From: Cris Di Sclafani Date: Wed, 7 Jul 2021 09:32:50 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.31 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=74b1d71f8fbaa9645baaa6f0b0e7a1febc980692;p=motion2.git Built motion from commit (unavailable).|2.5.31 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 344f6ab..225aeea 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-07-07T08:59:45.090Z", + "time": "2021-07-07T09:24:20.001Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 7ad75b5..90a0d57 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-07-07T08:59:45.090Z", + "time": "2021-07-07T09:24:20.001Z", "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 e9d71ab..4de476c 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 _0xfe4d=['integration','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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]','sequelize','VIRTUAL','action','STRING'];(function(_0x2b737c,_0x274adf){var _0x466ed5=function(_0x593124){while(--_0x593124){_0x2b737c['push'](_0x2b737c['shift']());}};_0x466ed5(++_0x274adf);}(_0xfe4d,0x168));var _0xdfe4=function(_0x3cc6b4,_0x58b1aa){_0x3cc6b4=_0x3cc6b4-0x0;var _0x1c07b8=_0xfe4d[_0x3cc6b4];return _0x1c07b8;};'use strict';var Sequelize=require(_0xdfe4('0x0'));module['exports']={'name':{'type':Sequelize[_0xdfe4('0x1')],'get':function(_0x452372){return this['getDataValue'](_0xdfe4('0x2'));}},'action':{'type':Sequelize[_0xdfe4('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xdfe4('0x4'),'motionbar',_0xdfe4('0x5'),_0xdfe4('0x6'),'browser',_0xdfe4('0x7'),_0xdfe4('0x8')]],'msg':_0xdfe4('0x9')}},'comment':_0xdfe4('0x9')},'data1':{'type':Sequelize[_0xdfe4('0x3')](0x1000),'comment':_0xdfe4('0xa')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xdfe4('0xb')},'data3':{'type':Sequelize[_0xdfe4('0x3')](0x1000),'comment':_0xdfe4('0xc')},'data4':{'type':Sequelize[_0xdfe4('0x3')](0x1000)},'data5':{'type':Sequelize[_0xdfe4('0x3')](0x1000)},'data6':{'type':Sequelize[_0xdfe4('0x3')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xbeb2=['getDataValue','STRING','contactManager','integration','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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'];(function(_0x2e5801,_0x104997){var _0x164605=function(_0x218b22){while(--_0x218b22){_0x2e5801['push'](_0x2e5801['shift']());}};_0x164605(++_0x104997);}(_0xbeb2,0x16e));var _0x2beb=function(_0x5b8526,_0x9b6cc9){_0x5b8526=_0x5b8526-0x0;var _0x839211=_0xbeb2[_0x5b8526];return _0x839211;};'use strict';var Sequelize=require(_0x2beb('0x0'));module[_0x2beb('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x463e75){return this[_0x2beb('0x2')]('action');}},'action':{'type':Sequelize[_0x2beb('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x2beb('0x4'),_0x2beb('0x5'),'motionbar',_0x2beb('0x6'),_0x2beb('0x7'),_0x2beb('0x8'),_0x2beb('0x9'),_0x2beb('0xa')]],'msg':_0x2beb('0xb')}},'comment':_0x2beb('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x2beb('0xc')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x2beb('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x2beb('0xe')},'data4':{'type':Sequelize[_0x2beb('0x3')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x2beb('0x3')]},'data7':{'type':Sequelize[_0x2beb('0xf')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 7aef12a..bffc3bd 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 _0xcc92=['params','catch','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','reject','save','update','then','destroy','error','stack','name','render','merge','body','contact','message','agent','interaction','account','Action'];(function(_0x2e1cb8,_0x2256e6){var _0x4300fc=function(_0x31aa91){while(--_0x31aa91){_0x2e1cb8['push'](_0x2e1cb8['shift']());}};_0x4300fc(++_0x2256e6);}(_0xcc92,0x141));var _0x2cc9=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xcc92[_0x257642];return _0x3d813b;};'use strict';var emlformat=require(_0x2cc9('0x0'));var rimraf=require(_0x2cc9('0x1'));var zipdir=require(_0x2cc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cc9('0x3'));var moment=require(_0x2cc9('0x4'));var BPromise=require(_0x2cc9('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2cc9('0x6'));var sox=require(_0x2cc9('0x7'));var csv=require('to-csv');var ejs=require(_0x2cc9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cc9('0x9'));var squel=require(_0x2cc9('0xa'));var crypto=require(_0x2cc9('0xb'));var jsforce=require(_0x2cc9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2cc9('0xd'));var querystring=require('querystring');var Papa=require(_0x2cc9('0xe'));var Redis=require(_0x2cc9('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2cc9('0x10'));var hardwareService=require(_0x2cc9('0x11'));var logger=require(_0x2cc9('0x12'))(_0x2cc9('0x13'));var utils=require(_0x2cc9('0x14'));var config=require(_0x2cc9('0x15'));var licenseUtil=require(_0x2cc9('0x16'));var db=require(_0x2cc9('0x17'))['db'];function respondWithStatusCode(_0x45c46e,_0x315273){_0x315273=_0x315273||0xcc;return function(_0x27bccc){if(_0x27bccc){return _0x45c46e[_0x2cc9('0x18')](_0x315273);}return _0x45c46e['status'](_0x315273)[_0x2cc9('0x19')]();};}function respondWithResult(_0x45a3d4,_0x149488){_0x149488=_0x149488||0xc8;return function(_0x22237e){if(_0x22237e){return _0x45a3d4['status'](_0x149488)[_0x2cc9('0x1a')](_0x22237e);}};}function respondWithFilteredResult(_0x29b974,_0x3c380c){return function(_0x39aa00){if(_0x39aa00){var _0x58ec11=typeof _0x3c380c[_0x2cc9('0x1b')]===_0x2cc9('0x1c')&&typeof _0x3c380c[_0x2cc9('0x1d')]==='undefined';var _0x16051c=_0x39aa00[_0x2cc9('0x1e')];var _0x53ec15=_0x58ec11?0x0:_0x3c380c['offset'];var _0x1311a5=_0x58ec11?_0x39aa00['count']:_0x3c380c[_0x2cc9('0x1b')]+_0x3c380c['limit'];var _0x18b98f;if(_0x1311a5>=_0x16051c){_0x1311a5=_0x16051c;_0x18b98f=0xc8;}else{_0x18b98f=0xce;}_0x29b974[_0x2cc9('0x1f')](_0x18b98f);return _0x29b974[_0x2cc9('0x20')]('Content-Range',_0x53ec15+'-'+_0x1311a5+'/'+_0x16051c)[_0x2cc9('0x1a')](_0x39aa00);}return null;};}function patchUpdates(_0x3b68b4){return function(_0x155abb){try{jsonpatch['apply'](_0x155abb,_0x3b68b4,!![]);}catch(_0x48e0fa){return BPromise[_0x2cc9('0x21')](_0x48e0fa);}return _0x155abb[_0x2cc9('0x22')]();};}function saveUpdates(_0x4c04e5,_0x46b79a){return function(_0x327b90){if(_0x327b90){return _0x327b90[_0x2cc9('0x23')](_0x4c04e5)[_0x2cc9('0x24')](function(_0x26e21a){return _0x26e21a;});}return null;};}function removeEntity(_0x3d2268,_0x565ece){return function(_0x1ed11a){if(_0x1ed11a){return _0x1ed11a[_0x2cc9('0x25')]()[_0x2cc9('0x24')](function(){_0x3d2268[_0x2cc9('0x1f')](0xcc)[_0x2cc9('0x19')]();});}};}function handleEntityNotFound(_0x3b9f47,_0x57f8ae){return function(_0x3267d8){if(!_0x3267d8){_0x3b9f47[_0x2cc9('0x18')](0x194);}return _0x3267d8;};}function handleError(_0x3bbf51,_0x5a456e){_0x5a456e=_0x5a456e||0x1f4;return function(_0x38a88c){logger[_0x2cc9('0x26')](_0x38a88c[_0x2cc9('0x27')]);if(_0x38a88c[_0x2cc9('0x28')]){delete _0x38a88c[_0x2cc9('0x28')];}_0x3bbf51[_0x2cc9('0x1f')](_0x5a456e)['send'](_0x38a88c);};}function getMustacheRender(_0x4790bb,_0x4f16ad){return Mustache[_0x2cc9('0x29')](_0x4790bb,_[_0x2cc9('0x2a')](_0x4f16ad[_0x2cc9('0x2b')],{'contact':_0x4f16ad[_0x2cc9('0x2c')],'message':_0x4f16ad[_0x2cc9('0x2d')],'agent':_0x4f16ad[_0x2cc9('0x2e')],'interaction':_0x4f16ad[_0x2cc9('0x2f')],'account':_0x4f16ad[_0x2cc9('0x30')]}))||'';}exports[_0x2cc9('0x23')]=function(_0x2bc6b9,_0x3d8928){if(_0x2bc6b9[_0x2cc9('0x2b')]['id']){delete _0x2bc6b9[_0x2cc9('0x2b')]['id'];}return db[_0x2cc9('0x31')]['find']({'where':{'id':_0x2bc6b9[_0x2cc9('0x32')]['id']}})[_0x2cc9('0x24')](handleEntityNotFound(_0x3d8928,null))[_0x2cc9('0x24')](saveUpdates(_0x2bc6b9[_0x2cc9('0x2b')],null))['then'](respondWithResult(_0x3d8928,null))[_0x2cc9('0x33')](handleError(_0x3d8928,null));};exports['destroy']=function(_0x1a8dda,_0x12789b){return db[_0x2cc9('0x31')][_0x2cc9('0x34')]({'where':{'id':_0x1a8dda[_0x2cc9('0x32')]['id']}})[_0x2cc9('0x24')](handleEntityNotFound(_0x12789b,null))[_0x2cc9('0x24')](removeEntity(_0x12789b,null))[_0x2cc9('0x33')](handleError(_0x12789b,null));}; \ No newline at end of file +var _0x0abe=['apply','reject','save','update','error','stack','send','render','merge','body','contact','message','agent','interaction','account','find','then','destroy','Action','params','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x4b8df0,_0x5c59f1){var _0x2ad3fe=function(_0x2244ae){while(--_0x2244ae){_0x4b8df0['push'](_0x4b8df0['shift']());}};_0x2ad3fe(++_0x5c59f1);}(_0x0abe,0x188));var _0xe0ab=function(_0x45ceed,_0x55307){_0x45ceed=_0x45ceed-0x0;var _0x4099ab=_0x0abe[_0x45ceed];return _0x4099ab;};'use strict';var emlformat=require(_0xe0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0ab('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0ab('0x2'));var moment=require(_0xe0ab('0x3'));var BPromise=require(_0xe0ab('0x4'));var Mustache=require(_0xe0ab('0x5'));var util=require(_0xe0ab('0x6'));var path=require(_0xe0ab('0x7'));var sox=require(_0xe0ab('0x8'));var csv=require('to-csv');var ejs=require(_0xe0ab('0x9'));var fs=require('fs');var fs_extra=require(_0xe0ab('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0ab('0xb'));var deskjs=require(_0xe0ab('0xc'));var toCsv=require(_0xe0ab('0xd'));var querystring=require('querystring');var Papa=require(_0xe0ab('0xe'));var Redis=require(_0xe0ab('0xf'));var authService=require(_0xe0ab('0x10'));var qs=require(_0xe0ab('0x11'));var as=require(_0xe0ab('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe0ab('0x13'));var utils=require('../../config/utils');var config=require(_0xe0ab('0x14'));var licenseUtil=require(_0xe0ab('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11ba06,_0x5aa1dc){_0x5aa1dc=_0x5aa1dc||0xcc;return function(_0x2d2812){if(_0x2d2812){return _0x11ba06[_0xe0ab('0x16')](_0x5aa1dc);}return _0x11ba06[_0xe0ab('0x17')](_0x5aa1dc)[_0xe0ab('0x18')]();};}function respondWithResult(_0x14d5ad,_0x5e0331){_0x5e0331=_0x5e0331||0xc8;return function(_0x536712){if(_0x536712){return _0x14d5ad[_0xe0ab('0x17')](_0x5e0331)[_0xe0ab('0x19')](_0x536712);}};}function respondWithFilteredResult(_0x59f487,_0x10fe05){return function(_0x12cce8){if(_0x12cce8){var _0x572f13=typeof _0x10fe05[_0xe0ab('0x1a')]===_0xe0ab('0x1b')&&typeof _0x10fe05['limit']===_0xe0ab('0x1b');var _0x2ed515=_0x12cce8[_0xe0ab('0x1c')];var _0x30fe41=_0x572f13?0x0:_0x10fe05[_0xe0ab('0x1a')];var _0x214b5a=_0x572f13?_0x12cce8[_0xe0ab('0x1c')]:_0x10fe05[_0xe0ab('0x1a')]+_0x10fe05[_0xe0ab('0x1d')];var _0x10e882;if(_0x214b5a>=_0x2ed515){_0x214b5a=_0x2ed515;_0x10e882=0xc8;}else{_0x10e882=0xce;}_0x59f487['status'](_0x10e882);return _0x59f487[_0xe0ab('0x1e')](_0xe0ab('0x1f'),_0x30fe41+'-'+_0x214b5a+'/'+_0x2ed515)[_0xe0ab('0x19')](_0x12cce8);}return null;};}function patchUpdates(_0x5853dc){return function(_0x10569a){try{jsonpatch[_0xe0ab('0x20')](_0x10569a,_0x5853dc,!![]);}catch(_0x816d3e){return BPromise[_0xe0ab('0x21')](_0x816d3e);}return _0x10569a[_0xe0ab('0x22')]();};}function saveUpdates(_0x13321f,_0x4cd955){return function(_0x192bdb){if(_0x192bdb){return _0x192bdb[_0xe0ab('0x23')](_0x13321f)['then'](function(_0x395c20){return _0x395c20;});}return null;};}function removeEntity(_0x1650c3,_0x1c85f1){return function(_0x5ebb27){if(_0x5ebb27){return _0x5ebb27['destroy']()['then'](function(){_0x1650c3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x757f41,_0x54d607){return function(_0x497833){if(!_0x497833){_0x757f41[_0xe0ab('0x16')](0x194);}return _0x497833;};}function handleError(_0x1ac0c4,_0x5b2e35){_0x5b2e35=_0x5b2e35||0x1f4;return function(_0x5a2c1b){logger[_0xe0ab('0x24')](_0x5a2c1b[_0xe0ab('0x25')]);if(_0x5a2c1b['name']){delete _0x5a2c1b['name'];}_0x1ac0c4[_0xe0ab('0x17')](_0x5b2e35)[_0xe0ab('0x26')](_0x5a2c1b);};}function getMustacheRender(_0x304fa4,_0xa0e1c9){return Mustache[_0xe0ab('0x27')](_0x304fa4,_[_0xe0ab('0x28')](_0xa0e1c9[_0xe0ab('0x29')],{'contact':_0xa0e1c9[_0xe0ab('0x2a')],'message':_0xa0e1c9[_0xe0ab('0x2b')],'agent':_0xa0e1c9[_0xe0ab('0x2c')],'interaction':_0xa0e1c9[_0xe0ab('0x2d')],'account':_0xa0e1c9[_0xe0ab('0x2e')]}))||'';}exports['update']=function(_0x3d69ef,_0x4828ef){if(_0x3d69ef[_0xe0ab('0x29')]['id']){delete _0x3d69ef[_0xe0ab('0x29')]['id'];}return db['Action'][_0xe0ab('0x2f')]({'where':{'id':_0x3d69ef['params']['id']}})[_0xe0ab('0x30')](handleEntityNotFound(_0x4828ef,null))[_0xe0ab('0x30')](saveUpdates(_0x3d69ef[_0xe0ab('0x29')],null))[_0xe0ab('0x30')](respondWithResult(_0x4828ef,null))['catch'](handleError(_0x4828ef,null));};exports[_0xe0ab('0x31')]=function(_0x3cc202,_0x21a824){return db[_0xe0ab('0x32')][_0xe0ab('0x2f')]({'where':{'id':_0x3cc202[_0xe0ab('0x33')]['id']}})[_0xe0ab('0x30')](handleEntityNotFound(_0x21a824,null))['then'](removeEntity(_0x21a824,null))[_0xe0ab('0x34')](handleError(_0x21a824,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index df2ba78..a8fa7ba 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 _0xc9b2=['bluebird','path','rimraf','../../config/environment','./action.attributes','define','tools_actions','util','../../config/logger','api'];(function(_0x5a3138,_0x2667fd){var _0x232d67=function(_0x2a2812){while(--_0x2a2812){_0x5a3138['push'](_0x5a3138['shift']());}};_0x232d67(++_0x2667fd);}(_0xc9b2,0x1e7));var _0x2c9b=function(_0x58223e,_0x1757af){_0x58223e=_0x58223e-0x0;var _0x3045b2=_0xc9b2[_0x58223e];return _0x3045b2;};'use strict';var _=require('lodash');var util=require(_0x2c9b('0x0'));var logger=require(_0x2c9b('0x1'))(_0x2c9b('0x2'));var moment=require('moment');var BPromise=require(_0x2c9b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c9b('0x4'));var rimraf=require(_0x2c9b('0x5'));var config=require(_0x2c9b('0x6'));var attributes=require(_0x2c9b('0x7'));module['exports']=function(_0x48ab53,_0xd7b918){return _0x48ab53[_0x2c9b('0x8')]('Action',attributes,{'tableName':_0x2c9b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8189=['exports','define','Action','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x13d49e,_0x2c9cac){var _0x4660f4=function(_0x1091cb){while(--_0x1091cb){_0x13d49e['push'](_0x13d49e['shift']());}};_0x4660f4(++_0x2c9cac);}(_0x8189,0x66));var _0x9818=function(_0x40051c,_0x5d563c){_0x40051c=_0x40051c-0x0;var _0x1d3f8b=_0x8189[_0x40051c];return _0x1d3f8b;};'use strict';var _=require(_0x9818('0x0'));var util=require(_0x9818('0x1'));var logger=require('../../config/logger')(_0x9818('0x2'));var moment=require('moment');var BPromise=require(_0x9818('0x3'));var rp=require(_0x9818('0x4'));var fs=require('fs');var path=require(_0x9818('0x5'));var rimraf=require(_0x9818('0x6'));var config=require(_0x9818('0x7'));var attributes=require('./action.attributes');module[_0x9818('0x8')]=function(_0x5d8d1f,_0x447550){return _0x5d8d1f[_0x9818('0x9')](_0x9818('0xa'),attributes,{'tableName':'tools_actions','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 f59b015..b2b26a9 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 _0xbaf0=['client','http','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Action,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0xb7e7=['Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x1bbfb6,_0x1bf29f){var _0x3a38c6=function(_0x1a3249){while(--_0x1a3249){_0x1bbfb6['push'](_0x1bbfb6['shift']());}};_0x3a38c6(++_0x1bf29f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xb7e7[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Action,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 3cc7b8c..02a2b70 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 _0x7883=['/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x7883,0x1b6));var _0x3788=function(_0x155329,_0x1dc4bb){_0x155329=_0x155329-0x0;var _0x4ee0b8=_0x7883[_0x155329];return _0x4ee0b8;};'use strict';var multer=require(_0x3788('0x0'));var util=require('util');var path=require(_0x3788('0x1'));var timeout=require(_0x3788('0x2'));var express=require(_0x3788('0x3'));var router=express[_0x3788('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3788('0x5'));var interaction=require(_0x3788('0x6'));var config=require(_0x3788('0x7'));var controller=require(_0x3788('0x8'));router[_0x3788('0x9')](_0x3788('0xa'),auth[_0x3788('0xb')](),controller[_0x3788('0xc')]);router[_0x3788('0xd')]('/:id',auth[_0x3788('0xb')](),controller[_0x3788('0xe')]);module[_0x3788('0xf')]=router; \ No newline at end of file +var _0x8f7c=['../../components/interaction/service','put','isAuthenticated','update','delete','/:id','destroy','exports','multer','util','express','fs-extra','../../components/auth/service'];(function(_0x4429e0,_0xee6f1f){var _0x51a5b3=function(_0x16eb11){while(--_0x16eb11){_0x4429e0['push'](_0x4429e0['shift']());}};_0x51a5b3(++_0xee6f1f);}(_0x8f7c,0x133));var _0xc8f7=function(_0x58b603,_0x450f6d){_0x58b603=_0x58b603-0x0;var _0xf76126=_0x8f7c[_0x58b603];return _0xf76126;};'use strict';var multer=require(_0xc8f7('0x0'));var util=require(_0xc8f7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc8f7('0x2'));var router=express['Router']();var fs_extra=require(_0xc8f7('0x3'));var auth=require(_0xc8f7('0x4'));var interaction=require(_0xc8f7('0x5'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0xc8f7('0x6')]('/:id',auth[_0xc8f7('0x7')](),controller[_0xc8f7('0x8')]);router[_0xc8f7('0x9')](_0xc8f7('0xa'),auth[_0xc8f7('0x7')](),controller[_0xc8f7('0xb')]);module[_0xc8f7('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index d2e4ae1..439faf9 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 _0x9b7d=['exports','STRING','TEXT','sequelize'];(function(_0x4647f4,_0xb0fe7a){var _0x14fabf=function(_0x31014b){while(--_0x31014b){_0x4647f4['push'](_0x4647f4['shift']());}};_0x14fabf(++_0xb0fe7a);}(_0x9b7d,0x1df));var _0xd9b7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9b7d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xd9b7('0x0'));module[_0xd9b7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd9b7('0x2')]},'parent':{'type':Sequelize[_0xd9b7('0x2')]},'table':{'type':Sequelize[_0xd9b7('0x2')]},'conditions':{'type':Sequelize[_0xd9b7('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe5c7=['TEXT','sequelize','STRING'];(function(_0x52b88f,_0x16d90d){var _0x42da99=function(_0x37533f){while(--_0x37533f){_0x52b88f['push'](_0x52b88f['shift']());}};_0x42da99(++_0x16d90d);}(_0xe5c7,0x1cf));var _0x7e5c=function(_0x2b8063,_0x27b6de){_0x2b8063=_0x2b8063-0x0;var _0x440ae3=_0xe5c7[_0x2b8063];return _0x440ae3;};'use strict';var Sequelize=require(_0x7e5c('0x0'));module['exports']={'name':{'type':Sequelize[_0x7e5c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7e5c('0x1')]},'table':{'type':Sequelize[_0x7e5c('0x1')]},'conditions':{'type':Sequelize[_0x7e5c('0x2')]},'joins':{'type':Sequelize[_0x7e5c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 7180f17..b59831b 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 _0xb472=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','sendStatus','stack','name','send','render','merge','body','contact','agent','interaction','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','user','Reports','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','from','table','MetricId','metric','function','replace','format','groupBy','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','IS\x20NULL','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','orderBy','DESC','web','%s-%s.%s','output','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','ROUND(%s)','IS\x20NOT\x20EMPTY','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','papaparse','ioredis'];(function(_0x575a38,_0x2e83d7){var _0x5a7bdd=function(_0x1bf478){while(--_0x1bf478){_0x575a38['push'](_0x575a38['shift']());}};_0x5a7bdd(++_0x2e83d7);}(_0xb472,0x9b));var _0x2b47=function(_0x11aa4d,_0x4ef80f){_0x11aa4d=_0x11aa4d-0x0;var _0x5375b1=_0xb472[_0x11aa4d];return _0x5375b1;};'use strict';var emlformat=require(_0x2b47('0x0'));var rimraf=require(_0x2b47('0x1'));var zipdir=require(_0x2b47('0x2'));var jsonpatch=require(_0x2b47('0x3'));var rp=require(_0x2b47('0x4'));var moment=require(_0x2b47('0x5'));var BPromise=require(_0x2b47('0x6'));var Mustache=require(_0x2b47('0x7'));var util=require(_0x2b47('0x8'));var path=require(_0x2b47('0x9'));var sox=require(_0x2b47('0xa'));var csv=require(_0x2b47('0xb'));var ejs=require(_0x2b47('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b47('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b47('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2b47('0xb'));var querystring=require('querystring');var Papa=require(_0x2b47('0xf'));var Redis=require(_0x2b47('0x10'));var authService=require(_0x2b47('0x11'));var qs=require(_0x2b47('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b47('0x13'));var logger=require(_0x2b47('0x14'))(_0x2b47('0x15'));var utils=require(_0x2b47('0x16'));var config=require(_0x2b47('0x17'));var licenseUtil=require(_0x2b47('0x18'));var db=require(_0x2b47('0x19'))['db'];var dbH=require(_0x2b47('0x19'))['dbH'];function respondWithStatusCode(_0xe82592,_0x5cdecb){_0x5cdecb=_0x5cdecb||0xcc;return function(_0x2a6c27){if(_0x2a6c27){return _0xe82592['sendStatus'](_0x5cdecb);}return _0xe82592[_0x2b47('0x1a')](_0x5cdecb)[_0x2b47('0x1b')]();};}function respondWithResult(_0x2880c9,_0x4a0d0a){_0x4a0d0a=_0x4a0d0a||0xc8;return function(_0x5e27c6){if(_0x5e27c6){return _0x2880c9[_0x2b47('0x1a')](_0x4a0d0a)[_0x2b47('0x1c')](_0x5e27c6);}};}function respondWithFilteredResult(_0x14cd6b,_0x27e5fd){return function(_0x1663c1){if(_0x1663c1){var _0x430db9=typeof _0x27e5fd[_0x2b47('0x1d')]===_0x2b47('0x1e')&&typeof _0x27e5fd[_0x2b47('0x1f')]==='undefined';var _0x3a440c=_0x1663c1[_0x2b47('0x20')];var _0x1eacb0=_0x430db9?0x0:_0x27e5fd['offset'];var _0x4c72ef=_0x430db9?_0x1663c1[_0x2b47('0x20')]:_0x27e5fd[_0x2b47('0x1d')]+_0x27e5fd[_0x2b47('0x1f')];var _0x2917b4;if(_0x4c72ef>=_0x3a440c){_0x4c72ef=_0x3a440c;_0x2917b4=0xc8;}else{_0x2917b4=0xce;}_0x14cd6b[_0x2b47('0x1a')](_0x2917b4);return _0x14cd6b[_0x2b47('0x21')](_0x2b47('0x22'),_0x1eacb0+'-'+_0x4c72ef+'/'+_0x3a440c)[_0x2b47('0x1c')](_0x1663c1);}return null;};}function patchUpdates(_0x266927){return function(_0x4d070d){try{jsonpatch[_0x2b47('0x23')](_0x4d070d,_0x266927,!![]);}catch(_0x4dc329){return BPromise[_0x2b47('0x24')](_0x4dc329);}return _0x4d070d[_0x2b47('0x25')]();};}function saveUpdates(_0x5a8310,_0x25061e){return function(_0x30c02d){if(_0x30c02d){return _0x30c02d[_0x2b47('0x26')](_0x5a8310)[_0x2b47('0x27')](function(_0x2c461f){return _0x2c461f;});}return null;};}function removeEntity(_0x3dbd5d,_0x32519f){return function(_0x181cf8){if(_0x181cf8){return _0x181cf8[_0x2b47('0x28')]()[_0x2b47('0x27')](function(){var _0x3e375a=_0x181cf8[_0x2b47('0x29')]({'plain':!![]});var _0x40ccc7=_0x2b47('0x2a');return db[_0x2b47('0x2b')][_0x2b47('0x28')]({'where':{'type':_0x40ccc7,'resourceId':_0x3e375a['id']}})[_0x2b47('0x27')](function(){return _0x181cf8;});})[_0x2b47('0x27')](function(){_0x3dbd5d['status'](0xcc)[_0x2b47('0x1b')]();});}};}function handleEntityNotFound(_0x5d6d8c,_0x5dca18){return function(_0x37c894){if(!_0x37c894){_0x5d6d8c[_0x2b47('0x2c')](0x194);}return _0x37c894;};}function handleError(_0x382a2c,_0x21b1c9){_0x21b1c9=_0x21b1c9||0x1f4;return function(_0x3a2bc3){logger['error'](_0x3a2bc3[_0x2b47('0x2d')]);if(_0x3a2bc3['name']){delete _0x3a2bc3[_0x2b47('0x2e')];}_0x382a2c[_0x2b47('0x1a')](_0x21b1c9)[_0x2b47('0x2f')](_0x3a2bc3);};}function getMustacheRender(_0x2b9654,_0xb85ef1){return Mustache[_0x2b47('0x30')](_0x2b9654,_[_0x2b47('0x31')](_0xb85ef1[_0x2b47('0x32')],{'contact':_0xb85ef1[_0x2b47('0x33')],'message':_0xb85ef1['message'],'agent':_0xb85ef1[_0x2b47('0x34')],'interaction':_0xb85ef1[_0x2b47('0x35')],'account':_0xb85ef1['account']}))||'';}exports['index']=function(_0x43b587,_0x35b5ad){var _0xada2f3={},_0x3fdf95={},_0x517868={'count':0x0,'rows':[]};var _0x38ad9c=_[_0x2b47('0x36')](db[_0x2b47('0x37')][_0x2b47('0x38')],function(_0x484451){return{'name':_0x484451[_0x2b47('0x39')],'type':_0x484451[_0x2b47('0x3a')][_0x2b47('0x3b')]};});_0x3fdf95[_0x2b47('0x3c')]=_['map'](_0x38ad9c,_0x2b47('0x2e'));_0x3fdf95['query']=_[_0x2b47('0x3d')](_0x43b587[_0x2b47('0x3e')]);_0x3fdf95['filters']=_['intersection'](_0x3fdf95[_0x2b47('0x3c')],_0x3fdf95['query']);_0xada2f3[_0x2b47('0x3f')]=_[_0x2b47('0x40')](_0x3fdf95[_0x2b47('0x3c')],qs['fields'](_0x43b587[_0x2b47('0x3e')][_0x2b47('0x41')]));_0xada2f3[_0x2b47('0x3f')]=_0xada2f3[_0x2b47('0x3f')][_0x2b47('0x42')]?_0xada2f3['attributes']:_0x3fdf95[_0x2b47('0x3c')];if(!_0x43b587[_0x2b47('0x3e')]['hasOwnProperty'](_0x2b47('0x43'))){_0xada2f3['limit']=qs['limit'](_0x43b587[_0x2b47('0x3e')][_0x2b47('0x1f')]);_0xada2f3[_0x2b47('0x1d')]=qs[_0x2b47('0x1d')](_0x43b587[_0x2b47('0x3e')]['offset']);}_0xada2f3[_0x2b47('0x44')]=qs[_0x2b47('0x45')](_0x43b587[_0x2b47('0x3e')][_0x2b47('0x45')]);_0xada2f3[_0x2b47('0x46')]=qs['filters'](_[_0x2b47('0x47')](_0x43b587[_0x2b47('0x3e')],_0x3fdf95[_0x2b47('0x48')]),_0x38ad9c);if(_0x43b587[_0x2b47('0x3e')][_0x2b47('0x49')]){_0xada2f3[_0x2b47('0x46')]=_[_0x2b47('0x31')](_0xada2f3[_0x2b47('0x46')],{'$or':_[_0x2b47('0x36')](_0x38ad9c,function(_0x5c6695){if(_0x5c6695[_0x2b47('0x3a')]!==_0x2b47('0x4a')){var _0x395d39={};_0x395d39[_0x5c6695[_0x2b47('0x2e')]]={'$like':'%'+_0x43b587['query'][_0x2b47('0x49')]+'%'};return _0x395d39;}})});}_0xada2f3=_[_0x2b47('0x31')]({},_0xada2f3,_0x43b587[_0x2b47('0x4b')]);var _0x485129={'where':_0xada2f3['where']};return db['AnalyticCustomReport'][_0x2b47('0x20')](_0x485129)[_0x2b47('0x27')](function(_0x509127){_0x517868[_0x2b47('0x20')]=_0x509127;if(_0x43b587[_0x2b47('0x3e')][_0x2b47('0x4c')]){_0xada2f3[_0x2b47('0x4d')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x2b47('0x4e')](_0xada2f3);})[_0x2b47('0x27')](function(_0x367eb1){_0x517868[_0x2b47('0x4f')]=_0x367eb1;return _0x517868;})[_0x2b47('0x27')](respondWithFilteredResult(_0x35b5ad,_0xada2f3))[_0x2b47('0x50')](handleError(_0x35b5ad,null));};exports[_0x2b47('0x51')]=function(_0x596534,_0x570798){var _0x465415={'raw':![],'where':{'id':_0x596534[_0x2b47('0x52')]['id']}},_0x563f1c={};_0x563f1c[_0x2b47('0x3c')]=_['keys'](db[_0x2b47('0x37')][_0x2b47('0x38')]);_0x563f1c[_0x2b47('0x3e')]=_[_0x2b47('0x3d')](_0x596534[_0x2b47('0x3e')]);_0x563f1c['filters']=_[_0x2b47('0x40')](_0x563f1c['model'],_0x563f1c['query']);_0x465415['attributes']=_[_0x2b47('0x40')](_0x563f1c['model'],qs['fields'](_0x596534[_0x2b47('0x3e')][_0x2b47('0x41')]));_0x465415[_0x2b47('0x3f')]=_0x465415[_0x2b47('0x3f')][_0x2b47('0x42')]?_0x465415[_0x2b47('0x3f')]:_0x563f1c['model'];if(_0x596534[_0x2b47('0x3e')][_0x2b47('0x4c')]){_0x465415[_0x2b47('0x4d')]=[{'all':!![]}];}_0x465415=_[_0x2b47('0x31')]({},_0x465415,_0x596534['options']);return db['AnalyticCustomReport']['find'](_0x465415)[_0x2b47('0x27')](handleEntityNotFound(_0x570798,null))[_0x2b47('0x27')](respondWithResult(_0x570798,null))['catch'](handleError(_0x570798,null));};exports[_0x2b47('0x53')]=function(_0x423804,_0x2fef18){return db[_0x2b47('0x37')][_0x2b47('0x53')](_0x423804[_0x2b47('0x32')],{})[_0x2b47('0x27')](function(_0x14407d){var _0x56921f=_0x423804[_0x2b47('0x54')][_0x2b47('0x29')]({'plain':!![]});if(!_0x56921f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56921f['role']===_0x2b47('0x54')){var _0x21c3ae=_0x14407d[_0x2b47('0x29')]({'plain':!![]});var _0x361d36=_0x2b47('0x55');return db[_0x2b47('0x56')][_0x2b47('0x57')]({'where':{'name':_0x361d36,'userProfileId':_0x56921f[_0x2b47('0x58')]},'raw':!![]})[_0x2b47('0x27')](function(_0x3c4c8f){if(_0x3c4c8f&&_0x3c4c8f[_0x2b47('0x59')]===0x0){return db['UserProfileResource']['create']({'name':_0x21c3ae[_0x2b47('0x2e')],'resourceId':_0x21c3ae['id'],'type':_0x2b47('0x2a'),'sectionId':_0x3c4c8f['id']},{})[_0x2b47('0x27')](function(){return _0x14407d;});}else{return _0x14407d;}})[_0x2b47('0x50')](function(_0x4b9572){logger[_0x2b47('0x5a')](_0x2b47('0x5b'),_0x4b9572);throw _0x4b9572;});}return _0x14407d;})[_0x2b47('0x27')](respondWithResult(_0x2fef18,0xc9))['catch'](handleError(_0x2fef18,null));};exports[_0x2b47('0x26')]=function(_0x2261c7,_0x17bf9e){if(_0x2261c7[_0x2b47('0x32')]['id']){delete _0x2261c7[_0x2b47('0x32')]['id'];}return db['AnalyticCustomReport'][_0x2b47('0x57')]({'where':{'id':_0x2261c7[_0x2b47('0x52')]['id']}})[_0x2b47('0x27')](handleEntityNotFound(_0x17bf9e,null))[_0x2b47('0x27')](saveUpdates(_0x2261c7['body'],null))[_0x2b47('0x27')](respondWithResult(_0x17bf9e,null))[_0x2b47('0x50')](handleError(_0x17bf9e,null));};exports[_0x2b47('0x28')]=function(_0x4ded0b,_0x39cd9b){return db['AnalyticCustomReport'][_0x2b47('0x57')]({'where':{'id':_0x4ded0b[_0x2b47('0x52')]['id']}})['then'](handleEntityNotFound(_0x39cd9b,null))['then'](removeEntity(_0x39cd9b,null))[_0x2b47('0x50')](handleError(_0x39cd9b,null));};exports['preview']=function(_0x355c50,_0x1dd7e6){var _0x17b8b5=0xa;var _0xa22f68=[_0x2b47('0x5c'),_0x2b47('0x5d'),_0x2b47('0x5e'),_0x2b47('0x5f')];var _0x145eab={'SUM':_0x2b47('0x60'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2b47('0x61'),'MAX':_0x2b47('0x62'),'MIN':_0x2b47('0x63'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x2b47('0x64'),'GROUP_CONCAT ASC':_0x2b47('0x65'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x325533={'SEC_TO_TIME':_0x2b47('0x66'),'DATE':'DATE(%s)','HOUR':_0x2b47('0x67'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x2b47('0x68')};var _0x360c71=function(_0x2ffe46){return!_[_0x2b47('0x69')](['IS\x20NULL',_0x2b47('0x6a'),_0x2b47('0x6b'),'IS\x20NOT\x20EMPTY'],_0x2ffe46);};var _0x198799=function(_0x20559d){if(!_0x20559d||!_0x20559d['rules'][_0x2b47('0x42')]){return'';}for(var _0x2d4dbe='(',_0x5ad2e6=0x0;_0x5ad2e6<_0x20559d[_0x2b47('0x6c')][_0x2b47('0x42')];_0x5ad2e6+=0x1){_0x5ad2e6>0x0&&(_0x2d4dbe+='\x20'+_0x20559d[_0x2b47('0x6d')]+'\x20');_0x2d4dbe+=_0x20559d[_0x2b47('0x6c')][_0x5ad2e6][_0x2b47('0x6e')]?_0x198799(_0x20559d[_0x2b47('0x6c')][_0x5ad2e6][_0x2b47('0x6e')]):_0x20559d['rules'][_0x5ad2e6][_0x2b47('0x6f')]+'\x20'+_0x20559d[_0x2b47('0x6c')][_0x5ad2e6][_0x2b47('0x70')]+(_0x360c71(_0x20559d[_0x2b47('0x6c')][_0x5ad2e6][_0x2b47('0x70')])?'\x20'+_0x20559d[_0x2b47('0x6c')][_0x5ad2e6][_0x2b47('0x71')]:'');}return _0x2d4dbe+')';};var _0x25bd6a={'where':{'id':_0x355c50['params']['id']}},_0x5c4001,_0xc5cb20,_0xd2bce6,_0x41d65,_0x411ffe;_0x25bd6a=_[_0x2b47('0x31')]({},_0x25bd6a,_0x355c50[_0x2b47('0x4b')]);return db['AnalyticCustomReport'][_0x2b47('0x57')](_0x25bd6a)['then'](function(_0x7b4645){if(_0x7b4645){_0x5c4001=_0x7b4645;return _0x7b4645[_0x2b47('0x72')]();}return null;})['then'](function(_0x35d01e){if(_0x35d01e){if(!_0x35d01e[_0x2b47('0x42')]){throw new db[(_0x2b47('0x73'))][(_0x2b47('0x74'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xc5cb20=_0x35d01e;return db[_0x2b47('0x75')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x57624f){if(_0x57624f){_0xd2bce6=_['keyBy'](_0x57624f,'id');var _0x6a9431;var _0x410872=squel['select']();_0x410872[_0x2b47('0x76')](_0x5c4001[_0x2b47('0x77')]);for(var _0x5619e0=0x0;_0x5619e0<_0xc5cb20['length'];_0x5619e0+=0x1){_0x6a9431=_0xc5cb20[_0x5619e0][_0x2b47('0x78')]?_0xd2bce6[_0xc5cb20[_0x5619e0][_0x2b47('0x78')]][_0x2b47('0x79')]:_0xc5cb20[_0x5619e0][_0x2b47('0x6f')];_0x6a9431=_0xc5cb20[_0x5619e0][_0x2b47('0x7a')]?_[_0x2b47('0x7b')](_0x145eab[_0xc5cb20[_0x5619e0][_0x2b47('0x7a')]],'%s',_0x6a9431):_0x6a9431;_0x6a9431=_0xc5cb20[_0x5619e0][_0x2b47('0x7c')]?_['replace'](_0x325533[_0xc5cb20[_0x5619e0][_0x2b47('0x7c')]],'%s',_0x6a9431):_0x6a9431;if(_0xc5cb20[_0x5619e0][_0x2b47('0x7d')]){_0x410872['group'](_0x6a9431);}_0xc5cb20[_0x5619e0]['orderBy']&&_0x410872[_0x2b47('0x44')](_0x6a9431,_0xc5cb20[_0x5619e0]['orderBy']==='DESC'?![]:!![]);_0x410872[_0x2b47('0x6f')](_0x6a9431,_0xc5cb20[_0x5619e0][_0x2b47('0x7e')]||_0x6a9431);}if(_0x5c4001[_0x2b47('0x7f')]){_0x5c4001[_0x2b47('0x7f')]=JSON[_0x2b47('0x80')](_0x5c4001[_0x2b47('0x7f')]);for(var _0x3a15ff=0x0;_0x3a15ff<_0x5c4001['joins'][_0x2b47('0x42')];_0x3a15ff+=0x1){if(_0x5c4001[_0x2b47('0x7f')][_0x3a15ff][_0x2b47('0x3a')]&&_['includes'](_0xa22f68,_0x5c4001['joins'][_0x3a15ff][_0x2b47('0x3a')])&&_0x5c4001[_0x2b47('0x7f')][_0x3a15ff][_0x2b47('0x81')]&&_0x5c4001[_0x2b47('0x7f')][_0x3a15ff][_0x2b47('0x82')]&&_0x5c4001[_0x2b47('0x7f')][_0x3a15ff][_0x2b47('0x83')]){_0x410872[_0x5c4001[_0x2b47('0x7f')][_0x3a15ff][_0x2b47('0x3a')]](_0x5c4001[_0x2b47('0x7f')][_0x3a15ff]['foreignTable'],null,util['format'](_0x2b47('0x84'),_0x5c4001[_0x2b47('0x77')],_0x5c4001[_0x2b47('0x7f')][_0x3a15ff]['parentKey'],_0x5c4001[_0x2b47('0x7f')][_0x3a15ff][_0x2b47('0x82')],_0x5c4001['joins'][_0x3a15ff][_0x2b47('0x83')]));}}}if(_0x5c4001[_0x2b47('0x85')]){_0x5c4001[_0x2b47('0x85')]=JSON[_0x2b47('0x80')](_0x5c4001['conditions']);_0x410872[_0x2b47('0x46')](_0x198799(_0x5c4001[_0x2b47('0x85')][_0x2b47('0x6e')]));}_0x411ffe=_0x410872[_0x2b47('0x86')]();_0x410872[_0x2b47('0x1f')](_0x17b8b5);_0x410872['offset'](0x0);logger[_0x2b47('0x87')](_0x2b47('0x88'),_0x410872['toString']());return dbH[_0x2b47('0x89')][_0x2b47('0x3e')](_0x410872[_0x2b47('0x8a')](),{'type':dbH['sequelize'][_0x2b47('0x8b')][_0x2b47('0x8c')]});}})[_0x2b47('0x27')](respondWithResult(_0x1dd7e6,null))[_0x2b47('0x50')](handleError(_0x1dd7e6,null));};function runReport(_0x3f73ce,_0x3bdfe4,_0x1f0004){var _0x85a354=_0x3bdfe4['name'];var _0x330f2c=0xa;var _0x1b9c27=[_0x2b47('0x5c'),'left_join',_0x2b47('0x5e'),_0x2b47('0x5f')];var _0x4377f7={'SUM':_0x2b47('0x60'),'COUNT':_0x2b47('0x8d'),'COUNT DISTINCT':_0x2b47('0x61'),'MAX':'MAX(%s)','MIN':_0x2b47('0x63'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x2b47('0x64'),'GROUP_CONCAT ASC':_0x2b47('0x65'),'GROUP_CONCAT DESC':_0x2b47('0x8e')};var _0x5540dc={'SEC_TO_TIME':_0x2b47('0x66'),'DATE':_0x2b47('0x8f'),'HOUR':_0x2b47('0x67'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x2b47('0x68')};var _0x59409b=function(_0x5e4459){return!_['includes']([_0x2b47('0x90'),_0x2b47('0x6a'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x5e4459);};var _0xaf5678=function(_0x3750a1){if(!_0x3750a1||!_0x3750a1[_0x2b47('0x6c')][_0x2b47('0x42')]){return'';}for(var _0x2643a2='(',_0x2e558c=0x0;_0x2e558c<_0x3750a1[_0x2b47('0x6c')][_0x2b47('0x42')];_0x2e558c+=0x1){_0x2e558c>0x0&&(_0x2643a2+='\x20'+_0x3750a1[_0x2b47('0x6d')]+'\x20');_0x2643a2+=_0x3750a1[_0x2b47('0x6c')][_0x2e558c][_0x2b47('0x6e')]?_0xaf5678(_0x3750a1['rules'][_0x2e558c]['group']):_0x3750a1[_0x2b47('0x6c')][_0x2e558c][_0x2b47('0x6f')]+'\x20'+_0x3750a1[_0x2b47('0x6c')][_0x2e558c][_0x2b47('0x70')]+(_0x59409b(_0x3750a1[_0x2b47('0x6c')][_0x2e558c]['condition'])?'\x20'+_0x3750a1['rules'][_0x2e558c][_0x2b47('0x71')]:'');}return _0x2643a2+')';};var _0x1ab34d={'where':{'id':_0x3f73ce['id']}},_0x1e0a5f,_0x314445,_0x14a1e8,_0x512951,_0x13c3f9;_0x1ab34d=_['merge']({},_0x1ab34d,_0x1f0004);return db[_0x2b47('0x37')][_0x2b47('0x57')](_0x1ab34d)['then'](function(_0x26cfd3){if(_0x26cfd3){_0x1e0a5f=_0x26cfd3;return _0x26cfd3[_0x2b47('0x72')]();}return null;})[_0x2b47('0x27')](function(_0x5be417){if(_0x5be417){if(!_0x5be417[_0x2b47('0x42')]){throw new db[(_0x2b47('0x73'))][(_0x2b47('0x74'))](_0x2b47('0x91'),0x193);}_0x314445=_0x5be417;return db[_0x2b47('0x75')]['findAll']({'raw':!![]});}return null;})[_0x2b47('0x27')](function(_0x7185c9){if(_0x7185c9){_0x14a1e8=_[_0x2b47('0x92')](_0x7185c9,'id');var _0x4d097a;var _0x1b1211=squel[_0x2b47('0x93')]();_0x1b1211['from'](_0x1e0a5f['table']);for(var _0x654ccb=0x0;_0x654ccb<_0x314445['length'];_0x654ccb+=0x1){_0x4d097a=_0x314445[_0x654ccb][_0x2b47('0x78')]?_0x14a1e8[_0x314445[_0x654ccb][_0x2b47('0x78')]][_0x2b47('0x79')]:_0x314445[_0x654ccb][_0x2b47('0x6f')];_0x4d097a=_0x314445[_0x654ccb][_0x2b47('0x7a')]?_['replace'](_0x4377f7[_0x314445[_0x654ccb][_0x2b47('0x7a')]],'%s',_0x4d097a):_0x4d097a;_0x4d097a=_0x314445[_0x654ccb][_0x2b47('0x7c')]?_[_0x2b47('0x7b')](_0x5540dc[_0x314445[_0x654ccb][_0x2b47('0x7c')]],'%s',_0x4d097a):_0x4d097a;if(_0x314445[_0x654ccb][_0x2b47('0x7d')]){_0x1b1211[_0x2b47('0x6e')](_0x4d097a);}_0x314445[_0x654ccb][_0x2b47('0x94')]&&_0x1b1211['order'](_0x4d097a,_0x314445[_0x654ccb]['orderBy']===_0x2b47('0x95')?![]:!![]);_0x1b1211['field'](_0x4d097a,_0x314445[_0x654ccb][_0x2b47('0x7e')]||_0x4d097a);}if(_0x1e0a5f[_0x2b47('0x7f')]){_0x1e0a5f[_0x2b47('0x7f')]=JSON[_0x2b47('0x80')](_0x1e0a5f[_0x2b47('0x7f')]);for(var _0x5125af=0x0;_0x5125af<_0x1e0a5f[_0x2b47('0x7f')]['length'];_0x5125af+=0x1){if(_0x1e0a5f[_0x2b47('0x7f')][_0x5125af][_0x2b47('0x3a')]&&_[_0x2b47('0x69')](_0x1b9c27,_0x1e0a5f[_0x2b47('0x7f')][_0x5125af][_0x2b47('0x3a')])&&_0x1e0a5f[_0x2b47('0x7f')][_0x5125af]['parentKey']&&_0x1e0a5f['joins'][_0x5125af]['foreignTable']&&_0x1e0a5f[_0x2b47('0x7f')][_0x5125af][_0x2b47('0x83')]){_0x1b1211[_0x1e0a5f[_0x2b47('0x7f')][_0x5125af][_0x2b47('0x3a')]](_0x1e0a5f[_0x2b47('0x7f')][_0x5125af][_0x2b47('0x82')],null,util[_0x2b47('0x7c')](_0x2b47('0x84'),_0x1e0a5f[_0x2b47('0x77')],_0x1e0a5f['joins'][_0x5125af][_0x2b47('0x81')],_0x1e0a5f[_0x2b47('0x7f')][_0x5125af]['foreignTable'],_0x1e0a5f[_0x2b47('0x7f')][_0x5125af]['foreignKey']));}}}if(_0x1e0a5f[_0x2b47('0x85')]){_0x1e0a5f[_0x2b47('0x85')]=JSON[_0x2b47('0x80')](_0x1e0a5f[_0x2b47('0x85')]);_0x1b1211[_0x2b47('0x46')](_0xaf5678(_0x1e0a5f[_0x2b47('0x85')]['group']));}_0x13c3f9=_0x1b1211['clone']();_0x1b1211[_0x2b47('0x1f')](_0x330f2c);_0x1b1211[_0x2b47('0x1d')](0x0);return;}})[_0x2b47('0x27')](function(){if(_0x3bdfe4['output']===_0x2b47('0x96')){return null;}var _0x48dad5=_[_0x2b47('0x31')](_0x3bdfe4,{'name':_0x3bdfe4['fullPath']||_0x3bdfe4[_0x2b47('0x2e')]||_0x1e0a5f[_0x2b47('0x2e')],'basename':_0x85a354,'savename':util[_0x2b47('0x7c')](_0x2b47('0x97'),_0x3bdfe4[_0x2b47('0x2e')]||_0x1e0a5f[_0x2b47('0x2e')],require('randomstring')['generate'](0x4),_0x3bdfe4[_0x2b47('0x98')]||_0x2b47('0x99')),'reportId':_0x1e0a5f['id'],'reportType':'custom'});return db[_0x2b47('0x9a')]['create'](_0x48dad5,{'raw':!![]});})['then'](function(_0x276544){if(_0x1e0a5f[_0x2b47('0x77')]===_0x2b47('0x9b')){_0x13c3f9[_0x2b47('0x46')](_0x1e0a5f[_0x2b47('0x77')]+_0x2b47('0x9c'),_0x3bdfe4[_0x2b47('0x9d')],_0x3bdfe4[_0x2b47('0x9e')]);}else{_0x13c3f9['where'](_0x1e0a5f[_0x2b47('0x77')]+_0x2b47('0x9f'),_0x3bdfe4['startDate'],_0x3bdfe4[_0x2b47('0x9e')]);}if(_0x276544){logger[_0x2b47('0xa0')](_0x2b47('0xa1'),_0x13c3f9[_0x2b47('0x8a')]());require(_0x2b47('0xa2'))[_0x2b47('0xa3')](path['join'](__dirname,_0x2b47('0xa4'),_0x276544[_0x2b47('0x98')]),[_0x276544['id'],_0x13c3f9[_0x2b47('0x8a')](),path['join'](__dirname,_0x2b47('0xa5'),_0x276544[_0x2b47('0xa6')]),_0x85a354]);return _0x276544;}else{var _0x47b343=squel[_0x2b47('0x93')]();_0x47b343[_0x2b47('0x76')]('('+_0x13c3f9[_0x2b47('0x8a')]()+')','countTable');_0x47b343['field'](_0x2b47('0xa7'),_0x2b47('0x20'));_0x13c3f9[_0x2b47('0x1f')](_0x3bdfe4[_0x2b47('0x1f')]||_0x330f2c);_0x13c3f9[_0x2b47('0x1d')](_0x3bdfe4[_0x2b47('0x1d')]||0x0);return dbH[_0x2b47('0x89')][_0x2b47('0x3e')](_0x47b343[_0x2b47('0x8a')](),{'type':dbH[_0x2b47('0x89')][_0x2b47('0x8b')][_0x2b47('0x8c')]})[_0x2b47('0x27')](function(_0x2fd547){if(!_0x2fd547[_0x2b47('0x42')]){_0x512951=0x0;}else{_0x512951=_0x2fd547[0x0][_0x2b47('0x20')]||0x0;}return dbH[_0x2b47('0x89')][_0x2b47('0x3e')](_0x13c3f9[_0x2b47('0x8a')](),{'type':dbH[_0x2b47('0x89')][_0x2b47('0x8b')]['SELECT']});})[_0x2b47('0x27')](function(_0x5d8f1e){return{'rows':_0x5d8f1e||[],'count':_0x512951};});}});}exports[_0x2b47('0xa8')]=function(_0x2ccc9d,_0x4aa753){return runReport(_0x2ccc9d[_0x2b47('0x52')],_0x2ccc9d['query'],_0x2ccc9d[_0x2b47('0x4b')])[_0x2b47('0x27')](respondWithResult(_0x4aa753,null))[_0x2b47('0x50')](handleError(_0x4aa753,null));};exports[_0x2b47('0xa9')]=runReport;exports[_0x2b47('0x3e')]=function(_0x21003f,_0x1c5222){var _0x4ba4be=0xa;var _0x314218=[_0x2b47('0x5c'),'left_join',_0x2b47('0x5e'),_0x2b47('0x5f')];var _0x32685b={'SUM':_0x2b47('0x60'),'COUNT':_0x2b47('0x8d'),'COUNT DISTINCT':_0x2b47('0x61'),'MAX':_0x2b47('0x62'),'MIN':_0x2b47('0x63'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x2b47('0x64'),'GROUP_CONCAT ASC':_0x2b47('0x65'),'GROUP_CONCAT DESC':_0x2b47('0x8e')};var _0x45dde5={'SEC_TO_TIME':_0x2b47('0x66'),'DATE':_0x2b47('0x8f'),'HOUR':_0x2b47('0x67'),'ROUND':_0x2b47('0xaa'),'UNIX_TIMESTAMP':_0x2b47('0x68')};var _0x435f48=function(_0x2b4b1f){return!_['includes']([_0x2b47('0x90'),_0x2b47('0x6a'),_0x2b47('0x6b'),_0x2b47('0xab')],_0x2b4b1f);};var _0x142569=function(_0x7a6adf){if(!_0x7a6adf||!_0x7a6adf[_0x2b47('0x6c')][_0x2b47('0x42')]){return'';}for(var _0x3c2266='(',_0x4a3c32=0x0;_0x4a3c32<_0x7a6adf[_0x2b47('0x6c')][_0x2b47('0x42')];_0x4a3c32+=0x1){_0x4a3c32>0x0&&(_0x3c2266+='\x20'+_0x7a6adf[_0x2b47('0x6d')]+'\x20');_0x3c2266+=_0x7a6adf[_0x2b47('0x6c')][_0x4a3c32][_0x2b47('0x6e')]?_0x142569(_0x7a6adf['rules'][_0x4a3c32][_0x2b47('0x6e')]):_0x7a6adf['rules'][_0x4a3c32][_0x2b47('0x6f')]+'\x20'+_0x7a6adf[_0x2b47('0x6c')][_0x4a3c32][_0x2b47('0x70')]+(_0x435f48(_0x7a6adf[_0x2b47('0x6c')][_0x4a3c32][_0x2b47('0x70')])?'\x20'+_0x7a6adf[_0x2b47('0x6c')][_0x4a3c32][_0x2b47('0x71')]:'');}return _0x3c2266+')';};var _0xc9a65e={'where':{'id':_0x21003f[_0x2b47('0x52')]['id']}},_0x47fc91,_0x746128,_0x2328f0,_0xf9515a,_0x3339ff;_0xc9a65e=_[_0x2b47('0x31')]({},_0xc9a65e,_0x21003f[_0x2b47('0x4b')]);return db[_0x2b47('0x37')][_0x2b47('0x57')](_0xc9a65e)['then'](function(_0x4332df){if(_0x4332df){_0x47fc91=_0x4332df;return _0x4332df['getFields']();}return null;})[_0x2b47('0x27')](function(_0x99f719){if(_0x99f719){if(!_0x99f719[_0x2b47('0x42')]){throw new db[(_0x2b47('0x73'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x746128=_0x99f719;return db[_0x2b47('0x75')][_0x2b47('0x4e')]({'raw':!![]});}return null;})[_0x2b47('0x27')](function(_0x35d604){if(_0x35d604){_0x2328f0=_[_0x2b47('0x92')](_0x35d604,'id');var _0x8808c;var _0x4009b8=squel[_0x2b47('0x93')]();_0x4009b8[_0x2b47('0x76')](_0x47fc91[_0x2b47('0x77')]);for(var _0x885ca8=0x0;_0x885ca8<_0x746128[_0x2b47('0x42')];_0x885ca8+=0x1){_0x8808c=_0x746128[_0x885ca8][_0x2b47('0x78')]?_0x2328f0[_0x746128[_0x885ca8][_0x2b47('0x78')]][_0x2b47('0x79')]:_0x746128[_0x885ca8]['field'];_0x8808c=_0x746128[_0x885ca8][_0x2b47('0x7a')]?_[_0x2b47('0x7b')](_0x32685b[_0x746128[_0x885ca8][_0x2b47('0x7a')]],'%s',_0x8808c):_0x8808c;_0x8808c=_0x746128[_0x885ca8]['format']?_[_0x2b47('0x7b')](_0x45dde5[_0x746128[_0x885ca8]['format']],'%s',_0x8808c):_0x8808c;if(_0x746128[_0x885ca8][_0x2b47('0x7d')]){_0x4009b8[_0x2b47('0x6e')](_0x8808c);}_0x746128[_0x885ca8]['orderBy']&&_0x4009b8[_0x2b47('0x44')](_0x8808c,_0x746128[_0x885ca8]['orderBy']===_0x2b47('0x95')?![]:!![]);_0x4009b8[_0x2b47('0x6f')](_0x8808c,_0x746128[_0x885ca8]['alias']||_0x8808c);}if(_0x47fc91['joins']){_0x47fc91['joins']=JSON['parse'](_0x47fc91[_0x2b47('0x7f')]);for(var _0x1d4d52=0x0;_0x1d4d52<_0x47fc91[_0x2b47('0x7f')][_0x2b47('0x42')];_0x1d4d52+=0x1){if(_0x47fc91[_0x2b47('0x7f')][_0x1d4d52]['type']&&_[_0x2b47('0x69')](_0x314218,_0x47fc91[_0x2b47('0x7f')][_0x1d4d52][_0x2b47('0x3a')])&&_0x47fc91[_0x2b47('0x7f')][_0x1d4d52][_0x2b47('0x81')]&&_0x47fc91[_0x2b47('0x7f')][_0x1d4d52][_0x2b47('0x82')]&&_0x47fc91[_0x2b47('0x7f')][_0x1d4d52][_0x2b47('0x83')]){_0x4009b8[_0x47fc91[_0x2b47('0x7f')][_0x1d4d52][_0x2b47('0x3a')]](_0x47fc91[_0x2b47('0x7f')][_0x1d4d52][_0x2b47('0x82')],null,util[_0x2b47('0x7c')](_0x2b47('0x84'),_0x47fc91[_0x2b47('0x77')],_0x47fc91[_0x2b47('0x7f')][_0x1d4d52][_0x2b47('0x81')],_0x47fc91[_0x2b47('0x7f')][_0x1d4d52][_0x2b47('0x82')],_0x47fc91[_0x2b47('0x7f')][_0x1d4d52][_0x2b47('0x83')]));}}}if(_0x47fc91[_0x2b47('0x85')]){_0x47fc91['conditions']=JSON[_0x2b47('0x80')](_0x47fc91[_0x2b47('0x85')]);_0x4009b8[_0x2b47('0x46')](_0x142569(_0x47fc91['conditions'][_0x2b47('0x6e')]));}_0x3339ff=_0x4009b8['clone']();_0x4009b8[_0x2b47('0x1f')](_0x4ba4be);_0x4009b8['offset'](0x0);logger[_0x2b47('0x87')](_0x2b47('0x88'),_0x4009b8[_0x2b47('0x8a')]());return dbH[_0x2b47('0x89')][_0x2b47('0x3e')](_0x4009b8['toString'](),{'type':dbH['sequelize'][_0x2b47('0x8b')][_0x2b47('0x8c')]});}})[_0x2b47('0x27')](function(){return{'sql':_0x3339ff[_0x2b47('0x8a')]()};})[_0x2b47('0x27')](respondWithResult(_0x1c5222,null))[_0x2b47('0x50')](handleError(_0x1c5222,null));}; \ No newline at end of file +var _0x74d6=['COUNT(DISTINCT\x20%s)','IS\x20NOT\x20NULL','metric','debug','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','CustomReports','error','stack','name','render','merge','contact','message','interaction','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','includeAll','include','findAll','rows','catch','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','IS\x20EMPTY','Sequelize','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../files/reports','savename','COUNT(*)','run','runReport'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x74d6,0x14c));var _0x674d=function(_0x7f409f,_0x27bafd){_0x7f409f=_0x7f409f-0x0;var _0x55a058=_0x74d6[_0x7f409f];return _0x55a058;};'use strict';var emlformat=require(_0x674d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x674d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x674d('0x2'));var moment=require(_0x674d('0x3'));var BPromise=require(_0x674d('0x4'));var Mustache=require('mustache');var util=require(_0x674d('0x5'));var path=require(_0x674d('0x6'));var sox=require(_0x674d('0x7'));var csv=require(_0x674d('0x8'));var ejs=require(_0x674d('0x9'));var fs=require('fs');var fs_extra=require(_0x674d('0xa'));var _=require(_0x674d('0xb'));var squel=require(_0x674d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x674d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x674d('0xe'));var Redis=require(_0x674d('0xf'));var authService=require(_0x674d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x674d('0x11'));var logger=require('../../config/logger')(_0x674d('0x12'));var utils=require(_0x674d('0x13'));var config=require(_0x674d('0x14'));var licenseUtil=require(_0x674d('0x15'));var db=require(_0x674d('0x16'))['db'];var dbH=require('../../mysqldb')[_0x674d('0x17')];function respondWithStatusCode(_0x1ecbf0,_0x35b399){_0x35b399=_0x35b399||0xcc;return function(_0x30692c){if(_0x30692c){return _0x1ecbf0[_0x674d('0x18')](_0x35b399);}return _0x1ecbf0[_0x674d('0x19')](_0x35b399)[_0x674d('0x1a')]();};}function respondWithResult(_0x3b2a9d,_0x5a9aff){_0x5a9aff=_0x5a9aff||0xc8;return function(_0x2f4624){if(_0x2f4624){return _0x3b2a9d['status'](_0x5a9aff)['json'](_0x2f4624);}};}function respondWithFilteredResult(_0x5e95ba,_0xc66ffd){return function(_0xac4f85){if(_0xac4f85){var _0x3c904a=typeof _0xc66ffd[_0x674d('0x1b')]===_0x674d('0x1c')&&typeof _0xc66ffd[_0x674d('0x1d')]==='undefined';var _0x39d254=_0xac4f85['count'];var _0x37e681=_0x3c904a?0x0:_0xc66ffd[_0x674d('0x1b')];var _0x37c001=_0x3c904a?_0xac4f85[_0x674d('0x1e')]:_0xc66ffd['offset']+_0xc66ffd[_0x674d('0x1d')];var _0x36a682;if(_0x37c001>=_0x39d254){_0x37c001=_0x39d254;_0x36a682=0xc8;}else{_0x36a682=0xce;}_0x5e95ba[_0x674d('0x19')](_0x36a682);return _0x5e95ba[_0x674d('0x1f')](_0x674d('0x20'),_0x37e681+'-'+_0x37c001+'/'+_0x39d254)['json'](_0xac4f85);}return null;};}function patchUpdates(_0x40cf32){return function(_0x2d6f19){try{jsonpatch[_0x674d('0x21')](_0x2d6f19,_0x40cf32,!![]);}catch(_0x4ac6fb){return BPromise[_0x674d('0x22')](_0x4ac6fb);}return _0x2d6f19['save']();};}function saveUpdates(_0x5c9995,_0x1275dd){return function(_0x576013){if(_0x576013){return _0x576013['update'](_0x5c9995)[_0x674d('0x23')](function(_0x3d04f9){return _0x3d04f9;});}return null;};}function removeEntity(_0x566fbc,_0x271e5e){return function(_0x36f147){if(_0x36f147){return _0x36f147[_0x674d('0x24')]()[_0x674d('0x23')](function(){var _0x4b869b=_0x36f147[_0x674d('0x25')]({'plain':!![]});var _0x56136c=_0x674d('0x26');return db['UserProfileResource'][_0x674d('0x24')]({'where':{'type':_0x56136c,'resourceId':_0x4b869b['id']}})[_0x674d('0x23')](function(){return _0x36f147;});})[_0x674d('0x23')](function(){_0x566fbc[_0x674d('0x19')](0xcc)[_0x674d('0x1a')]();});}};}function handleEntityNotFound(_0x122241,_0x3e9d2c){return function(_0x10ff7e){if(!_0x10ff7e){_0x122241[_0x674d('0x18')](0x194);}return _0x10ff7e;};}function handleError(_0x2a1bc0,_0x582e95){_0x582e95=_0x582e95||0x1f4;return function(_0x53f631){logger[_0x674d('0x27')](_0x53f631[_0x674d('0x28')]);if(_0x53f631[_0x674d('0x29')]){delete _0x53f631['name'];}_0x2a1bc0[_0x674d('0x19')](_0x582e95)['send'](_0x53f631);};}function getMustacheRender(_0x206d5b,_0x2acc63){return Mustache[_0x674d('0x2a')](_0x206d5b,_[_0x674d('0x2b')](_0x2acc63['body'],{'contact':_0x2acc63[_0x674d('0x2c')],'message':_0x2acc63[_0x674d('0x2d')],'agent':_0x2acc63['agent'],'interaction':_0x2acc63[_0x674d('0x2e')],'account':_0x2acc63['account']}))||'';}exports['index']=function(_0x4f17a0,_0x3e340b){var _0xb9cea2={},_0x39b99a={},_0x3c51f4={'count':0x0,'rows':[]};var _0x5c7454=_[_0x674d('0x2f')](db[_0x674d('0x30')][_0x674d('0x31')],function(_0x572253){return{'name':_0x572253[_0x674d('0x32')],'type':_0x572253[_0x674d('0x33')][_0x674d('0x34')]};});_0x39b99a[_0x674d('0x35')]=_[_0x674d('0x2f')](_0x5c7454,_0x674d('0x29'));_0x39b99a[_0x674d('0x36')]=_[_0x674d('0x37')](_0x4f17a0['query']);_0x39b99a[_0x674d('0x38')]=_[_0x674d('0x39')](_0x39b99a[_0x674d('0x35')],_0x39b99a[_0x674d('0x36')]);_0xb9cea2['attributes']=_['intersection'](_0x39b99a[_0x674d('0x35')],qs[_0x674d('0x3a')](_0x4f17a0['query']['fields']));_0xb9cea2['attributes']=_0xb9cea2[_0x674d('0x3b')][_0x674d('0x3c')]?_0xb9cea2[_0x674d('0x3b')]:_0x39b99a[_0x674d('0x35')];if(!_0x4f17a0[_0x674d('0x36')][_0x674d('0x3d')](_0x674d('0x3e'))){_0xb9cea2[_0x674d('0x1d')]=qs[_0x674d('0x1d')](_0x4f17a0[_0x674d('0x36')][_0x674d('0x1d')]);_0xb9cea2[_0x674d('0x1b')]=qs[_0x674d('0x1b')](_0x4f17a0[_0x674d('0x36')][_0x674d('0x1b')]);}_0xb9cea2[_0x674d('0x3f')]=qs['sort'](_0x4f17a0['query'][_0x674d('0x40')]);_0xb9cea2['where']=qs['filters'](_[_0x674d('0x41')](_0x4f17a0[_0x674d('0x36')],_0x39b99a['filters']),_0x5c7454);if(_0x4f17a0[_0x674d('0x36')]['filter']){_0xb9cea2[_0x674d('0x42')]=_[_0x674d('0x2b')](_0xb9cea2[_0x674d('0x42')],{'$or':_[_0x674d('0x2f')](_0x5c7454,function(_0x16a82f){if(_0x16a82f[_0x674d('0x33')]!=='VIRTUAL'){var _0x384156={};_0x384156[_0x16a82f[_0x674d('0x29')]]={'$like':'%'+_0x4f17a0[_0x674d('0x36')]['filter']+'%'};return _0x384156;}})});}_0xb9cea2=_[_0x674d('0x2b')]({},_0xb9cea2,_0x4f17a0['options']);var _0x1aeb0f={'where':_0xb9cea2['where']};return db[_0x674d('0x30')][_0x674d('0x1e')](_0x1aeb0f)['then'](function(_0x223684){_0x3c51f4['count']=_0x223684;if(_0x4f17a0[_0x674d('0x36')][_0x674d('0x43')]){_0xb9cea2[_0x674d('0x44')]=[{'all':!![]}];}return db[_0x674d('0x30')][_0x674d('0x45')](_0xb9cea2);})[_0x674d('0x23')](function(_0x55333d){_0x3c51f4[_0x674d('0x46')]=_0x55333d;return _0x3c51f4;})[_0x674d('0x23')](respondWithFilteredResult(_0x3e340b,_0xb9cea2))[_0x674d('0x47')](handleError(_0x3e340b,null));};exports['show']=function(_0x7576dc,_0x381c03){var _0x1a18d3={'raw':![],'where':{'id':_0x7576dc['params']['id']}},_0x413f7d={};_0x413f7d[_0x674d('0x35')]=_[_0x674d('0x37')](db[_0x674d('0x30')][_0x674d('0x31')]);_0x413f7d['query']=_[_0x674d('0x37')](_0x7576dc[_0x674d('0x36')]);_0x413f7d[_0x674d('0x38')]=_[_0x674d('0x39')](_0x413f7d[_0x674d('0x35')],_0x413f7d[_0x674d('0x36')]);_0x1a18d3[_0x674d('0x3b')]=_[_0x674d('0x39')](_0x413f7d[_0x674d('0x35')],qs[_0x674d('0x3a')](_0x7576dc[_0x674d('0x36')][_0x674d('0x3a')]));_0x1a18d3['attributes']=_0x1a18d3[_0x674d('0x3b')]['length']?_0x1a18d3[_0x674d('0x3b')]:_0x413f7d[_0x674d('0x35')];if(_0x7576dc[_0x674d('0x36')][_0x674d('0x43')]){_0x1a18d3[_0x674d('0x44')]=[{'all':!![]}];}_0x1a18d3=_[_0x674d('0x2b')]({},_0x1a18d3,_0x7576dc[_0x674d('0x48')]);return db[_0x674d('0x30')][_0x674d('0x49')](_0x1a18d3)['then'](handleEntityNotFound(_0x381c03,null))[_0x674d('0x23')](respondWithResult(_0x381c03,null))[_0x674d('0x47')](handleError(_0x381c03,null));};exports[_0x674d('0x4a')]=function(_0x42e50c,_0x222f3f){return db[_0x674d('0x30')]['create'](_0x42e50c[_0x674d('0x4b')],{})[_0x674d('0x23')](function(_0x4e1790){var _0x16f318=_0x42e50c[_0x674d('0x4c')][_0x674d('0x25')]({'plain':!![]});if(!_0x16f318)throw new Error(_0x674d('0x4d'));if(_0x16f318['role']===_0x674d('0x4c')){var _0x1cc031=_0x4e1790['get']({'plain':!![]});var _0x3cacb9=_0x674d('0x4e');return db[_0x674d('0x4f')][_0x674d('0x49')]({'where':{'name':_0x3cacb9,'userProfileId':_0x16f318['userProfileId']},'raw':!![]})[_0x674d('0x23')](function(_0x49813a){if(_0x49813a&&_0x49813a[_0x674d('0x50')]===0x0){return db['UserProfileResource'][_0x674d('0x4a')]({'name':_0x1cc031[_0x674d('0x29')],'resourceId':_0x1cc031['id'],'type':_0x674d('0x26'),'sectionId':_0x49813a['id']},{})['then'](function(){return _0x4e1790;});}else{return _0x4e1790;}})['catch'](function(_0x48213d){logger[_0x674d('0x27')](_0x674d('0x51'),_0x48213d);throw _0x48213d;});}return _0x4e1790;})[_0x674d('0x23')](respondWithResult(_0x222f3f,0xc9))['catch'](handleError(_0x222f3f,null));};exports[_0x674d('0x52')]=function(_0x277650,_0x56e1e1){if(_0x277650['body']['id']){delete _0x277650[_0x674d('0x4b')]['id'];}return db[_0x674d('0x30')][_0x674d('0x49')]({'where':{'id':_0x277650[_0x674d('0x53')]['id']}})[_0x674d('0x23')](handleEntityNotFound(_0x56e1e1,null))[_0x674d('0x23')](saveUpdates(_0x277650[_0x674d('0x4b')],null))['then'](respondWithResult(_0x56e1e1,null))[_0x674d('0x47')](handleError(_0x56e1e1,null));};exports[_0x674d('0x24')]=function(_0x598993,_0x2f25e9){return db[_0x674d('0x30')][_0x674d('0x49')]({'where':{'id':_0x598993[_0x674d('0x53')]['id']}})[_0x674d('0x23')](handleEntityNotFound(_0x2f25e9,null))[_0x674d('0x23')](removeEntity(_0x2f25e9,null))[_0x674d('0x47')](handleError(_0x2f25e9,null));};exports[_0x674d('0x54')]=function(_0x4b35aa,_0x486ad2){var _0x246eaf=0xa;var _0x47ae04=[_0x674d('0x55'),_0x674d('0x56'),_0x674d('0x57'),'cross_join'];var _0x2fdd49={'SUM':_0x674d('0x58'),'COUNT':_0x674d('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x674d('0x5a'),'MIN':_0x674d('0x5b'),'AVG':_0x674d('0x5c'),'GROUP_CONCAT':_0x674d('0x5d'),'GROUP_CONCAT ASC':_0x674d('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x408bc9={'SEC_TO_TIME':_0x674d('0x5f'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x674d('0x60'),'UNIX_TIMESTAMP':_0x674d('0x61')};var _0x49776f=function(_0x47c018){return!_[_0x674d('0x62')]([_0x674d('0x63'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x674d('0x64')],_0x47c018);};var _0xd80fc6=function(_0xb605ce){if(!_0xb605ce||!_0xb605ce[_0x674d('0x65')][_0x674d('0x3c')]){return'';}for(var _0x1f1f7f='(',_0x3f7bb5=0x0;_0x3f7bb5<_0xb605ce[_0x674d('0x65')][_0x674d('0x3c')];_0x3f7bb5+=0x1){_0x3f7bb5>0x0&&(_0x1f1f7f+='\x20'+_0xb605ce['operator']+'\x20');_0x1f1f7f+=_0xb605ce[_0x674d('0x65')][_0x3f7bb5][_0x674d('0x66')]?_0xd80fc6(_0xb605ce[_0x674d('0x65')][_0x3f7bb5]['group']):_0xb605ce[_0x674d('0x65')][_0x3f7bb5][_0x674d('0x67')]+'\x20'+_0xb605ce[_0x674d('0x65')][_0x3f7bb5][_0x674d('0x68')]+(_0x49776f(_0xb605ce[_0x674d('0x65')][_0x3f7bb5][_0x674d('0x68')])?'\x20'+_0xb605ce[_0x674d('0x65')][_0x3f7bb5][_0x674d('0x69')]:'');}return _0x1f1f7f+')';};var _0x10ffed={'where':{'id':_0x4b35aa[_0x674d('0x53')]['id']}},_0x328caf,_0x1ea901,_0x1d2c0a,_0x301d06,_0x56a503;_0x10ffed=_[_0x674d('0x2b')]({},_0x10ffed,_0x4b35aa[_0x674d('0x48')]);return db[_0x674d('0x30')][_0x674d('0x49')](_0x10ffed)['then'](function(_0x238598){if(_0x238598){_0x328caf=_0x238598;return _0x238598[_0x674d('0x6a')]();}return null;})[_0x674d('0x23')](function(_0x434de7){if(_0x434de7){if(!_0x434de7[_0x674d('0x3c')]){throw new db['Sequelize'][(_0x674d('0x6b'))](_0x674d('0x6c'),0x193);}_0x1ea901=_0x434de7;return db[_0x674d('0x6d')][_0x674d('0x45')]({'raw':!![]});}return null;})[_0x674d('0x23')](function(_0x503b93){if(_0x503b93){_0x1d2c0a=_[_0x674d('0x6e')](_0x503b93,'id');var _0x1f647a;var _0x4944fe=squel[_0x674d('0x6f')]();_0x4944fe[_0x674d('0x70')](_0x328caf[_0x674d('0x71')]);for(var _0x3411f2=0x0;_0x3411f2<_0x1ea901[_0x674d('0x3c')];_0x3411f2+=0x1){_0x1f647a=_0x1ea901[_0x3411f2]['MetricId']?_0x1d2c0a[_0x1ea901[_0x3411f2][_0x674d('0x72')]]['metric']:_0x1ea901[_0x3411f2]['field'];_0x1f647a=_0x1ea901[_0x3411f2]['function']?_[_0x674d('0x73')](_0x2fdd49[_0x1ea901[_0x3411f2][_0x674d('0x74')]],'%s',_0x1f647a):_0x1f647a;_0x1f647a=_0x1ea901[_0x3411f2][_0x674d('0x75')]?_['replace'](_0x408bc9[_0x1ea901[_0x3411f2][_0x674d('0x75')]],'%s',_0x1f647a):_0x1f647a;if(_0x1ea901[_0x3411f2][_0x674d('0x76')]){_0x4944fe[_0x674d('0x66')](_0x1f647a);}_0x1ea901[_0x3411f2]['orderBy']&&_0x4944fe[_0x674d('0x3f')](_0x1f647a,_0x1ea901[_0x3411f2][_0x674d('0x77')]===_0x674d('0x78')?![]:!![]);_0x4944fe[_0x674d('0x67')](_0x1f647a,_0x1ea901[_0x3411f2][_0x674d('0x79')]||_0x1f647a);}if(_0x328caf[_0x674d('0x7a')]){_0x328caf[_0x674d('0x7a')]=JSON[_0x674d('0x7b')](_0x328caf[_0x674d('0x7a')]);for(var _0x4768b2=0x0;_0x4768b2<_0x328caf[_0x674d('0x7a')][_0x674d('0x3c')];_0x4768b2+=0x1){if(_0x328caf[_0x674d('0x7a')][_0x4768b2][_0x674d('0x33')]&&_[_0x674d('0x62')](_0x47ae04,_0x328caf[_0x674d('0x7a')][_0x4768b2]['type'])&&_0x328caf[_0x674d('0x7a')][_0x4768b2][_0x674d('0x7c')]&&_0x328caf[_0x674d('0x7a')][_0x4768b2][_0x674d('0x7d')]&&_0x328caf['joins'][_0x4768b2][_0x674d('0x7e')]){_0x4944fe[_0x328caf[_0x674d('0x7a')][_0x4768b2][_0x674d('0x33')]](_0x328caf[_0x674d('0x7a')][_0x4768b2][_0x674d('0x7d')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x328caf[_0x674d('0x71')],_0x328caf[_0x674d('0x7a')][_0x4768b2][_0x674d('0x7c')],_0x328caf['joins'][_0x4768b2]['foreignTable'],_0x328caf[_0x674d('0x7a')][_0x4768b2][_0x674d('0x7e')]));}}}if(_0x328caf['conditions']){_0x328caf[_0x674d('0x7f')]=JSON[_0x674d('0x7b')](_0x328caf[_0x674d('0x7f')]);_0x4944fe['where'](_0xd80fc6(_0x328caf[_0x674d('0x7f')][_0x674d('0x66')]));}_0x56a503=_0x4944fe[_0x674d('0x80')]();_0x4944fe[_0x674d('0x1d')](_0x246eaf);_0x4944fe['offset'](0x0);logger['debug'](_0x674d('0x81'),_0x4944fe[_0x674d('0x82')]());return dbH[_0x674d('0x83')]['query'](_0x4944fe[_0x674d('0x82')](),{'type':dbH[_0x674d('0x83')][_0x674d('0x84')][_0x674d('0x85')]});}})[_0x674d('0x23')](respondWithResult(_0x486ad2,null))[_0x674d('0x47')](handleError(_0x486ad2,null));};function runReport(_0x3ba08b,_0x28e2ef,_0x34061d){var _0x159ff8=_0x28e2ef[_0x674d('0x29')];var _0x13f8d9=0xa;var _0x117865=[_0x674d('0x55'),_0x674d('0x56'),_0x674d('0x57'),_0x674d('0x86')];var _0x36c915={'SUM':_0x674d('0x58'),'COUNT':_0x674d('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x674d('0x5a'),'MIN':'MIN(%s)','AVG':_0x674d('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x674d('0x87')};var _0x5b4244={'SEC_TO_TIME':_0x674d('0x5f'),'DATE':_0x674d('0x88'),'HOUR':_0x674d('0x89'),'ROUND':_0x674d('0x60'),'UNIX_TIMESTAMP':_0x674d('0x61')};var _0x5269ec=function(_0x154dda){return!_[_0x674d('0x62')]([_0x674d('0x63'),'IS\x20NOT\x20NULL',_0x674d('0x8a'),_0x674d('0x64')],_0x154dda);};var _0x41c8fd=function(_0xe78c6c){if(!_0xe78c6c||!_0xe78c6c[_0x674d('0x65')][_0x674d('0x3c')]){return'';}for(var _0x3fa8f3='(',_0x3ba6a8=0x0;_0x3ba6a8<_0xe78c6c[_0x674d('0x65')][_0x674d('0x3c')];_0x3ba6a8+=0x1){_0x3ba6a8>0x0&&(_0x3fa8f3+='\x20'+_0xe78c6c['operator']+'\x20');_0x3fa8f3+=_0xe78c6c[_0x674d('0x65')][_0x3ba6a8][_0x674d('0x66')]?_0x41c8fd(_0xe78c6c[_0x674d('0x65')][_0x3ba6a8][_0x674d('0x66')]):_0xe78c6c[_0x674d('0x65')][_0x3ba6a8][_0x674d('0x67')]+'\x20'+_0xe78c6c[_0x674d('0x65')][_0x3ba6a8][_0x674d('0x68')]+(_0x5269ec(_0xe78c6c[_0x674d('0x65')][_0x3ba6a8]['condition'])?'\x20'+_0xe78c6c[_0x674d('0x65')][_0x3ba6a8]['value']:'');}return _0x3fa8f3+')';};var _0x49efb1={'where':{'id':_0x3ba08b['id']}},_0x105cb0,_0x3ee242,_0xf8f66d,_0x41d871,_0x1c21a3;_0x49efb1=_[_0x674d('0x2b')]({},_0x49efb1,_0x34061d);return db[_0x674d('0x30')][_0x674d('0x49')](_0x49efb1)[_0x674d('0x23')](function(_0x39ce1b){if(_0x39ce1b){_0x105cb0=_0x39ce1b;return _0x39ce1b[_0x674d('0x6a')]();}return null;})[_0x674d('0x23')](function(_0x513e01){if(_0x513e01){if(!_0x513e01['length']){throw new db[(_0x674d('0x8b'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3ee242=_0x513e01;return db[_0x674d('0x6d')][_0x674d('0x45')]({'raw':!![]});}return null;})[_0x674d('0x23')](function(_0x10ecdd){if(_0x10ecdd){_0xf8f66d=_['keyBy'](_0x10ecdd,'id');var _0x584b24;var _0x5d8f8b=squel[_0x674d('0x6f')]();_0x5d8f8b[_0x674d('0x70')](_0x105cb0[_0x674d('0x71')]);for(var _0x461f73=0x0;_0x461f73<_0x3ee242[_0x674d('0x3c')];_0x461f73+=0x1){_0x584b24=_0x3ee242[_0x461f73][_0x674d('0x72')]?_0xf8f66d[_0x3ee242[_0x461f73]['MetricId']]['metric']:_0x3ee242[_0x461f73][_0x674d('0x67')];_0x584b24=_0x3ee242[_0x461f73][_0x674d('0x74')]?_[_0x674d('0x73')](_0x36c915[_0x3ee242[_0x461f73][_0x674d('0x74')]],'%s',_0x584b24):_0x584b24;_0x584b24=_0x3ee242[_0x461f73][_0x674d('0x75')]?_[_0x674d('0x73')](_0x5b4244[_0x3ee242[_0x461f73][_0x674d('0x75')]],'%s',_0x584b24):_0x584b24;if(_0x3ee242[_0x461f73][_0x674d('0x76')]){_0x5d8f8b[_0x674d('0x66')](_0x584b24);}_0x3ee242[_0x461f73][_0x674d('0x77')]&&_0x5d8f8b['order'](_0x584b24,_0x3ee242[_0x461f73][_0x674d('0x77')]==='DESC'?![]:!![]);_0x5d8f8b[_0x674d('0x67')](_0x584b24,_0x3ee242[_0x461f73]['alias']||_0x584b24);}if(_0x105cb0[_0x674d('0x7a')]){_0x105cb0[_0x674d('0x7a')]=JSON[_0x674d('0x7b')](_0x105cb0['joins']);for(var _0x23b1c6=0x0;_0x23b1c6<_0x105cb0['joins']['length'];_0x23b1c6+=0x1){if(_0x105cb0['joins'][_0x23b1c6]['type']&&_['includes'](_0x117865,_0x105cb0[_0x674d('0x7a')][_0x23b1c6][_0x674d('0x33')])&&_0x105cb0[_0x674d('0x7a')][_0x23b1c6]['parentKey']&&_0x105cb0['joins'][_0x23b1c6][_0x674d('0x7d')]&&_0x105cb0['joins'][_0x23b1c6][_0x674d('0x7e')]){_0x5d8f8b[_0x105cb0['joins'][_0x23b1c6][_0x674d('0x33')]](_0x105cb0[_0x674d('0x7a')][_0x23b1c6][_0x674d('0x7d')],null,util[_0x674d('0x75')](_0x674d('0x8c'),_0x105cb0[_0x674d('0x71')],_0x105cb0[_0x674d('0x7a')][_0x23b1c6][_0x674d('0x7c')],_0x105cb0['joins'][_0x23b1c6][_0x674d('0x7d')],_0x105cb0[_0x674d('0x7a')][_0x23b1c6][_0x674d('0x7e')]));}}}if(_0x105cb0[_0x674d('0x7f')]){_0x105cb0['conditions']=JSON['parse'](_0x105cb0[_0x674d('0x7f')]);_0x5d8f8b[_0x674d('0x42')](_0x41c8fd(_0x105cb0['conditions']['group']));}_0x1c21a3=_0x5d8f8b[_0x674d('0x80')]();_0x5d8f8b['limit'](_0x13f8d9);_0x5d8f8b[_0x674d('0x1b')](0x0);return;}})['then'](function(){if(_0x28e2ef[_0x674d('0x8d')]===_0x674d('0x8e')){return null;}var _0x2305c0=_[_0x674d('0x2b')](_0x28e2ef,{'name':_0x28e2ef[_0x674d('0x8f')]||_0x28e2ef[_0x674d('0x29')]||_0x105cb0[_0x674d('0x29')],'basename':_0x159ff8,'savename':util['format'](_0x674d('0x90'),_0x28e2ef[_0x674d('0x29')]||_0x105cb0[_0x674d('0x29')],require('randomstring')['generate'](0x4),_0x28e2ef[_0x674d('0x8d')]||_0x674d('0x91')),'reportId':_0x105cb0['id'],'reportType':'custom'});return db[_0x674d('0x92')][_0x674d('0x4a')](_0x2305c0,{'raw':!![]});})['then'](function(_0x539b38){if(_0x105cb0[_0x674d('0x71')]===_0x674d('0x93')){_0x1c21a3['where'](_0x105cb0['table']+_0x674d('0x94'),_0x28e2ef[_0x674d('0x95')],_0x28e2ef[_0x674d('0x96')]);}else{_0x1c21a3[_0x674d('0x42')](_0x105cb0[_0x674d('0x71')]+_0x674d('0x97'),_0x28e2ef[_0x674d('0x95')],_0x28e2ef[_0x674d('0x96')]);}if(_0x539b38){logger[_0x674d('0x98')](_0x674d('0x99'),_0x1c21a3['toString']());require(_0x674d('0x9a'))['fork'](path[_0x674d('0x55')](__dirname,'../../components/export/',_0x539b38[_0x674d('0x8d')]),[_0x539b38['id'],_0x1c21a3['toString'](),path['join'](__dirname,_0x674d('0x9b'),_0x539b38[_0x674d('0x9c')]),_0x159ff8]);return _0x539b38;}else{var _0x53c79d=squel[_0x674d('0x6f')]();_0x53c79d[_0x674d('0x70')]('('+_0x1c21a3[_0x674d('0x82')]()+')','countTable');_0x53c79d[_0x674d('0x67')](_0x674d('0x9d'),_0x674d('0x1e'));_0x1c21a3[_0x674d('0x1d')](_0x28e2ef[_0x674d('0x1d')]||_0x13f8d9);_0x1c21a3['offset'](_0x28e2ef[_0x674d('0x1b')]||0x0);return dbH[_0x674d('0x83')][_0x674d('0x36')](_0x53c79d[_0x674d('0x82')](),{'type':dbH[_0x674d('0x83')]['QueryTypes']['SELECT']})[_0x674d('0x23')](function(_0x9f2776){if(!_0x9f2776[_0x674d('0x3c')]){_0x41d871=0x0;}else{_0x41d871=_0x9f2776[0x0]['count']||0x0;}return dbH[_0x674d('0x83')][_0x674d('0x36')](_0x1c21a3[_0x674d('0x82')](),{'type':dbH[_0x674d('0x83')][_0x674d('0x84')]['SELECT']});})[_0x674d('0x23')](function(_0x37eb5b){return{'rows':_0x37eb5b||[],'count':_0x41d871};});}});}exports[_0x674d('0x9e')]=function(_0x1ca350,_0x12ccf9){return runReport(_0x1ca350[_0x674d('0x53')],_0x1ca350['query'],_0x1ca350[_0x674d('0x48')])[_0x674d('0x23')](respondWithResult(_0x12ccf9,null))['catch'](handleError(_0x12ccf9,null));};exports[_0x674d('0x9f')]=runReport;exports[_0x674d('0x36')]=function(_0x51908e,_0x83b310){var _0x3ce7c5=0xa;var _0x231853=[_0x674d('0x55'),_0x674d('0x56'),_0x674d('0x57'),_0x674d('0x86')];var _0x1da20b={'SUM':'SUM(%s)','COUNT':_0x674d('0x59'),'COUNT DISTINCT':_0x674d('0xa0'),'MAX':_0x674d('0x5a'),'MIN':'MIN(%s)','AVG':_0x674d('0x5c'),'GROUP_CONCAT':_0x674d('0x5d'),'GROUP_CONCAT ASC':_0x674d('0x5e'),'GROUP_CONCAT DESC':_0x674d('0x87')};var _0x14d7b7={'SEC_TO_TIME':_0x674d('0x5f'),'DATE':_0x674d('0x88'),'HOUR':'HOUR(%s)','ROUND':_0x674d('0x60'),'UNIX_TIMESTAMP':_0x674d('0x61')};var _0x171ec9=function(_0x16b8cb){return!_[_0x674d('0x62')]([_0x674d('0x63'),_0x674d('0xa1'),_0x674d('0x8a'),_0x674d('0x64')],_0x16b8cb);};var _0x363ed3=function(_0x3a916c){if(!_0x3a916c||!_0x3a916c[_0x674d('0x65')][_0x674d('0x3c')]){return'';}for(var _0x5015f7='(',_0x35ce13=0x0;_0x35ce13<_0x3a916c['rules'][_0x674d('0x3c')];_0x35ce13+=0x1){_0x35ce13>0x0&&(_0x5015f7+='\x20'+_0x3a916c['operator']+'\x20');_0x5015f7+=_0x3a916c[_0x674d('0x65')][_0x35ce13][_0x674d('0x66')]?_0x363ed3(_0x3a916c[_0x674d('0x65')][_0x35ce13][_0x674d('0x66')]):_0x3a916c[_0x674d('0x65')][_0x35ce13][_0x674d('0x67')]+'\x20'+_0x3a916c[_0x674d('0x65')][_0x35ce13][_0x674d('0x68')]+(_0x171ec9(_0x3a916c[_0x674d('0x65')][_0x35ce13][_0x674d('0x68')])?'\x20'+_0x3a916c['rules'][_0x35ce13][_0x674d('0x69')]:'');}return _0x5015f7+')';};var _0x18afa1={'where':{'id':_0x51908e[_0x674d('0x53')]['id']}},_0x35ede1,_0x1e5d5e,_0x58926d,_0x264853,_0x5e7ff4;_0x18afa1=_[_0x674d('0x2b')]({},_0x18afa1,_0x51908e[_0x674d('0x48')]);return db[_0x674d('0x30')][_0x674d('0x49')](_0x18afa1)['then'](function(_0x46241c){if(_0x46241c){_0x35ede1=_0x46241c;return _0x46241c[_0x674d('0x6a')]();}return null;})['then'](function(_0x3a6391){if(_0x3a6391){if(!_0x3a6391[_0x674d('0x3c')]){throw new db[(_0x674d('0x8b'))][(_0x674d('0x6b'))](_0x674d('0x6c'),0x193);}_0x1e5d5e=_0x3a6391;return db[_0x674d('0x6d')][_0x674d('0x45')]({'raw':!![]});}return null;})[_0x674d('0x23')](function(_0x25dcbb){if(_0x25dcbb){_0x58926d=_[_0x674d('0x6e')](_0x25dcbb,'id');var _0xa3ba8b;var _0x478c3a=squel['select']();_0x478c3a[_0x674d('0x70')](_0x35ede1[_0x674d('0x71')]);for(var _0x6ea95=0x0;_0x6ea95<_0x1e5d5e['length'];_0x6ea95+=0x1){_0xa3ba8b=_0x1e5d5e[_0x6ea95]['MetricId']?_0x58926d[_0x1e5d5e[_0x6ea95][_0x674d('0x72')]][_0x674d('0xa2')]:_0x1e5d5e[_0x6ea95][_0x674d('0x67')];_0xa3ba8b=_0x1e5d5e[_0x6ea95]['function']?_['replace'](_0x1da20b[_0x1e5d5e[_0x6ea95][_0x674d('0x74')]],'%s',_0xa3ba8b):_0xa3ba8b;_0xa3ba8b=_0x1e5d5e[_0x6ea95][_0x674d('0x75')]?_[_0x674d('0x73')](_0x14d7b7[_0x1e5d5e[_0x6ea95]['format']],'%s',_0xa3ba8b):_0xa3ba8b;if(_0x1e5d5e[_0x6ea95][_0x674d('0x76')]){_0x478c3a[_0x674d('0x66')](_0xa3ba8b);}_0x1e5d5e[_0x6ea95][_0x674d('0x77')]&&_0x478c3a[_0x674d('0x3f')](_0xa3ba8b,_0x1e5d5e[_0x6ea95][_0x674d('0x77')]===_0x674d('0x78')?![]:!![]);_0x478c3a[_0x674d('0x67')](_0xa3ba8b,_0x1e5d5e[_0x6ea95][_0x674d('0x79')]||_0xa3ba8b);}if(_0x35ede1['joins']){_0x35ede1[_0x674d('0x7a')]=JSON['parse'](_0x35ede1[_0x674d('0x7a')]);for(var _0x3ac0fb=0x0;_0x3ac0fb<_0x35ede1[_0x674d('0x7a')][_0x674d('0x3c')];_0x3ac0fb+=0x1){if(_0x35ede1[_0x674d('0x7a')][_0x3ac0fb][_0x674d('0x33')]&&_[_0x674d('0x62')](_0x231853,_0x35ede1[_0x674d('0x7a')][_0x3ac0fb][_0x674d('0x33')])&&_0x35ede1[_0x674d('0x7a')][_0x3ac0fb][_0x674d('0x7c')]&&_0x35ede1[_0x674d('0x7a')][_0x3ac0fb][_0x674d('0x7d')]&&_0x35ede1[_0x674d('0x7a')][_0x3ac0fb][_0x674d('0x7e')]){_0x478c3a[_0x35ede1[_0x674d('0x7a')][_0x3ac0fb][_0x674d('0x33')]](_0x35ede1[_0x674d('0x7a')][_0x3ac0fb][_0x674d('0x7d')],null,util[_0x674d('0x75')](_0x674d('0x8c'),_0x35ede1[_0x674d('0x71')],_0x35ede1[_0x674d('0x7a')][_0x3ac0fb][_0x674d('0x7c')],_0x35ede1['joins'][_0x3ac0fb][_0x674d('0x7d')],_0x35ede1[_0x674d('0x7a')][_0x3ac0fb]['foreignKey']));}}}if(_0x35ede1[_0x674d('0x7f')]){_0x35ede1['conditions']=JSON['parse'](_0x35ede1[_0x674d('0x7f')]);_0x478c3a[_0x674d('0x42')](_0x363ed3(_0x35ede1[_0x674d('0x7f')]['group']));}_0x5e7ff4=_0x478c3a[_0x674d('0x80')]();_0x478c3a[_0x674d('0x1d')](_0x3ce7c5);_0x478c3a[_0x674d('0x1b')](0x0);logger[_0x674d('0xa3')](_0x674d('0x81'),_0x478c3a['toString']());return dbH['sequelize'][_0x674d('0x36')](_0x478c3a[_0x674d('0x82')](),{'type':dbH[_0x674d('0x83')][_0x674d('0x84')][_0x674d('0x85')]});}})[_0x674d('0x23')](function(){return{'sql':_0x5e7ff4[_0x674d('0x82')]()};})[_0x674d('0x23')](respondWithResult(_0x83b310,null))[_0x674d('0x47')](handleError(_0x83b310,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 5a8b642..ffb0aec 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 _0x9e26=['analytics_custom_reports','../../config/logger','path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9e26,0x149));var _0x69e2=function(_0x35478d,_0x4810a1){_0x35478d=_0x35478d-0x0;var _0x1ec881=_0x9e26[_0x35478d];return _0x1ec881;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x69e2('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x69e2('0x1'));var rimraf=require(_0x69e2('0x2'));var config=require('../../config/environment');var attributes=require(_0x69e2('0x3'));module[_0x69e2('0x4')]=function(_0x317f47,_0xa736e2){return _0x317f47[_0x69e2('0x5')](_0x69e2('0x6'),attributes,{'tableName':_0x69e2('0x7'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6bd=['AnalyticCustomReport','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6bd,0x64));var _0xdd6b=function(_0x999d55,_0xcd1f58){_0x999d55=_0x999d55-0x0;var _0x150655=_0xd6bd[_0x999d55];return _0x150655;};'use strict';var _=require(_0xdd6b('0x0'));var util=require('util');var logger=require(_0xdd6b('0x1'))(_0xdd6b('0x2'));var moment=require(_0xdd6b('0x3'));var BPromise=require('bluebird');var rp=require(_0xdd6b('0x4'));var fs=require('fs');var path=require(_0xdd6b('0x5'));var rimraf=require(_0xdd6b('0x6'));var config=require(_0xdd6b('0x7'));var attributes=require(_0xdd6b('0x8'));module[_0xdd6b('0x9')]=function(_0x149f1b,_0x2c3752){return _0x149f1b['define'](_0xdd6b('0xa'),attributes,{'tableName':'analytics_custom_reports','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 07fd25d..0823a6a 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 _0x7672=['request\x20sent','error','code','message','result','catch','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s'];(function(_0x10d413,_0x284a3e){var _0x2661c4=function(_0x5cf827){while(--_0x5cf827){_0x10d413['push'](_0x10d413['shift']());}};_0x2661c4(++_0x284a3e);}(_0x7672,0x146));var _0x2767=function(_0xe40509,_0x13b167){_0xe40509=_0xe40509-0x0;var _0x3e5750=_0x7672[_0xe40509];return _0x3e5750;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2767('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2767('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x2767('0x2'));var logger=require(_0x2767('0x3'))(_0x2767('0x4'));var config=require('../../config/environment');var jayson=require(_0x2767('0x5'));var client=jayson[_0x2767('0x6')][_0x2767('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9ec4b9,_0x131a7a,_0x2890e3){return new BPromise(function(_0x2317b8,_0x5368fa){return client[_0x2767('0x8')](_0x9ec4b9,_0x2890e3)[_0x2767('0x9')](function(_0xaeacc0){logger[_0x2767('0xa')](_0x2767('0xb'),_0x131a7a,'request\x20sent');logger[_0x2767('0xc')](_0x2767('0xd'),_0x131a7a,_0x2767('0xe'),JSON['stringify'](_0xaeacc0));if(_0xaeacc0[_0x2767('0xf')]){if(_0xaeacc0[_0x2767('0xf')][_0x2767('0x10')]===0x1f4){logger['error'](_0x2767('0xb'),_0x131a7a,_0xaeacc0[_0x2767('0xf')][_0x2767('0x11')]);return _0x5368fa(_0xaeacc0[_0x2767('0xf')][_0x2767('0x11')]);}logger[_0x2767('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x131a7a,_0xaeacc0[_0x2767('0xf')]['message']);return _0x2317b8(_0xaeacc0['error'][_0x2767('0x11')]);}else{logger[_0x2767('0xa')](_0x2767('0xb'),_0x131a7a,_0x2767('0xe'));_0x2317b8(_0xaeacc0[_0x2767('0x12')][_0x2767('0x11')]);}})[_0x2767('0x13')](function(_0x1f075a){logger[_0x2767('0xf')](_0x2767('0xb'),_0x131a7a,_0x1f075a);_0x5368fa(_0x1f075a);});});} \ No newline at end of file +var _0x73ad=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent'];(function(_0x127364,_0x591295){var _0x12c89a=function(_0x38d257){while(--_0x38d257){_0x127364['push'](_0x127364['shift']());}};_0x12c89a(++_0x591295);}(_0x73ad,0x1e0));var _0xd73a=function(_0x72d50b,_0x4db2d0){_0x72d50b=_0x72d50b-0x0;var _0x1a3ef1=_0x73ad[_0x72d50b];return _0x1a3ef1;};'use strict';var _=require(_0xd73a('0x0'));var util=require(_0xd73a('0x1'));var moment=require(_0xd73a('0x2'));var BPromise=require(_0xd73a('0x3'));var rs=require(_0xd73a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd73a('0x5'))['db'];var utils=require(_0xd73a('0x6'));var logger=require(_0xd73a('0x7'))('rpc');var config=require(_0xd73a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd73a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ebb57,_0x1fcb07,_0x3c1536){return new BPromise(function(_0x158298,_0x358cd3){return client['request'](_0x3ebb57,_0x3c1536)['then'](function(_0x4ed359){logger[_0xd73a('0xa')](_0xd73a('0xb'),_0x1fcb07,_0xd73a('0xc'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1fcb07,'request\x20sent',JSON['stringify'](_0x4ed359));if(_0x4ed359[_0xd73a('0xd')]){if(_0x4ed359[_0xd73a('0xd')][_0xd73a('0xe')]===0x1f4){logger['error'](_0xd73a('0xb'),_0x1fcb07,_0x4ed359[_0xd73a('0xd')][_0xd73a('0xf')]);return _0x358cd3(_0x4ed359['error']['message']);}logger[_0xd73a('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1fcb07,_0x4ed359[_0xd73a('0xd')][_0xd73a('0xf')]);return _0x158298(_0x4ed359[_0xd73a('0xd')][_0xd73a('0xf')]);}else{logger['info'](_0xd73a('0xb'),_0x1fcb07,'request\x20sent');_0x158298(_0x4ed359['result']['message']);}})[_0xd73a('0x10')](function(_0x39339f){logger[_0xd73a('0xd')](_0xd73a('0xb'),_0x1fcb07,_0x39339f);_0x358cd3(_0x39339f);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 48e653f..0cb9b54 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 _0xc7b3=['./analyticCustomReport.controller','get','isAuthenticated','/:id','show','preview','/:id/query','query','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x58ccba,_0x3cac10){var _0x4e2b73=function(_0x37ded0){while(--_0x37ded0){_0x58ccba['push'](_0x58ccba['shift']());}};_0x4e2b73(++_0x3cac10);}(_0xc7b3,0x1c6));var _0x3c7b=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc7b3[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0x3c7b('0x0'));var util=require(_0x3c7b('0x1'));var path=require('path');var timeout=require(_0x3c7b('0x2'));var express=require(_0x3c7b('0x3'));var router=express[_0x3c7b('0x4')]();var fs_extra=require(_0x3c7b('0x5'));var auth=require(_0x3c7b('0x6'));var interaction=require(_0x3c7b('0x7'));var config=require('../../config/environment');var controller=require(_0x3c7b('0x8'));router[_0x3c7b('0x9')]('/',auth[_0x3c7b('0xa')](),controller['index']);router[_0x3c7b('0x9')](_0x3c7b('0xb'),auth['isAuthenticated'](),controller[_0x3c7b('0xc')]);router[_0x3c7b('0x9')]('/:id/preview',auth[_0x3c7b('0xa')](),controller[_0x3c7b('0xd')]);router[_0x3c7b('0x9')]('/:id/run',auth[_0x3c7b('0xa')](),controller['run']);router[_0x3c7b('0x9')](_0x3c7b('0xe'),auth['isAuthenticated'](),controller[_0x3c7b('0xf')]);router[_0x3c7b('0x10')]('/',auth[_0x3c7b('0xa')](),controller[_0x3c7b('0x11')]);router[_0x3c7b('0x12')](_0x3c7b('0xb'),auth['isAuthenticated'](),controller[_0x3c7b('0x13')]);router['delete'](_0x3c7b('0xb'),auth[_0x3c7b('0xa')](),controller[_0x3c7b('0x14')]);module[_0x3c7b('0x15')]=router; \ No newline at end of file +var _0x8654=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8654,0xfa));var _0x4865=function(_0x3623d3,_0x529b09){_0x3623d3=_0x3623d3-0x0;var _0x4c6a04=_0x8654[_0x3623d3];return _0x4c6a04;};'use strict';var multer=require('multer');var util=require(_0x4865('0x0'));var path=require(_0x4865('0x1'));var timeout=require(_0x4865('0x2'));var express=require(_0x4865('0x3'));var router=express[_0x4865('0x4')]();var fs_extra=require(_0x4865('0x5'));var auth=require(_0x4865('0x6'));var interaction=require(_0x4865('0x7'));var config=require(_0x4865('0x8'));var controller=require(_0x4865('0x9'));router['get']('/',auth[_0x4865('0xa')](),controller[_0x4865('0xb')]);router[_0x4865('0xc')](_0x4865('0xd'),auth['isAuthenticated'](),controller[_0x4865('0xe')]);router[_0x4865('0xc')](_0x4865('0xf'),auth[_0x4865('0xa')](),controller[_0x4865('0x10')]);router[_0x4865('0xc')](_0x4865('0x11'),auth[_0x4865('0xa')](),controller['run']);router[_0x4865('0xc')](_0x4865('0x12'),auth[_0x4865('0xa')](),controller[_0x4865('0x13')]);router[_0x4865('0x14')]('/',auth[_0x4865('0xa')](),controller[_0x4865('0x15')]);router[_0x4865('0x16')]('/:id',auth[_0x4865('0xa')](),controller[_0x4865('0x17')]);router[_0x4865('0x18')]('/:id',auth[_0x4865('0xa')](),controller[_0x4865('0x19')]);module[_0x4865('0x1a')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 20fae77..ba5e84a 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 _0xc3d4=['STRING','TEXT','exports'];(function(_0x1293fa,_0x446d6b){var _0x1dd054=function(_0x1b2d93){while(--_0x1b2d93){_0x1293fa['push'](_0x1293fa['shift']());}};_0x1dd054(++_0x446d6b);}(_0xc3d4,0x104));var _0x4c3d=function(_0x1717f5,_0x17ec76){_0x1717f5=_0x1717f5-0x0;var _0x2ba043=_0xc3d4[_0x1717f5];return _0x2ba043;};'use strict';var Sequelize=require('sequelize');module[_0x4c3d('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4c3d('0x1')]},'parent':{'type':Sequelize[_0x4c3d('0x1')]},'table':{'type':Sequelize[_0x4c3d('0x1')]},'conditions':{'type':Sequelize[_0x4c3d('0x2')]},'joins':{'type':Sequelize[_0x4c3d('0x2')]}}; \ No newline at end of file +var _0x8870=['TEXT','sequelize','exports','STRING'];(function(_0x324cce,_0x492e4a){var _0x3b4a7c=function(_0x190cd1){while(--_0x190cd1){_0x324cce['push'](_0x324cce['shift']());}};_0x3b4a7c(++_0x492e4a);}(_0x8870,0x171));var _0x0887=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x8870[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x0887('0x0'));module[_0x0887('0x1')]={'name':{'type':Sequelize[_0x0887('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0887('0x2')]},'parent':{'type':Sequelize[_0x0887('0x2')]},'table':{'type':Sequelize[_0x0887('0x2')]},'conditions':{'type':Sequelize[_0x0887('0x3')]},'joins':{'type':Sequelize[_0x0887('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index c40c235..12dd60d 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 _0x7814=['key','map','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','findAll','catch','show','rawAttributes','keys','create','user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','error','update','params','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','value','Sequelize','AnalyticMetric','keyBy','table','MetricId','metric','field','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','MIN(%s)','UNIX_TIMESTAMP(%s)','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','from','output','web','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','select','COUNT(*)','run','runReport','eml-format','rimraf','fast-json-patch','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','DefaultReports','UserProfileResource','stack','name','send','render','merge','body','contact','message','account','index','AnalyticDefaultReport','fieldName','type'];(function(_0x451a86,_0x101d8b){var _0x2b2c79=function(_0x306329){while(--_0x306329){_0x451a86['push'](_0x451a86['shift']());}};_0x2b2c79(++_0x101d8b);}(_0x7814,0x73));var _0x4781=function(_0x48b6b9,_0x3dd5e7){_0x48b6b9=_0x48b6b9-0x0;var _0x41ae74=_0x7814[_0x48b6b9];return _0x41ae74;};'use strict';var emlformat=require(_0x4781('0x0'));var rimraf=require(_0x4781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4781('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4781('0x3'));var util=require('util');var path=require(_0x4781('0x4'));var sox=require(_0x4781('0x5'));var csv=require(_0x4781('0x6'));var ejs=require(_0x4781('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4781('0x8'));var squel=require(_0x4781('0x9'));var crypto=require(_0x4781('0xa'));var jsforce=require(_0x4781('0xb'));var deskjs=require(_0x4781('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4781('0xd'));var Papa=require(_0x4781('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4781('0xf'));var as=require(_0x4781('0x10'));var hardwareService=require(_0x4781('0x11'));var logger=require(_0x4781('0x12'))(_0x4781('0x13'));var utils=require(_0x4781('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4781('0x15'))['db'];var dbH=require(_0x4781('0x15'))[_0x4781('0x16')];function respondWithStatusCode(_0x2f1407,_0x579eb2){_0x579eb2=_0x579eb2||0xcc;return function(_0x5b8d16){if(_0x5b8d16){return _0x2f1407[_0x4781('0x17')](_0x579eb2);}return _0x2f1407[_0x4781('0x18')](_0x579eb2)[_0x4781('0x19')]();};}function respondWithResult(_0x15d064,_0x476d95){_0x476d95=_0x476d95||0xc8;return function(_0x55ca42){if(_0x55ca42){return _0x15d064[_0x4781('0x18')](_0x476d95)[_0x4781('0x1a')](_0x55ca42);}};}function respondWithFilteredResult(_0x55810e,_0x3bb1d0){return function(_0x1f321d){if(_0x1f321d){var _0x5066bd=typeof _0x3bb1d0[_0x4781('0x1b')]===_0x4781('0x1c')&&typeof _0x3bb1d0[_0x4781('0x1d')]===_0x4781('0x1c');var _0x5e7910=_0x1f321d[_0x4781('0x1e')];var _0x413576=_0x5066bd?0x0:_0x3bb1d0['offset'];var _0x1af231=_0x5066bd?_0x1f321d['count']:_0x3bb1d0[_0x4781('0x1b')]+_0x3bb1d0[_0x4781('0x1d')];var _0x1c721f;if(_0x1af231>=_0x5e7910){_0x1af231=_0x5e7910;_0x1c721f=0xc8;}else{_0x1c721f=0xce;}_0x55810e[_0x4781('0x18')](_0x1c721f);return _0x55810e[_0x4781('0x1f')](_0x4781('0x20'),_0x413576+'-'+_0x1af231+'/'+_0x5e7910)[_0x4781('0x1a')](_0x1f321d);}return null;};}function patchUpdates(_0x1e427d){return function(_0x4439c8){try{jsonpatch[_0x4781('0x21')](_0x4439c8,_0x1e427d,!![]);}catch(_0x3c37c9){return BPromise[_0x4781('0x22')](_0x3c37c9);}return _0x4439c8['save']();};}function saveUpdates(_0x3fed7d,_0x200678){return function(_0x24f4f9){if(_0x24f4f9){return _0x24f4f9['update'](_0x3fed7d)[_0x4781('0x23')](function(_0x481719){return _0x481719;});}return null;};}function removeEntity(_0x5f0549,_0x44f94f){return function(_0x57af01){if(_0x57af01){return _0x57af01[_0x4781('0x24')]()[_0x4781('0x23')](function(){var _0x45bad3=_0x57af01[_0x4781('0x25')]({'plain':!![]});var _0x2fabf1=_0x4781('0x26');return db[_0x4781('0x27')][_0x4781('0x24')]({'where':{'type':_0x2fabf1,'resourceId':_0x45bad3['id']}})[_0x4781('0x23')](function(){return _0x57af01;});})[_0x4781('0x23')](function(){_0x5f0549['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25db9e,_0xbec164){return function(_0x273f10){if(!_0x273f10){_0x25db9e[_0x4781('0x17')](0x194);}return _0x273f10;};}function handleError(_0x173a8b,_0x2d28e6){_0x2d28e6=_0x2d28e6||0x1f4;return function(_0x1be070){logger['error'](_0x1be070[_0x4781('0x28')]);if(_0x1be070[_0x4781('0x29')]){delete _0x1be070[_0x4781('0x29')];}_0x173a8b[_0x4781('0x18')](_0x2d28e6)[_0x4781('0x2a')](_0x1be070);};}function getMustacheRender(_0x582989,_0x41cacd){return Mustache[_0x4781('0x2b')](_0x582989,_[_0x4781('0x2c')](_0x41cacd[_0x4781('0x2d')],{'contact':_0x41cacd[_0x4781('0x2e')],'message':_0x41cacd[_0x4781('0x2f')],'agent':_0x41cacd['agent'],'interaction':_0x41cacd['interaction'],'account':_0x41cacd[_0x4781('0x30')]}))||'';}exports[_0x4781('0x31')]=function(_0x13d106,_0x1d0b71){var _0x7a0746={},_0x1d6a5f={},_0x10b2dd={'count':0x0,'rows':[]};var _0x30a148=_['map'](db[_0x4781('0x32')]['rawAttributes'],function(_0xaf506c){return{'name':_0xaf506c[_0x4781('0x33')],'type':_0xaf506c[_0x4781('0x34')][_0x4781('0x35')]};});_0x1d6a5f['model']=_[_0x4781('0x36')](_0x30a148,_0x4781('0x29'));_0x1d6a5f[_0x4781('0x37')]=_['keys'](_0x13d106[_0x4781('0x37')]);_0x1d6a5f[_0x4781('0x38')]=_[_0x4781('0x39')](_0x1d6a5f['model'],_0x1d6a5f[_0x4781('0x37')]);_0x7a0746[_0x4781('0x3a')]=_[_0x4781('0x39')](_0x1d6a5f['model'],qs[_0x4781('0x3b')](_0x13d106['query'][_0x4781('0x3b')]));_0x7a0746[_0x4781('0x3a')]=_0x7a0746['attributes'][_0x4781('0x3c')]?_0x7a0746[_0x4781('0x3a')]:_0x1d6a5f[_0x4781('0x3d')];if(!_0x13d106[_0x4781('0x37')][_0x4781('0x3e')](_0x4781('0x3f'))){_0x7a0746['limit']=qs[_0x4781('0x1d')](_0x13d106['query']['limit']);_0x7a0746[_0x4781('0x1b')]=qs[_0x4781('0x1b')](_0x13d106[_0x4781('0x37')]['offset']);}_0x7a0746[_0x4781('0x40')]=qs[_0x4781('0x41')](_0x13d106[_0x4781('0x37')][_0x4781('0x41')]);_0x7a0746[_0x4781('0x42')]=qs[_0x4781('0x38')](_['pick'](_0x13d106[_0x4781('0x37')],_0x1d6a5f[_0x4781('0x38')]),_0x30a148);if(_0x13d106['query'][_0x4781('0x43')]){_0x7a0746['where']=_[_0x4781('0x2c')](_0x7a0746[_0x4781('0x42')],{'$or':_[_0x4781('0x36')](_0x30a148,function(_0x580d62){if(_0x580d62[_0x4781('0x34')]!=='VIRTUAL'){var _0x2dc69a={};_0x2dc69a[_0x580d62[_0x4781('0x29')]]={'$like':'%'+_0x13d106[_0x4781('0x37')][_0x4781('0x43')]+'%'};return _0x2dc69a;}})});}_0x7a0746=_[_0x4781('0x2c')]({},_0x7a0746,_0x13d106[_0x4781('0x44')]);var _0x245cfd={'where':_0x7a0746[_0x4781('0x42')]};return db[_0x4781('0x32')][_0x4781('0x1e')](_0x245cfd)[_0x4781('0x23')](function(_0x41e0b9){_0x10b2dd[_0x4781('0x1e')]=_0x41e0b9;if(_0x13d106[_0x4781('0x37')][_0x4781('0x45')]){_0x7a0746[_0x4781('0x46')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x4781('0x47')](_0x7a0746);})[_0x4781('0x23')](function(_0x3f7b62){_0x10b2dd['rows']=_0x3f7b62;return _0x10b2dd;})[_0x4781('0x23')](respondWithFilteredResult(_0x1d0b71,_0x7a0746))[_0x4781('0x48')](handleError(_0x1d0b71,null));};exports[_0x4781('0x49')]=function(_0x25efbb,_0x270012){var _0x54147c={'raw':!![],'where':{'id':_0x25efbb['params']['id']}},_0x102200={};_0x102200[_0x4781('0x3d')]=_['keys'](db[_0x4781('0x32')][_0x4781('0x4a')]);_0x102200[_0x4781('0x37')]=_[_0x4781('0x4b')](_0x25efbb['query']);_0x102200['filters']=_['intersection'](_0x102200['model'],_0x102200[_0x4781('0x37')]);_0x54147c[_0x4781('0x3a')]=_[_0x4781('0x39')](_0x102200[_0x4781('0x3d')],qs[_0x4781('0x3b')](_0x25efbb[_0x4781('0x37')][_0x4781('0x3b')]));_0x54147c['attributes']=_0x54147c[_0x4781('0x3a')][_0x4781('0x3c')]?_0x54147c[_0x4781('0x3a')]:_0x102200['model'];if(_0x25efbb['query'][_0x4781('0x45')]){_0x54147c['include']=[{'all':!![]}];}_0x54147c=_[_0x4781('0x2c')]({},_0x54147c,_0x25efbb['options']);return db[_0x4781('0x32')]['find'](_0x54147c)[_0x4781('0x23')](handleEntityNotFound(_0x270012,null))['then'](respondWithResult(_0x270012,null))[_0x4781('0x48')](handleError(_0x270012,null));};exports[_0x4781('0x4c')]=function(_0x329a54,_0x297a4d){return db[_0x4781('0x32')][_0x4781('0x4c')](_0x329a54[_0x4781('0x2d')],{})['then'](function(_0x5cf6db){var _0x465913=_0x329a54[_0x4781('0x4d')][_0x4781('0x25')]({'plain':!![]});if(!_0x465913)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x465913[_0x4781('0x4e')]===_0x4781('0x4d')){var _0x547e55=_0x5cf6db['get']({'plain':!![]});var _0x244aa2=_0x4781('0x4f');return db[_0x4781('0x50')][_0x4781('0x51')]({'where':{'name':_0x244aa2,'userProfileId':_0x465913[_0x4781('0x52')]},'raw':!![]})[_0x4781('0x23')](function(_0x34c5b9){if(_0x34c5b9&&_0x34c5b9[_0x4781('0x53')]===0x0){return db[_0x4781('0x27')][_0x4781('0x4c')]({'name':_0x547e55[_0x4781('0x29')],'resourceId':_0x547e55['id'],'type':_0x4781('0x26'),'sectionId':_0x34c5b9['id']},{})[_0x4781('0x23')](function(){return _0x5cf6db;});}else{return _0x5cf6db;}})[_0x4781('0x48')](function(_0x3d3556){logger[_0x4781('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d3556);throw _0x3d3556;});}return _0x5cf6db;})[_0x4781('0x23')](respondWithResult(_0x297a4d,0xc9))['catch'](handleError(_0x297a4d,null));};exports[_0x4781('0x55')]=function(_0x5bd612,_0x2eedd7){if(_0x5bd612['body']['id']){delete _0x5bd612['body']['id'];}return db[_0x4781('0x32')][_0x4781('0x51')]({'where':{'id':_0x5bd612[_0x4781('0x56')]['id']}})[_0x4781('0x23')](handleEntityNotFound(_0x2eedd7,null))[_0x4781('0x23')](saveUpdates(_0x5bd612[_0x4781('0x2d')],null))[_0x4781('0x23')](respondWithResult(_0x2eedd7,null))[_0x4781('0x48')](handleError(_0x2eedd7,null));};exports[_0x4781('0x24')]=function(_0x98dcf,_0x11a2e7){return db[_0x4781('0x32')][_0x4781('0x51')]({'where':{'id':_0x98dcf[_0x4781('0x56')]['id']}})[_0x4781('0x23')](handleEntityNotFound(_0x11a2e7,null))['then'](removeEntity(_0x11a2e7,null))[_0x4781('0x48')](handleError(_0x11a2e7,null));};exports[_0x4781('0x57')]=function(_0x2317db,_0x4e806d){var _0x314df3=0xa;var _0xfc717e=[_0x4781('0x58'),_0x4781('0x59'),_0x4781('0x5a'),_0x4781('0x5b')];var _0x46f7f1={'SUM':'SUM(%s)','COUNT':_0x4781('0x5c'),'COUNT DISTINCT':_0x4781('0x5d'),'MAX':_0x4781('0x5e'),'MIN':'MIN(%s)','AVG':_0x4781('0x5f'),'GROUP_CONCAT':_0x4781('0x60'),'GROUP_CONCAT ASC':_0x4781('0x61'),'GROUP_CONCAT DESC':_0x4781('0x62')};var _0x2ff7f6={'SEC_TO_TIME':_0x4781('0x63'),'DATE':_0x4781('0x64'),'HOUR':_0x4781('0x65'),'ROUND':_0x4781('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2533b2=function(_0x9605c5){return!_[_0x4781('0x67')]([_0x4781('0x68'),_0x4781('0x69'),_0x4781('0x6a'),_0x4781('0x6b')],_0x9605c5);};var _0x517207=function(_0x7da29a){if(!_0x7da29a||!_0x7da29a[_0x4781('0x6c')][_0x4781('0x3c')]){return'';}for(var _0x2879aa='(',_0x41461d=0x0;_0x41461d<_0x7da29a[_0x4781('0x6c')]['length'];_0x41461d+=0x1){_0x41461d>0x0&&(_0x2879aa+='\x20'+_0x7da29a[_0x4781('0x6d')]+'\x20');_0x2879aa+=_0x7da29a[_0x4781('0x6c')][_0x41461d]['group']?_0x517207(_0x7da29a[_0x4781('0x6c')][_0x41461d][_0x4781('0x6e')]):_0x7da29a[_0x4781('0x6c')][_0x41461d]['field']+'\x20'+_0x7da29a['rules'][_0x41461d]['condition']+(_0x2533b2(_0x7da29a[_0x4781('0x6c')][_0x41461d]['condition'])?'\x20'+_0x7da29a[_0x4781('0x6c')][_0x41461d][_0x4781('0x6f')]:'');}return _0x2879aa+')';};var _0x1e0844={'where':{'id':_0x2317db[_0x4781('0x56')]['id']}},_0x4b3984,_0x58c51d,_0x276f2a,_0x55735d,_0x5ec763;_0x1e0844=_[_0x4781('0x2c')]({},_0x1e0844,_0x2317db['options']);return db[_0x4781('0x32')][_0x4781('0x51')](_0x1e0844)[_0x4781('0x23')](function(_0x4dd261){if(_0x4dd261){_0x4b3984=_0x4dd261;return _0x4dd261['getFields']();}return null;})[_0x4781('0x23')](function(_0x3b207a){if(_0x3b207a){if(!_0x3b207a[_0x4781('0x3c')]){throw new db[(_0x4781('0x70'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x58c51d=_0x3b207a;return db[_0x4781('0x71')]['findAll']({'raw':!![]});}return null;})[_0x4781('0x23')](function(_0x188eab){if(_0x188eab){_0x276f2a=_[_0x4781('0x72')](_0x188eab,'id');var _0x15acb1;var _0x25d32f=squel['select']();_0x25d32f['from'](_0x4b3984[_0x4781('0x73')]);for(var _0x2e3dec=0x0;_0x2e3dec<_0x58c51d['length'];_0x2e3dec+=0x1){_0x15acb1=_0x58c51d[_0x2e3dec][_0x4781('0x74')]?_0x276f2a[_0x58c51d[_0x2e3dec][_0x4781('0x74')]][_0x4781('0x75')]:_0x58c51d[_0x2e3dec][_0x4781('0x76')];_0x15acb1=_0x58c51d[_0x2e3dec]['function']?_[_0x4781('0x77')](_0x46f7f1[_0x58c51d[_0x2e3dec][_0x4781('0x78')]],'%s',_0x15acb1):_0x15acb1;_0x15acb1=_0x58c51d[_0x2e3dec][_0x4781('0x79')]?_[_0x4781('0x77')](_0x2ff7f6[_0x58c51d[_0x2e3dec][_0x4781('0x79')]],'%s',_0x15acb1):_0x15acb1;if(_0x58c51d[_0x2e3dec][_0x4781('0x7a')]){_0x25d32f[_0x4781('0x6e')](_0x15acb1);}_0x58c51d[_0x2e3dec][_0x4781('0x7b')]&&_0x25d32f[_0x4781('0x40')](_0x15acb1,_0x58c51d[_0x2e3dec]['orderBy']===_0x4781('0x7c')?![]:!![]);_0x25d32f[_0x4781('0x76')](_0x15acb1,_0x58c51d[_0x2e3dec][_0x4781('0x7d')]||_0x15acb1);}if(_0x4b3984[_0x4781('0x7e')]){_0x4b3984['joins']=JSON[_0x4781('0x7f')](_0x4b3984[_0x4781('0x7e')]);for(var _0x5e8864=0x0;_0x5e8864<_0x4b3984['joins'][_0x4781('0x3c')];_0x5e8864+=0x1){if(_0x4b3984[_0x4781('0x7e')][_0x5e8864][_0x4781('0x34')]&&_[_0x4781('0x67')](_0xfc717e,_0x4b3984[_0x4781('0x7e')][_0x5e8864][_0x4781('0x34')])&&_0x4b3984[_0x4781('0x7e')][_0x5e8864][_0x4781('0x80')]&&_0x4b3984[_0x4781('0x7e')][_0x5e8864][_0x4781('0x81')]&&_0x4b3984[_0x4781('0x7e')][_0x5e8864][_0x4781('0x82')]){_0x25d32f[_0x4b3984[_0x4781('0x7e')][_0x5e8864]['type']](_0x4b3984[_0x4781('0x7e')][_0x5e8864]['foreignTable'],null,util[_0x4781('0x79')](_0x4781('0x83'),_0x4b3984[_0x4781('0x73')],_0x4b3984[_0x4781('0x7e')][_0x5e8864][_0x4781('0x80')],_0x4b3984[_0x4781('0x7e')][_0x5e8864][_0x4781('0x81')],_0x4b3984[_0x4781('0x7e')][_0x5e8864][_0x4781('0x82')]));}}}if(_0x4b3984[_0x4781('0x84')]){_0x4b3984['conditions']=JSON['parse'](_0x4b3984['conditions']);_0x25d32f['where'](_0x517207(_0x4b3984[_0x4781('0x84')][_0x4781('0x6e')]));}_0x5ec763=_0x25d32f['clone']();_0x25d32f[_0x4781('0x1d')](_0x314df3);_0x25d32f[_0x4781('0x1b')](0x0);logger[_0x4781('0x85')](_0x4781('0x86'),_0x25d32f[_0x4781('0x87')]());return dbH[_0x4781('0x88')][_0x4781('0x37')](_0x25d32f['toString'](),{'type':dbH[_0x4781('0x88')][_0x4781('0x89')][_0x4781('0x8a')]});}})[_0x4781('0x23')](respondWithResult(_0x4e806d,null))[_0x4781('0x48')](handleError(_0x4e806d,null));};function runReport(_0x13d91c,_0x130bbb,_0x358eaa){var _0xc4cbf1=_0x130bbb[_0x4781('0x29')];var _0x564c53=0xa;var _0x411ca1=['join',_0x4781('0x59'),_0x4781('0x5a'),'cross_join'];var _0x5e60db={'SUM':_0x4781('0x8b'),'COUNT':_0x4781('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x4781('0x5e'),'MIN':_0x4781('0x8c'),'AVG':_0x4781('0x5f'),'GROUP_CONCAT':_0x4781('0x60'),'GROUP_CONCAT ASC':_0x4781('0x61'),'GROUP_CONCAT DESC':_0x4781('0x62')};var _0x5efaa4={'SEC_TO_TIME':_0x4781('0x63'),'DATE':_0x4781('0x64'),'HOUR':_0x4781('0x65'),'ROUND':_0x4781('0x66'),'UNIX_TIMESTAMP':_0x4781('0x8d')};var _0x2cd3d6=function(_0x1a9c13){return!_['includes'](['IS\x20NULL',_0x4781('0x69'),_0x4781('0x6a'),_0x4781('0x6b')],_0x1a9c13);};var _0x2361c6=function(_0x5a205c){if(!_0x5a205c||!_0x5a205c[_0x4781('0x6c')][_0x4781('0x3c')]){return'';}for(var _0x1c4581='(',_0x4aa03f=0x0;_0x4aa03f<_0x5a205c[_0x4781('0x6c')]['length'];_0x4aa03f+=0x1){_0x4aa03f>0x0&&(_0x1c4581+='\x20'+_0x5a205c[_0x4781('0x6d')]+'\x20');_0x1c4581+=_0x5a205c[_0x4781('0x6c')][_0x4aa03f][_0x4781('0x6e')]?_0x2361c6(_0x5a205c[_0x4781('0x6c')][_0x4aa03f]['group']):_0x5a205c[_0x4781('0x6c')][_0x4aa03f]['field']+'\x20'+_0x5a205c[_0x4781('0x6c')][_0x4aa03f][_0x4781('0x8e')]+(_0x2cd3d6(_0x5a205c[_0x4781('0x6c')][_0x4aa03f][_0x4781('0x8e')])?'\x20'+_0x5a205c[_0x4781('0x6c')][_0x4aa03f][_0x4781('0x6f')]:'');}return _0x1c4581+')';};var _0xe860c9={'where':{'id':_0x13d91c['id']}},_0x57f11c,_0x7ae72f,_0x333f01,_0x248316,_0x5b4a8a;_0xe860c9=_['merge']({},_0xe860c9,_0x358eaa);return db[_0x4781('0x32')][_0x4781('0x51')](_0xe860c9)[_0x4781('0x23')](function(_0x254397){if(_0x254397){_0x57f11c=_0x254397;return _0x254397[_0x4781('0x8f')]();}return null;})[_0x4781('0x23')](function(_0xcd3d07){if(_0xcd3d07){if(!_0xcd3d07[_0x4781('0x3c')]){throw new db[(_0x4781('0x70'))][(_0x4781('0x90'))](_0x4781('0x91'),0x193);}_0x7ae72f=_0xcd3d07;return db[_0x4781('0x71')][_0x4781('0x47')]({'raw':!![]});}return null;})[_0x4781('0x23')](function(_0x1cd0b8){if(_0x1cd0b8){_0x333f01=_['keyBy'](_0x1cd0b8,'id');var _0x8bf665;var _0x477a44=squel['select']();_0x477a44[_0x4781('0x92')](_0x57f11c[_0x4781('0x73')]);for(var _0x2f076f=0x0;_0x2f076f<_0x7ae72f[_0x4781('0x3c')];_0x2f076f+=0x1){_0x8bf665=_0x7ae72f[_0x2f076f]['MetricId']?_0x333f01[_0x7ae72f[_0x2f076f]['MetricId']]['metric']:_0x7ae72f[_0x2f076f][_0x4781('0x76')];_0x8bf665=_0x7ae72f[_0x2f076f]['function']?_['replace'](_0x5e60db[_0x7ae72f[_0x2f076f][_0x4781('0x78')]],'%s',_0x8bf665):_0x8bf665;_0x8bf665=_0x7ae72f[_0x2f076f][_0x4781('0x79')]?_[_0x4781('0x77')](_0x5efaa4[_0x7ae72f[_0x2f076f]['format']],'%s',_0x8bf665):_0x8bf665;if(_0x7ae72f[_0x2f076f][_0x4781('0x7a')]){_0x477a44['group'](_0x8bf665);}_0x7ae72f[_0x2f076f][_0x4781('0x7b')]&&_0x477a44[_0x4781('0x40')](_0x8bf665,_0x7ae72f[_0x2f076f][_0x4781('0x7b')]===_0x4781('0x7c')?![]:!![]);_0x477a44['field'](_0x8bf665,_0x7ae72f[_0x2f076f][_0x4781('0x7d')]||_0x8bf665);}if(_0x57f11c[_0x4781('0x7e')]){_0x57f11c[_0x4781('0x7e')]=JSON[_0x4781('0x7f')](_0x57f11c[_0x4781('0x7e')]);for(var _0x28b35b=0x0;_0x28b35b<_0x57f11c[_0x4781('0x7e')][_0x4781('0x3c')];_0x28b35b+=0x1){if(_0x57f11c[_0x4781('0x7e')][_0x28b35b][_0x4781('0x34')]&&_[_0x4781('0x67')](_0x411ca1,_0x57f11c[_0x4781('0x7e')][_0x28b35b][_0x4781('0x34')])&&_0x57f11c[_0x4781('0x7e')][_0x28b35b]['parentKey']&&_0x57f11c['joins'][_0x28b35b][_0x4781('0x81')]&&_0x57f11c[_0x4781('0x7e')][_0x28b35b]['foreignKey']){_0x477a44[_0x57f11c['joins'][_0x28b35b][_0x4781('0x34')]](_0x57f11c[_0x4781('0x7e')][_0x28b35b][_0x4781('0x81')],null,util[_0x4781('0x79')](_0x4781('0x83'),_0x57f11c[_0x4781('0x73')],_0x57f11c[_0x4781('0x7e')][_0x28b35b]['parentKey'],_0x57f11c[_0x4781('0x7e')][_0x28b35b][_0x4781('0x81')],_0x57f11c['joins'][_0x28b35b][_0x4781('0x82')]));}}}if(_0x57f11c['conditions']){_0x57f11c[_0x4781('0x84')]=JSON[_0x4781('0x7f')](_0x57f11c[_0x4781('0x84')]);_0x477a44[_0x4781('0x42')](_0x2361c6(_0x57f11c[_0x4781('0x84')][_0x4781('0x6e')]));}_0x5b4a8a=_0x477a44['clone']();_0x477a44['limit'](_0x564c53);_0x477a44[_0x4781('0x1b')](0x0);return;}})[_0x4781('0x23')](function(){if(_0x130bbb[_0x4781('0x93')]===_0x4781('0x94')){return null;}var _0x3e5d15=_[_0x4781('0x2c')](_0x130bbb,{'name':_0x130bbb['fullPath']||_0x130bbb[_0x4781('0x29')]||_0x57f11c[_0x4781('0x29')],'basename':_0xc4cbf1,'savename':util[_0x4781('0x79')](_0x4781('0x95'),_0x130bbb[_0x4781('0x29')]||_0x57f11c[_0x4781('0x29')],require('randomstring')[_0x4781('0x96')](0x4),_0x130bbb['output']||_0x4781('0x97')),'reportId':_0x57f11c['id'],'reportType':_0x4781('0x98')});return db[_0x4781('0x99')][_0x4781('0x4c')](_0x3e5d15,{'raw':!![]});})[_0x4781('0x23')](function(_0xc32218){if(_0x57f11c['table']===_0x4781('0x9a')){_0x5b4a8a['where'](_0x57f11c[_0x4781('0x73')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x130bbb[_0x4781('0x9b')],_0x130bbb[_0x4781('0x9c')]);}else{_0x5b4a8a[_0x4781('0x42')](_0x57f11c['table']+_0x4781('0x9d'),_0x130bbb[_0x4781('0x9b')],_0x130bbb[_0x4781('0x9c')]);}if(_0xc32218){logger[_0x4781('0x9e')](_0x4781('0x9f'),_0x5b4a8a['toString']());require(_0x4781('0xa0'))[_0x4781('0xa1')](path[_0x4781('0x58')](__dirname,_0x4781('0xa2'),_0xc32218[_0x4781('0x93')]),[_0xc32218['id'],_0x5b4a8a['toString'](),path[_0x4781('0x58')](__dirname,_0x4781('0xa3'),_0xc32218['savename']),_0xc4cbf1]);return _0xc32218;}else{var _0x492834=squel[_0x4781('0xa4')]();_0x492834['from']('('+_0x5b4a8a[_0x4781('0x87')]()+')','countTable');_0x492834['field'](_0x4781('0xa5'),_0x4781('0x1e'));_0x5b4a8a[_0x4781('0x1d')](_0x130bbb[_0x4781('0x1d')]||_0x564c53);_0x5b4a8a[_0x4781('0x1b')](_0x130bbb[_0x4781('0x1b')]||0x0);return dbH[_0x4781('0x88')][_0x4781('0x37')](_0x492834['toString'](),{'type':dbH[_0x4781('0x88')]['QueryTypes'][_0x4781('0x8a')]})[_0x4781('0x23')](function(_0x337d9f){if(!_0x337d9f[_0x4781('0x3c')]){_0x248316=0x0;}else{_0x248316=_0x337d9f[0x0][_0x4781('0x1e')]||0x0;}return dbH[_0x4781('0x88')][_0x4781('0x37')](_0x5b4a8a[_0x4781('0x87')](),{'type':dbH[_0x4781('0x88')][_0x4781('0x89')][_0x4781('0x8a')]});})['then'](function(_0x1adb37){return{'rows':_0x1adb37||[],'count':_0x248316};});}});}exports[_0x4781('0xa6')]=function(_0x322292,_0x4f38ff){return runReport(_0x322292['params'],_0x322292['query'],_0x322292['options'])[_0x4781('0x23')](respondWithResult(_0x4f38ff,null))[_0x4781('0x48')](handleError(_0x4f38ff,null));};exports[_0x4781('0xa7')]=runReport;exports[_0x4781('0x37')]=function(_0x10945d,_0x11d945){var _0x2696c5=0xa;var _0x52ab9e=[_0x4781('0x58'),'left_join',_0x4781('0x5a'),_0x4781('0x5b')];var _0x16e4fe={'SUM':_0x4781('0x8b'),'COUNT':_0x4781('0x5c'),'COUNT DISTINCT':_0x4781('0x5d'),'MAX':_0x4781('0x5e'),'MIN':_0x4781('0x8c'),'AVG':_0x4781('0x5f'),'GROUP_CONCAT':_0x4781('0x60'),'GROUP_CONCAT ASC':_0x4781('0x61'),'GROUP_CONCAT DESC':_0x4781('0x62')};var _0x222818={'SEC_TO_TIME':_0x4781('0x63'),'DATE':'DATE(%s)','HOUR':_0x4781('0x65'),'ROUND':_0x4781('0x66'),'UNIX_TIMESTAMP':_0x4781('0x8d')};var _0x13c977=function(_0xddad8d){return!_[_0x4781('0x67')](['IS\x20NULL',_0x4781('0x69'),_0x4781('0x6a'),_0x4781('0x6b')],_0xddad8d);};var _0x1a109a=function(_0x55445d){if(!_0x55445d||!_0x55445d[_0x4781('0x6c')]['length']){return'';}for(var _0x8abe3f='(',_0x329c1e=0x0;_0x329c1e<_0x55445d[_0x4781('0x6c')][_0x4781('0x3c')];_0x329c1e+=0x1){_0x329c1e>0x0&&(_0x8abe3f+='\x20'+_0x55445d['operator']+'\x20');_0x8abe3f+=_0x55445d[_0x4781('0x6c')][_0x329c1e][_0x4781('0x6e')]?_0x1a109a(_0x55445d[_0x4781('0x6c')][_0x329c1e]['group']):_0x55445d[_0x4781('0x6c')][_0x329c1e][_0x4781('0x76')]+'\x20'+_0x55445d[_0x4781('0x6c')][_0x329c1e][_0x4781('0x8e')]+(_0x13c977(_0x55445d[_0x4781('0x6c')][_0x329c1e][_0x4781('0x8e')])?'\x20'+_0x55445d[_0x4781('0x6c')][_0x329c1e]['value']:'');}return _0x8abe3f+')';};var _0x498356={'where':{'id':_0x10945d[_0x4781('0x56')]['id']}},_0x119395,_0x582af7,_0xb22a9c,_0x2fe15e,_0x28d06f;_0x498356=_[_0x4781('0x2c')]({},_0x498356,_0x10945d[_0x4781('0x44')]);return db[_0x4781('0x32')]['find'](_0x498356)[_0x4781('0x23')](function(_0x5cc7dd){if(_0x5cc7dd){_0x119395=_0x5cc7dd;return _0x5cc7dd['getFields']();}return null;})[_0x4781('0x23')](function(_0x2875e2){if(_0x2875e2){if(!_0x2875e2[_0x4781('0x3c')]){throw new db[(_0x4781('0x70'))][(_0x4781('0x90'))](_0x4781('0x91'),0x193);}_0x582af7=_0x2875e2;return db[_0x4781('0x71')][_0x4781('0x47')]({'raw':!![]});}return null;})[_0x4781('0x23')](function(_0xca2200){if(_0xca2200){_0xb22a9c=_[_0x4781('0x72')](_0xca2200,'id');var _0x2c663b;var _0x2adb2a=squel[_0x4781('0xa4')]();_0x2adb2a['from'](_0x119395[_0x4781('0x73')]);for(var _0x48f18c=0x0;_0x48f18c<_0x582af7[_0x4781('0x3c')];_0x48f18c+=0x1){_0x2c663b=_0x582af7[_0x48f18c]['MetricId']?_0xb22a9c[_0x582af7[_0x48f18c]['MetricId']][_0x4781('0x75')]:_0x582af7[_0x48f18c][_0x4781('0x76')];_0x2c663b=_0x582af7[_0x48f18c][_0x4781('0x78')]?_['replace'](_0x16e4fe[_0x582af7[_0x48f18c][_0x4781('0x78')]],'%s',_0x2c663b):_0x2c663b;_0x2c663b=_0x582af7[_0x48f18c]['format']?_[_0x4781('0x77')](_0x222818[_0x582af7[_0x48f18c][_0x4781('0x79')]],'%s',_0x2c663b):_0x2c663b;if(_0x582af7[_0x48f18c][_0x4781('0x7a')]){_0x2adb2a['group'](_0x2c663b);}_0x582af7[_0x48f18c][_0x4781('0x7b')]&&_0x2adb2a[_0x4781('0x40')](_0x2c663b,_0x582af7[_0x48f18c]['orderBy']==='DESC'?![]:!![]);_0x2adb2a[_0x4781('0x76')](_0x2c663b,_0x582af7[_0x48f18c][_0x4781('0x7d')]||_0x2c663b);}if(_0x119395[_0x4781('0x7e')]){_0x119395[_0x4781('0x7e')]=JSON[_0x4781('0x7f')](_0x119395[_0x4781('0x7e')]);for(var _0x44c0dd=0x0;_0x44c0dd<_0x119395['joins'][_0x4781('0x3c')];_0x44c0dd+=0x1){if(_0x119395[_0x4781('0x7e')][_0x44c0dd]['type']&&_['includes'](_0x52ab9e,_0x119395[_0x4781('0x7e')][_0x44c0dd][_0x4781('0x34')])&&_0x119395[_0x4781('0x7e')][_0x44c0dd][_0x4781('0x80')]&&_0x119395[_0x4781('0x7e')][_0x44c0dd]['foreignTable']&&_0x119395[_0x4781('0x7e')][_0x44c0dd][_0x4781('0x82')]){_0x2adb2a[_0x119395[_0x4781('0x7e')][_0x44c0dd][_0x4781('0x34')]](_0x119395['joins'][_0x44c0dd][_0x4781('0x81')],null,util[_0x4781('0x79')](_0x4781('0x83'),_0x119395[_0x4781('0x73')],_0x119395[_0x4781('0x7e')][_0x44c0dd][_0x4781('0x80')],_0x119395[_0x4781('0x7e')][_0x44c0dd][_0x4781('0x81')],_0x119395[_0x4781('0x7e')][_0x44c0dd][_0x4781('0x82')]));}}}if(_0x119395[_0x4781('0x84')]){_0x119395[_0x4781('0x84')]=JSON[_0x4781('0x7f')](_0x119395[_0x4781('0x84')]);_0x2adb2a[_0x4781('0x42')](_0x1a109a(_0x119395[_0x4781('0x84')][_0x4781('0x6e')]));}_0x28d06f=_0x2adb2a['clone']();_0x2adb2a[_0x4781('0x1d')](_0x2696c5);_0x2adb2a[_0x4781('0x1b')](0x0);logger[_0x4781('0x85')](_0x4781('0x86'),_0x2adb2a[_0x4781('0x87')]());return dbH['sequelize'][_0x4781('0x37')](_0x2adb2a[_0x4781('0x87')](),{'type':dbH[_0x4781('0x88')]['QueryTypes'][_0x4781('0x8a')]});}})[_0x4781('0x23')](function(){return{'sql':_0x28d06f[_0x4781('0x87')]()};})[_0x4781('0x23')](respondWithResult(_0x11d945,null))['catch'](handleError(_0x11d945,null));}; \ No newline at end of file +var _0xdff2=['UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','from','function','output','web','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','fork','../../files/reports','savename','sequelize','QueryTypes','run','AVG(%s)','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','get','DefaultReports','destroy','sendStatus','error','name','send','render','body','contact','message','agent','interaction','account','index','rawAttributes','fieldName','type','model','keys','intersection','query','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','map','options','AnalyticDefaultReport','findAll','rows','catch','show','includeAll','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)'];(function(_0x12eb81,_0x1fa5d1){var _0x1852f4=function(_0xae73a0){while(--_0xae73a0){_0x12eb81['push'](_0x12eb81['shift']());}};_0x1852f4(++_0x1fa5d1);}(_0xdff2,0xe9));var _0x2dff=function(_0x22ea7a,_0x36f82b){_0x22ea7a=_0x22ea7a-0x0;var _0x462110=_0xdff2[_0x22ea7a];return _0x462110;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2dff('0x0'));var jsonpatch=require(_0x2dff('0x1'));var rp=require(_0x2dff('0x2'));var moment=require(_0x2dff('0x3'));var BPromise=require(_0x2dff('0x4'));var Mustache=require(_0x2dff('0x5'));var util=require(_0x2dff('0x6'));var path=require(_0x2dff('0x7'));var sox=require('sox');var csv=require(_0x2dff('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2dff('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2dff('0xa'));var deskjs=require(_0x2dff('0xb'));var toCsv=require(_0x2dff('0x8'));var querystring=require(_0x2dff('0xc'));var Papa=require(_0x2dff('0xd'));var Redis=require(_0x2dff('0xe'));var authService=require(_0x2dff('0xf'));var qs=require(_0x2dff('0x10'));var as=require(_0x2dff('0x11'));var hardwareService=require(_0x2dff('0x12'));var logger=require(_0x2dff('0x13'))(_0x2dff('0x14'));var utils=require(_0x2dff('0x15'));var config=require(_0x2dff('0x16'));var licenseUtil=require(_0x2dff('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0x2dff('0x18'))[_0x2dff('0x19')];function respondWithStatusCode(_0x59bd46,_0x5a2358){_0x5a2358=_0x5a2358||0xcc;return function(_0xb20d45){if(_0xb20d45){return _0x59bd46['sendStatus'](_0x5a2358);}return _0x59bd46[_0x2dff('0x1a')](_0x5a2358)[_0x2dff('0x1b')]();};}function respondWithResult(_0x4f6d14,_0x179551){_0x179551=_0x179551||0xc8;return function(_0x236476){if(_0x236476){return _0x4f6d14[_0x2dff('0x1a')](_0x179551)[_0x2dff('0x1c')](_0x236476);}};}function respondWithFilteredResult(_0x2254bf,_0x43363b){return function(_0x484e70){if(_0x484e70){var _0x5479b9=typeof _0x43363b[_0x2dff('0x1d')]==='undefined'&&typeof _0x43363b[_0x2dff('0x1e')]===_0x2dff('0x1f');var _0x284039=_0x484e70['count'];var _0x4b9837=_0x5479b9?0x0:_0x43363b[_0x2dff('0x1d')];var _0x3d62f7=_0x5479b9?_0x484e70[_0x2dff('0x20')]:_0x43363b['offset']+_0x43363b[_0x2dff('0x1e')];var _0x3b90eb;if(_0x3d62f7>=_0x284039){_0x3d62f7=_0x284039;_0x3b90eb=0xc8;}else{_0x3b90eb=0xce;}_0x2254bf[_0x2dff('0x1a')](_0x3b90eb);return _0x2254bf[_0x2dff('0x21')](_0x2dff('0x22'),_0x4b9837+'-'+_0x3d62f7+'/'+_0x284039)[_0x2dff('0x1c')](_0x484e70);}return null;};}function patchUpdates(_0x3599c4){return function(_0x6546b){try{jsonpatch[_0x2dff('0x23')](_0x6546b,_0x3599c4,!![]);}catch(_0x3e352d){return BPromise['reject'](_0x3e352d);}return _0x6546b['save']();};}function saveUpdates(_0x2f73b4,_0x142b21){return function(_0x5f1118){if(_0x5f1118){return _0x5f1118[_0x2dff('0x24')](_0x2f73b4)[_0x2dff('0x25')](function(_0x50fa26){return _0x50fa26;});}return null;};}function removeEntity(_0x2d5588,_0x4d9c60){return function(_0x2ca02c){if(_0x2ca02c){return _0x2ca02c['destroy']()[_0x2dff('0x25')](function(){var _0x19e7fb=_0x2ca02c[_0x2dff('0x26')]({'plain':!![]});var _0x52a507=_0x2dff('0x27');return db['UserProfileResource'][_0x2dff('0x28')]({'where':{'type':_0x52a507,'resourceId':_0x19e7fb['id']}})[_0x2dff('0x25')](function(){return _0x2ca02c;});})[_0x2dff('0x25')](function(){_0x2d5588['status'](0xcc)[_0x2dff('0x1b')]();});}};}function handleEntityNotFound(_0xbb4cde,_0x4c7d0d){return function(_0x459ce3){if(!_0x459ce3){_0xbb4cde[_0x2dff('0x29')](0x194);}return _0x459ce3;};}function handleError(_0x3f0edc,_0x4d8b0c){_0x4d8b0c=_0x4d8b0c||0x1f4;return function(_0x8d3000){logger[_0x2dff('0x2a')](_0x8d3000['stack']);if(_0x8d3000[_0x2dff('0x2b')]){delete _0x8d3000[_0x2dff('0x2b')];}_0x3f0edc['status'](_0x4d8b0c)[_0x2dff('0x2c')](_0x8d3000);};}function getMustacheRender(_0x302c6d,_0x5ec408){return Mustache[_0x2dff('0x2d')](_0x302c6d,_['merge'](_0x5ec408[_0x2dff('0x2e')],{'contact':_0x5ec408[_0x2dff('0x2f')],'message':_0x5ec408[_0x2dff('0x30')],'agent':_0x5ec408[_0x2dff('0x31')],'interaction':_0x5ec408[_0x2dff('0x32')],'account':_0x5ec408[_0x2dff('0x33')]}))||'';}exports[_0x2dff('0x34')]=function(_0x22ac1c,_0x42ec35){var _0x4faabc={},_0x5e84c0={},_0x44805d={'count':0x0,'rows':[]};var _0x2a198c=_['map'](db['AnalyticDefaultReport'][_0x2dff('0x35')],function(_0x409898){return{'name':_0x409898[_0x2dff('0x36')],'type':_0x409898[_0x2dff('0x37')]['key']};});_0x5e84c0[_0x2dff('0x38')]=_['map'](_0x2a198c,_0x2dff('0x2b'));_0x5e84c0['query']=_[_0x2dff('0x39')](_0x22ac1c['query']);_0x5e84c0['filters']=_[_0x2dff('0x3a')](_0x5e84c0[_0x2dff('0x38')],_0x5e84c0[_0x2dff('0x3b')]);_0x4faabc[_0x2dff('0x3c')]=_[_0x2dff('0x3a')](_0x5e84c0[_0x2dff('0x38')],qs[_0x2dff('0x3d')](_0x22ac1c['query']['fields']));_0x4faabc['attributes']=_0x4faabc[_0x2dff('0x3c')][_0x2dff('0x3e')]?_0x4faabc[_0x2dff('0x3c')]:_0x5e84c0[_0x2dff('0x38')];if(!_0x22ac1c['query']['hasOwnProperty'](_0x2dff('0x3f'))){_0x4faabc['limit']=qs[_0x2dff('0x1e')](_0x22ac1c[_0x2dff('0x3b')][_0x2dff('0x1e')]);_0x4faabc[_0x2dff('0x1d')]=qs[_0x2dff('0x1d')](_0x22ac1c['query'][_0x2dff('0x1d')]);}_0x4faabc[_0x2dff('0x40')]=qs['sort'](_0x22ac1c[_0x2dff('0x3b')][_0x2dff('0x41')]);_0x4faabc[_0x2dff('0x42')]=qs[_0x2dff('0x43')](_[_0x2dff('0x44')](_0x22ac1c['query'],_0x5e84c0['filters']),_0x2a198c);if(_0x22ac1c[_0x2dff('0x3b')]['filter']){_0x4faabc[_0x2dff('0x42')]=_[_0x2dff('0x45')](_0x4faabc[_0x2dff('0x42')],{'$or':_[_0x2dff('0x46')](_0x2a198c,function(_0x3f7317){if(_0x3f7317[_0x2dff('0x37')]!=='VIRTUAL'){var _0x409650={};_0x409650[_0x3f7317[_0x2dff('0x2b')]]={'$like':'%'+_0x22ac1c['query']['filter']+'%'};return _0x409650;}})});}_0x4faabc=_['merge']({},_0x4faabc,_0x22ac1c[_0x2dff('0x47')]);var _0x36f87f={'where':_0x4faabc['where']};return db[_0x2dff('0x48')][_0x2dff('0x20')](_0x36f87f)['then'](function(_0x5f5669){_0x44805d[_0x2dff('0x20')]=_0x5f5669;if(_0x22ac1c[_0x2dff('0x3b')]['includeAll']){_0x4faabc['include']=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x2dff('0x49')](_0x4faabc);})[_0x2dff('0x25')](function(_0x553d3b){_0x44805d[_0x2dff('0x4a')]=_0x553d3b;return _0x44805d;})['then'](respondWithFilteredResult(_0x42ec35,_0x4faabc))[_0x2dff('0x4b')](handleError(_0x42ec35,null));};exports[_0x2dff('0x4c')]=function(_0x325145,_0x355823){var _0x28f126={'raw':!![],'where':{'id':_0x325145['params']['id']}},_0x466cec={};_0x466cec[_0x2dff('0x38')]=_[_0x2dff('0x39')](db['AnalyticDefaultReport']['rawAttributes']);_0x466cec[_0x2dff('0x3b')]=_[_0x2dff('0x39')](_0x325145[_0x2dff('0x3b')]);_0x466cec[_0x2dff('0x43')]=_[_0x2dff('0x3a')](_0x466cec[_0x2dff('0x38')],_0x466cec['query']);_0x28f126['attributes']=_[_0x2dff('0x3a')](_0x466cec[_0x2dff('0x38')],qs[_0x2dff('0x3d')](_0x325145['query'][_0x2dff('0x3d')]));_0x28f126['attributes']=_0x28f126[_0x2dff('0x3c')]['length']?_0x28f126[_0x2dff('0x3c')]:_0x466cec['model'];if(_0x325145['query'][_0x2dff('0x4d')]){_0x28f126[_0x2dff('0x4e')]=[{'all':!![]}];}_0x28f126=_[_0x2dff('0x45')]({},_0x28f126,_0x325145['options']);return db[_0x2dff('0x48')][_0x2dff('0x4f')](_0x28f126)['then'](handleEntityNotFound(_0x355823,null))['then'](respondWithResult(_0x355823,null))[_0x2dff('0x4b')](handleError(_0x355823,null));};exports[_0x2dff('0x50')]=function(_0x158e0c,_0x3984f4){return db[_0x2dff('0x48')][_0x2dff('0x50')](_0x158e0c[_0x2dff('0x2e')],{})[_0x2dff('0x25')](function(_0x2d24b5){var _0x3d226e=_0x158e0c[_0x2dff('0x51')][_0x2dff('0x26')]({'plain':!![]});if(!_0x3d226e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d226e[_0x2dff('0x52')]==='user'){var _0x5c27a0=_0x2d24b5[_0x2dff('0x26')]({'plain':!![]});var _0xc14602='Reports';return db[_0x2dff('0x53')][_0x2dff('0x4f')]({'where':{'name':_0xc14602,'userProfileId':_0x3d226e[_0x2dff('0x54')]},'raw':!![]})[_0x2dff('0x25')](function(_0x15159c){if(_0x15159c&&_0x15159c[_0x2dff('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x5c27a0['name'],'resourceId':_0x5c27a0['id'],'type':'DefaultReports','sectionId':_0x15159c['id']},{})[_0x2dff('0x25')](function(){return _0x2d24b5;});}else{return _0x2d24b5;}})[_0x2dff('0x4b')](function(_0x24df1c){logger['error'](_0x2dff('0x56'),_0x24df1c);throw _0x24df1c;});}return _0x2d24b5;})[_0x2dff('0x25')](respondWithResult(_0x3984f4,0xc9))[_0x2dff('0x4b')](handleError(_0x3984f4,null));};exports[_0x2dff('0x24')]=function(_0x5cff10,_0x5709db){if(_0x5cff10[_0x2dff('0x2e')]['id']){delete _0x5cff10[_0x2dff('0x2e')]['id'];}return db[_0x2dff('0x48')]['find']({'where':{'id':_0x5cff10[_0x2dff('0x57')]['id']}})['then'](handleEntityNotFound(_0x5709db,null))[_0x2dff('0x25')](saveUpdates(_0x5cff10[_0x2dff('0x2e')],null))[_0x2dff('0x25')](respondWithResult(_0x5709db,null))[_0x2dff('0x4b')](handleError(_0x5709db,null));};exports[_0x2dff('0x28')]=function(_0x4dc108,_0x57e2a9){return db[_0x2dff('0x48')][_0x2dff('0x4f')]({'where':{'id':_0x4dc108[_0x2dff('0x57')]['id']}})[_0x2dff('0x25')](handleEntityNotFound(_0x57e2a9,null))[_0x2dff('0x25')](removeEntity(_0x57e2a9,null))[_0x2dff('0x4b')](handleError(_0x57e2a9,null));};exports[_0x2dff('0x58')]=function(_0x69e97,_0x585ab7){var _0x55ec2a=0xa;var _0xe0115e=[_0x2dff('0x59'),_0x2dff('0x5a'),_0x2dff('0x5b'),_0x2dff('0x5c')];var _0x32e8e2={'SUM':'SUM(%s)','COUNT':_0x2dff('0x5d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x2dff('0x5e'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x2dff('0x5f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2dff('0x60')};var _0x1c6e33={'SEC_TO_TIME':_0x2dff('0x61'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x2dff('0x62'),'UNIX_TIMESTAMP':_0x2dff('0x63')};var _0x2db1f1=function(_0x490f6c){return!_[_0x2dff('0x64')]([_0x2dff('0x65'),_0x2dff('0x66'),_0x2dff('0x67'),_0x2dff('0x68')],_0x490f6c);};var _0x4dbe23=function(_0x3fc932){if(!_0x3fc932||!_0x3fc932[_0x2dff('0x69')][_0x2dff('0x3e')]){return'';}for(var _0x46624c='(',_0x5b5b73=0x0;_0x5b5b73<_0x3fc932['rules'][_0x2dff('0x3e')];_0x5b5b73+=0x1){_0x5b5b73>0x0&&(_0x46624c+='\x20'+_0x3fc932[_0x2dff('0x6a')]+'\x20');_0x46624c+=_0x3fc932[_0x2dff('0x69')][_0x5b5b73]['group']?_0x4dbe23(_0x3fc932['rules'][_0x5b5b73][_0x2dff('0x6b')]):_0x3fc932[_0x2dff('0x69')][_0x5b5b73][_0x2dff('0x6c')]+'\x20'+_0x3fc932[_0x2dff('0x69')][_0x5b5b73][_0x2dff('0x6d')]+(_0x2db1f1(_0x3fc932['rules'][_0x5b5b73]['condition'])?'\x20'+_0x3fc932[_0x2dff('0x69')][_0x5b5b73][_0x2dff('0x6e')]:'');}return _0x46624c+')';};var _0x14c4c9={'where':{'id':_0x69e97['params']['id']}},_0x105fc0,_0x13ae8c,_0x5ede45,_0x4ec52f,_0x5b29ce;_0x14c4c9=_[_0x2dff('0x45')]({},_0x14c4c9,_0x69e97['options']);return db[_0x2dff('0x48')][_0x2dff('0x4f')](_0x14c4c9)[_0x2dff('0x25')](function(_0x512cd8){if(_0x512cd8){_0x105fc0=_0x512cd8;return _0x512cd8[_0x2dff('0x6f')]();}return null;})['then'](function(_0x3e8111){if(_0x3e8111){if(!_0x3e8111['length']){throw new db['Sequelize'][(_0x2dff('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x13ae8c=_0x3e8111;return db[_0x2dff('0x71')][_0x2dff('0x49')]({'raw':!![]});}return null;})[_0x2dff('0x25')](function(_0x1c0948){if(_0x1c0948){_0x5ede45=_[_0x2dff('0x72')](_0x1c0948,'id');var _0x1f0a49;var _0x38f736=squel[_0x2dff('0x73')]();_0x38f736['from'](_0x105fc0[_0x2dff('0x74')]);for(var _0x246aed=0x0;_0x246aed<_0x13ae8c[_0x2dff('0x3e')];_0x246aed+=0x1){_0x1f0a49=_0x13ae8c[_0x246aed]['MetricId']?_0x5ede45[_0x13ae8c[_0x246aed][_0x2dff('0x75')]][_0x2dff('0x76')]:_0x13ae8c[_0x246aed][_0x2dff('0x6c')];_0x1f0a49=_0x13ae8c[_0x246aed]['function']?_[_0x2dff('0x77')](_0x32e8e2[_0x13ae8c[_0x246aed]['function']],'%s',_0x1f0a49):_0x1f0a49;_0x1f0a49=_0x13ae8c[_0x246aed][_0x2dff('0x78')]?_['replace'](_0x1c6e33[_0x13ae8c[_0x246aed][_0x2dff('0x78')]],'%s',_0x1f0a49):_0x1f0a49;if(_0x13ae8c[_0x246aed][_0x2dff('0x79')]){_0x38f736[_0x2dff('0x6b')](_0x1f0a49);}_0x13ae8c[_0x246aed]['orderBy']&&_0x38f736[_0x2dff('0x40')](_0x1f0a49,_0x13ae8c[_0x246aed][_0x2dff('0x7a')]===_0x2dff('0x7b')?![]:!![]);_0x38f736[_0x2dff('0x6c')](_0x1f0a49,_0x13ae8c[_0x246aed][_0x2dff('0x7c')]||_0x1f0a49);}if(_0x105fc0[_0x2dff('0x7d')]){_0x105fc0[_0x2dff('0x7d')]=JSON[_0x2dff('0x7e')](_0x105fc0[_0x2dff('0x7d')]);for(var _0x100726=0x0;_0x100726<_0x105fc0[_0x2dff('0x7d')][_0x2dff('0x3e')];_0x100726+=0x1){if(_0x105fc0[_0x2dff('0x7d')][_0x100726][_0x2dff('0x37')]&&_['includes'](_0xe0115e,_0x105fc0[_0x2dff('0x7d')][_0x100726]['type'])&&_0x105fc0['joins'][_0x100726][_0x2dff('0x7f')]&&_0x105fc0[_0x2dff('0x7d')][_0x100726][_0x2dff('0x80')]&&_0x105fc0[_0x2dff('0x7d')][_0x100726][_0x2dff('0x81')]){_0x38f736[_0x105fc0[_0x2dff('0x7d')][_0x100726][_0x2dff('0x37')]](_0x105fc0[_0x2dff('0x7d')][_0x100726][_0x2dff('0x80')],null,util[_0x2dff('0x78')](_0x2dff('0x82'),_0x105fc0[_0x2dff('0x74')],_0x105fc0[_0x2dff('0x7d')][_0x100726][_0x2dff('0x7f')],_0x105fc0[_0x2dff('0x7d')][_0x100726][_0x2dff('0x80')],_0x105fc0[_0x2dff('0x7d')][_0x100726][_0x2dff('0x81')]));}}}if(_0x105fc0[_0x2dff('0x83')]){_0x105fc0[_0x2dff('0x83')]=JSON[_0x2dff('0x7e')](_0x105fc0[_0x2dff('0x83')]);_0x38f736[_0x2dff('0x42')](_0x4dbe23(_0x105fc0[_0x2dff('0x83')][_0x2dff('0x6b')]));}_0x5b29ce=_0x38f736[_0x2dff('0x84')]();_0x38f736['limit'](_0x55ec2a);_0x38f736[_0x2dff('0x1d')](0x0);logger[_0x2dff('0x85')](_0x2dff('0x86'),_0x38f736[_0x2dff('0x87')]());return dbH['sequelize'][_0x2dff('0x3b')](_0x38f736['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x2dff('0x88')]});}})['then'](respondWithResult(_0x585ab7,null))[_0x2dff('0x4b')](handleError(_0x585ab7,null));};function runReport(_0x2980a0,_0x327141,_0x51d26f){var _0x92c079=_0x327141[_0x2dff('0x2b')];var _0x402208=0xa;var _0x3ff63b=[_0x2dff('0x59'),_0x2dff('0x5a'),_0x2dff('0x5b'),_0x2dff('0x5c')];var _0x4adf5d={'SUM':_0x2dff('0x89'),'COUNT':_0x2dff('0x5d'),'COUNT DISTINCT':_0x2dff('0x8a'),'MAX':_0x2dff('0x5e'),'MIN':_0x2dff('0x8b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x2dff('0x5f'),'GROUP_CONCAT ASC':_0x2dff('0x8c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x58e5de={'SEC_TO_TIME':_0x2dff('0x61'),'DATE':_0x2dff('0x8d'),'HOUR':_0x2dff('0x8e'),'ROUND':_0x2dff('0x62'),'UNIX_TIMESTAMP':_0x2dff('0x63')};var _0x50b2c1=function(_0x3c8b9a){return!_[_0x2dff('0x64')]([_0x2dff('0x65'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x2dff('0x68')],_0x3c8b9a);};var _0x218ef2=function(_0x34a01c){if(!_0x34a01c||!_0x34a01c['rules'][_0x2dff('0x3e')]){return'';}for(var _0x383d19='(',_0x24de26=0x0;_0x24de26<_0x34a01c[_0x2dff('0x69')][_0x2dff('0x3e')];_0x24de26+=0x1){_0x24de26>0x0&&(_0x383d19+='\x20'+_0x34a01c[_0x2dff('0x6a')]+'\x20');_0x383d19+=_0x34a01c[_0x2dff('0x69')][_0x24de26][_0x2dff('0x6b')]?_0x218ef2(_0x34a01c[_0x2dff('0x69')][_0x24de26][_0x2dff('0x6b')]):_0x34a01c[_0x2dff('0x69')][_0x24de26][_0x2dff('0x6c')]+'\x20'+_0x34a01c[_0x2dff('0x69')][_0x24de26][_0x2dff('0x6d')]+(_0x50b2c1(_0x34a01c['rules'][_0x24de26]['condition'])?'\x20'+_0x34a01c['rules'][_0x24de26]['value']:'');}return _0x383d19+')';};var _0x4ebc3a={'where':{'id':_0x2980a0['id']}},_0x1460de,_0x1c4810,_0x15854b,_0x44e516,_0x2a8d1b;_0x4ebc3a=_[_0x2dff('0x45')]({},_0x4ebc3a,_0x51d26f);return db['AnalyticDefaultReport'][_0x2dff('0x4f')](_0x4ebc3a)[_0x2dff('0x25')](function(_0x49b2b9){if(_0x49b2b9){_0x1460de=_0x49b2b9;return _0x49b2b9['getFields']();}return null;})[_0x2dff('0x25')](function(_0x212f94){if(_0x212f94){if(!_0x212f94[_0x2dff('0x3e')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1c4810=_0x212f94;return db[_0x2dff('0x71')]['findAll']({'raw':!![]});}return null;})[_0x2dff('0x25')](function(_0x474c7c){if(_0x474c7c){_0x15854b=_[_0x2dff('0x72')](_0x474c7c,'id');var _0x20d55e;var _0x2fba0e=squel[_0x2dff('0x73')]();_0x2fba0e[_0x2dff('0x8f')](_0x1460de[_0x2dff('0x74')]);for(var _0xcdc401=0x0;_0xcdc401<_0x1c4810[_0x2dff('0x3e')];_0xcdc401+=0x1){_0x20d55e=_0x1c4810[_0xcdc401]['MetricId']?_0x15854b[_0x1c4810[_0xcdc401][_0x2dff('0x75')]][_0x2dff('0x76')]:_0x1c4810[_0xcdc401][_0x2dff('0x6c')];_0x20d55e=_0x1c4810[_0xcdc401][_0x2dff('0x90')]?_[_0x2dff('0x77')](_0x4adf5d[_0x1c4810[_0xcdc401]['function']],'%s',_0x20d55e):_0x20d55e;_0x20d55e=_0x1c4810[_0xcdc401][_0x2dff('0x78')]?_['replace'](_0x58e5de[_0x1c4810[_0xcdc401][_0x2dff('0x78')]],'%s',_0x20d55e):_0x20d55e;if(_0x1c4810[_0xcdc401][_0x2dff('0x79')]){_0x2fba0e[_0x2dff('0x6b')](_0x20d55e);}_0x1c4810[_0xcdc401]['orderBy']&&_0x2fba0e[_0x2dff('0x40')](_0x20d55e,_0x1c4810[_0xcdc401][_0x2dff('0x7a')]===_0x2dff('0x7b')?![]:!![]);_0x2fba0e[_0x2dff('0x6c')](_0x20d55e,_0x1c4810[_0xcdc401][_0x2dff('0x7c')]||_0x20d55e);}if(_0x1460de[_0x2dff('0x7d')]){_0x1460de['joins']=JSON[_0x2dff('0x7e')](_0x1460de['joins']);for(var _0x4facf7=0x0;_0x4facf7<_0x1460de[_0x2dff('0x7d')][_0x2dff('0x3e')];_0x4facf7+=0x1){if(_0x1460de[_0x2dff('0x7d')][_0x4facf7][_0x2dff('0x37')]&&_[_0x2dff('0x64')](_0x3ff63b,_0x1460de[_0x2dff('0x7d')][_0x4facf7][_0x2dff('0x37')])&&_0x1460de[_0x2dff('0x7d')][_0x4facf7][_0x2dff('0x7f')]&&_0x1460de['joins'][_0x4facf7][_0x2dff('0x80')]&&_0x1460de[_0x2dff('0x7d')][_0x4facf7][_0x2dff('0x81')]){_0x2fba0e[_0x1460de[_0x2dff('0x7d')][_0x4facf7]['type']](_0x1460de[_0x2dff('0x7d')][_0x4facf7][_0x2dff('0x80')],null,util['format'](_0x2dff('0x82'),_0x1460de[_0x2dff('0x74')],_0x1460de[_0x2dff('0x7d')][_0x4facf7][_0x2dff('0x7f')],_0x1460de[_0x2dff('0x7d')][_0x4facf7][_0x2dff('0x80')],_0x1460de[_0x2dff('0x7d')][_0x4facf7][_0x2dff('0x81')]));}}}if(_0x1460de[_0x2dff('0x83')]){_0x1460de[_0x2dff('0x83')]=JSON['parse'](_0x1460de[_0x2dff('0x83')]);_0x2fba0e['where'](_0x218ef2(_0x1460de[_0x2dff('0x83')][_0x2dff('0x6b')]));}_0x2a8d1b=_0x2fba0e[_0x2dff('0x84')]();_0x2fba0e[_0x2dff('0x1e')](_0x402208);_0x2fba0e[_0x2dff('0x1d')](0x0);return;}})[_0x2dff('0x25')](function(){if(_0x327141[_0x2dff('0x91')]===_0x2dff('0x92')){return null;}var _0x441eb=_[_0x2dff('0x45')](_0x327141,{'name':_0x327141['fullPath']||_0x327141[_0x2dff('0x2b')]||_0x1460de['name'],'basename':_0x92c079,'savename':util['format'](_0x2dff('0x93'),_0x327141[_0x2dff('0x2b')]||_0x1460de[_0x2dff('0x2b')],require(_0x2dff('0x94'))[_0x2dff('0x95')](0x4),_0x327141[_0x2dff('0x91')]||_0x2dff('0x96')),'reportId':_0x1460de['id'],'reportType':_0x2dff('0x97')});return db[_0x2dff('0x98')][_0x2dff('0x50')](_0x441eb,{'raw':!![]});})[_0x2dff('0x25')](function(_0x2439ca){if(_0x1460de[_0x2dff('0x74')]==='cdr'){_0x2a8d1b[_0x2dff('0x42')](_0x1460de[_0x2dff('0x74')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x327141['startDate'],_0x327141[_0x2dff('0x99')]);}else{_0x2a8d1b[_0x2dff('0x42')](_0x1460de[_0x2dff('0x74')]+_0x2dff('0x9a'),_0x327141[_0x2dff('0x9b')],_0x327141['endDate']);}if(_0x2439ca){logger['info'](_0x2dff('0x9c'),_0x2a8d1b['toString']());require('child_process')[_0x2dff('0x9d')](path['join'](__dirname,'../../components/export/',_0x2439ca['output']),[_0x2439ca['id'],_0x2a8d1b[_0x2dff('0x87')](),path[_0x2dff('0x59')](__dirname,_0x2dff('0x9e'),_0x2439ca[_0x2dff('0x9f')]),_0x92c079]);return _0x2439ca;}else{var _0x493b0f=squel[_0x2dff('0x73')]();_0x493b0f[_0x2dff('0x8f')]('('+_0x2a8d1b[_0x2dff('0x87')]()+')','countTable');_0x493b0f[_0x2dff('0x6c')]('COUNT(*)',_0x2dff('0x20'));_0x2a8d1b[_0x2dff('0x1e')](_0x327141[_0x2dff('0x1e')]||_0x402208);_0x2a8d1b['offset'](_0x327141['offset']||0x0);return dbH['sequelize']['query'](_0x493b0f[_0x2dff('0x87')](),{'type':dbH[_0x2dff('0xa0')][_0x2dff('0xa1')]['SELECT']})[_0x2dff('0x25')](function(_0x38568d){if(!_0x38568d[_0x2dff('0x3e')]){_0x44e516=0x0;}else{_0x44e516=_0x38568d[0x0]['count']||0x0;}return dbH[_0x2dff('0xa0')]['query'](_0x2a8d1b[_0x2dff('0x87')](),{'type':dbH['sequelize']['QueryTypes'][_0x2dff('0x88')]});})[_0x2dff('0x25')](function(_0x59c5eb){return{'rows':_0x59c5eb||[],'count':_0x44e516};});}});}exports[_0x2dff('0xa2')]=function(_0xa6e0c8,_0x33b12f){return runReport(_0xa6e0c8['params'],_0xa6e0c8[_0x2dff('0x3b')],_0xa6e0c8[_0x2dff('0x47')])[_0x2dff('0x25')](respondWithResult(_0x33b12f,null))[_0x2dff('0x4b')](handleError(_0x33b12f,null));};exports['runReport']=runReport;exports[_0x2dff('0x3b')]=function(_0x2cf6da,_0x5255b1){var _0x34591e=0xa;var _0x367a04=[_0x2dff('0x59'),_0x2dff('0x5a'),'right_join',_0x2dff('0x5c')];var _0x5c1362={'SUM':_0x2dff('0x89'),'COUNT':_0x2dff('0x5d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x2dff('0x5e'),'MIN':_0x2dff('0x8b'),'AVG':_0x2dff('0xa3'),'GROUP_CONCAT':_0x2dff('0x5f'),'GROUP_CONCAT ASC':_0x2dff('0x8c'),'GROUP_CONCAT DESC':_0x2dff('0x60')};var _0x4d4dd2={'SEC_TO_TIME':_0x2dff('0x61'),'DATE':'DATE(%s)','HOUR':_0x2dff('0x8e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x125769=function(_0x45047f){return!_['includes']([_0x2dff('0x65'),_0x2dff('0x66'),_0x2dff('0x67'),'IS\x20NOT\x20EMPTY'],_0x45047f);};var _0x3b4a74=function(_0x1ff10d){if(!_0x1ff10d||!_0x1ff10d[_0x2dff('0x69')][_0x2dff('0x3e')]){return'';}for(var _0x5a22c8='(',_0x370f1=0x0;_0x370f1<_0x1ff10d[_0x2dff('0x69')][_0x2dff('0x3e')];_0x370f1+=0x1){_0x370f1>0x0&&(_0x5a22c8+='\x20'+_0x1ff10d[_0x2dff('0x6a')]+'\x20');_0x5a22c8+=_0x1ff10d[_0x2dff('0x69')][_0x370f1][_0x2dff('0x6b')]?_0x3b4a74(_0x1ff10d[_0x2dff('0x69')][_0x370f1][_0x2dff('0x6b')]):_0x1ff10d['rules'][_0x370f1][_0x2dff('0x6c')]+'\x20'+_0x1ff10d[_0x2dff('0x69')][_0x370f1][_0x2dff('0x6d')]+(_0x125769(_0x1ff10d[_0x2dff('0x69')][_0x370f1][_0x2dff('0x6d')])?'\x20'+_0x1ff10d[_0x2dff('0x69')][_0x370f1][_0x2dff('0x6e')]:'');}return _0x5a22c8+')';};var _0x12674e={'where':{'id':_0x2cf6da[_0x2dff('0x57')]['id']}},_0x1964c0,_0x1cda7a,_0x41d06c,_0x5c21e7,_0x40650f;_0x12674e=_['merge']({},_0x12674e,_0x2cf6da[_0x2dff('0x47')]);return db['AnalyticDefaultReport'][_0x2dff('0x4f')](_0x12674e)['then'](function(_0x1c577f){if(_0x1c577f){_0x1964c0=_0x1c577f;return _0x1c577f['getFields']();}return null;})['then'](function(_0x289673){if(_0x289673){if(!_0x289673[_0x2dff('0x3e')]){throw new db[(_0x2dff('0xa4'))][(_0x2dff('0x70'))](_0x2dff('0xa5'),0x193);}_0x1cda7a=_0x289673;return db[_0x2dff('0x71')][_0x2dff('0x49')]({'raw':!![]});}return null;})[_0x2dff('0x25')](function(_0x1f69c1){if(_0x1f69c1){_0x41d06c=_[_0x2dff('0x72')](_0x1f69c1,'id');var _0x30b83f;var _0x489598=squel['select']();_0x489598['from'](_0x1964c0[_0x2dff('0x74')]);for(var _0xbaf60e=0x0;_0xbaf60e<_0x1cda7a[_0x2dff('0x3e')];_0xbaf60e+=0x1){_0x30b83f=_0x1cda7a[_0xbaf60e][_0x2dff('0x75')]?_0x41d06c[_0x1cda7a[_0xbaf60e][_0x2dff('0x75')]][_0x2dff('0x76')]:_0x1cda7a[_0xbaf60e][_0x2dff('0x6c')];_0x30b83f=_0x1cda7a[_0xbaf60e]['function']?_['replace'](_0x5c1362[_0x1cda7a[_0xbaf60e][_0x2dff('0x90')]],'%s',_0x30b83f):_0x30b83f;_0x30b83f=_0x1cda7a[_0xbaf60e][_0x2dff('0x78')]?_[_0x2dff('0x77')](_0x4d4dd2[_0x1cda7a[_0xbaf60e][_0x2dff('0x78')]],'%s',_0x30b83f):_0x30b83f;if(_0x1cda7a[_0xbaf60e][_0x2dff('0x79')]){_0x489598[_0x2dff('0x6b')](_0x30b83f);}_0x1cda7a[_0xbaf60e][_0x2dff('0x7a')]&&_0x489598[_0x2dff('0x40')](_0x30b83f,_0x1cda7a[_0xbaf60e][_0x2dff('0x7a')]===_0x2dff('0x7b')?![]:!![]);_0x489598['field'](_0x30b83f,_0x1cda7a[_0xbaf60e][_0x2dff('0x7c')]||_0x30b83f);}if(_0x1964c0[_0x2dff('0x7d')]){_0x1964c0['joins']=JSON[_0x2dff('0x7e')](_0x1964c0[_0x2dff('0x7d')]);for(var _0x54422e=0x0;_0x54422e<_0x1964c0['joins'][_0x2dff('0x3e')];_0x54422e+=0x1){if(_0x1964c0['joins'][_0x54422e]['type']&&_['includes'](_0x367a04,_0x1964c0[_0x2dff('0x7d')][_0x54422e][_0x2dff('0x37')])&&_0x1964c0[_0x2dff('0x7d')][_0x54422e][_0x2dff('0x7f')]&&_0x1964c0[_0x2dff('0x7d')][_0x54422e][_0x2dff('0x80')]&&_0x1964c0[_0x2dff('0x7d')][_0x54422e][_0x2dff('0x81')]){_0x489598[_0x1964c0[_0x2dff('0x7d')][_0x54422e][_0x2dff('0x37')]](_0x1964c0[_0x2dff('0x7d')][_0x54422e][_0x2dff('0x80')],null,util['format'](_0x2dff('0x82'),_0x1964c0[_0x2dff('0x74')],_0x1964c0[_0x2dff('0x7d')][_0x54422e][_0x2dff('0x7f')],_0x1964c0[_0x2dff('0x7d')][_0x54422e][_0x2dff('0x80')],_0x1964c0[_0x2dff('0x7d')][_0x54422e]['foreignKey']));}}}if(_0x1964c0[_0x2dff('0x83')]){_0x1964c0['conditions']=JSON[_0x2dff('0x7e')](_0x1964c0[_0x2dff('0x83')]);_0x489598[_0x2dff('0x42')](_0x3b4a74(_0x1964c0[_0x2dff('0x83')][_0x2dff('0x6b')]));}_0x40650f=_0x489598[_0x2dff('0x84')]();_0x489598['limit'](_0x34591e);_0x489598[_0x2dff('0x1d')](0x0);logger['debug']('Limited\x20Query:',_0x489598[_0x2dff('0x87')]());return dbH[_0x2dff('0xa0')][_0x2dff('0x3b')](_0x489598[_0x2dff('0x87')](),{'type':dbH[_0x2dff('0xa0')][_0x2dff('0xa1')]['SELECT']});}})[_0x2dff('0x25')](function(){return{'sql':_0x40650f[_0x2dff('0x87')]()};})[_0x2dff('0x25')](respondWithResult(_0x5255b1,null))[_0x2dff('0x4b')](handleError(_0x5255b1,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 10808a2..6cb5364 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 _0x4499=['path','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0x4499,0x145));var _0x9449=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0x4499[_0x55fa03];return _0x2cd7cd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9449('0x0'))(_0x9449('0x1'));var moment=require(_0x9449('0x2'));var BPromise=require(_0x9449('0x3'));var rp=require(_0x9449('0x4'));var fs=require('fs');var path=require(_0x9449('0x5'));var rimraf=require('rimraf');var config=require(_0x9449('0x6'));var attributes=require(_0x9449('0x7'));module['exports']=function(_0x4c5927,_0xaecc82){return _0x4c5927[_0x9449('0x8')](_0x9449('0x9'),attributes,{'tableName':_0x9449('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2e1=['moment','bluebird','request-promise','path','../../config/environment','exports','define','analytics_default_reports','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2e1,0xd4));var _0x1b2e=function(_0x3fccbb,_0x473396){_0x3fccbb=_0x3fccbb-0x0;var _0x11df6e=_0xb2e1[_0x3fccbb];return _0x11df6e;};'use strict';var _=require(_0x1b2e('0x0'));var util=require(_0x1b2e('0x1'));var logger=require(_0x1b2e('0x2'))(_0x1b2e('0x3'));var moment=require(_0x1b2e('0x4'));var BPromise=require(_0x1b2e('0x5'));var rp=require(_0x1b2e('0x6'));var fs=require('fs');var path=require(_0x1b2e('0x7'));var rimraf=require('rimraf');var config=require(_0x1b2e('0x8'));var attributes=require('./analyticDefaultReport.attributes');module[_0x1b2e('0x9')]=function(_0x41564f,_0x58e1a5){return _0x41564f[_0x1b2e('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x1b2e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index ddd0408..24fe7d6 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 _0x13eb=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x13eb,0x8f));var _0xb13e=function(_0x56ed51,_0x5acddc){_0x56ed51=_0x56ed51-0x0;var _0x521784=_0x13eb[_0x56ed51];return _0x521784;};'use strict';var _=require(_0xb13e('0x0'));var util=require(_0xb13e('0x1'));var moment=require('moment');var BPromise=require(_0xb13e('0x2'));var rs=require(_0xb13e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb13e('0x4'))['db'];var utils=require(_0xb13e('0x5'));var logger=require(_0xb13e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb13e('0x7'));var client=jayson[_0xb13e('0x8')][_0xb13e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1722ad,_0x215b85,_0x2184d5){return new BPromise(function(_0x4c2374,_0x3390be){return client[_0xb13e('0xa')](_0x1722ad,_0x2184d5)['then'](function(_0x44e6b4){logger[_0xb13e('0xb')](_0xb13e('0xc'),_0x215b85,_0xb13e('0xd'));logger[_0xb13e('0xe')](_0xb13e('0xf'),_0x215b85,_0xb13e('0xd'),JSON[_0xb13e('0x10')](_0x44e6b4));if(_0x44e6b4[_0xb13e('0x11')]){if(_0x44e6b4[_0xb13e('0x11')]['code']===0x1f4){logger[_0xb13e('0x11')](_0xb13e('0xc'),_0x215b85,_0x44e6b4[_0xb13e('0x11')][_0xb13e('0x12')]);return _0x3390be(_0x44e6b4['error'][_0xb13e('0x12')]);}logger[_0xb13e('0x11')](_0xb13e('0xc'),_0x215b85,_0x44e6b4[_0xb13e('0x11')][_0xb13e('0x12')]);return _0x4c2374(_0x44e6b4[_0xb13e('0x11')][_0xb13e('0x12')]);}else{logger[_0xb13e('0xb')](_0xb13e('0xc'),_0x215b85,_0xb13e('0xd'));_0x4c2374(_0x44e6b4[_0xb13e('0x13')][_0xb13e('0x12')]);}})[_0xb13e('0x14')](function(_0x3e5fa2){logger[_0xb13e('0x11')](_0xb13e('0xc'),_0x215b85,_0x3e5fa2);_0x3390be(_0x3e5fa2);});});} \ No newline at end of file +var _0x7497=['request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7749('0x0'));var util=require(_0x7749('0x1'));var moment=require(_0x7749('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7749('0x3'))['db'];var utils=require(_0x7749('0x4'));var logger=require('../../config/logger')(_0x7749('0x5'));var config=require(_0x7749('0x6'));var jayson=require(_0x7749('0x7'));var client=jayson[_0x7749('0x8')][_0x7749('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29f84f,_0x37d7b9,_0x344fa8){return new BPromise(function(_0x38dd37,_0x3efd35){return client[_0x7749('0xa')](_0x29f84f,_0x344fa8)['then'](function(_0xb58b29){logger['info'](_0x7749('0xb'),_0x37d7b9,_0x7749('0xc'));logger[_0x7749('0xd')](_0x7749('0xe'),_0x37d7b9,_0x7749('0xc'),JSON[_0x7749('0xf')](_0xb58b29));if(_0xb58b29[_0x7749('0x10')]){if(_0xb58b29[_0x7749('0x10')][_0x7749('0x11')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x37d7b9,_0xb58b29[_0x7749('0x10')]['message']);return _0x3efd35(_0xb58b29['error'][_0x7749('0x12')]);}logger[_0x7749('0x10')](_0x7749('0xb'),_0x37d7b9,_0xb58b29[_0x7749('0x10')][_0x7749('0x12')]);return _0x38dd37(_0xb58b29[_0x7749('0x10')]['message']);}else{logger['info'](_0x7749('0xb'),_0x37d7b9,_0x7749('0xc'));_0x38dd37(_0xb58b29['result'][_0x7749('0x12')]);}})[_0x7749('0x13')](function(_0x42c942){logger[_0x7749('0x10')](_0x7749('0xb'),_0x37d7b9,_0x42c942);_0x3efd35(_0x42c942);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index ea754ed..8c20348 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 _0xe176=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','put','/:id','update','delete','exports'];(function(_0x43a9c7,_0x26b5b6){var _0xc9067b=function(_0x5833c7){while(--_0x5833c7){_0x43a9c7['push'](_0x43a9c7['shift']());}};_0xc9067b(++_0x26b5b6);}(_0xe176,0x12c));var _0x6e17=function(_0x835f74,_0x123452){_0x835f74=_0x835f74-0x0;var _0x46a4d6=_0xe176[_0x835f74];return _0x46a4d6;};'use strict';var multer=require(_0x6e17('0x0'));var util=require(_0x6e17('0x1'));var path=require(_0x6e17('0x2'));var timeout=require(_0x6e17('0x3'));var express=require(_0x6e17('0x4'));var router=express[_0x6e17('0x5')]();var fs_extra=require(_0x6e17('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6e17('0x7'));var config=require(_0x6e17('0x8'));var controller=require(_0x6e17('0x9'));router[_0x6e17('0xa')]('/',auth[_0x6e17('0xb')](),controller['index']);router[_0x6e17('0xa')]('/:id',auth[_0x6e17('0xb')](),controller[_0x6e17('0xc')]);router['get'](_0x6e17('0xd'),auth[_0x6e17('0xb')](),controller[_0x6e17('0xe')]);router[_0x6e17('0xa')](_0x6e17('0xf'),auth[_0x6e17('0xb')](),controller[_0x6e17('0x10')]);router['get'](_0x6e17('0x11'),auth[_0x6e17('0xb')](),controller[_0x6e17('0x12')]);router[_0x6e17('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6e17('0x14')](_0x6e17('0x15'),auth[_0x6e17('0xb')](),controller[_0x6e17('0x16')]);router[_0x6e17('0x17')](_0x6e17('0x15'),auth[_0x6e17('0xb')](),controller['destroy']);module[_0x6e17('0x18')]=router; \ No newline at end of file +var _0xace0=['query','post','update','destroy','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','/:id','show','/:id/preview','get','/:id/run','/:id/query'];(function(_0x3dfbaa,_0x438725){var _0x3708f2=function(_0x272924){while(--_0x272924){_0x3dfbaa['push'](_0x3dfbaa['shift']());}};_0x3708f2(++_0x438725);}(_0xace0,0x1ad));var _0x0ace=function(_0x5b3447,_0x52bef4){_0x5b3447=_0x5b3447-0x0;var _0x2c10bf=_0xace0[_0x5b3447];return _0x2c10bf;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0ace('0x0'));var express=require('express');var router=express[_0x0ace('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x0ace('0x2'));var interaction=require(_0x0ace('0x3'));var config=require(_0x0ace('0x4'));var controller=require(_0x0ace('0x5'));router['get']('/',auth[_0x0ace('0x6')](),controller['index']);router['get'](_0x0ace('0x7'),auth[_0x0ace('0x6')](),controller[_0x0ace('0x8')]);router['get'](_0x0ace('0x9'),auth['isAuthenticated'](),controller['preview']);router[_0x0ace('0xa')](_0x0ace('0xb'),auth[_0x0ace('0x6')](),controller['run']);router[_0x0ace('0xa')](_0x0ace('0xc'),auth[_0x0ace('0x6')](),controller[_0x0ace('0xd')]);router[_0x0ace('0xe')]('/',auth[_0x0ace('0x6')](),controller['create']);router['put'](_0x0ace('0x7'),auth[_0x0ace('0x6')](),controller[_0x0ace('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0ace('0x10')]);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 d670698..740df03 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 _0xc5d8=['STRING','csv','pdf','xlsx','DATE','Loading','ENUM','manual','UNSIGNED','sequelize','moment'];(function(_0x454a97,_0xbcda0f){var _0xc8096d=function(_0x116a3e){while(--_0x116a3e){_0x454a97['push'](_0x454a97['shift']());}};_0xc8096d(++_0xbcda0f);}(_0xc5d8,0x77));var _0x8c5d=function(_0x3dfbc3,_0x41a601){_0x3dfbc3=_0x3dfbc3-0x0;var _0x53fc9e=_0xc5d8[_0x3dfbc3];return _0x53fc9e;};'use strict';var Sequelize=require(_0x8c5d('0x0'));var moment=require(_0x8c5d('0x1'));module['exports']={'name':{'type':Sequelize[_0x8c5d('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x8c5d('0x3'),_0x8c5d('0x4'),_0x8c5d('0x5')),'allowNull':![],'defaultValue':_0x8c5d('0x3')},'savename':{'type':Sequelize[_0x8c5d('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8c5d('0x6')]},'endDate':{'type':Sequelize[_0x8c5d('0x6')]},'status':{'type':Sequelize[_0x8c5d('0x2')],'defaultValue':_0x8c5d('0x7')},'type':{'type':Sequelize[_0x8c5d('0x8')](_0x8c5d('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x8c5d('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x8c5d('0xa')]},'reportType':{'type':Sequelize[_0x8c5d('0x2')]}}; \ No newline at end of file +var _0x1f3d=['xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf'];(function(_0x476a26,_0x43e6e9){var _0xac50d1=function(_0x30e888){while(--_0x30e888){_0x476a26['push'](_0x476a26['shift']());}};_0xac50d1(++_0x43e6e9);}(_0x1f3d,0x1b9));var _0xd1f3=function(_0x551e11,_0x2274ac){_0x551e11=_0x551e11-0x0;var _0x2fe05a=_0x1f3d[_0x551e11];return _0x2fe05a;};'use strict';var Sequelize=require(_0xd1f3('0x0'));var moment=require(_0xd1f3('0x1'));module[_0xd1f3('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xd1f3('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xd1f3('0x4')](_0xd1f3('0x5'),_0xd1f3('0x6'),_0xd1f3('0x7')),'allowNull':![],'defaultValue':_0xd1f3('0x5')},'savename':{'type':Sequelize[_0xd1f3('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xd1f3('0x8')]},'endDate':{'type':Sequelize[_0xd1f3('0x8')]},'status':{'type':Sequelize[_0xd1f3('0x3')],'defaultValue':_0xd1f3('0x9')},'type':{'type':Sequelize['ENUM'](_0xd1f3('0xa'),_0xd1f3('0xb')),'allowNull':![],'defaultValue':_0xd1f3('0xa')},'reportId':{'type':Sequelize[_0xd1f3('0xc')](0xb)[_0xd1f3('0xd')]},'reportType':{'type':Sequelize[_0xd1f3('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 7f31ba8..2c749bd 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 _0x5426=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','limit','undefined','offset','set','Content-Range','apply','reject','save','update','then','get','ExtractedReports','error','stack','name','send','render','merge','body','contact','interaction','account','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','count','includeAll','include','findAll','rows','catch','show','params','options','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','create','destroy','download','basename','savename','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','%s.%s','output','toLowerCase','rimraf'];(function(_0x5f770a,_0x37aa52){var _0x1fd600=function(_0x58d061){while(--_0x58d061){_0x5f770a['push'](_0x5f770a['shift']());}};_0x1fd600(++_0x37aa52);}(_0x5426,0x12b));var _0x6542=function(_0x3601ac,_0x1a2a9d){_0x3601ac=_0x3601ac-0x0;var _0x16e39a=_0x5426[_0x3601ac];return _0x16e39a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6542('0x0'));var zipdir=require(_0x6542('0x1'));var jsonpatch=require(_0x6542('0x2'));var rp=require(_0x6542('0x3'));var moment=require(_0x6542('0x4'));var BPromise=require(_0x6542('0x5'));var Mustache=require(_0x6542('0x6'));var util=require(_0x6542('0x7'));var path=require(_0x6542('0x8'));var sox=require(_0x6542('0x9'));var csv=require(_0x6542('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6542('0xb'));var _=require('lodash');var squel=require(_0x6542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6542('0xd'));var toCsv=require(_0x6542('0xa'));var querystring=require(_0x6542('0xe'));var Papa=require(_0x6542('0xf'));var Redis=require(_0x6542('0x10'));var authService=require(_0x6542('0x11'));var qs=require(_0x6542('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6542('0x13'))(_0x6542('0x14'));var utils=require(_0x6542('0x15'));var config=require(_0x6542('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6542('0x17'))['db'];function respondWithStatusCode(_0x34c520,_0x3374f3){_0x3374f3=_0x3374f3||0xcc;return function(_0x23e68b){if(_0x23e68b){return _0x34c520['sendStatus'](_0x3374f3);}return _0x34c520[_0x6542('0x18')](_0x3374f3)['end']();};}function respondWithResult(_0x11d7ad,_0x18dd58){_0x18dd58=_0x18dd58||0xc8;return function(_0x4c9684){if(_0x4c9684){return _0x11d7ad[_0x6542('0x18')](_0x18dd58)[_0x6542('0x19')](_0x4c9684);}};}function respondWithFilteredResult(_0x5f1837,_0xb51d44){return function(_0x44f431){if(_0x44f431){var _0x563380=typeof _0xb51d44['offset']==='undefined'&&typeof _0xb51d44[_0x6542('0x1a')]===_0x6542('0x1b');var _0x5018ed=_0x44f431['count'];var _0xdca96b=_0x563380?0x0:_0xb51d44[_0x6542('0x1c')];var _0x28fe42=_0x563380?_0x44f431['count']:_0xb51d44['offset']+_0xb51d44[_0x6542('0x1a')];var _0x3dfd76;if(_0x28fe42>=_0x5018ed){_0x28fe42=_0x5018ed;_0x3dfd76=0xc8;}else{_0x3dfd76=0xce;}_0x5f1837[_0x6542('0x18')](_0x3dfd76);return _0x5f1837[_0x6542('0x1d')](_0x6542('0x1e'),_0xdca96b+'-'+_0x28fe42+'/'+_0x5018ed)[_0x6542('0x19')](_0x44f431);}return null;};}function patchUpdates(_0x576619){return function(_0x26e8a9){try{jsonpatch[_0x6542('0x1f')](_0x26e8a9,_0x576619,!![]);}catch(_0x284c08){return BPromise[_0x6542('0x20')](_0x284c08);}return _0x26e8a9[_0x6542('0x21')]();};}function saveUpdates(_0x5b0e96,_0x217578){return function(_0x145675){if(_0x145675){return _0x145675[_0x6542('0x22')](_0x5b0e96)[_0x6542('0x23')](function(_0x409ec7){return _0x409ec7;});}return null;};}function removeEntity(_0x532911,_0x2f156a){return function(_0x4a921a){if(_0x4a921a){return _0x4a921a['destroy']()['then'](function(){var _0x11ab35=_0x4a921a[_0x6542('0x24')]({'plain':!![]});var _0x32e8ae=_0x6542('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x32e8ae,'resourceId':_0x11ab35['id']}})[_0x6542('0x23')](function(){return _0x4a921a;});})[_0x6542('0x23')](function(){_0x532911[_0x6542('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2309,_0x5d315a){return function(_0x29e50a){if(!_0x29e50a){_0x5c2309['sendStatus'](0x194);}return _0x29e50a;};}function handleError(_0x1ee8fd,_0x3b59c6){_0x3b59c6=_0x3b59c6||0x1f4;return function(_0x1e4b38){logger[_0x6542('0x26')](_0x1e4b38[_0x6542('0x27')]);if(_0x1e4b38[_0x6542('0x28')]){delete _0x1e4b38['name'];}_0x1ee8fd[_0x6542('0x18')](_0x3b59c6)[_0x6542('0x29')](_0x1e4b38);};}function getMustacheRender(_0x283e3d,_0x59f005){return Mustache[_0x6542('0x2a')](_0x283e3d,_[_0x6542('0x2b')](_0x59f005[_0x6542('0x2c')],{'contact':_0x59f005[_0x6542('0x2d')],'message':_0x59f005['message'],'agent':_0x59f005['agent'],'interaction':_0x59f005[_0x6542('0x2e')],'account':_0x59f005[_0x6542('0x2f')]}))||'';}exports[_0x6542('0x30')]=function(_0x3f6dd5,_0x3198bd){var _0x55e158={},_0x3d225d={},_0x8777a={'count':0x0,'rows':[]};var _0x502dec=_[_0x6542('0x31')](db[_0x6542('0x32')][_0x6542('0x33')],function(_0x27d024){return{'name':_0x27d024[_0x6542('0x34')],'type':_0x27d024[_0x6542('0x35')][_0x6542('0x36')]};});_0x3d225d[_0x6542('0x37')]=_[_0x6542('0x31')](_0x502dec,'name');_0x3d225d['query']=_[_0x6542('0x38')](_0x3f6dd5[_0x6542('0x39')]);_0x3d225d[_0x6542('0x3a')]=_[_0x6542('0x3b')](_0x3d225d[_0x6542('0x37')],_0x3d225d['query']);_0x55e158[_0x6542('0x3c')]=_[_0x6542('0x3b')](_0x3d225d[_0x6542('0x37')],qs[_0x6542('0x3d')](_0x3f6dd5[_0x6542('0x39')][_0x6542('0x3d')]));_0x55e158[_0x6542('0x3c')]=_0x55e158[_0x6542('0x3c')][_0x6542('0x3e')]?_0x55e158[_0x6542('0x3c')]:_0x3d225d[_0x6542('0x37')];if(!_0x3f6dd5[_0x6542('0x39')][_0x6542('0x3f')](_0x6542('0x40'))){_0x55e158[_0x6542('0x1a')]=qs[_0x6542('0x1a')](_0x3f6dd5[_0x6542('0x39')][_0x6542('0x1a')]);_0x55e158[_0x6542('0x1c')]=qs['offset'](_0x3f6dd5[_0x6542('0x39')]['offset']);}_0x55e158[_0x6542('0x41')]=qs['sort'](_0x3f6dd5[_0x6542('0x39')][_0x6542('0x42')]);_0x55e158[_0x6542('0x43')]=qs[_0x6542('0x3a')](_['pick'](_0x3f6dd5['query'],_0x3d225d['filters']),_0x502dec);if(_0x3f6dd5[_0x6542('0x39')][_0x6542('0x44')]){_0x55e158['where']=_['merge'](_0x55e158[_0x6542('0x43')],{'$or':_[_0x6542('0x31')](_0x502dec,function(_0x182645){if(_0x182645[_0x6542('0x35')]!=='VIRTUAL'){var _0xc6173e={};_0xc6173e[_0x182645[_0x6542('0x28')]]={'$like':'%'+_0x3f6dd5['query'][_0x6542('0x44')]+'%'};return _0xc6173e;}})});}_0x55e158=_[_0x6542('0x2b')]({},_0x55e158,_0x3f6dd5['options']);var _0x37e9fd={'where':_0x55e158['where']};return db['AnalyticExtractedReport'][_0x6542('0x45')](_0x37e9fd)[_0x6542('0x23')](function(_0x469a4d){_0x8777a[_0x6542('0x45')]=_0x469a4d;if(_0x3f6dd5[_0x6542('0x39')][_0x6542('0x46')]){_0x55e158[_0x6542('0x47')]=[{'all':!![]}];}return db[_0x6542('0x32')][_0x6542('0x48')](_0x55e158);})[_0x6542('0x23')](function(_0x2d19b7){_0x8777a[_0x6542('0x49')]=_0x2d19b7;return _0x8777a;})[_0x6542('0x23')](respondWithFilteredResult(_0x3198bd,_0x55e158))[_0x6542('0x4a')](handleError(_0x3198bd,null));};exports[_0x6542('0x4b')]=function(_0x50576f,_0x56b84c){var _0x35ff7c={'raw':!![],'where':{'id':_0x50576f[_0x6542('0x4c')]['id']}},_0x2cc700={};_0x2cc700[_0x6542('0x37')]=_['keys'](db[_0x6542('0x32')][_0x6542('0x33')]);_0x2cc700['query']=_[_0x6542('0x38')](_0x50576f['query']);_0x2cc700[_0x6542('0x3a')]=_[_0x6542('0x3b')](_0x2cc700[_0x6542('0x37')],_0x2cc700[_0x6542('0x39')]);_0x35ff7c[_0x6542('0x3c')]=_[_0x6542('0x3b')](_0x2cc700[_0x6542('0x37')],qs[_0x6542('0x3d')](_0x50576f['query'][_0x6542('0x3d')]));_0x35ff7c[_0x6542('0x3c')]=_0x35ff7c[_0x6542('0x3c')][_0x6542('0x3e')]?_0x35ff7c[_0x6542('0x3c')]:_0x2cc700['model'];if(_0x50576f[_0x6542('0x39')][_0x6542('0x46')]){_0x35ff7c[_0x6542('0x47')]=[{'all':!![]}];}_0x35ff7c=_[_0x6542('0x2b')]({},_0x35ff7c,_0x50576f[_0x6542('0x4d')]);return db[_0x6542('0x32')][_0x6542('0x4e')](_0x35ff7c)[_0x6542('0x23')](handleEntityNotFound(_0x56b84c,null))[_0x6542('0x23')](respondWithResult(_0x56b84c,null))[_0x6542('0x4a')](handleError(_0x56b84c,null));};exports['create']=function(_0x4b4b2f,_0xca1a38){return db[_0x6542('0x32')]['create'](_0x4b4b2f[_0x6542('0x2c')],{})['then'](function(_0x252cc5){var _0x2ab277=_0x4b4b2f[_0x6542('0x4f')][_0x6542('0x24')]({'plain':!![]});if(!_0x2ab277)throw new Error(_0x6542('0x50'));if(_0x2ab277['role']===_0x6542('0x4f')){var _0x31dac8=_0x252cc5['get']({'plain':!![]});var _0x2062fe=_0x6542('0x25');return db[_0x6542('0x51')][_0x6542('0x4e')]({'where':{'name':_0x2062fe,'userProfileId':_0x2ab277[_0x6542('0x52')]},'raw':!![]})['then'](function(_0x229e72){if(_0x229e72&&_0x229e72['autoAssociation']===0x0){return db[_0x6542('0x53')][_0x6542('0x54')]({'name':_0x31dac8['name'],'resourceId':_0x31dac8['id'],'type':_0x229e72[_0x6542('0x28')],'sectionId':_0x229e72['id']},{})[_0x6542('0x23')](function(){return _0x252cc5;});}else{return _0x252cc5;}})[_0x6542('0x4a')](function(_0x16ba3e){logger[_0x6542('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16ba3e);throw _0x16ba3e;});}return _0x252cc5;})['then'](respondWithResult(_0xca1a38,0xc9))['catch'](handleError(_0xca1a38,null));};exports[_0x6542('0x22')]=function(_0x43d26b,_0x37f8b1){if(_0x43d26b[_0x6542('0x2c')]['id']){delete _0x43d26b[_0x6542('0x2c')]['id'];}return db[_0x6542('0x32')][_0x6542('0x4e')]({'where':{'id':_0x43d26b['params']['id']}})[_0x6542('0x23')](handleEntityNotFound(_0x37f8b1,null))[_0x6542('0x23')](saveUpdates(_0x43d26b[_0x6542('0x2c')],null))['then'](respondWithResult(_0x37f8b1,null))['catch'](handleError(_0x37f8b1,null));};exports[_0x6542('0x55')]=function(_0x3b7883,_0x427d32){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x3b7883[_0x6542('0x4c')]['id']}})[_0x6542('0x23')](handleEntityNotFound(_0x427d32,null))[_0x6542('0x23')](removeEntity(_0x427d32,null))['catch'](handleError(_0x427d32,null));};exports[_0x6542('0x56')]=function(_0x1b350f,_0x405f82,_0xee4bb8){return db[_0x6542('0x32')][_0x6542('0x4e')]({'where':{'id':_0x1b350f['params']['id']},'attributes':[_0x6542('0x28'),_0x6542('0x57'),_0x6542('0x58'),'output'],'raw':!![]})[_0x6542('0x23')](handleEntityNotFound(_0x405f82,null))[_0x6542('0x23')](function(_0x584fb9){if(_0x584fb9){if(!fs['existsSync'](path[_0x6542('0x59')](config[_0x6542('0x5a')],_0x6542('0x5b'),_0x584fb9[_0x6542('0x58')]))){throw new db[(_0x6542('0x5c'))][(_0x6542('0x5d'))](_0x6542('0x5e'));}if(_0x1b350f[_0x6542('0x39')][_0x6542('0x5f')]){return _0x405f82[_0x6542('0x60')](0xc8);}return _0x405f82[_0x6542('0x56')](path[_0x6542('0x59')](config[_0x6542('0x5a')],_0x6542('0x5b'),_0x584fb9['savename']),util['format'](_0x6542('0x61'),_0x584fb9[_0x6542('0x57')]||_0x584fb9[_0x6542('0x28')],_0x584fb9[_0x6542('0x62')][_0x6542('0x63')]()));}})[_0x6542('0x4a')](handleError(_0x405f82,null));}; \ No newline at end of file +var _0xc85d=['contact','agent','interaction','account','AnalyticExtractedReport','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','rawAttributes','keys','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','download','savename','output','existsSync','join','root','server/files/reports','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','sendStatus','stack','name','send','render','body'];(function(_0x183256,_0x1a596d){var _0x5394a2=function(_0x192025){while(--_0x192025){_0x183256['push'](_0x183256['shift']());}};_0x5394a2(++_0x1a596d);}(_0xc85d,0xfe));var _0xdc85=function(_0x2c7dc6,_0x3c4ce0){_0x2c7dc6=_0x2c7dc6-0x0;var _0x10002b=_0xc85d[_0x2c7dc6];return _0x10002b;};'use strict';var emlformat=require(_0xdc85('0x0'));var rimraf=require(_0xdc85('0x1'));var zipdir=require(_0xdc85('0x2'));var jsonpatch=require(_0xdc85('0x3'));var rp=require(_0xdc85('0x4'));var moment=require(_0xdc85('0x5'));var BPromise=require(_0xdc85('0x6'));var Mustache=require('mustache');var util=require(_0xdc85('0x7'));var path=require(_0xdc85('0x8'));var sox=require(_0xdc85('0x9'));var csv=require('to-csv');var ejs=require(_0xdc85('0xa'));var fs=require('fs');var fs_extra=require(_0xdc85('0xb'));var _=require(_0xdc85('0xc'));var squel=require(_0xdc85('0xd'));var crypto=require(_0xdc85('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdc85('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdc85('0x10'));var Papa=require(_0xdc85('0x11'));var Redis=require(_0xdc85('0x12'));var authService=require(_0xdc85('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdc85('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc85('0x15'))(_0xdc85('0x16'));var utils=require('../../config/utils');var config=require(_0xdc85('0x17'));var licenseUtil=require(_0xdc85('0x18'));var db=require(_0xdc85('0x19'))['db'];function respondWithStatusCode(_0x1a3179,_0x1e845b){_0x1e845b=_0x1e845b||0xcc;return function(_0xa9bc1a){if(_0xa9bc1a){return _0x1a3179['sendStatus'](_0x1e845b);}return _0x1a3179[_0xdc85('0x1a')](_0x1e845b)[_0xdc85('0x1b')]();};}function respondWithResult(_0x369e6c,_0x75f600){_0x75f600=_0x75f600||0xc8;return function(_0x434494){if(_0x434494){return _0x369e6c[_0xdc85('0x1a')](_0x75f600)[_0xdc85('0x1c')](_0x434494);}};}function respondWithFilteredResult(_0x5003f5,_0x22d56d){return function(_0x70b796){if(_0x70b796){var _0x4e378e=typeof _0x22d56d[_0xdc85('0x1d')]===_0xdc85('0x1e')&&typeof _0x22d56d[_0xdc85('0x1f')]===_0xdc85('0x1e');var _0x1f5d9b=_0x70b796[_0xdc85('0x20')];var _0x2f6c89=_0x4e378e?0x0:_0x22d56d[_0xdc85('0x1d')];var _0x33dc28=_0x4e378e?_0x70b796[_0xdc85('0x20')]:_0x22d56d[_0xdc85('0x1d')]+_0x22d56d['limit'];var _0x156d16;if(_0x33dc28>=_0x1f5d9b){_0x33dc28=_0x1f5d9b;_0x156d16=0xc8;}else{_0x156d16=0xce;}_0x5003f5[_0xdc85('0x1a')](_0x156d16);return _0x5003f5[_0xdc85('0x21')](_0xdc85('0x22'),_0x2f6c89+'-'+_0x33dc28+'/'+_0x1f5d9b)[_0xdc85('0x1c')](_0x70b796);}return null;};}function patchUpdates(_0x33bd24){return function(_0x46188f){try{jsonpatch[_0xdc85('0x23')](_0x46188f,_0x33bd24,!![]);}catch(_0x3db0be){return BPromise[_0xdc85('0x24')](_0x3db0be);}return _0x46188f[_0xdc85('0x25')]();};}function saveUpdates(_0x57d673,_0x2c71b6){return function(_0xec15db){if(_0xec15db){return _0xec15db['update'](_0x57d673)[_0xdc85('0x26')](function(_0x5be339){return _0x5be339;});}return null;};}function removeEntity(_0x430e28,_0x3086d0){return function(_0x3235cd){if(_0x3235cd){return _0x3235cd[_0xdc85('0x27')]()[_0xdc85('0x26')](function(){var _0x6f9f29=_0x3235cd[_0xdc85('0x28')]({'plain':!![]});var _0x3f7140=_0xdc85('0x29');return db[_0xdc85('0x2a')][_0xdc85('0x27')]({'where':{'type':_0x3f7140,'resourceId':_0x6f9f29['id']}})['then'](function(){return _0x3235cd;});})[_0xdc85('0x26')](function(){_0x430e28[_0xdc85('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x622cb2,_0x19ca2d){return function(_0x20be93){if(!_0x20be93){_0x622cb2[_0xdc85('0x2b')](0x194);}return _0x20be93;};}function handleError(_0x42bc1f,_0x4e68e7){_0x4e68e7=_0x4e68e7||0x1f4;return function(_0x296369){logger['error'](_0x296369[_0xdc85('0x2c')]);if(_0x296369[_0xdc85('0x2d')]){delete _0x296369[_0xdc85('0x2d')];}_0x42bc1f[_0xdc85('0x1a')](_0x4e68e7)[_0xdc85('0x2e')](_0x296369);};}function getMustacheRender(_0x26c941,_0x36b8ce){return Mustache[_0xdc85('0x2f')](_0x26c941,_['merge'](_0x36b8ce[_0xdc85('0x30')],{'contact':_0x36b8ce[_0xdc85('0x31')],'message':_0x36b8ce['message'],'agent':_0x36b8ce[_0xdc85('0x32')],'interaction':_0x36b8ce[_0xdc85('0x33')],'account':_0x36b8ce[_0xdc85('0x34')]}))||'';}exports['index']=function(_0x250e0c,_0x13fe47){var _0x2c3522={},_0x18c60a={},_0x208f2f={'count':0x0,'rows':[]};var _0x192d3e=_['map'](db[_0xdc85('0x35')]['rawAttributes'],function(_0x263f4c){return{'name':_0x263f4c['fieldName'],'type':_0x263f4c[_0xdc85('0x36')][_0xdc85('0x37')]};});_0x18c60a[_0xdc85('0x38')]=_[_0xdc85('0x39')](_0x192d3e,_0xdc85('0x2d'));_0x18c60a[_0xdc85('0x3a')]=_['keys'](_0x250e0c[_0xdc85('0x3a')]);_0x18c60a[_0xdc85('0x3b')]=_[_0xdc85('0x3c')](_0x18c60a[_0xdc85('0x38')],_0x18c60a[_0xdc85('0x3a')]);_0x2c3522[_0xdc85('0x3d')]=_['intersection'](_0x18c60a[_0xdc85('0x38')],qs[_0xdc85('0x3e')](_0x250e0c[_0xdc85('0x3a')][_0xdc85('0x3e')]));_0x2c3522['attributes']=_0x2c3522[_0xdc85('0x3d')][_0xdc85('0x3f')]?_0x2c3522['attributes']:_0x18c60a[_0xdc85('0x38')];if(!_0x250e0c[_0xdc85('0x3a')]['hasOwnProperty'](_0xdc85('0x40'))){_0x2c3522[_0xdc85('0x1f')]=qs[_0xdc85('0x1f')](_0x250e0c[_0xdc85('0x3a')][_0xdc85('0x1f')]);_0x2c3522[_0xdc85('0x1d')]=qs[_0xdc85('0x1d')](_0x250e0c[_0xdc85('0x3a')][_0xdc85('0x1d')]);}_0x2c3522[_0xdc85('0x41')]=qs[_0xdc85('0x42')](_0x250e0c['query']['sort']);_0x2c3522[_0xdc85('0x43')]=qs['filters'](_[_0xdc85('0x44')](_0x250e0c['query'],_0x18c60a[_0xdc85('0x3b')]),_0x192d3e);if(_0x250e0c[_0xdc85('0x3a')][_0xdc85('0x45')]){_0x2c3522['where']=_[_0xdc85('0x46')](_0x2c3522[_0xdc85('0x43')],{'$or':_[_0xdc85('0x39')](_0x192d3e,function(_0x4f100c){if(_0x4f100c['type']!=='VIRTUAL'){var _0x51caf7={};_0x51caf7[_0x4f100c[_0xdc85('0x2d')]]={'$like':'%'+_0x250e0c['query']['filter']+'%'};return _0x51caf7;}})});}_0x2c3522=_[_0xdc85('0x46')]({},_0x2c3522,_0x250e0c[_0xdc85('0x47')]);var _0x2a4b34={'where':_0x2c3522[_0xdc85('0x43')]};return db[_0xdc85('0x35')][_0xdc85('0x20')](_0x2a4b34)[_0xdc85('0x26')](function(_0x84bd00){_0x208f2f[_0xdc85('0x20')]=_0x84bd00;if(_0x250e0c['query']['includeAll']){_0x2c3522[_0xdc85('0x48')]=[{'all':!![]}];}return db[_0xdc85('0x35')][_0xdc85('0x49')](_0x2c3522);})[_0xdc85('0x26')](function(_0x5d5084){_0x208f2f['rows']=_0x5d5084;return _0x208f2f;})['then'](respondWithFilteredResult(_0x13fe47,_0x2c3522))[_0xdc85('0x4a')](handleError(_0x13fe47,null));};exports[_0xdc85('0x4b')]=function(_0x294a32,_0xbafac4){var _0x474d3b={'raw':!![],'where':{'id':_0x294a32[_0xdc85('0x4c')]['id']}},_0xf39c80={};_0xf39c80[_0xdc85('0x38')]=_['keys'](db[_0xdc85('0x35')][_0xdc85('0x4d')]);_0xf39c80[_0xdc85('0x3a')]=_[_0xdc85('0x4e')](_0x294a32[_0xdc85('0x3a')]);_0xf39c80[_0xdc85('0x3b')]=_['intersection'](_0xf39c80[_0xdc85('0x38')],_0xf39c80['query']);_0x474d3b[_0xdc85('0x3d')]=_[_0xdc85('0x3c')](_0xf39c80[_0xdc85('0x38')],qs[_0xdc85('0x3e')](_0x294a32[_0xdc85('0x3a')][_0xdc85('0x3e')]));_0x474d3b[_0xdc85('0x3d')]=_0x474d3b[_0xdc85('0x3d')][_0xdc85('0x3f')]?_0x474d3b['attributes']:_0xf39c80[_0xdc85('0x38')];if(_0x294a32[_0xdc85('0x3a')][_0xdc85('0x4f')]){_0x474d3b[_0xdc85('0x48')]=[{'all':!![]}];}_0x474d3b=_[_0xdc85('0x46')]({},_0x474d3b,_0x294a32[_0xdc85('0x47')]);return db[_0xdc85('0x35')][_0xdc85('0x50')](_0x474d3b)[_0xdc85('0x26')](handleEntityNotFound(_0xbafac4,null))[_0xdc85('0x26')](respondWithResult(_0xbafac4,null))['catch'](handleError(_0xbafac4,null));};exports[_0xdc85('0x51')]=function(_0x34d754,_0x4f2fcd){return db[_0xdc85('0x35')][_0xdc85('0x51')](_0x34d754[_0xdc85('0x30')],{})[_0xdc85('0x26')](function(_0x1f293f){var _0x148b7d=_0x34d754[_0xdc85('0x52')]['get']({'plain':!![]});if(!_0x148b7d)throw new Error(_0xdc85('0x53'));if(_0x148b7d[_0xdc85('0x54')]===_0xdc85('0x52')){var _0x1acc56=_0x1f293f['get']({'plain':!![]});var _0x5da1cc=_0xdc85('0x29');return db[_0xdc85('0x55')]['find']({'where':{'name':_0x5da1cc,'userProfileId':_0x148b7d[_0xdc85('0x56')]},'raw':!![]})[_0xdc85('0x26')](function(_0xcf58b){if(_0xcf58b&&_0xcf58b[_0xdc85('0x57')]===0x0){return db[_0xdc85('0x2a')][_0xdc85('0x51')]({'name':_0x1acc56[_0xdc85('0x2d')],'resourceId':_0x1acc56['id'],'type':_0xcf58b['name'],'sectionId':_0xcf58b['id']},{})[_0xdc85('0x26')](function(){return _0x1f293f;});}else{return _0x1f293f;}})[_0xdc85('0x4a')](function(_0xee747a){logger[_0xdc85('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xee747a);throw _0xee747a;});}return _0x1f293f;})[_0xdc85('0x26')](respondWithResult(_0x4f2fcd,0xc9))[_0xdc85('0x4a')](handleError(_0x4f2fcd,null));};exports['update']=function(_0x1ccb1c,_0x5b9b64){if(_0x1ccb1c[_0xdc85('0x30')]['id']){delete _0x1ccb1c[_0xdc85('0x30')]['id'];}return db[_0xdc85('0x35')][_0xdc85('0x50')]({'where':{'id':_0x1ccb1c[_0xdc85('0x4c')]['id']}})[_0xdc85('0x26')](handleEntityNotFound(_0x5b9b64,null))[_0xdc85('0x26')](saveUpdates(_0x1ccb1c[_0xdc85('0x30')],null))[_0xdc85('0x26')](respondWithResult(_0x5b9b64,null))[_0xdc85('0x4a')](handleError(_0x5b9b64,null));};exports['destroy']=function(_0x395f54,_0x5bb7a7){return db[_0xdc85('0x35')][_0xdc85('0x50')]({'where':{'id':_0x395f54[_0xdc85('0x4c')]['id']}})[_0xdc85('0x26')](handleEntityNotFound(_0x5bb7a7,null))[_0xdc85('0x26')](removeEntity(_0x5bb7a7,null))[_0xdc85('0x4a')](handleError(_0x5bb7a7,null));};exports[_0xdc85('0x59')]=function(_0x2708ef,_0x1e27b4,_0x235a46){return db[_0xdc85('0x35')][_0xdc85('0x50')]({'where':{'id':_0x2708ef['params']['id']},'attributes':[_0xdc85('0x2d'),'basename',_0xdc85('0x5a'),_0xdc85('0x5b')],'raw':!![]})[_0xdc85('0x26')](handleEntityNotFound(_0x1e27b4,null))[_0xdc85('0x26')](function(_0x2d359a){if(_0x2d359a){if(!fs[_0xdc85('0x5c')](path[_0xdc85('0x5d')](config[_0xdc85('0x5e')],_0xdc85('0x5f'),_0x2d359a[_0xdc85('0x5a')]))){throw new db['Sequelize']['ValidationError'](_0xdc85('0x60'));}if(_0x2708ef['query'][_0xdc85('0x61')]){return _0x1e27b4[_0xdc85('0x2b')](0xc8);}return _0x1e27b4[_0xdc85('0x59')](path[_0xdc85('0x5d')](config[_0xdc85('0x5e')],_0xdc85('0x5f'),_0x2d359a['savename']),util['format'](_0xdc85('0x62'),_0x2d359a[_0xdc85('0x63')]||_0x2d359a[_0xdc85('0x2d')],_0x2d359a[_0xdc85('0x5b')][_0xdc85('0x64')]()));}})[_0xdc85('0x4a')](handleError(_0x1e27b4,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 0c1cf63..aebf434 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 _0x4437=['./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x4437,0x87));var _0x7443=function(_0x531899,_0x3606e3){_0x531899=_0x531899-0x0;var _0x313ee2=_0x4437[_0x531899];return _0x313ee2;};'use strict';var _=require(_0x7443('0x0'));var util=require(_0x7443('0x1'));var logger=require(_0x7443('0x2'))(_0x7443('0x3'));var moment=require('moment');var BPromise=require(_0x7443('0x4'));var rp=require(_0x7443('0x5'));var fs=require('fs');var path=require(_0x7443('0x6'));var rimraf=require('rimraf');var config=require(_0x7443('0x7'));var attributes=require(_0x7443('0x8'));module[_0x7443('0x9')]=function(_0x59bbc3,_0xd19a6e){return _0x59bbc3[_0x7443('0xa')](_0x7443('0xb'),attributes,{'tableName':_0x7443('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92c7=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','request-promise'];(function(_0x50417f,_0x35432e){var _0x4d2328=function(_0x228001){while(--_0x228001){_0x50417f['push'](_0x50417f['shift']());}};_0x4d2328(++_0x35432e);}(_0x92c7,0x10a));var _0x792c=function(_0x548121,_0xa3e5bb){_0x548121=_0x548121-0x0;var _0x201eba=_0x92c7[_0x548121];return _0x201eba;};'use strict';var _=require(_0x792c('0x0'));var util=require('util');var logger=require(_0x792c('0x1'))(_0x792c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x792c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x792c('0x4'));var config=require(_0x792c('0x5'));var attributes=require(_0x792c('0x6'));module[_0x792c('0x7')]=function(_0x5723b4,_0x2b484f){return _0x5723b4['define'](_0x792c('0x8'),attributes,{'tableName':_0x792c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index b15d143..29a28e5 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 _0x0b96=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0x0b96,0xf1));var _0x60b9=function(_0x24df34,_0x50aa1a){_0x24df34=_0x24df34-0x0;var _0x3980e8=_0x0b96[_0x24df34];return _0x3980e8;};'use strict';var _=require(_0x60b9('0x0'));var util=require('util');var moment=require(_0x60b9('0x1'));var BPromise=require(_0x60b9('0x2'));var rs=require(_0x60b9('0x3'));var fs=require('fs');var Redis=require(_0x60b9('0x4'));var db=require(_0x60b9('0x5'))['db'];var utils=require(_0x60b9('0x6'));var logger=require(_0x60b9('0x7'))(_0x60b9('0x8'));var config=require(_0x60b9('0x9'));var jayson=require(_0x60b9('0xa'));var client=jayson[_0x60b9('0xb')][_0x60b9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x815970,_0x5ea969,_0x58c7a3){return new BPromise(function(_0x2f0efc,_0x49a727){return client[_0x60b9('0xd')](_0x815970,_0x58c7a3)['then'](function(_0x96a558){logger[_0x60b9('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5ea969,'request\x20sent');logger['debug'](_0x60b9('0xf'),_0x5ea969,_0x60b9('0x10'),JSON[_0x60b9('0x11')](_0x96a558));if(_0x96a558['error']){if(_0x96a558['error'][_0x60b9('0x12')]===0x1f4){logger[_0x60b9('0x13')](_0x60b9('0x14'),_0x5ea969,_0x96a558[_0x60b9('0x13')][_0x60b9('0x15')]);return _0x49a727(_0x96a558['error'][_0x60b9('0x15')]);}logger[_0x60b9('0x13')](_0x60b9('0x14'),_0x5ea969,_0x96a558[_0x60b9('0x13')]['message']);return _0x2f0efc(_0x96a558[_0x60b9('0x13')][_0x60b9('0x15')]);}else{logger[_0x60b9('0xe')](_0x60b9('0x14'),_0x5ea969,_0x60b9('0x10'));_0x2f0efc(_0x96a558[_0x60b9('0x16')][_0x60b9('0x15')]);}})[_0x60b9('0x17')](function(_0x1154f1){logger[_0x60b9('0x13')](_0x60b9('0x14'),_0x5ea969,_0x1154f1);_0x49a727(_0x1154f1);});});} \ No newline at end of file +var _0x9330=['request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0xabbd2f,_0x44d05a){var _0x34a040=function(_0x3736d9){while(--_0x3736d9){_0xabbd2f['push'](_0xabbd2f['shift']());}};_0x34a040(++_0x44d05a);}(_0x9330,0x1d8));var _0x0933=function(_0x345c73,_0x27c179){_0x345c73=_0x345c73-0x0;var _0x4b757f=_0x9330[_0x345c73];return _0x4b757f;};'use strict';var _=require(_0x0933('0x0'));var util=require(_0x0933('0x1'));var moment=require(_0x0933('0x2'));var BPromise=require(_0x0933('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0933('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0933('0x5'))(_0x0933('0x6'));var config=require(_0x0933('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ba7b7,_0x3e339c,_0x465b74){return new BPromise(function(_0x3f5fb9,_0x4bc2af){return client[_0x0933('0x8')](_0x1ba7b7,_0x465b74)['then'](function(_0x2520f8){logger[_0x0933('0x9')](_0x0933('0xa'),_0x3e339c,_0x0933('0xb'));logger[_0x0933('0xc')](_0x0933('0xd'),_0x3e339c,_0x0933('0xb'),JSON[_0x0933('0xe')](_0x2520f8));if(_0x2520f8[_0x0933('0xf')]){if(_0x2520f8[_0x0933('0xf')][_0x0933('0x10')]===0x1f4){logger[_0x0933('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3e339c,_0x2520f8[_0x0933('0xf')][_0x0933('0x11')]);return _0x4bc2af(_0x2520f8[_0x0933('0xf')][_0x0933('0x11')]);}logger[_0x0933('0xf')](_0x0933('0xa'),_0x3e339c,_0x2520f8['error'][_0x0933('0x11')]);return _0x3f5fb9(_0x2520f8[_0x0933('0xf')][_0x0933('0x11')]);}else{logger[_0x0933('0x9')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3e339c,_0x0933('0xb'));_0x3f5fb9(_0x2520f8[_0x0933('0x12')]['message']);}})[_0x0933('0x13')](function(_0x3800f5){logger[_0x0933('0xf')](_0x0933('0xa'),_0x3e339c,_0x3800f5);_0x4bc2af(_0x3800f5);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index d4b4b47..bcfdce8 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 _0x67c0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','download','post','create','put','delete','destroy','exports','util','express'];(function(_0x376e18,_0x4273c6){var _0x247ca1=function(_0x20ba85){while(--_0x20ba85){_0x376e18['push'](_0x376e18['shift']());}};_0x247ca1(++_0x4273c6);}(_0x67c0,0x174));var _0x067c=function(_0x4e6e1b,_0x5c2d28){_0x4e6e1b=_0x4e6e1b-0x0;var _0x41f832=_0x67c0[_0x4e6e1b];return _0x41f832;};'use strict';var multer=require('multer');var util=require(_0x067c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x067c('0x1'));var router=express[_0x067c('0x2')]();var fs_extra=require(_0x067c('0x3'));var auth=require(_0x067c('0x4'));var interaction=require(_0x067c('0x5'));var config=require(_0x067c('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0x067c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x067c('0x7')](_0x067c('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x067c('0x7')]('/:id/download',auth[_0x067c('0x9')](),controller[_0x067c('0xa')]);router[_0x067c('0xb')]('/',auth[_0x067c('0x9')](),controller[_0x067c('0xc')]);router[_0x067c('0xd')](_0x067c('0x8'),auth[_0x067c('0x9')](),controller['update']);router[_0x067c('0xe')]('/:id',auth[_0x067c('0x9')](),controller[_0x067c('0xf')]);module[_0x067c('0x10')]=router; \ No newline at end of file +var _0x5221=['/:id/download','download','post','create','update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','show'];(function(_0x1621dd,_0x172229){var _0x3b0046=function(_0x53ab32){while(--_0x53ab32){_0x1621dd['push'](_0x1621dd['shift']());}};_0x3b0046(++_0x172229);}(_0x5221,0x8d));var _0x1522=function(_0x5d4786,_0x4f4db4){_0x5d4786=_0x5d4786-0x0;var _0x333bc0=_0x5221[_0x5d4786];return _0x333bc0;};'use strict';var multer=require(_0x1522('0x0'));var util=require(_0x1522('0x1'));var path=require('path');var timeout=require(_0x1522('0x2'));var express=require('express');var router=express[_0x1522('0x3')]();var fs_extra=require(_0x1522('0x4'));var auth=require(_0x1522('0x5'));var interaction=require(_0x1522('0x6'));var config=require(_0x1522('0x7'));var controller=require(_0x1522('0x8'));router['get']('/',auth[_0x1522('0x9')](),controller[_0x1522('0xa')]);router[_0x1522('0xb')]('/:id',auth[_0x1522('0x9')](),controller[_0x1522('0xc')]);router[_0x1522('0xb')](_0x1522('0xd'),auth[_0x1522('0x9')](),controller[_0x1522('0xe')]);router[_0x1522('0xf')]('/',auth[_0x1522('0x9')](),controller[_0x1522('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1522('0x11')]);router[_0x1522('0x12')](_0x1522('0x13'),auth['isAuthenticated'](),controller[_0x1522('0x14')]);module[_0x1522('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 8636451..d8ec73b 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 _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x140610,_0x1b7199){var _0x4b2845=function(_0x25f67d){while(--_0x25f67d){_0x140610['push'](_0x140610['shift']());}};_0x4b2845(++_0x1b7199);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x814b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x4ae2fb,_0x1c1c67){var _0x4f5268=function(_0x11236b){while(--_0x11236b){_0x4ae2fb['push'](_0x4ae2fb['shift']());}};_0x4f5268(++_0x1c1c67);}(_0x814b,0x1a2));var _0xb814=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0x814b[_0x31a37b];return _0x49ae16;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'field':{'type':Sequelize[_0xb814('0x2')]},'alias':{'type':Sequelize[_0xb814('0x3')]},'function':{'type':Sequelize[_0xb814('0x3')]},'format':{'type':Sequelize[_0xb814('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb814('0x3')]},'custom':{'type':Sequelize[_0xb814('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index bd8692f..89b96bd 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 _0xb113=['send','merge','contact','message','agent','account','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','catch','show','params','options','find','create','body','update','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','error','stack','name'];(function(_0x563d6f,_0x139af5){var _0x19ee0d=function(_0x58e729){while(--_0x58e729){_0x563d6f['push'](_0x563d6f['shift']());}};_0x19ee0d(++_0x139af5);}(_0xb113,0x18d));var _0x3b11=function(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0xb113[_0x1a1b6e];return _0x571e2c;};'use strict';var emlformat=require(_0x3b11('0x0'));var rimraf=require(_0x3b11('0x1'));var zipdir=require(_0x3b11('0x2'));var jsonpatch=require(_0x3b11('0x3'));var rp=require(_0x3b11('0x4'));var moment=require(_0x3b11('0x5'));var BPromise=require(_0x3b11('0x6'));var Mustache=require(_0x3b11('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3b11('0x8'));var ejs=require(_0x3b11('0x9'));var fs=require('fs');var fs_extra=require(_0x3b11('0xa'));var _=require(_0x3b11('0xb'));var squel=require('squel');var crypto=require(_0x3b11('0xc'));var jsforce=require(_0x3b11('0xd'));var deskjs=require(_0x3b11('0xe'));var toCsv=require(_0x3b11('0x8'));var querystring=require(_0x3b11('0xf'));var Papa=require(_0x3b11('0x10'));var Redis=require(_0x3b11('0x11'));var authService=require(_0x3b11('0x12'));var qs=require(_0x3b11('0x13'));var as=require(_0x3b11('0x14'));var hardwareService=require(_0x3b11('0x15'));var logger=require('../../config/logger')(_0x3b11('0x16'));var utils=require(_0x3b11('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3b11('0x18'));var db=require(_0x3b11('0x19'))['db'];function respondWithStatusCode(_0x50ecba,_0x2b2dbf){_0x2b2dbf=_0x2b2dbf||0xcc;return function(_0x28a1d5){if(_0x28a1d5){return _0x50ecba[_0x3b11('0x1a')](_0x2b2dbf);}return _0x50ecba[_0x3b11('0x1b')](_0x2b2dbf)[_0x3b11('0x1c')]();};}function respondWithResult(_0x1b38a8,_0x589e5f){_0x589e5f=_0x589e5f||0xc8;return function(_0x37d0ce){if(_0x37d0ce){return _0x1b38a8[_0x3b11('0x1b')](_0x589e5f)[_0x3b11('0x1d')](_0x37d0ce);}};}function respondWithFilteredResult(_0x1a85e0,_0x4112c7){return function(_0x1a8211){if(_0x1a8211){var _0x14b7cf=typeof _0x4112c7[_0x3b11('0x1e')]==='undefined'&&typeof _0x4112c7[_0x3b11('0x1f')]===_0x3b11('0x20');var _0x5721eb=_0x1a8211[_0x3b11('0x21')];var _0x51671f=_0x14b7cf?0x0:_0x4112c7[_0x3b11('0x1e')];var _0x314e52=_0x14b7cf?_0x1a8211[_0x3b11('0x21')]:_0x4112c7[_0x3b11('0x1e')]+_0x4112c7[_0x3b11('0x1f')];var _0x3010af;if(_0x314e52>=_0x5721eb){_0x314e52=_0x5721eb;_0x3010af=0xc8;}else{_0x3010af=0xce;}_0x1a85e0[_0x3b11('0x1b')](_0x3010af);return _0x1a85e0[_0x3b11('0x22')](_0x3b11('0x23'),_0x51671f+'-'+_0x314e52+'/'+_0x5721eb)['json'](_0x1a8211);}return null;};}function patchUpdates(_0x296135){return function(_0x34eb73){try{jsonpatch[_0x3b11('0x24')](_0x34eb73,_0x296135,!![]);}catch(_0x443edb){return BPromise['reject'](_0x443edb);}return _0x34eb73[_0x3b11('0x25')]();};}function saveUpdates(_0x10e62a,_0x382360){return function(_0x18dab8){if(_0x18dab8){return _0x18dab8['update'](_0x10e62a)[_0x3b11('0x26')](function(_0xf8e165){return _0xf8e165;});}return null;};}function removeEntity(_0x2fcbb9,_0x4a3556){return function(_0x34b309){if(_0x34b309){return _0x34b309[_0x3b11('0x27')]()[_0x3b11('0x26')](function(){_0x2fcbb9[_0x3b11('0x1b')](0xcc)[_0x3b11('0x1c')]();});}};}function handleEntityNotFound(_0x3b1c4c,_0x5559f7){return function(_0x3bd33e){if(!_0x3bd33e){_0x3b1c4c[_0x3b11('0x1a')](0x194);}return _0x3bd33e;};}function handleError(_0x460cb4,_0x177fd7){_0x177fd7=_0x177fd7||0x1f4;return function(_0x36d731){logger[_0x3b11('0x28')](_0x36d731[_0x3b11('0x29')]);if(_0x36d731[_0x3b11('0x2a')]){delete _0x36d731[_0x3b11('0x2a')];}_0x460cb4['status'](_0x177fd7)[_0x3b11('0x2b')](_0x36d731);};}function getMustacheRender(_0x4fc1b9,_0x51bf79){return Mustache['render'](_0x4fc1b9,_[_0x3b11('0x2c')](_0x51bf79['body'],{'contact':_0x51bf79[_0x3b11('0x2d')],'message':_0x51bf79[_0x3b11('0x2e')],'agent':_0x51bf79[_0x3b11('0x2f')],'interaction':_0x51bf79['interaction'],'account':_0x51bf79[_0x3b11('0x30')]}))||'';}exports[_0x3b11('0x31')]=function(_0x2fae4b,_0x5d7ae2){var _0x1f12f9={},_0x32e0ff={},_0x38c695={'count':0x0,'rows':[]};var _0x1b19fa=_[_0x3b11('0x32')](db[_0x3b11('0x33')][_0x3b11('0x34')],function(_0x521b24){return{'name':_0x521b24[_0x3b11('0x35')],'type':_0x521b24[_0x3b11('0x36')][_0x3b11('0x37')]};});_0x32e0ff[_0x3b11('0x38')]=_['map'](_0x1b19fa,'name');_0x32e0ff[_0x3b11('0x39')]=_[_0x3b11('0x3a')](_0x2fae4b[_0x3b11('0x39')]);_0x32e0ff[_0x3b11('0x3b')]=_[_0x3b11('0x3c')](_0x32e0ff[_0x3b11('0x38')],_0x32e0ff['query']);_0x1f12f9[_0x3b11('0x3d')]=_['intersection'](_0x32e0ff['model'],qs[_0x3b11('0x3e')](_0x2fae4b['query'][_0x3b11('0x3e')]));_0x1f12f9[_0x3b11('0x3d')]=_0x1f12f9[_0x3b11('0x3d')][_0x3b11('0x3f')]?_0x1f12f9[_0x3b11('0x3d')]:_0x32e0ff[_0x3b11('0x38')];if(!_0x2fae4b[_0x3b11('0x39')][_0x3b11('0x40')](_0x3b11('0x41'))){_0x1f12f9[_0x3b11('0x1f')]=qs[_0x3b11('0x1f')](_0x2fae4b[_0x3b11('0x39')][_0x3b11('0x1f')]);_0x1f12f9[_0x3b11('0x1e')]=qs[_0x3b11('0x1e')](_0x2fae4b[_0x3b11('0x39')][_0x3b11('0x1e')]);}_0x1f12f9[_0x3b11('0x42')]=qs[_0x3b11('0x43')](_0x2fae4b[_0x3b11('0x39')][_0x3b11('0x43')]);_0x1f12f9[_0x3b11('0x44')]=qs['filters'](_[_0x3b11('0x45')](_0x2fae4b[_0x3b11('0x39')],_0x32e0ff[_0x3b11('0x3b')]),_0x1b19fa);if(_0x2fae4b[_0x3b11('0x39')][_0x3b11('0x46')]){_0x1f12f9[_0x3b11('0x44')]=_[_0x3b11('0x2c')](_0x1f12f9['where'],{'$or':_['map'](_0x1b19fa,function(_0x17f3c4){if(_0x17f3c4[_0x3b11('0x36')]!=='VIRTUAL'){var _0x26d2c2={};_0x26d2c2[_0x17f3c4['name']]={'$like':'%'+_0x2fae4b[_0x3b11('0x39')][_0x3b11('0x46')]+'%'};return _0x26d2c2;}})});}_0x1f12f9=_[_0x3b11('0x2c')]({},_0x1f12f9,_0x2fae4b['options']);var _0x8236ca={'where':_0x1f12f9[_0x3b11('0x44')]};return db[_0x3b11('0x33')][_0x3b11('0x21')](_0x8236ca)[_0x3b11('0x26')](function(_0x225a24){_0x38c695['count']=_0x225a24;if(_0x2fae4b[_0x3b11('0x39')][_0x3b11('0x47')]){_0x1f12f9[_0x3b11('0x48')]=[{'all':!![]}];}return db[_0x3b11('0x33')][_0x3b11('0x49')](_0x1f12f9);})['then'](function(_0xd7b20){_0x38c695['rows']=_0xd7b20;return _0x38c695;})['then'](respondWithFilteredResult(_0x5d7ae2,_0x1f12f9))[_0x3b11('0x4a')](handleError(_0x5d7ae2,null));};exports[_0x3b11('0x4b')]=function(_0x36ec59,_0x2794c9){var _0xa5d407={'raw':![],'where':{'id':_0x36ec59[_0x3b11('0x4c')]['id']}},_0x5db92b={};_0x5db92b[_0x3b11('0x38')]=_[_0x3b11('0x3a')](db['AnalyticFieldReport'][_0x3b11('0x34')]);_0x5db92b[_0x3b11('0x39')]=_[_0x3b11('0x3a')](_0x36ec59['query']);_0x5db92b[_0x3b11('0x3b')]=_[_0x3b11('0x3c')](_0x5db92b[_0x3b11('0x38')],_0x5db92b[_0x3b11('0x39')]);_0xa5d407[_0x3b11('0x3d')]=_[_0x3b11('0x3c')](_0x5db92b[_0x3b11('0x38')],qs[_0x3b11('0x3e')](_0x36ec59['query'][_0x3b11('0x3e')]));_0xa5d407['attributes']=_0xa5d407['attributes'][_0x3b11('0x3f')]?_0xa5d407['attributes']:_0x5db92b[_0x3b11('0x38')];if(_0x36ec59['query']['includeAll']){_0xa5d407['include']=[{'all':!![]}];}_0xa5d407=_[_0x3b11('0x2c')]({},_0xa5d407,_0x36ec59[_0x3b11('0x4d')]);return db['AnalyticFieldReport'][_0x3b11('0x4e')](_0xa5d407)[_0x3b11('0x26')](handleEntityNotFound(_0x2794c9,null))[_0x3b11('0x26')](respondWithResult(_0x2794c9,null))[_0x3b11('0x4a')](handleError(_0x2794c9,null));};exports['create']=function(_0x300d20,_0x1517bb){return db[_0x3b11('0x33')][_0x3b11('0x4f')](_0x300d20[_0x3b11('0x50')],{})[_0x3b11('0x26')](respondWithResult(_0x1517bb,0xc9))[_0x3b11('0x4a')](handleError(_0x1517bb,null));};exports['bulkCreate']=function(_0x493dc0,_0x2f6301){return db['AnalyticFieldReport']['bulkCreate'](_0x493dc0[_0x3b11('0x50')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2f6301,0xc9))[_0x3b11('0x4a')](handleError(_0x2f6301,null));};exports[_0x3b11('0x51')]=function(_0x1b4cdf,_0x178777){if(_0x1b4cdf['body']['id']){delete _0x1b4cdf[_0x3b11('0x50')]['id'];}return db[_0x3b11('0x33')]['find']({'where':{'id':_0x1b4cdf[_0x3b11('0x4c')]['id']}})['then'](handleEntityNotFound(_0x178777,null))[_0x3b11('0x26')](saveUpdates(_0x1b4cdf[_0x3b11('0x50')],null))[_0x3b11('0x26')](respondWithResult(_0x178777,null))[_0x3b11('0x4a')](handleError(_0x178777,null));};exports['destroy']=function(_0x2c6e80,_0x9cb3d2){return db[_0x3b11('0x33')]['find']({'where':{'id':_0x2c6e80[_0x3b11('0x4c')]['id']}})[_0x3b11('0x26')](handleEntityNotFound(_0x9cb3d2,null))['then'](removeEntity(_0x9cb3d2,null))[_0x3b11('0x4a')](handleError(_0x9cb3d2,null));};exports[_0x3b11('0x52')]=function(_0x27ab68,_0x38c65f){return db[_0x3b11('0x33')][_0x3b11('0x27')]({'where':{'id':_0x27ab68[_0x3b11('0x39')][_0x3b11('0x53')]||[]},'raw':![],'individualHooks':!![]})[_0x3b11('0x26')](respondWithResult(_0x38c65f,0xcc))[_0x3b11('0x4a')](handleError(_0x38c65f,null));};exports[_0x3b11('0x54')]=function(_0x2ec0a4,_0x37fca7,_0x3c6f02){return db[_0x3b11('0x55')][_0x3b11('0x56')]({'where':{'id':_0x2ec0a4['params']['id']}})[_0x3b11('0x26')](handleEntityNotFound(_0x37fca7,null))[_0x3b11('0x26')](function(_0x152bf4){if(_0x152bf4){return db['sequelize'][_0x3b11('0x57')](function(_0x4af69f){return db[_0x3b11('0x33')][_0x3b11('0x27')]({'where':{'CustomReportId':_0x2ec0a4[_0x3b11('0x4c')]['id']},'transaction':_0x4af69f})[_0x3b11('0x26')](function(_0x4e0e5c){var _0x18e3f7=_[_0x3b11('0x32')](_0x2ec0a4['body'],function(_0x5e5d47){delete _0x5e5d47['id'];_0x5e5d47['CustomReportId']=_0x2ec0a4[_0x3b11('0x4c')]['id'];return _0x5e5d47;});return db[_0x3b11('0x33')]['bulkCreate'](_0x18e3f7,{'transaction':_0x4af69f});});})[_0x3b11('0x26')](function(){return db[_0x3b11('0x33')]['findAll']({'where':{'CustomReportId':_0x2ec0a4['params']['id']}});});}})[_0x3b11('0x26')](respondWithResult(_0x37fca7,null))[_0x3b11('0x4a')](handleError(_0x37fca7,null));}; \ No newline at end of file +var _0x880f=['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/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','body','contact','message','interaction','account','AnalyticFieldReport','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','includeAll','include','findAll','rows','show','rawAttributes','find','create','bulkCreate','catch','params','bulkDestroy','AnalyticCustomReport','findOne','sequelize','transaction','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0x880f,0x9b));var _0xf880=function(_0x1e0e72,_0x3cc752){_0x1e0e72=_0x1e0e72-0x0;var _0x4feba4=_0x880f[_0x1e0e72];return _0x4feba4;};'use strict';var emlformat=require(_0xf880('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf880('0x1'));var moment=require(_0xf880('0x2'));var BPromise=require(_0xf880('0x3'));var Mustache=require(_0xf880('0x4'));var util=require(_0xf880('0x5'));var path=require(_0xf880('0x6'));var sox=require(_0xf880('0x7'));var csv=require(_0xf880('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf880('0x9'));var _=require(_0xf880('0xa'));var squel=require(_0xf880('0xb'));var crypto=require('crypto');var jsforce=require(_0xf880('0xc'));var deskjs=require(_0xf880('0xd'));var toCsv=require(_0xf880('0x8'));var querystring=require('querystring');var Papa=require(_0xf880('0xe'));var Redis=require(_0xf880('0xf'));var authService=require(_0xf880('0x10'));var qs=require(_0xf880('0x11'));var as=require(_0xf880('0x12'));var hardwareService=require(_0xf880('0x13'));var logger=require(_0xf880('0x14'))(_0xf880('0x15'));var utils=require(_0xf880('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf880('0x17'));var db=require(_0xf880('0x18'))['db'];function respondWithStatusCode(_0x214083,_0x294150){_0x294150=_0x294150||0xcc;return function(_0x4ed8f7){if(_0x4ed8f7){return _0x214083['sendStatus'](_0x294150);}return _0x214083[_0xf880('0x19')](_0x294150)[_0xf880('0x1a')]();};}function respondWithResult(_0x5ea163,_0x1fd39d){_0x1fd39d=_0x1fd39d||0xc8;return function(_0x495af9){if(_0x495af9){return _0x5ea163[_0xf880('0x19')](_0x1fd39d)[_0xf880('0x1b')](_0x495af9);}};}function respondWithFilteredResult(_0x5cb312,_0x36aa83){return function(_0x37aa90){if(_0x37aa90){var _0x377a06=typeof _0x36aa83[_0xf880('0x1c')]===_0xf880('0x1d')&&typeof _0x36aa83[_0xf880('0x1e')]==='undefined';var _0xb96a4c=_0x37aa90[_0xf880('0x1f')];var _0x1789a0=_0x377a06?0x0:_0x36aa83['offset'];var _0x1e3b98=_0x377a06?_0x37aa90[_0xf880('0x1f')]:_0x36aa83['offset']+_0x36aa83[_0xf880('0x1e')];var _0x9b1975;if(_0x1e3b98>=_0xb96a4c){_0x1e3b98=_0xb96a4c;_0x9b1975=0xc8;}else{_0x9b1975=0xce;}_0x5cb312[_0xf880('0x19')](_0x9b1975);return _0x5cb312[_0xf880('0x20')](_0xf880('0x21'),_0x1789a0+'-'+_0x1e3b98+'/'+_0xb96a4c)[_0xf880('0x1b')](_0x37aa90);}return null;};}function patchUpdates(_0x1edf07){return function(_0x39b082){try{jsonpatch[_0xf880('0x22')](_0x39b082,_0x1edf07,!![]);}catch(_0x4e8f4a){return BPromise['reject'](_0x4e8f4a);}return _0x39b082[_0xf880('0x23')]();};}function saveUpdates(_0x4ccf84,_0xae5ec2){return function(_0x1d0ddd){if(_0x1d0ddd){return _0x1d0ddd[_0xf880('0x24')](_0x4ccf84)[_0xf880('0x25')](function(_0x1a8f33){return _0x1a8f33;});}return null;};}function removeEntity(_0x56305c,_0x132a37){return function(_0x247e08){if(_0x247e08){return _0x247e08[_0xf880('0x26')]()[_0xf880('0x25')](function(){_0x56305c[_0xf880('0x19')](0xcc)[_0xf880('0x1a')]();});}};}function handleEntityNotFound(_0x30ed0e,_0x59193f){return function(_0xf90cb0){if(!_0xf90cb0){_0x30ed0e[_0xf880('0x27')](0x194);}return _0xf90cb0;};}function handleError(_0x506e4a,_0x24ba90){_0x24ba90=_0x24ba90||0x1f4;return function(_0x15e944){logger['error'](_0x15e944[_0xf880('0x28')]);if(_0x15e944[_0xf880('0x29')]){delete _0x15e944[_0xf880('0x29')];}_0x506e4a['status'](_0x24ba90)[_0xf880('0x2a')](_0x15e944);};}function getMustacheRender(_0x4903ad,_0x5f24bb){return Mustache['render'](_0x4903ad,_['merge'](_0x5f24bb[_0xf880('0x2b')],{'contact':_0x5f24bb[_0xf880('0x2c')],'message':_0x5f24bb[_0xf880('0x2d')],'agent':_0x5f24bb['agent'],'interaction':_0x5f24bb[_0xf880('0x2e')],'account':_0x5f24bb[_0xf880('0x2f')]}))||'';}exports['index']=function(_0xd2a63d,_0x2953cf){var _0x570fc1={},_0x56c718={},_0x267abb={'count':0x0,'rows':[]};var _0x13539f=_['map'](db[_0xf880('0x30')]['rawAttributes'],function(_0x5660b6){return{'name':_0x5660b6[_0xf880('0x31')],'type':_0x5660b6[_0xf880('0x32')]['key']};});_0x56c718['model']=_[_0xf880('0x33')](_0x13539f,_0xf880('0x29'));_0x56c718[_0xf880('0x34')]=_[_0xf880('0x35')](_0xd2a63d[_0xf880('0x34')]);_0x56c718[_0xf880('0x36')]=_[_0xf880('0x37')](_0x56c718[_0xf880('0x38')],_0x56c718['query']);_0x570fc1['attributes']=_[_0xf880('0x37')](_0x56c718[_0xf880('0x38')],qs[_0xf880('0x39')](_0xd2a63d['query']['fields']));_0x570fc1[_0xf880('0x3a')]=_0x570fc1[_0xf880('0x3a')][_0xf880('0x3b')]?_0x570fc1['attributes']:_0x56c718[_0xf880('0x38')];if(!_0xd2a63d[_0xf880('0x34')][_0xf880('0x3c')](_0xf880('0x3d'))){_0x570fc1['limit']=qs['limit'](_0xd2a63d[_0xf880('0x34')][_0xf880('0x1e')]);_0x570fc1[_0xf880('0x1c')]=qs[_0xf880('0x1c')](_0xd2a63d['query'][_0xf880('0x1c')]);}_0x570fc1['order']=qs[_0xf880('0x3e')](_0xd2a63d[_0xf880('0x34')][_0xf880('0x3e')]);_0x570fc1[_0xf880('0x3f')]=qs[_0xf880('0x36')](_[_0xf880('0x40')](_0xd2a63d[_0xf880('0x34')],_0x56c718['filters']),_0x13539f);if(_0xd2a63d[_0xf880('0x34')]['filter']){_0x570fc1[_0xf880('0x3f')]=_[_0xf880('0x41')](_0x570fc1[_0xf880('0x3f')],{'$or':_[_0xf880('0x33')](_0x13539f,function(_0x3ac5c7){if(_0x3ac5c7[_0xf880('0x32')]!=='VIRTUAL'){var _0x53cb2e={};_0x53cb2e[_0x3ac5c7[_0xf880('0x29')]]={'$like':'%'+_0xd2a63d[_0xf880('0x34')]['filter']+'%'};return _0x53cb2e;}})});}_0x570fc1=_[_0xf880('0x41')]({},_0x570fc1,_0xd2a63d['options']);var _0x42908e={'where':_0x570fc1[_0xf880('0x3f')]};return db[_0xf880('0x30')][_0xf880('0x1f')](_0x42908e)[_0xf880('0x25')](function(_0x3e4c8e){_0x267abb[_0xf880('0x1f')]=_0x3e4c8e;if(_0xd2a63d[_0xf880('0x34')][_0xf880('0x42')]){_0x570fc1[_0xf880('0x43')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xf880('0x44')](_0x570fc1);})[_0xf880('0x25')](function(_0x2a96a6){_0x267abb[_0xf880('0x45')]=_0x2a96a6;return _0x267abb;})[_0xf880('0x25')](respondWithFilteredResult(_0x2953cf,_0x570fc1))['catch'](handleError(_0x2953cf,null));};exports[_0xf880('0x46')]=function(_0xbaa079,_0x5d78f5){var _0x1a9898={'raw':![],'where':{'id':_0xbaa079['params']['id']}},_0x4c0794={};_0x4c0794['model']=_[_0xf880('0x35')](db[_0xf880('0x30')][_0xf880('0x47')]);_0x4c0794[_0xf880('0x34')]=_['keys'](_0xbaa079[_0xf880('0x34')]);_0x4c0794[_0xf880('0x36')]=_[_0xf880('0x37')](_0x4c0794[_0xf880('0x38')],_0x4c0794[_0xf880('0x34')]);_0x1a9898[_0xf880('0x3a')]=_[_0xf880('0x37')](_0x4c0794[_0xf880('0x38')],qs['fields'](_0xbaa079[_0xf880('0x34')][_0xf880('0x39')]));_0x1a9898[_0xf880('0x3a')]=_0x1a9898[_0xf880('0x3a')]['length']?_0x1a9898[_0xf880('0x3a')]:_0x4c0794[_0xf880('0x38')];if(_0xbaa079[_0xf880('0x34')][_0xf880('0x42')]){_0x1a9898[_0xf880('0x43')]=[{'all':!![]}];}_0x1a9898=_[_0xf880('0x41')]({},_0x1a9898,_0xbaa079['options']);return db[_0xf880('0x30')][_0xf880('0x48')](_0x1a9898)[_0xf880('0x25')](handleEntityNotFound(_0x5d78f5,null))[_0xf880('0x25')](respondWithResult(_0x5d78f5,null))['catch'](handleError(_0x5d78f5,null));};exports[_0xf880('0x49')]=function(_0x1a8813,_0x1fe5e3){return db[_0xf880('0x30')][_0xf880('0x49')](_0x1a8813[_0xf880('0x2b')],{})[_0xf880('0x25')](respondWithResult(_0x1fe5e3,0xc9))['catch'](handleError(_0x1fe5e3,null));};exports[_0xf880('0x4a')]=function(_0x3ae8b6,_0x2edbf2){return db['AnalyticFieldReport']['bulkCreate'](_0x3ae8b6['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2edbf2,0xc9))[_0xf880('0x4b')](handleError(_0x2edbf2,null));};exports[_0xf880('0x24')]=function(_0x44b221,_0xefaaee){if(_0x44b221[_0xf880('0x2b')]['id']){delete _0x44b221[_0xf880('0x2b')]['id'];}return db[_0xf880('0x30')][_0xf880('0x48')]({'where':{'id':_0x44b221[_0xf880('0x4c')]['id']}})['then'](handleEntityNotFound(_0xefaaee,null))['then'](saveUpdates(_0x44b221[_0xf880('0x2b')],null))[_0xf880('0x25')](respondWithResult(_0xefaaee,null))[_0xf880('0x4b')](handleError(_0xefaaee,null));};exports['destroy']=function(_0x438384,_0x3ad0b2){return db[_0xf880('0x30')]['find']({'where':{'id':_0x438384[_0xf880('0x4c')]['id']}})[_0xf880('0x25')](handleEntityNotFound(_0x3ad0b2,null))[_0xf880('0x25')](removeEntity(_0x3ad0b2,null))['catch'](handleError(_0x3ad0b2,null));};exports[_0xf880('0x4d')]=function(_0x1164a0,_0x57dea8){return db[_0xf880('0x30')]['destroy']({'where':{'id':_0x1164a0[_0xf880('0x34')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xf880('0x25')](respondWithResult(_0x57dea8,0xcc))[_0xf880('0x4b')](handleError(_0x57dea8,null));};exports['addFields']=function(_0x505173,_0x5da767,_0x48b945){return db[_0xf880('0x4e')][_0xf880('0x4f')]({'where':{'id':_0x505173[_0xf880('0x4c')]['id']}})[_0xf880('0x25')](handleEntityNotFound(_0x5da767,null))[_0xf880('0x25')](function(_0x52c7e4){if(_0x52c7e4){return db[_0xf880('0x50')][_0xf880('0x51')](function(_0x1fc69c){return db['AnalyticFieldReport'][_0xf880('0x26')]({'where':{'CustomReportId':_0x505173[_0xf880('0x4c')]['id']},'transaction':_0x1fc69c})[_0xf880('0x25')](function(_0x44ef53){var _0x2962a8=_['map'](_0x505173[_0xf880('0x2b')],function(_0x483a94){delete _0x483a94['id'];_0x483a94['CustomReportId']=_0x505173[_0xf880('0x4c')]['id'];return _0x483a94;});return db[_0xf880('0x30')]['bulkCreate'](_0x2962a8,{'transaction':_0x1fc69c});});})['then'](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x505173[_0xf880('0x4c')]['id']}});});}})['then'](respondWithResult(_0x5da767,null))['catch'](handleError(_0x5da767,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index ac2e5b2..7834735 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 _0x6ffe=['analytics_report_fields','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','define'];(function(_0x3c2dc3,_0x9b07ad){var _0x24da57=function(_0x4a5b55){while(--_0x4a5b55){_0x3c2dc3['push'](_0x3c2dc3['shift']());}};_0x24da57(++_0x9b07ad);}(_0x6ffe,0x1ae));var _0xe6ff=function(_0x3a23f1,_0x401962){_0x3a23f1=_0x3a23f1-0x0;var _0x484219=_0x6ffe[_0x3a23f1];return _0x484219;};'use strict';var _=require(_0xe6ff('0x0'));var util=require('util');var logger=require(_0xe6ff('0x1'))(_0xe6ff('0x2'));var moment=require(_0xe6ff('0x3'));var BPromise=require('bluebird');var rp=require(_0xe6ff('0x4'));var fs=require('fs');var path=require(_0xe6ff('0x5'));var rimraf=require(_0xe6ff('0x6'));var config=require(_0xe6ff('0x7'));var attributes=require(_0xe6ff('0x8'));module['exports']=function(_0x374ae2,_0x54665c){return _0x374ae2[_0xe6ff('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0xe6ff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5cc=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe5cc,0x166));var _0xce5c=function(_0x18083e,_0x1979fb){_0x18083e=_0x18083e-0x0;var _0xdfd586=_0xe5cc[_0x18083e];return _0xdfd586;};'use strict';var _=require(_0xce5c('0x0'));var util=require(_0xce5c('0x1'));var logger=require(_0xce5c('0x2'))(_0xce5c('0x3'));var moment=require('moment');var BPromise=require(_0xce5c('0x4'));var rp=require(_0xce5c('0x5'));var fs=require('fs');var path=require(_0xce5c('0x6'));var rimraf=require('rimraf');var config=require(_0xce5c('0x7'));var attributes=require(_0xce5c('0x8'));module['exports']=function(_0x4534c2,_0x11c462){return _0x4534c2[_0xce5c('0x9')](_0xce5c('0xa'),attributes,{'tableName':_0xce5c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 97a4ad9..13619f9 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 _0xb39f=['info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x40a05a,_0x5e9093){var _0x2f133c=function(_0x211af8){while(--_0x211af8){_0x40a05a['push'](_0x40a05a['shift']());}};_0x2f133c(++_0x5e9093);}(_0xb39f,0x13e));var _0xfb39=function(_0x6ee26,_0x34df23){_0x6ee26=_0x6ee26-0x0;var _0x119a3d=_0xb39f[_0x6ee26];return _0x119a3d;};'use strict';var _=require('lodash');var util=require(_0xfb39('0x0'));var moment=require(_0xfb39('0x1'));var BPromise=require('bluebird');var rs=require(_0xfb39('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb39('0x3'))['db'];var utils=require(_0xfb39('0x4'));var logger=require(_0xfb39('0x5'))(_0xfb39('0x6'));var config=require(_0xfb39('0x7'));var jayson=require(_0xfb39('0x8'));var client=jayson[_0xfb39('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfbdef2,_0x52af4d,_0x3aa832){return new BPromise(function(_0x47728c,_0xc15cd8){return client[_0xfb39('0xa')](_0xfbdef2,_0x3aa832)[_0xfb39('0xb')](function(_0x4a4ae5){logger[_0xfb39('0xc')](_0xfb39('0xd'),_0x52af4d,_0xfb39('0xe'));logger['debug'](_0xfb39('0xf'),_0x52af4d,'request\x20sent',JSON[_0xfb39('0x10')](_0x4a4ae5));if(_0x4a4ae5[_0xfb39('0x11')]){if(_0x4a4ae5['error'][_0xfb39('0x12')]===0x1f4){logger[_0xfb39('0x11')](_0xfb39('0xd'),_0x52af4d,_0x4a4ae5[_0xfb39('0x11')]['message']);return _0xc15cd8(_0x4a4ae5[_0xfb39('0x11')]['message']);}logger[_0xfb39('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x52af4d,_0x4a4ae5['error']['message']);return _0x47728c(_0x4a4ae5[_0xfb39('0x11')][_0xfb39('0x13')]);}else{logger[_0xfb39('0xc')](_0xfb39('0xd'),_0x52af4d,_0xfb39('0xe'));_0x47728c(_0x4a4ae5[_0xfb39('0x14')][_0xfb39('0x13')]);}})[_0xfb39('0x15')](function(_0x2332ef){logger[_0xfb39('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x52af4d,_0x2332ef);_0xc15cd8(_0x2332ef);});});} \ No newline at end of file +var _0x4f57=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f57,0x12b));var _0x74f5=function(_0xdcefa9,_0x7673c0){_0xdcefa9=_0xdcefa9-0x0;var _0x56b223=_0x4f57[_0xdcefa9];return _0x56b223;};'use strict';var _=require('lodash');var util=require(_0x74f5('0x0'));var moment=require(_0x74f5('0x1'));var BPromise=require(_0x74f5('0x2'));var rs=require(_0x74f5('0x3'));var fs=require('fs');var Redis=require(_0x74f5('0x4'));var db=require(_0x74f5('0x5'))['db'];var utils=require(_0x74f5('0x6'));var logger=require(_0x74f5('0x7'))(_0x74f5('0x8'));var config=require(_0x74f5('0x9'));var jayson=require(_0x74f5('0xa'));var client=jayson[_0x74f5('0xb')][_0x74f5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1655a4,_0x544a6a,_0x4d68ea){return new BPromise(function(_0x3ac57d,_0x4d7d11){return client[_0x74f5('0xd')](_0x1655a4,_0x4d68ea)[_0x74f5('0xe')](function(_0x42771d){logger[_0x74f5('0xf')](_0x74f5('0x10'),_0x544a6a,'request\x20sent');logger[_0x74f5('0x11')](_0x74f5('0x12'),_0x544a6a,_0x74f5('0x13'),JSON['stringify'](_0x42771d));if(_0x42771d[_0x74f5('0x14')]){if(_0x42771d[_0x74f5('0x14')][_0x74f5('0x15')]===0x1f4){logger[_0x74f5('0x14')](_0x74f5('0x10'),_0x544a6a,_0x42771d[_0x74f5('0x14')][_0x74f5('0x16')]);return _0x4d7d11(_0x42771d[_0x74f5('0x14')][_0x74f5('0x16')]);}logger[_0x74f5('0x14')](_0x74f5('0x10'),_0x544a6a,_0x42771d[_0x74f5('0x14')]['message']);return _0x3ac57d(_0x42771d['error'][_0x74f5('0x16')]);}else{logger[_0x74f5('0xf')](_0x74f5('0x10'),_0x544a6a,_0x74f5('0x13'));_0x3ac57d(_0x42771d[_0x74f5('0x17')][_0x74f5('0x16')]);}})[_0x74f5('0x18')](function(_0x5d532d){logger[_0x74f5('0x14')](_0x74f5('0x10'),_0x544a6a,_0x5d532d);_0x4d7d11(_0x5d532d);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index e7fbd42..27f09c0 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 _0xb012=['isAuthenticated','index','/:id','show','post','create','/create_many','/:id/create_many','addFields','put','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x2c69ac,_0x158a07){var _0x5cc03f=function(_0x3f570e){while(--_0x3f570e){_0x2c69ac['push'](_0x2c69ac['shift']());}};_0x5cc03f(++_0x158a07);}(_0xb012,0x92));var _0x2b01=function(_0x2df2d7,_0x55820d){_0x2df2d7=_0x2df2d7-0x0;var _0x5d3e56=_0xb012[_0x2df2d7];return _0x5d3e56;};'use strict';var multer=require(_0x2b01('0x0'));var util=require(_0x2b01('0x1'));var path=require(_0x2b01('0x2'));var timeout=require(_0x2b01('0x3'));var express=require(_0x2b01('0x4'));var router=express[_0x2b01('0x5')]();var fs_extra=require(_0x2b01('0x6'));var auth=require(_0x2b01('0x7'));var interaction=require(_0x2b01('0x8'));var config=require('../../config/environment');var controller=require('./analyticFieldReport.controller');router[_0x2b01('0x9')]('/',auth[_0x2b01('0xa')](),controller[_0x2b01('0xb')]);router[_0x2b01('0x9')](_0x2b01('0xc'),auth['isAuthenticated'](),controller[_0x2b01('0xd')]);router[_0x2b01('0xe')]('/',auth[_0x2b01('0xa')](),controller[_0x2b01('0xf')]);router[_0x2b01('0xe')](_0x2b01('0x10'),auth[_0x2b01('0xa')](),controller['bulkCreate']);router['post'](_0x2b01('0x11'),auth[_0x2b01('0xa')](),controller[_0x2b01('0x12')]);router[_0x2b01('0x13')](_0x2b01('0xc'),auth[_0x2b01('0xa')](),controller[_0x2b01('0x14')]);router[_0x2b01('0x15')](_0x2b01('0x16'),auth[_0x2b01('0xa')](),controller[_0x2b01('0x17')]);router[_0x2b01('0x15')](_0x2b01('0xc'),auth[_0x2b01('0xa')](),controller[_0x2b01('0x18')]);module[_0x2b01('0x19')]=router; \ No newline at end of file +var _0x0271=['bulkDestroy','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','/create_many','/:id/create_many','put','/:id','delete','/destroy_many'];(function(_0x467a1a,_0x163b60){var _0x23c960=function(_0x13b65f){while(--_0x13b65f){_0x467a1a['push'](_0x467a1a['shift']());}};_0x23c960(++_0x163b60);}(_0x0271,0x1bc));var _0x1027=function(_0x4ae611,_0x16970d){_0x4ae611=_0x4ae611-0x0;var _0x540126=_0x0271[_0x4ae611];return _0x540126;};'use strict';var multer=require('multer');var util=require(_0x1027('0x0'));var path=require(_0x1027('0x1'));var timeout=require(_0x1027('0x2'));var express=require('express');var router=express[_0x1027('0x3')]();var fs_extra=require(_0x1027('0x4'));var auth=require(_0x1027('0x5'));var interaction=require(_0x1027('0x6'));var config=require(_0x1027('0x7'));var controller=require('./analyticFieldReport.controller');router[_0x1027('0x8')]('/',auth[_0x1027('0x9')](),controller[_0x1027('0xa')]);router[_0x1027('0x8')]('/:id',auth[_0x1027('0x9')](),controller['show']);router[_0x1027('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1027('0xb')](_0x1027('0xc'),auth[_0x1027('0x9')](),controller['bulkCreate']);router[_0x1027('0xb')](_0x1027('0xd'),auth['isAuthenticated'](),controller['addFields']);router[_0x1027('0xe')](_0x1027('0xf'),auth[_0x1027('0x9')](),controller['update']);router[_0x1027('0x10')](_0x1027('0x11'),auth['isAuthenticated'](),controller[_0x1027('0x12')]);router[_0x1027('0x10')](_0x1027('0xf'),auth[_0x1027('0x9')](),controller[_0x1027('0x13')]);module[_0x1027('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index bce4d87..0f08c8d 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 _0xf482=['sequelize','exports','STRING','name','TEXT'];(function(_0x4dac82,_0x462395){var _0x105272=function(_0x4d427f){while(--_0x4d427f){_0x4dac82['push'](_0x4dac82['shift']());}};_0x105272(++_0x462395);}(_0xf482,0xf0));var _0x2f48=function(_0x4c7e05,_0x831fc2){_0x4c7e05=_0x4c7e05-0x0;var _0x334cb2=_0xf482[_0x4c7e05];return _0x334cb2;};'use strict';var Sequelize=require(_0x2f48('0x0'));module[_0x2f48('0x1')]={'name':{'type':Sequelize[_0x2f48('0x2')],'allowNull':![],'unique':_0x2f48('0x3')},'table':{'type':Sequelize[_0x2f48('0x2')]},'metric':{'type':Sequelize[_0x2f48('0x4')]},'description':{'type':Sequelize[_0x2f48('0x2')]}}; \ No newline at end of file +var _0xb79a=['name','STRING','TEXT','sequelize','exports'];(function(_0x546821,_0x3f4194){var _0x156655=function(_0x12576b){while(--_0x12576b){_0x546821['push'](_0x546821['shift']());}};_0x156655(++_0x3f4194);}(_0xb79a,0x18e));var _0xab79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb79a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xab79('0x0'));module[_0xab79('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xab79('0x2')},'table':{'type':Sequelize[_0xab79('0x3')]},'metric':{'type':Sequelize[_0xab79('0x4')]},'description':{'type':Sequelize[_0xab79('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 3433bf7..b0eb428 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 _0x48d0=['account','index','AnalyticMetric','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','show','include','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','apply','update','then','Metrics','UserProfileResource','destroy','status','name','send','render','merge','body','message','agent'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x48d0,0xd3));var _0x048d=function(_0x1b8039,_0x5e3d9c){_0x1b8039=_0x1b8039-0x0;var _0x2bb4cc=_0x48d0[_0x1b8039];return _0x2bb4cc;};'use strict';var emlformat=require(_0x048d('0x0'));var rimraf=require(_0x048d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x048d('0x2'));var rp=require(_0x048d('0x3'));var moment=require(_0x048d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x048d('0x5'));var util=require(_0x048d('0x6'));var path=require('path');var sox=require(_0x048d('0x7'));var csv=require(_0x048d('0x8'));var ejs=require(_0x048d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x048d('0xa'));var squel=require(_0x048d('0xb'));var crypto=require('crypto');var jsforce=require(_0x048d('0xc'));var deskjs=require(_0x048d('0xd'));var toCsv=require(_0x048d('0x8'));var querystring=require(_0x048d('0xe'));var Papa=require(_0x048d('0xf'));var Redis=require(_0x048d('0x10'));var authService=require(_0x048d('0x11'));var qs=require(_0x048d('0x12'));var as=require(_0x048d('0x13'));var hardwareService=require(_0x048d('0x14'));var logger=require(_0x048d('0x15'))(_0x048d('0x16'));var utils=require('../../config/utils');var config=require(_0x048d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x048d('0x18'))['db'];function respondWithStatusCode(_0x240804,_0x1e535c){_0x1e535c=_0x1e535c||0xcc;return function(_0x5e6f72){if(_0x5e6f72){return _0x240804[_0x048d('0x19')](_0x1e535c);}return _0x240804['status'](_0x1e535c)[_0x048d('0x1a')]();};}function respondWithResult(_0x459864,_0x553b00){_0x553b00=_0x553b00||0xc8;return function(_0xaaa80a){if(_0xaaa80a){return _0x459864['status'](_0x553b00)[_0x048d('0x1b')](_0xaaa80a);}};}function respondWithFilteredResult(_0x245e10,_0x193154){return function(_0x183444){if(_0x183444){var _0x175572=typeof _0x193154[_0x048d('0x1c')]===_0x048d('0x1d')&&typeof _0x193154['limit']===_0x048d('0x1d');var _0xef2f1c=_0x183444[_0x048d('0x1e')];var _0x5371ec=_0x175572?0x0:_0x193154[_0x048d('0x1c')];var _0x47bb61=_0x175572?_0x183444['count']:_0x193154[_0x048d('0x1c')]+_0x193154[_0x048d('0x1f')];var _0x34408a;if(_0x47bb61>=_0xef2f1c){_0x47bb61=_0xef2f1c;_0x34408a=0xc8;}else{_0x34408a=0xce;}_0x245e10['status'](_0x34408a);return _0x245e10[_0x048d('0x20')]('Content-Range',_0x5371ec+'-'+_0x47bb61+'/'+_0xef2f1c)[_0x048d('0x1b')](_0x183444);}return null;};}function patchUpdates(_0x5a6b35){return function(_0x4b1d3e){try{jsonpatch[_0x048d('0x21')](_0x4b1d3e,_0x5a6b35,!![]);}catch(_0x499ba9){return BPromise['reject'](_0x499ba9);}return _0x4b1d3e['save']();};}function saveUpdates(_0x44df55,_0x221863){return function(_0x113b7b){if(_0x113b7b){return _0x113b7b[_0x048d('0x22')](_0x44df55)[_0x048d('0x23')](function(_0x144123){return _0x144123;});}return null;};}function removeEntity(_0x4b6dca,_0x5cced5){return function(_0x22fd5b){if(_0x22fd5b){return _0x22fd5b['destroy']()['then'](function(){var _0x21c485=_0x22fd5b['get']({'plain':!![]});var _0x480266=_0x048d('0x24');return db[_0x048d('0x25')][_0x048d('0x26')]({'where':{'type':_0x480266,'resourceId':_0x21c485['id']}})[_0x048d('0x23')](function(){return _0x22fd5b;});})[_0x048d('0x23')](function(){_0x4b6dca[_0x048d('0x27')](0xcc)[_0x048d('0x1a')]();});}};}function handleEntityNotFound(_0xe0cdce,_0x118a43){return function(_0x37538d){if(!_0x37538d){_0xe0cdce[_0x048d('0x19')](0x194);}return _0x37538d;};}function handleError(_0x4f9253,_0x46e3a7){_0x46e3a7=_0x46e3a7||0x1f4;return function(_0x4682db){logger['error'](_0x4682db['stack']);if(_0x4682db['name']){delete _0x4682db[_0x048d('0x28')];}_0x4f9253['status'](_0x46e3a7)[_0x048d('0x29')](_0x4682db);};}function getMustacheRender(_0x43e2d1,_0x35acaa){return Mustache[_0x048d('0x2a')](_0x43e2d1,_[_0x048d('0x2b')](_0x35acaa[_0x048d('0x2c')],{'contact':_0x35acaa['contact'],'message':_0x35acaa[_0x048d('0x2d')],'agent':_0x35acaa[_0x048d('0x2e')],'interaction':_0x35acaa['interaction'],'account':_0x35acaa[_0x048d('0x2f')]}))||'';}exports[_0x048d('0x30')]=function(_0x87e456,_0x2cbb6a){var _0x1ab0d1={},_0x15b7d2={},_0xc98c7b={'count':0x0,'rows':[]};var _0x1fb94e=_['map'](db[_0x048d('0x31')][_0x048d('0x32')],function(_0x1e86f7){return{'name':_0x1e86f7['fieldName'],'type':_0x1e86f7[_0x048d('0x33')][_0x048d('0x34')]};});_0x15b7d2[_0x048d('0x35')]=_[_0x048d('0x36')](_0x1fb94e,_0x048d('0x28'));_0x15b7d2[_0x048d('0x37')]=_[_0x048d('0x38')](_0x87e456[_0x048d('0x37')]);_0x15b7d2[_0x048d('0x39')]=_[_0x048d('0x3a')](_0x15b7d2['model'],_0x15b7d2[_0x048d('0x37')]);_0x1ab0d1['attributes']=_['intersection'](_0x15b7d2['model'],qs[_0x048d('0x3b')](_0x87e456[_0x048d('0x37')][_0x048d('0x3b')]));_0x1ab0d1[_0x048d('0x3c')]=_0x1ab0d1[_0x048d('0x3c')][_0x048d('0x3d')]?_0x1ab0d1[_0x048d('0x3c')]:_0x15b7d2[_0x048d('0x35')];if(!_0x87e456['query']['hasOwnProperty'](_0x048d('0x3e'))){_0x1ab0d1['limit']=qs['limit'](_0x87e456[_0x048d('0x37')][_0x048d('0x1f')]);_0x1ab0d1[_0x048d('0x1c')]=qs[_0x048d('0x1c')](_0x87e456[_0x048d('0x37')][_0x048d('0x1c')]);}_0x1ab0d1[_0x048d('0x3f')]=qs[_0x048d('0x40')](_0x87e456['query']['sort']);_0x1ab0d1[_0x048d('0x41')]=qs[_0x048d('0x39')](_[_0x048d('0x42')](_0x87e456['query'],_0x15b7d2[_0x048d('0x39')]),_0x1fb94e);if(_0x87e456[_0x048d('0x37')][_0x048d('0x43')]){_0x1ab0d1[_0x048d('0x41')]=_[_0x048d('0x2b')](_0x1ab0d1[_0x048d('0x41')],{'$or':_[_0x048d('0x36')](_0x1fb94e,function(_0x6695d){if(_0x6695d[_0x048d('0x33')]!==_0x048d('0x44')){var _0xdeb3aa={};_0xdeb3aa[_0x6695d[_0x048d('0x28')]]={'$like':'%'+_0x87e456[_0x048d('0x37')][_0x048d('0x43')]+'%'};return _0xdeb3aa;}})});}_0x1ab0d1=_[_0x048d('0x2b')]({},_0x1ab0d1,_0x87e456['options']);var _0x20754e={'where':_0x1ab0d1[_0x048d('0x41')]};return db[_0x048d('0x31')][_0x048d('0x1e')](_0x20754e)[_0x048d('0x23')](function(_0x14d015){_0xc98c7b[_0x048d('0x1e')]=_0x14d015;if(_0x87e456[_0x048d('0x37')][_0x048d('0x45')]){_0x1ab0d1['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0x048d('0x46')](_0x1ab0d1);})[_0x048d('0x23')](function(_0x375792){_0xc98c7b[_0x048d('0x47')]=_0x375792;return _0xc98c7b;})[_0x048d('0x23')](respondWithFilteredResult(_0x2cbb6a,_0x1ab0d1))[_0x048d('0x48')](handleError(_0x2cbb6a,null));};exports[_0x048d('0x49')]=function(_0x95c6f7,_0x2ae513){var _0x369f0b={'raw':!![],'where':{'id':_0x95c6f7['params']['id']}},_0x2b6d54={};_0x2b6d54[_0x048d('0x35')]=_[_0x048d('0x38')](db[_0x048d('0x31')]['rawAttributes']);_0x2b6d54[_0x048d('0x37')]=_['keys'](_0x95c6f7[_0x048d('0x37')]);_0x2b6d54['filters']=_[_0x048d('0x3a')](_0x2b6d54[_0x048d('0x35')],_0x2b6d54[_0x048d('0x37')]);_0x369f0b[_0x048d('0x3c')]=_[_0x048d('0x3a')](_0x2b6d54[_0x048d('0x35')],qs[_0x048d('0x3b')](_0x95c6f7[_0x048d('0x37')]['fields']));_0x369f0b['attributes']=_0x369f0b[_0x048d('0x3c')][_0x048d('0x3d')]?_0x369f0b['attributes']:_0x2b6d54['model'];if(_0x95c6f7['query']['includeAll']){_0x369f0b[_0x048d('0x4a')]=[{'all':!![]}];}_0x369f0b=_[_0x048d('0x2b')]({},_0x369f0b,_0x95c6f7[_0x048d('0x4b')]);return db[_0x048d('0x31')]['find'](_0x369f0b)['then'](handleEntityNotFound(_0x2ae513,null))[_0x048d('0x23')](respondWithResult(_0x2ae513,null))['catch'](handleError(_0x2ae513,null));};exports[_0x048d('0x4c')]=function(_0x315a24,_0x1f0062){return db[_0x048d('0x31')]['create'](_0x315a24[_0x048d('0x2c')],{})['then'](function(_0x18ec00){var _0x33c1ac=_0x315a24[_0x048d('0x4d')]['get']({'plain':!![]});if(!_0x33c1ac)throw new Error(_0x048d('0x4e'));if(_0x33c1ac[_0x048d('0x4f')]===_0x048d('0x4d')){var _0x429b67=_0x18ec00[_0x048d('0x50')]({'plain':!![]});var _0x4879d7=_0x048d('0x24');return db[_0x048d('0x51')][_0x048d('0x52')]({'where':{'name':_0x4879d7,'userProfileId':_0x33c1ac[_0x048d('0x53')]},'raw':!![]})[_0x048d('0x23')](function(_0x3241c8){if(_0x3241c8&&_0x3241c8[_0x048d('0x54')]===0x0){return db['UserProfileResource'][_0x048d('0x4c')]({'name':_0x429b67[_0x048d('0x28')],'resourceId':_0x429b67['id'],'type':_0x3241c8[_0x048d('0x28')],'sectionId':_0x3241c8['id']},{})[_0x048d('0x23')](function(){return _0x18ec00;});}else{return _0x18ec00;}})['catch'](function(_0x49aeb4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49aeb4);throw _0x49aeb4;});}return _0x18ec00;})['then'](respondWithResult(_0x1f0062,0xc9))[_0x048d('0x48')](handleError(_0x1f0062,null));};exports[_0x048d('0x22')]=function(_0x398b16,_0x43ff6d){if(_0x398b16['body']['id']){delete _0x398b16[_0x048d('0x2c')]['id'];}return db['AnalyticMetric'][_0x048d('0x52')]({'where':{'id':_0x398b16[_0x048d('0x55')]['id']}})[_0x048d('0x23')](handleEntityNotFound(_0x43ff6d,null))[_0x048d('0x23')](saveUpdates(_0x398b16['body'],null))[_0x048d('0x23')](respondWithResult(_0x43ff6d,null))[_0x048d('0x48')](handleError(_0x43ff6d,null));};exports['destroy']=function(_0x4c32d6,_0x222ef8){return db[_0x048d('0x31')]['find']({'where':{'id':_0x4c32d6['params']['id']}})[_0x048d('0x23')](handleEntityNotFound(_0x222ef8,null))[_0x048d('0x23')](removeEntity(_0x222ef8,null))[_0x048d('0x48')](handleError(_0x222ef8,null));}; \ No newline at end of file +var _0xf021=['crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','limit','reject','save','update','then','Metrics','end','error','stack','send','render','merge','body','contact','message','agent','account','rawAttributes','type','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','options','count','includeAll','include','AnalyticMetric','findAll','catch','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','squel'];(function(_0x1fed62,_0x226377){var _0x17a4b3=function(_0x5df534){while(--_0x5df534){_0x1fed62['push'](_0x1fed62['shift']());}};_0x17a4b3(++_0x226377);}(_0xf021,0x18f));var _0x1f02=function(_0x305a6e,_0x1f4a40){_0x305a6e=_0x305a6e-0x0;var _0xd23128=_0xf021[_0x305a6e];return _0xd23128;};'use strict';var emlformat=require(_0x1f02('0x0'));var rimraf=require(_0x1f02('0x1'));var zipdir=require(_0x1f02('0x2'));var jsonpatch=require(_0x1f02('0x3'));var rp=require(_0x1f02('0x4'));var moment=require('moment');var BPromise=require(_0x1f02('0x5'));var Mustache=require('mustache');var util=require(_0x1f02('0x6'));var path=require(_0x1f02('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1f02('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f02('0x9'));var squel=require(_0x1f02('0xa'));var crypto=require(_0x1f02('0xb'));var jsforce=require(_0x1f02('0xc'));var deskjs=require(_0x1f02('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1f02('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1f02('0xf'));var as=require(_0x1f02('0x10'));var hardwareService=require(_0x1f02('0x11'));var logger=require(_0x1f02('0x12'))(_0x1f02('0x13'));var utils=require('../../config/utils');var config=require(_0x1f02('0x14'));var licenseUtil=require(_0x1f02('0x15'));var db=require(_0x1f02('0x16'))['db'];function respondWithStatusCode(_0x56a2c2,_0x24e9b8){_0x24e9b8=_0x24e9b8||0xcc;return function(_0x1ac6eb){if(_0x1ac6eb){return _0x56a2c2[_0x1f02('0x17')](_0x24e9b8);}return _0x56a2c2['status'](_0x24e9b8)['end']();};}function respondWithResult(_0x4974bd,_0x11ba7e){_0x11ba7e=_0x11ba7e||0xc8;return function(_0x2c08ad){if(_0x2c08ad){return _0x4974bd[_0x1f02('0x18')](_0x11ba7e)[_0x1f02('0x19')](_0x2c08ad);}};}function respondWithFilteredResult(_0x1c16ce,_0x45bae1){return function(_0x440328){if(_0x440328){var _0x3b0a3d=typeof _0x45bae1['offset']===_0x1f02('0x1a')&&typeof _0x45bae1['limit']==='undefined';var _0x4a66a5=_0x440328['count'];var _0x4d1e4f=_0x3b0a3d?0x0:_0x45bae1[_0x1f02('0x1b')];var _0x3033a2=_0x3b0a3d?_0x440328['count']:_0x45bae1[_0x1f02('0x1b')]+_0x45bae1[_0x1f02('0x1c')];var _0x356444;if(_0x3033a2>=_0x4a66a5){_0x3033a2=_0x4a66a5;_0x356444=0xc8;}else{_0x356444=0xce;}_0x1c16ce[_0x1f02('0x18')](_0x356444);return _0x1c16ce['set']('Content-Range',_0x4d1e4f+'-'+_0x3033a2+'/'+_0x4a66a5)[_0x1f02('0x19')](_0x440328);}return null;};}function patchUpdates(_0x37393a){return function(_0x5e78c2){try{jsonpatch['apply'](_0x5e78c2,_0x37393a,!![]);}catch(_0x339c29){return BPromise[_0x1f02('0x1d')](_0x339c29);}return _0x5e78c2[_0x1f02('0x1e')]();};}function saveUpdates(_0xbabbd7,_0x480297){return function(_0x12c4af){if(_0x12c4af){return _0x12c4af[_0x1f02('0x1f')](_0xbabbd7)[_0x1f02('0x20')](function(_0x2f422c){return _0x2f422c;});}return null;};}function removeEntity(_0x43b3e7,_0x134398){return function(_0x1328ea){if(_0x1328ea){return _0x1328ea['destroy']()[_0x1f02('0x20')](function(){var _0x3a8c57=_0x1328ea['get']({'plain':!![]});var _0x25a8d1=_0x1f02('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x25a8d1,'resourceId':_0x3a8c57['id']}})[_0x1f02('0x20')](function(){return _0x1328ea;});})[_0x1f02('0x20')](function(){_0x43b3e7[_0x1f02('0x18')](0xcc)[_0x1f02('0x22')]();});}};}function handleEntityNotFound(_0x3f5c5e,_0x3f5577){return function(_0x297cf4){if(!_0x297cf4){_0x3f5c5e['sendStatus'](0x194);}return _0x297cf4;};}function handleError(_0x4d5f7e,_0x4e04f2){_0x4e04f2=_0x4e04f2||0x1f4;return function(_0x3ef4bf){logger[_0x1f02('0x23')](_0x3ef4bf[_0x1f02('0x24')]);if(_0x3ef4bf['name']){delete _0x3ef4bf['name'];}_0x4d5f7e[_0x1f02('0x18')](_0x4e04f2)[_0x1f02('0x25')](_0x3ef4bf);};}function getMustacheRender(_0x1605cf,_0x433a1e){return Mustache[_0x1f02('0x26')](_0x1605cf,_[_0x1f02('0x27')](_0x433a1e[_0x1f02('0x28')],{'contact':_0x433a1e[_0x1f02('0x29')],'message':_0x433a1e[_0x1f02('0x2a')],'agent':_0x433a1e[_0x1f02('0x2b')],'interaction':_0x433a1e['interaction'],'account':_0x433a1e[_0x1f02('0x2c')]}))||'';}exports['index']=function(_0xa61d8f,_0x3b3b57){var _0x8a3f1e={},_0x2bf78e={},_0x28a572={'count':0x0,'rows':[]};var _0x194c85=_['map'](db['AnalyticMetric'][_0x1f02('0x2d')],function(_0x15e655){return{'name':_0x15e655['fieldName'],'type':_0x15e655[_0x1f02('0x2e')]['key']};});_0x2bf78e[_0x1f02('0x2f')]=_['map'](_0x194c85,_0x1f02('0x30'));_0x2bf78e['query']=_['keys'](_0xa61d8f[_0x1f02('0x31')]);_0x2bf78e[_0x1f02('0x32')]=_[_0x1f02('0x33')](_0x2bf78e[_0x1f02('0x2f')],_0x2bf78e['query']);_0x8a3f1e[_0x1f02('0x34')]=_[_0x1f02('0x33')](_0x2bf78e[_0x1f02('0x2f')],qs['fields'](_0xa61d8f[_0x1f02('0x31')][_0x1f02('0x35')]));_0x8a3f1e[_0x1f02('0x34')]=_0x8a3f1e[_0x1f02('0x34')][_0x1f02('0x36')]?_0x8a3f1e[_0x1f02('0x34')]:_0x2bf78e['model'];if(!_0xa61d8f[_0x1f02('0x31')][_0x1f02('0x37')](_0x1f02('0x38'))){_0x8a3f1e['limit']=qs[_0x1f02('0x1c')](_0xa61d8f['query'][_0x1f02('0x1c')]);_0x8a3f1e['offset']=qs['offset'](_0xa61d8f[_0x1f02('0x31')]['offset']);}_0x8a3f1e['order']=qs[_0x1f02('0x39')](_0xa61d8f[_0x1f02('0x31')][_0x1f02('0x39')]);_0x8a3f1e[_0x1f02('0x3a')]=qs['filters'](_[_0x1f02('0x3b')](_0xa61d8f['query'],_0x2bf78e[_0x1f02('0x32')]),_0x194c85);if(_0xa61d8f[_0x1f02('0x31')][_0x1f02('0x3c')]){_0x8a3f1e[_0x1f02('0x3a')]=_[_0x1f02('0x27')](_0x8a3f1e[_0x1f02('0x3a')],{'$or':_[_0x1f02('0x3d')](_0x194c85,function(_0xffa05b){if(_0xffa05b[_0x1f02('0x2e')]!=='VIRTUAL'){var _0x31ca4d={};_0x31ca4d[_0xffa05b['name']]={'$like':'%'+_0xa61d8f[_0x1f02('0x31')]['filter']+'%'};return _0x31ca4d;}})});}_0x8a3f1e=_[_0x1f02('0x27')]({},_0x8a3f1e,_0xa61d8f[_0x1f02('0x3e')]);var _0x1c7182={'where':_0x8a3f1e['where']};return db['AnalyticMetric'][_0x1f02('0x3f')](_0x1c7182)[_0x1f02('0x20')](function(_0x37d6b5){_0x28a572[_0x1f02('0x3f')]=_0x37d6b5;if(_0xa61d8f[_0x1f02('0x31')][_0x1f02('0x40')]){_0x8a3f1e[_0x1f02('0x41')]=[{'all':!![]}];}return db[_0x1f02('0x42')][_0x1f02('0x43')](_0x8a3f1e);})['then'](function(_0x3202d8){_0x28a572['rows']=_0x3202d8;return _0x28a572;})['then'](respondWithFilteredResult(_0x3b3b57,_0x8a3f1e))[_0x1f02('0x44')](handleError(_0x3b3b57,null));};exports['show']=function(_0x584d9c,_0xe61000){var _0x55ad2b={'raw':!![],'where':{'id':_0x584d9c[_0x1f02('0x45')]['id']}},_0x4be37b={};_0x4be37b[_0x1f02('0x2f')]=_['keys'](db[_0x1f02('0x42')][_0x1f02('0x2d')]);_0x4be37b[_0x1f02('0x31')]=_[_0x1f02('0x46')](_0x584d9c['query']);_0x4be37b[_0x1f02('0x32')]=_[_0x1f02('0x33')](_0x4be37b[_0x1f02('0x2f')],_0x4be37b[_0x1f02('0x31')]);_0x55ad2b[_0x1f02('0x34')]=_[_0x1f02('0x33')](_0x4be37b[_0x1f02('0x2f')],qs[_0x1f02('0x35')](_0x584d9c[_0x1f02('0x31')][_0x1f02('0x35')]));_0x55ad2b[_0x1f02('0x34')]=_0x55ad2b[_0x1f02('0x34')][_0x1f02('0x36')]?_0x55ad2b[_0x1f02('0x34')]:_0x4be37b['model'];if(_0x584d9c[_0x1f02('0x31')]['includeAll']){_0x55ad2b[_0x1f02('0x41')]=[{'all':!![]}];}_0x55ad2b=_['merge']({},_0x55ad2b,_0x584d9c[_0x1f02('0x3e')]);return db[_0x1f02('0x42')][_0x1f02('0x47')](_0x55ad2b)[_0x1f02('0x20')](handleEntityNotFound(_0xe61000,null))[_0x1f02('0x20')](respondWithResult(_0xe61000,null))[_0x1f02('0x44')](handleError(_0xe61000,null));};exports[_0x1f02('0x48')]=function(_0x2178b2,_0x8eae3){return db[_0x1f02('0x42')][_0x1f02('0x48')](_0x2178b2['body'],{})[_0x1f02('0x20')](function(_0x297957){var _0x3f3e7c=_0x2178b2[_0x1f02('0x49')][_0x1f02('0x4a')]({'plain':!![]});if(!_0x3f3e7c)throw new Error(_0x1f02('0x4b'));if(_0x3f3e7c[_0x1f02('0x4c')]===_0x1f02('0x49')){var _0x15cd89=_0x297957['get']({'plain':!![]});var _0xa0b579=_0x1f02('0x21');return db[_0x1f02('0x4d')][_0x1f02('0x47')]({'where':{'name':_0xa0b579,'userProfileId':_0x3f3e7c[_0x1f02('0x4e')]},'raw':!![]})['then'](function(_0x12c1fb){if(_0x12c1fb&&_0x12c1fb['autoAssociation']===0x0){return db[_0x1f02('0x4f')][_0x1f02('0x48')]({'name':_0x15cd89[_0x1f02('0x30')],'resourceId':_0x15cd89['id'],'type':_0x12c1fb[_0x1f02('0x30')],'sectionId':_0x12c1fb['id']},{})[_0x1f02('0x20')](function(){return _0x297957;});}else{return _0x297957;}})[_0x1f02('0x44')](function(_0x41b024){logger[_0x1f02('0x23')](_0x1f02('0x50'),_0x41b024);throw _0x41b024;});}return _0x297957;})[_0x1f02('0x20')](respondWithResult(_0x8eae3,0xc9))['catch'](handleError(_0x8eae3,null));};exports['update']=function(_0x4d084c,_0x39dbee){if(_0x4d084c['body']['id']){delete _0x4d084c[_0x1f02('0x28')]['id'];}return db[_0x1f02('0x42')]['find']({'where':{'id':_0x4d084c[_0x1f02('0x45')]['id']}})['then'](handleEntityNotFound(_0x39dbee,null))['then'](saveUpdates(_0x4d084c['body'],null))[_0x1f02('0x20')](respondWithResult(_0x39dbee,null))[_0x1f02('0x44')](handleError(_0x39dbee,null));};exports[_0x1f02('0x51')]=function(_0x390df6,_0xbb603){return db[_0x1f02('0x42')]['find']({'where':{'id':_0x390df6[_0x1f02('0x45')]['id']}})[_0x1f02('0x20')](handleEntityNotFound(_0xbb603,null))['then'](removeEntity(_0xbb603,null))['catch'](handleError(_0xbb603,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index be5e1c4..ccd7c8a 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 _0xdb76=['../../config/environment','./analyticMetric.attributes','AnalyticMetric','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2a3b3e,_0x415238){var _0x3bb5f6=function(_0x26a88a){while(--_0x26a88a){_0x2a3b3e['push'](_0x2a3b3e['shift']());}};_0x3bb5f6(++_0x415238);}(_0xdb76,0x1dc));var _0x6db7=function(_0x8bdf2d,_0x454cab){_0x8bdf2d=_0x8bdf2d-0x0;var _0x5d7f1f=_0xdb76[_0x8bdf2d];return _0x5d7f1f;};'use strict';var _=require(_0x6db7('0x0'));var util=require(_0x6db7('0x1'));var logger=require(_0x6db7('0x2'))('api');var moment=require(_0x6db7('0x3'));var BPromise=require(_0x6db7('0x4'));var rp=require(_0x6db7('0x5'));var fs=require('fs');var path=require(_0x6db7('0x6'));var rimraf=require(_0x6db7('0x7'));var config=require(_0x6db7('0x8'));var attributes=require(_0x6db7('0x9'));module['exports']=function(_0x562cb6,_0x541b51){return _0x562cb6['define'](_0x6db7('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce36=['path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0xf26d40,_0x2f4f46){var _0x50b68c=function(_0x10aa58){while(--_0x10aa58){_0xf26d40['push'](_0xf26d40['shift']());}};_0x50b68c(++_0x2f4f46);}(_0xce36,0x96));var _0x6ce3=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0xce36[_0x291d3f];return _0x242080;};'use strict';var _=require(_0x6ce3('0x0'));var util=require(_0x6ce3('0x1'));var logger=require(_0x6ce3('0x2'))('api');var moment=require(_0x6ce3('0x3'));var BPromise=require(_0x6ce3('0x4'));var rp=require(_0x6ce3('0x5'));var fs=require('fs');var path=require(_0x6ce3('0x6'));var rimraf=require(_0x6ce3('0x7'));var config=require(_0x6ce3('0x8'));var attributes=require(_0x6ce3('0x9'));module[_0x6ce3('0xa')]=function(_0x4a6dc9,_0x56e17b){return _0x4a6dc9[_0x6ce3('0xb')]('AnalyticMetric',attributes,{'tableName':_0x6ce3('0xc'),'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 2f0c3b5..600b3da 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 _0xe8e7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xe8e7,0x131));var _0x7e8e=function(_0x2c7bd4,_0x2072eb){_0x2c7bd4=_0x2c7bd4-0x0;var _0x57e657=_0xe8e7[_0x2c7bd4];return _0x57e657;};'use strict';var _=require(_0x7e8e('0x0'));var util=require(_0x7e8e('0x1'));var moment=require(_0x7e8e('0x2'));var BPromise=require(_0x7e8e('0x3'));var rs=require(_0x7e8e('0x4'));var fs=require('fs');var Redis=require(_0x7e8e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e8e('0x6'));var logger=require(_0x7e8e('0x7'))(_0x7e8e('0x8'));var config=require(_0x7e8e('0x9'));var jayson=require(_0x7e8e('0xa'));var client=jayson[_0x7e8e('0xb')][_0x7e8e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15e582,_0x22be34,_0x39bc0c){return new BPromise(function(_0xb511f3,_0x3df578){return client[_0x7e8e('0xd')](_0x15e582,_0x39bc0c)[_0x7e8e('0xe')](function(_0x3be5db){logger[_0x7e8e('0xf')](_0x7e8e('0x10'),_0x22be34,_0x7e8e('0x11'));logger['debug'](_0x7e8e('0x12'),_0x22be34,'request\x20sent',JSON[_0x7e8e('0x13')](_0x3be5db));if(_0x3be5db[_0x7e8e('0x14')]){if(_0x3be5db[_0x7e8e('0x14')]['code']===0x1f4){logger[_0x7e8e('0x14')](_0x7e8e('0x10'),_0x22be34,_0x3be5db[_0x7e8e('0x14')][_0x7e8e('0x15')]);return _0x3df578(_0x3be5db[_0x7e8e('0x14')][_0x7e8e('0x15')]);}logger[_0x7e8e('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x22be34,_0x3be5db[_0x7e8e('0x14')]['message']);return _0xb511f3(_0x3be5db['error'][_0x7e8e('0x15')]);}else{logger['info'](_0x7e8e('0x10'),_0x22be34,'request\x20sent');_0xb511f3(_0x3be5db[_0x7e8e('0x16')]['message']);}})[_0x7e8e('0x17')](function(_0xb887b8){logger[_0x7e8e('0x14')](_0x7e8e('0x10'),_0x22be34,_0xb887b8);_0x3df578(_0xb887b8);});});} \ No newline at end of file +var _0xe4ca=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x53385d,_0x2fa75d){var _0x2a6624=function(_0x5d1eb5){while(--_0x5d1eb5){_0x53385d['push'](_0x53385d['shift']());}};_0x2a6624(++_0x2fa75d);}(_0xe4ca,0x79));var _0xae4c=function(_0x4bf5f6,_0x44e324){_0x4bf5f6=_0x4bf5f6-0x0;var _0x21c97e=_0xe4ca[_0x4bf5f6];return _0x21c97e;};'use strict';var _=require(_0xae4c('0x0'));var util=require(_0xae4c('0x1'));var moment=require(_0xae4c('0x2'));var BPromise=require(_0xae4c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae4c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xae4c('0x5'));var logger=require(_0xae4c('0x6'))('rpc');var config=require(_0xae4c('0x7'));var jayson=require(_0xae4c('0x8'));var client=jayson[_0xae4c('0x9')][_0xae4c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x260781,_0x611435,_0x48ab36){return new BPromise(function(_0x58a14d,_0x34d06d){return client[_0xae4c('0xb')](_0x260781,_0x48ab36)[_0xae4c('0xc')](function(_0x5d78e8){logger[_0xae4c('0xd')](_0xae4c('0xe'),_0x611435,_0xae4c('0xf'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x611435,'request\x20sent',JSON[_0xae4c('0x10')](_0x5d78e8));if(_0x5d78e8['error']){if(_0x5d78e8[_0xae4c('0x11')][_0xae4c('0x12')]===0x1f4){logger[_0xae4c('0x11')](_0xae4c('0xe'),_0x611435,_0x5d78e8['error']['message']);return _0x34d06d(_0x5d78e8['error'][_0xae4c('0x13')]);}logger[_0xae4c('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x611435,_0x5d78e8[_0xae4c('0x11')][_0xae4c('0x13')]);return _0x58a14d(_0x5d78e8[_0xae4c('0x11')][_0xae4c('0x13')]);}else{logger[_0xae4c('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x611435,_0xae4c('0xf'));_0x58a14d(_0x5d78e8[_0xae4c('0x14')]['message']);}})['catch'](function(_0x487b6a){logger[_0xae4c('0x11')](_0xae4c('0xe'),_0x611435,_0x487b6a);_0x34d06d(_0x487b6a);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 6cd164e..30d8352 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 _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x40433a,_0x2c9bd9){var _0x41d7f4=function(_0x359a2c){while(--_0x359a2c){_0x40433a['push'](_0x40433a['shift']());}};_0x41d7f4(++_0x2c9bd9);}(_0xda3f,0xec));var _0xfda3=function(_0x47e0ac,_0x317e54){_0x47e0ac=_0x47e0ac-0x0;var _0x430680=_0xda3f[_0x47e0ac];return _0x430680;};'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('./analyticMetric.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file +var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x5a2436,_0x11375a){var _0x2d8468=function(_0x5b77b9){while(--_0x5b77b9){_0x5a2436['push'](_0x5a2436['shift']());}};_0x2d8468(++_0x11375a);}(_0xda3f,0xec));var _0xfda3=function(_0xeb4909,_0xe3946a){_0xeb4909=_0xeb4909-0x0;var _0x4b9835=_0xda3f[_0xeb4909];return _0x4b9835;};'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('./analyticMetric.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 8d96696..5d25491 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 _0x10af=['TEXT','sequelize','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x10af,0x73));var _0xf10a=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x10af[_0x1ae5ab];return _0x1ce001;};'use strict';var Sequelize=require(_0xf10a('0x0'));module[_0xf10a('0x1')]={'tree':{'type':Sequelize[_0xf10a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5cd8=['exports','TEXT'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x5cd8,0xf4));var _0x85cd=function(_0x5517c7,_0x14e9ba){_0x5517c7=_0x5517c7-0x0;var _0x13832d=_0x5cd8[_0x5517c7];return _0x13832d;};'use strict';var Sequelize=require('sequelize');module[_0x85cd('0x0')]={'tree':{'type':Sequelize[_0x85cd('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 59f478d..eda27d0 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 _0xc8d5=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','map','includeAll','include','findAll','rows','catch','options','find','create','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','merge','body','message','agent','interaction','account','index','AnalyticTreeReport','rawAttributes','type','model'];(function(_0x20a416,_0x4ec77e){var _0x35c938=function(_0x65206e){while(--_0x65206e){_0x20a416['push'](_0x20a416['shift']());}};_0x35c938(++_0x4ec77e);}(_0xc8d5,0xb4));var _0x5c8d=function(_0x3a620c,_0x29e955){_0x3a620c=_0x3a620c-0x0;var _0x5082dd=_0xc8d5[_0x3a620c];return _0x5082dd;};'use strict';var emlformat=require(_0x5c8d('0x0'));var rimraf=require(_0x5c8d('0x1'));var zipdir=require(_0x5c8d('0x2'));var jsonpatch=require(_0x5c8d('0x3'));var rp=require(_0x5c8d('0x4'));var moment=require(_0x5c8d('0x5'));var BPromise=require(_0x5c8d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5c8d('0x7'));var csv=require(_0x5c8d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c8d('0x9'));var _=require(_0x5c8d('0xa'));var squel=require('squel');var crypto=require(_0x5c8d('0xb'));var jsforce=require(_0x5c8d('0xc'));var deskjs=require(_0x5c8d('0xd'));var toCsv=require(_0x5c8d('0x8'));var querystring=require(_0x5c8d('0xe'));var Papa=require('papaparse');var Redis=require(_0x5c8d('0xf'));var authService=require(_0x5c8d('0x10'));var qs=require(_0x5c8d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c8d('0x12'));var logger=require(_0x5c8d('0x13'))(_0x5c8d('0x14'));var utils=require(_0x5c8d('0x15'));var config=require(_0x5c8d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c8d('0x17'))['db'];function respondWithStatusCode(_0x26fa34,_0x317dab){_0x317dab=_0x317dab||0xcc;return function(_0x120897){if(_0x120897){return _0x26fa34[_0x5c8d('0x18')](_0x317dab);}return _0x26fa34[_0x5c8d('0x19')](_0x317dab)[_0x5c8d('0x1a')]();};}function respondWithResult(_0x1faf50,_0x294700){_0x294700=_0x294700||0xc8;return function(_0x387bae){if(_0x387bae){return _0x1faf50[_0x5c8d('0x19')](_0x294700)[_0x5c8d('0x1b')](_0x387bae);}};}function respondWithFilteredResult(_0x4fd3af,_0xd522da){return function(_0x4975f3){if(_0x4975f3){var _0x25ae8=typeof _0xd522da[_0x5c8d('0x1c')]===_0x5c8d('0x1d')&&typeof _0xd522da['limit']===_0x5c8d('0x1d');var _0x5f0002=_0x4975f3[_0x5c8d('0x1e')];var _0x5e0a0b=_0x25ae8?0x0:_0xd522da['offset'];var _0x34b62e=_0x25ae8?_0x4975f3[_0x5c8d('0x1e')]:_0xd522da['offset']+_0xd522da['limit'];var _0x541f30;if(_0x34b62e>=_0x5f0002){_0x34b62e=_0x5f0002;_0x541f30=0xc8;}else{_0x541f30=0xce;}_0x4fd3af['status'](_0x541f30);return _0x4fd3af[_0x5c8d('0x1f')](_0x5c8d('0x20'),_0x5e0a0b+'-'+_0x34b62e+'/'+_0x5f0002)[_0x5c8d('0x1b')](_0x4975f3);}return null;};}function patchUpdates(_0x50fd0f){return function(_0x23354f){try{jsonpatch[_0x5c8d('0x21')](_0x23354f,_0x50fd0f,!![]);}catch(_0x3b0542){return BPromise[_0x5c8d('0x22')](_0x3b0542);}return _0x23354f[_0x5c8d('0x23')]();};}function saveUpdates(_0x30b900,_0x5478da){return function(_0x3a0160){if(_0x3a0160){return _0x3a0160[_0x5c8d('0x24')](_0x30b900)[_0x5c8d('0x25')](function(_0x379be4){return _0x379be4;});}return null;};}function removeEntity(_0x109774,_0x12700c){return function(_0x60a7c9){if(_0x60a7c9){return _0x60a7c9[_0x5c8d('0x26')]()[_0x5c8d('0x25')](function(){_0x109774[_0x5c8d('0x19')](0xcc)[_0x5c8d('0x1a')]();});}};}function handleEntityNotFound(_0x1efbb1,_0x405beb){return function(_0x3a24a2){if(!_0x3a24a2){_0x1efbb1['sendStatus'](0x194);}return _0x3a24a2;};}function handleError(_0x310caa,_0x4c3d72){_0x4c3d72=_0x4c3d72||0x1f4;return function(_0x192e11){logger[_0x5c8d('0x27')](_0x192e11[_0x5c8d('0x28')]);if(_0x192e11[_0x5c8d('0x29')]){delete _0x192e11[_0x5c8d('0x29')];}_0x310caa[_0x5c8d('0x19')](_0x4c3d72)[_0x5c8d('0x2a')](_0x192e11);};}function getMustacheRender(_0x59dfbd,_0x4e4e1b){return Mustache['render'](_0x59dfbd,_[_0x5c8d('0x2b')](_0x4e4e1b[_0x5c8d('0x2c')],{'contact':_0x4e4e1b['contact'],'message':_0x4e4e1b[_0x5c8d('0x2d')],'agent':_0x4e4e1b[_0x5c8d('0x2e')],'interaction':_0x4e4e1b[_0x5c8d('0x2f')],'account':_0x4e4e1b[_0x5c8d('0x30')]}))||'';}exports[_0x5c8d('0x31')]=function(_0x22601,_0xf25637){var _0x3a6041={},_0x2fead7={},_0x429bf7={'count':0x0,'rows':[]};var _0x3fbf43=_['map'](db[_0x5c8d('0x32')][_0x5c8d('0x33')],function(_0x4fccc6){return{'name':_0x4fccc6['fieldName'],'type':_0x4fccc6[_0x5c8d('0x34')]['key']};});_0x2fead7[_0x5c8d('0x35')]=_['map'](_0x3fbf43,'name');_0x2fead7[_0x5c8d('0x36')]=_[_0x5c8d('0x37')](_0x22601[_0x5c8d('0x36')]);_0x2fead7[_0x5c8d('0x38')]=_[_0x5c8d('0x39')](_0x2fead7['model'],_0x2fead7[_0x5c8d('0x36')]);_0x3a6041[_0x5c8d('0x3a')]=_[_0x5c8d('0x39')](_0x2fead7[_0x5c8d('0x35')],qs[_0x5c8d('0x3b')](_0x22601[_0x5c8d('0x36')][_0x5c8d('0x3b')]));_0x3a6041[_0x5c8d('0x3a')]=_0x3a6041[_0x5c8d('0x3a')][_0x5c8d('0x3c')]?_0x3a6041[_0x5c8d('0x3a')]:_0x2fead7[_0x5c8d('0x35')];if(!_0x22601[_0x5c8d('0x36')][_0x5c8d('0x3d')]('nolimit')){_0x3a6041[_0x5c8d('0x3e')]=qs[_0x5c8d('0x3e')](_0x22601[_0x5c8d('0x36')][_0x5c8d('0x3e')]);_0x3a6041[_0x5c8d('0x1c')]=qs[_0x5c8d('0x1c')](_0x22601[_0x5c8d('0x36')][_0x5c8d('0x1c')]);}_0x3a6041[_0x5c8d('0x3f')]=qs[_0x5c8d('0x40')](_0x22601[_0x5c8d('0x36')]['sort']);_0x3a6041[_0x5c8d('0x41')]=qs[_0x5c8d('0x38')](_[_0x5c8d('0x42')](_0x22601['query'],_0x2fead7[_0x5c8d('0x38')]),_0x3fbf43);if(_0x22601[_0x5c8d('0x36')][_0x5c8d('0x43')]){_0x3a6041[_0x5c8d('0x41')]=_[_0x5c8d('0x2b')](_0x3a6041['where'],{'$or':_[_0x5c8d('0x44')](_0x3fbf43,function(_0x3ac615){if(_0x3ac615[_0x5c8d('0x34')]!=='VIRTUAL'){var _0x4acc50={};_0x4acc50[_0x3ac615[_0x5c8d('0x29')]]={'$like':'%'+_0x22601[_0x5c8d('0x36')][_0x5c8d('0x43')]+'%'};return _0x4acc50;}})});}_0x3a6041=_['merge']({},_0x3a6041,_0x22601['options']);var _0x12aad2={'where':_0x3a6041[_0x5c8d('0x41')]};return db[_0x5c8d('0x32')][_0x5c8d('0x1e')](_0x12aad2)[_0x5c8d('0x25')](function(_0x1cca7c){_0x429bf7['count']=_0x1cca7c;if(_0x22601['query'][_0x5c8d('0x45')]){_0x3a6041[_0x5c8d('0x46')]=[{'all':!![]}];}return db[_0x5c8d('0x32')][_0x5c8d('0x47')](_0x3a6041);})[_0x5c8d('0x25')](function(_0x27b22d){_0x429bf7[_0x5c8d('0x48')]=_0x27b22d;return _0x429bf7;})[_0x5c8d('0x25')](respondWithFilteredResult(_0xf25637,_0x3a6041))[_0x5c8d('0x49')](handleError(_0xf25637,null));};exports['show']=function(_0x9bba45,_0x3d5b31){var _0x522f25={'raw':!![],'where':{'id':_0x9bba45['params']['id']}},_0x256a98={};_0x256a98[_0x5c8d('0x35')]=_['keys'](db['AnalyticTreeReport'][_0x5c8d('0x33')]);_0x256a98['query']=_[_0x5c8d('0x37')](_0x9bba45[_0x5c8d('0x36')]);_0x256a98[_0x5c8d('0x38')]=_[_0x5c8d('0x39')](_0x256a98[_0x5c8d('0x35')],_0x256a98[_0x5c8d('0x36')]);_0x522f25[_0x5c8d('0x3a')]=_[_0x5c8d('0x39')](_0x256a98['model'],qs['fields'](_0x9bba45[_0x5c8d('0x36')][_0x5c8d('0x3b')]));_0x522f25[_0x5c8d('0x3a')]=_0x522f25[_0x5c8d('0x3a')][_0x5c8d('0x3c')]?_0x522f25['attributes']:_0x256a98['model'];if(_0x9bba45[_0x5c8d('0x36')]['includeAll']){_0x522f25['include']=[{'all':!![]}];}_0x522f25=_['merge']({},_0x522f25,_0x9bba45[_0x5c8d('0x4a')]);return db[_0x5c8d('0x32')][_0x5c8d('0x4b')](_0x522f25)['then'](handleEntityNotFound(_0x3d5b31,null))[_0x5c8d('0x25')](respondWithResult(_0x3d5b31,null))['catch'](handleError(_0x3d5b31,null));};exports['create']=function(_0x312bab,_0x417a0e){return db[_0x5c8d('0x32')][_0x5c8d('0x4c')](_0x312bab[_0x5c8d('0x2c')],{})[_0x5c8d('0x25')](respondWithResult(_0x417a0e,0xc9))[_0x5c8d('0x49')](handleError(_0x417a0e,null));};exports['update']=function(_0x4ebca4,_0x4c0fb6){if(_0x4ebca4[_0x5c8d('0x2c')]['id']){delete _0x4ebca4[_0x5c8d('0x2c')]['id'];}return db['AnalyticTreeReport'][_0x5c8d('0x4b')]({'where':{'id':_0x4ebca4['params']['id']}})[_0x5c8d('0x25')](handleEntityNotFound(_0x4c0fb6,null))[_0x5c8d('0x25')](saveUpdates(_0x4ebca4['body'],null))['then'](respondWithResult(_0x4c0fb6,null))['catch'](handleError(_0x4c0fb6,null));};exports[_0x5c8d('0x26')]=function(_0xaca84,_0x29b5ff){return db[_0x5c8d('0x32')][_0x5c8d('0x4b')]({'where':{'id':_0xaca84[_0x5c8d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x29b5ff,null))[_0x5c8d('0x25')](removeEntity(_0x29b5ff,null))['catch'](handleError(_0x29b5ff,null));}; \ No newline at end of file +var _0xb612=['length','hasOwnProperty','nolimit','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','include','create','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','render','body','contact','message','agent','interaction','account','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xb612,0x1a7));var _0x2b61=function(_0x5eb442,_0xe2ae2e){_0x5eb442=_0x5eb442-0x0;var _0x53aad0=_0xb612[_0x5eb442];return _0x53aad0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b61('0x0'));var zipdir=require(_0x2b61('0x1'));var jsonpatch=require(_0x2b61('0x2'));var rp=require(_0x2b61('0x3'));var moment=require(_0x2b61('0x4'));var BPromise=require(_0x2b61('0x5'));var Mustache=require(_0x2b61('0x6'));var util=require(_0x2b61('0x7'));var path=require(_0x2b61('0x8'));var sox=require('sox');var csv=require(_0x2b61('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b61('0xa'));var _=require(_0x2b61('0xb'));var squel=require(_0x2b61('0xc'));var crypto=require(_0x2b61('0xd'));var jsforce=require(_0x2b61('0xe'));var deskjs=require(_0x2b61('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2b61('0x10'));var Papa=require(_0x2b61('0x11'));var Redis=require(_0x2b61('0x12'));var authService=require(_0x2b61('0x13'));var qs=require(_0x2b61('0x14'));var as=require(_0x2b61('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b61('0x16'))('api');var utils=require(_0x2b61('0x17'));var config=require(_0x2b61('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b61('0x19'))['db'];function respondWithStatusCode(_0x532b91,_0xc4f55b){_0xc4f55b=_0xc4f55b||0xcc;return function(_0x298b8f){if(_0x298b8f){return _0x532b91[_0x2b61('0x1a')](_0xc4f55b);}return _0x532b91[_0x2b61('0x1b')](_0xc4f55b)['end']();};}function respondWithResult(_0x1190b5,_0x33d8ef){_0x33d8ef=_0x33d8ef||0xc8;return function(_0x550b5a){if(_0x550b5a){return _0x1190b5[_0x2b61('0x1b')](_0x33d8ef)[_0x2b61('0x1c')](_0x550b5a);}};}function respondWithFilteredResult(_0x45e460,_0xd11119){return function(_0xd6d128){if(_0xd6d128){var _0x3a3a58=typeof _0xd11119[_0x2b61('0x1d')]==='undefined'&&typeof _0xd11119[_0x2b61('0x1e')]===_0x2b61('0x1f');var _0x56c9c8=_0xd6d128[_0x2b61('0x20')];var _0x2263a0=_0x3a3a58?0x0:_0xd11119[_0x2b61('0x1d')];var _0x4de149=_0x3a3a58?_0xd6d128[_0x2b61('0x20')]:_0xd11119[_0x2b61('0x1d')]+_0xd11119[_0x2b61('0x1e')];var _0x2df3f4;if(_0x4de149>=_0x56c9c8){_0x4de149=_0x56c9c8;_0x2df3f4=0xc8;}else{_0x2df3f4=0xce;}_0x45e460[_0x2b61('0x1b')](_0x2df3f4);return _0x45e460[_0x2b61('0x21')](_0x2b61('0x22'),_0x2263a0+'-'+_0x4de149+'/'+_0x56c9c8)['json'](_0xd6d128);}return null;};}function patchUpdates(_0x51a94b){return function(_0x49875b){try{jsonpatch[_0x2b61('0x23')](_0x49875b,_0x51a94b,!![]);}catch(_0x3bd8ae){return BPromise[_0x2b61('0x24')](_0x3bd8ae);}return _0x49875b[_0x2b61('0x25')]();};}function saveUpdates(_0x1a9e63,_0x3dd5e5){return function(_0x10b7b8){if(_0x10b7b8){return _0x10b7b8[_0x2b61('0x26')](_0x1a9e63)[_0x2b61('0x27')](function(_0x424c05){return _0x424c05;});}return null;};}function removeEntity(_0x6a20eb,_0x10f270){return function(_0x91d695){if(_0x91d695){return _0x91d695['destroy']()['then'](function(){_0x6a20eb[_0x2b61('0x1b')](0xcc)[_0x2b61('0x28')]();});}};}function handleEntityNotFound(_0x13bff7,_0x143294){return function(_0xdf8345){if(!_0xdf8345){_0x13bff7['sendStatus'](0x194);}return _0xdf8345;};}function handleError(_0x2d843d,_0x37729a){_0x37729a=_0x37729a||0x1f4;return function(_0x11c8d4){logger['error'](_0x11c8d4[_0x2b61('0x29')]);if(_0x11c8d4[_0x2b61('0x2a')]){delete _0x11c8d4[_0x2b61('0x2a')];}_0x2d843d['status'](_0x37729a)[_0x2b61('0x2b')](_0x11c8d4);};}function getMustacheRender(_0x33fe5c,_0x43a317){return Mustache[_0x2b61('0x2c')](_0x33fe5c,_['merge'](_0x43a317[_0x2b61('0x2d')],{'contact':_0x43a317[_0x2b61('0x2e')],'message':_0x43a317[_0x2b61('0x2f')],'agent':_0x43a317[_0x2b61('0x30')],'interaction':_0x43a317[_0x2b61('0x31')],'account':_0x43a317[_0x2b61('0x32')]}))||'';}exports['index']=function(_0x190b0f,_0x5900c5){var _0x17ed56={},_0x555d9b={},_0x4823e1={'count':0x0,'rows':[]};var _0x1fef16=_[_0x2b61('0x33')](db[_0x2b61('0x34')][_0x2b61('0x35')],function(_0x432765){return{'name':_0x432765[_0x2b61('0x36')],'type':_0x432765[_0x2b61('0x37')][_0x2b61('0x38')]};});_0x555d9b[_0x2b61('0x39')]=_[_0x2b61('0x33')](_0x1fef16,_0x2b61('0x2a'));_0x555d9b[_0x2b61('0x3a')]=_[_0x2b61('0x3b')](_0x190b0f['query']);_0x555d9b['filters']=_[_0x2b61('0x3c')](_0x555d9b['model'],_0x555d9b[_0x2b61('0x3a')]);_0x17ed56['attributes']=_['intersection'](_0x555d9b[_0x2b61('0x39')],qs['fields'](_0x190b0f[_0x2b61('0x3a')][_0x2b61('0x3d')]));_0x17ed56[_0x2b61('0x3e')]=_0x17ed56[_0x2b61('0x3e')][_0x2b61('0x3f')]?_0x17ed56[_0x2b61('0x3e')]:_0x555d9b['model'];if(!_0x190b0f[_0x2b61('0x3a')][_0x2b61('0x40')](_0x2b61('0x41'))){_0x17ed56[_0x2b61('0x1e')]=qs[_0x2b61('0x1e')](_0x190b0f[_0x2b61('0x3a')][_0x2b61('0x1e')]);_0x17ed56['offset']=qs[_0x2b61('0x1d')](_0x190b0f[_0x2b61('0x3a')][_0x2b61('0x1d')]);}_0x17ed56['order']=qs[_0x2b61('0x42')](_0x190b0f[_0x2b61('0x3a')]['sort']);_0x17ed56['where']=qs['filters'](_['pick'](_0x190b0f[_0x2b61('0x3a')],_0x555d9b[_0x2b61('0x43')]),_0x1fef16);if(_0x190b0f['query'][_0x2b61('0x44')]){_0x17ed56[_0x2b61('0x45')]=_['merge'](_0x17ed56['where'],{'$or':_[_0x2b61('0x33')](_0x1fef16,function(_0x3ecaf0){if(_0x3ecaf0['type']!==_0x2b61('0x46')){var _0x325c2a={};_0x325c2a[_0x3ecaf0['name']]={'$like':'%'+_0x190b0f[_0x2b61('0x3a')][_0x2b61('0x44')]+'%'};return _0x325c2a;}})});}_0x17ed56=_[_0x2b61('0x47')]({},_0x17ed56,_0x190b0f[_0x2b61('0x48')]);var _0x288149={'where':_0x17ed56[_0x2b61('0x45')]};return db[_0x2b61('0x34')][_0x2b61('0x20')](_0x288149)['then'](function(_0x468e52){_0x4823e1[_0x2b61('0x20')]=_0x468e52;if(_0x190b0f['query'][_0x2b61('0x49')]){_0x17ed56['include']=[{'all':!![]}];}return db[_0x2b61('0x34')][_0x2b61('0x4a')](_0x17ed56);})[_0x2b61('0x27')](function(_0x27b197){_0x4823e1[_0x2b61('0x4b')]=_0x27b197;return _0x4823e1;})[_0x2b61('0x27')](respondWithFilteredResult(_0x5900c5,_0x17ed56))[_0x2b61('0x4c')](handleError(_0x5900c5,null));};exports['show']=function(_0x1ee809,_0x3f65a9){var _0x431bbb={'raw':!![],'where':{'id':_0x1ee809['params']['id']}},_0xfc56a2={};_0xfc56a2[_0x2b61('0x39')]=_[_0x2b61('0x3b')](db['AnalyticTreeReport']['rawAttributes']);_0xfc56a2[_0x2b61('0x3a')]=_[_0x2b61('0x3b')](_0x1ee809[_0x2b61('0x3a')]);_0xfc56a2[_0x2b61('0x43')]=_[_0x2b61('0x3c')](_0xfc56a2[_0x2b61('0x39')],_0xfc56a2[_0x2b61('0x3a')]);_0x431bbb[_0x2b61('0x3e')]=_['intersection'](_0xfc56a2[_0x2b61('0x39')],qs[_0x2b61('0x3d')](_0x1ee809[_0x2b61('0x3a')][_0x2b61('0x3d')]));_0x431bbb[_0x2b61('0x3e')]=_0x431bbb['attributes']['length']?_0x431bbb['attributes']:_0xfc56a2[_0x2b61('0x39')];if(_0x1ee809[_0x2b61('0x3a')][_0x2b61('0x49')]){_0x431bbb[_0x2b61('0x4d')]=[{'all':!![]}];}_0x431bbb=_[_0x2b61('0x47')]({},_0x431bbb,_0x1ee809[_0x2b61('0x48')]);return db[_0x2b61('0x34')]['find'](_0x431bbb)[_0x2b61('0x27')](handleEntityNotFound(_0x3f65a9,null))[_0x2b61('0x27')](respondWithResult(_0x3f65a9,null))[_0x2b61('0x4c')](handleError(_0x3f65a9,null));};exports['create']=function(_0x5344a7,_0x4e2b3f){return db['AnalyticTreeReport'][_0x2b61('0x4e')](_0x5344a7['body'],{})[_0x2b61('0x27')](respondWithResult(_0x4e2b3f,0xc9))[_0x2b61('0x4c')](handleError(_0x4e2b3f,null));};exports[_0x2b61('0x26')]=function(_0x168911,_0x527fa7){if(_0x168911[_0x2b61('0x2d')]['id']){delete _0x168911[_0x2b61('0x2d')]['id'];}return db[_0x2b61('0x34')]['find']({'where':{'id':_0x168911[_0x2b61('0x4f')]['id']}})[_0x2b61('0x27')](handleEntityNotFound(_0x527fa7,null))[_0x2b61('0x27')](saveUpdates(_0x168911[_0x2b61('0x2d')],null))['then'](respondWithResult(_0x527fa7,null))['catch'](handleError(_0x527fa7,null));};exports[_0x2b61('0x50')]=function(_0xe62f97,_0x4edb5f){return db[_0x2b61('0x34')]['find']({'where':{'id':_0xe62f97[_0x2b61('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4edb5f,null))[_0x2b61('0x27')](removeEntity(_0x4edb5f,null))[_0x2b61('0x4c')](handleError(_0x4edb5f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 53e1b36..97cb70c 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 _0x00b3=['bluebird','path','rimraf','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment'];(function(_0x4b771d,_0x46e8fd){var _0x19e284=function(_0x478b25){while(--_0x478b25){_0x4b771d['push'](_0x4b771d['shift']());}};_0x19e284(++_0x46e8fd);}(_0x00b3,0x157));var _0x300b=function(_0x45e9a6,_0x4e6df6){_0x45e9a6=_0x45e9a6-0x0;var _0x4bed6d=_0x00b3[_0x45e9a6];return _0x4bed6d;};'use strict';var _=require(_0x300b('0x0'));var util=require(_0x300b('0x1'));var logger=require(_0x300b('0x2'))(_0x300b('0x3'));var moment=require(_0x300b('0x4'));var BPromise=require(_0x300b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x300b('0x6'));var rimraf=require(_0x300b('0x7'));var config=require('../../config/environment');var attributes=require(_0x300b('0x8'));module['exports']=function(_0x2bd6ef,_0x345454){return _0x2bd6ef[_0x300b('0x9')](_0x300b('0xa'),attributes,{'tableName':_0x300b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2515=['rimraf','../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','api','moment','bluebird','request-promise'];(function(_0x20c397,_0x88b803){var _0xf414db=function(_0x291557){while(--_0x291557){_0x20c397['push'](_0x20c397['shift']());}};_0xf414db(++_0x88b803);}(_0x2515,0x1c2));var _0x5251=function(_0x9b89c1,_0x2a7e4f){_0x9b89c1=_0x9b89c1-0x0;var _0xf547ae=_0x2515[_0x9b89c1];return _0xf547ae;};'use strict';var _=require(_0x5251('0x0'));var util=require(_0x5251('0x1'));var logger=require('../../config/logger')(_0x5251('0x2'));var moment=require(_0x5251('0x3'));var BPromise=require(_0x5251('0x4'));var rp=require(_0x5251('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5251('0x6'));var config=require(_0x5251('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0x5251('0x8')]=function(_0xa2b768,_0x228dcd){return _0xa2b768[_0x5251('0x9')](_0x5251('0xa'),attributes,{'tableName':_0x5251('0xb'),'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 05fb649..74b8caa 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 _0x642d=['AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','debug'];(function(_0x15a70f,_0x4684ac){var _0x33c8f5=function(_0x346195){while(--_0x346195){_0x15a70f['push'](_0x15a70f['shift']());}};_0x33c8f5(++_0x4684ac);}(_0x642d,0x9a));var _0xd642=function(_0x5f368c,_0x29e639){_0x5f368c=_0x5f368c-0x0;var _0x3496e9=_0x642d[_0x5f368c];return _0x3496e9;};'use strict';var _=require(_0xd642('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd642('0x1'));var rs=require(_0xd642('0x2'));var fs=require('fs');var Redis=require(_0xd642('0x3'));var db=require(_0xd642('0x4'))['db'];var utils=require(_0xd642('0x5'));var logger=require('../../config/logger')(_0xd642('0x6'));var config=require(_0xd642('0x7'));var jayson=require(_0xd642('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ac41b,_0x5e5b30,_0x481a92){return new BPromise(function(_0x197c6a,_0x46ceb2){return client[_0xd642('0x9')](_0x4ac41b,_0x481a92)[_0xd642('0xa')](function(_0x5816c5){logger[_0xd642('0xb')](_0xd642('0xc'),_0x5e5b30,'request\x20sent');logger[_0xd642('0xd')](_0xd642('0xe'),_0x5e5b30,'request\x20sent',JSON[_0xd642('0xf')](_0x5816c5));if(_0x5816c5[_0xd642('0x10')]){if(_0x5816c5[_0xd642('0x10')]['code']===0x1f4){logger[_0xd642('0x10')](_0xd642('0xc'),_0x5e5b30,_0x5816c5[_0xd642('0x10')][_0xd642('0x11')]);return _0x46ceb2(_0x5816c5[_0xd642('0x10')][_0xd642('0x11')]);}logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x5e5b30,_0x5816c5[_0xd642('0x10')][_0xd642('0x11')]);return _0x197c6a(_0x5816c5[_0xd642('0x10')][_0xd642('0x11')]);}else{logger[_0xd642('0xb')](_0xd642('0xc'),_0x5e5b30,_0xd642('0x12'));_0x197c6a(_0x5816c5[_0xd642('0x13')]['message']);}})[_0xd642('0x14')](function(_0xe17547){logger[_0xd642('0x10')](_0xd642('0xc'),_0x5e5b30,_0xe17547);_0x46ceb2(_0xe17547);});});} \ No newline at end of file +var _0x7e77=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e77,0x11d));var _0x77e7=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0x7e77[_0x31991b];return _0x307304;};'use strict';var _=require(_0x77e7('0x0'));var util=require(_0x77e7('0x1'));var moment=require(_0x77e7('0x2'));var BPromise=require(_0x77e7('0x3'));var rs=require(_0x77e7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77e7('0x5'))['db'];var utils=require(_0x77e7('0x6'));var logger=require(_0x77e7('0x7'))('rpc');var config=require(_0x77e7('0x8'));var jayson=require(_0x77e7('0x9'));var client=jayson['client'][_0x77e7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f4a8b,_0x2bcbe6,_0x4808df){return new BPromise(function(_0x29d430,_0x11da39){return client[_0x77e7('0xb')](_0x3f4a8b,_0x4808df)[_0x77e7('0xc')](function(_0x5d408e){logger[_0x77e7('0xd')](_0x77e7('0xe'),_0x2bcbe6,_0x77e7('0xf'));logger[_0x77e7('0x10')](_0x77e7('0x11'),_0x2bcbe6,_0x77e7('0xf'),JSON['stringify'](_0x5d408e));if(_0x5d408e[_0x77e7('0x12')]){if(_0x5d408e[_0x77e7('0x12')]['code']===0x1f4){logger['error'](_0x77e7('0xe'),_0x2bcbe6,_0x5d408e[_0x77e7('0x12')][_0x77e7('0x13')]);return _0x11da39(_0x5d408e['error'][_0x77e7('0x13')]);}logger[_0x77e7('0x12')](_0x77e7('0xe'),_0x2bcbe6,_0x5d408e[_0x77e7('0x12')]['message']);return _0x29d430(_0x5d408e[_0x77e7('0x12')][_0x77e7('0x13')]);}else{logger[_0x77e7('0xd')](_0x77e7('0xe'),_0x2bcbe6,'request\x20sent');_0x29d430(_0x5d408e[_0x77e7('0x14')][_0x77e7('0x13')]);}})[_0x77e7('0x15')](function(_0x23da00){logger[_0x77e7('0x12')](_0x77e7('0xe'),_0x2bcbe6,_0x23da00);_0x11da39(_0x23da00);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index f90ea92..d317443 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 _0xec53=['show','post','isAuthenticated','create','put','/:id','update','delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get'];(function(_0x49c8ab,_0x4f8eb3){var _0x171247=function(_0x5cd244){while(--_0x5cd244){_0x49c8ab['push'](_0x49c8ab['shift']());}};_0x171247(++_0x4f8eb3);}(_0xec53,0x1e6));var _0x3ec5=function(_0x54ebe2,_0xe6b92e){_0x54ebe2=_0x54ebe2-0x0;var _0x337a51=_0xec53[_0x54ebe2];return _0x337a51;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3ec5('0x0'));var timeout=require('connect-timeout');var express=require(_0x3ec5('0x1'));var router=express[_0x3ec5('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3ec5('0x3'));var interaction=require(_0x3ec5('0x4'));var config=require('../../config/environment');var controller=require(_0x3ec5('0x5'));router[_0x3ec5('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3ec5('0x7')]);router[_0x3ec5('0x8')]('/',auth[_0x3ec5('0x9')](),controller[_0x3ec5('0xa')]);router[_0x3ec5('0xb')](_0x3ec5('0xc'),auth['isAuthenticated'](),controller[_0x3ec5('0xd')]);router[_0x3ec5('0xe')]('/:id',auth[_0x3ec5('0x9')](),controller[_0x3ec5('0xf')]);module[_0x3ec5('0x10')]=router; \ No newline at end of file +var _0xf41a=['multer','util','path','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','create','put','update','destroy'];(function(_0x1a9f23,_0x5d3401){var _0x16bf9c=function(_0x5bbd70){while(--_0x5bbd70){_0x1a9f23['push'](_0x1a9f23['shift']());}};_0x16bf9c(++_0x5d3401);}(_0xf41a,0x1d4));var _0xaf41=function(_0x15411f,_0x42bef8){_0x15411f=_0x15411f-0x0;var _0x555650=_0xf41a[_0x15411f];return _0x555650;};'use strict';var multer=require(_0xaf41('0x0'));var util=require(_0xaf41('0x1'));var path=require(_0xaf41('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xaf41('0x3'));var auth=require(_0xaf41('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0xaf41('0x5')]('/',auth['isAuthenticated'](),controller[_0xaf41('0x6')]);router[_0xaf41('0x5')](_0xaf41('0x7'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xaf41('0x8')](),controller[_0xaf41('0x9')]);router[_0xaf41('0xa')](_0xaf41('0x7'),auth[_0xaf41('0x8')](),controller[_0xaf41('0xb')]);router['delete']('/:id',auth[_0xaf41('0x8')](),controller[_0xaf41('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 163e28f..ed8de39 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 _0x7a5d=['exports','STRING'];(function(_0x1daa04,_0x42425f){var _0x1eb284=function(_0x580757){while(--_0x580757){_0x1daa04['push'](_0x1daa04['shift']());}};_0x1eb284(++_0x42425f);}(_0x7a5d,0x100));var _0xd7a5=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x7a5d[_0x24061a];return _0x82054e;};'use strict';var Sequelize=require('sequelize');module[_0xd7a5('0x0')]={'name':{'type':Sequelize[_0xd7a5('0x1')]},'basename':{'type':Sequelize[_0xd7a5('0x1')]},'type':{'type':Sequelize[_0xd7a5('0x1')]}}; \ No newline at end of file +var _0xb7b9=['STRING','exports'];(function(_0x3b87f5,_0x1f79c1){var _0x4c61a1=function(_0x696b7d){while(--_0x696b7d){_0x3b87f5['push'](_0x3b87f5['shift']());}};_0x4c61a1(++_0x1f79c1);}(_0xb7b9,0x105));var _0x9b7b=function(_0x5b1681,_0x344273){_0x5b1681=_0x5b1681-0x0;var _0x41f5ee=_0xb7b9[_0x5b1681];return _0x41f5ee;};'use strict';var Sequelize=require('sequelize');module[_0x9b7b('0x0')]={'name':{'type':Sequelize[_0x9b7b('0x1')]},'basename':{'type':Sequelize[_0x9b7b('0x1')]},'type':{'type':Sequelize[_0x9b7b('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index f7264ab..864c115 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 _0xc18f=['index','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','filter','map','type','VIRTUAL','Attachment','includeAll','include','findAll','rows','catch','show','params','length','options','clone','find','omit','updatedAt','create','file','originalname','basename','filename','mimetype','findOne','root','server/files/attachments/','join','offline-chat/','download','eml-format','zip-dir','bluebird','mustache','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/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','render','merge','body','contact','message','agent','interaction'];(function(_0x115ef0,_0x5a83b2){var _0x420f5a=function(_0x102b2d){while(--_0x102b2d){_0x115ef0['push'](_0x115ef0['shift']());}};_0x420f5a(++_0x5a83b2);}(_0xc18f,0x148));var _0xfc18=function(_0x2ccd33,_0x450bc6){_0x2ccd33=_0x2ccd33-0x0;var _0x3bf83c=_0xc18f[_0x2ccd33];return _0x3bf83c;};'use strict';var emlformat=require(_0xfc18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfc18('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc18('0x2'));var Mustache=require(_0xfc18('0x3'));var util=require(_0xfc18('0x4'));var path=require(_0xfc18('0x5'));var sox=require(_0xfc18('0x6'));var csv=require(_0xfc18('0x7'));var ejs=require(_0xfc18('0x8'));var fs=require('fs');var fs_extra=require(_0xfc18('0x9'));var _=require(_0xfc18('0xa'));var squel=require('squel');var crypto=require(_0xfc18('0xb'));var jsforce=require(_0xfc18('0xc'));var deskjs=require(_0xfc18('0xd'));var toCsv=require(_0xfc18('0x7'));var querystring=require('querystring');var Papa=require(_0xfc18('0xe'));var Redis=require(_0xfc18('0xf'));var authService=require(_0xfc18('0x10'));var qs=require(_0xfc18('0x11'));var as=require(_0xfc18('0x12'));var hardwareService=require(_0xfc18('0x13'));var logger=require(_0xfc18('0x14'))(_0xfc18('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfc18('0x16'));var db=require(_0xfc18('0x17'))['db'];function respondWithStatusCode(_0x5d8869,_0x2c68be){_0x2c68be=_0x2c68be||0xcc;return function(_0x262162){if(_0x262162){return _0x5d8869[_0xfc18('0x18')](_0x2c68be);}return _0x5d8869[_0xfc18('0x19')](_0x2c68be)['end']();};}function respondWithResult(_0x1bf002,_0x3db61a){_0x3db61a=_0x3db61a||0xc8;return function(_0x4ebb6e){if(_0x4ebb6e){return _0x1bf002[_0xfc18('0x19')](_0x3db61a)[_0xfc18('0x1a')](_0x4ebb6e);}};}function respondWithFilteredResult(_0x1050b1,_0x230488){return function(_0x274774){if(_0x274774){var _0xc017ac=typeof _0x230488[_0xfc18('0x1b')]===_0xfc18('0x1c')&&typeof _0x230488[_0xfc18('0x1d')]===_0xfc18('0x1c');var _0x2d471a=_0x274774['count'];var _0x19903d=_0xc017ac?0x0:_0x230488[_0xfc18('0x1b')];var _0x462c2f=_0xc017ac?_0x274774[_0xfc18('0x1e')]:_0x230488[_0xfc18('0x1b')]+_0x230488[_0xfc18('0x1d')];var _0x14b7f3;if(_0x462c2f>=_0x2d471a){_0x462c2f=_0x2d471a;_0x14b7f3=0xc8;}else{_0x14b7f3=0xce;}_0x1050b1[_0xfc18('0x19')](_0x14b7f3);return _0x1050b1[_0xfc18('0x1f')](_0xfc18('0x20'),_0x19903d+'-'+_0x462c2f+'/'+_0x2d471a)[_0xfc18('0x1a')](_0x274774);}return null;};}function patchUpdates(_0x13291a){return function(_0x220abd){try{jsonpatch['apply'](_0x220abd,_0x13291a,!![]);}catch(_0x37150f){return BPromise[_0xfc18('0x21')](_0x37150f);}return _0x220abd['save']();};}function saveUpdates(_0x691c85,_0x192884){return function(_0x1caedb){if(_0x1caedb){return _0x1caedb[_0xfc18('0x22')](_0x691c85)[_0xfc18('0x23')](function(_0x2946b0){return _0x2946b0;});}return null;};}function removeEntity(_0x299a0c,_0x41183d){return function(_0x4145be){if(_0x4145be){return _0x4145be[_0xfc18('0x24')]()['then'](function(){_0x299a0c['status'](0xcc)[_0xfc18('0x25')]();});}};}function handleEntityNotFound(_0xa29ae0,_0x5bd5f9){return function(_0x2634ce){if(!_0x2634ce){_0xa29ae0[_0xfc18('0x18')](0x194);}return _0x2634ce;};}function handleError(_0x2aa0c7,_0x43fb6f){_0x43fb6f=_0x43fb6f||0x1f4;return function(_0x1130f2){logger[_0xfc18('0x26')](_0x1130f2[_0xfc18('0x27')]);if(_0x1130f2[_0xfc18('0x28')]){delete _0x1130f2[_0xfc18('0x28')];}_0x2aa0c7['status'](_0x43fb6f)['send'](_0x1130f2);};}function getMustacheRender(_0x46471b,_0x36514d){return Mustache[_0xfc18('0x29')](_0x46471b,_[_0xfc18('0x2a')](_0x36514d[_0xfc18('0x2b')],{'contact':_0x36514d[_0xfc18('0x2c')],'message':_0x36514d[_0xfc18('0x2d')],'agent':_0x36514d[_0xfc18('0x2e')],'interaction':_0x36514d[_0xfc18('0x2f')],'account':_0x36514d['account']}))||'';}exports[_0xfc18('0x30')]=function(_0x319565,_0x4c5116){var _0x2f7fc4={},_0x30dabb={},_0x47576c={'count':0x0,'rows':[]};var _0x4f7b49=_['map'](db['Attachment'][_0xfc18('0x31')],function(_0x1b650f){return{'name':_0x1b650f[_0xfc18('0x32')],'type':_0x1b650f['type'][_0xfc18('0x33')]};});_0x30dabb[_0xfc18('0x34')]=_['map'](_0x4f7b49,_0xfc18('0x28'));_0x30dabb[_0xfc18('0x35')]=_[_0xfc18('0x36')](_0x319565[_0xfc18('0x35')]);_0x30dabb['filters']=_['intersection'](_0x30dabb[_0xfc18('0x34')],_0x30dabb['query']);_0x2f7fc4[_0xfc18('0x37')]=_[_0xfc18('0x38')](_0x30dabb[_0xfc18('0x34')],qs[_0xfc18('0x39')](_0x319565[_0xfc18('0x35')][_0xfc18('0x39')]));_0x2f7fc4[_0xfc18('0x37')]=_0x2f7fc4[_0xfc18('0x37')]['length']?_0x2f7fc4[_0xfc18('0x37')]:_0x30dabb['model'];if(!_0x319565[_0xfc18('0x35')][_0xfc18('0x3a')]('nolimit')){_0x2f7fc4['limit']=qs['limit'](_0x319565[_0xfc18('0x35')][_0xfc18('0x1d')]);_0x2f7fc4[_0xfc18('0x1b')]=qs['offset'](_0x319565['query'][_0xfc18('0x1b')]);}_0x2f7fc4[_0xfc18('0x3b')]=qs[_0xfc18('0x3c')](_0x319565[_0xfc18('0x35')][_0xfc18('0x3c')]);_0x2f7fc4[_0xfc18('0x3d')]=qs[_0xfc18('0x3e')](_[_0xfc18('0x3f')](_0x319565['query'],_0x30dabb[_0xfc18('0x3e')]),_0x4f7b49);if(_0x319565['query'][_0xfc18('0x40')]){_0x2f7fc4['where']=_[_0xfc18('0x2a')](_0x2f7fc4['where'],{'$or':_[_0xfc18('0x41')](_0x4f7b49,function(_0x23eea3){if(_0x23eea3[_0xfc18('0x42')]!==_0xfc18('0x43')){var _0x2adb01={};_0x2adb01[_0x23eea3[_0xfc18('0x28')]]={'$like':'%'+_0x319565[_0xfc18('0x35')][_0xfc18('0x40')]+'%'};return _0x2adb01;}})});}_0x2f7fc4=_[_0xfc18('0x2a')]({},_0x2f7fc4,_0x319565['options']);var _0x2b9690={'where':_0x2f7fc4[_0xfc18('0x3d')]};return db[_0xfc18('0x44')][_0xfc18('0x1e')](_0x2b9690)['then'](function(_0x12935b){_0x47576c[_0xfc18('0x1e')]=_0x12935b;if(_0x319565['query'][_0xfc18('0x45')]){_0x2f7fc4[_0xfc18('0x46')]=[{'all':!![]}];}return db['Attachment'][_0xfc18('0x47')](_0x2f7fc4);})[_0xfc18('0x23')](function(_0x35f14d){_0x47576c[_0xfc18('0x48')]=_0x35f14d;return _0x47576c;})[_0xfc18('0x23')](respondWithFilteredResult(_0x4c5116,_0x2f7fc4))[_0xfc18('0x49')](handleError(_0x4c5116,null));};exports[_0xfc18('0x4a')]=function(_0x4d265d,_0x3a153e){var _0x19f37f={'raw':!![],'where':{'id':_0x4d265d[_0xfc18('0x4b')]['id']}},_0x3db38a={};_0x3db38a['model']=_[_0xfc18('0x36')](db[_0xfc18('0x44')][_0xfc18('0x31')]);_0x3db38a['query']=_[_0xfc18('0x36')](_0x4d265d[_0xfc18('0x35')]);_0x3db38a[_0xfc18('0x3e')]=_[_0xfc18('0x38')](_0x3db38a['model'],_0x3db38a[_0xfc18('0x35')]);_0x19f37f[_0xfc18('0x37')]=_[_0xfc18('0x38')](_0x3db38a[_0xfc18('0x34')],qs['fields'](_0x4d265d['query']['fields']));_0x19f37f[_0xfc18('0x37')]=_0x19f37f[_0xfc18('0x37')][_0xfc18('0x4c')]?_0x19f37f[_0xfc18('0x37')]:_0x3db38a['model'];if(_0x4d265d[_0xfc18('0x35')]['includeAll']){_0x19f37f['include']=[{'all':!![]}];}_0x19f37f=_[_0xfc18('0x2a')]({},_0x19f37f,_0x4d265d[_0xfc18('0x4d')]);return db[_0xfc18('0x44')]['find'](_0x19f37f)[_0xfc18('0x23')](handleEntityNotFound(_0x3a153e,null))['then'](respondWithResult(_0x3a153e,null))[_0xfc18('0x49')](handleError(_0x3a153e,null));};exports[_0xfc18('0x4e')]=function(_0x33a4d,_0x5420b7){var _0x190d02={'where':{'id':_0x33a4d[_0xfc18('0x4b')]['id']}},_0x44f427={};_0x44f427[_0xfc18('0x34')]=_[_0xfc18('0x36')](db['Attachment'][_0xfc18('0x31')]);_0x190d02['attributes']=_[_0xfc18('0x38')](_0x44f427[_0xfc18('0x34')],qs[_0xfc18('0x39')](_0x33a4d[_0xfc18('0x35')][_0xfc18('0x39')]));_0x190d02[_0xfc18('0x37')]=_0x190d02[_0xfc18('0x37')][_0xfc18('0x4c')]?_0x190d02[_0xfc18('0x37')]:_0x44f427[_0xfc18('0x34')];if(_0x33a4d[_0xfc18('0x35')][_0xfc18('0x45')]){_0x190d02[_0xfc18('0x46')]=[{'all':!![]}];}_0x190d02=_[_0xfc18('0x2a')]({},_0x190d02,_0x33a4d[_0xfc18('0x4d')]);return db[_0xfc18('0x44')][_0xfc18('0x4f')](_0x190d02)[_0xfc18('0x23')](handleEntityNotFound(_0x5420b7,null))[_0xfc18('0x23')](function(_0x1b9a6a){if(_0x1b9a6a){var _0x19887c=_0x1b9a6a['get']({'plain':!![]});_0x19887c=qs[_0xfc18('0x50')](_0x19887c,['id','createdAt',_0xfc18('0x51')]);_0x33a4d[_0xfc18('0x2b')]=_[_0xfc18('0x50')](_0x33a4d['body'],['id','createdAt',_0xfc18('0x51')]);return db['Attachment'][_0xfc18('0x52')](_[_0xfc18('0x2a')](_0x19887c,_0x33a4d[_0xfc18('0x2b')]),{'include':_0x33a4d['query'][_0xfc18('0x45')]?[{'all':!![]}]:undefined});}})[_0xfc18('0x23')](respondWithResult(_0x5420b7,0xc9))[_0xfc18('0x49')](handleError(_0x5420b7,null));};exports[_0xfc18('0x22')]=function(_0x48c653,_0x150a20){if(_0x48c653[_0xfc18('0x2b')]['id']){delete _0x48c653[_0xfc18('0x2b')]['id'];}return db[_0xfc18('0x44')]['find']({'where':{'id':_0x48c653['params']['id']}})[_0xfc18('0x23')](handleEntityNotFound(_0x150a20,null))[_0xfc18('0x23')](saveUpdates(_0x48c653[_0xfc18('0x2b')],null))['then'](respondWithResult(_0x150a20,null))['catch'](handleError(_0x150a20,null));};exports[_0xfc18('0x24')]=function(_0xdecd5,_0x7b0137){return db[_0xfc18('0x44')]['find']({'where':{'id':_0xdecd5[_0xfc18('0x4b')]['id']}})[_0xfc18('0x23')](handleEntityNotFound(_0x7b0137,null))[_0xfc18('0x23')](removeEntity(_0x7b0137,null))[_0xfc18('0x49')](handleError(_0x7b0137,null));};exports[_0xfc18('0x52')]=function(_0x3effd9,_0x37ca13,_0x377593){_0x3effd9['body'][_0xfc18('0x28')]=_0x3effd9[_0xfc18('0x53')][_0xfc18('0x54')];_0x3effd9['body'][_0xfc18('0x55')]=_0x3effd9[_0xfc18('0x53')][_0xfc18('0x56')];_0x3effd9[_0xfc18('0x2b')][_0xfc18('0x42')]=_0x3effd9[_0xfc18('0x53')][_0xfc18('0x57')];return db[_0xfc18('0x44')]['create'](_0x3effd9[_0xfc18('0x2b')])[_0xfc18('0x23')](respondWithResult(_0x37ca13,0xc9))['catch'](handleError(_0x37ca13,null));};exports['download']=function(_0x308251,_0x4c5f27,_0x2f417b){return db['Attachment'][_0xfc18('0x58')]({'where':{'id':_0x308251[_0xfc18('0x4b')]['id']},'raw':!![]})[_0xfc18('0x23')](handleEntityNotFound(_0x4c5f27,null))[_0xfc18('0x23')](function(_0x1e12ed){if(_0x1e12ed){var _0x394dac=_0x1e12ed['ChatOfflineMessageId']!==null;var _0x454cf4=path['join'](config[_0xfc18('0x59')],_0xfc18('0x5a'));if(_0x394dac){_0x454cf4=path[_0xfc18('0x5b')](_0x454cf4,_0xfc18('0x5c'));}var _0x19f510=path[_0xfc18('0x5b')](_0x454cf4,_0x1e12ed['basename']);return _0x4c5f27[_0xfc18('0x5d')](_0x19f510);}})[_0xfc18('0x49')](handleError(_0x4c5f27,null));}; \ No newline at end of file +var _0xe818=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','render','merge','body','message','agent','interaction','account','index','fieldName','key','filters','intersection','model','query','fields','length','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','Attachment','includeAll','findAll','rows','catch','show','params','keys','include','find','clone','rawAttributes','get','omit','createdAt','updatedAt','create','originalname','basename','file','filename','type','mimetype','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x19fec1,_0x1cc62f){var _0x29cd35=function(_0x712a4f){while(--_0x712a4f){_0x19fec1['push'](_0x19fec1['shift']());}};_0x29cd35(++_0x1cc62f);}(_0xe818,0x1e4));var _0x8e81=function(_0x286ba6,_0x4c1a64){_0x286ba6=_0x286ba6-0x0;var _0x4c09a7=_0xe818[_0x286ba6];return _0x4c09a7;};'use strict';var emlformat=require(_0x8e81('0x0'));var rimraf=require(_0x8e81('0x1'));var zipdir=require(_0x8e81('0x2'));var jsonpatch=require(_0x8e81('0x3'));var rp=require(_0x8e81('0x4'));var moment=require('moment');var BPromise=require(_0x8e81('0x5'));var Mustache=require('mustache');var util=require(_0x8e81('0x6'));var path=require(_0x8e81('0x7'));var sox=require(_0x8e81('0x8'));var csv=require(_0x8e81('0x9'));var ejs=require(_0x8e81('0xa'));var fs=require('fs');var fs_extra=require(_0x8e81('0xb'));var _=require(_0x8e81('0xc'));var squel=require(_0x8e81('0xd'));var crypto=require(_0x8e81('0xe'));var jsforce=require(_0x8e81('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8e81('0x9'));var querystring=require(_0x8e81('0x10'));var Papa=require(_0x8e81('0x11'));var Redis=require(_0x8e81('0x12'));var authService=require(_0x8e81('0x13'));var qs=require(_0x8e81('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e81('0x15'));var logger=require(_0x8e81('0x16'))(_0x8e81('0x17'));var utils=require('../../config/utils');var config=require(_0x8e81('0x18'));var licenseUtil=require(_0x8e81('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa4dc0f,_0x5f3747){_0x5f3747=_0x5f3747||0xcc;return function(_0x570725){if(_0x570725){return _0xa4dc0f[_0x8e81('0x1a')](_0x5f3747);}return _0xa4dc0f[_0x8e81('0x1b')](_0x5f3747)[_0x8e81('0x1c')]();};}function respondWithResult(_0x54cfb8,_0x4c20c5){_0x4c20c5=_0x4c20c5||0xc8;return function(_0x21e997){if(_0x21e997){return _0x54cfb8[_0x8e81('0x1b')](_0x4c20c5)['json'](_0x21e997);}};}function respondWithFilteredResult(_0x4420f5,_0x230da8){return function(_0x16142a){if(_0x16142a){var _0x2a1905=typeof _0x230da8[_0x8e81('0x1d')]===_0x8e81('0x1e')&&typeof _0x230da8[_0x8e81('0x1f')]===_0x8e81('0x1e');var _0x5217ee=_0x16142a[_0x8e81('0x20')];var _0x52979d=_0x2a1905?0x0:_0x230da8[_0x8e81('0x1d')];var _0x2a5563=_0x2a1905?_0x16142a[_0x8e81('0x20')]:_0x230da8[_0x8e81('0x1d')]+_0x230da8[_0x8e81('0x1f')];var _0x4619d3;if(_0x2a5563>=_0x5217ee){_0x2a5563=_0x5217ee;_0x4619d3=0xc8;}else{_0x4619d3=0xce;}_0x4420f5['status'](_0x4619d3);return _0x4420f5[_0x8e81('0x21')]('Content-Range',_0x52979d+'-'+_0x2a5563+'/'+_0x5217ee)[_0x8e81('0x22')](_0x16142a);}return null;};}function patchUpdates(_0x208710){return function(_0x40dcf8){try{jsonpatch[_0x8e81('0x23')](_0x40dcf8,_0x208710,!![]);}catch(_0x54d343){return BPromise[_0x8e81('0x24')](_0x54d343);}return _0x40dcf8[_0x8e81('0x25')]();};}function saveUpdates(_0x58d5cc,_0x165989){return function(_0x23b223){if(_0x23b223){return _0x23b223[_0x8e81('0x26')](_0x58d5cc)[_0x8e81('0x27')](function(_0x27e508){return _0x27e508;});}return null;};}function removeEntity(_0x1c1086,_0x4ab0f0){return function(_0x1e11f3){if(_0x1e11f3){return _0x1e11f3[_0x8e81('0x28')]()[_0x8e81('0x27')](function(){_0x1c1086[_0x8e81('0x1b')](0xcc)[_0x8e81('0x1c')]();});}};}function handleEntityNotFound(_0x42b990,_0x22c6f1){return function(_0x36acc3){if(!_0x36acc3){_0x42b990[_0x8e81('0x1a')](0x194);}return _0x36acc3;};}function handleError(_0x5f2995,_0x3bdbd8){_0x3bdbd8=_0x3bdbd8||0x1f4;return function(_0x2b764d){logger[_0x8e81('0x29')](_0x2b764d[_0x8e81('0x2a')]);if(_0x2b764d[_0x8e81('0x2b')]){delete _0x2b764d[_0x8e81('0x2b')];}_0x5f2995[_0x8e81('0x1b')](_0x3bdbd8)[_0x8e81('0x2c')](_0x2b764d);};}function getMustacheRender(_0x3ad769,_0x855489){return Mustache[_0x8e81('0x2d')](_0x3ad769,_[_0x8e81('0x2e')](_0x855489[_0x8e81('0x2f')],{'contact':_0x855489['contact'],'message':_0x855489[_0x8e81('0x30')],'agent':_0x855489[_0x8e81('0x31')],'interaction':_0x855489[_0x8e81('0x32')],'account':_0x855489[_0x8e81('0x33')]}))||'';}exports[_0x8e81('0x34')]=function(_0x1a7fd5,_0x2a8cee){var _0x36df5a={},_0x3d92ea={},_0x1c4092={'count':0x0,'rows':[]};var _0x1977fa=_['map'](db['Attachment']['rawAttributes'],function(_0x42ee11){return{'name':_0x42ee11[_0x8e81('0x35')],'type':_0x42ee11['type'][_0x8e81('0x36')]};});_0x3d92ea['model']=_['map'](_0x1977fa,_0x8e81('0x2b'));_0x3d92ea['query']=_['keys'](_0x1a7fd5['query']);_0x3d92ea[_0x8e81('0x37')]=_[_0x8e81('0x38')](_0x3d92ea[_0x8e81('0x39')],_0x3d92ea[_0x8e81('0x3a')]);_0x36df5a['attributes']=_[_0x8e81('0x38')](_0x3d92ea[_0x8e81('0x39')],qs[_0x8e81('0x3b')](_0x1a7fd5[_0x8e81('0x3a')][_0x8e81('0x3b')]));_0x36df5a['attributes']=_0x36df5a['attributes'][_0x8e81('0x3c')]?_0x36df5a[_0x8e81('0x3d')]:_0x3d92ea[_0x8e81('0x39')];if(!_0x1a7fd5[_0x8e81('0x3a')][_0x8e81('0x3e')](_0x8e81('0x3f'))){_0x36df5a['limit']=qs[_0x8e81('0x1f')](_0x1a7fd5[_0x8e81('0x3a')][_0x8e81('0x1f')]);_0x36df5a['offset']=qs[_0x8e81('0x1d')](_0x1a7fd5['query'][_0x8e81('0x1d')]);}_0x36df5a['order']=qs[_0x8e81('0x40')](_0x1a7fd5[_0x8e81('0x3a')][_0x8e81('0x40')]);_0x36df5a['where']=qs[_0x8e81('0x37')](_[_0x8e81('0x41')](_0x1a7fd5[_0x8e81('0x3a')],_0x3d92ea[_0x8e81('0x37')]),_0x1977fa);if(_0x1a7fd5[_0x8e81('0x3a')][_0x8e81('0x42')]){_0x36df5a[_0x8e81('0x43')]=_[_0x8e81('0x2e')](_0x36df5a[_0x8e81('0x43')],{'$or':_['map'](_0x1977fa,function(_0x5ee653){if(_0x5ee653['type']!==_0x8e81('0x44')){var _0x496989={};_0x496989[_0x5ee653[_0x8e81('0x2b')]]={'$like':'%'+_0x1a7fd5[_0x8e81('0x3a')][_0x8e81('0x42')]+'%'};return _0x496989;}})});}_0x36df5a=_[_0x8e81('0x2e')]({},_0x36df5a,_0x1a7fd5[_0x8e81('0x45')]);var _0x4208fa={'where':_0x36df5a[_0x8e81('0x43')]};return db[_0x8e81('0x46')][_0x8e81('0x20')](_0x4208fa)[_0x8e81('0x27')](function(_0x45c5b6){_0x1c4092[_0x8e81('0x20')]=_0x45c5b6;if(_0x1a7fd5[_0x8e81('0x3a')][_0x8e81('0x47')]){_0x36df5a['include']=[{'all':!![]}];}return db[_0x8e81('0x46')][_0x8e81('0x48')](_0x36df5a);})[_0x8e81('0x27')](function(_0x19e25c){_0x1c4092[_0x8e81('0x49')]=_0x19e25c;return _0x1c4092;})['then'](respondWithFilteredResult(_0x2a8cee,_0x36df5a))[_0x8e81('0x4a')](handleError(_0x2a8cee,null));};exports[_0x8e81('0x4b')]=function(_0x1bdcfb,_0x557af3){var _0x52645e={'raw':!![],'where':{'id':_0x1bdcfb[_0x8e81('0x4c')]['id']}},_0x223533={};_0x223533[_0x8e81('0x39')]=_[_0x8e81('0x4d')](db[_0x8e81('0x46')]['rawAttributes']);_0x223533[_0x8e81('0x3a')]=_['keys'](_0x1bdcfb[_0x8e81('0x3a')]);_0x223533[_0x8e81('0x37')]=_[_0x8e81('0x38')](_0x223533['model'],_0x223533[_0x8e81('0x3a')]);_0x52645e['attributes']=_[_0x8e81('0x38')](_0x223533[_0x8e81('0x39')],qs[_0x8e81('0x3b')](_0x1bdcfb['query'][_0x8e81('0x3b')]));_0x52645e['attributes']=_0x52645e['attributes'][_0x8e81('0x3c')]?_0x52645e[_0x8e81('0x3d')]:_0x223533['model'];if(_0x1bdcfb[_0x8e81('0x3a')][_0x8e81('0x47')]){_0x52645e[_0x8e81('0x4e')]=[{'all':!![]}];}_0x52645e=_[_0x8e81('0x2e')]({},_0x52645e,_0x1bdcfb[_0x8e81('0x45')]);return db['Attachment'][_0x8e81('0x4f')](_0x52645e)[_0x8e81('0x27')](handleEntityNotFound(_0x557af3,null))[_0x8e81('0x27')](respondWithResult(_0x557af3,null))[_0x8e81('0x4a')](handleError(_0x557af3,null));};exports[_0x8e81('0x50')]=function(_0x38e0fa,_0x9adca4){var _0x329b78={'where':{'id':_0x38e0fa[_0x8e81('0x4c')]['id']}},_0x36ba81={};_0x36ba81['model']=_[_0x8e81('0x4d')](db[_0x8e81('0x46')][_0x8e81('0x51')]);_0x329b78[_0x8e81('0x3d')]=_[_0x8e81('0x38')](_0x36ba81[_0x8e81('0x39')],qs[_0x8e81('0x3b')](_0x38e0fa[_0x8e81('0x3a')]['fields']));_0x329b78['attributes']=_0x329b78[_0x8e81('0x3d')]['length']?_0x329b78[_0x8e81('0x3d')]:_0x36ba81['model'];if(_0x38e0fa['query']['includeAll']){_0x329b78[_0x8e81('0x4e')]=[{'all':!![]}];}_0x329b78=_['merge']({},_0x329b78,_0x38e0fa[_0x8e81('0x45')]);return db[_0x8e81('0x46')][_0x8e81('0x4f')](_0x329b78)['then'](handleEntityNotFound(_0x9adca4,null))[_0x8e81('0x27')](function(_0x4ba11e){if(_0x4ba11e){var _0x2e46fc=_0x4ba11e[_0x8e81('0x52')]({'plain':!![]});_0x2e46fc=qs[_0x8e81('0x53')](_0x2e46fc,['id',_0x8e81('0x54'),_0x8e81('0x55')]);_0x38e0fa[_0x8e81('0x2f')]=_['omit'](_0x38e0fa[_0x8e81('0x2f')],['id','createdAt',_0x8e81('0x55')]);return db[_0x8e81('0x46')][_0x8e81('0x56')](_[_0x8e81('0x2e')](_0x2e46fc,_0x38e0fa[_0x8e81('0x2f')]),{'include':_0x38e0fa[_0x8e81('0x3a')][_0x8e81('0x47')]?[{'all':!![]}]:undefined});}})[_0x8e81('0x27')](respondWithResult(_0x9adca4,0xc9))['catch'](handleError(_0x9adca4,null));};exports['update']=function(_0x5ac625,_0x595d59){if(_0x5ac625[_0x8e81('0x2f')]['id']){delete _0x5ac625[_0x8e81('0x2f')]['id'];}return db[_0x8e81('0x46')][_0x8e81('0x4f')]({'where':{'id':_0x5ac625[_0x8e81('0x4c')]['id']}})[_0x8e81('0x27')](handleEntityNotFound(_0x595d59,null))[_0x8e81('0x27')](saveUpdates(_0x5ac625[_0x8e81('0x2f')],null))[_0x8e81('0x27')](respondWithResult(_0x595d59,null))['catch'](handleError(_0x595d59,null));};exports[_0x8e81('0x28')]=function(_0x30546a,_0x57be57){return db[_0x8e81('0x46')][_0x8e81('0x4f')]({'where':{'id':_0x30546a[_0x8e81('0x4c')]['id']}})[_0x8e81('0x27')](handleEntityNotFound(_0x57be57,null))['then'](removeEntity(_0x57be57,null))[_0x8e81('0x4a')](handleError(_0x57be57,null));};exports[_0x8e81('0x56')]=function(_0x55d2e9,_0x471898,_0x21d3d8){_0x55d2e9[_0x8e81('0x2f')][_0x8e81('0x2b')]=_0x55d2e9['file'][_0x8e81('0x57')];_0x55d2e9[_0x8e81('0x2f')][_0x8e81('0x58')]=_0x55d2e9[_0x8e81('0x59')][_0x8e81('0x5a')];_0x55d2e9[_0x8e81('0x2f')][_0x8e81('0x5b')]=_0x55d2e9[_0x8e81('0x59')][_0x8e81('0x5c')];return db[_0x8e81('0x46')][_0x8e81('0x56')](_0x55d2e9[_0x8e81('0x2f')])[_0x8e81('0x27')](respondWithResult(_0x471898,0xc9))[_0x8e81('0x4a')](handleError(_0x471898,null));};exports[_0x8e81('0x5d')]=function(_0x24d0c2,_0x384622,_0x14f7e2){return db[_0x8e81('0x46')][_0x8e81('0x5e')]({'where':{'id':_0x24d0c2['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x384622,null))[_0x8e81('0x27')](function(_0x525b76){if(_0x525b76){var _0x4d8073=_0x525b76[_0x8e81('0x5f')]!==null;var _0x15f1eb=path['join'](config[_0x8e81('0x60')],_0x8e81('0x61'));if(_0x4d8073){_0x15f1eb=path[_0x8e81('0x62')](_0x15f1eb,_0x8e81('0x63'));}var _0x3b46ed=path[_0x8e81('0x62')](_0x15f1eb,_0x525b76[_0x8e81('0x58')]);return _0x384622[_0x8e81('0x5d')](_0x3b46ed);}})[_0x8e81('0x4a')](handleError(_0x384622,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 23863b2..c4de662 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 _0xa880=['define','Attachment','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes'];(function(_0x16bdff,_0x431bc0){var _0x33abe7=function(_0x369383){while(--_0x369383){_0x16bdff['push'](_0x16bdff['shift']());}};_0x33abe7(++_0x431bc0);}(_0xa880,0x106));var _0x0a88=function(_0xe6aba1,_0x4ff2b4){_0xe6aba1=_0xe6aba1-0x0;var _0x56482c=_0xa880[_0xe6aba1];return _0x56482c;};'use strict';var _=require(_0x0a88('0x0'));var util=require(_0x0a88('0x1'));var logger=require(_0x0a88('0x2'))(_0x0a88('0x3'));var moment=require(_0x0a88('0x4'));var BPromise=require(_0x0a88('0x5'));var rp=require(_0x0a88('0x6'));var fs=require('fs');var path=require(_0x0a88('0x7'));var rimraf=require(_0x0a88('0x8'));var config=require(_0x0a88('0x9'));var attributes=require(_0x0a88('0xa'));module['exports']=function(_0x35c530,_0x2aac39){return _0x35c530[_0x0a88('0xb')](_0x0a88('0xc'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f18=['path','rimraf','./attachment.attributes','exports','define','attachments','lodash','../../config/logger','moment','bluebird'];(function(_0x5438c6,_0x4f6b04){var _0xb1672c=function(_0x571aa8){while(--_0x571aa8){_0x5438c6['push'](_0x5438c6['shift']());}};_0xb1672c(++_0x4f6b04);}(_0x6f18,0x1b4));var _0x86f1=function(_0x330786,_0x579ea1){_0x330786=_0x330786-0x0;var _0x31e5c1=_0x6f18[_0x330786];return _0x31e5c1;};'use strict';var _=require(_0x86f1('0x0'));var util=require('util');var logger=require(_0x86f1('0x1'))('api');var moment=require(_0x86f1('0x2'));var BPromise=require(_0x86f1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x86f1('0x4'));var rimraf=require(_0x86f1('0x5'));var config=require('../../config/environment');var attributes=require(_0x86f1('0x6'));module[_0x86f1('0x7')]=function(_0x3c91dc,_0x15a5e1){return _0x3c91dc[_0x86f1('0x8')]('Attachment',attributes,{'tableName':_0x86f1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index b715fe4..12754af 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 _0x9a94=['create','options','raw','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','CreateAttachment'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x9a94,0xc0));var _0x49a9=function(_0x4c49c0,_0x4adb76){_0x4c49c0=_0x4c49c0-0x0;var _0x596b70=_0x9a94[_0x4c49c0];return _0x596b70;};'use strict';var _=require(_0x49a9('0x0'));var util=require('util');var moment=require(_0x49a9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49a9('0x2'));var db=require(_0x49a9('0x3'))['db'];var utils=require(_0x49a9('0x4'));var logger=require(_0x49a9('0x5'))(_0x49a9('0x6'));var config=require(_0x49a9('0x7'));var jayson=require(_0x49a9('0x8'));var client=jayson[_0x49a9('0x9')][_0x49a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49b5d9,_0x4d3db8,_0x2c8d2b){return new BPromise(function(_0x8ebbc1,_0x66455){return client[_0x49a9('0xb')](_0x49b5d9,_0x2c8d2b)[_0x49a9('0xc')](function(_0x242b31){logger['info'](_0x49a9('0xd'),_0x4d3db8,'request\x20sent');logger[_0x49a9('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x4d3db8,_0x49a9('0xf'),JSON[_0x49a9('0x10')](_0x242b31));if(_0x242b31['error']){if(_0x242b31[_0x49a9('0x11')][_0x49a9('0x12')]===0x1f4){logger[_0x49a9('0x11')](_0x49a9('0xd'),_0x4d3db8,_0x242b31['error'][_0x49a9('0x13')]);return _0x66455(_0x242b31[_0x49a9('0x11')][_0x49a9('0x13')]);}logger[_0x49a9('0x11')](_0x49a9('0xd'),_0x4d3db8,_0x242b31['error'][_0x49a9('0x13')]);return _0x8ebbc1(_0x242b31[_0x49a9('0x11')][_0x49a9('0x13')]);}else{logger[_0x49a9('0x14')]('Attachment,\x20%s,\x20%s',_0x4d3db8,'request\x20sent');_0x8ebbc1(_0x242b31[_0x49a9('0x15')][_0x49a9('0x13')]);}})[_0x49a9('0x16')](function(_0x1268d4){logger[_0x49a9('0x11')](_0x49a9('0xd'),_0x4d3db8,_0x1268d4);_0x66455(_0x1268d4);});});}exports[_0x49a9('0x17')]=function(_0x36cf05){var _0x351405=this;return new Promise(function(_0x9a69c9,_0x4f3261){return db['Attachment'][_0x49a9('0x18')](_0x36cf05['body'],{'raw':_0x36cf05[_0x49a9('0x19')]?_0x36cf05[_0x49a9('0x19')][_0x49a9('0x1a')]===undefined?!![]:![]:!![]})[_0x49a9('0xc')](function(_0x2ef64f){logger[_0x49a9('0x14')](_0x49a9('0x17'),_0x36cf05);logger[_0x49a9('0xe')](_0x49a9('0x17'),_0x36cf05,JSON[_0x49a9('0x10')](_0x2ef64f));_0x9a69c9(_0x2ef64f);})[_0x49a9('0x16')](function(_0x503fa3){logger[_0x49a9('0x11')](_0x49a9('0x17'),_0x503fa3[_0x49a9('0x13')],_0x36cf05);_0x4f3261(_0x351405[_0x49a9('0x11')](0x1f4,_0x503fa3[_0x49a9('0x13')]));});});}; \ No newline at end of file +var _0x7411=['Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateAttachment','Attachment','create','body','options','info','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7411,0x1ac));var _0x1741=function(_0x35bd0b,_0xc93fae){_0x35bd0b=_0x35bd0b-0x0;var _0x478117=_0x7411[_0x35bd0b];return _0x478117;};'use strict';var _=require('lodash');var util=require(_0x1741('0x0'));var moment=require(_0x1741('0x1'));var BPromise=require(_0x1741('0x2'));var rs=require(_0x1741('0x3'));var fs=require('fs');var Redis=require(_0x1741('0x4'));var db=require(_0x1741('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1741('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1741('0x7')][_0x1741('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x65bf27,_0x761002,_0x1c1af8){return new BPromise(function(_0x5b952e,_0x21c3d2){return client[_0x1741('0x9')](_0x65bf27,_0x1c1af8)[_0x1741('0xa')](function(_0x24b8f3){logger['info'](_0x1741('0xb'),_0x761002,_0x1741('0xc'));logger[_0x1741('0xd')](_0x1741('0xe'),_0x761002,_0x1741('0xc'),JSON['stringify'](_0x24b8f3));if(_0x24b8f3[_0x1741('0xf')]){if(_0x24b8f3[_0x1741('0xf')][_0x1741('0x10')]===0x1f4){logger[_0x1741('0xf')](_0x1741('0xb'),_0x761002,_0x24b8f3[_0x1741('0xf')]['message']);return _0x21c3d2(_0x24b8f3[_0x1741('0xf')][_0x1741('0x11')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x761002,_0x24b8f3['error'][_0x1741('0x11')]);return _0x5b952e(_0x24b8f3[_0x1741('0xf')]['message']);}else{logger['info'](_0x1741('0xb'),_0x761002,_0x1741('0xc'));_0x5b952e(_0x24b8f3[_0x1741('0x12')][_0x1741('0x11')]);}})['catch'](function(_0x2b4264){logger[_0x1741('0xf')](_0x1741('0xb'),_0x761002,_0x2b4264);_0x21c3d2(_0x2b4264);});});}exports[_0x1741('0x13')]=function(_0x1de625){var _0x4774f1=this;return new Promise(function(_0x579a3c,_0x406a78){return db[_0x1741('0x14')][_0x1741('0x15')](_0x1de625[_0x1741('0x16')],{'raw':_0x1de625[_0x1741('0x17')]?_0x1de625[_0x1741('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x1741('0xa')](function(_0x489e44){logger[_0x1741('0x18')](_0x1741('0x13'),_0x1de625);logger[_0x1741('0xd')](_0x1741('0x13'),_0x1de625,JSON[_0x1741('0x19')](_0x489e44));_0x579a3c(_0x489e44);})['catch'](function(_0xf5e455){logger[_0x1741('0xf')](_0x1741('0x13'),_0xf5e455[_0x1741('0x11')],_0x1de625);_0x406a78(_0x4774f1['error'](0x1f4,_0xf5e455['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index c76019c..14395be 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 _0x7fce=['multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','clone','diskStorage','join','now','originalname','replace','single','create','update','delete'];(function(_0x32e26c,_0x296d5c){var _0x15c13b=function(_0x3974cb){while(--_0x3974cb){_0x32e26c['push'](_0x32e26c['shift']());}};_0x15c13b(++_0x296d5c);}(_0x7fce,0xdc));var _0xe7fc=function(_0x2abe62,_0x19aa98){_0x2abe62=_0x2abe62-0x0;var _0x5d3f3e=_0x7fce[_0x2abe62];return _0x5d3f3e;};'use strict';var multer=require(_0xe7fc('0x0'));var util=require(_0xe7fc('0x1'));var path=require(_0xe7fc('0x2'));var timeout=require('connect-timeout');var express=require(_0xe7fc('0x3'));var router=express['Router']();var fs_extra=require(_0xe7fc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe7fc('0x5'));var config=require(_0xe7fc('0x6'));var controller=require('./attachment.controller');router['get']('/',auth[_0xe7fc('0x7')](),controller['index']);router[_0xe7fc('0x8')](_0xe7fc('0x9'),auth[_0xe7fc('0x7')](),controller[_0xe7fc('0xa')]);router[_0xe7fc('0x8')]('/:id/download',auth[_0xe7fc('0x7')](),controller['download']);router[_0xe7fc('0xb')]('/:id/clone',auth[_0xe7fc('0x7')](),controller[_0xe7fc('0xc')]);var upload=multer({'storage':multer[_0xe7fc('0xd')]({'destination':function(_0x31c05f,_0x53a26c,_0x278e9a){_0x278e9a(null,path[_0xe7fc('0xe')](config['root'],'server/files/attachments/'));},'filename':function(_0x243600,_0x59da2e,_0x38512a){_0x38512a(null,util['format']('%s-%s',Date[_0xe7fc('0xf')](),_0x59da2e[_0xe7fc('0x10')][_0xe7fc('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe7fc('0xb')]('/',upload[_0xe7fc('0x12')]('file'),controller[_0xe7fc('0x13')]);router['put']('/:id',auth[_0xe7fc('0x7')](),controller[_0xe7fc('0x14')]);router[_0xe7fc('0x15')](_0xe7fc('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2884=['express','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','/:id','show','download','post','clone','diskStorage','join','root','format','now','originalname','file','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x1985d1,_0x5cb51d){var _0x409ef1=function(_0x4d57f8){while(--_0x4d57f8){_0x1985d1['push'](_0x1985d1['shift']());}};_0x409ef1(++_0x5cb51d);}(_0x2884,0x1eb));var _0x4288=function(_0x5950bd,_0x103e16){_0x5950bd=_0x5950bd-0x0;var _0x33e816=_0x2884[_0x5950bd];return _0x33e816;};'use strict';var multer=require(_0x4288('0x0'));var util=require('util');var path=require(_0x4288('0x1'));var timeout=require(_0x4288('0x2'));var express=require(_0x4288('0x3'));var router=express['Router']();var fs_extra=require(_0x4288('0x4'));var auth=require(_0x4288('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4288('0x6'));router[_0x4288('0x7')]('/',auth[_0x4288('0x8')](),controller['index']);router['get'](_0x4288('0x9'),auth['isAuthenticated'](),controller[_0x4288('0xa')]);router[_0x4288('0x7')]('/:id/download',auth[_0x4288('0x8')](),controller[_0x4288('0xb')]);router[_0x4288('0xc')]('/:id/clone',auth['isAuthenticated'](),controller[_0x4288('0xd')]);var upload=multer({'storage':multer[_0x4288('0xe')]({'destination':function(_0x7095f1,_0x2345d5,_0x2445eb){_0x2445eb(null,path[_0x4288('0xf')](config[_0x4288('0x10')],'server/files/attachments/'));},'filename':function(_0x10eb55,_0x1c4bd0,_0xfa6eca){_0xfa6eca(null,util[_0x4288('0x11')]('%s-%s',Date[_0x4288('0x12')](),_0x1c4bd0[_0x4288('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x4288('0xc')]('/',upload['single'](_0x4288('0x14')),controller['create']);router[_0x4288('0x15')](_0x4288('0x9'),auth[_0x4288('0x8')](),controller[_0x4288('0x16')]);router[_0x4288('0x17')](_0x4288('0x9'),auth[_0x4288('0x8')](),controller[_0x4288('0x18')]);module[_0x4288('0x19')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 558df04..1d86767 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 _0x946d=['then','find','map','value','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','minutes','getLicense','catch','lodash','passport','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','profile','email','callback','use','clientID','clientSecret','secret','allowedLoginAttempts','blockDuration'];(function(_0x3a7139,_0x3e9be1){var _0x3be950=function(_0x2b5470){while(--_0x2b5470){_0x3a7139['push'](_0x3a7139['shift']());}};_0x3be950(++_0x3e9be1);}(_0x946d,0x16c));var _0xd946=function(_0x452c60,_0xdd9426){_0x452c60=_0x452c60-0x0;var _0x25e9db=_0x946d[_0x452c60];return _0x25e9db;};'use strict';var _=require(_0xd946('0x0'));var passport=require(_0xd946('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0xd946('0x2')];var moment=require('moment');var db=require(_0xd946('0x3'))['db'];var config=require(_0xd946('0x4'));var signToken=require(_0xd946('0x5'))[_0xd946('0x6')];var utils=require(_0xd946('0x7'));exports[_0xd946('0x8')]=passport[_0xd946('0x9')](_0xd946('0xa'),{'failureRedirect':'/login','scope':[_0xd946('0xb'),_0xd946('0xc')],'session':![]});exports[_0xd946('0xd')]=passport[_0xd946('0x9')]('google',{'failureRedirect':'/login','session':![]});passport[_0xd946('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0xd946('0xa')][_0xd946('0xf')]:'id','clientSecret':config['google']?config['google'][_0xd946('0x10')]:_0xd946('0x11'),'callbackURL':config['google']?config[_0xd946('0xa')]['callbackURL']:''},function(_0x3a74b4,_0xed081d,_0x2c6372,_0xdd08d5){var _0x1a1d26,_0x56b270;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xd946('0x12'),_0xd946('0x13')],'raw':!![]})[_0xd946('0x14')](function(_0x38b8e9){_0x1a1d26=_0x38b8e9;return db['User'][_0xd946('0x15')]({'where':{'email':_[_0xd946('0x16')](_0x2c6372['emails'],_0xd946('0x17')),'role':{'$or':['admin','user',_0xd946('0x18')]}}});})[_0xd946('0x14')](function(_0x1077ae){_0x56b270=_0x1077ae;if(_0x56b270){if(_0x56b270[_0xd946('0x19')]){return _0xdd08d5(_0xd946('0x1a'));}else if(_0x1a1d26[_0xd946('0x13')]>0x0){if(_0x56b270[_0xd946('0x1b')]){if(moment(_0x56b270[_0xd946('0x1c')])['add'](_0x1a1d26[_0xd946('0x13')],_0xd946('0x1d'))>moment()){return _0xdd08d5('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils['clearBlockUser'](_0x56b270,0x0,![],null)[_0xd946('0x14')](function(){return utils[_0xd946('0x1e')](_0x56b270);})['then'](function(){return _0xdd08d5(null,_0x56b270);});}}else{return utils[_0xd946('0x1e')](_0x56b270)[_0xd946('0x14')](function(){return _0xdd08d5(null,_0x56b270);});}}else{return utils[_0xd946('0x1e')](_0x56b270)[_0xd946('0x14')](function(){return _0xdd08d5(null,_0x56b270);});}}return _0xdd08d5('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0xd946('0x1f')](function(_0x19eb44){_0xdd08d5(_0x19eb44);});})); \ No newline at end of file +var _0x6b8d=['agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','minutes','clearBlockUser','getLicense','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','email','use','clientID','secret','callbackURL','Setting','findOne','allowedLoginAttempts','then','User','find','map','emails','value','user'];(function(_0x1b192c,_0xdbc44b){var _0x275caf=function(_0x6de7a9){while(--_0x6de7a9){_0x1b192c['push'](_0x1b192c['shift']());}};_0x275caf(++_0xdbc44b);}(_0x6b8d,0xbd));var _0xd6b8=function(_0x434506,_0x2f9c1c){_0x434506=_0x434506-0x0;var _0x1ac516=_0x6b8d[_0x434506];return _0x1ac516;};'use strict';var _=require('lodash');var passport=require(_0xd6b8('0x0'));var GoogleStrategy=require(_0xd6b8('0x1'))[_0xd6b8('0x2')];var moment=require(_0xd6b8('0x3'));var db=require(_0xd6b8('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0xd6b8('0x5'))[_0xd6b8('0x6')];var utils=require(_0xd6b8('0x7'));exports[_0xd6b8('0x8')]=passport[_0xd6b8('0x9')](_0xd6b8('0xa'),{'failureRedirect':_0xd6b8('0xb'),'scope':['profile',_0xd6b8('0xc')],'session':![]});exports['callback']=passport[_0xd6b8('0x9')](_0xd6b8('0xa'),{'failureRedirect':'/login','session':![]});passport[_0xd6b8('0xd')](new GoogleStrategy({'clientID':config[_0xd6b8('0xa')]?config['google'][_0xd6b8('0xe')]:'id','clientSecret':config['google']?config['google']['clientSecret']:_0xd6b8('0xf'),'callbackURL':config[_0xd6b8('0xa')]?config['google'][_0xd6b8('0x10')]:''},function(_0x51dd0d,_0x1296af,_0x5b9402,_0x2582a5){var _0x35b2f9,_0x1953d7;return db[_0xd6b8('0x11')][_0xd6b8('0x12')]({'where':{'id':0x1},'attributes':[_0xd6b8('0x13'),'blockDuration'],'raw':!![]})[_0xd6b8('0x14')](function(_0x999776){_0x35b2f9=_0x999776;return db[_0xd6b8('0x15')][_0xd6b8('0x16')]({'where':{'email':_[_0xd6b8('0x17')](_0x5b9402[_0xd6b8('0x18')],_0xd6b8('0x19')),'role':{'$or':['admin',_0xd6b8('0x1a'),_0xd6b8('0x1b')]}}});})[_0xd6b8('0x14')](function(_0x1dd525){_0x1953d7=_0x1dd525;if(_0x1953d7){if(_0x1953d7[_0xd6b8('0x1c')]){return _0x2582a5(_0xd6b8('0x1d'));}else if(_0x35b2f9[_0xd6b8('0x1e')]>0x0){if(_0x1953d7[_0xd6b8('0x1f')]){if(moment(_0x1953d7[_0xd6b8('0x20')])['add'](_0x35b2f9[_0xd6b8('0x1e')],_0xd6b8('0x21'))>moment()){return _0x2582a5(_0xd6b8('0x1d'));}else{return utils[_0xd6b8('0x22')](_0x1953d7,0x0,![],null)[_0xd6b8('0x14')](function(){return utils['getLicense'](_0x1953d7);})[_0xd6b8('0x14')](function(){return _0x2582a5(null,_0x1953d7);});}}else{return utils[_0xd6b8('0x23')](_0x1953d7)[_0xd6b8('0x14')](function(){return _0x2582a5(null,_0x1953d7);});}}else{return utils['getLicense'](_0x1953d7)[_0xd6b8('0x14')](function(){return _0x2582a5(null,_0x1953d7);});}}return _0x2582a5(_0xd6b8('0x1d'));})['catch'](function(_0x469f18){_0x2582a5(_0x469f18);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 4c55ee4..7001ea5 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 _0x7834=['./authGoogle.controller','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express'];(function(_0x3ff5c8,_0x284c6d){var _0xa9f551=function(_0x1a7a40){while(--_0x1a7a40){_0x3ff5c8['push'](_0x3ff5c8['shift']());}};_0xa9f551(++_0x284c6d);}(_0x7834,0x13f));var _0x4783=function(_0x50ac2e,_0x316214){_0x50ac2e=_0x50ac2e-0x0;var _0x1c7984=_0x7834[_0x50ac2e];return _0x1c7984;};'use strict';var express=require(_0x4783('0x0'));var passport=require('passport');var router=express['Router']();var controller=require(_0x4783('0x1'));var userController=require('../user/user.controller.js');var authService=require(_0x4783('0x2'));router[_0x4783('0x3')]('/',controller[_0x4783('0x4')]);router[_0x4783('0x3')](_0x4783('0x5'),controller[_0x4783('0x6')],authService[_0x4783('0x7')],userController['login'],authService[_0x4783('0x8')]);module[_0x4783('0x9')]=router; \ No newline at end of file +var _0xda55=['../../components/auth/service','get','login','callback','exports','express','passport','../user/user.controller.js'];(function(_0x5e7777,_0x5aec03){var _0xc8dfc3=function(_0x37b498){while(--_0x37b498){_0x5e7777['push'](_0x5e7777['shift']());}};_0xc8dfc3(++_0x5aec03);}(_0xda55,0x6d));var _0x5da5=function(_0x4800c4,_0x13b31e){_0x4800c4=_0x4800c4-0x0;var _0x5bd103=_0xda55[_0x4800c4];return _0x5bd103;};'use strict';var express=require(_0x5da5('0x0'));var passport=require(_0x5da5('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0x5da5('0x2'));var authService=require(_0x5da5('0x3'));router[_0x5da5('0x4')]('/',controller[_0x5da5('0x5')]);router[_0x5da5('0x4')]('/callback',controller[_0x5da5('0x6')],authService['isMiddleware'],userController[_0x5da5('0x5')],authService['setTokenCookie']);module[_0x5da5('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index c75d36b..7324785 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 _0x3e24=['token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','resetPasswordToken','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','then','name','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','merge','\x22%s\x22\x20<%s>','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','trim','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params'];(function(_0x54d0d9,_0x1f2828){var _0x379ae0=function(_0x1d156a){while(--_0x1d156a){_0x54d0d9['push'](_0x54d0d9['shift']());}};_0x379ae0(++_0x1f2828);}(_0x3e24,0x167));var _0x43e2=function(_0x37a1ce,_0x1eaf1d){_0x37a1ce=_0x37a1ce-0x0;var _0x18f726=_0x3e24[_0x37a1ce];return _0x18f726;};'use strict';var util=require(_0x43e2('0x0'));var passport=require(_0x43e2('0x1'));var LocalStrategy=require(_0x43e2('0x2'))[_0x43e2('0x3')];var jayson=require(_0x43e2('0x4'));var _=require('lodash');var rs=require(_0x43e2('0x5'));var moment=require(_0x43e2('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x43e2('0x7'));var utils=require(_0x43e2('0x8'));var client=jayson[_0x43e2('0x9')][_0x43e2('0xa')]({'port':0x232b});function localAuthenticate(_0x43b5a7,_0x121e2e,_0x23b2d8,_0x59956d){var _0xb75b,_0x2357bc;return db['Setting'][_0x43e2('0xb')]({'where':{'id':0x1},'attributes':[_0x43e2('0xc'),'blockDuration'],'raw':!![]})[_0x43e2('0xd')](function(_0x1ef968){_0xb75b=_0x1ef968;return _0x43b5a7['findOne']({'attributes':['id',_0x43e2('0xe'),'password','salt','role',_0x43e2('0xf'),_0x43e2('0x10'),_0x43e2('0x11'),_0x43e2('0x12')],'where':{'name':_0x121e2e,'role':{'$or':[_0x43e2('0x13'),_0x43e2('0x14'),_0x43e2('0x15')]}}});})[_0x43e2('0xd')](function(_0x10d166){if(!_0x10d166||_0x10d166&&_0x10d166[_0x43e2('0xe')]!==_0x121e2e){throw new Error(_0x43e2('0x16'));}else{_0x2357bc=_0x10d166;return _0x2357bc;}})[_0x43e2('0xd')](function(){_0x2357bc['authenticate'](_0x23b2d8,function(_0x376bba,_0x40fb7b){var _0xb929b5=_0x2357bc[_0x43e2('0x12')]+0x1;if(_0x376bba){return _0x59956d(_0x376bba);}else if(!_0x40fb7b){if(_0x2357bc['disabled']){return _0x59956d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xb75b[_0x43e2('0xc')]>0x0){if(_0x2357bc[_0x43e2('0x10')]){if(_0xb75b[_0x43e2('0x17')]>0x0){if(moment(_0x2357bc[_0x43e2('0x11')])[_0x43e2('0x18')](_0xb75b[_0x43e2('0x17')],_0x43e2('0x19'))>moment()){return _0x59956d(null,![],{'message':_0x43e2('0x16')});}else{return utils[_0x43e2('0x1a')](_0x2357bc,_0xb929b5,![],null)[_0x43e2('0xd')](function(){return _0x59956d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x59956d(null,![],{'message':_0x43e2('0x16')});}}else{if(_0xb929b5>=_0xb75b[_0x43e2('0xc')]){return utils['clearBlockUser'](_0x2357bc,0x0,!![],moment())[_0x43e2('0xd')](function(){return _0x59956d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x43e2('0x1a')](_0x2357bc,_0xb929b5,![],null)[_0x43e2('0xd')](function(){return _0x59956d(null,![],{'message':_0x43e2('0x16')});});}}}else{return _0x59956d(null,![],{'message':_0x43e2('0x16')});}}else{if(_0x2357bc[_0x43e2('0xf')]){return _0x59956d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xb75b[_0x43e2('0xc')]>0x0){if(_0x2357bc[_0x43e2('0x10')]){if(_0xb75b[_0x43e2('0x17')]>0x0){if(moment(_0x2357bc['blockedAt'])[_0x43e2('0x18')](_0xb75b[_0x43e2('0x17')],_0x43e2('0x19'))>moment()){return _0x59956d(null,![],{'message':_0x43e2('0x16')});}else{return utils['clearBlockUser'](_0x2357bc,0x0,![],null)[_0x43e2('0xd')](function(){return utils[_0x43e2('0x1b')](_0x2357bc);})[_0x43e2('0xd')](function(){return _0x59956d(null,_0x2357bc);});}}else{return _0x59956d(null,![],{'message':_0x43e2('0x16')});}}else{return utils[_0x43e2('0x1a')](_0x2357bc,0x0,![],null)[_0x43e2('0xd')](function(){return utils[_0x43e2('0x1b')](_0x2357bc);})[_0x43e2('0xd')](function(){return _0x59956d(null,_0x2357bc);})[_0x43e2('0x1c')](function(_0x1ec68e){return _0x59956d(null,![],_0x1ec68e);});}}else{if(_0x2357bc[_0x43e2('0x10')]){return _0x59956d(null,![],{'message':_0x43e2('0x16')});}else{return utils['getLicense'](_0x2357bc)[_0x43e2('0xd')](function(){return _0x59956d(null,_0x2357bc);});}}}});})[_0x43e2('0x1c')](function(_0x545246){return _0x59956d(null,![],_0x545246);});}function sendServiceMail(_0x163063){return db[_0x43e2('0x1d')][_0x43e2('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x43e2('0xe'),_0x43e2('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0x43e2('0x20')}]})[_0x43e2('0xd')](function(_0x1779f9){if(!_0x1779f9){throw new Error(_0x43e2('0x21'));}var _0x3316d6={'tls':{'rejectUnauthorized':![]}};if(_0x1779f9[_0x43e2('0x20')]['service']){_0x3316d6['service']=_0x1779f9[_0x43e2('0x20')][_0x43e2('0x22')];}else{_0x3316d6[_0x43e2('0x23')]=_0x1779f9[_0x43e2('0x20')][_0x43e2('0x23')];_0x3316d6['port']=_0x1779f9[_0x43e2('0x20')][_0x43e2('0x24')];_0x3316d6[_0x43e2('0x25')]=_0x1779f9[_0x43e2('0x20')][_0x43e2('0x25')];}if(_0x1779f9[_0x43e2('0x20')][_0x43e2('0x26')]){_0x3316d6['auth']={'user':_0x1779f9['Smtp'][_0x43e2('0x14')],'pass':_0x1779f9[_0x43e2('0x20')]['pass']};}var _0x257676={'account':_0x3316d6,'message':_[_0x43e2('0x27')]({'from':util['format'](_0x43e2('0x28'),_0x1779f9['name'],_0x1779f9['email']||_0x1779f9['Smtp'][_0x43e2('0x14')])},_0x163063)};return client['request'](_0x43e2('0x29'),_0x257676);})[_0x43e2('0xd')](function(_0x128e22){if(_0x128e22[_0x43e2('0x2a')]){throw new Error(util[_0x43e2('0x2b')](_0x43e2('0x2c'),_0x128e22[_0x43e2('0x2a')][_0x43e2('0x2d')]||JSON[_0x43e2('0x2e')](_0x128e22[_0x43e2('0x2a')])));}return!![];});}function handleError(_0x28261f,_0xf38103,_0x10093f){return _0x28261f[_0x43e2('0x2f')](_0xf38103||0x1f4)[_0x43e2('0x30')]({'message':_0x10093f?_0x10093f[_0x43e2('0x2d')]||_0x10093f:''});}exports[_0x43e2('0x31')]=function(_0x47f74c,_0x4da45f,_0x4c3f7d){passport[_0x43e2('0x32')](_0x43e2('0x33'),function(_0x490f4d,_0x5cfde9,_0x2b5fce){var _0x45cb38=_0x490f4d||_0x2b5fce;if(_0x45cb38){return handleError(_0x4da45f,0x191,_0x45cb38);}if(!_0x5cfde9){return handleError(_0x4da45f,0x194,{'message':_0x43e2('0x34')});}else{var _0x200d70={'payload':{'id':_0x5cfde9['id'],'role':_0x5cfde9[_0x43e2('0x35')]},'options':{'expiresIn':0x15180}};return authService[_0x43e2('0x36')](_0x200d70)[_0x43e2('0xd')](function(_0x3f03e5){_0x4da45f[_0x43e2('0x37')]({'id':_0x5cfde9['id'],'token':_0x3f03e5,'statusCall':'','isAlreadyLogged':_0x5cfde9[_0x43e2('0x38')]});});}})(_0x47f74c,_0x4da45f,_0x4c3f7d);};exports[_0x43e2('0x39')]=function(_0x257de9,_0x196b5f,_0x280074){if(!_0x257de9['body'][_0x43e2('0x1f')]){return handleError(_0x196b5f,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0xc1fbb4=rs['generate']();_0x257de9[_0x43e2('0x3a')][_0x43e2('0x1f')]=_0x257de9[_0x43e2('0x3a')]['email'][_0x43e2('0x3b')]()['toLowerCase']();var _0x1ba4cf;return db[_0x43e2('0x3c')][_0x43e2('0xb')]({'where':{'id':0x1},'attributes':[_0x43e2('0xc'),'blockDuration'],'raw':!![]})['then'](function(_0x95b22f){_0x1ba4cf=_0x95b22f;return db[_0x43e2('0x3d')][_0x43e2('0x1e')]({'where':{'email':_0x257de9[_0x43e2('0x3a')]['email']}});})[_0x43e2('0xd')](function(_0x1c6061){if(!_0x1c6061){throw new Error(_0x43e2('0x3e'));}if(_0x1c6061[_0x43e2('0xf')]){throw new Error(_0x43e2('0x3f'));}if(_0x1c6061['blocked']){if(moment(_0x1c6061[_0x43e2('0x11')])['add'](_0x1ba4cf[_0x43e2('0x17')],_0x43e2('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x1c6061[_0x43e2('0x10')]=![];_0x1c6061['blockedAt']=null;}}_0x1c6061['resetPasswordToken']=_0xc1fbb4;_0x1c6061[_0x43e2('0x40')]=Date[_0x43e2('0x41')]()+0x36ee80;return _0x1c6061[_0x43e2('0x42')]();})[_0x43e2('0xd')](function(){return sendServiceMail({'to':_0x257de9[_0x43e2('0x3a')]['email'],'subject':_0x43e2('0x43'),'text':_0x43e2('0x44')+_0x43e2('0x45')+_0x43e2('0x46')+_0x257de9[_0x43e2('0x47')][_0x43e2('0x23')]+_0x43e2('0x48')+_0xc1fbb4+'\x0a\x0a'+_0x43e2('0x49')});})['then'](function(){_0x196b5f[_0x43e2('0x2f')](0xc8)[_0x43e2('0x30')]({'message':'Reset\x20Email\x20sent!'});})[_0x43e2('0x1c')](function(_0x2b82be){return handleError(_0x196b5f,0x1f4,_0x2b82be);});};exports[_0x43e2('0x4a')]=function(_0x8bc721,_0x5d4c81,_0x48df9e){return db[_0x43e2('0x3d')][_0x43e2('0x1e')]({'where':{'resetPasswordToken':_0x8bc721[_0x43e2('0x4b')][_0x43e2('0x4c')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x399e96){if(!_0x399e96){throw new Error(_0x43e2('0x4d'));}return db['Setting'][_0x43e2('0xb')]({'attributes':['id',_0x43e2('0x4e'),_0x43e2('0x4f'),'passwordHistoryLimit']})['then'](function(_0x171960){if(_0x171960[_0x43e2('0x4e')])authService[_0x43e2('0x50')](_0x8bc721[_0x43e2('0x3a')][_0x43e2('0x51')]);if(!_0x171960[_0x43e2('0x4f')]||!_0x399e96[_0x43e2('0x52')])return _0x399e96;authService[_0x43e2('0x53')](_0x8bc721[_0x43e2('0x3a')]['password'],_0x399e96[_0x43e2('0x52')],_0x171960['passwordHistoryLimit']);return _0x399e96;})[_0x43e2('0xd')](function(){_0x399e96[_0x43e2('0x51')]=_0x8bc721[_0x43e2('0x3a')]['password'];_0x399e96[_0x43e2('0x54')]=null;_0x399e96[_0x43e2('0x40')]=null;return _0x399e96[_0x43e2('0x42')]();});})[_0x43e2('0xd')](function(){_0x5d4c81[_0x43e2('0x2f')](0xc8)[_0x43e2('0x30')]({'message':_0x43e2('0x55')});})[_0x43e2('0x1c')](function(_0xc72b92){return handleError(_0x5d4c81,0x1f4,_0xc72b92);});};passport[_0x43e2('0x56')](new LocalStrategy({'usernameField':_0x43e2('0xe'),'passwordField':_0x43e2('0x51')},function(_0x147af5,_0x57dad2,_0x5c634e){return localAuthenticate(db['User'],_0x147af5,_0x57dad2,_0x5c634e);})); \ No newline at end of file +var _0x583c=['merge','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','signToken','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','Setting','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','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','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','User','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','util','passport','passport-local','Strategy','lodash','randomstring','../../components/auth/service','../../config/utils','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','disabled','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','pass'];(function(_0x874a49,_0x5b07bc){var _0x343d2f=function(_0x351928){while(--_0x351928){_0x874a49['push'](_0x874a49['shift']());}};_0x343d2f(++_0x5b07bc);}(_0x583c,0x12b));var _0xc583=function(_0x2ed7d1,_0x363741){_0x2ed7d1=_0x2ed7d1-0x0;var _0x38ae3c=_0x583c[_0x2ed7d1];return _0x38ae3c;};'use strict';var util=require(_0xc583('0x0'));var passport=require(_0xc583('0x1'));var LocalStrategy=require(_0xc583('0x2'))[_0xc583('0x3')];var jayson=require('jayson/promise');var _=require(_0xc583('0x4'));var rs=require(_0xc583('0x5'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0xc583('0x6'));var utils=require(_0xc583('0x7'));var client=jayson['client'][_0xc583('0x8')]({'port':0x232b});function localAuthenticate(_0x365ed6,_0x2719df,_0x1dd37c,_0x48a8d4){var _0x21ed88,_0x26cec0;return db['Setting'][_0xc583('0x9')]({'where':{'id':0x1},'attributes':[_0xc583('0xa'),_0xc583('0xb')],'raw':!![]})[_0xc583('0xc')](function(_0x2d99ca){_0x21ed88=_0x2d99ca;return _0x365ed6['findOne']({'attributes':['id',_0xc583('0xd'),_0xc583('0xe'),'salt',_0xc583('0xf'),_0xc583('0x10'),'blocked',_0xc583('0x11'),_0xc583('0x12')],'where':{'name':_0x2719df,'role':{'$or':[_0xc583('0x13'),_0xc583('0x14'),_0xc583('0x15')]}}});})[_0xc583('0xc')](function(_0x183cca){if(!_0x183cca||_0x183cca&&_0x183cca[_0xc583('0xd')]!==_0x2719df){throw new Error(_0xc583('0x16'));}else{_0x26cec0=_0x183cca;return _0x26cec0;}})['then'](function(){_0x26cec0[_0xc583('0x17')](_0x1dd37c,function(_0x51ecd7,_0x19f46a){var _0x299fa1=_0x26cec0['loginAttempts']+0x1;if(_0x51ecd7){return _0x48a8d4(_0x51ecd7);}else if(!_0x19f46a){if(_0x26cec0[_0xc583('0x10')]){return _0x48a8d4(null,![],{'message':_0xc583('0x16')});}else if(_0x21ed88['allowedLoginAttempts']>0x0){if(_0x26cec0[_0xc583('0x18')]){if(_0x21ed88[_0xc583('0xb')]>0x0){if(moment(_0x26cec0['blockedAt'])[_0xc583('0x19')](_0x21ed88[_0xc583('0xb')],_0xc583('0x1a'))>moment()){return _0x48a8d4(null,![],{'message':_0xc583('0x16')});}else{return utils['clearBlockUser'](_0x26cec0,_0x299fa1,![],null)[_0xc583('0xc')](function(){return _0x48a8d4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x48a8d4(null,![],{'message':_0xc583('0x16')});}}else{if(_0x299fa1>=_0x21ed88[_0xc583('0xa')]){return utils[_0xc583('0x1b')](_0x26cec0,0x0,!![],moment())[_0xc583('0xc')](function(){return _0x48a8d4(null,![],{'message':_0xc583('0x16')});});}else{return utils[_0xc583('0x1b')](_0x26cec0,_0x299fa1,![],null)[_0xc583('0xc')](function(){return _0x48a8d4(null,![],{'message':_0xc583('0x16')});});}}}else{return _0x48a8d4(null,![],{'message':_0xc583('0x16')});}}else{if(_0x26cec0[_0xc583('0x10')]){return _0x48a8d4(null,![],{'message':_0xc583('0x16')});}else if(_0x21ed88[_0xc583('0xa')]>0x0){if(_0x26cec0[_0xc583('0x18')]){if(_0x21ed88['blockDuration']>0x0){if(moment(_0x26cec0['blockedAt'])[_0xc583('0x19')](_0x21ed88[_0xc583('0xb')],_0xc583('0x1a'))>moment()){return _0x48a8d4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc583('0x1b')](_0x26cec0,0x0,![],null)[_0xc583('0xc')](function(){return utils[_0xc583('0x1c')](_0x26cec0);})[_0xc583('0xc')](function(){return _0x48a8d4(null,_0x26cec0);});}}else{return _0x48a8d4(null,![],{'message':_0xc583('0x16')});}}else{return utils['clearBlockUser'](_0x26cec0,0x0,![],null)['then'](function(){return utils[_0xc583('0x1c')](_0x26cec0);})['then'](function(){return _0x48a8d4(null,_0x26cec0);})[_0xc583('0x1d')](function(_0xcbe9b2){return _0x48a8d4(null,![],_0xcbe9b2);});}}else{if(_0x26cec0[_0xc583('0x18')]){return _0x48a8d4(null,![],{'message':_0xc583('0x16')});}else{return utils[_0xc583('0x1c')](_0x26cec0)['then'](function(){return _0x48a8d4(null,_0x26cec0);});}}}});})[_0xc583('0x1d')](function(_0x44f76a){return _0x48a8d4(null,![],_0x44f76a);});}function sendServiceMail(_0x4adde3){return db[_0xc583('0x1e')]['find']({'where':{'service':!![]},'attributes':['id',_0xc583('0xd'),_0xc583('0x1f')],'include':[{'model':db[_0xc583('0x20')],'as':_0xc583('0x21')}]})[_0xc583('0xc')](function(_0x19079b){if(!_0x19079b){throw new Error(_0xc583('0x22'));}var _0x4a87b5={'tls':{'rejectUnauthorized':![]}};if(_0x19079b[_0xc583('0x21')][_0xc583('0x23')]){_0x4a87b5[_0xc583('0x23')]=_0x19079b[_0xc583('0x21')][_0xc583('0x23')];}else{_0x4a87b5[_0xc583('0x24')]=_0x19079b['Smtp'][_0xc583('0x24')];_0x4a87b5['port']=_0x19079b['Smtp'][_0xc583('0x25')];_0x4a87b5[_0xc583('0x26')]=_0x19079b[_0xc583('0x21')][_0xc583('0x26')];}if(_0x19079b[_0xc583('0x21')]['authentication']){_0x4a87b5[_0xc583('0x27')]={'user':_0x19079b[_0xc583('0x21')][_0xc583('0x14')],'pass':_0x19079b['Smtp'][_0xc583('0x28')]};}var _0x55bdca={'account':_0x4a87b5,'message':_[_0xc583('0x29')]({'from':util[_0xc583('0x2a')](_0xc583('0x2b'),_0x19079b[_0xc583('0xd')],_0x19079b[_0xc583('0x1f')]||_0x19079b['Smtp'][_0xc583('0x14')])},_0x4adde3)};return client['request'](_0xc583('0x2c'),_0x55bdca);})['then'](function(_0x2e96fc){if(_0x2e96fc[_0xc583('0x2d')]){throw new Error(util[_0xc583('0x2a')](_0xc583('0x2e'),_0x2e96fc[_0xc583('0x2d')][_0xc583('0x2f')]||JSON['stringify'](_0x2e96fc['error'])));}return!![];});}function handleError(_0x3720d6,_0xa02621,_0x56c4b6){return _0x3720d6[_0xc583('0x30')](_0xa02621||0x1f4)[_0xc583('0x31')]({'message':_0x56c4b6?_0x56c4b6[_0xc583('0x2f')]||_0x56c4b6:''});}exports[_0xc583('0x32')]=function(_0x37b8c7,_0x388a85,_0x4e11d9){passport[_0xc583('0x17')]('local',function(_0x1d9735,_0x22cc57,_0x39bed4){var _0x502b6d=_0x1d9735||_0x39bed4;if(_0x502b6d){return handleError(_0x388a85,0x191,_0x502b6d);}if(!_0x22cc57){return handleError(_0x388a85,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x518c90={'payload':{'id':_0x22cc57['id'],'role':_0x22cc57[_0xc583('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0xc583('0x33')](_0x518c90)[_0xc583('0xc')](function(_0x342b66){_0x388a85['json']({'id':_0x22cc57['id'],'token':_0x342b66,'statusCall':'','isAlreadyLogged':_0x22cc57[_0xc583('0x34')]});});}})(_0x37b8c7,_0x388a85,_0x4e11d9);};exports[_0xc583('0x35')]=function(_0x594a0b,_0x48930a,_0x1ea5da){if(!_0x594a0b['body'][_0xc583('0x1f')]){return handleError(_0x48930a,0x1f4,{'message':_0xc583('0x36')});}var _0xe73752=rs[_0xc583('0x37')]();_0x594a0b['body'][_0xc583('0x1f')]=_0x594a0b[_0xc583('0x38')][_0xc583('0x1f')][_0xc583('0x39')]()[_0xc583('0x3a')]();var _0x5e6e7e;return db[_0xc583('0x3b')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc583('0xb')],'raw':!![]})[_0xc583('0xc')](function(_0x5788c7){_0x5e6e7e=_0x5788c7;return db['User'][_0xc583('0x3c')]({'where':{'email':_0x594a0b[_0xc583('0x38')][_0xc583('0x1f')]}});})[_0xc583('0xc')](function(_0x4b6d39){if(!_0x4b6d39){throw new Error(_0xc583('0x3d'));}if(_0x4b6d39['disabled']){throw new Error(_0xc583('0x3e'));}if(_0x4b6d39['blocked']){if(moment(_0x4b6d39[_0xc583('0x11')])[_0xc583('0x19')](_0x5e6e7e[_0xc583('0xb')],_0xc583('0x1a'))>moment()){throw new Error(_0xc583('0x3f'));}else{_0x4b6d39['blocked']=![];_0x4b6d39[_0xc583('0x11')]=null;}}_0x4b6d39[_0xc583('0x40')]=_0xe73752;_0x4b6d39[_0xc583('0x41')]=Date['now']()+0x36ee80;return _0x4b6d39['save']();})['then'](function(){return sendServiceMail({'to':_0x594a0b[_0xc583('0x38')]['email'],'subject':_0xc583('0x42'),'text':_0xc583('0x43')+_0xc583('0x44')+_0xc583('0x45')+_0x594a0b[_0xc583('0x46')][_0xc583('0x24')]+_0xc583('0x47')+_0xe73752+'\x0a\x0a'+_0xc583('0x48')});})[_0xc583('0xc')](function(){_0x48930a[_0xc583('0x30')](0xc8)[_0xc583('0x31')]({'message':'Reset\x20Email\x20sent!'});})[_0xc583('0x1d')](function(_0x121262){return handleError(_0x48930a,0x1f4,_0x121262);});};exports[_0xc583('0x49')]=function(_0x230a45,_0x56e370,_0xab8f73){return db[_0xc583('0x4a')][_0xc583('0x3c')]({'where':{'resetPasswordToken':_0x230a45[_0xc583('0x4b')][_0xc583('0x4c')],'resetPasswordExpires':{'$gt':Date[_0xc583('0x4d')]()}}})[_0xc583('0xc')](function(_0x12291c){if(!_0x12291c){throw new Error(_0xc583('0x4e'));}return db['Setting'][_0xc583('0x9')]({'attributes':['id',_0xc583('0x4f'),_0xc583('0x50'),_0xc583('0x51')]})[_0xc583('0xc')](function(_0xc42b2a){if(_0xc42b2a[_0xc583('0x4f')])authService[_0xc583('0x52')](_0x230a45[_0xc583('0x38')][_0xc583('0xe')]);if(!_0xc42b2a[_0xc583('0x50')]||!_0x12291c[_0xc583('0x53')])return _0x12291c;authService[_0xc583('0x54')](_0x230a45['body'][_0xc583('0xe')],_0x12291c[_0xc583('0x53')],_0xc42b2a[_0xc583('0x51')]);return _0x12291c;})[_0xc583('0xc')](function(){_0x12291c[_0xc583('0xe')]=_0x230a45[_0xc583('0x38')][_0xc583('0xe')];_0x12291c[_0xc583('0x40')]=null;_0x12291c[_0xc583('0x41')]=null;return _0x12291c['save']();});})[_0xc583('0xc')](function(){_0x56e370[_0xc583('0x30')](0xc8)[_0xc583('0x31')]({'message':'Password\x20reset!'});})['catch'](function(_0x2bb764){return handleError(_0x56e370,0x1f4,_0x2bb764);});};passport['use'](new LocalStrategy({'usernameField':_0xc583('0xd'),'passwordField':_0xc583('0xe')},function(_0x5613e7,_0x49e691,_0x282290){return localAuthenticate(db[_0xc583('0x4a')],_0x5613e7,_0x49e691,_0x282290);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index a59c3d2..70bcd52 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 _0x4361=['exports','Router','./authLocal.controller','post','login','/forgot','reset'];(function(_0x316714,_0x544a1d){var _0xd0e4b0=function(_0x5321b5){while(--_0x5321b5){_0x316714['push'](_0x316714['shift']());}};_0xd0e4b0(++_0x544a1d);}(_0x4361,0x189));var _0x1436=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x4361[_0x3ab9ee];return _0x82ee88;};'use strict';var express=require('express');var router=express[_0x1436('0x0')]();var controller=require(_0x1436('0x1'));router[_0x1436('0x2')]('/',controller[_0x1436('0x3')]);router[_0x1436('0x2')](_0x1436('0x4'),controller['forgot']);router[_0x1436('0x2')]('/reset/:token',controller[_0x1436('0x5')]);module[_0x1436('0x6')]=router; \ No newline at end of file +var _0xab6d=['./authLocal.controller','post','/forgot','/reset/:token','exports','express','Router'];(function(_0xf5fef7,_0x4c878b){var _0x417aa9=function(_0x3134f1){while(--_0x3134f1){_0xf5fef7['push'](_0xf5fef7['shift']());}};_0x417aa9(++_0x4c878b);}(_0xab6d,0x1ef));var _0xdab6=function(_0x4d244b,_0x3c9d64){_0x4d244b=_0x4d244b-0x0;var _0x29a47c=_0xab6d[_0x4d244b];return _0x29a47c;};'use strict';var express=require(_0xdab6('0x0'));var router=express[_0xdab6('0x1')]();var controller=require(_0xdab6('0x2'));router['post']('/',controller['login']);router[_0xdab6('0x3')](_0xdab6('0x4'),controller['forgot']);router[_0xdab6('0x3')](_0xdab6('0x5'),controller['reset']);module[_0xdab6('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index babdcad..f4e56a0 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 _0xecf0=['STRING','BOOLEAN','INTEGER','exports'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0xecf0,0x1ab));var _0x0ecf=function(_0x49e559,_0x34179a){_0x49e559=_0x49e559-0x0;var _0x2e80c0=_0xecf0[_0x49e559];return _0x2e80c0;};'use strict';var Sequelize=require('sequelize');module[_0x0ecf('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0ecf('0x1')]},'status':{'type':Sequelize[_0x0ecf('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0ecf('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xf400=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf400,0x16e));var _0x0f40=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xf400[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require(_0x0f40('0x0'));module[_0x0f40('0x1')]={'name':{'type':Sequelize[_0x0f40('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0f40('0x2')]},'status':{'type':Sequelize[_0x0f40('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0f40('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 4ce65cf..fbdf160 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 _0x9ffd=['zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../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','apply','update','then','error','name','send','render','merge','body','contact','message','agent','interaction','account','map','Automation','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','rows','show','params','length','find','catch','create','destroy','omit','ids','getConditions','Condition','pick','addActions','Action','getActions','findOne','eml-format','rimraf'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5697d2,_0x4889a0){_0x5697d2=_0x5697d2-0x0;var _0x53da01=_0x9ffd[_0x5697d2];return _0x53da01;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require(_0xd9ff('0x19'))['db'];function respondWithStatusCode(_0x47d842,_0x47b0d7){_0x47b0d7=_0x47b0d7||0xcc;return function(_0xaaf7af){if(_0xaaf7af){return _0x47d842[_0xd9ff('0x1a')](_0x47b0d7);}return _0x47d842[_0xd9ff('0x1b')](_0x47b0d7)[_0xd9ff('0x1c')]();};}function respondWithResult(_0x12c39a,_0x556aa4){_0x556aa4=_0x556aa4||0xc8;return function(_0x2f78c1){if(_0x2f78c1){return _0x12c39a[_0xd9ff('0x1b')](_0x556aa4)['json'](_0x2f78c1);}};}function respondWithFilteredResult(_0xf14c9f,_0x5db010){return function(_0x4ffe54){if(_0x4ffe54){var _0x547e28=typeof _0x5db010['offset']===_0xd9ff('0x1d')&&typeof _0x5db010['limit']===_0xd9ff('0x1d');var _0xa30fd2=_0x4ffe54[_0xd9ff('0x1e')];var _0x3afd19=_0x547e28?0x0:_0x5db010[_0xd9ff('0x1f')];var _0x2d4df1=_0x547e28?_0x4ffe54[_0xd9ff('0x1e')]:_0x5db010[_0xd9ff('0x1f')]+_0x5db010[_0xd9ff('0x20')];var _0x1f028f;if(_0x2d4df1>=_0xa30fd2){_0x2d4df1=_0xa30fd2;_0x1f028f=0xc8;}else{_0x1f028f=0xce;}_0xf14c9f[_0xd9ff('0x1b')](_0x1f028f);return _0xf14c9f[_0xd9ff('0x21')](_0xd9ff('0x22'),_0x3afd19+'-'+_0x2d4df1+'/'+_0xa30fd2)['json'](_0x4ffe54);}return null;};}function patchUpdates(_0x4cf8ec){return function(_0x264a3d){try{jsonpatch[_0xd9ff('0x23')](_0x264a3d,_0x4cf8ec,!![]);}catch(_0x4eea4d){return BPromise['reject'](_0x4eea4d);}return _0x264a3d['save']();};}function saveUpdates(_0x4b1477,_0x1f4d9e){return function(_0x58eb5f){if(_0x58eb5f){return _0x58eb5f[_0xd9ff('0x24')](_0x4b1477)[_0xd9ff('0x25')](function(_0x291f52){return _0x291f52;});}return null;};}function removeEntity(_0x9f074e,_0x278b66){return function(_0x42a828){if(_0x42a828){return _0x42a828['destroy']()['then'](function(){_0x9f074e[_0xd9ff('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ca906,_0x4d86fe){return function(_0x285002){if(!_0x285002){_0x3ca906['sendStatus'](0x194);}return _0x285002;};}function handleError(_0x10cbdd,_0x159e56){_0x159e56=_0x159e56||0x1f4;return function(_0x2138b4){logger[_0xd9ff('0x26')](_0x2138b4['stack']);if(_0x2138b4[_0xd9ff('0x27')]){delete _0x2138b4[_0xd9ff('0x27')];}_0x10cbdd[_0xd9ff('0x1b')](_0x159e56)[_0xd9ff('0x28')](_0x2138b4);};}function getMustacheRender(_0x5c1c1f,_0x1d3684){return Mustache[_0xd9ff('0x29')](_0x5c1c1f,_[_0xd9ff('0x2a')](_0x1d3684[_0xd9ff('0x2b')],{'contact':_0x1d3684[_0xd9ff('0x2c')],'message':_0x1d3684[_0xd9ff('0x2d')],'agent':_0x1d3684[_0xd9ff('0x2e')],'interaction':_0x1d3684[_0xd9ff('0x2f')],'account':_0x1d3684[_0xd9ff('0x30')]}))||'';}exports['index']=function(_0xcea5db,_0x4ba2be){var _0x1d55fd={},_0x29c532={},_0xbdd352={'count':0x0,'rows':[]};var _0x552d08=_[_0xd9ff('0x31')](db[_0xd9ff('0x32')][_0xd9ff('0x33')],function(_0x436a55){return{'name':_0x436a55['fieldName'],'type':_0x436a55[_0xd9ff('0x34')]['key']};});_0x29c532[_0xd9ff('0x35')]=_[_0xd9ff('0x31')](_0x552d08,_0xd9ff('0x27'));_0x29c532[_0xd9ff('0x36')]=_[_0xd9ff('0x37')](_0xcea5db[_0xd9ff('0x36')]);_0x29c532[_0xd9ff('0x38')]=_[_0xd9ff('0x39')](_0x29c532[_0xd9ff('0x35')],_0x29c532[_0xd9ff('0x36')]);_0x1d55fd[_0xd9ff('0x3a')]=_[_0xd9ff('0x39')](_0x29c532[_0xd9ff('0x35')],qs[_0xd9ff('0x3b')](_0xcea5db['query'][_0xd9ff('0x3b')]));_0x1d55fd[_0xd9ff('0x3a')]=_0x1d55fd[_0xd9ff('0x3a')]['length']?_0x1d55fd[_0xd9ff('0x3a')]:_0x29c532['model'];if(!_0xcea5db[_0xd9ff('0x36')]['hasOwnProperty'](_0xd9ff('0x3c'))){_0x1d55fd['limit']=qs[_0xd9ff('0x20')](_0xcea5db[_0xd9ff('0x36')][_0xd9ff('0x20')]);_0x1d55fd['offset']=qs['offset'](_0xcea5db['query'][_0xd9ff('0x1f')]);}_0x1d55fd[_0xd9ff('0x3d')]=qs[_0xd9ff('0x3e')](_0xcea5db[_0xd9ff('0x36')][_0xd9ff('0x3e')]);_0x1d55fd[_0xd9ff('0x3f')]=qs['filters'](_['pick'](_0xcea5db['query'],_0x29c532[_0xd9ff('0x38')]),_0x552d08);if(_0xcea5db[_0xd9ff('0x36')][_0xd9ff('0x40')]){_0x1d55fd[_0xd9ff('0x3f')]=_['merge'](_0x1d55fd[_0xd9ff('0x3f')],{'$or':_['map'](_0x552d08,function(_0x3cff52){if(_0x3cff52[_0xd9ff('0x34')]!==_0xd9ff('0x41')){var _0x169dc7={};_0x169dc7[_0x3cff52['name']]={'$like':'%'+_0xcea5db[_0xd9ff('0x36')][_0xd9ff('0x40')]+'%'};return _0x169dc7;}})});}_0x1d55fd=_['merge']({},_0x1d55fd,_0xcea5db[_0xd9ff('0x42')]);var _0x37848e={'where':_0x1d55fd[_0xd9ff('0x3f')]};return db[_0xd9ff('0x32')][_0xd9ff('0x1e')](_0x37848e)[_0xd9ff('0x25')](function(_0x57c496){_0xbdd352[_0xd9ff('0x1e')]=_0x57c496;if(_0xcea5db[_0xd9ff('0x36')][_0xd9ff('0x43')]){_0x1d55fd[_0xd9ff('0x44')]=[{'all':!![]}];}return db[_0xd9ff('0x32')]['findAll'](_0x1d55fd);})[_0xd9ff('0x25')](function(_0x463d6e){_0xbdd352[_0xd9ff('0x45')]=_0x463d6e;return _0xbdd352;})['then'](respondWithFilteredResult(_0x4ba2be,_0x1d55fd))['catch'](handleError(_0x4ba2be,null));};exports[_0xd9ff('0x46')]=function(_0x7eb1a,_0x18d1c4){var _0x2dfb8f={'raw':![],'where':{'id':_0x7eb1a[_0xd9ff('0x47')]['id']}},_0x437561={};_0x437561['model']=_[_0xd9ff('0x37')](db[_0xd9ff('0x32')]['rawAttributes']);_0x437561[_0xd9ff('0x36')]=_[_0xd9ff('0x37')](_0x7eb1a[_0xd9ff('0x36')]);_0x437561[_0xd9ff('0x38')]=_[_0xd9ff('0x39')](_0x437561['model'],_0x437561['query']);_0x2dfb8f['attributes']=_[_0xd9ff('0x39')](_0x437561['model'],qs[_0xd9ff('0x3b')](_0x7eb1a[_0xd9ff('0x36')][_0xd9ff('0x3b')]));_0x2dfb8f['attributes']=_0x2dfb8f[_0xd9ff('0x3a')][_0xd9ff('0x48')]?_0x2dfb8f['attributes']:_0x437561[_0xd9ff('0x35')];if(_0x7eb1a[_0xd9ff('0x36')][_0xd9ff('0x43')]){_0x2dfb8f[_0xd9ff('0x44')]=[{'all':!![]}];}_0x2dfb8f=_['merge']({},_0x2dfb8f,_0x7eb1a[_0xd9ff('0x42')]);return db['Automation'][_0xd9ff('0x49')](_0x2dfb8f)['then'](handleEntityNotFound(_0x18d1c4,null))[_0xd9ff('0x25')](respondWithResult(_0x18d1c4,null))[_0xd9ff('0x4a')](handleError(_0x18d1c4,null));};exports[_0xd9ff('0x4b')]=function(_0x1760c3,_0xf21b7d){return db['Automation'][_0xd9ff('0x4b')](_0x1760c3[_0xd9ff('0x2b')],{})[_0xd9ff('0x25')](respondWithResult(_0xf21b7d,0xc9))[_0xd9ff('0x4a')](handleError(_0xf21b7d,null));};exports['update']=function(_0x537282,_0x4c22dc){if(_0x537282[_0xd9ff('0x2b')]['id']){delete _0x537282[_0xd9ff('0x2b')]['id'];}return db[_0xd9ff('0x32')]['find']({'where':{'id':_0x537282[_0xd9ff('0x47')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x4c22dc,null))[_0xd9ff('0x25')](saveUpdates(_0x537282[_0xd9ff('0x2b')],null))[_0xd9ff('0x25')](respondWithResult(_0x4c22dc,null))[_0xd9ff('0x4a')](handleError(_0x4c22dc,null));};exports[_0xd9ff('0x4c')]=function(_0x1e1364,_0x1ad160){return db[_0xd9ff('0x32')][_0xd9ff('0x49')]({'where':{'id':_0x1e1364[_0xd9ff('0x47')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x1ad160,null))['then'](removeEntity(_0x1ad160,null))[_0xd9ff('0x4a')](handleError(_0x1ad160,null));};exports['addConditions']=function(_0x2c03a6,_0x5eff95,_0x2953d7){return db['Condition'][_0xd9ff('0x49')]({'where':{'id':_0x2c03a6['params']['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x5eff95,null))['then'](function(_0x3fbeda){if(_0x3fbeda){return _0x3fbeda['addConditions'](_0x2c03a6[_0xd9ff('0x2b')]['ids'],_[_0xd9ff('0x4d')](_0x2c03a6[_0xd9ff('0x2b')],[_0xd9ff('0x4e'),'id'])||{});}})[_0xd9ff('0x25')](respondWithResult(_0x5eff95,null))['catch'](handleError(_0x5eff95,null));};exports[_0xd9ff('0x4f')]=function(_0x180e79,_0x1dc00c,_0x59f8e8){var _0x2d6c3={};var _0x32e1b9={};var _0x19b033;var _0x2e29aa;return db[_0xd9ff('0x32')]['findOne']({'where':{'id':_0x180e79[_0xd9ff('0x47')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x1dc00c,null))[_0xd9ff('0x25')](function(_0x5eddc1){if(_0x5eddc1){_0x19b033=_0x5eddc1;_0x32e1b9[_0xd9ff('0x35')]=_[_0xd9ff('0x37')](db[_0xd9ff('0x50')]['rawAttributes']);_0x32e1b9[_0xd9ff('0x36')]=_[_0xd9ff('0x37')](_0x180e79['query']);_0x32e1b9[_0xd9ff('0x38')]=_[_0xd9ff('0x39')](_0x32e1b9['model'],_0x32e1b9[_0xd9ff('0x36')]);_0x2d6c3[_0xd9ff('0x3a')]=_[_0xd9ff('0x39')](_0x32e1b9['model'],qs['fields'](_0x180e79[_0xd9ff('0x36')]['fields']));_0x2d6c3[_0xd9ff('0x3a')]=_0x2d6c3[_0xd9ff('0x3a')][_0xd9ff('0x48')]?_0x2d6c3[_0xd9ff('0x3a')]:_0x32e1b9['model'];_0x2d6c3['order']=qs['sort'](_0x180e79[_0xd9ff('0x36')][_0xd9ff('0x3e')]);_0x2d6c3[_0xd9ff('0x3f')]=qs[_0xd9ff('0x38')](_[_0xd9ff('0x51')](_0x180e79['query'],_0x32e1b9[_0xd9ff('0x38')]));if(_0x180e79['query'][_0xd9ff('0x40')]){_0x2d6c3[_0xd9ff('0x3f')]=_[_0xd9ff('0x2a')](_0x2d6c3[_0xd9ff('0x3f')],{'$or':_[_0xd9ff('0x31')](_0x2d6c3[_0xd9ff('0x3a')],function(_0xed12df){var _0xfcafbe={};_0xfcafbe[_0xed12df]={'$like':'%'+_0x180e79['query'][_0xd9ff('0x40')]+'%'};return _0xfcafbe;})});}_0x2d6c3=_[_0xd9ff('0x2a')]({},_0x2d6c3,_0x180e79['options']);return _0x19b033['getConditions'](_0x2d6c3);}})[_0xd9ff('0x25')](function(_0x4d9226){if(_0x4d9226){_0x2e29aa=_0x4d9226[_0xd9ff('0x48')];if(!_0x180e79[_0xd9ff('0x36')]['hasOwnProperty'](_0xd9ff('0x3c'))){_0x2d6c3[_0xd9ff('0x20')]=qs[_0xd9ff('0x20')](_0x180e79[_0xd9ff('0x36')][_0xd9ff('0x20')]);_0x2d6c3['offset']=qs[_0xd9ff('0x1f')](_0x180e79['query']['offset']);}return _0x19b033[_0xd9ff('0x4f')](_0x2d6c3);}})[_0xd9ff('0x25')](function(_0x1a08a9){if(_0x1a08a9){return _0x1a08a9?{'count':_0x2e29aa,'rows':_0x1a08a9}:null;}})[_0xd9ff('0x25')](respondWithResult(_0x1dc00c,null))['catch'](handleError(_0x1dc00c,null));};exports[_0xd9ff('0x52')]=function(_0x23b816,_0x358ccd,_0x3b58bb){return db[_0xd9ff('0x53')][_0xd9ff('0x49')]({'where':{'id':_0x23b816[_0xd9ff('0x47')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x358ccd,null))['then'](function(_0x4c6b9d){if(_0x4c6b9d){return _0x4c6b9d['addActions'](_0x23b816[_0xd9ff('0x2b')][_0xd9ff('0x4e')],_['omit'](_0x23b816[_0xd9ff('0x2b')],[_0xd9ff('0x4e'),'id'])||{});}})[_0xd9ff('0x25')](respondWithResult(_0x358ccd,null))[_0xd9ff('0x4a')](handleError(_0x358ccd,null));};exports[_0xd9ff('0x54')]=function(_0x471e03,_0x2a9fdf,_0xc51fe8){var _0x5e5460={};var _0x1f9400={};var _0x1ef766;var _0x228413;return db['Automation'][_0xd9ff('0x55')]({'where':{'id':_0x471e03['params']['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x2a9fdf,null))[_0xd9ff('0x25')](function(_0x25ee82){if(_0x25ee82){_0x1ef766=_0x25ee82;_0x1f9400['model']=_[_0xd9ff('0x37')](db[_0xd9ff('0x53')][_0xd9ff('0x33')]);_0x1f9400[_0xd9ff('0x36')]=_['keys'](_0x471e03[_0xd9ff('0x36')]);_0x1f9400[_0xd9ff('0x38')]=_[_0xd9ff('0x39')](_0x1f9400['model'],_0x1f9400[_0xd9ff('0x36')]);_0x5e5460[_0xd9ff('0x3a')]=_[_0xd9ff('0x39')](_0x1f9400['model'],qs[_0xd9ff('0x3b')](_0x471e03[_0xd9ff('0x36')][_0xd9ff('0x3b')]));_0x5e5460[_0xd9ff('0x3a')]=_0x5e5460[_0xd9ff('0x3a')]['length']?_0x5e5460[_0xd9ff('0x3a')]:_0x1f9400[_0xd9ff('0x35')];_0x5e5460['order']=qs[_0xd9ff('0x3e')](_0x471e03[_0xd9ff('0x36')][_0xd9ff('0x3e')]);_0x5e5460['where']=qs[_0xd9ff('0x38')](_['pick'](_0x471e03[_0xd9ff('0x36')],_0x1f9400['filters']));if(_0x471e03[_0xd9ff('0x36')][_0xd9ff('0x40')]){_0x5e5460[_0xd9ff('0x3f')]=_[_0xd9ff('0x2a')](_0x5e5460[_0xd9ff('0x3f')],{'$or':_[_0xd9ff('0x31')](_0x5e5460[_0xd9ff('0x3a')],function(_0x518c8c){var _0x2f5b97={};_0x2f5b97[_0x518c8c]={'$like':'%'+_0x471e03[_0xd9ff('0x36')]['filter']+'%'};return _0x2f5b97;})});}_0x5e5460=_[_0xd9ff('0x2a')]({},_0x5e5460,_0x471e03[_0xd9ff('0x42')]);return _0x1ef766[_0xd9ff('0x54')](_0x5e5460);}})[_0xd9ff('0x25')](function(_0xad8e5b){if(_0xad8e5b){_0x228413=_0xad8e5b[_0xd9ff('0x48')];if(!_0x471e03['query']['hasOwnProperty'](_0xd9ff('0x3c'))){_0x5e5460[_0xd9ff('0x20')]=qs[_0xd9ff('0x20')](_0x471e03[_0xd9ff('0x36')][_0xd9ff('0x20')]);_0x5e5460[_0xd9ff('0x1f')]=qs['offset'](_0x471e03[_0xd9ff('0x36')][_0xd9ff('0x1f')]);}return _0x1ef766[_0xd9ff('0x54')](_0x5e5460);}})[_0xd9ff('0x25')](function(_0x14c89f){if(_0x14c89f){return _0x14c89f?{'count':_0x228413,'rows':_0x14c89f}:null;}})[_0xd9ff('0x25')](respondWithResult(_0x2a9fdf,null))['catch'](handleError(_0x2a9fdf,null));}; \ No newline at end of file +var _0xda3f=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','render','merge','body','contact','message','agent','index','map','Automation','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','findAll','catch','show','params','includeAll','include','create','find','destroy','addConditions','ids','omit','getConditions','findOne','Condition','hasOwnProperty','addActions','getActions','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x488e3d,_0x4f7e2a){var _0x3ee2b2=function(_0x5b6b37){while(--_0x5b6b37){_0x488e3d['push'](_0x488e3d['shift']());}};_0x3ee2b2(++_0x4f7e2a);}(_0xda3f,0xec));var _0xfda3=function(_0x3d0497,_0x41a640){_0x3d0497=_0x3d0497-0x0;var _0x2b2b42=_0xda3f[_0x3d0497];return _0x2b2b42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}function getMustacheRender(_0x5704c7,_0x3c1549){return Mustache[_0xfda3('0x28')](_0x5704c7,_[_0xfda3('0x29')](_0x3c1549[_0xfda3('0x2a')],{'contact':_0x3c1549[_0xfda3('0x2b')],'message':_0x3c1549[_0xfda3('0x2c')],'agent':_0x3c1549[_0xfda3('0x2d')],'interaction':_0x3c1549['interaction'],'account':_0x3c1549['account']}))||'';}exports[_0xfda3('0x2e')]=function(_0x4fd277,_0x4b9d90){var _0x16b4a2={},_0x2a5971={},_0x34f9d2={'count':0x0,'rows':[]};var _0xd7e1d6=_[_0xfda3('0x2f')](db[_0xfda3('0x30')][_0xfda3('0x31')],function(_0xd6b6d7){return{'name':_0xd6b6d7[_0xfda3('0x32')],'type':_0xd6b6d7['type'][_0xfda3('0x33')]};});_0x2a5971[_0xfda3('0x34')]=_[_0xfda3('0x2f')](_0xd7e1d6,_0xfda3('0x26'));_0x2a5971[_0xfda3('0x35')]=_[_0xfda3('0x36')](_0x4fd277[_0xfda3('0x35')]);_0x2a5971[_0xfda3('0x37')]=_[_0xfda3('0x38')](_0x2a5971['model'],_0x2a5971['query']);_0x16b4a2[_0xfda3('0x39')]=_[_0xfda3('0x38')](_0x2a5971['model'],qs[_0xfda3('0x3a')](_0x4fd277[_0xfda3('0x35')][_0xfda3('0x3a')]));_0x16b4a2['attributes']=_0x16b4a2[_0xfda3('0x39')][_0xfda3('0x3b')]?_0x16b4a2[_0xfda3('0x39')]:_0x2a5971[_0xfda3('0x34')];if(!_0x4fd277[_0xfda3('0x35')]['hasOwnProperty'](_0xfda3('0x3c'))){_0x16b4a2[_0xfda3('0x1b')]=qs[_0xfda3('0x1b')](_0x4fd277['query'][_0xfda3('0x1b')]);_0x16b4a2['offset']=qs[_0xfda3('0x19')](_0x4fd277[_0xfda3('0x35')][_0xfda3('0x19')]);}_0x16b4a2[_0xfda3('0x3d')]=qs[_0xfda3('0x3e')](_0x4fd277[_0xfda3('0x35')][_0xfda3('0x3e')]);_0x16b4a2[_0xfda3('0x3f')]=qs['filters'](_[_0xfda3('0x40')](_0x4fd277[_0xfda3('0x35')],_0x2a5971[_0xfda3('0x37')]),_0xd7e1d6);if(_0x4fd277[_0xfda3('0x35')]['filter']){_0x16b4a2[_0xfda3('0x3f')]=_[_0xfda3('0x29')](_0x16b4a2[_0xfda3('0x3f')],{'$or':_['map'](_0xd7e1d6,function(_0x5ac61e){if(_0x5ac61e[_0xfda3('0x41')]!==_0xfda3('0x42')){var _0x14716a={};_0x14716a[_0x5ac61e[_0xfda3('0x26')]]={'$like':'%'+_0x4fd277[_0xfda3('0x35')][_0xfda3('0x43')]+'%'};return _0x14716a;}})});}_0x16b4a2=_[_0xfda3('0x29')]({},_0x16b4a2,_0x4fd277[_0xfda3('0x44')]);var _0x2620d0={'where':_0x16b4a2[_0xfda3('0x3f')]};return db['Automation'][_0xfda3('0x1c')](_0x2620d0)[_0xfda3('0x23')](function(_0x5c3ac5){_0x34f9d2[_0xfda3('0x1c')]=_0x5c3ac5;if(_0x4fd277['query']['includeAll']){_0x16b4a2['include']=[{'all':!![]}];}return db[_0xfda3('0x30')][_0xfda3('0x45')](_0x16b4a2);})[_0xfda3('0x23')](function(_0x209918){_0x34f9d2['rows']=_0x209918;return _0x34f9d2;})[_0xfda3('0x23')](respondWithFilteredResult(_0x4b9d90,_0x16b4a2))[_0xfda3('0x46')](handleError(_0x4b9d90,null));};exports[_0xfda3('0x47')]=function(_0x2ce504,_0x564ccd){var _0x10482a={'raw':![],'where':{'id':_0x2ce504[_0xfda3('0x48')]['id']}},_0x240c16={};_0x240c16['model']=_['keys'](db[_0xfda3('0x30')][_0xfda3('0x31')]);_0x240c16[_0xfda3('0x35')]=_[_0xfda3('0x36')](_0x2ce504[_0xfda3('0x35')]);_0x240c16[_0xfda3('0x37')]=_[_0xfda3('0x38')](_0x240c16[_0xfda3('0x34')],_0x240c16[_0xfda3('0x35')]);_0x10482a[_0xfda3('0x39')]=_[_0xfda3('0x38')](_0x240c16[_0xfda3('0x34')],qs[_0xfda3('0x3a')](_0x2ce504[_0xfda3('0x35')]['fields']));_0x10482a['attributes']=_0x10482a[_0xfda3('0x39')][_0xfda3('0x3b')]?_0x10482a[_0xfda3('0x39')]:_0x240c16[_0xfda3('0x34')];if(_0x2ce504[_0xfda3('0x35')][_0xfda3('0x49')]){_0x10482a[_0xfda3('0x4a')]=[{'all':!![]}];}_0x10482a=_[_0xfda3('0x29')]({},_0x10482a,_0x2ce504[_0xfda3('0x44')]);return db[_0xfda3('0x30')]['find'](_0x10482a)[_0xfda3('0x23')](handleEntityNotFound(_0x564ccd,null))[_0xfda3('0x23')](respondWithResult(_0x564ccd,null))[_0xfda3('0x46')](handleError(_0x564ccd,null));};exports[_0xfda3('0x4b')]=function(_0x26496a,_0x5b4817){return db[_0xfda3('0x30')][_0xfda3('0x4b')](_0x26496a[_0xfda3('0x2a')],{})['then'](respondWithResult(_0x5b4817,0xc9))[_0xfda3('0x46')](handleError(_0x5b4817,null));};exports[_0xfda3('0x22')]=function(_0x11addf,_0x4cd5cb){if(_0x11addf[_0xfda3('0x2a')]['id']){delete _0x11addf[_0xfda3('0x2a')]['id'];}return db[_0xfda3('0x30')][_0xfda3('0x4c')]({'where':{'id':_0x11addf[_0xfda3('0x48')]['id']}})['then'](handleEntityNotFound(_0x4cd5cb,null))[_0xfda3('0x23')](saveUpdates(_0x11addf['body'],null))[_0xfda3('0x23')](respondWithResult(_0x4cd5cb,null))['catch'](handleError(_0x4cd5cb,null));};exports[_0xfda3('0x4d')]=function(_0x6447,_0x322b66){return db[_0xfda3('0x30')]['find']({'where':{'id':_0x6447[_0xfda3('0x48')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x322b66,null))[_0xfda3('0x23')](removeEntity(_0x322b66,null))[_0xfda3('0x46')](handleError(_0x322b66,null));};exports[_0xfda3('0x4e')]=function(_0x2ab6e9,_0x1d051f,_0x54fba2){return db['Condition'][_0xfda3('0x4c')]({'where':{'id':_0x2ab6e9[_0xfda3('0x48')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x1d051f,null))['then'](function(_0x5057c9){if(_0x5057c9){return _0x5057c9[_0xfda3('0x4e')](_0x2ab6e9[_0xfda3('0x2a')][_0xfda3('0x4f')],_[_0xfda3('0x50')](_0x2ab6e9[_0xfda3('0x2a')],['ids','id'])||{});}})[_0xfda3('0x23')](respondWithResult(_0x1d051f,null))[_0xfda3('0x46')](handleError(_0x1d051f,null));};exports[_0xfda3('0x51')]=function(_0x375d8c,_0x27c3cb,_0x2f52e2){var _0x360653={};var _0x1c5073={};var _0x3a8c51;var _0x28b6dc;return db[_0xfda3('0x30')][_0xfda3('0x52')]({'where':{'id':_0x375d8c['params']['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x27c3cb,null))[_0xfda3('0x23')](function(_0x33bc84){if(_0x33bc84){_0x3a8c51=_0x33bc84;_0x1c5073[_0xfda3('0x34')]=_[_0xfda3('0x36')](db[_0xfda3('0x53')][_0xfda3('0x31')]);_0x1c5073['query']=_['keys'](_0x375d8c[_0xfda3('0x35')]);_0x1c5073[_0xfda3('0x37')]=_['intersection'](_0x1c5073[_0xfda3('0x34')],_0x1c5073[_0xfda3('0x35')]);_0x360653[_0xfda3('0x39')]=_[_0xfda3('0x38')](_0x1c5073['model'],qs['fields'](_0x375d8c[_0xfda3('0x35')][_0xfda3('0x3a')]));_0x360653[_0xfda3('0x39')]=_0x360653['attributes'][_0xfda3('0x3b')]?_0x360653['attributes']:_0x1c5073[_0xfda3('0x34')];_0x360653[_0xfda3('0x3d')]=qs[_0xfda3('0x3e')](_0x375d8c[_0xfda3('0x35')][_0xfda3('0x3e')]);_0x360653[_0xfda3('0x3f')]=qs['filters'](_[_0xfda3('0x40')](_0x375d8c[_0xfda3('0x35')],_0x1c5073[_0xfda3('0x37')]));if(_0x375d8c[_0xfda3('0x35')][_0xfda3('0x43')]){_0x360653['where']=_['merge'](_0x360653[_0xfda3('0x3f')],{'$or':_[_0xfda3('0x2f')](_0x360653['attributes'],function(_0x550822){var _0x512d7b={};_0x512d7b[_0x550822]={'$like':'%'+_0x375d8c[_0xfda3('0x35')][_0xfda3('0x43')]+'%'};return _0x512d7b;})});}_0x360653=_['merge']({},_0x360653,_0x375d8c[_0xfda3('0x44')]);return _0x3a8c51[_0xfda3('0x51')](_0x360653);}})[_0xfda3('0x23')](function(_0x2e042b){if(_0x2e042b){_0x28b6dc=_0x2e042b['length'];if(!_0x375d8c[_0xfda3('0x35')][_0xfda3('0x54')](_0xfda3('0x3c'))){_0x360653[_0xfda3('0x1b')]=qs[_0xfda3('0x1b')](_0x375d8c[_0xfda3('0x35')]['limit']);_0x360653['offset']=qs[_0xfda3('0x19')](_0x375d8c['query'][_0xfda3('0x19')]);}return _0x3a8c51[_0xfda3('0x51')](_0x360653);}})[_0xfda3('0x23')](function(_0x3884b1){if(_0x3884b1){return _0x3884b1?{'count':_0x28b6dc,'rows':_0x3884b1}:null;}})[_0xfda3('0x23')](respondWithResult(_0x27c3cb,null))[_0xfda3('0x46')](handleError(_0x27c3cb,null));};exports[_0xfda3('0x55')]=function(_0x10a200,_0x29b9fb,_0x1eb4dc){return db['Action'][_0xfda3('0x4c')]({'where':{'id':_0x10a200['params']['id']}})['then'](handleEntityNotFound(_0x29b9fb,null))[_0xfda3('0x23')](function(_0x238762){if(_0x238762){return _0x238762['addActions'](_0x10a200[_0xfda3('0x2a')][_0xfda3('0x4f')],_[_0xfda3('0x50')](_0x10a200['body'],[_0xfda3('0x4f'),'id'])||{});}})[_0xfda3('0x23')](respondWithResult(_0x29b9fb,null))[_0xfda3('0x46')](handleError(_0x29b9fb,null));};exports[_0xfda3('0x56')]=function(_0x2448b1,_0x4c7435,_0x5b06a5){var _0x53c2e9={};var _0x1a278c={};var _0xa032b5;var _0x4768dc;return db[_0xfda3('0x30')][_0xfda3('0x52')]({'where':{'id':_0x2448b1[_0xfda3('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c7435,null))[_0xfda3('0x23')](function(_0x6c5e9d){if(_0x6c5e9d){_0xa032b5=_0x6c5e9d;_0x1a278c[_0xfda3('0x34')]=_[_0xfda3('0x36')](db['Action'][_0xfda3('0x31')]);_0x1a278c['query']=_[_0xfda3('0x36')](_0x2448b1[_0xfda3('0x35')]);_0x1a278c[_0xfda3('0x37')]=_[_0xfda3('0x38')](_0x1a278c[_0xfda3('0x34')],_0x1a278c[_0xfda3('0x35')]);_0x53c2e9[_0xfda3('0x39')]=_['intersection'](_0x1a278c[_0xfda3('0x34')],qs[_0xfda3('0x3a')](_0x2448b1[_0xfda3('0x35')][_0xfda3('0x3a')]));_0x53c2e9[_0xfda3('0x39')]=_0x53c2e9[_0xfda3('0x39')]['length']?_0x53c2e9[_0xfda3('0x39')]:_0x1a278c[_0xfda3('0x34')];_0x53c2e9[_0xfda3('0x3d')]=qs[_0xfda3('0x3e')](_0x2448b1[_0xfda3('0x35')]['sort']);_0x53c2e9[_0xfda3('0x3f')]=qs[_0xfda3('0x37')](_[_0xfda3('0x40')](_0x2448b1[_0xfda3('0x35')],_0x1a278c[_0xfda3('0x37')]));if(_0x2448b1[_0xfda3('0x35')][_0xfda3('0x43')]){_0x53c2e9[_0xfda3('0x3f')]=_[_0xfda3('0x29')](_0x53c2e9[_0xfda3('0x3f')],{'$or':_['map'](_0x53c2e9[_0xfda3('0x39')],function(_0x271403){var _0x46210d={};_0x46210d[_0x271403]={'$like':'%'+_0x2448b1[_0xfda3('0x35')][_0xfda3('0x43')]+'%'};return _0x46210d;})});}_0x53c2e9=_['merge']({},_0x53c2e9,_0x2448b1['options']);return _0xa032b5[_0xfda3('0x56')](_0x53c2e9);}})[_0xfda3('0x23')](function(_0x120fe9){if(_0x120fe9){_0x4768dc=_0x120fe9[_0xfda3('0x3b')];if(!_0x2448b1[_0xfda3('0x35')][_0xfda3('0x54')](_0xfda3('0x3c'))){_0x53c2e9[_0xfda3('0x1b')]=qs[_0xfda3('0x1b')](_0x2448b1[_0xfda3('0x35')][_0xfda3('0x1b')]);_0x53c2e9['offset']=qs[_0xfda3('0x19')](_0x2448b1['query']['offset']);}return _0xa032b5['getActions'](_0x53c2e9);}})[_0xfda3('0x23')](function(_0x4a2c6a){if(_0x4a2c6a){return _0x4a2c6a?{'count':_0x4768dc,'rows':_0x4a2c6a}:null;}})[_0xfda3('0x23')](respondWithResult(_0x4c7435,null))[_0xfda3('0x46')](handleError(_0x4c7435,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 45bb85c..37fd850 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 _0x5ba3=['request-promise','path','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','../../config/logger','api','bluebird'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x5ba3,0x140));var _0x35ba=function(_0xb60e68,_0x5ea03b){_0xb60e68=_0xb60e68-0x0;var _0x5dae1e=_0x5ba3[_0xb60e68];return _0x5dae1e;};'use strict';var _=require(_0x35ba('0x0'));var util=require('util');var logger=require(_0x35ba('0x1'))(_0x35ba('0x2'));var moment=require('moment');var BPromise=require(_0x35ba('0x3'));var rp=require(_0x35ba('0x4'));var fs=require('fs');var path=require(_0x35ba('0x5'));var rimraf=require('rimraf');var config=require(_0x35ba('0x6'));var attributes=require(_0x35ba('0x7'));module[_0x35ba('0x8')]=function(_0x596785,_0x54c722){return _0x596785[_0x35ba('0x9')](_0x35ba('0xa'),attributes,{'tableName':_0x35ba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17a4=['moment','request-promise','path','rimraf','./automation.attributes','exports','define','Automation','lodash','util','../../config/logger','api'];(function(_0x44c83b,_0x103aca){var _0x169eb4=function(_0x1c1a0d){while(--_0x1c1a0d){_0x44c83b['push'](_0x44c83b['shift']());}};_0x169eb4(++_0x103aca);}(_0x17a4,0x68));var _0x417a=function(_0x8e8ca7,_0x5a5e07){_0x8e8ca7=_0x8e8ca7-0x0;var _0x561381=_0x17a4[_0x8e8ca7];return _0x561381;};'use strict';var _=require(_0x417a('0x0'));var util=require(_0x417a('0x1'));var logger=require(_0x417a('0x2'))(_0x417a('0x3'));var moment=require(_0x417a('0x4'));var BPromise=require('bluebird');var rp=require(_0x417a('0x5'));var fs=require('fs');var path=require(_0x417a('0x6'));var rimraf=require(_0x417a('0x7'));var config=require('../../config/environment');var attributes=require(_0x417a('0x8'));module[_0x417a('0x9')]=function(_0x17c98f,_0x46a712){return _0x17c98f[_0x417a('0xa')](_0x417a('0xb'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index bc67f80..8340346 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 _0x160c=['message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','debug','error','code'];(function(_0x2d7c0f,_0x1ed3e8){var _0x268aa0=function(_0x51605c){while(--_0x51605c){_0x2d7c0f['push'](_0x2d7c0f['shift']());}};_0x268aa0(++_0x1ed3e8);}(_0x160c,0x122));var _0xc160=function(_0x59e73d,_0x4d7ff8){_0x59e73d=_0x59e73d-0x0;var _0x58c214=_0x160c[_0x59e73d];return _0x58c214;};'use strict';var _=require(_0xc160('0x0'));var util=require(_0xc160('0x1'));var moment=require(_0xc160('0x2'));var BPromise=require('bluebird');var rs=require(_0xc160('0x3'));var fs=require('fs');var Redis=require(_0xc160('0x4'));var db=require(_0xc160('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc160('0x6'))(_0xc160('0x7'));var config=require(_0xc160('0x8'));var jayson=require(_0xc160('0x9'));var client=jayson[_0xc160('0xa')][_0xc160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20a0d8,_0x380d2a,_0x53f8e5){return new BPromise(function(_0x38618,_0x456b0c){return client[_0xc160('0xc')](_0x20a0d8,_0x53f8e5)['then'](function(_0x465e45){logger[_0xc160('0xd')](_0xc160('0xe'),_0x380d2a,'request\x20sent');logger[_0xc160('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x380d2a,'request\x20sent',JSON['stringify'](_0x465e45));if(_0x465e45[_0xc160('0x10')]){if(_0x465e45[_0xc160('0x10')][_0xc160('0x11')]===0x1f4){logger[_0xc160('0x10')](_0xc160('0xe'),_0x380d2a,_0x465e45['error'][_0xc160('0x12')]);return _0x456b0c(_0x465e45['error']['message']);}logger['error'](_0xc160('0xe'),_0x380d2a,_0x465e45[_0xc160('0x10')]['message']);return _0x38618(_0x465e45['error']['message']);}else{logger['info'](_0xc160('0xe'),_0x380d2a,_0xc160('0x13'));_0x38618(_0x465e45[_0xc160('0x14')][_0xc160('0x12')]);}})[_0xc160('0x15')](function(_0x504499){logger[_0xc160('0x10')]('Automation,\x20%s,\x20%s',_0x380d2a,_0x504499);_0x456b0c(_0x504499);});});} \ No newline at end of file +var _0x2260=['Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Automation,\x20%s,\x20%s','request\x20sent'];(function(_0x50be30,_0x55a0ca){var _0x5a6441=function(_0x516a5d){while(--_0x516a5d){_0x50be30['push'](_0x50be30['shift']());}};_0x5a6441(++_0x55a0ca);}(_0x2260,0x156));var _0x0226=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x2260[_0x5bd426];return _0x23a7eb;};'use strict';var _=require('lodash');var util=require(_0x0226('0x0'));var moment=require(_0x0226('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0226('0x2'));var db=require(_0x0226('0x3'))['db'];var utils=require(_0x0226('0x4'));var logger=require(_0x0226('0x5'))(_0x0226('0x6'));var config=require(_0x0226('0x7'));var jayson=require(_0x0226('0x8'));var client=jayson[_0x0226('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x591e2,_0x4e94df,_0x24a257){return new BPromise(function(_0xd1fa21,_0x35fd33){return client[_0x0226('0xa')](_0x591e2,_0x24a257)[_0x0226('0xb')](function(_0x443686){logger[_0x0226('0xc')](_0x0226('0xd'),_0x4e94df,_0x0226('0xe'));logger['debug'](_0x0226('0xf'),_0x4e94df,_0x0226('0xe'),JSON[_0x0226('0x10')](_0x443686));if(_0x443686['error']){if(_0x443686['error']['code']===0x1f4){logger[_0x0226('0x11')](_0x0226('0xd'),_0x4e94df,_0x443686[_0x0226('0x11')][_0x0226('0x12')]);return _0x35fd33(_0x443686[_0x0226('0x11')]['message']);}logger['error'](_0x0226('0xd'),_0x4e94df,_0x443686[_0x0226('0x11')][_0x0226('0x12')]);return _0xd1fa21(_0x443686[_0x0226('0x11')]['message']);}else{logger[_0x0226('0xc')]('Automation,\x20%s,\x20%s',_0x4e94df,_0x0226('0xe'));_0xd1fa21(_0x443686[_0x0226('0x13')][_0x0226('0x12')]);}})[_0x0226('0x14')](function(_0x2ce8d0){logger[_0x0226('0x11')](_0x0226('0xd'),_0x4e94df,_0x2ce8d0);_0x35fd33(_0x2ce8d0);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 81d740a..550aa42 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 _0x878c=['show','get','/:id/conditions','getConditions','/:id/actions','post','create','addConditions','addActions','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','/:id'];(function(_0x1623de,_0x13c233){var _0x5dab0d=function(_0x45ffa8){while(--_0x45ffa8){_0x1623de['push'](_0x1623de['shift']());}};_0x5dab0d(++_0x13c233);}(_0x878c,0xe6));var _0xc878=function(_0x2db5cf,_0x330d5c){_0x2db5cf=_0x2db5cf-0x0;var _0x45b1b=_0x878c[_0x2db5cf];return _0x45b1b;};'use strict';var multer=require(_0xc878('0x0'));var util=require(_0xc878('0x1'));var path=require(_0xc878('0x2'));var timeout=require('connect-timeout');var express=require(_0xc878('0x3'));var router=express[_0xc878('0x4')]();var fs_extra=require(_0xc878('0x5'));var auth=require(_0xc878('0x6'));var interaction=require(_0xc878('0x7'));var config=require(_0xc878('0x8'));var controller=require(_0xc878('0x9'));router['get']('/',auth[_0xc878('0xa')](),controller[_0xc878('0xb')]);router['get'](_0xc878('0xc'),auth[_0xc878('0xa')](),controller[_0xc878('0xd')]);router[_0xc878('0xe')](_0xc878('0xf'),auth[_0xc878('0xa')](),controller[_0xc878('0x10')]);router[_0xc878('0xe')](_0xc878('0x11'),auth['isAuthenticated'](),controller['getActions']);router[_0xc878('0x12')]('/',auth['isAuthenticated'](),controller[_0xc878('0x13')]);router[_0xc878('0x12')](_0xc878('0xf'),auth['isAuthenticated'](),controller[_0xc878('0x14')]);router[_0xc878('0x12')]('/:id/actions',auth[_0xc878('0xa')](),controller[_0xc878('0x15')]);router[_0xc878('0x16')](_0xc878('0xc'),auth[_0xc878('0xa')](),controller[_0xc878('0x17')]);router[_0xc878('0x18')](_0xc878('0xc'),auth['isAuthenticated'](),controller[_0xc878('0x19')]);module[_0xc878('0x1a')]=router; \ No newline at end of file +var _0x6a54=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./automation.controller','get','index','/:id','show','/:id/conditions','getConditions','/:id/actions','isAuthenticated','getActions','post','addConditions','addActions','delete','destroy'];(function(_0x223c0d,_0x3ec04d){var _0x207827=function(_0x39d240){while(--_0x39d240){_0x223c0d['push'](_0x223c0d['shift']());}};_0x207827(++_0x3ec04d);}(_0x6a54,0xf1));var _0x46a5=function(_0x29f8a6,_0x307342){_0x29f8a6=_0x29f8a6-0x0;var _0x38d8fe=_0x6a54[_0x29f8a6];return _0x38d8fe;};'use strict';var multer=require(_0x46a5('0x0'));var util=require(_0x46a5('0x1'));var path=require(_0x46a5('0x2'));var timeout=require(_0x46a5('0x3'));var express=require(_0x46a5('0x4'));var router=express[_0x46a5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x46a5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x46a5('0x7'));var controller=require(_0x46a5('0x8'));router[_0x46a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x46a5('0xa')]);router[_0x46a5('0x9')](_0x46a5('0xb'),auth['isAuthenticated'](),controller[_0x46a5('0xc')]);router['get'](_0x46a5('0xd'),auth['isAuthenticated'](),controller[_0x46a5('0xe')]);router[_0x46a5('0x9')](_0x46a5('0xf'),auth[_0x46a5('0x10')](),controller[_0x46a5('0x11')]);router[_0x46a5('0x12')]('/',auth[_0x46a5('0x10')](),controller['create']);router[_0x46a5('0x12')]('/:id/conditions',auth[_0x46a5('0x10')](),controller[_0x46a5('0x13')]);router[_0x46a5('0x12')](_0x46a5('0xf'),auth[_0x46a5('0x10')](),controller[_0x46a5('0x14')]);router['put'](_0x46a5('0xb'),auth[_0x46a5('0x10')](),controller['update']);router[_0x46a5('0x15')](_0x46a5('0xb'),auth[_0x46a5('0x10')](),controller[_0x46a5('0x16')]);module[_0x46a5('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 831805d..c64dd71 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 _0xa6bb=['BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr'];(function(_0x45d385,_0x3dc59e){var _0x631a03=function(_0x407703){while(--_0x407703){_0x45d385['push'](_0x45d385['shift']());}};_0x631a03(++_0x3dc59e);}(_0xa6bb,0xaa));var _0xba6b=function(_0x4406dc,_0x5a777a){_0x4406dc=_0x4406dc-0x0;var _0x38fd3d=_0xa6bb[_0x4406dc];return _0x38fd3d;};'use strict';var Sequelize=require(_0xba6b('0x0'));module['exports']={'name':{'type':Sequelize[_0xba6b('0x1')],'unique':_0xba6b('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xba6b('0x3')](_0xba6b('0x4')),'allowNull':![],'defaultValue':_0xba6b('0x4')},'description':{'type':Sequelize[_0xba6b('0x1')]},'active':{'type':Sequelize[_0xba6b('0x5')],'defaultValue':0x0,'comment':_0xba6b('0x6')},'limitCalls':{'type':Sequelize[_0xba6b('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xba6b('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xba6b('0x7')](0x3)[_0xba6b('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba6b('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xba6b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba6b('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xba6b('0x7')](0x3)[_0xba6b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba6b('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xba6b('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba6b('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xba6b('0x7')](0x3)[_0xba6b('0x8')],'defaultValue':0x3,'comment':_0xba6b('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xba6b('0x7')](0x5)[_0xba6b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba6b('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xba6b('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xba6b('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xba6b('0x1')],'defaultValue':_0xba6b('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xba6b('0x3')]('always','never',_0xba6b('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xba6b('0x5')],'defaultValue':0x0,'comment':_0xba6b('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xba6b('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xba6b('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xba6b('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xba6b('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xba6b('0x7')](0x9)[_0xba6b('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xba6b('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xba6b('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xba6b('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xba6b('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xba6b('0x7')](0x9)[_0xba6b('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xba6b('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xba6b('0x7')](0x5)[_0xba6b('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xba6b('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xba6b('0x7')](0x9)[_0xba6b('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xba6b('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xba6b('0x3')](_0xba6b('0x1a'),'ASC'),'defaultValue':_0xba6b('0x1a')},'dialPrefix':{'type':Sequelize[_0xba6b('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xba6b('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xba6b('0x1b')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xba6b('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xba6b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba6b('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xba6b('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba6b('0x1d')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xba6b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba6b('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xba6b('0x7')](0x3)[_0xba6b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xba6b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba6b('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0xba6b('0x7')](0x3)[_0xba6b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba6b('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0xba6b('0x7')](0x5)[_0xba6b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xba6b('0x7')](0x3)[_0xba6b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba6b('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xba6b('0x7')](0x5)[_0xba6b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba6b('0x22')}}; \ No newline at end of file +var _0xd5c6=['UNSIGNED','Max\x20200\x20calls.','INTEGER','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#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)','STRING','ENUM','ivr'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd5c6,0xa7));var _0x6d5c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd5c6[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6d5c('0x0')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x6d5c('0x1')]('ivr'),'allowNull':![],'defaultValue':_0x6d5c('0x2')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x6d5c('0x3')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x6d5c('0x4')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6d5c('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6d5c('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x6d5c('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d5c('0x6')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6d5c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d5c('0x7')},'dialBusyMaxRetry':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d5c('0x8')},'dialBusyRetryFrequency':{'type':Sequelize[_0x6d5c('0x5')](0x5)[_0x6d5c('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d5c('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6d5c('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6d5c('0x5')](0x5)[_0x6d5c('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d5c('0xa')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6d5c('0xb')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6d5c('0x0')],'defaultValue':_0x6d5c('0xc')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x6d5c('0xd')],'defaultValue':0x0,'comment':_0x6d5c('0xe')},'dialAMDInitialSilence':{'type':Sequelize[_0x6d5c('0x5')](0x9)[_0x6d5c('0x3')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6d5c('0xf')},'dialAMDGreeting':{'type':Sequelize[_0x6d5c('0x5')](0x9)[_0x6d5c('0x3')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6d5c('0x10')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6d5c('0x5')](0x9)[_0x6d5c('0x3')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x6d5c('0x3')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6d5c('0x11')},'dialAMDMinWordLength':{'type':Sequelize[_0x6d5c('0x5')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6d5c('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6d5c('0x12')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x6d5c('0x3')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6d5c('0x13')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6d5c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6d5c('0x14')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x6d5c('0x3')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6d5c('0x15')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x6d5c('0x16'),_0x6d5c('0x17')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x6d5c('0x0')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6d5c('0x18')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d5c('0x19')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6d5c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d5c('0x1a')},'dialDropMaxRetry':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d5c('0x1b')},'dialDropRetryFrequency':{'type':Sequelize[_0x6d5c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d5c('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d5c('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6d5c('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6d5c('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d5c('0x1e')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6d5c('0x5')](0x5)[_0x6d5c('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d5c('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d5c('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6d5c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d5c('0x21')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index bfac26d..e23e26a 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 _0x0edf=['CmHopper','hasOwnProperty','CampaignId','findAll','getHopperHistories','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','omit','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','field','CmListId','toString','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','from','onlyIfOpen','insert','ContactId','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','push','removeBlackLists','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','error','name','send','merge','body','contact','message','agent','interaction','account','index','map','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','model','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','options','Campaign','includeAll','include','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','getHoppers','findOne'];(function(_0x46a2d0,_0x25686f){var _0x120d40=function(_0x361aef){while(--_0x361aef){_0x46a2d0['push'](_0x46a2d0['shift']());}};_0x120d40(++_0x25686f);}(_0x0edf,0x147));var _0xf0ed=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x0edf[_0x279d37];return _0x530173;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf0ed('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0ed('0x1'));var rp=require(_0xf0ed('0x2'));var moment=require(_0xf0ed('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf0ed('0x4'));var sox=require(_0xf0ed('0x5'));var csv=require(_0xf0ed('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf0ed('0x7'));var _=require(_0xf0ed('0x8'));var squel=require(_0xf0ed('0x9'));var crypto=require(_0xf0ed('0xa'));var jsforce=require(_0xf0ed('0xb'));var deskjs=require(_0xf0ed('0xc'));var toCsv=require(_0xf0ed('0x6'));var querystring=require(_0xf0ed('0xd'));var Papa=require(_0xf0ed('0xe'));var Redis=require(_0xf0ed('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf0ed('0x10'));var as=require(_0xf0ed('0x11'));var hardwareService=require(_0xf0ed('0x12'));var logger=require('../../config/logger')(_0xf0ed('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf0ed('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5444f2,_0x5e8560){_0x5e8560=_0x5e8560||0xcc;return function(_0x1bcf94){if(_0x1bcf94){return _0x5444f2[_0xf0ed('0x15')](_0x5e8560);}return _0x5444f2['status'](_0x5e8560)[_0xf0ed('0x16')]();};}function respondWithResult(_0x5e64a0,_0x3f00c6){_0x3f00c6=_0x3f00c6||0xc8;return function(_0x5b38cb){if(_0x5b38cb){return _0x5e64a0[_0xf0ed('0x17')](_0x3f00c6)[_0xf0ed('0x18')](_0x5b38cb);}};}function respondWithFilteredResult(_0x334877,_0x6156c4){return function(_0x48bf3e){if(_0x48bf3e){var _0x12af51=typeof _0x6156c4[_0xf0ed('0x19')]==='undefined'&&typeof _0x6156c4[_0xf0ed('0x1a')]===_0xf0ed('0x1b');var _0x1cde68=_0x48bf3e[_0xf0ed('0x1c')];var _0x4da0da=_0x12af51?0x0:_0x6156c4[_0xf0ed('0x19')];var _0x5a5394=_0x12af51?_0x48bf3e[_0xf0ed('0x1c')]:_0x6156c4[_0xf0ed('0x19')]+_0x6156c4[_0xf0ed('0x1a')];var _0x82ec74;if(_0x5a5394>=_0x1cde68){_0x5a5394=_0x1cde68;_0x82ec74=0xc8;}else{_0x82ec74=0xce;}_0x334877[_0xf0ed('0x17')](_0x82ec74);return _0x334877['set'](_0xf0ed('0x1d'),_0x4da0da+'-'+_0x5a5394+'/'+_0x1cde68)['json'](_0x48bf3e);}return null;};}function patchUpdates(_0x3d6dc3){return function(_0x3174d2){try{jsonpatch[_0xf0ed('0x1e')](_0x3174d2,_0x3d6dc3,!![]);}catch(_0x28915c){return BPromise[_0xf0ed('0x1f')](_0x28915c);}return _0x3174d2[_0xf0ed('0x20')]();};}function saveUpdates(_0x59ddde,_0x43cb77){return function(_0x44d8f4){if(_0x44d8f4){return _0x44d8f4[_0xf0ed('0x21')](_0x59ddde)[_0xf0ed('0x22')](function(_0x43f5ea){return _0x43f5ea;});}return null;};}function removeEntity(_0x46f734,_0x458a56){return function(_0x561225){if(_0x561225){return _0x561225['destroy']()['then'](function(){var _0x5733df=_0x561225[_0xf0ed('0x23')]({'plain':!![]});var _0x48422f=_0xf0ed('0x24');return db[_0xf0ed('0x25')][_0xf0ed('0x26')]({'where':{'type':_0x48422f,'resourceId':_0x5733df['id']}})[_0xf0ed('0x22')](function(){return _0x561225;});})[_0xf0ed('0x22')](function(){_0x46f734['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12aab0,_0x5b8143){return function(_0x226736){if(!_0x226736){_0x12aab0[_0xf0ed('0x15')](0x194);}return _0x226736;};}function handleError(_0x1022f6,_0x5904d9){_0x5904d9=_0x5904d9||0x1f4;return function(_0x5c14cc){logger[_0xf0ed('0x27')](_0x5c14cc['stack']);if(_0x5c14cc[_0xf0ed('0x28')]){delete _0x5c14cc[_0xf0ed('0x28')];}_0x1022f6[_0xf0ed('0x17')](_0x5904d9)[_0xf0ed('0x29')](_0x5c14cc);};}function getMustacheRender(_0x20e9a5,_0x1c9ebb){return Mustache['render'](_0x20e9a5,_[_0xf0ed('0x2a')](_0x1c9ebb[_0xf0ed('0x2b')],{'contact':_0x1c9ebb[_0xf0ed('0x2c')],'message':_0x1c9ebb[_0xf0ed('0x2d')],'agent':_0x1c9ebb[_0xf0ed('0x2e')],'interaction':_0x1c9ebb[_0xf0ed('0x2f')],'account':_0x1c9ebb[_0xf0ed('0x30')]}))||'';}exports[_0xf0ed('0x31')]=function(_0x289072,_0x2602f2){var _0x5628f7={},_0x11a3eb={},_0x4bcda0={'count':0x0,'rows':[]};var _0x9990c=_[_0xf0ed('0x32')](db['Campaign'][_0xf0ed('0x33')],function(_0x19ae67){return{'name':_0x19ae67[_0xf0ed('0x34')],'type':_0x19ae67[_0xf0ed('0x35')]['key']};});_0x11a3eb['model']=_[_0xf0ed('0x32')](_0x9990c,'name');_0x11a3eb[_0xf0ed('0x36')]=_[_0xf0ed('0x37')](_0x289072['query']);_0x11a3eb[_0xf0ed('0x38')]=_['intersection'](_0x11a3eb['model'],_0x11a3eb[_0xf0ed('0x36')]);_0x5628f7[_0xf0ed('0x39')]=_[_0xf0ed('0x3a')](_0x11a3eb[_0xf0ed('0x3b')],qs[_0xf0ed('0x3c')](_0x289072[_0xf0ed('0x36')][_0xf0ed('0x3c')]));_0x5628f7['attributes']=_0x5628f7['attributes'][_0xf0ed('0x3d')]?_0x5628f7[_0xf0ed('0x39')]:_0x11a3eb['model'];if(!_0x289072['query']['hasOwnProperty'](_0xf0ed('0x3e'))){_0x5628f7[_0xf0ed('0x1a')]=qs[_0xf0ed('0x1a')](_0x289072[_0xf0ed('0x36')][_0xf0ed('0x1a')]);_0x5628f7['offset']=qs[_0xf0ed('0x19')](_0x289072[_0xf0ed('0x36')][_0xf0ed('0x19')]);}_0x5628f7[_0xf0ed('0x3f')]=qs[_0xf0ed('0x40')](_0x289072[_0xf0ed('0x36')][_0xf0ed('0x40')]);_0x5628f7[_0xf0ed('0x41')]=qs[_0xf0ed('0x38')](_[_0xf0ed('0x42')](_0x289072[_0xf0ed('0x36')],_0x11a3eb[_0xf0ed('0x38')]),_0x9990c);if(_0x289072[_0xf0ed('0x36')]['filter']){_0x5628f7[_0xf0ed('0x41')]=_[_0xf0ed('0x2a')](_0x5628f7[_0xf0ed('0x41')],{'$or':_[_0xf0ed('0x32')](_0x9990c,function(_0x485c4a){if(_0x485c4a['type']!==_0xf0ed('0x43')){var _0x3bb131={};_0x3bb131[_0x485c4a[_0xf0ed('0x28')]]={'$like':'%'+_0x289072[_0xf0ed('0x36')][_0xf0ed('0x44')]+'%'};return _0x3bb131;}})});}_0x5628f7=_[_0xf0ed('0x2a')]({},_0x5628f7,_0x289072[_0xf0ed('0x45')]);var _0x1f7732={'where':_0x5628f7['where']};return db[_0xf0ed('0x46')][_0xf0ed('0x1c')](_0x1f7732)[_0xf0ed('0x22')](function(_0x27edf9){_0x4bcda0[_0xf0ed('0x1c')]=_0x27edf9;if(_0x289072['query'][_0xf0ed('0x47')]){_0x5628f7[_0xf0ed('0x48')]=[{'all':!![]}];}return db[_0xf0ed('0x46')]['findAll'](_0x5628f7);})[_0xf0ed('0x22')](function(_0x30609d){_0x4bcda0['rows']=_0x30609d;return _0x4bcda0;})[_0xf0ed('0x22')](respondWithFilteredResult(_0x2602f2,_0x5628f7))[_0xf0ed('0x49')](handleError(_0x2602f2,null));};exports[_0xf0ed('0x4a')]=function(_0x210573,_0x397e38){var _0x333264={'raw':![],'where':{'id':_0x210573[_0xf0ed('0x4b')]['id']}},_0x44a179={};_0x44a179[_0xf0ed('0x3b')]=_[_0xf0ed('0x37')](db['Campaign']['rawAttributes']);_0x44a179['query']=_['keys'](_0x210573[_0xf0ed('0x36')]);_0x44a179['filters']=_['intersection'](_0x44a179[_0xf0ed('0x3b')],_0x44a179[_0xf0ed('0x36')]);_0x333264[_0xf0ed('0x39')]=_[_0xf0ed('0x3a')](_0x44a179[_0xf0ed('0x3b')],qs['fields'](_0x210573[_0xf0ed('0x36')][_0xf0ed('0x3c')]));_0x333264[_0xf0ed('0x39')]=_0x333264[_0xf0ed('0x39')][_0xf0ed('0x3d')]?_0x333264[_0xf0ed('0x39')]:_0x44a179[_0xf0ed('0x3b')];if(_0x210573[_0xf0ed('0x36')][_0xf0ed('0x47')]){_0x333264[_0xf0ed('0x48')]=[{'all':!![]}];}_0x333264=_[_0xf0ed('0x2a')]({},_0x333264,_0x210573[_0xf0ed('0x45')]);return db[_0xf0ed('0x46')]['find'](_0x333264)[_0xf0ed('0x22')](handleEntityNotFound(_0x397e38,null))[_0xf0ed('0x22')](respondWithResult(_0x397e38,null))['catch'](handleError(_0x397e38,null));};exports['create']=function(_0x5ac21f,_0x57cc11){return db[_0xf0ed('0x46')][_0xf0ed('0x4c')](_0x5ac21f['body'],{})[_0xf0ed('0x22')](function(_0x319ec9){var _0x109e9f=_0x5ac21f[_0xf0ed('0x4d')][_0xf0ed('0x23')]({'plain':!![]});if(!_0x109e9f)throw new Error(_0xf0ed('0x4e'));if(_0x109e9f[_0xf0ed('0x4f')]===_0xf0ed('0x4d')){var _0x51a0f6=_0x319ec9[_0xf0ed('0x23')]({'plain':!![]});var _0x35d657=_0xf0ed('0x24');return db[_0xf0ed('0x50')][_0xf0ed('0x51')]({'where':{'name':_0x35d657,'userProfileId':_0x109e9f[_0xf0ed('0x52')]},'raw':!![]})['then'](function(_0x269b78){if(_0x269b78&&_0x269b78[_0xf0ed('0x53')]===0x0){return db[_0xf0ed('0x25')]['create']({'name':_0x51a0f6[_0xf0ed('0x28')],'resourceId':_0x51a0f6['id'],'type':_0x269b78[_0xf0ed('0x28')],'sectionId':_0x269b78['id']},{})['then'](function(){return _0x319ec9;});}else{return _0x319ec9;}})['catch'](function(_0x5eb17a){logger[_0xf0ed('0x27')](_0xf0ed('0x54'),_0x5eb17a);throw _0x5eb17a;});}return _0x319ec9;})[_0xf0ed('0x22')](respondWithResult(_0x57cc11,0xc9))[_0xf0ed('0x49')](handleError(_0x57cc11,null));};exports[_0xf0ed('0x55')]=function(_0x216248,_0x243c70){var _0x58fcc4={'where':{'id':_0x216248['params']['id']}},_0x161819={};_0x161819[_0xf0ed('0x3b')]=_['keys'](db[_0xf0ed('0x46')][_0xf0ed('0x33')]);_0x58fcc4[_0xf0ed('0x39')]=_[_0xf0ed('0x3a')](_0x161819['model'],qs[_0xf0ed('0x3c')](_0x216248[_0xf0ed('0x36')][_0xf0ed('0x3c')]));_0x58fcc4[_0xf0ed('0x39')]=_0x58fcc4[_0xf0ed('0x39')]['length']?_0x58fcc4[_0xf0ed('0x39')]:_0x161819[_0xf0ed('0x3b')];if(_0x216248['query'][_0xf0ed('0x47')]){_0x58fcc4[_0xf0ed('0x48')]=[{'all':!![]}];}_0x58fcc4=_[_0xf0ed('0x2a')]({},_0x58fcc4,_0x216248[_0xf0ed('0x45')]);return db['Campaign'][_0xf0ed('0x51')](_0x58fcc4)['then'](handleEntityNotFound(_0x243c70,null))['then'](function(_0x56f6b9){if(_0x56f6b9){var _0xc58e69=_0x56f6b9[_0xf0ed('0x23')]({'plain':!![]});_0xc58e69=qs['omit'](_0xc58e69,['id',_0xf0ed('0x56'),_0xf0ed('0x57')]);_0x216248['body']=_['omit'](_0x216248[_0xf0ed('0x2b')],['id','createdAt','updatedAt']);return db[_0xf0ed('0x46')][_0xf0ed('0x4c')](_[_0xf0ed('0x2a')](_0xc58e69,_0x216248[_0xf0ed('0x2b')]),{'include':_0x216248['query'][_0xf0ed('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x5c69df){var _0x1adf2e=_0x216248[_0xf0ed('0x4d')]['get']({'plain':!![]});if(!_0x1adf2e)throw new Error(_0xf0ed('0x4e'));if(_0x1adf2e[_0xf0ed('0x4f')]===_0xf0ed('0x4d')){var _0x38faf6=_0x5c69df[_0xf0ed('0x23')]({'plain':!![]});var _0x17e888=_0xf0ed('0x24');return db[_0xf0ed('0x50')][_0xf0ed('0x51')]({'where':{'name':_0x17e888,'userProfileId':_0x1adf2e[_0xf0ed('0x52')]},'raw':!![]})['then'](function(_0x5723cf){if(_0x5723cf&&_0x5723cf[_0xf0ed('0x53')]===0x0){return db[_0xf0ed('0x25')][_0xf0ed('0x4c')]({'name':_0x38faf6[_0xf0ed('0x28')],'resourceId':_0x38faf6['id'],'type':_0x5723cf['name'],'sectionId':_0x5723cf['id']},{})[_0xf0ed('0x22')](function(){return _0x5c69df;});}else{return _0x5c69df;}})[_0xf0ed('0x49')](function(_0x3aef8b){logger[_0xf0ed('0x27')](_0xf0ed('0x54'),_0x3aef8b);throw _0x3aef8b;});}return _0x5c69df;});}})['then'](respondWithResult(_0x243c70,0xc9))['catch'](handleError(_0x243c70,null));};exports[_0xf0ed('0x21')]=function(_0x4554f7,_0x226d9d){if(_0x4554f7[_0xf0ed('0x2b')]['id']){delete _0x4554f7[_0xf0ed('0x2b')]['id'];}return db['Campaign'][_0xf0ed('0x51')]({'where':{'id':_0x4554f7[_0xf0ed('0x4b')]['id']}})['then'](handleEntityNotFound(_0x226d9d,null))['then'](saveUpdates(_0x4554f7[_0xf0ed('0x2b')],null))['then'](respondWithResult(_0x226d9d,null))['catch'](handleError(_0x226d9d,null));};exports[_0xf0ed('0x26')]=function(_0x42781e,_0x20a520){return db[_0xf0ed('0x46')][_0xf0ed('0x51')]({'where':{'id':_0x42781e[_0xf0ed('0x4b')]['id']}})[_0xf0ed('0x22')](handleEntityNotFound(_0x20a520,null))['then'](removeEntity(_0x20a520,null))['catch'](handleError(_0x20a520,null));};exports[_0xf0ed('0x58')]=function(_0x1f0871,_0xe86367,_0x1c5ed3){var _0xd3d29a={'raw':!![],'where':{}};var _0x428c6a={};var _0x9cdb78={'count':0x0,'rows':[]};return db[_0xf0ed('0x46')][_0xf0ed('0x59')]({'where':{'id':_0x1f0871[_0xf0ed('0x4b')]['id']}})[_0xf0ed('0x22')](handleEntityNotFound(_0xe86367,null))[_0xf0ed('0x22')](function(_0x47714d){if(_0x47714d){_0x428c6a['model']=_[_0xf0ed('0x37')](db[_0xf0ed('0x5a')]['rawAttributes']);_0x428c6a[_0xf0ed('0x36')]=_[_0xf0ed('0x37')](_0x1f0871[_0xf0ed('0x36')]);_0x428c6a[_0xf0ed('0x38')]=_[_0xf0ed('0x3a')](_0x428c6a['model'],_0x428c6a[_0xf0ed('0x36')]);_0xd3d29a[_0xf0ed('0x39')]=_[_0xf0ed('0x3a')](_0x428c6a[_0xf0ed('0x3b')],qs['fields'](_0x1f0871[_0xf0ed('0x36')][_0xf0ed('0x3c')]));_0xd3d29a[_0xf0ed('0x39')]=_0xd3d29a[_0xf0ed('0x39')][_0xf0ed('0x3d')]?_0xd3d29a[_0xf0ed('0x39')]:_0x428c6a[_0xf0ed('0x3b')];if(!_0x1f0871[_0xf0ed('0x36')][_0xf0ed('0x5b')](_0xf0ed('0x3e'))){_0xd3d29a['limit']=qs[_0xf0ed('0x1a')](_0x1f0871[_0xf0ed('0x36')][_0xf0ed('0x1a')]);_0xd3d29a['offset']=qs[_0xf0ed('0x19')](_0x1f0871[_0xf0ed('0x36')]['offset']);}_0xd3d29a['order']=qs['sort'](_0x1f0871['query'][_0xf0ed('0x40')]);_0xd3d29a['where']=qs['filters'](_[_0xf0ed('0x42')](_0x1f0871[_0xf0ed('0x36')],_0x428c6a[_0xf0ed('0x38')]));_0xd3d29a['where'][_0xf0ed('0x5c')]=_0x47714d['id'];if(_0x1f0871[_0xf0ed('0x36')][_0xf0ed('0x44')]){_0xd3d29a['where']=_[_0xf0ed('0x2a')](_0xd3d29a[_0xf0ed('0x41')],{'$or':_[_0xf0ed('0x32')](_0xd3d29a['attributes'],function(_0x57ec21){var _0x3b0e55={};_0x3b0e55[_0x57ec21]={'$like':'%'+_0x1f0871[_0xf0ed('0x36')][_0xf0ed('0x44')]+'%'};return _0x3b0e55;})});}_0xd3d29a=_[_0xf0ed('0x2a')]({},_0xd3d29a,_0x1f0871['options']);return db[_0xf0ed('0x5a')][_0xf0ed('0x1c')]({'where':_0xd3d29a[_0xf0ed('0x41')]})[_0xf0ed('0x22')](function(_0x3d1723){_0x9cdb78['count']=_0x3d1723;if(_0x1f0871[_0xf0ed('0x36')]['includeAll']){_0xd3d29a['include']=[{'all':!![]}];}return db['CmHopper'][_0xf0ed('0x5d')](_0xd3d29a);})['then'](function(_0x35f673){_0x9cdb78['rows']=_0x35f673;return _0x9cdb78;});}})['then'](respondWithFilteredResult(_0xe86367,_0xd3d29a))['catch'](handleError(_0xe86367,null));};exports[_0xf0ed('0x5e')]=function(_0x593c0a,_0x4ea2a7,_0x9456f5){var _0x459a98={'raw':!![],'where':{}};var _0x4ba886={};var _0x1bcd89={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x593c0a['params']['id']}})[_0xf0ed('0x22')](handleEntityNotFound(_0x4ea2a7,null))[_0xf0ed('0x22')](function(_0xd1d670){if(_0xd1d670){_0x4ba886[_0xf0ed('0x3b')]=_[_0xf0ed('0x37')](db[_0xf0ed('0x5f')][_0xf0ed('0x33')]);_0x4ba886['query']=_[_0xf0ed('0x37')](_0x593c0a[_0xf0ed('0x36')]);_0x4ba886[_0xf0ed('0x38')]=_[_0xf0ed('0x3a')](_0x4ba886[_0xf0ed('0x3b')],_0x4ba886[_0xf0ed('0x36')]);_0x459a98[_0xf0ed('0x39')]=_['intersection'](_0x4ba886[_0xf0ed('0x3b')],qs[_0xf0ed('0x3c')](_0x593c0a['query'][_0xf0ed('0x3c')]));_0x459a98[_0xf0ed('0x39')]=_0x459a98[_0xf0ed('0x39')][_0xf0ed('0x3d')]?_0x459a98[_0xf0ed('0x39')]:_0x4ba886[_0xf0ed('0x3b')];if(!_0x593c0a[_0xf0ed('0x36')][_0xf0ed('0x5b')](_0xf0ed('0x3e'))){_0x459a98[_0xf0ed('0x1a')]=qs[_0xf0ed('0x1a')](_0x593c0a[_0xf0ed('0x36')][_0xf0ed('0x1a')]);_0x459a98[_0xf0ed('0x19')]=qs[_0xf0ed('0x19')](_0x593c0a[_0xf0ed('0x36')][_0xf0ed('0x19')]);}_0x459a98[_0xf0ed('0x3f')]=qs[_0xf0ed('0x40')](_0x593c0a[_0xf0ed('0x36')][_0xf0ed('0x40')]);_0x459a98[_0xf0ed('0x41')]=qs[_0xf0ed('0x38')](_[_0xf0ed('0x42')](_0x593c0a['query'],_0x4ba886[_0xf0ed('0x38')]));_0x459a98[_0xf0ed('0x41')][_0xf0ed('0x5c')]=_0xd1d670['id'];if(_0x593c0a[_0xf0ed('0x36')][_0xf0ed('0x44')]){_0x459a98[_0xf0ed('0x41')]=_['merge'](_0x459a98['where'],{'$or':_['map'](_0x459a98['attributes'],function(_0x46a0ff){var _0x5ce1e2={};_0x5ce1e2[_0x46a0ff]={'$like':'%'+_0x593c0a['query'][_0xf0ed('0x44')]+'%'};return _0x5ce1e2;})});}_0x459a98=_[_0xf0ed('0x2a')]({},_0x459a98,_0x593c0a[_0xf0ed('0x45')]);return db[_0xf0ed('0x5f')]['count']({'where':_0x459a98[_0xf0ed('0x41')]})[_0xf0ed('0x22')](function(_0x28bd50){_0x1bcd89['count']=_0x28bd50;if(_0x593c0a[_0xf0ed('0x36')]['includeAll']){_0x459a98[_0xf0ed('0x48')]=[{'all':!![]}];}return db[_0xf0ed('0x5f')][_0xf0ed('0x5d')](_0x459a98);})[_0xf0ed('0x22')](function(_0x3eb35a){_0x1bcd89[_0xf0ed('0x60')]=_0x3eb35a;return _0x1bcd89;});}})[_0xf0ed('0x22')](respondWithFilteredResult(_0x4ea2a7,_0x459a98))[_0xf0ed('0x49')](handleError(_0x4ea2a7,null));};exports[_0xf0ed('0x61')]=function(_0x4a8007,_0x548f79,_0x436e69){var _0x413f3c={'raw':!![],'where':{}};var _0x5d2e19={};var _0x4b304a={'count':0x0,'rows':[]};return db[_0xf0ed('0x46')][_0xf0ed('0x59')]({'where':{'id':_0x4a8007[_0xf0ed('0x4b')]['id']}})['then'](handleEntityNotFound(_0x548f79,null))[_0xf0ed('0x22')](function(_0x4389ec){if(_0x4389ec){_0x5d2e19[_0xf0ed('0x3b')]=_['keys'](db[_0xf0ed('0x62')][_0xf0ed('0x33')]);_0x5d2e19['query']=_[_0xf0ed('0x37')](_0x4a8007[_0xf0ed('0x36')]);_0x5d2e19[_0xf0ed('0x38')]=_[_0xf0ed('0x3a')](_0x5d2e19['model'],_0x5d2e19[_0xf0ed('0x36')]);_0x413f3c[_0xf0ed('0x39')]=_[_0xf0ed('0x3a')](_0x5d2e19[_0xf0ed('0x3b')],qs[_0xf0ed('0x3c')](_0x4a8007[_0xf0ed('0x36')]['fields']));_0x413f3c[_0xf0ed('0x39')]=_0x413f3c[_0xf0ed('0x39')][_0xf0ed('0x3d')]?_0x413f3c[_0xf0ed('0x39')]:_0x5d2e19[_0xf0ed('0x3b')];if(!_0x4a8007[_0xf0ed('0x36')][_0xf0ed('0x5b')](_0xf0ed('0x3e'))){_0x413f3c[_0xf0ed('0x1a')]=qs['limit'](_0x4a8007[_0xf0ed('0x36')][_0xf0ed('0x1a')]);_0x413f3c['offset']=qs[_0xf0ed('0x19')](_0x4a8007[_0xf0ed('0x36')]['offset']);}_0x413f3c['order']=qs[_0xf0ed('0x40')](_0x4a8007[_0xf0ed('0x36')]['sort']);_0x413f3c[_0xf0ed('0x41')]=qs[_0xf0ed('0x38')](_['pick'](_0x4a8007[_0xf0ed('0x36')],_0x5d2e19[_0xf0ed('0x38')]));_0x413f3c[_0xf0ed('0x41')][_0xf0ed('0x5c')]=_0x4389ec['id'];if(_0x4a8007[_0xf0ed('0x36')][_0xf0ed('0x44')]){_0x413f3c['where']=_['merge'](_0x413f3c['where'],{'$or':_['map'](_0x413f3c[_0xf0ed('0x39')],function(_0x353f84){var _0x181e1d={};_0x181e1d[_0x353f84]={'$like':'%'+_0x4a8007[_0xf0ed('0x36')][_0xf0ed('0x44')]+'%'};return _0x181e1d;})});}_0x413f3c=_[_0xf0ed('0x2a')]({},_0x413f3c,_0x4a8007['options']);return db[_0xf0ed('0x62')][_0xf0ed('0x1c')]({'where':_0x413f3c[_0xf0ed('0x41')]})[_0xf0ed('0x22')](function(_0x1b0131){_0x4b304a[_0xf0ed('0x1c')]=_0x1b0131;if(_0x4a8007[_0xf0ed('0x36')][_0xf0ed('0x47')]){_0x413f3c[_0xf0ed('0x48')]=[{'all':!![]}];}return db[_0xf0ed('0x62')][_0xf0ed('0x5d')](_0x413f3c);})['then'](function(_0x3958a3){_0x4b304a['rows']=_0x3958a3;return _0x4b304a;});}})[_0xf0ed('0x22')](respondWithFilteredResult(_0x548f79,_0x413f3c))[_0xf0ed('0x49')](handleError(_0x548f79,null));};exports[_0xf0ed('0x63')]=function(_0xe98d53,_0x4eab5f,_0xe25db4){var _0x3ff2bf={'raw':!![],'where':{}};var _0x15f464={};var _0x2935d3={'count':0x0,'rows':[]};return db[_0xf0ed('0x46')][_0xf0ed('0x59')]({'where':{'id':_0xe98d53[_0xf0ed('0x4b')]['id']}})[_0xf0ed('0x22')](handleEntityNotFound(_0x4eab5f,null))['then'](function(_0x54be99){if(_0x54be99){_0x15f464[_0xf0ed('0x3b')]=_[_0xf0ed('0x37')](db[_0xf0ed('0x64')]['rawAttributes']);_0x15f464['query']=_[_0xf0ed('0x37')](_0xe98d53[_0xf0ed('0x36')]);_0x15f464[_0xf0ed('0x38')]=_[_0xf0ed('0x3a')](_0x15f464[_0xf0ed('0x3b')],_0x15f464['query']);_0x3ff2bf[_0xf0ed('0x39')]=_[_0xf0ed('0x3a')](_0x15f464['model'],qs['fields'](_0xe98d53['query'][_0xf0ed('0x3c')]));_0x3ff2bf['attributes']=_0x3ff2bf[_0xf0ed('0x39')]['length']?_0x3ff2bf[_0xf0ed('0x39')]:_0x15f464[_0xf0ed('0x3b')];if(!_0xe98d53[_0xf0ed('0x36')][_0xf0ed('0x5b')](_0xf0ed('0x3e'))){_0x3ff2bf[_0xf0ed('0x1a')]=qs['limit'](_0xe98d53[_0xf0ed('0x36')][_0xf0ed('0x1a')]);_0x3ff2bf['offset']=qs[_0xf0ed('0x19')](_0xe98d53[_0xf0ed('0x36')]['offset']);}_0x3ff2bf['order']=qs[_0xf0ed('0x40')](_0xe98d53[_0xf0ed('0x36')]['sort']);_0x3ff2bf[_0xf0ed('0x41')]=qs['filters'](_[_0xf0ed('0x42')](_0xe98d53[_0xf0ed('0x36')],_0x15f464[_0xf0ed('0x38')]));_0x3ff2bf[_0xf0ed('0x41')][_0xf0ed('0x5c')]=_0x54be99['id'];if(_0xe98d53[_0xf0ed('0x36')]['filter']){_0x3ff2bf[_0xf0ed('0x41')]=_[_0xf0ed('0x2a')](_0x3ff2bf[_0xf0ed('0x41')],{'$or':_['map'](_0x3ff2bf['attributes'],function(_0xb57fa9){var _0x50c984={};_0x50c984[_0xb57fa9]={'$like':'%'+_0xe98d53[_0xf0ed('0x36')][_0xf0ed('0x44')]+'%'};return _0x50c984;})});}_0x3ff2bf=_[_0xf0ed('0x2a')]({},_0x3ff2bf,_0xe98d53[_0xf0ed('0x45')]);return db[_0xf0ed('0x64')]['count']({'where':_0x3ff2bf['where']})[_0xf0ed('0x22')](function(_0x2d3868){_0x2935d3[_0xf0ed('0x1c')]=_0x2d3868;if(_0xe98d53[_0xf0ed('0x36')][_0xf0ed('0x47')]){_0x3ff2bf[_0xf0ed('0x48')]=[{'all':!![]}];}return db[_0xf0ed('0x64')]['findAll'](_0x3ff2bf);})[_0xf0ed('0x22')](function(_0x3349bf){_0x2935d3[_0xf0ed('0x60')]=_0x3349bf;return _0x2935d3;});}})['then'](respondWithFilteredResult(_0x4eab5f,_0x3ff2bf))[_0xf0ed('0x49')](handleError(_0x4eab5f,null));};exports[_0xf0ed('0x65')]=function(_0x228bda,_0x573904,_0x58d61c){var _0x2dbd27={};var _0x3c3a31={};var _0x1ebfbc;var _0x2774b0;return db[_0xf0ed('0x46')][_0xf0ed('0x59')]({'where':{'id':_0x228bda['params']['id']}})['then'](handleEntityNotFound(_0x573904,null))['then'](function(_0x32dc6a){if(_0x32dc6a){_0x1ebfbc=_0x32dc6a;_0x3c3a31[_0xf0ed('0x3b')]=_[_0xf0ed('0x37')](db['CmList'][_0xf0ed('0x33')]);_0x3c3a31['query']=_[_0xf0ed('0x37')](_0x228bda['query']);_0x3c3a31[_0xf0ed('0x38')]=_[_0xf0ed('0x3a')](_0x3c3a31[_0xf0ed('0x3b')],_0x3c3a31[_0xf0ed('0x36')]);_0x2dbd27[_0xf0ed('0x39')]=_[_0xf0ed('0x3a')](_0x3c3a31[_0xf0ed('0x3b')],qs[_0xf0ed('0x3c')](_0x228bda[_0xf0ed('0x36')][_0xf0ed('0x3c')]));_0x2dbd27[_0xf0ed('0x39')]=_0x2dbd27[_0xf0ed('0x39')][_0xf0ed('0x3d')]?_0x2dbd27[_0xf0ed('0x39')]:_0x3c3a31[_0xf0ed('0x3b')];_0x2dbd27[_0xf0ed('0x3f')]=qs[_0xf0ed('0x40')](_0x228bda[_0xf0ed('0x36')][_0xf0ed('0x40')]);_0x2dbd27[_0xf0ed('0x41')]=qs[_0xf0ed('0x38')](_['pick'](_0x228bda['query'],_0x3c3a31[_0xf0ed('0x38')]));if(_0x228bda[_0xf0ed('0x36')][_0xf0ed('0x44')]){_0x2dbd27['where']=_['merge'](_0x2dbd27[_0xf0ed('0x41')],{'$or':_[_0xf0ed('0x32')](_0x2dbd27['attributes'],function(_0x1e5b67){var _0x2bc845={};_0x2bc845[_0x1e5b67]={'$like':'%'+_0x228bda[_0xf0ed('0x36')]['filter']+'%'};return _0x2bc845;})});}_0x2dbd27=_[_0xf0ed('0x2a')]({},_0x2dbd27,_0x228bda['options']);return _0x1ebfbc['getLists'](_0x2dbd27);}})['then'](function(_0x1ef75e){if(_0x1ef75e){_0x2774b0=_0x1ef75e[_0xf0ed('0x3d')];if(!_0x228bda[_0xf0ed('0x36')][_0xf0ed('0x5b')](_0xf0ed('0x3e'))){_0x2dbd27[_0xf0ed('0x1a')]=qs['limit'](_0x228bda['query'][_0xf0ed('0x1a')]);_0x2dbd27[_0xf0ed('0x19')]=qs[_0xf0ed('0x19')](_0x228bda[_0xf0ed('0x36')][_0xf0ed('0x19')]);}return _0x1ebfbc['getLists'](_0x2dbd27);}})[_0xf0ed('0x22')](function(_0x1054ee){if(_0x1054ee){return _0x1054ee?{'count':_0x2774b0,'rows':_0x1054ee}:null;}})[_0xf0ed('0x22')](respondWithResult(_0x573904,null))[_0xf0ed('0x49')](handleError(_0x573904,null));};exports[_0xf0ed('0x66')]=function(_0xdeffff,_0xa80cc6,_0x588c39){var _0x520db2,_0x1374e3;return db[_0xf0ed('0x46')]['find']({'where':{'id':_0xdeffff[_0xf0ed('0x4b')]['id']}})[_0xf0ed('0x22')](handleEntityNotFound(_0xa80cc6,null))[_0xf0ed('0x22')](function(_0x2b2e2a){if(_0x2b2e2a){_0x1374e3=_0x2b2e2a;return _0x2b2e2a[_0xf0ed('0x66')](_0xdeffff[_0xf0ed('0x2b')][_0xf0ed('0x67')],_[_0xf0ed('0x68')](_0xdeffff[_0xf0ed('0x2b')],[_0xf0ed('0x67'),'id'])||{});}return null;})[_0xf0ed('0x69')](function(_0x34a5d0){var _0x579749;_0x520db2=_0x34a5d0||[];var _0x7179c8=[];if(_0x34a5d0){for(var _0x474dca=0x0;_0x474dca<_0x34a5d0[_0xf0ed('0x3d')];_0x474dca+=0x1){var _0x1f7a5c=_0x34a5d0[_0x474dca]['get']({'plain':!![]});_0x1374e3[_0xf0ed('0x6a')]=_0xdeffff[_0xf0ed('0x2b')][_0xf0ed('0x6a')]?_0xdeffff['body'][_0xf0ed('0x6a')]:_0x1374e3[_0xf0ed('0x6a')];switch(_0x1374e3['dialCheckDuplicateType']){case _0xf0ed('0x6b'):_0x579749=squel['insert']()[_0xf0ed('0x6c')](_0xf0ed('0x6d'))[_0xf0ed('0x6e')]([_0xf0ed('0x6f'),_0xf0ed('0x70'),'ContactId',_0xf0ed('0x71'),_0xf0ed('0x5c'),_0xf0ed('0x56'),_0xf0ed('0x57')],squel[_0xf0ed('0x72')]()[_0xf0ed('0x73')](_0xf0ed('0x6f'),_0xf0ed('0x6f'))[_0xf0ed('0x73')]('NOW()','scheduledAt')[_0xf0ed('0x73')]('id','ContactId')[_0xf0ed('0x73')](_0x1f7a5c[_0xf0ed('0x74')][_0xf0ed('0x75')](),_0xf0ed('0x71'))[_0xf0ed('0x73')](_0xdeffff[_0xf0ed('0x4b')]['id'][_0xf0ed('0x75')](),_0xf0ed('0x5c'))[_0xf0ed('0x73')](_0xf0ed('0x76'),_0xf0ed('0x56'))[_0xf0ed('0x73')]('NOW()',_0xf0ed('0x57'))['from'](_0xf0ed('0x77'))[_0xf0ed('0x41')](_0xf0ed('0x78'))[_0xf0ed('0x41')](_0xf0ed('0x79'),_0x1f7a5c[_0xf0ed('0x74')][_0xf0ed('0x75')]())[_0xf0ed('0x41')](_0xf0ed('0x7a'))[_0xf0ed('0x41')](_0xf0ed('0x7b'),squel[_0xf0ed('0x72')]()[_0xf0ed('0x73')](_0xf0ed('0x7c'))['from'](_0xf0ed('0x7d'))[_0xf0ed('0x41')](_0xf0ed('0x7e'),_0xdeffff[_0xf0ed('0x4b')]['id'][_0xf0ed('0x75')]()))[_0xf0ed('0x41')](_0xf0ed('0x7b'),squel[_0xf0ed('0x72')]()[_0xf0ed('0x73')](_0xf0ed('0x7f'))[_0xf0ed('0x80')](_0xf0ed('0x6d'))[_0xf0ed('0x41')](_0xf0ed('0x7e'),_0xdeffff['params']['id'][_0xf0ed('0x75')]())))[_0xf0ed('0x75')]();break;case _0xf0ed('0x81'):_0x579749=squel[_0xf0ed('0x82')]()[_0xf0ed('0x6c')](_0xf0ed('0x6d'))[_0xf0ed('0x6e')]([_0xf0ed('0x6f'),'scheduledAt',_0xf0ed('0x83'),'ListId',_0xf0ed('0x5c'),_0xf0ed('0x56'),_0xf0ed('0x57')],squel['select']()[_0xf0ed('0x73')](_0xf0ed('0x6f'),_0xf0ed('0x6f'))['field'](_0xf0ed('0x76'),_0xf0ed('0x70'))[_0xf0ed('0x73')]('id','ContactId')[_0xf0ed('0x73')](_0x1f7a5c[_0xf0ed('0x74')][_0xf0ed('0x75')](),_0xf0ed('0x71'))[_0xf0ed('0x73')](_0xdeffff[_0xf0ed('0x4b')]['id'][_0xf0ed('0x75')](),_0xf0ed('0x5c'))[_0xf0ed('0x73')](_0xf0ed('0x76'),_0xf0ed('0x56'))[_0xf0ed('0x73')](_0xf0ed('0x76'),_0xf0ed('0x57'))[_0xf0ed('0x80')](_0xf0ed('0x77'))[_0xf0ed('0x41')](_0xf0ed('0x78'))[_0xf0ed('0x41')]('ListId\x20=\x20?',_0x1f7a5c[_0xf0ed('0x74')][_0xf0ed('0x75')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xf0ed('0x41')](_0xf0ed('0x7b'),squel[_0xf0ed('0x72')]()[_0xf0ed('0x73')]('COALESCE(phone,\x27\x27)')['from'](_0xf0ed('0x6d'))[_0xf0ed('0x41')](_0xf0ed('0x7e'),_0xdeffff[_0xf0ed('0x4b')]['id'][_0xf0ed('0x75')]())))[_0xf0ed('0x75')]();break;default:_0x579749=squel['insert']()[_0xf0ed('0x6c')](_0xf0ed('0x6d'))[_0xf0ed('0x6e')](['phone',_0xf0ed('0x70'),'ContactId','ListId',_0xf0ed('0x5c'),_0xf0ed('0x56'),_0xf0ed('0x57')],squel[_0xf0ed('0x72')]()[_0xf0ed('0x73')]('phone',_0xf0ed('0x6f'))['field'](_0xf0ed('0x76'),_0xf0ed('0x70'))[_0xf0ed('0x73')]('id',_0xf0ed('0x83'))['field'](_0x1f7a5c['CmListId'][_0xf0ed('0x75')](),_0xf0ed('0x71'))[_0xf0ed('0x73')](_0xdeffff['params']['id'][_0xf0ed('0x75')](),_0xf0ed('0x5c'))[_0xf0ed('0x73')](_0xf0ed('0x76'),_0xf0ed('0x56'))[_0xf0ed('0x73')]('NOW()',_0xf0ed('0x57'))[_0xf0ed('0x80')](_0xf0ed('0x77'))['where'](_0xf0ed('0x78'))['where'](_0xf0ed('0x79'),_0x1f7a5c[_0xf0ed('0x74')]['toString']())['where'](_0xf0ed('0x7a')))[_0xf0ed('0x75')]();}_0x7179c8['push'](db[_0xf0ed('0x84')][_0xf0ed('0x36')](_0x579749));}return BPromise['all'](_0x7179c8);}})[_0xf0ed('0x22')](function(){return _0x520db2;})[_0xf0ed('0x22')](respondWithResult(_0xa80cc6,null))[_0xf0ed('0x49')](handleError(_0xa80cc6,null));};exports[_0xf0ed('0x85')]=function(_0x51d6c6,_0x41103f,_0xcc845f){return db['Campaign'][_0xf0ed('0x51')]({'where':{'id':_0x51d6c6[_0xf0ed('0x4b')]['id']}})[_0xf0ed('0x22')](handleEntityNotFound(_0x41103f,null))[_0xf0ed('0x22')](function(_0x431743){if(_0x431743){return _0x431743['removeLists'](_0x51d6c6[_0xf0ed('0x36')][_0xf0ed('0x67')]);}})['then'](function(_0x54d5c5){if(_0x54d5c5){return db[_0xf0ed('0x5a')][_0xf0ed('0x26')]({'where':{'ListId':_0x51d6c6['query']['ids'],'CampaignId':_0x51d6c6[_0xf0ed('0x4b')]['id']}})[_0xf0ed('0x22')](function(){return _0x54d5c5;});}})[_0xf0ed('0x22')](respondWithStatusCode(_0x41103f,null))[_0xf0ed('0x49')](handleError(_0x41103f,null));};exports['getBlackLists']=function(_0x1a3d4d,_0x3fe04f,_0x47296b){var _0x47cdaf={};var _0x2f3a8e={};var _0x5cbf57;var _0x2665a2;return db['Campaign'][_0xf0ed('0x59')]({'where':{'id':_0x1a3d4d[_0xf0ed('0x4b')]['id']}})[_0xf0ed('0x22')](handleEntityNotFound(_0x3fe04f,null))[_0xf0ed('0x22')](function(_0x3a901c){if(_0x3a901c){_0x5cbf57=_0x3a901c;_0x2f3a8e[_0xf0ed('0x3b')]=_['keys'](db['CmList'][_0xf0ed('0x33')]);_0x2f3a8e[_0xf0ed('0x36')]=_[_0xf0ed('0x37')](_0x1a3d4d[_0xf0ed('0x36')]);_0x2f3a8e[_0xf0ed('0x38')]=_[_0xf0ed('0x3a')](_0x2f3a8e['model'],_0x2f3a8e[_0xf0ed('0x36')]);_0x47cdaf[_0xf0ed('0x39')]=_[_0xf0ed('0x3a')](_0x2f3a8e[_0xf0ed('0x3b')],qs[_0xf0ed('0x3c')](_0x1a3d4d[_0xf0ed('0x36')]['fields']));_0x47cdaf[_0xf0ed('0x39')]=_0x47cdaf[_0xf0ed('0x39')][_0xf0ed('0x3d')]?_0x47cdaf[_0xf0ed('0x39')]:_0x2f3a8e[_0xf0ed('0x3b')];_0x47cdaf[_0xf0ed('0x3f')]=qs[_0xf0ed('0x40')](_0x1a3d4d[_0xf0ed('0x36')][_0xf0ed('0x40')]);_0x47cdaf[_0xf0ed('0x41')]=qs['filters'](_['pick'](_0x1a3d4d['query'],_0x2f3a8e['filters']));if(_0x1a3d4d['query'][_0xf0ed('0x44')]){_0x47cdaf[_0xf0ed('0x41')]=_[_0xf0ed('0x2a')](_0x47cdaf['where'],{'$or':_[_0xf0ed('0x32')](_0x47cdaf[_0xf0ed('0x39')],function(_0x552261){var _0x55c833={};_0x55c833[_0x552261]={'$like':'%'+_0x1a3d4d[_0xf0ed('0x36')][_0xf0ed('0x44')]+'%'};return _0x55c833;})});}_0x47cdaf=_[_0xf0ed('0x2a')]({},_0x47cdaf,_0x1a3d4d['options']);return _0x5cbf57[_0xf0ed('0x86')](_0x47cdaf);}})['then'](function(_0x4d071a){if(_0x4d071a){_0x2665a2=_0x4d071a[_0xf0ed('0x3d')];if(!_0x1a3d4d[_0xf0ed('0x36')]['hasOwnProperty'](_0xf0ed('0x3e'))){_0x47cdaf['limit']=qs[_0xf0ed('0x1a')](_0x1a3d4d[_0xf0ed('0x36')][_0xf0ed('0x1a')]);_0x47cdaf[_0xf0ed('0x19')]=qs[_0xf0ed('0x19')](_0x1a3d4d[_0xf0ed('0x36')][_0xf0ed('0x19')]);}return _0x5cbf57['getBlackLists'](_0x47cdaf);}})[_0xf0ed('0x22')](function(_0x21d817){if(_0x21d817){return _0x21d817?{'count':_0x2665a2,'rows':_0x21d817}:null;}})[_0xf0ed('0x22')](respondWithResult(_0x3fe04f,null))[_0xf0ed('0x49')](handleError(_0x3fe04f,null));};exports[_0xf0ed('0x87')]=function(_0x2ceb42,_0x21fac5,_0x5b244e){var _0x5856a2,_0x12cecd;return db[_0xf0ed('0x46')][_0xf0ed('0x51')]({'where':{'id':_0x2ceb42[_0xf0ed('0x4b')]['id']}})[_0xf0ed('0x22')](handleEntityNotFound(_0x21fac5,null))['then'](function(_0x2a4982){if(_0x2a4982){_0x12cecd=_0x2a4982;return _0x2a4982[_0xf0ed('0x87')](_0x2ceb42[_0xf0ed('0x2b')][_0xf0ed('0x67')],_[_0xf0ed('0x68')](_0x2ceb42[_0xf0ed('0x2b')],['ids','id'])||{});}return null;})[_0xf0ed('0x69')](function(_0x36787e){var _0x7d7f5d;_0x5856a2=_0x36787e||[];var _0x28d0ea=[];if(_0x36787e){for(var _0x1162f2=0x0;_0x1162f2<_0x36787e[_0xf0ed('0x3d')];_0x1162f2+=0x1){var _0x59534c=_0x36787e[_0x1162f2][_0xf0ed('0x23')]({'plain':!![]});_0x7d7f5d=squel['insert']()['into'](_0xf0ed('0x88'))['fromQuery']([_0xf0ed('0x6f'),_0xf0ed('0x83'),_0xf0ed('0x71'),_0xf0ed('0x5c'),_0xf0ed('0x56'),_0xf0ed('0x57')],squel['select']()[_0xf0ed('0x73')](_0xf0ed('0x6f'),'phone')[_0xf0ed('0x73')]('id',_0xf0ed('0x83'))[_0xf0ed('0x73')](_0x59534c[_0xf0ed('0x74')][_0xf0ed('0x75')](),_0xf0ed('0x71'))[_0xf0ed('0x73')](_0x2ceb42[_0xf0ed('0x4b')]['id']['toString'](),_0xf0ed('0x5c'))[_0xf0ed('0x73')](_0xf0ed('0x76'),_0xf0ed('0x56'))[_0xf0ed('0x73')](_0xf0ed('0x76'),'updatedAt')[_0xf0ed('0x80')](_0xf0ed('0x77'))[_0xf0ed('0x41')](_0xf0ed('0x78'))[_0xf0ed('0x41')](_0xf0ed('0x79'),_0x59534c['CmListId']['toString']())[_0xf0ed('0x41')](_0xf0ed('0x7a')))[_0xf0ed('0x75')]();_0x28d0ea[_0xf0ed('0x89')](db[_0xf0ed('0x84')][_0xf0ed('0x36')](_0x7d7f5d));}return BPromise['all'](_0x28d0ea);}})[_0xf0ed('0x22')](function(){return _0x5856a2;})[_0xf0ed('0x22')](respondWithResult(_0x21fac5,null))[_0xf0ed('0x49')](handleError(_0x21fac5,null));};exports[_0xf0ed('0x8a')]=function(_0x9cf311,_0x330fc6,_0x27a9d1){return db[_0xf0ed('0x46')][_0xf0ed('0x51')]({'where':{'id':_0x9cf311[_0xf0ed('0x4b')]['id']}})[_0xf0ed('0x22')](handleEntityNotFound(_0x330fc6,null))[_0xf0ed('0x22')](function(_0x3aab28){if(_0x3aab28){return _0x3aab28[_0xf0ed('0x8a')](_0x9cf311['query'][_0xf0ed('0x67')]);}})[_0xf0ed('0x22')](function(_0x34b435){if(_0x34b435){return db['CmHopperBlack'][_0xf0ed('0x26')]({'where':{'ListId':_0x9cf311[_0xf0ed('0x36')][_0xf0ed('0x67')],'CampaignId':_0x9cf311[_0xf0ed('0x4b')]['id']}})[_0xf0ed('0x22')](function(){return _0x34b435;});}})[_0xf0ed('0x22')](respondWithStatusCode(_0x330fc6,null))[_0xf0ed('0x49')](handleError(_0x330fc6,null));}; \ No newline at end of file +var _0x7544=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','get','IvrCampaigns','sendStatus','error','stack','name','render','merge','body','interaction','Campaign','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','find','createdAt','omit','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','NOW()','toString','ListId','updatedAt','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','CmListId','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','sequelize','all','removeLists','getBlackLists','addBlackLists','push','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring'];(function(_0x6329b5,_0x372386){var _0x20e459=function(_0x1b3c8a){while(--_0x1b3c8a){_0x6329b5['push'](_0x6329b5['shift']());}};_0x20e459(++_0x372386);}(_0x7544,0x104));var _0x4754=function(_0x38cfa4,_0x1307b0){_0x38cfa4=_0x38cfa4-0x0;var _0x5be9e4=_0x7544[_0x38cfa4];return _0x5be9e4;};'use strict';var emlformat=require(_0x4754('0x0'));var rimraf=require(_0x4754('0x1'));var zipdir=require(_0x4754('0x2'));var jsonpatch=require(_0x4754('0x3'));var rp=require(_0x4754('0x4'));var moment=require(_0x4754('0x5'));var BPromise=require(_0x4754('0x6'));var Mustache=require(_0x4754('0x7'));var util=require(_0x4754('0x8'));var path=require(_0x4754('0x9'));var sox=require(_0x4754('0xa'));var csv=require(_0x4754('0xb'));var ejs=require(_0x4754('0xc'));var fs=require('fs');var fs_extra=require(_0x4754('0xd'));var _=require('lodash');var squel=require(_0x4754('0xe'));var crypto=require(_0x4754('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4754('0x10'));var toCsv=require(_0x4754('0xb'));var querystring=require(_0x4754('0x11'));var Papa=require('papaparse');var Redis=require(_0x4754('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4754('0x13'));var as=require(_0x4754('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4754('0x15'));var utils=require(_0x4754('0x16'));var config=require(_0x4754('0x17'));var licenseUtil=require(_0x4754('0x18'));var db=require(_0x4754('0x19'))['db'];function respondWithStatusCode(_0x5464d1,_0x49959b){_0x49959b=_0x49959b||0xcc;return function(_0x38c761){if(_0x38c761){return _0x5464d1['sendStatus'](_0x49959b);}return _0x5464d1[_0x4754('0x1a')](_0x49959b)[_0x4754('0x1b')]();};}function respondWithResult(_0x3a8bf7,_0x4cfcf3){_0x4cfcf3=_0x4cfcf3||0xc8;return function(_0x2a1026){if(_0x2a1026){return _0x3a8bf7[_0x4754('0x1a')](_0x4cfcf3)[_0x4754('0x1c')](_0x2a1026);}};}function respondWithFilteredResult(_0x55e46c,_0x289489){return function(_0x2a1fa3){if(_0x2a1fa3){var _0x4f2f85=typeof _0x289489[_0x4754('0x1d')]==='undefined'&&typeof _0x289489['limit']===_0x4754('0x1e');var _0x18fc4f=_0x2a1fa3[_0x4754('0x1f')];var _0x4cb9ef=_0x4f2f85?0x0:_0x289489[_0x4754('0x1d')];var _0x1a4782=_0x4f2f85?_0x2a1fa3['count']:_0x289489[_0x4754('0x1d')]+_0x289489[_0x4754('0x20')];var _0x2cef48;if(_0x1a4782>=_0x18fc4f){_0x1a4782=_0x18fc4f;_0x2cef48=0xc8;}else{_0x2cef48=0xce;}_0x55e46c['status'](_0x2cef48);return _0x55e46c[_0x4754('0x21')]('Content-Range',_0x4cb9ef+'-'+_0x1a4782+'/'+_0x18fc4f)[_0x4754('0x1c')](_0x2a1fa3);}return null;};}function patchUpdates(_0x1a07b9){return function(_0x322cab){try{jsonpatch[_0x4754('0x22')](_0x322cab,_0x1a07b9,!![]);}catch(_0x54fa93){return BPromise['reject'](_0x54fa93);}return _0x322cab[_0x4754('0x23')]();};}function saveUpdates(_0xa6c232,_0x3ac5cf){return function(_0x2ebe9a){if(_0x2ebe9a){return _0x2ebe9a[_0x4754('0x24')](_0xa6c232)[_0x4754('0x25')](function(_0x4a29e5){return _0x4a29e5;});}return null;};}function removeEntity(_0x2d1ea7,_0x45facd){return function(_0x1712c8){if(_0x1712c8){return _0x1712c8[_0x4754('0x26')]()['then'](function(){var _0x33130f=_0x1712c8[_0x4754('0x27')]({'plain':!![]});var _0x181509=_0x4754('0x28');return db['UserProfileResource'][_0x4754('0x26')]({'where':{'type':_0x181509,'resourceId':_0x33130f['id']}})[_0x4754('0x25')](function(){return _0x1712c8;});})[_0x4754('0x25')](function(){_0x2d1ea7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd0855c,_0x2e8b84){return function(_0x5c3f9f){if(!_0x5c3f9f){_0xd0855c[_0x4754('0x29')](0x194);}return _0x5c3f9f;};}function handleError(_0x5743c5,_0x2d7098){_0x2d7098=_0x2d7098||0x1f4;return function(_0x509931){logger[_0x4754('0x2a')](_0x509931[_0x4754('0x2b')]);if(_0x509931[_0x4754('0x2c')]){delete _0x509931['name'];}_0x5743c5[_0x4754('0x1a')](_0x2d7098)['send'](_0x509931);};}function getMustacheRender(_0x3eaa3e,_0x46a84f){return Mustache[_0x4754('0x2d')](_0x3eaa3e,_[_0x4754('0x2e')](_0x46a84f[_0x4754('0x2f')],{'contact':_0x46a84f['contact'],'message':_0x46a84f['message'],'agent':_0x46a84f['agent'],'interaction':_0x46a84f[_0x4754('0x30')],'account':_0x46a84f['account']}))||'';}exports['index']=function(_0x4ffce8,_0x260ccf){var _0x112822={},_0x500767={},_0x57b5ca={'count':0x0,'rows':[]};var _0x3c17fc=_['map'](db[_0x4754('0x31')][_0x4754('0x32')],function(_0x4d6bee){return{'name':_0x4d6bee[_0x4754('0x33')],'type':_0x4d6bee[_0x4754('0x34')][_0x4754('0x35')]};});_0x500767[_0x4754('0x36')]=_[_0x4754('0x37')](_0x3c17fc,'name');_0x500767[_0x4754('0x38')]=_[_0x4754('0x39')](_0x4ffce8[_0x4754('0x38')]);_0x500767['filters']=_[_0x4754('0x3a')](_0x500767[_0x4754('0x36')],_0x500767['query']);_0x112822['attributes']=_[_0x4754('0x3a')](_0x500767['model'],qs[_0x4754('0x3b')](_0x4ffce8[_0x4754('0x38')]['fields']));_0x112822[_0x4754('0x3c')]=_0x112822[_0x4754('0x3c')]['length']?_0x112822[_0x4754('0x3c')]:_0x500767[_0x4754('0x36')];if(!_0x4ffce8[_0x4754('0x38')][_0x4754('0x3d')](_0x4754('0x3e'))){_0x112822[_0x4754('0x20')]=qs[_0x4754('0x20')](_0x4ffce8[_0x4754('0x38')]['limit']);_0x112822[_0x4754('0x1d')]=qs[_0x4754('0x1d')](_0x4ffce8[_0x4754('0x38')][_0x4754('0x1d')]);}_0x112822[_0x4754('0x3f')]=qs[_0x4754('0x40')](_0x4ffce8[_0x4754('0x38')][_0x4754('0x40')]);_0x112822[_0x4754('0x41')]=qs[_0x4754('0x42')](_[_0x4754('0x43')](_0x4ffce8[_0x4754('0x38')],_0x500767[_0x4754('0x42')]),_0x3c17fc);if(_0x4ffce8[_0x4754('0x38')]['filter']){_0x112822['where']=_[_0x4754('0x2e')](_0x112822['where'],{'$or':_['map'](_0x3c17fc,function(_0x3b65fe){if(_0x3b65fe['type']!==_0x4754('0x44')){var _0x115993={};_0x115993[_0x3b65fe['name']]={'$like':'%'+_0x4ffce8['query'][_0x4754('0x45')]+'%'};return _0x115993;}})});}_0x112822=_[_0x4754('0x2e')]({},_0x112822,_0x4ffce8[_0x4754('0x46')]);var _0x4f6fed={'where':_0x112822[_0x4754('0x41')]};return db[_0x4754('0x31')]['count'](_0x4f6fed)[_0x4754('0x25')](function(_0x11ed54){_0x57b5ca[_0x4754('0x1f')]=_0x11ed54;if(_0x4ffce8[_0x4754('0x38')][_0x4754('0x47')]){_0x112822[_0x4754('0x48')]=[{'all':!![]}];}return db['Campaign'][_0x4754('0x49')](_0x112822);})['then'](function(_0x1d5ac9){_0x57b5ca[_0x4754('0x4a')]=_0x1d5ac9;return _0x57b5ca;})[_0x4754('0x25')](respondWithFilteredResult(_0x260ccf,_0x112822))[_0x4754('0x4b')](handleError(_0x260ccf,null));};exports[_0x4754('0x4c')]=function(_0x4914f2,_0x33a321){var _0x1dfabd={'raw':![],'where':{'id':_0x4914f2[_0x4754('0x4d')]['id']}},_0x1e9a43={};_0x1e9a43[_0x4754('0x36')]=_[_0x4754('0x39')](db['Campaign']['rawAttributes']);_0x1e9a43[_0x4754('0x38')]=_['keys'](_0x4914f2[_0x4754('0x38')]);_0x1e9a43[_0x4754('0x42')]=_[_0x4754('0x3a')](_0x1e9a43[_0x4754('0x36')],_0x1e9a43['query']);_0x1dfabd['attributes']=_[_0x4754('0x3a')](_0x1e9a43[_0x4754('0x36')],qs[_0x4754('0x3b')](_0x4914f2['query']['fields']));_0x1dfabd[_0x4754('0x3c')]=_0x1dfabd[_0x4754('0x3c')][_0x4754('0x4e')]?_0x1dfabd[_0x4754('0x3c')]:_0x1e9a43[_0x4754('0x36')];if(_0x4914f2['query'][_0x4754('0x47')]){_0x1dfabd['include']=[{'all':!![]}];}_0x1dfabd=_['merge']({},_0x1dfabd,_0x4914f2[_0x4754('0x46')]);return db['Campaign']['find'](_0x1dfabd)[_0x4754('0x25')](handleEntityNotFound(_0x33a321,null))[_0x4754('0x25')](respondWithResult(_0x33a321,null))['catch'](handleError(_0x33a321,null));};exports[_0x4754('0x4f')]=function(_0x5c224f,_0x1bf2d8){return db[_0x4754('0x31')][_0x4754('0x4f')](_0x5c224f[_0x4754('0x2f')],{})[_0x4754('0x25')](function(_0x40b476){var _0x845c43=_0x5c224f[_0x4754('0x50')][_0x4754('0x27')]({'plain':!![]});if(!_0x845c43)throw new Error(_0x4754('0x51'));if(_0x845c43[_0x4754('0x52')]==='user'){var _0x3d771c=_0x40b476['get']({'plain':!![]});var _0x550c2b=_0x4754('0x28');return db[_0x4754('0x53')]['find']({'where':{'name':_0x550c2b,'userProfileId':_0x845c43[_0x4754('0x54')]},'raw':!![]})[_0x4754('0x25')](function(_0x8ef37){if(_0x8ef37&&_0x8ef37[_0x4754('0x55')]===0x0){return db[_0x4754('0x56')][_0x4754('0x4f')]({'name':_0x3d771c['name'],'resourceId':_0x3d771c['id'],'type':_0x8ef37['name'],'sectionId':_0x8ef37['id']},{})['then'](function(){return _0x40b476;});}else{return _0x40b476;}})[_0x4754('0x4b')](function(_0x5ba911){logger[_0x4754('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ba911);throw _0x5ba911;});}return _0x40b476;})[_0x4754('0x25')](respondWithResult(_0x1bf2d8,0xc9))[_0x4754('0x4b')](handleError(_0x1bf2d8,null));};exports[_0x4754('0x57')]=function(_0x5eb488,_0x2e5c9a){var _0x2b16d2={'where':{'id':_0x5eb488['params']['id']}},_0x23d305={};_0x23d305['model']=_['keys'](db[_0x4754('0x31')]['rawAttributes']);_0x2b16d2[_0x4754('0x3c')]=_[_0x4754('0x3a')](_0x23d305['model'],qs[_0x4754('0x3b')](_0x5eb488[_0x4754('0x38')][_0x4754('0x3b')]));_0x2b16d2[_0x4754('0x3c')]=_0x2b16d2[_0x4754('0x3c')][_0x4754('0x4e')]?_0x2b16d2[_0x4754('0x3c')]:_0x23d305[_0x4754('0x36')];if(_0x5eb488[_0x4754('0x38')]['includeAll']){_0x2b16d2[_0x4754('0x48')]=[{'all':!![]}];}_0x2b16d2=_[_0x4754('0x2e')]({},_0x2b16d2,_0x5eb488['options']);return db[_0x4754('0x31')][_0x4754('0x58')](_0x2b16d2)[_0x4754('0x25')](handleEntityNotFound(_0x2e5c9a,null))[_0x4754('0x25')](function(_0xe6fab){if(_0xe6fab){var _0x301b8c=_0xe6fab[_0x4754('0x27')]({'plain':!![]});_0x301b8c=qs['omit'](_0x301b8c,['id',_0x4754('0x59'),'updatedAt']);_0x5eb488['body']=_[_0x4754('0x5a')](_0x5eb488[_0x4754('0x2f')],['id','createdAt','updatedAt']);return db[_0x4754('0x31')][_0x4754('0x4f')](_[_0x4754('0x2e')](_0x301b8c,_0x5eb488[_0x4754('0x2f')]),{'include':_0x5eb488[_0x4754('0x38')]['includeAll']?[{'all':!![]}]:undefined})[_0x4754('0x25')](function(_0x59c602){var _0x3b9e3e=_0x5eb488['user'][_0x4754('0x27')]({'plain':!![]});if(!_0x3b9e3e)throw new Error(_0x4754('0x51'));if(_0x3b9e3e[_0x4754('0x52')]===_0x4754('0x50')){var _0x1d7c58=_0x59c602[_0x4754('0x27')]({'plain':!![]});var _0x54bdfb=_0x4754('0x28');return db['UserProfileSection'][_0x4754('0x58')]({'where':{'name':_0x54bdfb,'userProfileId':_0x3b9e3e[_0x4754('0x54')]},'raw':!![]})[_0x4754('0x25')](function(_0x2cbabc){if(_0x2cbabc&&_0x2cbabc[_0x4754('0x55')]===0x0){return db['UserProfileResource'][_0x4754('0x4f')]({'name':_0x1d7c58['name'],'resourceId':_0x1d7c58['id'],'type':_0x2cbabc[_0x4754('0x2c')],'sectionId':_0x2cbabc['id']},{})[_0x4754('0x25')](function(){return _0x59c602;});}else{return _0x59c602;}})[_0x4754('0x4b')](function(_0x2ff617){logger['error'](_0x4754('0x5b'),_0x2ff617);throw _0x2ff617;});}return _0x59c602;});}})[_0x4754('0x25')](respondWithResult(_0x2e5c9a,0xc9))[_0x4754('0x4b')](handleError(_0x2e5c9a,null));};exports[_0x4754('0x24')]=function(_0x3c2f9f,_0x14a004){if(_0x3c2f9f[_0x4754('0x2f')]['id']){delete _0x3c2f9f[_0x4754('0x2f')]['id'];}return db[_0x4754('0x31')][_0x4754('0x58')]({'where':{'id':_0x3c2f9f[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x14a004,null))[_0x4754('0x25')](saveUpdates(_0x3c2f9f[_0x4754('0x2f')],null))[_0x4754('0x25')](respondWithResult(_0x14a004,null))['catch'](handleError(_0x14a004,null));};exports[_0x4754('0x26')]=function(_0x442b49,_0x54d13c){return db[_0x4754('0x31')][_0x4754('0x58')]({'where':{'id':_0x442b49[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x54d13c,null))['then'](removeEntity(_0x54d13c,null))[_0x4754('0x4b')](handleError(_0x54d13c,null));};exports[_0x4754('0x5c')]=function(_0x310078,_0x522416,_0x5ea87b){var _0x2909aa={'raw':!![],'where':{}};var _0x48613c={};var _0x2e1ccf={'count':0x0,'rows':[]};return db[_0x4754('0x31')][_0x4754('0x5d')]({'where':{'id':_0x310078[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x522416,null))[_0x4754('0x25')](function(_0x5038fa){if(_0x5038fa){_0x48613c[_0x4754('0x36')]=_['keys'](db['CmHopper'][_0x4754('0x32')]);_0x48613c['query']=_[_0x4754('0x39')](_0x310078['query']);_0x48613c['filters']=_[_0x4754('0x3a')](_0x48613c['model'],_0x48613c['query']);_0x2909aa[_0x4754('0x3c')]=_[_0x4754('0x3a')](_0x48613c[_0x4754('0x36')],qs['fields'](_0x310078[_0x4754('0x38')][_0x4754('0x3b')]));_0x2909aa[_0x4754('0x3c')]=_0x2909aa['attributes']['length']?_0x2909aa[_0x4754('0x3c')]:_0x48613c[_0x4754('0x36')];if(!_0x310078[_0x4754('0x38')]['hasOwnProperty'](_0x4754('0x3e'))){_0x2909aa[_0x4754('0x20')]=qs[_0x4754('0x20')](_0x310078['query'][_0x4754('0x20')]);_0x2909aa[_0x4754('0x1d')]=qs[_0x4754('0x1d')](_0x310078[_0x4754('0x38')][_0x4754('0x1d')]);}_0x2909aa[_0x4754('0x3f')]=qs[_0x4754('0x40')](_0x310078[_0x4754('0x38')][_0x4754('0x40')]);_0x2909aa[_0x4754('0x41')]=qs['filters'](_[_0x4754('0x43')](_0x310078['query'],_0x48613c[_0x4754('0x42')]));_0x2909aa[_0x4754('0x41')][_0x4754('0x5e')]=_0x5038fa['id'];if(_0x310078[_0x4754('0x38')]['filter']){_0x2909aa[_0x4754('0x41')]=_['merge'](_0x2909aa['where'],{'$or':_['map'](_0x2909aa[_0x4754('0x3c')],function(_0x52d913){var _0x38010f={};_0x38010f[_0x52d913]={'$like':'%'+_0x310078[_0x4754('0x38')][_0x4754('0x45')]+'%'};return _0x38010f;})});}_0x2909aa=_['merge']({},_0x2909aa,_0x310078[_0x4754('0x46')]);return db['CmHopper'][_0x4754('0x1f')]({'where':_0x2909aa[_0x4754('0x41')]})[_0x4754('0x25')](function(_0x466e73){_0x2e1ccf['count']=_0x466e73;if(_0x310078[_0x4754('0x38')][_0x4754('0x47')]){_0x2909aa['include']=[{'all':!![]}];}return db[_0x4754('0x5f')][_0x4754('0x49')](_0x2909aa);})[_0x4754('0x25')](function(_0x5ce62c){_0x2e1ccf[_0x4754('0x4a')]=_0x5ce62c;return _0x2e1ccf;});}})[_0x4754('0x25')](respondWithFilteredResult(_0x522416,_0x2909aa))[_0x4754('0x4b')](handleError(_0x522416,null));};exports[_0x4754('0x60')]=function(_0x204129,_0x15bd59,_0xb6c1f5){var _0x37af62={'raw':!![],'where':{}};var _0x4442df={};var _0x4198bd={'count':0x0,'rows':[]};return db[_0x4754('0x31')][_0x4754('0x5d')]({'where':{'id':_0x204129[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x15bd59,null))[_0x4754('0x25')](function(_0x126b77){if(_0x126b77){_0x4442df[_0x4754('0x36')]=_['keys'](db['CmHopperHistory'][_0x4754('0x32')]);_0x4442df['query']=_['keys'](_0x204129[_0x4754('0x38')]);_0x4442df[_0x4754('0x42')]=_['intersection'](_0x4442df[_0x4754('0x36')],_0x4442df[_0x4754('0x38')]);_0x37af62[_0x4754('0x3c')]=_['intersection'](_0x4442df[_0x4754('0x36')],qs[_0x4754('0x3b')](_0x204129[_0x4754('0x38')][_0x4754('0x3b')]));_0x37af62['attributes']=_0x37af62[_0x4754('0x3c')][_0x4754('0x4e')]?_0x37af62[_0x4754('0x3c')]:_0x4442df['model'];if(!_0x204129['query'][_0x4754('0x3d')](_0x4754('0x3e'))){_0x37af62[_0x4754('0x20')]=qs['limit'](_0x204129[_0x4754('0x38')][_0x4754('0x20')]);_0x37af62[_0x4754('0x1d')]=qs[_0x4754('0x1d')](_0x204129[_0x4754('0x38')][_0x4754('0x1d')]);}_0x37af62[_0x4754('0x3f')]=qs[_0x4754('0x40')](_0x204129[_0x4754('0x38')]['sort']);_0x37af62[_0x4754('0x41')]=qs[_0x4754('0x42')](_[_0x4754('0x43')](_0x204129[_0x4754('0x38')],_0x4442df['filters']));_0x37af62[_0x4754('0x41')][_0x4754('0x5e')]=_0x126b77['id'];if(_0x204129[_0x4754('0x38')][_0x4754('0x45')]){_0x37af62[_0x4754('0x41')]=_[_0x4754('0x2e')](_0x37af62[_0x4754('0x41')],{'$or':_[_0x4754('0x37')](_0x37af62[_0x4754('0x3c')],function(_0x48725b){var _0x5e307a={};_0x5e307a[_0x48725b]={'$like':'%'+_0x204129[_0x4754('0x38')]['filter']+'%'};return _0x5e307a;})});}_0x37af62=_['merge']({},_0x37af62,_0x204129[_0x4754('0x46')]);return db[_0x4754('0x61')]['count']({'where':_0x37af62[_0x4754('0x41')]})[_0x4754('0x25')](function(_0x51cd1b){_0x4198bd[_0x4754('0x1f')]=_0x51cd1b;if(_0x204129['query'][_0x4754('0x47')]){_0x37af62[_0x4754('0x48')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x37af62);})[_0x4754('0x25')](function(_0x3e2a37){_0x4198bd[_0x4754('0x4a')]=_0x3e2a37;return _0x4198bd;});}})['then'](respondWithFilteredResult(_0x15bd59,_0x37af62))['catch'](handleError(_0x15bd59,null));};exports[_0x4754('0x62')]=function(_0x4fda2f,_0x57cdf3,_0x4b8e70){var _0x3cbb01={'raw':!![],'where':{}};var _0x390790={};var _0xda891e={'count':0x0,'rows':[]};return db[_0x4754('0x31')][_0x4754('0x5d')]({'where':{'id':_0x4fda2f['params']['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x57cdf3,null))[_0x4754('0x25')](function(_0x58844f){if(_0x58844f){_0x390790[_0x4754('0x36')]=_[_0x4754('0x39')](db[_0x4754('0x63')]['rawAttributes']);_0x390790[_0x4754('0x38')]=_[_0x4754('0x39')](_0x4fda2f['query']);_0x390790[_0x4754('0x42')]=_[_0x4754('0x3a')](_0x390790[_0x4754('0x36')],_0x390790['query']);_0x3cbb01[_0x4754('0x3c')]=_[_0x4754('0x3a')](_0x390790[_0x4754('0x36')],qs[_0x4754('0x3b')](_0x4fda2f[_0x4754('0x38')][_0x4754('0x3b')]));_0x3cbb01[_0x4754('0x3c')]=_0x3cbb01['attributes'][_0x4754('0x4e')]?_0x3cbb01[_0x4754('0x3c')]:_0x390790[_0x4754('0x36')];if(!_0x4fda2f[_0x4754('0x38')][_0x4754('0x3d')]('nolimit')){_0x3cbb01['limit']=qs[_0x4754('0x20')](_0x4fda2f[_0x4754('0x38')]['limit']);_0x3cbb01[_0x4754('0x1d')]=qs[_0x4754('0x1d')](_0x4fda2f[_0x4754('0x38')]['offset']);}_0x3cbb01[_0x4754('0x3f')]=qs['sort'](_0x4fda2f[_0x4754('0x38')]['sort']);_0x3cbb01[_0x4754('0x41')]=qs[_0x4754('0x42')](_[_0x4754('0x43')](_0x4fda2f[_0x4754('0x38')],_0x390790[_0x4754('0x42')]));_0x3cbb01[_0x4754('0x41')]['CampaignId']=_0x58844f['id'];if(_0x4fda2f['query'][_0x4754('0x45')]){_0x3cbb01['where']=_[_0x4754('0x2e')](_0x3cbb01[_0x4754('0x41')],{'$or':_[_0x4754('0x37')](_0x3cbb01[_0x4754('0x3c')],function(_0xbdbe90){var _0x1d8ad9={};_0x1d8ad9[_0xbdbe90]={'$like':'%'+_0x4fda2f['query'][_0x4754('0x45')]+'%'};return _0x1d8ad9;})});}_0x3cbb01=_['merge']({},_0x3cbb01,_0x4fda2f[_0x4754('0x46')]);return db[_0x4754('0x63')][_0x4754('0x1f')]({'where':_0x3cbb01['where']})['then'](function(_0x67e3ce){_0xda891e[_0x4754('0x1f')]=_0x67e3ce;if(_0x4fda2f[_0x4754('0x38')][_0x4754('0x47')]){_0x3cbb01[_0x4754('0x48')]=[{'all':!![]}];}return db[_0x4754('0x63')][_0x4754('0x49')](_0x3cbb01);})[_0x4754('0x25')](function(_0x37a1ae){_0xda891e[_0x4754('0x4a')]=_0x37a1ae;return _0xda891e;});}})['then'](respondWithFilteredResult(_0x57cdf3,_0x3cbb01))[_0x4754('0x4b')](handleError(_0x57cdf3,null));};exports['getHopperBlacks']=function(_0x40899b,_0x34d63b,_0x407cbd){var _0x40f806={'raw':!![],'where':{}};var _0x14729f={};var _0x21ec61={'count':0x0,'rows':[]};return db[_0x4754('0x31')][_0x4754('0x5d')]({'where':{'id':_0x40899b[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x34d63b,null))['then'](function(_0x329ca2){if(_0x329ca2){_0x14729f[_0x4754('0x36')]=_['keys'](db[_0x4754('0x64')][_0x4754('0x32')]);_0x14729f[_0x4754('0x38')]=_[_0x4754('0x39')](_0x40899b[_0x4754('0x38')]);_0x14729f[_0x4754('0x42')]=_[_0x4754('0x3a')](_0x14729f[_0x4754('0x36')],_0x14729f[_0x4754('0x38')]);_0x40f806[_0x4754('0x3c')]=_[_0x4754('0x3a')](_0x14729f[_0x4754('0x36')],qs[_0x4754('0x3b')](_0x40899b['query'][_0x4754('0x3b')]));_0x40f806[_0x4754('0x3c')]=_0x40f806[_0x4754('0x3c')]['length']?_0x40f806[_0x4754('0x3c')]:_0x14729f[_0x4754('0x36')];if(!_0x40899b[_0x4754('0x38')][_0x4754('0x3d')](_0x4754('0x3e'))){_0x40f806[_0x4754('0x20')]=qs[_0x4754('0x20')](_0x40899b[_0x4754('0x38')]['limit']);_0x40f806[_0x4754('0x1d')]=qs[_0x4754('0x1d')](_0x40899b['query'][_0x4754('0x1d')]);}_0x40f806[_0x4754('0x3f')]=qs[_0x4754('0x40')](_0x40899b[_0x4754('0x38')][_0x4754('0x40')]);_0x40f806['where']=qs[_0x4754('0x42')](_[_0x4754('0x43')](_0x40899b['query'],_0x14729f[_0x4754('0x42')]));_0x40f806['where'][_0x4754('0x5e')]=_0x329ca2['id'];if(_0x40899b['query']['filter']){_0x40f806[_0x4754('0x41')]=_['merge'](_0x40f806['where'],{'$or':_[_0x4754('0x37')](_0x40f806[_0x4754('0x3c')],function(_0x1b28a8){var _0x4dcd61={};_0x4dcd61[_0x1b28a8]={'$like':'%'+_0x40899b[_0x4754('0x38')]['filter']+'%'};return _0x4dcd61;})});}_0x40f806=_[_0x4754('0x2e')]({},_0x40f806,_0x40899b['options']);return db['CmHopperBlack'][_0x4754('0x1f')]({'where':_0x40f806['where']})['then'](function(_0x12dec4){_0x21ec61['count']=_0x12dec4;if(_0x40899b[_0x4754('0x38')]['includeAll']){_0x40f806[_0x4754('0x48')]=[{'all':!![]}];}return db[_0x4754('0x64')]['findAll'](_0x40f806);})['then'](function(_0x25caad){_0x21ec61[_0x4754('0x4a')]=_0x25caad;return _0x21ec61;});}})[_0x4754('0x25')](respondWithFilteredResult(_0x34d63b,_0x40f806))[_0x4754('0x4b')](handleError(_0x34d63b,null));};exports[_0x4754('0x65')]=function(_0x3fcced,_0xd8849c,_0x537066){var _0x183d6e={};var _0x76facd={};var _0x4cbf89;var _0x3edbb7;return db[_0x4754('0x31')][_0x4754('0x5d')]({'where':{'id':_0x3fcced[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0xd8849c,null))[_0x4754('0x25')](function(_0x3e3d7b){if(_0x3e3d7b){_0x4cbf89=_0x3e3d7b;_0x76facd[_0x4754('0x36')]=_['keys'](db[_0x4754('0x66')][_0x4754('0x32')]);_0x76facd[_0x4754('0x38')]=_[_0x4754('0x39')](_0x3fcced[_0x4754('0x38')]);_0x76facd['filters']=_['intersection'](_0x76facd[_0x4754('0x36')],_0x76facd[_0x4754('0x38')]);_0x183d6e['attributes']=_['intersection'](_0x76facd[_0x4754('0x36')],qs[_0x4754('0x3b')](_0x3fcced[_0x4754('0x38')]['fields']));_0x183d6e['attributes']=_0x183d6e[_0x4754('0x3c')]['length']?_0x183d6e[_0x4754('0x3c')]:_0x76facd[_0x4754('0x36')];_0x183d6e[_0x4754('0x3f')]=qs[_0x4754('0x40')](_0x3fcced['query'][_0x4754('0x40')]);_0x183d6e['where']=qs['filters'](_[_0x4754('0x43')](_0x3fcced[_0x4754('0x38')],_0x76facd[_0x4754('0x42')]));if(_0x3fcced[_0x4754('0x38')]['filter']){_0x183d6e[_0x4754('0x41')]=_['merge'](_0x183d6e['where'],{'$or':_['map'](_0x183d6e[_0x4754('0x3c')],function(_0x351b86){var _0x4adace={};_0x4adace[_0x351b86]={'$like':'%'+_0x3fcced['query']['filter']+'%'};return _0x4adace;})});}_0x183d6e=_[_0x4754('0x2e')]({},_0x183d6e,_0x3fcced['options']);return _0x4cbf89[_0x4754('0x65')](_0x183d6e);}})[_0x4754('0x25')](function(_0x46c450){if(_0x46c450){_0x3edbb7=_0x46c450[_0x4754('0x4e')];if(!_0x3fcced['query'][_0x4754('0x3d')](_0x4754('0x3e'))){_0x183d6e[_0x4754('0x20')]=qs[_0x4754('0x20')](_0x3fcced[_0x4754('0x38')][_0x4754('0x20')]);_0x183d6e[_0x4754('0x1d')]=qs[_0x4754('0x1d')](_0x3fcced['query'][_0x4754('0x1d')]);}return _0x4cbf89['getLists'](_0x183d6e);}})[_0x4754('0x25')](function(_0x5a1eaa){if(_0x5a1eaa){return _0x5a1eaa?{'count':_0x3edbb7,'rows':_0x5a1eaa}:null;}})[_0x4754('0x25')](respondWithResult(_0xd8849c,null))[_0x4754('0x4b')](handleError(_0xd8849c,null));};exports[_0x4754('0x67')]=function(_0x1050a5,_0x356763,_0x140527){var _0x2885bb,_0x44a151;return db[_0x4754('0x31')]['find']({'where':{'id':_0x1050a5[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x356763,null))['then'](function(_0x39b54f){if(_0x39b54f){_0x44a151=_0x39b54f;return _0x39b54f[_0x4754('0x67')](_0x1050a5[_0x4754('0x2f')][_0x4754('0x68')],_[_0x4754('0x5a')](_0x1050a5['body'],[_0x4754('0x68'),'id'])||{});}return null;})[_0x4754('0x69')](function(_0x578e1b){var _0x18c099;_0x2885bb=_0x578e1b||[];var _0x2a020b=[];if(_0x578e1b){for(var _0x295ff6=0x0;_0x295ff6<_0x578e1b['length'];_0x295ff6+=0x1){var _0x29dae4=_0x578e1b[_0x295ff6][_0x4754('0x27')]({'plain':!![]});_0x44a151[_0x4754('0x6a')]=_0x1050a5[_0x4754('0x2f')]['dialCheckDuplicateType']?_0x1050a5[_0x4754('0x2f')]['dialCheckDuplicateType']:_0x44a151[_0x4754('0x6a')];switch(_0x44a151[_0x4754('0x6a')]){case _0x4754('0x6b'):_0x18c099=squel[_0x4754('0x6c')]()[_0x4754('0x6d')](_0x4754('0x6e'))[_0x4754('0x6f')]([_0x4754('0x70'),_0x4754('0x71'),_0x4754('0x72'),'ListId',_0x4754('0x5e'),'createdAt','updatedAt'],squel[_0x4754('0x73')]()['field'](_0x4754('0x70'),_0x4754('0x70'))[_0x4754('0x74')](_0x4754('0x75'),_0x4754('0x71'))[_0x4754('0x74')]('id','ContactId')['field'](_0x29dae4['CmListId'][_0x4754('0x76')](),_0x4754('0x77'))['field'](_0x1050a5['params']['id'][_0x4754('0x76')](),_0x4754('0x5e'))[_0x4754('0x74')](_0x4754('0x75'),'createdAt')[_0x4754('0x74')]('NOW()',_0x4754('0x78'))[_0x4754('0x79')](_0x4754('0x7a'))[_0x4754('0x41')]('deletedAt\x20IS\x20NULL')[_0x4754('0x41')](_0x4754('0x7b'),_0x29dae4['CmListId'][_0x4754('0x76')]())[_0x4754('0x41')](_0x4754('0x7c'))[_0x4754('0x41')](_0x4754('0x7d'),squel[_0x4754('0x73')]()[_0x4754('0x74')](_0x4754('0x7e'))[_0x4754('0x79')](_0x4754('0x7f'))[_0x4754('0x41')]('CampaignId\x20=\x20?',_0x1050a5[_0x4754('0x4d')]['id'][_0x4754('0x76')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x4754('0x74')]('COALESCE(phone,\x27\x27)')[_0x4754('0x79')](_0x4754('0x6e'))[_0x4754('0x41')](_0x4754('0x80'),_0x1050a5[_0x4754('0x4d')]['id'][_0x4754('0x76')]())))[_0x4754('0x76')]();break;case'onlyIfOpen':_0x18c099=squel[_0x4754('0x6c')]()[_0x4754('0x6d')](_0x4754('0x6e'))[_0x4754('0x6f')](['phone',_0x4754('0x71'),_0x4754('0x72'),_0x4754('0x77'),_0x4754('0x5e'),_0x4754('0x59'),_0x4754('0x78')],squel[_0x4754('0x73')]()[_0x4754('0x74')]('phone',_0x4754('0x70'))[_0x4754('0x74')]('NOW()',_0x4754('0x71'))[_0x4754('0x74')]('id','ContactId')['field'](_0x29dae4[_0x4754('0x81')][_0x4754('0x76')](),_0x4754('0x77'))[_0x4754('0x74')](_0x1050a5['params']['id']['toString'](),_0x4754('0x5e'))['field']('NOW()',_0x4754('0x59'))['field'](_0x4754('0x75'),_0x4754('0x78'))['from'](_0x4754('0x7a'))[_0x4754('0x41')](_0x4754('0x82'))['where'](_0x4754('0x7b'),_0x29dae4[_0x4754('0x81')][_0x4754('0x76')]())[_0x4754('0x41')](_0x4754('0x7c'))[_0x4754('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x4754('0x73')]()[_0x4754('0x74')](_0x4754('0x83'))[_0x4754('0x79')](_0x4754('0x6e'))['where'](_0x4754('0x80'),_0x1050a5[_0x4754('0x4d')]['id'][_0x4754('0x76')]())))[_0x4754('0x76')]();break;default:_0x18c099=squel[_0x4754('0x6c')]()['into'](_0x4754('0x6e'))[_0x4754('0x6f')]([_0x4754('0x70'),_0x4754('0x71'),'ContactId',_0x4754('0x77'),_0x4754('0x5e'),_0x4754('0x59'),_0x4754('0x78')],squel[_0x4754('0x73')]()[_0x4754('0x74')](_0x4754('0x70'),_0x4754('0x70'))[_0x4754('0x74')](_0x4754('0x75'),_0x4754('0x71'))['field']('id',_0x4754('0x72'))[_0x4754('0x74')](_0x29dae4[_0x4754('0x81')][_0x4754('0x76')](),'ListId')[_0x4754('0x74')](_0x1050a5[_0x4754('0x4d')]['id'][_0x4754('0x76')](),_0x4754('0x5e'))[_0x4754('0x74')](_0x4754('0x75'),_0x4754('0x59'))['field'](_0x4754('0x75'),'updatedAt')['from']('cm_contacts')[_0x4754('0x41')](_0x4754('0x82'))[_0x4754('0x41')](_0x4754('0x7b'),_0x29dae4[_0x4754('0x81')][_0x4754('0x76')]())[_0x4754('0x41')](_0x4754('0x7c')))[_0x4754('0x76')]();}_0x2a020b['push'](db[_0x4754('0x84')][_0x4754('0x38')](_0x18c099));}return BPromise[_0x4754('0x85')](_0x2a020b);}})[_0x4754('0x25')](function(){return _0x2885bb;})[_0x4754('0x25')](respondWithResult(_0x356763,null))[_0x4754('0x4b')](handleError(_0x356763,null));};exports['removeLists']=function(_0x50ff20,_0x44f139,_0x2f073a){return db[_0x4754('0x31')][_0x4754('0x58')]({'where':{'id':_0x50ff20['params']['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x44f139,null))[_0x4754('0x25')](function(_0x3c28ba){if(_0x3c28ba){return _0x3c28ba[_0x4754('0x86')](_0x50ff20[_0x4754('0x38')][_0x4754('0x68')]);}})[_0x4754('0x25')](function(_0x39628d){if(_0x39628d){return db[_0x4754('0x5f')][_0x4754('0x26')]({'where':{'ListId':_0x50ff20[_0x4754('0x38')]['ids'],'CampaignId':_0x50ff20[_0x4754('0x4d')]['id']}})['then'](function(){return _0x39628d;});}})[_0x4754('0x25')](respondWithStatusCode(_0x44f139,null))[_0x4754('0x4b')](handleError(_0x44f139,null));};exports['getBlackLists']=function(_0x34fd3f,_0x35ac2a,_0x477b97){var _0x33a894={};var _0x3a19b2={};var _0x47006d;var _0x2d3be4;return db['Campaign']['findOne']({'where':{'id':_0x34fd3f[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x35ac2a,null))[_0x4754('0x25')](function(_0x59668f){if(_0x59668f){_0x47006d=_0x59668f;_0x3a19b2[_0x4754('0x36')]=_['keys'](db[_0x4754('0x66')][_0x4754('0x32')]);_0x3a19b2[_0x4754('0x38')]=_['keys'](_0x34fd3f[_0x4754('0x38')]);_0x3a19b2[_0x4754('0x42')]=_['intersection'](_0x3a19b2[_0x4754('0x36')],_0x3a19b2['query']);_0x33a894[_0x4754('0x3c')]=_[_0x4754('0x3a')](_0x3a19b2[_0x4754('0x36')],qs[_0x4754('0x3b')](_0x34fd3f['query'][_0x4754('0x3b')]));_0x33a894[_0x4754('0x3c')]=_0x33a894[_0x4754('0x3c')][_0x4754('0x4e')]?_0x33a894['attributes']:_0x3a19b2[_0x4754('0x36')];_0x33a894[_0x4754('0x3f')]=qs['sort'](_0x34fd3f[_0x4754('0x38')][_0x4754('0x40')]);_0x33a894['where']=qs[_0x4754('0x42')](_[_0x4754('0x43')](_0x34fd3f[_0x4754('0x38')],_0x3a19b2[_0x4754('0x42')]));if(_0x34fd3f[_0x4754('0x38')]['filter']){_0x33a894[_0x4754('0x41')]=_[_0x4754('0x2e')](_0x33a894[_0x4754('0x41')],{'$or':_[_0x4754('0x37')](_0x33a894[_0x4754('0x3c')],function(_0x3a5d65){var _0x3f37c5={};_0x3f37c5[_0x3a5d65]={'$like':'%'+_0x34fd3f['query'][_0x4754('0x45')]+'%'};return _0x3f37c5;})});}_0x33a894=_[_0x4754('0x2e')]({},_0x33a894,_0x34fd3f[_0x4754('0x46')]);return _0x47006d[_0x4754('0x87')](_0x33a894);}})[_0x4754('0x25')](function(_0x5e3953){if(_0x5e3953){_0x2d3be4=_0x5e3953['length'];if(!_0x34fd3f[_0x4754('0x38')]['hasOwnProperty'](_0x4754('0x3e'))){_0x33a894[_0x4754('0x20')]=qs[_0x4754('0x20')](_0x34fd3f['query']['limit']);_0x33a894[_0x4754('0x1d')]=qs[_0x4754('0x1d')](_0x34fd3f[_0x4754('0x38')]['offset']);}return _0x47006d[_0x4754('0x87')](_0x33a894);}})['then'](function(_0x513b3d){if(_0x513b3d){return _0x513b3d?{'count':_0x2d3be4,'rows':_0x513b3d}:null;}})['then'](respondWithResult(_0x35ac2a,null))[_0x4754('0x4b')](handleError(_0x35ac2a,null));};exports[_0x4754('0x88')]=function(_0x165b22,_0x139e53,_0x2fb100){var _0x2ce4b7,_0x103aed;return db[_0x4754('0x31')][_0x4754('0x58')]({'where':{'id':_0x165b22[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x139e53,null))[_0x4754('0x25')](function(_0x5ef8ef){if(_0x5ef8ef){_0x103aed=_0x5ef8ef;return _0x5ef8ef[_0x4754('0x88')](_0x165b22[_0x4754('0x2f')]['ids'],_[_0x4754('0x5a')](_0x165b22['body'],[_0x4754('0x68'),'id'])||{});}return null;})['spread'](function(_0x57bbf6){var _0x831893;_0x2ce4b7=_0x57bbf6||[];var _0x5d8e6b=[];if(_0x57bbf6){for(var _0x2126d8=0x0;_0x2126d8<_0x57bbf6[_0x4754('0x4e')];_0x2126d8+=0x1){var _0x2d30fb=_0x57bbf6[_0x2126d8][_0x4754('0x27')]({'plain':!![]});_0x831893=squel[_0x4754('0x6c')]()[_0x4754('0x6d')]('cm_hopper_black')[_0x4754('0x6f')]([_0x4754('0x70'),_0x4754('0x72'),_0x4754('0x77'),_0x4754('0x5e'),_0x4754('0x59'),'updatedAt'],squel['select']()['field'](_0x4754('0x70'),_0x4754('0x70'))['field']('id',_0x4754('0x72'))[_0x4754('0x74')](_0x2d30fb['CmListId'][_0x4754('0x76')](),_0x4754('0x77'))['field'](_0x165b22[_0x4754('0x4d')]['id']['toString'](),_0x4754('0x5e'))[_0x4754('0x74')](_0x4754('0x75'),'createdAt')[_0x4754('0x74')](_0x4754('0x75'),_0x4754('0x78'))[_0x4754('0x79')](_0x4754('0x7a'))[_0x4754('0x41')](_0x4754('0x82'))[_0x4754('0x41')](_0x4754('0x7b'),_0x2d30fb[_0x4754('0x81')][_0x4754('0x76')]())[_0x4754('0x41')](_0x4754('0x7c')))[_0x4754('0x76')]();_0x5d8e6b[_0x4754('0x89')](db[_0x4754('0x84')][_0x4754('0x38')](_0x831893));}return BPromise[_0x4754('0x85')](_0x5d8e6b);}})[_0x4754('0x25')](function(){return _0x2ce4b7;})[_0x4754('0x25')](respondWithResult(_0x139e53,null))['catch'](handleError(_0x139e53,null));};exports[_0x4754('0x8a')]=function(_0x47fba3,_0x46cbd5,_0x2de779){return db['Campaign'][_0x4754('0x58')]({'where':{'id':_0x47fba3[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x46cbd5,null))[_0x4754('0x25')](function(_0xee591c){if(_0xee591c){return _0xee591c[_0x4754('0x8a')](_0x47fba3[_0x4754('0x38')][_0x4754('0x68')]);}})[_0x4754('0x25')](function(_0x44d1ff){if(_0x44d1ff){return db[_0x4754('0x64')][_0x4754('0x26')]({'where':{'ListId':_0x47fba3[_0x4754('0x38')][_0x4754('0x68')],'CampaignId':_0x47fba3[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](function(){return _0x44d1ff;});}})[_0x4754('0x25')](respondWithStatusCode(_0x46cbd5,null))['catch'](handleError(_0x46cbd5,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 2010fee..b3d49c0 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 _0xce68=['define','Campaign','campaigns','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x139a8b,_0x7f1f97){var _0x55b133=function(_0x182feb){while(--_0x182feb){_0x139a8b['push'](_0x139a8b['shift']());}};_0x55b133(++_0x7f1f97);}(_0xce68,0x6f));var _0x8ce6=function(_0x56663d,_0x235666){_0x56663d=_0x56663d-0x0;var _0x4d4859=_0xce68[_0x56663d];return _0x4d4859;};'use strict';var _=require(_0x8ce6('0x0'));var util=require(_0x8ce6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8ce6('0x2'));var BPromise=require(_0x8ce6('0x3'));var rp=require(_0x8ce6('0x4'));var fs=require('fs');var path=require(_0x8ce6('0x5'));var rimraf=require(_0x8ce6('0x6'));var config=require(_0x8ce6('0x7'));var attributes=require('./campaign.attributes');module[_0x8ce6('0x8')]=function(_0x49d7a4,_0x4f905a){return _0x49d7a4[_0x8ce6('0x9')](_0x8ce6('0xa'),attributes,{'tableName':_0x8ce6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x125e=['Campaign','campaigns','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./campaign.attributes','define'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x125e,0xc2));var _0xe125=function(_0x455150,_0x274121){_0x455150=_0x455150-0x0;var _0x12ca9c=_0x125e[_0x455150];return _0x12ca9c;};'use strict';var _=require(_0xe125('0x0'));var util=require(_0xe125('0x1'));var logger=require('../../config/logger')(_0xe125('0x2'));var moment=require(_0xe125('0x3'));var BPromise=require(_0xe125('0x4'));var rp=require(_0xe125('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe125('0x6'));var config=require(_0xe125('0x7'));var attributes=require(_0xe125('0x8'));module['exports']=function(_0x4bfcd3,_0x3d04e8){return _0x4bfcd3[_0xe125('0x9')](_0xe125('0xa'),attributes,{'tableName':_0xe125('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 0c11e02..c9e3442 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x16b331,_0x5e41dd){var _0x48fdce=function(_0x2ecdb9){while(--_0x2ecdb9){_0x16b331['push'](_0x16b331['shift']());}};_0x48fdce(++_0x5e41dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1c63ef,_0x1dc339){var _0x16ade7=function(_0xf5bc43){while(--_0xf5bc43){_0x1c63ef['push'](_0x1c63ef['shift']());}};_0x16ade7(++_0x1dc339);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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']('Campaign,\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);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index ed95ce4..b6b61a2 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 _0x219b=['connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','put','update','delete','destroy','removeLists','exports','multer','path'];(function(_0x4fcfbf,_0x219428){var _0x5346c9=function(_0x9f8d49){while(--_0x9f8d49){_0x4fcfbf['push'](_0x4fcfbf['shift']());}};_0x5346c9(++_0x219428);}(_0x219b,0x8f));var _0xb219=function(_0x3041e7,_0x7ea232){_0x3041e7=_0x3041e7-0x0;var _0x402515=_0x219b[_0x3041e7];return _0x402515;};'use strict';var multer=require(_0xb219('0x0'));var util=require('util');var path=require(_0xb219('0x1'));var timeout=require(_0xb219('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb219('0x3'));var auth=require(_0xb219('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb219('0x5'));var controller=require(_0xb219('0x6'));router[_0xb219('0x7')]('/',auth[_0xb219('0x8')](),controller[_0xb219('0x9')]);router[_0xb219('0x7')](_0xb219('0xa'),auth[_0xb219('0x8')](),controller['show']);router[_0xb219('0x7')](_0xb219('0xb'),auth[_0xb219('0x8')](),controller[_0xb219('0xc')]);router[_0xb219('0x7')](_0xb219('0xd'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xb219('0x7')](_0xb219('0xe'),auth[_0xb219('0x8')](),controller[_0xb219('0xf')]);router[_0xb219('0x7')](_0xb219('0x10'),auth['isAuthenticated'](),controller[_0xb219('0x11')]);router[_0xb219('0x7')](_0xb219('0x12'),auth[_0xb219('0x8')](),controller[_0xb219('0x13')]);router[_0xb219('0x7')](_0xb219('0x14'),auth[_0xb219('0x8')](),controller['getBlackLists']);router[_0xb219('0x15')]('/',auth[_0xb219('0x8')](),controller[_0xb219('0x16')]);router[_0xb219('0x15')]('/:id/clone',auth[_0xb219('0x8')](),controller['clone']);router[_0xb219('0x15')]('/:id/lists',auth['isAuthenticated'](),controller['addLists']);router['post'](_0xb219('0x14'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0xb219('0x17')](_0xb219('0xa'),auth[_0xb219('0x8')](),controller[_0xb219('0x18')]);router[_0xb219('0x19')](_0xb219('0xa'),auth[_0xb219('0x8')](),controller[_0xb219('0x1a')]);router[_0xb219('0x19')]('/:id/lists',auth[_0xb219('0x8')](),controller[_0xb219('0x1b')]);router[_0xb219('0x19')](_0xb219('0x14'),auth[_0xb219('0x8')](),controller['removeBlackLists']);module[_0xb219('0x1c')]=router; \ No newline at end of file +var _0x4be7=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','getLists','getBlackLists','post','/:id/clone','clone','/:id/blacklists','addBlackLists','update','delete','destroy','/:id/lists','removeLists','removeBlackLists','exports'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0x4be7,0xc6));var _0x74be=function(_0x49693f,_0x4d994f){_0x49693f=_0x49693f-0x0;var _0x1b0f6e=_0x4be7[_0x49693f];return _0x1b0f6e;};'use strict';var multer=require(_0x74be('0x0'));var util=require(_0x74be('0x1'));var path=require(_0x74be('0x2'));var timeout=require(_0x74be('0x3'));var express=require(_0x74be('0x4'));var router=express['Router']();var fs_extra=require(_0x74be('0x5'));var auth=require(_0x74be('0x6'));var interaction=require(_0x74be('0x7'));var config=require(_0x74be('0x8'));var controller=require(_0x74be('0x9'));router[_0x74be('0xa')]('/',auth[_0x74be('0xb')](),controller['index']);router[_0x74be('0xa')](_0x74be('0xc'),auth[_0x74be('0xb')](),controller['show']);router[_0x74be('0xa')](_0x74be('0xd'),auth[_0x74be('0xb')](),controller['getHoppers']);router[_0x74be('0xa')](_0x74be('0xe'),auth[_0x74be('0xb')](),controller[_0x74be('0xf')]);router[_0x74be('0xa')](_0x74be('0x10'),auth[_0x74be('0xb')](),controller['getHopperFinals']);router[_0x74be('0xa')](_0x74be('0x11'),auth[_0x74be('0xb')](),controller[_0x74be('0x12')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0x74be('0x13')]);router[_0x74be('0xa')]('/:id/blacklists',auth[_0x74be('0xb')](),controller[_0x74be('0x14')]);router[_0x74be('0x15')]('/',auth[_0x74be('0xb')](),controller['create']);router['post'](_0x74be('0x16'),auth[_0x74be('0xb')](),controller[_0x74be('0x17')]);router['post']('/:id/lists',auth['isAuthenticated'](),controller['addLists']);router[_0x74be('0x15')](_0x74be('0x18'),auth['isAuthenticated'](),controller[_0x74be('0x19')]);router['put'](_0x74be('0xc'),auth[_0x74be('0xb')](),controller[_0x74be('0x1a')]);router[_0x74be('0x1b')](_0x74be('0xc'),auth[_0x74be('0xb')](),controller[_0x74be('0x1c')]);router[_0x74be('0x1b')](_0x74be('0x1d'),auth[_0x74be('0xb')](),controller[_0x74be('0x1e')]);router[_0x74be('0x1b')](_0x74be('0x18'),auth['isAuthenticated'](),controller[_0x74be('0x1f')]);module[_0x74be('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index f74793c..803ec93 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 _0x8497=['TEXT','sequelize','exports','STRING'];(function(_0x3c219d,_0x18a7cc){var _0x1e6765=function(_0xb94b81){while(--_0xb94b81){_0x3c219d['push'](_0x3c219d['shift']());}};_0x1e6765(++_0x18a7cc);}(_0x8497,0x109));var _0x7849=function(_0x436820,_0x3e3eb9){_0x436820=_0x436820-0x0;var _0x5e1800=_0x8497[_0x436820];return _0x5e1800;};'use strict';var Sequelize=require(_0x7849('0x0'));module[_0x7849('0x1')]={'key':{'type':Sequelize[_0x7849('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x7849('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x7849('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file +var _0xb7d7=['STRING','key','exports'];(function(_0x1f2d53,_0xb09b8c){var _0xdbedb9=function(_0x1e2041){while(--_0x1e2041){_0x1f2d53['push'](_0x1f2d53['shift']());}};_0xdbedb9(++_0xb09b8c);}(_0xb7d7,0xdd));var _0x7b7d=function(_0x9e0867,_0x2df073){_0x9e0867=_0x9e0867-0x0;var _0x31d1d2=_0xb7d7[_0x9e0867];return _0x31d1d2;};'use strict';var Sequelize=require('sequelize');module[_0x7b7d('0x0')]={'key':{'type':Sequelize[_0x7b7d('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x7b7d('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x7b7d('0x2'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 3d79c21..ff2e6a3 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 _0x9deb=['rawAttributes','fieldName','type','key','model','query','keys','intersection','length','nolimit','order','sort','filters','pick','filter','where','options','includeAll','findAll','rows','catch','show','params','fields','attributes','include','find','destroy','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','get','CannedAnswers','UserProfileResource','sendStatus','error','stack','name','render','merge','body','message','agent','interaction','index','map','CannedAnswer'];(function(_0x283b55,_0x279bee){var _0x192e58=function(_0x535c7c){while(--_0x535c7c){_0x283b55['push'](_0x283b55['shift']());}};_0x192e58(++_0x279bee);}(_0x9deb,0xdf));var _0xb9de=function(_0x5e39df,_0x5ee5c2){_0x5e39df=_0x5e39df-0x0;var _0x2ae0d8=_0x9deb[_0x5e39df];return _0x2ae0d8;};'use strict';var emlformat=require(_0xb9de('0x0'));var rimraf=require(_0xb9de('0x1'));var zipdir=require(_0xb9de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9de('0x3'));var moment=require(_0xb9de('0x4'));var BPromise=require(_0xb9de('0x5'));var Mustache=require(_0xb9de('0x6'));var util=require(_0xb9de('0x7'));var path=require('path');var sox=require(_0xb9de('0x8'));var csv=require(_0xb9de('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb9de('0xa'));var _=require(_0xb9de('0xb'));var squel=require('squel');var crypto=require(_0xb9de('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb9de('0xd'));var toCsv=require(_0xb9de('0x9'));var querystring=require('querystring');var Papa=require(_0xb9de('0xe'));var Redis=require(_0xb9de('0xf'));var authService=require(_0xb9de('0x10'));var qs=require(_0xb9de('0x11'));var as=require(_0xb9de('0x12'));var hardwareService=require(_0xb9de('0x13'));var logger=require(_0xb9de('0x14'))(_0xb9de('0x15'));var utils=require(_0xb9de('0x16'));var config=require(_0xb9de('0x17'));var licenseUtil=require(_0xb9de('0x18'));var db=require(_0xb9de('0x19'))['db'];function respondWithStatusCode(_0x47843a,_0x271efc){_0x271efc=_0x271efc||0xcc;return function(_0x57af46){if(_0x57af46){return _0x47843a['sendStatus'](_0x271efc);}return _0x47843a[_0xb9de('0x1a')](_0x271efc)[_0xb9de('0x1b')]();};}function respondWithResult(_0x5cb1a2,_0x246979){_0x246979=_0x246979||0xc8;return function(_0x5b1a73){if(_0x5b1a73){return _0x5cb1a2['status'](_0x246979)[_0xb9de('0x1c')](_0x5b1a73);}};}function respondWithFilteredResult(_0x5490fe,_0x3566ca){return function(_0xb62748){if(_0xb62748){var _0x13d1a5=typeof _0x3566ca[_0xb9de('0x1d')]==='undefined'&&typeof _0x3566ca[_0xb9de('0x1e')]==='undefined';var _0x55650f=_0xb62748[_0xb9de('0x1f')];var _0x41e462=_0x13d1a5?0x0:_0x3566ca['offset'];var _0x39b9e4=_0x13d1a5?_0xb62748[_0xb9de('0x1f')]:_0x3566ca[_0xb9de('0x1d')]+_0x3566ca[_0xb9de('0x1e')];var _0x3a072d;if(_0x39b9e4>=_0x55650f){_0x39b9e4=_0x55650f;_0x3a072d=0xc8;}else{_0x3a072d=0xce;}_0x5490fe['status'](_0x3a072d);return _0x5490fe['set'](_0xb9de('0x20'),_0x41e462+'-'+_0x39b9e4+'/'+_0x55650f)['json'](_0xb62748);}return null;};}function patchUpdates(_0x5d8051){return function(_0xb31dd8){try{jsonpatch['apply'](_0xb31dd8,_0x5d8051,!![]);}catch(_0x255b68){return BPromise[_0xb9de('0x21')](_0x255b68);}return _0xb31dd8[_0xb9de('0x22')]();};}function saveUpdates(_0x479ddf,_0x411341){return function(_0x26f5ba){if(_0x26f5ba){return _0x26f5ba[_0xb9de('0x23')](_0x479ddf)[_0xb9de('0x24')](function(_0x67f8b0){return _0x67f8b0;});}return null;};}function removeEntity(_0x5906b7,_0x869ad1){return function(_0x1285f2){if(_0x1285f2){return _0x1285f2['destroy']()['then'](function(){var _0x19516e=_0x1285f2[_0xb9de('0x25')]({'plain':!![]});var _0x3fd386=_0xb9de('0x26');return db[_0xb9de('0x27')]['destroy']({'where':{'type':_0x3fd386,'resourceId':_0x19516e['id']}})['then'](function(){return _0x1285f2;});})['then'](function(){_0x5906b7['status'](0xcc)[_0xb9de('0x1b')]();});}};}function handleEntityNotFound(_0x17155d,_0x5e8275){return function(_0x53134f){if(!_0x53134f){_0x17155d[_0xb9de('0x28')](0x194);}return _0x53134f;};}function handleError(_0xedee15,_0x53b3a7){_0x53b3a7=_0x53b3a7||0x1f4;return function(_0x17a694){logger[_0xb9de('0x29')](_0x17a694[_0xb9de('0x2a')]);if(_0x17a694['name']){delete _0x17a694[_0xb9de('0x2b')];}_0xedee15[_0xb9de('0x1a')](_0x53b3a7)['send'](_0x17a694);};}function getMustacheRender(_0x492b92,_0xcce7c2){return Mustache[_0xb9de('0x2c')](_0x492b92,_[_0xb9de('0x2d')](_0xcce7c2[_0xb9de('0x2e')],{'contact':_0xcce7c2['contact'],'message':_0xcce7c2[_0xb9de('0x2f')],'agent':_0xcce7c2[_0xb9de('0x30')],'interaction':_0xcce7c2[_0xb9de('0x31')],'account':_0xcce7c2['account']}))||'';}exports[_0xb9de('0x32')]=function(_0x149736,_0x35fc56){var _0x317877={},_0x40d840={},_0x4edcb2={'count':0x0,'rows':[]};var _0x2fb793=_[_0xb9de('0x33')](db[_0xb9de('0x34')][_0xb9de('0x35')],function(_0x2d592d){return{'name':_0x2d592d[_0xb9de('0x36')],'type':_0x2d592d[_0xb9de('0x37')][_0xb9de('0x38')]};});_0x40d840[_0xb9de('0x39')]=_[_0xb9de('0x33')](_0x2fb793,_0xb9de('0x2b'));_0x40d840[_0xb9de('0x3a')]=_[_0xb9de('0x3b')](_0x149736[_0xb9de('0x3a')]);_0x40d840['filters']=_[_0xb9de('0x3c')](_0x40d840[_0xb9de('0x39')],_0x40d840[_0xb9de('0x3a')]);_0x317877['attributes']=_[_0xb9de('0x3c')](_0x40d840[_0xb9de('0x39')],qs['fields'](_0x149736[_0xb9de('0x3a')]['fields']));_0x317877['attributes']=_0x317877['attributes'][_0xb9de('0x3d')]?_0x317877['attributes']:_0x40d840[_0xb9de('0x39')];if(!_0x149736[_0xb9de('0x3a')]['hasOwnProperty'](_0xb9de('0x3e'))){_0x317877[_0xb9de('0x1e')]=qs[_0xb9de('0x1e')](_0x149736['query'][_0xb9de('0x1e')]);_0x317877[_0xb9de('0x1d')]=qs[_0xb9de('0x1d')](_0x149736[_0xb9de('0x3a')][_0xb9de('0x1d')]);}_0x317877[_0xb9de('0x3f')]=qs[_0xb9de('0x40')](_0x149736[_0xb9de('0x3a')]['sort']);_0x317877['where']=qs[_0xb9de('0x41')](_[_0xb9de('0x42')](_0x149736[_0xb9de('0x3a')],_0x40d840[_0xb9de('0x41')]),_0x2fb793);if(_0x149736[_0xb9de('0x3a')][_0xb9de('0x43')]){_0x317877[_0xb9de('0x44')]=_[_0xb9de('0x2d')](_0x317877[_0xb9de('0x44')],{'$or':[{'key':{'$like':'%'+_0x149736[_0xb9de('0x3a')][_0xb9de('0x43')]+'%'}},{'value':{'$like':'%'+_0x149736[_0xb9de('0x3a')][_0xb9de('0x43')]+'%'}}]});}_0x317877=_[_0xb9de('0x2d')]({},_0x317877,_0x149736[_0xb9de('0x45')]);var _0x2aec2b={'where':_0x317877[_0xb9de('0x44')]};return db['CannedAnswer'][_0xb9de('0x1f')](_0x2aec2b)[_0xb9de('0x24')](function(_0x2a8001){_0x4edcb2[_0xb9de('0x1f')]=_0x2a8001;if(_0x149736[_0xb9de('0x3a')][_0xb9de('0x46')]){_0x317877['include']=[{'all':!![]}];}return db[_0xb9de('0x34')][_0xb9de('0x47')](_0x317877);})[_0xb9de('0x24')](function(_0x2cbed4){_0x4edcb2[_0xb9de('0x48')]=_0x2cbed4;return _0x4edcb2;})[_0xb9de('0x24')](respondWithFilteredResult(_0x35fc56,_0x317877))[_0xb9de('0x49')](handleError(_0x35fc56,null));};exports[_0xb9de('0x4a')]=function(_0x3c81e2,_0x58c65d){var _0x5afcfe={'raw':!![],'where':{'id':_0x3c81e2[_0xb9de('0x4b')]['id']}},_0x57c395={};_0x57c395[_0xb9de('0x39')]=_[_0xb9de('0x3b')](db[_0xb9de('0x34')][_0xb9de('0x35')]);_0x57c395[_0xb9de('0x3a')]=_[_0xb9de('0x3b')](_0x3c81e2[_0xb9de('0x3a')]);_0x57c395[_0xb9de('0x41')]=_['intersection'](_0x57c395[_0xb9de('0x39')],_0x57c395[_0xb9de('0x3a')]);_0x5afcfe['attributes']=_[_0xb9de('0x3c')](_0x57c395[_0xb9de('0x39')],qs[_0xb9de('0x4c')](_0x3c81e2[_0xb9de('0x3a')][_0xb9de('0x4c')]));_0x5afcfe[_0xb9de('0x4d')]=_0x5afcfe[_0xb9de('0x4d')]['length']?_0x5afcfe['attributes']:_0x57c395[_0xb9de('0x39')];if(_0x3c81e2[_0xb9de('0x3a')][_0xb9de('0x46')]){_0x5afcfe[_0xb9de('0x4e')]=[{'all':!![]}];}_0x5afcfe=_['merge']({},_0x5afcfe,_0x3c81e2[_0xb9de('0x45')]);return db['CannedAnswer'][_0xb9de('0x4f')](_0x5afcfe)[_0xb9de('0x24')](handleEntityNotFound(_0x58c65d,null))[_0xb9de('0x24')](respondWithResult(_0x58c65d,null))[_0xb9de('0x49')](handleError(_0x58c65d,null));};exports['update']=function(_0x5647af,_0x143268){if(_0x5647af[_0xb9de('0x2e')]['id']){delete _0x5647af['body']['id'];}return db[_0xb9de('0x34')][_0xb9de('0x4f')]({'where':{'id':_0x5647af[_0xb9de('0x4b')]['id']}})[_0xb9de('0x24')](handleEntityNotFound(_0x143268,null))[_0xb9de('0x24')](saveUpdates(_0x5647af[_0xb9de('0x2e')],null))[_0xb9de('0x24')](respondWithResult(_0x143268,null))[_0xb9de('0x49')](handleError(_0x143268,null));};exports[_0xb9de('0x50')]=function(_0xc4903f,_0x4026e5){return db[_0xb9de('0x34')][_0xb9de('0x4f')]({'where':{'id':_0xc4903f['params']['id']}})[_0xb9de('0x24')](handleEntityNotFound(_0x4026e5,null))[_0xb9de('0x24')](removeEntity(_0x4026e5,null))[_0xb9de('0x49')](handleError(_0x4026e5,null));};exports['create']=function(_0x170631,_0x22b96f){var _0xc598e={'key':_0x170631[_0xb9de('0x2e')]['key']};if(_0x170631[_0xb9de('0x2e')][_0xb9de('0x51')]){_0xc598e[_0xb9de('0x51')]=_0x170631[_0xb9de('0x2e')][_0xb9de('0x51')];}else if(_0x170631[_0xb9de('0x2e')]['SmsAccountId']){_0xc598e['SmsAccountId']=_0x170631['body'][_0xb9de('0x52')];}else if(_0x170631[_0xb9de('0x2e')]['OpenchannelAccountId']){_0xc598e[_0xb9de('0x53')]=_0x170631[_0xb9de('0x2e')]['OpenchannelAccountId'];}else if(_0x170631['body'][_0xb9de('0x54')]){_0xc598e[_0xb9de('0x54')]=_0x170631[_0xb9de('0x2e')][_0xb9de('0x54')];}return db[_0xb9de('0x34')]['find']({'where':_0xc598e})[_0xb9de('0x24')](function(_0x4a1d16){if(_0x4a1d16){throw new db[(_0xb9de('0x55'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xb9de('0x34')][_0xb9de('0x56')](_0x170631[_0xb9de('0x2e')]);})[_0xb9de('0x24')](function(_0x29765c){var _0x2b29ca=_0x170631[_0xb9de('0x57')][_0xb9de('0x25')]({'plain':!![]});if(!_0x2b29ca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b29ca[_0xb9de('0x58')]===_0xb9de('0x57')){var _0x5305a0=_0x29765c[_0xb9de('0x25')]({'plain':!![]});return db[_0xb9de('0x59')][_0xb9de('0x4f')]({'where':{'name':_0xb9de('0x26'),'userProfileId':_0x2b29ca['userProfileId']},'raw':!![]})['then'](function(_0x382969){if(_0x382969&&_0x382969[_0xb9de('0x5a')]===0x0){return db[_0xb9de('0x27')][_0xb9de('0x56')]({'name':_0x5305a0[_0xb9de('0x2b')],'resourceId':_0x5305a0['id'],'type':_0x382969['name'],'sectionId':_0x382969['id']},{})[_0xb9de('0x24')](function(){return _0x29765c;});}else{return _0x29765c;}})['catch'](function(_0x447ebc){logger[_0xb9de('0x29')](_0xb9de('0x5b'),_0x447ebc);throw _0x447ebc;});}return _0x29765c;})[_0xb9de('0x24')](respondWithResult(_0x22b96f,0xc9))[_0xb9de('0x49')](handleError(_0x22b96f,null));}; \ No newline at end of file +var _0x2c91=['send','render','merge','contact','message','agent','interaction','account','map','CannedAnswer','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','catch','params','intersection','length','options','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','get','CannedAnswers','UserProfileResource','destroy','error','stack','name'];(function(_0x5c5371,_0x3ac3ed){var _0x443bd2=function(_0x36c999){while(--_0x36c999){_0x5c5371['push'](_0x5c5371['shift']());}};_0x443bd2(++_0x3ac3ed);}(_0x2c91,0x158));var _0x12c9=function(_0x8fb908,_0x34e41c){_0x8fb908=_0x8fb908-0x0;var _0x312509=_0x2c91[_0x8fb908];return _0x312509;};'use strict';var emlformat=require(_0x12c9('0x0'));var rimraf=require(_0x12c9('0x1'));var zipdir=require(_0x12c9('0x2'));var jsonpatch=require(_0x12c9('0x3'));var rp=require(_0x12c9('0x4'));var moment=require(_0x12c9('0x5'));var BPromise=require(_0x12c9('0x6'));var Mustache=require(_0x12c9('0x7'));var util=require('util');var path=require(_0x12c9('0x8'));var sox=require(_0x12c9('0x9'));var csv=require(_0x12c9('0xa'));var ejs=require(_0x12c9('0xb'));var fs=require('fs');var fs_extra=require(_0x12c9('0xc'));var _=require(_0x12c9('0xd'));var squel=require(_0x12c9('0xe'));var crypto=require('crypto');var jsforce=require(_0x12c9('0xf'));var deskjs=require(_0x12c9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x12c9('0x11'));var Papa=require(_0x12c9('0x12'));var Redis=require('ioredis');var authService=require(_0x12c9('0x13'));var qs=require(_0x12c9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12c9('0x15'));var logger=require(_0x12c9('0x16'))('api');var utils=require(_0x12c9('0x17'));var config=require(_0x12c9('0x18'));var licenseUtil=require(_0x12c9('0x19'));var db=require(_0x12c9('0x1a'))['db'];function respondWithStatusCode(_0x278da5,_0x2b239d){_0x2b239d=_0x2b239d||0xcc;return function(_0x5629b7){if(_0x5629b7){return _0x278da5[_0x12c9('0x1b')](_0x2b239d);}return _0x278da5[_0x12c9('0x1c')](_0x2b239d)[_0x12c9('0x1d')]();};}function respondWithResult(_0x4d0388,_0x4bf1a9){_0x4bf1a9=_0x4bf1a9||0xc8;return function(_0x490854){if(_0x490854){return _0x4d0388['status'](_0x4bf1a9)['json'](_0x490854);}};}function respondWithFilteredResult(_0x9fa35,_0x4e4cbf){return function(_0x3a83b4){if(_0x3a83b4){var _0x4460d5=typeof _0x4e4cbf[_0x12c9('0x1e')]===_0x12c9('0x1f')&&typeof _0x4e4cbf[_0x12c9('0x20')]==='undefined';var _0x2f704c=_0x3a83b4[_0x12c9('0x21')];var _0x1890d4=_0x4460d5?0x0:_0x4e4cbf[_0x12c9('0x1e')];var _0x44e9af=_0x4460d5?_0x3a83b4[_0x12c9('0x21')]:_0x4e4cbf[_0x12c9('0x1e')]+_0x4e4cbf[_0x12c9('0x20')];var _0x59b225;if(_0x44e9af>=_0x2f704c){_0x44e9af=_0x2f704c;_0x59b225=0xc8;}else{_0x59b225=0xce;}_0x9fa35[_0x12c9('0x1c')](_0x59b225);return _0x9fa35['set'](_0x12c9('0x22'),_0x1890d4+'-'+_0x44e9af+'/'+_0x2f704c)[_0x12c9('0x23')](_0x3a83b4);}return null;};}function patchUpdates(_0xd036ef){return function(_0x17675e){try{jsonpatch[_0x12c9('0x24')](_0x17675e,_0xd036ef,!![]);}catch(_0x4e767a){return BPromise[_0x12c9('0x25')](_0x4e767a);}return _0x17675e[_0x12c9('0x26')]();};}function saveUpdates(_0x2a324f,_0x36d400){return function(_0x370126){if(_0x370126){return _0x370126[_0x12c9('0x27')](_0x2a324f)[_0x12c9('0x28')](function(_0x1d7942){return _0x1d7942;});}return null;};}function removeEntity(_0x210a77,_0x2eecec){return function(_0x905751){if(_0x905751){return _0x905751['destroy']()[_0x12c9('0x28')](function(){var _0x1599a8=_0x905751[_0x12c9('0x29')]({'plain':!![]});var _0x1aa6a8=_0x12c9('0x2a');return db[_0x12c9('0x2b')][_0x12c9('0x2c')]({'where':{'type':_0x1aa6a8,'resourceId':_0x1599a8['id']}})[_0x12c9('0x28')](function(){return _0x905751;});})[_0x12c9('0x28')](function(){_0x210a77[_0x12c9('0x1c')](0xcc)[_0x12c9('0x1d')]();});}};}function handleEntityNotFound(_0x340f24,_0x447dec){return function(_0x2224ce){if(!_0x2224ce){_0x340f24[_0x12c9('0x1b')](0x194);}return _0x2224ce;};}function handleError(_0x4141db,_0x248bff){_0x248bff=_0x248bff||0x1f4;return function(_0xa53d40){logger[_0x12c9('0x2d')](_0xa53d40[_0x12c9('0x2e')]);if(_0xa53d40['name']){delete _0xa53d40[_0x12c9('0x2f')];}_0x4141db[_0x12c9('0x1c')](_0x248bff)[_0x12c9('0x30')](_0xa53d40);};}function getMustacheRender(_0x284224,_0x6ddf60){return Mustache[_0x12c9('0x31')](_0x284224,_[_0x12c9('0x32')](_0x6ddf60['body'],{'contact':_0x6ddf60[_0x12c9('0x33')],'message':_0x6ddf60[_0x12c9('0x34')],'agent':_0x6ddf60[_0x12c9('0x35')],'interaction':_0x6ddf60[_0x12c9('0x36')],'account':_0x6ddf60[_0x12c9('0x37')]}))||'';}exports['index']=function(_0x238239,_0x5aaf33){var _0x147d0c={},_0x1604b8={},_0x1763fd={'count':0x0,'rows':[]};var _0xadd087=_[_0x12c9('0x38')](db[_0x12c9('0x39')][_0x12c9('0x3a')],function(_0x2fdd28){return{'name':_0x2fdd28[_0x12c9('0x3b')],'type':_0x2fdd28['type']['key']};});_0x1604b8[_0x12c9('0x3c')]=_[_0x12c9('0x38')](_0xadd087,_0x12c9('0x2f'));_0x1604b8[_0x12c9('0x3d')]=_[_0x12c9('0x3e')](_0x238239[_0x12c9('0x3d')]);_0x1604b8[_0x12c9('0x3f')]=_['intersection'](_0x1604b8[_0x12c9('0x3c')],_0x1604b8[_0x12c9('0x3d')]);_0x147d0c[_0x12c9('0x40')]=_['intersection'](_0x1604b8[_0x12c9('0x3c')],qs[_0x12c9('0x41')](_0x238239['query'][_0x12c9('0x41')]));_0x147d0c[_0x12c9('0x40')]=_0x147d0c[_0x12c9('0x40')]['length']?_0x147d0c[_0x12c9('0x40')]:_0x1604b8[_0x12c9('0x3c')];if(!_0x238239[_0x12c9('0x3d')][_0x12c9('0x42')](_0x12c9('0x43'))){_0x147d0c[_0x12c9('0x20')]=qs[_0x12c9('0x20')](_0x238239[_0x12c9('0x3d')][_0x12c9('0x20')]);_0x147d0c[_0x12c9('0x1e')]=qs['offset'](_0x238239[_0x12c9('0x3d')][_0x12c9('0x1e')]);}_0x147d0c[_0x12c9('0x44')]=qs[_0x12c9('0x45')](_0x238239[_0x12c9('0x3d')]['sort']);_0x147d0c[_0x12c9('0x46')]=qs['filters'](_[_0x12c9('0x47')](_0x238239[_0x12c9('0x3d')],_0x1604b8[_0x12c9('0x3f')]),_0xadd087);if(_0x238239['query']['filter']){_0x147d0c[_0x12c9('0x46')]=_[_0x12c9('0x32')](_0x147d0c[_0x12c9('0x46')],{'$or':[{'key':{'$like':'%'+_0x238239[_0x12c9('0x3d')][_0x12c9('0x48')]+'%'}},{'value':{'$like':'%'+_0x238239['query'][_0x12c9('0x48')]+'%'}}]});}_0x147d0c=_[_0x12c9('0x32')]({},_0x147d0c,_0x238239['options']);var _0x18b73a={'where':_0x147d0c[_0x12c9('0x46')]};return db[_0x12c9('0x39')]['count'](_0x18b73a)[_0x12c9('0x28')](function(_0x179972){_0x1763fd['count']=_0x179972;if(_0x238239[_0x12c9('0x3d')][_0x12c9('0x49')]){_0x147d0c[_0x12c9('0x4a')]=[{'all':!![]}];}return db[_0x12c9('0x39')][_0x12c9('0x4b')](_0x147d0c);})[_0x12c9('0x28')](function(_0x11cbe8){_0x1763fd['rows']=_0x11cbe8;return _0x1763fd;})[_0x12c9('0x28')](respondWithFilteredResult(_0x5aaf33,_0x147d0c))[_0x12c9('0x4c')](handleError(_0x5aaf33,null));};exports['show']=function(_0xdc0408,_0x1c450c){var _0x171e41={'raw':!![],'where':{'id':_0xdc0408[_0x12c9('0x4d')]['id']}},_0x21a3fa={};_0x21a3fa[_0x12c9('0x3c')]=_[_0x12c9('0x3e')](db['CannedAnswer'][_0x12c9('0x3a')]);_0x21a3fa['query']=_[_0x12c9('0x3e')](_0xdc0408['query']);_0x21a3fa['filters']=_[_0x12c9('0x4e')](_0x21a3fa[_0x12c9('0x3c')],_0x21a3fa['query']);_0x171e41[_0x12c9('0x40')]=_[_0x12c9('0x4e')](_0x21a3fa[_0x12c9('0x3c')],qs[_0x12c9('0x41')](_0xdc0408[_0x12c9('0x3d')][_0x12c9('0x41')]));_0x171e41[_0x12c9('0x40')]=_0x171e41['attributes'][_0x12c9('0x4f')]?_0x171e41[_0x12c9('0x40')]:_0x21a3fa[_0x12c9('0x3c')];if(_0xdc0408[_0x12c9('0x3d')]['includeAll']){_0x171e41[_0x12c9('0x4a')]=[{'all':!![]}];}_0x171e41=_['merge']({},_0x171e41,_0xdc0408[_0x12c9('0x50')]);return db[_0x12c9('0x39')][_0x12c9('0x51')](_0x171e41)[_0x12c9('0x28')](handleEntityNotFound(_0x1c450c,null))['then'](respondWithResult(_0x1c450c,null))[_0x12c9('0x4c')](handleError(_0x1c450c,null));};exports[_0x12c9('0x27')]=function(_0x39b578,_0x58d2ff){if(_0x39b578[_0x12c9('0x52')]['id']){delete _0x39b578['body']['id'];}return db[_0x12c9('0x39')][_0x12c9('0x51')]({'where':{'id':_0x39b578['params']['id']}})['then'](handleEntityNotFound(_0x58d2ff,null))['then'](saveUpdates(_0x39b578[_0x12c9('0x52')],null))[_0x12c9('0x28')](respondWithResult(_0x58d2ff,null))[_0x12c9('0x4c')](handleError(_0x58d2ff,null));};exports['destroy']=function(_0x4babe8,_0x9db27b){return db[_0x12c9('0x39')]['find']({'where':{'id':_0x4babe8[_0x12c9('0x4d')]['id']}})[_0x12c9('0x28')](handleEntityNotFound(_0x9db27b,null))[_0x12c9('0x28')](removeEntity(_0x9db27b,null))[_0x12c9('0x4c')](handleError(_0x9db27b,null));};exports[_0x12c9('0x53')]=function(_0x19f865,_0x2750c9){var _0x434ab3={'key':_0x19f865['body'][_0x12c9('0x54')]};if(_0x19f865[_0x12c9('0x52')][_0x12c9('0x55')]){_0x434ab3[_0x12c9('0x55')]=_0x19f865[_0x12c9('0x52')]['MailAccountId'];}else if(_0x19f865['body'][_0x12c9('0x56')]){_0x434ab3['SmsAccountId']=_0x19f865['body'][_0x12c9('0x56')];}else if(_0x19f865[_0x12c9('0x52')]['OpenchannelAccountId']){_0x434ab3[_0x12c9('0x57')]=_0x19f865[_0x12c9('0x52')][_0x12c9('0x57')];}else if(_0x19f865[_0x12c9('0x52')][_0x12c9('0x58')]){_0x434ab3[_0x12c9('0x58')]=_0x19f865[_0x12c9('0x52')][_0x12c9('0x58')];}return db[_0x12c9('0x39')][_0x12c9('0x51')]({'where':_0x434ab3})[_0x12c9('0x28')](function(_0x461a06){if(_0x461a06){throw new db[(_0x12c9('0x59'))][(_0x12c9('0x5a'))](_0x12c9('0x5b'));}return db[_0x12c9('0x39')]['create'](_0x19f865[_0x12c9('0x52')]);})[_0x12c9('0x28')](function(_0x1aa875){var _0x5866f5=_0x19f865[_0x12c9('0x5c')][_0x12c9('0x29')]({'plain':!![]});if(!_0x5866f5)throw new Error(_0x12c9('0x5d'));if(_0x5866f5[_0x12c9('0x5e')]===_0x12c9('0x5c')){var _0x2e9637=_0x1aa875['get']({'plain':!![]});return db[_0x12c9('0x5f')]['find']({'where':{'name':_0x12c9('0x2a'),'userProfileId':_0x5866f5[_0x12c9('0x60')]},'raw':!![]})[_0x12c9('0x28')](function(_0x4493a5){if(_0x4493a5&&_0x4493a5['autoAssociation']===0x0){return db[_0x12c9('0x2b')][_0x12c9('0x53')]({'name':_0x2e9637[_0x12c9('0x2f')],'resourceId':_0x2e9637['id'],'type':_0x4493a5[_0x12c9('0x2f')],'sectionId':_0x4493a5['id']},{})['then'](function(){return _0x1aa875;});}else{return _0x1aa875;}})['catch'](function(_0x54ed8e){logger[_0x12c9('0x2d')](_0x12c9('0x61'),_0x54ed8e);throw _0x54ed8e;});}return _0x1aa875;})[_0x12c9('0x28')](respondWithResult(_0x2750c9,0xc9))[_0x12c9('0x4c')](handleError(_0x2750c9,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 3463798..c1efa86 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 _0x0c5d=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','utf8mb4'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x0c5d,0x6c));var _0xd0c5=function(_0xbb5887,_0x5ea50c){_0xbb5887=_0xbb5887-0x0;var _0x5a653c=_0x0c5d[_0xbb5887];return _0x5a653c;};'use strict';var _=require(_0xd0c5('0x0'));var util=require(_0xd0c5('0x1'));var logger=require('../../config/logger')(_0xd0c5('0x2'));var moment=require('moment');var BPromise=require(_0xd0c5('0x3'));var rp=require(_0xd0c5('0x4'));var fs=require('fs');var path=require(_0xd0c5('0x5'));var rimraf=require(_0xd0c5('0x6'));var config=require(_0xd0c5('0x7'));var attributes=require(_0xd0c5('0x8'));module[_0xd0c5('0x9')]=function(_0x121911,_0x569992){return _0x121911[_0xd0c5('0xa')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd0c5('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa9e5=['CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define'];(function(_0x3a63fd,_0x587403){var _0x57cae3=function(_0x315d1b){while(--_0x315d1b){_0x3a63fd['push'](_0x3a63fd['shift']());}};_0x57cae3(++_0x587403);}(_0xa9e5,0x8a));var _0x5a9e=function(_0x29ee3f,_0x119406){_0x29ee3f=_0x29ee3f-0x0;var _0xe8b75e=_0xa9e5[_0x29ee3f];return _0xe8b75e;};'use strict';var _=require(_0x5a9e('0x0'));var util=require(_0x5a9e('0x1'));var logger=require('../../config/logger')(_0x5a9e('0x2'));var moment=require(_0x5a9e('0x3'));var BPromise=require(_0x5a9e('0x4'));var rp=require(_0x5a9e('0x5'));var fs=require('fs');var path=require(_0x5a9e('0x6'));var rimraf=require(_0x5a9e('0x7'));var config=require(_0x5a9e('0x8'));var attributes=require(_0x5a9e('0x9'));module[_0x5a9e('0xa')]=function(_0x34a9ed,_0x1fb122){return _0x34a9ed[_0x5a9e('0xb')](_0x5a9e('0xc'),attributes,{'tableName':_0x5a9e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5a9e('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index a0c8478..100a014 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 _0x10c6=['then','CannedAnswer,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x520353,_0x10abaa){var _0x192d1e=function(_0x553411){while(--_0x553411){_0x520353['push'](_0x520353['shift']());}};_0x192d1e(++_0x10abaa);}(_0x10c6,0x1d8));var _0x610c=function(_0x176a60,_0x39cd0b){_0x176a60=_0x176a60-0x0;var _0x12ba0d=_0x10c6[_0x176a60];return _0x12ba0d;};'use strict';var _=require(_0x610c('0x0'));var util=require('util');var moment=require(_0x610c('0x1'));var BPromise=require(_0x610c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x610c('0x3'));var db=require(_0x610c('0x4'))['db'];var utils=require(_0x610c('0x5'));var logger=require(_0x610c('0x6'))(_0x610c('0x7'));var config=require(_0x610c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x610c('0x9')][_0x610c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49a6f9,_0x28a9b6,_0x186e40){return new BPromise(function(_0x34a679,_0x25f693){return client[_0x610c('0xb')](_0x49a6f9,_0x186e40)[_0x610c('0xc')](function(_0x86459e){logger['info'](_0x610c('0xd'),_0x28a9b6,'request\x20sent');logger[_0x610c('0xe')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x28a9b6,_0x610c('0xf'),JSON[_0x610c('0x10')](_0x86459e));if(_0x86459e['error']){if(_0x86459e[_0x610c('0x11')]['code']===0x1f4){logger[_0x610c('0x11')](_0x610c('0xd'),_0x28a9b6,_0x86459e['error'][_0x610c('0x12')]);return _0x25f693(_0x86459e[_0x610c('0x11')][_0x610c('0x12')]);}logger['error'](_0x610c('0xd'),_0x28a9b6,_0x86459e[_0x610c('0x11')][_0x610c('0x12')]);return _0x34a679(_0x86459e[_0x610c('0x11')]['message']);}else{logger[_0x610c('0x13')](_0x610c('0xd'),_0x28a9b6,_0x610c('0xf'));_0x34a679(_0x86459e[_0x610c('0x14')][_0x610c('0x12')]);}})[_0x610c('0x15')](function(_0x3dd1f3){logger[_0x610c('0x11')](_0x610c('0xd'),_0x28a9b6,_0x3dd1f3);_0x25f693(_0x3dd1f3);});});} \ No newline at end of file +var _0x2163=['http','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2163,0x193));var _0x3216=function(_0x1dfc65,_0x2de3e9){_0x1dfc65=_0x1dfc65-0x0;var _0x1768f6=_0x2163[_0x1dfc65];return _0x1768f6;};'use strict';var _=require('lodash');var util=require(_0x3216('0x0'));var moment=require(_0x3216('0x1'));var BPromise=require(_0x3216('0x2'));var rs=require(_0x3216('0x3'));var fs=require('fs');var Redis=require(_0x3216('0x4'));var db=require(_0x3216('0x5'))['db'];var utils=require(_0x3216('0x6'));var logger=require(_0x3216('0x7'))(_0x3216('0x8'));var config=require(_0x3216('0x9'));var jayson=require(_0x3216('0xa'));var client=jayson['client'][_0x3216('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f5ce5,_0x4a7fb4,_0x45dedd){return new BPromise(function(_0x576e59,_0x3b8ca1){return client[_0x3216('0xc')](_0x4f5ce5,_0x45dedd)[_0x3216('0xd')](function(_0x4ea4b5){logger[_0x3216('0xe')](_0x3216('0xf'),_0x4a7fb4,_0x3216('0x10'));logger['debug'](_0x3216('0x11'),_0x4a7fb4,_0x3216('0x10'),JSON[_0x3216('0x12')](_0x4ea4b5));if(_0x4ea4b5[_0x3216('0x13')]){if(_0x4ea4b5[_0x3216('0x13')][_0x3216('0x14')]===0x1f4){logger[_0x3216('0x13')](_0x3216('0xf'),_0x4a7fb4,_0x4ea4b5['error'][_0x3216('0x15')]);return _0x3b8ca1(_0x4ea4b5[_0x3216('0x13')][_0x3216('0x15')]);}logger[_0x3216('0x13')]('CannedAnswer,\x20%s,\x20%s',_0x4a7fb4,_0x4ea4b5['error'][_0x3216('0x15')]);return _0x576e59(_0x4ea4b5[_0x3216('0x13')][_0x3216('0x15')]);}else{logger['info'](_0x3216('0xf'),_0x4a7fb4,_0x3216('0x10'));_0x576e59(_0x4ea4b5[_0x3216('0x16')][_0x3216('0x15')]);}})['catch'](function(_0x1621c7){logger[_0x3216('0x13')](_0x3216('0xf'),_0x4a7fb4,_0x1621c7);_0x3b8ca1(_0x1621c7);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 6168f75..e082c15 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 _0x6401=['../../config/environment','./cannedAnswer.controller','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4c310e,_0x18fdfb){var _0x4adecc=function(_0x498070){while(--_0x498070){_0x4c310e['push'](_0x4c310e['shift']());}};_0x4adecc(++_0x18fdfb);}(_0x6401,0xf5));var _0x1640=function(_0x5cb1cd,_0x1465d0){_0x5cb1cd=_0x5cb1cd-0x0;var _0x40a91b=_0x6401[_0x5cb1cd];return _0x40a91b;};'use strict';var multer=require(_0x1640('0x0'));var util=require(_0x1640('0x1'));var path=require(_0x1640('0x2'));var timeout=require('connect-timeout');var express=require(_0x1640('0x3'));var router=express[_0x1640('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1640('0x5'));var interaction=require(_0x1640('0x6'));var config=require(_0x1640('0x7'));var controller=require(_0x1640('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1640('0x9')]);router['get'](_0x1640('0xa'),auth[_0x1640('0xb')](),controller[_0x1640('0xc')]);router[_0x1640('0xd')]('/',auth[_0x1640('0xb')](),controller[_0x1640('0xe')]);router['put']('/:id',auth[_0x1640('0xb')](),controller[_0x1640('0xf')]);router[_0x1640('0x10')](_0x1640('0xa'),auth[_0x1640('0xb')](),controller[_0x1640('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf07a=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4374e8,_0x2fd1c5){var _0x10c4e2=function(_0x25d44e){while(--_0x25d44e){_0x4374e8['push'](_0x4374e8['shift']());}};_0x10c4e2(++_0x2fd1c5);}(_0xf07a,0x1e6));var _0xaf07=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0xf07a[_0x2ce6d5];return _0x32d272;};'use strict';var multer=require(_0xaf07('0x0'));var util=require(_0xaf07('0x1'));var path=require(_0xaf07('0x2'));var timeout=require(_0xaf07('0x3'));var express=require('express');var router=express[_0xaf07('0x4')]();var fs_extra=require(_0xaf07('0x5'));var auth=require(_0xaf07('0x6'));var interaction=require(_0xaf07('0x7'));var config=require(_0xaf07('0x8'));var controller=require('./cannedAnswer.controller');router[_0xaf07('0x9')]('/',auth[_0xaf07('0xa')](),controller[_0xaf07('0xb')]);router[_0xaf07('0x9')](_0xaf07('0xc'),auth['isAuthenticated'](),controller[_0xaf07('0xd')]);router['post']('/',auth[_0xaf07('0xa')](),controller['create']);router['put']('/:id',auth[_0xaf07('0xa')](),controller[_0xaf07('0xe')]);router[_0xaf07('0xf')](_0xaf07('0xc'),auth['isAuthenticated'](),controller[_0xaf07('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index c5dd250..85333e2 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 _0x5b71=['sequelize','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x3d3dcd,_0x3d76a2){var _0x4eba97=function(_0x1e16e1){while(--_0x1e16e1){_0x3d3dcd['push'](_0x3d3dcd['shift']());}};_0x4eba97(++_0x3d76a2);}(_0x5b71,0x120));var _0x15b7=function(_0x33a77d,_0x42f466){_0x33a77d=_0x33a77d-0x0;var _0xa33b61=_0x5b71[_0x33a77d];return _0xa33b61;};'use strict';var Sequelize=require(_0x15b7('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x15b7('0x1')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x15b7('0x2')]},'dst':{'type':Sequelize[_0x15b7('0x2')]},'dcontext':{'type':Sequelize[_0x15b7('0x2')]},'channel':{'type':Sequelize[_0x15b7('0x2')]},'dstchannel':{'type':Sequelize[_0x15b7('0x2')]},'lastapp':{'type':Sequelize[_0x15b7('0x2')]},'lastdata':{'type':Sequelize[_0x15b7('0x2')]},'duration':{'type':Sequelize[_0x15b7('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x15b7('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x15b7('0x2')]},'userfield':{'type':Sequelize[_0x15b7('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x15b7('0x2')]},'sequence':{'type':Sequelize[_0x15b7('0x2')]},'peeraccount':{'type':Sequelize[_0x15b7('0x2')]},'type':{'type':Sequelize[_0x15b7('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb789=['STRING','INTEGER','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x1a35e6,_0x5d105c){var _0x1b4585=function(_0x10ab78){while(--_0x10ab78){_0x1a35e6['push'](_0x1a35e6['shift']());}};_0x1b4585(++_0x5d105c);}(_0xb789,0x197));var _0x9b78=function(_0x5c20ff,_0x3aa940){_0x5c20ff=_0x5c20ff-0x0;var _0x1cc3af=_0xb789[_0x5c20ff];return _0x1cc3af;};'use strict';var Sequelize=require('sequelize');module[_0x9b78('0x0')]={'calldate':{'type':Sequelize[_0x9b78('0x1')],'allowNull':![],'defaultValue':_0x9b78('0x2')},'clid':{'type':Sequelize[_0x9b78('0x3')]},'src':{'type':Sequelize[_0x9b78('0x3')]},'dst':{'type':Sequelize[_0x9b78('0x3')]},'dcontext':{'type':Sequelize[_0x9b78('0x3')]},'channel':{'type':Sequelize[_0x9b78('0x3')]},'dstchannel':{'type':Sequelize[_0x9b78('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x9b78('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9b78('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9b78('0x3')]},'amaflags':{'type':Sequelize[_0x9b78('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x9b78('0x3')]},'userfield':{'type':Sequelize[_0x9b78('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x9b78('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x9b78('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x9b78('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 513b6d3..c401bab 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 _0x95eb=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','status','name','send','render','body','contact','message','agent','account','index','map','Cdr','rawAttributes','key','model','query','keys','intersection','attributes','fields','nolimit','order','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x95eb,0x129));var _0xb95e=function(_0xad26f1,_0x43bdfb){_0xad26f1=_0xad26f1-0x0;var _0x146645=_0x95eb[_0xad26f1];return _0x146645;};'use strict';var emlformat=require(_0xb95e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb95e('0x1'));var jsonpatch=require(_0xb95e('0x2'));var rp=require(_0xb95e('0x3'));var moment=require('moment');var BPromise=require(_0xb95e('0x4'));var Mustache=require(_0xb95e('0x5'));var util=require(_0xb95e('0x6'));var path=require('path');var sox=require(_0xb95e('0x7'));var csv=require(_0xb95e('0x8'));var ejs=require(_0xb95e('0x9'));var fs=require('fs');var fs_extra=require(_0xb95e('0xa'));var _=require(_0xb95e('0xb'));var squel=require(_0xb95e('0xc'));var crypto=require(_0xb95e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb95e('0xe'));var toCsv=require(_0xb95e('0x8'));var querystring=require('querystring');var Papa=require(_0xb95e('0xf'));var Redis=require(_0xb95e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb95e('0x11'));var as=require(_0xb95e('0x12'));var hardwareService=require(_0xb95e('0x13'));var logger=require('../../config/logger')(_0xb95e('0x14'));var utils=require(_0xb95e('0x15'));var config=require(_0xb95e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb95e('0x17'))['db'];function respondWithStatusCode(_0x5cb5dc,_0xf7ad86){_0xf7ad86=_0xf7ad86||0xcc;return function(_0x39758e){if(_0x39758e){return _0x5cb5dc[_0xb95e('0x18')](_0xf7ad86);}return _0x5cb5dc['status'](_0xf7ad86)[_0xb95e('0x19')]();};}function respondWithResult(_0x47d2f2,_0x423f75){_0x423f75=_0x423f75||0xc8;return function(_0x253ee6){if(_0x253ee6){return _0x47d2f2['status'](_0x423f75)[_0xb95e('0x1a')](_0x253ee6);}};}function respondWithFilteredResult(_0x58276e,_0xe930e3){return function(_0x26b639){if(_0x26b639){var _0x26a810=typeof _0xe930e3[_0xb95e('0x1b')]==='undefined'&&typeof _0xe930e3[_0xb95e('0x1c')]===_0xb95e('0x1d');var _0x56abb9=_0x26b639[_0xb95e('0x1e')];var _0x4486ff=_0x26a810?0x0:_0xe930e3[_0xb95e('0x1b')];var _0x4cec38=_0x26a810?_0x26b639[_0xb95e('0x1e')]:_0xe930e3['offset']+_0xe930e3['limit'];var _0xedde72;if(_0x4cec38>=_0x56abb9){_0x4cec38=_0x56abb9;_0xedde72=0xc8;}else{_0xedde72=0xce;}_0x58276e['status'](_0xedde72);return _0x58276e[_0xb95e('0x1f')]('Content-Range',_0x4486ff+'-'+_0x4cec38+'/'+_0x56abb9)[_0xb95e('0x1a')](_0x26b639);}return null;};}function patchUpdates(_0x1862c1){return function(_0x547e17){try{jsonpatch[_0xb95e('0x20')](_0x547e17,_0x1862c1,!![]);}catch(_0x55eed7){return BPromise[_0xb95e('0x21')](_0x55eed7);}return _0x547e17[_0xb95e('0x22')]();};}function saveUpdates(_0xba4659,_0x5b402a){return function(_0x55de1e){if(_0x55de1e){return _0x55de1e[_0xb95e('0x23')](_0xba4659)[_0xb95e('0x24')](function(_0x4d2f8c){return _0x4d2f8c;});}return null;};}function removeEntity(_0x7404aa,_0x4095ec){return function(_0x4c2b5d){if(_0x4c2b5d){return _0x4c2b5d[_0xb95e('0x25')]()[_0xb95e('0x24')](function(){_0x7404aa[_0xb95e('0x26')](0xcc)[_0xb95e('0x19')]();});}};}function handleEntityNotFound(_0x4d4caf,_0x58612d){return function(_0x14d0d8){if(!_0x14d0d8){_0x4d4caf['sendStatus'](0x194);}return _0x14d0d8;};}function handleError(_0x1d99b1,_0x3d895d){_0x3d895d=_0x3d895d||0x1f4;return function(_0xffedd4){logger['error'](_0xffedd4['stack']);if(_0xffedd4[_0xb95e('0x27')]){delete _0xffedd4[_0xb95e('0x27')];}_0x1d99b1[_0xb95e('0x26')](_0x3d895d)[_0xb95e('0x28')](_0xffedd4);};}function getMustacheRender(_0x64a58c,_0x5feb05){return Mustache[_0xb95e('0x29')](_0x64a58c,_['merge'](_0x5feb05[_0xb95e('0x2a')],{'contact':_0x5feb05[_0xb95e('0x2b')],'message':_0x5feb05[_0xb95e('0x2c')],'agent':_0x5feb05[_0xb95e('0x2d')],'interaction':_0x5feb05['interaction'],'account':_0x5feb05[_0xb95e('0x2e')]}))||'';}exports[_0xb95e('0x2f')]=function(_0x50e8f4,_0x23ce90){var _0x41c6b3={},_0x352f91={},_0x2673e8={'count':0x0,'rows':[]};var _0x543af3=_[_0xb95e('0x30')](db[_0xb95e('0x31')][_0xb95e('0x32')],function(_0x26f5fe){return{'name':_0x26f5fe['fieldName'],'type':_0x26f5fe['type'][_0xb95e('0x33')]};});_0x352f91[_0xb95e('0x34')]=_[_0xb95e('0x30')](_0x543af3,'name');_0x352f91[_0xb95e('0x35')]=_[_0xb95e('0x36')](_0x50e8f4[_0xb95e('0x35')]);_0x352f91['filters']=_[_0xb95e('0x37')](_0x352f91[_0xb95e('0x34')],_0x352f91['query']);_0x41c6b3[_0xb95e('0x38')]=_[_0xb95e('0x37')](_0x352f91[_0xb95e('0x34')],qs[_0xb95e('0x39')](_0x50e8f4[_0xb95e('0x35')]['fields']));_0x41c6b3[_0xb95e('0x38')]=_0x41c6b3[_0xb95e('0x38')]['length']?_0x41c6b3[_0xb95e('0x38')]:_0x352f91['model'];if(!_0x50e8f4[_0xb95e('0x35')]['hasOwnProperty'](_0xb95e('0x3a'))){_0x41c6b3[_0xb95e('0x1c')]=qs['limit'](_0x50e8f4[_0xb95e('0x35')][_0xb95e('0x1c')]);_0x41c6b3[_0xb95e('0x1b')]=qs[_0xb95e('0x1b')](_0x50e8f4['query']['offset']);}_0x41c6b3[_0xb95e('0x3b')]=qs['sort'](_0x50e8f4['query']['sort']);_0x41c6b3['where']=qs[_0xb95e('0x3c')](_[_0xb95e('0x3d')](_0x50e8f4[_0xb95e('0x35')],_0x352f91[_0xb95e('0x3c')]),_0x543af3);if(_0x50e8f4['query'][_0xb95e('0x3e')]){_0x41c6b3[_0xb95e('0x3f')]=_[_0xb95e('0x40')](_0x41c6b3['where'],{'$or':_[_0xb95e('0x30')](_0x543af3,function(_0x315c5d){if(_0x315c5d[_0xb95e('0x41')]!==_0xb95e('0x42')){var _0x47e445={};_0x47e445[_0x315c5d[_0xb95e('0x27')]]={'$like':'%'+_0x50e8f4[_0xb95e('0x35')]['filter']+'%'};return _0x47e445;}})});}_0x41c6b3=_['merge']({},_0x41c6b3,_0x50e8f4[_0xb95e('0x43')]);var _0x33c3cd={'where':_0x41c6b3[_0xb95e('0x3f')]};return db[_0xb95e('0x31')][_0xb95e('0x1e')](_0x33c3cd)[_0xb95e('0x24')](function(_0x1dad44){_0x2673e8['count']=_0x1dad44;if(_0x50e8f4['query'][_0xb95e('0x44')]){_0x41c6b3[_0xb95e('0x45')]=[{'all':!![]}];}return db[_0xb95e('0x31')][_0xb95e('0x46')](_0x41c6b3);})['then'](function(_0x267ff9){_0x2673e8[_0xb95e('0x47')]=_0x267ff9;return _0x2673e8;})['then'](respondWithFilteredResult(_0x23ce90,_0x41c6b3))[_0xb95e('0x48')](handleError(_0x23ce90,null));};exports[_0xb95e('0x49')]=function(_0x3a1c00,_0x535037){var _0x36c3c9={'raw':!![],'where':{'id':_0x3a1c00['params']['id']}},_0xbb847f={};_0xbb847f[_0xb95e('0x34')]=_['keys'](db[_0xb95e('0x31')]['rawAttributes']);_0xbb847f[_0xb95e('0x35')]=_[_0xb95e('0x36')](_0x3a1c00['query']);_0xbb847f[_0xb95e('0x3c')]=_[_0xb95e('0x37')](_0xbb847f[_0xb95e('0x34')],_0xbb847f[_0xb95e('0x35')]);_0x36c3c9[_0xb95e('0x38')]=_['intersection'](_0xbb847f['model'],qs[_0xb95e('0x39')](_0x3a1c00[_0xb95e('0x35')][_0xb95e('0x39')]));_0x36c3c9[_0xb95e('0x38')]=_0x36c3c9[_0xb95e('0x38')][_0xb95e('0x4a')]?_0x36c3c9[_0xb95e('0x38')]:_0xbb847f[_0xb95e('0x34')];if(_0x3a1c00[_0xb95e('0x35')][_0xb95e('0x44')]){_0x36c3c9[_0xb95e('0x45')]=[{'all':!![]}];}_0x36c3c9=_['merge']({},_0x36c3c9,_0x3a1c00['options']);return db[_0xb95e('0x31')][_0xb95e('0x4b')](_0x36c3c9)[_0xb95e('0x24')](handleEntityNotFound(_0x535037,null))['then'](respondWithResult(_0x535037,null))[_0xb95e('0x48')](handleError(_0x535037,null));};exports['create']=function(_0x5cefbe,_0xb34e08){return db[_0xb95e('0x31')][_0xb95e('0x4c')](_0x5cefbe[_0xb95e('0x2a')],{})['then'](respondWithResult(_0xb34e08,0xc9))['catch'](handleError(_0xb34e08,null));};exports['update']=function(_0x273bfe,_0x378fdb){if(_0x273bfe[_0xb95e('0x2a')]['id']){delete _0x273bfe[_0xb95e('0x2a')]['id'];}return db['Cdr'][_0xb95e('0x4b')]({'where':{'id':_0x273bfe[_0xb95e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x378fdb,null))[_0xb95e('0x24')](saveUpdates(_0x273bfe[_0xb95e('0x2a')],null))[_0xb95e('0x24')](respondWithResult(_0x378fdb,null))['catch'](handleError(_0x378fdb,null));};exports[_0xb95e('0x25')]=function(_0xb07aaf,_0x26e7a0){return db[_0xb95e('0x31')][_0xb95e('0x4b')]({'where':{'id':_0xb07aaf[_0xb95e('0x4d')]['id']}})[_0xb95e('0x24')](handleEntityNotFound(_0x26e7a0,null))[_0xb95e('0x24')](removeEntity(_0x26e7a0,null))[_0xb95e('0x48')](handleError(_0x26e7a0,null));};exports['describe']=function(_0x38b2d0,_0x2b6f61){return db['Cdr'][_0xb95e('0x4e')]()[_0xb95e('0x24')](respondWithResult(_0x2b6f61,null))['catch'](handleError(_0x2b6f61,null));}; \ No newline at end of file +var _0x0d54=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','render','merge','body','contact','agent','interaction','index','rawAttributes','type','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','Cdr','findAll','catch','show','params','intersection','find','create','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service'];(function(_0x55b86a,_0x9f9772){var _0x46f950=function(_0x3113b0){while(--_0x3113b0){_0x55b86a['push'](_0x55b86a['shift']());}};_0x46f950(++_0x9f9772);}(_0x0d54,0x125));var _0x40d5=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x0d54[_0x383356];return _0x32ee5a;};'use strict';var emlformat=require(_0x40d5('0x0'));var rimraf=require(_0x40d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40d5('0x2'));var rp=require(_0x40d5('0x3'));var moment=require('moment');var BPromise=require(_0x40d5('0x4'));var Mustache=require(_0x40d5('0x5'));var util=require('util');var path=require('path');var sox=require(_0x40d5('0x6'));var csv=require(_0x40d5('0x7'));var ejs=require(_0x40d5('0x8'));var fs=require('fs');var fs_extra=require(_0x40d5('0x9'));var _=require(_0x40d5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x40d5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x40d5('0x7'));var querystring=require(_0x40d5('0xc'));var Papa=require(_0x40d5('0xd'));var Redis=require('ioredis');var authService=require(_0x40d5('0xe'));var qs=require(_0x40d5('0xf'));var as=require(_0x40d5('0x10'));var hardwareService=require(_0x40d5('0x11'));var logger=require(_0x40d5('0x12'))(_0x40d5('0x13'));var utils=require('../../config/utils');var config=require(_0x40d5('0x14'));var licenseUtil=require(_0x40d5('0x15'));var db=require(_0x40d5('0x16'))['db'];function respondWithStatusCode(_0x427822,_0x44e7d3){_0x44e7d3=_0x44e7d3||0xcc;return function(_0x18820e){if(_0x18820e){return _0x427822[_0x40d5('0x17')](_0x44e7d3);}return _0x427822['status'](_0x44e7d3)[_0x40d5('0x18')]();};}function respondWithResult(_0x306ff9,_0x36b212){_0x36b212=_0x36b212||0xc8;return function(_0x19ad08){if(_0x19ad08){return _0x306ff9[_0x40d5('0x19')](_0x36b212)['json'](_0x19ad08);}};}function respondWithFilteredResult(_0x256454,_0x1d8ba4){return function(_0x592ee2){if(_0x592ee2){var _0x59dae2=typeof _0x1d8ba4[_0x40d5('0x1a')]==='undefined'&&typeof _0x1d8ba4[_0x40d5('0x1b')]===_0x40d5('0x1c');var _0x1430bd=_0x592ee2[_0x40d5('0x1d')];var _0x17b9f9=_0x59dae2?0x0:_0x1d8ba4[_0x40d5('0x1a')];var _0x18a5c8=_0x59dae2?_0x592ee2[_0x40d5('0x1d')]:_0x1d8ba4[_0x40d5('0x1a')]+_0x1d8ba4['limit'];var _0x1252fb;if(_0x18a5c8>=_0x1430bd){_0x18a5c8=_0x1430bd;_0x1252fb=0xc8;}else{_0x1252fb=0xce;}_0x256454[_0x40d5('0x19')](_0x1252fb);return _0x256454[_0x40d5('0x1e')](_0x40d5('0x1f'),_0x17b9f9+'-'+_0x18a5c8+'/'+_0x1430bd)[_0x40d5('0x20')](_0x592ee2);}return null;};}function patchUpdates(_0x33cd7d){return function(_0x5edb83){try{jsonpatch[_0x40d5('0x21')](_0x5edb83,_0x33cd7d,!![]);}catch(_0x4ecfab){return BPromise[_0x40d5('0x22')](_0x4ecfab);}return _0x5edb83[_0x40d5('0x23')]();};}function saveUpdates(_0x2df11f,_0x3e2211){return function(_0x2c67ef){if(_0x2c67ef){return _0x2c67ef[_0x40d5('0x24')](_0x2df11f)[_0x40d5('0x25')](function(_0x5a5898){return _0x5a5898;});}return null;};}function removeEntity(_0x2de4e8,_0x4528f6){return function(_0x3ed884){if(_0x3ed884){return _0x3ed884[_0x40d5('0x26')]()['then'](function(){_0x2de4e8['status'](0xcc)[_0x40d5('0x18')]();});}};}function handleEntityNotFound(_0x2f2abf,_0x397c4e){return function(_0x5606d2){if(!_0x5606d2){_0x2f2abf[_0x40d5('0x17')](0x194);}return _0x5606d2;};}function handleError(_0x4a4d67,_0x3a4eca){_0x3a4eca=_0x3a4eca||0x1f4;return function(_0x596b34){logger[_0x40d5('0x27')](_0x596b34[_0x40d5('0x28')]);if(_0x596b34[_0x40d5('0x29')]){delete _0x596b34[_0x40d5('0x29')];}_0x4a4d67[_0x40d5('0x19')](_0x3a4eca)['send'](_0x596b34);};}function getMustacheRender(_0x304045,_0x23191f){return Mustache[_0x40d5('0x2a')](_0x304045,_[_0x40d5('0x2b')](_0x23191f[_0x40d5('0x2c')],{'contact':_0x23191f[_0x40d5('0x2d')],'message':_0x23191f['message'],'agent':_0x23191f[_0x40d5('0x2e')],'interaction':_0x23191f[_0x40d5('0x2f')],'account':_0x23191f['account']}))||'';}exports[_0x40d5('0x30')]=function(_0x5f0bcd,_0x1f966f){var _0x36f167={},_0x546b33={},_0x2ee8fa={'count':0x0,'rows':[]};var _0x5b5ba6=_['map'](db['Cdr'][_0x40d5('0x31')],function(_0xeb0d65){return{'name':_0xeb0d65['fieldName'],'type':_0xeb0d65[_0x40d5('0x32')]['key']};});_0x546b33[_0x40d5('0x33')]=_[_0x40d5('0x34')](_0x5b5ba6,_0x40d5('0x29'));_0x546b33[_0x40d5('0x35')]=_[_0x40d5('0x36')](_0x5f0bcd[_0x40d5('0x35')]);_0x546b33['filters']=_['intersection'](_0x546b33[_0x40d5('0x33')],_0x546b33[_0x40d5('0x35')]);_0x36f167[_0x40d5('0x37')]=_['intersection'](_0x546b33[_0x40d5('0x33')],qs['fields'](_0x5f0bcd[_0x40d5('0x35')][_0x40d5('0x38')]));_0x36f167[_0x40d5('0x37')]=_0x36f167[_0x40d5('0x37')][_0x40d5('0x39')]?_0x36f167[_0x40d5('0x37')]:_0x546b33[_0x40d5('0x33')];if(!_0x5f0bcd['query'][_0x40d5('0x3a')](_0x40d5('0x3b'))){_0x36f167['limit']=qs[_0x40d5('0x1b')](_0x5f0bcd['query'][_0x40d5('0x1b')]);_0x36f167[_0x40d5('0x1a')]=qs['offset'](_0x5f0bcd['query'][_0x40d5('0x1a')]);}_0x36f167[_0x40d5('0x3c')]=qs[_0x40d5('0x3d')](_0x5f0bcd[_0x40d5('0x35')]['sort']);_0x36f167[_0x40d5('0x3e')]=qs[_0x40d5('0x3f')](_[_0x40d5('0x40')](_0x5f0bcd[_0x40d5('0x35')],_0x546b33[_0x40d5('0x3f')]),_0x5b5ba6);if(_0x5f0bcd[_0x40d5('0x35')][_0x40d5('0x41')]){_0x36f167[_0x40d5('0x3e')]=_['merge'](_0x36f167['where'],{'$or':_['map'](_0x5b5ba6,function(_0x5541b7){if(_0x5541b7['type']!==_0x40d5('0x42')){var _0x2d11f8={};_0x2d11f8[_0x5541b7[_0x40d5('0x29')]]={'$like':'%'+_0x5f0bcd['query'][_0x40d5('0x41')]+'%'};return _0x2d11f8;}})});}_0x36f167=_[_0x40d5('0x2b')]({},_0x36f167,_0x5f0bcd[_0x40d5('0x43')]);var _0x5e6567={'where':_0x36f167[_0x40d5('0x3e')]};return db[_0x40d5('0x44')]['count'](_0x5e6567)['then'](function(_0x42f944){_0x2ee8fa[_0x40d5('0x1d')]=_0x42f944;if(_0x5f0bcd[_0x40d5('0x35')]['includeAll']){_0x36f167['include']=[{'all':!![]}];}return db[_0x40d5('0x44')][_0x40d5('0x45')](_0x36f167);})[_0x40d5('0x25')](function(_0x44913e){_0x2ee8fa['rows']=_0x44913e;return _0x2ee8fa;})[_0x40d5('0x25')](respondWithFilteredResult(_0x1f966f,_0x36f167))[_0x40d5('0x46')](handleError(_0x1f966f,null));};exports[_0x40d5('0x47')]=function(_0x533a5d,_0x28f497){var _0x5a5d61={'raw':!![],'where':{'id':_0x533a5d[_0x40d5('0x48')]['id']}},_0x184ee2={};_0x184ee2[_0x40d5('0x33')]=_[_0x40d5('0x36')](db[_0x40d5('0x44')][_0x40d5('0x31')]);_0x184ee2[_0x40d5('0x35')]=_[_0x40d5('0x36')](_0x533a5d[_0x40d5('0x35')]);_0x184ee2['filters']=_[_0x40d5('0x49')](_0x184ee2[_0x40d5('0x33')],_0x184ee2['query']);_0x5a5d61[_0x40d5('0x37')]=_[_0x40d5('0x49')](_0x184ee2[_0x40d5('0x33')],qs[_0x40d5('0x38')](_0x533a5d[_0x40d5('0x35')][_0x40d5('0x38')]));_0x5a5d61[_0x40d5('0x37')]=_0x5a5d61[_0x40d5('0x37')]['length']?_0x5a5d61['attributes']:_0x184ee2[_0x40d5('0x33')];if(_0x533a5d[_0x40d5('0x35')]['includeAll']){_0x5a5d61['include']=[{'all':!![]}];}_0x5a5d61=_['merge']({},_0x5a5d61,_0x533a5d[_0x40d5('0x43')]);return db[_0x40d5('0x44')][_0x40d5('0x4a')](_0x5a5d61)[_0x40d5('0x25')](handleEntityNotFound(_0x28f497,null))['then'](respondWithResult(_0x28f497,null))[_0x40d5('0x46')](handleError(_0x28f497,null));};exports[_0x40d5('0x4b')]=function(_0x1d4bf3,_0x12b43d){return db['Cdr']['create'](_0x1d4bf3[_0x40d5('0x2c')],{})[_0x40d5('0x25')](respondWithResult(_0x12b43d,0xc9))[_0x40d5('0x46')](handleError(_0x12b43d,null));};exports[_0x40d5('0x24')]=function(_0x20e69d,_0x38f424){if(_0x20e69d[_0x40d5('0x2c')]['id']){delete _0x20e69d['body']['id'];}return db[_0x40d5('0x44')][_0x40d5('0x4a')]({'where':{'id':_0x20e69d[_0x40d5('0x48')]['id']}})[_0x40d5('0x25')](handleEntityNotFound(_0x38f424,null))[_0x40d5('0x25')](saveUpdates(_0x20e69d['body'],null))[_0x40d5('0x25')](respondWithResult(_0x38f424,null))[_0x40d5('0x46')](handleError(_0x38f424,null));};exports['destroy']=function(_0x5e4d5c,_0x387406){return db['Cdr']['find']({'where':{'id':_0x5e4d5c[_0x40d5('0x48')]['id']}})[_0x40d5('0x25')](handleEntityNotFound(_0x387406,null))[_0x40d5('0x25')](removeEntity(_0x387406,null))[_0x40d5('0x46')](handleError(_0x387406,null));};exports[_0x40d5('0x4c')]=function(_0x4b4999,_0x20afcc){return db[_0x40d5('0x44')][_0x40d5('0x4c')]()[_0x40d5('0x25')](respondWithResult(_0x20afcc,null))[_0x40d5('0x46')](handleError(_0x20afcc,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 41bc138..78c3f41 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 _0x0295=['uniqueid','lodash','api','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','accountcode','calldate','disposition','dst','src'];(function(_0x4c9cfd,_0x5b1a1b){var _0x49f9f0=function(_0x55aa2e){while(--_0x55aa2e){_0x4c9cfd['push'](_0x4c9cfd['shift']());}};_0x49f9f0(++_0x5b1a1b);}(_0x0295,0x1f0));var _0x5029=function(_0x188832,_0x49101d){_0x188832=_0x188832-0x0;var _0x2b990f=_0x0295[_0x188832];return _0x2b990f;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('Cdr',attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x5029('0x9')]},{'name':'calldate','fields':[_0x5029('0xa')]},{'name':'disposition','fields':[_0x5029('0xb')]},{'name':'dst','fields':[_0x5029('0xc')]},{'name':_0x5029('0xd'),'fields':[_0x5029('0xd')]},{'name':'uniqueid','fields':[_0x5029('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xe2fe=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Cdr','accountcode','calldate','disposition','dst','uniqueid','lodash'];(function(_0x16dfb6,_0x24da6f){var _0x4c21fc=function(_0x4065cd){while(--_0x4065cd){_0x16dfb6['push'](_0x16dfb6['shift']());}};_0x4c21fc(++_0x24da6f);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./cdr.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['accountcode']},{'name':_0xee2f('0xb'),'fields':[_0xee2f('0xb')]},{'name':'disposition','fields':[_0xee2f('0xc')]},{'name':_0xee2f('0xd'),'fields':['dst']},{'name':'src','fields':['src']},{'name':'uniqueid','fields':[_0xee2f('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 5b57f08..79f9705 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 _0xcb47=['result','catch','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x5a1033,_0x34c0ee){var _0x31f6e0=function(_0xf0cc24){while(--_0xf0cc24){_0x5a1033['push'](_0x5a1033['shift']());}};_0x31f6e0(++_0x34c0ee);}(_0xcb47,0xe9));var _0x7cb4=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0xcb47[_0x25248b];return _0x509939;};'use strict';var _=require('lodash');var util=require(_0x7cb4('0x0'));var moment=require(_0x7cb4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7cb4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cb4('0x3'));var logger=require('../../config/logger')(_0x7cb4('0x4'));var config=require(_0x7cb4('0x5'));var jayson=require(_0x7cb4('0x6'));var client=jayson[_0x7cb4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x817cec,_0x449046,_0x2271da){return new BPromise(function(_0xf13211,_0x3781aa){return client[_0x7cb4('0x8')](_0x817cec,_0x2271da)[_0x7cb4('0x9')](function(_0x5d4bcf){logger[_0x7cb4('0xa')](_0x7cb4('0xb'),_0x449046,'request\x20sent');logger[_0x7cb4('0xc')](_0x7cb4('0xd'),_0x449046,_0x7cb4('0xe'),JSON[_0x7cb4('0xf')](_0x5d4bcf));if(_0x5d4bcf['error']){if(_0x5d4bcf[_0x7cb4('0x10')][_0x7cb4('0x11')]===0x1f4){logger[_0x7cb4('0x10')](_0x7cb4('0xb'),_0x449046,_0x5d4bcf[_0x7cb4('0x10')][_0x7cb4('0x12')]);return _0x3781aa(_0x5d4bcf[_0x7cb4('0x10')][_0x7cb4('0x12')]);}logger[_0x7cb4('0x10')](_0x7cb4('0xb'),_0x449046,_0x5d4bcf[_0x7cb4('0x10')][_0x7cb4('0x12')]);return _0xf13211(_0x5d4bcf[_0x7cb4('0x10')]['message']);}else{logger[_0x7cb4('0xa')](_0x7cb4('0xb'),_0x449046,'request\x20sent');_0xf13211(_0x5d4bcf[_0x7cb4('0x13')][_0x7cb4('0x12')]);}})[_0x7cb4('0x14')](function(_0xda8af2){logger[_0x7cb4('0x10')](_0x7cb4('0xb'),_0x449046,_0xda8af2);_0x3781aa(_0xda8af2);});});} \ No newline at end of file +var _0x7738=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x7738,0xec));var _0x8773=function(_0x21d650,_0x34649d){_0x21d650=_0x21d650-0x0;var _0x5e50a3=_0x7738[_0x21d650];return _0x5e50a3;};'use strict';var _=require(_0x8773('0x0'));var util=require(_0x8773('0x1'));var moment=require(_0x8773('0x2'));var BPromise=require(_0x8773('0x3'));var rs=require(_0x8773('0x4'));var fs=require('fs');var Redis=require(_0x8773('0x5'));var db=require(_0x8773('0x6'))['db'];var utils=require(_0x8773('0x7'));var logger=require('../../config/logger')(_0x8773('0x8'));var config=require(_0x8773('0x9'));var jayson=require(_0x8773('0xa'));var client=jayson[_0x8773('0xb')][_0x8773('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fae42,_0x5a15dc,_0x136598){return new BPromise(function(_0x10be6e,_0xd4480a){return client[_0x8773('0xd')](_0x4fae42,_0x136598)[_0x8773('0xe')](function(_0x25b733){logger[_0x8773('0xf')](_0x8773('0x10'),_0x5a15dc,_0x8773('0x11'));logger[_0x8773('0x12')]('Cdr,\x20%s,\x20%s,\x20%s',_0x5a15dc,_0x8773('0x11'),JSON[_0x8773('0x13')](_0x25b733));if(_0x25b733[_0x8773('0x14')]){if(_0x25b733['error']['code']===0x1f4){logger[_0x8773('0x14')](_0x8773('0x10'),_0x5a15dc,_0x25b733[_0x8773('0x14')][_0x8773('0x15')]);return _0xd4480a(_0x25b733[_0x8773('0x14')][_0x8773('0x15')]);}logger[_0x8773('0x14')](_0x8773('0x10'),_0x5a15dc,_0x25b733['error'][_0x8773('0x15')]);return _0x10be6e(_0x25b733[_0x8773('0x14')][_0x8773('0x15')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x5a15dc,'request\x20sent');_0x10be6e(_0x25b733[_0x8773('0x16')][_0x8773('0x15')]);}})[_0x8773('0x17')](function(_0x39d0b9){logger[_0x8773('0x14')]('Cdr,\x20%s,\x20%s',_0x5a15dc,_0x39d0b9);_0xd4480a(_0x39d0b9);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 294299e..5004236 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 _0x9679=['get','isAuthenticated','index','/describe','describe','/:id','show','create','put','destroy','exports','path','connect-timeout','Router','./cdr.controller'];(function(_0x2f5f1e,_0x1679ec){var _0x2ed99a=function(_0x1a0ac3){while(--_0x1a0ac3){_0x2f5f1e['push'](_0x2f5f1e['shift']());}};_0x2ed99a(++_0x1679ec);}(_0x9679,0x74));var _0x9967=function(_0xdafc9,_0x29f906){_0xdafc9=_0xdafc9-0x0;var _0x3af415=_0x9679[_0xdafc9];return _0x3af415;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9967('0x0'));var timeout=require(_0x9967('0x1'));var express=require('express');var router=express[_0x9967('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9967('0x3'));router[_0x9967('0x4')]('/',auth[_0x9967('0x5')](),controller[_0x9967('0x6')]);router[_0x9967('0x4')](_0x9967('0x7'),auth[_0x9967('0x5')](),controller[_0x9967('0x8')]);router[_0x9967('0x4')](_0x9967('0x9'),auth[_0x9967('0x5')](),controller[_0x9967('0xa')]);router['post']('/',auth[_0x9967('0x5')](),controller[_0x9967('0xb')]);router[_0x9967('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x9967('0x9'),auth[_0x9967('0x5')](),controller[_0x9967('0xd')]);module[_0x9967('0xe')]=router; \ No newline at end of file +var _0x8caa=['../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x57c6cd,_0x281362){var _0xa191e4=function(_0x412748){while(--_0x412748){_0x57c6cd['push'](_0x57c6cd['shift']());}};_0xa191e4(++_0x281362);}(_0x8caa,0x161));var _0xa8ca=function(_0x4d8f6f,_0x559720){_0x4d8f6f=_0x4d8f6f-0x0;var _0x441c71=_0x8caa[_0x4d8f6f];return _0x441c71;};'use strict';var multer=require(_0xa8ca('0x0'));var util=require(_0xa8ca('0x1'));var path=require(_0xa8ca('0x2'));var timeout=require(_0xa8ca('0x3'));var express=require(_0xa8ca('0x4'));var router=express[_0xa8ca('0x5')]();var fs_extra=require(_0xa8ca('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa8ca('0x7'));var config=require(_0xa8ca('0x8'));var controller=require(_0xa8ca('0x9'));router[_0xa8ca('0xa')]('/',auth[_0xa8ca('0xb')](),controller[_0xa8ca('0xc')]);router[_0xa8ca('0xa')]('/describe',auth[_0xa8ca('0xb')](),controller['describe']);router[_0xa8ca('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa8ca('0xd')]('/',auth[_0xa8ca('0xb')](),controller[_0xa8ca('0xe')]);router[_0xa8ca('0xf')](_0xa8ca('0x10'),auth[_0xa8ca('0xb')](),controller[_0xa8ca('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa8ca('0x12')]);module[_0xa8ca('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 483fd2c..d992801 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 _0x6242=['TEXT','*,*,*,*','sequelize','STRING','noop'];(function(_0x1807f5,_0xc65403){var _0x3763af=function(_0x2eed19){while(--_0x2eed19){_0x1807f5['push'](_0x1807f5['shift']());}};_0x3763af(++_0xc65403);}(_0x6242,0x1dd));var _0x2624=function(_0x2bb9fd,_0x1e9ab8){_0x2bb9fd=_0x2bb9fd-0x0;var _0x229cfe=_0x6242[_0x2bb9fd];return _0x229cfe;};'use strict';var Sequelize=require(_0x2624('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2624('0x1')],'allowNull':![],'defaultValue':_0x2624('0x2')},'appdata':{'type':Sequelize[_0x2624('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2624('0x4')}}; \ No newline at end of file +var _0x69b8=['exports','INTEGER','STRING','TEXT','sequelize'];(function(_0x2e249d,_0x41b7e7){var _0x1faa37=function(_0x1422b4){while(--_0x1422b4){_0x2e249d['push'](_0x2e249d['shift']());}};_0x1faa37(++_0x41b7e7);}(_0x69b8,0x185));var _0x869b=function(_0xe2665b,_0x26db74){_0xe2665b=_0xe2665b-0x0;var _0x1888f5=_0x69b8[_0xe2665b];return _0x1888f5;};'use strict';var Sequelize=require(_0x869b('0x0'));module[_0x869b('0x1')]={'priority':{'type':Sequelize[_0x869b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x869b('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x869b('0x4')]()},'description':{'type':Sequelize[_0x869b('0x3')]},'interval':{'type':Sequelize[_0x869b('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 833d36f..949a0ce 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 _0x0a05=['fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','save','update','then','destroy','error','name','render','body','contact','message','agent','params','model','keys','ChatApplication','filters','query','attributes','intersection','fields','length','merge','options','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x0a05,0x9e));var _0x50a0=function(_0x1c72b8,_0x104b7e){_0x1c72b8=_0x1c72b8-0x0;var _0x191114=_0x0a05[_0x1c72b8];return _0x191114;};'use strict';var emlformat=require(_0x50a0('0x0'));var rimraf=require(_0x50a0('0x1'));var zipdir=require(_0x50a0('0x2'));var jsonpatch=require(_0x50a0('0x3'));var rp=require(_0x50a0('0x4'));var moment=require(_0x50a0('0x5'));var BPromise=require(_0x50a0('0x6'));var Mustache=require('mustache');var util=require(_0x50a0('0x7'));var path=require('path');var sox=require(_0x50a0('0x8'));var csv=require('to-csv');var ejs=require(_0x50a0('0x9'));var fs=require('fs');var fs_extra=require(_0x50a0('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x50a0('0xb'));var jsforce=require(_0x50a0('0xc'));var deskjs=require(_0x50a0('0xd'));var toCsv=require(_0x50a0('0xe'));var querystring=require('querystring');var Papa=require(_0x50a0('0xf'));var Redis=require('ioredis');var authService=require(_0x50a0('0x10'));var qs=require(_0x50a0('0x11'));var as=require(_0x50a0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50a0('0x13'))('api');var utils=require(_0x50a0('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50a0('0x15'))['db'];function respondWithStatusCode(_0x3da025,_0x3f56e8){_0x3f56e8=_0x3f56e8||0xcc;return function(_0x259c69){if(_0x259c69){return _0x3da025[_0x50a0('0x16')](_0x3f56e8);}return _0x3da025['status'](_0x3f56e8)[_0x50a0('0x17')]();};}function respondWithResult(_0x20f0b1,_0x37882a){_0x37882a=_0x37882a||0xc8;return function(_0x2a083d){if(_0x2a083d){return _0x20f0b1[_0x50a0('0x18')](_0x37882a)['json'](_0x2a083d);}};}function respondWithFilteredResult(_0x4db16e,_0x4c34ba){return function(_0x582fb5){if(_0x582fb5){var _0x2a4ce7=typeof _0x4c34ba[_0x50a0('0x19')]===_0x50a0('0x1a')&&typeof _0x4c34ba[_0x50a0('0x1b')]===_0x50a0('0x1a');var _0x474f10=_0x582fb5['count'];var _0x4e2e05=_0x2a4ce7?0x0:_0x4c34ba[_0x50a0('0x19')];var _0x2433e0=_0x2a4ce7?_0x582fb5[_0x50a0('0x1c')]:_0x4c34ba[_0x50a0('0x19')]+_0x4c34ba[_0x50a0('0x1b')];var _0x48ec1e;if(_0x2433e0>=_0x474f10){_0x2433e0=_0x474f10;_0x48ec1e=0xc8;}else{_0x48ec1e=0xce;}_0x4db16e[_0x50a0('0x18')](_0x48ec1e);return _0x4db16e['set'](_0x50a0('0x1d'),_0x4e2e05+'-'+_0x2433e0+'/'+_0x474f10)[_0x50a0('0x1e')](_0x582fb5);}return null;};}function patchUpdates(_0x5fe74c){return function(_0x28664e){try{jsonpatch['apply'](_0x28664e,_0x5fe74c,!![]);}catch(_0x62c40a){return BPromise['reject'](_0x62c40a);}return _0x28664e[_0x50a0('0x1f')]();};}function saveUpdates(_0x3c7e89,_0x50d724){return function(_0x190263){if(_0x190263){return _0x190263[_0x50a0('0x20')](_0x3c7e89)[_0x50a0('0x21')](function(_0x89e493){return _0x89e493;});}return null;};}function removeEntity(_0x1a264a,_0x10ec8b){return function(_0x427094){if(_0x427094){return _0x427094[_0x50a0('0x22')]()['then'](function(){_0x1a264a['status'](0xcc)[_0x50a0('0x17')]();});}};}function handleEntityNotFound(_0x44958b,_0xba9168){return function(_0x4c9d9b){if(!_0x4c9d9b){_0x44958b[_0x50a0('0x16')](0x194);}return _0x4c9d9b;};}function handleError(_0x1ff89a,_0x2707e9){_0x2707e9=_0x2707e9||0x1f4;return function(_0x4a36da){logger[_0x50a0('0x23')](_0x4a36da['stack']);if(_0x4a36da[_0x50a0('0x24')]){delete _0x4a36da[_0x50a0('0x24')];}_0x1ff89a[_0x50a0('0x18')](_0x2707e9)['send'](_0x4a36da);};}function getMustacheRender(_0xde56f1,_0x2e0dd9){return Mustache[_0x50a0('0x25')](_0xde56f1,_['merge'](_0x2e0dd9[_0x50a0('0x26')],{'contact':_0x2e0dd9[_0x50a0('0x27')],'message':_0x2e0dd9[_0x50a0('0x28')],'agent':_0x2e0dd9[_0x50a0('0x29')],'interaction':_0x2e0dd9['interaction'],'account':_0x2e0dd9['account']}))||'';}exports['show']=function(_0x5524ae,_0x271aa3){var _0x269d68={'raw':!![],'where':{'id':_0x5524ae[_0x50a0('0x2a')]['id']}},_0xd5c166={};_0xd5c166[_0x50a0('0x2b')]=_[_0x50a0('0x2c')](db[_0x50a0('0x2d')]['rawAttributes']);_0xd5c166['query']=_[_0x50a0('0x2c')](_0x5524ae['query']);_0xd5c166[_0x50a0('0x2e')]=_['intersection'](_0xd5c166[_0x50a0('0x2b')],_0xd5c166[_0x50a0('0x2f')]);_0x269d68[_0x50a0('0x30')]=_[_0x50a0('0x31')](_0xd5c166[_0x50a0('0x2b')],qs[_0x50a0('0x32')](_0x5524ae[_0x50a0('0x2f')][_0x50a0('0x32')]));_0x269d68[_0x50a0('0x30')]=_0x269d68[_0x50a0('0x30')][_0x50a0('0x33')]?_0x269d68[_0x50a0('0x30')]:_0xd5c166['model'];if(_0x5524ae[_0x50a0('0x2f')]['includeAll']){_0x269d68['include']=[{'all':!![]}];}_0x269d68=_[_0x50a0('0x34')]({},_0x269d68,_0x5524ae[_0x50a0('0x35')]);return db['ChatApplication'][_0x50a0('0x36')](_0x269d68)[_0x50a0('0x21')](handleEntityNotFound(_0x271aa3,null))[_0x50a0('0x21')](respondWithResult(_0x271aa3,null))[_0x50a0('0x37')](handleError(_0x271aa3,null));};exports[_0x50a0('0x20')]=function(_0x20291d,_0x2a652e){if(_0x20291d[_0x50a0('0x26')]['id']){delete _0x20291d[_0x50a0('0x26')]['id'];}return db[_0x50a0('0x2d')][_0x50a0('0x36')]({'where':{'id':_0x20291d[_0x50a0('0x2a')]['id']}})[_0x50a0('0x21')](handleEntityNotFound(_0x2a652e,null))['then'](saveUpdates(_0x20291d[_0x50a0('0x26')],null))[_0x50a0('0x21')](respondWithResult(_0x2a652e,null))[_0x50a0('0x37')](handleError(_0x2a652e,null));};exports[_0x50a0('0x22')]=function(_0x2ecc08,_0xcea4bf){return db[_0x50a0('0x2d')][_0x50a0('0x36')]({'where':{'id':_0x2ecc08['params']['id']}})[_0x50a0('0x21')](handleEntityNotFound(_0xcea4bf,null))[_0x50a0('0x21')](removeEntity(_0xcea4bf,null))['catch'](handleError(_0xcea4bf,null));}; \ No newline at end of file +var _0x1623=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','merge','body','contact','message','agent','account','params','model','keys','ChatApplication','query','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1623,0xab));var _0x3162=function(_0x12120d,_0x3fd6ea){_0x12120d=_0x12120d-0x0;var _0x3f2894=_0x1623[_0x12120d];return _0x3f2894;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}function getMustacheRender(_0x10c90b,_0x57f567){return Mustache['render'](_0x10c90b,_[_0x3162('0x2a')](_0x57f567[_0x3162('0x2b')],{'contact':_0x57f567[_0x3162('0x2c')],'message':_0x57f567[_0x3162('0x2d')],'agent':_0x57f567[_0x3162('0x2e')],'interaction':_0x57f567['interaction'],'account':_0x57f567[_0x3162('0x2f')]}))||'';}exports['show']=function(_0xf11765,_0x3a188e){var _0x41e933={'raw':!![],'where':{'id':_0xf11765[_0x3162('0x30')]['id']}},_0x221b38={};_0x221b38[_0x3162('0x31')]=_[_0x3162('0x32')](db[_0x3162('0x33')]['rawAttributes']);_0x221b38[_0x3162('0x34')]=_[_0x3162('0x32')](_0xf11765['query']);_0x221b38[_0x3162('0x35')]=_[_0x3162('0x36')](_0x221b38['model'],_0x221b38['query']);_0x41e933[_0x3162('0x37')]=_['intersection'](_0x221b38[_0x3162('0x31')],qs[_0x3162('0x38')](_0xf11765[_0x3162('0x34')]['fields']));_0x41e933['attributes']=_0x41e933[_0x3162('0x37')][_0x3162('0x39')]?_0x41e933['attributes']:_0x221b38[_0x3162('0x31')];if(_0xf11765['query'][_0x3162('0x3a')]){_0x41e933[_0x3162('0x3b')]=[{'all':!![]}];}_0x41e933=_[_0x3162('0x2a')]({},_0x41e933,_0xf11765[_0x3162('0x3c')]);return db[_0x3162('0x33')][_0x3162('0x3d')](_0x41e933)[_0x3162('0x24')](handleEntityNotFound(_0x3a188e,null))[_0x3162('0x24')](respondWithResult(_0x3a188e,null))[_0x3162('0x3e')](handleError(_0x3a188e,null));};exports[_0x3162('0x23')]=function(_0x3fc06f,_0x5c39d9){if(_0x3fc06f[_0x3162('0x2b')]['id']){delete _0x3fc06f[_0x3162('0x2b')]['id'];}return db[_0x3162('0x33')]['find']({'where':{'id':_0x3fc06f['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x5c39d9,null))[_0x3162('0x24')](saveUpdates(_0x3fc06f[_0x3162('0x2b')],null))[_0x3162('0x24')](respondWithResult(_0x5c39d9,null))['catch'](handleError(_0x5c39d9,null));};exports[_0x3162('0x25')]=function(_0x5ee3e2,_0x59e049){return db['ChatApplication'][_0x3162('0x3d')]({'where':{'id':_0x5ee3e2[_0x3162('0x30')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x59e049,null))['then'](removeEntity(_0x59e049,null))[_0x3162('0x3e')](handleError(_0x59e049,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index f0135e4..e501f1d 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 3681ab9..dbd8c77 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 _0xea96=['debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ChatApplication,\x20%s,\x20%s'];(function(_0x24ac4c,_0x506b37){var _0x12bf50=function(_0xc44dfb){while(--_0xc44dfb){_0x24ac4c['push'](_0x24ac4c['shift']());}};_0x12bf50(++_0x506b37);}(_0xea96,0xee));var _0x6ea9=function(_0x4b2a19,_0x16669c){_0x4b2a19=_0x4b2a19-0x0;var _0x2a7cbb=_0xea96[_0x4b2a19];return _0x2a7cbb;};'use strict';var _=require(_0x6ea9('0x0'));var util=require(_0x6ea9('0x1'));var moment=require(_0x6ea9('0x2'));var BPromise=require(_0x6ea9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ea9('0x4'));var db=require(_0x6ea9('0x5'))['db'];var utils=require(_0x6ea9('0x6'));var logger=require(_0x6ea9('0x7'))(_0x6ea9('0x8'));var config=require(_0x6ea9('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6ea9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x282588,_0x19a476,_0x147863){return new BPromise(function(_0xed8958,_0x1f9a53){return client[_0x6ea9('0xb')](_0x282588,_0x147863)[_0x6ea9('0xc')](function(_0x2c225f){logger[_0x6ea9('0xd')](_0x6ea9('0xe'),_0x19a476,'request\x20sent');logger[_0x6ea9('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x19a476,_0x6ea9('0x10'),JSON[_0x6ea9('0x11')](_0x2c225f));if(_0x2c225f[_0x6ea9('0x12')]){if(_0x2c225f[_0x6ea9('0x12')][_0x6ea9('0x13')]===0x1f4){logger[_0x6ea9('0x12')](_0x6ea9('0xe'),_0x19a476,_0x2c225f[_0x6ea9('0x12')][_0x6ea9('0x14')]);return _0x1f9a53(_0x2c225f[_0x6ea9('0x12')][_0x6ea9('0x14')]);}logger[_0x6ea9('0x12')]('ChatApplication,\x20%s,\x20%s',_0x19a476,_0x2c225f[_0x6ea9('0x12')]['message']);return _0xed8958(_0x2c225f[_0x6ea9('0x12')][_0x6ea9('0x14')]);}else{logger[_0x6ea9('0xd')](_0x6ea9('0xe'),_0x19a476,_0x6ea9('0x10'));_0xed8958(_0x2c225f[_0x6ea9('0x15')][_0x6ea9('0x14')]);}})[_0x6ea9('0x16')](function(_0x50ea0e){logger['error'](_0x6ea9('0xe'),_0x19a476,_0x50ea0e);_0x1f9a53(_0x50ea0e);});});} \ No newline at end of file +var _0xc0d2=['then','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1e4e8b,_0x59ecba){var _0x2d34c4=function(_0x522685){while(--_0x522685){_0x1e4e8b['push'](_0x1e4e8b['shift']());}};_0x2d34c4(++_0x59ecba);}(_0xc0d2,0x14d));var _0x2c0d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xc0d2[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x2c0d('0x0'));var moment=require(_0x2c0d('0x1'));var BPromise=require('bluebird');var rs=require(_0x2c0d('0x2'));var fs=require('fs');var Redis=require(_0x2c0d('0x3'));var db=require(_0x2c0d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c0d('0x5'))(_0x2c0d('0x6'));var config=require(_0x2c0d('0x7'));var jayson=require(_0x2c0d('0x8'));var client=jayson[_0x2c0d('0x9')][_0x2c0d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c5a55,_0x47f00b,_0x2186be){return new BPromise(function(_0x212c02,_0x2e163c){return client[_0x2c0d('0xb')](_0x4c5a55,_0x2186be)[_0x2c0d('0xc')](function(_0x1898f7){logger['info']('ChatApplication,\x20%s,\x20%s',_0x47f00b,_0x2c0d('0xd'));logger[_0x2c0d('0xe')](_0x2c0d('0xf'),_0x47f00b,_0x2c0d('0xd'),JSON[_0x2c0d('0x10')](_0x1898f7));if(_0x1898f7[_0x2c0d('0x11')]){if(_0x1898f7[_0x2c0d('0x11')][_0x2c0d('0x12')]===0x1f4){logger[_0x2c0d('0x11')](_0x2c0d('0x13'),_0x47f00b,_0x1898f7['error'][_0x2c0d('0x14')]);return _0x2e163c(_0x1898f7[_0x2c0d('0x11')][_0x2c0d('0x14')]);}logger[_0x2c0d('0x11')](_0x2c0d('0x13'),_0x47f00b,_0x1898f7[_0x2c0d('0x11')]['message']);return _0x212c02(_0x1898f7['error'][_0x2c0d('0x14')]);}else{logger['info'](_0x2c0d('0x13'),_0x47f00b,_0x2c0d('0xd'));_0x212c02(_0x1898f7[_0x2c0d('0x15')][_0x2c0d('0x14')]);}})[_0x2c0d('0x16')](function(_0x2568d9){logger['error']('ChatApplication,\x20%s,\x20%s',_0x47f00b,_0x2568d9);_0x2e163c(_0x2568d9);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 3db9f57..100df0c 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 _0x1d86=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x1d86,0xc0));var _0x61d8=function(_0x38957a,_0x2f7cc5){_0x38957a=_0x38957a-0x0;var _0xf179c7=_0x1d86[_0x38957a];return _0xf179c7;};'use strict';var multer=require(_0x61d8('0x0'));var util=require(_0x61d8('0x1'));var path=require(_0x61d8('0x2'));var timeout=require(_0x61d8('0x3'));var express=require(_0x61d8('0x4'));var router=express['Router']();var fs_extra=require(_0x61d8('0x5'));var auth=require(_0x61d8('0x6'));var interaction=require(_0x61d8('0x7'));var config=require(_0x61d8('0x8'));var controller=require(_0x61d8('0x9'));router['get'](_0x61d8('0xa'),auth[_0x61d8('0xb')](),controller[_0x61d8('0xc')]);router[_0x61d8('0xd')]('/:id',auth[_0x61d8('0xb')](),controller[_0x61d8('0xe')]);router[_0x61d8('0xf')](_0x61d8('0xa'),auth[_0x61d8('0xb')](),controller[_0x61d8('0x10')]);module[_0x61d8('0x11')]=router; \ No newline at end of file +var _0xe699=['../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0xe699,0x15a));var _0x9e69=function(_0x334127,_0x35b19a){_0x334127=_0x334127-0x0;var _0x6b4dd9=_0xe699[_0x334127];return _0x6b4dd9;};'use strict';var multer=require(_0x9e69('0x0'));var util=require(_0x9e69('0x1'));var path=require(_0x9e69('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9e69('0x3')]();var fs_extra=require(_0x9e69('0x4'));var auth=require(_0x9e69('0x5'));var interaction=require(_0x9e69('0x6'));var config=require(_0x9e69('0x7'));var controller=require(_0x9e69('0x8'));router['get'](_0x9e69('0x9'),auth[_0x9e69('0xa')](),controller[_0x9e69('0xb')]);router[_0x9e69('0xc')]('/:id',auth[_0x9e69('0xa')](),controller['update']);router[_0x9e69('0xd')](_0x9e69('0x9'),auth[_0x9e69('0xa')](),controller[_0x9e69('0xe')]);module[_0x9e69('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 f999064..2625a5d 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 _0xa9a0=['exports','STRING','BOOLEAN'];(function(_0x2193ac,_0x4c0cab){var _0x73141d=function(_0x513267){while(--_0x513267){_0x2193ac['push'](_0x2193ac['shift']());}};_0x73141d(++_0x4c0cab);}(_0xa9a0,0x117));var _0x0a9a=function(_0x8956db,_0x565a5f){_0x8956db=_0x8956db-0x0;var _0x175a41=_0xa9a0[_0x8956db];return _0x175a41;};'use strict';var Sequelize=require('sequelize');module[_0x0a9a('0x0')]={'name':{'type':Sequelize[_0x0a9a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0a9a('0x1')]},'write':{'type':Sequelize[_0x0a9a('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5bb0=['sequelize','exports','STRING'];(function(_0x3ff73b,_0x228451){var _0x191517=function(_0x325c6c){while(--_0x325c6c){_0x3ff73b['push'](_0x3ff73b['shift']());}};_0x191517(++_0x228451);}(_0x5bb0,0x12f));var _0x05bb=function(_0x389c69,_0x4ed7b5){_0x389c69=_0x389c69-0x0;var _0x12c459=_0x5bb0[_0x389c69];return _0x12c459;};'use strict';var Sequelize=require(_0x05bb('0x0'));module[_0x05bb('0x1')]={'name':{'type':Sequelize[_0x05bb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x05bb('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index d53d0c4..8099188 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 _0x089f=['addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./chatGroup.socket','register','client','request','then','info','request\x20sent','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','sendStatus','send','merge','body','contact','interaction','account','index','map','ChatGroup','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','findAll','rows','show','params','keys','includeAll','include','find','create','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','findOne','User','options','removeMembers'];(function(_0x24286f,_0x2805ce){var _0x35e571=function(_0x499407){while(--_0x499407){_0x24286f['push'](_0x24286f['shift']());}};_0x35e571(++_0x2805ce);}(_0x089f,0x1c7));var _0xf089=function(_0x4809a6,_0x584cc2){_0x4809a6=_0x4809a6-0x0;var _0x5b9ecd=_0x089f[_0x4809a6];return _0x5b9ecd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf089('0x0'));var zipdir=require(_0xf089('0x1'));var jsonpatch=require(_0xf089('0x2'));var rp=require(_0xf089('0x3'));var moment=require(_0xf089('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf089('0x5'));var util=require(_0xf089('0x6'));var path=require(_0xf089('0x7'));var sox=require('sox');var csv=require(_0xf089('0x8'));var ejs=require(_0xf089('0x9'));var fs=require('fs');var fs_extra=require(_0xf089('0xa'));var _=require('lodash');var squel=require(_0xf089('0xb'));var crypto=require(_0xf089('0xc'));var jsforce=require(_0xf089('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf089('0x8'));var querystring=require(_0xf089('0xe'));var Papa=require(_0xf089('0xf'));var Redis=require(_0xf089('0x10'));var authService=require(_0xf089('0x11'));var qs=require(_0xf089('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf089('0x13'));var logger=require(_0xf089('0x14'))(_0xf089('0x15'));var utils=require('../../config/utils');var config=require(_0xf089('0x16'));var licenseUtil=require(_0xf089('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf089('0x18')](config[_0xf089('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xf089('0x1a'))(new Redis(config[_0xf089('0x19')]));require(_0xf089('0x1b'))[_0xf089('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf089('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d5f2b,_0x528cf9,_0x342bb3,_0x5aee45){return new BPromise(function(_0x3bc27b,_0x250d5e){var _0x157371=_0x5aee45||client;return _0x157371[_0xf089('0x1e')](_0x2d5f2b,_0x342bb3)[_0xf089('0x1f')](function(_0x57f2a7){logger[_0xf089('0x20')]('ChatGroup,\x20%s,\x20%s',_0x528cf9,_0xf089('0x21'));logger[_0xf089('0x22')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x528cf9,_0xf089('0x21'),JSON[_0xf089('0x23')](_0x57f2a7));if(_0x57f2a7['error']){if(_0x57f2a7[_0xf089('0x24')][_0xf089('0x25')]===0x1f4){logger[_0xf089('0x24')](_0xf089('0x26'),_0x528cf9,_0x57f2a7[_0xf089('0x24')][_0xf089('0x27')]);return _0x250d5e(_0x57f2a7[_0xf089('0x24')][_0xf089('0x27')]);}logger[_0xf089('0x24')](_0xf089('0x26'),_0x528cf9,_0x57f2a7['error'][_0xf089('0x27')]);return _0x3bc27b(_0x57f2a7[_0xf089('0x24')][_0xf089('0x27')]);}else{logger[_0xf089('0x20')](_0xf089('0x26'),_0x528cf9,_0xf089('0x21'));_0x3bc27b(_0x57f2a7[_0xf089('0x28')][_0xf089('0x27')]);}})[_0xf089('0x29')](function(_0x3a78fc){logger['error'](_0xf089('0x26'),_0x528cf9,_0x3a78fc);_0x250d5e(_0x3a78fc);});});}function respondWithStatusCode(_0x598a4e,_0x38078a){_0x38078a=_0x38078a||0xcc;return function(_0x372a7a){if(_0x372a7a){return _0x598a4e['sendStatus'](_0x38078a);}return _0x598a4e[_0xf089('0x2a')](_0x38078a)['end']();};}function respondWithResult(_0x52ea47,_0x42c286){_0x42c286=_0x42c286||0xc8;return function(_0x220746){if(_0x220746){return _0x52ea47[_0xf089('0x2a')](_0x42c286)[_0xf089('0x2b')](_0x220746);}};}function respondWithFilteredResult(_0x14aa96,_0x52e6ac){return function(_0x210147){if(_0x210147){var _0x531dd2=typeof _0x52e6ac[_0xf089('0x2c')]===_0xf089('0x2d')&&typeof _0x52e6ac[_0xf089('0x2e')]===_0xf089('0x2d');var _0x32f869=_0x210147[_0xf089('0x2f')];var _0x3268ca=_0x531dd2?0x0:_0x52e6ac[_0xf089('0x2c')];var _0x281fee=_0x531dd2?_0x210147[_0xf089('0x2f')]:_0x52e6ac[_0xf089('0x2c')]+_0x52e6ac[_0xf089('0x2e')];var _0x5b85a4;if(_0x281fee>=_0x32f869){_0x281fee=_0x32f869;_0x5b85a4=0xc8;}else{_0x5b85a4=0xce;}_0x14aa96['status'](_0x5b85a4);return _0x14aa96[_0xf089('0x30')](_0xf089('0x31'),_0x3268ca+'-'+_0x281fee+'/'+_0x32f869)[_0xf089('0x2b')](_0x210147);}return null;};}function patchUpdates(_0x26ec9c){return function(_0x33f2d8){try{jsonpatch['apply'](_0x33f2d8,_0x26ec9c,!![]);}catch(_0x5cc632){return BPromise[_0xf089('0x32')](_0x5cc632);}return _0x33f2d8[_0xf089('0x33')]();};}function saveUpdates(_0x3d8287,_0x6c58c7){return function(_0x1d0d62){if(_0x1d0d62){return _0x1d0d62[_0xf089('0x34')](_0x3d8287)[_0xf089('0x1f')](function(_0x29bd70){return _0x29bd70;});}return null;};}function removeEntity(_0x41d699,_0x488746){return function(_0x228e7e){if(_0x228e7e){return _0x228e7e['destroy']()[_0xf089('0x1f')](function(){_0x41d699[_0xf089('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3507ff,_0x1f49da){return function(_0xcbc1a7){if(!_0xcbc1a7){_0x3507ff[_0xf089('0x35')](0x194);}return _0xcbc1a7;};}function handleError(_0x5e646c,_0x2108ca){_0x2108ca=_0x2108ca||0x1f4;return function(_0x4d8b0c){logger[_0xf089('0x24')](_0x4d8b0c['stack']);if(_0x4d8b0c['name']){delete _0x4d8b0c['name'];}_0x5e646c[_0xf089('0x2a')](_0x2108ca)[_0xf089('0x36')](_0x4d8b0c);};}function getMustacheRender(_0x59685c,_0x5f13f0){return Mustache['render'](_0x59685c,_[_0xf089('0x37')](_0x5f13f0[_0xf089('0x38')],{'contact':_0x5f13f0[_0xf089('0x39')],'message':_0x5f13f0[_0xf089('0x27')],'agent':_0x5f13f0['agent'],'interaction':_0x5f13f0[_0xf089('0x3a')],'account':_0x5f13f0[_0xf089('0x3b')]}))||'';}exports[_0xf089('0x3c')]=function(_0x4c2b18,_0xe26eb6){var _0x4c5cea={},_0x4de400={},_0xd6af5c={'count':0x0,'rows':[]};var _0xbff340=_[_0xf089('0x3d')](db[_0xf089('0x3e')][_0xf089('0x3f')],function(_0x6a70a4){return{'name':_0x6a70a4[_0xf089('0x40')],'type':_0x6a70a4[_0xf089('0x41')][_0xf089('0x42')]};});_0x4de400['model']=_[_0xf089('0x3d')](_0xbff340,_0xf089('0x43'));_0x4de400[_0xf089('0x44')]=_['keys'](_0x4c2b18['query']);_0x4de400[_0xf089('0x45')]=_[_0xf089('0x46')](_0x4de400[_0xf089('0x47')],_0x4de400['query']);_0x4c5cea[_0xf089('0x48')]=_[_0xf089('0x46')](_0x4de400['model'],qs[_0xf089('0x49')](_0x4c2b18[_0xf089('0x44')]['fields']));_0x4c5cea[_0xf089('0x48')]=_0x4c5cea['attributes'][_0xf089('0x4a')]?_0x4c5cea[_0xf089('0x48')]:_0x4de400[_0xf089('0x47')];if(!_0x4c2b18[_0xf089('0x44')][_0xf089('0x4b')]('nolimit')){_0x4c5cea[_0xf089('0x2e')]=qs[_0xf089('0x2e')](_0x4c2b18['query'][_0xf089('0x2e')]);_0x4c5cea[_0xf089('0x2c')]=qs[_0xf089('0x2c')](_0x4c2b18[_0xf089('0x44')][_0xf089('0x2c')]);}_0x4c5cea[_0xf089('0x4c')]=qs[_0xf089('0x4d')](_0x4c2b18['query']['sort']);_0x4c5cea['where']=qs[_0xf089('0x45')](_[_0xf089('0x4e')](_0x4c2b18[_0xf089('0x44')],_0x4de400[_0xf089('0x45')]),_0xbff340);if(_0x4c2b18['query'][_0xf089('0x4f')]){_0x4c5cea['where']=_[_0xf089('0x37')](_0x4c5cea[_0xf089('0x50')],{'$or':_[_0xf089('0x3d')](_0xbff340,function(_0x53e4f7){if(_0x53e4f7[_0xf089('0x41')]!==_0xf089('0x51')){var _0x4abe8d={};_0x4abe8d[_0x53e4f7[_0xf089('0x43')]]={'$like':'%'+_0x4c2b18[_0xf089('0x44')][_0xf089('0x4f')]+'%'};return _0x4abe8d;}})});}_0x4c5cea=_[_0xf089('0x37')]({},_0x4c5cea,_0x4c2b18['options']);var _0x2d15fe={'where':_0x4c5cea['where']};return db['ChatGroup'][_0xf089('0x2f')](_0x2d15fe)[_0xf089('0x1f')](function(_0x505ac0){_0xd6af5c[_0xf089('0x2f')]=_0x505ac0;if(_0x4c2b18['query']['includeAll']){_0x4c5cea['include']=[{'all':!![]}];}return db['ChatGroup'][_0xf089('0x52')](_0x4c5cea);})[_0xf089('0x1f')](function(_0x5e6ed0){_0xd6af5c[_0xf089('0x53')]=_0x5e6ed0;return _0xd6af5c;})[_0xf089('0x1f')](respondWithFilteredResult(_0xe26eb6,_0x4c5cea))[_0xf089('0x29')](handleError(_0xe26eb6,null));};exports[_0xf089('0x54')]=function(_0xb6b8ee,_0x34c619){var _0x39397b={'raw':!![],'where':{'id':_0xb6b8ee[_0xf089('0x55')]['id']}},_0x57af87={};_0x57af87[_0xf089('0x47')]=_[_0xf089('0x56')](db[_0xf089('0x3e')]['rawAttributes']);_0x57af87[_0xf089('0x44')]=_[_0xf089('0x56')](_0xb6b8ee[_0xf089('0x44')]);_0x57af87[_0xf089('0x45')]=_[_0xf089('0x46')](_0x57af87[_0xf089('0x47')],_0x57af87[_0xf089('0x44')]);_0x39397b['attributes']=_['intersection'](_0x57af87['model'],qs[_0xf089('0x49')](_0xb6b8ee[_0xf089('0x44')]['fields']));_0x39397b['attributes']=_0x39397b[_0xf089('0x48')][_0xf089('0x4a')]?_0x39397b[_0xf089('0x48')]:_0x57af87[_0xf089('0x47')];if(_0xb6b8ee[_0xf089('0x44')][_0xf089('0x57')]){_0x39397b[_0xf089('0x58')]=[{'all':!![]}];}_0x39397b=_['merge']({},_0x39397b,_0xb6b8ee['options']);return db[_0xf089('0x3e')][_0xf089('0x59')](_0x39397b)[_0xf089('0x1f')](handleEntityNotFound(_0x34c619,null))['then'](respondWithResult(_0x34c619,null))[_0xf089('0x29')](handleError(_0x34c619,null));};exports[_0xf089('0x5a')]=function(_0x30a8ac,_0x55525d){return db[_0xf089('0x3e')]['create'](_0x30a8ac['body'],{})[_0xf089('0x1f')](respondWithResult(_0x55525d,0xc9))[_0xf089('0x29')](handleError(_0x55525d,null));};exports[_0xf089('0x34')]=function(_0x4eb267,_0x5ea5c3){if(_0x4eb267[_0xf089('0x38')]['id']){delete _0x4eb267['body']['id'];}return db[_0xf089('0x3e')][_0xf089('0x59')]({'where':{'id':_0x4eb267[_0xf089('0x55')]['id']}})['then'](handleEntityNotFound(_0x5ea5c3,null))[_0xf089('0x1f')](saveUpdates(_0x4eb267['body'],null))[_0xf089('0x1f')](respondWithResult(_0x5ea5c3,null))[_0xf089('0x29')](handleError(_0x5ea5c3,null));};exports[_0xf089('0x5b')]=function(_0x35bdab,_0x5bb752){return db['ChatGroup'][_0xf089('0x59')]({'where':{'id':_0x35bdab['params']['id']}})[_0xf089('0x1f')](handleEntityNotFound(_0x5bb752,null))['then'](removeEntity(_0x5bb752,null))['catch'](handleError(_0x5bb752,null));};exports[_0xf089('0x5c')]=function(_0x11d5b5,_0x5a63dc){return db['ChatGroup'][_0xf089('0x5c')]()['then'](respondWithResult(_0x5a63dc,null))[_0xf089('0x29')](handleError(_0x5a63dc,null));};exports[_0xf089('0x5d')]=function(_0x8a874,_0x30d591,_0x31b1e5){return db[_0xf089('0x5e')]['count']({'where':{'ChatGroupId':_0x8a874[_0xf089('0x55')]['id'],'ToId':_0x8a874[_0xf089('0x5f')]['id'],'read':![]}})['then'](function(_0x441dba){return{'id':_[_0xf089('0x60')](_0x8a874[_0xf089('0x55')]['id']),'count':_0x441dba};})[_0xf089('0x1f')](respondWithResult(_0x30d591,null))[_0xf089('0x29')](handleError(_0x30d591,null));};exports[_0xf089('0x61')]=function(_0x2b5af0,_0x127cb4,_0x1ac5cf){return db[_0xf089('0x3e')][_0xf089('0x59')]({'where':{'id':_0x2b5af0[_0xf089('0x55')]['id']}})[_0xf089('0x1f')](handleEntityNotFound(_0x127cb4,null))[_0xf089('0x1f')](function(_0xc445e7){if(_0xc445e7){return _0xc445e7[_0xf089('0x61')](_0x2b5af0['body']['ids'],_[_0xf089('0x62')](_0x2b5af0[_0xf089('0x38')],[_0xf089('0x63'),'id'])||{});}})[_0xf089('0x1f')](respondWithResult(_0x127cb4,null))[_0xf089('0x29')](handleError(_0x127cb4,null));};exports[_0xf089('0x64')]=function(_0x51eb40,_0x2da086,_0x12913c){var _0x312b15={};var _0x4bc5cf={};var _0x357714;var _0x108ea3;return db[_0xf089('0x3e')][_0xf089('0x65')]({'where':{'id':_0x51eb40['params']['id']}})[_0xf089('0x1f')](handleEntityNotFound(_0x2da086,null))[_0xf089('0x1f')](function(_0x310936){if(_0x310936){_0x357714=_0x310936;_0x4bc5cf[_0xf089('0x47')]=_[_0xf089('0x56')](db[_0xf089('0x66')]['rawAttributes']);_0x4bc5cf['query']=_[_0xf089('0x56')](_0x51eb40[_0xf089('0x44')]);_0x4bc5cf[_0xf089('0x45')]=_[_0xf089('0x46')](_0x4bc5cf['model'],_0x4bc5cf[_0xf089('0x44')]);_0x312b15['attributes']=_[_0xf089('0x46')](_0x4bc5cf[_0xf089('0x47')],qs[_0xf089('0x49')](_0x51eb40[_0xf089('0x44')][_0xf089('0x49')]));_0x312b15['attributes']=_0x312b15[_0xf089('0x48')]['length']?_0x312b15[_0xf089('0x48')]:_0x4bc5cf[_0xf089('0x47')];_0x312b15[_0xf089('0x4c')]=qs['sort'](_0x51eb40[_0xf089('0x44')]['sort']);_0x312b15[_0xf089('0x50')]=qs[_0xf089('0x45')](_[_0xf089('0x4e')](_0x51eb40[_0xf089('0x44')],_0x4bc5cf['filters']));if(_0x51eb40[_0xf089('0x44')][_0xf089('0x4f')]){_0x312b15['where']=_['merge'](_0x312b15[_0xf089('0x50')],{'$or':_[_0xf089('0x3d')](_0x312b15['attributes'],function(_0x23245e){var _0x52c502={};_0x52c502[_0x23245e]={'$like':'%'+_0x51eb40['query'][_0xf089('0x4f')]+'%'};return _0x52c502;})});}_0x312b15=_[_0xf089('0x37')]({},_0x312b15,_0x51eb40[_0xf089('0x67')]);return _0x357714[_0xf089('0x64')](_0x312b15);}})[_0xf089('0x1f')](function(_0x4db27){if(_0x4db27){_0x108ea3=_0x4db27['length'];if(!_0x51eb40['query'][_0xf089('0x4b')]('nolimit')){_0x312b15[_0xf089('0x2e')]=qs['limit'](_0x51eb40['query']['limit']);_0x312b15[_0xf089('0x2c')]=qs[_0xf089('0x2c')](_0x51eb40['query'][_0xf089('0x2c')]);}return _0x357714['getMembers'](_0x312b15);}})[_0xf089('0x1f')](function(_0x2435cb){if(_0x2435cb){return _0x2435cb?{'count':_0x108ea3,'rows':_0x2435cb}:null;}})[_0xf089('0x1f')](respondWithResult(_0x2da086,null))[_0xf089('0x29')](handleError(_0x2da086,null));};exports[_0xf089('0x68')]=function(_0x138d6b,_0x4bec3a,_0x4697b0){return db[_0xf089('0x3e')][_0xf089('0x59')]({'where':{'id':_0x138d6b['params']['id']}})[_0xf089('0x1f')](handleEntityNotFound(_0x4bec3a,null))['then'](function(_0x4354b0){if(_0x4354b0){return _0x4354b0['removeMembers'](_0x138d6b[_0xf089('0x44')][_0xf089('0x63')]);}})[_0xf089('0x1f')](respondWithStatusCode(_0x4bec3a,null))[_0xf089('0x29')](handleError(_0x4bec3a,null));};exports[_0xf089('0x69')]=function(_0x261dd4,_0x16a00e,_0x5477e0){if(_0x261dd4['body']['id']){delete _0x261dd4[_0xf089('0x38')]['id'];}return db[_0xf089('0x3e')][_0xf089('0x59')]({'where':{'id':_0x261dd4[_0xf089('0x55')]['id']}})[_0xf089('0x1f')](handleEntityNotFound(_0x16a00e,null))[_0xf089('0x1f')](function(_0x3a3884){if(_0x3a3884){_0x261dd4[_0xf089('0x38')][_0xf089('0x6a')]=_0x3a3884['id'];return db[_0xf089('0x5e')][_0xf089('0x5a')](_0x261dd4[_0xf089('0x38')]);}})[_0xf089('0x1f')](respondWithResult(_0x16a00e,null))[_0xf089('0x29')](handleError(_0x16a00e,null));};exports[_0xf089('0x6b')]=function(_0x265522,_0x5c401d,_0x5e5f53){var _0x1a3c74={};var _0x302649={};var _0x1d4e3d;var _0x34af52;return db[_0xf089('0x3e')]['findOne']({'where':{'id':_0x265522[_0xf089('0x55')]['id']}})[_0xf089('0x1f')](handleEntityNotFound(_0x5c401d,null))[_0xf089('0x1f')](function(_0x45a276){if(_0x45a276){_0x1d4e3d=_0x45a276;_0x302649[_0xf089('0x47')]=_['keys'](db['ChatInternalMessage'][_0xf089('0x3f')]);_0x302649['query']=_['keys'](_0x265522[_0xf089('0x44')]);_0x302649[_0xf089('0x45')]=_[_0xf089('0x46')](_0x302649[_0xf089('0x47')],_0x302649[_0xf089('0x44')]);_0x1a3c74[_0xf089('0x48')]=_[_0xf089('0x46')](_0x302649[_0xf089('0x47')],qs[_0xf089('0x49')](_0x265522[_0xf089('0x44')][_0xf089('0x49')]));_0x1a3c74[_0xf089('0x48')]=_0x1a3c74[_0xf089('0x48')]['length']?_0x1a3c74[_0xf089('0x48')]:_0x302649[_0xf089('0x47')];_0x1a3c74[_0xf089('0x4c')]=qs[_0xf089('0x4d')](_0x265522[_0xf089('0x44')]['sort']);_0x1a3c74[_0xf089('0x50')]=qs[_0xf089('0x45')](_[_0xf089('0x4e')](_0x265522[_0xf089('0x44')],_0x302649[_0xf089('0x45')]));if(_0x265522[_0xf089('0x44')][_0xf089('0x4f')]){_0x1a3c74[_0xf089('0x50')]=_[_0xf089('0x37')](_0x1a3c74[_0xf089('0x50')],{'$or':_[_0xf089('0x3d')](_0x1a3c74['attributes'],function(_0x1d8da2){var _0x463421={};_0x463421[_0x1d8da2]={'$like':'%'+_0x265522[_0xf089('0x44')][_0xf089('0x4f')]+'%'};return _0x463421;})});}if(_0x265522['query'][_0xf089('0x6c')]){var _0x211bff=_0x265522['query'][_0xf089('0x6c')]['split'](',');var _0x2715fa={};_0x2715fa[_0x211bff[0x0]]={'$gte':moment(_0x211bff[0x1])[_0xf089('0x6d')](_0xf089('0x6e'))};_0x1a3c74[_0xf089('0x50')]=_[_0xf089('0x37')](_0x1a3c74[_0xf089('0x50')],_0x2715fa);}_0x1a3c74=_['merge']({},_0x1a3c74,_0x265522[_0xf089('0x67')]);return _0x1d4e3d[_0xf089('0x6b')](_0x1a3c74);}})[_0xf089('0x1f')](function(_0xdb09c6){if(_0xdb09c6){_0x34af52=_0xdb09c6[_0xf089('0x4a')];if(!_0x265522[_0xf089('0x44')]['hasOwnProperty'](_0xf089('0x6f'))){_0x1a3c74[_0xf089('0x2e')]=qs['limit'](_0x265522[_0xf089('0x44')]['limit']);_0x1a3c74[_0xf089('0x2c')]=qs['offset'](_0x265522[_0xf089('0x44')][_0xf089('0x2c')]);}return _0x1d4e3d[_0xf089('0x6b')](_0x1a3c74);}})[_0xf089('0x1f')](function(_0x4fcb46){if(_0x4fcb46){return _0x4fcb46?{'count':_0x34af52,'rows':_0x4fcb46}:null;}})[_0xf089('0x1f')](respondWithResult(_0x5c401d,null))['catch'](handleError(_0x5c401d,null));}; \ No newline at end of file +var _0xac22=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','./chatGroup.socket','register','jayson/promise','client','http','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','message','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','destroy','end','stack','name','send','merge','body','contact','interaction','account','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','where','filters','pick','filter','includeAll','include','findAll','rows','catch','show','params','find','create','update','describe','getUnread','user','addMembers','omit','getMembers','findOne','sort','options','nolimit','removeMembers','ids','addMessage','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xac22,0x138));var _0x2ac2=function(_0x2427a7,_0x2a0f2e){_0x2427a7=_0x2427a7-0x0;var _0x54adad=_0xac22[_0x2427a7];return _0x54adad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ac2('0x0'));var zipdir=require(_0x2ac2('0x1'));var jsonpatch=require(_0x2ac2('0x2'));var rp=require(_0x2ac2('0x3'));var moment=require(_0x2ac2('0x4'));var BPromise=require(_0x2ac2('0x5'));var Mustache=require(_0x2ac2('0x6'));var util=require('util');var path=require(_0x2ac2('0x7'));var sox=require(_0x2ac2('0x8'));var csv=require(_0x2ac2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ac2('0xa'));var _=require(_0x2ac2('0xb'));var squel=require('squel');var crypto=require(_0x2ac2('0xc'));var jsforce=require(_0x2ac2('0xd'));var deskjs=require(_0x2ac2('0xe'));var toCsv=require(_0x2ac2('0x9'));var querystring=require(_0x2ac2('0xf'));var Papa=require(_0x2ac2('0x10'));var Redis=require(_0x2ac2('0x11'));var authService=require(_0x2ac2('0x12'));var qs=require(_0x2ac2('0x13'));var as=require(_0x2ac2('0x14'));var hardwareService=require(_0x2ac2('0x15'));var logger=require(_0x2ac2('0x16'))('api');var utils=require(_0x2ac2('0x17'));var config=require(_0x2ac2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2ac2('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ac2('0x1a')]));require(_0x2ac2('0x1b'))[_0x2ac2('0x1c')](socket);var jayson=require(_0x2ac2('0x1d'));var client=jayson[_0x2ac2('0x1e')][_0x2ac2('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x41fb58,_0x5c3458,_0x156864,_0x27a4de){return new BPromise(function(_0x55ef25,_0xa6f4c){var _0x496cf0=_0x27a4de||client;return _0x496cf0[_0x2ac2('0x20')](_0x41fb58,_0x156864)[_0x2ac2('0x21')](function(_0x32679c){logger[_0x2ac2('0x22')](_0x2ac2('0x23'),_0x5c3458,_0x2ac2('0x24'));logger[_0x2ac2('0x25')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5c3458,'request\x20sent',JSON['stringify'](_0x32679c));if(_0x32679c[_0x2ac2('0x26')]){if(_0x32679c[_0x2ac2('0x26')]['code']===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x5c3458,_0x32679c[_0x2ac2('0x26')][_0x2ac2('0x27')]);return _0xa6f4c(_0x32679c[_0x2ac2('0x26')][_0x2ac2('0x27')]);}logger[_0x2ac2('0x26')](_0x2ac2('0x23'),_0x5c3458,_0x32679c[_0x2ac2('0x26')]['message']);return _0x55ef25(_0x32679c[_0x2ac2('0x26')][_0x2ac2('0x27')]);}else{logger[_0x2ac2('0x22')](_0x2ac2('0x23'),_0x5c3458,_0x2ac2('0x24'));_0x55ef25(_0x32679c['result']['message']);}})['catch'](function(_0x4bf8e3){logger[_0x2ac2('0x26')](_0x2ac2('0x23'),_0x5c3458,_0x4bf8e3);_0xa6f4c(_0x4bf8e3);});});}function respondWithStatusCode(_0x260086,_0x24ac47){_0x24ac47=_0x24ac47||0xcc;return function(_0x4b2c3e){if(_0x4b2c3e){return _0x260086[_0x2ac2('0x28')](_0x24ac47);}return _0x260086['status'](_0x24ac47)['end']();};}function respondWithResult(_0x26a9c0,_0x46db0a){_0x46db0a=_0x46db0a||0xc8;return function(_0x135aa3){if(_0x135aa3){return _0x26a9c0[_0x2ac2('0x29')](_0x46db0a)['json'](_0x135aa3);}};}function respondWithFilteredResult(_0x40b2cd,_0x4d68a2){return function(_0x5dcb54){if(_0x5dcb54){var _0x580ca0=typeof _0x4d68a2[_0x2ac2('0x2a')]===_0x2ac2('0x2b')&&typeof _0x4d68a2[_0x2ac2('0x2c')]===_0x2ac2('0x2b');var _0x3649ab=_0x5dcb54['count'];var _0x3dfacc=_0x580ca0?0x0:_0x4d68a2['offset'];var _0x243a7d=_0x580ca0?_0x5dcb54[_0x2ac2('0x2d')]:_0x4d68a2[_0x2ac2('0x2a')]+_0x4d68a2[_0x2ac2('0x2c')];var _0x185cd8;if(_0x243a7d>=_0x3649ab){_0x243a7d=_0x3649ab;_0x185cd8=0xc8;}else{_0x185cd8=0xce;}_0x40b2cd['status'](_0x185cd8);return _0x40b2cd[_0x2ac2('0x2e')](_0x2ac2('0x2f'),_0x3dfacc+'-'+_0x243a7d+'/'+_0x3649ab)[_0x2ac2('0x30')](_0x5dcb54);}return null;};}function patchUpdates(_0x36e406){return function(_0x55e0b7){try{jsonpatch[_0x2ac2('0x31')](_0x55e0b7,_0x36e406,!![]);}catch(_0x4f156f){return BPromise[_0x2ac2('0x32')](_0x4f156f);}return _0x55e0b7['save']();};}function saveUpdates(_0x202a4d,_0x10b263){return function(_0x1f5148){if(_0x1f5148){return _0x1f5148['update'](_0x202a4d)['then'](function(_0x47f828){return _0x47f828;});}return null;};}function removeEntity(_0x28eac0,_0x54b3ff){return function(_0x74d930){if(_0x74d930){return _0x74d930[_0x2ac2('0x33')]()[_0x2ac2('0x21')](function(){_0x28eac0[_0x2ac2('0x29')](0xcc)[_0x2ac2('0x34')]();});}};}function handleEntityNotFound(_0x2af9de,_0x2ec7b3){return function(_0x57aaec){if(!_0x57aaec){_0x2af9de[_0x2ac2('0x28')](0x194);}return _0x57aaec;};}function handleError(_0x1279db,_0x4757dc){_0x4757dc=_0x4757dc||0x1f4;return function(_0x475fff){logger[_0x2ac2('0x26')](_0x475fff[_0x2ac2('0x35')]);if(_0x475fff[_0x2ac2('0x36')]){delete _0x475fff[_0x2ac2('0x36')];}_0x1279db[_0x2ac2('0x29')](_0x4757dc)[_0x2ac2('0x37')](_0x475fff);};}function getMustacheRender(_0x136abf,_0x3b4111){return Mustache['render'](_0x136abf,_[_0x2ac2('0x38')](_0x3b4111[_0x2ac2('0x39')],{'contact':_0x3b4111[_0x2ac2('0x3a')],'message':_0x3b4111['message'],'agent':_0x3b4111['agent'],'interaction':_0x3b4111[_0x2ac2('0x3b')],'account':_0x3b4111[_0x2ac2('0x3c')]}))||'';}exports[_0x2ac2('0x3d')]=function(_0x5ae1a6,_0x3d828a){var _0x4f5d66={},_0x16c4db={},_0x225e9b={'count':0x0,'rows':[]};var _0x34b15e=_[_0x2ac2('0x3e')](db[_0x2ac2('0x3f')][_0x2ac2('0x40')],function(_0x2c3de3){return{'name':_0x2c3de3[_0x2ac2('0x41')],'type':_0x2c3de3[_0x2ac2('0x42')][_0x2ac2('0x43')]};});_0x16c4db[_0x2ac2('0x44')]=_[_0x2ac2('0x3e')](_0x34b15e,_0x2ac2('0x36'));_0x16c4db[_0x2ac2('0x45')]=_[_0x2ac2('0x46')](_0x5ae1a6['query']);_0x16c4db['filters']=_[_0x2ac2('0x47')](_0x16c4db['model'],_0x16c4db[_0x2ac2('0x45')]);_0x4f5d66['attributes']=_['intersection'](_0x16c4db['model'],qs['fields'](_0x5ae1a6[_0x2ac2('0x45')][_0x2ac2('0x48')]));_0x4f5d66['attributes']=_0x4f5d66[_0x2ac2('0x49')][_0x2ac2('0x4a')]?_0x4f5d66[_0x2ac2('0x49')]:_0x16c4db[_0x2ac2('0x44')];if(!_0x5ae1a6['query'][_0x2ac2('0x4b')]('nolimit')){_0x4f5d66[_0x2ac2('0x2c')]=qs[_0x2ac2('0x2c')](_0x5ae1a6[_0x2ac2('0x45')][_0x2ac2('0x2c')]);_0x4f5d66['offset']=qs[_0x2ac2('0x2a')](_0x5ae1a6[_0x2ac2('0x45')][_0x2ac2('0x2a')]);}_0x4f5d66[_0x2ac2('0x4c')]=qs['sort'](_0x5ae1a6[_0x2ac2('0x45')]['sort']);_0x4f5d66[_0x2ac2('0x4d')]=qs[_0x2ac2('0x4e')](_[_0x2ac2('0x4f')](_0x5ae1a6[_0x2ac2('0x45')],_0x16c4db['filters']),_0x34b15e);if(_0x5ae1a6['query'][_0x2ac2('0x50')]){_0x4f5d66[_0x2ac2('0x4d')]=_[_0x2ac2('0x38')](_0x4f5d66[_0x2ac2('0x4d')],{'$or':_[_0x2ac2('0x3e')](_0x34b15e,function(_0x19be9e){if(_0x19be9e[_0x2ac2('0x42')]!=='VIRTUAL'){var _0x3c42ff={};_0x3c42ff[_0x19be9e['name']]={'$like':'%'+_0x5ae1a6[_0x2ac2('0x45')]['filter']+'%'};return _0x3c42ff;}})});}_0x4f5d66=_['merge']({},_0x4f5d66,_0x5ae1a6['options']);var _0x3600c6={'where':_0x4f5d66[_0x2ac2('0x4d')]};return db[_0x2ac2('0x3f')][_0x2ac2('0x2d')](_0x3600c6)[_0x2ac2('0x21')](function(_0xe0765a){_0x225e9b[_0x2ac2('0x2d')]=_0xe0765a;if(_0x5ae1a6[_0x2ac2('0x45')][_0x2ac2('0x51')]){_0x4f5d66[_0x2ac2('0x52')]=[{'all':!![]}];}return db[_0x2ac2('0x3f')][_0x2ac2('0x53')](_0x4f5d66);})[_0x2ac2('0x21')](function(_0x1dc83e){_0x225e9b[_0x2ac2('0x54')]=_0x1dc83e;return _0x225e9b;})[_0x2ac2('0x21')](respondWithFilteredResult(_0x3d828a,_0x4f5d66))[_0x2ac2('0x55')](handleError(_0x3d828a,null));};exports[_0x2ac2('0x56')]=function(_0x4cfee9,_0x50d076){var _0x534858={'raw':!![],'where':{'id':_0x4cfee9[_0x2ac2('0x57')]['id']}},_0x35f874={};_0x35f874[_0x2ac2('0x44')]=_[_0x2ac2('0x46')](db[_0x2ac2('0x3f')][_0x2ac2('0x40')]);_0x35f874[_0x2ac2('0x45')]=_[_0x2ac2('0x46')](_0x4cfee9[_0x2ac2('0x45')]);_0x35f874[_0x2ac2('0x4e')]=_[_0x2ac2('0x47')](_0x35f874[_0x2ac2('0x44')],_0x35f874[_0x2ac2('0x45')]);_0x534858[_0x2ac2('0x49')]=_[_0x2ac2('0x47')](_0x35f874[_0x2ac2('0x44')],qs['fields'](_0x4cfee9[_0x2ac2('0x45')][_0x2ac2('0x48')]));_0x534858[_0x2ac2('0x49')]=_0x534858[_0x2ac2('0x49')][_0x2ac2('0x4a')]?_0x534858[_0x2ac2('0x49')]:_0x35f874['model'];if(_0x4cfee9[_0x2ac2('0x45')]['includeAll']){_0x534858[_0x2ac2('0x52')]=[{'all':!![]}];}_0x534858=_[_0x2ac2('0x38')]({},_0x534858,_0x4cfee9['options']);return db['ChatGroup'][_0x2ac2('0x58')](_0x534858)[_0x2ac2('0x21')](handleEntityNotFound(_0x50d076,null))['then'](respondWithResult(_0x50d076,null))['catch'](handleError(_0x50d076,null));};exports[_0x2ac2('0x59')]=function(_0x5b02be,_0x4382d8){return db[_0x2ac2('0x3f')][_0x2ac2('0x59')](_0x5b02be['body'],{})[_0x2ac2('0x21')](respondWithResult(_0x4382d8,0xc9))[_0x2ac2('0x55')](handleError(_0x4382d8,null));};exports[_0x2ac2('0x5a')]=function(_0x4a3745,_0x5d84ba){if(_0x4a3745[_0x2ac2('0x39')]['id']){delete _0x4a3745[_0x2ac2('0x39')]['id'];}return db[_0x2ac2('0x3f')][_0x2ac2('0x58')]({'where':{'id':_0x4a3745[_0x2ac2('0x57')]['id']}})[_0x2ac2('0x21')](handleEntityNotFound(_0x5d84ba,null))['then'](saveUpdates(_0x4a3745[_0x2ac2('0x39')],null))[_0x2ac2('0x21')](respondWithResult(_0x5d84ba,null))[_0x2ac2('0x55')](handleError(_0x5d84ba,null));};exports[_0x2ac2('0x33')]=function(_0x16fc54,_0x2983c2){return db[_0x2ac2('0x3f')][_0x2ac2('0x58')]({'where':{'id':_0x16fc54['params']['id']}})[_0x2ac2('0x21')](handleEntityNotFound(_0x2983c2,null))[_0x2ac2('0x21')](removeEntity(_0x2983c2,null))[_0x2ac2('0x55')](handleError(_0x2983c2,null));};exports[_0x2ac2('0x5b')]=function(_0x1217d4,_0x46a9b6){return db[_0x2ac2('0x3f')][_0x2ac2('0x5b')]()[_0x2ac2('0x21')](respondWithResult(_0x46a9b6,null))[_0x2ac2('0x55')](handleError(_0x46a9b6,null));};exports[_0x2ac2('0x5c')]=function(_0x44e23f,_0x18df93,_0x29fd65){return db['ChatInternalMessage'][_0x2ac2('0x2d')]({'where':{'ChatGroupId':_0x44e23f[_0x2ac2('0x57')]['id'],'ToId':_0x44e23f[_0x2ac2('0x5d')]['id'],'read':![]}})['then'](function(_0x1c27e5){return{'id':_['toInteger'](_0x44e23f[_0x2ac2('0x57')]['id']),'count':_0x1c27e5};})['then'](respondWithResult(_0x18df93,null))['catch'](handleError(_0x18df93,null));};exports['addMembers']=function(_0x3c60d4,_0x721170,_0x39c0af){return db[_0x2ac2('0x3f')][_0x2ac2('0x58')]({'where':{'id':_0x3c60d4[_0x2ac2('0x57')]['id']}})['then'](handleEntityNotFound(_0x721170,null))[_0x2ac2('0x21')](function(_0x217b19){if(_0x217b19){return _0x217b19[_0x2ac2('0x5e')](_0x3c60d4[_0x2ac2('0x39')]['ids'],_[_0x2ac2('0x5f')](_0x3c60d4['body'],['ids','id'])||{});}})[_0x2ac2('0x21')](respondWithResult(_0x721170,null))[_0x2ac2('0x55')](handleError(_0x721170,null));};exports[_0x2ac2('0x60')]=function(_0x1ba21f,_0x2465aa,_0x58c8e4){var _0x131b54={};var _0x584a43={};var _0x586e22;var _0x2d4f89;return db[_0x2ac2('0x3f')][_0x2ac2('0x61')]({'where':{'id':_0x1ba21f[_0x2ac2('0x57')]['id']}})[_0x2ac2('0x21')](handleEntityNotFound(_0x2465aa,null))['then'](function(_0x1be2d0){if(_0x1be2d0){_0x586e22=_0x1be2d0;_0x584a43[_0x2ac2('0x44')]=_[_0x2ac2('0x46')](db['User']['rawAttributes']);_0x584a43[_0x2ac2('0x45')]=_[_0x2ac2('0x46')](_0x1ba21f[_0x2ac2('0x45')]);_0x584a43[_0x2ac2('0x4e')]=_[_0x2ac2('0x47')](_0x584a43['model'],_0x584a43[_0x2ac2('0x45')]);_0x131b54[_0x2ac2('0x49')]=_['intersection'](_0x584a43['model'],qs[_0x2ac2('0x48')](_0x1ba21f['query'][_0x2ac2('0x48')]));_0x131b54[_0x2ac2('0x49')]=_0x131b54[_0x2ac2('0x49')][_0x2ac2('0x4a')]?_0x131b54['attributes']:_0x584a43['model'];_0x131b54[_0x2ac2('0x4c')]=qs[_0x2ac2('0x62')](_0x1ba21f[_0x2ac2('0x45')][_0x2ac2('0x62')]);_0x131b54[_0x2ac2('0x4d')]=qs['filters'](_[_0x2ac2('0x4f')](_0x1ba21f[_0x2ac2('0x45')],_0x584a43['filters']));if(_0x1ba21f[_0x2ac2('0x45')][_0x2ac2('0x50')]){_0x131b54[_0x2ac2('0x4d')]=_[_0x2ac2('0x38')](_0x131b54['where'],{'$or':_[_0x2ac2('0x3e')](_0x131b54['attributes'],function(_0x55c1ae){var _0x594b79={};_0x594b79[_0x55c1ae]={'$like':'%'+_0x1ba21f['query'][_0x2ac2('0x50')]+'%'};return _0x594b79;})});}_0x131b54=_[_0x2ac2('0x38')]({},_0x131b54,_0x1ba21f[_0x2ac2('0x63')]);return _0x586e22[_0x2ac2('0x60')](_0x131b54);}})[_0x2ac2('0x21')](function(_0x65058a){if(_0x65058a){_0x2d4f89=_0x65058a[_0x2ac2('0x4a')];if(!_0x1ba21f['query']['hasOwnProperty'](_0x2ac2('0x64'))){_0x131b54[_0x2ac2('0x2c')]=qs[_0x2ac2('0x2c')](_0x1ba21f['query'][_0x2ac2('0x2c')]);_0x131b54['offset']=qs[_0x2ac2('0x2a')](_0x1ba21f[_0x2ac2('0x45')]['offset']);}return _0x586e22[_0x2ac2('0x60')](_0x131b54);}})[_0x2ac2('0x21')](function(_0x4c3313){if(_0x4c3313){return _0x4c3313?{'count':_0x2d4f89,'rows':_0x4c3313}:null;}})[_0x2ac2('0x21')](respondWithResult(_0x2465aa,null))[_0x2ac2('0x55')](handleError(_0x2465aa,null));};exports[_0x2ac2('0x65')]=function(_0x90eef9,_0x203e1f,_0x31dc42){return db[_0x2ac2('0x3f')][_0x2ac2('0x58')]({'where':{'id':_0x90eef9[_0x2ac2('0x57')]['id']}})[_0x2ac2('0x21')](handleEntityNotFound(_0x203e1f,null))['then'](function(_0x1380b6){if(_0x1380b6){return _0x1380b6[_0x2ac2('0x65')](_0x90eef9[_0x2ac2('0x45')][_0x2ac2('0x66')]);}})[_0x2ac2('0x21')](respondWithStatusCode(_0x203e1f,null))[_0x2ac2('0x55')](handleError(_0x203e1f,null));};exports[_0x2ac2('0x67')]=function(_0x4aeae8,_0x36bebe,_0x4c489a){if(_0x4aeae8[_0x2ac2('0x39')]['id']){delete _0x4aeae8[_0x2ac2('0x39')]['id'];}return db[_0x2ac2('0x3f')][_0x2ac2('0x58')]({'where':{'id':_0x4aeae8[_0x2ac2('0x57')]['id']}})[_0x2ac2('0x21')](handleEntityNotFound(_0x36bebe,null))['then'](function(_0x1419ca){if(_0x1419ca){_0x4aeae8[_0x2ac2('0x39')][_0x2ac2('0x68')]=_0x1419ca['id'];return db['ChatInternalMessage']['create'](_0x4aeae8['body']);}})['then'](respondWithResult(_0x36bebe,null))['catch'](handleError(_0x36bebe,null));};exports['getMessages']=function(_0x2b92c7,_0x2d6568,_0x2cea99){var _0x335475={};var _0x532639={};var _0x12a934;var _0x118270;return db['ChatGroup'][_0x2ac2('0x61')]({'where':{'id':_0x2b92c7[_0x2ac2('0x57')]['id']}})[_0x2ac2('0x21')](handleEntityNotFound(_0x2d6568,null))[_0x2ac2('0x21')](function(_0x295316){if(_0x295316){_0x12a934=_0x295316;_0x532639[_0x2ac2('0x44')]=_[_0x2ac2('0x46')](db['ChatInternalMessage'][_0x2ac2('0x40')]);_0x532639[_0x2ac2('0x45')]=_['keys'](_0x2b92c7[_0x2ac2('0x45')]);_0x532639[_0x2ac2('0x4e')]=_[_0x2ac2('0x47')](_0x532639['model'],_0x532639[_0x2ac2('0x45')]);_0x335475[_0x2ac2('0x49')]=_['intersection'](_0x532639[_0x2ac2('0x44')],qs[_0x2ac2('0x48')](_0x2b92c7[_0x2ac2('0x45')][_0x2ac2('0x48')]));_0x335475[_0x2ac2('0x49')]=_0x335475[_0x2ac2('0x49')][_0x2ac2('0x4a')]?_0x335475['attributes']:_0x532639[_0x2ac2('0x44')];_0x335475[_0x2ac2('0x4c')]=qs['sort'](_0x2b92c7[_0x2ac2('0x45')][_0x2ac2('0x62')]);_0x335475[_0x2ac2('0x4d')]=qs[_0x2ac2('0x4e')](_[_0x2ac2('0x4f')](_0x2b92c7['query'],_0x532639[_0x2ac2('0x4e')]));if(_0x2b92c7[_0x2ac2('0x45')][_0x2ac2('0x50')]){_0x335475[_0x2ac2('0x4d')]=_['merge'](_0x335475[_0x2ac2('0x4d')],{'$or':_[_0x2ac2('0x3e')](_0x335475[_0x2ac2('0x49')],function(_0x420d7b){var _0x261538={};_0x261538[_0x420d7b]={'$like':'%'+_0x2b92c7[_0x2ac2('0x45')][_0x2ac2('0x50')]+'%'};return _0x261538;})});}if(_0x2b92c7[_0x2ac2('0x45')][_0x2ac2('0x69')]){var _0x1cb225=_0x2b92c7[_0x2ac2('0x45')][_0x2ac2('0x69')][_0x2ac2('0x6a')](',');var _0x12351f={};_0x12351f[_0x1cb225[0x0]]={'$gte':moment(_0x1cb225[0x1])[_0x2ac2('0x6b')](_0x2ac2('0x6c'))};_0x335475[_0x2ac2('0x4d')]=_['merge'](_0x335475[_0x2ac2('0x4d')],_0x12351f);}_0x335475=_[_0x2ac2('0x38')]({},_0x335475,_0x2b92c7['options']);return _0x12a934['getMessages'](_0x335475);}})[_0x2ac2('0x21')](function(_0x12edef){if(_0x12edef){_0x118270=_0x12edef[_0x2ac2('0x4a')];if(!_0x2b92c7['query'][_0x2ac2('0x4b')](_0x2ac2('0x64'))){_0x335475['limit']=qs[_0x2ac2('0x2c')](_0x2b92c7['query'][_0x2ac2('0x2c')]);_0x335475['offset']=qs[_0x2ac2('0x2a')](_0x2b92c7['query'][_0x2ac2('0x2a')]);}return _0x12a934[_0x2ac2('0x6d')](_0x335475);}})[_0x2ac2('0x21')](function(_0x7f59dc){if(_0x7f59dc){return _0x7f59dc?{'count':_0x118270,'rows':_0x7f59dc}:null;}})[_0x2ac2('0x21')](respondWithResult(_0x2d6568,null))[_0x2ac2('0x55')](handleError(_0x2d6568,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index fd5bbed..9f9e311 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x18fb4c,_0x578f22){var _0x4a75b3=function(_0x27d762){while(--_0x27d762){_0x18fb4c['push'](_0x18fb4c['shift']());}};_0x4a75b3(++_0x578f22);}(_0x2ef3,0xba));var _0x32ef=function(_0x315fa1,_0x26a256){_0x315fa1=_0x315fa1-0x0;var _0x40a907=_0x2ef3[_0x315fa1];return _0x40a907;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var ChatGroup=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){ChatGroupEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);ChatGroupEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xdb28=['ChatGroup','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x3e41aa,_0x3b5f7e){var _0x28ab00=function(_0x2cb395){while(--_0x2cb395){_0x3e41aa['push'](_0x3e41aa['shift']());}};_0x28ab00(++_0x3b5f7e);}(_0xdb28,0x106));var _0x8db2=function(_0x925037,_0x3ed88d){_0x925037=_0x925037-0x0;var _0x5a0d9e=_0xdb28[_0x925037];return _0x5a0d9e;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var ChatGroup=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 7cf0b15..862335c 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 _0xa991=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','lodash'];(function(_0x4c74ae,_0x12408d){var _0x307451=function(_0x210931){while(--_0x210931){_0x4c74ae['push'](_0x4c74ae['shift']());}};_0x307451(++_0x12408d);}(_0xa991,0x143));var _0x1a99=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xa991[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x1a99('0x0'));var util=require('util');var logger=require(_0x1a99('0x1'))(_0x1a99('0x2'));var moment=require(_0x1a99('0x3'));var BPromise=require(_0x1a99('0x4'));var rp=require(_0x1a99('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a99('0x6'));var config=require(_0x1a99('0x7'));var attributes=require(_0x1a99('0x8'));module[_0x1a99('0x9')]=function(_0x22990b,_0xabf36a){return _0x22990b[_0x1a99('0xa')]('ChatGroup',attributes,{'tableName':_0x1a99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fb8=['rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','../../config/logger','api','bluebird'];(function(_0x645982,_0x37392d){var _0x5b0505=function(_0x33c2dd){while(--_0x33c2dd){_0x645982['push'](_0x645982['shift']());}};_0x5b0505(++_0x37392d);}(_0x6fb8,0x104));var _0x86fb=function(_0xee3051,_0xbe4f18){_0xee3051=_0xee3051-0x0;var _0x139e81=_0x6fb8[_0xee3051];return _0x139e81;};'use strict';var _=require(_0x86fb('0x0'));var util=require('util');var logger=require(_0x86fb('0x1'))(_0x86fb('0x2'));var moment=require('moment');var BPromise=require(_0x86fb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x86fb('0x4'));var config=require(_0x86fb('0x5'));var attributes=require(_0x86fb('0x6'));module[_0x86fb('0x7')]=function(_0x1aa956,_0x7ba395){return _0x1aa956[_0x86fb('0x8')](_0x86fb('0x9'),attributes,{'tableName':_0x86fb('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 a60c8c8..092b8e8 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 _0x5df3=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment'];(function(_0x175388,_0x4578cc){var _0x4a3566=function(_0x14e27f){while(--_0x14e27f){_0x175388['push'](_0x175388['shift']());}};_0x4a3566(++_0x4578cc);}(_0x5df3,0x13d));var _0x35df=function(_0x599c94,_0x464f0e){_0x599c94=_0x599c94-0x0;var _0x34e215=_0x5df3[_0x599c94];return _0x34e215;};'use strict';var _=require('lodash');var util=require(_0x35df('0x0'));var moment=require(_0x35df('0x1'));var BPromise=require('bluebird');var rs=require(_0x35df('0x2'));var fs=require('fs');var Redis=require(_0x35df('0x3'));var db=require(_0x35df('0x4'))['db'];var utils=require(_0x35df('0x5'));var logger=require(_0x35df('0x6'))(_0x35df('0x7'));var config=require(_0x35df('0x8'));var jayson=require(_0x35df('0x9'));var client=jayson[_0x35df('0xa')][_0x35df('0xb')]({'port':0x232a});config['redis']=_[_0x35df('0xc')](config[_0x35df('0xd')],{'host':_0x35df('0xe'),'port':0x18eb});var socket=require(_0x35df('0xf'))(new Redis(config['redis']));require(_0x35df('0x10'))['register'](socket);function respondWithRpcPromise(_0x1a4460,_0x23ca2e,_0x36ab7f){return new BPromise(function(_0x2d0780,_0x58dcc1){return client[_0x35df('0x11')](_0x1a4460,_0x36ab7f)[_0x35df('0x12')](function(_0x56b1f8){logger['info'](_0x35df('0x13'),_0x23ca2e,_0x35df('0x14'));logger[_0x35df('0x15')](_0x35df('0x16'),_0x23ca2e,_0x35df('0x14'),JSON['stringify'](_0x56b1f8));if(_0x56b1f8[_0x35df('0x17')]){if(_0x56b1f8['error'][_0x35df('0x18')]===0x1f4){logger[_0x35df('0x17')](_0x35df('0x13'),_0x23ca2e,_0x56b1f8['error'][_0x35df('0x19')]);return _0x58dcc1(_0x56b1f8[_0x35df('0x17')][_0x35df('0x19')]);}logger[_0x35df('0x17')]('ChatGroup,\x20%s,\x20%s',_0x23ca2e,_0x56b1f8['error'][_0x35df('0x19')]);return _0x2d0780(_0x56b1f8[_0x35df('0x17')][_0x35df('0x19')]);}else{logger[_0x35df('0x1a')](_0x35df('0x13'),_0x23ca2e,'request\x20sent');_0x2d0780(_0x56b1f8[_0x35df('0x1b')][_0x35df('0x19')]);}})[_0x35df('0x1c')](function(_0x4e866e){logger[_0x35df('0x17')](_0x35df('0x13'),_0x23ca2e,_0x4e866e);_0x58dcc1(_0x4e866e);});});} \ No newline at end of file +var _0x3087=['code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','defaults','localhost','redis','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x36d535,_0x5b8abb){var _0x263556=function(_0x1284de){while(--_0x1284de){_0x36d535['push'](_0x36d535['shift']());}};_0x263556(++_0x5b8abb);}(_0x3087,0x163));var _0x7308=function(_0x265307,_0x1705bf){_0x265307=_0x265307-0x0;var _0x4b2237=_0x3087[_0x265307];return _0x4b2237;};'use strict';var _=require(_0x7308('0x0'));var util=require('util');var moment=require(_0x7308('0x1'));var BPromise=require(_0x7308('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7308('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7308('0x4'));var logger=require(_0x7308('0x5'))('rpc');var config=require(_0x7308('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7308('0x7')]['http']({'port':0x232a});config['redis']=_[_0x7308('0x8')](config['redis'],{'host':_0x7308('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7308('0xa')]));require(_0x7308('0xb'))[_0x7308('0xc')](socket);function respondWithRpcPromise(_0x15d677,_0x5384c0,_0x1f735f){return new BPromise(function(_0x108d02,_0x157e9f){return client[_0x7308('0xd')](_0x15d677,_0x1f735f)[_0x7308('0xe')](function(_0xd8014f){logger['info'](_0x7308('0xf'),_0x5384c0,_0x7308('0x10'));logger[_0x7308('0x11')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5384c0,_0x7308('0x10'),JSON[_0x7308('0x12')](_0xd8014f));if(_0xd8014f[_0x7308('0x13')]){if(_0xd8014f['error'][_0x7308('0x14')]===0x1f4){logger['error'](_0x7308('0xf'),_0x5384c0,_0xd8014f[_0x7308('0x13')][_0x7308('0x15')]);return _0x157e9f(_0xd8014f[_0x7308('0x13')][_0x7308('0x15')]);}logger[_0x7308('0x13')](_0x7308('0xf'),_0x5384c0,_0xd8014f[_0x7308('0x13')][_0x7308('0x15')]);return _0x108d02(_0xd8014f[_0x7308('0x13')]['message']);}else{logger[_0x7308('0x16')](_0x7308('0xf'),_0x5384c0,'request\x20sent');_0x108d02(_0xd8014f[_0x7308('0x17')]['message']);}})[_0x7308('0x18')](function(_0x24ede2){logger['error'](_0x7308('0xf'),_0x5384c0,_0x24ede2);_0x157e9f(_0x24ede2);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 33f80e7..67d717b 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 _0xbf8d=['chatGroup:','save','remove','update','emit','removeListener','register','length'];(function(_0x5a013e,_0x32eeab){var _0x2e7421=function(_0xe35e32){while(--_0xe35e32){_0x5a013e['push'](_0x5a013e['shift']());}};_0x2e7421(++_0x32eeab);}(_0xbf8d,0x121));var _0xdbf8=function(_0x5b87ec,_0x43b6b4){_0x5b87ec=_0x5b87ec-0x0;var _0x3f0a21=_0xbf8d[_0x5b87ec];return _0x3f0a21;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xdbf8('0x0'),_0xdbf8('0x1'),_0xdbf8('0x2')];function createListener(_0x266f67,_0x535e7d){return function(_0x28a363){_0x535e7d[_0xdbf8('0x3')](_0x266f67,_0x28a363);};}function removeListener(_0x4141e6,_0x32e323){return function(){ChatGroupEvents[_0xdbf8('0x4')](_0x4141e6,_0x32e323);};}exports[_0xdbf8('0x5')]=function(_0x327262){for(var _0x399634=0x0,_0x3b6998=events[_0xdbf8('0x6')];_0x399634<_0x3b6998;_0x399634++){var _0x57f592=events[_0x399634];var _0x45a620=createListener(_0xdbf8('0x7')+_0x57f592,_0x327262);ChatGroupEvents['on'](_0x57f592,_0x45a620);}}; \ No newline at end of file +var _0x83ed=['removeListener','register','length','chatGroup:','./chatGroup.events','save','remove','emit'];(function(_0x4da11a,_0x9d013d){var _0x1ab4f6=function(_0x14fa64){while(--_0x14fa64){_0x4da11a['push'](_0x4da11a['shift']());}};_0x1ab4f6(++_0x9d013d);}(_0x83ed,0xd4));var _0xd83e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x83ed[_0x56482c];return _0x5aae7a;};'use strict';var ChatGroupEvents=require(_0xd83e('0x0'));var events=[_0xd83e('0x1'),_0xd83e('0x2'),'update'];function createListener(_0x1c24ce,_0x55af99){return function(_0x2948c3){_0x55af99[_0xd83e('0x3')](_0x1c24ce,_0x2948c3);};}function removeListener(_0x177c17,_0x118b3f){return function(){ChatGroupEvents[_0xd83e('0x4')](_0x177c17,_0x118b3f);};}exports[_0xd83e('0x5')]=function(_0x11cdc1){for(var _0xcb2473=0x0,_0x398089=events[_0xd83e('0x6')];_0xcb2473<_0x398089;_0xcb2473++){var _0x382d32=events[_0xcb2473];var _0x748e2d=createListener(_0xd83e('0x7')+_0x382d32,_0x11cdc1);ChatGroupEvents['on'](_0x382d32,_0x748e2d);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index cbe02a0..a1e35ff 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 _0x0182=['/describe','isAuthenticated','describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','addMessage','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index'];(function(_0xc3a71f,_0x54fe71){var _0x46a474=function(_0x47e601){while(--_0x47e601){_0xc3a71f['push'](_0xc3a71f['shift']());}};_0x46a474(++_0x54fe71);}(_0x0182,0x18a));var _0x2018=function(_0xc6b2ff,_0x1558d7){_0xc6b2ff=_0xc6b2ff-0x0;var _0x47f7a4=_0x0182[_0xc6b2ff];return _0x47f7a4;};'use strict';var multer=require(_0x2018('0x0'));var util=require(_0x2018('0x1'));var path=require(_0x2018('0x2'));var timeout=require(_0x2018('0x3'));var express=require(_0x2018('0x4'));var router=express[_0x2018('0x5')]();var fs_extra=require(_0x2018('0x6'));var auth=require(_0x2018('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2018('0x8'));var controller=require('./chatGroup.controller');router[_0x2018('0x9')]('/',auth['isAuthenticated'](),controller[_0x2018('0xa')]);router[_0x2018('0x9')](_0x2018('0xb'),auth[_0x2018('0xc')](),controller[_0x2018('0xd')]);router[_0x2018('0x9')](_0x2018('0xe'),auth['isAuthenticated'](),controller['show']);router['get'](_0x2018('0xf'),auth[_0x2018('0xc')](),controller[_0x2018('0x10')]);router['get'](_0x2018('0x11'),auth['isAuthenticated'](),controller[_0x2018('0x12')]);router[_0x2018('0x9')](_0x2018('0x13'),auth['isAuthenticated'](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/members',auth['isAuthenticated'](),controller['addMembers']);router[_0x2018('0x14')](_0x2018('0x13'),auth[_0x2018('0xc')](),controller[_0x2018('0x15')]);router[_0x2018('0x16')]('/:id',auth[_0x2018('0xc')](),controller[_0x2018('0x17')]);router[_0x2018('0x18')](_0x2018('0xe'),auth[_0x2018('0xc')](),controller[_0x2018('0x19')]);router[_0x2018('0x18')](_0x2018('0x11'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x2018('0x1a')]=router; \ No newline at end of file +var _0xf5dd=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/unread','/:id/members','getMembers','getMessages','post','/:id/messages','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express'];(function(_0x24add3,_0x37bab3){var _0x5c884f=function(_0x171955){while(--_0x171955){_0x24add3['push'](_0x24add3['shift']());}};_0x5c884f(++_0x37bab3);}(_0xf5dd,0x1ad));var _0xdf5d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf5dd[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xdf5d('0x0'));var util=require(_0xdf5d('0x1'));var path=require(_0xdf5d('0x2'));var timeout=require(_0xdf5d('0x3'));var express=require(_0xdf5d('0x4'));var router=express[_0xdf5d('0x5')]();var fs_extra=require(_0xdf5d('0x6'));var auth=require(_0xdf5d('0x7'));var interaction=require(_0xdf5d('0x8'));var config=require(_0xdf5d('0x9'));var controller=require(_0xdf5d('0xa'));router['get']('/',auth[_0xdf5d('0xb')](),controller[_0xdf5d('0xc')]);router[_0xdf5d('0xd')](_0xdf5d('0xe'),auth[_0xdf5d('0xb')](),controller[_0xdf5d('0xf')]);router[_0xdf5d('0xd')](_0xdf5d('0x10'),auth[_0xdf5d('0xb')](),controller[_0xdf5d('0x11')]);router[_0xdf5d('0xd')](_0xdf5d('0x12'),auth[_0xdf5d('0xb')](),controller['getUnread']);router[_0xdf5d('0xd')](_0xdf5d('0x13'),auth[_0xdf5d('0xb')](),controller[_0xdf5d('0x14')]);router[_0xdf5d('0xd')]('/:id/messages',auth[_0xdf5d('0xb')](),controller[_0xdf5d('0x15')]);router[_0xdf5d('0x16')]('/',auth[_0xdf5d('0xb')](),controller['create']);router[_0xdf5d('0x16')](_0xdf5d('0x13'),auth['isAuthenticated'](),controller['addMembers']);router['post'](_0xdf5d('0x17'),auth['isAuthenticated'](),controller[_0xdf5d('0x18')]);router[_0xdf5d('0x19')](_0xdf5d('0x10'),auth['isAuthenticated'](),controller[_0xdf5d('0x1a')]);router[_0xdf5d('0x1b')]('/:id',auth[_0xdf5d('0xb')](),controller[_0xdf5d('0x1c')]);router['delete']('/:id/members',auth[_0xdf5d('0xb')](),controller[_0xdf5d('0x1d')]);module[_0xdf5d('0x1e')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 71edab4..957e5e1 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 _0xe9ec=['sequelize','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0xe9ec,0x1c2));var _0xce9e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe9ec[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xce9e('0x0'));module['exports']={'closed':{'type':Sequelize[_0xce9e('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xce9e('0x2')]},'ratingType':{'type':Sequelize[_0xce9e('0x3')](_0xce9e('0x4'),_0xce9e('0x5')),'defaultValue':_0xce9e('0x4')},'ratingMessage':{'type':Sequelize[_0xce9e('0x6')]},'pathTranscript':{'type':Sequelize[_0xce9e('0x6')]},'mailTranscript':{'type':Sequelize[_0xce9e('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xce9e('0x7')]},'thirdDisposition':{'type':Sequelize[_0xce9e('0x7')]},'note':{'type':Sequelize[_0xce9e('0x7')]},'browserName':{'type':Sequelize[_0xce9e('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xce9e('0x7')]},'osVersion':{'type':Sequelize[_0xce9e('0x7')]},'deviceModel':{'type':Sequelize[_0xce9e('0x7')]},'deviceVendor':{'type':Sequelize[_0xce9e('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xce9e('0x6')]},'customerIp':{'type':Sequelize[_0xce9e('0x7')]},'formData':{'type':Sequelize[_0xce9e('0x6')]('long')},'read1stAt':{'type':Sequelize[_0xce9e('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xce9e('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3646=['ENUM','star','thumb','TEXT','DATE','STRING','long','out','sequelize','exports','BOOLEAN','INTEGER'];(function(_0x4ea6af,_0x4aa32e){var _0x4cb1e6=function(_0xc9edd0){while(--_0xc9edd0){_0x4ea6af['push'](_0x4ea6af['shift']());}};_0x4cb1e6(++_0x4aa32e);}(_0x3646,0x1e8));var _0x6364=function(_0x3d1d0d,_0x320be1){_0x3d1d0d=_0x3d1d0d-0x0;var _0x463db4=_0x3646[_0x3d1d0d];return _0x463db4;};'use strict';var Sequelize=require(_0x6364('0x0'));module[_0x6364('0x1')]={'closed':{'type':Sequelize[_0x6364('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6364('0x3')]},'ratingType':{'type':Sequelize[_0x6364('0x4')](_0x6364('0x5'),_0x6364('0x6')),'defaultValue':_0x6364('0x5')},'ratingMessage':{'type':Sequelize[_0x6364('0x7')]},'pathTranscript':{'type':Sequelize[_0x6364('0x7')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6364('0x8')]},'disposition':{'type':Sequelize[_0x6364('0x9')]},'secondDisposition':{'type':Sequelize[_0x6364('0x9')]},'thirdDisposition':{'type':Sequelize[_0x6364('0x9')]},'note':{'type':Sequelize[_0x6364('0x9')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x6364('0x9')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x6364('0x9')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x6364('0x7')]},'customerIp':{'type':Sequelize[_0x6364('0x9')]},'formData':{'type':Sequelize[_0x6364('0x7')](_0x6364('0xa'))},'read1stAt':{'type':Sequelize[_0x6364('0x8')]},'lastMsgAt':{'type':Sequelize[_0x6364('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x6364('0x4')]('in',_0x6364('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6364('0x9')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index b485f1e..8f0160d 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 _0xea32=['closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','server','views','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','ejs','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','jayson/promise','http','client','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','body','agent','interaction','Users','TagIds','Tags','split','forEach','push','index','map','ChatInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','fields','attributes','length','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.ChatInteractionId','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','o.id\x20=\x20i.UserId','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','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','buildExpression','start','some','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','contactName','DESC','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','groupBy','ChatInteractionId','all','rows','params','intersection','includeAll','include','create','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','contact','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','CmContact','Contact','abandon','entity\x20not\x20found','sendStatus','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','download','close','format','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','System','customer','%s%d','Visitor','agentIdentifier','website_alias','agentAlias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','pass','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','merge','findAll','getMyMessages','includeAgent','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','files','tmp','lastName','attachments','Owner','mkdirSync','Chat','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x337cee,_0x8a49c1){var _0x68aa0=function(_0x5f582e){while(--_0x5f582e){_0x337cee['push'](_0x337cee['shift']());}};_0x68aa0(++_0x8a49c1);}(_0xea32,0x14b));var _0x2ea3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea32[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x2ea3('0x0'));var rimraf=require(_0x2ea3('0x1'));var zipdir=require(_0x2ea3('0x2'));var jsonpatch=require(_0x2ea3('0x3'));var rp=require('request-promise');var moment=require(_0x2ea3('0x4'));var BPromise=require(_0x2ea3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2ea3('0x6'));var csv=require('to-csv');var ejs=require(_0x2ea3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ea3('0x8'));var squel=require(_0x2ea3('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2ea3('0xa'));var toCsv=require(_0x2ea3('0xb'));var querystring=require(_0x2ea3('0xc'));var Papa=require('papaparse');var Redis=require(_0x2ea3('0xd'));var authService=require(_0x2ea3('0xe'));var qs=require(_0x2ea3('0xf'));var as=require(_0x2ea3('0x10'));var pdf=require(_0x2ea3('0x11'));var hardwareService=require(_0x2ea3('0x12'));var logger=require(_0x2ea3('0x13'))(_0x2ea3('0x14'));var utils=require('../../config/utils');var config=require(_0x2ea3('0x15'));var licenseUtil=require(_0x2ea3('0x16'));var db=require(_0x2ea3('0x17'))['db'];config[_0x2ea3('0x18')]=_['defaults'](config['redis'],{'host':_0x2ea3('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ea3('0x18')]));require('./chatInteraction.socket')[_0x2ea3('0x1a')](socket);var jayson=require(_0x2ea3('0x1b'));var client=jayson['client'][_0x2ea3('0x1c')]({'port':0x232b});var client9004=jayson[_0x2ea3('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5d555b,_0x5a262c,_0x4c6bdb,_0x48a49a){return new BPromise(function(_0x382912,_0x480ffa){var _0x3a0c23=_0x48a49a||client;return _0x3a0c23[_0x2ea3('0x1e')](_0x5d555b,_0x4c6bdb)['then'](function(_0x12a7bf){logger[_0x2ea3('0x1f')](_0x2ea3('0x20'),_0x5a262c,_0x2ea3('0x21'));logger[_0x2ea3('0x22')](_0x2ea3('0x23'),_0x5a262c,_0x2ea3('0x21'),JSON['stringify'](_0x12a7bf));if(_0x12a7bf[_0x2ea3('0x24')]){if(_0x12a7bf[_0x2ea3('0x24')][_0x2ea3('0x25')]===0x1f4){logger['error'](_0x2ea3('0x20'),_0x5a262c,_0x12a7bf['error'][_0x2ea3('0x26')]);return _0x480ffa(_0x12a7bf[_0x2ea3('0x24')][_0x2ea3('0x26')]);}logger[_0x2ea3('0x24')](_0x2ea3('0x20'),_0x5a262c,_0x12a7bf[_0x2ea3('0x24')][_0x2ea3('0x26')]);return _0x382912(_0x12a7bf[_0x2ea3('0x24')][_0x2ea3('0x26')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5a262c,'request\x20sent');_0x382912(_0x12a7bf['result'][_0x2ea3('0x26')]);}})[_0x2ea3('0x27')](function(_0x2a2e6e){logger[_0x2ea3('0x24')]('ChatInteraction,\x20%s,\x20%s',_0x5a262c,_0x2a2e6e);_0x480ffa(_0x2a2e6e);});});}function respondWithStatusCode(_0x7034d5,_0x236af6){_0x236af6=_0x236af6||0xcc;return function(_0x33c611){if(_0x33c611){return _0x7034d5['sendStatus'](_0x236af6);}return _0x7034d5['status'](_0x236af6)[_0x2ea3('0x28')]();};}function respondWithResult(_0x401a3c,_0x1cbf9f){_0x1cbf9f=_0x1cbf9f||0xc8;return function(_0x431cd5){if(_0x431cd5){return _0x401a3c[_0x2ea3('0x29')](_0x1cbf9f)[_0x2ea3('0x2a')](_0x431cd5);}};}function respondWithFilteredResult(_0x33e754,_0x15d247){return function(_0x41db64){if(_0x41db64){var _0x5e639e=typeof _0x15d247[_0x2ea3('0x2b')]==='undefined'&&typeof _0x15d247[_0x2ea3('0x2c')]===_0x2ea3('0x2d');var _0x4b2d53=_0x41db64['count'];var _0x318f23=_0x5e639e?0x0:_0x15d247[_0x2ea3('0x2b')];var _0x18d705=_0x5e639e?_0x41db64[_0x2ea3('0x2e')]:_0x15d247['offset']+_0x15d247[_0x2ea3('0x2c')];var _0x240a7c;if(_0x18d705>=_0x4b2d53){_0x18d705=_0x4b2d53;_0x240a7c=0xc8;}else{_0x240a7c=0xce;}_0x33e754[_0x2ea3('0x29')](_0x240a7c);return _0x33e754[_0x2ea3('0x2f')](_0x2ea3('0x30'),_0x318f23+'-'+_0x18d705+'/'+_0x4b2d53)[_0x2ea3('0x2a')](_0x41db64);}return null;};}function patchUpdates(_0x47eab4){return function(_0x365344){try{jsonpatch[_0x2ea3('0x31')](_0x365344,_0x47eab4,!![]);}catch(_0x2d5922){return BPromise[_0x2ea3('0x32')](_0x2d5922);}return _0x365344[_0x2ea3('0x33')]();};}function saveUpdates(_0x218dbb,_0x3f27e0){return function(_0x53c008){if(_0x53c008){return _0x53c008[_0x2ea3('0x34')](_0x218dbb)[_0x2ea3('0x35')](function(_0x1a3cf0){return _0x1a3cf0;});}return null;};}function removeEntity(_0x13769d,_0x55ec2e){return function(_0xd919d6){if(_0xd919d6){return _0xd919d6['destroy']()['then'](function(){_0x13769d[_0x2ea3('0x29')](0xcc)[_0x2ea3('0x28')]();});}};}function handleEntityNotFound(_0x4c9a8a,_0x3e6553){return function(_0x264e0e){if(!_0x264e0e){_0x4c9a8a['sendStatus'](0x194);}return _0x264e0e;};}function handleError(_0x3dee97,_0x3476fc){_0x3476fc=_0x3476fc||0x1f4;return function(_0x5eff83){logger['error'](_0x5eff83[_0x2ea3('0x36')]);if(_0x5eff83[_0x2ea3('0x37')]){delete _0x5eff83[_0x2ea3('0x37')];}_0x3dee97[_0x2ea3('0x29')](_0x3476fc)[_0x2ea3('0x38')](_0x5eff83);};}function getMustacheRender(_0x1d2d33,_0x2834a3){return Mustache['render'](_0x1d2d33,_['merge'](_0x2834a3[_0x2ea3('0x39')],{'contact':_0x2834a3['contact'],'message':_0x2834a3[_0x2ea3('0x26')],'agent':_0x2834a3[_0x2ea3('0x3a')],'interaction':_0x2834a3[_0x2ea3('0x3b')],'account':_0x2834a3['account']}))||'';}function getInteractionUsers(_0x1a79bd,_0x39cace){return new BPromise(function(_0x2e6655,_0xde06e7){try{if(_0x39cace[_0x1a79bd['id']]){_0x1a79bd[_0x2ea3('0x3c')]=_['map'](_0x39cace[_0x1a79bd['id']],function(_0x299512){return{'id':_0x299512['id'],'fullname':_0x299512['fullname']};});}}catch(_0x11c108){_0xde06e7(_0x11c108);}_0x2e6655(_0x1a79bd);});}function getInteractionTags(_0x2f8b23,_0x1e64d1){return new BPromise(function(_0x405684,_0x2ec481){try{if(_0x2f8b23[_0x2ea3('0x3d')]){_0x2f8b23[_0x2ea3('0x3e')]=[];_0x2f8b23['TagIds'][_0x2ea3('0x3f')](',')[_0x2ea3('0x40')](function(_0x2f4d98){_0x2f8b23[_0x2ea3('0x3e')][_0x2ea3('0x41')](_0x1e64d1[_0x2f4d98]);});}delete _0x2f8b23['TagIds'];}catch(_0x3693da){_0x2ec481(_0x3693da);}_0x405684(_0x2f8b23);});}function updateChatInteraction(_0x751a7,_0x3cd8e7,_0x4c202d){return new BPromise(function(_0x1348b9,_0x4a56ae){return getInteractionUsers(_0x751a7,_0x4c202d)[_0x2ea3('0x35')](function(_0x54fd9f){return getInteractionTags(_0x54fd9f,_0x3cd8e7);})[_0x2ea3('0x35')](function(_0x37ef57){_0x1348b9(_0x37ef57);})[_0x2ea3('0x27')](function(_0xb6e901){_0x4a56ae(_0xb6e901);});});}exports[_0x2ea3('0x42')]=function(_0x56afb1,_0xe894b){var _0x1129b9={},_0xeac806={},_0x113fbf={'count':0x0,'rows':[]};var _0x564138=_[_0x2ea3('0x43')](db[_0x2ea3('0x44')][_0x2ea3('0x45')],function(_0x29136f){return{'name':_0x29136f[_0x2ea3('0x46')],'type':_0x29136f[_0x2ea3('0x47')][_0x2ea3('0x48')]};});_0xeac806[_0x2ea3('0x49')]=_[_0x2ea3('0x43')](_0x564138,_0x2ea3('0x37'));_0xeac806['query']=_[_0x2ea3('0x4a')](_0x56afb1[_0x2ea3('0x4b')]);_0xeac806[_0x2ea3('0x4c')]=_['intersection'](_0xeac806[_0x2ea3('0x49')],_0xeac806[_0x2ea3('0x4b')]);_0x1129b9['attributes']=_['intersection'](_0xeac806[_0x2ea3('0x49')],qs[_0x2ea3('0x4d')](_0x56afb1['query']['fields']));_0x1129b9[_0x2ea3('0x4e')]=_0x1129b9['attributes'][_0x2ea3('0x4f')]?_0x1129b9[_0x2ea3('0x4e')]:_0xeac806[_0x2ea3('0x49')];if(!_0x56afb1[_0x2ea3('0x4b')]['hasOwnProperty'](_0x2ea3('0x50'))){_0x1129b9[_0x2ea3('0x2c')]=qs['limit'](_0x56afb1[_0x2ea3('0x4b')][_0x2ea3('0x2c')]);_0x1129b9['offset']=qs['offset'](_0x56afb1[_0x2ea3('0x4b')][_0x2ea3('0x2b')]);}_0x1129b9[_0x2ea3('0x51')]=qs[_0x2ea3('0x52')](_0x56afb1[_0x2ea3('0x4b')]['sort']);_0x1129b9[_0x2ea3('0x53')]=qs[_0x2ea3('0x4c')](_[_0x2ea3('0x54')](_0x56afb1[_0x2ea3('0x4b')],_0xeac806[_0x2ea3('0x4c')]),_0x564138);var _0x3a0ae0=[];var _0x39ab3e=squel[_0x2ea3('0x55')]()[_0x2ea3('0x56')]('id')['field'](_0x2ea3('0x37'))[_0x2ea3('0x56')](_0x2ea3('0x57'))[_0x2ea3('0x58')](_0x2ea3('0x59'));var _0x25228f=squel[_0x2ea3('0x55')]()[_0x2ea3('0x56')](_0x2ea3('0x5a'))[_0x2ea3('0x56')]('u.fullname')[_0x2ea3('0x56')](_0x2ea3('0x5b'))[_0x2ea3('0x58')](_0x2ea3('0x5c'),'ui')[_0x2ea3('0x5d')]('users','u',_0x2ea3('0x5e'));var _0x38d84f=squel[_0x2ea3('0x55')]()[_0x2ea3('0x58')](_0x2ea3('0x5f'),'i')[_0x2ea3('0x5d')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x2ea3('0x5d')]('users','o',_0x2ea3('0x60'))[_0x2ea3('0x5d')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')[_0x2ea3('0x5d')](_0x2ea3('0x61'),'me',_0x2ea3('0x62'))[_0x2ea3('0x5d')](_0x2ea3('0x63'),'it',_0x2ea3('0x64'))[_0x2ea3('0x5d')](_0x2ea3('0x59'),'t',_0x2ea3('0x65'));var _0x1a2a96=squel[_0x2ea3('0x66')]();var _0x1f5c97=[];var _0x28c6fd=squel[_0x2ea3('0x66')]();var _0x2dda02;if(_0x56afb1[_0x2ea3('0x4b')][_0x2ea3('0x67')]){_0x2dda02=as[_0x2ea3('0x68')](_0x56afb1['query'][_0x2ea3('0x67')]);var _0x2ffe7a=_0x2dda02[_0x2ea3('0x69')];for(var _0x3cf8f9=0x0;_0x3cf8f9<_0x2dda02['conditions'][_0x2ea3('0x4f')];_0x3cf8f9++){var _0x1d6171=_0x2dda02[_0x2ea3('0x6a')][_0x3cf8f9];var _0xac87bc='i';var _0x332f27=_[_0x2ea3('0x6b')](_0x564138,['name',_0x1d6171[_0x2ea3('0x56')]]);if(!_0x332f27){switch(_0x1d6171[_0x2ea3('0x56')]){case _0x2ea3('0x6c'):if(_0x1d6171[_0x2ea3('0x6d')]==0x1){_0x38d84f[_0x2ea3('0x6e')]('`'+_0x1d6171[_0x2ea3('0x56')]+_0x2ea3('0x6f'));}else{_0x38d84f[_0x2ea3('0x6e')]('`'+_0x1d6171[_0x2ea3('0x56')]+_0x2ea3('0x70'));}break;case'Contact':if(_0x1d6171[_0x2ea3('0x71')]===_0x2ea3('0x72')){if(_0x1d6171[_0x2ea3('0x6d')][_0x2ea3('0x3f')]('\x20')[_0x2ea3('0x4f')]>0x1){_0x1a2a96[_0x2ffe7a](_0x2ea3('0x73'),qs['getFullTextValue'](_0x1d6171[_0x2ea3('0x6d')]),null);}else{var _0x36faa1='%'+_0x1d6171[_0x2ea3('0x6d')]+'%';_0x1a2a96[_0x2ffe7a](_0x2ea3('0x74'),_0x36faa1,_0x36faa1,_0x36faa1);}}else{_0x332f27=_['find'](_0x564138,['name',_0x2ea3('0x75')]);_0x1d6171[_0x2ea3('0x56')]='ContactId';_0x344137=as['buildExpression'](_0xac87bc,_0x332f27[_0x2ea3('0x47')],_0x1d6171);_0x1a2a96[_0x2ffe7a](_0x344137['text'],_0x344137['value']['start'],_0x344137['value'][_0x2ea3('0x28')]);}break;case'Tag':var _0x1a5256=_0x1d6171['value']['split'](',')[_0x2ea3('0x43')](function(_0x41effb){return Number(_0x41effb);});_0x1a5256['forEach'](function(_0x1e181f){_0x28c6fd['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1e181f+',%');});_0x1f5c97=_[_0x2ea3('0x76')](_0x1f5c97,_0x1a5256);break;case _0x2ea3('0x77'):if(_0x1d6171[_0x2ea3('0x71')]===_0x2ea3('0x72')){_0x1a2a96[_0x2ffe7a](_0x2ea3('0x78'),'%'+_0x1d6171[_0x2ea3('0x6d')]+'%',null);}else{_0x332f27=_[_0x2ea3('0x6b')](_0x564138,[_0x2ea3('0x37'),'UserId']);_0x1d6171[_0x2ea3('0x56')]=_0x2ea3('0x79');_0x344137=as['buildExpression'](_0xac87bc,_0x332f27[_0x2ea3('0x47')],_0x1d6171);_0x1a2a96[_0x2ffe7a](_0x344137[_0x2ea3('0x7a')],_0x344137[_0x2ea3('0x6d')]['start'],_0x344137[_0x2ea3('0x6d')][_0x2ea3('0x28')]);}break;case _0x2ea3('0x39'):_0x344137=as[_0x2ea3('0x7b')]('me',null,_0x1d6171);_0x1a2a96[_0x2ffe7a](_0x344137[_0x2ea3('0x7a')],_0x344137['value'][_0x2ea3('0x7c')],_0x344137['value'][_0x2ea3('0x28')]);break;}}else{var _0x344137=as['buildExpression'](_0xac87bc,_0x332f27[_0x2ea3('0x47')],_0x1d6171);_0x1a2a96[_0x2ffe7a](_0x344137[_0x2ea3('0x7a')],_0x344137[_0x2ea3('0x6d')][_0x2ea3('0x7c')],_0x344137[_0x2ea3('0x6d')][_0x2ea3('0x28')]);}}}else{var _0x32ce87=_(_0x56afb1[_0x2ea3('0x4b')])[_0x2ea3('0x4a')]()[_0x2ea3('0x43')](function(_0x524078){return _[_0x2ea3('0x7d')](_0x564138,[_0x2ea3('0x37'),_0x524078])?_0x524078:undefined;})['compact']()[_0x2ea3('0x6d')]();if(!_[_0x2ea3('0x7e')](_0x32ce87)){_0x32ce87[_0x2ea3('0x40')](function(_0x6f266d){if(_0x6f266d==='ChatWebsiteId'){_0x38d84f[_0x2ea3('0x53')](_0x2ea3('0x7f'),[][_0x2ea3('0x80')](_0x56afb1[_0x2ea3('0x4b')][_0x6f266d]));}else if(_0x6f266d===_0x2ea3('0x81')){var _0x2f1493=JSON[_0x2ea3('0x82')](_0x56afb1[_0x2ea3('0x4b')][_0x6f266d])[_0x2ea3('0x83')];var _0x1c8f1e=JSON[_0x2ea3('0x82')](_0x56afb1[_0x2ea3('0x4b')][_0x6f266d])[_0x2ea3('0x84')];_0x38d84f[_0x2ea3('0x53')](_0x2ea3('0x85'),_0x2f1493,_0x1c8f1e);}else{if(_0x56afb1[_0x2ea3('0x4b')][_0x6f266d]===_0x2ea3('0x86')){_0x38d84f[_0x2ea3('0x53')]('i.'+_0x6f266d+_0x2ea3('0x87'));}else{_0x38d84f['where']('i.'+_0x6f266d+_0x2ea3('0x88'),_0x56afb1[_0x2ea3('0x4b')][_0x6f266d]);}}});}if(_0x56afb1[_0x2ea3('0x4b')][_0x2ea3('0x89')]){if(_0x56afb1[_0x2ea3('0x4b')]['read']==0x1){_0x38d84f[_0x2ea3('0x6e')](_0x2ea3('0x8a'));}else{_0x38d84f[_0x2ea3('0x6e')](_0x2ea3('0x8b'));}}if(_0x56afb1[_0x2ea3('0x4b')][_0x2ea3('0x8c')]){_0x1f5c97=_[_0x2ea3('0x8d')](_0x56afb1[_0x2ea3('0x4b')][_0x2ea3('0x8c')])?_0x56afb1[_0x2ea3('0x4b')][_0x2ea3('0x8c')]:new Array(_0x56afb1[_0x2ea3('0x4b')][_0x2ea3('0x8c')]);_0x1f5c97[_0x2ea3('0x40')](function(_0x11d55f){_0x28c6fd['or'](_0x2ea3('0x8e'),'%,'+_0x11d55f+',%');});}if(_0x56afb1['query'][_0x2ea3('0x8f')]){var _0x19489f=_0x56afb1[_0x2ea3('0x4b')]['filter'][_0x2ea3('0x90')]('\x5c','\x5c\x5c')[_0x2ea3('0x90')](/'/g,'\x27\x27');if(qs[_0x2ea3('0x91')](_0x19489f)){_0x1a2a96['or'](_0x2ea3('0x92'),_0x19489f+'%');}else{_0x1a2a96['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x19489f))['or'](_0x2ea3('0x93'),_0x19489f+'%');}}}_0x38d84f[_0x2ea3('0x53')](_0x1a2a96);_0x38d84f[_0x2ea3('0x94')](_0x2ea3('0x95'));var _0x57188b={'type':db[_0x2ea3('0x96')][_0x2ea3('0x97')][_0x2ea3('0x98')],'raw':!![]};var _0x599acf=_0x38d84f['clone']();_0x599acf['field'](_0x2ea3('0x95'));_0x599acf['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2ea3('0x6c'));if(_0x1129b9['order']){_0x1129b9[_0x2ea3('0x51')][_0x2ea3('0x40')](function(_0x31237a){var _0x3fffcf=_0x31237a[0x0]===_0x2ea3('0x99')?_0x31237a[0x0]:'i.'+_0x31237a[0x0];_0x38d84f[_0x2ea3('0x51')](_0x3fffcf,_0x31237a[0x1]===_0x2ea3('0x9a')?![]:!![]);});}if(!_['isEmpty'](_0x1f5c97)){_0x38d84f[_0x2ea3('0x6e')](_0x28c6fd);_0x599acf[_0x2ea3('0x53')](_0x2ea3('0x9b'),_0x1f5c97);}BPromise[_0x2ea3('0x9c')]()[_0x2ea3('0x35')](function(){if(!_0x2dda02){if(_0x56afb1[_0x2ea3('0x4b')][_0x2ea3('0x9d')])return;_0x599acf['where'](_0x2ea3('0x9e'));_0x38d84f[_0x2ea3('0x53')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x56afb1['user'][_0x2ea3('0x9f')]!=='agent')return;return _0x56afb1[_0x2ea3('0xa0')][_0x2ea3('0xa1')]({'attributes':['id'],'raw':!![]})[_0x2ea3('0x35')](function(_0x3af208){if(_[_0x2ea3('0x7e')](_0x3af208)){_0x599acf[_0x2ea3('0x53')](_0x2ea3('0xa2'));_0x38d84f[_0x2ea3('0x53')](_0x2ea3('0xa2'));}else{_0x599acf[_0x2ea3('0x53')]('i.ChatWebsiteId\x20IN\x20?',_[_0x2ea3('0x43')](_0x3af208,'id'));_0x38d84f[_0x2ea3('0x53')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x3af208,'id'));}});})[_0x2ea3('0x35')](function(){if(_0x56afb1[_0x2ea3('0xa0')][_0x2ea3('0x9f')]==='agent'&&!_0x2dda02&&!_0x56afb1[_0x2ea3('0x4b')][_0x2ea3('0x9d')])return[];return db[_0x2ea3('0xa3')][_0x2ea3('0x4b')](_0x599acf[_0x2ea3('0xa4')](),_0x57188b);})[_0x2ea3('0x35')](function(_0x37d34c){_0x113fbf[_0x2ea3('0x2e')]=_0x37d34c['length'];if(_0x113fbf[_0x2ea3('0x2e')]===0x0)return[];return db[_0x2ea3('0xa3')]['query'](_0x39ab3e['toString'](),_0x57188b)[_0x2ea3('0x35')](function(_0x55250b){_0x3a0ae0=_[_0x2ea3('0xa5')](_0x55250b,'id');_0x57188b=_['merge'](_0x57188b,{'model':db[_0x2ea3('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x56afb1[_0x2ea3('0x4b')][_0x2ea3('0x4d')]){_0x1129b9[_0x2ea3('0x4e')][_0x2ea3('0x40')](function(_0x504435){_0x38d84f[_0x2ea3('0x56')]('i.'+_0x504435);});}else{_0x38d84f[_0x2ea3('0x56')](_0x2ea3('0xa6'),_0x2ea3('0x6c'));_0x38d84f[_0x2ea3('0x56')](_0x2ea3('0xa7'),_0x2ea3('0xa8'));_0x38d84f[_0x2ea3('0x56')](_0x2ea3('0xa9'),_0x2ea3('0xaa'));_0x38d84f[_0x2ea3('0x56')]('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',_0x2ea3('0x99'));_0x38d84f[_0x2ea3('0x56')](_0x2ea3('0xab'));_0x38d84f['field']('c.firstName',_0x2ea3('0xac'));_0x38d84f[_0x2ea3('0x56')](_0x2ea3('0xad'),'Contact.lastName');_0x38d84f[_0x2ea3('0x56')](_0x2ea3('0xae'),_0x2ea3('0xaf'));_0x38d84f[_0x2ea3('0x56')](_0x2ea3('0xb0'),_0x2ea3('0xb1'));_0x38d84f[_0x2ea3('0x56')](_0x2ea3('0xb2'),'Contact.mobile');_0x38d84f[_0x2ea3('0x56')](_0x2ea3('0xb3'),_0x2ea3('0xb4'));_0x38d84f[_0x2ea3('0x56')](_0x2ea3('0xb5'),'Owner.fullname');_0x38d84f[_0x2ea3('0x56')](_0x2ea3('0xb6'),_0x2ea3('0xb7'));_0x38d84f[_0x2ea3('0x56')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2ea3('0x3d'));}if(_0x1129b9[_0x2ea3('0x2c')])_0x38d84f[_0x2ea3('0x2c')](_0x1129b9[_0x2ea3('0x2c')]);if(_0x1129b9[_0x2ea3('0x2b')])_0x38d84f[_0x2ea3('0x2b')](_0x1129b9[_0x2ea3('0x2b')]);return db['sequelize'][_0x2ea3('0x4b')](_0x38d84f[_0x2ea3('0xa4')](),_0x57188b);})[_0x2ea3('0x35')](function(_0x1d40f5){if(_0x1d40f5[_0x2ea3('0x4f')]>0x0)_0x25228f[_0x2ea3('0x53')]('ui.ChatInteractionId\x20IN\x20?',_[_0x2ea3('0x43')](_0x1d40f5,'id'));return db[_0x2ea3('0xa3')][_0x2ea3('0x4b')](_0x25228f[_0x2ea3('0xa4')](),_0x57188b)['then'](function(_0xd4970b){var _0x5bc24f=_[_0x2ea3('0xb8')](_0xd4970b,_0x2ea3('0xb9'));var _0x19a28f=[];_0x1d40f5[_0x2ea3('0x40')](function(_0x3ba91b){_0x19a28f[_0x2ea3('0x41')](updateChatInteraction(_0x3ba91b,_0x3a0ae0,_0x5bc24f));});return BPromise[_0x2ea3('0xba')](_0x19a28f);});});})[_0x2ea3('0x35')](function(_0x17c997){_0x113fbf[_0x2ea3('0xbb')]=_0x17c997;return _0x113fbf;})[_0x2ea3('0x35')](respondWithFilteredResult(_0xe894b,_0x1129b9))[_0x2ea3('0x27')](handleError(_0xe894b,null));};exports['show']=function(_0x19806e,_0x29e76c){var _0x1c5ae6={'raw':![],'where':{'id':_0x19806e[_0x2ea3('0xbc')]['id']}},_0x306593={};_0x306593[_0x2ea3('0x49')]=_['keys'](db[_0x2ea3('0x44')][_0x2ea3('0x45')]);_0x306593[_0x2ea3('0x4b')]=_[_0x2ea3('0x4a')](_0x19806e['query']);_0x306593[_0x2ea3('0x4c')]=_[_0x2ea3('0xbd')](_0x306593['model'],_0x306593['query']);_0x1c5ae6[_0x2ea3('0x4e')]=_['intersection'](_0x306593[_0x2ea3('0x49')],qs[_0x2ea3('0x4d')](_0x19806e[_0x2ea3('0x4b')][_0x2ea3('0x4d')]));_0x1c5ae6[_0x2ea3('0x4e')]=_0x1c5ae6['attributes'][_0x2ea3('0x4f')]?_0x1c5ae6[_0x2ea3('0x4e')]:_0x306593[_0x2ea3('0x49')];if(_0x19806e[_0x2ea3('0x4b')][_0x2ea3('0xbe')]){_0x1c5ae6[_0x2ea3('0xbf')]=[{'all':!![]}];}_0x1c5ae6=_['merge']({},_0x1c5ae6,_0x19806e['options']);return db[_0x2ea3('0x44')]['find'](_0x1c5ae6)['then'](handleEntityNotFound(_0x29e76c,null))[_0x2ea3('0x35')](respondWithResult(_0x29e76c,null))[_0x2ea3('0x27')](handleError(_0x29e76c,null));};exports[_0x2ea3('0xc0')]=function(_0x1a3329,_0x38f9b8){return db['ChatInteraction'][_0x2ea3('0xc0')](_0x1a3329[_0x2ea3('0x39')],{})[_0x2ea3('0x35')](respondWithResult(_0x38f9b8,0xc9))[_0x2ea3('0x27')](handleError(_0x38f9b8,null));};exports[_0x2ea3('0x34')]=function(_0xbfad59,_0x21606b){if(_0xbfad59[_0x2ea3('0x39')]['id']){delete _0xbfad59['body']['id'];}return db['ChatInteraction'][_0x2ea3('0x6b')]({'where':{'id':_0xbfad59[_0x2ea3('0xbc')]['id']}})[_0x2ea3('0x35')](handleEntityNotFound(_0x21606b,null))[_0x2ea3('0x35')](saveUpdates(_0xbfad59[_0x2ea3('0x39')],null))[_0x2ea3('0x35')](respondWithResult(_0x21606b,null))[_0x2ea3('0x27')](handleError(_0x21606b,null));};exports['destroy']=function(_0x2671bc,_0x3fe3ad){return db[_0x2ea3('0x44')]['find']({'where':{'id':_0x2671bc['params']['id']}})['then'](handleEntityNotFound(_0x3fe3ad,null))[_0x2ea3('0x35')](removeEntity(_0x3fe3ad,null))[_0x2ea3('0x27')](handleError(_0x3fe3ad,null));};exports[_0x2ea3('0xc1')]=function(_0x2137a3,_0x13eb2c){return db[_0x2ea3('0x44')][_0x2ea3('0xc1')]()[_0x2ea3('0x35')](respondWithResult(_0x13eb2c,null))[_0x2ea3('0x27')](handleError(_0x13eb2c,null));};exports[_0x2ea3('0xc2')]=function(_0x226368,_0x1e8c86){var _0x5dba72=_0x226368[_0x2ea3('0xbc')]['id'];var _0xa2e0bb;var _0x4938f9;var _0x4aaa8a;return db['ChatInteraction'][_0x2ea3('0xc3')]({'where':{'id':_0x5dba72}})[_0x2ea3('0x35')](function(_0x28673c){_0xa2e0bb=_0x28673c;return db['ChatWebsite'][_0x2ea3('0xc3')]({'where':{'id':_0x28673c[_0x2ea3('0x9d')]},'attributes':['id',_0x2ea3('0xc4'),_0x2ea3('0xc5'),_0x2ea3('0xc6'),_0x2ea3('0xc7'),_0x2ea3('0xc8')],'raw':!![]});})[_0x2ea3('0x35')](function(_0x2ea658){if(_0x2ea658&&_0x2ea658[_0x2ea3('0xc4')]&&_0x2ea658['vidaooEscalation']){_0x4938f9=_0x2ea658;var _0x1d4939={'interaction':{'id':_0x5dba72},'agent':{'id':_0x226368['user']['id'],'name':_0x226368['user'][_0x2ea3('0x37')],'fullname':_0x226368['user'][_0x2ea3('0xc9')],'email':_0x226368['user'][_0x2ea3('0xca')]},'contact':_0x226368[_0x2ea3('0x39')][_0x2ea3('0xcb')],'account':_0x226368[_0x2ea3('0x39')][_0x2ea3('0xcc')]};var _0xc600b={'rejectUnauthorized':![],'method':_0x2ea3('0xcd'),'url':_0x2ea3('0xce'),'headers':{'X-APIKEY':_0x2ea658[_0x2ea3('0xc4')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x226368[_0x2ea3('0xa0')][_0x2ea3('0xca')]],'buttons':null,'topic':_0x4938f9[_0x2ea3('0xc6')],'note':_[_0x2ea3('0xcf')](_0x4938f9[_0x2ea3('0xc7')])?null:getMustacheRender(_0x4938f9['vidaooNote'],_0x1d4939),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x2ea3('0xcf')](_0x4938f9[_0x2ea3('0xc8')])){var _0x43255c=getMustacheRender(_0x4938f9[_0x2ea3('0xc8')],_0x1d4939);var _0x3c1875=JSON[_0x2ea3('0x82')](_0x43255c);_0xc600b[_0x2ea3('0x39')][_0x2ea3('0xd0')]=_0x3c1875;}}catch(_0x399e02){throw new db[(_0x2ea3('0x96'))][(_0x2ea3('0xd1'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0xc600b);}else{throw new db[(_0x2ea3('0x96'))]['ValidationError'](_0x2ea3('0xd2'));}})[_0x2ea3('0x35')](function(_0x4dddde){_0x4aaa8a=_0x4dddde;if(_0x4aaa8a['id']){var _0x4d6134={'body':_0x4aaa8a[_0x2ea3('0xd3')],'ChatWebsiteId':_0x4938f9['id'],'ChatInteractionId':_0xa2e0bb['id'],'direction':_0x2ea3('0xd4'),'UserId':_0x226368[_0x2ea3('0xa0')]['id']};return db[_0x2ea3('0xd5')][_0x2ea3('0xc0')](_0x4d6134,{});}else{throw new db[(_0x2ea3('0x96'))][(_0x2ea3('0xd1'))](_0x2ea3('0xd6'));}})[_0x2ea3('0x35')](function(){return _0xa2e0bb['updateAttributes']({'vidaooSessionId':_0x4aaa8a['id']});})[_0x2ea3('0x35')](respondWithResult(_0x1e8c86,null))[_0x2ea3('0x27')](handleError(_0x1e8c86,null));};exports['customUpdate']=function(_0x254c4a,_0x3d4cd0){if(_0x254c4a[_0x2ea3('0x39')]['id']){delete _0x254c4a['body']['id'];}return db[_0x2ea3('0x44')]['find']({'where':{'id':_0x254c4a[_0x2ea3('0xbc')]['id']},'include':[{'model':db[_0x2ea3('0xd7')],'as':_0x2ea3('0xd8')}]})[_0x2ea3('0x35')](handleEntityNotFound(_0x3d4cd0,null))[_0x2ea3('0x35')](saveUpdates(_0x254c4a[_0x2ea3('0x39')],null))[_0x2ea3('0x35')](respondWithResult(_0x3d4cd0,null))[_0x2ea3('0x27')](handleError(_0x3d4cd0,null));};exports[_0x2ea3('0xd9')]=function(_0x17706a,_0x450193,_0x2ecfd2){if(_0x17706a[_0x2ea3('0x39')]['id']){delete _0x17706a[_0x2ea3('0x39')]['id'];}return db[_0x2ea3('0x44')][_0x2ea3('0x6b')]({'where':{'id':_0x17706a[_0x2ea3('0xbc')]['id']}})[_0x2ea3('0x35')](function(_0xbc7bb0){if(!_0xbc7bb0){logger[_0x2ea3('0x24')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x2ea3('0xda'));_0x450193[_0x2ea3('0xdb')](0x194);}else{if(_0xbc7bb0[_0x2ea3('0x79')]){throw new db[(_0x2ea3('0x96'))][(_0x2ea3('0xd1'))](_0x2ea3('0xdc'));}}return _0xbc7bb0;})[_0x2ea3('0x35')](function(_0x46e8bb){if(_0x46e8bb){return _0x46e8bb[_0x2ea3('0x34')]({'closed':_0x17706a[_0x2ea3('0x39')][_0x2ea3('0xdd')],'disposition':_0x17706a[_0x2ea3('0x39')][_0x2ea3('0xde')]})[_0x2ea3('0x35')](function(_0x29be9b){return _0x29be9b;});}})[_0x2ea3('0x35')](function(_0x45868f){return respondWithRpcPromise(_0x2ea3('0xdf'),_0x2ea3('0xd9'),_0x17706a[_0x2ea3('0x39')],client9004);})[_0x2ea3('0x35')](respondWithResult(_0x450193,null))['catch'](handleError(_0x450193,null));};exports[_0x2ea3('0xe0')]=function(_0x3d6e45,_0x3475c6,_0x4d267f){_0x3d6e45['body'][_0x2ea3('0x37')]=_0x3d6e45[_0x2ea3('0xe1')][_0x2ea3('0xe2')];_0x3d6e45[_0x2ea3('0x39')][_0x2ea3('0xe3')]=_0x3d6e45[_0x2ea3('0xe1')][_0x2ea3('0xe4')];_0x3d6e45[_0x2ea3('0x39')][_0x2ea3('0x47')]=_0x3d6e45['file'][_0x2ea3('0xe5')];return db[_0x2ea3('0xe6')]['create'](_0x3d6e45[_0x2ea3('0x39')])[_0x2ea3('0x35')](respondWithResult(_0x3475c6,0xc9))[_0x2ea3('0x27')](handleError(_0x3475c6,null));};exports['attachmentDownload']=function(_0x3f8289,_0xbb7f82,_0x3ee20c){return db['ChatInteraction']['findOne']({'where':{'id':_0x3f8289[_0x2ea3('0xbc')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0xbb7f82,null))[_0x2ea3('0x35')](function(_0x48a46){if(_0x48a46){if(_0x48a46[_0x2ea3('0xdd')]){return _0xbb7f82[_0x2ea3('0x29')](0x193)[_0x2ea3('0x2a')]({'status':0x193,'message':_0x2ea3('0xe7')});}return db['Attachment']['findOne']({'where':{'id':_0x3f8289['query'][_0x2ea3('0xe8')]},'raw':!![]})['then'](handleEntityNotFound(_0xbb7f82,null));}})[_0x2ea3('0x35')](function(_0x3b35ce){if(_0x3b35ce){var _0x24e46b=_0x3b35ce[_0x2ea3('0xe9')]!==null;var _0x38f351=path[_0x2ea3('0xea')](config[_0x2ea3('0xeb')],_0x2ea3('0xec'));if(_0x24e46b){_0x38f351=path[_0x2ea3('0xea')](_0x38f351,'offline-chat/');}var _0x4cfbaf=path['join'](_0x38f351,_0x3b35ce[_0x2ea3('0xe3')]);return _0xbb7f82[_0x2ea3('0xed')](_0x4cfbaf);}})[_0x2ea3('0x27')](handleError(_0xbb7f82,null));};exports[_0x2ea3('0xee')]=function(_0x21164e,_0x28f51f){var _0x203de0=null;var _0x5908fd=null;var _0x2e50fa=null;var _0xfe7428=null;if(_0x21164e['body']['id']){delete _0x21164e['body']['id'];}if(_0x21164e[_0x2ea3('0x39')]['mailTranscript']){_0xfe7428=path[_0x2ea3('0xea')](config[_0x2ea3('0xeb')],'server/files/chat/upload/',util[_0x2ea3('0xef')](_0x2ea3('0xf0'),Date[_0x2ea3('0xf1')]()));_0x21164e[_0x2ea3('0x39')][_0x2ea3('0xf2')]=_0xfe7428;}return db['ChatInteraction'][_0x2ea3('0x6b')]({'where':{'id':_0x21164e[_0x2ea3('0xbc')]['id']},'include':[{'model':db[_0x2ea3('0xd5')],'as':_0x2ea3('0xf3'),'include':[{'model':db[_0x2ea3('0x77')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x28f51f,null))[_0x2ea3('0x35')](saveUpdates(_0x21164e[_0x2ea3('0x39')],null))[_0x2ea3('0x35')](function(_0x1c2f6d){if(_0x1c2f6d){_0x203de0=_0x1c2f6d;return db[_0x2ea3('0xf4')][_0x2ea3('0x6b')]({'where':{'id':_0x203de0[_0x2ea3('0x9d')]}});}})['then'](function(_0x549afd){if(_0x549afd){_0x2e50fa=_0x549afd;return db['CmContact'][_0x2ea3('0x6b')]({'where':{'id':_0x203de0[_0x2ea3('0x75')]}});}})[_0x2ea3('0x35')](function(_0x827a2f){if(_0x827a2f){_0x5908fd=_0x827a2f;if(_0xfe7428){var _0x3cbc5a=null;for(var _0xeeb0eb=0x1;_0xeeb0eb<_0x203de0['Messages'][_0x2ea3('0x4f')];++_0xeeb0eb){_0x3cbc5a=_0x203de0[_0x2ea3('0xf3')][_0xeeb0eb];var _0x596136=_0x3cbc5a[_0x2ea3('0x79')]?util['format']('%s%d',_0x2e50fa['agentAlias'],_0x3cbc5a[_0x2ea3('0x79')]):_0x2ea3('0xf5');var _0x51eca9=_0x21164e['body'][_0x2ea3('0xf6')]||util[_0x2ea3('0xef')](_0x2ea3('0xf7'),_0x2ea3('0xf8'),_0x3cbc5a['ContactId']);switch(_0x2e50fa[_0x2ea3('0xf9')]){case _0x2ea3('0xfa'):_0x596136=_0x3cbc5a[_0x2ea3('0x79')]?util[_0x2ea3('0xef')](_0x2ea3('0xf7'),_0x2e50fa[_0x2ea3('0xfb')],_0x3cbc5a[_0x2ea3('0x79')]):_0x2ea3('0xf5');break;case'agent_alias':_0x596136=_0x3cbc5a['UserId']?_0x3cbc5a[_0x2ea3('0x77')][_0x2ea3('0xfc')]||_0x3cbc5a['User'][_0x2ea3('0xc9')]:'System';break;case'agent_fullname':_0x596136=_0x3cbc5a[_0x2ea3('0x79')]?_0x3cbc5a[_0x2ea3('0x77')][_0x2ea3('0xc9')]:_0x2ea3('0xf5');break;default:_0x596136=_0x3cbc5a[_0x2ea3('0x79')]?util[_0x2ea3('0xef')](_0x2ea3('0xf7'),_0x2e50fa[_0x2ea3('0xfb')],_0x3cbc5a[_0x2ea3('0x79')]):_0x2ea3('0xf5');}var _0xb2c262=util[_0x2ea3('0xef')](_0x2ea3('0xfd'),moment(_0x3cbc5a[_0x2ea3('0x81')])[_0x2ea3('0xef')](_0x2ea3('0xfe')),_0x3cbc5a[_0x2ea3('0xff')]==='in'?_0x51eca9:_0x596136,_0x3cbc5a['body']);if(!_0x3cbc5a[_0x2ea3('0x100')]){fs[_0x2ea3('0x101')](_0xfe7428,_0xb2c262);}}return db[_0x2ea3('0x102')][_0x2ea3('0xc3')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x2ea3('0x103'),'raw':!![]}]});}}})[_0x2ea3('0x35')](function(_0x55bfa0){if(_0x55bfa0&&_0x55bfa0[_0x2ea3('0x103')]&&_0x21164e[_0x2ea3('0x39')]){var _0x355245={'tls':{'rejectUnauthorized':![]}};if(_0x55bfa0[_0x2ea3('0x103')][_0x2ea3('0x104')]){_0x355245['service']=_0x55bfa0[_0x2ea3('0x103')][_0x2ea3('0x104')];}else{_0x355245[_0x2ea3('0x105')]=_0x55bfa0['Smtp'][_0x2ea3('0x105')];_0x355245[_0x2ea3('0x106')]=_0x55bfa0[_0x2ea3('0x103')][_0x2ea3('0x106')];_0x355245[_0x2ea3('0x107')]=_0x55bfa0[_0x2ea3('0x103')]['secure'];}if(_0x55bfa0[_0x2ea3('0x103')][_0x2ea3('0x108')]){_0x355245['auth']={'user':_0x55bfa0[_0x2ea3('0x103')][_0x2ea3('0xa0')],'pass':_0x55bfa0['Smtp'][_0x2ea3('0x109')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x355245,'message':{'from':util[_0x2ea3('0xef')](_0x2ea3('0x10a'),_0x55bfa0[_0x2ea3('0x37')],_0x55bfa0[_0x2ea3('0xca')]||_0x55bfa0['Smtp'][_0x2ea3('0xa0')]),'to':_0x21164e[_0x2ea3('0x39')][_0x2ea3('0x10b')],'subject':_0x2ea3('0x10c'),'text':util[_0x2ea3('0xef')](_0x2ea3('0x10d'),_0x21164e[_0x2ea3('0x39')]['mailTranscript']),'attachments':[{'path':_0xfe7428}]}})['then'](function(){return _0x203de0;})['catch'](function(_0x2e983a){console[_0x2ea3('0x24')](_0x2e983a);});}else{return _0x203de0;}})[_0x2ea3('0x35')](respondWithStatusCode(_0x28f51f,0xc8))[_0x2ea3('0x27')](handleError(_0x28f51f,null));};exports[_0x2ea3('0x10e')]=function(_0x1789c1,_0x2f80ab,_0x150e42){return db['ChatMessage'][_0x2ea3('0x6b')]({'where':{'id':_0x1789c1[_0x2ea3('0xbc')]['id']}})[_0x2ea3('0x35')](handleEntityNotFound(_0x2f80ab,null))[_0x2ea3('0x35')](function(_0x271b97){if(_0x271b97){return _0x271b97[_0x2ea3('0x10e')](_0x1789c1[_0x2ea3('0x39')][_0x2ea3('0x10f')],_['omit'](_0x1789c1[_0x2ea3('0x39')],[_0x2ea3('0x10f'),'id'])||{});}})[_0x2ea3('0x35')](respondWithResult(_0x2f80ab,null))[_0x2ea3('0x27')](handleError(_0x2f80ab,null));};exports['getMessages']=function(_0x254cef,_0x1e572e,_0x2de6b4){var _0x5e6eab={'raw':![],'where':{}};var _0xb433b={};var _0x7d143e={'count':0x0,'rows':[]};return db[_0x2ea3('0x44')][_0x2ea3('0xc3')]({'where':{'id':_0x254cef['params']['id']}})[_0x2ea3('0x35')](handleEntityNotFound(_0x1e572e,null))[_0x2ea3('0x35')](function(_0x2525db){if(_0x2525db){_0xb433b['model']=_[_0x2ea3('0x4a')](db[_0x2ea3('0xd5')][_0x2ea3('0x45')]);_0xb433b['query']=_[_0x2ea3('0x4a')](_0x254cef['query']);_0xb433b[_0x2ea3('0x4c')]=_[_0x2ea3('0xbd')](_0xb433b[_0x2ea3('0x49')],_0xb433b[_0x2ea3('0x4b')]);_0x5e6eab[_0x2ea3('0x4e')]=_[_0x2ea3('0xbd')](_0xb433b[_0x2ea3('0x49')],qs[_0x2ea3('0x4d')](_0x254cef[_0x2ea3('0x4b')][_0x2ea3('0x4d')]));_0x5e6eab[_0x2ea3('0x4e')]=_0x5e6eab['attributes'][_0x2ea3('0x4f')]?_0x5e6eab[_0x2ea3('0x4e')]:_0xb433b[_0x2ea3('0x49')];if(!_0x254cef['query']['hasOwnProperty'](_0x2ea3('0x50'))){_0x5e6eab[_0x2ea3('0x2c')]=qs[_0x2ea3('0x2c')](_0x254cef[_0x2ea3('0x4b')]['limit']);_0x5e6eab[_0x2ea3('0x2b')]=qs['offset'](_0x254cef['query'][_0x2ea3('0x2b')]);}_0x5e6eab['order']=qs[_0x2ea3('0x52')](_0x254cef[_0x2ea3('0x4b')][_0x2ea3('0x52')]);_0x5e6eab[_0x2ea3('0x53')]=qs[_0x2ea3('0x4c')](_[_0x2ea3('0x54')](_0x254cef['query'],_0xb433b[_0x2ea3('0x4c')]));_0x5e6eab[_0x2ea3('0x53')][_0x2ea3('0xb9')]=_0x2525db['id'];if(_0x254cef['query']['filter']){_0x5e6eab['where']=_[_0x2ea3('0x110')](_0x5e6eab[_0x2ea3('0x53')],{'$or':_['map'](_0x5e6eab['attributes'],function(_0x2d9986){var _0x311433={};_0x311433[_0x2d9986]={'$like':'%'+_0x254cef['query'][_0x2ea3('0x8f')]+'%'};return _0x311433;})});}if(_0x254cef['query'][_0x2ea3('0x83')]){var _0x224ca8=_0x254cef[_0x2ea3('0x4b')]['$gte'][_0x2ea3('0x3f')](',');var _0x51cb7b={};_0x51cb7b[_0x224ca8[0x0]]={'$gte':moment(_0x224ca8[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x5e6eab[_0x2ea3('0x53')]=_[_0x2ea3('0x110')](_0x5e6eab['where'],_0x51cb7b);}_0x5e6eab=_[_0x2ea3('0x110')]({},_0x5e6eab,_0x254cef['options']);return db[_0x2ea3('0xd5')]['count']({'where':_0x5e6eab['where']})[_0x2ea3('0x35')](function(_0x3ab36a){_0x7d143e['count']=_0x3ab36a;if(_0x254cef[_0x2ea3('0x4b')]['includeAll']){_0x5e6eab[_0x2ea3('0xbf')]=[{'all':!![]}];}return db[_0x2ea3('0xd5')][_0x2ea3('0x111')](_0x5e6eab);})['then'](function(_0x5aa021){_0x7d143e[_0x2ea3('0xbb')]=_0x5aa021;return _0x7d143e;});}})[_0x2ea3('0x35')](respondWithFilteredResult(_0x1e572e,_0x5e6eab))['catch'](handleError(_0x1e572e,null));};exports[_0x2ea3('0x112')]=function(_0x18263b,_0x6ec213,_0x5ea393){var _0x585e88={'where':{}},_0x1604d9={},_0x5da056={'count':0x0,'rows':[]};return db[_0x2ea3('0x44')][_0x2ea3('0xc3')]({'where':{'id':_0x18263b['params']['id']}})[_0x2ea3('0x35')](handleEntityNotFound(_0x6ec213,null))[_0x2ea3('0x35')](function(_0x510ebd){if(_0x510ebd){_0x1604d9['model']=_['keys'](db[_0x2ea3('0xd5')][_0x2ea3('0x45')]);_0x1604d9[_0x2ea3('0x4b')]=_[_0x2ea3('0x4a')](_0x18263b['query']);_0x1604d9[_0x2ea3('0x4c')]=_[_0x2ea3('0xbd')](_0x1604d9['model'],_0x1604d9['query']);_0x585e88[_0x2ea3('0x4e')]=_[_0x2ea3('0xbd')](_0x1604d9[_0x2ea3('0x49')],qs['fields'](_0x18263b[_0x2ea3('0x4b')]['fields']));_0x585e88[_0x2ea3('0x4e')]=_0x585e88[_0x2ea3('0x4e')][_0x2ea3('0x4f')]?_0x585e88[_0x2ea3('0x4e')]:_0x1604d9[_0x2ea3('0x49')];if(!_0x18263b['query']['hasOwnProperty']('nolimit')){_0x585e88['limit']=qs[_0x2ea3('0x2c')](_0x18263b[_0x2ea3('0x4b')]['limit']);_0x585e88[_0x2ea3('0x2b')]=qs[_0x2ea3('0x2b')](_0x18263b[_0x2ea3('0x4b')][_0x2ea3('0x2b')]);}_0x585e88[_0x2ea3('0x51')]=qs[_0x2ea3('0x52')](_0x18263b[_0x2ea3('0x4b')]['sort']);_0x585e88[_0x2ea3('0x53')]=qs[_0x2ea3('0x4c')](_['pick'](_0x18263b['query'],_0x1604d9[_0x2ea3('0x4c')]));_0x585e88['where'][_0x2ea3('0xb9')]=_0x510ebd['id'];if(_0x18263b[_0x2ea3('0x4b')][_0x2ea3('0x8f')]){_0x585e88[_0x2ea3('0x53')]=_[_0x2ea3('0x110')](_0x585e88[_0x2ea3('0x53')],{'$or':_[_0x2ea3('0x43')](_0x585e88['attributes'],function(_0x358bf8){var _0x2423b1={};_0x2423b1[_0x358bf8]={'$like':'%'+_0x18263b[_0x2ea3('0x4b')][_0x2ea3('0x8f')]+'%'};return _0x2423b1;})});}_0x585e88[_0x2ea3('0x53')]['secret']=![];if(_0x18263b['query']['id']){_0x585e88[_0x2ea3('0x53')]['id']={'$gt':_0x18263b[_0x2ea3('0x4b')]['id']};}_0x585e88=_['merge']({},_0x585e88,_0x18263b['options']);return db[_0x2ea3('0xd5')][_0x2ea3('0x2e')]({'where':_0x585e88[_0x2ea3('0x53')]})[_0x2ea3('0x35')](function(_0x12b430){_0x5da056[_0x2ea3('0x2e')]=_0x12b430;_0x585e88['include']=[];if(_0x18263b['query'][_0x2ea3('0x113')]){_0x585e88[_0x2ea3('0xbf')]['push']({'model':db[_0x2ea3('0x77')],'as':'User','attributes':['id','fullname','alias']});}if(_0x18263b[_0x2ea3('0x4b')][_0x2ea3('0xbe')]){_0x585e88[_0x2ea3('0xbf')]=[{'all':!![]}];}return db['ChatMessage'][_0x2ea3('0x111')](_0x585e88);})[_0x2ea3('0x35')](function(_0x18b27c){_0x5da056[_0x2ea3('0xbb')]=_0x18b27c;return _0x5da056;});}})[_0x2ea3('0x35')](respondWithFilteredResult(_0x6ec213,_0x585e88))[_0x2ea3('0x27')](handleError(_0x6ec213,null));};exports[_0x2ea3('0x114')]=function(_0x3d3735,_0x3f83f7,_0x39b80a){return db[_0x2ea3('0x44')][_0x2ea3('0x6b')]({'where':{'id':_0x3d3735['params']['id']}})['then'](handleEntityNotFound(_0x3f83f7,null))['then'](function(_0x5b8ab6){if(_0x5b8ab6){return _0x5b8ab6[_0x2ea3('0x115')](_0x3d3735[_0x2ea3('0x39')][_0x2ea3('0x10f')],_['omit'](_0x3d3735[_0x2ea3('0x39')],[_0x2ea3('0x10f'),'id'])||{})[_0x2ea3('0x116')](function(){return db['Tag'][_0x2ea3('0x111')]({'attributes':['id',_0x2ea3('0x37'),_0x2ea3('0x57')],'where':{'id':_0x3d3735[_0x2ea3('0x39')][_0x2ea3('0x10f')]}});})['then'](function(_0x495958){socket[_0x2ea3('0x117')](_0x2ea3('0x118'),{'id':Number(_0x3d3735[_0x2ea3('0xbc')]['id']),'tags':_0x495958||[]});return{'id':Number(_0x3d3735[_0x2ea3('0xbc')]['id']),'tags':_0x495958||[]};});}})[_0x2ea3('0x35')](respondWithResult(_0x3f83f7,null))[_0x2ea3('0x27')](handleError(_0x3f83f7,null));};exports[_0x2ea3('0x119')]=function(_0x254ffc,_0x59b57c,_0x23f6a5){return db[_0x2ea3('0x44')][_0x2ea3('0x6b')]({'where':{'id':_0x254ffc[_0x2ea3('0xbc')]['id']}})[_0x2ea3('0x35')](handleEntityNotFound(_0x59b57c,null))['then'](function(_0x3ab54d){if(_0x3ab54d){return _0x3ab54d[_0x2ea3('0x119')](_0x254ffc[_0x2ea3('0x4b')][_0x2ea3('0x10f')]);}})['then'](respondWithStatusCode(_0x59b57c,null))[_0x2ea3('0x27')](handleError(_0x59b57c,null));};exports['download']=function(_0xca619d,_0x918b07){var _0x12c532=moment()[_0x2ea3('0x11a')]()[_0x2ea3('0xa4')]();var _0x171c00=path['join'](config['root'],'server',_0x2ea3('0x11b'),_0x2ea3('0x11c'));var _0x13f633=path[_0x2ea3('0xea')](config[_0x2ea3('0xeb')],'server',_0x2ea3('0x11b'),'attachments');var _0x2628e0=path[_0x2ea3('0xea')](_0x171c00,_0x12c532);var _0x3e7562=util[_0x2ea3('0xef')]('transcript-%d-%s.zip',_0xca619d[_0x2ea3('0xbc')]['id'],_0x12c532);var _0x836e=path['join'](_0x171c00,_0x3e7562);var _0x5ee7fb=[];_0x5ee7fb[_0x2ea3('0x41')]({'model':db[_0x2ea3('0x77')],'as':_0x2ea3('0x77'),'attributes':['id',_0x2ea3('0xc9')],'raw':!![]});_0x5ee7fb[_0x2ea3('0x41')]({'model':db[_0x2ea3('0xd7')],'as':'Contact','attributes':['id','firstName',_0x2ea3('0x11d')],'raw':!![]});if(_0xca619d[_0x2ea3('0x4b')][_0x2ea3('0x11e')]){_0x5ee7fb[_0x2ea3('0x41')]({'model':db['Attachment'],'as':_0x2ea3('0xe6'),'raw':!![]});}var _0x3aafa6=[{'model':db[_0x2ea3('0xd5')],'as':_0x2ea3('0xf3'),'attributes':['id','body',_0x2ea3('0x81'),_0x2ea3('0xff'),_0x2ea3('0x100'),'read'],'include':_0x5ee7fb}];_0x3aafa6['push']({'model':db[_0x2ea3('0xf4')],'as':'Account','attributes':['id',_0x2ea3('0x37')]});_0x3aafa6[_0x2ea3('0x41')]({'model':db['User'],'as':_0x2ea3('0x11f'),'attributes':['id',_0x2ea3('0xc9')]});return db[_0x2ea3('0x44')]['find']({'where':{'id':_0xca619d[_0x2ea3('0xbc')]['id']},'include':_0x3aafa6})[_0x2ea3('0x35')](handleEntityNotFound(_0x918b07,null))[_0x2ea3('0x35')](function(_0x495023){if(_0x495023){var _0x2fd439=_0x495023['get']({'plain':!![]});fs[_0x2ea3('0x120')](_0x2628e0);var _0x61e6a0={'channel':_0x2ea3('0x121'),'account':_0x2fd439[_0x2ea3('0x122')]['name'],'agent':_0x2fd439['Owner']?_0x2fd439[_0x2ea3('0x11f')][_0x2ea3('0xc9')]:_0x2ea3('0x123'),'createdAt':moment(_0x2fd439[_0x2ea3('0x81')])[_0x2ea3('0xef')](_0x2ea3('0x124'))[_0x2ea3('0xa4')](),'closedAt':_0x2fd439[_0x2ea3('0xdd')]?moment(_0x2fd439[_0x2ea3('0x125')])[_0x2ea3('0xef')](_0x2ea3('0x124'))[_0x2ea3('0xa4')]():'','disposition':_0x2fd439['disposition'],'chatInfo':{'browser':_0x2fd439[_0x2ea3('0x126')],'os':_0x2fd439[_0x2ea3('0x127')],'referer':_0x2fd439['referer'],'customerIp':_0x2fd439[_0x2ea3('0x128')],'customerPort':_0x2fd439['customerPort']?_0x2fd439[_0x2ea3('0x129')]:_0x2ea3('0x123')},'messages':_(_0x2fd439[_0x2ea3('0xf3')])[_0x2ea3('0x12a')]()[_0x2ea3('0x8f')]({'secret':![]})[_0x2ea3('0x43')](function(_0xac5afb){if(_0xac5afb[_0x2ea3('0xe6')]){var _0x7fad5e=path[_0x2ea3('0xea')](_0x13f633,_0xac5afb[_0x2ea3('0xe6')]['basename']);if(fs[_0x2ea3('0x12b')](_0x7fad5e)){fs[_0x2ea3('0x12c')](_0x7fad5e)[_0x2ea3('0x12d')](fs[_0x2ea3('0x12e')](path[_0x2ea3('0xea')](_0x2628e0,_0xac5afb[_0x2ea3('0xe6')]['basename'])));}}return{'date':moment(_0xac5afb[_0x2ea3('0x81')])[_0x2ea3('0xef')](_0x2ea3('0x124'))[_0x2ea3('0xa4')](),'sender':_0xac5afb[_0x2ea3('0xff')]==='out'?_0xac5afb['User']?_0xac5afb['User']['fullname']:_0x2ea3('0xf5'):_0xac5afb['Contact']['firstName']+(_0xac5afb[_0x2ea3('0xd8')]['lastName']?'\x20'+_0xac5afb[_0x2ea3('0xd8')][_0x2ea3('0x11d')]:''),'body':_0xac5afb[_0x2ea3('0xe6')]?_0xac5afb[_0x2ea3('0xe6')][_0x2ea3('0xe3')]:_0xac5afb[_0x2ea3('0x39')],'direction':_0xac5afb[_0x2ea3('0xff')]===_0x2ea3('0xd4')?'A':'C','secret':_0xac5afb[_0x2ea3('0x100')],'read':_0xac5afb[_0x2ea3('0x89')],'attachment':_0xac5afb[_0x2ea3('0xe6')]};})[_0x2ea3('0x6d')]()};return ejs[_0x2ea3('0x12f')](path[_0x2ea3('0xea')](config[_0x2ea3('0xeb')],_0x2ea3('0x130'),_0x2ea3('0x131'),_0x2ea3('0x132')),{'interaction':_0x61e6a0})[_0x2ea3('0x35')](function(_0x4f563d){var _0x598ebb=path[_0x2ea3('0xea')](_0x2628e0,_0x2ea3('0x133')+_0x2fd439['id']+'-'+_0x12c532+_0x2ea3('0x134'));var _0x3136a7={'path':_0x598ebb,'channel':_0x2ea3('0x121'),'interactionId':_0x2fd439['id']};return pdf[_0x2ea3('0x135')](_0x4f563d,_0x3136a7);})[_0x2ea3('0x35')](function(){return new BPromise(function(_0x570184,_0x23f4ea){zipdir(_0x2628e0,{'saveTo':_0x836e},function(_0x4f0537,_0x30a756){if(_0x4f0537)return _0x23f4ea(_0x4f0537);return _0x570184(_0x30a756);});})['then'](function(){return new BPromise(function(_0x48e309,_0x1cfa91){rimraf(_0x2628e0,function(_0x38970d){if(_0x38970d)_0x1cfa91(_0x38970d);return _0x48e309();});});})[_0x2ea3('0x35')](function(){return _0x918b07[_0x2ea3('0xed')](_0x836e,_0x3e7562,function(_0x57909f){if(_0x57909f){console['log'](_0x2ea3('0x136'),_0x57909f);}else{fs[_0x2ea3('0x137')](_0x836e);}});});});}else{return _0x918b07['sendStatus'](0xc8);}})[_0x2ea3('0x27')](handleError(_0x918b07,null));}; \ No newline at end of file +var _0xcbc7=['findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','parse','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','closed','Unauthorized','root','join','download','mailTranscript','server/files/chat/upload/','format','now','CmContact','Messages','%s%d','agentAlias','System','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','service','Smtp','host','port','secure','authentication','pass','SendMail','sendMail','Mail\x20Transcript','addMessage','ids','omit','nolimit','pick','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','addTags','setTags','chatInteractionTags:save','removeTags','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','direction','Owner','Chat','Account','N.A.','osName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','stack','name','render','merge','body','contact','agent','interaction','account','Users','map','fullname','TagIds','Tags','split','push','ChatInteraction','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','filters','select','color','tools_tags','u.id','field','ui.ChatInteractionId','left_join','users','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','order','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','rawAttributes','includeAll','include','options','create','params','destroy','createVidaooSession'];(function(_0x2f34d8,_0x164619){var _0x106898=function(_0x1f6e2f){while(--_0x1f6e2f){_0x2f34d8['push'](_0x2f34d8['shift']());}};_0x106898(++_0x164619);}(_0xcbc7,0x18f));var _0x7cbc=function(_0x182cbd,_0x3b513a){_0x182cbd=_0x182cbd-0x0;var _0x48ade4=_0xcbc7[_0x182cbd];return _0x48ade4;};'use strict';var emlformat=require(_0x7cbc('0x0'));var rimraf=require(_0x7cbc('0x1'));var zipdir=require(_0x7cbc('0x2'));var jsonpatch=require(_0x7cbc('0x3'));var rp=require(_0x7cbc('0x4'));var moment=require(_0x7cbc('0x5'));var BPromise=require(_0x7cbc('0x6'));var Mustache=require(_0x7cbc('0x7'));var util=require(_0x7cbc('0x8'));var path=require(_0x7cbc('0x9'));var sox=require(_0x7cbc('0xa'));var csv=require(_0x7cbc('0xb'));var ejs=require(_0x7cbc('0xc'));var fs=require('fs');var fs_extra=require(_0x7cbc('0xd'));var _=require(_0x7cbc('0xe'));var squel=require(_0x7cbc('0xf'));var crypto=require(_0x7cbc('0x10'));var jsforce=require(_0x7cbc('0x11'));var deskjs=require(_0x7cbc('0x12'));var toCsv=require(_0x7cbc('0xb'));var querystring=require(_0x7cbc('0x13'));var Papa=require(_0x7cbc('0x14'));var Redis=require(_0x7cbc('0x15'));var authService=require(_0x7cbc('0x16'));var qs=require(_0x7cbc('0x17'));var as=require(_0x7cbc('0x18'));var pdf=require(_0x7cbc('0x19'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cbc('0x1a'))(_0x7cbc('0x1b'));var utils=require(_0x7cbc('0x1c'));var config=require('../../config/environment');var licenseUtil=require(_0x7cbc('0x1d'));var db=require('../../mysqldb')['db'];config[_0x7cbc('0x1e')]=_[_0x7cbc('0x1f')](config[_0x7cbc('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x7cbc('0x20'))(new Redis(config[_0x7cbc('0x1e')]));require(_0x7cbc('0x21'))[_0x7cbc('0x22')](socket);var jayson=require(_0x7cbc('0x23'));var client=jayson[_0x7cbc('0x24')]['http']({'port':0x232b});var client9004=jayson['client'][_0x7cbc('0x25')]({'port':0x232c});function respondWithRpcPromise(_0x3629a0,_0x21e5bc,_0x1b0cef,_0x4b84dd){return new BPromise(function(_0x16c184,_0x227088){var _0x5e6c59=_0x4b84dd||client;return _0x5e6c59[_0x7cbc('0x26')](_0x3629a0,_0x1b0cef)['then'](function(_0x5d0bdc){logger['info'](_0x7cbc('0x27'),_0x21e5bc,_0x7cbc('0x28'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x21e5bc,_0x7cbc('0x28'),JSON[_0x7cbc('0x29')](_0x5d0bdc));if(_0x5d0bdc[_0x7cbc('0x2a')]){if(_0x5d0bdc[_0x7cbc('0x2a')][_0x7cbc('0x2b')]===0x1f4){logger[_0x7cbc('0x2a')](_0x7cbc('0x27'),_0x21e5bc,_0x5d0bdc['error'][_0x7cbc('0x2c')]);return _0x227088(_0x5d0bdc['error'][_0x7cbc('0x2c')]);}logger['error'](_0x7cbc('0x27'),_0x21e5bc,_0x5d0bdc[_0x7cbc('0x2a')][_0x7cbc('0x2c')]);return _0x16c184(_0x5d0bdc[_0x7cbc('0x2a')][_0x7cbc('0x2c')]);}else{logger['info'](_0x7cbc('0x27'),_0x21e5bc,_0x7cbc('0x28'));_0x16c184(_0x5d0bdc[_0x7cbc('0x2d')][_0x7cbc('0x2c')]);}})[_0x7cbc('0x2e')](function(_0x27eecd){logger[_0x7cbc('0x2a')](_0x7cbc('0x27'),_0x21e5bc,_0x27eecd);_0x227088(_0x27eecd);});});}function respondWithStatusCode(_0x5e2f2c,_0x23e038){_0x23e038=_0x23e038||0xcc;return function(_0x3b9842){if(_0x3b9842){return _0x5e2f2c[_0x7cbc('0x2f')](_0x23e038);}return _0x5e2f2c[_0x7cbc('0x30')](_0x23e038)[_0x7cbc('0x31')]();};}function respondWithResult(_0x5bc085,_0x2a5e4c){_0x2a5e4c=_0x2a5e4c||0xc8;return function(_0x4c33ca){if(_0x4c33ca){return _0x5bc085[_0x7cbc('0x30')](_0x2a5e4c)[_0x7cbc('0x32')](_0x4c33ca);}};}function respondWithFilteredResult(_0x21647a,_0x4ca15c){return function(_0x46f9ec){if(_0x46f9ec){var _0x800275=typeof _0x4ca15c['offset']==='undefined'&&typeof _0x4ca15c[_0x7cbc('0x33')]===_0x7cbc('0x34');var _0x1ea4b0=_0x46f9ec[_0x7cbc('0x35')];var _0x1f1256=_0x800275?0x0:_0x4ca15c[_0x7cbc('0x36')];var _0x174c1f=_0x800275?_0x46f9ec[_0x7cbc('0x35')]:_0x4ca15c[_0x7cbc('0x36')]+_0x4ca15c[_0x7cbc('0x33')];var _0xf6043;if(_0x174c1f>=_0x1ea4b0){_0x174c1f=_0x1ea4b0;_0xf6043=0xc8;}else{_0xf6043=0xce;}_0x21647a[_0x7cbc('0x30')](_0xf6043);return _0x21647a['set'](_0x7cbc('0x37'),_0x1f1256+'-'+_0x174c1f+'/'+_0x1ea4b0)[_0x7cbc('0x32')](_0x46f9ec);}return null;};}function patchUpdates(_0x22325f){return function(_0x1a6919){try{jsonpatch[_0x7cbc('0x38')](_0x1a6919,_0x22325f,!![]);}catch(_0x157677){return BPromise[_0x7cbc('0x39')](_0x157677);}return _0x1a6919[_0x7cbc('0x3a')]();};}function saveUpdates(_0x305745,_0x572ee2){return function(_0x1b645f){if(_0x1b645f){return _0x1b645f[_0x7cbc('0x3b')](_0x305745)[_0x7cbc('0x3c')](function(_0x24b466){return _0x24b466;});}return null;};}function removeEntity(_0x583727,_0x6165c9){return function(_0x2293bf){if(_0x2293bf){return _0x2293bf['destroy']()[_0x7cbc('0x3c')](function(){_0x583727[_0x7cbc('0x30')](0xcc)[_0x7cbc('0x31')]();});}};}function handleEntityNotFound(_0x6fae2e,_0x12bbe3){return function(_0x351f55){if(!_0x351f55){_0x6fae2e['sendStatus'](0x194);}return _0x351f55;};}function handleError(_0x381c74,_0x58cd2d){_0x58cd2d=_0x58cd2d||0x1f4;return function(_0x309ba6){logger['error'](_0x309ba6[_0x7cbc('0x3d')]);if(_0x309ba6[_0x7cbc('0x3e')]){delete _0x309ba6[_0x7cbc('0x3e')];}_0x381c74['status'](_0x58cd2d)['send'](_0x309ba6);};}function getMustacheRender(_0x152b49,_0xfd6677){return Mustache[_0x7cbc('0x3f')](_0x152b49,_[_0x7cbc('0x40')](_0xfd6677[_0x7cbc('0x41')],{'contact':_0xfd6677[_0x7cbc('0x42')],'message':_0xfd6677[_0x7cbc('0x2c')],'agent':_0xfd6677[_0x7cbc('0x43')],'interaction':_0xfd6677[_0x7cbc('0x44')],'account':_0xfd6677[_0x7cbc('0x45')]}))||'';}function getInteractionUsers(_0x1d86db,_0x59c7c4){return new BPromise(function(_0x2a38ff,_0x11d230){try{if(_0x59c7c4[_0x1d86db['id']]){_0x1d86db[_0x7cbc('0x46')]=_[_0x7cbc('0x47')](_0x59c7c4[_0x1d86db['id']],function(_0x537d5c){return{'id':_0x537d5c['id'],'fullname':_0x537d5c[_0x7cbc('0x48')]};});}}catch(_0xa07225){_0x11d230(_0xa07225);}_0x2a38ff(_0x1d86db);});}function getInteractionTags(_0x1663bc,_0x1c7847){return new BPromise(function(_0x2e23fd,_0x1e2d74){try{if(_0x1663bc[_0x7cbc('0x49')]){_0x1663bc[_0x7cbc('0x4a')]=[];_0x1663bc[_0x7cbc('0x49')][_0x7cbc('0x4b')](',')['forEach'](function(_0x153e37){_0x1663bc[_0x7cbc('0x4a')][_0x7cbc('0x4c')](_0x1c7847[_0x153e37]);});}delete _0x1663bc['TagIds'];}catch(_0x122f42){_0x1e2d74(_0x122f42);}_0x2e23fd(_0x1663bc);});}function updateChatInteraction(_0x17521b,_0x13144a,_0x51b03b){return new BPromise(function(_0x909e45,_0x45d5a9){return getInteractionUsers(_0x17521b,_0x51b03b)[_0x7cbc('0x3c')](function(_0x4c5a61){return getInteractionTags(_0x4c5a61,_0x13144a);})[_0x7cbc('0x3c')](function(_0x208e53){_0x909e45(_0x208e53);})[_0x7cbc('0x2e')](function(_0x2e1273){_0x45d5a9(_0x2e1273);});});}exports['index']=function(_0x574226,_0x1f0f27){var _0x24bed3={},_0x4c8395={},_0x1ff56e={'count':0x0,'rows':[]};var _0x231f30=_[_0x7cbc('0x47')](db[_0x7cbc('0x4d')]['rawAttributes'],function(_0x3d6161){return{'name':_0x3d6161['fieldName'],'type':_0x3d6161[_0x7cbc('0x4e')]['key']};});_0x4c8395[_0x7cbc('0x4f')]=_[_0x7cbc('0x47')](_0x231f30,_0x7cbc('0x3e'));_0x4c8395[_0x7cbc('0x50')]=_[_0x7cbc('0x51')](_0x574226[_0x7cbc('0x50')]);_0x4c8395['filters']=_[_0x7cbc('0x52')](_0x4c8395[_0x7cbc('0x4f')],_0x4c8395[_0x7cbc('0x50')]);_0x24bed3[_0x7cbc('0x53')]=_[_0x7cbc('0x52')](_0x4c8395['model'],qs[_0x7cbc('0x54')](_0x574226[_0x7cbc('0x50')][_0x7cbc('0x54')]));_0x24bed3[_0x7cbc('0x53')]=_0x24bed3['attributes'][_0x7cbc('0x55')]?_0x24bed3['attributes']:_0x4c8395[_0x7cbc('0x4f')];if(!_0x574226[_0x7cbc('0x50')][_0x7cbc('0x56')]('nolimit')){_0x24bed3['limit']=qs[_0x7cbc('0x33')](_0x574226[_0x7cbc('0x50')][_0x7cbc('0x33')]);_0x24bed3[_0x7cbc('0x36')]=qs[_0x7cbc('0x36')](_0x574226[_0x7cbc('0x50')][_0x7cbc('0x36')]);}_0x24bed3['order']=qs['sort'](_0x574226[_0x7cbc('0x50')][_0x7cbc('0x57')]);_0x24bed3['where']=qs[_0x7cbc('0x58')](_['pick'](_0x574226[_0x7cbc('0x50')],_0x4c8395[_0x7cbc('0x58')]),_0x231f30);var _0x56ee8d=[];var _0x52ecdb=squel[_0x7cbc('0x59')]()['field']('id')['field']('name')['field'](_0x7cbc('0x5a'))['from'](_0x7cbc('0x5b'));var _0x50e4b3=squel[_0x7cbc('0x59')]()['field'](_0x7cbc('0x5c'))[_0x7cbc('0x5d')]('u.fullname')[_0x7cbc('0x5d')](_0x7cbc('0x5e'))['from']('user_has_chat_interactions','ui')[_0x7cbc('0x5f')](_0x7cbc('0x60'),'u','u.id\x20=\x20ui.UserId');var _0x1bd078=squel['select']()['from'](_0x7cbc('0x61'),'i')['left_join']('cm_contacts','c',_0x7cbc('0x62'))[_0x7cbc('0x5f')](_0x7cbc('0x60'),'o','o.id\x20=\x20i.UserId')[_0x7cbc('0x5f')](_0x7cbc('0x63'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x7cbc('0x5f')]('chat_messages','me',_0x7cbc('0x64'))[_0x7cbc('0x5f')]('chat_interaction_has_tags','it',_0x7cbc('0x65'))[_0x7cbc('0x5f')](_0x7cbc('0x5b'),'t',_0x7cbc('0x66'));var _0x1b4254=squel[_0x7cbc('0x67')]();var _0x1edff5=[];var _0x2590ac=squel['expr']();var _0x9ed138;if(_0x574226[_0x7cbc('0x50')][_0x7cbc('0x68')]){_0x9ed138=as['parseSearch'](_0x574226[_0x7cbc('0x50')]['search']);var _0x313b44=_0x9ed138[_0x7cbc('0x69')];for(var _0xeef2b1=0x0;_0xeef2b1<_0x9ed138[_0x7cbc('0x6a')]['length'];_0xeef2b1++){var _0x28f2c5=_0x9ed138[_0x7cbc('0x6a')][_0xeef2b1];var _0x317960='i';var _0x4baa68=_[_0x7cbc('0x6b')](_0x231f30,[_0x7cbc('0x3e'),_0x28f2c5[_0x7cbc('0x5d')]]);if(!_0x4baa68){switch(_0x28f2c5['field']){case _0x7cbc('0x6c'):if(_0x28f2c5[_0x7cbc('0x6d')]==0x1){_0x1bd078['having']('`'+_0x28f2c5[_0x7cbc('0x5d')]+_0x7cbc('0x6e'));}else{_0x1bd078[_0x7cbc('0x6f')]('`'+_0x28f2c5[_0x7cbc('0x5d')]+'`\x20>\x200');}break;case _0x7cbc('0x70'):if(_0x28f2c5[_0x7cbc('0x71')]===_0x7cbc('0x72')){if(_0x28f2c5['value'][_0x7cbc('0x4b')]('\x20')[_0x7cbc('0x55')]>0x1){_0x1b4254[_0x313b44](_0x7cbc('0x73'),qs[_0x7cbc('0x74')](_0x28f2c5[_0x7cbc('0x6d')]),null);}else{var _0x23f52c='%'+_0x28f2c5['value']+'%';_0x1b4254[_0x313b44](_0x7cbc('0x75'),_0x23f52c,_0x23f52c,_0x23f52c);}}else{_0x4baa68=_[_0x7cbc('0x6b')](_0x231f30,['name',_0x7cbc('0x76')]);_0x28f2c5[_0x7cbc('0x5d')]=_0x7cbc('0x76');_0x46b5d1=as[_0x7cbc('0x77')](_0x317960,_0x4baa68[_0x7cbc('0x4e')],_0x28f2c5);_0x1b4254[_0x313b44](_0x46b5d1[_0x7cbc('0x78')],_0x46b5d1[_0x7cbc('0x6d')][_0x7cbc('0x79')],_0x46b5d1[_0x7cbc('0x6d')][_0x7cbc('0x31')]);}break;case _0x7cbc('0x7a'):var _0xcc5b3c=_0x28f2c5[_0x7cbc('0x6d')][_0x7cbc('0x4b')](',')['map'](function(_0x3f82e6){return Number(_0x3f82e6);});_0xcc5b3c[_0x7cbc('0x7b')](function(_0x18b099){_0x2590ac['or'](_0x7cbc('0x7c'),'%,'+_0x18b099+',%');});_0x1edff5=_[_0x7cbc('0x7d')](_0x1edff5,_0xcc5b3c);break;case _0x7cbc('0x7e'):if(_0x28f2c5['operator']===_0x7cbc('0x72')){_0x1b4254[_0x313b44](_0x7cbc('0x7f'),'%'+_0x28f2c5['value']+'%',null);}else{_0x4baa68=_[_0x7cbc('0x6b')](_0x231f30,[_0x7cbc('0x3e'),_0x7cbc('0x80')]);_0x28f2c5[_0x7cbc('0x5d')]=_0x7cbc('0x80');_0x46b5d1=as['buildExpression'](_0x317960,_0x4baa68['type'],_0x28f2c5);_0x1b4254[_0x313b44](_0x46b5d1[_0x7cbc('0x78')],_0x46b5d1[_0x7cbc('0x6d')][_0x7cbc('0x79')],_0x46b5d1['value']['end']);}break;case'body':_0x46b5d1=as[_0x7cbc('0x77')]('me',null,_0x28f2c5);_0x1b4254[_0x313b44](_0x46b5d1[_0x7cbc('0x78')],_0x46b5d1['value'][_0x7cbc('0x79')],_0x46b5d1[_0x7cbc('0x6d')][_0x7cbc('0x31')]);break;}}else{var _0x46b5d1=as['buildExpression'](_0x317960,_0x4baa68['type'],_0x28f2c5);_0x1b4254[_0x313b44](_0x46b5d1[_0x7cbc('0x78')],_0x46b5d1['value'][_0x7cbc('0x79')],_0x46b5d1[_0x7cbc('0x6d')][_0x7cbc('0x31')]);}}}else{var _0x3d1ac6=_(_0x574226['query'])[_0x7cbc('0x51')]()[_0x7cbc('0x47')](function(_0x4957db){return _[_0x7cbc('0x81')](_0x231f30,['name',_0x4957db])?_0x4957db:undefined;})[_0x7cbc('0x82')]()['value']();if(!_['isEmpty'](_0x3d1ac6)){_0x3d1ac6[_0x7cbc('0x7b')](function(_0x3f126f){if(_0x3f126f===_0x7cbc('0x83')){_0x1bd078[_0x7cbc('0x84')](_0x7cbc('0x85'),[]['concat'](_0x574226[_0x7cbc('0x50')][_0x3f126f]));}else if(_0x3f126f===_0x7cbc('0x86')){var _0x497f7a=JSON['parse'](_0x574226['query'][_0x3f126f])[_0x7cbc('0x87')];var _0x315d1e=JSON['parse'](_0x574226[_0x7cbc('0x50')][_0x3f126f])[_0x7cbc('0x88')];_0x1bd078[_0x7cbc('0x84')](_0x7cbc('0x89'),_0x497f7a,_0x315d1e);}else{if(_0x574226[_0x7cbc('0x50')][_0x3f126f]==='null'){_0x1bd078[_0x7cbc('0x84')]('i.'+_0x3f126f+_0x7cbc('0x8a'));}else{_0x1bd078[_0x7cbc('0x84')]('i.'+_0x3f126f+_0x7cbc('0x8b'),_0x574226[_0x7cbc('0x50')][_0x3f126f]);}}});}if(_0x574226[_0x7cbc('0x50')][_0x7cbc('0x8c')]){if(_0x574226[_0x7cbc('0x50')][_0x7cbc('0x8c')]==0x1){_0x1bd078[_0x7cbc('0x6f')](_0x7cbc('0x8d'));}else{_0x1bd078[_0x7cbc('0x6f')](_0x7cbc('0x8e'));}}if(_0x574226[_0x7cbc('0x50')][_0x7cbc('0x8f')]){_0x1edff5=_['isArray'](_0x574226[_0x7cbc('0x50')][_0x7cbc('0x8f')])?_0x574226[_0x7cbc('0x50')][_0x7cbc('0x8f')]:new Array(_0x574226[_0x7cbc('0x50')][_0x7cbc('0x8f')]);_0x1edff5['forEach'](function(_0x680022){_0x2590ac['or'](_0x7cbc('0x7c'),'%,'+_0x680022+',%');});}if(_0x574226['query']['filter']){var _0x5bf9da=_0x574226[_0x7cbc('0x50')][_0x7cbc('0x90')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x7cbc('0x91')](_0x5bf9da)){_0x1b4254['or']('i.id\x20LIKE\x20?',_0x5bf9da+'%');}else{_0x1b4254['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7cbc('0x74')](_0x5bf9da))['or'](_0x7cbc('0x92'),_0x5bf9da+'%');}}}_0x1bd078[_0x7cbc('0x84')](_0x1b4254);_0x1bd078['group'](_0x7cbc('0x93'));var _0x2cf757={'type':db[_0x7cbc('0x94')][_0x7cbc('0x95')]['SELECT'],'raw':!![]};var _0x56ef1f=_0x1bd078[_0x7cbc('0x96')]();_0x56ef1f['field'](_0x7cbc('0x93'));_0x56ef1f[_0x7cbc('0x5d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x24bed3[_0x7cbc('0x97')]){_0x24bed3[_0x7cbc('0x97')][_0x7cbc('0x7b')](function(_0x1ce706){var _0x519398=_0x1ce706[0x0]===_0x7cbc('0x98')?_0x1ce706[0x0]:'i.'+_0x1ce706[0x0];_0x1bd078['order'](_0x519398,_0x1ce706[0x1]==='DESC'?![]:!![]);});}if(!_[_0x7cbc('0x99')](_0x1edff5)){_0x1bd078['having'](_0x2590ac);_0x56ef1f[_0x7cbc('0x84')](_0x7cbc('0x9a'),_0x1edff5);}BPromise[_0x7cbc('0x9b')]()[_0x7cbc('0x3c')](function(){if(!_0x9ed138){if(_0x574226[_0x7cbc('0x50')][_0x7cbc('0x83')])return;_0x56ef1f[_0x7cbc('0x84')](_0x7cbc('0x9c'));_0x1bd078[_0x7cbc('0x84')](_0x7cbc('0x9c'));return;}if(_0x574226[_0x7cbc('0x9d')][_0x7cbc('0x9e')]!==_0x7cbc('0x43'))return;return _0x574226[_0x7cbc('0x9d')][_0x7cbc('0x9f')]({'attributes':['id'],'raw':!![]})[_0x7cbc('0x3c')](function(_0x185d33){if(_[_0x7cbc('0x99')](_0x185d33)){_0x56ef1f['where'](_0x7cbc('0xa0'));_0x1bd078[_0x7cbc('0x84')](_0x7cbc('0xa0'));}else{_0x56ef1f[_0x7cbc('0x84')](_0x7cbc('0x85'),_[_0x7cbc('0x47')](_0x185d33,'id'));_0x1bd078['where'](_0x7cbc('0x85'),_[_0x7cbc('0x47')](_0x185d33,'id'));}});})[_0x7cbc('0x3c')](function(){if(_0x574226[_0x7cbc('0x9d')]['role']===_0x7cbc('0x43')&&!_0x9ed138&&!_0x574226[_0x7cbc('0x50')][_0x7cbc('0x83')])return[];return db[_0x7cbc('0xa1')][_0x7cbc('0x50')](_0x56ef1f[_0x7cbc('0xa2')](),_0x2cf757);})['then'](function(_0x56356a){_0x1ff56e[_0x7cbc('0x35')]=_0x56356a[_0x7cbc('0x55')];if(_0x1ff56e['count']===0x0)return[];return db['sequelize']['query'](_0x52ecdb[_0x7cbc('0xa2')](),_0x2cf757)[_0x7cbc('0x3c')](function(_0x5eda83){_0x56ee8d=_[_0x7cbc('0xa3')](_0x5eda83,'id');_0x2cf757=_[_0x7cbc('0x40')](_0x2cf757,{'model':db[_0x7cbc('0x4d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x574226['query'][_0x7cbc('0x54')]){_0x24bed3[_0x7cbc('0x53')]['forEach'](function(_0x37efa6){_0x1bd078[_0x7cbc('0x5d')]('i.'+_0x37efa6);});}else{_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xa4'),'unreadMessages');_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xa5'),'Account.key');_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xa6'),_0x7cbc('0xa7'));_0x1bd078[_0x7cbc('0x5d')]('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',_0x7cbc('0x98'));_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xa8'));_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xa9'),'Contact.firstName');_0x1bd078['field'](_0x7cbc('0xaa'),_0x7cbc('0xab'));_0x1bd078[_0x7cbc('0x5d')]('c.email',_0x7cbc('0xac'));_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xad'),'Contact.phone');_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xae'),_0x7cbc('0xaf'));_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xb0'),_0x7cbc('0xb1'));_0x1bd078[_0x7cbc('0x5d')]('o.fullname',_0x7cbc('0xb2'));_0x1bd078[_0x7cbc('0x5d')]('o.internal',_0x7cbc('0xb3'));_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xb4'),_0x7cbc('0x49'));}if(_0x24bed3[_0x7cbc('0x33')])_0x1bd078['limit'](_0x24bed3[_0x7cbc('0x33')]);if(_0x24bed3[_0x7cbc('0x36')])_0x1bd078[_0x7cbc('0x36')](_0x24bed3[_0x7cbc('0x36')]);return db[_0x7cbc('0xa1')][_0x7cbc('0x50')](_0x1bd078['toString'](),_0x2cf757);})['then'](function(_0x26e574){if(_0x26e574['length']>0x0)_0x50e4b3['where'](_0x7cbc('0xb5'),_[_0x7cbc('0x47')](_0x26e574,'id'));return db[_0x7cbc('0xa1')][_0x7cbc('0x50')](_0x50e4b3[_0x7cbc('0xa2')](),_0x2cf757)[_0x7cbc('0x3c')](function(_0xc55707){var _0x432c6a=_[_0x7cbc('0xb6')](_0xc55707,_0x7cbc('0xb7'));var _0x1eb8d5=[];_0x26e574[_0x7cbc('0x7b')](function(_0x4d2dc4){_0x1eb8d5[_0x7cbc('0x4c')](updateChatInteraction(_0x4d2dc4,_0x56ee8d,_0x432c6a));});return BPromise['all'](_0x1eb8d5);});});})[_0x7cbc('0x3c')](function(_0x28cf80){_0x1ff56e[_0x7cbc('0xb8')]=_0x28cf80;return _0x1ff56e;})['then'](respondWithFilteredResult(_0x1f0f27,_0x24bed3))[_0x7cbc('0x2e')](handleError(_0x1f0f27,null));};exports['show']=function(_0x5beef5,_0x59c03f){var _0x4ff489={'raw':![],'where':{'id':_0x5beef5['params']['id']}},_0x22acb7={};_0x22acb7['model']=_[_0x7cbc('0x51')](db['ChatInteraction'][_0x7cbc('0xb9')]);_0x22acb7['query']=_[_0x7cbc('0x51')](_0x5beef5[_0x7cbc('0x50')]);_0x22acb7['filters']=_[_0x7cbc('0x52')](_0x22acb7[_0x7cbc('0x4f')],_0x22acb7[_0x7cbc('0x50')]);_0x4ff489[_0x7cbc('0x53')]=_[_0x7cbc('0x52')](_0x22acb7[_0x7cbc('0x4f')],qs['fields'](_0x5beef5['query'][_0x7cbc('0x54')]));_0x4ff489['attributes']=_0x4ff489['attributes'][_0x7cbc('0x55')]?_0x4ff489[_0x7cbc('0x53')]:_0x22acb7[_0x7cbc('0x4f')];if(_0x5beef5[_0x7cbc('0x50')][_0x7cbc('0xba')]){_0x4ff489[_0x7cbc('0xbb')]=[{'all':!![]}];}_0x4ff489=_[_0x7cbc('0x40')]({},_0x4ff489,_0x5beef5[_0x7cbc('0xbc')]);return db['ChatInteraction'][_0x7cbc('0x6b')](_0x4ff489)[_0x7cbc('0x3c')](handleEntityNotFound(_0x59c03f,null))['then'](respondWithResult(_0x59c03f,null))[_0x7cbc('0x2e')](handleError(_0x59c03f,null));};exports[_0x7cbc('0xbd')]=function(_0x3e14f7,_0x35b31b){return db['ChatInteraction'][_0x7cbc('0xbd')](_0x3e14f7[_0x7cbc('0x41')],{})['then'](respondWithResult(_0x35b31b,0xc9))['catch'](handleError(_0x35b31b,null));};exports[_0x7cbc('0x3b')]=function(_0x359d38,_0x1fc421){if(_0x359d38[_0x7cbc('0x41')]['id']){delete _0x359d38[_0x7cbc('0x41')]['id'];}return db[_0x7cbc('0x4d')][_0x7cbc('0x6b')]({'where':{'id':_0x359d38[_0x7cbc('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1fc421,null))['then'](saveUpdates(_0x359d38[_0x7cbc('0x41')],null))[_0x7cbc('0x3c')](respondWithResult(_0x1fc421,null))['catch'](handleError(_0x1fc421,null));};exports[_0x7cbc('0xbf')]=function(_0x2c4b2d,_0x4e3f40){return db[_0x7cbc('0x4d')][_0x7cbc('0x6b')]({'where':{'id':_0x2c4b2d[_0x7cbc('0xbe')]['id']}})[_0x7cbc('0x3c')](handleEntityNotFound(_0x4e3f40,null))[_0x7cbc('0x3c')](removeEntity(_0x4e3f40,null))['catch'](handleError(_0x4e3f40,null));};exports['describe']=function(_0xc2d796,_0xcbf428){return db[_0x7cbc('0x4d')]['describe']()[_0x7cbc('0x3c')](respondWithResult(_0xcbf428,null))[_0x7cbc('0x2e')](handleError(_0xcbf428,null));};exports[_0x7cbc('0xc0')]=function(_0x34338e,_0x2d2bb8){var _0x3176f8=_0x34338e['params']['id'];var _0x376493;var _0x4fbdaf;var _0x24517c;return db[_0x7cbc('0x4d')][_0x7cbc('0xc1')]({'where':{'id':_0x3176f8}})[_0x7cbc('0x3c')](function(_0x11b39e){_0x376493=_0x11b39e;return db[_0x7cbc('0xc2')][_0x7cbc('0xc1')]({'where':{'id':_0x11b39e[_0x7cbc('0x83')]},'attributes':['id',_0x7cbc('0xc3'),_0x7cbc('0xc4'),'vidaooTopic',_0x7cbc('0xc5'),_0x7cbc('0xc6')],'raw':!![]});})[_0x7cbc('0x3c')](function(_0xc03641){if(_0xc03641&&_0xc03641['vidaooApiKey']&&_0xc03641[_0x7cbc('0xc4')]){_0x4fbdaf=_0xc03641;var _0x351fd0={'interaction':{'id':_0x3176f8},'agent':{'id':_0x34338e[_0x7cbc('0x9d')]['id'],'name':_0x34338e[_0x7cbc('0x9d')][_0x7cbc('0x3e')],'fullname':_0x34338e[_0x7cbc('0x9d')]['fullname'],'email':_0x34338e[_0x7cbc('0x9d')][_0x7cbc('0xc7')]},'contact':_0x34338e[_0x7cbc('0x41')][_0x7cbc('0x42')],'account':_0x34338e[_0x7cbc('0x41')][_0x7cbc('0x45')]};var _0x5002f3={'rejectUnauthorized':![],'method':_0x7cbc('0xc8'),'url':_0x7cbc('0xc9'),'headers':{'X-APIKEY':_0xc03641[_0x7cbc('0xc3')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x34338e[_0x7cbc('0x9d')][_0x7cbc('0xc7')]],'buttons':null,'topic':_0x4fbdaf[_0x7cbc('0xca')],'note':_[_0x7cbc('0xcb')](_0x4fbdaf[_0x7cbc('0xc5')])?null:getMustacheRender(_0x4fbdaf[_0x7cbc('0xc5')],_0x351fd0),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x7cbc('0xcb')](_0x4fbdaf['vidaooMetadata'])){var _0x37f7c3=getMustacheRender(_0x4fbdaf[_0x7cbc('0xc6')],_0x351fd0);var _0x1f0572=JSON[_0x7cbc('0xcc')](_0x37f7c3);_0x5002f3['body']['metadata']=_0x1f0572;}}catch(_0xf35cbd){throw new db[(_0x7cbc('0x94'))][(_0x7cbc('0xcd'))](_0x7cbc('0xce'));}return rp(_0x5002f3);}else{throw new db['Sequelize'][(_0x7cbc('0xcd'))](_0x7cbc('0xcf'));}})['then'](function(_0x27207f){_0x24517c=_0x27207f;if(_0x24517c['id']){var _0x18af8b={'body':_0x24517c[_0x7cbc('0xd0')],'ChatWebsiteId':_0x4fbdaf['id'],'ChatInteractionId':_0x376493['id'],'direction':_0x7cbc('0xd1'),'UserId':_0x34338e[_0x7cbc('0x9d')]['id']};return db[_0x7cbc('0xd2')][_0x7cbc('0xbd')](_0x18af8b,{});}else{throw new db[(_0x7cbc('0x94'))][(_0x7cbc('0xcd'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x7cbc('0x3c')](function(){return _0x376493['updateAttributes']({'vidaooSessionId':_0x24517c['id']});})[_0x7cbc('0x3c')](respondWithResult(_0x2d2bb8,null))[_0x7cbc('0x2e')](handleError(_0x2d2bb8,null));};exports[_0x7cbc('0xd3')]=function(_0x24857e,_0x5dff5a){if(_0x24857e[_0x7cbc('0x41')]['id']){delete _0x24857e[_0x7cbc('0x41')]['id'];}return db[_0x7cbc('0x4d')][_0x7cbc('0x6b')]({'where':{'id':_0x24857e[_0x7cbc('0xbe')]['id']},'include':[{'model':db['CmContact'],'as':_0x7cbc('0x70')}]})[_0x7cbc('0x3c')](handleEntityNotFound(_0x5dff5a,null))['then'](saveUpdates(_0x24857e[_0x7cbc('0x41')],null))[_0x7cbc('0x3c')](respondWithResult(_0x5dff5a,null))['catch'](handleError(_0x5dff5a,null));};exports[_0x7cbc('0xd4')]=function(_0x49345d,_0x2e210c,_0x3a8040){if(_0x49345d[_0x7cbc('0x41')]['id']){delete _0x49345d[_0x7cbc('0x41')]['id'];}return db[_0x7cbc('0x4d')]['find']({'where':{'id':_0x49345d[_0x7cbc('0xbe')]['id']}})['then'](function(_0x274728){if(!_0x274728){logger[_0x7cbc('0x2a')](_0x7cbc('0xd5'),_0x7cbc('0xd4'),0x194,_0x7cbc('0xd6'));_0x2e210c[_0x7cbc('0x2f')](0x194);}else{if(_0x274728[_0x7cbc('0x80')]){throw new db['Sequelize']['ValidationError']('Interaction\x20already\x20assigned');}}return _0x274728;})[_0x7cbc('0x3c')](function(_0x425823){if(_0x425823){return _0x425823[_0x7cbc('0x3b')]({'closed':_0x49345d['body']['closed'],'disposition':_0x49345d[_0x7cbc('0x41')][_0x7cbc('0xd7')]})['then'](function(_0xe28d89){return _0xe28d89;});}})[_0x7cbc('0x3c')](function(_0x2a9cdf){return respondWithRpcPromise(_0x7cbc('0xd8'),_0x7cbc('0xd4'),_0x49345d[_0x7cbc('0x41')],client9004);})['then'](respondWithResult(_0x2e210c,null))[_0x7cbc('0x2e')](handleError(_0x2e210c,null));};exports[_0x7cbc('0xd9')]=function(_0x5885d9,_0x39b158,_0x177f88){_0x5885d9['body'][_0x7cbc('0x3e')]=_0x5885d9[_0x7cbc('0xda')][_0x7cbc('0xdb')];_0x5885d9[_0x7cbc('0x41')][_0x7cbc('0xdc')]=_0x5885d9[_0x7cbc('0xda')][_0x7cbc('0xdd')];_0x5885d9[_0x7cbc('0x41')][_0x7cbc('0x4e')]=_0x5885d9[_0x7cbc('0xda')][_0x7cbc('0xde')];return db[_0x7cbc('0xdf')][_0x7cbc('0xbd')](_0x5885d9[_0x7cbc('0x41')])[_0x7cbc('0x3c')](respondWithResult(_0x39b158,0xc9))['catch'](handleError(_0x39b158,null));};exports['attachmentDownload']=function(_0x254663,_0x51cc8d,_0x3be5ea){return db[_0x7cbc('0x4d')][_0x7cbc('0xc1')]({'where':{'id':_0x254663[_0x7cbc('0xbe')]['id']},'raw':!![]})[_0x7cbc('0x3c')](handleEntityNotFound(_0x51cc8d,null))[_0x7cbc('0x3c')](function(_0x5304c2){if(_0x5304c2){if(_0x5304c2[_0x7cbc('0xe0')]){return _0x51cc8d['status'](0x193)['json']({'status':0x193,'message':_0x7cbc('0xe1')});}return db['Attachment']['findOne']({'where':{'id':_0x254663[_0x7cbc('0x50')]['attachId']},'raw':!![]})[_0x7cbc('0x3c')](handleEntityNotFound(_0x51cc8d,null));}})[_0x7cbc('0x3c')](function(_0x5ecbde){if(_0x5ecbde){var _0x42eda3=_0x5ecbde['ChatOfflineMessageId']!==null;var _0x4b1c25=path['join'](config[_0x7cbc('0xe2')],'server/files/attachments/');if(_0x42eda3){_0x4b1c25=path[_0x7cbc('0xe3')](_0x4b1c25,'offline-chat/');}var _0x4e9b56=path[_0x7cbc('0xe3')](_0x4b1c25,_0x5ecbde[_0x7cbc('0xdc')]);return _0x51cc8d[_0x7cbc('0xe4')](_0x4e9b56);}})['catch'](handleError(_0x51cc8d,null));};exports['close']=function(_0x14e32d,_0xf051e6){var _0x3cb778=null;var _0x682d83=null;var _0x5ac96b=null;var _0xa1da71=null;if(_0x14e32d[_0x7cbc('0x41')]['id']){delete _0x14e32d[_0x7cbc('0x41')]['id'];}if(_0x14e32d['body'][_0x7cbc('0xe5')]){_0xa1da71=path[_0x7cbc('0xe3')](config[_0x7cbc('0xe2')],_0x7cbc('0xe6'),util[_0x7cbc('0xe7')]('transcript-%s.txt',Date[_0x7cbc('0xe8')]()));_0x14e32d[_0x7cbc('0x41')]['pathTranscript']=_0xa1da71;}return db[_0x7cbc('0x4d')][_0x7cbc('0x6b')]({'where':{'id':_0x14e32d[_0x7cbc('0xbe')]['id']},'include':[{'model':db[_0x7cbc('0xd2')],'as':'Messages','include':[{'model':db[_0x7cbc('0x7e')],'as':_0x7cbc('0x7e')}]}]})[_0x7cbc('0x3c')](handleEntityNotFound(_0xf051e6,null))['then'](saveUpdates(_0x14e32d['body'],null))[_0x7cbc('0x3c')](function(_0x4fbb5d){if(_0x4fbb5d){_0x3cb778=_0x4fbb5d;return db[_0x7cbc('0xc2')][_0x7cbc('0x6b')]({'where':{'id':_0x3cb778['ChatWebsiteId']}});}})['then'](function(_0x324866){if(_0x324866){_0x5ac96b=_0x324866;return db[_0x7cbc('0xe9')][_0x7cbc('0x6b')]({'where':{'id':_0x3cb778['ContactId']}});}})[_0x7cbc('0x3c')](function(_0x12ea21){if(_0x12ea21){_0x682d83=_0x12ea21;if(_0xa1da71){var _0x142320=null;for(var _0x182d65=0x1;_0x182d65<_0x3cb778[_0x7cbc('0xea')]['length'];++_0x182d65){_0x142320=_0x3cb778[_0x7cbc('0xea')][_0x182d65];var _0x595533=_0x142320[_0x7cbc('0x80')]?util[_0x7cbc('0xe7')](_0x7cbc('0xeb'),_0x5ac96b[_0x7cbc('0xec')],_0x142320[_0x7cbc('0x80')]):_0x7cbc('0xed');var _0x30cf48=_0x14e32d[_0x7cbc('0x41')]['customer']||util[_0x7cbc('0xe7')](_0x7cbc('0xeb'),'Visitor',_0x142320[_0x7cbc('0x76')]);switch(_0x5ac96b['agentIdentifier']){case _0x7cbc('0xee'):_0x595533=_0x142320[_0x7cbc('0x80')]?util[_0x7cbc('0xe7')](_0x7cbc('0xeb'),_0x5ac96b[_0x7cbc('0xec')],_0x142320[_0x7cbc('0x80')]):_0x7cbc('0xed');break;case _0x7cbc('0xef'):_0x595533=_0x142320[_0x7cbc('0x80')]?_0x142320[_0x7cbc('0x7e')][_0x7cbc('0xf0')]||_0x142320[_0x7cbc('0x7e')][_0x7cbc('0x48')]:'System';break;case _0x7cbc('0xf1'):_0x595533=_0x142320[_0x7cbc('0x80')]?_0x142320[_0x7cbc('0x7e')][_0x7cbc('0x48')]:_0x7cbc('0xed');break;default:_0x595533=_0x142320[_0x7cbc('0x80')]?util[_0x7cbc('0xe7')](_0x7cbc('0xeb'),_0x5ac96b[_0x7cbc('0xec')],_0x142320[_0x7cbc('0x80')]):_0x7cbc('0xed');}var _0x1d3fc5=util['format'](_0x7cbc('0xf2'),moment(_0x142320[_0x7cbc('0x86')])['format'](_0x7cbc('0xf3')),_0x142320['direction']==='in'?_0x30cf48:_0x595533,_0x142320[_0x7cbc('0x41')]);if(!_0x142320[_0x7cbc('0xf4')]){fs[_0x7cbc('0xf5')](_0xa1da71,_0x1d3fc5);}}return db[_0x7cbc('0xf6')][_0x7cbc('0xc1')]({'where':{'service':!![]},'include':[{'model':db[_0x7cbc('0xf7')],'as':'Smtp','raw':!![]}]});}}})[_0x7cbc('0x3c')](function(_0x4fdaa9){if(_0x4fdaa9&&_0x4fdaa9['Smtp']&&_0x14e32d['body']){var _0x699750={'tls':{'rejectUnauthorized':![]}};if(_0x4fdaa9['Smtp'][_0x7cbc('0xf8')]){_0x699750[_0x7cbc('0xf8')]=_0x4fdaa9[_0x7cbc('0xf9')][_0x7cbc('0xf8')];}else{_0x699750[_0x7cbc('0xfa')]=_0x4fdaa9[_0x7cbc('0xf9')][_0x7cbc('0xfa')];_0x699750['port']=_0x4fdaa9[_0x7cbc('0xf9')][_0x7cbc('0xfb')];_0x699750[_0x7cbc('0xfc')]=_0x4fdaa9['Smtp'][_0x7cbc('0xfc')];}if(_0x4fdaa9[_0x7cbc('0xf9')][_0x7cbc('0xfd')]){_0x699750['auth']={'user':_0x4fdaa9[_0x7cbc('0xf9')][_0x7cbc('0x9d')],'pass':_0x4fdaa9[_0x7cbc('0xf9')][_0x7cbc('0xfe')]};}return respondWithRpcPromise(_0x7cbc('0xff'),_0x7cbc('0x100'),{'account':_0x699750,'message':{'from':util[_0x7cbc('0xe7')]('\x22%s\x22\x20<%s>',_0x4fdaa9['name'],_0x4fdaa9[_0x7cbc('0xc7')]||_0x4fdaa9[_0x7cbc('0xf9')][_0x7cbc('0x9d')]),'to':_0x14e32d[_0x7cbc('0x41')][_0x7cbc('0xe5')],'subject':_0x7cbc('0x101'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x14e32d['body'][_0x7cbc('0xe5')]),'attachments':[{'path':_0xa1da71}]}})[_0x7cbc('0x3c')](function(){return _0x3cb778;})['catch'](function(_0x496599){console[_0x7cbc('0x2a')](_0x496599);});}else{return _0x3cb778;}})['then'](respondWithStatusCode(_0xf051e6,0xc8))['catch'](handleError(_0xf051e6,null));};exports[_0x7cbc('0x102')]=function(_0x5d1ad2,_0x2fff24,_0x59ed3c){return db[_0x7cbc('0xd2')][_0x7cbc('0x6b')]({'where':{'id':_0x5d1ad2[_0x7cbc('0xbe')]['id']}})[_0x7cbc('0x3c')](handleEntityNotFound(_0x2fff24,null))[_0x7cbc('0x3c')](function(_0x5b0a43){if(_0x5b0a43){return _0x5b0a43[_0x7cbc('0x102')](_0x5d1ad2[_0x7cbc('0x41')][_0x7cbc('0x103')],_[_0x7cbc('0x104')](_0x5d1ad2['body'],[_0x7cbc('0x103'),'id'])||{});}})[_0x7cbc('0x3c')](respondWithResult(_0x2fff24,null))['catch'](handleError(_0x2fff24,null));};exports['getMessages']=function(_0x1ba70a,_0x3bd088,_0x27fbe7){var _0x466b29={'raw':![],'where':{}};var _0x3e8769={};var _0x39f6a5={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x7cbc('0xc1')]({'where':{'id':_0x1ba70a['params']['id']}})[_0x7cbc('0x3c')](handleEntityNotFound(_0x3bd088,null))[_0x7cbc('0x3c')](function(_0x5c682b){if(_0x5c682b){_0x3e8769['model']=_[_0x7cbc('0x51')](db[_0x7cbc('0xd2')][_0x7cbc('0xb9')]);_0x3e8769[_0x7cbc('0x50')]=_[_0x7cbc('0x51')](_0x1ba70a[_0x7cbc('0x50')]);_0x3e8769[_0x7cbc('0x58')]=_[_0x7cbc('0x52')](_0x3e8769[_0x7cbc('0x4f')],_0x3e8769[_0x7cbc('0x50')]);_0x466b29[_0x7cbc('0x53')]=_['intersection'](_0x3e8769[_0x7cbc('0x4f')],qs[_0x7cbc('0x54')](_0x1ba70a[_0x7cbc('0x50')][_0x7cbc('0x54')]));_0x466b29[_0x7cbc('0x53')]=_0x466b29[_0x7cbc('0x53')][_0x7cbc('0x55')]?_0x466b29['attributes']:_0x3e8769[_0x7cbc('0x4f')];if(!_0x1ba70a[_0x7cbc('0x50')][_0x7cbc('0x56')](_0x7cbc('0x105'))){_0x466b29[_0x7cbc('0x33')]=qs[_0x7cbc('0x33')](_0x1ba70a[_0x7cbc('0x50')][_0x7cbc('0x33')]);_0x466b29[_0x7cbc('0x36')]=qs[_0x7cbc('0x36')](_0x1ba70a[_0x7cbc('0x50')]['offset']);}_0x466b29[_0x7cbc('0x97')]=qs[_0x7cbc('0x57')](_0x1ba70a['query']['sort']);_0x466b29[_0x7cbc('0x84')]=qs[_0x7cbc('0x58')](_[_0x7cbc('0x106')](_0x1ba70a['query'],_0x3e8769[_0x7cbc('0x58')]));_0x466b29[_0x7cbc('0x84')][_0x7cbc('0xb7')]=_0x5c682b['id'];if(_0x1ba70a[_0x7cbc('0x50')]['filter']){_0x466b29[_0x7cbc('0x84')]=_[_0x7cbc('0x40')](_0x466b29[_0x7cbc('0x84')],{'$or':_[_0x7cbc('0x47')](_0x466b29[_0x7cbc('0x53')],function(_0x485739){var _0x131e3e={};_0x131e3e[_0x485739]={'$like':'%'+_0x1ba70a['query'][_0x7cbc('0x90')]+'%'};return _0x131e3e;})});}if(_0x1ba70a[_0x7cbc('0x50')][_0x7cbc('0x87')]){var _0x17807f=_0x1ba70a[_0x7cbc('0x50')][_0x7cbc('0x87')]['split'](',');var _0x28ee93={};_0x28ee93[_0x17807f[0x0]]={'$gte':moment(_0x17807f[0x1])[_0x7cbc('0xe7')](_0x7cbc('0x107'))};_0x466b29['where']=_['merge'](_0x466b29[_0x7cbc('0x84')],_0x28ee93);}_0x466b29=_[_0x7cbc('0x40')]({},_0x466b29,_0x1ba70a['options']);return db[_0x7cbc('0xd2')]['count']({'where':_0x466b29[_0x7cbc('0x84')]})[_0x7cbc('0x3c')](function(_0x3a082c){_0x39f6a5[_0x7cbc('0x35')]=_0x3a082c;if(_0x1ba70a[_0x7cbc('0x50')][_0x7cbc('0xba')]){_0x466b29[_0x7cbc('0xbb')]=[{'all':!![]}];}return db[_0x7cbc('0xd2')][_0x7cbc('0x108')](_0x466b29);})[_0x7cbc('0x3c')](function(_0x1a83e3){_0x39f6a5[_0x7cbc('0xb8')]=_0x1a83e3;return _0x39f6a5;});}})['then'](respondWithFilteredResult(_0x3bd088,_0x466b29))[_0x7cbc('0x2e')](handleError(_0x3bd088,null));};exports[_0x7cbc('0x109')]=function(_0x1f2bae,_0x336538,_0x339b76){var _0xf9e31f={'where':{}},_0x1bfa62={},_0x1b2c70={'count':0x0,'rows':[]};return db[_0x7cbc('0x4d')]['findOne']({'where':{'id':_0x1f2bae[_0x7cbc('0xbe')]['id']}})[_0x7cbc('0x3c')](handleEntityNotFound(_0x336538,null))[_0x7cbc('0x3c')](function(_0x503911){if(_0x503911){_0x1bfa62[_0x7cbc('0x4f')]=_[_0x7cbc('0x51')](db[_0x7cbc('0xd2')][_0x7cbc('0xb9')]);_0x1bfa62['query']=_[_0x7cbc('0x51')](_0x1f2bae['query']);_0x1bfa62[_0x7cbc('0x58')]=_[_0x7cbc('0x52')](_0x1bfa62[_0x7cbc('0x4f')],_0x1bfa62['query']);_0xf9e31f[_0x7cbc('0x53')]=_['intersection'](_0x1bfa62[_0x7cbc('0x4f')],qs['fields'](_0x1f2bae[_0x7cbc('0x50')][_0x7cbc('0x54')]));_0xf9e31f[_0x7cbc('0x53')]=_0xf9e31f[_0x7cbc('0x53')]['length']?_0xf9e31f['attributes']:_0x1bfa62[_0x7cbc('0x4f')];if(!_0x1f2bae['query']['hasOwnProperty'](_0x7cbc('0x105'))){_0xf9e31f[_0x7cbc('0x33')]=qs['limit'](_0x1f2bae['query']['limit']);_0xf9e31f[_0x7cbc('0x36')]=qs[_0x7cbc('0x36')](_0x1f2bae[_0x7cbc('0x50')]['offset']);}_0xf9e31f['order']=qs[_0x7cbc('0x57')](_0x1f2bae[_0x7cbc('0x50')]['sort']);_0xf9e31f['where']=qs['filters'](_[_0x7cbc('0x106')](_0x1f2bae[_0x7cbc('0x50')],_0x1bfa62[_0x7cbc('0x58')]));_0xf9e31f[_0x7cbc('0x84')]['ChatInteractionId']=_0x503911['id'];if(_0x1f2bae[_0x7cbc('0x50')][_0x7cbc('0x90')]){_0xf9e31f[_0x7cbc('0x84')]=_[_0x7cbc('0x40')](_0xf9e31f[_0x7cbc('0x84')],{'$or':_[_0x7cbc('0x47')](_0xf9e31f[_0x7cbc('0x53')],function(_0xf0718f){var _0x571d8e={};_0x571d8e[_0xf0718f]={'$like':'%'+_0x1f2bae['query']['filter']+'%'};return _0x571d8e;})});}_0xf9e31f[_0x7cbc('0x84')][_0x7cbc('0xf4')]=![];if(_0x1f2bae[_0x7cbc('0x50')]['id']){_0xf9e31f['where']['id']={'$gt':_0x1f2bae['query']['id']};}_0xf9e31f=_['merge']({},_0xf9e31f,_0x1f2bae[_0x7cbc('0xbc')]);return db['ChatMessage'][_0x7cbc('0x35')]({'where':_0xf9e31f[_0x7cbc('0x84')]})[_0x7cbc('0x3c')](function(_0x39e435){_0x1b2c70[_0x7cbc('0x35')]=_0x39e435;_0xf9e31f[_0x7cbc('0xbb')]=[];if(_0x1f2bae[_0x7cbc('0x50')][_0x7cbc('0x10a')]){_0xf9e31f[_0x7cbc('0xbb')][_0x7cbc('0x4c')]({'model':db[_0x7cbc('0x7e')],'as':_0x7cbc('0x7e'),'attributes':['id',_0x7cbc('0x48'),_0x7cbc('0xf0')]});}if(_0x1f2bae[_0x7cbc('0x50')][_0x7cbc('0xba')]){_0xf9e31f[_0x7cbc('0xbb')]=[{'all':!![]}];}return db['ChatMessage'][_0x7cbc('0x108')](_0xf9e31f);})['then'](function(_0x11b068){_0x1b2c70['rows']=_0x11b068;return _0x1b2c70;});}})[_0x7cbc('0x3c')](respondWithFilteredResult(_0x336538,_0xf9e31f))[_0x7cbc('0x2e')](handleError(_0x336538,null));};exports[_0x7cbc('0x10b')]=function(_0x22a71c,_0x1a0ccb,_0x4f8177){return db[_0x7cbc('0x4d')][_0x7cbc('0x6b')]({'where':{'id':_0x22a71c[_0x7cbc('0xbe')]['id']}})[_0x7cbc('0x3c')](handleEntityNotFound(_0x1a0ccb,null))[_0x7cbc('0x3c')](function(_0x2dab8a){if(_0x2dab8a){return _0x2dab8a[_0x7cbc('0x10c')](_0x22a71c[_0x7cbc('0x41')][_0x7cbc('0x103')],_['omit'](_0x22a71c['body'],[_0x7cbc('0x103'),'id'])||{})['spread'](function(){return db[_0x7cbc('0x7a')]['findAll']({'attributes':['id',_0x7cbc('0x3e'),'color'],'where':{'id':_0x22a71c[_0x7cbc('0x41')][_0x7cbc('0x103')]}});})[_0x7cbc('0x3c')](function(_0x5c6d48){socket['emit'](_0x7cbc('0x10d'),{'id':Number(_0x22a71c[_0x7cbc('0xbe')]['id']),'tags':_0x5c6d48||[]});return{'id':Number(_0x22a71c['params']['id']),'tags':_0x5c6d48||[]};});}})[_0x7cbc('0x3c')](respondWithResult(_0x1a0ccb,null))['catch'](handleError(_0x1a0ccb,null));};exports[_0x7cbc('0x10e')]=function(_0xec4872,_0x27b522,_0x30b3ee){return db[_0x7cbc('0x4d')][_0x7cbc('0x6b')]({'where':{'id':_0xec4872[_0x7cbc('0xbe')]['id']}})[_0x7cbc('0x3c')](handleEntityNotFound(_0x27b522,null))[_0x7cbc('0x3c')](function(_0x54894d){if(_0x54894d){return _0x54894d[_0x7cbc('0x10e')](_0xec4872[_0x7cbc('0x50')][_0x7cbc('0x103')]);}})[_0x7cbc('0x3c')](respondWithStatusCode(_0x27b522,null))[_0x7cbc('0x2e')](handleError(_0x27b522,null));};exports[_0x7cbc('0xe4')]=function(_0x4a47aa,_0x3ea8d0){var _0x348396=moment()['unix']()['toString']();var _0x2b8162=path['join'](config[_0x7cbc('0xe2')],_0x7cbc('0x10f'),_0x7cbc('0x110'),'tmp');var _0x250841=path[_0x7cbc('0xe3')](config[_0x7cbc('0xe2')],_0x7cbc('0x10f'),_0x7cbc('0x110'),_0x7cbc('0x111'));var _0x43d71b=path[_0x7cbc('0xe3')](_0x2b8162,_0x348396);var _0x37d512=util[_0x7cbc('0xe7')](_0x7cbc('0x112'),_0x4a47aa[_0x7cbc('0xbe')]['id'],_0x348396);var _0x20aa92=path[_0x7cbc('0xe3')](_0x2b8162,_0x37d512);var _0x562670=[];_0x562670[_0x7cbc('0x4c')]({'model':db[_0x7cbc('0x7e')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x562670[_0x7cbc('0x4c')]({'model':db['CmContact'],'as':_0x7cbc('0x70'),'attributes':['id',_0x7cbc('0x113'),_0x7cbc('0x114')],'raw':!![]});if(_0x4a47aa[_0x7cbc('0x50')][_0x7cbc('0x111')]){_0x562670['push']({'model':db[_0x7cbc('0xdf')],'as':'Attachment','raw':!![]});}var _0x31ef1e=[{'model':db[_0x7cbc('0xd2')],'as':_0x7cbc('0xea'),'attributes':['id','body','createdAt',_0x7cbc('0x115'),_0x7cbc('0xf4'),'read'],'include':_0x562670}];_0x31ef1e[_0x7cbc('0x4c')]({'model':db[_0x7cbc('0xc2')],'as':'Account','attributes':['id',_0x7cbc('0x3e')]});_0x31ef1e[_0x7cbc('0x4c')]({'model':db[_0x7cbc('0x7e')],'as':_0x7cbc('0x116'),'attributes':['id','fullname']});return db[_0x7cbc('0x4d')][_0x7cbc('0x6b')]({'where':{'id':_0x4a47aa['params']['id']},'include':_0x31ef1e})[_0x7cbc('0x3c')](handleEntityNotFound(_0x3ea8d0,null))[_0x7cbc('0x3c')](function(_0x565d3b){if(_0x565d3b){var _0x284d95=_0x565d3b['get']({'plain':!![]});fs['mkdirSync'](_0x43d71b);var _0x301d18={'channel':_0x7cbc('0x117'),'account':_0x284d95[_0x7cbc('0x118')][_0x7cbc('0x3e')],'agent':_0x284d95[_0x7cbc('0x116')]?_0x284d95['Owner'][_0x7cbc('0x48')]:_0x7cbc('0x119'),'createdAt':moment(_0x284d95[_0x7cbc('0x86')])[_0x7cbc('0xe7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7cbc('0xa2')](),'closedAt':_0x284d95[_0x7cbc('0xe0')]?moment(_0x284d95['closedAt'])[_0x7cbc('0xe7')](_0x7cbc('0x107'))[_0x7cbc('0xa2')]():'','disposition':_0x284d95['disposition'],'chatInfo':{'browser':_0x284d95['browserName'],'os':_0x284d95[_0x7cbc('0x11a')],'referer':_0x284d95['referer'],'customerIp':_0x284d95[_0x7cbc('0x11b')],'customerPort':_0x284d95['customerPort']?_0x284d95[_0x7cbc('0x11c')]:_0x7cbc('0x119')},'messages':_(_0x284d95[_0x7cbc('0xea')])[_0x7cbc('0x11d')]()[_0x7cbc('0x90')]({'secret':![]})['map'](function(_0x5dca55){if(_0x5dca55[_0x7cbc('0xdf')]){var _0x21ea18=path[_0x7cbc('0xe3')](_0x250841,_0x5dca55[_0x7cbc('0xdf')]['basename']);if(fs[_0x7cbc('0x11e')](_0x21ea18)){fs[_0x7cbc('0x11f')](_0x21ea18)[_0x7cbc('0x120')](fs[_0x7cbc('0x121')](path[_0x7cbc('0xe3')](_0x43d71b,_0x5dca55[_0x7cbc('0xdf')][_0x7cbc('0xdc')])));}}return{'date':moment(_0x5dca55[_0x7cbc('0x86')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x7cbc('0xa2')](),'sender':_0x5dca55['direction']===_0x7cbc('0xd1')?_0x5dca55[_0x7cbc('0x7e')]?_0x5dca55[_0x7cbc('0x7e')][_0x7cbc('0x48')]:'System':_0x5dca55[_0x7cbc('0x70')]['firstName']+(_0x5dca55[_0x7cbc('0x70')][_0x7cbc('0x114')]?'\x20'+_0x5dca55[_0x7cbc('0x70')][_0x7cbc('0x114')]:''),'body':_0x5dca55[_0x7cbc('0xdf')]?_0x5dca55[_0x7cbc('0xdf')][_0x7cbc('0xdc')]:_0x5dca55[_0x7cbc('0x41')],'direction':_0x5dca55['direction']==='out'?'A':'C','secret':_0x5dca55['secret'],'read':_0x5dca55[_0x7cbc('0x8c')],'attachment':_0x5dca55[_0x7cbc('0xdf')]};})[_0x7cbc('0x6d')]()};return ejs[_0x7cbc('0x122')](path[_0x7cbc('0xe3')](config['root'],_0x7cbc('0x10f'),'views','downloadInteraction.html'),{'interaction':_0x301d18})[_0x7cbc('0x3c')](function(_0x10301c){var _0x2d0076=path[_0x7cbc('0xe3')](_0x43d71b,_0x7cbc('0x123')+_0x284d95['id']+'-'+_0x348396+_0x7cbc('0x124'));var _0xef22e2={'path':_0x2d0076,'channel':_0x7cbc('0x117'),'interactionId':_0x284d95['id']};return pdf[_0x7cbc('0x125')](_0x10301c,_0xef22e2);})[_0x7cbc('0x3c')](function(){return new BPromise(function(_0x359385,_0x1e9360){zipdir(_0x43d71b,{'saveTo':_0x20aa92},function(_0x2dfc03,_0x31412c){if(_0x2dfc03)return _0x1e9360(_0x2dfc03);return _0x359385(_0x31412c);});})[_0x7cbc('0x3c')](function(){return new BPromise(function(_0x1f84f7,_0x522775){rimraf(_0x43d71b,function(_0x3fb359){if(_0x3fb359)_0x522775(_0x3fb359);return _0x1f84f7();});});})['then'](function(){return _0x3ea8d0[_0x7cbc('0xe4')](_0x20aa92,_0x37d512,function(_0x39e07a){if(_0x39e07a){console['log'](_0x7cbc('0x126'),_0x39e07a);}else{fs[_0x7cbc('0x127')](_0x20aa92);}});});});}else{return _0x3ea8d0['sendStatus'](0xc8);}})[_0x7cbc('0x2e')](handleError(_0x3ea8d0,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 8af3a33..e09d6e6 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 _0xb7d6=['Users','findAll','length','emit','hasOwnProperty','hook','../../mysqldb','ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue'];(function(_0x1b9fbf,_0x406202){var _0x1f986b=function(_0x5f57b1){while(--_0x5f57b1){_0x1b9fbf['push'](_0x1b9fbf['shift']());}};_0x1f986b(++_0x406202);}(_0xb7d6,0xca));var _0x6b7d=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0xb7d6[_0x1a0daa];return _0x1dbe15;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x6b7d('0x0'))['db'][_0x6b7d('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x6b7d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6b7d('0x3'),'afterDestroy':_0x6b7d('0x4')};function emitEvent(_0xe6c580){return function(_0x1835f4,_0x4ff6ac,_0x944c0b){_0x1835f4[_0x6b7d('0x5')]({'attributes':['id'],'raw':!![]})[_0x6b7d('0x6')](function(_0x3aaf9e){_0x1835f4[_0x6b7d('0x7')](_0x6b7d('0x8'),_0x3aaf9e['map'](function(_0x121c76){return{'id':_0x121c76['id']};}));return ChatMessage[_0x6b7d('0x9')]({'where':{'ChatInteractionId':_0x1835f4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6b7d('0x6')](function(_0x5f0b64){_0x1835f4['setDataValue']('unreadMessages',_0x5f0b64[_0x6b7d('0xa')]);ChatInteractionEvents[_0x6b7d('0xb')](_0xe6c580+':'+_0x1835f4['id'],_0x1835f4);ChatInteractionEvents['emit'](_0xe6c580,_0x1835f4);_0x944c0b(null);})['catch'](_0x944c0b(null));};}for(var e in events){if(events[_0x6b7d('0xc')](e)){var event=events[e];ChatInteraction[_0x6b7d('0xd')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x0570=['Users','map','findAll','then','setDataValue','unreadMessages','length','emit','catch','exports','../../mysqldb','ChatInteraction','setMaxListeners','update','getUsers'];(function(_0x52cafd,_0x46747c){var _0x597f07=function(_0x3eb067){while(--_0x3eb067){_0x52cafd['push'](_0x52cafd['shift']());}};_0x597f07(++_0x46747c);}(_0x0570,0x172));var _0x0057=function(_0x10b7ad,_0x506b66){_0x10b7ad=_0x10b7ad-0x0;var _0x97cecc=_0x0570[_0x10b7ad];return _0x97cecc;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x0057('0x0'))['db'][_0x0057('0x1')];var ChatMessage=require(_0x0057('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x0057('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0057('0x3'),'afterDestroy':'remove'};function emitEvent(_0x27f031){return function(_0x2161b9,_0x216a7a,_0x418a5a){_0x2161b9[_0x0057('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0xc86734){_0x2161b9['setDataValue'](_0x0057('0x5'),_0xc86734[_0x0057('0x6')](function(_0x25fb92){return{'id':_0x25fb92['id']};}));return ChatMessage[_0x0057('0x7')]({'where':{'ChatInteractionId':_0x2161b9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0057('0x8')](function(_0x54f384){_0x2161b9[_0x0057('0x9')](_0x0057('0xa'),_0x54f384[_0x0057('0xb')]);ChatInteractionEvents['emit'](_0x27f031+':'+_0x2161b9['id'],_0x2161b9);ChatInteractionEvents[_0x0057('0xc')](_0x27f031,_0x2161b9);_0x418a5a(null);})[_0x0057('0xd')](_0x418a5a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x0057('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index c828862..b64d314 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 _0x7b6d=['define','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x7b6d,0x1ca));var _0xd7b6=function(_0x3db00a,_0x5aa077){_0x3db00a=_0x3db00a-0x0;var _0x5ab99d=_0x7b6d[_0x3db00a];return _0x5ab99d;};'use strict';var _=require(_0xd7b6('0x0'));var util=require(_0xd7b6('0x1'));var logger=require(_0xd7b6('0x2'))(_0xd7b6('0x3'));var moment=require('moment');var BPromise=require(_0xd7b6('0x4'));var rp=require(_0xd7b6('0x5'));var fs=require('fs');var path=require(_0xd7b6('0x6'));var rimraf=require(_0xd7b6('0x7'));var config=require(_0xd7b6('0x8'));var attributes=require('./chatInteraction.attributes');module[_0xd7b6('0x9')]=function(_0xabb488,_0x5d951a){return _0xabb488[_0xd7b6('0xa')]('ChatInteraction',attributes,{'tableName':_0xd7b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x594ead,_0x5322fe,_0x372d64){if(_0x594ead[_0xd7b6('0xc')](_0xd7b6('0xd'))){_0x594ead[_0xd7b6('0xe')]=moment()['format'](_0xd7b6('0xf'));}_0x372d64(null,_0x594ead);}},'charset':_0xd7b6('0x10'),'collate':_0xd7b6('0x11')});}; \ No newline at end of file +var _0x3958=['api','moment','bluebird','request-promise','path','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3e8931,_0x204ba0){var _0x10fc99=function(_0x5504df){while(--_0x5504df){_0x3e8931['push'](_0x3e8931['shift']());}};_0x10fc99(++_0x204ba0);}(_0x3958,0x141));var _0x8395=function(_0x1e82c6,_0x2be4e4){_0x1e82c6=_0x1e82c6-0x0;var _0x5cd38e=_0x3958[_0x1e82c6];return _0x5cd38e;};'use strict';var _=require(_0x8395('0x0'));var util=require(_0x8395('0x1'));var logger=require(_0x8395('0x2'))(_0x8395('0x3'));var moment=require(_0x8395('0x4'));var BPromise=require(_0x8395('0x5'));var rp=require(_0x8395('0x6'));var fs=require('fs');var path=require(_0x8395('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8395('0x8'));module['exports']=function(_0x482651,_0x13f9b9){return _0x482651[_0x8395('0x9')](_0x8395('0xa'),attributes,{'tableName':_0x8395('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43e1d8,_0x50c6de,_0x27cf6a){if(_0x43e1d8['changed'](_0x8395('0xc'))){_0x43e1d8[_0x8395('0xd')]=moment()[_0x8395('0xe')](_0x8395('0xf'));}_0x27cf6a(null,_0x43e1d8);}},'charset':_0x8395('0x10'),'collate':_0x8395('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index e090be8..fc29e92 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 _0x1349=['AddTagsToChatInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction','options','raw','where','attributes','limit'];(function(_0x412859,_0x1ae81d){var _0x1fc7c2=function(_0xcdb8a7){while(--_0xcdb8a7){_0x412859['push'](_0x412859['shift']());}};_0x1fc7c2(++_0x1ae81d);}(_0x1349,0x8f));var _0x9134=function(_0x4dccfc,_0xd05502){_0x4dccfc=_0x4dccfc-0x0;var _0x3b22a4=_0x1349[_0x4dccfc];return _0x3b22a4;};'use strict';var _=require(_0x9134('0x0'));var util=require(_0x9134('0x1'));var moment=require(_0x9134('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9134('0x3'));var db=require(_0x9134('0x4'))['db'];var utils=require(_0x9134('0x5'));var logger=require(_0x9134('0x6'))(_0x9134('0x7'));var config=require(_0x9134('0x8'));var jayson=require(_0x9134('0x9'));var client=jayson[_0x9134('0xa')][_0x9134('0xb')]({'port':0x232a});config[_0x9134('0xc')]=_[_0x9134('0xd')](config['redis'],{'host':_0x9134('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9134('0xc')]));require(_0x9134('0xf'))[_0x9134('0x10')](socket);function respondWithRpcPromise(_0x2f3c9e,_0x4d44cc,_0x5cc28f){return new BPromise(function(_0x4cf84f,_0x37cd45){return client[_0x9134('0x11')](_0x2f3c9e,_0x5cc28f)[_0x9134('0x12')](function(_0x5515fa){logger['info'](_0x9134('0x13'),_0x4d44cc,_0x9134('0x14'));logger[_0x9134('0x15')](_0x9134('0x16'),_0x4d44cc,_0x9134('0x14'),JSON[_0x9134('0x17')](_0x5515fa));if(_0x5515fa[_0x9134('0x18')]){if(_0x5515fa['error'][_0x9134('0x19')]===0x1f4){logger[_0x9134('0x18')](_0x9134('0x13'),_0x4d44cc,_0x5515fa[_0x9134('0x18')][_0x9134('0x1a')]);return _0x37cd45(_0x5515fa[_0x9134('0x18')][_0x9134('0x1a')]);}logger[_0x9134('0x18')](_0x9134('0x13'),_0x4d44cc,_0x5515fa['error'][_0x9134('0x1a')]);return _0x4cf84f(_0x5515fa[_0x9134('0x18')][_0x9134('0x1a')]);}else{logger[_0x9134('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x4d44cc,_0x9134('0x14'));_0x4cf84f(_0x5515fa[_0x9134('0x1c')][_0x9134('0x1a')]);}})[_0x9134('0x1d')](function(_0x1e46eb){logger[_0x9134('0x18')](_0x9134('0x13'),_0x4d44cc,_0x1e46eb);_0x37cd45(_0x1e46eb);});});}exports[_0x9134('0x1e')]=function(_0x2d9225){var _0x5e782d=this;return new Promise(function(_0x326201,_0x5710ff){return db[_0x9134('0x1f')]['update'](_0x2d9225['body'],{'raw':_0x2d9225[_0x9134('0x20')]?_0x2d9225[_0x9134('0x20')][_0x9134('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d9225[_0x9134('0x20')]?_0x2d9225[_0x9134('0x20')][_0x9134('0x22')]||null:null,'attributes':_0x2d9225['options']?_0x2d9225[_0x9134('0x20')][_0x9134('0x23')]||null:null,'limit':_0x2d9225[_0x9134('0x20')]?_0x2d9225[_0x9134('0x20')][_0x9134('0x24')]||null:null})[_0x9134('0x12')](function(_0x442fd4){logger[_0x9134('0x1b')](_0x9134('0x1e'),_0x2d9225);logger['debug'](_0x9134('0x1e'),_0x2d9225,JSON[_0x9134('0x17')](_0x442fd4));_0x326201(_0x442fd4);})[_0x9134('0x1d')](function(_0x487305){logger[_0x9134('0x18')](_0x9134('0x1e'),_0x487305[_0x9134('0x1a')],_0x2d9225);_0x5710ff(_0x5e782d[_0x9134('0x18')](0x1f4,_0x487305[_0x9134('0x1a')]));});});};exports[_0x9134('0x25')]=function(_0x27ed9a){return new Promise(function(_0x57d54d,_0x5c5c79){return db[_0x9134('0x1f')][_0x9134('0x26')]({'where':_0x27ed9a['options']?_0x27ed9a['options']['where']||null:null})[_0x9134('0x12')](function(_0x564f1c){if(_0x564f1c){return _0x564f1c[_0x9134('0x27')](_0x27ed9a[_0x9134('0x28')][_0x9134('0x29')],_[_0x9134('0x2a')](_0x27ed9a[_0x9134('0x28')],['ids','id'])||{});}})[_0x9134('0x2b')](function(_0x457299){logger[_0x9134('0x1b')](_0x9134('0x2c'),_0x27ed9a);logger[_0x9134('0x15')](_0x9134('0x2c'),_0x27ed9a,JSON[_0x9134('0x17')](_0x457299));_0x57d54d(_0x457299);})[_0x9134('0x1d')](function(_0x3ff2a4){logger[_0x9134('0x18')]('AddTags',_0x3ff2a4[_0x9134('0x1a')],_0x27ed9a);_0x5c5c79(_this['error'](0x1f4,_0x3ff2a4['message']));});});}; \ No newline at end of file +var _0x17a7=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','limit','find','omit','ids','spread','AddTags','stringify','lodash'];(function(_0x2bcf7c,_0x4ddbd9){var _0x553762=function(_0x3b3da4){while(--_0x3b3da4){_0x2bcf7c['push'](_0x2bcf7c['shift']());}};_0x553762(++_0x4ddbd9);}(_0x17a7,0x7d));var _0x717a=function(_0x505c01,_0x4cd33b){_0x505c01=_0x505c01-0x0;var _0x55e0dd=_0x17a7[_0x505c01];return _0x55e0dd;};'use strict';var _=require(_0x717a('0x0'));var util=require(_0x717a('0x1'));var moment=require(_0x717a('0x2'));var BPromise=require('bluebird');var rs=require(_0x717a('0x3'));var fs=require('fs');var Redis=require(_0x717a('0x4'));var db=require(_0x717a('0x5'))['db'];var utils=require(_0x717a('0x6'));var logger=require(_0x717a('0x7'))(_0x717a('0x8'));var config=require(_0x717a('0x9'));var jayson=require(_0x717a('0xa'));var client=jayson[_0x717a('0xb')][_0x717a('0xc')]({'port':0x232a});config['redis']=_[_0x717a('0xd')](config['redis'],{'host':_0x717a('0xe'),'port':0x18eb});var socket=require(_0x717a('0xf'))(new Redis(config[_0x717a('0x10')]));require('./chatInteraction.socket')[_0x717a('0x11')](socket);function respondWithRpcPromise(_0x11cd44,_0x548d8a,_0x16d10e){return new BPromise(function(_0x589a2d,_0x496dd7){return client['request'](_0x11cd44,_0x16d10e)[_0x717a('0x12')](function(_0x44d4f7){logger[_0x717a('0x13')](_0x717a('0x14'),_0x548d8a,'request\x20sent');logger[_0x717a('0x15')](_0x717a('0x16'),_0x548d8a,_0x717a('0x17'),JSON['stringify'](_0x44d4f7));if(_0x44d4f7[_0x717a('0x18')]){if(_0x44d4f7[_0x717a('0x18')][_0x717a('0x19')]===0x1f4){logger[_0x717a('0x18')](_0x717a('0x14'),_0x548d8a,_0x44d4f7[_0x717a('0x18')]['message']);return _0x496dd7(_0x44d4f7['error'][_0x717a('0x1a')]);}logger[_0x717a('0x18')](_0x717a('0x14'),_0x548d8a,_0x44d4f7['error'][_0x717a('0x1a')]);return _0x589a2d(_0x44d4f7[_0x717a('0x18')][_0x717a('0x1a')]);}else{logger[_0x717a('0x13')](_0x717a('0x14'),_0x548d8a,_0x717a('0x17'));_0x589a2d(_0x44d4f7[_0x717a('0x1b')]['message']);}})[_0x717a('0x1c')](function(_0xaca9b4){logger[_0x717a('0x18')](_0x717a('0x14'),_0x548d8a,_0xaca9b4);_0x496dd7(_0xaca9b4);});});}exports[_0x717a('0x1d')]=function(_0x39af1d){var _0x4bf3c2=this;return new Promise(function(_0x364a98,_0xd77f02){return db[_0x717a('0x1e')]['update'](_0x39af1d[_0x717a('0x1f')],{'raw':_0x39af1d[_0x717a('0x20')]?_0x39af1d[_0x717a('0x20')][_0x717a('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39af1d['options']?_0x39af1d[_0x717a('0x20')][_0x717a('0x22')]||null:null,'attributes':_0x39af1d[_0x717a('0x20')]?_0x39af1d[_0x717a('0x20')]['attributes']||null:null,'limit':_0x39af1d[_0x717a('0x20')]?_0x39af1d[_0x717a('0x20')][_0x717a('0x23')]||null:null})['then'](function(_0x89209a){logger[_0x717a('0x13')](_0x717a('0x1d'),_0x39af1d);logger[_0x717a('0x15')](_0x717a('0x1d'),_0x39af1d,JSON['stringify'](_0x89209a));_0x364a98(_0x89209a);})['catch'](function(_0x3ac33e){logger['error']('UpdateChatInteraction',_0x3ac33e['message'],_0x39af1d);_0xd77f02(_0x4bf3c2['error'](0x1f4,_0x3ac33e[_0x717a('0x1a')]));});});};exports['AddTagsToChatInteraction']=function(_0x3ac0cb){return new Promise(function(_0x328cb3,_0x4900cf){return db[_0x717a('0x1e')][_0x717a('0x24')]({'where':_0x3ac0cb['options']?_0x3ac0cb[_0x717a('0x20')][_0x717a('0x22')]||null:null})[_0x717a('0x12')](function(_0x56803a){if(_0x56803a){return _0x56803a['addTags'](_0x3ac0cb[_0x717a('0x1f')]['ids'],_[_0x717a('0x25')](_0x3ac0cb['body'],[_0x717a('0x26'),'id'])||{});}})[_0x717a('0x27')](function(_0x1a7738){logger[_0x717a('0x13')]('AddTags',_0x3ac0cb);logger[_0x717a('0x15')](_0x717a('0x28'),_0x3ac0cb,JSON[_0x717a('0x29')](_0x1a7738));_0x328cb3(_0x1a7738);})['catch'](function(_0x25be3b){logger[_0x717a('0x18')](_0x717a('0x28'),_0x25be3b[_0x717a('0x1a')],_0x3ac0cb);_0x4900cf(_this['error'](0x1f4,_0x25be3b[_0x717a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 19e9160..ef38616 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 _0xd87e=['length','./chatInteraction.events','remove','register'];(function(_0x17601d,_0x274052){var _0x3ab50a=function(_0x1b8f7f){while(--_0x1b8f7f){_0x17601d['push'](_0x17601d['shift']());}};_0x3ab50a(++_0x274052);}(_0xd87e,0x10d));var _0xed87=function(_0x432d74,_0x51d55b){_0x432d74=_0x432d74-0x0;var _0x3b2daa=_0xd87e[_0x432d74];return _0x3b2daa;};'use strict';var ChatInteractionEvents=require(_0xed87('0x0'));var events=['save',_0xed87('0x1'),'update'];function createListener(_0x4302c0,_0x4f756d){return function(_0x1c1bd4){_0x4f756d['emit'](_0x4302c0,_0x1c1bd4);};}function removeListener(_0x254578,_0x27df7f){return function(){ChatInteractionEvents['removeListener'](_0x254578,_0x27df7f);};}exports[_0xed87('0x2')]=function(_0x4222a5){for(var _0x1db47e=0x0,_0xa7719d=events[_0xed87('0x3')];_0x1db47e<_0xa7719d;_0x1db47e++){var _0x433872=events[_0x1db47e];var _0x30fd3c=createListener('chatInteraction:'+_0x433872,_0x4222a5);ChatInteractionEvents['on'](_0x433872,_0x30fd3c);}}; \ No newline at end of file +var _0x2455=['register','./chatInteraction.events','save','remove','update','removeListener'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x2455,0xd3));var _0x5245=function(_0x50f92b,_0x32fab3){_0x50f92b=_0x50f92b-0x0;var _0x5cedbc=_0x2455[_0x50f92b];return _0x5cedbc;};'use strict';var ChatInteractionEvents=require(_0x5245('0x0'));var events=[_0x5245('0x1'),_0x5245('0x2'),_0x5245('0x3')];function createListener(_0x1f4446,_0x557700){return function(_0x5d7f64){_0x557700['emit'](_0x1f4446,_0x5d7f64);};}function removeListener(_0x3f1460,_0x1a162c){return function(){ChatInteractionEvents[_0x5245('0x4')](_0x3f1460,_0x1a162c);};}exports[_0x5245('0x5')]=function(_0x2f07d5){for(var _0x663a3=0x0,_0x5e2cde=events['length'];_0x663a3<_0x5e2cde;_0x663a3++){var _0x440eed=events[_0x663a3];var _0x313ef9=createListener('chatInteraction:'+_0x440eed,_0x2f07d5);ChatInteractionEvents['on'](_0x440eed,_0x313ef9);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 5a98252..a81b1f4 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 _0x8515=['tracked','chat','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload','single','file','addMessage'];(function(_0x24e3be,_0xab3bdd){var _0xc47b7e=function(_0x4a470d){while(--_0x4a470d){_0x24e3be['push'](_0x24e3be['shift']());}};_0xc47b7e(++_0xab3bdd);}(_0x8515,0x80));var _0x5851=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0x8515[_0x496738];return _0xee1381;};'use strict';var multer=require(_0x5851('0x0'));var util=require(_0x5851('0x1'));var path=require(_0x5851('0x2'));var timeout=require(_0x5851('0x3'));var express=require(_0x5851('0x4'));var router=express[_0x5851('0x5')]();var fs_extra=require(_0x5851('0x6'));var auth=require(_0x5851('0x7'));var interaction=require(_0x5851('0x8'));var config=require(_0x5851('0x9'));var controller=require(_0x5851('0xa'));router[_0x5851('0xb')]('/',auth[_0x5851('0xc')](),controller['index']);router[_0x5851('0xb')](_0x5851('0xd'),auth[_0x5851('0xc')](),controller[_0x5851('0xe')]);router['get'](_0x5851('0xf'),auth[_0x5851('0x10')](),controller[_0x5851('0x11')]);router[_0x5851('0xb')](_0x5851('0x12'),auth[_0x5851('0x10')](),controller[_0x5851('0x13')]);router[_0x5851('0xb')](_0x5851('0x14'),auth[_0x5851('0xc')](),controller[_0x5851('0x15')]);router[_0x5851('0xb')](_0x5851('0x16'),auth['isChatInteractionAuthorized'](),controller[_0x5851('0x17')]);router['get'](_0x5851('0x18'),auth[_0x5851('0xc')](),controller[_0x5851('0x19')]);router[_0x5851('0x1a')]('/',auth[_0x5851('0xc')](),controller['create']);router[_0x5851('0x1a')](_0x5851('0x1b'),auth['isAuthenticated'](),controller[_0x5851('0x1c')]);var upload=multer({'storage':multer[_0x5851('0x1d')]({'destination':function(_0x317a95,_0x182409,_0x29f05e){_0x29f05e(null,path['join'](config[_0x5851('0x1e')],_0x5851('0x1f')));},'filename':function(_0x306f51,_0x1f6873,_0x28f6d7){_0x28f6d7(null,util[_0x5851('0x20')](_0x5851('0x21'),Date['now'](),_0x1f6873[_0x5851('0x22')][_0x5851('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5851('0x1a')](_0x5851('0x24'),upload[_0x5851('0x25')](_0x5851('0x26')),controller['attachmentUpload']);router[_0x5851('0x1a')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0x5851('0x27')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x5851('0x28')](_0x5851('0x29'),'chatinteraction:addtags'),controller[_0x5851('0x2a')]);router[_0x5851('0x2b')](_0x5851('0xf'),auth[_0x5851('0xc')](),interaction[_0x5851('0x28')]('chat',_0x5851('0x2c')),controller[_0x5851('0x2d')]);router[_0x5851('0x2b')](_0x5851('0x2e'),controller[_0x5851('0x2f')]);router[_0x5851('0x2b')](_0x5851('0x30'),auth['isChatInteractionAuthorized'](),controller[_0x5851('0x31')]);router[_0x5851('0x2b')](_0x5851('0x32'),controller[_0x5851('0x33')]);router[_0x5851('0x34')](_0x5851('0xf'),auth[_0x5851('0xc')](),interaction[_0x5851('0x28')]('chat','chatinteraction:destroy'),controller[_0x5851('0x35')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x5851('0x36')]);module[_0x5851('0x37')]=router; \ No newline at end of file +var _0x4f63=['join','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','tracked','chatinteraction:addtags','addTags','put','/:id','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','create','post','/:id/vidaoo','createVidaooSession','diskStorage'];(function(_0x3b29d5,_0x12faa2){var _0x20b96d=function(_0x284207){while(--_0x284207){_0x3b29d5['push'](_0x3b29d5['shift']());}};_0x20b96d(++_0x12faa2);}(_0x4f63,0xc2));var _0x34f6=function(_0x8ed2fe,_0x19ca78){_0x8ed2fe=_0x8ed2fe-0x0;var _0x23a751=_0x4f63[_0x8ed2fe];return _0x23a751;};'use strict';var multer=require(_0x34f6('0x0'));var util=require(_0x34f6('0x1'));var path=require(_0x34f6('0x2'));var timeout=require(_0x34f6('0x3'));var express=require(_0x34f6('0x4'));var router=express[_0x34f6('0x5')]();var fs_extra=require(_0x34f6('0x6'));var auth=require(_0x34f6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x34f6('0x8'));var controller=require('./chatInteraction.controller');router[_0x34f6('0x9')]('/',auth[_0x34f6('0xa')](),controller[_0x34f6('0xb')]);router['get'](_0x34f6('0xc'),auth[_0x34f6('0xa')](),controller[_0x34f6('0xd')]);router[_0x34f6('0x9')]('/:id',auth[_0x34f6('0xe')](),controller['show']);router[_0x34f6('0x9')]('/:id/attachment_download',auth[_0x34f6('0xe')](),controller[_0x34f6('0xf')]);router[_0x34f6('0x9')](_0x34f6('0x10'),auth[_0x34f6('0xa')](),controller[_0x34f6('0x11')]);router[_0x34f6('0x9')](_0x34f6('0x12'),auth[_0x34f6('0xe')](),controller[_0x34f6('0x13')]);router['get'](_0x34f6('0x14'),auth[_0x34f6('0xa')](),controller['download']);router['post']('/',auth[_0x34f6('0xa')](),controller[_0x34f6('0x15')]);router[_0x34f6('0x16')](_0x34f6('0x17'),auth[_0x34f6('0xa')](),controller[_0x34f6('0x18')]);var upload=multer({'storage':multer[_0x34f6('0x19')]({'destination':function(_0x4b223d,_0xfe1997,_0x3843f3){_0x3843f3(null,path[_0x34f6('0x1a')](config[_0x34f6('0x1b')],_0x34f6('0x1c')));},'filename':function(_0x335857,_0x27defb,_0x444714){_0x444714(null,util['format'](_0x34f6('0x1d'),Date[_0x34f6('0x1e')](),_0x27defb[_0x34f6('0x1f')][_0x34f6('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x34f6('0x16')](_0x34f6('0x21'),upload[_0x34f6('0x22')](_0x34f6('0x23')),controller[_0x34f6('0x24')]);router[_0x34f6('0x16')](_0x34f6('0x10'),auth[_0x34f6('0xe')](),controller['addMessage']);router['post']('/:id/tags',auth[_0x34f6('0xa')](),interaction[_0x34f6('0x25')]('chat',_0x34f6('0x26')),controller[_0x34f6('0x27')]);router[_0x34f6('0x28')](_0x34f6('0x29'),auth[_0x34f6('0xa')](),interaction['tracked'](_0x34f6('0x2a'),_0x34f6('0x2b')),controller[_0x34f6('0x2c')]);router[_0x34f6('0x28')](_0x34f6('0x2d'),controller[_0x34f6('0x2e')]);router[_0x34f6('0x28')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x34f6('0x2f')]);router[_0x34f6('0x28')]('/:id/close',controller[_0x34f6('0x30')]);router[_0x34f6('0x31')](_0x34f6('0x29'),auth[_0x34f6('0xa')](),interaction[_0x34f6('0x25')](_0x34f6('0x2a'),_0x34f6('0x32')),controller[_0x34f6('0x33')]);router[_0x34f6('0x31')](_0x34f6('0x34'),auth[_0x34f6('0xa')](),controller[_0x34f6('0x35')]);module[_0x34f6('0x36')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 27b2d5f..7d08c16 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 _0xda2d=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0x3966df,_0x52f6d8){var _0x305bd6=function(_0x445662){while(--_0x445662){_0x3966df['push'](_0x3966df['shift']());}};_0x305bd6(++_0x52f6d8);}(_0xda2d,0x102));var _0xdda2=function(_0x470f03,_0x552b31){_0x470f03=_0x470f03-0x0;var _0x5afc7b=_0xda2d[_0x470f03];return _0x5afc7b;};'use strict';var Sequelize=require('sequelize');module[_0xdda2('0x0')]={'body':{'type':Sequelize[_0xdda2('0x1')](_0xdda2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdda2('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xdda2('0x4')]}}; \ No newline at end of file +var _0x5f2f=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x9a7375,_0x233724){var _0x24c588=function(_0x51e3f3){while(--_0x51e3f3){_0x9a7375['push'](_0x9a7375['shift']());}};_0x24c588(++_0x233724);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5bdab3,_0x3fa942){_0x5bdab3=_0x5bdab3-0x0;var _0x888f97=_0x5f2f[_0x5bdab3];return _0x888f97;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf5f2('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index dc21aac..8f12adb 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 _0xdb94=['moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','end','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','render','merge','body','message','agent','interaction','account','rawAttributes','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','update','describe','messages','lastMessageAt','createdAt','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','admin','user','fullname','role','internal','online','lastLoginAt','showWebBar','-online','VoiceQueue','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','rimraf','zip-dir','request-promise'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xdb94,0xe5));var _0x4db9=function(_0x336b7e,_0x371cf4){_0x336b7e=_0x336b7e-0x0;var _0x5a7b42=_0xdb94[_0x336b7e];return _0x5a7b42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4db9('0x0'));var zipdir=require(_0x4db9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4db9('0x2'));var moment=require(_0x4db9('0x3'));var BPromise=require(_0x4db9('0x4'));var Mustache=require(_0x4db9('0x5'));var util=require(_0x4db9('0x6'));var path=require('path');var sox=require(_0x4db9('0x7'));var csv=require('to-csv');var ejs=require(_0x4db9('0x8'));var fs=require('fs');var fs_extra=require(_0x4db9('0x9'));var _=require(_0x4db9('0xa'));var squel=require(_0x4db9('0xb'));var crypto=require(_0x4db9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4db9('0xd'));var toCsv=require(_0x4db9('0xe'));var querystring=require(_0x4db9('0xf'));var Papa=require(_0x4db9('0x10'));var Redis=require(_0x4db9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4db9('0x12'));var as=require(_0x4db9('0x13'));var hardwareService=require(_0x4db9('0x14'));var logger=require(_0x4db9('0x15'))(_0x4db9('0x16'));var utils=require(_0x4db9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4db9('0x18'));var db=require(_0x4db9('0x19'))['db'];config['redis']=_['defaults'](config[_0x4db9('0x1a')],{'host':_0x4db9('0x1b'),'port':0x18eb});var socket=require(_0x4db9('0x1c'))(new Redis(config['redis']));require(_0x4db9('0x1d'))[_0x4db9('0x1e')](socket);function respondWithStatusCode(_0x2018d2,_0x1ea47d){_0x1ea47d=_0x1ea47d||0xcc;return function(_0x2d89a7){if(_0x2d89a7){return _0x2018d2['sendStatus'](_0x1ea47d);}return _0x2018d2[_0x4db9('0x1f')](_0x1ea47d)[_0x4db9('0x20')]();};}function respondWithResult(_0x5d4d70,_0x27b387){_0x27b387=_0x27b387||0xc8;return function(_0x7df575){if(_0x7df575){return _0x5d4d70[_0x4db9('0x1f')](_0x27b387)['json'](_0x7df575);}};}function respondWithFilteredResult(_0xedc513,_0x3b0863){return function(_0x4c5f4f){if(_0x4c5f4f){var _0x50f685=typeof _0x3b0863['offset']===_0x4db9('0x21')&&typeof _0x3b0863[_0x4db9('0x22')]==='undefined';var _0x375515=_0x4c5f4f[_0x4db9('0x23')];var _0x353718=_0x50f685?0x0:_0x3b0863[_0x4db9('0x24')];var _0x439433=_0x50f685?_0x4c5f4f[_0x4db9('0x23')]:_0x3b0863[_0x4db9('0x24')]+_0x3b0863[_0x4db9('0x22')];var _0x3256f4;if(_0x439433>=_0x375515){_0x439433=_0x375515;_0x3256f4=0xc8;}else{_0x3256f4=0xce;}_0xedc513[_0x4db9('0x1f')](_0x3256f4);return _0xedc513[_0x4db9('0x25')](_0x4db9('0x26'),_0x353718+'-'+_0x439433+'/'+_0x375515)['json'](_0x4c5f4f);}return null;};}function patchUpdates(_0x42cc40){return function(_0x2917bd){try{jsonpatch['apply'](_0x2917bd,_0x42cc40,!![]);}catch(_0x37c81f){return BPromise[_0x4db9('0x27')](_0x37c81f);}return _0x2917bd[_0x4db9('0x28')]();};}function saveUpdates(_0x402898,_0x4928c5){return function(_0xe3dbe){if(_0xe3dbe){return _0xe3dbe['update'](_0x402898)[_0x4db9('0x29')](function(_0x1c82b6){return _0x1c82b6;});}return null;};}function removeEntity(_0x135aa7,_0x47e89c){return function(_0x293933){if(_0x293933){return _0x293933[_0x4db9('0x2a')]()[_0x4db9('0x29')](function(){_0x135aa7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b2647,_0x5ce6cc){return function(_0x910137){if(!_0x910137){_0x1b2647[_0x4db9('0x2b')](0x194);}return _0x910137;};}function handleError(_0x38d5e2,_0x19e0be){_0x19e0be=_0x19e0be||0x1f4;return function(_0x384df5){logger[_0x4db9('0x2c')](_0x384df5[_0x4db9('0x2d')]);if(_0x384df5[_0x4db9('0x2e')]){delete _0x384df5['name'];}_0x38d5e2[_0x4db9('0x1f')](_0x19e0be)['send'](_0x384df5);};}function getMustacheRender(_0x3b0663,_0x33eb9e){return Mustache[_0x4db9('0x2f')](_0x3b0663,_[_0x4db9('0x30')](_0x33eb9e[_0x4db9('0x31')],{'contact':_0x33eb9e['contact'],'message':_0x33eb9e[_0x4db9('0x32')],'agent':_0x33eb9e[_0x4db9('0x33')],'interaction':_0x33eb9e[_0x4db9('0x34')],'account':_0x33eb9e[_0x4db9('0x35')]}))||'';}exports['index']=function(_0x553d07,_0x15841b){var _0x39e528={},_0x5c28db={},_0x5e93aa={'count':0x0,'rows':[]};var _0x3783f2=_['map'](db['ChatInternalMessage'][_0x4db9('0x36')],function(_0x83f4e8){return{'name':_0x83f4e8['fieldName'],'type':_0x83f4e8[_0x4db9('0x37')][_0x4db9('0x38')]};});_0x5c28db[_0x4db9('0x39')]=_[_0x4db9('0x3a')](_0x3783f2,'name');_0x5c28db[_0x4db9('0x3b')]=_['keys'](_0x553d07['query']);_0x5c28db['filters']=_[_0x4db9('0x3c')](_0x5c28db[_0x4db9('0x39')],_0x5c28db['query']);_0x39e528[_0x4db9('0x3d')]=_[_0x4db9('0x3c')](_0x5c28db['model'],qs['fields'](_0x553d07['query'][_0x4db9('0x3e')]));_0x39e528['attributes']=_0x39e528[_0x4db9('0x3d')]['length']?_0x39e528[_0x4db9('0x3d')]:_0x5c28db[_0x4db9('0x39')];if(!_0x553d07[_0x4db9('0x3b')][_0x4db9('0x3f')](_0x4db9('0x40'))){_0x39e528['limit']=qs[_0x4db9('0x22')](_0x553d07['query'][_0x4db9('0x22')]);_0x39e528[_0x4db9('0x24')]=qs[_0x4db9('0x24')](_0x553d07[_0x4db9('0x3b')][_0x4db9('0x24')]);}_0x39e528[_0x4db9('0x41')]=qs['sort'](_0x553d07[_0x4db9('0x3b')][_0x4db9('0x42')]);_0x39e528['where']=qs['filters'](_[_0x4db9('0x43')](_0x553d07[_0x4db9('0x3b')],_0x5c28db[_0x4db9('0x44')]),_0x3783f2);if(_0x553d07[_0x4db9('0x3b')][_0x4db9('0x45')]){_0x39e528[_0x4db9('0x46')]=_[_0x4db9('0x30')](_0x39e528[_0x4db9('0x46')],{'$or':_[_0x4db9('0x3a')](_0x3783f2,function(_0x130310){if(_0x130310[_0x4db9('0x37')]!==_0x4db9('0x47')){var _0x489967={};_0x489967[_0x130310[_0x4db9('0x2e')]]={'$like':'%'+_0x553d07[_0x4db9('0x3b')][_0x4db9('0x45')]+'%'};return _0x489967;}})});}_0x39e528=_[_0x4db9('0x30')]({},_0x39e528,_0x553d07['options']);var _0x57d32d={'where':_0x39e528[_0x4db9('0x46')]};return db[_0x4db9('0x48')][_0x4db9('0x23')](_0x57d32d)['then'](function(_0x461878){_0x5e93aa['count']=_0x461878;if(_0x553d07[_0x4db9('0x3b')][_0x4db9('0x49')]){_0x39e528[_0x4db9('0x4a')]=[{'all':!![]}];}return db[_0x4db9('0x48')][_0x4db9('0x4b')](_0x39e528);})['then'](function(_0x302f15){_0x5e93aa[_0x4db9('0x4c')]=_0x302f15;return _0x5e93aa;})[_0x4db9('0x29')](respondWithFilteredResult(_0x15841b,_0x39e528))[_0x4db9('0x4d')](handleError(_0x15841b,null));};exports[_0x4db9('0x4e')]=function(_0x48d591,_0x38d554){var _0x366077={'raw':!![],'where':{'id':_0x48d591[_0x4db9('0x4f')]['id']}},_0x34fc31={};_0x34fc31[_0x4db9('0x39')]=_[_0x4db9('0x50')](db[_0x4db9('0x48')][_0x4db9('0x36')]);_0x34fc31[_0x4db9('0x3b')]=_['keys'](_0x48d591[_0x4db9('0x3b')]);_0x34fc31['filters']=_['intersection'](_0x34fc31[_0x4db9('0x39')],_0x34fc31[_0x4db9('0x3b')]);_0x366077['attributes']=_['intersection'](_0x34fc31[_0x4db9('0x39')],qs[_0x4db9('0x3e')](_0x48d591[_0x4db9('0x3b')][_0x4db9('0x3e')]));_0x366077[_0x4db9('0x3d')]=_0x366077[_0x4db9('0x3d')][_0x4db9('0x51')]?_0x366077[_0x4db9('0x3d')]:_0x34fc31[_0x4db9('0x39')];if(_0x48d591[_0x4db9('0x3b')][_0x4db9('0x49')]){_0x366077['include']=[{'all':!![]}];}_0x366077=_[_0x4db9('0x30')]({},_0x366077,_0x48d591[_0x4db9('0x52')]);return db['ChatInternalMessage'][_0x4db9('0x53')](_0x366077)['then'](handleEntityNotFound(_0x38d554,null))[_0x4db9('0x29')](respondWithResult(_0x38d554,null))[_0x4db9('0x4d')](handleError(_0x38d554,null));};exports[_0x4db9('0x54')]=function(_0x2a5a98,_0x3d8df3){return db[_0x4db9('0x48')][_0x4db9('0x54')](_0x2a5a98[_0x4db9('0x31')],{})[_0x4db9('0x29')](respondWithResult(_0x3d8df3,0xc9))[_0x4db9('0x4d')](handleError(_0x3d8df3,null));};exports[_0x4db9('0x55')]=function(_0x2bfe78,_0x1bbdb8){if(_0x2bfe78['body']['id']){delete _0x2bfe78['body']['id'];}return db['ChatInternalMessage'][_0x4db9('0x53')]({'where':{'id':_0x2bfe78['params']['id']}})[_0x4db9('0x29')](handleEntityNotFound(_0x1bbdb8,null))['then'](saveUpdates(_0x2bfe78[_0x4db9('0x31')],null))[_0x4db9('0x29')](respondWithResult(_0x1bbdb8,null))['catch'](handleError(_0x1bbdb8,null));};exports['destroy']=function(_0x475b2f,_0x3f2674){return db[_0x4db9('0x48')][_0x4db9('0x53')]({'where':{'id':_0x475b2f[_0x4db9('0x4f')]['id']}})[_0x4db9('0x29')](handleEntityNotFound(_0x3f2674,null))[_0x4db9('0x29')](removeEntity(_0x3f2674,null))[_0x4db9('0x4d')](handleError(_0x3f2674,null));};exports['describe']=function(_0x129211,_0x43253f){return db[_0x4db9('0x48')][_0x4db9('0x56')]()[_0x4db9('0x29')](respondWithResult(_0x43253f,null))['catch'](handleError(_0x43253f,null));};function wrapUser(_0x319d69){return function(_0x351b61){var _0x204b92=_0x319d69['get']({'plain':!![]});_0x204b92[_0x4db9('0x57')]=[];if(_0x351b61){_0x204b92[_0x4db9('0x58')]=_0x351b61[_0x4db9('0x59')];_0x204b92['lastMessage']=_0x351b61;}else{_0x204b92[_0x4db9('0x58')]=moment(0x0)['format'](_0x4db9('0x5a'));_0x204b92[_0x4db9('0x5b')]={};}return _0x204b92;};}exports[_0x4db9('0x5c')]=function(_0x57dedc,_0x3544bf,_0x475ed6){var _0x5a8a1b=[];return db[_0x4db9('0x5d')][_0x4db9('0x4b')]({'where':{'role':[_0x4db9('0x33'),_0x4db9('0x5e'),_0x4db9('0x5f')]},'attributes':['id',_0x4db9('0x60'),_0x4db9('0x2e'),_0x4db9('0x61'),'userpic',_0x4db9('0x62'),_0x4db9('0x63'),_0x4db9('0x64'),'allowmessenger',_0x4db9('0x65')],'order':qs[_0x4db9('0x42')](_0x4db9('0x66')),'include':[{'model':db[_0x4db9('0x67')],'as':'VoiceQueues','attributes':['id',_0x4db9('0x2e'),_0x4db9('0x37')],'through':{'attributes':[]}}]})[_0x4db9('0x29')](function(_0x226023){if(_0x226023){var _0x2659ba=_0x57dedc[_0x4db9('0x5f')][_0x4db9('0x68')]({'plain':!![]});if(!_0x2659ba)throw new Error(_0x4db9('0x69'));if(_0x2659ba['role']===_0x4db9('0x5f')){return db[_0x4db9('0x6a')][_0x4db9('0x53')]({'where':{'name':'Agents','userProfileId':_0x2659ba['userProfileId']},'raw':!![]})[_0x4db9('0x29')](function(_0x3ba3e0){if(_0x3ba3e0){if(_0x3ba3e0['autoAssociation']===0x0){return db[_0x4db9('0x6b')]['findAll']({'where':{'sectionId':_0x3ba3e0['id']},'raw':!![]})[_0x4db9('0x29')](function(_0x447a45){var _0x111646=[];if(_[_0x4db9('0x6c')](_0x447a45)){_0x111646=_[_0x4db9('0x45')](_0x226023,function(_0x2024ec){if(_0x2024ec[_0x4db9('0x61')]!==_0x4db9('0x33')){return _0x2024ec;}});return _0x111646;}else{for(var _0x56fdf8=0x0;_0x56fdf8<_0x226023[_0x4db9('0x51')];_0x56fdf8++){var _0xc1b476=_0x226023[_0x56fdf8];if(_0xc1b476[_0x4db9('0x61')]===_0x4db9('0x33')){var _0x21598f=_[_0x4db9('0x53')](_0x447a45,function(_0x2b9e99){return _0x2b9e99[_0x4db9('0x6d')]===_0xc1b476['id'];});if(_0x21598f)_0x111646['push'](_0xc1b476);}else{_0x111646[_0x4db9('0x6e')](_0xc1b476);}}return _0x111646;}});}else{return _0x226023;}}else{var _0x5c985c=_['filter'](_0x226023,function(_0x4d0541){if(_0x4d0541[_0x4db9('0x61')]!==_0x4db9('0x33')){return _0x4d0541;}});return _0x5c985c;}});}else{return _0x226023;}}})[_0x4db9('0x29')](function(_0x20f97c){var _0x3c76ac=[];if(_0x20f97c){_0x5a8a1b=_0x20f97c;for(var _0x1db7d9=0x0;_0x1db7d9<_0x20f97c[_0x4db9('0x51')];_0x1db7d9+=0x1){_0x5a8a1b[_0x1db7d9][_0x4db9('0x57')]=[];_0x3c76ac['push'](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x57dedc['user']['id'],_0x20f97c[_0x1db7d9]['id']],'ToId':[_0x57dedc[_0x4db9('0x5f')]['id'],_0x20f97c[_0x1db7d9]['id']],'ChatGroupId':null},'attributes':['id',_0x4db9('0x59'),_0x4db9('0x6f'),_0x4db9('0x70'),_0x4db9('0x71'),_0x4db9('0x31')],'order':qs[_0x4db9('0x42')](_0x4db9('0x72')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x20f97c[_0x1db7d9])));}return BPromise[_0x4db9('0x73')](_0x3c76ac);}return[];})[_0x4db9('0x29')](function(_0x35f8d3){return{'rows':_0x35f8d3,'count':_0x35f8d3['length']};})[_0x4db9('0x29')](respondWithResult(_0x3544bf,null))['catch'](handleError(_0x3544bf,null));}; \ No newline at end of file +var _0x9957=['get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','admin','user','role','userpic','internal','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','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','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','render','merge','body','contact','message','agent','index','ChatInternalMessage','rawAttributes','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','intersection','find','params','describe'];(function(_0x4a392e,_0x44d3f2){var _0x4dd3b1=function(_0x2480d0){while(--_0x2480d0){_0x4a392e['push'](_0x4a392e['shift']());}};_0x4dd3b1(++_0x44d3f2);}(_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'];config[_0x7995('0x1b')]=_[_0x7995('0x1c')](config[_0x7995('0x1b')],{'host':_0x7995('0x1d'),'port':0x18eb});var socket=require(_0x7995('0x1e'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x7995('0x1f')](socket);function respondWithStatusCode(_0x2233dd,_0x24b5bb){_0x24b5bb=_0x24b5bb||0xcc;return function(_0x321ae8){if(_0x321ae8){return _0x2233dd[_0x7995('0x20')](_0x24b5bb);}return _0x2233dd[_0x7995('0x21')](_0x24b5bb)[_0x7995('0x22')]();};}function respondWithResult(_0x41cbf0,_0x5377e5){_0x5377e5=_0x5377e5||0xc8;return function(_0x2eeacc){if(_0x2eeacc){return _0x41cbf0['status'](_0x5377e5)[_0x7995('0x23')](_0x2eeacc);}};}function respondWithFilteredResult(_0x37f297,_0x43d4b8){return function(_0x291317){if(_0x291317){var _0x1e1415=typeof _0x43d4b8[_0x7995('0x24')]==='undefined'&&typeof _0x43d4b8['limit']===_0x7995('0x25');var _0x5e6f90=_0x291317['count'];var _0x3ec178=_0x1e1415?0x0:_0x43d4b8[_0x7995('0x24')];var _0x4cbe10=_0x1e1415?_0x291317[_0x7995('0x26')]:_0x43d4b8['offset']+_0x43d4b8['limit'];var _0x3e4c54;if(_0x4cbe10>=_0x5e6f90){_0x4cbe10=_0x5e6f90;_0x3e4c54=0xc8;}else{_0x3e4c54=0xce;}_0x37f297[_0x7995('0x21')](_0x3e4c54);return _0x37f297[_0x7995('0x27')](_0x7995('0x28'),_0x3ec178+'-'+_0x4cbe10+'/'+_0x5e6f90)[_0x7995('0x23')](_0x291317);}return null;};}function patchUpdates(_0x1c278a){return function(_0x5d40ae){try{jsonpatch[_0x7995('0x29')](_0x5d40ae,_0x1c278a,!![]);}catch(_0x46ee4b){return BPromise[_0x7995('0x2a')](_0x46ee4b);}return _0x5d40ae[_0x7995('0x2b')]();};}function saveUpdates(_0x563799,_0x13bc35){return function(_0x475351){if(_0x475351){return _0x475351[_0x7995('0x2c')](_0x563799)['then'](function(_0x39df42){return _0x39df42;});}return null;};}function removeEntity(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(_0x268ce7){return _0x268ce7[_0x7995('0x2d')]()[_0x7995('0x2e')](function(){_0x34e70c['status'](0xcc)[_0x7995('0x22')]();});}};}function handleEntityNotFound(_0x5911c3,_0x229742){return function(_0x49bc7e){if(!_0x49bc7e){_0x5911c3[_0x7995('0x20')](0x194);}return _0x49bc7e;};}function handleError(_0x132a42,_0x11c1eb){_0x11c1eb=_0x11c1eb||0x1f4;return function(_0x4b6f99){logger[_0x7995('0x2f')](_0x4b6f99['stack']);if(_0x4b6f99[_0x7995('0x30')]){delete _0x4b6f99[_0x7995('0x30')];}_0x132a42[_0x7995('0x21')](_0x11c1eb)['send'](_0x4b6f99);};}function getMustacheRender(_0x530611,_0x48e573){return Mustache[_0x7995('0x31')](_0x530611,_[_0x7995('0x32')](_0x48e573[_0x7995('0x33')],{'contact':_0x48e573[_0x7995('0x34')],'message':_0x48e573[_0x7995('0x35')],'agent':_0x48e573[_0x7995('0x36')],'interaction':_0x48e573['interaction'],'account':_0x48e573['account']}))||'';}exports[_0x7995('0x37')]=function(_0x5524af,_0x553671){var _0x3eb566={},_0x29fac5={},_0x1e9fa4={'count':0x0,'rows':[]};var _0x1f7d27=_['map'](db[_0x7995('0x38')][_0x7995('0x39')],function(_0x5dd802){return{'name':_0x5dd802['fieldName'],'type':_0x5dd802['type'][_0x7995('0x3a')]};});_0x29fac5[_0x7995('0x3b')]=_['map'](_0x1f7d27,_0x7995('0x30'));_0x29fac5['query']=_[_0x7995('0x3c')](_0x5524af[_0x7995('0x3d')]);_0x29fac5[_0x7995('0x3e')]=_['intersection'](_0x29fac5['model'],_0x29fac5[_0x7995('0x3d')]);_0x3eb566['attributes']=_['intersection'](_0x29fac5[_0x7995('0x3b')],qs[_0x7995('0x3f')](_0x5524af['query'][_0x7995('0x3f')]));_0x3eb566[_0x7995('0x40')]=_0x3eb566[_0x7995('0x40')][_0x7995('0x41')]?_0x3eb566[_0x7995('0x40')]:_0x29fac5['model'];if(!_0x5524af[_0x7995('0x3d')][_0x7995('0x42')](_0x7995('0x43'))){_0x3eb566[_0x7995('0x44')]=qs['limit'](_0x5524af[_0x7995('0x3d')][_0x7995('0x44')]);_0x3eb566[_0x7995('0x24')]=qs[_0x7995('0x24')](_0x5524af[_0x7995('0x3d')][_0x7995('0x24')]);}_0x3eb566['order']=qs[_0x7995('0x45')](_0x5524af[_0x7995('0x3d')][_0x7995('0x45')]);_0x3eb566[_0x7995('0x46')]=qs[_0x7995('0x3e')](_[_0x7995('0x47')](_0x5524af[_0x7995('0x3d')],_0x29fac5[_0x7995('0x3e')]),_0x1f7d27);if(_0x5524af[_0x7995('0x3d')][_0x7995('0x48')]){_0x3eb566[_0x7995('0x46')]=_[_0x7995('0x32')](_0x3eb566[_0x7995('0x46')],{'$or':_['map'](_0x1f7d27,function(_0x50a98e){if(_0x50a98e[_0x7995('0x49')]!==_0x7995('0x4a')){var _0x58523e={};_0x58523e[_0x50a98e['name']]={'$like':'%'+_0x5524af[_0x7995('0x3d')]['filter']+'%'};return _0x58523e;}})});}_0x3eb566=_['merge']({},_0x3eb566,_0x5524af[_0x7995('0x4b')]);var _0x36e28b={'where':_0x3eb566[_0x7995('0x46')]};return db['ChatInternalMessage'][_0x7995('0x26')](_0x36e28b)['then'](function(_0x3993b5){_0x1e9fa4['count']=_0x3993b5;if(_0x5524af['query'][_0x7995('0x4c')]){_0x3eb566[_0x7995('0x4d')]=[{'all':!![]}];}return db[_0x7995('0x38')][_0x7995('0x4e')](_0x3eb566);})['then'](function(_0x3c5cde){_0x1e9fa4[_0x7995('0x4f')]=_0x3c5cde;return _0x1e9fa4;})[_0x7995('0x2e')](respondWithFilteredResult(_0x553671,_0x3eb566))[_0x7995('0x50')](handleError(_0x553671,null));};exports['show']=function(_0x5f28e7,_0x1c37c6){var _0x55791b={'raw':!![],'where':{'id':_0x5f28e7['params']['id']}},_0x23c41d={};_0x23c41d[_0x7995('0x3b')]=_['keys'](db[_0x7995('0x38')][_0x7995('0x39')]);_0x23c41d['query']=_[_0x7995('0x3c')](_0x5f28e7[_0x7995('0x3d')]);_0x23c41d[_0x7995('0x3e')]=_[_0x7995('0x51')](_0x23c41d['model'],_0x23c41d[_0x7995('0x3d')]);_0x55791b[_0x7995('0x40')]=_[_0x7995('0x51')](_0x23c41d['model'],qs[_0x7995('0x3f')](_0x5f28e7[_0x7995('0x3d')][_0x7995('0x3f')]));_0x55791b[_0x7995('0x40')]=_0x55791b[_0x7995('0x40')]['length']?_0x55791b[_0x7995('0x40')]:_0x23c41d[_0x7995('0x3b')];if(_0x5f28e7['query'][_0x7995('0x4c')]){_0x55791b['include']=[{'all':!![]}];}_0x55791b=_[_0x7995('0x32')]({},_0x55791b,_0x5f28e7[_0x7995('0x4b')]);return db[_0x7995('0x38')][_0x7995('0x52')](_0x55791b)[_0x7995('0x2e')](handleEntityNotFound(_0x1c37c6,null))[_0x7995('0x2e')](respondWithResult(_0x1c37c6,null))[_0x7995('0x50')](handleError(_0x1c37c6,null));};exports['create']=function(_0x427dcf,_0x32f4be){return db[_0x7995('0x38')]['create'](_0x427dcf[_0x7995('0x33')],{})[_0x7995('0x2e')](respondWithResult(_0x32f4be,0xc9))[_0x7995('0x50')](handleError(_0x32f4be,null));};exports['update']=function(_0x4ec548,_0x5a592e){if(_0x4ec548[_0x7995('0x33')]['id']){delete _0x4ec548[_0x7995('0x33')]['id'];}return db['ChatInternalMessage'][_0x7995('0x52')]({'where':{'id':_0x4ec548[_0x7995('0x53')]['id']}})[_0x7995('0x2e')](handleEntityNotFound(_0x5a592e,null))[_0x7995('0x2e')](saveUpdates(_0x4ec548[_0x7995('0x33')],null))['then'](respondWithResult(_0x5a592e,null))[_0x7995('0x50')](handleError(_0x5a592e,null));};exports['destroy']=function(_0x14fe7f,_0x33c801){return db[_0x7995('0x38')]['find']({'where':{'id':_0x14fe7f['params']['id']}})['then'](handleEntityNotFound(_0x33c801,null))['then'](removeEntity(_0x33c801,null))[_0x7995('0x50')](handleError(_0x33c801,null));};exports[_0x7995('0x54')]=function(_0x1a861c,_0x150261){return db[_0x7995('0x38')][_0x7995('0x54')]()[_0x7995('0x2e')](respondWithResult(_0x150261,null))[_0x7995('0x50')](handleError(_0x150261,null));};function wrapUser(_0x328671){return function(_0x17ecd3){var _0xa7af8c=_0x328671[_0x7995('0x55')]({'plain':!![]});_0xa7af8c[_0x7995('0x56')]=[];if(_0x17ecd3){_0xa7af8c[_0x7995('0x57')]=_0x17ecd3[_0x7995('0x58')];_0xa7af8c[_0x7995('0x59')]=_0x17ecd3;}else{_0xa7af8c[_0x7995('0x57')]=moment(0x0)[_0x7995('0x5a')](_0x7995('0x5b'));_0xa7af8c['lastMessage']={};}return _0xa7af8c;};}exports[_0x7995('0x5c')]=function(_0x630737,_0x3b8a54,_0x32c0d3){var _0x5d160d=[];return db['User'][_0x7995('0x4e')]({'where':{'role':[_0x7995('0x36'),_0x7995('0x5d'),_0x7995('0x5e')]},'attributes':['id','fullname',_0x7995('0x30'),_0x7995('0x5f'),_0x7995('0x60'),_0x7995('0x61'),'online','lastLoginAt',_0x7995('0x62'),_0x7995('0x63')],'order':qs[_0x7995('0x45')](_0x7995('0x64')),'include':[{'model':db[_0x7995('0x65')],'as':_0x7995('0x66'),'attributes':['id',_0x7995('0x30'),_0x7995('0x49')],'through':{'attributes':[]}}]})[_0x7995('0x2e')](function(_0x50caf5){if(_0x50caf5){var _0x18f230=_0x630737[_0x7995('0x5e')][_0x7995('0x55')]({'plain':!![]});if(!_0x18f230)throw new Error(_0x7995('0x67'));if(_0x18f230['role']==='user'){return db[_0x7995('0x68')][_0x7995('0x52')]({'where':{'name':'Agents','userProfileId':_0x18f230[_0x7995('0x69')]},'raw':!![]})[_0x7995('0x2e')](function(_0x2e3421){if(_0x2e3421){if(_0x2e3421[_0x7995('0x6a')]===0x0){return db[_0x7995('0x6b')]['findAll']({'where':{'sectionId':_0x2e3421['id']},'raw':!![]})[_0x7995('0x2e')](function(_0x564fca){var _0x3e0a46=[];if(_[_0x7995('0x6c')](_0x564fca)){_0x3e0a46=_[_0x7995('0x48')](_0x50caf5,function(_0x25b534){if(_0x25b534[_0x7995('0x5f')]!==_0x7995('0x36')){return _0x25b534;}});return _0x3e0a46;}else{for(var _0x2b3c1d=0x0;_0x2b3c1d<_0x50caf5[_0x7995('0x41')];_0x2b3c1d++){var _0x10f012=_0x50caf5[_0x2b3c1d];if(_0x10f012[_0x7995('0x5f')]===_0x7995('0x36')){var _0x234d8d=_['find'](_0x564fca,function(_0x45351d){return _0x45351d[_0x7995('0x6d')]===_0x10f012['id'];});if(_0x234d8d)_0x3e0a46[_0x7995('0x6e')](_0x10f012);}else{_0x3e0a46[_0x7995('0x6e')](_0x10f012);}}return _0x3e0a46;}});}else{return _0x50caf5;}}else{var _0x2c6548=_['filter'](_0x50caf5,function(_0x4b54f2){if(_0x4b54f2[_0x7995('0x5f')]!==_0x7995('0x36')){return _0x4b54f2;}});return _0x2c6548;}});}else{return _0x50caf5;}}})[_0x7995('0x2e')](function(_0xae6166){var _0x5aa2ec=[];if(_0xae6166){_0x5d160d=_0xae6166;for(var _0x22d317=0x0;_0x22d317<_0xae6166['length'];_0x22d317+=0x1){_0x5d160d[_0x22d317]['messages']=[];_0x5aa2ec[_0x7995('0x6e')](db[_0x7995('0x38')][_0x7995('0x52')]({'where':{'FromId':[_0x630737[_0x7995('0x5e')]['id'],_0xae6166[_0x22d317]['id']],'ToId':[_0x630737[_0x7995('0x5e')]['id'],_0xae6166[_0x22d317]['id']],'ChatGroupId':null},'attributes':['id',_0x7995('0x58'),_0x7995('0x6f'),_0x7995('0x70'),_0x7995('0x71'),_0x7995('0x33')],'order':qs['sort'](_0x7995('0x72')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7995('0x2e')](wrapUser(_0xae6166[_0x22d317])));}return BPromise[_0x7995('0x73')](_0x5aa2ec);}return[];})['then'](function(_0x1fe1cb){return{'rows':_0x1fe1cb,'count':_0x1fe1cb[_0x7995('0x41')]};})[_0x7995('0x2e')](respondWithResult(_0x3b8a54,null))[_0x7995('0x50')](handleError(_0x3b8a54,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 1ab53ce..4e845a2 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 _0x27c9=['../../mysqldb','ChatInternalMessage','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x203d72,_0x5c9cdc){var _0x1f96ed=function(_0x572eb6){while(--_0x572eb6){_0x203d72['push'](_0x203d72['shift']());}};_0x1f96ed(++_0x5c9cdc);}(_0x27c9,0x1af));var _0x927c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x27c9[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0x927c('0x0'));var ChatInternalMessage=require(_0x927c('0x1'))['db'][_0x927c('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x927c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x927c('0x4'),'afterDestroy':_0x927c('0x5')};function emitEvent(_0x591cb0){return function(_0x3a091e,_0x3ec1a0,_0x3c36f6){ChatInternalMessageEvents[_0x927c('0x6')](_0x591cb0+':'+_0x3a091e['id'],_0x3a091e);ChatInternalMessageEvents[_0x927c('0x6')](_0x591cb0,_0x3a091e);_0x3c36f6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x927c('0x7')](e,emitEvent(event));}}module[_0x927c('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xb72d=['ChatInternalMessage','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0xb72d,0xc4));var _0xdb72=function(_0x2d123a,_0x2b258b){_0x2d123a=_0x2d123a-0x0;var _0x1cd0b3=_0xb72d[_0x2d123a];return _0x1cd0b3;};'use strict';var EventEmitter=require(_0xdb72('0x0'));var ChatInternalMessage=require(_0xdb72('0x1'))['db'][_0xdb72('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xdb72('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdb72('0x4'),'afterDestroy':'remove'};function emitEvent(_0x124742){return function(_0x326e71,_0x101d38,_0x4f988e){ChatInternalMessageEvents['emit'](_0x124742+':'+_0x326e71['id'],_0x326e71);ChatInternalMessageEvents[_0xdb72('0x5')](_0x124742,_0x326e71);_0x4f988e(null);};}for(var e in events){if(events[_0xdb72('0x6')](e)){var event=events[e];ChatInternalMessage[_0xdb72('0x7')](e,emitEvent(event));}}module[_0xdb72('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 119cd98..f94cbe0 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 _0xa9e0=['define','ChatInternalMessage','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xbaf0=['define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x42bbf5,_0x529769){var _0x3ec48c=function(_0xa1ca2b){while(--_0xa1ca2b){_0x42bbf5['push'](_0x42bbf5['shift']());}};_0x3ec48c(++_0x529769);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0baf('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 91a8ff0..f3d618e 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 _0x3330=['result','catch','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2e3655,_0x18b8cf){var _0x20e51b=function(_0x40bc40){while(--_0x40bc40){_0x2e3655['push'](_0x2e3655['shift']());}};_0x20e51b(++_0x18b8cf);}(_0x3330,0x1ab));var _0x0333=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x3330[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require(_0x0333('0x0'));var moment=require(_0x0333('0x1'));var BPromise=require('bluebird');var rs=require(_0x0333('0x2'));var fs=require('fs');var Redis=require(_0x0333('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0333('0x4'))(_0x0333('0x5'));var config=require('../../config/environment');var jayson=require(_0x0333('0x6'));var client=jayson[_0x0333('0x7')]['http']({'port':0x232a});config['redis']=_[_0x0333('0x8')](config[_0x0333('0x9')],{'host':_0x0333('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0333('0xb'))[_0x0333('0xc')](socket);function respondWithRpcPromise(_0x58ca5c,_0x459c4f,_0x30dc29){return new BPromise(function(_0x3588e4,_0x4339ee){return client[_0x0333('0xd')](_0x58ca5c,_0x30dc29)['then'](function(_0x356000){logger[_0x0333('0xe')](_0x0333('0xf'),_0x459c4f,_0x0333('0x10'));logger[_0x0333('0x11')](_0x0333('0x12'),_0x459c4f,_0x0333('0x10'),JSON[_0x0333('0x13')](_0x356000));if(_0x356000[_0x0333('0x14')]){if(_0x356000[_0x0333('0x14')][_0x0333('0x15')]===0x1f4){logger[_0x0333('0x14')](_0x0333('0xf'),_0x459c4f,_0x356000['error'][_0x0333('0x16')]);return _0x4339ee(_0x356000[_0x0333('0x14')][_0x0333('0x16')]);}logger['error'](_0x0333('0xf'),_0x459c4f,_0x356000['error'][_0x0333('0x16')]);return _0x3588e4(_0x356000['error']['message']);}else{logger[_0x0333('0xe')](_0x0333('0xf'),_0x459c4f,'request\x20sent');_0x3588e4(_0x356000[_0x0333('0x17')]['message']);}})[_0x0333('0x18')](function(_0x1f57c2){logger[_0x0333('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x459c4f,_0x1f57c2);_0x4339ee(_0x1f57c2);});});} \ No newline at end of file +var _0x18d7=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x105ecb,_0xeca91e){var _0xaa5025=function(_0x4aff9f){while(--_0x4aff9f){_0x105ecb['push'](_0x105ecb['shift']());}};_0xaa5025(++_0xeca91e);}(_0x18d7,0x1b7));var _0x718d=function(_0x407656,_0x551993){_0x407656=_0x407656-0x0;var _0x5706c8=_0x18d7[_0x407656];return _0x5706c8;};'use strict';var _=require('lodash');var util=require(_0x718d('0x0'));var moment=require(_0x718d('0x1'));var BPromise=require(_0x718d('0x2'));var rs=require(_0x718d('0x3'));var fs=require('fs');var Redis=require(_0x718d('0x4'));var db=require(_0x718d('0x5'))['db'];var utils=require(_0x718d('0x6'));var logger=require('../../config/logger')(_0x718d('0x7'));var config=require(_0x718d('0x8'));var jayson=require(_0x718d('0x9'));var client=jayson[_0x718d('0xa')][_0x718d('0xb')]({'port':0x232a});config[_0x718d('0xc')]=_[_0x718d('0xd')](config['redis'],{'host':_0x718d('0xe'),'port':0x18eb});var socket=require(_0x718d('0xf'))(new Redis(config[_0x718d('0xc')]));require(_0x718d('0x10'))[_0x718d('0x11')](socket);function respondWithRpcPromise(_0x2589d2,_0x44c858,_0x5b4c0){return new BPromise(function(_0x3603f8,_0x4db098){return client[_0x718d('0x12')](_0x2589d2,_0x5b4c0)['then'](function(_0x579b95){logger[_0x718d('0x13')](_0x718d('0x14'),_0x44c858,_0x718d('0x15'));logger['debug'](_0x718d('0x16'),_0x44c858,_0x718d('0x15'),JSON[_0x718d('0x17')](_0x579b95));if(_0x579b95['error']){if(_0x579b95[_0x718d('0x18')][_0x718d('0x19')]===0x1f4){logger[_0x718d('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x44c858,_0x579b95[_0x718d('0x18')][_0x718d('0x1a')]);return _0x4db098(_0x579b95['error'][_0x718d('0x1a')]);}logger[_0x718d('0x18')](_0x718d('0x14'),_0x44c858,_0x579b95[_0x718d('0x18')][_0x718d('0x1a')]);return _0x3603f8(_0x579b95[_0x718d('0x18')][_0x718d('0x1a')]);}else{logger[_0x718d('0x13')](_0x718d('0x14'),_0x44c858,'request\x20sent');_0x3603f8(_0x579b95[_0x718d('0x1b')][_0x718d('0x1a')]);}})[_0x718d('0x1c')](function(_0x412bdd){logger[_0x718d('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x44c858,_0x412bdd);_0x4db098(_0x412bdd);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index b7509bb..2b99083 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 _0x86dd=['update','emit','removeListener','register','save'];(function(_0x1cdb2d,_0x8f1f76){var _0x4dafe3=function(_0xec694e){while(--_0xec694e){_0x1cdb2d['push'](_0x1cdb2d['shift']());}};_0x4dafe3(++_0x8f1f76);}(_0x86dd,0x1ee));var _0xd86d=function(_0x9c02fc,_0xaaa1ed){_0x9c02fc=_0x9c02fc-0x0;var _0x27a2e5=_0x86dd[_0x9c02fc];return _0x27a2e5;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xd86d('0x0'),'remove',_0xd86d('0x1')];function createListener(_0x2cb4b4,_0x287d1d){return function(_0x217373){_0x287d1d[_0xd86d('0x2')](_0x2cb4b4,_0x217373);};}function removeListener(_0x30a31c,_0x2e82a9){return function(){ChatInternalMessageEvents[_0xd86d('0x3')](_0x30a31c,_0x2e82a9);};}exports[_0xd86d('0x4')]=function(_0x1d5ffc){for(var _0x3b13f9=0x0,_0x4274f8=events['length'];_0x3b13f9<_0x4274f8;_0x3b13f9++){var _0x341335=events[_0x3b13f9];var _0xfcba94=createListener('chatInternalMessage:'+_0x341335,_0x1d5ffc);ChatInternalMessageEvents['on'](_0x341335,_0xfcba94);}}; \ No newline at end of file +var _0x6fad=['length','./chatInternalMessage.events','save','remove','update','emit','removeListener'];(function(_0x47a852,_0x215dc0){var _0x223c56=function(_0x43e6b7){while(--_0x43e6b7){_0x47a852['push'](_0x47a852['shift']());}};_0x223c56(++_0x215dc0);}(_0x6fad,0x174));var _0xd6fa=function(_0x5c6f53,_0x5f08f6){_0x5c6f53=_0x5c6f53-0x0;var _0x4b9fff=_0x6fad[_0x5c6f53];return _0x4b9fff;};'use strict';var ChatInternalMessageEvents=require(_0xd6fa('0x0'));var events=[_0xd6fa('0x1'),_0xd6fa('0x2'),_0xd6fa('0x3')];function createListener(_0x4f8a1c,_0x2f5f9b){return function(_0x4ae415){_0x2f5f9b[_0xd6fa('0x4')](_0x4f8a1c,_0x4ae415);};}function removeListener(_0x48f433,_0x3e76d0){return function(){ChatInternalMessageEvents[_0xd6fa('0x5')](_0x48f433,_0x3e76d0);};}exports['register']=function(_0x45dad4){for(var _0x329390=0x0,_0x291bd5=events[_0xd6fa('0x6')];_0x329390<_0x291bd5;_0x329390++){var _0x5a1bf0=events[_0x329390];var _0x1d2aaa=createListener('chatInternalMessage:'+_0x5a1bf0,_0x45dad4);ChatInternalMessageEvents['on'](_0x5a1bf0,_0x1d2aaa);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index fe692d0..783164e 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 _0xe9ce=['./chatInternalMessage.controller','get','index','/describe','describe','isAuthenticated','/:id','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x2e87e1,_0x506517){var _0x35d9e7=function(_0x314efd){while(--_0x314efd){_0x2e87e1['push'](_0x2e87e1['shift']());}};_0x35d9e7(++_0x506517);}(_0xe9ce,0x1ae));var _0xee9c=function(_0x4e48cd,_0x59dc29){_0x4e48cd=_0x4e48cd-0x0;var _0x4e1fd0=_0xe9ce[_0x4e48cd];return _0x4e1fd0;};'use strict';var multer=require(_0xee9c('0x0'));var util=require(_0xee9c('0x1'));var path=require(_0xee9c('0x2'));var timeout=require(_0xee9c('0x3'));var express=require(_0xee9c('0x4'));var router=express['Router']();var fs_extra=require(_0xee9c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xee9c('0x6'));var config=require('../../config/environment');var controller=require(_0xee9c('0x7'));router[_0xee9c('0x8')]('/',auth['isAuthenticated'](),controller[_0xee9c('0x9')]);router[_0xee9c('0x8')](_0xee9c('0xa'),auth['isAuthenticated'](),controller[_0xee9c('0xb')]);router[_0xee9c('0x8')]('/users',auth[_0xee9c('0xc')](),controller['getUsers']);router[_0xee9c('0x8')](_0xee9c('0xd'),auth[_0xee9c('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xee9c('0xe')]);router[_0xee9c('0xf')](_0xee9c('0xd'),controller[_0xee9c('0x10')]);router[_0xee9c('0x11')]('/:id',auth[_0xee9c('0xc')](),controller[_0xee9c('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2aa0=['update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','getUsers','/:id','show','create','put'];(function(_0x585900,_0x453c01){var _0x4af5ee=function(_0x49a86c){while(--_0x49a86c){_0x585900['push'](_0x585900['shift']());}};_0x4af5ee(++_0x453c01);}(_0x2aa0,0x6c));var _0x02aa=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2aa0[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x02aa('0x0'));var util=require(_0x02aa('0x1'));var path=require('path');var timeout=require(_0x02aa('0x2'));var express=require(_0x02aa('0x3'));var router=express['Router']();var fs_extra=require(_0x02aa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x02aa('0x5'));var config=require(_0x02aa('0x6'));var controller=require(_0x02aa('0x7'));router[_0x02aa('0x8')]('/',auth[_0x02aa('0x9')](),controller[_0x02aa('0xa')]);router[_0x02aa('0x8')](_0x02aa('0xb'),auth[_0x02aa('0x9')](),controller[_0x02aa('0xc')]);router[_0x02aa('0x8')]('/users',auth[_0x02aa('0x9')](),controller[_0x02aa('0xd')]);router['get'](_0x02aa('0xe'),auth[_0x02aa('0x9')](),controller[_0x02aa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x02aa('0x10')]);router[_0x02aa('0x11')](_0x02aa('0xe'),controller[_0x02aa('0x12')]);router[_0x02aa('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x02aa('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index e305d6e..725b02b 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 _0x328b=['STRING','sequelize','TEXT','BOOLEAN','out','DATE'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x328b,0x145));var _0xb328=function(_0x1d5ba8,_0x412a52){_0x1d5ba8=_0x1d5ba8-0x0;var _0x1022a2=_0x328b[_0x1d5ba8];return _0x1022a2;};'use strict';var Sequelize=require(_0xb328('0x0'));module['exports']={'body':{'type':Sequelize[_0xb328('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb328('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb328('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb328('0x3')),'defaultValue':_0xb328('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb328('0x4')]},'providerName':{'type':Sequelize[_0xb328('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4847=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x4847,0x97));var _0x7484=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x4847[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x7484('0x0'));module[_0x7484('0x1')]={'body':{'type':Sequelize[_0x7484('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7484('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7484('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7484('0x4')),'defaultValue':_0x7484('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7484('0x5')]},'providerName':{'type':Sequelize[_0x7484('0x6')]},'providerResponse':{'type':Sequelize[_0x7484('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index fa9c9d6..eb6165d 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=['query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','../../config/logger','chat-interactions','accept','chat','read','readAt','format','UserId','user','CmContact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','role','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','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','render','merge','body','agent','interaction','index','ChatMessage','rawAttributes','fieldName','model','map'];(function(_0x38c699,_0x56fea7){var _0x3b1ded=function(_0x100851){while(--_0x100851){_0x38c699['push'](_0x38c699['shift']());}};_0x3b1ded(++_0x56fea7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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);};}function getMustacheRender(_0x5640eb,_0x24936a){return Mustache[_0x0a9e('0x3a')](_0x5640eb,_[_0x0a9e('0x3b')](_0x24936a[_0x0a9e('0x3c')],{'contact':_0x24936a['contact'],'message':_0x24936a[_0x0a9e('0x26')],'agent':_0x24936a[_0x0a9e('0x3d')],'interaction':_0x24936a[_0x0a9e('0x3e')],'account':_0x24936a['account']}))||'';}exports[_0x0a9e('0x3f')]=function(_0x1a180b,_0x289467){var _0x4c1c0e={},_0x546ef8={},_0x11b61d={'count':0x0,'rows':[]};var _0x40d766=_['map'](db[_0x0a9e('0x40')][_0x0a9e('0x41')],function(_0x2e1b3a){return{'name':_0x2e1b3a[_0x0a9e('0x42')],'type':_0x2e1b3a['type']['key']};});_0x546ef8[_0x0a9e('0x43')]=_[_0x0a9e('0x44')](_0x40d766,'name');_0x546ef8[_0x0a9e('0x45')]=_[_0x0a9e('0x46')](_0x1a180b[_0x0a9e('0x45')]);_0x546ef8['filters']=_[_0x0a9e('0x47')](_0x546ef8[_0x0a9e('0x43')],_0x546ef8[_0x0a9e('0x45')]);_0x4c1c0e[_0x0a9e('0x48')]=_[_0x0a9e('0x47')](_0x546ef8[_0x0a9e('0x43')],qs[_0x0a9e('0x49')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x49')]));_0x4c1c0e[_0x0a9e('0x48')]=_0x4c1c0e[_0x0a9e('0x48')][_0x0a9e('0x4a')]?_0x4c1c0e[_0x0a9e('0x48')]:_0x546ef8[_0x0a9e('0x43')];if(!_0x1a180b[_0x0a9e('0x45')]['hasOwnProperty']('nolimit')){_0x4c1c0e[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x30')]);_0x4c1c0e[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x2d')]);}_0x4c1c0e[_0x0a9e('0x4b')]=qs[_0x0a9e('0x4c')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4c')]);_0x4c1c0e['where']=qs[_0x0a9e('0x4d')](_[_0x0a9e('0x4e')](_0x1a180b[_0x0a9e('0x45')],_0x546ef8[_0x0a9e('0x4d')]),_0x40d766);if(_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4f')]){_0x4c1c0e[_0x0a9e('0x50')]=_[_0x0a9e('0x3b')](_0x4c1c0e['where'],{'$or':_[_0x0a9e('0x44')](_0x40d766,function(_0x48fd45){if(_0x48fd45[_0x0a9e('0x51')]!==_0x0a9e('0x52')){var _0x8d6dd1={};_0x8d6dd1[_0x48fd45['name']]={'$like':'%'+_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4f')]+'%'};return _0x8d6dd1;}})});}_0x4c1c0e=_[_0x0a9e('0x3b')]({},_0x4c1c0e,_0x1a180b[_0x0a9e('0x53')]);var _0x45c845={'where':_0x4c1c0e[_0x0a9e('0x50')]};return db[_0x0a9e('0x40')]['count'](_0x45c845)[_0x0a9e('0x1d')](function(_0x1bde3c){_0x11b61d[_0x0a9e('0x2f')]=_0x1bde3c;if(_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x54')]){_0x4c1c0e[_0x0a9e('0x55')]=[{'all':!![]}];}return db[_0x0a9e('0x40')][_0x0a9e('0x56')](_0x4c1c0e);})[_0x0a9e('0x1d')](function(_0x58a5c2){_0x11b61d[_0x0a9e('0x57')]=_0x58a5c2;return _0x11b61d;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x289467,_0x4c1c0e))['catch'](handleError(_0x289467,null));};exports['show']=function(_0x5ddf84,_0x1adfee){var _0x4317e3={'raw':!![],'where':{'id':_0x5ddf84[_0x0a9e('0x58')]['id']}},_0x37edaa={};_0x37edaa[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](db[_0x0a9e('0x40')][_0x0a9e('0x41')]);_0x37edaa['query']=_['keys'](_0x5ddf84['query']);_0x37edaa[_0x0a9e('0x4d')]=_[_0x0a9e('0x47')](_0x37edaa[_0x0a9e('0x43')],_0x37edaa['query']);_0x4317e3[_0x0a9e('0x48')]=_[_0x0a9e('0x47')](_0x37edaa['model'],qs['fields'](_0x5ddf84[_0x0a9e('0x45')]['fields']));_0x4317e3[_0x0a9e('0x48')]=_0x4317e3['attributes'][_0x0a9e('0x4a')]?_0x4317e3[_0x0a9e('0x48')]:_0x37edaa[_0x0a9e('0x43')];if(_0x5ddf84['query'][_0x0a9e('0x54')]){_0x4317e3[_0x0a9e('0x55')]=[{'all':!![]}];}_0x4317e3=_['merge']({},_0x4317e3,_0x5ddf84['options']);return db[_0x0a9e('0x40')][_0x0a9e('0x59')](_0x4317e3)['then'](handleEntityNotFound(_0x1adfee,null))[_0x0a9e('0x1d')](respondWithResult(_0x1adfee,null))['catch'](handleError(_0x1adfee,null));};exports[_0x0a9e('0x5a')]=function(_0x523cd2,_0xe22ccc){return db['ChatMessage']['create'](_0x523cd2['body'],{})[_0x0a9e('0x1d')](respondWithResult(_0xe22ccc,0xc9))['catch'](handleError(_0xe22ccc,null));};exports[_0x0a9e('0x35')]=function(_0x65432,_0x3cfd00){if(_0x65432[_0x0a9e('0x3c')]['id']){delete _0x65432[_0x0a9e('0x3c')]['id'];}return db[_0x0a9e('0x40')][_0x0a9e('0x59')]({'where':{'id':_0x65432[_0x0a9e('0x58')]['id']}})['then'](handleEntityNotFound(_0x3cfd00,null))[_0x0a9e('0x1d')](saveUpdates(_0x65432[_0x0a9e('0x3c')],null))[_0x0a9e('0x1d')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x28')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x36')]=function(_0x156662,_0x5d86e9){return db[_0x0a9e('0x40')][_0x0a9e('0x59')]({'where':{'id':_0x156662['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x5d86e9,null))['then'](removeEntity(_0x5d86e9,null))[_0x0a9e('0x28')](handleError(_0x5d86e9,null));};exports['describe']=function(_0x4b3c1a,_0x5674ee){return db[_0x0a9e('0x40')]['describe']()[_0x0a9e('0x1d')](respondWithResult(_0x5674ee,null))[_0x0a9e('0x28')](handleError(_0x5674ee,null));};var interaction_log=require(_0x0a9e('0x5b'))(_0x0a9e('0x5c'));exports[_0x0a9e('0x5d')]=function(_0x26d7db,_0x49eed0,_0x1627a7){var _0x5854cc={'agent':{},'channel':_0x0a9e('0x5e')};if(_0x26d7db[_0x0a9e('0x3c')]['id']){delete _0x26d7db[_0x0a9e('0x3c')]['id'];}_0x26d7db['body'][_0x0a9e('0x5f')]=!![];_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x60')]=moment()[_0x0a9e('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')]=_0x26d7db['body'][_0x0a9e('0x62')]||_0x26d7db[_0x0a9e('0x63')]['id'];_0x5854cc[_0x0a9e('0x3d')]['id']=_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')];return db['ChatMessage'][_0x0a9e('0x59')]({'where':{'id':_0x26d7db[_0x0a9e('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x64')],'as':'Contact'}]})[_0x0a9e('0x1d')](handleEntityNotFound(_0x49eed0,null))['then'](saveUpdates(_0x26d7db['body'],null))[_0x0a9e('0x1d')](function(_0x4556c5){if(_0x4556c5){_0x5854cc[_0x0a9e('0x26')]=_0x4556c5[_0x0a9e('0x65')]({'plain':!![]});return db[_0x0a9e('0x66')][_0x0a9e('0x59')]({'where':{'id':_0x4556c5[_0x0a9e('0x67')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x49eed0,null))[_0x0a9e('0x1d')](function(_0x1cc4f3){if(_0x1cc4f3){return _0x1cc4f3[_0x0a9e('0x35')]({'UserId':_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')],'read1stAt':_[_0x0a9e('0x68')](_0x1cc4f3[_0x0a9e('0x69')])?moment()[_0x0a9e('0x61')](_0x0a9e('0x6a')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x5150a4){if(_0x5150a4){_0x5854cc[_0x0a9e('0x3e')]=_0x5150a4[_0x0a9e('0x65')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x26d7db[_0x0a9e('0x63')]['id'],_0x26d7db[_0x0a9e('0x63')]['name'],_0x26d7db[_0x0a9e('0x63')][_0x0a9e('0x6b')],_0x5854cc[_0x0a9e('0x3e')]['id'],_0x26d7db[_0x0a9e('0x3c')]?JSON[_0x0a9e('0x23')](_0x26d7db['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x0a9e('0x6c'),_0x5854cc);}return null;})[_0x0a9e('0x1d')](function(_0x1104ad){if(_0x1104ad){if(_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x6d')]){_0x5854cc[_0x0a9e('0x26')][_0x0a9e('0x6e')]=util[_0x0a9e('0x61')]('SIP/%s',_0x26d7db[_0x0a9e('0x63')][_0x0a9e('0x38')]);_0x5854cc[_0x0a9e('0x26')]['channel']=_0x5854cc[_0x0a9e('0x6f')];_0x5854cc['message'][_0x0a9e('0x70')]=_0x0a9e('0x5d');return respondWithRpcPromise('EventManager',_0x0a9e('0x71'),{'event':_0x0a9e('0x72'),'message':_[_0x0a9e('0x3b')](_0x5854cc[_0x0a9e('0x26')],JSON['parse'](_0x5854cc[_0x0a9e('0x3e')][_0x0a9e('0x73')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x5854cc;});}return _0x5854cc;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x49eed0,null))['catch'](handleError(_0x49eed0,null));};var interaction_log=require(_0x0a9e('0x5b'))(_0x0a9e('0x5c'));exports[_0x0a9e('0x33')]=function(_0x361b21,_0x4abc8f,_0x290d43){var _0x3511c9={'agent':{},'channel':_0x0a9e('0x5e')};if(_0x361b21[_0x0a9e('0x3c')]['id']){delete _0x361b21[_0x0a9e('0x3c')]['id'];}_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')]=_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')]||_0x361b21[_0x0a9e('0x63')]['id'];_0x3511c9[_0x0a9e('0x3d')]['id']=_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')];return db[_0x0a9e('0x40')]['find']({'where':{'id':_0x361b21[_0x0a9e('0x58')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4abc8f,null))[_0x0a9e('0x1d')](function(_0x563627){if(_0x563627){_0x3511c9[_0x0a9e('0x26')]=_0x563627[_0x0a9e('0x65')]({'plain':!![]});return db[_0x0a9e('0x66')][_0x0a9e('0x59')]({'where':{'id':_0x563627['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4abc8f,null))[_0x0a9e('0x1d')](function(_0x2bbdb5){if(_0x2bbdb5){_0x3511c9['interaction']=_0x2bbdb5[_0x0a9e('0x65')]({'plain':!![]});interaction_log['info'](_0x0a9e('0x74'),_0x361b21[_0x0a9e('0x63')]['id'],_0x361b21['user'][_0x0a9e('0x38')],_0x361b21[_0x0a9e('0x63')][_0x0a9e('0x6b')],_0x3511c9[_0x0a9e('0x3e')]['id'],_0x361b21[_0x0a9e('0x3c')]?JSON[_0x0a9e('0x23')](_0x361b21[_0x0a9e('0x3c')]):'null');return respondWithRpcPromise(_0x0a9e('0x75'),_0x0a9e('0x76'),_0x3511c9);}return null;})[_0x0a9e('0x1d')](function(_0x16e5b9){if(_0x16e5b9){_0x16e5b9['message'][_0x0a9e('0x6e')]=util[_0x0a9e('0x61')]('SIP/%s',_0x361b21[_0x0a9e('0x63')]['name']);_0x16e5b9[_0x0a9e('0x26')][_0x0a9e('0x6f')]=_0x3511c9[_0x0a9e('0x6f')];_0x16e5b9[_0x0a9e('0x26')]['event']='reject';respondWithRpcPromise(_0x0a9e('0x71'),_0x0a9e('0x71'),{'event':_0x0a9e('0x77'),'message':_0x16e5b9['message']},client9002);return _0x3511c9;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4abc8f,null))[_0x0a9e('0x28')](handleError(_0x4abc8f,null));}; \ No newline at end of file +var _0xa9e0=['query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','../../config/logger','chat-interactions','accept','chat','read','readAt','format','UserId','user','CmContact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','role','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','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','render','merge','body','agent','interaction','index','ChatMessage','rawAttributes','fieldName','model','map'];(function(_0x32161e,_0x578b70){var _0x382fe6=function(_0x76959f){while(--_0x76959f){_0x32161e['push'](_0x32161e['shift']());}};_0x382fe6(++_0x578b70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];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);};}function getMustacheRender(_0x5640eb,_0x24936a){return Mustache[_0x0a9e('0x3a')](_0x5640eb,_[_0x0a9e('0x3b')](_0x24936a[_0x0a9e('0x3c')],{'contact':_0x24936a['contact'],'message':_0x24936a[_0x0a9e('0x26')],'agent':_0x24936a[_0x0a9e('0x3d')],'interaction':_0x24936a[_0x0a9e('0x3e')],'account':_0x24936a['account']}))||'';}exports[_0x0a9e('0x3f')]=function(_0x1a180b,_0x289467){var _0x4c1c0e={},_0x546ef8={},_0x11b61d={'count':0x0,'rows':[]};var _0x40d766=_['map'](db[_0x0a9e('0x40')][_0x0a9e('0x41')],function(_0x2e1b3a){return{'name':_0x2e1b3a[_0x0a9e('0x42')],'type':_0x2e1b3a['type']['key']};});_0x546ef8[_0x0a9e('0x43')]=_[_0x0a9e('0x44')](_0x40d766,'name');_0x546ef8[_0x0a9e('0x45')]=_[_0x0a9e('0x46')](_0x1a180b[_0x0a9e('0x45')]);_0x546ef8['filters']=_[_0x0a9e('0x47')](_0x546ef8[_0x0a9e('0x43')],_0x546ef8[_0x0a9e('0x45')]);_0x4c1c0e[_0x0a9e('0x48')]=_[_0x0a9e('0x47')](_0x546ef8[_0x0a9e('0x43')],qs[_0x0a9e('0x49')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x49')]));_0x4c1c0e[_0x0a9e('0x48')]=_0x4c1c0e[_0x0a9e('0x48')][_0x0a9e('0x4a')]?_0x4c1c0e[_0x0a9e('0x48')]:_0x546ef8[_0x0a9e('0x43')];if(!_0x1a180b[_0x0a9e('0x45')]['hasOwnProperty']('nolimit')){_0x4c1c0e[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x30')]);_0x4c1c0e[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x2d')]);}_0x4c1c0e[_0x0a9e('0x4b')]=qs[_0x0a9e('0x4c')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4c')]);_0x4c1c0e['where']=qs[_0x0a9e('0x4d')](_[_0x0a9e('0x4e')](_0x1a180b[_0x0a9e('0x45')],_0x546ef8[_0x0a9e('0x4d')]),_0x40d766);if(_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4f')]){_0x4c1c0e[_0x0a9e('0x50')]=_[_0x0a9e('0x3b')](_0x4c1c0e['where'],{'$or':_[_0x0a9e('0x44')](_0x40d766,function(_0x48fd45){if(_0x48fd45[_0x0a9e('0x51')]!==_0x0a9e('0x52')){var _0x8d6dd1={};_0x8d6dd1[_0x48fd45['name']]={'$like':'%'+_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4f')]+'%'};return _0x8d6dd1;}})});}_0x4c1c0e=_[_0x0a9e('0x3b')]({},_0x4c1c0e,_0x1a180b[_0x0a9e('0x53')]);var _0x45c845={'where':_0x4c1c0e[_0x0a9e('0x50')]};return db[_0x0a9e('0x40')]['count'](_0x45c845)[_0x0a9e('0x1d')](function(_0x1bde3c){_0x11b61d[_0x0a9e('0x2f')]=_0x1bde3c;if(_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x54')]){_0x4c1c0e[_0x0a9e('0x55')]=[{'all':!![]}];}return db[_0x0a9e('0x40')][_0x0a9e('0x56')](_0x4c1c0e);})[_0x0a9e('0x1d')](function(_0x58a5c2){_0x11b61d[_0x0a9e('0x57')]=_0x58a5c2;return _0x11b61d;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x289467,_0x4c1c0e))['catch'](handleError(_0x289467,null));};exports['show']=function(_0x5ddf84,_0x1adfee){var _0x4317e3={'raw':!![],'where':{'id':_0x5ddf84[_0x0a9e('0x58')]['id']}},_0x37edaa={};_0x37edaa[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](db[_0x0a9e('0x40')][_0x0a9e('0x41')]);_0x37edaa['query']=_['keys'](_0x5ddf84['query']);_0x37edaa[_0x0a9e('0x4d')]=_[_0x0a9e('0x47')](_0x37edaa[_0x0a9e('0x43')],_0x37edaa['query']);_0x4317e3[_0x0a9e('0x48')]=_[_0x0a9e('0x47')](_0x37edaa['model'],qs['fields'](_0x5ddf84[_0x0a9e('0x45')]['fields']));_0x4317e3[_0x0a9e('0x48')]=_0x4317e3['attributes'][_0x0a9e('0x4a')]?_0x4317e3[_0x0a9e('0x48')]:_0x37edaa[_0x0a9e('0x43')];if(_0x5ddf84['query'][_0x0a9e('0x54')]){_0x4317e3[_0x0a9e('0x55')]=[{'all':!![]}];}_0x4317e3=_['merge']({},_0x4317e3,_0x5ddf84['options']);return db[_0x0a9e('0x40')][_0x0a9e('0x59')](_0x4317e3)['then'](handleEntityNotFound(_0x1adfee,null))[_0x0a9e('0x1d')](respondWithResult(_0x1adfee,null))['catch'](handleError(_0x1adfee,null));};exports[_0x0a9e('0x5a')]=function(_0x523cd2,_0xe22ccc){return db['ChatMessage']['create'](_0x523cd2['body'],{})[_0x0a9e('0x1d')](respondWithResult(_0xe22ccc,0xc9))['catch'](handleError(_0xe22ccc,null));};exports[_0x0a9e('0x35')]=function(_0x65432,_0x3cfd00){if(_0x65432[_0x0a9e('0x3c')]['id']){delete _0x65432[_0x0a9e('0x3c')]['id'];}return db[_0x0a9e('0x40')][_0x0a9e('0x59')]({'where':{'id':_0x65432[_0x0a9e('0x58')]['id']}})['then'](handleEntityNotFound(_0x3cfd00,null))[_0x0a9e('0x1d')](saveUpdates(_0x65432[_0x0a9e('0x3c')],null))[_0x0a9e('0x1d')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x28')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x36')]=function(_0x156662,_0x5d86e9){return db[_0x0a9e('0x40')][_0x0a9e('0x59')]({'where':{'id':_0x156662['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x5d86e9,null))['then'](removeEntity(_0x5d86e9,null))[_0x0a9e('0x28')](handleError(_0x5d86e9,null));};exports['describe']=function(_0x4b3c1a,_0x5674ee){return db[_0x0a9e('0x40')]['describe']()[_0x0a9e('0x1d')](respondWithResult(_0x5674ee,null))[_0x0a9e('0x28')](handleError(_0x5674ee,null));};var interaction_log=require(_0x0a9e('0x5b'))(_0x0a9e('0x5c'));exports[_0x0a9e('0x5d')]=function(_0x26d7db,_0x49eed0,_0x1627a7){var _0x5854cc={'agent':{},'channel':_0x0a9e('0x5e')};if(_0x26d7db[_0x0a9e('0x3c')]['id']){delete _0x26d7db[_0x0a9e('0x3c')]['id'];}_0x26d7db['body'][_0x0a9e('0x5f')]=!![];_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x60')]=moment()[_0x0a9e('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')]=_0x26d7db['body'][_0x0a9e('0x62')]||_0x26d7db[_0x0a9e('0x63')]['id'];_0x5854cc[_0x0a9e('0x3d')]['id']=_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')];return db['ChatMessage'][_0x0a9e('0x59')]({'where':{'id':_0x26d7db[_0x0a9e('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x64')],'as':'Contact'}]})[_0x0a9e('0x1d')](handleEntityNotFound(_0x49eed0,null))['then'](saveUpdates(_0x26d7db['body'],null))[_0x0a9e('0x1d')](function(_0x4556c5){if(_0x4556c5){_0x5854cc[_0x0a9e('0x26')]=_0x4556c5[_0x0a9e('0x65')]({'plain':!![]});return db[_0x0a9e('0x66')][_0x0a9e('0x59')]({'where':{'id':_0x4556c5[_0x0a9e('0x67')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x49eed0,null))[_0x0a9e('0x1d')](function(_0x1cc4f3){if(_0x1cc4f3){return _0x1cc4f3[_0x0a9e('0x35')]({'UserId':_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')],'read1stAt':_[_0x0a9e('0x68')](_0x1cc4f3[_0x0a9e('0x69')])?moment()[_0x0a9e('0x61')](_0x0a9e('0x6a')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x5150a4){if(_0x5150a4){_0x5854cc[_0x0a9e('0x3e')]=_0x5150a4[_0x0a9e('0x65')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x26d7db[_0x0a9e('0x63')]['id'],_0x26d7db[_0x0a9e('0x63')]['name'],_0x26d7db[_0x0a9e('0x63')][_0x0a9e('0x6b')],_0x5854cc[_0x0a9e('0x3e')]['id'],_0x26d7db[_0x0a9e('0x3c')]?JSON[_0x0a9e('0x23')](_0x26d7db['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x0a9e('0x6c'),_0x5854cc);}return null;})[_0x0a9e('0x1d')](function(_0x1104ad){if(_0x1104ad){if(_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x6d')]){_0x5854cc[_0x0a9e('0x26')][_0x0a9e('0x6e')]=util[_0x0a9e('0x61')]('SIP/%s',_0x26d7db[_0x0a9e('0x63')][_0x0a9e('0x38')]);_0x5854cc[_0x0a9e('0x26')]['channel']=_0x5854cc[_0x0a9e('0x6f')];_0x5854cc['message'][_0x0a9e('0x70')]=_0x0a9e('0x5d');return respondWithRpcPromise('EventManager',_0x0a9e('0x71'),{'event':_0x0a9e('0x72'),'message':_[_0x0a9e('0x3b')](_0x5854cc[_0x0a9e('0x26')],JSON['parse'](_0x5854cc[_0x0a9e('0x3e')][_0x0a9e('0x73')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x5854cc;});}return _0x5854cc;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x49eed0,null))['catch'](handleError(_0x49eed0,null));};var interaction_log=require(_0x0a9e('0x5b'))(_0x0a9e('0x5c'));exports[_0x0a9e('0x33')]=function(_0x361b21,_0x4abc8f,_0x290d43){var _0x3511c9={'agent':{},'channel':_0x0a9e('0x5e')};if(_0x361b21[_0x0a9e('0x3c')]['id']){delete _0x361b21[_0x0a9e('0x3c')]['id'];}_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')]=_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')]||_0x361b21[_0x0a9e('0x63')]['id'];_0x3511c9[_0x0a9e('0x3d')]['id']=_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')];return db[_0x0a9e('0x40')]['find']({'where':{'id':_0x361b21[_0x0a9e('0x58')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4abc8f,null))[_0x0a9e('0x1d')](function(_0x563627){if(_0x563627){_0x3511c9[_0x0a9e('0x26')]=_0x563627[_0x0a9e('0x65')]({'plain':!![]});return db[_0x0a9e('0x66')][_0x0a9e('0x59')]({'where':{'id':_0x563627['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4abc8f,null))[_0x0a9e('0x1d')](function(_0x2bbdb5){if(_0x2bbdb5){_0x3511c9['interaction']=_0x2bbdb5[_0x0a9e('0x65')]({'plain':!![]});interaction_log['info'](_0x0a9e('0x74'),_0x361b21[_0x0a9e('0x63')]['id'],_0x361b21['user'][_0x0a9e('0x38')],_0x361b21[_0x0a9e('0x63')][_0x0a9e('0x6b')],_0x3511c9[_0x0a9e('0x3e')]['id'],_0x361b21[_0x0a9e('0x3c')]?JSON[_0x0a9e('0x23')](_0x361b21[_0x0a9e('0x3c')]):'null');return respondWithRpcPromise(_0x0a9e('0x75'),_0x0a9e('0x76'),_0x3511c9);}return null;})[_0x0a9e('0x1d')](function(_0x16e5b9){if(_0x16e5b9){_0x16e5b9['message'][_0x0a9e('0x6e')]=util[_0x0a9e('0x61')]('SIP/%s',_0x361b21[_0x0a9e('0x63')]['name']);_0x16e5b9[_0x0a9e('0x26')][_0x0a9e('0x6f')]=_0x3511c9[_0x0a9e('0x6f')];_0x16e5b9[_0x0a9e('0x26')]['event']='reject';respondWithRpcPromise(_0x0a9e('0x71'),_0x0a9e('0x71'),{'event':_0x0a9e('0x77'),'message':_0x16e5b9['message']},client9002);return _0x3511c9;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4abc8f,null))[_0x0a9e('0x28')](handleError(_0x4abc8f,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 26b37b8..8c37be9 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 _0x0eca=['hasOwnProperty','hook','events','setMaxListeners','save','remove','emit'];(function(_0x59dccc,_0x184c1c){var _0xc97bcb=function(_0x1ddbcb){while(--_0x1ddbcb){_0x59dccc['push'](_0x59dccc['shift']());}};_0xc97bcb(++_0x184c1c);}(_0x0eca,0x1b4));var _0xa0ec=function(_0x2e353f,_0x15d70a){_0x2e353f=_0x2e353f-0x0;var _0x4b0700=_0x0eca[_0x2e353f];return _0x4b0700;};'use strict';var EventEmitter=require(_0xa0ec('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa0ec('0x1')](0x0);var events={'afterCreate':_0xa0ec('0x2'),'afterUpdate':'update','afterDestroy':_0xa0ec('0x3')};function emitEvent(_0x2d828b){return function(_0x4c268e,_0x357584,_0x433503){ChatMessageEvents['emit'](_0x2d828b+':'+_0x4c268e['id'],_0x4c268e);ChatMessageEvents[_0xa0ec('0x4')](_0x2d828b,_0x4c268e);_0x433503(null);};}for(var e in events){if(events[_0xa0ec('0x5')](e)){var event=events[e];ChatMessage[_0xa0ec('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xa35a=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x5589ac,_0x43ea17){var _0x435500=function(_0x32077b){while(--_0x32077b){_0x5589ac['push'](_0x5589ac['shift']());}};_0x435500(++_0x43ea17);}(_0xa35a,0x10a));var _0xaa35=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xa35a[_0x4a53d];return _0x27410e;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xaa35('0x0'))['db'][_0xaa35('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xaa35('0x2')](0x0);var events={'afterCreate':_0xaa35('0x3'),'afterUpdate':_0xaa35('0x4'),'afterDestroy':_0xaa35('0x5')};function emitEvent(_0x554f02){return function(_0x5eb2e9,_0x4f0012,_0x2cdef8){ChatMessageEvents[_0xaa35('0x6')](_0x554f02+':'+_0x5eb2e9['id'],_0x5eb2e9);ChatMessageEvents[_0xaa35('0x6')](_0x554f02,_0x5eb2e9);_0x2cdef8(null);};}for(var e in events){if(events[_0xaa35('0x7')](e)){var event=events[e];ChatMessage[_0xaa35('0x8')](e,emitEvent(event));}}module[_0xaa35('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 6313dce..c1bc7d4 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 _0x38d3=['ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','update','catch','error','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define'];(function(_0x4c6ea2,_0x235789){var _0x3f1e64=function(_0x32cc91){while(--_0x32cc91){_0x4c6ea2['push'](_0x4c6ea2['shift']());}};_0x3f1e64(++_0x235789);}(_0x38d3,0x1a7));var _0x338d=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x38d3[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x338d('0x0'));var util=require(_0x338d('0x1'));var logger=require('../../config/logger')(_0x338d('0x2'));var moment=require(_0x338d('0x3'));var BPromise=require(_0x338d('0x4'));var rp=require(_0x338d('0x5'));var fs=require('fs');var path=require(_0x338d('0x6'));var rimraf=require(_0x338d('0x7'));var config=require(_0x338d('0x8'));var attributes=require(_0x338d('0x9'));module[_0x338d('0xa')]=function(_0x4e32b4,_0x2a056d){return _0x4e32b4[_0x338d('0xb')](_0x338d('0xc'),attributes,{'tableName':_0x338d('0xd'),'paranoid':![],'indexes':[{'name':_0x338d('0xe'),'fields':[_0x338d('0xf')],'type':_0x338d('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x489cb2,_0x264986,_0x46b524){var _0x3c9b82=_0x4e32b4[_0x338d('0x11')];var _0x111c22=_0x489cb2[_0x338d('0x12')]({'plain':!![]});if(_0x111c22['direction'][_0x338d('0x13')]()==='in'||_0x111c22[_0x338d('0x14')][_0x338d('0x13')]()===_0x338d('0x15')&&!_0x111c22[_0x338d('0x16')]&&!_[_0x338d('0x17')](_0x111c22[_0x338d('0x18')])){_0x3c9b82[_0x338d('0x19')]['findOne']({'where':{'id':_0x111c22['ChatInteractionId']}})['then'](function(_0x1259d4){if(_0x1259d4){_0x1259d4[_0x338d('0x1a')]({'lastMsgAt':_0x111c22['createdAt'],'lastMsgDirection':_0x111c22[_0x338d('0x14')]['toLowerCase']()});}})[_0x338d('0x1b')](function(_0x36b054){console[_0x338d('0x1c')](_0x36b054);});}_0x46b524();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x41d9=['UserId','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret'];(function(_0x284664,_0x455bfa){var _0x2e5d22=function(_0x40f40b){while(--_0x40f40b){_0x284664['push'](_0x284664['shift']());}};_0x2e5d22(++_0x455bfa);}(_0x41d9,0x13c));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x941d('0x0'));var util=require(_0x941d('0x1'));var logger=require(_0x941d('0x2'))(_0x941d('0x3'));var moment=require(_0x941d('0x4'));var BPromise=require(_0x941d('0x5'));var rp=require(_0x941d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x941d('0x7'));var config=require(_0x941d('0x8'));var attributes=require('./chatMessage.attributes');module[_0x941d('0x9')]=function(_0x19dd41,_0x56e384){return _0x19dd41[_0x941d('0xa')]('ChatMessage',attributes,{'tableName':_0x941d('0xb'),'paranoid':![],'indexes':[{'name':_0x941d('0xc'),'fields':[_0x941d('0xd')],'type':_0x941d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x28033a,_0x546a1a,_0x176430){var _0x1c5e4d=_0x19dd41[_0x941d('0xf')];var _0x10d08e=_0x28033a['get']({'plain':!![]});if(_0x10d08e[_0x941d('0x10')][_0x941d('0x11')]()==='in'||_0x10d08e[_0x941d('0x10')][_0x941d('0x11')]()===_0x941d('0x12')&&!_0x10d08e[_0x941d('0x13')]&&!_['isNil'](_0x10d08e[_0x941d('0x14')])){_0x1c5e4d['ChatInteraction']['findOne']({'where':{'id':_0x10d08e[_0x941d('0x15')]}})[_0x941d('0x16')](function(_0xbd3711){if(_0xbd3711){_0xbd3711[_0x941d('0x17')]({'lastMsgAt':_0x10d08e[_0x941d('0x18')],'lastMsgDirection':_0x10d08e[_0x941d('0x10')][_0x941d('0x11')]()});}})[_0x941d('0x19')](function(_0x369b0b){console[_0x941d('0x1a')](_0x369b0b);});}_0x176430();}},'charset':_0x941d('0x1b'),'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 dda8d49..183f9d6 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 _0x4c3e=['stringify','error','ChatMessage,\x20%s,\x20%s','message','catch','create','body','options','CreateChatMessage','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0xc8a598,_0x8ffd7c){var _0x2a6225=function(_0x5f2d46){while(--_0x5f2d46){_0xc8a598['push'](_0xc8a598['shift']());}};_0x2a6225(++_0x8ffd7c);}(_0x4c3e,0xbf));var _0xe4c3=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4c3e[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xe4c3('0x0'));var util=require('util');var moment=require(_0xe4c3('0x1'));var BPromise=require('bluebird');var rs=require(_0xe4c3('0x2'));var fs=require('fs');var Redis=require(_0xe4c3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4c3('0x4'));var logger=require('../../config/logger')(_0xe4c3('0x5'));var config=require(_0xe4c3('0x6'));var jayson=require(_0xe4c3('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xe4c3('0x8')]=_[_0xe4c3('0x9')](config[_0xe4c3('0x8')],{'host':_0xe4c3('0xa'),'port':0x18eb});var socket=require(_0xe4c3('0xb'))(new Redis(config[_0xe4c3('0x8')]));require('./chatMessage.socket')[_0xe4c3('0xc')](socket);function respondWithRpcPromise(_0x4bc876,_0x4f532a,_0x597ce3){return new BPromise(function(_0x293654,_0x10809b){return client['request'](_0x4bc876,_0x597ce3)[_0xe4c3('0xd')](function(_0x5b40be){logger[_0xe4c3('0xe')]('ChatMessage,\x20%s,\x20%s',_0x4f532a,_0xe4c3('0xf'));logger['debug'](_0xe4c3('0x10'),_0x4f532a,_0xe4c3('0xf'),JSON[_0xe4c3('0x11')](_0x5b40be));if(_0x5b40be[_0xe4c3('0x12')]){if(_0x5b40be[_0xe4c3('0x12')]['code']===0x1f4){logger['error'](_0xe4c3('0x13'),_0x4f532a,_0x5b40be[_0xe4c3('0x12')]['message']);return _0x10809b(_0x5b40be[_0xe4c3('0x12')][_0xe4c3('0x14')]);}logger['error'](_0xe4c3('0x13'),_0x4f532a,_0x5b40be[_0xe4c3('0x12')][_0xe4c3('0x14')]);return _0x293654(_0x5b40be[_0xe4c3('0x12')][_0xe4c3('0x14')]);}else{logger[_0xe4c3('0xe')](_0xe4c3('0x13'),_0x4f532a,_0xe4c3('0xf'));_0x293654(_0x5b40be['result']['message']);}})[_0xe4c3('0x15')](function(_0x5e2e36){logger[_0xe4c3('0x12')]('ChatMessage,\x20%s,\x20%s',_0x4f532a,_0x5e2e36);_0x10809b(_0x5e2e36);});});}exports['CreateChatMessage']=function(_0x3d34ab){var _0x363212=this;return new Promise(function(_0xe5b666,_0x1de69a){return db['ChatMessage'][_0xe4c3('0x16')](_0x3d34ab[_0xe4c3('0x17')],{'raw':_0x3d34ab[_0xe4c3('0x18')]?_0x3d34ab[_0xe4c3('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xe4c3('0xd')](function(_0x54514a){logger[_0xe4c3('0xe')](_0xe4c3('0x19'),_0x3d34ab);logger['debug']('CreateChatMessage',_0x3d34ab,JSON[_0xe4c3('0x11')](_0x54514a));_0xe5b666(_0x54514a);})[_0xe4c3('0x15')](function(_0x3a4ac9){logger['error'](_0xe4c3('0x19'),_0x3a4ac9[_0xe4c3('0x14')],_0x3d34ab);_0x1de69a(_0x363212[_0xe4c3('0x12')](0x1f4,_0x3a4ac9[_0xe4c3('0x14')]));});});}; \ No newline at end of file +var _0x2198=['../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateChatMessage','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x44039a,_0x2ac8a8){var _0x525de5=function(_0x1dc635){while(--_0x1dc635){_0x44039a['push'](_0x44039a['shift']());}};_0x525de5(++_0x2ac8a8);}(_0x2198,0x1da));var _0x8219=function(_0x11de22,_0x96e2f5){_0x11de22=_0x11de22-0x0;var _0x54aee9=_0x2198[_0x11de22];return _0x54aee9;};'use strict';var _=require(_0x8219('0x0'));var util=require(_0x8219('0x1'));var moment=require(_0x8219('0x2'));var BPromise=require('bluebird');var rs=require(_0x8219('0x3'));var fs=require('fs');var Redis=require(_0x8219('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8219('0x5'));var logger=require(_0x8219('0x6'))(_0x8219('0x7'));var config=require('../../config/environment');var jayson=require(_0x8219('0x8'));var client=jayson[_0x8219('0x9')][_0x8219('0xa')]({'port':0x232a});config[_0x8219('0xb')]=_['defaults'](config[_0x8219('0xb')],{'host':_0x8219('0xc'),'port':0x18eb});var socket=require(_0x8219('0xd'))(new Redis(config[_0x8219('0xb')]));require(_0x8219('0xe'))[_0x8219('0xf')](socket);function respondWithRpcPromise(_0x4438e3,_0xda39a6,_0x439f3f){return new BPromise(function(_0x432397,_0x2a11df){return client[_0x8219('0x10')](_0x4438e3,_0x439f3f)[_0x8219('0x11')](function(_0x5176bb){logger[_0x8219('0x12')](_0x8219('0x13'),_0xda39a6,_0x8219('0x14'));logger[_0x8219('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0xda39a6,'request\x20sent',JSON[_0x8219('0x16')](_0x5176bb));if(_0x5176bb[_0x8219('0x17')]){if(_0x5176bb[_0x8219('0x17')]['code']===0x1f4){logger[_0x8219('0x17')]('ChatMessage,\x20%s,\x20%s',_0xda39a6,_0x5176bb[_0x8219('0x17')][_0x8219('0x18')]);return _0x2a11df(_0x5176bb['error'][_0x8219('0x18')]);}logger[_0x8219('0x17')]('ChatMessage,\x20%s,\x20%s',_0xda39a6,_0x5176bb[_0x8219('0x17')]['message']);return _0x432397(_0x5176bb[_0x8219('0x17')][_0x8219('0x18')]);}else{logger['info'](_0x8219('0x13'),_0xda39a6,'request\x20sent');_0x432397(_0x5176bb[_0x8219('0x19')][_0x8219('0x18')]);}})[_0x8219('0x1a')](function(_0x510be8){logger[_0x8219('0x17')](_0x8219('0x13'),_0xda39a6,_0x510be8);_0x2a11df(_0x510be8);});});}exports[_0x8219('0x1b')]=function(_0x105752){var _0xf6e5cc=this;return new Promise(function(_0x31be81,_0xeb73b7){return db['ChatMessage'][_0x8219('0x1c')](_0x105752[_0x8219('0x1d')],{'raw':_0x105752[_0x8219('0x1e')]?_0x105752[_0x8219('0x1e')][_0x8219('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x3767f8){logger[_0x8219('0x12')](_0x8219('0x1b'),_0x105752);logger[_0x8219('0x15')](_0x8219('0x1b'),_0x105752,JSON[_0x8219('0x16')](_0x3767f8));_0x31be81(_0x3767f8);})[_0x8219('0x1a')](function(_0x19be98){logger[_0x8219('0x17')](_0x8219('0x1b'),_0x19be98['message'],_0x105752);_0xeb73b7(_0xf6e5cc[_0x8219('0x17')](0x1f4,_0x19be98[_0x8219('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 5f2e22a..0fc1546 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 _0xc4aa=['remove','update','removeListener','register','length','./chatMessage.events','save'];(function(_0x445707,_0x94e1c2){var _0x279525=function(_0x41264a){while(--_0x41264a){_0x445707['push'](_0x445707['shift']());}};_0x279525(++_0x94e1c2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xc4aa[_0x2235bf];return _0x4c3a64;};'use strict';var ChatMessageEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){ChatMessageEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('chatMessage:'+_0x10525b,_0x215f39);ChatMessageEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file +var _0x2675=['register','length','chatMessage:','./chatMessage.events','emit','removeListener'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0x2675,0x75));var _0x5267=function(_0xb3a6f7,_0x1c8ec5){_0xb3a6f7=_0xb3a6f7-0x0;var _0x4c087f=_0x2675[_0xb3a6f7];return _0x4c087f;};'use strict';var ChatMessageEvents=require(_0x5267('0x0'));var events=['save','remove','update'];function createListener(_0x1da342,_0x2ae442){return function(_0x57c95a){_0x2ae442[_0x5267('0x1')](_0x1da342,_0x57c95a);};}function removeListener(_0x36bdf0,_0x4e2548){return function(){ChatMessageEvents[_0x5267('0x2')](_0x36bdf0,_0x4e2548);};}exports[_0x5267('0x3')]=function(_0x4bd042){for(var _0x10f92c=0x0,_0x20f065=events[_0x5267('0x4')];_0x10f92c<_0x20f065;_0x10f92c++){var _0x527c16=events[_0x10f92c];var _0x9e0a27=createListener(_0x5267('0x5')+_0x527c16,_0x4bd042);ChatMessageEvents['on'](_0x527c16,_0x9e0a27);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index d90fc19..b8cb1ce 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 _0x55ea=['../../components/interaction/service','./chatMessage.controller','/describe','isAuthenticated','describe','get','/:id','show','post','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x8c4526,_0x5c04cb){var _0x36c4cf=function(_0x198a67){while(--_0x198a67){_0x8c4526['push'](_0x8c4526['shift']());}};_0x36c4cf(++_0x5c04cb);}(_0x55ea,0xc9));var _0xa55e=function(_0x43be5e,_0x27bd4c){_0x43be5e=_0x43be5e-0x0;var _0x4d1fbd=_0x55ea[_0x43be5e];return _0x4d1fbd;};'use strict';var multer=require(_0xa55e('0x0'));var util=require(_0xa55e('0x1'));var path=require(_0xa55e('0x2'));var timeout=require('connect-timeout');var express=require(_0xa55e('0x3'));var router=express[_0xa55e('0x4')]();var fs_extra=require(_0xa55e('0x5'));var auth=require(_0xa55e('0x6'));var interaction=require(_0xa55e('0x7'));var config=require('../../config/environment');var controller=require(_0xa55e('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa55e('0x9'),auth[_0xa55e('0xa')](),controller[_0xa55e('0xb')]);router[_0xa55e('0xc')](_0xa55e('0xd'),auth[_0xa55e('0xa')](),controller[_0xa55e('0xe')]);router[_0xa55e('0xf')]('/',auth[_0xa55e('0xa')](),interaction['tracked']('chat',_0xa55e('0x10')),controller[_0xa55e('0x11')]);router[_0xa55e('0x12')](_0xa55e('0xd'),controller[_0xa55e('0x13')]);router['put'](_0xa55e('0x14'),auth['isAuthenticated'](),controller[_0xa55e('0x15')]);router[_0xa55e('0x12')](_0xa55e('0x16'),auth[_0xa55e('0xa')](),controller[_0xa55e('0x17')]);router[_0xa55e('0x18')](_0xa55e('0xd'),auth[_0xa55e('0xa')](),controller[_0xa55e('0x19')]);module['exports']=router; \ No newline at end of file +var _0x8130=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','chatmessage:create','put','update','/:id/accept','/:id/reject','delete','destroy'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x8130,0x146));var _0x0813=function(_0x13a61c,_0x51f924){_0x13a61c=_0x13a61c-0x0;var _0x1ae767=_0x8130[_0x13a61c];return _0x1ae767;};'use strict';var multer=require(_0x0813('0x0'));var util=require(_0x0813('0x1'));var path=require('path');var timeout=require(_0x0813('0x2'));var express=require(_0x0813('0x3'));var router=express[_0x0813('0x4')]();var fs_extra=require(_0x0813('0x5'));var auth=require(_0x0813('0x6'));var interaction=require(_0x0813('0x7'));var config=require('../../config/environment');var controller=require(_0x0813('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0813('0x9')]);router[_0x0813('0xa')](_0x0813('0xb'),auth[_0x0813('0xc')](),controller[_0x0813('0xd')]);router[_0x0813('0xa')](_0x0813('0xe'),auth['isAuthenticated'](),controller[_0x0813('0xf')]);router[_0x0813('0x10')]('/',auth[_0x0813('0xc')](),interaction['tracked']('chat',_0x0813('0x11')),controller['create']);router[_0x0813('0x12')]('/:id',controller[_0x0813('0x13')]);router[_0x0813('0x12')](_0x0813('0x14'),auth[_0x0813('0xc')](),controller['accept']);router['put'](_0x0813('0x15'),auth[_0x0813('0xc')](),controller['reject']);router[_0x0813('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x0813('0x17')]);module[_0x0813('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index e377354..7225ce2 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 _0x4494=['medium','sequelize'];(function(_0x7ea168,_0x19fd7f){var _0x1f8a07=function(_0x2cc9a9){while(--_0x2cc9a9){_0x7ea168['push'](_0x7ea168['shift']());}};_0x1f8a07(++_0x19fd7f);}(_0x4494,0xb3));var _0x4449=function(_0x678bd0,_0x4faa71){_0x678bd0=_0x678bd0-0x0;var _0xdf99e1=_0x4494[_0x678bd0];return _0xdf99e1;};'use strict';var Sequelize=require(_0x4449('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x4449('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x21a2=['TEXT','medium','sequelize','exports'];(function(_0x2c8208,_0x3600de){var _0x56afa7=function(_0x2e6943){while(--_0x2e6943){_0x2c8208['push'](_0x2c8208['shift']());}};_0x56afa7(++_0x3600de);}(_0x21a2,0x10e));var _0x221a=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x21a2[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x221a('0x0'));module[_0x221a('0x1')]={'body':{'type':Sequelize[_0x221a('0x2')](_0x221a('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 909d743..31a4be3 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 _0xefda=['../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','render','merge','contact','agent','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','ChatOfflineMessage','rows','catch','show','params','create','body','find','Attachment','join','root','attachments','offline-chat','basename','existsSync','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3d2df5,_0x591b54){var _0x33c00d=function(_0x518ebf){while(--_0x518ebf){_0x3d2df5['push'](_0x3d2df5['shift']());}};_0x33c00d(++_0x591b54);}(_0xefda,0x96));var _0xaefd=function(_0x2b2583,_0x2a154b){_0x2b2583=_0x2b2583-0x0;var _0x4cd668=_0xefda[_0x2b2583];return _0x4cd668;};'use strict';var emlformat=require(_0xaefd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaefd('0x1'));var rp=require(_0xaefd('0x2'));var moment=require('moment');var BPromise=require(_0xaefd('0x3'));var Mustache=require(_0xaefd('0x4'));var util=require(_0xaefd('0x5'));var path=require(_0xaefd('0x6'));var sox=require(_0xaefd('0x7'));var csv=require(_0xaefd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaefd('0x9'));var _=require(_0xaefd('0xa'));var squel=require(_0xaefd('0xb'));var crypto=require(_0xaefd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaefd('0xd'));var toCsv=require(_0xaefd('0x8'));var querystring=require(_0xaefd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaefd('0xf'));var as=require(_0xaefd('0x10'));var hardwareService=require(_0xaefd('0x11'));var logger=require(_0xaefd('0x12'))(_0xaefd('0x13'));var utils=require(_0xaefd('0x14'));var config=require(_0xaefd('0x15'));var licenseUtil=require(_0xaefd('0x16'));var db=require(_0xaefd('0x17'))['db'];function respondWithStatusCode(_0x382983,_0x2a310c){_0x2a310c=_0x2a310c||0xcc;return function(_0x4b2b5c){if(_0x4b2b5c){return _0x382983[_0xaefd('0x18')](_0x2a310c);}return _0x382983['status'](_0x2a310c)[_0xaefd('0x19')]();};}function respondWithResult(_0x1725af,_0x9dfdf6){_0x9dfdf6=_0x9dfdf6||0xc8;return function(_0x43b82a){if(_0x43b82a){return _0x1725af['status'](_0x9dfdf6)[_0xaefd('0x1a')](_0x43b82a);}};}function respondWithFilteredResult(_0x13492c,_0x41f345){return function(_0x411701){if(_0x411701){var _0x10ee28=typeof _0x41f345[_0xaefd('0x1b')]===_0xaefd('0x1c')&&typeof _0x41f345[_0xaefd('0x1d')]==='undefined';var _0x9d9c29=_0x411701[_0xaefd('0x1e')];var _0x9748f4=_0x10ee28?0x0:_0x41f345[_0xaefd('0x1b')];var _0x2db61b=_0x10ee28?_0x411701[_0xaefd('0x1e')]:_0x41f345['offset']+_0x41f345[_0xaefd('0x1d')];var _0x182f9a;if(_0x2db61b>=_0x9d9c29){_0x2db61b=_0x9d9c29;_0x182f9a=0xc8;}else{_0x182f9a=0xce;}_0x13492c[_0xaefd('0x1f')](_0x182f9a);return _0x13492c[_0xaefd('0x20')](_0xaefd('0x21'),_0x9748f4+'-'+_0x2db61b+'/'+_0x9d9c29)[_0xaefd('0x1a')](_0x411701);}return null;};}function patchUpdates(_0x5282ed){return function(_0x463d48){try{jsonpatch[_0xaefd('0x22')](_0x463d48,_0x5282ed,!![]);}catch(_0x2dcdd8){return BPromise[_0xaefd('0x23')](_0x2dcdd8);}return _0x463d48[_0xaefd('0x24')]();};}function saveUpdates(_0x577fb7,_0x479486){return function(_0x5b9967){if(_0x5b9967){return _0x5b9967[_0xaefd('0x25')](_0x577fb7)[_0xaefd('0x26')](function(_0x313a6f){return _0x313a6f;});}return null;};}function removeEntity(_0x5a44ed,_0x23060f){return function(_0x4cd9b2){if(_0x4cd9b2){return _0x4cd9b2[_0xaefd('0x27')]()[_0xaefd('0x26')](function(){_0x5a44ed[_0xaefd('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x435413,_0x3ffc9c){return function(_0x18e720){if(!_0x18e720){_0x435413[_0xaefd('0x18')](0x194);}return _0x18e720;};}function handleError(_0x33862f,_0x5a170c){_0x5a170c=_0x5a170c||0x1f4;return function(_0x2fe27e){logger['error'](_0x2fe27e[_0xaefd('0x28')]);if(_0x2fe27e[_0xaefd('0x29')]){delete _0x2fe27e['name'];}_0x33862f[_0xaefd('0x1f')](_0x5a170c)[_0xaefd('0x2a')](_0x2fe27e);};}function getMustacheRender(_0x521839,_0xbeb1b8){return Mustache[_0xaefd('0x2b')](_0x521839,_[_0xaefd('0x2c')](_0xbeb1b8['body'],{'contact':_0xbeb1b8[_0xaefd('0x2d')],'message':_0xbeb1b8['message'],'agent':_0xbeb1b8[_0xaefd('0x2e')],'interaction':_0xbeb1b8['interaction'],'account':_0xbeb1b8['account']}))||'';}exports[_0xaefd('0x2f')]=function(_0x1b470c,_0x4a032d){var _0x578378={},_0x4ee0c1={},_0x46cf1a={'count':0x0,'rows':[]};var _0x280eab=_['map'](db['ChatOfflineMessage'][_0xaefd('0x30')],function(_0x465d99){return{'name':_0x465d99[_0xaefd('0x31')],'type':_0x465d99[_0xaefd('0x32')]['key']};});_0x4ee0c1[_0xaefd('0x33')]=_[_0xaefd('0x34')](_0x280eab,_0xaefd('0x29'));_0x4ee0c1[_0xaefd('0x35')]=_[_0xaefd('0x36')](_0x1b470c[_0xaefd('0x35')]);_0x4ee0c1[_0xaefd('0x37')]=_[_0xaefd('0x38')](_0x4ee0c1[_0xaefd('0x33')],_0x4ee0c1[_0xaefd('0x35')]);_0x578378[_0xaefd('0x39')]=_[_0xaefd('0x38')](_0x4ee0c1[_0xaefd('0x33')],qs[_0xaefd('0x3a')](_0x1b470c[_0xaefd('0x35')][_0xaefd('0x3a')]));_0x578378['attributes']=_0x578378[_0xaefd('0x39')][_0xaefd('0x3b')]?_0x578378[_0xaefd('0x39')]:_0x4ee0c1['model'];if(!_0x1b470c[_0xaefd('0x35')]['hasOwnProperty'](_0xaefd('0x3c'))){_0x578378[_0xaefd('0x1d')]=qs[_0xaefd('0x1d')](_0x1b470c[_0xaefd('0x35')][_0xaefd('0x1d')]);_0x578378[_0xaefd('0x1b')]=qs[_0xaefd('0x1b')](_0x1b470c[_0xaefd('0x35')][_0xaefd('0x1b')]);}_0x578378[_0xaefd('0x3d')]=qs[_0xaefd('0x3e')](_0x1b470c[_0xaefd('0x35')][_0xaefd('0x3e')]);_0x578378[_0xaefd('0x3f')]=qs['filters'](_[_0xaefd('0x40')](_0x1b470c['query'],_0x4ee0c1[_0xaefd('0x37')]),_0x280eab);if(_0x1b470c[_0xaefd('0x35')][_0xaefd('0x41')]){_0x578378[_0xaefd('0x3f')]=_[_0xaefd('0x2c')](_0x578378[_0xaefd('0x3f')],{'$or':_[_0xaefd('0x34')](_0x280eab,function(_0x145e9e){if(_0x145e9e[_0xaefd('0x32')]!==_0xaefd('0x42')){var _0x53f693={};_0x53f693[_0x145e9e[_0xaefd('0x29')]]={'$like':'%'+_0x1b470c[_0xaefd('0x35')]['filter']+'%'};return _0x53f693;}})});}_0x578378=_[_0xaefd('0x2c')]({},_0x578378,_0x1b470c[_0xaefd('0x43')]);var _0x27daa8={'where':_0x578378['where']};return db['ChatOfflineMessage'][_0xaefd('0x1e')](_0x27daa8)[_0xaefd('0x26')](function(_0xf72a72){_0x46cf1a[_0xaefd('0x1e')]=_0xf72a72;if(_0x1b470c[_0xaefd('0x35')][_0xaefd('0x44')]){_0x578378[_0xaefd('0x45')]=[{'all':!![]}];}return db[_0xaefd('0x46')]['findAll'](_0x578378);})[_0xaefd('0x26')](function(_0x2cecdf){_0x46cf1a[_0xaefd('0x47')]=_0x2cecdf;return _0x46cf1a;})[_0xaefd('0x26')](respondWithFilteredResult(_0x4a032d,_0x578378))[_0xaefd('0x48')](handleError(_0x4a032d,null));};exports[_0xaefd('0x49')]=function(_0x3633ec,_0x1f4a15){var _0x5d0f3d={'raw':!![],'where':{'id':_0x3633ec[_0xaefd('0x4a')]['id']}},_0x52d6ab={};_0x52d6ab[_0xaefd('0x33')]=_['keys'](db['ChatOfflineMessage'][_0xaefd('0x30')]);_0x52d6ab[_0xaefd('0x35')]=_[_0xaefd('0x36')](_0x3633ec[_0xaefd('0x35')]);_0x52d6ab[_0xaefd('0x37')]=_[_0xaefd('0x38')](_0x52d6ab[_0xaefd('0x33')],_0x52d6ab[_0xaefd('0x35')]);_0x5d0f3d[_0xaefd('0x39')]=_['intersection'](_0x52d6ab[_0xaefd('0x33')],qs[_0xaefd('0x3a')](_0x3633ec[_0xaefd('0x35')][_0xaefd('0x3a')]));_0x5d0f3d[_0xaefd('0x39')]=_0x5d0f3d[_0xaefd('0x39')][_0xaefd('0x3b')]?_0x5d0f3d['attributes']:_0x52d6ab[_0xaefd('0x33')];if(_0x3633ec['query'][_0xaefd('0x44')]){_0x5d0f3d[_0xaefd('0x45')]=[{'all':!![]}];}_0x5d0f3d=_[_0xaefd('0x2c')]({},_0x5d0f3d,_0x3633ec[_0xaefd('0x43')]);return db['ChatOfflineMessage']['find'](_0x5d0f3d)[_0xaefd('0x26')](handleEntityNotFound(_0x1f4a15,null))[_0xaefd('0x26')](respondWithResult(_0x1f4a15,null))[_0xaefd('0x48')](handleError(_0x1f4a15,null));};exports['create']=function(_0x2a836a,_0x24107e){return db['ChatOfflineMessage'][_0xaefd('0x4b')](_0x2a836a[_0xaefd('0x4c')],{})[_0xaefd('0x26')](respondWithResult(_0x24107e,0xc9))[_0xaefd('0x48')](handleError(_0x24107e,null));};exports[_0xaefd('0x25')]=function(_0xcdb133,_0x78a3e6){if(_0xcdb133[_0xaefd('0x4c')]['id']){delete _0xcdb133['body']['id'];}return db['ChatOfflineMessage'][_0xaefd('0x4d')]({'where':{'id':_0xcdb133[_0xaefd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x78a3e6,null))[_0xaefd('0x26')](saveUpdates(_0xcdb133['body'],null))[_0xaefd('0x26')](respondWithResult(_0x78a3e6,null))[_0xaefd('0x48')](handleError(_0x78a3e6,null));};exports[_0xaefd('0x27')]=function(_0x69185e,_0x27fd3f){return db[_0xaefd('0x4e')]['findAll']({'where':{'ChatOfflineMessageId':_0x69185e['params']['id']},'raw':!![]})[_0xaefd('0x26')](function(_0x338823){_0x338823['forEach'](function(_0x398ea0){var _0x3d8844=path[_0xaefd('0x4f')](config[_0xaefd('0x50')],'server','files',_0xaefd('0x51'),_0xaefd('0x52'),_0x398ea0[_0xaefd('0x53')]);var _0x1fe44a=fs[_0xaefd('0x54')](_0x3d8844);if(_0x1fe44a)fs_extra['remove'](_0x3d8844);});})[_0xaefd('0x26')](function(){return db[_0xaefd('0x46')]['find']({'where':{'id':_0x69185e[_0xaefd('0x4a')]['id']},'individualHooks':!![]});})[_0xaefd('0x26')](handleEntityNotFound(_0x27fd3f,null))['then'](removeEntity(_0x27fd3f,null))[_0xaefd('0x48')](handleError(_0x27fd3f,null));};exports[_0xaefd('0x55')]=function(_0x46be93,_0x4a5ddf){return db[_0xaefd('0x46')][_0xaefd('0x55')]()['then'](respondWithResult(_0x4a5ddf,null))[_0xaefd('0x48')](handleError(_0x4a5ddf,null));}; \ No newline at end of file +var _0x4325=['limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','body','message','account','index','map','ChatOfflineMessage','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','includeAll','rows','catch','show','params','include','options','find','create','findAll','join','root','files','offline-chat','existsSync','remove','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset'];(function(_0x564592,_0x41234e){var _0x198337=function(_0x191ee5){while(--_0x191ee5){_0x564592['push'](_0x564592['shift']());}};_0x198337(++_0x41234e);}(_0x4325,0x1da));var _0x5432=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4325[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x5432('0x0'));var rimraf=require(_0x5432('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5432('0x2'));var rp=require(_0x5432('0x3'));var moment=require(_0x5432('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5432('0x5'));var path=require(_0x5432('0x6'));var sox=require(_0x5432('0x7'));var csv=require('to-csv');var ejs=require(_0x5432('0x8'));var fs=require('fs');var fs_extra=require(_0x5432('0x9'));var _=require('lodash');var squel=require(_0x5432('0xa'));var crypto=require('crypto');var jsforce=require(_0x5432('0xb'));var deskjs=require(_0x5432('0xc'));var toCsv=require(_0x5432('0xd'));var querystring=require(_0x5432('0xe'));var Papa=require(_0x5432('0xf'));var Redis=require('ioredis');var authService=require(_0x5432('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5432('0x11'));var hardwareService=require(_0x5432('0x12'));var logger=require(_0x5432('0x13'))(_0x5432('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5432('0x15'));var db=require(_0x5432('0x16'))['db'];function respondWithStatusCode(_0x5366a0,_0x10a289){_0x10a289=_0x10a289||0xcc;return function(_0x111c54){if(_0x111c54){return _0x5366a0[_0x5432('0x17')](_0x10a289);}return _0x5366a0[_0x5432('0x18')](_0x10a289)[_0x5432('0x19')]();};}function respondWithResult(_0x1a084d,_0x54f41a){_0x54f41a=_0x54f41a||0xc8;return function(_0x5617ce){if(_0x5617ce){return _0x1a084d[_0x5432('0x18')](_0x54f41a)[_0x5432('0x1a')](_0x5617ce);}};}function respondWithFilteredResult(_0x3859d1,_0x364152){return function(_0x9d2023){if(_0x9d2023){var _0x11db3c=typeof _0x364152['offset']===_0x5432('0x1b')&&typeof _0x364152['limit']===_0x5432('0x1b');var _0x3de07a=_0x9d2023[_0x5432('0x1c')];var _0x32fe60=_0x11db3c?0x0:_0x364152[_0x5432('0x1d')];var _0x5f011f=_0x11db3c?_0x9d2023[_0x5432('0x1c')]:_0x364152[_0x5432('0x1d')]+_0x364152[_0x5432('0x1e')];var _0x2bfe04;if(_0x5f011f>=_0x3de07a){_0x5f011f=_0x3de07a;_0x2bfe04=0xc8;}else{_0x2bfe04=0xce;}_0x3859d1[_0x5432('0x18')](_0x2bfe04);return _0x3859d1[_0x5432('0x1f')](_0x5432('0x20'),_0x32fe60+'-'+_0x5f011f+'/'+_0x3de07a)['json'](_0x9d2023);}return null;};}function patchUpdates(_0x66911a){return function(_0x29cde7){try{jsonpatch[_0x5432('0x21')](_0x29cde7,_0x66911a,!![]);}catch(_0xa6c864){return BPromise[_0x5432('0x22')](_0xa6c864);}return _0x29cde7['save']();};}function saveUpdates(_0x5901e2,_0x4d09cd){return function(_0x61827e){if(_0x61827e){return _0x61827e[_0x5432('0x23')](_0x5901e2)[_0x5432('0x24')](function(_0x1f4870){return _0x1f4870;});}return null;};}function removeEntity(_0x4af9f6,_0x4af5f4){return function(_0x3e0b66){if(_0x3e0b66){return _0x3e0b66[_0x5432('0x25')]()['then'](function(){_0x4af9f6[_0x5432('0x18')](0xcc)[_0x5432('0x19')]();});}};}function handleEntityNotFound(_0x637582,_0x4b6ea5){return function(_0xd9928a){if(!_0xd9928a){_0x637582[_0x5432('0x17')](0x194);}return _0xd9928a;};}function handleError(_0xe7eda2,_0x520da1){_0x520da1=_0x520da1||0x1f4;return function(_0x4ab09d){logger[_0x5432('0x26')](_0x4ab09d[_0x5432('0x27')]);if(_0x4ab09d['name']){delete _0x4ab09d[_0x5432('0x28')];}_0xe7eda2[_0x5432('0x18')](_0x520da1)[_0x5432('0x29')](_0x4ab09d);};}function getMustacheRender(_0x4add5b,_0x29dc15){return Mustache['render'](_0x4add5b,_['merge'](_0x29dc15[_0x5432('0x2a')],{'contact':_0x29dc15['contact'],'message':_0x29dc15[_0x5432('0x2b')],'agent':_0x29dc15['agent'],'interaction':_0x29dc15['interaction'],'account':_0x29dc15[_0x5432('0x2c')]}))||'';}exports[_0x5432('0x2d')]=function(_0x345b51,_0x4e92d5){var _0x31490c={},_0x1d436c={},_0x214ed3={'count':0x0,'rows':[]};var _0x1d2fd4=_[_0x5432('0x2e')](db[_0x5432('0x2f')][_0x5432('0x30')],function(_0x444178){return{'name':_0x444178[_0x5432('0x31')],'type':_0x444178['type']['key']};});_0x1d436c[_0x5432('0x32')]=_[_0x5432('0x2e')](_0x1d2fd4,_0x5432('0x28'));_0x1d436c[_0x5432('0x33')]=_[_0x5432('0x34')](_0x345b51['query']);_0x1d436c[_0x5432('0x35')]=_['intersection'](_0x1d436c[_0x5432('0x32')],_0x1d436c[_0x5432('0x33')]);_0x31490c[_0x5432('0x36')]=_[_0x5432('0x37')](_0x1d436c[_0x5432('0x32')],qs[_0x5432('0x38')](_0x345b51['query'][_0x5432('0x38')]));_0x31490c[_0x5432('0x36')]=_0x31490c[_0x5432('0x36')][_0x5432('0x39')]?_0x31490c['attributes']:_0x1d436c[_0x5432('0x32')];if(!_0x345b51[_0x5432('0x33')][_0x5432('0x3a')](_0x5432('0x3b'))){_0x31490c[_0x5432('0x1e')]=qs[_0x5432('0x1e')](_0x345b51[_0x5432('0x33')][_0x5432('0x1e')]);_0x31490c[_0x5432('0x1d')]=qs[_0x5432('0x1d')](_0x345b51[_0x5432('0x33')][_0x5432('0x1d')]);}_0x31490c[_0x5432('0x3c')]=qs[_0x5432('0x3d')](_0x345b51['query'][_0x5432('0x3d')]);_0x31490c['where']=qs[_0x5432('0x35')](_[_0x5432('0x3e')](_0x345b51[_0x5432('0x33')],_0x1d436c[_0x5432('0x35')]),_0x1d2fd4);if(_0x345b51['query']['filter']){_0x31490c['where']=_[_0x5432('0x3f')](_0x31490c[_0x5432('0x40')],{'$or':_[_0x5432('0x2e')](_0x1d2fd4,function(_0x39c9c0){if(_0x39c9c0['type']!==_0x5432('0x41')){var _0x183d92={};_0x183d92[_0x39c9c0[_0x5432('0x28')]]={'$like':'%'+_0x345b51['query'][_0x5432('0x42')]+'%'};return _0x183d92;}})});}_0x31490c=_[_0x5432('0x3f')]({},_0x31490c,_0x345b51['options']);var _0x3eb446={'where':_0x31490c[_0x5432('0x40')]};return db['ChatOfflineMessage'][_0x5432('0x1c')](_0x3eb446)['then'](function(_0x2f1a51){_0x214ed3[_0x5432('0x1c')]=_0x2f1a51;if(_0x345b51[_0x5432('0x33')][_0x5432('0x43')]){_0x31490c['include']=[{'all':!![]}];}return db[_0x5432('0x2f')]['findAll'](_0x31490c);})[_0x5432('0x24')](function(_0x15f18d){_0x214ed3[_0x5432('0x44')]=_0x15f18d;return _0x214ed3;})[_0x5432('0x24')](respondWithFilteredResult(_0x4e92d5,_0x31490c))[_0x5432('0x45')](handleError(_0x4e92d5,null));};exports[_0x5432('0x46')]=function(_0x2234da,_0x4ab024){var _0x31fca4={'raw':!![],'where':{'id':_0x2234da[_0x5432('0x47')]['id']}},_0x534d47={};_0x534d47[_0x5432('0x32')]=_[_0x5432('0x34')](db[_0x5432('0x2f')][_0x5432('0x30')]);_0x534d47['query']=_[_0x5432('0x34')](_0x2234da[_0x5432('0x33')]);_0x534d47[_0x5432('0x35')]=_[_0x5432('0x37')](_0x534d47[_0x5432('0x32')],_0x534d47['query']);_0x31fca4[_0x5432('0x36')]=_['intersection'](_0x534d47[_0x5432('0x32')],qs[_0x5432('0x38')](_0x2234da['query'][_0x5432('0x38')]));_0x31fca4['attributes']=_0x31fca4[_0x5432('0x36')][_0x5432('0x39')]?_0x31fca4['attributes']:_0x534d47['model'];if(_0x2234da[_0x5432('0x33')][_0x5432('0x43')]){_0x31fca4[_0x5432('0x48')]=[{'all':!![]}];}_0x31fca4=_[_0x5432('0x3f')]({},_0x31fca4,_0x2234da[_0x5432('0x49')]);return db[_0x5432('0x2f')][_0x5432('0x4a')](_0x31fca4)['then'](handleEntityNotFound(_0x4ab024,null))[_0x5432('0x24')](respondWithResult(_0x4ab024,null))[_0x5432('0x45')](handleError(_0x4ab024,null));};exports[_0x5432('0x4b')]=function(_0x5b1355,_0x5ca992){return db['ChatOfflineMessage']['create'](_0x5b1355[_0x5432('0x2a')],{})[_0x5432('0x24')](respondWithResult(_0x5ca992,0xc9))[_0x5432('0x45')](handleError(_0x5ca992,null));};exports[_0x5432('0x23')]=function(_0x1beefd,_0x4bc716){if(_0x1beefd[_0x5432('0x2a')]['id']){delete _0x1beefd[_0x5432('0x2a')]['id'];}return db[_0x5432('0x2f')]['find']({'where':{'id':_0x1beefd[_0x5432('0x47')]['id']}})[_0x5432('0x24')](handleEntityNotFound(_0x4bc716,null))[_0x5432('0x24')](saveUpdates(_0x1beefd[_0x5432('0x2a')],null))[_0x5432('0x24')](respondWithResult(_0x4bc716,null))['catch'](handleError(_0x4bc716,null));};exports[_0x5432('0x25')]=function(_0x5bbedb,_0x2fd527){return db['Attachment'][_0x5432('0x4c')]({'where':{'ChatOfflineMessageId':_0x5bbedb[_0x5432('0x47')]['id']},'raw':!![]})['then'](function(_0x7129e2){_0x7129e2['forEach'](function(_0x18fd03){var _0x2234fe=path[_0x5432('0x4d')](config[_0x5432('0x4e')],'server',_0x5432('0x4f'),'attachments',_0x5432('0x50'),_0x18fd03['basename']);var _0x1c5c5c=fs[_0x5432('0x51')](_0x2234fe);if(_0x1c5c5c)fs_extra[_0x5432('0x52')](_0x2234fe);});})[_0x5432('0x24')](function(){return db[_0x5432('0x2f')][_0x5432('0x4a')]({'where':{'id':_0x5bbedb[_0x5432('0x47')]['id']},'individualHooks':!![]});})[_0x5432('0x24')](handleEntityNotFound(_0x2fd527,null))[_0x5432('0x24')](removeEntity(_0x2fd527,null))[_0x5432('0x45')](handleError(_0x2fd527,null));};exports['describe']=function(_0x3d4afd,_0xb489e8){return db['ChatOfflineMessage'][_0x5432('0x53')]()[_0x5432('0x24')](respondWithResult(_0xb489e8,null))[_0x5432('0x45')](handleError(_0xb489e8,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index fa0b54d..093268d 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 _0xb7c8=['bluebird','request-promise','path','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x3b1b95,_0x10c556){var _0x32977f=function(_0x28c7cf){while(--_0x28c7cf){_0x3b1b95['push'](_0x3b1b95['shift']());}};_0x32977f(++_0x10c556);}(_0xb7c8,0x119));var _0x8b7c=function(_0x21b7f1,_0x509839){_0x21b7f1=_0x21b7f1-0x0;var _0xc3f06b=_0xb7c8[_0x21b7f1];return _0xc3f06b;};'use strict';var _=require('lodash');var util=require(_0x8b7c('0x0'));var logger=require(_0x8b7c('0x1'))(_0x8b7c('0x2'));var moment=require(_0x8b7c('0x3'));var BPromise=require(_0x8b7c('0x4'));var rp=require(_0x8b7c('0x5'));var fs=require('fs');var path=require(_0x8b7c('0x6'));var rimraf=require('rimraf');var config=require(_0x8b7c('0x7'));var attributes=require(_0x8b7c('0x8'));module[_0x8b7c('0x9')]=function(_0x440900,_0x107428){return _0x440900[_0x8b7c('0xa')](_0x8b7c('0xb'),attributes,{'tableName':_0x8b7c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8b7c('0xd'),'collate':_0x8b7c('0xe')});}; \ No newline at end of file +var _0x5fd1=['exports','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x5fd1,0x155));var _0x15fd=function(_0x35d033,_0xf6140c){_0x35d033=_0x35d033-0x0;var _0x257ed1=_0x5fd1[_0x35d033];return _0x257ed1;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var logger=require(_0x15fd('0x1'))(_0x15fd('0x2'));var moment=require(_0x15fd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x15fd('0x4'));var rimraf=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var attributes=require('./chatOfflineMessage.attributes');module[_0x15fd('0x7')]=function(_0x386441,_0x18450c){return _0x386441[_0x15fd('0x8')](_0x15fd('0x9'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x15fd('0xa'),'collate':_0x15fd('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index ea9218f..9640e07 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 _0xf23a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4ca3fa,_0x3207a0){var _0x2244c3=function(_0x49236e){while(--_0x49236e){_0x4ca3fa['push'](_0x4ca3fa['shift']());}};_0x2244c3(++_0x3207a0);}(_0xf23a,0x9d));var _0xaf23=function(_0x345fad,_0x4ed1c3){_0x345fad=_0x345fad-0x0;var _0xc61976=_0xf23a[_0x345fad];return _0xc61976;};'use strict';var _=require(_0xaf23('0x0'));var util=require(_0xaf23('0x1'));var moment=require(_0xaf23('0x2'));var BPromise=require(_0xaf23('0x3'));var rs=require(_0xaf23('0x4'));var fs=require('fs');var Redis=require(_0xaf23('0x5'));var db=require(_0xaf23('0x6'))['db'];var utils=require(_0xaf23('0x7'));var logger=require(_0xaf23('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaf23('0x9')][_0xaf23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bc184,_0x3f7ee4,_0x2758b2){return new BPromise(function(_0x54d09b,_0x182ab9){return client[_0xaf23('0xb')](_0x5bc184,_0x2758b2)[_0xaf23('0xc')](function(_0x1214be){logger[_0xaf23('0xd')](_0xaf23('0xe'),_0x3f7ee4,'request\x20sent');logger[_0xaf23('0xf')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x3f7ee4,_0xaf23('0x10'),JSON[_0xaf23('0x11')](_0x1214be));if(_0x1214be['error']){if(_0x1214be[_0xaf23('0x12')][_0xaf23('0x13')]===0x1f4){logger[_0xaf23('0x12')](_0xaf23('0xe'),_0x3f7ee4,_0x1214be[_0xaf23('0x12')][_0xaf23('0x14')]);return _0x182ab9(_0x1214be[_0xaf23('0x12')][_0xaf23('0x14')]);}logger['error'](_0xaf23('0xe'),_0x3f7ee4,_0x1214be[_0xaf23('0x12')][_0xaf23('0x14')]);return _0x54d09b(_0x1214be['error'][_0xaf23('0x14')]);}else{logger[_0xaf23('0xd')](_0xaf23('0xe'),_0x3f7ee4,_0xaf23('0x10'));_0x54d09b(_0x1214be[_0xaf23('0x15')]['message']);}})[_0xaf23('0x16')](function(_0x128060){logger['error'](_0xaf23('0xe'),_0x3f7ee4,_0x128060);_0x182ab9(_0x128060);});});} \ No newline at end of file +var _0xa7ab=['ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3a6204,_0xc3d4d2){var _0x2f425d=function(_0x479c57){while(--_0x479c57){_0x3a6204['push'](_0x3a6204['shift']());}};_0x2f425d(++_0xc3d4d2);}(_0xa7ab,0x119));var _0xba7a=function(_0x3221cf,_0x58f4ec){_0x3221cf=_0x3221cf-0x0;var _0x2dd1da=_0xa7ab[_0x3221cf];return _0x2dd1da;};'use strict';var _=require(_0xba7a('0x0'));var util=require('util');var moment=require(_0xba7a('0x1'));var BPromise=require(_0xba7a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba7a('0x3'));var db=require(_0xba7a('0x4'))['db'];var utils=require(_0xba7a('0x5'));var logger=require(_0xba7a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xba7a('0x7'));var client=jayson['client'][_0xba7a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1da4cc,_0x911702,_0x2406fd){return new BPromise(function(_0x327daf,_0x29aa1f){return client['request'](_0x1da4cc,_0x2406fd)[_0xba7a('0x9')](function(_0x252970){logger['info'](_0xba7a('0xa'),_0x911702,_0xba7a('0xb'));logger[_0xba7a('0xc')](_0xba7a('0xd'),_0x911702,_0xba7a('0xb'),JSON[_0xba7a('0xe')](_0x252970));if(_0x252970[_0xba7a('0xf')]){if(_0x252970[_0xba7a('0xf')][_0xba7a('0x10')]===0x1f4){logger[_0xba7a('0xf')](_0xba7a('0xa'),_0x911702,_0x252970[_0xba7a('0xf')][_0xba7a('0x11')]);return _0x29aa1f(_0x252970[_0xba7a('0xf')][_0xba7a('0x11')]);}logger[_0xba7a('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x911702,_0x252970['error'][_0xba7a('0x11')]);return _0x327daf(_0x252970[_0xba7a('0xf')]['message']);}else{logger[_0xba7a('0x12')](_0xba7a('0xa'),_0x911702,_0xba7a('0xb'));_0x327daf(_0x252970[_0xba7a('0x13')][_0xba7a('0x11')]);}})[_0xba7a('0x14')](function(_0x45350f){logger[_0xba7a('0xf')](_0xba7a('0xa'),_0x911702,_0x45350f);_0x29aa1f(_0x45350f);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index f7147f3..66ff445 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 _0x01aa=['show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','/describe','isAuthenticated','describe','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01aa,0x1aa));var _0xa01a=function(_0x2293b5,_0xdfbfa6){_0x2293b5=_0x2293b5-0x0;var _0x586b65=_0x01aa[_0x2293b5];return _0x586b65;};'use strict';var multer=require(_0xa01a('0x0'));var util=require(_0xa01a('0x1'));var path=require('path');var timeout=require(_0xa01a('0x2'));var express=require(_0xa01a('0x3'));var router=express[_0xa01a('0x4')]();var fs_extra=require(_0xa01a('0x5'));var auth=require(_0xa01a('0x6'));var interaction=require(_0xa01a('0x7'));var config=require('../../config/environment');var controller=require(_0xa01a('0x8'));router[_0xa01a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa01a('0x9')](_0xa01a('0xa'),auth[_0xa01a('0xb')](),controller[_0xa01a('0xc')]);router[_0xa01a('0x9')](_0xa01a('0xd'),auth[_0xa01a('0xb')](),controller[_0xa01a('0xe')]);router[_0xa01a('0xf')]('/',auth['isAuthenticated'](),controller[_0xa01a('0x10')]);router[_0xa01a('0x11')](_0xa01a('0xd'),auth[_0xa01a('0xb')](),controller[_0xa01a('0x12')]);router[_0xa01a('0x13')](_0xa01a('0xd'),auth[_0xa01a('0xb')](),controller[_0xa01a('0x14')]);module[_0xa01a('0x15')]=router; \ No newline at end of file +var _0x1a28=['isAuthenticated','index','/describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x83c716,_0x25152d){var _0xab9893=function(_0x9b3f0a){while(--_0x9b3f0a){_0x83c716['push'](_0x83c716['shift']());}};_0xab9893(++_0x25152d);}(_0x1a28,0x146));var _0x81a2=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0x1a28[_0x16db8b];return _0x5ba017;};'use strict';var multer=require(_0x81a2('0x0'));var util=require(_0x81a2('0x1'));var path=require('path');var timeout=require(_0x81a2('0x2'));var express=require(_0x81a2('0x3'));var router=express[_0x81a2('0x4')]();var fs_extra=require(_0x81a2('0x5'));var auth=require(_0x81a2('0x6'));var interaction=require(_0x81a2('0x7'));var config=require(_0x81a2('0x8'));var controller=require('./chatOfflineMessage.controller');router[_0x81a2('0x9')]('/',auth[_0x81a2('0xa')](),controller[_0x81a2('0xb')]);router[_0x81a2('0x9')](_0x81a2('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x81a2('0x9')](_0x81a2('0xd'),auth[_0x81a2('0xa')](),controller[_0x81a2('0xe')]);router['post']('/',auth[_0x81a2('0xa')](),controller[_0x81a2('0xf')]);router[_0x81a2('0x10')](_0x81a2('0xd'),auth['isAuthenticated'](),controller[_0x81a2('0x11')]);router[_0x81a2('0x12')](_0x81a2('0xd'),auth[_0x81a2('0xa')](),controller[_0x81a2('0x13')]);module[_0x81a2('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 74c8187..2a875ae 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 _0x1d20=['STRING','mouseOver','timeout','INTEGER','exports'];(function(_0x969cff,_0x3b6212){var _0x3da252=function(_0x31197c){while(--_0x31197c){_0x969cff['push'](_0x969cff['shift']());}};_0x3da252(++_0x3b6212);}(_0x1d20,0x90));var _0x01d2=function(_0x4f34eb,_0x3b624a){_0x4f34eb=_0x4f34eb-0x0;var _0x43a16d=_0x1d20[_0x4f34eb];return _0x43a16d;};'use strict';var Sequelize=require('sequelize');module[_0x01d2('0x0')]={'name':{'type':Sequelize[_0x01d2('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x01d2('0x2'),_0x01d2('0x3')),'defaultValue':_0x01d2('0x2')},'selector':{'type':Sequelize[_0x01d2('0x1')]},'timeout':{'type':Sequelize[_0x01d2('0x4')]}}; \ No newline at end of file +var _0x7162=['exports','STRING','mouseOver','timeout','INTEGER','sequelize'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x7162,0xb3));var _0x2716=function(_0x444cbb,_0x2e4600){_0x444cbb=_0x444cbb-0x0;var _0x48237c=_0x7162[_0x444cbb];return _0x48237c;};'use strict';var Sequelize=require(_0x2716('0x0'));module[_0x2716('0x1')]={'name':{'type':Sequelize[_0x2716('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x2716('0x3'),_0x2716('0x4')),'defaultValue':_0x2716('0x3')},'selector':{'type':Sequelize[_0x2716('0x2')]},'timeout':{'type':Sequelize[_0x2716('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 64222a8..98650e4 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 _0xd43b=['../../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','Content-Range','reject','update','destroy','then','error','stack','name','render','merge','body','contact','agent','interaction','account','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','create','eml-format','rimraf','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x71c476,_0x7cc813){var _0x192a45=function(_0x2bd365){while(--_0x2bd365){_0x71c476['push'](_0x71c476['shift']());}};_0x192a45(++_0x7cc813);}(_0xd43b,0xf8));var _0xbd43=function(_0x3a4bb3,_0x4bb42e){_0x3a4bb3=_0x3a4bb3-0x0;var _0x4c7c04=_0xd43b[_0x3a4bb3];return _0x4c7c04;};'use strict';var emlformat=require(_0xbd43('0x0'));var rimraf=require(_0xbd43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbd43('0x2'));var Mustache=require(_0xbd43('0x3'));var util=require('util');var path=require('path');var sox=require(_0xbd43('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd43('0x5'));var _=require(_0xbd43('0x6'));var squel=require(_0xbd43('0x7'));var crypto=require(_0xbd43('0x8'));var jsforce=require(_0xbd43('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xbd43('0xa'));var querystring=require(_0xbd43('0xb'));var Papa=require(_0xbd43('0xc'));var Redis=require(_0xbd43('0xd'));var authService=require(_0xbd43('0xe'));var qs=require(_0xbd43('0xf'));var as=require(_0xbd43('0x10'));var hardwareService=require(_0xbd43('0x11'));var logger=require(_0xbd43('0x12'))(_0xbd43('0x13'));var utils=require(_0xbd43('0x14'));var config=require(_0xbd43('0x15'));var licenseUtil=require(_0xbd43('0x16'));var db=require(_0xbd43('0x17'))['db'];function respondWithStatusCode(_0x4d7451,_0x519ba6){_0x519ba6=_0x519ba6||0xcc;return function(_0x73173f){if(_0x73173f){return _0x4d7451[_0xbd43('0x18')](_0x519ba6);}return _0x4d7451[_0xbd43('0x19')](_0x519ba6)[_0xbd43('0x1a')]();};}function respondWithResult(_0x4ee2f6,_0x19820e){_0x19820e=_0x19820e||0xc8;return function(_0x2d5557){if(_0x2d5557){return _0x4ee2f6[_0xbd43('0x19')](_0x19820e)[_0xbd43('0x1b')](_0x2d5557);}};}function respondWithFilteredResult(_0xac7a60,_0x4c0d0b){return function(_0x252d68){if(_0x252d68){var _0x3a9a42=typeof _0x4c0d0b['offset']===_0xbd43('0x1c')&&typeof _0x4c0d0b[_0xbd43('0x1d')]===_0xbd43('0x1c');var _0x41eaba=_0x252d68[_0xbd43('0x1e')];var _0x1277b2=_0x3a9a42?0x0:_0x4c0d0b[_0xbd43('0x1f')];var _0x3baaa3=_0x3a9a42?_0x252d68[_0xbd43('0x1e')]:_0x4c0d0b[_0xbd43('0x1f')]+_0x4c0d0b[_0xbd43('0x1d')];var _0x48f982;if(_0x3baaa3>=_0x41eaba){_0x3baaa3=_0x41eaba;_0x48f982=0xc8;}else{_0x48f982=0xce;}_0xac7a60[_0xbd43('0x19')](_0x48f982);return _0xac7a60[_0xbd43('0x20')](_0xbd43('0x21'),_0x1277b2+'-'+_0x3baaa3+'/'+_0x41eaba)[_0xbd43('0x1b')](_0x252d68);}return null;};}function patchUpdates(_0x3e616b){return function(_0x258095){try{jsonpatch['apply'](_0x258095,_0x3e616b,!![]);}catch(_0x2231db){return BPromise[_0xbd43('0x22')](_0x2231db);}return _0x258095['save']();};}function saveUpdates(_0x1404a8,_0x4774bb){return function(_0x4ee647){if(_0x4ee647){return _0x4ee647[_0xbd43('0x23')](_0x1404a8)['then'](function(_0x38e205){return _0x38e205;});}return null;};}function removeEntity(_0x11f12e,_0x4f4304){return function(_0x421849){if(_0x421849){return _0x421849[_0xbd43('0x24')]()[_0xbd43('0x25')](function(){_0x11f12e[_0xbd43('0x19')](0xcc)[_0xbd43('0x1a')]();});}};}function handleEntityNotFound(_0x4b79df,_0x3262e7){return function(_0x1afd02){if(!_0x1afd02){_0x4b79df[_0xbd43('0x18')](0x194);}return _0x1afd02;};}function handleError(_0x34f207,_0x81ca9a){_0x81ca9a=_0x81ca9a||0x1f4;return function(_0x8143ee){logger[_0xbd43('0x26')](_0x8143ee[_0xbd43('0x27')]);if(_0x8143ee[_0xbd43('0x28')]){delete _0x8143ee[_0xbd43('0x28')];}_0x34f207[_0xbd43('0x19')](_0x81ca9a)['send'](_0x8143ee);};}function getMustacheRender(_0x47b214,_0x5fd226){return Mustache[_0xbd43('0x29')](_0x47b214,_[_0xbd43('0x2a')](_0x5fd226[_0xbd43('0x2b')],{'contact':_0x5fd226[_0xbd43('0x2c')],'message':_0x5fd226['message'],'agent':_0x5fd226[_0xbd43('0x2d')],'interaction':_0x5fd226[_0xbd43('0x2e')],'account':_0x5fd226[_0xbd43('0x2f')]}))||'';}exports[_0xbd43('0x30')]=function(_0x18a647,_0x26b963){var _0x2e9807={'raw':!![],'where':{'id':_0x18a647[_0xbd43('0x31')]['id']}},_0x1b79ba={};_0x1b79ba[_0xbd43('0x32')]=_[_0xbd43('0x33')](db[_0xbd43('0x34')][_0xbd43('0x35')]);_0x1b79ba[_0xbd43('0x36')]=_[_0xbd43('0x33')](_0x18a647['query']);_0x1b79ba[_0xbd43('0x37')]=_[_0xbd43('0x38')](_0x1b79ba[_0xbd43('0x32')],_0x1b79ba['query']);_0x2e9807[_0xbd43('0x39')]=_[_0xbd43('0x38')](_0x1b79ba[_0xbd43('0x32')],qs[_0xbd43('0x3a')](_0x18a647[_0xbd43('0x36')][_0xbd43('0x3a')]));_0x2e9807[_0xbd43('0x39')]=_0x2e9807[_0xbd43('0x39')][_0xbd43('0x3b')]?_0x2e9807['attributes']:_0x1b79ba[_0xbd43('0x32')];if(_0x18a647['query'][_0xbd43('0x3c')]){_0x2e9807[_0xbd43('0x3d')]=[{'all':!![]}];}_0x2e9807=_[_0xbd43('0x2a')]({},_0x2e9807,_0x18a647[_0xbd43('0x3e')]);return db[_0xbd43('0x34')][_0xbd43('0x3f')](_0x2e9807)[_0xbd43('0x25')](handleEntityNotFound(_0x26b963,null))['then'](respondWithResult(_0x26b963,null))[_0xbd43('0x40')](handleError(_0x26b963,null));};exports[_0xbd43('0x41')]=function(_0x4686d4,_0x1dde93){return db[_0xbd43('0x34')][_0xbd43('0x41')](_0x4686d4[_0xbd43('0x2b')],{})[_0xbd43('0x25')](respondWithResult(_0x1dde93,0xc9))[_0xbd43('0x40')](handleError(_0x1dde93,null));};exports['update']=function(_0x4c8ff2,_0x167772){if(_0x4c8ff2[_0xbd43('0x2b')]['id']){delete _0x4c8ff2[_0xbd43('0x2b')]['id'];}return db[_0xbd43('0x34')]['find']({'where':{'id':_0x4c8ff2[_0xbd43('0x31')]['id']}})[_0xbd43('0x25')](handleEntityNotFound(_0x167772,null))[_0xbd43('0x25')](saveUpdates(_0x4c8ff2[_0xbd43('0x2b')],null))[_0xbd43('0x25')](respondWithResult(_0x167772,null))[_0xbd43('0x40')](handleError(_0x167772,null));};exports[_0xbd43('0x24')]=function(_0x5465a9,_0x9dde8d){return db[_0xbd43('0x34')]['find']({'where':{'id':_0x5465a9[_0xbd43('0x31')]['id']}})[_0xbd43('0x25')](handleEntityNotFound(_0x9dde8d,null))['then'](removeEntity(_0x9dde8d,null))[_0xbd43('0x40')](handleError(_0x9dde8d,null));}; \ No newline at end of file +var _0x3b2d=['count','offset','limit','apply','reject','update','then','end','stack','name','send','render','merge','body','account','show','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','options','find','catch','create','params','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined'];(function(_0x45ae37,_0x3fbe69){var _0x2203f9=function(_0x374a11){while(--_0x374a11){_0x45ae37['push'](_0x45ae37['shift']());}};_0x2203f9(++_0x3fbe69);}(_0x3b2d,0xa1));var _0xd3b2=function(_0x394a82,_0x3f921a){_0x394a82=_0x394a82-0x0;var _0x592201=_0x3b2d[_0x394a82];return _0x592201;};'use strict';var emlformat=require(_0xd3b2('0x0'));var rimraf=require(_0xd3b2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3b2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd3b2('0x3'));var Mustache=require(_0xd3b2('0x4'));var util=require(_0xd3b2('0x5'));var path=require(_0xd3b2('0x6'));var sox=require(_0xd3b2('0x7'));var csv=require(_0xd3b2('0x8'));var ejs=require(_0xd3b2('0x9'));var fs=require('fs');var fs_extra=require(_0xd3b2('0xa'));var _=require(_0xd3b2('0xb'));var squel=require(_0xd3b2('0xc'));var crypto=require(_0xd3b2('0xd'));var jsforce=require(_0xd3b2('0xe'));var deskjs=require(_0xd3b2('0xf'));var toCsv=require(_0xd3b2('0x8'));var querystring=require(_0xd3b2('0x10'));var Papa=require(_0xd3b2('0x11'));var Redis=require(_0xd3b2('0x12'));var authService=require(_0xd3b2('0x13'));var qs=require(_0xd3b2('0x14'));var as=require(_0xd3b2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3b2('0x16'))(_0xd3b2('0x17'));var utils=require(_0xd3b2('0x18'));var config=require(_0xd3b2('0x19'));var licenseUtil=require(_0xd3b2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25c6fc,_0x22e11a){_0x22e11a=_0x22e11a||0xcc;return function(_0x3ea71c){if(_0x3ea71c){return _0x25c6fc[_0xd3b2('0x1b')](_0x22e11a);}return _0x25c6fc['status'](_0x22e11a)['end']();};}function respondWithResult(_0x24f1d9,_0x3367c2){_0x3367c2=_0x3367c2||0xc8;return function(_0x5c1ff4){if(_0x5c1ff4){return _0x24f1d9[_0xd3b2('0x1c')](_0x3367c2)[_0xd3b2('0x1d')](_0x5c1ff4);}};}function respondWithFilteredResult(_0x419cdf,_0x581cfc){return function(_0x18dc60){if(_0x18dc60){var _0x2c1884=typeof _0x581cfc['offset']===_0xd3b2('0x1e')&&typeof _0x581cfc['limit']==='undefined';var _0x551336=_0x18dc60[_0xd3b2('0x1f')];var _0x1d2886=_0x2c1884?0x0:_0x581cfc[_0xd3b2('0x20')];var _0x29713c=_0x2c1884?_0x18dc60[_0xd3b2('0x1f')]:_0x581cfc[_0xd3b2('0x20')]+_0x581cfc[_0xd3b2('0x21')];var _0x134640;if(_0x29713c>=_0x551336){_0x29713c=_0x551336;_0x134640=0xc8;}else{_0x134640=0xce;}_0x419cdf[_0xd3b2('0x1c')](_0x134640);return _0x419cdf['set']('Content-Range',_0x1d2886+'-'+_0x29713c+'/'+_0x551336)[_0xd3b2('0x1d')](_0x18dc60);}return null;};}function patchUpdates(_0x47c492){return function(_0x372047){try{jsonpatch[_0xd3b2('0x22')](_0x372047,_0x47c492,!![]);}catch(_0x686245){return BPromise[_0xd3b2('0x23')](_0x686245);}return _0x372047['save']();};}function saveUpdates(_0x1c20f8,_0x33e428){return function(_0x29acd9){if(_0x29acd9){return _0x29acd9[_0xd3b2('0x24')](_0x1c20f8)['then'](function(_0x3a8e03){return _0x3a8e03;});}return null;};}function removeEntity(_0x3743b8,_0x2b607c){return function(_0x59a0c7){if(_0x59a0c7){return _0x59a0c7['destroy']()[_0xd3b2('0x25')](function(){_0x3743b8['status'](0xcc)[_0xd3b2('0x26')]();});}};}function handleEntityNotFound(_0x4292f0,_0x3ac31a){return function(_0x29ef8b){if(!_0x29ef8b){_0x4292f0[_0xd3b2('0x1b')](0x194);}return _0x29ef8b;};}function handleError(_0x81a168,_0x449fd4){_0x449fd4=_0x449fd4||0x1f4;return function(_0x3c5def){logger['error'](_0x3c5def[_0xd3b2('0x27')]);if(_0x3c5def[_0xd3b2('0x28')]){delete _0x3c5def[_0xd3b2('0x28')];}_0x81a168[_0xd3b2('0x1c')](_0x449fd4)[_0xd3b2('0x29')](_0x3c5def);};}function getMustacheRender(_0x1dd649,_0x104aa1){return Mustache[_0xd3b2('0x2a')](_0x1dd649,_[_0xd3b2('0x2b')](_0x104aa1[_0xd3b2('0x2c')],{'contact':_0x104aa1['contact'],'message':_0x104aa1['message'],'agent':_0x104aa1['agent'],'interaction':_0x104aa1['interaction'],'account':_0x104aa1[_0xd3b2('0x2d')]}))||'';}exports[_0xd3b2('0x2e')]=function(_0x23d44f,_0x5d446e){var _0x2303ea={'raw':!![],'where':{'id':_0x23d44f['params']['id']}},_0x56b437={};_0x56b437['model']=_['keys'](db[_0xd3b2('0x2f')][_0xd3b2('0x30')]);_0x56b437[_0xd3b2('0x31')]=_[_0xd3b2('0x32')](_0x23d44f[_0xd3b2('0x31')]);_0x56b437[_0xd3b2('0x33')]=_[_0xd3b2('0x34')](_0x56b437[_0xd3b2('0x35')],_0x56b437[_0xd3b2('0x31')]);_0x2303ea['attributes']=_[_0xd3b2('0x34')](_0x56b437['model'],qs[_0xd3b2('0x36')](_0x23d44f[_0xd3b2('0x31')]['fields']));_0x2303ea[_0xd3b2('0x37')]=_0x2303ea['attributes'][_0xd3b2('0x38')]?_0x2303ea[_0xd3b2('0x37')]:_0x56b437[_0xd3b2('0x35')];if(_0x23d44f[_0xd3b2('0x31')][_0xd3b2('0x39')]){_0x2303ea[_0xd3b2('0x3a')]=[{'all':!![]}];}_0x2303ea=_[_0xd3b2('0x2b')]({},_0x2303ea,_0x23d44f[_0xd3b2('0x3b')]);return db[_0xd3b2('0x2f')][_0xd3b2('0x3c')](_0x2303ea)[_0xd3b2('0x25')](handleEntityNotFound(_0x5d446e,null))[_0xd3b2('0x25')](respondWithResult(_0x5d446e,null))[_0xd3b2('0x3d')](handleError(_0x5d446e,null));};exports['create']=function(_0x25605d,_0x50d37b){return db[_0xd3b2('0x2f')][_0xd3b2('0x3e')](_0x25605d[_0xd3b2('0x2c')],{})[_0xd3b2('0x25')](respondWithResult(_0x50d37b,0xc9))[_0xd3b2('0x3d')](handleError(_0x50d37b,null));};exports['update']=function(_0x5c85f5,_0x4363a3){if(_0x5c85f5[_0xd3b2('0x2c')]['id']){delete _0x5c85f5[_0xd3b2('0x2c')]['id'];}return db[_0xd3b2('0x2f')][_0xd3b2('0x3c')]({'where':{'id':_0x5c85f5[_0xd3b2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4363a3,null))[_0xd3b2('0x25')](saveUpdates(_0x5c85f5['body'],null))[_0xd3b2('0x25')](respondWithResult(_0x4363a3,null))['catch'](handleError(_0x4363a3,null));};exports['destroy']=function(_0x557608,_0x4968c8){return db[_0xd3b2('0x2f')]['find']({'where':{'id':_0x557608[_0xd3b2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4968c8,null))[_0xd3b2('0x25')](removeEntity(_0x4968c8,null))[_0xd3b2('0x3d')](handleError(_0x4968c8,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index b3f740e..339a693 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 _0x1a67=['define','chat_proactive_actions','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./chatProactiveAction.attributes','exports'];(function(_0x3f9455,_0x44a884){var _0xbef00=function(_0x158c09){while(--_0x158c09){_0x3f9455['push'](_0x3f9455['shift']());}};_0xbef00(++_0x44a884);}(_0x1a67,0x1e6));var _0x71a6=function(_0x4f0727,_0x1a6a1e){_0x4f0727=_0x4f0727-0x0;var _0x24b661=_0x1a67[_0x4f0727];return _0x24b661;};'use strict';var _=require(_0x71a6('0x0'));var util=require(_0x71a6('0x1'));var logger=require(_0x71a6('0x2'))('api');var moment=require(_0x71a6('0x3'));var BPromise=require('bluebird');var rp=require(_0x71a6('0x4'));var fs=require('fs');var path=require(_0x71a6('0x5'));var rimraf=require(_0x71a6('0x6'));var config=require('../../config/environment');var attributes=require(_0x71a6('0x7'));module[_0x71a6('0x8')]=function(_0x2a58ec,_0x492de3){return _0x2a58ec[_0x71a6('0x9')]('ChatProactiveAction',attributes,{'tableName':_0x71a6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc09=['moment','request-promise','path','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','api'];(function(_0x583d0c,_0x2f141c){var _0x35b1d3=function(_0x29c529){while(--_0x29c529){_0x583d0c['push'](_0x583d0c['shift']());}};_0x35b1d3(++_0x2f141c);}(_0xdc09,0x80));var _0x9dc0=function(_0x234318,_0xf22f31){_0x234318=_0x234318-0x0;var _0x1ab719=_0xdc09[_0x234318];return _0x1ab719;};'use strict';var _=require(_0x9dc0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9dc0('0x1'));var moment=require(_0x9dc0('0x2'));var BPromise=require('bluebird');var rp=require(_0x9dc0('0x3'));var fs=require('fs');var path=require(_0x9dc0('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9dc0('0x5'));module[_0x9dc0('0x6')]=function(_0x1a843b,_0x3ab47e){return _0x1a843b[_0x9dc0('0x7')](_0x9dc0('0x8'),attributes,{'tableName':_0x9dc0('0x9'),'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 006ac66..af60870 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 _0x6657=['request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x333ea6,_0x5dbc72){var _0x1bac85=function(_0x22f099){while(--_0x22f099){_0x333ea6['push'](_0x333ea6['shift']());}};_0x1bac85(++_0x5dbc72);}(_0x6657,0xce));var _0x7665=function(_0x50653b,_0x565ab3){_0x50653b=_0x50653b-0x0;var _0x446b45=_0x6657[_0x50653b];return _0x446b45;};'use strict';var _=require(_0x7665('0x0'));var util=require(_0x7665('0x1'));var moment=require(_0x7665('0x2'));var BPromise=require(_0x7665('0x3'));var rs=require(_0x7665('0x4'));var fs=require('fs');var Redis=require(_0x7665('0x5'));var db=require(_0x7665('0x6'))['db'];var utils=require(_0x7665('0x7'));var logger=require(_0x7665('0x8'))('rpc');var config=require(_0x7665('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7665('0xa')][_0x7665('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ecab7,_0x46cb2a,_0x5407aa){return new BPromise(function(_0x455e5c,_0x24a608){return client['request'](_0x1ecab7,_0x5407aa)['then'](function(_0x48678c){logger[_0x7665('0xc')](_0x7665('0xd'),_0x46cb2a,_0x7665('0xe'));logger[_0x7665('0xf')](_0x7665('0x10'),_0x46cb2a,_0x7665('0xe'),JSON[_0x7665('0x11')](_0x48678c));if(_0x48678c['error']){if(_0x48678c[_0x7665('0x12')]['code']===0x1f4){logger[_0x7665('0x12')](_0x7665('0xd'),_0x46cb2a,_0x48678c['error']['message']);return _0x24a608(_0x48678c[_0x7665('0x12')][_0x7665('0x13')]);}logger[_0x7665('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x46cb2a,_0x48678c['error'][_0x7665('0x13')]);return _0x455e5c(_0x48678c['error']['message']);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x46cb2a,'request\x20sent');_0x455e5c(_0x48678c[_0x7665('0x14')][_0x7665('0x13')]);}})[_0x7665('0x15')](function(_0x51feed){logger[_0x7665('0x12')](_0x7665('0xd'),_0x46cb2a,_0x51feed);_0x24a608(_0x51feed);});});} \ No newline at end of file +var _0x0cb4=['debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x0cb4,0x11d));var _0x40cb=function(_0x1ee909,_0xed48b4){_0x1ee909=_0x1ee909-0x0;var _0x2e5e9a=_0x0cb4[_0x1ee909];return _0x2e5e9a;};'use strict';var _=require(_0x40cb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x40cb('0x1'));var rs=require(_0x40cb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40cb('0x3'))['db'];var utils=require(_0x40cb('0x4'));var logger=require(_0x40cb('0x5'))(_0x40cb('0x6'));var config=require('../../config/environment');var jayson=require(_0x40cb('0x7'));var client=jayson[_0x40cb('0x8')][_0x40cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21841d,_0x249c35,_0x2e6638){return new BPromise(function(_0x497107,_0x432d44){return client[_0x40cb('0xa')](_0x21841d,_0x2e6638)[_0x40cb('0xb')](function(_0x583f74){logger[_0x40cb('0xc')](_0x40cb('0xd'),_0x249c35,'request\x20sent');logger[_0x40cb('0xe')](_0x40cb('0xf'),_0x249c35,_0x40cb('0x10'),JSON[_0x40cb('0x11')](_0x583f74));if(_0x583f74[_0x40cb('0x12')]){if(_0x583f74[_0x40cb('0x12')][_0x40cb('0x13')]===0x1f4){logger[_0x40cb('0x12')](_0x40cb('0xd'),_0x249c35,_0x583f74[_0x40cb('0x12')]['message']);return _0x432d44(_0x583f74['error'][_0x40cb('0x14')]);}logger[_0x40cb('0x12')](_0x40cb('0xd'),_0x249c35,_0x583f74['error'][_0x40cb('0x14')]);return _0x497107(_0x583f74['error'][_0x40cb('0x14')]);}else{logger[_0x40cb('0xc')](_0x40cb('0xd'),_0x249c35,_0x40cb('0x10'));_0x497107(_0x583f74[_0x40cb('0x15')][_0x40cb('0x14')]);}})[_0x40cb('0x16')](function(_0x5d601a){logger[_0x40cb('0x12')](_0x40cb('0xd'),_0x249c35,_0x5d601a);_0x432d44(_0x5d601a);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 695f002..399f286 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 _0xddc3=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','post','put'];(function(_0x36e7ba,_0x4d225c){var _0x588132=function(_0x2344b4){while(--_0x2344b4){_0x36e7ba['push'](_0x36e7ba['shift']());}};_0x588132(++_0x4d225c);}(_0xddc3,0x162));var _0x3ddc=function(_0x25c448,_0x5ea511){_0x25c448=_0x25c448-0x0;var _0x4c6dd9=_0xddc3[_0x25c448];return _0x4c6dd9;};'use strict';var multer=require(_0x3ddc('0x0'));var util=require(_0x3ddc('0x1'));var path=require(_0x3ddc('0x2'));var timeout=require('connect-timeout');var express=require(_0x3ddc('0x3'));var router=express[_0x3ddc('0x4')]();var fs_extra=require(_0x3ddc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3ddc('0x6'));var config=require(_0x3ddc('0x7'));var controller=require(_0x3ddc('0x8'));router[_0x3ddc('0x9')](_0x3ddc('0xa'),auth[_0x3ddc('0xb')](),controller['show']);router[_0x3ddc('0xc')]('/',auth[_0x3ddc('0xb')](),controller['create']);router[_0x3ddc('0xd')](_0x3ddc('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x3ddc('0xe')](_0x3ddc('0xa'),auth[_0x3ddc('0xb')](),controller[_0x3ddc('0xf')]);module['exports']=router; \ No newline at end of file +var _0xc8f7=['destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','create','put','delete'];(function(_0xd2678f,_0x175685){var _0x3d64cd=function(_0x374bd9){while(--_0x374bd9){_0xd2678f['push'](_0xd2678f['shift']());}};_0x3d64cd(++_0x175685);}(_0xc8f7,0x72));var _0x7c8f=function(_0xb867a8,_0x926a63){_0xb867a8=_0xb867a8-0x0;var _0x1e5dcd=_0xc8f7[_0xb867a8];return _0x1e5dcd;};'use strict';var multer=require(_0x7c8f('0x0'));var util=require(_0x7c8f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7c8f('0x2'));var router=express[_0x7c8f('0x3')]();var fs_extra=require(_0x7c8f('0x4'));var auth=require(_0x7c8f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7c8f('0x6'));var controller=require(_0x7c8f('0x7'));router[_0x7c8f('0x8')](_0x7c8f('0x9'),auth[_0x7c8f('0xa')](),controller['show']);router['post']('/',auth[_0x7c8f('0xa')](),controller[_0x7c8f('0xb')]);router[_0x7c8f('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7c8f('0xd')](_0x7c8f('0x9'),auth['isAuthenticated'](),controller[_0x7c8f('0xe')]);module[_0x7c8f('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 365a2c5..2937faa 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 _0xe647=['beepall','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x3e4a41,_0xa3c772){var _0x2f984b=function(_0x3c2c15){while(--_0x3c2c15){_0x3e4a41['push'](_0x3e4a41['shift']());}};_0x2f984b(++_0xa3c772);}(_0xe647,0x6a));var _0x7e64=function(_0x3ab4eb,_0x9e9510){_0x3ab4eb=_0x3ab4eb-0x0;var _0x462166=_0xe647[_0x3ab4eb];return _0x462166;};'use strict';var Sequelize=require(_0x7e64('0x0'));module['exports']={'name':{'type':Sequelize[_0x7e64('0x1')],'unique':_0x7e64('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7e64('0x1')]},'timeout':{'type':Sequelize[_0x7e64('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7e64('0x4')](_0x7e64('0x5'),_0x7e64('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x37c5=['rrmemory','beepall','name','STRING','INTEGER'];(function(_0x9e4a5e,_0x394a7b){var _0x167cb0=function(_0x41c200){while(--_0x41c200){_0x9e4a5e['push'](_0x9e4a5e['shift']());}};_0x167cb0(++_0x394a7b);}(_0x37c5,0x1e7));var _0x537c=function(_0x1bfee5,_0x35ccb0){_0x1bfee5=_0x1bfee5-0x0;var _0x4f0ff2=_0x37c5[_0x1bfee5];return _0x4f0ff2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x537c('0x0'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x537c('0x1')]},'timeout':{'type':Sequelize[_0x537c('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x537c('0x3'),_0x537c('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 8aa09a6..45c0273 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 _0x1d7e=['http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','ChatQueues','UserProfileResource','name','send','merge','body','interaction','index','map','ChatQueue','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','pick','ChatQueueId','findAll','User','UserId','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','hasOwnProperty','addTeams','ids','online','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','transaction','isEmpty','removeAgents','emit','addAgents','spread','isArray','userChatQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','client'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x1d7e[_0x2763f2];return _0x3ef471;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe1d7('0x0'));var zipdir=require(_0xe1d7('0x1'));var jsonpatch=require(_0xe1d7('0x2'));var rp=require('request-promise');var moment=require(_0xe1d7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe1d7('0x4'));var util=require(_0xe1d7('0x5'));var path=require(_0xe1d7('0x6'));var sox=require(_0xe1d7('0x7'));var csv=require(_0xe1d7('0x8'));var ejs=require(_0xe1d7('0x9'));var fs=require('fs');var fs_extra=require(_0xe1d7('0xa'));var _=require(_0xe1d7('0xb'));var squel=require(_0xe1d7('0xc'));var crypto=require(_0xe1d7('0xd'));var jsforce=require(_0xe1d7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe1d7('0x8'));var querystring=require(_0xe1d7('0xf'));var Papa=require('papaparse');var Redis=require(_0xe1d7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe1d7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1d7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe1d7('0x13'));var config=require(_0xe1d7('0x14'));var licenseUtil=require(_0xe1d7('0x15'));var db=require(_0xe1d7('0x16'))['db'];config[_0xe1d7('0x17')]=_[_0xe1d7('0x18')](config[_0xe1d7('0x17')],{'host':_0xe1d7('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe1d7('0x17')]));require(_0xe1d7('0x1a'))[_0xe1d7('0x1b')](socket);var jayson=require(_0xe1d7('0x1c'));var client=jayson[_0xe1d7('0x1d')][_0xe1d7('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3c1923,_0x565278,_0x391f55,_0x328898){return new BPromise(function(_0x419cf3,_0x56e1c6){var _0x41cd11=_0x328898||client;return _0x41cd11[_0xe1d7('0x1f')](_0x3c1923,_0x391f55)[_0xe1d7('0x20')](function(_0x1f82ce){logger[_0xe1d7('0x21')](_0xe1d7('0x22'),_0x565278,_0xe1d7('0x23'));logger[_0xe1d7('0x24')](_0xe1d7('0x25'),_0x565278,_0xe1d7('0x23'),JSON[_0xe1d7('0x26')](_0x1f82ce));if(_0x1f82ce[_0xe1d7('0x27')]){if(_0x1f82ce['error'][_0xe1d7('0x28')]===0x1f4){logger[_0xe1d7('0x27')](_0xe1d7('0x22'),_0x565278,_0x1f82ce[_0xe1d7('0x27')][_0xe1d7('0x29')]);return _0x56e1c6(_0x1f82ce['error'][_0xe1d7('0x29')]);}logger[_0xe1d7('0x27')](_0xe1d7('0x22'),_0x565278,_0x1f82ce[_0xe1d7('0x27')][_0xe1d7('0x29')]);return _0x419cf3(_0x1f82ce['error'][_0xe1d7('0x29')]);}else{logger[_0xe1d7('0x21')](_0xe1d7('0x22'),_0x565278,_0xe1d7('0x23'));_0x419cf3(_0x1f82ce[_0xe1d7('0x2a')][_0xe1d7('0x29')]);}})[_0xe1d7('0x2b')](function(_0x3b3771){logger[_0xe1d7('0x27')](_0xe1d7('0x22'),_0x565278,_0x3b3771);_0x56e1c6(_0x3b3771);});});}function respondWithStatusCode(_0x55446d,_0x672bed){_0x672bed=_0x672bed||0xcc;return function(_0x7c1923){if(_0x7c1923){return _0x55446d[_0xe1d7('0x2c')](_0x672bed);}return _0x55446d['status'](_0x672bed)[_0xe1d7('0x2d')]();};}function respondWithResult(_0x4079db,_0x19c671){_0x19c671=_0x19c671||0xc8;return function(_0x303523){if(_0x303523){return _0x4079db[_0xe1d7('0x2e')](_0x19c671)[_0xe1d7('0x2f')](_0x303523);}};}function respondWithFilteredResult(_0x95f28c,_0x55f7dd){return function(_0x3e8ca3){if(_0x3e8ca3){var _0x4a3344=typeof _0x55f7dd[_0xe1d7('0x30')]===_0xe1d7('0x31')&&typeof _0x55f7dd['limit']==='undefined';var _0x4a1ccd=_0x3e8ca3[_0xe1d7('0x32')];var _0x34eea8=_0x4a3344?0x0:_0x55f7dd[_0xe1d7('0x30')];var _0x2786d0=_0x4a3344?_0x3e8ca3['count']:_0x55f7dd[_0xe1d7('0x30')]+_0x55f7dd[_0xe1d7('0x33')];var _0x7df62f;if(_0x2786d0>=_0x4a1ccd){_0x2786d0=_0x4a1ccd;_0x7df62f=0xc8;}else{_0x7df62f=0xce;}_0x95f28c[_0xe1d7('0x2e')](_0x7df62f);return _0x95f28c[_0xe1d7('0x34')]('Content-Range',_0x34eea8+'-'+_0x2786d0+'/'+_0x4a1ccd)[_0xe1d7('0x2f')](_0x3e8ca3);}return null;};}function patchUpdates(_0xec4345){return function(_0x380157){try{jsonpatch[_0xe1d7('0x35')](_0x380157,_0xec4345,!![]);}catch(_0x430acd){return BPromise[_0xe1d7('0x36')](_0x430acd);}return _0x380157[_0xe1d7('0x37')]();};}function saveUpdates(_0x39302a,_0x542d78){return function(_0x2df96d){if(_0x2df96d){return _0x2df96d[_0xe1d7('0x38')](_0x39302a)[_0xe1d7('0x20')](function(_0x5b3fd0){return _0x5b3fd0;});}return null;};}function removeEntity(_0x42d6db,_0x2fa371){return function(_0x2056fb){if(_0x2056fb){return _0x2056fb[_0xe1d7('0x39')]()[_0xe1d7('0x20')](function(){var _0x118d32=_0x2056fb['get']({'plain':!![]});var _0x1882bb=_0xe1d7('0x3a');return db[_0xe1d7('0x3b')][_0xe1d7('0x39')]({'where':{'type':_0x1882bb,'resourceId':_0x118d32['id']}})[_0xe1d7('0x20')](function(){return _0x2056fb;});})[_0xe1d7('0x20')](function(){_0x42d6db['status'](0xcc)[_0xe1d7('0x2d')]();});}};}function handleEntityNotFound(_0x228f2c,_0x36f1d6){return function(_0x48d438){if(!_0x48d438){_0x228f2c[_0xe1d7('0x2c')](0x194);}return _0x48d438;};}function handleError(_0x3df459,_0x1ef76e){_0x1ef76e=_0x1ef76e||0x1f4;return function(_0x5ee4e7){logger[_0xe1d7('0x27')](_0x5ee4e7['stack']);if(_0x5ee4e7[_0xe1d7('0x3c')]){delete _0x5ee4e7[_0xe1d7('0x3c')];}_0x3df459['status'](_0x1ef76e)[_0xe1d7('0x3d')](_0x5ee4e7);};}function getMustacheRender(_0x371c2e,_0x412688){return Mustache['render'](_0x371c2e,_[_0xe1d7('0x3e')](_0x412688[_0xe1d7('0x3f')],{'contact':_0x412688['contact'],'message':_0x412688[_0xe1d7('0x29')],'agent':_0x412688['agent'],'interaction':_0x412688[_0xe1d7('0x40')],'account':_0x412688['account']}))||'';}exports[_0xe1d7('0x41')]=function(_0x15de19,_0x1b4aac){var _0x2854b5={},_0x26959b={},_0x285cc8={'count':0x0,'rows':[]};var _0x3f363e=_[_0xe1d7('0x42')](db[_0xe1d7('0x43')]['rawAttributes'],function(_0x2e587d){return{'name':_0x2e587d['fieldName'],'type':_0x2e587d[_0xe1d7('0x44')][_0xe1d7('0x45')]};});_0x26959b[_0xe1d7('0x46')]=_[_0xe1d7('0x42')](_0x3f363e,_0xe1d7('0x3c'));_0x26959b[_0xe1d7('0x47')]=_[_0xe1d7('0x48')](_0x15de19['query']);_0x26959b[_0xe1d7('0x49')]=_[_0xe1d7('0x4a')](_0x26959b[_0xe1d7('0x46')],_0x26959b[_0xe1d7('0x47')]);_0x2854b5[_0xe1d7('0x4b')]=_[_0xe1d7('0x4a')](_0x26959b['model'],qs[_0xe1d7('0x4c')](_0x15de19[_0xe1d7('0x47')][_0xe1d7('0x4c')]));_0x2854b5['attributes']=_0x2854b5[_0xe1d7('0x4b')][_0xe1d7('0x4d')]?_0x2854b5[_0xe1d7('0x4b')]:_0x26959b[_0xe1d7('0x46')];if(!_0x15de19[_0xe1d7('0x47')]['hasOwnProperty'](_0xe1d7('0x4e'))){_0x2854b5[_0xe1d7('0x33')]=qs[_0xe1d7('0x33')](_0x15de19[_0xe1d7('0x47')][_0xe1d7('0x33')]);_0x2854b5[_0xe1d7('0x30')]=qs[_0xe1d7('0x30')](_0x15de19[_0xe1d7('0x47')][_0xe1d7('0x30')]);}_0x2854b5[_0xe1d7('0x4f')]=qs['sort'](_0x15de19[_0xe1d7('0x47')][_0xe1d7('0x50')]);_0x2854b5[_0xe1d7('0x51')]=qs['filters'](_['pick'](_0x15de19[_0xe1d7('0x47')],_0x26959b[_0xe1d7('0x49')]),_0x3f363e);if(_0x15de19[_0xe1d7('0x47')][_0xe1d7('0x52')]){_0x2854b5[_0xe1d7('0x51')]=_['merge'](_0x2854b5[_0xe1d7('0x51')],{'$or':_['map'](_0x3f363e,function(_0x22718a){if(_0x22718a[_0xe1d7('0x44')]!==_0xe1d7('0x53')){var _0x32e4a3={};_0x32e4a3[_0x22718a[_0xe1d7('0x3c')]]={'$like':'%'+_0x15de19['query'][_0xe1d7('0x52')]+'%'};return _0x32e4a3;}})});}_0x2854b5=_[_0xe1d7('0x3e')]({},_0x2854b5,_0x15de19[_0xe1d7('0x54')]);var _0x4fb5ac={'where':_0x2854b5[_0xe1d7('0x51')]};return db[_0xe1d7('0x43')][_0xe1d7('0x32')](_0x4fb5ac)['then'](function(_0x175b75){_0x285cc8['count']=_0x175b75;if(_0x15de19[_0xe1d7('0x47')][_0xe1d7('0x55')]){_0x2854b5[_0xe1d7('0x56')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x2854b5);})[_0xe1d7('0x20')](function(_0x3f8d70){_0x285cc8[_0xe1d7('0x57')]=_0x3f8d70;return _0x285cc8;})[_0xe1d7('0x20')](respondWithFilteredResult(_0x1b4aac,_0x2854b5))['catch'](handleError(_0x1b4aac,null));};exports[_0xe1d7('0x58')]=function(_0x162f29,_0x13b990){var _0x421b83={'raw':!![],'where':{'id':_0x162f29[_0xe1d7('0x59')]['id']}},_0x59b758={};_0x59b758[_0xe1d7('0x46')]=_[_0xe1d7('0x48')](db[_0xe1d7('0x43')][_0xe1d7('0x5a')]);_0x59b758['query']=_[_0xe1d7('0x48')](_0x162f29[_0xe1d7('0x47')]);_0x59b758[_0xe1d7('0x49')]=_[_0xe1d7('0x4a')](_0x59b758['model'],_0x59b758[_0xe1d7('0x47')]);_0x421b83['attributes']=_[_0xe1d7('0x4a')](_0x59b758[_0xe1d7('0x46')],qs[_0xe1d7('0x4c')](_0x162f29[_0xe1d7('0x47')]['fields']));_0x421b83[_0xe1d7('0x4b')]=_0x421b83[_0xe1d7('0x4b')]['length']?_0x421b83[_0xe1d7('0x4b')]:_0x59b758[_0xe1d7('0x46')];if(_0x162f29[_0xe1d7('0x47')][_0xe1d7('0x55')]){_0x421b83[_0xe1d7('0x56')]=[{'all':!![]}];}_0x421b83=_[_0xe1d7('0x3e')]({},_0x421b83,_0x162f29[_0xe1d7('0x54')]);return db[_0xe1d7('0x43')][_0xe1d7('0x5b')](_0x421b83)[_0xe1d7('0x20')](handleEntityNotFound(_0x13b990,null))['then'](respondWithResult(_0x13b990,null))['catch'](handleError(_0x13b990,null));};exports['create']=function(_0xd4b9c7,_0x40c4d3){return db[_0xe1d7('0x43')]['create'](_0xd4b9c7['body'],{})[_0xe1d7('0x20')](function(_0x113d44){var _0x4a0b36=_0xd4b9c7['user'][_0xe1d7('0x5c')]({'plain':!![]});if(!_0x4a0b36)throw new Error(_0xe1d7('0x5d'));if(_0x4a0b36[_0xe1d7('0x5e')]===_0xe1d7('0x5f')){var _0x3b787e=_0x113d44[_0xe1d7('0x5c')]({'plain':!![]});var _0x54f1cd='ChatQueues';return db[_0xe1d7('0x60')]['find']({'where':{'name':_0x54f1cd,'userProfileId':_0x4a0b36[_0xe1d7('0x61')]},'raw':!![]})['then'](function(_0x4af5f3){if(_0x4af5f3&&_0x4af5f3[_0xe1d7('0x62')]===0x0){return db['UserProfileResource'][_0xe1d7('0x63')]({'name':_0x3b787e['name'],'resourceId':_0x3b787e['id'],'type':_0x4af5f3[_0xe1d7('0x3c')],'sectionId':_0x4af5f3['id']},{})[_0xe1d7('0x20')](function(){return _0x113d44;});}else{return _0x113d44;}})[_0xe1d7('0x2b')](function(_0xbee496){logger[_0xe1d7('0x27')](_0xe1d7('0x64'),_0xbee496);throw _0xbee496;});}return _0x113d44;})[_0xe1d7('0x20')](respondWithResult(_0x40c4d3,0xc9))[_0xe1d7('0x2b')](handleError(_0x40c4d3,null));};exports['update']=function(_0x43fc1c,_0x1aeb4e){if(_0x43fc1c[_0xe1d7('0x3f')]['id']){delete _0x43fc1c[_0xe1d7('0x3f')]['id'];}return db['ChatQueue'][_0xe1d7('0x5b')]({'where':{'id':_0x43fc1c[_0xe1d7('0x59')]['id']}})['then'](handleEntityNotFound(_0x1aeb4e,null))[_0xe1d7('0x20')](saveUpdates(_0x43fc1c['body'],null))[_0xe1d7('0x20')](respondWithResult(_0x1aeb4e,null))['catch'](handleError(_0x1aeb4e,null));};exports['destroy']=function(_0x23c97c,_0x25854a){return db[_0xe1d7('0x43')][_0xe1d7('0x5b')]({'where':{'id':_0x23c97c[_0xe1d7('0x59')]['id']}})[_0xe1d7('0x20')](handleEntityNotFound(_0x25854a,null))[_0xe1d7('0x20')](removeEntity(_0x25854a,null))[_0xe1d7('0x2b')](handleError(_0x25854a,null));};exports[_0xe1d7('0x65')]=function(_0x500bc5,_0xd6c1a3){return db[_0xe1d7('0x43')]['describe']()[_0xe1d7('0x20')](respondWithResult(_0xd6c1a3,null))[_0xe1d7('0x2b')](handleError(_0xd6c1a3,null));};exports[_0xe1d7('0x66')]=function(_0x150eab,_0x4e1d73,_0x13084e){var _0x37399a={'raw':!![],'where':{}},_0x34cbcd={},_0x13134c;return db[_0xe1d7('0x43')][_0xe1d7('0x67')]({'where':{'id':_0x150eab[_0xe1d7('0x59')]['id']}})['then'](handleEntityNotFound(_0x4e1d73,null))[_0xe1d7('0x20')](function(_0x20180f){if(_0x20180f){_0x13134c=_0x20180f[_0xe1d7('0x5c')]({'plain':!![]});_0x34cbcd[_0xe1d7('0x46')]=_[_0xe1d7('0x48')](db[_0xe1d7('0x68')]['rawAttributes']);_0x34cbcd['query']=_[_0xe1d7('0x48')](_0x150eab['query']);_0x34cbcd[_0xe1d7('0x49')]=_[_0xe1d7('0x4a')](_0x34cbcd['model'],_0x34cbcd['query']);_0x37399a[_0xe1d7('0x4b')]=_['intersection'](_0x34cbcd[_0xe1d7('0x46')],qs[_0xe1d7('0x4c')](_0x150eab['query']['fields']));_0x37399a[_0xe1d7('0x4b')]=_0x37399a['attributes'][_0xe1d7('0x4d')]?_0x37399a[_0xe1d7('0x4b')]:_0x34cbcd[_0xe1d7('0x46')];if(!_0x150eab[_0xe1d7('0x47')]['hasOwnProperty'](_0xe1d7('0x4e'))){_0x37399a[_0xe1d7('0x33')]=qs[_0xe1d7('0x33')](_0x150eab[_0xe1d7('0x47')][_0xe1d7('0x33')]);_0x37399a[_0xe1d7('0x30')]=qs['offset'](_0x150eab['query'][_0xe1d7('0x30')]);}_0x37399a[_0xe1d7('0x4f')]=qs[_0xe1d7('0x50')](_0x150eab[_0xe1d7('0x47')]['sort']);_0x37399a['where']=qs[_0xe1d7('0x49')](_[_0xe1d7('0x69')](_0x150eab[_0xe1d7('0x47')],_0x34cbcd[_0xe1d7('0x49')]));_0x37399a[_0xe1d7('0x51')][_0xe1d7('0x6a')]=_0x20180f['id'];if(_0x150eab[_0xe1d7('0x47')][_0xe1d7('0x52')]){_0x37399a['where']=_[_0xe1d7('0x3e')](_0x37399a['where'],{'$or':_[_0xe1d7('0x42')](_0x37399a[_0xe1d7('0x4b')],function(_0xd97e20){var _0x3f75eb={};_0x3f75eb[_0xd97e20]={'$like':'%'+_0x150eab[_0xe1d7('0x47')]['filter']+'%'};return _0x3f75eb;})});}_0x37399a=_[_0xe1d7('0x3e')]({},_0x37399a,_0x150eab['options']);return db[_0xe1d7('0x68')][_0xe1d7('0x6b')](_0x37399a);}})[_0xe1d7('0x20')](function(_0x4ca35e){if(_0x4ca35e){return db[_0xe1d7('0x6c')]['findAndCountAll']({'where':{'id':_[_0xe1d7('0x42')](_0x4ca35e,_0xe1d7('0x6d')),'role':'agent'},'attributes':['id','name',_0xe1d7('0x6e'),_0xe1d7('0x6f'),_0xe1d7('0x70')]});}})[_0xe1d7('0x20')](function(_0x424579){if(_0x424579){return{'count':_0x424579[_0xe1d7('0x32')],'rows':_[_0xe1d7('0x42')](_0x424579[_0xe1d7('0x57')],function(_0x1c6a55){return{'membername':_0x1c6a55[_0xe1d7('0x3c')],'UserId':_0x1c6a55['id'],'queue_name':_0x13134c['name'],'ChatQueueId':_0x13134c['id'],'interface':util[_0xe1d7('0x71')](_0xe1d7('0x72'),'SIP',_0x1c6a55[_0xe1d7('0x3c')]),'penalty':0x0,'paused':_0x1c6a55[_0xe1d7('0x6e')],'createdAt':_0x1c6a55[_0xe1d7('0x70')],'updatedAt':_0x1c6a55[_0xe1d7('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe1d7('0x20')](respondWithFilteredResult(_0x4e1d73,_0x37399a))['catch'](handleError(_0x4e1d73,null));};exports[_0xe1d7('0x73')]=function(_0x265192,_0x1228d9,_0x35a973){var _0x22ded3={};var _0x2ea461={};var _0x403e65;var _0x53f06b;return db[_0xe1d7('0x43')]['findOne']({'where':{'id':_0x265192['params']['id']}})[_0xe1d7('0x20')](handleEntityNotFound(_0x1228d9,null))[_0xe1d7('0x20')](function(_0x547176){if(_0x547176){_0x403e65=_0x547176;_0x2ea461[_0xe1d7('0x46')]=_['keys'](db[_0xe1d7('0x74')][_0xe1d7('0x5a')]);_0x2ea461[_0xe1d7('0x47')]=_[_0xe1d7('0x48')](_0x265192[_0xe1d7('0x47')]);_0x2ea461[_0xe1d7('0x49')]=_['intersection'](_0x2ea461[_0xe1d7('0x46')],_0x2ea461[_0xe1d7('0x47')]);_0x22ded3[_0xe1d7('0x4b')]=_[_0xe1d7('0x4a')](_0x2ea461[_0xe1d7('0x46')],qs[_0xe1d7('0x4c')](_0x265192[_0xe1d7('0x47')]['fields']));_0x22ded3[_0xe1d7('0x4b')]=_0x22ded3['attributes'][_0xe1d7('0x4d')]?_0x22ded3[_0xe1d7('0x4b')]:_0x2ea461['model'];_0x22ded3[_0xe1d7('0x4f')]=qs[_0xe1d7('0x50')](_0x265192[_0xe1d7('0x47')]['sort']);_0x22ded3[_0xe1d7('0x51')]=qs[_0xe1d7('0x49')](_[_0xe1d7('0x69')](_0x265192[_0xe1d7('0x47')],_0x2ea461[_0xe1d7('0x49')]));if(_0x265192[_0xe1d7('0x47')][_0xe1d7('0x52')]){_0x22ded3[_0xe1d7('0x51')]=_[_0xe1d7('0x3e')](_0x22ded3['where'],{'$or':_[_0xe1d7('0x42')](_0x22ded3['attributes'],function(_0x3fabad){var _0x5a8ce8={};_0x5a8ce8[_0x3fabad]={'$like':'%'+_0x265192[_0xe1d7('0x47')][_0xe1d7('0x52')]+'%'};return _0x5a8ce8;})});}_0x22ded3=_[_0xe1d7('0x3e')]({},_0x22ded3,_0x265192[_0xe1d7('0x54')]);return _0x403e65[_0xe1d7('0x73')](_0x22ded3);}})['then'](function(_0x144343){if(_0x144343){_0x53f06b=_0x144343[_0xe1d7('0x4d')];if(!_0x265192[_0xe1d7('0x47')][_0xe1d7('0x75')](_0xe1d7('0x4e'))){_0x22ded3[_0xe1d7('0x33')]=qs['limit'](_0x265192[_0xe1d7('0x47')][_0xe1d7('0x33')]);_0x22ded3['offset']=qs['offset'](_0x265192[_0xe1d7('0x47')][_0xe1d7('0x30')]);}return _0x403e65[_0xe1d7('0x73')](_0x22ded3);}})[_0xe1d7('0x20')](function(_0x3e0591){if(_0x3e0591){return _0x3e0591?{'count':_0x53f06b,'rows':_0x3e0591}:null;}})[_0xe1d7('0x20')](respondWithResult(_0x1228d9,null))[_0xe1d7('0x2b')](handleError(_0x1228d9,null));};exports[_0xe1d7('0x76')]=function(_0x4d9098,_0x2e8da1,_0x40b418){var _0x126aee=_0x4d9098[_0xe1d7('0x3f')][_0xe1d7('0x77')];return db[_0xe1d7('0x74')][_0xe1d7('0x6b')]({'where':{'id':_0x126aee},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xe1d7('0x3c'),_0xe1d7('0x78'),'voicePause',_0xe1d7('0x79')],'raw':!![]}]})[_0xe1d7('0x20')](function(_0x43264a){if(_0x43264a){var _0x4bb5ad=_[_0xe1d7('0x7a')](_0x43264a,function(_0x2b3860){var _0x55637f=_0x2b3860[_0xe1d7('0x5c')]({'plain':!![]});return _0x55637f[_0xe1d7('0x7b')];});return db[_0xe1d7('0x43')]['find']({'where':{'id':_0x4d9098[_0xe1d7('0x59')]['id']}})[_0xe1d7('0x20')](function(_0x1c86bd){return db[_0xe1d7('0x7c')]['transaction'](function(_0x29aec9){return _0x1c86bd[_0xe1d7('0x76')](_0x126aee,{'transaction':_0x29aec9})[_0xe1d7('0x20')](function(){return BPromise[_0xe1d7('0x7d')](_0x4bb5ad,function(_0x47e148){return db[_0xe1d7('0x68')][_0xe1d7('0x7e')]({'where':{'UserId':_0x47e148['id'],'ChatQueueId':_0x4d9098[_0xe1d7('0x59')]['id']},'transaction':_0x29aec9});});})[_0xe1d7('0x20')](function(){_0x4bb5ad[_0xe1d7('0x7f')](function(_0x5abae2){socket['emit'](_0xe1d7('0x80'),{'UserId':_0x5abae2['id'],'ChatQueueId':_0x1c86bd['id']});});});});});}})['then'](respondWithStatusCode(_0x2e8da1,null))[_0xe1d7('0x2b')](handleError(_0x2e8da1,null));};exports[_0xe1d7('0x81')]=function(_0x45cd1b,_0x50d47d,_0x2c84ad){return db[_0xe1d7('0x74')]['findAll']({'where':{'id':_0x45cd1b['query'][_0xe1d7('0x77')]},'attributes':['id'],'include':[{'model':db[_0xe1d7('0x6c')],'as':_0xe1d7('0x7b'),'attributes':['id'],'raw':!![]}]})[_0xe1d7('0x20')](handleEntityNotFound(_0x50d47d,null))['then'](function(_0xe11346){var _0x90a04=_[_0xe1d7('0x42')](_0xe11346,'id');var _0x2ee11d=[];var _0x2c1a0a=[];var _0x59ee3a=squel[_0xe1d7('0x82')]();_0x59ee3a[_0xe1d7('0x83')](_0xe1d7('0x84'))[_0xe1d7('0x85')](_0xe1d7('0x86'),'tq')[_0xe1d7('0x87')](_0xe1d7('0x88'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe1d7('0x51')](_0xe1d7('0x89'),_0x45cd1b[_0xe1d7('0x59')]['id']);for(var _0x563e0f=0x0;_0x563e0f<_0xe11346[_0xe1d7('0x4d')];_0x563e0f+=0x1){let _0x352025=_0xe11346[_0x563e0f];for(var _0x54cd44=0x0;_0x54cd44<_0x352025[_0xe1d7('0x7b')][_0xe1d7('0x4d')];_0x54cd44+=0x1){let _0x5a0d91=_0x352025[_0xe1d7('0x7b')][_0x54cd44];var _0x43eeaa=_0x59ee3a['clone']();_0x43eeaa['where']('ut.UserId\x20=\x20?',_0x5a0d91['id']);_0x2c1a0a['push'](db['sequelize']['query'](_0x43eeaa[_0xe1d7('0x8a')](),{'type':db[_0xe1d7('0x7c')][_0xe1d7('0x8b')][_0xe1d7('0x8c')]})['then'](function(_0x3f8d58){if(_0x3f8d58['length']===0x1){return _0x5a0d91['id'];}else{var _0x4d4b9c=_[_0xe1d7('0x8d')](_[_0xe1d7('0x42')](_0x3f8d58,_0xe1d7('0x8e')),function(_0x2215f1){return _[_0xe1d7('0x8f')](_0x90a04,_0x2215f1);});if(_0x4d4b9c){return _0x5a0d91['id'];}}}));}}return BPromise[_0xe1d7('0x90')](_0x2c1a0a)[_0xe1d7('0x20')](function(_0x10f182){_0x2ee11d=_(_0x2ee11d)[_0xe1d7('0x91')](_0x10f182)['compact']()['value']();return db['ChatQueue']['find']({'where':{'id':_0x45cd1b[_0xe1d7('0x59')]['id']}})['then'](function(_0x309297){return db['sequelize'][_0xe1d7('0x92')](function(_0x2d7ad1){return _0x309297['removeTeams'](_0x45cd1b['query'][_0xe1d7('0x77')],{'transaction':_0x2d7ad1})[_0xe1d7('0x20')](function(){if(!_[_0xe1d7('0x93')](_0x2ee11d)){return _0x309297[_0xe1d7('0x94')](_0x2ee11d,{'transaction':_0x2d7ad1});}})[_0xe1d7('0x20')](function(){_0x2ee11d[_0xe1d7('0x7f')](function(_0x241858){socket[_0xe1d7('0x95')]('userChatQueue:remove',{'UserId':_0x241858,'ChatQueueId':_0x309297['id']});});});});});});})[_0xe1d7('0x20')](respondWithStatusCode(_0x50d47d,null))['catch'](handleError(_0x50d47d,null));};exports[_0xe1d7('0x96')]=function(_0x3e94e7,_0x244deb,_0x4ddbd7){return db['ChatQueue'][_0xe1d7('0x5b')]({'where':{'id':_0x3e94e7[_0xe1d7('0x59')]['id']}})[_0xe1d7('0x20')](handleEntityNotFound(_0x244deb,null))['then'](function(_0x4f958d){if(_0x4f958d){return _0x4f958d['addAgents'](_0x3e94e7['body'][_0xe1d7('0x77')],_['omit'](_0x3e94e7[_0xe1d7('0x3f')],[_0xe1d7('0x77'),'id'])||{})[_0xe1d7('0x97')](function(_0x170e0a){for(var _0x4e877c=0x0;_0x4e877c<_0x3e94e7[_0xe1d7('0x3f')][_0xe1d7('0x77')][_0xe1d7('0x4d')];_0x4e877c+=0x1){socket[_0xe1d7('0x95')](_0xe1d7('0x80'),{'UserId':_0x3e94e7[_0xe1d7('0x3f')][_0xe1d7('0x77')][_0x4e877c],'ChatQueueId':_0x3e94e7[_0xe1d7('0x59')]['id']});}return _0x170e0a;});}})[_0xe1d7('0x20')](respondWithResult(_0x244deb,null))[_0xe1d7('0x2b')](handleError(_0x244deb,null));};exports[_0xe1d7('0x94')]=function(_0x3a953b,_0x7718c4,_0x49023d){return db[_0xe1d7('0x43')][_0xe1d7('0x5b')]({'where':{'id':_0x3a953b[_0xe1d7('0x59')]['id']}})['then'](handleEntityNotFound(_0x7718c4,null))[_0xe1d7('0x20')](function(_0x2aa3d4){if(_0x2aa3d4){return _0x2aa3d4[_0xe1d7('0x94')](_0x3a953b[_0xe1d7('0x47')][_0xe1d7('0x77')])[_0xe1d7('0x20')](function(){if(_[_0xe1d7('0x98')](_0x3a953b[_0xe1d7('0x47')][_0xe1d7('0x77')])){for(var _0x159fff=0x0;_0x159fff<_0x3a953b[_0xe1d7('0x47')][_0xe1d7('0x77')][_0xe1d7('0x4d')];_0x159fff+=0x1){socket[_0xe1d7('0x95')](_0xe1d7('0x99'),{'UserId':Number(_0x3a953b[_0xe1d7('0x47')][_0xe1d7('0x77')][_0x159fff]),'ChatQueueId':Number(_0x3a953b[_0xe1d7('0x59')]['id'])});}}else{socket[_0xe1d7('0x95')]('userChatQueue:remove',{'UserId':Number(_0x3a953b[_0xe1d7('0x47')][_0xe1d7('0x77')]),'ChatQueueId':Number(_0x3a953b['params']['id'])});}});}})[_0xe1d7('0x20')](respondWithStatusCode(_0x7718c4,null))[_0xe1d7('0x2b')](handleError(_0x7718c4,null));};exports['getAgents']=function(_0x141612,_0x3bb9a3,_0x43ee4){var _0x150525={};var _0x30f3d8={};var _0x216dea;var _0x30aee0;return db['ChatQueue']['findOne']({'where':{'id':_0x141612[_0xe1d7('0x59')]['id']}})['then'](handleEntityNotFound(_0x3bb9a3,null))[_0xe1d7('0x20')](function(_0x322792){if(_0x322792){_0x216dea=_0x322792;_0x30f3d8[_0xe1d7('0x46')]=_[_0xe1d7('0x48')](db['User'][_0xe1d7('0x5a')]);_0x30f3d8[_0xe1d7('0x47')]=_[_0xe1d7('0x48')](_0x141612['query']);_0x30f3d8[_0xe1d7('0x49')]=_[_0xe1d7('0x4a')](_0x30f3d8[_0xe1d7('0x46')],_0x30f3d8[_0xe1d7('0x47')]);_0x150525[_0xe1d7('0x4b')]=_[_0xe1d7('0x4a')](_0x30f3d8[_0xe1d7('0x46')],qs[_0xe1d7('0x4c')](_0x141612[_0xe1d7('0x47')][_0xe1d7('0x4c')]));_0x150525[_0xe1d7('0x4b')]=_0x150525[_0xe1d7('0x4b')]['length']?_0x150525[_0xe1d7('0x4b')]:_0x30f3d8['model'];_0x150525[_0xe1d7('0x4f')]=qs[_0xe1d7('0x50')](_0x141612['query']['sort']);_0x150525[_0xe1d7('0x51')]=qs[_0xe1d7('0x49')](_[_0xe1d7('0x69')](_0x141612[_0xe1d7('0x47')],_0x30f3d8[_0xe1d7('0x49')]));if(_0x141612[_0xe1d7('0x47')][_0xe1d7('0x52')]){_0x150525[_0xe1d7('0x51')]=_[_0xe1d7('0x3e')](_0x150525['where'],{'$or':_[_0xe1d7('0x42')](_0x150525[_0xe1d7('0x4b')],function(_0x3d3353){var _0x345eea={};_0x345eea[_0x3d3353]={'$like':'%'+_0x141612[_0xe1d7('0x47')][_0xe1d7('0x52')]+'%'};return _0x345eea;})});}_0x150525=_[_0xe1d7('0x3e')]({},_0x150525,_0x141612[_0xe1d7('0x54')]);return _0x216dea[_0xe1d7('0x9a')](_0x150525);}})[_0xe1d7('0x20')](function(_0x55f193){if(_0x55f193){_0x30aee0=_0x55f193[_0xe1d7('0x4d')];if(!_0x141612['query'][_0xe1d7('0x75')](_0xe1d7('0x4e'))){_0x150525[_0xe1d7('0x33')]=qs[_0xe1d7('0x33')](_0x141612['query']['limit']);_0x150525[_0xe1d7('0x30')]=qs[_0xe1d7('0x30')](_0x141612[_0xe1d7('0x47')][_0xe1d7('0x30')]);}return _0x216dea[_0xe1d7('0x9a')](_0x150525);}})[_0xe1d7('0x20')](function(_0x48cce3){if(_0x48cce3){return _0x48cce3?{'count':_0x30aee0,'rows':_0x48cce3}:null;}})[_0xe1d7('0x20')](respondWithResult(_0x3bb9a3,null))[_0xe1d7('0x2b')](handleError(_0x3bb9a3,null));}; \ No newline at end of file +var _0x3595=['clone','ut.UserId\x20=\x20?','push','toString','TeamId','all','value','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','client','http','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','then','destroy','get','ChatQueues','UserProfileResource','name','send','body','contact','agent','interaction','account','index','map','ChatQueue','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','include','rows','show','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','UserChatQueue','ChatQueueId','findAll','findAndCountAll','UserId','chatPause','createdAt','format','%s/%s','updatedAt','getTeams','addTeams','ids','online','voicePause','flatMap','Agents','sequelize','each','forEach','emit','userChatQueue:save','removeTeams','User','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?'];(function(_0x5ba038,_0x31f47f){var _0x25b682=function(_0x4b8a5e){while(--_0x4b8a5e){_0x5ba038['push'](_0x5ba038['shift']());}};_0x25b682(++_0x31f47f);}(_0x3595,0x147));var _0x5359=function(_0x7a40d8,_0x16ce76){_0x7a40d8=_0x7a40d8-0x0;var _0x3a8746=_0x3595[_0x7a40d8];return _0x3a8746;};'use strict';var emlformat=require(_0x5359('0x0'));var rimraf=require(_0x5359('0x1'));var zipdir=require(_0x5359('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5359('0x3'));var moment=require(_0x5359('0x4'));var BPromise=require(_0x5359('0x5'));var Mustache=require(_0x5359('0x6'));var util=require(_0x5359('0x7'));var path=require(_0x5359('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5359('0x9'));var fs=require('fs');var fs_extra=require(_0x5359('0xa'));var _=require(_0x5359('0xb'));var squel=require(_0x5359('0xc'));var crypto=require(_0x5359('0xd'));var jsforce=require(_0x5359('0xe'));var deskjs=require(_0x5359('0xf'));var toCsv=require(_0x5359('0x10'));var querystring=require(_0x5359('0x11'));var Papa=require(_0x5359('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5359('0x13'));var logger=require(_0x5359('0x14'))(_0x5359('0x15'));var utils=require(_0x5359('0x16'));var config=require(_0x5359('0x17'));var licenseUtil=require(_0x5359('0x18'));var db=require(_0x5359('0x19'))['db'];config[_0x5359('0x1a')]=_[_0x5359('0x1b')](config[_0x5359('0x1a')],{'host':_0x5359('0x1c'),'port':0x18eb});var socket=require(_0x5359('0x1d'))(new Redis(config[_0x5359('0x1a')]));require(_0x5359('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x5359('0x1f')][_0x5359('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x11d494,_0xa146f5,_0xcdc03e,_0x44c489){return new BPromise(function(_0x534c3e,_0x5399bb){var _0x267d4c=_0x44c489||client;return _0x267d4c[_0x5359('0x21')](_0x11d494,_0xcdc03e)['then'](function(_0x10007f){logger[_0x5359('0x22')](_0x5359('0x23'),_0xa146f5,_0x5359('0x24'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0xa146f5,'request\x20sent',JSON[_0x5359('0x25')](_0x10007f));if(_0x10007f[_0x5359('0x26')]){if(_0x10007f['error'][_0x5359('0x27')]===0x1f4){logger[_0x5359('0x26')](_0x5359('0x23'),_0xa146f5,_0x10007f[_0x5359('0x26')]['message']);return _0x5399bb(_0x10007f[_0x5359('0x26')][_0x5359('0x28')]);}logger['error'](_0x5359('0x23'),_0xa146f5,_0x10007f[_0x5359('0x26')][_0x5359('0x28')]);return _0x534c3e(_0x10007f[_0x5359('0x26')][_0x5359('0x28')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0xa146f5,_0x5359('0x24'));_0x534c3e(_0x10007f[_0x5359('0x29')][_0x5359('0x28')]);}})[_0x5359('0x2a')](function(_0xe8cc42){logger[_0x5359('0x26')](_0x5359('0x23'),_0xa146f5,_0xe8cc42);_0x5399bb(_0xe8cc42);});});}function respondWithStatusCode(_0x2771ea,_0x3fea11){_0x3fea11=_0x3fea11||0xcc;return function(_0x550881){if(_0x550881){return _0x2771ea[_0x5359('0x2b')](_0x3fea11);}return _0x2771ea[_0x5359('0x2c')](_0x3fea11)[_0x5359('0x2d')]();};}function respondWithResult(_0x3753cb,_0x234c96){_0x234c96=_0x234c96||0xc8;return function(_0x402bce){if(_0x402bce){return _0x3753cb['status'](_0x234c96)[_0x5359('0x2e')](_0x402bce);}};}function respondWithFilteredResult(_0x47cda4,_0x3b0f9c){return function(_0x4b130a){if(_0x4b130a){var _0x1d6810=typeof _0x3b0f9c[_0x5359('0x2f')]==='undefined'&&typeof _0x3b0f9c[_0x5359('0x30')]==='undefined';var _0x20cd96=_0x4b130a[_0x5359('0x31')];var _0x1ac5ac=_0x1d6810?0x0:_0x3b0f9c[_0x5359('0x2f')];var _0x19c102=_0x1d6810?_0x4b130a[_0x5359('0x31')]:_0x3b0f9c[_0x5359('0x2f')]+_0x3b0f9c[_0x5359('0x30')];var _0x2acf23;if(_0x19c102>=_0x20cd96){_0x19c102=_0x20cd96;_0x2acf23=0xc8;}else{_0x2acf23=0xce;}_0x47cda4[_0x5359('0x2c')](_0x2acf23);return _0x47cda4[_0x5359('0x32')](_0x5359('0x33'),_0x1ac5ac+'-'+_0x19c102+'/'+_0x20cd96)[_0x5359('0x2e')](_0x4b130a);}return null;};}function patchUpdates(_0x212b58){return function(_0x17b26e){try{jsonpatch[_0x5359('0x34')](_0x17b26e,_0x212b58,!![]);}catch(_0x1981c7){return BPromise[_0x5359('0x35')](_0x1981c7);}return _0x17b26e['save']();};}function saveUpdates(_0x457c6e,_0x101ff9){return function(_0x4c07e0){if(_0x4c07e0){return _0x4c07e0['update'](_0x457c6e)[_0x5359('0x36')](function(_0x251dc6){return _0x251dc6;});}return null;};}function removeEntity(_0x2fc0bb,_0x35ceb9){return function(_0x4b6fdf){if(_0x4b6fdf){return _0x4b6fdf[_0x5359('0x37')]()['then'](function(){var _0x27f663=_0x4b6fdf[_0x5359('0x38')]({'plain':!![]});var _0x1faeaa=_0x5359('0x39');return db[_0x5359('0x3a')][_0x5359('0x37')]({'where':{'type':_0x1faeaa,'resourceId':_0x27f663['id']}})[_0x5359('0x36')](function(){return _0x4b6fdf;});})[_0x5359('0x36')](function(){_0x2fc0bb[_0x5359('0x2c')](0xcc)[_0x5359('0x2d')]();});}};}function handleEntityNotFound(_0x7ba0e5,_0x3392c9){return function(_0x56cbd4){if(!_0x56cbd4){_0x7ba0e5['sendStatus'](0x194);}return _0x56cbd4;};}function handleError(_0x567e0e,_0x38b429){_0x38b429=_0x38b429||0x1f4;return function(_0x3b5947){logger['error'](_0x3b5947['stack']);if(_0x3b5947[_0x5359('0x3b')]){delete _0x3b5947[_0x5359('0x3b')];}_0x567e0e[_0x5359('0x2c')](_0x38b429)[_0x5359('0x3c')](_0x3b5947);};}function getMustacheRender(_0x1aee86,_0x19fd15){return Mustache['render'](_0x1aee86,_['merge'](_0x19fd15[_0x5359('0x3d')],{'contact':_0x19fd15[_0x5359('0x3e')],'message':_0x19fd15[_0x5359('0x28')],'agent':_0x19fd15[_0x5359('0x3f')],'interaction':_0x19fd15[_0x5359('0x40')],'account':_0x19fd15[_0x5359('0x41')]}))||'';}exports[_0x5359('0x42')]=function(_0x45555b,_0x55e6f6){var _0x35b8b6={},_0x4b4a99={},_0x48250b={'count':0x0,'rows':[]};var _0x37fe85=_[_0x5359('0x43')](db[_0x5359('0x44')][_0x5359('0x45')],function(_0x1e74d6){return{'name':_0x1e74d6[_0x5359('0x46')],'type':_0x1e74d6['type'][_0x5359('0x47')]};});_0x4b4a99[_0x5359('0x48')]=_[_0x5359('0x43')](_0x37fe85,_0x5359('0x3b'));_0x4b4a99['query']=_[_0x5359('0x49')](_0x45555b['query']);_0x4b4a99[_0x5359('0x4a')]=_[_0x5359('0x4b')](_0x4b4a99[_0x5359('0x48')],_0x4b4a99[_0x5359('0x4c')]);_0x35b8b6[_0x5359('0x4d')]=_[_0x5359('0x4b')](_0x4b4a99[_0x5359('0x48')],qs[_0x5359('0x4e')](_0x45555b[_0x5359('0x4c')][_0x5359('0x4e')]));_0x35b8b6[_0x5359('0x4d')]=_0x35b8b6[_0x5359('0x4d')]['length']?_0x35b8b6[_0x5359('0x4d')]:_0x4b4a99[_0x5359('0x48')];if(!_0x45555b[_0x5359('0x4c')][_0x5359('0x4f')](_0x5359('0x50'))){_0x35b8b6[_0x5359('0x30')]=qs[_0x5359('0x30')](_0x45555b['query'][_0x5359('0x30')]);_0x35b8b6['offset']=qs[_0x5359('0x2f')](_0x45555b[_0x5359('0x4c')][_0x5359('0x2f')]);}_0x35b8b6[_0x5359('0x51')]=qs[_0x5359('0x52')](_0x45555b['query'][_0x5359('0x52')]);_0x35b8b6[_0x5359('0x53')]=qs['filters'](_[_0x5359('0x54')](_0x45555b[_0x5359('0x4c')],_0x4b4a99[_0x5359('0x4a')]),_0x37fe85);if(_0x45555b[_0x5359('0x4c')]['filter']){_0x35b8b6[_0x5359('0x53')]=_[_0x5359('0x55')](_0x35b8b6[_0x5359('0x53')],{'$or':_[_0x5359('0x43')](_0x37fe85,function(_0x46462b){if(_0x46462b[_0x5359('0x56')]!==_0x5359('0x57')){var _0x2a043e={};_0x2a043e[_0x46462b['name']]={'$like':'%'+_0x45555b[_0x5359('0x4c')][_0x5359('0x58')]+'%'};return _0x2a043e;}})});}_0x35b8b6=_[_0x5359('0x55')]({},_0x35b8b6,_0x45555b['options']);var _0x8522a5={'where':_0x35b8b6[_0x5359('0x53')]};return db['ChatQueue'][_0x5359('0x31')](_0x8522a5)[_0x5359('0x36')](function(_0x3ac363){_0x48250b[_0x5359('0x31')]=_0x3ac363;if(_0x45555b['query']['includeAll']){_0x35b8b6[_0x5359('0x59')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x35b8b6);})['then'](function(_0x238197){_0x48250b[_0x5359('0x5a')]=_0x238197;return _0x48250b;})[_0x5359('0x36')](respondWithFilteredResult(_0x55e6f6,_0x35b8b6))[_0x5359('0x2a')](handleError(_0x55e6f6,null));};exports[_0x5359('0x5b')]=function(_0x1eeb88,_0x4ce838){var _0x28cc0d={'raw':!![],'where':{'id':_0x1eeb88['params']['id']}},_0x587453={};_0x587453[_0x5359('0x48')]=_[_0x5359('0x49')](db[_0x5359('0x44')]['rawAttributes']);_0x587453[_0x5359('0x4c')]=_['keys'](_0x1eeb88[_0x5359('0x4c')]);_0x587453['filters']=_[_0x5359('0x4b')](_0x587453['model'],_0x587453[_0x5359('0x4c')]);_0x28cc0d[_0x5359('0x4d')]=_[_0x5359('0x4b')](_0x587453[_0x5359('0x48')],qs[_0x5359('0x4e')](_0x1eeb88[_0x5359('0x4c')][_0x5359('0x4e')]));_0x28cc0d['attributes']=_0x28cc0d[_0x5359('0x4d')][_0x5359('0x5c')]?_0x28cc0d['attributes']:_0x587453[_0x5359('0x48')];if(_0x1eeb88[_0x5359('0x4c')]['includeAll']){_0x28cc0d['include']=[{'all':!![]}];}_0x28cc0d=_[_0x5359('0x55')]({},_0x28cc0d,_0x1eeb88[_0x5359('0x5d')]);return db[_0x5359('0x44')][_0x5359('0x5e')](_0x28cc0d)[_0x5359('0x36')](handleEntityNotFound(_0x4ce838,null))[_0x5359('0x36')](respondWithResult(_0x4ce838,null))[_0x5359('0x2a')](handleError(_0x4ce838,null));};exports['create']=function(_0x2c4685,_0x48d0fb){return db[_0x5359('0x44')][_0x5359('0x5f')](_0x2c4685[_0x5359('0x3d')],{})[_0x5359('0x36')](function(_0x285b5d){var _0x270714=_0x2c4685[_0x5359('0x60')]['get']({'plain':!![]});if(!_0x270714)throw new Error(_0x5359('0x61'));if(_0x270714[_0x5359('0x62')]==='user'){var _0x1f9e1b=_0x285b5d[_0x5359('0x38')]({'plain':!![]});var _0x3a30f0=_0x5359('0x39');return db['UserProfileSection'][_0x5359('0x5e')]({'where':{'name':_0x3a30f0,'userProfileId':_0x270714[_0x5359('0x63')]},'raw':!![]})['then'](function(_0x164995){if(_0x164995&&_0x164995[_0x5359('0x64')]===0x0){return db[_0x5359('0x3a')]['create']({'name':_0x1f9e1b[_0x5359('0x3b')],'resourceId':_0x1f9e1b['id'],'type':_0x164995[_0x5359('0x3b')],'sectionId':_0x164995['id']},{})[_0x5359('0x36')](function(){return _0x285b5d;});}else{return _0x285b5d;}})['catch'](function(_0x20d909){logger[_0x5359('0x26')](_0x5359('0x65'),_0x20d909);throw _0x20d909;});}return _0x285b5d;})[_0x5359('0x36')](respondWithResult(_0x48d0fb,0xc9))['catch'](handleError(_0x48d0fb,null));};exports[_0x5359('0x66')]=function(_0x2a2c47,_0x22c4ee){if(_0x2a2c47[_0x5359('0x3d')]['id']){delete _0x2a2c47[_0x5359('0x3d')]['id'];}return db[_0x5359('0x44')][_0x5359('0x5e')]({'where':{'id':_0x2a2c47[_0x5359('0x67')]['id']}})['then'](handleEntityNotFound(_0x22c4ee,null))[_0x5359('0x36')](saveUpdates(_0x2a2c47[_0x5359('0x3d')],null))[_0x5359('0x36')](respondWithResult(_0x22c4ee,null))['catch'](handleError(_0x22c4ee,null));};exports[_0x5359('0x37')]=function(_0x1c4978,_0x3fb997){return db[_0x5359('0x44')][_0x5359('0x5e')]({'where':{'id':_0x1c4978[_0x5359('0x67')]['id']}})[_0x5359('0x36')](handleEntityNotFound(_0x3fb997,null))['then'](removeEntity(_0x3fb997,null))[_0x5359('0x2a')](handleError(_0x3fb997,null));};exports[_0x5359('0x68')]=function(_0x54eba5,_0x2e25b0){return db[_0x5359('0x44')][_0x5359('0x68')]()['then'](respondWithResult(_0x2e25b0,null))[_0x5359('0x2a')](handleError(_0x2e25b0,null));};exports[_0x5359('0x69')]=function(_0x502f66,_0x2ed277,_0x203ce4){var _0x336c53={'raw':!![],'where':{}},_0x31484f={},_0x3aaf77;return db[_0x5359('0x44')]['findOne']({'where':{'id':_0x502f66['params']['id']}})['then'](handleEntityNotFound(_0x2ed277,null))[_0x5359('0x36')](function(_0x29fef8){if(_0x29fef8){_0x3aaf77=_0x29fef8['get']({'plain':!![]});_0x31484f[_0x5359('0x48')]=_[_0x5359('0x49')](db[_0x5359('0x6a')][_0x5359('0x45')]);_0x31484f[_0x5359('0x4c')]=_[_0x5359('0x49')](_0x502f66['query']);_0x31484f[_0x5359('0x4a')]=_[_0x5359('0x4b')](_0x31484f[_0x5359('0x48')],_0x31484f[_0x5359('0x4c')]);_0x336c53['attributes']=_[_0x5359('0x4b')](_0x31484f[_0x5359('0x48')],qs['fields'](_0x502f66[_0x5359('0x4c')]['fields']));_0x336c53[_0x5359('0x4d')]=_0x336c53['attributes'][_0x5359('0x5c')]?_0x336c53[_0x5359('0x4d')]:_0x31484f['model'];if(!_0x502f66[_0x5359('0x4c')][_0x5359('0x4f')](_0x5359('0x50'))){_0x336c53[_0x5359('0x30')]=qs[_0x5359('0x30')](_0x502f66[_0x5359('0x4c')][_0x5359('0x30')]);_0x336c53['offset']=qs[_0x5359('0x2f')](_0x502f66[_0x5359('0x4c')]['offset']);}_0x336c53[_0x5359('0x51')]=qs['sort'](_0x502f66[_0x5359('0x4c')][_0x5359('0x52')]);_0x336c53['where']=qs[_0x5359('0x4a')](_[_0x5359('0x54')](_0x502f66[_0x5359('0x4c')],_0x31484f[_0x5359('0x4a')]));_0x336c53[_0x5359('0x53')][_0x5359('0x6b')]=_0x29fef8['id'];if(_0x502f66[_0x5359('0x4c')][_0x5359('0x58')]){_0x336c53[_0x5359('0x53')]=_[_0x5359('0x55')](_0x336c53[_0x5359('0x53')],{'$or':_['map'](_0x336c53[_0x5359('0x4d')],function(_0x18a3de){var _0x54c278={};_0x54c278[_0x18a3de]={'$like':'%'+_0x502f66[_0x5359('0x4c')][_0x5359('0x58')]+'%'};return _0x54c278;})});}_0x336c53=_[_0x5359('0x55')]({},_0x336c53,_0x502f66[_0x5359('0x5d')]);return db[_0x5359('0x6a')][_0x5359('0x6c')](_0x336c53);}})[_0x5359('0x36')](function(_0x1486da){if(_0x1486da){return db['User'][_0x5359('0x6d')]({'where':{'id':_['map'](_0x1486da,_0x5359('0x6e')),'role':'agent'},'attributes':['id',_0x5359('0x3b'),_0x5359('0x6f'),'updatedAt',_0x5359('0x70')]});}})[_0x5359('0x36')](function(_0xd6f413){if(_0xd6f413){return{'count':_0xd6f413['count'],'rows':_[_0x5359('0x43')](_0xd6f413[_0x5359('0x5a')],function(_0x487642){return{'membername':_0x487642[_0x5359('0x3b')],'UserId':_0x487642['id'],'queue_name':_0x3aaf77['name'],'ChatQueueId':_0x3aaf77['id'],'interface':util[_0x5359('0x71')](_0x5359('0x72'),'SIP',_0x487642['name']),'penalty':0x0,'paused':_0x487642[_0x5359('0x6f')],'createdAt':_0x487642[_0x5359('0x70')],'updatedAt':_0x487642[_0x5359('0x73')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5359('0x36')](respondWithFilteredResult(_0x2ed277,_0x336c53))['catch'](handleError(_0x2ed277,null));};exports[_0x5359('0x74')]=function(_0x1b6e9f,_0x4bc760,_0x4ba96d){var _0x58f83b={};var _0x481fe9={};var _0x193140;var _0x1a9aea;return db[_0x5359('0x44')]['findOne']({'where':{'id':_0x1b6e9f[_0x5359('0x67')]['id']}})[_0x5359('0x36')](handleEntityNotFound(_0x4bc760,null))['then'](function(_0x357e94){if(_0x357e94){_0x193140=_0x357e94;_0x481fe9[_0x5359('0x48')]=_['keys'](db['Team'][_0x5359('0x45')]);_0x481fe9[_0x5359('0x4c')]=_[_0x5359('0x49')](_0x1b6e9f[_0x5359('0x4c')]);_0x481fe9[_0x5359('0x4a')]=_[_0x5359('0x4b')](_0x481fe9[_0x5359('0x48')],_0x481fe9[_0x5359('0x4c')]);_0x58f83b[_0x5359('0x4d')]=_[_0x5359('0x4b')](_0x481fe9[_0x5359('0x48')],qs[_0x5359('0x4e')](_0x1b6e9f[_0x5359('0x4c')]['fields']));_0x58f83b['attributes']=_0x58f83b[_0x5359('0x4d')][_0x5359('0x5c')]?_0x58f83b['attributes']:_0x481fe9['model'];_0x58f83b['order']=qs[_0x5359('0x52')](_0x1b6e9f['query'][_0x5359('0x52')]);_0x58f83b[_0x5359('0x53')]=qs[_0x5359('0x4a')](_[_0x5359('0x54')](_0x1b6e9f[_0x5359('0x4c')],_0x481fe9['filters']));if(_0x1b6e9f['query'][_0x5359('0x58')]){_0x58f83b[_0x5359('0x53')]=_[_0x5359('0x55')](_0x58f83b[_0x5359('0x53')],{'$or':_[_0x5359('0x43')](_0x58f83b[_0x5359('0x4d')],function(_0x40f74c){var _0x5e0cce={};_0x5e0cce[_0x40f74c]={'$like':'%'+_0x1b6e9f['query']['filter']+'%'};return _0x5e0cce;})});}_0x58f83b=_[_0x5359('0x55')]({},_0x58f83b,_0x1b6e9f[_0x5359('0x5d')]);return _0x193140['getTeams'](_0x58f83b);}})[_0x5359('0x36')](function(_0x39f491){if(_0x39f491){_0x1a9aea=_0x39f491[_0x5359('0x5c')];if(!_0x1b6e9f[_0x5359('0x4c')][_0x5359('0x4f')](_0x5359('0x50'))){_0x58f83b[_0x5359('0x30')]=qs[_0x5359('0x30')](_0x1b6e9f[_0x5359('0x4c')][_0x5359('0x30')]);_0x58f83b[_0x5359('0x2f')]=qs['offset'](_0x1b6e9f[_0x5359('0x4c')][_0x5359('0x2f')]);}return _0x193140[_0x5359('0x74')](_0x58f83b);}})[_0x5359('0x36')](function(_0x56d31d){if(_0x56d31d){return _0x56d31d?{'count':_0x1a9aea,'rows':_0x56d31d}:null;}})[_0x5359('0x36')](respondWithResult(_0x4bc760,null))['catch'](handleError(_0x4bc760,null));};exports[_0x5359('0x75')]=function(_0x28a905,_0x21c0f5,_0x1d66ff){var _0xaf262=_0x28a905[_0x5359('0x3d')][_0x5359('0x76')];return db['Team'][_0x5359('0x6c')]({'where':{'id':_0xaf262},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x5359('0x3b'),_0x5359('0x77'),_0x5359('0x78'),'interface'],'raw':!![]}]})[_0x5359('0x36')](function(_0x11664a){if(_0x11664a){var _0x10038a=_[_0x5359('0x79')](_0x11664a,function(_0xdfa718){var _0x10b84a=_0xdfa718[_0x5359('0x38')]({'plain':!![]});return _0x10b84a[_0x5359('0x7a')];});return db['ChatQueue'][_0x5359('0x5e')]({'where':{'id':_0x28a905[_0x5359('0x67')]['id']}})[_0x5359('0x36')](function(_0x494a94){return db[_0x5359('0x7b')]['transaction'](function(_0x21d0f1){return _0x494a94['addTeams'](_0xaf262,{'transaction':_0x21d0f1})[_0x5359('0x36')](function(){return BPromise[_0x5359('0x7c')](_0x10038a,function(_0x462551){return db[_0x5359('0x6a')]['findOrCreate']({'where':{'UserId':_0x462551['id'],'ChatQueueId':_0x28a905[_0x5359('0x67')]['id']},'transaction':_0x21d0f1});});})[_0x5359('0x36')](function(){_0x10038a[_0x5359('0x7d')](function(_0x22a52f){socket[_0x5359('0x7e')](_0x5359('0x7f'),{'UserId':_0x22a52f['id'],'ChatQueueId':_0x494a94['id']});});});});});}})[_0x5359('0x36')](respondWithStatusCode(_0x21c0f5,null))[_0x5359('0x2a')](handleError(_0x21c0f5,null));};exports[_0x5359('0x80')]=function(_0x40339c,_0x349c08,_0x10dff3){return db['Team'][_0x5359('0x6c')]({'where':{'id':_0x40339c[_0x5359('0x4c')][_0x5359('0x76')]},'attributes':['id'],'include':[{'model':db[_0x5359('0x81')],'as':_0x5359('0x7a'),'attributes':['id'],'raw':!![]}]})[_0x5359('0x36')](handleEntityNotFound(_0x349c08,null))[_0x5359('0x36')](function(_0xdb3e42){var _0x42dfc6=_[_0x5359('0x43')](_0xdb3e42,'id');var _0x516f3d=[];var _0x598e32=[];var _0x291692=squel[_0x5359('0x82')]();_0x291692[_0x5359('0x83')](_0x5359('0x84'))['from'](_0x5359('0x85'),'tq')[_0x5359('0x86')](_0x5359('0x87'),'ut',_0x5359('0x88'))[_0x5359('0x53')](_0x5359('0x89'),_0x40339c[_0x5359('0x67')]['id']);for(var _0x31b11e=0x0;_0x31b11e<_0xdb3e42[_0x5359('0x5c')];_0x31b11e+=0x1){let _0x41e06e=_0xdb3e42[_0x31b11e];for(var _0x26b380=0x0;_0x26b380<_0x41e06e[_0x5359('0x7a')][_0x5359('0x5c')];_0x26b380+=0x1){let _0x58e23e=_0x41e06e[_0x5359('0x7a')][_0x26b380];var _0x22e8c5=_0x291692[_0x5359('0x8a')]();_0x22e8c5[_0x5359('0x53')](_0x5359('0x8b'),_0x58e23e['id']);_0x598e32[_0x5359('0x8c')](db[_0x5359('0x7b')][_0x5359('0x4c')](_0x22e8c5[_0x5359('0x8d')](),{'type':db[_0x5359('0x7b')]['QueryTypes']['SELECT']})[_0x5359('0x36')](function(_0x2e80d0){if(_0x2e80d0[_0x5359('0x5c')]===0x1){return _0x58e23e['id'];}else{var _0x20dc70=_['every'](_[_0x5359('0x43')](_0x2e80d0,_0x5359('0x8e')),function(_0x38f99e){return _['includes'](_0x42dfc6,_0x38f99e);});if(_0x20dc70){return _0x58e23e['id'];}}}));}}return BPromise[_0x5359('0x8f')](_0x598e32)[_0x5359('0x36')](function(_0xbe9b77){_0x516f3d=_(_0x516f3d)['union'](_0xbe9b77)['compact']()[_0x5359('0x90')]();return db[_0x5359('0x44')][_0x5359('0x5e')]({'where':{'id':_0x40339c['params']['id']}})['then'](function(_0x45d8c8){return db[_0x5359('0x7b')][_0x5359('0x91')](function(_0x5e73d7){return _0x45d8c8[_0x5359('0x80')](_0x40339c[_0x5359('0x4c')][_0x5359('0x76')],{'transaction':_0x5e73d7})[_0x5359('0x36')](function(){if(!_[_0x5359('0x92')](_0x516f3d)){return _0x45d8c8[_0x5359('0x93')](_0x516f3d,{'transaction':_0x5e73d7});}})['then'](function(){_0x516f3d[_0x5359('0x7d')](function(_0x2f6626){socket[_0x5359('0x7e')](_0x5359('0x94'),{'UserId':_0x2f6626,'ChatQueueId':_0x45d8c8['id']});});});});});});})['then'](respondWithStatusCode(_0x349c08,null))['catch'](handleError(_0x349c08,null));};exports[_0x5359('0x95')]=function(_0x12ba61,_0x119d5e,_0x1d3ed1){return db[_0x5359('0x44')][_0x5359('0x5e')]({'where':{'id':_0x12ba61[_0x5359('0x67')]['id']}})[_0x5359('0x36')](handleEntityNotFound(_0x119d5e,null))[_0x5359('0x36')](function(_0x2a7517){if(_0x2a7517){return _0x2a7517[_0x5359('0x95')](_0x12ba61['body'][_0x5359('0x76')],_[_0x5359('0x96')](_0x12ba61[_0x5359('0x3d')],[_0x5359('0x76'),'id'])||{})[_0x5359('0x97')](function(_0x19bda2){for(var _0x4c3bb4=0x0;_0x4c3bb4<_0x12ba61[_0x5359('0x3d')][_0x5359('0x76')]['length'];_0x4c3bb4+=0x1){socket[_0x5359('0x7e')](_0x5359('0x7f'),{'UserId':_0x12ba61['body'][_0x5359('0x76')][_0x4c3bb4],'ChatQueueId':_0x12ba61[_0x5359('0x67')]['id']});}return _0x19bda2;});}})[_0x5359('0x36')](respondWithResult(_0x119d5e,null))[_0x5359('0x2a')](handleError(_0x119d5e,null));};exports[_0x5359('0x93')]=function(_0x1969cf,_0x4842bf,_0x13b136){return db['ChatQueue']['find']({'where':{'id':_0x1969cf[_0x5359('0x67')]['id']}})[_0x5359('0x36')](handleEntityNotFound(_0x4842bf,null))[_0x5359('0x36')](function(_0x4b8397){if(_0x4b8397){return _0x4b8397[_0x5359('0x93')](_0x1969cf[_0x5359('0x4c')][_0x5359('0x76')])[_0x5359('0x36')](function(){if(_[_0x5359('0x98')](_0x1969cf[_0x5359('0x4c')][_0x5359('0x76')])){for(var _0x189bf6=0x0;_0x189bf6<_0x1969cf[_0x5359('0x4c')][_0x5359('0x76')][_0x5359('0x5c')];_0x189bf6+=0x1){socket[_0x5359('0x7e')](_0x5359('0x94'),{'UserId':Number(_0x1969cf[_0x5359('0x4c')][_0x5359('0x76')][_0x189bf6]),'ChatQueueId':Number(_0x1969cf['params']['id'])});}}else{socket['emit'](_0x5359('0x94'),{'UserId':Number(_0x1969cf[_0x5359('0x4c')]['ids']),'ChatQueueId':Number(_0x1969cf['params']['id'])});}});}})[_0x5359('0x36')](respondWithStatusCode(_0x4842bf,null))[_0x5359('0x2a')](handleError(_0x4842bf,null));};exports[_0x5359('0x99')]=function(_0x364601,_0x4ad3b9,_0x3a25e4){var _0x218c5d={};var _0x2f0de7={};var _0xa1ace7;var _0x1ee5fd;return db[_0x5359('0x44')][_0x5359('0x9a')]({'where':{'id':_0x364601['params']['id']}})['then'](handleEntityNotFound(_0x4ad3b9,null))['then'](function(_0x129609){if(_0x129609){_0xa1ace7=_0x129609;_0x2f0de7[_0x5359('0x48')]=_[_0x5359('0x49')](db['User']['rawAttributes']);_0x2f0de7[_0x5359('0x4c')]=_['keys'](_0x364601[_0x5359('0x4c')]);_0x2f0de7['filters']=_['intersection'](_0x2f0de7[_0x5359('0x48')],_0x2f0de7[_0x5359('0x4c')]);_0x218c5d[_0x5359('0x4d')]=_[_0x5359('0x4b')](_0x2f0de7[_0x5359('0x48')],qs['fields'](_0x364601['query']['fields']));_0x218c5d['attributes']=_0x218c5d['attributes']['length']?_0x218c5d[_0x5359('0x4d')]:_0x2f0de7[_0x5359('0x48')];_0x218c5d[_0x5359('0x51')]=qs[_0x5359('0x52')](_0x364601['query'][_0x5359('0x52')]);_0x218c5d[_0x5359('0x53')]=qs[_0x5359('0x4a')](_[_0x5359('0x54')](_0x364601[_0x5359('0x4c')],_0x2f0de7[_0x5359('0x4a')]));if(_0x364601['query'][_0x5359('0x58')]){_0x218c5d[_0x5359('0x53')]=_['merge'](_0x218c5d['where'],{'$or':_['map'](_0x218c5d['attributes'],function(_0x4fedbb){var _0x46b47d={};_0x46b47d[_0x4fedbb]={'$like':'%'+_0x364601[_0x5359('0x4c')][_0x5359('0x58')]+'%'};return _0x46b47d;})});}_0x218c5d=_[_0x5359('0x55')]({},_0x218c5d,_0x364601[_0x5359('0x5d')]);return _0xa1ace7[_0x5359('0x99')](_0x218c5d);}})[_0x5359('0x36')](function(_0x1932c5){if(_0x1932c5){_0x1ee5fd=_0x1932c5[_0x5359('0x5c')];if(!_0x364601['query'][_0x5359('0x4f')](_0x5359('0x50'))){_0x218c5d[_0x5359('0x30')]=qs[_0x5359('0x30')](_0x364601[_0x5359('0x4c')][_0x5359('0x30')]);_0x218c5d[_0x5359('0x2f')]=qs[_0x5359('0x2f')](_0x364601[_0x5359('0x4c')][_0x5359('0x2f')]);}return _0xa1ace7[_0x5359('0x99')](_0x218c5d);}})['then'](function(_0x9b26db){if(_0x9b26db){return _0x9b26db?{'count':_0x1ee5fd,'rows':_0x9b26db}:null;}})[_0x5359('0x36')](respondWithResult(_0x4ad3b9,null))['catch'](handleError(_0x4ad3b9,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 81aca8b..8b27cb0 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 _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatQueue'];(function(_0x4fbb3e,_0x55785f){var _0x1eb197=function(_0xfda25){while(--_0xfda25){_0x4fbb3e['push'](_0x4fbb3e['shift']());}};_0x1eb197(++_0x55785f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x0baf('0x0'))['db'][_0x0baf('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0baf('0x2')](0x0);var events={'afterCreate':_0x0baf('0x3'),'afterUpdate':_0x0baf('0x4'),'afterDestroy':_0x0baf('0x5')};function emitEvent(_0x5a3e42){return function(_0x232cc7,_0x1c383e,_0x2d3fa5){ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42+':'+_0x232cc7['id'],_0x232cc7);ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42,_0x232cc7);_0x2d3fa5(null);};}for(var e in events){if(events[_0x0baf('0x7')](e)){var event=events[e];ChatQueue[_0x0baf('0x8')](e,emitEvent(event));}}module[_0x0baf('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x39c54e,_0x4ecf92){var _0x54a727=function(_0x375a56){while(--_0x375a56){_0x39c54e['push'](_0x39c54e['shift']());}};_0x54a727(++_0x4ecf92);}(_0x5f2f,0x73));var _0xf5f2=function(_0x29e633,_0x4c2016){_0x29e633=_0x29e633-0x0;var _0x5a4e9b=_0x5f2f[_0x29e633];return _0x5a4e9b;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 9b7ecad..34bdcc0 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 _0xa043=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue','chat_queues','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa043,0x11d));var _0x3a04=function(_0x2955e3,_0x289e4b){_0x2955e3=_0x2955e3-0x0;var _0x490268=_0xa043[_0x2955e3];return _0x490268;};'use strict';var _=require(_0x3a04('0x0'));var util=require('util');var logger=require(_0x3a04('0x1'))(_0x3a04('0x2'));var moment=require('moment');var BPromise=require(_0x3a04('0x3'));var rp=require(_0x3a04('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a04('0x5'));var config=require(_0x3a04('0x6'));var attributes=require(_0x3a04('0x7'));module['exports']=function(_0x24fe5f,_0x137248){return _0x24fe5f[_0x3a04('0x8')](_0x3a04('0x9'),attributes,{'tableName':_0x3a04('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49df=['../../config/environment','exports','define','ChatQueue','chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3c3039,_0xd0a1dc){var _0xc9710d=function(_0x191211){while(--_0x191211){_0x3c3039['push'](_0x3c3039['shift']());}};_0xc9710d(++_0xd0a1dc);}(_0x49df,0x65));var _0xf49d=function(_0x51bd5c,_0x292789){_0x51bd5c=_0x51bd5c-0x0;var _0x5dd8b8=_0x49df[_0x51bd5c];return _0x5dd8b8;};'use strict';var _=require(_0xf49d('0x0'));var util=require('util');var logger=require(_0xf49d('0x1'))(_0xf49d('0x2'));var moment=require(_0xf49d('0x3'));var BPromise=require(_0xf49d('0x4'));var rp=require(_0xf49d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf49d('0x6'));var config=require(_0xf49d('0x7'));var attributes=require('./chatQueue.attributes');module[_0xf49d('0x8')]=function(_0x11b93d,_0x5a6f9c){return _0x11b93d[_0xf49d('0x9')](_0xf49d('0xa'),attributes,{'tableName':_0xf49d('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 881f0f5..8cbb368 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 _0x3f48=['defaults','localhost','socket.io-emitter','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetChatQueue','ChatQueue','findAll','raw','options','where','attributes','include','map','model','debug','ShowChatQueue','find','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis'];(function(_0x355933,_0x17afab){var _0x158728=function(_0x210f66){while(--_0x210f66){_0x355933['push'](_0x355933['shift']());}};_0x158728(++_0x17afab);}(_0x3f48,0x17c));var _0x83f4=function(_0xdfef6b,_0x31f80a){_0xdfef6b=_0xdfef6b-0x0;var _0x11663c=_0x3f48[_0xdfef6b];return _0x11663c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x83f4('0x0'));var BPromise=require(_0x83f4('0x1'));var rs=require(_0x83f4('0x2'));var fs=require('fs');var Redis=require(_0x83f4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x83f4('0x4'));var logger=require(_0x83f4('0x5'))('rpc');var config=require(_0x83f4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x83f4('0x7')][_0x83f4('0x8')]({'port':0x232a});config[_0x83f4('0x9')]=_[_0x83f4('0xa')](config[_0x83f4('0x9')],{'host':_0x83f4('0xb'),'port':0x18eb});var socket=require(_0x83f4('0xc'))(new Redis(config[_0x83f4('0x9')]));require('./chatQueue.socket')[_0x83f4('0xd')](socket);function respondWithRpcPromise(_0x3b0784,_0x177c28,_0x54c0c1){return new BPromise(function(_0x4cb8bb,_0x589cbe){return client[_0x83f4('0xe')](_0x3b0784,_0x54c0c1)[_0x83f4('0xf')](function(_0x74a994){logger['info'](_0x83f4('0x10'),_0x177c28,_0x83f4('0x11'));logger['debug'](_0x83f4('0x12'),_0x177c28,_0x83f4('0x11'),JSON[_0x83f4('0x13')](_0x74a994));if(_0x74a994[_0x83f4('0x14')]){if(_0x74a994[_0x83f4('0x14')][_0x83f4('0x15')]===0x1f4){logger[_0x83f4('0x14')]('ChatQueue,\x20%s,\x20%s',_0x177c28,_0x74a994[_0x83f4('0x14')][_0x83f4('0x16')]);return _0x589cbe(_0x74a994[_0x83f4('0x14')][_0x83f4('0x16')]);}logger[_0x83f4('0x14')](_0x83f4('0x10'),_0x177c28,_0x74a994['error'][_0x83f4('0x16')]);return _0x4cb8bb(_0x74a994[_0x83f4('0x14')][_0x83f4('0x16')]);}else{logger[_0x83f4('0x17')](_0x83f4('0x10'),_0x177c28,'request\x20sent');_0x4cb8bb(_0x74a994[_0x83f4('0x18')]['message']);}})[_0x83f4('0x19')](function(_0x3b08d8){logger[_0x83f4('0x14')](_0x83f4('0x10'),_0x177c28,_0x3b08d8);_0x589cbe(_0x3b08d8);});});}exports[_0x83f4('0x1a')]=function(_0x9ef4a9){var _0x52452b=this;return new Promise(function(_0x79c248,_0x14575b){return db[_0x83f4('0x1b')][_0x83f4('0x1c')]({'raw':_0x9ef4a9['options']?_0x9ef4a9['options'][_0x83f4('0x1d')]===undefined?!![]:![]:!![],'where':_0x9ef4a9[_0x83f4('0x1e')]?_0x9ef4a9[_0x83f4('0x1e')][_0x83f4('0x1f')]||null:null,'attributes':_0x9ef4a9['options']?_0x9ef4a9[_0x83f4('0x1e')][_0x83f4('0x20')]||null:null,'limit':_0x9ef4a9[_0x83f4('0x1e')]?_0x9ef4a9[_0x83f4('0x1e')]['limit']||null:null,'include':_0x9ef4a9[_0x83f4('0x1e')]?_0x9ef4a9['options'][_0x83f4('0x21')]?_[_0x83f4('0x22')](_0x9ef4a9[_0x83f4('0x1e')][_0x83f4('0x21')],function(_0x27623d){return{'model':db[_0x27623d[_0x83f4('0x23')]],'as':_0x27623d['as'],'attributes':_0x27623d[_0x83f4('0x20')],'include':_0x27623d[_0x83f4('0x21')]?_[_0x83f4('0x22')](_0x27623d[_0x83f4('0x21')],function(_0x3ab54d){return{'model':db[_0x3ab54d['model']],'as':_0x3ab54d['as'],'attributes':_0x3ab54d[_0x83f4('0x20')],'include':_0x3ab54d['include']?_['map'](_0x3ab54d[_0x83f4('0x21')],function(_0x5f17f5){return{'model':db[_0x5f17f5[_0x83f4('0x23')]],'as':_0x5f17f5['as'],'attributes':_0x5f17f5[_0x83f4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x83f4('0xf')](function(_0x5429fe){logger['info']('GetChatQueue',_0x9ef4a9);logger[_0x83f4('0x24')](_0x83f4('0x1a'),_0x9ef4a9,JSON[_0x83f4('0x13')](_0x5429fe));_0x79c248(_0x5429fe);})[_0x83f4('0x19')](function(_0x57fd72){logger[_0x83f4('0x14')](_0x83f4('0x1a'),_0x57fd72[_0x83f4('0x16')],_0x9ef4a9);_0x14575b(_0x52452b[_0x83f4('0x14')](0x1f4,_0x57fd72[_0x83f4('0x16')]));});});};exports[_0x83f4('0x25')]=function(_0x37956b){var _0x162f06=this;return new Promise(function(_0x5ca9bc,_0x203d08){return db['ChatQueue'][_0x83f4('0x26')]({'raw':_0x37956b['options']?_0x37956b[_0x83f4('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x37956b[_0x83f4('0x1e')]?_0x37956b[_0x83f4('0x1e')]['where']||null:null,'attributes':_0x37956b[_0x83f4('0x1e')]?_0x37956b['options'][_0x83f4('0x20')]||null:null,'include':_0x37956b['options']?_0x37956b[_0x83f4('0x1e')]['include']?_[_0x83f4('0x22')](_0x37956b[_0x83f4('0x1e')][_0x83f4('0x21')],function(_0x1871e1){return{'model':db[_0x1871e1[_0x83f4('0x23')]],'as':_0x1871e1['as'],'attributes':_0x1871e1[_0x83f4('0x20')],'include':_0x1871e1['include']?_[_0x83f4('0x22')](_0x1871e1[_0x83f4('0x21')],function(_0x3e2d5f){return{'model':db[_0x3e2d5f[_0x83f4('0x23')]],'as':_0x3e2d5f['as'],'attributes':_0x3e2d5f[_0x83f4('0x20')],'include':_0x3e2d5f[_0x83f4('0x21')]?_[_0x83f4('0x22')](_0x3e2d5f[_0x83f4('0x21')],function(_0x239c41){return{'model':db[_0x239c41[_0x83f4('0x23')]],'as':_0x239c41['as'],'attributes':_0x239c41[_0x83f4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x83f4('0xf')](function(_0x3f25e9){logger[_0x83f4('0x17')](_0x83f4('0x25'),_0x37956b);logger[_0x83f4('0x24')](_0x83f4('0x25'),_0x37956b,JSON[_0x83f4('0x13')](_0x3f25e9));_0x5ca9bc(_0x3f25e9);})[_0x83f4('0x19')](function(_0x437853){logger[_0x83f4('0x14')]('ShowChatQueue',_0x437853[_0x83f4('0x16')],_0x37956b);_0x203d08(_0x162f06['error'](0x1f4,_0x437853['message']));});});}; \ No newline at end of file +var _0x94d4=['model','then','debug','where','ShowChatQueue','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','register','request','info','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','findAll','raw','options','attributes','limit','include','map'];(function(_0x512c4c,_0x4bd397){var _0x58c0f1=function(_0x405fad){while(--_0x405fad){_0x512c4c['push'](_0x512c4c['shift']());}};_0x58c0f1(++_0x4bd397);}(_0x94d4,0xa5));var _0x494d=function(_0x1b20bd,_0x474417){_0x1b20bd=_0x1b20bd-0x0;var _0x463f0c=_0x94d4[_0x1b20bd];return _0x463f0c;};'use strict';var _=require(_0x494d('0x0'));var util=require(_0x494d('0x1'));var moment=require('moment');var BPromise=require(_0x494d('0x2'));var rs=require(_0x494d('0x3'));var fs=require('fs');var Redis=require(_0x494d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x494d('0x5'));var logger=require(_0x494d('0x6'))(_0x494d('0x7'));var config=require(_0x494d('0x8'));var jayson=require(_0x494d('0x9'));var client=jayson[_0x494d('0xa')][_0x494d('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x494d('0xc'),'port':0x18eb});var socket=require(_0x494d('0xd'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x494d('0xe')](socket);function respondWithRpcPromise(_0x1d4d21,_0x4f99d0,_0x376694){return new BPromise(function(_0x28bff7,_0x163bdb){return client[_0x494d('0xf')](_0x1d4d21,_0x376694)['then'](function(_0x28d3d1){logger[_0x494d('0x10')]('ChatQueue,\x20%s,\x20%s',_0x4f99d0,'request\x20sent');logger['debug'](_0x494d('0x11'),_0x4f99d0,_0x494d('0x12'),JSON[_0x494d('0x13')](_0x28d3d1));if(_0x28d3d1[_0x494d('0x14')]){if(_0x28d3d1[_0x494d('0x14')][_0x494d('0x15')]===0x1f4){logger[_0x494d('0x14')](_0x494d('0x16'),_0x4f99d0,_0x28d3d1[_0x494d('0x14')][_0x494d('0x17')]);return _0x163bdb(_0x28d3d1[_0x494d('0x14')]['message']);}logger[_0x494d('0x14')](_0x494d('0x16'),_0x4f99d0,_0x28d3d1[_0x494d('0x14')][_0x494d('0x17')]);return _0x28bff7(_0x28d3d1[_0x494d('0x14')][_0x494d('0x17')]);}else{logger[_0x494d('0x10')](_0x494d('0x16'),_0x4f99d0,_0x494d('0x12'));_0x28bff7(_0x28d3d1[_0x494d('0x18')][_0x494d('0x17')]);}})[_0x494d('0x19')](function(_0xb2fc39){logger[_0x494d('0x14')](_0x494d('0x16'),_0x4f99d0,_0xb2fc39);_0x163bdb(_0xb2fc39);});});}exports[_0x494d('0x1a')]=function(_0x134632){var _0x5bf90b=this;return new Promise(function(_0x2be3b5,_0x172763){return db[_0x494d('0x1b')][_0x494d('0x1c')]({'raw':_0x134632['options']?_0x134632['options'][_0x494d('0x1d')]===undefined?!![]:![]:!![],'where':_0x134632[_0x494d('0x1e')]?_0x134632['options']['where']||null:null,'attributes':_0x134632[_0x494d('0x1e')]?_0x134632['options'][_0x494d('0x1f')]||null:null,'limit':_0x134632['options']?_0x134632[_0x494d('0x1e')][_0x494d('0x20')]||null:null,'include':_0x134632['options']?_0x134632[_0x494d('0x1e')][_0x494d('0x21')]?_[_0x494d('0x22')](_0x134632[_0x494d('0x1e')][_0x494d('0x21')],function(_0x575f07){return{'model':db[_0x575f07[_0x494d('0x23')]],'as':_0x575f07['as'],'attributes':_0x575f07[_0x494d('0x1f')],'include':_0x575f07['include']?_['map'](_0x575f07[_0x494d('0x21')],function(_0x43a3a5){return{'model':db[_0x43a3a5[_0x494d('0x23')]],'as':_0x43a3a5['as'],'attributes':_0x43a3a5[_0x494d('0x1f')],'include':_0x43a3a5[_0x494d('0x21')]?_[_0x494d('0x22')](_0x43a3a5[_0x494d('0x21')],function(_0x347c58){return{'model':db[_0x347c58[_0x494d('0x23')]],'as':_0x347c58['as'],'attributes':_0x347c58[_0x494d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x494d('0x24')](function(_0x44f757){logger[_0x494d('0x10')]('GetChatQueue',_0x134632);logger[_0x494d('0x25')](_0x494d('0x1a'),_0x134632,JSON[_0x494d('0x13')](_0x44f757));_0x2be3b5(_0x44f757);})[_0x494d('0x19')](function(_0x2636ce){logger[_0x494d('0x14')](_0x494d('0x1a'),_0x2636ce[_0x494d('0x17')],_0x134632);_0x172763(_0x5bf90b[_0x494d('0x14')](0x1f4,_0x2636ce[_0x494d('0x17')]));});});};exports['ShowChatQueue']=function(_0x24d357){var _0x3692d3=this;return new Promise(function(_0x5de360,_0x3bd0fe){return db[_0x494d('0x1b')]['find']({'raw':_0x24d357['options']?_0x24d357[_0x494d('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x24d357[_0x494d('0x1e')]?_0x24d357[_0x494d('0x1e')][_0x494d('0x26')]||null:null,'attributes':_0x24d357[_0x494d('0x1e')]?_0x24d357['options']['attributes']||null:null,'include':_0x24d357[_0x494d('0x1e')]?_0x24d357[_0x494d('0x1e')][_0x494d('0x21')]?_['map'](_0x24d357['options'][_0x494d('0x21')],function(_0x153959){return{'model':db[_0x153959['model']],'as':_0x153959['as'],'attributes':_0x153959[_0x494d('0x1f')],'include':_0x153959[_0x494d('0x21')]?_[_0x494d('0x22')](_0x153959['include'],function(_0x571e87){return{'model':db[_0x571e87['model']],'as':_0x571e87['as'],'attributes':_0x571e87[_0x494d('0x1f')],'include':_0x571e87['include']?_['map'](_0x571e87[_0x494d('0x21')],function(_0x89b0a7){return{'model':db[_0x89b0a7[_0x494d('0x23')]],'as':_0x89b0a7['as'],'attributes':_0x89b0a7[_0x494d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x494d('0x24')](function(_0x5c20b1){logger[_0x494d('0x10')](_0x494d('0x27'),_0x24d357);logger[_0x494d('0x25')](_0x494d('0x27'),_0x24d357,JSON[_0x494d('0x13')](_0x5c20b1));_0x5de360(_0x5c20b1);})['catch'](function(_0x2a8d3a){logger[_0x494d('0x14')]('ShowChatQueue',_0x2a8d3a[_0x494d('0x17')],_0x24d357);_0x3bd0fe(_0x3692d3[_0x494d('0x14')](0x1f4,_0x2a8d3a[_0x494d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index a2861c4..6409ddd 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 _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x803ae0,_0x5c5f30){var _0x3c38b1=function(_0x59b091){while(--_0x59b091){_0x803ae0['push'](_0x803ae0['shift']());}};_0x3c38b1(++_0x5c5f30);}(_0xb10b,0x12a));var _0xbb10=function(_0x41cb4b,_0x200468){_0x41cb4b=_0x41cb4b-0x0;var _0x1719c1=_0xb10b[_0x41cb4b];return _0x1719c1;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x524cae,_0x5c8d1b){var _0xc61797=function(_0x39bb31){while(--_0x39bb31){_0x524cae['push'](_0x524cae['shift']());}};_0xc61797(++_0x5c8d1b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4eb7e6,_0x451464){_0x4eb7e6=_0x4eb7e6-0x0;var _0x3cf508=_0x0b0e[_0x4eb7e6];return _0x3cf508;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 4fa5680..9e34285 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 _0xfdf4=['/:id','update','delete','removeTeams','/:id/users','removeAgents','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','addAgents','put'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xfdf4,0x1c6));var _0x4fdf=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0xfdf4[_0x5dc03e];return _0x466a07;};'use strict';var multer=require(_0x4fdf('0x0'));var util=require(_0x4fdf('0x1'));var path=require('path');var timeout=require(_0x4fdf('0x2'));var express=require(_0x4fdf('0x3'));var router=express['Router']();var fs_extra=require(_0x4fdf('0x4'));var auth=require(_0x4fdf('0x5'));var interaction=require(_0x4fdf('0x6'));var config=require('../../config/environment');var controller=require(_0x4fdf('0x7'));router[_0x4fdf('0x8')]('/',auth[_0x4fdf('0x9')](),controller[_0x4fdf('0xa')]);router[_0x4fdf('0x8')]('/describe',auth[_0x4fdf('0x9')](),controller['describe']);router[_0x4fdf('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4fdf('0xb')]);router[_0x4fdf('0x8')](_0x4fdf('0xc'),auth['isAuthenticated'](),controller[_0x4fdf('0xd')]);router['get'](_0x4fdf('0xe'),auth['isAuthenticated'](),controller[_0x4fdf('0xf')]);router[_0x4fdf('0x8')]('/:id/users',auth[_0x4fdf('0x9')](),controller[_0x4fdf('0x10')]);router[_0x4fdf('0x11')]('/',auth[_0x4fdf('0x9')](),controller[_0x4fdf('0x12')]);router['post'](_0x4fdf('0xe'),auth['isAuthenticated'](),controller[_0x4fdf('0x13')]);router[_0x4fdf('0x11')]('/:id/users',auth[_0x4fdf('0x9')](),controller[_0x4fdf('0x14')]);router[_0x4fdf('0x15')](_0x4fdf('0x16'),auth['isAuthenticated'](),controller[_0x4fdf('0x17')]);router[_0x4fdf('0x18')]('/:id',auth[_0x4fdf('0x9')](),controller['destroy']);router[_0x4fdf('0x18')](_0x4fdf('0xe'),auth[_0x4fdf('0x9')](),controller[_0x4fdf('0x19')]);router[_0x4fdf('0x18')](_0x4fdf('0x1a'),auth['isAuthenticated'](),controller[_0x4fdf('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x895e=['Router','fs-extra','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','getAgents','post','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams','util','path','connect-timeout','express'];(function(_0x4604f0,_0x6de84f){var _0x3edd9e=function(_0x4135b5){while(--_0x4135b5){_0x4604f0['push'](_0x4604f0['shift']());}};_0x3edd9e(++_0x6de84f);}(_0x895e,0xab));var _0xe895=function(_0x24e924,_0x54df20){_0x24e924=_0x24e924-0x0;var _0x75c9cc=_0x895e[_0x24e924];return _0x75c9cc;};'use strict';var multer=require('multer');var util=require(_0xe895('0x0'));var path=require(_0xe895('0x1'));var timeout=require(_0xe895('0x2'));var express=require(_0xe895('0x3'));var router=express[_0xe895('0x4')]();var fs_extra=require(_0xe895('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe895('0x6'));var config=require('../../config/environment');var controller=require(_0xe895('0x7'));router[_0xe895('0x8')]('/',auth[_0xe895('0x9')](),controller['index']);router[_0xe895('0x8')](_0xe895('0xa'),auth['isAuthenticated'](),controller[_0xe895('0xb')]);router[_0xe895('0x8')](_0xe895('0xc'),auth[_0xe895('0x9')](),controller[_0xe895('0xd')]);router['get'](_0xe895('0xe'),auth[_0xe895('0x9')](),controller[_0xe895('0xf')]);router[_0xe895('0x8')]('/:id/teams',auth[_0xe895('0x9')](),controller['getTeams']);router[_0xe895('0x8')]('/:id/users',auth[_0xe895('0x9')](),controller[_0xe895('0x10')]);router[_0xe895('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe895('0x11')]('/:id/teams',auth[_0xe895('0x9')](),controller[_0xe895('0x12')]);router['post'](_0xe895('0x13'),auth[_0xe895('0x9')](),controller[_0xe895('0x14')]);router[_0xe895('0x15')]('/:id',auth[_0xe895('0x9')](),controller['update']);router[_0xe895('0x16')](_0xe895('0xc'),auth[_0xe895('0x9')](),controller[_0xe895('0x17')]);router[_0xe895('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe895('0x18')]);router[_0xe895('0x16')](_0xe895('0x13'),auth[_0xe895('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index d41500a..1d7204f 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 _0x5fe2=['DATE','moment','sequelize','STRING'];(function(_0xfcd89d,_0x221dbe){var _0x3d36e4=function(_0x12d6e0){while(--_0x12d6e0){_0xfcd89d['push'](_0xfcd89d['shift']());}};_0x3d36e4(++_0x221dbe);}(_0x5fe2,0x169));var _0x25fe=function(_0xac2b4a,_0x2e1a17){_0xac2b4a=_0xac2b4a-0x0;var _0x1b868a=_0x5fe2[_0xac2b4a];return _0x1b868a;};'use strict';var moment=require(_0x25fe('0x0'));var Sequelize=require(_0x25fe('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x25fe('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x25fe('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x25fe('0x2')]}}; \ No newline at end of file +var _0xae5f=['sequelize','exports','STRING','DATE','moment'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xae5f,0x103));var _0xfae5=function(_0xed54ae,_0x2ce107){_0xed54ae=_0xed54ae-0x0;var _0x3f8120=_0xae5f[_0xed54ae];return _0x3f8120;};'use strict';var moment=require(_0xfae5('0x0'));var Sequelize=require(_0xfae5('0x1'));module[_0xfae5('0x2')]={'uniqueid':{'type':Sequelize[_0xfae5('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfae5('0x4')]},'leaveAt':{'type':Sequelize[_0xfae5('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xfae5('0x4')]},'reason':{'type':Sequelize[_0xfae5('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 88f0c23..638ee95 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 _0x01cc=['account','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','VIRTUAL','filter','ChatQueueReport','include','findAll','rows','catch','show','params','keys','options','find','create','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','name','send','render','merge','body','contact','message','agent','interaction'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x01cc,0xc3));var _0xc01c=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x01cc[_0xf50820];return _0x2a9b10;};'use strict';var emlformat=require(_0xc01c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc01c('0x1'));var rp=require(_0xc01c('0x2'));var moment=require(_0xc01c('0x3'));var BPromise=require(_0xc01c('0x4'));var Mustache=require(_0xc01c('0x5'));var util=require(_0xc01c('0x6'));var path=require(_0xc01c('0x7'));var sox=require(_0xc01c('0x8'));var csv=require('to-csv');var ejs=require(_0xc01c('0x9'));var fs=require('fs');var fs_extra=require(_0xc01c('0xa'));var _=require(_0xc01c('0xb'));var squel=require('squel');var crypto=require(_0xc01c('0xc'));var jsforce=require(_0xc01c('0xd'));var deskjs=require(_0xc01c('0xe'));var toCsv=require(_0xc01c('0xf'));var querystring=require(_0xc01c('0x10'));var Papa=require(_0xc01c('0x11'));var Redis=require('ioredis');var authService=require(_0xc01c('0x12'));var qs=require(_0xc01c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc01c('0x14'));var logger=require(_0xc01c('0x15'))(_0xc01c('0x16'));var utils=require(_0xc01c('0x17'));var config=require(_0xc01c('0x18'));var licenseUtil=require(_0xc01c('0x19'));var db=require(_0xc01c('0x1a'))['db'];function respondWithStatusCode(_0x5a46dc,_0x18c3c3){_0x18c3c3=_0x18c3c3||0xcc;return function(_0x147558){if(_0x147558){return _0x5a46dc[_0xc01c('0x1b')](_0x18c3c3);}return _0x5a46dc[_0xc01c('0x1c')](_0x18c3c3)[_0xc01c('0x1d')]();};}function respondWithResult(_0x3aa0cb,_0x3a25ed){_0x3a25ed=_0x3a25ed||0xc8;return function(_0xc28d66){if(_0xc28d66){return _0x3aa0cb[_0xc01c('0x1c')](_0x3a25ed)[_0xc01c('0x1e')](_0xc28d66);}};}function respondWithFilteredResult(_0x4d48c7,_0x17b897){return function(_0x41ed6f){if(_0x41ed6f){var _0x17da9c=typeof _0x17b897[_0xc01c('0x1f')]===_0xc01c('0x20')&&typeof _0x17b897[_0xc01c('0x21')]==='undefined';var _0x2780d2=_0x41ed6f[_0xc01c('0x22')];var _0x37f48b=_0x17da9c?0x0:_0x17b897[_0xc01c('0x1f')];var _0x4e0ec6=_0x17da9c?_0x41ed6f[_0xc01c('0x22')]:_0x17b897[_0xc01c('0x1f')]+_0x17b897[_0xc01c('0x21')];var _0x11b97b;if(_0x4e0ec6>=_0x2780d2){_0x4e0ec6=_0x2780d2;_0x11b97b=0xc8;}else{_0x11b97b=0xce;}_0x4d48c7[_0xc01c('0x1c')](_0x11b97b);return _0x4d48c7[_0xc01c('0x23')](_0xc01c('0x24'),_0x37f48b+'-'+_0x4e0ec6+'/'+_0x2780d2)['json'](_0x41ed6f);}return null;};}function patchUpdates(_0x7d58d9){return function(_0x477544){try{jsonpatch[_0xc01c('0x25')](_0x477544,_0x7d58d9,!![]);}catch(_0x5814ba){return BPromise[_0xc01c('0x26')](_0x5814ba);}return _0x477544['save']();};}function saveUpdates(_0x6b9089,_0x87a632){return function(_0x1a6882){if(_0x1a6882){return _0x1a6882[_0xc01c('0x27')](_0x6b9089)[_0xc01c('0x28')](function(_0xd33de6){return _0xd33de6;});}return null;};}function removeEntity(_0x28499d,_0x1ac83c){return function(_0x296d5e){if(_0x296d5e){return _0x296d5e['destroy']()[_0xc01c('0x28')](function(){_0x28499d[_0xc01c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5657a9,_0x12a57f){return function(_0x32e5be){if(!_0x32e5be){_0x5657a9[_0xc01c('0x1b')](0x194);}return _0x32e5be;};}function handleError(_0x5a60be,_0x58e38a){_0x58e38a=_0x58e38a||0x1f4;return function(_0x2b7fcd){logger[_0xc01c('0x29')](_0x2b7fcd['stack']);if(_0x2b7fcd['name']){delete _0x2b7fcd[_0xc01c('0x2a')];}_0x5a60be['status'](_0x58e38a)[_0xc01c('0x2b')](_0x2b7fcd);};}function getMustacheRender(_0x4b0764,_0xd7ca09){return Mustache[_0xc01c('0x2c')](_0x4b0764,_[_0xc01c('0x2d')](_0xd7ca09[_0xc01c('0x2e')],{'contact':_0xd7ca09[_0xc01c('0x2f')],'message':_0xd7ca09[_0xc01c('0x30')],'agent':_0xd7ca09[_0xc01c('0x31')],'interaction':_0xd7ca09[_0xc01c('0x32')],'account':_0xd7ca09[_0xc01c('0x33')]}))||'';}exports['index']=function(_0x4c1abc,_0x1bfb5e){var _0x19bab5={},_0x341a62={},_0x56b2f3={'count':0x0,'rows':[]};var _0x412082=_[_0xc01c('0x34')](db['ChatQueueReport'][_0xc01c('0x35')],function(_0x553098){return{'name':_0x553098[_0xc01c('0x36')],'type':_0x553098[_0xc01c('0x37')][_0xc01c('0x38')]};});_0x341a62[_0xc01c('0x39')]=_[_0xc01c('0x34')](_0x412082,'name');_0x341a62[_0xc01c('0x3a')]=_['keys'](_0x4c1abc[_0xc01c('0x3a')]);_0x341a62['filters']=_['intersection'](_0x341a62[_0xc01c('0x39')],_0x341a62['query']);_0x19bab5[_0xc01c('0x3b')]=_[_0xc01c('0x3c')](_0x341a62[_0xc01c('0x39')],qs[_0xc01c('0x3d')](_0x4c1abc['query'][_0xc01c('0x3d')]));_0x19bab5['attributes']=_0x19bab5[_0xc01c('0x3b')][_0xc01c('0x3e')]?_0x19bab5['attributes']:_0x341a62[_0xc01c('0x39')];if(!_0x4c1abc[_0xc01c('0x3a')]['hasOwnProperty'](_0xc01c('0x3f'))){_0x19bab5[_0xc01c('0x21')]=qs[_0xc01c('0x21')](_0x4c1abc[_0xc01c('0x3a')]['limit']);_0x19bab5[_0xc01c('0x1f')]=qs['offset'](_0x4c1abc['query'][_0xc01c('0x1f')]);}_0x19bab5[_0xc01c('0x40')]=qs[_0xc01c('0x41')](_0x4c1abc[_0xc01c('0x3a')][_0xc01c('0x41')]);_0x19bab5[_0xc01c('0x42')]=qs[_0xc01c('0x43')](_['pick'](_0x4c1abc[_0xc01c('0x3a')],_0x341a62['filters']),_0x412082);if(_0x4c1abc['query']['filter']){_0x19bab5[_0xc01c('0x42')]=_['merge'](_0x19bab5[_0xc01c('0x42')],{'$or':_[_0xc01c('0x34')](_0x412082,function(_0x51fec4){if(_0x51fec4[_0xc01c('0x37')]!==_0xc01c('0x44')){var _0x4694ee={};_0x4694ee[_0x51fec4[_0xc01c('0x2a')]]={'$like':'%'+_0x4c1abc[_0xc01c('0x3a')][_0xc01c('0x45')]+'%'};return _0x4694ee;}})});}_0x19bab5=_[_0xc01c('0x2d')]({},_0x19bab5,_0x4c1abc['options']);var _0x14a978={'where':_0x19bab5[_0xc01c('0x42')]};return db[_0xc01c('0x46')][_0xc01c('0x22')](_0x14a978)[_0xc01c('0x28')](function(_0x3c1eb9){_0x56b2f3[_0xc01c('0x22')]=_0x3c1eb9;if(_0x4c1abc[_0xc01c('0x3a')]['includeAll']){_0x19bab5[_0xc01c('0x47')]=[{'all':!![]}];}return db[_0xc01c('0x46')][_0xc01c('0x48')](_0x19bab5);})[_0xc01c('0x28')](function(_0x4dce4f){_0x56b2f3[_0xc01c('0x49')]=_0x4dce4f;return _0x56b2f3;})['then'](respondWithFilteredResult(_0x1bfb5e,_0x19bab5))[_0xc01c('0x4a')](handleError(_0x1bfb5e,null));};exports[_0xc01c('0x4b')]=function(_0x256118,_0x234558){var _0x55f3f5={'raw':!![],'where':{'id':_0x256118[_0xc01c('0x4c')]['id']}},_0x12d9f1={};_0x12d9f1[_0xc01c('0x39')]=_[_0xc01c('0x4d')](db[_0xc01c('0x46')][_0xc01c('0x35')]);_0x12d9f1['query']=_[_0xc01c('0x4d')](_0x256118[_0xc01c('0x3a')]);_0x12d9f1[_0xc01c('0x43')]=_['intersection'](_0x12d9f1[_0xc01c('0x39')],_0x12d9f1['query']);_0x55f3f5[_0xc01c('0x3b')]=_[_0xc01c('0x3c')](_0x12d9f1[_0xc01c('0x39')],qs['fields'](_0x256118[_0xc01c('0x3a')][_0xc01c('0x3d')]));_0x55f3f5[_0xc01c('0x3b')]=_0x55f3f5[_0xc01c('0x3b')][_0xc01c('0x3e')]?_0x55f3f5['attributes']:_0x12d9f1[_0xc01c('0x39')];if(_0x256118[_0xc01c('0x3a')]['includeAll']){_0x55f3f5['include']=[{'all':!![]}];}_0x55f3f5=_[_0xc01c('0x2d')]({},_0x55f3f5,_0x256118[_0xc01c('0x4e')]);return db[_0xc01c('0x46')][_0xc01c('0x4f')](_0x55f3f5)[_0xc01c('0x28')](handleEntityNotFound(_0x234558,null))['then'](respondWithResult(_0x234558,null))[_0xc01c('0x4a')](handleError(_0x234558,null));};exports[_0xc01c('0x50')]=function(_0x109a68,_0x2110d5){return db[_0xc01c('0x46')][_0xc01c('0x50')](_0x109a68[_0xc01c('0x2e')],{})['then'](respondWithResult(_0x2110d5,0xc9))[_0xc01c('0x4a')](handleError(_0x2110d5,null));};exports[_0xc01c('0x27')]=function(_0x19af0e,_0x633bde){if(_0x19af0e[_0xc01c('0x2e')]['id']){delete _0x19af0e['body']['id'];}return db[_0xc01c('0x46')][_0xc01c('0x4f')]({'where':{'id':_0x19af0e[_0xc01c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x633bde,null))[_0xc01c('0x28')](saveUpdates(_0x19af0e[_0xc01c('0x2e')],null))[_0xc01c('0x28')](respondWithResult(_0x633bde,null))[_0xc01c('0x4a')](handleError(_0x633bde,null));};exports['destroy']=function(_0x2e2003,_0x2a0878){return db[_0xc01c('0x46')][_0xc01c('0x4f')]({'where':{'id':_0x2e2003[_0xc01c('0x4c')]['id']}})[_0xc01c('0x28')](handleEntityNotFound(_0x2a0878,null))[_0xc01c('0x28')](removeEntity(_0x2a0878,null))[_0xc01c('0x4a')](handleError(_0x2a0878,null));};exports['describe']=function(_0x503c68,_0x390407){return db[_0xc01c('0x46')][_0xc01c('0x51')]()[_0xc01c('0x28')](respondWithResult(_0x390407,null))['catch'](handleError(_0x390407,null));}; \ No newline at end of file +var _0x40f7=['update','then','destroy','error','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','ChatQueueReport','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','params','describe','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save'];(function(_0x4ee3e0,_0x4f57f1){var _0x3bc180=function(_0x539bfc){while(--_0x539bfc){_0x4ee3e0['push'](_0x4ee3e0['shift']());}};_0x3bc180(++_0x4f57f1);}(_0x40f7,0x1b9));var _0x740f=function(_0x44c722,_0x3e3e7e){_0x44c722=_0x44c722-0x0;var _0x354b6f=_0x40f7[_0x44c722];return _0x354b6f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x740f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x740f('0x1'));var Mustache=require(_0x740f('0x2'));var util=require(_0x740f('0x3'));var path=require('path');var sox=require(_0x740f('0x4'));var csv=require(_0x740f('0x5'));var ejs=require(_0x740f('0x6'));var fs=require('fs');var fs_extra=require(_0x740f('0x7'));var _=require(_0x740f('0x8'));var squel=require(_0x740f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x740f('0xa'));var toCsv=require(_0x740f('0x5'));var querystring=require('querystring');var Papa=require(_0x740f('0xb'));var Redis=require(_0x740f('0xc'));var authService=require(_0x740f('0xd'));var qs=require(_0x740f('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x740f('0xf'));var logger=require(_0x740f('0x10'))(_0x740f('0x11'));var utils=require(_0x740f('0x12'));var config=require(_0x740f('0x13'));var licenseUtil=require(_0x740f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a49bb,_0x48f003){_0x48f003=_0x48f003||0xcc;return function(_0x15e9ce){if(_0x15e9ce){return _0x5a49bb[_0x740f('0x15')](_0x48f003);}return _0x5a49bb[_0x740f('0x16')](_0x48f003)[_0x740f('0x17')]();};}function respondWithResult(_0x3ed47f,_0x9722a6){_0x9722a6=_0x9722a6||0xc8;return function(_0x441ef){if(_0x441ef){return _0x3ed47f[_0x740f('0x16')](_0x9722a6)['json'](_0x441ef);}};}function respondWithFilteredResult(_0x31b03c,_0x435d10){return function(_0x1b2f91){if(_0x1b2f91){var _0xc78e4b=typeof _0x435d10[_0x740f('0x18')]==='undefined'&&typeof _0x435d10[_0x740f('0x19')]===_0x740f('0x1a');var _0x52bd19=_0x1b2f91['count'];var _0x21ac01=_0xc78e4b?0x0:_0x435d10[_0x740f('0x18')];var _0x36fae1=_0xc78e4b?_0x1b2f91[_0x740f('0x1b')]:_0x435d10[_0x740f('0x18')]+_0x435d10[_0x740f('0x19')];var _0x25e723;if(_0x36fae1>=_0x52bd19){_0x36fae1=_0x52bd19;_0x25e723=0xc8;}else{_0x25e723=0xce;}_0x31b03c[_0x740f('0x16')](_0x25e723);return _0x31b03c[_0x740f('0x1c')](_0x740f('0x1d'),_0x21ac01+'-'+_0x36fae1+'/'+_0x52bd19)[_0x740f('0x1e')](_0x1b2f91);}return null;};}function patchUpdates(_0xdb4a13){return function(_0x27d0e8){try{jsonpatch[_0x740f('0x1f')](_0x27d0e8,_0xdb4a13,!![]);}catch(_0x41cf40){return BPromise['reject'](_0x41cf40);}return _0x27d0e8[_0x740f('0x20')]();};}function saveUpdates(_0x1fe8a7,_0x116634){return function(_0x322972){if(_0x322972){return _0x322972[_0x740f('0x21')](_0x1fe8a7)[_0x740f('0x22')](function(_0x1a394d){return _0x1a394d;});}return null;};}function removeEntity(_0x3d73cd,_0x2c9157){return function(_0xc581e1){if(_0xc581e1){return _0xc581e1[_0x740f('0x23')]()[_0x740f('0x22')](function(){_0x3d73cd['status'](0xcc)[_0x740f('0x17')]();});}};}function handleEntityNotFound(_0x8f4753,_0x17f192){return function(_0x2287be){if(!_0x2287be){_0x8f4753[_0x740f('0x15')](0x194);}return _0x2287be;};}function handleError(_0x18ac82,_0x3c9f5f){_0x3c9f5f=_0x3c9f5f||0x1f4;return function(_0x1df214){logger[_0x740f('0x24')](_0x1df214['stack']);if(_0x1df214['name']){delete _0x1df214[_0x740f('0x25')];}_0x18ac82[_0x740f('0x16')](_0x3c9f5f)[_0x740f('0x26')](_0x1df214);};}function getMustacheRender(_0x585860,_0x352d15){return Mustache[_0x740f('0x27')](_0x585860,_[_0x740f('0x28')](_0x352d15[_0x740f('0x29')],{'contact':_0x352d15[_0x740f('0x2a')],'message':_0x352d15[_0x740f('0x2b')],'agent':_0x352d15[_0x740f('0x2c')],'interaction':_0x352d15[_0x740f('0x2d')],'account':_0x352d15[_0x740f('0x2e')]}))||'';}exports[_0x740f('0x2f')]=function(_0x57ed92,_0x56cdc3){var _0x27ed6e={},_0x5e7f14={},_0x232b75={'count':0x0,'rows':[]};var _0x533a02=_[_0x740f('0x30')](db[_0x740f('0x31')][_0x740f('0x32')],function(_0x4d8e03){return{'name':_0x4d8e03['fieldName'],'type':_0x4d8e03[_0x740f('0x33')][_0x740f('0x34')]};});_0x5e7f14[_0x740f('0x35')]=_['map'](_0x533a02,_0x740f('0x25'));_0x5e7f14['query']=_[_0x740f('0x36')](_0x57ed92['query']);_0x5e7f14[_0x740f('0x37')]=_[_0x740f('0x38')](_0x5e7f14['model'],_0x5e7f14[_0x740f('0x39')]);_0x27ed6e[_0x740f('0x3a')]=_['intersection'](_0x5e7f14['model'],qs[_0x740f('0x3b')](_0x57ed92[_0x740f('0x39')][_0x740f('0x3b')]));_0x27ed6e[_0x740f('0x3a')]=_0x27ed6e['attributes'][_0x740f('0x3c')]?_0x27ed6e[_0x740f('0x3a')]:_0x5e7f14[_0x740f('0x35')];if(!_0x57ed92[_0x740f('0x39')][_0x740f('0x3d')](_0x740f('0x3e'))){_0x27ed6e[_0x740f('0x19')]=qs['limit'](_0x57ed92[_0x740f('0x39')]['limit']);_0x27ed6e['offset']=qs[_0x740f('0x18')](_0x57ed92[_0x740f('0x39')][_0x740f('0x18')]);}_0x27ed6e['order']=qs[_0x740f('0x3f')](_0x57ed92[_0x740f('0x39')][_0x740f('0x3f')]);_0x27ed6e[_0x740f('0x40')]=qs[_0x740f('0x37')](_[_0x740f('0x41')](_0x57ed92[_0x740f('0x39')],_0x5e7f14[_0x740f('0x37')]),_0x533a02);if(_0x57ed92[_0x740f('0x39')][_0x740f('0x42')]){_0x27ed6e[_0x740f('0x40')]=_[_0x740f('0x28')](_0x27ed6e[_0x740f('0x40')],{'$or':_[_0x740f('0x30')](_0x533a02,function(_0x427c09){if(_0x427c09[_0x740f('0x33')]!==_0x740f('0x43')){var _0x47ce31={};_0x47ce31[_0x427c09[_0x740f('0x25')]]={'$like':'%'+_0x57ed92['query'][_0x740f('0x42')]+'%'};return _0x47ce31;}})});}_0x27ed6e=_[_0x740f('0x28')]({},_0x27ed6e,_0x57ed92[_0x740f('0x44')]);var _0x1e4d96={'where':_0x27ed6e[_0x740f('0x40')]};return db['ChatQueueReport'][_0x740f('0x1b')](_0x1e4d96)[_0x740f('0x22')](function(_0xe17359){_0x232b75[_0x740f('0x1b')]=_0xe17359;if(_0x57ed92[_0x740f('0x39')]['includeAll']){_0x27ed6e[_0x740f('0x45')]=[{'all':!![]}];}return db[_0x740f('0x31')][_0x740f('0x46')](_0x27ed6e);})[_0x740f('0x22')](function(_0x37f339){_0x232b75[_0x740f('0x47')]=_0x37f339;return _0x232b75;})['then'](respondWithFilteredResult(_0x56cdc3,_0x27ed6e))[_0x740f('0x48')](handleError(_0x56cdc3,null));};exports[_0x740f('0x49')]=function(_0x40b9f8,_0x45fc97){var _0x3b16c4={'raw':!![],'where':{'id':_0x40b9f8['params']['id']}},_0x44bd9f={};_0x44bd9f[_0x740f('0x35')]=_['keys'](db[_0x740f('0x31')][_0x740f('0x32')]);_0x44bd9f[_0x740f('0x39')]=_['keys'](_0x40b9f8[_0x740f('0x39')]);_0x44bd9f['filters']=_[_0x740f('0x38')](_0x44bd9f['model'],_0x44bd9f[_0x740f('0x39')]);_0x3b16c4[_0x740f('0x3a')]=_[_0x740f('0x38')](_0x44bd9f[_0x740f('0x35')],qs[_0x740f('0x3b')](_0x40b9f8[_0x740f('0x39')][_0x740f('0x3b')]));_0x3b16c4[_0x740f('0x3a')]=_0x3b16c4['attributes']['length']?_0x3b16c4[_0x740f('0x3a')]:_0x44bd9f[_0x740f('0x35')];if(_0x40b9f8[_0x740f('0x39')][_0x740f('0x4a')]){_0x3b16c4[_0x740f('0x45')]=[{'all':!![]}];}_0x3b16c4=_['merge']({},_0x3b16c4,_0x40b9f8[_0x740f('0x44')]);return db['ChatQueueReport'][_0x740f('0x4b')](_0x3b16c4)[_0x740f('0x22')](handleEntityNotFound(_0x45fc97,null))['then'](respondWithResult(_0x45fc97,null))[_0x740f('0x48')](handleError(_0x45fc97,null));};exports[_0x740f('0x4c')]=function(_0x563c1d,_0x4a0276){return db[_0x740f('0x31')][_0x740f('0x4c')](_0x563c1d['body'],{})['then'](respondWithResult(_0x4a0276,0xc9))['catch'](handleError(_0x4a0276,null));};exports[_0x740f('0x21')]=function(_0x28075f,_0x4af8e3){if(_0x28075f[_0x740f('0x29')]['id']){delete _0x28075f[_0x740f('0x29')]['id'];}return db[_0x740f('0x31')][_0x740f('0x4b')]({'where':{'id':_0x28075f['params']['id']}})[_0x740f('0x22')](handleEntityNotFound(_0x4af8e3,null))[_0x740f('0x22')](saveUpdates(_0x28075f[_0x740f('0x29')],null))[_0x740f('0x22')](respondWithResult(_0x4af8e3,null))[_0x740f('0x48')](handleError(_0x4af8e3,null));};exports['destroy']=function(_0xdde2ba,_0xc79d52){return db[_0x740f('0x31')][_0x740f('0x4b')]({'where':{'id':_0xdde2ba[_0x740f('0x4d')]['id']}})[_0x740f('0x22')](handleEntityNotFound(_0xc79d52,null))[_0x740f('0x22')](removeEntity(_0xc79d52,null))[_0x740f('0x48')](handleError(_0xc79d52,null));};exports[_0x740f('0x4e')]=function(_0x43d3b0,_0x1f0d88){return db['ChatQueueReport'][_0x740f('0x4e')]()[_0x740f('0x22')](respondWithResult(_0x1f0d88,null))[_0x740f('0x48')](handleError(_0x1f0d88,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index f32b8c0..45e718f 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 _0x61dd=['report_chat_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport'];(function(_0x2606bd,_0x3148ea){var _0x1b6f75=function(_0x23f433){while(--_0x23f433){_0x2606bd['push'](_0x2606bd['shift']());}};_0x1b6f75(++_0x3148ea);}(_0x61dd,0x15b));var _0xd61d=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x61dd[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0xd61d('0x0'));var util=require(_0xd61d('0x1'));var logger=require(_0xd61d('0x2'))(_0xd61d('0x3'));var moment=require(_0xd61d('0x4'));var BPromise=require(_0xd61d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd61d('0x6'));var rimraf=require(_0xd61d('0x7'));var config=require(_0xd61d('0x8'));var attributes=require(_0xd61d('0x9'));module[_0xd61d('0xa')]=function(_0x2795dd,_0x3fa6ff){return _0x2795dd[_0xd61d('0xb')](_0xd61d('0xc'),attributes,{'tableName':_0xd61d('0xd'),'paranoid':![],'indexes':[{'name':_0xd61d('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x90e6=['request-promise','path','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x90e6,0x16f));var _0x690e=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0x90e6[_0x4347ec];return _0x4c8314;};'use strict';var _=require(_0x690e('0x0'));var util=require(_0x690e('0x1'));var logger=require(_0x690e('0x2'))('api');var moment=require(_0x690e('0x3'));var BPromise=require(_0x690e('0x4'));var rp=require(_0x690e('0x5'));var fs=require('fs');var path=require(_0x690e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x690e('0x7'));module[_0x690e('0x8')]=function(_0xbcc6f7,_0x565dc6){return _0xbcc6f7[_0x690e('0x9')]('ChatQueueReport',attributes,{'tableName':_0x690e('0xa'),'paranoid':![],'indexes':[{'name':_0x690e('0xb'),'fields':[_0x690e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 817c526..38ee76f 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 _0xf6f4=['info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CreateChatQueueReport','create','body','options','catch','UpdateChatQueueReport','ChatQueueReport','where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0xf6f4,0xd3));var _0x4f6f=function(_0x1a48d2,_0x52ef8c){_0x1a48d2=_0x1a48d2-0x0;var _0x33810e=_0xf6f4[_0x1a48d2];return _0x33810e;};'use strict';var _=require(_0x4f6f('0x0'));var util=require('util');var moment=require(_0x4f6f('0x1'));var BPromise=require(_0x4f6f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f6f('0x3'));var db=require(_0x4f6f('0x4'))['db'];var utils=require(_0x4f6f('0x5'));var logger=require(_0x4f6f('0x6'))('rpc');var config=require(_0x4f6f('0x7'));var jayson=require(_0x4f6f('0x8'));var client=jayson[_0x4f6f('0x9')][_0x4f6f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d289b,_0x60f044,_0x5caf71){return new BPromise(function(_0x1389e8,_0x460cd8){return client[_0x4f6f('0xb')](_0x3d289b,_0x5caf71)[_0x4f6f('0xc')](function(_0x2f4922){logger[_0x4f6f('0xd')](_0x4f6f('0xe'),_0x60f044,'request\x20sent');logger[_0x4f6f('0xf')](_0x4f6f('0x10'),_0x60f044,_0x4f6f('0x11'),JSON[_0x4f6f('0x12')](_0x2f4922));if(_0x2f4922[_0x4f6f('0x13')]){if(_0x2f4922['error'][_0x4f6f('0x14')]===0x1f4){logger[_0x4f6f('0x13')](_0x4f6f('0xe'),_0x60f044,_0x2f4922['error'][_0x4f6f('0x15')]);return _0x460cd8(_0x2f4922[_0x4f6f('0x13')][_0x4f6f('0x15')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x60f044,_0x2f4922[_0x4f6f('0x13')][_0x4f6f('0x15')]);return _0x1389e8(_0x2f4922['error'][_0x4f6f('0x15')]);}else{logger['info'](_0x4f6f('0xe'),_0x60f044,_0x4f6f('0x11'));_0x1389e8(_0x2f4922['result'][_0x4f6f('0x15')]);}})['catch'](function(_0x2644aa){logger[_0x4f6f('0x13')](_0x4f6f('0xe'),_0x60f044,_0x2644aa);_0x460cd8(_0x2644aa);});});}exports[_0x4f6f('0x16')]=function(_0x46fb77){var _0x495699=this;return new Promise(function(_0x301b50,_0x471306){return db['ChatQueueReport'][_0x4f6f('0x17')](_0x46fb77[_0x4f6f('0x18')],{'raw':_0x46fb77[_0x4f6f('0x19')]?_0x46fb77[_0x4f6f('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x4f6f('0xc')](function(_0x538ad3){logger[_0x4f6f('0xd')](_0x4f6f('0x16'),_0x46fb77);logger[_0x4f6f('0xf')](_0x4f6f('0x16'),_0x46fb77,JSON['stringify'](_0x538ad3));_0x301b50(_0x538ad3);})[_0x4f6f('0x1a')](function(_0x56c51d){logger[_0x4f6f('0x13')](_0x4f6f('0x16'),_0x56c51d[_0x4f6f('0x15')],_0x46fb77);_0x471306(_0x495699[_0x4f6f('0x13')](0x1f4,_0x56c51d[_0x4f6f('0x15')]));});});};exports[_0x4f6f('0x1b')]=function(_0x468332){var _0x20c9aa=this;return new Promise(function(_0xb937ec,_0x5ce8b4){return db[_0x4f6f('0x1c')]['update'](_0x468332[_0x4f6f('0x18')],{'raw':_0x468332[_0x4f6f('0x19')]?_0x468332[_0x4f6f('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x468332['options']?_0x468332['options'][_0x4f6f('0x1d')]||null:null,'attributes':_0x468332[_0x4f6f('0x19')]?_0x468332[_0x4f6f('0x19')][_0x4f6f('0x1e')]||null:null,'limit':_0x468332['options']?_0x468332[_0x4f6f('0x19')][_0x4f6f('0x1f')]||null:null})[_0x4f6f('0xc')](function(_0x24c15a){logger[_0x4f6f('0xd')](_0x4f6f('0x1b'),_0x468332);logger[_0x4f6f('0xf')](_0x4f6f('0x1b'),_0x468332,JSON[_0x4f6f('0x12')](_0x24c15a));_0xb937ec(_0x24c15a);})[_0x4f6f('0x1a')](function(_0x20ef0a){logger[_0x4f6f('0x13')](_0x4f6f('0x1b'),_0x20ef0a['message'],_0x468332);_0x5ce8b4(_0x20c9aa[_0x4f6f('0x13')](0x1f4,_0x20ef0a[_0x4f6f('0x15')]));});});}; \ No newline at end of file +var _0x7757=['then','debug','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','CreateChatQueueReport','body','options','UpdateChatQueueReport','ChatQueueReport','raw','where'];(function(_0x55a440,_0x5dacbc){var _0x1561b9=function(_0x92ebd4){while(--_0x92ebd4){_0x55a440['push'](_0x55a440['shift']());}};_0x1561b9(++_0x5dacbc);}(_0x7757,0xe2));var _0x7775=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x7757[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x7775('0x0'));var util=require('util');var moment=require(_0x7775('0x1'));var BPromise=require(_0x7775('0x2'));var rs=require(_0x7775('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7775('0x4'));var logger=require(_0x7775('0x5'))(_0x7775('0x6'));var config=require(_0x7775('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7775('0x8')][_0x7775('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52cc6f,_0x2c69d1,_0x28ea3a){return new BPromise(function(_0x61c4b1,_0x29fb5d){return client[_0x7775('0xa')](_0x52cc6f,_0x28ea3a)['then'](function(_0xd1c098){logger['info'](_0x7775('0xb'),_0x2c69d1,'request\x20sent');logger['debug'](_0x7775('0xc'),_0x2c69d1,_0x7775('0xd'),JSON[_0x7775('0xe')](_0xd1c098));if(_0xd1c098[_0x7775('0xf')]){if(_0xd1c098[_0x7775('0xf')]['code']===0x1f4){logger[_0x7775('0xf')](_0x7775('0xb'),_0x2c69d1,_0xd1c098[_0x7775('0xf')]['message']);return _0x29fb5d(_0xd1c098[_0x7775('0xf')][_0x7775('0x10')]);}logger[_0x7775('0xf')](_0x7775('0xb'),_0x2c69d1,_0xd1c098[_0x7775('0xf')][_0x7775('0x10')]);return _0x61c4b1(_0xd1c098[_0x7775('0xf')][_0x7775('0x10')]);}else{logger[_0x7775('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x2c69d1,_0x7775('0xd'));_0x61c4b1(_0xd1c098['result']['message']);}})[_0x7775('0x12')](function(_0x5cef87){logger[_0x7775('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x2c69d1,_0x5cef87);_0x29fb5d(_0x5cef87);});});}exports[_0x7775('0x13')]=function(_0xcca1d2){var _0x3707fb=this;return new Promise(function(_0x15c096,_0xd72e64){return db['ChatQueueReport']['create'](_0xcca1d2[_0x7775('0x14')],{'raw':_0xcca1d2[_0x7775('0x15')]?_0xcca1d2['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0xfe320e){logger[_0x7775('0x11')]('CreateChatQueueReport',_0xcca1d2);logger['debug'](_0x7775('0x13'),_0xcca1d2,JSON['stringify'](_0xfe320e));_0x15c096(_0xfe320e);})[_0x7775('0x12')](function(_0x37fbe7){logger[_0x7775('0xf')](_0x7775('0x13'),_0x37fbe7[_0x7775('0x10')],_0xcca1d2);_0xd72e64(_0x3707fb[_0x7775('0xf')](0x1f4,_0x37fbe7['message']));});});};exports[_0x7775('0x16')]=function(_0x48415e){var _0x2466c0=this;return new Promise(function(_0x10ece7,_0x4cbe6b){return db[_0x7775('0x17')]['update'](_0x48415e[_0x7775('0x14')],{'raw':_0x48415e['options']?_0x48415e['options'][_0x7775('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48415e[_0x7775('0x15')]?_0x48415e[_0x7775('0x15')][_0x7775('0x19')]||null:null,'attributes':_0x48415e[_0x7775('0x15')]?_0x48415e['options']['attributes']||null:null,'limit':_0x48415e[_0x7775('0x15')]?_0x48415e[_0x7775('0x15')]['limit']||null:null})[_0x7775('0x1a')](function(_0x3b5ccb){logger[_0x7775('0x11')]('UpdateChatQueueReport',_0x48415e);logger[_0x7775('0x1b')](_0x7775('0x16'),_0x48415e,JSON[_0x7775('0xe')](_0x3b5ccb));_0x10ece7(_0x3b5ccb);})[_0x7775('0x12')](function(_0x503455){logger[_0x7775('0xf')](_0x7775('0x16'),_0x503455['message'],_0x48415e);_0x4cbe6b(_0x2466c0[_0x7775('0xf')](0x1f4,_0x503455[_0x7775('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index c2b4399..0874635 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 _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x1b84a0,_0x302905){var _0x4f2598=function(_0x28e6cd){while(--_0x28e6cd){_0x1b84a0['push'](_0x1b84a0['shift']());}};_0x4f2598(++_0x302905);}(_0x2ef3,0xba));var _0x32ef=function(_0x10d83b,_0x3e01a8){_0x10d83b=_0x10d83b-0x0;var _0x2a1f0f=_0x2ef3[_0x10d83b];return _0x2a1f0f;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file +var _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xdb28,0x106));var _0x8db2=function(_0x65141,_0xb291ca){_0x65141=_0x65141-0x0;var _0xe1e385=_0xdb28[_0x65141];return _0xe1e385;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./chatQueueReport.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post']('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x11')]);router['delete'](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index ee656f5..89cd4b5 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 _0xa2c7=['sequelize','exports','STRING','account','agent','queue','DATE','moment'];(function(_0x5cb3dd,_0x539d1c){var _0x246cd7=function(_0x2d6936){while(--_0x2d6936){_0x5cb3dd['push'](_0x5cb3dd['shift']());}};_0x246cd7(++_0x539d1c);}(_0xa2c7,0xc7));var _0x7a2c=function(_0x47e7dd,_0x51b041){_0x47e7dd=_0x47e7dd-0x0;var _0x38501f=_0xa2c7[_0x47e7dd];return _0x38501f;};'use strict';var moment=require(_0x7a2c('0x0'));var Sequelize=require(_0x7a2c('0x1'));module[_0x7a2c('0x2')]={'uniqueid':{'type':Sequelize[_0x7a2c('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7a2c('0x4'),_0x7a2c('0x5'),_0x7a2c('0x6')),'allowNull':![],'defaultValue':_0x7a2c('0x6')},'transferredAt':{'type':Sequelize[_0x7a2c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x359f=['sequelize','exports','STRING','ENUM','account','queue','DATE','moment'];(function(_0x24ec36,_0x2f4b4c){var _0x3c7dbf=function(_0x3f3f92){while(--_0x3f3f92){_0x24ec36['push'](_0x24ec36['shift']());}};_0x3c7dbf(++_0x2f4b4c);}(_0x359f,0x15f));var _0xf359=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x359f[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0xf359('0x0'));var Sequelize=require(_0xf359('0x1'));module[_0xf359('0x2')]={'uniqueid':{'type':Sequelize[_0xf359('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xf359('0x4')](_0xf359('0x5'),'agent',_0xf359('0x6')),'allowNull':![],'defaultValue':_0xf359('0x6')},'transferredAt':{'type':Sequelize[_0xf359('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 253ed7e..abe6926 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 _0x25cf=['findAll','catch','show','fields','find','create','body','params','describe','eml-format','rimraf','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','merge','contact','message','agent','interaction','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll'];(function(_0x3ffcc8,_0x4240e1){var _0x2e08e6=function(_0x11a031){while(--_0x11a031){_0x3ffcc8['push'](_0x3ffcc8['shift']());}};_0x2e08e6(++_0x4240e1);}(_0x25cf,0x13d));var _0xf25c=function(_0x3c8d87,_0x4f156a){_0x3c8d87=_0x3c8d87-0x0;var _0x42a735=_0x25cf[_0x3c8d87];return _0x42a735;};'use strict';var emlformat=require(_0xf25c('0x0'));var rimraf=require(_0xf25c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf25c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf25c('0x3'));var sox=require(_0xf25c('0x4'));var csv=require(_0xf25c('0x5'));var ejs=require(_0xf25c('0x6'));var fs=require('fs');var fs_extra=require(_0xf25c('0x7'));var _=require(_0xf25c('0x8'));var squel=require(_0xf25c('0x9'));var crypto=require(_0xf25c('0xa'));var jsforce=require(_0xf25c('0xb'));var deskjs=require(_0xf25c('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf25c('0xd'));var Papa=require(_0xf25c('0xe'));var Redis=require(_0xf25c('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf25c('0x10'));var hardwareService=require(_0xf25c('0x11'));var logger=require(_0xf25c('0x12'))('api');var utils=require(_0xf25c('0x13'));var config=require(_0xf25c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf25c('0x15'))['db'];function respondWithStatusCode(_0x307b22,_0x4740cb){_0x4740cb=_0x4740cb||0xcc;return function(_0x54ec35){if(_0x54ec35){return _0x307b22[_0xf25c('0x16')](_0x4740cb);}return _0x307b22['status'](_0x4740cb)['end']();};}function respondWithResult(_0x2ecf3a,_0x31e3df){_0x31e3df=_0x31e3df||0xc8;return function(_0x523056){if(_0x523056){return _0x2ecf3a[_0xf25c('0x17')](_0x31e3df)[_0xf25c('0x18')](_0x523056);}};}function respondWithFilteredResult(_0x24edc4,_0xc6a50f){return function(_0x3de250){if(_0x3de250){var _0x369ac8=typeof _0xc6a50f[_0xf25c('0x19')]===_0xf25c('0x1a')&&typeof _0xc6a50f[_0xf25c('0x1b')]==='undefined';var _0x40810c=_0x3de250[_0xf25c('0x1c')];var _0x5e9485=_0x369ac8?0x0:_0xc6a50f['offset'];var _0x3df263=_0x369ac8?_0x3de250[_0xf25c('0x1c')]:_0xc6a50f[_0xf25c('0x19')]+_0xc6a50f['limit'];var _0x5de757;if(_0x3df263>=_0x40810c){_0x3df263=_0x40810c;_0x5de757=0xc8;}else{_0x5de757=0xce;}_0x24edc4[_0xf25c('0x17')](_0x5de757);return _0x24edc4[_0xf25c('0x1d')](_0xf25c('0x1e'),_0x5e9485+'-'+_0x3df263+'/'+_0x40810c)[_0xf25c('0x18')](_0x3de250);}return null;};}function patchUpdates(_0x102778){return function(_0x1f0769){try{jsonpatch[_0xf25c('0x1f')](_0x1f0769,_0x102778,!![]);}catch(_0x1cfcf0){return BPromise['reject'](_0x1cfcf0);}return _0x1f0769[_0xf25c('0x20')]();};}function saveUpdates(_0x28a052,_0x5621a1){return function(_0x3305d9){if(_0x3305d9){return _0x3305d9[_0xf25c('0x21')](_0x28a052)[_0xf25c('0x22')](function(_0x52035f){return _0x52035f;});}return null;};}function removeEntity(_0x3727b1,_0x58c207){return function(_0x403761){if(_0x403761){return _0x403761[_0xf25c('0x23')]()[_0xf25c('0x22')](function(){_0x3727b1[_0xf25c('0x17')](0xcc)[_0xf25c('0x24')]();});}};}function handleEntityNotFound(_0xd1f419,_0xfc1ffc){return function(_0x555d51){if(!_0x555d51){_0xd1f419[_0xf25c('0x16')](0x194);}return _0x555d51;};}function handleError(_0x5cebe0,_0xc840d3){_0xc840d3=_0xc840d3||0x1f4;return function(_0x5b827c){logger[_0xf25c('0x25')](_0x5b827c['stack']);if(_0x5b827c[_0xf25c('0x26')]){delete _0x5b827c[_0xf25c('0x26')];}_0x5cebe0['status'](_0xc840d3)[_0xf25c('0x27')](_0x5b827c);};}function getMustacheRender(_0x12cdcb,_0x2b5733){return Mustache['render'](_0x12cdcb,_[_0xf25c('0x28')](_0x2b5733['body'],{'contact':_0x2b5733[_0xf25c('0x29')],'message':_0x2b5733[_0xf25c('0x2a')],'agent':_0x2b5733[_0xf25c('0x2b')],'interaction':_0x2b5733[_0xf25c('0x2c')],'account':_0x2b5733['account']}))||'';}exports[_0xf25c('0x2d')]=function(_0x11625e,_0x19c8ca){var _0x3b3fbc={},_0x184466={},_0x141faf={'count':0x0,'rows':[]};var _0x2ee97f=_[_0xf25c('0x2e')](db[_0xf25c('0x2f')][_0xf25c('0x30')],function(_0x372893){return{'name':_0x372893[_0xf25c('0x31')],'type':_0x372893[_0xf25c('0x32')][_0xf25c('0x33')]};});_0x184466[_0xf25c('0x34')]=_[_0xf25c('0x2e')](_0x2ee97f,_0xf25c('0x26'));_0x184466[_0xf25c('0x35')]=_[_0xf25c('0x36')](_0x11625e['query']);_0x184466[_0xf25c('0x37')]=_[_0xf25c('0x38')](_0x184466[_0xf25c('0x34')],_0x184466['query']);_0x3b3fbc[_0xf25c('0x39')]=_['intersection'](_0x184466[_0xf25c('0x34')],qs['fields'](_0x11625e[_0xf25c('0x35')]['fields']));_0x3b3fbc[_0xf25c('0x39')]=_0x3b3fbc['attributes'][_0xf25c('0x3a')]?_0x3b3fbc[_0xf25c('0x39')]:_0x184466['model'];if(!_0x11625e[_0xf25c('0x35')][_0xf25c('0x3b')](_0xf25c('0x3c'))){_0x3b3fbc[_0xf25c('0x1b')]=qs[_0xf25c('0x1b')](_0x11625e[_0xf25c('0x35')][_0xf25c('0x1b')]);_0x3b3fbc['offset']=qs['offset'](_0x11625e[_0xf25c('0x35')][_0xf25c('0x19')]);}_0x3b3fbc['order']=qs['sort'](_0x11625e[_0xf25c('0x35')][_0xf25c('0x3d')]);_0x3b3fbc[_0xf25c('0x3e')]=qs[_0xf25c('0x37')](_[_0xf25c('0x3f')](_0x11625e[_0xf25c('0x35')],_0x184466[_0xf25c('0x37')]),_0x2ee97f);if(_0x11625e[_0xf25c('0x35')][_0xf25c('0x40')]){_0x3b3fbc['where']=_['merge'](_0x3b3fbc[_0xf25c('0x3e')],{'$or':_[_0xf25c('0x2e')](_0x2ee97f,function(_0x2ba0d3){if(_0x2ba0d3[_0xf25c('0x32')]!==_0xf25c('0x41')){var _0x455631={};_0x455631[_0x2ba0d3['name']]={'$like':'%'+_0x11625e[_0xf25c('0x35')][_0xf25c('0x40')]+'%'};return _0x455631;}})});}_0x3b3fbc=_['merge']({},_0x3b3fbc,_0x11625e[_0xf25c('0x42')]);var _0x223f88={'where':_0x3b3fbc[_0xf25c('0x3e')]};return db[_0xf25c('0x2f')][_0xf25c('0x1c')](_0x223f88)[_0xf25c('0x22')](function(_0x3e87ef){_0x141faf[_0xf25c('0x1c')]=_0x3e87ef;if(_0x11625e[_0xf25c('0x35')][_0xf25c('0x43')]){_0x3b3fbc['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0xf25c('0x44')](_0x3b3fbc);})[_0xf25c('0x22')](function(_0x14193c){_0x141faf['rows']=_0x14193c;return _0x141faf;})[_0xf25c('0x22')](respondWithFilteredResult(_0x19c8ca,_0x3b3fbc))[_0xf25c('0x45')](handleError(_0x19c8ca,null));};exports[_0xf25c('0x46')]=function(_0xb134af,_0x131f07){var _0x5a8b91={'raw':!![],'where':{'id':_0xb134af['params']['id']}},_0x3ae071={};_0x3ae071['model']=_[_0xf25c('0x36')](db[_0xf25c('0x2f')]['rawAttributes']);_0x3ae071['query']=_[_0xf25c('0x36')](_0xb134af['query']);_0x3ae071[_0xf25c('0x37')]=_['intersection'](_0x3ae071[_0xf25c('0x34')],_0x3ae071[_0xf25c('0x35')]);_0x5a8b91[_0xf25c('0x39')]=_[_0xf25c('0x38')](_0x3ae071[_0xf25c('0x34')],qs[_0xf25c('0x47')](_0xb134af[_0xf25c('0x35')][_0xf25c('0x47')]));_0x5a8b91[_0xf25c('0x39')]=_0x5a8b91['attributes'][_0xf25c('0x3a')]?_0x5a8b91[_0xf25c('0x39')]:_0x3ae071[_0xf25c('0x34')];if(_0xb134af[_0xf25c('0x35')][_0xf25c('0x43')]){_0x5a8b91['include']=[{'all':!![]}];}_0x5a8b91=_[_0xf25c('0x28')]({},_0x5a8b91,_0xb134af['options']);return db[_0xf25c('0x2f')][_0xf25c('0x48')](_0x5a8b91)[_0xf25c('0x22')](handleEntityNotFound(_0x131f07,null))[_0xf25c('0x22')](respondWithResult(_0x131f07,null))[_0xf25c('0x45')](handleError(_0x131f07,null));};exports[_0xf25c('0x49')]=function(_0x196be6,_0x350309){return db[_0xf25c('0x2f')]['create'](_0x196be6[_0xf25c('0x4a')],{})[_0xf25c('0x22')](respondWithResult(_0x350309,0xc9))[_0xf25c('0x45')](handleError(_0x350309,null));};exports['update']=function(_0x284504,_0x591315){if(_0x284504[_0xf25c('0x4a')]['id']){delete _0x284504[_0xf25c('0x4a')]['id'];}return db[_0xf25c('0x2f')][_0xf25c('0x48')]({'where':{'id':_0x284504[_0xf25c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x591315,null))[_0xf25c('0x22')](saveUpdates(_0x284504[_0xf25c('0x4a')],null))[_0xf25c('0x22')](respondWithResult(_0x591315,null))['catch'](handleError(_0x591315,null));};exports[_0xf25c('0x23')]=function(_0x3c0bb2,_0x1d23f3){return db[_0xf25c('0x2f')][_0xf25c('0x48')]({'where':{'id':_0x3c0bb2[_0xf25c('0x4b')]['id']}})[_0xf25c('0x22')](handleEntityNotFound(_0x1d23f3,null))['then'](removeEntity(_0x1d23f3,null))[_0xf25c('0x45')](handleError(_0x1d23f3,null));};exports[_0xf25c('0x4c')]=function(_0x10fbc9,_0x35395a){return db[_0xf25c('0x2f')][_0xf25c('0x4c')]()['then'](respondWithResult(_0x35395a,null))['catch'](handleError(_0x35395a,null));}; \ No newline at end of file +var _0xf8a9=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','update','destroy','then','error','name','send','render','merge','body','contact','message','agent','interaction','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','limit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv'];(function(_0x18acf6,_0x3f096b){var _0x293a2e=function(_0x4b0d0b){while(--_0x4b0d0b){_0x18acf6['push'](_0x18acf6['shift']());}};_0x293a2e(++_0x3f096b);}(_0xf8a9,0xdf));var _0x9f8a=function(_0x2f4ac9,_0x95cf9c){_0x2f4ac9=_0x2f4ac9-0x0;var _0x161f38=_0xf8a9[_0x2f4ac9];return _0x161f38;};'use strict';var emlformat=require(_0x9f8a('0x0'));var rimraf=require(_0x9f8a('0x1'));var zipdir=require(_0x9f8a('0x2'));var jsonpatch=require(_0x9f8a('0x3'));var rp=require(_0x9f8a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9f8a('0x5'));var util=require(_0x9f8a('0x6'));var path=require(_0x9f8a('0x7'));var sox=require(_0x9f8a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f8a('0x9'));var squel=require(_0x9f8a('0xa'));var crypto=require('crypto');var jsforce=require(_0x9f8a('0xb'));var deskjs=require(_0x9f8a('0xc'));var toCsv=require(_0x9f8a('0xd'));var querystring=require(_0x9f8a('0xe'));var Papa=require(_0x9f8a('0xf'));var Redis=require(_0x9f8a('0x10'));var authService=require(_0x9f8a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9f8a('0x12'));var hardwareService=require(_0x9f8a('0x13'));var logger=require(_0x9f8a('0x14'))(_0x9f8a('0x15'));var utils=require(_0x9f8a('0x16'));var config=require(_0x9f8a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f8a('0x18'))['db'];function respondWithStatusCode(_0x3cfd22,_0x55c5de){_0x55c5de=_0x55c5de||0xcc;return function(_0x5cdb2b){if(_0x5cdb2b){return _0x3cfd22[_0x9f8a('0x19')](_0x55c5de);}return _0x3cfd22[_0x9f8a('0x1a')](_0x55c5de)[_0x9f8a('0x1b')]();};}function respondWithResult(_0xa4e754,_0x4e4528){_0x4e4528=_0x4e4528||0xc8;return function(_0x282454){if(_0x282454){return _0xa4e754[_0x9f8a('0x1a')](_0x4e4528)[_0x9f8a('0x1c')](_0x282454);}};}function respondWithFilteredResult(_0x3e3570,_0x5c42b9){return function(_0x4ec754){if(_0x4ec754){var _0x17e595=typeof _0x5c42b9['offset']===_0x9f8a('0x1d')&&typeof _0x5c42b9['limit']==='undefined';var _0x3b42ac=_0x4ec754[_0x9f8a('0x1e')];var _0x34004b=_0x17e595?0x0:_0x5c42b9[_0x9f8a('0x1f')];var _0x48fd64=_0x17e595?_0x4ec754['count']:_0x5c42b9['offset']+_0x5c42b9['limit'];var _0x4a1d0a;if(_0x48fd64>=_0x3b42ac){_0x48fd64=_0x3b42ac;_0x4a1d0a=0xc8;}else{_0x4a1d0a=0xce;}_0x3e3570[_0x9f8a('0x1a')](_0x4a1d0a);return _0x3e3570[_0x9f8a('0x20')]('Content-Range',_0x34004b+'-'+_0x48fd64+'/'+_0x3b42ac)[_0x9f8a('0x1c')](_0x4ec754);}return null;};}function patchUpdates(_0x1a10c3){return function(_0x5d3844){try{jsonpatch[_0x9f8a('0x21')](_0x5d3844,_0x1a10c3,!![]);}catch(_0x530f0c){return BPromise['reject'](_0x530f0c);}return _0x5d3844['save']();};}function saveUpdates(_0x4100d2,_0xc56de6){return function(_0xbb8055){if(_0xbb8055){return _0xbb8055[_0x9f8a('0x22')](_0x4100d2)['then'](function(_0x202a8d){return _0x202a8d;});}return null;};}function removeEntity(_0x4d4f7a,_0x1e7b96){return function(_0x2930d5){if(_0x2930d5){return _0x2930d5[_0x9f8a('0x23')]()[_0x9f8a('0x24')](function(){_0x4d4f7a[_0x9f8a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x397739,_0x4d4d0a){return function(_0x5105b3){if(!_0x5105b3){_0x397739['sendStatus'](0x194);}return _0x5105b3;};}function handleError(_0x37939b,_0x13753c){_0x13753c=_0x13753c||0x1f4;return function(_0x5a070c){logger[_0x9f8a('0x25')](_0x5a070c['stack']);if(_0x5a070c[_0x9f8a('0x26')]){delete _0x5a070c[_0x9f8a('0x26')];}_0x37939b[_0x9f8a('0x1a')](_0x13753c)[_0x9f8a('0x27')](_0x5a070c);};}function getMustacheRender(_0x29f7a2,_0x59320a){return Mustache[_0x9f8a('0x28')](_0x29f7a2,_[_0x9f8a('0x29')](_0x59320a[_0x9f8a('0x2a')],{'contact':_0x59320a[_0x9f8a('0x2b')],'message':_0x59320a[_0x9f8a('0x2c')],'agent':_0x59320a[_0x9f8a('0x2d')],'interaction':_0x59320a[_0x9f8a('0x2e')],'account':_0x59320a['account']}))||'';}exports[_0x9f8a('0x2f')]=function(_0x28fe45,_0x25ba96){var _0x2f5d34={},_0xa39e69={},_0x552e06={'count':0x0,'rows':[]};var _0x2f5aac=_[_0x9f8a('0x30')](db[_0x9f8a('0x31')][_0x9f8a('0x32')],function(_0x181eaf){return{'name':_0x181eaf[_0x9f8a('0x33')],'type':_0x181eaf[_0x9f8a('0x34')][_0x9f8a('0x35')]};});_0xa39e69[_0x9f8a('0x36')]=_['map'](_0x2f5aac,_0x9f8a('0x26'));_0xa39e69[_0x9f8a('0x37')]=_['keys'](_0x28fe45[_0x9f8a('0x37')]);_0xa39e69[_0x9f8a('0x38')]=_['intersection'](_0xa39e69[_0x9f8a('0x36')],_0xa39e69[_0x9f8a('0x37')]);_0x2f5d34[_0x9f8a('0x39')]=_[_0x9f8a('0x3a')](_0xa39e69['model'],qs[_0x9f8a('0x3b')](_0x28fe45[_0x9f8a('0x37')][_0x9f8a('0x3b')]));_0x2f5d34[_0x9f8a('0x39')]=_0x2f5d34['attributes']['length']?_0x2f5d34['attributes']:_0xa39e69[_0x9f8a('0x36')];if(!_0x28fe45[_0x9f8a('0x37')]['hasOwnProperty'](_0x9f8a('0x3c'))){_0x2f5d34[_0x9f8a('0x3d')]=qs[_0x9f8a('0x3d')](_0x28fe45[_0x9f8a('0x37')][_0x9f8a('0x3d')]);_0x2f5d34['offset']=qs[_0x9f8a('0x1f')](_0x28fe45[_0x9f8a('0x37')][_0x9f8a('0x1f')]);}_0x2f5d34['order']=qs[_0x9f8a('0x3e')](_0x28fe45['query'][_0x9f8a('0x3e')]);_0x2f5d34[_0x9f8a('0x3f')]=qs['filters'](_[_0x9f8a('0x40')](_0x28fe45[_0x9f8a('0x37')],_0xa39e69['filters']),_0x2f5aac);if(_0x28fe45[_0x9f8a('0x37')][_0x9f8a('0x41')]){_0x2f5d34[_0x9f8a('0x3f')]=_['merge'](_0x2f5d34[_0x9f8a('0x3f')],{'$or':_['map'](_0x2f5aac,function(_0x183e77){if(_0x183e77[_0x9f8a('0x34')]!==_0x9f8a('0x42')){var _0x292800={};_0x292800[_0x183e77['name']]={'$like':'%'+_0x28fe45[_0x9f8a('0x37')][_0x9f8a('0x41')]+'%'};return _0x292800;}})});}_0x2f5d34=_[_0x9f8a('0x29')]({},_0x2f5d34,_0x28fe45[_0x9f8a('0x43')]);var _0x168147={'where':_0x2f5d34[_0x9f8a('0x3f')]};return db[_0x9f8a('0x31')][_0x9f8a('0x1e')](_0x168147)[_0x9f8a('0x24')](function(_0x13b371){_0x552e06[_0x9f8a('0x1e')]=_0x13b371;if(_0x28fe45[_0x9f8a('0x37')][_0x9f8a('0x44')]){_0x2f5d34[_0x9f8a('0x45')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x9f8a('0x46')](_0x2f5d34);})['then'](function(_0x1d2a0e){_0x552e06[_0x9f8a('0x47')]=_0x1d2a0e;return _0x552e06;})[_0x9f8a('0x24')](respondWithFilteredResult(_0x25ba96,_0x2f5d34))['catch'](handleError(_0x25ba96,null));};exports[_0x9f8a('0x48')]=function(_0x37dc95,_0x4fa8ec){var _0x3447b0={'raw':!![],'where':{'id':_0x37dc95[_0x9f8a('0x49')]['id']}},_0x57b763={};_0x57b763['model']=_[_0x9f8a('0x4a')](db['ChatTransferReport'][_0x9f8a('0x32')]);_0x57b763[_0x9f8a('0x37')]=_['keys'](_0x37dc95[_0x9f8a('0x37')]);_0x57b763[_0x9f8a('0x38')]=_[_0x9f8a('0x3a')](_0x57b763['model'],_0x57b763['query']);_0x3447b0[_0x9f8a('0x39')]=_[_0x9f8a('0x3a')](_0x57b763[_0x9f8a('0x36')],qs[_0x9f8a('0x3b')](_0x37dc95['query']['fields']));_0x3447b0[_0x9f8a('0x39')]=_0x3447b0['attributes']['length']?_0x3447b0['attributes']:_0x57b763['model'];if(_0x37dc95['query'][_0x9f8a('0x44')]){_0x3447b0[_0x9f8a('0x45')]=[{'all':!![]}];}_0x3447b0=_[_0x9f8a('0x29')]({},_0x3447b0,_0x37dc95['options']);return db[_0x9f8a('0x31')][_0x9f8a('0x4b')](_0x3447b0)[_0x9f8a('0x24')](handleEntityNotFound(_0x4fa8ec,null))[_0x9f8a('0x24')](respondWithResult(_0x4fa8ec,null))[_0x9f8a('0x4c')](handleError(_0x4fa8ec,null));};exports[_0x9f8a('0x4d')]=function(_0xc8447c,_0x3ad8c2){return db['ChatTransferReport'][_0x9f8a('0x4d')](_0xc8447c[_0x9f8a('0x2a')],{})[_0x9f8a('0x24')](respondWithResult(_0x3ad8c2,0xc9))['catch'](handleError(_0x3ad8c2,null));};exports[_0x9f8a('0x22')]=function(_0x4947b3,_0xa0901d){if(_0x4947b3[_0x9f8a('0x2a')]['id']){delete _0x4947b3[_0x9f8a('0x2a')]['id'];}return db[_0x9f8a('0x31')]['find']({'where':{'id':_0x4947b3[_0x9f8a('0x49')]['id']}})[_0x9f8a('0x24')](handleEntityNotFound(_0xa0901d,null))[_0x9f8a('0x24')](saveUpdates(_0x4947b3[_0x9f8a('0x2a')],null))['then'](respondWithResult(_0xa0901d,null))[_0x9f8a('0x4c')](handleError(_0xa0901d,null));};exports[_0x9f8a('0x23')]=function(_0xea1e2e,_0x34e86f){return db[_0x9f8a('0x31')][_0x9f8a('0x4b')]({'where':{'id':_0xea1e2e[_0x9f8a('0x49')]['id']}})[_0x9f8a('0x24')](handleEntityNotFound(_0x34e86f,null))[_0x9f8a('0x24')](removeEntity(_0x34e86f,null))[_0x9f8a('0x4c')](handleError(_0x34e86f,null));};exports['describe']=function(_0x82b05e,_0x48c03b){return db[_0x9f8a('0x31')][_0x9f8a('0x4e')]()[_0x9f8a('0x24')](respondWithResult(_0x48c03b,null))[_0x9f8a('0x4c')](handleError(_0x48c03b,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 9363a15..a8a3586 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 _0xa24e=['define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatTransferReport.attributes','exports'];(function(_0x3ec0e2,_0x5d09a3){var _0x34ec43=function(_0x56fe6d){while(--_0x56fe6d){_0x3ec0e2['push'](_0x3ec0e2['shift']());}};_0x34ec43(++_0x5d09a3);}(_0xa24e,0x137));var _0xea24=function(_0x326668,_0x175cff){_0x326668=_0x326668-0x0;var _0x5aa8b5=_0xa24e[_0x326668];return _0x5aa8b5;};'use strict';var _=require(_0xea24('0x0'));var util=require(_0xea24('0x1'));var logger=require(_0xea24('0x2'))(_0xea24('0x3'));var moment=require(_0xea24('0x4'));var BPromise=require(_0xea24('0x5'));var rp=require(_0xea24('0x6'));var fs=require('fs');var path=require(_0xea24('0x7'));var rimraf=require(_0xea24('0x8'));var config=require('../../config/environment');var attributes=require(_0xea24('0x9'));module[_0xea24('0xa')]=function(_0x36b376,_0x2534a6){return _0x36b376[_0xea24('0xb')]('ChatTransferReport',attributes,{'tableName':_0xea24('0xc'),'paranoid':![],'indexes':[{'name':_0xea24('0xd'),'fields':[_0xea24('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c24=['bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x476b47,_0x392e2f){var _0x462261=function(_0x5b1565){while(--_0x5b1565){_0x476b47['push'](_0x476b47['shift']());}};_0x462261(++_0x392e2f);}(_0x9c24,0xc0));var _0x49c2=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x9c24[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x49c2('0x0'));var util=require(_0x49c2('0x1'));var logger=require(_0x49c2('0x2'))('api');var moment=require(_0x49c2('0x3'));var BPromise=require(_0x49c2('0x4'));var rp=require(_0x49c2('0x5'));var fs=require('fs');var path=require(_0x49c2('0x6'));var rimraf=require(_0x49c2('0x7'));var config=require(_0x49c2('0x8'));var attributes=require(_0x49c2('0x9'));module[_0x49c2('0xa')]=function(_0x3928ec,_0x4724cc){return _0x3928ec[_0x49c2('0xb')](_0x49c2('0xc'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x49c2('0xd'),'fields':[_0x49c2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 0eda75b..2d5a828 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 _0x3c00=['debug','request\x20sent','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info'];(function(_0x15ac79,_0x3aac89){var _0x4c7a46=function(_0x582f28){while(--_0x582f28){_0x15ac79['push'](_0x15ac79['shift']());}};_0x4c7a46(++_0x3aac89);}(_0x3c00,0x135));var _0x03c0=function(_0x5baff0,_0x451ef8){_0x5baff0=_0x5baff0-0x0;var _0x4acedd=_0x3c00[_0x5baff0];return _0x4acedd;};'use strict';var _=require(_0x03c0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x03c0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x03c0('0x2'));var db=require(_0x03c0('0x3'))['db'];var utils=require(_0x03c0('0x4'));var logger=require(_0x03c0('0x5'))(_0x03c0('0x6'));var config=require(_0x03c0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x03c0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d3119,_0xd8b568,_0x5a4a69){return new BPromise(function(_0x1b85c9,_0x3c6bfe){return client['request'](_0x1d3119,_0x5a4a69)[_0x03c0('0x9')](function(_0x2a923b){logger[_0x03c0('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0xd8b568,'request\x20sent');logger[_0x03c0('0xb')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xd8b568,_0x03c0('0xc'),JSON[_0x03c0('0xd')](_0x2a923b));if(_0x2a923b[_0x03c0('0xe')]){if(_0x2a923b[_0x03c0('0xe')][_0x03c0('0xf')]===0x1f4){logger[_0x03c0('0xe')](_0x03c0('0x10'),_0xd8b568,_0x2a923b[_0x03c0('0xe')][_0x03c0('0x11')]);return _0x3c6bfe(_0x2a923b[_0x03c0('0xe')][_0x03c0('0x11')]);}logger[_0x03c0('0xe')](_0x03c0('0x10'),_0xd8b568,_0x2a923b[_0x03c0('0xe')][_0x03c0('0x11')]);return _0x1b85c9(_0x2a923b[_0x03c0('0xe')][_0x03c0('0x11')]);}else{logger[_0x03c0('0xa')](_0x03c0('0x10'),_0xd8b568,'request\x20sent');_0x1b85c9(_0x2a923b[_0x03c0('0x12')][_0x03c0('0x11')]);}})[_0x03c0('0x13')](function(_0x4813f5){logger[_0x03c0('0xe')](_0x03c0('0x10'),_0xd8b568,_0x4813f5);_0x3c6bfe(_0x4813f5);});});} \ No newline at end of file +var _0x5aab=['http','request','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','ChatTransferReport,\x20%s,\x20%s','result','util','moment','bluebird','../../config/utils','../../config/logger','jayson/promise'];(function(_0x1fdb8e,_0x265786){var _0x128c00=function(_0x50f2d7){while(--_0x50f2d7){_0x1fdb8e['push'](_0x1fdb8e['shift']());}};_0x128c00(++_0x265786);}(_0x5aab,0x1da));var _0xb5aa=function(_0xde1b69,_0x12a058){_0xde1b69=_0xde1b69-0x0;var _0x50f18f=_0x5aab[_0xde1b69];return _0x50f18f;};'use strict';var _=require('lodash');var util=require(_0xb5aa('0x0'));var moment=require(_0xb5aa('0x1'));var BPromise=require(_0xb5aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb5aa('0x3'));var logger=require(_0xb5aa('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb5aa('0x5'));var client=jayson['client'][_0xb5aa('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x47cc59,_0x599a3e,_0x46e86a){return new BPromise(function(_0x4551bd,_0x25d0bd){return client[_0xb5aa('0x7')](_0x47cc59,_0x46e86a)['then'](function(_0x348a02){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x599a3e,_0xb5aa('0x8'));logger[_0xb5aa('0x9')](_0xb5aa('0xa'),_0x599a3e,_0xb5aa('0x8'),JSON['stringify'](_0x348a02));if(_0x348a02[_0xb5aa('0xb')]){if(_0x348a02[_0xb5aa('0xb')][_0xb5aa('0xc')]===0x1f4){logger[_0xb5aa('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x599a3e,_0x348a02[_0xb5aa('0xb')][_0xb5aa('0xd')]);return _0x25d0bd(_0x348a02[_0xb5aa('0xb')]['message']);}logger['error'](_0xb5aa('0xe'),_0x599a3e,_0x348a02[_0xb5aa('0xb')][_0xb5aa('0xd')]);return _0x4551bd(_0x348a02['error']['message']);}else{logger['info'](_0xb5aa('0xe'),_0x599a3e,'request\x20sent');_0x4551bd(_0x348a02[_0xb5aa('0xf')][_0xb5aa('0xd')]);}})['catch'](function(_0x463fe9){logger[_0xb5aa('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x599a3e,_0x463fe9);_0x25d0bd(_0x463fe9);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 6cd7659..0cfa27b 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 _0xb7fe=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update'];(function(_0x5dd63a,_0x5709b6){var _0x4b6fbe=function(_0x50d5a2){while(--_0x50d5a2){_0x5dd63a['push'](_0x5dd63a['shift']());}};_0x4b6fbe(++_0x5709b6);}(_0xb7fe,0x142));var _0xeb7f=function(_0xb1271e,_0x4cd506){_0xb1271e=_0xb1271e-0x0;var _0x45d761=_0xb7fe[_0xb1271e];return _0x45d761;};'use strict';var multer=require(_0xeb7f('0x0'));var util=require(_0xeb7f('0x1'));var path=require(_0xeb7f('0x2'));var timeout=require(_0xeb7f('0x3'));var express=require(_0xeb7f('0x4'));var router=express[_0xeb7f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xeb7f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeb7f('0x7'));router[_0xeb7f('0x8')]('/',auth[_0xeb7f('0x9')](),controller[_0xeb7f('0xa')]);router[_0xeb7f('0x8')](_0xeb7f('0xb'),auth[_0xeb7f('0x9')](),controller[_0xeb7f('0xc')]);router[_0xeb7f('0x8')](_0xeb7f('0xd'),auth[_0xeb7f('0x9')](),controller[_0xeb7f('0xe')]);router['post']('/',auth[_0xeb7f('0x9')](),controller[_0xeb7f('0xf')]);router[_0xeb7f('0x10')](_0xeb7f('0xd'),auth[_0xeb7f('0x9')](),controller[_0xeb7f('0x11')]);router['delete'](_0xeb7f('0xd'),auth[_0xeb7f('0x9')](),controller[_0xeb7f('0x12')]);module[_0xeb7f('0x13')]=router; \ No newline at end of file +var _0x8f5d=['exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','destroy'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0x8f5d,0x10b));var _0xd8f5=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x8f5d[_0x486f4a];return _0x135d99;};'use strict';var multer=require(_0xd8f5('0x0'));var util=require('util');var path=require(_0xd8f5('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f5('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd8f5('0x3'));var interaction=require(_0xd8f5('0x4'));var config=require(_0xd8f5('0x5'));var controller=require(_0xd8f5('0x6'));router[_0xd8f5('0x7')]('/',auth[_0xd8f5('0x8')](),controller[_0xd8f5('0x9')]);router[_0xd8f5('0x7')](_0xd8f5('0xa'),auth[_0xd8f5('0x8')](),controller[_0xd8f5('0xb')]);router[_0xd8f5('0x7')](_0xd8f5('0xc'),auth['isAuthenticated'](),controller[_0xd8f5('0xd')]);router[_0xd8f5('0xe')]('/',auth[_0xd8f5('0x8')](),controller[_0xd8f5('0xf')]);router['put'](_0xd8f5('0xc'),auth[_0xd8f5('0x8')](),controller[_0xd8f5('0x10')]);router['delete'](_0xd8f5('0xc'),auth[_0xd8f5('0x8')](),controller[_0xd8f5('0x11')]);module[_0xd8f5('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 57ff72c..b4a9bb5 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 _0x7cd5=['address','email','#011F6A','BOOLEAN','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Skip','ENUM','star','thumb','INTEGER','stringify','input','name','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','STRING'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7cd5,0x1d8));var _0x57cd=function(_0x54379d,_0x13880c){_0x54379d=_0x54379d-0x0;var _0x28a430=_0x7cd5[_0x54379d];return _0x28a430;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x57cd('0x0')],'allowNull':![]},'address':{'type':Sequelize[_0x57cd('0x0')],'allowNull':![],'unique':_0x57cd('0x1')},'description':{'type':Sequelize[_0x57cd('0x0')]},'mapKey':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':_0x57cd('0x2')},'mapKeyOffline':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':_0x57cd('0x2')},'key':{'type':Sequelize[_0x57cd('0x0')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x57cd('0x0')],'allowNull':![],'defaultValue':_0x57cd('0x3'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x57cd('0x0')],'allowNull':![],'defaultValue':_0x57cd('0x3'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x57cd('0x0')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x57cd('0x0')]},'animation':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0x57cd('0x5')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x57cd('0x6')},'start_chat_button':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':_0x57cd('0x7')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x57cd('0x8')},'header_offline':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':_0x57cd('0x9')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':_0x57cd('0xa')},'defaultWhiteLabel':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x57cd('0xb')]},'closingQuestion':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x57cd('0xc')},'formSubmitFailureMessage':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':_0x57cd('0xd')},'noteTitle':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':_0x57cd('0xe')},'placeholderMessage':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':_0x57cd('0x8')},'skipMessageButton':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':_0x57cd('0xf')},'conditionAgreement':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x57cd('0x10')](_0x57cd('0x11'),_0x57cd('0x12')),'defaultValue':_0x57cd('0x11')},'ratingStarsNumber':{'type':Sequelize[_0x57cd('0x13')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x57cd('0xb')],'defaultValue':function(){return JSON[_0x57cd('0x14')]({'items':[{'type':_0x57cd('0x15'),'variable':null,'config':{'placeholder':_0x57cd('0x16'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x57cd('0x15'),'props':{'title':_0x57cd('0x2'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x57cd('0x2')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x57cd('0x17'))?JSON[_0x57cd('0x18')](this[_0x57cd('0x19')](_0x57cd('0x17'))):{};},'set':function(_0x482ff1){return this[_0x57cd('0x1a')](_0x57cd('0x17'),JSON[_0x57cd('0x14')](_0x482ff1));}},'offlineForm':{'type':Sequelize[_0x57cd('0xb')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x57cd('0x15'),'props':{'title':_0x57cd('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0x57cd('0x2'),'type':_0x57cd('0x2')},'variable':null},{'type':_0x57cd('0x1b'),'config':{'placeholder':_0x57cd('0x1c')},'props':{'title':_0x57cd('0x1c'),'helpText':_0x57cd('0x1d')}}],'fromKey':0x0});},'get':function(){return this[_0x57cd('0x19')](_0x57cd('0x1e'))?JSON[_0x57cd('0x18')](this['getDataValue']('offlineForm')):{};},'set':function(_0xa69f42){return this[_0x57cd('0x1a')](_0x57cd('0x1e'),JSON[_0x57cd('0x14')](_0xa69f42));}},'token':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x57cd('0x0')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x57cd('0x0')]},'waitingTitle':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':_0x57cd('0x1f')},'offlineMessageBody':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':_0x57cd('0x20')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x57cd('0x21')},'skipUnmanaged':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':_0x57cd('0xf')},'sendUnmanaged':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':_0x57cd('0x8')},'enableCustomerAttachment':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x57cd('0xb')]},'showAgentAvatar':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x57cd('0x0')]},'notificationTemplate':{'type':Sequelize[_0x57cd('0xb')],'defaultValue':function(){return _0x57cd('0x22');}},'notificationSound':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':_0x57cd('0x23')},'waitForTheAssignedAgent':{'type':Sequelize[_0x57cd('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':_0x57cd('0x24')},'defaultTitle':{'type':Sequelize[_0x57cd('0x0')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x57cd('0x13')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x57cd('0x25'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x57cd('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x57cd('0x26')},'systemAvatar':{'type':Sequelize[_0x57cd('0xb')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x57cd('0x27')},'mandatoryDisposition':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':![],'comment':_0x57cd('0x28'),'set':function(_0x268542){if(!_0x268542)this[_0x57cd('0x1a')](_0x57cd('0x29'),null);this[_0x57cd('0x1a')](_0x57cd('0x2a'),_0x268542);}},'vidaooEscalation':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x57cd('0x0')],'defaultValue':![]},'vidaooTopic':{'type':Sequelize[_0x57cd('0x0')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x57cd('0x4')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x57cd('0xb')]}}; \ No newline at end of file +var _0x944e=['email','Agent','#011F6A','BOOLEAN','ENUM','rounded','Chat','Send','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','name','text','input','getDataValue','onlineForm','setDataValue','stringify','textarea','Comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING'];(function(_0x53f28d,_0x521c75){var _0x48858a=function(_0x3cae32){while(--_0x3cae32){_0x53f28d['push'](_0x53f28d['shift']());}};_0x48858a(++_0x521c75);}(_0x944e,0x89));var _0xe944=function(_0x11b8ae,_0x485fa8){_0x11b8ae=_0x11b8ae-0x0;var _0x35a448=_0x944e[_0x11b8ae];return _0x35a448;};'use strict';var Sequelize=require(_0xe944('0x0'));var rs=require(_0xe944('0x1'));module[_0xe944('0x2')]={'name':{'type':Sequelize[_0xe944('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xe944('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xe944('0x3')]},'mapKey':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0x4')},'key':{'type':Sequelize[_0xe944('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0x5')},'customerAlias':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe944('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe944('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xe944('0x3')]},'animation':{'type':Sequelize[_0xe944('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xe944('0x8')](_0xe944('0x9'),'squared'),'defaultValue':_0xe944('0x9')},'header_online':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0xa')},'offline_chat_button':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0xb')},'header_offline':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xe944('0xc')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xe944('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0xe944('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xe944('0xe')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xe944('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0x10')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xe944('0x11')},'noteTitle':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xe944('0x12')},'closingMessageButton':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0x13')},'conditionAgreement':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xe944('0x14')},'ratingType':{'type':Sequelize[_0xe944('0x8')](_0xe944('0x15'),_0xe944('0x16')),'defaultValue':_0xe944('0x15')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xe944('0x17'),'type':_0xe944('0x18'),'required':!![]},'props':{'title':_0xe944('0x17'),'helpText':''}},{'type':_0xe944('0x19'),'props':{'title':_0xe944('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xe944('0x4'),'type':_0xe944('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xe944('0x1a')](_0xe944('0x1b'))?JSON['parse'](this[_0xe944('0x1a')]('onlineForm')):{};},'set':function(_0x179c12){return this[_0xe944('0x1c')](_0xe944('0x1b'),JSON[_0xe944('0x1d')](_0x179c12));}},'offlineForm':{'type':Sequelize[_0xe944('0xe')],'defaultValue':function(){return JSON[_0xe944('0x1d')]({'items':[{'type':_0xe944('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xe944('0x4'),'type':_0xe944('0x4')},'variable':null},{'type':_0xe944('0x1e'),'config':{'placeholder':_0xe944('0x1f')},'props':{'title':_0xe944('0x1f'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xe944('0x1a')](_0xe944('0x20'))?JSON[_0xe944('0x21')](this['getDataValue'](_0xe944('0x20'))):{};},'set':function(_0xd95c57){return this['setDataValue'](_0xe944('0x20'),JSON[_0xe944('0x1d')](_0xd95c57));}},'token':{'type':Sequelize[_0xe944('0x3')],'defaultValue':function(){return rs[_0xe944('0x22')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xe944('0x3')]},'waitingTitle':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0x23')},'waitingMessage':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xe944('0x24')},'offlineMessageBody':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xe944('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xe944('0x13')},'sendUnmanaged':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xe944('0xe')],'defaultValue':function(){return _0xe944('0x25');}},'notificationSound':{'type':Sequelize[_0xe944('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xe944('0x26')},'verticalAlignment':{'type':Sequelize[_0xe944('0xc')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0x27')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xe944('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xe944('0xc')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xe944('0x3')],'allowNull':![],'defaultValue':_0xe944('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0x29')},'systemAvatar':{'type':Sequelize[_0xe944('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe944('0xc')],'comment':_0xe944('0x2a')},'mandatoryDisposition':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![],'comment':_0xe944('0x2b'),'set':function(_0x3a70d9){if(!_0x3a70d9)this[_0xe944('0x1c')]('mandatoryDispositionPauseId',null);this[_0xe944('0x1c')](_0xe944('0x2c'),_0x3a70d9);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xe944('0x3')],'defaultValue':![]},'vidaooTopic':{'type':Sequelize[_0xe944('0x3')],'allowNull':![],'defaultValue':_0xe944('0x2d')},'vidaooNote':{'type':Sequelize[_0xe944('0x3')],'defaultValue':function(){return _0xe944('0x2e');}},'vidaooMetadata':{'type':Sequelize[_0xe944('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index f74e06b..d27c252 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 _0xde19=['*,*,*,*','Start','startRouting','EventManager','notify','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','render','toPairs','offlineMessageBody','originalname','mimetype','server','files','attachments','offline-chat','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','email','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','getProactiveActions','getLicense','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.js','utf8','x-real-ip','remoteAddress','verticalAlignment','color_button','backgroundColor','addApplications','findAndCountAll','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','omit','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatWebsite.socket','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','end','offset','limit','undefined','count','set','Content-Range','apply','update','destroy','get','ChatWebsites','sendStatus','stack','name','send','merge','body','contact','agent','interaction','account','index','Pause','mandatoryDispositionPause','map','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','where','filters','pick','filter','type','VIRTUAL','options','ChatWebsite','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','nolimit','sort','ChatWebsiteId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addLogo','sitepic','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','isNil','existsSync','server/files/images/logos/','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','showCustomerAvatar','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','createdAt','difference','updatedAt','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','ChatApplication','Applications','applications','list','priority','asc','customerIp','first','x-forwarded-for','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','ContactId','spread','firstName','messageId','created','autoclose','push','close','unmanaged','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde19,0x18c));var _0x9de1=function(_0x101094,_0x5d3900){_0x101094=_0x101094-0x0;var _0x3d6d75=_0xde19[_0x101094];return _0x3d6d75;};'use strict';var emlformat=require(_0x9de1('0x0'));var rimraf=require(_0x9de1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9de1('0x2'));var rp=require(_0x9de1('0x3'));var moment=require(_0x9de1('0x4'));var BPromise=require(_0x9de1('0x5'));var Mustache=require(_0x9de1('0x6'));var util=require('util');var path=require(_0x9de1('0x7'));var sox=require(_0x9de1('0x8'));var csv=require(_0x9de1('0x9'));var ejs=require(_0x9de1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9de1('0xb'));var squel=require('squel');var crypto=require(_0x9de1('0xc'));var jsforce=require(_0x9de1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9de1('0x9'));var querystring=require('querystring');var Papa=require(_0x9de1('0xe'));var Redis=require(_0x9de1('0xf'));var authService=require(_0x9de1('0x10'));var qs=require(_0x9de1('0x11'));var as=require(_0x9de1('0x12'));var hardwareService=require(_0x9de1('0x13'));var logger=require(_0x9de1('0x14'))('api');var utils=require(_0x9de1('0x15'));var config=require(_0x9de1('0x16'));var licenseUtil=require(_0x9de1('0x17'));var db=require('../../mysqldb')['db'];config[_0x9de1('0x18')]=_[_0x9de1('0x19')](config[_0x9de1('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x9de1('0x1a'))(new Redis(config['redis']));require(_0x9de1('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9de1('0x1c')][_0x9de1('0x1d')]({'port':0x232c});var client9002=jayson[_0x9de1('0x1c')][_0x9de1('0x1d')]({'port':0x232a});var client9003=jayson[_0x9de1('0x1c')][_0x9de1('0x1d')]({'port':0x232b});var client9001=jayson[_0x9de1('0x1c')][_0x9de1('0x1d')]({'port':0x2329});function respondWithRpcPromise(_0x2bb18a,_0x3f5d94,_0x27a6f5,_0x522993){return new BPromise(function(_0x212328,_0x34a6b7){var _0x460e0c=_0x522993||client;return _0x460e0c['request'](_0x2bb18a,_0x27a6f5)[_0x9de1('0x1e')](function(_0x3f9d5e){logger[_0x9de1('0x1f')](_0x9de1('0x20'),_0x3f5d94,_0x9de1('0x21'));logger[_0x9de1('0x22')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3f5d94,_0x9de1('0x21'),JSON[_0x9de1('0x23')](_0x3f9d5e));if(_0x3f9d5e[_0x9de1('0x24')]){if(_0x3f9d5e['error'][_0x9de1('0x25')]===0x1f4){logger[_0x9de1('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x3f5d94,_0x3f9d5e['error']['message']);return _0x34a6b7(_0x3f9d5e[_0x9de1('0x24')][_0x9de1('0x26')]);}logger[_0x9de1('0x24')](_0x9de1('0x20'),_0x3f5d94,_0x3f9d5e[_0x9de1('0x24')][_0x9de1('0x26')]);return _0x212328(_0x3f9d5e[_0x9de1('0x24')][_0x9de1('0x26')]);}else{logger[_0x9de1('0x1f')](_0x9de1('0x20'),_0x3f5d94,_0x9de1('0x21'));_0x212328(_0x3f9d5e['result']['message']);}})[_0x9de1('0x27')](function(_0x20e798){logger[_0x9de1('0x24')](_0x9de1('0x20'),_0x3f5d94,_0x20e798);_0x34a6b7(_0x20e798);});});}function respondWithStatusCode(_0x4faa5c,_0x41030a){_0x41030a=_0x41030a||0xcc;return function(_0x357389){if(_0x357389){return _0x4faa5c['sendStatus'](_0x41030a);}return _0x4faa5c[_0x9de1('0x28')](_0x41030a)[_0x9de1('0x29')]();};}function respondWithResult(_0x5ced5e,_0x5e22f6){_0x5e22f6=_0x5e22f6||0xc8;return function(_0x301090){if(_0x301090){return _0x5ced5e[_0x9de1('0x28')](_0x5e22f6)['json'](_0x301090);}};}function respondWithFilteredResult(_0x5d28a8,_0x38da3f){return function(_0x311b3b){if(_0x311b3b){var _0x317423=typeof _0x38da3f[_0x9de1('0x2a')]==='undefined'&&typeof _0x38da3f[_0x9de1('0x2b')]===_0x9de1('0x2c');var _0x3690ea=_0x311b3b['count'];var _0x5b14f5=_0x317423?0x0:_0x38da3f['offset'];var _0x2273de=_0x317423?_0x311b3b[_0x9de1('0x2d')]:_0x38da3f[_0x9de1('0x2a')]+_0x38da3f['limit'];var _0x3ecdbc;if(_0x2273de>=_0x3690ea){_0x2273de=_0x3690ea;_0x3ecdbc=0xc8;}else{_0x3ecdbc=0xce;}_0x5d28a8['status'](_0x3ecdbc);return _0x5d28a8[_0x9de1('0x2e')](_0x9de1('0x2f'),_0x5b14f5+'-'+_0x2273de+'/'+_0x3690ea)['json'](_0x311b3b);}return null;};}function patchUpdates(_0x1c2048){return function(_0x417782){try{jsonpatch[_0x9de1('0x30')](_0x417782,_0x1c2048,!![]);}catch(_0x3147b4){return BPromise['reject'](_0x3147b4);}return _0x417782['save']();};}function saveUpdates(_0x31216d,_0x2a8814){return function(_0x4bc9f2){if(_0x4bc9f2){return _0x4bc9f2[_0x9de1('0x31')](_0x31216d)['then'](function(_0x32b6b8){return _0x32b6b8;});}return null;};}function removeEntity(_0x14e4ed,_0x22ee42){return function(_0x4998ec){if(_0x4998ec){return _0x4998ec[_0x9de1('0x32')]()[_0x9de1('0x1e')](function(){var _0x299ba2=_0x4998ec[_0x9de1('0x33')]({'plain':!![]});var _0x28cbb5=_0x9de1('0x34');return db['UserProfileResource']['destroy']({'where':{'type':_0x28cbb5,'resourceId':_0x299ba2['id']}})[_0x9de1('0x1e')](function(){return _0x4998ec;});})[_0x9de1('0x1e')](function(){_0x14e4ed[_0x9de1('0x28')](0xcc)[_0x9de1('0x29')]();});}};}function handleEntityNotFound(_0x46b356,_0x7148f7){return function(_0x31dc9a){if(!_0x31dc9a){_0x46b356[_0x9de1('0x35')](0x194);}return _0x31dc9a;};}function handleError(_0x192ea1,_0x4220dc){_0x4220dc=_0x4220dc||0x1f4;return function(_0x1d3991){logger[_0x9de1('0x24')](_0x1d3991[_0x9de1('0x36')]);if(_0x1d3991[_0x9de1('0x37')]){delete _0x1d3991[_0x9de1('0x37')];}_0x192ea1[_0x9de1('0x28')](_0x4220dc)[_0x9de1('0x38')](_0x1d3991);};}function getMustacheRender(_0x54d805,_0x5218d1){return Mustache['render'](_0x54d805,_[_0x9de1('0x39')](_0x5218d1[_0x9de1('0x3a')],{'contact':_0x5218d1[_0x9de1('0x3b')],'message':_0x5218d1[_0x9de1('0x26')],'agent':_0x5218d1[_0x9de1('0x3c')],'interaction':_0x5218d1[_0x9de1('0x3d')],'account':_0x5218d1[_0x9de1('0x3e')]}))||'';}exports[_0x9de1('0x3f')]=function(_0x1a8b08,_0x4f4d69){var _0x43ffe7={'include':[{'model':db[_0x9de1('0x40')],'as':_0x9de1('0x41')}]},_0x165c53={},_0x410b99={'count':0x0,'rows':[]};var _0x368085=_[_0x9de1('0x42')](db['ChatWebsite']['rawAttributes'],function(_0x11acd7){return{'name':_0x11acd7[_0x9de1('0x43')],'type':_0x11acd7['type'][_0x9de1('0x44')]};});_0x165c53[_0x9de1('0x45')]=_['map'](_0x368085,_0x9de1('0x37'));_0x165c53['query']=_[_0x9de1('0x46')](_0x1a8b08[_0x9de1('0x47')]);_0x165c53['filters']=_[_0x9de1('0x48')](_0x165c53[_0x9de1('0x45')],_0x165c53[_0x9de1('0x47')]);_0x43ffe7[_0x9de1('0x49')]=_[_0x9de1('0x48')](_0x165c53[_0x9de1('0x45')],qs['fields'](_0x1a8b08[_0x9de1('0x47')][_0x9de1('0x4a')]));_0x43ffe7['attributes']=_0x43ffe7[_0x9de1('0x49')][_0x9de1('0x4b')]?_0x43ffe7[_0x9de1('0x49')]:_0x165c53[_0x9de1('0x45')];if(!_0x1a8b08['query'][_0x9de1('0x4c')]('nolimit')){_0x43ffe7[_0x9de1('0x2b')]=qs[_0x9de1('0x2b')](_0x1a8b08[_0x9de1('0x47')][_0x9de1('0x2b')]);_0x43ffe7[_0x9de1('0x2a')]=qs[_0x9de1('0x2a')](_0x1a8b08[_0x9de1('0x47')]['offset']);}_0x43ffe7[_0x9de1('0x4d')]=qs['sort'](_0x1a8b08[_0x9de1('0x47')]['sort']);_0x43ffe7[_0x9de1('0x4e')]=qs[_0x9de1('0x4f')](_[_0x9de1('0x50')](_0x1a8b08[_0x9de1('0x47')],_0x165c53[_0x9de1('0x4f')]),_0x368085);if(_0x1a8b08[_0x9de1('0x47')][_0x9de1('0x51')]){_0x43ffe7[_0x9de1('0x4e')]=_['merge'](_0x43ffe7['where'],{'$or':_[_0x9de1('0x42')](_0x368085,function(_0x498927){if(_0x498927[_0x9de1('0x52')]!==_0x9de1('0x53')){var _0x40d7dc={};_0x40d7dc[_0x498927[_0x9de1('0x37')]]={'$like':'%'+_0x1a8b08['query'][_0x9de1('0x51')]+'%'};return _0x40d7dc;}})});}_0x43ffe7=_[_0x9de1('0x39')]({},_0x43ffe7,_0x1a8b08[_0x9de1('0x54')]);var _0x3258a1={'where':_0x43ffe7['where']};return db[_0x9de1('0x55')]['count'](_0x3258a1)[_0x9de1('0x1e')](function(_0x59bbf2){_0x410b99['count']=_0x59bbf2;if(_0x1a8b08['query'][_0x9de1('0x56')]){_0x43ffe7[_0x9de1('0x57')]=[{'all':!![]}];}return db[_0x9de1('0x55')][_0x9de1('0x58')](_0x43ffe7);})[_0x9de1('0x1e')](function(_0x2a3c97){_0x410b99[_0x9de1('0x59')]=_0x2a3c97;return _0x410b99;})[_0x9de1('0x1e')](respondWithFilteredResult(_0x4f4d69,_0x43ffe7))['catch'](handleError(_0x4f4d69,null));};exports[_0x9de1('0x5a')]=function(_0x326920,_0x4425b0){var _0x49f8c8={'raw':![],'where':{'id':_0x326920[_0x9de1('0x5b')]['id']},'include':[{'model':db[_0x9de1('0x40')],'as':'mandatoryDispositionPause'}]},_0x1030fd={};_0x1030fd[_0x9de1('0x45')]=_[_0x9de1('0x46')](db[_0x9de1('0x55')][_0x9de1('0x5c')]);_0x1030fd[_0x9de1('0x47')]=_[_0x9de1('0x46')](_0x326920[_0x9de1('0x47')]);_0x1030fd['filters']=_[_0x9de1('0x48')](_0x1030fd[_0x9de1('0x45')],_0x1030fd[_0x9de1('0x47')]);_0x49f8c8[_0x9de1('0x49')]=_['intersection'](_0x1030fd[_0x9de1('0x45')],qs[_0x9de1('0x4a')](_0x326920['query'][_0x9de1('0x4a')]));_0x49f8c8[_0x9de1('0x49')]=_0x49f8c8[_0x9de1('0x49')][_0x9de1('0x4b')]?_0x49f8c8[_0x9de1('0x49')]:_0x1030fd[_0x9de1('0x45')];if(_0x326920['query'][_0x9de1('0x56')]){_0x49f8c8[_0x9de1('0x57')]=[{'all':!![]}];}_0x49f8c8=_[_0x9de1('0x39')]({},_0x49f8c8,_0x326920['options']);return db[_0x9de1('0x55')][_0x9de1('0x5d')](_0x49f8c8)['then'](handleEntityNotFound(_0x4425b0,null))[_0x9de1('0x1e')](respondWithResult(_0x4425b0,null))['catch'](handleError(_0x4425b0,null));};exports[_0x9de1('0x5e')]=function(_0x331733,_0x14cbd7){return db[_0x9de1('0x55')][_0x9de1('0x5e')](_0x331733['body'],{})['then'](function(_0x524c2a){var _0x38327=_0x331733[_0x9de1('0x5f')][_0x9de1('0x33')]({'plain':!![]});if(!_0x38327)throw new Error(_0x9de1('0x60'));if(_0x38327[_0x9de1('0x61')]==='user'){var _0x191d6a=_0x524c2a['get']({'plain':!![]});var _0x272fa6=_0x9de1('0x34');return db['UserProfileSection']['find']({'where':{'name':_0x272fa6,'userProfileId':_0x38327['userProfileId']},'raw':!![]})[_0x9de1('0x1e')](function(_0x206ea0){if(_0x206ea0&&_0x206ea0[_0x9de1('0x62')]===0x0){return db[_0x9de1('0x63')][_0x9de1('0x5e')]({'name':_0x191d6a[_0x9de1('0x37')],'resourceId':_0x191d6a['id'],'type':_0x206ea0[_0x9de1('0x37')],'sectionId':_0x206ea0['id']},{})[_0x9de1('0x1e')](function(){return _0x524c2a;});}else{return _0x524c2a;}})[_0x9de1('0x27')](function(_0x11ab76){logger[_0x9de1('0x24')](_0x9de1('0x64'),_0x11ab76);throw _0x11ab76;});}return _0x524c2a;})[_0x9de1('0x1e')](respondWithResult(_0x14cbd7,0xc9))[_0x9de1('0x27')](handleError(_0x14cbd7,null));};exports['update']=function(_0x4849d8,_0x5afa96){if(_0x4849d8['body']['id']){delete _0x4849d8[_0x9de1('0x3a')]['id'];}return db[_0x9de1('0x55')][_0x9de1('0x5d')]({'where':{'id':_0x4849d8['params']['id']},'include':[{'model':db[_0x9de1('0x40')],'as':_0x9de1('0x41')}]})[_0x9de1('0x1e')](handleEntityNotFound(_0x5afa96,null))['then'](saveUpdates(_0x4849d8[_0x9de1('0x3a')],null))[_0x9de1('0x1e')](respondWithResult(_0x5afa96,null))['catch'](handleError(_0x5afa96,null));};exports[_0x9de1('0x32')]=function(_0x211e74,_0x1f7d67){return db[_0x9de1('0x55')][_0x9de1('0x5d')]({'where':{'id':_0x211e74[_0x9de1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1f7d67,null))['then'](removeEntity(_0x1f7d67,null))[_0x9de1('0x27')](handleError(_0x1f7d67,null));};exports[_0x9de1('0x65')]=function(_0x53e017,_0x1a81ed){return db['ChatWebsite'][_0x9de1('0x65')]()[_0x9de1('0x1e')](respondWithResult(_0x1a81ed,null))[_0x9de1('0x27')](handleError(_0x1a81ed,null));};exports['addDisposition']=function(_0x250b2e,_0x227541,_0x54acf3){if(_0x250b2e[_0x9de1('0x3a')]['id']){delete _0x250b2e['body']['id'];}return db['ChatWebsite'][_0x9de1('0x5d')]({'where':{'id':_0x250b2e[_0x9de1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x227541,null))[_0x9de1('0x1e')](function(_0x3865fa){if(_0x3865fa){_0x250b2e[_0x9de1('0x3a')]['ChatWebsiteId']=_0x3865fa['id'];return db[_0x9de1('0x66')]['create'](_0x250b2e[_0x9de1('0x3a')]);}})[_0x9de1('0x1e')](respondWithResult(_0x227541,null))[_0x9de1('0x27')](handleError(_0x227541,null));};exports[_0x9de1('0x67')]=function(_0x47c97e,_0x231a9e,_0x1b3716){var _0xc75cd2={'raw':![],'where':{}};var _0x232b82={};var _0xf1914b={'count':0x0,'rows':[]};return db[_0x9de1('0x55')][_0x9de1('0x68')]({'where':{'id':_0x47c97e[_0x9de1('0x5b')]['id']}})[_0x9de1('0x1e')](handleEntityNotFound(_0x231a9e,null))['then'](function(_0x56e0ee){if(_0x56e0ee){_0x232b82[_0x9de1('0x45')]=_[_0x9de1('0x46')](db['Disposition'][_0x9de1('0x5c')]);_0x232b82[_0x9de1('0x47')]=_[_0x9de1('0x46')](_0x47c97e[_0x9de1('0x47')]);_0x232b82[_0x9de1('0x4f')]=_['intersection'](_0x232b82[_0x9de1('0x45')],_0x232b82[_0x9de1('0x47')]);_0xc75cd2[_0x9de1('0x49')]=_[_0x9de1('0x48')](_0x232b82[_0x9de1('0x45')],qs[_0x9de1('0x4a')](_0x47c97e[_0x9de1('0x47')][_0x9de1('0x4a')]));_0xc75cd2[_0x9de1('0x49')]=_0xc75cd2['attributes']['length']?_0xc75cd2[_0x9de1('0x49')]:_0x232b82[_0x9de1('0x45')];if(!_0x47c97e[_0x9de1('0x47')][_0x9de1('0x4c')](_0x9de1('0x69'))){_0xc75cd2[_0x9de1('0x2b')]=qs['limit'](_0x47c97e[_0x9de1('0x47')][_0x9de1('0x2b')]);_0xc75cd2[_0x9de1('0x2a')]=qs[_0x9de1('0x2a')](_0x47c97e[_0x9de1('0x47')][_0x9de1('0x2a')]);}_0xc75cd2[_0x9de1('0x4d')]=qs[_0x9de1('0x6a')](_0x47c97e[_0x9de1('0x47')]['sort']);_0xc75cd2['where']=qs[_0x9de1('0x4f')](_[_0x9de1('0x50')](_0x47c97e[_0x9de1('0x47')],_0x232b82[_0x9de1('0x4f')]));_0xc75cd2[_0x9de1('0x4e')][_0x9de1('0x6b')]=_0x56e0ee['id'];if(_0x47c97e['query'][_0x9de1('0x51')]){_0xc75cd2['where']=_[_0x9de1('0x39')](_0xc75cd2[_0x9de1('0x4e')],{'$or':_[_0x9de1('0x42')](_0xc75cd2['attributes'],function(_0x270ccf){var _0x5953f8={};_0x5953f8[_0x270ccf]={'$like':'%'+_0x47c97e[_0x9de1('0x47')][_0x9de1('0x51')]+'%'};return _0x5953f8;})});}_0xc75cd2=_[_0x9de1('0x39')]({},_0xc75cd2,_0x47c97e['options']);return db['Disposition']['count']({'where':_0xc75cd2['where']})['then'](function(_0x2d555e){_0xf1914b[_0x9de1('0x2d')]=_0x2d555e;if(_0x47c97e[_0x9de1('0x47')]['includeAll']){_0xc75cd2[_0x9de1('0x57')]=[{'all':!![]}];}return db[_0x9de1('0x66')]['findAll'](_0xc75cd2);})['then'](function(_0x2c3a17){_0xf1914b[_0x9de1('0x59')]=_0x2c3a17;return _0xf1914b;});}})[_0x9de1('0x1e')](respondWithFilteredResult(_0x231a9e,_0xc75cd2))[_0x9de1('0x27')](handleError(_0x231a9e,null));};exports[_0x9de1('0x6c')]=function(_0x4d5192,_0x48d2f5,_0xe3b00){return db[_0x9de1('0x55')][_0x9de1('0x5d')]({'where':{'id':_0x4d5192['params']['id']}})[_0x9de1('0x1e')](handleEntityNotFound(_0x48d2f5,null))[_0x9de1('0x1e')](function(_0x1a0233){if(_0x1a0233){return _0x1a0233[_0x9de1('0x6c')](_0x4d5192['query'][_0x9de1('0x6d')]);}})[_0x9de1('0x1e')](respondWithStatusCode(_0x48d2f5,null))[_0x9de1('0x27')](handleError(_0x48d2f5,null));};exports[_0x9de1('0x6e')]=function(_0x40929c,_0x43c9de,_0x1749bc){if(_0x40929c[_0x9de1('0x3a')]['id']){delete _0x40929c['body']['id'];}return db[_0x9de1('0x55')][_0x9de1('0x5d')]({'where':{'id':_0x40929c[_0x9de1('0x5b')]['id']}})[_0x9de1('0x1e')](handleEntityNotFound(_0x43c9de,null))['then'](function(_0x3ab1dc){if(_0x3ab1dc){_0x40929c[_0x9de1('0x3a')][_0x9de1('0x6b')]=_0x3ab1dc['id'];return db[_0x9de1('0x6f')]['create'](_0x40929c['body']);}})[_0x9de1('0x1e')](respondWithResult(_0x43c9de,null))['catch'](handleError(_0x43c9de,null));};exports['getAnswers']=function(_0x5b655b,_0x459b4e,_0x14d701){var _0x5b2fd9={'raw':![],'where':{}};var _0x191307={};var _0x1cfa7e={'count':0x0,'rows':[]};return db[_0x9de1('0x55')][_0x9de1('0x68')]({'where':{'id':_0x5b655b['params']['id']}})['then'](handleEntityNotFound(_0x459b4e,null))['then'](function(_0xa78954){if(_0xa78954){_0x191307[_0x9de1('0x45')]=_[_0x9de1('0x46')](db[_0x9de1('0x6f')][_0x9de1('0x5c')]);_0x191307['query']=_[_0x9de1('0x46')](_0x5b655b[_0x9de1('0x47')]);_0x191307[_0x9de1('0x4f')]=_[_0x9de1('0x48')](_0x191307['model'],_0x191307[_0x9de1('0x47')]);_0x5b2fd9[_0x9de1('0x49')]=_[_0x9de1('0x48')](_0x191307[_0x9de1('0x45')],qs[_0x9de1('0x4a')](_0x5b655b[_0x9de1('0x47')][_0x9de1('0x4a')]));_0x5b2fd9[_0x9de1('0x49')]=_0x5b2fd9[_0x9de1('0x49')]['length']?_0x5b2fd9['attributes']:_0x191307['model'];if(!_0x5b655b[_0x9de1('0x47')][_0x9de1('0x4c')](_0x9de1('0x69'))){_0x5b2fd9['limit']=qs['limit'](_0x5b655b[_0x9de1('0x47')][_0x9de1('0x2b')]);_0x5b2fd9[_0x9de1('0x2a')]=qs[_0x9de1('0x2a')](_0x5b655b['query']['offset']);}_0x5b2fd9[_0x9de1('0x4d')]=qs[_0x9de1('0x6a')](_0x5b655b[_0x9de1('0x47')][_0x9de1('0x6a')]);_0x5b2fd9[_0x9de1('0x4e')]=qs[_0x9de1('0x4f')](_['pick'](_0x5b655b[_0x9de1('0x47')],_0x191307[_0x9de1('0x4f')]));_0x5b2fd9[_0x9de1('0x4e')]['ChatWebsiteId']=_0xa78954['id'];if(_0x5b655b['query'][_0x9de1('0x51')]){_0x5b2fd9[_0x9de1('0x4e')]=_[_0x9de1('0x39')](_0x5b2fd9[_0x9de1('0x4e')],{'$or':_[_0x9de1('0x42')](_0x5b2fd9[_0x9de1('0x49')],function(_0x3e55c1){var _0x223dff={};_0x223dff[_0x3e55c1]={'$like':'%'+_0x5b655b[_0x9de1('0x47')][_0x9de1('0x51')]+'%'};return _0x223dff;})});}_0x5b2fd9=_['merge']({},_0x5b2fd9,_0x5b655b[_0x9de1('0x54')]);return db['CannedAnswer'][_0x9de1('0x2d')]({'where':_0x5b2fd9['where']})[_0x9de1('0x1e')](function(_0x9a2a33){_0x1cfa7e['count']=_0x9a2a33;if(_0x5b655b[_0x9de1('0x47')][_0x9de1('0x56')]){_0x5b2fd9['include']=[{'all':!![]}];}return db[_0x9de1('0x6f')][_0x9de1('0x58')](_0x5b2fd9);})[_0x9de1('0x1e')](function(_0x3912f3){_0x1cfa7e[_0x9de1('0x59')]=_0x3912f3;return _0x1cfa7e;});}})['then'](respondWithFilteredResult(_0x459b4e,_0x5b2fd9))[_0x9de1('0x27')](handleError(_0x459b4e,null));};exports['removeAnswers']=function(_0x228325,_0x314481,_0xd9efb){return db[_0x9de1('0x55')]['find']({'where':{'id':_0x228325[_0x9de1('0x5b')]['id']}})[_0x9de1('0x1e')](handleEntityNotFound(_0x314481,null))['then'](function(_0x324fbb){if(_0x324fbb){return _0x324fbb[_0x9de1('0x70')](_0x228325[_0x9de1('0x47')][_0x9de1('0x6d')]);}})[_0x9de1('0x1e')](respondWithStatusCode(_0x314481,null))[_0x9de1('0x27')](handleError(_0x314481,null));};exports[_0x9de1('0x71')]=function(_0x4ca159,_0x550b75,_0xb4a77c){_0x4ca159[_0x9de1('0x3a')][_0x9de1('0x72')]=_0x4ca159['file']['filename'];return db[_0x9de1('0x55')][_0x9de1('0x5d')]({'where':{'id':_0x4ca159[_0x9de1('0x5b')]['id']}})[_0x9de1('0x1e')](handleEntityNotFound(_0x550b75,null))[_0x9de1('0x1e')](saveUpdates(_0x4ca159[_0x9de1('0x3a')],null))[_0x9de1('0x1e')](respondWithResult(_0x550b75,null))['catch'](handleError(_0x550b75,null));};exports[_0x9de1('0x73')]=function(_0x26f849,_0x22efc2,_0xc355c8){_0x26f849[_0x9de1('0x3a')][_0x9de1('0x74')]=_0x26f849['file'][_0x9de1('0x75')];return db[_0x9de1('0x55')]['find']({'where':{'id':_0x26f849[_0x9de1('0x5b')]['id']}})[_0x9de1('0x1e')](handleEntityNotFound(_0x22efc2,null))[_0x9de1('0x1e')](saveUpdates(_0x26f849[_0x9de1('0x3a')],null))['then'](respondWithResult(_0x22efc2,null))['catch'](handleError(_0x22efc2,null));};exports[_0x9de1('0x76')]=function(_0x20740b,_0x26eaa0,_0x4f5c31){_0x20740b[_0x9de1('0x3a')][_0x9de1('0x77')]=_0x20740b['file'][_0x9de1('0x75')];return db['ChatWebsite']['find']({'where':{'id':_0x20740b[_0x9de1('0x5b')]['id']}})[_0x9de1('0x1e')](handleEntityNotFound(_0x26eaa0,null))['then'](saveUpdates(_0x20740b[_0x9de1('0x3a')],null))[_0x9de1('0x1e')](respondWithResult(_0x26eaa0,null))['catch'](handleError(_0x26eaa0,null));};exports[_0x9de1('0x78')]=function(_0x2806db,_0x38e675,_0x350034){_0x2806db['body'][_0x9de1('0x79')]=_0x2806db['file'][_0x9de1('0x75')];return db[_0x9de1('0x55')][_0x9de1('0x5d')]({'where':{'id':_0x2806db[_0x9de1('0x5b')]['id']}})[_0x9de1('0x1e')](handleEntityNotFound(_0x38e675,null))[_0x9de1('0x1e')](saveUpdates(_0x2806db[_0x9de1('0x3a')],null))[_0x9de1('0x1e')](respondWithResult(_0x38e675,null))[_0x9de1('0x27')](handleError(_0x38e675,null));};exports['getLogo']=function(_0x4b04bc,_0x4f635e,_0x5437bf){var _0x567daa=path[_0x9de1('0x7a')](config[_0x9de1('0x7b')],_0x9de1('0x7c'));var _0x507d37={'where':{'id':_0x4b04bc[_0x9de1('0x5b')]['id']},'attributes':['id',_0x9de1('0x72')],'raw':!![]};var _0x193955=![];return require(_0x9de1('0x17'))['getLicense']()['then'](function(_0x4661b7){if(_0x4661b7){_0x193955=_0x4661b7['custom'];}})[_0x9de1('0x1e')](function(){return db[_0x9de1('0x55')]['find'](_0x507d37);})['then'](handleEntityNotFound(_0x4f635e,null))[_0x9de1('0x1e')](function(_0x5add6d){if(_0x5add6d){if(!_[_0x9de1('0x7d')](_0x5add6d['sitepic'])){if(fs[_0x9de1('0x7e')](path[_0x9de1('0x7a')](config[_0x9de1('0x7b')],_0x9de1('0x7f'),_0x5add6d[_0x9de1('0x72')]))&&_0x193955){_0x567daa=path[_0x9de1('0x7a')](config[_0x9de1('0x7b')],'server/files/images/logos/',_0x5add6d[_0x9de1('0x72')]);}}return _0x4f635e['download'](_0x567daa);}})['catch'](handleError(_0x4f635e,null));};exports['getAvatar']=function(_0x28fc83,_0x30624e,_0x4a631b){var _0x4e209f=path[_0x9de1('0x7a')](config[_0x9de1('0x7b')],_0x9de1('0x80'));var _0x3642a4={'where':{'id':_0x28fc83['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x9de1('0x55')][_0x9de1('0x5d')](_0x3642a4)[_0x9de1('0x1e')](handleEntityNotFound(_0x30624e,null))[_0x9de1('0x1e')](function(_0x5d718b){if(_0x5d718b){if(!_[_0x9de1('0x7d')](_0x5d718b[_0x9de1('0x74')])){if(fs[_0x9de1('0x7e')](path['join'](config[_0x9de1('0x7b')],_0x9de1('0x81'),_0x5d718b[_0x9de1('0x74')]))){_0x4e209f=path['join'](config[_0x9de1('0x7b')],_0x9de1('0x81'),_0x5d718b[_0x9de1('0x74')]);}}return _0x30624e[_0x9de1('0x82')](_0x4e209f);}})[_0x9de1('0x27')](handleError(_0x30624e,null));};exports[_0x9de1('0x83')]=function(_0x11b992,_0x3a2308,_0x915de){var _0x55a6a7=path[_0x9de1('0x7a')](config[_0x9de1('0x7b')],'server/files/images/avatars/customer_avatar.png');var _0x3a02c8={'where':{'id':_0x11b992[_0x9de1('0x5b')]['id']},'attributes':['id',_0x9de1('0x77'),_0x9de1('0x84')],'raw':!![]};return db['ChatWebsite'][_0x9de1('0x5d')](_0x3a02c8)['then'](handleEntityNotFound(_0x3a2308,null))[_0x9de1('0x1e')](function(_0x3b9d4c){if(_0x3b9d4c){if(!_[_0x9de1('0x7d')](_0x3b9d4c[_0x9de1('0x77')])){if(fs['existsSync'](path['join'](config['root'],_0x9de1('0x81'),_0x3b9d4c[_0x9de1('0x77')]))&&_0x3b9d4c['showCustomerAvatar']){_0x55a6a7=path[_0x9de1('0x7a')](config[_0x9de1('0x7b')],_0x9de1('0x81'),_0x3b9d4c[_0x9de1('0x77')]);}}return _0x3a2308['download'](_0x55a6a7);}})['catch'](handleError(_0x3a2308,null));};exports['getSystemAvatar']=function(_0x44d093,_0x265aac,_0x4806ef){var _0x3e7de1=path[_0x9de1('0x7a')](config[_0x9de1('0x7b')],'server/files/images/avatars/system_avatar.png');var _0x4547e1={'where':{'id':_0x44d093['params']['id']},'attributes':['id',_0x9de1('0x79')],'raw':!![]};return db[_0x9de1('0x55')][_0x9de1('0x5d')](_0x4547e1)[_0x9de1('0x1e')](handleEntityNotFound(_0x265aac,null))[_0x9de1('0x1e')](function(_0x4b336e){if(_0x4b336e){if(!_[_0x9de1('0x7d')](_0x4b336e[_0x9de1('0x79')])){if(fs[_0x9de1('0x7e')](path[_0x9de1('0x7a')](config[_0x9de1('0x7b')],_0x9de1('0x81'),_0x4b336e[_0x9de1('0x79')]))){_0x3e7de1=path['join'](config[_0x9de1('0x7b')],_0x9de1('0x81'),_0x4b336e[_0x9de1('0x79')]);}}return _0x265aac[_0x9de1('0x82')](_0x3e7de1);}})['catch'](handleError(_0x265aac,null));};exports['notify']=function(_0x396490,_0x4de2d5,_0x49667f){var _0x26836c=require(_0x9de1('0x85'));var _0x59a0c3=new _0x26836c();var _0xfe959d=_0x59a0c3['setUA'](_0x396490[_0x9de1('0x86')][_0x9de1('0x87')])[_0x9de1('0x88')]();var _0x11fb60={'body':_0x396490[_0x9de1('0x3a')],'channel':_0x9de1('0x89')};var _0x9f4d06=[];var _0x30a7d3=[];var _0x2ad682={};var _0x44321f=![];return db[_0x9de1('0x8a')][_0x9de1('0x65')]()[_0x9de1('0x1e')](function(_0x4a0feb){if(!_0x4a0feb){throw new db[(_0x9de1('0x8b'))][(_0x9de1('0x8c'))]('no\x20available\x20attributes');}_0x9f4d06=_['difference'](_[_0x9de1('0x46')](_0x4a0feb),[_0x9de1('0x8d'),'updatedAt']);_0x30a7d3=_[_0x9de1('0x8e')](_[_0x9de1('0x46')](_0x4a0feb),['createdAt',_0x9de1('0x8f'),'CompanyId',_0x9de1('0x90')]);if(_0x396490[_0x9de1('0x3a')]['id']){delete _0x396490[_0x9de1('0x3a')]['id'];}if(_[_0x9de1('0x7d')](_0x396490[_0x9de1('0x3a')][_0x9de1('0x91')])){throw new db[(_0x9de1('0x8b'))][(_0x9de1('0x8c'))](_0x9de1('0x92'));}if(_[_0x9de1('0x7d')](_0x396490['body'][_0x9de1('0x3a')])||_0x396490['body']['body']===''){throw new db[(_0x9de1('0x8b'))]['ValidationError'](_0x9de1('0x93'));}if(_[_0x9de1('0x7d')](_0x396490[_0x9de1('0x3a')]['mapKey'])){throw new db[(_0x9de1('0x8b'))][(_0x9de1('0x8c'))](_0x9de1('0x94')+_0x30a7d3);}if(!_['includes'](_0x30a7d3,_0x396490['body'][_0x9de1('0x95')])){throw new db[(_0x9de1('0x8b'))]['ValidationError'](_0x9de1('0x96')+_0x30a7d3);}_0x2ad682[_0x396490[_0x9de1('0x3a')][_0x9de1('0x95')]]=_0x396490['body']['from'];})[_0x9de1('0x1e')](function(){return db[_0x9de1('0x55')]['find']({'where':{'id':_0x396490[_0x9de1('0x5b')]['id']},'include':[{'model':db[_0x9de1('0x97')],'as':_0x9de1('0x98'),'include':[{'model':db[_0x9de1('0x8a')],'as':_0x9de1('0x99'),'where':_0x2ad682,'limit':0x1,'order':[[_0x9de1('0x8f'),'DESC']]}]},{'model':db[_0x9de1('0x9a')],'as':_0x9de1('0x9b')}]});})[_0x9de1('0x1e')](handleEntityNotFound(_0x4de2d5,null))[_0x9de1('0x1e')](function(_0x36734f){if(_0x36734f&&_0x36734f[_0x9de1('0x98')]){_0x11fb60[_0x9de1('0x3e')]=_0x36734f;_0x11fb60[_0x9de1('0x9c')]=_0x36734f[_0x9de1('0x9b')];_0x11fb60[_0x9de1('0x9d')]=_0x36734f[_0x9de1('0x98')];_0x11fb60[_0x9de1('0x9c')]=_['orderBy'](_0x11fb60['applications'],[_0x9de1('0x9e')],[_0x9de1('0x9f')]);if(_0x11fb60[_0x9de1('0x3e')][_0x9de1('0x9b')]){delete _0x11fb60[_0x9de1('0x3e')][_0x9de1('0x9b')];}if(_0x11fb60['account'][_0x9de1('0x98')]&&_0x11fb60[_0x9de1('0x3e')]['List'][_0x9de1('0x99')]['length']){return _0x11fb60[_0x9de1('0x3e')]['List'][_0x9de1('0x99')][0x0];}var _0x472428=_[_0x9de1('0x19')](_0x396490[_0x9de1('0x3a')],{'firstName':_0x396490['body'][_0x9de1('0x91')],'ListId':_0x36734f[_0x9de1('0x90')]});_0x472428[_0x396490[_0x9de1('0x3a')][_0x9de1('0x95')]]=_0x396490[_0x9de1('0x3a')]['from'];return db[_0x9de1('0x8a')][_0x9de1('0x5e')](_0x472428,{'fields':_0x9f4d06,'raw':!![]});}})[_0x9de1('0x1e')](handleEntityNotFound(_0x4de2d5,null))[_0x9de1('0x1e')](function(_0x8f9b9b){_0x11fb60[_0x9de1('0x3b')]=_0x8f9b9b;var _0x229baf=_0x396490[_0x9de1('0x3a')][_0x9de1('0xa0')];if(_0x396490[_0x9de1('0x86')]['cf-connecting-ip']){_0x229baf=_0x396490[_0x9de1('0x86')]['cf-connecting-ip'];}else if(_0x396490[_0x9de1('0x86')]['x-forwarded-for']){_0x229baf=_[_0x9de1('0xa1')](_0x396490[_0x9de1('0x86')][_0x9de1('0xa2')]['split'](','));}if(_0x8f9b9b){var _0x3fe8eb={'ContactId':_0x8f9b9b['id'],'ChatWebsiteId':_0x396490['params']['id'],'from':(_0x8f9b9b['firstName']||'')+'\x20'+(_0x8f9b9b[_0x9de1('0xa3')]||''),'customerIp':_0x229baf,'customerPort':_0x396490[_0x9de1('0x86')][_0x9de1('0xa4')]?_0x396490[_0x9de1('0x86')][_0x9de1('0xa4')]:null,'referer':_0x396490[_0x9de1('0x3a')][_0x9de1('0xa5')],'browserName':_0xfe959d[_0x9de1('0xa6')]['name']&&_0xfe959d[_0x9de1('0xa6')][_0x9de1('0xa7')]?util['format'](_0x9de1('0xa8'),_0xfe959d[_0x9de1('0xa6')]['name'],_0xfe959d[_0x9de1('0xa6')]['version']):_0x9de1('0xa9'),'browserVersion':_0xfe959d[_0x9de1('0xa6')][_0x9de1('0xa7')]||'unknown','osName':util[_0x9de1('0xaa')]('%s\x20%s',_0xfe959d['os'][_0x9de1('0x37')],_0xfe959d['os'][_0x9de1('0xa7')]),'osVersion':_0xfe959d['os'][_0x9de1('0xa7')],'deviceModel':_0xfe959d[_0x9de1('0xab')][_0x9de1('0x45')]&&_0xfe959d[_0x9de1('0xab')][_0x9de1('0xac')]?util[_0x9de1('0xaa')](_0x9de1('0xad'),_0xfe959d['device'][_0x9de1('0x45')],_0xfe959d[_0x9de1('0xab')][_0x9de1('0xac')],_0xfe959d[_0x9de1('0xab')]['type']):null,'deviceVendor':_0xfe959d[_0x9de1('0xab')][_0x9de1('0xac')],'deviceType':_0xfe959d[_0x9de1('0xab')][_0x9de1('0x52')],'formData':JSON[_0x9de1('0x23')](_0x396490[_0x9de1('0x3a')])};var _0x3a49f8={'ChatWebsiteId':_0x396490['params']['id'],'closed':![]};if(_0x396490[_0x9de1('0x3a')][_0x9de1('0xae')]){_0x3a49f8[_0x9de1('0xae')]=_0x396490['body']['threadId'];return db[_0x9de1('0xaf')]['find']({'where':_0x3a49f8})[_0x9de1('0x1e')](function(_0x4b20fa){if(_0x4b20fa){return[_0x4b20fa,![]];}_0x3fe8eb[_0x9de1('0xae')]=_0x396490['body']['threadId'];_0x3fe8eb['externalUrl']=_0x396490['body']['externalUrl'];return db['ChatInteraction']['create'](_0x3fe8eb)[_0x9de1('0x1e')](function(_0x1d4444){return[_0x1d4444,!![]];});});}_0x3a49f8[_0x9de1('0xb0')]=_0x8f9b9b['id'];if(_0x396490[_0x9de1('0x3a')][_0x9de1('0x3d')]&&_0x396490['body'][_0x9de1('0x3d')]['id']){_0x3a49f8['id']=_0x396490[_0x9de1('0x3a')][_0x9de1('0x3d')]['id'];return db[_0x9de1('0xaf')][_0x9de1('0x5d')]({'where':_0x3a49f8})[_0x9de1('0x1e')](function(_0x539f6d){if(_0x539f6d){return[_0x539f6d,![]];}return db[_0x9de1('0xaf')]['create'](_0x3fe8eb)['then'](function(_0x14f3cf){return[_0x14f3cf,!![]];});});}return db[_0x9de1('0xaf')][_0x9de1('0x5e')](_0x3fe8eb)['then'](function(_0x34119d){return[_0x34119d,!![]];});}})[_0x9de1('0xb1')](function(_0x4a36e8,_0x123e64){if(_0x4a36e8){_0x44321f=_0x123e64;if(!_0x123e64){var _0x1a61b0={'from':(_0x11fb60[_0x9de1('0x3b')][_0x9de1('0xb2')]||'')+'\x20'+(_0x11fb60[_0x9de1('0x3b')]['lastName']||'')};if(_0x396490[_0x9de1('0x3a')][_0x9de1('0xae')]&&_0x396490['body'][_0x9de1('0xb3')]&&_0x396490[_0x9de1('0x3a')][_0x9de1('0xae')]!=_0x396490[_0x9de1('0x3a')][_0x9de1('0xb3')]){_0x1a61b0['threadId']=_0x396490['body'][_0x9de1('0xb3')];}return _0x4a36e8[_0x9de1('0x31')](_0x1a61b0);}else{return _0x4a36e8;}}})[_0x9de1('0x1e')](function(_0x558dd4){_0x11fb60['interaction']=_0x558dd4[_0x9de1('0x33')]({'plain':!![]});_0x11fb60['interaction'][_0x9de1('0xb4')]=_0x44321f;if(_0x11fb60[_0x9de1('0x3d')][_0x9de1('0xb4')]){if(_0x11fb60['account'][_0x9de1('0xb5')]){_0x11fb60['applications'][_0x9de1('0xb6')]({'id':0x0,'priority':_0x11fb60[_0x9de1('0x9c')][_0x9de1('0x4b')]+0x1,'app':_0x9de1('0xb7'),'appdata':_0x9de1('0xb8'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0x9de1('0x5e')]({'body':_0x396490[_0x9de1('0x3a')][_0x9de1('0x3a')],'ChatWebsiteId':_0x396490['params']['id'],'ChatInteractionId':_0x558dd4['id'],'direction':'in','ContactId':_0x11fb60[_0x9de1('0x3b')]['id'],'AttachmentId':_0x396490[_0x9de1('0x3a')][_0x9de1('0xb9')]});})[_0x9de1('0x1e')](function(_0x2da19a){_0x11fb60[_0x9de1('0x26')]=_0x2da19a;if(_0x11fb60[_0x9de1('0x3d')][_0x9de1('0xba')]){return db[_0x9de1('0xbb')][_0x9de1('0x5d')]({'attributes':['id',_0x9de1('0x37')],'where':{'id':_0x11fb60[_0x9de1('0x3d')]['UserId']}})[_0x9de1('0x1e')](function(_0x129265){if(_0x129265){_0x11fb60[_0x9de1('0x9c')][_0x9de1('0xbc')]({'id':0x0,'priority':0x0,'app':_0x9de1('0x3c'),'appdata':_0x129265[_0x9de1('0x37')]+','+(_0x11fb60[_0x9de1('0x3e')][_0x9de1('0xbd')]||0xa),'interval':_0x9de1('0xbe')});_0x11fb60['forcedOwnership']=!![];}return respondWithRpcPromise('Start','startRouting',_0x11fb60);});}return respondWithRpcPromise(_0x9de1('0xbf'),_0x9de1('0xc0'),_0x11fb60);})[_0x9de1('0x1e')](function(_0x50bf55){respondWithRpcPromise('EventManager',_0x9de1('0xc1'),{'event':_0x9de1('0xc2'),'message':_0x50bf55},client9002);return _0x50bf55;})[_0x9de1('0x1e')](respondWithResult(_0x4de2d5,null))[_0x9de1('0x27')](handleError(_0x4de2d5,null));};exports[_0x9de1('0xc3')]=function(_0x405cf4,_0x3af179,_0x4b201c){var _0x11389a,_0x268edd,_0x33a5f0;var _0x2bf668=[];var _0x2882c5=[];var _0x460df5={};var _0x2576f8=_0x405cf4['files']||[];var _0x31cfcb=[];var _0x3381cd;return db['CmContact']['describe']()[_0x9de1('0x1e')](function(_0x25fa06){if(!_0x25fa06){throw new db[(_0x9de1('0x8b'))][(_0x9de1('0x8c'))]('no\x20available\x20attributes');}_0x2882c5=_[_0x9de1('0x8e')](_[_0x9de1('0x46')](_0x25fa06),[_0x9de1('0x8d'),_0x9de1('0x8f')]);_0x2bf668=_[_0x9de1('0x8e')](_[_0x9de1('0x46')](_0x25fa06),[_0x9de1('0x8d'),_0x9de1('0x8f'),'CompanyId','ListId']);if(_0x405cf4['body']['id']){delete _0x405cf4[_0x9de1('0x3a')]['id'];}if(_[_0x9de1('0x7d')](_0x405cf4[_0x9de1('0x3a')]['from'])){throw _0x3af179['status'](0x1f4)['send'](new db['Sequelize'][(_0x9de1('0x8c'))](_0x9de1('0x92')));}if(_[_0x9de1('0x7d')](_0x405cf4[_0x9de1('0x3a')]['body'])||_0x405cf4[_0x9de1('0x3a')][_0x9de1('0x3a')]===''){throw _0x3af179[_0x9de1('0x28')](0x1f4)[_0x9de1('0x38')](new db[(_0x9de1('0x8b'))][(_0x9de1('0x8c'))](_0x9de1('0x93')));}if(_[_0x9de1('0x7d')](_0x405cf4[_0x9de1('0x3a')][_0x9de1('0xc4')])){throw _0x3af179[_0x9de1('0x28')](0x1f4)[_0x9de1('0x38')](new db[(_0x9de1('0x8b'))][(_0x9de1('0x8c'))](_0x9de1('0xc5')+_0x2bf668));}if(!_[_0x9de1('0xc6')](_0x2bf668,_0x405cf4['body'][_0x9de1('0xc4')])){throw _0x3af179[_0x9de1('0x28')](0x1f4)['send'](new db[(_0x9de1('0x8b'))][(_0x9de1('0x8c'))](_0x9de1('0xc7')+_0x2bf668));}_0x460df5[_0x405cf4[_0x9de1('0x3a')][_0x9de1('0xc4')]]=_0x405cf4[_0x9de1('0x3a')][_0x9de1('0x91')];})[_0x9de1('0x1e')](function(){return db[_0x9de1('0x55')][_0x9de1('0x5d')]({'where':{'id':_0x405cf4['params']['id']},'include':[{'model':db[_0x9de1('0x97')],'as':_0x9de1('0x98')},{'model':db[_0x9de1('0xc8')],'as':_0x9de1('0xc8')}]});})[_0x9de1('0x1e')](handleEntityNotFound(_0x3af179,null))[_0x9de1('0x1e')](function(_0x33ac11){if(_0x33ac11&&_0x33ac11['List']){_0x268edd=_0x33ac11;var _0x487b61=_[_0x9de1('0x19')](_0x405cf4[_0x9de1('0x3a')],{'firstName':_0x405cf4[_0x9de1('0x3a')][_0x9de1('0x91')],'phone':_0x405cf4[_0x9de1('0x3a')]['from'],'ListId':_0x33ac11[_0x9de1('0x90')]});_0x487b61[_0x405cf4['body'][_0x9de1('0xc4')]]=_0x405cf4[_0x9de1('0x3a')][_0x9de1('0x91')];return db[_0x9de1('0x8a')][_0x9de1('0xc9')]({'where':_0x460df5,'defaults':_0x487b61});}})['spread'](function(_0x2effbc){if(_0x2effbc){_0x33a5f0=_0x2effbc;var _0x5b2d6d=fs['readFileSync'](path[_0x9de1('0x7a')](config[_0x9de1('0x7b')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x322a0e=ejs[_0x9de1('0xca')](_0x5b2d6d,{'body':_[_0x9de1('0xcb')](_0x405cf4[_0x9de1('0x3a')][_0x9de1('0x3a')]),'bodyTitle':_0x268edd[_0x9de1('0xcc')]});return db['ChatOfflineMessage']['create']({'body':_0x322a0e,'ContactId':_0x2effbc['id'],'ChatWebsiteId':_0x268edd['id']});}})[_0x9de1('0x1e')](function(_0x6edccc){_0x3381cd=_0x6edccc;if(_0x2576f8[_0x9de1('0x4b')]){var _0x467e1b=_0x2576f8[_0x9de1('0x42')](function(_0x57c827){return{'name':_0x57c827[_0x9de1('0xcd')],'basename':_0x57c827['filename'],'type':_0x57c827[_0x9de1('0xce')],'ChatOfflineMessageId':_0x6edccc['id']};});_0x31cfcb=_0x467e1b[_0x9de1('0x42')](_0x3cb81b=>{var _0x5f5a19={'filename':_0x3cb81b[_0x9de1('0x37')],'path':path[_0x9de1('0x7a')](config['root'],_0x9de1('0xcf'),_0x9de1('0xd0'),_0x9de1('0xd1'),_0x9de1('0xd2'),_0x3cb81b['basename'])};return _0x5f5a19;});if(!_0x268edd[_0x9de1('0xd3')]){return db['sequelize'][_0x9de1('0xd4')](function(_0x2ea917){return db[_0x9de1('0xd5')][_0x9de1('0xd6')](_0x467e1b,{'transaction':_0x2ea917});});}}})[_0x9de1('0x1e')](function(){if(_0x3381cd){_0x11389a=_0x3381cd;return db[_0x9de1('0xc8')][_0x9de1('0x68')]({'where':{'active':!![]},'include':[{'model':db[_0x9de1('0xd7')],'as':_0x9de1('0xd8'),'raw':!![]}]});}})[_0x9de1('0x1e')](function(_0x2230d7){if(_0x2230d7&&_0x2230d7[_0x9de1('0xd8')]&&_0x268edd['forwardOffline']&&_0x268edd[_0x9de1('0xd9')]){var _0xf1ac59={'tls':{'rejectUnauthorized':![]}};if(_0x2230d7[_0x9de1('0xd8')][_0x9de1('0xda')]){_0xf1ac59[_0x9de1('0xda')]=_0x2230d7[_0x9de1('0xd8')][_0x9de1('0xda')];}else{_0xf1ac59[_0x9de1('0xdb')]=_0x2230d7[_0x9de1('0xd8')][_0x9de1('0xdb')];_0xf1ac59[_0x9de1('0xdc')]=_0x2230d7[_0x9de1('0xd8')][_0x9de1('0xdc')];_0xf1ac59[_0x9de1('0xdd')]=_0x2230d7[_0x9de1('0xd8')][_0x9de1('0xdd')];}if(_0x2230d7[_0x9de1('0xd8')][_0x9de1('0xde')]){_0xf1ac59[_0x9de1('0xdf')]={'user':_0x2230d7[_0x9de1('0xd8')][_0x9de1('0x5f')],'pass':_0x2230d7[_0x9de1('0xd8')][_0x9de1('0xe0')]};}return respondWithRpcPromise(_0x9de1('0xe1'),_0x9de1('0xe2'),{'account':_0xf1ac59,'message':{'from':util[_0x9de1('0xaa')]('\x22%s\x22\x20<%s>',_0x2230d7[_0x9de1('0x37')],_0x2230d7[_0x9de1('0xe3')]||_0x2230d7['Smtp'][_0x9de1('0x5f')]),'to':_0x268edd[_0x9de1('0xd9')],'subject':_0x268edd[_0x9de1('0xe4')],'html':_0x11389a[_0x9de1('0x3a')],'attachments':_0x31cfcb}},client9003)[_0x9de1('0x1e')](function(){return _0x11389a;})[_0x9de1('0x27')](function(_0x2b4250){console['error'](_0x2b4250);});}})[_0x9de1('0x1e')](function(){if(_0x268edd&&_0x268edd[_0x9de1('0xd3')]&&_0x268edd['MailAccountId']){var _0xb2570f=[];if(_0x2576f8['length']){_0xb2570f=_0x2576f8[_0x9de1('0x42')](function(_0x3b47b3){return{'name':_0x3b47b3[_0x9de1('0xcd')],'basename':_0x3b47b3[_0x9de1('0x75')],'type':_0x3b47b3['mimetype'],'ChatOfflineMessageId':_0x3381cd['id']};});}var _0xb58d57;if(!_[_0x9de1('0x7d')](_0x268edd[_0x9de1('0xe5')])){var _0xaccf10=_['map'](_0x405cf4['body'],function(_0x279131){return _0x279131;});var _0x50681f=_[_0x9de1('0xe6')](_0xaccf10)[0x0];var _0x3f2f2c=_[_0x9de1('0xe7')](_0x50681f,function(_0x564d43){return _0x564d43;});_0xb58d57=_0x3f2f2c[0x1][_0x268edd[_0x9de1('0xe5')]];}var _0x20f810={'from':_0x33a5f0['email'],'firstName':_0x33a5f0[_0x9de1('0xb2')],'lastName':_0x33a5f0['lastName'],'mapKey':_0x9de1('0xe3'),'message':{'from':_0x33a5f0['email'],'to':_0x268edd[_0x9de1('0xc8')][_0x9de1('0xe3')],'cc':'','subject':_[_0x9de1('0x7d')](_0xb58d57)?_0x268edd['offlineMessageSubject']:_0xb58d57,'messageId':'','sentAt':new Date(),'attach':_0xb2570f[_0x9de1('0x4b')],'attachments':_0xb2570f,'originChannel':'Chat','ChatWebsiteId':_0x268edd['id'],'ChatOfflineMessageId':_0x11389a['id'],'originTo':_0x268edd['MailAccount'][_0x9de1('0xe3')]},'body':_0x11389a[_0x9de1('0x3a')]};var _0x2b13d2={'account':{'id':_0x268edd['MailAccountId']},'body':_0x20f810,'log':_0x9de1('0xe8')};return respondWithRpcPromise(_0x9de1('0xe8'),_0x9de1('0xe9'),_0x2b13d2,client9001)[_0x9de1('0x1e')](function(){return _0x11389a;})[_0x9de1('0x27')](function(_0x213826){console[_0x9de1('0x24')](_0x213826);});}return;})['then'](function(){if(_0x11389a){return _0x11389a;}})[_0x9de1('0x1e')](respondWithResult(_0x3af179,null))['catch'](function(_0x14dc94){console[_0x9de1('0x24')](_0x9de1('0x27'),_0x14dc94);for(var _0x562239 of _0x2576f8){var _0x5d5f0b=path['join'](config[_0x9de1('0x7b')],_0x9de1('0xcf'),'files',_0x9de1('0xd1'),'offline-chat',_0x562239['filename']);fs_extra[_0x9de1('0xea')](_0x5d5f0b)[_0x9de1('0x27')](function(_0x2fa03a){console[_0x9de1('0x24')](_0x9de1('0xeb'),_0x5d5f0b,_0x2fa03a);});}});};exports[_0x9de1('0xec')]=function(_0xf11383,_0x1ba468,_0x228baf){return db[_0x9de1('0xaf')]['find']({'where':{'id':_0xf11383['params']['id']}})[_0x9de1('0x1e')](handleEntityNotFound(_0x1ba468,null))[_0x9de1('0x1e')](function(_0x18c9cf){if(_0x18c9cf){return _0x18c9cf['addInteraction'](_0xf11383['body'][_0x9de1('0x6d')],_['omit'](_0xf11383[_0x9de1('0x3a')],[_0x9de1('0x6d'),'id'])||{});}})[_0x9de1('0x1e')](respondWithResult(_0x1ba468,null))[_0x9de1('0x27')](handleError(_0x1ba468,null));};exports[_0x9de1('0xed')]=function(_0x1a942c,_0x519397,_0x32f126){var _0x3acdd5={'raw':![],'where':{}};var _0x5eda23={};var _0x3e9acd={'count':0x0,'rows':[]};return db[_0x9de1('0x55')]['findOne']({'where':{'id':_0x1a942c[_0x9de1('0x5b')]['id']}})[_0x9de1('0x1e')](handleEntityNotFound(_0x519397,null))[_0x9de1('0x1e')](function(_0x50ee6a){if(_0x50ee6a){_0x5eda23[_0x9de1('0x45')]=_[_0x9de1('0x46')](db[_0x9de1('0xaf')][_0x9de1('0x5c')]);_0x5eda23[_0x9de1('0x47')]=_['keys'](_0x1a942c[_0x9de1('0x47')]);_0x5eda23[_0x9de1('0x4f')]=_['intersection'](_0x5eda23[_0x9de1('0x45')],_0x5eda23['query']);_0x3acdd5[_0x9de1('0x49')]=_[_0x9de1('0x48')](_0x5eda23[_0x9de1('0x45')],qs[_0x9de1('0x4a')](_0x1a942c[_0x9de1('0x47')]['fields']));_0x3acdd5[_0x9de1('0x49')]=_0x3acdd5[_0x9de1('0x49')][_0x9de1('0x4b')]?_0x3acdd5[_0x9de1('0x49')]:_0x5eda23['model'];if(!_0x1a942c[_0x9de1('0x47')]['hasOwnProperty'](_0x9de1('0x69'))){_0x3acdd5[_0x9de1('0x2b')]=qs[_0x9de1('0x2b')](_0x1a942c[_0x9de1('0x47')][_0x9de1('0x2b')]);_0x3acdd5[_0x9de1('0x2a')]=qs[_0x9de1('0x2a')](_0x1a942c[_0x9de1('0x47')][_0x9de1('0x2a')]);}_0x3acdd5[_0x9de1('0x4d')]=qs[_0x9de1('0x6a')](_0x1a942c['query'][_0x9de1('0x6a')]);_0x3acdd5[_0x9de1('0x4e')]=qs[_0x9de1('0x4f')](_[_0x9de1('0x50')](_0x1a942c[_0x9de1('0x47')],_0x5eda23[_0x9de1('0x4f')]));_0x3acdd5['where'][_0x9de1('0x6b')]=_0x50ee6a['id'];if(_0x1a942c[_0x9de1('0x47')][_0x9de1('0x51')]){_0x3acdd5['where']=_[_0x9de1('0x39')](_0x3acdd5[_0x9de1('0x4e')],{'$or':_[_0x9de1('0x42')](_0x3acdd5[_0x9de1('0x49')],function(_0x475def){var _0x4fc562={};_0x4fc562[_0x475def]={'$like':'%'+_0x1a942c[_0x9de1('0x47')]['filter']+'%'};return _0x4fc562;})});}_0x3acdd5=_[_0x9de1('0x39')]({},_0x3acdd5,_0x1a942c[_0x9de1('0x54')]);return db['ChatInteraction'][_0x9de1('0x2d')]({'where':_0x3acdd5[_0x9de1('0x4e')]})['then'](function(_0x4cfebf){_0x3e9acd[_0x9de1('0x2d')]=_0x4cfebf;if(_0x1a942c[_0x9de1('0x47')][_0x9de1('0x56')]){_0x3acdd5['include']=[{'model':db[_0x9de1('0x8a')],'as':_0x9de1('0xee'),'required':![]},{'model':db[_0x9de1('0xbb')],'as':_0x9de1('0xef'),'attributes':[_0x9de1('0x37'),_0x9de1('0xf0'),_0x9de1('0xf1')],'required':![]},{'model':db[_0x9de1('0xf2')],'as':_0x9de1('0xf3'),'attributes':['id',_0x9de1('0x37'),_0x9de1('0xf4')],'where':_0x1a942c[_0x9de1('0x47')][_0x9de1('0xf5')]?{'id':_0x1a942c[_0x9de1('0x47')]['tag']}:undefined,'required':_0x1a942c[_0x9de1('0x47')]['tag']?!![]:![]}];}return db[_0x9de1('0xaf')][_0x9de1('0x58')](_0x3acdd5);})[_0x9de1('0x1e')](function(_0x1e1f04){_0x3e9acd[_0x9de1('0x59')]=_0x1e1f04;return _0x3e9acd;});}})[_0x9de1('0x1e')](respondWithFilteredResult(_0x519397,_0x3acdd5))[_0x9de1('0x27')](handleError(_0x519397,null));};function iftimePromise(_0x4ae0d2,_0x1bb2de){return respondWithRpcPromise(_0x9de1('0xf6'),'getSnippet',{'command':_0x1bb2de[_0x9de1('0xf7')]?util[_0x9de1('0xaa')](_0x9de1('0xf8'),_0x4ae0d2[_0x9de1('0xf9')],_0x1bb2de[_0x9de1('0xf7')]):util['format'](_0x9de1('0xfa'),_0x4ae0d2[_0x9de1('0xf9')])},client9002)[_0x9de1('0x1e')](function(_0x9a6d8c){var _0x2f9f5b=_0x9a6d8c&&_0x9a6d8c['indexOf'](_0x9de1('0xfb'))>=0x0?!![]:![];logger[_0x9de1('0x1f')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1bb2de['id'],_0x4ae0d2['id'],_0x4ae0d2[_0x9de1('0xf9')],_0x2f9f5b?_0x9de1('0xfc'):_0x9de1('0xfd'),_0x1bb2de['timezone']?_0x1bb2de[_0x9de1('0xf7')]:_0x9de1('0xfe'));return _0x2f9f5b;})['catch'](function(_0x4d8a7d){logger[_0x9de1('0x24')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1bb2de['id'],_0x4ae0d2['id'],_0x4ae0d2[_0x9de1('0xf9')],util[_0x9de1('0xff')](_0x4d8a7d,{'showHidden':![],'depth':null}),_0x1bb2de[_0x9de1('0xf7')]?_0x1bb2de[_0x9de1('0xf7')]:'No\x20timezone');return![];});}exports[_0x9de1('0x100')]=function(_0x20400f,_0x5d0f27,_0x2994f4){var _0x16f65b=0x0;var _0x180e0f=0x0;var _0x1589c7=![];var _0x264b11;var _0x4df8c0;return db['ChatWebsite']['find']({'where':{'id':_0x20400f['params']['id']},'include':[{'model':db[_0x9de1('0x101')],'as':_0x9de1('0x101'),'include':[{'model':db['Interval'],'as':_0x9de1('0x102'),'attributes':['id',_0x9de1('0xf9')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5d0f27,null))[_0x9de1('0x1e')](function(_0x424758){if(_0x424758){_0x264b11=_0x424758;return _0x424758[_0x9de1('0x103')]({'raw':!![]});}})['then'](function(_0x18d868){if(_0x264b11){if(_0x18d868){_0x4df8c0=_0x18d868;}}return require(_0x9de1('0x17'))[_0x9de1('0x104')]();})[_0x9de1('0x1e')](function(_0x13c6eb){if(_0x13c6eb){_0x180e0f=_0x13c6eb[_0x9de1('0x105')];_0x1589c7=_0x13c6eb['custom'];}})['then'](function(){return db[_0x9de1('0xaf')][_0x9de1('0x2d')]({'where':{'closed':![]}});})[_0x9de1('0x1e')](function(_0x3ba5ad){_0x16f65b=_0x3ba5ad;if(_0x180e0f&&_0x3ba5ad>_0x180e0f){return db[_0x9de1('0x106')][_0x9de1('0x68')]({'where':{'id':0x1}})[_0x9de1('0x1e')](function(_0x382813){if(_0x382813){_0x382813[_0x9de1('0x107')](_0x9de1('0x108'));}});}})['then'](function(){if(_0x264b11['Interval']&&_0x264b11[_0x9de1('0x101')][_0x9de1('0x102')]){var _0x255aec=[];for(var _0x273b40=0x0;_0x273b40<_0x264b11['Interval'][_0x9de1('0x102')][_0x9de1('0x4b')];_0x273b40++){var _0x402850=_0x264b11['Interval'][_0x9de1('0x102')][_0x273b40][_0x9de1('0x33')]({'plain':!![]});_0x255aec[_0x9de1('0xb6')](iftimePromise(_0x402850,_0x264b11));}return BPromise['all'](_0x255aec)[_0x9de1('0x1e')](function(_0x56603b){return _['some'](_0x56603b);});}else{return!![];}})['then'](function(_0x27f467){var _0x1ea61c=fs['readFileSync'](path[_0x9de1('0x7a')](config[_0x9de1('0x7b')],_0x9de1('0x109')),_0x9de1('0x10a'));var _0x348c7d={'remote':_0x264b11['remote'],'query':querystring[_0x9de1('0x23')](_[_0x9de1('0x39')](_0x264b11[_0x9de1('0x33')]({'plain':!![]}),{'customerIp':_0x20400f['headers']['x-forwarded-for']||_0x20400f[_0x9de1('0x86')][_0x9de1('0x10b')]||_0x20400f['connection'][_0x9de1('0x10c')]||_0x20400f['ip'],'referer':_0x20400f[_0x9de1('0x86')][_0x9de1('0xa5')],'openedInteractions':_0x16f65b,'maxInteractions':_0x180e0f,'virtual':_0x1589c7[_0x9de1('0x105')],'online':_0x27f467,'custom':_0x1589c7}))['replace'](/'/g,'\x5c\x27')};_0x5d0f27[_0x9de1('0x38')](ejs[_0x9de1('0xca')](Mustache[_0x9de1('0xca')](_0x1ea61c,_0x348c7d),{'proactiveActions':_0x4df8c0,'alignment':_0x264b11['alignment'],'verticalAlignment':_0x264b11[_0x9de1('0x10d')],'div_color':_0x264b11[_0x9de1('0xf4')],'text_color':_0x264b11['textColor'],'button_color':_0x264b11[_0x9de1('0x10e')],'background_color':_0x264b11[_0x9de1('0x10f')]}));})[_0x9de1('0x27')](handleError(_0x5d0f27,null));};exports[_0x9de1('0x110')]=function(_0x4cc8af,_0x1db8e8,_0x5b77ec){return db[_0x9de1('0x55')][_0x9de1('0x68')]({'where':{'id':_0x4cc8af[_0x9de1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1db8e8,null))['then'](function(_0x5b5a5f){if(_0x5b5a5f){return db['sequelize'][_0x9de1('0xd4')](function(_0x45469d){return db['ChatApplication'][_0x9de1('0x32')]({'where':{'ChatWebsiteId':_0x4cc8af[_0x9de1('0x5b')]['id']},'transaction':_0x45469d})['then'](function(_0x388b46){var _0x31190c=_['map'](_0x4cc8af[_0x9de1('0x3a')],function(_0x49698c){_0x49698c[_0x9de1('0x6b')]=_0x4cc8af[_0x9de1('0x5b')]['id'];return _0x49698c;});return db[_0x9de1('0x9a')][_0x9de1('0xd6')](_0x31190c,{'transaction':_0x45469d});});})['then'](function(){return db[_0x9de1('0x9a')][_0x9de1('0x111')]({'where':{'ChatWebsiteId':_0x4cc8af['params']['id']},'order':'priority'});});}})[_0x9de1('0x1e')](respondWithResult(_0x1db8e8,null))['catch'](handleError(_0x1db8e8,null));};exports['getApplications']=function(_0x263b65,_0x30597b,_0x51a3c4){var _0x159b58={};var _0xc2a94={};var _0x3701b8;var _0x52e7df;return db[_0x9de1('0x55')][_0x9de1('0x68')]({'where':{'id':_0x263b65[_0x9de1('0x5b')]['id']}})[_0x9de1('0x1e')](handleEntityNotFound(_0x30597b,null))[_0x9de1('0x1e')](function(_0x416fe7){if(_0x416fe7){_0x3701b8=_0x416fe7;_0xc2a94[_0x9de1('0x45')]=_[_0x9de1('0x46')](db['ChatApplication'][_0x9de1('0x5c')]);_0xc2a94['query']=_[_0x9de1('0x46')](_0x263b65['query']);_0xc2a94['filters']=_[_0x9de1('0x48')](_0xc2a94[_0x9de1('0x45')],_0xc2a94['query']);_0x159b58[_0x9de1('0x49')]=_[_0x9de1('0x48')](_0xc2a94[_0x9de1('0x45')],qs['fields'](_0x263b65[_0x9de1('0x47')]['fields']));_0x159b58[_0x9de1('0x49')]=_0x159b58[_0x9de1('0x49')][_0x9de1('0x4b')]?_0x159b58[_0x9de1('0x49')]:_0xc2a94[_0x9de1('0x45')];_0x159b58['order']=qs[_0x9de1('0x6a')](_0x263b65[_0x9de1('0x47')]['sort']);_0x159b58[_0x9de1('0x4e')]=qs[_0x9de1('0x4f')](_[_0x9de1('0x50')](_0x263b65[_0x9de1('0x47')],_0xc2a94['filters']));if(_0x263b65[_0x9de1('0x47')][_0x9de1('0x51')]){_0x159b58[_0x9de1('0x4e')]=_[_0x9de1('0x39')](_0x159b58[_0x9de1('0x4e')],{'$or':_[_0x9de1('0x42')](_0x159b58[_0x9de1('0x49')],function(_0x51888c){var _0x327c82={};_0x327c82[_0x51888c]={'$like':'%'+_0x263b65[_0x9de1('0x47')][_0x9de1('0x51')]+'%'};return _0x327c82;})});}_0x159b58=_[_0x9de1('0x39')]({},_0x159b58,_0x263b65[_0x9de1('0x54')]);return _0x3701b8['getApplications'](_0x159b58);}})[_0x9de1('0x1e')](function(_0x3e5850){if(_0x3e5850){_0x52e7df=_0x3e5850[_0x9de1('0x4b')];if(!_0x263b65[_0x9de1('0x47')][_0x9de1('0x4c')]('nolimit')){_0x159b58[_0x9de1('0x2b')]=qs[_0x9de1('0x2b')](_0x263b65[_0x9de1('0x47')][_0x9de1('0x2b')]);_0x159b58['offset']=qs[_0x9de1('0x2a')](_0x263b65['query']['offset']);}return _0x3701b8['getApplications'](_0x159b58);}})[_0x9de1('0x1e')](function(_0x4ce74c){if(_0x4ce74c){return _0x4ce74c?{'count':_0x52e7df,'rows':_0x4ce74c}:null;}})[_0x9de1('0x1e')](respondWithResult(_0x30597b,null))['catch'](handleError(_0x30597b,null));};exports[_0x9de1('0x112')]=function(_0x575870,_0x1c87f8,_0x31f891){return db[_0x9de1('0x113')]['find']({'where':{'id':_0x575870[_0x9de1('0x5b')]['id']}})[_0x9de1('0x1e')](handleEntityNotFound(_0x1c87f8,null))['then'](function(_0x57946c){if(_0x57946c){return _0x57946c[_0x9de1('0x112')](_0x575870[_0x9de1('0x3a')]['ids'],_['omit'](_0x575870[_0x9de1('0x3a')],[_0x9de1('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x1c87f8,null))[_0x9de1('0x27')](handleError(_0x1c87f8,null));};exports[_0x9de1('0x103')]=function(_0x54883f,_0x27c127,_0x533658){var _0x63e002={};var _0x157a80={};var _0x386227;var _0x26c6d1;return db[_0x9de1('0x55')]['findOne']({'where':{'id':_0x54883f[_0x9de1('0x5b')]['id']}})[_0x9de1('0x1e')](handleEntityNotFound(_0x27c127,null))[_0x9de1('0x1e')](function(_0x2db740){if(_0x2db740){_0x386227=_0x2db740;_0x157a80[_0x9de1('0x45')]=_[_0x9de1('0x46')](db[_0x9de1('0x114')][_0x9de1('0x5c')]);_0x157a80[_0x9de1('0x47')]=_[_0x9de1('0x46')](_0x54883f['query']);_0x157a80[_0x9de1('0x4f')]=_[_0x9de1('0x48')](_0x157a80['model'],_0x157a80[_0x9de1('0x47')]);_0x63e002[_0x9de1('0x49')]=_[_0x9de1('0x48')](_0x157a80[_0x9de1('0x45')],qs[_0x9de1('0x4a')](_0x54883f['query'][_0x9de1('0x4a')]));_0x63e002['attributes']=_0x63e002[_0x9de1('0x49')]['length']?_0x63e002[_0x9de1('0x49')]:_0x157a80[_0x9de1('0x45')];_0x63e002['order']=qs[_0x9de1('0x6a')](_0x54883f[_0x9de1('0x47')][_0x9de1('0x6a')]);_0x63e002[_0x9de1('0x4e')]=qs['filters'](_[_0x9de1('0x50')](_0x54883f[_0x9de1('0x47')],_0x157a80[_0x9de1('0x4f')]));if(_0x54883f[_0x9de1('0x47')][_0x9de1('0x51')]){_0x63e002['where']=_['merge'](_0x63e002['where'],{'$or':_[_0x9de1('0x42')](_0x63e002[_0x9de1('0x49')],function(_0x4b9e00){var _0x58959e={};_0x58959e[_0x4b9e00]={'$like':'%'+_0x54883f[_0x9de1('0x47')]['filter']+'%'};return _0x58959e;})});}_0x63e002=_['merge']({},_0x63e002,_0x54883f[_0x9de1('0x54')]);return _0x386227['getProactiveActions'](_0x63e002);}})[_0x9de1('0x1e')](function(_0x23d8ce){if(_0x23d8ce){_0x26c6d1=_0x23d8ce['length'];if(!_0x54883f[_0x9de1('0x47')]['hasOwnProperty'](_0x9de1('0x69'))){_0x63e002[_0x9de1('0x2b')]=qs[_0x9de1('0x2b')](_0x54883f[_0x9de1('0x47')][_0x9de1('0x2b')]);_0x63e002[_0x9de1('0x2a')]=qs['offset'](_0x54883f['query']['offset']);}return _0x386227[_0x9de1('0x103')](_0x63e002);}})[_0x9de1('0x1e')](function(_0x513e85){if(_0x513e85){return _0x513e85?{'count':_0x26c6d1,'rows':_0x513e85}:null;}})['then'](respondWithResult(_0x27c127,null))[_0x9de1('0x27')](handleError(_0x27c127,null));};exports[_0x9de1('0x115')]=function(_0x58c9bf,_0x451f60,_0xb8dae1){var _0x4172b2=_0x58c9bf[_0x9de1('0x47')][_0x9de1('0x116')]==='false'?_0x9de1('0x117'):_0x9de1('0x118');return db['ChatWebsite'][_0x9de1('0x5d')]({'attributes':['id',_0x4172b2],'where':{'id':_0x58c9bf[_0x9de1('0x5b')]['id']}})[_0x9de1('0x1e')](handleEntityNotFound(_0x451f60,null))[_0x9de1('0x1e')](function(_0x47ecda){if(_0x47ecda){var _0x75cab2=_0x47ecda[_0x4172b2];var _0x5a5282=_0x75cab2&&_0x75cab2[_0x9de1('0x119')]?_0x75cab2[_0x9de1('0x119')]:[];_0x451f60['send']({'fromKey':_[_0x9de1('0x7d')](_0x75cab2[_0x9de1('0x11a')])?undefined:_0x75cab2[_0x9de1('0x11a')],'count':_0x5a5282[_0x9de1('0x4b')],'rows':_0x5a5282});}})[_0x9de1('0x27')](handleError(_0x451f60,null));};exports[_0x9de1('0x11b')]=function(_0xc24769,_0x45ecd4,_0x11d259){var _0x202309={'raw':![],'where':{}};var _0x55d6ef={};var _0x471e26={'count':0x0,'rows':[]};return db[_0x9de1('0x55')][_0x9de1('0x68')]({'where':{'id':_0xc24769[_0x9de1('0x5b')]['id']}})[_0x9de1('0x1e')](handleEntityNotFound(_0x45ecd4,null))[_0x9de1('0x1e')](function(_0xc0cd89){if(_0xc0cd89){_0x55d6ef[_0x9de1('0x45')]=_['keys'](db[_0x9de1('0x11c')][_0x9de1('0x5c')]);_0x55d6ef[_0x9de1('0x47')]=_[_0x9de1('0x46')](_0xc24769[_0x9de1('0x47')]);_0x55d6ef[_0x9de1('0x4f')]=_[_0x9de1('0x48')](_0x55d6ef['model'],_0x55d6ef[_0x9de1('0x47')]);_0x202309[_0x9de1('0x49')]=_[_0x9de1('0x48')](_0x55d6ef[_0x9de1('0x45')],qs[_0x9de1('0x4a')](_0xc24769[_0x9de1('0x47')][_0x9de1('0x4a')]));_0x202309[_0x9de1('0x49')]=_0x202309[_0x9de1('0x49')][_0x9de1('0x4b')]?_0x202309[_0x9de1('0x49')]:_0x55d6ef['model'];if(!_0xc24769[_0x9de1('0x47')][_0x9de1('0x4c')]('nolimit')){_0x202309['limit']=qs[_0x9de1('0x2b')](_0xc24769[_0x9de1('0x47')][_0x9de1('0x2b')]);_0x202309[_0x9de1('0x2a')]=qs[_0x9de1('0x2a')](_0xc24769[_0x9de1('0x47')][_0x9de1('0x2a')]);}_0x202309[_0x9de1('0x4d')]=qs[_0x9de1('0x6a')](_0xc24769[_0x9de1('0x47')]['sort']);_0x202309[_0x9de1('0x4e')]=qs[_0x9de1('0x4f')](_['pick'](_0xc24769[_0x9de1('0x47')],_0x55d6ef[_0x9de1('0x4f')]));_0x202309['where'][_0x9de1('0x6b')]=_0xc0cd89['id'];if(_0xc24769['query'][_0x9de1('0x51')]){_0x202309[_0x9de1('0x4e')]=_['merge'](_0x202309[_0x9de1('0x4e')],{'$or':_[_0x9de1('0x42')](_0x202309[_0x9de1('0x49')],function(_0x45da5c){var _0x3574eb={};_0x3574eb[_0x45da5c]={'$like':'%'+_0xc24769[_0x9de1('0x47')][_0x9de1('0x51')]+'%'};return _0x3574eb;})});}_0x202309=_[_0x9de1('0x39')]({},_0x202309,_0xc24769[_0x9de1('0x54')]);return db[_0x9de1('0x11c')][_0x9de1('0x2d')]({'where':_0x202309[_0x9de1('0x4e')]})[_0x9de1('0x1e')](function(_0x1bf100){_0x471e26[_0x9de1('0x2d')]=_0x1bf100;if(_0xc24769[_0x9de1('0x47')][_0x9de1('0x56')]){_0x202309['include']=[{'all':!![]}];}else{_0x202309['include']=[{'model':db['CmContact'],'as':_0x9de1('0xee'),'required':![]},{'model':db[_0x9de1('0xd5')],'as':_0x9de1('0x11d'),'required':![]}];}return db[_0x9de1('0x11c')][_0x9de1('0x58')](_0x202309);})['then'](function(_0x46595f){_0x471e26[_0x9de1('0x59')]=_0x46595f;return _0x471e26;});}})[_0x9de1('0x1e')](respondWithFilteredResult(_0x45ecd4,_0x202309))[_0x9de1('0x27')](handleError(_0x45ecd4,null));};exports[_0x9de1('0x11e')]=function(_0x2d148f,_0x4369f9,_0x23ae2b){return db['ChatWebsite']['find']({'where':{'id':_0x2d148f[_0x9de1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4369f9,null))[_0x9de1('0x1e')](function(_0x55b6c6){if(_0x55b6c6){return _0x55b6c6['addAgents'](_0x2d148f[_0x9de1('0x3a')][_0x9de1('0x6d')],_[_0x9de1('0x11f')](_0x2d148f[_0x9de1('0x3a')],['ids','id'])||{})[_0x9de1('0xb1')](function(_0x56196c){for(var _0x7bb199=0x0;_0x7bb199<_0x2d148f[_0x9de1('0x3a')][_0x9de1('0x6d')][_0x9de1('0x4b')];_0x7bb199+=0x1){socket[_0x9de1('0x120')]('userChatWebsite:save',{'UserId':_0x2d148f[_0x9de1('0x3a')][_0x9de1('0x6d')][_0x7bb199],'ChatWebsiteId':_0x2d148f['params']['id']});}return _0x56196c;});}})[_0x9de1('0x1e')](respondWithResult(_0x4369f9,null))['catch'](handleError(_0x4369f9,null));};exports[_0x9de1('0x121')]=function(_0x2a1ac9,_0x142d19,_0x57dd10){return db[_0x9de1('0x55')][_0x9de1('0x5d')]({'where':{'id':_0x2a1ac9[_0x9de1('0x5b')]['id']}})[_0x9de1('0x1e')](handleEntityNotFound(_0x142d19,null))[_0x9de1('0x1e')](function(_0x2140a3){if(_0x2140a3){return _0x2140a3[_0x9de1('0x121')](_0x2a1ac9['query'][_0x9de1('0x6d')])[_0x9de1('0x1e')](function(){if(_[_0x9de1('0x122')](_0x2a1ac9[_0x9de1('0x47')]['ids'])){for(var _0x3a1430=0x0;_0x3a1430<_0x2a1ac9[_0x9de1('0x47')]['ids'][_0x9de1('0x4b')];_0x3a1430+=0x1){socket[_0x9de1('0x120')](_0x9de1('0x123'),{'UserId':Number(_0x2a1ac9[_0x9de1('0x47')]['ids'][_0x3a1430]),'ChatWebsiteId':Number(_0x2a1ac9[_0x9de1('0x5b')]['id'])});}}else{socket[_0x9de1('0x120')]('userChatWebsite:remove',{'UserId':Number(_0x2a1ac9[_0x9de1('0x47')]['ids']),'ChatWebsiteId':Number(_0x2a1ac9['params']['id'])});}});}})[_0x9de1('0x1e')](respondWithStatusCode(_0x142d19,null))['catch'](handleError(_0x142d19,null));};exports[_0x9de1('0x124')]=function(_0x2f0c26,_0x3b304b,_0x1ed49a){var _0x442da4={};var _0xbfe5d7={};var _0x54ba06;var _0x11cf47;return db['ChatWebsite'][_0x9de1('0x68')]({'where':{'id':_0x2f0c26['params']['id']}})['then'](handleEntityNotFound(_0x3b304b,null))[_0x9de1('0x1e')](function(_0x29240f){if(_0x29240f){_0x54ba06=_0x29240f;_0xbfe5d7['model']=_[_0x9de1('0x46')](db['User'][_0x9de1('0x5c')]);_0xbfe5d7[_0x9de1('0x47')]=_[_0x9de1('0x46')](_0x2f0c26[_0x9de1('0x47')]);_0xbfe5d7[_0x9de1('0x4f')]=_[_0x9de1('0x48')](_0xbfe5d7[_0x9de1('0x45')],_0xbfe5d7[_0x9de1('0x47')]);_0x442da4[_0x9de1('0x49')]=_['intersection'](_0xbfe5d7[_0x9de1('0x45')],qs[_0x9de1('0x4a')](_0x2f0c26[_0x9de1('0x47')][_0x9de1('0x4a')]));_0x442da4[_0x9de1('0x49')]=_0x442da4[_0x9de1('0x49')][_0x9de1('0x4b')]?_0x442da4[_0x9de1('0x49')]:_0xbfe5d7[_0x9de1('0x45')];_0x442da4[_0x9de1('0x4d')]=qs[_0x9de1('0x6a')](_0x2f0c26[_0x9de1('0x47')][_0x9de1('0x6a')]);_0x442da4[_0x9de1('0x4e')]=qs[_0x9de1('0x4f')](_[_0x9de1('0x50')](_0x2f0c26['query'],_0xbfe5d7[_0x9de1('0x4f')]));if(_0x2f0c26['query'][_0x9de1('0x51')]){_0x442da4[_0x9de1('0x4e')]=_['merge'](_0x442da4[_0x9de1('0x4e')],{'$or':_[_0x9de1('0x42')](_0x442da4[_0x9de1('0x49')],function(_0x52000d){var _0x1289ae={};_0x1289ae[_0x52000d]={'$like':'%'+_0x2f0c26['query'][_0x9de1('0x51')]+'%'};return _0x1289ae;})});}_0x442da4=_[_0x9de1('0x39')]({},_0x442da4,_0x2f0c26[_0x9de1('0x54')]);return _0x54ba06['getAgents'](_0x442da4);}})[_0x9de1('0x1e')](function(_0x165fea){if(_0x165fea){_0x11cf47=_0x165fea[_0x9de1('0x4b')];if(!_0x2f0c26[_0x9de1('0x47')]['hasOwnProperty'](_0x9de1('0x69'))){_0x442da4[_0x9de1('0x2b')]=qs[_0x9de1('0x2b')](_0x2f0c26['query']['limit']);_0x442da4[_0x9de1('0x2a')]=qs[_0x9de1('0x2a')](_0x2f0c26[_0x9de1('0x47')]['offset']);}return _0x54ba06[_0x9de1('0x124')](_0x442da4);}})[_0x9de1('0x1e')](function(_0x121174){if(_0x121174){return _0x121174?{'count':_0x11cf47,'rows':_0x121174}:null;}})[_0x9de1('0x1e')](respondWithResult(_0x3b304b,null))['catch'](handleError(_0x3b304b,null));}; \ No newline at end of file +var _0x61ac=['ids','addLogo','sitepic','filename','addAvatar','addCustomerAvatar','customerAvatar','file','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','custom','isNil','existsSync','server/files/images/logos/','getAvatar','root','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','agentAvatar','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','chat','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','from','Sequelize','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','CmList','List','CmContact','Contacts','ChatApplication','applications','Applications','list','orderBy','priority','asc','mapKey','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','update','created','autoclose','push','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','utf8','toPairs','originalname','mimetype','server','files','attachments','offline-chat','transaction','bulkCreate','MailServerOut','Smtp','service','host','port','secure','auth','pass','SendMail','email','forwardOfflineAddress','offlineMessageSubject','openNewInteraction','subjectOffline','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','addInteraction','getInteractions','Owner','fullname','Tag','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','info','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','getLicense','virtual','License','chatLicenseExceeded','all','some','server/files/chat/iframe.js','remote','x-real-ip','remoteAddress','referer','replace','alignment','textColor','color_button','backgroundColor','sequelize','getApplications','chatProactiveAction','omit','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','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/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','http','client','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','ChatWebsites','UserProfileResource','sendStatus','name','render','merge','contact','agent','account','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','Disposition','getDispositions','findOne','options','rows','removeDispositions','CannedAnswer','getAnswers','ChatWebsiteId'];(function(_0x4d8a74,_0x4bf5d2){var _0x58fbc5=function(_0x4bca6f){while(--_0x4bca6f){_0x4d8a74['push'](_0x4d8a74['shift']());}};_0x58fbc5(++_0x4bf5d2);}(_0x61ac,0xc5));var _0xc61a=function(_0x590b61,_0x4c4335){_0x590b61=_0x590b61-0x0;var _0x1a14dc=_0x61ac[_0x590b61];return _0x1a14dc;};'use strict';var emlformat=require(_0xc61a('0x0'));var rimraf=require(_0xc61a('0x1'));var zipdir=require(_0xc61a('0x2'));var jsonpatch=require(_0xc61a('0x3'));var rp=require(_0xc61a('0x4'));var moment=require(_0xc61a('0x5'));var BPromise=require(_0xc61a('0x6'));var Mustache=require(_0xc61a('0x7'));var util=require('util');var path=require(_0xc61a('0x8'));var sox=require('sox');var csv=require(_0xc61a('0x9'));var ejs=require(_0xc61a('0xa'));var fs=require('fs');var fs_extra=require(_0xc61a('0xb'));var _=require(_0xc61a('0xc'));var squel=require('squel');var crypto=require(_0xc61a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc61a('0xe'));var toCsv=require(_0xc61a('0x9'));var querystring=require(_0xc61a('0xf'));var Papa=require(_0xc61a('0x10'));var Redis=require('ioredis');var authService=require(_0xc61a('0x11'));var qs=require(_0xc61a('0x12'));var as=require(_0xc61a('0x13'));var hardwareService=require(_0xc61a('0x14'));var logger=require(_0xc61a('0x15'))(_0xc61a('0x16'));var utils=require('../../config/utils');var config=require(_0xc61a('0x17'));var licenseUtil=require(_0xc61a('0x18'));var db=require(_0xc61a('0x19'))['db'];config[_0xc61a('0x1a')]=_['defaults'](config[_0xc61a('0x1a')],{'host':_0xc61a('0x1b'),'port':0x18eb});var socket=require(_0xc61a('0x1c'))(new Redis(config[_0xc61a('0x1a')]));require(_0xc61a('0x1d'))['register'](socket);var jayson=require(_0xc61a('0x1e'));var client=jayson['client'][_0xc61a('0x1f')]({'port':0x232c});var client9002=jayson[_0xc61a('0x20')]['http']({'port':0x232a});var client9003=jayson[_0xc61a('0x20')][_0xc61a('0x1f')]({'port':0x232b});var client9001=jayson[_0xc61a('0x20')][_0xc61a('0x1f')]({'port':0x2329});function respondWithRpcPromise(_0x687eda,_0x25e616,_0xcb3419,_0x3c0760){return new BPromise(function(_0x52e2e5,_0x539fde){var _0x34189f=_0x3c0760||client;return _0x34189f[_0xc61a('0x21')](_0x687eda,_0xcb3419)['then'](function(_0x1a05de){logger['info'](_0xc61a('0x22'),_0x25e616,_0xc61a('0x23'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x25e616,_0xc61a('0x23'),JSON[_0xc61a('0x24')](_0x1a05de));if(_0x1a05de[_0xc61a('0x25')]){if(_0x1a05de[_0xc61a('0x25')][_0xc61a('0x26')]===0x1f4){logger[_0xc61a('0x25')]('ChatWebsite,\x20%s,\x20%s',_0x25e616,_0x1a05de[_0xc61a('0x25')][_0xc61a('0x27')]);return _0x539fde(_0x1a05de[_0xc61a('0x25')][_0xc61a('0x27')]);}logger[_0xc61a('0x25')](_0xc61a('0x22'),_0x25e616,_0x1a05de[_0xc61a('0x25')][_0xc61a('0x27')]);return _0x52e2e5(_0x1a05de[_0xc61a('0x25')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x25e616,_0xc61a('0x23'));_0x52e2e5(_0x1a05de[_0xc61a('0x28')][_0xc61a('0x27')]);}})['catch'](function(_0x210111){logger[_0xc61a('0x25')](_0xc61a('0x22'),_0x25e616,_0x210111);_0x539fde(_0x210111);});});}function respondWithStatusCode(_0x1bd79e,_0x1066fd){_0x1066fd=_0x1066fd||0xcc;return function(_0x19a390){if(_0x19a390){return _0x1bd79e['sendStatus'](_0x1066fd);}return _0x1bd79e[_0xc61a('0x29')](_0x1066fd)[_0xc61a('0x2a')]();};}function respondWithResult(_0x2957ad,_0x1b92ec){_0x1b92ec=_0x1b92ec||0xc8;return function(_0x38dbbd){if(_0x38dbbd){return _0x2957ad[_0xc61a('0x29')](_0x1b92ec)[_0xc61a('0x2b')](_0x38dbbd);}};}function respondWithFilteredResult(_0x4a3186,_0x29ae43){return function(_0x1e95ef){if(_0x1e95ef){var _0x45f28c=typeof _0x29ae43[_0xc61a('0x2c')]===_0xc61a('0x2d')&&typeof _0x29ae43[_0xc61a('0x2e')]===_0xc61a('0x2d');var _0x1670e6=_0x1e95ef['count'];var _0x4eb9d2=_0x45f28c?0x0:_0x29ae43[_0xc61a('0x2c')];var _0x552087=_0x45f28c?_0x1e95ef[_0xc61a('0x2f')]:_0x29ae43[_0xc61a('0x2c')]+_0x29ae43[_0xc61a('0x2e')];var _0x1d9944;if(_0x552087>=_0x1670e6){_0x552087=_0x1670e6;_0x1d9944=0xc8;}else{_0x1d9944=0xce;}_0x4a3186['status'](_0x1d9944);return _0x4a3186[_0xc61a('0x30')](_0xc61a('0x31'),_0x4eb9d2+'-'+_0x552087+'/'+_0x1670e6)['json'](_0x1e95ef);}return null;};}function patchUpdates(_0x300125){return function(_0x500894){try{jsonpatch[_0xc61a('0x32')](_0x500894,_0x300125,!![]);}catch(_0x5a6935){return BPromise['reject'](_0x5a6935);}return _0x500894['save']();};}function saveUpdates(_0x3c3e58,_0x4c90b5){return function(_0x25f63c){if(_0x25f63c){return _0x25f63c['update'](_0x3c3e58)[_0xc61a('0x33')](function(_0x3359ac){return _0x3359ac;});}return null;};}function removeEntity(_0x22b435,_0x42c6ce){return function(_0x357197){if(_0x357197){return _0x357197[_0xc61a('0x34')]()['then'](function(){var _0x11161f=_0x357197['get']({'plain':!![]});var _0x3143c5=_0xc61a('0x35');return db[_0xc61a('0x36')]['destroy']({'where':{'type':_0x3143c5,'resourceId':_0x11161f['id']}})[_0xc61a('0x33')](function(){return _0x357197;});})[_0xc61a('0x33')](function(){_0x22b435['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5034d8,_0x399d58){return function(_0xa909e4){if(!_0xa909e4){_0x5034d8[_0xc61a('0x37')](0x194);}return _0xa909e4;};}function handleError(_0x10afc8,_0xc538ff){_0xc538ff=_0xc538ff||0x1f4;return function(_0x1c0e42){logger['error'](_0x1c0e42['stack']);if(_0x1c0e42[_0xc61a('0x38')]){delete _0x1c0e42[_0xc61a('0x38')];}_0x10afc8[_0xc61a('0x29')](_0xc538ff)['send'](_0x1c0e42);};}function getMustacheRender(_0x71f9f8,_0x436698){return Mustache[_0xc61a('0x39')](_0x71f9f8,_[_0xc61a('0x3a')](_0x436698['body'],{'contact':_0x436698[_0xc61a('0x3b')],'message':_0x436698[_0xc61a('0x27')],'agent':_0x436698[_0xc61a('0x3c')],'interaction':_0x436698['interaction'],'account':_0x436698[_0xc61a('0x3d')]}))||'';}exports[_0xc61a('0x3e')]=function(_0x8da429,_0x5623e2){var _0x2010ce={'include':[{'model':db[_0xc61a('0x3f')],'as':_0xc61a('0x40')}]},_0xa2ae41={},_0x1a8436={'count':0x0,'rows':[]};var _0x47fbbe=_['map'](db[_0xc61a('0x41')][_0xc61a('0x42')],function(_0x97e0d0){return{'name':_0x97e0d0[_0xc61a('0x43')],'type':_0x97e0d0['type'][_0xc61a('0x44')]};});_0xa2ae41['model']=_[_0xc61a('0x45')](_0x47fbbe,'name');_0xa2ae41[_0xc61a('0x46')]=_['keys'](_0x8da429[_0xc61a('0x46')]);_0xa2ae41[_0xc61a('0x47')]=_['intersection'](_0xa2ae41['model'],_0xa2ae41['query']);_0x2010ce['attributes']=_[_0xc61a('0x48')](_0xa2ae41[_0xc61a('0x49')],qs[_0xc61a('0x4a')](_0x8da429[_0xc61a('0x46')][_0xc61a('0x4a')]));_0x2010ce[_0xc61a('0x4b')]=_0x2010ce['attributes'][_0xc61a('0x4c')]?_0x2010ce[_0xc61a('0x4b')]:_0xa2ae41[_0xc61a('0x49')];if(!_0x8da429[_0xc61a('0x46')][_0xc61a('0x4d')](_0xc61a('0x4e'))){_0x2010ce[_0xc61a('0x2e')]=qs['limit'](_0x8da429[_0xc61a('0x46')][_0xc61a('0x2e')]);_0x2010ce[_0xc61a('0x2c')]=qs[_0xc61a('0x2c')](_0x8da429[_0xc61a('0x46')][_0xc61a('0x2c')]);}_0x2010ce[_0xc61a('0x4f')]=qs[_0xc61a('0x50')](_0x8da429['query']['sort']);_0x2010ce[_0xc61a('0x51')]=qs[_0xc61a('0x47')](_[_0xc61a('0x52')](_0x8da429[_0xc61a('0x46')],_0xa2ae41['filters']),_0x47fbbe);if(_0x8da429[_0xc61a('0x46')][_0xc61a('0x53')]){_0x2010ce[_0xc61a('0x51')]=_[_0xc61a('0x3a')](_0x2010ce[_0xc61a('0x51')],{'$or':_['map'](_0x47fbbe,function(_0x7ef3ef){if(_0x7ef3ef[_0xc61a('0x54')]!==_0xc61a('0x55')){var _0x67b5c5={};_0x67b5c5[_0x7ef3ef[_0xc61a('0x38')]]={'$like':'%'+_0x8da429[_0xc61a('0x46')][_0xc61a('0x53')]+'%'};return _0x67b5c5;}})});}_0x2010ce=_[_0xc61a('0x3a')]({},_0x2010ce,_0x8da429['options']);var _0x528720={'where':_0x2010ce[_0xc61a('0x51')]};return db[_0xc61a('0x41')][_0xc61a('0x2f')](_0x528720)[_0xc61a('0x33')](function(_0x5ed912){_0x1a8436['count']=_0x5ed912;if(_0x8da429[_0xc61a('0x46')][_0xc61a('0x56')]){_0x2010ce[_0xc61a('0x57')]=[{'all':!![]}];}return db[_0xc61a('0x41')][_0xc61a('0x58')](_0x2010ce);})[_0xc61a('0x33')](function(_0x44781f){_0x1a8436['rows']=_0x44781f;return _0x1a8436;})[_0xc61a('0x33')](respondWithFilteredResult(_0x5623e2,_0x2010ce))[_0xc61a('0x59')](handleError(_0x5623e2,null));};exports[_0xc61a('0x5a')]=function(_0x24e5e1,_0x3650ef){var _0x329360={'raw':![],'where':{'id':_0x24e5e1[_0xc61a('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xc61a('0x40')}]},_0xd7e672={};_0xd7e672['model']=_[_0xc61a('0x5c')](db['ChatWebsite']['rawAttributes']);_0xd7e672['query']=_[_0xc61a('0x5c')](_0x24e5e1[_0xc61a('0x46')]);_0xd7e672[_0xc61a('0x47')]=_['intersection'](_0xd7e672['model'],_0xd7e672[_0xc61a('0x46')]);_0x329360[_0xc61a('0x4b')]=_[_0xc61a('0x48')](_0xd7e672[_0xc61a('0x49')],qs[_0xc61a('0x4a')](_0x24e5e1['query'][_0xc61a('0x4a')]));_0x329360[_0xc61a('0x4b')]=_0x329360['attributes'][_0xc61a('0x4c')]?_0x329360[_0xc61a('0x4b')]:_0xd7e672['model'];if(_0x24e5e1[_0xc61a('0x46')][_0xc61a('0x56')]){_0x329360[_0xc61a('0x57')]=[{'all':!![]}];}_0x329360=_[_0xc61a('0x3a')]({},_0x329360,_0x24e5e1['options']);return db[_0xc61a('0x41')]['find'](_0x329360)[_0xc61a('0x33')](handleEntityNotFound(_0x3650ef,null))[_0xc61a('0x33')](respondWithResult(_0x3650ef,null))[_0xc61a('0x59')](handleError(_0x3650ef,null));};exports[_0xc61a('0x5d')]=function(_0x2cde67,_0x1e1d95){return db[_0xc61a('0x41')]['create'](_0x2cde67[_0xc61a('0x5e')],{})[_0xc61a('0x33')](function(_0x256585){var _0xc03fbd=_0x2cde67[_0xc61a('0x5f')][_0xc61a('0x60')]({'plain':!![]});if(!_0xc03fbd)throw new Error(_0xc61a('0x61'));if(_0xc03fbd[_0xc61a('0x62')]==='user'){var _0x2d00b1=_0x256585[_0xc61a('0x60')]({'plain':!![]});var _0x49cb0d='ChatWebsites';return db[_0xc61a('0x63')]['find']({'where':{'name':_0x49cb0d,'userProfileId':_0xc03fbd[_0xc61a('0x64')]},'raw':!![]})[_0xc61a('0x33')](function(_0x4d66cf){if(_0x4d66cf&&_0x4d66cf['autoAssociation']===0x0){return db[_0xc61a('0x36')]['create']({'name':_0x2d00b1['name'],'resourceId':_0x2d00b1['id'],'type':_0x4d66cf[_0xc61a('0x38')],'sectionId':_0x4d66cf['id']},{})[_0xc61a('0x33')](function(){return _0x256585;});}else{return _0x256585;}})[_0xc61a('0x59')](function(_0x34ca02){logger[_0xc61a('0x25')](_0xc61a('0x65'),_0x34ca02);throw _0x34ca02;});}return _0x256585;})[_0xc61a('0x33')](respondWithResult(_0x1e1d95,0xc9))[_0xc61a('0x59')](handleError(_0x1e1d95,null));};exports['update']=function(_0x1c0c00,_0xc97810){if(_0x1c0c00[_0xc61a('0x5e')]['id']){delete _0x1c0c00[_0xc61a('0x5e')]['id'];}return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x1c0c00[_0xc61a('0x5b')]['id']},'include':[{'model':db[_0xc61a('0x3f')],'as':_0xc61a('0x40')}]})[_0xc61a('0x33')](handleEntityNotFound(_0xc97810,null))['then'](saveUpdates(_0x1c0c00[_0xc61a('0x5e')],null))[_0xc61a('0x33')](respondWithResult(_0xc97810,null))['catch'](handleError(_0xc97810,null));};exports[_0xc61a('0x34')]=function(_0x5b5b0c,_0xa93874){return db['ChatWebsite'][_0xc61a('0x66')]({'where':{'id':_0x5b5b0c[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0xa93874,null))[_0xc61a('0x33')](removeEntity(_0xa93874,null))[_0xc61a('0x59')](handleError(_0xa93874,null));};exports[_0xc61a('0x67')]=function(_0x174036,_0xba46ee){return db[_0xc61a('0x41')][_0xc61a('0x67')]()[_0xc61a('0x33')](respondWithResult(_0xba46ee,null))[_0xc61a('0x59')](handleError(_0xba46ee,null));};exports[_0xc61a('0x68')]=function(_0x3b1709,_0x3e4662,_0x155758){if(_0x3b1709['body']['id']){delete _0x3b1709[_0xc61a('0x5e')]['id'];}return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x3b1709[_0xc61a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3e4662,null))[_0xc61a('0x33')](function(_0x46b778){if(_0x46b778){_0x3b1709['body']['ChatWebsiteId']=_0x46b778['id'];return db[_0xc61a('0x69')][_0xc61a('0x5d')](_0x3b1709['body']);}})['then'](respondWithResult(_0x3e4662,null))[_0xc61a('0x59')](handleError(_0x3e4662,null));};exports[_0xc61a('0x6a')]=function(_0x3b30ed,_0x2dc989,_0x4b9217){var _0x4403a={'raw':![],'where':{}};var _0x454e52={};var _0xf1e760={'count':0x0,'rows':[]};return db[_0xc61a('0x41')][_0xc61a('0x6b')]({'where':{'id':_0x3b30ed[_0xc61a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2dc989,null))[_0xc61a('0x33')](function(_0x5907fd){if(_0x5907fd){_0x454e52['model']=_['keys'](db[_0xc61a('0x69')][_0xc61a('0x42')]);_0x454e52[_0xc61a('0x46')]=_[_0xc61a('0x5c')](_0x3b30ed[_0xc61a('0x46')]);_0x454e52[_0xc61a('0x47')]=_[_0xc61a('0x48')](_0x454e52[_0xc61a('0x49')],_0x454e52[_0xc61a('0x46')]);_0x4403a[_0xc61a('0x4b')]=_[_0xc61a('0x48')](_0x454e52[_0xc61a('0x49')],qs[_0xc61a('0x4a')](_0x3b30ed[_0xc61a('0x46')][_0xc61a('0x4a')]));_0x4403a[_0xc61a('0x4b')]=_0x4403a['attributes'][_0xc61a('0x4c')]?_0x4403a[_0xc61a('0x4b')]:_0x454e52[_0xc61a('0x49')];if(!_0x3b30ed[_0xc61a('0x46')][_0xc61a('0x4d')](_0xc61a('0x4e'))){_0x4403a[_0xc61a('0x2e')]=qs[_0xc61a('0x2e')](_0x3b30ed[_0xc61a('0x46')][_0xc61a('0x2e')]);_0x4403a[_0xc61a('0x2c')]=qs[_0xc61a('0x2c')](_0x3b30ed['query'][_0xc61a('0x2c')]);}_0x4403a['order']=qs['sort'](_0x3b30ed[_0xc61a('0x46')][_0xc61a('0x50')]);_0x4403a[_0xc61a('0x51')]=qs[_0xc61a('0x47')](_[_0xc61a('0x52')](_0x3b30ed[_0xc61a('0x46')],_0x454e52[_0xc61a('0x47')]));_0x4403a['where']['ChatWebsiteId']=_0x5907fd['id'];if(_0x3b30ed[_0xc61a('0x46')][_0xc61a('0x53')]){_0x4403a[_0xc61a('0x51')]=_[_0xc61a('0x3a')](_0x4403a[_0xc61a('0x51')],{'$or':_[_0xc61a('0x45')](_0x4403a[_0xc61a('0x4b')],function(_0x589b6e){var _0x590724={};_0x590724[_0x589b6e]={'$like':'%'+_0x3b30ed[_0xc61a('0x46')][_0xc61a('0x53')]+'%'};return _0x590724;})});}_0x4403a=_['merge']({},_0x4403a,_0x3b30ed[_0xc61a('0x6c')]);return db[_0xc61a('0x69')][_0xc61a('0x2f')]({'where':_0x4403a[_0xc61a('0x51')]})[_0xc61a('0x33')](function(_0x2864cd){_0xf1e760['count']=_0x2864cd;if(_0x3b30ed['query'][_0xc61a('0x56')]){_0x4403a[_0xc61a('0x57')]=[{'all':!![]}];}return db[_0xc61a('0x69')][_0xc61a('0x58')](_0x4403a);})[_0xc61a('0x33')](function(_0xb6aa27){_0xf1e760[_0xc61a('0x6d')]=_0xb6aa27;return _0xf1e760;});}})[_0xc61a('0x33')](respondWithFilteredResult(_0x2dc989,_0x4403a))[_0xc61a('0x59')](handleError(_0x2dc989,null));};exports['removeDispositions']=function(_0x221105,_0x238827,_0x3831af){return db['ChatWebsite'][_0xc61a('0x66')]({'where':{'id':_0x221105[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x238827,null))[_0xc61a('0x33')](function(_0x54c0f8){if(_0x54c0f8){return _0x54c0f8[_0xc61a('0x6e')](_0x221105[_0xc61a('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x238827,null))[_0xc61a('0x59')](handleError(_0x238827,null));};exports['addAnswer']=function(_0x222646,_0x54284e,_0x1fbe44){if(_0x222646[_0xc61a('0x5e')]['id']){delete _0x222646['body']['id'];}return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x222646['params']['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x54284e,null))[_0xc61a('0x33')](function(_0x5a9c20){if(_0x5a9c20){_0x222646[_0xc61a('0x5e')]['ChatWebsiteId']=_0x5a9c20['id'];return db[_0xc61a('0x6f')]['create'](_0x222646[_0xc61a('0x5e')]);}})[_0xc61a('0x33')](respondWithResult(_0x54284e,null))[_0xc61a('0x59')](handleError(_0x54284e,null));};exports[_0xc61a('0x70')]=function(_0x2896d7,_0x1ed89,_0x5255b9){var _0x3afeb4={'raw':![],'where':{}};var _0xc71f38={};var _0x4bb58a={'count':0x0,'rows':[]};return db[_0xc61a('0x41')][_0xc61a('0x6b')]({'where':{'id':_0x2896d7['params']['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x1ed89,null))[_0xc61a('0x33')](function(_0x2589b0){if(_0x2589b0){_0xc71f38['model']=_['keys'](db[_0xc61a('0x6f')]['rawAttributes']);_0xc71f38['query']=_['keys'](_0x2896d7['query']);_0xc71f38[_0xc61a('0x47')]=_['intersection'](_0xc71f38[_0xc61a('0x49')],_0xc71f38[_0xc61a('0x46')]);_0x3afeb4[_0xc61a('0x4b')]=_[_0xc61a('0x48')](_0xc71f38['model'],qs[_0xc61a('0x4a')](_0x2896d7[_0xc61a('0x46')][_0xc61a('0x4a')]));_0x3afeb4[_0xc61a('0x4b')]=_0x3afeb4[_0xc61a('0x4b')][_0xc61a('0x4c')]?_0x3afeb4['attributes']:_0xc71f38['model'];if(!_0x2896d7['query'][_0xc61a('0x4d')](_0xc61a('0x4e'))){_0x3afeb4['limit']=qs[_0xc61a('0x2e')](_0x2896d7[_0xc61a('0x46')][_0xc61a('0x2e')]);_0x3afeb4[_0xc61a('0x2c')]=qs[_0xc61a('0x2c')](_0x2896d7[_0xc61a('0x46')][_0xc61a('0x2c')]);}_0x3afeb4[_0xc61a('0x4f')]=qs[_0xc61a('0x50')](_0x2896d7[_0xc61a('0x46')][_0xc61a('0x50')]);_0x3afeb4[_0xc61a('0x51')]=qs[_0xc61a('0x47')](_['pick'](_0x2896d7[_0xc61a('0x46')],_0xc71f38[_0xc61a('0x47')]));_0x3afeb4[_0xc61a('0x51')][_0xc61a('0x71')]=_0x2589b0['id'];if(_0x2896d7[_0xc61a('0x46')][_0xc61a('0x53')]){_0x3afeb4[_0xc61a('0x51')]=_[_0xc61a('0x3a')](_0x3afeb4[_0xc61a('0x51')],{'$or':_[_0xc61a('0x45')](_0x3afeb4[_0xc61a('0x4b')],function(_0x2dd007){var _0x19fc8c={};_0x19fc8c[_0x2dd007]={'$like':'%'+_0x2896d7[_0xc61a('0x46')]['filter']+'%'};return _0x19fc8c;})});}_0x3afeb4=_['merge']({},_0x3afeb4,_0x2896d7['options']);return db[_0xc61a('0x6f')][_0xc61a('0x2f')]({'where':_0x3afeb4['where']})[_0xc61a('0x33')](function(_0x77ac12){_0x4bb58a[_0xc61a('0x2f')]=_0x77ac12;if(_0x2896d7[_0xc61a('0x46')][_0xc61a('0x56')]){_0x3afeb4[_0xc61a('0x57')]=[{'all':!![]}];}return db[_0xc61a('0x6f')][_0xc61a('0x58')](_0x3afeb4);})[_0xc61a('0x33')](function(_0x38b2fa){_0x4bb58a[_0xc61a('0x6d')]=_0x38b2fa;return _0x4bb58a;});}})['then'](respondWithFilteredResult(_0x1ed89,_0x3afeb4))[_0xc61a('0x59')](handleError(_0x1ed89,null));};exports['removeAnswers']=function(_0xe3db55,_0x256641,_0x3026c3){return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0xe3db55[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x256641,null))['then'](function(_0x16ae8d){if(_0x16ae8d){return _0x16ae8d['removeAnswers'](_0xe3db55['query'][_0xc61a('0x72')]);}})['then'](respondWithStatusCode(_0x256641,null))[_0xc61a('0x59')](handleError(_0x256641,null));};exports[_0xc61a('0x73')]=function(_0x10b34c,_0x474b12,_0x3895ed){_0x10b34c[_0xc61a('0x5e')][_0xc61a('0x74')]=_0x10b34c['file'][_0xc61a('0x75')];return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x10b34c[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x474b12,null))[_0xc61a('0x33')](saveUpdates(_0x10b34c[_0xc61a('0x5e')],null))[_0xc61a('0x33')](respondWithResult(_0x474b12,null))[_0xc61a('0x59')](handleError(_0x474b12,null));};exports[_0xc61a('0x76')]=function(_0x40bc48,_0xd4664,_0x533e16){_0x40bc48['body']['agentAvatar']=_0x40bc48['file']['filename'];return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x40bc48[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0xd4664,null))[_0xc61a('0x33')](saveUpdates(_0x40bc48[_0xc61a('0x5e')],null))[_0xc61a('0x33')](respondWithResult(_0xd4664,null))[_0xc61a('0x59')](handleError(_0xd4664,null));};exports[_0xc61a('0x77')]=function(_0x19036e,_0x33a3b1,_0x577b10){_0x19036e['body'][_0xc61a('0x78')]=_0x19036e[_0xc61a('0x79')][_0xc61a('0x75')];return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x19036e['params']['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x33a3b1,null))[_0xc61a('0x33')](saveUpdates(_0x19036e['body'],null))[_0xc61a('0x33')](respondWithResult(_0x33a3b1,null))[_0xc61a('0x59')](handleError(_0x33a3b1,null));};exports[_0xc61a('0x7a')]=function(_0x5b0855,_0x1dc304,_0x5027ce){_0x5b0855[_0xc61a('0x5e')][_0xc61a('0x7b')]=_0x5b0855[_0xc61a('0x79')][_0xc61a('0x75')];return db['ChatWebsite'][_0xc61a('0x66')]({'where':{'id':_0x5b0855[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x1dc304,null))[_0xc61a('0x33')](saveUpdates(_0x5b0855['body'],null))['then'](respondWithResult(_0x1dc304,null))[_0xc61a('0x59')](handleError(_0x1dc304,null));};exports[_0xc61a('0x7c')]=function(_0x4881fa,_0x1c6452,_0x46ea70){var _0x17c83f=path[_0xc61a('0x7d')](config['root'],_0xc61a('0x7e'));var _0xa4ab1f={'where':{'id':_0x4881fa[_0xc61a('0x5b')]['id']},'attributes':['id',_0xc61a('0x74')],'raw':!![]};var _0x1b60fc=![];return require('../../config/license/util')['getLicense']()[_0xc61a('0x33')](function(_0x14fab5){if(_0x14fab5){_0x1b60fc=_0x14fab5[_0xc61a('0x7f')];}})[_0xc61a('0x33')](function(){return db[_0xc61a('0x41')][_0xc61a('0x66')](_0xa4ab1f);})['then'](handleEntityNotFound(_0x1c6452,null))[_0xc61a('0x33')](function(_0x20459f){if(_0x20459f){if(!_[_0xc61a('0x80')](_0x20459f[_0xc61a('0x74')])){if(fs[_0xc61a('0x81')](path['join'](config['root'],_0xc61a('0x82'),_0x20459f[_0xc61a('0x74')]))&&_0x1b60fc){_0x17c83f=path['join'](config['root'],_0xc61a('0x82'),_0x20459f['sitepic']);}}return _0x1c6452['download'](_0x17c83f);}})[_0xc61a('0x59')](handleError(_0x1c6452,null));};exports[_0xc61a('0x83')]=function(_0x12efab,_0x3c1f76,_0x573bae){var _0x422321=path[_0xc61a('0x7d')](config[_0xc61a('0x84')],_0xc61a('0x85'));var _0x297a78={'where':{'id':_0x12efab['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xc61a('0x41')][_0xc61a('0x66')](_0x297a78)[_0xc61a('0x33')](handleEntityNotFound(_0x3c1f76,null))[_0xc61a('0x33')](function(_0x32c93a){if(_0x32c93a){if(!_[_0xc61a('0x80')](_0x32c93a['agentAvatar'])){if(fs[_0xc61a('0x81')](path[_0xc61a('0x7d')](config[_0xc61a('0x84')],_0xc61a('0x86'),_0x32c93a['agentAvatar']))){_0x422321=path[_0xc61a('0x7d')](config[_0xc61a('0x84')],_0xc61a('0x86'),_0x32c93a[_0xc61a('0x87')]);}}return _0x3c1f76['download'](_0x422321);}})['catch'](handleError(_0x3c1f76,null));};exports[_0xc61a('0x88')]=function(_0xbea8aa,_0xc1feb7,_0x404020){var _0xbed718=path[_0xc61a('0x7d')](config['root'],_0xc61a('0x89'));var _0x24ab94={'where':{'id':_0xbea8aa[_0xc61a('0x5b')]['id']},'attributes':['id',_0xc61a('0x78'),'showCustomerAvatar'],'raw':!![]};return db[_0xc61a('0x41')][_0xc61a('0x66')](_0x24ab94)[_0xc61a('0x33')](handleEntityNotFound(_0xc1feb7,null))['then'](function(_0x5b1c08){if(_0x5b1c08){if(!_[_0xc61a('0x80')](_0x5b1c08[_0xc61a('0x78')])){if(fs['existsSync'](path['join'](config[_0xc61a('0x84')],_0xc61a('0x86'),_0x5b1c08[_0xc61a('0x78')]))&&_0x5b1c08[_0xc61a('0x8a')]){_0xbed718=path['join'](config[_0xc61a('0x84')],'server/files/images/avatars/',_0x5b1c08[_0xc61a('0x78')]);}}return _0xc1feb7[_0xc61a('0x8b')](_0xbed718);}})['catch'](handleError(_0xc1feb7,null));};exports[_0xc61a('0x8c')]=function(_0x1a1177,_0x3ea991,_0x246cd4){var _0x166897=path[_0xc61a('0x7d')](config[_0xc61a('0x84')],_0xc61a('0x8d'));var _0x1b81a5={'where':{'id':_0x1a1177[_0xc61a('0x5b')]['id']},'attributes':['id',_0xc61a('0x7b')],'raw':!![]};return db[_0xc61a('0x41')]['find'](_0x1b81a5)[_0xc61a('0x33')](handleEntityNotFound(_0x3ea991,null))[_0xc61a('0x33')](function(_0x2f222a){if(_0x2f222a){if(!_[_0xc61a('0x80')](_0x2f222a[_0xc61a('0x7b')])){if(fs[_0xc61a('0x81')](path[_0xc61a('0x7d')](config[_0xc61a('0x84')],_0xc61a('0x86'),_0x2f222a[_0xc61a('0x7b')]))){_0x166897=path[_0xc61a('0x7d')](config[_0xc61a('0x84')],'server/files/images/avatars/',_0x2f222a[_0xc61a('0x7b')]);}}return _0x3ea991[_0xc61a('0x8b')](_0x166897);}})[_0xc61a('0x59')](handleError(_0x3ea991,null));};exports[_0xc61a('0x8e')]=function(_0x52e2a5,_0x14fde9,_0x2df464){var _0x872c40=require(_0xc61a('0x8f'));var _0x471758=new _0x872c40();var _0x5b562e=_0x471758[_0xc61a('0x90')](_0x52e2a5[_0xc61a('0x91')][_0xc61a('0x92')])['getResult']();var _0x1ea773={'body':_0x52e2a5['body'],'channel':_0xc61a('0x93')};var _0x504419=[];var _0x3ab4af=[];var _0x5c0e52={};var _0x26d28d=![];return db['CmContact']['describe']()['then'](function(_0x50016a){if(!_0x50016a){throw new db['Sequelize'][(_0xc61a('0x94'))](_0xc61a('0x95'));}_0x504419=_['difference'](_['keys'](_0x50016a),[_0xc61a('0x96'),'updatedAt']);_0x3ab4af=_[_0xc61a('0x97')](_[_0xc61a('0x5c')](_0x50016a),['createdAt',_0xc61a('0x98'),_0xc61a('0x99'),_0xc61a('0x9a')]);if(_0x52e2a5['body']['id']){delete _0x52e2a5[_0xc61a('0x5e')]['id'];}if(_[_0xc61a('0x80')](_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0x9b')])){throw new db[(_0xc61a('0x9c'))][(_0xc61a('0x94'))](_0xc61a('0x9d'));}if(_['isNil'](_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0x5e')])||_0x52e2a5['body'][_0xc61a('0x5e')]===''){throw new db[(_0xc61a('0x9c'))][(_0xc61a('0x94'))](_0xc61a('0x9e'));}if(_['isNil'](_0x52e2a5['body']['mapKey'])){throw new db['Sequelize'][(_0xc61a('0x94'))](_0xc61a('0x9f')+_0x3ab4af);}if(!_[_0xc61a('0xa0')](_0x3ab4af,_0x52e2a5[_0xc61a('0x5e')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xc61a('0xa1')+_0x3ab4af);}_0x5c0e52[_0x52e2a5[_0xc61a('0x5e')]['mapKey']]=_0x52e2a5[_0xc61a('0x5e')]['from'];})['then'](function(){return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x52e2a5[_0xc61a('0x5b')]['id']},'include':[{'model':db[_0xc61a('0xa2')],'as':_0xc61a('0xa3'),'include':[{'model':db[_0xc61a('0xa4')],'as':_0xc61a('0xa5'),'where':_0x5c0e52,'limit':0x1,'order':[[_0xc61a('0x98'),'DESC']]}]},{'model':db[_0xc61a('0xa6')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x14fde9,null))['then'](function(_0x34432a){if(_0x34432a&&_0x34432a[_0xc61a('0xa3')]){_0x1ea773[_0xc61a('0x3d')]=_0x34432a;_0x1ea773[_0xc61a('0xa7')]=_0x34432a[_0xc61a('0xa8')];_0x1ea773[_0xc61a('0xa9')]=_0x34432a[_0xc61a('0xa3')];_0x1ea773[_0xc61a('0xa7')]=_[_0xc61a('0xaa')](_0x1ea773['applications'],[_0xc61a('0xab')],[_0xc61a('0xac')]);if(_0x1ea773[_0xc61a('0x3d')]['Applications']){delete _0x1ea773[_0xc61a('0x3d')][_0xc61a('0xa8')];}if(_0x1ea773[_0xc61a('0x3d')][_0xc61a('0xa3')]&&_0x1ea773[_0xc61a('0x3d')][_0xc61a('0xa3')][_0xc61a('0xa5')][_0xc61a('0x4c')]){return _0x1ea773[_0xc61a('0x3d')]['List'][_0xc61a('0xa5')][0x0];}var _0x364ee3=_['defaults'](_0x52e2a5['body'],{'firstName':_0x52e2a5['body'][_0xc61a('0x9b')],'ListId':_0x34432a['ListId']});_0x364ee3[_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xad')]]=_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0x9b')];return db[_0xc61a('0xa4')][_0xc61a('0x5d')](_0x364ee3,{'fields':_0x504419,'raw':!![]});}})['then'](handleEntityNotFound(_0x14fde9,null))[_0xc61a('0x33')](function(_0x7f5399){_0x1ea773[_0xc61a('0x3b')]=_0x7f5399;var _0x39a2b6=_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xae')];if(_0x52e2a5[_0xc61a('0x91')]['cf-connecting-ip']){_0x39a2b6=_0x52e2a5['headers'][_0xc61a('0xaf')];}else if(_0x52e2a5['headers'][_0xc61a('0xb0')]){_0x39a2b6=_[_0xc61a('0xb1')](_0x52e2a5[_0xc61a('0x91')][_0xc61a('0xb0')][_0xc61a('0xb2')](','));}if(_0x7f5399){var _0x5156ec={'ContactId':_0x7f5399['id'],'ChatWebsiteId':_0x52e2a5['params']['id'],'from':(_0x7f5399[_0xc61a('0xb3')]||'')+'\x20'+(_0x7f5399[_0xc61a('0xb4')]||''),'customerIp':_0x39a2b6,'customerPort':_0x52e2a5[_0xc61a('0x91')]['x-real-port']?_0x52e2a5[_0xc61a('0x91')][_0xc61a('0xb5')]:null,'referer':_0x52e2a5[_0xc61a('0x5e')]['referer'],'browserName':_0x5b562e[_0xc61a('0xb6')]['name']&&_0x5b562e['browser'][_0xc61a('0xb7')]?util[_0xc61a('0xb8')](_0xc61a('0xb9'),_0x5b562e[_0xc61a('0xb6')][_0xc61a('0x38')],_0x5b562e[_0xc61a('0xb6')][_0xc61a('0xb7')]):_0xc61a('0xba'),'browserVersion':_0x5b562e[_0xc61a('0xb6')][_0xc61a('0xb7')]||'unknown','osName':util[_0xc61a('0xb8')](_0xc61a('0xb9'),_0x5b562e['os'][_0xc61a('0x38')],_0x5b562e['os']['version']),'osVersion':_0x5b562e['os']['version'],'deviceModel':_0x5b562e[_0xc61a('0xbb')][_0xc61a('0x49')]&&_0x5b562e[_0xc61a('0xbb')][_0xc61a('0xbc')]?util[_0xc61a('0xb8')](_0xc61a('0xbd'),_0x5b562e[_0xc61a('0xbb')][_0xc61a('0x49')],_0x5b562e['device'][_0xc61a('0xbc')],_0x5b562e[_0xc61a('0xbb')]['type']):null,'deviceVendor':_0x5b562e[_0xc61a('0xbb')][_0xc61a('0xbc')],'deviceType':_0x5b562e['device']['type'],'formData':JSON['stringify'](_0x52e2a5[_0xc61a('0x5e')])};var _0x48485e={'ChatWebsiteId':_0x52e2a5['params']['id'],'closed':![]};if(_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xbe')]){_0x48485e[_0xc61a('0xbe')]=_0x52e2a5['body'][_0xc61a('0xbe')];return db[_0xc61a('0xbf')][_0xc61a('0x66')]({'where':_0x48485e})['then'](function(_0x23232b){if(_0x23232b){return[_0x23232b,![]];}_0x5156ec[_0xc61a('0xbe')]=_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xbe')];_0x5156ec['externalUrl']=_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xc0')];return db['ChatInteraction'][_0xc61a('0x5d')](_0x5156ec)[_0xc61a('0x33')](function(_0x10871d){return[_0x10871d,!![]];});});}_0x48485e[_0xc61a('0xc1')]=_0x7f5399['id'];if(_0x52e2a5['body']['interaction']&&_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xc2')]['id']){_0x48485e['id']=_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xc2')]['id'];return db['ChatInteraction'][_0xc61a('0x66')]({'where':_0x48485e})[_0xc61a('0x33')](function(_0x152148){if(_0x152148){return[_0x152148,![]];}return db[_0xc61a('0xbf')][_0xc61a('0x5d')](_0x5156ec)[_0xc61a('0x33')](function(_0x32ff8e){return[_0x32ff8e,!![]];});});}return db[_0xc61a('0xbf')]['create'](_0x5156ec)[_0xc61a('0x33')](function(_0x2733de){return[_0x2733de,!![]];});}})[_0xc61a('0xc3')](function(_0x1cf79c,_0x28f8bd){if(_0x1cf79c){_0x26d28d=_0x28f8bd;if(!_0x28f8bd){var _0x453315={'from':(_0x1ea773['contact']['firstName']||'')+'\x20'+(_0x1ea773[_0xc61a('0x3b')][_0xc61a('0xb4')]||'')};if(_0x52e2a5['body']['threadId']&&_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xc4')]&&_0x52e2a5['body'][_0xc61a('0xbe')]!=_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xc4')]){_0x453315['threadId']=_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xc4')];}return _0x1cf79c[_0xc61a('0xc5')](_0x453315);}else{return _0x1cf79c;}}})[_0xc61a('0x33')](function(_0x55fd4a){_0x1ea773[_0xc61a('0xc2')]=_0x55fd4a['get']({'plain':!![]});_0x1ea773[_0xc61a('0xc2')]['created']=_0x26d28d;if(_0x1ea773['interaction'][_0xc61a('0xc6')]){if(_0x1ea773[_0xc61a('0x3d')][_0xc61a('0xc7')]){_0x1ea773[_0xc61a('0xa7')][_0xc61a('0xc8')]({'id':0x0,'priority':_0x1ea773[_0xc61a('0xa7')][_0xc61a('0x4c')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db['ChatMessage'][_0xc61a('0x5d')]({'body':_0x52e2a5['body'][_0xc61a('0x5e')],'ChatWebsiteId':_0x52e2a5['params']['id'],'ChatInteractionId':_0x55fd4a['id'],'direction':'in','ContactId':_0x1ea773['contact']['id'],'AttachmentId':_0x52e2a5['body']['AttachmentId']});})[_0xc61a('0x33')](function(_0x5964aa){_0x1ea773[_0xc61a('0x27')]=_0x5964aa;if(_0x1ea773['interaction'][_0xc61a('0xc9')]){return db[_0xc61a('0xca')][_0xc61a('0x66')]({'attributes':['id',_0xc61a('0x38')],'where':{'id':_0x1ea773[_0xc61a('0xc2')]['UserId']}})[_0xc61a('0x33')](function(_0x5d7519){if(_0x5d7519){_0x1ea773[_0xc61a('0xa7')][_0xc61a('0xcb')]({'id':0x0,'priority':0x0,'app':_0xc61a('0x3c'),'appdata':_0x5d7519[_0xc61a('0x38')]+','+(_0x1ea773[_0xc61a('0x3d')][_0xc61a('0xcc')]||0xa),'interval':_0xc61a('0xcd')});_0x1ea773[_0xc61a('0xce')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x1ea773);});}return respondWithRpcPromise(_0xc61a('0xcf'),_0xc61a('0xd0'),_0x1ea773);})['then'](function(_0x2ed169){respondWithRpcPromise(_0xc61a('0xd1'),_0xc61a('0xd1'),{'event':_0xc61a('0x8e'),'message':_0x2ed169},client9002);return _0x2ed169;})[_0xc61a('0x33')](respondWithResult(_0x14fde9,null))['catch'](handleError(_0x14fde9,null));};exports[_0xc61a('0xd2')]=function(_0x22752d,_0x3576b1,_0x2f73a1){var _0x430d3e,_0x12205a,_0x3731df;var _0xdb2cd5=[];var _0x1725d6=[];var _0x168874={};var _0x19d501=_0x22752d['files']||[];var _0x4a0d48=[];var _0x26c5a2;return db[_0xc61a('0xa4')]['describe']()[_0xc61a('0x33')](function(_0x8f89f5){if(!_0x8f89f5){throw new db[(_0xc61a('0x9c'))][(_0xc61a('0x94'))](_0xc61a('0x95'));}_0x1725d6=_[_0xc61a('0x97')](_[_0xc61a('0x5c')](_0x8f89f5),[_0xc61a('0x96'),_0xc61a('0x98')]);_0xdb2cd5=_[_0xc61a('0x97')](_[_0xc61a('0x5c')](_0x8f89f5),[_0xc61a('0x96'),_0xc61a('0x98'),'CompanyId',_0xc61a('0x9a')]);if(_0x22752d[_0xc61a('0x5e')]['id']){delete _0x22752d[_0xc61a('0x5e')]['id'];}if(_['isNil'](_0x22752d[_0xc61a('0x5e')][_0xc61a('0x9b')])){throw _0x3576b1['status'](0x1f4)[_0xc61a('0xd3')](new db[(_0xc61a('0x9c'))][(_0xc61a('0x94'))](_0xc61a('0x9d')));}if(_[_0xc61a('0x80')](_0x22752d['body']['body'])||_0x22752d[_0xc61a('0x5e')][_0xc61a('0x5e')]===''){throw _0x3576b1[_0xc61a('0x29')](0x1f4)['send'](new db[(_0xc61a('0x9c'))][(_0xc61a('0x94'))](_0xc61a('0x9e')));}if(_['isNil'](_0x22752d[_0xc61a('0x5e')]['mapKeyOffline'])){throw _0x3576b1[_0xc61a('0x29')](0x1f4)['send'](new db[(_0xc61a('0x9c'))][(_0xc61a('0x94'))](_0xc61a('0xd4')+_0xdb2cd5));}if(!_[_0xc61a('0xa0')](_0xdb2cd5,_0x22752d[_0xc61a('0x5e')][_0xc61a('0xd5')])){throw _0x3576b1[_0xc61a('0x29')](0x1f4)[_0xc61a('0xd3')](new db[(_0xc61a('0x9c'))][(_0xc61a('0x94'))](_0xc61a('0xd6')+_0xdb2cd5));}_0x168874[_0x22752d[_0xc61a('0x5e')][_0xc61a('0xd5')]]=_0x22752d['body'][_0xc61a('0x9b')];})['then'](function(){return db['ChatWebsite'][_0xc61a('0x66')]({'where':{'id':_0x22752d['params']['id']},'include':[{'model':db[_0xc61a('0xa2')],'as':_0xc61a('0xa3')},{'model':db[_0xc61a('0xd7')],'as':_0xc61a('0xd7')}]});})[_0xc61a('0x33')](handleEntityNotFound(_0x3576b1,null))['then'](function(_0x17c6b7){if(_0x17c6b7&&_0x17c6b7[_0xc61a('0xa3')]){_0x12205a=_0x17c6b7;var _0x474661=_['defaults'](_0x22752d[_0xc61a('0x5e')],{'firstName':_0x22752d[_0xc61a('0x5e')][_0xc61a('0x9b')],'phone':_0x22752d['body'][_0xc61a('0x9b')],'ListId':_0x17c6b7[_0xc61a('0x9a')]});_0x474661[_0x22752d[_0xc61a('0x5e')][_0xc61a('0xd5')]]=_0x22752d[_0xc61a('0x5e')][_0xc61a('0x9b')];return db[_0xc61a('0xa4')][_0xc61a('0xd8')]({'where':_0x168874,'defaults':_0x474661});}})[_0xc61a('0xc3')](function(_0x12107b){if(_0x12107b){_0x3731df=_0x12107b;var _0x5c0e0c=fs[_0xc61a('0xd9')](path['join'](config['root'],'server/files/templates/chatOfflineMessage.ejs'),_0xc61a('0xda'));var _0xfc2a59=ejs[_0xc61a('0x39')](_0x5c0e0c,{'body':_[_0xc61a('0xdb')](_0x22752d[_0xc61a('0x5e')]['body']),'bodyTitle':_0x12205a['offlineMessageBody']});return db['ChatOfflineMessage']['create']({'body':_0xfc2a59,'ContactId':_0x12107b['id'],'ChatWebsiteId':_0x12205a['id']});}})[_0xc61a('0x33')](function(_0xf2a8fd){_0x26c5a2=_0xf2a8fd;if(_0x19d501[_0xc61a('0x4c')]){var _0xfb3e09=_0x19d501[_0xc61a('0x45')](function(_0xd3a37){return{'name':_0xd3a37[_0xc61a('0xdc')],'basename':_0xd3a37[_0xc61a('0x75')],'type':_0xd3a37[_0xc61a('0xdd')],'ChatOfflineMessageId':_0xf2a8fd['id']};});_0x4a0d48=_0xfb3e09['map'](_0x444afd=>{var _0x306341={'filename':_0x444afd['name'],'path':path[_0xc61a('0x7d')](config[_0xc61a('0x84')],_0xc61a('0xde'),_0xc61a('0xdf'),_0xc61a('0xe0'),_0xc61a('0xe1'),_0x444afd['basename'])};return _0x306341;});if(!_0x12205a['openNewInteraction']){return db['sequelize'][_0xc61a('0xe2')](function(_0x1750e4){return db['Attachment'][_0xc61a('0xe3')](_0xfb3e09,{'transaction':_0x1750e4});});}}})['then'](function(){if(_0x26c5a2){_0x430d3e=_0x26c5a2;return db[_0xc61a('0xd7')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0xc61a('0xe4')],'as':_0xc61a('0xe5'),'raw':!![]}]});}})[_0xc61a('0x33')](function(_0x6dbb50){if(_0x6dbb50&&_0x6dbb50[_0xc61a('0xe5')]&&_0x12205a['forwardOffline']&&_0x12205a['forwardOfflineAddress']){var _0x1ef54e={'tls':{'rejectUnauthorized':![]}};if(_0x6dbb50[_0xc61a('0xe5')][_0xc61a('0xe6')]){_0x1ef54e['service']=_0x6dbb50['Smtp'][_0xc61a('0xe6')];}else{_0x1ef54e[_0xc61a('0xe7')]=_0x6dbb50[_0xc61a('0xe5')]['host'];_0x1ef54e[_0xc61a('0xe8')]=_0x6dbb50[_0xc61a('0xe5')][_0xc61a('0xe8')];_0x1ef54e[_0xc61a('0xe9')]=_0x6dbb50[_0xc61a('0xe5')]['secure'];}if(_0x6dbb50[_0xc61a('0xe5')]['authentication']){_0x1ef54e[_0xc61a('0xea')]={'user':_0x6dbb50[_0xc61a('0xe5')][_0xc61a('0x5f')],'pass':_0x6dbb50[_0xc61a('0xe5')][_0xc61a('0xeb')]};}return respondWithRpcPromise(_0xc61a('0xec'),'sendMail',{'account':_0x1ef54e,'message':{'from':util[_0xc61a('0xb8')]('\x22%s\x22\x20<%s>',_0x6dbb50[_0xc61a('0x38')],_0x6dbb50[_0xc61a('0xed')]||_0x6dbb50[_0xc61a('0xe5')][_0xc61a('0x5f')]),'to':_0x12205a[_0xc61a('0xee')],'subject':_0x12205a[_0xc61a('0xef')],'html':_0x430d3e[_0xc61a('0x5e')],'attachments':_0x4a0d48}},client9003)[_0xc61a('0x33')](function(){return _0x430d3e;})[_0xc61a('0x59')](function(_0x228448){console[_0xc61a('0x25')](_0x228448);});}})[_0xc61a('0x33')](function(){if(_0x12205a&&_0x12205a[_0xc61a('0xf0')]&&_0x12205a['MailAccountId']){var _0x20eabb=[];if(_0x19d501[_0xc61a('0x4c')]){_0x20eabb=_0x19d501['map'](function(_0x2b07f9){return{'name':_0x2b07f9[_0xc61a('0xdc')],'basename':_0x2b07f9[_0xc61a('0x75')],'type':_0x2b07f9[_0xc61a('0xdd')],'ChatOfflineMessageId':_0x26c5a2['id']};});}var _0x31bd97;if(!_['isNil'](_0x12205a[_0xc61a('0xf1')])){var _0x3ae74d=_[_0xc61a('0x45')](_0x22752d[_0xc61a('0x5e')],function(_0x50e859){return _0x50e859;});var _0xd98853=_[_0xc61a('0xf2')](_0x3ae74d)[0x0];var _0x119992=_[_0xc61a('0xf3')](_0xd98853,function(_0x389571){return _0x389571;});_0x31bd97=_0x119992[0x1][_0x12205a['subjectOffline']];}var _0x34253f={'from':_0x3731df[_0xc61a('0xed')],'firstName':_0x3731df[_0xc61a('0xb3')],'lastName':_0x3731df['lastName'],'mapKey':_0xc61a('0xed'),'message':{'from':_0x3731df[_0xc61a('0xed')],'to':_0x12205a[_0xc61a('0xd7')][_0xc61a('0xed')],'cc':'','subject':_['isNil'](_0x31bd97)?_0x12205a[_0xc61a('0xef')]:_0x31bd97,'messageId':'','sentAt':new Date(),'attach':_0x20eabb[_0xc61a('0x4c')],'attachments':_0x20eabb,'originChannel':_0xc61a('0xf4'),'ChatWebsiteId':_0x12205a['id'],'ChatOfflineMessageId':_0x430d3e['id'],'originTo':_0x12205a['MailAccount'][_0xc61a('0xed')]},'body':_0x430d3e[_0xc61a('0x5e')]};var _0x1bbcd2={'account':{'id':_0x12205a[_0xc61a('0xf5')]},'body':_0x34253f,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xc61a('0xf6'),_0xc61a('0xf7'),_0x1bbcd2,client9001)['then'](function(){return _0x430d3e;})[_0xc61a('0x59')](function(_0x2c5e4c){console[_0xc61a('0x25')](_0x2c5e4c);});}return;})[_0xc61a('0x33')](function(){if(_0x430d3e){return _0x430d3e;}})[_0xc61a('0x33')](respondWithResult(_0x3576b1,null))[_0xc61a('0x59')](function(_0x22024c){console[_0xc61a('0x25')](_0xc61a('0x59'),_0x22024c);for(var _0x2d059a of _0x19d501){var _0x559d79=path[_0xc61a('0x7d')](config[_0xc61a('0x84')],'server',_0xc61a('0xdf'),_0xc61a('0xe0'),'offline-chat',_0x2d059a['filename']);fs_extra[_0xc61a('0xf8')](_0x559d79)['catch'](function(_0xcf8d0c){console[_0xc61a('0x25')]('Could\x20not\x20remove\x20attachment\x20file',_0x559d79,_0xcf8d0c);});}});};exports[_0xc61a('0xf9')]=function(_0x2b8065,_0x26ea79,_0x119dcc){return db[_0xc61a('0xbf')][_0xc61a('0x66')]({'where':{'id':_0x2b8065['params']['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x26ea79,null))[_0xc61a('0x33')](function(_0x39161e){if(_0x39161e){return _0x39161e[_0xc61a('0xf9')](_0x2b8065[_0xc61a('0x5e')][_0xc61a('0x72')],_['omit'](_0x2b8065[_0xc61a('0x5e')],[_0xc61a('0x72'),'id'])||{});}})[_0xc61a('0x33')](respondWithResult(_0x26ea79,null))['catch'](handleError(_0x26ea79,null));};exports[_0xc61a('0xfa')]=function(_0x35cd5f,_0x19d6bc,_0x2aa576){var _0x38a206={'raw':![],'where':{}};var _0x16da39={};var _0x3b7827={'count':0x0,'rows':[]};return db[_0xc61a('0x41')][_0xc61a('0x6b')]({'where':{'id':_0x35cd5f[_0xc61a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x19d6bc,null))['then'](function(_0x117eda){if(_0x117eda){_0x16da39[_0xc61a('0x49')]=_[_0xc61a('0x5c')](db[_0xc61a('0xbf')]['rawAttributes']);_0x16da39[_0xc61a('0x46')]=_['keys'](_0x35cd5f[_0xc61a('0x46')]);_0x16da39[_0xc61a('0x47')]=_['intersection'](_0x16da39['model'],_0x16da39[_0xc61a('0x46')]);_0x38a206['attributes']=_['intersection'](_0x16da39[_0xc61a('0x49')],qs[_0xc61a('0x4a')](_0x35cd5f['query'][_0xc61a('0x4a')]));_0x38a206[_0xc61a('0x4b')]=_0x38a206[_0xc61a('0x4b')][_0xc61a('0x4c')]?_0x38a206['attributes']:_0x16da39[_0xc61a('0x49')];if(!_0x35cd5f['query'][_0xc61a('0x4d')](_0xc61a('0x4e'))){_0x38a206['limit']=qs['limit'](_0x35cd5f[_0xc61a('0x46')][_0xc61a('0x2e')]);_0x38a206['offset']=qs[_0xc61a('0x2c')](_0x35cd5f[_0xc61a('0x46')][_0xc61a('0x2c')]);}_0x38a206[_0xc61a('0x4f')]=qs[_0xc61a('0x50')](_0x35cd5f[_0xc61a('0x46')][_0xc61a('0x50')]);_0x38a206[_0xc61a('0x51')]=qs['filters'](_[_0xc61a('0x52')](_0x35cd5f['query'],_0x16da39[_0xc61a('0x47')]));_0x38a206[_0xc61a('0x51')][_0xc61a('0x71')]=_0x117eda['id'];if(_0x35cd5f[_0xc61a('0x46')][_0xc61a('0x53')]){_0x38a206[_0xc61a('0x51')]=_[_0xc61a('0x3a')](_0x38a206[_0xc61a('0x51')],{'$or':_[_0xc61a('0x45')](_0x38a206['attributes'],function(_0x4b1d22){var _0x2348f9={};_0x2348f9[_0x4b1d22]={'$like':'%'+_0x35cd5f[_0xc61a('0x46')]['filter']+'%'};return _0x2348f9;})});}_0x38a206=_[_0xc61a('0x3a')]({},_0x38a206,_0x35cd5f[_0xc61a('0x6c')]);return db[_0xc61a('0xbf')][_0xc61a('0x2f')]({'where':_0x38a206[_0xc61a('0x51')]})['then'](function(_0x38d8e2){_0x3b7827['count']=_0x38d8e2;if(_0x35cd5f['query']['includeAll']){_0x38a206['include']=[{'model':db[_0xc61a('0xa4')],'as':'Contact','required':![]},{'model':db[_0xc61a('0xca')],'as':_0xc61a('0xfb'),'attributes':['name',_0xc61a('0xfc'),'internal'],'required':![]},{'model':db[_0xc61a('0xfd')],'as':'Tags','attributes':['id',_0xc61a('0x38'),_0xc61a('0xfe')],'where':_0x35cd5f[_0xc61a('0x46')][_0xc61a('0xff')]?{'id':_0x35cd5f[_0xc61a('0x46')]['tag']}:undefined,'required':_0x35cd5f[_0xc61a('0x46')]['tag']?!![]:![]}];}return db[_0xc61a('0xbf')][_0xc61a('0x58')](_0x38a206);})[_0xc61a('0x33')](function(_0x1ffa9e){_0x3b7827[_0xc61a('0x6d')]=_0x1ffa9e;return _0x3b7827;});}})[_0xc61a('0x33')](respondWithFilteredResult(_0x19d6bc,_0x38a206))['catch'](handleError(_0x19d6bc,null));};function iftimePromise(_0x4be3d5,_0x511e73){return respondWithRpcPromise(_0xc61a('0x100'),_0xc61a('0x101'),{'command':_0x511e73[_0xc61a('0x102')]?util['format'](_0xc61a('0x103'),_0x4be3d5[_0xc61a('0x104')],_0x511e73['timezone']):util[_0xc61a('0xb8')](_0xc61a('0x105'),_0x4be3d5['interval'])},client9002)[_0xc61a('0x33')](function(_0x17953c){var _0x4630a1=_0x17953c&&_0x17953c[_0xc61a('0x106')](_0xc61a('0x107'))>=0x0?!![]:![];logger[_0xc61a('0x108')](_0xc61a('0x109'),_0x511e73['id'],_0x4be3d5['id'],_0x4be3d5[_0xc61a('0x104')],_0x4630a1?_0xc61a('0x10a'):_0xc61a('0x10b'),_0x511e73[_0xc61a('0x102')]?_0x511e73['timezone']:_0xc61a('0x10c'));return _0x4630a1;})[_0xc61a('0x59')](function(_0x4a4a19){logger[_0xc61a('0x25')](_0xc61a('0x109'),_0x511e73['id'],_0x4be3d5['id'],_0x4be3d5[_0xc61a('0x104')],util[_0xc61a('0x10d')](_0x4a4a19,{'showHidden':![],'depth':null}),_0x511e73[_0xc61a('0x102')]?_0x511e73[_0xc61a('0x102')]:_0xc61a('0x10c'));return![];});}exports[_0xc61a('0x101')]=function(_0x8ad648,_0x28f2d7,_0x3c89b5){var _0x1f89e3=0x0;var _0x229b9f=0x0;var _0x1bd06c=![];var _0x47e973;var _0x214375;return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x8ad648[_0xc61a('0x5b')]['id']},'include':[{'model':db[_0xc61a('0x10e')],'as':'Interval','include':[{'model':db[_0xc61a('0x10e')],'as':_0xc61a('0x10f'),'attributes':['id',_0xc61a('0x104')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x28f2d7,null))[_0xc61a('0x33')](function(_0x262bfb){if(_0x262bfb){_0x47e973=_0x262bfb;return _0x262bfb[_0xc61a('0x110')]({'raw':!![]});}})[_0xc61a('0x33')](function(_0x205680){if(_0x47e973){if(_0x205680){_0x214375=_0x205680;}}return require(_0xc61a('0x18'))[_0xc61a('0x111')]();})[_0xc61a('0x33')](function(_0x310921){if(_0x310921){_0x229b9f=_0x310921[_0xc61a('0x112')];_0x1bd06c=_0x310921[_0xc61a('0x7f')];}})['then'](function(){return db[_0xc61a('0xbf')]['count']({'where':{'closed':![]}});})[_0xc61a('0x33')](function(_0x4434c5){_0x1f89e3=_0x4434c5;if(_0x229b9f&&_0x4434c5>_0x229b9f){return db[_0xc61a('0x113')][_0xc61a('0x6b')]({'where':{'id':0x1}})[_0xc61a('0x33')](function(_0x3dc080){if(_0x3dc080){_0x3dc080['increment'](_0xc61a('0x114'));}});}})['then'](function(){if(_0x47e973[_0xc61a('0x10e')]&&_0x47e973['Interval'][_0xc61a('0x10f')]){var _0x5e32fe=[];for(var _0x4349a2=0x0;_0x4349a2<_0x47e973['Interval'][_0xc61a('0x10f')]['length'];_0x4349a2++){var _0x19d37e=_0x47e973['Interval']['Intervals'][_0x4349a2][_0xc61a('0x60')]({'plain':!![]});_0x5e32fe[_0xc61a('0xc8')](iftimePromise(_0x19d37e,_0x47e973));}return BPromise[_0xc61a('0x115')](_0x5e32fe)[_0xc61a('0x33')](function(_0x561515){return _[_0xc61a('0x116')](_0x561515);});}else{return!![];}})[_0xc61a('0x33')](function(_0x27f4f9){var _0x58f2ad=fs[_0xc61a('0xd9')](path[_0xc61a('0x7d')](config[_0xc61a('0x84')],_0xc61a('0x117')),_0xc61a('0xda'));var _0x4cd194={'remote':_0x47e973[_0xc61a('0x118')],'query':querystring[_0xc61a('0x24')](_[_0xc61a('0x3a')](_0x47e973['get']({'plain':!![]}),{'customerIp':_0x8ad648[_0xc61a('0x91')][_0xc61a('0xb0')]||_0x8ad648[_0xc61a('0x91')][_0xc61a('0x119')]||_0x8ad648['connection'][_0xc61a('0x11a')]||_0x8ad648['ip'],'referer':_0x8ad648['headers'][_0xc61a('0x11b')],'openedInteractions':_0x1f89e3,'maxInteractions':_0x229b9f,'virtual':_0x1bd06c['virtual'],'online':_0x27f4f9,'custom':_0x1bd06c}))[_0xc61a('0x11c')](/'/g,'\x5c\x27')};_0x28f2d7[_0xc61a('0xd3')](ejs[_0xc61a('0x39')](Mustache[_0xc61a('0x39')](_0x58f2ad,_0x4cd194),{'proactiveActions':_0x214375,'alignment':_0x47e973[_0xc61a('0x11d')],'verticalAlignment':_0x47e973['verticalAlignment'],'div_color':_0x47e973[_0xc61a('0xfe')],'text_color':_0x47e973[_0xc61a('0x11e')],'button_color':_0x47e973[_0xc61a('0x11f')],'background_color':_0x47e973[_0xc61a('0x120')]}));})[_0xc61a('0x59')](handleError(_0x28f2d7,null));};exports['addApplications']=function(_0x44dce8,_0x2fcabb,_0x27b2bb){return db[_0xc61a('0x41')][_0xc61a('0x6b')]({'where':{'id':_0x44dce8[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x2fcabb,null))[_0xc61a('0x33')](function(_0x13626d){if(_0x13626d){return db[_0xc61a('0x121')]['transaction'](function(_0x19f1b5){return db[_0xc61a('0xa6')][_0xc61a('0x34')]({'where':{'ChatWebsiteId':_0x44dce8[_0xc61a('0x5b')]['id']},'transaction':_0x19f1b5})[_0xc61a('0x33')](function(_0x3d16e9){var _0xc4f189=_['map'](_0x44dce8[_0xc61a('0x5e')],function(_0x2a3d1f){_0x2a3d1f[_0xc61a('0x71')]=_0x44dce8[_0xc61a('0x5b')]['id'];return _0x2a3d1f;});return db['ChatApplication']['bulkCreate'](_0xc4f189,{'transaction':_0x19f1b5});});})[_0xc61a('0x33')](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x44dce8[_0xc61a('0x5b')]['id']},'order':_0xc61a('0xab')});});}})[_0xc61a('0x33')](respondWithResult(_0x2fcabb,null))[_0xc61a('0x59')](handleError(_0x2fcabb,null));};exports[_0xc61a('0x122')]=function(_0x5eecee,_0x50be69,_0x18ae33){var _0x1b8119={};var _0x4a9c3a={};var _0x413caf;var _0x5d05c4;return db['ChatWebsite'][_0xc61a('0x6b')]({'where':{'id':_0x5eecee['params']['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x50be69,null))[_0xc61a('0x33')](function(_0xb5dccd){if(_0xb5dccd){_0x413caf=_0xb5dccd;_0x4a9c3a[_0xc61a('0x49')]=_[_0xc61a('0x5c')](db[_0xc61a('0xa6')][_0xc61a('0x42')]);_0x4a9c3a['query']=_['keys'](_0x5eecee[_0xc61a('0x46')]);_0x4a9c3a[_0xc61a('0x47')]=_['intersection'](_0x4a9c3a[_0xc61a('0x49')],_0x4a9c3a[_0xc61a('0x46')]);_0x1b8119[_0xc61a('0x4b')]=_[_0xc61a('0x48')](_0x4a9c3a['model'],qs[_0xc61a('0x4a')](_0x5eecee['query']['fields']));_0x1b8119[_0xc61a('0x4b')]=_0x1b8119[_0xc61a('0x4b')][_0xc61a('0x4c')]?_0x1b8119[_0xc61a('0x4b')]:_0x4a9c3a[_0xc61a('0x49')];_0x1b8119[_0xc61a('0x4f')]=qs[_0xc61a('0x50')](_0x5eecee[_0xc61a('0x46')][_0xc61a('0x50')]);_0x1b8119[_0xc61a('0x51')]=qs[_0xc61a('0x47')](_[_0xc61a('0x52')](_0x5eecee[_0xc61a('0x46')],_0x4a9c3a[_0xc61a('0x47')]));if(_0x5eecee['query'][_0xc61a('0x53')]){_0x1b8119[_0xc61a('0x51')]=_[_0xc61a('0x3a')](_0x1b8119[_0xc61a('0x51')],{'$or':_['map'](_0x1b8119['attributes'],function(_0x160d7b){var _0x4c9b8b={};_0x4c9b8b[_0x160d7b]={'$like':'%'+_0x5eecee['query'][_0xc61a('0x53')]+'%'};return _0x4c9b8b;})});}_0x1b8119=_[_0xc61a('0x3a')]({},_0x1b8119,_0x5eecee['options']);return _0x413caf['getApplications'](_0x1b8119);}})[_0xc61a('0x33')](function(_0x9c75b){if(_0x9c75b){_0x5d05c4=_0x9c75b[_0xc61a('0x4c')];if(!_0x5eecee['query']['hasOwnProperty'](_0xc61a('0x4e'))){_0x1b8119[_0xc61a('0x2e')]=qs[_0xc61a('0x2e')](_0x5eecee['query'][_0xc61a('0x2e')]);_0x1b8119[_0xc61a('0x2c')]=qs[_0xc61a('0x2c')](_0x5eecee[_0xc61a('0x46')][_0xc61a('0x2c')]);}return _0x413caf[_0xc61a('0x122')](_0x1b8119);}})[_0xc61a('0x33')](function(_0x3946b1){if(_0x3946b1){return _0x3946b1?{'count':_0x5d05c4,'rows':_0x3946b1}:null;}})[_0xc61a('0x33')](respondWithResult(_0x50be69,null))[_0xc61a('0x59')](handleError(_0x50be69,null));};exports['addProactiveActions']=function(_0x10dd90,_0x4a7814,_0x33a816){return db[_0xc61a('0x123')]['find']({'where':{'id':_0x10dd90[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x4a7814,null))[_0xc61a('0x33')](function(_0x19ec15){if(_0x19ec15){return _0x19ec15['addProactiveActions'](_0x10dd90['body'][_0xc61a('0x72')],_[_0xc61a('0x124')](_0x10dd90[_0xc61a('0x5e')],[_0xc61a('0x72'),'id'])||{});}})[_0xc61a('0x33')](respondWithResult(_0x4a7814,null))[_0xc61a('0x59')](handleError(_0x4a7814,null));};exports[_0xc61a('0x110')]=function(_0x282de7,_0x7a2712,_0xfe2396){var _0x2828ef={};var _0xbc994e={};var _0x2959b3;var _0x8b59fe;return db['ChatWebsite'][_0xc61a('0x6b')]({'where':{'id':_0x282de7[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x7a2712,null))[_0xc61a('0x33')](function(_0x33e828){if(_0x33e828){_0x2959b3=_0x33e828;_0xbc994e[_0xc61a('0x49')]=_[_0xc61a('0x5c')](db[_0xc61a('0x125')][_0xc61a('0x42')]);_0xbc994e[_0xc61a('0x46')]=_['keys'](_0x282de7[_0xc61a('0x46')]);_0xbc994e[_0xc61a('0x47')]=_['intersection'](_0xbc994e[_0xc61a('0x49')],_0xbc994e['query']);_0x2828ef[_0xc61a('0x4b')]=_[_0xc61a('0x48')](_0xbc994e['model'],qs[_0xc61a('0x4a')](_0x282de7[_0xc61a('0x46')]['fields']));_0x2828ef[_0xc61a('0x4b')]=_0x2828ef[_0xc61a('0x4b')][_0xc61a('0x4c')]?_0x2828ef[_0xc61a('0x4b')]:_0xbc994e['model'];_0x2828ef[_0xc61a('0x4f')]=qs['sort'](_0x282de7[_0xc61a('0x46')][_0xc61a('0x50')]);_0x2828ef[_0xc61a('0x51')]=qs[_0xc61a('0x47')](_['pick'](_0x282de7[_0xc61a('0x46')],_0xbc994e[_0xc61a('0x47')]));if(_0x282de7[_0xc61a('0x46')]['filter']){_0x2828ef['where']=_[_0xc61a('0x3a')](_0x2828ef['where'],{'$or':_[_0xc61a('0x45')](_0x2828ef[_0xc61a('0x4b')],function(_0x3104dc){var _0xb2521b={};_0xb2521b[_0x3104dc]={'$like':'%'+_0x282de7['query'][_0xc61a('0x53')]+'%'};return _0xb2521b;})});}_0x2828ef=_['merge']({},_0x2828ef,_0x282de7['options']);return _0x2959b3['getProactiveActions'](_0x2828ef);}})['then'](function(_0x5af2f3){if(_0x5af2f3){_0x8b59fe=_0x5af2f3[_0xc61a('0x4c')];if(!_0x282de7[_0xc61a('0x46')]['hasOwnProperty'](_0xc61a('0x4e'))){_0x2828ef[_0xc61a('0x2e')]=qs[_0xc61a('0x2e')](_0x282de7[_0xc61a('0x46')][_0xc61a('0x2e')]);_0x2828ef[_0xc61a('0x2c')]=qs[_0xc61a('0x2c')](_0x282de7[_0xc61a('0x46')][_0xc61a('0x2c')]);}return _0x2959b3[_0xc61a('0x110')](_0x2828ef);}})[_0xc61a('0x33')](function(_0x99b0ae){if(_0x99b0ae){return _0x99b0ae?{'count':_0x8b59fe,'rows':_0x99b0ae}:null;}})[_0xc61a('0x33')](respondWithResult(_0x7a2712,null))[_0xc61a('0x59')](handleError(_0x7a2712,null));};exports[_0xc61a('0x126')]=function(_0x3b45b7,_0x3b9e36,_0x188244){var _0xecd723=_0x3b45b7[_0xc61a('0x46')]['online']===_0xc61a('0x127')?_0xc61a('0x128'):_0xc61a('0x129');return db['ChatWebsite'][_0xc61a('0x66')]({'attributes':['id',_0xecd723],'where':{'id':_0x3b45b7['params']['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x3b9e36,null))[_0xc61a('0x33')](function(_0x46c2e1){if(_0x46c2e1){var _0x2f2596=_0x46c2e1[_0xecd723];var _0x3f02e6=_0x2f2596&&_0x2f2596['items']?_0x2f2596[_0xc61a('0x12a')]:[];_0x3b9e36[_0xc61a('0xd3')]({'fromKey':_[_0xc61a('0x80')](_0x2f2596[_0xc61a('0x12b')])?undefined:_0x2f2596[_0xc61a('0x12b')],'count':_0x3f02e6[_0xc61a('0x4c')],'rows':_0x3f02e6});}})[_0xc61a('0x59')](handleError(_0x3b9e36,null));};exports[_0xc61a('0x12c')]=function(_0x192331,_0x34e5b7,_0x12a215){var _0x23b93c={'raw':![],'where':{}};var _0x246f41={};var _0x1260b7={'count':0x0,'rows':[]};return db[_0xc61a('0x41')][_0xc61a('0x6b')]({'where':{'id':_0x192331['params']['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x34e5b7,null))['then'](function(_0x10862f){if(_0x10862f){_0x246f41[_0xc61a('0x49')]=_[_0xc61a('0x5c')](db[_0xc61a('0x12d')][_0xc61a('0x42')]);_0x246f41[_0xc61a('0x46')]=_[_0xc61a('0x5c')](_0x192331['query']);_0x246f41['filters']=_[_0xc61a('0x48')](_0x246f41[_0xc61a('0x49')],_0x246f41[_0xc61a('0x46')]);_0x23b93c['attributes']=_['intersection'](_0x246f41[_0xc61a('0x49')],qs[_0xc61a('0x4a')](_0x192331['query'][_0xc61a('0x4a')]));_0x23b93c[_0xc61a('0x4b')]=_0x23b93c['attributes'][_0xc61a('0x4c')]?_0x23b93c[_0xc61a('0x4b')]:_0x246f41[_0xc61a('0x49')];if(!_0x192331['query'][_0xc61a('0x4d')]('nolimit')){_0x23b93c[_0xc61a('0x2e')]=qs[_0xc61a('0x2e')](_0x192331[_0xc61a('0x46')][_0xc61a('0x2e')]);_0x23b93c['offset']=qs['offset'](_0x192331['query']['offset']);}_0x23b93c['order']=qs['sort'](_0x192331['query'][_0xc61a('0x50')]);_0x23b93c['where']=qs[_0xc61a('0x47')](_[_0xc61a('0x52')](_0x192331[_0xc61a('0x46')],_0x246f41[_0xc61a('0x47')]));_0x23b93c[_0xc61a('0x51')][_0xc61a('0x71')]=_0x10862f['id'];if(_0x192331[_0xc61a('0x46')]['filter']){_0x23b93c[_0xc61a('0x51')]=_[_0xc61a('0x3a')](_0x23b93c[_0xc61a('0x51')],{'$or':_[_0xc61a('0x45')](_0x23b93c[_0xc61a('0x4b')],function(_0x18e044){var _0x4e37ed={};_0x4e37ed[_0x18e044]={'$like':'%'+_0x192331[_0xc61a('0x46')][_0xc61a('0x53')]+'%'};return _0x4e37ed;})});}_0x23b93c=_['merge']({},_0x23b93c,_0x192331['options']);return db[_0xc61a('0x12d')]['count']({'where':_0x23b93c[_0xc61a('0x51')]})[_0xc61a('0x33')](function(_0x1fd318){_0x1260b7['count']=_0x1fd318;if(_0x192331[_0xc61a('0x46')][_0xc61a('0x56')]){_0x23b93c[_0xc61a('0x57')]=[{'all':!![]}];}else{_0x23b93c[_0xc61a('0x57')]=[{'model':db[_0xc61a('0xa4')],'as':_0xc61a('0x12e'),'required':![]},{'model':db[_0xc61a('0x12f')],'as':_0xc61a('0x130'),'required':![]}];}return db['ChatOfflineMessage'][_0xc61a('0x58')](_0x23b93c);})[_0xc61a('0x33')](function(_0x5b2db4){_0x1260b7[_0xc61a('0x6d')]=_0x5b2db4;return _0x1260b7;});}})[_0xc61a('0x33')](respondWithFilteredResult(_0x34e5b7,_0x23b93c))[_0xc61a('0x59')](handleError(_0x34e5b7,null));};exports[_0xc61a('0x131')]=function(_0x130a0b,_0x14aa3a,_0x2405ff){return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x130a0b['params']['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x14aa3a,null))[_0xc61a('0x33')](function(_0x50337e){if(_0x50337e){return _0x50337e['addAgents'](_0x130a0b[_0xc61a('0x5e')][_0xc61a('0x72')],_[_0xc61a('0x124')](_0x130a0b['body'],[_0xc61a('0x72'),'id'])||{})[_0xc61a('0xc3')](function(_0x51f495){for(var _0x5b0d92=0x0;_0x5b0d92<_0x130a0b[_0xc61a('0x5e')][_0xc61a('0x72')][_0xc61a('0x4c')];_0x5b0d92+=0x1){socket[_0xc61a('0x132')](_0xc61a('0x133'),{'UserId':_0x130a0b[_0xc61a('0x5e')]['ids'][_0x5b0d92],'ChatWebsiteId':_0x130a0b['params']['id']});}return _0x51f495;});}})[_0xc61a('0x33')](respondWithResult(_0x14aa3a,null))[_0xc61a('0x59')](handleError(_0x14aa3a,null));};exports[_0xc61a('0x134')]=function(_0x55ae4c,_0x53b435,_0x5ed254){return db['ChatWebsite'][_0xc61a('0x66')]({'where':{'id':_0x55ae4c[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x53b435,null))[_0xc61a('0x33')](function(_0x49e698){if(_0x49e698){return _0x49e698[_0xc61a('0x134')](_0x55ae4c[_0xc61a('0x46')]['ids'])[_0xc61a('0x33')](function(){if(_['isArray'](_0x55ae4c['query'][_0xc61a('0x72')])){for(var _0x47bb2b=0x0;_0x47bb2b<_0x55ae4c['query'][_0xc61a('0x72')][_0xc61a('0x4c')];_0x47bb2b+=0x1){socket[_0xc61a('0x132')](_0xc61a('0x135'),{'UserId':Number(_0x55ae4c[_0xc61a('0x46')][_0xc61a('0x72')][_0x47bb2b]),'ChatWebsiteId':Number(_0x55ae4c[_0xc61a('0x5b')]['id'])});}}else{socket[_0xc61a('0x132')](_0xc61a('0x135'),{'UserId':Number(_0x55ae4c[_0xc61a('0x46')]['ids']),'ChatWebsiteId':Number(_0x55ae4c['params']['id'])});}});}})[_0xc61a('0x33')](respondWithStatusCode(_0x53b435,null))['catch'](handleError(_0x53b435,null));};exports[_0xc61a('0x136')]=function(_0x4ba4c6,_0x3c9550,_0x49ac31){var _0x2ad9be={};var _0x200528={};var _0x3035d3;var _0x4553ae;return db[_0xc61a('0x41')]['findOne']({'where':{'id':_0x4ba4c6[_0xc61a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3c9550,null))[_0xc61a('0x33')](function(_0x2662e1){if(_0x2662e1){_0x3035d3=_0x2662e1;_0x200528[_0xc61a('0x49')]=_[_0xc61a('0x5c')](db[_0xc61a('0xca')]['rawAttributes']);_0x200528[_0xc61a('0x46')]=_[_0xc61a('0x5c')](_0x4ba4c6[_0xc61a('0x46')]);_0x200528['filters']=_['intersection'](_0x200528[_0xc61a('0x49')],_0x200528[_0xc61a('0x46')]);_0x2ad9be['attributes']=_[_0xc61a('0x48')](_0x200528['model'],qs[_0xc61a('0x4a')](_0x4ba4c6[_0xc61a('0x46')]['fields']));_0x2ad9be[_0xc61a('0x4b')]=_0x2ad9be[_0xc61a('0x4b')]['length']?_0x2ad9be[_0xc61a('0x4b')]:_0x200528[_0xc61a('0x49')];_0x2ad9be[_0xc61a('0x4f')]=qs[_0xc61a('0x50')](_0x4ba4c6[_0xc61a('0x46')][_0xc61a('0x50')]);_0x2ad9be[_0xc61a('0x51')]=qs[_0xc61a('0x47')](_[_0xc61a('0x52')](_0x4ba4c6[_0xc61a('0x46')],_0x200528['filters']));if(_0x4ba4c6[_0xc61a('0x46')][_0xc61a('0x53')]){_0x2ad9be[_0xc61a('0x51')]=_[_0xc61a('0x3a')](_0x2ad9be[_0xc61a('0x51')],{'$or':_[_0xc61a('0x45')](_0x2ad9be['attributes'],function(_0x2442fa){var _0xa7b9c6={};_0xa7b9c6[_0x2442fa]={'$like':'%'+_0x4ba4c6[_0xc61a('0x46')][_0xc61a('0x53')]+'%'};return _0xa7b9c6;})});}_0x2ad9be=_[_0xc61a('0x3a')]({},_0x2ad9be,_0x4ba4c6['options']);return _0x3035d3[_0xc61a('0x136')](_0x2ad9be);}})[_0xc61a('0x33')](function(_0x34e8c3){if(_0x34e8c3){_0x4553ae=_0x34e8c3[_0xc61a('0x4c')];if(!_0x4ba4c6[_0xc61a('0x46')]['hasOwnProperty'](_0xc61a('0x4e'))){_0x2ad9be[_0xc61a('0x2e')]=qs[_0xc61a('0x2e')](_0x4ba4c6[_0xc61a('0x46')][_0xc61a('0x2e')]);_0x2ad9be[_0xc61a('0x2c')]=qs['offset'](_0x4ba4c6[_0xc61a('0x46')][_0xc61a('0x2c')]);}return _0x3035d3[_0xc61a('0x136')](_0x2ad9be);}})[_0xc61a('0x33')](function(_0x51c3e2){if(_0x51c3e2){return _0x51c3e2?{'count':_0x4553ae,'rows':_0x51c3e2}:null;}})[_0xc61a('0x33')](respondWithResult(_0x3c9550,null))[_0xc61a('0x59')](handleError(_0x3c9550,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index e0cf44e..9a1ad36 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 _0xa87e=['hook','exports','events','../../mysqldb','ChatWebsite','save','update','remove','emit'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xa87e,0x185));var _0xea87=function(_0x19f20f,_0x54fb83){_0x19f20f=_0x19f20f-0x0;var _0x4d89d6=_0xa87e[_0x19f20f];return _0x4d89d6;};'use strict';var EventEmitter=require(_0xea87('0x0'));var ChatWebsite=require(_0xea87('0x1'))['db'][_0xea87('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xea87('0x3'),'afterUpdate':_0xea87('0x4'),'afterDestroy':_0xea87('0x5')};function emitEvent(_0x55c317){return function(_0x28fe92,_0x3c1913,_0x42ca61){ChatWebsiteEvents[_0xea87('0x6')](_0x55c317+':'+_0x28fe92['id'],_0x28fe92);ChatWebsiteEvents[_0xea87('0x6')](_0x55c317,_0x28fe92);_0x42ca61(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xea87('0x7')](e,emitEvent(event));}}module[_0xea87('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0xc992=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','ChatWebsite'];(function(_0xf3af93,_0x40fcb6){var _0x19a5b9=function(_0x46d597){while(--_0x46d597){_0xf3af93['push'](_0xf3af93['shift']());}};_0x19a5b9(++_0x40fcb6);}(_0xc992,0xbb));var _0x2c99=function(_0x384411,_0x5d9014){_0x384411=_0x384411-0x0;var _0x3c0380=_0xc992[_0x384411];return _0x3c0380;};'use strict';var EventEmitter=require(_0x2c99('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x2c99('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x2c99('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2c99('0x3'),'afterDestroy':_0x2c99('0x4')};function emitEvent(_0x36c8ed){return function(_0x50de49,_0x2b4abc,_0x5ede91){ChatWebsiteEvents[_0x2c99('0x5')](_0x36c8ed+':'+_0x50de49['id'],_0x50de49);ChatWebsiteEvents[_0x2c99('0x5')](_0x36c8ed,_0x50de49);_0x5ede91(null);};}for(var e in events){if(events[_0x2c99('0x6')](e)){var event=events[e];ChatWebsite[_0x2c99('0x7')](e,emitEvent(event));}}module[_0x2c99('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 d98da13..90e6e4b 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 _0x39cb=['chat_websites','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite'];(function(_0x49894c,_0x49cece){var _0xc19c75=function(_0x594111){while(--_0x594111){_0x49894c['push'](_0x49894c['shift']());}};_0xc19c75(++_0x49cece);}(_0x39cb,0x1bd));var _0xb39c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x39cb[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0xb39c('0x0'));var logger=require(_0xb39c('0x1'))('api');var moment=require(_0xb39c('0x2'));var BPromise=require(_0xb39c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb39c('0x4'));var rimraf=require(_0xb39c('0x5'));var config=require(_0xb39c('0x6'));var attributes=require(_0xb39c('0x7'));module[_0xb39c('0x8')]=function(_0x4ae4cf,_0x32cdcd){return _0x4ae4cf[_0xb39c('0x9')](_0xb39c('0xa'),attributes,{'tableName':_0xb39c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0427=['api','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','../../config/logger'];(function(_0xf48d27,_0xc761af){var _0x172722=function(_0x4722d1){while(--_0x4722d1){_0xf48d27['push'](_0xf48d27['shift']());}};_0x172722(++_0xc761af);}(_0x0427,0x137));var _0x7042=function(_0x1d5b68,_0x5540ba){_0x1d5b68=_0x1d5b68-0x0;var _0x2501c9=_0x0427[_0x1d5b68];return _0x2501c9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7042('0x0'))(_0x7042('0x1'));var moment=require('moment');var BPromise=require(_0x7042('0x2'));var rp=require(_0x7042('0x3'));var fs=require('fs');var path=require(_0x7042('0x4'));var rimraf=require(_0x7042('0x5'));var config=require(_0x7042('0x6'));var attributes=require(_0x7042('0x7'));module[_0x7042('0x8')]=function(_0x53ab81,_0x37a35b){return _0x53ab81[_0x7042('0x9')](_0x7042('0xa'),attributes,{'tableName':_0x7042('0xb'),'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 4ec1ebc..9a0ef27 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 _0x5c3c=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util'];(function(_0x3a6882,_0x76acc1){var _0x5b522f=function(_0x412c0b){while(--_0x412c0b){_0x3a6882['push'](_0x3a6882['shift']());}};_0x5b522f(++_0x76acc1);}(_0x5c3c,0x132));var _0xc5c3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5c3c[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xc5c3('0xd'),'port':0x18eb});var socket=require(_0xc5c3('0xe'))(new Redis(config['redis']));require(_0xc5c3('0xf'))[_0xc5c3('0x10')](socket);function respondWithRpcPromise(_0x52f3eb,_0x14140f,_0x2a1d19){return new BPromise(function(_0x4e329f,_0x1f2e34){return client[_0xc5c3('0x11')](_0x52f3eb,_0x2a1d19)[_0xc5c3('0x12')](function(_0x59fb60){logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,'request\x20sent');logger[_0xc5c3('0x15')](_0xc5c3('0x16'),_0x14140f,_0xc5c3('0x17'),JSON['stringify'](_0x59fb60));if(_0x59fb60[_0xc5c3('0x18')]){if(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x19')]===0x1f4){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x1f2e34(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x1a')]);}logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x4e329f(_0x59fb60[_0xc5c3('0x18')]['message']);}else{logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,_0xc5c3('0x17'));_0x4e329f(_0x59fb60[_0xc5c3('0x1b')][_0xc5c3('0x1a')]);}})['catch'](function(_0x364f42){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x364f42);_0x1f2e34(_0x364f42);});});} \ No newline at end of file +var _0xadb5=['code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xadb5,0xad));var _0x5adb=function(_0x733d6b,_0x5c9f21){_0x733d6b=_0x733d6b-0x0;var _0x2b0b7d=_0xadb5[_0x733d6b];return _0x2b0b7d;};'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});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index bf5368d..3f70f0f 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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x2545d0,_0x397e79){var _0x10111b=function(_0x2fdcd8){while(--_0x2fdcd8){_0x2545d0['push'](_0x2545d0['shift']());}};_0x10111b(++_0x397e79);}(_0x5f2f,0x73));var _0xf5f2=function(_0x32f056,_0x5c34ca){_0x32f056=_0x32f056-0x0;var _0x3456d5=_0x5f2f[_0x32f056];return _0x3456d5;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x214023,_0x65e22b){var _0x10cf15=function(_0x3a05df){while(--_0x3a05df){_0x214023['push'](_0x214023['shift']());}};_0x10cf15(++_0x65e22b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x350f77,_0x12a9b8){_0x350f77=_0x350f77-0x0;var _0x1305b6=_0x5f2f[_0x350f77];return _0x1305b6;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 123a701..c69f3a2 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 _0x9eca=['create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','server/files/images/avatars/','file','addAvatar','server/files','offline-chat','ensureDir','replace','/:id/offline','any','offline','addInteraction','/:id/applications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/proactive_actions','/:id/fields','getFields','/:id/users','post'];(function(_0x2d8948,_0x1e06f3){var _0x1e62b6=function(_0x30e939){while(--_0x30e939){_0x2d8948['push'](_0x2d8948['shift']());}};_0x1e62b6(++_0x1e06f3);}(_0x9eca,0x12f));var _0xa9ec=function(_0x50b15b,_0x71ac13){_0x50b15b=_0x50b15b-0x0;var _0x1334e2=_0x9eca[_0x50b15b];return _0x1334e2;};'use strict';var multer=require(_0xa9ec('0x0'));var util=require(_0xa9ec('0x1'));var path=require(_0xa9ec('0x2'));var timeout=require('connect-timeout');var express=require(_0xa9ec('0x3'));var router=express[_0xa9ec('0x4')]();var fs_extra=require(_0xa9ec('0x5'));var auth=require(_0xa9ec('0x6'));var interaction=require(_0xa9ec('0x7'));var config=require(_0xa9ec('0x8'));var controller=require('./chatWebsite.controller');router[_0xa9ec('0x9')]('/',auth[_0xa9ec('0xa')](),controller[_0xa9ec('0xb')]);router['get'](_0xa9ec('0xc'),auth[_0xa9ec('0xa')](),controller[_0xa9ec('0xd')]);router[_0xa9ec('0x9')](_0xa9ec('0xe'),auth['isAuthenticated'](),controller[_0xa9ec('0xf')]);router[_0xa9ec('0x9')](_0xa9ec('0x10'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xa9ec('0x9')](_0xa9ec('0x11'),auth['isAuthenticated'](),controller[_0xa9ec('0x12')]);router[_0xa9ec('0x9')]('/:id/logo',controller[_0xa9ec('0x13')]);router['get'](_0xa9ec('0x14'),controller['getAvatar']);router['get'](_0xa9ec('0x15'),controller['getCustomerAvatar']);router[_0xa9ec('0x9')](_0xa9ec('0x16'),controller[_0xa9ec('0x17')]);router[_0xa9ec('0x9')](_0xa9ec('0x18'),auth['isAuthenticated'](),controller[_0xa9ec('0x19')]);router[_0xa9ec('0x9')]('/:id/snippet',controller[_0xa9ec('0x1a')]);router[_0xa9ec('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xa9ec('0x9')](_0xa9ec('0x1b'),auth['isAuthenticated'](),controller['getProactiveActions']);router[_0xa9ec('0x9')](_0xa9ec('0x1c'),controller[_0xa9ec('0x1d')]);router[_0xa9ec('0x9')]('/:id/offline_messages',auth[_0xa9ec('0xa')](),controller['getOfflineMessages']);router[_0xa9ec('0x9')](_0xa9ec('0x1e'),auth[_0xa9ec('0xa')](),controller['getAgents']);router[_0xa9ec('0x1f')]('/',auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x20')]);router[_0xa9ec('0x1f')](_0xa9ec('0x10'),auth['isAuthenticated'](),controller[_0xa9ec('0x21')]);router['post'](_0xa9ec('0x11'),auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x22')]);var upload=multer({'storage':multer[_0xa9ec('0x23')]({'destination':function(_0x30391a,_0x3459df,_0x35ab9e){_0x35ab9e(null,path[_0xa9ec('0x24')](config[_0xa9ec('0x25')],_0xa9ec('0x26')));},'filename':function(_0x737b33,_0xfc9dd3,_0x59bd3a){_0x59bd3a(null,util[_0xa9ec('0x27')](_0xa9ec('0x28'),Date[_0xa9ec('0x29')](),_0xfc9dd3[_0xa9ec('0x2a')]));}})});router[_0xa9ec('0x1f')](_0xa9ec('0x2b'),upload[_0xa9ec('0x2c')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0xa9ec('0x23')]({'destination':function(_0xb40f18,_0x5a5b48,_0x36d147){_0x36d147(null,path[_0xa9ec('0x24')](config[_0xa9ec('0x25')],_0xa9ec('0x2d')));},'filename':function(_0x145916,_0x522704,_0x102f7b){_0x102f7b(null,util[_0xa9ec('0x27')](_0xa9ec('0x28'),Date['now'](),_0x522704['originalname']));}})});router[_0xa9ec('0x1f')](_0xa9ec('0x14'),upload[_0xa9ec('0x2c')](_0xa9ec('0x2e')),controller[_0xa9ec('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d079e,_0x30a28f,_0x519461){_0x519461(null,path[_0xa9ec('0x24')](config[_0xa9ec('0x25')],_0xa9ec('0x2d')));},'filename':function(_0x732587,_0x12d457,_0x359827){_0x359827(null,util[_0xa9ec('0x27')](_0xa9ec('0x28'),Date[_0xa9ec('0x29')](),_0x12d457[_0xa9ec('0x2a')]));}})});router[_0xa9ec('0x1f')](_0xa9ec('0x15'),upload[_0xa9ec('0x2c')](_0xa9ec('0x2e')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xa9ec('0x23')]({'destination':function(_0x3102b9,_0x3235ea,_0x51a812){_0x51a812(null,path[_0xa9ec('0x24')](config[_0xa9ec('0x25')],_0xa9ec('0x2d')));},'filename':function(_0xfc985,_0x42a205,_0x25c123){_0x25c123(null,util[_0xa9ec('0x27')]('%s-%s',Date['now'](),_0x42a205[_0xa9ec('0x2a')]));}})});router[_0xa9ec('0x1f')](_0xa9ec('0x16'),upload[_0xa9ec('0x2c')](_0xa9ec('0x2e')),controller['addSystemAvatar']);router[_0xa9ec('0x1f')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xa9ec('0x23')]({'destination':function(_0x10459e,_0x401fec,_0x5f1198){const _0xccbe93=path[_0xa9ec('0x24')](config[_0xa9ec('0x25')],_0xa9ec('0x30'),'attachments',_0xa9ec('0x31'));fs_extra[_0xa9ec('0x32')](_0xccbe93,function(){_0x5f1198(null,_0xccbe93);});},'filename':function(_0x451aa4,_0x421d16,_0x1484cf){const _0x155b4d=_0x421d16[_0xa9ec('0x2a')][_0xa9ec('0x33')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3a5da6=path['extname'](_0x155b4d);const _0x227aca=Date[_0xa9ec('0x29')]()+'-'+_0x155b4d[_0xa9ec('0x33')](_0x3a5da6,'')+_0x3a5da6;_0x1484cf(null,_0x227aca);}})});router[_0xa9ec('0x1f')](_0xa9ec('0x34'),offlineUploadMulter[_0xa9ec('0x35')](),controller[_0xa9ec('0x36')]);router[_0xa9ec('0x1f')]('/:id/interactions',auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x37')]);router[_0xa9ec('0x1f')](_0xa9ec('0x38'),auth[_0xa9ec('0xa')](),controller['addApplications']);router[_0xa9ec('0x1f')](_0xa9ec('0x1b'),auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x39')]);router[_0xa9ec('0x1f')]('/:id/users',auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x3a')]);router[_0xa9ec('0x3b')](_0xa9ec('0xe'),auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x3c')]);router[_0xa9ec('0x3d')](_0xa9ec('0xe'),auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x3e')]);router[_0xa9ec('0x3d')](_0xa9ec('0x10'),auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x3f')]);router[_0xa9ec('0x3d')](_0xa9ec('0x11'),auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x40')]);router[_0xa9ec('0x3d')](_0xa9ec('0x1e'),auth['isAuthenticated'](),controller[_0xa9ec('0x41')]);module[_0xa9ec('0x42')]=router; \ No newline at end of file +var _0x9b5c=['now','originalname','post','single','file','addLogo','root','server/files/images/avatars/','addAvatar','%s-%s','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addProactiveActions','/:id/users','addAgents','put','update','delete','/:id','destroy','/:id/dispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','create','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','format'];(function(_0x27221f,_0x3f0125){var _0x1946d4=function(_0x2c7b20){while(--_0x2c7b20){_0x27221f['push'](_0x27221f['shift']());}};_0x1946d4(++_0x3f0125);}(_0x9b5c,0xb8));var _0xc9b5=function(_0x401821,_0x34e8c4){_0x401821=_0x401821-0x0;var _0x22c1eb=_0x9b5c[_0x401821];return _0x22c1eb;};'use strict';var multer=require(_0xc9b5('0x0'));var util=require(_0xc9b5('0x1'));var path=require('path');var timeout=require(_0xc9b5('0x2'));var express=require(_0xc9b5('0x3'));var router=express[_0xc9b5('0x4')]();var fs_extra=require(_0xc9b5('0x5'));var auth=require(_0xc9b5('0x6'));var interaction=require(_0xc9b5('0x7'));var config=require(_0xc9b5('0x8'));var controller=require(_0xc9b5('0x9'));router[_0xc9b5('0xa')]('/',auth[_0xc9b5('0xb')](),controller[_0xc9b5('0xc')]);router[_0xc9b5('0xa')](_0xc9b5('0xd'),auth[_0xc9b5('0xb')](),controller[_0xc9b5('0xe')]);router['get']('/:id',auth[_0xc9b5('0xb')](),controller[_0xc9b5('0xf')]);router[_0xc9b5('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc9b5('0x10')]);router[_0xc9b5('0xa')](_0xc9b5('0x11'),auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x12')]);router[_0xc9b5('0xa')](_0xc9b5('0x13'),controller[_0xc9b5('0x14')]);router[_0xc9b5('0xa')](_0xc9b5('0x15'),controller[_0xc9b5('0x16')]);router[_0xc9b5('0xa')]('/:id/customer_avatar',controller[_0xc9b5('0x17')]);router['get'](_0xc9b5('0x18'),controller[_0xc9b5('0x19')]);router['get'](_0xc9b5('0x1a'),auth['isAuthenticated'](),controller['getInteractions']);router['get']('/:id/snippet',controller[_0xc9b5('0x1b')]);router[_0xc9b5('0xa')](_0xc9b5('0x1c'),auth[_0xc9b5('0xb')](),controller['getApplications']);router[_0xc9b5('0xa')](_0xc9b5('0x1d'),auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x1e')]);router[_0xc9b5('0xa')](_0xc9b5('0x1f'),controller[_0xc9b5('0x20')]);router[_0xc9b5('0xa')](_0xc9b5('0x21'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0xc9b5('0xa')]('/:id/users',auth[_0xc9b5('0xb')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xc9b5('0x22')]);router['post']('/:id/dispositions',auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x23')]);router['post'](_0xc9b5('0x11'),auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x24')]);var upload=multer({'storage':multer[_0xc9b5('0x25')]({'destination':function(_0xf8b7f5,_0x4c3cd5,_0xb891da){_0xb891da(null,path[_0xc9b5('0x26')](config['root'],_0xc9b5('0x27')));},'filename':function(_0x37a1a7,_0x32bc73,_0x200429){_0x200429(null,util[_0xc9b5('0x28')]('%s-%s',Date[_0xc9b5('0x29')](),_0x32bc73[_0xc9b5('0x2a')]));}})});router[_0xc9b5('0x2b')]('/:id/logo',upload[_0xc9b5('0x2c')](_0xc9b5('0x2d')),controller[_0xc9b5('0x2e')]);var upload=multer({'storage':multer[_0xc9b5('0x25')]({'destination':function(_0x5ae300,_0x53ed1c,_0x166184){_0x166184(null,path[_0xc9b5('0x26')](config[_0xc9b5('0x2f')],_0xc9b5('0x30')));},'filename':function(_0x33b058,_0x35a107,_0xdac692){_0xdac692(null,util[_0xc9b5('0x28')]('%s-%s',Date['now'](),_0x35a107[_0xc9b5('0x2a')]));}})});router['post'](_0xc9b5('0x15'),upload[_0xc9b5('0x2c')](_0xc9b5('0x2d')),controller[_0xc9b5('0x31')]);var upload=multer({'storage':multer[_0xc9b5('0x25')]({'destination':function(_0x131984,_0x5e2cf2,_0x1d079d){_0x1d079d(null,path[_0xc9b5('0x26')](config[_0xc9b5('0x2f')],_0xc9b5('0x30')));},'filename':function(_0x14071f,_0x4c0edb,_0x343b58){_0x343b58(null,util['format'](_0xc9b5('0x32'),Date[_0xc9b5('0x29')](),_0x4c0edb[_0xc9b5('0x2a')]));}})});router['post'](_0xc9b5('0x33'),upload['single']('file'),controller[_0xc9b5('0x34')]);var upload=multer({'storage':multer[_0xc9b5('0x25')]({'destination':function(_0x5b4c58,_0x39993d,_0x400bea){_0x400bea(null,path[_0xc9b5('0x26')](config[_0xc9b5('0x2f')],_0xc9b5('0x30')));},'filename':function(_0x5416fa,_0x32710e,_0x4abc64){_0x4abc64(null,util['format'](_0xc9b5('0x32'),Date[_0xc9b5('0x29')](),_0x32710e['originalname']));}})});router['post'](_0xc9b5('0x18'),upload[_0xc9b5('0x2c')](_0xc9b5('0x2d')),controller[_0xc9b5('0x35')]);router[_0xc9b5('0x2b')](_0xc9b5('0x36'),controller[_0xc9b5('0x37')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x4b3d9c,_0x4259a1,_0x248499){const _0x1b9e66=path['join'](config[_0xc9b5('0x2f')],'server/files','attachments',_0xc9b5('0x38'));fs_extra[_0xc9b5('0x39')](_0x1b9e66,function(){_0x248499(null,_0x1b9e66);});},'filename':function(_0x4a17b5,_0x419f9e,_0x4fa7ca){const _0x119955=_0x419f9e[_0xc9b5('0x2a')][_0xc9b5('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4aeeb2=path[_0xc9b5('0x3b')](_0x119955);const _0x27cb5a=Date[_0xc9b5('0x29')]()+'-'+_0x119955[_0xc9b5('0x3a')](_0x4aeeb2,'')+_0x4aeeb2;_0x4fa7ca(null,_0x27cb5a);}})});router['post'](_0xc9b5('0x3c'),offlineUploadMulter[_0xc9b5('0x3d')](),controller[_0xc9b5('0x3e')]);router[_0xc9b5('0x2b')](_0xc9b5('0x1a'),auth[_0xc9b5('0xb')](),controller['addInteraction']);router['post'](_0xc9b5('0x1c'),auth[_0xc9b5('0xb')](),controller['addApplications']);router[_0xc9b5('0x2b')](_0xc9b5('0x1d'),auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x3f')]);router['post'](_0xc9b5('0x40'),auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x41')]);router[_0xc9b5('0x42')]('/:id',auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x43')]);router[_0xc9b5('0x44')](_0xc9b5('0x45'),auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x46')]);router[_0xc9b5('0x44')](_0xc9b5('0x47'),auth[_0xc9b5('0xb')](),controller['removeDispositions']);router[_0xc9b5('0x44')]('/:id/canned_answers',auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x48')]);router[_0xc9b5('0x44')](_0xc9b5('0x40'),auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x49')]);module[_0xc9b5('0x4a')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 55e74a9..388a61b 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 _0xee3c=['sequelize','exports','STRING','ENUM','AmazonAWS','Google'];(function(_0x10fcd4,_0x32edbf){var _0xef5322=function(_0x116592){while(--_0x116592){_0x10fcd4['push'](_0x10fcd4['shift']());}};_0xef5322(++_0x32edbf);}(_0xee3c,0x14a));var _0xcee3=function(_0x4f5212,_0x1a583c){_0x4f5212=_0x4f5212-0x0;var _0x20d1b6=_0xee3c[_0x4f5212];return _0x20d1b6;};'use strict';var Sequelize=require(_0xcee3('0x0'));module[_0xcee3('0x1')]={'name':{'type':Sequelize[_0xcee3('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xcee3('0x3')](_0xcee3('0x4'),_0xcee3('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x53ec=['sequelize','exports','STRING','ENUM','AmazonAWS','Google'];(function(_0x5c8d8b,_0x299310){var _0x360828=function(_0x3d734d){while(--_0x3d734d){_0x5c8d8b['push'](_0x5c8d8b['shift']());}};_0x360828(++_0x299310);}(_0x53ec,0x192));var _0xc53e=function(_0x5f1de4,_0x47c201){_0x5f1de4=_0x5f1de4-0x0;var _0x1aeaf0=_0x53ec[_0x5f1de4];return _0x1aeaf0;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc53e('0x3')](_0xc53e('0x4'),_0xc53e('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xc53e('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 6c7a233..13e1d61 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 _0x2528=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','../../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','merge','body','contact','agent','interaction','index','map','CloudProvider','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','where','pick','filters','filter','type','includeAll','include','findAll','rows','catch','show','params','options','find','create'];(function(_0x485dab,_0x526c7a){var _0x381c33=function(_0x5c1acd){while(--_0x5c1acd){_0x485dab['push'](_0x485dab['shift']());}};_0x381c33(++_0x526c7a);}(_0x2528,0x186));var _0x8252=function(_0x6b082e,_0x520582){_0x6b082e=_0x6b082e-0x0;var _0x424fc1=_0x2528[_0x6b082e];return _0x424fc1;};'use strict';var emlformat=require(_0x8252('0x0'));var rimraf=require(_0x8252('0x1'));var zipdir=require(_0x8252('0x2'));var jsonpatch=require(_0x8252('0x3'));var rp=require(_0x8252('0x4'));var moment=require(_0x8252('0x5'));var BPromise=require(_0x8252('0x6'));var Mustache=require(_0x8252('0x7'));var util=require(_0x8252('0x8'));var path=require(_0x8252('0x9'));var sox=require(_0x8252('0xa'));var csv=require(_0x8252('0xb'));var ejs=require(_0x8252('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8252('0xd'));var squel=require('squel');var crypto=require(_0x8252('0xe'));var jsforce=require(_0x8252('0xf'));var deskjs=require(_0x8252('0x10'));var toCsv=require(_0x8252('0xb'));var querystring=require(_0x8252('0x11'));var Papa=require(_0x8252('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8252('0x13'));var logger=require(_0x8252('0x14'))('api');var utils=require(_0x8252('0x15'));var config=require(_0x8252('0x16'));var licenseUtil=require(_0x8252('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e161f,_0x23156b){_0x23156b=_0x23156b||0xcc;return function(_0x59f54e){if(_0x59f54e){return _0x5e161f[_0x8252('0x18')](_0x23156b);}return _0x5e161f[_0x8252('0x19')](_0x23156b)[_0x8252('0x1a')]();};}function respondWithResult(_0x3a1d19,_0x298171){_0x298171=_0x298171||0xc8;return function(_0x50dc19){if(_0x50dc19){return _0x3a1d19[_0x8252('0x19')](_0x298171)[_0x8252('0x1b')](_0x50dc19);}};}function respondWithFilteredResult(_0x265c29,_0x195e9b){return function(_0x43a190){if(_0x43a190){var _0xb33db6=typeof _0x195e9b[_0x8252('0x1c')]===_0x8252('0x1d')&&typeof _0x195e9b[_0x8252('0x1e')]==='undefined';var _0x34ac74=_0x43a190[_0x8252('0x1f')];var _0x4cf7b1=_0xb33db6?0x0:_0x195e9b[_0x8252('0x1c')];var _0x177a4b=_0xb33db6?_0x43a190['count']:_0x195e9b[_0x8252('0x1c')]+_0x195e9b[_0x8252('0x1e')];var _0x1144bb;if(_0x177a4b>=_0x34ac74){_0x177a4b=_0x34ac74;_0x1144bb=0xc8;}else{_0x1144bb=0xce;}_0x265c29['status'](_0x1144bb);return _0x265c29[_0x8252('0x20')](_0x8252('0x21'),_0x4cf7b1+'-'+_0x177a4b+'/'+_0x34ac74)[_0x8252('0x1b')](_0x43a190);}return null;};}function patchUpdates(_0x1070d6){return function(_0x435dcb){try{jsonpatch['apply'](_0x435dcb,_0x1070d6,!![]);}catch(_0x46ed29){return BPromise[_0x8252('0x22')](_0x46ed29);}return _0x435dcb[_0x8252('0x23')]();};}function saveUpdates(_0x20eed9,_0x4e1ebc){return function(_0x2e5ad4){if(_0x2e5ad4){return _0x2e5ad4[_0x8252('0x24')](_0x20eed9)[_0x8252('0x25')](function(_0x504984){return _0x504984;});}return null;};}function removeEntity(_0x1f21bf,_0x1347fe){return function(_0x387614){if(_0x387614){return _0x387614[_0x8252('0x26')]()[_0x8252('0x25')](function(){_0x1f21bf[_0x8252('0x19')](0xcc)[_0x8252('0x1a')]();});}};}function handleEntityNotFound(_0x2719ed,_0x3553c5){return function(_0x19f1a7){if(!_0x19f1a7){_0x2719ed[_0x8252('0x18')](0x194);}return _0x19f1a7;};}function handleError(_0x3dc66f,_0x1bf4ef){_0x1bf4ef=_0x1bf4ef||0x1f4;return function(_0x964977){logger[_0x8252('0x27')](_0x964977[_0x8252('0x28')]);if(_0x964977[_0x8252('0x29')]){delete _0x964977[_0x8252('0x29')];}_0x3dc66f[_0x8252('0x19')](_0x1bf4ef)[_0x8252('0x2a')](_0x964977);};}function getMustacheRender(_0x3209d3,_0x1c2da8){return Mustache['render'](_0x3209d3,_[_0x8252('0x2b')](_0x1c2da8[_0x8252('0x2c')],{'contact':_0x1c2da8[_0x8252('0x2d')],'message':_0x1c2da8['message'],'agent':_0x1c2da8[_0x8252('0x2e')],'interaction':_0x1c2da8[_0x8252('0x2f')],'account':_0x1c2da8['account']}))||'';}exports[_0x8252('0x30')]=function(_0x36ae98,_0x2964ff){var _0x26648e={},_0x55fbb4={},_0x5eac20={'count':0x0,'rows':[]};var _0x4a79b2=_[_0x8252('0x31')](db[_0x8252('0x32')][_0x8252('0x33')],function(_0x2128b2){return{'name':_0x2128b2[_0x8252('0x34')],'type':_0x2128b2['type'][_0x8252('0x35')]};});_0x55fbb4['model']=_[_0x8252('0x31')](_0x4a79b2,_0x8252('0x29'));_0x55fbb4[_0x8252('0x36')]=_[_0x8252('0x37')](_0x36ae98[_0x8252('0x36')]);_0x55fbb4['filters']=_[_0x8252('0x38')](_0x55fbb4[_0x8252('0x39')],_0x55fbb4['query']);_0x26648e[_0x8252('0x3a')]=_[_0x8252('0x38')](_0x55fbb4['model'],qs[_0x8252('0x3b')](_0x36ae98[_0x8252('0x36')][_0x8252('0x3b')]));_0x26648e[_0x8252('0x3a')]=_0x26648e['attributes'][_0x8252('0x3c')]?_0x26648e[_0x8252('0x3a')]:_0x55fbb4[_0x8252('0x39')];if(!_0x36ae98[_0x8252('0x36')][_0x8252('0x3d')]('nolimit')){_0x26648e['limit']=qs[_0x8252('0x1e')](_0x36ae98['query'][_0x8252('0x1e')]);_0x26648e[_0x8252('0x1c')]=qs[_0x8252('0x1c')](_0x36ae98[_0x8252('0x36')][_0x8252('0x1c')]);}_0x26648e[_0x8252('0x3e')]=qs['sort'](_0x36ae98[_0x8252('0x36')]['sort']);_0x26648e[_0x8252('0x3f')]=qs['filters'](_[_0x8252('0x40')](_0x36ae98[_0x8252('0x36')],_0x55fbb4[_0x8252('0x41')]),_0x4a79b2);if(_0x36ae98[_0x8252('0x36')][_0x8252('0x42')]){_0x26648e['where']=_[_0x8252('0x2b')](_0x26648e[_0x8252('0x3f')],{'$or':_[_0x8252('0x31')](_0x4a79b2,function(_0x662ae8){if(_0x662ae8[_0x8252('0x43')]!=='VIRTUAL'){var _0x100ff0={};_0x100ff0[_0x662ae8[_0x8252('0x29')]]={'$like':'%'+_0x36ae98[_0x8252('0x36')][_0x8252('0x42')]+'%'};return _0x100ff0;}})});}_0x26648e=_['merge']({},_0x26648e,_0x36ae98['options']);var _0x3df105={'where':_0x26648e['where']};return db[_0x8252('0x32')]['count'](_0x3df105)[_0x8252('0x25')](function(_0x19dbfa){_0x5eac20[_0x8252('0x1f')]=_0x19dbfa;if(_0x36ae98[_0x8252('0x36')][_0x8252('0x44')]){_0x26648e[_0x8252('0x45')]=[{'all':!![]}];}return db[_0x8252('0x32')][_0x8252('0x46')](_0x26648e);})[_0x8252('0x25')](function(_0x53ad18){_0x5eac20[_0x8252('0x47')]=_0x53ad18;return _0x5eac20;})[_0x8252('0x25')](respondWithFilteredResult(_0x2964ff,_0x26648e))[_0x8252('0x48')](handleError(_0x2964ff,null));};exports[_0x8252('0x49')]=function(_0x18cfbe,_0x111418){var _0x3edddf={'raw':!![],'where':{'id':_0x18cfbe[_0x8252('0x4a')]['id']}},_0x557bc9={};_0x557bc9[_0x8252('0x39')]=_[_0x8252('0x37')](db['CloudProvider'][_0x8252('0x33')]);_0x557bc9[_0x8252('0x36')]=_[_0x8252('0x37')](_0x18cfbe['query']);_0x557bc9[_0x8252('0x41')]=_['intersection'](_0x557bc9['model'],_0x557bc9[_0x8252('0x36')]);_0x3edddf[_0x8252('0x3a')]=_[_0x8252('0x38')](_0x557bc9[_0x8252('0x39')],qs[_0x8252('0x3b')](_0x18cfbe[_0x8252('0x36')][_0x8252('0x3b')]));_0x3edddf[_0x8252('0x3a')]=_0x3edddf[_0x8252('0x3a')]['length']?_0x3edddf[_0x8252('0x3a')]:_0x557bc9[_0x8252('0x39')];if(_0x18cfbe[_0x8252('0x36')][_0x8252('0x44')]){_0x3edddf['include']=[{'all':!![]}];}_0x3edddf=_['merge']({},_0x3edddf,_0x18cfbe[_0x8252('0x4b')]);return db[_0x8252('0x32')][_0x8252('0x4c')](_0x3edddf)[_0x8252('0x25')](handleEntityNotFound(_0x111418,null))[_0x8252('0x25')](respondWithResult(_0x111418,null))['catch'](handleError(_0x111418,null));};exports[_0x8252('0x4d')]=function(_0x320812,_0x3a5f23){return db[_0x8252('0x32')]['create'](_0x320812[_0x8252('0x2c')],{})[_0x8252('0x25')](respondWithResult(_0x3a5f23,0xc9))['catch'](handleError(_0x3a5f23,null));};exports['update']=function(_0x3ee702,_0x45d52a){if(_0x3ee702[_0x8252('0x2c')]['id']){delete _0x3ee702[_0x8252('0x2c')]['id'];}return db[_0x8252('0x32')][_0x8252('0x4c')]({'where':{'id':_0x3ee702[_0x8252('0x4a')]['id']}})[_0x8252('0x25')](handleEntityNotFound(_0x45d52a,null))[_0x8252('0x25')](saveUpdates(_0x3ee702[_0x8252('0x2c')],null))[_0x8252('0x25')](respondWithResult(_0x45d52a,null))['catch'](handleError(_0x45d52a,null));};exports[_0x8252('0x26')]=function(_0x1a9fd3,_0xe4108e){return db[_0x8252('0x32')][_0x8252('0x4c')]({'where':{'id':_0x1a9fd3[_0x8252('0x4a')]['id']}})[_0x8252('0x25')](handleEntityNotFound(_0xe4108e,null))[_0x8252('0x25')](removeEntity(_0xe4108e,null))['catch'](handleError(_0xe4108e,null));}; \ No newline at end of file +var _0x4147=['contact','message','agent','interaction','account','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','CloudProvider','include','findAll','rows','catch','show','params','keys','includeAll','body','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','error','name','send','merge'];(function(_0x41b66f,_0x199fd0){var _0x1b46dd=function(_0x690c4a){while(--_0x690c4a){_0x41b66f['push'](_0x41b66f['shift']());}};_0x1b46dd(++_0x199fd0);}(_0x4147,0x1a7));var _0x7414=function(_0x21352b,_0x499500){_0x21352b=_0x21352b-0x0;var _0x2073be=_0x4147[_0x21352b];return _0x2073be;};'use strict';var emlformat=require(_0x7414('0x0'));var rimraf=require(_0x7414('0x1'));var zipdir=require(_0x7414('0x2'));var jsonpatch=require(_0x7414('0x3'));var rp=require('request-promise');var moment=require(_0x7414('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7414('0x5'));var util=require('util');var path=require(_0x7414('0x6'));var sox=require(_0x7414('0x7'));var csv=require('to-csv');var ejs=require(_0x7414('0x8'));var fs=require('fs');var fs_extra=require(_0x7414('0x9'));var _=require('lodash');var squel=require(_0x7414('0xa'));var crypto=require(_0x7414('0xb'));var jsforce=require(_0x7414('0xc'));var deskjs=require(_0x7414('0xd'));var toCsv=require(_0x7414('0xe'));var querystring=require(_0x7414('0xf'));var Papa=require(_0x7414('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7414('0x11'));var as=require(_0x7414('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7414('0x13'))('api');var utils=require(_0x7414('0x14'));var config=require(_0x7414('0x15'));var licenseUtil=require(_0x7414('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36d9fe,_0x43a4a0){_0x43a4a0=_0x43a4a0||0xcc;return function(_0x445795){if(_0x445795){return _0x36d9fe[_0x7414('0x17')](_0x43a4a0);}return _0x36d9fe[_0x7414('0x18')](_0x43a4a0)[_0x7414('0x19')]();};}function respondWithResult(_0x30f8a4,_0x2edfa9){_0x2edfa9=_0x2edfa9||0xc8;return function(_0x58b964){if(_0x58b964){return _0x30f8a4[_0x7414('0x18')](_0x2edfa9)[_0x7414('0x1a')](_0x58b964);}};}function respondWithFilteredResult(_0x3fbbff,_0x8f561b){return function(_0x12dbc2){if(_0x12dbc2){var _0x63b4fe=typeof _0x8f561b[_0x7414('0x1b')]===_0x7414('0x1c')&&typeof _0x8f561b[_0x7414('0x1d')]==='undefined';var _0x34d66f=_0x12dbc2[_0x7414('0x1e')];var _0x431896=_0x63b4fe?0x0:_0x8f561b[_0x7414('0x1b')];var _0x1af1af=_0x63b4fe?_0x12dbc2[_0x7414('0x1e')]:_0x8f561b['offset']+_0x8f561b[_0x7414('0x1d')];var _0x2fc0bc;if(_0x1af1af>=_0x34d66f){_0x1af1af=_0x34d66f;_0x2fc0bc=0xc8;}else{_0x2fc0bc=0xce;}_0x3fbbff[_0x7414('0x18')](_0x2fc0bc);return _0x3fbbff['set'](_0x7414('0x1f'),_0x431896+'-'+_0x1af1af+'/'+_0x34d66f)['json'](_0x12dbc2);}return null;};}function patchUpdates(_0x128be6){return function(_0x242cf6){try{jsonpatch['apply'](_0x242cf6,_0x128be6,!![]);}catch(_0x328a14){return BPromise[_0x7414('0x20')](_0x328a14);}return _0x242cf6['save']();};}function saveUpdates(_0x3fa751,_0x4c976e){return function(_0x4628ab){if(_0x4628ab){return _0x4628ab[_0x7414('0x21')](_0x3fa751)[_0x7414('0x22')](function(_0x117524){return _0x117524;});}return null;};}function removeEntity(_0x166e1f,_0x40473f){return function(_0x38ca14){if(_0x38ca14){return _0x38ca14['destroy']()[_0x7414('0x22')](function(){_0x166e1f[_0x7414('0x18')](0xcc)[_0x7414('0x19')]();});}};}function handleEntityNotFound(_0xb79a39,_0x3da60c){return function(_0xcfcc0b){if(!_0xcfcc0b){_0xb79a39[_0x7414('0x17')](0x194);}return _0xcfcc0b;};}function handleError(_0x24170d,_0x1f98e0){_0x1f98e0=_0x1f98e0||0x1f4;return function(_0x1185a3){logger[_0x7414('0x23')](_0x1185a3['stack']);if(_0x1185a3[_0x7414('0x24')]){delete _0x1185a3['name'];}_0x24170d[_0x7414('0x18')](_0x1f98e0)[_0x7414('0x25')](_0x1185a3);};}function getMustacheRender(_0x2d44f6,_0x2d699e){return Mustache['render'](_0x2d44f6,_[_0x7414('0x26')](_0x2d699e['body'],{'contact':_0x2d699e[_0x7414('0x27')],'message':_0x2d699e[_0x7414('0x28')],'agent':_0x2d699e[_0x7414('0x29')],'interaction':_0x2d699e[_0x7414('0x2a')],'account':_0x2d699e[_0x7414('0x2b')]}))||'';}exports['index']=function(_0x400feb,_0x3f1e73){var _0x28353c={},_0x386472={},_0x273347={'count':0x0,'rows':[]};var _0x48a892=_[_0x7414('0x2c')](db['CloudProvider'][_0x7414('0x2d')],function(_0x3f358c){return{'name':_0x3f358c[_0x7414('0x2e')],'type':_0x3f358c[_0x7414('0x2f')][_0x7414('0x30')]};});_0x386472[_0x7414('0x31')]=_[_0x7414('0x2c')](_0x48a892,_0x7414('0x24'));_0x386472[_0x7414('0x32')]=_['keys'](_0x400feb[_0x7414('0x32')]);_0x386472['filters']=_[_0x7414('0x33')](_0x386472['model'],_0x386472[_0x7414('0x32')]);_0x28353c['attributes']=_[_0x7414('0x33')](_0x386472[_0x7414('0x31')],qs[_0x7414('0x34')](_0x400feb[_0x7414('0x32')][_0x7414('0x34')]));_0x28353c['attributes']=_0x28353c[_0x7414('0x35')][_0x7414('0x36')]?_0x28353c[_0x7414('0x35')]:_0x386472['model'];if(!_0x400feb[_0x7414('0x32')][_0x7414('0x37')](_0x7414('0x38'))){_0x28353c['limit']=qs[_0x7414('0x1d')](_0x400feb[_0x7414('0x32')][_0x7414('0x1d')]);_0x28353c[_0x7414('0x1b')]=qs['offset'](_0x400feb[_0x7414('0x32')][_0x7414('0x1b')]);}_0x28353c[_0x7414('0x39')]=qs[_0x7414('0x3a')](_0x400feb[_0x7414('0x32')][_0x7414('0x3a')]);_0x28353c['where']=qs[_0x7414('0x3b')](_[_0x7414('0x3c')](_0x400feb[_0x7414('0x32')],_0x386472[_0x7414('0x3b')]),_0x48a892);if(_0x400feb[_0x7414('0x32')][_0x7414('0x3d')]){_0x28353c[_0x7414('0x3e')]=_['merge'](_0x28353c['where'],{'$or':_[_0x7414('0x2c')](_0x48a892,function(_0x1b5f3f){if(_0x1b5f3f[_0x7414('0x2f')]!==_0x7414('0x3f')){var _0x3a4297={};_0x3a4297[_0x1b5f3f['name']]={'$like':'%'+_0x400feb[_0x7414('0x32')][_0x7414('0x3d')]+'%'};return _0x3a4297;}})});}_0x28353c=_['merge']({},_0x28353c,_0x400feb[_0x7414('0x40')]);var _0x3bba74={'where':_0x28353c['where']};return db[_0x7414('0x41')][_0x7414('0x1e')](_0x3bba74)[_0x7414('0x22')](function(_0x3ad9d6){_0x273347[_0x7414('0x1e')]=_0x3ad9d6;if(_0x400feb[_0x7414('0x32')]['includeAll']){_0x28353c[_0x7414('0x42')]=[{'all':!![]}];}return db[_0x7414('0x41')][_0x7414('0x43')](_0x28353c);})[_0x7414('0x22')](function(_0x1c84fe){_0x273347[_0x7414('0x44')]=_0x1c84fe;return _0x273347;})[_0x7414('0x22')](respondWithFilteredResult(_0x3f1e73,_0x28353c))[_0x7414('0x45')](handleError(_0x3f1e73,null));};exports[_0x7414('0x46')]=function(_0x37e293,_0x4757c0){var _0x11167e={'raw':!![],'where':{'id':_0x37e293[_0x7414('0x47')]['id']}},_0x2e9d4e={};_0x2e9d4e[_0x7414('0x31')]=_['keys'](db[_0x7414('0x41')][_0x7414('0x2d')]);_0x2e9d4e['query']=_[_0x7414('0x48')](_0x37e293[_0x7414('0x32')]);_0x2e9d4e[_0x7414('0x3b')]=_[_0x7414('0x33')](_0x2e9d4e['model'],_0x2e9d4e[_0x7414('0x32')]);_0x11167e[_0x7414('0x35')]=_[_0x7414('0x33')](_0x2e9d4e[_0x7414('0x31')],qs[_0x7414('0x34')](_0x37e293[_0x7414('0x32')][_0x7414('0x34')]));_0x11167e[_0x7414('0x35')]=_0x11167e[_0x7414('0x35')]['length']?_0x11167e[_0x7414('0x35')]:_0x2e9d4e[_0x7414('0x31')];if(_0x37e293[_0x7414('0x32')][_0x7414('0x49')]){_0x11167e['include']=[{'all':!![]}];}_0x11167e=_[_0x7414('0x26')]({},_0x11167e,_0x37e293['options']);return db[_0x7414('0x41')]['find'](_0x11167e)[_0x7414('0x22')](handleEntityNotFound(_0x4757c0,null))['then'](respondWithResult(_0x4757c0,null))[_0x7414('0x45')](handleError(_0x4757c0,null));};exports['create']=function(_0x371c66,_0x4b78e1){return db[_0x7414('0x41')]['create'](_0x371c66[_0x7414('0x4a')],{})['then'](respondWithResult(_0x4b78e1,0xc9))[_0x7414('0x45')](handleError(_0x4b78e1,null));};exports['update']=function(_0xe9045c,_0xf79684){if(_0xe9045c[_0x7414('0x4a')]['id']){delete _0xe9045c['body']['id'];}return db[_0x7414('0x41')]['find']({'where':{'id':_0xe9045c[_0x7414('0x47')]['id']}})[_0x7414('0x22')](handleEntityNotFound(_0xf79684,null))['then'](saveUpdates(_0xe9045c[_0x7414('0x4a')],null))[_0x7414('0x22')](respondWithResult(_0xf79684,null))[_0x7414('0x45')](handleError(_0xf79684,null));};exports[_0x7414('0x4b')]=function(_0x5043c6,_0x3664a6){return db[_0x7414('0x41')][_0x7414('0x4c')]({'where':{'id':_0x5043c6[_0x7414('0x47')]['id']}})[_0x7414('0x22')](handleEntityNotFound(_0x3664a6,null))[_0x7414('0x22')](removeEntity(_0x3664a6,null))['catch'](handleError(_0x3664a6,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 05ac9d6..a7454ba 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 _0xb2d9=['lodash','util','api','moment','./cloudProvider.attributes','define','CloudProvider','cloud_providers'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xb2d9,0x78));var _0x9b2d=function(_0x5c03b0,_0x164471){_0x5c03b0=_0x5c03b0-0x0;var _0x3e62d7=_0xb2d9[_0x5c03b0];return _0x3e62d7;};'use strict';var _=require(_0x9b2d('0x0'));var util=require(_0x9b2d('0x1'));var logger=require('../../config/logger')(_0x9b2d('0x2'));var moment=require(_0x9b2d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9b2d('0x4'));module['exports']=function(_0x2bb981,_0x5835ae){return _0x2bb981[_0x9b2d('0x5')](_0x9b2d('0x6'),attributes,{'tableName':_0x9b2d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc10d=['path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','../../config/logger','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc10d,0xec));var _0xdc10=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0xc10d[_0x33a694];return _0x41ff01;};'use strict';var _=require(_0xdc10('0x0'));var util=require('util');var logger=require(_0xdc10('0x1'))('api');var moment=require('moment');var BPromise=require(_0xdc10('0x2'));var rp=require(_0xdc10('0x3'));var fs=require('fs');var path=require(_0xdc10('0x4'));var rimraf=require(_0xdc10('0x5'));var config=require(_0xdc10('0x6'));var attributes=require(_0xdc10('0x7'));module[_0xdc10('0x8')]=function(_0x5df2b2,_0x74c530){return _0x5df2b2[_0xdc10('0x9')](_0xdc10('0xa'),attributes,{'tableName':_0xdc10('0xb'),'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 762d336..771d2aa 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 _0xeceb=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x18747c,_0xdf0ed0){var _0x250b60=function(_0x154966){while(--_0x154966){_0x18747c['push'](_0x18747c['shift']());}};_0x250b60(++_0xdf0ed0);}(_0xeceb,0x10d));var _0xbece=function(_0x41e63e,_0x59a1ea){_0x41e63e=_0x41e63e-0x0;var _0x14aca1=_0xeceb[_0x41e63e];return _0x14aca1;};'use strict';var _=require(_0xbece('0x0'));var util=require(_0xbece('0x1'));var moment=require('moment');var BPromise=require(_0xbece('0x2'));var rs=require(_0xbece('0x3'));var fs=require('fs');var Redis=require(_0xbece('0x4'));var db=require(_0xbece('0x5'))['db'];var utils=require(_0xbece('0x6'));var logger=require(_0xbece('0x7'))(_0xbece('0x8'));var config=require(_0xbece('0x9'));var jayson=require(_0xbece('0xa'));var client=jayson[_0xbece('0xb')][_0xbece('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a978f,_0x258130,_0x304530){return new BPromise(function(_0x3312aa,_0x146cc7){return client[_0xbece('0xd')](_0x3a978f,_0x304530)[_0xbece('0xe')](function(_0x599a18){logger[_0xbece('0xf')](_0xbece('0x10'),_0x258130,_0xbece('0x11'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x258130,_0xbece('0x11'),JSON[_0xbece('0x12')](_0x599a18));if(_0x599a18[_0xbece('0x13')]){if(_0x599a18[_0xbece('0x13')][_0xbece('0x14')]===0x1f4){logger[_0xbece('0x13')](_0xbece('0x10'),_0x258130,_0x599a18[_0xbece('0x13')]['message']);return _0x146cc7(_0x599a18[_0xbece('0x13')][_0xbece('0x15')]);}logger[_0xbece('0x13')](_0xbece('0x10'),_0x258130,_0x599a18['error']['message']);return _0x3312aa(_0x599a18[_0xbece('0x13')][_0xbece('0x15')]);}else{logger[_0xbece('0xf')](_0xbece('0x10'),_0x258130,'request\x20sent');_0x3312aa(_0x599a18[_0xbece('0x16')][_0xbece('0x15')]);}})['catch'](function(_0x1193a7){logger['error'](_0xbece('0x10'),_0x258130,_0x1193a7);_0x146cc7(_0x1193a7);});});} \ No newline at end of file +var _0xfb70=['CloudProvider,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb70,0xb2));var _0x0fb7=function(_0x4360d8,_0x266dec){_0x4360d8=_0x4360d8-0x0;var _0x37bd31=_0xfb70[_0x4360d8];return _0x37bd31;};'use strict';var _=require(_0x0fb7('0x0'));var util=require(_0x0fb7('0x1'));var moment=require('moment');var BPromise=require(_0x0fb7('0x2'));var rs=require(_0x0fb7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0fb7('0x4'))['db'];var utils=require(_0x0fb7('0x5'));var logger=require(_0x0fb7('0x6'))(_0x0fb7('0x7'));var config=require(_0x0fb7('0x8'));var jayson=require(_0x0fb7('0x9'));var client=jayson[_0x0fb7('0xa')][_0x0fb7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b1648,_0x1f83f8,_0x44dbc8){return new BPromise(function(_0x40dd63,_0x20347e){return client[_0x0fb7('0xc')](_0x1b1648,_0x44dbc8)['then'](function(_0x3920a4){logger[_0x0fb7('0xd')]('CloudProvider,\x20%s,\x20%s',_0x1f83f8,_0x0fb7('0xe'));logger['debug'](_0x0fb7('0xf'),_0x1f83f8,'request\x20sent',JSON[_0x0fb7('0x10')](_0x3920a4));if(_0x3920a4[_0x0fb7('0x11')]){if(_0x3920a4[_0x0fb7('0x11')][_0x0fb7('0x12')]===0x1f4){logger[_0x0fb7('0x11')]('CloudProvider,\x20%s,\x20%s',_0x1f83f8,_0x3920a4[_0x0fb7('0x11')][_0x0fb7('0x13')]);return _0x20347e(_0x3920a4[_0x0fb7('0x11')][_0x0fb7('0x13')]);}logger[_0x0fb7('0x11')](_0x0fb7('0x14'),_0x1f83f8,_0x3920a4[_0x0fb7('0x11')][_0x0fb7('0x13')]);return _0x40dd63(_0x3920a4[_0x0fb7('0x11')][_0x0fb7('0x13')]);}else{logger[_0x0fb7('0xd')](_0x0fb7('0x14'),_0x1f83f8,_0x0fb7('0xe'));_0x40dd63(_0x3920a4['result'][_0x0fb7('0x13')]);}})[_0x0fb7('0x15')](function(_0x1020d7){logger[_0x0fb7('0x11')](_0x0fb7('0x14'),_0x1f83f8,_0x1020d7);_0x20347e(_0x1020d7);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 21fbf3e..b4f5c89 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 _0x02d6=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cloudProvider.controller','index','get','isAuthenticated','show','post','create','update'];(function(_0x7ebbaa,_0x159536){var _0x3c503c=function(_0x5b5938){while(--_0x5b5938){_0x7ebbaa['push'](_0x7ebbaa['shift']());}};_0x3c503c(++_0x159536);}(_0x02d6,0x1df));var _0x602d=function(_0x2b5bab,_0x2018e1){_0x2b5bab=_0x2b5bab-0x0;var _0x243b04=_0x02d6[_0x2b5bab];return _0x243b04;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x602d('0x0'));var timeout=require(_0x602d('0x1'));var express=require(_0x602d('0x2'));var router=express[_0x602d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x602d('0x4'));var interaction=require(_0x602d('0x5'));var config=require('../../config/environment');var controller=require(_0x602d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x602d('0x7')]);router[_0x602d('0x8')]('/:id',auth[_0x602d('0x9')](),controller[_0x602d('0xa')]);router[_0x602d('0xb')]('/',auth[_0x602d('0x9')](),controller[_0x602d('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x602d('0xd')]);router[_0x602d('0xe')]('/:id',auth[_0x602d('0x9')](),controller[_0x602d('0xf')]);module[_0x602d('0x10')]=router; \ No newline at end of file +var _0x4c4c=['./cloudProvider.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4c4c,0xad));var _0xc4c4=function(_0x15571f,_0x592026){_0x15571f=_0x15571f-0x0;var _0x3b4708=_0x4c4c[_0x15571f];return _0x3b4708;};'use strict';var multer=require('multer');var util=require(_0xc4c4('0x0'));var path=require(_0xc4c4('0x1'));var timeout=require(_0xc4c4('0x2'));var express=require(_0xc4c4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc4c4('0x4'));var interaction=require(_0xc4c4('0x5'));var config=require(_0xc4c4('0x6'));var controller=require(_0xc4c4('0x7'));router['get']('/',auth[_0xc4c4('0x8')](),controller[_0xc4c4('0x9')]);router[_0xc4c4('0xa')](_0xc4c4('0xb'),auth[_0xc4c4('0x8')](),controller[_0xc4c4('0xc')]);router[_0xc4c4('0xd')]('/',auth[_0xc4c4('0x8')](),controller[_0xc4c4('0xe')]);router[_0xc4c4('0xf')](_0xc4c4('0xb'),auth['isAuthenticated'](),controller[_0xc4c4('0x10')]);router[_0xc4c4('0x11')](_0xc4c4('0xb'),auth['isAuthenticated'](),controller[_0xc4c4('0x12')]);module[_0xc4c4('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 6fbe418..26e875a 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 _0x1b7d=['STRING','name','sequelize','exports'];(function(_0x5ec134,_0x47c983){var _0x80b765=function(_0x158477){while(--_0x158477){_0x5ec134['push'](_0x5ec134['shift']());}};_0x80b765(++_0x47c983);}(_0x1b7d,0x116));var _0xd1b7=function(_0x390991,_0x56eca0){_0x390991=_0x390991-0x0;var _0x18a726=_0x1b7d[_0x390991];return _0x18a726;};'use strict';var Sequelize=require(_0xd1b7('0x0'));module[_0xd1b7('0x1')]={'name':{'type':Sequelize[_0xd1b7('0x2')],'unique':_0xd1b7('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd1b7('0x2')]},'companyId':{'type':Sequelize[_0xd1b7('0x2')]},'website':{'type':Sequelize[_0xd1b7('0x2')]},'phone':{'type':Sequelize[_0xd1b7('0x2')]},'fax':{'type':Sequelize[_0xd1b7('0x2')]},'type':{'type':Sequelize[_0xd1b7('0x2')]},'street':{'type':Sequelize[_0xd1b7('0x2')]},'postalCode':{'type':Sequelize[_0xd1b7('0x2')]},'city':{'type':Sequelize[_0xd1b7('0x2')]},'country':{'type':Sequelize[_0xd1b7('0x2')]},'email':{'type':Sequelize[_0xd1b7('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xd1b7('0x2')]},'sStreet':{'type':Sequelize[_0xd1b7('0x2')]},'sPostalCode':{'type':Sequelize[_0xd1b7('0x2')]},'sCity':{'type':Sequelize[_0xd1b7('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd1b7('0x2')]}}; \ No newline at end of file +var _0x27f5=['STRING','sequelize','exports'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x27f5,0x17b));var _0x527f=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x27f5[_0x580647];return _0x5f0792;};'use strict';var Sequelize=require(_0x527f('0x0'));module[_0x527f('0x1')]={'name':{'type':Sequelize[_0x527f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x527f('0x2')]},'companyId':{'type':Sequelize[_0x527f('0x2')]},'website':{'type':Sequelize[_0x527f('0x2')]},'phone':{'type':Sequelize[_0x527f('0x2')]},'fax':{'type':Sequelize[_0x527f('0x2')]},'type':{'type':Sequelize[_0x527f('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x527f('0x2')]},'city':{'type':Sequelize[_0x527f('0x2')]},'country':{'type':Sequelize[_0x527f('0x2')]},'email':{'type':Sequelize[_0x527f('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x527f('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x527f('0x2')]},'sCountry':{'type':Sequelize[_0x527f('0x2')]},'description':{'type':Sequelize[_0x527f('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 241f918..0b73f01 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 _0xc130=['autoAssociation','error','body','destroy','addContacts','ids','findOne','CmContact','rawAttributes','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Companies','UserProfileResource','sendStatus','name','send','merge','contact','message','agent','interaction','account','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','filter','CmCompany','include','findAll','rows','catch','show','params','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','userProfileId'];(function(_0x373a8d,_0x330797){var _0x10054c=function(_0xd97897){while(--_0xd97897){_0x373a8d['push'](_0x373a8d['shift']());}};_0x10054c(++_0x330797);}(_0xc130,0x115));var _0x0c13=function(_0x3062a6,_0x212947){_0x3062a6=_0x3062a6-0x0;var _0x50da39=_0xc130[_0x3062a6];return _0x50da39;};'use strict';var emlformat=require(_0x0c13('0x0'));var rimraf=require(_0x0c13('0x1'));var zipdir=require(_0x0c13('0x2'));var jsonpatch=require(_0x0c13('0x3'));var rp=require(_0x0c13('0x4'));var moment=require(_0x0c13('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0c13('0x6'));var util=require(_0x0c13('0x7'));var path=require('path');var sox=require(_0x0c13('0x8'));var csv=require(_0x0c13('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c13('0xa'));var squel=require(_0x0c13('0xb'));var crypto=require(_0x0c13('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0c13('0xd'));var toCsv=require(_0x0c13('0x9'));var querystring=require('querystring');var Papa=require(_0x0c13('0xe'));var Redis=require(_0x0c13('0xf'));var authService=require(_0x0c13('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0c13('0x11'));var hardwareService=require(_0x0c13('0x12'));var logger=require(_0x0c13('0x13'))(_0x0c13('0x14'));var utils=require('../../config/utils');var config=require(_0x0c13('0x15'));var licenseUtil=require(_0x0c13('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb4d472,_0x326995){_0x326995=_0x326995||0xcc;return function(_0xfe6857){if(_0xfe6857){return _0xb4d472['sendStatus'](_0x326995);}return _0xb4d472[_0x0c13('0x17')](_0x326995)[_0x0c13('0x18')]();};}function respondWithResult(_0x59781f,_0x3b0031){_0x3b0031=_0x3b0031||0xc8;return function(_0x571027){if(_0x571027){return _0x59781f['status'](_0x3b0031)['json'](_0x571027);}};}function respondWithFilteredResult(_0x4da34f,_0x1002f8){return function(_0x370907){if(_0x370907){var _0x211938=typeof _0x1002f8['offset']===_0x0c13('0x19')&&typeof _0x1002f8[_0x0c13('0x1a')]===_0x0c13('0x19');var _0xb722b8=_0x370907[_0x0c13('0x1b')];var _0x2250b4=_0x211938?0x0:_0x1002f8[_0x0c13('0x1c')];var _0xaf865a=_0x211938?_0x370907[_0x0c13('0x1b')]:_0x1002f8[_0x0c13('0x1c')]+_0x1002f8[_0x0c13('0x1a')];var _0x4a6782;if(_0xaf865a>=_0xb722b8){_0xaf865a=_0xb722b8;_0x4a6782=0xc8;}else{_0x4a6782=0xce;}_0x4da34f[_0x0c13('0x17')](_0x4a6782);return _0x4da34f[_0x0c13('0x1d')](_0x0c13('0x1e'),_0x2250b4+'-'+_0xaf865a+'/'+_0xb722b8)['json'](_0x370907);}return null;};}function patchUpdates(_0x478270){return function(_0x21c36d){try{jsonpatch[_0x0c13('0x1f')](_0x21c36d,_0x478270,!![]);}catch(_0x4eafb1){return BPromise[_0x0c13('0x20')](_0x4eafb1);}return _0x21c36d[_0x0c13('0x21')]();};}function saveUpdates(_0x33297e,_0x33b4f8){return function(_0x911eff){if(_0x911eff){return _0x911eff[_0x0c13('0x22')](_0x33297e)[_0x0c13('0x23')](function(_0x3cdfb0){return _0x3cdfb0;});}return null;};}function removeEntity(_0x6252e4,_0x3abf8f){return function(_0x1c5aea){if(_0x1c5aea){return _0x1c5aea['destroy']()[_0x0c13('0x23')](function(){var _0x1b8344=_0x1c5aea['get']({'plain':!![]});var _0x45cbe4=_0x0c13('0x24');return db[_0x0c13('0x25')]['destroy']({'where':{'type':_0x45cbe4,'resourceId':_0x1b8344['id']}})[_0x0c13('0x23')](function(){return _0x1c5aea;});})[_0x0c13('0x23')](function(){_0x6252e4[_0x0c13('0x17')](0xcc)[_0x0c13('0x18')]();});}};}function handleEntityNotFound(_0x76fe03,_0x3417c9){return function(_0x21d5e6){if(!_0x21d5e6){_0x76fe03[_0x0c13('0x26')](0x194);}return _0x21d5e6;};}function handleError(_0x401f5e,_0x4008c2){_0x4008c2=_0x4008c2||0x1f4;return function(_0x3924ab){logger['error'](_0x3924ab['stack']);if(_0x3924ab['name']){delete _0x3924ab[_0x0c13('0x27')];}_0x401f5e['status'](_0x4008c2)[_0x0c13('0x28')](_0x3924ab);};}function getMustacheRender(_0xdd034d,_0x3c9ef1){return Mustache['render'](_0xdd034d,_[_0x0c13('0x29')](_0x3c9ef1['body'],{'contact':_0x3c9ef1[_0x0c13('0x2a')],'message':_0x3c9ef1[_0x0c13('0x2b')],'agent':_0x3c9ef1[_0x0c13('0x2c')],'interaction':_0x3c9ef1[_0x0c13('0x2d')],'account':_0x3c9ef1[_0x0c13('0x2e')]}))||'';}exports['index']=function(_0x4e2442,_0x24c1a7){var _0x3b2e49={},_0xef46b8={},_0x1df519={'count':0x0,'rows':[]};return db['CmCompany'][_0x0c13('0x2f')]()[_0x0c13('0x23')](function(_0x366314){_0xef46b8[_0x0c13('0x30')]=_[_0x0c13('0x31')](_0x366314);_0xef46b8[_0x0c13('0x32')]=_[_0x0c13('0x31')](_0x4e2442[_0x0c13('0x32')]);_0xef46b8[_0x0c13('0x33')]=_[_0x0c13('0x34')](_0xef46b8['model'],_0xef46b8[_0x0c13('0x32')]);_0x3b2e49[_0x0c13('0x35')]=_['intersection'](_0xef46b8[_0x0c13('0x30')],qs[_0x0c13('0x36')](_0x4e2442[_0x0c13('0x32')][_0x0c13('0x36')]));_0x3b2e49[_0x0c13('0x35')]=_0x3b2e49[_0x0c13('0x35')][_0x0c13('0x37')]?_0x3b2e49[_0x0c13('0x35')]:_0xef46b8[_0x0c13('0x30')];if(!_0x4e2442[_0x0c13('0x32')][_0x0c13('0x38')](_0x0c13('0x39'))){_0x3b2e49['limit']=qs['limit'](_0x4e2442[_0x0c13('0x32')][_0x0c13('0x1a')]);_0x3b2e49[_0x0c13('0x1c')]=qs[_0x0c13('0x1c')](_0x4e2442[_0x0c13('0x32')]['offset']);}_0x3b2e49[_0x0c13('0x3a')]=qs[_0x0c13('0x3b')](_0x4e2442[_0x0c13('0x32')][_0x0c13('0x3b')]);_0x3b2e49[_0x0c13('0x3c')]=qs['filters'](_[_0x0c13('0x3d')](_0x4e2442[_0x0c13('0x32')],_0xef46b8[_0x0c13('0x33')]),_0x366314);if(_0x4e2442['query']['filter']){_0x3b2e49['where']=_['merge'](_0x3b2e49[_0x0c13('0x3c')],{'$or':_[_0x0c13('0x3e')](_0x3b2e49[_0x0c13('0x35')],function(_0x3afaef){var _0x2cfcfe={};_0x2cfcfe[_0x3afaef]={'$like':'%'+_0x4e2442[_0x0c13('0x32')][_0x0c13('0x3f')]+'%'};return _0x2cfcfe;})});}_0x3b2e49=_[_0x0c13('0x29')]({},_0x3b2e49,_0x4e2442['options']);var _0x5f272f={'where':_0x3b2e49[_0x0c13('0x3c')]};return db[_0x0c13('0x40')][_0x0c13('0x1b')](_0x5f272f)['then'](function(_0xeb9af9){_0x1df519[_0x0c13('0x1b')]=_0xeb9af9;if(_0x4e2442[_0x0c13('0x32')]['includeAll']){_0x3b2e49[_0x0c13('0x41')]=[{'all':!![]}];}return db['CmCompany'][_0x0c13('0x42')](_0x3b2e49);})[_0x0c13('0x23')](function(_0x50f6f2){_0x1df519[_0x0c13('0x43')]=_0x50f6f2;return _0x1df519;})[_0x0c13('0x23')](respondWithFilteredResult(_0x24c1a7,_0x3b2e49))[_0x0c13('0x44')](handleError(_0x24c1a7,null));})[_0x0c13('0x44')](handleError(_0x24c1a7,null));};exports[_0x0c13('0x45')]=function(_0x1d5acc,_0x3ef69e){var _0x56a987={'raw':![],'where':{'id':_0x1d5acc[_0x0c13('0x46')]['id']}},_0x29fce4={};_0x29fce4['model']=_[_0x0c13('0x31')](db[_0x0c13('0x40')]['rawAttributes']);_0x29fce4['query']=_[_0x0c13('0x31')](_0x1d5acc[_0x0c13('0x32')]);_0x29fce4[_0x0c13('0x33')]=_[_0x0c13('0x34')](_0x29fce4[_0x0c13('0x30')],_0x29fce4[_0x0c13('0x32')]);_0x56a987[_0x0c13('0x35')]=_['intersection'](_0x29fce4[_0x0c13('0x30')],qs[_0x0c13('0x36')](_0x1d5acc['query'][_0x0c13('0x36')]));_0x56a987[_0x0c13('0x35')]=_0x56a987[_0x0c13('0x35')][_0x0c13('0x37')]?_0x56a987[_0x0c13('0x35')]:_0x29fce4['model'];if(_0x1d5acc[_0x0c13('0x32')]['includeAll']){_0x56a987['include']=[{'all':!![]}];}_0x56a987=_['merge']({},_0x56a987,_0x1d5acc[_0x0c13('0x47')]);return db['CmCompany'][_0x0c13('0x48')](_0x56a987)[_0x0c13('0x23')](handleEntityNotFound(_0x3ef69e,null))['then'](respondWithResult(_0x3ef69e,null))['catch'](handleError(_0x3ef69e,null));};exports[_0x0c13('0x49')]=function(_0x11c817,_0x1141f6){return db['CmCompany'][_0x0c13('0x49')](_0x11c817['body'],{})[_0x0c13('0x23')](function(_0x5df5ac){var _0x43db43=_0x11c817['user']['get']({'plain':!![]});if(!_0x43db43)throw new Error(_0x0c13('0x4a'));if(_0x43db43[_0x0c13('0x4b')]===_0x0c13('0x4c')){var _0x8710d0=_0x5df5ac[_0x0c13('0x4d')]({'plain':!![]});var _0x1d2e25='Companies';return db['UserProfileSection'][_0x0c13('0x48')]({'where':{'name':_0x1d2e25,'userProfileId':_0x43db43[_0x0c13('0x4e')]},'raw':!![]})[_0x0c13('0x23')](function(_0x19ffc0){if(_0x19ffc0&&_0x19ffc0[_0x0c13('0x4f')]===0x0){return db['UserProfileResource'][_0x0c13('0x49')]({'name':_0x8710d0[_0x0c13('0x27')],'resourceId':_0x8710d0['id'],'type':_0x19ffc0[_0x0c13('0x27')],'sectionId':_0x19ffc0['id']},{})[_0x0c13('0x23')](function(){return _0x5df5ac;});}else{return _0x5df5ac;}})[_0x0c13('0x44')](function(_0x2c9311){logger[_0x0c13('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c9311);throw _0x2c9311;});}return _0x5df5ac;})['then'](respondWithResult(_0x1141f6,0xc9))['catch'](handleError(_0x1141f6,null));};exports[_0x0c13('0x22')]=function(_0x35fa39,_0x481802){if(_0x35fa39[_0x0c13('0x51')]['id']){delete _0x35fa39[_0x0c13('0x51')]['id'];}return db[_0x0c13('0x40')][_0x0c13('0x48')]({'where':{'id':_0x35fa39[_0x0c13('0x46')]['id']}})['then'](handleEntityNotFound(_0x481802,null))['then'](saveUpdates(_0x35fa39[_0x0c13('0x51')],null))[_0x0c13('0x23')](respondWithResult(_0x481802,null))[_0x0c13('0x44')](handleError(_0x481802,null));};exports[_0x0c13('0x52')]=function(_0x3dc6e0,_0x14ec39){return db[_0x0c13('0x40')][_0x0c13('0x48')]({'where':{'id':_0x3dc6e0[_0x0c13('0x46')]['id']}})[_0x0c13('0x23')](handleEntityNotFound(_0x14ec39,null))['then'](removeEntity(_0x14ec39,null))['catch'](handleError(_0x14ec39,null));};exports[_0x0c13('0x2f')]=function(_0x332d40,_0x3b6b37){return db['CmCompany'][_0x0c13('0x2f')]()[_0x0c13('0x23')](respondWithResult(_0x3b6b37,null))[_0x0c13('0x44')](handleError(_0x3b6b37,null));};exports[_0x0c13('0x53')]=function(_0x41d034,_0x2993c0,_0x788dcb){return db['CmContact'][_0x0c13('0x48')]({'where':{'id':_0x41d034[_0x0c13('0x46')]['id']}})[_0x0c13('0x23')](handleEntityNotFound(_0x2993c0,null))[_0x0c13('0x23')](function(_0x54f173){if(_0x54f173){return _0x54f173[_0x0c13('0x53')](_0x41d034[_0x0c13('0x51')][_0x0c13('0x54')],_['omit'](_0x41d034[_0x0c13('0x51')],[_0x0c13('0x54'),'id'])||{});}})[_0x0c13('0x23')](respondWithResult(_0x2993c0,null))['catch'](handleError(_0x2993c0,null));};exports['getContacts']=function(_0x26f058,_0x5cc742,_0x6ac197){var _0xa90316={};var _0xfc6b43={};var _0x5cc802;var _0x3db3e8;return db[_0x0c13('0x40')][_0x0c13('0x55')]({'where':{'id':_0x26f058['params']['id']}})[_0x0c13('0x23')](handleEntityNotFound(_0x5cc742,null))['then'](function(_0x4b1d21){if(_0x4b1d21){_0x5cc802=_0x4b1d21;_0xfc6b43['model']=_[_0x0c13('0x31')](db[_0x0c13('0x56')][_0x0c13('0x57')]);_0xfc6b43[_0x0c13('0x32')]=_[_0x0c13('0x31')](_0x26f058[_0x0c13('0x32')]);_0xfc6b43[_0x0c13('0x33')]=_['intersection'](_0xfc6b43['model'],_0xfc6b43[_0x0c13('0x32')]);_0xa90316[_0x0c13('0x35')]=_['intersection'](_0xfc6b43['model'],qs[_0x0c13('0x36')](_0x26f058[_0x0c13('0x32')]['fields']));_0xa90316['attributes']=_0xa90316['attributes'][_0x0c13('0x37')]?_0xa90316[_0x0c13('0x35')]:_0xfc6b43[_0x0c13('0x30')];_0xa90316[_0x0c13('0x3a')]=qs['sort'](_0x26f058[_0x0c13('0x32')]['sort']);_0xa90316[_0x0c13('0x3c')]=qs[_0x0c13('0x33')](_['pick'](_0x26f058[_0x0c13('0x32')],_0xfc6b43[_0x0c13('0x33')]));if(_0x26f058[_0x0c13('0x32')]['filter']){_0xa90316[_0x0c13('0x3c')]=_['merge'](_0xa90316['where'],{'$or':_[_0x0c13('0x3e')](_0xa90316[_0x0c13('0x35')],function(_0x143e70){var _0x5c90a1={};_0x5c90a1[_0x143e70]={'$like':'%'+_0x26f058[_0x0c13('0x32')][_0x0c13('0x3f')]+'%'};return _0x5c90a1;})});}_0xa90316=_[_0x0c13('0x29')]({},_0xa90316,_0x26f058[_0x0c13('0x47')]);return _0x5cc802['getContacts'](_0xa90316);}})[_0x0c13('0x23')](function(_0x338706){if(_0x338706){_0x3db3e8=_0x338706[_0x0c13('0x37')];if(!_0x26f058[_0x0c13('0x32')][_0x0c13('0x38')](_0x0c13('0x39'))){_0xa90316['limit']=qs[_0x0c13('0x1a')](_0x26f058[_0x0c13('0x32')][_0x0c13('0x1a')]);_0xa90316[_0x0c13('0x1c')]=qs[_0x0c13('0x1c')](_0x26f058[_0x0c13('0x32')]['offset']);}return _0x5cc802[_0x0c13('0x58')](_0xa90316);}})['then'](function(_0x63100c){if(_0x63100c){return _0x63100c?{'count':_0x3db3e8,'rows':_0x63100c}:null;}})['then'](respondWithResult(_0x5cc742,null))['catch'](handleError(_0x5cc742,null));}; \ No newline at end of file +var _0x6ff8=['catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','findOne','rimraf','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','reject','save','update','then','destroy','get','Companies','UserProfileResource','end','error','stack','name','render','body','contact','message','agent','interaction','account','index','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','merge','options','includeAll','include','CmCompany','findAll','rows'];(function(_0x5891aa,_0x2baf88){var _0xabe03d=function(_0x4b06b8){while(--_0x4b06b8){_0x5891aa['push'](_0x5891aa['shift']());}};_0xabe03d(++_0x2baf88);}(_0x6ff8,0x182));var _0x86ff=function(_0x1a4b42,_0x198645){_0x1a4b42=_0x1a4b42-0x0;var _0x4e78a9=_0x6ff8[_0x1a4b42];return _0x4e78a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86ff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86ff('0x1'));var Mustache=require(_0x86ff('0x2'));var util=require('util');var path=require(_0x86ff('0x3'));var sox=require('sox');var csv=require(_0x86ff('0x4'));var ejs=require(_0x86ff('0x5'));var fs=require('fs');var fs_extra=require(_0x86ff('0x6'));var _=require('lodash');var squel=require(_0x86ff('0x7'));var crypto=require(_0x86ff('0x8'));var jsforce=require(_0x86ff('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x86ff('0x4'));var querystring=require(_0x86ff('0xa'));var Papa=require(_0x86ff('0xb'));var Redis=require('ioredis');var authService=require(_0x86ff('0xc'));var qs=require(_0x86ff('0xd'));var as=require(_0x86ff('0xe'));var hardwareService=require(_0x86ff('0xf'));var logger=require(_0x86ff('0x10'))('api');var utils=require(_0x86ff('0x11'));var config=require(_0x86ff('0x12'));var licenseUtil=require(_0x86ff('0x13'));var db=require(_0x86ff('0x14'))['db'];function respondWithStatusCode(_0x1a42a6,_0x282fef){_0x282fef=_0x282fef||0xcc;return function(_0x15385d){if(_0x15385d){return _0x1a42a6[_0x86ff('0x15')](_0x282fef);}return _0x1a42a6[_0x86ff('0x16')](_0x282fef)['end']();};}function respondWithResult(_0x4e29b9,_0x31b878){_0x31b878=_0x31b878||0xc8;return function(_0xc06f23){if(_0xc06f23){return _0x4e29b9['status'](_0x31b878)['json'](_0xc06f23);}};}function respondWithFilteredResult(_0x384353,_0x333a41){return function(_0x45d432){if(_0x45d432){var _0xea1276=typeof _0x333a41['offset']===_0x86ff('0x17')&&typeof _0x333a41[_0x86ff('0x18')]==='undefined';var _0x37cdc2=_0x45d432['count'];var _0x3bbfeb=_0xea1276?0x0:_0x333a41[_0x86ff('0x19')];var _0x39bafa=_0xea1276?_0x45d432[_0x86ff('0x1a')]:_0x333a41[_0x86ff('0x19')]+_0x333a41[_0x86ff('0x18')];var _0x5003bc;if(_0x39bafa>=_0x37cdc2){_0x39bafa=_0x37cdc2;_0x5003bc=0xc8;}else{_0x5003bc=0xce;}_0x384353['status'](_0x5003bc);return _0x384353[_0x86ff('0x1b')](_0x86ff('0x1c'),_0x3bbfeb+'-'+_0x39bafa+'/'+_0x37cdc2)[_0x86ff('0x1d')](_0x45d432);}return null;};}function patchUpdates(_0x1fe04a){return function(_0x56a2e4){try{jsonpatch['apply'](_0x56a2e4,_0x1fe04a,!![]);}catch(_0x58047d){return BPromise[_0x86ff('0x1e')](_0x58047d);}return _0x56a2e4[_0x86ff('0x1f')]();};}function saveUpdates(_0x289ad6,_0x442f38){return function(_0x4c2589){if(_0x4c2589){return _0x4c2589[_0x86ff('0x20')](_0x289ad6)[_0x86ff('0x21')](function(_0x317f51){return _0x317f51;});}return null;};}function removeEntity(_0x3baca3,_0x3eab58){return function(_0x18ce58){if(_0x18ce58){return _0x18ce58[_0x86ff('0x22')]()[_0x86ff('0x21')](function(){var _0x4940b4=_0x18ce58[_0x86ff('0x23')]({'plain':!![]});var _0x16ec3a=_0x86ff('0x24');return db[_0x86ff('0x25')][_0x86ff('0x22')]({'where':{'type':_0x16ec3a,'resourceId':_0x4940b4['id']}})[_0x86ff('0x21')](function(){return _0x18ce58;});})[_0x86ff('0x21')](function(){_0x3baca3[_0x86ff('0x16')](0xcc)[_0x86ff('0x26')]();});}};}function handleEntityNotFound(_0x37ebd4,_0x23ff07){return function(_0x5f5ce3){if(!_0x5f5ce3){_0x37ebd4[_0x86ff('0x15')](0x194);}return _0x5f5ce3;};}function handleError(_0x407bbd,_0x3062d6){_0x3062d6=_0x3062d6||0x1f4;return function(_0x13623d){logger[_0x86ff('0x27')](_0x13623d[_0x86ff('0x28')]);if(_0x13623d['name']){delete _0x13623d[_0x86ff('0x29')];}_0x407bbd['status'](_0x3062d6)['send'](_0x13623d);};}function getMustacheRender(_0x296c2a,_0x140a23){return Mustache[_0x86ff('0x2a')](_0x296c2a,_['merge'](_0x140a23[_0x86ff('0x2b')],{'contact':_0x140a23[_0x86ff('0x2c')],'message':_0x140a23[_0x86ff('0x2d')],'agent':_0x140a23[_0x86ff('0x2e')],'interaction':_0x140a23[_0x86ff('0x2f')],'account':_0x140a23[_0x86ff('0x30')]}))||'';}exports[_0x86ff('0x31')]=function(_0x3d6039,_0x3136f5){var _0x4123a3={},_0x5f5422={},_0x39baf1={'count':0x0,'rows':[]};return db['CmCompany'][_0x86ff('0x32')]()[_0x86ff('0x21')](function(_0x46cc06){_0x5f5422[_0x86ff('0x33')]=_[_0x86ff('0x34')](_0x46cc06);_0x5f5422[_0x86ff('0x35')]=_[_0x86ff('0x34')](_0x3d6039['query']);_0x5f5422[_0x86ff('0x36')]=_[_0x86ff('0x37')](_0x5f5422[_0x86ff('0x33')],_0x5f5422[_0x86ff('0x35')]);_0x4123a3[_0x86ff('0x38')]=_['intersection'](_0x5f5422[_0x86ff('0x33')],qs[_0x86ff('0x39')](_0x3d6039[_0x86ff('0x35')][_0x86ff('0x39')]));_0x4123a3['attributes']=_0x4123a3['attributes'][_0x86ff('0x3a')]?_0x4123a3[_0x86ff('0x38')]:_0x5f5422[_0x86ff('0x33')];if(!_0x3d6039['query'][_0x86ff('0x3b')](_0x86ff('0x3c'))){_0x4123a3['limit']=qs[_0x86ff('0x18')](_0x3d6039['query']['limit']);_0x4123a3[_0x86ff('0x19')]=qs['offset'](_0x3d6039[_0x86ff('0x35')][_0x86ff('0x19')]);}_0x4123a3[_0x86ff('0x3d')]=qs[_0x86ff('0x3e')](_0x3d6039[_0x86ff('0x35')][_0x86ff('0x3e')]);_0x4123a3['where']=qs['filters'](_[_0x86ff('0x3f')](_0x3d6039[_0x86ff('0x35')],_0x5f5422[_0x86ff('0x36')]),_0x46cc06);if(_0x3d6039[_0x86ff('0x35')][_0x86ff('0x40')]){_0x4123a3[_0x86ff('0x41')]=_['merge'](_0x4123a3[_0x86ff('0x41')],{'$or':_[_0x86ff('0x42')](_0x4123a3[_0x86ff('0x38')],function(_0x55e952){var _0xacafa6={};_0xacafa6[_0x55e952]={'$like':'%'+_0x3d6039['query']['filter']+'%'};return _0xacafa6;})});}_0x4123a3=_[_0x86ff('0x43')]({},_0x4123a3,_0x3d6039[_0x86ff('0x44')]);var _0x35d667={'where':_0x4123a3[_0x86ff('0x41')]};return db['CmCompany']['count'](_0x35d667)[_0x86ff('0x21')](function(_0x22e263){_0x39baf1['count']=_0x22e263;if(_0x3d6039[_0x86ff('0x35')][_0x86ff('0x45')]){_0x4123a3[_0x86ff('0x46')]=[{'all':!![]}];}return db[_0x86ff('0x47')][_0x86ff('0x48')](_0x4123a3);})[_0x86ff('0x21')](function(_0x3e5efa){_0x39baf1[_0x86ff('0x49')]=_0x3e5efa;return _0x39baf1;})[_0x86ff('0x21')](respondWithFilteredResult(_0x3136f5,_0x4123a3))[_0x86ff('0x4a')](handleError(_0x3136f5,null));})[_0x86ff('0x4a')](handleError(_0x3136f5,null));};exports[_0x86ff('0x4b')]=function(_0x446757,_0x4e3a51){var _0x53b86c={'raw':![],'where':{'id':_0x446757[_0x86ff('0x4c')]['id']}},_0x3d6a08={};_0x3d6a08[_0x86ff('0x33')]=_[_0x86ff('0x34')](db[_0x86ff('0x47')][_0x86ff('0x4d')]);_0x3d6a08['query']=_['keys'](_0x446757['query']);_0x3d6a08[_0x86ff('0x36')]=_[_0x86ff('0x37')](_0x3d6a08[_0x86ff('0x33')],_0x3d6a08[_0x86ff('0x35')]);_0x53b86c[_0x86ff('0x38')]=_['intersection'](_0x3d6a08[_0x86ff('0x33')],qs[_0x86ff('0x39')](_0x446757[_0x86ff('0x35')][_0x86ff('0x39')]));_0x53b86c['attributes']=_0x53b86c['attributes']['length']?_0x53b86c[_0x86ff('0x38')]:_0x3d6a08[_0x86ff('0x33')];if(_0x446757[_0x86ff('0x35')][_0x86ff('0x45')]){_0x53b86c[_0x86ff('0x46')]=[{'all':!![]}];}_0x53b86c=_[_0x86ff('0x43')]({},_0x53b86c,_0x446757[_0x86ff('0x44')]);return db[_0x86ff('0x47')][_0x86ff('0x4e')](_0x53b86c)[_0x86ff('0x21')](handleEntityNotFound(_0x4e3a51,null))['then'](respondWithResult(_0x4e3a51,null))[_0x86ff('0x4a')](handleError(_0x4e3a51,null));};exports['create']=function(_0x469bfc,_0x376a16){return db[_0x86ff('0x47')][_0x86ff('0x4f')](_0x469bfc[_0x86ff('0x2b')],{})['then'](function(_0x3e1946){var _0x3615e9=_0x469bfc[_0x86ff('0x50')][_0x86ff('0x23')]({'plain':!![]});if(!_0x3615e9)throw new Error(_0x86ff('0x51'));if(_0x3615e9[_0x86ff('0x52')]===_0x86ff('0x50')){var _0x5b3d4d=_0x3e1946['get']({'plain':!![]});var _0x858cc0=_0x86ff('0x24');return db[_0x86ff('0x53')]['find']({'where':{'name':_0x858cc0,'userProfileId':_0x3615e9['userProfileId']},'raw':!![]})['then'](function(_0x270dce){if(_0x270dce&&_0x270dce[_0x86ff('0x54')]===0x0){return db[_0x86ff('0x25')][_0x86ff('0x4f')]({'name':_0x5b3d4d['name'],'resourceId':_0x5b3d4d['id'],'type':_0x270dce[_0x86ff('0x29')],'sectionId':_0x270dce['id']},{})[_0x86ff('0x21')](function(){return _0x3e1946;});}else{return _0x3e1946;}})[_0x86ff('0x4a')](function(_0x41987f){logger[_0x86ff('0x27')](_0x86ff('0x55'),_0x41987f);throw _0x41987f;});}return _0x3e1946;})[_0x86ff('0x21')](respondWithResult(_0x376a16,0xc9))[_0x86ff('0x4a')](handleError(_0x376a16,null));};exports['update']=function(_0x4134c3,_0x10c329){if(_0x4134c3[_0x86ff('0x2b')]['id']){delete _0x4134c3[_0x86ff('0x2b')]['id'];}return db[_0x86ff('0x47')][_0x86ff('0x4e')]({'where':{'id':_0x4134c3[_0x86ff('0x4c')]['id']}})[_0x86ff('0x21')](handleEntityNotFound(_0x10c329,null))['then'](saveUpdates(_0x4134c3[_0x86ff('0x2b')],null))['then'](respondWithResult(_0x10c329,null))['catch'](handleError(_0x10c329,null));};exports[_0x86ff('0x22')]=function(_0x4df6bd,_0x1a2667){return db[_0x86ff('0x47')][_0x86ff('0x4e')]({'where':{'id':_0x4df6bd[_0x86ff('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1a2667,null))[_0x86ff('0x21')](removeEntity(_0x1a2667,null))['catch'](handleError(_0x1a2667,null));};exports['describe']=function(_0x3b89ed,_0x100eb2){return db['CmCompany'][_0x86ff('0x32')]()[_0x86ff('0x21')](respondWithResult(_0x100eb2,null))[_0x86ff('0x4a')](handleError(_0x100eb2,null));};exports[_0x86ff('0x56')]=function(_0x280c44,_0x5b3db8,_0x58ba11){return db[_0x86ff('0x57')][_0x86ff('0x4e')]({'where':{'id':_0x280c44[_0x86ff('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5b3db8,null))[_0x86ff('0x21')](function(_0x15772c){if(_0x15772c){return _0x15772c['addContacts'](_0x280c44[_0x86ff('0x2b')][_0x86ff('0x58')],_[_0x86ff('0x59')](_0x280c44['body'],[_0x86ff('0x58'),'id'])||{});}})[_0x86ff('0x21')](respondWithResult(_0x5b3db8,null))[_0x86ff('0x4a')](handleError(_0x5b3db8,null));};exports[_0x86ff('0x5a')]=function(_0x314825,_0x345f37,_0x27d136){var _0xff6d90={};var _0x293b5c={};var _0x2e99a2;var _0x3bec7c;return db[_0x86ff('0x47')][_0x86ff('0x5b')]({'where':{'id':_0x314825['params']['id']}})[_0x86ff('0x21')](handleEntityNotFound(_0x345f37,null))['then'](function(_0x5df964){if(_0x5df964){_0x2e99a2=_0x5df964;_0x293b5c[_0x86ff('0x33')]=_[_0x86ff('0x34')](db['CmContact'][_0x86ff('0x4d')]);_0x293b5c[_0x86ff('0x35')]=_[_0x86ff('0x34')](_0x314825[_0x86ff('0x35')]);_0x293b5c[_0x86ff('0x36')]=_[_0x86ff('0x37')](_0x293b5c[_0x86ff('0x33')],_0x293b5c['query']);_0xff6d90[_0x86ff('0x38')]=_[_0x86ff('0x37')](_0x293b5c[_0x86ff('0x33')],qs[_0x86ff('0x39')](_0x314825[_0x86ff('0x35')][_0x86ff('0x39')]));_0xff6d90[_0x86ff('0x38')]=_0xff6d90[_0x86ff('0x38')][_0x86ff('0x3a')]?_0xff6d90['attributes']:_0x293b5c[_0x86ff('0x33')];_0xff6d90[_0x86ff('0x3d')]=qs[_0x86ff('0x3e')](_0x314825[_0x86ff('0x35')][_0x86ff('0x3e')]);_0xff6d90[_0x86ff('0x41')]=qs[_0x86ff('0x36')](_[_0x86ff('0x3f')](_0x314825[_0x86ff('0x35')],_0x293b5c[_0x86ff('0x36')]));if(_0x314825[_0x86ff('0x35')][_0x86ff('0x40')]){_0xff6d90[_0x86ff('0x41')]=_[_0x86ff('0x43')](_0xff6d90[_0x86ff('0x41')],{'$or':_[_0x86ff('0x42')](_0xff6d90[_0x86ff('0x38')],function(_0x3c3cd2){var _0x5b34c2={};_0x5b34c2[_0x3c3cd2]={'$like':'%'+_0x314825[_0x86ff('0x35')]['filter']+'%'};return _0x5b34c2;})});}_0xff6d90=_['merge']({},_0xff6d90,_0x314825[_0x86ff('0x44')]);return _0x2e99a2[_0x86ff('0x5a')](_0xff6d90);}})[_0x86ff('0x21')](function(_0x141545){if(_0x141545){_0x3bec7c=_0x141545[_0x86ff('0x3a')];if(!_0x314825[_0x86ff('0x35')][_0x86ff('0x3b')]('nolimit')){_0xff6d90[_0x86ff('0x18')]=qs['limit'](_0x314825[_0x86ff('0x35')][_0x86ff('0x18')]);_0xff6d90[_0x86ff('0x19')]=qs['offset'](_0x314825[_0x86ff('0x35')]['offset']);}return _0x2e99a2[_0x86ff('0x5a')](_0xff6d90);}})[_0x86ff('0x21')](function(_0x52a121){if(_0x52a121){return _0x52a121?{'count':_0x3bec7c,'rows':_0x52a121}:null;}})[_0x86ff('0x21')](respondWithResult(_0x345f37,null))[_0x86ff('0x4a')](handleError(_0x345f37,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 3af5519..b7de441 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 _0x10af=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmCompany','cm_companies'];(function(_0x132ba1,_0x352097){var _0x1af422=function(_0x4622f9){while(--_0x4622f9){_0x132ba1['push'](_0x132ba1['shift']());}};_0x1af422(++_0x352097);}(_0x10af,0xfc));var _0xf10a=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x10af[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xf10a('0x0'));var util=require('util');var logger=require(_0xf10a('0x1'))(_0xf10a('0x2'));var moment=require(_0xf10a('0x3'));var BPromise=require(_0xf10a('0x4'));var rp=require(_0xf10a('0x5'));var fs=require('fs');var path=require(_0xf10a('0x6'));var rimraf=require(_0xf10a('0x7'));var config=require(_0xf10a('0x8'));var attributes=require('./cmCompany.attributes');module[_0xf10a('0x9')]=function(_0xf86ea1,_0x5c9a4c){return _0xf86ea1['define'](_0xf10a('0xa'),attributes,{'tableName':_0xf10a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc03e=['rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','lodash','api','bluebird','path'];(function(_0x4edf50,_0x40a7c9){var _0x3d89be=function(_0x2064d3){while(--_0x2064d3){_0x4edf50['push'](_0x4edf50['shift']());}};_0x3d89be(++_0x40a7c9);}(_0xc03e,0x15a));var _0xec03=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0xc03e[_0x14fad0];return _0x5c665f;};'use strict';var _=require(_0xec03('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xec03('0x1'));var moment=require('moment');var BPromise=require(_0xec03('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec03('0x3'));var rimraf=require(_0xec03('0x4'));var config=require(_0xec03('0x5'));var attributes=require(_0xec03('0x6'));module[_0xec03('0x7')]=function(_0x1ce78a,_0x31db21){return _0x1ce78a[_0xec03('0x8')](_0xec03('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 5a74747..6bca80d 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 _0x5935=['request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','info','CmCompany,\x20%s,\x20%s'];(function(_0x33dcca,_0x2b78c3){var _0x5b5be5=function(_0x1c3b0e){while(--_0x1c3b0e){_0x33dcca['push'](_0x33dcca['shift']());}};_0x5b5be5(++_0x2b78c3);}(_0x5935,0x12e));var _0x5593=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x5935[_0x313c96];return _0x522f53;};'use strict';var _=require(_0x5593('0x0'));var util=require(_0x5593('0x1'));var moment=require(_0x5593('0x2'));var BPromise=require(_0x5593('0x3'));var rs=require(_0x5593('0x4'));var fs=require('fs');var Redis=require(_0x5593('0x5'));var db=require(_0x5593('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5593('0x7'));var config=require('../../config/environment');var jayson=require(_0x5593('0x8'));var client=jayson[_0x5593('0x9')][_0x5593('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22fa7c,_0x4799b2,_0x54079c){return new BPromise(function(_0x828309,_0x2da6ca){return client['request'](_0x22fa7c,_0x54079c)['then'](function(_0x9920a1){logger[_0x5593('0xb')](_0x5593('0xc'),_0x4799b2,_0x5593('0xd'));logger[_0x5593('0xe')](_0x5593('0xf'),_0x4799b2,_0x5593('0xd'),JSON[_0x5593('0x10')](_0x9920a1));if(_0x9920a1[_0x5593('0x11')]){if(_0x9920a1['error']['code']===0x1f4){logger[_0x5593('0x11')](_0x5593('0xc'),_0x4799b2,_0x9920a1[_0x5593('0x11')]['message']);return _0x2da6ca(_0x9920a1[_0x5593('0x11')][_0x5593('0x12')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x4799b2,_0x9920a1[_0x5593('0x11')][_0x5593('0x12')]);return _0x828309(_0x9920a1[_0x5593('0x11')]['message']);}else{logger[_0x5593('0xb')](_0x5593('0xc'),_0x4799b2,_0x5593('0xd'));_0x828309(_0x9920a1[_0x5593('0x13')]['message']);}})[_0x5593('0x14')](function(_0x8089fc){logger[_0x5593('0x11')](_0x5593('0xc'),_0x4799b2,_0x8089fc);_0x2da6ca(_0x8089fc);});});} \ No newline at end of file +var _0x957f=['client','http','then','request\x20sent','debug','stringify','error','CmCompany,\x20%s,\x20%s','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x957f,0x1c5));var _0xf957=function(_0x315b61,_0x4bb11e){_0x315b61=_0x315b61-0x0;var _0x3521e8=_0x957f[_0x315b61];return _0x3521e8;};'use strict';var _=require('lodash');var util=require(_0xf957('0x0'));var moment=require('moment');var BPromise=require(_0xf957('0x1'));var rs=require(_0xf957('0x2'));var fs=require('fs');var Redis=require(_0xf957('0x3'));var db=require(_0xf957('0x4'))['db'];var utils=require(_0xf957('0x5'));var logger=require('../../config/logger')(_0xf957('0x6'));var config=require(_0xf957('0x7'));var jayson=require(_0xf957('0x8'));var client=jayson[_0xf957('0x9')][_0xf957('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1496d5,_0xa83fce,_0x22ccf7){return new BPromise(function(_0x221a64,_0x7a5ed6){return client['request'](_0x1496d5,_0x22ccf7)[_0xf957('0xb')](function(_0x24103e){logger['info']('CmCompany,\x20%s,\x20%s',_0xa83fce,_0xf957('0xc'));logger[_0xf957('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0xa83fce,'request\x20sent',JSON[_0xf957('0xe')](_0x24103e));if(_0x24103e[_0xf957('0xf')]){if(_0x24103e[_0xf957('0xf')]['code']===0x1f4){logger[_0xf957('0xf')](_0xf957('0x10'),_0xa83fce,_0x24103e['error'][_0xf957('0x11')]);return _0x7a5ed6(_0x24103e['error']['message']);}logger[_0xf957('0xf')](_0xf957('0x10'),_0xa83fce,_0x24103e['error']['message']);return _0x221a64(_0x24103e[_0xf957('0xf')][_0xf957('0x11')]);}else{logger[_0xf957('0x12')](_0xf957('0x10'),_0xa83fce,_0xf957('0xc'));_0x221a64(_0x24103e[_0xf957('0x13')][_0xf957('0x11')]);}})[_0xf957('0x14')](function(_0xf7a819){logger[_0xf957('0xf')](_0xf957('0x10'),_0xa83fce,_0xf7a819);_0x7a5ed6(_0xf7a819);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index abd2e13..9dce25d 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 _0x8f6c=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/contacts','getContacts','post','addContacts','put','update','delete'];(function(_0x120f25,_0x139aaa){var _0x5f5b04=function(_0x2b4719){while(--_0x2b4719){_0x120f25['push'](_0x120f25['shift']());}};_0x5f5b04(++_0x139aaa);}(_0x8f6c,0xfe));var _0xc8f6=function(_0x50c72e,_0x236cfb){_0x50c72e=_0x50c72e-0x0;var _0x4f2cdd=_0x8f6c[_0x50c72e];return _0x4f2cdd;};'use strict';var multer=require(_0xc8f6('0x0'));var util=require(_0xc8f6('0x1'));var path=require('path');var timeout=require(_0xc8f6('0x2'));var express=require(_0xc8f6('0x3'));var router=express[_0xc8f6('0x4')]();var fs_extra=require(_0xc8f6('0x5'));var auth=require(_0xc8f6('0x6'));var interaction=require(_0xc8f6('0x7'));var config=require('../../config/environment');var controller=require(_0xc8f6('0x8'));router['get']('/',auth[_0xc8f6('0x9')](),controller[_0xc8f6('0xa')]);router[_0xc8f6('0xb')](_0xc8f6('0xc'),auth[_0xc8f6('0x9')](),controller[_0xc8f6('0xd')]);router['get'](_0xc8f6('0xe'),auth[_0xc8f6('0x9')](),controller['show']);router[_0xc8f6('0xb')](_0xc8f6('0xf'),auth[_0xc8f6('0x9')](),controller[_0xc8f6('0x10')]);router[_0xc8f6('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/contacts',auth[_0xc8f6('0x9')](),controller[_0xc8f6('0x12')]);router[_0xc8f6('0x13')](_0xc8f6('0xe'),auth['isAuthenticated'](),controller[_0xc8f6('0x14')]);router[_0xc8f6('0x15')](_0xc8f6('0xe'),auth[_0xc8f6('0x9')](),controller['destroy']);module[_0xc8f6('0x16')]=router; \ No newline at end of file +var _0xe11a=['express','Router','fs-extra','../../components/auth/service','./cmCompany.controller','get','/describe','isAuthenticated','show','/:id/contacts','post','create','/:id','delete','destroy','util','path','connect-timeout'];(function(_0x480224,_0x4a0331){var _0x3b83e2=function(_0x1b3101){while(--_0x1b3101){_0x480224['push'](_0x480224['shift']());}};_0x3b83e2(++_0x4a0331);}(_0xe11a,0x153));var _0xae11=function(_0x5ca716,_0x3ad8f0){_0x5ca716=_0x5ca716-0x0;var _0x2176ca=_0xe11a[_0x5ca716];return _0x2176ca;};'use strict';var multer=require('multer');var util=require(_0xae11('0x0'));var path=require(_0xae11('0x1'));var timeout=require(_0xae11('0x2'));var express=require(_0xae11('0x3'));var router=express[_0xae11('0x4')]();var fs_extra=require(_0xae11('0x5'));var auth=require(_0xae11('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xae11('0x7'));router[_0xae11('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xae11('0x8')](_0xae11('0x9'),auth[_0xae11('0xa')](),controller['describe']);router[_0xae11('0x8')]('/:id',auth[_0xae11('0xa')](),controller[_0xae11('0xb')]);router[_0xae11('0x8')](_0xae11('0xc'),auth[_0xae11('0xa')](),controller['getContacts']);router[_0xae11('0xd')]('/',auth[_0xae11('0xa')](),controller[_0xae11('0xe')]);router[_0xae11('0xd')]('/:id/contacts',auth[_0xae11('0xa')](),controller['addContacts']);router['put'](_0xae11('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xae11('0x10')](_0xae11('0xf'),auth[_0xae11('0xa')](),controller[_0xae11('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index d1c339e..2abbb9b 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 _0x1b43=['UNSIGNED','DATE','NOW','sequelize','STRING','TEXT','INTEGER'];(function(_0x466410,_0x4069d9){var _0x3d758e=function(_0x400fc0){while(--_0x400fc0){_0x466410['push'](_0x466410['shift']());}};_0x3d758e(++_0x4069d9);}(_0x1b43,0x168));var _0x31b4=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x1b43[_0x3826ad];return _0x17b900;};'use strict';var _=require('lodash');var Sequelize=require(_0x31b4('0x0'));module['exports']={'firstName':{'type':Sequelize[_0x31b4('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x31b4('0x1')]},'street':{'type':Sequelize[_0x31b4('0x1')]},'postalCode':{'type':Sequelize[_0x31b4('0x1')]},'city':{'type':Sequelize[_0x31b4('0x1')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x31b4('0x1')]},'description':{'type':Sequelize[_0x31b4('0x2')]},'phone':{'type':Sequelize[_0x31b4('0x1')]},'mobile':{'type':Sequelize[_0x31b4('0x1')]},'fax':{'type':Sequelize[_0x31b4('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x31b4('0x1')]},'facebook':{'type':Sequelize[_0x31b4('0x1')]},'fb_data':{'type':Sequelize[_0x31b4('0x1')]},'twitter':{'type':Sequelize[_0x31b4('0x1')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x31b4('0x1')]},'viber':{'type':Sequelize[_0x31b4('0x1')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x31b4('0x1')]},'telegram':{'type':Sequelize[_0x31b4('0x1')]},'UserId':{'type':Sequelize[_0x31b4('0x3')]},'priority':{'type':Sequelize[_0x31b4('0x3')](0x2)[_0x31b4('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x31b4('0x5')],'defaultValue':Sequelize[_0x31b4('0x6')]}}; \ No newline at end of file +var _0xd421=['TEXT','INTEGER','DATE','NOW','sequelize','STRING'];(function(_0x348ff3,_0x113767){var _0x20e02c=function(_0x5a8d06){while(--_0x5a8d06){_0x348ff3['push'](_0x348ff3['shift']());}};_0x20e02c(++_0x113767);}(_0xd421,0x9a));var _0x1d42=function(_0x2462f5,_0x57fed4){_0x2462f5=_0x2462f5-0x0;var _0x226292=_0xd421[_0x2462f5];return _0x226292;};'use strict';var _=require('lodash');var Sequelize=require(_0x1d42('0x0'));module['exports']={'firstName':{'type':Sequelize[_0x1d42('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1d42('0x1')]},'street':{'type':Sequelize[_0x1d42('0x1')]},'postalCode':{'type':Sequelize[_0x1d42('0x1')]},'city':{'type':Sequelize[_0x1d42('0x1')]},'country':{'type':Sequelize[_0x1d42('0x1')]},'dateOfBirth':{'type':Sequelize[_0x1d42('0x1')]},'description':{'type':Sequelize[_0x1d42('0x2')]},'phone':{'type':Sequelize[_0x1d42('0x1')]},'mobile':{'type':Sequelize[_0x1d42('0x1')]},'fax':{'type':Sequelize[_0x1d42('0x1')]},'email':{'type':Sequelize[_0x1d42('0x1')]},'url':{'type':Sequelize[_0x1d42('0x1')]},'facebook':{'type':Sequelize[_0x1d42('0x1')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x1d42('0x1')]},'skype':{'type':Sequelize[_0x1d42('0x1')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x1d42('0x1')]},'wechat':{'type':Sequelize[_0x1d42('0x1')]},'telegram':{'type':Sequelize[_0x1d42('0x1')]},'UserId':{'type':Sequelize[_0x1d42('0x3')]},'priority':{'type':Sequelize[_0x1d42('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1d42('0x4')],'defaultValue':Sequelize[_0x1d42('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 1e90c96..258d04a 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 _0x3a0f=['createdAt','findAndCountAll','fullname','startCase','Account','closed','closedAt','disposition','thirdDisposition','Owner','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','flatten','sortBy','reverse','slice','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','merge','body','contact','message','agent','interaction','index','CmContact','keys','length','startsWith','push','CmCustomField','findOne','cf_','all','fieldType','type','query','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','select','field','color','from','tools_tags','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','cm_contact_has_tags','where','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','Tag','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','datetime','castTo','DATE','buildExpression','hasOwnProperty','filter','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','isArray','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','c.id','having','t.id\x20IN\x20?','resolve','user','role','some','getLists','sequelize','keyBy','c.firstName','c.lastName','c.phone','c.fax','c.ListId','c.createdAt','c.CompanyId','TagIds','toString','Tags','rows','find','catch','describe','tags','columnName','findAll','alias','custom','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','bulkCreate','duplicates','$or','findOrCreate','spread','show','params','$and','omit','format','table','id\x20=\x20?','values','phone','getTags','options','setTags','ids','getHoppers','rawAttributes','includeAll','include','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getJscriptySessions','ContactId','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','chmodSync','0777','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','parse','meta','binding','child_process','stringify','start\x20child\x20process\x20correctly!','exit','getJourney','mail','chat','openchannel','whatsapp','voice','-createdAt','channel','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','callerid','starttime','endtime','duration','note','userDisposition','userSecondDisposition','userThirdDisposition','UserId'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3a0f,0x145));var _0xf3a0=function(_0x122ee8,_0x3134d4){_0x122ee8=_0x122ee8-0x0;var _0x5b6118=_0x3a0f[_0x122ee8];return _0x5b6118;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf3a0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf3a0('0x1'));var BPromise=require(_0xf3a0('0x2'));var Mustache=require(_0xf3a0('0x3'));var util=require(_0xf3a0('0x4'));var path=require(_0xf3a0('0x5'));var sox=require(_0xf3a0('0x6'));var csv=require(_0xf3a0('0x7'));var ejs=require(_0xf3a0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf3a0('0x9'));var squel=require(_0xf3a0('0xa'));var crypto=require(_0xf3a0('0xb'));var jsforce=require(_0xf3a0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf3a0('0x7'));var querystring=require(_0xf3a0('0xd'));var Papa=require(_0xf3a0('0xe'));var Redis=require(_0xf3a0('0xf'));var authService=require(_0xf3a0('0x10'));var qs=require(_0xf3a0('0x11'));var as=require(_0xf3a0('0x12'));var hardwareService=require(_0xf3a0('0x13'));var logger=require('../../config/logger')(_0xf3a0('0x14'));var utils=require(_0xf3a0('0x15'));var config=require(_0xf3a0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf3a0('0x17'))['db'];config[_0xf3a0('0x18')]=_[_0xf3a0('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf3a0('0x1a'))(new Redis(config[_0xf3a0('0x18')]));require(_0xf3a0('0x1b'))[_0xf3a0('0x1c')](socket);function respondWithStatusCode(_0x49b5ff,_0x287e7e){_0x287e7e=_0x287e7e||0xcc;return function(_0x204cf9){if(_0x204cf9){return _0x49b5ff[_0xf3a0('0x1d')](_0x287e7e);}return _0x49b5ff[_0xf3a0('0x1e')](_0x287e7e)[_0xf3a0('0x1f')]();};}function respondWithResult(_0x239a70,_0x39f039){_0x39f039=_0x39f039||0xc8;return function(_0x3e4926){if(_0x3e4926){return _0x239a70['status'](_0x39f039)['json'](_0x3e4926);}};}function respondWithFilteredResult(_0x1be8b9,_0x358916){return function(_0x2c3eba){if(_0x2c3eba){var _0x2c721c=typeof _0x358916[_0xf3a0('0x20')]===_0xf3a0('0x21')&&typeof _0x358916['limit']==='undefined';var _0x29d478=_0x2c3eba[_0xf3a0('0x22')];var _0x66660c=_0x2c721c?0x0:_0x358916[_0xf3a0('0x20')];var _0x25c2f4=_0x2c721c?_0x2c3eba['count']:_0x358916['offset']+_0x358916[_0xf3a0('0x23')];var _0x4bc714;if(_0x25c2f4>=_0x29d478){_0x25c2f4=_0x29d478;_0x4bc714=0xc8;}else{_0x4bc714=0xce;}_0x1be8b9[_0xf3a0('0x1e')](_0x4bc714);return _0x1be8b9[_0xf3a0('0x24')](_0xf3a0('0x25'),_0x66660c+'-'+_0x25c2f4+'/'+_0x29d478)[_0xf3a0('0x26')](_0x2c3eba);}return null;};}function patchUpdates(_0x2de459){return function(_0x1659eb){try{jsonpatch[_0xf3a0('0x27')](_0x1659eb,_0x2de459,!![]);}catch(_0xe7926){return BPromise[_0xf3a0('0x28')](_0xe7926);}return _0x1659eb[_0xf3a0('0x29')]();};}function saveUpdates(_0x422601,_0x21ca14){return function(_0x1804ad){if(_0x1804ad){return _0x1804ad[_0xf3a0('0x2a')](_0x422601)[_0xf3a0('0x2b')](function(_0x5569a9){return _0x5569a9;});}return null;};}function removeEntity(_0x2c4f45,_0x182ce6){return function(_0x36c24e){if(_0x36c24e){return _0x36c24e[_0xf3a0('0x2c')]()[_0xf3a0('0x2b')](function(){_0x2c4f45[_0xf3a0('0x1e')](0xcc)[_0xf3a0('0x1f')]();});}};}function handleEntityNotFound(_0x7f90dd,_0x48953e){return function(_0x5270da){if(!_0x5270da){_0x7f90dd['sendStatus'](0x194);}return _0x5270da;};}function handleError(_0x2a720a,_0x26efe7){_0x26efe7=_0x26efe7||0x1f4;return function(_0x252f89){logger[_0xf3a0('0x2d')](_0x252f89['stack']);if(_0x252f89[_0xf3a0('0x2e')]){delete _0x252f89[_0xf3a0('0x2e')];}_0x2a720a[_0xf3a0('0x1e')](_0x26efe7)[_0xf3a0('0x2f')](_0x252f89);};}function getMustacheRender(_0x268242,_0x13eddf){return Mustache['render'](_0x268242,_[_0xf3a0('0x30')](_0x13eddf[_0xf3a0('0x31')],{'contact':_0x13eddf[_0xf3a0('0x32')],'message':_0x13eddf[_0xf3a0('0x33')],'agent':_0x13eddf[_0xf3a0('0x34')],'interaction':_0x13eddf[_0xf3a0('0x35')],'account':_0x13eddf['account']}))||'';}exports[_0xf3a0('0x36')]=function(_0x3d8325,_0x183bb6){var _0x309d3a={},_0x364177={},_0x40b58f={'count':0x0,'rows':[]};return db[_0xf3a0('0x37')]['describe']()['then'](function(_0x289ecf){var _0x31542e=[];for(var _0x426d85=0x0;_0x426d850x1){_0x4cd775['or'](_0xf3a0('0x78'),qs['getFullTextValue'](_0x24725b),null);}else{if(qs[_0xf3a0('0x79')](_0x24725b)){_0x4cd775['or']('c.id\x20LIKE\x20?',_0x24725b+'%');_0x4cd775['or'](_0xf3a0('0x7a'),_0x24725b+'%');_0x4cd775['or'](_0xf3a0('0x7b'),_0x24725b+'%');_0x4cd775['or']('c.fax\x20LIKE\x20?',_0x24725b+'%');}else if(qs[_0xf3a0('0x7c')](_0x24725b)){_0x4cd775['or'](_0xf3a0('0x7d'),_0x24725b+'%');}else{_0x4cd775['or'](_0xf3a0('0x7e'),'%'+_0x24725b+'%');_0x4cd775['or'](_0xf3a0('0x7f'),'%'+_0x24725b+'%');_0x4cd775['or'](_0xf3a0('0x7d'),'%'+_0x24725b+'%');}}}}_0x2c164c[_0xf3a0('0x56')](_0x4cd775);_0x2c164c[_0xf3a0('0x80')]('c.id');var _0x32ccfa={'type':db[_0xf3a0('0x81')][_0xf3a0('0x82')][_0xf3a0('0x83')],'raw':!![]};var _0x50d5f2=_0x2c164c['clone']()[_0xf3a0('0x4d')](_0xf3a0('0x84'));if(_0x309d3a[_0xf3a0('0x49')]){_0x309d3a['order'][_0xf3a0('0x5f')](function(_0xfeff43){_0x2c164c[_0xf3a0('0x49')]('c.'+_0xfeff43[0x0],_0xfeff43[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x5568a2)){_0x2c164c[_0xf3a0('0x85')](_0x927cb7);_0x50d5f2[_0xf3a0('0x56')](_0xf3a0('0x86'),_0x5568a2);}BPromise[_0xf3a0('0x87')]()[_0xf3a0('0x2b')](function(){if(!_0x29da13)return;if(_0x3d8325[_0xf3a0('0x88')][_0xf3a0('0x89')]!==_0xf3a0('0x34'))return;if(!_[_0xf3a0('0x8a')](_0x29da13[_0xf3a0('0x5c')],[_0xf3a0('0x4d'),_0xf3a0('0x62')])){return _0x3d8325[_0xf3a0('0x88')][_0xf3a0('0x8b')]({'attributes':['id'],'raw':!![]})[_0xf3a0('0x2b')](function(_0x2bdd49){if(_['isEmpty'](_0x2bdd49)){_0x50d5f2[_0xf3a0('0x56')]('c.ListId\x20IS\x20NULL');_0x2c164c[_0xf3a0('0x56')]('c.ListId\x20IS\x20NULL');}else{_0x50d5f2['where']('c.ListId\x20IN\x20?',_[_0xf3a0('0x5e')](_0x2bdd49,'id'));_0x2c164c[_0xf3a0('0x56')](_0xf3a0('0x71'),_[_0xf3a0('0x5e')](_0x2bdd49,'id'));}});}})[_0xf3a0('0x2b')](function(){if(_0x3d8325['user']['role']===_0xf3a0('0x34')&&!_0x29da13&&!_0x3d8325[_0xf3a0('0x42')]['ListId'])return[];return db[_0xf3a0('0x8c')][_0xf3a0('0x42')](_0x50d5f2['toString'](),_0x32ccfa);})[_0xf3a0('0x2b')](function(_0xd4837a){_0x40b58f[_0xf3a0('0x22')]=_0xd4837a[_0xf3a0('0x39')];if(_0x40b58f['count']===0x0)return[];return db[_0xf3a0('0x8c')][_0xf3a0('0x42')](_0xb92bad['toString'](),_0x32ccfa)[_0xf3a0('0x2b')](function(_0x2d53fa){_0xe1b3aa=_[_0xf3a0('0x8d')](_0x2d53fa,'id');_0x32ccfa=_[_0xf3a0('0x30')](_0x32ccfa,{'model':db[_0xf3a0('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d8325[_0xf3a0('0x42')][_0xf3a0('0x47')]){_0x309d3a[_0xf3a0('0x46')][_0xf3a0('0x5f')](function(_0x141627){_0x2c164c[_0xf3a0('0x4d')]('c.'+_0x141627);});}else{_0x2c164c[_0xf3a0('0x4d')](_0xf3a0('0x84'));_0x2c164c[_0xf3a0('0x4d')](_0xf3a0('0x8e'));_0x2c164c[_0xf3a0('0x4d')](_0xf3a0('0x8f'));_0x2c164c[_0xf3a0('0x4d')](_0xf3a0('0x90'));_0x2c164c[_0xf3a0('0x4d')]('c.mobile');_0x2c164c['field'](_0xf3a0('0x91'));_0x2c164c[_0xf3a0('0x4d')]('c.email');_0x2c164c[_0xf3a0('0x4d')](_0xf3a0('0x92'));_0x2c164c[_0xf3a0('0x4d')](_0xf3a0('0x93'));_0x2c164c[_0xf3a0('0x4d')]('c.deletedAt');_0x2c164c['field'](_0xf3a0('0x94'));_0x2c164c['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xf3a0('0x95'));}if(_0x309d3a['limit'])_0x2c164c[_0xf3a0('0x23')](_0x309d3a['limit']);if(_0x309d3a[_0xf3a0('0x20')])_0x2c164c[_0xf3a0('0x20')](_0x309d3a[_0xf3a0('0x20')]);return db[_0xf3a0('0x8c')]['query'](_0x2c164c[_0xf3a0('0x96')](),_0x32ccfa);});})[_0xf3a0('0x2b')](function(_0x4632b1){_0x4632b1[_0xf3a0('0x5f')](function(_0x575031){if(_0x575031[_0xf3a0('0x95')]){_0x575031[_0xf3a0('0x97')]=[];_0x575031[_0xf3a0('0x95')][_0xf3a0('0x77')](',')['forEach'](function(_0x1294aa){_0x575031[_0xf3a0('0x97')][_0xf3a0('0x3b')](_0xe1b3aa[_0x1294aa]);});}delete _0x575031['TagIds'];});_0x40b58f[_0xf3a0('0x98')]=_0x4632b1;return _0x40b58f;})[_0xf3a0('0x2b')](respondWithFilteredResult(_0x183bb6,_0x309d3a));})['catch'](handleError(_0x183bb6,null));};exports['destroy']=function(_0xbe9100,_0x38965a){return db[_0xf3a0('0x37')][_0xf3a0('0x99')]({'where':{'id':_0xbe9100['params']['id']}})[_0xf3a0('0x2b')](handleEntityNotFound(_0x38965a,null))['then'](removeEntity(_0x38965a,null))[_0xf3a0('0x9a')](handleError(_0x38965a,null));};exports[_0xf3a0('0x9b')]=function(_0x28621c,_0x4855e1){return db[_0xf3a0('0x37')][_0xf3a0('0x9b')]()[_0xf3a0('0x2b')](function(_0x3d43b0){delete _0x3d43b0[_0xf3a0('0x9c')];for(var _0x1e03d8=0x0;_0x1e03d8=_0x18c860){_0x354de9=_0x18c860;_0x227e6c=0xc8;}else{_0x227e6c=0xce;}_0x809f7b[_0xf5f1('0x1e')](_0x227e6c);return _0x809f7b[_0xf5f1('0x23')]('Content-Range',_0x5cd7f6+'-'+_0x354de9+'/'+_0x18c860)[_0xf5f1('0x1f')](_0x5d1442);}return null;};}function patchUpdates(_0x17d7bf){return function(_0x2fd45b){try{jsonpatch[_0xf5f1('0x24')](_0x2fd45b,_0x17d7bf,!![]);}catch(_0x43f5c5){return BPromise['reject'](_0x43f5c5);}return _0x2fd45b['save']();};}function saveUpdates(_0x4e283b,_0x3830cd){return function(_0x399480){if(_0x399480){return _0x399480[_0xf5f1('0x25')](_0x4e283b)['then'](function(_0x10e0a1){return _0x10e0a1;});}return null;};}function removeEntity(_0x1ef1ae,_0x4bd768){return function(_0x464f34){if(_0x464f34){return _0x464f34['destroy']()[_0xf5f1('0x26')](function(){_0x1ef1ae[_0xf5f1('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e8e28,_0x2f68b0){return function(_0x23f03e){if(!_0x23f03e){_0x4e8e28[_0xf5f1('0x1c')](0x194);}return _0x23f03e;};}function handleError(_0x44810d,_0x19c2b3){_0x19c2b3=_0x19c2b3||0x1f4;return function(_0x4de9e7){logger['error'](_0x4de9e7[_0xf5f1('0x27')]);if(_0x4de9e7[_0xf5f1('0x28')]){delete _0x4de9e7[_0xf5f1('0x28')];}_0x44810d[_0xf5f1('0x1e')](_0x19c2b3)[_0xf5f1('0x29')](_0x4de9e7);};}function getMustacheRender(_0x486006,_0x894d5e){return Mustache[_0xf5f1('0x2a')](_0x486006,_[_0xf5f1('0x2b')](_0x894d5e[_0xf5f1('0x2c')],{'contact':_0x894d5e[_0xf5f1('0x2d')],'message':_0x894d5e[_0xf5f1('0x2e')],'agent':_0x894d5e[_0xf5f1('0x2f')],'interaction':_0x894d5e[_0xf5f1('0x30')],'account':_0x894d5e[_0xf5f1('0x31')]}))||'';}exports[_0xf5f1('0x32')]=function(_0x427a2b,_0x1313a1){var _0x35396e={},_0x22518b={},_0x478493={'count':0x0,'rows':[]};return db[_0xf5f1('0x33')][_0xf5f1('0x34')]()[_0xf5f1('0x26')](function(_0x5e1b76){var _0x32ffbd=[];for(var _0x384c4e=0x0;_0x384c4e0x1){_0x49a513['or'](_0xf5f1('0x70'),qs[_0xf5f1('0x71')](_0x929c18),null);}else{if(qs['isNumeric'](_0x929c18)){_0x49a513['or'](_0xf5f1('0x72'),_0x929c18+'%');_0x49a513['or'](_0xf5f1('0x73'),_0x929c18+'%');_0x49a513['or'](_0xf5f1('0x74'),_0x929c18+'%');_0x49a513['or'](_0xf5f1('0x75'),_0x929c18+'%');}else if(qs['isEmail'](_0x929c18)){_0x49a513['or']('c.email\x20LIKE\x20?',_0x929c18+'%');}else{_0x49a513['or'](_0xf5f1('0x76'),'%'+_0x929c18+'%');_0x49a513['or'](_0xf5f1('0x77'),'%'+_0x929c18+'%');_0x49a513['or']('c.email\x20LIKE\x20?','%'+_0x929c18+'%');}}}}_0x52a90e[_0xf5f1('0x48')](_0x49a513);_0x52a90e[_0xf5f1('0x78')](_0xf5f1('0x79'));var _0x373be9={'type':db[_0xf5f1('0x7a')]['QueryTypes']['SELECT'],'raw':!![]};var _0x4d82b1=_0x52a90e[_0xf5f1('0x7b')]()['field'](_0xf5f1('0x79'));if(_0x35396e[_0xf5f1('0x46')]){_0x35396e[_0xf5f1('0x46')][_0xf5f1('0x59')](function(_0x394ebc){_0x52a90e[_0xf5f1('0x46')]('c.'+_0x394ebc[0x0],_0x394ebc[0x1]===_0xf5f1('0x7c')?![]:!![]);});}if(!_[_0xf5f1('0x67')](_0xff687c)){_0x52a90e[_0xf5f1('0x7d')](_0x56986d);_0x4d82b1[_0xf5f1('0x48')](_0xf5f1('0x7e'),_0xff687c);}BPromise[_0xf5f1('0x7f')]()[_0xf5f1('0x26')](function(){if(!_0x16e470)return;if(_0x427a2b['user']['role']!==_0xf5f1('0x2f'))return;if(!_[_0xf5f1('0x80')](_0x16e470['conditions'],[_0xf5f1('0x4a'),_0xf5f1('0x81')])){return _0x427a2b['user']['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x176966){if(_[_0xf5f1('0x67')](_0x176966)){_0x4d82b1[_0xf5f1('0x48')](_0xf5f1('0x82'));_0x52a90e[_0xf5f1('0x48')](_0xf5f1('0x82'));}else{_0x4d82b1[_0xf5f1('0x48')]('c.ListId\x20IN\x20?',_[_0xf5f1('0x58')](_0x176966,'id'));_0x52a90e[_0xf5f1('0x48')](_0xf5f1('0x69'),_['map'](_0x176966,'id'));}});}})[_0xf5f1('0x26')](function(){if(_0x427a2b[_0xf5f1('0x83')][_0xf5f1('0x84')]==='agent'&&!_0x16e470&&!_0x427a2b[_0xf5f1('0x3e')][_0xf5f1('0x68')])return[];return db[_0xf5f1('0x85')][_0xf5f1('0x3e')](_0x4d82b1[_0xf5f1('0x86')](),_0x373be9);})[_0xf5f1('0x26')](function(_0x45116c){_0x478493[_0xf5f1('0x22')]=_0x45116c[_0xf5f1('0x43')];if(_0x478493[_0xf5f1('0x22')]===0x0)return[];return db['sequelize']['query'](_0x5ec80e[_0xf5f1('0x86')](),_0x373be9)[_0xf5f1('0x26')](function(_0x4c9ca5){_0x271e20=_[_0xf5f1('0x87')](_0x4c9ca5,'id');_0x373be9=_[_0xf5f1('0x2b')](_0x373be9,{'model':db[_0xf5f1('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x427a2b[_0xf5f1('0x3e')][_0xf5f1('0x42')]){_0x35396e[_0xf5f1('0x41')][_0xf5f1('0x59')](function(_0x584b9b){_0x52a90e['field']('c.'+_0x584b9b);});}else{_0x52a90e[_0xf5f1('0x4a')](_0xf5f1('0x79'));_0x52a90e['field']('c.firstName');_0x52a90e['field']('c.lastName');_0x52a90e[_0xf5f1('0x4a')](_0xf5f1('0x88'));_0x52a90e[_0xf5f1('0x4a')](_0xf5f1('0x89'));_0x52a90e[_0xf5f1('0x4a')](_0xf5f1('0x8a'));_0x52a90e[_0xf5f1('0x4a')]('c.email');_0x52a90e['field'](_0xf5f1('0x8b'));_0x52a90e[_0xf5f1('0x4a')](_0xf5f1('0x8c'));_0x52a90e['field']('c.deletedAt');_0x52a90e[_0xf5f1('0x4a')]('c.CompanyId');_0x52a90e['field'](_0xf5f1('0x8d'),'TagIds');}if(_0x35396e[_0xf5f1('0x21')])_0x52a90e[_0xf5f1('0x21')](_0x35396e[_0xf5f1('0x21')]);if(_0x35396e['offset'])_0x52a90e[_0xf5f1('0x20')](_0x35396e[_0xf5f1('0x20')]);return db[_0xf5f1('0x85')][_0xf5f1('0x3e')](_0x52a90e[_0xf5f1('0x86')](),_0x373be9);});})['then'](function(_0x101c06){_0x101c06[_0xf5f1('0x59')](function(_0x5ca476){if(_0x5ca476[_0xf5f1('0x8e')]){_0x5ca476[_0xf5f1('0x8f')]=[];_0x5ca476[_0xf5f1('0x8e')]['split'](',')['forEach'](function(_0xd5d21d){_0x5ca476[_0xf5f1('0x8f')][_0xf5f1('0x90')](_0x271e20[_0xd5d21d]);});}delete _0x5ca476[_0xf5f1('0x8e')];});_0x478493[_0xf5f1('0x91')]=_0x101c06;return _0x478493;})[_0xf5f1('0x26')](respondWithFilteredResult(_0x1313a1,_0x35396e));})[_0xf5f1('0x92')](handleError(_0x1313a1,null));};exports['destroy']=function(_0x2d427b,_0x2712cd){return db['CmContact']['find']({'where':{'id':_0x2d427b[_0xf5f1('0x93')]['id']}})[_0xf5f1('0x26')](handleEntityNotFound(_0x2712cd,null))[_0xf5f1('0x26')](removeEntity(_0x2712cd,null))[_0xf5f1('0x92')](handleError(_0x2712cd,null));};exports[_0xf5f1('0x34')]=function(_0x389f45,_0x65df33){return db[_0xf5f1('0x33')][_0xf5f1('0x34')]()[_0xf5f1('0x26')](function(_0x17eda1){delete _0x17eda1['tags'];for(var _0x3eb57b=0x0;_0x3eb57b{}\s\\|]/g,'-');_0x19f206(null,util[_0x2b9e('0x22')](_0x2b9e('0x23'),path[_0x2b9e('0x24')](_0x317447['originalname'],path[_0x2b9e('0x25')](_0x317447[_0x2b9e('0x21')])),Date[_0x2b9e('0x26')](),path['extname'](_0x317447[_0x2b9e('0x21')])));}})});router[_0x2b9e('0x19')](_0x2b9e('0x27'),upload[_0x2b9e('0x28')](_0x2b9e('0x29')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x2b9e('0x1d')]({'destination':function(_0x158183,_0x302dc9,_0x56041f){_0x56041f(null,path[_0x2b9e('0x1e')](config['root'],'server/files/tmp'));},'filename':function(_0x3767ad,_0x307383,_0xcf95cb){_0x307383['originalname']=_0x307383[_0x2b9e('0x21')][_0x2b9e('0x2a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xcf95cb(null,util[_0x2b9e('0x22')](_0x2b9e('0x23'),path[_0x2b9e('0x24')](_0x307383[_0x2b9e('0x21')],path[_0x2b9e('0x25')](_0x307383[_0x2b9e('0x21')])),Date[_0x2b9e('0x26')](),path[_0x2b9e('0x25')](_0x307383[_0x2b9e('0x21')])));}})});router[_0x2b9e('0x19')](_0x2b9e('0x2b'),upload['single'](_0x2b9e('0x29')),controller[_0x2b9e('0x2c')]);router[_0x2b9e('0x19')](_0x2b9e('0x2d'),auth[_0x2b9e('0xa')](),controller['import']);router[_0x2b9e('0x2e')](_0x2b9e('0xe'),auth[_0x2b9e('0xa')](),controller[_0x2b9e('0x2f')]);router[_0x2b9e('0x30')](_0x2b9e('0xe'),auth[_0x2b9e('0xa')](),controller['destroy']);module[_0x2b9e('0x31')]=router; \ No newline at end of file +var _0xa041=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmContact.controller','get','isAuthenticated','index','/describe','/:id','show','getTags','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge','create','/create_many','/:id/tags','diskStorage','join','root','server/files/tmp','originalname','replace','format','%s-%s%s','basename','/csv','single','uploadCsv','extname','now','/upload','file','upload','/upload/:id','import','put','update','delete','destroy','exports','multer','util','path'];(function(_0x29339d,_0xc92fda){var _0x34fc6f=function(_0x505561){while(--_0x505561){_0x29339d['push'](_0x29339d['shift']());}};_0x34fc6f(++_0xc92fda);}(_0xa041,0xd5));var _0x1a04=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa041[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x1a04('0x0'));var util=require(_0x1a04('0x1'));var path=require(_0x1a04('0x2'));var timeout=require(_0x1a04('0x3'));var express=require(_0x1a04('0x4'));var router=express[_0x1a04('0x5')]();var fs_extra=require(_0x1a04('0x6'));var auth=require(_0x1a04('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a04('0x8'));router[_0x1a04('0x9')]('/',auth[_0x1a04('0xa')](),controller[_0x1a04('0xb')]);router[_0x1a04('0x9')](_0x1a04('0xc'),auth[_0x1a04('0xa')](),controller['describe']);router['get'](_0x1a04('0xd'),auth[_0x1a04('0xa')](),controller[_0x1a04('0xe')]);router[_0x1a04('0x9')]('/:id/tags',auth[_0x1a04('0xa')](),controller[_0x1a04('0xf')]);router[_0x1a04('0x9')](_0x1a04('0x10'),auth[_0x1a04('0xa')](),controller[_0x1a04('0x11')]);router[_0x1a04('0x9')]('/:id/hopper_histories',auth[_0x1a04('0xa')](),controller[_0x1a04('0x12')]);router[_0x1a04('0x9')](_0x1a04('0x13'),auth[_0x1a04('0xa')](),controller['getHopperFinals']);router[_0x1a04('0x9')](_0x1a04('0x14'),auth['isAuthenticated'](),controller[_0x1a04('0x15')]);router['get'](_0x1a04('0x16'),auth[_0x1a04('0xa')](),controller[_0x1a04('0x17')]);router[_0x1a04('0x18')](_0x1a04('0x19'),auth[_0x1a04('0xa')](),controller[_0x1a04('0x1a')]);router[_0x1a04('0x18')]('/',auth[_0x1a04('0xa')](),controller[_0x1a04('0x1b')]);router['post'](_0x1a04('0x1c'),auth[_0x1a04('0xa')](),controller['bulkCreate']);router[_0x1a04('0x18')](_0x1a04('0x1d'),auth[_0x1a04('0xa')](),controller['setTags']);var upload=multer({'storage':multer[_0x1a04('0x1e')]({'destination':function(_0x4e9571,_0x5d9746,_0x498fb3){_0x498fb3(null,path[_0x1a04('0x1f')](config[_0x1a04('0x20')],_0x1a04('0x21')));},'filename':function(_0x2c2691,_0x5d147a,_0x7b2015){_0x5d147a[_0x1a04('0x22')]=_0x5d147a['originalname'][_0x1a04('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x7b2015(null,util[_0x1a04('0x24')](_0x1a04('0x25'),path[_0x1a04('0x26')](_0x5d147a[_0x1a04('0x22')],path['extname'](_0x5d147a[_0x1a04('0x22')])),Date['now'](),path['extname'](_0x5d147a[_0x1a04('0x22')])));}})});router[_0x1a04('0x18')](_0x1a04('0x27'),upload[_0x1a04('0x28')]('file'),controller[_0x1a04('0x29')]);var upload=multer({'storage':multer[_0x1a04('0x1e')]({'destination':function(_0x3688dc,_0x3e1a6a,_0x1bb6db){_0x1bb6db(null,path[_0x1a04('0x1f')](config['root'],_0x1a04('0x21')));},'filename':function(_0x3b2bf8,_0x2762e9,_0x4c3af1){_0x2762e9['originalname']=_0x2762e9[_0x1a04('0x22')][_0x1a04('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4c3af1(null,util[_0x1a04('0x24')](_0x1a04('0x25'),path[_0x1a04('0x26')](_0x2762e9[_0x1a04('0x22')],path[_0x1a04('0x2a')](_0x2762e9[_0x1a04('0x22')])),Date[_0x1a04('0x2b')](),path[_0x1a04('0x2a')](_0x2762e9[_0x1a04('0x22')])));}})});router['post'](_0x1a04('0x2c'),upload['single'](_0x1a04('0x2d')),controller[_0x1a04('0x2e')]);router[_0x1a04('0x18')](_0x1a04('0x2f'),auth[_0x1a04('0xa')](),controller[_0x1a04('0x30')]);router[_0x1a04('0x31')](_0x1a04('0xd'),auth[_0x1a04('0xa')](),controller[_0x1a04('0x32')]);router[_0x1a04('0x33')](_0x1a04('0xd'),auth[_0x1a04('0xa')](),controller[_0x1a04('0x34')]);module[_0x1a04('0x35')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 26848f6..97ffe82 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd17=['sequelize','exports','STRING','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd17,0x88));var _0x7dd1=function(_0x4f50d6,_0x100adc){_0x4f50d6=_0x4f50d6-0x0;var _0x412340=_0xdd17[_0x4f50d6];return _0x412340;};'use strict';var Sequelize=require(_0x7dd1('0x0'));module[_0x7dd1('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x7dd1('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x7dd1('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x7dd1('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x7dd1('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x8aa5=['INTEGER','PHONE','sequelize','exports'];(function(_0x5608c8,_0x5cd32a){var _0x34572d=function(_0x52483d){while(--_0x52483d){_0x5608c8['push'](_0x5608c8['shift']());}};_0x34572d(++_0x5cd32a);}(_0x8aa5,0x13e));var _0x58aa=function(_0x1dca7f,_0x2e101a){_0x1dca7f=_0x1dca7f-0x0;var _0x4abf6a=_0x8aa5[_0x1dca7f];return _0x4abf6a;};'use strict';var Sequelize=require(_0x58aa('0x0'));module[_0x58aa('0x1')]={'CmContactId':{'type':Sequelize[_0x58aa('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x58aa('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x58aa('0x3')},'OrderBy':{'type':Sequelize[_0x58aa('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index df7ce15..e5a0b83 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2075=['UserProfileResource','error','name','merge','body','contact','message','interaction','account','index','map','CmContactHasItem','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','then','destroy','get','CmContactHasItems'];(function(_0x3cd283,_0x2b8542){var _0x5ea1f0=function(_0x5d7e1c){while(--_0x5d7e1c){_0x3cd283['push'](_0x3cd283['shift']());}};_0x5ea1f0(++_0x2b8542);}(_0x2075,0x16e));var _0x5207=function(_0x42c282,_0x2c14c7){_0x42c282=_0x42c282-0x0;var _0x537c85=_0x2075[_0x42c282];return _0x537c85;};'use strict';var emlformat=require(_0x5207('0x0'));var rimraf=require(_0x5207('0x1'));var zipdir=require(_0x5207('0x2'));var jsonpatch=require(_0x5207('0x3'));var rp=require(_0x5207('0x4'));var moment=require('moment');var BPromise=require(_0x5207('0x5'));var Mustache=require(_0x5207('0x6'));var util=require(_0x5207('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5207('0x8'));var fs=require('fs');var fs_extra=require(_0x5207('0x9'));var _=require(_0x5207('0xa'));var squel=require(_0x5207('0xb'));var crypto=require(_0x5207('0xc'));var jsforce=require(_0x5207('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5207('0xe'));var querystring=require(_0x5207('0xf'));var Papa=require('papaparse');var Redis=require(_0x5207('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5207('0x11'));var as=require(_0x5207('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5207('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5207('0x14'));var licenseUtil=require(_0x5207('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe02089,_0x3f8aaa){_0x3f8aaa=_0x3f8aaa||0xcc;return function(_0x3d11fe){if(_0x3d11fe){return _0xe02089[_0x5207('0x16')](_0x3f8aaa);}return _0xe02089['status'](_0x3f8aaa)[_0x5207('0x17')]();};}function respondWithResult(_0x2fce11,_0x3acaf6){_0x3acaf6=_0x3acaf6||0xc8;return function(_0x5bd822){if(_0x5bd822){return _0x2fce11['status'](_0x3acaf6)[_0x5207('0x18')](_0x5bd822);}};}function respondWithFilteredResult(_0x220d48,_0x267624){return function(_0x31f9c9){if(_0x31f9c9){var _0x12f6f2=typeof _0x267624['offset']===_0x5207('0x19')&&typeof _0x267624[_0x5207('0x1a')]===_0x5207('0x19');var _0x2b086a=_0x31f9c9[_0x5207('0x1b')];var _0x13eb9e=_0x12f6f2?0x0:_0x267624[_0x5207('0x1c')];var _0x29cbb4=_0x12f6f2?_0x31f9c9[_0x5207('0x1b')]:_0x267624['offset']+_0x267624[_0x5207('0x1a')];var _0x189947;if(_0x29cbb4>=_0x2b086a){_0x29cbb4=_0x2b086a;_0x189947=0xc8;}else{_0x189947=0xce;}_0x220d48[_0x5207('0x1d')](_0x189947);return _0x220d48[_0x5207('0x1e')](_0x5207('0x1f'),_0x13eb9e+'-'+_0x29cbb4+'/'+_0x2b086a)[_0x5207('0x18')](_0x31f9c9);}return null;};}function patchUpdates(_0x45a3d3){return function(_0x5cfae9){try{jsonpatch[_0x5207('0x20')](_0x5cfae9,_0x45a3d3,!![]);}catch(_0x53e072){return BPromise[_0x5207('0x21')](_0x53e072);}return _0x5cfae9[_0x5207('0x22')]();};}function saveUpdates(_0x1764bb,_0x19b7d2){return function(_0x380a74){if(_0x380a74){return _0x380a74['update'](_0x1764bb)[_0x5207('0x23')](function(_0x3793b4){return _0x3793b4;});}return null;};}function removeEntity(_0x243352,_0x554833){return function(_0x17250b){if(_0x17250b){return _0x17250b[_0x5207('0x24')]()['then'](function(){var _0x2cb480=_0x17250b[_0x5207('0x25')]({'plain':!![]});var _0x1f798f=_0x5207('0x26');return db[_0x5207('0x27')]['destroy']({'where':{'type':_0x1f798f,'resourceId':_0x2cb480['id']}})[_0x5207('0x23')](function(){return _0x17250b;});})[_0x5207('0x23')](function(){_0x243352[_0x5207('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ac411,_0x3e4477){return function(_0x370d2f){if(!_0x370d2f){_0x4ac411['sendStatus'](0x194);}return _0x370d2f;};}function handleError(_0x3d76f1,_0x53cdb7){_0x53cdb7=_0x53cdb7||0x1f4;return function(_0x3e72b9){logger[_0x5207('0x28')](_0x3e72b9['stack']);if(_0x3e72b9[_0x5207('0x29')]){delete _0x3e72b9['name'];}_0x3d76f1['status'](_0x53cdb7)['send'](_0x3e72b9);};}function getMustacheRender(_0x58330a,_0x44a7f6){return Mustache['render'](_0x58330a,_[_0x5207('0x2a')](_0x44a7f6[_0x5207('0x2b')],{'contact':_0x44a7f6[_0x5207('0x2c')],'message':_0x44a7f6[_0x5207('0x2d')],'agent':_0x44a7f6['agent'],'interaction':_0x44a7f6[_0x5207('0x2e')],'account':_0x44a7f6[_0x5207('0x2f')]}))||'';}exports[_0x5207('0x30')]=function(_0x3fca85,_0x5e77b9){var _0x5d9ab2={},_0x1b96d2={},_0x209310={'count':0x0,'rows':[]};var _0x1fe76a=_[_0x5207('0x31')](db[_0x5207('0x32')][_0x5207('0x33')],function(_0x1da5aa){return{'name':_0x1da5aa['fieldName'],'type':_0x1da5aa['type'][_0x5207('0x34')]};});_0x1b96d2['model']=_[_0x5207('0x31')](_0x1fe76a,_0x5207('0x29'));_0x1b96d2[_0x5207('0x35')]=_[_0x5207('0x36')](_0x3fca85[_0x5207('0x35')]);_0x1b96d2[_0x5207('0x37')]=_[_0x5207('0x38')](_0x1b96d2['model'],_0x1b96d2[_0x5207('0x35')]);_0x5d9ab2[_0x5207('0x39')]=_[_0x5207('0x38')](_0x1b96d2[_0x5207('0x3a')],qs[_0x5207('0x3b')](_0x3fca85[_0x5207('0x35')][_0x5207('0x3b')]));_0x5d9ab2['attributes']=_0x5d9ab2['attributes'][_0x5207('0x3c')]?_0x5d9ab2[_0x5207('0x39')]:_0x1b96d2[_0x5207('0x3a')];if(!_0x3fca85[_0x5207('0x35')][_0x5207('0x3d')]('nolimit')){_0x5d9ab2['limit']=qs['limit'](_0x3fca85[_0x5207('0x35')][_0x5207('0x1a')]);_0x5d9ab2[_0x5207('0x1c')]=qs['offset'](_0x3fca85[_0x5207('0x35')][_0x5207('0x1c')]);}_0x5d9ab2[_0x5207('0x3e')]=qs[_0x5207('0x3f')](_0x3fca85[_0x5207('0x35')][_0x5207('0x3f')]);_0x5d9ab2[_0x5207('0x40')]=qs[_0x5207('0x37')](_['pick'](_0x3fca85[_0x5207('0x35')],_0x1b96d2[_0x5207('0x37')]),_0x1fe76a);if(_0x3fca85['query'][_0x5207('0x41')]){_0x5d9ab2['where']=_[_0x5207('0x2a')](_0x5d9ab2[_0x5207('0x40')],{'$or':_[_0x5207('0x31')](_0x1fe76a,function(_0x547658){if(_0x547658[_0x5207('0x42')]!==_0x5207('0x43')){var _0x4d671d={};_0x4d671d[_0x547658['name']]={'$like':'%'+_0x3fca85[_0x5207('0x35')][_0x5207('0x41')]+'%'};return _0x4d671d;}})});}_0x5d9ab2=_[_0x5207('0x2a')]({},_0x5d9ab2,_0x3fca85[_0x5207('0x44')]);var _0x45051b={'where':_0x5d9ab2[_0x5207('0x40')]};return db[_0x5207('0x32')][_0x5207('0x1b')](_0x45051b)[_0x5207('0x23')](function(_0x510cc1){_0x209310[_0x5207('0x1b')]=_0x510cc1;if(_0x3fca85[_0x5207('0x35')][_0x5207('0x45')]){_0x5d9ab2['include']=[{'all':!![]}];}return db[_0x5207('0x32')][_0x5207('0x46')](_0x5d9ab2);})[_0x5207('0x23')](function(_0x2f54b6){_0x209310[_0x5207('0x47')]=_0x2f54b6;return _0x209310;})[_0x5207('0x23')](respondWithFilteredResult(_0x5e77b9,_0x5d9ab2))[_0x5207('0x48')](handleError(_0x5e77b9,null));};exports[_0x5207('0x49')]=function(_0x1407cf,_0x1a4343){var _0x424603={'raw':!![],'where':{'id':_0x1407cf[_0x5207('0x4a')]['id']}},_0x243e38={};_0x243e38[_0x5207('0x3a')]=_['keys'](db[_0x5207('0x32')][_0x5207('0x33')]);_0x243e38[_0x5207('0x35')]=_[_0x5207('0x36')](_0x1407cf['query']);_0x243e38[_0x5207('0x37')]=_[_0x5207('0x38')](_0x243e38[_0x5207('0x3a')],_0x243e38[_0x5207('0x35')]);_0x424603['attributes']=_[_0x5207('0x38')](_0x243e38[_0x5207('0x3a')],qs[_0x5207('0x3b')](_0x1407cf[_0x5207('0x35')]['fields']));_0x424603[_0x5207('0x39')]=_0x424603[_0x5207('0x39')][_0x5207('0x3c')]?_0x424603[_0x5207('0x39')]:_0x243e38[_0x5207('0x3a')];if(_0x1407cf['query'][_0x5207('0x45')]){_0x424603['include']=[{'all':!![]}];}_0x424603=_[_0x5207('0x2a')]({},_0x424603,_0x1407cf['options']);return db[_0x5207('0x32')][_0x5207('0x4b')](_0x424603)[_0x5207('0x23')](handleEntityNotFound(_0x1a4343,null))[_0x5207('0x23')](respondWithResult(_0x1a4343,null))[_0x5207('0x48')](handleError(_0x1a4343,null));};exports[_0x5207('0x4c')]=function(_0x49c555,_0x3ea941){return db[_0x5207('0x32')][_0x5207('0x4c')](_0x49c555[_0x5207('0x2b')],{})[_0x5207('0x23')](function(_0x2da582){var _0x502da8=_0x49c555[_0x5207('0x4d')][_0x5207('0x25')]({'plain':!![]});if(!_0x502da8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x502da8['role']===_0x5207('0x4d')){var _0x13c196=_0x2da582[_0x5207('0x25')]({'plain':!![]});var _0x2b9b63='CmContactHasItems';return db[_0x5207('0x4e')][_0x5207('0x4b')]({'where':{'name':_0x2b9b63,'userProfileId':_0x502da8[_0x5207('0x4f')]},'raw':!![]})[_0x5207('0x23')](function(_0x577b32){if(_0x577b32&&_0x577b32[_0x5207('0x50')]===0x0){return db['UserProfileResource'][_0x5207('0x4c')]({'name':_0x13c196[_0x5207('0x29')],'resourceId':_0x13c196['id'],'type':_0x577b32[_0x5207('0x29')],'sectionId':_0x577b32['id']},{})[_0x5207('0x23')](function(){return _0x2da582;});}else{return _0x2da582;}})[_0x5207('0x48')](function(_0x57d52d){logger[_0x5207('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57d52d);throw _0x57d52d;});}return _0x2da582;})[_0x5207('0x23')](respondWithResult(_0x3ea941,0xc9))['catch'](handleError(_0x3ea941,null));};exports['update']=function(_0x2e5ec1,_0x47f5f5){if(_0x2e5ec1[_0x5207('0x2b')]['id']){delete _0x2e5ec1['body']['id'];}return db[_0x5207('0x32')][_0x5207('0x4b')]({'where':{'id':_0x2e5ec1[_0x5207('0x4a')]['id']}})[_0x5207('0x23')](handleEntityNotFound(_0x47f5f5,null))[_0x5207('0x23')](saveUpdates(_0x2e5ec1['body'],null))[_0x5207('0x23')](respondWithResult(_0x47f5f5,null))[_0x5207('0x48')](handleError(_0x47f5f5,null));};exports[_0x5207('0x24')]=function(_0x5772a3,_0x1590ab){return db[_0x5207('0x32')]['find']({'where':{'id':_0x5772a3['params']['id']}})[_0x5207('0x23')](handleEntityNotFound(_0x1590ab,null))['then'](removeEntity(_0x1590ab,null))[_0x5207('0x48')](handleError(_0x1590ab,null));}; \ No newline at end of file +var _0x808b=['nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','CmContactHasItem','includeAll','include','findAll','rows','show','params','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','send','body','contact','message','interaction','account','index','map','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0x808b,0xd3));var _0xb808=function(_0x10393a,_0x2371f2){_0x10393a=_0x10393a-0x0;var _0x4eba0b=_0x808b[_0x10393a];return _0x4eba0b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb808('0x0'));var jsonpatch=require(_0xb808('0x1'));var rp=require(_0xb808('0x2'));var moment=require(_0xb808('0x3'));var BPromise=require(_0xb808('0x4'));var Mustache=require(_0xb808('0x5'));var util=require(_0xb808('0x6'));var path=require(_0xb808('0x7'));var sox=require(_0xb808('0x8'));var csv=require(_0xb808('0x9'));var ejs=require(_0xb808('0xa'));var fs=require('fs');var fs_extra=require(_0xb808('0xb'));var _=require(_0xb808('0xc'));var squel=require('squel');var crypto=require(_0xb808('0xd'));var jsforce=require(_0xb808('0xe'));var deskjs=require(_0xb808('0xf'));var toCsv=require(_0xb808('0x9'));var querystring=require('querystring');var Papa=require(_0xb808('0x10'));var Redis=require('ioredis');var authService=require(_0xb808('0x11'));var qs=require(_0xb808('0x12'));var as=require(_0xb808('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb808('0x14'))(_0xb808('0x15'));var utils=require(_0xb808('0x16'));var config=require(_0xb808('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f13ae,_0xd2e0b2){_0xd2e0b2=_0xd2e0b2||0xcc;return function(_0x255c08){if(_0x255c08){return _0x4f13ae[_0xb808('0x18')](_0xd2e0b2);}return _0x4f13ae[_0xb808('0x19')](_0xd2e0b2)[_0xb808('0x1a')]();};}function respondWithResult(_0x14f70e,_0x188e47){_0x188e47=_0x188e47||0xc8;return function(_0x273237){if(_0x273237){return _0x14f70e[_0xb808('0x19')](_0x188e47)[_0xb808('0x1b')](_0x273237);}};}function respondWithFilteredResult(_0x115ce8,_0x2b32dd){return function(_0x521f75){if(_0x521f75){var _0x329c57=typeof _0x2b32dd[_0xb808('0x1c')]===_0xb808('0x1d')&&typeof _0x2b32dd[_0xb808('0x1e')]===_0xb808('0x1d');var _0x33c917=_0x521f75[_0xb808('0x1f')];var _0x5b70e0=_0x329c57?0x0:_0x2b32dd['offset'];var _0x5662bf=_0x329c57?_0x521f75['count']:_0x2b32dd['offset']+_0x2b32dd[_0xb808('0x1e')];var _0x33b7f0;if(_0x5662bf>=_0x33c917){_0x5662bf=_0x33c917;_0x33b7f0=0xc8;}else{_0x33b7f0=0xce;}_0x115ce8[_0xb808('0x19')](_0x33b7f0);return _0x115ce8[_0xb808('0x20')](_0xb808('0x21'),_0x5b70e0+'-'+_0x5662bf+'/'+_0x33c917)[_0xb808('0x1b')](_0x521f75);}return null;};}function patchUpdates(_0x476461){return function(_0x1a5573){try{jsonpatch[_0xb808('0x22')](_0x1a5573,_0x476461,!![]);}catch(_0x525c8c){return BPromise[_0xb808('0x23')](_0x525c8c);}return _0x1a5573[_0xb808('0x24')]();};}function saveUpdates(_0x552003,_0x367e2d){return function(_0x50637a){if(_0x50637a){return _0x50637a[_0xb808('0x25')](_0x552003)[_0xb808('0x26')](function(_0x269829){return _0x269829;});}return null;};}function removeEntity(_0x515704,_0x59d294){return function(_0x46eef1){if(_0x46eef1){return _0x46eef1[_0xb808('0x27')]()['then'](function(){var _0x2a8491=_0x46eef1['get']({'plain':!![]});var _0x48988f='CmContactHasItems';return db[_0xb808('0x28')][_0xb808('0x27')]({'where':{'type':_0x48988f,'resourceId':_0x2a8491['id']}})[_0xb808('0x26')](function(){return _0x46eef1;});})[_0xb808('0x26')](function(){_0x515704['status'](0xcc)[_0xb808('0x1a')]();});}};}function handleEntityNotFound(_0x3f29e9,_0x283bd6){return function(_0x3440e3){if(!_0x3440e3){_0x3f29e9[_0xb808('0x18')](0x194);}return _0x3440e3;};}function handleError(_0x35b7a7,_0x88237c){_0x88237c=_0x88237c||0x1f4;return function(_0x567245){logger['error'](_0x567245[_0xb808('0x29')]);if(_0x567245[_0xb808('0x2a')]){delete _0x567245[_0xb808('0x2a')];}_0x35b7a7[_0xb808('0x19')](_0x88237c)[_0xb808('0x2b')](_0x567245);};}function getMustacheRender(_0x38e78b,_0x349a80){return Mustache['render'](_0x38e78b,_['merge'](_0x349a80[_0xb808('0x2c')],{'contact':_0x349a80[_0xb808('0x2d')],'message':_0x349a80[_0xb808('0x2e')],'agent':_0x349a80['agent'],'interaction':_0x349a80[_0xb808('0x2f')],'account':_0x349a80[_0xb808('0x30')]}))||'';}exports[_0xb808('0x31')]=function(_0x4886e0,_0x4accd1){var _0x27cf4e={},_0x689acd={},_0x5205e3={'count':0x0,'rows':[]};var _0x40bf73=_[_0xb808('0x32')](db['CmContactHasItem'][_0xb808('0x33')],function(_0xa973e8){return{'name':_0xa973e8['fieldName'],'type':_0xa973e8[_0xb808('0x34')]['key']};});_0x689acd['model']=_[_0xb808('0x32')](_0x40bf73,_0xb808('0x2a'));_0x689acd[_0xb808('0x35')]=_[_0xb808('0x36')](_0x4886e0[_0xb808('0x35')]);_0x689acd[_0xb808('0x37')]=_[_0xb808('0x38')](_0x689acd[_0xb808('0x39')],_0x689acd['query']);_0x27cf4e[_0xb808('0x3a')]=_['intersection'](_0x689acd[_0xb808('0x39')],qs[_0xb808('0x3b')](_0x4886e0[_0xb808('0x35')][_0xb808('0x3b')]));_0x27cf4e[_0xb808('0x3a')]=_0x27cf4e[_0xb808('0x3a')][_0xb808('0x3c')]?_0x27cf4e[_0xb808('0x3a')]:_0x689acd[_0xb808('0x39')];if(!_0x4886e0[_0xb808('0x35')][_0xb808('0x3d')](_0xb808('0x3e'))){_0x27cf4e['limit']=qs['limit'](_0x4886e0['query'][_0xb808('0x1e')]);_0x27cf4e['offset']=qs['offset'](_0x4886e0[_0xb808('0x35')][_0xb808('0x1c')]);}_0x27cf4e[_0xb808('0x3f')]=qs[_0xb808('0x40')](_0x4886e0[_0xb808('0x35')][_0xb808('0x40')]);_0x27cf4e[_0xb808('0x41')]=qs[_0xb808('0x37')](_[_0xb808('0x42')](_0x4886e0['query'],_0x689acd[_0xb808('0x37')]),_0x40bf73);if(_0x4886e0[_0xb808('0x35')]['filter']){_0x27cf4e[_0xb808('0x41')]=_[_0xb808('0x43')](_0x27cf4e[_0xb808('0x41')],{'$or':_[_0xb808('0x32')](_0x40bf73,function(_0x15cf60){if(_0x15cf60[_0xb808('0x34')]!==_0xb808('0x44')){var _0x177876={};_0x177876[_0x15cf60['name']]={'$like':'%'+_0x4886e0[_0xb808('0x35')][_0xb808('0x45')]+'%'};return _0x177876;}})});}_0x27cf4e=_[_0xb808('0x43')]({},_0x27cf4e,_0x4886e0[_0xb808('0x46')]);var _0x3d5c78={'where':_0x27cf4e['where']};return db[_0xb808('0x47')][_0xb808('0x1f')](_0x3d5c78)[_0xb808('0x26')](function(_0x302cbc){_0x5205e3[_0xb808('0x1f')]=_0x302cbc;if(_0x4886e0[_0xb808('0x35')][_0xb808('0x48')]){_0x27cf4e[_0xb808('0x49')]=[{'all':!![]}];}return db[_0xb808('0x47')][_0xb808('0x4a')](_0x27cf4e);})[_0xb808('0x26')](function(_0x4ef3ec){_0x5205e3[_0xb808('0x4b')]=_0x4ef3ec;return _0x5205e3;})[_0xb808('0x26')](respondWithFilteredResult(_0x4accd1,_0x27cf4e))['catch'](handleError(_0x4accd1,null));};exports[_0xb808('0x4c')]=function(_0x683b6,_0x3d9081){var _0x499879={'raw':!![],'where':{'id':_0x683b6[_0xb808('0x4d')]['id']}},_0x2c2ec7={};_0x2c2ec7['model']=_[_0xb808('0x36')](db[_0xb808('0x47')]['rawAttributes']);_0x2c2ec7['query']=_['keys'](_0x683b6['query']);_0x2c2ec7[_0xb808('0x37')]=_['intersection'](_0x2c2ec7[_0xb808('0x39')],_0x2c2ec7[_0xb808('0x35')]);_0x499879[_0xb808('0x3a')]=_['intersection'](_0x2c2ec7['model'],qs[_0xb808('0x3b')](_0x683b6[_0xb808('0x35')]['fields']));_0x499879[_0xb808('0x3a')]=_0x499879[_0xb808('0x3a')][_0xb808('0x3c')]?_0x499879[_0xb808('0x3a')]:_0x2c2ec7[_0xb808('0x39')];if(_0x683b6[_0xb808('0x35')][_0xb808('0x48')]){_0x499879['include']=[{'all':!![]}];}_0x499879=_['merge']({},_0x499879,_0x683b6[_0xb808('0x46')]);return db[_0xb808('0x47')][_0xb808('0x4e')](_0x499879)[_0xb808('0x26')](handleEntityNotFound(_0x3d9081,null))[_0xb808('0x26')](respondWithResult(_0x3d9081,null))[_0xb808('0x4f')](handleError(_0x3d9081,null));};exports[_0xb808('0x50')]=function(_0x11808c,_0x18e6e4){return db['CmContactHasItem']['create'](_0x11808c['body'],{})[_0xb808('0x26')](function(_0x5b69c6){var _0x478689=_0x11808c['user']['get']({'plain':!![]});if(!_0x478689)throw new Error(_0xb808('0x51'));if(_0x478689[_0xb808('0x52')]===_0xb808('0x53')){var _0x5cff96=_0x5b69c6[_0xb808('0x54')]({'plain':!![]});var _0x5e64da=_0xb808('0x55');return db[_0xb808('0x56')][_0xb808('0x4e')]({'where':{'name':_0x5e64da,'userProfileId':_0x478689[_0xb808('0x57')]},'raw':!![]})[_0xb808('0x26')](function(_0x5d8b41){if(_0x5d8b41&&_0x5d8b41[_0xb808('0x58')]===0x0){return db[_0xb808('0x28')]['create']({'name':_0x5cff96[_0xb808('0x2a')],'resourceId':_0x5cff96['id'],'type':_0x5d8b41['name'],'sectionId':_0x5d8b41['id']},{})[_0xb808('0x26')](function(){return _0x5b69c6;});}else{return _0x5b69c6;}})['catch'](function(_0x588720){logger[_0xb808('0x59')](_0xb808('0x5a'),_0x588720);throw _0x588720;});}return _0x5b69c6;})['then'](respondWithResult(_0x18e6e4,0xc9))['catch'](handleError(_0x18e6e4,null));};exports['update']=function(_0x2c7a33,_0x299fdf){if(_0x2c7a33[_0xb808('0x2c')]['id']){delete _0x2c7a33['body']['id'];}return db[_0xb808('0x47')][_0xb808('0x4e')]({'where':{'id':_0x2c7a33['params']['id']}})[_0xb808('0x26')](handleEntityNotFound(_0x299fdf,null))[_0xb808('0x26')](saveUpdates(_0x2c7a33[_0xb808('0x2c')],null))['then'](respondWithResult(_0x299fdf,null))[_0xb808('0x4f')](handleError(_0x299fdf,null));};exports['destroy']=function(_0x4bff18,_0x2d98e8){return db[_0xb808('0x47')][_0xb808('0x4e')]({'where':{'id':_0x4bff18[_0xb808('0x4d')]['id']}})[_0xb808('0x26')](handleEntityNotFound(_0x2d98e8,null))[_0xb808('0x26')](removeEntity(_0x2d98e8,null))['catch'](handleError(_0x2d98e8,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 94ae22d..23d047a 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56a4=['./cmContactHasItem.attributes','exports','cm_contact_has_items','lodash','util','api','moment','path','rimraf','../../config/environment'];(function(_0x30f096,_0x3d0888){var _0x5839d8=function(_0x5220ea){while(--_0x5220ea){_0x30f096['push'](_0x30f096['shift']());}};_0x5839d8(++_0x3d0888);}(_0x56a4,0x11b));var _0x456a=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x56a4[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var logger=require('../../config/logger')(_0x456a('0x2'));var moment=require(_0x456a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x456a('0x4'));var rimraf=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var attributes=require(_0x456a('0x7'));module[_0x456a('0x8')]=function(_0x4b8eec,_0x3b0145){return _0x4b8eec['define']('CmContactHasItem',attributes,{'tableName':_0x456a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7da7=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','cm_contact_has_items','lodash'];(function(_0x4b688f,_0x476f40){var _0x4ccc2b=function(_0x266227){while(--_0x266227){_0x4b688f['push'](_0x4b688f['shift']());}};_0x4ccc2b(++_0x476f40);}(_0x7da7,0x10d));var _0x77da=function(_0x595604,_0x2cc998){_0x595604=_0x595604-0x0;var _0x1466f3=_0x7da7[_0x595604];return _0x1466f3;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var logger=require(_0x77da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x77da('0x3'));var rp=require(_0x77da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var attributes=require('./cmContactHasItem.attributes');module[_0x77da('0x7')]=function(_0xc54a12,_0x47da81){return _0xc54a12[_0x77da('0x8')]('CmContactHasItem',attributes,{'tableName':_0x77da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 532fe80..a4d2927 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x730d=['debug','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent'];(function(_0x2b622b,_0x2023b5){var _0x11858e=function(_0x4958b1){while(--_0x4958b1){_0x2b622b['push'](_0x2b622b['shift']());}};_0x11858e(++_0x2023b5);}(_0x730d,0x110));var _0xd730=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x730d[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0xd730('0x0'));var util=require(_0xd730('0x1'));var moment=require('moment');var BPromise=require(_0xd730('0x2'));var rs=require(_0xd730('0x3'));var fs=require('fs');var Redis=require(_0xd730('0x4'));var db=require(_0xd730('0x5'))['db'];var utils=require(_0xd730('0x6'));var logger=require('../../config/logger')(_0xd730('0x7'));var config=require(_0xd730('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd730('0x9')][_0xd730('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x280d13,_0x2d451b,_0x3e1b25){return new BPromise(function(_0x9f1f7,_0xdcf68e){return client['request'](_0x280d13,_0x3e1b25)[_0xd730('0xb')](function(_0x2c2195){logger[_0xd730('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x2d451b,_0xd730('0xd'));logger[_0xd730('0xe')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x2d451b,_0xd730('0xd'),JSON[_0xd730('0xf')](_0x2c2195));if(_0x2c2195[_0xd730('0x10')]){if(_0x2c2195[_0xd730('0x10')][_0xd730('0x11')]===0x1f4){logger[_0xd730('0x10')](_0xd730('0x12'),_0x2d451b,_0x2c2195[_0xd730('0x10')][_0xd730('0x13')]);return _0xdcf68e(_0x2c2195['error'][_0xd730('0x13')]);}logger[_0xd730('0x10')](_0xd730('0x12'),_0x2d451b,_0x2c2195[_0xd730('0x10')][_0xd730('0x13')]);return _0x9f1f7(_0x2c2195['error'][_0xd730('0x13')]);}else{logger[_0xd730('0xc')](_0xd730('0x12'),_0x2d451b,_0xd730('0xd'));_0x9f1f7(_0x2c2195[_0xd730('0x14')]['message']);}})[_0xd730('0x15')](function(_0x5555de){logger[_0xd730('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x2d451b,_0x5555de);_0xdcf68e(_0x5555de);});});} \ No newline at end of file +var _0xd8af=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','CmContactHasItem,\x20%s,\x20%s','debug','error','message','request\x20sent','result','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8af,0x142));var _0xfd8a=function(_0x145f05,_0x5b3ea3){_0x145f05=_0x145f05-0x0;var _0x18dcac=_0xd8af[_0x145f05];return _0x18dcac;};'use strict';var _=require(_0xfd8a('0x0'));var util=require(_0xfd8a('0x1'));var moment=require(_0xfd8a('0x2'));var BPromise=require(_0xfd8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd8a('0x4'));var db=require(_0xfd8a('0x5'))['db'];var utils=require(_0xfd8a('0x6'));var logger=require('../../config/logger')(_0xfd8a('0x7'));var config=require('../../config/environment');var jayson=require(_0xfd8a('0x8'));var client=jayson[_0xfd8a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5260c4,_0x1f132d,_0x344457){return new BPromise(function(_0x20a4fa,_0x4a32e3){return client[_0xfd8a('0xa')](_0x5260c4,_0x344457)[_0xfd8a('0xb')](function(_0x124962){logger[_0xfd8a('0xc')](_0xfd8a('0xd'),_0x1f132d,'request\x20sent');logger[_0xfd8a('0xe')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x1f132d,'request\x20sent',JSON['stringify'](_0x124962));if(_0x124962[_0xfd8a('0xf')]){if(_0x124962[_0xfd8a('0xf')]['code']===0x1f4){logger[_0xfd8a('0xf')](_0xfd8a('0xd'),_0x1f132d,_0x124962[_0xfd8a('0xf')]['message']);return _0x4a32e3(_0x124962[_0xfd8a('0xf')][_0xfd8a('0x10')]);}logger[_0xfd8a('0xf')](_0xfd8a('0xd'),_0x1f132d,_0x124962[_0xfd8a('0xf')]['message']);return _0x20a4fa(_0x124962[_0xfd8a('0xf')][_0xfd8a('0x10')]);}else{logger[_0xfd8a('0xc')](_0xfd8a('0xd'),_0x1f132d,_0xfd8a('0x11'));_0x20a4fa(_0x124962[_0xfd8a('0x12')]['message']);}})['catch'](function(_0x240770){logger['error'](_0xfd8a('0xd'),_0x1f132d,_0x240770);_0x4a32e3(_0x240770);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 9d00c29..b5e7f63 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe62=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','index','/:id','isAuthenticated','post','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5ed567,_0x3832ed){var _0x35210e=function(_0x5b9c31){while(--_0x5b9c31){_0x5ed567['push'](_0x5ed567['shift']());}};_0x35210e(++_0x3832ed);}(_0xfe62,0x152));var _0x2fe6=function(_0x4f6ea2,_0x1c36a4){_0x4f6ea2=_0x4f6ea2-0x0;var _0x3f1609=_0xfe62[_0x4f6ea2];return _0x3f1609;};'use strict';var multer=require(_0x2fe6('0x0'));var util=require(_0x2fe6('0x1'));var path=require(_0x2fe6('0x2'));var timeout=require(_0x2fe6('0x3'));var express=require('express');var router=express[_0x2fe6('0x4')]();var fs_extra=require(_0x2fe6('0x5'));var auth=require(_0x2fe6('0x6'));var interaction=require(_0x2fe6('0x7'));var config=require(_0x2fe6('0x8'));var controller=require(_0x2fe6('0x9'));router[_0x2fe6('0xa')]('/',auth['isAuthenticated'](),controller[_0x2fe6('0xb')]);router[_0x2fe6('0xa')](_0x2fe6('0xc'),auth[_0x2fe6('0xd')](),controller['show']);router[_0x2fe6('0xe')]('/',auth[_0x2fe6('0xd')](),controller[_0x2fe6('0xf')]);router['put'](_0x2fe6('0xc'),auth[_0x2fe6('0xd')](),controller['update']);router[_0x2fe6('0x10')](_0x2fe6('0xc'),auth['isAuthenticated'](),controller[_0x2fe6('0x11')]);module[_0x2fe6('0x12')]=router; \ No newline at end of file +var _0x709b=['Router','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','get','/:id','show','post','update','delete','destroy','exports','multer','path'];(function(_0x26de68,_0x1721f1){var _0x40308a=function(_0x2ecf99){while(--_0x2ecf99){_0x26de68['push'](_0x26de68['shift']());}};_0x40308a(++_0x1721f1);}(_0x709b,0xfe));var _0xb709=function(_0x2c0a8b,_0x415a60){_0x2c0a8b=_0x2c0a8b-0x0;var _0x2df1db=_0x709b[_0x2c0a8b];return _0x2df1db;};'use strict';var multer=require(_0xb709('0x0'));var util=require('util');var path=require(_0xb709('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb709('0x2')]();var fs_extra=require(_0xb709('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb709('0x4'));var config=require(_0xb709('0x5'));var controller=require(_0xb709('0x6'));router['get']('/',auth[_0xb709('0x7')](),controller['index']);router[_0xb709('0x8')](_0xb709('0x9'),auth[_0xb709('0x7')](),controller[_0xb709('0xa')]);router[_0xb709('0xb')]('/',auth[_0xb709('0x7')](),controller['create']);router['put'](_0xb709('0x9'),auth[_0xb709('0x7')](),controller[_0xb709('0xc')]);router[_0xb709('0xd')](_0xb709('0x9'),auth[_0xb709('0x7')](),controller[_0xb709('0xe')]);module[_0xb709('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index b1dd607..95b7378 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ba4=['exports','INTEGER','sequelize'];(function(_0x17d82f,_0x5d9172){var _0x58137b=function(_0x40e198){while(--_0x40e198){_0x17d82f['push'](_0x17d82f['shift']());}};_0x58137b(++_0x5d9172);}(_0x8ba4,0x191));var _0x48ba=function(_0x252805,_0x1d1e8e){_0x252805=_0x252805-0x0;var _0x3e74b9=_0x8ba4[_0x252805];return _0x3e74b9;};'use strict';var Sequelize=require(_0x48ba('0x0'));module[_0x48ba('0x1')]={'CmContactId':{'type':Sequelize[_0x48ba('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0xc384=['STRING','sequelize','exports','INTEGER'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xc384,0x12d));var _0x4c38=function(_0x900c2d,_0xfcc1d){_0x900c2d=_0x900c2d-0x0;var _0x326c0b=_0xc384[_0x900c2d];return _0x326c0b;};'use strict';var Sequelize=require(_0x4c38('0x0'));module[_0x4c38('0x1')]={'CmContactId':{'type':Sequelize[_0x4c38('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x4c38('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index 492452b..e7cc212 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca27=['filter','merge','VIRTUAL','includeAll','include','findAll','catch','rawAttributes','length','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','then','CmContactHasPhones','UserProfileResource','name','body','contact','message','interaction','account','map','CmContactHasPhone','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where'];(function(_0x34c553,_0x3e7dfc){var _0x1357d2=function(_0x3b509f){while(--_0x3b509f){_0x34c553['push'](_0x34c553['shift']());}};_0x1357d2(++_0x3e7dfc);}(_0xca27,0x1e5));var _0x7ca2=function(_0x36bef1,_0x4ef227){_0x36bef1=_0x36bef1-0x0;var _0x1303cb=_0xca27[_0x36bef1];return _0x1303cb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7ca2('0x0'));var jsonpatch=require(_0x7ca2('0x1'));var rp=require(_0x7ca2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7ca2('0x3'));var util=require(_0x7ca2('0x4'));var path=require(_0x7ca2('0x5'));var sox=require(_0x7ca2('0x6'));var csv=require(_0x7ca2('0x7'));var ejs=require(_0x7ca2('0x8'));var fs=require('fs');var fs_extra=require(_0x7ca2('0x9'));var _=require('lodash');var squel=require(_0x7ca2('0xa'));var crypto=require('crypto');var jsforce=require(_0x7ca2('0xb'));var deskjs=require(_0x7ca2('0xc'));var toCsv=require(_0x7ca2('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7ca2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7ca2('0xe'));var as=require(_0x7ca2('0xf'));var hardwareService=require(_0x7ca2('0x10'));var logger=require(_0x7ca2('0x11'))(_0x7ca2('0x12'));var utils=require(_0x7ca2('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7ca2('0x14'))['db'];function respondWithStatusCode(_0x49debd,_0x540077){_0x540077=_0x540077||0xcc;return function(_0x254ee8){if(_0x254ee8){return _0x49debd[_0x7ca2('0x15')](_0x540077);}return _0x49debd[_0x7ca2('0x16')](_0x540077)[_0x7ca2('0x17')]();};}function respondWithResult(_0x7bf62c,_0xd5139d){_0xd5139d=_0xd5139d||0xc8;return function(_0x4a05d5){if(_0x4a05d5){return _0x7bf62c[_0x7ca2('0x16')](_0xd5139d)[_0x7ca2('0x18')](_0x4a05d5);}};}function respondWithFilteredResult(_0x4a2097,_0x357fa3){return function(_0x3a95e3){if(_0x3a95e3){var _0x5e97e5=typeof _0x357fa3[_0x7ca2('0x19')]==='undefined'&&typeof _0x357fa3[_0x7ca2('0x1a')]==='undefined';var _0x48fbd7=_0x3a95e3[_0x7ca2('0x1b')];var _0x36b550=_0x5e97e5?0x0:_0x357fa3[_0x7ca2('0x19')];var _0x58591a=_0x5e97e5?_0x3a95e3[_0x7ca2('0x1b')]:_0x357fa3[_0x7ca2('0x19')]+_0x357fa3[_0x7ca2('0x1a')];var _0x45700d;if(_0x58591a>=_0x48fbd7){_0x58591a=_0x48fbd7;_0x45700d=0xc8;}else{_0x45700d=0xce;}_0x4a2097[_0x7ca2('0x16')](_0x45700d);return _0x4a2097['set'](_0x7ca2('0x1c'),_0x36b550+'-'+_0x58591a+'/'+_0x48fbd7)['json'](_0x3a95e3);}return null;};}function patchUpdates(_0x2e03a5){return function(_0x4c4822){try{jsonpatch['apply'](_0x4c4822,_0x2e03a5,!![]);}catch(_0x549a78){return BPromise[_0x7ca2('0x1d')](_0x549a78);}return _0x4c4822[_0x7ca2('0x1e')]();};}function saveUpdates(_0x29496e,_0x2c8c9f){return function(_0x6e3b83){if(_0x6e3b83){return _0x6e3b83['update'](_0x29496e)['then'](function(_0xf5f5cc){return _0xf5f5cc;});}return null;};}function removeEntity(_0x51ff85,_0x3c57f5){return function(_0x2e1a65){if(_0x2e1a65){return _0x2e1a65['destroy']()[_0x7ca2('0x1f')](function(){var _0x4a172c=_0x2e1a65['get']({'plain':!![]});var _0x135a95=_0x7ca2('0x20');return db[_0x7ca2('0x21')]['destroy']({'where':{'type':_0x135a95,'resourceId':_0x4a172c['id']}})[_0x7ca2('0x1f')](function(){return _0x2e1a65;});})[_0x7ca2('0x1f')](function(){_0x51ff85[_0x7ca2('0x16')](0xcc)[_0x7ca2('0x17')]();});}};}function handleEntityNotFound(_0x308a57,_0x59a08e){return function(_0x3532aa){if(!_0x3532aa){_0x308a57[_0x7ca2('0x15')](0x194);}return _0x3532aa;};}function handleError(_0x24e0e9,_0xecfd65){_0xecfd65=_0xecfd65||0x1f4;return function(_0x2d9e7c){logger['error'](_0x2d9e7c['stack']);if(_0x2d9e7c[_0x7ca2('0x22')]){delete _0x2d9e7c[_0x7ca2('0x22')];}_0x24e0e9['status'](_0xecfd65)['send'](_0x2d9e7c);};}function getMustacheRender(_0x2b39be,_0x369cf1){return Mustache['render'](_0x2b39be,_['merge'](_0x369cf1[_0x7ca2('0x23')],{'contact':_0x369cf1[_0x7ca2('0x24')],'message':_0x369cf1[_0x7ca2('0x25')],'agent':_0x369cf1['agent'],'interaction':_0x369cf1[_0x7ca2('0x26')],'account':_0x369cf1[_0x7ca2('0x27')]}))||'';}exports['index']=function(_0x2ed817,_0x155abf){var _0x5d9639={},_0x594c10={},_0xde54e9={'count':0x0,'rows':[]};var _0x32080d=_[_0x7ca2('0x28')](db[_0x7ca2('0x29')]['rawAttributes'],function(_0x238a51){return{'name':_0x238a51['fieldName'],'type':_0x238a51[_0x7ca2('0x2a')][_0x7ca2('0x2b')]};});_0x594c10[_0x7ca2('0x2c')]=_['map'](_0x32080d,_0x7ca2('0x22'));_0x594c10[_0x7ca2('0x2d')]=_[_0x7ca2('0x2e')](_0x2ed817[_0x7ca2('0x2d')]);_0x594c10[_0x7ca2('0x2f')]=_['intersection'](_0x594c10[_0x7ca2('0x2c')],_0x594c10['query']);_0x5d9639['attributes']=_[_0x7ca2('0x30')](_0x594c10[_0x7ca2('0x2c')],qs[_0x7ca2('0x31')](_0x2ed817[_0x7ca2('0x2d')][_0x7ca2('0x31')]));_0x5d9639[_0x7ca2('0x32')]=_0x5d9639[_0x7ca2('0x32')]['length']?_0x5d9639[_0x7ca2('0x32')]:_0x594c10[_0x7ca2('0x2c')];if(!_0x2ed817[_0x7ca2('0x2d')][_0x7ca2('0x33')]('nolimit')){_0x5d9639[_0x7ca2('0x1a')]=qs[_0x7ca2('0x1a')](_0x2ed817[_0x7ca2('0x2d')]['limit']);_0x5d9639[_0x7ca2('0x19')]=qs['offset'](_0x2ed817[_0x7ca2('0x2d')][_0x7ca2('0x19')]);}_0x5d9639['order']=qs[_0x7ca2('0x34')](_0x2ed817[_0x7ca2('0x2d')][_0x7ca2('0x34')]);_0x5d9639[_0x7ca2('0x35')]=qs[_0x7ca2('0x2f')](_['pick'](_0x2ed817['query'],_0x594c10[_0x7ca2('0x2f')]),_0x32080d);if(_0x2ed817[_0x7ca2('0x2d')][_0x7ca2('0x36')]){_0x5d9639['where']=_[_0x7ca2('0x37')](_0x5d9639[_0x7ca2('0x35')],{'$or':_[_0x7ca2('0x28')](_0x32080d,function(_0x3f8d89){if(_0x3f8d89['type']!==_0x7ca2('0x38')){var _0x42742e={};_0x42742e[_0x3f8d89['name']]={'$like':'%'+_0x2ed817[_0x7ca2('0x2d')][_0x7ca2('0x36')]+'%'};return _0x42742e;}})});}_0x5d9639=_['merge']({},_0x5d9639,_0x2ed817['options']);var _0x3ab740={'where':_0x5d9639[_0x7ca2('0x35')]};return db[_0x7ca2('0x29')]['count'](_0x3ab740)[_0x7ca2('0x1f')](function(_0xb377cd){_0xde54e9[_0x7ca2('0x1b')]=_0xb377cd;if(_0x2ed817[_0x7ca2('0x2d')][_0x7ca2('0x39')]){_0x5d9639[_0x7ca2('0x3a')]=[{'all':!![]}];}return db['CmContactHasPhone'][_0x7ca2('0x3b')](_0x5d9639);})[_0x7ca2('0x1f')](function(_0x50ac79){_0xde54e9['rows']=_0x50ac79;return _0xde54e9;})[_0x7ca2('0x1f')](respondWithFilteredResult(_0x155abf,_0x5d9639))[_0x7ca2('0x3c')](handleError(_0x155abf,null));};exports['show']=function(_0x3aa894,_0x37059b){var _0x4ce07f={'raw':!![],'where':{'id':_0x3aa894['params']['id']}},_0x5c059f={};_0x5c059f[_0x7ca2('0x2c')]=_['keys'](db['CmContactHasPhone'][_0x7ca2('0x3d')]);_0x5c059f[_0x7ca2('0x2d')]=_['keys'](_0x3aa894['query']);_0x5c059f[_0x7ca2('0x2f')]=_['intersection'](_0x5c059f['model'],_0x5c059f[_0x7ca2('0x2d')]);_0x4ce07f[_0x7ca2('0x32')]=_[_0x7ca2('0x30')](_0x5c059f[_0x7ca2('0x2c')],qs[_0x7ca2('0x31')](_0x3aa894[_0x7ca2('0x2d')][_0x7ca2('0x31')]));_0x4ce07f[_0x7ca2('0x32')]=_0x4ce07f[_0x7ca2('0x32')][_0x7ca2('0x3e')]?_0x4ce07f[_0x7ca2('0x32')]:_0x5c059f[_0x7ca2('0x2c')];if(_0x3aa894[_0x7ca2('0x2d')]['includeAll']){_0x4ce07f[_0x7ca2('0x3a')]=[{'all':!![]}];}_0x4ce07f=_[_0x7ca2('0x37')]({},_0x4ce07f,_0x3aa894[_0x7ca2('0x3f')]);return db[_0x7ca2('0x29')][_0x7ca2('0x40')](_0x4ce07f)[_0x7ca2('0x1f')](handleEntityNotFound(_0x37059b,null))[_0x7ca2('0x1f')](respondWithResult(_0x37059b,null))[_0x7ca2('0x3c')](handleError(_0x37059b,null));};exports[_0x7ca2('0x41')]=function(_0x438c90,_0x38e2b2){return db[_0x7ca2('0x29')][_0x7ca2('0x41')](_0x438c90[_0x7ca2('0x23')],{})[_0x7ca2('0x1f')](function(_0xba5567){var _0x2cd991=_0x438c90[_0x7ca2('0x42')][_0x7ca2('0x43')]({'plain':!![]});if(!_0x2cd991)throw new Error(_0x7ca2('0x44'));if(_0x2cd991[_0x7ca2('0x45')]===_0x7ca2('0x42')){var _0x2cf61b=_0xba5567[_0x7ca2('0x43')]({'plain':!![]});var _0x327f1c=_0x7ca2('0x20');return db[_0x7ca2('0x46')][_0x7ca2('0x40')]({'where':{'name':_0x327f1c,'userProfileId':_0x2cd991[_0x7ca2('0x47')]},'raw':!![]})[_0x7ca2('0x1f')](function(_0x4dbaa0){if(_0x4dbaa0&&_0x4dbaa0[_0x7ca2('0x48')]===0x0){return db[_0x7ca2('0x21')]['create']({'name':_0x2cf61b['name'],'resourceId':_0x2cf61b['id'],'type':_0x4dbaa0[_0x7ca2('0x22')],'sectionId':_0x4dbaa0['id']},{})['then'](function(){return _0xba5567;});}else{return _0xba5567;}})[_0x7ca2('0x3c')](function(_0x2166b1){logger[_0x7ca2('0x49')](_0x7ca2('0x4a'),_0x2166b1);throw _0x2166b1;});}return _0xba5567;})[_0x7ca2('0x1f')](respondWithResult(_0x38e2b2,0xc9))[_0x7ca2('0x3c')](handleError(_0x38e2b2,null));};exports[_0x7ca2('0x4b')]=function(_0x354785,_0x1bd12d){if(_0x354785[_0x7ca2('0x23')]['id']){delete _0x354785['body']['id'];}return db[_0x7ca2('0x29')][_0x7ca2('0x40')]({'where':{'id':_0x354785[_0x7ca2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1bd12d,null))['then'](saveUpdates(_0x354785[_0x7ca2('0x23')],null))[_0x7ca2('0x1f')](respondWithResult(_0x1bd12d,null))[_0x7ca2('0x3c')](handleError(_0x1bd12d,null));};exports['destroy']=function(_0x4491c8,_0x5684fc){return db[_0x7ca2('0x29')][_0x7ca2('0x40')]({'where':{'id':_0x4491c8[_0x7ca2('0x4c')]['id']}})[_0x7ca2('0x1f')](handleEntityNotFound(_0x5684fc,null))[_0x7ca2('0x1f')](removeEntity(_0x5684fc,null))[_0x7ca2('0x3c')](handleError(_0x5684fc,null));}; \ No newline at end of file +var _0x0d67=['index','map','CmContactHasPhone','fieldName','type','key','model','query','intersection','attributes','fields','order','sort','where','filters','filter','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','keys','length','includeAll','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CmContactHasPhones','UserProfileResource','error','stack','name','send','render','merge','contact','message','agent','interaction','account'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x0d67,0x7c));var _0x70d6=function(_0x1acb27,_0x346885){_0x1acb27=_0x1acb27-0x0;var _0x3fbad9=_0x0d67[_0x1acb27];return _0x3fbad9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x70d6('0x0'));var zipdir=require(_0x70d6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x70d6('0x2'));var BPromise=require(_0x70d6('0x3'));var Mustache=require(_0x70d6('0x4'));var util=require(_0x70d6('0x5'));var path=require('path');var sox=require(_0x70d6('0x6'));var csv=require(_0x70d6('0x7'));var ejs=require(_0x70d6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x70d6('0x9'));var squel=require('squel');var crypto=require(_0x70d6('0xa'));var jsforce=require(_0x70d6('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x70d6('0xc'));var Papa=require(_0x70d6('0xd'));var Redis=require('ioredis');var authService=require(_0x70d6('0xe'));var qs=require(_0x70d6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70d6('0x10'));var logger=require(_0x70d6('0x11'))(_0x70d6('0x12'));var utils=require(_0x70d6('0x13'));var config=require(_0x70d6('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x70d6('0x15'))['db'];function respondWithStatusCode(_0x53096e,_0x4325f5){_0x4325f5=_0x4325f5||0xcc;return function(_0x5ae9d6){if(_0x5ae9d6){return _0x53096e[_0x70d6('0x16')](_0x4325f5);}return _0x53096e['status'](_0x4325f5)[_0x70d6('0x17')]();};}function respondWithResult(_0x2c0679,_0x354af8){_0x354af8=_0x354af8||0xc8;return function(_0x1a882f){if(_0x1a882f){return _0x2c0679[_0x70d6('0x18')](_0x354af8)[_0x70d6('0x19')](_0x1a882f);}};}function respondWithFilteredResult(_0x2e8e3a,_0x580ff9){return function(_0x191cc5){if(_0x191cc5){var _0x2a5418=typeof _0x580ff9[_0x70d6('0x1a')]==='undefined'&&typeof _0x580ff9[_0x70d6('0x1b')]===_0x70d6('0x1c');var _0x476f0b=_0x191cc5['count'];var _0x50024d=_0x2a5418?0x0:_0x580ff9[_0x70d6('0x1a')];var _0x31a296=_0x2a5418?_0x191cc5[_0x70d6('0x1d')]:_0x580ff9[_0x70d6('0x1a')]+_0x580ff9[_0x70d6('0x1b')];var _0x3727f9;if(_0x31a296>=_0x476f0b){_0x31a296=_0x476f0b;_0x3727f9=0xc8;}else{_0x3727f9=0xce;}_0x2e8e3a[_0x70d6('0x18')](_0x3727f9);return _0x2e8e3a[_0x70d6('0x1e')](_0x70d6('0x1f'),_0x50024d+'-'+_0x31a296+'/'+_0x476f0b)[_0x70d6('0x19')](_0x191cc5);}return null;};}function patchUpdates(_0x313360){return function(_0x1265cf){try{jsonpatch[_0x70d6('0x20')](_0x1265cf,_0x313360,!![]);}catch(_0x1157c4){return BPromise[_0x70d6('0x21')](_0x1157c4);}return _0x1265cf[_0x70d6('0x22')]();};}function saveUpdates(_0x49f8f1,_0x1bf52c){return function(_0x42da7b){if(_0x42da7b){return _0x42da7b[_0x70d6('0x23')](_0x49f8f1)[_0x70d6('0x24')](function(_0x41eef1){return _0x41eef1;});}return null;};}function removeEntity(_0x510188,_0x1645fd){return function(_0x2bfba6){if(_0x2bfba6){return _0x2bfba6[_0x70d6('0x25')]()[_0x70d6('0x24')](function(){var _0x42ce68=_0x2bfba6[_0x70d6('0x26')]({'plain':!![]});var _0x47b657=_0x70d6('0x27');return db[_0x70d6('0x28')][_0x70d6('0x25')]({'where':{'type':_0x47b657,'resourceId':_0x42ce68['id']}})[_0x70d6('0x24')](function(){return _0x2bfba6;});})['then'](function(){_0x510188[_0x70d6('0x18')](0xcc)[_0x70d6('0x17')]();});}};}function handleEntityNotFound(_0x546fcd,_0x350573){return function(_0x194a90){if(!_0x194a90){_0x546fcd[_0x70d6('0x16')](0x194);}return _0x194a90;};}function handleError(_0x9edf6f,_0x67066b){_0x67066b=_0x67066b||0x1f4;return function(_0x353d3f){logger[_0x70d6('0x29')](_0x353d3f[_0x70d6('0x2a')]);if(_0x353d3f['name']){delete _0x353d3f[_0x70d6('0x2b')];}_0x9edf6f['status'](_0x67066b)[_0x70d6('0x2c')](_0x353d3f);};}function getMustacheRender(_0x4a75fc,_0x489d51){return Mustache[_0x70d6('0x2d')](_0x4a75fc,_[_0x70d6('0x2e')](_0x489d51['body'],{'contact':_0x489d51[_0x70d6('0x2f')],'message':_0x489d51[_0x70d6('0x30')],'agent':_0x489d51[_0x70d6('0x31')],'interaction':_0x489d51[_0x70d6('0x32')],'account':_0x489d51[_0x70d6('0x33')]}))||'';}exports[_0x70d6('0x34')]=function(_0x275465,_0x1d8ee1){var _0x153757={},_0xb4301f={},_0x32f808={'count':0x0,'rows':[]};var _0x554137=_[_0x70d6('0x35')](db[_0x70d6('0x36')]['rawAttributes'],function(_0x44143b){return{'name':_0x44143b[_0x70d6('0x37')],'type':_0x44143b[_0x70d6('0x38')][_0x70d6('0x39')]};});_0xb4301f[_0x70d6('0x3a')]=_[_0x70d6('0x35')](_0x554137,_0x70d6('0x2b'));_0xb4301f[_0x70d6('0x3b')]=_['keys'](_0x275465[_0x70d6('0x3b')]);_0xb4301f['filters']=_[_0x70d6('0x3c')](_0xb4301f[_0x70d6('0x3a')],_0xb4301f['query']);_0x153757[_0x70d6('0x3d')]=_[_0x70d6('0x3c')](_0xb4301f[_0x70d6('0x3a')],qs[_0x70d6('0x3e')](_0x275465[_0x70d6('0x3b')][_0x70d6('0x3e')]));_0x153757['attributes']=_0x153757[_0x70d6('0x3d')]['length']?_0x153757[_0x70d6('0x3d')]:_0xb4301f[_0x70d6('0x3a')];if(!_0x275465[_0x70d6('0x3b')]['hasOwnProperty']('nolimit')){_0x153757[_0x70d6('0x1b')]=qs[_0x70d6('0x1b')](_0x275465[_0x70d6('0x3b')][_0x70d6('0x1b')]);_0x153757['offset']=qs[_0x70d6('0x1a')](_0x275465['query'][_0x70d6('0x1a')]);}_0x153757[_0x70d6('0x3f')]=qs[_0x70d6('0x40')](_0x275465[_0x70d6('0x3b')]['sort']);_0x153757[_0x70d6('0x41')]=qs[_0x70d6('0x42')](_['pick'](_0x275465[_0x70d6('0x3b')],_0xb4301f[_0x70d6('0x42')]),_0x554137);if(_0x275465['query'][_0x70d6('0x43')]){_0x153757[_0x70d6('0x41')]=_[_0x70d6('0x2e')](_0x153757[_0x70d6('0x41')],{'$or':_['map'](_0x554137,function(_0x5187bd){if(_0x5187bd['type']!==_0x70d6('0x44')){var _0x58c114={};_0x58c114[_0x5187bd[_0x70d6('0x2b')]]={'$like':'%'+_0x275465[_0x70d6('0x3b')]['filter']+'%'};return _0x58c114;}})});}_0x153757=_[_0x70d6('0x2e')]({},_0x153757,_0x275465['options']);var _0x4c8617={'where':_0x153757[_0x70d6('0x41')]};return db[_0x70d6('0x36')][_0x70d6('0x1d')](_0x4c8617)[_0x70d6('0x24')](function(_0x946ffc){_0x32f808['count']=_0x946ffc;if(_0x275465[_0x70d6('0x3b')]['includeAll']){_0x153757[_0x70d6('0x45')]=[{'all':!![]}];}return db[_0x70d6('0x36')][_0x70d6('0x46')](_0x153757);})[_0x70d6('0x24')](function(_0x2a1cd9){_0x32f808[_0x70d6('0x47')]=_0x2a1cd9;return _0x32f808;})[_0x70d6('0x24')](respondWithFilteredResult(_0x1d8ee1,_0x153757))[_0x70d6('0x48')](handleError(_0x1d8ee1,null));};exports[_0x70d6('0x49')]=function(_0x21de8e,_0x3bb2dc){var _0x3d555e={'raw':!![],'where':{'id':_0x21de8e[_0x70d6('0x4a')]['id']}},_0x116d6c={};_0x116d6c[_0x70d6('0x3a')]=_['keys'](db[_0x70d6('0x36')][_0x70d6('0x4b')]);_0x116d6c[_0x70d6('0x3b')]=_[_0x70d6('0x4c')](_0x21de8e[_0x70d6('0x3b')]);_0x116d6c[_0x70d6('0x42')]=_[_0x70d6('0x3c')](_0x116d6c[_0x70d6('0x3a')],_0x116d6c[_0x70d6('0x3b')]);_0x3d555e[_0x70d6('0x3d')]=_['intersection'](_0x116d6c[_0x70d6('0x3a')],qs[_0x70d6('0x3e')](_0x21de8e[_0x70d6('0x3b')]['fields']));_0x3d555e[_0x70d6('0x3d')]=_0x3d555e[_0x70d6('0x3d')][_0x70d6('0x4d')]?_0x3d555e[_0x70d6('0x3d')]:_0x116d6c['model'];if(_0x21de8e[_0x70d6('0x3b')][_0x70d6('0x4e')]){_0x3d555e[_0x70d6('0x45')]=[{'all':!![]}];}_0x3d555e=_['merge']({},_0x3d555e,_0x21de8e[_0x70d6('0x4f')]);return db[_0x70d6('0x36')][_0x70d6('0x50')](_0x3d555e)[_0x70d6('0x24')](handleEntityNotFound(_0x3bb2dc,null))[_0x70d6('0x24')](respondWithResult(_0x3bb2dc,null))['catch'](handleError(_0x3bb2dc,null));};exports[_0x70d6('0x51')]=function(_0x57f283,_0xd4116d){return db[_0x70d6('0x36')][_0x70d6('0x51')](_0x57f283[_0x70d6('0x52')],{})[_0x70d6('0x24')](function(_0x1d36d2){var _0x1842db=_0x57f283[_0x70d6('0x53')]['get']({'plain':!![]});if(!_0x1842db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1842db['role']===_0x70d6('0x53')){var _0x25c61b=_0x1d36d2['get']({'plain':!![]});var _0x353e62='CmContactHasPhones';return db[_0x70d6('0x54')][_0x70d6('0x50')]({'where':{'name':_0x353e62,'userProfileId':_0x1842db[_0x70d6('0x55')]},'raw':!![]})[_0x70d6('0x24')](function(_0x1f65fc){if(_0x1f65fc&&_0x1f65fc[_0x70d6('0x56')]===0x0){return db[_0x70d6('0x28')][_0x70d6('0x51')]({'name':_0x25c61b[_0x70d6('0x2b')],'resourceId':_0x25c61b['id'],'type':_0x1f65fc['name'],'sectionId':_0x1f65fc['id']},{})[_0x70d6('0x24')](function(){return _0x1d36d2;});}else{return _0x1d36d2;}})['catch'](function(_0x5a2fc6){logger[_0x70d6('0x29')](_0x70d6('0x57'),_0x5a2fc6);throw _0x5a2fc6;});}return _0x1d36d2;})[_0x70d6('0x24')](respondWithResult(_0xd4116d,0xc9))['catch'](handleError(_0xd4116d,null));};exports[_0x70d6('0x23')]=function(_0x43fd33,_0x2864d3){if(_0x43fd33['body']['id']){delete _0x43fd33[_0x70d6('0x52')]['id'];}return db['CmContactHasPhone'][_0x70d6('0x50')]({'where':{'id':_0x43fd33[_0x70d6('0x4a')]['id']}})[_0x70d6('0x24')](handleEntityNotFound(_0x2864d3,null))['then'](saveUpdates(_0x43fd33['body'],null))[_0x70d6('0x24')](respondWithResult(_0x2864d3,null))[_0x70d6('0x48')](handleError(_0x2864d3,null));};exports[_0x70d6('0x25')]=function(_0x3c31a2,_0x2fae8c){return db[_0x70d6('0x36')][_0x70d6('0x50')]({'where':{'id':_0x3c31a2[_0x70d6('0x4a')]['id']}})[_0x70d6('0x24')](handleEntityNotFound(_0x2fae8c,null))[_0x70d6('0x24')](removeEntity(_0x2fae8c,null))[_0x70d6('0x48')](handleError(_0x2fae8c,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 59b3b12..61a1845 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.model.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68de=['moment','bluebird','request-promise','path','../../config/environment','./cmContactHasPhone.attributes','exports','CmContactHasPhone','lodash','util','../../config/logger'];(function(_0x1242cb,_0xe85745){var _0x10768c=function(_0x4980d9){while(--_0x4980d9){_0x1242cb['push'](_0x1242cb['shift']());}};_0x10768c(++_0xe85745);}(_0x68de,0xfa));var _0xe68d=function(_0x10791d,_0x2562b6){_0x10791d=_0x10791d-0x0;var _0x1b4f9c=_0x68de[_0x10791d];return _0x1b4f9c;};'use strict';var _=require(_0xe68d('0x0'));var util=require(_0xe68d('0x1'));var logger=require(_0xe68d('0x2'))('api');var moment=require(_0xe68d('0x3'));var BPromise=require(_0xe68d('0x4'));var rp=require(_0xe68d('0x5'));var fs=require('fs');var path=require(_0xe68d('0x6'));var rimraf=require('rimraf');var config=require(_0xe68d('0x7'));var attributes=require(_0xe68d('0x8'));module[_0xe68d('0x9')]=function(_0x21fb14,_0x170c82){return _0x21fb14['define'](_0xe68d('0xa'),attributes,{'tableName':'cm_contact_has_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50e3=['util','api','moment','bluebird','path','rimraf','exports','CmContactHasPhone','cm_contact_has_phones'];(function(_0x17a32f,_0x5a51a){var _0x15a293=function(_0x55fbd3){while(--_0x55fbd3){_0x17a32f['push'](_0x17a32f['shift']());}};_0x15a293(++_0x5a51a);}(_0x50e3,0xea));var _0x350e=function(_0xbf2339,_0x127f98){_0xbf2339=_0xbf2339-0x0;var _0x2d34a2=_0x50e3[_0xbf2339];return _0x2d34a2;};'use strict';var _=require('lodash');var util=require(_0x350e('0x0'));var logger=require('../../config/logger')(_0x350e('0x1'));var moment=require(_0x350e('0x2'));var BPromise=require(_0x350e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x350e('0x4'));var rimraf=require(_0x350e('0x5'));var config=require('../../config/environment');var attributes=require('./cmContactHasPhone.attributes');module[_0x350e('0x6')]=function(_0x4cc5be,_0x29d3c9){return _0x4cc5be['define'](_0x350e('0x7'),attributes,{'tableName':_0x350e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index e3b1a48..b921f25 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3330=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s'];(function(_0x4fd9cb,_0x328bca){var _0x405cca=function(_0x2e0421){while(--_0x2e0421){_0x4fd9cb['push'](_0x4fd9cb['shift']());}};_0x405cca(++_0x328bca);}(_0x3330,0x1b5));var _0x0333=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x3330[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x0333('0x0'));var util=require(_0x0333('0x1'));var moment=require(_0x0333('0x2'));var BPromise=require(_0x0333('0x3'));var rs=require(_0x0333('0x4'));var fs=require('fs');var Redis=require(_0x0333('0x5'));var db=require(_0x0333('0x6'))['db'];var utils=require(_0x0333('0x7'));var logger=require(_0x0333('0x8'))(_0x0333('0x9'));var config=require(_0x0333('0xa'));var jayson=require(_0x0333('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9dfcf2,_0x43de8b,_0x3d912d){return new BPromise(function(_0xe2b01b,_0x3af6d4){return client[_0x0333('0xc')](_0x9dfcf2,_0x3d912d)[_0x0333('0xd')](function(_0x439915){logger[_0x0333('0xe')](_0x0333('0xf'),_0x43de8b,_0x0333('0x10'));logger[_0x0333('0x11')](_0x0333('0x12'),_0x43de8b,_0x0333('0x10'),JSON[_0x0333('0x13')](_0x439915));if(_0x439915['error']){if(_0x439915[_0x0333('0x14')][_0x0333('0x15')]===0x1f4){logger['error'](_0x0333('0xf'),_0x43de8b,_0x439915['error']['message']);return _0x3af6d4(_0x439915[_0x0333('0x14')][_0x0333('0x16')]);}logger[_0x0333('0x14')](_0x0333('0xf'),_0x43de8b,_0x439915[_0x0333('0x14')]['message']);return _0xe2b01b(_0x439915['error'][_0x0333('0x16')]);}else{logger['info']('CmContactHasPhone,\x20%s,\x20%s',_0x43de8b,_0x0333('0x10'));_0xe2b01b(_0x439915[_0x0333('0x17')][_0x0333('0x16')]);}})['catch'](function(_0x3d537b){logger[_0x0333('0x14')](_0x0333('0xf'),_0x43de8b,_0x3d537b);_0x3af6d4(_0x3d537b);});});} \ No newline at end of file +var _0xda15=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmContactHasPhone,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils'];(function(_0x26e43d,_0x384011){var _0x3552a7=function(_0x44ca2d){while(--_0x44ca2d){_0x26e43d['push'](_0x26e43d['shift']());}};_0x3552a7(++_0x384011);}(_0xda15,0xf8));var _0x5da1=function(_0xc066e8,_0x4b4943){_0xc066e8=_0xc066e8-0x0;var _0x4ba074=_0xda15[_0xc066e8];return _0x4ba074;};'use strict';var _=require(_0x5da1('0x0'));var util=require('util');var moment=require(_0x5da1('0x1'));var BPromise=require(_0x5da1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5da1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5da1('0x4'));var logger=require(_0x5da1('0x5'))(_0x5da1('0x6'));var config=require(_0x5da1('0x7'));var jayson=require(_0x5da1('0x8'));var client=jayson[_0x5da1('0x9')][_0x5da1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe02369,_0x3ba713,_0x204a02){return new BPromise(function(_0x40e9e1,_0x889b67){return client[_0x5da1('0xb')](_0xe02369,_0x204a02)[_0x5da1('0xc')](function(_0x3ba1f5){logger[_0x5da1('0xd')]('CmContactHasPhone,\x20%s,\x20%s',_0x3ba713,_0x5da1('0xe'));logger[_0x5da1('0xf')]('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x3ba713,_0x5da1('0xe'),JSON[_0x5da1('0x10')](_0x3ba1f5));if(_0x3ba1f5['error']){if(_0x3ba1f5[_0x5da1('0x11')][_0x5da1('0x12')]===0x1f4){logger[_0x5da1('0x11')](_0x5da1('0x13'),_0x3ba713,_0x3ba1f5[_0x5da1('0x11')][_0x5da1('0x14')]);return _0x889b67(_0x3ba1f5[_0x5da1('0x11')][_0x5da1('0x14')]);}logger[_0x5da1('0x11')](_0x5da1('0x13'),_0x3ba713,_0x3ba1f5['error']['message']);return _0x40e9e1(_0x3ba1f5[_0x5da1('0x11')][_0x5da1('0x14')]);}else{logger[_0x5da1('0xd')](_0x5da1('0x13'),_0x3ba713,_0x5da1('0xe'));_0x40e9e1(_0x3ba1f5[_0x5da1('0x15')][_0x5da1('0x14')]);}})[_0x5da1('0x16')](function(_0x8440a7){logger['error'](_0x5da1('0x13'),_0x3ba713,_0x8440a7);_0x889b67(_0x8440a7);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 770ee1b..b7f3833 100644 --- a/server/api/cmContactHasPhone/index.js +++ b/server/api/cmContactHasPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95f4=['multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','index','show','post','isAuthenticated','put','/:id','delete','destroy','exports'];(function(_0x416cdc,_0x213b87){var _0x1931ce=function(_0x1dc762){while(--_0x1dc762){_0x416cdc['push'](_0x416cdc['shift']());}};_0x1931ce(++_0x213b87);}(_0x95f4,0xbe));var _0x495f=function(_0x536804,_0x4151f4){_0x536804=_0x536804-0x0;var _0x1cc065=_0x95f4[_0x536804];return _0x1cc065;};'use strict';var multer=require(_0x495f('0x0'));var util=require(_0x495f('0x1'));var path=require('path');var timeout=require(_0x495f('0x2'));var express=require(_0x495f('0x3'));var router=express[_0x495f('0x4')]();var fs_extra=require(_0x495f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x495f('0x6'));var config=require(_0x495f('0x7'));var controller=require(_0x495f('0x8'));router[_0x495f('0x9')]('/',auth['isAuthenticated'](),controller[_0x495f('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x495f('0xb')]);router[_0x495f('0xc')]('/',auth[_0x495f('0xd')](),controller['create']);router[_0x495f('0xe')](_0x495f('0xf'),auth[_0x495f('0xd')](),controller['update']);router[_0x495f('0x10')](_0x495f('0xf'),auth['isAuthenticated'](),controller[_0x495f('0x11')]);module[_0x495f('0x12')]=router; \ No newline at end of file +var _0xf736=['isAuthenticated','index','get','/:id','post','create','put','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmContactHasPhone.controller'];(function(_0xda6ad1,_0x5f09e3){var _0xedc3a5=function(_0x5459d7){while(--_0x5459d7){_0xda6ad1['push'](_0xda6ad1['shift']());}};_0xedc3a5(++_0x5f09e3);}(_0xf736,0x191));var _0x6f73=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf736[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x6f73('0x0'));var path=require(_0x6f73('0x1'));var timeout=require(_0x6f73('0x2'));var express=require('express');var router=express[_0x6f73('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6f73('0x4'));var interaction=require(_0x6f73('0x5'));var config=require('../../config/environment');var controller=require(_0x6f73('0x6'));router['get']('/',auth[_0x6f73('0x7')](),controller[_0x6f73('0x8')]);router[_0x6f73('0x9')](_0x6f73('0xa'),auth[_0x6f73('0x7')](),controller['show']);router[_0x6f73('0xb')]('/',auth[_0x6f73('0x7')](),controller[_0x6f73('0xc')]);router[_0x6f73('0xd')](_0x6f73('0xa'),auth[_0x6f73('0x7')](),controller[_0x6f73('0xe')]);router[_0x6f73('0xf')](_0x6f73('0xa'),auth[_0x6f73('0x7')](),controller['destroy']);module[_0x6f73('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index ea6f27e..26a5752 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 _0x80d9=['VIRTUAL','alias','STRING','setDataValue','getDataValue','type','select','parse','values','BOOLEAN','ENUM','voice','sequelize','exports'];(function(_0x139674,_0x1ca8d8){var _0x191caa=function(_0x10b31a){while(--_0x10b31a){_0x139674['push'](_0x139674['shift']());}};_0x191caa(++_0x1ca8d8);}(_0x80d9,0x15c));var _0x980d=function(_0x2c7c06,_0x5e9354){_0x2c7c06=_0x2c7c06-0x0;var _0x5cdcbb=_0x80d9[_0x2c7c06];return _0x5cdcbb;};'use strict';var Sequelize=require(_0x980d('0x0'));var _=require('lodash');module[_0x980d('0x1')]={'name':{'type':Sequelize[_0x980d('0x2')],'get':function(_0xac96e5){return this['getDataValue'](_0x980d('0x3'));}},'alias':{'type':Sequelize[_0x980d('0x4')],'allowNull':![],'set':function(_0x38d1b9){this[_0x980d('0x5')](_0x980d('0x3'),_0x38d1b9?_0x38d1b9:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x980d('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0x980d('0x6')](_0x980d('0x7'))===_0x980d('0x8')){return JSON[_0x980d('0x9')](this[_0x980d('0x6')](_0x980d('0xa')));}else{return this[_0x980d('0x6')]('values');}},'set':function(_0x55b479){if(Array['isArray'](_0x55b479)){this[_0x980d('0x5')](_0x980d('0xa'),JSON['stringify'](_0x55b479));}else{this[_0x980d('0x5')]('values',_0x55b479);}}},'required':{'type':Sequelize[_0x980d('0xb')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x980d('0xc')](_0x980d('0xd'))}}; \ No newline at end of file +var _0x0ef0=['sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','name','TEXT','type','select','parse','values','setDataValue','stringify','BOOLEAN','voice'];(function(_0x3f288d,_0x3c7a97){var _0x5e8468=function(_0xb0189c){while(--_0xb0189c){_0x3f288d['push'](_0x3f288d['shift']());}};_0x5e8468(++_0x3c7a97);}(_0x0ef0,0x80));var _0x00ef=function(_0xc68650,_0x258343){_0xc68650=_0xc68650-0x0;var _0x57bd40=_0x0ef0[_0xc68650];return _0x57bd40;};'use strict';var Sequelize=require(_0x00ef('0x0'));var _=require(_0x00ef('0x1'));module['exports']={'name':{'type':Sequelize[_0x00ef('0x2')],'get':function(_0x282cce){return this[_0x00ef('0x3')](_0x00ef('0x4'));}},'alias':{'type':Sequelize[_0x00ef('0x5')],'allowNull':![],'set':function(_0x92e0b){this['setDataValue']('alias',_0x92e0b?_0x92e0b:this[_0x00ef('0x3')](_0x00ef('0x6')));}},'type':{'type':Sequelize[_0x00ef('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x00ef('0x7')]('long'),'get':function(){if(this[_0x00ef('0x3')](_0x00ef('0x8'))===_0x00ef('0x9')){return JSON[_0x00ef('0xa')](this[_0x00ef('0x3')]('values'));}else{return this[_0x00ef('0x3')](_0x00ef('0xb'));}},'set':function(_0x2dce41){if(Array['isArray'](_0x2dce41)){this[_0x00ef('0xc')]('values',JSON[_0x00ef('0xd')](_0x2dce41));}else{this[_0x00ef('0xc')](_0x00ef('0xb'),_0x2dce41);}}},'required':{'type':Sequelize[_0x00ef('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x00ef('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x00ef('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 5d980c6..135fa77 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 _0x53ec=['name','send','body','contact','message','agent','interaction','account','index','map','rawAttributes','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','CmCustomField','includeAll','findAll','params','include','options','find','catch','update','destroy','create','sequelize','TEXT','type','text','Sequelize','number','INTEGER','BOOLEAN','queryInterface','cm_contacts','format','cf_%d','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','count','set','Content-Range','apply','reject','save','then','sendStatus'];(function(_0x35c5a8,_0x8ecb48){var _0x34782c=function(_0x1b23ec){while(--_0x1b23ec){_0x35c5a8['push'](_0x35c5a8['shift']());}};_0x34782c(++_0x8ecb48);}(_0x53ec,0x192));var _0xc53e=function(_0x2e655a,_0x6d5799){_0x2e655a=_0x2e655a-0x0;var _0x26f13b=_0x53ec[_0x2e655a];return _0x26f13b;};'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);};}function getMustacheRender(_0x4f203d,_0x24a77e){return Mustache['render'](_0x4f203d,_['merge'](_0x24a77e[_0xc53e('0x28')],{'contact':_0x24a77e[_0xc53e('0x29')],'message':_0x24a77e[_0xc53e('0x2a')],'agent':_0x24a77e[_0xc53e('0x2b')],'interaction':_0x24a77e[_0xc53e('0x2c')],'account':_0x24a77e[_0xc53e('0x2d')]}))||'';}exports[_0xc53e('0x2e')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x2f')](db['CmCustomField'][_0xc53e('0x30')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x31')]};});_0x311835[_0xc53e('0x32')]=_[_0xc53e('0x33')](_[_0xc53e('0x2f')](_0x56206b,_0xc53e('0x26')),[_0xc53e('0x26')]);_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9['query']);_0x311835[_0xc53e('0x36')]=_[_0xc53e('0x37')](_0x311835[_0xc53e('0x32')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x38')]=_[_0xc53e('0x37')](_0x311835[_0xc53e('0x32')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')]['fields']));_0x437893[_0xc53e('0x38')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893[_0xc53e('0x38')]:_0x311835['model'];if(!_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3b')](_0xc53e('0x3c'))){_0x437893['limit']=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);_0x437893[_0xc53e('0x1b')]=qs[_0xc53e('0x1b')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1b')]);}_0x437893['order']=qs[_0xc53e('0x3d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3d')]);_0x437893['where']=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835[_0xc53e('0x36')]),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3e')]){_0x437893[_0xc53e('0x3f')]=_['merge'](_0x437893[_0xc53e('0x3f')],{'$or':_[_0xc53e('0x2f')](_0x56206b,function(_0x4a5529){if(_0x4a5529['type']!=='VIRTUAL'){var _0x52cf0a={};_0x52cf0a[_0x4a5529[_0xc53e('0x26')]]={'$like':'%'+_0x2a2ca9[_0xc53e('0x34')]['filter']+'%'};return _0x52cf0a;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x55d07d={'where':_0x437893['where']};return db[_0xc53e('0x41')]['count'](_0x55d07d)['then'](function(_0x433a44){_0x2d36c0['count']=_0x433a44;if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x42')]){_0x437893['include']=[{'all':!![]}];}return db[_0xc53e('0x41')][_0xc53e('0x43')](_0x437893);})['then'](function(_0x2ebce7){_0x2d36c0['rows']=_0x2ebce7;return _0x2d36c0;})['then'](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x887d78,_0x17b586){var _0x3b2834={'raw':!![],'where':{'id':_0x887d78[_0xc53e('0x44')]['id']}},_0x5f1884={};_0x5f1884[_0xc53e('0x32')]=_['keys'](db['CmCustomField'][_0xc53e('0x30')]);_0x5f1884[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x887d78['query']);_0x5f1884[_0xc53e('0x36')]=_[_0xc53e('0x37')](_0x5f1884[_0xc53e('0x32')],_0x5f1884[_0xc53e('0x34')]);_0x3b2834[_0xc53e('0x38')]=_[_0xc53e('0x37')](_0x5f1884[_0xc53e('0x32')],qs['fields'](_0x887d78[_0xc53e('0x34')][_0xc53e('0x39')]));_0x3b2834[_0xc53e('0x38')]=_0x3b2834['attributes'][_0xc53e('0x3a')]?_0x3b2834[_0xc53e('0x38')]:_0x5f1884[_0xc53e('0x32')];if(_0x887d78[_0xc53e('0x34')][_0xc53e('0x42')]){_0x3b2834[_0xc53e('0x45')]=[{'all':!![]}];}_0x3b2834=_['merge']({},_0x3b2834,_0x887d78[_0xc53e('0x46')]);return db[_0xc53e('0x41')][_0xc53e('0x47')](_0x3b2834)['then'](handleEntityNotFound(_0x17b586,null))[_0xc53e('0x24')](respondWithResult(_0x17b586,null))[_0xc53e('0x48')](handleError(_0x17b586,null));};exports[_0xc53e('0x49')]=function(_0x3f81b8,_0x293f36){if(_0x3f81b8[_0xc53e('0x28')]['id']){delete _0x3f81b8[_0xc53e('0x28')]['id'];}return db[_0xc53e('0x41')][_0xc53e('0x47')]({'where':{'id':_0x3f81b8[_0xc53e('0x44')]['id']}})['then'](handleEntityNotFound(_0x293f36,null))[_0xc53e('0x24')](saveUpdates(_0x3f81b8[_0xc53e('0x28')],null))[_0xc53e('0x24')](respondWithResult(_0x293f36,null))[_0xc53e('0x48')](handleError(_0x293f36,null));};exports[_0xc53e('0x4a')]=function(_0x52dac7,_0x4dae60){return db[_0xc53e('0x41')]['find']({'where':{'id':_0x52dac7[_0xc53e('0x44')]['id']}})['then'](handleEntityNotFound(_0x4dae60,null))[_0xc53e('0x24')](removeEntity(_0x4dae60,null))[_0xc53e('0x48')](handleError(_0x4dae60,null));};exports[_0xc53e('0x4b')]=function(_0x55797f,_0x393611){var _0x10bebb;return db[_0xc53e('0x4c')]['transaction'](function(_0x2f7df2){return db['CmCustomField'][_0xc53e('0x4b')](_0x55797f[_0xc53e('0x28')],{'transaction':_0x2f7df2})['then'](function(_0x15a96a){_0x10bebb=_0x15a96a;var _0x1515ea={'type':db['Sequelize'][_0xc53e('0x4d')],'transaction':_0x2f7df2};switch(_0x55797f[_0xc53e('0x28')][_0xc53e('0x4e')]){case _0xc53e('0x4f'):_0x1515ea[_0xc53e('0x4e')]=db[_0xc53e('0x50')][_0xc53e('0x4d')];break;case _0xc53e('0x51'):_0x1515ea[_0xc53e('0x4e')]=db[_0xc53e('0x50')][_0xc53e('0x52')];break;case'switch':_0x1515ea[_0xc53e('0x4e')]=db['Sequelize'][_0xc53e('0x53')];_0x1515ea['defaultValue']=![];break;default:}return db[_0xc53e('0x4c')][_0xc53e('0x54')]['addColumn'](_0xc53e('0x55'),util[_0xc53e('0x56')](_0xc53e('0x57'),_0x10bebb['id']),_0x1515ea);})[_0xc53e('0x24')](function(){return _0x10bebb;});})['then'](respondWithResult(_0x393611,0xc9))[_0xc53e('0x48')](handleError(_0x393611,null));}; \ No newline at end of file +var _0x31f0=['cf_%d','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','then','stack','name','send','render','merge','body','message','agent','interaction','account','index','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','sequelize','transaction','Sequelize','TEXT','text','INTEGER','queryInterface','cm_contacts','format'];(function(_0x4bb429,_0x4c1363){var _0x4a824b=function(_0x57c840){while(--_0x57c840){_0x4bb429['push'](_0x4bb429['shift']());}};_0x4a824b(++_0x4c1363);}(_0x31f0,0xb7));var _0x031f=function(_0x3e5dcc,_0x54a7a6){_0x3e5dcc=_0x3e5dcc-0x0;var _0x37eecc=_0x31f0[_0x3e5dcc];return _0x37eecc;};'use strict';var emlformat=require(_0x031f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var util=require('util');var path=require(_0x031f('0x6'));var sox=require(_0x031f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];function respondWithStatusCode(_0x351052,_0x3819bb){_0x3819bb=_0x3819bb||0xcc;return function(_0x405896){if(_0x405896){return _0x351052[_0x031f('0x18')](_0x3819bb);}return _0x351052['status'](_0x3819bb)[_0x031f('0x19')]();};}function respondWithResult(_0x23b40c,_0x17a699){_0x17a699=_0x17a699||0xc8;return function(_0x2e3dfe){if(_0x2e3dfe){return _0x23b40c[_0x031f('0x1a')](_0x17a699)['json'](_0x2e3dfe);}};}function respondWithFilteredResult(_0x4b7011,_0x1f08db){return function(_0x3a10aa){if(_0x3a10aa){var _0xe4fc1d=typeof _0x1f08db[_0x031f('0x1b')]==='undefined'&&typeof _0x1f08db[_0x031f('0x1c')]===_0x031f('0x1d');var _0x5d0c70=_0x3a10aa[_0x031f('0x1e')];var _0x535e70=_0xe4fc1d?0x0:_0x1f08db[_0x031f('0x1b')];var _0x5f2199=_0xe4fc1d?_0x3a10aa[_0x031f('0x1e')]:_0x1f08db[_0x031f('0x1b')]+_0x1f08db[_0x031f('0x1c')];var _0x26cb5e;if(_0x5f2199>=_0x5d0c70){_0x5f2199=_0x5d0c70;_0x26cb5e=0xc8;}else{_0x26cb5e=0xce;}_0x4b7011[_0x031f('0x1a')](_0x26cb5e);return _0x4b7011[_0x031f('0x1f')](_0x031f('0x20'),_0x535e70+'-'+_0x5f2199+'/'+_0x5d0c70)[_0x031f('0x21')](_0x3a10aa);}return null;};}function patchUpdates(_0x29dd6e){return function(_0x48a76e){try{jsonpatch[_0x031f('0x22')](_0x48a76e,_0x29dd6e,!![]);}catch(_0x33926c){return BPromise[_0x031f('0x23')](_0x33926c);}return _0x48a76e['save']();};}function saveUpdates(_0x5c4184,_0xa11a2b){return function(_0x4d0f92){if(_0x4d0f92){return _0x4d0f92[_0x031f('0x24')](_0x5c4184)['then'](function(_0x54d054){return _0x54d054;});}return null;};}function removeEntity(_0x47d639,_0x971691){return function(_0x12c406){if(_0x12c406){return _0x12c406[_0x031f('0x25')]()[_0x031f('0x26')](function(){_0x47d639['status'](0xcc)[_0x031f('0x19')]();});}};}function handleEntityNotFound(_0x5a64c0,_0x40cb1c){return function(_0x1f5a14){if(!_0x1f5a14){_0x5a64c0[_0x031f('0x18')](0x194);}return _0x1f5a14;};}function handleError(_0x567666,_0x35af16){_0x35af16=_0x35af16||0x1f4;return function(_0x3b2a51){logger['error'](_0x3b2a51[_0x031f('0x27')]);if(_0x3b2a51[_0x031f('0x28')]){delete _0x3b2a51[_0x031f('0x28')];}_0x567666['status'](_0x35af16)[_0x031f('0x29')](_0x3b2a51);};}function getMustacheRender(_0x114e34,_0xb6ed6c){return Mustache[_0x031f('0x2a')](_0x114e34,_[_0x031f('0x2b')](_0xb6ed6c[_0x031f('0x2c')],{'contact':_0xb6ed6c['contact'],'message':_0xb6ed6c[_0x031f('0x2d')],'agent':_0xb6ed6c[_0x031f('0x2e')],'interaction':_0xb6ed6c[_0x031f('0x2f')],'account':_0xb6ed6c[_0x031f('0x30')]}))||'';}exports[_0x031f('0x31')]=function(_0x2d24f0,_0x378692){var _0x87dc07={},_0x2034ac={},_0xfc4a89={'count':0x0,'rows':[]};var _0x2cf3a8=_['map'](db[_0x031f('0x32')][_0x031f('0x33')],function(_0xb3a6bd){return{'name':_0xb3a6bd[_0x031f('0x34')],'type':_0xb3a6bd[_0x031f('0x35')][_0x031f('0x36')]};});_0x2034ac[_0x031f('0x37')]=_[_0x031f('0x38')](_[_0x031f('0x39')](_0x2cf3a8,_0x031f('0x28')),[_0x031f('0x28')]);_0x2034ac[_0x031f('0x3a')]=_[_0x031f('0x3b')](_0x2d24f0['query']);_0x2034ac[_0x031f('0x3c')]=_[_0x031f('0x3d')](_0x2034ac['model'],_0x2034ac[_0x031f('0x3a')]);_0x87dc07[_0x031f('0x3e')]=_['intersection'](_0x2034ac[_0x031f('0x37')],qs[_0x031f('0x3f')](_0x2d24f0[_0x031f('0x3a')][_0x031f('0x3f')]));_0x87dc07['attributes']=_0x87dc07['attributes'][_0x031f('0x40')]?_0x87dc07['attributes']:_0x2034ac[_0x031f('0x37')];if(!_0x2d24f0[_0x031f('0x3a')][_0x031f('0x41')]('nolimit')){_0x87dc07['limit']=qs[_0x031f('0x1c')](_0x2d24f0['query']['limit']);_0x87dc07[_0x031f('0x1b')]=qs[_0x031f('0x1b')](_0x2d24f0[_0x031f('0x3a')][_0x031f('0x1b')]);}_0x87dc07[_0x031f('0x42')]=qs[_0x031f('0x43')](_0x2d24f0[_0x031f('0x3a')]['sort']);_0x87dc07[_0x031f('0x44')]=qs[_0x031f('0x3c')](_[_0x031f('0x45')](_0x2d24f0[_0x031f('0x3a')],_0x2034ac['filters']),_0x2cf3a8);if(_0x2d24f0[_0x031f('0x3a')][_0x031f('0x46')]){_0x87dc07[_0x031f('0x44')]=_['merge'](_0x87dc07[_0x031f('0x44')],{'$or':_[_0x031f('0x39')](_0x2cf3a8,function(_0x5d6826){if(_0x5d6826[_0x031f('0x35')]!==_0x031f('0x47')){var _0x56a8f3={};_0x56a8f3[_0x5d6826['name']]={'$like':'%'+_0x2d24f0[_0x031f('0x3a')][_0x031f('0x46')]+'%'};return _0x56a8f3;}})});}_0x87dc07=_[_0x031f('0x2b')]({},_0x87dc07,_0x2d24f0[_0x031f('0x48')]);var _0x2691b7={'where':_0x87dc07[_0x031f('0x44')]};return db[_0x031f('0x32')]['count'](_0x2691b7)[_0x031f('0x26')](function(_0xe71615){_0xfc4a89['count']=_0xe71615;if(_0x2d24f0[_0x031f('0x3a')]['includeAll']){_0x87dc07[_0x031f('0x49')]=[{'all':!![]}];}return db[_0x031f('0x32')]['findAll'](_0x87dc07);})[_0x031f('0x26')](function(_0x391cd1){_0xfc4a89[_0x031f('0x4a')]=_0x391cd1;return _0xfc4a89;})['then'](respondWithFilteredResult(_0x378692,_0x87dc07))[_0x031f('0x4b')](handleError(_0x378692,null));};exports[_0x031f('0x4c')]=function(_0x1d3324,_0x2a6cba){var _0x177306={'raw':!![],'where':{'id':_0x1d3324[_0x031f('0x4d')]['id']}},_0x193b8f={};_0x193b8f[_0x031f('0x37')]=_[_0x031f('0x3b')](db['CmCustomField'][_0x031f('0x33')]);_0x193b8f[_0x031f('0x3a')]=_[_0x031f('0x3b')](_0x1d3324[_0x031f('0x3a')]);_0x193b8f[_0x031f('0x3c')]=_[_0x031f('0x3d')](_0x193b8f[_0x031f('0x37')],_0x193b8f[_0x031f('0x3a')]);_0x177306[_0x031f('0x3e')]=_['intersection'](_0x193b8f[_0x031f('0x37')],qs['fields'](_0x1d3324['query'][_0x031f('0x3f')]));_0x177306[_0x031f('0x3e')]=_0x177306[_0x031f('0x3e')][_0x031f('0x40')]?_0x177306[_0x031f('0x3e')]:_0x193b8f['model'];if(_0x1d3324[_0x031f('0x3a')][_0x031f('0x4e')]){_0x177306[_0x031f('0x49')]=[{'all':!![]}];}_0x177306=_['merge']({},_0x177306,_0x1d3324[_0x031f('0x48')]);return db[_0x031f('0x32')][_0x031f('0x4f')](_0x177306)[_0x031f('0x26')](handleEntityNotFound(_0x2a6cba,null))[_0x031f('0x26')](respondWithResult(_0x2a6cba,null))[_0x031f('0x4b')](handleError(_0x2a6cba,null));};exports['update']=function(_0x569d8f,_0xd28ade){if(_0x569d8f['body']['id']){delete _0x569d8f[_0x031f('0x2c')]['id'];}return db[_0x031f('0x32')]['find']({'where':{'id':_0x569d8f[_0x031f('0x4d')]['id']}})['then'](handleEntityNotFound(_0xd28ade,null))['then'](saveUpdates(_0x569d8f[_0x031f('0x2c')],null))['then'](respondWithResult(_0xd28ade,null))[_0x031f('0x4b')](handleError(_0xd28ade,null));};exports['destroy']=function(_0x11bf43,_0x2137c3){return db['CmCustomField'][_0x031f('0x4f')]({'where':{'id':_0x11bf43[_0x031f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2137c3,null))[_0x031f('0x26')](removeEntity(_0x2137c3,null))['catch'](handleError(_0x2137c3,null));};exports[_0x031f('0x50')]=function(_0x5e18f0,_0x1464df){var _0x24848b;return db[_0x031f('0x51')][_0x031f('0x52')](function(_0x691a68){return db['CmCustomField'][_0x031f('0x50')](_0x5e18f0['body'],{'transaction':_0x691a68})[_0x031f('0x26')](function(_0x414350){_0x24848b=_0x414350;var _0x4d49f8={'type':db[_0x031f('0x53')][_0x031f('0x54')],'transaction':_0x691a68};switch(_0x5e18f0['body'][_0x031f('0x35')]){case _0x031f('0x55'):_0x4d49f8[_0x031f('0x35')]=db['Sequelize'][_0x031f('0x54')];break;case'number':_0x4d49f8[_0x031f('0x35')]=db['Sequelize'][_0x031f('0x56')];break;case'switch':_0x4d49f8[_0x031f('0x35')]=db[_0x031f('0x53')]['BOOLEAN'];_0x4d49f8['defaultValue']=![];break;default:}return db[_0x031f('0x51')][_0x031f('0x57')]['addColumn'](_0x031f('0x58'),util[_0x031f('0x59')](_0x031f('0x5a'),_0x24848b['id']),_0x4d49f8);})[_0x031f('0x26')](function(){return _0x24848b;});})[_0x031f('0x26')](respondWithResult(_0x1464df,0xc9))[_0x031f('0x4b')](handleError(_0x1464df,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 9a81106..02f6411 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 _0xdc40=['../../config/logger','api','moment','bluebird','request-promise','path','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','util'];(function(_0x33ac6b,_0x1ed895){var _0x34cffe=function(_0x17d762){while(--_0x17d762){_0x33ac6b['push'](_0x33ac6b['shift']());}};_0x34cffe(++_0x1ed895);}(_0xdc40,0x1bb));var _0x0dc4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdc40[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x0dc4('0x0'));var logger=require(_0x0dc4('0x1'))(_0x0dc4('0x2'));var moment=require(_0x0dc4('0x3'));var BPromise=require(_0x0dc4('0x4'));var rp=require(_0x0dc4('0x5'));var fs=require('fs');var path=require(_0x0dc4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0dc4('0x7'));module[_0x0dc4('0x8')]=function(_0x580556,_0x9cea06){return _0x580556[_0x0dc4('0x9')](_0x0dc4('0xa'),attributes,{'tableName':_0x0dc4('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x564d=['define','CmCustomField','util','../../config/logger','moment','bluebird','path','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x208f9d,_0x3c5881){var _0x200fb3=function(_0x4ae500){while(--_0x4ae500){_0x208f9d['push'](_0x208f9d['shift']());}};_0x200fb3(++_0x3c5881);}(_0x564d,0x66));var _0xd564=function(_0x545731,_0x1b9f4e){_0x545731=_0x545731-0x0;var _0x2e3b57=_0x564d[_0x545731];return _0x2e3b57;};'use strict';var _=require('lodash');var util=require(_0xd564('0x0'));var logger=require(_0xd564('0x1'))('api');var moment=require(_0xd564('0x2'));var BPromise=require(_0xd564('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd564('0x4'));var rimraf=require('rimraf');var config=require(_0xd564('0x5'));var attributes=require(_0xd564('0x6'));module[_0xd564('0x7')]=function(_0x15592f,_0x460fb3){return _0x15592f[_0xd564('0x8')](_0xd564('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 343c0f5..88548bd 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 _0x8ce3=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird'];(function(_0x127f61,_0x858956){var _0xf89d0c=function(_0x3a4815){while(--_0x3a4815){_0x127f61['push'](_0x127f61['shift']());}};_0xf89d0c(++_0x858956);}(_0x8ce3,0xc3));var _0x38ce=function(_0x490c02,_0x2faa1b){_0x490c02=_0x490c02-0x0;var _0x4604ab=_0x8ce3[_0x490c02];return _0x4604ab;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var moment=require('moment');var BPromise=require(_0x38ce('0x2'));var rs=require(_0x38ce('0x3'));var fs=require('fs');var Redis=require(_0x38ce('0x4'));var db=require(_0x38ce('0x5'))['db'];var utils=require(_0x38ce('0x6'));var logger=require(_0x38ce('0x7'))(_0x38ce('0x8'));var config=require(_0x38ce('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x38ce('0xa')][_0x38ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58074c,_0x262b13,_0xbe7332){return new BPromise(function(_0x3f8011,_0x482955){return client[_0x38ce('0xc')](_0x58074c,_0xbe7332)['then'](function(_0x725d27){logger['info'](_0x38ce('0xd'),_0x262b13,_0x38ce('0xe'));logger[_0x38ce('0xf')](_0x38ce('0x10'),_0x262b13,_0x38ce('0xe'),JSON[_0x38ce('0x11')](_0x725d27));if(_0x725d27[_0x38ce('0x12')]){if(_0x725d27[_0x38ce('0x12')][_0x38ce('0x13')]===0x1f4){logger[_0x38ce('0x12')](_0x38ce('0xd'),_0x262b13,_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);return _0x482955(_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);}logger[_0x38ce('0x12')]('CmCustomField,\x20%s,\x20%s',_0x262b13,_0x725d27['error'][_0x38ce('0x14')]);return _0x3f8011(_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);}else{logger['info'](_0x38ce('0xd'),_0x262b13,'request\x20sent');_0x3f8011(_0x725d27[_0x38ce('0x15')][_0x38ce('0x14')]);}})['catch'](function(_0x5fc115){logger[_0x38ce('0x12')](_0x38ce('0xd'),_0x262b13,_0x5fc115);_0x482955(_0x5fc115);});});} \ No newline at end of file +var _0x984b=['CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','then','info'];(function(_0x1250e9,_0x1a05f8){var _0x41756c=function(_0xb64c9d){while(--_0xb64c9d){_0x1250e9['push'](_0x1250e9['shift']());}};_0x41756c(++_0x1a05f8);}(_0x984b,0xee));var _0xb984=function(_0x493309,_0x1a94a4){_0x493309=_0x493309-0x0;var _0x1e705b=_0x984b[_0x493309];return _0x1e705b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 1339b1f..a49befc 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 _0xc145=['destroy','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','/:id','show','post','create','put','delete'];(function(_0x257a53,_0x45f592){var _0x2601bc=function(_0x1e3692){while(--_0x1e3692){_0x257a53['push'](_0x257a53['shift']());}};_0x2601bc(++_0x45f592);}(_0xc145,0x181));var _0x5c14=function(_0xa050c0,_0xe6e3b8){_0xa050c0=_0xa050c0-0x0;var _0x3440c1=_0xc145[_0xa050c0];return _0x3440c1;};'use strict';var multer=require(_0x5c14('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5c14('0x1'));var express=require('express');var router=express[_0x5c14('0x2')]();var fs_extra=require(_0x5c14('0x3'));var auth=require(_0x5c14('0x4'));var interaction=require(_0x5c14('0x5'));var config=require('../../config/environment');var controller=require(_0x5c14('0x6'));router[_0x5c14('0x7')]('/',auth[_0x5c14('0x8')](),controller['index']);router[_0x5c14('0x7')](_0x5c14('0x9'),auth['isAuthenticated'](),controller[_0x5c14('0xa')]);router[_0x5c14('0xb')]('/',auth[_0x5c14('0x8')](),controller[_0x5c14('0xc')]);router[_0x5c14('0xd')](_0x5c14('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x5c14('0xe')](_0x5c14('0x9'),auth['isAuthenticated'](),controller[_0x5c14('0xf')]);module['exports']=router; \ No newline at end of file +var _0x58c1=['index','show','post','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated'];(function(_0x4640bc,_0x444c26){var _0x3cafa0=function(_0xf24e13){while(--_0xf24e13){_0x4640bc['push'](_0x4640bc['shift']());}};_0x3cafa0(++_0x444c26);}(_0x58c1,0x1e4));var _0x158c=function(_0x3ac90d,_0x55da04){_0x3ac90d=_0x3ac90d-0x0;var _0x1b8acf=_0x58c1[_0x3ac90d];return _0x1b8acf;};'use strict';var multer=require(_0x158c('0x0'));var util=require(_0x158c('0x1'));var path=require(_0x158c('0x2'));var timeout=require('connect-timeout');var express=require(_0x158c('0x3'));var router=express[_0x158c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x158c('0x5'));var config=require(_0x158c('0x6'));var controller=require(_0x158c('0x7'));router[_0x158c('0x8')]('/',auth[_0x158c('0x9')](),controller[_0x158c('0xa')]);router[_0x158c('0x8')]('/:id',auth[_0x158c('0x9')](),controller[_0x158c('0xb')]);router[_0x158c('0xc')]('/',auth[_0x158c('0x9')](),controller['create']);router[_0x158c('0xd')]('/:id',auth[_0x158c('0x9')](),controller[_0x158c('0xe')]);router[_0x158c('0xf')](_0x158c('0x10'),auth['isAuthenticated'](),controller[_0x158c('0x11')]);module[_0x158c('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index b93f4ca..25e3ad9 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 _0x3eea=['STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','exports'];(function(_0x1dd7c6,_0xa28998){var _0x4c462d=function(_0x4a17c6){while(--_0x4a17c6){_0x1dd7c6['push'](_0x1dd7c6['shift']());}};_0x4c462d(++_0xa28998);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x4ecf63,_0x18c0ee){_0x4ecf63=_0x4ecf63-0x0;var _0x5644df=_0x3eea[_0x4ecf63];return _0x5644df;};'use strict';var moment=require(_0xa3ee('0x0'));var Sequelize=require('sequelize');module[_0xa3ee('0x1')]={'phone':{'type':Sequelize[_0xa3ee('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xa3ee('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa3ee('0x4')],'defaultValue':moment()[_0xa3ee('0x5')](_0xa3ee('0x6'))},'countbusyretry':{'type':Sequelize[_0xa3ee('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa3ee('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa3ee('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa3ee('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa3ee('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xa3ee('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa3ee('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xa3ee('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xa3ee('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa3ee('0x9')},'CampaignId':{'type':Sequelize[_0xa3ee('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xa3ee('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa3ee('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa3ee('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xabce=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xabce,0x103));var _0xeabc=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xabce[_0x47a7d0];return _0xb9bd08;};'use strict';var moment=require(_0xeabc('0x0'));var Sequelize=require(_0xeabc('0x1'));module[_0xeabc('0x2')]={'phone':{'type':Sequelize[_0xeabc('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xeabc('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xeabc('0x5'))},'countbusyretry':{'type':Sequelize[_0xeabc('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xeabc('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xeabc('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xeabc('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xeabc('0x6')],'unique':_0xeabc('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xeabc('0x7')},'UserId':{'type':Sequelize[_0xeabc('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xeabc('0x6')],'unique':_0xeabc('0x7')},'CampaignId':{'type':Sequelize[_0xeabc('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xeabc('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xeabc('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xeabc('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xeabc('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xeabc('0x6')],'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 af88fd0..a3c39ad 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 _0xcddd=['finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','sequelize','transaction','format','direction','hopperIds','ASC','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','render','merge','body','contact','message','agent','account','index','CmHopper','rawAttributes','fieldName','model','map','query','keys','filters','intersection','concat','$and','$lte','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$contains','$contained','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','options','includeAll','rows','catch','show','params','include','find','create','describe','CampaignId','VoiceQueueId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','user','UserId','deleted','deletedat','YYYY-MM-DD\x20HH:mm:ss','campaigntype','ivr','CmContact','ContactId','lastName','isNil','calleridname','firstName'];(function(_0xcfe0ed,_0x3feab1){var _0x15bdec=function(_0x2a884d){while(--_0x2a884d){_0xcfe0ed['push'](_0xcfe0ed['shift']());}};_0x15bdec(++_0x3feab1);}(_0xcddd,0x1d2));var _0xdcdd=function(_0xd19ac9,_0x1f118f){_0xd19ac9=_0xd19ac9-0x0;var _0x3b3e6=_0xcddd[_0xd19ac9];return _0x3b3e6;};'use strict';var emlformat=require(_0xdcdd('0x0'));var rimraf=require(_0xdcdd('0x1'));var zipdir=require(_0xdcdd('0x2'));var jsonpatch=require(_0xdcdd('0x3'));var rp=require(_0xdcdd('0x4'));var moment=require('moment');var BPromise=require(_0xdcdd('0x5'));var Mustache=require('mustache');var util=require(_0xdcdd('0x6'));var path=require(_0xdcdd('0x7'));var sox=require('sox');var csv=require(_0xdcdd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdcdd('0x9'));var _=require(_0xdcdd('0xa'));var squel=require(_0xdcdd('0xb'));var crypto=require(_0xdcdd('0xc'));var jsforce=require(_0xdcdd('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdcdd('0xe'));var Papa=require(_0xdcdd('0xf'));var Redis=require(_0xdcdd('0x10'));var authService=require(_0xdcdd('0x11'));var qs=require(_0xdcdd('0x12'));var as=require(_0xdcdd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdcdd('0x14'))(_0xdcdd('0x15'));var utils=require(_0xdcdd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdcdd('0x17'));var db=require(_0xdcdd('0x18'))['db'];function respondWithStatusCode(_0x1e5e14,_0x48ea4a){_0x48ea4a=_0x48ea4a||0xcc;return function(_0x217791){if(_0x217791){return _0x1e5e14[_0xdcdd('0x19')](_0x48ea4a);}return _0x1e5e14[_0xdcdd('0x1a')](_0x48ea4a)[_0xdcdd('0x1b')]();};}function respondWithResult(_0x25d862,_0x5ec794){_0x5ec794=_0x5ec794||0xc8;return function(_0x486da1){if(_0x486da1){return _0x25d862['status'](_0x5ec794)[_0xdcdd('0x1c')](_0x486da1);}};}function respondWithFilteredResult(_0x1112b0,_0x5b577a){return function(_0x5b970f){if(_0x5b970f){var _0x5ac6e1=typeof _0x5b577a[_0xdcdd('0x1d')]==='undefined'&&typeof _0x5b577a[_0xdcdd('0x1e')]===_0xdcdd('0x1f');var _0x4efd46=_0x5b970f[_0xdcdd('0x20')];var _0x52fdce=_0x5ac6e1?0x0:_0x5b577a[_0xdcdd('0x1d')];var _0x8bff31=_0x5ac6e1?_0x5b970f['count']:_0x5b577a['offset']+_0x5b577a[_0xdcdd('0x1e')];var _0x2dace8;if(_0x8bff31>=_0x4efd46){_0x8bff31=_0x4efd46;_0x2dace8=0xc8;}else{_0x2dace8=0xce;}_0x1112b0[_0xdcdd('0x1a')](_0x2dace8);return _0x1112b0[_0xdcdd('0x21')](_0xdcdd('0x22'),_0x52fdce+'-'+_0x8bff31+'/'+_0x4efd46)['json'](_0x5b970f);}return null;};}function patchUpdates(_0x512c4b){return function(_0x53272d){try{jsonpatch[_0xdcdd('0x23')](_0x53272d,_0x512c4b,!![]);}catch(_0x3ac5e6){return BPromise[_0xdcdd('0x24')](_0x3ac5e6);}return _0x53272d[_0xdcdd('0x25')]();};}function saveUpdates(_0x25dd11,_0x26fc36){return function(_0x23dde9){if(_0x23dde9){return _0x23dde9[_0xdcdd('0x26')](_0x25dd11)[_0xdcdd('0x27')](function(_0x34e139){return _0x34e139;});}return null;};}function removeEntity(_0x232cb8,_0x2f8e4d){return function(_0x4c77d6){if(_0x4c77d6){return _0x4c77d6[_0xdcdd('0x28')]()[_0xdcdd('0x27')](function(){_0x232cb8[_0xdcdd('0x1a')](0xcc)[_0xdcdd('0x1b')]();});}};}function handleEntityNotFound(_0x3ab10f,_0x42aafd){return function(_0x5bf1f3){if(!_0x5bf1f3){_0x3ab10f[_0xdcdd('0x19')](0x194);}return _0x5bf1f3;};}function handleError(_0x327225,_0x576919){_0x576919=_0x576919||0x1f4;return function(_0x4b3b6a){logger[_0xdcdd('0x29')](_0x4b3b6a['stack']);if(_0x4b3b6a[_0xdcdd('0x2a')]){delete _0x4b3b6a['name'];}_0x327225[_0xdcdd('0x1a')](_0x576919)[_0xdcdd('0x2b')](_0x4b3b6a);};}function getMustacheRender(_0x5dd1c2,_0x10e5b0){return Mustache[_0xdcdd('0x2c')](_0x5dd1c2,_[_0xdcdd('0x2d')](_0x10e5b0[_0xdcdd('0x2e')],{'contact':_0x10e5b0[_0xdcdd('0x2f')],'message':_0x10e5b0[_0xdcdd('0x30')],'agent':_0x10e5b0[_0xdcdd('0x31')],'interaction':_0x10e5b0['interaction'],'account':_0x10e5b0[_0xdcdd('0x32')]}))||'';}exports[_0xdcdd('0x33')]=function(_0x5f5456,_0x2065fa){var _0x4da856={},_0x31560f={},_0x5c0f4f={'count':0x0,'rows':[]};var _0x4980fa=_['map'](db[_0xdcdd('0x34')][_0xdcdd('0x35')],function(_0x2e0fb1){return{'name':_0x2e0fb1[_0xdcdd('0x36')],'type':_0x2e0fb1['type']['key']};});_0x31560f[_0xdcdd('0x37')]=_[_0xdcdd('0x38')](_0x4980fa,_0xdcdd('0x2a'));_0x31560f[_0xdcdd('0x39')]=_[_0xdcdd('0x3a')](_0x5f5456[_0xdcdd('0x39')]);_0x31560f[_0xdcdd('0x3b')]=_[_0xdcdd('0x3c')](_0x31560f['model'],_0x31560f[_0xdcdd('0x39')]);_0x31560f[_0xdcdd('0x3b')]=_[_0xdcdd('0x3d')](_0x31560f[_0xdcdd('0x3b')],[_0xdcdd('0x3e'),'$or','$gt','$gte','$lt',_0xdcdd('0x3f'),'$ne','$eq',_0xdcdd('0x40'),_0xdcdd('0x41'),_0xdcdd('0x42'),_0xdcdd('0x43'),_0xdcdd('0x44'),_0xdcdd('0x45'),_0xdcdd('0x46'),'$iLike','$notILike','$like','$overlap',_0xdcdd('0x47'),_0xdcdd('0x48'),'$any']);_0x4da856['attributes']=_['intersection'](_0x31560f[_0xdcdd('0x37')],qs[_0xdcdd('0x49')](_0x5f5456['query'][_0xdcdd('0x49')]));_0x4da856[_0xdcdd('0x4a')]=_0x4da856[_0xdcdd('0x4a')][_0xdcdd('0x4b')]?_0x4da856[_0xdcdd('0x4a')]:_0x31560f[_0xdcdd('0x37')];if(!_0x5f5456[_0xdcdd('0x39')][_0xdcdd('0x4c')](_0xdcdd('0x4d'))){_0x4da856[_0xdcdd('0x1e')]=qs[_0xdcdd('0x1e')](_0x5f5456[_0xdcdd('0x39')][_0xdcdd('0x1e')]);_0x4da856[_0xdcdd('0x1d')]=qs['offset'](_0x5f5456[_0xdcdd('0x39')][_0xdcdd('0x1d')]);}_0x4da856['order']=qs['sort'](_0x5f5456[_0xdcdd('0x39')]['sort']);_0x4da856[_0xdcdd('0x4e')]=qs[_0xdcdd('0x3b')](_[_0xdcdd('0x4f')](_0x5f5456[_0xdcdd('0x39')],_0x31560f['filters']),_0x4980fa);if(_0x5f5456[_0xdcdd('0x39')]['filter']){_0x4da856[_0xdcdd('0x4e')]=_[_0xdcdd('0x2d')](_0x4da856[_0xdcdd('0x4e')],{'$or':_[_0xdcdd('0x38')](_0x4980fa,function(_0x374e90){if(_0x374e90['type']!=='VIRTUAL'){var _0x5a5840={};_0x5a5840[_0x374e90['name']]={'$like':'%'+_0x5f5456[_0xdcdd('0x39')][_0xdcdd('0x50')]+'%'};return _0x5a5840;}})});}_0x4da856=_[_0xdcdd('0x2d')]({},_0x4da856,_0x5f5456[_0xdcdd('0x51')]);var _0x17c757={'where':_0x4da856[_0xdcdd('0x4e')]};return db[_0xdcdd('0x34')][_0xdcdd('0x20')](_0x17c757)[_0xdcdd('0x27')](function(_0x38f9ec){_0x5c0f4f[_0xdcdd('0x20')]=_0x38f9ec;if(_0x5f5456[_0xdcdd('0x39')][_0xdcdd('0x52')]){_0x4da856['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x4da856);})[_0xdcdd('0x27')](function(_0x19afd2){_0x5c0f4f[_0xdcdd('0x53')]=_0x19afd2;return _0x5c0f4f;})[_0xdcdd('0x27')](respondWithFilteredResult(_0x2065fa,_0x4da856))[_0xdcdd('0x54')](handleError(_0x2065fa,null));};exports[_0xdcdd('0x55')]=function(_0x2b5550,_0x47d09d){var _0x21e471={'raw':!![],'where':{'id':_0x2b5550[_0xdcdd('0x56')]['id']}},_0x4be784={};_0x4be784['model']=_[_0xdcdd('0x3a')](db[_0xdcdd('0x34')][_0xdcdd('0x35')]);_0x4be784[_0xdcdd('0x39')]=_[_0xdcdd('0x3a')](_0x2b5550[_0xdcdd('0x39')]);_0x4be784[_0xdcdd('0x3b')]=_[_0xdcdd('0x3c')](_0x4be784[_0xdcdd('0x37')],_0x4be784[_0xdcdd('0x39')]);_0x21e471[_0xdcdd('0x4a')]=_[_0xdcdd('0x3c')](_0x4be784[_0xdcdd('0x37')],qs[_0xdcdd('0x49')](_0x2b5550['query']['fields']));_0x21e471[_0xdcdd('0x4a')]=_0x21e471[_0xdcdd('0x4a')][_0xdcdd('0x4b')]?_0x21e471[_0xdcdd('0x4a')]:_0x4be784['model'];if(_0x2b5550[_0xdcdd('0x39')][_0xdcdd('0x52')]){_0x21e471[_0xdcdd('0x57')]=[{'all':!![]}];}_0x21e471=_['merge']({},_0x21e471,_0x2b5550[_0xdcdd('0x51')]);return db[_0xdcdd('0x34')][_0xdcdd('0x58')](_0x21e471)[_0xdcdd('0x27')](handleEntityNotFound(_0x47d09d,null))[_0xdcdd('0x27')](respondWithResult(_0x47d09d,null))['catch'](handleError(_0x47d09d,null));};exports[_0xdcdd('0x59')]=function(_0x36378e,_0x1048a4){return db[_0xdcdd('0x34')][_0xdcdd('0x59')](_0x36378e[_0xdcdd('0x2e')],{})[_0xdcdd('0x27')](respondWithResult(_0x1048a4,0xc9))[_0xdcdd('0x54')](handleError(_0x1048a4,null));};exports[_0xdcdd('0x26')]=function(_0x39b30a,_0x42e88c){if(_0x39b30a['body']['id']){delete _0x39b30a[_0xdcdd('0x2e')]['id'];}return db[_0xdcdd('0x34')][_0xdcdd('0x58')]({'where':{'id':_0x39b30a[_0xdcdd('0x56')]['id']}})[_0xdcdd('0x27')](handleEntityNotFound(_0x42e88c,null))[_0xdcdd('0x27')](saveUpdates(_0x39b30a[_0xdcdd('0x2e')],null))['then'](respondWithResult(_0x42e88c,null))[_0xdcdd('0x54')](handleError(_0x42e88c,null));};exports[_0xdcdd('0x5a')]=function(_0x50bf2c,_0xa69ee2){return db[_0xdcdd('0x34')][_0xdcdd('0x5a')]()[_0xdcdd('0x27')](respondWithResult(_0xa69ee2,null))[_0xdcdd('0x54')](handleError(_0xa69ee2,null));};exports[_0xdcdd('0x28')]=function(_0x4d9a14,_0x2dfed7){var _0x14cfe5;return db[_0xdcdd('0x34')]['find']({'where':{'id':_0x4d9a14['params']['id']}})[_0xdcdd('0x27')](handleEntityNotFound(_0x2dfed7,null))[_0xdcdd('0x27')](function(_0x284b10){if(_0x284b10){return _0x284b10[_0xdcdd('0x28')]()[_0xdcdd('0x27')](function(_0x45821a){return _0x45821a;});}})[_0xdcdd('0x27')](function(_0x5acdee){_0x14cfe5=_0x5acdee;if(_0x5acdee){if(_0x5acdee['VoiceQueueId']||_0x5acdee[_0xdcdd('0x5b')]){return db[_0x5acdee[_0xdcdd('0x5c')]?_0xdcdd('0x5d'):'Campaign']['find']({'where':{'id':_0x5acdee[_0xdcdd('0x5c')]?_0x5acdee['VoiceQueueId']:_0x5acdee[_0xdcdd('0x5b')]},'attributes':['id',_0xdcdd('0x2a')],'raw':!![]});}}})[_0xdcdd('0x27')](function(_0x1201a9){var _0x5b1946={};if(_0x1201a9){_[_0xdcdd('0x2d')](_0x5b1946,_[_0xdcdd('0x5e')](_0x14cfe5[_0xdcdd('0x5f')],[_0xdcdd('0x60'),_0xdcdd('0x61'),'id']));_0x5b1946[_0xdcdd('0x62')]=0x15;_0x5b1946[_0xdcdd('0x63')]='deleted';_0x5b1946[_0xdcdd('0x64')]=_0x1201a9[_0xdcdd('0x2a')];_0x5b1946['membername']=_0x4d9a14[_0xdcdd('0x65')][_0xdcdd('0x2a')];_0x5b1946[_0xdcdd('0x66')]=_0x4d9a14['user']['id'];_0x5b1946[_0xdcdd('0x67')]=!![];_0x5b1946[_0xdcdd('0x68')]=moment()['format'](_0xdcdd('0x69'));_0x5b1946['calleridnum']=_0x14cfe5['phone'];_0x5b1946[_0xdcdd('0x6a')]=_0x14cfe5[_0xdcdd('0x5c')]?'queue':_0xdcdd('0x6b');return db[_0xdcdd('0x6c')][_0xdcdd('0x58')]({'where':{'id':_0x5b1946[_0xdcdd('0x6d')]},'attributes':['firstName',_0xdcdd('0x6e')]})['then'](function(_0x31ff48){if(!_[_0xdcdd('0x6f')](_0x2dfed7)&&!_[_0xdcdd('0x6f')](_0x31ff48['firstName'])){_0x5b1946[_0xdcdd('0x70')]=_0x31ff48[_0xdcdd('0x71')];if(!_['isNil'](_0x31ff48['lastName'])){_0x5b1946['calleridname']+='\x20'+_0x31ff48[_0xdcdd('0x6e')];}}})[_0xdcdd('0x72')](function(){return db[_0xdcdd('0x73')][_0xdcdd('0x59')](_0x5b1946);});}})[_0xdcdd('0x27')](function(){return _0x2dfed7[_0xdcdd('0x1a')](0xcc)[_0xdcdd('0x1b')]();})[_0xdcdd('0x54')](handleError(_0x2dfed7,null));};exports[_0xdcdd('0x74')]=function(_0x21baf2,_0x28d2f8,_0x36f4f9){var _0x14bd2e=[];return db[_0xdcdd('0x6c')]['describe']()[_0xdcdd('0x27')](function(_0x32feaf){_0x14bd2e=_[_0xdcdd('0x3a')](_0x32feaf);return _0x21baf2['user'][_0xdcdd('0x75')]({'where':{'type':_0xdcdd('0x76'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x398321){if(_0x398321&&_0x398321['length']){return db[_0xdcdd('0x77')][_0xdcdd('0x78')](function(_0x2e07df){var _0x3bd42a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xdcdd('0x79')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x398321,'id')},'$or':[{'UserId':null},{'UserId':_0x21baf2['user']['id']}]};var _0x3f2c55=[];if(_0x21baf2['body'][_0xdcdd('0x7a')]&&_0x21baf2['body'][_0xdcdd('0x7a')]==='prev'){if(!_['isEmpty'](_0x21baf2['body'][_0xdcdd('0x7b')])){_0x3bd42a['id']={'$in':_0x21baf2['body'][_0xdcdd('0x7b')]};}_0x3f2c55=[['priority',_0xdcdd('0x7c')],['scheduledAt',_0x398321[0x0][_0xdcdd('0x7d')]===_0xdcdd('0x7c')?_0xdcdd('0x7e'):_0xdcdd('0x7c')],db[_0xdcdd('0x77')][_0xdcdd('0x7f')](_0xdcdd('0x80')),['id',_0xdcdd('0x7e')]];}else{if(!_[_0xdcdd('0x81')](_0x21baf2[_0xdcdd('0x2e')][_0xdcdd('0x7b')])){_0x3bd42a['id']={'$notIn':_0x21baf2[_0xdcdd('0x2e')][_0xdcdd('0x7b')]};}_0x3f2c55=[[_0xdcdd('0x82'),_0xdcdd('0x7e')],['scheduledAt',_0x398321[0x0][_0xdcdd('0x7d')]],db[_0xdcdd('0x77')][_0xdcdd('0x7f')](_0xdcdd('0x83')),['id',_0xdcdd('0x7c')]];}return db[_0xdcdd('0x34')][_0xdcdd('0x84')]({'attributes':['id','scheduledat'],'where':_0x3bd42a,'order':_0x3f2c55,'transaction':_0x2e07df,'lock':_0x2e07df[_0xdcdd('0x85')][_0xdcdd('0x86')],'include':[{'model':db['CmContact'],'as':_0xdcdd('0x87'),'attributes':_0x14bd2e,'include':[{'model':db[_0xdcdd('0x88')],'as':'Company','attributes':['id',_0xdcdd('0x2a')]}]},{'model':db[_0xdcdd('0x89')],'as':_0xdcdd('0x8a'),'attributes':['id',_0xdcdd('0x2a')]},{'model':db[_0xdcdd('0x5d')],'as':_0xdcdd('0x8b'),'attributes':['id',_0xdcdd('0x2a'),_0xdcdd('0x8c')]}]})['then'](function(_0x1223dc){if(_0x1223dc){return _0x1223dc[_0xdcdd('0x26')]({'UserId':_0x21baf2['user']['id']},{'transaction':_0x2e07df});}});});}})['then'](handleEntityNotFound(_0x28d2f8,null))[_0xdcdd('0x27')](respondWithResult(_0x28d2f8,null))[_0xdcdd('0x54')](handleError(_0x28d2f8,null));};exports[_0xdcdd('0x8d')]=function(_0x508666,_0x692ae8,_0x12809f){return _0x508666['user'][_0xdcdd('0x75')]({'where':{'type':_0xdcdd('0x76'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xdcdd('0x27')](function(_0x1fe220){if(_0x1fe220&&_0x1fe220[_0xdcdd('0x4b')]){return db[_0xdcdd('0x34')][_0xdcdd('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xdcdd('0x79')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x1fe220,'id')},'$or':[{'UserId':null},{'UserId':_0x508666[_0xdcdd('0x65')]['id']}]}});}return 0x0;})['then'](function(_0x4c8c3d){if(!_[_0xdcdd('0x6f')](_0x4c8c3d)&&_[_0xdcdd('0x8e')](_0x4c8c3d)){return _0x692ae8[_0xdcdd('0x1a')](0xc8)[_0xdcdd('0x1c')]({'contacts':_0x4c8c3d});}else{logger['error'](_0xdcdd('0x8f'),'getOpenContacts',0x194,_0xdcdd('0x90'));_0x692ae8[_0xdcdd('0x19')](0x194);}})[_0xdcdd('0x54')](handleError(_0x692ae8,null));}; \ No newline at end of file +var _0x183f=['List','Queue','dialActive','getOpenContacts','isNumber','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','end','error','stack','name','send','render','merge','body','message','interaction','index','map','CmHopper','rawAttributes','type','model','query','keys','filters','intersection','concat','$and','$gt','$gte','$lt','$eq','$not','$between','$notBetween','$in','$notLike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','updatedAt','state','statedesc','campaign','membername','UserId','user','deleted','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','format','direction','prev','isEmpty','hopperIds','priority','DESC','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','CmCompany','Company'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x183f,0x9d));var _0xf183=function(_0x255bea,_0x298ba8){_0x255bea=_0x255bea-0x0;var _0x5151a9=_0x183f[_0x255bea];return _0x5151a9;};'use strict';var emlformat=require(_0xf183('0x0'));var rimraf=require(_0xf183('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf183('0x2'));var rp=require(_0xf183('0x3'));var moment=require(_0xf183('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf183('0x5'));var util=require(_0xf183('0x6'));var path=require(_0xf183('0x7'));var sox=require(_0xf183('0x8'));var csv=require(_0xf183('0x9'));var ejs=require(_0xf183('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf183('0xb'));var squel=require('squel');var crypto=require(_0xf183('0xc'));var jsforce=require(_0xf183('0xd'));var deskjs=require(_0xf183('0xe'));var toCsv=require(_0xf183('0x9'));var querystring=require(_0xf183('0xf'));var Papa=require(_0xf183('0x10'));var Redis=require(_0xf183('0x11'));var authService=require(_0xf183('0x12'));var qs=require(_0xf183('0x13'));var as=require(_0xf183('0x14'));var hardwareService=require(_0xf183('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xf183('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf183('0x17'));var db=require(_0xf183('0x18'))['db'];function respondWithStatusCode(_0x3af97a,_0x362ff4){_0x362ff4=_0x362ff4||0xcc;return function(_0x3d7a7b){if(_0x3d7a7b){return _0x3af97a[_0xf183('0x19')](_0x362ff4);}return _0x3af97a[_0xf183('0x1a')](_0x362ff4)['end']();};}function respondWithResult(_0x27a066,_0x3eaa19){_0x3eaa19=_0x3eaa19||0xc8;return function(_0x30fbbf){if(_0x30fbbf){return _0x27a066[_0xf183('0x1a')](_0x3eaa19)[_0xf183('0x1b')](_0x30fbbf);}};}function respondWithFilteredResult(_0x568c55,_0x402ccc){return function(_0x3624d5){if(_0x3624d5){var _0x1e7713=typeof _0x402ccc[_0xf183('0x1c')]===_0xf183('0x1d')&&typeof _0x402ccc['limit']===_0xf183('0x1d');var _0x2f0f48=_0x3624d5[_0xf183('0x1e')];var _0x2fb253=_0x1e7713?0x0:_0x402ccc[_0xf183('0x1c')];var _0x876ae5=_0x1e7713?_0x3624d5[_0xf183('0x1e')]:_0x402ccc[_0xf183('0x1c')]+_0x402ccc[_0xf183('0x1f')];var _0x173a64;if(_0x876ae5>=_0x2f0f48){_0x876ae5=_0x2f0f48;_0x173a64=0xc8;}else{_0x173a64=0xce;}_0x568c55['status'](_0x173a64);return _0x568c55[_0xf183('0x20')]('Content-Range',_0x2fb253+'-'+_0x876ae5+'/'+_0x2f0f48)[_0xf183('0x1b')](_0x3624d5);}return null;};}function patchUpdates(_0x24956){return function(_0xed90b9){try{jsonpatch[_0xf183('0x21')](_0xed90b9,_0x24956,!![]);}catch(_0x6fc4e0){return BPromise[_0xf183('0x22')](_0x6fc4e0);}return _0xed90b9[_0xf183('0x23')]();};}function saveUpdates(_0x11e48d,_0x6da37a){return function(_0x21dd72){if(_0x21dd72){return _0x21dd72[_0xf183('0x24')](_0x11e48d)[_0xf183('0x25')](function(_0x13217c){return _0x13217c;});}return null;};}function removeEntity(_0x1696ae,_0x5d5380){return function(_0x42c0df){if(_0x42c0df){return _0x42c0df['destroy']()[_0xf183('0x25')](function(){_0x1696ae['status'](0xcc)[_0xf183('0x26')]();});}};}function handleEntityNotFound(_0x38fbf0,_0x39fa80){return function(_0x5bf195){if(!_0x5bf195){_0x38fbf0[_0xf183('0x19')](0x194);}return _0x5bf195;};}function handleError(_0x370dae,_0x38501f){_0x38501f=_0x38501f||0x1f4;return function(_0x2b4970){logger[_0xf183('0x27')](_0x2b4970[_0xf183('0x28')]);if(_0x2b4970[_0xf183('0x29')]){delete _0x2b4970[_0xf183('0x29')];}_0x370dae[_0xf183('0x1a')](_0x38501f)[_0xf183('0x2a')](_0x2b4970);};}function getMustacheRender(_0x2fd7fe,_0x26ba2c){return Mustache[_0xf183('0x2b')](_0x2fd7fe,_[_0xf183('0x2c')](_0x26ba2c[_0xf183('0x2d')],{'contact':_0x26ba2c['contact'],'message':_0x26ba2c[_0xf183('0x2e')],'agent':_0x26ba2c['agent'],'interaction':_0x26ba2c[_0xf183('0x2f')],'account':_0x26ba2c['account']}))||'';}exports[_0xf183('0x30')]=function(_0x32dc03,_0x9c6191){var _0x415f1b={},_0x24554f={},_0x5e411e={'count':0x0,'rows':[]};var _0x28c123=_[_0xf183('0x31')](db[_0xf183('0x32')][_0xf183('0x33')],function(_0x2eafd7){return{'name':_0x2eafd7['fieldName'],'type':_0x2eafd7[_0xf183('0x34')]['key']};});_0x24554f[_0xf183('0x35')]=_[_0xf183('0x31')](_0x28c123,_0xf183('0x29'));_0x24554f[_0xf183('0x36')]=_[_0xf183('0x37')](_0x32dc03['query']);_0x24554f[_0xf183('0x38')]=_[_0xf183('0x39')](_0x24554f[_0xf183('0x35')],_0x24554f['query']);_0x24554f['filters']=_[_0xf183('0x3a')](_0x24554f[_0xf183('0x38')],[_0xf183('0x3b'),'$or',_0xf183('0x3c'),_0xf183('0x3d'),_0xf183('0x3e'),'$lte','$ne',_0xf183('0x3f'),_0xf183('0x40'),_0xf183('0x41'),_0xf183('0x42'),_0xf183('0x43'),'$notIn','$like',_0xf183('0x44'),'$iLike','$notILike','$like',_0xf183('0x45'),_0xf183('0x46'),_0xf183('0x47'),_0xf183('0x48')]);_0x415f1b[_0xf183('0x49')]=_[_0xf183('0x39')](_0x24554f[_0xf183('0x35')],qs[_0xf183('0x4a')](_0x32dc03[_0xf183('0x36')][_0xf183('0x4a')]));_0x415f1b[_0xf183('0x49')]=_0x415f1b['attributes'][_0xf183('0x4b')]?_0x415f1b[_0xf183('0x49')]:_0x24554f['model'];if(!_0x32dc03['query'][_0xf183('0x4c')](_0xf183('0x4d'))){_0x415f1b[_0xf183('0x1f')]=qs['limit'](_0x32dc03[_0xf183('0x36')][_0xf183('0x1f')]);_0x415f1b[_0xf183('0x1c')]=qs['offset'](_0x32dc03[_0xf183('0x36')][_0xf183('0x1c')]);}_0x415f1b[_0xf183('0x4e')]=qs[_0xf183('0x4f')](_0x32dc03[_0xf183('0x36')]['sort']);_0x415f1b[_0xf183('0x50')]=qs['filters'](_[_0xf183('0x51')](_0x32dc03[_0xf183('0x36')],_0x24554f[_0xf183('0x38')]),_0x28c123);if(_0x32dc03[_0xf183('0x36')][_0xf183('0x52')]){_0x415f1b[_0xf183('0x50')]=_[_0xf183('0x2c')](_0x415f1b[_0xf183('0x50')],{'$or':_[_0xf183('0x31')](_0x28c123,function(_0x17299f){if(_0x17299f[_0xf183('0x34')]!==_0xf183('0x53')){var _0x1b07dd={};_0x1b07dd[_0x17299f[_0xf183('0x29')]]={'$like':'%'+_0x32dc03[_0xf183('0x36')][_0xf183('0x52')]+'%'};return _0x1b07dd;}})});}_0x415f1b=_[_0xf183('0x2c')]({},_0x415f1b,_0x32dc03[_0xf183('0x54')]);var _0x30e9f7={'where':_0x415f1b['where']};return db['CmHopper'][_0xf183('0x1e')](_0x30e9f7)[_0xf183('0x25')](function(_0xb5afda){_0x5e411e[_0xf183('0x1e')]=_0xb5afda;if(_0x32dc03['query'][_0xf183('0x55')]){_0x415f1b[_0xf183('0x56')]=[{'all':!![]}];}return db['CmHopper'][_0xf183('0x57')](_0x415f1b);})[_0xf183('0x25')](function(_0x3ff740){_0x5e411e[_0xf183('0x58')]=_0x3ff740;return _0x5e411e;})[_0xf183('0x25')](respondWithFilteredResult(_0x9c6191,_0x415f1b))[_0xf183('0x59')](handleError(_0x9c6191,null));};exports[_0xf183('0x5a')]=function(_0x1b591b,_0x3c6228){var _0x5f287f={'raw':!![],'where':{'id':_0x1b591b[_0xf183('0x5b')]['id']}},_0x4af299={};_0x4af299[_0xf183('0x35')]=_[_0xf183('0x37')](db['CmHopper']['rawAttributes']);_0x4af299[_0xf183('0x36')]=_['keys'](_0x1b591b[_0xf183('0x36')]);_0x4af299[_0xf183('0x38')]=_[_0xf183('0x39')](_0x4af299[_0xf183('0x35')],_0x4af299[_0xf183('0x36')]);_0x5f287f[_0xf183('0x49')]=_[_0xf183('0x39')](_0x4af299[_0xf183('0x35')],qs['fields'](_0x1b591b[_0xf183('0x36')]['fields']));_0x5f287f[_0xf183('0x49')]=_0x5f287f[_0xf183('0x49')]['length']?_0x5f287f[_0xf183('0x49')]:_0x4af299[_0xf183('0x35')];if(_0x1b591b[_0xf183('0x36')][_0xf183('0x55')]){_0x5f287f[_0xf183('0x56')]=[{'all':!![]}];}_0x5f287f=_[_0xf183('0x2c')]({},_0x5f287f,_0x1b591b[_0xf183('0x54')]);return db[_0xf183('0x32')][_0xf183('0x5c')](_0x5f287f)[_0xf183('0x25')](handleEntityNotFound(_0x3c6228,null))['then'](respondWithResult(_0x3c6228,null))[_0xf183('0x59')](handleError(_0x3c6228,null));};exports[_0xf183('0x5d')]=function(_0x34f2ab,_0x14b413){return db[_0xf183('0x32')][_0xf183('0x5d')](_0x34f2ab[_0xf183('0x2d')],{})[_0xf183('0x25')](respondWithResult(_0x14b413,0xc9))[_0xf183('0x59')](handleError(_0x14b413,null));};exports[_0xf183('0x24')]=function(_0x5dab07,_0x24a696){if(_0x5dab07['body']['id']){delete _0x5dab07[_0xf183('0x2d')]['id'];}return db[_0xf183('0x32')][_0xf183('0x5c')]({'where':{'id':_0x5dab07[_0xf183('0x5b')]['id']}})['then'](handleEntityNotFound(_0x24a696,null))[_0xf183('0x25')](saveUpdates(_0x5dab07['body'],null))['then'](respondWithResult(_0x24a696,null))[_0xf183('0x59')](handleError(_0x24a696,null));};exports[_0xf183('0x5e')]=function(_0x6ffe49,_0x47a615){return db[_0xf183('0x32')]['describe']()['then'](respondWithResult(_0x47a615,null))[_0xf183('0x59')](handleError(_0x47a615,null));};exports[_0xf183('0x5f')]=function(_0x44c7ea,_0x26f3fe){var _0xebbf7a;return db[_0xf183('0x32')]['find']({'where':{'id':_0x44c7ea[_0xf183('0x5b')]['id']}})['then'](handleEntityNotFound(_0x26f3fe,null))[_0xf183('0x25')](function(_0x53b562){if(_0x53b562){return _0x53b562[_0xf183('0x5f')]()['then'](function(_0x1cbafa){return _0x1cbafa;});}})[_0xf183('0x25')](function(_0x26f0d3){_0xebbf7a=_0x26f0d3;if(_0x26f0d3){if(_0x26f0d3[_0xf183('0x60')]||_0x26f0d3[_0xf183('0x61')]){return db[_0x26f0d3[_0xf183('0x60')]?_0xf183('0x62'):_0xf183('0x63')][_0xf183('0x5c')]({'where':{'id':_0x26f0d3[_0xf183('0x60')]?_0x26f0d3[_0xf183('0x60')]:_0x26f0d3[_0xf183('0x61')]},'attributes':['id',_0xf183('0x29')],'raw':!![]});}}})[_0xf183('0x25')](function(_0x222998){var _0x48cc77={};if(_0x222998){_[_0xf183('0x2c')](_0x48cc77,_[_0xf183('0x64')](_0xebbf7a['dataValues'],['createdAt',_0xf183('0x65'),'id']));_0x48cc77[_0xf183('0x66')]=0x15;_0x48cc77[_0xf183('0x67')]='deleted';_0x48cc77[_0xf183('0x68')]=_0x222998[_0xf183('0x29')];_0x48cc77[_0xf183('0x69')]=_0x44c7ea['user'][_0xf183('0x29')];_0x48cc77[_0xf183('0x6a')]=_0x44c7ea[_0xf183('0x6b')]['id'];_0x48cc77[_0xf183('0x6c')]=!![];_0x48cc77[_0xf183('0x6d')]=moment()['format'](_0xf183('0x6e'));_0x48cc77[_0xf183('0x6f')]=_0xebbf7a[_0xf183('0x70')];_0x48cc77['campaigntype']=_0xebbf7a[_0xf183('0x60')]?_0xf183('0x71'):_0xf183('0x72');return db[_0xf183('0x73')][_0xf183('0x5c')]({'where':{'id':_0x48cc77[_0xf183('0x74')]},'attributes':[_0xf183('0x75'),_0xf183('0x76')]})[_0xf183('0x25')](function(_0x1b64eb){if(!_['isNil'](_0x26f3fe)&&!_[_0xf183('0x77')](_0x1b64eb['firstName'])){_0x48cc77['calleridname']=_0x1b64eb[_0xf183('0x75')];if(!_[_0xf183('0x77')](_0x1b64eb[_0xf183('0x76')])){_0x48cc77[_0xf183('0x78')]+='\x20'+_0x1b64eb[_0xf183('0x76')];}}})[_0xf183('0x79')](function(){return db[_0xf183('0x7a')]['create'](_0x48cc77);});}})['then'](function(){return _0x26f3fe['status'](0xcc)[_0xf183('0x26')]();})[_0xf183('0x59')](handleError(_0x26f3fe,null));};exports[_0xf183('0x7b')]=function(_0x2ce8c7,_0x3f63a6,_0x415455){var _0x5b482f=[];return db[_0xf183('0x73')][_0xf183('0x5e')]()['then'](function(_0x32e4c9){_0x5b482f=_[_0xf183('0x37')](_0x32e4c9);return _0x2ce8c7[_0xf183('0x6b')][_0xf183('0x7c')]({'where':{'type':_0xf183('0x7d'),'dialActive':!![],'dialMethod':_0xf183('0x7e')},'attributes':['id',_0xf183('0x7f')],'raw':!![]});})[_0xf183('0x25')](function(_0x6e742){if(_0x6e742&&_0x6e742[_0xf183('0x4b')]){return db[_0xf183('0x80')][_0xf183('0x81')](function(_0x2373ed){var _0x2695c5={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf183('0x82')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xf183('0x31')](_0x6e742,'id')},'$or':[{'UserId':null},{'UserId':_0x2ce8c7[_0xf183('0x6b')]['id']}]};var _0x3f55d8=[];if(_0x2ce8c7[_0xf183('0x2d')]['direction']&&_0x2ce8c7[_0xf183('0x2d')][_0xf183('0x83')]===_0xf183('0x84')){if(!_[_0xf183('0x85')](_0x2ce8c7[_0xf183('0x2d')][_0xf183('0x86')])){_0x2695c5['id']={'$in':_0x2ce8c7[_0xf183('0x2d')][_0xf183('0x86')]};}_0x3f55d8=[[_0xf183('0x87'),'ASC'],['scheduledAt',_0x6e742[0x0][_0xf183('0x7f')]==='ASC'?_0xf183('0x88'):_0xf183('0x89')],db['sequelize'][_0xf183('0x8a')](_0xf183('0x8b')),['id',_0xf183('0x88')]];}else{if(!_['isEmpty'](_0x2ce8c7[_0xf183('0x2d')]['hopperIds'])){_0x2695c5['id']={'$notIn':_0x2ce8c7['body'][_0xf183('0x86')]};}_0x3f55d8=[[_0xf183('0x87'),'DESC'],[_0xf183('0x8c'),_0x6e742[0x0][_0xf183('0x7f')]],db[_0xf183('0x80')][_0xf183('0x8a')](_0xf183('0x8d')),['id','ASC']];}return db['CmHopper'][_0xf183('0x8e')]({'attributes':['id',_0xf183('0x8f')],'where':_0x2695c5,'order':_0x3f55d8,'transaction':_0x2373ed,'lock':_0x2373ed['LOCK'][_0xf183('0x90')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x5b482f,'include':[{'model':db[_0xf183('0x91')],'as':_0xf183('0x92'),'attributes':['id',_0xf183('0x29')]}]},{'model':db['CmList'],'as':_0xf183('0x93'),'attributes':['id',_0xf183('0x29')]},{'model':db[_0xf183('0x62')],'as':_0xf183('0x94'),'attributes':['id',_0xf183('0x29'),_0xf183('0x95')]}]})[_0xf183('0x25')](function(_0x454a74){if(_0x454a74){return _0x454a74[_0xf183('0x24')]({'UserId':_0x2ce8c7[_0xf183('0x6b')]['id']},{'transaction':_0x2373ed});}});});}})['then'](handleEntityNotFound(_0x3f63a6,null))[_0xf183('0x25')](respondWithResult(_0x3f63a6,null))[_0xf183('0x59')](handleError(_0x3f63a6,null));};exports[_0xf183('0x96')]=function(_0x23b0d0,_0x5f0d91,_0x2eeea3){return _0x23b0d0[_0xf183('0x6b')][_0xf183('0x7c')]({'where':{'type':_0xf183('0x7d'),'dialActive':!![],'dialMethod':_0xf183('0x7e')},'attributes':['id'],'raw':!![]})['then'](function(_0x1c16cd){if(_0x1c16cd&&_0x1c16cd[_0xf183('0x4b')]){return db[_0xf183('0x32')][_0xf183('0x1e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf183('0x82')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x1c16cd,'id')},'$or':[{'UserId':null},{'UserId':_0x23b0d0['user']['id']}]}});}return 0x0;})['then'](function(_0x543d31){if(!_[_0xf183('0x77')](_0x543d31)&&_[_0xf183('0x97')](_0x543d31)){return _0x5f0d91[_0xf183('0x1a')](0xc8)[_0xf183('0x1b')]({'contacts':_0x543d31});}else{logger[_0xf183('0x27')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xf183('0x96'),0x194,'entity\x20not\x20found');_0x5f0d91[_0xf183('0x19')](0x194);}})[_0xf183('0x59')](handleError(_0x5f0d91,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index eb70345..65e0d1e 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 _0xe0a3=['cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','exports','CmHopper'];(function(_0x2aebe9,_0xa24506){var _0x463d19=function(_0x544e9e){while(--_0x544e9e){_0x2aebe9['push'](_0x2aebe9['shift']());}};_0x463d19(++_0xa24506);}(_0xe0a3,0xac));var _0x3e0a=function(_0x3bcf9e,_0x148a5d){_0x3bcf9e=_0x3bcf9e-0x0;var _0x1bb37c=_0xe0a3[_0x3bcf9e];return _0x1bb37c;};'use strict';var _=require(_0x3e0a('0x0'));var util=require('util');var logger=require(_0x3e0a('0x1'))('api');var moment=require(_0x3e0a('0x2'));var BPromise=require(_0x3e0a('0x3'));var rp=require(_0x3e0a('0x4'));var fs=require('fs');var path=require(_0x3e0a('0x5'));var rimraf=require('rimraf');var config=require(_0x3e0a('0x6'));var attributes=require(_0x3e0a('0x7'));module[_0x3e0a('0x8')]=function(_0x13451e,_0x464e1b){return _0x13451e['define'](_0x3e0a('0x9'),attributes,{'tableName':_0x3e0a('0xa'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x3e0a('0xb')]},{'name':'phone','fields':[_0x3e0a('0xc')]},{'name':_0x3e0a('0xd'),'fields':[_0x3e0a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x350f=['api','moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','exports','scheduledat','phone','priority','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x350f,0x97));var _0xf350=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x350f[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0xf350('0x0'));var util=require(_0xf350('0x1'));var logger=require(_0xf350('0x2'))(_0xf350('0x3'));var moment=require(_0xf350('0x4'));var BPromise=require(_0xf350('0x5'));var rp=require(_0xf350('0x6'));var fs=require('fs');var path=require(_0xf350('0x7'));var rimraf=require('rimraf');var config=require(_0xf350('0x8'));var attributes=require(_0xf350('0x9'));module[_0xf350('0xa')]=function(_0x3b2d56,_0x339799){return _0x3b2d56['define']('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0xf350('0xb')]},{'name':_0xf350('0xc'),'fields':[_0xf350('0xc')]},{'name':_0xf350('0xd'),'fields':[_0xf350('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 8a44e99..c309362 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 _0x8fd7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CmHopper','findAll','options','where','limit','include','map','model','attributes','GetCmHopper','debug','ShowCmHopper','find','raw','CreateCmHopper','create','body','update','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','includes','all','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x32956c,_0x53a1e3){var _0x97df49=function(_0x3a0309){while(--_0x3a0309){_0x32956c['push'](_0x32956c['shift']());}};_0x97df49(++_0x53a1e3);}(_0x8fd7,0x1cd));var _0x78fd=function(_0x38c4b6,_0x4f4ae8){_0x38c4b6=_0x38c4b6-0x0;var _0x498984=_0x8fd7[_0x38c4b6];return _0x498984;};'use strict';var _=require(_0x78fd('0x0'));var util=require(_0x78fd('0x1'));var moment=require(_0x78fd('0x2'));var BPromise=require(_0x78fd('0x3'));var rs=require(_0x78fd('0x4'));var fs=require('fs');var Redis=require(_0x78fd('0x5'));var db=require(_0x78fd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x78fd('0x7'))(_0x78fd('0x8'));var config=require(_0x78fd('0x9'));var jayson=require(_0x78fd('0xa'));var client=jayson[_0x78fd('0xb')][_0x78fd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f68d2,_0x149510,_0x2a8f42){return new BPromise(function(_0x28aa52,_0x297481){return client[_0x78fd('0xd')](_0x3f68d2,_0x2a8f42)[_0x78fd('0xe')](function(_0x31f286){logger[_0x78fd('0xf')](_0x78fd('0x10'),_0x149510,'request\x20sent');logger['debug'](_0x78fd('0x11'),_0x149510,'request\x20sent',JSON[_0x78fd('0x12')](_0x31f286));if(_0x31f286['error']){if(_0x31f286[_0x78fd('0x13')][_0x78fd('0x14')]===0x1f4){logger[_0x78fd('0x13')]('CmHopper,\x20%s,\x20%s',_0x149510,_0x31f286[_0x78fd('0x13')]['message']);return _0x297481(_0x31f286['error'][_0x78fd('0x15')]);}logger[_0x78fd('0x13')](_0x78fd('0x10'),_0x149510,_0x31f286[_0x78fd('0x13')][_0x78fd('0x15')]);return _0x28aa52(_0x31f286[_0x78fd('0x13')][_0x78fd('0x15')]);}else{logger[_0x78fd('0xf')]('CmHopper,\x20%s,\x20%s',_0x149510,_0x78fd('0x16'));_0x28aa52(_0x31f286[_0x78fd('0x17')][_0x78fd('0x15')]);}})[_0x78fd('0x18')](function(_0x197550){logger['error'](_0x78fd('0x10'),_0x149510,_0x197550);_0x297481(_0x197550);});});}exports['GetCmHopper']=function(_0x4a02f0){var _0x363566=this;return new Promise(function(_0x319853,_0x5c4095){return db[_0x78fd('0x19')][_0x78fd('0x1a')]({'raw':_0x4a02f0['options']?_0x4a02f0[_0x78fd('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4a02f0[_0x78fd('0x1b')]?_0x4a02f0['options'][_0x78fd('0x1c')]||null:null,'attributes':_0x4a02f0[_0x78fd('0x1b')]?_0x4a02f0[_0x78fd('0x1b')]['attributes']||null:null,'limit':_0x4a02f0[_0x78fd('0x1b')]?_0x4a02f0[_0x78fd('0x1b')][_0x78fd('0x1d')]||null:null,'include':_0x4a02f0[_0x78fd('0x1b')]?_0x4a02f0[_0x78fd('0x1b')][_0x78fd('0x1e')]?_[_0x78fd('0x1f')](_0x4a02f0[_0x78fd('0x1b')]['include'],function(_0x533eb1){return{'model':db[_0x533eb1[_0x78fd('0x20')]],'as':_0x533eb1['as'],'attributes':_0x533eb1['attributes'],'include':_0x533eb1['include']?_[_0x78fd('0x1f')](_0x533eb1[_0x78fd('0x1e')],function(_0x112ff7){return{'model':db[_0x112ff7['model']],'as':_0x112ff7['as'],'attributes':_0x112ff7[_0x78fd('0x21')],'include':_0x112ff7[_0x78fd('0x1e')]?_[_0x78fd('0x1f')](_0x112ff7[_0x78fd('0x1e')],function(_0x239939){return{'model':db[_0x239939[_0x78fd('0x20')]],'as':_0x239939['as'],'attributes':_0x239939['attributes']};}):[]};}):[]};}):[]:[]})[_0x78fd('0xe')](function(_0x422e14){logger[_0x78fd('0xf')](_0x78fd('0x22'),_0x4a02f0);logger[_0x78fd('0x23')](_0x78fd('0x22'),_0x4a02f0,JSON['stringify'](_0x422e14));_0x319853(_0x422e14);})['catch'](function(_0x1e6f76){logger[_0x78fd('0x13')](_0x78fd('0x22'),_0x1e6f76[_0x78fd('0x15')],_0x4a02f0);_0x5c4095(_0x363566['error'](0x1f4,_0x1e6f76[_0x78fd('0x15')]));});});};exports[_0x78fd('0x24')]=function(_0x29ab29){var _0x417b3d=this;return new Promise(function(_0x14429a,_0x473197){return db[_0x78fd('0x19')][_0x78fd('0x25')]({'raw':_0x29ab29['options']?_0x29ab29['options'][_0x78fd('0x26')]===undefined?!![]:![]:!![],'where':_0x29ab29['options']?_0x29ab29[_0x78fd('0x1b')][_0x78fd('0x1c')]||null:null,'attributes':_0x29ab29[_0x78fd('0x1b')]?_0x29ab29[_0x78fd('0x1b')]['attributes']||null:null,'include':_0x29ab29[_0x78fd('0x1b')]?_0x29ab29['options'][_0x78fd('0x1e')]?_[_0x78fd('0x1f')](_0x29ab29['options'][_0x78fd('0x1e')],function(_0x784d12){return{'model':db[_0x784d12[_0x78fd('0x20')]],'as':_0x784d12['as'],'attributes':_0x784d12[_0x78fd('0x21')],'include':_0x784d12[_0x78fd('0x1e')]?_[_0x78fd('0x1f')](_0x784d12['include'],function(_0x46e801){return{'model':db[_0x46e801[_0x78fd('0x20')]],'as':_0x46e801['as'],'attributes':_0x46e801['attributes'],'include':_0x46e801[_0x78fd('0x1e')]?_[_0x78fd('0x1f')](_0x46e801['include'],function(_0x1b683e){return{'model':db[_0x1b683e[_0x78fd('0x20')]],'as':_0x1b683e['as'],'attributes':_0x1b683e[_0x78fd('0x21')]};}):[]};}):[]};}):[]:[]})[_0x78fd('0xe')](function(_0xbfc0d6){logger['info'](_0x78fd('0x24'),_0x29ab29);logger[_0x78fd('0x23')](_0x78fd('0x24'),_0x29ab29,JSON[_0x78fd('0x12')](_0xbfc0d6));_0x14429a(_0xbfc0d6);})['catch'](function(_0x217b78){logger['error'](_0x78fd('0x24'),_0x217b78[_0x78fd('0x15')],_0x29ab29);_0x473197(_0x417b3d[_0x78fd('0x13')](0x1f4,_0x217b78[_0x78fd('0x15')]));});});};exports[_0x78fd('0x27')]=function(_0x4ca747){var _0xadbb88=this;return new Promise(function(_0x21587d,_0x31828d){return db['CmHopper'][_0x78fd('0x28')](_0x4ca747[_0x78fd('0x29')],{'raw':_0x4ca747[_0x78fd('0x1b')]?_0x4ca747[_0x78fd('0x1b')][_0x78fd('0x26')]===undefined?!![]:![]:!![]})[_0x78fd('0xe')](function(_0x4dfdc1){logger[_0x78fd('0xf')](_0x78fd('0x27'),_0x4ca747);logger[_0x78fd('0x23')]('CreateCmHopper',_0x4ca747,JSON['stringify'](_0x4dfdc1));_0x21587d(_0x4dfdc1);})[_0x78fd('0x18')](function(_0x1c1a24){logger['error'](_0x78fd('0x27'),_0x1c1a24[_0x78fd('0x15')],_0x4ca747);_0x31828d(_0xadbb88['error'](0x1f4,_0x1c1a24[_0x78fd('0x15')]));});});};exports['UpdateCmHopper']=function(_0x595048){var _0x371596=this;return new Promise(function(_0x547fd3,_0xd663f4){return db[_0x78fd('0x19')][_0x78fd('0x2a')](_0x595048[_0x78fd('0x29')],{'raw':_0x595048[_0x78fd('0x1b')]?_0x595048['options'][_0x78fd('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x595048[_0x78fd('0x1b')]?_0x595048['options'][_0x78fd('0x1c')]||null:null,'attributes':_0x595048[_0x78fd('0x1b')]?_0x595048[_0x78fd('0x1b')][_0x78fd('0x21')]||null:null,'limit':_0x595048['options']?_0x595048[_0x78fd('0x1b')][_0x78fd('0x1d')]||null:null})['then'](function(_0x15d0a8){logger[_0x78fd('0xf')](_0x78fd('0x2b'),_0x595048);logger['debug']('UpdateCmHopper',_0x595048,JSON[_0x78fd('0x12')](_0x15d0a8));_0x547fd3(_0x15d0a8);})['catch'](function(_0x1ea486){logger['error'](_0x78fd('0x2b'),_0x1ea486[_0x78fd('0x15')],_0x595048);_0xd663f4(_0x371596[_0x78fd('0x13')](0x1f4,_0x1ea486[_0x78fd('0x15')]));});});};exports['DestroyCmHopper']=function(_0x240ea3){var _0x1d9ba0=this;return new Promise(function(_0x14b655,_0x5cd17e){return db[_0x78fd('0x19')][_0x78fd('0x2c')]({'where':_0x240ea3[_0x78fd('0x1b')]?_0x240ea3[_0x78fd('0x1b')][_0x78fd('0x1c')]||null:null})['then'](function(_0x2eb5ef){logger[_0x78fd('0xf')](_0x78fd('0x2d'),_0x240ea3);logger[_0x78fd('0x23')]('DestroyCmHopper',_0x240ea3,JSON[_0x78fd('0x12')](_0x2eb5ef));_0x14b655(_0x2eb5ef);})[_0x78fd('0x18')](function(_0xe0fb77){logger[_0x78fd('0x13')](_0x78fd('0x2d'),_0xe0fb77[_0x78fd('0x15')],_0x240ea3);_0x5cd17e(_0x1d9ba0['error'](0x1f4,_0xe0fb77['message']));});});};exports[_0x78fd('0x2e')]=function(_0x496419){var _0x29d3a2=this;return new Promise(function(_0x544ce8,_0x1449ef){return db[_0x78fd('0x2f')][_0x78fd('0x30')]()['then'](function(_0x112940){return db[_0x78fd('0x31')][_0x78fd('0x32')](function(_0x3043f4){return db[_0x78fd('0x19')][_0x78fd('0x1a')]({'where':_0x496419[_0x78fd('0x1b')]?_0x496419[_0x78fd('0x1b')]['where']||null:null,'attributes':_0x496419[_0x78fd('0x1b')]?_0x496419[_0x78fd('0x1b')][_0x78fd('0x21')]||null:null,'limit':_0x496419['options']?_0x496419['options'][_0x78fd('0x1d')]||null:null,'order':_0x496419[_0x78fd('0x1b')]?_0x496419[_0x78fd('0x1b')][_0x78fd('0x33')]||null:null,'transaction':_0x3043f4,'lock':_0x3043f4[_0x78fd('0x34')][_0x78fd('0x35')],'include':[{'model':db['CmContact'],'as':_0x78fd('0x36'),'attributes':_[_0x78fd('0x37')](_0x112940)},{'model':db[_0x78fd('0x38')],'as':_0x78fd('0x39'),'attributes':['id',_0x78fd('0x3a'),_0x78fd('0x3b')]}]})[_0x78fd('0xe')](function(_0x22af76){var _0x11b493=[];var _0x1ec16a=[];for(var _0x1e4a41=0x0;_0x1e4a41<_0x22af76[_0x78fd('0x3c')];_0x1e4a41+=0x1){var _0x4b2559=_0x22af76[_0x1e4a41][_0x78fd('0x3d')];if(_0x4b2559===null){_0x11b493[_0x78fd('0x3e')](_0x22af76[_0x1e4a41]['update'](_0x496419[_0x78fd('0x29')],{'transaction':_0x3043f4}));}else if(!_0x1ec16a[_0x78fd('0x3f')](_0x4b2559)){_0x1ec16a['push'](_0x4b2559);_0x11b493[_0x78fd('0x3e')](_0x22af76[_0x1e4a41]['update'](_0x496419[_0x78fd('0x29')],{'transaction':_0x3043f4}));}}return BPromise[_0x78fd('0x40')](_0x11b493);});})[_0x78fd('0xe')](function(_0x6c7eed){logger[_0x78fd('0xf')](_0x78fd('0x2e'),_0x496419);logger[_0x78fd('0x23')](_0x78fd('0x2e'),_0x496419,JSON[_0x78fd('0x12')](_0x6c7eed));_0x544ce8(_0x6c7eed);})[_0x78fd('0x18')](function(_0x4feb0c){logger['error'](_0x78fd('0x2e'),_0x4feb0c[_0x78fd('0x15')],_0x496419);_0x1449ef(_0x29d3a2[_0x78fd('0x13')](0x1f4,_0x4feb0c['message']));});});});};exports[_0x78fd('0x41')]=function(_0x4f2fb9){var _0x454bb2=this;return new Promise(function(_0x2eb216,_0x4db0b1){return db['sequelize'][_0x78fd('0x32')](function(_0x4139d4){return db[_0x78fd('0x42')][_0x78fd('0x28')](_0x4f2fb9[_0x78fd('0x29')],{'raw':_0x4f2fb9[_0x78fd('0x1b')]?_0x4f2fb9[_0x78fd('0x1b')][_0x78fd('0x26')]===undefined?!![]:![]:!![],'transaction':_0x4139d4})[_0x78fd('0xe')](function(){return db['CmHopper'][_0x78fd('0x2c')]({'where':_0x4f2fb9[_0x78fd('0x1b')]?_0x4f2fb9[_0x78fd('0x1b')][_0x78fd('0x1c')]||null:null,'transaction':_0x4139d4});});})[_0x78fd('0xe')](function(_0x2118f4){logger['info'](_0x78fd('0x41'),_0x4f2fb9);logger[_0x78fd('0x23')]('MoveContactManagedDialer',_0x4f2fb9,JSON[_0x78fd('0x12')](_0x2118f4));_0x2eb216(_0x2118f4);})[_0x78fd('0x18')](function(_0x3be5e9){logger[_0x78fd('0x13')](_0x78fd('0x41'),_0x3be5e9[_0x78fd('0x15')],_0x4f2fb9);_0x4db0b1(_0x454bb2[_0x78fd('0x13')](0x1f4,_0x3be5e9[_0x78fd('0x15')]));});});};exports[_0x78fd('0x43')]=function(_0x247b2a){var _0x4a382d=this;return new Promise(function(_0x3f47e4,_0x3dde8a){return db[_0x78fd('0x19')][_0x78fd('0x1a')]({'raw':_0x247b2a[_0x78fd('0x1b')]?_0x247b2a[_0x78fd('0x1b')][_0x78fd('0x26')]===undefined?!![]:![]:!![],'where':_0x247b2a[_0x78fd('0x1b')]?_0x247b2a[_0x78fd('0x1b')][_0x78fd('0x1c')]||null:null,'attributes':[[db[_0x78fd('0x31')]['fn'](_0x78fd('0x44'),db[_0x78fd('0x31')]['fn']('IF',db['sequelize'][_0x78fd('0x45')](_0x78fd('0x46')+util[_0x78fd('0x47')](_0x78fd('0x48'),moment()[_0x78fd('0x47')](_0x78fd('0x49')))+_0x78fd('0x4a')))),_0x78fd('0x4b')]]})['then'](function(_0x3ab70d){logger['info']('CountReScheduled',_0x247b2a);logger[_0x78fd('0x23')](_0x78fd('0x43'),_0x247b2a,JSON[_0x78fd('0x12')](_0x3ab70d));_0x3f47e4(_0x3ab70d);})[_0x78fd('0x18')](function(_0x35dfbf){logger['error'](_0x78fd('0x43'),_0x35dfbf['message'],_0x247b2a);_0x3dde8a(_0x4a382d[_0x78fd('0x13')](0x1f4,_0x35dfbf[_0x78fd('0x15')]));});});};exports[_0x78fd('0x4c')]=function(_0x1fcee2){var _0xcb4fdd=this;return new Promise(function(_0x21ae7a,_0x16de37){return db[_0x78fd('0x2f')][_0x78fd('0x30')]()[_0x78fd('0xe')](function(_0x2d98a1){return db[_0x78fd('0x31')][_0x78fd('0x32')](function(_0x4e34f5){return db[_0x78fd('0x19')][_0x78fd('0x1a')]({'where':_0x1fcee2[_0x78fd('0x1b')]?_0x1fcee2[_0x78fd('0x1b')][_0x78fd('0x1c')]||null:null,'attributes':_0x1fcee2[_0x78fd('0x1b')]?_0x1fcee2[_0x78fd('0x1b')]['attributes']||null:null,'limit':0x1,'order':_0x1fcee2[_0x78fd('0x1b')]?_0x1fcee2['options']['order']||null:null,'group':db[_0x78fd('0x19')]['UserId'],'transaction':_0x4e34f5,'lock':_0x4e34f5['LOCK'][_0x78fd('0x35')],'include':_0x1fcee2[_0x78fd('0x1b')]?_0x1fcee2[_0x78fd('0x1b')]['include']?_[_0x78fd('0x1f')](_0x1fcee2[_0x78fd('0x1b')]['include'],function(_0x21d907){return{'model':db[_0x21d907[_0x78fd('0x20')]],'as':_0x21d907['as'],'attributes':_0x21d907[_0x78fd('0x21')],'include':_0x21d907[_0x78fd('0x1e')]?_['map'](_0x21d907[_0x78fd('0x1e')],function(_0x6da2f3){return{'model':db[_0x6da2f3[_0x78fd('0x20')]],'as':_0x6da2f3['as'],'attributes':_0x6da2f3[_0x78fd('0x21')],'include':_0x6da2f3[_0x78fd('0x1e')]?_[_0x78fd('0x1f')](_0x6da2f3[_0x78fd('0x1e')],function(_0x1b105a){return{'model':db[_0x1b105a[_0x78fd('0x20')]],'as':_0x1b105a['as'],'attributes':_0x1b105a[_0x78fd('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3db801){var _0x53fa5a=[];for(var _0x9664c7=0x0;_0x9664c7<_0x3db801['length'];_0x9664c7+=0x1){_0x53fa5a[_0x78fd('0x3e')](_0x3db801[_0x9664c7][_0x78fd('0x2a')](_0x1fcee2['body'],{'transaction':_0x4e34f5}));}return BPromise[_0x78fd('0x40')](_0x53fa5a);});})[_0x78fd('0xe')](function(_0x4e7225){logger[_0x78fd('0xf')](_0x78fd('0x4c'),_0x1fcee2);logger['debug']('GetContactRecallMe',_0x1fcee2,JSON[_0x78fd('0x12')](_0x4e7225));_0x21ae7a(_0x4e7225);})['catch'](function(_0x29e880){logger[_0x78fd('0x13')](_0x78fd('0x4c'),_0x29e880[_0x78fd('0x15')],_0x1fcee2);_0x16de37(_0xcb4fdd[_0x78fd('0x13')](0x1f4,_0x29e880[_0x78fd('0x15')]));});});});};exports[_0x78fd('0x4d')]=function(_0x2379d0){var _0x84ad19=this;return new Promise(function(_0x9f6b6,_0x43b3f2){db['CmContact']['describe']()[_0x78fd('0xe')](function(_0x264684){return db['CmHopper'][_0x78fd('0x1a')]({'raw':_0x2379d0[_0x78fd('0x1b')]?_0x2379d0[_0x78fd('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2379d0[_0x78fd('0x1b')]?_0x2379d0[_0x78fd('0x1b')]['where']||null:null,'attributes':_0x2379d0[_0x78fd('0x1b')]?_0x2379d0['options'][_0x78fd('0x21')]||null:null,'limit':_0x2379d0['options']?_0x2379d0[_0x78fd('0x1b')]['limit']||null:null,'include':_0x2379d0[_0x78fd('0x1b')]?_0x2379d0[_0x78fd('0x1b')][_0x78fd('0x1e')]?_[_0x78fd('0x1f')](_0x2379d0[_0x78fd('0x1b')][_0x78fd('0x1e')],function(_0x4e677a){return{'model':db[_0x4e677a[_0x78fd('0x20')]],'as':_0x4e677a['as'],'attributes':_0x4e677a['as']==='Contact'?_[_0x78fd('0x37')](_0x264684):_0x4e677a[_0x78fd('0x21')],'include':_0x4e677a[_0x78fd('0x1e')]?_[_0x78fd('0x1f')](_0x4e677a['include'],function(_0x48e361){return{'model':db[_0x48e361[_0x78fd('0x20')]],'as':_0x48e361['as'],'attributes':_0x48e361[_0x78fd('0x21')],'include':_0x48e361[_0x78fd('0x1e')]?_[_0x78fd('0x1f')](_0x48e361[_0x78fd('0x1e')],function(_0x2366f4){return{'model':db[_0x2366f4['model']],'as':_0x2366f4['as'],'attributes':_0x2366f4[_0x78fd('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ea1da){logger[_0x78fd('0xf')](_0x78fd('0x22'),_0x2379d0);logger[_0x78fd('0x23')](_0x78fd('0x22'),_0x2379d0,JSON[_0x78fd('0x12')](_0x4ea1da));_0x9f6b6(_0x4ea1da);})[_0x78fd('0x18')](function(_0xa8d018){logger[_0x78fd('0x13')](_0x78fd('0x22'),_0xa8d018[_0x78fd('0x15')],_0x2379d0);_0x43b3f2(_0x84ad19[_0x78fd('0x13')](0x1f4,_0xa8d018[_0x78fd('0x15')]));});});});}; \ No newline at end of file +var _0xe096=['model','catch','CmHopper','find','ShowCmHopper','CreateCmHopper','create','body','stringify','UpdateCmHopper','update','limit','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','keys','User','Agent','name','voicePause','length','UserId','push','includes','all','MoveContactManagedDialer','CmHopperFinal','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','GetCmHopperPreview','Contact','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','message','GetCmHopper','findAll','options','raw','where','attributes','include','map'];(function(_0x109294,_0x35122c){var _0x788554=function(_0x2e33b4){while(--_0x2e33b4){_0x109294['push'](_0x109294['shift']());}};_0x788554(++_0x35122c);}(_0xe096,0x198));var _0x6e09=function(_0x3de4f8,_0x336c7d){_0x3de4f8=_0x3de4f8-0x0;var _0x3d81fc=_0xe096[_0x3de4f8];return _0x3d81fc;};'use strict';var _=require(_0x6e09('0x0'));var util=require(_0x6e09('0x1'));var moment=require(_0x6e09('0x2'));var BPromise=require(_0x6e09('0x3'));var rs=require(_0x6e09('0x4'));var fs=require('fs');var Redis=require(_0x6e09('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e09('0x6'));var logger=require(_0x6e09('0x7'))(_0x6e09('0x8'));var config=require(_0x6e09('0x9'));var jayson=require(_0x6e09('0xa'));var client=jayson[_0x6e09('0xb')][_0x6e09('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55d2e8,_0xccd0ba,_0x14b58e){return new BPromise(function(_0x5443ee,_0x11b680){return client[_0x6e09('0xd')](_0x55d2e8,_0x14b58e)[_0x6e09('0xe')](function(_0x549554){logger[_0x6e09('0xf')](_0x6e09('0x10'),_0xccd0ba,_0x6e09('0x11'));logger[_0x6e09('0x12')](_0x6e09('0x13'),_0xccd0ba,_0x6e09('0x11'),JSON['stringify'](_0x549554));if(_0x549554[_0x6e09('0x14')]){if(_0x549554[_0x6e09('0x14')]['code']===0x1f4){logger['error'](_0x6e09('0x10'),_0xccd0ba,_0x549554[_0x6e09('0x14')][_0x6e09('0x15')]);return _0x11b680(_0x549554['error'][_0x6e09('0x15')]);}logger[_0x6e09('0x14')](_0x6e09('0x10'),_0xccd0ba,_0x549554[_0x6e09('0x14')]['message']);return _0x5443ee(_0x549554['error']['message']);}else{logger[_0x6e09('0xf')](_0x6e09('0x10'),_0xccd0ba,_0x6e09('0x11'));_0x5443ee(_0x549554['result'][_0x6e09('0x15')]);}})['catch'](function(_0x11d7ce){logger[_0x6e09('0x14')](_0x6e09('0x10'),_0xccd0ba,_0x11d7ce);_0x11b680(_0x11d7ce);});});}exports[_0x6e09('0x16')]=function(_0x5ac8aa){var _0x34de8c=this;return new Promise(function(_0x2f1330,_0x1be2ad){return db['CmHopper'][_0x6e09('0x17')]({'raw':_0x5ac8aa[_0x6e09('0x18')]?_0x5ac8aa[_0x6e09('0x18')][_0x6e09('0x19')]===undefined?!![]:![]:!![],'where':_0x5ac8aa[_0x6e09('0x18')]?_0x5ac8aa[_0x6e09('0x18')][_0x6e09('0x1a')]||null:null,'attributes':_0x5ac8aa[_0x6e09('0x18')]?_0x5ac8aa[_0x6e09('0x18')][_0x6e09('0x1b')]||null:null,'limit':_0x5ac8aa[_0x6e09('0x18')]?_0x5ac8aa[_0x6e09('0x18')]['limit']||null:null,'include':_0x5ac8aa[_0x6e09('0x18')]?_0x5ac8aa['options'][_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0x5ac8aa[_0x6e09('0x18')][_0x6e09('0x1c')],function(_0x224a8e){return{'model':db[_0x224a8e['model']],'as':_0x224a8e['as'],'attributes':_0x224a8e[_0x6e09('0x1b')],'include':_0x224a8e['include']?_['map'](_0x224a8e[_0x6e09('0x1c')],function(_0x404f9d){return{'model':db[_0x404f9d[_0x6e09('0x1e')]],'as':_0x404f9d['as'],'attributes':_0x404f9d['attributes'],'include':_0x404f9d[_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0x404f9d[_0x6e09('0x1c')],function(_0x4224aa){return{'model':db[_0x4224aa[_0x6e09('0x1e')]],'as':_0x4224aa['as'],'attributes':_0x4224aa[_0x6e09('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d40bb){logger[_0x6e09('0xf')](_0x6e09('0x16'),_0x5ac8aa);logger['debug'](_0x6e09('0x16'),_0x5ac8aa,JSON['stringify'](_0x5d40bb));_0x2f1330(_0x5d40bb);})[_0x6e09('0x1f')](function(_0x3bfb08){logger[_0x6e09('0x14')](_0x6e09('0x16'),_0x3bfb08[_0x6e09('0x15')],_0x5ac8aa);_0x1be2ad(_0x34de8c[_0x6e09('0x14')](0x1f4,_0x3bfb08['message']));});});};exports['ShowCmHopper']=function(_0x120cbb){var _0x42d4be=this;return new Promise(function(_0x378a8c,_0x116477){return db[_0x6e09('0x20')][_0x6e09('0x21')]({'raw':_0x120cbb['options']?_0x120cbb[_0x6e09('0x18')][_0x6e09('0x19')]===undefined?!![]:![]:!![],'where':_0x120cbb['options']?_0x120cbb[_0x6e09('0x18')][_0x6e09('0x1a')]||null:null,'attributes':_0x120cbb['options']?_0x120cbb['options'][_0x6e09('0x1b')]||null:null,'include':_0x120cbb[_0x6e09('0x18')]?_0x120cbb[_0x6e09('0x18')][_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0x120cbb[_0x6e09('0x18')]['include'],function(_0x11a296){return{'model':db[_0x11a296[_0x6e09('0x1e')]],'as':_0x11a296['as'],'attributes':_0x11a296[_0x6e09('0x1b')],'include':_0x11a296['include']?_[_0x6e09('0x1d')](_0x11a296[_0x6e09('0x1c')],function(_0x234d44){return{'model':db[_0x234d44['model']],'as':_0x234d44['as'],'attributes':_0x234d44[_0x6e09('0x1b')],'include':_0x234d44[_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0x234d44[_0x6e09('0x1c')],function(_0x53552a){return{'model':db[_0x53552a['model']],'as':_0x53552a['as'],'attributes':_0x53552a[_0x6e09('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6e09('0xe')](function(_0x26634f){logger['info'](_0x6e09('0x22'),_0x120cbb);logger[_0x6e09('0x12')]('ShowCmHopper',_0x120cbb,JSON['stringify'](_0x26634f));_0x378a8c(_0x26634f);})[_0x6e09('0x1f')](function(_0x208894){logger[_0x6e09('0x14')](_0x6e09('0x22'),_0x208894[_0x6e09('0x15')],_0x120cbb);_0x116477(_0x42d4be[_0x6e09('0x14')](0x1f4,_0x208894[_0x6e09('0x15')]));});});};exports[_0x6e09('0x23')]=function(_0x248bc0){var _0x1e1395=this;return new Promise(function(_0x20246e,_0x41e98d){return db[_0x6e09('0x20')][_0x6e09('0x24')](_0x248bc0[_0x6e09('0x25')],{'raw':_0x248bc0['options']?_0x248bc0[_0x6e09('0x18')][_0x6e09('0x19')]===undefined?!![]:![]:!![]})[_0x6e09('0xe')](function(_0x2ba826){logger[_0x6e09('0xf')](_0x6e09('0x23'),_0x248bc0);logger[_0x6e09('0x12')](_0x6e09('0x23'),_0x248bc0,JSON[_0x6e09('0x26')](_0x2ba826));_0x20246e(_0x2ba826);})[_0x6e09('0x1f')](function(_0x666fce){logger['error'](_0x6e09('0x23'),_0x666fce['message'],_0x248bc0);_0x41e98d(_0x1e1395[_0x6e09('0x14')](0x1f4,_0x666fce['message']));});});};exports[_0x6e09('0x27')]=function(_0x3a9c8e){var _0x313d60=this;return new Promise(function(_0x39b6a6,_0x5551a5){return db[_0x6e09('0x20')][_0x6e09('0x28')](_0x3a9c8e[_0x6e09('0x25')],{'raw':_0x3a9c8e[_0x6e09('0x18')]?_0x3a9c8e[_0x6e09('0x18')][_0x6e09('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a9c8e[_0x6e09('0x18')]?_0x3a9c8e['options'][_0x6e09('0x1a')]||null:null,'attributes':_0x3a9c8e['options']?_0x3a9c8e[_0x6e09('0x18')]['attributes']||null:null,'limit':_0x3a9c8e[_0x6e09('0x18')]?_0x3a9c8e[_0x6e09('0x18')][_0x6e09('0x29')]||null:null})['then'](function(_0x2b1154){logger[_0x6e09('0xf')](_0x6e09('0x27'),_0x3a9c8e);logger[_0x6e09('0x12')](_0x6e09('0x27'),_0x3a9c8e,JSON[_0x6e09('0x26')](_0x2b1154));_0x39b6a6(_0x2b1154);})[_0x6e09('0x1f')](function(_0x54cd46){logger[_0x6e09('0x14')](_0x6e09('0x27'),_0x54cd46[_0x6e09('0x15')],_0x3a9c8e);_0x5551a5(_0x313d60[_0x6e09('0x14')](0x1f4,_0x54cd46[_0x6e09('0x15')]));});});};exports[_0x6e09('0x2a')]=function(_0x4be4cc){var _0x22a6a2=this;return new Promise(function(_0x33b4b7,_0x514e2a){return db[_0x6e09('0x20')]['destroy']({'where':_0x4be4cc[_0x6e09('0x18')]?_0x4be4cc['options'][_0x6e09('0x1a')]||null:null})[_0x6e09('0xe')](function(_0x17954f){logger[_0x6e09('0xf')]('DestroyCmHopper',_0x4be4cc);logger[_0x6e09('0x12')]('DestroyCmHopper',_0x4be4cc,JSON[_0x6e09('0x26')](_0x17954f));_0x33b4b7(_0x17954f);})['catch'](function(_0x948a55){logger[_0x6e09('0x14')](_0x6e09('0x2a'),_0x948a55[_0x6e09('0x15')],_0x4be4cc);_0x514e2a(_0x22a6a2[_0x6e09('0x14')](0x1f4,_0x948a55[_0x6e09('0x15')]));});});};exports[_0x6e09('0x2b')]=function(_0x371fdd){var _0x1e9655=this;return new Promise(function(_0x4c1fd3,_0x2f7ffe){return db[_0x6e09('0x2c')][_0x6e09('0x2d')]()[_0x6e09('0xe')](function(_0x5a5f30){return db[_0x6e09('0x2e')][_0x6e09('0x2f')](function(_0x537018){return db[_0x6e09('0x20')]['findAll']({'where':_0x371fdd[_0x6e09('0x18')]?_0x371fdd[_0x6e09('0x18')]['where']||null:null,'attributes':_0x371fdd[_0x6e09('0x18')]?_0x371fdd[_0x6e09('0x18')][_0x6e09('0x1b')]||null:null,'limit':_0x371fdd[_0x6e09('0x18')]?_0x371fdd[_0x6e09('0x18')][_0x6e09('0x29')]||null:null,'order':_0x371fdd[_0x6e09('0x18')]?_0x371fdd['options'][_0x6e09('0x30')]||null:null,'transaction':_0x537018,'lock':_0x537018[_0x6e09('0x31')]['UPDATE'],'include':[{'model':db[_0x6e09('0x2c')],'as':'Contact','attributes':_[_0x6e09('0x32')](_0x5a5f30)},{'model':db[_0x6e09('0x33')],'as':_0x6e09('0x34'),'attributes':['id',_0x6e09('0x35'),_0x6e09('0x36')]}]})[_0x6e09('0xe')](function(_0x3d9b84){var _0x32a48c=[];var _0x13f6f1=[];for(var _0x4ab7ab=0x0;_0x4ab7ab<_0x3d9b84[_0x6e09('0x37')];_0x4ab7ab+=0x1){var _0x5346f2=_0x3d9b84[_0x4ab7ab][_0x6e09('0x38')];if(_0x5346f2===null){_0x32a48c[_0x6e09('0x39')](_0x3d9b84[_0x4ab7ab][_0x6e09('0x28')](_0x371fdd[_0x6e09('0x25')],{'transaction':_0x537018}));}else if(!_0x13f6f1[_0x6e09('0x3a')](_0x5346f2)){_0x13f6f1[_0x6e09('0x39')](_0x5346f2);_0x32a48c[_0x6e09('0x39')](_0x3d9b84[_0x4ab7ab][_0x6e09('0x28')](_0x371fdd['body'],{'transaction':_0x537018}));}}return BPromise[_0x6e09('0x3b')](_0x32a48c);});})[_0x6e09('0xe')](function(_0x180e27){logger[_0x6e09('0xf')](_0x6e09('0x2b'),_0x371fdd);logger[_0x6e09('0x12')](_0x6e09('0x2b'),_0x371fdd,JSON[_0x6e09('0x26')](_0x180e27));_0x4c1fd3(_0x180e27);})[_0x6e09('0x1f')](function(_0x3f8bdc){logger['error'](_0x6e09('0x2b'),_0x3f8bdc[_0x6e09('0x15')],_0x371fdd);_0x2f7ffe(_0x1e9655[_0x6e09('0x14')](0x1f4,_0x3f8bdc[_0x6e09('0x15')]));});});});};exports[_0x6e09('0x3c')]=function(_0xc4f15b){var _0x37d9d4=this;return new Promise(function(_0x58cf11,_0x4756b1){return db[_0x6e09('0x2e')][_0x6e09('0x2f')](function(_0x2d4e39){return db[_0x6e09('0x3d')][_0x6e09('0x24')](_0xc4f15b['body'],{'raw':_0xc4f15b['options']?_0xc4f15b['options'][_0x6e09('0x19')]===undefined?!![]:![]:!![],'transaction':_0x2d4e39})['then'](function(){return db[_0x6e09('0x20')][_0x6e09('0x3e')]({'where':_0xc4f15b[_0x6e09('0x18')]?_0xc4f15b[_0x6e09('0x18')][_0x6e09('0x1a')]||null:null,'transaction':_0x2d4e39});});})[_0x6e09('0xe')](function(_0xbcade7){logger[_0x6e09('0xf')](_0x6e09('0x3c'),_0xc4f15b);logger[_0x6e09('0x12')](_0x6e09('0x3c'),_0xc4f15b,JSON[_0x6e09('0x26')](_0xbcade7));_0x58cf11(_0xbcade7);})[_0x6e09('0x1f')](function(_0x351b4a){logger[_0x6e09('0x14')](_0x6e09('0x3c'),_0x351b4a[_0x6e09('0x15')],_0xc4f15b);_0x4756b1(_0x37d9d4[_0x6e09('0x14')](0x1f4,_0x351b4a[_0x6e09('0x15')]));});});};exports[_0x6e09('0x3f')]=function(_0x292223){var _0xe50cf6=this;return new Promise(function(_0x3b6e5c,_0x5b5cf9){return db[_0x6e09('0x20')][_0x6e09('0x17')]({'raw':_0x292223[_0x6e09('0x18')]?_0x292223[_0x6e09('0x18')][_0x6e09('0x19')]===undefined?!![]:![]:!![],'where':_0x292223['options']?_0x292223['options'][_0x6e09('0x1a')]||null:null,'attributes':[[db[_0x6e09('0x2e')]['fn'](_0x6e09('0x40'),db['sequelize']['fn']('IF',db[_0x6e09('0x2e')][_0x6e09('0x41')](_0x6e09('0x42')+util[_0x6e09('0x43')]('\x22%s\x22',moment()[_0x6e09('0x43')](_0x6e09('0x44')))+_0x6e09('0x45')))),'contactsRescheduled']]})[_0x6e09('0xe')](function(_0x1029c9){logger[_0x6e09('0xf')](_0x6e09('0x3f'),_0x292223);logger[_0x6e09('0x12')](_0x6e09('0x3f'),_0x292223,JSON[_0x6e09('0x26')](_0x1029c9));_0x3b6e5c(_0x1029c9);})[_0x6e09('0x1f')](function(_0x264c23){logger[_0x6e09('0x14')](_0x6e09('0x3f'),_0x264c23['message'],_0x292223);_0x5b5cf9(_0xe50cf6['error'](0x1f4,_0x264c23[_0x6e09('0x15')]));});});};exports[_0x6e09('0x46')]=function(_0xaed3c5){var _0x423805=this;return new Promise(function(_0x5cfec3,_0x1b36b6){return db[_0x6e09('0x2c')][_0x6e09('0x2d')]()[_0x6e09('0xe')](function(_0x5bd39b){return db[_0x6e09('0x2e')][_0x6e09('0x2f')](function(_0x1de486){return db[_0x6e09('0x20')][_0x6e09('0x17')]({'where':_0xaed3c5[_0x6e09('0x18')]?_0xaed3c5[_0x6e09('0x18')]['where']||null:null,'attributes':_0xaed3c5['options']?_0xaed3c5[_0x6e09('0x18')][_0x6e09('0x1b')]||null:null,'limit':0x1,'order':_0xaed3c5[_0x6e09('0x18')]?_0xaed3c5[_0x6e09('0x18')]['order']||null:null,'group':db[_0x6e09('0x20')][_0x6e09('0x38')],'transaction':_0x1de486,'lock':_0x1de486[_0x6e09('0x31')]['UPDATE'],'include':_0xaed3c5[_0x6e09('0x18')]?_0xaed3c5[_0x6e09('0x18')][_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0xaed3c5[_0x6e09('0x18')]['include'],function(_0x168c66){return{'model':db[_0x168c66[_0x6e09('0x1e')]],'as':_0x168c66['as'],'attributes':_0x168c66[_0x6e09('0x1b')],'include':_0x168c66[_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0x168c66[_0x6e09('0x1c')],function(_0xb1344f){return{'model':db[_0xb1344f[_0x6e09('0x1e')]],'as':_0xb1344f['as'],'attributes':_0xb1344f[_0x6e09('0x1b')],'include':_0xb1344f[_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0xb1344f[_0x6e09('0x1c')],function(_0x490fc2){return{'model':db[_0x490fc2[_0x6e09('0x1e')]],'as':_0x490fc2['as'],'attributes':_0x490fc2[_0x6e09('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6e09('0xe')](function(_0x56615a){var _0x10fa68=[];for(var _0x1e150c=0x0;_0x1e150c<_0x56615a['length'];_0x1e150c+=0x1){_0x10fa68[_0x6e09('0x39')](_0x56615a[_0x1e150c][_0x6e09('0x28')](_0xaed3c5['body'],{'transaction':_0x1de486}));}return BPromise[_0x6e09('0x3b')](_0x10fa68);});})[_0x6e09('0xe')](function(_0x2411f3){logger[_0x6e09('0xf')]('GetContactRecallMe',_0xaed3c5);logger[_0x6e09('0x12')](_0x6e09('0x46'),_0xaed3c5,JSON[_0x6e09('0x26')](_0x2411f3));_0x5cfec3(_0x2411f3);})[_0x6e09('0x1f')](function(_0x432c0a){logger['error'](_0x6e09('0x46'),_0x432c0a[_0x6e09('0x15')],_0xaed3c5);_0x1b36b6(_0x423805[_0x6e09('0x14')](0x1f4,_0x432c0a[_0x6e09('0x15')]));});});});};exports[_0x6e09('0x47')]=function(_0x28430c){var _0x9103b0=this;return new Promise(function(_0x149e8e,_0x52cace){db['CmContact'][_0x6e09('0x2d')]()[_0x6e09('0xe')](function(_0x4d91a4){return db[_0x6e09('0x20')][_0x6e09('0x17')]({'raw':_0x28430c['options']?_0x28430c['options']['raw']===undefined?!![]:![]:!![],'where':_0x28430c[_0x6e09('0x18')]?_0x28430c[_0x6e09('0x18')]['where']||null:null,'attributes':_0x28430c[_0x6e09('0x18')]?_0x28430c[_0x6e09('0x18')][_0x6e09('0x1b')]||null:null,'limit':_0x28430c[_0x6e09('0x18')]?_0x28430c[_0x6e09('0x18')]['limit']||null:null,'include':_0x28430c[_0x6e09('0x18')]?_0x28430c['options'][_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0x28430c[_0x6e09('0x18')][_0x6e09('0x1c')],function(_0x1454a7){return{'model':db[_0x1454a7[_0x6e09('0x1e')]],'as':_0x1454a7['as'],'attributes':_0x1454a7['as']===_0x6e09('0x48')?_[_0x6e09('0x32')](_0x4d91a4):_0x1454a7[_0x6e09('0x1b')],'include':_0x1454a7['include']?_[_0x6e09('0x1d')](_0x1454a7[_0x6e09('0x1c')],function(_0x4d4776){return{'model':db[_0x4d4776['model']],'as':_0x4d4776['as'],'attributes':_0x4d4776[_0x6e09('0x1b')],'include':_0x4d4776[_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0x4d4776[_0x6e09('0x1c')],function(_0x1510bc){return{'model':db[_0x1510bc['model']],'as':_0x1510bc['as'],'attributes':_0x1510bc[_0x6e09('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6e09('0xe')](function(_0x2d462f){logger[_0x6e09('0xf')]('GetCmHopper',_0x28430c);logger[_0x6e09('0x12')](_0x6e09('0x16'),_0x28430c,JSON[_0x6e09('0x26')](_0x2d462f));_0x149e8e(_0x2d462f);})['catch'](function(_0x44b5f6){logger[_0x6e09('0x14')](_0x6e09('0x16'),_0x44b5f6['message'],_0x28430c);_0x52cace(_0x9103b0[_0x6e09('0x14')](0x1f4,_0x44b5f6[_0x6e09('0x15')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 59502da..2e29562 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 _0x5636=['put','/:id','update','delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','show','post','/preview','getPreview'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0x5636,0x102));var _0x6563=function(_0x428e48,_0x17d493){_0x428e48=_0x428e48-0x0;var _0x5b7997=_0x5636[_0x428e48];return _0x5b7997;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6563('0x2')]();var fs_extra=require(_0x6563('0x3'));var auth=require(_0x6563('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6563('0x5'));var controller=require(_0x6563('0x6'));router[_0x6563('0x7')]('/',auth[_0x6563('0x8')](),controller[_0x6563('0x9')]);router[_0x6563('0x7')](_0x6563('0xa'),auth[_0x6563('0x8')](),controller[_0x6563('0xb')]);router[_0x6563('0x7')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0xd')]);router['get']('/:id',auth[_0x6563('0x8')](),controller[_0x6563('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6563('0xf')](_0x6563('0x10'),auth[_0x6563('0x8')](),controller[_0x6563('0x11')]);router[_0x6563('0x12')](_0x6563('0x13'),auth[_0x6563('0x8')](),controller[_0x6563('0x14')]);router[_0x6563('0x15')]('/:id',auth[_0x6563('0x8')](),controller['destroy']);module[_0x6563('0x16')]=router; \ No newline at end of file +var _0x24ca=['/describe','/opencontacts','/:id','show','post','create','/preview','getPreview','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index'];(function(_0x2ec842,_0x296cf2){var _0x100825=function(_0x582dc9){while(--_0x582dc9){_0x2ec842['push'](_0x2ec842['shift']());}};_0x100825(++_0x296cf2);}(_0x24ca,0x1bc));var _0xa24c=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0x24ca[_0x5ac84c];return _0x3c53d2;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var fs_extra=require(_0xa24c('0x4'));var auth=require(_0xa24c('0x5'));var interaction=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var controller=require(_0xa24c('0x8'));router[_0xa24c('0x9')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0xb')]);router[_0xa24c('0x9')](_0xa24c('0xc'),auth[_0xa24c('0xa')](),controller['describe']);router[_0xa24c('0x9')](_0xa24c('0xd'),auth[_0xa24c('0xa')](),controller['getOpenContacts']);router[_0xa24c('0x9')](_0xa24c('0xe'),auth[_0xa24c('0xa')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0x11')]);router[_0xa24c('0x10')](_0xa24c('0x12'),auth['isAuthenticated'](),controller[_0xa24c('0x13')]);router[_0xa24c('0x14')](_0xa24c('0xe'),auth[_0xa24c('0xa')](),controller['update']);router[_0xa24c('0x15')](_0xa24c('0xe'),auth[_0xa24c('0xa')](),controller[_0xa24c('0x16')]);module[_0xa24c('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 5579aed..30fe533 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x701a=['STRING','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x33fe84,_0x4c1888){var _0x1f0d45=function(_0x3a0cfb){while(--_0x3a0cfb){_0x33fe84['push'](_0x33fe84['shift']());}};_0x1f0d45(++_0x4c1888);}(_0x701a,0x18d));var _0xa701=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0x701a[_0x55ff3e];return _0x2709eb;};'use strict';var moment=require(_0xa701('0x0'));var Sequelize=require(_0xa701('0x1'));module[_0xa701('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0xa701('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xa701('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xa701('0x5')],'defaultValue':moment()[_0xa701('0x6')](_0xa701('0x7'))},'countbusyretry':{'type':Sequelize[_0xa701('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa701('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa701('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xa701('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa701('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa701('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x05d9=['exports','INTEGER','STRING','DATE','moment','sequelize'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0x05d9,0xca));var _0x905d=function(_0x223b67,_0x18f77f){_0x223b67=_0x223b67-0x0;var _0x16bfc1=_0x05d9[_0x223b67];return _0x16bfc1;};'use strict';var moment=require(_0x905d('0x0'));var Sequelize=require(_0x905d('0x1'));module[_0x905d('0x2')]={'CmHopperId':{'type':Sequelize[_0x905d('0x3')]},'phone':{'type':Sequelize[_0x905d('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x905d('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x905d('0x5')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x905d('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x905d('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x905d('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x905d('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index dda8f57..6267276 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0515=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','render','merge','body','contact','message','interaction','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','VIRTUAL','filter','options','includeAll','rows','catch','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring'];(function(_0x4aa7c1,_0x4fb353){var _0x5369a2=function(_0x4eb413){while(--_0x4eb413){_0x4aa7c1['push'](_0x4aa7c1['shift']());}};_0x5369a2(++_0x4fb353);}(_0x0515,0x155));var _0x5051=function(_0x14723d,_0x4e09de){_0x14723d=_0x14723d-0x0;var _0x53227d=_0x0515[_0x14723d];return _0x53227d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5051('0x0'));var jsonpatch=require(_0x5051('0x1'));var rp=require(_0x5051('0x2'));var moment=require(_0x5051('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5051('0x4'));var util=require('util');var path=require(_0x5051('0x5'));var sox=require(_0x5051('0x6'));var csv=require('to-csv');var ejs=require(_0x5051('0x7'));var fs=require('fs');var fs_extra=require(_0x5051('0x8'));var _=require(_0x5051('0x9'));var squel=require(_0x5051('0xa'));var crypto=require(_0x5051('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5051('0xc'));var toCsv=require(_0x5051('0xd'));var querystring=require(_0x5051('0xe'));var Papa=require(_0x5051('0xf'));var Redis=require(_0x5051('0x10'));var authService=require(_0x5051('0x11'));var qs=require(_0x5051('0x12'));var as=require(_0x5051('0x13'));var hardwareService=require(_0x5051('0x14'));var logger=require(_0x5051('0x15'))(_0x5051('0x16'));var utils=require('../../config/utils');var config=require(_0x5051('0x17'));var licenseUtil=require(_0x5051('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x466d03,_0x264f7b){_0x264f7b=_0x264f7b||0xcc;return function(_0x42ebac){if(_0x42ebac){return _0x466d03[_0x5051('0x19')](_0x264f7b);}return _0x466d03[_0x5051('0x1a')](_0x264f7b)[_0x5051('0x1b')]();};}function respondWithResult(_0x557655,_0x44b69b){_0x44b69b=_0x44b69b||0xc8;return function(_0x49c3a6){if(_0x49c3a6){return _0x557655[_0x5051('0x1a')](_0x44b69b)[_0x5051('0x1c')](_0x49c3a6);}};}function respondWithFilteredResult(_0x504e74,_0x3a86c3){return function(_0x4221cc){if(_0x4221cc){var _0x4d2c8d=typeof _0x3a86c3[_0x5051('0x1d')]===_0x5051('0x1e')&&typeof _0x3a86c3[_0x5051('0x1f')]===_0x5051('0x1e');var _0x492056=_0x4221cc[_0x5051('0x20')];var _0x2c6474=_0x4d2c8d?0x0:_0x3a86c3['offset'];var _0x4d7980=_0x4d2c8d?_0x4221cc['count']:_0x3a86c3[_0x5051('0x1d')]+_0x3a86c3['limit'];var _0x24df12;if(_0x4d7980>=_0x492056){_0x4d7980=_0x492056;_0x24df12=0xc8;}else{_0x24df12=0xce;}_0x504e74['status'](_0x24df12);return _0x504e74['set'](_0x5051('0x21'),_0x2c6474+'-'+_0x4d7980+'/'+_0x492056)[_0x5051('0x1c')](_0x4221cc);}return null;};}function patchUpdates(_0x862fa7){return function(_0x2b2017){try{jsonpatch[_0x5051('0x22')](_0x2b2017,_0x862fa7,!![]);}catch(_0x305288){return BPromise['reject'](_0x305288);}return _0x2b2017[_0x5051('0x23')]();};}function saveUpdates(_0x295949,_0x4eec71){return function(_0x3187fd){if(_0x3187fd){return _0x3187fd[_0x5051('0x24')](_0x295949)[_0x5051('0x25')](function(_0x32813d){return _0x32813d;});}return null;};}function removeEntity(_0x11b58c,_0x55b19c){return function(_0x188730){if(_0x188730){return _0x188730[_0x5051('0x26')]()['then'](function(){var _0xde076b=_0x188730[_0x5051('0x27')]({'plain':!![]});var _0x265155=_0x5051('0x28');return db[_0x5051('0x29')][_0x5051('0x26')]({'where':{'type':_0x265155,'resourceId':_0xde076b['id']}})[_0x5051('0x25')](function(){return _0x188730;});})[_0x5051('0x25')](function(){_0x11b58c[_0x5051('0x1a')](0xcc)[_0x5051('0x1b')]();});}};}function handleEntityNotFound(_0x3b91ea,_0x2baf00){return function(_0x417ff7){if(!_0x417ff7){_0x3b91ea[_0x5051('0x19')](0x194);}return _0x417ff7;};}function handleError(_0x3eb578,_0x561611){_0x561611=_0x561611||0x1f4;return function(_0x4fbe48){logger[_0x5051('0x2a')](_0x4fbe48[_0x5051('0x2b')]);if(_0x4fbe48[_0x5051('0x2c')]){delete _0x4fbe48[_0x5051('0x2c')];}_0x3eb578[_0x5051('0x1a')](_0x561611)[_0x5051('0x2d')](_0x4fbe48);};}function getMustacheRender(_0x4758ad,_0x1d5f11){return Mustache[_0x5051('0x2e')](_0x4758ad,_[_0x5051('0x2f')](_0x1d5f11[_0x5051('0x30')],{'contact':_0x1d5f11[_0x5051('0x31')],'message':_0x1d5f11[_0x5051('0x32')],'agent':_0x1d5f11['agent'],'interaction':_0x1d5f11[_0x5051('0x33')],'account':_0x1d5f11['account']}))||'';}exports[_0x5051('0x34')]=function(_0x3bee7e,_0x3d48ef){var _0x4a1cb1={},_0x163cd2={},_0x5b2739={'count':0x0,'rows':[]};var _0x34cd9a=_['map'](db[_0x5051('0x35')][_0x5051('0x36')],function(_0x4da429){return{'name':_0x4da429[_0x5051('0x37')],'type':_0x4da429[_0x5051('0x38')][_0x5051('0x39')]};});_0x163cd2[_0x5051('0x3a')]=_[_0x5051('0x3b')](_0x34cd9a,_0x5051('0x2c'));_0x163cd2[_0x5051('0x3c')]=_[_0x5051('0x3d')](_0x3bee7e[_0x5051('0x3c')]);_0x163cd2[_0x5051('0x3e')]=_[_0x5051('0x3f')](_0x163cd2[_0x5051('0x3a')],_0x163cd2[_0x5051('0x3c')]);_0x4a1cb1[_0x5051('0x40')]=_['intersection'](_0x163cd2[_0x5051('0x3a')],qs['fields'](_0x3bee7e['query'][_0x5051('0x41')]));_0x4a1cb1[_0x5051('0x40')]=_0x4a1cb1[_0x5051('0x40')][_0x5051('0x42')]?_0x4a1cb1[_0x5051('0x40')]:_0x163cd2[_0x5051('0x3a')];if(!_0x3bee7e['query'][_0x5051('0x43')](_0x5051('0x44'))){_0x4a1cb1[_0x5051('0x1f')]=qs[_0x5051('0x1f')](_0x3bee7e[_0x5051('0x3c')][_0x5051('0x1f')]);_0x4a1cb1[_0x5051('0x1d')]=qs['offset'](_0x3bee7e['query'][_0x5051('0x1d')]);}_0x4a1cb1[_0x5051('0x45')]=qs['sort'](_0x3bee7e[_0x5051('0x3c')]['sort']);_0x4a1cb1['where']=qs['filters'](_[_0x5051('0x46')](_0x3bee7e[_0x5051('0x3c')],_0x163cd2['filters']),_0x34cd9a);if(_0x3bee7e['query']['filter']){_0x4a1cb1[_0x5051('0x47')]=_['merge'](_0x4a1cb1[_0x5051('0x47')],{'$or':_['map'](_0x34cd9a,function(_0x1223a7){if(_0x1223a7['type']!==_0x5051('0x48')){var _0x3070e0={};_0x3070e0[_0x1223a7[_0x5051('0x2c')]]={'$like':'%'+_0x3bee7e['query'][_0x5051('0x49')]+'%'};return _0x3070e0;}})});}_0x4a1cb1=_[_0x5051('0x2f')]({},_0x4a1cb1,_0x3bee7e[_0x5051('0x4a')]);var _0x19311a={'where':_0x4a1cb1[_0x5051('0x47')]};return db[_0x5051('0x35')]['count'](_0x19311a)[_0x5051('0x25')](function(_0x6959ef){_0x5b2739[_0x5051('0x20')]=_0x6959ef;if(_0x3bee7e[_0x5051('0x3c')][_0x5051('0x4b')]){_0x4a1cb1['include']=[{'all':!![]}];}return db[_0x5051('0x35')]['findAll'](_0x4a1cb1);})[_0x5051('0x25')](function(_0x536335){_0x5b2739[_0x5051('0x4c')]=_0x536335;return _0x5b2739;})[_0x5051('0x25')](respondWithFilteredResult(_0x3d48ef,_0x4a1cb1))[_0x5051('0x4d')](handleError(_0x3d48ef,null));};exports['show']=function(_0x238a8f,_0x1c7333){var _0x385360={'raw':!![],'where':{'id':_0x238a8f[_0x5051('0x4e')]['id']}},_0x8a6d33={};_0x8a6d33['model']=_[_0x5051('0x3d')](db['CmHopperAdditionalPhone']['rawAttributes']);_0x8a6d33[_0x5051('0x3c')]=_['keys'](_0x238a8f['query']);_0x8a6d33['filters']=_[_0x5051('0x3f')](_0x8a6d33[_0x5051('0x3a')],_0x8a6d33['query']);_0x385360['attributes']=_['intersection'](_0x8a6d33[_0x5051('0x3a')],qs['fields'](_0x238a8f[_0x5051('0x3c')][_0x5051('0x41')]));_0x385360['attributes']=_0x385360[_0x5051('0x40')][_0x5051('0x42')]?_0x385360[_0x5051('0x40')]:_0x8a6d33['model'];if(_0x238a8f[_0x5051('0x3c')][_0x5051('0x4b')]){_0x385360[_0x5051('0x4f')]=[{'all':!![]}];}_0x385360=_[_0x5051('0x2f')]({},_0x385360,_0x238a8f[_0x5051('0x4a')]);return db['CmHopperAdditionalPhone'][_0x5051('0x50')](_0x385360)['then'](handleEntityNotFound(_0x1c7333,null))[_0x5051('0x25')](respondWithResult(_0x1c7333,null))[_0x5051('0x4d')](handleError(_0x1c7333,null));};exports[_0x5051('0x51')]=function(_0x436abd,_0x3c0af4){return db[_0x5051('0x35')][_0x5051('0x51')](_0x436abd[_0x5051('0x30')],{})['then'](function(_0x5ed07e){var _0x5cf074=_0x436abd[_0x5051('0x52')][_0x5051('0x27')]({'plain':!![]});if(!_0x5cf074)throw new Error(_0x5051('0x53'));if(_0x5cf074[_0x5051('0x54')]===_0x5051('0x52')){var _0x16b7ae=_0x5ed07e[_0x5051('0x27')]({'plain':!![]});var _0x4c27be=_0x5051('0x28');return db[_0x5051('0x55')][_0x5051('0x50')]({'where':{'name':_0x4c27be,'userProfileId':_0x5cf074[_0x5051('0x56')]},'raw':!![]})['then'](function(_0x254e44){if(_0x254e44&&_0x254e44[_0x5051('0x57')]===0x0){return db['UserProfileResource'][_0x5051('0x51')]({'name':_0x16b7ae[_0x5051('0x2c')],'resourceId':_0x16b7ae['id'],'type':_0x254e44[_0x5051('0x2c')],'sectionId':_0x254e44['id']},{})[_0x5051('0x25')](function(){return _0x5ed07e;});}else{return _0x5ed07e;}})[_0x5051('0x4d')](function(_0x36f61e){logger[_0x5051('0x2a')](_0x5051('0x58'),_0x36f61e);throw _0x36f61e;});}return _0x5ed07e;})[_0x5051('0x25')](respondWithResult(_0x3c0af4,0xc9))[_0x5051('0x4d')](handleError(_0x3c0af4,null));};exports['update']=function(_0x2d79cb,_0xae0f6f){if(_0x2d79cb[_0x5051('0x30')]['id']){delete _0x2d79cb[_0x5051('0x30')]['id'];}return db[_0x5051('0x35')][_0x5051('0x50')]({'where':{'id':_0x2d79cb[_0x5051('0x4e')]['id']}})['then'](handleEntityNotFound(_0xae0f6f,null))[_0x5051('0x25')](saveUpdates(_0x2d79cb[_0x5051('0x30')],null))[_0x5051('0x25')](respondWithResult(_0xae0f6f,null))[_0x5051('0x4d')](handleError(_0xae0f6f,null));};exports[_0x5051('0x26')]=function(_0x5cb9d5,_0x272041){return db[_0x5051('0x35')][_0x5051('0x50')]({'where':{'id':_0x5cb9d5['params']['id']}})[_0x5051('0x25')](handleEntityNotFound(_0x272041,null))[_0x5051('0x25')](removeEntity(_0x272041,null))[_0x5051('0x4d')](handleError(_0x272041,null));}; \ No newline at end of file +var _0x9f66=['error','stack','send','merge','body','contact','message','agent','interaction','account','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','name','includeAll','include','findAll','catch','show','params','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','json','reject','save','update','then','destroy'];(function(_0x3e9b35,_0x468198){var _0x1cf06c=function(_0x15e8da){while(--_0x15e8da){_0x3e9b35['push'](_0x3e9b35['shift']());}};_0x1cf06c(++_0x468198);}(_0x9f66,0x17d));var _0x69f6=function(_0x590e5a,_0x5d556b){_0x590e5a=_0x590e5a-0x0;var _0x6a49c6=_0x9f66[_0x590e5a];return _0x6a49c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x69f6('0x0'));var zipdir=require(_0x69f6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x69f6('0x2'));var moment=require(_0x69f6('0x3'));var BPromise=require(_0x69f6('0x4'));var Mustache=require(_0x69f6('0x5'));var util=require('util');var path=require(_0x69f6('0x6'));var sox=require(_0x69f6('0x7'));var csv=require('to-csv');var ejs=require(_0x69f6('0x8'));var fs=require('fs');var fs_extra=require(_0x69f6('0x9'));var _=require('lodash');var squel=require(_0x69f6('0xa'));var crypto=require(_0x69f6('0xb'));var jsforce=require(_0x69f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x69f6('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x69f6('0xe'));var as=require(_0x69f6('0xf'));var hardwareService=require(_0x69f6('0x10'));var logger=require(_0x69f6('0x11'))(_0x69f6('0x12'));var utils=require(_0x69f6('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x69f6('0x14'))['db'];function respondWithStatusCode(_0x29645e,_0x1c2f0a){_0x1c2f0a=_0x1c2f0a||0xcc;return function(_0x4ce887){if(_0x4ce887){return _0x29645e[_0x69f6('0x15')](_0x1c2f0a);}return _0x29645e[_0x69f6('0x16')](_0x1c2f0a)[_0x69f6('0x17')]();};}function respondWithResult(_0x1335dc,_0x389127){_0x389127=_0x389127||0xc8;return function(_0x4d3eb4){if(_0x4d3eb4){return _0x1335dc[_0x69f6('0x16')](_0x389127)['json'](_0x4d3eb4);}};}function respondWithFilteredResult(_0x569b88,_0x2e5490){return function(_0x4c63aa){if(_0x4c63aa){var _0x3b5efb=typeof _0x2e5490[_0x69f6('0x18')]==='undefined'&&typeof _0x2e5490[_0x69f6('0x19')]===_0x69f6('0x1a');var _0x3c5973=_0x4c63aa[_0x69f6('0x1b')];var _0x591642=_0x3b5efb?0x0:_0x2e5490[_0x69f6('0x18')];var _0x6884f4=_0x3b5efb?_0x4c63aa[_0x69f6('0x1b')]:_0x2e5490[_0x69f6('0x18')]+_0x2e5490[_0x69f6('0x19')];var _0x189cf1;if(_0x6884f4>=_0x3c5973){_0x6884f4=_0x3c5973;_0x189cf1=0xc8;}else{_0x189cf1=0xce;}_0x569b88[_0x69f6('0x16')](_0x189cf1);return _0x569b88['set']('Content-Range',_0x591642+'-'+_0x6884f4+'/'+_0x3c5973)[_0x69f6('0x1c')](_0x4c63aa);}return null;};}function patchUpdates(_0x862f2e){return function(_0x5c8db2){try{jsonpatch['apply'](_0x5c8db2,_0x862f2e,!![]);}catch(_0x54d813){return BPromise[_0x69f6('0x1d')](_0x54d813);}return _0x5c8db2[_0x69f6('0x1e')]();};}function saveUpdates(_0x1726f9,_0x2ca812){return function(_0x1dfc2f){if(_0x1dfc2f){return _0x1dfc2f[_0x69f6('0x1f')](_0x1726f9)[_0x69f6('0x20')](function(_0x5dd7be){return _0x5dd7be;});}return null;};}function removeEntity(_0x44db72,_0x348d56){return function(_0x4220ee){if(_0x4220ee){return _0x4220ee[_0x69f6('0x21')]()[_0x69f6('0x20')](function(){var _0x330ac9=_0x4220ee['get']({'plain':!![]});var _0x112c4f='CmHopperAdditionalPhones';return db['UserProfileResource'][_0x69f6('0x21')]({'where':{'type':_0x112c4f,'resourceId':_0x330ac9['id']}})['then'](function(){return _0x4220ee;});})['then'](function(){_0x44db72[_0x69f6('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x120f9b,_0x43bba3){return function(_0x1fc640){if(!_0x1fc640){_0x120f9b['sendStatus'](0x194);}return _0x1fc640;};}function handleError(_0x177673,_0x59cd2a){_0x59cd2a=_0x59cd2a||0x1f4;return function(_0x2cb709){logger[_0x69f6('0x22')](_0x2cb709[_0x69f6('0x23')]);if(_0x2cb709['name']){delete _0x2cb709['name'];}_0x177673[_0x69f6('0x16')](_0x59cd2a)[_0x69f6('0x24')](_0x2cb709);};}function getMustacheRender(_0x9d4f69,_0x494858){return Mustache['render'](_0x9d4f69,_[_0x69f6('0x25')](_0x494858[_0x69f6('0x26')],{'contact':_0x494858[_0x69f6('0x27')],'message':_0x494858[_0x69f6('0x28')],'agent':_0x494858[_0x69f6('0x29')],'interaction':_0x494858[_0x69f6('0x2a')],'account':_0x494858[_0x69f6('0x2b')]}))||'';}exports[_0x69f6('0x2c')]=function(_0xce1197,_0x21a522){var _0x5890be={},_0x20cc61={},_0x9c8bd8={'count':0x0,'rows':[]};var _0x251e8b=_[_0x69f6('0x2d')](db[_0x69f6('0x2e')][_0x69f6('0x2f')],function(_0x31b980){return{'name':_0x31b980['fieldName'],'type':_0x31b980[_0x69f6('0x30')][_0x69f6('0x31')]};});_0x20cc61[_0x69f6('0x32')]=_[_0x69f6('0x2d')](_0x251e8b,'name');_0x20cc61[_0x69f6('0x33')]=_[_0x69f6('0x34')](_0xce1197['query']);_0x20cc61[_0x69f6('0x35')]=_[_0x69f6('0x36')](_0x20cc61[_0x69f6('0x32')],_0x20cc61['query']);_0x5890be[_0x69f6('0x37')]=_[_0x69f6('0x36')](_0x20cc61[_0x69f6('0x32')],qs[_0x69f6('0x38')](_0xce1197[_0x69f6('0x33')][_0x69f6('0x38')]));_0x5890be[_0x69f6('0x37')]=_0x5890be[_0x69f6('0x37')][_0x69f6('0x39')]?_0x5890be[_0x69f6('0x37')]:_0x20cc61[_0x69f6('0x32')];if(!_0xce1197['query']['hasOwnProperty'](_0x69f6('0x3a'))){_0x5890be['limit']=qs[_0x69f6('0x19')](_0xce1197[_0x69f6('0x33')][_0x69f6('0x19')]);_0x5890be[_0x69f6('0x18')]=qs[_0x69f6('0x18')](_0xce1197[_0x69f6('0x33')][_0x69f6('0x18')]);}_0x5890be[_0x69f6('0x3b')]=qs[_0x69f6('0x3c')](_0xce1197[_0x69f6('0x33')][_0x69f6('0x3c')]);_0x5890be[_0x69f6('0x3d')]=qs[_0x69f6('0x35')](_[_0x69f6('0x3e')](_0xce1197[_0x69f6('0x33')],_0x20cc61['filters']),_0x251e8b);if(_0xce1197[_0x69f6('0x33')][_0x69f6('0x3f')]){_0x5890be[_0x69f6('0x3d')]=_[_0x69f6('0x25')](_0x5890be[_0x69f6('0x3d')],{'$or':_[_0x69f6('0x2d')](_0x251e8b,function(_0x261885){if(_0x261885[_0x69f6('0x30')]!=='VIRTUAL'){var _0x1b8d3a={};_0x1b8d3a[_0x261885[_0x69f6('0x40')]]={'$like':'%'+_0xce1197[_0x69f6('0x33')][_0x69f6('0x3f')]+'%'};return _0x1b8d3a;}})});}_0x5890be=_[_0x69f6('0x25')]({},_0x5890be,_0xce1197['options']);var _0x568040={'where':_0x5890be[_0x69f6('0x3d')]};return db[_0x69f6('0x2e')][_0x69f6('0x1b')](_0x568040)[_0x69f6('0x20')](function(_0x1e6cea){_0x9c8bd8[_0x69f6('0x1b')]=_0x1e6cea;if(_0xce1197[_0x69f6('0x33')][_0x69f6('0x41')]){_0x5890be[_0x69f6('0x42')]=[{'all':!![]}];}return db[_0x69f6('0x2e')][_0x69f6('0x43')](_0x5890be);})[_0x69f6('0x20')](function(_0x1b7350){_0x9c8bd8['rows']=_0x1b7350;return _0x9c8bd8;})[_0x69f6('0x20')](respondWithFilteredResult(_0x21a522,_0x5890be))[_0x69f6('0x44')](handleError(_0x21a522,null));};exports[_0x69f6('0x45')]=function(_0x5fead0,_0x2e48b2){var _0x36e1b4={'raw':!![],'where':{'id':_0x5fead0[_0x69f6('0x46')]['id']}},_0x559b5d={};_0x559b5d[_0x69f6('0x32')]=_['keys'](db[_0x69f6('0x2e')][_0x69f6('0x2f')]);_0x559b5d['query']=_[_0x69f6('0x34')](_0x5fead0[_0x69f6('0x33')]);_0x559b5d[_0x69f6('0x35')]=_[_0x69f6('0x36')](_0x559b5d[_0x69f6('0x32')],_0x559b5d[_0x69f6('0x33')]);_0x36e1b4['attributes']=_[_0x69f6('0x36')](_0x559b5d[_0x69f6('0x32')],qs['fields'](_0x5fead0[_0x69f6('0x33')][_0x69f6('0x38')]));_0x36e1b4[_0x69f6('0x37')]=_0x36e1b4[_0x69f6('0x37')][_0x69f6('0x39')]?_0x36e1b4[_0x69f6('0x37')]:_0x559b5d[_0x69f6('0x32')];if(_0x5fead0[_0x69f6('0x33')][_0x69f6('0x41')]){_0x36e1b4[_0x69f6('0x42')]=[{'all':!![]}];}_0x36e1b4=_[_0x69f6('0x25')]({},_0x36e1b4,_0x5fead0[_0x69f6('0x47')]);return db[_0x69f6('0x2e')]['find'](_0x36e1b4)[_0x69f6('0x20')](handleEntityNotFound(_0x2e48b2,null))[_0x69f6('0x20')](respondWithResult(_0x2e48b2,null))[_0x69f6('0x44')](handleError(_0x2e48b2,null));};exports[_0x69f6('0x48')]=function(_0x2e109b,_0x2d9995){return db[_0x69f6('0x2e')][_0x69f6('0x48')](_0x2e109b[_0x69f6('0x26')],{})[_0x69f6('0x20')](function(_0x589960){var _0x5bca6d=_0x2e109b[_0x69f6('0x49')][_0x69f6('0x4a')]({'plain':!![]});if(!_0x5bca6d)throw new Error(_0x69f6('0x4b'));if(_0x5bca6d[_0x69f6('0x4c')]===_0x69f6('0x49')){var _0x42412f=_0x589960[_0x69f6('0x4a')]({'plain':!![]});var _0x3d3f31='CmHopperAdditionalPhones';return db[_0x69f6('0x4d')][_0x69f6('0x4e')]({'where':{'name':_0x3d3f31,'userProfileId':_0x5bca6d[_0x69f6('0x4f')]},'raw':!![]})[_0x69f6('0x20')](function(_0x295ce3){if(_0x295ce3&&_0x295ce3[_0x69f6('0x50')]===0x0){return db[_0x69f6('0x51')]['create']({'name':_0x42412f['name'],'resourceId':_0x42412f['id'],'type':_0x295ce3[_0x69f6('0x40')],'sectionId':_0x295ce3['id']},{})[_0x69f6('0x20')](function(){return _0x589960;});}else{return _0x589960;}})['catch'](function(_0x5bd98e){logger[_0x69f6('0x22')](_0x69f6('0x52'),_0x5bd98e);throw _0x5bd98e;});}return _0x589960;})[_0x69f6('0x20')](respondWithResult(_0x2d9995,0xc9))[_0x69f6('0x44')](handleError(_0x2d9995,null));};exports['update']=function(_0x161848,_0x4d9bf1){if(_0x161848[_0x69f6('0x26')]['id']){delete _0x161848[_0x69f6('0x26')]['id'];}return db[_0x69f6('0x2e')][_0x69f6('0x4e')]({'where':{'id':_0x161848[_0x69f6('0x46')]['id']}})[_0x69f6('0x20')](handleEntityNotFound(_0x4d9bf1,null))['then'](saveUpdates(_0x161848[_0x69f6('0x26')],null))[_0x69f6('0x20')](respondWithResult(_0x4d9bf1,null))['catch'](handleError(_0x4d9bf1,null));};exports[_0x69f6('0x21')]=function(_0x475773,_0x343327){return db['CmHopperAdditionalPhone'][_0x69f6('0x4e')]({'where':{'id':_0x475773[_0x69f6('0x46')]['id']}})[_0x69f6('0x20')](handleEntityNotFound(_0x343327,null))[_0x69f6('0x20')](removeEntity(_0x343327,null))[_0x69f6('0x44')](handleError(_0x343327,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index a585eb1..df74b4b 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8249=['CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','moment','exports','define'];(function(_0x9105f4,_0x3bf6f7){var _0x57a818=function(_0x1c5cf4){while(--_0x1c5cf4){_0x9105f4['push'](_0x9105f4['shift']());}};_0x57a818(++_0x3bf6f7);}(_0x8249,0xc6));var _0x9824=function(_0x340e88,_0xefa352){_0x340e88=_0x340e88-0x0;var _0x1642f9=_0x8249[_0x340e88];return _0x1642f9;};'use strict';var _=require(_0x9824('0x0'));var util=require(_0x9824('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9824('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x9824('0x3')]=function(_0x1507aa,_0xbd196b){return _0x1507aa[_0x9824('0x4')](_0x9824('0x5'),attributes,{'tableName':_0x9824('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca79=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash'];(function(_0x43ec95,_0x7d0644){var _0x54a880=function(_0x560d87){while(--_0x560d87){_0x43ec95['push'](_0x43ec95['shift']());}};_0x54a880(++_0x7d0644);}(_0xca79,0x185));var _0x9ca7=function(_0x53c34d,_0x39f4ba){_0x53c34d=_0x53c34d-0x0;var _0x47fa3f=_0xca79[_0x53c34d];return _0x47fa3f;};'use strict';var _=require(_0x9ca7('0x0'));var util=require(_0x9ca7('0x1'));var logger=require(_0x9ca7('0x2'))(_0x9ca7('0x3'));var moment=require('moment');var BPromise=require(_0x9ca7('0x4'));var rp=require(_0x9ca7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ca7('0x6'));var config=require(_0x9ca7('0x7'));var attributes=require(_0x9ca7('0x8'));module[_0x9ca7('0x9')]=function(_0x4a44f9,_0x2728dc){return _0x4a44f9[_0x9ca7('0xa')](_0x9ca7('0xb'),attributes,{'tableName':_0x9ca7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index e70121f..81dd72b 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xced4=['findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','countabandonedretry','createdAt','updatedAt','phone','additionalToHop','sequelize','update','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','ContactId','body','ListId','VoiceQueueId','CampaignId'];(function(_0x5cbf0e,_0x4cd140){var _0x1c76f8=function(_0xcc9be4){while(--_0xcc9be4){_0x5cbf0e['push'](_0x5cbf0e['shift']());}};_0x1c76f8(++_0x4cd140);}(_0xced4,0x144));var _0x4ced=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0xced4[_0x1fcaf1];return _0x55f464;};'use strict';var _=require(_0x4ced('0x0'));var util=require(_0x4ced('0x1'));var moment=require(_0x4ced('0x2'));var BPromise=require(_0x4ced('0x3'));var rs=require(_0x4ced('0x4'));var fs=require('fs');var Redis=require(_0x4ced('0x5'));var db=require(_0x4ced('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ced('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4ced('0x8'));var client=jayson[_0x4ced('0x9')][_0x4ced('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1aae91,_0x4b3032,_0x347e10){return new BPromise(function(_0x1da4b4,_0xf1c322){return client[_0x4ced('0xb')](_0x1aae91,_0x347e10)[_0x4ced('0xc')](function(_0x5b800e){logger[_0x4ced('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4b3032,_0x4ced('0xe'));logger['debug'](_0x4ced('0xf'),_0x4b3032,'request\x20sent',JSON[_0x4ced('0x10')](_0x5b800e));if(_0x5b800e[_0x4ced('0x11')]){if(_0x5b800e[_0x4ced('0x11')][_0x4ced('0x12')]===0x1f4){logger[_0x4ced('0x11')](_0x4ced('0x13'),_0x4b3032,_0x5b800e[_0x4ced('0x11')][_0x4ced('0x14')]);return _0xf1c322(_0x5b800e[_0x4ced('0x11')]['message']);}logger[_0x4ced('0x11')](_0x4ced('0x13'),_0x4b3032,_0x5b800e['error'][_0x4ced('0x14')]);return _0x1da4b4(_0x5b800e[_0x4ced('0x11')]['message']);}else{logger[_0x4ced('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4b3032,'request\x20sent');_0x1da4b4(_0x5b800e[_0x4ced('0x15')][_0x4ced('0x14')]);}})[_0x4ced('0x16')](function(_0x1470bc){logger[_0x4ced('0x11')](_0x4ced('0x13'),_0x4b3032,_0x1470bc);_0xf1c322(_0x1470bc);});});}exports[_0x4ced('0x17')]=function(_0x540246){var _0x2adbe1=this;return new Promise(function(_0x37511b,_0x377fbb){return db[_0x4ced('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x540246['body'][_0x4ced('0x19')],'ListId':_0x540246[_0x4ced('0x1a')][_0x4ced('0x1b')],'VoiceQueueId':_0x540246[_0x4ced('0x1a')][_0x4ced('0x1c')]===undefined?null:_0x540246[_0x4ced('0x1a')][_0x4ced('0x1c')],'CampaignId':_0x540246[_0x4ced('0x1a')][_0x4ced('0x1d')]===undefined?null:_0x540246['body'][_0x4ced('0x1d')]}})['then'](function(_0x18a92a){if(_0x18a92a!=null){return db['CmHopperAdditionalPhone'][_0x4ced('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x18a92a['id'],'OrderBy':{'$gt':_0x18a92a[_0x4ced('0x1f')]}},'order':[[_0x4ced('0x1f'),_0x4ced('0x20')]]})[_0x4ced('0xc')](function(_0x46ead3){var _0xebfcf6=0x0;if(_0x46ead3){if(_0x46ead3[_0x4ced('0x21')]+_0x46ead3[_0x4ced('0x22')]+_0x46ead3[_0x4ced('0x23')]+_0x46ead3[_0x4ced('0x24')]+_0x46ead3[_0x4ced('0x25')]+_0x46ead3['countabandonedretry']+_0x46ead3[_0x4ced('0x26')]+_0x46ead3[_0x4ced('0x27')]<_0x540246[_0x4ced('0x28')][_0x4ced('0x29')])_0xebfcf6=0x1;_0x37511b({'additional':_0xebfcf6});}else{return db[_0x4ced('0x2a')][_0x4ced('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x18a92a['id']},'order':[['OrderBy',_0x4ced('0x20')]]})[_0x4ced('0xc')](function(_0x5c68fb){var _0x29c5ac=0x0;if(_0x5c68fb){if(_0x5c68fb[_0x4ced('0x21')]+_0x5c68fb[_0x4ced('0x22')]+_0x5c68fb[_0x4ced('0x23')]+_0x5c68fb[_0x4ced('0x24')]+_0x5c68fb[_0x4ced('0x25')]+_0x5c68fb['countabandonedretry']+_0x5c68fb[_0x4ced('0x26')]+_0x5c68fb[_0x4ced('0x27')]<_0x540246['entity'][_0x4ced('0x29')])_0x29c5ac=0x1;_0x37511b({'additional':_0x29c5ac});}else{_0x37511b({'additional':0x0});}})[_0x4ced('0x16')](function(_0x52b446){logger[_0x4ced('0x11')](_0x4ced('0x17'),_0x52b446['message'],_0x540246);_0x377fbb(_0x2adbe1[_0x4ced('0x11')](0x1f4,_0x52b446['message']));});}})['catch'](function(_0x3076ce){logger[_0x4ced('0x11')](_0x4ced('0x17'),_0x3076ce['message'],_0x540246);_0x377fbb(_0x2adbe1['error'](0x1f4,_0x3076ce[_0x4ced('0x14')]));});}else _0x37511b({'additional':0x0});});});};exports[_0x4ced('0x2b')]=function(_0x3d1b07){var _0x1bac30=this;return new Promise(function(_0x2ce95c,_0x33d483){return db[_0x4ced('0x18')][_0x4ced('0x1e')]({'raw':!![],'where':{'ContactId':_0x3d1b07[_0x4ced('0x1a')][_0x4ced('0x19')],'ListId':_0x3d1b07[_0x4ced('0x1a')][_0x4ced('0x1b')],'VoiceQueueId':_0x3d1b07['body'][_0x4ced('0x1c')]===undefined?null:_0x3d1b07[_0x4ced('0x1a')][_0x4ced('0x1c')],'CampaignId':_0x3d1b07[_0x4ced('0x1a')][_0x4ced('0x1d')]===undefined?null:_0x3d1b07[_0x4ced('0x1a')]['CampaignId']}})['then'](function(_0x251573){if(_0x251573!=null){return db[_0x4ced('0x2a')][_0x4ced('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x251573['id'],'OrderBy':{'$gt':_0x251573[_0x4ced('0x1f')]}},'order':[[_0x4ced('0x1f'),_0x4ced('0x20')]]})[_0x4ced('0xc')](function(_0x421778){if(_0x421778)return activateAdditionalPhone(_0x251573,_0x3d1b07[_0x4ced('0x1a')],_0x421778,_0x3d1b07[_0x4ced('0x2c')],_0x3d1b07['waitTime'])[_0x4ced('0xc')](function(_0xdad0f3){_0x2ce95c(_0xdad0f3);});else{return db[_0x4ced('0x2a')][_0x4ced('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x251573['id']},'order':[[_0x4ced('0x1f'),_0x4ced('0x20')]]})[_0x4ced('0xc')](function(_0xdb8680){if(_0xdb8680)return activateAdditionalPhone(_0x251573,_0x3d1b07[_0x4ced('0x1a')],_0xdb8680,_0x3d1b07['duration'],_0x3d1b07[_0x4ced('0x2d')])[_0x4ced('0xc')](function(_0x4d077b){_0x2ce95c(_0x4d077b);});else{_0x2ce95c({'id':_0x251573['id'],'phone':''});}})[_0x4ced('0x16')](function(_0x14845c){logger[_0x4ced('0x11')](_0x4ced('0x17'),_0x14845c[_0x4ced('0x14')],_0x3d1b07);_0x33d483(_0x1bac30['error'](0x1f4,_0x14845c[_0x4ced('0x14')]));});}})['catch'](function(_0x3ef8a2){logger[_0x4ced('0x11')]('VerifyAdditionalPhones',_0x3ef8a2[_0x4ced('0x14')],_0x3d1b07);_0x33d483(_0x1bac30[_0x4ced('0x11')](0x1f4,_0x3ef8a2[_0x4ced('0x14')]));});}else _0x2ce95c(0x1);});});};function activateAdditionalPhone(_0x38d477,_0x5d120a,_0x1e9f40,_0x1a09dc,_0x5c0e6d){return new Promise(function(_0x4ec329,_0x40ea43){logger['info'](_0x4ced('0x17'),_0x1e9f40);var _0x195351;if(moment()>moment(_0x1e9f40[_0x4ced('0x2e')])){_0x195351=moment()[_0x4ced('0x2f')](_0x5c0e6d||0x3,'minutes');}else{if(_0x1e9f40['OrderBy']==0x0){_0x195351=moment(_0x1e9f40[_0x4ced('0x2e')]);}else{_0x195351=moment()[_0x4ced('0x2f')](_0x5c0e6d||0x3,_0x4ced('0x30'));}}var _0x12faca={'phone':_0x38d477['phone'],'active':0x0,'OrderBy':_[_0x4ced('0x31')](_0x38d477['OrderBy'])?0x0:_0x38d477['OrderBy'],'scheduledat':moment()[_0x4ced('0x2f')](_0x1a09dc||0x1,_0x4ced('0x30')),'countbusyretry':_0x5d120a[_0x4ced('0x21')],'countcongestionretry':_0x5d120a[_0x4ced('0x22')],'countnoanswerretry':_0x5d120a['countnoanswerretry'],'countnosuchnumberretry':_0x5d120a['countnosuchnumberretry'],'countdropretry':_0x5d120a[_0x4ced('0x25')],'countabandonedretry':_0x5d120a[_0x4ced('0x32')],'countmachineretry':_0x5d120a[_0x4ced('0x26')],'countagentrejectretry':_0x5d120a[_0x4ced('0x27')],'createdAt':_0x5d120a[_0x4ced('0x33')],'updatedAt':_0x5d120a[_0x4ced('0x34')]};var _0xe68564={'CmHopperId':_0x38d477['id'],'phone':_0x1e9f40[_0x4ced('0x35')],'active':0x0,'OrderBy':_[_0x4ced('0x31')](_0x1e9f40['OrderBy'])?0x0:_0x1e9f40[_0x4ced('0x1f')],'scheduledat':_0x195351,'countbusyretry':_0x1e9f40[_0x4ced('0x21')],'countcongestionretry':_0x1e9f40[_0x4ced('0x22')],'countnoanswerretry':_0x1e9f40[_0x4ced('0x23')],'countnosuchnumberretry':_0x5d120a[_0x4ced('0x24')],'countdropretry':_0x5d120a[_0x4ced('0x25')],'countabandonedretry':_0x5d120a[_0x4ced('0x32')],'countmachineretry':_0x5d120a[_0x4ced('0x26')],'countagentrejectretry':_0x5d120a[_0x4ced('0x27')],'createdAt':_0x1e9f40[_0x4ced('0x33')],'updatedAt':_0x1e9f40[_0x4ced('0x34')]};logger[_0x4ced('0xd')]('hopperToAdd',_0x12faca);logger['info'](_0x4ced('0x36'),_0xe68564);return db[_0x4ced('0x37')]['transaction'](function(_0x53683b){return db[_0x4ced('0x2a')][_0x4ced('0x38')](_0x12faca,{'where':{'id':_0x1e9f40['id']}},{'transaction':_0x53683b})[_0x4ced('0xc')](function(){return db[_0x4ced('0x18')][_0x4ced('0x38')](_0xe68564,{'where':{'id':_0x38d477['id']}},{'transaction':_0x53683b});});})[_0x4ced('0xc')](function(_0x3f1493){_0x4ec329({'id':_0x38d477['id'],'phone':_0x1e9f40[_0x4ced('0x35')]});})['catch'](function(_0x4423f9){logger['error'](_0x4ced('0x17'),_0x4423f9['message'],req);_0x40ea43(_this[_0x4ced('0x11')](0x1f4,_0x4423f9[_0x4ced('0x14')]));});});}exports[_0x4ced('0x39')]=function(_0x1e4586){var _0x16e7eb=this;return new Promise(function(_0x5c89e1,_0x5c9b71){return db[_0x4ced('0x18')][_0x4ced('0x38')](_0x1e4586[_0x4ced('0x1a')][_0x4ced('0x3a')],{'where':{'id':_0x1e4586[_0x4ced('0x1a')]['id']}})[_0x4ced('0xc')](function(_0x343154){_0x5c89e1(_0x343154);})['catch'](function(_0x5bef2e){logger[_0x4ced('0x11')](_0x4ced('0x39'),_0x5bef2e['message'],_0x1e4586);_0x5c9b71(_0x16e7eb['error'](0x1f4,_0x5bef2e['message']));});});}; \ No newline at end of file +var _0x6705=['../../config/utils','rpc','jayson/promise','client','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','then','OrderBy','ASC','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countcongestionretry','SwapAdditionalPhones','ListId','duration','waitTime','add','minutes','scheduledat','phone','countnoanswerretry','createdAt','updatedAt','isNil','additionalToHop','transaction','update','IncrementPreviewCounters','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x48deac,_0x4d8ab8){var _0x3b5eaa=function(_0x91c61e){while(--_0x91c61e){_0x48deac['push'](_0x48deac['shift']());}};_0x3b5eaa(++_0x4d8ab8);}(_0x6705,0x14a));var _0x5670=function(_0x5f433a,_0x2e6d64){_0x5f433a=_0x5f433a-0x0;var _0x2fd980=_0x6705[_0x5f433a];return _0x2fd980;};'use strict';var _=require(_0x5670('0x0'));var util=require('util');var moment=require(_0x5670('0x1'));var BPromise=require(_0x5670('0x2'));var rs=require(_0x5670('0x3'));var fs=require('fs');var Redis=require(_0x5670('0x4'));var db=require(_0x5670('0x5'))['db'];var utils=require(_0x5670('0x6'));var logger=require('../../config/logger')(_0x5670('0x7'));var config=require('../../config/environment');var jayson=require(_0x5670('0x8'));var client=jayson[_0x5670('0x9')][_0x5670('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1213dc,_0x303c05,_0x1af140){return new BPromise(function(_0x1d380d,_0x1cab62){return client[_0x5670('0xb')](_0x1213dc,_0x1af140)['then'](function(_0x532779){logger[_0x5670('0xc')](_0x5670('0xd'),_0x303c05,_0x5670('0xe'));logger[_0x5670('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x303c05,'request\x20sent',JSON[_0x5670('0x10')](_0x532779));if(_0x532779[_0x5670('0x11')]){if(_0x532779['error']['code']===0x1f4){logger[_0x5670('0x11')](_0x5670('0xd'),_0x303c05,_0x532779['error']['message']);return _0x1cab62(_0x532779[_0x5670('0x11')][_0x5670('0x12')]);}logger[_0x5670('0x11')](_0x5670('0xd'),_0x303c05,_0x532779[_0x5670('0x11')][_0x5670('0x12')]);return _0x1d380d(_0x532779[_0x5670('0x11')][_0x5670('0x12')]);}else{logger[_0x5670('0xc')](_0x5670('0xd'),_0x303c05,_0x5670('0xe'));_0x1d380d(_0x532779['result'][_0x5670('0x12')]);}})[_0x5670('0x13')](function(_0x2b98c0){logger[_0x5670('0x11')](_0x5670('0xd'),_0x303c05,_0x2b98c0);_0x1cab62(_0x2b98c0);});});}exports[_0x5670('0x14')]=function(_0x39ae3b){var _0x276df1=this;return new Promise(function(_0x22eea7,_0x214a28){return db[_0x5670('0x15')][_0x5670('0x16')]({'raw':!![],'where':{'ContactId':_0x39ae3b[_0x5670('0x17')][_0x5670('0x18')],'ListId':_0x39ae3b['body']['ListId'],'VoiceQueueId':_0x39ae3b[_0x5670('0x17')]['VoiceQueueId']===undefined?null:_0x39ae3b[_0x5670('0x17')][_0x5670('0x19')],'CampaignId':_0x39ae3b[_0x5670('0x17')][_0x5670('0x1a')]===undefined?null:_0x39ae3b[_0x5670('0x17')][_0x5670('0x1a')]}})[_0x5670('0x1b')](function(_0xfe3857){if(_0xfe3857!=null){return db['CmHopperAdditionalPhone'][_0x5670('0x16')]({'raw':!![],'where':{'CmHopperId':_0xfe3857['id'],'OrderBy':{'$gt':_0xfe3857[_0x5670('0x1c')]}},'order':[[_0x5670('0x1c'),_0x5670('0x1d')]]})['then'](function(_0x8ef9f){var _0x32cb85=0x0;if(_0x8ef9f){if(_0x8ef9f[_0x5670('0x1e')]+_0x8ef9f['countcongestionretry']+_0x8ef9f['countnoanswerretry']+_0x8ef9f[_0x5670('0x1f')]+_0x8ef9f[_0x5670('0x20')]+_0x8ef9f[_0x5670('0x21')]+_0x8ef9f[_0x5670('0x22')]+_0x8ef9f[_0x5670('0x23')]<_0x39ae3b[_0x5670('0x24')][_0x5670('0x25')])_0x32cb85=0x1;_0x22eea7({'additional':_0x32cb85});}else{return db[_0x5670('0x26')][_0x5670('0x16')]({'raw':!![],'where':{'CmHopperId':_0xfe3857['id']},'order':[[_0x5670('0x1c'),_0x5670('0x1d')]]})[_0x5670('0x1b')](function(_0x25d3b3){var _0x1c2acb=0x0;if(_0x25d3b3){if(_0x25d3b3[_0x5670('0x1e')]+_0x25d3b3[_0x5670('0x27')]+_0x25d3b3['countnoanswerretry']+_0x25d3b3[_0x5670('0x1f')]+_0x25d3b3['countdropretry']+_0x25d3b3[_0x5670('0x21')]+_0x25d3b3['countmachineretry']+_0x25d3b3[_0x5670('0x23')]<_0x39ae3b[_0x5670('0x24')][_0x5670('0x25')])_0x1c2acb=0x1;_0x22eea7({'additional':_0x1c2acb});}else{_0x22eea7({'additional':0x0});}})['catch'](function(_0xee9fd5){logger[_0x5670('0x11')]('VerifyAdditionalPhones',_0xee9fd5[_0x5670('0x12')],_0x39ae3b);_0x214a28(_0x276df1['error'](0x1f4,_0xee9fd5[_0x5670('0x12')]));});}})[_0x5670('0x13')](function(_0x10a8b6){logger['error']('VerifyAdditionalPhones',_0x10a8b6[_0x5670('0x12')],_0x39ae3b);_0x214a28(_0x276df1[_0x5670('0x11')](0x1f4,_0x10a8b6[_0x5670('0x12')]));});}else _0x22eea7({'additional':0x0});});});};exports[_0x5670('0x28')]=function(_0x2cb704){var _0x5b6a6f=this;return new Promise(function(_0x56d348,_0x2c3097){return db[_0x5670('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0x2cb704[_0x5670('0x17')][_0x5670('0x18')],'ListId':_0x2cb704[_0x5670('0x17')][_0x5670('0x29')],'VoiceQueueId':_0x2cb704[_0x5670('0x17')][_0x5670('0x19')]===undefined?null:_0x2cb704[_0x5670('0x17')]['VoiceQueueId'],'CampaignId':_0x2cb704[_0x5670('0x17')][_0x5670('0x1a')]===undefined?null:_0x2cb704[_0x5670('0x17')]['CampaignId']}})[_0x5670('0x1b')](function(_0x561739){if(_0x561739!=null){return db['CmHopperAdditionalPhone'][_0x5670('0x16')]({'raw':!![],'where':{'CmHopperId':_0x561739['id'],'OrderBy':{'$gt':_0x561739['OrderBy']}},'order':[['OrderBy',_0x5670('0x1d')]]})[_0x5670('0x1b')](function(_0x22937d){if(_0x22937d)return activateAdditionalPhone(_0x561739,_0x2cb704[_0x5670('0x17')],_0x22937d,_0x2cb704[_0x5670('0x2a')],_0x2cb704[_0x5670('0x2b')])['then'](function(_0xefa4a1){_0x56d348(_0xefa4a1);});else{return db[_0x5670('0x26')][_0x5670('0x16')]({'raw':!![],'where':{'CmHopperId':_0x561739['id']},'order':[[_0x5670('0x1c'),'ASC']]})[_0x5670('0x1b')](function(_0x2efefa){if(_0x2efefa)return activateAdditionalPhone(_0x561739,_0x2cb704[_0x5670('0x17')],_0x2efefa,_0x2cb704[_0x5670('0x2a')],_0x2cb704['waitTime'])['then'](function(_0x975214){_0x56d348(_0x975214);});else{_0x56d348({'id':_0x561739['id'],'phone':''});}})[_0x5670('0x13')](function(_0xe6c4a6){logger[_0x5670('0x11')](_0x5670('0x14'),_0xe6c4a6[_0x5670('0x12')],_0x2cb704);_0x2c3097(_0x5b6a6f[_0x5670('0x11')](0x1f4,_0xe6c4a6['message']));});}})['catch'](function(_0x758362){logger[_0x5670('0x11')](_0x5670('0x14'),_0x758362[_0x5670('0x12')],_0x2cb704);_0x2c3097(_0x5b6a6f[_0x5670('0x11')](0x1f4,_0x758362[_0x5670('0x12')]));});}else _0x56d348(0x1);});});};function activateAdditionalPhone(_0x54acd6,_0xaba4e3,_0x181f0d,_0x3830be,_0x2ec023){return new Promise(function(_0x264459,_0x17b6ea){logger[_0x5670('0xc')](_0x5670('0x14'),_0x181f0d);var _0x466401;if(moment()>moment(_0x181f0d['scheduledat'])){_0x466401=moment()[_0x5670('0x2c')](_0x2ec023||0x3,_0x5670('0x2d'));}else{if(_0x181f0d[_0x5670('0x1c')]==0x0){_0x466401=moment(_0x181f0d[_0x5670('0x2e')]);}else{_0x466401=moment()[_0x5670('0x2c')](_0x2ec023||0x3,_0x5670('0x2d'));}}var _0x4579fd={'phone':_0x54acd6[_0x5670('0x2f')],'active':0x0,'OrderBy':_['isNil'](_0x54acd6[_0x5670('0x1c')])?0x0:_0x54acd6[_0x5670('0x1c')],'scheduledat':moment()[_0x5670('0x2c')](_0x3830be||0x1,_0x5670('0x2d')),'countbusyretry':_0xaba4e3['countbusyretry'],'countcongestionretry':_0xaba4e3[_0x5670('0x27')],'countnoanswerretry':_0xaba4e3[_0x5670('0x30')],'countnosuchnumberretry':_0xaba4e3[_0x5670('0x1f')],'countdropretry':_0xaba4e3[_0x5670('0x20')],'countabandonedretry':_0xaba4e3[_0x5670('0x21')],'countmachineretry':_0xaba4e3[_0x5670('0x22')],'countagentrejectretry':_0xaba4e3['countagentrejectretry'],'createdAt':_0xaba4e3[_0x5670('0x31')],'updatedAt':_0xaba4e3[_0x5670('0x32')]};var _0x95c8b8={'CmHopperId':_0x54acd6['id'],'phone':_0x181f0d['phone'],'active':0x0,'OrderBy':_[_0x5670('0x33')](_0x181f0d[_0x5670('0x1c')])?0x0:_0x181f0d[_0x5670('0x1c')],'scheduledat':_0x466401,'countbusyretry':_0x181f0d[_0x5670('0x1e')],'countcongestionretry':_0x181f0d[_0x5670('0x27')],'countnoanswerretry':_0x181f0d[_0x5670('0x30')],'countnosuchnumberretry':_0xaba4e3[_0x5670('0x1f')],'countdropretry':_0xaba4e3[_0x5670('0x20')],'countabandonedretry':_0xaba4e3[_0x5670('0x21')],'countmachineretry':_0xaba4e3['countmachineretry'],'countagentrejectretry':_0xaba4e3[_0x5670('0x23')],'createdAt':_0x181f0d[_0x5670('0x31')],'updatedAt':_0x181f0d['updatedAt']};logger[_0x5670('0xc')]('hopperToAdd',_0x4579fd);logger[_0x5670('0xc')](_0x5670('0x34'),_0x95c8b8);return db['sequelize'][_0x5670('0x35')](function(_0x46e9d3){return db[_0x5670('0x26')][_0x5670('0x36')](_0x4579fd,{'where':{'id':_0x181f0d['id']}},{'transaction':_0x46e9d3})[_0x5670('0x1b')](function(){return db[_0x5670('0x15')][_0x5670('0x36')](_0x95c8b8,{'where':{'id':_0x54acd6['id']}},{'transaction':_0x46e9d3});});})[_0x5670('0x1b')](function(_0x26c3dc){_0x264459({'id':_0x54acd6['id'],'phone':_0x181f0d[_0x5670('0x2f')]});})[_0x5670('0x13')](function(_0x5c03f7){logger[_0x5670('0x11')](_0x5670('0x14'),_0x5c03f7[_0x5670('0x12')],req);_0x17b6ea(_this[_0x5670('0x11')](0x1f4,_0x5c03f7[_0x5670('0x12')]));});});}exports['IncrementPreviewCounters']=function(_0x410797){var _0x32079e=this;return new Promise(function(_0x5da997,_0x533817){return db[_0x5670('0x15')][_0x5670('0x36')](_0x410797[_0x5670('0x17')]['field'],{'where':{'id':_0x410797[_0x5670('0x17')]['id']}})[_0x5670('0x1b')](function(_0xf85db4){_0x5da997(_0xf85db4);})[_0x5670('0x13')](function(_0x5cce2d){logger[_0x5670('0x11')](_0x5670('0x37'),_0x5cce2d['message'],_0x410797);_0x533817(_0x32079e['error'](0x1f4,_0x5cce2d[_0x5670('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 2883ee2..9d8d245 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x771c=['/:id','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','show','create','put'];(function(_0x33f404,_0x344c7f){var _0x5c9437=function(_0xe33ec){while(--_0xe33ec){_0x33f404['push'](_0x33f404['shift']());}};_0x5c9437(++_0x344c7f);}(_0x771c,0x6d));var _0xc771=function(_0x36b2d3,_0x3295aa){_0x36b2d3=_0x36b2d3-0x0;var _0x3fff28=_0x771c[_0x36b2d3];return _0x3fff28;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc771('0x0'));var timeout=require(_0xc771('0x1'));var express=require(_0xc771('0x2'));var router=express[_0xc771('0x3')]();var fs_extra=require(_0xc771('0x4'));var auth=require(_0xc771('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc771('0x6')]('/:id',auth[_0xc771('0x7')](),controller[_0xc771('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc771('0x9')]);router[_0xc771('0xa')](_0xc771('0xb'),auth[_0xc771('0x7')](),controller['update']);router[_0xc771('0xc')](_0xc771('0xb'),auth['isAuthenticated'](),controller[_0xc771('0xd')]);module[_0xc771('0xe')]=router; \ No newline at end of file +var _0xa244=['../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','post','update','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x3aeb13,_0x3c5496){var _0x97f334=function(_0x52ed42){while(--_0x52ed42){_0x3aeb13['push'](_0x3aeb13['shift']());}};_0x97f334(++_0x3c5496);}(_0xa244,0xa4));var _0x4a24=function(_0x2ceb8e,_0x19ba8e){_0x2ceb8e=_0x2ceb8e-0x0;var _0xe283bb=_0xa244[_0x2ceb8e];return _0xe283bb;};'use strict';var multer=require(_0x4a24('0x0'));var util=require(_0x4a24('0x1'));var path=require(_0x4a24('0x2'));var timeout=require('connect-timeout');var express=require(_0x4a24('0x3'));var router=express[_0x4a24('0x4')]();var fs_extra=require(_0x4a24('0x5'));var auth=require(_0x4a24('0x6'));var interaction=require(_0x4a24('0x7'));var config=require('../../config/environment');var controller=require(_0x4a24('0x8'));router[_0x4a24('0x9')]('/',auth[_0x4a24('0xa')](),controller[_0x4a24('0xb')]);router[_0x4a24('0x9')](_0x4a24('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4a24('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x4a24('0xc'),auth[_0x4a24('0xa')](),controller[_0x4a24('0xe')]);router['delete']('/:id',auth[_0x4a24('0xa')](),controller[_0x4a24('0xf')]);module[_0x4a24('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index d4fa5ce..a5afac3 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 _0x280c=['INTEGER','contactListQueue','moment','exports'];(function(_0x1c9b09,_0x3b3704){var _0x16434f=function(_0x2f99da){while(--_0x2f99da){_0x1c9b09['push'](_0x1c9b09['shift']());}};_0x16434f(++_0x3b3704);}(_0x280c,0x172));var _0xc280=function(_0x3187a7,_0x4c7bf5){_0x3187a7=_0x3187a7-0x0;var _0x30ce86=_0x280c[_0x3187a7];return _0x30ce86;};'use strict';var moment=require(_0xc280('0x0'));var Sequelize=require('sequelize');module[_0xc280('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xc280('0x2')],'unique':_0xc280('0x3')},'ListId':{'type':Sequelize[_0xc280('0x2')],'unique':_0xc280('0x3')},'VoiceQueueId':{'type':Sequelize[_0xc280('0x2')],'unique':_0xc280('0x3')}}; \ No newline at end of file +var _0xa7b9=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa7b9,0x7c));var _0x9a7b=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xa7b9[_0x266618];return _0x54dbf5;};'use strict';var moment=require(_0x9a7b('0x0'));var Sequelize=require(_0x9a7b('0x1'));module[_0x9a7b('0x2')]={'phone':{'type':Sequelize[_0x9a7b('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9a7b('0x4')],'unique':_0x9a7b('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x9a7b('0x5')},'VoiceQueueId':{'type':Sequelize[_0x9a7b('0x4')],'unique':_0x9a7b('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index e555ec5..285cbed 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 _0x6e86=['key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','CmHopperBlack','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','options','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','sendStatus','end','json','offset','limit','undefined','count','status','Content-Range','reject','save','update','then','destroy','error','name','render','merge','body','contact','message','agent','interaction','index','map','fieldName','type'];(function(_0x3566ea,_0x50e87d){var _0x24c0b9=function(_0x1f22a5){while(--_0x1f22a5){_0x3566ea['push'](_0x3566ea['shift']());}};_0x24c0b9(++_0x50e87d);}(_0x6e86,0x19c));var _0x66e8=function(_0x4e0f5e,_0x4168c4){_0x4e0f5e=_0x4e0f5e-0x0;var _0x45de30=_0x6e86[_0x4e0f5e];return _0x45de30;};'use strict';var emlformat=require(_0x66e8('0x0'));var rimraf=require(_0x66e8('0x1'));var zipdir=require(_0x66e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66e8('0x3'));var moment=require(_0x66e8('0x4'));var BPromise=require(_0x66e8('0x5'));var Mustache=require(_0x66e8('0x6'));var util=require(_0x66e8('0x7'));var path=require(_0x66e8('0x8'));var sox=require(_0x66e8('0x9'));var csv=require('to-csv');var ejs=require(_0x66e8('0xa'));var fs=require('fs');var fs_extra=require(_0x66e8('0xb'));var _=require('lodash');var squel=require(_0x66e8('0xc'));var crypto=require(_0x66e8('0xd'));var jsforce=require(_0x66e8('0xe'));var deskjs=require(_0x66e8('0xf'));var toCsv=require(_0x66e8('0x10'));var querystring=require(_0x66e8('0x11'));var Papa=require(_0x66e8('0x12'));var Redis=require('ioredis');var authService=require(_0x66e8('0x13'));var qs=require(_0x66e8('0x14'));var as=require(_0x66e8('0x15'));var hardwareService=require(_0x66e8('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cd34c,_0x38a664){_0x38a664=_0x38a664||0xcc;return function(_0x4bfb68){if(_0x4bfb68){return _0x1cd34c[_0x66e8('0x17')](_0x38a664);}return _0x1cd34c['status'](_0x38a664)[_0x66e8('0x18')]();};}function respondWithResult(_0x44c86a,_0x1306f5){_0x1306f5=_0x1306f5||0xc8;return function(_0x339b29){if(_0x339b29){return _0x44c86a['status'](_0x1306f5)[_0x66e8('0x19')](_0x339b29);}};}function respondWithFilteredResult(_0x1945f0,_0x3fe2a1){return function(_0x5bc818){if(_0x5bc818){var _0x32d24e=typeof _0x3fe2a1[_0x66e8('0x1a')]==='undefined'&&typeof _0x3fe2a1[_0x66e8('0x1b')]===_0x66e8('0x1c');var _0x10daf6=_0x5bc818[_0x66e8('0x1d')];var _0x342094=_0x32d24e?0x0:_0x3fe2a1[_0x66e8('0x1a')];var _0x58a75d=_0x32d24e?_0x5bc818[_0x66e8('0x1d')]:_0x3fe2a1[_0x66e8('0x1a')]+_0x3fe2a1[_0x66e8('0x1b')];var _0xd320a3;if(_0x58a75d>=_0x10daf6){_0x58a75d=_0x10daf6;_0xd320a3=0xc8;}else{_0xd320a3=0xce;}_0x1945f0[_0x66e8('0x1e')](_0xd320a3);return _0x1945f0['set'](_0x66e8('0x1f'),_0x342094+'-'+_0x58a75d+'/'+_0x10daf6)[_0x66e8('0x19')](_0x5bc818);}return null;};}function patchUpdates(_0x4b9f62){return function(_0x26d6ee){try{jsonpatch['apply'](_0x26d6ee,_0x4b9f62,!![]);}catch(_0x3c8518){return BPromise[_0x66e8('0x20')](_0x3c8518);}return _0x26d6ee[_0x66e8('0x21')]();};}function saveUpdates(_0x16fb57,_0x20e35d){return function(_0x39c85a){if(_0x39c85a){return _0x39c85a[_0x66e8('0x22')](_0x16fb57)[_0x66e8('0x23')](function(_0x11f0f2){return _0x11f0f2;});}return null;};}function removeEntity(_0x2f2a4a,_0x471b93){return function(_0x28ebd4){if(_0x28ebd4){return _0x28ebd4[_0x66e8('0x24')]()[_0x66e8('0x23')](function(){_0x2f2a4a[_0x66e8('0x1e')](0xcc)[_0x66e8('0x18')]();});}};}function handleEntityNotFound(_0x320053,_0x23ba7b){return function(_0x1f024e){if(!_0x1f024e){_0x320053['sendStatus'](0x194);}return _0x1f024e;};}function handleError(_0x53c696,_0x4dee62){_0x4dee62=_0x4dee62||0x1f4;return function(_0x52ca11){logger[_0x66e8('0x25')](_0x52ca11['stack']);if(_0x52ca11[_0x66e8('0x26')]){delete _0x52ca11[_0x66e8('0x26')];}_0x53c696[_0x66e8('0x1e')](_0x4dee62)['send'](_0x52ca11);};}function getMustacheRender(_0x30db65,_0x1814dd){return Mustache[_0x66e8('0x27')](_0x30db65,_[_0x66e8('0x28')](_0x1814dd[_0x66e8('0x29')],{'contact':_0x1814dd[_0x66e8('0x2a')],'message':_0x1814dd[_0x66e8('0x2b')],'agent':_0x1814dd[_0x66e8('0x2c')],'interaction':_0x1814dd[_0x66e8('0x2d')],'account':_0x1814dd['account']}))||'';}exports[_0x66e8('0x2e')]=function(_0x4bdfd8,_0x50b4b2){var _0x424229={},_0x5b334f={},_0x4bb775={'count':0x0,'rows':[]};var _0x682ccd=_[_0x66e8('0x2f')](db['CmHopperBlack']['rawAttributes'],function(_0x328b95){return{'name':_0x328b95[_0x66e8('0x30')],'type':_0x328b95[_0x66e8('0x31')][_0x66e8('0x32')]};});_0x5b334f[_0x66e8('0x33')]=_[_0x66e8('0x2f')](_0x682ccd,'name');_0x5b334f[_0x66e8('0x34')]=_['keys'](_0x4bdfd8['query']);_0x5b334f[_0x66e8('0x35')]=_['intersection'](_0x5b334f['model'],_0x5b334f[_0x66e8('0x34')]);_0x424229['attributes']=_[_0x66e8('0x36')](_0x5b334f[_0x66e8('0x33')],qs[_0x66e8('0x37')](_0x4bdfd8['query'][_0x66e8('0x37')]));_0x424229[_0x66e8('0x38')]=_0x424229[_0x66e8('0x38')][_0x66e8('0x39')]?_0x424229[_0x66e8('0x38')]:_0x5b334f[_0x66e8('0x33')];if(!_0x4bdfd8['query'][_0x66e8('0x3a')]('nolimit')){_0x424229[_0x66e8('0x1b')]=qs['limit'](_0x4bdfd8[_0x66e8('0x34')][_0x66e8('0x1b')]);_0x424229[_0x66e8('0x1a')]=qs[_0x66e8('0x1a')](_0x4bdfd8['query'][_0x66e8('0x1a')]);}_0x424229[_0x66e8('0x3b')]=qs['sort'](_0x4bdfd8[_0x66e8('0x34')][_0x66e8('0x3c')]);_0x424229[_0x66e8('0x3d')]=qs[_0x66e8('0x35')](_['pick'](_0x4bdfd8[_0x66e8('0x34')],_0x5b334f[_0x66e8('0x35')]),_0x682ccd);if(_0x4bdfd8[_0x66e8('0x34')][_0x66e8('0x3e')]){_0x424229['where']=_['merge'](_0x424229['where'],{'$or':_[_0x66e8('0x2f')](_0x682ccd,function(_0x239e5e){if(_0x239e5e['type']!==_0x66e8('0x3f')){var _0xfad970={};_0xfad970[_0x239e5e[_0x66e8('0x26')]]={'$like':'%'+_0x4bdfd8['query']['filter']+'%'};return _0xfad970;}})});}_0x424229=_['merge']({},_0x424229,_0x4bdfd8['options']);var _0x2c6344={'where':_0x424229[_0x66e8('0x3d')]};return db[_0x66e8('0x40')][_0x66e8('0x1d')](_0x2c6344)['then'](function(_0x51cdc4){_0x4bb775[_0x66e8('0x1d')]=_0x51cdc4;if(_0x4bdfd8[_0x66e8('0x34')][_0x66e8('0x41')]){_0x424229[_0x66e8('0x42')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x66e8('0x43')](_0x424229);})[_0x66e8('0x23')](function(_0x539b4d){_0x4bb775[_0x66e8('0x44')]=_0x539b4d;return _0x4bb775;})[_0x66e8('0x23')](respondWithFilteredResult(_0x50b4b2,_0x424229))[_0x66e8('0x45')](handleError(_0x50b4b2,null));};exports[_0x66e8('0x46')]=function(_0x15c10,_0x10990c){var _0x3a3725={'raw':!![],'where':{'id':_0x15c10['params']['id']}},_0x290b46={};_0x290b46[_0x66e8('0x33')]=_[_0x66e8('0x47')](db['CmHopperBlack'][_0x66e8('0x48')]);_0x290b46['query']=_[_0x66e8('0x47')](_0x15c10[_0x66e8('0x34')]);_0x290b46[_0x66e8('0x35')]=_[_0x66e8('0x36')](_0x290b46[_0x66e8('0x33')],_0x290b46[_0x66e8('0x34')]);_0x3a3725[_0x66e8('0x38')]=_[_0x66e8('0x36')](_0x290b46[_0x66e8('0x33')],qs[_0x66e8('0x37')](_0x15c10['query'][_0x66e8('0x37')]));_0x3a3725[_0x66e8('0x38')]=_0x3a3725['attributes'][_0x66e8('0x39')]?_0x3a3725['attributes']:_0x290b46[_0x66e8('0x33')];if(_0x15c10[_0x66e8('0x34')][_0x66e8('0x41')]){_0x3a3725['include']=[{'all':!![]}];}_0x3a3725=_[_0x66e8('0x28')]({},_0x3a3725,_0x15c10[_0x66e8('0x49')]);return db['CmHopperBlack'][_0x66e8('0x4a')](_0x3a3725)[_0x66e8('0x23')](handleEntityNotFound(_0x10990c,null))[_0x66e8('0x23')](respondWithResult(_0x10990c,null))[_0x66e8('0x45')](handleError(_0x10990c,null));};exports['update']=function(_0xacee6a,_0x4eaff2){if(_0xacee6a[_0x66e8('0x29')]['id']){delete _0xacee6a[_0x66e8('0x29')]['id'];}return db[_0x66e8('0x40')][_0x66e8('0x4a')]({'where':{'id':_0xacee6a[_0x66e8('0x4b')]['id']}})[_0x66e8('0x23')](handleEntityNotFound(_0x4eaff2,null))['then'](saveUpdates(_0xacee6a[_0x66e8('0x29')],null))[_0x66e8('0x23')](respondWithResult(_0x4eaff2,null))[_0x66e8('0x45')](handleError(_0x4eaff2,null));};exports[_0x66e8('0x24')]=function(_0x2142bf,_0x164e67){return db[_0x66e8('0x40')][_0x66e8('0x4a')]({'where':{'id':_0x2142bf['params']['id']}})['then'](handleEntityNotFound(_0x164e67,null))['then'](removeEntity(_0x164e67,null))[_0x66e8('0x45')](handleError(_0x164e67,null));};exports[_0x66e8('0x4c')]=function(_0x991ef8,_0x56f419){return db[_0x66e8('0x40')][_0x66e8('0x4c')]()[_0x66e8('0x23')](respondWithResult(_0x56f419,null))[_0x66e8('0x45')](handleError(_0x56f419,null));}; \ No newline at end of file +var _0xf70f=['type','VIRTUAL','options','CmHopperBlack','includeAll','include','rows','catch','show','params','find','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','then','end','error','stack','name','send','render','contact','message','agent','interaction','account','index','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge'];(function(_0x308d28,_0x1eb3f9){var _0x3a150f=function(_0x58fbc3){while(--_0x58fbc3){_0x308d28['push'](_0x308d28['shift']());}};_0x3a150f(++_0x1eb3f9);}(_0xf70f,0x194));var _0xff70=function(_0x1e08fa,_0x2177b8){_0x1e08fa=_0x1e08fa-0x0;var _0x48a80f=_0xf70f[_0x1e08fa];return _0x48a80f;};'use strict';var emlformat=require(_0xff70('0x0'));var rimraf=require(_0xff70('0x1'));var zipdir=require(_0xff70('0x2'));var jsonpatch=require(_0xff70('0x3'));var rp=require('request-promise');var moment=require(_0xff70('0x4'));var BPromise=require(_0xff70('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xff70('0x6'));var sox=require(_0xff70('0x7'));var csv=require(_0xff70('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff70('0x9'));var _=require(_0xff70('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xff70('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xff70('0x8'));var querystring=require(_0xff70('0xc'));var Papa=require(_0xff70('0xd'));var Redis=require(_0xff70('0xe'));var authService=require(_0xff70('0xf'));var qs=require(_0xff70('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff70('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xff70('0x12'));var config=require(_0xff70('0x13'));var licenseUtil=require(_0xff70('0x14'));var db=require(_0xff70('0x15'))['db'];function respondWithStatusCode(_0x34ed3a,_0x29a42e){_0x29a42e=_0x29a42e||0xcc;return function(_0x32b59e){if(_0x32b59e){return _0x34ed3a[_0xff70('0x16')](_0x29a42e);}return _0x34ed3a[_0xff70('0x17')](_0x29a42e)['end']();};}function respondWithResult(_0x19dcd1,_0x35b778){_0x35b778=_0x35b778||0xc8;return function(_0x4902db){if(_0x4902db){return _0x19dcd1[_0xff70('0x17')](_0x35b778)['json'](_0x4902db);}};}function respondWithFilteredResult(_0x2a13c5,_0xdaeeac){return function(_0x5d40ea){if(_0x5d40ea){var _0x517558=typeof _0xdaeeac[_0xff70('0x18')]===_0xff70('0x19')&&typeof _0xdaeeac[_0xff70('0x1a')]===_0xff70('0x19');var _0xa8f578=_0x5d40ea[_0xff70('0x1b')];var _0x3a8bb1=_0x517558?0x0:_0xdaeeac['offset'];var _0x1100b5=_0x517558?_0x5d40ea[_0xff70('0x1b')]:_0xdaeeac[_0xff70('0x18')]+_0xdaeeac[_0xff70('0x1a')];var _0x3629e4;if(_0x1100b5>=_0xa8f578){_0x1100b5=_0xa8f578;_0x3629e4=0xc8;}else{_0x3629e4=0xce;}_0x2a13c5[_0xff70('0x17')](_0x3629e4);return _0x2a13c5[_0xff70('0x1c')](_0xff70('0x1d'),_0x3a8bb1+'-'+_0x1100b5+'/'+_0xa8f578)['json'](_0x5d40ea);}return null;};}function patchUpdates(_0x748121){return function(_0x1c6de0){try{jsonpatch[_0xff70('0x1e')](_0x1c6de0,_0x748121,!![]);}catch(_0x33606b){return BPromise[_0xff70('0x1f')](_0x33606b);}return _0x1c6de0['save']();};}function saveUpdates(_0x499c40,_0x218cba){return function(_0x4291a3){if(_0x4291a3){return _0x4291a3['update'](_0x499c40)['then'](function(_0x3fcc69){return _0x3fcc69;});}return null;};}function removeEntity(_0x1414ff,_0x5eb694){return function(_0x49361e){if(_0x49361e){return _0x49361e['destroy']()[_0xff70('0x20')](function(){_0x1414ff[_0xff70('0x17')](0xcc)[_0xff70('0x21')]();});}};}function handleEntityNotFound(_0x109d2c,_0x1c9ecf){return function(_0x348074){if(!_0x348074){_0x109d2c[_0xff70('0x16')](0x194);}return _0x348074;};}function handleError(_0x179054,_0x523580){_0x523580=_0x523580||0x1f4;return function(_0x39bd6b){logger[_0xff70('0x22')](_0x39bd6b[_0xff70('0x23')]);if(_0x39bd6b[_0xff70('0x24')]){delete _0x39bd6b[_0xff70('0x24')];}_0x179054[_0xff70('0x17')](_0x523580)[_0xff70('0x25')](_0x39bd6b);};}function getMustacheRender(_0x44046f,_0xc5b289){return Mustache[_0xff70('0x26')](_0x44046f,_['merge'](_0xc5b289['body'],{'contact':_0xc5b289[_0xff70('0x27')],'message':_0xc5b289[_0xff70('0x28')],'agent':_0xc5b289[_0xff70('0x29')],'interaction':_0xc5b289[_0xff70('0x2a')],'account':_0xc5b289[_0xff70('0x2b')]}))||'';}exports[_0xff70('0x2c')]=function(_0x4261a4,_0x55dc03){var _0x1edbc1={},_0x4db6d3={},_0x144e54={'count':0x0,'rows':[]};var _0x5b76c5=_[_0xff70('0x2d')](db['CmHopperBlack'][_0xff70('0x2e')],function(_0xfc5846){return{'name':_0xfc5846[_0xff70('0x2f')],'type':_0xfc5846['type'][_0xff70('0x30')]};});_0x4db6d3[_0xff70('0x31')]=_['map'](_0x5b76c5,'name');_0x4db6d3[_0xff70('0x32')]=_[_0xff70('0x33')](_0x4261a4[_0xff70('0x32')]);_0x4db6d3['filters']=_['intersection'](_0x4db6d3[_0xff70('0x31')],_0x4db6d3[_0xff70('0x32')]);_0x1edbc1[_0xff70('0x34')]=_[_0xff70('0x35')](_0x4db6d3['model'],qs['fields'](_0x4261a4['query'][_0xff70('0x36')]));_0x1edbc1[_0xff70('0x34')]=_0x1edbc1[_0xff70('0x34')][_0xff70('0x37')]?_0x1edbc1[_0xff70('0x34')]:_0x4db6d3[_0xff70('0x31')];if(!_0x4261a4['query'][_0xff70('0x38')]('nolimit')){_0x1edbc1[_0xff70('0x1a')]=qs[_0xff70('0x1a')](_0x4261a4[_0xff70('0x32')][_0xff70('0x1a')]);_0x1edbc1['offset']=qs['offset'](_0x4261a4[_0xff70('0x32')][_0xff70('0x18')]);}_0x1edbc1[_0xff70('0x39')]=qs[_0xff70('0x3a')](_0x4261a4['query'][_0xff70('0x3a')]);_0x1edbc1[_0xff70('0x3b')]=qs[_0xff70('0x3c')](_[_0xff70('0x3d')](_0x4261a4['query'],_0x4db6d3[_0xff70('0x3c')]),_0x5b76c5);if(_0x4261a4[_0xff70('0x32')][_0xff70('0x3e')]){_0x1edbc1[_0xff70('0x3b')]=_[_0xff70('0x3f')](_0x1edbc1[_0xff70('0x3b')],{'$or':_[_0xff70('0x2d')](_0x5b76c5,function(_0x27c9b2){if(_0x27c9b2[_0xff70('0x40')]!==_0xff70('0x41')){var _0x4533e9={};_0x4533e9[_0x27c9b2[_0xff70('0x24')]]={'$like':'%'+_0x4261a4['query'][_0xff70('0x3e')]+'%'};return _0x4533e9;}})});}_0x1edbc1=_['merge']({},_0x1edbc1,_0x4261a4[_0xff70('0x42')]);var _0x5d0f0b={'where':_0x1edbc1['where']};return db[_0xff70('0x43')][_0xff70('0x1b')](_0x5d0f0b)[_0xff70('0x20')](function(_0x3c621f){_0x144e54[_0xff70('0x1b')]=_0x3c621f;if(_0x4261a4[_0xff70('0x32')][_0xff70('0x44')]){_0x1edbc1[_0xff70('0x45')]=[{'all':!![]}];}return db[_0xff70('0x43')]['findAll'](_0x1edbc1);})['then'](function(_0x3d9678){_0x144e54[_0xff70('0x46')]=_0x3d9678;return _0x144e54;})[_0xff70('0x20')](respondWithFilteredResult(_0x55dc03,_0x1edbc1))[_0xff70('0x47')](handleError(_0x55dc03,null));};exports[_0xff70('0x48')]=function(_0x1faae5,_0x1ac031){var _0x30c6a7={'raw':!![],'where':{'id':_0x1faae5[_0xff70('0x49')]['id']}},_0x2db861={};_0x2db861[_0xff70('0x31')]=_[_0xff70('0x33')](db[_0xff70('0x43')][_0xff70('0x2e')]);_0x2db861[_0xff70('0x32')]=_[_0xff70('0x33')](_0x1faae5['query']);_0x2db861[_0xff70('0x3c')]=_[_0xff70('0x35')](_0x2db861[_0xff70('0x31')],_0x2db861[_0xff70('0x32')]);_0x30c6a7[_0xff70('0x34')]=_['intersection'](_0x2db861[_0xff70('0x31')],qs[_0xff70('0x36')](_0x1faae5[_0xff70('0x32')][_0xff70('0x36')]));_0x30c6a7[_0xff70('0x34')]=_0x30c6a7[_0xff70('0x34')]['length']?_0x30c6a7[_0xff70('0x34')]:_0x2db861[_0xff70('0x31')];if(_0x1faae5['query'][_0xff70('0x44')]){_0x30c6a7[_0xff70('0x45')]=[{'all':!![]}];}_0x30c6a7=_[_0xff70('0x3f')]({},_0x30c6a7,_0x1faae5[_0xff70('0x42')]);return db['CmHopperBlack'][_0xff70('0x4a')](_0x30c6a7)['then'](handleEntityNotFound(_0x1ac031,null))[_0xff70('0x20')](respondWithResult(_0x1ac031,null))['catch'](handleError(_0x1ac031,null));};exports[_0xff70('0x4b')]=function(_0x1ca329,_0x42aa66){if(_0x1ca329[_0xff70('0x4c')]['id']){delete _0x1ca329[_0xff70('0x4c')]['id'];}return db[_0xff70('0x43')][_0xff70('0x4a')]({'where':{'id':_0x1ca329[_0xff70('0x49')]['id']}})[_0xff70('0x20')](handleEntityNotFound(_0x42aa66,null))[_0xff70('0x20')](saveUpdates(_0x1ca329['body'],null))[_0xff70('0x20')](respondWithResult(_0x42aa66,null))[_0xff70('0x47')](handleError(_0x42aa66,null));};exports['destroy']=function(_0x1472e0,_0x546ead){return db['CmHopperBlack'][_0xff70('0x4a')]({'where':{'id':_0x1472e0['params']['id']}})[_0xff70('0x20')](handleEntityNotFound(_0x546ead,null))[_0xff70('0x20')](removeEntity(_0x546ead,null))[_0xff70('0x47')](handleError(_0x546ead,null));};exports[_0xff70('0x4d')]=function(_0x594828,_0x2bb2dc){return db['CmHopperBlack'][_0xff70('0x4d')]()[_0xff70('0x20')](respondWithResult(_0x2bb2dc,null))[_0xff70('0x47')](handleError(_0x2bb2dc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 88baf71..e6fc0e3 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 _0x87d0=['CmHopperBlack','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0xa71c40,_0x47b087){var _0x38f61c=function(_0x4a1b52){while(--_0x4a1b52){_0xa71c40['push'](_0xa71c40['shift']());}};_0x38f61c(++_0x47b087);}(_0x87d0,0x123));var _0x087d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x87d0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x087d('0x0'));var util=require(_0x087d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x087d('0x2'));var BPromise=require(_0x087d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x087d('0x4'));var rimraf=require(_0x087d('0x5'));var config=require(_0x087d('0x6'));var attributes=require(_0x087d('0x7'));module[_0x087d('0x8')]=function(_0x3bcebd,_0x5c66bb){return _0x3bcebd['define'](_0x087d('0x9'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85e2=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','exports','define','CmHopperBlack','cm_hopper_black'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x85e2,0xbb));var _0x285e=function(_0x1ae5dc,_0x31a664){_0x1ae5dc=_0x1ae5dc-0x0;var _0x137f77=_0x85e2[_0x1ae5dc];return _0x137f77;};'use strict';var _=require(_0x285e('0x0'));var util=require(_0x285e('0x1'));var logger=require(_0x285e('0x2'))(_0x285e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x285e('0x4'));var rimraf=require(_0x285e('0x5'));var config=require(_0x285e('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0x285e('0x7')]=function(_0x40939d,_0x5bf3f5){return _0x40939d[_0x285e('0x8')](_0x285e('0x9'),attributes,{'tableName':_0x285e('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 9aa8f14..e578def 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 _0x7a91=['attributes','limit','include','map','model','catch','UpdateCmHopperBlack','update','body','where','DestroyCmHopperBlack','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw'];(function(_0x2f4c1c,_0x5a3dd4){var _0x25e0f2=function(_0x46ea31){while(--_0x46ea31){_0x2f4c1c['push'](_0x2f4c1c['shift']());}};_0x25e0f2(++_0x5a3dd4);}(_0x7a91,0x169));var _0x17a9=function(_0x47b67e,_0x50181a){_0x47b67e=_0x47b67e-0x0;var _0xe3b207=_0x7a91[_0x47b67e];return _0xe3b207;};'use strict';var _=require('lodash');var util=require(_0x17a9('0x0'));var moment=require(_0x17a9('0x1'));var BPromise=require('bluebird');var rs=require(_0x17a9('0x2'));var fs=require('fs');var Redis=require(_0x17a9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x17a9('0x4'));var logger=require(_0x17a9('0x5'))(_0x17a9('0x6'));var config=require(_0x17a9('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14cf54,_0x4eb90e,_0x4b804a){return new BPromise(function(_0x363f93,_0x4304c2){return client['request'](_0x14cf54,_0x4b804a)[_0x17a9('0x8')](function(_0x7d6fec){logger[_0x17a9('0x9')]('CmHopperBlack,\x20%s,\x20%s',_0x4eb90e,_0x17a9('0xa'));logger[_0x17a9('0xb')](_0x17a9('0xc'),_0x4eb90e,_0x17a9('0xa'),JSON[_0x17a9('0xd')](_0x7d6fec));if(_0x7d6fec['error']){if(_0x7d6fec[_0x17a9('0xe')][_0x17a9('0xf')]===0x1f4){logger[_0x17a9('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x4eb90e,_0x7d6fec['error'][_0x17a9('0x10')]);return _0x4304c2(_0x7d6fec[_0x17a9('0xe')]['message']);}logger[_0x17a9('0xe')](_0x17a9('0x11'),_0x4eb90e,_0x7d6fec['error'][_0x17a9('0x10')]);return _0x363f93(_0x7d6fec['error']['message']);}else{logger[_0x17a9('0x9')](_0x17a9('0x11'),_0x4eb90e,_0x17a9('0xa'));_0x363f93(_0x7d6fec[_0x17a9('0x12')][_0x17a9('0x10')]);}})['catch'](function(_0x124a88){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x4eb90e,_0x124a88);_0x4304c2(_0x124a88);});});}exports[_0x17a9('0x13')]=function(_0x5d0860){var _0x58a735=this;return new Promise(function(_0x34aa61,_0x383eeb){return db[_0x17a9('0x14')][_0x17a9('0x15')]({'raw':_0x5d0860[_0x17a9('0x16')]?_0x5d0860[_0x17a9('0x16')][_0x17a9('0x17')]===undefined?!![]:![]:!![],'where':_0x5d0860[_0x17a9('0x16')]?_0x5d0860[_0x17a9('0x16')]['where']||null:null,'attributes':_0x5d0860[_0x17a9('0x16')]?_0x5d0860['options'][_0x17a9('0x18')]||null:null,'limit':_0x5d0860[_0x17a9('0x16')]?_0x5d0860[_0x17a9('0x16')][_0x17a9('0x19')]||null:null,'include':_0x5d0860[_0x17a9('0x16')]?_0x5d0860[_0x17a9('0x16')][_0x17a9('0x1a')]?_[_0x17a9('0x1b')](_0x5d0860[_0x17a9('0x16')][_0x17a9('0x1a')],function(_0x45a7f8){return{'model':db[_0x45a7f8['model']],'as':_0x45a7f8['as'],'attributes':_0x45a7f8[_0x17a9('0x18')],'include':_0x45a7f8[_0x17a9('0x1a')]?_[_0x17a9('0x1b')](_0x45a7f8[_0x17a9('0x1a')],function(_0x51f28c){return{'model':db[_0x51f28c[_0x17a9('0x1c')]],'as':_0x51f28c['as'],'attributes':_0x51f28c[_0x17a9('0x18')],'include':_0x51f28c[_0x17a9('0x1a')]?_[_0x17a9('0x1b')](_0x51f28c['include'],function(_0x162d08){return{'model':db[_0x162d08[_0x17a9('0x1c')]],'as':_0x162d08['as'],'attributes':_0x162d08[_0x17a9('0x18')]};}):[]};}):[]};}):[]:[]})[_0x17a9('0x8')](function(_0x2f7ab1){logger[_0x17a9('0x9')](_0x17a9('0x13'),_0x5d0860);logger[_0x17a9('0xb')]('GetCmHopperBlack',_0x5d0860,JSON[_0x17a9('0xd')](_0x2f7ab1));_0x34aa61(_0x2f7ab1);})[_0x17a9('0x1d')](function(_0x14d5e2){logger['error'](_0x17a9('0x13'),_0x14d5e2['message'],_0x5d0860);_0x383eeb(_0x58a735[_0x17a9('0xe')](0x1f4,_0x14d5e2[_0x17a9('0x10')]));});});};exports[_0x17a9('0x1e')]=function(_0x33b972){var _0x339629=this;return new Promise(function(_0x516a95,_0x1c7725){return db[_0x17a9('0x14')][_0x17a9('0x1f')](_0x33b972[_0x17a9('0x20')],{'raw':_0x33b972['options']?_0x33b972[_0x17a9('0x16')][_0x17a9('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33b972[_0x17a9('0x16')]?_0x33b972[_0x17a9('0x16')][_0x17a9('0x21')]||null:null,'attributes':_0x33b972[_0x17a9('0x16')]?_0x33b972[_0x17a9('0x16')][_0x17a9('0x18')]||null:null,'limit':_0x33b972['options']?_0x33b972[_0x17a9('0x16')][_0x17a9('0x19')]||null:null})['then'](function(_0x2b13d8){logger[_0x17a9('0x9')](_0x17a9('0x1e'),_0x33b972);logger[_0x17a9('0xb')](_0x17a9('0x1e'),_0x33b972,JSON['stringify'](_0x2b13d8));_0x516a95(_0x2b13d8);})[_0x17a9('0x1d')](function(_0x4fee62){logger[_0x17a9('0xe')](_0x17a9('0x1e'),_0x4fee62[_0x17a9('0x10')],_0x33b972);_0x1c7725(_0x339629[_0x17a9('0xe')](0x1f4,_0x4fee62[_0x17a9('0x10')]));});});};exports[_0x17a9('0x22')]=function(_0x5084bb){var _0x4330ef=this;return new Promise(function(_0x5b4b24,_0x253f0b){return db[_0x17a9('0x14')]['destroy']({'where':_0x5084bb['options']?_0x5084bb[_0x17a9('0x16')][_0x17a9('0x21')]||null:null})[_0x17a9('0x8')](function(_0x66c2f2){logger[_0x17a9('0x9')]('DestroyCmHopperBlack',_0x5084bb);logger[_0x17a9('0xb')](_0x17a9('0x22'),_0x5084bb,JSON[_0x17a9('0xd')](_0x66c2f2));_0x5b4b24(_0x66c2f2);})[_0x17a9('0x1d')](function(_0x543a7f){logger[_0x17a9('0xe')](_0x17a9('0x22'),_0x543a7f[_0x17a9('0x10')],_0x5084bb);_0x253f0b(_0x4330ef[_0x17a9('0xe')](0x1f4,_0x543a7f['message']));});});}; \ No newline at end of file +var _0x3e63=['DestroyCmHopperBlack','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','limit','include','map','model','attributes','then','UpdateCmHopperBlack','body','destroy','where'];(function(_0x2b5904,_0xc1a4c2){var _0x1717fe=function(_0xc25128){while(--_0xc25128){_0x2b5904['push'](_0x2b5904['shift']());}};_0x1717fe(++_0xc1a4c2);}(_0x3e63,0x96));var _0x33e6=function(_0x3cf053,_0x7a9947){_0x3cf053=_0x3cf053-0x0;var _0x3b55a0=_0x3e63[_0x3cf053];return _0x3b55a0;};'use strict';var _=require(_0x33e6('0x0'));var util=require(_0x33e6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x33e6('0x2'));var fs=require('fs');var Redis=require(_0x33e6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x33e6('0x4'));var logger=require(_0x33e6('0x5'))(_0x33e6('0x6'));var config=require(_0x33e6('0x7'));var jayson=require(_0x33e6('0x8'));var client=jayson[_0x33e6('0x9')][_0x33e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19f700,_0x2cb464,_0x3da3d9){return new BPromise(function(_0x246f0b,_0x6f9180){return client[_0x33e6('0xb')](_0x19f700,_0x3da3d9)['then'](function(_0x25b2d1){logger[_0x33e6('0xc')](_0x33e6('0xd'),_0x2cb464,_0x33e6('0xe'));logger[_0x33e6('0xf')](_0x33e6('0x10'),_0x2cb464,_0x33e6('0xe'),JSON[_0x33e6('0x11')](_0x25b2d1));if(_0x25b2d1[_0x33e6('0x12')]){if(_0x25b2d1[_0x33e6('0x12')]['code']===0x1f4){logger['error'](_0x33e6('0xd'),_0x2cb464,_0x25b2d1[_0x33e6('0x12')][_0x33e6('0x13')]);return _0x6f9180(_0x25b2d1[_0x33e6('0x12')][_0x33e6('0x13')]);}logger[_0x33e6('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x2cb464,_0x25b2d1['error'][_0x33e6('0x13')]);return _0x246f0b(_0x25b2d1['error']['message']);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x2cb464,'request\x20sent');_0x246f0b(_0x25b2d1['result'][_0x33e6('0x13')]);}})['catch'](function(_0x3c8f85){logger[_0x33e6('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x2cb464,_0x3c8f85);_0x6f9180(_0x3c8f85);});});}exports[_0x33e6('0x14')]=function(_0x51d09d){var _0x3c7067=this;return new Promise(function(_0x577ea7,_0x4c3834){return db[_0x33e6('0x15')][_0x33e6('0x16')]({'raw':_0x51d09d[_0x33e6('0x17')]?_0x51d09d['options'][_0x33e6('0x18')]===undefined?!![]:![]:!![],'where':_0x51d09d['options']?_0x51d09d['options']['where']||null:null,'attributes':_0x51d09d['options']?_0x51d09d[_0x33e6('0x17')]['attributes']||null:null,'limit':_0x51d09d['options']?_0x51d09d[_0x33e6('0x17')][_0x33e6('0x19')]||null:null,'include':_0x51d09d[_0x33e6('0x17')]?_0x51d09d[_0x33e6('0x17')][_0x33e6('0x1a')]?_[_0x33e6('0x1b')](_0x51d09d[_0x33e6('0x17')]['include'],function(_0x338a3f){return{'model':db[_0x338a3f[_0x33e6('0x1c')]],'as':_0x338a3f['as'],'attributes':_0x338a3f['attributes'],'include':_0x338a3f[_0x33e6('0x1a')]?_[_0x33e6('0x1b')](_0x338a3f['include'],function(_0x4a5a8b){return{'model':db[_0x4a5a8b[_0x33e6('0x1c')]],'as':_0x4a5a8b['as'],'attributes':_0x4a5a8b[_0x33e6('0x1d')],'include':_0x4a5a8b['include']?_[_0x33e6('0x1b')](_0x4a5a8b[_0x33e6('0x1a')],function(_0x36cef8){return{'model':db[_0x36cef8['model']],'as':_0x36cef8['as'],'attributes':_0x36cef8[_0x33e6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x33e6('0x1e')](function(_0x2db1f1){logger['info'](_0x33e6('0x14'),_0x51d09d);logger[_0x33e6('0xf')](_0x33e6('0x14'),_0x51d09d,JSON['stringify'](_0x2db1f1));_0x577ea7(_0x2db1f1);})['catch'](function(_0x321c78){logger[_0x33e6('0x12')](_0x33e6('0x14'),_0x321c78[_0x33e6('0x13')],_0x51d09d);_0x4c3834(_0x3c7067[_0x33e6('0x12')](0x1f4,_0x321c78[_0x33e6('0x13')]));});});};exports[_0x33e6('0x1f')]=function(_0x4fdec2){var _0x5c2b9e=this;return new Promise(function(_0x663f9b,_0x5af9ac){return db[_0x33e6('0x15')]['update'](_0x4fdec2[_0x33e6('0x20')],{'raw':_0x4fdec2[_0x33e6('0x17')]?_0x4fdec2[_0x33e6('0x17')][_0x33e6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fdec2[_0x33e6('0x17')]?_0x4fdec2[_0x33e6('0x17')]['where']||null:null,'attributes':_0x4fdec2[_0x33e6('0x17')]?_0x4fdec2['options'][_0x33e6('0x1d')]||null:null,'limit':_0x4fdec2['options']?_0x4fdec2[_0x33e6('0x17')]['limit']||null:null})['then'](function(_0x369f2e){logger[_0x33e6('0xc')](_0x33e6('0x1f'),_0x4fdec2);logger[_0x33e6('0xf')]('UpdateCmHopperBlack',_0x4fdec2,JSON[_0x33e6('0x11')](_0x369f2e));_0x663f9b(_0x369f2e);})['catch'](function(_0x2dd645){logger[_0x33e6('0x12')](_0x33e6('0x1f'),_0x2dd645[_0x33e6('0x13')],_0x4fdec2);_0x5af9ac(_0x5c2b9e['error'](0x1f4,_0x2dd645[_0x33e6('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x33c50c){var _0x342718=this;return new Promise(function(_0x47718b,_0x5060f8){return db[_0x33e6('0x15')][_0x33e6('0x21')]({'where':_0x33c50c[_0x33e6('0x17')]?_0x33c50c[_0x33e6('0x17')][_0x33e6('0x22')]||null:null})[_0x33e6('0x1e')](function(_0x774cce){logger[_0x33e6('0xc')](_0x33e6('0x23'),_0x33c50c);logger[_0x33e6('0xf')]('DestroyCmHopperBlack',_0x33c50c,JSON[_0x33e6('0x11')](_0x774cce));_0x47718b(_0x774cce);})[_0x33e6('0x24')](function(_0x5813be){logger[_0x33e6('0x12')](_0x33e6('0x23'),_0x5813be[_0x33e6('0x13')],_0x33c50c);_0x5060f8(_0x342718[_0x33e6('0x12')](0x1f4,_0x5813be[_0x33e6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 5005854..5e82987 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 _0x4745=['isAuthenticated','/:id','show','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index'];(function(_0x5788c3,_0x407621){var _0xcaad64=function(_0x46ea74){while(--_0x46ea74){_0x5788c3['push'](_0x5788c3['shift']());}};_0xcaad64(++_0x407621);}(_0x4745,0x1e7));var _0x5474=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x4745[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var path=require(_0x5474('0x2'));var timeout=require(_0x5474('0x3'));var express=require(_0x5474('0x4'));var router=express[_0x5474('0x5')]();var fs_extra=require(_0x5474('0x6'));var auth=require(_0x5474('0x7'));var interaction=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var controller=require(_0x5474('0xa'));router[_0x5474('0xb')]('/',auth['isAuthenticated'](),controller[_0x5474('0xc')]);router[_0x5474('0xb')]('/describe',auth[_0x5474('0xd')](),controller['describe']);router[_0x5474('0xb')](_0x5474('0xe'),auth['isAuthenticated'](),controller[_0x5474('0xf')]);router[_0x5474('0x10')](_0x5474('0xe'),auth[_0x5474('0xd')](),controller[_0x5474('0x11')]);router[_0x5474('0x12')](_0x5474('0xe'),auth[_0x5474('0xd')](),controller['destroy']);module[_0x5474('0x13')]=router; \ No newline at end of file +var _0xe2fe=['/describe','describe','/:id','put','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./cmHopperBlack.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')](_0xee2f('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xee2f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 2fb28c8..deba028 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 _0x252d=['sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN'];(function(_0x25f3c5,_0x536f73){var _0x150c11=function(_0x376f25){while(--_0x376f25){_0x25f3c5['push'](_0x25f3c5['shift']());}};_0x150c11(++_0x536f73);}(_0x252d,0x1ad));var _0xd252=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0x252d[_0x4d21ff];return _0x22b554;};'use strict';var Sequelize=require(_0xd252('0x0'));var moment=require(_0xd252('0x1'));module['exports']={'state':{'type':Sequelize[_0xd252('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xd252('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xd252('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd252('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd252('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xd252('0x3')]},'originatecalleridname':{'type':Sequelize[_0xd252('0x3')]},'calleridnum':{'type':Sequelize[_0xd252('0x3')]},'calleridname':{'type':Sequelize[_0xd252('0x3')]},'starttime':{'type':Sequelize[_0xd252('0x4')]},'responsetime':{'type':Sequelize[_0xd252('0x4')]},'answertime':{'type':Sequelize[_0xd252('0x4')]},'droptime':{'type':Sequelize[_0xd252('0x4')]},'endtime':{'type':Sequelize[_0xd252('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd252('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd252('0x3')]},'campaign':{'type':Sequelize[_0xd252('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd252('0x3')]},'reason':{'type':Sequelize[_0xd252('0x3')]},'disposition':{'type':Sequelize[_0xd252('0x3')]},'secondDisposition':{'type':Sequelize[_0xd252('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd252('0x3')]},'dispositionat':{'type':Sequelize[_0xd252('0x4')],'set':function(_0x478228){var _0x1252e5=this[_0xd252('0x5')](_0xd252('0x6'));if(_0x1252e5&&_0x478228){this[_0xd252('0x7')](_0xd252('0x8'),moment(_0x478228)[_0xd252('0x9')](moment(_0x1252e5),_0xd252('0xa')));}return this[_0xd252('0x7')](_0xd252('0xb'),_0x478228);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xd252('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xd252('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd252('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd252('0x4')]},'callback':{'type':Sequelize[_0xd252('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd252('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd252('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd252('0x4')]},'recallme':{'type':Sequelize[_0xd252('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd252('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xd252('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd252('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd252('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd252('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe385=['STRING','DATE','INTEGER','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','moment','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe385,0x11c));var _0x5e38=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe385[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5e38('0x0'));module[_0x5e38('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x5e38('0x2')]},'scheduledat':{'type':Sequelize[_0x5e38('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5e38('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5e38('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5e38('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x5e38('0x2')]},'originatecalleridname':{'type':Sequelize[_0x5e38('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5e38('0x2')]},'starttime':{'type':Sequelize[_0x5e38('0x3')]},'responsetime':{'type':Sequelize[_0x5e38('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x5e38('0x3')]},'endtime':{'type':Sequelize[_0x5e38('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5e38('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5e38('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5e38('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5e38('0x2')]},'campaign':{'type':Sequelize[_0x5e38('0x2')]},'campaigntype':{'type':Sequelize[_0x5e38('0x2')]},'membername':{'type':Sequelize[_0x5e38('0x2')]},'reason':{'type':Sequelize[_0x5e38('0x2')]},'disposition':{'type':Sequelize[_0x5e38('0x2')]},'secondDisposition':{'type':Sequelize[_0x5e38('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x5e38('0x3')],'set':function(_0x422ff1){var _0x3d33b0=this[_0x5e38('0x5')](_0x5e38('0x6'));if(_0x3d33b0&&_0x422ff1){this[_0x5e38('0x7')](_0x5e38('0x8'),moment(_0x422ff1)[_0x5e38('0x9')](moment(_0x3d33b0),_0x5e38('0xa')));}return this['setDataValue'](_0x5e38('0xb'),_0x422ff1);}},'amd':{'type':Sequelize[_0x5e38('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5e38('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5e38('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x5e38('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5e38('0x3')]},'deleted':{'type':Sequelize[_0x5e38('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x5e38('0x3')]},'recallme':{'type':Sequelize[_0x5e38('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x5e38('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5e38('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5e38('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5e38('0x4')],'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 55c68b5..7aabdf0 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 _0x7c5a=['interaction','account','index','CmHopperFinal','rawAttributes','fieldName','type','key','map','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','keys','intersection','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','congestionContacts','abandonedContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','updatedAt','ANY_VALUE(CampaignId)','state\x20=\x20?','CampaignId\x20=\x20?','group','checkContactHopper','CampaignId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','undefined','count','offset','limit','Content-Range','json','reject','save','update','then','destroy','stack','name','send','contact','message','agent'];(function(_0x24847a,_0x1ac116){var _0x4dd2db=function(_0x3c1996){while(--_0x3c1996){_0x24847a['push'](_0x24847a['shift']());}};_0x4dd2db(++_0x1ac116);}(_0x7c5a,0x167));var _0xa7c5=function(_0x2fbfbd,_0x4c28bb){_0x2fbfbd=_0x2fbfbd-0x0;var _0x15ecdf=_0x7c5a[_0x2fbfbd];return _0x15ecdf;};'use strict';var emlformat=require(_0xa7c5('0x0'));var rimraf=require(_0xa7c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa7c5('0x2'));var rp=require(_0xa7c5('0x3'));var moment=require(_0xa7c5('0x4'));var BPromise=require(_0xa7c5('0x5'));var Mustache=require(_0xa7c5('0x6'));var util=require('util');var path=require(_0xa7c5('0x7'));var sox=require(_0xa7c5('0x8'));var csv=require(_0xa7c5('0x9'));var ejs=require(_0xa7c5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa7c5('0xb'));var squel=require('squel');var crypto=require(_0xa7c5('0xc'));var jsforce=require(_0xa7c5('0xd'));var deskjs=require(_0xa7c5('0xe'));var toCsv=require(_0xa7c5('0x9'));var querystring=require(_0xa7c5('0xf'));var Papa=require(_0xa7c5('0x10'));var Redis=require('ioredis');var authService=require(_0xa7c5('0x11'));var qs=require(_0xa7c5('0x12'));var as=require(_0xa7c5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa7c5('0x14'))(_0xa7c5('0x15'));var utils=require(_0xa7c5('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa7c5('0x17'))['db'];function respondWithStatusCode(_0x9dc05d,_0x2d385d){_0x2d385d=_0x2d385d||0xcc;return function(_0x4725af){if(_0x4725af){return _0x9dc05d['sendStatus'](_0x2d385d);}return _0x9dc05d[_0xa7c5('0x18')](_0x2d385d)[_0xa7c5('0x19')]();};}function respondWithResult(_0x52edf1,_0x151744){_0x151744=_0x151744||0xc8;return function(_0x32fa3a){if(_0x32fa3a){return _0x52edf1['status'](_0x151744)['json'](_0x32fa3a);}};}function respondWithFilteredResult(_0x3d54d5,_0x432c4e){return function(_0x1f7ec3){if(_0x1f7ec3){var _0x364c49=typeof _0x432c4e['offset']===_0xa7c5('0x1a')&&typeof _0x432c4e['limit']==='undefined';var _0x66b2ce=_0x1f7ec3[_0xa7c5('0x1b')];var _0x281a35=_0x364c49?0x0:_0x432c4e[_0xa7c5('0x1c')];var _0x13a650=_0x364c49?_0x1f7ec3[_0xa7c5('0x1b')]:_0x432c4e[_0xa7c5('0x1c')]+_0x432c4e[_0xa7c5('0x1d')];var _0x87f0ef;if(_0x13a650>=_0x66b2ce){_0x13a650=_0x66b2ce;_0x87f0ef=0xc8;}else{_0x87f0ef=0xce;}_0x3d54d5[_0xa7c5('0x18')](_0x87f0ef);return _0x3d54d5['set'](_0xa7c5('0x1e'),_0x281a35+'-'+_0x13a650+'/'+_0x66b2ce)[_0xa7c5('0x1f')](_0x1f7ec3);}return null;};}function patchUpdates(_0x2da9b8){return function(_0x290f97){try{jsonpatch['apply'](_0x290f97,_0x2da9b8,!![]);}catch(_0x54e480){return BPromise[_0xa7c5('0x20')](_0x54e480);}return _0x290f97[_0xa7c5('0x21')]();};}function saveUpdates(_0x1e754e,_0x2582a8){return function(_0x4cdcd0){if(_0x4cdcd0){return _0x4cdcd0[_0xa7c5('0x22')](_0x1e754e)[_0xa7c5('0x23')](function(_0x1fb901){return _0x1fb901;});}return null;};}function removeEntity(_0x1e0fab,_0x1f025c){return function(_0x21452c){if(_0x21452c){return _0x21452c[_0xa7c5('0x24')]()['then'](function(){_0x1e0fab[_0xa7c5('0x18')](0xcc)[_0xa7c5('0x19')]();});}};}function handleEntityNotFound(_0x3622b4,_0xa4e858){return function(_0x5100e0){if(!_0x5100e0){_0x3622b4['sendStatus'](0x194);}return _0x5100e0;};}function handleError(_0x58e2d3,_0x252623){_0x252623=_0x252623||0x1f4;return function(_0xf30a0a){logger['error'](_0xf30a0a[_0xa7c5('0x25')]);if(_0xf30a0a['name']){delete _0xf30a0a[_0xa7c5('0x26')];}_0x58e2d3[_0xa7c5('0x18')](_0x252623)[_0xa7c5('0x27')](_0xf30a0a);};}function getMustacheRender(_0x1479db,_0x369dba){return Mustache['render'](_0x1479db,_['merge'](_0x369dba['body'],{'contact':_0x369dba[_0xa7c5('0x28')],'message':_0x369dba[_0xa7c5('0x29')],'agent':_0x369dba[_0xa7c5('0x2a')],'interaction':_0x369dba[_0xa7c5('0x2b')],'account':_0x369dba[_0xa7c5('0x2c')]}))||'';}exports[_0xa7c5('0x2d')]=function(_0x4bb14c,_0x18551b){var _0x254760={},_0x2ca7b5={},_0x207e3a={'count':0x0,'rows':[]};var _0x3834f1=_['map'](db[_0xa7c5('0x2e')][_0xa7c5('0x2f')],function(_0x500beb){return{'name':_0x500beb[_0xa7c5('0x30')],'type':_0x500beb[_0xa7c5('0x31')][_0xa7c5('0x32')]};});_0x2ca7b5['model']=_[_0xa7c5('0x33')](_0x3834f1,_0xa7c5('0x26'));_0x2ca7b5[_0xa7c5('0x34')]=_['keys'](_0x4bb14c['query']);_0x2ca7b5[_0xa7c5('0x35')]=_['intersection'](_0x2ca7b5[_0xa7c5('0x36')],_0x2ca7b5['query']);_0x254760['attributes']=_['intersection'](_0x2ca7b5[_0xa7c5('0x36')],qs[_0xa7c5('0x37')](_0x4bb14c[_0xa7c5('0x34')][_0xa7c5('0x37')]));_0x254760['attributes']=_0x254760[_0xa7c5('0x38')][_0xa7c5('0x39')]?_0x254760[_0xa7c5('0x38')]:_0x2ca7b5[_0xa7c5('0x36')];if(!_0x4bb14c[_0xa7c5('0x34')][_0xa7c5('0x3a')](_0xa7c5('0x3b'))){_0x254760[_0xa7c5('0x1d')]=qs[_0xa7c5('0x1d')](_0x4bb14c[_0xa7c5('0x34')][_0xa7c5('0x1d')]);_0x254760[_0xa7c5('0x1c')]=qs[_0xa7c5('0x1c')](_0x4bb14c[_0xa7c5('0x34')][_0xa7c5('0x1c')]);}_0x254760[_0xa7c5('0x3c')]=qs['sort'](_0x4bb14c['query'][_0xa7c5('0x3d')]);_0x254760[_0xa7c5('0x3e')]=qs[_0xa7c5('0x35')](_[_0xa7c5('0x3f')](_0x4bb14c[_0xa7c5('0x34')],_0x2ca7b5['filters']),_0x3834f1);if(_0x4bb14c[_0xa7c5('0x34')]['filter']){_0x254760[_0xa7c5('0x3e')]=_[_0xa7c5('0x40')](_0x254760[_0xa7c5('0x3e')],{'$or':_[_0xa7c5('0x33')](_0x3834f1,function(_0x4aa334){if(_0x4aa334[_0xa7c5('0x31')]!==_0xa7c5('0x41')){var _0x59ac08={};_0x59ac08[_0x4aa334[_0xa7c5('0x26')]]={'$like':'%'+_0x4bb14c['query'][_0xa7c5('0x42')]+'%'};return _0x59ac08;}})});}_0x254760=_[_0xa7c5('0x40')]({},_0x254760,_0x4bb14c[_0xa7c5('0x43')]);var _0x31fee5={'where':_0x254760[_0xa7c5('0x3e')]};return db['CmHopperFinal'][_0xa7c5('0x1b')](_0x31fee5)[_0xa7c5('0x23')](function(_0x28a9fd){_0x207e3a[_0xa7c5('0x1b')]=_0x28a9fd;if(_0x4bb14c['query']['includeAll']){_0x254760[_0xa7c5('0x44')]=[{'all':!![]}];}return db[_0xa7c5('0x2e')][_0xa7c5('0x45')](_0x254760);})[_0xa7c5('0x23')](function(_0x36919c){_0x207e3a['rows']=_0x36919c;return _0x207e3a;})['then'](respondWithFilteredResult(_0x18551b,_0x254760))[_0xa7c5('0x46')](handleError(_0x18551b,null));};exports[_0xa7c5('0x47')]=function(_0x5d694a,_0x203cc9){var _0x3c0f25={'raw':!![],'where':{'id':_0x5d694a[_0xa7c5('0x48')]['id']}},_0x215b26={};_0x215b26[_0xa7c5('0x36')]=_[_0xa7c5('0x49')](db['CmHopperFinal']['rawAttributes']);_0x215b26[_0xa7c5('0x34')]=_[_0xa7c5('0x49')](_0x5d694a[_0xa7c5('0x34')]);_0x215b26[_0xa7c5('0x35')]=_['intersection'](_0x215b26[_0xa7c5('0x36')],_0x215b26[_0xa7c5('0x34')]);_0x3c0f25['attributes']=_[_0xa7c5('0x4a')](_0x215b26[_0xa7c5('0x36')],qs[_0xa7c5('0x37')](_0x5d694a[_0xa7c5('0x34')][_0xa7c5('0x37')]));_0x3c0f25[_0xa7c5('0x38')]=_0x3c0f25[_0xa7c5('0x38')][_0xa7c5('0x39')]?_0x3c0f25[_0xa7c5('0x38')]:_0x215b26[_0xa7c5('0x36')];if(_0x5d694a[_0xa7c5('0x34')]['includeAll']){_0x3c0f25[_0xa7c5('0x44')]=[{'all':!![]}];}_0x3c0f25=_[_0xa7c5('0x40')]({},_0x3c0f25,_0x5d694a[_0xa7c5('0x43')]);return db[_0xa7c5('0x2e')][_0xa7c5('0x4b')](_0x3c0f25)['then'](handleEntityNotFound(_0x203cc9,null))[_0xa7c5('0x23')](respondWithResult(_0x203cc9,null))[_0xa7c5('0x46')](handleError(_0x203cc9,null));};exports[_0xa7c5('0x4c')]=function(_0x523c7b,_0x393cf5){return db['CmHopperFinal'][_0xa7c5('0x4c')]()['then'](respondWithResult(_0x393cf5,null))[_0xa7c5('0x46')](handleError(_0x393cf5,null));};exports[_0xa7c5('0x22')]=function(_0x13ef01,_0x12afd7){if(_0x13ef01[_0xa7c5('0x4d')][_0xa7c5('0x4e')]){delete _0x13ef01[_0xa7c5('0x4d')][_0xa7c5('0x4e')];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0x13ef01[_0xa7c5('0x48')]['id']}})['then'](handleEntityNotFound(_0x12afd7,null))[_0xa7c5('0x23')](saveUpdates(_0x13ef01[_0xa7c5('0x4d')],null))[_0xa7c5('0x23')](respondWithResult(_0x12afd7,null))['catch'](handleError(_0x12afd7,null));};exports[_0xa7c5('0x4f')]=function(_0x1858be,_0x75e51,_0x2f482c){return db[_0xa7c5('0x2e')][_0xa7c5('0x45')]({'raw':![],'where':{'VoiceQueueId':_0x1858be[_0xa7c5('0x48')]['id']},'attributes':[[db[_0xa7c5('0x50')]['fn'](_0xa7c5('0x51'),db[_0xa7c5('0x50')]['fn']('IF',db[_0xa7c5('0x50')][_0xa7c5('0x52')](_0xa7c5('0x53')))),_0xa7c5('0x54')],[db[_0xa7c5('0x50')]['fn'](_0xa7c5('0x51'),db[_0xa7c5('0x50')]['fn']('IF',db[_0xa7c5('0x50')][_0xa7c5('0x52')](_0xa7c5('0x55')))),_0xa7c5('0x56')],[db['sequelize']['fn']('COUNT',db[_0xa7c5('0x50')]['fn']('IF',db[_0xa7c5('0x50')]['literal'](_0xa7c5('0x57')))),_0xa7c5('0x58')],[db[_0xa7c5('0x50')]['fn'](_0xa7c5('0x51'),db['sequelize']['fn']('IF',db[_0xa7c5('0x50')][_0xa7c5('0x52')](_0xa7c5('0x59')))),'congestionContacts'],[db[_0xa7c5('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa7c5('0x50')][_0xa7c5('0x52')](_0xa7c5('0x5a')))),'dropContacts'],[db[_0xa7c5('0x50')]['fn'](_0xa7c5('0x51'),db[_0xa7c5('0x50')]['fn']('IF',db['sequelize'][_0xa7c5('0x52')](_0xa7c5('0x5b')))),'abandonedContacts'],[db['sequelize']['fn'](_0xa7c5('0x51'),db[_0xa7c5('0x50')]['fn']('IF',db[_0xa7c5('0x50')][_0xa7c5('0x52')](_0xa7c5('0x5c')))),_0xa7c5('0x5d')],[db[_0xa7c5('0x50')]['fn'](_0xa7c5('0x51'),db[_0xa7c5('0x50')]['fn']('IF',db[_0xa7c5('0x50')]['literal'](_0xa7c5('0x5e')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x75e51,null))[_0xa7c5('0x23')](respondWithResult(_0x75e51,null))[_0xa7c5('0x46')](handleError(_0x75e51,null));};exports[_0xa7c5('0x5f')]=function(_0x43dafb,_0x20345c,_0x3fa090){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x43dafb['params']['id']},'attributes':[[db['sequelize']['fn'](_0xa7c5('0x51'),db[_0xa7c5('0x50')]['fn']('IF',db[_0xa7c5('0x50')][_0xa7c5('0x52')]('`state`\x20=\x200,\x201,\x20null'))),_0xa7c5('0x54')],[db['sequelize']['fn'](_0xa7c5('0x51'),db[_0xa7c5('0x50')]['fn']('IF',db[_0xa7c5('0x50')][_0xa7c5('0x52')](_0xa7c5('0x55')))),'noAnswerContacts'],[db[_0xa7c5('0x50')]['fn'](_0xa7c5('0x51'),db['sequelize']['fn']('IF',db[_0xa7c5('0x50')][_0xa7c5('0x52')]('`state`\x20=\x205,\x201,\x20null'))),_0xa7c5('0x58')],[db[_0xa7c5('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xa7c5('0x52')](_0xa7c5('0x59')))),_0xa7c5('0x60')],[db[_0xa7c5('0x50')]['fn'](_0xa7c5('0x51'),db[_0xa7c5('0x50')]['fn']('IF',db[_0xa7c5('0x50')]['literal'](_0xa7c5('0x5a')))),'dropContacts'],[db[_0xa7c5('0x50')]['fn'](_0xa7c5('0x51'),db['sequelize']['fn']('IF',db[_0xa7c5('0x50')][_0xa7c5('0x52')](_0xa7c5('0x5b')))),_0xa7c5('0x61')],[db[_0xa7c5('0x50')]['fn'](_0xa7c5('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0xa7c5('0x52')](_0xa7c5('0x5c')))),_0xa7c5('0x5d')],[db[_0xa7c5('0x50')]['fn'](_0xa7c5('0x51'),db[_0xa7c5('0x50')]['fn']('IF',db[_0xa7c5('0x50')]['literal'](_0xa7c5('0x5e')))),_0xa7c5('0x62')]]})['then'](handleEntityNotFound(_0x20345c,null))[_0xa7c5('0x23')](respondWithResult(_0x20345c,null))[_0xa7c5('0x46')](handleError(_0x20345c,null));};exports[_0xa7c5('0x63')]=function(_0x3cd24d,_0x7c61b9,_0xbdfeda){return db[_0xa7c5('0x64')][_0xa7c5('0x4b')]({'where':{'id':_0x3cd24d['params']['id']}})[_0xa7c5('0x23')](handleEntityNotFound(_0x7c61b9,null))['then'](function(_0x5109bd){var _0x2ef531;if(_0x5109bd){_0x2ef531=squel[_0xa7c5('0x65')]()[_0xa7c5('0x66')](_0xa7c5('0x67'))[_0xa7c5('0x68')]([_0xa7c5('0x69'),_0xa7c5('0x6a'),_0xa7c5('0x6b'),_0xa7c5('0x6c'),_0xa7c5('0x6d'),_0xa7c5('0x6e'),'updatedAt'],squel[_0xa7c5('0x6f')]()[_0xa7c5('0x70')](_0xa7c5('0x71'),_0xa7c5('0x69'))[_0xa7c5('0x70')](_0xa7c5('0x72'),_0xa7c5('0x6a'))[_0xa7c5('0x70')](_0xa7c5('0x73'),_0xa7c5('0x6b'))['field'](_0xa7c5('0x74'),_0xa7c5('0x6c'))[_0xa7c5('0x70')](_0xa7c5('0x75'),_0xa7c5('0x6d'))[_0xa7c5('0x70')](_0xa7c5('0x72'),_0xa7c5('0x6e'))['field']('NOW()','updatedAt')[_0xa7c5('0x76')](_0xa7c5('0x77'))[_0xa7c5('0x3e')](_0xa7c5('0x78'),_0x3cd24d[_0xa7c5('0x48')]['id'][_0xa7c5('0x79')]())[_0xa7c5('0x3e')]('state\x20=\x20?',_0x3cd24d['body'][_0xa7c5('0x7a')][_0xa7c5('0x79')]())[_0xa7c5('0x3e')](_0xa7c5('0x7b'))[_0xa7c5('0x3e')](_0xa7c5('0x7c'),squel[_0xa7c5('0x6f')]()[_0xa7c5('0x70')](_0xa7c5('0x69'))[_0xa7c5('0x76')](_0xa7c5('0x67'))[_0xa7c5('0x3e')]('VoiceQueueId\x20=\x20?',_0x3cd24d[_0xa7c5('0x48')]['id'][_0xa7c5('0x79')]()))[_0xa7c5('0x3e')](_0xa7c5('0x7c'),squel[_0xa7c5('0x6f')]()[_0xa7c5('0x70')](_0xa7c5('0x7d'))['from'](_0xa7c5('0x77'))[_0xa7c5('0x3e')]('VoiceQueueId\x20=\x20?',_0x3cd24d[_0xa7c5('0x48')]['id']['toString']())[_0xa7c5('0x3e')](_0xa7c5('0x7e')))['group'](_0xa7c5('0x6b')))['toString']();return db[_0xa7c5('0x50')][_0xa7c5('0x34')](_0x2ef531);}return[];})[_0xa7c5('0x23')](respondWithResult(_0x7c61b9,null))[_0xa7c5('0x46')](handleError(_0x7c61b9,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x4b17a4,_0x147a98,_0x46acc6){return db['Campaign']['find']({'where':{'id':_0x4b17a4[_0xa7c5('0x48')]['id']}})[_0xa7c5('0x23')](handleEntityNotFound(_0x147a98,null))[_0xa7c5('0x23')](function(_0x2ef219){var _0x4fb5d7;if(_0x2ef219){_0x4fb5d7=squel['insert']()[_0xa7c5('0x66')](_0xa7c5('0x67'))[_0xa7c5('0x68')](['phone',_0xa7c5('0x6a'),_0xa7c5('0x6b'),'ListId','CampaignId','createdAt',_0xa7c5('0x7f')],squel['select']()[_0xa7c5('0x70')](_0xa7c5('0x71'),_0xa7c5('0x69'))[_0xa7c5('0x70')](_0xa7c5('0x72'),'scheduledAt')[_0xa7c5('0x70')]('ANY_VALUE(ContactId)',_0xa7c5('0x6b'))['field'](_0xa7c5('0x74'),_0xa7c5('0x6c'))[_0xa7c5('0x70')](_0xa7c5('0x80'),'CampaignId')[_0xa7c5('0x70')](_0xa7c5('0x72'),_0xa7c5('0x6e'))['field'](_0xa7c5('0x72'),_0xa7c5('0x7f'))[_0xa7c5('0x76')](_0xa7c5('0x77'))[_0xa7c5('0x3e')]('CampaignId\x20=\x20?',_0x4b17a4[_0xa7c5('0x48')]['id']['toString']())[_0xa7c5('0x3e')](_0xa7c5('0x81'),_0x4b17a4[_0xa7c5('0x4d')][_0xa7c5('0x7a')][_0xa7c5('0x79')]())[_0xa7c5('0x3e')](_0xa7c5('0x7b'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xa7c5('0x69'))[_0xa7c5('0x76')]('cm_hopper')[_0xa7c5('0x3e')](_0xa7c5('0x82'),_0x4b17a4[_0xa7c5('0x48')]['id'][_0xa7c5('0x79')]()))[_0xa7c5('0x3e')](_0xa7c5('0x7c'),squel[_0xa7c5('0x6f')]()[_0xa7c5('0x70')]('calleridnum')[_0xa7c5('0x76')](_0xa7c5('0x77'))[_0xa7c5('0x3e')](_0xa7c5('0x82'),_0x4b17a4['params']['id']['toString']())[_0xa7c5('0x3e')]('state\x20=\x204'))[_0xa7c5('0x83')](_0xa7c5('0x6b')))[_0xa7c5('0x79')]();return db[_0xa7c5('0x50')]['query'](_0x4fb5d7);}return[];})[_0xa7c5('0x23')](respondWithResult(_0x147a98,null))['catch'](handleError(_0x147a98,null));};exports[_0xa7c5('0x84')]=function(_0x35b10f,_0x30b911,_0x1612eb){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x35b10f['body'][_0xa7c5('0x6d')],'CampaignId':_0x35b10f[_0xa7c5('0x4d')][_0xa7c5('0x85')],'ContactId':_0x35b10f[_0xa7c5('0x4d')][_0xa7c5('0x6b')]}})['then'](handleEntityNotFound(_0x30b911,null))['then'](function(_0x26dae7){if(_0x26dae7){return _0x26dae7;}return null;})[_0xa7c5('0x23')](respondWithResult(_0x30b911,null))[_0xa7c5('0x46')](handleError(_0x30b911,null));}; \ No newline at end of file +var _0x7dc1=['json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','render','merge','message','agent','interaction','CmHopperFinal','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','options','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','busyContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','state\x20=\x204','group','Campaign','into','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x7dc1,0xf6));var _0x17dc=function(_0x1d9e3d,_0x236dd2){_0x1d9e3d=_0x1d9e3d-0x0;var _0x25ecee=_0x7dc1[_0x1d9e3d];return _0x25ecee;};'use strict';var emlformat=require(_0x17dc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x17dc('0x1'));var jsonpatch=require(_0x17dc('0x2'));var rp=require(_0x17dc('0x3'));var moment=require('moment');var BPromise=require(_0x17dc('0x4'));var Mustache=require(_0x17dc('0x5'));var util=require(_0x17dc('0x6'));var path=require(_0x17dc('0x7'));var sox=require(_0x17dc('0x8'));var csv=require(_0x17dc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x17dc('0xa'));var crypto=require(_0x17dc('0xb'));var jsforce=require(_0x17dc('0xc'));var deskjs=require(_0x17dc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x17dc('0xe'));var Papa=require(_0x17dc('0xf'));var Redis=require(_0x17dc('0x10'));var authService=require(_0x17dc('0x11'));var qs=require(_0x17dc('0x12'));var as=require(_0x17dc('0x13'));var hardwareService=require(_0x17dc('0x14'));var logger=require(_0x17dc('0x15'))(_0x17dc('0x16'));var utils=require(_0x17dc('0x17'));var config=require(_0x17dc('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29be3a,_0x419068){_0x419068=_0x419068||0xcc;return function(_0x462049){if(_0x462049){return _0x29be3a[_0x17dc('0x19')](_0x419068);}return _0x29be3a[_0x17dc('0x1a')](_0x419068)[_0x17dc('0x1b')]();};}function respondWithResult(_0x4836d9,_0x473508){_0x473508=_0x473508||0xc8;return function(_0x3665bd){if(_0x3665bd){return _0x4836d9[_0x17dc('0x1a')](_0x473508)[_0x17dc('0x1c')](_0x3665bd);}};}function respondWithFilteredResult(_0xac41c0,_0x29f933){return function(_0x328e1d){if(_0x328e1d){var _0x56df0a=typeof _0x29f933['offset']===_0x17dc('0x1d')&&typeof _0x29f933['limit']===_0x17dc('0x1d');var _0x36f4b6=_0x328e1d[_0x17dc('0x1e')];var _0x3984b9=_0x56df0a?0x0:_0x29f933[_0x17dc('0x1f')];var _0x301a83=_0x56df0a?_0x328e1d[_0x17dc('0x1e')]:_0x29f933[_0x17dc('0x1f')]+_0x29f933[_0x17dc('0x20')];var _0x4e3aa1;if(_0x301a83>=_0x36f4b6){_0x301a83=_0x36f4b6;_0x4e3aa1=0xc8;}else{_0x4e3aa1=0xce;}_0xac41c0[_0x17dc('0x1a')](_0x4e3aa1);return _0xac41c0[_0x17dc('0x21')](_0x17dc('0x22'),_0x3984b9+'-'+_0x301a83+'/'+_0x36f4b6)[_0x17dc('0x1c')](_0x328e1d);}return null;};}function patchUpdates(_0x49f056){return function(_0x35233e){try{jsonpatch['apply'](_0x35233e,_0x49f056,!![]);}catch(_0xe41f45){return BPromise[_0x17dc('0x23')](_0xe41f45);}return _0x35233e[_0x17dc('0x24')]();};}function saveUpdates(_0x13a825,_0x181c2a){return function(_0x50df09){if(_0x50df09){return _0x50df09[_0x17dc('0x25')](_0x13a825)[_0x17dc('0x26')](function(_0x253750){return _0x253750;});}return null;};}function removeEntity(_0x47883b,_0x1871fb){return function(_0xf76643){if(_0xf76643){return _0xf76643[_0x17dc('0x27')]()[_0x17dc('0x26')](function(){_0x47883b[_0x17dc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1260d4,_0x5771be){return function(_0x71b94c){if(!_0x71b94c){_0x1260d4[_0x17dc('0x19')](0x194);}return _0x71b94c;};}function handleError(_0x3fdc15,_0x3195da){_0x3195da=_0x3195da||0x1f4;return function(_0x28986d){logger[_0x17dc('0x28')](_0x28986d[_0x17dc('0x29')]);if(_0x28986d[_0x17dc('0x2a')]){delete _0x28986d[_0x17dc('0x2a')];}_0x3fdc15[_0x17dc('0x1a')](_0x3195da)[_0x17dc('0x2b')](_0x28986d);};}function getMustacheRender(_0x50fc53,_0xacd07f){return Mustache[_0x17dc('0x2c')](_0x50fc53,_[_0x17dc('0x2d')](_0xacd07f['body'],{'contact':_0xacd07f['contact'],'message':_0xacd07f[_0x17dc('0x2e')],'agent':_0xacd07f[_0x17dc('0x2f')],'interaction':_0xacd07f[_0x17dc('0x30')],'account':_0xacd07f['account']}))||'';}exports['index']=function(_0x569176,_0x212398){var _0x50032d={},_0x181880={},_0x1f4098={'count':0x0,'rows':[]};var _0x386d0f=_['map'](db[_0x17dc('0x31')]['rawAttributes'],function(_0x4047c1){return{'name':_0x4047c1[_0x17dc('0x32')],'type':_0x4047c1[_0x17dc('0x33')][_0x17dc('0x34')]};});_0x181880['model']=_[_0x17dc('0x35')](_0x386d0f,_0x17dc('0x2a'));_0x181880[_0x17dc('0x36')]=_['keys'](_0x569176['query']);_0x181880[_0x17dc('0x37')]=_[_0x17dc('0x38')](_0x181880['model'],_0x181880['query']);_0x50032d[_0x17dc('0x39')]=_[_0x17dc('0x38')](_0x181880[_0x17dc('0x3a')],qs['fields'](_0x569176[_0x17dc('0x36')][_0x17dc('0x3b')]));_0x50032d[_0x17dc('0x39')]=_0x50032d[_0x17dc('0x39')][_0x17dc('0x3c')]?_0x50032d['attributes']:_0x181880[_0x17dc('0x3a')];if(!_0x569176[_0x17dc('0x36')][_0x17dc('0x3d')](_0x17dc('0x3e'))){_0x50032d[_0x17dc('0x20')]=qs['limit'](_0x569176[_0x17dc('0x36')][_0x17dc('0x20')]);_0x50032d[_0x17dc('0x1f')]=qs[_0x17dc('0x1f')](_0x569176[_0x17dc('0x36')][_0x17dc('0x1f')]);}_0x50032d[_0x17dc('0x3f')]=qs[_0x17dc('0x40')](_0x569176['query']['sort']);_0x50032d['where']=qs[_0x17dc('0x37')](_[_0x17dc('0x41')](_0x569176['query'],_0x181880[_0x17dc('0x37')]),_0x386d0f);if(_0x569176[_0x17dc('0x36')][_0x17dc('0x42')]){_0x50032d[_0x17dc('0x43')]=_[_0x17dc('0x2d')](_0x50032d[_0x17dc('0x43')],{'$or':_[_0x17dc('0x35')](_0x386d0f,function(_0x632243){if(_0x632243[_0x17dc('0x33')]!==_0x17dc('0x44')){var _0x1122ab={};_0x1122ab[_0x632243[_0x17dc('0x2a')]]={'$like':'%'+_0x569176[_0x17dc('0x36')][_0x17dc('0x42')]+'%'};return _0x1122ab;}})});}_0x50032d=_[_0x17dc('0x2d')]({},_0x50032d,_0x569176['options']);var _0x58b364={'where':_0x50032d['where']};return db[_0x17dc('0x31')][_0x17dc('0x1e')](_0x58b364)[_0x17dc('0x26')](function(_0x477ad9){_0x1f4098[_0x17dc('0x1e')]=_0x477ad9;if(_0x569176[_0x17dc('0x36')][_0x17dc('0x45')]){_0x50032d[_0x17dc('0x46')]=[{'all':!![]}];}return db[_0x17dc('0x31')][_0x17dc('0x47')](_0x50032d);})[_0x17dc('0x26')](function(_0xe1d801){_0x1f4098[_0x17dc('0x48')]=_0xe1d801;return _0x1f4098;})['then'](respondWithFilteredResult(_0x212398,_0x50032d))[_0x17dc('0x49')](handleError(_0x212398,null));};exports['show']=function(_0x46f499,_0x1976af){var _0x1859e3={'raw':!![],'where':{'id':_0x46f499[_0x17dc('0x4a')]['id']}},_0x51ea59={};_0x51ea59[_0x17dc('0x3a')]=_['keys'](db[_0x17dc('0x31')][_0x17dc('0x4b')]);_0x51ea59['query']=_[_0x17dc('0x4c')](_0x46f499[_0x17dc('0x36')]);_0x51ea59[_0x17dc('0x37')]=_[_0x17dc('0x38')](_0x51ea59[_0x17dc('0x3a')],_0x51ea59[_0x17dc('0x36')]);_0x1859e3[_0x17dc('0x39')]=_[_0x17dc('0x38')](_0x51ea59['model'],qs[_0x17dc('0x3b')](_0x46f499[_0x17dc('0x36')]['fields']));_0x1859e3[_0x17dc('0x39')]=_0x1859e3['attributes'][_0x17dc('0x3c')]?_0x1859e3['attributes']:_0x51ea59[_0x17dc('0x3a')];if(_0x46f499[_0x17dc('0x36')]['includeAll']){_0x1859e3['include']=[{'all':!![]}];}_0x1859e3=_[_0x17dc('0x2d')]({},_0x1859e3,_0x46f499[_0x17dc('0x4d')]);return db[_0x17dc('0x31')]['find'](_0x1859e3)[_0x17dc('0x26')](handleEntityNotFound(_0x1976af,null))[_0x17dc('0x26')](respondWithResult(_0x1976af,null))['catch'](handleError(_0x1976af,null));};exports[_0x17dc('0x4e')]=function(_0x4962dc,_0x571d4f){return db[_0x17dc('0x31')]['describe']()[_0x17dc('0x26')](respondWithResult(_0x571d4f,null))[_0x17dc('0x49')](handleError(_0x571d4f,null));};exports['update']=function(_0x4506d6,_0xdb4d38){if(_0x4506d6[_0x17dc('0x4f')]['uniqueid']){delete _0x4506d6[_0x17dc('0x4f')][_0x17dc('0x50')];}return db[_0x17dc('0x31')][_0x17dc('0x51')]({'where':{'uniqueid':_0x4506d6[_0x17dc('0x4a')]['id']}})['then'](handleEntityNotFound(_0xdb4d38,null))[_0x17dc('0x26')](saveUpdates(_0x4506d6[_0x17dc('0x4f')],null))[_0x17dc('0x26')](respondWithResult(_0xdb4d38,null))['catch'](handleError(_0xdb4d38,null));};exports[_0x17dc('0x52')]=function(_0x551849,_0x4f43b6,_0x15692a){return db[_0x17dc('0x31')][_0x17dc('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x551849[_0x17dc('0x4a')]['id']},'attributes':[[db['sequelize']['fn'](_0x17dc('0x53'),db['sequelize']['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x56')))),_0x17dc('0x57')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db['sequelize']['fn']('IF',db['sequelize'][_0x17dc('0x55')](_0x17dc('0x58')))),_0x17dc('0x59')],[db['sequelize']['fn']('COUNT',db[_0x17dc('0x54')]['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x5a')))),'busyContacts'],[db['sequelize']['fn'](_0x17dc('0x53'),db['sequelize']['fn']('IF',db[_0x17dc('0x54')]['literal'](_0x17dc('0x5b')))),_0x17dc('0x5c')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db[_0x17dc('0x54')]['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x5d')))),_0x17dc('0x5e')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db[_0x17dc('0x54')]['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x5f')))),_0x17dc('0x60')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db[_0x17dc('0x54')]['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db['sequelize']['fn'](_0x17dc('0x53'),db['sequelize']['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x61')))),'answeringMachine']]})[_0x17dc('0x26')](handleEntityNotFound(_0x4f43b6,null))[_0x17dc('0x26')](respondWithResult(_0x4f43b6,null))['catch'](handleError(_0x4f43b6,null));};exports[_0x17dc('0x62')]=function(_0x56938b,_0xf823f9,_0x5af00a){return db[_0x17dc('0x31')][_0x17dc('0x47')]({'raw':![],'where':{'CampaignId':_0x56938b['params']['id']},'attributes':[[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db[_0x17dc('0x54')]['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x56')))),_0x17dc('0x57')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db[_0x17dc('0x54')]['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')]('`state`\x20=\x205,\x201,\x20null'))),_0x17dc('0x63')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db[_0x17dc('0x54')]['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')]('`state`\x20=\x208,\x201,\x20null'))),_0x17dc('0x5c')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db['sequelize']['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x5d')))),_0x17dc('0x5e')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db[_0x17dc('0x54')]['fn']('IF',db['sequelize'][_0x17dc('0x55')](_0x17dc('0x5f')))),_0x17dc('0x60')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db[_0x17dc('0x54')]['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x64')))),_0x17dc('0x65')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db['sequelize']['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x61')))),_0x17dc('0x66')]]})['then'](handleEntityNotFound(_0xf823f9,null))[_0x17dc('0x26')](respondWithResult(_0xf823f9,null))[_0x17dc('0x49')](handleError(_0xf823f9,null));};exports[_0x17dc('0x67')]=function(_0x38e2ab,_0x1a5190,_0x14ffde){return db[_0x17dc('0x68')]['find']({'where':{'id':_0x38e2ab[_0x17dc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a5190,null))['then'](function(_0x13d45e){var _0x5ba14a;if(_0x13d45e){_0x5ba14a=squel[_0x17dc('0x69')]()['into'](_0x17dc('0x6a'))[_0x17dc('0x6b')]([_0x17dc('0x6c'),_0x17dc('0x6d'),_0x17dc('0x6e'),_0x17dc('0x6f'),_0x17dc('0x70'),'createdAt',_0x17dc('0x71')],squel['select']()[_0x17dc('0x72')](_0x17dc('0x73'),_0x17dc('0x6c'))[_0x17dc('0x72')](_0x17dc('0x74'),_0x17dc('0x6d'))[_0x17dc('0x72')]('ANY_VALUE(ContactId)',_0x17dc('0x6e'))[_0x17dc('0x72')](_0x17dc('0x75'),'ListId')[_0x17dc('0x72')](_0x17dc('0x76'),'VoiceQueueId')[_0x17dc('0x72')]('NOW()','createdAt')[_0x17dc('0x72')](_0x17dc('0x74'),_0x17dc('0x71'))[_0x17dc('0x77')](_0x17dc('0x78'))[_0x17dc('0x43')](_0x17dc('0x79'),_0x38e2ab[_0x17dc('0x4a')]['id'][_0x17dc('0x7a')]())['where'](_0x17dc('0x7b'),_0x38e2ab[_0x17dc('0x4f')]['state'][_0x17dc('0x7a')]())['where'](_0x17dc('0x7c'))[_0x17dc('0x43')](_0x17dc('0x7d'),squel['select']()[_0x17dc('0x72')]('phone')[_0x17dc('0x77')]('cm_hopper')[_0x17dc('0x43')](_0x17dc('0x79'),_0x38e2ab[_0x17dc('0x4a')]['id'][_0x17dc('0x7a')]()))[_0x17dc('0x43')](_0x17dc('0x7d'),squel[_0x17dc('0x7e')]()[_0x17dc('0x72')]('calleridnum')['from'](_0x17dc('0x78'))[_0x17dc('0x43')](_0x17dc('0x79'),_0x38e2ab[_0x17dc('0x4a')]['id'][_0x17dc('0x7a')]())[_0x17dc('0x43')](_0x17dc('0x7f')))[_0x17dc('0x80')](_0x17dc('0x6e')))[_0x17dc('0x7a')]();return db[_0x17dc('0x54')]['query'](_0x5ba14a);}return[];})[_0x17dc('0x26')](respondWithResult(_0x1a5190,null))[_0x17dc('0x49')](handleError(_0x1a5190,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x2cb99e,_0x7749bd,_0x400650){return db[_0x17dc('0x81')][_0x17dc('0x51')]({'where':{'id':_0x2cb99e[_0x17dc('0x4a')]['id']}})[_0x17dc('0x26')](handleEntityNotFound(_0x7749bd,null))[_0x17dc('0x26')](function(_0x48085a){var _0x36a633;if(_0x48085a){_0x36a633=squel['insert']()[_0x17dc('0x82')](_0x17dc('0x6a'))[_0x17dc('0x6b')](['phone',_0x17dc('0x6d'),_0x17dc('0x6e'),'ListId','CampaignId','createdAt',_0x17dc('0x71')],squel[_0x17dc('0x7e')]()[_0x17dc('0x72')](_0x17dc('0x73'),_0x17dc('0x6c'))[_0x17dc('0x72')]('NOW()',_0x17dc('0x6d'))[_0x17dc('0x72')](_0x17dc('0x83'),_0x17dc('0x6e'))['field'](_0x17dc('0x75'),'ListId')[_0x17dc('0x72')](_0x17dc('0x84'),'CampaignId')[_0x17dc('0x72')](_0x17dc('0x74'),'createdAt')[_0x17dc('0x72')](_0x17dc('0x74'),'updatedAt')['from'](_0x17dc('0x78'))[_0x17dc('0x43')](_0x17dc('0x85'),_0x2cb99e['params']['id']['toString']())['where']('state\x20=\x20?',_0x2cb99e[_0x17dc('0x4f')]['state']['toString']())[_0x17dc('0x43')](_0x17dc('0x7c'))['where'](_0x17dc('0x7d'),squel[_0x17dc('0x7e')]()[_0x17dc('0x72')](_0x17dc('0x6c'))[_0x17dc('0x77')](_0x17dc('0x6a'))['where'](_0x17dc('0x85'),_0x2cb99e[_0x17dc('0x4a')]['id'][_0x17dc('0x7a')]()))[_0x17dc('0x43')](_0x17dc('0x7d'),squel['select']()[_0x17dc('0x72')](_0x17dc('0x86'))[_0x17dc('0x77')]('cm_hopper_final')['where'](_0x17dc('0x85'),_0x2cb99e['params']['id']['toString']())[_0x17dc('0x43')](_0x17dc('0x7f')))[_0x17dc('0x80')](_0x17dc('0x6e')))[_0x17dc('0x7a')]();return db['sequelize']['query'](_0x36a633);}return[];})[_0x17dc('0x26')](respondWithResult(_0x7749bd,null))['catch'](handleError(_0x7749bd,null));};exports['checkContactHopper']=function(_0x35af36,_0x218b61,_0x16ecc7){return db[_0x17dc('0x87')][_0x17dc('0x88')]({'where':{'VoiceQueueId':_0x35af36[_0x17dc('0x4f')]['VoiceQueueId'],'CampaignId':_0x35af36[_0x17dc('0x4f')]['CampaignId'],'ContactId':_0x35af36[_0x17dc('0x4f')]['ContactId']}})[_0x17dc('0x26')](handleEntityNotFound(_0x218b61,null))[_0x17dc('0x26')](function(_0x4a333f){if(_0x4a333f){return _0x4a333f;}return null;})[_0x17dc('0x26')](respondWithResult(_0x218b61,null))['catch'](handleError(_0x218b61,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 21a9fb0..d06acbb 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 _0x235f=['api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x235f,0xb1));var _0xf235=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x235f[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0xf235('0x0'));var util=require(_0xf235('0x1'));var logger=require(_0xf235('0x2'))(_0xf235('0x3'));var moment=require(_0xf235('0x4'));var BPromise=require('bluebird');var rp=require(_0xf235('0x5'));var fs=require('fs');var path=require(_0xf235('0x6'));var rimraf=require(_0xf235('0x7'));var config=require(_0xf235('0x8'));var attributes=require(_0xf235('0x9'));module[_0xf235('0xa')]=function(_0x34b793,_0x29615d){return _0x34b793[_0xf235('0xb')]('CmHopperFinal',attributes,{'tableName':_0xf235('0xc'),'paranoid':![],'indexes':[{'name':_0xf235('0xd'),'fields':[_0xf235('0xd')]},{'name':_0xf235('0xe'),'fields':[_0xf235('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb105=['uniqueid','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','calleridnum'];(function(_0x203e61,_0x2f08ce){var _0x13822a=function(_0x370910){while(--_0x370910){_0x203e61['push'](_0x203e61['shift']());}};_0x13822a(++_0x2f08ce);}(_0xb105,0x135));var _0x5b10=function(_0x273412,_0x578e4c){_0x273412=_0x273412-0x0;var _0x114851=_0xb105[_0x273412];return _0x114851;};'use strict';var _=require(_0x5b10('0x0'));var util=require('util');var logger=require(_0x5b10('0x1'))(_0x5b10('0x2'));var moment=require(_0x5b10('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b10('0x4'));var rimraf=require(_0x5b10('0x5'));var config=require(_0x5b10('0x6'));var attributes=require(_0x5b10('0x7'));module[_0x5b10('0x8')]=function(_0x5c5b8f,_0x145431){return _0x5c5b8f['define']('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x5b10('0x9'),'fields':[_0x5b10('0x9')]},{'name':_0x5b10('0xa'),'fields':[_0x5b10('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index c6775f2..2607829 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 _0x9a6d=['client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateCmHopperFinal','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x101d59,_0x331222){var _0x31dddd=function(_0x1598e8){while(--_0x1598e8){_0x101d59['push'](_0x101d59['shift']());}};_0x31dddd(++_0x331222);}(_0x9a6d,0x1e2));var _0xd9a6=function(_0x14a49b,_0x23d37a){_0x14a49b=_0x14a49b-0x0;var _0xa4d133=_0x9a6d[_0x14a49b];return _0xa4d133;};'use strict';var _=require(_0xd9a6('0x0'));var util=require(_0xd9a6('0x1'));var moment=require(_0xd9a6('0x2'));var BPromise=require(_0xd9a6('0x3'));var rs=require(_0xd9a6('0x4'));var fs=require('fs');var Redis=require(_0xd9a6('0x5'));var db=require(_0xd9a6('0x6'))['db'];var utils=require(_0xd9a6('0x7'));var logger=require(_0xd9a6('0x8'))('rpc');var config=require(_0xd9a6('0x9'));var jayson=require(_0xd9a6('0xa'));var client=jayson[_0xd9a6('0xb')][_0xd9a6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x111c57,_0x3ff0c1,_0x106f4d){return new BPromise(function(_0x4d85a1,_0x212693){return client[_0xd9a6('0xd')](_0x111c57,_0x106f4d)[_0xd9a6('0xe')](function(_0x26fffe){logger[_0xd9a6('0xf')](_0xd9a6('0x10'),_0x3ff0c1,_0xd9a6('0x11'));logger[_0xd9a6('0x12')](_0xd9a6('0x13'),_0x3ff0c1,_0xd9a6('0x11'),JSON[_0xd9a6('0x14')](_0x26fffe));if(_0x26fffe['error']){if(_0x26fffe[_0xd9a6('0x15')][_0xd9a6('0x16')]===0x1f4){logger[_0xd9a6('0x15')](_0xd9a6('0x10'),_0x3ff0c1,_0x26fffe[_0xd9a6('0x15')][_0xd9a6('0x17')]);return _0x212693(_0x26fffe[_0xd9a6('0x15')][_0xd9a6('0x17')]);}logger['error'](_0xd9a6('0x10'),_0x3ff0c1,_0x26fffe['error']['message']);return _0x4d85a1(_0x26fffe['error'][_0xd9a6('0x17')]);}else{logger[_0xd9a6('0xf')](_0xd9a6('0x10'),_0x3ff0c1,_0xd9a6('0x11'));_0x4d85a1(_0x26fffe['result'][_0xd9a6('0x17')]);}})[_0xd9a6('0x18')](function(_0x5ebbde){logger[_0xd9a6('0x15')]('CmHopperFinal,\x20%s,\x20%s',_0x3ff0c1,_0x5ebbde);_0x212693(_0x5ebbde);});});}exports[_0xd9a6('0x19')]=function(_0x5631fb){var _0x3c74fd=this;return new Promise(function(_0x52f253,_0x579031){return db['CmHopperFinal'][_0xd9a6('0x1a')](_0x5631fb['body'],{'raw':_0x5631fb[_0xd9a6('0x1b')]?_0x5631fb[_0xd9a6('0x1b')][_0xd9a6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x3f2d35){logger[_0xd9a6('0xf')](_0xd9a6('0x19'),_0x5631fb);logger[_0xd9a6('0x12')]('CreateCmHopperFinal',_0x5631fb,JSON[_0xd9a6('0x14')](_0x3f2d35));_0x52f253(_0x3f2d35);})[_0xd9a6('0x18')](function(_0x17d8de){logger['error'](_0xd9a6('0x19'),_0x17d8de['message'],_0x5631fb);_0x579031(_0x3c74fd[_0xd9a6('0x15')](0x1f4,_0x17d8de[_0xd9a6('0x17')]));});});}; \ No newline at end of file +var _0x4e07=['http','request','then','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x58b93b,_0x9ba2b0){var _0x875fd0=function(_0x2c2c53){while(--_0x2c2c53){_0x58b93b['push'](_0x58b93b['shift']());}};_0x875fd0(++_0x9ba2b0);}(_0x4e07,0x1ee));var _0x74e0=function(_0x4d5a9d,_0x5d732b){_0x4d5a9d=_0x4d5a9d-0x0;var _0x4f1911=_0x4e07[_0x4d5a9d];return _0x4f1911;};'use strict';var _=require(_0x74e0('0x0'));var util=require(_0x74e0('0x1'));var moment=require('moment');var BPromise=require(_0x74e0('0x2'));var rs=require(_0x74e0('0x3'));var fs=require('fs');var Redis=require(_0x74e0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x74e0('0x5'));var logger=require(_0x74e0('0x6'))(_0x74e0('0x7'));var config=require('../../config/environment');var jayson=require(_0x74e0('0x8'));var client=jayson[_0x74e0('0x9')][_0x74e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16a78a,_0x317e19,_0x3b45c1){return new BPromise(function(_0x4b8aa4,_0x4df14f){return client[_0x74e0('0xb')](_0x16a78a,_0x3b45c1)[_0x74e0('0xc')](function(_0x56e8b6){logger['info'](_0x74e0('0xd'),_0x317e19,_0x74e0('0xe'));logger[_0x74e0('0xf')](_0x74e0('0x10'),_0x317e19,_0x74e0('0xe'),JSON[_0x74e0('0x11')](_0x56e8b6));if(_0x56e8b6[_0x74e0('0x12')]){if(_0x56e8b6[_0x74e0('0x12')][_0x74e0('0x13')]===0x1f4){logger[_0x74e0('0x12')](_0x74e0('0xd'),_0x317e19,_0x56e8b6[_0x74e0('0x12')][_0x74e0('0x14')]);return _0x4df14f(_0x56e8b6['error'][_0x74e0('0x14')]);}logger[_0x74e0('0x12')](_0x74e0('0xd'),_0x317e19,_0x56e8b6[_0x74e0('0x12')][_0x74e0('0x14')]);return _0x4b8aa4(_0x56e8b6[_0x74e0('0x12')][_0x74e0('0x14')]);}else{logger[_0x74e0('0x15')]('CmHopperFinal,\x20%s,\x20%s',_0x317e19,_0x74e0('0xe'));_0x4b8aa4(_0x56e8b6['result']['message']);}})[_0x74e0('0x16')](function(_0x4225a8){logger[_0x74e0('0x12')](_0x74e0('0xd'),_0x317e19,_0x4225a8);_0x4df14f(_0x4225a8);});});}exports[_0x74e0('0x17')]=function(_0x4d5fce){var _0x2255f7=this;return new Promise(function(_0x176f9b,_0x2a15b5){return db[_0x74e0('0x18')][_0x74e0('0x19')](_0x4d5fce[_0x74e0('0x1a')],{'raw':_0x4d5fce[_0x74e0('0x1b')]?_0x4d5fce['options']['raw']===undefined?!![]:![]:!![]})[_0x74e0('0xc')](function(_0x5f0bd1){logger[_0x74e0('0x15')]('CreateCmHopperFinal',_0x4d5fce);logger[_0x74e0('0xf')]('CreateCmHopperFinal',_0x4d5fce,JSON[_0x74e0('0x11')](_0x5f0bd1));_0x176f9b(_0x5f0bd1);})['catch'](function(_0x16b13e){logger[_0x74e0('0x12')](_0x74e0('0x17'),_0x16b13e[_0x74e0('0x14')],_0x4d5fce);_0x2a15b5(_0x2255f7['error'](0x1f4,_0x16b13e[_0x74e0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 0ce0b70..f9cf834 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 _0xc4ae=['/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post'];(function(_0x53f5f4,_0x1bb96a){var _0x68c201=function(_0x43b030){while(--_0x43b030){_0x53f5f4['push'](_0x53f5f4['shift']());}};_0x68c201(++_0x1bb96a);}(_0xc4ae,0x1ba));var _0xec4a=function(_0xcd173a,_0x3b7068){_0xcd173a=_0xcd173a-0x0;var _0x3794c7=_0xc4ae[_0xcd173a];return _0x3794c7;};'use strict';var multer=require(_0xec4a('0x0'));var util=require(_0xec4a('0x1'));var path=require(_0xec4a('0x2'));var timeout=require(_0xec4a('0x3'));var express=require(_0xec4a('0x4'));var router=express[_0xec4a('0x5')]();var fs_extra=require(_0xec4a('0x6'));var auth=require(_0xec4a('0x7'));var interaction=require(_0xec4a('0x8'));var config=require(_0xec4a('0x9'));var controller=require(_0xec4a('0xa'));router[_0xec4a('0xb')]('/',auth[_0xec4a('0xc')](),controller[_0xec4a('0xd')]);router[_0xec4a('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xec4a('0xe')]);router[_0xec4a('0xb')](_0xec4a('0xf'),auth[_0xec4a('0xc')](),controller[_0xec4a('0x10')]);router['get'](_0xec4a('0x11'),auth[_0xec4a('0xc')](),controller[_0xec4a('0x12')]);router[_0xec4a('0xb')](_0xec4a('0x13'),auth['isAuthenticated'](),controller[_0xec4a('0x14')]);router[_0xec4a('0x15')](_0xec4a('0x16'),auth['isAuthenticated'](),controller[_0xec4a('0x17')]);router[_0xec4a('0x15')]('/voice/campaign/moveContacts/:id',auth[_0xec4a('0xc')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xec4a('0x15')](_0xec4a('0x18'),auth[_0xec4a('0xc')](),controller[_0xec4a('0x19')]);router[_0xec4a('0x1a')](_0xec4a('0xf'),auth[_0xec4a('0xc')](),controller[_0xec4a('0x1b')]);module[_0xec4a('0x1c')]=router; \ No newline at end of file +var _0xdcaa=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xdcaa,0x127));var _0xadca=function(_0x219375,_0x376e0d){_0x219375=_0x219375-0x0;var _0x56ef25=_0xdcaa[_0x219375];return _0x56ef25;};'use strict';var multer=require(_0xadca('0x0'));var util=require('util');var path=require(_0xadca('0x1'));var timeout=require(_0xadca('0x2'));var express=require(_0xadca('0x3'));var router=express['Router']();var fs_extra=require(_0xadca('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xadca('0x5'));var config=require(_0xadca('0x6'));var controller=require(_0xadca('0x7'));router[_0xadca('0x8')]('/',auth[_0xadca('0x9')](),controller[_0xadca('0xa')]);router['get'](_0xadca('0xb'),auth[_0xadca('0x9')](),controller[_0xadca('0xc')]);router[_0xadca('0x8')](_0xadca('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xadca('0x8')]('/voice/queue/countAttributes/:id',auth[_0xadca('0x9')](),controller[_0xadca('0xe')]);router[_0xadca('0x8')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0xadca('0xf')]);router[_0xadca('0x10')]('/voice/queue/moveContacts/:id',auth[_0xadca('0x9')](),controller[_0xadca('0x11')]);router[_0xadca('0x10')](_0xadca('0x12'),auth[_0xadca('0x9')](),controller[_0xadca('0x13')]);router['post'](_0xadca('0x14'),auth[_0xadca('0x9')](),controller[_0xadca('0x15')]);router[_0xadca('0x16')]('/:id',auth[_0xadca('0x9')](),controller[_0xadca('0x17')]);module[_0xadca('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 7c3602e..b4de428 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 _0xe5c7=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x56e0e5,_0x2e3937){var _0x27bb15=function(_0x186336){while(--_0x186336){_0x56e0e5['push'](_0x56e0e5['shift']());}};_0x27bb15(++_0x2e3937);}(_0xe5c7,0x10d));var _0x7e5c=function(_0x54c782,_0xdd0799){_0x54c782=_0x54c782-0x0;var _0x3d148d=_0xe5c7[_0x54c782];return _0x3d148d;};'use strict';var Sequelize=require(_0x7e5c('0x0'));module[_0x7e5c('0x1')]={'state':{'type':Sequelize[_0x7e5c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x7e5c('0x3')]},'scheduledat':{'type':Sequelize[_0x7e5c('0x4')]},'countbusyretry':{'type':Sequelize[_0x7e5c('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7e5c('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7e5c('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7e5c('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x7e5c('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x7e5c('0x4')]},'responsetime':{'type':Sequelize[_0x7e5c('0x4')]},'answertime':{'type':Sequelize[_0x7e5c('0x4')]},'droptime':{'type':Sequelize[_0x7e5c('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x7e5c('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7e5c('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7e5c('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7e5c('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7e5c('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x7e5c('0x3')]},'membername':{'type':Sequelize[_0x7e5c('0x3')]},'reason':{'type':Sequelize[_0x7e5c('0x3')]},'amd':{'type':Sequelize[_0x7e5c('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7e5c('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x7e5c('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7e5c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x7e5c('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x7e5c('0x4')]},'edited':{'type':Sequelize[_0x7e5c('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x7e5c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7e5c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7e5c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7e5c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7e5c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf7a4=['DATE','BOOLEAN','exports','INTEGER','STRING'];(function(_0x491199,_0x42e8f5){var _0x36c9cd=function(_0x2a1d3f){while(--_0x2a1d3f){_0x491199['push'](_0x491199['shift']());}};_0x36c9cd(++_0x42e8f5);}(_0xf7a4,0x1ab));var _0x4f7a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xf7a4[_0x342baa];return _0x1208f3;};'use strict';var Sequelize=require('sequelize');module[_0x4f7a('0x0')]={'state':{'type':Sequelize[_0x4f7a('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4f7a('0x2')]},'scheduledat':{'type':Sequelize[_0x4f7a('0x3')]},'countbusyretry':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4f7a('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x4f7a('0x2')]},'originatecalleridname':{'type':Sequelize[_0x4f7a('0x2')]},'calleridnum':{'type':Sequelize[_0x4f7a('0x2')]},'calleridname':{'type':Sequelize[_0x4f7a('0x2')]},'starttime':{'type':Sequelize[_0x4f7a('0x3')]},'responsetime':{'type':Sequelize[_0x4f7a('0x3')]},'answertime':{'type':Sequelize[_0x4f7a('0x3')]},'droptime':{'type':Sequelize[_0x4f7a('0x3')]},'endtime':{'type':Sequelize[_0x4f7a('0x3')]},'ringtime':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4f7a('0x2')]},'campaign':{'type':Sequelize[_0x4f7a('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4f7a('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x4f7a('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4f7a('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4f7a('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x4f7a('0x3')]},'edited':{'type':Sequelize[_0x4f7a('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4f7a('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 7cc51e3..f2b47c4 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 _0x98a8=['lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','contact','message','agent','interaction','account','index','CmHopperHistory','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x33bbff,_0x16bb74){var _0x5d3503=function(_0x43a1c4){while(--_0x43a1c4){_0x33bbff['push'](_0x33bbff['shift']());}};_0x5d3503(++_0x16bb74);}(_0x98a8,0x12c));var _0x898a=function(_0x152608,_0x301d4a){_0x152608=_0x152608-0x0;var _0x1ab7b7=_0x98a8[_0x152608];return _0x1ab7b7;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x1426e3,_0x5b7719){return function(_0x20bde0){if(!_0x20bde0){_0x1426e3['sendStatus'](0x194);}return _0x20bde0;};}function handleError(_0x513c6b,_0x53ddb2){_0x53ddb2=_0x53ddb2||0x1f4;return function(_0x3678be){logger[_0x898a('0x25')](_0x3678be[_0x898a('0x26')]);if(_0x3678be[_0x898a('0x27')]){delete _0x3678be[_0x898a('0x27')];}_0x513c6b[_0x898a('0x1a')](_0x53ddb2)[_0x898a('0x28')](_0x3678be);};}function getMustacheRender(_0xac1fc4,_0xd31922){return Mustache['render'](_0xac1fc4,_['merge'](_0xd31922['body'],{'contact':_0xd31922[_0x898a('0x29')],'message':_0xd31922[_0x898a('0x2a')],'agent':_0xd31922[_0x898a('0x2b')],'interaction':_0xd31922[_0x898a('0x2c')],'account':_0xd31922[_0x898a('0x2d')]}))||'';}exports[_0x898a('0x2e')]=function(_0xe3c983,_0xf74645){var _0x18773a={},_0x4287da={},_0x44c5d2={'count':0x0,'rows':[]};var _0x194d74=_['map'](db[_0x898a('0x2f')][_0x898a('0x30')],function(_0x26eead){return{'name':_0x26eead[_0x898a('0x31')],'type':_0x26eead[_0x898a('0x32')]['key']};});_0x4287da['model']=_[_0x898a('0x33')](_0x194d74,_0x898a('0x27'));_0x4287da[_0x898a('0x34')]=_['keys'](_0xe3c983[_0x898a('0x34')]);_0x4287da[_0x898a('0x35')]=_[_0x898a('0x36')](_0x4287da[_0x898a('0x37')],_0x4287da[_0x898a('0x34')]);_0x18773a[_0x898a('0x38')]=_[_0x898a('0x36')](_0x4287da[_0x898a('0x37')],qs['fields'](_0xe3c983[_0x898a('0x34')]['fields']));_0x18773a['attributes']=_0x18773a[_0x898a('0x38')]['length']?_0x18773a[_0x898a('0x38')]:_0x4287da['model'];if(!_0xe3c983[_0x898a('0x34')]['hasOwnProperty'](_0x898a('0x39'))){_0x18773a[_0x898a('0x3a')]=qs[_0x898a('0x3a')](_0xe3c983['query']['limit']);_0x18773a['offset']=qs[_0x898a('0x1e')](_0xe3c983[_0x898a('0x34')]['offset']);}_0x18773a[_0x898a('0x3b')]=qs[_0x898a('0x3c')](_0xe3c983[_0x898a('0x34')][_0x898a('0x3c')]);_0x18773a['where']=qs['filters'](_[_0x898a('0x3d')](_0xe3c983[_0x898a('0x34')],_0x4287da['filters']),_0x194d74);if(_0xe3c983['query'][_0x898a('0x3e')]){_0x18773a[_0x898a('0x3f')]=_[_0x898a('0x40')](_0x18773a[_0x898a('0x3f')],{'$or':_['map'](_0x194d74,function(_0x67114b){if(_0x67114b[_0x898a('0x32')]!=='VIRTUAL'){var _0x516b8c={};_0x516b8c[_0x67114b['name']]={'$like':'%'+_0xe3c983[_0x898a('0x34')][_0x898a('0x3e')]+'%'};return _0x516b8c;}})});}_0x18773a=_[_0x898a('0x40')]({},_0x18773a,_0xe3c983[_0x898a('0x41')]);var _0x20a6eb={'where':_0x18773a[_0x898a('0x3f')]};return db[_0x898a('0x2f')][_0x898a('0x1d')](_0x20a6eb)[_0x898a('0x23')](function(_0x235fcf){_0x44c5d2[_0x898a('0x1d')]=_0x235fcf;if(_0xe3c983[_0x898a('0x34')][_0x898a('0x42')]){_0x18773a[_0x898a('0x43')]=[{'all':!![]}];}return db[_0x898a('0x2f')]['findAll'](_0x18773a);})[_0x898a('0x23')](function(_0x11c437){_0x44c5d2[_0x898a('0x44')]=_0x11c437;return _0x44c5d2;})['then'](respondWithFilteredResult(_0xf74645,_0x18773a))[_0x898a('0x45')](handleError(_0xf74645,null));};exports[_0x898a('0x46')]=function(_0x3a8663,_0x6ab441){var _0x2cd3c5={'raw':!![],'where':{'id':_0x3a8663[_0x898a('0x47')]['id']}},_0x477e2e={};_0x477e2e[_0x898a('0x37')]=_['keys'](db[_0x898a('0x2f')][_0x898a('0x30')]);_0x477e2e[_0x898a('0x34')]=_[_0x898a('0x48')](_0x3a8663['query']);_0x477e2e[_0x898a('0x35')]=_[_0x898a('0x36')](_0x477e2e['model'],_0x477e2e[_0x898a('0x34')]);_0x2cd3c5['attributes']=_[_0x898a('0x36')](_0x477e2e['model'],qs['fields'](_0x3a8663[_0x898a('0x34')]['fields']));_0x2cd3c5[_0x898a('0x38')]=_0x2cd3c5[_0x898a('0x38')]['length']?_0x2cd3c5[_0x898a('0x38')]:_0x477e2e[_0x898a('0x37')];if(_0x3a8663['query'][_0x898a('0x42')]){_0x2cd3c5[_0x898a('0x43')]=[{'all':!![]}];}_0x2cd3c5=_[_0x898a('0x40')]({},_0x2cd3c5,_0x3a8663[_0x898a('0x41')]);return db['CmHopperHistory'][_0x898a('0x49')](_0x2cd3c5)[_0x898a('0x23')](handleEntityNotFound(_0x6ab441,null))['then'](respondWithResult(_0x6ab441,null))[_0x898a('0x45')](handleError(_0x6ab441,null));};exports[_0x898a('0x4a')]=function(_0x4ab441,_0x28525b){return db['CmHopperHistory'][_0x898a('0x4a')](_0x4ab441[_0x898a('0x4b')],{})[_0x898a('0x23')](respondWithResult(_0x28525b,0xc9))['catch'](handleError(_0x28525b,null));};exports[_0x898a('0x4c')]=function(_0x1b09da,_0x3909ae){return db[_0x898a('0x2f')]['describe']()[_0x898a('0x23')](respondWithResult(_0x3909ae,null))['catch'](handleError(_0x3909ae,null));};exports[_0x898a('0x22')]=function(_0x2feb38,_0x3159d0){if(_0x2feb38['body'][_0x898a('0x4d')]){delete _0x2feb38[_0x898a('0x4b')][_0x898a('0x4d')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x2feb38[_0x898a('0x47')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x3159d0,null))[_0x898a('0x23')](saveUpdates(_0x2feb38[_0x898a('0x4b')],null))[_0x898a('0x23')](respondWithResult(_0x3159d0,null))[_0x898a('0x45')](handleError(_0x3159d0,null));}; \ No newline at end of file +var _0x24ca=['sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','destroy','then','error','send','render','merge','message','agent','interaction','account','index','map','CmHopperHistory','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','describe','update','uniqueid','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x43907c,_0x4ab831){var _0x42b194=function(_0x3e6552){while(--_0x3e6552){_0x43907c['push'](_0x43907c['shift']());}};_0x42b194(++_0x4ab831);}(_0x24ca,0x8c));var _0xa24c=function(_0x212bf5,_0x165cbd){_0x212bf5=_0x212bf5-0x0;var _0xfcad21=_0x24ca[_0x212bf5];return _0xfcad21;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa24c('0x1'));var rp=require('request-promise');var moment=require(_0xa24c('0x2'));var BPromise=require(_0xa24c('0x3'));var Mustache=require(_0xa24c('0x4'));var util=require('util');var path=require(_0xa24c('0x5'));var sox=require(_0xa24c('0x6'));var csv=require(_0xa24c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa24c('0x8'));var crypto=require(_0xa24c('0x9'));var jsforce=require(_0xa24c('0xa'));var deskjs=require(_0xa24c('0xb'));var toCsv=require(_0xa24c('0x7'));var querystring=require(_0xa24c('0xc'));var Papa=require('papaparse');var Redis=require(_0xa24c('0xd'));var authService=require(_0xa24c('0xe'));var qs=require(_0xa24c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa24c('0x10'))(_0xa24c('0x11'));var utils=require(_0xa24c('0x12'));var config=require(_0xa24c('0x13'));var licenseUtil=require(_0xa24c('0x14'));var db=require(_0xa24c('0x15'))['db'];function respondWithStatusCode(_0x566313,_0x5bb631){_0x5bb631=_0x5bb631||0xcc;return function(_0x4907f6){if(_0x4907f6){return _0x566313[_0xa24c('0x16')](_0x5bb631);}return _0x566313[_0xa24c('0x17')](_0x5bb631)[_0xa24c('0x18')]();};}function respondWithResult(_0x9fe9e3,_0x4351a8){_0x4351a8=_0x4351a8||0xc8;return function(_0x4971af){if(_0x4971af){return _0x9fe9e3[_0xa24c('0x17')](_0x4351a8)['json'](_0x4971af);}};}function respondWithFilteredResult(_0x493bcb,_0x588acf){return function(_0x2e8dc9){if(_0x2e8dc9){var _0x2a4270=typeof _0x588acf[_0xa24c('0x19')]===_0xa24c('0x1a')&&typeof _0x588acf[_0xa24c('0x1b')]===_0xa24c('0x1a');var _0x2197da=_0x2e8dc9[_0xa24c('0x1c')];var _0x14f0aa=_0x2a4270?0x0:_0x588acf[_0xa24c('0x19')];var _0x1970fc=_0x2a4270?_0x2e8dc9[_0xa24c('0x1c')]:_0x588acf[_0xa24c('0x19')]+_0x588acf[_0xa24c('0x1b')];var _0x5276b6;if(_0x1970fc>=_0x2197da){_0x1970fc=_0x2197da;_0x5276b6=0xc8;}else{_0x5276b6=0xce;}_0x493bcb[_0xa24c('0x17')](_0x5276b6);return _0x493bcb['set'](_0xa24c('0x1d'),_0x14f0aa+'-'+_0x1970fc+'/'+_0x2197da)[_0xa24c('0x1e')](_0x2e8dc9);}return null;};}function patchUpdates(_0x8c3949){return function(_0x37e20e){try{jsonpatch[_0xa24c('0x1f')](_0x37e20e,_0x8c3949,!![]);}catch(_0x416dea){return BPromise[_0xa24c('0x20')](_0x416dea);}return _0x37e20e[_0xa24c('0x21')]();};}function saveUpdates(_0xba710,_0x2ec5ad){return function(_0x2b471a){if(_0x2b471a){return _0x2b471a['update'](_0xba710)['then'](function(_0x10fa25){return _0x10fa25;});}return null;};}function removeEntity(_0xdd32a8,_0x316a68){return function(_0x1a04ff){if(_0x1a04ff){return _0x1a04ff[_0xa24c('0x22')]()[_0xa24c('0x23')](function(){_0xdd32a8[_0xa24c('0x17')](0xcc)[_0xa24c('0x18')]();});}};}function handleEntityNotFound(_0x304d6c,_0x4dc3dc){return function(_0x2290e1){if(!_0x2290e1){_0x304d6c['sendStatus'](0x194);}return _0x2290e1;};}function handleError(_0x1f347b,_0x256fbc){_0x256fbc=_0x256fbc||0x1f4;return function(_0x471421){logger[_0xa24c('0x24')](_0x471421['stack']);if(_0x471421['name']){delete _0x471421['name'];}_0x1f347b['status'](_0x256fbc)[_0xa24c('0x25')](_0x471421);};}function getMustacheRender(_0x39e0be,_0xab6197){return Mustache[_0xa24c('0x26')](_0x39e0be,_[_0xa24c('0x27')](_0xab6197['body'],{'contact':_0xab6197['contact'],'message':_0xab6197[_0xa24c('0x28')],'agent':_0xab6197[_0xa24c('0x29')],'interaction':_0xab6197[_0xa24c('0x2a')],'account':_0xab6197[_0xa24c('0x2b')]}))||'';}exports[_0xa24c('0x2c')]=function(_0x3f7102,_0xc0db8f){var _0x1e30a9={},_0x29f539={},_0x17a001={'count':0x0,'rows':[]};var _0x59526b=_[_0xa24c('0x2d')](db[_0xa24c('0x2e')]['rawAttributes'],function(_0x3c9649){return{'name':_0x3c9649[_0xa24c('0x2f')],'type':_0x3c9649[_0xa24c('0x30')][_0xa24c('0x31')]};});_0x29f539[_0xa24c('0x32')]=_[_0xa24c('0x2d')](_0x59526b,_0xa24c('0x33'));_0x29f539[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x3f7102[_0xa24c('0x34')]);_0x29f539['filters']=_['intersection'](_0x29f539['model'],_0x29f539[_0xa24c('0x34')]);_0x1e30a9['attributes']=_[_0xa24c('0x36')](_0x29f539[_0xa24c('0x32')],qs[_0xa24c('0x37')](_0x3f7102['query'][_0xa24c('0x37')]));_0x1e30a9[_0xa24c('0x38')]=_0x1e30a9[_0xa24c('0x38')]['length']?_0x1e30a9[_0xa24c('0x38')]:_0x29f539[_0xa24c('0x32')];if(!_0x3f7102['query'][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x1e30a9[_0xa24c('0x1b')]=qs['limit'](_0x3f7102[_0xa24c('0x34')][_0xa24c('0x1b')]);_0x1e30a9[_0xa24c('0x19')]=qs[_0xa24c('0x19')](_0x3f7102[_0xa24c('0x34')]['offset']);}_0x1e30a9[_0xa24c('0x3b')]=qs[_0xa24c('0x3c')](_0x3f7102['query'][_0xa24c('0x3c')]);_0x1e30a9[_0xa24c('0x3d')]=qs[_0xa24c('0x3e')](_['pick'](_0x3f7102['query'],_0x29f539[_0xa24c('0x3e')]),_0x59526b);if(_0x3f7102[_0xa24c('0x34')][_0xa24c('0x3f')]){_0x1e30a9[_0xa24c('0x3d')]=_[_0xa24c('0x27')](_0x1e30a9[_0xa24c('0x3d')],{'$or':_['map'](_0x59526b,function(_0x46c0bf){if(_0x46c0bf[_0xa24c('0x30')]!==_0xa24c('0x40')){var _0x137a1d={};_0x137a1d[_0x46c0bf['name']]={'$like':'%'+_0x3f7102[_0xa24c('0x34')][_0xa24c('0x3f')]+'%'};return _0x137a1d;}})});}_0x1e30a9=_[_0xa24c('0x27')]({},_0x1e30a9,_0x3f7102[_0xa24c('0x41')]);var _0x103b50={'where':_0x1e30a9[_0xa24c('0x3d')]};return db[_0xa24c('0x2e')]['count'](_0x103b50)['then'](function(_0x22c57e){_0x17a001['count']=_0x22c57e;if(_0x3f7102[_0xa24c('0x34')]['includeAll']){_0x1e30a9[_0xa24c('0x42')]=[{'all':!![]}];}return db[_0xa24c('0x2e')][_0xa24c('0x43')](_0x1e30a9);})[_0xa24c('0x23')](function(_0x21328f){_0x17a001[_0xa24c('0x44')]=_0x21328f;return _0x17a001;})[_0xa24c('0x23')](respondWithFilteredResult(_0xc0db8f,_0x1e30a9))[_0xa24c('0x45')](handleError(_0xc0db8f,null));};exports[_0xa24c('0x46')]=function(_0x38791c,_0x45dd80){var _0x1f87b7={'raw':!![],'where':{'id':_0x38791c[_0xa24c('0x47')]['id']}},_0x2e2f06={};_0x2e2f06[_0xa24c('0x32')]=_[_0xa24c('0x35')](db['CmHopperHistory'][_0xa24c('0x48')]);_0x2e2f06[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x38791c['query']);_0x2e2f06[_0xa24c('0x3e')]=_[_0xa24c('0x36')](_0x2e2f06[_0xa24c('0x32')],_0x2e2f06[_0xa24c('0x34')]);_0x1f87b7['attributes']=_[_0xa24c('0x36')](_0x2e2f06[_0xa24c('0x32')],qs[_0xa24c('0x37')](_0x38791c[_0xa24c('0x34')][_0xa24c('0x37')]));_0x1f87b7[_0xa24c('0x38')]=_0x1f87b7[_0xa24c('0x38')][_0xa24c('0x49')]?_0x1f87b7[_0xa24c('0x38')]:_0x2e2f06[_0xa24c('0x32')];if(_0x38791c[_0xa24c('0x34')][_0xa24c('0x4a')]){_0x1f87b7[_0xa24c('0x42')]=[{'all':!![]}];}_0x1f87b7=_['merge']({},_0x1f87b7,_0x38791c[_0xa24c('0x41')]);return db['CmHopperHistory'][_0xa24c('0x4b')](_0x1f87b7)[_0xa24c('0x23')](handleEntityNotFound(_0x45dd80,null))[_0xa24c('0x23')](respondWithResult(_0x45dd80,null))[_0xa24c('0x45')](handleError(_0x45dd80,null));};exports[_0xa24c('0x4c')]=function(_0x42d84b,_0x338877){return db[_0xa24c('0x2e')][_0xa24c('0x4c')](_0x42d84b[_0xa24c('0x4d')],{})[_0xa24c('0x23')](respondWithResult(_0x338877,0xc9))[_0xa24c('0x45')](handleError(_0x338877,null));};exports[_0xa24c('0x4e')]=function(_0x5974b3,_0x19785a){return db[_0xa24c('0x2e')][_0xa24c('0x4e')]()[_0xa24c('0x23')](respondWithResult(_0x19785a,null))['catch'](handleError(_0x19785a,null));};exports[_0xa24c('0x4f')]=function(_0xd09fd4,_0x2a8182){if(_0xd09fd4['body']['uniqueid']){delete _0xd09fd4[_0xa24c('0x4d')][_0xa24c('0x50')];}return db['CmHopperHistory'][_0xa24c('0x4b')]({'where':{'uniqueid':_0xd09fd4[_0xa24c('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a8182,null))[_0xa24c('0x23')](saveUpdates(_0xd09fd4['body'],null))['then'](respondWithResult(_0x2a8182,null))[_0xa24c('0x45')](handleError(_0x2a8182,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index c4dce46..8064d57 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 _0x9e9c=['define','CmHopperHistory','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x32cf96,_0x7502d5){var _0x125cc1=function(_0x376987){while(--_0x376987){_0x32cf96['push'](_0x32cf96['shift']());}};_0x125cc1(++_0x7502d5);}(_0x9e9c,0x7c));var _0xc9e9=function(_0x1c156e,_0x3263a6){_0x1c156e=_0x1c156e-0x0;var _0x58fc22=_0x9e9c[_0x1c156e];return _0x58fc22;};'use strict';var _=require(_0xc9e9('0x0'));var util=require(_0xc9e9('0x1'));var logger=require(_0xc9e9('0x2'))(_0xc9e9('0x3'));var moment=require(_0xc9e9('0x4'));var BPromise=require(_0xc9e9('0x5'));var rp=require(_0xc9e9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc9e9('0x7'));var config=require(_0xc9e9('0x8'));var attributes=require(_0xc9e9('0x9'));module[_0xc9e9('0xa')]=function(_0x26f34d,_0x391710){return _0x26f34d[_0xc9e9('0xb')](_0xc9e9('0xc'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xc9e9('0xd'),'fields':['endtime']},{'name':_0xc9e9('0xe'),'fields':[_0xc9e9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb361=['path','rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','util','../../config/logger','bluebird','request-promise'];(function(_0x33d5f1,_0x10a37b){var _0x54a379=function(_0x5803ca){while(--_0x5803ca){_0x33d5f1['push'](_0x33d5f1['shift']());}};_0x54a379(++_0x10a37b);}(_0xb361,0x17c));var _0x1b36=function(_0x9a0cd8,_0x4af85b){_0x9a0cd8=_0x9a0cd8-0x0;var _0x11179b=_0xb361[_0x9a0cd8];return _0x11179b;};'use strict';var _=require('lodash');var util=require(_0x1b36('0x0'));var logger=require(_0x1b36('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b36('0x2'));var rp=require(_0x1b36('0x3'));var fs=require('fs');var path=require(_0x1b36('0x4'));var rimraf=require(_0x1b36('0x5'));var config=require(_0x1b36('0x6'));var attributes=require('./cmHopperHistory.attributes');module[_0x1b36('0x7')]=function(_0x4e97ba,_0x3a6920){return _0x4e97ba[_0x1b36('0x8')](_0x1b36('0x9'),attributes,{'tableName':_0x1b36('0xa'),'paranoid':![],'indexes':[{'name':_0x1b36('0xb'),'fields':['endtime']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index d189c11..931bba2 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 _0x30e0=['findAll','raw','where','COUNT','sequelize','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','debug','request\x20sent','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','CreateCmHopperHistory','create','options','then','stringify','catch','CmHopperHistory'];(function(_0x3811ac,_0x2c9b65){var _0x5423f1=function(_0x2daab8){while(--_0x2daab8){_0x3811ac['push'](_0x3811ac['shift']());}};_0x5423f1(++_0x2c9b65);}(_0x30e0,0x1ce));var _0x030e=function(_0x3efadf,_0x364aa4){_0x3efadf=_0x3efadf-0x0;var _0x1d1e97=_0x30e0[_0x3efadf];return _0x1d1e97;};'use strict';var _=require(_0x030e('0x0'));var util=require(_0x030e('0x1'));var moment=require('moment');var BPromise=require(_0x030e('0x2'));var rs=require(_0x030e('0x3'));var fs=require('fs');var Redis=require(_0x030e('0x4'));var db=require(_0x030e('0x5'))['db'];var utils=require(_0x030e('0x6'));var logger=require(_0x030e('0x7'))('rpc');var config=require(_0x030e('0x8'));var jayson=require(_0x030e('0x9'));var client=jayson[_0x030e('0xa')][_0x030e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b8745,_0x4a5f4c,_0x38263c){return new BPromise(function(_0x53d819,_0x214026){return client[_0x030e('0xc')](_0x4b8745,_0x38263c)['then'](function(_0x2ca585){logger[_0x030e('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x4a5f4c,'request\x20sent');logger[_0x030e('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x4a5f4c,_0x030e('0xf'),JSON['stringify'](_0x2ca585));if(_0x2ca585[_0x030e('0x10')]){if(_0x2ca585[_0x030e('0x10')][_0x030e('0x11')]===0x1f4){logger['error'](_0x030e('0x12'),_0x4a5f4c,_0x2ca585[_0x030e('0x10')][_0x030e('0x13')]);return _0x214026(_0x2ca585[_0x030e('0x10')][_0x030e('0x13')]);}logger['error'](_0x030e('0x12'),_0x4a5f4c,_0x2ca585[_0x030e('0x10')][_0x030e('0x13')]);return _0x53d819(_0x2ca585[_0x030e('0x10')][_0x030e('0x13')]);}else{logger[_0x030e('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x4a5f4c,_0x030e('0xf'));_0x53d819(_0x2ca585[_0x030e('0x14')][_0x030e('0x13')]);}})['catch'](function(_0x181e2e){logger['error'](_0x030e('0x12'),_0x4a5f4c,_0x181e2e);_0x214026(_0x181e2e);});});}exports[_0x030e('0x15')]=function(_0x15bdf3){var _0x31ecb5=this;return new Promise(function(_0x575251,_0x6f1761){return db['CmHopperHistory'][_0x030e('0x16')](_0x15bdf3['body'],{'raw':_0x15bdf3[_0x030e('0x17')]?_0x15bdf3[_0x030e('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x030e('0x18')](function(_0x5178b5){logger['info'](_0x030e('0x15'),_0x15bdf3);logger[_0x030e('0xe')](_0x030e('0x15'),_0x15bdf3,JSON[_0x030e('0x19')](_0x5178b5));_0x575251(_0x5178b5);})[_0x030e('0x1a')](function(_0x385460){logger[_0x030e('0x10')](_0x030e('0x15'),_0x385460['message'],_0x15bdf3);_0x6f1761(_0x31ecb5['error'](0x1f4,_0x385460[_0x030e('0x13')]));});});};exports['AvgHandleTime']=function(_0x550199){var _0x5971b0=this;return new Promise(function(_0x5d948e,_0x99ed06){return db[_0x030e('0x1b')][_0x030e('0x1c')]({'raw':_0x550199[_0x030e('0x17')]?_0x550199['options'][_0x030e('0x1d')]===undefined?!![]:![]:!![],'where':_0x550199[_0x030e('0x17')]?_0x550199['options'][_0x030e('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x030e('0x1f'),db[_0x030e('0x20')]['col']('id')),_0x030e('0x21')],[db[_0x030e('0x20')]['fn'](_0x030e('0x1f'),db[_0x030e('0x20')]['fn']('IF',db[_0x030e('0x20')][_0x030e('0x22')](_0x030e('0x23')))),_0x030e('0x24')],[db[_0x030e('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x030e('0x22')](_0x030e('0x25')))),_0x030e('0x26')],[db[_0x030e('0x20')]['fn']('COUNT',db[_0x030e('0x20')]['fn']('IF',db[_0x030e('0x20')][_0x030e('0x22')](_0x030e('0x27')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x030e('0x20')]['fn'](_0x030e('0x28'),db[_0x030e('0x20')]['fn']('IF',db[_0x030e('0x20')][_0x030e('0x22')](_0x030e('0x29')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0x030e('0x28'),db['sequelize']['fn']('IF',db['sequelize'][_0x030e('0x22')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x030e('0x2a')]]})[_0x030e('0x18')](function(_0x1b240e){logger[_0x030e('0xd')](_0x030e('0x2b'),_0x550199);logger[_0x030e('0xe')](_0x030e('0x2b'),_0x550199,JSON[_0x030e('0x19')](_0x1b240e));_0x5d948e(_0x1b240e);})[_0x030e('0x1a')](function(_0xfe8e87){logger[_0x030e('0x10')](_0x030e('0x2b'),_0xfe8e87['message'],_0x550199);_0x99ed06(_0x5971b0[_0x030e('0x10')](0x1f4,_0xfe8e87[_0x030e('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x57e0a0){var _0x1959a2=this;return new Promise(function(_0x217b64,_0x393f16){return db[_0x030e('0x1b')]['findAll']({'raw':_0x57e0a0['options']?_0x57e0a0['options'][_0x030e('0x1d')]===undefined?!![]:![]:!![],'where':_0x57e0a0[_0x030e('0x17')]?_0x57e0a0[_0x030e('0x17')][_0x030e('0x1e')]||null:null,'attributes':[[_0x030e('0x2c'),'name'],[db[_0x030e('0x20')]['fn'](_0x030e('0x1f'),db['sequelize']['fn']('IF',db[_0x030e('0x20')]['literal'](_0x030e('0x2d')))),_0x030e('0x2e')],[db[_0x030e('0x20')]['fn'](_0x030e('0x1f'),db[_0x030e('0x20')]['fn']('IF',db[_0x030e('0x20')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x030e('0x2f')],[db[_0x030e('0x20')]['fn']('COUNT',db[_0x030e('0x20')]['fn']('IF',db[_0x030e('0x20')][_0x030e('0x22')](_0x030e('0x23')))),_0x030e('0x30')],[db['sequelize']['fn'](_0x030e('0x1f'),db[_0x030e('0x20')]['fn']('IF',db[_0x030e('0x20')][_0x030e('0x22')](_0x030e('0x31')))),_0x030e('0x32')],[db[_0x030e('0x20')]['fn'](_0x030e('0x1f'),db[_0x030e('0x20')]['fn']('IF',db[_0x030e('0x20')][_0x030e('0x22')](_0x030e('0x33')))),_0x030e('0x34')],[db['sequelize']['fn'](_0x030e('0x1f'),db[_0x030e('0x20')]['fn']('IF',db[_0x030e('0x20')][_0x030e('0x22')](_0x030e('0x35')))),_0x030e('0x36')],[db[_0x030e('0x20')]['fn'](_0x030e('0x1f'),db['sequelize']['fn']('IF',db[_0x030e('0x20')]['literal'](_0x030e('0x37')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0x030e('0x1f'),db[_0x030e('0x20')]['fn']('IF',db[_0x030e('0x20')]['literal']('`state`\x20=\x2012,\x201,\x20null'))),_0x030e('0x38')],[db[_0x030e('0x20')]['fn'](_0x030e('0x1f'),db[_0x030e('0x20')]['fn']('IF',db[_0x030e('0x20')][_0x030e('0x22')](_0x030e('0x39')))),'outboundBlacklistCallsDay'],[db[_0x030e('0x20')]['fn'](_0x030e('0x1f'),db[_0x030e('0x20')]['fn']('IF',db[_0x030e('0x20')][_0x030e('0x22')](_0x030e('0x3a')))),_0x030e('0x3b')],[db[_0x030e('0x20')]['fn'](_0x030e('0x1f'),db[_0x030e('0x20')]['fn']('IF',db[_0x030e('0x20')][_0x030e('0x22')](_0x030e('0x3c')))),'outboundRejectCallsDay'],[db[_0x030e('0x20')]['fn']('COUNT',db[_0x030e('0x20')]['fn']('IF',db[_0x030e('0x20')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0x030e('0x3d')],[db[_0x030e('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x030e('0x20')]['literal'](_0x030e('0x3e')))),_0x030e('0x3f')],[db[_0x030e('0x20')]['fn'](_0x030e('0x1f'),db[_0x030e('0x20')]['fn']('IF',db[_0x030e('0x20')][_0x030e('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x030e('0x40')]],'group':[_0x030e('0x2c')]})['then'](function(_0x3241fe){logger[_0x030e('0xd')](_0x030e('0x41'),_0x57e0a0);logger[_0x030e('0xe')](_0x030e('0x41'),_0x57e0a0,JSON[_0x030e('0x19')](_0x3241fe));_0x217b64(_0x3241fe);})[_0x030e('0x1a')](function(_0x3847ee){logger[_0x030e('0x10')]('GetVoiceQueueHopperHistory',_0x3847ee[_0x030e('0x13')],_0x57e0a0);_0x393f16(_0x1959a2['error'](0x1f4,_0x3847ee[_0x030e('0x13')]));});});};exports[_0x030e('0x42')]=function(_0x4c27e0){var _0x525146=this;return new Promise(function(_0x446957,_0x345453){return db[_0x030e('0x1b')][_0x030e('0x1c')]({'raw':_0x4c27e0[_0x030e('0x17')]?_0x4c27e0[_0x030e('0x17')][_0x030e('0x1d')]===undefined?!![]:![]:!![],'where':_0x4c27e0[_0x030e('0x17')]?_0x4c27e0[_0x030e('0x17')][_0x030e('0x1e')]||null:null,'attributes':[['campaign',_0x030e('0x43')],[db['sequelize']['fn'](_0x030e('0x1f'),db[_0x030e('0x20')]['col']('id')),_0x030e('0x44')],[db[_0x030e('0x20')]['fn'](_0x030e('0x1f'),db['sequelize']['fn']('IF',db[_0x030e('0x20')]['literal'](_0x030e('0x23')))),_0x030e('0x45')]],'group':[_0x030e('0x2c')]})[_0x030e('0x18')](function(_0x5aceb2){logger[_0x030e('0xd')](_0x030e('0x42'),_0x4c27e0);logger['debug'](_0x030e('0x42'),_0x4c27e0,JSON[_0x030e('0x19')](_0x5aceb2));_0x446957(_0x5aceb2);})[_0x030e('0x1a')](function(_0x104be6){logger[_0x030e('0x10')](_0x030e('0x42'),_0x104be6['message'],_0x4c27e0);_0x345453(_0x525146[_0x030e('0x10')](0x1f4,_0x104be6[_0x030e('0x13')]));});});}; \ No newline at end of file +var _0x38b6=['error','code','message','info','catch','CreateCmHopperHistory','CmHopperHistory','options','raw','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','outboundReCallsDay','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x256662,_0xcbc858){var _0x2a7aaa=function(_0x5d40ca){while(--_0x5d40ca){_0x256662['push'](_0x256662['shift']());}};_0x2a7aaa(++_0xcbc858);}(_0x38b6,0x177));var _0x638b=function(_0x1595ae,_0x18356c){_0x1595ae=_0x1595ae-0x0;var _0x47e6e2=_0x38b6[_0x1595ae];return _0x47e6e2;};'use strict';var _=require(_0x638b('0x0'));var util=require(_0x638b('0x1'));var moment=require(_0x638b('0x2'));var BPromise=require(_0x638b('0x3'));var rs=require(_0x638b('0x4'));var fs=require('fs');var Redis=require(_0x638b('0x5'));var db=require(_0x638b('0x6'))['db'];var utils=require(_0x638b('0x7'));var logger=require(_0x638b('0x8'))(_0x638b('0x9'));var config=require(_0x638b('0xa'));var jayson=require(_0x638b('0xb'));var client=jayson[_0x638b('0xc')][_0x638b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x34a362,_0x3d8c49,_0x57388c){return new BPromise(function(_0x4dffae,_0x401498){return client[_0x638b('0xe')](_0x34a362,_0x57388c)[_0x638b('0xf')](function(_0x510a9d){logger['info'](_0x638b('0x10'),_0x3d8c49,'request\x20sent');logger[_0x638b('0x11')](_0x638b('0x12'),_0x3d8c49,_0x638b('0x13'),JSON[_0x638b('0x14')](_0x510a9d));if(_0x510a9d['error']){if(_0x510a9d[_0x638b('0x15')][_0x638b('0x16')]===0x1f4){logger['error'](_0x638b('0x10'),_0x3d8c49,_0x510a9d['error'][_0x638b('0x17')]);return _0x401498(_0x510a9d[_0x638b('0x15')][_0x638b('0x17')]);}logger[_0x638b('0x15')](_0x638b('0x10'),_0x3d8c49,_0x510a9d[_0x638b('0x15')][_0x638b('0x17')]);return _0x4dffae(_0x510a9d[_0x638b('0x15')][_0x638b('0x17')]);}else{logger[_0x638b('0x18')](_0x638b('0x10'),_0x3d8c49,_0x638b('0x13'));_0x4dffae(_0x510a9d['result']['message']);}})[_0x638b('0x19')](function(_0x52eedb){logger[_0x638b('0x15')](_0x638b('0x10'),_0x3d8c49,_0x52eedb);_0x401498(_0x52eedb);});});}exports[_0x638b('0x1a')]=function(_0x5c86a9){var _0x3bb367=this;return new Promise(function(_0x53cef7,_0x332cf1){return db[_0x638b('0x1b')]['create'](_0x5c86a9['body'],{'raw':_0x5c86a9['options']?_0x5c86a9[_0x638b('0x1c')][_0x638b('0x1d')]===undefined?!![]:![]:!![]})[_0x638b('0xf')](function(_0x5218d9){logger[_0x638b('0x18')](_0x638b('0x1a'),_0x5c86a9);logger[_0x638b('0x11')](_0x638b('0x1a'),_0x5c86a9,JSON[_0x638b('0x14')](_0x5218d9));_0x53cef7(_0x5218d9);})['catch'](function(_0x11fdb8){logger['error'](_0x638b('0x1a'),_0x11fdb8[_0x638b('0x17')],_0x5c86a9);_0x332cf1(_0x3bb367[_0x638b('0x15')](0x1f4,_0x11fdb8['message']));});});};exports[_0x638b('0x1e')]=function(_0x1e3fb7){var _0x56f3b9=this;return new Promise(function(_0x15a6e8,_0x2b5ef4){return db['CmHopperHistory'][_0x638b('0x1f')]({'raw':_0x1e3fb7['options']?_0x1e3fb7['options'][_0x638b('0x1d')]===undefined?!![]:![]:!![],'where':_0x1e3fb7[_0x638b('0x1c')]?_0x1e3fb7['options']['where']||null:null,'attributes':[[db[_0x638b('0x20')]['fn'](_0x638b('0x21'),db[_0x638b('0x20')][_0x638b('0x22')]('id')),_0x638b('0x23')],[db[_0x638b('0x20')]['fn']('COUNT',db[_0x638b('0x20')]['fn']('IF',db['sequelize'][_0x638b('0x24')](_0x638b('0x25')))),_0x638b('0x26')],[db[_0x638b('0x20')]['fn']('COUNT',db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x27')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x638b('0x20')]['fn'](_0x638b('0x21'),db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x28')))),_0x638b('0x29')],[db[_0x638b('0x20')]['fn']('AVG',db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x638b('0x2a')],[db[_0x638b('0x20')]['fn']('AVG',db['sequelize']['fn']('IF',db['sequelize'][_0x638b('0x24')](_0x638b('0x2b')))),'predictiveIntervalAvgTalktime']]})[_0x638b('0xf')](function(_0x17414c){logger[_0x638b('0x18')](_0x638b('0x1e'),_0x1e3fb7);logger[_0x638b('0x11')]('AvgHandleTime',_0x1e3fb7,JSON['stringify'](_0x17414c));_0x15a6e8(_0x17414c);})[_0x638b('0x19')](function(_0x50c9fa){logger[_0x638b('0x15')](_0x638b('0x1e'),_0x50c9fa[_0x638b('0x17')],_0x1e3fb7);_0x2b5ef4(_0x56f3b9[_0x638b('0x15')](0x1f4,_0x50c9fa[_0x638b('0x17')]));});});};exports[_0x638b('0x2c')]=function(_0x33cf15){var _0x108b30=this;return new Promise(function(_0xeb54ee,_0x54e1ce){return db[_0x638b('0x1b')][_0x638b('0x1f')]({'raw':_0x33cf15[_0x638b('0x1c')]?_0x33cf15[_0x638b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x33cf15[_0x638b('0x1c')]?_0x33cf15[_0x638b('0x1c')]['where']||null:null,'attributes':[[_0x638b('0x2d'),_0x638b('0x2e')],[db[_0x638b('0x20')]['fn'](_0x638b('0x21'),db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')]['literal'](_0x638b('0x2f')))),'outboundNoSuchCallsDay'],[db[_0x638b('0x20')]['fn'](_0x638b('0x21'),db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x30')))),_0x638b('0x31')],[db[_0x638b('0x20')]['fn']('COUNT',db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x25')))),'outboundAnswerCallsDay'],[db[_0x638b('0x20')]['fn'](_0x638b('0x21'),db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x32')))),'outboundBusyCallsDay'],[db[_0x638b('0x20')]['fn']('COUNT',db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')]['literal'](_0x638b('0x33')))),_0x638b('0x34')],[db[_0x638b('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x35')))),_0x638b('0x36')],[db[_0x638b('0x20')]['fn'](_0x638b('0x21'),db[_0x638b('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0x638b('0x21'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x638b('0x37')))),'outboundUnknownCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x38')))),_0x638b('0x39')],[db[_0x638b('0x20')]['fn']('COUNT',db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x3a')))),_0x638b('0x3b')],[db[_0x638b('0x20')]['fn'](_0x638b('0x21'),db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x3c')))),'outboundRejectCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')]('`state`\x20=\x2016,\x201,\x20null'))),_0x638b('0x3d')],[db[_0x638b('0x20')]['fn']('COUNT',db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0x638b('0x3e')],[db[_0x638b('0x20')]['fn'](_0x638b('0x21'),db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x638b('0x3f')]],'group':['campaign']})[_0x638b('0xf')](function(_0x2eeb19){logger[_0x638b('0x18')](_0x638b('0x2c'),_0x33cf15);logger[_0x638b('0x11')]('GetVoiceQueueHopperHistory',_0x33cf15,JSON['stringify'](_0x2eeb19));_0xeb54ee(_0x2eeb19);})[_0x638b('0x19')](function(_0x2b8975){logger[_0x638b('0x15')]('GetVoiceQueueHopperHistory',_0x2b8975[_0x638b('0x17')],_0x33cf15);_0x54e1ce(_0x108b30[_0x638b('0x15')](0x1f4,_0x2b8975[_0x638b('0x17')]));});});};exports[_0x638b('0x40')]=function(_0x47f844){var _0x43efdf=this;return new Promise(function(_0x5d25e2,_0x5d27f8){return db['CmHopperHistory'][_0x638b('0x1f')]({'raw':_0x47f844[_0x638b('0x1c')]?_0x47f844[_0x638b('0x1c')][_0x638b('0x1d')]===undefined?!![]:![]:!![],'where':_0x47f844[_0x638b('0x1c')]?_0x47f844[_0x638b('0x1c')]['where']||null:null,'attributes':[['campaign',_0x638b('0x2e')],[db['sequelize']['fn'](_0x638b('0x21'),db[_0x638b('0x20')]['col']('id')),'ivrTotalCallsDays'],[db[_0x638b('0x20')]['fn']('COUNT',db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x25')))),_0x638b('0x41')]],'group':[_0x638b('0x2d')]})[_0x638b('0xf')](function(_0x58d859){logger['info']('GetCampaignHopperHistory',_0x47f844);logger[_0x638b('0x11')](_0x638b('0x40'),_0x47f844,JSON[_0x638b('0x14')](_0x58d859));_0x5d25e2(_0x58d859);})['catch'](function(_0x225fba){logger[_0x638b('0x15')](_0x638b('0x40'),_0x225fba[_0x638b('0x17')],_0x47f844);_0x5d27f8(_0x43efdf[_0x638b('0x15')](0x1f4,_0x225fba[_0x638b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index eb29e84..e4b1e83 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 _0xaa3c=['index','/describe','isAuthenticated','/:id','show','post','create','put','update','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get'];(function(_0x3ed26c,_0xab6b81){var _0x20074a=function(_0xd2a4d5){while(--_0xd2a4d5){_0x3ed26c['push'](_0x3ed26c['shift']());}};_0x20074a(++_0xab6b81);}(_0xaa3c,0x1e5));var _0xcaa3=function(_0xd93895,_0x405349){_0xd93895=_0xd93895-0x0;var _0x23c06d=_0xaa3c[_0xd93895];return _0x23c06d;};'use strict';var multer=require(_0xcaa3('0x0'));var util=require(_0xcaa3('0x1'));var path=require(_0xcaa3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcaa3('0x3')]();var fs_extra=require(_0xcaa3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcaa3('0x5'));var config=require(_0xcaa3('0x6'));var controller=require(_0xcaa3('0x7'));router[_0xcaa3('0x8')]('/',auth['isAuthenticated'](),controller[_0xcaa3('0x9')]);router[_0xcaa3('0x8')](_0xcaa3('0xa'),auth[_0xcaa3('0xb')](),controller['describe']);router['get'](_0xcaa3('0xc'),auth['isAuthenticated'](),controller[_0xcaa3('0xd')]);router[_0xcaa3('0xe')]('/',auth[_0xcaa3('0xb')](),controller[_0xcaa3('0xf')]);router[_0xcaa3('0x10')](_0xcaa3('0xc'),auth['isAuthenticated'](),controller[_0xcaa3('0x11')]);module[_0xcaa3('0x12')]=router; \ No newline at end of file +var _0x1b8c=['get','isAuthenticated','index','/:id','show','post','put','update','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmHopperHistory.controller'];(function(_0x25dda3,_0x4c0e93){var _0x20b001=function(_0x50ac35){while(--_0x50ac35){_0x25dda3['push'](_0x25dda3['shift']());}};_0x20b001(++_0x4c0e93);}(_0x1b8c,0x134));var _0xc1b8=function(_0x38ef2d,_0x4d58ff){_0x38ef2d=_0x38ef2d-0x0;var _0x2de5ca=_0x1b8c[_0x38ef2d];return _0x2de5ca;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc1b8('0x0'));var timeout=require(_0xc1b8('0x1'));var express=require(_0xc1b8('0x2'));var router=express[_0xc1b8('0x3')]();var fs_extra=require(_0xc1b8('0x4'));var auth=require(_0xc1b8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc1b8('0x6'));router[_0xc1b8('0x7')]('/',auth[_0xc1b8('0x8')](),controller[_0xc1b8('0x9')]);router[_0xc1b8('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc1b8('0x7')](_0xc1b8('0xa'),auth['isAuthenticated'](),controller[_0xc1b8('0xb')]);router[_0xc1b8('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc1b8('0xd')]('/:id',auth[_0xc1b8('0x8')](),controller[_0xc1b8('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index a44c860..354b33f 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 _0x500f=['exports','STRING','name','sequelize'];(function(_0x7eff10,_0xf268fc){var _0x582171=function(_0x476570){while(--_0x476570){_0x7eff10['push'](_0x7eff10['shift']());}};_0x582171(++_0xf268fc);}(_0x500f,0xd7));var _0xf500=function(_0x58c851,_0x1f3d96){_0x58c851=_0x58c851-0x0;var _0x534d8a=_0x500f[_0x58c851];return _0x534d8a;};'use strict';var Sequelize=require(_0xf500('0x0'));module[_0xf500('0x1')]={'name':{'type':Sequelize[_0xf500('0x2')],'unique':_0xf500('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf500('0x2')]},'dialPrefix':{'type':Sequelize[_0xf500('0x2')]}}; \ No newline at end of file +var _0x9e12=['STRING','sequelize','exports'];(function(_0x1c5765,_0x51d576){var _0x303166=function(_0x15fad6){while(--_0x15fad6){_0x1c5765['push'](_0x1c5765['shift']());}};_0x303166(++_0x51d576);}(_0x9e12,0xdc));var _0x29e1=function(_0x8590da,_0xbbe20f){_0x8590da=_0x8590da-0x0;var _0x203f0f=_0x9e12[_0x8590da];return _0x203f0f;};'use strict';var Sequelize=require(_0x29e1('0x0'));module[_0x29e1('0x1')]={'name':{'type':Sequelize[_0x29e1('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x29e1('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 735a2b6..fd910e5 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 _0x6f26=['CmCustomField','concat','CustomFields','format','cf_%d','raw','getContactsCsv','writeFileSync','setHeader','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','error','name','send','body','contact','message','agent','interaction','account','map','CmList','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','user','Lists','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','getDispositions','hasOwnProperty','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','success','Malformed\x20request\x20syntax','getContacts'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6f26,0xb4));var _0x66f2=function(_0x210dd4,_0x4ad95d){_0x210dd4=_0x210dd4-0x0;var _0x538297=_0x6f26[_0x210dd4];return _0x538297;};'use strict';var emlformat=require(_0x66f2('0x0'));var rimraf=require(_0x66f2('0x1'));var zipdir=require(_0x66f2('0x2'));var jsonpatch=require(_0x66f2('0x3'));var rp=require(_0x66f2('0x4'));var moment=require('moment');var BPromise=require(_0x66f2('0x5'));var Mustache=require('mustache');var util=require(_0x66f2('0x6'));var path=require(_0x66f2('0x7'));var sox=require(_0x66f2('0x8'));var csv=require(_0x66f2('0x9'));var ejs=require(_0x66f2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66f2('0xb'));var squel=require(_0x66f2('0xc'));var crypto=require(_0x66f2('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x66f2('0x9'));var querystring=require('querystring');var Papa=require(_0x66f2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x66f2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66f2('0x10'));var logger=require(_0x66f2('0x11'))(_0x66f2('0x12'));var utils=require(_0x66f2('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x66f2('0x14'));var db=require('../../mysqldb')['db'];config[_0x66f2('0x15')]=_[_0x66f2('0x16')](config[_0x66f2('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x66f2('0x17'))(new Redis(config[_0x66f2('0x15')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x2bf315,_0x24de83){_0x24de83=_0x24de83||0xcc;return function(_0x2e53a7){if(_0x2e53a7){return _0x2bf315[_0x66f2('0x18')](_0x24de83);}return _0x2bf315[_0x66f2('0x19')](_0x24de83)[_0x66f2('0x1a')]();};}function respondWithResult(_0x131324,_0x3c9e0b){_0x3c9e0b=_0x3c9e0b||0xc8;return function(_0x3dd063){if(_0x3dd063){return _0x131324[_0x66f2('0x19')](_0x3c9e0b)[_0x66f2('0x1b')](_0x3dd063);}};}function respondWithFilteredResult(_0x6e504,_0x5a116b){return function(_0x1a1413){if(_0x1a1413){var _0x1bf056=typeof _0x5a116b[_0x66f2('0x1c')]===_0x66f2('0x1d')&&typeof _0x5a116b[_0x66f2('0x1e')]===_0x66f2('0x1d');var _0x1cefc0=_0x1a1413['count'];var _0x53060f=_0x1bf056?0x0:_0x5a116b[_0x66f2('0x1c')];var _0x38f829=_0x1bf056?_0x1a1413[_0x66f2('0x1f')]:_0x5a116b[_0x66f2('0x1c')]+_0x5a116b[_0x66f2('0x1e')];var _0x599fb5;if(_0x38f829>=_0x1cefc0){_0x38f829=_0x1cefc0;_0x599fb5=0xc8;}else{_0x599fb5=0xce;}_0x6e504[_0x66f2('0x19')](_0x599fb5);return _0x6e504[_0x66f2('0x20')](_0x66f2('0x21'),_0x53060f+'-'+_0x38f829+'/'+_0x1cefc0)[_0x66f2('0x1b')](_0x1a1413);}return null;};}function patchUpdates(_0x2c6fee){return function(_0x44d4ba){try{jsonpatch[_0x66f2('0x22')](_0x44d4ba,_0x2c6fee,!![]);}catch(_0x3802f6){return BPromise[_0x66f2('0x23')](_0x3802f6);}return _0x44d4ba[_0x66f2('0x24')]();};}function saveUpdates(_0xed68a5,_0x5cbcd2){return function(_0x53af47){if(_0x53af47){return _0x53af47[_0x66f2('0x25')](_0xed68a5)[_0x66f2('0x26')](function(_0x1a1e20){return _0x1a1e20;});}return null;};}function removeEntity(_0x4d0058,_0x1d00f0){return function(_0x4b27f7){if(_0x4b27f7){return _0x4b27f7[_0x66f2('0x27')]()[_0x66f2('0x26')](function(){var _0x3cc5bc=_0x4b27f7[_0x66f2('0x28')]({'plain':!![]});var _0xa4f254='Lists';return db['UserProfileResource']['destroy']({'where':{'type':_0xa4f254,'resourceId':_0x3cc5bc['id']}})[_0x66f2('0x26')](function(){return _0x4b27f7;});})[_0x66f2('0x26')](function(){_0x4d0058[_0x66f2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15073c,_0x1e26a7){return function(_0x52f2dd){if(!_0x52f2dd){_0x15073c[_0x66f2('0x18')](0x194);}return _0x52f2dd;};}function handleError(_0x4d1669,_0x14883b){_0x14883b=_0x14883b||0x1f4;return function(_0x397a45){logger[_0x66f2('0x29')](_0x397a45['stack']);if(_0x397a45[_0x66f2('0x2a')]){delete _0x397a45[_0x66f2('0x2a')];}_0x4d1669[_0x66f2('0x19')](_0x14883b)[_0x66f2('0x2b')](_0x397a45);};}function getMustacheRender(_0x3bb757,_0x4a9e83){return Mustache['render'](_0x3bb757,_['merge'](_0x4a9e83[_0x66f2('0x2c')],{'contact':_0x4a9e83[_0x66f2('0x2d')],'message':_0x4a9e83[_0x66f2('0x2e')],'agent':_0x4a9e83[_0x66f2('0x2f')],'interaction':_0x4a9e83[_0x66f2('0x30')],'account':_0x4a9e83[_0x66f2('0x31')]}))||'';}exports['index']=function(_0x45d0bf,_0x1060be){var _0x3dd219={},_0x205ecf={},_0x4646d4={'count':0x0,'rows':[]};var _0x1b35dc=_[_0x66f2('0x32')](db[_0x66f2('0x33')]['rawAttributes'],function(_0x532fa0){return{'name':_0x532fa0[_0x66f2('0x34')],'type':_0x532fa0['type'][_0x66f2('0x35')]};});_0x205ecf[_0x66f2('0x36')]=_[_0x66f2('0x32')](_0x1b35dc,'name');_0x205ecf['query']=_[_0x66f2('0x37')](_0x45d0bf[_0x66f2('0x38')]);_0x205ecf[_0x66f2('0x39')]=_[_0x66f2('0x3a')](_0x205ecf['model'],_0x205ecf[_0x66f2('0x38')]);_0x3dd219[_0x66f2('0x3b')]=_[_0x66f2('0x3a')](_0x205ecf[_0x66f2('0x36')],qs[_0x66f2('0x3c')](_0x45d0bf[_0x66f2('0x38')][_0x66f2('0x3c')]));_0x3dd219[_0x66f2('0x3b')]=_0x3dd219[_0x66f2('0x3b')][_0x66f2('0x3d')]?_0x3dd219[_0x66f2('0x3b')]:_0x205ecf[_0x66f2('0x36')];if(!_0x45d0bf[_0x66f2('0x38')]['hasOwnProperty'](_0x66f2('0x3e'))){_0x3dd219['limit']=qs['limit'](_0x45d0bf['query'][_0x66f2('0x1e')]);_0x3dd219[_0x66f2('0x1c')]=qs['offset'](_0x45d0bf[_0x66f2('0x38')][_0x66f2('0x1c')]);}_0x3dd219[_0x66f2('0x3f')]=qs['sort'](_0x45d0bf[_0x66f2('0x38')][_0x66f2('0x40')]);_0x3dd219[_0x66f2('0x41')]=qs[_0x66f2('0x39')](_[_0x66f2('0x42')](_0x45d0bf[_0x66f2('0x38')],_0x205ecf['filters']),_0x1b35dc);if(_0x45d0bf[_0x66f2('0x38')][_0x66f2('0x43')]){_0x3dd219[_0x66f2('0x41')]=_[_0x66f2('0x44')](_0x3dd219[_0x66f2('0x41')],{'$or':_['map'](_0x1b35dc,function(_0x68df20){if(_0x68df20[_0x66f2('0x45')]!=='VIRTUAL'){var _0x55def0={};_0x55def0[_0x68df20[_0x66f2('0x2a')]]={'$like':'%'+_0x45d0bf[_0x66f2('0x38')][_0x66f2('0x43')]+'%'};return _0x55def0;}})});}_0x3dd219=_[_0x66f2('0x44')]({},_0x3dd219,_0x45d0bf[_0x66f2('0x46')]);var _0x396d79={'where':_0x3dd219['where']};return db[_0x66f2('0x33')][_0x66f2('0x1f')](_0x396d79)['then'](function(_0x28e023){_0x4646d4['count']=_0x28e023;if(_0x45d0bf['query'][_0x66f2('0x47')]){_0x3dd219['include']=[{'all':!![]}];}return db[_0x66f2('0x33')][_0x66f2('0x48')](_0x3dd219);})[_0x66f2('0x26')](function(_0x321cbe){_0x4646d4[_0x66f2('0x49')]=_0x321cbe;return _0x4646d4;})[_0x66f2('0x26')](respondWithFilteredResult(_0x1060be,_0x3dd219))[_0x66f2('0x4a')](handleError(_0x1060be,null));};exports[_0x66f2('0x4b')]=function(_0x108adf,_0x2d358c){var _0x3ce2fb={'raw':![],'where':{'id':_0x108adf[_0x66f2('0x4c')]['id']}},_0x40c1f5={};_0x40c1f5[_0x66f2('0x36')]=_['keys'](db['CmList'][_0x66f2('0x4d')]);_0x40c1f5['query']=_['keys'](_0x108adf['query']);_0x40c1f5['filters']=_['intersection'](_0x40c1f5['model'],_0x40c1f5[_0x66f2('0x38')]);_0x3ce2fb[_0x66f2('0x3b')]=_[_0x66f2('0x3a')](_0x40c1f5['model'],qs[_0x66f2('0x3c')](_0x108adf[_0x66f2('0x38')][_0x66f2('0x3c')]));_0x3ce2fb[_0x66f2('0x3b')]=_0x3ce2fb[_0x66f2('0x3b')]['length']?_0x3ce2fb[_0x66f2('0x3b')]:_0x40c1f5['model'];if(_0x108adf[_0x66f2('0x38')][_0x66f2('0x47')]){_0x3ce2fb[_0x66f2('0x4e')]=[{'all':!![]}];}_0x3ce2fb=_['merge']({},_0x3ce2fb,_0x108adf[_0x66f2('0x46')]);return db[_0x66f2('0x33')]['find'](_0x3ce2fb)[_0x66f2('0x26')](handleEntityNotFound(_0x2d358c,null))[_0x66f2('0x26')](respondWithResult(_0x2d358c,null))['catch'](handleError(_0x2d358c,null));};exports[_0x66f2('0x4f')]=function(_0x31631d,_0x5b7099){return db[_0x66f2('0x33')][_0x66f2('0x4f')](_0x31631d[_0x66f2('0x2c')],{})[_0x66f2('0x26')](function(_0x526775){var _0x52bdaf=_0x31631d[_0x66f2('0x50')][_0x66f2('0x28')]({'plain':!![]});if(!_0x52bdaf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52bdaf['role']==='user'){var _0x2c5981=_0x526775[_0x66f2('0x28')]({'plain':!![]});var _0x5171=_0x66f2('0x51');return db[_0x66f2('0x52')][_0x66f2('0x53')]({'where':{'name':_0x5171,'userProfileId':_0x52bdaf['userProfileId']},'raw':!![]})['then'](function(_0x3b88c5){if(_0x3b88c5&&_0x3b88c5[_0x66f2('0x54')]===0x0){return db[_0x66f2('0x55')][_0x66f2('0x4f')]({'name':_0x2c5981[_0x66f2('0x2a')],'resourceId':_0x2c5981['id'],'type':_0x3b88c5['name'],'sectionId':_0x3b88c5['id']},{})[_0x66f2('0x26')](function(){return _0x526775;});}else{return _0x526775;}})[_0x66f2('0x4a')](function(_0x5b5689){logger[_0x66f2('0x29')](_0x66f2('0x56'),_0x5b5689);throw _0x5b5689;});}return _0x526775;})['then'](respondWithResult(_0x5b7099,0xc9))[_0x66f2('0x4a')](handleError(_0x5b7099,null));};exports[_0x66f2('0x25')]=function(_0x500d35,_0x48e1a0){if(_0x500d35[_0x66f2('0x2c')]['id']){delete _0x500d35[_0x66f2('0x2c')]['id'];}return db[_0x66f2('0x33')][_0x66f2('0x53')]({'where':{'id':_0x500d35[_0x66f2('0x4c')]['id']}})[_0x66f2('0x26')](handleEntityNotFound(_0x48e1a0,null))[_0x66f2('0x26')](saveUpdates(_0x500d35[_0x66f2('0x2c')],null))[_0x66f2('0x26')](respondWithResult(_0x48e1a0,null))[_0x66f2('0x4a')](handleError(_0x48e1a0,null));};exports[_0x66f2('0x27')]=function(_0x2a8536,_0xe3b713){return db[_0x66f2('0x33')]['find']({'where':{'id':_0x2a8536['params']['id']}})['then'](handleEntityNotFound(_0xe3b713,null))[_0x66f2('0x26')](removeEntity(_0xe3b713,null))[_0x66f2('0x4a')](handleError(_0xe3b713,null));};exports['describe']=function(_0x56ee7e,_0x25347a){return db[_0x66f2('0x33')][_0x66f2('0x57')]()[_0x66f2('0x26')](respondWithResult(_0x25347a,null))['catch'](handleError(_0x25347a,null));};exports['addDisposition']=function(_0x540011,_0x2e66df,_0x3ef2e2){if(_0x540011[_0x66f2('0x2c')]['id']){delete _0x540011[_0x66f2('0x2c')]['id'];}return db[_0x66f2('0x33')]['find']({'where':{'id':_0x540011['params']['id']}})[_0x66f2('0x26')](handleEntityNotFound(_0x2e66df,null))[_0x66f2('0x26')](function(_0x5dc068){if(_0x5dc068){_0x540011['body'][_0x66f2('0x58')]=_0x5dc068['id'];return db[_0x66f2('0x59')][_0x66f2('0x4f')](_0x540011['body']);}})[_0x66f2('0x26')](respondWithResult(_0x2e66df,null))[_0x66f2('0x4a')](handleError(_0x2e66df,null));};exports[_0x66f2('0x5a')]=function(_0x1a88ce,_0x3912af,_0x2744ba){var _0x8a9ca={'raw':![],'where':{}};var _0x20282a={};var _0x4d5cdf={'count':0x0,'rows':[]};return db[_0x66f2('0x33')]['findOne']({'where':{'id':_0x1a88ce[_0x66f2('0x4c')]['id']}})[_0x66f2('0x26')](handleEntityNotFound(_0x3912af,null))['then'](function(_0x14c2a3){if(_0x14c2a3){_0x20282a['model']=_[_0x66f2('0x37')](db[_0x66f2('0x59')]['rawAttributes']);_0x20282a[_0x66f2('0x38')]=_[_0x66f2('0x37')](_0x1a88ce['query']);_0x20282a[_0x66f2('0x39')]=_[_0x66f2('0x3a')](_0x20282a[_0x66f2('0x36')],_0x20282a['query']);_0x8a9ca['attributes']=_['intersection'](_0x20282a['model'],qs[_0x66f2('0x3c')](_0x1a88ce[_0x66f2('0x38')]['fields']));_0x8a9ca[_0x66f2('0x3b')]=_0x8a9ca[_0x66f2('0x3b')][_0x66f2('0x3d')]?_0x8a9ca['attributes']:_0x20282a['model'];if(!_0x1a88ce[_0x66f2('0x38')][_0x66f2('0x5b')](_0x66f2('0x3e'))){_0x8a9ca['limit']=qs[_0x66f2('0x1e')](_0x1a88ce[_0x66f2('0x38')][_0x66f2('0x1e')]);_0x8a9ca[_0x66f2('0x1c')]=qs['offset'](_0x1a88ce[_0x66f2('0x38')][_0x66f2('0x1c')]);}_0x8a9ca['order']=qs[_0x66f2('0x40')](_0x1a88ce['query'][_0x66f2('0x40')]);_0x8a9ca['where']=qs[_0x66f2('0x39')](_[_0x66f2('0x42')](_0x1a88ce['query'],_0x20282a[_0x66f2('0x39')]));_0x8a9ca[_0x66f2('0x41')]['ListId']=_0x14c2a3['id'];if(_0x1a88ce[_0x66f2('0x38')][_0x66f2('0x43')]){_0x8a9ca[_0x66f2('0x41')]=_[_0x66f2('0x44')](_0x8a9ca[_0x66f2('0x41')],{'$or':_[_0x66f2('0x32')](_0x8a9ca['attributes'],function(_0x1969f4){var _0xfde145={};_0xfde145[_0x1969f4]={'$like':'%'+_0x1a88ce[_0x66f2('0x38')]['filter']+'%'};return _0xfde145;})});}_0x8a9ca=_[_0x66f2('0x44')]({},_0x8a9ca,_0x1a88ce['options']);return db['Disposition']['count']({'where':_0x8a9ca['where']})['then'](function(_0x5c00e3){_0x4d5cdf['count']=_0x5c00e3;if(_0x1a88ce['query'][_0x66f2('0x47')]){_0x8a9ca['include']=[{'all':!![]}];}return db['Disposition'][_0x66f2('0x48')](_0x8a9ca);})[_0x66f2('0x26')](function(_0x43fd25){_0x4d5cdf['rows']=_0x43fd25;return _0x4d5cdf;});}})[_0x66f2('0x26')](respondWithFilteredResult(_0x3912af,_0x8a9ca))[_0x66f2('0x4a')](handleError(_0x3912af,null));};exports['removeDispositions']=function(_0x4053e7,_0x24839c,_0x12a4fb){return db[_0x66f2('0x33')][_0x66f2('0x53')]({'where':{'id':_0x4053e7['params']['id']}})[_0x66f2('0x26')](handleEntityNotFound(_0x24839c,null))[_0x66f2('0x26')](function(_0x2bc721){if(_0x2bc721){return _0x2bc721[_0x66f2('0x5c')](_0x4053e7[_0x66f2('0x38')][_0x66f2('0x5d')]);}})[_0x66f2('0x26')](respondWithStatusCode(_0x24839c,null))[_0x66f2('0x4a')](handleError(_0x24839c,null));};exports[_0x66f2('0x5e')]=function(_0x464b37,_0xf89006,_0x16c3e6){return db[_0x66f2('0x33')][_0x66f2('0x53')]({'where':{'id':_0x464b37[_0x66f2('0x4c')]['id']}})[_0x66f2('0x26')](handleEntityNotFound(_0xf89006,null))[_0x66f2('0x26')](function(_0x3f8d05){if(_0x3f8d05){var _0x2b2255=[];var _0x184eb7={'success':[],'errors':[]};return db[_0x66f2('0x5f')][_0x66f2('0x57')]()[_0x66f2('0x26')](function(_0x39b9f1){if(_0x464b37[_0x66f2('0x2c')]['tags']&&_[_0x66f2('0x60')](_0x464b37['body'][_0x66f2('0x61')])){if(_0x464b37[_0x66f2('0x2c')][_0x66f2('0x61')][_0x66f2('0x3d')]){_0x464b37[_0x66f2('0x2c')][_0x66f2('0x61')]=_0x464b37[_0x66f2('0x2c')][_0x66f2('0x61')][_0x66f2('0x62')](';')+';';}else{_0x464b37[_0x66f2('0x2c')][_0x66f2('0x61')]=null;}}else{_0x464b37[_0x66f2('0x2c')][_0x66f2('0x61')]=null;}if(_0x464b37['body']&&_['isArray'](_0x464b37[_0x66f2('0x2c')])){for(var _0x40ae=0x0;_0x40ae<_0x464b37['body'][_0x66f2('0x3d')];_0x40ae+=0x1){_0x464b37[_0x66f2('0x2c')][_0x40ae][_0x66f2('0x58')]=_0x464b37['params']['id'];_0x2b2255[_0x66f2('0x63')](_0x464b37['body'][_0x40ae]);}return BPromise[_0x66f2('0x64')](_0x2b2255,function(_0x267a93){return db[_0x66f2('0x5f')]['create'](_['omit'](_0x267a93,[_0x66f2('0x5d'),'id'])||{},{'fields':_[_0x66f2('0x37')](_0x39b9f1),'raw':!![]})['then'](function(_0x4f7fd0){_0x184eb7[_0x66f2('0x65')][_0x66f2('0x63')](_0x4f7fd0['dataValues']);})['catch'](function(_0x5f5c4f){_0x184eb7['errors'][_0x66f2('0x63')]({'data':_0x267a93,'error':_0x5f5c4f[_0x66f2('0x2e')]});});})[_0x66f2('0x26')](function(_0x1b4af6){return _0x184eb7;})[_0x66f2('0x4a')](function(_0xc2df9d){return _0xc2df9d;});}else{_0xf89006['status'](0x190)[_0x66f2('0x1b')]({'message':_0x66f2('0x66')});}});}})[_0x66f2('0x26')](respondWithResult(_0xf89006,null))[_0x66f2('0x4a')](handleError(_0xf89006,null));};exports[_0x66f2('0x67')]=function(_0x4e9502,_0x1d3362,_0x174d43){var _0x45a726;return db[_0x66f2('0x33')][_0x66f2('0x53')]({'where':{'id':_0x4e9502[_0x66f2('0x4c')]['id']},'include':[{'model':db[_0x66f2('0x68')],'as':'CustomFields'}]})[_0x66f2('0x26')](handleEntityNotFound(_0x1d3362,null))[_0x66f2('0x26')](function(_0x6d578){if(_0x6d578){_0x45a726=_0x6d578;return db['CmContact'][_0x66f2('0x4d')];}})[_0x66f2('0x26')](function(_0x48dc4b){if(_0x48dc4b){var _0x34eb56={};var _0x316859={};_0x316859['model']=_[_0x66f2('0x69')](_[_0x66f2('0x37')](_0x48dc4b),_['map'](_0x45a726[_0x66f2('0x6a')],function(_0x2234fc){return util[_0x66f2('0x6b')](_0x66f2('0x6c'),_0x2234fc['id']);}));_0x316859[_0x66f2('0x38')]=_[_0x66f2('0x37')](_0x4e9502[_0x66f2('0x38')]);_0x316859[_0x66f2('0x39')]=_[_0x66f2('0x3a')](_0x316859[_0x66f2('0x36')],_0x316859[_0x66f2('0x38')]);_0x34eb56[_0x66f2('0x3b')]=_[_0x66f2('0x3a')](_0x316859[_0x66f2('0x36')],qs[_0x66f2('0x3c')](_0x4e9502['query'][_0x66f2('0x3c')]));_0x34eb56['attributes']=_0x34eb56[_0x66f2('0x3b')][_0x66f2('0x3d')]?_0x34eb56[_0x66f2('0x3b')]:_0x316859[_0x66f2('0x36')];if(!_0x4e9502[_0x66f2('0x38')][_0x66f2('0x5b')](_0x66f2('0x3e'))){_0x34eb56[_0x66f2('0x1e')]=qs['limit'](_0x4e9502['query']['limit']);_0x34eb56['offset']=qs[_0x66f2('0x1c')](_0x4e9502[_0x66f2('0x38')][_0x66f2('0x1c')]);}_0x34eb56['order']=qs['sort'](_0x4e9502[_0x66f2('0x38')][_0x66f2('0x40')]);_0x34eb56['where']=qs['filters'](_['pick'](_0x4e9502['query'],_0x316859['filters']));_0x34eb56[_0x66f2('0x6d')]=!![];if(_0x4e9502[_0x66f2('0x38')]['filter']){_0x34eb56[_0x66f2('0x41')]=_[_0x66f2('0x44')](_0x34eb56[_0x66f2('0x41')],{'$or':_[_0x66f2('0x32')](_0x34eb56['attributes'],function(_0x5451b8){var _0x141f51={};_0x141f51[_0x5451b8]={'$like':'%'+_0x4e9502[_0x66f2('0x38')][_0x66f2('0x43')]+'%'};return _0x141f51;})});}_0x34eb56=_['merge']({},_0x34eb56,_0x4e9502[_0x66f2('0x46')]);return _0x45a726[_0x66f2('0x67')](_0x34eb56);}})[_0x66f2('0x26')](respondWithResult(_0x1d3362,null))[_0x66f2('0x4a')](handleError(_0x1d3362,null));};exports[_0x66f2('0x6e')]=function(_0x138a19,_0x26956e,_0x445d67){var _0xc3e98f;return db['CmList'][_0x66f2('0x53')]({'where':{'id':_0x138a19[_0x66f2('0x4c')]['id']},'include':[{'model':db[_0x66f2('0x68')],'as':_0x66f2('0x6a')}]})['then'](handleEntityNotFound(_0x26956e,null))[_0x66f2('0x26')](function(_0x3f92ba){if(_0x3f92ba){_0xc3e98f=_0x3f92ba;return db[_0x66f2('0x5f')]['rawAttributes'];}})['then'](function(_0x16f10c){if(_0x16f10c){var _0x2f6d5f={};var _0xdd24c6={};_0xdd24c6[_0x66f2('0x36')]=_[_0x66f2('0x69')](_[_0x66f2('0x37')](_0x16f10c),_[_0x66f2('0x32')](_0xc3e98f['CustomFields'],function(_0x58570d){return util[_0x66f2('0x6b')](_0x66f2('0x6c'),_0x58570d['id']);}));_0xdd24c6[_0x66f2('0x38')]=_['keys'](_0x138a19['query']);_0xdd24c6[_0x66f2('0x39')]=_[_0x66f2('0x3a')](_0xdd24c6[_0x66f2('0x36')],_0xdd24c6['query']);_0x2f6d5f[_0x66f2('0x3b')]=_[_0x66f2('0x3a')](_0xdd24c6['model'],qs[_0x66f2('0x3c')](_0x138a19['query']['fields']));_0x2f6d5f['attributes']=_0x2f6d5f[_0x66f2('0x3b')]['length']?_0x2f6d5f['attributes']:_0xdd24c6[_0x66f2('0x36')];if(!_0x138a19[_0x66f2('0x38')][_0x66f2('0x5b')](_0x66f2('0x3e'))){_0x2f6d5f[_0x66f2('0x1e')]=qs[_0x66f2('0x1e')](_0x138a19[_0x66f2('0x38')][_0x66f2('0x1e')]);_0x2f6d5f[_0x66f2('0x1c')]=qs[_0x66f2('0x1c')](_0x138a19[_0x66f2('0x38')]['offset']);}_0x2f6d5f[_0x66f2('0x3f')]=qs[_0x66f2('0x40')](_0x138a19[_0x66f2('0x38')][_0x66f2('0x40')]);_0x2f6d5f[_0x66f2('0x41')]=qs[_0x66f2('0x39')](_[_0x66f2('0x42')](_0x138a19[_0x66f2('0x38')],_0xdd24c6['filters']));_0x2f6d5f[_0x66f2('0x6d')]=!![];if(_0x138a19[_0x66f2('0x38')][_0x66f2('0x43')]){_0x2f6d5f[_0x66f2('0x41')]=_['merge'](_0x2f6d5f['where'],{'$or':_['map'](_0x2f6d5f[_0x66f2('0x3b')],function(_0x560f9d){var _0x1c78dc={};_0x1c78dc[_0x560f9d]={'$like':'%'+_0x138a19[_0x66f2('0x38')][_0x66f2('0x43')]+'%'};return _0x1c78dc;})});}_0x2f6d5f=_[_0x66f2('0x44')]({},_0x2f6d5f,_0x138a19['options']);return _0xc3e98f[_0x66f2('0x67')](_0x2f6d5f);}})[_0x66f2('0x26')](function(_0x3d3e34){if(!_['isEmpty'](_0x3d3e34)){var _0x864624=toCsv(_0x3d3e34);var _0x2d15a3=Date['now']();fs[_0x66f2('0x6f')](util[_0x66f2('0x6b')]('/tmp/list_%d_%s.csv',_0xc3e98f['id'],_0x2d15a3),_0x864624);_0x26956e[_0x66f2('0x70')]('Content-disposition','attachment;\x20filename='+util[_0x66f2('0x6b')]('list_%d_%s.csv',_0xc3e98f['id'],_0x2d15a3));_0x26956e[_0x66f2('0x70')](_0x66f2('0x71'),_0x66f2('0x72'));return _0x26956e[_0x66f2('0x73')](util[_0x66f2('0x6b')](_0x66f2('0x74'),_0xc3e98f['id'],_0x2d15a3));}else{return _0x26956e[_0x66f2('0x18')](0xcc);}})[_0x66f2('0x4a')](handleError(_0x26956e,null));};exports[_0x66f2('0x75')]=function(_0x3e2fbf,_0x21ce40,_0x461bd1){var _0x27d623;delete _0x3e2fbf[_0x66f2('0x2c')]['id'];return db[_0x66f2('0x33')][_0x66f2('0x76')]({'where':{'id':_0x3e2fbf['params']['id']}})[_0x66f2('0x26')](handleEntityNotFound(_0x21ce40,null))[_0x66f2('0x26')](function(_0x10eb22){if(_0x10eb22){return db[_0x66f2('0x77')][_0x66f2('0x78')](function(_0xc258ca){return db[_0x66f2('0x68')][_0x66f2('0x4f')](_0x3e2fbf[_0x66f2('0x2c')],{'transaction':_0xc258ca})['then'](function(_0x25ccc7){_0x27d623=_0x25ccc7;return _0x10eb22[_0x66f2('0x79')](_0x25ccc7,{'transaction':_0xc258ca});})[_0x66f2('0x26')](function(){var _0x5de3b5={'type':db[_0x66f2('0x7a')][_0x66f2('0x7b')],'transaction':_0xc258ca};switch(_0x3e2fbf['body'][_0x66f2('0x45')]){case'text':_0x5de3b5['type']=db[_0x66f2('0x7a')]['TEXT'];break;case _0x66f2('0x7c'):_0x5de3b5['type']=db[_0x66f2('0x7a')][_0x66f2('0x7d')];break;case'switch':_0x5de3b5[_0x66f2('0x45')]=db[_0x66f2('0x7a')][_0x66f2('0x7e')];_0x5de3b5[_0x66f2('0x7f')]=![];break;default:}return db[_0x66f2('0x77')][_0x66f2('0x80')]['addColumn'](_0x66f2('0x81'),util[_0x66f2('0x6b')](_0x66f2('0x82'),_0x27d623['id']),_0x5de3b5);})[_0x66f2('0x26')](function(){return _0x27d623;});});}})['then'](respondWithResult(_0x21ce40,null))[_0x66f2('0x4a')](handleError(_0x21ce40,null));};exports[_0x66f2('0x83')]=function(_0x3dd4d5,_0x2e9b5e,_0x2ee4b7){var _0x4bd882={};var _0x3f2690={};var _0x267c7e;var _0x1ace4c;return db[_0x66f2('0x33')][_0x66f2('0x76')]({'where':{'id':_0x3dd4d5[_0x66f2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e9b5e,null))[_0x66f2('0x26')](function(_0xffb994){if(_0xffb994){_0x267c7e=_0xffb994;_0x3f2690[_0x66f2('0x36')]=_[_0x66f2('0x37')](db['CmCustomField']['rawAttributes']);_0x3f2690['query']=_[_0x66f2('0x37')](_0x3dd4d5[_0x66f2('0x38')]);_0x3f2690['filters']=_['intersection'](_0x3f2690['model'],_0x3f2690[_0x66f2('0x38')]);_0x4bd882[_0x66f2('0x3b')]=_[_0x66f2('0x3a')](_0x3f2690[_0x66f2('0x36')],qs[_0x66f2('0x3c')](_0x3dd4d5[_0x66f2('0x38')][_0x66f2('0x3c')]));_0x4bd882[_0x66f2('0x3b')]=_0x4bd882['attributes']['length']?_0x4bd882['attributes']:_0x3f2690[_0x66f2('0x36')];_0x4bd882[_0x66f2('0x3f')]=qs[_0x66f2('0x40')](_0x3dd4d5[_0x66f2('0x38')][_0x66f2('0x40')]);_0x4bd882['where']=qs[_0x66f2('0x39')](_[_0x66f2('0x42')](_0x3dd4d5[_0x66f2('0x38')],_0x3f2690[_0x66f2('0x39')]));_0x4bd882[_0x66f2('0x41')]=_[_0x66f2('0x44')](_0x4bd882['where'],{'$or':[{'ListId':_0xffb994['id']},{'ListId':null}]});if(_0x3dd4d5[_0x66f2('0x38')][_0x66f2('0x43')]){_0x4bd882[_0x66f2('0x41')]=_[_0x66f2('0x44')](_0x4bd882[_0x66f2('0x41')],{'$or':_[_0x66f2('0x32')](_0x4bd882['attributes'],function(_0x4a26e9){var _0x496745={};_0x496745[_0x4a26e9]={'$like':'%'+_0x3dd4d5[_0x66f2('0x38')][_0x66f2('0x43')]+'%'};return _0x496745;})});}_0x4bd882=_[_0x66f2('0x44')]({},_0x4bd882,_0x3dd4d5['options']);return db[_0x66f2('0x68')][_0x66f2('0x84')](_0x4bd882);}})[_0x66f2('0x26')](respondWithResult(_0x2e9b5e,null))[_0x66f2('0x4a')](handleError(_0x2e9b5e,null));};exports[_0x66f2('0x85')]=function(_0x5612a5,_0x25bda1,_0x26f25c){return db[_0x66f2('0x33')][_0x66f2('0x53')]({'where':{'id':_0x5612a5[_0x66f2('0x4c')]['id']}})[_0x66f2('0x26')](handleEntityNotFound(_0x25bda1,null))[_0x66f2('0x26')](function(_0x2aed2f){if(_0x2aed2f){return _0x2aed2f[_0x66f2('0x85')](_0x5612a5[_0x66f2('0x2c')]['ids'],_[_0x66f2('0x86')](_0x5612a5[_0x66f2('0x2c')],[_0x66f2('0x5d'),'id'])||{})[_0x66f2('0x87')](function(_0x285673){for(var _0xf2ba7e=0x0;_0xf2ba7e<_0x5612a5[_0x66f2('0x2c')][_0x66f2('0x5d')]['length'];_0xf2ba7e+=0x1){socket[_0x66f2('0x88')](_0x66f2('0x89'),{'UserId':_0x5612a5[_0x66f2('0x2c')][_0x66f2('0x5d')][_0xf2ba7e],'CmListId':_0x5612a5[_0x66f2('0x4c')]['id']});}return _0x285673;});}})['then'](respondWithResult(_0x25bda1,null))[_0x66f2('0x4a')](handleError(_0x25bda1,null));};exports[_0x66f2('0x8a')]=function(_0x1fc0a6,_0x3d1a80,_0x50de20){return db[_0x66f2('0x33')][_0x66f2('0x53')]({'where':{'id':_0x1fc0a6['params']['id']}})['then'](handleEntityNotFound(_0x3d1a80,null))[_0x66f2('0x26')](function(_0x10098d){if(_0x10098d){return _0x10098d[_0x66f2('0x8a')](_0x1fc0a6[_0x66f2('0x38')][_0x66f2('0x5d')])[_0x66f2('0x26')](function(){if(_['isArray'](_0x1fc0a6[_0x66f2('0x38')][_0x66f2('0x5d')])){for(var _0x2b7a6c=0x0;_0x2b7a6c<_0x1fc0a6[_0x66f2('0x38')][_0x66f2('0x5d')][_0x66f2('0x3d')];_0x2b7a6c+=0x1){socket['emit'](_0x66f2('0x8b'),{'UserId':Number(_0x1fc0a6['query'][_0x66f2('0x5d')][_0x2b7a6c]),'CmListId':Number(_0x1fc0a6['params']['id'])});}}else{socket[_0x66f2('0x88')](_0x66f2('0x8b'),{'UserId':Number(_0x1fc0a6[_0x66f2('0x38')][_0x66f2('0x5d')]),'CmListId':Number(_0x1fc0a6[_0x66f2('0x4c')]['id'])});}});}})[_0x66f2('0x26')](respondWithStatusCode(_0x3d1a80,null))[_0x66f2('0x4a')](handleError(_0x3d1a80,null));};exports[_0x66f2('0x8c')]=function(_0x546355,_0x146bff,_0x2180de){var _0x30771a={};var _0x4a2168={};var _0x5efc73;var _0x48c360;return db[_0x66f2('0x33')][_0x66f2('0x76')]({'where':{'id':_0x546355[_0x66f2('0x4c')]['id']}})[_0x66f2('0x26')](handleEntityNotFound(_0x146bff,null))[_0x66f2('0x26')](function(_0x250b1c){if(_0x250b1c){_0x5efc73=_0x250b1c;_0x4a2168[_0x66f2('0x36')]=_[_0x66f2('0x37')](db[_0x66f2('0x8d')]['rawAttributes']);_0x4a2168['query']=_[_0x66f2('0x37')](_0x546355[_0x66f2('0x38')]);_0x4a2168[_0x66f2('0x39')]=_[_0x66f2('0x3a')](_0x4a2168['model'],_0x4a2168['query']);_0x30771a[_0x66f2('0x3b')]=_[_0x66f2('0x3a')](_0x4a2168[_0x66f2('0x36')],qs[_0x66f2('0x3c')](_0x546355[_0x66f2('0x38')][_0x66f2('0x3c')]));_0x30771a['attributes']=_0x30771a[_0x66f2('0x3b')]['length']?_0x30771a[_0x66f2('0x3b')]:_0x4a2168[_0x66f2('0x36')];_0x30771a[_0x66f2('0x3f')]=qs['sort'](_0x546355[_0x66f2('0x38')][_0x66f2('0x40')]);_0x30771a['where']=qs[_0x66f2('0x39')](_['pick'](_0x546355['query'],_0x4a2168[_0x66f2('0x39')]));if(_0x546355['query'][_0x66f2('0x43')]){_0x30771a[_0x66f2('0x41')]=_[_0x66f2('0x44')](_0x30771a[_0x66f2('0x41')],{'$or':_[_0x66f2('0x32')](_0x30771a[_0x66f2('0x3b')],function(_0xf307cc){var _0x4a24e6={};_0x4a24e6[_0xf307cc]={'$like':'%'+_0x546355[_0x66f2('0x38')][_0x66f2('0x43')]+'%'};return _0x4a24e6;})});}_0x30771a=_[_0x66f2('0x44')]({},_0x30771a,_0x546355['options']);return _0x5efc73[_0x66f2('0x8c')](_0x30771a);}})[_0x66f2('0x26')](function(_0xad9339){if(_0xad9339){_0x48c360=_0xad9339['length'];if(!_0x546355['query'][_0x66f2('0x5b')](_0x66f2('0x3e'))){_0x30771a['limit']=qs[_0x66f2('0x1e')](_0x546355[_0x66f2('0x38')][_0x66f2('0x1e')]);_0x30771a[_0x66f2('0x1c')]=qs[_0x66f2('0x1c')](_0x546355[_0x66f2('0x38')][_0x66f2('0x1c')]);}return _0x5efc73[_0x66f2('0x8c')](_0x30771a);}})[_0x66f2('0x26')](function(_0x33d3df){if(_0x33d3df){return _0x33d3df?{'count':_0x48c360,'rows':_0x33d3df}:null;}})[_0x66f2('0x26')](respondWithResult(_0x146bff,null))[_0x66f2('0x4a')](handleError(_0x146bff,null));}; \ No newline at end of file +var _0x0092=['squel','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','defaults','redis','localhost','socket.io-emitter','./cmList.socket','status','end','offset','undefined','count','limit','set','json','apply','reject','save','then','destroy','Lists','sendStatus','error','name','render','body','contact','message','interaction','account','index','map','CmList','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','rows','catch','show','params','keys','intersection','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','Disposition','getDispositions','findOne','removeDispositions','ids','addContacts','tags','join','each','CmContact','omit','push','dataValues','errors','Malformed\x20request\x20syntax','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','CmCustomField','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','attachment;\x20filename=','setHeader','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','type','text','TEXT','number','INTEGER','queryInterface','cm_contacts','cf_%s','getCustomFields','addAgents','spread','emit','removeAgents','isArray','userCmList:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash'];(function(_0xf9c2a4,_0x569900){var _0x1179e8=function(_0x32d20e){while(--_0x32d20e){_0xf9c2a4['push'](_0xf9c2a4['shift']());}};_0x1179e8(++_0x569900);}(_0x0092,0x123));var _0x2009=function(_0x5bde78,_0xef666d){_0x5bde78=_0x5bde78-0x0;var _0x587f12=_0x0092[_0x5bde78];return _0x587f12;};'use strict';var emlformat=require(_0x2009('0x0'));var rimraf=require(_0x2009('0x1'));var zipdir=require(_0x2009('0x2'));var jsonpatch=require(_0x2009('0x3'));var rp=require(_0x2009('0x4'));var moment=require('moment');var BPromise=require(_0x2009('0x5'));var Mustache=require(_0x2009('0x6'));var util=require(_0x2009('0x7'));var path=require(_0x2009('0x8'));var sox=require(_0x2009('0x9'));var csv=require('to-csv');var ejs=require(_0x2009('0xa'));var fs=require('fs');var fs_extra=require(_0x2009('0xb'));var _=require(_0x2009('0xc'));var squel=require(_0x2009('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2009('0xe'));var toCsv=require(_0x2009('0xf'));var querystring=require(_0x2009('0x10'));var Papa=require(_0x2009('0x11'));var Redis=require(_0x2009('0x12'));var authService=require(_0x2009('0x13'));var qs=require(_0x2009('0x14'));var as=require(_0x2009('0x15'));var hardwareService=require(_0x2009('0x16'));var logger=require(_0x2009('0x17'))('api');var utils=require(_0x2009('0x18'));var config=require(_0x2009('0x19'));var licenseUtil=require(_0x2009('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2009('0x1b')](config[_0x2009('0x1c')],{'host':_0x2009('0x1d'),'port':0x18eb});var socket=require(_0x2009('0x1e'))(new Redis(config['redis']));require(_0x2009('0x1f'))['register'](socket);function respondWithStatusCode(_0x5a1712,_0x2a357a){_0x2a357a=_0x2a357a||0xcc;return function(_0x5e44da){if(_0x5e44da){return _0x5a1712['sendStatus'](_0x2a357a);}return _0x5a1712[_0x2009('0x20')](_0x2a357a)[_0x2009('0x21')]();};}function respondWithResult(_0x4b0820,_0x4c7972){_0x4c7972=_0x4c7972||0xc8;return function(_0x58465){if(_0x58465){return _0x4b0820['status'](_0x4c7972)['json'](_0x58465);}};}function respondWithFilteredResult(_0x4e1646,_0x1d8b19){return function(_0x9967ac){if(_0x9967ac){var _0x4cd502=typeof _0x1d8b19[_0x2009('0x22')]===_0x2009('0x23')&&typeof _0x1d8b19['limit']===_0x2009('0x23');var _0x300fae=_0x9967ac[_0x2009('0x24')];var _0x2078c9=_0x4cd502?0x0:_0x1d8b19[_0x2009('0x22')];var _0x40dd22=_0x4cd502?_0x9967ac['count']:_0x1d8b19[_0x2009('0x22')]+_0x1d8b19[_0x2009('0x25')];var _0x26c18a;if(_0x40dd22>=_0x300fae){_0x40dd22=_0x300fae;_0x26c18a=0xc8;}else{_0x26c18a=0xce;}_0x4e1646[_0x2009('0x20')](_0x26c18a);return _0x4e1646[_0x2009('0x26')]('Content-Range',_0x2078c9+'-'+_0x40dd22+'/'+_0x300fae)[_0x2009('0x27')](_0x9967ac);}return null;};}function patchUpdates(_0x4dc39c){return function(_0x1737bf){try{jsonpatch[_0x2009('0x28')](_0x1737bf,_0x4dc39c,!![]);}catch(_0x413d34){return BPromise[_0x2009('0x29')](_0x413d34);}return _0x1737bf[_0x2009('0x2a')]();};}function saveUpdates(_0x43ab85,_0x4cdbf6){return function(_0x5a718a){if(_0x5a718a){return _0x5a718a['update'](_0x43ab85)[_0x2009('0x2b')](function(_0x3a8e75){return _0x3a8e75;});}return null;};}function removeEntity(_0xcdae89,_0x4a9a53){return function(_0x21c31d){if(_0x21c31d){return _0x21c31d[_0x2009('0x2c')]()['then'](function(){var _0x13425e=_0x21c31d['get']({'plain':!![]});var _0x56a841=_0x2009('0x2d');return db['UserProfileResource'][_0x2009('0x2c')]({'where':{'type':_0x56a841,'resourceId':_0x13425e['id']}})[_0x2009('0x2b')](function(){return _0x21c31d;});})[_0x2009('0x2b')](function(){_0xcdae89['status'](0xcc)[_0x2009('0x21')]();});}};}function handleEntityNotFound(_0x16d116,_0x319b1d){return function(_0x415dfb){if(!_0x415dfb){_0x16d116[_0x2009('0x2e')](0x194);}return _0x415dfb;};}function handleError(_0x15b7b2,_0x8873b8){_0x8873b8=_0x8873b8||0x1f4;return function(_0x26548c){logger[_0x2009('0x2f')](_0x26548c['stack']);if(_0x26548c[_0x2009('0x30')]){delete _0x26548c[_0x2009('0x30')];}_0x15b7b2['status'](_0x8873b8)['send'](_0x26548c);};}function getMustacheRender(_0x2e60ff,_0x20bb2b){return Mustache[_0x2009('0x31')](_0x2e60ff,_['merge'](_0x20bb2b[_0x2009('0x32')],{'contact':_0x20bb2b[_0x2009('0x33')],'message':_0x20bb2b[_0x2009('0x34')],'agent':_0x20bb2b['agent'],'interaction':_0x20bb2b[_0x2009('0x35')],'account':_0x20bb2b[_0x2009('0x36')]}))||'';}exports[_0x2009('0x37')]=function(_0x584830,_0x41d8ee){var _0x2e9720={},_0x24a835={},_0x41e894={'count':0x0,'rows':[]};var _0x138e4a=_[_0x2009('0x38')](db[_0x2009('0x39')][_0x2009('0x3a')],function(_0x1f3738){return{'name':_0x1f3738[_0x2009('0x3b')],'type':_0x1f3738['type'][_0x2009('0x3c')]};});_0x24a835[_0x2009('0x3d')]=_[_0x2009('0x38')](_0x138e4a,_0x2009('0x30'));_0x24a835[_0x2009('0x3e')]=_['keys'](_0x584830['query']);_0x24a835[_0x2009('0x3f')]=_['intersection'](_0x24a835[_0x2009('0x3d')],_0x24a835[_0x2009('0x3e')]);_0x2e9720[_0x2009('0x40')]=_['intersection'](_0x24a835[_0x2009('0x3d')],qs[_0x2009('0x41')](_0x584830[_0x2009('0x3e')][_0x2009('0x41')]));_0x2e9720['attributes']=_0x2e9720[_0x2009('0x40')][_0x2009('0x42')]?_0x2e9720[_0x2009('0x40')]:_0x24a835['model'];if(!_0x584830[_0x2009('0x3e')][_0x2009('0x43')](_0x2009('0x44'))){_0x2e9720[_0x2009('0x25')]=qs[_0x2009('0x25')](_0x584830[_0x2009('0x3e')][_0x2009('0x25')]);_0x2e9720[_0x2009('0x22')]=qs[_0x2009('0x22')](_0x584830['query'][_0x2009('0x22')]);}_0x2e9720[_0x2009('0x45')]=qs[_0x2009('0x46')](_0x584830[_0x2009('0x3e')]['sort']);_0x2e9720['where']=qs[_0x2009('0x3f')](_[_0x2009('0x47')](_0x584830[_0x2009('0x3e')],_0x24a835['filters']),_0x138e4a);if(_0x584830['query'][_0x2009('0x48')]){_0x2e9720[_0x2009('0x49')]=_['merge'](_0x2e9720[_0x2009('0x49')],{'$or':_[_0x2009('0x38')](_0x138e4a,function(_0x570a50){if(_0x570a50['type']!==_0x2009('0x4a')){var _0x238442={};_0x238442[_0x570a50[_0x2009('0x30')]]={'$like':'%'+_0x584830['query'][_0x2009('0x48')]+'%'};return _0x238442;}})});}_0x2e9720=_[_0x2009('0x4b')]({},_0x2e9720,_0x584830['options']);var _0x4291b6={'where':_0x2e9720['where']};return db[_0x2009('0x39')]['count'](_0x4291b6)[_0x2009('0x2b')](function(_0x45b21b){_0x41e894[_0x2009('0x24')]=_0x45b21b;if(_0x584830[_0x2009('0x3e')][_0x2009('0x4c')]){_0x2e9720[_0x2009('0x4d')]=[{'all':!![]}];}return db[_0x2009('0x39')]['findAll'](_0x2e9720);})[_0x2009('0x2b')](function(_0x3016ed){_0x41e894[_0x2009('0x4e')]=_0x3016ed;return _0x41e894;})[_0x2009('0x2b')](respondWithFilteredResult(_0x41d8ee,_0x2e9720))[_0x2009('0x4f')](handleError(_0x41d8ee,null));};exports[_0x2009('0x50')]=function(_0xa5472e,_0x1797c7){var _0x5f10b9={'raw':![],'where':{'id':_0xa5472e[_0x2009('0x51')]['id']}},_0x2640e5={};_0x2640e5['model']=_[_0x2009('0x52')](db[_0x2009('0x39')][_0x2009('0x3a')]);_0x2640e5[_0x2009('0x3e')]=_[_0x2009('0x52')](_0xa5472e[_0x2009('0x3e')]);_0x2640e5[_0x2009('0x3f')]=_[_0x2009('0x53')](_0x2640e5[_0x2009('0x3d')],_0x2640e5[_0x2009('0x3e')]);_0x5f10b9['attributes']=_[_0x2009('0x53')](_0x2640e5[_0x2009('0x3d')],qs[_0x2009('0x41')](_0xa5472e[_0x2009('0x3e')]['fields']));_0x5f10b9[_0x2009('0x40')]=_0x5f10b9[_0x2009('0x40')][_0x2009('0x42')]?_0x5f10b9[_0x2009('0x40')]:_0x2640e5[_0x2009('0x3d')];if(_0xa5472e[_0x2009('0x3e')][_0x2009('0x4c')]){_0x5f10b9[_0x2009('0x4d')]=[{'all':!![]}];}_0x5f10b9=_[_0x2009('0x4b')]({},_0x5f10b9,_0xa5472e[_0x2009('0x54')]);return db[_0x2009('0x39')][_0x2009('0x55')](_0x5f10b9)[_0x2009('0x2b')](handleEntityNotFound(_0x1797c7,null))[_0x2009('0x2b')](respondWithResult(_0x1797c7,null))['catch'](handleError(_0x1797c7,null));};exports[_0x2009('0x56')]=function(_0x5252f9,_0xd87015){return db[_0x2009('0x39')][_0x2009('0x56')](_0x5252f9[_0x2009('0x32')],{})[_0x2009('0x2b')](function(_0x76f83c){var _0x18db54=_0x5252f9[_0x2009('0x57')][_0x2009('0x58')]({'plain':!![]});if(!_0x18db54)throw new Error(_0x2009('0x59'));if(_0x18db54[_0x2009('0x5a')]===_0x2009('0x57')){var _0x3b459d=_0x76f83c[_0x2009('0x58')]({'plain':!![]});var _0x51e777=_0x2009('0x2d');return db[_0x2009('0x5b')][_0x2009('0x55')]({'where':{'name':_0x51e777,'userProfileId':_0x18db54[_0x2009('0x5c')]},'raw':!![]})[_0x2009('0x2b')](function(_0x3e0da0){if(_0x3e0da0&&_0x3e0da0['autoAssociation']===0x0){return db[_0x2009('0x5d')][_0x2009('0x56')]({'name':_0x3b459d[_0x2009('0x30')],'resourceId':_0x3b459d['id'],'type':_0x3e0da0[_0x2009('0x30')],'sectionId':_0x3e0da0['id']},{})[_0x2009('0x2b')](function(){return _0x76f83c;});}else{return _0x76f83c;}})[_0x2009('0x4f')](function(_0x4935da){logger[_0x2009('0x2f')](_0x2009('0x5e'),_0x4935da);throw _0x4935da;});}return _0x76f83c;})[_0x2009('0x2b')](respondWithResult(_0xd87015,0xc9))[_0x2009('0x4f')](handleError(_0xd87015,null));};exports[_0x2009('0x5f')]=function(_0x270984,_0xb53ccb){if(_0x270984[_0x2009('0x32')]['id']){delete _0x270984['body']['id'];}return db[_0x2009('0x39')]['find']({'where':{'id':_0x270984[_0x2009('0x51')]['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0xb53ccb,null))[_0x2009('0x2b')](saveUpdates(_0x270984[_0x2009('0x32')],null))['then'](respondWithResult(_0xb53ccb,null))[_0x2009('0x4f')](handleError(_0xb53ccb,null));};exports[_0x2009('0x2c')]=function(_0x558e7a,_0x1c3c41){return db[_0x2009('0x39')]['find']({'where':{'id':_0x558e7a['params']['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0x1c3c41,null))[_0x2009('0x2b')](removeEntity(_0x1c3c41,null))[_0x2009('0x4f')](handleError(_0x1c3c41,null));};exports[_0x2009('0x60')]=function(_0x72df50,_0x58c5c1){return db[_0x2009('0x39')]['describe']()['then'](respondWithResult(_0x58c5c1,null))['catch'](handleError(_0x58c5c1,null));};exports[_0x2009('0x61')]=function(_0x1d4fc3,_0xac42e9,_0x2692a0){if(_0x1d4fc3['body']['id']){delete _0x1d4fc3[_0x2009('0x32')]['id'];}return db[_0x2009('0x39')][_0x2009('0x55')]({'where':{'id':_0x1d4fc3['params']['id']}})['then'](handleEntityNotFound(_0xac42e9,null))['then'](function(_0x1c82b1){if(_0x1c82b1){_0x1d4fc3[_0x2009('0x32')][_0x2009('0x62')]=_0x1c82b1['id'];return db[_0x2009('0x63')]['create'](_0x1d4fc3[_0x2009('0x32')]);}})[_0x2009('0x2b')](respondWithResult(_0xac42e9,null))['catch'](handleError(_0xac42e9,null));};exports[_0x2009('0x64')]=function(_0x27f89f,_0x5f5de8,_0x2cd46d){var _0xccc318={'raw':![],'where':{}};var _0x474227={};var _0x4fd7af={'count':0x0,'rows':[]};return db['CmList'][_0x2009('0x65')]({'where':{'id':_0x27f89f[_0x2009('0x51')]['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0x5f5de8,null))[_0x2009('0x2b')](function(_0x9855a6){if(_0x9855a6){_0x474227[_0x2009('0x3d')]=_[_0x2009('0x52')](db[_0x2009('0x63')][_0x2009('0x3a')]);_0x474227[_0x2009('0x3e')]=_[_0x2009('0x52')](_0x27f89f[_0x2009('0x3e')]);_0x474227['filters']=_[_0x2009('0x53')](_0x474227['model'],_0x474227[_0x2009('0x3e')]);_0xccc318[_0x2009('0x40')]=_['intersection'](_0x474227[_0x2009('0x3d')],qs[_0x2009('0x41')](_0x27f89f[_0x2009('0x3e')][_0x2009('0x41')]));_0xccc318[_0x2009('0x40')]=_0xccc318['attributes'][_0x2009('0x42')]?_0xccc318[_0x2009('0x40')]:_0x474227[_0x2009('0x3d')];if(!_0x27f89f[_0x2009('0x3e')][_0x2009('0x43')](_0x2009('0x44'))){_0xccc318[_0x2009('0x25')]=qs[_0x2009('0x25')](_0x27f89f['query']['limit']);_0xccc318[_0x2009('0x22')]=qs['offset'](_0x27f89f[_0x2009('0x3e')]['offset']);}_0xccc318[_0x2009('0x45')]=qs[_0x2009('0x46')](_0x27f89f[_0x2009('0x3e')][_0x2009('0x46')]);_0xccc318[_0x2009('0x49')]=qs[_0x2009('0x3f')](_['pick'](_0x27f89f[_0x2009('0x3e')],_0x474227[_0x2009('0x3f')]));_0xccc318[_0x2009('0x49')][_0x2009('0x62')]=_0x9855a6['id'];if(_0x27f89f[_0x2009('0x3e')][_0x2009('0x48')]){_0xccc318[_0x2009('0x49')]=_[_0x2009('0x4b')](_0xccc318[_0x2009('0x49')],{'$or':_[_0x2009('0x38')](_0xccc318[_0x2009('0x40')],function(_0x158a36){var _0x34ad0d={};_0x34ad0d[_0x158a36]={'$like':'%'+_0x27f89f[_0x2009('0x3e')]['filter']+'%'};return _0x34ad0d;})});}_0xccc318=_['merge']({},_0xccc318,_0x27f89f[_0x2009('0x54')]);return db[_0x2009('0x63')][_0x2009('0x24')]({'where':_0xccc318[_0x2009('0x49')]})[_0x2009('0x2b')](function(_0x4996ac){_0x4fd7af[_0x2009('0x24')]=_0x4996ac;if(_0x27f89f[_0x2009('0x3e')][_0x2009('0x4c')]){_0xccc318[_0x2009('0x4d')]=[{'all':!![]}];}return db[_0x2009('0x63')]['findAll'](_0xccc318);})['then'](function(_0x195827){_0x4fd7af['rows']=_0x195827;return _0x4fd7af;});}})[_0x2009('0x2b')](respondWithFilteredResult(_0x5f5de8,_0xccc318))['catch'](handleError(_0x5f5de8,null));};exports[_0x2009('0x66')]=function(_0x2b6d59,_0x49242e,_0x2b89de){return db[_0x2009('0x39')][_0x2009('0x55')]({'where':{'id':_0x2b6d59[_0x2009('0x51')]['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0x49242e,null))[_0x2009('0x2b')](function(_0x3825dd){if(_0x3825dd){return _0x3825dd[_0x2009('0x66')](_0x2b6d59['query'][_0x2009('0x67')]);}})[_0x2009('0x2b')](respondWithStatusCode(_0x49242e,null))['catch'](handleError(_0x49242e,null));};exports[_0x2009('0x68')]=function(_0x3b70aa,_0x2db702,_0x353400){return db['CmList'][_0x2009('0x55')]({'where':{'id':_0x3b70aa[_0x2009('0x51')]['id']}})['then'](handleEntityNotFound(_0x2db702,null))[_0x2009('0x2b')](function(_0x1f547b){if(_0x1f547b){var _0x11b089=[];var _0x14746d={'success':[],'errors':[]};return db['CmContact'][_0x2009('0x60')]()[_0x2009('0x2b')](function(_0x5548ca){if(_0x3b70aa['body'][_0x2009('0x69')]&&_['isArray'](_0x3b70aa[_0x2009('0x32')][_0x2009('0x69')])){if(_0x3b70aa[_0x2009('0x32')][_0x2009('0x69')][_0x2009('0x42')]){_0x3b70aa[_0x2009('0x32')][_0x2009('0x69')]=_0x3b70aa[_0x2009('0x32')][_0x2009('0x69')][_0x2009('0x6a')](';')+';';}else{_0x3b70aa[_0x2009('0x32')]['tags']=null;}}else{_0x3b70aa[_0x2009('0x32')][_0x2009('0x69')]=null;}if(_0x3b70aa[_0x2009('0x32')]&&_['isArray'](_0x3b70aa['body'])){for(var _0x546bff=0x0;_0x546bff<_0x3b70aa[_0x2009('0x32')][_0x2009('0x42')];_0x546bff+=0x1){_0x3b70aa[_0x2009('0x32')][_0x546bff]['ListId']=_0x3b70aa[_0x2009('0x51')]['id'];_0x11b089['push'](_0x3b70aa['body'][_0x546bff]);}return BPromise[_0x2009('0x6b')](_0x11b089,function(_0x2c3180){return db[_0x2009('0x6c')][_0x2009('0x56')](_[_0x2009('0x6d')](_0x2c3180,[_0x2009('0x67'),'id'])||{},{'fields':_[_0x2009('0x52')](_0x5548ca),'raw':!![]})[_0x2009('0x2b')](function(_0x5b6236){_0x14746d['success'][_0x2009('0x6e')](_0x5b6236[_0x2009('0x6f')]);})[_0x2009('0x4f')](function(_0x4337a0){_0x14746d[_0x2009('0x70')][_0x2009('0x6e')]({'data':_0x2c3180,'error':_0x4337a0[_0x2009('0x34')]});});})[_0x2009('0x2b')](function(_0xc8e6ca){return _0x14746d;})[_0x2009('0x4f')](function(_0x3cc77e){return _0x3cc77e;});}else{_0x2db702[_0x2009('0x20')](0x190)[_0x2009('0x27')]({'message':_0x2009('0x71')});}});}})['then'](respondWithResult(_0x2db702,null))[_0x2009('0x4f')](handleError(_0x2db702,null));};exports['getContacts']=function(_0x3ee1bc,_0x5530df,_0x5859dc){var _0x10da90;return db[_0x2009('0x39')]['find']({'where':{'id':_0x3ee1bc['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x2009('0x72')}]})[_0x2009('0x2b')](handleEntityNotFound(_0x5530df,null))[_0x2009('0x2b')](function(_0x569cc6){if(_0x569cc6){_0x10da90=_0x569cc6;return db[_0x2009('0x6c')][_0x2009('0x3a')];}})[_0x2009('0x2b')](function(_0x4f87aa){if(_0x4f87aa){var _0x259ecb={};var _0xce7bdc={};_0xce7bdc[_0x2009('0x3d')]=_[_0x2009('0x73')](_[_0x2009('0x52')](_0x4f87aa),_[_0x2009('0x38')](_0x10da90['CustomFields'],function(_0x2e809a){return util[_0x2009('0x74')](_0x2009('0x75'),_0x2e809a['id']);}));_0xce7bdc[_0x2009('0x3e')]=_['keys'](_0x3ee1bc[_0x2009('0x3e')]);_0xce7bdc[_0x2009('0x3f')]=_[_0x2009('0x53')](_0xce7bdc[_0x2009('0x3d')],_0xce7bdc[_0x2009('0x3e')]);_0x259ecb[_0x2009('0x40')]=_[_0x2009('0x53')](_0xce7bdc[_0x2009('0x3d')],qs[_0x2009('0x41')](_0x3ee1bc[_0x2009('0x3e')][_0x2009('0x41')]));_0x259ecb[_0x2009('0x40')]=_0x259ecb[_0x2009('0x40')][_0x2009('0x42')]?_0x259ecb[_0x2009('0x40')]:_0xce7bdc[_0x2009('0x3d')];if(!_0x3ee1bc[_0x2009('0x3e')][_0x2009('0x43')]('nolimit')){_0x259ecb[_0x2009('0x25')]=qs[_0x2009('0x25')](_0x3ee1bc['query'][_0x2009('0x25')]);_0x259ecb[_0x2009('0x22')]=qs[_0x2009('0x22')](_0x3ee1bc[_0x2009('0x3e')]['offset']);}_0x259ecb[_0x2009('0x45')]=qs[_0x2009('0x46')](_0x3ee1bc[_0x2009('0x3e')][_0x2009('0x46')]);_0x259ecb[_0x2009('0x49')]=qs[_0x2009('0x3f')](_[_0x2009('0x47')](_0x3ee1bc[_0x2009('0x3e')],_0xce7bdc['filters']));_0x259ecb[_0x2009('0x76')]=!![];if(_0x3ee1bc[_0x2009('0x3e')][_0x2009('0x48')]){_0x259ecb[_0x2009('0x49')]=_[_0x2009('0x4b')](_0x259ecb[_0x2009('0x49')],{'$or':_[_0x2009('0x38')](_0x259ecb[_0x2009('0x40')],function(_0x28a7f3){var _0x3fca07={};_0x3fca07[_0x28a7f3]={'$like':'%'+_0x3ee1bc[_0x2009('0x3e')]['filter']+'%'};return _0x3fca07;})});}_0x259ecb=_['merge']({},_0x259ecb,_0x3ee1bc[_0x2009('0x54')]);return _0x10da90[_0x2009('0x77')](_0x259ecb);}})[_0x2009('0x2b')](respondWithResult(_0x5530df,null))[_0x2009('0x4f')](handleError(_0x5530df,null));};exports[_0x2009('0x78')]=function(_0x21e0ef,_0x4b0465,_0x48b0af){var _0x5221bf;return db['CmList']['find']({'where':{'id':_0x21e0ef[_0x2009('0x51')]['id']},'include':[{'model':db[_0x2009('0x79')],'as':_0x2009('0x72')}]})[_0x2009('0x2b')](handleEntityNotFound(_0x4b0465,null))[_0x2009('0x2b')](function(_0x420949){if(_0x420949){_0x5221bf=_0x420949;return db['CmContact'][_0x2009('0x3a')];}})[_0x2009('0x2b')](function(_0x3160ad){if(_0x3160ad){var _0x17672a={};var _0x457530={};_0x457530[_0x2009('0x3d')]=_[_0x2009('0x73')](_[_0x2009('0x52')](_0x3160ad),_[_0x2009('0x38')](_0x5221bf['CustomFields'],function(_0x1f72be){return util['format'](_0x2009('0x75'),_0x1f72be['id']);}));_0x457530[_0x2009('0x3e')]=_['keys'](_0x21e0ef['query']);_0x457530[_0x2009('0x3f')]=_[_0x2009('0x53')](_0x457530[_0x2009('0x3d')],_0x457530[_0x2009('0x3e')]);_0x17672a[_0x2009('0x40')]=_['intersection'](_0x457530[_0x2009('0x3d')],qs[_0x2009('0x41')](_0x21e0ef[_0x2009('0x3e')]['fields']));_0x17672a[_0x2009('0x40')]=_0x17672a[_0x2009('0x40')]['length']?_0x17672a[_0x2009('0x40')]:_0x457530[_0x2009('0x3d')];if(!_0x21e0ef['query'][_0x2009('0x43')](_0x2009('0x44'))){_0x17672a[_0x2009('0x25')]=qs[_0x2009('0x25')](_0x21e0ef[_0x2009('0x3e')]['limit']);_0x17672a[_0x2009('0x22')]=qs['offset'](_0x21e0ef[_0x2009('0x3e')]['offset']);}_0x17672a[_0x2009('0x45')]=qs[_0x2009('0x46')](_0x21e0ef[_0x2009('0x3e')][_0x2009('0x46')]);_0x17672a[_0x2009('0x49')]=qs[_0x2009('0x3f')](_[_0x2009('0x47')](_0x21e0ef['query'],_0x457530[_0x2009('0x3f')]));_0x17672a[_0x2009('0x76')]=!![];if(_0x21e0ef['query'][_0x2009('0x48')]){_0x17672a[_0x2009('0x49')]=_[_0x2009('0x4b')](_0x17672a[_0x2009('0x49')],{'$or':_[_0x2009('0x38')](_0x17672a[_0x2009('0x40')],function(_0x2f3c53){var _0x8a525f={};_0x8a525f[_0x2f3c53]={'$like':'%'+_0x21e0ef[_0x2009('0x3e')][_0x2009('0x48')]+'%'};return _0x8a525f;})});}_0x17672a=_[_0x2009('0x4b')]({},_0x17672a,_0x21e0ef[_0x2009('0x54')]);return _0x5221bf[_0x2009('0x77')](_0x17672a);}})[_0x2009('0x2b')](function(_0xe2f1da){if(!_[_0x2009('0x7a')](_0xe2f1da)){var _0x461836=toCsv(_0xe2f1da);var _0x212662=Date[_0x2009('0x7b')]();fs[_0x2009('0x7c')](util[_0x2009('0x74')](_0x2009('0x7d'),_0x5221bf['id'],_0x212662),_0x461836);_0x4b0465['setHeader']('Content-disposition',_0x2009('0x7e')+util[_0x2009('0x74')]('list_%d_%s.csv',_0x5221bf['id'],_0x212662));_0x4b0465[_0x2009('0x7f')](_0x2009('0x80'),'text/csv');return _0x4b0465[_0x2009('0x81')](util[_0x2009('0x74')](_0x2009('0x7d'),_0x5221bf['id'],_0x212662));}else{return _0x4b0465[_0x2009('0x2e')](0xcc);}})['catch'](handleError(_0x4b0465,null));};exports[_0x2009('0x82')]=function(_0x52d75b,_0x20badb,_0x5dea1){var _0x5d11c2;delete _0x52d75b['body']['id'];return db[_0x2009('0x39')]['findOne']({'where':{'id':_0x52d75b[_0x2009('0x51')]['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0x20badb,null))[_0x2009('0x2b')](function(_0x1f34aa){if(_0x1f34aa){return db[_0x2009('0x83')][_0x2009('0x84')](function(_0x2e700b){return db['CmCustomField']['create'](_0x52d75b[_0x2009('0x32')],{'transaction':_0x2e700b})[_0x2009('0x2b')](function(_0x38760d){_0x5d11c2=_0x38760d;return _0x1f34aa[_0x2009('0x85')](_0x38760d,{'transaction':_0x2e700b});})['then'](function(){var _0x458aea={'type':db[_0x2009('0x86')]['TEXT'],'transaction':_0x2e700b};switch(_0x52d75b[_0x2009('0x32')][_0x2009('0x87')]){case _0x2009('0x88'):_0x458aea[_0x2009('0x87')]=db[_0x2009('0x86')][_0x2009('0x89')];break;case _0x2009('0x8a'):_0x458aea[_0x2009('0x87')]=db[_0x2009('0x86')][_0x2009('0x8b')];break;case'switch':_0x458aea[_0x2009('0x87')]=db[_0x2009('0x86')]['BOOLEAN'];_0x458aea['defaultValue']=![];break;default:}return db[_0x2009('0x83')][_0x2009('0x8c')]['addColumn'](_0x2009('0x8d'),util['format'](_0x2009('0x8e'),_0x5d11c2['id']),_0x458aea);})['then'](function(){return _0x5d11c2;});});}})[_0x2009('0x2b')](respondWithResult(_0x20badb,null))['catch'](handleError(_0x20badb,null));};exports[_0x2009('0x8f')]=function(_0x40b666,_0x2126b9,_0x2347ac){var _0x5bc2e0={};var _0xe2147={};var _0x5f04b5;var _0x1d4ee9;return db[_0x2009('0x39')]['findOne']({'where':{'id':_0x40b666[_0x2009('0x51')]['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0x2126b9,null))['then'](function(_0x96d493){if(_0x96d493){_0x5f04b5=_0x96d493;_0xe2147[_0x2009('0x3d')]=_[_0x2009('0x52')](db[_0x2009('0x79')][_0x2009('0x3a')]);_0xe2147['query']=_['keys'](_0x40b666[_0x2009('0x3e')]);_0xe2147[_0x2009('0x3f')]=_['intersection'](_0xe2147['model'],_0xe2147[_0x2009('0x3e')]);_0x5bc2e0[_0x2009('0x40')]=_['intersection'](_0xe2147[_0x2009('0x3d')],qs['fields'](_0x40b666[_0x2009('0x3e')][_0x2009('0x41')]));_0x5bc2e0[_0x2009('0x40')]=_0x5bc2e0[_0x2009('0x40')][_0x2009('0x42')]?_0x5bc2e0['attributes']:_0xe2147[_0x2009('0x3d')];_0x5bc2e0[_0x2009('0x45')]=qs[_0x2009('0x46')](_0x40b666[_0x2009('0x3e')][_0x2009('0x46')]);_0x5bc2e0[_0x2009('0x49')]=qs[_0x2009('0x3f')](_[_0x2009('0x47')](_0x40b666[_0x2009('0x3e')],_0xe2147[_0x2009('0x3f')]));_0x5bc2e0[_0x2009('0x49')]=_[_0x2009('0x4b')](_0x5bc2e0['where'],{'$or':[{'ListId':_0x96d493['id']},{'ListId':null}]});if(_0x40b666['query']['filter']){_0x5bc2e0[_0x2009('0x49')]=_[_0x2009('0x4b')](_0x5bc2e0['where'],{'$or':_['map'](_0x5bc2e0[_0x2009('0x40')],function(_0x449597){var _0x2135d0={};_0x2135d0[_0x449597]={'$like':'%'+_0x40b666['query'][_0x2009('0x48')]+'%'};return _0x2135d0;})});}_0x5bc2e0=_['merge']({},_0x5bc2e0,_0x40b666[_0x2009('0x54')]);return db[_0x2009('0x79')]['findAndCountAll'](_0x5bc2e0);}})['then'](respondWithResult(_0x2126b9,null))[_0x2009('0x4f')](handleError(_0x2126b9,null));};exports['addAgents']=function(_0x1025ca,_0x3a0389,_0x145689){return db[_0x2009('0x39')]['find']({'where':{'id':_0x1025ca[_0x2009('0x51')]['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0x3a0389,null))[_0x2009('0x2b')](function(_0x2f0cec){if(_0x2f0cec){return _0x2f0cec[_0x2009('0x90')](_0x1025ca[_0x2009('0x32')]['ids'],_['omit'](_0x1025ca[_0x2009('0x32')],[_0x2009('0x67'),'id'])||{})[_0x2009('0x91')](function(_0x4648b9){for(var _0x418d02=0x0;_0x418d02<_0x1025ca[_0x2009('0x32')][_0x2009('0x67')]['length'];_0x418d02+=0x1){socket[_0x2009('0x92')]('userCmList:save',{'UserId':_0x1025ca[_0x2009('0x32')]['ids'][_0x418d02],'CmListId':_0x1025ca[_0x2009('0x51')]['id']});}return _0x4648b9;});}})[_0x2009('0x2b')](respondWithResult(_0x3a0389,null))[_0x2009('0x4f')](handleError(_0x3a0389,null));};exports[_0x2009('0x93')]=function(_0x4e2b32,_0x617c07,_0x268751){return db[_0x2009('0x39')][_0x2009('0x55')]({'where':{'id':_0x4e2b32[_0x2009('0x51')]['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0x617c07,null))[_0x2009('0x2b')](function(_0x11e147){if(_0x11e147){return _0x11e147[_0x2009('0x93')](_0x4e2b32[_0x2009('0x3e')][_0x2009('0x67')])['then'](function(){if(_[_0x2009('0x94')](_0x4e2b32['query']['ids'])){for(var _0x5a4a1b=0x0;_0x5a4a1b<_0x4e2b32[_0x2009('0x3e')]['ids'][_0x2009('0x42')];_0x5a4a1b+=0x1){socket['emit'](_0x2009('0x95'),{'UserId':Number(_0x4e2b32[_0x2009('0x3e')][_0x2009('0x67')][_0x5a4a1b]),'CmListId':Number(_0x4e2b32['params']['id'])});}}else{socket[_0x2009('0x92')](_0x2009('0x95'),{'UserId':Number(_0x4e2b32[_0x2009('0x3e')][_0x2009('0x67')]),'CmListId':Number(_0x4e2b32[_0x2009('0x51')]['id'])});}});}})[_0x2009('0x2b')](respondWithStatusCode(_0x617c07,null))[_0x2009('0x4f')](handleError(_0x617c07,null));};exports['getAgents']=function(_0x23fb90,_0x1b7472,_0x3bb978){var _0x403ce8={};var _0x53d0b4={};var _0x43eebd;var _0x156a63;return db[_0x2009('0x39')][_0x2009('0x65')]({'where':{'id':_0x23fb90[_0x2009('0x51')]['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0x1b7472,null))[_0x2009('0x2b')](function(_0x1f9df9){if(_0x1f9df9){_0x43eebd=_0x1f9df9;_0x53d0b4[_0x2009('0x3d')]=_[_0x2009('0x52')](db[_0x2009('0x96')][_0x2009('0x3a')]);_0x53d0b4[_0x2009('0x3e')]=_[_0x2009('0x52')](_0x23fb90[_0x2009('0x3e')]);_0x53d0b4[_0x2009('0x3f')]=_[_0x2009('0x53')](_0x53d0b4[_0x2009('0x3d')],_0x53d0b4[_0x2009('0x3e')]);_0x403ce8['attributes']=_[_0x2009('0x53')](_0x53d0b4['model'],qs['fields'](_0x23fb90[_0x2009('0x3e')][_0x2009('0x41')]));_0x403ce8[_0x2009('0x40')]=_0x403ce8[_0x2009('0x40')][_0x2009('0x42')]?_0x403ce8[_0x2009('0x40')]:_0x53d0b4['model'];_0x403ce8[_0x2009('0x45')]=qs[_0x2009('0x46')](_0x23fb90[_0x2009('0x3e')][_0x2009('0x46')]);_0x403ce8['where']=qs[_0x2009('0x3f')](_[_0x2009('0x47')](_0x23fb90['query'],_0x53d0b4['filters']));if(_0x23fb90[_0x2009('0x3e')][_0x2009('0x48')]){_0x403ce8[_0x2009('0x49')]=_[_0x2009('0x4b')](_0x403ce8[_0x2009('0x49')],{'$or':_[_0x2009('0x38')](_0x403ce8[_0x2009('0x40')],function(_0x2bb6d1){var _0x26cda4={};_0x26cda4[_0x2bb6d1]={'$like':'%'+_0x23fb90[_0x2009('0x3e')][_0x2009('0x48')]+'%'};return _0x26cda4;})});}_0x403ce8=_[_0x2009('0x4b')]({},_0x403ce8,_0x23fb90[_0x2009('0x54')]);return _0x43eebd[_0x2009('0x97')](_0x403ce8);}})['then'](function(_0x32a93e){if(_0x32a93e){_0x156a63=_0x32a93e[_0x2009('0x42')];if(!_0x23fb90['query'][_0x2009('0x43')](_0x2009('0x44'))){_0x403ce8[_0x2009('0x25')]=qs[_0x2009('0x25')](_0x23fb90[_0x2009('0x3e')][_0x2009('0x25')]);_0x403ce8[_0x2009('0x22')]=qs[_0x2009('0x22')](_0x23fb90[_0x2009('0x3e')][_0x2009('0x22')]);}return _0x43eebd['getAgents'](_0x403ce8);}})[_0x2009('0x2b')](function(_0x414fa0){if(_0x414fa0){return _0x414fa0?{'count':_0x156a63,'rows':_0x414fa0}:null;}})[_0x2009('0x2b')](respondWithResult(_0x1b7472,null))[_0x2009('0x4f')](handleError(_0x1b7472,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 1062573..a8204cb 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 _0xcf53=['CmList','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x2f18b9,_0x58b41f){var _0x217e10=function(_0x273ae1){while(--_0x273ae1){_0x2f18b9['push'](_0x2f18b9['shift']());}};_0x217e10(++_0x58b41f);}(_0xcf53,0xcb));var _0x3cf5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcf53[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var CmList=require('../../mysqldb')['db'][_0x3cf5('0x0')];var CmListEvents=new EventEmitter();CmListEvents[_0x3cf5('0x1')](0x0);var events={'afterCreate':_0x3cf5('0x2'),'afterUpdate':'update','afterDestroy':_0x3cf5('0x3')};function emitEvent(_0xfdcb85){return function(_0x210dbc,_0x4b6411,_0x3227a8){CmListEvents['emit'](_0xfdcb85+':'+_0x210dbc['id'],_0x210dbc);CmListEvents[_0x3cf5('0x4')](_0xfdcb85,_0x210dbc);_0x3227a8(null);};}for(var e in events){if(events[_0x3cf5('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x3cf5('0x6')]=CmListEvents; \ No newline at end of file +var _0x95df=['emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','remove'];(function(_0x32aea7,_0x4130ea){var _0x2a480b=function(_0x27b068){while(--_0x27b068){_0x32aea7['push'](_0x32aea7['shift']());}};_0x2a480b(++_0x4130ea);}(_0x95df,0x137));var _0xf95d=function(_0x3e8479,_0xcacd11){_0x3e8479=_0x3e8479-0x0;var _0x28e20e=_0x95df[_0x3e8479];return _0x28e20e;};'use strict';var EventEmitter=require('events');var CmList=require(_0xf95d('0x0'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf95d('0x1')](0x0);var events={'afterCreate':_0xf95d('0x2'),'afterUpdate':'update','afterDestroy':_0xf95d('0x3')};function emitEvent(_0x1b1eab){return function(_0xa8fdc7,_0x1c33b9,_0x246270){CmListEvents[_0xf95d('0x4')](_0x1b1eab+':'+_0xa8fdc7['id'],_0xa8fdc7);CmListEvents[_0xf95d('0x4')](_0x1b1eab,_0xa8fdc7);_0x246270(null);};}for(var e in events){if(events[_0xf95d('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0xf95d('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 4a3242c..067b74f 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 _0xe2c0=['path','rimraf','../../config/environment','./cmList.attributes','exports','CmList','lodash','util','../../config/logger','api','bluebird'];(function(_0x4fcb0a,_0x15ecab){var _0x11f660=function(_0x383fde){while(--_0x383fde){_0x4fcb0a['push'](_0x4fcb0a['shift']());}};_0x11f660(++_0x15ecab);}(_0xe2c0,0xcc));var _0x0e2c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe2c0[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x0e2c('0x0'));var util=require(_0x0e2c('0x1'));var logger=require(_0x0e2c('0x2'))(_0x0e2c('0x3'));var moment=require('moment');var BPromise=require(_0x0e2c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e2c('0x5'));var rimraf=require(_0x0e2c('0x6'));var config=require(_0x0e2c('0x7'));var attributes=require(_0x0e2c('0x8'));module[_0x0e2c('0x9')]=function(_0xef3865,_0x31058e){return _0xef3865['define'](_0x0e2c('0xa'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24d0=['../../config/environment','./cmList.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x24d0,0x13c));var _0x024d=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x24d0[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x024d('0x0'));var util=require('util');var logger=require(_0x024d('0x1'))(_0x024d('0x2'));var moment=require(_0x024d('0x3'));var BPromise=require(_0x024d('0x4'));var rp=require(_0x024d('0x5'));var fs=require('fs');var path=require(_0x024d('0x6'));var rimraf=require(_0x024d('0x7'));var config=require(_0x024d('0x8'));var attributes=require(_0x024d('0x9'));module[_0x024d('0xa')]=function(_0x400cf1,_0x332e2c){return _0x400cf1[_0x024d('0xb')]('CmList',attributes,{'tableName':'cm_lists','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 9a1eb21..e6fbd98 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 _0xaffe=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client'];(function(_0x1a7b2f,_0x303865){var _0x4d414f=function(_0x2ea771){while(--_0x2ea771){_0x1a7b2f['push'](_0x1a7b2f['shift']());}};_0x4d414f(++_0x303865);}(_0xaffe,0x155));var _0xeaff=function(_0x256ba5,_0x743f6d){_0x256ba5=_0x256ba5-0x0;var _0xeadb5f=_0xaffe[_0x256ba5];return _0xeadb5f;};'use strict';var _=require(_0xeaff('0x0'));var util=require(_0xeaff('0x1'));var moment=require(_0xeaff('0x2'));var BPromise=require(_0xeaff('0x3'));var rs=require(_0xeaff('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeaff('0x5'));var logger=require('../../config/logger')(_0xeaff('0x6'));var config=require('../../config/environment');var jayson=require(_0xeaff('0x7'));var client=jayson[_0xeaff('0x8')][_0xeaff('0x9')]({'port':0x232a});config[_0xeaff('0xa')]=_[_0xeaff('0xb')](config['redis'],{'host':_0xeaff('0xc'),'port':0x18eb});var socket=require(_0xeaff('0xd'))(new Redis(config['redis']));require('./cmList.socket')[_0xeaff('0xe')](socket);function respondWithRpcPromise(_0x5c8d51,_0x15581a,_0x5dc774){return new BPromise(function(_0x30ad54,_0x445ebc){return client[_0xeaff('0xf')](_0x5c8d51,_0x5dc774)[_0xeaff('0x10')](function(_0x57a8a7){logger[_0xeaff('0x11')](_0xeaff('0x12'),_0x15581a,_0xeaff('0x13'));logger['debug'](_0xeaff('0x14'),_0x15581a,_0xeaff('0x13'),JSON['stringify'](_0x57a8a7));if(_0x57a8a7[_0xeaff('0x15')]){if(_0x57a8a7[_0xeaff('0x15')][_0xeaff('0x16')]===0x1f4){logger[_0xeaff('0x15')](_0xeaff('0x12'),_0x15581a,_0x57a8a7[_0xeaff('0x15')][_0xeaff('0x17')]);return _0x445ebc(_0x57a8a7['error'][_0xeaff('0x17')]);}logger[_0xeaff('0x15')](_0xeaff('0x12'),_0x15581a,_0x57a8a7[_0xeaff('0x15')][_0xeaff('0x17')]);return _0x30ad54(_0x57a8a7[_0xeaff('0x15')]['message']);}else{logger[_0xeaff('0x11')](_0xeaff('0x12'),_0x15581a,_0xeaff('0x13'));_0x30ad54(_0x57a8a7[_0xeaff('0x18')][_0xeaff('0x17')]);}})['catch'](function(_0x11c8d4){logger[_0xeaff('0x15')](_0xeaff('0x12'),_0x15581a,_0x11c8d4);_0x445ebc(_0x11c8d4);});});} \ No newline at end of file +var _0x7cf1=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CmList,\x20%s,\x20%s','lodash','moment'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x7cf1,0xce));var _0x17cf=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7cf1[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x17cf('0x0'));var util=require('util');var moment=require(_0x17cf('0x1'));var BPromise=require('bluebird');var rs=require(_0x17cf('0x2'));var fs=require('fs');var Redis=require(_0x17cf('0x3'));var db=require(_0x17cf('0x4'))['db'];var utils=require(_0x17cf('0x5'));var logger=require('../../config/logger')(_0x17cf('0x6'));var config=require(_0x17cf('0x7'));var jayson=require(_0x17cf('0x8'));var client=jayson['client'][_0x17cf('0x9')]({'port':0x232a});config[_0x17cf('0xa')]=_[_0x17cf('0xb')](config[_0x17cf('0xa')],{'host':_0x17cf('0xc'),'port':0x18eb});var socket=require(_0x17cf('0xd'))(new Redis(config['redis']));require('./cmList.socket')[_0x17cf('0xe')](socket);function respondWithRpcPromise(_0x599e6b,_0x444f4a,_0x54e620){return new BPromise(function(_0x4fc8be,_0x12361f){return client[_0x17cf('0xf')](_0x599e6b,_0x54e620)['then'](function(_0x29878b){logger[_0x17cf('0x10')]('CmList,\x20%s,\x20%s',_0x444f4a,_0x17cf('0x11'));logger[_0x17cf('0x12')](_0x17cf('0x13'),_0x444f4a,'request\x20sent',JSON[_0x17cf('0x14')](_0x29878b));if(_0x29878b[_0x17cf('0x15')]){if(_0x29878b['error']['code']===0x1f4){logger[_0x17cf('0x15')]('CmList,\x20%s,\x20%s',_0x444f4a,_0x29878b[_0x17cf('0x15')][_0x17cf('0x16')]);return _0x12361f(_0x29878b[_0x17cf('0x15')]['message']);}logger[_0x17cf('0x15')]('CmList,\x20%s,\x20%s',_0x444f4a,_0x29878b[_0x17cf('0x15')][_0x17cf('0x16')]);return _0x4fc8be(_0x29878b[_0x17cf('0x15')][_0x17cf('0x16')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x444f4a,'request\x20sent');_0x4fc8be(_0x29878b[_0x17cf('0x17')][_0x17cf('0x16')]);}})[_0x17cf('0x18')](function(_0x2e7885){logger['error'](_0x17cf('0x19'),_0x444f4a,_0x2e7885);_0x12361f(_0x2e7885);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 2737978..09d21a0 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 _0x448a=['removeListener','register','length','save','remove','emit'];(function(_0x313532,_0x33e75f){var _0x44bc16=function(_0x31ab32){while(--_0x31ab32){_0x313532['push'](_0x313532['shift']());}};_0x44bc16(++_0x33e75f);}(_0x448a,0x1ef));var _0xa448=function(_0x5d4e57,_0x122d59){_0x5d4e57=_0x5d4e57-0x0;var _0x5b975f=_0x448a[_0x5d4e57];return _0x5b975f;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xa448('0x0'),_0xa448('0x1'),'update'];function createListener(_0x3f08b0,_0x47909c){return function(_0x5ea7f4){_0x47909c[_0xa448('0x2')](_0x3f08b0,_0x5ea7f4);};}function removeListener(_0x3206fd,_0x57e1ea){return function(){CmListEvents[_0xa448('0x3')](_0x3206fd,_0x57e1ea);};}exports[_0xa448('0x4')]=function(_0x343b79){for(var _0x2c16e3=0x0,_0x12b0e2=events[_0xa448('0x5')];_0x2c16e3<_0x12b0e2;_0x2c16e3++){var _0x1ec2d8=events[_0x2c16e3];var _0x54bdb0=createListener('cmList:'+_0x1ec2d8,_0x343b79);CmListEvents['on'](_0x1ec2d8,_0x54bdb0);}}; \ No newline at end of file +var _0x7e4b=['save','update','emit','removeListener','register','cmList:','./cmList.events'];(function(_0x23753e,_0x341e20){var _0x2d941c=function(_0x462950){while(--_0x462950){_0x23753e['push'](_0x23753e['shift']());}};_0x2d941c(++_0x341e20);}(_0x7e4b,0x84));var _0xb7e4=function(_0x4a5c33,_0x40a5a3){_0x4a5c33=_0x4a5c33-0x0;var _0x52bf41=_0x7e4b[_0x4a5c33];return _0x52bf41;};'use strict';var CmListEvents=require(_0xb7e4('0x0'));var events=[_0xb7e4('0x1'),'remove',_0xb7e4('0x2')];function createListener(_0x802d62,_0x546114){return function(_0x3d3eed){_0x546114[_0xb7e4('0x3')](_0x802d62,_0x3d3eed);};}function removeListener(_0x2fca1d,_0x32f781){return function(){CmListEvents[_0xb7e4('0x4')](_0x2fca1d,_0x32f781);};}exports[_0xb7e4('0x5')]=function(_0x39c1fd){for(var _0x2f1b05=0x0,_0x1d49a7=events['length'];_0x2f1b05<_0x1d49a7;_0x2f1b05++){var _0x334af2=events[_0x2f1b05];var _0x5e4a34=createListener(_0xb7e4('0x6')+_0x334af2,_0x39c1fd);CmListEvents['on'](_0x334af2,_0x5e4a34);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 8513cab..d8acf0c 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 _0xa8ae=['Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','post','addDisposition','addCustomField','/:id/users','addAgents','/:id','update','destroy','delete','removeDispositions','exports','multer','util','path','connect-timeout','express'];(function(_0x743b6c,_0x4dbc78){var _0x41575a=function(_0x283c63){while(--_0x283c63){_0x743b6c['push'](_0x743b6c['shift']());}};_0x41575a(++_0x4dbc78);}(_0xa8ae,0x96));var _0xea8a=function(_0x273c00,_0x55c4af){_0x273c00=_0x273c00-0x0;var _0xc628a5=_0xa8ae[_0x273c00];return _0xc628a5;};'use strict';var multer=require(_0xea8a('0x0'));var util=require(_0xea8a('0x1'));var path=require(_0xea8a('0x2'));var timeout=require(_0xea8a('0x3'));var express=require(_0xea8a('0x4'));var router=express[_0xea8a('0x5')]();var fs_extra=require(_0xea8a('0x6'));var auth=require(_0xea8a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xea8a('0x8'));var controller=require(_0xea8a('0x9'));router[_0xea8a('0xa')]('/',auth[_0xea8a('0xb')](),controller[_0xea8a('0xc')]);router[_0xea8a('0xa')]('/describe',auth[_0xea8a('0xb')](),controller['describe']);router[_0xea8a('0xa')]('/:id',auth[_0xea8a('0xb')](),controller[_0xea8a('0xd')]);router[_0xea8a('0xa')](_0xea8a('0xe'),auth[_0xea8a('0xb')](),controller[_0xea8a('0xf')]);router[_0xea8a('0xa')](_0xea8a('0x10'),auth[_0xea8a('0xb')](),controller[_0xea8a('0x11')]);router[_0xea8a('0xa')](_0xea8a('0x12'),auth[_0xea8a('0xb')](),controller['getContactsCsv']);router[_0xea8a('0xa')](_0xea8a('0x13'),auth[_0xea8a('0xb')](),controller['getCustomFields']);router[_0xea8a('0xa')]('/:id/users',auth[_0xea8a('0xb')](),controller['getAgents']);router['post']('/',auth[_0xea8a('0xb')](),controller['create']);router[_0xea8a('0x14')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xea8a('0x15')]);router[_0xea8a('0x14')](_0xea8a('0x10'),auth[_0xea8a('0xb')](),controller['addContacts']);router[_0xea8a('0x14')](_0xea8a('0x13'),auth[_0xea8a('0xb')](),controller[_0xea8a('0x16')]);router[_0xea8a('0x14')](_0xea8a('0x17'),auth[_0xea8a('0xb')](),controller[_0xea8a('0x18')]);router['put'](_0xea8a('0x19'),auth[_0xea8a('0xb')](),controller[_0xea8a('0x1a')]);router['delete'](_0xea8a('0x19'),auth[_0xea8a('0xb')](),controller[_0xea8a('0x1b')]);router[_0xea8a('0x1c')](_0xea8a('0xe'),auth[_0xea8a('0xb')](),controller[_0xea8a('0x1d')]);router[_0xea8a('0x1c')](_0xea8a('0x17'),auth[_0xea8a('0xb')](),controller['removeAgents']);module[_0xea8a('0x1e')]=router; \ No newline at end of file +var _0x7f93=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','post','create','addDisposition','addContacts','/:id/fields','addCustomField','/:id/users','addAgents','put','update','delete','removeAgents'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x7f93,0xc1));var _0x37f9=function(_0x5ae34b,_0x37f3e9){_0x5ae34b=_0x5ae34b-0x0;var _0x4f1420=_0x7f93[_0x5ae34b];return _0x4f1420;};'use strict';var multer=require('multer');var util=require(_0x37f9('0x0'));var path=require(_0x37f9('0x1'));var timeout=require(_0x37f9('0x2'));var express=require('express');var router=express[_0x37f9('0x3')]();var fs_extra=require(_0x37f9('0x4'));var auth=require(_0x37f9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x37f9('0x6'));var controller=require(_0x37f9('0x7'));router[_0x37f9('0x8')]('/',auth[_0x37f9('0x9')](),controller['index']);router[_0x37f9('0x8')](_0x37f9('0xa'),auth[_0x37f9('0x9')](),controller[_0x37f9('0xb')]);router[_0x37f9('0x8')](_0x37f9('0xc'),auth[_0x37f9('0x9')](),controller[_0x37f9('0xd')]);router['get'](_0x37f9('0xe'),auth[_0x37f9('0x9')](),controller[_0x37f9('0xf')]);router['get'](_0x37f9('0x10'),auth[_0x37f9('0x9')](),controller['getContacts']);router['get'](_0x37f9('0x11'),auth[_0x37f9('0x9')](),controller[_0x37f9('0x12')]);router['get']('/:id/fields',auth[_0x37f9('0x9')](),controller['getCustomFields']);router[_0x37f9('0x8')]('/:id/users',auth[_0x37f9('0x9')](),controller['getAgents']);router[_0x37f9('0x13')]('/',auth[_0x37f9('0x9')](),controller[_0x37f9('0x14')]);router[_0x37f9('0x13')]('/:id/dispositions',auth[_0x37f9('0x9')](),controller[_0x37f9('0x15')]);router['post']('/:id/contacts',auth[_0x37f9('0x9')](),controller[_0x37f9('0x16')]);router[_0x37f9('0x13')](_0x37f9('0x17'),auth[_0x37f9('0x9')](),controller[_0x37f9('0x18')]);router[_0x37f9('0x13')](_0x37f9('0x19'),auth[_0x37f9('0x9')](),controller[_0x37f9('0x1a')]);router[_0x37f9('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x37f9('0x1c')]);router[_0x37f9('0x1d')]('/:id',auth[_0x37f9('0x9')](),controller['destroy']);router[_0x37f9('0x1d')](_0x37f9('0xe'),auth[_0x37f9('0x9')](),controller['removeDispositions']);router[_0x37f9('0x1d')](_0x37f9('0x19'),auth[_0x37f9('0x9')](),controller[_0x37f9('0x1e')]);module[_0x37f9('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 6de9f50..b693aac 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 _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x39a68f,_0x5c93d8){var _0x15d685=function(_0x4f0e2c){while(--_0x4f0e2c){_0x39a68f['push'](_0x39a68f['shift']());}};_0x15d685(++_0x5c93d8);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x51474d,_0x41bc55){var _0x22cfe5=function(_0x1dcc0d){while(--_0x1dcc0d){_0x51474d['push'](_0x51474d['shift']());}};_0x22cfe5(++_0x41bc55);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index ee4363e..9d27c3f 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 _0xb3a9=['agent','account','params','then','catch','Condition','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','status','error','stack','send','render','body','contact'];(function(_0x317e6d,_0x2b3d5d){var _0x2f8353=function(_0x134b6d){while(--_0x134b6d){_0x317e6d['push'](_0x317e6d['shift']());}};_0x2f8353(++_0x2b3d5d);}(_0xb3a9,0xa2));var _0x9b3a=function(_0x23c111,_0x4dad2f){_0x23c111=_0x23c111-0x0;var _0x3701f0=_0xb3a9[_0x23c111];return _0x3701f0;};'use strict';var emlformat=require(_0x9b3a('0x0'));var rimraf=require(_0x9b3a('0x1'));var zipdir=require(_0x9b3a('0x2'));var jsonpatch=require(_0x9b3a('0x3'));var rp=require(_0x9b3a('0x4'));var moment=require(_0x9b3a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9b3a('0x6'));var util=require(_0x9b3a('0x7'));var path=require('path');var sox=require(_0x9b3a('0x8'));var csv=require(_0x9b3a('0x9'));var ejs=require(_0x9b3a('0xa'));var fs=require('fs');var fs_extra=require(_0x9b3a('0xb'));var _=require(_0x9b3a('0xc'));var squel=require(_0x9b3a('0xd'));var crypto=require(_0x9b3a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9b3a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9b3a('0x10'));var Papa=require(_0x9b3a('0x11'));var Redis=require('ioredis');var authService=require(_0x9b3a('0x12'));var qs=require(_0x9b3a('0x13'));var as=require(_0x9b3a('0x14'));var hardwareService=require(_0x9b3a('0x15'));var logger=require(_0x9b3a('0x16'))(_0x9b3a('0x17'));var utils=require(_0x9b3a('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9b3a('0x19'))['db'];function respondWithStatusCode(_0x39e268,_0x34274c){_0x34274c=_0x34274c||0xcc;return function(_0x31383d){if(_0x31383d){return _0x39e268[_0x9b3a('0x1a')](_0x34274c);}return _0x39e268['status'](_0x34274c)[_0x9b3a('0x1b')]();};}function respondWithResult(_0x164734,_0xc2ec8a){_0xc2ec8a=_0xc2ec8a||0xc8;return function(_0x21427c){if(_0x21427c){return _0x164734['status'](_0xc2ec8a)[_0x9b3a('0x1c')](_0x21427c);}};}function respondWithFilteredResult(_0x28d1f9,_0x46161c){return function(_0x5064df){if(_0x5064df){var _0x1b6b7e=typeof _0x46161c[_0x9b3a('0x1d')]===_0x9b3a('0x1e')&&typeof _0x46161c[_0x9b3a('0x1f')]===_0x9b3a('0x1e');var _0xf406e9=_0x5064df[_0x9b3a('0x20')];var _0x2950a2=_0x1b6b7e?0x0:_0x46161c[_0x9b3a('0x1d')];var _0xba98cd=_0x1b6b7e?_0x5064df['count']:_0x46161c[_0x9b3a('0x1d')]+_0x46161c[_0x9b3a('0x1f')];var _0x214980;if(_0xba98cd>=_0xf406e9){_0xba98cd=_0xf406e9;_0x214980=0xc8;}else{_0x214980=0xce;}_0x28d1f9['status'](_0x214980);return _0x28d1f9[_0x9b3a('0x21')](_0x9b3a('0x22'),_0x2950a2+'-'+_0xba98cd+'/'+_0xf406e9)[_0x9b3a('0x1c')](_0x5064df);}return null;};}function patchUpdates(_0x436ad0){return function(_0x26d4e0){try{jsonpatch[_0x9b3a('0x23')](_0x26d4e0,_0x436ad0,!![]);}catch(_0x43a2ff){return BPromise['reject'](_0x43a2ff);}return _0x26d4e0[_0x9b3a('0x24')]();};}function saveUpdates(_0x4cd288,_0x56a367){return function(_0x378a2c){if(_0x378a2c){return _0x378a2c[_0x9b3a('0x25')](_0x4cd288)['then'](function(_0x2fcb48){return _0x2fcb48;});}return null;};}function removeEntity(_0x573f5d,_0xa8ed22){return function(_0x900550){if(_0x900550){return _0x900550[_0x9b3a('0x26')]()['then'](function(){_0x573f5d[_0x9b3a('0x27')](0xcc)[_0x9b3a('0x1b')]();});}};}function handleEntityNotFound(_0x39cea3,_0x1014d9){return function(_0x14fc8d){if(!_0x14fc8d){_0x39cea3[_0x9b3a('0x1a')](0x194);}return _0x14fc8d;};}function handleError(_0x357dfe,_0x182372){_0x182372=_0x182372||0x1f4;return function(_0xb472){logger[_0x9b3a('0x28')](_0xb472[_0x9b3a('0x29')]);if(_0xb472['name']){delete _0xb472['name'];}_0x357dfe[_0x9b3a('0x27')](_0x182372)[_0x9b3a('0x2a')](_0xb472);};}function getMustacheRender(_0x59bf1b,_0x587a1a){return Mustache[_0x9b3a('0x2b')](_0x59bf1b,_['merge'](_0x587a1a[_0x9b3a('0x2c')],{'contact':_0x587a1a[_0x9b3a('0x2d')],'message':_0x587a1a['message'],'agent':_0x587a1a[_0x9b3a('0x2e')],'interaction':_0x587a1a['interaction'],'account':_0x587a1a[_0x9b3a('0x2f')]}))||'';}exports[_0x9b3a('0x25')]=function(_0x16dc2a,_0x11165b){if(_0x16dc2a[_0x9b3a('0x2c')]['id']){delete _0x16dc2a[_0x9b3a('0x2c')]['id'];}return db['Condition']['find']({'where':{'id':_0x16dc2a[_0x9b3a('0x30')]['id']}})[_0x9b3a('0x31')](handleEntityNotFound(_0x11165b,null))[_0x9b3a('0x31')](saveUpdates(_0x16dc2a[_0x9b3a('0x2c')],null))[_0x9b3a('0x31')](respondWithResult(_0x11165b,null))[_0x9b3a('0x32')](handleError(_0x11165b,null));};exports['destroy']=function(_0x5bb09f,_0x57d1cc){return db[_0x9b3a('0x33')]['find']({'where':{'id':_0x5bb09f[_0x9b3a('0x30')]['id']}})[_0x9b3a('0x31')](handleEntityNotFound(_0x57d1cc,null))[_0x9b3a('0x31')](removeEntity(_0x57d1cc,null))[_0x9b3a('0x32')](handleError(_0x57d1cc,null));}; \ No newline at end of file +var _0x8ff9=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','end','error','stack','name','send','merge','body','contact','message','agent','interaction','account','update','Condition','find','params','then','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0x8ff9,0x1a6));var _0x98ff=function(_0x686b46,_0x1a497f){_0x686b46=_0x686b46-0x0;var _0x53f174=_0x8ff9[_0x686b46];return _0x53f174;};'use strict';var emlformat=require(_0x98ff('0x0'));var rimraf=require(_0x98ff('0x1'));var zipdir=require(_0x98ff('0x2'));var jsonpatch=require(_0x98ff('0x3'));var rp=require(_0x98ff('0x4'));var moment=require(_0x98ff('0x5'));var BPromise=require(_0x98ff('0x6'));var Mustache=require(_0x98ff('0x7'));var util=require(_0x98ff('0x8'));var path=require(_0x98ff('0x9'));var sox=require(_0x98ff('0xa'));var csv=require('to-csv');var ejs=require(_0x98ff('0xb'));var fs=require('fs');var fs_extra=require(_0x98ff('0xc'));var _=require(_0x98ff('0xd'));var squel=require(_0x98ff('0xe'));var crypto=require(_0x98ff('0xf'));var jsforce=require(_0x98ff('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x98ff('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x98ff('0x12'));var authService=require(_0x98ff('0x13'));var qs=require(_0x98ff('0x14'));var as=require(_0x98ff('0x15'));var hardwareService=require(_0x98ff('0x16'));var logger=require('../../config/logger')(_0x98ff('0x17'));var utils=require('../../config/utils');var config=require(_0x98ff('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc547f8,_0x1529cf){_0x1529cf=_0x1529cf||0xcc;return function(_0x24a64e){if(_0x24a64e){return _0xc547f8['sendStatus'](_0x1529cf);}return _0xc547f8[_0x98ff('0x19')](_0x1529cf)['end']();};}function respondWithResult(_0x7af35,_0x373e14){_0x373e14=_0x373e14||0xc8;return function(_0x2c4e4d){if(_0x2c4e4d){return _0x7af35[_0x98ff('0x19')](_0x373e14)[_0x98ff('0x1a')](_0x2c4e4d);}};}function respondWithFilteredResult(_0x2ebc89,_0x4c319c){return function(_0x3573a4){if(_0x3573a4){var _0x196f27=typeof _0x4c319c[_0x98ff('0x1b')]===_0x98ff('0x1c')&&typeof _0x4c319c[_0x98ff('0x1d')]===_0x98ff('0x1c');var _0x1f3044=_0x3573a4[_0x98ff('0x1e')];var _0x268121=_0x196f27?0x0:_0x4c319c[_0x98ff('0x1b')];var _0x91e31c=_0x196f27?_0x3573a4[_0x98ff('0x1e')]:_0x4c319c[_0x98ff('0x1b')]+_0x4c319c[_0x98ff('0x1d')];var _0x4c235b;if(_0x91e31c>=_0x1f3044){_0x91e31c=_0x1f3044;_0x4c235b=0xc8;}else{_0x4c235b=0xce;}_0x2ebc89[_0x98ff('0x19')](_0x4c235b);return _0x2ebc89[_0x98ff('0x1f')](_0x98ff('0x20'),_0x268121+'-'+_0x91e31c+'/'+_0x1f3044)[_0x98ff('0x1a')](_0x3573a4);}return null;};}function patchUpdates(_0x41b840){return function(_0x26e589){try{jsonpatch[_0x98ff('0x21')](_0x26e589,_0x41b840,!![]);}catch(_0x3a6c52){return BPromise[_0x98ff('0x22')](_0x3a6c52);}return _0x26e589[_0x98ff('0x23')]();};}function saveUpdates(_0xf0f062,_0x2b21be){return function(_0x2fdbc2){if(_0x2fdbc2){return _0x2fdbc2['update'](_0xf0f062)['then'](function(_0x4c6ddc){return _0x4c6ddc;});}return null;};}function removeEntity(_0x27a070,_0x3ee01b){return function(_0x547fab){if(_0x547fab){return _0x547fab[_0x98ff('0x24')]()['then'](function(){_0x27a070[_0x98ff('0x19')](0xcc)[_0x98ff('0x25')]();});}};}function handleEntityNotFound(_0x308efd,_0x2b3ee9){return function(_0x4003de){if(!_0x4003de){_0x308efd['sendStatus'](0x194);}return _0x4003de;};}function handleError(_0x577ca7,_0xf53ff7){_0xf53ff7=_0xf53ff7||0x1f4;return function(_0x1a4ebd){logger[_0x98ff('0x26')](_0x1a4ebd[_0x98ff('0x27')]);if(_0x1a4ebd[_0x98ff('0x28')]){delete _0x1a4ebd[_0x98ff('0x28')];}_0x577ca7[_0x98ff('0x19')](_0xf53ff7)[_0x98ff('0x29')](_0x1a4ebd);};}function getMustacheRender(_0xda7649,_0x25a658){return Mustache['render'](_0xda7649,_[_0x98ff('0x2a')](_0x25a658[_0x98ff('0x2b')],{'contact':_0x25a658[_0x98ff('0x2c')],'message':_0x25a658[_0x98ff('0x2d')],'agent':_0x25a658[_0x98ff('0x2e')],'interaction':_0x25a658[_0x98ff('0x2f')],'account':_0x25a658[_0x98ff('0x30')]}))||'';}exports[_0x98ff('0x31')]=function(_0x42213a,_0x205d85){if(_0x42213a[_0x98ff('0x2b')]['id']){delete _0x42213a[_0x98ff('0x2b')]['id'];}return db[_0x98ff('0x32')][_0x98ff('0x33')]({'where':{'id':_0x42213a[_0x98ff('0x34')]['id']}})[_0x98ff('0x35')](handleEntityNotFound(_0x205d85,null))[_0x98ff('0x35')](saveUpdates(_0x42213a[_0x98ff('0x2b')],null))[_0x98ff('0x35')](respondWithResult(_0x205d85,null))[_0x98ff('0x36')](handleError(_0x205d85,null));};exports[_0x98ff('0x24')]=function(_0x492652,_0x364371){return db[_0x98ff('0x32')][_0x98ff('0x33')]({'where':{'id':_0x492652[_0x98ff('0x34')]['id']}})[_0x98ff('0x35')](handleEntityNotFound(_0x364371,null))['then'](removeEntity(_0x364371,null))[_0x98ff('0x36')](handleError(_0x364371,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 14c611a..326b7d0 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 _0xad0b=['rimraf','../../config/environment','./condition.attributes','exports','define','tools_conditions','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x191921,_0x41f732){var _0x334751=function(_0x568bd4){while(--_0x568bd4){_0x191921['push'](_0x191921['shift']());}};_0x334751(++_0x41f732);}(_0xad0b,0x124));var _0xbad0=function(_0x2a0642,_0x15db5d){_0x2a0642=_0x2a0642-0x0;var _0x22c96e=_0xad0b[_0x2a0642];return _0x22c96e;};'use strict';var _=require(_0xbad0('0x0'));var util=require('util');var logger=require(_0xbad0('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbad0('0x2'));var rp=require(_0xbad0('0x3'));var fs=require('fs');var path=require(_0xbad0('0x4'));var rimraf=require(_0xbad0('0x5'));var config=require(_0xbad0('0x6'));var attributes=require(_0xbad0('0x7'));module[_0xbad0('0x8')]=function(_0x32a47f,_0x4302cf){return _0x32a47f[_0xbad0('0x9')]('Condition',attributes,{'tableName':_0xbad0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0a2=['Condition','lodash','util','../../config/logger','api','moment','path','./condition.attributes','define'];(function(_0x50aa4b,_0x77f234){var _0x20fbd9=function(_0x52c967){while(--_0x52c967){_0x50aa4b['push'](_0x50aa4b['shift']());}};_0x20fbd9(++_0x77f234);}(_0xd0a2,0x160));var _0x2d0a=function(_0x4d3835,_0x4f5f50){_0x4d3835=_0x4d3835-0x0;var _0x823439=_0xd0a2[_0x4d3835];return _0x823439;};'use strict';var _=require(_0x2d0a('0x0'));var util=require(_0x2d0a('0x1'));var logger=require(_0x2d0a('0x2'))(_0x2d0a('0x3'));var moment=require(_0x2d0a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d0a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2d0a('0x6'));module['exports']=function(_0x1e5dd9,_0x12b8fa){return _0x1e5dd9[_0x2d0a('0x7')](_0x2d0a('0x8'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 10c001a..12b89a5 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 _0x71ee=['debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x3eca70,_0x491b92){var _0x242de7=function(_0x101925){while(--_0x101925){_0x3eca70['push'](_0x3eca70['shift']());}};_0x242de7(++_0x491b92);}(_0x71ee,0xa2));var _0xe71e=function(_0x515a41,_0x4c631c){_0x515a41=_0x515a41-0x0;var _0x5a435b=_0x71ee[_0x515a41];return _0x5a435b;};'use strict';var _=require(_0xe71e('0x0'));var util=require('util');var moment=require(_0xe71e('0x1'));var BPromise=require(_0xe71e('0x2'));var rs=require(_0xe71e('0x3'));var fs=require('fs');var Redis=require(_0xe71e('0x4'));var db=require(_0xe71e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe71e('0x6'))(_0xe71e('0x7'));var config=require(_0xe71e('0x8'));var jayson=require(_0xe71e('0x9'));var client=jayson['client'][_0xe71e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19932e,_0x23a24c,_0x277794){return new BPromise(function(_0x2e3c87,_0x55f144){return client['request'](_0x19932e,_0x277794)[_0xe71e('0xb')](function(_0x2bf6dc){logger['info'](_0xe71e('0xc'),_0x23a24c,_0xe71e('0xd'));logger[_0xe71e('0xe')](_0xe71e('0xf'),_0x23a24c,_0xe71e('0xd'),JSON[_0xe71e('0x10')](_0x2bf6dc));if(_0x2bf6dc[_0xe71e('0x11')]){if(_0x2bf6dc[_0xe71e('0x11')][_0xe71e('0x12')]===0x1f4){logger[_0xe71e('0x11')](_0xe71e('0xc'),_0x23a24c,_0x2bf6dc['error'][_0xe71e('0x13')]);return _0x55f144(_0x2bf6dc[_0xe71e('0x11')][_0xe71e('0x13')]);}logger[_0xe71e('0x11')](_0xe71e('0xc'),_0x23a24c,_0x2bf6dc[_0xe71e('0x11')][_0xe71e('0x13')]);return _0x2e3c87(_0x2bf6dc[_0xe71e('0x11')][_0xe71e('0x13')]);}else{logger[_0xe71e('0x14')](_0xe71e('0xc'),_0x23a24c,_0xe71e('0xd'));_0x2e3c87(_0x2bf6dc['result'][_0xe71e('0x13')]);}})[_0xe71e('0x15')](function(_0x5d3159){logger[_0xe71e('0x11')](_0xe71e('0xc'),_0x23a24c,_0x5d3159);_0x55f144(_0x5d3159);});});} \ No newline at end of file +var _0x4978=['info','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x46e523,_0xe6fccb){var _0x5da0ee=function(_0x396682){while(--_0x396682){_0x46e523['push'](_0x46e523['shift']());}};_0x5da0ee(++_0xe6fccb);}(_0x4978,0x13e));var _0x8497=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x4978[_0x5037ab];return _0x512adb;};'use strict';var _=require('lodash');var util=require(_0x8497('0x0'));var moment=require(_0x8497('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8497('0x2'))['db'];var utils=require(_0x8497('0x3'));var logger=require(_0x8497('0x4'))(_0x8497('0x5'));var config=require(_0x8497('0x6'));var jayson=require(_0x8497('0x7'));var client=jayson[_0x8497('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3357ec,_0x456093,_0x2f090d){return new BPromise(function(_0x4d894f,_0x66effe){return client[_0x8497('0x9')](_0x3357ec,_0x2f090d)[_0x8497('0xa')](function(_0xe2a0d8){logger['info'](_0x8497('0xb'),_0x456093,_0x8497('0xc'));logger[_0x8497('0xd')](_0x8497('0xe'),_0x456093,_0x8497('0xc'),JSON['stringify'](_0xe2a0d8));if(_0xe2a0d8[_0x8497('0xf')]){if(_0xe2a0d8['error'][_0x8497('0x10')]===0x1f4){logger[_0x8497('0xf')]('Condition,\x20%s,\x20%s',_0x456093,_0xe2a0d8[_0x8497('0xf')][_0x8497('0x11')]);return _0x66effe(_0xe2a0d8['error'][_0x8497('0x11')]);}logger[_0x8497('0xf')](_0x8497('0xb'),_0x456093,_0xe2a0d8[_0x8497('0xf')][_0x8497('0x11')]);return _0x4d894f(_0xe2a0d8['error']['message']);}else{logger[_0x8497('0x12')](_0x8497('0xb'),_0x456093,_0x8497('0xc'));_0x4d894f(_0xe2a0d8[_0x8497('0x13')][_0x8497('0x11')]);}})[_0x8497('0x14')](function(_0x26869c){logger[_0x8497('0xf')](_0x8497('0xb'),_0x456093,_0x26869c);_0x66effe(_0x26869c);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 1136861..efc0ee9 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 _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','delete','/:id','destroy','multer','util','path','express'];(function(_0x2add5d,_0xcd787e){var _0x6c9048=function(_0x42c6dc){while(--_0x42c6dc){_0x2add5d['push'](_0x2add5d['shift']());}};_0x6c9048(++_0xcd787e);}(_0x7a54,0x106));var _0x47a5=function(_0x1a2398,_0x104501){_0x1a2398=_0x1a2398-0x0;var _0x232a36=_0x7a54[_0x1a2398];return _0x232a36;};'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')]('/:id',auth[_0x47a5('0xa')](),controller['update']);router[_0x47a5('0xb')](_0x47a5('0xc'),auth['isAuthenticated'](),controller[_0x47a5('0xd')]);module['exports']=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')](_0x7995('0xa'),auth[_0x7995('0xb')](),controller[_0x7995('0xc')]);router[_0x7995('0xd')]('/:id',auth[_0x7995('0xb')](),controller[_0x7995('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index fa792a9..e85df6c 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5c7=['STRING','name','INTEGER','exports'];(function(_0x3939d8,_0x24610a){var _0x360563=function(_0x415433){while(--_0x415433){_0x3939d8['push'](_0x3939d8['shift']());}};_0x360563(++_0x24610a);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x2ecb67,_0x108820){_0x2ecb67=_0x2ecb67-0x0;var _0x57148b=_0xc5c7[_0x2ecb67];return _0x57148b;};'use strict';var Sequelize=require('sequelize');module[_0x7c5c('0x0')]={'name':{'type':Sequelize[_0x7c5c('0x1')],'allowNull':![],'unique':_0x7c5c('0x2')},'OrderBy':{'type':Sequelize[_0x7c5c('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x7c5c('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x6c32=['sequelize','exports','STRING','name','INTEGER'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x6c32,0x6e));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x26c3('0x0'));module[_0x26c3('0x1')]={'name':{'type':Sequelize[_0x26c3('0x2')],'allowNull':![],'unique':_0x26c3('0x3')},'OrderBy':{'type':Sequelize[_0x26c3('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x26c3('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index e895759..35a5caf 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29e8=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','length','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','reject','then','destroy','get','UserProfileResource','error','stack','name','render','merge','body','agent','interaction','account','index','map','ContactItemType','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter'];(function(_0x494419,_0x587f4){var _0x17fb99=function(_0x116235){while(--_0x116235){_0x494419['push'](_0x494419['shift']());}};_0x17fb99(++_0x587f4);}(_0x29e8,0x15d));var _0x829e=function(_0x2fdaa4,_0x56f2e9){_0x2fdaa4=_0x2fdaa4-0x0;var _0x103849=_0x29e8[_0x2fdaa4];return _0x103849;};'use strict';var emlformat=require(_0x829e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x829e('0x1'));var jsonpatch=require(_0x829e('0x2'));var rp=require(_0x829e('0x3'));var moment=require(_0x829e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x829e('0x5'));var path=require(_0x829e('0x6'));var sox=require('sox');var csv=require(_0x829e('0x7'));var ejs=require(_0x829e('0x8'));var fs=require('fs');var fs_extra=require(_0x829e('0x9'));var _=require(_0x829e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x829e('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x829e('0xc'));var Redis=require(_0x829e('0xd'));var authService=require(_0x829e('0xe'));var qs=require(_0x829e('0xf'));var as=require(_0x829e('0x10'));var hardwareService=require(_0x829e('0x11'));var logger=require(_0x829e('0x12'))(_0x829e('0x13'));var utils=require(_0x829e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x829e('0x15'));var db=require(_0x829e('0x16'))['db'];function respondWithStatusCode(_0x1b0e21,_0x48471a){_0x48471a=_0x48471a||0xcc;return function(_0x2aa0e8){if(_0x2aa0e8){return _0x1b0e21[_0x829e('0x17')](_0x48471a);}return _0x1b0e21[_0x829e('0x18')](_0x48471a)[_0x829e('0x19')]();};}function respondWithResult(_0x53b8f6,_0x6b3003){_0x6b3003=_0x6b3003||0xc8;return function(_0x459dd7){if(_0x459dd7){return _0x53b8f6[_0x829e('0x18')](_0x6b3003)['json'](_0x459dd7);}};}function respondWithFilteredResult(_0x4c67dd,_0xb74ea4){return function(_0xbe7851){if(_0xbe7851){var _0x49df7d=typeof _0xb74ea4['offset']===_0x829e('0x1a')&&typeof _0xb74ea4[_0x829e('0x1b')]===_0x829e('0x1a');var _0x26c93c=_0xbe7851['count'];var _0xb44374=_0x49df7d?0x0:_0xb74ea4[_0x829e('0x1c')];var _0x3f2e45=_0x49df7d?_0xbe7851[_0x829e('0x1d')]:_0xb74ea4[_0x829e('0x1c')]+_0xb74ea4[_0x829e('0x1b')];var _0x3c0599;if(_0x3f2e45>=_0x26c93c){_0x3f2e45=_0x26c93c;_0x3c0599=0xc8;}else{_0x3c0599=0xce;}_0x4c67dd['status'](_0x3c0599);return _0x4c67dd['set']('Content-Range',_0xb44374+'-'+_0x3f2e45+'/'+_0x26c93c)['json'](_0xbe7851);}return null;};}function patchUpdates(_0x554d7e){return function(_0x5a6128){try{jsonpatch['apply'](_0x5a6128,_0x554d7e,!![]);}catch(_0x4ef685){return BPromise[_0x829e('0x1e')](_0x4ef685);}return _0x5a6128['save']();};}function saveUpdates(_0x455a0f,_0x275441){return function(_0x144e54){if(_0x144e54){return _0x144e54['update'](_0x455a0f)[_0x829e('0x1f')](function(_0x16cc73){return _0x16cc73;});}return null;};}function removeEntity(_0x4e3bbd,_0x34926f){return function(_0x594f94){if(_0x594f94){return _0x594f94[_0x829e('0x20')]()[_0x829e('0x1f')](function(){var _0x265ce3=_0x594f94[_0x829e('0x21')]({'plain':!![]});var _0x201d9f='ContactItemTypes';return db[_0x829e('0x22')]['destroy']({'where':{'type':_0x201d9f,'resourceId':_0x265ce3['id']}})['then'](function(){return _0x594f94;});})[_0x829e('0x1f')](function(){_0x4e3bbd[_0x829e('0x18')](0xcc)[_0x829e('0x19')]();});}};}function handleEntityNotFound(_0x41fdb5,_0x1b5cff){return function(_0x1d4936){if(!_0x1d4936){_0x41fdb5[_0x829e('0x17')](0x194);}return _0x1d4936;};}function handleError(_0x439b47,_0x5c4671){_0x5c4671=_0x5c4671||0x1f4;return function(_0x341f4d){logger[_0x829e('0x23')](_0x341f4d[_0x829e('0x24')]);if(_0x341f4d[_0x829e('0x25')]){delete _0x341f4d[_0x829e('0x25')];}_0x439b47[_0x829e('0x18')](_0x5c4671)['send'](_0x341f4d);};}function getMustacheRender(_0x20c26f,_0x20fa77){return Mustache[_0x829e('0x26')](_0x20c26f,_[_0x829e('0x27')](_0x20fa77[_0x829e('0x28')],{'contact':_0x20fa77['contact'],'message':_0x20fa77['message'],'agent':_0x20fa77[_0x829e('0x29')],'interaction':_0x20fa77[_0x829e('0x2a')],'account':_0x20fa77[_0x829e('0x2b')]}))||'';}exports[_0x829e('0x2c')]=function(_0x14d76e,_0x15c696){var _0x45a302={},_0x582b62={},_0x354c71={'count':0x0,'rows':[]};var _0x4c4cda=_[_0x829e('0x2d')](db[_0x829e('0x2e')][_0x829e('0x2f')],function(_0x28ec40){return{'name':_0x28ec40[_0x829e('0x30')],'type':_0x28ec40[_0x829e('0x31')]['key']};});_0x582b62[_0x829e('0x32')]=_[_0x829e('0x2d')](_0x4c4cda,_0x829e('0x25'));_0x582b62[_0x829e('0x33')]=_['keys'](_0x14d76e[_0x829e('0x33')]);_0x582b62[_0x829e('0x34')]=_[_0x829e('0x35')](_0x582b62[_0x829e('0x32')],_0x582b62[_0x829e('0x33')]);_0x45a302[_0x829e('0x36')]=_[_0x829e('0x35')](_0x582b62[_0x829e('0x32')],qs['fields'](_0x14d76e[_0x829e('0x33')][_0x829e('0x37')]));_0x45a302[_0x829e('0x36')]=_0x45a302['attributes']['length']?_0x45a302['attributes']:_0x582b62[_0x829e('0x32')];if(!_0x14d76e[_0x829e('0x33')][_0x829e('0x38')](_0x829e('0x39'))){_0x45a302[_0x829e('0x1b')]=qs[_0x829e('0x1b')](_0x14d76e['query']['limit']);_0x45a302['offset']=qs[_0x829e('0x1c')](_0x14d76e[_0x829e('0x33')]['offset']);}_0x45a302['order']=qs[_0x829e('0x3a')](_0x14d76e[_0x829e('0x33')][_0x829e('0x3a')]);_0x45a302[_0x829e('0x3b')]=qs[_0x829e('0x34')](_['pick'](_0x14d76e['query'],_0x582b62[_0x829e('0x34')]),_0x4c4cda);if(_0x14d76e['query'][_0x829e('0x3c')]){_0x45a302[_0x829e('0x3b')]=_['merge'](_0x45a302[_0x829e('0x3b')],{'$or':_[_0x829e('0x2d')](_0x4c4cda,function(_0x4b27b2){if(_0x4b27b2[_0x829e('0x31')]!==_0x829e('0x3d')){var _0x2d8781={};_0x2d8781[_0x4b27b2[_0x829e('0x25')]]={'$like':'%'+_0x14d76e[_0x829e('0x33')]['filter']+'%'};return _0x2d8781;}})});}_0x45a302=_[_0x829e('0x27')]({},_0x45a302,_0x14d76e[_0x829e('0x3e')]);var _0x468c93={'where':_0x45a302['where']};return db['ContactItemType'][_0x829e('0x1d')](_0x468c93)[_0x829e('0x1f')](function(_0x3f3b2c){_0x354c71['count']=_0x3f3b2c;if(_0x14d76e[_0x829e('0x33')][_0x829e('0x3f')]){_0x45a302[_0x829e('0x40')]=[{'all':!![]}];}return db[_0x829e('0x2e')][_0x829e('0x41')](_0x45a302);})['then'](function(_0x15dafa){_0x354c71[_0x829e('0x42')]=_0x15dafa;return _0x354c71;})[_0x829e('0x1f')](respondWithFilteredResult(_0x15c696,_0x45a302))[_0x829e('0x43')](handleError(_0x15c696,null));};exports[_0x829e('0x44')]=function(_0x21c8e3,_0x3a0ae8){var _0x553eac={'raw':!![],'where':{'id':_0x21c8e3['params']['id']}},_0xa04df4={};_0xa04df4['model']=_[_0x829e('0x45')](db[_0x829e('0x2e')][_0x829e('0x2f')]);_0xa04df4[_0x829e('0x33')]=_[_0x829e('0x45')](_0x21c8e3[_0x829e('0x33')]);_0xa04df4[_0x829e('0x34')]=_[_0x829e('0x35')](_0xa04df4[_0x829e('0x32')],_0xa04df4['query']);_0x553eac[_0x829e('0x36')]=_[_0x829e('0x35')](_0xa04df4['model'],qs['fields'](_0x21c8e3[_0x829e('0x33')][_0x829e('0x37')]));_0x553eac['attributes']=_0x553eac[_0x829e('0x36')][_0x829e('0x46')]?_0x553eac[_0x829e('0x36')]:_0xa04df4['model'];if(_0x21c8e3[_0x829e('0x33')]['includeAll']){_0x553eac[_0x829e('0x40')]=[{'all':!![]}];}_0x553eac=_[_0x829e('0x27')]({},_0x553eac,_0x21c8e3['options']);return db[_0x829e('0x2e')]['find'](_0x553eac)['then'](handleEntityNotFound(_0x3a0ae8,null))[_0x829e('0x1f')](respondWithResult(_0x3a0ae8,null))['catch'](handleError(_0x3a0ae8,null));};exports['create']=function(_0x22cfd1,_0x24d68d){return db['ContactItemType']['create'](_0x22cfd1[_0x829e('0x28')],{})[_0x829e('0x1f')](function(_0x4567a9){var _0x7559a1=_0x22cfd1[_0x829e('0x47')]['get']({'plain':!![]});if(!_0x7559a1)throw new Error(_0x829e('0x48'));if(_0x7559a1[_0x829e('0x49')]==='user'){var _0x55de67=_0x4567a9['get']({'plain':!![]});var _0x1e493f=_0x829e('0x4a');return db[_0x829e('0x4b')]['find']({'where':{'name':_0x1e493f,'userProfileId':_0x7559a1[_0x829e('0x4c')]},'raw':!![]})['then'](function(_0x3c2440){if(_0x3c2440&&_0x3c2440[_0x829e('0x4d')]===0x0){return db['UserProfileResource'][_0x829e('0x4e')]({'name':_0x55de67[_0x829e('0x25')],'resourceId':_0x55de67['id'],'type':_0x3c2440[_0x829e('0x25')],'sectionId':_0x3c2440['id']},{})[_0x829e('0x1f')](function(){return _0x4567a9;});}else{return _0x4567a9;}})[_0x829e('0x43')](function(_0x4bcfd1){logger['error'](_0x829e('0x4f'),_0x4bcfd1);throw _0x4bcfd1;});}return _0x4567a9;})[_0x829e('0x1f')](respondWithResult(_0x24d68d,0xc9))[_0x829e('0x43')](handleError(_0x24d68d,null));};exports['update']=function(_0x1f99a6,_0x161192){if(_0x1f99a6[_0x829e('0x28')]['id']){delete _0x1f99a6[_0x829e('0x28')]['id'];}return db[_0x829e('0x2e')][_0x829e('0x50')]({'where':{'id':_0x1f99a6[_0x829e('0x51')]['id']}})[_0x829e('0x1f')](handleEntityNotFound(_0x161192,null))[_0x829e('0x1f')](saveUpdates(_0x1f99a6[_0x829e('0x28')],null))['then'](respondWithResult(_0x161192,null))['catch'](handleError(_0x161192,null));};exports['destroy']=function(_0x3b5bc4,_0x4bdaf1){return db[_0x829e('0x2e')][_0x829e('0x50')]({'where':{'id':_0x3b5bc4[_0x829e('0x51')]['id']}})[_0x829e('0x1f')](handleEntityNotFound(_0x4bdaf1,null))['then'](removeEntity(_0x4bdaf1,null))['catch'](handleError(_0x4bdaf1,null));}; \ No newline at end of file +var _0x70b8=['limit','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','error','stack','name','send','render','merge','body','contact','message','agent','account','index','map','ContactItemType','rawAttributes','key','filters','intersection','model','query','attributes','fields','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','user','role','ContactItemTypes','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70b8,0xf4));var _0x870b=function(_0x699d31,_0x513869){_0x699d31=_0x699d31-0x0;var _0x3365eb=_0x70b8[_0x699d31];return _0x3365eb;};'use strict';var emlformat=require(_0x870b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x870b('0x1'));var jsonpatch=require(_0x870b('0x2'));var rp=require(_0x870b('0x3'));var moment=require(_0x870b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x870b('0x5'));var util=require(_0x870b('0x6'));var path=require(_0x870b('0x7'));var sox=require(_0x870b('0x8'));var csv=require('to-csv');var ejs=require(_0x870b('0x9'));var fs=require('fs');var fs_extra=require(_0x870b('0xa'));var _=require('lodash');var squel=require(_0x870b('0xb'));var crypto=require(_0x870b('0xc'));var jsforce=require(_0x870b('0xd'));var deskjs=require(_0x870b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x870b('0xf'));var Papa=require(_0x870b('0x10'));var Redis=require(_0x870b('0x11'));var authService=require(_0x870b('0x12'));var qs=require(_0x870b('0x13'));var as=require(_0x870b('0x14'));var hardwareService=require(_0x870b('0x15'));var logger=require(_0x870b('0x16'))(_0x870b('0x17'));var utils=require(_0x870b('0x18'));var config=require(_0x870b('0x19'));var licenseUtil=require(_0x870b('0x1a'));var db=require(_0x870b('0x1b'))['db'];function respondWithStatusCode(_0x173828,_0x2c0908){_0x2c0908=_0x2c0908||0xcc;return function(_0x4fb015){if(_0x4fb015){return _0x173828[_0x870b('0x1c')](_0x2c0908);}return _0x173828[_0x870b('0x1d')](_0x2c0908)[_0x870b('0x1e')]();};}function respondWithResult(_0x2ea5ad,_0x33e84b){_0x33e84b=_0x33e84b||0xc8;return function(_0x395aeb){if(_0x395aeb){return _0x2ea5ad[_0x870b('0x1d')](_0x33e84b)[_0x870b('0x1f')](_0x395aeb);}};}function respondWithFilteredResult(_0x5289ed,_0x2a1021){return function(_0x4df387){if(_0x4df387){var _0x14e820=typeof _0x2a1021[_0x870b('0x20')]===_0x870b('0x21')&&typeof _0x2a1021['limit']===_0x870b('0x21');var _0x30734b=_0x4df387[_0x870b('0x22')];var _0x1051fd=_0x14e820?0x0:_0x2a1021[_0x870b('0x20')];var _0x4a3c9f=_0x14e820?_0x4df387[_0x870b('0x22')]:_0x2a1021[_0x870b('0x20')]+_0x2a1021[_0x870b('0x23')];var _0x3a01d3;if(_0x4a3c9f>=_0x30734b){_0x4a3c9f=_0x30734b;_0x3a01d3=0xc8;}else{_0x3a01d3=0xce;}_0x5289ed[_0x870b('0x1d')](_0x3a01d3);return _0x5289ed[_0x870b('0x24')](_0x870b('0x25'),_0x1051fd+'-'+_0x4a3c9f+'/'+_0x30734b)[_0x870b('0x1f')](_0x4df387);}return null;};}function patchUpdates(_0x534641){return function(_0x5d449f){try{jsonpatch[_0x870b('0x26')](_0x5d449f,_0x534641,!![]);}catch(_0x4682e0){return BPromise['reject'](_0x4682e0);}return _0x5d449f[_0x870b('0x27')]();};}function saveUpdates(_0x21f4e5,_0x1a1c2b){return function(_0x3904d7){if(_0x3904d7){return _0x3904d7['update'](_0x21f4e5)[_0x870b('0x28')](function(_0x318435){return _0x318435;});}return null;};}function removeEntity(_0x479d86,_0x4a058a){return function(_0x55b567){if(_0x55b567){return _0x55b567[_0x870b('0x29')]()['then'](function(){var _0x3e9cd8=_0x55b567[_0x870b('0x2a')]({'plain':!![]});var _0x169d61='ContactItemTypes';return db[_0x870b('0x2b')]['destroy']({'where':{'type':_0x169d61,'resourceId':_0x3e9cd8['id']}})['then'](function(){return _0x55b567;});})['then'](function(){_0x479d86[_0x870b('0x1d')](0xcc)[_0x870b('0x1e')]();});}};}function handleEntityNotFound(_0x395e91,_0x1f071a){return function(_0x30f22b){if(!_0x30f22b){_0x395e91[_0x870b('0x1c')](0x194);}return _0x30f22b;};}function handleError(_0x3c9a48,_0x367002){_0x367002=_0x367002||0x1f4;return function(_0x58e04b){logger[_0x870b('0x2c')](_0x58e04b[_0x870b('0x2d')]);if(_0x58e04b[_0x870b('0x2e')]){delete _0x58e04b[_0x870b('0x2e')];}_0x3c9a48[_0x870b('0x1d')](_0x367002)[_0x870b('0x2f')](_0x58e04b);};}function getMustacheRender(_0x15c9a7,_0x16988f){return Mustache[_0x870b('0x30')](_0x15c9a7,_[_0x870b('0x31')](_0x16988f[_0x870b('0x32')],{'contact':_0x16988f[_0x870b('0x33')],'message':_0x16988f[_0x870b('0x34')],'agent':_0x16988f[_0x870b('0x35')],'interaction':_0x16988f['interaction'],'account':_0x16988f[_0x870b('0x36')]}))||'';}exports[_0x870b('0x37')]=function(_0x14126e,_0x5e08d8){var _0x2cf62e={},_0x1a4ada={},_0x46aa77={'count':0x0,'rows':[]};var _0x7a473c=_[_0x870b('0x38')](db[_0x870b('0x39')][_0x870b('0x3a')],function(_0x3096d8){return{'name':_0x3096d8['fieldName'],'type':_0x3096d8['type'][_0x870b('0x3b')]};});_0x1a4ada['model']=_[_0x870b('0x38')](_0x7a473c,_0x870b('0x2e'));_0x1a4ada['query']=_['keys'](_0x14126e['query']);_0x1a4ada[_0x870b('0x3c')]=_[_0x870b('0x3d')](_0x1a4ada[_0x870b('0x3e')],_0x1a4ada[_0x870b('0x3f')]);_0x2cf62e[_0x870b('0x40')]=_[_0x870b('0x3d')](_0x1a4ada[_0x870b('0x3e')],qs[_0x870b('0x41')](_0x14126e['query'][_0x870b('0x41')]));_0x2cf62e['attributes']=_0x2cf62e[_0x870b('0x40')]['length']?_0x2cf62e['attributes']:_0x1a4ada['model'];if(!_0x14126e[_0x870b('0x3f')]['hasOwnProperty'](_0x870b('0x42'))){_0x2cf62e[_0x870b('0x23')]=qs[_0x870b('0x23')](_0x14126e[_0x870b('0x3f')]['limit']);_0x2cf62e[_0x870b('0x20')]=qs['offset'](_0x14126e['query']['offset']);}_0x2cf62e[_0x870b('0x43')]=qs[_0x870b('0x44')](_0x14126e[_0x870b('0x3f')][_0x870b('0x44')]);_0x2cf62e[_0x870b('0x45')]=qs[_0x870b('0x3c')](_[_0x870b('0x46')](_0x14126e[_0x870b('0x3f')],_0x1a4ada[_0x870b('0x3c')]),_0x7a473c);if(_0x14126e['query']['filter']){_0x2cf62e[_0x870b('0x45')]=_[_0x870b('0x31')](_0x2cf62e[_0x870b('0x45')],{'$or':_[_0x870b('0x38')](_0x7a473c,function(_0x2e1b7c){if(_0x2e1b7c[_0x870b('0x47')]!==_0x870b('0x48')){var _0x1787d1={};_0x1787d1[_0x2e1b7c['name']]={'$like':'%'+_0x14126e[_0x870b('0x3f')][_0x870b('0x49')]+'%'};return _0x1787d1;}})});}_0x2cf62e=_[_0x870b('0x31')]({},_0x2cf62e,_0x14126e[_0x870b('0x4a')]);var _0x105665={'where':_0x2cf62e[_0x870b('0x45')]};return db['ContactItemType']['count'](_0x105665)[_0x870b('0x28')](function(_0x3e1c5e){_0x46aa77[_0x870b('0x22')]=_0x3e1c5e;if(_0x14126e['query'][_0x870b('0x4b')]){_0x2cf62e[_0x870b('0x4c')]=[{'all':!![]}];}return db[_0x870b('0x39')][_0x870b('0x4d')](_0x2cf62e);})[_0x870b('0x28')](function(_0x3f4e57){_0x46aa77[_0x870b('0x4e')]=_0x3f4e57;return _0x46aa77;})[_0x870b('0x28')](respondWithFilteredResult(_0x5e08d8,_0x2cf62e))['catch'](handleError(_0x5e08d8,null));};exports[_0x870b('0x4f')]=function(_0x5212fb,_0x31241f){var _0x268513={'raw':!![],'where':{'id':_0x5212fb[_0x870b('0x50')]['id']}},_0x9adbcb={};_0x9adbcb['model']=_['keys'](db[_0x870b('0x39')][_0x870b('0x3a')]);_0x9adbcb[_0x870b('0x3f')]=_[_0x870b('0x51')](_0x5212fb[_0x870b('0x3f')]);_0x9adbcb[_0x870b('0x3c')]=_['intersection'](_0x9adbcb[_0x870b('0x3e')],_0x9adbcb['query']);_0x268513['attributes']=_['intersection'](_0x9adbcb[_0x870b('0x3e')],qs[_0x870b('0x41')](_0x5212fb['query']['fields']));_0x268513[_0x870b('0x40')]=_0x268513[_0x870b('0x40')][_0x870b('0x52')]?_0x268513[_0x870b('0x40')]:_0x9adbcb[_0x870b('0x3e')];if(_0x5212fb['query'][_0x870b('0x4b')]){_0x268513['include']=[{'all':!![]}];}_0x268513=_[_0x870b('0x31')]({},_0x268513,_0x5212fb[_0x870b('0x4a')]);return db[_0x870b('0x39')][_0x870b('0x53')](_0x268513)['then'](handleEntityNotFound(_0x31241f,null))['then'](respondWithResult(_0x31241f,null))['catch'](handleError(_0x31241f,null));};exports[_0x870b('0x54')]=function(_0x5e44bf,_0xd318d1){return db[_0x870b('0x39')][_0x870b('0x54')](_0x5e44bf[_0x870b('0x32')],{})[_0x870b('0x28')](function(_0x114333){var _0x3afc42=_0x5e44bf[_0x870b('0x55')]['get']({'plain':!![]});if(!_0x3afc42)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3afc42[_0x870b('0x56')]===_0x870b('0x55')){var _0xbf7b76=_0x114333['get']({'plain':!![]});var _0x5aae11=_0x870b('0x57');return db[_0x870b('0x58')][_0x870b('0x53')]({'where':{'name':_0x5aae11,'userProfileId':_0x3afc42['userProfileId']},'raw':!![]})['then'](function(_0x1d1a9b){if(_0x1d1a9b&&_0x1d1a9b[_0x870b('0x59')]===0x0){return db['UserProfileResource'][_0x870b('0x54')]({'name':_0xbf7b76[_0x870b('0x2e')],'resourceId':_0xbf7b76['id'],'type':_0x1d1a9b[_0x870b('0x2e')],'sectionId':_0x1d1a9b['id']},{})[_0x870b('0x28')](function(){return _0x114333;});}else{return _0x114333;}})[_0x870b('0x5a')](function(_0x2e633e){logger[_0x870b('0x2c')](_0x870b('0x5b'),_0x2e633e);throw _0x2e633e;});}return _0x114333;})[_0x870b('0x28')](respondWithResult(_0xd318d1,0xc9))[_0x870b('0x5a')](handleError(_0xd318d1,null));};exports[_0x870b('0x5c')]=function(_0x5b696b,_0x2e3249){if(_0x5b696b['body']['id']){delete _0x5b696b[_0x870b('0x32')]['id'];}return db[_0x870b('0x39')][_0x870b('0x53')]({'where':{'id':_0x5b696b['params']['id']}})[_0x870b('0x28')](handleEntityNotFound(_0x2e3249,null))[_0x870b('0x28')](saveUpdates(_0x5b696b['body'],null))['then'](respondWithResult(_0x2e3249,null))[_0x870b('0x5a')](handleError(_0x2e3249,null));};exports[_0x870b('0x29')]=function(_0x56d416,_0x13aa8c){return db['ContactItemType']['find']({'where':{'id':_0x56d416[_0x870b('0x50')]['id']}})[_0x870b('0x28')](handleEntityNotFound(_0x13aa8c,null))[_0x870b('0x28')](removeEntity(_0x13aa8c,null))['catch'](handleError(_0x13aa8c,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 2b8cdaa..83e7969 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd916=['../../config/logger','api','moment','request-promise','path','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util'];(function(_0x5349ee,_0x3e8ed9){var _0x26dd71=function(_0x48fb0c){while(--_0x48fb0c){_0x5349ee['push'](_0x5349ee['shift']());}};_0x26dd71(++_0x3e8ed9);}(_0xd916,0x18a));var _0x6d91=function(_0x452fef,_0xe0c889){_0x452fef=_0x452fef-0x0;var _0x1b46cd=_0xd916[_0x452fef];return _0x1b46cd;};'use strict';var _=require(_0x6d91('0x0'));var util=require(_0x6d91('0x1'));var logger=require(_0x6d91('0x2'))(_0x6d91('0x3'));var moment=require(_0x6d91('0x4'));var BPromise=require('bluebird');var rp=require(_0x6d91('0x5'));var fs=require('fs');var path=require(_0x6d91('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6d91('0x7'));module[_0x6d91('0x8')]=function(_0x59c589,_0x1f5cfc){return _0x59c589[_0x6d91('0x9')](_0x6d91('0xa'),attributes,{'tableName':_0x6d91('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a2a=['tools_contact_item_types','lodash','util','../../config/logger','api','path','rimraf','./contactItemType.attributes','exports','define'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x256d9c,_0x1e9546){_0x256d9c=_0x256d9c-0x0;var _0x586003=_0x5a2a[_0x256d9c];return _0x586003;};'use strict';var _=require(_0xa5a2('0x0'));var util=require(_0xa5a2('0x1'));var logger=require(_0xa5a2('0x2'))(_0xa5a2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5a2('0x4'));var rimraf=require(_0xa5a2('0x5'));var config=require('../../config/environment');var attributes=require(_0xa5a2('0x6'));module[_0xa5a2('0x7')]=function(_0x2e97d3,_0x55728b){return _0x2e97d3[_0xa5a2('0x8')]('ContactItemType',attributes,{'tableName':_0xa5a2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 97a07e7..570f205 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc874=['bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment'];(function(_0x3368f6,_0x431f09){var _0x173bfd=function(_0x55d3cb){while(--_0x55d3cb){_0x3368f6['push'](_0x3368f6['shift']());}};_0x173bfd(++_0x431f09);}(_0xc874,0x154));var _0x4c87=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0xc874[_0x16de68];return _0x1c277e;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var moment=require(_0x4c87('0x1'));var BPromise=require(_0x4c87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c87('0x3'))['db'];var utils=require(_0x4c87('0x4'));var logger=require(_0x4c87('0x5'))('rpc');var config=require(_0x4c87('0x6'));var jayson=require(_0x4c87('0x7'));var client=jayson['client'][_0x4c87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dafe0,_0x30c939,_0xdc4a29){return new BPromise(function(_0x116649,_0x5b7720){return client[_0x4c87('0x9')](_0x3dafe0,_0xdc4a29)['then'](function(_0x384268){logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,_0x4c87('0xc'));logger[_0x4c87('0xd')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x30c939,_0x4c87('0xc'),JSON[_0x4c87('0xe')](_0x384268));if(_0x384268['error']){if(_0x384268[_0x4c87('0xf')][_0x4c87('0x10')]===0x1f4){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')]['message']);return _0x5b7720(_0x384268['error']['message']);}logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);return _0x116649(_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);}else{logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,'request\x20sent');_0x116649(_0x384268[_0x4c87('0x12')][_0x4c87('0x11')]);}})['catch'](function(_0x575de5){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x575de5);_0x5b7720(_0x575de5);});});} \ No newline at end of file +var _0x823c=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x3efb47,_0x1d4196){var _0x434e88=function(_0x2274b0){while(--_0x2274b0){_0x3efb47['push'](_0x3efb47['shift']());}};_0x434e88(++_0x1d4196);}(_0x823c,0x143));var _0xc823=function(_0x3aa7e9,_0x90038c){_0x3aa7e9=_0x3aa7e9-0x0;var _0x146884=_0x823c[_0x3aa7e9];return _0x146884;};'use strict';var _=require(_0xc823('0x0'));var util=require('util');var moment=require(_0xc823('0x1'));var BPromise=require(_0xc823('0x2'));var rs=require(_0xc823('0x3'));var fs=require('fs');var Redis=require(_0xc823('0x4'));var db=require(_0xc823('0x5'))['db'];var utils=require(_0xc823('0x6'));var logger=require('../../config/logger')(_0xc823('0x7'));var config=require(_0xc823('0x8'));var jayson=require(_0xc823('0x9'));var client=jayson[_0xc823('0xa')][_0xc823('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49e861,_0xba407e,_0x472007){return new BPromise(function(_0x5daab9,_0x52bb76){return client[_0xc823('0xc')](_0x49e861,_0x472007)[_0xc823('0xd')](function(_0x53d48d){logger[_0xc823('0xe')](_0xc823('0xf'),_0xba407e,'request\x20sent');logger['debug'](_0xc823('0x10'),_0xba407e,_0xc823('0x11'),JSON[_0xc823('0x12')](_0x53d48d));if(_0x53d48d[_0xc823('0x13')]){if(_0x53d48d[_0xc823('0x13')]['code']===0x1f4){logger[_0xc823('0x13')](_0xc823('0xf'),_0xba407e,_0x53d48d[_0xc823('0x13')][_0xc823('0x14')]);return _0x52bb76(_0x53d48d[_0xc823('0x13')][_0xc823('0x14')]);}logger['error'](_0xc823('0xf'),_0xba407e,_0x53d48d[_0xc823('0x13')][_0xc823('0x14')]);return _0x5daab9(_0x53d48d[_0xc823('0x13')]['message']);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0xba407e,'request\x20sent');_0x5daab9(_0x53d48d[_0xc823('0x15')]['message']);}})[_0xc823('0x16')](function(_0x122510){logger[_0xc823('0x13')](_0xc823('0xf'),_0xba407e,_0x122510);_0x52bb76(_0x122510);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 3860304..2422fca 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9b0=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x4bb27a,_0x373798){var _0x1ef716=function(_0x5c0403){while(--_0x5c0403){_0x4bb27a['push'](_0x4bb27a['shift']());}};_0x1ef716(++_0x373798);}(_0xa9b0,0x173));var _0x0a9b=function(_0x2525f1,_0x47034f){_0x2525f1=_0x2525f1-0x0;var _0x13c1b5=_0xa9b0[_0x2525f1];return _0x13c1b5;};'use strict';var multer=require(_0x0a9b('0x0'));var util=require('util');var path=require(_0x0a9b('0x1'));var timeout=require(_0x0a9b('0x2'));var express=require('express');var router=express[_0x0a9b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9b('0x5'));var controller=require('./contactItemType.controller');router[_0x0a9b('0x6')]('/',auth[_0x0a9b('0x7')](),controller[_0x0a9b('0x8')]);router[_0x0a9b('0x6')](_0x0a9b('0x9'),auth[_0x0a9b('0x7')](),controller[_0x0a9b('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0a9b('0xb')]);router[_0x0a9b('0xc')](_0x0a9b('0x9'),auth['isAuthenticated'](),controller[_0x0a9b('0xd')]);router[_0x0a9b('0xe')](_0x0a9b('0x9'),auth['isAuthenticated'](),controller[_0x0a9b('0xf')]);module[_0x0a9b('0x10')]=router; \ No newline at end of file +var _0x424a=['delete','/:id','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','post','create','put','update'];(function(_0x48ac7f,_0xb8ec44){var _0x50a9b6=function(_0x46d1fa){while(--_0x46d1fa){_0x48ac7f['push'](_0x48ac7f['shift']());}};_0x50a9b6(++_0xb8ec44);}(_0x424a,0x192));var _0xa424=function(_0x165ece,_0x1f0a42){_0x165ece=_0x165ece-0x0;var _0x545fe6=_0x424a[_0x165ece];return _0x545fe6;};'use strict';var multer=require(_0xa424('0x0'));var util=require(_0xa424('0x1'));var path=require(_0xa424('0x2'));var timeout=require('connect-timeout');var express=require(_0xa424('0x3'));var router=express[_0xa424('0x4')]();var fs_extra=require(_0xa424('0x5'));var auth=require(_0xa424('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa424('0x7'));var controller=require(_0xa424('0x8'));router[_0xa424('0x9')]('/',auth[_0xa424('0xa')](),controller[_0xa424('0xb')]);router[_0xa424('0x9')]('/:id',auth[_0xa424('0xa')](),controller['show']);router[_0xa424('0xc')]('/',auth[_0xa424('0xa')](),controller[_0xa424('0xd')]);router[_0xa424('0xe')]('/:id',auth[_0xa424('0xa')](),controller[_0xa424('0xf')]);router[_0xa424('0x10')](_0xa424('0x11'),auth[_0xa424('0xa')](),controller['destroy']);module[_0xa424('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 72c0760..e4efc69 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 _0x5a63=['exports','STRING','sequelize'];(function(_0x49c5ff,_0x4771d7){var _0x38175e=function(_0x234a74){while(--_0x234a74){_0x49c5ff['push'](_0x49c5ff['shift']());}};_0x38175e(++_0x4771d7);}(_0x5a63,0xe3));var _0x35a6=function(_0x15329f,_0x30b540){_0x15329f=_0x15329f-0x0;var _0x4ceabd=_0x5a63[_0x15329f];return _0x4ceabd;};'use strict';var Sequelize=require(_0x35a6('0x0'));module[_0x35a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x35a6('0x2')]}}; \ No newline at end of file +var _0x4397=['sequelize','exports','STRING','name'];(function(_0x4b8aa8,_0x1cc2b6){var _0x51040e=function(_0x35ca67){while(--_0x35ca67){_0x4b8aa8['push'](_0x4b8aa8['shift']());}};_0x51040e(++_0x1cc2b6);}(_0x4397,0xe4));var _0x7439=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0x4397[_0x32b993];return _0x482780;};'use strict';var Sequelize=require(_0x7439('0x0'));module[_0x7439('0x1')]={'name':{'type':Sequelize[_0x7439('0x2')],'allowNull':![],'unique':_0x7439('0x3')},'description':{'type':Sequelize[_0x7439('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 6df80b6..93269b5 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 _0xbeef=['util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','redis','defaults','register','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','get','sendStatus','error','name','send','merge','body','contact','message','account','index','map','Dashboard','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','userProfileId','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','length','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x75b25d,_0x3fbae3){var _0x3400de=function(_0x380c27){while(--_0x380c27){_0x75b25d['push'](_0x75b25d['shift']());}};_0x3400de(++_0x3fbae3);}(_0xbeef,0x172));var _0xfbee=function(_0x23d9bc,_0x4dc97f){_0x23d9bc=_0x23d9bc-0x0;var _0x5716b5=_0xbeef[_0x23d9bc];return _0x5716b5;};'use strict';var emlformat=require(_0xfbee('0x0'));var rimraf=require(_0xfbee('0x1'));var zipdir=require(_0xfbee('0x2'));var jsonpatch=require(_0xfbee('0x3'));var rp=require(_0xfbee('0x4'));var moment=require(_0xfbee('0x5'));var BPromise=require(_0xfbee('0x6'));var Mustache=require(_0xfbee('0x7'));var util=require(_0xfbee('0x8'));var path=require(_0xfbee('0x9'));var sox=require(_0xfbee('0xa'));var csv=require(_0xfbee('0xb'));var ejs=require(_0xfbee('0xc'));var fs=require('fs');var fs_extra=require(_0xfbee('0xd'));var _=require(_0xfbee('0xe'));var squel=require('squel');var crypto=require(_0xfbee('0xf'));var jsforce=require(_0xfbee('0x10'));var deskjs=require(_0xfbee('0x11'));var toCsv=require(_0xfbee('0xb'));var querystring=require(_0xfbee('0x12'));var Papa=require(_0xfbee('0x13'));var Redis=require(_0xfbee('0x14'));var authService=require(_0xfbee('0x15'));var qs=require(_0xfbee('0x16'));var as=require(_0xfbee('0x17'));var hardwareService=require(_0xfbee('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0xfbee('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xfbee('0x1a'));var db=require('../../mysqldb')['db'];config[_0xfbee('0x1b')]=_[_0xfbee('0x1c')](config[_0xfbee('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfbee('0x1b')]));require('./dashboard.socket')[_0xfbee('0x1d')](socket);function respondWithStatusCode(_0xaaf8e7,_0x26053f){_0x26053f=_0x26053f||0xcc;return function(_0x4d1209){if(_0x4d1209){return _0xaaf8e7['sendStatus'](_0x26053f);}return _0xaaf8e7[_0xfbee('0x1e')](_0x26053f)[_0xfbee('0x1f')]();};}function respondWithResult(_0x10d135,_0x4e36e1){_0x4e36e1=_0x4e36e1||0xc8;return function(_0x57058b){if(_0x57058b){return _0x10d135[_0xfbee('0x1e')](_0x4e36e1)[_0xfbee('0x20')](_0x57058b);}};}function respondWithFilteredResult(_0x4643e3,_0x415aeb){return function(_0x45adab){if(_0x45adab){var _0x21e893=typeof _0x415aeb['offset']===_0xfbee('0x21')&&typeof _0x415aeb[_0xfbee('0x22')]===_0xfbee('0x21');var _0xbf2c60=_0x45adab[_0xfbee('0x23')];var _0x3f4eae=_0x21e893?0x0:_0x415aeb['offset'];var _0x9017e9=_0x21e893?_0x45adab[_0xfbee('0x23')]:_0x415aeb[_0xfbee('0x24')]+_0x415aeb['limit'];var _0x38616e;if(_0x9017e9>=_0xbf2c60){_0x9017e9=_0xbf2c60;_0x38616e=0xc8;}else{_0x38616e=0xce;}_0x4643e3[_0xfbee('0x1e')](_0x38616e);return _0x4643e3[_0xfbee('0x25')](_0xfbee('0x26'),_0x3f4eae+'-'+_0x9017e9+'/'+_0xbf2c60)[_0xfbee('0x20')](_0x45adab);}return null;};}function patchUpdates(_0x1b9064){return function(_0x52b173){try{jsonpatch[_0xfbee('0x27')](_0x52b173,_0x1b9064,!![]);}catch(_0x1d33d0){return BPromise['reject'](_0x1d33d0);}return _0x52b173['save']();};}function saveUpdates(_0x4453a7,_0x286239){return function(_0x1ee615){if(_0x1ee615){return _0x1ee615[_0xfbee('0x28')](_0x4453a7)[_0xfbee('0x29')](function(_0x570817){return _0x570817;});}return null;};}function removeEntity(_0x20f60d,_0x5ef03b){return function(_0xc3ab30){if(_0xc3ab30){return _0xc3ab30[_0xfbee('0x2a')]()[_0xfbee('0x29')](function(){var _0x44381d=_0xc3ab30[_0xfbee('0x2b')]({'plain':!![]});var _0x3dc8a0='CustomDashboards';return db['UserProfileResource'][_0xfbee('0x2a')]({'where':{'type':_0x3dc8a0,'resourceId':_0x44381d['id']}})[_0xfbee('0x29')](function(){return _0xc3ab30;});})[_0xfbee('0x29')](function(){_0x20f60d[_0xfbee('0x1e')](0xcc)[_0xfbee('0x1f')]();});}};}function handleEntityNotFound(_0x1659f8,_0x329b32){return function(_0x309b27){if(!_0x309b27){_0x1659f8[_0xfbee('0x2c')](0x194);}return _0x309b27;};}function handleError(_0x22b1f9,_0x1cbbba){_0x1cbbba=_0x1cbbba||0x1f4;return function(_0x39f25e){logger[_0xfbee('0x2d')](_0x39f25e['stack']);if(_0x39f25e[_0xfbee('0x2e')]){delete _0x39f25e[_0xfbee('0x2e')];}_0x22b1f9[_0xfbee('0x1e')](_0x1cbbba)[_0xfbee('0x2f')](_0x39f25e);};}function getMustacheRender(_0x26b813,_0x4f0718){return Mustache['render'](_0x26b813,_[_0xfbee('0x30')](_0x4f0718[_0xfbee('0x31')],{'contact':_0x4f0718[_0xfbee('0x32')],'message':_0x4f0718[_0xfbee('0x33')],'agent':_0x4f0718['agent'],'interaction':_0x4f0718['interaction'],'account':_0x4f0718[_0xfbee('0x34')]}))||'';}exports[_0xfbee('0x35')]=function(_0x57d497,_0x47744c){var _0x46d01c={},_0x3744d1={},_0x145b6d={'count':0x0,'rows':[]};var _0x939775=_[_0xfbee('0x36')](db[_0xfbee('0x37')][_0xfbee('0x38')],function(_0x21434f){return{'name':_0x21434f[_0xfbee('0x39')],'type':_0x21434f[_0xfbee('0x3a')]['key']};});_0x3744d1[_0xfbee('0x3b')]=_[_0xfbee('0x36')](_0x939775,_0xfbee('0x2e'));_0x3744d1[_0xfbee('0x3c')]=_[_0xfbee('0x3d')](_0x57d497[_0xfbee('0x3c')]);_0x3744d1[_0xfbee('0x3e')]=_[_0xfbee('0x3f')](_0x3744d1[_0xfbee('0x3b')],_0x3744d1[_0xfbee('0x3c')]);_0x46d01c[_0xfbee('0x40')]=_['intersection'](_0x3744d1[_0xfbee('0x3b')],qs[_0xfbee('0x41')](_0x57d497[_0xfbee('0x3c')][_0xfbee('0x41')]));_0x46d01c[_0xfbee('0x40')]=_0x46d01c[_0xfbee('0x40')]['length']?_0x46d01c['attributes']:_0x3744d1[_0xfbee('0x3b')];if(!_0x57d497[_0xfbee('0x3c')][_0xfbee('0x42')](_0xfbee('0x43'))){_0x46d01c[_0xfbee('0x22')]=qs['limit'](_0x57d497[_0xfbee('0x3c')]['limit']);_0x46d01c['offset']=qs[_0xfbee('0x24')](_0x57d497['query'][_0xfbee('0x24')]);}_0x46d01c[_0xfbee('0x44')]=qs['sort'](_0x57d497['query'][_0xfbee('0x45')]);_0x46d01c[_0xfbee('0x46')]=qs[_0xfbee('0x3e')](_[_0xfbee('0x47')](_0x57d497[_0xfbee('0x3c')],_0x3744d1['filters']),_0x939775);if(_0x57d497[_0xfbee('0x3c')][_0xfbee('0x48')]){_0x46d01c[_0xfbee('0x46')]=_[_0xfbee('0x30')](_0x46d01c[_0xfbee('0x46')],{'$or':_[_0xfbee('0x36')](_0x939775,function(_0x267e83){if(_0x267e83[_0xfbee('0x3a')]!==_0xfbee('0x49')){var _0xdc26a7={};_0xdc26a7[_0x267e83[_0xfbee('0x2e')]]={'$like':'%'+_0x57d497[_0xfbee('0x3c')][_0xfbee('0x48')]+'%'};return _0xdc26a7;}})});}_0x46d01c=_[_0xfbee('0x30')]({},_0x46d01c,_0x57d497['options']);var _0x26c72d={'where':_0x46d01c['where']};return db[_0xfbee('0x37')][_0xfbee('0x23')](_0x26c72d)[_0xfbee('0x29')](function(_0x1a2d05){_0x145b6d['count']=_0x1a2d05;if(_0x57d497['query']['includeAll']){_0x46d01c[_0xfbee('0x4a')]=[{'all':!![]}];}return db['Dashboard'][_0xfbee('0x4b')](_0x46d01c);})[_0xfbee('0x29')](function(_0x4574a1){_0x145b6d[_0xfbee('0x4c')]=_0x4574a1;return _0x145b6d;})[_0xfbee('0x29')](respondWithFilteredResult(_0x47744c,_0x46d01c))[_0xfbee('0x4d')](handleError(_0x47744c,null));};exports[_0xfbee('0x4e')]=function(_0x2b1fdc,_0x3b7628){var _0x215011={'raw':![],'where':{'id':_0x2b1fdc[_0xfbee('0x4f')]['id']}},_0x2e68f4={};_0x2e68f4[_0xfbee('0x3b')]=_[_0xfbee('0x3d')](db[_0xfbee('0x37')]['rawAttributes']);_0x2e68f4[_0xfbee('0x3c')]=_['keys'](_0x2b1fdc[_0xfbee('0x3c')]);_0x2e68f4[_0xfbee('0x3e')]=_[_0xfbee('0x3f')](_0x2e68f4[_0xfbee('0x3b')],_0x2e68f4[_0xfbee('0x3c')]);_0x215011['attributes']=_[_0xfbee('0x3f')](_0x2e68f4[_0xfbee('0x3b')],qs[_0xfbee('0x41')](_0x2b1fdc[_0xfbee('0x3c')][_0xfbee('0x41')]));_0x215011[_0xfbee('0x40')]=_0x215011['attributes']['length']?_0x215011[_0xfbee('0x40')]:_0x2e68f4['model'];if(_0x2b1fdc[_0xfbee('0x3c')][_0xfbee('0x50')]){_0x215011[_0xfbee('0x4a')]=[{'all':!![]}];}_0x215011=_[_0xfbee('0x30')]({},_0x215011,_0x2b1fdc[_0xfbee('0x51')]);return db[_0xfbee('0x37')][_0xfbee('0x52')](_0x215011)[_0xfbee('0x29')](handleEntityNotFound(_0x3b7628,null))['then'](respondWithResult(_0x3b7628,null))[_0xfbee('0x4d')](handleError(_0x3b7628,null));};exports[_0xfbee('0x53')]=function(_0x24088b,_0x3da7f3){return db[_0xfbee('0x37')][_0xfbee('0x53')](_0x24088b[_0xfbee('0x31')],{})['then'](function(_0x39ae77){var _0x32ed51=_0x24088b[_0xfbee('0x54')][_0xfbee('0x2b')]({'plain':!![]});if(!_0x32ed51)throw new Error(_0xfbee('0x55'));if(_0x32ed51[_0xfbee('0x56')]===_0xfbee('0x54')){var _0x33d960=_0x39ae77[_0xfbee('0x2b')]({'plain':!![]});var _0x1cc69f=_0xfbee('0x57');return db[_0xfbee('0x58')][_0xfbee('0x52')]({'where':{'name':_0x1cc69f,'userProfileId':_0x32ed51['userProfileId']},'raw':!![]})[_0xfbee('0x29')](function(_0x2bbea9){if(_0x2bbea9&&_0x2bbea9[_0xfbee('0x59')]===0x0){return db[_0xfbee('0x5a')][_0xfbee('0x53')]({'name':_0x33d960[_0xfbee('0x2e')],'resourceId':_0x33d960['id'],'type':_0x2bbea9[_0xfbee('0x2e')],'sectionId':_0x2bbea9['id']},{})[_0xfbee('0x29')](function(){return _0x39ae77;});}else{return _0x39ae77;}})[_0xfbee('0x4d')](function(_0x1f5294){logger[_0xfbee('0x2d')](_0xfbee('0x5b'),_0x1f5294);throw _0x1f5294;});}return _0x39ae77;})['then'](respondWithResult(_0x3da7f3,0xc9))[_0xfbee('0x4d')](handleError(_0x3da7f3,null));};exports[_0xfbee('0x5c')]=function(_0x22beb4,_0x5edd87){var _0x10ac4e={'where':{'id':_0x22beb4[_0xfbee('0x4f')]['id']}},_0x2443ec={};_0x2443ec['model']=_[_0xfbee('0x3d')](db['Dashboard'][_0xfbee('0x38')]);_0x10ac4e[_0xfbee('0x40')]=_['intersection'](_0x2443ec[_0xfbee('0x3b')],qs[_0xfbee('0x41')](_0x22beb4[_0xfbee('0x3c')][_0xfbee('0x41')]));_0x10ac4e[_0xfbee('0x40')]=_0x10ac4e[_0xfbee('0x40')]['length']?_0x10ac4e[_0xfbee('0x40')]:_0x2443ec[_0xfbee('0x3b')];if(_0x22beb4[_0xfbee('0x3c')][_0xfbee('0x50')]){_0x10ac4e[_0xfbee('0x4a')]=[{'all':!![]}];}_0x10ac4e=_[_0xfbee('0x30')]({},_0x10ac4e,_0x22beb4[_0xfbee('0x51')]);return db['Dashboard'][_0xfbee('0x52')](_0x10ac4e)['then'](handleEntityNotFound(_0x5edd87,null))[_0xfbee('0x29')](function(_0x215192){if(_0x215192){var _0x49d25b=_0x215192[_0xfbee('0x2b')]({'plain':!![]});_0x49d25b=qs[_0xfbee('0x5d')](_0x49d25b,['id','createdAt',_0xfbee('0x5e')]);_0x22beb4[_0xfbee('0x31')]=_['omit'](_0x22beb4[_0xfbee('0x31')],['id',_0xfbee('0x5f'),_0xfbee('0x5e')]);return db[_0xfbee('0x37')][_0xfbee('0x53')](_[_0xfbee('0x30')](_0x49d25b,_0x22beb4['body']),{'include':_0x22beb4[_0xfbee('0x3c')][_0xfbee('0x50')]?[{'all':!![]}]:undefined})[_0xfbee('0x29')](function(_0x397d63){var _0x4c4c3a=_0x22beb4[_0xfbee('0x54')][_0xfbee('0x2b')]({'plain':!![]});if(!_0x4c4c3a)throw new Error(_0xfbee('0x55'));if(_0x4c4c3a['role']===_0xfbee('0x54')){var _0x1c63ce=_0x397d63[_0xfbee('0x2b')]({'plain':!![]});var _0x3bdf53=_0xfbee('0x57');return db[_0xfbee('0x58')]['find']({'where':{'name':_0x3bdf53,'userProfileId':_0x4c4c3a[_0xfbee('0x60')]},'raw':!![]})[_0xfbee('0x29')](function(_0xf995ab){if(_0xf995ab&&_0xf995ab[_0xfbee('0x59')]===0x0){return db[_0xfbee('0x5a')][_0xfbee('0x53')]({'name':_0x1c63ce[_0xfbee('0x2e')],'resourceId':_0x1c63ce['id'],'type':_0xf995ab['name'],'sectionId':_0xf995ab['id']},{})[_0xfbee('0x29')](function(){return _0x397d63;});}else{return _0x397d63;}})[_0xfbee('0x4d')](function(_0x93ac0e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x93ac0e);throw _0x93ac0e;});}return _0x397d63;});}})['then'](respondWithResult(_0x5edd87,0xc9))['catch'](handleError(_0x5edd87,null));};exports[_0xfbee('0x28')]=function(_0x1003f6,_0x37949c){if(_0x1003f6[_0xfbee('0x31')]['id']){delete _0x1003f6[_0xfbee('0x31')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x1003f6['params']['id']}})[_0xfbee('0x29')](handleEntityNotFound(_0x37949c,null))[_0xfbee('0x29')](saveUpdates(_0x1003f6[_0xfbee('0x31')],null))[_0xfbee('0x29')](respondWithResult(_0x37949c,null))['catch'](handleError(_0x37949c,null));};exports[_0xfbee('0x2a')]=function(_0x1c1144,_0x292be9){return db['Dashboard']['find']({'where':{'id':_0x1c1144['params']['id']}})[_0xfbee('0x29')](handleEntityNotFound(_0x292be9,null))[_0xfbee('0x29')](removeEntity(_0x292be9,null))[_0xfbee('0x4d')](handleError(_0x292be9,null));};function widgetAttributes(_0x472b92){try{switch(_0x472b92[_0xfbee('0x3a')]){case _0xfbee('0x61'):return[{'name':_0xfbee('0x62'),'value':_0x472b92[_0xfbee('0x62')]||(_0x472b92[_0xfbee('0x63')]&&_0x472b92['attrs'][0x0]?_0x472b92[_0xfbee('0x63')][0x0][_0xfbee('0x64')]:undefined)||_0xfbee('0x65')}];case _0xfbee('0x66'):return[{'name':_0xfbee('0x67'),'value':_0x472b92[_0xfbee('0x67')]||(_0x472b92['attrs']&&_0x472b92['attrs'][0x0]?_0x472b92['attrs'][0x0][_0xfbee('0x64')]:undefined)||''}];case'clock':return[{'name':_0xfbee('0x68'),'value':_0x472b92[_0xfbee('0x68')]||(_0x472b92[_0xfbee('0x63')]&&_0x472b92['attrs'][0x0]?_0x472b92['attrs'][0x0][_0xfbee('0x64')]:undefined)||_0xfbee('0x69')},{'name':_0xfbee('0x6a'),'value':_0x472b92[_0xfbee('0x6a')]||(_0x472b92[_0xfbee('0x63')]&&_0x472b92[_0xfbee('0x63')][0x1]?_0x472b92[_0xfbee('0x63')][0x1][_0xfbee('0x64')]:undefined)||_0xfbee('0x6b')},{'name':'attrFontSize','value':_0x472b92[_0xfbee('0x6c')]||(_0x472b92[_0xfbee('0x63')]&&_0x472b92['attrs'][0x2]?_0x472b92[_0xfbee('0x63')][0x2][_0xfbee('0x64')]:undefined)||0xc}];case'counter':return[{'name':_0xfbee('0x6d'),'value':_0x472b92['attrMetric']||(_0x472b92[_0xfbee('0x63')]&&_0x472b92[_0xfbee('0x63')][0x0]?_0x472b92[_0xfbee('0x63')][0x0]['value']:undefined)||_0xfbee('0x6e')},{'name':_0xfbee('0x6f'),'value':_0x472b92[_0xfbee('0x6f')]||(_0x472b92['attrs']&&_0x472b92[_0xfbee('0x63')][0x1]?_0x472b92[_0xfbee('0x63')][0x1][_0xfbee('0x64')]:undefined)||[]},{'name':'attrFontSize','value':_0x472b92[_0xfbee('0x6c')]||(_0x472b92['attrs']&&_0x472b92[_0xfbee('0x63')][0x2]?_0x472b92[_0xfbee('0x63')][0x2][_0xfbee('0x64')]:undefined)||0x14}];case'multibar-chart':case _0xfbee('0x70'):return[{'name':_0xfbee('0x71'),'value':_0x472b92[_0xfbee('0x71')]||(_0x472b92[_0xfbee('0x63')]&&_0x472b92[_0xfbee('0x63')][0x0]?_0x472b92[_0xfbee('0x63')][0x0][_0xfbee('0x64')]:undefined)||_0xfbee('0x6e')},{'name':_0xfbee('0x72'),'value':_0x472b92[_0xfbee('0x72')]||(_0x472b92[_0xfbee('0x63')]&&_0x472b92['attrs'][0x1]?_0x472b92[_0xfbee('0x63')][0x1][_0xfbee('0x64')]:undefined)||null},{'name':_0xfbee('0x73'),'value':_0x472b92[_0xfbee('0x73')]||(_0x472b92['attrs']&&_0x472b92[_0xfbee('0x63')][0x2]?_0x472b92[_0xfbee('0x63')][0x2][_0xfbee('0x64')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x472b92[_0xfbee('0x6f')]||(_0x472b92[_0xfbee('0x63')]&&_0x472b92[_0xfbee('0x63')][0x3]?_0x472b92[_0xfbee('0x63')][0x3][_0xfbee('0x64')]:undefined)||[]}];case _0xfbee('0x74'):return[{'name':_0xfbee('0x75'),'type':_0x472b92['reportType']||(_0x472b92[_0xfbee('0x63')]&&_0x472b92[_0xfbee('0x63')][0x0]?_0x472b92[_0xfbee('0x63')][0x0]['type']:undefined)||null,'value':_0x472b92[_0xfbee('0x75')]||(_0x472b92[_0xfbee('0x63')]&&_0x472b92[_0xfbee('0x63')][0x0]?_0x472b92[_0xfbee('0x63')][0x0]['value']:undefined)||null},{'name':_0xfbee('0x76'),'value':_0x472b92[_0xfbee('0x76')]||(_0x472b92[_0xfbee('0x63')]&&_0x472b92[_0xfbee('0x63')][0x1]?_0x472b92[_0xfbee('0x63')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x42b2ff){logger[_0xfbee('0x2d')](_0xfbee('0x77'),JSON['stringify'](_0x42b2ff));return[];}}exports[_0xfbee('0x78')]=function(_0x8b3999,_0x2f1522,_0x4bebb5){if(_0x8b3999['body']['id']){delete _0x8b3999[_0xfbee('0x31')]['id'];}return db[_0xfbee('0x37')][_0xfbee('0x52')]({'where':{'id':_0x8b3999[_0xfbee('0x4f')]['id']}})[_0xfbee('0x29')](handleEntityNotFound(_0x2f1522,null))[_0xfbee('0x29')](function(_0x47ecfd){if(_0x47ecfd){_0x8b3999['body'][_0xfbee('0x79')]=_0x47ecfd['id'];_0x8b3999['body'][_0xfbee('0x63')]=widgetAttributes(_0x8b3999[_0xfbee('0x31')]);return db[_0xfbee('0x7a')][_0xfbee('0x53')](_0x8b3999[_0xfbee('0x31')]);}})[_0xfbee('0x29')](respondWithResult(_0x2f1522,null))[_0xfbee('0x4d')](handleError(_0x2f1522,null));};exports[_0xfbee('0x7b')]=function(_0x1ea8ad,_0x5035f3,_0x229817){var _0xebe555={};var _0x1f043b={};var _0x48f98a;var _0x52caf1;return db['Dashboard'][_0xfbee('0x7c')]({'where':{'id':_0x1ea8ad[_0xfbee('0x4f')]['id']}})[_0xfbee('0x29')](handleEntityNotFound(_0x5035f3,null))['then'](function(_0x475335){if(_0x475335){_0x48f98a=_0x475335;_0x1f043b['model']=_[_0xfbee('0x3d')](db['DashboardItem'][_0xfbee('0x38')]);_0x1f043b[_0xfbee('0x3c')]=_['keys'](_0x1ea8ad[_0xfbee('0x3c')]);_0x1f043b[_0xfbee('0x3e')]=_[_0xfbee('0x3f')](_0x1f043b[_0xfbee('0x3b')],_0x1f043b[_0xfbee('0x3c')]);_0xebe555[_0xfbee('0x40')]=_['intersection'](_0x1f043b[_0xfbee('0x3b')],qs[_0xfbee('0x41')](_0x1ea8ad[_0xfbee('0x3c')]['fields']));_0xebe555[_0xfbee('0x40')]=_0xebe555[_0xfbee('0x40')][_0xfbee('0x7d')]?_0xebe555[_0xfbee('0x40')]:_0x1f043b['model'];_0xebe555[_0xfbee('0x44')]=qs[_0xfbee('0x45')](_0x1ea8ad[_0xfbee('0x3c')][_0xfbee('0x45')]);_0xebe555['where']=qs[_0xfbee('0x3e')](_[_0xfbee('0x47')](_0x1ea8ad['query'],_0x1f043b['filters']));if(_0x1ea8ad[_0xfbee('0x3c')][_0xfbee('0x48')]){_0xebe555[_0xfbee('0x46')]=_[_0xfbee('0x30')](_0xebe555[_0xfbee('0x46')],{'$or':_[_0xfbee('0x36')](_0xebe555[_0xfbee('0x40')],function(_0x44ce33){var _0x3e53aa={};_0x3e53aa[_0x44ce33]={'$like':'%'+_0x1ea8ad[_0xfbee('0x3c')]['filter']+'%'};return _0x3e53aa;})});}_0xebe555=_[_0xfbee('0x30')]({},_0xebe555,_0x1ea8ad['options']);return _0x48f98a[_0xfbee('0x7b')](_0xebe555);}})[_0xfbee('0x29')](function(_0x4bf65c){if(_0x4bf65c){_0x52caf1=_0x4bf65c[_0xfbee('0x7d')];if(!_0x1ea8ad[_0xfbee('0x3c')][_0xfbee('0x42')](_0xfbee('0x43'))){_0xebe555[_0xfbee('0x22')]=qs[_0xfbee('0x22')](_0x1ea8ad['query']['limit']);_0xebe555[_0xfbee('0x24')]=qs[_0xfbee('0x24')](_0x1ea8ad[_0xfbee('0x3c')][_0xfbee('0x24')]);}return _0x48f98a[_0xfbee('0x7b')](_0xebe555);}})[_0xfbee('0x29')](function(_0x25f686){if(_0x25f686){return _0x25f686?{'count':_0x52caf1,'rows':_0x25f686}:null;}})[_0xfbee('0x29')](respondWithResult(_0x5035f3,null))[_0xfbee('0x4d')](handleError(_0x5035f3,null));}; \ No newline at end of file +var _0x311b=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','iframe','attrUrl','attrs','https://','custom','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','CustomDashboards','UserProfileResource','end','error','stack','name','send','render','contact','message','agent','account','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','then','include','findAll','rows','catch','show','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','clone','omit','updatedAt','createdAt'];(function(_0x48bc1a,_0xa1e621){var _0x49d785=function(_0x308694){while(--_0x308694){_0x48bc1a['push'](_0x48bc1a['shift']());}};_0x49d785(++_0xa1e621);}(_0x311b,0xa1));var _0xb311=function(_0xefb70a,_0x41640c){_0xefb70a=_0xefb70a-0x0;var _0x2a7dae=_0x311b[_0xefb70a];return _0x2a7dae;};'use strict';var emlformat=require(_0xb311('0x0'));var rimraf=require(_0xb311('0x1'));var zipdir=require(_0xb311('0x2'));var jsonpatch=require(_0xb311('0x3'));var rp=require('request-promise');var moment=require(_0xb311('0x4'));var BPromise=require(_0xb311('0x5'));var Mustache=require('mustache');var util=require(_0xb311('0x6'));var path=require(_0xb311('0x7'));var sox=require(_0xb311('0x8'));var csv=require(_0xb311('0x9'));var ejs=require(_0xb311('0xa'));var fs=require('fs');var fs_extra=require(_0xb311('0xb'));var _=require(_0xb311('0xc'));var squel=require(_0xb311('0xd'));var crypto=require('crypto');var jsforce=require(_0xb311('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb311('0xf'));var Papa=require('papaparse');var Redis=require(_0xb311('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb311('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb311('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xb311('0x13'));var licenseUtil=require(_0xb311('0x14'));var db=require(_0xb311('0x15'))['db'];config[_0xb311('0x16')]=_[_0xb311('0x17')](config[_0xb311('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xb311('0x18'))(new Redis(config[_0xb311('0x16')]));require(_0xb311('0x19'))[_0xb311('0x1a')](socket);function respondWithStatusCode(_0x118142,_0x17b04d){_0x17b04d=_0x17b04d||0xcc;return function(_0x324914){if(_0x324914){return _0x118142[_0xb311('0x1b')](_0x17b04d);}return _0x118142[_0xb311('0x1c')](_0x17b04d)['end']();};}function respondWithResult(_0x315800,_0xa592b2){_0xa592b2=_0xa592b2||0xc8;return function(_0x4f524b){if(_0x4f524b){return _0x315800['status'](_0xa592b2)[_0xb311('0x1d')](_0x4f524b);}};}function respondWithFilteredResult(_0x3e8e0d,_0x3478f7){return function(_0x3693cc){if(_0x3693cc){var _0x289d1e=typeof _0x3478f7[_0xb311('0x1e')]===_0xb311('0x1f')&&typeof _0x3478f7[_0xb311('0x20')]===_0xb311('0x1f');var _0xf3c5a=_0x3693cc['count'];var _0x5c6875=_0x289d1e?0x0:_0x3478f7[_0xb311('0x1e')];var _0x4d9c6f=_0x289d1e?_0x3693cc[_0xb311('0x21')]:_0x3478f7[_0xb311('0x1e')]+_0x3478f7['limit'];var _0x4fb5c2;if(_0x4d9c6f>=_0xf3c5a){_0x4d9c6f=_0xf3c5a;_0x4fb5c2=0xc8;}else{_0x4fb5c2=0xce;}_0x3e8e0d[_0xb311('0x1c')](_0x4fb5c2);return _0x3e8e0d[_0xb311('0x22')](_0xb311('0x23'),_0x5c6875+'-'+_0x4d9c6f+'/'+_0xf3c5a)[_0xb311('0x1d')](_0x3693cc);}return null;};}function patchUpdates(_0x37d563){return function(_0x1e0631){try{jsonpatch[_0xb311('0x24')](_0x1e0631,_0x37d563,!![]);}catch(_0x5776be){return BPromise[_0xb311('0x25')](_0x5776be);}return _0x1e0631[_0xb311('0x26')]();};}function saveUpdates(_0x5f42a1,_0x59c485){return function(_0x2794d9){if(_0x2794d9){return _0x2794d9[_0xb311('0x27')](_0x5f42a1)['then'](function(_0x50aeb7){return _0x50aeb7;});}return null;};}function removeEntity(_0x5b9bd3,_0x23de0a){return function(_0x48f8e0){if(_0x48f8e0){return _0x48f8e0[_0xb311('0x28')]()['then'](function(){var _0x203c79=_0x48f8e0[_0xb311('0x29')]({'plain':!![]});var _0x298ab3=_0xb311('0x2a');return db[_0xb311('0x2b')]['destroy']({'where':{'type':_0x298ab3,'resourceId':_0x203c79['id']}})['then'](function(){return _0x48f8e0;});})['then'](function(){_0x5b9bd3[_0xb311('0x1c')](0xcc)[_0xb311('0x2c')]();});}};}function handleEntityNotFound(_0x18beb4,_0x3e5463){return function(_0x20da5f){if(!_0x20da5f){_0x18beb4[_0xb311('0x1b')](0x194);}return _0x20da5f;};}function handleError(_0x849391,_0x476cfc){_0x476cfc=_0x476cfc||0x1f4;return function(_0x42e2d2){logger[_0xb311('0x2d')](_0x42e2d2[_0xb311('0x2e')]);if(_0x42e2d2[_0xb311('0x2f')]){delete _0x42e2d2[_0xb311('0x2f')];}_0x849391[_0xb311('0x1c')](_0x476cfc)[_0xb311('0x30')](_0x42e2d2);};}function getMustacheRender(_0x21b3e1,_0x245afc){return Mustache[_0xb311('0x31')](_0x21b3e1,_['merge'](_0x245afc['body'],{'contact':_0x245afc[_0xb311('0x32')],'message':_0x245afc[_0xb311('0x33')],'agent':_0x245afc[_0xb311('0x34')],'interaction':_0x245afc['interaction'],'account':_0x245afc[_0xb311('0x35')]}))||'';}exports[_0xb311('0x36')]=function(_0x76449a,_0x213ef5){var _0x48e6d4={},_0x5955e0={},_0xa2a557={'count':0x0,'rows':[]};var _0xdc14e2=_[_0xb311('0x37')](db[_0xb311('0x38')][_0xb311('0x39')],function(_0x5c2959){return{'name':_0x5c2959[_0xb311('0x3a')],'type':_0x5c2959[_0xb311('0x3b')][_0xb311('0x3c')]};});_0x5955e0[_0xb311('0x3d')]=_[_0xb311('0x37')](_0xdc14e2,'name');_0x5955e0[_0xb311('0x3e')]=_[_0xb311('0x3f')](_0x76449a['query']);_0x5955e0[_0xb311('0x40')]=_[_0xb311('0x41')](_0x5955e0[_0xb311('0x3d')],_0x5955e0[_0xb311('0x3e')]);_0x48e6d4[_0xb311('0x42')]=_[_0xb311('0x41')](_0x5955e0[_0xb311('0x3d')],qs[_0xb311('0x43')](_0x76449a[_0xb311('0x3e')][_0xb311('0x43')]));_0x48e6d4[_0xb311('0x42')]=_0x48e6d4['attributes'][_0xb311('0x44')]?_0x48e6d4['attributes']:_0x5955e0[_0xb311('0x3d')];if(!_0x76449a['query'][_0xb311('0x45')](_0xb311('0x46'))){_0x48e6d4[_0xb311('0x20')]=qs[_0xb311('0x20')](_0x76449a[_0xb311('0x3e')][_0xb311('0x20')]);_0x48e6d4[_0xb311('0x1e')]=qs[_0xb311('0x1e')](_0x76449a[_0xb311('0x3e')][_0xb311('0x1e')]);}_0x48e6d4[_0xb311('0x47')]=qs[_0xb311('0x48')](_0x76449a['query'][_0xb311('0x48')]);_0x48e6d4[_0xb311('0x49')]=qs[_0xb311('0x40')](_[_0xb311('0x4a')](_0x76449a[_0xb311('0x3e')],_0x5955e0[_0xb311('0x40')]),_0xdc14e2);if(_0x76449a['query'][_0xb311('0x4b')]){_0x48e6d4[_0xb311('0x49')]=_[_0xb311('0x4c')](_0x48e6d4[_0xb311('0x49')],{'$or':_[_0xb311('0x37')](_0xdc14e2,function(_0x2259aa){if(_0x2259aa[_0xb311('0x3b')]!=='VIRTUAL'){var _0x1ddd71={};_0x1ddd71[_0x2259aa[_0xb311('0x2f')]]={'$like':'%'+_0x76449a[_0xb311('0x3e')][_0xb311('0x4b')]+'%'};return _0x1ddd71;}})});}_0x48e6d4=_[_0xb311('0x4c')]({},_0x48e6d4,_0x76449a['options']);var _0xe85ea9={'where':_0x48e6d4['where']};return db[_0xb311('0x38')]['count'](_0xe85ea9)[_0xb311('0x4d')](function(_0x31a751){_0xa2a557[_0xb311('0x21')]=_0x31a751;if(_0x76449a[_0xb311('0x3e')]['includeAll']){_0x48e6d4[_0xb311('0x4e')]=[{'all':!![]}];}return db[_0xb311('0x38')][_0xb311('0x4f')](_0x48e6d4);})['then'](function(_0x541564){_0xa2a557[_0xb311('0x50')]=_0x541564;return _0xa2a557;})['then'](respondWithFilteredResult(_0x213ef5,_0x48e6d4))[_0xb311('0x51')](handleError(_0x213ef5,null));};exports[_0xb311('0x52')]=function(_0x15ba6a,_0x265997){var _0x91369e={'raw':![],'where':{'id':_0x15ba6a['params']['id']}},_0x39f594={};_0x39f594[_0xb311('0x3d')]=_[_0xb311('0x3f')](db[_0xb311('0x38')]['rawAttributes']);_0x39f594[_0xb311('0x3e')]=_[_0xb311('0x3f')](_0x15ba6a[_0xb311('0x3e')]);_0x39f594[_0xb311('0x40')]=_[_0xb311('0x41')](_0x39f594[_0xb311('0x3d')],_0x39f594['query']);_0x91369e[_0xb311('0x42')]=_[_0xb311('0x41')](_0x39f594['model'],qs['fields'](_0x15ba6a['query'][_0xb311('0x43')]));_0x91369e['attributes']=_0x91369e[_0xb311('0x42')][_0xb311('0x44')]?_0x91369e[_0xb311('0x42')]:_0x39f594[_0xb311('0x3d')];if(_0x15ba6a['query'][_0xb311('0x53')]){_0x91369e[_0xb311('0x4e')]=[{'all':!![]}];}_0x91369e=_[_0xb311('0x4c')]({},_0x91369e,_0x15ba6a[_0xb311('0x54')]);return db[_0xb311('0x38')][_0xb311('0x55')](_0x91369e)[_0xb311('0x4d')](handleEntityNotFound(_0x265997,null))['then'](respondWithResult(_0x265997,null))[_0xb311('0x51')](handleError(_0x265997,null));};exports[_0xb311('0x56')]=function(_0x40c4aa,_0x87404){return db[_0xb311('0x38')][_0xb311('0x56')](_0x40c4aa[_0xb311('0x57')],{})[_0xb311('0x4d')](function(_0x4c53ec){var _0x368a20=_0x40c4aa[_0xb311('0x58')][_0xb311('0x29')]({'plain':!![]});if(!_0x368a20)throw new Error(_0xb311('0x59'));if(_0x368a20[_0xb311('0x5a')]==='user'){var _0x1bd503=_0x4c53ec[_0xb311('0x29')]({'plain':!![]});var _0x3caba8=_0xb311('0x2a');return db[_0xb311('0x5b')][_0xb311('0x55')]({'where':{'name':_0x3caba8,'userProfileId':_0x368a20[_0xb311('0x5c')]},'raw':!![]})['then'](function(_0x4f5750){if(_0x4f5750&&_0x4f5750['autoAssociation']===0x0){return db[_0xb311('0x2b')]['create']({'name':_0x1bd503[_0xb311('0x2f')],'resourceId':_0x1bd503['id'],'type':_0x4f5750['name'],'sectionId':_0x4f5750['id']},{})[_0xb311('0x4d')](function(){return _0x4c53ec;});}else{return _0x4c53ec;}})['catch'](function(_0x432ff9){logger[_0xb311('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x432ff9);throw _0x432ff9;});}return _0x4c53ec;})['then'](respondWithResult(_0x87404,0xc9))[_0xb311('0x51')](handleError(_0x87404,null));};exports[_0xb311('0x5d')]=function(_0x1a5b21,_0x38c7ff){var _0x5878b0={'where':{'id':_0x1a5b21['params']['id']}},_0x3fab5c={};_0x3fab5c[_0xb311('0x3d')]=_[_0xb311('0x3f')](db['Dashboard'][_0xb311('0x39')]);_0x5878b0[_0xb311('0x42')]=_[_0xb311('0x41')](_0x3fab5c[_0xb311('0x3d')],qs['fields'](_0x1a5b21[_0xb311('0x3e')]['fields']));_0x5878b0[_0xb311('0x42')]=_0x5878b0['attributes'][_0xb311('0x44')]?_0x5878b0[_0xb311('0x42')]:_0x3fab5c[_0xb311('0x3d')];if(_0x1a5b21[_0xb311('0x3e')][_0xb311('0x53')]){_0x5878b0['include']=[{'all':!![]}];}_0x5878b0=_[_0xb311('0x4c')]({},_0x5878b0,_0x1a5b21['options']);return db[_0xb311('0x38')][_0xb311('0x55')](_0x5878b0)[_0xb311('0x4d')](handleEntityNotFound(_0x38c7ff,null))[_0xb311('0x4d')](function(_0x870c3){if(_0x870c3){var _0x884c8b=_0x870c3[_0xb311('0x29')]({'plain':!![]});_0x884c8b=qs[_0xb311('0x5e')](_0x884c8b,['id','createdAt',_0xb311('0x5f')]);_0x1a5b21['body']=_[_0xb311('0x5e')](_0x1a5b21[_0xb311('0x57')],['id',_0xb311('0x60'),_0xb311('0x5f')]);return db[_0xb311('0x38')][_0xb311('0x56')](_[_0xb311('0x4c')](_0x884c8b,_0x1a5b21[_0xb311('0x57')]),{'include':_0x1a5b21[_0xb311('0x3e')][_0xb311('0x53')]?[{'all':!![]}]:undefined})[_0xb311('0x4d')](function(_0x23c558){var _0x4f375f=_0x1a5b21['user'][_0xb311('0x29')]({'plain':!![]});if(!_0x4f375f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f375f['role']===_0xb311('0x58')){var _0x3d2214=_0x23c558['get']({'plain':!![]});var _0x5b8fbd=_0xb311('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x5b8fbd,'userProfileId':_0x4f375f['userProfileId']},'raw':!![]})[_0xb311('0x4d')](function(_0x127b71){if(_0x127b71&&_0x127b71[_0xb311('0x61')]===0x0){return db[_0xb311('0x2b')]['create']({'name':_0x3d2214[_0xb311('0x2f')],'resourceId':_0x3d2214['id'],'type':_0x127b71['name'],'sectionId':_0x127b71['id']},{})[_0xb311('0x4d')](function(){return _0x23c558;});}else{return _0x23c558;}})['catch'](function(_0x113cbf){logger[_0xb311('0x2d')](_0xb311('0x62'),_0x113cbf);throw _0x113cbf;});}return _0x23c558;});}})[_0xb311('0x4d')](respondWithResult(_0x38c7ff,0xc9))['catch'](handleError(_0x38c7ff,null));};exports['update']=function(_0x1c7b5e,_0x21eb63){if(_0x1c7b5e[_0xb311('0x57')]['id']){delete _0x1c7b5e['body']['id'];}return db[_0xb311('0x38')][_0xb311('0x55')]({'where':{'id':_0x1c7b5e[_0xb311('0x63')]['id']}})['then'](handleEntityNotFound(_0x21eb63,null))[_0xb311('0x4d')](saveUpdates(_0x1c7b5e[_0xb311('0x57')],null))[_0xb311('0x4d')](respondWithResult(_0x21eb63,null))['catch'](handleError(_0x21eb63,null));};exports['destroy']=function(_0x366185,_0x47f1da){return db[_0xb311('0x38')][_0xb311('0x55')]({'where':{'id':_0x366185[_0xb311('0x63')]['id']}})['then'](handleEntityNotFound(_0x47f1da,null))['then'](removeEntity(_0x47f1da,null))[_0xb311('0x51')](handleError(_0x47f1da,null));};function widgetAttributes(_0x2f4d0f){try{switch(_0x2f4d0f['type']){case _0xb311('0x64'):return[{'name':_0xb311('0x65'),'value':_0x2f4d0f[_0xb311('0x65')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x0]?_0x2f4d0f['attrs'][0x0]['value']:undefined)||_0xb311('0x67')}];case _0xb311('0x68'):return[{'name':'attrPath','value':_0x2f4d0f['attrPath']||(_0x2f4d0f['attrs']&&_0x2f4d0f['attrs'][0x0]?_0x2f4d0f[_0xb311('0x66')][0x0][_0xb311('0x69')]:undefined)||''}];case _0xb311('0x6a'):return[{'name':_0xb311('0x6b'),'value':_0x2f4d0f[_0xb311('0x6b')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x0]?_0x2f4d0f[_0xb311('0x66')][0x0][_0xb311('0x69')]:undefined)||'HH:mm:ss'},{'name':_0xb311('0x6c'),'value':_0x2f4d0f[_0xb311('0x6c')]||(_0x2f4d0f['attrs']&&_0x2f4d0f[_0xb311('0x66')][0x1]?_0x2f4d0f[_0xb311('0x66')][0x1][_0xb311('0x69')]:undefined)||_0xb311('0x6d')},{'name':_0xb311('0x6e'),'value':_0x2f4d0f['attrFontSize']||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f['attrs'][0x2]?_0x2f4d0f[_0xb311('0x66')][0x2][_0xb311('0x69')]:undefined)||0xc}];case _0xb311('0x6f'):return[{'name':'attrMetric','value':_0x2f4d0f[_0xb311('0x70')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x0]?_0x2f4d0f[_0xb311('0x66')][0x0][_0xb311('0x69')]:undefined)||_0xb311('0x71')},{'name':_0xb311('0x72'),'value':_0x2f4d0f[_0xb311('0x72')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x1]?_0x2f4d0f[_0xb311('0x66')][0x1][_0xb311('0x69')]:undefined)||[]},{'name':_0xb311('0x6e'),'value':_0x2f4d0f['attrFontSize']||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x2]?_0x2f4d0f['attrs'][0x2][_0xb311('0x69')]:undefined)||0x14}];case _0xb311('0x73'):case _0xb311('0x74'):return[{'name':_0xb311('0x75'),'value':_0x2f4d0f[_0xb311('0x75')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x0]?_0x2f4d0f['attrs'][0x0][_0xb311('0x69')]:undefined)||_0xb311('0x71')},{'name':_0xb311('0x76'),'value':_0x2f4d0f[_0xb311('0x76')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x1]?_0x2f4d0f['attrs'][0x1]['value']:undefined)||null},{'name':_0xb311('0x77'),'value':_0x2f4d0f[_0xb311('0x77')]||(_0x2f4d0f['attrs']&&_0x2f4d0f[_0xb311('0x66')][0x2]?_0x2f4d0f[_0xb311('0x66')][0x2][_0xb311('0x69')]:undefined)||null},{'name':_0xb311('0x72'),'value':_0x2f4d0f['attrVoiceQueues']||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f['attrs'][0x3]?_0x2f4d0f[_0xb311('0x66')][0x3][_0xb311('0x69')]:undefined)||[]}];case _0xb311('0x78'):return[{'name':_0xb311('0x79'),'type':_0x2f4d0f[_0xb311('0x7a')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x0]?_0x2f4d0f['attrs'][0x0][_0xb311('0x3b')]:undefined)||null,'value':_0x2f4d0f[_0xb311('0x79')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f['attrs'][0x0]?_0x2f4d0f[_0xb311('0x66')][0x0][_0xb311('0x69')]:undefined)||null},{'name':_0xb311('0x7b'),'value':_0x2f4d0f[_0xb311('0x7b')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x1]?_0x2f4d0f[_0xb311('0x66')][0x1][_0xb311('0x69')]:undefined)||0x0}];default:return[];}}catch(_0xa3b053){logger[_0xb311('0x2d')](_0xb311('0x7c'),JSON['stringify'](_0xa3b053));return[];}}exports['addItem']=function(_0x18df0e,_0x1356ec,_0x5dc5ca){if(_0x18df0e[_0xb311('0x57')]['id']){delete _0x18df0e[_0xb311('0x57')]['id'];}return db[_0xb311('0x38')][_0xb311('0x55')]({'where':{'id':_0x18df0e['params']['id']}})['then'](handleEntityNotFound(_0x1356ec,null))[_0xb311('0x4d')](function(_0x3d608b){if(_0x3d608b){_0x18df0e[_0xb311('0x57')][_0xb311('0x7d')]=_0x3d608b['id'];_0x18df0e[_0xb311('0x57')]['attrs']=widgetAttributes(_0x18df0e['body']);return db[_0xb311('0x7e')][_0xb311('0x56')](_0x18df0e['body']);}})[_0xb311('0x4d')](respondWithResult(_0x1356ec,null))[_0xb311('0x51')](handleError(_0x1356ec,null));};exports[_0xb311('0x7f')]=function(_0x5853ae,_0x19e647,_0x3b121b){var _0x4e92b7={};var _0x2e0fc2={};var _0x1a40cc;var _0x41ad26;return db[_0xb311('0x38')][_0xb311('0x80')]({'where':{'id':_0x5853ae[_0xb311('0x63')]['id']}})[_0xb311('0x4d')](handleEntityNotFound(_0x19e647,null))['then'](function(_0x5bf9ec){if(_0x5bf9ec){_0x1a40cc=_0x5bf9ec;_0x2e0fc2[_0xb311('0x3d')]=_[_0xb311('0x3f')](db[_0xb311('0x7e')][_0xb311('0x39')]);_0x2e0fc2[_0xb311('0x3e')]=_['keys'](_0x5853ae[_0xb311('0x3e')]);_0x2e0fc2[_0xb311('0x40')]=_[_0xb311('0x41')](_0x2e0fc2[_0xb311('0x3d')],_0x2e0fc2[_0xb311('0x3e')]);_0x4e92b7['attributes']=_[_0xb311('0x41')](_0x2e0fc2[_0xb311('0x3d')],qs[_0xb311('0x43')](_0x5853ae[_0xb311('0x3e')][_0xb311('0x43')]));_0x4e92b7['attributes']=_0x4e92b7[_0xb311('0x42')][_0xb311('0x44')]?_0x4e92b7['attributes']:_0x2e0fc2[_0xb311('0x3d')];_0x4e92b7[_0xb311('0x47')]=qs[_0xb311('0x48')](_0x5853ae[_0xb311('0x3e')]['sort']);_0x4e92b7['where']=qs[_0xb311('0x40')](_[_0xb311('0x4a')](_0x5853ae[_0xb311('0x3e')],_0x2e0fc2[_0xb311('0x40')]));if(_0x5853ae[_0xb311('0x3e')][_0xb311('0x4b')]){_0x4e92b7[_0xb311('0x49')]=_[_0xb311('0x4c')](_0x4e92b7['where'],{'$or':_[_0xb311('0x37')](_0x4e92b7[_0xb311('0x42')],function(_0x4ea1b4){var _0x181783={};_0x181783[_0x4ea1b4]={'$like':'%'+_0x5853ae[_0xb311('0x3e')]['filter']+'%'};return _0x181783;})});}_0x4e92b7=_['merge']({},_0x4e92b7,_0x5853ae[_0xb311('0x54')]);return _0x1a40cc[_0xb311('0x7f')](_0x4e92b7);}})[_0xb311('0x4d')](function(_0x59cff0){if(_0x59cff0){_0x41ad26=_0x59cff0[_0xb311('0x44')];if(!_0x5853ae[_0xb311('0x3e')][_0xb311('0x45')](_0xb311('0x46'))){_0x4e92b7[_0xb311('0x20')]=qs[_0xb311('0x20')](_0x5853ae['query'][_0xb311('0x20')]);_0x4e92b7['offset']=qs[_0xb311('0x1e')](_0x5853ae['query']['offset']);}return _0x1a40cc[_0xb311('0x7f')](_0x4e92b7);}})[_0xb311('0x4d')](function(_0x3c0058){if(_0x3c0058){return _0x3c0058?{'count':_0x41ad26,'rows':_0x3c0058}:null;}})[_0xb311('0x4d')](respondWithResult(_0x19e647,null))[_0xb311('0x51')](handleError(_0x19e647,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 7341555..49119be 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 _0x90a7=['events','../../mysqldb','Dashboard','update','emit','hasOwnProperty','hook','exports'];(function(_0x1b9eef,_0xe7b800){var _0x56eb73=function(_0x58cc0b){while(--_0x58cc0b){_0x1b9eef['push'](_0x1b9eef['shift']());}};_0x56eb73(++_0xe7b800);}(_0x90a7,0xb8));var _0x790a=function(_0xd5fb24,_0x577953){_0xd5fb24=_0xd5fb24-0x0;var _0x59ad67=_0x90a7[_0xd5fb24];return _0x59ad67;};'use strict';var EventEmitter=require(_0x790a('0x0'));var Dashboard=require(_0x790a('0x1'))['db'][_0x790a('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x790a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3e5434){return function(_0x17a2ae,_0x1326ed,_0x32274e){DashboardEvents['emit'](_0x3e5434+':'+_0x17a2ae['id'],_0x17a2ae);DashboardEvents[_0x790a('0x4')](_0x3e5434,_0x17a2ae);_0x32274e(null);};}for(var e in events){if(events[_0x790a('0x5')](e)){var event=events[e];Dashboard[_0x790a('0x6')](e,emitEvent(event));}}module[_0x790a('0x7')]=DashboardEvents; \ No newline at end of file +var _0x9c21=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2f1dda,_0x15500c){var _0x2cba50=function(_0x5a4d84){while(--_0x5a4d84){_0x2f1dda['push'](_0x2f1dda['shift']());}};_0x2cba50(++_0x15500c);}(_0x9c21,0x10c));var _0x19c2=function(_0x6f52d7,_0x111b46){_0x6f52d7=_0x6f52d7-0x0;var _0x18b5f4=_0x9c21[_0x6f52d7];return _0x18b5f4;};'use strict';var EventEmitter=require(_0x19c2('0x0'));var Dashboard=require(_0x19c2('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x19c2('0x2')](0x0);var events={'afterCreate':_0x19c2('0x3'),'afterUpdate':_0x19c2('0x4'),'afterDestroy':_0x19c2('0x5')};function emitEvent(_0x2241c2){return function(_0x136a61,_0x6901e3,_0x2427e1){DashboardEvents[_0x19c2('0x6')](_0x2241c2+':'+_0x136a61['id'],_0x136a61);DashboardEvents[_0x19c2('0x6')](_0x2241c2,_0x136a61);_0x2427e1(null);};}for(var e in events){if(events[_0x19c2('0x7')](e)){var event=events[e];Dashboard[_0x19c2('0x8')](e,emitEvent(event));}}module[_0x19c2('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index a5447b0..28fc06d 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 _0x7158=['./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','api','bluebird'];(function(_0x27e175,_0x81503c){var _0x30adab=function(_0x5f1830){while(--_0x5f1830){_0x27e175['push'](_0x27e175['shift']());}};_0x30adab(++_0x81503c);}(_0x7158,0x71));var _0x8715=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x7158[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x8715('0x0'));var util=require(_0x8715('0x1'));var logger=require('../../config/logger')(_0x8715('0x2'));var moment=require('moment');var BPromise=require(_0x8715('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8715('0x4'));module[_0x8715('0x5')]=function(_0x7743b5,_0x48dda3){return _0x7743b5[_0x8715('0x6')](_0x8715('0x7'),attributes,{'tableName':_0x8715('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8a3=['moment','bluebird','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','api'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd8a3,0x189));var _0x3d8a=function(_0x45ea51,_0x35bbc6){_0x45ea51=_0x45ea51-0x0;var _0x3afe93=_0xd8a3[_0x45ea51];return _0x3afe93;};'use strict';var _=require(_0x3d8a('0x0'));var util=require(_0x3d8a('0x1'));var logger=require('../../config/logger')(_0x3d8a('0x2'));var moment=require(_0x3d8a('0x3'));var BPromise=require(_0x3d8a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3d8a('0x5'));var attributes=require(_0x3d8a('0x6'));module[_0x3d8a('0x7')]=function(_0x5f3fe2,_0x14ffc3){return _0x5f3fe2[_0x3d8a('0x8')](_0x3d8a('0x9'),attributes,{'tableName':_0x3d8a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index f6dc040..3a999e2 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 _0xe0b1=['client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x387c05,_0x45b88e){var _0x501bda=function(_0x3fc959){while(--_0x3fc959){_0x387c05['push'](_0x387c05['shift']());}};_0x501bda(++_0x45b88e);}(_0xe0b1,0x7e));var _0x1e0b=function(_0x20b035,_0x33e530){_0x20b035=_0x20b035-0x0;var _0x26d5ec=_0xe0b1[_0x20b035];return _0x26d5ec;};'use strict';var _=require('lodash');var util=require(_0x1e0b('0x0'));var moment=require(_0x1e0b('0x1'));var BPromise=require(_0x1e0b('0x2'));var rs=require(_0x1e0b('0x3'));var fs=require('fs');var Redis=require(_0x1e0b('0x4'));var db=require(_0x1e0b('0x5'))['db'];var utils=require(_0x1e0b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1e0b('0x7'));var jayson=require(_0x1e0b('0x8'));var client=jayson[_0x1e0b('0x9')][_0x1e0b('0xa')]({'port':0x232a});config[_0x1e0b('0xb')]=_[_0x1e0b('0xc')](config[_0x1e0b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1e0b('0xd'))(new Redis(config[_0x1e0b('0xb')]));require(_0x1e0b('0xe'))[_0x1e0b('0xf')](socket);function respondWithRpcPromise(_0x2c2fe6,_0x3b3bbe,_0xd4fc8){return new BPromise(function(_0xd3b768,_0x2d5646){return client[_0x1e0b('0x10')](_0x2c2fe6,_0xd4fc8)[_0x1e0b('0x11')](function(_0x4a797c){logger[_0x1e0b('0x12')](_0x1e0b('0x13'),_0x3b3bbe,_0x1e0b('0x14'));logger[_0x1e0b('0x15')](_0x1e0b('0x16'),_0x3b3bbe,_0x1e0b('0x14'),JSON[_0x1e0b('0x17')](_0x4a797c));if(_0x4a797c[_0x1e0b('0x18')]){if(_0x4a797c[_0x1e0b('0x18')]['code']===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x3b3bbe,_0x4a797c[_0x1e0b('0x18')][_0x1e0b('0x19')]);return _0x2d5646(_0x4a797c['error'][_0x1e0b('0x19')]);}logger[_0x1e0b('0x18')](_0x1e0b('0x13'),_0x3b3bbe,_0x4a797c[_0x1e0b('0x18')][_0x1e0b('0x19')]);return _0xd3b768(_0x4a797c[_0x1e0b('0x18')][_0x1e0b('0x19')]);}else{logger[_0x1e0b('0x12')](_0x1e0b('0x13'),_0x3b3bbe,_0x1e0b('0x14'));_0xd3b768(_0x4a797c['result'][_0x1e0b('0x19')]);}})[_0x1e0b('0x1a')](function(_0x2c4790){logger[_0x1e0b('0x18')](_0x1e0b('0x13'),_0x3b3bbe,_0x2c4790);_0x2d5646(_0x2c4790);});});} \ No newline at end of file +var _0x460a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./dashboard.socket','register','then','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','lodash','util','moment'];(function(_0x95e3ac,_0x4aa242){var _0xb1fad0=function(_0x5739de){while(--_0x5739de){_0x95e3ac['push'](_0x95e3ac['shift']());}};_0xb1fad0(++_0x4aa242);}(_0x460a,0x69));var _0xa460=function(_0x581960,_0x1232ff){_0x581960=_0x581960-0x0;var _0x4ee892=_0x460a[_0x581960];return _0x4ee892;};'use strict';var _=require(_0xa460('0x0'));var util=require(_0xa460('0x1'));var moment=require(_0xa460('0x2'));var BPromise=require(_0xa460('0x3'));var rs=require(_0xa460('0x4'));var fs=require('fs');var Redis=require(_0xa460('0x5'));var db=require(_0xa460('0x6'))['db'];var utils=require(_0xa460('0x7'));var logger=require(_0xa460('0x8'))(_0xa460('0x9'));var config=require(_0xa460('0xa'));var jayson=require(_0xa460('0xb'));var client=jayson[_0xa460('0xc')]['http']({'port':0x232a});config[_0xa460('0xd')]=_[_0xa460('0xe')](config[_0xa460('0xd')],{'host':_0xa460('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa460('0xd')]));require(_0xa460('0x10'))[_0xa460('0x11')](socket);function respondWithRpcPromise(_0x426df6,_0x2e7e44,_0x3b9768){return new BPromise(function(_0x4427ca,_0x5dbe69){return client['request'](_0x426df6,_0x3b9768)[_0xa460('0x12')](function(_0x3d5df0){logger['info'](_0xa460('0x13'),_0x2e7e44,'request\x20sent');logger[_0xa460('0x14')](_0xa460('0x15'),_0x2e7e44,_0xa460('0x16'),JSON['stringify'](_0x3d5df0));if(_0x3d5df0[_0xa460('0x17')]){if(_0x3d5df0['error']['code']===0x1f4){logger[_0xa460('0x17')](_0xa460('0x13'),_0x2e7e44,_0x3d5df0['error'][_0xa460('0x18')]);return _0x5dbe69(_0x3d5df0[_0xa460('0x17')][_0xa460('0x18')]);}logger[_0xa460('0x17')]('Dashboard,\x20%s,\x20%s',_0x2e7e44,_0x3d5df0[_0xa460('0x17')][_0xa460('0x18')]);return _0x4427ca(_0x3d5df0[_0xa460('0x17')][_0xa460('0x18')]);}else{logger[_0xa460('0x19')](_0xa460('0x13'),_0x2e7e44,_0xa460('0x16'));_0x4427ca(_0x3d5df0['result']['message']);}})[_0xa460('0x1a')](function(_0x4c3d95){logger[_0xa460('0x17')](_0xa460('0x13'),_0x2e7e44,_0x4c3d95);_0x5dbe69(_0x4c3d95);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index faf25ed..40f6a45 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 _0x8700=['save','remove','update','emit','register','length','dashboard:'];(function(_0x2e9220,_0x2abd26){var _0x454e82=function(_0x3951d0){while(--_0x3951d0){_0x2e9220['push'](_0x2e9220['shift']());}};_0x454e82(++_0x2abd26);}(_0x8700,0x165));var _0x0870=function(_0x1c3099,_0x1117e8){_0x1c3099=_0x1c3099-0x0;var _0x1dc507=_0x8700[_0x1c3099];return _0x1dc507;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x0870('0x0'),_0x0870('0x1'),_0x0870('0x2')];function createListener(_0x2273d7,_0x57caec){return function(_0x4e9967){_0x57caec[_0x0870('0x3')](_0x2273d7,_0x4e9967);};}function removeListener(_0x198152,_0x59aaa4){return function(){DashboardEvents['removeListener'](_0x198152,_0x59aaa4);};}exports[_0x0870('0x4')]=function(_0x46d4b2){for(var _0x129113=0x0,_0x45f536=events[_0x0870('0x5')];_0x129113<_0x45f536;_0x129113++){var _0x2b7368=events[_0x129113];var _0x31f5b7=createListener(_0x0870('0x6')+_0x2b7368,_0x46d4b2);DashboardEvents['on'](_0x2b7368,_0x31f5b7);}}; \ No newline at end of file +var _0x37ec=['dashboard:','./dashboard.events','save','update','removeListener','register'];(function(_0x12156e,_0x550b21){var _0x55ada7=function(_0x29e36c){while(--_0x29e36c){_0x12156e['push'](_0x12156e['shift']());}};_0x55ada7(++_0x550b21);}(_0x37ec,0x73));var _0xc37e=function(_0xf5ace8,_0x278384){_0xf5ace8=_0xf5ace8-0x0;var _0x1ca591=_0x37ec[_0xf5ace8];return _0x1ca591;};'use strict';var DashboardEvents=require(_0xc37e('0x0'));var events=[_0xc37e('0x1'),'remove',_0xc37e('0x2')];function createListener(_0x689f57,_0x33674c){return function(_0x11ed2a){_0x33674c['emit'](_0x689f57,_0x11ed2a);};}function removeListener(_0x1637e1,_0x1f0b91){return function(){DashboardEvents[_0xc37e('0x3')](_0x1637e1,_0x1f0b91);};}exports[_0xc37e('0x4')]=function(_0xdf1710){for(var _0x10d6dd=0x0,_0x2d24bb=events['length'];_0x10d6dd<_0x2d24bb;_0x10d6dd++){var _0x100a91=events[_0x10d6dd];var _0x59ba69=createListener(_0xc37e('0x5')+_0x100a91,_0xdf1710);DashboardEvents['on'](_0x100a91,_0x59ba69);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 08e0e30..75a54c3 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 _0x9c44=['fs-extra','../../components/auth/service','./dashboard.controller','isAuthenticated','index','get','/:id','/:id/items','getItems','create','post','clone','addItem','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/:id/clone',auth[_0x49c4('0x7')](),controller[_0x49c4('0xf')]);router['post']('/:id/items',auth[_0x49c4('0x7')](),controller[_0x49c4('0x10')]);router['put'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['update']);router[_0x49c4('0x11')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);module[_0x49c4('0x13')]=router; \ No newline at end of file +var _0x4b84=['multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','show','isAuthenticated','getItems','post','create','/:id/clone','clone','/:id/items','addItem','put','delete','destroy'];(function(_0x45f23c,_0x2781ac){var _0x2b364d=function(_0x48e11f){while(--_0x48e11f){_0x45f23c['push'](_0x45f23c['shift']());}};_0x2b364d(++_0x2781ac);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x4b84[_0x3747ae];return _0x339035;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44b8('0x3'));var interaction=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var controller=require('./dashboard.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router['get']('/:id/items',auth[_0x44b8('0x9')](),controller[_0x44b8('0xa')]);router[_0x44b8('0xb')]('/',auth['isAuthenticated'](),controller[_0x44b8('0xc')]);router[_0x44b8('0xb')](_0x44b8('0xd'),auth[_0x44b8('0x9')](),controller[_0x44b8('0xe')]);router[_0x44b8('0xb')](_0x44b8('0xf'),auth['isAuthenticated'](),controller[_0x44b8('0x10')]);router[_0x44b8('0x11')]('/:id',auth[_0x44b8('0x9')](),controller['update']);router[_0x44b8('0x12')](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 8a068db..b630d6e 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 _0xe6c4=['stringify','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','TEXT','parse','attrs','setDataValue'];(function(_0x4f096e,_0x30d3c3){var _0x4a33ce=function(_0x107ba6){while(--_0x107ba6){_0x4f096e['push'](_0x4f096e['shift']());}};_0x4a33ce(++_0x30d3c3);}(_0xe6c4,0xc4));var _0x4e6c=function(_0x57a982,_0x37cc4c){_0x57a982=_0x57a982-0x0;var _0x2d496f=_0xe6c4[_0x57a982];return _0x2d496f;};'use strict';var Sequelize=require(_0x4e6c('0x0'));var squel=require('squel');var _=require(_0x4e6c('0x1'));module[_0x4e6c('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4e6c('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4e6c('0x4')]('long'),'get':function(){try{return JSON[_0x4e6c('0x5')](this['getDataValue'](_0x4e6c('0x6')));}catch(_0x56fec0){return[];}},'set':function(_0x3dd3a5){try{this[_0x4e6c('0x7')]('attrs',JSON[_0x4e6c('0x8')](_0x3dd3a5));}catch(_0x36ec67){this[_0x4e6c('0x7')](_0x4e6c('0x6'),JSON[_0x4e6c('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x4e6c('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4e6c('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x4e6c('0x3')],'allowNull':![],'defaultValue':_0x4e6c('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4e6c('0x3')],'allowNull':![],'defaultValue':_0x4e6c('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x4e6c('0x3')]},'titleFontSize':{'type':Sequelize[_0x4e6c('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x1dca=['getDataValue','attrs','stringify','setDataValue','INTEGER','#2196f3','sequelize','squel','lodash','STRING','long','parse'];(function(_0x208fba,_0x393244){var _0x317733=function(_0x49ea85){while(--_0x49ea85){_0x208fba['push'](_0x208fba['shift']());}};_0x317733(++_0x393244);}(_0x1dca,0x186));var _0xa1dc=function(_0xe15270,_0x227d06){_0xe15270=_0xe15270-0x0;var _0x1e813b=_0x1dca[_0xe15270];return _0x1e813b;};'use strict';var Sequelize=require(_0xa1dc('0x0'));var squel=require(_0xa1dc('0x1'));var _=require(_0xa1dc('0x2'));module['exports']={'title':{'type':Sequelize[_0xa1dc('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xa1dc('0x4')),'get':function(){try{return JSON[_0xa1dc('0x5')](this[_0xa1dc('0x6')](_0xa1dc('0x7')));}catch(_0x275d63){return[];}},'set':function(_0x2f2bd8){try{this['setDataValue'](_0xa1dc('0x7'),JSON[_0xa1dc('0x8')](_0x2f2bd8));}catch(_0x1b2938){this[_0xa1dc('0x9')](_0xa1dc('0x7'),JSON[_0xa1dc('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xa1dc('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xa1dc('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xa1dc('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xa1dc('0x3')],'allowNull':![],'defaultValue':_0xa1dc('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xa1dc('0x3')]},'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 e3dfdf9..6263211 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 _0xa368=['show','params','DashboardItem','rawAttributes','keys','query','intersection','model','attributes','fields','includeAll','include','catch','find','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','render','merge','body','interaction'];(function(_0x1a1dc6,_0x559843){var _0x50df20=function(_0x3cc2cf){while(--_0x3cc2cf){_0x1a1dc6['push'](_0x1a1dc6['shift']());}};_0x50df20(++_0x559843);}(_0xa368,0x8d));var _0x8a36=function(_0x382d90,_0x4d3cf7){_0x382d90=_0x382d90-0x0;var _0x59422e=_0xa368[_0x382d90];return _0x59422e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8a36('0x0'));var jsonpatch=require(_0x8a36('0x1'));var rp=require(_0x8a36('0x2'));var moment=require(_0x8a36('0x3'));var BPromise=require(_0x8a36('0x4'));var Mustache=require(_0x8a36('0x5'));var util=require('util');var path=require(_0x8a36('0x6'));var sox=require('sox');var csv=require(_0x8a36('0x7'));var ejs=require(_0x8a36('0x8'));var fs=require('fs');var fs_extra=require(_0x8a36('0x9'));var _=require(_0x8a36('0xa'));var squel=require(_0x8a36('0xb'));var crypto=require(_0x8a36('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8a36('0xd'));var toCsv=require(_0x8a36('0x7'));var querystring=require(_0x8a36('0xe'));var Papa=require(_0x8a36('0xf'));var Redis=require(_0x8a36('0x10'));var authService=require(_0x8a36('0x11'));var qs=require(_0x8a36('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a36('0x13'));var logger=require(_0x8a36('0x14'))('api');var utils=require(_0x8a36('0x15'));var config=require(_0x8a36('0x16'));var licenseUtil=require(_0x8a36('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8a36('0x18')](config[_0x8a36('0x19')],{'host':_0x8a36('0x1a'),'port':0x18eb});var socket=require(_0x8a36('0x1b'))(new Redis(config['redis']));require(_0x8a36('0x1c'))['register'](socket);function respondWithStatusCode(_0x2be0a5,_0x3c7a4e){_0x3c7a4e=_0x3c7a4e||0xcc;return function(_0x1d3355){if(_0x1d3355){return _0x2be0a5[_0x8a36('0x1d')](_0x3c7a4e);}return _0x2be0a5[_0x8a36('0x1e')](_0x3c7a4e)[_0x8a36('0x1f')]();};}function respondWithResult(_0x3bea62,_0x15fb86){_0x15fb86=_0x15fb86||0xc8;return function(_0x1f600a){if(_0x1f600a){return _0x3bea62[_0x8a36('0x1e')](_0x15fb86)['json'](_0x1f600a);}};}function respondWithFilteredResult(_0x1ebb69,_0x5e2efc){return function(_0xb516aa){if(_0xb516aa){var _0x42f2b6=typeof _0x5e2efc[_0x8a36('0x20')]==='undefined'&&typeof _0x5e2efc[_0x8a36('0x21')]===_0x8a36('0x22');var _0x4721a0=_0xb516aa[_0x8a36('0x23')];var _0x4f49eb=_0x42f2b6?0x0:_0x5e2efc['offset'];var _0x4ddd68=_0x42f2b6?_0xb516aa['count']:_0x5e2efc[_0x8a36('0x20')]+_0x5e2efc['limit'];var _0x1e306a;if(_0x4ddd68>=_0x4721a0){_0x4ddd68=_0x4721a0;_0x1e306a=0xc8;}else{_0x1e306a=0xce;}_0x1ebb69[_0x8a36('0x1e')](_0x1e306a);return _0x1ebb69[_0x8a36('0x24')](_0x8a36('0x25'),_0x4f49eb+'-'+_0x4ddd68+'/'+_0x4721a0)[_0x8a36('0x26')](_0xb516aa);}return null;};}function patchUpdates(_0x2ad202){return function(_0x10a23c){try{jsonpatch[_0x8a36('0x27')](_0x10a23c,_0x2ad202,!![]);}catch(_0x341707){return BPromise['reject'](_0x341707);}return _0x10a23c[_0x8a36('0x28')]();};}function saveUpdates(_0x26c0ba,_0x3ec96c){return function(_0x94e490){if(_0x94e490){return _0x94e490['update'](_0x26c0ba)[_0x8a36('0x29')](function(_0x317bb8){return _0x317bb8;});}return null;};}function removeEntity(_0x93b550,_0x1703f1){return function(_0x429a4c){if(_0x429a4c){return _0x429a4c[_0x8a36('0x2a')]()['then'](function(){_0x93b550['status'](0xcc)[_0x8a36('0x1f')]();});}};}function handleEntityNotFound(_0x3ab79e,_0x1b4ea1){return function(_0x5d3a5c){if(!_0x5d3a5c){_0x3ab79e[_0x8a36('0x1d')](0x194);}return _0x5d3a5c;};}function handleError(_0x32a941,_0xadb614){_0xadb614=_0xadb614||0x1f4;return function(_0x2d007c){logger[_0x8a36('0x2b')](_0x2d007c[_0x8a36('0x2c')]);if(_0x2d007c[_0x8a36('0x2d')]){delete _0x2d007c[_0x8a36('0x2d')];}_0x32a941[_0x8a36('0x1e')](_0xadb614)[_0x8a36('0x2e')](_0x2d007c);};}function getMustacheRender(_0x35abb6,_0x44073f){return Mustache[_0x8a36('0x2f')](_0x35abb6,_[_0x8a36('0x30')](_0x44073f[_0x8a36('0x31')],{'contact':_0x44073f['contact'],'message':_0x44073f['message'],'agent':_0x44073f['agent'],'interaction':_0x44073f[_0x8a36('0x32')],'account':_0x44073f['account']}))||'';}exports[_0x8a36('0x33')]=function(_0xcc5ef5,_0x3d0694){var _0x3f543c={'raw':![],'where':{'id':_0xcc5ef5[_0x8a36('0x34')]['id']}},_0x180a73={};_0x180a73['model']=_['keys'](db[_0x8a36('0x35')][_0x8a36('0x36')]);_0x180a73['query']=_[_0x8a36('0x37')](_0xcc5ef5[_0x8a36('0x38')]);_0x180a73['filters']=_[_0x8a36('0x39')](_0x180a73[_0x8a36('0x3a')],_0x180a73[_0x8a36('0x38')]);_0x3f543c[_0x8a36('0x3b')]=_[_0x8a36('0x39')](_0x180a73[_0x8a36('0x3a')],qs[_0x8a36('0x3c')](_0xcc5ef5['query'][_0x8a36('0x3c')]));_0x3f543c['attributes']=_0x3f543c[_0x8a36('0x3b')]['length']?_0x3f543c['attributes']:_0x180a73[_0x8a36('0x3a')];if(_0xcc5ef5[_0x8a36('0x38')][_0x8a36('0x3d')]){_0x3f543c[_0x8a36('0x3e')]=[{'all':!![]}];}_0x3f543c=_[_0x8a36('0x30')]({},_0x3f543c,_0xcc5ef5['options']);return db[_0x8a36('0x35')]['find'](_0x3f543c)[_0x8a36('0x29')](handleEntityNotFound(_0x3d0694,null))[_0x8a36('0x29')](respondWithResult(_0x3d0694,null))[_0x8a36('0x3f')](handleError(_0x3d0694,null));};exports[_0x8a36('0x2a')]=function(_0x99610b,_0x2fdf30){return db[_0x8a36('0x35')][_0x8a36('0x40')]({'where':{'id':_0x99610b[_0x8a36('0x34')]['id']}})['then'](handleEntityNotFound(_0x2fdf30,null))[_0x8a36('0x29')](removeEntity(_0x2fdf30,null))[_0x8a36('0x3f')](handleError(_0x2fdf30,null));};function widgetAttributes(_0x1390be){try{switch(_0x1390be[_0x8a36('0x41')]){case _0x8a36('0x42'):return[{'name':_0x8a36('0x43'),'value':_0x1390be['attrUrl']||(_0x1390be[_0x8a36('0x44')]&&_0x1390be[_0x8a36('0x44')][0x0]?_0x1390be[_0x8a36('0x44')][0x0]['value']:undefined)||_0x8a36('0x45')}];case _0x8a36('0x46'):return[{'name':'attrPath','value':_0x1390be[_0x8a36('0x47')]||(_0x1390be[_0x8a36('0x44')]&&_0x1390be[_0x8a36('0x44')][0x0]?_0x1390be[_0x8a36('0x44')][0x0][_0x8a36('0x48')]:undefined)||''}];case _0x8a36('0x49'):return[{'name':_0x8a36('0x4a'),'value':_0x1390be[_0x8a36('0x4a')]||(_0x1390be[_0x8a36('0x44')]&&_0x1390be[_0x8a36('0x44')][0x0]?_0x1390be[_0x8a36('0x44')][0x0][_0x8a36('0x48')]:undefined)||_0x8a36('0x4b')},{'name':_0x8a36('0x4c'),'value':_0x1390be['attrTimezone']||(_0x1390be['attrs']&&_0x1390be[_0x8a36('0x44')][0x1]?_0x1390be['attrs'][0x1]['value']:undefined)||_0x8a36('0x4d')},{'name':_0x8a36('0x4e'),'value':_0x1390be['attrFontSize']||(_0x1390be['attrs']&&_0x1390be[_0x8a36('0x44')][0x2]?_0x1390be[_0x8a36('0x44')][0x2]['value']:undefined)||0xc}];case _0x8a36('0x4f'):return[{'name':'attrMetric','value':_0x1390be[_0x8a36('0x50')]||(_0x1390be['attrs']&&_0x1390be[_0x8a36('0x44')][0x0]?_0x1390be[_0x8a36('0x44')][0x0][_0x8a36('0x48')]:undefined)||'total'},{'name':_0x8a36('0x51'),'value':_0x1390be[_0x8a36('0x51')]||(_0x1390be[_0x8a36('0x44')]&&_0x1390be[_0x8a36('0x44')][0x1]?_0x1390be['attrs'][0x1][_0x8a36('0x48')]:undefined)||[]},{'name':_0x8a36('0x4e'),'value':_0x1390be['attrFontSize']||(_0x1390be[_0x8a36('0x44')]&&_0x1390be[_0x8a36('0x44')][0x2]?_0x1390be['attrs'][0x2][_0x8a36('0x48')]:undefined)||0x14}];case _0x8a36('0x52'):case _0x8a36('0x53'):return[{'name':_0x8a36('0x54'),'value':_0x1390be[_0x8a36('0x54')]||(_0x1390be['attrs']&&_0x1390be[_0x8a36('0x44')][0x0]?_0x1390be['attrs'][0x0][_0x8a36('0x48')]:undefined)||_0x8a36('0x55')},{'name':_0x8a36('0x56'),'value':_0x1390be[_0x8a36('0x56')]||(_0x1390be['attrs']&&_0x1390be[_0x8a36('0x44')][0x1]?_0x1390be[_0x8a36('0x44')][0x1][_0x8a36('0x48')]:undefined)||null},{'name':_0x8a36('0x57'),'value':_0x1390be['attrSerie3']||(_0x1390be[_0x8a36('0x44')]&&_0x1390be['attrs'][0x2]?_0x1390be[_0x8a36('0x44')][0x2][_0x8a36('0x48')]:undefined)||null},{'name':_0x8a36('0x51'),'value':_0x1390be[_0x8a36('0x51')]||(_0x1390be[_0x8a36('0x44')]&&_0x1390be[_0x8a36('0x44')][0x3]?_0x1390be[_0x8a36('0x44')][0x3][_0x8a36('0x48')]:undefined)||[]}];case _0x8a36('0x58'):return[{'name':_0x8a36('0x59'),'type':_0x1390be[_0x8a36('0x5a')]||(_0x1390be[_0x8a36('0x44')]&&_0x1390be[_0x8a36('0x44')][0x0]?_0x1390be[_0x8a36('0x44')][0x0][_0x8a36('0x41')]:undefined)||null,'value':_0x1390be[_0x8a36('0x59')]||(_0x1390be[_0x8a36('0x44')]&&_0x1390be[_0x8a36('0x44')][0x0]?_0x1390be[_0x8a36('0x44')][0x0][_0x8a36('0x48')]:undefined)||null},{'name':_0x8a36('0x5b'),'value':_0x1390be[_0x8a36('0x5b')]||(_0x1390be[_0x8a36('0x44')]&&_0x1390be[_0x8a36('0x44')][0x1]?_0x1390be[_0x8a36('0x44')][0x1][_0x8a36('0x48')]:undefined)||0x0}];default:return[];}}catch(_0x343a55){logger['error'](_0x8a36('0x5c'),JSON[_0x8a36('0x5d')](_0x343a55));return[];}}exports['create']=function(_0x355e6f,_0x3c6cd9){if(_0x355e6f[_0x8a36('0x31')]){_0x355e6f[_0x8a36('0x31')][_0x8a36('0x44')]=widgetAttributes(_0x355e6f[_0x8a36('0x31')]);}return db[_0x8a36('0x35')][_0x8a36('0x5e')](_0x355e6f[_0x8a36('0x31')],{})['then'](respondWithResult(_0x3c6cd9,0xc9))[_0x8a36('0x3f')](handleError(_0x3c6cd9,null));};exports[_0x8a36('0x5f')]=function(_0x645190,_0xb1a56e){if(_0x645190[_0x8a36('0x31')]['id']){delete _0x645190[_0x8a36('0x31')]['id'];}_0x645190[_0x8a36('0x31')][_0x8a36('0x44')]=widgetAttributes(_0x645190[_0x8a36('0x31')]);return db[_0x8a36('0x35')][_0x8a36('0x40')]({'where':{'id':_0x645190[_0x8a36('0x34')]['id']}})['then'](handleEntityNotFound(_0xb1a56e,null))[_0x8a36('0x29')](saveUpdates(_0x645190[_0x8a36('0x31')],null))[_0x8a36('0x29')](respondWithResult(_0xb1a56e,null))['catch'](handleError(_0xb1a56e,null));}; \ No newline at end of file +var _0xcd18=['agent','interaction','account','show','params','model','keys','DashboardItem','rawAttributes','query','filters','attributes','intersection','length','includeAll','include','merge','options','catch','find','type','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','body','create','update','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','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','name','contact','message'];(function(_0x424b40,_0x14217b){var _0x435866=function(_0x8a1283){while(--_0x8a1283){_0x424b40['push'](_0x424b40['shift']());}};_0x435866(++_0x14217b);}(_0xcd18,0x13c));var _0x8cd1=function(_0x8c7710,_0x7e2cba){_0x8c7710=_0x8c7710-0x0;var _0x3280a2=_0xcd18[_0x8c7710];return _0x3280a2;};'use strict';var emlformat=require(_0x8cd1('0x0'));var rimraf=require(_0x8cd1('0x1'));var zipdir=require(_0x8cd1('0x2'));var jsonpatch=require(_0x8cd1('0x3'));var rp=require(_0x8cd1('0x4'));var moment=require(_0x8cd1('0x5'));var BPromise=require(_0x8cd1('0x6'));var Mustache=require(_0x8cd1('0x7'));var util=require('util');var path=require(_0x8cd1('0x8'));var sox=require(_0x8cd1('0x9'));var csv=require(_0x8cd1('0xa'));var ejs=require(_0x8cd1('0xb'));var fs=require('fs');var fs_extra=require(_0x8cd1('0xc'));var _=require(_0x8cd1('0xd'));var squel=require(_0x8cd1('0xe'));var crypto=require(_0x8cd1('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8cd1('0xa'));var querystring=require(_0x8cd1('0x10'));var Papa=require(_0x8cd1('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8cd1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cd1('0x13'));var logger=require('../../config/logger')(_0x8cd1('0x14'));var utils=require('../../config/utils');var config=require(_0x8cd1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8cd1('0x16'))['db'];config[_0x8cd1('0x17')]=_[_0x8cd1('0x18')](config[_0x8cd1('0x17')],{'host':_0x8cd1('0x19'),'port':0x18eb});var socket=require(_0x8cd1('0x1a'))(new Redis(config['redis']));require(_0x8cd1('0x1b'))['register'](socket);function respondWithStatusCode(_0x368c46,_0x3869f3){_0x3869f3=_0x3869f3||0xcc;return function(_0x1a51a6){if(_0x1a51a6){return _0x368c46['sendStatus'](_0x3869f3);}return _0x368c46[_0x8cd1('0x1c')](_0x3869f3)[_0x8cd1('0x1d')]();};}function respondWithResult(_0x2f341d,_0x43704f){_0x43704f=_0x43704f||0xc8;return function(_0x26434d){if(_0x26434d){return _0x2f341d[_0x8cd1('0x1c')](_0x43704f)[_0x8cd1('0x1e')](_0x26434d);}};}function respondWithFilteredResult(_0x3fe7ac,_0x3a1871){return function(_0x1d3cd5){if(_0x1d3cd5){var _0x143c5c=typeof _0x3a1871[_0x8cd1('0x1f')]===_0x8cd1('0x20')&&typeof _0x3a1871[_0x8cd1('0x21')]===_0x8cd1('0x20');var _0x2e9cb7=_0x1d3cd5['count'];var _0x489f19=_0x143c5c?0x0:_0x3a1871[_0x8cd1('0x1f')];var _0x2e840a=_0x143c5c?_0x1d3cd5[_0x8cd1('0x22')]:_0x3a1871[_0x8cd1('0x1f')]+_0x3a1871[_0x8cd1('0x21')];var _0x457d2f;if(_0x2e840a>=_0x2e9cb7){_0x2e840a=_0x2e9cb7;_0x457d2f=0xc8;}else{_0x457d2f=0xce;}_0x3fe7ac[_0x8cd1('0x1c')](_0x457d2f);return _0x3fe7ac[_0x8cd1('0x23')](_0x8cd1('0x24'),_0x489f19+'-'+_0x2e840a+'/'+_0x2e9cb7)['json'](_0x1d3cd5);}return null;};}function patchUpdates(_0x1ab684){return function(_0x5d8f9c){try{jsonpatch['apply'](_0x5d8f9c,_0x1ab684,!![]);}catch(_0xdfcf7a){return BPromise['reject'](_0xdfcf7a);}return _0x5d8f9c[_0x8cd1('0x25')]();};}function saveUpdates(_0x221fdf,_0x2bcdff){return function(_0x2950ec){if(_0x2950ec){return _0x2950ec['update'](_0x221fdf)[_0x8cd1('0x26')](function(_0x3e96c7){return _0x3e96c7;});}return null;};}function removeEntity(_0x5d68c4,_0x2115d5){return function(_0x56e5c3){if(_0x56e5c3){return _0x56e5c3[_0x8cd1('0x27')]()[_0x8cd1('0x26')](function(){_0x5d68c4[_0x8cd1('0x1c')](0xcc)[_0x8cd1('0x1d')]();});}};}function handleEntityNotFound(_0x384dbf,_0x20c05b){return function(_0x67a753){if(!_0x67a753){_0x384dbf['sendStatus'](0x194);}return _0x67a753;};}function handleError(_0x5ed211,_0x4bfdac){_0x4bfdac=_0x4bfdac||0x1f4;return function(_0x5bb385){logger[_0x8cd1('0x28')](_0x5bb385['stack']);if(_0x5bb385[_0x8cd1('0x29')]){delete _0x5bb385[_0x8cd1('0x29')];}_0x5ed211[_0x8cd1('0x1c')](_0x4bfdac)['send'](_0x5bb385);};}function getMustacheRender(_0x2208da,_0x23464f){return Mustache['render'](_0x2208da,_['merge'](_0x23464f['body'],{'contact':_0x23464f[_0x8cd1('0x2a')],'message':_0x23464f[_0x8cd1('0x2b')],'agent':_0x23464f[_0x8cd1('0x2c')],'interaction':_0x23464f[_0x8cd1('0x2d')],'account':_0x23464f[_0x8cd1('0x2e')]}))||'';}exports[_0x8cd1('0x2f')]=function(_0x24e4f6,_0x111574){var _0x22ab48={'raw':![],'where':{'id':_0x24e4f6[_0x8cd1('0x30')]['id']}},_0x234e57={};_0x234e57[_0x8cd1('0x31')]=_[_0x8cd1('0x32')](db[_0x8cd1('0x33')][_0x8cd1('0x34')]);_0x234e57['query']=_['keys'](_0x24e4f6[_0x8cd1('0x35')]);_0x234e57[_0x8cd1('0x36')]=_['intersection'](_0x234e57[_0x8cd1('0x31')],_0x234e57[_0x8cd1('0x35')]);_0x22ab48[_0x8cd1('0x37')]=_[_0x8cd1('0x38')](_0x234e57['model'],qs['fields'](_0x24e4f6[_0x8cd1('0x35')]['fields']));_0x22ab48['attributes']=_0x22ab48[_0x8cd1('0x37')][_0x8cd1('0x39')]?_0x22ab48[_0x8cd1('0x37')]:_0x234e57[_0x8cd1('0x31')];if(_0x24e4f6[_0x8cd1('0x35')][_0x8cd1('0x3a')]){_0x22ab48[_0x8cd1('0x3b')]=[{'all':!![]}];}_0x22ab48=_[_0x8cd1('0x3c')]({},_0x22ab48,_0x24e4f6[_0x8cd1('0x3d')]);return db['DashboardItem']['find'](_0x22ab48)['then'](handleEntityNotFound(_0x111574,null))[_0x8cd1('0x26')](respondWithResult(_0x111574,null))[_0x8cd1('0x3e')](handleError(_0x111574,null));};exports['destroy']=function(_0x5aff0c,_0x160818){return db[_0x8cd1('0x33')][_0x8cd1('0x3f')]({'where':{'id':_0x5aff0c[_0x8cd1('0x30')]['id']}})[_0x8cd1('0x26')](handleEntityNotFound(_0x160818,null))['then'](removeEntity(_0x160818,null))[_0x8cd1('0x3e')](handleError(_0x160818,null));};function widgetAttributes(_0x5f1157){try{switch(_0x5f1157[_0x8cd1('0x40')]){case'iframe':return[{'name':'attrUrl','value':_0x5f1157[_0x8cd1('0x41')]||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157['attrs'][0x0]?_0x5f1157[_0x8cd1('0x42')][0x0][_0x8cd1('0x43')]:undefined)||'https://'}];case _0x8cd1('0x44'):return[{'name':_0x8cd1('0x45'),'value':_0x5f1157['attrPath']||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x0]?_0x5f1157['attrs'][0x0][_0x8cd1('0x43')]:undefined)||''}];case _0x8cd1('0x46'):return[{'name':_0x8cd1('0x47'),'value':_0x5f1157['attrHourFormat']||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x0]?_0x5f1157['attrs'][0x0][_0x8cd1('0x43')]:undefined)||'HH:mm:ss'},{'name':_0x8cd1('0x48'),'value':_0x5f1157['attrTimezone']||(_0x5f1157['attrs']&&_0x5f1157[_0x8cd1('0x42')][0x1]?_0x5f1157['attrs'][0x1][_0x8cd1('0x43')]:undefined)||'0.00'},{'name':_0x8cd1('0x49'),'value':_0x5f1157['attrFontSize']||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157['attrs'][0x2]?_0x5f1157[_0x8cd1('0x42')][0x2][_0x8cd1('0x43')]:undefined)||0xc}];case _0x8cd1('0x4a'):return[{'name':_0x8cd1('0x4b'),'value':_0x5f1157[_0x8cd1('0x4b')]||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x0]?_0x5f1157[_0x8cd1('0x42')][0x0][_0x8cd1('0x43')]:undefined)||'total'},{'name':_0x8cd1('0x4c'),'value':_0x5f1157[_0x8cd1('0x4c')]||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157['attrs'][0x1]?_0x5f1157[_0x8cd1('0x42')][0x1][_0x8cd1('0x43')]:undefined)||[]},{'name':_0x8cd1('0x49'),'value':_0x5f1157[_0x8cd1('0x49')]||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x2]?_0x5f1157[_0x8cd1('0x42')][0x2][_0x8cd1('0x43')]:undefined)||0x14}];case _0x8cd1('0x4d'):case _0x8cd1('0x4e'):return[{'name':_0x8cd1('0x4f'),'value':_0x5f1157['attrSerie1']||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x0]?_0x5f1157[_0x8cd1('0x42')][0x0][_0x8cd1('0x43')]:undefined)||_0x8cd1('0x50')},{'name':'attrSerie2','value':_0x5f1157[_0x8cd1('0x51')]||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x1]?_0x5f1157['attrs'][0x1]['value']:undefined)||null},{'name':_0x8cd1('0x52'),'value':_0x5f1157[_0x8cd1('0x52')]||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x2]?_0x5f1157[_0x8cd1('0x42')][0x2][_0x8cd1('0x43')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x5f1157['attrVoiceQueues']||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x3]?_0x5f1157[_0x8cd1('0x42')][0x3][_0x8cd1('0x43')]:undefined)||[]}];case _0x8cd1('0x53'):return[{'name':_0x8cd1('0x54'),'type':_0x5f1157[_0x8cd1('0x55')]||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x0]?_0x5f1157[_0x8cd1('0x42')][0x0]['type']:undefined)||null,'value':_0x5f1157[_0x8cd1('0x54')]||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x0]?_0x5f1157[_0x8cd1('0x42')][0x0][_0x8cd1('0x43')]:undefined)||null},{'name':_0x8cd1('0x56'),'value':_0x5f1157[_0x8cd1('0x56')]||(_0x5f1157['attrs']&&_0x5f1157['attrs'][0x1]?_0x5f1157[_0x8cd1('0x42')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4b2db4){logger[_0x8cd1('0x28')]('widgetAttributes:\x20%s',JSON['stringify'](_0x4b2db4));return[];}}exports['create']=function(_0x485ef3,_0x20538e){if(_0x485ef3[_0x8cd1('0x57')]){_0x485ef3[_0x8cd1('0x57')]['attrs']=widgetAttributes(_0x485ef3[_0x8cd1('0x57')]);}return db[_0x8cd1('0x33')][_0x8cd1('0x58')](_0x485ef3[_0x8cd1('0x57')],{})['then'](respondWithResult(_0x20538e,0xc9))[_0x8cd1('0x3e')](handleError(_0x20538e,null));};exports[_0x8cd1('0x59')]=function(_0x20102d,_0x52462b){if(_0x20102d[_0x8cd1('0x57')]['id']){delete _0x20102d[_0x8cd1('0x57')]['id'];}_0x20102d[_0x8cd1('0x57')]['attrs']=widgetAttributes(_0x20102d[_0x8cd1('0x57')]);return db[_0x8cd1('0x33')][_0x8cd1('0x3f')]({'where':{'id':_0x20102d[_0x8cd1('0x30')]['id']}})[_0x8cd1('0x26')](handleEntityNotFound(_0x52462b,null))[_0x8cd1('0x26')](saveUpdates(_0x20102d[_0x8cd1('0x57')],null))['then'](respondWithResult(_0x52462b,null))[_0x8cd1('0x3e')](handleError(_0x52462b,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a143e3b..b9ea01e 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 _0x301c=['events','../../mysqldb','DashboardItem','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x44efba,_0x5c39fc){var _0x3e7da6=function(_0x2fb6b8){while(--_0x2fb6b8){_0x44efba['push'](_0x44efba['shift']());}};_0x3e7da6(++_0x5c39fc);}(_0x301c,0x10e));var _0xc301=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0x301c[_0x4b5813];return _0x423465;};'use strict';var EventEmitter=require(_0xc301('0x0'));var DashboardItem=require(_0xc301('0x1'))['db'][_0xc301('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc301('0x3')](0x0);var events={'afterCreate':_0xc301('0x4'),'afterUpdate':'update','afterDestroy':_0xc301('0x5')};function emitEvent(_0x4c4924){return function(_0x51c03a,_0x297192,_0x4000e8){DashboardItemEvents[_0xc301('0x6')](_0x4c4924+':'+_0x51c03a['id'],_0x51c03a);DashboardItemEvents[_0xc301('0x6')](_0x4c4924,_0x51c03a);_0x4000e8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xc301('0x7')](e,emitEvent(event));}}module[_0xc301('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x6c6e=['../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x4a7767,_0x15666c){var _0x58c6fd=function(_0x2c4425){while(--_0x2c4425){_0x4a7767['push'](_0x4a7767['shift']());}};_0x58c6fd(++_0x15666c);}(_0x6c6e,0x1ef));var _0xe6c6=function(_0x5e4741,_0x3e70fc){_0x5e4741=_0x5e4741-0x0;var _0x165638=_0x6c6e[_0x5e4741];return _0x165638;};'use strict';var EventEmitter=require(_0xe6c6('0x0'));var DashboardItem=require(_0xe6c6('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xe6c6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe6c6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4b3ccc){return function(_0x498e74,_0x3a438d,_0x1a8e4c){DashboardItemEvents[_0xe6c6('0x4')](_0x4b3ccc+':'+_0x498e74['id'],_0x498e74);DashboardItemEvents['emit'](_0x4b3ccc,_0x498e74);_0x1a8e4c(null);};}for(var e in events){if(events[_0xe6c6('0x5')](e)){var event=events[e];DashboardItem[_0xe6c6('0x6')](e,emitEvent(event));}}module[_0xe6c6('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 90af50f..dba59b1 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 _0x3434=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','DashboardItem','util','../../config/logger','api'];(function(_0x79500c,_0xf2b547){var _0x4b7791=function(_0x52c23a){while(--_0x52c23a){_0x79500c['push'](_0x79500c['shift']());}};_0x4b7791(++_0xf2b547);}(_0x3434,0x147));var _0x4343=function(_0x4a2066,_0x5a3447){_0x4a2066=_0x4a2066-0x0;var _0x380c9c=_0x3434[_0x4a2066];return _0x380c9c;};'use strict';var _=require('lodash');var util=require(_0x4343('0x0'));var logger=require(_0x4343('0x1'))(_0x4343('0x2'));var moment=require(_0x4343('0x3'));var BPromise=require(_0x4343('0x4'));var rp=require(_0x4343('0x5'));var fs=require('fs');var path=require(_0x4343('0x6'));var rimraf=require(_0x4343('0x7'));var config=require(_0x4343('0x8'));var attributes=require(_0x4343('0x9'));module['exports']=function(_0x2e1261,_0x3a4494){return _0x2e1261['define'](_0x4343('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x273e=['util','../../config/logger','api','rimraf','../../config/environment','./dashboardItem.attributes','dashboard_items'];(function(_0x32c166,_0x4654a0){var _0x15ff50=function(_0x36e7ba){while(--_0x36e7ba){_0x32c166['push'](_0x32c166['shift']());}};_0x15ff50(++_0x4654a0);}(_0x273e,0x1f1));var _0xe273=function(_0x583233,_0x66fc6){_0x583233=_0x583233-0x0;var _0x22d35c=_0x273e[_0x583233];return _0x22d35c;};'use strict';var _=require('lodash');var util=require(_0xe273('0x0'));var logger=require(_0xe273('0x1'))(_0xe273('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe273('0x3'));var config=require(_0xe273('0x4'));var attributes=require(_0xe273('0x5'));module['exports']=function(_0x17cee0,_0x224b7c){return _0x17cee0['define']('DashboardItem',attributes,{'tableName':_0xe273('0x6'),'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 380be57..fad3fc8 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 _0x1a3a=['jayson/promise','http','redis','defaults','localhost','./dashboardItem.socket','then','info','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5f1d8a,_0x3fd98e){var _0x1cd6be=function(_0x2a195f){while(--_0x2a195f){_0x5f1d8a['push'](_0x5f1d8a['shift']());}};_0x1cd6be(++_0x3fd98e);}(_0x1a3a,0x169));var _0xa1a3=function(_0x1823d9,_0x1d0645){_0x1823d9=_0x1823d9-0x0;var _0x5981ce=_0x1a3a[_0x1823d9];return _0x5981ce;};'use strict';var _=require(_0xa1a3('0x0'));var util=require(_0xa1a3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa1a3('0x2'));var fs=require('fs');var Redis=require(_0xa1a3('0x3'));var db=require(_0xa1a3('0x4'))['db'];var utils=require(_0xa1a3('0x5'));var logger=require(_0xa1a3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa1a3('0x7'));var client=jayson['client'][_0xa1a3('0x8')]({'port':0x232a});config[_0xa1a3('0x9')]=_[_0xa1a3('0xa')](config['redis'],{'host':_0xa1a3('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa1a3('0x9')]));require(_0xa1a3('0xc'))['register'](socket);function respondWithRpcPromise(_0x7c0ef7,_0x17f185,_0x33619e){return new BPromise(function(_0x12b90c,_0x145196){return client['request'](_0x7c0ef7,_0x33619e)[_0xa1a3('0xd')](function(_0x2b3b72){logger[_0xa1a3('0xe')](_0xa1a3('0xf'),_0x17f185,'request\x20sent');logger['debug'](_0xa1a3('0x10'),_0x17f185,_0xa1a3('0x11'),JSON['stringify'](_0x2b3b72));if(_0x2b3b72[_0xa1a3('0x12')]){if(_0x2b3b72[_0xa1a3('0x12')][_0xa1a3('0x13')]===0x1f4){logger['error'](_0xa1a3('0xf'),_0x17f185,_0x2b3b72[_0xa1a3('0x12')]['message']);return _0x145196(_0x2b3b72[_0xa1a3('0x12')][_0xa1a3('0x14')]);}logger[_0xa1a3('0x12')]('DashboardItem,\x20%s,\x20%s',_0x17f185,_0x2b3b72[_0xa1a3('0x12')]['message']);return _0x12b90c(_0x2b3b72[_0xa1a3('0x12')][_0xa1a3('0x14')]);}else{logger['info'](_0xa1a3('0xf'),_0x17f185,_0xa1a3('0x11'));_0x12b90c(_0x2b3b72[_0xa1a3('0x15')][_0xa1a3('0x14')]);}})[_0xa1a3('0x16')](function(_0x2a3952){logger[_0xa1a3('0x12')](_0xa1a3('0xf'),_0x17f185,_0x2a3952);_0x145196(_0x2a3952);});});} \ No newline at end of file +var _0xe1c8=['rpc','client','http','redis','defaults','localhost','register','request','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xe1c8,0xf3));var _0x8e1c=function(_0xaa8045,_0x249502){_0xaa8045=_0xaa8045-0x0;var _0x11a308=_0xe1c8[_0xaa8045];return _0x11a308;};'use strict';var _=require('lodash');var util=require(_0x8e1c('0x0'));var moment=require(_0x8e1c('0x1'));var BPromise=require(_0x8e1c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e1c('0x3'));var db=require(_0x8e1c('0x4'))['db'];var utils=require(_0x8e1c('0x5'));var logger=require(_0x8e1c('0x6'))(_0x8e1c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8e1c('0x8')][_0x8e1c('0x9')]({'port':0x232a});config[_0x8e1c('0xa')]=_[_0x8e1c('0xb')](config[_0x8e1c('0xa')],{'host':_0x8e1c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboardItem.socket')[_0x8e1c('0xd')](socket);function respondWithRpcPromise(_0x3eba0e,_0x42edbe,_0x94f9c9){return new BPromise(function(_0x5bddb,_0x4ff327){return client[_0x8e1c('0xe')](_0x3eba0e,_0x94f9c9)['then'](function(_0x6b87e4){logger['info']('DashboardItem,\x20%s,\x20%s',_0x42edbe,_0x8e1c('0xf'));logger[_0x8e1c('0x10')](_0x8e1c('0x11'),_0x42edbe,_0x8e1c('0xf'),JSON[_0x8e1c('0x12')](_0x6b87e4));if(_0x6b87e4[_0x8e1c('0x13')]){if(_0x6b87e4[_0x8e1c('0x13')][_0x8e1c('0x14')]===0x1f4){logger[_0x8e1c('0x13')]('DashboardItem,\x20%s,\x20%s',_0x42edbe,_0x6b87e4[_0x8e1c('0x13')][_0x8e1c('0x15')]);return _0x4ff327(_0x6b87e4['error'][_0x8e1c('0x15')]);}logger[_0x8e1c('0x13')]('DashboardItem,\x20%s,\x20%s',_0x42edbe,_0x6b87e4[_0x8e1c('0x13')][_0x8e1c('0x15')]);return _0x5bddb(_0x6b87e4[_0x8e1c('0x13')][_0x8e1c('0x15')]);}else{logger['info'](_0x8e1c('0x16'),_0x42edbe,_0x8e1c('0xf'));_0x5bddb(_0x6b87e4[_0x8e1c('0x17')][_0x8e1c('0x15')]);}})[_0x8e1c('0x18')](function(_0xe19728){logger[_0x8e1c('0x13')](_0x8e1c('0x16'),_0x42edbe,_0xe19728);_0x4ff327(_0xe19728);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index b08d56d..5f489b8 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 _0xfc66=['./dashboardItem.events','save','remove','update','removeListener','register','length'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xfc66,0x7e));var _0x6fc6=function(_0x3029e5,_0x1b3e84){_0x3029e5=_0x3029e5-0x0;var _0x2a693a=_0xfc66[_0x3029e5];return _0x2a693a;};'use strict';var DashboardItemEvents=require(_0x6fc6('0x0'));var events=[_0x6fc6('0x1'),_0x6fc6('0x2'),_0x6fc6('0x3')];function createListener(_0x20d468,_0x85dacd){return function(_0x51cd34){_0x85dacd['emit'](_0x20d468,_0x51cd34);};}function removeListener(_0x279eff,_0x5920c3){return function(){DashboardItemEvents[_0x6fc6('0x4')](_0x279eff,_0x5920c3);};}exports[_0x6fc6('0x5')]=function(_0x57de42){for(var _0x326853=0x0,_0x12c844=events[_0x6fc6('0x6')];_0x326853<_0x12c844;_0x326853++){var _0x40faa4=events[_0x326853];var _0xa9757e=createListener('dashboardItem:'+_0x40faa4,_0x57de42);DashboardItemEvents['on'](_0x40faa4,_0xa9757e);}}; \ No newline at end of file +var _0x5720=['register','length','dashboardItem:','save','update','emit','removeListener'];(function(_0x17f629,_0x45ec13){var _0x50af36=function(_0x47d96d){while(--_0x47d96d){_0x17f629['push'](_0x17f629['shift']());}};_0x50af36(++_0x45ec13);}(_0x5720,0x8f));var _0x0572=function(_0x5defc1,_0x3b17e1){_0x5defc1=_0x5defc1-0x0;var _0x568dde=_0x5720[_0x5defc1];return _0x568dde;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x0572('0x0'),'remove',_0x0572('0x1')];function createListener(_0x27fb4a,_0x1c658e){return function(_0x3030e2){_0x1c658e[_0x0572('0x2')](_0x27fb4a,_0x3030e2);};}function removeListener(_0x1301e7,_0x334ba0){return function(){DashboardItemEvents[_0x0572('0x3')](_0x1301e7,_0x334ba0);};}exports[_0x0572('0x4')]=function(_0x34d5d1){for(var _0x1c6640=0x0,_0x2c2c84=events[_0x0572('0x5')];_0x1c6640<_0x2c2c84;_0x1c6640++){var _0x520adf=events[_0x1c6640];var _0x527478=createListener(_0x0572('0x6')+_0x520adf,_0x34d5d1);DashboardItemEvents['on'](_0x520adf,_0x527478);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index e5c66ac..1274912 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 _0x055c=['../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x055c,0x8c));var _0xc055=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x055c[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require(_0xc055('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc055('0x1'));var express=require('express');var router=express[_0xc055('0x2')]();var fs_extra=require(_0xc055('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc055('0x4'));var config=require(_0xc055('0x5'));var controller=require(_0xc055('0x6'));router[_0xc055('0x7')](_0xc055('0x8'),auth['isAuthenticated'](),controller[_0xc055('0x9')]);router[_0xc055('0xa')]('/',auth[_0xc055('0xb')](),controller[_0xc055('0xc')]);router[_0xc055('0xd')](_0xc055('0x8'),auth['isAuthenticated'](),controller[_0xc055('0xe')]);router[_0xc055('0xf')](_0xc055('0x8'),auth[_0xc055('0xb')](),controller[_0xc055('0x10')]);module[_0xc055('0x11')]=router; \ No newline at end of file +var _0xb74d=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','create','put','update','delete'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0xb74d,0x12e));var _0xdb74=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0xb74d[_0x3b7a0c];return _0x3bb70f;};'use strict';var multer=require(_0xdb74('0x0'));var util=require(_0xdb74('0x1'));var path=require(_0xdb74('0x2'));var timeout=require(_0xdb74('0x3'));var express=require(_0xdb74('0x4'));var router=express[_0xdb74('0x5')]();var fs_extra=require(_0xdb74('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdb74('0x7'));var config=require(_0xdb74('0x8'));var controller=require(_0xdb74('0x9'));router[_0xdb74('0xa')](_0xdb74('0xb'),auth[_0xdb74('0xc')](),controller[_0xdb74('0xd')]);router['post']('/',auth[_0xdb74('0xc')](),controller[_0xdb74('0xe')]);router[_0xdb74('0xf')](_0xdb74('0xb'),auth[_0xdb74('0xc')](),controller[_0xdb74('0x10')]);router[_0xdb74('0x11')]('/:id',auth[_0xdb74('0xc')](),controller[_0xdb74('0x12')]);module[_0xdb74('0x13')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 22ca606..4f092e2 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 _0x8f5f=['STRING','ENUM','first','third','exports'];(function(_0x23b260,_0x28e8bf){var _0x56c3aa=function(_0x293c23){while(--_0x293c23){_0x23b260['push'](_0x23b260['shift']());}};_0x56c3aa(++_0x28e8bf);}(_0x8f5f,0xae));var _0xf8f5=function(_0xb3b452,_0x582e8e){_0xb3b452=_0xb3b452-0x0;var _0x238983=_0x8f5f[_0xb3b452];return _0x238983;};'use strict';var Sequelize=require('sequelize');module[_0xf8f5('0x0')]={'name':{'type':Sequelize[_0xf8f5('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xf8f5('0x2')](_0xf8f5('0x3'),'second',_0xf8f5('0x4')),'allowNull':![],'defaultValue':_0xf8f5('0x3')},'description':{'type':Sequelize[_0xf8f5('0x1')]}}; \ No newline at end of file +var _0x4b6b=['exports','first','second','third','STRING','sequelize'];(function(_0x3e78eb,_0x198a0d){var _0x11257e=function(_0x307e7e){while(--_0x307e7e){_0x3e78eb['push'](_0x3e78eb['shift']());}};_0x11257e(++_0x198a0d);}(_0x4b6b,0x1eb));var _0xb4b6=function(_0x4e56f2,_0x33b905){_0x4e56f2=_0x4e56f2-0x0;var _0x1f5f79=_0x4b6b[_0x4e56f2];return _0x1f5f79;};'use strict';var Sequelize=require(_0xb4b6('0x0'));module[_0xb4b6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xb4b6('0x2'),_0xb4b6('0x3'),_0xb4b6('0x4')),'allowNull':![],'defaultValue':_0xb4b6('0x2')},'description':{'type':Sequelize[_0xb4b6('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 6f803ab..f78a707 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 _0x7aee=['order','sort','where','VIRTUAL','filter','options','Disposition','includeAll','include','findAll','rows','show','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','Dispositions','UserProfileResource','error','stack','name','send','render','merge','body','contact','message','agent','interaction','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x4e5f40,_0x3bf5d2){var _0x7d58be=function(_0xd91e4d){while(--_0xd91e4d){_0x4e5f40['push'](_0x4e5f40['shift']());}};_0x7d58be(++_0x3bf5d2);}(_0x7aee,0x176));var _0xe7ae=function(_0x57542d,_0x105cac){_0x57542d=_0x57542d-0x0;var _0x16b0bf=_0x7aee[_0x57542d];return _0x16b0bf;};'use strict';var emlformat=require(_0xe7ae('0x0'));var rimraf=require(_0xe7ae('0x1'));var zipdir=require(_0xe7ae('0x2'));var jsonpatch=require(_0xe7ae('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe7ae('0x4'));var Mustache=require('mustache');var util=require(_0xe7ae('0x5'));var path=require(_0xe7ae('0x6'));var sox=require('sox');var csv=require(_0xe7ae('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe7ae('0x8'));var _=require(_0xe7ae('0x9'));var squel=require(_0xe7ae('0xa'));var crypto=require(_0xe7ae('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe7ae('0xc'));var toCsv=require(_0xe7ae('0x7'));var querystring=require(_0xe7ae('0xd'));var Papa=require(_0xe7ae('0xe'));var Redis=require(_0xe7ae('0xf'));var authService=require(_0xe7ae('0x10'));var qs=require(_0xe7ae('0x11'));var as=require(_0xe7ae('0x12'));var hardwareService=require(_0xe7ae('0x13'));var logger=require(_0xe7ae('0x14'))(_0xe7ae('0x15'));var utils=require(_0xe7ae('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe7ae('0x17'))['db'];function respondWithStatusCode(_0x3e71b3,_0x3a1fdc){_0x3a1fdc=_0x3a1fdc||0xcc;return function(_0x558f54){if(_0x558f54){return _0x3e71b3[_0xe7ae('0x18')](_0x3a1fdc);}return _0x3e71b3[_0xe7ae('0x19')](_0x3a1fdc)[_0xe7ae('0x1a')]();};}function respondWithResult(_0xdefe73,_0x5f1cf1){_0x5f1cf1=_0x5f1cf1||0xc8;return function(_0x2b323c){if(_0x2b323c){return _0xdefe73[_0xe7ae('0x19')](_0x5f1cf1)[_0xe7ae('0x1b')](_0x2b323c);}};}function respondWithFilteredResult(_0x1af4da,_0x414fb3){return function(_0x2438e7){if(_0x2438e7){var _0x42dca6=typeof _0x414fb3[_0xe7ae('0x1c')]===_0xe7ae('0x1d')&&typeof _0x414fb3[_0xe7ae('0x1e')]==='undefined';var _0x5daf03=_0x2438e7['count'];var _0x41ac49=_0x42dca6?0x0:_0x414fb3['offset'];var _0x183931=_0x42dca6?_0x2438e7[_0xe7ae('0x1f')]:_0x414fb3[_0xe7ae('0x1c')]+_0x414fb3[_0xe7ae('0x1e')];var _0x552fdc;if(_0x183931>=_0x5daf03){_0x183931=_0x5daf03;_0x552fdc=0xc8;}else{_0x552fdc=0xce;}_0x1af4da[_0xe7ae('0x19')](_0x552fdc);return _0x1af4da[_0xe7ae('0x20')](_0xe7ae('0x21'),_0x41ac49+'-'+_0x183931+'/'+_0x5daf03)['json'](_0x2438e7);}return null;};}function patchUpdates(_0x45c72a){return function(_0xb9161b){try{jsonpatch[_0xe7ae('0x22')](_0xb9161b,_0x45c72a,!![]);}catch(_0x272e4e){return BPromise['reject'](_0x272e4e);}return _0xb9161b[_0xe7ae('0x23')]();};}function saveUpdates(_0x1fb891,_0x352fa9){return function(_0x3a0b25){if(_0x3a0b25){return _0x3a0b25[_0xe7ae('0x24')](_0x1fb891)[_0xe7ae('0x25')](function(_0x5318f8){return _0x5318f8;});}return null;};}function removeEntity(_0x3f4aa0,_0x4a8dc0){return function(_0x2d3a94){if(_0x2d3a94){return _0x2d3a94['destroy']()[_0xe7ae('0x25')](function(){var _0x56997a=_0x2d3a94['get']({'plain':!![]});var _0x5be354=_0xe7ae('0x26');return db[_0xe7ae('0x27')]['destroy']({'where':{'type':_0x5be354,'resourceId':_0x56997a['id']}})['then'](function(){return _0x2d3a94;});})['then'](function(){_0x3f4aa0[_0xe7ae('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x258957,_0x3270a4){return function(_0x1c7653){if(!_0x1c7653){_0x258957[_0xe7ae('0x18')](0x194);}return _0x1c7653;};}function handleError(_0x3d45df,_0x55ef21){_0x55ef21=_0x55ef21||0x1f4;return function(_0x2d592d){logger[_0xe7ae('0x28')](_0x2d592d[_0xe7ae('0x29')]);if(_0x2d592d['name']){delete _0x2d592d[_0xe7ae('0x2a')];}_0x3d45df['status'](_0x55ef21)[_0xe7ae('0x2b')](_0x2d592d);};}function getMustacheRender(_0x2e9ea1,_0x22c34b){return Mustache[_0xe7ae('0x2c')](_0x2e9ea1,_[_0xe7ae('0x2d')](_0x22c34b[_0xe7ae('0x2e')],{'contact':_0x22c34b[_0xe7ae('0x2f')],'message':_0x22c34b[_0xe7ae('0x30')],'agent':_0x22c34b[_0xe7ae('0x31')],'interaction':_0x22c34b[_0xe7ae('0x32')],'account':_0x22c34b['account']}))||'';}exports[_0xe7ae('0x33')]=function(_0x5ccc16,_0x23820e){var _0x366016={},_0x417e28={},_0x11d7c5={'count':0x0,'rows':[]};var _0x5120ff=_['map'](db['Disposition'][_0xe7ae('0x34')],function(_0x4c5cb5){return{'name':_0x4c5cb5['fieldName'],'type':_0x4c5cb5[_0xe7ae('0x35')][_0xe7ae('0x36')]};});_0x417e28[_0xe7ae('0x37')]=_[_0xe7ae('0x38')](_0x5120ff,_0xe7ae('0x2a'));_0x417e28[_0xe7ae('0x39')]=_[_0xe7ae('0x3a')](_0x5ccc16[_0xe7ae('0x39')]);_0x417e28[_0xe7ae('0x3b')]=_[_0xe7ae('0x3c')](_0x417e28['model'],_0x417e28[_0xe7ae('0x39')]);_0x366016['attributes']=_['intersection'](_0x417e28[_0xe7ae('0x37')],qs[_0xe7ae('0x3d')](_0x5ccc16['query'][_0xe7ae('0x3d')]));_0x366016['attributes']=_0x366016[_0xe7ae('0x3e')][_0xe7ae('0x3f')]?_0x366016[_0xe7ae('0x3e')]:_0x417e28[_0xe7ae('0x37')];if(!_0x5ccc16[_0xe7ae('0x39')][_0xe7ae('0x40')](_0xe7ae('0x41'))){_0x366016[_0xe7ae('0x1e')]=qs[_0xe7ae('0x1e')](_0x5ccc16[_0xe7ae('0x39')][_0xe7ae('0x1e')]);_0x366016[_0xe7ae('0x1c')]=qs['offset'](_0x5ccc16[_0xe7ae('0x39')][_0xe7ae('0x1c')]);}_0x366016[_0xe7ae('0x42')]=qs[_0xe7ae('0x43')](_0x5ccc16[_0xe7ae('0x39')]['sort']);_0x366016[_0xe7ae('0x44')]=qs[_0xe7ae('0x3b')](_['pick'](_0x5ccc16['query'],_0x417e28[_0xe7ae('0x3b')]),_0x5120ff);if(_0x5ccc16[_0xe7ae('0x39')]['filter']){_0x366016['where']=_[_0xe7ae('0x2d')](_0x366016[_0xe7ae('0x44')],{'$or':_['map'](_0x5120ff,function(_0x4077de){if(_0x4077de[_0xe7ae('0x35')]!==_0xe7ae('0x45')){var _0x217de7={};_0x217de7[_0x4077de['name']]={'$like':'%'+_0x5ccc16[_0xe7ae('0x39')][_0xe7ae('0x46')]+'%'};return _0x217de7;}})});}_0x366016=_[_0xe7ae('0x2d')]({},_0x366016,_0x5ccc16[_0xe7ae('0x47')]);var _0x17b632={'where':_0x366016['where']};return db[_0xe7ae('0x48')][_0xe7ae('0x1f')](_0x17b632)[_0xe7ae('0x25')](function(_0x4c1ee8){_0x11d7c5['count']=_0x4c1ee8;if(_0x5ccc16[_0xe7ae('0x39')][_0xe7ae('0x49')]){_0x366016[_0xe7ae('0x4a')]=[{'all':!![]}];}return db['Disposition'][_0xe7ae('0x4b')](_0x366016);})[_0xe7ae('0x25')](function(_0x452f89){_0x11d7c5[_0xe7ae('0x4c')]=_0x452f89;return _0x11d7c5;})['then'](respondWithFilteredResult(_0x23820e,_0x366016))['catch'](handleError(_0x23820e,null));};exports[_0xe7ae('0x4d')]=function(_0x516df2,_0x4b4426){var _0x48cd07={'raw':!![],'where':{'id':_0x516df2['params']['id']}},_0x59065a={};_0x59065a[_0xe7ae('0x37')]=_['keys'](db[_0xe7ae('0x48')][_0xe7ae('0x34')]);_0x59065a[_0xe7ae('0x39')]=_[_0xe7ae('0x3a')](_0x516df2[_0xe7ae('0x39')]);_0x59065a['filters']=_[_0xe7ae('0x3c')](_0x59065a[_0xe7ae('0x37')],_0x59065a[_0xe7ae('0x39')]);_0x48cd07[_0xe7ae('0x3e')]=_[_0xe7ae('0x3c')](_0x59065a['model'],qs['fields'](_0x516df2[_0xe7ae('0x39')][_0xe7ae('0x3d')]));_0x48cd07[_0xe7ae('0x3e')]=_0x48cd07[_0xe7ae('0x3e')][_0xe7ae('0x3f')]?_0x48cd07[_0xe7ae('0x3e')]:_0x59065a[_0xe7ae('0x37')];if(_0x516df2[_0xe7ae('0x39')][_0xe7ae('0x49')]){_0x48cd07[_0xe7ae('0x4a')]=[{'all':!![]}];}_0x48cd07=_['merge']({},_0x48cd07,_0x516df2[_0xe7ae('0x47')]);return db['Disposition'][_0xe7ae('0x4e')](_0x48cd07)[_0xe7ae('0x25')](handleEntityNotFound(_0x4b4426,null))[_0xe7ae('0x25')](respondWithResult(_0x4b4426,null))[_0xe7ae('0x4f')](handleError(_0x4b4426,null));};exports[_0xe7ae('0x50')]=function(_0x2b4dda,_0x3a6935){return db[_0xe7ae('0x48')]['create'](_0x2b4dda[_0xe7ae('0x2e')],{})[_0xe7ae('0x25')](function(_0xf22763){var _0x14ad5d=_0x2b4dda[_0xe7ae('0x51')][_0xe7ae('0x52')]({'plain':!![]});if(!_0x14ad5d)throw new Error(_0xe7ae('0x53'));if(_0x14ad5d['role']==='user'){var _0xc8b5db=_0xf22763[_0xe7ae('0x52')]({'plain':!![]});var _0x56551e=_0xe7ae('0x26');return db[_0xe7ae('0x54')][_0xe7ae('0x4e')]({'where':{'name':_0x56551e,'userProfileId':_0x14ad5d['userProfileId']},'raw':!![]})[_0xe7ae('0x25')](function(_0x373a3f){if(_0x373a3f&&_0x373a3f[_0xe7ae('0x55')]===0x0){return db[_0xe7ae('0x27')][_0xe7ae('0x50')]({'name':_0xc8b5db[_0xe7ae('0x2a')],'resourceId':_0xc8b5db['id'],'type':_0x373a3f[_0xe7ae('0x2a')],'sectionId':_0x373a3f['id']},{})[_0xe7ae('0x25')](function(){return _0xf22763;});}else{return _0xf22763;}})[_0xe7ae('0x4f')](function(_0xae194){logger[_0xe7ae('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xae194);throw _0xae194;});}return _0xf22763;})[_0xe7ae('0x25')](respondWithResult(_0x3a6935,0xc9))['catch'](handleError(_0x3a6935,null));};exports[_0xe7ae('0x24')]=function(_0x41de64,_0x1d480c){if(_0x41de64['body']['id']){delete _0x41de64['body']['id'];}return db[_0xe7ae('0x48')][_0xe7ae('0x4e')]({'where':{'id':_0x41de64[_0xe7ae('0x56')]['id']}})[_0xe7ae('0x25')](handleEntityNotFound(_0x1d480c,null))['then'](saveUpdates(_0x41de64[_0xe7ae('0x2e')],null))[_0xe7ae('0x25')](respondWithResult(_0x1d480c,null))['catch'](handleError(_0x1d480c,null));};exports[_0xe7ae('0x57')]=function(_0x16a313,_0xf0a66c){return db[_0xe7ae('0x48')]['find']({'where':{'id':_0x16a313['params']['id']}})[_0xe7ae('0x25')](handleEntityNotFound(_0xf0a66c,null))[_0xe7ae('0x25')](removeEntity(_0xf0a66c,null))['catch'](handleError(_0xf0a66c,null));}; \ No newline at end of file +var _0x87cf=['../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','Dispositions','UserProfileResource','sendStatus','error','stack','name','render','merge','contact','message','agent','interaction','index','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','options','includeAll','include','Disposition','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x525fc5,_0x115f96){var _0x1c9be7=function(_0x18eb5c){while(--_0x18eb5c){_0x525fc5['push'](_0x525fc5['shift']());}};_0x1c9be7(++_0x115f96);}(_0x87cf,0x19d));var _0xf87c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x87cf[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xf87c('0x0'));var rimraf=require(_0xf87c('0x1'));var zipdir=require(_0xf87c('0x2'));var jsonpatch=require(_0xf87c('0x3'));var rp=require(_0xf87c('0x4'));var moment=require(_0xf87c('0x5'));var BPromise=require(_0xf87c('0x6'));var Mustache=require(_0xf87c('0x7'));var util=require(_0xf87c('0x8'));var path=require('path');var sox=require(_0xf87c('0x9'));var csv=require('to-csv');var ejs=require(_0xf87c('0xa'));var fs=require('fs');var fs_extra=require(_0xf87c('0xb'));var _=require(_0xf87c('0xc'));var squel=require(_0xf87c('0xd'));var crypto=require(_0xf87c('0xe'));var jsforce=require(_0xf87c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf87c('0x10'));var Papa=require(_0xf87c('0x11'));var Redis=require(_0xf87c('0x12'));var authService=require(_0xf87c('0x13'));var qs=require(_0xf87c('0x14'));var as=require(_0xf87c('0x15'));var hardwareService=require(_0xf87c('0x16'));var logger=require(_0xf87c('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xf87c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf87c('0x19'))['db'];function respondWithStatusCode(_0x1cde1f,_0x24a111){_0x24a111=_0x24a111||0xcc;return function(_0x19b281){if(_0x19b281){return _0x1cde1f['sendStatus'](_0x24a111);}return _0x1cde1f['status'](_0x24a111)['end']();};}function respondWithResult(_0x2ead94,_0x1d2ce9){_0x1d2ce9=_0x1d2ce9||0xc8;return function(_0x7e7d89){if(_0x7e7d89){return _0x2ead94[_0xf87c('0x1a')](_0x1d2ce9)[_0xf87c('0x1b')](_0x7e7d89);}};}function respondWithFilteredResult(_0x51cc3e,_0x25125a){return function(_0x1efa29){if(_0x1efa29){var _0x2837ac=typeof _0x25125a[_0xf87c('0x1c')]===_0xf87c('0x1d')&&typeof _0x25125a[_0xf87c('0x1e')]===_0xf87c('0x1d');var _0x3f93a6=_0x1efa29[_0xf87c('0x1f')];var _0x31d463=_0x2837ac?0x0:_0x25125a[_0xf87c('0x1c')];var _0x20eb92=_0x2837ac?_0x1efa29[_0xf87c('0x1f')]:_0x25125a[_0xf87c('0x1c')]+_0x25125a['limit'];var _0x50722c;if(_0x20eb92>=_0x3f93a6){_0x20eb92=_0x3f93a6;_0x50722c=0xc8;}else{_0x50722c=0xce;}_0x51cc3e[_0xf87c('0x1a')](_0x50722c);return _0x51cc3e[_0xf87c('0x20')](_0xf87c('0x21'),_0x31d463+'-'+_0x20eb92+'/'+_0x3f93a6)['json'](_0x1efa29);}return null;};}function patchUpdates(_0x46070a){return function(_0x142e60){try{jsonpatch['apply'](_0x142e60,_0x46070a,!![]);}catch(_0x36f59a){return BPromise[_0xf87c('0x22')](_0x36f59a);}return _0x142e60[_0xf87c('0x23')]();};}function saveUpdates(_0x1811d7,_0x349549){return function(_0xfd779f){if(_0xfd779f){return _0xfd779f['update'](_0x1811d7)[_0xf87c('0x24')](function(_0x12adae){return _0x12adae;});}return null;};}function removeEntity(_0xf78ca8,_0x3c26a3){return function(_0x5263ef){if(_0x5263ef){return _0x5263ef[_0xf87c('0x25')]()[_0xf87c('0x24')](function(){var _0x3250ec=_0x5263ef[_0xf87c('0x26')]({'plain':!![]});var _0x20749e=_0xf87c('0x27');return db[_0xf87c('0x28')][_0xf87c('0x25')]({'where':{'type':_0x20749e,'resourceId':_0x3250ec['id']}})[_0xf87c('0x24')](function(){return _0x5263ef;});})[_0xf87c('0x24')](function(){_0xf78ca8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x966757,_0x59e1e9){return function(_0xfe9f93){if(!_0xfe9f93){_0x966757[_0xf87c('0x29')](0x194);}return _0xfe9f93;};}function handleError(_0x6e4743,_0x1e1b0c){_0x1e1b0c=_0x1e1b0c||0x1f4;return function(_0x41ab25){logger[_0xf87c('0x2a')](_0x41ab25[_0xf87c('0x2b')]);if(_0x41ab25[_0xf87c('0x2c')]){delete _0x41ab25[_0xf87c('0x2c')];}_0x6e4743[_0xf87c('0x1a')](_0x1e1b0c)['send'](_0x41ab25);};}function getMustacheRender(_0x133b34,_0x5839b1){return Mustache[_0xf87c('0x2d')](_0x133b34,_[_0xf87c('0x2e')](_0x5839b1['body'],{'contact':_0x5839b1[_0xf87c('0x2f')],'message':_0x5839b1[_0xf87c('0x30')],'agent':_0x5839b1[_0xf87c('0x31')],'interaction':_0x5839b1[_0xf87c('0x32')],'account':_0x5839b1['account']}))||'';}exports[_0xf87c('0x33')]=function(_0x3081de,_0x1f82c6){var _0x4a7cb6={},_0x5dcc04={},_0x457fc6={'count':0x0,'rows':[]};var _0x1d834c=_[_0xf87c('0x34')](db['Disposition']['rawAttributes'],function(_0x1352b7){return{'name':_0x1352b7[_0xf87c('0x35')],'type':_0x1352b7[_0xf87c('0x36')]['key']};});_0x5dcc04[_0xf87c('0x37')]=_[_0xf87c('0x34')](_0x1d834c,'name');_0x5dcc04[_0xf87c('0x38')]=_['keys'](_0x3081de[_0xf87c('0x38')]);_0x5dcc04[_0xf87c('0x39')]=_[_0xf87c('0x3a')](_0x5dcc04[_0xf87c('0x37')],_0x5dcc04[_0xf87c('0x38')]);_0x4a7cb6[_0xf87c('0x3b')]=_[_0xf87c('0x3a')](_0x5dcc04[_0xf87c('0x37')],qs[_0xf87c('0x3c')](_0x3081de[_0xf87c('0x38')][_0xf87c('0x3c')]));_0x4a7cb6[_0xf87c('0x3b')]=_0x4a7cb6['attributes'][_0xf87c('0x3d')]?_0x4a7cb6['attributes']:_0x5dcc04[_0xf87c('0x37')];if(!_0x3081de['query']['hasOwnProperty'](_0xf87c('0x3e'))){_0x4a7cb6[_0xf87c('0x1e')]=qs[_0xf87c('0x1e')](_0x3081de['query']['limit']);_0x4a7cb6[_0xf87c('0x1c')]=qs[_0xf87c('0x1c')](_0x3081de[_0xf87c('0x38')][_0xf87c('0x1c')]);}_0x4a7cb6['order']=qs[_0xf87c('0x3f')](_0x3081de[_0xf87c('0x38')][_0xf87c('0x3f')]);_0x4a7cb6[_0xf87c('0x40')]=qs[_0xf87c('0x39')](_['pick'](_0x3081de[_0xf87c('0x38')],_0x5dcc04[_0xf87c('0x39')]),_0x1d834c);if(_0x3081de['query']['filter']){_0x4a7cb6[_0xf87c('0x40')]=_[_0xf87c('0x2e')](_0x4a7cb6[_0xf87c('0x40')],{'$or':_[_0xf87c('0x34')](_0x1d834c,function(_0x2eb180){if(_0x2eb180[_0xf87c('0x36')]!=='VIRTUAL'){var _0x1978af={};_0x1978af[_0x2eb180[_0xf87c('0x2c')]]={'$like':'%'+_0x3081de[_0xf87c('0x38')][_0xf87c('0x41')]+'%'};return _0x1978af;}})});}_0x4a7cb6=_[_0xf87c('0x2e')]({},_0x4a7cb6,_0x3081de[_0xf87c('0x42')]);var _0x234403={'where':_0x4a7cb6['where']};return db['Disposition'][_0xf87c('0x1f')](_0x234403)['then'](function(_0x333338){_0x457fc6[_0xf87c('0x1f')]=_0x333338;if(_0x3081de[_0xf87c('0x38')][_0xf87c('0x43')]){_0x4a7cb6[_0xf87c('0x44')]=[{'all':!![]}];}return db[_0xf87c('0x45')][_0xf87c('0x46')](_0x4a7cb6);})[_0xf87c('0x24')](function(_0x336f3f){_0x457fc6[_0xf87c('0x47')]=_0x336f3f;return _0x457fc6;})[_0xf87c('0x24')](respondWithFilteredResult(_0x1f82c6,_0x4a7cb6))[_0xf87c('0x48')](handleError(_0x1f82c6,null));};exports[_0xf87c('0x49')]=function(_0x2e4e3b,_0x25bfab){var _0x4d4dd0={'raw':!![],'where':{'id':_0x2e4e3b[_0xf87c('0x4a')]['id']}},_0x503904={};_0x503904[_0xf87c('0x37')]=_['keys'](db['Disposition'][_0xf87c('0x4b')]);_0x503904[_0xf87c('0x38')]=_[_0xf87c('0x4c')](_0x2e4e3b['query']);_0x503904['filters']=_[_0xf87c('0x3a')](_0x503904['model'],_0x503904[_0xf87c('0x38')]);_0x4d4dd0[_0xf87c('0x3b')]=_[_0xf87c('0x3a')](_0x503904[_0xf87c('0x37')],qs[_0xf87c('0x3c')](_0x2e4e3b[_0xf87c('0x38')]['fields']));_0x4d4dd0[_0xf87c('0x3b')]=_0x4d4dd0[_0xf87c('0x3b')][_0xf87c('0x3d')]?_0x4d4dd0[_0xf87c('0x3b')]:_0x503904[_0xf87c('0x37')];if(_0x2e4e3b[_0xf87c('0x38')]['includeAll']){_0x4d4dd0[_0xf87c('0x44')]=[{'all':!![]}];}_0x4d4dd0=_[_0xf87c('0x2e')]({},_0x4d4dd0,_0x2e4e3b['options']);return db[_0xf87c('0x45')][_0xf87c('0x4d')](_0x4d4dd0)['then'](handleEntityNotFound(_0x25bfab,null))[_0xf87c('0x24')](respondWithResult(_0x25bfab,null))['catch'](handleError(_0x25bfab,null));};exports['create']=function(_0x4ec6b6,_0x1d8708){return db[_0xf87c('0x45')][_0xf87c('0x4e')](_0x4ec6b6[_0xf87c('0x4f')],{})[_0xf87c('0x24')](function(_0x21580c){var _0x58736d=_0x4ec6b6[_0xf87c('0x50')][_0xf87c('0x26')]({'plain':!![]});if(!_0x58736d)throw new Error(_0xf87c('0x51'));if(_0x58736d[_0xf87c('0x52')]===_0xf87c('0x50')){var _0x227bd4=_0x21580c[_0xf87c('0x26')]({'plain':!![]});var _0x5f215a=_0xf87c('0x27');return db[_0xf87c('0x53')][_0xf87c('0x4d')]({'where':{'name':_0x5f215a,'userProfileId':_0x58736d[_0xf87c('0x54')]},'raw':!![]})['then'](function(_0x4bd4e3){if(_0x4bd4e3&&_0x4bd4e3['autoAssociation']===0x0){return db[_0xf87c('0x28')][_0xf87c('0x4e')]({'name':_0x227bd4[_0xf87c('0x2c')],'resourceId':_0x227bd4['id'],'type':_0x4bd4e3[_0xf87c('0x2c')],'sectionId':_0x4bd4e3['id']},{})[_0xf87c('0x24')](function(){return _0x21580c;});}else{return _0x21580c;}})['catch'](function(_0x14b1ed){logger['error'](_0xf87c('0x55'),_0x14b1ed);throw _0x14b1ed;});}return _0x21580c;})[_0xf87c('0x24')](respondWithResult(_0x1d8708,0xc9))[_0xf87c('0x48')](handleError(_0x1d8708,null));};exports[_0xf87c('0x56')]=function(_0x46d428,_0x5e06ca){if(_0x46d428['body']['id']){delete _0x46d428[_0xf87c('0x4f')]['id'];}return db['Disposition'][_0xf87c('0x4d')]({'where':{'id':_0x46d428[_0xf87c('0x4a')]['id']}})[_0xf87c('0x24')](handleEntityNotFound(_0x5e06ca,null))[_0xf87c('0x24')](saveUpdates(_0x46d428[_0xf87c('0x4f')],null))[_0xf87c('0x24')](respondWithResult(_0x5e06ca,null))[_0xf87c('0x48')](handleError(_0x5e06ca,null));};exports[_0xf87c('0x25')]=function(_0x20b87f,_0x2856df){return db[_0xf87c('0x45')][_0xf87c('0x4d')]({'where':{'id':_0x20b87f[_0xf87c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2856df,null))[_0xf87c('0x24')](removeEntity(_0x2856df,null))[_0xf87c('0x48')](handleError(_0x2856df,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index f5aad55..1c08987 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 _0x27a8=['name_chat','ChatWebsiteId','name_mail','SmsAccountId','name_fax','name_openchannel','name_whatsapp','WhatsappAccountId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x27a8,0x170));var _0x827a=function(_0x19ba1c,_0x4839d1){_0x19ba1c=_0x19ba1c-0x0;var _0x4030e9=_0x27a8[_0x19ba1c];return _0x4030e9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x827a('0x0'))(_0x827a('0x1'));var moment=require(_0x827a('0x2'));var BPromise=require(_0x827a('0x3'));var rp=require(_0x827a('0x4'));var fs=require('fs');var path=require(_0x827a('0x5'));var rimraf=require(_0x827a('0x6'));var config=require(_0x827a('0x7'));var attributes=require(_0x827a('0x8'));module[_0x827a('0x9')]=function(_0x19d10d,_0x61767e){return _0x19d10d[_0x827a('0xa')](_0x827a('0xb'),attributes,{'tableName':_0x827a('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x827a('0xd'),'fields':[_0x827a('0xe'),_0x827a('0xf')]},{'unique':!![],'name':_0x827a('0x10'),'fields':[_0x827a('0xe'),_0x827a('0x11')]},{'unique':!![],'name':_0x827a('0x12'),'fields':[_0x827a('0xe'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x827a('0xe'),_0x827a('0x13')]},{'unique':!![],'name':_0x827a('0x14'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x827a('0x15'),'fields':[_0x827a('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':_0x827a('0x16'),'fields':['name',_0x827a('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe181=['tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./disposition.attributes','define','Disposition'];(function(_0x1f88b3,_0x3560e0){var _0x5e0463=function(_0x8999c6){while(--_0x8999c6){_0x1f88b3['push'](_0x1f88b3['shift']());}};_0x5e0463(++_0x3560e0);}(_0xe181,0x68));var _0x1e18=function(_0xaaa123,_0x4c23e3){_0xaaa123=_0xaaa123-0x0;var _0x44d6d7=_0xe181[_0xaaa123];return _0x44d6d7;};'use strict';var _=require(_0x1e18('0x0'));var util=require('util');var logger=require(_0x1e18('0x1'))(_0x1e18('0x2'));var moment=require(_0x1e18('0x3'));var BPromise=require(_0x1e18('0x4'));var rp=require(_0x1e18('0x5'));var fs=require('fs');var path=require(_0x1e18('0x6'));var rimraf=require(_0x1e18('0x7'));var config=require('../../config/environment');var attributes=require(_0x1e18('0x8'));module['exports']=function(_0x512343,_0x18fabb){return _0x512343[_0x1e18('0x9')](_0x1e18('0xa'),attributes,{'tableName':_0x1e18('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x1e18('0xc'),'fields':[_0x1e18('0xd'),'ListId']},{'unique':!![],'name':_0x1e18('0xe'),'fields':[_0x1e18('0xd'),_0x1e18('0xf')]},{'unique':!![],'name':_0x1e18('0x10'),'fields':[_0x1e18('0xd'),_0x1e18('0x11')]},{'unique':!![],'name':'name_sms','fields':[_0x1e18('0xd'),_0x1e18('0x12')]},{'unique':!![],'name':_0x1e18('0x13'),'fields':[_0x1e18('0xd'),_0x1e18('0x14')]},{'unique':!![],'name':_0x1e18('0x15'),'fields':[_0x1e18('0xd'),_0x1e18('0x16')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x1e18('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index f8b1f31..04140af 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 _0x9b21=['client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5413b3,_0x5aa16d){var _0x47e610=function(_0x38c05b){while(--_0x38c05b){_0x5413b3['push'](_0x5413b3['shift']());}};_0x47e610(++_0x5aa16d);}(_0x9b21,0xb6));var _0x19b2=function(_0x3c25ff,_0x2b6676){_0x3c25ff=_0x3c25ff-0x0;var _0x1ca411=_0x9b21[_0x3c25ff];return _0x1ca411;};'use strict';var _=require(_0x19b2('0x0'));var util=require(_0x19b2('0x1'));var moment=require(_0x19b2('0x2'));var BPromise=require(_0x19b2('0x3'));var rs=require(_0x19b2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x19b2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x19b2('0x6'))(_0x19b2('0x7'));var config=require(_0x19b2('0x8'));var jayson=require(_0x19b2('0x9'));var client=jayson[_0x19b2('0xa')][_0x19b2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dc174,_0x37d3ab,_0x4ed936){return new BPromise(function(_0x553911,_0x1f2118){return client[_0x19b2('0xc')](_0x2dc174,_0x4ed936)[_0x19b2('0xd')](function(_0x4a264a){logger[_0x19b2('0xe')](_0x19b2('0xf'),_0x37d3ab,_0x19b2('0x10'));logger[_0x19b2('0x11')](_0x19b2('0x12'),_0x37d3ab,'request\x20sent',JSON['stringify'](_0x4a264a));if(_0x4a264a[_0x19b2('0x13')]){if(_0x4a264a['error'][_0x19b2('0x14')]===0x1f4){logger[_0x19b2('0x13')](_0x19b2('0xf'),_0x37d3ab,_0x4a264a[_0x19b2('0x13')]['message']);return _0x1f2118(_0x4a264a[_0x19b2('0x13')]['message']);}logger[_0x19b2('0x13')]('Disposition,\x20%s,\x20%s',_0x37d3ab,_0x4a264a[_0x19b2('0x13')][_0x19b2('0x15')]);return _0x553911(_0x4a264a[_0x19b2('0x13')]['message']);}else{logger[_0x19b2('0xe')](_0x19b2('0xf'),_0x37d3ab,_0x19b2('0x10'));_0x553911(_0x4a264a[_0x19b2('0x16')]['message']);}})[_0x19b2('0x17')](function(_0x1fddf4){logger[_0x19b2('0x13')](_0x19b2('0xf'),_0x37d3ab,_0x1fddf4);_0x1f2118(_0x1fddf4);});});} \ No newline at end of file +var _0x3d80=['message','lodash','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','result'];(function(_0x66c3a8,_0x186d44){var _0x481590=function(_0x26429b){while(--_0x26429b){_0x66c3a8['push'](_0x66c3a8['shift']());}};_0x481590(++_0x186d44);}(_0x3d80,0xb5));var _0x03d8=function(_0x45f3be,_0x2b377d){_0x45f3be=_0x45f3be-0x0;var _0x2026f5=_0x3d80[_0x45f3be];return _0x2026f5;};'use strict';var _=require(_0x03d8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x03d8('0x1'));var fs=require('fs');var Redis=require(_0x03d8('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x03d8('0x3'))(_0x03d8('0x4'));var config=require(_0x03d8('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x03d8('0x6')][_0x03d8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f9d3d,_0x1915ee,_0x254d94){return new BPromise(function(_0x55cc6e,_0x53fd88){return client['request'](_0x3f9d3d,_0x254d94)[_0x03d8('0x8')](function(_0x59d13b){logger[_0x03d8('0x9')](_0x03d8('0xa'),_0x1915ee,_0x03d8('0xb'));logger[_0x03d8('0xc')]('Disposition,\x20%s,\x20%s,\x20%s',_0x1915ee,'request\x20sent',JSON[_0x03d8('0xd')](_0x59d13b));if(_0x59d13b[_0x03d8('0xe')]){if(_0x59d13b[_0x03d8('0xe')][_0x03d8('0xf')]===0x1f4){logger[_0x03d8('0xe')](_0x03d8('0xa'),_0x1915ee,_0x59d13b[_0x03d8('0xe')]['message']);return _0x53fd88(_0x59d13b['error']['message']);}logger[_0x03d8('0xe')]('Disposition,\x20%s,\x20%s',_0x1915ee,_0x59d13b[_0x03d8('0xe')]['message']);return _0x55cc6e(_0x59d13b[_0x03d8('0xe')]['message']);}else{logger[_0x03d8('0x9')](_0x03d8('0xa'),_0x1915ee,_0x03d8('0xb'));_0x55cc6e(_0x59d13b[_0x03d8('0x10')][_0x03d8('0x11')]);}})['catch'](function(_0x492fd4){logger['error']('Disposition,\x20%s,\x20%s',_0x1915ee,_0x492fd4);_0x53fd88(_0x492fd4);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index ddb727e..4efe6c9 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 _0xa227=['delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show','post','create','update'];(function(_0x58efa6,_0x2c00bd){var _0x5d643c=function(_0x1d1ef2){while(--_0x1d1ef2){_0x58efa6['push'](_0x58efa6['shift']());}};_0x5d643c(++_0x2c00bd);}(_0xa227,0xb6));var _0x7a22=function(_0x1c582f,_0x3a6dc8){_0x1c582f=_0x1c582f-0x0;var _0x10e0a0=_0xa227[_0x1c582f];return _0x10e0a0;};'use strict';var multer=require('multer');var util=require(_0x7a22('0x0'));var path=require(_0x7a22('0x1'));var timeout=require(_0x7a22('0x2'));var express=require(_0x7a22('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7a22('0x4'));var interaction=require(_0x7a22('0x5'));var config=require(_0x7a22('0x6'));var controller=require(_0x7a22('0x7'));router['get']('/',auth[_0x7a22('0x8')](),controller[_0x7a22('0x9')]);router[_0x7a22('0xa')](_0x7a22('0xb'),auth['isAuthenticated'](),controller[_0x7a22('0xc')]);router[_0x7a22('0xd')]('/',auth[_0x7a22('0x8')](),controller[_0x7a22('0xe')]);router['put'](_0x7a22('0xb'),auth[_0x7a22('0x8')](),controller[_0x7a22('0xf')]);router[_0x7a22('0x10')](_0x7a22('0xb'),auth[_0x7a22('0x8')](),controller[_0x7a22('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1ad7=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x32017e,_0x546c4c){var _0x19981c=function(_0x4f15fd){while(--_0x4f15fd){_0x32017e['push'](_0x32017e['shift']());}};_0x19981c(++_0x546c4c);}(_0x1ad7,0x11e));var _0x71ad=function(_0x3cc563,_0x1598d3){_0x3cc563=_0x3cc563-0x0;var _0x11c044=_0x1ad7[_0x3cc563];return _0x11c044;};'use strict';var multer=require('multer');var util=require(_0x71ad('0x0'));var path=require('path');var timeout=require(_0x71ad('0x1'));var express=require(_0x71ad('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x71ad('0x3'));var interaction=require(_0x71ad('0x4'));var config=require(_0x71ad('0x5'));var controller=require(_0x71ad('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x71ad('0x7')]);router['get'](_0x71ad('0x8'),auth[_0x71ad('0x9')](),controller[_0x71ad('0xa')]);router[_0x71ad('0xb')]('/',auth['isAuthenticated'](),controller[_0x71ad('0xc')]);router[_0x71ad('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x71ad('0xe')]);router[_0x71ad('0xf')](_0x71ad('0x8'),auth['isAuthenticated'](),controller[_0x71ad('0x10')]);module[_0x71ad('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 6cf17b4..7c85f49 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 _0x04b6=['14400','4800','7200','v17,v27,v29','SIP','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','exports','ENUM','STRING','localstationid','2400','9600','12000'];(function(_0x6b88c,_0x3ae647){var _0x338030=function(_0x2a9509){while(--_0x2a9509){_0x6b88c['push'](_0x6b88c['shift']());}};_0x338030(++_0x3ae647);}(_0x04b6,0x129));var _0x604b=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0x04b6[_0x1ca890];return _0x3f8e01;};'use strict';var Sequelize=require('sequelize');module[_0x604b('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x604b('0x1')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x604b('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x604b('0x2')],'unique':_0x604b('0x3')},'minrate':{'type':Sequelize[_0x604b('0x1')](_0x604b('0x4'),'4800','7200',_0x604b('0x5'),_0x604b('0x6'),_0x604b('0x7')),'defaultValue':_0x604b('0x8')},'maxrate':{'type':Sequelize[_0x604b('0x1')](_0x604b('0x4'),_0x604b('0x8'),_0x604b('0x9'),'9600',_0x604b('0x6'),_0x604b('0x7')),'defaultValue':_0x604b('0x7')},'modem':{'type':Sequelize[_0x604b('0x2')],'defaultValue':_0x604b('0xa')},'gateway':{'type':Sequelize[_0x604b('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x604b('0x1')](_0x604b('0xb'),'IAX','DADHI',_0x604b('0xc')),'defaultValue':_0x604b('0xb')},'key':{'type':Sequelize[_0x604b('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x604b('0xd');}},'notificationSound':{'type':Sequelize[_0x604b('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x604b('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x604b('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x604b('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x604b('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x604b('0xf')],'allowNull':!![],'defaultValue':null,'comment':_0x604b('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3aa990){if(!_0x3aa990)this[_0x604b('0x11')]('mandatoryDispositionPauseId',null);this[_0x604b('0x11')](_0x604b('0x12'),_0x3aa990);}}}; \ No newline at end of file +var _0xf7c0=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x523196,_0x1d6d0a){var _0x3c75a1=function(_0x5f5ac5){while(--_0x5f5ac5){_0x523196['push'](_0x523196['shift']());}};_0x3c75a1(++_0x1d6d0a);}(_0xf7c0,0x1b5));var _0x0f7c=function(_0x11a164,_0x274dd7){_0x11a164=_0x11a164-0x0;var _0x5e359b=_0xf7c0[_0x11a164];return _0x5e359b;};'use strict';var Sequelize=require('sequelize');module[_0x0f7c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0f7c('0x1')]},'ecm':{'type':Sequelize[_0x0f7c('0x2')]('yes','no'),'defaultValue':_0x0f7c('0x3')},'headerinfo':{'type':Sequelize[_0x0f7c('0x1')],'defaultValue':_0x0f7c('0x4')},'localstationid':{'type':Sequelize[_0x0f7c('0x1')],'unique':_0x0f7c('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x0f7c('0x6'),_0x0f7c('0x7'),'7200','9600','12000','14400'),'defaultValue':_0x0f7c('0x7')},'maxrate':{'type':Sequelize[_0x0f7c('0x2')](_0x0f7c('0x6'),_0x0f7c('0x7'),_0x0f7c('0x8'),_0x0f7c('0x9'),_0x0f7c('0xa'),_0x0f7c('0xb')),'defaultValue':_0x0f7c('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x0f7c('0xc')},'gateway':{'type':Sequelize[_0x0f7c('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x0f7c('0xd'),_0x0f7c('0xe'),'DADHI',_0x0f7c('0xf')),'defaultValue':_0x0f7c('0xd')},'key':{'type':Sequelize[_0x0f7c('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0f7c('0x10')],'defaultValue':function(){return _0x0f7c('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0f7c('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0f7c('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0f7c('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0f7c('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0f7c('0x13')],'allowNull':!![],'defaultValue':null,'comment':_0x0f7c('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x18bbf7){if(!_0x18bbf7)this[_0x0f7c('0x15')](_0x0f7c('0x16'),null);this[_0x0f7c('0x15')](_0x0f7c('0x17'),_0x18bbf7);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index f59278d..5095b9d 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 _0xfac2=['includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','name','addDisposition','getDispositions','findOne','Disposition','sort','FaxAccountId','ids','CannedAnswer','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','fullname','internal','Tags','tag','sequelize','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','exten','localstationid','app','type','system','description','appdata','push','Answer','CDR(type)=inbound-fax','Set','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','VoiceExtension','updateAccountApplications','tech','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','List','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','stack','send','render','merge','body','contact','interaction','account','Pause','map','FaxAccount','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','options'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0xfac2,0x1d1));var _0x2fac=function(_0x514c00,_0x59646d){_0x514c00=_0x514c00-0x0;var _0x319129=_0xfac2[_0x514c00];return _0x319129;};'use strict';var emlformat=require(_0x2fac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2fac('0x1'));var jsonpatch=require(_0x2fac('0x2'));var rp=require('request-promise');var moment=require(_0x2fac('0x3'));var BPromise=require(_0x2fac('0x4'));var Mustache=require('mustache');var util=require(_0x2fac('0x5'));var path=require(_0x2fac('0x6'));var sox=require(_0x2fac('0x7'));var csv=require(_0x2fac('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2fac('0x9'));var _=require(_0x2fac('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2fac('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2fac('0xc'));var authService=require(_0x2fac('0xd'));var qs=require(_0x2fac('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2fac('0xf'));var logger=require('../../config/logger')(_0x2fac('0x10'));var utils=require(_0x2fac('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x2fac('0x12'));var db=require(_0x2fac('0x13'))['db'];config[_0x2fac('0x14')]=_[_0x2fac('0x15')](config[_0x2fac('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x2fac('0x16'))(new Redis(config[_0x2fac('0x14')]));require(_0x2fac('0x17'))[_0x2fac('0x18')](socket);var jayson=require(_0x2fac('0x19'));var client=jayson[_0x2fac('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x2fac('0x1a')][_0x2fac('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2ce361,_0x4a9334,_0x3cc4e4,_0x29f9e7){return new BPromise(function(_0x366cd3,_0xac0b56){var _0x67acca=_0x29f9e7||client;return _0x67acca['request'](_0x2ce361,_0x3cc4e4)[_0x2fac('0x1c')](function(_0x52bca6){logger[_0x2fac('0x1d')](_0x2fac('0x1e'),_0x4a9334,_0x2fac('0x1f'));logger['debug'](_0x2fac('0x20'),_0x4a9334,_0x2fac('0x1f'),JSON['stringify'](_0x52bca6));if(_0x52bca6[_0x2fac('0x21')]){if(_0x52bca6[_0x2fac('0x21')][_0x2fac('0x22')]===0x1f4){logger[_0x2fac('0x21')](_0x2fac('0x1e'),_0x4a9334,_0x52bca6[_0x2fac('0x21')][_0x2fac('0x23')]);return _0xac0b56(_0x52bca6['error'][_0x2fac('0x23')]);}logger[_0x2fac('0x21')](_0x2fac('0x1e'),_0x4a9334,_0x52bca6[_0x2fac('0x21')][_0x2fac('0x23')]);return _0x366cd3(_0x52bca6['error']['message']);}else{logger['info'](_0x2fac('0x1e'),_0x4a9334,_0x2fac('0x1f'));_0x366cd3(_0x52bca6[_0x2fac('0x24')][_0x2fac('0x23')]);}})[_0x2fac('0x25')](function(_0x353097){logger[_0x2fac('0x21')](_0x2fac('0x1e'),_0x4a9334,_0x353097);_0xac0b56(_0x353097);});});}function respondWithStatusCode(_0x368cb6,_0x231cc7){_0x231cc7=_0x231cc7||0xcc;return function(_0x4e7c72){if(_0x4e7c72){return _0x368cb6[_0x2fac('0x26')](_0x231cc7);}return _0x368cb6[_0x2fac('0x27')](_0x231cc7)[_0x2fac('0x28')]();};}function respondWithResult(_0x34e193,_0x330ac1){_0x330ac1=_0x330ac1||0xc8;return function(_0x103640){if(_0x103640){return _0x34e193[_0x2fac('0x27')](_0x330ac1)[_0x2fac('0x29')](_0x103640);}};}function respondWithFilteredResult(_0x53f6a6,_0x325c0d){return function(_0x4eb0c1){if(_0x4eb0c1){var _0x21bcfe=typeof _0x325c0d[_0x2fac('0x2a')]===_0x2fac('0x2b')&&typeof _0x325c0d[_0x2fac('0x2c')]===_0x2fac('0x2b');var _0x122ffa=_0x4eb0c1[_0x2fac('0x2d')];var _0x3f593a=_0x21bcfe?0x0:_0x325c0d[_0x2fac('0x2a')];var _0x305c32=_0x21bcfe?_0x4eb0c1['count']:_0x325c0d[_0x2fac('0x2a')]+_0x325c0d[_0x2fac('0x2c')];var _0x42c555;if(_0x305c32>=_0x122ffa){_0x305c32=_0x122ffa;_0x42c555=0xc8;}else{_0x42c555=0xce;}_0x53f6a6['status'](_0x42c555);return _0x53f6a6[_0x2fac('0x2e')](_0x2fac('0x2f'),_0x3f593a+'-'+_0x305c32+'/'+_0x122ffa)['json'](_0x4eb0c1);}return null;};}function patchUpdates(_0xa464d6){return function(_0x505687){try{jsonpatch[_0x2fac('0x30')](_0x505687,_0xa464d6,!![]);}catch(_0x1b8d23){return BPromise['reject'](_0x1b8d23);}return _0x505687[_0x2fac('0x31')]();};}function saveUpdates(_0x159309,_0x9bfe83){return function(_0x150a81){if(_0x150a81){return _0x150a81[_0x2fac('0x32')](_0x159309)[_0x2fac('0x1c')](function(_0x1c3769){return _0x1c3769;});}return null;};}function removeEntity(_0x3322a0,_0x58efa4){return function(_0x465961){if(_0x465961){return _0x465961[_0x2fac('0x33')]()[_0x2fac('0x1c')](function(){var _0x25f531=_0x465961[_0x2fac('0x34')]({'plain':!![]});var _0x576087='FaxAccounts';return db['UserProfileResource'][_0x2fac('0x33')]({'where':{'type':_0x576087,'resourceId':_0x25f531['id']}})[_0x2fac('0x1c')](function(){return _0x465961;});})[_0x2fac('0x1c')](function(){_0x3322a0['status'](0xcc)[_0x2fac('0x28')]();});}};}function handleEntityNotFound(_0x3ddd26,_0x4343e2){return function(_0x3ab463){if(!_0x3ab463){_0x3ddd26[_0x2fac('0x26')](0x194);}return _0x3ab463;};}function handleError(_0x573930,_0x1dac20){_0x1dac20=_0x1dac20||0x1f4;return function(_0x4d10a1){logger[_0x2fac('0x21')](_0x4d10a1[_0x2fac('0x35')]);if(_0x4d10a1['name']){delete _0x4d10a1['name'];}_0x573930[_0x2fac('0x27')](_0x1dac20)[_0x2fac('0x36')](_0x4d10a1);};}function getMustacheRender(_0x13ea60,_0x5241d7){return Mustache[_0x2fac('0x37')](_0x13ea60,_[_0x2fac('0x38')](_0x5241d7[_0x2fac('0x39')],{'contact':_0x5241d7[_0x2fac('0x3a')],'message':_0x5241d7['message'],'agent':_0x5241d7['agent'],'interaction':_0x5241d7[_0x2fac('0x3b')],'account':_0x5241d7[_0x2fac('0x3c')]}))||'';}exports['index']=function(_0x2bebcc,_0x303392){var _0x3feafa={'include':[{'model':db[_0x2fac('0x3d')],'as':'mandatoryDispositionPause'}]},_0x578327={},_0x106c4c={'count':0x0,'rows':[]};var _0x27d3f9=_[_0x2fac('0x3e')](db[_0x2fac('0x3f')][_0x2fac('0x40')],function(_0x1f1d6e){return{'name':_0x1f1d6e[_0x2fac('0x41')],'type':_0x1f1d6e['type']['key']};});_0x578327[_0x2fac('0x42')]=_[_0x2fac('0x3e')](_0x27d3f9,'name');_0x578327[_0x2fac('0x43')]=_[_0x2fac('0x44')](_0x2bebcc['query']);_0x578327[_0x2fac('0x45')]=_['intersection'](_0x578327[_0x2fac('0x42')],_0x578327[_0x2fac('0x43')]);_0x3feafa[_0x2fac('0x46')]=_['intersection'](_0x578327['model'],qs['fields'](_0x2bebcc[_0x2fac('0x43')][_0x2fac('0x47')]));_0x3feafa['attributes']=_0x3feafa['attributes'][_0x2fac('0x48')]?_0x3feafa['attributes']:_0x578327['model'];if(!_0x2bebcc[_0x2fac('0x43')][_0x2fac('0x49')](_0x2fac('0x4a'))){_0x3feafa[_0x2fac('0x2c')]=qs[_0x2fac('0x2c')](_0x2bebcc[_0x2fac('0x43')][_0x2fac('0x2c')]);_0x3feafa[_0x2fac('0x2a')]=qs[_0x2fac('0x2a')](_0x2bebcc[_0x2fac('0x43')]['offset']);}_0x3feafa[_0x2fac('0x4b')]=qs['sort'](_0x2bebcc[_0x2fac('0x43')]['sort']);_0x3feafa[_0x2fac('0x4c')]=qs[_0x2fac('0x45')](_[_0x2fac('0x4d')](_0x2bebcc[_0x2fac('0x43')],_0x578327['filters']),_0x27d3f9);if(_0x2bebcc['query'][_0x2fac('0x4e')]){_0x3feafa[_0x2fac('0x4c')]=_[_0x2fac('0x38')](_0x3feafa[_0x2fac('0x4c')],{'$or':_[_0x2fac('0x3e')](_0x27d3f9,function(_0x5dce27){if(_0x5dce27['type']!==_0x2fac('0x4f')){var _0x3f7622={};_0x3f7622[_0x5dce27['name']]={'$like':'%'+_0x2bebcc[_0x2fac('0x43')]['filter']+'%'};return _0x3f7622;}})});}_0x3feafa=_[_0x2fac('0x38')]({},_0x3feafa,_0x2bebcc[_0x2fac('0x50')]);var _0x12a7c1={'where':_0x3feafa[_0x2fac('0x4c')]};return db[_0x2fac('0x3f')][_0x2fac('0x2d')](_0x12a7c1)['then'](function(_0x41378a){_0x106c4c['count']=_0x41378a;if(_0x2bebcc[_0x2fac('0x43')][_0x2fac('0x51')]){_0x3feafa[_0x2fac('0x52')]=[{'all':!![]}];}return db[_0x2fac('0x3f')][_0x2fac('0x53')](_0x3feafa);})[_0x2fac('0x1c')](function(_0x4987a1){_0x106c4c[_0x2fac('0x54')]=_0x4987a1;return _0x106c4c;})[_0x2fac('0x1c')](respondWithFilteredResult(_0x303392,_0x3feafa))[_0x2fac('0x25')](handleError(_0x303392,null));};exports[_0x2fac('0x55')]=function(_0x2c7f91,_0x3601e8){var _0x5dc987={'raw':![],'where':{'id':_0x2c7f91[_0x2fac('0x56')]['id']},'include':[{'model':db[_0x2fac('0x3d')],'as':_0x2fac('0x57')}]},_0x1e85c9={};_0x1e85c9[_0x2fac('0x42')]=_[_0x2fac('0x44')](db[_0x2fac('0x3f')][_0x2fac('0x40')]);_0x1e85c9[_0x2fac('0x43')]=_[_0x2fac('0x44')](_0x2c7f91['query']);_0x1e85c9[_0x2fac('0x45')]=_[_0x2fac('0x58')](_0x1e85c9[_0x2fac('0x42')],_0x1e85c9[_0x2fac('0x43')]);_0x5dc987[_0x2fac('0x46')]=_[_0x2fac('0x58')](_0x1e85c9['model'],qs['fields'](_0x2c7f91[_0x2fac('0x43')]['fields']));_0x5dc987[_0x2fac('0x46')]=_0x5dc987[_0x2fac('0x46')][_0x2fac('0x48')]?_0x5dc987['attributes']:_0x1e85c9[_0x2fac('0x42')];if(_0x2c7f91[_0x2fac('0x43')][_0x2fac('0x51')]){_0x5dc987[_0x2fac('0x52')]=[{'all':!![]}];}_0x5dc987=_[_0x2fac('0x38')]({},_0x5dc987,_0x2c7f91[_0x2fac('0x50')]);return db[_0x2fac('0x3f')][_0x2fac('0x59')](_0x5dc987)[_0x2fac('0x1c')](handleEntityNotFound(_0x3601e8,null))[_0x2fac('0x1c')](respondWithResult(_0x3601e8,null))[_0x2fac('0x25')](handleError(_0x3601e8,null));};exports[_0x2fac('0x5a')]=function(_0x54e420,_0x163a56){return db[_0x2fac('0x3f')][_0x2fac('0x5a')](_0x54e420[_0x2fac('0x39')],{})['then'](function(_0x1fcc9f){var _0x26668f=_0x54e420[_0x2fac('0x5b')]['get']({'plain':!![]});if(!_0x26668f)throw new Error(_0x2fac('0x5c'));if(_0x26668f[_0x2fac('0x5d')]===_0x2fac('0x5b')){var _0x48f8cc=_0x1fcc9f['get']({'plain':!![]});var _0xae6b60='FaxAccounts';return db['UserProfileSection'][_0x2fac('0x59')]({'where':{'name':_0xae6b60,'userProfileId':_0x26668f[_0x2fac('0x5e')]},'raw':!![]})[_0x2fac('0x1c')](function(_0x1172ce){if(_0x1172ce&&_0x1172ce['autoAssociation']===0x0){return db[_0x2fac('0x5f')]['create']({'name':_0x48f8cc['name'],'resourceId':_0x48f8cc['id'],'type':_0x1172ce[_0x2fac('0x60')],'sectionId':_0x1172ce['id']},{})['then'](function(){return _0x1fcc9f;});}else{return _0x1fcc9f;}})['catch'](function(_0x5d0aed){logger[_0x2fac('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d0aed);throw _0x5d0aed;});}return _0x1fcc9f;})['then'](respondWithResult(_0x163a56,0xc9))[_0x2fac('0x25')](handleError(_0x163a56,null));};exports[_0x2fac('0x32')]=function(_0x4f0e9e,_0x163e07){if(_0x4f0e9e[_0x2fac('0x39')]['id']){delete _0x4f0e9e[_0x2fac('0x39')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x4f0e9e[_0x2fac('0x56')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x163e07,null))[_0x2fac('0x1c')](saveUpdates(_0x4f0e9e[_0x2fac('0x39')],null))['then'](respondWithResult(_0x163e07,null))[_0x2fac('0x25')](handleError(_0x163e07,null));};exports['destroy']=function(_0xba1a2e,_0x577925){return db[_0x2fac('0x3f')]['find']({'where':{'id':_0xba1a2e['params']['id']}})[_0x2fac('0x1c')](handleEntityNotFound(_0x577925,null))[_0x2fac('0x1c')](removeEntity(_0x577925,null))['catch'](handleError(_0x577925,null));};exports['describe']=function(_0x52466c,_0x40663c){return db[_0x2fac('0x3f')]['describe']()['then'](respondWithResult(_0x40663c,null))[_0x2fac('0x25')](handleError(_0x40663c,null));};exports[_0x2fac('0x61')]=function(_0x16b4c9,_0x5a7997,_0x354d81){if(_0x16b4c9[_0x2fac('0x39')]['id']){delete _0x16b4c9[_0x2fac('0x39')]['id'];}return db[_0x2fac('0x3f')][_0x2fac('0x59')]({'where':{'id':_0x16b4c9[_0x2fac('0x56')]['id']}})[_0x2fac('0x1c')](handleEntityNotFound(_0x5a7997,null))[_0x2fac('0x1c')](function(_0x27305d){if(_0x27305d){_0x16b4c9[_0x2fac('0x39')]['FaxAccountId']=_0x27305d['id'];return db['Disposition'][_0x2fac('0x5a')](_0x16b4c9['body']);}})[_0x2fac('0x1c')](respondWithResult(_0x5a7997,null))[_0x2fac('0x25')](handleError(_0x5a7997,null));};exports[_0x2fac('0x62')]=function(_0x2ad9d4,_0x5637f2,_0x3c0281){var _0x1f5e82={'raw':![],'where':{}};var _0x5b61d1={};var _0x5c4bbd={'count':0x0,'rows':[]};return db[_0x2fac('0x3f')][_0x2fac('0x63')]({'where':{'id':_0x2ad9d4[_0x2fac('0x56')]['id']}})[_0x2fac('0x1c')](handleEntityNotFound(_0x5637f2,null))[_0x2fac('0x1c')](function(_0xf141f3){if(_0xf141f3){_0x5b61d1[_0x2fac('0x42')]=_[_0x2fac('0x44')](db[_0x2fac('0x64')]['rawAttributes']);_0x5b61d1[_0x2fac('0x43')]=_['keys'](_0x2ad9d4[_0x2fac('0x43')]);_0x5b61d1[_0x2fac('0x45')]=_[_0x2fac('0x58')](_0x5b61d1['model'],_0x5b61d1[_0x2fac('0x43')]);_0x1f5e82[_0x2fac('0x46')]=_[_0x2fac('0x58')](_0x5b61d1[_0x2fac('0x42')],qs[_0x2fac('0x47')](_0x2ad9d4[_0x2fac('0x43')][_0x2fac('0x47')]));_0x1f5e82[_0x2fac('0x46')]=_0x1f5e82[_0x2fac('0x46')][_0x2fac('0x48')]?_0x1f5e82[_0x2fac('0x46')]:_0x5b61d1['model'];if(!_0x2ad9d4[_0x2fac('0x43')][_0x2fac('0x49')](_0x2fac('0x4a'))){_0x1f5e82[_0x2fac('0x2c')]=qs[_0x2fac('0x2c')](_0x2ad9d4[_0x2fac('0x43')][_0x2fac('0x2c')]);_0x1f5e82[_0x2fac('0x2a')]=qs[_0x2fac('0x2a')](_0x2ad9d4[_0x2fac('0x43')][_0x2fac('0x2a')]);}_0x1f5e82['order']=qs[_0x2fac('0x65')](_0x2ad9d4[_0x2fac('0x43')][_0x2fac('0x65')]);_0x1f5e82[_0x2fac('0x4c')]=qs[_0x2fac('0x45')](_[_0x2fac('0x4d')](_0x2ad9d4[_0x2fac('0x43')],_0x5b61d1[_0x2fac('0x45')]));_0x1f5e82[_0x2fac('0x4c')][_0x2fac('0x66')]=_0xf141f3['id'];if(_0x2ad9d4['query'][_0x2fac('0x4e')]){_0x1f5e82[_0x2fac('0x4c')]=_[_0x2fac('0x38')](_0x1f5e82[_0x2fac('0x4c')],{'$or':_[_0x2fac('0x3e')](_0x1f5e82[_0x2fac('0x46')],function(_0x375d79){var _0x4d7c35={};_0x4d7c35[_0x375d79]={'$like':'%'+_0x2ad9d4['query'][_0x2fac('0x4e')]+'%'};return _0x4d7c35;})});}_0x1f5e82=_[_0x2fac('0x38')]({},_0x1f5e82,_0x2ad9d4[_0x2fac('0x50')]);return db['Disposition'][_0x2fac('0x2d')]({'where':_0x1f5e82[_0x2fac('0x4c')]})[_0x2fac('0x1c')](function(_0x111b9b){_0x5c4bbd[_0x2fac('0x2d')]=_0x111b9b;if(_0x2ad9d4[_0x2fac('0x43')][_0x2fac('0x51')]){_0x1f5e82[_0x2fac('0x52')]=[{'all':!![]}];}return db[_0x2fac('0x64')]['findAll'](_0x1f5e82);})[_0x2fac('0x1c')](function(_0x57e8af){_0x5c4bbd[_0x2fac('0x54')]=_0x57e8af;return _0x5c4bbd;});}})[_0x2fac('0x1c')](respondWithFilteredResult(_0x5637f2,_0x1f5e82))[_0x2fac('0x25')](handleError(_0x5637f2,null));};exports['removeDispositions']=function(_0x38f105,_0x30bdf1,_0x13adfc){return db[_0x2fac('0x3f')][_0x2fac('0x59')]({'where':{'id':_0x38f105[_0x2fac('0x56')]['id']}})[_0x2fac('0x1c')](handleEntityNotFound(_0x30bdf1,null))[_0x2fac('0x1c')](function(_0x45c9e7){if(_0x45c9e7){return _0x45c9e7['removeDispositions'](_0x38f105[_0x2fac('0x43')][_0x2fac('0x67')]);}})[_0x2fac('0x1c')](respondWithStatusCode(_0x30bdf1,null))[_0x2fac('0x25')](handleError(_0x30bdf1,null));};exports['addAnswer']=function(_0x2ac6b4,_0x3bab8f,_0x4a0a6a){if(_0x2ac6b4[_0x2fac('0x39')]['id']){delete _0x2ac6b4[_0x2fac('0x39')]['id'];}return db[_0x2fac('0x3f')][_0x2fac('0x59')]({'where':{'id':_0x2ac6b4[_0x2fac('0x56')]['id']}})[_0x2fac('0x1c')](handleEntityNotFound(_0x3bab8f,null))[_0x2fac('0x1c')](function(_0x5ec262){if(_0x5ec262){_0x2ac6b4[_0x2fac('0x39')][_0x2fac('0x66')]=_0x5ec262['id'];return db[_0x2fac('0x68')][_0x2fac('0x5a')](_0x2ac6b4['body']);}})['then'](respondWithResult(_0x3bab8f,null))[_0x2fac('0x25')](handleError(_0x3bab8f,null));};exports['getAnswers']=function(_0x2f933f,_0x14029b,_0x40c77a){var _0x106e66={'raw':![],'where':{}};var _0x180f18={};var _0x225204={'count':0x0,'rows':[]};return db[_0x2fac('0x3f')][_0x2fac('0x63')]({'where':{'id':_0x2f933f[_0x2fac('0x56')]['id']}})[_0x2fac('0x1c')](handleEntityNotFound(_0x14029b,null))['then'](function(_0xf6ebe9){if(_0xf6ebe9){_0x180f18[_0x2fac('0x42')]=_[_0x2fac('0x44')](db[_0x2fac('0x68')][_0x2fac('0x40')]);_0x180f18[_0x2fac('0x43')]=_[_0x2fac('0x44')](_0x2f933f['query']);_0x180f18[_0x2fac('0x45')]=_['intersection'](_0x180f18[_0x2fac('0x42')],_0x180f18[_0x2fac('0x43')]);_0x106e66['attributes']=_[_0x2fac('0x58')](_0x180f18[_0x2fac('0x42')],qs[_0x2fac('0x47')](_0x2f933f['query']['fields']));_0x106e66['attributes']=_0x106e66['attributes'][_0x2fac('0x48')]?_0x106e66[_0x2fac('0x46')]:_0x180f18[_0x2fac('0x42')];if(!_0x2f933f['query'][_0x2fac('0x49')]('nolimit')){_0x106e66[_0x2fac('0x2c')]=qs['limit'](_0x2f933f[_0x2fac('0x43')][_0x2fac('0x2c')]);_0x106e66['offset']=qs['offset'](_0x2f933f[_0x2fac('0x43')][_0x2fac('0x2a')]);}_0x106e66[_0x2fac('0x4b')]=qs['sort'](_0x2f933f[_0x2fac('0x43')]['sort']);_0x106e66[_0x2fac('0x4c')]=qs[_0x2fac('0x45')](_[_0x2fac('0x4d')](_0x2f933f['query'],_0x180f18[_0x2fac('0x45')]));_0x106e66[_0x2fac('0x4c')]['FaxAccountId']=_0xf6ebe9['id'];if(_0x2f933f[_0x2fac('0x43')][_0x2fac('0x4e')]){_0x106e66[_0x2fac('0x4c')]=_[_0x2fac('0x38')](_0x106e66[_0x2fac('0x4c')],{'$or':_['map'](_0x106e66['attributes'],function(_0x119c92){var _0x3126d4={};_0x3126d4[_0x119c92]={'$like':'%'+_0x2f933f[_0x2fac('0x43')][_0x2fac('0x4e')]+'%'};return _0x3126d4;})});}_0x106e66=_[_0x2fac('0x38')]({},_0x106e66,_0x2f933f[_0x2fac('0x50')]);return db[_0x2fac('0x68')]['count']({'where':_0x106e66['where']})[_0x2fac('0x1c')](function(_0x4b6e41){_0x225204[_0x2fac('0x2d')]=_0x4b6e41;if(_0x2f933f[_0x2fac('0x43')][_0x2fac('0x51')]){_0x106e66['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x2fac('0x53')](_0x106e66);})[_0x2fac('0x1c')](function(_0x3f93df){_0x225204['rows']=_0x3f93df;return _0x225204;});}})['then'](respondWithFilteredResult(_0x14029b,_0x106e66))[_0x2fac('0x25')](handleError(_0x14029b,null));};exports['removeAnswers']=function(_0x111d1a,_0x29bc13,_0x2d7774){return db[_0x2fac('0x3f')][_0x2fac('0x59')]({'where':{'id':_0x111d1a[_0x2fac('0x56')]['id']}})[_0x2fac('0x1c')](handleEntityNotFound(_0x29bc13,null))[_0x2fac('0x1c')](function(_0x47a55e){if(_0x47a55e){return _0x47a55e['removeAnswers'](_0x111d1a[_0x2fac('0x43')][_0x2fac('0x67')]);}})[_0x2fac('0x1c')](respondWithStatusCode(_0x29bc13,null))[_0x2fac('0x25')](handleError(_0x29bc13,null));};exports[_0x2fac('0x69')]=function(_0x55e85b,_0xfabcc1,_0x16c021){return db[_0x2fac('0x6a')][_0x2fac('0x59')]({'where':{'id':_0x55e85b['params']['id']}})[_0x2fac('0x1c')](handleEntityNotFound(_0xfabcc1,null))[_0x2fac('0x1c')](function(_0x3f4d1b){if(_0x3f4d1b){return _0x3f4d1b[_0x2fac('0x69')](_0x55e85b[_0x2fac('0x39')][_0x2fac('0x67')],_[_0x2fac('0x6b')](_0x55e85b[_0x2fac('0x39')],[_0x2fac('0x67'),'id'])||{});}})[_0x2fac('0x1c')](respondWithResult(_0xfabcc1,null))[_0x2fac('0x25')](handleError(_0xfabcc1,null));};exports[_0x2fac('0x6c')]=function(_0x156c00,_0x3ade44,_0xbd7fb0){var _0x3bc4c1={'raw':![],'where':{}};var _0xc6b72f={};var _0xa72bbe={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2fac('0x63')]({'where':{'id':_0x156c00['params']['id']}})[_0x2fac('0x1c')](handleEntityNotFound(_0x3ade44,null))[_0x2fac('0x1c')](function(_0xf92512){if(_0xf92512){_0xc6b72f[_0x2fac('0x42')]=_[_0x2fac('0x44')](db[_0x2fac('0x6a')][_0x2fac('0x40')]);_0xc6b72f['query']=_['keys'](_0x156c00[_0x2fac('0x43')]);_0xc6b72f[_0x2fac('0x45')]=_['intersection'](_0xc6b72f[_0x2fac('0x42')],_0xc6b72f[_0x2fac('0x43')]);_0x3bc4c1[_0x2fac('0x46')]=_[_0x2fac('0x58')](_0xc6b72f['model'],qs[_0x2fac('0x47')](_0x156c00[_0x2fac('0x43')]['fields']));_0x3bc4c1[_0x2fac('0x46')]=_0x3bc4c1[_0x2fac('0x46')]['length']?_0x3bc4c1['attributes']:_0xc6b72f[_0x2fac('0x42')];if(!_0x156c00['query'][_0x2fac('0x49')](_0x2fac('0x4a'))){_0x3bc4c1[_0x2fac('0x2c')]=qs[_0x2fac('0x2c')](_0x156c00[_0x2fac('0x43')][_0x2fac('0x2c')]);_0x3bc4c1['offset']=qs[_0x2fac('0x2a')](_0x156c00[_0x2fac('0x43')]['offset']);}_0x3bc4c1[_0x2fac('0x4b')]=qs[_0x2fac('0x65')](_0x156c00[_0x2fac('0x43')][_0x2fac('0x65')]);_0x3bc4c1['where']=qs[_0x2fac('0x45')](_[_0x2fac('0x4d')](_0x156c00[_0x2fac('0x43')],_0xc6b72f[_0x2fac('0x45')]));_0x3bc4c1['where'][_0x2fac('0x66')]=_0xf92512['id'];if(_0x156c00[_0x2fac('0x43')]['filter']){_0x3bc4c1[_0x2fac('0x4c')]=_['merge'](_0x3bc4c1['where'],{'$or':_[_0x2fac('0x3e')](_0x3bc4c1[_0x2fac('0x46')],function(_0x1b4421){var _0x4bc61c={};_0x4bc61c[_0x1b4421]={'$like':'%'+_0x156c00['query'][_0x2fac('0x4e')]+'%'};return _0x4bc61c;})});}_0x3bc4c1=_[_0x2fac('0x38')]({},_0x3bc4c1,_0x156c00['options']);return db['FaxInteraction'][_0x2fac('0x2d')]({'where':_0x3bc4c1['where']})[_0x2fac('0x1c')](function(_0x205fa8){_0xa72bbe[_0x2fac('0x2d')]=_0x205fa8;if(_0x156c00[_0x2fac('0x43')]['includeAll']){_0x3bc4c1[_0x2fac('0x52')]=[{'model':db['CmContact'],'as':_0x2fac('0x6d'),'required':![]},{'model':db[_0x2fac('0x6e')],'as':'Owner','attributes':[_0x2fac('0x60'),_0x2fac('0x6f'),_0x2fac('0x70')],'required':![]},{'model':db['Tag'],'as':_0x2fac('0x71'),'attributes':['id',_0x2fac('0x60'),'color'],'where':_0x156c00[_0x2fac('0x43')]['tag']?{'id':_0x156c00[_0x2fac('0x43')][_0x2fac('0x72')]}:undefined,'required':_0x156c00['query'][_0x2fac('0x72')]?!![]:![]}];}return db[_0x2fac('0x6a')][_0x2fac('0x53')](_0x3bc4c1);})[_0x2fac('0x1c')](function(_0x481244){_0xa72bbe[_0x2fac('0x54')]=_0x481244;return _0xa72bbe;});}})[_0x2fac('0x1c')](respondWithFilteredResult(_0x3ade44,_0x3bc4c1))[_0x2fac('0x25')](handleError(_0x3ade44,null));};exports['addApplications']=function(_0x11dbd2,_0x46eafc,_0x5d8529){return db['FaxAccount'][_0x2fac('0x63')]({'where':{'id':_0x11dbd2[_0x2fac('0x56')]['id']}})[_0x2fac('0x1c')](handleEntityNotFound(_0x46eafc,null))[_0x2fac('0x1c')](function(_0x15f4c9){if(_0x15f4c9){return db[_0x2fac('0x73')]['transaction'](function(_0x4ba92e){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x11dbd2['params']['id']},'transaction':_0x4ba92e})[_0x2fac('0x1c')](function(_0x1ca34c){var _0x3a812b=_[_0x2fac('0x3e')](_0x11dbd2[_0x2fac('0x39')],function(_0x13de91){_0x13de91['FaxAccountId']=_0x11dbd2['params']['id'];return _0x13de91;});return db[_0x2fac('0x74')][_0x2fac('0x75')](_0x3a812b,{'transaction':_0x4ba92e});});})['then'](function(){return db[_0x2fac('0x74')][_0x2fac('0x76')]({'where':{'FaxAccountId':_0x11dbd2[_0x2fac('0x56')]['id']},'order':_0x2fac('0x77')});});}})[_0x2fac('0x1c')](respondWithResult(_0x46eafc,null))[_0x2fac('0x25')](handleError(_0x46eafc,null));};exports['getApplications']=function(_0x244ab0,_0x9950bb,_0xf62b39){var _0x7d59b7={};var _0xd5aca7={};var _0x591b29;var _0x221875;return db[_0x2fac('0x3f')][_0x2fac('0x63')]({'where':{'id':_0x244ab0[_0x2fac('0x56')]['id']}})[_0x2fac('0x1c')](handleEntityNotFound(_0x9950bb,null))[_0x2fac('0x1c')](function(_0x1bf6a5){if(_0x1bf6a5){_0x591b29=_0x1bf6a5;_0xd5aca7['model']=_[_0x2fac('0x44')](db[_0x2fac('0x74')]['rawAttributes']);_0xd5aca7[_0x2fac('0x43')]=_[_0x2fac('0x44')](_0x244ab0[_0x2fac('0x43')]);_0xd5aca7[_0x2fac('0x45')]=_[_0x2fac('0x58')](_0xd5aca7[_0x2fac('0x42')],_0xd5aca7[_0x2fac('0x43')]);_0x7d59b7['attributes']=_[_0x2fac('0x58')](_0xd5aca7['model'],qs[_0x2fac('0x47')](_0x244ab0['query']['fields']));_0x7d59b7[_0x2fac('0x46')]=_0x7d59b7[_0x2fac('0x46')][_0x2fac('0x48')]?_0x7d59b7[_0x2fac('0x46')]:_0xd5aca7['model'];_0x7d59b7[_0x2fac('0x4b')]=qs[_0x2fac('0x65')](_0x244ab0['query'][_0x2fac('0x65')]);_0x7d59b7[_0x2fac('0x4c')]=qs[_0x2fac('0x45')](_['pick'](_0x244ab0['query'],_0xd5aca7['filters']));if(_0x244ab0[_0x2fac('0x43')][_0x2fac('0x4e')]){_0x7d59b7[_0x2fac('0x4c')]=_[_0x2fac('0x38')](_0x7d59b7[_0x2fac('0x4c')],{'$or':_[_0x2fac('0x3e')](_0x7d59b7[_0x2fac('0x46')],function(_0x663527){var _0x561c2a={};_0x561c2a[_0x663527]={'$like':'%'+_0x244ab0['query']['filter']+'%'};return _0x561c2a;})});}_0x7d59b7=_[_0x2fac('0x38')]({},_0x7d59b7,_0x244ab0[_0x2fac('0x50')]);return _0x591b29[_0x2fac('0x78')](_0x7d59b7);}})[_0x2fac('0x1c')](function(_0x219d6d){if(_0x219d6d){_0x221875=_0x219d6d['length'];if(!_0x244ab0[_0x2fac('0x43')][_0x2fac('0x49')](_0x2fac('0x4a'))){_0x7d59b7[_0x2fac('0x2c')]=qs[_0x2fac('0x2c')](_0x244ab0[_0x2fac('0x43')][_0x2fac('0x2c')]);_0x7d59b7[_0x2fac('0x2a')]=qs['offset'](_0x244ab0[_0x2fac('0x43')][_0x2fac('0x2a')]);}return _0x591b29[_0x2fac('0x78')](_0x7d59b7);}})[_0x2fac('0x1c')](function(_0x121ffe){if(_0x121ffe){return _0x121ffe?{'count':_0x221875,'rows':_0x121ffe}:null;}})[_0x2fac('0x1c')](respondWithResult(_0x9950bb,null))[_0x2fac('0x25')](handleError(_0x9950bb,null));};function Extension(_0x19bd8b,_0x53b56a,_0x18b23b,_0x2a6b2d){this[_0x2fac('0x79')]='from-voip-provider';this[_0x2fac('0x7a')]=_0x19bd8b[_0x2fac('0x7b')];this[_0x2fac('0x7c')]=_0x2a6b2d;this[_0x2fac('0x7d')]=_0x2fac('0x7e');this[_0x2fac('0x7f')]='Fax\x20Extension';this[_0x2fac('0x66')]=_0x19bd8b['id'];this[_0x2fac('0x77')]=_0x53b56a;this[_0x2fac('0x80')]=_0x18b23b;}function createExtensionsReciveFax(_0x353cfd){var _0x366875=0x1;var _0x5dc4fa=[];_0x5dc4fa[_0x2fac('0x81')](new Extension(_0x353cfd,_0x366875,'',_0x2fac('0x82')));_0x366875+=0x1;_0x5dc4fa[_0x2fac('0x81')](new Extension(_0x353cfd,_0x366875,_0x2fac('0x83'),_0x2fac('0x84')));_0x366875+=0x1;for(var _0x1ae47d in _0x353cfd){if(_0x353cfd['hasOwnProperty'](_0x1ae47d)&&(_0x1ae47d==='ecm'||_0x1ae47d==='localstationid'||_0x1ae47d==='gateway'||_0x1ae47d===_0x2fac('0x85')||_0x1ae47d===_0x2fac('0x86')||_0x1ae47d===_0x2fac('0x87')||_0x1ae47d===_0x2fac('0x88')||_0x1ae47d===_0x2fac('0x89')||_0x1ae47d===_0x2fac('0x8a'))){_0x5dc4fa[_0x2fac('0x81')](new Extension(_0x353cfd,_0x366875,_0x2fac('0x8b')+_0x1ae47d+')='+_0x353cfd[_0x1ae47d],_0x2fac('0x84')));_0x366875+=0x1;}}_0x5dc4fa[_0x2fac('0x81')](new Extension(_0x353cfd,_0x366875,'6',_0x2fac('0x8c')));_0x366875+=0x1;_0x5dc4fa['push'](new Extension(_0x353cfd,_0x366875,'/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'));_0x366875=0x0;return _0x5dc4fa;}exports['addAccountApplications']=function(_0x3c47cc,_0x359785,_0x35d462){var _0x533391;return db[_0x2fac('0x73')]['transaction'](function(_0xf946a9){return db[_0x2fac('0x3f')]['create'](_0x3c47cc[_0x2fac('0x39')],{'transaction':_0xf946a9})['then'](function(_0x185f81){_0x533391=_0x185f81[_0x2fac('0x34')]({'plain':!![]});return db[_0x2fac('0x8d')][_0x2fac('0x75')](createExtensionsReciveFax(_0x533391),{'transaction':_0xf946a9});});})[_0x2fac('0x1c')](function(){return _0x533391;})[_0x2fac('0x1c')](respondWithResult(_0x359785,null))['catch'](handleError(_0x359785,null));};exports[_0x2fac('0x8e')]=function(_0x12db21,_0x730734,_0x150a3a){var _0x2bda13;return db[_0x2fac('0x73')]['transaction'](function(_0x48fd11){return db['FaxAccount'][_0x2fac('0x32')](_0x12db21[_0x2fac('0x39')],{'where':{'id':_0x12db21['body']['id']},'transaction':_0x48fd11})[_0x2fac('0x1c')](function(_0x511c32){return db[_0x2fac('0x8d')][_0x2fac('0x33')]({'where':{'FaxAccountId':_0x12db21[_0x2fac('0x39')]['id']},'transaction':_0x48fd11})[_0x2fac('0x1c')](function(_0x2d9f35){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x2fac('0x6b')](_0x12db21['body'],[_0x2fac('0x8f'),_0x2fac('0x90'),_0x2fac('0x91'),_0x2fac('0x92'),_0x2fac('0x93'),_0x2fac('0x94')])),{'transaction':_0x48fd11});});});})[_0x2fac('0x1c')](function(){return db['FaxAccount'][_0x2fac('0x95')](_0x12db21[_0x2fac('0x39')]['id']);})[_0x2fac('0x1c')](respondWithResult(_0x730734,null))[_0x2fac('0x25')](handleError(_0x730734,null));};exports[_0x2fac('0x96')]=function(_0xa8a558,_0x110e7a,_0x10f22c){var _0x57243d={'raw':!![],'where':{}};var _0x3dc0eb={};var _0x1ec432={'count':0x0,'rows':[]};return db[_0x2fac('0x3f')][_0x2fac('0x63')]({'where':{'id':_0xa8a558[_0x2fac('0x56')]['id']}})[_0x2fac('0x1c')](handleEntityNotFound(_0x110e7a,null))['then'](function(_0x55cc56){if(_0x55cc56){_0x3dc0eb[_0x2fac('0x42')]=_[_0x2fac('0x44')](db[_0x2fac('0x97')][_0x2fac('0x40')]);_0x3dc0eb[_0x2fac('0x43')]=_['keys'](_0xa8a558[_0x2fac('0x43')]);_0x3dc0eb[_0x2fac('0x45')]=_[_0x2fac('0x58')](_0x3dc0eb['model'],_0x3dc0eb['query']);_0x57243d['attributes']=_[_0x2fac('0x58')](_0x3dc0eb[_0x2fac('0x42')],qs[_0x2fac('0x47')](_0xa8a558[_0x2fac('0x43')]['fields']));_0x57243d[_0x2fac('0x46')]=_0x57243d[_0x2fac('0x46')]['length']?_0x57243d[_0x2fac('0x46')]:_0x3dc0eb['model'];if(!_0xa8a558[_0x2fac('0x43')][_0x2fac('0x49')](_0x2fac('0x4a'))){_0x57243d[_0x2fac('0x2c')]=qs['limit'](_0xa8a558[_0x2fac('0x43')][_0x2fac('0x2c')]);_0x57243d[_0x2fac('0x2a')]=qs[_0x2fac('0x2a')](_0xa8a558[_0x2fac('0x43')][_0x2fac('0x2a')]);}_0x57243d[_0x2fac('0x4b')]=qs[_0x2fac('0x65')](_0xa8a558[_0x2fac('0x43')][_0x2fac('0x65')]);_0x57243d[_0x2fac('0x4c')]=qs[_0x2fac('0x45')](_[_0x2fac('0x4d')](_0xa8a558[_0x2fac('0x43')],_0x3dc0eb[_0x2fac('0x45')]));_0x57243d[_0x2fac('0x4c')][_0x2fac('0x66')]=_0x55cc56['id'];if(_0xa8a558[_0x2fac('0x43')][_0x2fac('0x4e')]){_0x57243d[_0x2fac('0x4c')]=_[_0x2fac('0x38')](_0x57243d['where'],{'$or':_['map'](_0x57243d[_0x2fac('0x46')],function(_0x383bf0){var _0x919975={};_0x919975[_0x383bf0]={'$like':'%'+_0xa8a558['query']['filter']+'%'};return _0x919975;})});}if(_0xa8a558['query']['$gte']){var _0xa9bafb=_0xa8a558['query']['$gte'][_0x2fac('0x98')](',');var _0x564657={};_0x564657[_0xa9bafb[0x0]]={'$gte':moment(_0xa9bafb[0x1])[_0x2fac('0x99')](_0x2fac('0x9a'))};_0x57243d[_0x2fac('0x4c')]=_[_0x2fac('0x38')](_0x57243d[_0x2fac('0x4c')],_0x564657);}_0x57243d=_[_0x2fac('0x38')]({},_0x57243d,_0xa8a558[_0x2fac('0x50')]);return db['FaxMessage']['count']({'where':_0x57243d[_0x2fac('0x4c')]})[_0x2fac('0x1c')](function(_0x12cf45){_0x1ec432['count']=_0x12cf45;if(_0xa8a558[_0x2fac('0x43')][_0x2fac('0x51')]){_0x57243d[_0x2fac('0x52')]=[{'all':!![]}];}return db[_0x2fac('0x97')]['findAll'](_0x57243d);})[_0x2fac('0x1c')](function(_0x40bd55){_0x1ec432[_0x2fac('0x54')]=_0x40bd55;return _0x1ec432;});}})[_0x2fac('0x1c')](respondWithFilteredResult(_0x110e7a,_0x57243d))[_0x2fac('0x25')](handleError(_0x110e7a,null));};exports['send']=function(_0x53d395,_0x1c0915,_0x1fcc01){var _0xe80c51,_0x24e2b2={},_0x404f30;if(_0x53d395[_0x2fac('0x39')]['to']){_0x404f30=_0x53d395[_0x2fac('0x39')]['to'][0x0];}return db[_0x2fac('0x3f')][_0x2fac('0x59')]({'where':{'id':_0x53d395['params']['id']},'include':[{'model':db['CmList'],'as':_0x2fac('0x9b'),'include':[{'model':db[_0x2fac('0x9c')],'as':_0x2fac('0x9d'),'where':{'fax':_0x404f30},'limit':0x1,'order':[[_0x2fac('0x92'),_0x2fac('0x9e')]]}]}]})[_0x2fac('0x1c')](handleEntityNotFound(_0x1c0915,null))['then'](function(_0x49038c){_0xe80c51=_0x49038c;if(_0x53d395[_0x2fac('0x39')][_0x2fac('0x9f')]&&_0x53d395[_0x2fac('0x39')][_0x2fac('0x9f')][_0x2fac('0x48')]){for(var _0xa27569=0x0;_0xa27569<_0x53d395[_0x2fac('0x39')]['attachments'][_0x2fac('0x48')];_0xa27569+=0x1){_0x53d395[_0x2fac('0x39')][_0x2fac('0x9f')][_0xa27569]={'filename':_0x53d395['body'][_0x2fac('0x9f')][_0xa27569]['name'],'id':_0x53d395['body']['attachments'][_0xa27569]['id'],'path':path[_0x2fac('0xa0')](config[_0x2fac('0xa1')],_0x2fac('0xa2'),_0x53d395['body'][_0x2fac('0x9f')][_0xa27569][_0x2fac('0xa3')])};}}return respondWithRpcPromise(_0x2fac('0xa4'),'CheckAfterSend',{'FaxAccountId':_[_0x2fac('0xa5')](_0x53d395[_0x2fac('0x56')]['id'])?undefined:_0x53d395['params']['id'],'path':_[_0x2fac('0xa5')](_0x53d395[_0x2fac('0x39')][_0x2fac('0x9f')][0x0][_0x2fac('0x6')])?undefined:_0x53d395[_0x2fac('0x39')][_0x2fac('0x9f')][0x0][_0x2fac('0x6')],'fax':_['isNil'](_0x53d395['body']['to'][0x0])?undefined:_0x53d395['body']['to'][0x0]},client9002);})[_0x2fac('0x1c')](function(){if(_0xe80c51){if(_[_0x2fac('0xa5')](_0x53d395[_0x2fac('0x39')][_0x2fac('0xa6')])){_0x53d395[_0x2fac('0x39')][_0x2fac('0xa6')]=util[_0x2fac('0x99')]('\x22%s\x22\x20<%s>',_0xe80c51[_0x2fac('0x60')],_0xe80c51[_0x2fac('0xa7')]);}if(_0xe80c51[_0x2fac('0x9b')]){if(_0xe80c51['List'][_0x2fac('0x9d')][_0x2fac('0x48')]){return _0xe80c51['List'][_0x2fac('0x9d')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x53d395[_0x2fac('0x39')],{'firstName':_0x53d395['body']['to'][0x0],'phone':_0x53d395[_0x2fac('0x39')]['to'][0x0],'fax':_0x53d395[_0x2fac('0x39')]['to'][0x0],'ListId':_0xe80c51[_0x2fac('0x94')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x2fac('0x1c')](function(_0x4f77e2){if(_0x4f77e2){return db[_0x2fac('0x6a')][_0x2fac('0x59')]({'where':{'ContactId':_0x4f77e2['id'],'closed':![],'FaxAccountId':_0xe80c51['id']}})['then'](function(_0xfa30e2){if(_0xfa30e2){return[_0xfa30e2,![]];}return db[_0x2fac('0x6a')][_0x2fac('0x5a')]({'UserId':_0x53d395[_0x2fac('0x5b')]['id'],'ContactId':_0x4f77e2['id'],'FaxAccountId':_0xe80c51['id'],'fax':_0x53d395[_0x2fac('0x39')]['to'][0x0],'firstMsgDirection':_0x2fac('0xa8'),'Messages':[_[_0x2fac('0x38')](_0x53d395[_0x2fac('0x39')],{'read':![],'body':_0x53d395[_0x2fac('0x39')][_0x2fac('0x9f')][0x0][_0x2fac('0xa9')],'FaxAccountId':_0xe80c51['id'],'UserId':_0x53d395[_0x2fac('0x5b')]['id'],'ContactId':_0x4f77e2['id'],'AttachmentId':_0x53d395[_0x2fac('0x39')][_0x2fac('0x9f')][0x0]['id']})]},{'include':[{'model':db[_0x2fac('0x97')],'as':_0x2fac('0xaa')}]})[_0x2fac('0x1c')](function(_0x4dec5a){return[_0x4dec5a,!![]];});});}else{throw new Error(_0x2fac('0xab'));}})[_0x2fac('0xac')](function(_0xff84b3,_0x23dbec){if(_0x23dbec){return _0xff84b3;}return db['FaxMessage']['create']({'direction':'out','read':![],'body':_0x53d395[_0x2fac('0x39')][_0x2fac('0x9f')][0x0]['filename'],'FaxAccountId':_0xe80c51['id'],'FaxInteractionId':_0xff84b3['id'],'UserId':_0x53d395[_0x2fac('0x5b')]['id'],'ContactId':_0xff84b3[_0x2fac('0xad')],'AttachmentId':_0x53d395[_0x2fac('0x39')][_0x2fac('0x9f')][0x0]['id']})[_0x2fac('0x1c')](function(_0xbc2980){_0xff84b3[_0x2fac('0xae')][_0x2fac('0xaa')]=[];_0xff84b3[_0x2fac('0xae')][_0x2fac('0xaa')][_0x2fac('0x81')](_0xbc2980['dataValues']);return _0xff84b3;});})[_0x2fac('0x1c')](function(_0x540d78){respondWithRpcPromise(_0x2fac('0xaf'),_0x2fac('0xaf'),{'FaxAccountId':_[_0x2fac('0xa5')](_0x53d395[_0x2fac('0x56')]['id'])?undefined:_0x53d395[_0x2fac('0x56')]['id'],'path':_[_0x2fac('0xa5')](_0x53d395[_0x2fac('0x39')][_0x2fac('0x9f')][0x0][_0x2fac('0x6')])?undefined:_0x53d395[_0x2fac('0x39')][_0x2fac('0x9f')][0x0][_0x2fac('0x6')],'fax':_[_0x2fac('0xa5')](_0x53d395[_0x2fac('0x39')]['to'][0x0])?undefined:_0x53d395[_0x2fac('0x39')]['to'][0x0],'AttachmentId':_0x53d395[_0x2fac('0x39')]['attachments'][0x0]['id']},client9002)['then'](function(_0x1b7014){logger[_0x2fac('0x1d')](_0x2fac('0xb0'),_0x1b7014);})['catch'](function(_0x4b8269){logger[_0x2fac('0x1d')](_0x2fac('0xb0'),_0x4b8269);});return _0x540d78;})['then'](respondWithResult(_0x1c0915,null))['catch'](handleError(_0x1c0915,null));};exports['addAgents']=function(_0x3d0716,_0xc09c6f,_0x151051){return db[_0x2fac('0x3f')][_0x2fac('0x59')]({'where':{'id':_0x3d0716[_0x2fac('0x56')]['id']}})[_0x2fac('0x1c')](handleEntityNotFound(_0xc09c6f,null))[_0x2fac('0x1c')](function(_0x3c4cd3){if(_0x3c4cd3){return _0x3c4cd3[_0x2fac('0xb1')](_0x3d0716['body'][_0x2fac('0x67')],_['omit'](_0x3d0716[_0x2fac('0x39')],[_0x2fac('0x67'),'id'])||{})['spread'](function(_0x4f8d26){for(var _0x328fdf=0x0;_0x328fdf<_0x3d0716['body']['ids'][_0x2fac('0x48')];_0x328fdf+=0x1){socket[_0x2fac('0xb2')]('userFaxAccount:save',{'UserId':_0x3d0716['body'][_0x2fac('0x67')][_0x328fdf],'FaxAccountId':_0x3d0716[_0x2fac('0x56')]['id']});}return _0x4f8d26;});}})[_0x2fac('0x1c')](respondWithResult(_0xc09c6f,null))[_0x2fac('0x25')](handleError(_0xc09c6f,null));};exports[_0x2fac('0xb3')]=function(_0x58c82d,_0x411bb1,_0x5f3873){return db[_0x2fac('0x3f')]['find']({'where':{'id':_0x58c82d['params']['id']}})[_0x2fac('0x1c')](handleEntityNotFound(_0x411bb1,null))[_0x2fac('0x1c')](function(_0x18b61e){if(_0x18b61e){return _0x18b61e['removeAgents'](_0x58c82d[_0x2fac('0x43')][_0x2fac('0x67')])[_0x2fac('0x1c')](function(){if(_['isArray'](_0x58c82d[_0x2fac('0x43')][_0x2fac('0x67')])){for(var _0x1eb214=0x0;_0x1eb214<_0x58c82d['query']['ids'][_0x2fac('0x48')];_0x1eb214+=0x1){socket['emit'](_0x2fac('0xb4'),{'UserId':Number(_0x58c82d[_0x2fac('0x43')][_0x2fac('0x67')][_0x1eb214]),'FaxAccountId':Number(_0x58c82d[_0x2fac('0x56')]['id'])});}}else{socket['emit'](_0x2fac('0xb4'),{'UserId':Number(_0x58c82d['query'][_0x2fac('0x67')]),'FaxAccountId':Number(_0x58c82d[_0x2fac('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x411bb1,null))['catch'](handleError(_0x411bb1,null));};exports[_0x2fac('0xb5')]=function(_0x2d36bd,_0x4deeb9,_0x15086d){var _0xf64cbd={};var _0x8e22d0={};var _0x5ab421;var _0x507b07;return db['FaxAccount'][_0x2fac('0x63')]({'where':{'id':_0x2d36bd[_0x2fac('0x56')]['id']}})[_0x2fac('0x1c')](handleEntityNotFound(_0x4deeb9,null))[_0x2fac('0x1c')](function(_0x2c6b4a){if(_0x2c6b4a){_0x5ab421=_0x2c6b4a;_0x8e22d0['model']=_[_0x2fac('0x44')](db['User'][_0x2fac('0x40')]);_0x8e22d0[_0x2fac('0x43')]=_[_0x2fac('0x44')](_0x2d36bd[_0x2fac('0x43')]);_0x8e22d0[_0x2fac('0x45')]=_['intersection'](_0x8e22d0['model'],_0x8e22d0[_0x2fac('0x43')]);_0xf64cbd[_0x2fac('0x46')]=_[_0x2fac('0x58')](_0x8e22d0[_0x2fac('0x42')],qs[_0x2fac('0x47')](_0x2d36bd[_0x2fac('0x43')][_0x2fac('0x47')]));_0xf64cbd[_0x2fac('0x46')]=_0xf64cbd[_0x2fac('0x46')][_0x2fac('0x48')]?_0xf64cbd[_0x2fac('0x46')]:_0x8e22d0[_0x2fac('0x42')];_0xf64cbd[_0x2fac('0x4b')]=qs[_0x2fac('0x65')](_0x2d36bd['query'][_0x2fac('0x65')]);_0xf64cbd[_0x2fac('0x4c')]=qs[_0x2fac('0x45')](_[_0x2fac('0x4d')](_0x2d36bd[_0x2fac('0x43')],_0x8e22d0['filters']));if(_0x2d36bd[_0x2fac('0x43')][_0x2fac('0x4e')]){_0xf64cbd[_0x2fac('0x4c')]=_[_0x2fac('0x38')](_0xf64cbd[_0x2fac('0x4c')],{'$or':_[_0x2fac('0x3e')](_0xf64cbd[_0x2fac('0x46')],function(_0x8aef14){var _0x179757={};_0x179757[_0x8aef14]={'$like':'%'+_0x2d36bd[_0x2fac('0x43')]['filter']+'%'};return _0x179757;})});}_0xf64cbd=_[_0x2fac('0x38')]({},_0xf64cbd,_0x2d36bd[_0x2fac('0x50')]);return _0x5ab421[_0x2fac('0xb5')](_0xf64cbd);}})['then'](function(_0xd71c7){if(_0xd71c7){_0x507b07=_0xd71c7[_0x2fac('0x48')];if(!_0x2d36bd[_0x2fac('0x43')][_0x2fac('0x49')](_0x2fac('0x4a'))){_0xf64cbd[_0x2fac('0x2c')]=qs[_0x2fac('0x2c')](_0x2d36bd[_0x2fac('0x43')][_0x2fac('0x2c')]);_0xf64cbd[_0x2fac('0x2a')]=qs[_0x2fac('0x2a')](_0x2d36bd[_0x2fac('0x43')][_0x2fac('0x2a')]);}return _0x5ab421['getAgents'](_0xf64cbd);}})[_0x2fac('0x1c')](function(_0x35b45a){if(_0x35b45a){return _0x35b45a?{'count':_0x507b07,'rows':_0x35b45a}:null;}})[_0x2fac('0x1c')](respondWithResult(_0x4deeb9,null))[_0x2fac('0x25')](handleError(_0x4deeb9,null));}; \ No newline at end of file +var _0x4f40=['role','UserProfileSection','userProfileId','autoAssociation','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','sort','rows','ids','addAnswer','CannedAnswer','getAnswers','findOne','hasOwnProperty','nolimit','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Owner','fullname','internal','Tag','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','root','CheckAfterSend','isNil','from','fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','spread','userFaxAccount:save','isArray','emit','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','jayson/promise','client','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','destroy','get','FaxAccounts','UserProfileResource','then','stack','name','send','render','body','contact','agent','interaction','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x37dbbb,_0x1909de){var _0x10068f=function(_0x2464b0){while(--_0x2464b0){_0x37dbbb['push'](_0x37dbbb['shift']());}};_0x10068f(++_0x1909de);}(_0x4f40,0x64));var _0x04f4=function(_0x509698,_0x6a77ae){_0x509698=_0x509698-0x0;var _0x5495bd=_0x4f40[_0x509698];return _0x5495bd;};'use strict';var emlformat=require(_0x04f4('0x0'));var rimraf=require(_0x04f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x04f4('0x2'));var rp=require(_0x04f4('0x3'));var moment=require(_0x04f4('0x4'));var BPromise=require(_0x04f4('0x5'));var Mustache=require(_0x04f4('0x6'));var util=require(_0x04f4('0x7'));var path=require(_0x04f4('0x8'));var sox=require(_0x04f4('0x9'));var csv=require(_0x04f4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x04f4('0xb'));var _=require(_0x04f4('0xc'));var squel=require(_0x04f4('0xd'));var crypto=require(_0x04f4('0xe'));var jsforce=require(_0x04f4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x04f4('0xa'));var querystring=require(_0x04f4('0x10'));var Papa=require(_0x04f4('0x11'));var Redis=require(_0x04f4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x04f4('0x13'));var as=require(_0x04f4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04f4('0x15'))(_0x04f4('0x16'));var utils=require('../../config/utils');var config=require(_0x04f4('0x17'));var licenseUtil=require(_0x04f4('0x18'));var db=require('../../mysqldb')['db'];config[_0x04f4('0x19')]=_['defaults'](config['redis'],{'host':_0x04f4('0x1a'),'port':0x18eb});var socket=require(_0x04f4('0x1b'))(new Redis(config[_0x04f4('0x19')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0x04f4('0x1c'));var client=jayson[_0x04f4('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x04f4('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x369d23,_0x5e009e,_0x22dfeb,_0x4621dd){return new BPromise(function(_0x2eb71b,_0xbdebc){var _0x272d81=_0x4621dd||client;return _0x272d81[_0x04f4('0x1e')](_0x369d23,_0x22dfeb)['then'](function(_0x588a02){logger[_0x04f4('0x1f')](_0x04f4('0x20'),_0x5e009e,_0x04f4('0x21'));logger[_0x04f4('0x22')](_0x04f4('0x23'),_0x5e009e,_0x04f4('0x21'),JSON['stringify'](_0x588a02));if(_0x588a02[_0x04f4('0x24')]){if(_0x588a02['error'][_0x04f4('0x25')]===0x1f4){logger[_0x04f4('0x24')](_0x04f4('0x20'),_0x5e009e,_0x588a02['error'][_0x04f4('0x26')]);return _0xbdebc(_0x588a02['error'][_0x04f4('0x26')]);}logger[_0x04f4('0x24')]('FaxAccount,\x20%s,\x20%s',_0x5e009e,_0x588a02['error'][_0x04f4('0x26')]);return _0x2eb71b(_0x588a02['error'][_0x04f4('0x26')]);}else{logger[_0x04f4('0x1f')](_0x04f4('0x20'),_0x5e009e,_0x04f4('0x21'));_0x2eb71b(_0x588a02['result']['message']);}})[_0x04f4('0x27')](function(_0x104d7d){logger[_0x04f4('0x24')](_0x04f4('0x20'),_0x5e009e,_0x104d7d);_0xbdebc(_0x104d7d);});});}function respondWithStatusCode(_0x22adb5,_0x2ead7){_0x2ead7=_0x2ead7||0xcc;return function(_0x49af05){if(_0x49af05){return _0x22adb5[_0x04f4('0x28')](_0x2ead7);}return _0x22adb5[_0x04f4('0x29')](_0x2ead7)[_0x04f4('0x2a')]();};}function respondWithResult(_0x5d18db,_0x4139fa){_0x4139fa=_0x4139fa||0xc8;return function(_0xea9663){if(_0xea9663){return _0x5d18db[_0x04f4('0x29')](_0x4139fa)['json'](_0xea9663);}};}function respondWithFilteredResult(_0x4a1f6c,_0x421ff0){return function(_0x20f0e0){if(_0x20f0e0){var _0x546e14=typeof _0x421ff0[_0x04f4('0x2b')]===_0x04f4('0x2c')&&typeof _0x421ff0[_0x04f4('0x2d')]===_0x04f4('0x2c');var _0xc7c8e8=_0x20f0e0[_0x04f4('0x2e')];var _0x3fcdd3=_0x546e14?0x0:_0x421ff0[_0x04f4('0x2b')];var _0x24bc5e=_0x546e14?_0x20f0e0[_0x04f4('0x2e')]:_0x421ff0[_0x04f4('0x2b')]+_0x421ff0[_0x04f4('0x2d')];var _0x4bdd72;if(_0x24bc5e>=_0xc7c8e8){_0x24bc5e=_0xc7c8e8;_0x4bdd72=0xc8;}else{_0x4bdd72=0xce;}_0x4a1f6c['status'](_0x4bdd72);return _0x4a1f6c['set'](_0x04f4('0x2f'),_0x3fcdd3+'-'+_0x24bc5e+'/'+_0xc7c8e8)[_0x04f4('0x30')](_0x20f0e0);}return null;};}function patchUpdates(_0x49f211){return function(_0x4abe99){try{jsonpatch[_0x04f4('0x31')](_0x4abe99,_0x49f211,!![]);}catch(_0x424191){return BPromise[_0x04f4('0x32')](_0x424191);}return _0x4abe99['save']();};}function saveUpdates(_0x4ac161,_0x2d8d4f){return function(_0x544345){if(_0x544345){return _0x544345['update'](_0x4ac161)['then'](function(_0x3033ff){return _0x3033ff;});}return null;};}function removeEntity(_0xa7e95a,_0x4527ed){return function(_0x2a8321){if(_0x2a8321){return _0x2a8321[_0x04f4('0x33')]()['then'](function(){var _0x3ce4d5=_0x2a8321[_0x04f4('0x34')]({'plain':!![]});var _0x28c0ab=_0x04f4('0x35');return db[_0x04f4('0x36')][_0x04f4('0x33')]({'where':{'type':_0x28c0ab,'resourceId':_0x3ce4d5['id']}})[_0x04f4('0x37')](function(){return _0x2a8321;});})[_0x04f4('0x37')](function(){_0xa7e95a[_0x04f4('0x29')](0xcc)[_0x04f4('0x2a')]();});}};}function handleEntityNotFound(_0x3e0515,_0x4d3ff6){return function(_0x3e2763){if(!_0x3e2763){_0x3e0515[_0x04f4('0x28')](0x194);}return _0x3e2763;};}function handleError(_0x493b14,_0x574922){_0x574922=_0x574922||0x1f4;return function(_0x5be55a){logger['error'](_0x5be55a[_0x04f4('0x38')]);if(_0x5be55a[_0x04f4('0x39')]){delete _0x5be55a[_0x04f4('0x39')];}_0x493b14[_0x04f4('0x29')](_0x574922)[_0x04f4('0x3a')](_0x5be55a);};}function getMustacheRender(_0x2f261b,_0x23a047){return Mustache[_0x04f4('0x3b')](_0x2f261b,_['merge'](_0x23a047[_0x04f4('0x3c')],{'contact':_0x23a047[_0x04f4('0x3d')],'message':_0x23a047['message'],'agent':_0x23a047[_0x04f4('0x3e')],'interaction':_0x23a047[_0x04f4('0x3f')],'account':_0x23a047['account']}))||'';}exports[_0x04f4('0x40')]=function(_0x108f52,_0x5e5056){var _0x516fb5={'include':[{'model':db[_0x04f4('0x41')],'as':_0x04f4('0x42')}]},_0x26983b={},_0x21d5c9={'count':0x0,'rows':[]};var _0x1ab905=_[_0x04f4('0x43')](db[_0x04f4('0x44')][_0x04f4('0x45')],function(_0x369f3c){return{'name':_0x369f3c['fieldName'],'type':_0x369f3c[_0x04f4('0x46')][_0x04f4('0x47')]};});_0x26983b[_0x04f4('0x48')]=_[_0x04f4('0x43')](_0x1ab905,_0x04f4('0x39'));_0x26983b[_0x04f4('0x49')]=_[_0x04f4('0x4a')](_0x108f52[_0x04f4('0x49')]);_0x26983b[_0x04f4('0x4b')]=_['intersection'](_0x26983b[_0x04f4('0x48')],_0x26983b[_0x04f4('0x49')]);_0x516fb5[_0x04f4('0x4c')]=_[_0x04f4('0x4d')](_0x26983b[_0x04f4('0x48')],qs[_0x04f4('0x4e')](_0x108f52[_0x04f4('0x49')][_0x04f4('0x4e')]));_0x516fb5[_0x04f4('0x4c')]=_0x516fb5[_0x04f4('0x4c')]['length']?_0x516fb5[_0x04f4('0x4c')]:_0x26983b[_0x04f4('0x48')];if(!_0x108f52[_0x04f4('0x49')]['hasOwnProperty']('nolimit')){_0x516fb5[_0x04f4('0x2d')]=qs[_0x04f4('0x2d')](_0x108f52[_0x04f4('0x49')][_0x04f4('0x2d')]);_0x516fb5['offset']=qs[_0x04f4('0x2b')](_0x108f52[_0x04f4('0x49')]['offset']);}_0x516fb5[_0x04f4('0x4f')]=qs['sort'](_0x108f52[_0x04f4('0x49')]['sort']);_0x516fb5['where']=qs[_0x04f4('0x4b')](_[_0x04f4('0x50')](_0x108f52[_0x04f4('0x49')],_0x26983b['filters']),_0x1ab905);if(_0x108f52[_0x04f4('0x49')][_0x04f4('0x51')]){_0x516fb5[_0x04f4('0x52')]=_[_0x04f4('0x53')](_0x516fb5[_0x04f4('0x52')],{'$or':_[_0x04f4('0x43')](_0x1ab905,function(_0xcc39b){if(_0xcc39b[_0x04f4('0x46')]!==_0x04f4('0x54')){var _0x2d4a73={};_0x2d4a73[_0xcc39b[_0x04f4('0x39')]]={'$like':'%'+_0x108f52[_0x04f4('0x49')][_0x04f4('0x51')]+'%'};return _0x2d4a73;}})});}_0x516fb5=_[_0x04f4('0x53')]({},_0x516fb5,_0x108f52[_0x04f4('0x55')]);var _0x5b61d0={'where':_0x516fb5[_0x04f4('0x52')]};return db['FaxAccount'][_0x04f4('0x2e')](_0x5b61d0)['then'](function(_0x503977){_0x21d5c9[_0x04f4('0x2e')]=_0x503977;if(_0x108f52['query'][_0x04f4('0x56')]){_0x516fb5[_0x04f4('0x57')]=[{'all':!![]}];}return db[_0x04f4('0x44')][_0x04f4('0x58')](_0x516fb5);})[_0x04f4('0x37')](function(_0x505170){_0x21d5c9['rows']=_0x505170;return _0x21d5c9;})[_0x04f4('0x37')](respondWithFilteredResult(_0x5e5056,_0x516fb5))[_0x04f4('0x27')](handleError(_0x5e5056,null));};exports[_0x04f4('0x59')]=function(_0x8fb198,_0x38b851){var _0x419b47={'raw':![],'where':{'id':_0x8fb198[_0x04f4('0x5a')]['id']},'include':[{'model':db[_0x04f4('0x41')],'as':'mandatoryDispositionPause'}]},_0x48c56c={};_0x48c56c[_0x04f4('0x48')]=_[_0x04f4('0x4a')](db[_0x04f4('0x44')][_0x04f4('0x45')]);_0x48c56c['query']=_[_0x04f4('0x4a')](_0x8fb198[_0x04f4('0x49')]);_0x48c56c[_0x04f4('0x4b')]=_[_0x04f4('0x4d')](_0x48c56c[_0x04f4('0x48')],_0x48c56c[_0x04f4('0x49')]);_0x419b47[_0x04f4('0x4c')]=_['intersection'](_0x48c56c[_0x04f4('0x48')],qs[_0x04f4('0x4e')](_0x8fb198[_0x04f4('0x49')][_0x04f4('0x4e')]));_0x419b47[_0x04f4('0x4c')]=_0x419b47[_0x04f4('0x4c')][_0x04f4('0x5b')]?_0x419b47[_0x04f4('0x4c')]:_0x48c56c['model'];if(_0x8fb198['query'][_0x04f4('0x56')]){_0x419b47[_0x04f4('0x57')]=[{'all':!![]}];}_0x419b47=_[_0x04f4('0x53')]({},_0x419b47,_0x8fb198[_0x04f4('0x55')]);return db[_0x04f4('0x44')][_0x04f4('0x5c')](_0x419b47)[_0x04f4('0x37')](handleEntityNotFound(_0x38b851,null))[_0x04f4('0x37')](respondWithResult(_0x38b851,null))['catch'](handleError(_0x38b851,null));};exports[_0x04f4('0x5d')]=function(_0x574dfa,_0x167d54){return db[_0x04f4('0x44')][_0x04f4('0x5d')](_0x574dfa['body'],{})[_0x04f4('0x37')](function(_0x827236){var _0x7a0d57=_0x574dfa[_0x04f4('0x5e')][_0x04f4('0x34')]({'plain':!![]});if(!_0x7a0d57)throw new Error(_0x04f4('0x5f'));if(_0x7a0d57[_0x04f4('0x60')]===_0x04f4('0x5e')){var _0x577b5d=_0x827236[_0x04f4('0x34')]({'plain':!![]});var _0x42ac92=_0x04f4('0x35');return db[_0x04f4('0x61')][_0x04f4('0x5c')]({'where':{'name':_0x42ac92,'userProfileId':_0x7a0d57[_0x04f4('0x62')]},'raw':!![]})[_0x04f4('0x37')](function(_0x5f3272){if(_0x5f3272&&_0x5f3272[_0x04f4('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x577b5d['name'],'resourceId':_0x577b5d['id'],'type':_0x5f3272[_0x04f4('0x39')],'sectionId':_0x5f3272['id']},{})[_0x04f4('0x37')](function(){return _0x827236;});}else{return _0x827236;}})[_0x04f4('0x27')](function(_0x36c0cf){logger[_0x04f4('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36c0cf);throw _0x36c0cf;});}return _0x827236;})[_0x04f4('0x37')](respondWithResult(_0x167d54,0xc9))[_0x04f4('0x27')](handleError(_0x167d54,null));};exports[_0x04f4('0x64')]=function(_0x675c92,_0x3d3f69){if(_0x675c92['body']['id']){delete _0x675c92[_0x04f4('0x3c')]['id'];}return db['FaxAccount'][_0x04f4('0x5c')]({'where':{'id':_0x675c92[_0x04f4('0x5a')]['id']},'include':[{'model':db[_0x04f4('0x41')],'as':_0x04f4('0x42')}]})[_0x04f4('0x37')](handleEntityNotFound(_0x3d3f69,null))['then'](saveUpdates(_0x675c92[_0x04f4('0x3c')],null))[_0x04f4('0x37')](respondWithResult(_0x3d3f69,null))[_0x04f4('0x27')](handleError(_0x3d3f69,null));};exports[_0x04f4('0x33')]=function(_0x4f92cc,_0x341334){return db[_0x04f4('0x44')]['find']({'where':{'id':_0x4f92cc[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x341334,null))['then'](removeEntity(_0x341334,null))[_0x04f4('0x27')](handleError(_0x341334,null));};exports[_0x04f4('0x65')]=function(_0x3d96f8,_0x3e78c5){return db[_0x04f4('0x44')][_0x04f4('0x65')]()[_0x04f4('0x37')](respondWithResult(_0x3e78c5,null))['catch'](handleError(_0x3e78c5,null));};exports[_0x04f4('0x66')]=function(_0x256c58,_0x41e149,_0x391e66){if(_0x256c58[_0x04f4('0x3c')]['id']){delete _0x256c58[_0x04f4('0x3c')]['id'];}return db[_0x04f4('0x44')]['find']({'where':{'id':_0x256c58[_0x04f4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x41e149,null))[_0x04f4('0x37')](function(_0xb18e03){if(_0xb18e03){_0x256c58[_0x04f4('0x3c')][_0x04f4('0x67')]=_0xb18e03['id'];return db[_0x04f4('0x68')][_0x04f4('0x5d')](_0x256c58['body']);}})['then'](respondWithResult(_0x41e149,null))[_0x04f4('0x27')](handleError(_0x41e149,null));};exports[_0x04f4('0x69')]=function(_0x3e0710,_0x99cda5,_0x2359d3){var _0x191fee={'raw':![],'where':{}};var _0x1f109c={};var _0x2df3dd={'count':0x0,'rows':[]};return db[_0x04f4('0x44')]['findOne']({'where':{'id':_0x3e0710[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x99cda5,null))[_0x04f4('0x37')](function(_0x264cca){if(_0x264cca){_0x1f109c[_0x04f4('0x48')]=_[_0x04f4('0x4a')](db['Disposition'][_0x04f4('0x45')]);_0x1f109c[_0x04f4('0x49')]=_['keys'](_0x3e0710[_0x04f4('0x49')]);_0x1f109c[_0x04f4('0x4b')]=_[_0x04f4('0x4d')](_0x1f109c[_0x04f4('0x48')],_0x1f109c[_0x04f4('0x49')]);_0x191fee[_0x04f4('0x4c')]=_[_0x04f4('0x4d')](_0x1f109c['model'],qs[_0x04f4('0x4e')](_0x3e0710[_0x04f4('0x49')][_0x04f4('0x4e')]));_0x191fee['attributes']=_0x191fee[_0x04f4('0x4c')][_0x04f4('0x5b')]?_0x191fee[_0x04f4('0x4c')]:_0x1f109c[_0x04f4('0x48')];if(!_0x3e0710[_0x04f4('0x49')]['hasOwnProperty']('nolimit')){_0x191fee[_0x04f4('0x2d')]=qs[_0x04f4('0x2d')](_0x3e0710['query'][_0x04f4('0x2d')]);_0x191fee[_0x04f4('0x2b')]=qs['offset'](_0x3e0710[_0x04f4('0x49')]['offset']);}_0x191fee['order']=qs[_0x04f4('0x6a')](_0x3e0710['query'][_0x04f4('0x6a')]);_0x191fee['where']=qs[_0x04f4('0x4b')](_[_0x04f4('0x50')](_0x3e0710[_0x04f4('0x49')],_0x1f109c[_0x04f4('0x4b')]));_0x191fee[_0x04f4('0x52')][_0x04f4('0x67')]=_0x264cca['id'];if(_0x3e0710[_0x04f4('0x49')][_0x04f4('0x51')]){_0x191fee[_0x04f4('0x52')]=_[_0x04f4('0x53')](_0x191fee['where'],{'$or':_['map'](_0x191fee['attributes'],function(_0x118513){var _0x282c14={};_0x282c14[_0x118513]={'$like':'%'+_0x3e0710[_0x04f4('0x49')][_0x04f4('0x51')]+'%'};return _0x282c14;})});}_0x191fee=_['merge']({},_0x191fee,_0x3e0710[_0x04f4('0x55')]);return db[_0x04f4('0x68')][_0x04f4('0x2e')]({'where':_0x191fee['where']})[_0x04f4('0x37')](function(_0x5daf8f){_0x2df3dd[_0x04f4('0x2e')]=_0x5daf8f;if(_0x3e0710[_0x04f4('0x49')][_0x04f4('0x56')]){_0x191fee[_0x04f4('0x57')]=[{'all':!![]}];}return db[_0x04f4('0x68')]['findAll'](_0x191fee);})[_0x04f4('0x37')](function(_0x5ce488){_0x2df3dd[_0x04f4('0x6b')]=_0x5ce488;return _0x2df3dd;});}})[_0x04f4('0x37')](respondWithFilteredResult(_0x99cda5,_0x191fee))[_0x04f4('0x27')](handleError(_0x99cda5,null));};exports['removeDispositions']=function(_0x4721f0,_0x1c0a80,_0x46435b){return db[_0x04f4('0x44')][_0x04f4('0x5c')]({'where':{'id':_0x4721f0[_0x04f4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1c0a80,null))[_0x04f4('0x37')](function(_0x2f2cfa){if(_0x2f2cfa){return _0x2f2cfa['removeDispositions'](_0x4721f0['query'][_0x04f4('0x6c')]);}})[_0x04f4('0x37')](respondWithStatusCode(_0x1c0a80,null))[_0x04f4('0x27')](handleError(_0x1c0a80,null));};exports[_0x04f4('0x6d')]=function(_0x13c3a9,_0x53316a,_0x245b8d){if(_0x13c3a9[_0x04f4('0x3c')]['id']){delete _0x13c3a9[_0x04f4('0x3c')]['id'];}return db[_0x04f4('0x44')]['find']({'where':{'id':_0x13c3a9[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x53316a,null))[_0x04f4('0x37')](function(_0x1b7c24){if(_0x1b7c24){_0x13c3a9[_0x04f4('0x3c')][_0x04f4('0x67')]=_0x1b7c24['id'];return db[_0x04f4('0x6e')][_0x04f4('0x5d')](_0x13c3a9[_0x04f4('0x3c')]);}})[_0x04f4('0x37')](respondWithResult(_0x53316a,null))[_0x04f4('0x27')](handleError(_0x53316a,null));};exports[_0x04f4('0x6f')]=function(_0x5b446b,_0x332518,_0x5da121){var _0x402676={'raw':![],'where':{}};var _0x416ab2={};var _0x197b8a={'count':0x0,'rows':[]};return db[_0x04f4('0x44')][_0x04f4('0x70')]({'where':{'id':_0x5b446b[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x332518,null))[_0x04f4('0x37')](function(_0x28bcaf){if(_0x28bcaf){_0x416ab2[_0x04f4('0x48')]=_[_0x04f4('0x4a')](db[_0x04f4('0x6e')][_0x04f4('0x45')]);_0x416ab2[_0x04f4('0x49')]=_[_0x04f4('0x4a')](_0x5b446b[_0x04f4('0x49')]);_0x416ab2['filters']=_['intersection'](_0x416ab2[_0x04f4('0x48')],_0x416ab2['query']);_0x402676['attributes']=_[_0x04f4('0x4d')](_0x416ab2[_0x04f4('0x48')],qs[_0x04f4('0x4e')](_0x5b446b['query'][_0x04f4('0x4e')]));_0x402676[_0x04f4('0x4c')]=_0x402676[_0x04f4('0x4c')][_0x04f4('0x5b')]?_0x402676[_0x04f4('0x4c')]:_0x416ab2[_0x04f4('0x48')];if(!_0x5b446b['query'][_0x04f4('0x71')](_0x04f4('0x72'))){_0x402676[_0x04f4('0x2d')]=qs[_0x04f4('0x2d')](_0x5b446b[_0x04f4('0x49')][_0x04f4('0x2d')]);_0x402676[_0x04f4('0x2b')]=qs[_0x04f4('0x2b')](_0x5b446b['query'][_0x04f4('0x2b')]);}_0x402676[_0x04f4('0x4f')]=qs[_0x04f4('0x6a')](_0x5b446b[_0x04f4('0x49')][_0x04f4('0x6a')]);_0x402676[_0x04f4('0x52')]=qs[_0x04f4('0x4b')](_[_0x04f4('0x50')](_0x5b446b['query'],_0x416ab2[_0x04f4('0x4b')]));_0x402676[_0x04f4('0x52')][_0x04f4('0x67')]=_0x28bcaf['id'];if(_0x5b446b['query']['filter']){_0x402676[_0x04f4('0x52')]=_[_0x04f4('0x53')](_0x402676[_0x04f4('0x52')],{'$or':_['map'](_0x402676['attributes'],function(_0x3afc2c){var _0x131583={};_0x131583[_0x3afc2c]={'$like':'%'+_0x5b446b[_0x04f4('0x49')][_0x04f4('0x51')]+'%'};return _0x131583;})});}_0x402676=_[_0x04f4('0x53')]({},_0x402676,_0x5b446b[_0x04f4('0x55')]);return db[_0x04f4('0x6e')]['count']({'where':_0x402676[_0x04f4('0x52')]})[_0x04f4('0x37')](function(_0x4f0b69){_0x197b8a[_0x04f4('0x2e')]=_0x4f0b69;if(_0x5b446b['query']['includeAll']){_0x402676[_0x04f4('0x57')]=[{'all':!![]}];}return db[_0x04f4('0x6e')][_0x04f4('0x58')](_0x402676);})[_0x04f4('0x37')](function(_0x394cdd){_0x197b8a[_0x04f4('0x6b')]=_0x394cdd;return _0x197b8a;});}})[_0x04f4('0x37')](respondWithFilteredResult(_0x332518,_0x402676))[_0x04f4('0x27')](handleError(_0x332518,null));};exports[_0x04f4('0x73')]=function(_0x4c2950,_0x29bd2e,_0xbe4ddd){return db['FaxAccount']['find']({'where':{'id':_0x4c2950['params']['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x29bd2e,null))[_0x04f4('0x37')](function(_0x2ecaca){if(_0x2ecaca){return _0x2ecaca[_0x04f4('0x73')](_0x4c2950[_0x04f4('0x49')][_0x04f4('0x6c')]);}})['then'](respondWithStatusCode(_0x29bd2e,null))['catch'](handleError(_0x29bd2e,null));};exports[_0x04f4('0x74')]=function(_0x2d972c,_0x11c757,_0x1a0c07){return db[_0x04f4('0x75')][_0x04f4('0x5c')]({'where':{'id':_0x2d972c[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x11c757,null))[_0x04f4('0x37')](function(_0x5165fb){if(_0x5165fb){return _0x5165fb['addInteraction'](_0x2d972c[_0x04f4('0x3c')]['ids'],_[_0x04f4('0x76')](_0x2d972c[_0x04f4('0x3c')],['ids','id'])||{});}})[_0x04f4('0x37')](respondWithResult(_0x11c757,null))[_0x04f4('0x27')](handleError(_0x11c757,null));};exports[_0x04f4('0x77')]=function(_0x377cd3,_0x388f86,_0x5e7a80){var _0x36af06={'raw':![],'where':{}};var _0x3827c1={};var _0x4fcf2b={'count':0x0,'rows':[]};return db[_0x04f4('0x44')][_0x04f4('0x70')]({'where':{'id':_0x377cd3[_0x04f4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x388f86,null))[_0x04f4('0x37')](function(_0x3bade4){if(_0x3bade4){_0x3827c1[_0x04f4('0x48')]=_[_0x04f4('0x4a')](db['FaxInteraction']['rawAttributes']);_0x3827c1[_0x04f4('0x49')]=_[_0x04f4('0x4a')](_0x377cd3[_0x04f4('0x49')]);_0x3827c1[_0x04f4('0x4b')]=_['intersection'](_0x3827c1[_0x04f4('0x48')],_0x3827c1['query']);_0x36af06[_0x04f4('0x4c')]=_['intersection'](_0x3827c1[_0x04f4('0x48')],qs[_0x04f4('0x4e')](_0x377cd3[_0x04f4('0x49')][_0x04f4('0x4e')]));_0x36af06['attributes']=_0x36af06[_0x04f4('0x4c')][_0x04f4('0x5b')]?_0x36af06['attributes']:_0x3827c1['model'];if(!_0x377cd3['query'][_0x04f4('0x71')](_0x04f4('0x72'))){_0x36af06[_0x04f4('0x2d')]=qs[_0x04f4('0x2d')](_0x377cd3['query'][_0x04f4('0x2d')]);_0x36af06[_0x04f4('0x2b')]=qs['offset'](_0x377cd3[_0x04f4('0x49')][_0x04f4('0x2b')]);}_0x36af06[_0x04f4('0x4f')]=qs[_0x04f4('0x6a')](_0x377cd3['query']['sort']);_0x36af06[_0x04f4('0x52')]=qs['filters'](_[_0x04f4('0x50')](_0x377cd3['query'],_0x3827c1['filters']));_0x36af06[_0x04f4('0x52')][_0x04f4('0x67')]=_0x3bade4['id'];if(_0x377cd3[_0x04f4('0x49')][_0x04f4('0x51')]){_0x36af06[_0x04f4('0x52')]=_['merge'](_0x36af06['where'],{'$or':_[_0x04f4('0x43')](_0x36af06[_0x04f4('0x4c')],function(_0x2c093e){var _0x4f061a={};_0x4f061a[_0x2c093e]={'$like':'%'+_0x377cd3['query'][_0x04f4('0x51')]+'%'};return _0x4f061a;})});}_0x36af06=_[_0x04f4('0x53')]({},_0x36af06,_0x377cd3[_0x04f4('0x55')]);return db['FaxInteraction'][_0x04f4('0x2e')]({'where':_0x36af06[_0x04f4('0x52')]})[_0x04f4('0x37')](function(_0x12b320){_0x4fcf2b['count']=_0x12b320;if(_0x377cd3[_0x04f4('0x49')][_0x04f4('0x56')]){_0x36af06[_0x04f4('0x57')]=[{'model':db[_0x04f4('0x78')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x04f4('0x79'),'attributes':[_0x04f4('0x39'),_0x04f4('0x7a'),_0x04f4('0x7b')],'required':![]},{'model':db[_0x04f4('0x7c')],'as':'Tags','attributes':['id',_0x04f4('0x39'),'color'],'where':_0x377cd3[_0x04f4('0x49')][_0x04f4('0x7d')]?{'id':_0x377cd3[_0x04f4('0x49')][_0x04f4('0x7d')]}:undefined,'required':_0x377cd3[_0x04f4('0x49')][_0x04f4('0x7d')]?!![]:![]}];}return db[_0x04f4('0x75')]['findAll'](_0x36af06);})['then'](function(_0xf67122){_0x4fcf2b[_0x04f4('0x6b')]=_0xf67122;return _0x4fcf2b;});}})[_0x04f4('0x37')](respondWithFilteredResult(_0x388f86,_0x36af06))['catch'](handleError(_0x388f86,null));};exports[_0x04f4('0x7e')]=function(_0x4c86f5,_0x5976e2,_0x3ff69f){return db[_0x04f4('0x44')]['findOne']({'where':{'id':_0x4c86f5[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x5976e2,null))[_0x04f4('0x37')](function(_0x55f6f7){if(_0x55f6f7){return db[_0x04f4('0x7f')][_0x04f4('0x80')](function(_0x14639c){return db[_0x04f4('0x81')][_0x04f4('0x33')]({'where':{'FaxAccountId':_0x4c86f5[_0x04f4('0x5a')]['id']},'transaction':_0x14639c})[_0x04f4('0x37')](function(_0x58ce2d){var _0x1478a3=_['map'](_0x4c86f5[_0x04f4('0x3c')],function(_0x413e4e){_0x413e4e[_0x04f4('0x67')]=_0x4c86f5[_0x04f4('0x5a')]['id'];return _0x413e4e;});return db[_0x04f4('0x81')][_0x04f4('0x82')](_0x1478a3,{'transaction':_0x14639c});});})[_0x04f4('0x37')](function(){return db[_0x04f4('0x81')][_0x04f4('0x83')]({'where':{'FaxAccountId':_0x4c86f5[_0x04f4('0x5a')]['id']},'order':_0x04f4('0x84')});});}})[_0x04f4('0x37')](respondWithResult(_0x5976e2,null))['catch'](handleError(_0x5976e2,null));};exports[_0x04f4('0x85')]=function(_0x5c9bf1,_0x1907dd,_0x23cebd){var _0x312b03={};var _0x24915c={};var _0x5605e6;var _0x3f49a2;return db[_0x04f4('0x44')][_0x04f4('0x70')]({'where':{'id':_0x5c9bf1[_0x04f4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1907dd,null))[_0x04f4('0x37')](function(_0x2cf664){if(_0x2cf664){_0x5605e6=_0x2cf664;_0x24915c['model']=_[_0x04f4('0x4a')](db[_0x04f4('0x81')][_0x04f4('0x45')]);_0x24915c[_0x04f4('0x49')]=_[_0x04f4('0x4a')](_0x5c9bf1[_0x04f4('0x49')]);_0x24915c[_0x04f4('0x4b')]=_['intersection'](_0x24915c[_0x04f4('0x48')],_0x24915c[_0x04f4('0x49')]);_0x312b03[_0x04f4('0x4c')]=_['intersection'](_0x24915c[_0x04f4('0x48')],qs['fields'](_0x5c9bf1[_0x04f4('0x49')][_0x04f4('0x4e')]));_0x312b03[_0x04f4('0x4c')]=_0x312b03['attributes'][_0x04f4('0x5b')]?_0x312b03[_0x04f4('0x4c')]:_0x24915c[_0x04f4('0x48')];_0x312b03[_0x04f4('0x4f')]=qs[_0x04f4('0x6a')](_0x5c9bf1[_0x04f4('0x49')][_0x04f4('0x6a')]);_0x312b03[_0x04f4('0x52')]=qs[_0x04f4('0x4b')](_[_0x04f4('0x50')](_0x5c9bf1[_0x04f4('0x49')],_0x24915c[_0x04f4('0x4b')]));if(_0x5c9bf1[_0x04f4('0x49')][_0x04f4('0x51')]){_0x312b03['where']=_['merge'](_0x312b03['where'],{'$or':_[_0x04f4('0x43')](_0x312b03[_0x04f4('0x4c')],function(_0x3d4a41){var _0x975be={};_0x975be[_0x3d4a41]={'$like':'%'+_0x5c9bf1[_0x04f4('0x49')][_0x04f4('0x51')]+'%'};return _0x975be;})});}_0x312b03=_['merge']({},_0x312b03,_0x5c9bf1[_0x04f4('0x55')]);return _0x5605e6[_0x04f4('0x85')](_0x312b03);}})[_0x04f4('0x37')](function(_0x2815a6){if(_0x2815a6){_0x3f49a2=_0x2815a6[_0x04f4('0x5b')];if(!_0x5c9bf1[_0x04f4('0x49')][_0x04f4('0x71')](_0x04f4('0x72'))){_0x312b03[_0x04f4('0x2d')]=qs[_0x04f4('0x2d')](_0x5c9bf1[_0x04f4('0x49')][_0x04f4('0x2d')]);_0x312b03[_0x04f4('0x2b')]=qs[_0x04f4('0x2b')](_0x5c9bf1[_0x04f4('0x49')][_0x04f4('0x2b')]);}return _0x5605e6[_0x04f4('0x85')](_0x312b03);}})[_0x04f4('0x37')](function(_0x454b94){if(_0x454b94){return _0x454b94?{'count':_0x3f49a2,'rows':_0x454b94}:null;}})[_0x04f4('0x37')](respondWithResult(_0x1907dd,null))[_0x04f4('0x27')](handleError(_0x1907dd,null));};function Extension(_0x4c4682,_0xf83887,_0x4f30fe,_0x3807d4){this[_0x04f4('0x86')]=_0x04f4('0x87');this[_0x04f4('0x88')]=_0x4c4682[_0x04f4('0x89')];this[_0x04f4('0x8a')]=_0x3807d4;this[_0x04f4('0x46')]=_0x04f4('0x8b');this[_0x04f4('0x8c')]=_0x04f4('0x8d');this['FaxAccountId']=_0x4c4682['id'];this[_0x04f4('0x84')]=_0xf83887;this[_0x04f4('0x8e')]=_0x4f30fe;}function createExtensionsReciveFax(_0xdb825c){var _0x8feae=0x1;var _0x53f414=[];_0x53f414[_0x04f4('0x8f')](new Extension(_0xdb825c,_0x8feae,'',_0x04f4('0x90')));_0x8feae+=0x1;_0x53f414[_0x04f4('0x8f')](new Extension(_0xdb825c,_0x8feae,_0x04f4('0x91'),_0x04f4('0x92')));_0x8feae+=0x1;for(var _0x427a1a in _0xdb825c){if(_0xdb825c[_0x04f4('0x71')](_0x427a1a)&&(_0x427a1a===_0x04f4('0x93')||_0x427a1a==='localstationid'||_0x427a1a===_0x04f4('0x94')||_0x427a1a===_0x04f4('0x95')||_0x427a1a===_0x04f4('0x96')||_0x427a1a===_0x04f4('0x97')||_0x427a1a===_0x04f4('0x98')||_0x427a1a===_0x04f4('0x99')||_0x427a1a===_0x04f4('0x9a'))){_0x53f414['push'](new Extension(_0xdb825c,_0x8feae,_0x04f4('0x9b')+_0x427a1a+')='+_0xdb825c[_0x427a1a],_0x04f4('0x92')));_0x8feae+=0x1;}}_0x53f414[_0x04f4('0x8f')](new Extension(_0xdb825c,_0x8feae,'6',_0x04f4('0x9c')));_0x8feae+=0x1;_0x53f414[_0x04f4('0x8f')](new Extension(_0xdb825c,_0x8feae,'/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',_0x04f4('0x9d')));_0x8feae=0x0;return _0x53f414;}exports[_0x04f4('0x9e')]=function(_0x41e7e9,_0x2f95c5,_0x4bf429){var _0x1b14fa;return db[_0x04f4('0x7f')][_0x04f4('0x80')](function(_0x2020c3){return db[_0x04f4('0x44')][_0x04f4('0x5d')](_0x41e7e9['body'],{'transaction':_0x2020c3})[_0x04f4('0x37')](function(_0x1a64a9){_0x1b14fa=_0x1a64a9[_0x04f4('0x34')]({'plain':!![]});return db['VoiceExtension'][_0x04f4('0x82')](createExtensionsReciveFax(_0x1b14fa),{'transaction':_0x2020c3});});})['then'](function(){return _0x1b14fa;})[_0x04f4('0x37')](respondWithResult(_0x2f95c5,null))[_0x04f4('0x27')](handleError(_0x2f95c5,null));};exports[_0x04f4('0x9f')]=function(_0xb6382,_0x480883,_0x106397){var _0xed9e53;return db['sequelize'][_0x04f4('0x80')](function(_0x51d64b){return db[_0x04f4('0x44')][_0x04f4('0x64')](_0xb6382[_0x04f4('0x3c')],{'where':{'id':_0xb6382[_0x04f4('0x3c')]['id']},'transaction':_0x51d64b})[_0x04f4('0x37')](function(_0x1d8e20){return db[_0x04f4('0xa0')]['destroy']({'where':{'FaxAccountId':_0xb6382['body']['id']},'transaction':_0x51d64b})[_0x04f4('0x37')](function(_0x47c18a){return db[_0x04f4('0xa0')][_0x04f4('0x82')](createExtensionsReciveFax(_[_0x04f4('0x76')](_0xb6382[_0x04f4('0x3c')],['tech',_0x04f4('0x47'),_0x04f4('0xa1'),_0x04f4('0xa2'),_0x04f4('0xa3'),_0x04f4('0xa4')])),{'transaction':_0x51d64b});});});})[_0x04f4('0x37')](function(){return db['FaxAccount']['findById'](_0xb6382['body']['id']);})[_0x04f4('0x37')](respondWithResult(_0x480883,null))[_0x04f4('0x27')](handleError(_0x480883,null));};exports[_0x04f4('0xa5')]=function(_0x547541,_0x2819e7,_0x149a01){var _0x52dbca={'raw':!![],'where':{}};var _0x155403={};var _0x383a80={'count':0x0,'rows':[]};return db[_0x04f4('0x44')][_0x04f4('0x70')]({'where':{'id':_0x547541[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x2819e7,null))[_0x04f4('0x37')](function(_0x35a3d0){if(_0x35a3d0){_0x155403[_0x04f4('0x48')]=_[_0x04f4('0x4a')](db[_0x04f4('0xa6')][_0x04f4('0x45')]);_0x155403['query']=_[_0x04f4('0x4a')](_0x547541[_0x04f4('0x49')]);_0x155403[_0x04f4('0x4b')]=_['intersection'](_0x155403[_0x04f4('0x48')],_0x155403['query']);_0x52dbca['attributes']=_[_0x04f4('0x4d')](_0x155403[_0x04f4('0x48')],qs[_0x04f4('0x4e')](_0x547541['query']['fields']));_0x52dbca[_0x04f4('0x4c')]=_0x52dbca[_0x04f4('0x4c')][_0x04f4('0x5b')]?_0x52dbca[_0x04f4('0x4c')]:_0x155403['model'];if(!_0x547541[_0x04f4('0x49')][_0x04f4('0x71')](_0x04f4('0x72'))){_0x52dbca[_0x04f4('0x2d')]=qs['limit'](_0x547541['query'][_0x04f4('0x2d')]);_0x52dbca['offset']=qs[_0x04f4('0x2b')](_0x547541[_0x04f4('0x49')][_0x04f4('0x2b')]);}_0x52dbca[_0x04f4('0x4f')]=qs[_0x04f4('0x6a')](_0x547541[_0x04f4('0x49')][_0x04f4('0x6a')]);_0x52dbca[_0x04f4('0x52')]=qs['filters'](_['pick'](_0x547541[_0x04f4('0x49')],_0x155403[_0x04f4('0x4b')]));_0x52dbca[_0x04f4('0x52')][_0x04f4('0x67')]=_0x35a3d0['id'];if(_0x547541[_0x04f4('0x49')][_0x04f4('0x51')]){_0x52dbca['where']=_[_0x04f4('0x53')](_0x52dbca[_0x04f4('0x52')],{'$or':_[_0x04f4('0x43')](_0x52dbca[_0x04f4('0x4c')],function(_0x136d31){var _0x364d17={};_0x364d17[_0x136d31]={'$like':'%'+_0x547541[_0x04f4('0x49')][_0x04f4('0x51')]+'%'};return _0x364d17;})});}if(_0x547541['query'][_0x04f4('0xa7')]){var _0x253d59=_0x547541[_0x04f4('0x49')][_0x04f4('0xa7')][_0x04f4('0xa8')](',');var _0x133187={};_0x133187[_0x253d59[0x0]]={'$gte':moment(_0x253d59[0x1])[_0x04f4('0xa9')](_0x04f4('0xaa'))};_0x52dbca[_0x04f4('0x52')]=_[_0x04f4('0x53')](_0x52dbca[_0x04f4('0x52')],_0x133187);}_0x52dbca=_['merge']({},_0x52dbca,_0x547541[_0x04f4('0x55')]);return db[_0x04f4('0xa6')][_0x04f4('0x2e')]({'where':_0x52dbca[_0x04f4('0x52')]})[_0x04f4('0x37')](function(_0x295c72){_0x383a80[_0x04f4('0x2e')]=_0x295c72;if(_0x547541['query'][_0x04f4('0x56')]){_0x52dbca[_0x04f4('0x57')]=[{'all':!![]}];}return db['FaxMessage'][_0x04f4('0x58')](_0x52dbca);})[_0x04f4('0x37')](function(_0x1bb167){_0x383a80[_0x04f4('0x6b')]=_0x1bb167;return _0x383a80;});}})['then'](respondWithFilteredResult(_0x2819e7,_0x52dbca))[_0x04f4('0x27')](handleError(_0x2819e7,null));};exports[_0x04f4('0x3a')]=function(_0x4502cd,_0x2c84e4,_0x4bb62e){var _0x368cfa,_0x5bd1f7={},_0x221cfd;if(_0x4502cd[_0x04f4('0x3c')]['to']){_0x221cfd=_0x4502cd[_0x04f4('0x3c')]['to'][0x0];}return db[_0x04f4('0x44')][_0x04f4('0x5c')]({'where':{'id':_0x4502cd[_0x04f4('0x5a')]['id']},'include':[{'model':db[_0x04f4('0xab')],'as':'List','include':[{'model':db[_0x04f4('0x78')],'as':_0x04f4('0xac'),'where':{'fax':_0x221cfd},'limit':0x1,'order':[['updatedAt',_0x04f4('0xad')]]}]}]})[_0x04f4('0x37')](handleEntityNotFound(_0x2c84e4,null))[_0x04f4('0x37')](function(_0x1108ef){_0x368cfa=_0x1108ef;if(_0x4502cd[_0x04f4('0x3c')]['attachments']&&_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][_0x04f4('0x5b')]){for(var _0xcb9458=0x0;_0xcb9458<_0x4502cd[_0x04f4('0x3c')]['attachments']['length'];_0xcb9458+=0x1){_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][_0xcb9458]={'filename':_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][_0xcb9458][_0x04f4('0x39')],'id':_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][_0xcb9458]['id'],'path':path[_0x04f4('0xaf')](config[_0x04f4('0xb0')],'server/files/attachments',_0x4502cd[_0x04f4('0x3c')]['attachments'][_0xcb9458]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0x04f4('0xb1'),{'FaxAccountId':_[_0x04f4('0xb2')](_0x4502cd[_0x04f4('0x5a')]['id'])?undefined:_0x4502cd['params']['id'],'path':_[_0x04f4('0xb2')](_0x4502cd['body'][_0x04f4('0xae')][0x0][_0x04f4('0x8')])?undefined:_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][0x0][_0x04f4('0x8')],'fax':_[_0x04f4('0xb2')](_0x4502cd[_0x04f4('0x3c')]['to'][0x0])?undefined:_0x4502cd['body']['to'][0x0]},client9002);})[_0x04f4('0x37')](function(){if(_0x368cfa){if(_['isNil'](_0x4502cd['body'][_0x04f4('0xb3')])){_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xb3')]=util['format']('\x22%s\x22\x20<%s>',_0x368cfa['name'],_0x368cfa[_0x04f4('0xb4')]);}if(_0x368cfa['List']){if(_0x368cfa['List'][_0x04f4('0xac')][_0x04f4('0x5b')]){return _0x368cfa['List']['Contacts'][0x0];}else{return db[_0x04f4('0x78')][_0x04f4('0x5d')](_[_0x04f4('0xb5')](_0x4502cd['body'],{'firstName':_0x4502cd[_0x04f4('0x3c')]['to'][0x0],'phone':_0x4502cd[_0x04f4('0x3c')]['to'][0x0],'fax':_0x4502cd[_0x04f4('0x3c')]['to'][0x0],'ListId':_0x368cfa[_0x04f4('0xa4')]}));}}else{throw new Error(_0x04f4('0xb6'));}}else{throw new Error(_0x04f4('0xb7'));}})['then'](function(_0xd6d23){if(_0xd6d23){return db[_0x04f4('0x75')][_0x04f4('0x5c')]({'where':{'ContactId':_0xd6d23['id'],'closed':![],'FaxAccountId':_0x368cfa['id']}})[_0x04f4('0x37')](function(_0x2c149e){if(_0x2c149e){return[_0x2c149e,![]];}return db[_0x04f4('0x75')][_0x04f4('0x5d')]({'UserId':_0x4502cd[_0x04f4('0x5e')]['id'],'ContactId':_0xd6d23['id'],'FaxAccountId':_0x368cfa['id'],'fax':_0x4502cd[_0x04f4('0x3c')]['to'][0x0],'firstMsgDirection':_0x04f4('0xb8'),'Messages':[_['merge'](_0x4502cd[_0x04f4('0x3c')],{'read':![],'body':_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][0x0][_0x04f4('0xb9')],'FaxAccountId':_0x368cfa['id'],'UserId':_0x4502cd[_0x04f4('0x5e')]['id'],'ContactId':_0xd6d23['id'],'AttachmentId':_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][0x0]['id']})]},{'include':[{'model':db[_0x04f4('0xa6')],'as':_0x04f4('0xba')}]})['then'](function(_0x3761ed){return[_0x3761ed,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x5edd28,_0x2868b6){if(_0x2868b6){return _0x5edd28;}return db[_0x04f4('0xa6')][_0x04f4('0x5d')]({'direction':'out','read':![],'body':_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][0x0][_0x04f4('0xb9')],'FaxAccountId':_0x368cfa['id'],'FaxInteractionId':_0x5edd28['id'],'UserId':_0x4502cd['user']['id'],'ContactId':_0x5edd28[_0x04f4('0xbb')],'AttachmentId':_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][0x0]['id']})[_0x04f4('0x37')](function(_0x232d31){_0x5edd28['dataValues']['Messages']=[];_0x5edd28[_0x04f4('0xbc')][_0x04f4('0xba')]['push'](_0x232d31[_0x04f4('0xbc')]);return _0x5edd28;});})['then'](function(_0x1ea3b3){respondWithRpcPromise(_0x04f4('0xbd'),_0x04f4('0xbd'),{'FaxAccountId':_[_0x04f4('0xb2')](_0x4502cd[_0x04f4('0x5a')]['id'])?undefined:_0x4502cd[_0x04f4('0x5a')]['id'],'path':_[_0x04f4('0xb2')](_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][0x0]['path'])?undefined:_0x4502cd['body']['attachments'][0x0][_0x04f4('0x8')],'fax':_[_0x04f4('0xb2')](_0x4502cd['body']['to'][0x0])?undefined:_0x4502cd[_0x04f4('0x3c')]['to'][0x0],'AttachmentId':_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][0x0]['id']},client9002)[_0x04f4('0x37')](function(_0x10428f){logger['info'](_0x04f4('0xbe'),_0x10428f);})[_0x04f4('0x27')](function(_0x420cc6){logger[_0x04f4('0x1f')]('SendFaxRpc,\x20%s',_0x420cc6);});return _0x1ea3b3;})['then'](respondWithResult(_0x2c84e4,null))[_0x04f4('0x27')](handleError(_0x2c84e4,null));};exports['addAgents']=function(_0x2f68df,_0x36a6d8,_0x487e8a){return db[_0x04f4('0x44')][_0x04f4('0x5c')]({'where':{'id':_0x2f68df[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x36a6d8,null))['then'](function(_0x2a6da1){if(_0x2a6da1){return _0x2a6da1['addAgents'](_0x2f68df[_0x04f4('0x3c')]['ids'],_[_0x04f4('0x76')](_0x2f68df[_0x04f4('0x3c')],[_0x04f4('0x6c'),'id'])||{})[_0x04f4('0xbf')](function(_0x2f07cc){for(var _0x17bc1a=0x0;_0x17bc1a<_0x2f68df[_0x04f4('0x3c')][_0x04f4('0x6c')][_0x04f4('0x5b')];_0x17bc1a+=0x1){socket['emit'](_0x04f4('0xc0'),{'UserId':_0x2f68df[_0x04f4('0x3c')][_0x04f4('0x6c')][_0x17bc1a],'FaxAccountId':_0x2f68df[_0x04f4('0x5a')]['id']});}return _0x2f07cc;});}})['then'](respondWithResult(_0x36a6d8,null))['catch'](handleError(_0x36a6d8,null));};exports['removeAgents']=function(_0x37e8c9,_0x1d0e7f,_0x2daf3a){return db['FaxAccount'][_0x04f4('0x5c')]({'where':{'id':_0x37e8c9[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x1d0e7f,null))['then'](function(_0x37aeff){if(_0x37aeff){return _0x37aeff['removeAgents'](_0x37e8c9['query'][_0x04f4('0x6c')])[_0x04f4('0x37')](function(){if(_[_0x04f4('0xc1')](_0x37e8c9[_0x04f4('0x49')][_0x04f4('0x6c')])){for(var _0x5bf4ad=0x0;_0x5bf4ad<_0x37e8c9[_0x04f4('0x49')][_0x04f4('0x6c')]['length'];_0x5bf4ad+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x37e8c9[_0x04f4('0x49')][_0x04f4('0x6c')][_0x5bf4ad]),'FaxAccountId':Number(_0x37e8c9[_0x04f4('0x5a')]['id'])});}}else{socket[_0x04f4('0xc2')]('userFaxAccount:remove',{'UserId':Number(_0x37e8c9[_0x04f4('0x49')]['ids']),'FaxAccountId':Number(_0x37e8c9[_0x04f4('0x5a')]['id'])});}});}})[_0x04f4('0x37')](respondWithStatusCode(_0x1d0e7f,null))['catch'](handleError(_0x1d0e7f,null));};exports[_0x04f4('0xc3')]=function(_0x3c75ea,_0x3a28f5,_0xaa8306){var _0x4a6c0e={};var _0x3197d0={};var _0x18494d;var _0x4b1c86;return db['FaxAccount']['findOne']({'where':{'id':_0x3c75ea['params']['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x3a28f5,null))['then'](function(_0x4dea5e){if(_0x4dea5e){_0x18494d=_0x4dea5e;_0x3197d0[_0x04f4('0x48')]=_[_0x04f4('0x4a')](db['User'][_0x04f4('0x45')]);_0x3197d0[_0x04f4('0x49')]=_[_0x04f4('0x4a')](_0x3c75ea[_0x04f4('0x49')]);_0x3197d0[_0x04f4('0x4b')]=_[_0x04f4('0x4d')](_0x3197d0[_0x04f4('0x48')],_0x3197d0[_0x04f4('0x49')]);_0x4a6c0e[_0x04f4('0x4c')]=_[_0x04f4('0x4d')](_0x3197d0[_0x04f4('0x48')],qs[_0x04f4('0x4e')](_0x3c75ea[_0x04f4('0x49')][_0x04f4('0x4e')]));_0x4a6c0e[_0x04f4('0x4c')]=_0x4a6c0e[_0x04f4('0x4c')]['length']?_0x4a6c0e[_0x04f4('0x4c')]:_0x3197d0[_0x04f4('0x48')];_0x4a6c0e[_0x04f4('0x4f')]=qs['sort'](_0x3c75ea['query'][_0x04f4('0x6a')]);_0x4a6c0e[_0x04f4('0x52')]=qs[_0x04f4('0x4b')](_[_0x04f4('0x50')](_0x3c75ea[_0x04f4('0x49')],_0x3197d0[_0x04f4('0x4b')]));if(_0x3c75ea[_0x04f4('0x49')][_0x04f4('0x51')]){_0x4a6c0e['where']=_[_0x04f4('0x53')](_0x4a6c0e[_0x04f4('0x52')],{'$or':_[_0x04f4('0x43')](_0x4a6c0e['attributes'],function(_0x5c89d8){var _0x535dc0={};_0x535dc0[_0x5c89d8]={'$like':'%'+_0x3c75ea['query'][_0x04f4('0x51')]+'%'};return _0x535dc0;})});}_0x4a6c0e=_[_0x04f4('0x53')]({},_0x4a6c0e,_0x3c75ea[_0x04f4('0x55')]);return _0x18494d['getAgents'](_0x4a6c0e);}})[_0x04f4('0x37')](function(_0x48b33a){if(_0x48b33a){_0x4b1c86=_0x48b33a[_0x04f4('0x5b')];if(!_0x3c75ea[_0x04f4('0x49')]['hasOwnProperty'](_0x04f4('0x72'))){_0x4a6c0e[_0x04f4('0x2d')]=qs[_0x04f4('0x2d')](_0x3c75ea[_0x04f4('0x49')][_0x04f4('0x2d')]);_0x4a6c0e[_0x04f4('0x2b')]=qs['offset'](_0x3c75ea[_0x04f4('0x49')][_0x04f4('0x2b')]);}return _0x18494d[_0x04f4('0xc3')](_0x4a6c0e);}})[_0x04f4('0x37')](function(_0x1cddf0){if(_0x1cddf0){return _0x1cddf0?{'count':_0x4b1c86,'rows':_0x1cddf0}:null;}})['then'](respondWithResult(_0x3a28f5,null))[_0x04f4('0x27')](handleError(_0x3a28f5,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index c84188a..c4ac64e 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 _0x9c9f=['remove','emit','hasOwnProperty','hook','exports','FaxAccount','setMaxListeners','save','update'];(function(_0x2447cc,_0xc5f861){var _0x86393e=function(_0x19854f){while(--_0x19854f){_0x2447cc['push'](_0x2447cc['shift']());}};_0x86393e(++_0xc5f861);}(_0x9c9f,0x83));var _0xf9c9=function(_0x5eb8eb,_0x505f87){_0x5eb8eb=_0x5eb8eb-0x0;var _0x1b328c=_0x9c9f[_0x5eb8eb];return _0x1b328c;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0xf9c9('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xf9c9('0x1')](0x0);var events={'afterCreate':_0xf9c9('0x2'),'afterUpdate':_0xf9c9('0x3'),'afterDestroy':_0xf9c9('0x4')};function emitEvent(_0x760b80){return function(_0x1cc557,_0x219d9d,_0x54c0f1){FaxAccountEvents['emit'](_0x760b80+':'+_0x1cc557['id'],_0x1cc557);FaxAccountEvents[_0xf9c9('0x5')](_0x760b80,_0x1cc557);_0x54c0f1(null);};}for(var e in events){if(events[_0xf9c9('0x6')](e)){var event=events[e];FaxAccount[_0xf9c9('0x7')](e,emitEvent(event));}}module[_0xf9c9('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xb576=['exports','../../mysqldb','save','remove','emit','hasOwnProperty'];(function(_0x4173cc,_0x3b224f){var _0x171776=function(_0x173472){while(--_0x173472){_0x4173cc['push'](_0x4173cc['shift']());}};_0x171776(++_0x3b224f);}(_0xb576,0x1cf));var _0x6b57=function(_0x36006d,_0x206c39){_0x36006d=_0x36006d-0x0;var _0x10f33f=_0xb576[_0x36006d];return _0x10f33f;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x6b57('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b57('0x1'),'afterUpdate':'update','afterDestroy':_0x6b57('0x2')};function emitEvent(_0x4e044e){return function(_0x2f8f0b,_0x34e19a,_0x2566ac){FaxAccountEvents[_0x6b57('0x3')](_0x4e044e+':'+_0x2f8f0b['id'],_0x2f8f0b);FaxAccountEvents[_0x6b57('0x3')](_0x4e044e,_0x2f8f0b);_0x2566ac(null);};}for(var e in events){if(events[_0x6b57('0x4')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x6b57('0x5')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 801cee6..2c96152 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 _0x1109=['path','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash','../../config/logger','api','request-promise'];(function(_0x5225d6,_0x58dfbe){var _0x5996f1=function(_0x3020bd){while(--_0x3020bd){_0x5225d6['push'](_0x5225d6['shift']());}};_0x5996f1(++_0x58dfbe);}(_0x1109,0x15a));var _0x9110=function(_0x2df84d,_0x56d874){_0x2df84d=_0x2df84d-0x0;var _0x2634ce=_0x1109[_0x2df84d];return _0x2634ce;};'use strict';var _=require(_0x9110('0x0'));var util=require('util');var logger=require(_0x9110('0x1'))(_0x9110('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9110('0x3'));var fs=require('fs');var path=require(_0x9110('0x4'));var rimraf=require('rimraf');var config=require(_0x9110('0x5'));var attributes=require(_0x9110('0x6'));module[_0x9110('0x7')]=function(_0x4a3c87,_0x1d3b0e){return _0x4a3c87[_0x9110('0x8')]('FaxAccount',attributes,{'tableName':_0x9110('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf54a=['exports','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxAccount.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf54a,0x1cb));var _0xaf54=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf54a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaf54('0x0'));var util=require(_0xaf54('0x1'));var logger=require(_0xaf54('0x2'))(_0xaf54('0x3'));var moment=require(_0xaf54('0x4'));var BPromise=require('bluebird');var rp=require(_0xaf54('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf54('0x6'));var config=require(_0xaf54('0x7'));var attributes=require(_0xaf54('0x8'));module[_0xaf54('0x9')]=function(_0x53eb3b,_0x478fe3){return _0x53eb3b['define'](_0xaf54('0xa'),attributes,{'tableName':_0xaf54('0xb'),'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 dd75416..e26c64c 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 _0x958f=['create','Contact\x20not\x20found','spread','autoclose','close','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','map','model','then','debug','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','Contacts','DESC','FaxApplication','Applications','get','account','applications','priority','asc','length'];(function(_0x39c127,_0x2fa069){var _0x4b86df=function(_0x5a215c){while(--_0x5a215c){_0x39c127['push'](_0x39c127['shift']());}};_0x4b86df(++_0x2fa069);}(_0x958f,0x118));var _0xf958=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x958f[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xf958('0x0'));var util=require(_0xf958('0x1'));var moment=require('moment');var BPromise=require(_0xf958('0x2'));var rs=require(_0xf958('0x3'));var fs=require('fs');var Redis=require(_0xf958('0x4'));var db=require(_0xf958('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf958('0x6'))(_0xf958('0x7'));var config=require('../../config/environment');var jayson=require(_0xf958('0x8'));var client=jayson[_0xf958('0x9')][_0xf958('0xa')]({'port':0x232c});config[_0xf958('0xb')]=_[_0xf958('0xc')](config[_0xf958('0xb')],{'host':_0xf958('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf958('0xe'))[_0xf958('0xf')](socket);function respondWithRpcPromise(_0x578598,_0x4fc47e,_0x2543df){return new BPromise(function(_0x35c0e6,_0x1c215e){return client[_0xf958('0x10')](_0x578598,_0x2543df)['then'](function(_0x1c353a){logger[_0xf958('0x11')](_0xf958('0x12'),_0x4fc47e,_0xf958('0x13'));logger['debug'](_0xf958('0x14'),_0x4fc47e,'request\x20sent',JSON[_0xf958('0x15')](_0x1c353a));if(_0x1c353a[_0xf958('0x16')]){if(_0x1c353a[_0xf958('0x16')][_0xf958('0x17')]===0x1f4){logger[_0xf958('0x16')](_0xf958('0x12'),_0x4fc47e,_0x1c353a[_0xf958('0x16')][_0xf958('0x18')]);return _0x1c215e(_0x1c353a[_0xf958('0x16')]['message']);}logger[_0xf958('0x16')]('FaxAccount,\x20%s,\x20%s',_0x4fc47e,_0x1c353a[_0xf958('0x16')][_0xf958('0x18')]);return _0x35c0e6(_0x1c353a['error']['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x4fc47e,_0xf958('0x13'));_0x35c0e6(_0x1c353a['result'][_0xf958('0x18')]);}})[_0xf958('0x19')](function(_0x5d4b7a){logger[_0xf958('0x16')](_0xf958('0x12'),_0x4fc47e,_0x5d4b7a);_0x1c215e(_0x5d4b7a);});});}exports[_0xf958('0x1a')]=function(_0x5a9f1e){var _0x5e3570=this;return new Promise(function(_0x11200b,_0x313654){return db[_0xf958('0x1b')]['findAll']({'raw':_0x5a9f1e[_0xf958('0x1c')]?_0x5a9f1e['options'][_0xf958('0x1d')]===undefined?!![]:![]:!![],'where':_0x5a9f1e[_0xf958('0x1c')]?_0x5a9f1e['options'][_0xf958('0x1e')]||null:null,'attributes':_0x5a9f1e['options']?_0x5a9f1e[_0xf958('0x1c')][_0xf958('0x1f')]||null:null,'limit':_0x5a9f1e['options']?_0x5a9f1e[_0xf958('0x1c')][_0xf958('0x20')]||null:null,'include':_0x5a9f1e['options']?_0x5a9f1e[_0xf958('0x1c')][_0xf958('0x21')]?_[_0xf958('0x22')](_0x5a9f1e[_0xf958('0x1c')][_0xf958('0x21')],function(_0x4739bf){return{'model':db[_0x4739bf[_0xf958('0x23')]],'as':_0x4739bf['as'],'attributes':_0x4739bf[_0xf958('0x1f')],'include':_0x4739bf[_0xf958('0x21')]?_[_0xf958('0x22')](_0x4739bf[_0xf958('0x21')],function(_0x17440c){return{'model':db[_0x17440c[_0xf958('0x23')]],'as':_0x17440c['as'],'attributes':_0x17440c[_0xf958('0x1f')],'include':_0x17440c['include']?_[_0xf958('0x22')](_0x17440c['include'],function(_0x5d5503){return{'model':db[_0x5d5503[_0xf958('0x23')]],'as':_0x5d5503['as'],'attributes':_0x5d5503['attributes']};}):[]};}):[]};}):[]:[]})[_0xf958('0x24')](function(_0x501766){logger[_0xf958('0x11')](_0xf958('0x1a'),_0x5a9f1e);logger[_0xf958('0x25')](_0xf958('0x1a'),_0x5a9f1e,JSON[_0xf958('0x15')](_0x501766));_0x11200b(_0x501766);})[_0xf958('0x19')](function(_0x123cd7){logger[_0xf958('0x16')](_0xf958('0x1a'),_0x123cd7[_0xf958('0x18')],_0x5a9f1e);_0x313654(_0x5e3570['error'](0x1f4,_0x123cd7['message']));});});};exports[_0xf958('0x26')]=function(_0x3fb52b,_0x3fb448,_0x2c4489){var _0x42fdcb=this;return new Promise(function(_0x55865e,_0x19587a){var _0x2fb6a9={'body':_0x3fb52b[_0xf958('0x27')],'channel':_0xf958('0x28')};var _0x31d641=[];var _0x45442e=[];var _0x507c82={};return db[_0xf958('0x29')][_0xf958('0x2a')]()[_0xf958('0x24')](function(_0x39379f){if(!_0x39379f){throw new db[(_0xf958('0x2b'))][(_0xf958('0x2c'))](_0xf958('0x2d'));}_0x31d641=_[_0xf958('0x2e')](_[_0xf958('0x2f')](_0x39379f),[_0xf958('0x30'),'updatedAt']);_0x45442e=_[_0xf958('0x2e')](_[_0xf958('0x2f')](_0x39379f),['createdAt',_0xf958('0x31'),'CompanyId',_0xf958('0x32')]);if(_0x3fb52b[_0xf958('0x27')]['id']){delete _0x3fb52b[_0xf958('0x27')]['id'];}if(_['isNil'](_0x3fb52b[_0xf958('0x27')][_0xf958('0x33')])){throw new db[(_0xf958('0x2b'))][(_0xf958('0x2c'))](_0xf958('0x34'));}if(_[_0xf958('0x35')](_0x3fb52b[_0xf958('0x27')][_0xf958('0x27')])||_0x3fb52b[_0xf958('0x27')][_0xf958('0x27')]===''){throw new db['Sequelize']['ValidationError'](_0xf958('0x36'));}if(_[_0xf958('0x35')](_0x3fb52b[_0xf958('0x27')]['mapKey'])){throw new db['Sequelize'][(_0xf958('0x2c'))](_0xf958('0x37')+_0x45442e);}if(!_[_0xf958('0x38')](_0x45442e,_0x3fb52b[_0xf958('0x27')][_0xf958('0x39')])){throw new db[(_0xf958('0x2b'))][(_0xf958('0x2c'))](_0xf958('0x3a')+_0x45442e);}_0x507c82[_0x3fb52b[_0xf958('0x27')][_0xf958('0x39')]]=_0x3fb52b[_0xf958('0x27')][_0xf958('0x33')];})[_0xf958('0x24')](function(){return db[_0xf958('0x1b')][_0xf958('0x3b')]({'where':{'id':_0x3fb52b['account']['id']},'include':[{'model':db[_0xf958('0x3c')],'as':_0xf958('0x3d'),'include':[{'model':db[_0xf958('0x29')],'as':_0xf958('0x3e'),'where':_0x507c82,'limit':0x1,'order':[[_0xf958('0x31'),_0xf958('0x3f')]]}]},{'model':db[_0xf958('0x40')],'as':_0xf958('0x41')}]});})['then'](function(_0x4b87b4){if(_0x4b87b4&&_0x4b87b4[_0xf958('0x3d')]){var _0x517859=_0x4b87b4[_0xf958('0x42')]({'plain':!![]});_0x2fb6a9[_0xf958('0x43')]=_0x517859;_0x2fb6a9['applications']=_0x517859[_0xf958('0x41')];_0x2fb6a9['list']=_0x517859['List'];_0x2fb6a9['applications']=_['orderBy'](_0x2fb6a9[_0xf958('0x44')],[_0xf958('0x45')],[_0xf958('0x46')]);if(_0x2fb6a9[_0xf958('0x43')]['Applications']){delete _0x2fb6a9['account'][_0xf958('0x41')];}if(_0x2fb6a9['account'][_0xf958('0x3d')]&&_0x2fb6a9['account']['List']['Contacts'][_0xf958('0x47')]){return _0x2fb6a9['account'][_0xf958('0x3d')][_0xf958('0x3e')][0x0];}var _0x232963=_[_0xf958('0xc')](_0x3fb52b[_0xf958('0x27')],{'firstName':_0x3fb52b['body'][_0xf958('0x33')],'ListId':_0x517859[_0xf958('0x32')]});_0x232963[_0x3fb52b['body'][_0xf958('0x39')]]=_0x3fb52b[_0xf958('0x27')][_0xf958('0x33')];return db['CmContact']['create'](_0x232963,{'fields':_0x31d641,'raw':!![]});}})['then'](function(_0x2ece2b){_0x2fb6a9['contact']=_0x2ece2b;if(_0x2ece2b){var _0x2ccd56={'ContactId':_0x2ece2b['id'],'FaxAccountId':_0x3fb52b['account']['id'],'fax':_0x2ece2b[_0xf958('0x28')]};return db['FaxInteraction'][_0xf958('0x3b')]({'where':{'ContactId':_0x2ece2b['id'],'closed':![],'FaxAccountId':_0x3fb52b[_0xf958('0x43')]['id']}})['then'](function(_0x5e02f0){if(_0x5e02f0){return[_0x5e02f0,![]];}return db['FaxInteraction'][_0xf958('0x48')](_0x2ccd56)[_0xf958('0x24')](function(_0x1fc5d3){return[_0x1fc5d3,!![]];});});}else{throw new Error(_0xf958('0x49'));}})[_0xf958('0x4a')](function(_0x579b6d,_0x3fcf59){var _0x534b5a=_0x579b6d[_0xf958('0x42')]({'plain':!![]});if(_0x3fcf59){if(_0x2fb6a9[_0xf958('0x43')][_0xf958('0x4b')]){_0x2fb6a9[_0xf958('0x44')]['push']({'id':0x0,'priority':_0x2fb6a9['applications'][_0xf958('0x47')]+0x1,'app':_0xf958('0x4c'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x534b5a['created']=!![];}else{_0x534b5a[_0xf958('0x4d')]=![];}_0x2fb6a9[_0xf958('0x4e')]=_0x534b5a;return db[_0xf958('0x4f')][_0xf958('0x48')]({'body':_0x3fb52b[_0xf958('0x27')][_0xf958('0x27')],'FaxAccountId':_0x3fb52b[_0xf958('0x43')]['id'],'FaxInteractionId':_0x579b6d['id'],'direction':'in','ContactId':_0x579b6d[_0xf958('0x50')],'AttachmentId':_0x3fb52b[_0xf958('0x27')][_0xf958('0x51')]});})[_0xf958('0x24')](function(_0x1d9d9e){_0x2fb6a9[_0xf958('0x18')]=_0x1d9d9e;if(_0x2fb6a9[_0xf958('0x4e')][_0xf958('0x52')]){return db['User'][_0xf958('0x3b')]({'attributes':['id',_0xf958('0x53')],'where':{'id':_0x2fb6a9[_0xf958('0x4e')][_0xf958('0x52')]}})[_0xf958('0x24')](function(_0x299caa){if(_0x299caa){_0x2fb6a9[_0xf958('0x44')]['unshift']({'id':0x0,'priority':0x0,'app':_0xf958('0x54'),'appdata':_0x299caa['name']+','+(_0x2fb6a9[_0xf958('0x43')][_0xf958('0x55')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xf958('0x56'),_0xf958('0x57'),_0x2fb6a9);});}return respondWithRpcPromise(_0xf958('0x56'),'startRouting',_0x2fb6a9);})['then'](function(_0x5c2dd3){_0x55865e(_0x5c2dd3);})[_0xf958('0x19')](function(_0xd749a4){_0x19587a(_0x42fdcb['error'](0x1f4,_0xd749a4[_0xf958('0x18')]));});});}; \ No newline at end of file +var _0x71f7=['where','attributes','limit','include','model','map','then','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','CmList','Contacts','DESC','FaxApplication','List','get','applications','list','orderBy','priority','asc','Applications','length','create','FaxInteraction','Contact\x20not\x20found','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x71f7,0x1a7));var _0x771f=function(_0x8cd896,_0x1b28ba){_0x8cd896=_0x8cd896-0x0;var _0xc4af92=_0x71f7[_0x8cd896];return _0xc4af92;};'use strict';var _=require(_0x771f('0x0'));var util=require(_0x771f('0x1'));var moment=require('moment');var BPromise=require(_0x771f('0x2'));var rs=require(_0x771f('0x3'));var fs=require('fs');var Redis=require(_0x771f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x771f('0x5'));var config=require('../../config/environment');var jayson=require(_0x771f('0x6'));var client=jayson[_0x771f('0x7')][_0x771f('0x8')]({'port':0x232c});config[_0x771f('0x9')]=_[_0x771f('0xa')](config[_0x771f('0x9')],{'host':_0x771f('0xb'),'port':0x18eb});var socket=require(_0x771f('0xc'))(new Redis(config[_0x771f('0x9')]));require(_0x771f('0xd'))[_0x771f('0xe')](socket);function respondWithRpcPromise(_0xa1508d,_0x1847f8,_0x72a1a0){return new BPromise(function(_0x29a041,_0x3a49ae){return client[_0x771f('0xf')](_0xa1508d,_0x72a1a0)['then'](function(_0x59af22){logger[_0x771f('0x10')]('FaxAccount,\x20%s,\x20%s',_0x1847f8,_0x771f('0x11'));logger[_0x771f('0x12')](_0x771f('0x13'),_0x1847f8,'request\x20sent',JSON[_0x771f('0x14')](_0x59af22));if(_0x59af22[_0x771f('0x15')]){if(_0x59af22[_0x771f('0x15')][_0x771f('0x16')]===0x1f4){logger[_0x771f('0x15')](_0x771f('0x17'),_0x1847f8,_0x59af22[_0x771f('0x15')][_0x771f('0x18')]);return _0x3a49ae(_0x59af22[_0x771f('0x15')][_0x771f('0x18')]);}logger['error'](_0x771f('0x17'),_0x1847f8,_0x59af22[_0x771f('0x15')][_0x771f('0x18')]);return _0x29a041(_0x59af22[_0x771f('0x15')][_0x771f('0x18')]);}else{logger[_0x771f('0x10')]('FaxAccount,\x20%s,\x20%s',_0x1847f8,_0x771f('0x11'));_0x29a041(_0x59af22[_0x771f('0x19')][_0x771f('0x18')]);}})[_0x771f('0x1a')](function(_0xdfc895){logger[_0x771f('0x15')](_0x771f('0x17'),_0x1847f8,_0xdfc895);_0x3a49ae(_0xdfc895);});});}exports[_0x771f('0x1b')]=function(_0x16f227){var _0xbff02a=this;return new Promise(function(_0x490816,_0x36c565){return db[_0x771f('0x1c')][_0x771f('0x1d')]({'raw':_0x16f227[_0x771f('0x1e')]?_0x16f227[_0x771f('0x1e')][_0x771f('0x1f')]===undefined?!![]:![]:!![],'where':_0x16f227[_0x771f('0x1e')]?_0x16f227[_0x771f('0x1e')][_0x771f('0x20')]||null:null,'attributes':_0x16f227[_0x771f('0x1e')]?_0x16f227[_0x771f('0x1e')][_0x771f('0x21')]||null:null,'limit':_0x16f227[_0x771f('0x1e')]?_0x16f227[_0x771f('0x1e')][_0x771f('0x22')]||null:null,'include':_0x16f227['options']?_0x16f227[_0x771f('0x1e')][_0x771f('0x23')]?_['map'](_0x16f227[_0x771f('0x1e')]['include'],function(_0x3162af){return{'model':db[_0x3162af[_0x771f('0x24')]],'as':_0x3162af['as'],'attributes':_0x3162af[_0x771f('0x21')],'include':_0x3162af[_0x771f('0x23')]?_['map'](_0x3162af[_0x771f('0x23')],function(_0x557ce1){return{'model':db[_0x557ce1[_0x771f('0x24')]],'as':_0x557ce1['as'],'attributes':_0x557ce1[_0x771f('0x21')],'include':_0x557ce1['include']?_[_0x771f('0x25')](_0x557ce1[_0x771f('0x23')],function(_0x2b7e95){return{'model':db[_0x2b7e95['model']],'as':_0x2b7e95['as'],'attributes':_0x2b7e95['attributes']};}):[]};}):[]};}):[]:[]})[_0x771f('0x26')](function(_0x18f821){logger['info']('GetFaxAccount',_0x16f227);logger[_0x771f('0x12')]('GetFaxAccount',_0x16f227,JSON[_0x771f('0x14')](_0x18f821));_0x490816(_0x18f821);})['catch'](function(_0x3c0853){logger[_0x771f('0x15')](_0x771f('0x1b'),_0x3c0853['message'],_0x16f227);_0x36c565(_0xbff02a[_0x771f('0x15')](0x1f4,_0x3c0853[_0x771f('0x18')]));});});};exports[_0x771f('0x27')]=function(_0x4a4c4a,_0x3cf9e1,_0x2b3ef8){var _0x586075=this;return new Promise(function(_0x4935c7,_0x380dc6){var _0x572f34={'body':_0x4a4c4a[_0x771f('0x28')],'channel':_0x771f('0x29')};var _0xed3bb8=[];var _0x3f3ab2=[];var _0x1ac4dc={};return db[_0x771f('0x2a')][_0x771f('0x2b')]()[_0x771f('0x26')](function(_0x2f3d50){if(!_0x2f3d50){throw new db[(_0x771f('0x2c'))][(_0x771f('0x2d'))](_0x771f('0x2e'));}_0xed3bb8=_[_0x771f('0x2f')](_[_0x771f('0x30')](_0x2f3d50),[_0x771f('0x31'),'updatedAt']);_0x3f3ab2=_[_0x771f('0x2f')](_[_0x771f('0x30')](_0x2f3d50),['createdAt',_0x771f('0x32'),_0x771f('0x33'),_0x771f('0x34')]);if(_0x4a4c4a['body']['id']){delete _0x4a4c4a[_0x771f('0x28')]['id'];}if(_['isNil'](_0x4a4c4a['body']['from'])){throw new db[(_0x771f('0x2c'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x4a4c4a[_0x771f('0x28')][_0x771f('0x28')])||_0x4a4c4a[_0x771f('0x28')][_0x771f('0x28')]===''){throw new db[(_0x771f('0x2c'))][(_0x771f('0x2d'))](_0x771f('0x35'));}if(_['isNil'](_0x4a4c4a[_0x771f('0x28')][_0x771f('0x36')])){throw new db['Sequelize'][(_0x771f('0x2d'))](_0x771f('0x37')+_0x3f3ab2);}if(!_[_0x771f('0x38')](_0x3f3ab2,_0x4a4c4a[_0x771f('0x28')][_0x771f('0x36')])){throw new db['Sequelize'][(_0x771f('0x2d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3f3ab2);}_0x1ac4dc[_0x4a4c4a[_0x771f('0x28')][_0x771f('0x36')]]=_0x4a4c4a['body']['from'];})['then'](function(){return db[_0x771f('0x1c')][_0x771f('0x39')]({'where':{'id':_0x4a4c4a[_0x771f('0x3a')]['id']},'include':[{'model':db[_0x771f('0x3b')],'as':'List','include':[{'model':db[_0x771f('0x2a')],'as':_0x771f('0x3c'),'where':_0x1ac4dc,'limit':0x1,'order':[['updatedAt',_0x771f('0x3d')]]}]},{'model':db[_0x771f('0x3e')],'as':'Applications'}]});})[_0x771f('0x26')](function(_0x3d9476){if(_0x3d9476&&_0x3d9476[_0x771f('0x3f')]){var _0x5b941f=_0x3d9476[_0x771f('0x40')]({'plain':!![]});_0x572f34[_0x771f('0x3a')]=_0x5b941f;_0x572f34[_0x771f('0x41')]=_0x5b941f['Applications'];_0x572f34[_0x771f('0x42')]=_0x5b941f[_0x771f('0x3f')];_0x572f34[_0x771f('0x41')]=_[_0x771f('0x43')](_0x572f34[_0x771f('0x41')],[_0x771f('0x44')],[_0x771f('0x45')]);if(_0x572f34[_0x771f('0x3a')][_0x771f('0x46')]){delete _0x572f34[_0x771f('0x3a')][_0x771f('0x46')];}if(_0x572f34['account']['List']&&_0x572f34[_0x771f('0x3a')]['List'][_0x771f('0x3c')][_0x771f('0x47')]){return _0x572f34[_0x771f('0x3a')][_0x771f('0x3f')][_0x771f('0x3c')][0x0];}var _0x4db24e=_['defaults'](_0x4a4c4a['body'],{'firstName':_0x4a4c4a[_0x771f('0x28')]['from'],'ListId':_0x5b941f[_0x771f('0x34')]});_0x4db24e[_0x4a4c4a[_0x771f('0x28')][_0x771f('0x36')]]=_0x4a4c4a[_0x771f('0x28')]['from'];return db[_0x771f('0x2a')][_0x771f('0x48')](_0x4db24e,{'fields':_0xed3bb8,'raw':!![]});}})[_0x771f('0x26')](function(_0x276c66){_0x572f34['contact']=_0x276c66;if(_0x276c66){var _0x40f775={'ContactId':_0x276c66['id'],'FaxAccountId':_0x4a4c4a[_0x771f('0x3a')]['id'],'fax':_0x276c66['fax']};return db['FaxInteraction']['find']({'where':{'ContactId':_0x276c66['id'],'closed':![],'FaxAccountId':_0x4a4c4a['account']['id']}})['then'](function(_0x4e48ca){if(_0x4e48ca){return[_0x4e48ca,![]];}return db[_0x771f('0x49')]['create'](_0x40f775)[_0x771f('0x26')](function(_0x576d39){return[_0x576d39,!![]];});});}else{throw new Error(_0x771f('0x4a'));}})['spread'](function(_0x460d01,_0x2f344c){var _0xef3e47=_0x460d01[_0x771f('0x40')]({'plain':!![]});if(_0x2f344c){if(_0x572f34['account']['autoclose']){_0x572f34[_0x771f('0x41')][_0x771f('0x4b')]({'id':0x0,'priority':_0x572f34['applications']['length']+0x1,'app':_0x771f('0x4c'),'appdata':_0x771f('0x4d'),'interval':_0x771f('0x4e')});}_0xef3e47[_0x771f('0x4f')]=!![];}else{_0xef3e47[_0x771f('0x4f')]=![];}_0x572f34[_0x771f('0x50')]=_0xef3e47;return db[_0x771f('0x51')][_0x771f('0x48')]({'body':_0x4a4c4a[_0x771f('0x28')][_0x771f('0x28')],'FaxAccountId':_0x4a4c4a['account']['id'],'FaxInteractionId':_0x460d01['id'],'direction':'in','ContactId':_0x460d01[_0x771f('0x52')],'AttachmentId':_0x4a4c4a[_0x771f('0x28')][_0x771f('0x53')]});})['then'](function(_0xf11165){_0x572f34[_0x771f('0x18')]=_0xf11165;if(_0x572f34[_0x771f('0x50')][_0x771f('0x54')]){return db[_0x771f('0x55')][_0x771f('0x39')]({'attributes':['id','name'],'where':{'id':_0x572f34[_0x771f('0x50')][_0x771f('0x54')]}})['then'](function(_0x9d8c58){if(_0x9d8c58){_0x572f34[_0x771f('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':_0x771f('0x56'),'appdata':_0x9d8c58[_0x771f('0x57')]+','+(_0x572f34[_0x771f('0x3a')][_0x771f('0x58')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x771f('0x59'),_0x771f('0x5a'),_0x572f34);});}return respondWithRpcPromise(_0x771f('0x59'),_0x771f('0x5a'),_0x572f34);})[_0x771f('0x26')](function(_0xb2d590){_0x4935c7(_0xb2d590);})[_0x771f('0x1a')](function(_0x363b92){_0x380dc6(_0x586075['error'](0x1f4,_0x363b92[_0x771f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 3b2a61f..a877a38 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 _0x6d38=['removeListener','length','faxAccount:','save','remove','update'];(function(_0x101152,_0x397ab0){var _0xe1c465=function(_0x25de02){while(--_0x25de02){_0x101152['push'](_0x101152['shift']());}};_0xe1c465(++_0x397ab0);}(_0x6d38,0x1ef));var _0x86d3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6d38[_0x465028];return _0xb783d4;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x86d3('0x0'),_0x86d3('0x1'),_0x86d3('0x2')];function createListener(_0x52d138,_0x5c0b77){return function(_0xd1c7c){_0x5c0b77['emit'](_0x52d138,_0xd1c7c);};}function removeListener(_0xe9198a,_0x455b9d){return function(){FaxAccountEvents[_0x86d3('0x3')](_0xe9198a,_0x455b9d);};}exports['register']=function(_0x2d8272){for(var _0xfbbc15=0x0,_0x33d4aa=events[_0x86d3('0x4')];_0xfbbc15<_0x33d4aa;_0xfbbc15++){var _0x47e654=events[_0xfbbc15];var _0x552b07=createListener(_0x86d3('0x5')+_0x47e654,_0x2d8272);FaxAccountEvents['on'](_0x47e654,_0x552b07);}}; \ No newline at end of file +var _0x3d04=['remove','update','emit','removeListener','register','faxAccount:','./faxAccount.events','save'];(function(_0x2ba11a,_0x44e5ea){var _0x5c63e6=function(_0x5ca06f){while(--_0x5ca06f){_0x2ba11a['push'](_0x2ba11a['shift']());}};_0x5c63e6(++_0x44e5ea);}(_0x3d04,0xbe));var _0x43d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3d04[_0x5b644e];return _0x49c6bf;};'use strict';var FaxAccountEvents=require(_0x43d0('0x0'));var events=[_0x43d0('0x1'),_0x43d0('0x2'),_0x43d0('0x3')];function createListener(_0x191de5,_0x143fea){return function(_0x3d6e62){_0x143fea[_0x43d0('0x4')](_0x191de5,_0x3d6e62);};}function removeListener(_0x5a9e1d,_0x2a4d4c){return function(){FaxAccountEvents[_0x43d0('0x5')](_0x5a9e1d,_0x2a4d4c);};}exports[_0x43d0('0x6')]=function(_0x617bf){for(var _0x5e284f=0x0,_0x484271=events['length'];_0x5e284f<_0x484271;_0x5e284f++){var _0x5efb95=events[_0x5e284f];var _0x457550=createListener(_0x43d0('0x7')+_0x5efb95,_0x617bf);FaxAccountEvents['on'](_0x5efb95,_0x457550);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index ea31589..c1a1680 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 _0xa2cf=['./faxAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x547038,_0x296561){var _0x26b11a=function(_0x1be1bf){while(--_0x1be1bf){_0x547038['push'](_0x547038['shift']());}};_0x26b11a(++_0x296561);}(_0xa2cf,0xbd));var _0xfa2c=function(_0x8bb9bc,_0x45e3b7){_0x8bb9bc=_0x8bb9bc-0x0;var _0x24a4bd=_0xa2cf[_0x8bb9bc];return _0x24a4bd;};'use strict';var multer=require(_0xfa2c('0x0'));var util=require(_0xfa2c('0x1'));var path=require('path');var timeout=require(_0xfa2c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfa2c('0x3'));var auth=require(_0xfa2c('0x4'));var interaction=require(_0xfa2c('0x5'));var config=require('../../config/environment');var controller=require(_0xfa2c('0x6'));router[_0xfa2c('0x7')]('/',auth[_0xfa2c('0x8')](),controller['index']);router['get'](_0xfa2c('0x9'),auth['isAuthenticated'](),controller[_0xfa2c('0xa')]);router['get']('/:id',auth[_0xfa2c('0x8')](),controller[_0xfa2c('0xb')]);router['get'](_0xfa2c('0xc'),auth[_0xfa2c('0x8')](),controller[_0xfa2c('0xd')]);router[_0xfa2c('0x7')]('/:id/canned_answers',auth[_0xfa2c('0x8')](),controller[_0xfa2c('0xe')]);router[_0xfa2c('0x7')](_0xfa2c('0xf'),auth[_0xfa2c('0x8')](),controller[_0xfa2c('0x10')]);router['get'](_0xfa2c('0x11'),auth[_0xfa2c('0x8')](),controller[_0xfa2c('0x12')]);router[_0xfa2c('0x7')]('/:id/messages',auth[_0xfa2c('0x8')](),controller['getMessages']);router[_0xfa2c('0x7')](_0xfa2c('0x13'),auth[_0xfa2c('0x8')](),controller[_0xfa2c('0x14')]);router[_0xfa2c('0x15')]('/',auth[_0xfa2c('0x8')](),controller[_0xfa2c('0x16')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xfa2c('0x17')]);router[_0xfa2c('0x15')](_0xfa2c('0x18'),auth['isAuthenticated'](),controller[_0xfa2c('0x19')]);router[_0xfa2c('0x15')](_0xfa2c('0xf'),auth[_0xfa2c('0x8')](),controller[_0xfa2c('0x1a')]);router[_0xfa2c('0x15')](_0xfa2c('0x11'),auth[_0xfa2c('0x8')](),controller['addApplications']);router['post']('/addaccountapplications',auth['isAuthenticated'](),controller[_0xfa2c('0x1b')]);router[_0xfa2c('0x15')](_0xfa2c('0x1c'),auth['isAuthenticated'](),controller[_0xfa2c('0x1d')]);router[_0xfa2c('0x15')]('/:id/send',auth[_0xfa2c('0x8')](),controller[_0xfa2c('0x1e')]);router['post']('/:id/users',auth[_0xfa2c('0x8')](),controller['addAgents']);router[_0xfa2c('0x1f')](_0xfa2c('0x20'),auth[_0xfa2c('0x8')](),controller[_0xfa2c('0x21')]);router[_0xfa2c('0x22')](_0xfa2c('0x20'),auth[_0xfa2c('0x8')](),controller[_0xfa2c('0x23')]);router[_0xfa2c('0x22')](_0xfa2c('0xc'),auth[_0xfa2c('0x8')](),controller[_0xfa2c('0x24')]);router[_0xfa2c('0x22')](_0xfa2c('0x18'),auth[_0xfa2c('0x8')](),controller[_0xfa2c('0x25')]);router[_0xfa2c('0x22')](_0xfa2c('0x13'),auth[_0xfa2c('0x8')](),controller[_0xfa2c('0x26')]);module['exports']=router; \ No newline at end of file +var _0x17c5=['updateAccountApplications','/:id/send','/:id/users','addAgents','put','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addInteraction','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications'];(function(_0x580e94,_0x38c54a){var _0x47e041=function(_0x50d99c){while(--_0x50d99c){_0x580e94['push'](_0x580e94['shift']());}};_0x47e041(++_0x38c54a);}(_0x17c5,0xbe));var _0x517c=function(_0x408b34,_0x868761){_0x408b34=_0x408b34-0x0;var _0x2b40fa=_0x17c5[_0x408b34];return _0x2b40fa;};'use strict';var multer=require(_0x517c('0x0'));var util=require(_0x517c('0x1'));var path=require('path');var timeout=require(_0x517c('0x2'));var express=require(_0x517c('0x3'));var router=express[_0x517c('0x4')]();var fs_extra=require(_0x517c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x517c('0x6'));var config=require(_0x517c('0x7'));var controller=require(_0x517c('0x8'));router[_0x517c('0x9')]('/',auth[_0x517c('0xa')](),controller[_0x517c('0xb')]);router['get'](_0x517c('0xc'),auth[_0x517c('0xa')](),controller[_0x517c('0xd')]);router['get'](_0x517c('0xe'),auth[_0x517c('0xa')](),controller[_0x517c('0xf')]);router[_0x517c('0x9')](_0x517c('0x10'),auth[_0x517c('0xa')](),controller[_0x517c('0x11')]);router[_0x517c('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0x517c('0x9')](_0x517c('0x12'),auth[_0x517c('0xa')](),controller[_0x517c('0x13')]);router[_0x517c('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x517c('0x14')]);router[_0x517c('0x9')](_0x517c('0x15'),auth[_0x517c('0xa')](),controller[_0x517c('0x16')]);router['get']('/:id/users',auth[_0x517c('0xa')](),controller[_0x517c('0x17')]);router[_0x517c('0x18')]('/',auth['isAuthenticated'](),controller[_0x517c('0x19')]);router['post']('/:id/dispositions',auth[_0x517c('0xa')](),controller[_0x517c('0x1a')]);router['post'](_0x517c('0x1b'),auth['isAuthenticated'](),controller[_0x517c('0x1c')]);router['post'](_0x517c('0x12'),auth['isAuthenticated'](),controller[_0x517c('0x1d')]);router[_0x517c('0x18')](_0x517c('0x1e'),auth['isAuthenticated'](),controller[_0x517c('0x1f')]);router[_0x517c('0x18')](_0x517c('0x20'),auth['isAuthenticated'](),controller[_0x517c('0x21')]);router[_0x517c('0x18')](_0x517c('0x22'),auth['isAuthenticated'](),controller[_0x517c('0x23')]);router[_0x517c('0x18')](_0x517c('0x24'),auth[_0x517c('0xa')](),controller['send']);router[_0x517c('0x18')](_0x517c('0x25'),auth[_0x517c('0xa')](),controller[_0x517c('0x26')]);router[_0x517c('0x27')](_0x517c('0xe'),auth[_0x517c('0xa')](),controller['update']);router[_0x517c('0x28')](_0x517c('0xe'),auth['isAuthenticated'](),controller[_0x517c('0x29')]);router[_0x517c('0x28')](_0x517c('0x10'),auth['isAuthenticated'](),controller[_0x517c('0x2a')]);router[_0x517c('0x28')](_0x517c('0x1b'),auth[_0x517c('0xa')](),controller[_0x517c('0x2b')]);router['delete'](_0x517c('0x25'),auth[_0x517c('0xa')](),controller['removeAgents']);module[_0x517c('0x2c')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 110e066..ce7242a 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 _0x1a37=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1a37,0xb4));var _0x71a3=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x1a37[_0xd0b415];return _0x2bdf2c;};'use strict';var Sequelize=require(_0x71a3('0x0'));module[_0x71a3('0x1')]={'priority':{'type':Sequelize[_0x71a3('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x71a3('0x3')],'allowNull':![],'defaultValue':_0x71a3('0x4')},'appdata':{'type':Sequelize[_0x71a3('0x5')]()},'description':{'type':Sequelize[_0x71a3('0x3')]},'interval':{'type':Sequelize[_0x71a3('0x3')],'defaultValue':_0x71a3('0x6')}}; \ No newline at end of file +var _0x6a6e=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x4b6d85,_0x3cacc2){var _0x295a59=function(_0x456686){while(--_0x456686){_0x4b6d85['push'](_0x4b6d85['shift']());}};_0x295a59(++_0x3cacc2);}(_0x6a6e,0xe3));var _0xe6a6=function(_0x3ddefb,_0x2641f9){_0x3ddefb=_0x3ddefb-0x0;var _0x206cfc=_0x6a6e[_0x3ddefb];return _0x206cfc;};'use strict';var Sequelize=require(_0xe6a6('0x0'));module[_0xe6a6('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe6a6('0x2')],'allowNull':![],'defaultValue':_0xe6a6('0x3')},'appdata':{'type':Sequelize[_0xe6a6('0x4')]()},'description':{'type':Sequelize[_0xe6a6('0x2')]},'interval':{'type':Sequelize[_0xe6a6('0x2')],'defaultValue':_0xe6a6('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index b37cfda..d395cb8 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 _0xdad2=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','limit','apply','reject','then','error','name','send','render','body','contact','interaction','account','map','FaxApplication','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','catch','show','length','find','create','destroy','params','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js'];(function(_0x1876b2,_0x5d0225){var _0x9fb1e0=function(_0x29b099){while(--_0x29b099){_0x1876b2['push'](_0x1876b2['shift']());}};_0x9fb1e0(++_0x5d0225);}(_0xdad2,0x14c));var _0x2dad=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xdad2[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2dad('0x0'));var zipdir=require(_0x2dad('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2dad('0x2'));var moment=require(_0x2dad('0x3'));var BPromise=require(_0x2dad('0x4'));var Mustache=require('mustache');var util=require(_0x2dad('0x5'));var path=require(_0x2dad('0x6'));var sox=require('sox');var csv=require(_0x2dad('0x7'));var ejs=require(_0x2dad('0x8'));var fs=require('fs');var fs_extra=require(_0x2dad('0x9'));var _=require(_0x2dad('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2dad('0xb'));var deskjs=require(_0x2dad('0xc'));var toCsv=require(_0x2dad('0x7'));var querystring=require(_0x2dad('0xd'));var Papa=require(_0x2dad('0xe'));var Redis=require(_0x2dad('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2dad('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2dad('0x11'));var logger=require(_0x2dad('0x12'))('api');var utils=require(_0x2dad('0x13'));var config=require(_0x2dad('0x14'));var licenseUtil=require(_0x2dad('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39a4d5,_0x1d1f6a){_0x1d1f6a=_0x1d1f6a||0xcc;return function(_0x4aa814){if(_0x4aa814){return _0x39a4d5[_0x2dad('0x16')](_0x1d1f6a);}return _0x39a4d5[_0x2dad('0x17')](_0x1d1f6a)[_0x2dad('0x18')]();};}function respondWithResult(_0xa7969a,_0x5b9890){_0x5b9890=_0x5b9890||0xc8;return function(_0x711ee2){if(_0x711ee2){return _0xa7969a[_0x2dad('0x17')](_0x5b9890)[_0x2dad('0x19')](_0x711ee2);}};}function respondWithFilteredResult(_0x1ea049,_0x3094fa){return function(_0x49cb8a){if(_0x49cb8a){var _0x569c25=typeof _0x3094fa[_0x2dad('0x1a')]==='undefined'&&typeof _0x3094fa['limit']==='undefined';var _0xa5dc24=_0x49cb8a[_0x2dad('0x1b')];var _0x2a2602=_0x569c25?0x0:_0x3094fa[_0x2dad('0x1a')];var _0x126428=_0x569c25?_0x49cb8a['count']:_0x3094fa[_0x2dad('0x1a')]+_0x3094fa[_0x2dad('0x1c')];var _0x51de4a;if(_0x126428>=_0xa5dc24){_0x126428=_0xa5dc24;_0x51de4a=0xc8;}else{_0x51de4a=0xce;}_0x1ea049[_0x2dad('0x17')](_0x51de4a);return _0x1ea049['set']('Content-Range',_0x2a2602+'-'+_0x126428+'/'+_0xa5dc24)[_0x2dad('0x19')](_0x49cb8a);}return null;};}function patchUpdates(_0xc8dd1f){return function(_0x2cc5db){try{jsonpatch[_0x2dad('0x1d')](_0x2cc5db,_0xc8dd1f,!![]);}catch(_0x23eb0b){return BPromise[_0x2dad('0x1e')](_0x23eb0b);}return _0x2cc5db['save']();};}function saveUpdates(_0x4e1bd1,_0x2e1798){return function(_0x5d66af){if(_0x5d66af){return _0x5d66af['update'](_0x4e1bd1)[_0x2dad('0x1f')](function(_0x3865e9){return _0x3865e9;});}return null;};}function removeEntity(_0xf832fb,_0x5cb2c6){return function(_0xebad04){if(_0xebad04){return _0xebad04['destroy']()[_0x2dad('0x1f')](function(){_0xf832fb[_0x2dad('0x17')](0xcc)[_0x2dad('0x18')]();});}};}function handleEntityNotFound(_0x546946,_0x42d345){return function(_0x30e0fe){if(!_0x30e0fe){_0x546946[_0x2dad('0x16')](0x194);}return _0x30e0fe;};}function handleError(_0x5eb40a,_0x315a62){_0x315a62=_0x315a62||0x1f4;return function(_0x7055cb){logger[_0x2dad('0x20')](_0x7055cb['stack']);if(_0x7055cb[_0x2dad('0x21')]){delete _0x7055cb[_0x2dad('0x21')];}_0x5eb40a[_0x2dad('0x17')](_0x315a62)[_0x2dad('0x22')](_0x7055cb);};}function getMustacheRender(_0x2b5c0a,_0x37c3e1){return Mustache[_0x2dad('0x23')](_0x2b5c0a,_['merge'](_0x37c3e1[_0x2dad('0x24')],{'contact':_0x37c3e1[_0x2dad('0x25')],'message':_0x37c3e1['message'],'agent':_0x37c3e1['agent'],'interaction':_0x37c3e1[_0x2dad('0x26')],'account':_0x37c3e1[_0x2dad('0x27')]}))||'';}exports['index']=function(_0x32a788,_0x2f0a7a){var _0x2dd1dc={},_0x5334a5={},_0x479707={'count':0x0,'rows':[]};var _0x1e6069=_[_0x2dad('0x28')](db[_0x2dad('0x29')][_0x2dad('0x2a')],function(_0x3516c5){return{'name':_0x3516c5['fieldName'],'type':_0x3516c5[_0x2dad('0x2b')]['key']};});_0x5334a5[_0x2dad('0x2c')]=_[_0x2dad('0x28')](_0x1e6069,_0x2dad('0x21'));_0x5334a5[_0x2dad('0x2d')]=_[_0x2dad('0x2e')](_0x32a788[_0x2dad('0x2d')]);_0x5334a5[_0x2dad('0x2f')]=_[_0x2dad('0x30')](_0x5334a5[_0x2dad('0x2c')],_0x5334a5[_0x2dad('0x2d')]);_0x2dd1dc[_0x2dad('0x31')]=_[_0x2dad('0x30')](_0x5334a5[_0x2dad('0x2c')],qs[_0x2dad('0x32')](_0x32a788[_0x2dad('0x2d')][_0x2dad('0x32')]));_0x2dd1dc[_0x2dad('0x31')]=_0x2dd1dc[_0x2dad('0x31')]['length']?_0x2dd1dc[_0x2dad('0x31')]:_0x5334a5['model'];if(!_0x32a788[_0x2dad('0x2d')][_0x2dad('0x33')]('nolimit')){_0x2dd1dc[_0x2dad('0x1c')]=qs[_0x2dad('0x1c')](_0x32a788[_0x2dad('0x2d')][_0x2dad('0x1c')]);_0x2dd1dc['offset']=qs['offset'](_0x32a788[_0x2dad('0x2d')][_0x2dad('0x1a')]);}_0x2dd1dc[_0x2dad('0x34')]=qs[_0x2dad('0x35')](_0x32a788[_0x2dad('0x2d')][_0x2dad('0x35')]);_0x2dd1dc['where']=qs[_0x2dad('0x2f')](_[_0x2dad('0x36')](_0x32a788[_0x2dad('0x2d')],_0x5334a5['filters']),_0x1e6069);if(_0x32a788[_0x2dad('0x2d')][_0x2dad('0x37')]){_0x2dd1dc['where']=_[_0x2dad('0x38')](_0x2dd1dc[_0x2dad('0x39')],{'$or':_[_0x2dad('0x28')](_0x1e6069,function(_0x35ad33){if(_0x35ad33['type']!==_0x2dad('0x3a')){var _0xe48857={};_0xe48857[_0x35ad33['name']]={'$like':'%'+_0x32a788['query'][_0x2dad('0x37')]+'%'};return _0xe48857;}})});}_0x2dd1dc=_['merge']({},_0x2dd1dc,_0x32a788[_0x2dad('0x3b')]);var _0x5c3b0a={'where':_0x2dd1dc['where']};return db['FaxApplication'][_0x2dad('0x1b')](_0x5c3b0a)[_0x2dad('0x1f')](function(_0x4bf50a){_0x479707[_0x2dad('0x1b')]=_0x4bf50a;if(_0x32a788[_0x2dad('0x2d')]['includeAll']){_0x2dd1dc[_0x2dad('0x3c')]=[{'all':!![]}];}return db['FaxApplication'][_0x2dad('0x3d')](_0x2dd1dc);})[_0x2dad('0x1f')](function(_0x92c308){_0x479707['rows']=_0x92c308;return _0x479707;})[_0x2dad('0x1f')](respondWithFilteredResult(_0x2f0a7a,_0x2dd1dc))[_0x2dad('0x3e')](handleError(_0x2f0a7a,null));};exports[_0x2dad('0x3f')]=function(_0x414369,_0x5cb5f1){var _0x153414={'raw':!![],'where':{'id':_0x414369['params']['id']}},_0x454839={};_0x454839[_0x2dad('0x2c')]=_['keys'](db['FaxApplication'][_0x2dad('0x2a')]);_0x454839[_0x2dad('0x2d')]=_[_0x2dad('0x2e')](_0x414369[_0x2dad('0x2d')]);_0x454839[_0x2dad('0x2f')]=_[_0x2dad('0x30')](_0x454839[_0x2dad('0x2c')],_0x454839[_0x2dad('0x2d')]);_0x153414['attributes']=_[_0x2dad('0x30')](_0x454839[_0x2dad('0x2c')],qs[_0x2dad('0x32')](_0x414369['query'][_0x2dad('0x32')]));_0x153414[_0x2dad('0x31')]=_0x153414[_0x2dad('0x31')][_0x2dad('0x40')]?_0x153414[_0x2dad('0x31')]:_0x454839['model'];if(_0x414369['query']['includeAll']){_0x153414['include']=[{'all':!![]}];}_0x153414=_[_0x2dad('0x38')]({},_0x153414,_0x414369['options']);return db[_0x2dad('0x29')][_0x2dad('0x41')](_0x153414)[_0x2dad('0x1f')](handleEntityNotFound(_0x5cb5f1,null))[_0x2dad('0x1f')](respondWithResult(_0x5cb5f1,null))[_0x2dad('0x3e')](handleError(_0x5cb5f1,null));};exports['create']=function(_0x28faa6,_0x3bcfaf){return db[_0x2dad('0x29')][_0x2dad('0x42')](_0x28faa6['body'],{})['then'](respondWithResult(_0x3bcfaf,0xc9))[_0x2dad('0x3e')](handleError(_0x3bcfaf,null));};exports['update']=function(_0x306928,_0x446f90){if(_0x306928['body']['id']){delete _0x306928[_0x2dad('0x24')]['id'];}return db['FaxApplication'][_0x2dad('0x41')]({'where':{'id':_0x306928['params']['id']}})['then'](handleEntityNotFound(_0x446f90,null))[_0x2dad('0x1f')](saveUpdates(_0x306928[_0x2dad('0x24')],null))['then'](respondWithResult(_0x446f90,null))[_0x2dad('0x3e')](handleError(_0x446f90,null));};exports[_0x2dad('0x43')]=function(_0x254f02,_0x26620f){return db['FaxApplication']['find']({'where':{'id':_0x254f02[_0x2dad('0x44')]['id']}})['then'](handleEntityNotFound(_0x26620f,null))[_0x2dad('0x1f')](removeEntity(_0x26620f,null))[_0x2dad('0x3e')](handleError(_0x26620f,null));}; \ No newline at end of file +var _0x3593=['fieldName','type','key','map','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','options','FaxApplication','includeAll','include','rows','catch','show','params','length','create','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','reject','save','update','then','stack','name','send','render','merge','body','contact','message','agent','account','index','rawAttributes'];(function(_0x1a3ab3,_0x128a5b){var _0x482da8=function(_0x1bacec){while(--_0x1bacec){_0x1a3ab3['push'](_0x1a3ab3['shift']());}};_0x482da8(++_0x128a5b);}(_0x3593,0xb8));var _0x3359=function(_0x32f9ce,_0x3937be){_0x32f9ce=_0x32f9ce-0x0;var _0x3de330=_0x3593[_0x32f9ce];return _0x3de330;};'use strict';var emlformat=require(_0x3359('0x0'));var rimraf=require(_0x3359('0x1'));var zipdir=require(_0x3359('0x2'));var jsonpatch=require(_0x3359('0x3'));var rp=require(_0x3359('0x4'));var moment=require(_0x3359('0x5'));var BPromise=require(_0x3359('0x6'));var Mustache=require('mustache');var util=require(_0x3359('0x7'));var path=require('path');var sox=require(_0x3359('0x8'));var csv=require('to-csv');var ejs=require(_0x3359('0x9'));var fs=require('fs');var fs_extra=require(_0x3359('0xa'));var _=require(_0x3359('0xb'));var squel=require(_0x3359('0xc'));var crypto=require('crypto');var jsforce=require(_0x3359('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3359('0xe'));var querystring=require('querystring');var Papa=require(_0x3359('0xf'));var Redis=require(_0x3359('0x10'));var authService=require(_0x3359('0x11'));var qs=require(_0x3359('0x12'));var as=require(_0x3359('0x13'));var hardwareService=require(_0x3359('0x14'));var logger=require(_0x3359('0x15'))(_0x3359('0x16'));var utils=require(_0x3359('0x17'));var config=require(_0x3359('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3359('0x19'))['db'];function respondWithStatusCode(_0x3c7291,_0x29629d){_0x29629d=_0x29629d||0xcc;return function(_0x21f6fb){if(_0x21f6fb){return _0x3c7291[_0x3359('0x1a')](_0x29629d);}return _0x3c7291[_0x3359('0x1b')](_0x29629d)[_0x3359('0x1c')]();};}function respondWithResult(_0x40d524,_0x19ad13){_0x19ad13=_0x19ad13||0xc8;return function(_0x3a565d){if(_0x3a565d){return _0x40d524[_0x3359('0x1b')](_0x19ad13)[_0x3359('0x1d')](_0x3a565d);}};}function respondWithFilteredResult(_0x99344d,_0x16ae2a){return function(_0xd2f214){if(_0xd2f214){var _0x59a816=typeof _0x16ae2a[_0x3359('0x1e')]==='undefined'&&typeof _0x16ae2a[_0x3359('0x1f')]===_0x3359('0x20');var _0x3d04a6=_0xd2f214[_0x3359('0x21')];var _0x1c08e8=_0x59a816?0x0:_0x16ae2a[_0x3359('0x1e')];var _0xa22db=_0x59a816?_0xd2f214[_0x3359('0x21')]:_0x16ae2a['offset']+_0x16ae2a[_0x3359('0x1f')];var _0x303c74;if(_0xa22db>=_0x3d04a6){_0xa22db=_0x3d04a6;_0x303c74=0xc8;}else{_0x303c74=0xce;}_0x99344d[_0x3359('0x1b')](_0x303c74);return _0x99344d['set']('Content-Range',_0x1c08e8+'-'+_0xa22db+'/'+_0x3d04a6)[_0x3359('0x1d')](_0xd2f214);}return null;};}function patchUpdates(_0xd2b4e7){return function(_0x11025e){try{jsonpatch['apply'](_0x11025e,_0xd2b4e7,!![]);}catch(_0xf2bd1a){return BPromise[_0x3359('0x22')](_0xf2bd1a);}return _0x11025e[_0x3359('0x23')]();};}function saveUpdates(_0x3aa06a,_0x90034){return function(_0x3caa65){if(_0x3caa65){return _0x3caa65[_0x3359('0x24')](_0x3aa06a)[_0x3359('0x25')](function(_0x4d68e5){return _0x4d68e5;});}return null;};}function removeEntity(_0xf60dc9,_0x291977){return function(_0x3ef16d){if(_0x3ef16d){return _0x3ef16d['destroy']()[_0x3359('0x25')](function(){_0xf60dc9[_0x3359('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d9c7,_0x2263c3){return function(_0x12ac08){if(!_0x12ac08){_0x52d9c7[_0x3359('0x1a')](0x194);}return _0x12ac08;};}function handleError(_0xff1b68,_0x2e831e){_0x2e831e=_0x2e831e||0x1f4;return function(_0x343874){logger['error'](_0x343874[_0x3359('0x26')]);if(_0x343874['name']){delete _0x343874[_0x3359('0x27')];}_0xff1b68['status'](_0x2e831e)[_0x3359('0x28')](_0x343874);};}function getMustacheRender(_0x32ad12,_0x25cb53){return Mustache[_0x3359('0x29')](_0x32ad12,_[_0x3359('0x2a')](_0x25cb53[_0x3359('0x2b')],{'contact':_0x25cb53[_0x3359('0x2c')],'message':_0x25cb53[_0x3359('0x2d')],'agent':_0x25cb53[_0x3359('0x2e')],'interaction':_0x25cb53['interaction'],'account':_0x25cb53[_0x3359('0x2f')]}))||'';}exports[_0x3359('0x30')]=function(_0xcd8309,_0x5902c3){var _0x42be09={},_0x40a0e0={},_0x181b42={'count':0x0,'rows':[]};var _0x26aeb2=_['map'](db['FaxApplication'][_0x3359('0x31')],function(_0x49b713){return{'name':_0x49b713[_0x3359('0x32')],'type':_0x49b713[_0x3359('0x33')][_0x3359('0x34')]};});_0x40a0e0['model']=_[_0x3359('0x35')](_0x26aeb2,_0x3359('0x27'));_0x40a0e0['query']=_[_0x3359('0x36')](_0xcd8309[_0x3359('0x37')]);_0x40a0e0[_0x3359('0x38')]=_[_0x3359('0x39')](_0x40a0e0['model'],_0x40a0e0[_0x3359('0x37')]);_0x42be09[_0x3359('0x3a')]=_[_0x3359('0x39')](_0x40a0e0[_0x3359('0x3b')],qs[_0x3359('0x3c')](_0xcd8309[_0x3359('0x37')]['fields']));_0x42be09[_0x3359('0x3a')]=_0x42be09[_0x3359('0x3a')]['length']?_0x42be09['attributes']:_0x40a0e0[_0x3359('0x3b')];if(!_0xcd8309[_0x3359('0x37')][_0x3359('0x3d')]('nolimit')){_0x42be09[_0x3359('0x1f')]=qs[_0x3359('0x1f')](_0xcd8309['query'][_0x3359('0x1f')]);_0x42be09['offset']=qs[_0x3359('0x1e')](_0xcd8309[_0x3359('0x37')][_0x3359('0x1e')]);}_0x42be09[_0x3359('0x3e')]=qs[_0x3359('0x3f')](_0xcd8309['query'][_0x3359('0x3f')]);_0x42be09[_0x3359('0x40')]=qs[_0x3359('0x38')](_[_0x3359('0x41')](_0xcd8309[_0x3359('0x37')],_0x40a0e0['filters']),_0x26aeb2);if(_0xcd8309[_0x3359('0x37')][_0x3359('0x42')]){_0x42be09[_0x3359('0x40')]=_[_0x3359('0x2a')](_0x42be09[_0x3359('0x40')],{'$or':_[_0x3359('0x35')](_0x26aeb2,function(_0x448643){if(_0x448643[_0x3359('0x33')]!=='VIRTUAL'){var _0x1a28d9={};_0x1a28d9[_0x448643[_0x3359('0x27')]]={'$like':'%'+_0xcd8309[_0x3359('0x37')][_0x3359('0x42')]+'%'};return _0x1a28d9;}})});}_0x42be09=_[_0x3359('0x2a')]({},_0x42be09,_0xcd8309[_0x3359('0x43')]);var _0x30fbcd={'where':_0x42be09[_0x3359('0x40')]};return db[_0x3359('0x44')]['count'](_0x30fbcd)[_0x3359('0x25')](function(_0x4d7235){_0x181b42['count']=_0x4d7235;if(_0xcd8309[_0x3359('0x37')][_0x3359('0x45')]){_0x42be09[_0x3359('0x46')]=[{'all':!![]}];}return db[_0x3359('0x44')]['findAll'](_0x42be09);})[_0x3359('0x25')](function(_0x193063){_0x181b42[_0x3359('0x47')]=_0x193063;return _0x181b42;})[_0x3359('0x25')](respondWithFilteredResult(_0x5902c3,_0x42be09))[_0x3359('0x48')](handleError(_0x5902c3,null));};exports[_0x3359('0x49')]=function(_0x6f30,_0x223979){var _0x4d47a6={'raw':!![],'where':{'id':_0x6f30[_0x3359('0x4a')]['id']}},_0xe6910e={};_0xe6910e[_0x3359('0x3b')]=_[_0x3359('0x36')](db[_0x3359('0x44')]['rawAttributes']);_0xe6910e[_0x3359('0x37')]=_[_0x3359('0x36')](_0x6f30[_0x3359('0x37')]);_0xe6910e['filters']=_['intersection'](_0xe6910e[_0x3359('0x3b')],_0xe6910e[_0x3359('0x37')]);_0x4d47a6[_0x3359('0x3a')]=_['intersection'](_0xe6910e[_0x3359('0x3b')],qs[_0x3359('0x3c')](_0x6f30[_0x3359('0x37')][_0x3359('0x3c')]));_0x4d47a6[_0x3359('0x3a')]=_0x4d47a6[_0x3359('0x3a')][_0x3359('0x4b')]?_0x4d47a6[_0x3359('0x3a')]:_0xe6910e[_0x3359('0x3b')];if(_0x6f30[_0x3359('0x37')]['includeAll']){_0x4d47a6[_0x3359('0x46')]=[{'all':!![]}];}_0x4d47a6=_[_0x3359('0x2a')]({},_0x4d47a6,_0x6f30['options']);return db['FaxApplication']['find'](_0x4d47a6)[_0x3359('0x25')](handleEntityNotFound(_0x223979,null))[_0x3359('0x25')](respondWithResult(_0x223979,null))[_0x3359('0x48')](handleError(_0x223979,null));};exports[_0x3359('0x4c')]=function(_0x4fff7b,_0x31981e){return db[_0x3359('0x44')][_0x3359('0x4c')](_0x4fff7b[_0x3359('0x2b')],{})[_0x3359('0x25')](respondWithResult(_0x31981e,0xc9))[_0x3359('0x48')](handleError(_0x31981e,null));};exports[_0x3359('0x24')]=function(_0x4218bf,_0x40c4c2){if(_0x4218bf['body']['id']){delete _0x4218bf['body']['id'];}return db[_0x3359('0x44')][_0x3359('0x4d')]({'where':{'id':_0x4218bf['params']['id']}})[_0x3359('0x25')](handleEntityNotFound(_0x40c4c2,null))[_0x3359('0x25')](saveUpdates(_0x4218bf['body'],null))[_0x3359('0x25')](respondWithResult(_0x40c4c2,null))[_0x3359('0x48')](handleError(_0x40c4c2,null));};exports['destroy']=function(_0x383622,_0x38f852){return db[_0x3359('0x44')]['find']({'where':{'id':_0x383622[_0x3359('0x4a')]['id']}})[_0x3359('0x25')](handleEntityNotFound(_0x38f852,null))[_0x3359('0x25')](removeEntity(_0x38f852,null))[_0x3359('0x48')](handleError(_0x38f852,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 04a10ea..727a705 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 _0xfdf9=['request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird'];(function(_0x113a6c,_0x10df30){var _0x1ac632=function(_0xbd4fb9){while(--_0xbd4fb9){_0x113a6c['push'](_0x113a6c['shift']());}};_0x1ac632(++_0x10df30);}(_0xfdf9,0x99));var _0x9fdf=function(_0x24ffc9,_0x1b5bf5){_0x24ffc9=_0x24ffc9-0x0;var _0x30ac58=_0xfdf9[_0x24ffc9];return _0x30ac58;};'use strict';var _=require(_0x9fdf('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9fdf('0x1'));var BPromise=require(_0x9fdf('0x2'));var rp=require(_0x9fdf('0x3'));var fs=require('fs');var path=require(_0x9fdf('0x4'));var rimraf=require(_0x9fdf('0x5'));var config=require(_0x9fdf('0x6'));var attributes=require('./faxApplication.attributes');module[_0x9fdf('0x7')]=function(_0x699734,_0x52cd39){return _0x699734[_0x9fdf('0x8')](_0x9fdf('0x9'),attributes,{'tableName':_0x9fdf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9fdf('0xb'),'collate':_0x9fdf('0xc')});}; \ No newline at end of file +var _0xb3e4=['bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','util','../../config/logger','api','moment'];(function(_0x52975d,_0x127968){var _0x3baabc=function(_0x3b80e6){while(--_0x3b80e6){_0x52975d['push'](_0x52975d['shift']());}};_0x3baabc(++_0x127968);}(_0xb3e4,0x137));var _0x4b3e=function(_0x335db0,_0x37654c){_0x335db0=_0x335db0-0x0;var _0x2765d1=_0xb3e4[_0x335db0];return _0x2765d1;};'use strict';var _=require('lodash');var util=require(_0x4b3e('0x0'));var logger=require(_0x4b3e('0x1'))(_0x4b3e('0x2'));var moment=require(_0x4b3e('0x3'));var BPromise=require(_0x4b3e('0x4'));var rp=require(_0x4b3e('0x5'));var fs=require('fs');var path=require(_0x4b3e('0x6'));var rimraf=require(_0x4b3e('0x7'));var config=require(_0x4b3e('0x8'));var attributes=require(_0x4b3e('0x9'));module[_0x4b3e('0xa')]=function(_0xe9f578,_0x1604db){return _0xe9f578[_0x4b3e('0xb')](_0x4b3e('0xc'),attributes,{'tableName':_0x4b3e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4b3e('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index c68af56..0cba34b 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 _0x21c9=['body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','FaxApplication','update'];(function(_0x1b0364,_0x19dfc1){var _0x500680=function(_0xba5038){while(--_0xba5038){_0x1b0364['push'](_0x1b0364['shift']());}};_0x500680(++_0x19dfc1);}(_0x21c9,0xcc));var _0x921c=function(_0x5283ab,_0x2decb9){_0x5283ab=_0x5283ab-0x0;var _0x2f0386=_0x21c9[_0x5283ab];return _0x2f0386;};'use strict';var _=require(_0x921c('0x0'));var util=require(_0x921c('0x1'));var moment=require(_0x921c('0x2'));var BPromise=require(_0x921c('0x3'));var rs=require(_0x921c('0x4'));var fs=require('fs');var Redis=require(_0x921c('0x5'));var db=require(_0x921c('0x6'))['db'];var utils=require(_0x921c('0x7'));var logger=require('../../config/logger')(_0x921c('0x8'));var config=require('../../config/environment');var jayson=require(_0x921c('0x9'));var client=jayson[_0x921c('0xa')][_0x921c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7c4e9a,_0x1dbb92,_0xc611e5){return new BPromise(function(_0x4b839c,_0x5d5581){return client[_0x921c('0xc')](_0x7c4e9a,_0xc611e5)[_0x921c('0xd')](function(_0x40e568){logger[_0x921c('0xe')](_0x921c('0xf'),_0x1dbb92,_0x921c('0x10'));logger[_0x921c('0x11')](_0x921c('0x12'),_0x1dbb92,'request\x20sent',JSON[_0x921c('0x13')](_0x40e568));if(_0x40e568[_0x921c('0x14')]){if(_0x40e568[_0x921c('0x14')]['code']===0x1f4){logger[_0x921c('0x14')](_0x921c('0xf'),_0x1dbb92,_0x40e568[_0x921c('0x14')][_0x921c('0x15')]);return _0x5d5581(_0x40e568[_0x921c('0x14')][_0x921c('0x15')]);}logger[_0x921c('0x14')](_0x921c('0xf'),_0x1dbb92,_0x40e568[_0x921c('0x14')]['message']);return _0x4b839c(_0x40e568[_0x921c('0x14')]['message']);}else{logger[_0x921c('0xe')](_0x921c('0xf'),_0x1dbb92,_0x921c('0x10'));_0x4b839c(_0x40e568[_0x921c('0x16')][_0x921c('0x15')]);}})[_0x921c('0x17')](function(_0x379b19){logger[_0x921c('0x14')]('FaxApplication,\x20%s,\x20%s',_0x1dbb92,_0x379b19);_0x5d5581(_0x379b19);});});}exports[_0x921c('0x18')]=function(_0x1eef36){var _0xff6026=this;return new Promise(function(_0x4038ab,_0x169988){return db[_0x921c('0x19')][_0x921c('0x1a')](_0x1eef36[_0x921c('0x1b')],{'raw':_0x1eef36[_0x921c('0x1c')]?_0x1eef36[_0x921c('0x1c')][_0x921c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eef36['options']?_0x1eef36['options'][_0x921c('0x1e')]||null:null,'attributes':_0x1eef36['options']?_0x1eef36['options'][_0x921c('0x1f')]||null:null,'limit':_0x1eef36[_0x921c('0x1c')]?_0x1eef36['options'][_0x921c('0x20')]||null:null})[_0x921c('0xd')](function(_0x16feda){logger['info'](_0x921c('0x18'),_0x1eef36);logger[_0x921c('0x11')]('UpdateFaxApplication',_0x1eef36,JSON[_0x921c('0x13')](_0x16feda));_0x4038ab(_0x16feda);})['catch'](function(_0x4af61b){logger[_0x921c('0x14')](_0x921c('0x18'),_0x4af61b[_0x921c('0x15')],_0x1eef36);_0x169988(_0xff6026[_0x921c('0x14')](0x1f4,_0x4af61b[_0x921c('0x15')]));});});}; \ No newline at end of file +var _0x8117=['client','http','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','message','error','catch','FaxApplication','options','raw','where','attributes','limit','debug','UpdateFaxApplication','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x35885e,_0x2bd900){var _0xce29e1=function(_0x3a714c){while(--_0x3a714c){_0x35885e['push'](_0x35885e['shift']());}};_0xce29e1(++_0x2bd900);}(_0x8117,0x10e));var _0x7811=function(_0x160ce8,_0x221ea2){_0x160ce8=_0x160ce8-0x0;var _0x2bf5b2=_0x8117[_0x160ce8];return _0x2bf5b2;};'use strict';var _=require('lodash');var util=require(_0x7811('0x0'));var moment=require(_0x7811('0x1'));var BPromise=require('bluebird');var rs=require(_0x7811('0x2'));var fs=require('fs');var Redis=require(_0x7811('0x3'));var db=require(_0x7811('0x4'))['db'];var utils=require(_0x7811('0x5'));var logger=require(_0x7811('0x6'))(_0x7811('0x7'));var config=require(_0x7811('0x8'));var jayson=require(_0x7811('0x9'));var client=jayson[_0x7811('0xa')][_0x7811('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x365815,_0x19b809,_0x251f93){return new BPromise(function(_0x447a04,_0x5d84bc){return client['request'](_0x365815,_0x251f93)['then'](function(_0xb2c97b){logger[_0x7811('0xc')](_0x7811('0xd'),_0x19b809,_0x7811('0xe'));logger['debug'](_0x7811('0xf'),_0x19b809,_0x7811('0xe'),JSON[_0x7811('0x10')](_0xb2c97b));if(_0xb2c97b['error']){if(_0xb2c97b['error']['code']===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x19b809,_0xb2c97b['error'][_0x7811('0x11')]);return _0x5d84bc(_0xb2c97b[_0x7811('0x12')]['message']);}logger[_0x7811('0x12')](_0x7811('0xd'),_0x19b809,_0xb2c97b[_0x7811('0x12')][_0x7811('0x11')]);return _0x447a04(_0xb2c97b['error'][_0x7811('0x11')]);}else{logger[_0x7811('0xc')](_0x7811('0xd'),_0x19b809,'request\x20sent');_0x447a04(_0xb2c97b['result']['message']);}})[_0x7811('0x13')](function(_0x2c33e9){logger[_0x7811('0x12')](_0x7811('0xd'),_0x19b809,_0x2c33e9);_0x5d84bc(_0x2c33e9);});});}exports['UpdateFaxApplication']=function(_0x122f3b){var _0x574c10=this;return new Promise(function(_0x408331,_0x4f0a27){return db[_0x7811('0x14')]['update'](_0x122f3b['body'],{'raw':_0x122f3b['options']?_0x122f3b[_0x7811('0x15')][_0x7811('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x122f3b['options']?_0x122f3b['options'][_0x7811('0x17')]||null:null,'attributes':_0x122f3b[_0x7811('0x15')]?_0x122f3b[_0x7811('0x15')][_0x7811('0x18')]||null:null,'limit':_0x122f3b[_0x7811('0x15')]?_0x122f3b[_0x7811('0x15')][_0x7811('0x19')]||null:null})['then'](function(_0x20ca7a){logger[_0x7811('0xc')]('UpdateFaxApplication',_0x122f3b);logger[_0x7811('0x1a')](_0x7811('0x1b'),_0x122f3b,JSON[_0x7811('0x10')](_0x20ca7a));_0x408331(_0x20ca7a);})[_0x7811('0x13')](function(_0x358e0f){logger['error'](_0x7811('0x1b'),_0x358e0f[_0x7811('0x11')],_0x122f3b);_0x4f0a27(_0x574c10['error'](0x1f4,_0x358e0f['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 4962a7b..55e08b8 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 _0x114d=['post','create','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show'];(function(_0x4e43d4,_0xd760d0){var _0x4db61c=function(_0x4385c5){while(--_0x4385c5){_0x4e43d4['push'](_0x4e43d4['shift']());}};_0x4db61c(++_0xd760d0);}(_0x114d,0x184));var _0xd114=function(_0x30e808,_0x562b7a){_0x30e808=_0x30e808-0x0;var _0x1871e7=_0x114d[_0x30e808];return _0x1871e7;};'use strict';var multer=require(_0xd114('0x0'));var util=require(_0xd114('0x1'));var path=require(_0xd114('0x2'));var timeout=require('connect-timeout');var express=require(_0xd114('0x3'));var router=express[_0xd114('0x4')]();var fs_extra=require(_0xd114('0x5'));var auth=require(_0xd114('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd114('0x7'));var controller=require('./faxApplication.controller');router[_0xd114('0x8')]('/',auth['isAuthenticated'](),controller[_0xd114('0x9')]);router[_0xd114('0x8')]('/:id',auth[_0xd114('0xa')](),controller[_0xd114('0xb')]);router[_0xd114('0xc')]('/',auth[_0xd114('0xa')](),controller[_0xd114('0xd')]);router[_0xd114('0xe')]('/:id',auth[_0xd114('0xa')](),controller[_0xd114('0xf')]);router[_0xd114('0x10')](_0xd114('0x11'),auth[_0xd114('0xa')](),controller[_0xd114('0x12')]);module[_0xd114('0x13')]=router; \ No newline at end of file +var _0xfc34=['update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xfc34,0x135));var _0x4fc3=function(_0x24d560,_0x2e0e7b){_0x24d560=_0x24d560-0x0;var _0x18f7b3=_0xfc34[_0x24d560];return _0x18f7b3;};'use strict';var multer=require(_0x4fc3('0x0'));var util=require(_0x4fc3('0x1'));var path=require(_0x4fc3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4fc3('0x3')]();var fs_extra=require(_0x4fc3('0x4'));var auth=require(_0x4fc3('0x5'));var interaction=require(_0x4fc3('0x6'));var config=require(_0x4fc3('0x7'));var controller=require('./faxApplication.controller');router[_0x4fc3('0x8')]('/',auth[_0x4fc3('0x9')](),controller['index']);router[_0x4fc3('0x8')](_0x4fc3('0xa'),auth[_0x4fc3('0x9')](),controller[_0x4fc3('0xb')]);router[_0x4fc3('0xc')]('/',auth[_0x4fc3('0x9')](),controller['create']);router[_0x4fc3('0xd')](_0x4fc3('0xa'),auth[_0x4fc3('0x9')](),controller[_0x4fc3('0xe')]);router[_0x4fc3('0xf')](_0x4fc3('0xa'),auth['isAuthenticated'](),controller[_0x4fc3('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index d33da9e..9b7d4e3 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 _0xf88f=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x6eed90,_0x2656f2){var _0x4196f0=function(_0x11bb28){while(--_0x11bb28){_0x6eed90['push'](_0x6eed90['shift']());}};_0x4196f0(++_0x2656f2);}(_0xf88f,0x1bb));var _0xff88=function(_0x188720,_0xc83e6){_0x188720=_0x188720-0x0;var _0x1d7c2d=_0xf88f[_0x188720];return _0x1d7c2d;};'use strict';var Sequelize=require(_0xff88('0x0'));module[_0xff88('0x1')]={'closed':{'type':Sequelize[_0xff88('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xff88('0x3')]},'disposition':{'type':Sequelize[_0xff88('0x4')]},'secondDisposition':{'type':Sequelize[_0xff88('0x4')]},'thirdDisposition':{'type':Sequelize[_0xff88('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xff88('0x3')]},'fax':{'type':Sequelize[_0xff88('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xff88('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xff88('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xff88('0x5')]('in',_0xff88('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x3dd6=['STRING','ENUM','out','DATE'];(function(_0x2771ab,_0x571f8b){var _0x48ff7c=function(_0x10fc9b){while(--_0x10fc9b){_0x2771ab['push'](_0x2771ab['shift']());}};_0x48ff7c(++_0x571f8b);}(_0x3dd6,0xcf));var _0x63dd=function(_0xffad61,_0x5f0282){_0xffad61=_0xffad61-0x0;var _0x33ef10=_0x3dd6[_0xffad61];return _0x33ef10;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x63dd('0x0')]},'disposition':{'type':Sequelize[_0x63dd('0x1')]},'secondDisposition':{'type':Sequelize[_0x63dd('0x1')]},'thirdDisposition':{'type':Sequelize[_0x63dd('0x1')]},'note':{'type':Sequelize[_0x63dd('0x1')]},'read1stAt':{'type':Sequelize[_0x63dd('0x0')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x63dd('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x63dd('0x0')]},'lastMsgDirection':{'type':Sequelize[_0x63dd('0x2')]('in',_0x63dd('0x3')),'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 8a629ad..8b9d5e6 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 _0xfde6=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','merge','body','contact','message','agent','interaction','Users','Tags','TagIds','split','push','catch','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','find','value','`\x20=\x200','having','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','type','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','some','compact','isEmpty','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','i.FaxAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','FaxInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.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.*','Contact.lastName','c.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','params','includeAll','include','create','describe','addMessage','FaxMessage','ids','omit','findOne','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','addTags','setTags','faxInteractionTags:save','removeTags','download','unix','join','server','tmp','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','createReadStream','pipe','basename','log','err','unlinkSync','sendStatus','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x47d606,_0x4fa6b6){var _0x1520be=function(_0x4b92fc){while(--_0x4b92fc){_0x47d606['push'](_0x47d606['shift']());}};_0x1520be(++_0x4fa6b6);}(_0xfde6,0x19f));var _0x6fde=function(_0x28e126,_0x1dff35){_0x28e126=_0x28e126-0x0;var _0x17ad5f=_0xfde6[_0x28e126];return _0x17ad5f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6fde('0x0'));var rp=require('request-promise');var moment=require(_0x6fde('0x1'));var BPromise=require(_0x6fde('0x2'));var Mustache=require(_0x6fde('0x3'));var util=require(_0x6fde('0x4'));var path=require(_0x6fde('0x5'));var sox=require(_0x6fde('0x6'));var csv=require(_0x6fde('0x7'));var ejs=require(_0x6fde('0x8'));var fs=require('fs');var fs_extra=require(_0x6fde('0x9'));var _=require(_0x6fde('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6fde('0xb'));var deskjs=require(_0x6fde('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6fde('0xd'));var Papa=require(_0x6fde('0xe'));var Redis=require('ioredis');var authService=require(_0x6fde('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6fde('0x10'));var hardwareService=require(_0x6fde('0x11'));var logger=require(_0x6fde('0x12'))(_0x6fde('0x13'));var utils=require(_0x6fde('0x14'));var config=require(_0x6fde('0x15'));var licenseUtil=require(_0x6fde('0x16'));var db=require(_0x6fde('0x17'))['db'];config[_0x6fde('0x18')]=_[_0x6fde('0x19')](config[_0x6fde('0x18')],{'host':_0x6fde('0x1a'),'port':0x18eb});var socket=require(_0x6fde('0x1b'))(new Redis(config[_0x6fde('0x18')]));require(_0x6fde('0x1c'))[_0x6fde('0x1d')](socket);function respondWithStatusCode(_0x4f3b8b,_0x576cdc){_0x576cdc=_0x576cdc||0xcc;return function(_0x11c848){if(_0x11c848){return _0x4f3b8b['sendStatus'](_0x576cdc);}return _0x4f3b8b['status'](_0x576cdc)['end']();};}function respondWithResult(_0x1a0e6d,_0x4b921e){_0x4b921e=_0x4b921e||0xc8;return function(_0x2761f7){if(_0x2761f7){return _0x1a0e6d['status'](_0x4b921e)[_0x6fde('0x1e')](_0x2761f7);}};}function respondWithFilteredResult(_0x385956,_0x113daa){return function(_0x4ab384){if(_0x4ab384){var _0x51834f=typeof _0x113daa[_0x6fde('0x1f')]===_0x6fde('0x20')&&typeof _0x113daa['limit']===_0x6fde('0x20');var _0x3e89ec=_0x4ab384[_0x6fde('0x21')];var _0x257053=_0x51834f?0x0:_0x113daa[_0x6fde('0x1f')];var _0x293c4d=_0x51834f?_0x4ab384[_0x6fde('0x21')]:_0x113daa[_0x6fde('0x1f')]+_0x113daa[_0x6fde('0x22')];var _0x8390f2;if(_0x293c4d>=_0x3e89ec){_0x293c4d=_0x3e89ec;_0x8390f2=0xc8;}else{_0x8390f2=0xce;}_0x385956[_0x6fde('0x23')](_0x8390f2);return _0x385956[_0x6fde('0x24')](_0x6fde('0x25'),_0x257053+'-'+_0x293c4d+'/'+_0x3e89ec)[_0x6fde('0x1e')](_0x4ab384);}return null;};}function patchUpdates(_0x3139ba){return function(_0x4b11d7){try{jsonpatch[_0x6fde('0x26')](_0x4b11d7,_0x3139ba,!![]);}catch(_0x3949dc){return BPromise[_0x6fde('0x27')](_0x3949dc);}return _0x4b11d7[_0x6fde('0x28')]();};}function saveUpdates(_0x572b1e,_0x462f1f){return function(_0x394436){if(_0x394436){return _0x394436[_0x6fde('0x29')](_0x572b1e)[_0x6fde('0x2a')](function(_0x5ad904){return _0x5ad904;});}return null;};}function removeEntity(_0x30823f,_0x9ac67b){return function(_0x41064e){if(_0x41064e){return _0x41064e[_0x6fde('0x2b')]()['then'](function(){_0x30823f[_0x6fde('0x23')](0xcc)[_0x6fde('0x2c')]();});}};}function handleEntityNotFound(_0x54bebf,_0x3f7979){return function(_0x292d0c){if(!_0x292d0c){_0x54bebf['sendStatus'](0x194);}return _0x292d0c;};}function handleError(_0x7b5282,_0x50320e){_0x50320e=_0x50320e||0x1f4;return function(_0x3eafe2){logger[_0x6fde('0x2d')](_0x3eafe2[_0x6fde('0x2e')]);if(_0x3eafe2[_0x6fde('0x2f')]){delete _0x3eafe2['name'];}_0x7b5282[_0x6fde('0x23')](_0x50320e)['send'](_0x3eafe2);};}function getMustacheRender(_0x37b812,_0x17123a){return Mustache['render'](_0x37b812,_[_0x6fde('0x30')](_0x17123a[_0x6fde('0x31')],{'contact':_0x17123a[_0x6fde('0x32')],'message':_0x17123a[_0x6fde('0x33')],'agent':_0x17123a[_0x6fde('0x34')],'interaction':_0x17123a[_0x6fde('0x35')],'account':_0x17123a['account']}))||'';}function getInteractionUsers(_0x33b2cc,_0x3cc498){return new BPromise(function(_0x51f153,_0x5c3069){try{if(_0x3cc498[_0x33b2cc['id']]){_0x33b2cc[_0x6fde('0x36')]=_['map'](_0x3cc498[_0x33b2cc['id']],function(_0x18cb01){return{'id':_0x18cb01['id'],'fullname':_0x18cb01['fullname']};});}}catch(_0x15d229){_0x5c3069(_0x15d229);}_0x51f153(_0x33b2cc);});}function getInteractionTags(_0x7f0d3a,_0x24660e){return new BPromise(function(_0x385855,_0x2af35a){try{if(_0x7f0d3a['TagIds']){_0x7f0d3a[_0x6fde('0x37')]=[];_0x7f0d3a[_0x6fde('0x38')][_0x6fde('0x39')](',')['forEach'](function(_0x271122){_0x7f0d3a[_0x6fde('0x37')][_0x6fde('0x3a')](_0x24660e[_0x271122]);});}delete _0x7f0d3a['TagIds'];}catch(_0x84179a){_0x2af35a(_0x84179a);}_0x385855(_0x7f0d3a);});}function updateFaxInteraction(_0xda7f0b,_0x45489b,_0x5e39be){return new BPromise(function(_0x4718a1,_0x54aa8d){return getInteractionUsers(_0xda7f0b,_0x5e39be)[_0x6fde('0x2a')](function(_0x1ca126){return getInteractionTags(_0x1ca126,_0x45489b);})[_0x6fde('0x2a')](function(_0x20ca10){_0x4718a1(_0x20ca10);})[_0x6fde('0x3b')](function(_0x1816bc){_0x54aa8d(_0x1816bc);});});}exports[_0x6fde('0x3c')]=function(_0x428676,_0x4f1f78){var _0x47cdd3={},_0x23096b={},_0x285a4a={'count':0x0,'rows':[]};var _0x5bdc77=_[_0x6fde('0x3d')](db['FaxInteraction'][_0x6fde('0x3e')],function(_0x1a96e7){return{'name':_0x1a96e7[_0x6fde('0x3f')],'type':_0x1a96e7['type'][_0x6fde('0x40')]};});_0x23096b[_0x6fde('0x41')]=_[_0x6fde('0x3d')](_0x5bdc77,_0x6fde('0x2f'));_0x23096b[_0x6fde('0x42')]=_[_0x6fde('0x43')](_0x428676[_0x6fde('0x42')]);_0x23096b[_0x6fde('0x44')]=_['intersection'](_0x23096b['model'],_0x23096b[_0x6fde('0x42')]);_0x47cdd3[_0x6fde('0x45')]=_[_0x6fde('0x46')](_0x23096b[_0x6fde('0x41')],qs[_0x6fde('0x47')](_0x428676[_0x6fde('0x42')]['fields']));_0x47cdd3[_0x6fde('0x45')]=_0x47cdd3[_0x6fde('0x45')][_0x6fde('0x48')]?_0x47cdd3[_0x6fde('0x45')]:_0x23096b[_0x6fde('0x41')];if(!_0x428676[_0x6fde('0x42')][_0x6fde('0x49')](_0x6fde('0x4a'))){_0x47cdd3['limit']=qs[_0x6fde('0x22')](_0x428676['query'][_0x6fde('0x22')]);_0x47cdd3['offset']=qs[_0x6fde('0x1f')](_0x428676[_0x6fde('0x42')]['offset']);}_0x47cdd3[_0x6fde('0x4b')]=qs[_0x6fde('0x4c')](_0x428676[_0x6fde('0x42')][_0x6fde('0x4c')]);_0x47cdd3[_0x6fde('0x4d')]=qs[_0x6fde('0x44')](_['pick'](_0x428676['query'],_0x23096b[_0x6fde('0x44')]),_0x5bdc77);var _0x48e967=[];var _0x413b6e=squel[_0x6fde('0x4e')]()[_0x6fde('0x4f')]('id')[_0x6fde('0x4f')](_0x6fde('0x2f'))[_0x6fde('0x4f')](_0x6fde('0x50'))[_0x6fde('0x51')](_0x6fde('0x52'));var _0x5462db=squel[_0x6fde('0x4e')]()['field'](_0x6fde('0x53'))[_0x6fde('0x4f')](_0x6fde('0x54'))['field'](_0x6fde('0x55'))[_0x6fde('0x51')](_0x6fde('0x56'),'ui')['left_join'](_0x6fde('0x57'),'u',_0x6fde('0x58'));var _0x38dc8f=squel['select']()[_0x6fde('0x51')](_0x6fde('0x59'),'i')[_0x6fde('0x5a')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x6fde('0x57'),'o',_0x6fde('0x5b'))[_0x6fde('0x5a')]('fax_accounts','a',_0x6fde('0x5c'))[_0x6fde('0x5a')]('fax_messages','me',_0x6fde('0x5d'))['left_join'](_0x6fde('0x5e'),'it',_0x6fde('0x5f'))[_0x6fde('0x5a')](_0x6fde('0x52'),'t',_0x6fde('0x60'));var _0x4a96de=squel[_0x6fde('0x61')]();var _0x25ee6f=[];var _0xe545e4=squel['expr']();var _0x587e72;if(_0x428676['query'][_0x6fde('0x62')]){_0x587e72=as[_0x6fde('0x63')](_0x428676['query'][_0x6fde('0x62')]);var _0xa5176f=_0x587e72['sqlOperator'];for(var _0x436b2f=0x0;_0x436b2f<_0x587e72['conditions'][_0x6fde('0x48')];_0x436b2f++){var _0x178421=_0x587e72['conditions'][_0x436b2f];var _0x5a7062='i';var _0x5c1f55=_[_0x6fde('0x64')](_0x5bdc77,[_0x6fde('0x2f'),_0x178421['field']]);if(!_0x5c1f55){switch(_0x178421['field']){case'unreadMessages':if(_0x178421[_0x6fde('0x65')]==0x1){_0x38dc8f['having']('`'+_0x178421[_0x6fde('0x4f')]+_0x6fde('0x66'));}else{_0x38dc8f[_0x6fde('0x67')]('`'+_0x178421[_0x6fde('0x4f')]+'`\x20>\x200');}break;case'Contact':if(_0x178421['operator']==='$substring'){if(_0x178421[_0x6fde('0x65')][_0x6fde('0x39')]('\x20')[_0x6fde('0x48')]>0x1){_0x4a96de[_0xa5176f](_0x6fde('0x68'),qs[_0x6fde('0x69')](_0x178421[_0x6fde('0x65')]),null);}else{var _0x2ec3ed='%'+_0x178421['value']+'%';_0x4a96de[_0xa5176f](_0x6fde('0x6a'),_0x2ec3ed,_0x2ec3ed,_0x2ec3ed);}}else{_0x5c1f55=_['find'](_0x5bdc77,[_0x6fde('0x2f'),_0x6fde('0x6b')]);_0x178421['field']='ContactId';_0xcae091=as[_0x6fde('0x6c')](_0x5a7062,_0x5c1f55[_0x6fde('0x6d')],_0x178421);_0x4a96de[_0xa5176f](_0xcae091['text'],_0xcae091[_0x6fde('0x65')][_0x6fde('0x6e')],_0xcae091[_0x6fde('0x65')][_0x6fde('0x2c')]);}break;case _0x6fde('0x6f'):var _0x20161d=_0x178421['value'][_0x6fde('0x39')](',')[_0x6fde('0x3d')](function(_0x50ae47){return Number(_0x50ae47);});_0x20161d[_0x6fde('0x70')](function(_0x49c558){_0xe545e4['or'](_0x6fde('0x71'),'%,'+_0x49c558+',%');});_0x25ee6f=_[_0x6fde('0x72')](_0x25ee6f,_0x20161d);break;case _0x6fde('0x73'):if(_0x178421[_0x6fde('0x74')]===_0x6fde('0x75')){_0x4a96de[_0xa5176f](_0x6fde('0x76'),'%'+_0x178421['value']+'%',null);}else{_0x5c1f55=_[_0x6fde('0x64')](_0x5bdc77,[_0x6fde('0x2f'),'UserId']);_0x178421[_0x6fde('0x4f')]=_0x6fde('0x77');_0xcae091=as['buildExpression'](_0x5a7062,_0x5c1f55[_0x6fde('0x6d')],_0x178421);_0x4a96de[_0xa5176f](_0xcae091[_0x6fde('0x78')],_0xcae091[_0x6fde('0x65')][_0x6fde('0x6e')],_0xcae091[_0x6fde('0x65')][_0x6fde('0x2c')]);}break;case _0x6fde('0x31'):_0xcae091=as[_0x6fde('0x6c')]('me',null,_0x178421);_0x4a96de[_0xa5176f](_0xcae091[_0x6fde('0x78')],_0xcae091[_0x6fde('0x65')][_0x6fde('0x6e')],_0xcae091[_0x6fde('0x65')][_0x6fde('0x2c')]);break;}}else{var _0xcae091=as['buildExpression'](_0x5a7062,_0x5c1f55[_0x6fde('0x6d')],_0x178421);_0x4a96de[_0xa5176f](_0xcae091[_0x6fde('0x78')],_0xcae091[_0x6fde('0x65')][_0x6fde('0x6e')],_0xcae091[_0x6fde('0x65')][_0x6fde('0x2c')]);}}}else{var _0x565d06=_(_0x428676[_0x6fde('0x42')])['keys']()[_0x6fde('0x3d')](function(_0x20e441){return _[_0x6fde('0x79')](_0x5bdc77,[_0x6fde('0x2f'),_0x20e441])?_0x20e441:undefined;})[_0x6fde('0x7a')]()[_0x6fde('0x65')]();if(!_[_0x6fde('0x7b')](_0x565d06)){_0x565d06[_0x6fde('0x70')](function(_0x299780){if(_0x299780==='FaxAccountId'){_0x38dc8f[_0x6fde('0x4d')](_0x6fde('0x7c'),[][_0x6fde('0x7d')](_0x428676[_0x6fde('0x42')][_0x299780]));}else if(_0x299780===_0x6fde('0x7e')){var _0x5d732b=JSON['parse'](_0x428676[_0x6fde('0x42')][_0x299780])['$gte'];var _0x35fcc7=JSON[_0x6fde('0x7f')](_0x428676[_0x6fde('0x42')][_0x299780])[_0x6fde('0x80')];_0x38dc8f[_0x6fde('0x4d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5d732b,_0x35fcc7);}else{if(_0x428676[_0x6fde('0x42')][_0x299780]===_0x6fde('0x81')){_0x38dc8f[_0x6fde('0x4d')]('i.'+_0x299780+_0x6fde('0x82'));}else{_0x38dc8f[_0x6fde('0x4d')]('i.'+_0x299780+'\x20=\x20?',_0x428676[_0x6fde('0x42')][_0x299780]);}}});}if(_0x428676[_0x6fde('0x42')]['read']){if(_0x428676[_0x6fde('0x42')][_0x6fde('0x83')]==0x1){_0x38dc8f[_0x6fde('0x67')]('`unreadMessages`\x20=\x200');}else{_0x38dc8f[_0x6fde('0x67')](_0x6fde('0x84'));}}if(_0x428676[_0x6fde('0x42')]['tag']){_0x25ee6f=_[_0x6fde('0x85')](_0x428676[_0x6fde('0x42')][_0x6fde('0x86')])?_0x428676[_0x6fde('0x42')][_0x6fde('0x86')]:new Array(_0x428676['query'][_0x6fde('0x86')]);_0x25ee6f[_0x6fde('0x70')](function(_0x2b4103){_0xe545e4['or'](_0x6fde('0x71'),'%,'+_0x2b4103+',%');});}if(_0x428676[_0x6fde('0x42')][_0x6fde('0x87')]){var _0x33d7d6=_0x428676[_0x6fde('0x42')][_0x6fde('0x87')]['replace']('\x5c','\x5c\x5c')[_0x6fde('0x88')](/'/g,'\x27\x27');if(qs[_0x6fde('0x89')](_0x33d7d6)){_0x4a96de['or'](_0x6fde('0x8a'),_0x33d7d6+'%')['or'](_0x6fde('0x8b'),_0x33d7d6+'%');}_0x4a96de['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x33d7d6+'%');}}_0x38dc8f[_0x6fde('0x4d')](_0x4a96de);_0x38dc8f[_0x6fde('0x8c')](_0x6fde('0x8d'));var _0x128576={'type':db[_0x6fde('0x8e')][_0x6fde('0x8f')][_0x6fde('0x90')],'raw':!![]};var _0x27d70d=_0x38dc8f[_0x6fde('0x91')]();_0x27d70d['field'](_0x6fde('0x8d'));_0x27d70d['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6fde('0x92'));if(_0x47cdd3['order']){_0x47cdd3['order'][_0x6fde('0x70')](function(_0x3aa582){var _0x3b81e4=_0x3aa582[0x0]===_0x6fde('0x93')?_0x3aa582[0x0]:'i.'+_0x3aa582[0x0];_0x38dc8f[_0x6fde('0x4b')](_0x3b81e4,_0x3aa582[0x1]===_0x6fde('0x94')?![]:!![]);});}if(!_['isEmpty'](_0x25ee6f)){_0x38dc8f[_0x6fde('0x67')](_0xe545e4);_0x27d70d[_0x6fde('0x4d')](_0x6fde('0x95'),_0x25ee6f);}BPromise[_0x6fde('0x96')]()[_0x6fde('0x2a')](function(){if(!_0x587e72){if(_0x428676[_0x6fde('0x42')][_0x6fde('0x97')])return;_0x27d70d['where'](_0x6fde('0x98'));_0x38dc8f['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x428676[_0x6fde('0x99')]['role']!=='agent')return;return _0x428676['user']['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x6fde('0x2a')](function(_0x4cdf73){if(_['isEmpty'](_0x4cdf73)){_0x27d70d[_0x6fde('0x4d')]('i.FaxAccountId\x20IS\x20NULL');_0x38dc8f[_0x6fde('0x4d')](_0x6fde('0x9a'));}else{_0x27d70d[_0x6fde('0x4d')]('i.FaxAccountId\x20IN\x20?',_[_0x6fde('0x3d')](_0x4cdf73,'id'));_0x38dc8f[_0x6fde('0x4d')](_0x6fde('0x7c'),_[_0x6fde('0x3d')](_0x4cdf73,'id'));}});})[_0x6fde('0x2a')](function(){if(_0x428676[_0x6fde('0x99')][_0x6fde('0x9b')]==='agent'&&!_0x587e72&&!_0x428676[_0x6fde('0x42')][_0x6fde('0x97')])return[];return db[_0x6fde('0x9c')]['query'](_0x27d70d[_0x6fde('0x9d')](),_0x128576);})[_0x6fde('0x2a')](function(_0x2e9a92){_0x285a4a[_0x6fde('0x21')]=_0x2e9a92[_0x6fde('0x48')];if(_0x285a4a[_0x6fde('0x21')]===0x0)return[];return db[_0x6fde('0x9c')]['query'](_0x413b6e[_0x6fde('0x9d')](),_0x128576)[_0x6fde('0x2a')](function(_0x2cee34){_0x48e967=_[_0x6fde('0x9e')](_0x2cee34,'id');_0x128576=_[_0x6fde('0x30')](_0x128576,{'model':db[_0x6fde('0x9f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x428676['query'][_0x6fde('0x47')]){_0x47cdd3[_0x6fde('0x45')]['forEach'](function(_0x160610){_0x38dc8f[_0x6fde('0x4f')]('i.'+_0x160610);});}else{_0x38dc8f['field'](_0x6fde('0xa0'),_0x6fde('0x92'));_0x38dc8f[_0x6fde('0x4f')](_0x6fde('0xa1'),'Account.key');_0x38dc8f[_0x6fde('0x4f')](_0x6fde('0xa2'),_0x6fde('0xa3'));_0x38dc8f[_0x6fde('0x4f')](_0x6fde('0xa4'),_0x6fde('0x93'));_0x38dc8f[_0x6fde('0x4f')](_0x6fde('0xa5'));_0x38dc8f[_0x6fde('0x4f')]('c.firstName','Contact.firstName');_0x38dc8f[_0x6fde('0x4f')]('c.lastName',_0x6fde('0xa6'));_0x38dc8f['field'](_0x6fde('0xa7'),'Contact.email');_0x38dc8f[_0x6fde('0x4f')](_0x6fde('0xa8'),'Contact.phone');_0x38dc8f[_0x6fde('0x4f')]('c.mobile',_0x6fde('0xa9'));_0x38dc8f['field'](_0x6fde('0xaa'),_0x6fde('0xab'));_0x38dc8f[_0x6fde('0x4f')](_0x6fde('0xac'),_0x6fde('0xad'));_0x38dc8f[_0x6fde('0x4f')](_0x6fde('0xae'),'Owner.internal');_0x38dc8f[_0x6fde('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x6fde('0x38'));}if(_0x47cdd3[_0x6fde('0x22')])_0x38dc8f[_0x6fde('0x22')](_0x47cdd3[_0x6fde('0x22')]);if(_0x47cdd3['offset'])_0x38dc8f[_0x6fde('0x1f')](_0x47cdd3[_0x6fde('0x1f')]);return db['sequelize']['query'](_0x38dc8f[_0x6fde('0x9d')](),_0x128576);})[_0x6fde('0x2a')](function(_0x7814be){if(_0x7814be[_0x6fde('0x48')]>0x0)_0x5462db['where'](_0x6fde('0xaf'),_[_0x6fde('0x3d')](_0x7814be,'id'));return db[_0x6fde('0x9c')]['query'](_0x5462db[_0x6fde('0x9d')](),_0x128576)[_0x6fde('0x2a')](function(_0x5e32f8){var _0x24925f=_[_0x6fde('0xb0')](_0x5e32f8,_0x6fde('0xb1'));var _0x327b44=[];_0x7814be[_0x6fde('0x70')](function(_0x2bd3cb){_0x327b44[_0x6fde('0x3a')](updateFaxInteraction(_0x2bd3cb,_0x48e967,_0x24925f));});return BPromise[_0x6fde('0xb2')](_0x327b44);});});})[_0x6fde('0x2a')](function(_0x35984c){_0x285a4a['rows']=_0x35984c;return _0x285a4a;})[_0x6fde('0x2a')](respondWithFilteredResult(_0x4f1f78,_0x47cdd3))[_0x6fde('0x3b')](handleError(_0x4f1f78,null));};exports['show']=function(_0x1ac0cd,_0x527525){var _0x44a47b={'raw':![],'where':{'id':_0x1ac0cd[_0x6fde('0xb3')]['id']}},_0x20e7d4={};_0x20e7d4[_0x6fde('0x41')]=_[_0x6fde('0x43')](db[_0x6fde('0x9f')][_0x6fde('0x3e')]);_0x20e7d4[_0x6fde('0x42')]=_[_0x6fde('0x43')](_0x1ac0cd[_0x6fde('0x42')]);_0x20e7d4['filters']=_[_0x6fde('0x46')](_0x20e7d4['model'],_0x20e7d4[_0x6fde('0x42')]);_0x44a47b[_0x6fde('0x45')]=_[_0x6fde('0x46')](_0x20e7d4[_0x6fde('0x41')],qs['fields'](_0x1ac0cd['query'][_0x6fde('0x47')]));_0x44a47b[_0x6fde('0x45')]=_0x44a47b[_0x6fde('0x45')][_0x6fde('0x48')]?_0x44a47b['attributes']:_0x20e7d4[_0x6fde('0x41')];if(_0x1ac0cd[_0x6fde('0x42')][_0x6fde('0xb4')]){_0x44a47b[_0x6fde('0xb5')]=[{'all':!![]}];}_0x44a47b=_[_0x6fde('0x30')]({},_0x44a47b,_0x1ac0cd['options']);return db['FaxInteraction']['find'](_0x44a47b)[_0x6fde('0x2a')](handleEntityNotFound(_0x527525,null))[_0x6fde('0x2a')](respondWithResult(_0x527525,null))[_0x6fde('0x3b')](handleError(_0x527525,null));};exports['create']=function(_0x2d9d8f,_0x57f00e){return db['FaxInteraction'][_0x6fde('0xb6')](_0x2d9d8f[_0x6fde('0x31')],{})['then'](respondWithResult(_0x57f00e,0xc9))[_0x6fde('0x3b')](handleError(_0x57f00e,null));};exports[_0x6fde('0x29')]=function(_0xa14e4a,_0x5d7fda){if(_0xa14e4a['body']['id']){delete _0xa14e4a[_0x6fde('0x31')]['id'];}return db[_0x6fde('0x9f')][_0x6fde('0x64')]({'where':{'id':_0xa14e4a[_0x6fde('0xb3')]['id']}})[_0x6fde('0x2a')](handleEntityNotFound(_0x5d7fda,null))[_0x6fde('0x2a')](saveUpdates(_0xa14e4a[_0x6fde('0x31')],null))[_0x6fde('0x2a')](respondWithResult(_0x5d7fda,null))[_0x6fde('0x3b')](handleError(_0x5d7fda,null));};exports[_0x6fde('0x2b')]=function(_0x3b3517,_0x43371a){return db[_0x6fde('0x9f')][_0x6fde('0x64')]({'where':{'id':_0x3b3517[_0x6fde('0xb3')]['id']}})[_0x6fde('0x2a')](handleEntityNotFound(_0x43371a,null))[_0x6fde('0x2a')](removeEntity(_0x43371a,null))['catch'](handleError(_0x43371a,null));};exports[_0x6fde('0xb7')]=function(_0x26cd2b,_0x25d345){return db[_0x6fde('0x9f')][_0x6fde('0xb7')]()[_0x6fde('0x2a')](respondWithResult(_0x25d345,null))[_0x6fde('0x3b')](handleError(_0x25d345,null));};exports[_0x6fde('0xb8')]=function(_0x513a25,_0xe1602f,_0x42b0f1){return db[_0x6fde('0xb9')][_0x6fde('0x64')]({'where':{'id':_0x513a25[_0x6fde('0xb3')]['id']}})[_0x6fde('0x2a')](handleEntityNotFound(_0xe1602f,null))[_0x6fde('0x2a')](function(_0x9c4284){if(_0x9c4284){return _0x9c4284[_0x6fde('0xb8')](_0x513a25[_0x6fde('0x31')][_0x6fde('0xba')],_[_0x6fde('0xbb')](_0x513a25['body'],[_0x6fde('0xba'),'id'])||{});}})[_0x6fde('0x2a')](respondWithResult(_0xe1602f,null))['catch'](handleError(_0xe1602f,null));};exports['getMessages']=function(_0x361c27,_0x36c139,_0x4480e4){var _0x35513b={'raw':![],'where':{}};var _0x2e2d1a={};var _0x1ae9c4={'count':0x0,'rows':[]};return db[_0x6fde('0x9f')][_0x6fde('0xbc')]({'where':{'id':_0x361c27['params']['id']}})[_0x6fde('0x2a')](handleEntityNotFound(_0x36c139,null))[_0x6fde('0x2a')](function(_0x485c19){if(_0x485c19){_0x2e2d1a[_0x6fde('0x41')]=_[_0x6fde('0x43')](db[_0x6fde('0xb9')]['rawAttributes']);_0x2e2d1a['query']=_[_0x6fde('0x43')](_0x361c27['query']);_0x2e2d1a[_0x6fde('0x44')]=_[_0x6fde('0x46')](_0x2e2d1a[_0x6fde('0x41')],_0x2e2d1a[_0x6fde('0x42')]);_0x35513b['attributes']=_[_0x6fde('0x46')](_0x2e2d1a[_0x6fde('0x41')],qs['fields'](_0x361c27[_0x6fde('0x42')][_0x6fde('0x47')]));_0x35513b[_0x6fde('0x45')]=_0x35513b['attributes'][_0x6fde('0x48')]?_0x35513b[_0x6fde('0x45')]:_0x2e2d1a['model'];if(!_0x361c27[_0x6fde('0x42')][_0x6fde('0x49')](_0x6fde('0x4a'))){_0x35513b[_0x6fde('0x22')]=qs[_0x6fde('0x22')](_0x361c27['query'][_0x6fde('0x22')]);_0x35513b[_0x6fde('0x1f')]=qs['offset'](_0x361c27[_0x6fde('0x42')][_0x6fde('0x1f')]);}_0x35513b['order']=qs[_0x6fde('0x4c')](_0x361c27[_0x6fde('0x42')][_0x6fde('0x4c')]);_0x35513b[_0x6fde('0x4d')]=qs['filters'](_[_0x6fde('0xbd')](_0x361c27[_0x6fde('0x42')],_0x2e2d1a[_0x6fde('0x44')]));_0x35513b[_0x6fde('0x4d')]['FaxInteractionId']=_0x485c19['id'];if(_0x361c27[_0x6fde('0x42')][_0x6fde('0x87')]){_0x35513b[_0x6fde('0x4d')]=_[_0x6fde('0x30')](_0x35513b[_0x6fde('0x4d')],{'$or':_[_0x6fde('0x3d')](_0x35513b[_0x6fde('0x45')],function(_0x3956e1){var _0x4d6936={};_0x4d6936[_0x3956e1]={'$like':'%'+_0x361c27[_0x6fde('0x42')][_0x6fde('0x87')]+'%'};return _0x4d6936;})});}if(_0x361c27[_0x6fde('0x42')][_0x6fde('0xbe')]){var _0x1b5a3b=_0x361c27['query'][_0x6fde('0xbe')][_0x6fde('0x39')](',');var _0x15e8f0={};_0x15e8f0[_0x1b5a3b[0x0]]={'$gte':moment(_0x1b5a3b[0x1])[_0x6fde('0xbf')](_0x6fde('0xc0'))};_0x35513b[_0x6fde('0x4d')]=_[_0x6fde('0x30')](_0x35513b['where'],_0x15e8f0);}_0x35513b=_[_0x6fde('0x30')]({},_0x35513b,_0x361c27[_0x6fde('0xc1')]);return db['FaxMessage'][_0x6fde('0x21')]({'where':_0x35513b[_0x6fde('0x4d')]})[_0x6fde('0x2a')](function(_0x530ee5){_0x1ae9c4[_0x6fde('0x21')]=_0x530ee5;if(_0x361c27[_0x6fde('0x42')][_0x6fde('0xb4')]){_0x35513b['include']=[{'all':!![]}];}return db[_0x6fde('0xb9')]['findAll'](_0x35513b);})[_0x6fde('0x2a')](function(_0x2b4abd){_0x1ae9c4['rows']=_0x2b4abd;return _0x1ae9c4;});}})[_0x6fde('0x2a')](respondWithFilteredResult(_0x36c139,_0x35513b))['catch'](handleError(_0x36c139,null));};exports[_0x6fde('0xc2')]=function(_0x36a101,_0x4130c1,_0x5140ed){return db[_0x6fde('0x9f')]['find']({'where':{'id':_0x36a101[_0x6fde('0xb3')]['id']}})[_0x6fde('0x2a')](handleEntityNotFound(_0x4130c1,null))['then'](function(_0x3df6ce){if(_0x3df6ce){return _0x3df6ce[_0x6fde('0xc3')](_0x36a101[_0x6fde('0x31')][_0x6fde('0xba')],_['omit'](_0x36a101['body'],[_0x6fde('0xba'),'id'])||{})['spread'](function(){return db[_0x6fde('0x6f')]['findAll']({'attributes':['id',_0x6fde('0x2f'),_0x6fde('0x50')],'where':{'id':_0x36a101[_0x6fde('0x31')][_0x6fde('0xba')]}});})[_0x6fde('0x2a')](function(_0x59ee40){socket['emit'](_0x6fde('0xc4'),{'id':Number(_0x36a101[_0x6fde('0xb3')]['id']),'tags':_0x59ee40||[]});return{'id':Number(_0x36a101['params']['id']),'tags':_0x59ee40||[]};});}})['then'](respondWithResult(_0x4130c1,null))[_0x6fde('0x3b')](handleError(_0x4130c1,null));};exports[_0x6fde('0xc5')]=function(_0x35b1a4,_0x53ffed,_0x30f75){return db[_0x6fde('0x9f')][_0x6fde('0x64')]({'where':{'id':_0x35b1a4[_0x6fde('0xb3')]['id']}})[_0x6fde('0x2a')](handleEntityNotFound(_0x53ffed,null))[_0x6fde('0x2a')](function(_0x4dd2ed){if(_0x4dd2ed){return _0x4dd2ed['removeTags'](_0x35b1a4['query']['ids']);}})[_0x6fde('0x2a')](respondWithStatusCode(_0x53ffed,null))[_0x6fde('0x3b')](handleError(_0x53ffed,null));};exports[_0x6fde('0xc6')]=function(_0x140bc2,_0x3f37c8){var _0x2c17f6=moment()[_0x6fde('0xc7')]()[_0x6fde('0x9d')]();var _0x581877=path[_0x6fde('0xc8')](config['root'],_0x6fde('0xc9'),'files',_0x6fde('0xca'));var _0xa8cb0d=path[_0x6fde('0xc8')](config['root'],_0x6fde('0xc9'),_0x6fde('0xcb'),_0x6fde('0xcc'));var _0x5dbe2a=path[_0x6fde('0xc8')](_0x581877,_0x2c17f6);var _0x3ca7ff=util[_0x6fde('0xbf')](_0x6fde('0xcd'),_0x140bc2['params']['id'],_0x2c17f6);var _0x4bcf1e=path[_0x6fde('0xc8')](_0x581877,_0x3ca7ff);var _0x4a3dda=[];_0x4a3dda[_0x6fde('0x3a')]({'model':db['Attachment'],'as':_0x6fde('0xce'),'raw':!![]});var _0x41361=[{'model':db[_0x6fde('0xb9')],'as':'Messages','attributes':['id',_0x6fde('0x31'),_0x6fde('0x7e')],'include':_0x4a3dda}];return db[_0x6fde('0x9f')][_0x6fde('0x64')]({'where':{'id':_0x140bc2['params']['id']},'include':_0x41361})[_0x6fde('0x2a')](handleEntityNotFound(_0x3f37c8,null))[_0x6fde('0x2a')](function(_0x57bf32){if(_0x57bf32&&_0x57bf32[_0x6fde('0xcf')]){var _0x370282=_0x57bf32[_0x6fde('0xd0')]({'plain':!![]});fs[_0x6fde('0xd1')](_0x5dbe2a);for(var _0x36d63f=0x0;_0x36d63f<_0x370282[_0x6fde('0xcf')]['length'];_0x36d63f++){var _0x299e27=_0x370282['Messages'][_0x36d63f]['Attachment'];if(_0x299e27){var _0x572dd9=path['join'](_0xa8cb0d,_0x299e27['basename']);if(fs['existsSync'](_0x572dd9)){fs[_0x6fde('0xd2')](_0x572dd9)[_0x6fde('0xd3')](fs['createWriteStream'](path[_0x6fde('0xc8')](_0x5dbe2a,_0x299e27[_0x6fde('0xd4')])));}}}return BPromise[_0x6fde('0x96')]()[_0x6fde('0x2a')](function(){return new BPromise(function(_0x25adeb,_0x4bf3f8){zipdir(_0x5dbe2a,{'saveTo':_0x4bcf1e},function(_0x24e6f5,_0x398235){if(_0x24e6f5)return _0x4bf3f8(_0x24e6f5);return _0x25adeb(_0x398235);});})[_0x6fde('0x2a')](function(){return new BPromise(function(_0x5f1334,_0x2e47fc){rimraf(_0x5dbe2a,function(_0x2c9662){if(_0x2c9662)_0x2e47fc(_0x2c9662);return _0x5f1334();});});})['then'](function(){return _0x3f37c8['download'](_0x4bcf1e,_0x3ca7ff,function(_0x4503a6){if(_0x4503a6){console[_0x6fde('0xd5')](_0x6fde('0xd6'),_0x4503a6);}else{fs[_0x6fde('0xd7')](_0x4bcf1e);}});});});}else{return _0x3f37c8[_0x6fde('0xd8')](0xc8);}})['catch'](handleError(_0x3f37c8,null));}; \ No newline at end of file +var _0xa91d=['\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','isEmpty','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','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.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','params','includeAll','include','options','create','describe','FaxMessage','omit','ids','getMessages','findOne','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','emit','removeTags','unix','root','server','files','tmp','attachments','join','format','push','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','download','log','err','unlinkSync','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','render','merge','body','contact','message','agent','account','map','fullname','TagIds','Tags','split','forEach','catch','FaxInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','select','field','color','from','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','left_join','fax_accounts','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','ContactId','buildExpression','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','keys','some','compact','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL'];(function(_0x27c87a,_0x22a763){var _0x979632=function(_0x101c1c){while(--_0x101c1c){_0x27c87a['push'](_0x27c87a['shift']());}};_0x979632(++_0x22a763);}(_0xa91d,0x134));var _0xda91=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa91d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xda91('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda91('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda91('0x2'));var moment=require(_0xda91('0x3'));var BPromise=require(_0xda91('0x4'));var Mustache=require(_0xda91('0x5'));var util=require(_0xda91('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda91('0x7'));var _=require(_0xda91('0x8'));var squel=require(_0xda91('0x9'));var crypto=require(_0xda91('0xa'));var jsforce=require(_0xda91('0xb'));var deskjs=require(_0xda91('0xc'));var toCsv=require(_0xda91('0xd'));var querystring=require(_0xda91('0xe'));var Papa=require(_0xda91('0xf'));var Redis=require(_0xda91('0x10'));var authService=require(_0xda91('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xda91('0x12'));var hardwareService=require(_0xda91('0x13'));var logger=require(_0xda91('0x14'))('api');var utils=require(_0xda91('0x15'));var config=require(_0xda91('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xda91('0x17'))['db'];config[_0xda91('0x18')]=_[_0xda91('0x19')](config[_0xda91('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xda91('0x1a'))(new Redis(config[_0xda91('0x18')]));require(_0xda91('0x1b'))['register'](socket);function respondWithStatusCode(_0x5b3694,_0x4582ce){_0x4582ce=_0x4582ce||0xcc;return function(_0x590497){if(_0x590497){return _0x5b3694[_0xda91('0x1c')](_0x4582ce);}return _0x5b3694[_0xda91('0x1d')](_0x4582ce)[_0xda91('0x1e')]();};}function respondWithResult(_0x4cd17b,_0x48f5cc){_0x48f5cc=_0x48f5cc||0xc8;return function(_0x12a804){if(_0x12a804){return _0x4cd17b[_0xda91('0x1d')](_0x48f5cc)['json'](_0x12a804);}};}function respondWithFilteredResult(_0x5e6332,_0x5d4104){return function(_0x49e8c1){if(_0x49e8c1){var _0x2015b3=typeof _0x5d4104[_0xda91('0x1f')]===_0xda91('0x20')&&typeof _0x5d4104[_0xda91('0x21')]===_0xda91('0x20');var _0x576195=_0x49e8c1['count'];var _0x5c7d98=_0x2015b3?0x0:_0x5d4104[_0xda91('0x1f')];var _0x4699bf=_0x2015b3?_0x49e8c1[_0xda91('0x22')]:_0x5d4104['offset']+_0x5d4104[_0xda91('0x21')];var _0x24cd57;if(_0x4699bf>=_0x576195){_0x4699bf=_0x576195;_0x24cd57=0xc8;}else{_0x24cd57=0xce;}_0x5e6332['status'](_0x24cd57);return _0x5e6332['set'](_0xda91('0x23'),_0x5c7d98+'-'+_0x4699bf+'/'+_0x576195)[_0xda91('0x24')](_0x49e8c1);}return null;};}function patchUpdates(_0x4d4643){return function(_0x1d6d43){try{jsonpatch[_0xda91('0x25')](_0x1d6d43,_0x4d4643,!![]);}catch(_0x3ce572){return BPromise['reject'](_0x3ce572);}return _0x1d6d43[_0xda91('0x26')]();};}function saveUpdates(_0x553f56,_0x1760b3){return function(_0x5b6edd){if(_0x5b6edd){return _0x5b6edd[_0xda91('0x27')](_0x553f56)[_0xda91('0x28')](function(_0x25af0f){return _0x25af0f;});}return null;};}function removeEntity(_0x2b8e28,_0x203aa8){return function(_0x289983){if(_0x289983){return _0x289983[_0xda91('0x29')]()[_0xda91('0x28')](function(){_0x2b8e28[_0xda91('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a915,_0xe36e9c){return function(_0x137adb){if(!_0x137adb){_0x42a915['sendStatus'](0x194);}return _0x137adb;};}function handleError(_0x3194ae,_0x2b0c25){_0x2b0c25=_0x2b0c25||0x1f4;return function(_0x7d257f){logger[_0xda91('0x2a')](_0x7d257f[_0xda91('0x2b')]);if(_0x7d257f['name']){delete _0x7d257f[_0xda91('0x2c')];}_0x3194ae['status'](_0x2b0c25)[_0xda91('0x2d')](_0x7d257f);};}function getMustacheRender(_0x5b59a0,_0x828961){return Mustache[_0xda91('0x2e')](_0x5b59a0,_[_0xda91('0x2f')](_0x828961[_0xda91('0x30')],{'contact':_0x828961[_0xda91('0x31')],'message':_0x828961[_0xda91('0x32')],'agent':_0x828961[_0xda91('0x33')],'interaction':_0x828961['interaction'],'account':_0x828961[_0xda91('0x34')]}))||'';}function getInteractionUsers(_0x4818b3,_0x11796a){return new BPromise(function(_0x40fd6d,_0x4df6c9){try{if(_0x11796a[_0x4818b3['id']]){_0x4818b3['Users']=_[_0xda91('0x35')](_0x11796a[_0x4818b3['id']],function(_0x334558){return{'id':_0x334558['id'],'fullname':_0x334558[_0xda91('0x36')]};});}}catch(_0x3e6e9d){_0x4df6c9(_0x3e6e9d);}_0x40fd6d(_0x4818b3);});}function getInteractionTags(_0x57ce28,_0x37d857){return new BPromise(function(_0xaf14fe,_0x24a6d4){try{if(_0x57ce28[_0xda91('0x37')]){_0x57ce28[_0xda91('0x38')]=[];_0x57ce28['TagIds'][_0xda91('0x39')](',')[_0xda91('0x3a')](function(_0x40ca9d){_0x57ce28['Tags']['push'](_0x37d857[_0x40ca9d]);});}delete _0x57ce28['TagIds'];}catch(_0x442487){_0x24a6d4(_0x442487);}_0xaf14fe(_0x57ce28);});}function updateFaxInteraction(_0x4c0a2c,_0x11fdf8,_0x299b02){return new BPromise(function(_0x2325a3,_0x16cc6a){return getInteractionUsers(_0x4c0a2c,_0x299b02)[_0xda91('0x28')](function(_0x252c7c){return getInteractionTags(_0x252c7c,_0x11fdf8);})[_0xda91('0x28')](function(_0x58ac98){_0x2325a3(_0x58ac98);})[_0xda91('0x3b')](function(_0x23369f){_0x16cc6a(_0x23369f);});});}exports['index']=function(_0x31390b,_0x46c456){var _0x30d523={},_0x3d2346={},_0x4b0a19={'count':0x0,'rows':[]};var _0x81e6a5=_[_0xda91('0x35')](db[_0xda91('0x3c')][_0xda91('0x3d')],function(_0x3f6d93){return{'name':_0x3f6d93[_0xda91('0x3e')],'type':_0x3f6d93[_0xda91('0x3f')][_0xda91('0x40')]};});_0x3d2346[_0xda91('0x41')]=_[_0xda91('0x35')](_0x81e6a5,_0xda91('0x2c'));_0x3d2346[_0xda91('0x42')]=_['keys'](_0x31390b['query']);_0x3d2346[_0xda91('0x43')]=_[_0xda91('0x44')](_0x3d2346[_0xda91('0x41')],_0x3d2346[_0xda91('0x42')]);_0x30d523[_0xda91('0x45')]=_[_0xda91('0x44')](_0x3d2346['model'],qs[_0xda91('0x46')](_0x31390b[_0xda91('0x42')][_0xda91('0x46')]));_0x30d523['attributes']=_0x30d523[_0xda91('0x45')]['length']?_0x30d523[_0xda91('0x45')]:_0x3d2346[_0xda91('0x41')];if(!_0x31390b[_0xda91('0x42')]['hasOwnProperty'](_0xda91('0x47'))){_0x30d523[_0xda91('0x21')]=qs[_0xda91('0x21')](_0x31390b[_0xda91('0x42')][_0xda91('0x21')]);_0x30d523[_0xda91('0x1f')]=qs[_0xda91('0x1f')](_0x31390b[_0xda91('0x42')][_0xda91('0x1f')]);}_0x30d523['order']=qs[_0xda91('0x48')](_0x31390b['query']['sort']);_0x30d523[_0xda91('0x49')]=qs['filters'](_[_0xda91('0x4a')](_0x31390b[_0xda91('0x42')],_0x3d2346[_0xda91('0x43')]),_0x81e6a5);var _0x4b94e3=[];var _0x4b8e18=squel[_0xda91('0x4b')]()[_0xda91('0x4c')]('id')[_0xda91('0x4c')](_0xda91('0x2c'))[_0xda91('0x4c')](_0xda91('0x4d'))[_0xda91('0x4e')]('tools_tags');var _0x2f789d=squel[_0xda91('0x4b')]()[_0xda91('0x4c')]('u.id')[_0xda91('0x4c')](_0xda91('0x4f'))[_0xda91('0x4c')](_0xda91('0x50'))[_0xda91('0x4e')](_0xda91('0x51'),'ui')['left_join'](_0xda91('0x52'),'u',_0xda91('0x53'));var _0x51e0c3=squel[_0xda91('0x4b')]()['from'](_0xda91('0x54'),'i')['left_join']('cm_contacts','c',_0xda91('0x55'))['left_join']('users','o',_0xda91('0x56'))[_0xda91('0x57')](_0xda91('0x58'),'a','a.id\x20=\x20i.FaxAccountId')[_0xda91('0x57')]('fax_messages','me',_0xda91('0x59'))[_0xda91('0x57')](_0xda91('0x5a'),'it',_0xda91('0x5b'))[_0xda91('0x57')](_0xda91('0x5c'),'t',_0xda91('0x5d'));var _0x5ac32d=squel[_0xda91('0x5e')]();var _0x3196a8=[];var _0x3382b9=squel[_0xda91('0x5e')]();var _0x5ddf91;if(_0x31390b[_0xda91('0x42')]['search']){_0x5ddf91=as[_0xda91('0x5f')](_0x31390b[_0xda91('0x42')][_0xda91('0x60')]);var _0x3bf52c=_0x5ddf91[_0xda91('0x61')];for(var _0x2e073d=0x0;_0x2e073d<_0x5ddf91[_0xda91('0x62')][_0xda91('0x63')];_0x2e073d++){var _0x3edbe7=_0x5ddf91[_0xda91('0x62')][_0x2e073d];var _0xe5decf='i';var _0x49ada9=_[_0xda91('0x64')](_0x81e6a5,[_0xda91('0x2c'),_0x3edbe7['field']]);if(!_0x49ada9){switch(_0x3edbe7[_0xda91('0x4c')]){case _0xda91('0x65'):if(_0x3edbe7[_0xda91('0x66')]==0x1){_0x51e0c3[_0xda91('0x67')]('`'+_0x3edbe7[_0xda91('0x4c')]+'`\x20=\x200');}else{_0x51e0c3[_0xda91('0x67')]('`'+_0x3edbe7[_0xda91('0x4c')]+_0xda91('0x68'));}break;case _0xda91('0x69'):if(_0x3edbe7[_0xda91('0x6a')]===_0xda91('0x6b')){if(_0x3edbe7['value'][_0xda91('0x39')]('\x20')['length']>0x1){_0x5ac32d[_0x3bf52c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3edbe7[_0xda91('0x66')]),null);}else{var _0x26a8b1='%'+_0x3edbe7[_0xda91('0x66')]+'%';_0x5ac32d[_0x3bf52c]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26a8b1,_0x26a8b1,_0x26a8b1);}}else{_0x49ada9=_[_0xda91('0x64')](_0x81e6a5,[_0xda91('0x2c'),'ContactId']);_0x3edbe7[_0xda91('0x4c')]=_0xda91('0x6c');_0x5717e6=as[_0xda91('0x6d')](_0xe5decf,_0x49ada9[_0xda91('0x3f')],_0x3edbe7);_0x5ac32d[_0x3bf52c](_0x5717e6[_0xda91('0x6e')],_0x5717e6[_0xda91('0x66')][_0xda91('0x6f')],_0x5717e6[_0xda91('0x66')][_0xda91('0x1e')]);}break;case'Tag':var _0x23e6ee=_0x3edbe7[_0xda91('0x66')][_0xda91('0x39')](',')['map'](function(_0x43a74f){return Number(_0x43a74f);});_0x23e6ee[_0xda91('0x3a')](function(_0x10aade){_0x3382b9['or'](_0xda91('0x70'),'%,'+_0x10aade+',%');});_0x3196a8=_[_0xda91('0x71')](_0x3196a8,_0x23e6ee);break;case _0xda91('0x72'):if(_0x3edbe7[_0xda91('0x6a')]===_0xda91('0x6b')){_0x5ac32d[_0x3bf52c](_0xda91('0x73'),'%'+_0x3edbe7[_0xda91('0x66')]+'%',null);}else{_0x49ada9=_[_0xda91('0x64')](_0x81e6a5,['name',_0xda91('0x74')]);_0x3edbe7[_0xda91('0x4c')]='UserId';_0x5717e6=as['buildExpression'](_0xe5decf,_0x49ada9[_0xda91('0x3f')],_0x3edbe7);_0x5ac32d[_0x3bf52c](_0x5717e6[_0xda91('0x6e')],_0x5717e6[_0xda91('0x66')]['start'],_0x5717e6['value'][_0xda91('0x1e')]);}break;case'body':_0x5717e6=as[_0xda91('0x6d')]('me',null,_0x3edbe7);_0x5ac32d[_0x3bf52c](_0x5717e6['text'],_0x5717e6[_0xda91('0x66')][_0xda91('0x6f')],_0x5717e6[_0xda91('0x66')]['end']);break;}}else{var _0x5717e6=as[_0xda91('0x6d')](_0xe5decf,_0x49ada9[_0xda91('0x3f')],_0x3edbe7);_0x5ac32d[_0x3bf52c](_0x5717e6[_0xda91('0x6e')],_0x5717e6[_0xda91('0x66')][_0xda91('0x6f')],_0x5717e6[_0xda91('0x66')][_0xda91('0x1e')]);}}}else{var _0x177eb0=_(_0x31390b[_0xda91('0x42')])[_0xda91('0x75')]()[_0xda91('0x35')](function(_0x587e44){return _[_0xda91('0x76')](_0x81e6a5,[_0xda91('0x2c'),_0x587e44])?_0x587e44:undefined;})[_0xda91('0x77')]()[_0xda91('0x66')]();if(!_['isEmpty'](_0x177eb0)){_0x177eb0[_0xda91('0x3a')](function(_0x51d00b){if(_0x51d00b===_0xda91('0x78')){_0x51e0c3[_0xda91('0x49')](_0xda91('0x79'),[][_0xda91('0x7a')](_0x31390b[_0xda91('0x42')][_0x51d00b]));}else if(_0x51d00b===_0xda91('0x7b')){var _0xaf2ea5=JSON[_0xda91('0x7c')](_0x31390b[_0xda91('0x42')][_0x51d00b])[_0xda91('0x7d')];var _0x44aa73=JSON[_0xda91('0x7c')](_0x31390b[_0xda91('0x42')][_0x51d00b])[_0xda91('0x7e')];_0x51e0c3[_0xda91('0x49')](_0xda91('0x7f'),_0xaf2ea5,_0x44aa73);}else{if(_0x31390b[_0xda91('0x42')][_0x51d00b]===_0xda91('0x80')){_0x51e0c3[_0xda91('0x49')]('i.'+_0x51d00b+_0xda91('0x81'));}else{_0x51e0c3[_0xda91('0x49')]('i.'+_0x51d00b+_0xda91('0x82'),_0x31390b['query'][_0x51d00b]);}}});}if(_0x31390b['query'][_0xda91('0x83')]){if(_0x31390b[_0xda91('0x42')]['read']==0x1){_0x51e0c3[_0xda91('0x67')]('`unreadMessages`\x20=\x200');}else{_0x51e0c3['having'](_0xda91('0x84'));}}if(_0x31390b[_0xda91('0x42')][_0xda91('0x85')]){_0x3196a8=_['isArray'](_0x31390b[_0xda91('0x42')]['tag'])?_0x31390b[_0xda91('0x42')]['tag']:new Array(_0x31390b[_0xda91('0x42')][_0xda91('0x85')]);_0x3196a8[_0xda91('0x3a')](function(_0x28d328){_0x3382b9['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x28d328+',%');});}if(_0x31390b[_0xda91('0x42')][_0xda91('0x86')]){var _0x49ab6e=_0x31390b[_0xda91('0x42')][_0xda91('0x86')][_0xda91('0x87')]('\x5c','\x5c\x5c')[_0xda91('0x87')](/'/g,'\x27\x27');if(qs[_0xda91('0x88')](_0x49ab6e)){_0x5ac32d['or'](_0xda91('0x89'),_0x49ab6e+'%')['or'](_0xda91('0x8a'),_0x49ab6e+'%');}_0x5ac32d['or'](_0xda91('0x8b'),_0x49ab6e+'%');}}_0x51e0c3[_0xda91('0x49')](_0x5ac32d);_0x51e0c3[_0xda91('0x8c')](_0xda91('0x8d'));var _0x21f0b4={'type':db['Sequelize'][_0xda91('0x8e')]['SELECT'],'raw':!![]};var _0x695bce=_0x51e0c3[_0xda91('0x8f')]();_0x695bce[_0xda91('0x4c')](_0xda91('0x8d'));_0x695bce[_0xda91('0x4c')](_0xda91('0x90'),'unreadMessages');if(_0x30d523[_0xda91('0x91')]){_0x30d523[_0xda91('0x91')]['forEach'](function(_0x237eeb){var _0x3e9e0a=_0x237eeb[0x0]==='contactName'?_0x237eeb[0x0]:'i.'+_0x237eeb[0x0];_0x51e0c3[_0xda91('0x91')](_0x3e9e0a,_0x237eeb[0x1]===_0xda91('0x92')?![]:!![]);});}if(!_[_0xda91('0x93')](_0x3196a8)){_0x51e0c3[_0xda91('0x67')](_0x3382b9);_0x695bce[_0xda91('0x49')]('t.id\x20IN\x20?',_0x3196a8);}BPromise[_0xda91('0x94')]()[_0xda91('0x28')](function(){if(!_0x5ddf91){if(_0x31390b['query'][_0xda91('0x78')])return;_0x695bce[_0xda91('0x49')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x51e0c3[_0xda91('0x49')](_0xda91('0x95'));return;}if(_0x31390b[_0xda91('0x96')][_0xda91('0x97')]!==_0xda91('0x33'))return;return _0x31390b[_0xda91('0x96')][_0xda91('0x98')]({'attributes':['id'],'raw':!![]})[_0xda91('0x28')](function(_0x2f0c5a){if(_['isEmpty'](_0x2f0c5a)){_0x695bce[_0xda91('0x49')](_0xda91('0x99'));_0x51e0c3[_0xda91('0x49')](_0xda91('0x99'));}else{_0x695bce[_0xda91('0x49')](_0xda91('0x79'),_[_0xda91('0x35')](_0x2f0c5a,'id'));_0x51e0c3['where'](_0xda91('0x79'),_['map'](_0x2f0c5a,'id'));}});})['then'](function(){if(_0x31390b[_0xda91('0x96')][_0xda91('0x97')]===_0xda91('0x33')&&!_0x5ddf91&&!_0x31390b['query'][_0xda91('0x78')])return[];return db['sequelize'][_0xda91('0x42')](_0x695bce[_0xda91('0x9a')](),_0x21f0b4);})[_0xda91('0x28')](function(_0x1ac1e6){_0x4b0a19['count']=_0x1ac1e6[_0xda91('0x63')];if(_0x4b0a19[_0xda91('0x22')]===0x0)return[];return db[_0xda91('0x9b')][_0xda91('0x42')](_0x4b8e18[_0xda91('0x9a')](),_0x21f0b4)[_0xda91('0x28')](function(_0xe6dd02){_0x4b94e3=_['keyBy'](_0xe6dd02,'id');_0x21f0b4=_[_0xda91('0x2f')](_0x21f0b4,{'model':db[_0xda91('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x31390b[_0xda91('0x42')][_0xda91('0x46')]){_0x30d523['attributes'][_0xda91('0x3a')](function(_0x33c3c0){_0x51e0c3[_0xda91('0x4c')]('i.'+_0x33c3c0);});}else{_0x51e0c3[_0xda91('0x4c')](_0xda91('0x90'),_0xda91('0x65'));_0x51e0c3['field']('a.key','Account.key');_0x51e0c3['field']('a.mandatoryDisposition',_0xda91('0x9c'));_0x51e0c3[_0xda91('0x4c')](_0xda91('0x9d'),'contactName');_0x51e0c3[_0xda91('0x4c')](_0xda91('0x9e'));_0x51e0c3[_0xda91('0x4c')](_0xda91('0x9f'),'Contact.firstName');_0x51e0c3[_0xda91('0x4c')]('c.lastName',_0xda91('0xa0'));_0x51e0c3['field'](_0xda91('0xa1'),_0xda91('0xa2'));_0x51e0c3[_0xda91('0x4c')](_0xda91('0xa3'),_0xda91('0xa4'));_0x51e0c3[_0xda91('0x4c')](_0xda91('0xa5'),_0xda91('0xa6'));_0x51e0c3[_0xda91('0x4c')](_0xda91('0xa7'),_0xda91('0xa8'));_0x51e0c3[_0xda91('0x4c')]('o.fullname','Owner.fullname');_0x51e0c3[_0xda91('0x4c')](_0xda91('0xa9'),_0xda91('0xaa'));_0x51e0c3[_0xda91('0x4c')](_0xda91('0xab'),_0xda91('0x37'));}if(_0x30d523[_0xda91('0x21')])_0x51e0c3['limit'](_0x30d523[_0xda91('0x21')]);if(_0x30d523[_0xda91('0x1f')])_0x51e0c3[_0xda91('0x1f')](_0x30d523[_0xda91('0x1f')]);return db[_0xda91('0x9b')][_0xda91('0x42')](_0x51e0c3[_0xda91('0x9a')](),_0x21f0b4);})['then'](function(_0x57f278){if(_0x57f278['length']>0x0)_0x2f789d[_0xda91('0x49')](_0xda91('0xac'),_[_0xda91('0x35')](_0x57f278,'id'));return db['sequelize'][_0xda91('0x42')](_0x2f789d['toString'](),_0x21f0b4)['then'](function(_0x3b8e9d){var _0x5cf8b9=_[_0xda91('0xad')](_0x3b8e9d,_0xda91('0xae'));var _0x1fef18=[];_0x57f278[_0xda91('0x3a')](function(_0x6435b2){_0x1fef18['push'](updateFaxInteraction(_0x6435b2,_0x4b94e3,_0x5cf8b9));});return BPromise[_0xda91('0xaf')](_0x1fef18);});});})[_0xda91('0x28')](function(_0x1779bd){_0x4b0a19['rows']=_0x1779bd;return _0x4b0a19;})['then'](respondWithFilteredResult(_0x46c456,_0x30d523))[_0xda91('0x3b')](handleError(_0x46c456,null));};exports[_0xda91('0xb0')]=function(_0x573809,_0x5592d0){var _0x3e4aa0={'raw':![],'where':{'id':_0x573809[_0xda91('0xb1')]['id']}},_0x588b11={};_0x588b11[_0xda91('0x41')]=_[_0xda91('0x75')](db[_0xda91('0x3c')][_0xda91('0x3d')]);_0x588b11['query']=_[_0xda91('0x75')](_0x573809['query']);_0x588b11['filters']=_['intersection'](_0x588b11[_0xda91('0x41')],_0x588b11['query']);_0x3e4aa0['attributes']=_[_0xda91('0x44')](_0x588b11[_0xda91('0x41')],qs['fields'](_0x573809[_0xda91('0x42')][_0xda91('0x46')]));_0x3e4aa0[_0xda91('0x45')]=_0x3e4aa0[_0xda91('0x45')][_0xda91('0x63')]?_0x3e4aa0['attributes']:_0x588b11[_0xda91('0x41')];if(_0x573809[_0xda91('0x42')][_0xda91('0xb2')]){_0x3e4aa0[_0xda91('0xb3')]=[{'all':!![]}];}_0x3e4aa0=_[_0xda91('0x2f')]({},_0x3e4aa0,_0x573809[_0xda91('0xb4')]);return db[_0xda91('0x3c')][_0xda91('0x64')](_0x3e4aa0)[_0xda91('0x28')](handleEntityNotFound(_0x5592d0,null))[_0xda91('0x28')](respondWithResult(_0x5592d0,null))[_0xda91('0x3b')](handleError(_0x5592d0,null));};exports[_0xda91('0xb5')]=function(_0x4b4d9a,_0xee6674){return db['FaxInteraction'][_0xda91('0xb5')](_0x4b4d9a[_0xda91('0x30')],{})[_0xda91('0x28')](respondWithResult(_0xee6674,0xc9))['catch'](handleError(_0xee6674,null));};exports[_0xda91('0x27')]=function(_0x94304,_0x1fc676){if(_0x94304['body']['id']){delete _0x94304[_0xda91('0x30')]['id'];}return db[_0xda91('0x3c')][_0xda91('0x64')]({'where':{'id':_0x94304[_0xda91('0xb1')]['id']}})[_0xda91('0x28')](handleEntityNotFound(_0x1fc676,null))[_0xda91('0x28')](saveUpdates(_0x94304[_0xda91('0x30')],null))[_0xda91('0x28')](respondWithResult(_0x1fc676,null))[_0xda91('0x3b')](handleError(_0x1fc676,null));};exports[_0xda91('0x29')]=function(_0x3346d1,_0x1920f2){return db['FaxInteraction'][_0xda91('0x64')]({'where':{'id':_0x3346d1[_0xda91('0xb1')]['id']}})[_0xda91('0x28')](handleEntityNotFound(_0x1920f2,null))[_0xda91('0x28')](removeEntity(_0x1920f2,null))[_0xda91('0x3b')](handleError(_0x1920f2,null));};exports[_0xda91('0xb6')]=function(_0x3e5746,_0x195bfb){return db[_0xda91('0x3c')]['describe']()[_0xda91('0x28')](respondWithResult(_0x195bfb,null))['catch'](handleError(_0x195bfb,null));};exports['addMessage']=function(_0x23c25e,_0x1000cd,_0x42c7ee){return db[_0xda91('0xb7')][_0xda91('0x64')]({'where':{'id':_0x23c25e[_0xda91('0xb1')]['id']}})[_0xda91('0x28')](handleEntityNotFound(_0x1000cd,null))[_0xda91('0x28')](function(_0x330ab7){if(_0x330ab7){return _0x330ab7['addMessage'](_0x23c25e[_0xda91('0x30')]['ids'],_[_0xda91('0xb8')](_0x23c25e[_0xda91('0x30')],[_0xda91('0xb9'),'id'])||{});}})[_0xda91('0x28')](respondWithResult(_0x1000cd,null))[_0xda91('0x3b')](handleError(_0x1000cd,null));};exports[_0xda91('0xba')]=function(_0x19a86b,_0x5be6e1,_0xd377a0){var _0x477b3e={'raw':![],'where':{}};var _0x497f01={};var _0xbde48={'count':0x0,'rows':[]};return db[_0xda91('0x3c')][_0xda91('0xbb')]({'where':{'id':_0x19a86b['params']['id']}})[_0xda91('0x28')](handleEntityNotFound(_0x5be6e1,null))[_0xda91('0x28')](function(_0x45a292){if(_0x45a292){_0x497f01[_0xda91('0x41')]=_[_0xda91('0x75')](db[_0xda91('0xb7')][_0xda91('0x3d')]);_0x497f01[_0xda91('0x42')]=_[_0xda91('0x75')](_0x19a86b[_0xda91('0x42')]);_0x497f01[_0xda91('0x43')]=_['intersection'](_0x497f01[_0xda91('0x41')],_0x497f01['query']);_0x477b3e[_0xda91('0x45')]=_[_0xda91('0x44')](_0x497f01[_0xda91('0x41')],qs['fields'](_0x19a86b['query'][_0xda91('0x46')]));_0x477b3e['attributes']=_0x477b3e['attributes'][_0xda91('0x63')]?_0x477b3e[_0xda91('0x45')]:_0x497f01[_0xda91('0x41')];if(!_0x19a86b[_0xda91('0x42')][_0xda91('0xbc')](_0xda91('0x47'))){_0x477b3e[_0xda91('0x21')]=qs[_0xda91('0x21')](_0x19a86b[_0xda91('0x42')]['limit']);_0x477b3e[_0xda91('0x1f')]=qs[_0xda91('0x1f')](_0x19a86b[_0xda91('0x42')][_0xda91('0x1f')]);}_0x477b3e[_0xda91('0x91')]=qs[_0xda91('0x48')](_0x19a86b[_0xda91('0x42')][_0xda91('0x48')]);_0x477b3e['where']=qs[_0xda91('0x43')](_['pick'](_0x19a86b['query'],_0x497f01['filters']));_0x477b3e[_0xda91('0x49')][_0xda91('0xae')]=_0x45a292['id'];if(_0x19a86b[_0xda91('0x42')][_0xda91('0x86')]){_0x477b3e[_0xda91('0x49')]=_[_0xda91('0x2f')](_0x477b3e[_0xda91('0x49')],{'$or':_['map'](_0x477b3e['attributes'],function(_0x41d48a){var _0x31205a={};_0x31205a[_0x41d48a]={'$like':'%'+_0x19a86b['query']['filter']+'%'};return _0x31205a;})});}if(_0x19a86b['query']['$gte']){var _0x2a3268=_0x19a86b[_0xda91('0x42')]['$gte'][_0xda91('0x39')](',');var _0x2f5b37={};_0x2f5b37[_0x2a3268[0x0]]={'$gte':moment(_0x2a3268[0x1])['format'](_0xda91('0xbd'))};_0x477b3e['where']=_[_0xda91('0x2f')](_0x477b3e[_0xda91('0x49')],_0x2f5b37);}_0x477b3e=_[_0xda91('0x2f')]({},_0x477b3e,_0x19a86b[_0xda91('0xb4')]);return db[_0xda91('0xb7')]['count']({'where':_0x477b3e[_0xda91('0x49')]})[_0xda91('0x28')](function(_0x477307){_0xbde48[_0xda91('0x22')]=_0x477307;if(_0x19a86b[_0xda91('0x42')][_0xda91('0xb2')]){_0x477b3e['include']=[{'all':!![]}];}return db['FaxMessage'][_0xda91('0xbe')](_0x477b3e);})['then'](function(_0x2c2244){_0xbde48[_0xda91('0xbf')]=_0x2c2244;return _0xbde48;});}})[_0xda91('0x28')](respondWithFilteredResult(_0x5be6e1,_0x477b3e))[_0xda91('0x3b')](handleError(_0x5be6e1,null));};exports[_0xda91('0xc0')]=function(_0x3b7cef,_0x119fb6,_0x56a8f6){return db['FaxInteraction'][_0xda91('0x64')]({'where':{'id':_0x3b7cef[_0xda91('0xb1')]['id']}})[_0xda91('0x28')](handleEntityNotFound(_0x119fb6,null))['then'](function(_0x265a2e){if(_0x265a2e){return _0x265a2e[_0xda91('0xc1')](_0x3b7cef[_0xda91('0x30')]['ids'],_[_0xda91('0xb8')](_0x3b7cef['body'],[_0xda91('0xb9'),'id'])||{})[_0xda91('0xc2')](function(){return db['Tag'][_0xda91('0xbe')]({'attributes':['id','name','color'],'where':{'id':_0x3b7cef['body'][_0xda91('0xb9')]}});})['then'](function(_0x4a6ca0){socket[_0xda91('0xc3')]('faxInteractionTags:save',{'id':Number(_0x3b7cef[_0xda91('0xb1')]['id']),'tags':_0x4a6ca0||[]});return{'id':Number(_0x3b7cef[_0xda91('0xb1')]['id']),'tags':_0x4a6ca0||[]};});}})[_0xda91('0x28')](respondWithResult(_0x119fb6,null))[_0xda91('0x3b')](handleError(_0x119fb6,null));};exports[_0xda91('0xc4')]=function(_0x638343,_0x77bdd7,_0x2d47c3){return db['FaxInteraction'][_0xda91('0x64')]({'where':{'id':_0x638343[_0xda91('0xb1')]['id']}})[_0xda91('0x28')](handleEntityNotFound(_0x77bdd7,null))[_0xda91('0x28')](function(_0x2290d1){if(_0x2290d1){return _0x2290d1[_0xda91('0xc4')](_0x638343[_0xda91('0x42')][_0xda91('0xb9')]);}})[_0xda91('0x28')](respondWithStatusCode(_0x77bdd7,null))[_0xda91('0x3b')](handleError(_0x77bdd7,null));};exports['download']=function(_0x397eff,_0x25a20f){var _0x3d12e4=moment()[_0xda91('0xc5')]()[_0xda91('0x9a')]();var _0x40d9cc=path['join'](config[_0xda91('0xc6')],_0xda91('0xc7'),_0xda91('0xc8'),_0xda91('0xc9'));var _0x4fa7bc=path['join'](config['root'],_0xda91('0xc7'),'files',_0xda91('0xca'));var _0x44a7ea=path[_0xda91('0xcb')](_0x40d9cc,_0x3d12e4);var _0x52f868=util[_0xda91('0xcc')]('transcript-%d-%s.zip',_0x397eff[_0xda91('0xb1')]['id'],_0x3d12e4);var _0x2397d7=path[_0xda91('0xcb')](_0x40d9cc,_0x52f868);var _0x12fc4c=[];_0x12fc4c[_0xda91('0xcd')]({'model':db[_0xda91('0xce')],'as':'Attachment','raw':!![]});var _0xe258f6=[{'model':db[_0xda91('0xb7')],'as':'Messages','attributes':['id',_0xda91('0x30'),_0xda91('0x7b')],'include':_0x12fc4c}];return db[_0xda91('0x3c')][_0xda91('0x64')]({'where':{'id':_0x397eff[_0xda91('0xb1')]['id']},'include':_0xe258f6})[_0xda91('0x28')](handleEntityNotFound(_0x25a20f,null))['then'](function(_0x33ef63){if(_0x33ef63&&_0x33ef63[_0xda91('0xcf')]){var _0x37c168=_0x33ef63[_0xda91('0xd0')]({'plain':!![]});fs[_0xda91('0xd1')](_0x44a7ea);for(var _0x379bb4=0x0;_0x379bb4<_0x37c168[_0xda91('0xcf')][_0xda91('0x63')];_0x379bb4++){var _0x42860f=_0x37c168[_0xda91('0xcf')][_0x379bb4][_0xda91('0xce')];if(_0x42860f){var _0x501d90=path[_0xda91('0xcb')](_0x4fa7bc,_0x42860f[_0xda91('0xd2')]);if(fs[_0xda91('0xd3')](_0x501d90)){fs[_0xda91('0xd4')](_0x501d90)[_0xda91('0xd5')](fs[_0xda91('0xd6')](path['join'](_0x44a7ea,_0x42860f[_0xda91('0xd2')])));}}}return BPromise['resolve']()[_0xda91('0x28')](function(){return new BPromise(function(_0x221acc,_0x56e642){zipdir(_0x44a7ea,{'saveTo':_0x2397d7},function(_0x160e6c,_0xa0939e){if(_0x160e6c)return _0x56e642(_0x160e6c);return _0x221acc(_0xa0939e);});})[_0xda91('0x28')](function(){return new BPromise(function(_0x681be9,_0x3d59dd){rimraf(_0x44a7ea,function(_0x5b79ea){if(_0x5b79ea)_0x3d59dd(_0x5b79ea);return _0x681be9();});});})[_0xda91('0x28')](function(){return _0x25a20f[_0xda91('0xd7')](_0x2397d7,_0x52f868,function(_0xfc30ff){if(_0xfc30ff){console[_0xda91('0xd8')](_0xda91('0xd9'),_0xfc30ff);}else{fs[_0xda91('0xda')](_0x2397d7);}});});});}else{return _0x25a20f['sendStatus'](0xc8);}})['catch'](handleError(_0x25a20f,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 75802c3..d8971fc 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 _0x2ef3=['remove','then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2ef3,0xba));var _0x32ef=function(_0x3f7898,_0x3e8bec){_0x3f7898=_0x3f7898-0x0;var _0x6cf8b=_0x2ef3[_0x3f7898];return _0x6cf8b;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var FaxInteraction=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var FaxMessage=require(_0x32ef('0x1'))['db'][_0x32ef('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x32ef('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x32ef('0x5'),'afterDestroy':_0x32ef('0x6')};function emitEvent(_0x524ab6){return function(_0x402857,_0x37dd1d,_0x4c8104){_0x402857['getUsers']({'attributes':['id'],'raw':!![]})[_0x32ef('0x7')](function(_0x4bfcf8){_0x402857[_0x32ef('0x8')](_0x32ef('0x9'),_0x4bfcf8[_0x32ef('0xa')](function(_0x298066){return{'id':_0x298066['id']};}));return FaxMessage[_0x32ef('0xb')]({'where':{'FaxInteractionId':_0x402857['id'],'direction':'in','read':![]},'raw':!![]});})[_0x32ef('0x7')](function(_0x28275c){_0x402857[_0x32ef('0x8')]('unreadMessages',_0x28275c['length']);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6+':'+_0x402857['id'],_0x402857);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6,_0x402857);_0x4c8104(null);})[_0x32ef('0xd')](_0x4c8104(null));};}for(var e in events){if(events[_0x32ef('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x32ef('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x542bae,_0x530d98){var _0x5e0a23=function(_0x2d1cc3){while(--_0x2d1cc3){_0x542bae['push'](_0x542bae['shift']());}};_0x5e0a23(++_0x530d98);}(_0x1261,0x144));var _0x1126=function(_0x209511,_0x231622){_0x209511=_0x209511-0x0;var _0x39b937=_0x1261[_0x209511];return _0x39b937;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index a707a25..58f1456 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 _0x714d=['closedAt','format','api','path','rimraf','../../config/environment','exports','define','FaxInteraction'];(function(_0x27e0c2,_0x208a71){var _0x4659dc=function(_0x5a4ed5){while(--_0x5a4ed5){_0x27e0c2['push'](_0x27e0c2['shift']());}};_0x4659dc(++_0x208a71);}(_0x714d,0x13d));var _0xd714=function(_0x218688,_0x3c7e12){_0x218688=_0x218688-0x0;var _0x3a4fd7=_0x714d[_0x218688];return _0x3a4fd7;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd714('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd714('0x1'));var rimraf=require(_0xd714('0x2'));var config=require(_0xd714('0x3'));var attributes=require('./faxInteraction.attributes');module[_0xd714('0x4')]=function(_0x178dd6,_0x350c03){return _0x178dd6[_0xd714('0x5')](_0xd714('0x6'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x234721,_0x235204,_0xeac60f){if(_0x234721['changed']('closed')){_0x234721[_0xd714('0x7')]=moment()[_0xd714('0x8')]('YYYY-MM-DD\x20HH:mm:ss');}_0xeac60f(null,_0x234721);}}});}; \ No newline at end of file +var _0x1f64=['FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f64,0x15b));var _0x41f6=function(_0x2ff8e4,_0x122d8f){_0x2ff8e4=_0x2ff8e4-0x0;var _0x210cbf=_0x1f64[_0x2ff8e4];return _0x210cbf;};'use strict';var _=require(_0x41f6('0x0'));var util=require(_0x41f6('0x1'));var logger=require(_0x41f6('0x2'))('api');var moment=require(_0x41f6('0x3'));var BPromise=require('bluebird');var rp=require(_0x41f6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x41f6('0x5'));var config=require(_0x41f6('0x6'));var attributes=require(_0x41f6('0x7'));module[_0x41f6('0x8')]=function(_0x23b5ae,_0x431e3d){return _0x23b5ae[_0x41f6('0x9')](_0x41f6('0xa'),attributes,{'tableName':_0x41f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x181845,_0x2d860b,_0x4a9f05){if(_0x181845[_0x41f6('0xc')](_0x41f6('0xd'))){_0x181845[_0x41f6('0xe')]=moment()[_0x41f6('0xf')](_0x41f6('0x10'));}_0x4a9f05(null,_0x181845);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 689bc8f..1a29145 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 _0xe4af=['raw','attributes','limit','debug','catch','find','where','ids','omit','body','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxInteraction.socket','register','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','UpdateFaxInteraction','FaxInteraction','update','options'];(function(_0x1734f6,_0x410a08){var _0x188124=function(_0x5a25f9){while(--_0x5a25f9){_0x1734f6['push'](_0x1734f6['shift']());}};_0x188124(++_0x410a08);}(_0xe4af,0x11c));var _0xfe4a=function(_0x3e6d09,_0x5931f4){_0x3e6d09=_0x3e6d09-0x0;var _0x8341c5=_0xe4af[_0x3e6d09];return _0x8341c5;};'use strict';var _=require(_0xfe4a('0x0'));var util=require(_0xfe4a('0x1'));var moment=require(_0xfe4a('0x2'));var BPromise=require(_0xfe4a('0x3'));var rs=require(_0xfe4a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfe4a('0x5'))['db'];var utils=require(_0xfe4a('0x6'));var logger=require('../../config/logger')(_0xfe4a('0x7'));var config=require(_0xfe4a('0x8'));var jayson=require(_0xfe4a('0x9'));var client=jayson[_0xfe4a('0xa')][_0xfe4a('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfe4a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xfe4a('0xd'))(new Redis(config[_0xfe4a('0xc')]));require(_0xfe4a('0xe'))[_0xfe4a('0xf')](socket);function respondWithRpcPromise(_0x47e9f0,_0x27c848,_0x4653e6){return new BPromise(function(_0x38a83c,_0x593bd8){return client['request'](_0x47e9f0,_0x4653e6)[_0xfe4a('0x10')](function(_0x36386a){logger['info'](_0xfe4a('0x11'),_0x27c848,_0xfe4a('0x12'));logger['debug'](_0xfe4a('0x13'),_0x27c848,_0xfe4a('0x12'),JSON[_0xfe4a('0x14')](_0x36386a));if(_0x36386a[_0xfe4a('0x15')]){if(_0x36386a[_0xfe4a('0x15')]['code']===0x1f4){logger[_0xfe4a('0x15')](_0xfe4a('0x11'),_0x27c848,_0x36386a[_0xfe4a('0x15')][_0xfe4a('0x16')]);return _0x593bd8(_0x36386a[_0xfe4a('0x15')][_0xfe4a('0x16')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x27c848,_0x36386a['error'][_0xfe4a('0x16')]);return _0x38a83c(_0x36386a['error'][_0xfe4a('0x16')]);}else{logger[_0xfe4a('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x27c848,_0xfe4a('0x12'));_0x38a83c(_0x36386a['result'][_0xfe4a('0x16')]);}})['catch'](function(_0x3b3d06){logger['error'](_0xfe4a('0x11'),_0x27c848,_0x3b3d06);_0x593bd8(_0x3b3d06);});});}exports[_0xfe4a('0x18')]=function(_0x48356f){var _0x14654b=this;return new Promise(function(_0x5bc929,_0x1f933b){return db[_0xfe4a('0x19')][_0xfe4a('0x1a')](_0x48356f['body'],{'raw':_0x48356f[_0xfe4a('0x1b')]?_0x48356f['options'][_0xfe4a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48356f['options']?_0x48356f[_0xfe4a('0x1b')]['where']||null:null,'attributes':_0x48356f['options']?_0x48356f['options'][_0xfe4a('0x1d')]||null:null,'limit':_0x48356f[_0xfe4a('0x1b')]?_0x48356f[_0xfe4a('0x1b')][_0xfe4a('0x1e')]||null:null})[_0xfe4a('0x10')](function(_0x23eb6e){logger[_0xfe4a('0x17')](_0xfe4a('0x18'),_0x48356f);logger[_0xfe4a('0x1f')](_0xfe4a('0x18'),_0x48356f,JSON[_0xfe4a('0x14')](_0x23eb6e));_0x5bc929(_0x23eb6e);})[_0xfe4a('0x20')](function(_0x2644c7){logger[_0xfe4a('0x15')]('UpdateFaxInteraction',_0x2644c7[_0xfe4a('0x16')],_0x48356f);_0x1f933b(_0x14654b[_0xfe4a('0x15')](0x1f4,_0x2644c7[_0xfe4a('0x16')]));});});};exports['AddTagsToFaxInteraction']=function(_0x1b099e){return new Promise(function(_0x11c060,_0x43bf4e){return db['FaxInteraction'][_0xfe4a('0x21')]({'where':_0x1b099e[_0xfe4a('0x1b')]?_0x1b099e[_0xfe4a('0x1b')][_0xfe4a('0x22')]||null:null})['then'](function(_0x354855){if(_0x354855){return _0x354855['addTags'](_0x1b099e['body'][_0xfe4a('0x23')],_[_0xfe4a('0x24')](_0x1b099e[_0xfe4a('0x25')],[_0xfe4a('0x23'),'id'])||{});}})['spread'](function(_0xb221f5){logger[_0xfe4a('0x17')]('AddTags',_0x1b099e);logger[_0xfe4a('0x1f')](_0xfe4a('0x26'),_0x1b099e,JSON['stringify'](_0xb221f5));_0x11c060(_0xb221f5);})[_0xfe4a('0x20')](function(_0x4f8886){logger[_0xfe4a('0x15')]('AddTags',_0x4f8886['message'],_0x1b099e);_0x43bf4e(_this[_0xfe4a('0x15')](0x1f4,_0x4f8886[_0xfe4a('0x16')]));});});}; \ No newline at end of file +var _0x0747=['register','then','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','info','AddTagsToFaxInteraction','find','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','socket.io-emitter','./faxInteraction.socket'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0x0747,0x1d3));var _0x7074=function(_0x23cd3b,_0x1a4ce4){_0x23cd3b=_0x23cd3b-0x0;var _0x1c80a1=_0x0747[_0x23cd3b];return _0x1c80a1;};'use strict';var _=require(_0x7074('0x0'));var util=require('util');var moment=require(_0x7074('0x1'));var BPromise=require('bluebird');var rs=require(_0x7074('0x2'));var fs=require('fs');var Redis=require(_0x7074('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7074('0x4'));var logger=require(_0x7074('0x5'))(_0x7074('0x6'));var config=require('../../config/environment');var jayson=require(_0x7074('0x7'));var client=jayson[_0x7074('0x8')][_0x7074('0x9')]({'port':0x232a});config['redis']=_[_0x7074('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7074('0xb'))(new Redis(config['redis']));require(_0x7074('0xc'))[_0x7074('0xd')](socket);function respondWithRpcPromise(_0x1b0b91,_0x7b5645,_0x4c1fd3){return new BPromise(function(_0x4cff33,_0x1994dd){return client['request'](_0x1b0b91,_0x4c1fd3)[_0x7074('0xe')](function(_0x3e14bd){logger['info'](_0x7074('0xf'),_0x7b5645,'request\x20sent');logger[_0x7074('0x10')](_0x7074('0x11'),_0x7b5645,_0x7074('0x12'),JSON[_0x7074('0x13')](_0x3e14bd));if(_0x3e14bd[_0x7074('0x14')]){if(_0x3e14bd['error'][_0x7074('0x15')]===0x1f4){logger[_0x7074('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x7b5645,_0x3e14bd[_0x7074('0x14')][_0x7074('0x16')]);return _0x1994dd(_0x3e14bd['error'][_0x7074('0x16')]);}logger['error'](_0x7074('0xf'),_0x7b5645,_0x3e14bd[_0x7074('0x14')][_0x7074('0x16')]);return _0x4cff33(_0x3e14bd[_0x7074('0x14')]['message']);}else{logger['info'](_0x7074('0xf'),_0x7b5645,'request\x20sent');_0x4cff33(_0x3e14bd['result'][_0x7074('0x16')]);}})[_0x7074('0x17')](function(_0x2b4465){logger['error'](_0x7074('0xf'),_0x7b5645,_0x2b4465);_0x1994dd(_0x2b4465);});});}exports[_0x7074('0x18')]=function(_0x3f7dbb){var _0x3610c3=this;return new Promise(function(_0x2f9959,_0x5ef995){return db[_0x7074('0x19')][_0x7074('0x1a')](_0x3f7dbb[_0x7074('0x1b')],{'raw':_0x3f7dbb[_0x7074('0x1c')]?_0x3f7dbb[_0x7074('0x1c')][_0x7074('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f7dbb[_0x7074('0x1c')]?_0x3f7dbb[_0x7074('0x1c')][_0x7074('0x1e')]||null:null,'attributes':_0x3f7dbb[_0x7074('0x1c')]?_0x3f7dbb['options'][_0x7074('0x1f')]||null:null,'limit':_0x3f7dbb[_0x7074('0x1c')]?_0x3f7dbb[_0x7074('0x1c')][_0x7074('0x20')]||null:null})[_0x7074('0xe')](function(_0x96cd1d){logger[_0x7074('0x21')](_0x7074('0x18'),_0x3f7dbb);logger[_0x7074('0x10')](_0x7074('0x18'),_0x3f7dbb,JSON[_0x7074('0x13')](_0x96cd1d));_0x2f9959(_0x96cd1d);})[_0x7074('0x17')](function(_0x598f6d){logger[_0x7074('0x14')](_0x7074('0x18'),_0x598f6d['message'],_0x3f7dbb);_0x5ef995(_0x3610c3[_0x7074('0x14')](0x1f4,_0x598f6d[_0x7074('0x16')]));});});};exports[_0x7074('0x22')]=function(_0x9a844d){return new Promise(function(_0x3c4df0,_0x2c889c){return db['FaxInteraction'][_0x7074('0x23')]({'where':_0x9a844d[_0x7074('0x1c')]?_0x9a844d[_0x7074('0x1c')][_0x7074('0x1e')]||null:null})['then'](function(_0x3116c7){if(_0x3116c7){return _0x3116c7['addTags'](_0x9a844d['body'][_0x7074('0x24')],_[_0x7074('0x25')](_0x9a844d[_0x7074('0x1b')],[_0x7074('0x24'),'id'])||{});}})[_0x7074('0x26')](function(_0x47aa83){logger[_0x7074('0x21')]('AddTags',_0x9a844d);logger['debug'](_0x7074('0x27'),_0x9a844d,JSON['stringify'](_0x47aa83));_0x3c4df0(_0x47aa83);})[_0x7074('0x17')](function(_0x5e32e3){logger[_0x7074('0x14')](_0x7074('0x27'),_0x5e32e3['message'],_0x9a844d);_0x2c889c(_this[_0x7074('0x14')](0x1f4,_0x5e32e3[_0x7074('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index b60a45d..6877641 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 _0x2e84=['update','emit','removeListener','length','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0x2396eb,_0x36b9c1){var _0x4d9fdc=function(_0x564f82){while(--_0x564f82){_0x2396eb['push'](_0x2396eb['shift']());}};_0x4d9fdc(++_0x36b9c1);}(_0x2e84,0x175));var _0x42e8=function(_0xaae49e,_0x3b3589){_0xaae49e=_0xaae49e-0x0;var _0x3f5c45=_0x2e84[_0xaae49e];return _0x3f5c45;};'use strict';var FaxInteractionEvents=require(_0x42e8('0x0'));var events=[_0x42e8('0x1'),_0x42e8('0x2'),_0x42e8('0x3')];function createListener(_0xc275fa,_0x246f35){return function(_0x4faa9a){_0x246f35[_0x42e8('0x4')](_0xc275fa,_0x4faa9a);};}function removeListener(_0x490cf1,_0xa3a746){return function(){FaxInteractionEvents[_0x42e8('0x5')](_0x490cf1,_0xa3a746);};}exports['register']=function(_0x2b18c8){for(var _0x5aa5f4=0x0,_0x395a38=events[_0x42e8('0x6')];_0x5aa5f4<_0x395a38;_0x5aa5f4++){var _0x1eb9c9=events[_0x5aa5f4];var _0x165f76=createListener(_0x42e8('0x7')+_0x1eb9c9,_0x2b18c8);FaxInteractionEvents['on'](_0x1eb9c9,_0x165f76);}}; \ No newline at end of file +var _0xb573=['length','faxInteraction:','./faxInteraction.events','remove','update'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xb573,0x101));var _0x3b57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb573[_0x3dd15e];return _0x231fd0;};'use strict';var FaxInteractionEvents=require(_0x3b57('0x0'));var events=['save',_0x3b57('0x1'),_0x3b57('0x2')];function createListener(_0x5a2b11,_0x2f5613){return function(_0x2b4e86){_0x2f5613['emit'](_0x5a2b11,_0x2b4e86);};}function removeListener(_0x5d4cf8,_0x1ef2be){return function(){FaxInteractionEvents['removeListener'](_0x5d4cf8,_0x1ef2be);};}exports['register']=function(_0x19028e){for(var _0x2d272d=0x0,_0x1cb7f7=events[_0x3b57('0x3')];_0x2d272d<_0x1cb7f7;_0x2d272d++){var _0x119202=events[_0x2d272d];var _0x54b9b7=createListener(_0x3b57('0x4')+_0x119202,_0x19028e);FaxInteractionEvents['on'](_0x119202,_0x54b9b7);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index c44858f..d5825c6 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 _0x1194=['download','post','create','addMessage','/:id/tags','fax','faxinteraction:addtags','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','getMessages'];(function(_0x4f8bba,_0x3168dc){var _0x256a42=function(_0x2192b3){while(--_0x2192b3){_0x4f8bba['push'](_0x4f8bba['shift']());}};_0x256a42(++_0x3168dc);}(_0x1194,0x14d));var _0x4119=function(_0x50e7a4,_0x35bfbf){_0x50e7a4=_0x50e7a4-0x0;var _0x35c692=_0x1194[_0x50e7a4];return _0x35c692;};'use strict';var multer=require(_0x4119('0x0'));var util=require(_0x4119('0x1'));var path=require(_0x4119('0x2'));var timeout=require(_0x4119('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4119('0x4'));var auth=require(_0x4119('0x5'));var interaction=require(_0x4119('0x6'));var config=require('../../config/environment');var controller=require(_0x4119('0x7'));router[_0x4119('0x8')]('/',auth[_0x4119('0x9')](),controller['index']);router['get'](_0x4119('0xa'),auth[_0x4119('0x9')](),controller[_0x4119('0xb')]);router[_0x4119('0x8')](_0x4119('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4119('0x8')](_0x4119('0xd'),auth[_0x4119('0x9')](),controller[_0x4119('0xe')]);router['get']('/:id/download',auth[_0x4119('0x9')](),controller[_0x4119('0xf')]);router[_0x4119('0x10')]('/',auth[_0x4119('0x9')](),controller[_0x4119('0x11')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x4119('0x12')]);router['post'](_0x4119('0x13'),auth[_0x4119('0x9')](),interaction['tracked'](_0x4119('0x14'),_0x4119('0x15')),controller['addTags']);router['put'](_0x4119('0xc'),auth['isAuthenticated'](),interaction[_0x4119('0x16')](_0x4119('0x14'),_0x4119('0x17')),controller[_0x4119('0x18')]);router[_0x4119('0x19')](_0x4119('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0x4119('0x14'),_0x4119('0x1a')),controller['destroy']);router[_0x4119('0x19')](_0x4119('0x13'),auth[_0x4119('0x9')](),controller[_0x4119('0x1b')]);module[_0x4119('0x1c')]=router; \ No newline at end of file +var _0x9b33=['getMessages','/:id/download','download','post','create','/:id/messages','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','faxinteraction:destroy','destroy','delete','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x2cf620,_0x49f37f){var _0x4370a6=function(_0x21a030){while(--_0x21a030){_0x2cf620['push'](_0x2cf620['shift']());}};_0x4370a6(++_0x49f37f);}(_0x9b33,0x1c2));var _0x39b3=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x9b33[_0x49ca18];return _0x145d54;};'use strict';var multer=require('multer');var util=require(_0x39b3('0x0'));var path=require('path');var timeout=require(_0x39b3('0x1'));var express=require(_0x39b3('0x2'));var router=express[_0x39b3('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x39b3('0x4'));var config=require(_0x39b3('0x5'));var controller=require(_0x39b3('0x6'));router[_0x39b3('0x7')]('/',auth['isAuthenticated'](),controller[_0x39b3('0x8')]);router[_0x39b3('0x7')](_0x39b3('0x9'),auth[_0x39b3('0xa')](),controller[_0x39b3('0xb')]);router[_0x39b3('0x7')](_0x39b3('0xc'),auth[_0x39b3('0xa')](),controller[_0x39b3('0xd')]);router[_0x39b3('0x7')]('/:id/messages',auth[_0x39b3('0xa')](),controller[_0x39b3('0xe')]);router['get'](_0x39b3('0xf'),auth[_0x39b3('0xa')](),controller[_0x39b3('0x10')]);router[_0x39b3('0x11')]('/',auth[_0x39b3('0xa')](),controller[_0x39b3('0x12')]);router[_0x39b3('0x11')](_0x39b3('0x13'),auth[_0x39b3('0xa')](),controller['addMessage']);router[_0x39b3('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x39b3('0x14')](_0x39b3('0x15'),_0x39b3('0x16')),controller[_0x39b3('0x17')]);router[_0x39b3('0x18')](_0x39b3('0xc'),auth['isAuthenticated'](),interaction[_0x39b3('0x14')]('fax',_0x39b3('0x19')),controller['update']);router['delete'](_0x39b3('0xc'),auth[_0x39b3('0xa')](),interaction[_0x39b3('0x14')]('fax',_0x39b3('0x1a')),controller[_0x39b3('0x1b')]);router[_0x39b3('0x1c')]('/:id/tags',auth[_0x39b3('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 543ce81..7cfeeaa 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 _0x66fc=['sequelize','exports','medium','ENUM','DATE'];(function(_0x48da45,_0x259bea){var _0x5d5687=function(_0x2d0a0f){while(--_0x2d0a0f){_0x48da45['push'](_0x48da45['shift']());}};_0x5d5687(++_0x259bea);}(_0x66fc,0x154));var _0xc66f=function(_0x2d33e8,_0x3dd567){_0x2d33e8=_0x2d33e8-0x0;var _0x33ebcc=_0x66fc[_0x2d33e8];return _0x33ebcc;};'use strict';var Sequelize=require(_0xc66f('0x0'));module[_0xc66f('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc66f('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc66f('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xc66f('0x4')]}}; \ No newline at end of file +var _0x5cea=['DATE','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x3b98a9,_0x2ecb8c){var _0x289b79=function(_0x36d967){while(--_0x36d967){_0x3b98a9['push'](_0x3b98a9['shift']());}};_0x289b79(++_0x2ecb8c);}(_0x5cea,0x13c));var _0xa5ce=function(_0x8784aa,_0x8dd51b){_0x8784aa=_0x8784aa-0x0;var _0x14e1ba=_0x5cea[_0x8784aa];return _0x14e1ba;};'use strict';var Sequelize=require('sequelize');module[_0xa5ce('0x0')]={'body':{'type':Sequelize[_0xa5ce('0x1')](_0xa5ce('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa5ce('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa5ce('0x4')]('in','out'),'defaultValue':_0xa5ce('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xa5ce('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xa5ce('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 83c2c71..9876990 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 _0x484d=['model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','options','FaxMessage','includeAll','rows','params','keys','include','find','describe','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','format','rejectmessage','create','ContactId','findOne','AttachmentId','SendFax','isNil','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','Attachment','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','request','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','render','merge','body','agent','interaction','index','map','rawAttributes','fieldName','type','key','name','query','filters'];(function(_0xce68c0,_0xdf9f47){var _0x736fd0=function(_0x293cdd){while(--_0x293cdd){_0xce68c0['push'](_0xce68c0['shift']());}};_0x736fd0(++_0xdf9f47);}(_0x484d,0x1ca));var _0xd484=function(_0x439a24,_0x183240){_0x439a24=_0x439a24-0x0;var _0x2c8319=_0x484d[_0x439a24];return _0x2c8319;};'use strict';var emlformat=require(_0xd484('0x0'));var rimraf=require(_0xd484('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd484('0x2'));var rp=require(_0xd484('0x3'));var moment=require(_0xd484('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd484('0x5'));var util=require('util');var path=require(_0xd484('0x6'));var sox=require('sox');var csv=require(_0xd484('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd484('0x8'));var _=require('lodash');var squel=require(_0xd484('0x9'));var crypto=require(_0xd484('0xa'));var jsforce=require(_0xd484('0xb'));var deskjs=require(_0xd484('0xc'));var toCsv=require(_0xd484('0x7'));var querystring=require('querystring');var Papa=require(_0xd484('0xd'));var Redis=require(_0xd484('0xe'));var authService=require(_0xd484('0xf'));var qs=require(_0xd484('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd484('0x11'));var logger=require(_0xd484('0x12'))(_0xd484('0x13'));var utils=require(_0xd484('0x14'));var config=require(_0xd484('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd484('0x16'))['db'];config[_0xd484('0x17')]=_[_0xd484('0x18')](config['redis'],{'host':_0xd484('0x19'),'port':0x18eb});var socket=require(_0xd484('0x1a'))(new Redis(config[_0xd484('0x17')]));require('./faxMessage.socket')[_0xd484('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd484('0x1c')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5d664d,_0x1e6929,_0x2e3178,_0x2a1e29){return new BPromise(function(_0x3a33d3,_0x22d95d){var _0x10e16b=_0x2a1e29||client;return _0x10e16b[_0xd484('0x1d')](_0x5d664d,_0x2e3178)['then'](function(_0x59f26b){logger[_0xd484('0x1e')](_0xd484('0x1f'),_0x1e6929,'request\x20sent');logger[_0xd484('0x20')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x1e6929,_0xd484('0x21'),JSON[_0xd484('0x22')](_0x59f26b));if(_0x59f26b[_0xd484('0x23')]){if(_0x59f26b[_0xd484('0x23')]['code']===0x1f4){logger[_0xd484('0x23')](_0xd484('0x1f'),_0x1e6929,_0x59f26b[_0xd484('0x23')][_0xd484('0x24')]);return _0x22d95d(_0x59f26b[_0xd484('0x23')][_0xd484('0x24')]);}logger[_0xd484('0x23')]('FaxMessage,\x20%s,\x20%s',_0x1e6929,_0x59f26b[_0xd484('0x23')]['message']);return _0x3a33d3(_0x59f26b[_0xd484('0x23')][_0xd484('0x24')]);}else{logger['info'](_0xd484('0x1f'),_0x1e6929,'request\x20sent');_0x3a33d3(_0x59f26b[_0xd484('0x25')]['message']);}})[_0xd484('0x26')](function(_0x339d9b){logger[_0xd484('0x23')](_0xd484('0x1f'),_0x1e6929,_0x339d9b);_0x22d95d(_0x339d9b);});});}function respondWithStatusCode(_0x54907a,_0x163a44){_0x163a44=_0x163a44||0xcc;return function(_0x77ba62){if(_0x77ba62){return _0x54907a[_0xd484('0x27')](_0x163a44);}return _0x54907a[_0xd484('0x28')](_0x163a44)[_0xd484('0x29')]();};}function respondWithResult(_0x216236,_0x2b4c51){_0x2b4c51=_0x2b4c51||0xc8;return function(_0x2137ac){if(_0x2137ac){return _0x216236[_0xd484('0x28')](_0x2b4c51)[_0xd484('0x2a')](_0x2137ac);}};}function respondWithFilteredResult(_0x53f882,_0x3bf4b6){return function(_0x17a34c){if(_0x17a34c){var _0x3e2fe6=typeof _0x3bf4b6[_0xd484('0x2b')]==='undefined'&&typeof _0x3bf4b6['limit']===_0xd484('0x2c');var _0x3a9b36=_0x17a34c[_0xd484('0x2d')];var _0xd3fa8c=_0x3e2fe6?0x0:_0x3bf4b6[_0xd484('0x2b')];var _0x476050=_0x3e2fe6?_0x17a34c[_0xd484('0x2d')]:_0x3bf4b6[_0xd484('0x2b')]+_0x3bf4b6['limit'];var _0x50c10c;if(_0x476050>=_0x3a9b36){_0x476050=_0x3a9b36;_0x50c10c=0xc8;}else{_0x50c10c=0xce;}_0x53f882[_0xd484('0x28')](_0x50c10c);return _0x53f882[_0xd484('0x2e')](_0xd484('0x2f'),_0xd3fa8c+'-'+_0x476050+'/'+_0x3a9b36)[_0xd484('0x2a')](_0x17a34c);}return null;};}function patchUpdates(_0x26c377){return function(_0x43a678){try{jsonpatch[_0xd484('0x30')](_0x43a678,_0x26c377,!![]);}catch(_0x56a5b9){return BPromise[_0xd484('0x31')](_0x56a5b9);}return _0x43a678[_0xd484('0x32')]();};}function saveUpdates(_0x4fb085,_0x5bc102){return function(_0xba071c){if(_0xba071c){return _0xba071c[_0xd484('0x33')](_0x4fb085)[_0xd484('0x34')](function(_0x17a87f){return _0x17a87f;});}return null;};}function removeEntity(_0x21752e,_0x51aef7){return function(_0x3327b2){if(_0x3327b2){return _0x3327b2[_0xd484('0x35')]()[_0xd484('0x34')](function(){_0x21752e[_0xd484('0x28')](0xcc)[_0xd484('0x29')]();});}};}function handleEntityNotFound(_0x915a19,_0x16e8cc){return function(_0x1f6697){if(!_0x1f6697){_0x915a19[_0xd484('0x27')](0x194);}return _0x1f6697;};}function handleError(_0x58f2e4,_0x3e69b1){_0x3e69b1=_0x3e69b1||0x1f4;return function(_0x1ded83){logger[_0xd484('0x23')](_0x1ded83[_0xd484('0x36')]);if(_0x1ded83['name']){delete _0x1ded83['name'];}_0x58f2e4['status'](_0x3e69b1)[_0xd484('0x37')](_0x1ded83);};}function getMustacheRender(_0x5bbfd2,_0x351c38){return Mustache[_0xd484('0x38')](_0x5bbfd2,_[_0xd484('0x39')](_0x351c38[_0xd484('0x3a')],{'contact':_0x351c38['contact'],'message':_0x351c38['message'],'agent':_0x351c38[_0xd484('0x3b')],'interaction':_0x351c38[_0xd484('0x3c')],'account':_0x351c38['account']}))||'';}exports[_0xd484('0x3d')]=function(_0x474b7d,_0x439496){var _0x3f41ee={},_0x11c21f={},_0x53dd3b={'count':0x0,'rows':[]};var _0x4f26b1=_[_0xd484('0x3e')](db['FaxMessage'][_0xd484('0x3f')],function(_0x1c4816){return{'name':_0x1c4816[_0xd484('0x40')],'type':_0x1c4816[_0xd484('0x41')][_0xd484('0x42')]};});_0x11c21f['model']=_[_0xd484('0x3e')](_0x4f26b1,_0xd484('0x43'));_0x11c21f[_0xd484('0x44')]=_['keys'](_0x474b7d[_0xd484('0x44')]);_0x11c21f[_0xd484('0x45')]=_['intersection'](_0x11c21f[_0xd484('0x46')],_0x11c21f[_0xd484('0x44')]);_0x3f41ee['attributes']=_[_0xd484('0x47')](_0x11c21f[_0xd484('0x46')],qs[_0xd484('0x48')](_0x474b7d[_0xd484('0x44')][_0xd484('0x48')]));_0x3f41ee['attributes']=_0x3f41ee[_0xd484('0x49')][_0xd484('0x4a')]?_0x3f41ee[_0xd484('0x49')]:_0x11c21f[_0xd484('0x46')];if(!_0x474b7d[_0xd484('0x44')][_0xd484('0x4b')](_0xd484('0x4c'))){_0x3f41ee[_0xd484('0x4d')]=qs['limit'](_0x474b7d['query'][_0xd484('0x4d')]);_0x3f41ee[_0xd484('0x2b')]=qs[_0xd484('0x2b')](_0x474b7d[_0xd484('0x44')]['offset']);}_0x3f41ee[_0xd484('0x4e')]=qs['sort'](_0x474b7d[_0xd484('0x44')][_0xd484('0x4f')]);_0x3f41ee[_0xd484('0x50')]=qs['filters'](_[_0xd484('0x51')](_0x474b7d[_0xd484('0x44')],_0x11c21f['filters']),_0x4f26b1);if(_0x474b7d[_0xd484('0x44')][_0xd484('0x52')]){_0x3f41ee[_0xd484('0x50')]=_['merge'](_0x3f41ee[_0xd484('0x50')],{'$or':_[_0xd484('0x3e')](_0x4f26b1,function(_0x4cb752){if(_0x4cb752[_0xd484('0x41')]!=='VIRTUAL'){var _0x3238ff={};_0x3238ff[_0x4cb752[_0xd484('0x43')]]={'$like':'%'+_0x474b7d[_0xd484('0x44')]['filter']+'%'};return _0x3238ff;}})});}_0x3f41ee=_['merge']({},_0x3f41ee,_0x474b7d[_0xd484('0x53')]);var _0x3b9ec0={'where':_0x3f41ee[_0xd484('0x50')]};return db[_0xd484('0x54')][_0xd484('0x2d')](_0x3b9ec0)[_0xd484('0x34')](function(_0x34478a){_0x53dd3b[_0xd484('0x2d')]=_0x34478a;if(_0x474b7d[_0xd484('0x44')][_0xd484('0x55')]){_0x3f41ee['include']=[{'all':!![]}];}return db[_0xd484('0x54')]['findAll'](_0x3f41ee);})['then'](function(_0x1ee583){_0x53dd3b[_0xd484('0x56')]=_0x1ee583;return _0x53dd3b;})[_0xd484('0x34')](respondWithFilteredResult(_0x439496,_0x3f41ee))[_0xd484('0x26')](handleError(_0x439496,null));};exports['show']=function(_0x59e0de,_0x2e8381){var _0x4dd22d={'raw':!![],'where':{'id':_0x59e0de[_0xd484('0x57')]['id']}},_0x36a799={};_0x36a799[_0xd484('0x46')]=_[_0xd484('0x58')](db['FaxMessage'][_0xd484('0x3f')]);_0x36a799[_0xd484('0x44')]=_[_0xd484('0x58')](_0x59e0de[_0xd484('0x44')]);_0x36a799[_0xd484('0x45')]=_[_0xd484('0x47')](_0x36a799[_0xd484('0x46')],_0x36a799[_0xd484('0x44')]);_0x4dd22d[_0xd484('0x49')]=_[_0xd484('0x47')](_0x36a799[_0xd484('0x46')],qs['fields'](_0x59e0de['query']['fields']));_0x4dd22d['attributes']=_0x4dd22d[_0xd484('0x49')][_0xd484('0x4a')]?_0x4dd22d[_0xd484('0x49')]:_0x36a799['model'];if(_0x59e0de[_0xd484('0x44')][_0xd484('0x55')]){_0x4dd22d[_0xd484('0x59')]=[{'all':!![]}];}_0x4dd22d=_['merge']({},_0x4dd22d,_0x59e0de[_0xd484('0x53')]);return db[_0xd484('0x54')][_0xd484('0x5a')](_0x4dd22d)[_0xd484('0x34')](handleEntityNotFound(_0x2e8381,null))[_0xd484('0x34')](respondWithResult(_0x2e8381,null))['catch'](handleError(_0x2e8381,null));};exports[_0xd484('0x33')]=function(_0x58ded7,_0x27abca){if(_0x58ded7[_0xd484('0x3a')]['id']){delete _0x58ded7[_0xd484('0x3a')]['id'];}return db[_0xd484('0x54')]['find']({'where':{'id':_0x58ded7[_0xd484('0x57')]['id']}})[_0xd484('0x34')](handleEntityNotFound(_0x27abca,null))['then'](saveUpdates(_0x58ded7[_0xd484('0x3a')],null))[_0xd484('0x34')](respondWithResult(_0x27abca,null))[_0xd484('0x26')](handleError(_0x27abca,null));};exports[_0xd484('0x35')]=function(_0x1c6047,_0x7e5dd8){return db[_0xd484('0x54')][_0xd484('0x5a')]({'where':{'id':_0x1c6047[_0xd484('0x57')]['id']}})[_0xd484('0x34')](handleEntityNotFound(_0x7e5dd8,null))[_0xd484('0x34')](removeEntity(_0x7e5dd8,null))['catch'](handleError(_0x7e5dd8,null));};exports[_0xd484('0x5b')]=function(_0x93ac92,_0x15c93d){return db[_0xd484('0x54')][_0xd484('0x5b')]()['then'](respondWithResult(_0x15c93d,null))[_0xd484('0x26')](handleError(_0x15c93d,null));};var interaction_log=require(_0xd484('0x12'))(_0xd484('0x5c'));exports[_0xd484('0x5d')]=function(_0x2f1338,_0x2a5db9,_0x3a9e22){var _0x5455ff={'agent':{},'channel':_0xd484('0x5e')};if(_0x2f1338[_0xd484('0x3a')]['id']){delete _0x2f1338[_0xd484('0x3a')]['id'];}_0x2f1338[_0xd484('0x3a')][_0xd484('0x5f')]=!![];_0x2f1338[_0xd484('0x3a')][_0xd484('0x60')]=moment()['format'](_0xd484('0x61'));_0x2f1338[_0xd484('0x3a')]['UserId']=_0x2f1338['body'][_0xd484('0x62')]||_0x2f1338['user']['id'];_0x5455ff[_0xd484('0x3b')]['id']=_0x2f1338[_0xd484('0x3a')][_0xd484('0x62')];return db['FaxMessage'][_0xd484('0x5a')]({'where':{'id':_0x2f1338['params']['id'],'UserId':null},'include':[{'model':db[_0xd484('0x63')],'as':_0xd484('0x64')}]})[_0xd484('0x34')](handleEntityNotFound(_0x2a5db9,null))['then'](saveUpdates(_0x2f1338[_0xd484('0x3a')],null))[_0xd484('0x34')](function(_0x3a3c53){if(_0x3a3c53){_0x5455ff['message']=_0x3a3c53[_0xd484('0x65')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x3a3c53['FaxInteractionId']}});}return null;})[_0xd484('0x34')](handleEntityNotFound(_0x2a5db9,null))[_0xd484('0x34')](function(_0x19d148){if(_0x19d148){return _0x19d148['update']({'UserId':_0x2f1338['body'][_0xd484('0x62')],'read1stAt':_['isNil'](_0x19d148[_0xd484('0x66')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x401bb0){if(_0x401bb0){_0x5455ff['interaction']=_0x401bb0[_0xd484('0x65')]({'plain':!![]});interaction_log[_0xd484('0x1e')](_0xd484('0x67'),_0x2f1338[_0xd484('0x68')]['id'],_0x2f1338[_0xd484('0x68')][_0xd484('0x43')],_0x2f1338[_0xd484('0x68')]['role'],_0x5455ff[_0xd484('0x3c')]['id'],_0x2f1338['body']?JSON[_0xd484('0x22')](_0x2f1338[_0xd484('0x3a')]):_0xd484('0x69'));return respondWithRpcPromise(_0xd484('0x6a'),'acceptMessage',_0x5455ff);}return null;})[_0xd484('0x34')](function(_0x5bc9e6){if(_0x5bc9e6){if(_0x2f1338[_0xd484('0x3a')][_0xd484('0x6b')]){_0x5455ff[_0xd484('0x24')]['interface']=util['format'](_0xd484('0x6c'),_0x2f1338[_0xd484('0x68')][_0xd484('0x43')]);_0x5455ff[_0xd484('0x24')][_0xd484('0x6d')]=_0x5455ff['channel'];_0x5455ff[_0xd484('0x24')][_0xd484('0x6e')]='accept';return respondWithRpcPromise(_0xd484('0x6f'),_0xd484('0x6f'),{'event':_0xd484('0x70'),'message':_0x5455ff[_0xd484('0x24')]},client9002)[_0xd484('0x34')](function(){return _0x5455ff;});}return _0x5455ff;}return null;})['then'](respondWithResult(_0x2a5db9,null))[_0xd484('0x26')](handleError(_0x2a5db9,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xd484('0x31')]=function(_0x1e6581,_0x473df7,_0x7ede68){var _0x2fb693={'agent':{},'channel':_0xd484('0x5e')};if(_0x1e6581[_0xd484('0x3a')]['id']){delete _0x1e6581[_0xd484('0x3a')]['id'];}_0x1e6581['body'][_0xd484('0x62')]=_0x1e6581['body'][_0xd484('0x62')]||_0x1e6581['user']['id'];_0x2fb693[_0xd484('0x3b')]['id']=_0x1e6581[_0xd484('0x3a')][_0xd484('0x62')];return db['FaxMessage']['find']({'where':{'id':_0x1e6581['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x473df7,null))[_0xd484('0x34')](function(_0x348870){if(_0x348870){_0x2fb693[_0xd484('0x24')]=_0x348870[_0xd484('0x65')]({'plain':!![]});return db[_0xd484('0x71')]['find']({'where':{'id':_0x348870['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x473df7,null))[_0xd484('0x34')](function(_0x3c2ff1){if(_0x3c2ff1){_0x2fb693['interaction']=_0x3c2ff1['get']({'plain':!![]});interaction_log[_0xd484('0x1e')](_0xd484('0x72'),_0x1e6581['user']['id'],_0x1e6581[_0xd484('0x68')][_0xd484('0x43')],_0x1e6581[_0xd484('0x68')]['role'],_0x2fb693['interaction']['id'],_0x1e6581[_0xd484('0x3a')]?JSON[_0xd484('0x22')](_0x1e6581[_0xd484('0x3a')]):'null');return respondWithRpcPromise('RejectMessage',_0xd484('0x73'),_0x2fb693);}return null;})['then'](function(_0x52b1e3){if(_0x52b1e3){_0x52b1e3[_0xd484('0x24')][_0xd484('0x74')]=util[_0xd484('0x75')](_0xd484('0x6c'),_0x1e6581['user'][_0xd484('0x43')]);_0x52b1e3['message']['channel']=_0x2fb693[_0xd484('0x6d')];_0x52b1e3[_0xd484('0x24')][_0xd484('0x6e')]=_0xd484('0x31');respondWithRpcPromise(_0xd484('0x6f'),_0xd484('0x6f'),{'event':_0xd484('0x76'),'message':_0x52b1e3[_0xd484('0x24')]},client9002);return _0x2fb693;}return null;})['then'](respondWithResult(_0x473df7,null))['catch'](handleError(_0x473df7,null));};exports[_0xd484('0x77')]=function(_0x4b56e0,_0x2558e7){var _0x15d9be;return db[_0xd484('0x54')]['create'](_0x4b56e0[_0xd484('0x3a')],{})[_0xd484('0x34')](function(_0x5b02e7){_0x15d9be=_0x5b02e7;return db[_0xd484('0x63')]['findOne']({'where':{'id':_0x15d9be[_0xd484('0x78')]}});})[_0xd484('0x34')](function(_0x4e18e3){if(_['isNil'](_0x4e18e3)){return;}else{_0x15d9be[_0xd484('0x5e')]=_0x4e18e3[_0xd484('0x5e')];return db['Attachment'][_0xd484('0x79')]({'where':{'id':_0x15d9be[_0xd484('0x7a')]}});}})['then'](function(_0x145ac7){return respondWithRpcPromise(_0xd484('0x7b'),'SendFax',{'FaxAccountId':_[_0xd484('0x7c')](_0x4b56e0[_0xd484('0x3a')])?undefined:_0x4b56e0[_0xd484('0x3a')][_0xd484('0x7d')],'path':_[_0xd484('0x7c')](_0x145ac7)?undefined:util['format'](_0xd484('0x7e'),_0x145ac7[_0xd484('0x7f')]),'fax':_[_0xd484('0x7c')](_0x15d9be[_0xd484('0x5e')])?undefined:_0x15d9be[_0xd484('0x5e')],'AttachmentId':_0x15d9be['AttachmentId']},client9002);})[_0xd484('0x34')](respondWithResult(_0x2558e7,0xc9))[_0xd484('0x26')](handleError(_0x2558e7,null));};exports[_0xd484('0x80')]=function(_0x44a5aa,_0x5a162d){var _0x50d438=path[_0xd484('0x81')](config[_0xd484('0x82')],'server','files','attachments');return db[_0xd484('0x54')][_0xd484('0x5a')]({'where':{'id':_0x44a5aa[_0xd484('0x57')]['id']},'include':[{'model':db['Attachment'],'as':_0xd484('0x83')}]})['then'](handleEntityNotFound(_0x5a162d,null))[_0xd484('0x34')](function(_0x4cccc5){if(_0x4cccc5){return _0x5a162d[_0xd484('0x80')](path['join'](_0x50d438,_0x4cccc5[_0xd484('0x83')][_0xd484('0x7f')]));}})[_0xd484('0x26')](handleError(_0x5a162d,null));}; \ No newline at end of file +var _0xdb45=['bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','offset','limit','undefined','count','status','json','apply','update','destroy','stack','name','send','render','merge','body','contact','agent','account','map','FaxMessage','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','describe','../../config/logger','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','rejectmessage','create','findOne','ContactId','Attachment','SendFax','FaxAccountId','basename','download','server','files','attachments','zip-dir','fast-json-patch','moment'];(function(_0x1764dc,_0x2a6a26){var _0x232256=function(_0x452ffa){while(--_0x452ffa){_0x1764dc['push'](_0x1764dc['shift']());}};_0x232256(++_0x2a6a26);}(_0xdb45,0x10f));var _0x5db4=function(_0x9a752,_0x21804b){_0x9a752=_0x9a752-0x0;var _0x433b74=_0xdb45[_0x9a752];return _0x433b74;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5db4('0x0'));var jsonpatch=require(_0x5db4('0x1'));var rp=require('request-promise');var moment=require(_0x5db4('0x2'));var BPromise=require(_0x5db4('0x3'));var Mustache=require(_0x5db4('0x4'));var util=require(_0x5db4('0x5'));var path=require(_0x5db4('0x6'));var sox=require(_0x5db4('0x7'));var csv=require(_0x5db4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5db4('0x9'));var _=require(_0x5db4('0xa'));var squel=require('squel');var crypto=require(_0x5db4('0xb'));var jsforce=require(_0x5db4('0xc'));var deskjs=require(_0x5db4('0xd'));var toCsv=require(_0x5db4('0x8'));var querystring=require(_0x5db4('0xe'));var Papa=require('papaparse');var Redis=require(_0x5db4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5db4('0x10'));var as=require(_0x5db4('0x11'));var hardwareService=require(_0x5db4('0x12'));var logger=require('../../config/logger')(_0x5db4('0x13'));var utils=require(_0x5db4('0x14'));var config=require(_0x5db4('0x15'));var licenseUtil=require(_0x5db4('0x16'));var db=require('../../mysqldb')['db'];config[_0x5db4('0x17')]=_[_0x5db4('0x18')](config[_0x5db4('0x17')],{'host':_0x5db4('0x19'),'port':0x18eb});var socket=require(_0x5db4('0x1a'))(new Redis(config['redis']));require(_0x5db4('0x1b'))[_0x5db4('0x1c')](socket);var jayson=require(_0x5db4('0x1d'));var client=jayson['client'][_0x5db4('0x1e')]({'port':0x232c});var client9002=jayson[_0x5db4('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21c2e7,_0x2c6167,_0xf169ba,_0x10de51){return new BPromise(function(_0x5c33ff,_0x3e843d){var _0x458798=_0x10de51||client;return _0x458798[_0x5db4('0x20')](_0x21c2e7,_0xf169ba)[_0x5db4('0x21')](function(_0x2f1d25){logger[_0x5db4('0x22')](_0x5db4('0x23'),_0x2c6167,_0x5db4('0x24'));logger[_0x5db4('0x25')](_0x5db4('0x26'),_0x2c6167,_0x5db4('0x24'),JSON[_0x5db4('0x27')](_0x2f1d25));if(_0x2f1d25['error']){if(_0x2f1d25[_0x5db4('0x28')][_0x5db4('0x29')]===0x1f4){logger['error'](_0x5db4('0x23'),_0x2c6167,_0x2f1d25[_0x5db4('0x28')]['message']);return _0x3e843d(_0x2f1d25['error'][_0x5db4('0x2a')]);}logger[_0x5db4('0x28')](_0x5db4('0x23'),_0x2c6167,_0x2f1d25[_0x5db4('0x28')][_0x5db4('0x2a')]);return _0x5c33ff(_0x2f1d25[_0x5db4('0x28')]['message']);}else{logger[_0x5db4('0x22')]('FaxMessage,\x20%s,\x20%s',_0x2c6167,_0x5db4('0x24'));_0x5c33ff(_0x2f1d25[_0x5db4('0x2b')][_0x5db4('0x2a')]);}})[_0x5db4('0x2c')](function(_0x353992){logger[_0x5db4('0x28')](_0x5db4('0x23'),_0x2c6167,_0x353992);_0x3e843d(_0x353992);});});}function respondWithStatusCode(_0xd9d9f6,_0x1ea535){_0x1ea535=_0x1ea535||0xcc;return function(_0x3bee9a){if(_0x3bee9a){return _0xd9d9f6[_0x5db4('0x2d')](_0x1ea535);}return _0xd9d9f6['status'](_0x1ea535)['end']();};}function respondWithResult(_0x29b5b7,_0x3fa5d5){_0x3fa5d5=_0x3fa5d5||0xc8;return function(_0x562838){if(_0x562838){return _0x29b5b7['status'](_0x3fa5d5)['json'](_0x562838);}};}function respondWithFilteredResult(_0x8a2598,_0x1fbe30){return function(_0x45e46f){if(_0x45e46f){var _0xbdec59=typeof _0x1fbe30[_0x5db4('0x2e')]==='undefined'&&typeof _0x1fbe30[_0x5db4('0x2f')]===_0x5db4('0x30');var _0x27d35a=_0x45e46f['count'];var _0x29d845=_0xbdec59?0x0:_0x1fbe30[_0x5db4('0x2e')];var _0x4be531=_0xbdec59?_0x45e46f[_0x5db4('0x31')]:_0x1fbe30['offset']+_0x1fbe30[_0x5db4('0x2f')];var _0x4d9b90;if(_0x4be531>=_0x27d35a){_0x4be531=_0x27d35a;_0x4d9b90=0xc8;}else{_0x4d9b90=0xce;}_0x8a2598[_0x5db4('0x32')](_0x4d9b90);return _0x8a2598['set']('Content-Range',_0x29d845+'-'+_0x4be531+'/'+_0x27d35a)[_0x5db4('0x33')](_0x45e46f);}return null;};}function patchUpdates(_0x53a134){return function(_0xf2dfb1){try{jsonpatch[_0x5db4('0x34')](_0xf2dfb1,_0x53a134,!![]);}catch(_0x44cbcb){return BPromise['reject'](_0x44cbcb);}return _0xf2dfb1['save']();};}function saveUpdates(_0x646ae6,_0x3aeec5){return function(_0x4b138d){if(_0x4b138d){return _0x4b138d[_0x5db4('0x35')](_0x646ae6)[_0x5db4('0x21')](function(_0x4c7809){return _0x4c7809;});}return null;};}function removeEntity(_0x1f3a7d,_0x28b060){return function(_0x982707){if(_0x982707){return _0x982707[_0x5db4('0x36')]()[_0x5db4('0x21')](function(){_0x1f3a7d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cff45,_0x53cfe2){return function(_0x588e68){if(!_0x588e68){_0x3cff45[_0x5db4('0x2d')](0x194);}return _0x588e68;};}function handleError(_0x5c4214,_0x14154d){_0x14154d=_0x14154d||0x1f4;return function(_0x1ab426){logger[_0x5db4('0x28')](_0x1ab426[_0x5db4('0x37')]);if(_0x1ab426[_0x5db4('0x38')]){delete _0x1ab426['name'];}_0x5c4214[_0x5db4('0x32')](_0x14154d)[_0x5db4('0x39')](_0x1ab426);};}function getMustacheRender(_0x314cd2,_0x2410aa){return Mustache[_0x5db4('0x3a')](_0x314cd2,_[_0x5db4('0x3b')](_0x2410aa[_0x5db4('0x3c')],{'contact':_0x2410aa[_0x5db4('0x3d')],'message':_0x2410aa['message'],'agent':_0x2410aa[_0x5db4('0x3e')],'interaction':_0x2410aa['interaction'],'account':_0x2410aa[_0x5db4('0x3f')]}))||'';}exports['index']=function(_0x4a5dba,_0x1d178b){var _0x5755b4={},_0x3f3606={},_0x18f62e={'count':0x0,'rows':[]};var _0x466ac1=_[_0x5db4('0x40')](db[_0x5db4('0x41')]['rawAttributes'],function(_0x4f64e9){return{'name':_0x4f64e9[_0x5db4('0x42')],'type':_0x4f64e9[_0x5db4('0x43')][_0x5db4('0x44')]};});_0x3f3606[_0x5db4('0x45')]=_['map'](_0x466ac1,_0x5db4('0x38'));_0x3f3606[_0x5db4('0x46')]=_['keys'](_0x4a5dba['query']);_0x3f3606['filters']=_['intersection'](_0x3f3606[_0x5db4('0x45')],_0x3f3606[_0x5db4('0x46')]);_0x5755b4[_0x5db4('0x47')]=_[_0x5db4('0x48')](_0x3f3606['model'],qs[_0x5db4('0x49')](_0x4a5dba['query'][_0x5db4('0x49')]));_0x5755b4[_0x5db4('0x47')]=_0x5755b4[_0x5db4('0x47')][_0x5db4('0x4a')]?_0x5755b4['attributes']:_0x3f3606[_0x5db4('0x45')];if(!_0x4a5dba[_0x5db4('0x46')][_0x5db4('0x4b')]('nolimit')){_0x5755b4['limit']=qs[_0x5db4('0x2f')](_0x4a5dba[_0x5db4('0x46')][_0x5db4('0x2f')]);_0x5755b4[_0x5db4('0x2e')]=qs[_0x5db4('0x2e')](_0x4a5dba[_0x5db4('0x46')][_0x5db4('0x2e')]);}_0x5755b4[_0x5db4('0x4c')]=qs[_0x5db4('0x4d')](_0x4a5dba['query'][_0x5db4('0x4d')]);_0x5755b4['where']=qs[_0x5db4('0x4e')](_['pick'](_0x4a5dba[_0x5db4('0x46')],_0x3f3606['filters']),_0x466ac1);if(_0x4a5dba[_0x5db4('0x46')][_0x5db4('0x4f')]){_0x5755b4['where']=_['merge'](_0x5755b4[_0x5db4('0x50')],{'$or':_[_0x5db4('0x40')](_0x466ac1,function(_0x518018){if(_0x518018[_0x5db4('0x43')]!==_0x5db4('0x51')){var _0x26443f={};_0x26443f[_0x518018['name']]={'$like':'%'+_0x4a5dba[_0x5db4('0x46')][_0x5db4('0x4f')]+'%'};return _0x26443f;}})});}_0x5755b4=_[_0x5db4('0x3b')]({},_0x5755b4,_0x4a5dba[_0x5db4('0x52')]);var _0xa15420={'where':_0x5755b4[_0x5db4('0x50')]};return db[_0x5db4('0x41')][_0x5db4('0x31')](_0xa15420)['then'](function(_0x4a2082){_0x18f62e['count']=_0x4a2082;if(_0x4a5dba[_0x5db4('0x46')][_0x5db4('0x53')]){_0x5755b4[_0x5db4('0x54')]=[{'all':!![]}];}return db[_0x5db4('0x41')][_0x5db4('0x55')](_0x5755b4);})[_0x5db4('0x21')](function(_0x316389){_0x18f62e[_0x5db4('0x56')]=_0x316389;return _0x18f62e;})[_0x5db4('0x21')](respondWithFilteredResult(_0x1d178b,_0x5755b4))['catch'](handleError(_0x1d178b,null));};exports[_0x5db4('0x57')]=function(_0x3f38a1,_0x129a90){var _0x320e75={'raw':!![],'where':{'id':_0x3f38a1[_0x5db4('0x58')]['id']}},_0x3941c8={};_0x3941c8[_0x5db4('0x45')]=_[_0x5db4('0x59')](db[_0x5db4('0x41')][_0x5db4('0x5a')]);_0x3941c8[_0x5db4('0x46')]=_[_0x5db4('0x59')](_0x3f38a1[_0x5db4('0x46')]);_0x3941c8[_0x5db4('0x4e')]=_['intersection'](_0x3941c8[_0x5db4('0x45')],_0x3941c8[_0x5db4('0x46')]);_0x320e75[_0x5db4('0x47')]=_[_0x5db4('0x48')](_0x3941c8['model'],qs[_0x5db4('0x49')](_0x3f38a1[_0x5db4('0x46')]['fields']));_0x320e75[_0x5db4('0x47')]=_0x320e75[_0x5db4('0x47')][_0x5db4('0x4a')]?_0x320e75[_0x5db4('0x47')]:_0x3941c8[_0x5db4('0x45')];if(_0x3f38a1[_0x5db4('0x46')][_0x5db4('0x53')]){_0x320e75[_0x5db4('0x54')]=[{'all':!![]}];}_0x320e75=_[_0x5db4('0x3b')]({},_0x320e75,_0x3f38a1['options']);return db[_0x5db4('0x41')][_0x5db4('0x5b')](_0x320e75)[_0x5db4('0x21')](handleEntityNotFound(_0x129a90,null))[_0x5db4('0x21')](respondWithResult(_0x129a90,null))[_0x5db4('0x2c')](handleError(_0x129a90,null));};exports[_0x5db4('0x35')]=function(_0x5efe2c,_0x1c586e){if(_0x5efe2c['body']['id']){delete _0x5efe2c[_0x5db4('0x3c')]['id'];}return db[_0x5db4('0x41')]['find']({'where':{'id':_0x5efe2c[_0x5db4('0x58')]['id']}})[_0x5db4('0x21')](handleEntityNotFound(_0x1c586e,null))[_0x5db4('0x21')](saveUpdates(_0x5efe2c[_0x5db4('0x3c')],null))[_0x5db4('0x21')](respondWithResult(_0x1c586e,null))['catch'](handleError(_0x1c586e,null));};exports[_0x5db4('0x36')]=function(_0x5f4889,_0x3d45de){return db[_0x5db4('0x41')][_0x5db4('0x5b')]({'where':{'id':_0x5f4889[_0x5db4('0x58')]['id']}})[_0x5db4('0x21')](handleEntityNotFound(_0x3d45de,null))[_0x5db4('0x21')](removeEntity(_0x3d45de,null))[_0x5db4('0x2c')](handleError(_0x3d45de,null));};exports[_0x5db4('0x5c')]=function(_0x4a84d0,_0x3caac7){return db[_0x5db4('0x41')][_0x5db4('0x5c')]()[_0x5db4('0x21')](respondWithResult(_0x3caac7,null))[_0x5db4('0x2c')](handleError(_0x3caac7,null));};var interaction_log=require(_0x5db4('0x5d'))(_0x5db4('0x5e'));exports[_0x5db4('0x5f')]=function(_0x2103cf,_0x245238,_0x1b917b){var _0x552812={'agent':{},'channel':_0x5db4('0x60')};if(_0x2103cf['body']['id']){delete _0x2103cf[_0x5db4('0x3c')]['id'];}_0x2103cf[_0x5db4('0x3c')][_0x5db4('0x61')]=!![];_0x2103cf['body']['readAt']=moment()[_0x5db4('0x62')](_0x5db4('0x63'));_0x2103cf['body'][_0x5db4('0x64')]=_0x2103cf[_0x5db4('0x3c')][_0x5db4('0x64')]||_0x2103cf[_0x5db4('0x65')]['id'];_0x552812['agent']['id']=_0x2103cf[_0x5db4('0x3c')][_0x5db4('0x64')];return db['FaxMessage'][_0x5db4('0x5b')]({'where':{'id':_0x2103cf['params']['id'],'UserId':null},'include':[{'model':db[_0x5db4('0x66')],'as':'Contact'}]})[_0x5db4('0x21')](handleEntityNotFound(_0x245238,null))[_0x5db4('0x21')](saveUpdates(_0x2103cf['body'],null))['then'](function(_0x5a0d59){if(_0x5a0d59){_0x552812['message']=_0x5a0d59[_0x5db4('0x67')]({'plain':!![]});return db[_0x5db4('0x68')][_0x5db4('0x5b')]({'where':{'id':_0x5a0d59[_0x5db4('0x69')]}});}return null;})[_0x5db4('0x21')](handleEntityNotFound(_0x245238,null))[_0x5db4('0x21')](function(_0x4544a5){if(_0x4544a5){return _0x4544a5[_0x5db4('0x35')]({'UserId':_0x2103cf['body']['UserId'],'read1stAt':_[_0x5db4('0x6a')](_0x4544a5[_0x5db4('0x6b')])?moment()[_0x5db4('0x62')](_0x5db4('0x63')):undefined});}return null;})[_0x5db4('0x21')](function(_0x1018b0){if(_0x1018b0){_0x552812[_0x5db4('0x6c')]=_0x1018b0[_0x5db4('0x67')]({'plain':!![]});interaction_log[_0x5db4('0x22')](_0x5db4('0x6d'),_0x2103cf[_0x5db4('0x65')]['id'],_0x2103cf[_0x5db4('0x65')][_0x5db4('0x38')],_0x2103cf[_0x5db4('0x65')]['role'],_0x552812['interaction']['id'],_0x2103cf[_0x5db4('0x3c')]?JSON[_0x5db4('0x27')](_0x2103cf[_0x5db4('0x3c')]):'null');return respondWithRpcPromise(_0x5db4('0x6e'),_0x5db4('0x6f'),_0x552812);}return null;})[_0x5db4('0x21')](function(_0x98cad2){if(_0x98cad2){if(_0x2103cf[_0x5db4('0x3c')][_0x5db4('0x70')]){_0x552812[_0x5db4('0x2a')][_0x5db4('0x71')]=util[_0x5db4('0x62')](_0x5db4('0x72'),_0x2103cf[_0x5db4('0x65')][_0x5db4('0x38')]);_0x552812[_0x5db4('0x2a')][_0x5db4('0x73')]=_0x552812[_0x5db4('0x73')];_0x552812[_0x5db4('0x2a')][_0x5db4('0x74')]=_0x5db4('0x5f');return respondWithRpcPromise(_0x5db4('0x75'),_0x5db4('0x75'),{'event':_0x5db4('0x76'),'message':_0x552812[_0x5db4('0x2a')]},client9002)[_0x5db4('0x21')](function(){return _0x552812;});}return _0x552812;}return null;})['then'](respondWithResult(_0x245238,null))[_0x5db4('0x2c')](handleError(_0x245238,null));};var interaction_log=require(_0x5db4('0x5d'))(_0x5db4('0x5e'));exports[_0x5db4('0x77')]=function(_0x42f3b3,_0x1e7870,_0x2b5831){var _0x21d76b={'agent':{},'channel':'fax'};if(_0x42f3b3['body']['id']){delete _0x42f3b3[_0x5db4('0x3c')]['id'];}_0x42f3b3[_0x5db4('0x3c')][_0x5db4('0x64')]=_0x42f3b3[_0x5db4('0x3c')][_0x5db4('0x64')]||_0x42f3b3[_0x5db4('0x65')]['id'];_0x21d76b['agent']['id']=_0x42f3b3[_0x5db4('0x3c')][_0x5db4('0x64')];return db[_0x5db4('0x41')][_0x5db4('0x5b')]({'where':{'id':_0x42f3b3[_0x5db4('0x58')]['id'],'UserId':null}})[_0x5db4('0x21')](handleEntityNotFound(_0x1e7870,null))[_0x5db4('0x21')](function(_0x515980){if(_0x515980){_0x21d76b[_0x5db4('0x2a')]=_0x515980['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x515980['FaxInteractionId']}});}return null;})[_0x5db4('0x21')](handleEntityNotFound(_0x1e7870,null))[_0x5db4('0x21')](function(_0x174066){if(_0x174066){_0x21d76b[_0x5db4('0x6c')]=_0x174066['get']({'plain':!![]});interaction_log[_0x5db4('0x22')](_0x5db4('0x78'),_0x42f3b3[_0x5db4('0x65')]['id'],_0x42f3b3['user'][_0x5db4('0x38')],_0x42f3b3[_0x5db4('0x65')][_0x5db4('0x79')],_0x21d76b[_0x5db4('0x6c')]['id'],_0x42f3b3[_0x5db4('0x3c')]?JSON['stringify'](_0x42f3b3[_0x5db4('0x3c')]):_0x5db4('0x7a'));return respondWithRpcPromise(_0x5db4('0x7b'),_0x5db4('0x7c'),_0x21d76b);}return null;})[_0x5db4('0x21')](function(_0x196f11){if(_0x196f11){_0x196f11[_0x5db4('0x2a')]['interface']=util[_0x5db4('0x62')](_0x5db4('0x72'),_0x42f3b3[_0x5db4('0x65')][_0x5db4('0x38')]);_0x196f11[_0x5db4('0x2a')][_0x5db4('0x73')]=_0x21d76b['channel'];_0x196f11[_0x5db4('0x2a')]['event']='reject';respondWithRpcPromise('EventManager',_0x5db4('0x75'),{'event':_0x5db4('0x7d'),'message':_0x196f11['message']},client9002);return _0x21d76b;}return null;})['then'](respondWithResult(_0x1e7870,null))[_0x5db4('0x2c')](handleError(_0x1e7870,null));};exports[_0x5db4('0x7e')]=function(_0xe0e2d,_0x5ebdb3){var _0x5b0740;return db[_0x5db4('0x41')]['create'](_0xe0e2d[_0x5db4('0x3c')],{})[_0x5db4('0x21')](function(_0x56155f){_0x5b0740=_0x56155f;return db['CmContact'][_0x5db4('0x7f')]({'where':{'id':_0x5b0740[_0x5db4('0x80')]}});})[_0x5db4('0x21')](function(_0xf2b257){if(_[_0x5db4('0x6a')](_0xf2b257)){return;}else{_0x5b0740[_0x5db4('0x60')]=_0xf2b257['fax'];return db[_0x5db4('0x81')][_0x5db4('0x7f')]({'where':{'id':_0x5b0740['AttachmentId']}});}})['then'](function(_0x18b208){return respondWithRpcPromise(_0x5db4('0x82'),_0x5db4('0x82'),{'FaxAccountId':_[_0x5db4('0x6a')](_0xe0e2d['body'])?undefined:_0xe0e2d[_0x5db4('0x3c')][_0x5db4('0x83')],'path':_[_0x5db4('0x6a')](_0x18b208)?undefined:util[_0x5db4('0x62')]('/var/opt/motion2/server/files/attachments/%s',_0x18b208[_0x5db4('0x84')]),'fax':_['isNil'](_0x5b0740['fax'])?undefined:_0x5b0740[_0x5db4('0x60')],'AttachmentId':_0x5b0740['AttachmentId']},client9002);})[_0x5db4('0x21')](respondWithResult(_0x5ebdb3,0xc9))[_0x5db4('0x2c')](handleError(_0x5ebdb3,null));};exports[_0x5db4('0x85')]=function(_0x545ff4,_0x5288e5){var _0x434a82=path['join'](config['root'],_0x5db4('0x86'),_0x5db4('0x87'),_0x5db4('0x88'));return db['FaxMessage'][_0x5db4('0x5b')]({'where':{'id':_0x545ff4['params']['id']},'include':[{'model':db[_0x5db4('0x81')],'as':'Attachment'}]})[_0x5db4('0x21')](handleEntityNotFound(_0x5288e5,null))[_0x5db4('0x21')](function(_0x139e8e){if(_0x139e8e){return _0x5288e5[_0x5db4('0x85')](path['join'](_0x434a82,_0x139e8e[_0x5db4('0x81')][_0x5db4('0x84')]));}})['catch'](handleError(_0x5288e5,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 34e8a8c..391cd37 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 _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x34e8,0x12c));var _0x834e=function(_0x3c867b,_0x323ea9){_0x3c867b=_0x3c867b-0x0;var _0x342df1=_0x34e8[_0x3c867b];return _0x342df1;};'use strict';var EventEmitter=require(_0x834e('0x0'));var FaxMessage=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){FaxMessageEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);FaxMessageEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x34e8,0x12c));var _0x834e=function(_0x565b4f,_0x5465c8){_0x565b4f=_0x565b4f-0x0;var _0x2cbe0e=_0x34e8[_0x565b4f];return _0x2cbe0e;};'use strict';var EventEmitter=require(_0x834e('0x0'));var FaxMessage=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){FaxMessageEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);FaxMessageEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 80e2d54..8aa5dfa 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 _0xf256=['secret','isNil','UserId','FaxInteractionId','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0xf256,0x13d));var _0x6f25=function(_0x340e56,_0x4b49a1){_0x340e56=_0x340e56-0x0;var _0x4653c3=_0xf256[_0x340e56];return _0x4653c3;};'use strict';var _=require(_0x6f25('0x0'));var util=require(_0x6f25('0x1'));var logger=require('../../config/logger')(_0x6f25('0x2'));var moment=require(_0x6f25('0x3'));var BPromise=require('bluebird');var rp=require(_0x6f25('0x4'));var fs=require('fs');var path=require(_0x6f25('0x5'));var rimraf=require('rimraf');var config=require(_0x6f25('0x6'));var attributes=require(_0x6f25('0x7'));module[_0x6f25('0x8')]=function(_0x1495ff,_0x4e7581){return _0x1495ff[_0x6f25('0x9')](_0x6f25('0xa'),attributes,{'tableName':_0x6f25('0xb'),'paranoid':![],'indexes':[{'name':_0x6f25('0xc'),'fields':[_0x6f25('0xd')],'type':_0x6f25('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1db14e,_0x14a3b9,_0x3599bd){var _0x44fe9c=_0x1495ff[_0x6f25('0xf')];var _0x2613ef=_0x1db14e[_0x6f25('0x10')]({'plain':!![]});if(_0x2613ef[_0x6f25('0x11')]['toLowerCase']()==='in'||_0x2613ef[_0x6f25('0x11')][_0x6f25('0x12')]()==='out'&&!_0x2613ef[_0x6f25('0x13')]&&!_[_0x6f25('0x14')](_0x2613ef[_0x6f25('0x15')])){_0x44fe9c['FaxInteraction']['findOne']({'where':{'id':_0x2613ef[_0x6f25('0x16')]}})[_0x6f25('0x17')](function(_0x411c3a){if(_0x411c3a){_0x411c3a['update']({'lastMsgAt':_0x2613ef[_0x6f25('0x18')],'lastMsgDirection':_0x2613ef[_0x6f25('0x11')][_0x6f25('0x12')]()});}})[_0x6f25('0x19')](function(_0x2551ff){console['error'](_0x2551ff);});}_0x3599bd();}},'charset':_0x6f25('0x1a'),'collate':_0x6f25('0x1b')});}; \ No newline at end of file +var _0x31ac=['findOne','FaxInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x31ac,0xbc));var _0xc31a=function(_0x516577,_0x2c3de1){_0x516577=_0x516577-0x0;var _0x5c9d39=_0x31ac[_0x516577];return _0x5c9d39;};'use strict';var _=require('lodash');var util=require(_0xc31a('0x0'));var logger=require(_0xc31a('0x1'))(_0xc31a('0x2'));var moment=require(_0xc31a('0x3'));var BPromise=require(_0xc31a('0x4'));var rp=require(_0xc31a('0x5'));var fs=require('fs');var path=require(_0xc31a('0x6'));var rimraf=require('rimraf');var config=require(_0xc31a('0x7'));var attributes=require('./faxMessage.attributes');module[_0xc31a('0x8')]=function(_0x5c2eb3,_0x7a6d12){return _0x5c2eb3[_0xc31a('0x9')](_0xc31a('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xc31a('0xb'),'fields':[_0xc31a('0xc')],'type':_0xc31a('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c2f02,_0x3e587f,_0x545ffa){var _0x3551d6=_0x5c2eb3[_0xc31a('0xe')];var _0x5a9e7e=_0x4c2f02['get']({'plain':!![]});if(_0x5a9e7e[_0xc31a('0xf')][_0xc31a('0x10')]()==='in'||_0x5a9e7e[_0xc31a('0xf')][_0xc31a('0x10')]()===_0xc31a('0x11')&&!_0x5a9e7e[_0xc31a('0x12')]&&!_[_0xc31a('0x13')](_0x5a9e7e[_0xc31a('0x14')])){_0x3551d6[_0xc31a('0x15')][_0xc31a('0x16')]({'where':{'id':_0x5a9e7e[_0xc31a('0x17')]}})[_0xc31a('0x18')](function(_0x9e90e5){if(_0x9e90e5){_0x9e90e5[_0xc31a('0x19')]({'lastMsgAt':_0x5a9e7e['createdAt'],'lastMsgDirection':_0x5a9e7e[_0xc31a('0xf')]['toLowerCase']()});}})[_0xc31a('0x1a')](function(_0x307bdd){console[_0xc31a('0x1b')](_0x307bdd);});}_0x545ffa();}},'charset':_0xc31a('0x1c'),'collate':_0xc31a('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index d9436bf..6d92c23 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 _0x639a=['stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','create','options','raw','info','update','where','attributes','limit','debug','UpdateFaxMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','then','FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x446b7b,_0x824c95){var _0x43f1d5=function(_0x7b7873){while(--_0x7b7873){_0x446b7b['push'](_0x446b7b['shift']());}};_0x43f1d5(++_0x824c95);}(_0x639a,0x1e6));var _0xa639=function(_0x155320,_0x5d5e34){_0x155320=_0x155320-0x0;var _0x1dda69=_0x639a[_0x155320];return _0x1dda69;};'use strict';var _=require(_0xa639('0x0'));var util=require('util');var moment=require(_0xa639('0x1'));var BPromise=require('bluebird');var rs=require(_0xa639('0x2'));var fs=require('fs');var Redis=require(_0xa639('0x3'));var db=require(_0xa639('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa639('0x5'))(_0xa639('0x6'));var config=require(_0xa639('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa639('0x8')][_0xa639('0x9')]({'port':0x232a});config[_0xa639('0xa')]=_['defaults'](config[_0xa639('0xa')],{'host':_0xa639('0xb'),'port':0x18eb});var socket=require(_0xa639('0xc'))(new Redis(config[_0xa639('0xa')]));require('./faxMessage.socket')[_0xa639('0xd')](socket);function respondWithRpcPromise(_0x24ef63,_0xc23fe4,_0x58718a){return new BPromise(function(_0x2fe705,_0x2b30d3){return client['request'](_0x24ef63,_0x58718a)[_0xa639('0xe')](function(_0x2d1c33){logger['info'](_0xa639('0xf'),_0xc23fe4,'request\x20sent');logger['debug'](_0xa639('0x10'),_0xc23fe4,_0xa639('0x11'),JSON[_0xa639('0x12')](_0x2d1c33));if(_0x2d1c33[_0xa639('0x13')]){if(_0x2d1c33['error'][_0xa639('0x14')]===0x1f4){logger['error'](_0xa639('0xf'),_0xc23fe4,_0x2d1c33[_0xa639('0x13')][_0xa639('0x15')]);return _0x2b30d3(_0x2d1c33[_0xa639('0x13')][_0xa639('0x15')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0xc23fe4,_0x2d1c33[_0xa639('0x13')][_0xa639('0x15')]);return _0x2fe705(_0x2d1c33[_0xa639('0x13')]['message']);}else{logger['info'](_0xa639('0xf'),_0xc23fe4,_0xa639('0x11'));_0x2fe705(_0x2d1c33[_0xa639('0x16')][_0xa639('0x15')]);}})[_0xa639('0x17')](function(_0xe7e38f){logger[_0xa639('0x13')]('FaxMessage,\x20%s,\x20%s',_0xc23fe4,_0xe7e38f);_0x2b30d3(_0xe7e38f);});});}exports[_0xa639('0x18')]=function(_0x1df6ba){var _0xb137d=this;return new Promise(function(_0x4cac03,_0x23608c){return db[_0xa639('0x19')][_0xa639('0x1a')](_0x1df6ba['body'],{'raw':_0x1df6ba['options']?_0x1df6ba[_0xa639('0x1b')][_0xa639('0x1c')]===undefined?!![]:![]:!![]})[_0xa639('0xe')](function(_0x51794e){logger[_0xa639('0x1d')](_0xa639('0x18'),_0x1df6ba);logger['debug'](_0xa639('0x18'),_0x1df6ba,JSON[_0xa639('0x12')](_0x51794e));_0x4cac03(_0x51794e);})[_0xa639('0x17')](function(_0xd46313){logger[_0xa639('0x13')]('CreateFaxMessage',_0xd46313[_0xa639('0x15')],_0x1df6ba);_0x23608c(_0xb137d[_0xa639('0x13')](0x1f4,_0xd46313[_0xa639('0x15')]));});});};exports['UpdateFaxMessage']=function(_0x19cd04){var _0x18ac2b=this;return new Promise(function(_0xddfdf4,_0x2eb0cc){return db['FaxMessage'][_0xa639('0x1e')](_0x19cd04['body'],{'raw':_0x19cd04[_0xa639('0x1b')]?_0x19cd04['options'][_0xa639('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19cd04[_0xa639('0x1b')]?_0x19cd04['options'][_0xa639('0x1f')]||null:null,'attributes':_0x19cd04[_0xa639('0x1b')]?_0x19cd04['options'][_0xa639('0x20')]||null:null,'limit':_0x19cd04['options']?_0x19cd04[_0xa639('0x1b')][_0xa639('0x21')]||null:null})[_0xa639('0xe')](function(_0x5f4bc7){logger[_0xa639('0x1d')]('UpdateFaxMessage',_0x19cd04);logger[_0xa639('0x22')]('UpdateFaxMessage',_0x19cd04,JSON[_0xa639('0x12')](_0x5f4bc7));_0xddfdf4(_0x5f4bc7);})['catch'](function(_0x112463){logger[_0xa639('0x13')](_0xa639('0x23'),_0x112463[_0xa639('0x15')],_0x19cd04);_0x2eb0cc(_0x18ac2b[_0xa639('0x13')](0x1f4,_0x112463[_0xa639('0x15')]));});});}; \ No newline at end of file +var _0xa342=['info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','create','body','catch','UpdateFaxMessage','update','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxMessage.socket','then'];(function(_0x3b44e6,_0x535a52){var _0x29b17e=function(_0x264588){while(--_0x264588){_0x3b44e6['push'](_0x3b44e6['shift']());}};_0x29b17e(++_0x535a52);}(_0xa342,0x14e));var _0x2a34=function(_0x5382ca,_0x3ee668){_0x5382ca=_0x5382ca-0x0;var _0x37083c=_0xa342[_0x5382ca];return _0x37083c;};'use strict';var _=require(_0x2a34('0x0'));var util=require(_0x2a34('0x1'));var moment=require(_0x2a34('0x2'));var BPromise=require(_0x2a34('0x3'));var rs=require(_0x2a34('0x4'));var fs=require('fs');var Redis=require(_0x2a34('0x5'));var db=require(_0x2a34('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a34('0x7'))(_0x2a34('0x8'));var config=require(_0x2a34('0x9'));var jayson=require(_0x2a34('0xa'));var client=jayson[_0x2a34('0xb')][_0x2a34('0xc')]({'port':0x232a});config[_0x2a34('0xd')]=_['defaults'](config[_0x2a34('0xd')],{'host':_0x2a34('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2a34('0xd')]));require(_0x2a34('0xf'))['register'](socket);function respondWithRpcPromise(_0x25e5ef,_0x1590be,_0x5d357f){return new BPromise(function(_0x4fbad0,_0x39515e){return client['request'](_0x25e5ef,_0x5d357f)[_0x2a34('0x10')](function(_0x5715fd){logger[_0x2a34('0x11')]('FaxMessage,\x20%s,\x20%s',_0x1590be,_0x2a34('0x12'));logger[_0x2a34('0x13')](_0x2a34('0x14'),_0x1590be,_0x2a34('0x12'),JSON[_0x2a34('0x15')](_0x5715fd));if(_0x5715fd[_0x2a34('0x16')]){if(_0x5715fd[_0x2a34('0x16')][_0x2a34('0x17')]===0x1f4){logger[_0x2a34('0x16')](_0x2a34('0x18'),_0x1590be,_0x5715fd[_0x2a34('0x16')][_0x2a34('0x19')]);return _0x39515e(_0x5715fd[_0x2a34('0x16')][_0x2a34('0x19')]);}logger[_0x2a34('0x16')](_0x2a34('0x18'),_0x1590be,_0x5715fd[_0x2a34('0x16')][_0x2a34('0x19')]);return _0x4fbad0(_0x5715fd[_0x2a34('0x16')][_0x2a34('0x19')]);}else{logger['info'](_0x2a34('0x18'),_0x1590be,_0x2a34('0x12'));_0x4fbad0(_0x5715fd[_0x2a34('0x1a')]['message']);}})['catch'](function(_0x5dd6c9){logger['error'](_0x2a34('0x18'),_0x1590be,_0x5dd6c9);_0x39515e(_0x5dd6c9);});});}exports[_0x2a34('0x1b')]=function(_0xea5465){var _0x1861aa=this;return new Promise(function(_0x40dba4,_0x169b13){return db[_0x2a34('0x1c')][_0x2a34('0x1d')](_0xea5465[_0x2a34('0x1e')],{'raw':_0xea5465['options']?_0xea5465['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x256711){logger[_0x2a34('0x11')](_0x2a34('0x1b'),_0xea5465);logger[_0x2a34('0x13')](_0x2a34('0x1b'),_0xea5465,JSON[_0x2a34('0x15')](_0x256711));_0x40dba4(_0x256711);})[_0x2a34('0x1f')](function(_0x48697d){logger[_0x2a34('0x16')]('CreateFaxMessage',_0x48697d[_0x2a34('0x19')],_0xea5465);_0x169b13(_0x1861aa['error'](0x1f4,_0x48697d['message']));});});};exports[_0x2a34('0x20')]=function(_0x3f7853){var _0x25da32=this;return new Promise(function(_0x16d9cc,_0x87be2b){return db[_0x2a34('0x1c')][_0x2a34('0x21')](_0x3f7853['body'],{'raw':_0x3f7853[_0x2a34('0x22')]?_0x3f7853['options'][_0x2a34('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f7853[_0x2a34('0x22')]?_0x3f7853['options'][_0x2a34('0x24')]||null:null,'attributes':_0x3f7853[_0x2a34('0x22')]?_0x3f7853['options'][_0x2a34('0x25')]||null:null,'limit':_0x3f7853[_0x2a34('0x22')]?_0x3f7853[_0x2a34('0x22')][_0x2a34('0x26')]||null:null})['then'](function(_0x548781){logger[_0x2a34('0x11')](_0x2a34('0x20'),_0x3f7853);logger[_0x2a34('0x13')](_0x2a34('0x20'),_0x3f7853,JSON['stringify'](_0x548781));_0x16d9cc(_0x548781);})[_0x2a34('0x1f')](function(_0x44474c){logger[_0x2a34('0x16')](_0x2a34('0x20'),_0x44474c['message'],_0x3f7853);_0x87be2b(_0x25da32[_0x2a34('0x16')](0x1f4,_0x44474c['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 123089c..df3bf74 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x11309c,_0xe18a74){var _0x3fea9c=function(_0xeb11c3){while(--_0xeb11c3){_0x11309c['push'](_0x11309c['shift']());}};_0x3fea9c(++_0xe18a74);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var FaxMessageEvents=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(){FaxMessageEvents[_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);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 8384814..90f28c7 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 _0xeda6=['../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','post','tracked','faxmessage:create','create','put','accept','/:id/reject','delete','exports','multer','express','Router','fs-extra','../../components/auth/service'];(function(_0x2e3ea2,_0x8097ae){var _0x440961=function(_0x2e929f){while(--_0x2e929f){_0x2e3ea2['push'](_0x2e3ea2['shift']());}};_0x440961(++_0x8097ae);}(_0xeda6,0xa3));var _0x6eda=function(_0x42c824,_0x39936d){_0x42c824=_0x42c824-0x0;var _0x494fec=_0xeda6[_0x42c824];return _0x494fec;};'use strict';var multer=require(_0x6eda('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6eda('0x1'));var router=express[_0x6eda('0x2')]();var fs_extra=require(_0x6eda('0x3'));var auth=require(_0x6eda('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6eda('0x5'));var controller=require(_0x6eda('0x6'));router[_0x6eda('0x7')]('/',auth[_0x6eda('0x8')](),controller[_0x6eda('0x9')]);router['get'](_0x6eda('0xa'),auth[_0x6eda('0x8')](),controller[_0x6eda('0xb')]);router[_0x6eda('0x7')](_0x6eda('0xc'),auth[_0x6eda('0x8')](),controller[_0x6eda('0xd')]);router['get']('/:id/download',auth[_0x6eda('0x8')](),controller[_0x6eda('0xe')]);router[_0x6eda('0xf')]('/',auth[_0x6eda('0x8')](),interaction[_0x6eda('0x10')]('fax',_0x6eda('0x11')),controller[_0x6eda('0x12')]);router[_0x6eda('0x13')](_0x6eda('0xc'),auth[_0x6eda('0x8')](),controller['update']);router[_0x6eda('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0x6eda('0x14')]);router['put'](_0x6eda('0x15'),auth[_0x6eda('0x8')](),controller['reject']);router[_0x6eda('0x16')](_0x6eda('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x6eda('0x17')]=router; \ No newline at end of file +var _0xa06a=['reject','delete','multer','util','connect-timeout','express','../../components/interaction/service','./faxMessage.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/download','post','fax','faxmessage:create','create','update','/:id/accept','accept','put','/:id/reject'];(function(_0xba5c11,_0x42854b){var _0x52503e=function(_0x2176e5){while(--_0x2176e5){_0xba5c11['push'](_0xba5c11['shift']());}};_0x52503e(++_0x42854b);}(_0xa06a,0x122));var _0xaa06=function(_0x3a2043,_0x5d3bf6){_0x3a2043=_0x3a2043-0x0;var _0x3723ae=_0xa06a[_0x3a2043];return _0x3723ae;};'use strict';var multer=require(_0xaa06('0x0'));var util=require(_0xaa06('0x1'));var path=require('path');var timeout=require(_0xaa06('0x2'));var express=require(_0xaa06('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaa06('0x4'));var config=require('../../config/environment');var controller=require(_0xaa06('0x5'));router['get']('/',auth[_0xaa06('0x6')](),controller[_0xaa06('0x7')]);router[_0xaa06('0x8')](_0xaa06('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xaa06('0xa'),auth[_0xaa06('0x6')](),controller[_0xaa06('0xb')]);router[_0xaa06('0x8')](_0xaa06('0xc'),auth[_0xaa06('0x6')](),controller['download']);router[_0xaa06('0xd')]('/',auth[_0xaa06('0x6')](),interaction['tracked'](_0xaa06('0xe'),_0xaa06('0xf')),controller[_0xaa06('0x10')]);router['put'](_0xaa06('0xa'),auth[_0xaa06('0x6')](),controller[_0xaa06('0x11')]);router['put'](_0xaa06('0x12'),auth[_0xaa06('0x6')](),controller[_0xaa06('0x13')]);router[_0xaa06('0x14')](_0xaa06('0x15'),auth['isAuthenticated'](),controller[_0xaa06('0x16')]);router[_0xaa06('0x17')](_0xaa06('0xa'),auth[_0xaa06('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 55aee81..765c036 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 _0xa45d=['STRING','INTEGER','ENUM','rrmemory','sequelize','exports','name'];(function(_0x17b45d,_0x36b325){var _0x486a5b=function(_0x12ef2c){while(--_0x12ef2c){_0x17b45d['push'](_0x17b45d['shift']());}};_0x486a5b(++_0x36b325);}(_0xa45d,0x19a));var _0xda45=function(_0x38c27c,_0x19eb07){_0x38c27c=_0x38c27c-0x0;var _0x216212=_0xa45d[_0x38c27c];return _0x216212;};'use strict';var Sequelize=require(_0xda45('0x0'));module[_0xda45('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xda45('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xda45('0x3')]},'timeout':{'type':Sequelize[_0xda45('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xda45('0x5')](_0xda45('0x6'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4d59=['roundrobin','sequelize','exports','STRING','INTEGER','beepall'];(function(_0x10b719,_0x5b4b37){var _0x1037ca=function(_0x153d31){while(--_0x153d31){_0x10b719['push'](_0x10b719['shift']());}};_0x1037ca(++_0x5b4b37);}(_0x4d59,0x6d));var _0x94d5=function(_0x499b42,_0x287e10){_0x499b42=_0x499b42-0x0;var _0x32945f=_0x4d59[_0x499b42];return _0x32945f;};'use strict';var Sequelize=require(_0x94d5('0x0'));module[_0x94d5('0x1')]={'name':{'type':Sequelize[_0x94d5('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x94d5('0x2')]},'timeout':{'type':Sequelize[_0x94d5('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x94d5('0x4'),_0x94d5('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x94d5('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index e336a49..01573f6 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 _0xb458=['limit','count','apply','reject','save','then','destroy','FaxQueues','UserProfileResource','error','stack','name','send','render','merge','body','contact','message','interaction','FaxQueue','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','compact','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined'];(function(_0x28f68a,_0x29ee6e){var _0x3042e6=function(_0x4af414){while(--_0x4af414){_0x28f68a['push'](_0x28f68a['shift']());}};_0x3042e6(++_0x29ee6e);}(_0xb458,0x103));var _0x8b45=function(_0x50356c,_0xa24584){_0x50356c=_0x50356c-0x0;var _0x1c5b27=_0xb458[_0x50356c];return _0x1c5b27;};'use strict';var emlformat=require(_0x8b45('0x0'));var rimraf=require(_0x8b45('0x1'));var zipdir=require(_0x8b45('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8b45('0x3'));var BPromise=require(_0x8b45('0x4'));var Mustache=require(_0x8b45('0x5'));var util=require(_0x8b45('0x6'));var path=require('path');var sox=require(_0x8b45('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b45('0x8'));var _=require(_0x8b45('0x9'));var squel=require(_0x8b45('0xa'));var crypto=require(_0x8b45('0xb'));var jsforce=require(_0x8b45('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8b45('0xd'));var querystring=require(_0x8b45('0xe'));var Papa=require(_0x8b45('0xf'));var Redis=require(_0x8b45('0x10'));var authService=require(_0x8b45('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8b45('0x12'));var hardwareService=require(_0x8b45('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8b45('0x14'));var db=require(_0x8b45('0x15'))['db'];config[_0x8b45('0x16')]=_['defaults'](config[_0x8b45('0x16')],{'host':_0x8b45('0x17'),'port':0x18eb});var socket=require(_0x8b45('0x18'))(new Redis(config[_0x8b45('0x16')]));require(_0x8b45('0x19'))[_0x8b45('0x1a')](socket);function respondWithStatusCode(_0x5f0b20,_0x5a14c1){_0x5a14c1=_0x5a14c1||0xcc;return function(_0x45881c){if(_0x45881c){return _0x5f0b20[_0x8b45('0x1b')](_0x5a14c1);}return _0x5f0b20[_0x8b45('0x1c')](_0x5a14c1)[_0x8b45('0x1d')]();};}function respondWithResult(_0x4781d7,_0x27ebb3){_0x27ebb3=_0x27ebb3||0xc8;return function(_0x902c50){if(_0x902c50){return _0x4781d7[_0x8b45('0x1c')](_0x27ebb3)[_0x8b45('0x1e')](_0x902c50);}};}function respondWithFilteredResult(_0x391d1e,_0x287a3b){return function(_0x21d5b2){if(_0x21d5b2){var _0x1ed5ca=typeof _0x287a3b[_0x8b45('0x1f')]===_0x8b45('0x20')&&typeof _0x287a3b[_0x8b45('0x21')]===_0x8b45('0x20');var _0x309e23=_0x21d5b2['count'];var _0x25e8a1=_0x1ed5ca?0x0:_0x287a3b[_0x8b45('0x1f')];var _0x1767d5=_0x1ed5ca?_0x21d5b2[_0x8b45('0x22')]:_0x287a3b[_0x8b45('0x1f')]+_0x287a3b[_0x8b45('0x21')];var _0x2f4f1c;if(_0x1767d5>=_0x309e23){_0x1767d5=_0x309e23;_0x2f4f1c=0xc8;}else{_0x2f4f1c=0xce;}_0x391d1e[_0x8b45('0x1c')](_0x2f4f1c);return _0x391d1e['set']('Content-Range',_0x25e8a1+'-'+_0x1767d5+'/'+_0x309e23)[_0x8b45('0x1e')](_0x21d5b2);}return null;};}function patchUpdates(_0x580e17){return function(_0x1952fc){try{jsonpatch[_0x8b45('0x23')](_0x1952fc,_0x580e17,!![]);}catch(_0x30f405){return BPromise[_0x8b45('0x24')](_0x30f405);}return _0x1952fc[_0x8b45('0x25')]();};}function saveUpdates(_0x2b8526,_0x32b12b){return function(_0x5563eb){if(_0x5563eb){return _0x5563eb['update'](_0x2b8526)[_0x8b45('0x26')](function(_0x2c2c06){return _0x2c2c06;});}return null;};}function removeEntity(_0x500044,_0x5723a2){return function(_0x129c35){if(_0x129c35){return _0x129c35[_0x8b45('0x27')]()[_0x8b45('0x26')](function(){var _0x2f37bc=_0x129c35['get']({'plain':!![]});var _0x3df287=_0x8b45('0x28');return db[_0x8b45('0x29')][_0x8b45('0x27')]({'where':{'type':_0x3df287,'resourceId':_0x2f37bc['id']}})[_0x8b45('0x26')](function(){return _0x129c35;});})[_0x8b45('0x26')](function(){_0x500044[_0x8b45('0x1c')](0xcc)[_0x8b45('0x1d')]();});}};}function handleEntityNotFound(_0x1733a7,_0xf21bd1){return function(_0x339c73){if(!_0x339c73){_0x1733a7[_0x8b45('0x1b')](0x194);}return _0x339c73;};}function handleError(_0x5b6151,_0x4a7372){_0x4a7372=_0x4a7372||0x1f4;return function(_0x1d98c3){logger[_0x8b45('0x2a')](_0x1d98c3[_0x8b45('0x2b')]);if(_0x1d98c3[_0x8b45('0x2c')]){delete _0x1d98c3[_0x8b45('0x2c')];}_0x5b6151[_0x8b45('0x1c')](_0x4a7372)[_0x8b45('0x2d')](_0x1d98c3);};}function getMustacheRender(_0x4216bf,_0x5d8938){return Mustache[_0x8b45('0x2e')](_0x4216bf,_[_0x8b45('0x2f')](_0x5d8938[_0x8b45('0x30')],{'contact':_0x5d8938[_0x8b45('0x31')],'message':_0x5d8938[_0x8b45('0x32')],'agent':_0x5d8938['agent'],'interaction':_0x5d8938[_0x8b45('0x33')],'account':_0x5d8938['account']}))||'';}exports['index']=function(_0x1f8a11,_0x94e3b6){var _0xd3ba91={},_0x8d6790={},_0x1e72d2={'count':0x0,'rows':[]};var _0x8fd345=_['map'](db[_0x8b45('0x34')][_0x8b45('0x35')],function(_0x264be7){return{'name':_0x264be7[_0x8b45('0x36')],'type':_0x264be7['type'][_0x8b45('0x37')]};});_0x8d6790[_0x8b45('0x38')]=_[_0x8b45('0x39')](_0x8fd345,'name');_0x8d6790[_0x8b45('0x3a')]=_[_0x8b45('0x3b')](_0x1f8a11[_0x8b45('0x3a')]);_0x8d6790['filters']=_[_0x8b45('0x3c')](_0x8d6790[_0x8b45('0x38')],_0x8d6790[_0x8b45('0x3a')]);_0xd3ba91[_0x8b45('0x3d')]=_['intersection'](_0x8d6790[_0x8b45('0x38')],qs[_0x8b45('0x3e')](_0x1f8a11[_0x8b45('0x3a')][_0x8b45('0x3e')]));_0xd3ba91[_0x8b45('0x3d')]=_0xd3ba91[_0x8b45('0x3d')]['length']?_0xd3ba91['attributes']:_0x8d6790[_0x8b45('0x38')];if(!_0x1f8a11[_0x8b45('0x3a')][_0x8b45('0x3f')](_0x8b45('0x40'))){_0xd3ba91[_0x8b45('0x21')]=qs['limit'](_0x1f8a11[_0x8b45('0x3a')]['limit']);_0xd3ba91[_0x8b45('0x1f')]=qs[_0x8b45('0x1f')](_0x1f8a11[_0x8b45('0x3a')][_0x8b45('0x1f')]);}_0xd3ba91[_0x8b45('0x41')]=qs[_0x8b45('0x42')](_0x1f8a11[_0x8b45('0x3a')][_0x8b45('0x42')]);_0xd3ba91[_0x8b45('0x43')]=qs[_0x8b45('0x44')](_[_0x8b45('0x45')](_0x1f8a11['query'],_0x8d6790[_0x8b45('0x44')]),_0x8fd345);if(_0x1f8a11['query'][_0x8b45('0x46')]){_0xd3ba91['where']=_[_0x8b45('0x2f')](_0xd3ba91[_0x8b45('0x43')],{'$or':_[_0x8b45('0x39')](_0x8fd345,function(_0x7a284f){if(_0x7a284f[_0x8b45('0x47')]!==_0x8b45('0x48')){var _0x58e663={};_0x58e663[_0x7a284f[_0x8b45('0x2c')]]={'$like':'%'+_0x1f8a11['query']['filter']+'%'};return _0x58e663;}})});}_0xd3ba91=_[_0x8b45('0x2f')]({},_0xd3ba91,_0x1f8a11[_0x8b45('0x49')]);var _0x275eb0={'where':_0xd3ba91['where']};return db[_0x8b45('0x34')]['count'](_0x275eb0)[_0x8b45('0x26')](function(_0x1055db){_0x1e72d2[_0x8b45('0x22')]=_0x1055db;if(_0x1f8a11[_0x8b45('0x3a')][_0x8b45('0x4a')]){_0xd3ba91[_0x8b45('0x4b')]=[{'all':!![]}];}return db['FaxQueue'][_0x8b45('0x4c')](_0xd3ba91);})[_0x8b45('0x26')](function(_0x3ad9a4){_0x1e72d2[_0x8b45('0x4d')]=_0x3ad9a4;return _0x1e72d2;})[_0x8b45('0x26')](respondWithFilteredResult(_0x94e3b6,_0xd3ba91))[_0x8b45('0x4e')](handleError(_0x94e3b6,null));};exports[_0x8b45('0x4f')]=function(_0x3de3c2,_0x37b94a){var _0x462b51={'raw':!![],'where':{'id':_0x3de3c2[_0x8b45('0x50')]['id']}},_0x2a1999={};_0x2a1999[_0x8b45('0x38')]=_[_0x8b45('0x3b')](db[_0x8b45('0x34')][_0x8b45('0x35')]);_0x2a1999['query']=_['keys'](_0x3de3c2['query']);_0x2a1999[_0x8b45('0x44')]=_[_0x8b45('0x3c')](_0x2a1999[_0x8b45('0x38')],_0x2a1999[_0x8b45('0x3a')]);_0x462b51[_0x8b45('0x3d')]=_[_0x8b45('0x3c')](_0x2a1999[_0x8b45('0x38')],qs[_0x8b45('0x3e')](_0x3de3c2['query'][_0x8b45('0x3e')]));_0x462b51['attributes']=_0x462b51[_0x8b45('0x3d')][_0x8b45('0x51')]?_0x462b51[_0x8b45('0x3d')]:_0x2a1999[_0x8b45('0x38')];if(_0x3de3c2['query'][_0x8b45('0x4a')]){_0x462b51[_0x8b45('0x4b')]=[{'all':!![]}];}_0x462b51=_['merge']({},_0x462b51,_0x3de3c2[_0x8b45('0x49')]);return db[_0x8b45('0x34')]['find'](_0x462b51)[_0x8b45('0x26')](handleEntityNotFound(_0x37b94a,null))[_0x8b45('0x26')](respondWithResult(_0x37b94a,null))[_0x8b45('0x4e')](handleError(_0x37b94a,null));};exports[_0x8b45('0x52')]=function(_0x219cc0,_0x3d1bf1){return db['FaxQueue']['create'](_0x219cc0[_0x8b45('0x30')],{})[_0x8b45('0x26')](function(_0x2d5b31){var _0x5496cf=_0x219cc0[_0x8b45('0x53')][_0x8b45('0x54')]({'plain':!![]});if(!_0x5496cf)throw new Error(_0x8b45('0x55'));if(_0x5496cf[_0x8b45('0x56')]===_0x8b45('0x53')){var _0x597402=_0x2d5b31[_0x8b45('0x54')]({'plain':!![]});var _0xa92a05='FaxQueues';return db[_0x8b45('0x57')]['find']({'where':{'name':_0xa92a05,'userProfileId':_0x5496cf[_0x8b45('0x58')]},'raw':!![]})[_0x8b45('0x26')](function(_0xca6a73){if(_0xca6a73&&_0xca6a73[_0x8b45('0x59')]===0x0){return db['UserProfileResource'][_0x8b45('0x52')]({'name':_0x597402[_0x8b45('0x2c')],'resourceId':_0x597402['id'],'type':_0xca6a73[_0x8b45('0x2c')],'sectionId':_0xca6a73['id']},{})[_0x8b45('0x26')](function(){return _0x2d5b31;});}else{return _0x2d5b31;}})[_0x8b45('0x4e')](function(_0x20e536){logger[_0x8b45('0x2a')](_0x8b45('0x5a'),_0x20e536);throw _0x20e536;});}return _0x2d5b31;})[_0x8b45('0x26')](respondWithResult(_0x3d1bf1,0xc9))[_0x8b45('0x4e')](handleError(_0x3d1bf1,null));};exports[_0x8b45('0x5b')]=function(_0x274de8,_0x1405f3){if(_0x274de8[_0x8b45('0x30')]['id']){delete _0x274de8[_0x8b45('0x30')]['id'];}return db['FaxQueue'][_0x8b45('0x5c')]({'where':{'id':_0x274de8[_0x8b45('0x50')]['id']}})[_0x8b45('0x26')](handleEntityNotFound(_0x1405f3,null))['then'](saveUpdates(_0x274de8[_0x8b45('0x30')],null))[_0x8b45('0x26')](respondWithResult(_0x1405f3,null))[_0x8b45('0x4e')](handleError(_0x1405f3,null));};exports[_0x8b45('0x27')]=function(_0x5795ca,_0x456c0e){return db[_0x8b45('0x34')][_0x8b45('0x5c')]({'where':{'id':_0x5795ca[_0x8b45('0x50')]['id']}})['then'](handleEntityNotFound(_0x456c0e,null))[_0x8b45('0x26')](removeEntity(_0x456c0e,null))[_0x8b45('0x4e')](handleError(_0x456c0e,null));};exports[_0x8b45('0x5d')]=function(_0x27503f,_0x3488d1){return db['FaxQueue'][_0x8b45('0x5d')]()['then'](respondWithResult(_0x3488d1,null))[_0x8b45('0x4e')](handleError(_0x3488d1,null));};exports[_0x8b45('0x5e')]=function(_0x19152b,_0x19c80e,_0x6a77bd){var _0x3097c8={'raw':!![],'where':{}},_0x54df4d={},_0x5b8ebe;return db[_0x8b45('0x34')][_0x8b45('0x5f')]({'where':{'id':_0x19152b['params']['id']}})[_0x8b45('0x26')](handleEntityNotFound(_0x19c80e,null))[_0x8b45('0x26')](function(_0x3503cb){if(_0x3503cb){_0x5b8ebe=_0x3503cb['get']({'plain':!![]});_0x54df4d['model']=_[_0x8b45('0x3b')](db[_0x8b45('0x60')]['rawAttributes']);_0x54df4d[_0x8b45('0x3a')]=_['keys'](_0x19152b[_0x8b45('0x3a')]);_0x54df4d['filters']=_['intersection'](_0x54df4d[_0x8b45('0x38')],_0x54df4d[_0x8b45('0x3a')]);_0x3097c8['attributes']=_[_0x8b45('0x3c')](_0x54df4d[_0x8b45('0x38')],qs[_0x8b45('0x3e')](_0x19152b[_0x8b45('0x3a')][_0x8b45('0x3e')]));_0x3097c8['attributes']=_0x3097c8[_0x8b45('0x3d')][_0x8b45('0x51')]?_0x3097c8[_0x8b45('0x3d')]:_0x54df4d['model'];if(!_0x19152b['query'][_0x8b45('0x3f')]('nolimit')){_0x3097c8[_0x8b45('0x21')]=qs['limit'](_0x19152b['query']['limit']);_0x3097c8[_0x8b45('0x1f')]=qs['offset'](_0x19152b[_0x8b45('0x3a')][_0x8b45('0x1f')]);}_0x3097c8['order']=qs[_0x8b45('0x42')](_0x19152b[_0x8b45('0x3a')]['sort']);_0x3097c8[_0x8b45('0x43')]=qs[_0x8b45('0x44')](_[_0x8b45('0x45')](_0x19152b[_0x8b45('0x3a')],_0x54df4d[_0x8b45('0x44')]));_0x3097c8[_0x8b45('0x43')][_0x8b45('0x61')]=_0x3503cb['id'];if(_0x19152b[_0x8b45('0x3a')][_0x8b45('0x46')]){_0x3097c8[_0x8b45('0x43')]=_[_0x8b45('0x2f')](_0x3097c8[_0x8b45('0x43')],{'$or':_['map'](_0x3097c8[_0x8b45('0x3d')],function(_0x403ee2){var _0x283eb6={};_0x283eb6[_0x403ee2]={'$like':'%'+_0x19152b[_0x8b45('0x3a')][_0x8b45('0x46')]+'%'};return _0x283eb6;})});}_0x3097c8=_[_0x8b45('0x2f')]({},_0x3097c8,_0x19152b[_0x8b45('0x49')]);return db[_0x8b45('0x60')][_0x8b45('0x4c')](_0x3097c8);}})[_0x8b45('0x26')](function(_0x183c34){if(_0x183c34){return db[_0x8b45('0x62')][_0x8b45('0x63')]({'where':{'id':_[_0x8b45('0x39')](_0x183c34,_0x8b45('0x64')),'role':'agent'},'attributes':['id',_0x8b45('0x2c'),_0x8b45('0x65'),_0x8b45('0x66'),_0x8b45('0x67')]});}})[_0x8b45('0x26')](function(_0xd88538){if(_0xd88538){return{'count':_0xd88538[_0x8b45('0x22')],'rows':_[_0x8b45('0x39')](_0xd88538['rows'],function(_0xd59cf2){return{'membername':_0xd59cf2[_0x8b45('0x2c')],'UserId':_0xd59cf2['id'],'queue_name':_0x5b8ebe[_0x8b45('0x2c')],'FaxQueueId':_0x5b8ebe['id'],'interface':util[_0x8b45('0x68')](_0x8b45('0x69'),_0x8b45('0x6a'),_0xd59cf2[_0x8b45('0x2c')]),'penalty':0x0,'paused':_0xd59cf2[_0x8b45('0x65')],'createdAt':_0xd59cf2[_0x8b45('0x67')],'updatedAt':_0xd59cf2[_0x8b45('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8b45('0x26')](respondWithFilteredResult(_0x19c80e,_0x3097c8))['catch'](handleError(_0x19c80e,null));};exports['getTeams']=function(_0x3318a2,_0x28a909,_0x426a97){var _0x36e5e7={};var _0x6a235a={};var _0x19b851;var _0x6cdd2b;return db[_0x8b45('0x34')][_0x8b45('0x5f')]({'where':{'id':_0x3318a2['params']['id']}})['then'](handleEntityNotFound(_0x28a909,null))[_0x8b45('0x26')](function(_0x28b0b9){if(_0x28b0b9){_0x19b851=_0x28b0b9;_0x6a235a[_0x8b45('0x38')]=_[_0x8b45('0x3b')](db['Team'][_0x8b45('0x35')]);_0x6a235a[_0x8b45('0x3a')]=_[_0x8b45('0x3b')](_0x3318a2[_0x8b45('0x3a')]);_0x6a235a[_0x8b45('0x44')]=_[_0x8b45('0x3c')](_0x6a235a['model'],_0x6a235a['query']);_0x36e5e7[_0x8b45('0x3d')]=_['intersection'](_0x6a235a['model'],qs['fields'](_0x3318a2[_0x8b45('0x3a')][_0x8b45('0x3e')]));_0x36e5e7[_0x8b45('0x3d')]=_0x36e5e7[_0x8b45('0x3d')][_0x8b45('0x51')]?_0x36e5e7[_0x8b45('0x3d')]:_0x6a235a[_0x8b45('0x38')];_0x36e5e7[_0x8b45('0x41')]=qs[_0x8b45('0x42')](_0x3318a2[_0x8b45('0x3a')][_0x8b45('0x42')]);_0x36e5e7[_0x8b45('0x43')]=qs[_0x8b45('0x44')](_[_0x8b45('0x45')](_0x3318a2[_0x8b45('0x3a')],_0x6a235a['filters']));if(_0x3318a2[_0x8b45('0x3a')][_0x8b45('0x46')]){_0x36e5e7[_0x8b45('0x43')]=_[_0x8b45('0x2f')](_0x36e5e7[_0x8b45('0x43')],{'$or':_[_0x8b45('0x39')](_0x36e5e7[_0x8b45('0x3d')],function(_0x251584){var _0x31752d={};_0x31752d[_0x251584]={'$like':'%'+_0x3318a2[_0x8b45('0x3a')]['filter']+'%'};return _0x31752d;})});}_0x36e5e7=_[_0x8b45('0x2f')]({},_0x36e5e7,_0x3318a2[_0x8b45('0x49')]);return _0x19b851[_0x8b45('0x6b')](_0x36e5e7);}})[_0x8b45('0x26')](function(_0x4922e6){if(_0x4922e6){_0x6cdd2b=_0x4922e6[_0x8b45('0x51')];if(!_0x3318a2['query'][_0x8b45('0x3f')]('nolimit')){_0x36e5e7[_0x8b45('0x21')]=qs[_0x8b45('0x21')](_0x3318a2[_0x8b45('0x3a')][_0x8b45('0x21')]);_0x36e5e7[_0x8b45('0x1f')]=qs[_0x8b45('0x1f')](_0x3318a2['query'][_0x8b45('0x1f')]);}return _0x19b851[_0x8b45('0x6b')](_0x36e5e7);}})[_0x8b45('0x26')](function(_0x6189ed){if(_0x6189ed){return _0x6189ed?{'count':_0x6cdd2b,'rows':_0x6189ed}:null;}})['then'](respondWithResult(_0x28a909,null))[_0x8b45('0x4e')](handleError(_0x28a909,null));};exports[_0x8b45('0x6c')]=function(_0x4adb06,_0x5c3dbd,_0x260b4e){var _0x24a570=_0x4adb06[_0x8b45('0x30')]['ids'];return db[_0x8b45('0x6d')]['findAll']({'where':{'id':_0x24a570},'attributes':['id'],'include':[{'model':db[_0x8b45('0x62')],'as':_0x8b45('0x6e'),'attributes':['id','name','online',_0x8b45('0x6f'),_0x8b45('0x70')],'raw':!![]}]})[_0x8b45('0x26')](function(_0x36e785){if(_0x36e785){var _0x5f2253=_[_0x8b45('0x71')](_0x36e785,function(_0x29760d){var _0x376416=_0x29760d[_0x8b45('0x54')]({'plain':!![]});return _0x376416[_0x8b45('0x6e')];});return db[_0x8b45('0x34')]['find']({'where':{'id':_0x4adb06[_0x8b45('0x50')]['id']}})[_0x8b45('0x26')](function(_0x5b8f1c){return db[_0x8b45('0x72')][_0x8b45('0x73')](function(_0x569f98){return _0x5b8f1c['addTeams'](_0x24a570,{'transaction':_0x569f98})['then'](function(){return BPromise[_0x8b45('0x74')](_0x5f2253,function(_0x31ab30){return db[_0x8b45('0x60')][_0x8b45('0x75')]({'where':{'UserId':_0x31ab30['id'],'FaxQueueId':_0x4adb06[_0x8b45('0x50')]['id']},'transaction':_0x569f98});});})[_0x8b45('0x26')](function(){_0x5f2253[_0x8b45('0x76')](function(_0x55831c){socket[_0x8b45('0x77')](_0x8b45('0x78'),{'UserId':_0x55831c['id'],'FaxQueueId':_0x5b8f1c['id']});});});});});}})[_0x8b45('0x26')](respondWithStatusCode(_0x5c3dbd,null))[_0x8b45('0x4e')](handleError(_0x5c3dbd,null));};exports[_0x8b45('0x79')]=function(_0x10136e,_0x599d5c,_0x1d9cd9){return db[_0x8b45('0x6d')][_0x8b45('0x4c')]({'where':{'id':_0x10136e[_0x8b45('0x3a')][_0x8b45('0x7a')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8b45('0x26')](handleEntityNotFound(_0x599d5c,null))[_0x8b45('0x26')](function(_0xcd2b73){var _0x9993ce=_[_0x8b45('0x39')](_0xcd2b73,'id');var _0x5a4aaf=[];var _0x1f7f33=[];var _0x4b6455=squel[_0x8b45('0x7b')]();_0x4b6455['field'](_0x8b45('0x7c'))[_0x8b45('0x7d')](_0x8b45('0x7e'),'tq')[_0x8b45('0x7f')](_0x8b45('0x80'),'ut',_0x8b45('0x81'))[_0x8b45('0x43')](_0x8b45('0x82'),_0x10136e[_0x8b45('0x50')]['id']);for(var _0xfff1e=0x0;_0xfff1e<_0xcd2b73[_0x8b45('0x51')];_0xfff1e+=0x1){let _0x2f136d=_0xcd2b73[_0xfff1e];for(var _0x2eb241=0x0;_0x2eb241<_0x2f136d[_0x8b45('0x6e')]['length'];_0x2eb241+=0x1){let _0x3db51c=_0x2f136d[_0x8b45('0x6e')][_0x2eb241];var _0x1bcb0a=_0x4b6455['clone']();_0x1bcb0a[_0x8b45('0x43')]('ut.UserId\x20=\x20?',_0x3db51c['id']);_0x1f7f33[_0x8b45('0x83')](db[_0x8b45('0x72')]['query'](_0x1bcb0a[_0x8b45('0x84')](),{'type':db['sequelize'][_0x8b45('0x85')][_0x8b45('0x86')]})[_0x8b45('0x26')](function(_0xd524b7){if(_0xd524b7[_0x8b45('0x51')]===0x1){return _0x3db51c['id'];}else{var _0x3f920f=_['every'](_['map'](_0xd524b7,_0x8b45('0x87')),function(_0x2bbc85){return _['includes'](_0x9993ce,_0x2bbc85);});if(_0x3f920f){return _0x3db51c['id'];}}}));}}return BPromise['all'](_0x1f7f33)['then'](function(_0x430b95){_0x5a4aaf=_(_0x5a4aaf)['union'](_0x430b95)[_0x8b45('0x88')]()[_0x8b45('0x89')]();return db[_0x8b45('0x34')][_0x8b45('0x5c')]({'where':{'id':_0x10136e['params']['id']}})[_0x8b45('0x26')](function(_0x311be9){return db[_0x8b45('0x72')][_0x8b45('0x73')](function(_0x1afe71){return _0x311be9[_0x8b45('0x79')](_0x10136e[_0x8b45('0x3a')][_0x8b45('0x7a')],{'transaction':_0x1afe71})['then'](function(){if(!_[_0x8b45('0x8a')](_0x5a4aaf)){return _0x311be9['removeAgents'](_0x5a4aaf,{'transaction':_0x1afe71});}})[_0x8b45('0x26')](function(){_0x5a4aaf['forEach'](function(_0x4b8a95){socket['emit'](_0x8b45('0x8b'),{'UserId':_0x4b8a95,'FaxQueueId':_0x311be9['id']});});});});});});})[_0x8b45('0x26')](respondWithStatusCode(_0x599d5c,null))['catch'](handleError(_0x599d5c,null));};exports[_0x8b45('0x8c')]=function(_0x110eee,_0x36332e,_0x18a754){return db[_0x8b45('0x34')][_0x8b45('0x5c')]({'where':{'id':_0x110eee[_0x8b45('0x50')]['id']}})[_0x8b45('0x26')](handleEntityNotFound(_0x36332e,null))[_0x8b45('0x26')](function(_0x51121e){if(_0x51121e){return _0x51121e[_0x8b45('0x8c')](_0x110eee[_0x8b45('0x30')][_0x8b45('0x7a')],_[_0x8b45('0x8d')](_0x110eee['body'],[_0x8b45('0x7a'),'id'])||{})[_0x8b45('0x8e')](function(_0x3eedad){for(var _0x3d1590=0x0;_0x3d1590<_0x110eee[_0x8b45('0x30')]['ids'][_0x8b45('0x51')];_0x3d1590+=0x1){socket['emit'](_0x8b45('0x78'),{'UserId':_0x110eee[_0x8b45('0x30')]['ids'][_0x3d1590],'FaxQueueId':_0x110eee['params']['id']});}return _0x3eedad;});}})[_0x8b45('0x26')](respondWithResult(_0x36332e,null))['catch'](handleError(_0x36332e,null));};exports[_0x8b45('0x8f')]=function(_0x5006a6,_0x470d23,_0x2f7d4b){return db[_0x8b45('0x34')]['find']({'where':{'id':_0x5006a6[_0x8b45('0x50')]['id']}})['then'](handleEntityNotFound(_0x470d23,null))[_0x8b45('0x26')](function(_0xe5f7da){if(_0xe5f7da){return _0xe5f7da[_0x8b45('0x8f')](_0x5006a6[_0x8b45('0x3a')][_0x8b45('0x7a')])[_0x8b45('0x26')](function(){if(_[_0x8b45('0x90')](_0x5006a6[_0x8b45('0x3a')][_0x8b45('0x7a')])){for(var _0x1b8d9e=0x0;_0x1b8d9e<_0x5006a6[_0x8b45('0x3a')][_0x8b45('0x7a')][_0x8b45('0x51')];_0x1b8d9e+=0x1){socket[_0x8b45('0x77')](_0x8b45('0x8b'),{'UserId':Number(_0x5006a6['query'][_0x8b45('0x7a')][_0x1b8d9e]),'FaxQueueId':Number(_0x5006a6[_0x8b45('0x50')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x5006a6[_0x8b45('0x3a')][_0x8b45('0x7a')]),'FaxQueueId':Number(_0x5006a6[_0x8b45('0x50')]['id'])});}});}})[_0x8b45('0x26')](respondWithStatusCode(_0x470d23,null))[_0x8b45('0x4e')](handleError(_0x470d23,null));};exports[_0x8b45('0x91')]=function(_0x3f1aa6,_0x3ac89b,_0xc28f57){var _0x4ad1fe={};var _0x39626f={};var _0x401e93;var _0x4ca0f4;return db[_0x8b45('0x34')][_0x8b45('0x5f')]({'where':{'id':_0x3f1aa6[_0x8b45('0x50')]['id']}})[_0x8b45('0x26')](handleEntityNotFound(_0x3ac89b,null))[_0x8b45('0x26')](function(_0x1a281d){if(_0x1a281d){_0x401e93=_0x1a281d;_0x39626f[_0x8b45('0x38')]=_[_0x8b45('0x3b')](db[_0x8b45('0x62')][_0x8b45('0x35')]);_0x39626f[_0x8b45('0x3a')]=_[_0x8b45('0x3b')](_0x3f1aa6[_0x8b45('0x3a')]);_0x39626f['filters']=_[_0x8b45('0x3c')](_0x39626f['model'],_0x39626f[_0x8b45('0x3a')]);_0x4ad1fe[_0x8b45('0x3d')]=_[_0x8b45('0x3c')](_0x39626f['model'],qs[_0x8b45('0x3e')](_0x3f1aa6[_0x8b45('0x3a')][_0x8b45('0x3e')]));_0x4ad1fe[_0x8b45('0x3d')]=_0x4ad1fe[_0x8b45('0x3d')][_0x8b45('0x51')]?_0x4ad1fe['attributes']:_0x39626f[_0x8b45('0x38')];_0x4ad1fe[_0x8b45('0x41')]=qs[_0x8b45('0x42')](_0x3f1aa6[_0x8b45('0x3a')]['sort']);_0x4ad1fe[_0x8b45('0x43')]=qs[_0x8b45('0x44')](_[_0x8b45('0x45')](_0x3f1aa6[_0x8b45('0x3a')],_0x39626f['filters']));if(_0x3f1aa6[_0x8b45('0x3a')][_0x8b45('0x46')]){_0x4ad1fe[_0x8b45('0x43')]=_['merge'](_0x4ad1fe[_0x8b45('0x43')],{'$or':_[_0x8b45('0x39')](_0x4ad1fe[_0x8b45('0x3d')],function(_0x1d3a00){var _0x2783b2={};_0x2783b2[_0x1d3a00]={'$like':'%'+_0x3f1aa6[_0x8b45('0x3a')]['filter']+'%'};return _0x2783b2;})});}_0x4ad1fe=_[_0x8b45('0x2f')]({},_0x4ad1fe,_0x3f1aa6[_0x8b45('0x49')]);return _0x401e93['getAgents'](_0x4ad1fe);}})[_0x8b45('0x26')](function(_0x16d99a){if(_0x16d99a){_0x4ca0f4=_0x16d99a['length'];if(!_0x3f1aa6[_0x8b45('0x3a')][_0x8b45('0x3f')](_0x8b45('0x40'))){_0x4ad1fe[_0x8b45('0x21')]=qs[_0x8b45('0x21')](_0x3f1aa6[_0x8b45('0x3a')][_0x8b45('0x21')]);_0x4ad1fe[_0x8b45('0x1f')]=qs['offset'](_0x3f1aa6[_0x8b45('0x3a')]['offset']);}return _0x401e93[_0x8b45('0x91')](_0x4ad1fe);}})[_0x8b45('0x26')](function(_0x192932){if(_0x192932){return _0x192932?{'count':_0x4ca0f4,'rows':_0x192932}:null;}})['then'](respondWithResult(_0x3ac89b,null))[_0x8b45('0x4e')](handleError(_0x3ac89b,null));}; \ No newline at end of file +var _0x4c4e=['UserProfileSection','find','userProfileId','autoAssociation','error','update','describe','getMembers','findOne','length','nolimit','FaxQueueId','UserFaxQueue','User','UserId','faxPause','format','%s/%s','createdAt','updatedAt','Team','getTeams','addTeams','ids','findAll','Agents','online','voicePause','sequelize','each','findOrCreate','forEach','userFaxQueue:save','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','TeamId','union','value','transaction','removeTeams','removeAgents','emit','addAgents','omit','userFaxQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','UserProfileResource','name','send','render','merge','contact','message','agent','account','map','FaxQueue','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','include','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c4e,0x152));var _0xe4c4=function(_0x52dc8c,_0x4b1a69){_0x52dc8c=_0x52dc8c-0x0;var _0x24ecea=_0x4c4e[_0x52dc8c];return _0x24ecea;};'use strict';var emlformat=require(_0xe4c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c4('0x1'));var jsonpatch=require(_0xe4c4('0x2'));var rp=require(_0xe4c4('0x3'));var moment=require('moment');var BPromise=require(_0xe4c4('0x4'));var Mustache=require(_0xe4c4('0x5'));var util=require(_0xe4c4('0x6'));var path=require('path');var sox=require(_0xe4c4('0x7'));var csv=require('to-csv');var ejs=require(_0xe4c4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x9'));var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0x10'));var authService=require(_0xe4c4('0x11'));var qs=require(_0xe4c4('0x12'));var as=require(_0xe4c4('0x13'));var hardwareService=require(_0xe4c4('0x14'));var logger=require(_0xe4c4('0x15'))('api');var utils=require(_0xe4c4('0x16'));var config=require(_0xe4c4('0x17'));var licenseUtil=require(_0xe4c4('0x18'));var db=require(_0xe4c4('0x19'))['db'];config['redis']=_[_0xe4c4('0x1a')](config[_0xe4c4('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xe4c4('0x1c'))(new Redis(config[_0xe4c4('0x1b')]));require('./faxQueue.socket')[_0xe4c4('0x1d')](socket);function respondWithStatusCode(_0x29766a,_0x5e263c){_0x5e263c=_0x5e263c||0xcc;return function(_0x307aa8){if(_0x307aa8){return _0x29766a[_0xe4c4('0x1e')](_0x5e263c);}return _0x29766a[_0xe4c4('0x1f')](_0x5e263c)[_0xe4c4('0x20')]();};}function respondWithResult(_0x19e59b,_0x882be2){_0x882be2=_0x882be2||0xc8;return function(_0x1f637e){if(_0x1f637e){return _0x19e59b[_0xe4c4('0x1f')](_0x882be2)[_0xe4c4('0x21')](_0x1f637e);}};}function respondWithFilteredResult(_0x36b10c,_0x23b7e6){return function(_0x42242c){if(_0x42242c){var _0x3820c7=typeof _0x23b7e6[_0xe4c4('0x22')]===_0xe4c4('0x23')&&typeof _0x23b7e6['limit']===_0xe4c4('0x23');var _0x24f946=_0x42242c[_0xe4c4('0x24')];var _0x317cc8=_0x3820c7?0x0:_0x23b7e6['offset'];var _0x3d5856=_0x3820c7?_0x42242c[_0xe4c4('0x24')]:_0x23b7e6[_0xe4c4('0x22')]+_0x23b7e6[_0xe4c4('0x25')];var _0x2c5aea;if(_0x3d5856>=_0x24f946){_0x3d5856=_0x24f946;_0x2c5aea=0xc8;}else{_0x2c5aea=0xce;}_0x36b10c[_0xe4c4('0x1f')](_0x2c5aea);return _0x36b10c[_0xe4c4('0x26')](_0xe4c4('0x27'),_0x317cc8+'-'+_0x3d5856+'/'+_0x24f946)[_0xe4c4('0x21')](_0x42242c);}return null;};}function patchUpdates(_0x1a7690){return function(_0x210ee1){try{jsonpatch[_0xe4c4('0x28')](_0x210ee1,_0x1a7690,!![]);}catch(_0x138ead){return BPromise[_0xe4c4('0x29')](_0x138ead);}return _0x210ee1[_0xe4c4('0x2a')]();};}function saveUpdates(_0x59498e,_0x49cadc){return function(_0x403a2c){if(_0x403a2c){return _0x403a2c['update'](_0x59498e)[_0xe4c4('0x2b')](function(_0x5374fd){return _0x5374fd;});}return null;};}function removeEntity(_0x3adfcb,_0x5efc4c){return function(_0x34d667){if(_0x34d667){return _0x34d667['destroy']()[_0xe4c4('0x2b')](function(){var _0x4a0199=_0x34d667['get']({'plain':!![]});var _0x4cea1f='FaxQueues';return db[_0xe4c4('0x2c')]['destroy']({'where':{'type':_0x4cea1f,'resourceId':_0x4a0199['id']}})['then'](function(){return _0x34d667;});})[_0xe4c4('0x2b')](function(){_0x3adfcb[_0xe4c4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57ba43,_0x7428ad){return function(_0x33de43){if(!_0x33de43){_0x57ba43['sendStatus'](0x194);}return _0x33de43;};}function handleError(_0x158432,_0x2d0e2){_0x2d0e2=_0x2d0e2||0x1f4;return function(_0x3f60fc){logger['error'](_0x3f60fc['stack']);if(_0x3f60fc[_0xe4c4('0x2d')]){delete _0x3f60fc[_0xe4c4('0x2d')];}_0x158432[_0xe4c4('0x1f')](_0x2d0e2)[_0xe4c4('0x2e')](_0x3f60fc);};}function getMustacheRender(_0x5391f6,_0x49c913){return Mustache[_0xe4c4('0x2f')](_0x5391f6,_[_0xe4c4('0x30')](_0x49c913['body'],{'contact':_0x49c913[_0xe4c4('0x31')],'message':_0x49c913[_0xe4c4('0x32')],'agent':_0x49c913[_0xe4c4('0x33')],'interaction':_0x49c913['interaction'],'account':_0x49c913[_0xe4c4('0x34')]}))||'';}exports['index']=function(_0x45fc76,_0x4239ba){var _0x3bb6cf={},_0x35717a={},_0x2bd5c1={'count':0x0,'rows':[]};var _0x43c1ec=_[_0xe4c4('0x35')](db[_0xe4c4('0x36')][_0xe4c4('0x37')],function(_0x18b2a8){return{'name':_0x18b2a8[_0xe4c4('0x38')],'type':_0x18b2a8[_0xe4c4('0x39')]['key']};});_0x35717a[_0xe4c4('0x3a')]=_[_0xe4c4('0x35')](_0x43c1ec,_0xe4c4('0x2d'));_0x35717a['query']=_[_0xe4c4('0x3b')](_0x45fc76[_0xe4c4('0x3c')]);_0x35717a[_0xe4c4('0x3d')]=_['intersection'](_0x35717a[_0xe4c4('0x3a')],_0x35717a[_0xe4c4('0x3c')]);_0x3bb6cf[_0xe4c4('0x3e')]=_[_0xe4c4('0x3f')](_0x35717a[_0xe4c4('0x3a')],qs[_0xe4c4('0x40')](_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x40')]));_0x3bb6cf[_0xe4c4('0x3e')]=_0x3bb6cf[_0xe4c4('0x3e')]['length']?_0x3bb6cf[_0xe4c4('0x3e')]:_0x35717a[_0xe4c4('0x3a')];if(!_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x41')]('nolimit')){_0x3bb6cf[_0xe4c4('0x25')]=qs[_0xe4c4('0x25')](_0x45fc76['query'][_0xe4c4('0x25')]);_0x3bb6cf[_0xe4c4('0x22')]=qs['offset'](_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x22')]);}_0x3bb6cf[_0xe4c4('0x42')]=qs[_0xe4c4('0x43')](_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x43')]);_0x3bb6cf[_0xe4c4('0x44')]=qs[_0xe4c4('0x3d')](_[_0xe4c4('0x45')](_0x45fc76[_0xe4c4('0x3c')],_0x35717a[_0xe4c4('0x3d')]),_0x43c1ec);if(_0x45fc76[_0xe4c4('0x3c')]['filter']){_0x3bb6cf[_0xe4c4('0x44')]=_[_0xe4c4('0x30')](_0x3bb6cf[_0xe4c4('0x44')],{'$or':_[_0xe4c4('0x35')](_0x43c1ec,function(_0x260141){if(_0x260141[_0xe4c4('0x39')]!=='VIRTUAL'){var _0x312a49={};_0x312a49[_0x260141['name']]={'$like':'%'+_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x46')]+'%'};return _0x312a49;}})});}_0x3bb6cf=_[_0xe4c4('0x30')]({},_0x3bb6cf,_0x45fc76[_0xe4c4('0x47')]);var _0x48177f={'where':_0x3bb6cf['where']};return db['FaxQueue'][_0xe4c4('0x24')](_0x48177f)[_0xe4c4('0x2b')](function(_0x5aeded){_0x2bd5c1['count']=_0x5aeded;if(_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x48')]){_0x3bb6cf[_0xe4c4('0x49')]=[{'all':!![]}];}return db[_0xe4c4('0x36')]['findAll'](_0x3bb6cf);})[_0xe4c4('0x2b')](function(_0xd8e246){_0x2bd5c1[_0xe4c4('0x4a')]=_0xd8e246;return _0x2bd5c1;})[_0xe4c4('0x2b')](respondWithFilteredResult(_0x4239ba,_0x3bb6cf))[_0xe4c4('0x4b')](handleError(_0x4239ba,null));};exports[_0xe4c4('0x4c')]=function(_0x1eda5e,_0x176712){var _0x3ee4db={'raw':!![],'where':{'id':_0x1eda5e[_0xe4c4('0x4d')]['id']}},_0x5c7c4d={};_0x5c7c4d['model']=_[_0xe4c4('0x3b')](db[_0xe4c4('0x36')][_0xe4c4('0x37')]);_0x5c7c4d[_0xe4c4('0x3c')]=_[_0xe4c4('0x3b')](_0x1eda5e[_0xe4c4('0x3c')]);_0x5c7c4d[_0xe4c4('0x3d')]=_[_0xe4c4('0x3f')](_0x5c7c4d[_0xe4c4('0x3a')],_0x5c7c4d[_0xe4c4('0x3c')]);_0x3ee4db[_0xe4c4('0x3e')]=_[_0xe4c4('0x3f')](_0x5c7c4d[_0xe4c4('0x3a')],qs[_0xe4c4('0x40')](_0x1eda5e['query']['fields']));_0x3ee4db[_0xe4c4('0x3e')]=_0x3ee4db[_0xe4c4('0x3e')]['length']?_0x3ee4db[_0xe4c4('0x3e')]:_0x5c7c4d[_0xe4c4('0x3a')];if(_0x1eda5e[_0xe4c4('0x3c')][_0xe4c4('0x48')]){_0x3ee4db[_0xe4c4('0x49')]=[{'all':!![]}];}_0x3ee4db=_['merge']({},_0x3ee4db,_0x1eda5e[_0xe4c4('0x47')]);return db[_0xe4c4('0x36')]['find'](_0x3ee4db)[_0xe4c4('0x2b')](handleEntityNotFound(_0x176712,null))[_0xe4c4('0x2b')](respondWithResult(_0x176712,null))['catch'](handleError(_0x176712,null));};exports[_0xe4c4('0x4e')]=function(_0x53699d,_0xa66376){return db[_0xe4c4('0x36')][_0xe4c4('0x4e')](_0x53699d[_0xe4c4('0x4f')],{})[_0xe4c4('0x2b')](function(_0x525534){var _0x1c8b2e=_0x53699d[_0xe4c4('0x50')][_0xe4c4('0x51')]({'plain':!![]});if(!_0x1c8b2e)throw new Error(_0xe4c4('0x52'));if(_0x1c8b2e[_0xe4c4('0x53')]===_0xe4c4('0x50')){var _0x3ddcbe=_0x525534[_0xe4c4('0x51')]({'plain':!![]});var _0x1a96ba=_0xe4c4('0x54');return db[_0xe4c4('0x55')][_0xe4c4('0x56')]({'where':{'name':_0x1a96ba,'userProfileId':_0x1c8b2e[_0xe4c4('0x57')]},'raw':!![]})[_0xe4c4('0x2b')](function(_0x466882){if(_0x466882&&_0x466882[_0xe4c4('0x58')]===0x0){return db['UserProfileResource'][_0xe4c4('0x4e')]({'name':_0x3ddcbe[_0xe4c4('0x2d')],'resourceId':_0x3ddcbe['id'],'type':_0x466882[_0xe4c4('0x2d')],'sectionId':_0x466882['id']},{})['then'](function(){return _0x525534;});}else{return _0x525534;}})[_0xe4c4('0x4b')](function(_0xb7e4da){logger[_0xe4c4('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb7e4da);throw _0xb7e4da;});}return _0x525534;})[_0xe4c4('0x2b')](respondWithResult(_0xa66376,0xc9))['catch'](handleError(_0xa66376,null));};exports[_0xe4c4('0x5a')]=function(_0xfbfff6,_0x1cef48){if(_0xfbfff6['body']['id']){delete _0xfbfff6['body']['id'];}return db[_0xe4c4('0x36')][_0xe4c4('0x56')]({'where':{'id':_0xfbfff6[_0xe4c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1cef48,null))[_0xe4c4('0x2b')](saveUpdates(_0xfbfff6['body'],null))['then'](respondWithResult(_0x1cef48,null))['catch'](handleError(_0x1cef48,null));};exports['destroy']=function(_0x1ca931,_0x3a06da){return db[_0xe4c4('0x36')][_0xe4c4('0x56')]({'where':{'id':_0x1ca931[_0xe4c4('0x4d')]['id']}})[_0xe4c4('0x2b')](handleEntityNotFound(_0x3a06da,null))['then'](removeEntity(_0x3a06da,null))[_0xe4c4('0x4b')](handleError(_0x3a06da,null));};exports[_0xe4c4('0x5b')]=function(_0x184c5b,_0x125652){return db[_0xe4c4('0x36')][_0xe4c4('0x5b')]()['then'](respondWithResult(_0x125652,null))['catch'](handleError(_0x125652,null));};exports[_0xe4c4('0x5c')]=function(_0x6f374e,_0x1986ab,_0x3c8e44){var _0x3ccf42={'raw':!![],'where':{}},_0x2a575d={},_0x1dfc2d;return db[_0xe4c4('0x36')][_0xe4c4('0x5d')]({'where':{'id':_0x6f374e['params']['id']}})['then'](handleEntityNotFound(_0x1986ab,null))[_0xe4c4('0x2b')](function(_0x56f32e){if(_0x56f32e){_0x1dfc2d=_0x56f32e[_0xe4c4('0x51')]({'plain':!![]});_0x2a575d[_0xe4c4('0x3a')]=_[_0xe4c4('0x3b')](db['UserFaxQueue'][_0xe4c4('0x37')]);_0x2a575d['query']=_[_0xe4c4('0x3b')](_0x6f374e['query']);_0x2a575d['filters']=_[_0xe4c4('0x3f')](_0x2a575d[_0xe4c4('0x3a')],_0x2a575d[_0xe4c4('0x3c')]);_0x3ccf42['attributes']=_['intersection'](_0x2a575d['model'],qs[_0xe4c4('0x40')](_0x6f374e[_0xe4c4('0x3c')]['fields']));_0x3ccf42[_0xe4c4('0x3e')]=_0x3ccf42[_0xe4c4('0x3e')][_0xe4c4('0x5e')]?_0x3ccf42['attributes']:_0x2a575d['model'];if(!_0x6f374e[_0xe4c4('0x3c')][_0xe4c4('0x41')](_0xe4c4('0x5f'))){_0x3ccf42[_0xe4c4('0x25')]=qs[_0xe4c4('0x25')](_0x6f374e[_0xe4c4('0x3c')]['limit']);_0x3ccf42[_0xe4c4('0x22')]=qs[_0xe4c4('0x22')](_0x6f374e[_0xe4c4('0x3c')]['offset']);}_0x3ccf42[_0xe4c4('0x42')]=qs[_0xe4c4('0x43')](_0x6f374e[_0xe4c4('0x3c')]['sort']);_0x3ccf42['where']=qs[_0xe4c4('0x3d')](_['pick'](_0x6f374e['query'],_0x2a575d[_0xe4c4('0x3d')]));_0x3ccf42[_0xe4c4('0x44')][_0xe4c4('0x60')]=_0x56f32e['id'];if(_0x6f374e[_0xe4c4('0x3c')][_0xe4c4('0x46')]){_0x3ccf42[_0xe4c4('0x44')]=_[_0xe4c4('0x30')](_0x3ccf42[_0xe4c4('0x44')],{'$or':_['map'](_0x3ccf42[_0xe4c4('0x3e')],function(_0x475c2b){var _0x4bb16e={};_0x4bb16e[_0x475c2b]={'$like':'%'+_0x6f374e['query'][_0xe4c4('0x46')]+'%'};return _0x4bb16e;})});}_0x3ccf42=_[_0xe4c4('0x30')]({},_0x3ccf42,_0x6f374e[_0xe4c4('0x47')]);return db[_0xe4c4('0x61')]['findAll'](_0x3ccf42);}})[_0xe4c4('0x2b')](function(_0x25e84f){if(_0x25e84f){return db[_0xe4c4('0x62')]['findAndCountAll']({'where':{'id':_['map'](_0x25e84f,_0xe4c4('0x63')),'role':_0xe4c4('0x33')},'attributes':['id',_0xe4c4('0x2d'),_0xe4c4('0x64'),'updatedAt','createdAt']});}})[_0xe4c4('0x2b')](function(_0xe41a6d){if(_0xe41a6d){return{'count':_0xe41a6d[_0xe4c4('0x24')],'rows':_[_0xe4c4('0x35')](_0xe41a6d[_0xe4c4('0x4a')],function(_0x515e24){return{'membername':_0x515e24[_0xe4c4('0x2d')],'UserId':_0x515e24['id'],'queue_name':_0x1dfc2d['name'],'FaxQueueId':_0x1dfc2d['id'],'interface':util[_0xe4c4('0x65')](_0xe4c4('0x66'),'SIP',_0x515e24['name']),'penalty':0x0,'paused':_0x515e24[_0xe4c4('0x64')],'createdAt':_0x515e24[_0xe4c4('0x67')],'updatedAt':_0x515e24[_0xe4c4('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe4c4('0x2b')](respondWithFilteredResult(_0x1986ab,_0x3ccf42))[_0xe4c4('0x4b')](handleError(_0x1986ab,null));};exports['getTeams']=function(_0x4a71e9,_0x4e2b6b,_0x376c8e){var _0x3285f4={};var _0x4c10ef={};var _0x203f11;var _0x11faa3;return db[_0xe4c4('0x36')][_0xe4c4('0x5d')]({'where':{'id':_0x4a71e9['params']['id']}})['then'](handleEntityNotFound(_0x4e2b6b,null))[_0xe4c4('0x2b')](function(_0x32f019){if(_0x32f019){_0x203f11=_0x32f019;_0x4c10ef[_0xe4c4('0x3a')]=_[_0xe4c4('0x3b')](db[_0xe4c4('0x69')][_0xe4c4('0x37')]);_0x4c10ef[_0xe4c4('0x3c')]=_['keys'](_0x4a71e9[_0xe4c4('0x3c')]);_0x4c10ef[_0xe4c4('0x3d')]=_[_0xe4c4('0x3f')](_0x4c10ef[_0xe4c4('0x3a')],_0x4c10ef['query']);_0x3285f4[_0xe4c4('0x3e')]=_[_0xe4c4('0x3f')](_0x4c10ef[_0xe4c4('0x3a')],qs[_0xe4c4('0x40')](_0x4a71e9['query'][_0xe4c4('0x40')]));_0x3285f4[_0xe4c4('0x3e')]=_0x3285f4['attributes']['length']?_0x3285f4[_0xe4c4('0x3e')]:_0x4c10ef[_0xe4c4('0x3a')];_0x3285f4[_0xe4c4('0x42')]=qs[_0xe4c4('0x43')](_0x4a71e9[_0xe4c4('0x3c')][_0xe4c4('0x43')]);_0x3285f4[_0xe4c4('0x44')]=qs[_0xe4c4('0x3d')](_['pick'](_0x4a71e9['query'],_0x4c10ef[_0xe4c4('0x3d')]));if(_0x4a71e9[_0xe4c4('0x3c')][_0xe4c4('0x46')]){_0x3285f4[_0xe4c4('0x44')]=_[_0xe4c4('0x30')](_0x3285f4['where'],{'$or':_[_0xe4c4('0x35')](_0x3285f4[_0xe4c4('0x3e')],function(_0x425f38){var _0x295e2b={};_0x295e2b[_0x425f38]={'$like':'%'+_0x4a71e9[_0xe4c4('0x3c')][_0xe4c4('0x46')]+'%'};return _0x295e2b;})});}_0x3285f4=_[_0xe4c4('0x30')]({},_0x3285f4,_0x4a71e9[_0xe4c4('0x47')]);return _0x203f11[_0xe4c4('0x6a')](_0x3285f4);}})[_0xe4c4('0x2b')](function(_0x272345){if(_0x272345){_0x11faa3=_0x272345[_0xe4c4('0x5e')];if(!_0x4a71e9[_0xe4c4('0x3c')][_0xe4c4('0x41')](_0xe4c4('0x5f'))){_0x3285f4[_0xe4c4('0x25')]=qs['limit'](_0x4a71e9['query'][_0xe4c4('0x25')]);_0x3285f4['offset']=qs[_0xe4c4('0x22')](_0x4a71e9[_0xe4c4('0x3c')][_0xe4c4('0x22')]);}return _0x203f11[_0xe4c4('0x6a')](_0x3285f4);}})[_0xe4c4('0x2b')](function(_0x2f0664){if(_0x2f0664){return _0x2f0664?{'count':_0x11faa3,'rows':_0x2f0664}:null;}})[_0xe4c4('0x2b')](respondWithResult(_0x4e2b6b,null))[_0xe4c4('0x4b')](handleError(_0x4e2b6b,null));};exports[_0xe4c4('0x6b')]=function(_0x1579fe,_0x37bf48,_0x27a6e1){var _0x3030f6=_0x1579fe['body'][_0xe4c4('0x6c')];return db[_0xe4c4('0x69')][_0xe4c4('0x6d')]({'where':{'id':_0x3030f6},'attributes':['id'],'include':[{'model':db[_0xe4c4('0x62')],'as':_0xe4c4('0x6e'),'attributes':['id','name',_0xe4c4('0x6f'),_0xe4c4('0x70'),'interface'],'raw':!![]}]})[_0xe4c4('0x2b')](function(_0x32d704){if(_0x32d704){var _0x4f597a=_['flatMap'](_0x32d704,function(_0x4e63a5){var _0xaa2136=_0x4e63a5['get']({'plain':!![]});return _0xaa2136[_0xe4c4('0x6e')];});return db[_0xe4c4('0x36')][_0xe4c4('0x56')]({'where':{'id':_0x1579fe['params']['id']}})[_0xe4c4('0x2b')](function(_0x37cb8b){return db[_0xe4c4('0x71')]['transaction'](function(_0x52c9a4){return _0x37cb8b['addTeams'](_0x3030f6,{'transaction':_0x52c9a4})[_0xe4c4('0x2b')](function(){return BPromise[_0xe4c4('0x72')](_0x4f597a,function(_0x3c6b54){return db['UserFaxQueue'][_0xe4c4('0x73')]({'where':{'UserId':_0x3c6b54['id'],'FaxQueueId':_0x1579fe[_0xe4c4('0x4d')]['id']},'transaction':_0x52c9a4});});})[_0xe4c4('0x2b')](function(){_0x4f597a[_0xe4c4('0x74')](function(_0x325913){socket['emit'](_0xe4c4('0x75'),{'UserId':_0x325913['id'],'FaxQueueId':_0x37cb8b['id']});});});});});}})[_0xe4c4('0x2b')](respondWithStatusCode(_0x37bf48,null))[_0xe4c4('0x4b')](handleError(_0x37bf48,null));};exports['removeTeams']=function(_0x157c61,_0x21d8ca,_0x144e09){return db['Team'][_0xe4c4('0x6d')]({'where':{'id':_0x157c61[_0xe4c4('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe4c4('0x62')],'as':_0xe4c4('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xe4c4('0x2b')](handleEntityNotFound(_0x21d8ca,null))[_0xe4c4('0x2b')](function(_0x60f0fd){var _0x429ba6=_[_0xe4c4('0x35')](_0x60f0fd,'id');var _0x4df5c1=[];var _0x54abc3=[];var _0x1545e2=squel[_0xe4c4('0x76')]();_0x1545e2[_0xe4c4('0x77')](_0xe4c4('0x78'))[_0xe4c4('0x79')]('team_has_fax_queues','tq')[_0xe4c4('0x7a')]('user_has_teams','ut',_0xe4c4('0x7b'))[_0xe4c4('0x44')](_0xe4c4('0x7c'),_0x157c61['params']['id']);for(var _0x562aeb=0x0;_0x562aeb<_0x60f0fd['length'];_0x562aeb+=0x1){let _0xbac7c=_0x60f0fd[_0x562aeb];for(var _0x22147f=0x0;_0x22147f<_0xbac7c[_0xe4c4('0x6e')][_0xe4c4('0x5e')];_0x22147f+=0x1){let _0x551d45=_0xbac7c[_0xe4c4('0x6e')][_0x22147f];var _0xd024e8=_0x1545e2[_0xe4c4('0x7d')]();_0xd024e8[_0xe4c4('0x44')]('ut.UserId\x20=\x20?',_0x551d45['id']);_0x54abc3[_0xe4c4('0x7e')](db[_0xe4c4('0x71')]['query'](_0xd024e8['toString'](),{'type':db['sequelize'][_0xe4c4('0x7f')][_0xe4c4('0x80')]})[_0xe4c4('0x2b')](function(_0x339703){if(_0x339703[_0xe4c4('0x5e')]===0x1){return _0x551d45['id'];}else{var _0x24555b=_[_0xe4c4('0x81')](_[_0xe4c4('0x35')](_0x339703,_0xe4c4('0x82')),function(_0xcc6a14){return _['includes'](_0x429ba6,_0xcc6a14);});if(_0x24555b){return _0x551d45['id'];}}}));}}return BPromise['all'](_0x54abc3)[_0xe4c4('0x2b')](function(_0x2d159e){_0x4df5c1=_(_0x4df5c1)[_0xe4c4('0x83')](_0x2d159e)['compact']()[_0xe4c4('0x84')]();return db[_0xe4c4('0x36')]['find']({'where':{'id':_0x157c61[_0xe4c4('0x4d')]['id']}})['then'](function(_0x1e8e64){return db['sequelize'][_0xe4c4('0x85')](function(_0xfa8f93){return _0x1e8e64[_0xe4c4('0x86')](_0x157c61[_0xe4c4('0x3c')][_0xe4c4('0x6c')],{'transaction':_0xfa8f93})['then'](function(){if(!_['isEmpty'](_0x4df5c1)){return _0x1e8e64[_0xe4c4('0x87')](_0x4df5c1,{'transaction':_0xfa8f93});}})['then'](function(){_0x4df5c1[_0xe4c4('0x74')](function(_0x8bbdb9){socket[_0xe4c4('0x88')]('userFaxQueue:remove',{'UserId':_0x8bbdb9,'FaxQueueId':_0x1e8e64['id']});});});});});});})[_0xe4c4('0x2b')](respondWithStatusCode(_0x21d8ca,null))['catch'](handleError(_0x21d8ca,null));};exports[_0xe4c4('0x89')]=function(_0x5cc465,_0x551ddd,_0x2fb74b){return db[_0xe4c4('0x36')][_0xe4c4('0x56')]({'where':{'id':_0x5cc465['params']['id']}})[_0xe4c4('0x2b')](handleEntityNotFound(_0x551ddd,null))[_0xe4c4('0x2b')](function(_0x123aab){if(_0x123aab){return _0x123aab[_0xe4c4('0x89')](_0x5cc465['body'][_0xe4c4('0x6c')],_[_0xe4c4('0x8a')](_0x5cc465[_0xe4c4('0x4f')],[_0xe4c4('0x6c'),'id'])||{})['spread'](function(_0x51c62f){for(var _0x3b14c8=0x0;_0x3b14c8<_0x5cc465['body'][_0xe4c4('0x6c')][_0xe4c4('0x5e')];_0x3b14c8+=0x1){socket[_0xe4c4('0x88')](_0xe4c4('0x75'),{'UserId':_0x5cc465['body'][_0xe4c4('0x6c')][_0x3b14c8],'FaxQueueId':_0x5cc465[_0xe4c4('0x4d')]['id']});}return _0x51c62f;});}})[_0xe4c4('0x2b')](respondWithResult(_0x551ddd,null))[_0xe4c4('0x4b')](handleError(_0x551ddd,null));};exports['removeAgents']=function(_0xa36f3e,_0x58d2cb,_0x592915){return db['FaxQueue']['find']({'where':{'id':_0xa36f3e[_0xe4c4('0x4d')]['id']}})[_0xe4c4('0x2b')](handleEntityNotFound(_0x58d2cb,null))['then'](function(_0x24c63c){if(_0x24c63c){return _0x24c63c[_0xe4c4('0x87')](_0xa36f3e[_0xe4c4('0x3c')][_0xe4c4('0x6c')])['then'](function(){if(_['isArray'](_0xa36f3e[_0xe4c4('0x3c')][_0xe4c4('0x6c')])){for(var _0xc8168b=0x0;_0xc8168b<_0xa36f3e[_0xe4c4('0x3c')]['ids'][_0xe4c4('0x5e')];_0xc8168b+=0x1){socket[_0xe4c4('0x88')](_0xe4c4('0x8b'),{'UserId':Number(_0xa36f3e['query'][_0xe4c4('0x6c')][_0xc8168b]),'FaxQueueId':Number(_0xa36f3e[_0xe4c4('0x4d')]['id'])});}}else{socket[_0xe4c4('0x88')](_0xe4c4('0x8b'),{'UserId':Number(_0xa36f3e[_0xe4c4('0x3c')][_0xe4c4('0x6c')]),'FaxQueueId':Number(_0xa36f3e[_0xe4c4('0x4d')]['id'])});}});}})[_0xe4c4('0x2b')](respondWithStatusCode(_0x58d2cb,null))['catch'](handleError(_0x58d2cb,null));};exports[_0xe4c4('0x8c')]=function(_0x32153f,_0x38a27a,_0x57a800){var _0x40178a={};var _0x2006e1={};var _0x56ddaf;var _0x27add4;return db['FaxQueue']['findOne']({'where':{'id':_0x32153f[_0xe4c4('0x4d')]['id']}})[_0xe4c4('0x2b')](handleEntityNotFound(_0x38a27a,null))[_0xe4c4('0x2b')](function(_0x573e32){if(_0x573e32){_0x56ddaf=_0x573e32;_0x2006e1[_0xe4c4('0x3a')]=_['keys'](db[_0xe4c4('0x62')][_0xe4c4('0x37')]);_0x2006e1[_0xe4c4('0x3c')]=_[_0xe4c4('0x3b')](_0x32153f[_0xe4c4('0x3c')]);_0x2006e1[_0xe4c4('0x3d')]=_['intersection'](_0x2006e1[_0xe4c4('0x3a')],_0x2006e1[_0xe4c4('0x3c')]);_0x40178a[_0xe4c4('0x3e')]=_[_0xe4c4('0x3f')](_0x2006e1[_0xe4c4('0x3a')],qs[_0xe4c4('0x40')](_0x32153f['query'][_0xe4c4('0x40')]));_0x40178a[_0xe4c4('0x3e')]=_0x40178a['attributes'][_0xe4c4('0x5e')]?_0x40178a[_0xe4c4('0x3e')]:_0x2006e1['model'];_0x40178a[_0xe4c4('0x42')]=qs[_0xe4c4('0x43')](_0x32153f['query'][_0xe4c4('0x43')]);_0x40178a[_0xe4c4('0x44')]=qs[_0xe4c4('0x3d')](_[_0xe4c4('0x45')](_0x32153f['query'],_0x2006e1[_0xe4c4('0x3d')]));if(_0x32153f[_0xe4c4('0x3c')][_0xe4c4('0x46')]){_0x40178a[_0xe4c4('0x44')]=_[_0xe4c4('0x30')](_0x40178a[_0xe4c4('0x44')],{'$or':_[_0xe4c4('0x35')](_0x40178a[_0xe4c4('0x3e')],function(_0x69d886){var _0x5ba93d={};_0x5ba93d[_0x69d886]={'$like':'%'+_0x32153f['query']['filter']+'%'};return _0x5ba93d;})});}_0x40178a=_[_0xe4c4('0x30')]({},_0x40178a,_0x32153f[_0xe4c4('0x47')]);return _0x56ddaf[_0xe4c4('0x8c')](_0x40178a);}})['then'](function(_0x33e8a7){if(_0x33e8a7){_0x27add4=_0x33e8a7[_0xe4c4('0x5e')];if(!_0x32153f[_0xe4c4('0x3c')][_0xe4c4('0x41')](_0xe4c4('0x5f'))){_0x40178a[_0xe4c4('0x25')]=qs[_0xe4c4('0x25')](_0x32153f[_0xe4c4('0x3c')][_0xe4c4('0x25')]);_0x40178a['offset']=qs[_0xe4c4('0x22')](_0x32153f[_0xe4c4('0x3c')][_0xe4c4('0x22')]);}return _0x56ddaf[_0xe4c4('0x8c')](_0x40178a);}})[_0xe4c4('0x2b')](function(_0x249246){if(_0x249246){return _0x249246?{'count':_0x27add4,'rows':_0x249246}:null;}})[_0xe4c4('0x2b')](respondWithResult(_0x38a27a,null))[_0xe4c4('0x4b')](handleError(_0x38a27a,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index b1ce3fd..8d2e8ab 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 _0xd5df=['hasOwnProperty','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit'];(function(_0x1be787,_0x5c92b5){var _0x340b4d=function(_0x43d6a0){while(--_0x43d6a0){_0x1be787['push'](_0x1be787['shift']());}};_0x340b4d(++_0x5c92b5);}(_0xd5df,0x12b));var _0xfd5d=function(_0x3efe74,_0x5a7297){_0x3efe74=_0x3efe74-0x0;var _0x427c25=_0xd5df[_0x3efe74];return _0x427c25;};'use strict';var EventEmitter=require(_0xfd5d('0x0'));var FaxQueue=require(_0xfd5d('0x1'))['db'][_0xfd5d('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xfd5d('0x3')](0x0);var events={'afterCreate':_0xfd5d('0x4'),'afterUpdate':'update','afterDestroy':_0xfd5d('0x5')};function emitEvent(_0x171f69){return function(_0xb86728,_0x575e0c,_0x4a9ee4){FaxQueueEvents[_0xfd5d('0x6')](_0x171f69+':'+_0xb86728['id'],_0xb86728);FaxQueueEvents['emit'](_0x171f69,_0xb86728);_0x4a9ee4(null);};}for(var e in events){if(events[_0xfd5d('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xfd5d('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xbdc7=['emit','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove'];(function(_0x498d4f,_0x6e928e){var _0x1c81a8=function(_0x11dd33){while(--_0x11dd33){_0x498d4f['push'](_0x498d4f['shift']());}};_0x1c81a8(++_0x6e928e);}(_0xbdc7,0x197));var _0x7bdc=function(_0x439030,_0x2a3193){_0x439030=_0x439030-0x0;var _0x20511a=_0xbdc7[_0x439030];return _0x20511a;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x7bdc('0x0'))['db'][_0x7bdc('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x7bdc('0x2')](0x0);var events={'afterCreate':_0x7bdc('0x3'),'afterUpdate':_0x7bdc('0x4'),'afterDestroy':_0x7bdc('0x5')};function emitEvent(_0x7466be){return function(_0x4cbe6a,_0x521d0f,_0x414355){FaxQueueEvents[_0x7bdc('0x6')](_0x7466be+':'+_0x4cbe6a['id'],_0x4cbe6a);FaxQueueEvents[_0x7bdc('0x6')](_0x7466be,_0x4cbe6a);_0x414355(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](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 b07e8db..8da5ca7 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 _0xe49d=['moment','bluebird','path','../../config/environment','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api'];(function(_0x14df91,_0x4516a6){var _0x208c3c=function(_0x2a0634){while(--_0x2a0634){_0x14df91['push'](_0x14df91['shift']());}};_0x208c3c(++_0x4516a6);}(_0xe49d,0x1dc));var _0xde49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe49d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xde49('0x0'));var util=require(_0xde49('0x1'));var logger=require(_0xde49('0x2'))(_0xde49('0x3'));var moment=require(_0xde49('0x4'));var BPromise=require(_0xde49('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde49('0x6'));var rimraf=require('rimraf');var config=require(_0xde49('0x7'));var attributes=require('./faxQueue.attributes');module[_0xde49('0x8')]=function(_0xc441fe,_0x353eed){return _0xc441fe[_0xde49('0x9')](_0xde49('0xa'),attributes,{'tableName':_0xde49('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda56=['exports','define','FaxQueue','fax_queues','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1c352e,_0x2bc428){var _0x5a57f6=function(_0x279bca){while(--_0x279bca){_0x1c352e['push'](_0x1c352e['shift']());}};_0x5a57f6(++_0x2bc428);}(_0xda56,0xf4));var _0x6da5=function(_0x5659f4,_0x3a072a){_0x5659f4=_0x5659f4-0x0;var _0x18e9a5=_0xda56[_0x5659f4];return _0x18e9a5;};'use strict';var _=require('lodash');var util=require(_0x6da5('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6da5('0x1'));var rp=require(_0x6da5('0x2'));var fs=require('fs');var path=require(_0x6da5('0x3'));var rimraf=require(_0x6da5('0x4'));var config=require(_0x6da5('0x5'));var attributes=require('./faxQueue.attributes');module[_0x6da5('0x6')]=function(_0x41e7b3,_0x224103){return _0x41e7b3[_0x6da5('0x7')](_0x6da5('0x8'),attributes,{'tableName':_0x6da5('0x9'),'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 cbf7d0e..93edb8d 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 _0xcfb0=['result','GetFaxQueue','FaxQueue','findAll','options','limit','include','map','attributes','ShowFaxQueue','find','raw','where','model','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent'];(function(_0x1cc961,_0x2c42ee){var _0x471d86=function(_0x44e422){while(--_0x44e422){_0x1cc961['push'](_0x1cc961['shift']());}};_0x471d86(++_0x2c42ee);}(_0xcfb0,0x16e));var _0x0cfb=function(_0x3e7a9a,_0x135225){_0x3e7a9a=_0x3e7a9a-0x0;var _0x5e8b46=_0xcfb0[_0x3e7a9a];return _0x5e8b46;};'use strict';var _=require(_0x0cfb('0x0'));var util=require(_0x0cfb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0cfb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cfb('0x3'))['db'];var utils=require(_0x0cfb('0x4'));var logger=require('../../config/logger')(_0x0cfb('0x5'));var config=require(_0x0cfb('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0cfb('0x7')]({'port':0x232a});config[_0x0cfb('0x8')]=_[_0x0cfb('0x9')](config[_0x0cfb('0x8')],{'host':_0x0cfb('0xa'),'port':0x18eb});var socket=require(_0x0cfb('0xb'))(new Redis(config['redis']));require(_0x0cfb('0xc'))[_0x0cfb('0xd')](socket);function respondWithRpcPromise(_0x104313,_0x590253,_0x365add){return new BPromise(function(_0xa962a,_0x46433d){return client[_0x0cfb('0xe')](_0x104313,_0x365add)[_0x0cfb('0xf')](function(_0x5657f4){logger['info'](_0x0cfb('0x10'),_0x590253,'request\x20sent');logger[_0x0cfb('0x11')](_0x0cfb('0x12'),_0x590253,'request\x20sent',JSON[_0x0cfb('0x13')](_0x5657f4));if(_0x5657f4[_0x0cfb('0x14')]){if(_0x5657f4[_0x0cfb('0x14')]['code']===0x1f4){logger['error'](_0x0cfb('0x10'),_0x590253,_0x5657f4[_0x0cfb('0x14')][_0x0cfb('0x15')]);return _0x46433d(_0x5657f4[_0x0cfb('0x14')][_0x0cfb('0x15')]);}logger[_0x0cfb('0x14')](_0x0cfb('0x10'),_0x590253,_0x5657f4[_0x0cfb('0x14')][_0x0cfb('0x15')]);return _0xa962a(_0x5657f4[_0x0cfb('0x14')][_0x0cfb('0x15')]);}else{logger[_0x0cfb('0x16')]('FaxQueue,\x20%s,\x20%s',_0x590253,_0x0cfb('0x17'));_0xa962a(_0x5657f4[_0x0cfb('0x18')][_0x0cfb('0x15')]);}})['catch'](function(_0x5ec203){logger[_0x0cfb('0x14')](_0x0cfb('0x10'),_0x590253,_0x5ec203);_0x46433d(_0x5ec203);});});}exports[_0x0cfb('0x19')]=function(_0xf0f8bf){var _0x19aade=this;return new Promise(function(_0x367cde,_0x58fa66){return db[_0x0cfb('0x1a')][_0x0cfb('0x1b')]({'raw':_0xf0f8bf[_0x0cfb('0x1c')]?_0xf0f8bf[_0x0cfb('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xf0f8bf[_0x0cfb('0x1c')]?_0xf0f8bf[_0x0cfb('0x1c')]['where']||null:null,'attributes':_0xf0f8bf[_0x0cfb('0x1c')]?_0xf0f8bf[_0x0cfb('0x1c')]['attributes']||null:null,'limit':_0xf0f8bf[_0x0cfb('0x1c')]?_0xf0f8bf['options'][_0x0cfb('0x1d')]||null:null,'include':_0xf0f8bf[_0x0cfb('0x1c')]?_0xf0f8bf[_0x0cfb('0x1c')][_0x0cfb('0x1e')]?_[_0x0cfb('0x1f')](_0xf0f8bf[_0x0cfb('0x1c')]['include'],function(_0x27e439){return{'model':db[_0x27e439['model']],'as':_0x27e439['as'],'attributes':_0x27e439[_0x0cfb('0x20')],'include':_0x27e439[_0x0cfb('0x1e')]?_[_0x0cfb('0x1f')](_0x27e439[_0x0cfb('0x1e')],function(_0x1b52f6){return{'model':db[_0x1b52f6['model']],'as':_0x1b52f6['as'],'attributes':_0x1b52f6[_0x0cfb('0x20')],'include':_0x1b52f6[_0x0cfb('0x1e')]?_[_0x0cfb('0x1f')](_0x1b52f6[_0x0cfb('0x1e')],function(_0x5e4dc1){return{'model':db[_0x5e4dc1['model']],'as':_0x5e4dc1['as'],'attributes':_0x5e4dc1[_0x0cfb('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0cfb('0xf')](function(_0x801708){logger[_0x0cfb('0x16')](_0x0cfb('0x19'),_0xf0f8bf);logger[_0x0cfb('0x11')](_0x0cfb('0x19'),_0xf0f8bf,JSON[_0x0cfb('0x13')](_0x801708));_0x367cde(_0x801708);})['catch'](function(_0x8a1523){logger[_0x0cfb('0x14')](_0x0cfb('0x19'),_0x8a1523[_0x0cfb('0x15')],_0xf0f8bf);_0x58fa66(_0x19aade['error'](0x1f4,_0x8a1523[_0x0cfb('0x15')]));});});};exports[_0x0cfb('0x21')]=function(_0x10d9f7){var _0x5bc559=this;return new Promise(function(_0x542b8e,_0x4ed38d){return db[_0x0cfb('0x1a')][_0x0cfb('0x22')]({'raw':_0x10d9f7[_0x0cfb('0x1c')]?_0x10d9f7[_0x0cfb('0x1c')][_0x0cfb('0x23')]===undefined?!![]:![]:!![],'where':_0x10d9f7[_0x0cfb('0x1c')]?_0x10d9f7['options'][_0x0cfb('0x24')]||null:null,'attributes':_0x10d9f7[_0x0cfb('0x1c')]?_0x10d9f7['options'][_0x0cfb('0x20')]||null:null,'include':_0x10d9f7[_0x0cfb('0x1c')]?_0x10d9f7[_0x0cfb('0x1c')][_0x0cfb('0x1e')]?_[_0x0cfb('0x1f')](_0x10d9f7[_0x0cfb('0x1c')][_0x0cfb('0x1e')],function(_0x5d2e08){return{'model':db[_0x5d2e08['model']],'as':_0x5d2e08['as'],'attributes':_0x5d2e08[_0x0cfb('0x20')],'include':_0x5d2e08[_0x0cfb('0x1e')]?_[_0x0cfb('0x1f')](_0x5d2e08['include'],function(_0x132878){return{'model':db[_0x132878[_0x0cfb('0x25')]],'as':_0x132878['as'],'attributes':_0x132878[_0x0cfb('0x20')],'include':_0x132878[_0x0cfb('0x1e')]?_[_0x0cfb('0x1f')](_0x132878[_0x0cfb('0x1e')],function(_0x128117){return{'model':db[_0x128117['model']],'as':_0x128117['as'],'attributes':_0x128117[_0x0cfb('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0cfb('0xf')](function(_0x3c536d){logger['info'](_0x0cfb('0x21'),_0x10d9f7);logger[_0x0cfb('0x11')]('ShowFaxQueue',_0x10d9f7,JSON[_0x0cfb('0x13')](_0x3c536d));_0x542b8e(_0x3c536d);})[_0x0cfb('0x26')](function(_0x55eee5){logger['error'](_0x0cfb('0x21'),_0x55eee5[_0x0cfb('0x15')],_0x10d9f7);_0x4ed38d(_0x5bc559[_0x0cfb('0x14')](0x1f4,_0x55eee5['message']));});});}; \ No newline at end of file +var _0xc8b7=['defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxQueue','findAll','options','raw','where','attributes','map','include','model','GetFaxQueue','ShowFaxQueue','find','then','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0xf3fb4e,_0x1f8665){var _0x561bdb=function(_0x2a538c){while(--_0x2a538c){_0xf3fb4e['push'](_0xf3fb4e['shift']());}};_0x561bdb(++_0x1f8665);}(_0xc8b7,0x186));var _0x7c8b=function(_0x42652b,_0x46573a){_0x42652b=_0x42652b-0x0;var _0xa299f9=_0xc8b7[_0x42652b];return _0xa299f9;};'use strict';var _=require(_0x7c8b('0x0'));var util=require(_0x7c8b('0x1'));var moment=require(_0x7c8b('0x2'));var BPromise=require(_0x7c8b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c8b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c8b('0x5'))(_0x7c8b('0x6'));var config=require(_0x7c8b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7c8b('0x8')]({'port':0x232a});config[_0x7c8b('0x9')]=_[_0x7c8b('0xa')](config[_0x7c8b('0x9')],{'host':_0x7c8b('0xb'),'port':0x18eb});var socket=require(_0x7c8b('0xc'))(new Redis(config[_0x7c8b('0x9')]));require(_0x7c8b('0xd'))[_0x7c8b('0xe')](socket);function respondWithRpcPromise(_0x4093a7,_0x2d24ab,_0x279b77){return new BPromise(function(_0x42b47c,_0x46519a){return client[_0x7c8b('0xf')](_0x4093a7,_0x279b77)['then'](function(_0x4ef17f){logger['info'](_0x7c8b('0x10'),_0x2d24ab,_0x7c8b('0x11'));logger[_0x7c8b('0x12')](_0x7c8b('0x13'),_0x2d24ab,_0x7c8b('0x11'),JSON[_0x7c8b('0x14')](_0x4ef17f));if(_0x4ef17f[_0x7c8b('0x15')]){if(_0x4ef17f[_0x7c8b('0x15')][_0x7c8b('0x16')]===0x1f4){logger['error'](_0x7c8b('0x10'),_0x2d24ab,_0x4ef17f[_0x7c8b('0x15')][_0x7c8b('0x17')]);return _0x46519a(_0x4ef17f['error'][_0x7c8b('0x17')]);}logger[_0x7c8b('0x15')](_0x7c8b('0x10'),_0x2d24ab,_0x4ef17f['error'][_0x7c8b('0x17')]);return _0x42b47c(_0x4ef17f[_0x7c8b('0x15')][_0x7c8b('0x17')]);}else{logger[_0x7c8b('0x18')](_0x7c8b('0x10'),_0x2d24ab,_0x7c8b('0x11'));_0x42b47c(_0x4ef17f[_0x7c8b('0x19')][_0x7c8b('0x17')]);}})[_0x7c8b('0x1a')](function(_0x4c03f7){logger[_0x7c8b('0x15')]('FaxQueue,\x20%s,\x20%s',_0x2d24ab,_0x4c03f7);_0x46519a(_0x4c03f7);});});}exports['GetFaxQueue']=function(_0x5b350f){var _0x56f67a=this;return new Promise(function(_0x5d35f3,_0x58c572){return db[_0x7c8b('0x1b')][_0x7c8b('0x1c')]({'raw':_0x5b350f[_0x7c8b('0x1d')]?_0x5b350f[_0x7c8b('0x1d')][_0x7c8b('0x1e')]===undefined?!![]:![]:!![],'where':_0x5b350f[_0x7c8b('0x1d')]?_0x5b350f[_0x7c8b('0x1d')][_0x7c8b('0x1f')]||null:null,'attributes':_0x5b350f[_0x7c8b('0x1d')]?_0x5b350f[_0x7c8b('0x1d')][_0x7c8b('0x20')]||null:null,'limit':_0x5b350f[_0x7c8b('0x1d')]?_0x5b350f[_0x7c8b('0x1d')]['limit']||null:null,'include':_0x5b350f[_0x7c8b('0x1d')]?_0x5b350f['options']['include']?_[_0x7c8b('0x21')](_0x5b350f[_0x7c8b('0x1d')][_0x7c8b('0x22')],function(_0x1951b3){return{'model':db[_0x1951b3[_0x7c8b('0x23')]],'as':_0x1951b3['as'],'attributes':_0x1951b3[_0x7c8b('0x20')],'include':_0x1951b3[_0x7c8b('0x22')]?_[_0x7c8b('0x21')](_0x1951b3[_0x7c8b('0x22')],function(_0x40c166){return{'model':db[_0x40c166['model']],'as':_0x40c166['as'],'attributes':_0x40c166['attributes'],'include':_0x40c166[_0x7c8b('0x22')]?_[_0x7c8b('0x21')](_0x40c166[_0x7c8b('0x22')],function(_0x19e01){return{'model':db[_0x19e01['model']],'as':_0x19e01['as'],'attributes':_0x19e01[_0x7c8b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35dc21){logger['info'](_0x7c8b('0x24'),_0x5b350f);logger[_0x7c8b('0x12')](_0x7c8b('0x24'),_0x5b350f,JSON['stringify'](_0x35dc21));_0x5d35f3(_0x35dc21);})[_0x7c8b('0x1a')](function(_0x2d0f91){logger[_0x7c8b('0x15')](_0x7c8b('0x24'),_0x2d0f91[_0x7c8b('0x17')],_0x5b350f);_0x58c572(_0x56f67a[_0x7c8b('0x15')](0x1f4,_0x2d0f91[_0x7c8b('0x17')]));});});};exports[_0x7c8b('0x25')]=function(_0x3099bf){var _0x2e316c=this;return new Promise(function(_0x1bb2f2,_0x147ae8){return db[_0x7c8b('0x1b')][_0x7c8b('0x26')]({'raw':_0x3099bf['options']?_0x3099bf['options']['raw']===undefined?!![]:![]:!![],'where':_0x3099bf['options']?_0x3099bf[_0x7c8b('0x1d')]['where']||null:null,'attributes':_0x3099bf['options']?_0x3099bf[_0x7c8b('0x1d')][_0x7c8b('0x20')]||null:null,'include':_0x3099bf[_0x7c8b('0x1d')]?_0x3099bf[_0x7c8b('0x1d')][_0x7c8b('0x22')]?_[_0x7c8b('0x21')](_0x3099bf[_0x7c8b('0x1d')]['include'],function(_0x12219d){return{'model':db[_0x12219d[_0x7c8b('0x23')]],'as':_0x12219d['as'],'attributes':_0x12219d[_0x7c8b('0x20')],'include':_0x12219d[_0x7c8b('0x22')]?_['map'](_0x12219d[_0x7c8b('0x22')],function(_0x54b889){return{'model':db[_0x54b889[_0x7c8b('0x23')]],'as':_0x54b889['as'],'attributes':_0x54b889[_0x7c8b('0x20')],'include':_0x54b889[_0x7c8b('0x22')]?_[_0x7c8b('0x21')](_0x54b889[_0x7c8b('0x22')],function(_0x265ba4){return{'model':db[_0x265ba4[_0x7c8b('0x23')]],'as':_0x265ba4['as'],'attributes':_0x265ba4['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c8b('0x27')](function(_0x352346){logger[_0x7c8b('0x18')]('ShowFaxQueue',_0x3099bf);logger['debug'](_0x7c8b('0x25'),_0x3099bf,JSON[_0x7c8b('0x14')](_0x352346));_0x1bb2f2(_0x352346);})[_0x7c8b('0x1a')](function(_0x31ee58){logger[_0x7c8b('0x15')](_0x7c8b('0x25'),_0x31ee58[_0x7c8b('0x17')],_0x3099bf);_0x147ae8(_0x2e316c[_0x7c8b('0x15')](0x1f4,_0x31ee58[_0x7c8b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index f184da1..c324482 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 _0xce40=['save','update','emit','register','length','./faxQueue.events'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xce40,0x15b));var _0x0ce4=function(_0x38fb0d,_0x52b5db){_0x38fb0d=_0x38fb0d-0x0;var _0x30a5d6=_0xce40[_0x38fb0d];return _0x30a5d6;};'use strict';var FaxQueueEvents=require(_0x0ce4('0x0'));var events=[_0x0ce4('0x1'),'remove',_0x0ce4('0x2')];function createListener(_0x5d946a,_0x3e4ee0){return function(_0x179737){_0x3e4ee0[_0x0ce4('0x3')](_0x5d946a,_0x179737);};}function removeListener(_0x2d7022,_0x509f13){return function(){FaxQueueEvents['removeListener'](_0x2d7022,_0x509f13);};}exports[_0x0ce4('0x4')]=function(_0x120951){for(var _0xe51d49=0x0,_0x1122f6=events[_0x0ce4('0x5')];_0xe51d49<_0x1122f6;_0xe51d49++){var _0x4d8515=events[_0xe51d49];var _0x4eedf7=createListener('faxQueue:'+_0x4d8515,_0x120951);FaxQueueEvents['on'](_0x4d8515,_0x4eedf7);}}; \ No newline at end of file +var _0x5444=['remove','update','removeListener','register','length','faxQueue:','save'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x5444,0x164));var _0x4544=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5444[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x4544('0x0'),_0x4544('0x1'),_0x4544('0x2')];function createListener(_0x147b07,_0x31bb4b){return function(_0x2fd86b){_0x31bb4b['emit'](_0x147b07,_0x2fd86b);};}function removeListener(_0x44ef1f,_0x211883){return function(){FaxQueueEvents[_0x4544('0x3')](_0x44ef1f,_0x211883);};}exports[_0x4544('0x4')]=function(_0x127b85){for(var _0x33d467=0x0,_0x330f8f=events[_0x4544('0x5')];_0x33d467<_0x330f8f;_0x33d467++){var _0xec02e8=events[_0x33d467];var _0x247c3a=createListener(_0x4544('0x6')+_0xec02e8,_0x127b85);FaxQueueEvents['on'](_0xec02e8,_0x247c3a);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 530e877..d75b436 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 _0x4513=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeAgents','exports','multer','util'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x4513,0x177));var _0x3451=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4513[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0x3451('0x0'));var util=require(_0x3451('0x1'));var path=require(_0x3451('0x2'));var timeout=require(_0x3451('0x3'));var express=require('express');var router=express[_0x3451('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3451('0x5'));var interaction=require(_0x3451('0x6'));var config=require('../../config/environment');var controller=require(_0x3451('0x7'));router['get']('/',auth[_0x3451('0x8')](),controller['index']);router[_0x3451('0x9')](_0x3451('0xa'),auth[_0x3451('0x8')](),controller[_0x3451('0xb')]);router[_0x3451('0x9')](_0x3451('0xc'),auth[_0x3451('0x8')](),controller[_0x3451('0xd')]);router[_0x3451('0x9')](_0x3451('0xe'),auth[_0x3451('0x8')](),controller[_0x3451('0xf')]);router[_0x3451('0x9')](_0x3451('0x10'),auth['isAuthenticated'](),controller[_0x3451('0x11')]);router[_0x3451('0x9')](_0x3451('0x12'),auth[_0x3451('0x8')](),controller[_0x3451('0x13')]);router[_0x3451('0x14')]('/',auth[_0x3451('0x8')](),controller[_0x3451('0x15')]);router[_0x3451('0x14')](_0x3451('0x10'),auth[_0x3451('0x8')](),controller[_0x3451('0x16')]);router[_0x3451('0x14')]('/:id/users',auth[_0x3451('0x8')](),controller[_0x3451('0x17')]);router[_0x3451('0x18')](_0x3451('0xc'),auth[_0x3451('0x8')](),controller['update']);router[_0x3451('0x19')](_0x3451('0xc'),auth[_0x3451('0x8')](),controller[_0x3451('0x1a')]);router[_0x3451('0x19')](_0x3451('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x3451('0x12'),auth[_0x3451('0x8')](),controller[_0x3451('0x1b')]);module[_0x3451('0x1c')]=router; \ No newline at end of file +var _0x27af=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x27af,0xbe));var _0xf27a=function(_0x272830,_0x25698e){_0x272830=_0x272830-0x0;var _0x12173c=_0x27af[_0x272830];return _0x12173c;};'use strict';var multer=require(_0xf27a('0x0'));var util=require(_0xf27a('0x1'));var path=require(_0xf27a('0x2'));var timeout=require(_0xf27a('0x3'));var express=require(_0xf27a('0x4'));var router=express[_0xf27a('0x5')]();var fs_extra=require(_0xf27a('0x6'));var auth=require(_0xf27a('0x7'));var interaction=require(_0xf27a('0x8'));var config=require(_0xf27a('0x9'));var controller=require(_0xf27a('0xa'));router[_0xf27a('0xb')]('/',auth[_0xf27a('0xc')](),controller[_0xf27a('0xd')]);router['get'](_0xf27a('0xe'),auth[_0xf27a('0xc')](),controller[_0xf27a('0xf')]);router[_0xf27a('0xb')](_0xf27a('0x10'),auth[_0xf27a('0xc')](),controller[_0xf27a('0x11')]);router[_0xf27a('0xb')]('/:id/members',auth[_0xf27a('0xc')](),controller[_0xf27a('0x12')]);router['get'](_0xf27a('0x13'),auth[_0xf27a('0xc')](),controller[_0xf27a('0x14')]);router[_0xf27a('0xb')](_0xf27a('0x15'),auth[_0xf27a('0xc')](),controller[_0xf27a('0x16')]);router['post']('/',auth[_0xf27a('0xc')](),controller['create']);router[_0xf27a('0x17')](_0xf27a('0x13'),auth[_0xf27a('0xc')](),controller['addTeams']);router[_0xf27a('0x17')](_0xf27a('0x15'),auth['isAuthenticated'](),controller[_0xf27a('0x18')]);router[_0xf27a('0x19')](_0xf27a('0x10'),auth[_0xf27a('0xc')](),controller[_0xf27a('0x1a')]);router['delete'](_0xf27a('0x10'),auth[_0xf27a('0xc')](),controller[_0xf27a('0x1b')]);router[_0xf27a('0x1c')](_0xf27a('0x13'),auth['isAuthenticated'](),controller[_0xf27a('0x1d')]);router[_0xf27a('0x1c')](_0xf27a('0x15'),auth['isAuthenticated'](),controller[_0xf27a('0x1e')]);module[_0xf27a('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 7d659a2..39bc0be 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 _0x2e5d=['exports','STRING','DATE','sequelize'];(function(_0x332e61,_0x169a93){var _0x385dfd=function(_0x3eab89){while(--_0x3eab89){_0x332e61['push'](_0x332e61['shift']());}};_0x385dfd(++_0x169a93);}(_0x2e5d,0x1c7));var _0xd2e5=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0x2e5d[_0x2932cf];return _0x1711dd;};'use strict';var moment=require('moment');var Sequelize=require(_0xd2e5('0x0'));module[_0xd2e5('0x1')]={'uniqueid':{'type':Sequelize[_0xd2e5('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd2e5('0x2')]},'joinAt':{'type':Sequelize[_0xd2e5('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd2e5('0x3')]},'exitAt':{'type':Sequelize[_0xd2e5('0x3')]},'reason':{'type':Sequelize[_0xd2e5('0x2')]}}; \ No newline at end of file +var _0x938c=['STRING','DATE','moment','sequelize'];(function(_0x269bbf,_0x42dcac){var _0x23caa3=function(_0x21bdb2){while(--_0x21bdb2){_0x269bbf['push'](_0x269bbf['shift']());}};_0x23caa3(++_0x42dcac);}(_0x938c,0xae));var _0xc938=function(_0x5e1c90,_0x3ea0b9){_0x5e1c90=_0x5e1c90-0x0;var _0x520011=_0x938c[_0x5e1c90];return _0x520011;};'use strict';var moment=require(_0xc938('0x0'));var Sequelize=require(_0xc938('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xc938('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc938('0x3')]},'acceptAt':{'type':Sequelize[_0xc938('0x3')]},'exitAt':{'type':Sequelize[_0xc938('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 7c4712f..2b30be0 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 _0xbdb7=['bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','error','stack','name','send','render','merge','body','contact','message','agent','interaction','index','map','FaxQueueReport','rawAttributes','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','type','VIRTUAL','then','include','findAll','rows','catch','show','params','includeAll','options','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x166f50,_0xa4f7a0){var _0x30f413=function(_0x2c41f5){while(--_0x2c41f5){_0x166f50['push'](_0x166f50['shift']());}};_0x30f413(++_0xa4f7a0);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0xbdb7[_0x276468];return _0x36dc3a;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}function getMustacheRender(_0xe1141d,_0x371e8a){return Mustache[_0x7bdb('0x27')](_0xe1141d,_[_0x7bdb('0x28')](_0x371e8a[_0x7bdb('0x29')],{'contact':_0x371e8a[_0x7bdb('0x2a')],'message':_0x371e8a[_0x7bdb('0x2b')],'agent':_0x371e8a[_0x7bdb('0x2c')],'interaction':_0x371e8a[_0x7bdb('0x2d')],'account':_0x371e8a['account']}))||'';}exports[_0x7bdb('0x2e')]=function(_0x23fc3a,_0x8f7672){var _0x9f5c1={},_0x29eac5={},_0x5da819={'count':0x0,'rows':[]};var _0x28aa2f=_[_0x7bdb('0x2f')](db[_0x7bdb('0x30')][_0x7bdb('0x31')],function(_0x58c6b7){return{'name':_0x58c6b7['fieldName'],'type':_0x58c6b7['type'][_0x7bdb('0x32')]};});_0x29eac5['model']=_[_0x7bdb('0x2f')](_0x28aa2f,'name');_0x29eac5[_0x7bdb('0x33')]=_[_0x7bdb('0x34')](_0x23fc3a[_0x7bdb('0x33')]);_0x29eac5['filters']=_[_0x7bdb('0x35')](_0x29eac5['model'],_0x29eac5['query']);_0x9f5c1[_0x7bdb('0x36')]=_['intersection'](_0x29eac5[_0x7bdb('0x37')],qs['fields'](_0x23fc3a['query'][_0x7bdb('0x38')]));_0x9f5c1[_0x7bdb('0x36')]=_0x9f5c1[_0x7bdb('0x36')][_0x7bdb('0x39')]?_0x9f5c1[_0x7bdb('0x36')]:_0x29eac5[_0x7bdb('0x37')];if(!_0x23fc3a['query'][_0x7bdb('0x3a')](_0x7bdb('0x3b'))){_0x9f5c1[_0x7bdb('0x1b')]=qs[_0x7bdb('0x1b')](_0x23fc3a[_0x7bdb('0x33')][_0x7bdb('0x1b')]);_0x9f5c1[_0x7bdb('0x19')]=qs[_0x7bdb('0x19')](_0x23fc3a[_0x7bdb('0x33')]['offset']);}_0x9f5c1['order']=qs[_0x7bdb('0x3c')](_0x23fc3a[_0x7bdb('0x33')][_0x7bdb('0x3c')]);_0x9f5c1[_0x7bdb('0x3d')]=qs[_0x7bdb('0x3e')](_['pick'](_0x23fc3a['query'],_0x29eac5[_0x7bdb('0x3e')]),_0x28aa2f);if(_0x23fc3a['query'][_0x7bdb('0x3f')]){_0x9f5c1['where']=_[_0x7bdb('0x28')](_0x9f5c1['where'],{'$or':_['map'](_0x28aa2f,function(_0x21dae7){if(_0x21dae7[_0x7bdb('0x40')]!==_0x7bdb('0x41')){var _0x29435f={};_0x29435f[_0x21dae7[_0x7bdb('0x25')]]={'$like':'%'+_0x23fc3a[_0x7bdb('0x33')][_0x7bdb('0x3f')]+'%'};return _0x29435f;}})});}_0x9f5c1=_['merge']({},_0x9f5c1,_0x23fc3a['options']);var _0x18bdf6={'where':_0x9f5c1[_0x7bdb('0x3d')]};return db[_0x7bdb('0x30')][_0x7bdb('0x1c')](_0x18bdf6)[_0x7bdb('0x42')](function(_0x1824c6){_0x5da819[_0x7bdb('0x1c')]=_0x1824c6;if(_0x23fc3a['query']['includeAll']){_0x9f5c1[_0x7bdb('0x43')]=[{'all':!![]}];}return db[_0x7bdb('0x30')][_0x7bdb('0x44')](_0x9f5c1);})[_0x7bdb('0x42')](function(_0x52158e){_0x5da819[_0x7bdb('0x45')]=_0x52158e;return _0x5da819;})['then'](respondWithFilteredResult(_0x8f7672,_0x9f5c1))[_0x7bdb('0x46')](handleError(_0x8f7672,null));};exports[_0x7bdb('0x47')]=function(_0x218361,_0x264f3a){var _0x6b10d4={'raw':!![],'where':{'id':_0x218361[_0x7bdb('0x48')]['id']}},_0x375deb={};_0x375deb[_0x7bdb('0x37')]=_[_0x7bdb('0x34')](db['FaxQueueReport'][_0x7bdb('0x31')]);_0x375deb[_0x7bdb('0x33')]=_['keys'](_0x218361[_0x7bdb('0x33')]);_0x375deb['filters']=_[_0x7bdb('0x35')](_0x375deb[_0x7bdb('0x37')],_0x375deb[_0x7bdb('0x33')]);_0x6b10d4[_0x7bdb('0x36')]=_[_0x7bdb('0x35')](_0x375deb['model'],qs[_0x7bdb('0x38')](_0x218361[_0x7bdb('0x33')][_0x7bdb('0x38')]));_0x6b10d4[_0x7bdb('0x36')]=_0x6b10d4[_0x7bdb('0x36')]['length']?_0x6b10d4[_0x7bdb('0x36')]:_0x375deb[_0x7bdb('0x37')];if(_0x218361[_0x7bdb('0x33')][_0x7bdb('0x49')]){_0x6b10d4[_0x7bdb('0x43')]=[{'all':!![]}];}_0x6b10d4=_[_0x7bdb('0x28')]({},_0x6b10d4,_0x218361[_0x7bdb('0x4a')]);return db[_0x7bdb('0x30')][_0x7bdb('0x4b')](_0x6b10d4)[_0x7bdb('0x42')](handleEntityNotFound(_0x264f3a,null))['then'](respondWithResult(_0x264f3a,null))[_0x7bdb('0x46')](handleError(_0x264f3a,null));};exports['create']=function(_0x47cccd,_0x1a7cbf){return db[_0x7bdb('0x30')]['create'](_0x47cccd[_0x7bdb('0x29')],{})[_0x7bdb('0x42')](respondWithResult(_0x1a7cbf,0xc9))['catch'](handleError(_0x1a7cbf,null));};exports['update']=function(_0x4edd0d,_0x21b7a9){if(_0x4edd0d[_0x7bdb('0x29')]['id']){delete _0x4edd0d[_0x7bdb('0x29')]['id'];}return db[_0x7bdb('0x30')][_0x7bdb('0x4b')]({'where':{'id':_0x4edd0d[_0x7bdb('0x48')]['id']}})[_0x7bdb('0x42')](handleEntityNotFound(_0x21b7a9,null))[_0x7bdb('0x42')](saveUpdates(_0x4edd0d[_0x7bdb('0x29')],null))[_0x7bdb('0x42')](respondWithResult(_0x21b7a9,null))['catch'](handleError(_0x21b7a9,null));};exports[_0x7bdb('0x4c')]=function(_0x4806e0,_0x240425){return db[_0x7bdb('0x30')][_0x7bdb('0x4b')]({'where':{'id':_0x4806e0[_0x7bdb('0x48')]['id']}})['then'](handleEntityNotFound(_0x240425,null))[_0x7bdb('0x42')](removeEntity(_0x240425,null))['catch'](handleError(_0x240425,null));};exports['describe']=function(_0x1439c3,_0x17e4cf){return db['FaxQueueReport']['describe']()['then'](respondWithResult(_0x17e4cf,null))[_0x7bdb('0x46')](handleError(_0x17e4cf,null));}; \ No newline at end of file +var _0x5636=['fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','count','includeAll','include','findAll','catch','show','params','rawAttributes','length','options','find','create','describe','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','render','merge','body','message','account','index','map','FaxQueueReport'];(function(_0x25bb5c,_0x398eed){var _0x3db377=function(_0x5b678e){while(--_0x5b678e){_0x25bb5c['push'](_0x25bb5c['shift']());}};_0x3db377(++_0x398eed);}(_0x5636,0x102));var _0x6563=function(_0x96a983,_0x301b99){_0x96a983=_0x96a983-0x0;var _0x596ecc=_0x5636[_0x96a983];return _0x596ecc;};'use strict';var emlformat=require(_0x6563('0x0'));var rimraf=require(_0x6563('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6563('0x2'));var BPromise=require(_0x6563('0x3'));var Mustache=require(_0x6563('0x4'));var util=require('util');var path=require(_0x6563('0x5'));var sox=require(_0x6563('0x6'));var csv=require(_0x6563('0x7'));var ejs=require(_0x6563('0x8'));var fs=require('fs');var fs_extra=require(_0x6563('0x9'));var _=require(_0x6563('0xa'));var squel=require(_0x6563('0xb'));var crypto=require(_0x6563('0xc'));var jsforce=require(_0x6563('0xd'));var deskjs=require(_0x6563('0xe'));var toCsv=require(_0x6563('0x7'));var querystring=require(_0x6563('0xf'));var Papa=require(_0x6563('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6563('0x11'));var as=require(_0x6563('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6563('0x13'));var config=require(_0x6563('0x14'));var licenseUtil=require(_0x6563('0x15'));var db=require(_0x6563('0x16'))['db'];function respondWithStatusCode(_0x33816e,_0x2ed676){_0x2ed676=_0x2ed676||0xcc;return function(_0x31d3fa){if(_0x31d3fa){return _0x33816e[_0x6563('0x17')](_0x2ed676);}return _0x33816e[_0x6563('0x18')](_0x2ed676)['end']();};}function respondWithResult(_0xa0a0b6,_0x5e9329){_0x5e9329=_0x5e9329||0xc8;return function(_0x37131e){if(_0x37131e){return _0xa0a0b6[_0x6563('0x18')](_0x5e9329)[_0x6563('0x19')](_0x37131e);}};}function respondWithFilteredResult(_0x10d08c,_0x5af5d0){return function(_0x26f26e){if(_0x26f26e){var _0x11baa2=typeof _0x5af5d0[_0x6563('0x1a')]===_0x6563('0x1b')&&typeof _0x5af5d0['limit']===_0x6563('0x1b');var _0x589632=_0x26f26e['count'];var _0x47972a=_0x11baa2?0x0:_0x5af5d0[_0x6563('0x1a')];var _0x4f5609=_0x11baa2?_0x26f26e['count']:_0x5af5d0[_0x6563('0x1a')]+_0x5af5d0[_0x6563('0x1c')];var _0x17a29f;if(_0x4f5609>=_0x589632){_0x4f5609=_0x589632;_0x17a29f=0xc8;}else{_0x17a29f=0xce;}_0x10d08c[_0x6563('0x18')](_0x17a29f);return _0x10d08c[_0x6563('0x1d')](_0x6563('0x1e'),_0x47972a+'-'+_0x4f5609+'/'+_0x589632)[_0x6563('0x19')](_0x26f26e);}return null;};}function patchUpdates(_0x93a45){return function(_0x2a70f0){try{jsonpatch['apply'](_0x2a70f0,_0x93a45,!![]);}catch(_0x2f2905){return BPromise[_0x6563('0x1f')](_0x2f2905);}return _0x2a70f0[_0x6563('0x20')]();};}function saveUpdates(_0x5a335c,_0x293db2){return function(_0x5c37bb){if(_0x5c37bb){return _0x5c37bb[_0x6563('0x21')](_0x5a335c)[_0x6563('0x22')](function(_0x5610b0){return _0x5610b0;});}return null;};}function removeEntity(_0x5773e2,_0x3ab7f6){return function(_0x492f45){if(_0x492f45){return _0x492f45[_0x6563('0x23')]()[_0x6563('0x22')](function(){_0x5773e2[_0x6563('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd860d5,_0x51ff06){return function(_0x7ea857){if(!_0x7ea857){_0xd860d5[_0x6563('0x17')](0x194);}return _0x7ea857;};}function handleError(_0x5e5aeb,_0x365b16){_0x365b16=_0x365b16||0x1f4;return function(_0x28252d){logger['error'](_0x28252d[_0x6563('0x24')]);if(_0x28252d['name']){delete _0x28252d[_0x6563('0x25')];}_0x5e5aeb['status'](_0x365b16)['send'](_0x28252d);};}function getMustacheRender(_0x30f05a,_0x118d31){return Mustache[_0x6563('0x26')](_0x30f05a,_[_0x6563('0x27')](_0x118d31[_0x6563('0x28')],{'contact':_0x118d31['contact'],'message':_0x118d31[_0x6563('0x29')],'agent':_0x118d31['agent'],'interaction':_0x118d31['interaction'],'account':_0x118d31[_0x6563('0x2a')]}))||'';}exports[_0x6563('0x2b')]=function(_0x1e2ecb,_0xdbbdda){var _0x116605={},_0x305861={},_0x41f53e={'count':0x0,'rows':[]};var _0x334874=_[_0x6563('0x2c')](db[_0x6563('0x2d')]['rawAttributes'],function(_0x9b3d86){return{'name':_0x9b3d86[_0x6563('0x2e')],'type':_0x9b3d86[_0x6563('0x2f')][_0x6563('0x30')]};});_0x305861[_0x6563('0x31')]=_[_0x6563('0x2c')](_0x334874,_0x6563('0x25'));_0x305861['query']=_[_0x6563('0x32')](_0x1e2ecb[_0x6563('0x33')]);_0x305861[_0x6563('0x34')]=_[_0x6563('0x35')](_0x305861[_0x6563('0x31')],_0x305861[_0x6563('0x33')]);_0x116605['attributes']=_[_0x6563('0x35')](_0x305861[_0x6563('0x31')],qs[_0x6563('0x36')](_0x1e2ecb[_0x6563('0x33')][_0x6563('0x36')]));_0x116605[_0x6563('0x37')]=_0x116605[_0x6563('0x37')]['length']?_0x116605[_0x6563('0x37')]:_0x305861[_0x6563('0x31')];if(!_0x1e2ecb['query'][_0x6563('0x38')](_0x6563('0x39'))){_0x116605['limit']=qs['limit'](_0x1e2ecb[_0x6563('0x33')][_0x6563('0x1c')]);_0x116605[_0x6563('0x1a')]=qs[_0x6563('0x1a')](_0x1e2ecb['query'][_0x6563('0x1a')]);}_0x116605[_0x6563('0x3a')]=qs['sort'](_0x1e2ecb[_0x6563('0x33')][_0x6563('0x3b')]);_0x116605[_0x6563('0x3c')]=qs[_0x6563('0x34')](_[_0x6563('0x3d')](_0x1e2ecb[_0x6563('0x33')],_0x305861[_0x6563('0x34')]),_0x334874);if(_0x1e2ecb[_0x6563('0x33')][_0x6563('0x3e')]){_0x116605['where']=_[_0x6563('0x27')](_0x116605[_0x6563('0x3c')],{'$or':_[_0x6563('0x2c')](_0x334874,function(_0x1c53c4){if(_0x1c53c4['type']!=='VIRTUAL'){var _0x13bbbb={};_0x13bbbb[_0x1c53c4[_0x6563('0x25')]]={'$like':'%'+_0x1e2ecb[_0x6563('0x33')]['filter']+'%'};return _0x13bbbb;}})});}_0x116605=_[_0x6563('0x27')]({},_0x116605,_0x1e2ecb['options']);var _0x36d1aa={'where':_0x116605[_0x6563('0x3c')]};return db['FaxQueueReport'][_0x6563('0x3f')](_0x36d1aa)[_0x6563('0x22')](function(_0xea186){_0x41f53e[_0x6563('0x3f')]=_0xea186;if(_0x1e2ecb[_0x6563('0x33')][_0x6563('0x40')]){_0x116605[_0x6563('0x41')]=[{'all':!![]}];}return db[_0x6563('0x2d')][_0x6563('0x42')](_0x116605);})[_0x6563('0x22')](function(_0x2acb52){_0x41f53e['rows']=_0x2acb52;return _0x41f53e;})['then'](respondWithFilteredResult(_0xdbbdda,_0x116605))[_0x6563('0x43')](handleError(_0xdbbdda,null));};exports[_0x6563('0x44')]=function(_0x43a33e,_0x2f2aa6){var _0x14d134={'raw':!![],'where':{'id':_0x43a33e[_0x6563('0x45')]['id']}},_0x464d45={};_0x464d45['model']=_[_0x6563('0x32')](db[_0x6563('0x2d')][_0x6563('0x46')]);_0x464d45[_0x6563('0x33')]=_['keys'](_0x43a33e[_0x6563('0x33')]);_0x464d45[_0x6563('0x34')]=_[_0x6563('0x35')](_0x464d45[_0x6563('0x31')],_0x464d45[_0x6563('0x33')]);_0x14d134['attributes']=_['intersection'](_0x464d45[_0x6563('0x31')],qs[_0x6563('0x36')](_0x43a33e[_0x6563('0x33')]['fields']));_0x14d134[_0x6563('0x37')]=_0x14d134[_0x6563('0x37')][_0x6563('0x47')]?_0x14d134[_0x6563('0x37')]:_0x464d45['model'];if(_0x43a33e[_0x6563('0x33')][_0x6563('0x40')]){_0x14d134[_0x6563('0x41')]=[{'all':!![]}];}_0x14d134=_['merge']({},_0x14d134,_0x43a33e[_0x6563('0x48')]);return db['FaxQueueReport'][_0x6563('0x49')](_0x14d134)['then'](handleEntityNotFound(_0x2f2aa6,null))['then'](respondWithResult(_0x2f2aa6,null))[_0x6563('0x43')](handleError(_0x2f2aa6,null));};exports[_0x6563('0x4a')]=function(_0x2ebab0,_0xb84325){return db[_0x6563('0x2d')][_0x6563('0x4a')](_0x2ebab0[_0x6563('0x28')],{})[_0x6563('0x22')](respondWithResult(_0xb84325,0xc9))[_0x6563('0x43')](handleError(_0xb84325,null));};exports[_0x6563('0x21')]=function(_0x4951a6,_0x9469fe){if(_0x4951a6['body']['id']){delete _0x4951a6[_0x6563('0x28')]['id'];}return db[_0x6563('0x2d')][_0x6563('0x49')]({'where':{'id':_0x4951a6['params']['id']}})[_0x6563('0x22')](handleEntityNotFound(_0x9469fe,null))[_0x6563('0x22')](saveUpdates(_0x4951a6['body'],null))[_0x6563('0x22')](respondWithResult(_0x9469fe,null))[_0x6563('0x43')](handleError(_0x9469fe,null));};exports[_0x6563('0x23')]=function(_0x3883f3,_0xbd920a){return db['FaxQueueReport'][_0x6563('0x49')]({'where':{'id':_0x3883f3['params']['id']}})[_0x6563('0x22')](handleEntityNotFound(_0xbd920a,null))['then'](removeEntity(_0xbd920a,null))[_0x6563('0x43')](handleError(_0xbd920a,null));};exports['describe']=function(_0x55e002,_0x5c8274){return db['FaxQueueReport'][_0x6563('0x4b')]()['then'](respondWithResult(_0x5c8274,null))[_0x6563('0x43')](handleError(_0x5c8274,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 96d115b..16e655e 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 _0x5ad1=['../../config/logger','api','moment','request-promise','rimraf','./faxQueueReport.attributes','exports','report_fax_queue','uniqueid','lodash','util'];(function(_0x5c98e7,_0x1049f4){var _0xa7f605=function(_0x492a2c){while(--_0x492a2c){_0x5c98e7['push'](_0x5c98e7['shift']());}};_0xa7f605(++_0x1049f4);}(_0x5ad1,0x18a));var _0x15ad=function(_0x66dcfb,_0x47baf8){_0x66dcfb=_0x66dcfb-0x0;var _0x65f4ca=_0x5ad1[_0x66dcfb];return _0x65f4ca;};'use strict';var _=require(_0x15ad('0x0'));var util=require(_0x15ad('0x1'));var logger=require(_0x15ad('0x2'))(_0x15ad('0x3'));var moment=require(_0x15ad('0x4'));var BPromise=require('bluebird');var rp=require(_0x15ad('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15ad('0x6'));var config=require('../../config/environment');var attributes=require(_0x15ad('0x7'));module[_0x15ad('0x8')]=function(_0x237f6a,_0x879ca0){return _0x237f6a['define']('FaxQueueReport',attributes,{'tableName':_0x15ad('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x15ad('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6bc2=['request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6bc2,0xa9));var _0x26bc=function(_0x51c1c8,_0x2072dd){_0x51c1c8=_0x51c1c8-0x0;var _0x144be9=_0x6bc2[_0x51c1c8];return _0x144be9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x26bc('0x0'));var rp=require(_0x26bc('0x1'));var fs=require('fs');var path=require(_0x26bc('0x2'));var rimraf=require(_0x26bc('0x3'));var config=require(_0x26bc('0x4'));var attributes=require(_0x26bc('0x5'));module[_0x26bc('0x6')]=function(_0x578c17,_0x44c53a){return _0x578c17['define'](_0x26bc('0x7'),attributes,{'tableName':_0x26bc('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x26bc('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index c76f3d6..22a2d0a 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 _0xaa70=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','FaxQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','CreateFaxQueueReport','create','body','options','UpdateFaxQueueReport','FaxQueueReport','update','raw','where','then','debug','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5e6d56,_0x4bb64a){var _0x4c749c=function(_0x392f79){while(--_0x392f79){_0x5e6d56['push'](_0x5e6d56['shift']());}};_0x4c749c(++_0x4bb64a);}(_0xaa70,0xaf));var _0x0aa7=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0xaa70[_0x59162a];return _0x35e50d;};'use strict';var _=require('lodash');var util=require(_0x0aa7('0x0'));var moment=require(_0x0aa7('0x1'));var BPromise=require(_0x0aa7('0x2'));var rs=require(_0x0aa7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0aa7('0x4'))['db'];var utils=require(_0x0aa7('0x5'));var logger=require(_0x0aa7('0x6'))(_0x0aa7('0x7'));var config=require('../../config/environment');var jayson=require(_0x0aa7('0x8'));var client=jayson[_0x0aa7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x697c24,_0x23ee98,_0x27a076){return new BPromise(function(_0x331fa1,_0x3bacce){return client[_0x0aa7('0xa')](_0x697c24,_0x27a076)['then'](function(_0x1a868c){logger['info'](_0x0aa7('0xb'),_0x23ee98,_0x0aa7('0xc'));logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x23ee98,'request\x20sent',JSON[_0x0aa7('0xd')](_0x1a868c));if(_0x1a868c[_0x0aa7('0xe')]){if(_0x1a868c['error']['code']===0x1f4){logger[_0x0aa7('0xe')](_0x0aa7('0xb'),_0x23ee98,_0x1a868c[_0x0aa7('0xe')][_0x0aa7('0xf')]);return _0x3bacce(_0x1a868c[_0x0aa7('0xe')]['message']);}logger[_0x0aa7('0xe')](_0x0aa7('0xb'),_0x23ee98,_0x1a868c[_0x0aa7('0xe')][_0x0aa7('0xf')]);return _0x331fa1(_0x1a868c[_0x0aa7('0xe')][_0x0aa7('0xf')]);}else{logger[_0x0aa7('0x10')](_0x0aa7('0xb'),_0x23ee98,_0x0aa7('0xc'));_0x331fa1(_0x1a868c[_0x0aa7('0x11')][_0x0aa7('0xf')]);}})[_0x0aa7('0x12')](function(_0x3e6cdb){logger['error'](_0x0aa7('0xb'),_0x23ee98,_0x3e6cdb);_0x3bacce(_0x3e6cdb);});});}exports[_0x0aa7('0x13')]=function(_0x2495c4){var _0x138f78=this;return new Promise(function(_0x12b2a2,_0x18bdd3){return db['FaxQueueReport'][_0x0aa7('0x14')](_0x2495c4[_0x0aa7('0x15')],{'raw':_0x2495c4[_0x0aa7('0x16')]?_0x2495c4[_0x0aa7('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x7ba410){logger[_0x0aa7('0x10')](_0x0aa7('0x13'),_0x2495c4);logger['debug'](_0x0aa7('0x13'),_0x2495c4,JSON[_0x0aa7('0xd')](_0x7ba410));_0x12b2a2(_0x7ba410);})['catch'](function(_0xa427d0){logger[_0x0aa7('0xe')](_0x0aa7('0x13'),_0xa427d0[_0x0aa7('0xf')],_0x2495c4);_0x18bdd3(_0x138f78[_0x0aa7('0xe')](0x1f4,_0xa427d0[_0x0aa7('0xf')]));});});};exports[_0x0aa7('0x17')]=function(_0x3b6ab1){var _0x3bc0ce=this;return new Promise(function(_0x59fb99,_0x608d58){return db[_0x0aa7('0x18')][_0x0aa7('0x19')](_0x3b6ab1['body'],{'raw':_0x3b6ab1[_0x0aa7('0x16')]?_0x3b6ab1[_0x0aa7('0x16')][_0x0aa7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b6ab1[_0x0aa7('0x16')]?_0x3b6ab1['options'][_0x0aa7('0x1b')]||null:null,'attributes':_0x3b6ab1['options']?_0x3b6ab1[_0x0aa7('0x16')]['attributes']||null:null,'limit':_0x3b6ab1[_0x0aa7('0x16')]?_0x3b6ab1[_0x0aa7('0x16')]['limit']||null:null})[_0x0aa7('0x1c')](function(_0x4e2230){logger['info'](_0x0aa7('0x17'),_0x3b6ab1);logger[_0x0aa7('0x1d')]('UpdateFaxQueueReport',_0x3b6ab1,JSON[_0x0aa7('0xd')](_0x4e2230));_0x59fb99(_0x4e2230);})[_0x0aa7('0x12')](function(_0x533e94){logger[_0x0aa7('0xe')]('UpdateFaxQueueReport',_0x533e94[_0x0aa7('0xf')],_0x3b6ab1);_0x608d58(_0x3bc0ce[_0x0aa7('0xe')](0x1f4,_0x533e94[_0x0aa7('0xf')]));});});}; \ No newline at end of file +var _0x6f27=['client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','UpdateFaxQueueReport','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2b5aec,_0x2fa6e1){var _0x8ec4ac=function(_0x34b3d9){while(--_0x34b3d9){_0x2b5aec['push'](_0x2b5aec['shift']());}};_0x8ec4ac(++_0x2fa6e1);}(_0x6f27,0xd6));var _0x76f2=function(_0x13033f,_0x2045af){_0x13033f=_0x13033f-0x0;var _0x2ed576=_0x6f27[_0x13033f];return _0x2ed576;};'use strict';var _=require(_0x76f2('0x0'));var util=require(_0x76f2('0x1'));var moment=require('moment');var BPromise=require(_0x76f2('0x2'));var rs=require(_0x76f2('0x3'));var fs=require('fs');var Redis=require(_0x76f2('0x4'));var db=require(_0x76f2('0x5'))['db'];var utils=require(_0x76f2('0x6'));var logger=require('../../config/logger')(_0x76f2('0x7'));var config=require(_0x76f2('0x8'));var jayson=require(_0x76f2('0x9'));var client=jayson[_0x76f2('0xa')][_0x76f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53f6f0,_0x5048fd,_0x57bc87){return new BPromise(function(_0x4743b0,_0x54ca97){return client[_0x76f2('0xc')](_0x53f6f0,_0x57bc87)[_0x76f2('0xd')](function(_0x3b17f2){logger[_0x76f2('0xe')](_0x76f2('0xf'),_0x5048fd,_0x76f2('0x10'));logger[_0x76f2('0x11')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x5048fd,_0x76f2('0x10'),JSON[_0x76f2('0x12')](_0x3b17f2));if(_0x3b17f2['error']){if(_0x3b17f2['error'][_0x76f2('0x13')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x5048fd,_0x3b17f2[_0x76f2('0x14')][_0x76f2('0x15')]);return _0x54ca97(_0x3b17f2[_0x76f2('0x14')][_0x76f2('0x15')]);}logger[_0x76f2('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x5048fd,_0x3b17f2[_0x76f2('0x14')]['message']);return _0x4743b0(_0x3b17f2[_0x76f2('0x14')][_0x76f2('0x15')]);}else{logger[_0x76f2('0xe')](_0x76f2('0xf'),_0x5048fd,_0x76f2('0x10'));_0x4743b0(_0x3b17f2[_0x76f2('0x16')][_0x76f2('0x15')]);}})[_0x76f2('0x17')](function(_0x369e2a){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x5048fd,_0x369e2a);_0x54ca97(_0x369e2a);});});}exports[_0x76f2('0x18')]=function(_0x147a73){var _0x5776de=this;return new Promise(function(_0x4a01d9,_0x278461){return db[_0x76f2('0x19')]['create'](_0x147a73[_0x76f2('0x1a')],{'raw':_0x147a73[_0x76f2('0x1b')]?_0x147a73['options'][_0x76f2('0x1c')]===undefined?!![]:![]:!![]})[_0x76f2('0xd')](function(_0x65ff3f){logger[_0x76f2('0xe')](_0x76f2('0x18'),_0x147a73);logger[_0x76f2('0x11')](_0x76f2('0x18'),_0x147a73,JSON[_0x76f2('0x12')](_0x65ff3f));_0x4a01d9(_0x65ff3f);})[_0x76f2('0x17')](function(_0x18ad6e){logger[_0x76f2('0x14')](_0x76f2('0x18'),_0x18ad6e[_0x76f2('0x15')],_0x147a73);_0x278461(_0x5776de[_0x76f2('0x14')](0x1f4,_0x18ad6e[_0x76f2('0x15')]));});});};exports[_0x76f2('0x1d')]=function(_0x918cd6){var _0x4007f5=this;return new Promise(function(_0x5b7f51,_0x2cf48f){return db[_0x76f2('0x19')]['update'](_0x918cd6[_0x76f2('0x1a')],{'raw':_0x918cd6[_0x76f2('0x1b')]?_0x918cd6[_0x76f2('0x1b')][_0x76f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x918cd6[_0x76f2('0x1b')]?_0x918cd6[_0x76f2('0x1b')][_0x76f2('0x1e')]||null:null,'attributes':_0x918cd6[_0x76f2('0x1b')]?_0x918cd6[_0x76f2('0x1b')]['attributes']||null:null,'limit':_0x918cd6[_0x76f2('0x1b')]?_0x918cd6['options'][_0x76f2('0x1f')]||null:null})[_0x76f2('0xd')](function(_0xb191c1){logger[_0x76f2('0xe')](_0x76f2('0x1d'),_0x918cd6);logger[_0x76f2('0x11')]('UpdateFaxQueueReport',_0x918cd6,JSON[_0x76f2('0x12')](_0xb191c1));_0x5b7f51(_0xb191c1);})[_0x76f2('0x17')](function(_0x54465c){logger[_0x76f2('0x14')]('UpdateFaxQueueReport',_0x54465c[_0x76f2('0x15')],_0x918cd6);_0x2cf48f(_0x4007f5[_0x76f2('0x14')](0x1f4,_0x54465c[_0x76f2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 74c52d6..45a15cc 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 _0x2e54=['/:id','post','create','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2e54,0xc1));var _0x42e5=function(_0x211846,_0x468c87){_0x211846=_0x211846-0x0;var _0x3b1552=_0x2e54[_0x211846];return _0x3b1552;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x42e5('0x0'));var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var fs_extra=require(_0x42e5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x42e5('0x5'));var config=require(_0x42e5('0x6'));var controller=require(_0x42e5('0x7'));router[_0x42e5('0x8')]('/',auth[_0x42e5('0x9')](),controller['index']);router['get'](_0x42e5('0xa'),auth[_0x42e5('0x9')](),controller['describe']);router[_0x42e5('0x8')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller['show']);router[_0x42e5('0xc')]('/',auth[_0x42e5('0x9')](),controller[_0x42e5('0xd')]);router['put'](_0x42e5('0xb'),auth['isAuthenticated'](),controller[_0x42e5('0xe')]);router[_0x42e5('0xf')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x10')]);module['exports']=router; \ No newline at end of file +var _0x947e=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports'];(function(_0x1540b1,_0xb25088){var _0x1d020d=function(_0x51ac71){while(--_0x51ac71){_0x1540b1['push'](_0x1540b1['shift']());}};_0x1d020d(++_0xb25088);}(_0x947e,0x168));var _0xe947=function(_0xbfd350,_0x3a3694){_0xbfd350=_0xbfd350-0x0;var _0x55f5d3=_0x947e[_0xbfd350];return _0x55f5d3;};'use strict';var multer=require(_0xe947('0x0'));var util=require(_0xe947('0x1'));var path=require(_0xe947('0x2'));var timeout=require(_0xe947('0x3'));var express=require(_0xe947('0x4'));var router=express[_0xe947('0x5')]();var fs_extra=require(_0xe947('0x6'));var auth=require(_0xe947('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0xe947('0x8')]('/',auth[_0xe947('0x9')](),controller[_0xe947('0xa')]);router[_0xe947('0x8')](_0xe947('0xb'),auth['isAuthenticated'](),controller[_0xe947('0xc')]);router[_0xe947('0x8')](_0xe947('0xd'),auth['isAuthenticated'](),controller[_0xe947('0xe')]);router[_0xe947('0xf')]('/',auth[_0xe947('0x9')](),controller['create']);router[_0xe947('0x10')](_0xe947('0xd'),auth[_0xe947('0x9')](),controller[_0xe947('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe947('0x12')]);module[_0xe947('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 1587cbb..04c4b15 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 _0xd93c=['agent','queue','DATE','NOW','moment','sequelize','STRING','ENUM','account'];(function(_0x2d412c,_0x4974a7){var _0x39c5b9=function(_0x1ee55a){while(--_0x1ee55a){_0x2d412c['push'](_0x2d412c['shift']());}};_0x39c5b9(++_0x4974a7);}(_0xd93c,0x1f3));var _0xcd93=function(_0x1342b8,_0x8179fc){_0x1342b8=_0x1342b8-0x0;var _0x2e1bf4=_0xd93c[_0x1342b8];return _0x2e1bf4;};'use strict';var moment=require(_0xcd93('0x0'));var Sequelize=require(_0xcd93('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xcd93('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xcd93('0x3')](_0xcd93('0x4'),_0xcd93('0x5'),_0xcd93('0x6')),'allowNull':![],'defaultValue':_0xcd93('0x6')},'transferredAt':{'type':Sequelize[_0xcd93('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xcd93('0x8')]}}; \ No newline at end of file +var _0xa73c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa73c,0x149));var _0xca73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa73c[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0xca73('0x0'));var Sequelize=require(_0xca73('0x1'));module[_0xca73('0x2')]={'uniqueid':{'type':Sequelize[_0xca73('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xca73('0x4')]('account',_0xca73('0x5'),'queue'),'allowNull':![],'defaultValue':_0xca73('0x6')},'transferredAt':{'type':Sequelize[_0xca73('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xca73('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 5e37b94..ac1103d 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 _0x093a=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','find','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','render','merge','body','agent','interaction','account','index','map','FaxTransferReport','fieldName','type','key','model'];(function(_0x574e55,_0x18d861){var _0x3ed228=function(_0x3365ae){while(--_0x3365ae){_0x574e55['push'](_0x574e55['shift']());}};_0x3ed228(++_0x18d861);}(_0x093a,0x16a));var _0xa093=function(_0x29e3ec,_0x138a18){_0x29e3ec=_0x29e3ec-0x0;var _0x25727e=_0x093a[_0x29e3ec];return _0x25727e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa093('0x0'));var zipdir=require(_0xa093('0x1'));var jsonpatch=require(_0xa093('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa093('0x3'));var Mustache=require(_0xa093('0x4'));var util=require(_0xa093('0x5'));var path=require(_0xa093('0x6'));var sox=require(_0xa093('0x7'));var csv=require(_0xa093('0x8'));var ejs=require(_0xa093('0x9'));var fs=require('fs');var fs_extra=require(_0xa093('0xa'));var _=require(_0xa093('0xb'));var squel=require(_0xa093('0xc'));var crypto=require(_0xa093('0xd'));var jsforce=require(_0xa093('0xe'));var deskjs=require(_0xa093('0xf'));var toCsv=require(_0xa093('0x8'));var querystring=require(_0xa093('0x10'));var Papa=require(_0xa093('0x11'));var Redis=require(_0xa093('0x12'));var authService=require(_0xa093('0x13'));var qs=require(_0xa093('0x14'));var as=require(_0xa093('0x15'));var hardwareService=require(_0xa093('0x16'));var logger=require('../../config/logger')(_0xa093('0x17'));var utils=require(_0xa093('0x18'));var config=require(_0xa093('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa093('0x1a'))['db'];function respondWithStatusCode(_0x37b045,_0x306405){_0x306405=_0x306405||0xcc;return function(_0x33b118){if(_0x33b118){return _0x37b045[_0xa093('0x1b')](_0x306405);}return _0x37b045[_0xa093('0x1c')](_0x306405)[_0xa093('0x1d')]();};}function respondWithResult(_0x5b7b2c,_0x108037){_0x108037=_0x108037||0xc8;return function(_0x56fc96){if(_0x56fc96){return _0x5b7b2c[_0xa093('0x1c')](_0x108037)[_0xa093('0x1e')](_0x56fc96);}};}function respondWithFilteredResult(_0x45005f,_0x2f8e67){return function(_0x8245d8){if(_0x8245d8){var _0x26ac40=typeof _0x2f8e67[_0xa093('0x1f')]===_0xa093('0x20')&&typeof _0x2f8e67['limit']===_0xa093('0x20');var _0x226d1e=_0x8245d8[_0xa093('0x21')];var _0x30782c=_0x26ac40?0x0:_0x2f8e67[_0xa093('0x1f')];var _0x3b63db=_0x26ac40?_0x8245d8[_0xa093('0x21')]:_0x2f8e67['offset']+_0x2f8e67[_0xa093('0x22')];var _0x4bcb2a;if(_0x3b63db>=_0x226d1e){_0x3b63db=_0x226d1e;_0x4bcb2a=0xc8;}else{_0x4bcb2a=0xce;}_0x45005f[_0xa093('0x1c')](_0x4bcb2a);return _0x45005f['set'](_0xa093('0x23'),_0x30782c+'-'+_0x3b63db+'/'+_0x226d1e)[_0xa093('0x1e')](_0x8245d8);}return null;};}function patchUpdates(_0x4b1a16){return function(_0x3841c8){try{jsonpatch[_0xa093('0x24')](_0x3841c8,_0x4b1a16,!![]);}catch(_0x93f81a){return BPromise[_0xa093('0x25')](_0x93f81a);}return _0x3841c8[_0xa093('0x26')]();};}function saveUpdates(_0x4b61c2,_0x2fa9ca){return function(_0x57125e){if(_0x57125e){return _0x57125e[_0xa093('0x27')](_0x4b61c2)['then'](function(_0x38d68a){return _0x38d68a;});}return null;};}function removeEntity(_0x329847,_0x2e909d){return function(_0x3aeb7f){if(_0x3aeb7f){return _0x3aeb7f[_0xa093('0x28')]()[_0xa093('0x29')](function(){_0x329847[_0xa093('0x1c')](0xcc)[_0xa093('0x1d')]();});}};}function handleEntityNotFound(_0x302f21,_0x536311){return function(_0xd20fd){if(!_0xd20fd){_0x302f21[_0xa093('0x1b')](0x194);}return _0xd20fd;};}function handleError(_0x1f9506,_0x36fd8f){_0x36fd8f=_0x36fd8f||0x1f4;return function(_0x31909b){logger[_0xa093('0x2a')](_0x31909b[_0xa093('0x2b')]);if(_0x31909b[_0xa093('0x2c')]){delete _0x31909b[_0xa093('0x2c')];}_0x1f9506[_0xa093('0x1c')](_0x36fd8f)['send'](_0x31909b);};}function getMustacheRender(_0x1b1237,_0x1b9148){return Mustache[_0xa093('0x2d')](_0x1b1237,_[_0xa093('0x2e')](_0x1b9148[_0xa093('0x2f')],{'contact':_0x1b9148['contact'],'message':_0x1b9148['message'],'agent':_0x1b9148[_0xa093('0x30')],'interaction':_0x1b9148[_0xa093('0x31')],'account':_0x1b9148[_0xa093('0x32')]}))||'';}exports[_0xa093('0x33')]=function(_0x59a957,_0x56b5ab){var _0x57a5f7={},_0x2a52ea={},_0x5b0dbb={'count':0x0,'rows':[]};var _0x68cdbb=_[_0xa093('0x34')](db[_0xa093('0x35')]['rawAttributes'],function(_0x2c501f){return{'name':_0x2c501f[_0xa093('0x36')],'type':_0x2c501f[_0xa093('0x37')][_0xa093('0x38')]};});_0x2a52ea[_0xa093('0x39')]=_[_0xa093('0x34')](_0x68cdbb,_0xa093('0x2c'));_0x2a52ea[_0xa093('0x3a')]=_[_0xa093('0x3b')](_0x59a957[_0xa093('0x3a')]);_0x2a52ea[_0xa093('0x3c')]=_[_0xa093('0x3d')](_0x2a52ea['model'],_0x2a52ea[_0xa093('0x3a')]);_0x57a5f7['attributes']=_[_0xa093('0x3d')](_0x2a52ea[_0xa093('0x39')],qs[_0xa093('0x3e')](_0x59a957[_0xa093('0x3a')]['fields']));_0x57a5f7[_0xa093('0x3f')]=_0x57a5f7['attributes'][_0xa093('0x40')]?_0x57a5f7[_0xa093('0x3f')]:_0x2a52ea[_0xa093('0x39')];if(!_0x59a957[_0xa093('0x3a')][_0xa093('0x41')]('nolimit')){_0x57a5f7[_0xa093('0x22')]=qs['limit'](_0x59a957[_0xa093('0x3a')]['limit']);_0x57a5f7['offset']=qs[_0xa093('0x1f')](_0x59a957[_0xa093('0x3a')]['offset']);}_0x57a5f7[_0xa093('0x42')]=qs[_0xa093('0x43')](_0x59a957['query'][_0xa093('0x43')]);_0x57a5f7['where']=qs[_0xa093('0x3c')](_[_0xa093('0x44')](_0x59a957[_0xa093('0x3a')],_0x2a52ea['filters']),_0x68cdbb);if(_0x59a957['query'][_0xa093('0x45')]){_0x57a5f7[_0xa093('0x46')]=_[_0xa093('0x2e')](_0x57a5f7[_0xa093('0x46')],{'$or':_[_0xa093('0x34')](_0x68cdbb,function(_0x22682e){if(_0x22682e[_0xa093('0x37')]!==_0xa093('0x47')){var _0x5ad463={};_0x5ad463[_0x22682e[_0xa093('0x2c')]]={'$like':'%'+_0x59a957['query'][_0xa093('0x45')]+'%'};return _0x5ad463;}})});}_0x57a5f7=_[_0xa093('0x2e')]({},_0x57a5f7,_0x59a957[_0xa093('0x48')]);var _0x15f63f={'where':_0x57a5f7[_0xa093('0x46')]};return db['FaxTransferReport'][_0xa093('0x21')](_0x15f63f)[_0xa093('0x29')](function(_0x5323b4){_0x5b0dbb[_0xa093('0x21')]=_0x5323b4;if(_0x59a957[_0xa093('0x3a')][_0xa093('0x49')]){_0x57a5f7[_0xa093('0x4a')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xa093('0x4b')](_0x57a5f7);})[_0xa093('0x29')](function(_0x3bbbb6){_0x5b0dbb[_0xa093('0x4c')]=_0x3bbbb6;return _0x5b0dbb;})[_0xa093('0x29')](respondWithFilteredResult(_0x56b5ab,_0x57a5f7))['catch'](handleError(_0x56b5ab,null));};exports[_0xa093('0x4d')]=function(_0x3222ea,_0x11d163){var _0x1172ab={'raw':!![],'where':{'id':_0x3222ea[_0xa093('0x4e')]['id']}},_0x47943f={};_0x47943f[_0xa093('0x39')]=_[_0xa093('0x3b')](db[_0xa093('0x35')][_0xa093('0x4f')]);_0x47943f[_0xa093('0x3a')]=_[_0xa093('0x3b')](_0x3222ea[_0xa093('0x3a')]);_0x47943f[_0xa093('0x3c')]=_[_0xa093('0x3d')](_0x47943f['model'],_0x47943f['query']);_0x1172ab[_0xa093('0x3f')]=_[_0xa093('0x3d')](_0x47943f[_0xa093('0x39')],qs[_0xa093('0x3e')](_0x3222ea[_0xa093('0x3a')][_0xa093('0x3e')]));_0x1172ab[_0xa093('0x3f')]=_0x1172ab[_0xa093('0x3f')][_0xa093('0x40')]?_0x1172ab[_0xa093('0x3f')]:_0x47943f[_0xa093('0x39')];if(_0x3222ea[_0xa093('0x3a')][_0xa093('0x49')]){_0x1172ab[_0xa093('0x4a')]=[{'all':!![]}];}_0x1172ab=_[_0xa093('0x2e')]({},_0x1172ab,_0x3222ea['options']);return db['FaxTransferReport']['find'](_0x1172ab)[_0xa093('0x29')](handleEntityNotFound(_0x11d163,null))[_0xa093('0x29')](respondWithResult(_0x11d163,null))[_0xa093('0x50')](handleError(_0x11d163,null));};exports[_0xa093('0x51')]=function(_0x44542f,_0x4b6062){return db[_0xa093('0x35')][_0xa093('0x51')](_0x44542f['body'],{})[_0xa093('0x29')](respondWithResult(_0x4b6062,0xc9))[_0xa093('0x50')](handleError(_0x4b6062,null));};exports[_0xa093('0x27')]=function(_0x4a04d4,_0x17d28e){if(_0x4a04d4['body']['id']){delete _0x4a04d4['body']['id'];}return db[_0xa093('0x35')][_0xa093('0x52')]({'where':{'id':_0x4a04d4['params']['id']}})[_0xa093('0x29')](handleEntityNotFound(_0x17d28e,null))['then'](saveUpdates(_0x4a04d4[_0xa093('0x2f')],null))[_0xa093('0x29')](respondWithResult(_0x17d28e,null))[_0xa093('0x50')](handleError(_0x17d28e,null));};exports[_0xa093('0x28')]=function(_0x142ef0,_0x1fa6e3){return db[_0xa093('0x35')][_0xa093('0x52')]({'where':{'id':_0x142ef0[_0xa093('0x4e')]['id']}})[_0xa093('0x29')](handleEntityNotFound(_0x1fa6e3,null))[_0xa093('0x29')](removeEntity(_0x1fa6e3,null))[_0xa093('0x50')](handleError(_0x1fa6e3,null));};exports[_0xa093('0x53')]=function(_0xdbedb1,_0x378fc5){return db[_0xa093('0x35')]['describe']()[_0xa093('0x29')](respondWithResult(_0x378fc5,null))[_0xa093('0x50')](handleError(_0x378fc5,null));}; \ No newline at end of file +var _0x9c44=['set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','FaxTransferReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','find','create','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'];(function(_0x3d2da5,_0x569886){var _0x21e9f0=function(_0x2323d2){while(--_0x2323d2){_0x3d2da5['push'](_0x3d2da5['shift']());}};_0x21e9f0(++_0x569886);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'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);};}function getMustacheRender(_0x372a47,_0x5987ae){return Mustache[_0x49c4('0x28')](_0x372a47,_[_0x49c4('0x29')](_0x5987ae[_0x49c4('0x2a')],{'contact':_0x5987ae[_0x49c4('0x2b')],'message':_0x5987ae[_0x49c4('0x2c')],'agent':_0x5987ae[_0x49c4('0x2d')],'interaction':_0x5987ae[_0x49c4('0x2e')],'account':_0x5987ae[_0x49c4('0x2f')]}))||'';}exports[_0x49c4('0x30')]=function(_0x2cbd88,_0x46f7ea){var _0x4ea6ea={},_0x4f4495={},_0x59eb84={'count':0x0,'rows':[]};var _0x134928=_[_0x49c4('0x31')](db[_0x49c4('0x32')][_0x49c4('0x33')],function(_0x28eb47){return{'name':_0x28eb47['fieldName'],'type':_0x28eb47[_0x49c4('0x34')][_0x49c4('0x35')]};});_0x4f4495[_0x49c4('0x36')]=_[_0x49c4('0x31')](_0x134928,'name');_0x4f4495['query']=_[_0x49c4('0x37')](_0x2cbd88[_0x49c4('0x38')]);_0x4f4495[_0x49c4('0x39')]=_[_0x49c4('0x3a')](_0x4f4495[_0x49c4('0x36')],_0x4f4495['query']);_0x4ea6ea[_0x49c4('0x3b')]=_[_0x49c4('0x3a')](_0x4f4495[_0x49c4('0x36')],qs['fields'](_0x2cbd88['query'][_0x49c4('0x3c')]));_0x4ea6ea[_0x49c4('0x3b')]=_0x4ea6ea[_0x49c4('0x3b')][_0x49c4('0x3d')]?_0x4ea6ea[_0x49c4('0x3b')]:_0x4f4495[_0x49c4('0x36')];if(!_0x2cbd88[_0x49c4('0x38')][_0x49c4('0x3e')](_0x49c4('0x3f'))){_0x4ea6ea['limit']=qs[_0x49c4('0x1b')](_0x2cbd88['query'][_0x49c4('0x1b')]);_0x4ea6ea[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x2cbd88[_0x49c4('0x38')]['offset']);}_0x4ea6ea[_0x49c4('0x40')]=qs[_0x49c4('0x41')](_0x2cbd88[_0x49c4('0x38')]['sort']);_0x4ea6ea[_0x49c4('0x42')]=qs[_0x49c4('0x39')](_[_0x49c4('0x43')](_0x2cbd88[_0x49c4('0x38')],_0x4f4495[_0x49c4('0x39')]),_0x134928);if(_0x2cbd88[_0x49c4('0x38')][_0x49c4('0x44')]){_0x4ea6ea[_0x49c4('0x42')]=_[_0x49c4('0x29')](_0x4ea6ea[_0x49c4('0x42')],{'$or':_[_0x49c4('0x31')](_0x134928,function(_0x4e0663){if(_0x4e0663[_0x49c4('0x34')]!==_0x49c4('0x45')){var _0x32b172={};_0x32b172[_0x4e0663[_0x49c4('0x26')]]={'$like':'%'+_0x2cbd88[_0x49c4('0x38')][_0x49c4('0x44')]+'%'};return _0x32b172;}})});}_0x4ea6ea=_[_0x49c4('0x29')]({},_0x4ea6ea,_0x2cbd88[_0x49c4('0x46')]);var _0x248c0a={'where':_0x4ea6ea[_0x49c4('0x42')]};return db[_0x49c4('0x32')][_0x49c4('0x1c')](_0x248c0a)[_0x49c4('0x47')](function(_0x4e38bc){_0x59eb84[_0x49c4('0x1c')]=_0x4e38bc;if(_0x2cbd88['query'][_0x49c4('0x48')]){_0x4ea6ea[_0x49c4('0x49')]=[{'all':!![]}];}return db[_0x49c4('0x32')][_0x49c4('0x4a')](_0x4ea6ea);})[_0x49c4('0x47')](function(_0x281b83){_0x59eb84['rows']=_0x281b83;return _0x59eb84;})['then'](respondWithFilteredResult(_0x46f7ea,_0x4ea6ea))[_0x49c4('0x4b')](handleError(_0x46f7ea,null));};exports[_0x49c4('0x4c')]=function(_0x38349b,_0x117151){var _0x490823={'raw':!![],'where':{'id':_0x38349b[_0x49c4('0x4d')]['id']}},_0x3baff9={};_0x3baff9[_0x49c4('0x36')]=_[_0x49c4('0x37')](db[_0x49c4('0x32')][_0x49c4('0x33')]);_0x3baff9[_0x49c4('0x38')]=_[_0x49c4('0x37')](_0x38349b[_0x49c4('0x38')]);_0x3baff9['filters']=_[_0x49c4('0x3a')](_0x3baff9['model'],_0x3baff9[_0x49c4('0x38')]);_0x490823[_0x49c4('0x3b')]=_[_0x49c4('0x3a')](_0x3baff9[_0x49c4('0x36')],qs[_0x49c4('0x3c')](_0x38349b['query'][_0x49c4('0x3c')]));_0x490823[_0x49c4('0x3b')]=_0x490823[_0x49c4('0x3b')][_0x49c4('0x3d')]?_0x490823[_0x49c4('0x3b')]:_0x3baff9[_0x49c4('0x36')];if(_0x38349b[_0x49c4('0x38')]['includeAll']){_0x490823[_0x49c4('0x49')]=[{'all':!![]}];}_0x490823=_['merge']({},_0x490823,_0x38349b[_0x49c4('0x46')]);return db[_0x49c4('0x32')][_0x49c4('0x4e')](_0x490823)[_0x49c4('0x47')](handleEntityNotFound(_0x117151,null))[_0x49c4('0x47')](respondWithResult(_0x117151,null))[_0x49c4('0x4b')](handleError(_0x117151,null));};exports[_0x49c4('0x4f')]=function(_0x506c71,_0x3b731f){return db[_0x49c4('0x32')]['create'](_0x506c71[_0x49c4('0x2a')],{})[_0x49c4('0x47')](respondWithResult(_0x3b731f,0xc9))[_0x49c4('0x4b')](handleError(_0x3b731f,null));};exports[_0x49c4('0x22')]=function(_0x52a8f7,_0x5d8bf0){if(_0x52a8f7[_0x49c4('0x2a')]['id']){delete _0x52a8f7['body']['id'];}return db[_0x49c4('0x32')][_0x49c4('0x4e')]({'where':{'id':_0x52a8f7[_0x49c4('0x4d')]['id']}})[_0x49c4('0x47')](handleEntityNotFound(_0x5d8bf0,null))[_0x49c4('0x47')](saveUpdates(_0x52a8f7[_0x49c4('0x2a')],null))[_0x49c4('0x47')](respondWithResult(_0x5d8bf0,null))['catch'](handleError(_0x5d8bf0,null));};exports[_0x49c4('0x23')]=function(_0x1550ce,_0x3936d3){return db[_0x49c4('0x32')][_0x49c4('0x4e')]({'where':{'id':_0x1550ce[_0x49c4('0x4d')]['id']}})[_0x49c4('0x47')](handleEntityNotFound(_0x3936d3,null))[_0x49c4('0x47')](removeEntity(_0x3936d3,null))[_0x49c4('0x4b')](handleError(_0x3936d3,null));};exports[_0x49c4('0x50')]=function(_0x5b822f,_0x5e63f0){return db[_0x49c4('0x32')][_0x49c4('0x50')]()['then'](respondWithResult(_0x5e63f0,null))['catch'](handleError(_0x5e63f0,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 483e6f7..3429e2b 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 _0x50ed=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','FaxTransferReport','uniqueid','lodash','util'];(function(_0x2eee9a,_0x2de2f9){var _0x1dbb56=function(_0x18f452){while(--_0x18f452){_0x2eee9a['push'](_0x2eee9a['shift']());}};_0x1dbb56(++_0x2de2f9);}(_0x50ed,0x8e));var _0xd50e=function(_0x33a3e1,_0x209729){_0x33a3e1=_0x33a3e1-0x0;var _0x1ba9a1=_0x50ed[_0x33a3e1];return _0x1ba9a1;};'use strict';var _=require(_0xd50e('0x0'));var util=require(_0xd50e('0x1'));var logger=require('../../config/logger')(_0xd50e('0x2'));var moment=require(_0xd50e('0x3'));var BPromise=require(_0xd50e('0x4'));var rp=require(_0xd50e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd50e('0x6'));var config=require(_0xd50e('0x7'));var attributes=require('./faxTransferReport.attributes');module[_0xd50e('0x8')]=function(_0x563526,_0x3134fd){return _0x563526[_0xd50e('0x9')](_0xd50e('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xd50e('0xb'),'fields':[_0xd50e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x43ec=['lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x5b271b,_0x568567){var _0x5c60d8=function(_0x38f6bf){while(--_0x38f6bf){_0x5b271b['push'](_0x5b271b['shift']());}};_0x5c60d8(++_0x568567);}(_0x43ec,0x1e1));var _0xc43e=function(_0x534b49,_0x464ea8){_0x534b49=_0x534b49-0x0;var _0x107e16=_0x43ec[_0x534b49];return _0x107e16;};'use strict';var _=require(_0xc43e('0x0'));var util=require('util');var logger=require(_0xc43e('0x1'))(_0xc43e('0x2'));var moment=require(_0xc43e('0x3'));var BPromise=require(_0xc43e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc43e('0x5'));var rimraf=require('rimraf');var config=require(_0xc43e('0x6'));var attributes=require(_0xc43e('0x7'));module[_0xc43e('0x8')]=function(_0x22a075,_0x4617cf){return _0x22a075[_0xc43e('0x9')](_0xc43e('0xa'),attributes,{'tableName':_0xc43e('0xb'),'paranoid':![],'indexes':[{'name':_0xc43e('0xc'),'fields':[_0xc43e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 30ea828..79af001 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 _0x4817=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','FaxTransferReport,\x20%s,\x20%s','message','result'];(function(_0x656c17,_0x3e90c7){var _0x7bc8aa=function(_0x326362){while(--_0x326362){_0x656c17['push'](_0x656c17['shift']());}};_0x7bc8aa(++_0x3e90c7);}(_0x4817,0x8b));var _0x7481=function(_0x1dbfcd,_0xe1614f){_0x1dbfcd=_0x1dbfcd-0x0;var _0x3ded94=_0x4817[_0x1dbfcd];return _0x3ded94;};'use strict';var _=require('lodash');var util=require(_0x7481('0x0'));var moment=require('moment');var BPromise=require(_0x7481('0x1'));var rs=require(_0x7481('0x2'));var fs=require('fs');var Redis=require(_0x7481('0x3'));var db=require(_0x7481('0x4'))['db'];var utils=require(_0x7481('0x5'));var logger=require('../../config/logger')(_0x7481('0x6'));var config=require(_0x7481('0x7'));var jayson=require(_0x7481('0x8'));var client=jayson[_0x7481('0x9')][_0x7481('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x489cc5,_0x2c6dea,_0x5385c7){return new BPromise(function(_0x36701a,_0x4bfbec){return client[_0x7481('0xb')](_0x489cc5,_0x5385c7)[_0x7481('0xc')](function(_0x41c169){logger[_0x7481('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x2c6dea,_0x7481('0xe'));logger[_0x7481('0xf')](_0x7481('0x10'),_0x2c6dea,'request\x20sent',JSON['stringify'](_0x41c169));if(_0x41c169[_0x7481('0x11')]){if(_0x41c169[_0x7481('0x11')][_0x7481('0x12')]===0x1f4){logger[_0x7481('0x11')](_0x7481('0x13'),_0x2c6dea,_0x41c169[_0x7481('0x11')][_0x7481('0x14')]);return _0x4bfbec(_0x41c169[_0x7481('0x11')][_0x7481('0x14')]);}logger[_0x7481('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x2c6dea,_0x41c169[_0x7481('0x11')][_0x7481('0x14')]);return _0x36701a(_0x41c169[_0x7481('0x11')][_0x7481('0x14')]);}else{logger['info'](_0x7481('0x13'),_0x2c6dea,'request\x20sent');_0x36701a(_0x41c169[_0x7481('0x15')][_0x7481('0x14')]);}})[_0x7481('0x16')](function(_0x2d65c4){logger[_0x7481('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x2c6dea,_0x2d65c4);_0x4bfbec(_0x2d65c4);});});} \ No newline at end of file +var _0x490f=['FaxTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','FaxTransferReport,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug'];(function(_0x1adebd,_0x4ac472){var _0x162d8f=function(_0x355e91){while(--_0x355e91){_0x1adebd['push'](_0x1adebd['shift']());}};_0x162d8f(++_0x4ac472);}(_0x490f,0xe3));var _0xf490=function(_0x210d7f,_0x2abe4f){_0x210d7f=_0x210d7f-0x0;var _0x42d687=_0x490f[_0x210d7f];return _0x42d687;};'use strict';var _=require('lodash');var util=require(_0xf490('0x0'));var moment=require(_0xf490('0x1'));var BPromise=require(_0xf490('0x2'));var rs=require(_0xf490('0x3'));var fs=require('fs');var Redis=require(_0xf490('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf490('0x5'))(_0xf490('0x6'));var config=require(_0xf490('0x7'));var jayson=require(_0xf490('0x8'));var client=jayson[_0xf490('0x9')][_0xf490('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1daaa3,_0x39346e,_0x3e8702){return new BPromise(function(_0x314794,_0x33c1ad){return client['request'](_0x1daaa3,_0x3e8702)[_0xf490('0xb')](function(_0x2c0f59){logger[_0xf490('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x39346e,_0xf490('0xd'));logger[_0xf490('0xe')](_0xf490('0xf'),_0x39346e,_0xf490('0xd'),JSON['stringify'](_0x2c0f59));if(_0x2c0f59['error']){if(_0x2c0f59['error'][_0xf490('0x10')]===0x1f4){logger[_0xf490('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x39346e,_0x2c0f59[_0xf490('0x11')][_0xf490('0x12')]);return _0x33c1ad(_0x2c0f59['error']['message']);}logger[_0xf490('0x11')](_0xf490('0x13'),_0x39346e,_0x2c0f59[_0xf490('0x11')]['message']);return _0x314794(_0x2c0f59[_0xf490('0x11')][_0xf490('0x12')]);}else{logger[_0xf490('0xc')](_0xf490('0x13'),_0x39346e,'request\x20sent');_0x314794(_0x2c0f59[_0xf490('0x14')][_0xf490('0x12')]);}})[_0xf490('0x15')](function(_0x26fad9){logger[_0xf490('0x11')](_0xf490('0x13'),_0x39346e,_0x26fad9);_0x33c1ad(_0x26fad9);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 42973c7..88236b0 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 _0x80df=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','show','post','create','put','update','delete','/:id','destroy','multer','path','connect-timeout','express','Router'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x80df,0x19f));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xf80d('0x0'));var util=require('util');var path=require(_0xf80d('0x1'));var timeout=require(_0xf80d('0x2'));var express=require(_0xf80d('0x3'));var router=express[_0xf80d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf80d('0x5'));var interaction=require(_0xf80d('0x6'));var config=require(_0xf80d('0x7'));var controller=require(_0xf80d('0x8'));router[_0xf80d('0x9')]('/',auth[_0xf80d('0xa')](),controller['index']);router[_0xf80d('0x9')](_0xf80d('0xb'),auth[_0xf80d('0xa')](),controller['describe']);router[_0xf80d('0x9')]('/:id',auth[_0xf80d('0xa')](),controller[_0xf80d('0xc')]);router[_0xf80d('0xd')]('/',auth[_0xf80d('0xa')](),controller[_0xf80d('0xe')]);router[_0xf80d('0xf')]('/:id',auth[_0xf80d('0xa')](),controller[_0xf80d('0x10')]);router[_0xf80d('0x11')](_0xf80d('0x12'),auth['isAuthenticated'](),controller[_0xf80d('0x13')]);module['exports']=router; \ No newline at end of file +var _0x30f2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','multer','path','connect-timeout','Router'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x30f2,0x188));var _0x230f=function(_0x2d1d7f,_0x5a45d1){_0x2d1d7f=_0x2d1d7f-0x0;var _0x2f7276=_0x30f2[_0x2d1d7f];return _0x2f7276;};'use strict';var multer=require(_0x230f('0x0'));var util=require('util');var path=require(_0x230f('0x1'));var timeout=require(_0x230f('0x2'));var express=require('express');var router=express[_0x230f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x230f('0x4'));var interaction=require(_0x230f('0x5'));var config=require(_0x230f('0x6'));var controller=require(_0x230f('0x7'));router[_0x230f('0x8')]('/',auth[_0x230f('0x9')](),controller[_0x230f('0xa')]);router[_0x230f('0x8')](_0x230f('0xb'),auth[_0x230f('0x9')](),controller[_0x230f('0xc')]);router['get'](_0x230f('0xd'),auth[_0x230f('0x9')](),controller[_0x230f('0xe')]);router[_0x230f('0xf')]('/',auth[_0x230f('0x9')](),controller[_0x230f('0x10')]);router['put'](_0x230f('0xd'),auth[_0x230f('0x9')](),controller['update']);router[_0x230f('0x11')](_0x230f('0xd'),auth['isAuthenticated'](),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 afd9e96..f25a83c 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 _0xa45c=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller'];(function(_0x8eab6,_0x594142){var _0x25430f=function(_0xb55cee){while(--_0xb55cee){_0x8eab6['push'](_0x8eab6['shift']());}};_0x25430f(++_0x594142);}(_0xa45c,0xe9));var _0xca45=function(_0x3b4b93,_0x2d6185){_0x3b4b93=_0x3b4b93-0x0;var _0x37bc30=_0xa45c[_0x3b4b93];return _0x37bc30;};'use strict';var multer=require('multer');var util=require(_0xca45('0x0'));var path=require(_0xca45('0x1'));var timeout=require(_0xca45('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xca45('0x3'));var interaction=require(_0xca45('0x4'));var config=require(_0xca45('0x5'));var controller=require(_0xca45('0x6'));router[_0xca45('0x7')]('/',auth[_0xca45('0x8')](),controller[_0xca45('0x9')]);router[_0xca45('0x7')](_0xca45('0xa'),auth[_0xca45('0x8')](),controller[_0xca45('0xb')]);router[_0xca45('0x7')](_0xca45('0xc'),auth[_0xca45('0x8')](),controller[_0xca45('0xd')]);router[_0xca45('0x7')](_0xca45('0xe'),auth[_0xca45('0x8')](),controller[_0xca45('0xf')]);router[_0xca45('0x10')]('/',auth[_0xca45('0x8')](),controller[_0xca45('0x11')]);router[_0xca45('0x10')](_0xca45('0xc'),auth['isAuthenticated'](),controller[_0xca45('0x12')]);router[_0xca45('0x13')]('/:id',auth[_0xca45('0x8')](),controller[_0xca45('0x14')]);router[_0xca45('0x15')](_0xca45('0xa'),auth[_0xca45('0x8')](),controller[_0xca45('0x16')]);module[_0xca45('0x17')]=router; \ No newline at end of file +var _0xb5d8=['create','post','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields'];(function(_0x2f0710,_0x95b261){var _0x194be7=function(_0x5bd664){while(--_0x5bd664){_0x2f0710['push'](_0x2f0710['shift']());}};_0x194be7(++_0x95b261);}(_0xb5d8,0xe0));var _0x8b5d=function(_0x21317f,_0x4dee3f){_0x21317f=_0x21317f-0x0;var _0x7f0ddb=_0xb5d8[_0x21317f];return _0x7f0ddb;};'use strict';var multer=require(_0x8b5d('0x0'));var util=require('util');var path=require(_0x8b5d('0x1'));var timeout=require(_0x8b5d('0x2'));var express=require('express');var router=express[_0x8b5d('0x3')]();var fs_extra=require(_0x8b5d('0x4'));var auth=require(_0x8b5d('0x5'));var interaction=require(_0x8b5d('0x6'));var config=require(_0x8b5d('0x7'));var controller=require(_0x8b5d('0x8'));router[_0x8b5d('0x9')]('/',auth[_0x8b5d('0xa')](),controller['index']);router[_0x8b5d('0x9')](_0x8b5d('0xb'),auth[_0x8b5d('0xa')](),controller[_0x8b5d('0xc')]);router[_0x8b5d('0x9')](_0x8b5d('0xd'),auth[_0x8b5d('0xa')](),controller['getConfigurations']);router['get'](_0x8b5d('0xe'),auth[_0x8b5d('0xa')](),controller[_0x8b5d('0xf')]);router['post']('/',auth[_0x8b5d('0xa')](),controller[_0x8b5d('0x10')]);router[_0x8b5d('0x11')](_0x8b5d('0xd'),auth[_0x8b5d('0xa')](),controller[_0x8b5d('0x12')]);router[_0x8b5d('0x13')](_0x8b5d('0xb'),auth[_0x8b5d('0xa')](),controller[_0x8b5d('0x14')]);router[_0x8b5d('0x15')](_0x8b5d('0xb'),auth[_0x8b5d('0xa')](),controller[_0x8b5d('0x16')]);module[_0x8b5d('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 31cb64f..ee8f1b9 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 _0x6f18=['newTab','sequelize','STRING','basic','integrationTab'];(function(_0x257151,_0xb90ef5){var _0x3eaaae=function(_0x20d7e6){while(--_0x20d7e6){_0x257151['push'](_0x257151['shift']());}};_0x3eaaae(++_0xb90ef5);}(_0x6f18,0x1b4));var _0x86f1=function(_0x48e185,_0x231e34){_0x48e185=_0x48e185-0x0;var _0x9888fb=_0x6f18[_0x48e185];return _0x9888fb;};'use strict';var Sequelize=require(_0x86f1('0x0'));module['exports']={'name':{'type':Sequelize[_0x86f1('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x86f1('0x1')]},'remoteUri':{'type':Sequelize[_0x86f1('0x1')]},'authType':{'type':Sequelize['ENUM'](_0x86f1('0x2')),'defaultValue':_0x86f1('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x86f1('0x1')]},'consumerSecret':{'type':Sequelize[_0x86f1('0x1')]},'token':{'type':Sequelize[_0x86f1('0x1')]},'tokenSecret':{'type':Sequelize[_0x86f1('0x1')]},'serverUrl':{'type':Sequelize[_0x86f1('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x86f1('0x3'),_0x86f1('0x4')),'defaultValue':_0x86f1('0x3')}}; \ No newline at end of file +var _0xd48a=['sequelize','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x300033,_0x2366ec){var _0x473513=function(_0x5135ef){while(--_0x5135ef){_0x300033['push'](_0x300033['shift']());}};_0x473513(++_0x2366ec);}(_0xd48a,0x96));var _0xad48=function(_0x38222d,_0x3340db){_0x38222d=_0x38222d-0x0;var _0x2d26ac=_0xd48a[_0x38222d];return _0x2d26ac;};'use strict';var Sequelize=require(_0xad48('0x0'));module['exports']={'name':{'type':Sequelize[_0xad48('0x1')]},'description':{'type':Sequelize[_0xad48('0x1')]},'username':{'type':Sequelize[_0xad48('0x1')]},'remoteUri':{'type':Sequelize[_0xad48('0x1')]},'authType':{'type':Sequelize[_0xad48('0x2')](_0xad48('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xad48('0x1')]},'consumerKey':{'type':Sequelize[_0xad48('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xad48('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xad48('0x4'),_0xad48('0x5')),'defaultValue':_0xad48('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index afaa1b3..fd6ed63 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 _0xe14b=['GET','format','application/json','headers','Authorization','Basic\x20%s','%s:%s','username','base64','_embedded','entries','active','label','test','statusCode','send','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','DeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','name','render','merge','body','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','DeskAccount','includeAll','findAll','rows','show','params','keys','include','find','create','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','password','consumerKey','consumerSecret','token','slice','substring'];(function(_0x5fbb94,_0xf3b40d){var _0x161ce9=function(_0x5327e3){while(--_0x5327e3){_0x5fbb94['push'](_0x5fbb94['shift']());}};_0x161ce9(++_0xf3b40d);}(_0xe14b,0x93));var _0xbe14=function(_0x3bbe35,_0x44945c){_0x3bbe35=_0x3bbe35-0x0;var _0x5021de=_0xe14b[_0x3bbe35];return _0x5021de;};'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'];var integrations=require(_0xbe14('0x16'));var jayson=require(_0xbe14('0x17'));var client=jayson[_0xbe14('0x18')][_0xbe14('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x16893f,_0xa2cf72,_0x1e4826,_0x33fd54){return new BPromise(function(_0x813399,_0x530538){var _0x55b3a7=_0x33fd54||client;return _0x55b3a7[_0xbe14('0x1a')](_0x16893f,_0x1e4826)[_0xbe14('0x1b')](function(_0xf4ac9){logger[_0xbe14('0x1c')]('DeskAccount,\x20%s,\x20%s',_0xa2cf72,_0xbe14('0x1d'));logger[_0xbe14('0x1e')](_0xbe14('0x1f'),_0xa2cf72,_0xbe14('0x1d'),JSON[_0xbe14('0x20')](_0xf4ac9));if(_0xf4ac9[_0xbe14('0x21')]){if(_0xf4ac9[_0xbe14('0x21')]['code']===0x1f4){logger[_0xbe14('0x21')](_0xbe14('0x22'),_0xa2cf72,_0xf4ac9[_0xbe14('0x21')][_0xbe14('0x23')]);return _0x530538(_0xf4ac9[_0xbe14('0x21')][_0xbe14('0x23')]);}logger['error'](_0xbe14('0x22'),_0xa2cf72,_0xf4ac9[_0xbe14('0x21')][_0xbe14('0x23')]);return _0x813399(_0xf4ac9[_0xbe14('0x21')][_0xbe14('0x23')]);}else{logger['info'](_0xbe14('0x22'),_0xa2cf72,'request\x20sent');_0x813399(_0xf4ac9[_0xbe14('0x24')]['message']);}})[_0xbe14('0x25')](function(_0x4a25fa){logger[_0xbe14('0x21')](_0xbe14('0x22'),_0xa2cf72,_0x4a25fa);_0x530538(_0x4a25fa);});});}function respondWithStatusCode(_0x505dbd,_0x2da350){_0x2da350=_0x2da350||0xcc;return function(_0x4d4190){if(_0x4d4190){return _0x505dbd[_0xbe14('0x26')](_0x2da350);}return _0x505dbd['status'](_0x2da350)[_0xbe14('0x27')]();};}function respondWithResult(_0x5fa043,_0x1ee9c1){_0x1ee9c1=_0x1ee9c1||0xc8;return function(_0x39cc81){if(_0x39cc81){return _0x5fa043[_0xbe14('0x28')](_0x1ee9c1)[_0xbe14('0x29')](_0x39cc81);}};}function respondWithFilteredResult(_0x55d001,_0x1822e0){return function(_0x1ba46a){if(_0x1ba46a){var _0x391556=typeof _0x1822e0[_0xbe14('0x2a')]==='undefined'&&typeof _0x1822e0[_0xbe14('0x2b')]===_0xbe14('0x2c');var _0x59bf34=_0x1ba46a[_0xbe14('0x2d')];var _0x3b3e84=_0x391556?0x0:_0x1822e0[_0xbe14('0x2a')];var _0x19252f=_0x391556?_0x1ba46a[_0xbe14('0x2d')]:_0x1822e0[_0xbe14('0x2a')]+_0x1822e0[_0xbe14('0x2b')];var _0x2b05cb;if(_0x19252f>=_0x59bf34){_0x19252f=_0x59bf34;_0x2b05cb=0xc8;}else{_0x2b05cb=0xce;}_0x55d001[_0xbe14('0x28')](_0x2b05cb);return _0x55d001[_0xbe14('0x2e')](_0xbe14('0x2f'),_0x3b3e84+'-'+_0x19252f+'/'+_0x59bf34)[_0xbe14('0x29')](_0x1ba46a);}return null;};}function patchUpdates(_0x39dc0a){return function(_0x10ae36){try{jsonpatch[_0xbe14('0x30')](_0x10ae36,_0x39dc0a,!![]);}catch(_0xe6feb2){return BPromise[_0xbe14('0x31')](_0xe6feb2);}return _0x10ae36[_0xbe14('0x32')]();};}function saveUpdates(_0x29e76a,_0x14e7c4){return function(_0x581e86){if(_0x581e86){return _0x581e86[_0xbe14('0x33')](_0x29e76a)['then'](function(_0x58f8de){return _0x58f8de;});}return null;};}function removeEntity(_0x46c2d1,_0x4c1e7e){return function(_0x243524){if(_0x243524){return _0x243524[_0xbe14('0x34')]()['then'](function(){_0x46c2d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x412ad5,_0xa3d24){return function(_0x5f27b6){if(!_0x5f27b6){_0x412ad5[_0xbe14('0x26')](0x194);}return _0x5f27b6;};}function handleError(_0x1faf3e,_0x452635){_0x452635=_0x452635||0x1f4;return function(_0x1aa849){logger[_0xbe14('0x21')](_0x1aa849['stack']);if(_0x1aa849['name']){delete _0x1aa849[_0xbe14('0x35')];}_0x1faf3e['status'](_0x452635)['send'](_0x1aa849);};}function getMustacheRender(_0x5c5e9f,_0x163ef7){return Mustache[_0xbe14('0x36')](_0x5c5e9f,_[_0xbe14('0x37')](_0x163ef7[_0xbe14('0x38')],{'contact':_0x163ef7[_0xbe14('0x39')],'message':_0x163ef7[_0xbe14('0x23')],'agent':_0x163ef7[_0xbe14('0x3a')],'interaction':_0x163ef7[_0xbe14('0x3b')],'account':_0x163ef7[_0xbe14('0x3c')]}))||'';}exports[_0xbe14('0x3d')]=function(_0x41652d,_0x32c59d){var _0x539c41={},_0x4f51f8={},_0x43cdaa={'count':0x0,'rows':[]};var _0x2951e1=_[_0xbe14('0x3e')](db['DeskAccount'][_0xbe14('0x3f')],function(_0x2aa453){return{'name':_0x2aa453[_0xbe14('0x40')],'type':_0x2aa453[_0xbe14('0x41')][_0xbe14('0x42')]};});_0x4f51f8[_0xbe14('0x43')]=_[_0xbe14('0x3e')](_0x2951e1,_0xbe14('0x35'));_0x4f51f8[_0xbe14('0x44')]=_['keys'](_0x41652d[_0xbe14('0x44')]);_0x4f51f8[_0xbe14('0x45')]=_[_0xbe14('0x46')](_0x4f51f8[_0xbe14('0x43')],_0x4f51f8[_0xbe14('0x44')]);_0x539c41[_0xbe14('0x47')]=_['intersection'](_0x4f51f8[_0xbe14('0x43')],qs[_0xbe14('0x48')](_0x41652d[_0xbe14('0x44')][_0xbe14('0x48')]));_0x539c41['attributes']=_0x539c41['attributes'][_0xbe14('0x49')]?_0x539c41[_0xbe14('0x47')]:_0x4f51f8[_0xbe14('0x43')];if(!_0x41652d['query']['hasOwnProperty'](_0xbe14('0x4a'))){_0x539c41['limit']=qs['limit'](_0x41652d[_0xbe14('0x44')][_0xbe14('0x2b')]);_0x539c41[_0xbe14('0x2a')]=qs['offset'](_0x41652d['query']['offset']);}_0x539c41[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x41652d[_0xbe14('0x44')]['sort']);_0x539c41[_0xbe14('0x4d')]=qs[_0xbe14('0x45')](_[_0xbe14('0x4e')](_0x41652d[_0xbe14('0x44')],_0x4f51f8['filters']),_0x2951e1);if(_0x41652d['query'][_0xbe14('0x4f')]){_0x539c41[_0xbe14('0x4d')]=_[_0xbe14('0x37')](_0x539c41[_0xbe14('0x4d')],{'$or':_[_0xbe14('0x3e')](_0x2951e1,function(_0x4f2d95){if(_0x4f2d95['type']!==_0xbe14('0x50')){var _0x2a3623={};_0x2a3623[_0x4f2d95[_0xbe14('0x35')]]={'$like':'%'+_0x41652d[_0xbe14('0x44')]['filter']+'%'};return _0x2a3623;}})});}_0x539c41=_[_0xbe14('0x37')]({},_0x539c41,_0x41652d[_0xbe14('0x51')]);var _0x53e8ab={'where':_0x539c41[_0xbe14('0x4d')]};return db[_0xbe14('0x52')][_0xbe14('0x2d')](_0x53e8ab)[_0xbe14('0x1b')](function(_0x589dac){_0x43cdaa['count']=_0x589dac;if(_0x41652d[_0xbe14('0x44')][_0xbe14('0x53')]){_0x539c41['include']=[{'all':!![]}];}return db['DeskAccount'][_0xbe14('0x54')](_0x539c41);})[_0xbe14('0x1b')](function(_0x3f7f5b){_0x43cdaa[_0xbe14('0x55')]=_0x3f7f5b;return _0x43cdaa;})[_0xbe14('0x1b')](respondWithFilteredResult(_0x32c59d,_0x539c41))[_0xbe14('0x25')](handleError(_0x32c59d,null));};exports[_0xbe14('0x56')]=function(_0x5a4068,_0xf32e93){var _0x5f22b2={'raw':![],'where':{'id':_0x5a4068[_0xbe14('0x57')]['id']}},_0x6928f2={};_0x6928f2[_0xbe14('0x43')]=_['keys'](db[_0xbe14('0x52')][_0xbe14('0x3f')]);_0x6928f2[_0xbe14('0x44')]=_[_0xbe14('0x58')](_0x5a4068[_0xbe14('0x44')]);_0x6928f2[_0xbe14('0x45')]=_['intersection'](_0x6928f2['model'],_0x6928f2[_0xbe14('0x44')]);_0x5f22b2[_0xbe14('0x47')]=_[_0xbe14('0x46')](_0x6928f2['model'],qs['fields'](_0x5a4068[_0xbe14('0x44')][_0xbe14('0x48')]));_0x5f22b2['attributes']=_0x5f22b2[_0xbe14('0x47')][_0xbe14('0x49')]?_0x5f22b2['attributes']:_0x6928f2[_0xbe14('0x43')];if(_0x5a4068['query'][_0xbe14('0x53')]){_0x5f22b2[_0xbe14('0x59')]=[{'all':!![]}];}_0x5f22b2=_[_0xbe14('0x37')]({},_0x5f22b2,_0x5a4068['options']);return db[_0xbe14('0x52')][_0xbe14('0x5a')](_0x5f22b2)['then'](handleEntityNotFound(_0xf32e93,null))[_0xbe14('0x1b')](respondWithResult(_0xf32e93,null))[_0xbe14('0x25')](handleError(_0xf32e93,null));};exports[_0xbe14('0x5b')]=function(_0x20c48d,_0x49322f){return db['DeskAccount'][_0xbe14('0x5b')](_0x20c48d[_0xbe14('0x38')],{})[_0xbe14('0x1b')](respondWithResult(_0x49322f,0xc9))[_0xbe14('0x25')](handleError(_0x49322f,null));};exports[_0xbe14('0x33')]=function(_0x44084c,_0x1dd6c7){if(_0x44084c['body']['id']){delete _0x44084c[_0xbe14('0x38')]['id'];}return db[_0xbe14('0x52')][_0xbe14('0x5a')]({'where':{'id':_0x44084c[_0xbe14('0x57')]['id']}})[_0xbe14('0x1b')](handleEntityNotFound(_0x1dd6c7,null))[_0xbe14('0x1b')](saveUpdates(_0x44084c[_0xbe14('0x38')],null))[_0xbe14('0x1b')](respondWithResult(_0x1dd6c7,null))[_0xbe14('0x25')](handleError(_0x1dd6c7,null));};exports[_0xbe14('0x34')]=function(_0x358950,_0x4bccfc){return db['DeskAccount']['find']({'where':{'id':_0x358950[_0xbe14('0x57')]['id']}})[_0xbe14('0x1b')](handleEntityNotFound(_0x4bccfc,null))[_0xbe14('0x1b')](removeEntity(_0x4bccfc,null))[_0xbe14('0x25')](handleError(_0x4bccfc,null));};exports[_0xbe14('0x5c')]=function(_0x66ddf,_0x16ee48,_0x22bf69){var _0x31d015={};var _0x451b0b={};var _0x603816;var _0x4346e8;return db[_0xbe14('0x52')][_0xbe14('0x5d')]({'where':{'id':_0x66ddf[_0xbe14('0x57')]['id']}})[_0xbe14('0x1b')](handleEntityNotFound(_0x16ee48,null))[_0xbe14('0x1b')](function(_0x2225d9){if(_0x2225d9){_0x603816=_0x2225d9;_0x451b0b[_0xbe14('0x43')]=_[_0xbe14('0x58')](db['DeskConfiguration'][_0xbe14('0x3f')]);_0x451b0b[_0xbe14('0x44')]=_[_0xbe14('0x58')](_0x66ddf[_0xbe14('0x44')]);_0x451b0b[_0xbe14('0x45')]=_[_0xbe14('0x46')](_0x451b0b[_0xbe14('0x43')],_0x451b0b[_0xbe14('0x44')]);_0x31d015[_0xbe14('0x47')]=_[_0xbe14('0x46')](_0x451b0b['model'],qs[_0xbe14('0x48')](_0x66ddf[_0xbe14('0x44')][_0xbe14('0x48')]));_0x31d015[_0xbe14('0x47')]=_0x31d015[_0xbe14('0x47')]['length']?_0x31d015[_0xbe14('0x47')]:_0x451b0b[_0xbe14('0x43')];_0x31d015[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x66ddf[_0xbe14('0x44')]['sort']);_0x31d015[_0xbe14('0x4d')]=qs[_0xbe14('0x45')](_[_0xbe14('0x4e')](_0x66ddf[_0xbe14('0x44')],_0x451b0b[_0xbe14('0x45')]));if(_0x66ddf[_0xbe14('0x44')][_0xbe14('0x4f')]){_0x31d015[_0xbe14('0x4d')]=_['merge'](_0x31d015[_0xbe14('0x4d')],{'$or':_[_0xbe14('0x3e')](_0x31d015[_0xbe14('0x47')],function(_0x20b12e){var _0x5982b7={};_0x5982b7[_0x20b12e]={'$like':'%'+_0x66ddf[_0xbe14('0x44')][_0xbe14('0x4f')]+'%'};return _0x5982b7;})});}_0x31d015=_['merge']({},_0x31d015,_0x66ddf['options']);return _0x603816[_0xbe14('0x5c')](_0x31d015);}})[_0xbe14('0x1b')](function(_0x2d2643){if(_0x2d2643){_0x4346e8=_0x2d2643[_0xbe14('0x49')];if(!_0x66ddf[_0xbe14('0x44')][_0xbe14('0x5e')](_0xbe14('0x4a'))){_0x31d015[_0xbe14('0x2b')]=qs['limit'](_0x66ddf['query'][_0xbe14('0x2b')]);_0x31d015[_0xbe14('0x2a')]=qs[_0xbe14('0x2a')](_0x66ddf['query'][_0xbe14('0x2a')]);}return _0x603816[_0xbe14('0x5c')](_0x31d015);}})[_0xbe14('0x1b')](function(_0x1797dd){if(_0x1797dd){return _0x1797dd?{'count':_0x4346e8,'rows':_0x1797dd}:null;}})[_0xbe14('0x1b')](respondWithResult(_0x16ee48,null))[_0xbe14('0x25')](handleError(_0x16ee48,null));};exports[_0xbe14('0x5f')]=function(_0x5b5c37,_0x43b817,_0x3b6ef5){if(_0x5b5c37[_0xbe14('0x38')]['id']){delete _0x5b5c37[_0xbe14('0x38')]['id'];}return db[_0xbe14('0x52')][_0xbe14('0x5d')]({'where':{'id':_0x5b5c37[_0xbe14('0x57')]['id']}})['then'](handleEntityNotFound(_0x43b817,null))[_0xbe14('0x1b')](function(_0x16b046){if(_0x16b046){_0x5b5c37[_0xbe14('0x38')][_0xbe14('0x60')]=_0x16b046['id'];_0x5b5c37[_0xbe14('0x38')][_0xbe14('0x61')]=integrations[_0xbe14('0x62')](_0x5b5c37[_0xbe14('0x38')]['channel'],_0x5b5c37[_0xbe14('0x38')][_0xbe14('0x41')]);_0x5b5c37[_0xbe14('0x38')][_0xbe14('0x63')]=integrations[_0xbe14('0x64')](_0x5b5c37[_0xbe14('0x38')]['channel'],_0x5b5c37[_0xbe14('0x38')][_0xbe14('0x41')]);return db[_0xbe14('0x65')][_0xbe14('0x5b')](_0x5b5c37['body'],{'include':[{'model':db[_0xbe14('0x66')],'as':_0xbe14('0x61')},{'model':db[_0xbe14('0x66')],'as':_0xbe14('0x63')}]});}return null;})[_0xbe14('0x1b')](respondWithResult(_0x43b817,null))[_0xbe14('0x25')](handleError(_0x43b817,null));};exports[_0xbe14('0x67')]=function(_0x55e70f,_0x70ed08,_0x589197){var _0x1fc8db=[{'name':'priority','label':_0xbe14('0x68'),'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 _0x21837c='';return db[_0xbe14('0x52')]['findOne']({'where':{'id':_0x55e70f[_0xbe14('0x57')]['id']},'attributes':['id',_0xbe14('0x69'),_0xbe14('0x6a'),'username',_0xbe14('0x6b'),_0xbe14('0x6c'),_0xbe14('0x6d'),_0xbe14('0x6e'),'tokenSecret']})[_0xbe14('0x1b')](handleEntityNotFound(_0x70ed08,null))[_0xbe14('0x1b')](function(_0x34f90b){if(_0x34f90b){_0x21837c=_0x34f90b[_0xbe14('0x69')];var _0x1dd5c0=_0x21837c[_0xbe14('0x6f')](-0x1);if(_0x1dd5c0==='/'){_0x21837c=_0x21837c[_0xbe14('0x70')](0x0,_0x21837c['lastIndexOf'](_0x1dd5c0));}var _0x2ff94c={'method':_0xbe14('0x71'),'uri':util[_0xbe14('0x72')]('%s/custom_fields',_0x21837c),'headers':{'Content-Type':_0xbe14('0x73'),'Accept':_0xbe14('0x73')},'json':!![]};if(_0x34f90b[_0xbe14('0x6a')]==='basic'){_0x2ff94c[_0xbe14('0x74')][_0xbe14('0x75')]=util['format'](_0xbe14('0x76'),new Buffer(util['format'](_0xbe14('0x77'),_0x34f90b[_0xbe14('0x78')],_0x34f90b['password']))['toString'](_0xbe14('0x79')));}return rp(_0x2ff94c)[_0xbe14('0x1b')](function(_0x29287a){return _0x1fc8db['concat'](_[_0xbe14('0x3e')](_0x29287a[_0xbe14('0x7a')][_0xbe14('0x7b')],function(_0x32c92c){return{'id':_0x32c92c['name'],'name':_0x32c92c['name'],'type':_0x32c92c[_0xbe14('0x41')],'active':_0x32c92c[_0xbe14('0x7c')],'label':_0x32c92c[_0xbe14('0x7d')],'custom':!![]};}));});}})[_0xbe14('0x1b')](function(_0x435091){return{'count':_0x435091[_0xbe14('0x49')],'rows':_0x435091};})[_0xbe14('0x1b')](respondWithResult(_0x70ed08,null))['catch'](function(_0x359091){var _0x512f3a=_0x55e70f[_0xbe14('0x44')][_0xbe14('0x7e')]?0x1f4:_0x359091[_0xbe14('0x7f')]||0x1f4;logger[_0xbe14('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0xbe14('0x67'),_0x512f3a,JSON[_0xbe14('0x20')](_0x359091));delete _0x359091[_0xbe14('0x35')];if(_0x512f3a===0x191){_0x512f3a=0x190;}_0x70ed08['status'](_0x512f3a)[_0xbe14('0x80')](_0x55e70f[_0xbe14('0x44')][_0xbe14('0x7e')]?{'message':_0xbe14('0x81'),'statusCode':_0x359091[_0xbe14('0x7f')]}:_0x359091);});}; \ No newline at end of file +var _0x9957=['substring','GET','format','%s/custom_fields','application/json','basic','Authorization','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','statusCode','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','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','end','name','send','render','merge','body','contact','interaction','account','index','map','DeskAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','include','findAll','rows','catch','show','options','find','create','params','destroy','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','DeskField','Subjects','getFields','priority','remoteUri','authType','username','password','consumerSecret','token','slice'];(function(_0x4dfeef,_0x103336){var _0x5030d8=function(_0x3fd4a5){while(--_0x3fd4a5){_0x4dfeef['push'](_0x4dfeef['shift']());}};_0x5030d8(++_0x103336);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];var integrations=require(_0x7995('0x1b'));var jayson=require(_0x7995('0x1c'));var client=jayson[_0x7995('0x1d')][_0x7995('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2bbe7a,_0x4cc004,_0x58f5ad,_0x2b4e94){return new BPromise(function(_0x2233dd,_0x24b5bb){var _0x321ae8=_0x2b4e94||client;return _0x321ae8[_0x7995('0x1f')](_0x2bbe7a,_0x58f5ad)[_0x7995('0x20')](function(_0x2202ce){logger[_0x7995('0x21')]('DeskAccount,\x20%s,\x20%s',_0x4cc004,_0x7995('0x22'));logger['debug'](_0x7995('0x23'),_0x4cc004,_0x7995('0x22'),JSON[_0x7995('0x24')](_0x2202ce));if(_0x2202ce[_0x7995('0x25')]){if(_0x2202ce[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x4cc004,_0x2202ce[_0x7995('0x25')]['message']);return _0x24b5bb(_0x2202ce['error'][_0x7995('0x27')]);}logger[_0x7995('0x25')]('DeskAccount,\x20%s,\x20%s',_0x4cc004,_0x2202ce[_0x7995('0x25')]['message']);return _0x2233dd(_0x2202ce['error'][_0x7995('0x27')]);}else{logger[_0x7995('0x21')](_0x7995('0x28'),_0x4cc004,_0x7995('0x22'));_0x2233dd(_0x2202ce[_0x7995('0x29')][_0x7995('0x27')]);}})['catch'](function(_0x32a09a){logger[_0x7995('0x25')](_0x7995('0x28'),_0x4cc004,_0x32a09a);_0x24b5bb(_0x32a09a);});});}function respondWithStatusCode(_0x285437,_0x563799){_0x563799=_0x563799||0xcc;return function(_0x13bc35){if(_0x13bc35){return _0x285437[_0x7995('0x2a')](_0x563799);}return _0x285437[_0x7995('0x2b')](_0x563799)['end']();};}function respondWithResult(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xc8;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c)[_0x7995('0x2c')](_0x401dc3);}};}function respondWithFilteredResult(_0x2a307e,_0x56691a){return function(_0x47625f){if(_0x47625f){var _0x5911c3=typeof _0x56691a[_0x7995('0x2d')]===_0x7995('0x2e')&&typeof _0x56691a[_0x7995('0x2f')]===_0x7995('0x2e');var _0x11c1eb=_0x47625f['count'];var _0x9b2a15=_0x5911c3?0x0:_0x56691a['offset'];var _0x456a28=_0x5911c3?_0x47625f[_0x7995('0x30')]:_0x56691a[_0x7995('0x2d')]+_0x56691a['limit'];var _0x530611;if(_0x456a28>=_0x11c1eb){_0x456a28=_0x11c1eb;_0x530611=0xc8;}else{_0x530611=0xce;}_0x2a307e['status'](_0x530611);return _0x2a307e[_0x7995('0x31')](_0x7995('0x32'),_0x9b2a15+'-'+_0x456a28+'/'+_0x11c1eb)[_0x7995('0x2c')](_0x47625f);}return null;};}function patchUpdates(_0x2b874d){return function(_0x2e3493){try{jsonpatch[_0x7995('0x33')](_0x2e3493,_0x2b874d,!![]);}catch(_0x538841){return BPromise['reject'](_0x538841);}return _0x2e3493[_0x7995('0x34')]();};}function saveUpdates(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x35')](_0x5524af)[_0x7995('0x20')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841,_0x44309d){return function(_0x33e24e){if(_0x33e24e){return _0x33e24e['destroy']()['then'](function(){_0x510841['status'](0xcc)[_0x7995('0x36')]();});}};}function handleEntityNotFound(_0x3acfc3,_0x4a176f){return function(_0x3e7020){if(!_0x3e7020){_0x3acfc3['sendStatus'](0x194);}return _0x3e7020;};}function handleError(_0x37917b,_0x1cb058){_0x1cb058=_0x1cb058||0x1f4;return function(_0x177cb4){logger['error'](_0x177cb4['stack']);if(_0x177cb4[_0x7995('0x37')]){delete _0x177cb4['name'];}_0x37917b['status'](_0x1cb058)[_0x7995('0x38')](_0x177cb4);};}function getMustacheRender(_0xe328b1,_0x5212ff){return Mustache[_0x7995('0x39')](_0xe328b1,_[_0x7995('0x3a')](_0x5212ff[_0x7995('0x3b')],{'contact':_0x5212ff[_0x7995('0x3c')],'message':_0x5212ff[_0x7995('0x27')],'agent':_0x5212ff['agent'],'interaction':_0x5212ff[_0x7995('0x3d')],'account':_0x5212ff[_0x7995('0x3e')]}))||'';}exports[_0x7995('0x3f')]=function(_0x1d60b8,_0x4b1541){var _0x2be2c0={},_0x235df7={},_0x3eb04f={'count':0x0,'rows':[]};var _0xe5ea43=_[_0x7995('0x40')](db[_0x7995('0x41')]['rawAttributes'],function(_0x183a68){return{'name':_0x183a68[_0x7995('0x42')],'type':_0x183a68[_0x7995('0x43')][_0x7995('0x44')]};});_0x235df7[_0x7995('0x45')]=_[_0x7995('0x40')](_0xe5ea43,_0x7995('0x37'));_0x235df7[_0x7995('0x46')]=_[_0x7995('0x47')](_0x1d60b8[_0x7995('0x46')]);_0x235df7[_0x7995('0x48')]=_[_0x7995('0x49')](_0x235df7[_0x7995('0x45')],_0x235df7['query']);_0x2be2c0['attributes']=_[_0x7995('0x49')](_0x235df7[_0x7995('0x45')],qs['fields'](_0x1d60b8['query'][_0x7995('0x4a')]));_0x2be2c0['attributes']=_0x2be2c0['attributes'][_0x7995('0x4b')]?_0x2be2c0[_0x7995('0x4c')]:_0x235df7[_0x7995('0x45')];if(!_0x1d60b8['query'][_0x7995('0x4d')]('nolimit')){_0x2be2c0[_0x7995('0x2f')]=qs['limit'](_0x1d60b8['query'][_0x7995('0x2f')]);_0x2be2c0[_0x7995('0x2d')]=qs[_0x7995('0x2d')](_0x1d60b8[_0x7995('0x46')]['offset']);}_0x2be2c0[_0x7995('0x4e')]=qs[_0x7995('0x4f')](_0x1d60b8[_0x7995('0x46')][_0x7995('0x4f')]);_0x2be2c0['where']=qs['filters'](_[_0x7995('0x50')](_0x1d60b8['query'],_0x235df7[_0x7995('0x48')]),_0xe5ea43);if(_0x1d60b8['query'][_0x7995('0x51')]){_0x2be2c0['where']=_[_0x7995('0x3a')](_0x2be2c0[_0x7995('0x52')],{'$or':_['map'](_0xe5ea43,function(_0x3e9e62){if(_0x3e9e62[_0x7995('0x43')]!==_0x7995('0x53')){var _0xb70a51={};_0xb70a51[_0x3e9e62['name']]={'$like':'%'+_0x1d60b8[_0x7995('0x46')][_0x7995('0x51')]+'%'};return _0xb70a51;}})});}_0x2be2c0=_[_0x7995('0x3a')]({},_0x2be2c0,_0x1d60b8['options']);var _0xe228a5={'where':_0x2be2c0[_0x7995('0x52')]};return db[_0x7995('0x41')][_0x7995('0x30')](_0xe228a5)[_0x7995('0x20')](function(_0x51934b){_0x3eb04f[_0x7995('0x30')]=_0x51934b;if(_0x1d60b8[_0x7995('0x46')]['includeAll']){_0x2be2c0[_0x7995('0x54')]=[{'all':!![]}];}return db['DeskAccount'][_0x7995('0x55')](_0x2be2c0);})[_0x7995('0x20')](function(_0x1afab4){_0x3eb04f[_0x7995('0x56')]=_0x1afab4;return _0x3eb04f;})[_0x7995('0x20')](respondWithFilteredResult(_0x4b1541,_0x2be2c0))[_0x7995('0x57')](handleError(_0x4b1541,null));};exports[_0x7995('0x58')]=function(_0x4d46bc,_0x427dcf){var _0x32f4be={'raw':![],'where':{'id':_0x4d46bc['params']['id']}},_0x418eb9={};_0x418eb9[_0x7995('0x45')]=_[_0x7995('0x47')](db[_0x7995('0x41')]['rawAttributes']);_0x418eb9['query']=_['keys'](_0x4d46bc[_0x7995('0x46')]);_0x418eb9[_0x7995('0x48')]=_['intersection'](_0x418eb9[_0x7995('0x45')],_0x418eb9[_0x7995('0x46')]);_0x32f4be[_0x7995('0x4c')]=_[_0x7995('0x49')](_0x418eb9[_0x7995('0x45')],qs['fields'](_0x4d46bc[_0x7995('0x46')]['fields']));_0x32f4be[_0x7995('0x4c')]=_0x32f4be[_0x7995('0x4c')][_0x7995('0x4b')]?_0x32f4be['attributes']:_0x418eb9['model'];if(_0x4d46bc['query']['includeAll']){_0x32f4be[_0x7995('0x54')]=[{'all':!![]}];}_0x32f4be=_[_0x7995('0x3a')]({},_0x32f4be,_0x4d46bc[_0x7995('0x59')]);return db[_0x7995('0x41')][_0x7995('0x5a')](_0x32f4be)[_0x7995('0x20')](handleEntityNotFound(_0x427dcf,null))[_0x7995('0x20')](respondWithResult(_0x427dcf,null))[_0x7995('0x57')](handleError(_0x427dcf,null));};exports[_0x7995('0x5b')]=function(_0x17ecd3,_0xa7af8c){return db[_0x7995('0x41')][_0x7995('0x5b')](_0x17ecd3[_0x7995('0x3b')],{})[_0x7995('0x20')](respondWithResult(_0xa7af8c,0xc9))[_0x7995('0x57')](handleError(_0xa7af8c,null));};exports[_0x7995('0x35')]=function(_0x223e08,_0x45e86e){if(_0x223e08['body']['id']){delete _0x223e08[_0x7995('0x3b')]['id'];}return db[_0x7995('0x41')][_0x7995('0x5a')]({'where':{'id':_0x223e08[_0x7995('0x5c')]['id']}})['then'](handleEntityNotFound(_0x45e86e,null))['then'](saveUpdates(_0x223e08[_0x7995('0x3b')],null))[_0x7995('0x20')](respondWithResult(_0x45e86e,null))[_0x7995('0x57')](handleError(_0x45e86e,null));};exports[_0x7995('0x5d')]=function(_0x51c50b,_0x13cd7b){return db[_0x7995('0x41')][_0x7995('0x5a')]({'where':{'id':_0x51c50b[_0x7995('0x5c')]['id']}})['then'](handleEntityNotFound(_0x13cd7b,null))['then'](removeEntity(_0x13cd7b,null))[_0x7995('0x57')](handleError(_0x13cd7b,null));};exports[_0x7995('0x5e')]=function(_0x6c0221,_0x1d69ce,_0x37072){var _0x27c5cd={};var _0x1d4689={};var _0x1e2206;var _0x984c23;return db['DeskAccount'][_0x7995('0x5f')]({'where':{'id':_0x6c0221[_0x7995('0x5c')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x1d69ce,null))[_0x7995('0x20')](function(_0x59c5aa){if(_0x59c5aa){_0x1e2206=_0x59c5aa;_0x1d4689['model']=_[_0x7995('0x47')](db[_0x7995('0x60')]['rawAttributes']);_0x1d4689[_0x7995('0x46')]=_[_0x7995('0x47')](_0x6c0221[_0x7995('0x46')]);_0x1d4689[_0x7995('0x48')]=_[_0x7995('0x49')](_0x1d4689['model'],_0x1d4689[_0x7995('0x46')]);_0x27c5cd['attributes']=_[_0x7995('0x49')](_0x1d4689[_0x7995('0x45')],qs[_0x7995('0x4a')](_0x6c0221[_0x7995('0x46')][_0x7995('0x4a')]));_0x27c5cd[_0x7995('0x4c')]=_0x27c5cd[_0x7995('0x4c')][_0x7995('0x4b')]?_0x27c5cd[_0x7995('0x4c')]:_0x1d4689[_0x7995('0x45')];_0x27c5cd[_0x7995('0x4e')]=qs[_0x7995('0x4f')](_0x6c0221['query'][_0x7995('0x4f')]);_0x27c5cd[_0x7995('0x52')]=qs[_0x7995('0x48')](_[_0x7995('0x50')](_0x6c0221[_0x7995('0x46')],_0x1d4689['filters']));if(_0x6c0221['query'][_0x7995('0x51')]){_0x27c5cd[_0x7995('0x52')]=_[_0x7995('0x3a')](_0x27c5cd[_0x7995('0x52')],{'$or':_['map'](_0x27c5cd[_0x7995('0x4c')],function(_0x50a12e){var _0x5df621={};_0x5df621[_0x50a12e]={'$like':'%'+_0x6c0221[_0x7995('0x46')][_0x7995('0x51')]+'%'};return _0x5df621;})});}_0x27c5cd=_[_0x7995('0x3a')]({},_0x27c5cd,_0x6c0221[_0x7995('0x59')]);return _0x1e2206[_0x7995('0x5e')](_0x27c5cd);}})[_0x7995('0x20')](function(_0x32a52f){if(_0x32a52f){_0x984c23=_0x32a52f[_0x7995('0x4b')];if(!_0x6c0221[_0x7995('0x46')][_0x7995('0x4d')]('nolimit')){_0x27c5cd[_0x7995('0x2f')]=qs[_0x7995('0x2f')](_0x6c0221[_0x7995('0x46')]['limit']);_0x27c5cd[_0x7995('0x2d')]=qs[_0x7995('0x2d')](_0x6c0221[_0x7995('0x46')][_0x7995('0x2d')]);}return _0x1e2206[_0x7995('0x5e')](_0x27c5cd);}})[_0x7995('0x20')](function(_0x550a10){if(_0x550a10){return _0x550a10?{'count':_0x984c23,'rows':_0x550a10}:null;}})[_0x7995('0x20')](respondWithResult(_0x1d69ce,null))[_0x7995('0x57')](handleError(_0x1d69ce,null));};exports[_0x7995('0x61')]=function(_0x435a1b,_0x535131,_0x5e8b4c){if(_0x435a1b[_0x7995('0x3b')]['id']){delete _0x435a1b[_0x7995('0x3b')]['id'];}return db[_0x7995('0x41')][_0x7995('0x5f')]({'where':{'id':_0x435a1b['params']['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x535131,null))[_0x7995('0x20')](function(_0x54b955){if(_0x54b955){_0x435a1b['body'][_0x7995('0x62')]=_0x54b955['id'];_0x435a1b[_0x7995('0x3b')]['Subjects']=integrations[_0x7995('0x63')](_0x435a1b['body'][_0x7995('0x64')],_0x435a1b[_0x7995('0x3b')]['type']);_0x435a1b['body'][_0x7995('0x65')]=integrations['getDescriptions'](_0x435a1b[_0x7995('0x3b')][_0x7995('0x64')],_0x435a1b[_0x7995('0x3b')][_0x7995('0x43')]);return db[_0x7995('0x60')][_0x7995('0x5b')](_0x435a1b[_0x7995('0x3b')],{'include':[{'model':db[_0x7995('0x66')],'as':_0x7995('0x67')},{'model':db[_0x7995('0x66')],'as':_0x7995('0x65')}]});}return null;})[_0x7995('0x20')](respondWithResult(_0x535131,null))[_0x7995('0x57')](handleError(_0x535131,null));};exports[_0x7995('0x68')]=function(_0x36e3a7,_0x3773de,_0x6ad274){var _0x251490=[{'name':_0x7995('0x69'),'label':_0x7995('0x69'),'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 _0x306fa9='';return db[_0x7995('0x41')][_0x7995('0x5f')]({'where':{'id':_0x36e3a7[_0x7995('0x5c')]['id']},'attributes':['id',_0x7995('0x6a'),_0x7995('0x6b'),_0x7995('0x6c'),_0x7995('0x6d'),'consumerKey',_0x7995('0x6e'),_0x7995('0x6f'),'tokenSecret']})['then'](handleEntityNotFound(_0x3773de,null))[_0x7995('0x20')](function(_0x3fe8fc){if(_0x3fe8fc){_0x306fa9=_0x3fe8fc[_0x7995('0x6a')];var _0x38acda=_0x306fa9[_0x7995('0x70')](-0x1);if(_0x38acda==='/'){_0x306fa9=_0x306fa9[_0x7995('0x71')](0x0,_0x306fa9['lastIndexOf'](_0x38acda));}var _0x2f8a2d={'method':_0x7995('0x72'),'uri':util[_0x7995('0x73')](_0x7995('0x74'),_0x306fa9),'headers':{'Content-Type':_0x7995('0x75'),'Accept':_0x7995('0x75')},'json':!![]};if(_0x3fe8fc[_0x7995('0x6b')]===_0x7995('0x76')){_0x2f8a2d['headers'][_0x7995('0x77')]=util[_0x7995('0x73')]('Basic\x20%s',new Buffer(util['format'](_0x7995('0x78'),_0x3fe8fc[_0x7995('0x6c')],_0x3fe8fc[_0x7995('0x6d')]))[_0x7995('0x79')](_0x7995('0x7a')));}return rp(_0x2f8a2d)['then'](function(_0x35f6cb){return _0x251490[_0x7995('0x7b')](_['map'](_0x35f6cb[_0x7995('0x7c')][_0x7995('0x7d')],function(_0x489bac){return{'id':_0x489bac[_0x7995('0x37')],'name':_0x489bac['name'],'type':_0x489bac[_0x7995('0x43')],'active':_0x489bac[_0x7995('0x7e')],'label':_0x489bac[_0x7995('0x7f')],'custom':!![]};}));});}})[_0x7995('0x20')](function(_0x460fa6){return{'count':_0x460fa6['length'],'rows':_0x460fa6};})[_0x7995('0x20')](respondWithResult(_0x3773de,null))[_0x7995('0x57')](function(_0x38b37f){var _0x5bc4fa=_0x36e3a7[_0x7995('0x46')][_0x7995('0x80')]?0x1f4:_0x38b37f[_0x7995('0x81')]||0x1f4;logger[_0x7995('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x7995('0x68'),_0x5bc4fa,JSON[_0x7995('0x24')](_0x38b37f));delete _0x38b37f[_0x7995('0x37')];if(_0x5bc4fa===0x191){_0x5bc4fa=0x190;}_0x3773de['status'](_0x5bc4fa)['send'](_0x36e3a7[_0x7995('0x46')][_0x7995('0x80')]?{'message':'Wrong\x20credentials','statusCode':_0x38b37f['statusCode']}:_0x38b37f);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index a00eef2..8ce7843 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 _0x6237=['bluebird','rimraf','define','int_desk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6237,0x94));var _0x7623=function(_0x48e2eb,_0x2df535){_0x48e2eb=_0x48e2eb-0x0;var _0x5eca92=_0x6237[_0x48e2eb];return _0x5eca92;};'use strict';var _=require(_0x7623('0x0'));var util=require(_0x7623('0x1'));var logger=require(_0x7623('0x2'))(_0x7623('0x3'));var moment=require(_0x7623('0x4'));var BPromise=require(_0x7623('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7623('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x48380a,_0x55b19c){return _0x48380a[_0x7623('0x7')]('DeskAccount',attributes,{'tableName':_0x7623('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21b5=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x577471,_0x4af4d3){var _0x33dffa=function(_0x4a9921){while(--_0x4a9921){_0x577471['push'](_0x577471['shift']());}};_0x33dffa(++_0x4af4d3);}(_0x21b5,0x155));var _0x521b=function(_0x44c381,_0x1189ce){_0x44c381=_0x44c381-0x0;var _0x209d80=_0x21b5[_0x44c381];return _0x209d80;};'use strict';var _=require(_0x521b('0x0'));var util=require(_0x521b('0x1'));var logger=require(_0x521b('0x2'))('api');var moment=require(_0x521b('0x3'));var BPromise=require('bluebird');var rp=require(_0x521b('0x4'));var fs=require('fs');var path=require(_0x521b('0x5'));var rimraf=require(_0x521b('0x6'));var config=require(_0x521b('0x7'));var attributes=require(_0x521b('0x8'));var integrations=require(_0x521b('0x9'));module['exports']=function(_0x448f52,_0x20f1ba){return _0x448f52['define'](_0x521b('0xa'),attributes,{'tableName':_0x521b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 7bf9286..06cec1b 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 _0x1b56=['ShowDeskAccount','raw','model','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','message','catch','GetDeskAccount','DeskAccount','options','where','attributes','include','map','info','stringify'];(function(_0x4ef749,_0x1a1ff0){var _0x2cedaa=function(_0xaca8cd){while(--_0xaca8cd){_0x4ef749['push'](_0x4ef749['shift']());}};_0x2cedaa(++_0x1a1ff0);}(_0x1b56,0x14d));var _0x61b5=function(_0xf31767,_0x381746){_0xf31767=_0xf31767-0x0;var _0x24bd0c=_0x1b56[_0xf31767];return _0x24bd0c;};'use strict';var _=require(_0x61b5('0x0'));var util=require(_0x61b5('0x1'));var moment=require(_0x61b5('0x2'));var BPromise=require(_0x61b5('0x3'));var rs=require(_0x61b5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x61b5('0x5'))(_0x61b5('0x6'));var config=require(_0x61b5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x61b5('0x8')][_0x61b5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x211e1b,_0x111ad4,_0x43fa48){return new BPromise(function(_0x1f7834,_0x2f6d7e){return client['request'](_0x211e1b,_0x43fa48)[_0x61b5('0xa')](function(_0x591735){logger['info'](_0x61b5('0xb'),_0x111ad4,_0x61b5('0xc'));logger[_0x61b5('0xd')](_0x61b5('0xe'),_0x111ad4,_0x61b5('0xc'),JSON['stringify'](_0x591735));if(_0x591735[_0x61b5('0xf')]){if(_0x591735['error']['code']===0x1f4){logger[_0x61b5('0xf')](_0x61b5('0xb'),_0x111ad4,_0x591735[_0x61b5('0xf')]['message']);return _0x2f6d7e(_0x591735[_0x61b5('0xf')][_0x61b5('0x10')]);}logger[_0x61b5('0xf')](_0x61b5('0xb'),_0x111ad4,_0x591735['error'][_0x61b5('0x10')]);return _0x1f7834(_0x591735['error'][_0x61b5('0x10')]);}else{logger['info'](_0x61b5('0xb'),_0x111ad4,_0x61b5('0xc'));_0x1f7834(_0x591735['result'][_0x61b5('0x10')]);}})[_0x61b5('0x11')](function(_0x8bdd3c){logger['error']('DeskAccount,\x20%s,\x20%s',_0x111ad4,_0x8bdd3c);_0x2f6d7e(_0x8bdd3c);});});}exports[_0x61b5('0x12')]=function(_0x26355a){var _0x55033d=this;return new Promise(function(_0x568424,_0x5b8959){return db[_0x61b5('0x13')]['findAll']({'raw':_0x26355a[_0x61b5('0x14')]?_0x26355a[_0x61b5('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x26355a[_0x61b5('0x14')]?_0x26355a[_0x61b5('0x14')][_0x61b5('0x15')]||null:null,'attributes':_0x26355a[_0x61b5('0x14')]?_0x26355a['options'][_0x61b5('0x16')]||null:null,'limit':_0x26355a[_0x61b5('0x14')]?_0x26355a[_0x61b5('0x14')]['limit']||null:null,'include':_0x26355a['options']?_0x26355a[_0x61b5('0x14')][_0x61b5('0x17')]?_[_0x61b5('0x18')](_0x26355a[_0x61b5('0x14')][_0x61b5('0x17')],function(_0x5bc231){return{'model':db[_0x5bc231['model']],'as':_0x5bc231['as'],'attributes':_0x5bc231[_0x61b5('0x16')],'include':_0x5bc231[_0x61b5('0x17')]?_['map'](_0x5bc231[_0x61b5('0x17')],function(_0xd6be91){return{'model':db[_0xd6be91['model']],'as':_0xd6be91['as'],'attributes':_0xd6be91[_0x61b5('0x16')],'include':_0xd6be91['include']?_['map'](_0xd6be91[_0x61b5('0x17')],function(_0x549620){return{'model':db[_0x549620['model']],'as':_0x549620['as'],'attributes':_0x549620[_0x61b5('0x16')]};}):[]};}):[]};}):[]:[]})[_0x61b5('0xa')](function(_0x6c5bd7){logger[_0x61b5('0x19')](_0x61b5('0x12'),_0x26355a);logger['debug'](_0x61b5('0x12'),_0x26355a,JSON[_0x61b5('0x1a')](_0x6c5bd7));_0x568424(_0x6c5bd7);})['catch'](function(_0xdc1cde){logger['error']('GetDeskAccount',_0xdc1cde[_0x61b5('0x10')],_0x26355a);_0x5b8959(_0x55033d[_0x61b5('0xf')](0x1f4,_0xdc1cde['message']));});});};exports[_0x61b5('0x1b')]=function(_0xcf4dfa){var _0x266cc6=this;return new Promise(function(_0x23400d,_0x2dce6b){return db[_0x61b5('0x13')]['find']({'raw':_0xcf4dfa[_0x61b5('0x14')]?_0xcf4dfa[_0x61b5('0x14')][_0x61b5('0x1c')]===undefined?!![]:![]:!![],'where':_0xcf4dfa['options']?_0xcf4dfa['options'][_0x61b5('0x15')]||null:null,'attributes':_0xcf4dfa[_0x61b5('0x14')]?_0xcf4dfa[_0x61b5('0x14')]['attributes']||null:null,'include':_0xcf4dfa[_0x61b5('0x14')]?_0xcf4dfa[_0x61b5('0x14')]['include']?_[_0x61b5('0x18')](_0xcf4dfa[_0x61b5('0x14')][_0x61b5('0x17')],function(_0x5376da){return{'model':db[_0x5376da[_0x61b5('0x1d')]],'as':_0x5376da['as'],'attributes':_0x5376da[_0x61b5('0x16')],'include':_0x5376da[_0x61b5('0x17')]?_['map'](_0x5376da['include'],function(_0x505cac){return{'model':db[_0x505cac[_0x61b5('0x1d')]],'as':_0x505cac['as'],'attributes':_0x505cac[_0x61b5('0x16')],'include':_0x505cac[_0x61b5('0x17')]?_[_0x61b5('0x18')](_0x505cac[_0x61b5('0x17')],function(_0x2d5243){return{'model':db[_0x2d5243[_0x61b5('0x1d')]],'as':_0x2d5243['as'],'attributes':_0x2d5243['attributes']};}):[]};}):[]};}):[]:[]})[_0x61b5('0xa')](function(_0x2a06c8){logger[_0x61b5('0x19')](_0x61b5('0x1b'),_0xcf4dfa);logger[_0x61b5('0xd')](_0x61b5('0x1b'),_0xcf4dfa,JSON[_0x61b5('0x1a')](_0x2a06c8));_0x23400d(_0x2a06c8);})['catch'](function(_0x27e3d1){logger[_0x61b5('0xf')]('ShowDeskAccount',_0x27e3d1[_0x61b5('0x10')],_0xcf4dfa);_0x2dce6b(_0x266cc6[_0x61b5('0xf')](0x1f4,_0x27e3d1['message']));});});}; \ No newline at end of file +var _0xeeed=['DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug'];(function(_0x147ee3,_0x3ed8c7){var _0x343a7f=function(_0x19e955){while(--_0x19e955){_0x147ee3['push'](_0x147ee3['shift']());}};_0x343a7f(++_0x3ed8c7);}(_0xeeed,0x161));var _0xdeee=function(_0x364d24,_0x41a4c5){_0x364d24=_0x364d24-0x0;var _0x2b79c4=_0xeeed[_0x364d24];return _0x2b79c4;};'use strict';var _=require(_0xdeee('0x0'));var util=require('util');var moment=require(_0xdeee('0x1'));var BPromise=require(_0xdeee('0x2'));var rs=require(_0xdeee('0x3'));var fs=require('fs');var Redis=require(_0xdeee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdeee('0x5'));var logger=require(_0xdeee('0x6'))(_0xdeee('0x7'));var config=require(_0xdeee('0x8'));var jayson=require(_0xdeee('0x9'));var client=jayson[_0xdeee('0xa')][_0xdeee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46f793,_0x36294e,_0x525074){return new BPromise(function(_0x1b68a4,_0x562d24){return client[_0xdeee('0xc')](_0x46f793,_0x525074)[_0xdeee('0xd')](function(_0x59364f){logger[_0xdeee('0xe')](_0xdeee('0xf'),_0x36294e,'request\x20sent');logger[_0xdeee('0x10')](_0xdeee('0x11'),_0x36294e,_0xdeee('0x12'),JSON[_0xdeee('0x13')](_0x59364f));if(_0x59364f['error']){if(_0x59364f[_0xdeee('0x14')][_0xdeee('0x15')]===0x1f4){logger[_0xdeee('0x14')](_0xdeee('0xf'),_0x36294e,_0x59364f[_0xdeee('0x14')][_0xdeee('0x16')]);return _0x562d24(_0x59364f['error'][_0xdeee('0x16')]);}logger[_0xdeee('0x14')](_0xdeee('0xf'),_0x36294e,_0x59364f[_0xdeee('0x14')]['message']);return _0x1b68a4(_0x59364f[_0xdeee('0x14')][_0xdeee('0x16')]);}else{logger[_0xdeee('0xe')](_0xdeee('0xf'),_0x36294e,_0xdeee('0x12'));_0x1b68a4(_0x59364f[_0xdeee('0x17')]['message']);}})[_0xdeee('0x18')](function(_0x4f82d2){logger[_0xdeee('0x14')]('DeskAccount,\x20%s,\x20%s',_0x36294e,_0x4f82d2);_0x562d24(_0x4f82d2);});});}exports[_0xdeee('0x19')]=function(_0x22b44b){var _0x31aa55=this;return new Promise(function(_0x3bff5c,_0x3acfcc){return db[_0xdeee('0x1a')][_0xdeee('0x1b')]({'raw':_0x22b44b[_0xdeee('0x1c')]?_0x22b44b['options'][_0xdeee('0x1d')]===undefined?!![]:![]:!![],'where':_0x22b44b['options']?_0x22b44b[_0xdeee('0x1c')][_0xdeee('0x1e')]||null:null,'attributes':_0x22b44b[_0xdeee('0x1c')]?_0x22b44b[_0xdeee('0x1c')]['attributes']||null:null,'limit':_0x22b44b[_0xdeee('0x1c')]?_0x22b44b[_0xdeee('0x1c')][_0xdeee('0x1f')]||null:null,'include':_0x22b44b[_0xdeee('0x1c')]?_0x22b44b[_0xdeee('0x1c')][_0xdeee('0x20')]?_[_0xdeee('0x21')](_0x22b44b['options'][_0xdeee('0x20')],function(_0x258247){return{'model':db[_0x258247[_0xdeee('0x22')]],'as':_0x258247['as'],'attributes':_0x258247[_0xdeee('0x23')],'include':_0x258247[_0xdeee('0x20')]?_['map'](_0x258247[_0xdeee('0x20')],function(_0x22f687){return{'model':db[_0x22f687[_0xdeee('0x22')]],'as':_0x22f687['as'],'attributes':_0x22f687[_0xdeee('0x23')],'include':_0x22f687[_0xdeee('0x20')]?_['map'](_0x22f687[_0xdeee('0x20')],function(_0x31b999){return{'model':db[_0x31b999['model']],'as':_0x31b999['as'],'attributes':_0x31b999['attributes']};}):[]};}):[]};}):[]:[]})[_0xdeee('0xd')](function(_0x4aa7a8){logger[_0xdeee('0xe')](_0xdeee('0x19'),_0x22b44b);logger[_0xdeee('0x10')](_0xdeee('0x19'),_0x22b44b,JSON[_0xdeee('0x13')](_0x4aa7a8));_0x3bff5c(_0x4aa7a8);})['catch'](function(_0x2b6077){logger['error']('GetDeskAccount',_0x2b6077['message'],_0x22b44b);_0x3acfcc(_0x31aa55[_0xdeee('0x14')](0x1f4,_0x2b6077[_0xdeee('0x16')]));});});};exports['ShowDeskAccount']=function(_0x5e0bf4){var _0x32e50a=this;return new Promise(function(_0x375065,_0x20cc53){return db['DeskAccount'][_0xdeee('0x24')]({'raw':_0x5e0bf4[_0xdeee('0x1c')]?_0x5e0bf4[_0xdeee('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5e0bf4[_0xdeee('0x1c')]?_0x5e0bf4[_0xdeee('0x1c')][_0xdeee('0x1e')]||null:null,'attributes':_0x5e0bf4[_0xdeee('0x1c')]?_0x5e0bf4[_0xdeee('0x1c')][_0xdeee('0x23')]||null:null,'include':_0x5e0bf4['options']?_0x5e0bf4[_0xdeee('0x1c')]['include']?_[_0xdeee('0x21')](_0x5e0bf4[_0xdeee('0x1c')]['include'],function(_0x31188a){return{'model':db[_0x31188a[_0xdeee('0x22')]],'as':_0x31188a['as'],'attributes':_0x31188a[_0xdeee('0x23')],'include':_0x31188a[_0xdeee('0x20')]?_[_0xdeee('0x21')](_0x31188a[_0xdeee('0x20')],function(_0x3c0081){return{'model':db[_0x3c0081['model']],'as':_0x3c0081['as'],'attributes':_0x3c0081[_0xdeee('0x23')],'include':_0x3c0081['include']?_[_0xdeee('0x21')](_0x3c0081['include'],function(_0x41a7a3){return{'model':db[_0x41a7a3[_0xdeee('0x22')]],'as':_0x41a7a3['as'],'attributes':_0x41a7a3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5256fc){logger[_0xdeee('0xe')]('ShowDeskAccount',_0x5e0bf4);logger[_0xdeee('0x10')]('ShowDeskAccount',_0x5e0bf4,JSON[_0xdeee('0x13')](_0x5256fc));_0x375065(_0x5256fc);})[_0xdeee('0x18')](function(_0x3b85bc){logger[_0xdeee('0x14')]('ShowDeskAccount',_0x3b85bc[_0xdeee('0x16')],_0x5e0bf4);_0x20cc53(_0x32e50a['error'](0x1f4,_0x3b85bc['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 6bb321a..2673193 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 _0xfb48=['/:id/subjects','/:id/descriptions','getTags','post','create','setTags','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','/:id/fields','isAuthenticated'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xfb48,0x17a));var _0x8fb4=function(_0x4abb65,_0x1dafae){_0x4abb65=_0x4abb65-0x0;var _0xaa7ae9=_0xfb48[_0x4abb65];return _0xaa7ae9;};'use strict';var multer=require(_0x8fb4('0x0'));var util=require(_0x8fb4('0x1'));var path=require(_0x8fb4('0x2'));var timeout=require(_0x8fb4('0x3'));var express=require('express');var router=express[_0x8fb4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8fb4('0x5'));var interaction=require(_0x8fb4('0x6'));var config=require(_0x8fb4('0x7'));var controller=require('./intDeskConfiguration.controller');router[_0x8fb4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8fb4('0x8')](_0x8fb4('0x9'),auth['isAuthenticated'](),controller[_0x8fb4('0xa')]);router['get'](_0x8fb4('0xb'),auth[_0x8fb4('0xc')](),controller['getFields']);router['get'](_0x8fb4('0xd'),auth[_0x8fb4('0xc')](),controller['getSubjects']);router[_0x8fb4('0x8')](_0x8fb4('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x8fb4('0xf')]);router[_0x8fb4('0x10')]('/',auth[_0x8fb4('0xc')](),controller[_0x8fb4('0x11')]);router[_0x8fb4('0x10')]('/:id/tags',auth[_0x8fb4('0xc')](),controller[_0x8fb4('0x12')]);router['put']('/:id',auth[_0x8fb4('0xc')](),controller[_0x8fb4('0x13')]);router[_0x8fb4('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8fb4('0x15')]);module[_0x8fb4('0x16')]=router; \ No newline at end of file +var _0xf5d9=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','delete'];(function(_0x3619,_0x1ac6b9){var _0x490897=function(_0x1ead4f){while(--_0x1ead4f){_0x3619['push'](_0x3619['shift']());}};_0x490897(++_0x1ac6b9);}(_0xf5d9,0x72));var _0x9f5d=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xf5d9[_0x377a6e];return _0x37f751;};'use strict';var multer=require('multer');var util=require(_0x9f5d('0x0'));var path=require(_0x9f5d('0x1'));var timeout=require(_0x9f5d('0x2'));var express=require(_0x9f5d('0x3'));var router=express[_0x9f5d('0x4')]();var fs_extra=require(_0x9f5d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9f5d('0x6'));var config=require(_0x9f5d('0x7'));var controller=require(_0x9f5d('0x8'));router[_0x9f5d('0x9')]('/',auth[_0x9f5d('0xa')](),controller[_0x9f5d('0xb')]);router[_0x9f5d('0x9')](_0x9f5d('0xc'),auth[_0x9f5d('0xa')](),controller[_0x9f5d('0xd')]);router[_0x9f5d('0x9')](_0x9f5d('0xe'),auth[_0x9f5d('0xa')](),controller[_0x9f5d('0xf')]);router[_0x9f5d('0x9')](_0x9f5d('0x10'),auth[_0x9f5d('0xa')](),controller[_0x9f5d('0x11')]);router[_0x9f5d('0x9')](_0x9f5d('0x12'),auth[_0x9f5d('0xa')](),controller[_0x9f5d('0x13')]);router['get'](_0x9f5d('0x14'),auth[_0x9f5d('0xa')](),controller[_0x9f5d('0x15')]);router[_0x9f5d('0x16')]('/',auth[_0x9f5d('0xa')](),controller[_0x9f5d('0x17')]);router['post'](_0x9f5d('0x14'),auth[_0x9f5d('0xa')](),controller[_0x9f5d('0x18')]);router['put'](_0x9f5d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x9f5d('0x19')](_0x9f5d('0xc'),auth['isAuthenticated'](),controller[_0x9f5d('0x1a')]);module[_0x9f5d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index f60c000..b1efbd1 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 _0xb0a0=['sequelize','STRING'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0xb0a0,0x1f2));var _0x0b0a=function(_0x4b6d4d,_0x211c58){_0x4b6d4d=_0x4b6d4d-0x0;var _0x2a109c=_0xb0a0[_0x4b6d4d];return _0x2a109c;};'use strict';var Sequelize=require(_0x0b0a('0x0'));module['exports']={'name':{'type':Sequelize[_0x0b0a('0x1')]},'description':{'type':Sequelize[_0x0b0a('0x1')]}}; \ No newline at end of file +var _0xe2d7=['sequelize','exports','STRING'];(function(_0x103d29,_0x560bc6){var _0x558e81=function(_0xbc2499){while(--_0xbc2499){_0x103d29['push'](_0x103d29['shift']());}};_0x558e81(++_0x560bc6);}(_0xe2d7,0x66));var _0x7e2d=function(_0x32e5a3,_0x237cdb){_0x32e5a3=_0x32e5a3-0x0;var _0x378cc1=_0xe2d7[_0x32e5a3];return _0x378cc1;};'use strict';var Sequelize=require(_0x7e2d('0x0'));module[_0x7e2d('0x1')]={'name':{'type':Sequelize[_0x7e2d('0x2')]},'description':{'type':Sequelize[_0x7e2d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index cfc9020..7b625ca 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 _0xe13a=['client','http','request','then','info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','save','destroy','end','send','render','merge','body','contact','interaction','account','index','DeskConfiguration','rawAttributes','fieldName','type','model','map','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','show','params','keys','length','find','create','update','getFields','DeskField','pick','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','../../config/license/util','../../mysqldb'];(function(_0x49a312,_0x5d752c){var _0xdca857=function(_0xfa2de9){while(--_0xfa2de9){_0x49a312['push'](_0x49a312['shift']());}};_0xdca857(++_0x5d752c);}(_0xe13a,0x178));var _0xae13=function(_0x26ffd2,_0x1fdf7c){_0x26ffd2=_0x26ffd2-0x0;var _0xafdd11=_0xe13a[_0x26ffd2];return _0xafdd11;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xae13('0x0'));var zipdir=require(_0xae13('0x1'));var jsonpatch=require(_0xae13('0x2'));var rp=require(_0xae13('0x3'));var moment=require('moment');var BPromise=require(_0xae13('0x4'));var Mustache=require(_0xae13('0x5'));var util=require(_0xae13('0x6'));var path=require(_0xae13('0x7'));var sox=require(_0xae13('0x8'));var csv=require(_0xae13('0x9'));var ejs=require(_0xae13('0xa'));var fs=require('fs');var fs_extra=require(_0xae13('0xb'));var _=require(_0xae13('0xc'));var squel=require('squel');var crypto=require(_0xae13('0xd'));var jsforce=require(_0xae13('0xe'));var deskjs=require(_0xae13('0xf'));var toCsv=require(_0xae13('0x9'));var querystring=require(_0xae13('0x10'));var Papa=require(_0xae13('0x11'));var Redis=require(_0xae13('0x12'));var authService=require(_0xae13('0x13'));var qs=require(_0xae13('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae13('0x15'));var logger=require(_0xae13('0x16'))(_0xae13('0x17'));var utils=require(_0xae13('0x18'));var config=require(_0xae13('0x19'));var licenseUtil=require(_0xae13('0x1a'));var db=require(_0xae13('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xae13('0x1c')][_0xae13('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5c61bb,_0x589803,_0x506411,_0x50f7c4){return new BPromise(function(_0x52484b,_0x26ff3e){var _0x148186=_0x50f7c4||client;return _0x148186[_0xae13('0x1e')](_0x5c61bb,_0x506411)[_0xae13('0x1f')](function(_0x537889){logger[_0xae13('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x589803,_0xae13('0x21'));logger['debug'](_0xae13('0x22'),_0x589803,_0xae13('0x21'),JSON[_0xae13('0x23')](_0x537889));if(_0x537889[_0xae13('0x24')]){if(_0x537889[_0xae13('0x24')][_0xae13('0x25')]===0x1f4){logger[_0xae13('0x24')](_0xae13('0x26'),_0x589803,_0x537889[_0xae13('0x24')]['message']);return _0x26ff3e(_0x537889[_0xae13('0x24')]['message']);}logger[_0xae13('0x24')](_0xae13('0x26'),_0x589803,_0x537889['error'][_0xae13('0x27')]);return _0x52484b(_0x537889[_0xae13('0x24')][_0xae13('0x27')]);}else{logger[_0xae13('0x20')](_0xae13('0x26'),_0x589803,_0xae13('0x21'));_0x52484b(_0x537889['result']['message']);}})[_0xae13('0x28')](function(_0x290fb9){logger['error'](_0xae13('0x26'),_0x589803,_0x290fb9);_0x26ff3e(_0x290fb9);});});}function respondWithStatusCode(_0x519a37,_0x13c2de){_0x13c2de=_0x13c2de||0xcc;return function(_0x194437){if(_0x194437){return _0x519a37[_0xae13('0x29')](_0x13c2de);}return _0x519a37['status'](_0x13c2de)['end']();};}function respondWithResult(_0x4e38c3,_0x4edb8c){_0x4edb8c=_0x4edb8c||0xc8;return function(_0xc5e6a7){if(_0xc5e6a7){return _0x4e38c3[_0xae13('0x2a')](_0x4edb8c)['json'](_0xc5e6a7);}};}function respondWithFilteredResult(_0x370874,_0x517e71){return function(_0x3d0d60){if(_0x3d0d60){var _0x5de054=typeof _0x517e71[_0xae13('0x2b')]===_0xae13('0x2c')&&typeof _0x517e71['limit']===_0xae13('0x2c');var _0x370ee0=_0x3d0d60[_0xae13('0x2d')];var _0x306dfb=_0x5de054?0x0:_0x517e71['offset'];var _0x41ceb7=_0x5de054?_0x3d0d60[_0xae13('0x2d')]:_0x517e71[_0xae13('0x2b')]+_0x517e71[_0xae13('0x2e')];var _0x742759;if(_0x41ceb7>=_0x370ee0){_0x41ceb7=_0x370ee0;_0x742759=0xc8;}else{_0x742759=0xce;}_0x370874[_0xae13('0x2a')](_0x742759);return _0x370874[_0xae13('0x2f')]('Content-Range',_0x306dfb+'-'+_0x41ceb7+'/'+_0x370ee0)[_0xae13('0x30')](_0x3d0d60);}return null;};}function patchUpdates(_0x591f94){return function(_0xf6289c){try{jsonpatch[_0xae13('0x31')](_0xf6289c,_0x591f94,!![]);}catch(_0x2dc2af){return BPromise[_0xae13('0x32')](_0x2dc2af);}return _0xf6289c[_0xae13('0x33')]();};}function saveUpdates(_0x39718f,_0x11c2ba){return function(_0x48f0f6){if(_0x48f0f6){return _0x48f0f6['update'](_0x39718f)[_0xae13('0x1f')](function(_0x233896){return _0x233896;});}return null;};}function removeEntity(_0xb3764d,_0x3710d6){return function(_0x3d4ffd){if(_0x3d4ffd){return _0x3d4ffd[_0xae13('0x34')]()[_0xae13('0x1f')](function(){_0xb3764d[_0xae13('0x2a')](0xcc)[_0xae13('0x35')]();});}};}function handleEntityNotFound(_0x23f9d7,_0x5f1aeb){return function(_0x1a83d7){if(!_0x1a83d7){_0x23f9d7[_0xae13('0x29')](0x194);}return _0x1a83d7;};}function handleError(_0x469a81,_0x597001){_0x597001=_0x597001||0x1f4;return function(_0x53b5f6){logger['error'](_0x53b5f6['stack']);if(_0x53b5f6['name']){delete _0x53b5f6['name'];}_0x469a81[_0xae13('0x2a')](_0x597001)[_0xae13('0x36')](_0x53b5f6);};}function getMustacheRender(_0x34a801,_0x5bb32a){return Mustache[_0xae13('0x37')](_0x34a801,_[_0xae13('0x38')](_0x5bb32a[_0xae13('0x39')],{'contact':_0x5bb32a[_0xae13('0x3a')],'message':_0x5bb32a[_0xae13('0x27')],'agent':_0x5bb32a['agent'],'interaction':_0x5bb32a[_0xae13('0x3b')],'account':_0x5bb32a[_0xae13('0x3c')]}))||'';}exports[_0xae13('0x3d')]=function(_0x535b0b,_0x5f0870){var _0x257268={},_0xd7006d={},_0x120346={'count':0x0,'rows':[]};var _0x3c3202=_['map'](db[_0xae13('0x3e')][_0xae13('0x3f')],function(_0x538283){return{'name':_0x538283[_0xae13('0x40')],'type':_0x538283[_0xae13('0x41')]['key']};});_0xd7006d[_0xae13('0x42')]=_[_0xae13('0x43')](_0x3c3202,_0xae13('0x44'));_0xd7006d[_0xae13('0x45')]=_['keys'](_0x535b0b[_0xae13('0x45')]);_0xd7006d[_0xae13('0x46')]=_[_0xae13('0x47')](_0xd7006d[_0xae13('0x42')],_0xd7006d['query']);_0x257268[_0xae13('0x48')]=_[_0xae13('0x47')](_0xd7006d[_0xae13('0x42')],qs[_0xae13('0x49')](_0x535b0b['query']['fields']));_0x257268[_0xae13('0x48')]=_0x257268[_0xae13('0x48')]['length']?_0x257268[_0xae13('0x48')]:_0xd7006d['model'];if(!_0x535b0b[_0xae13('0x45')][_0xae13('0x4a')](_0xae13('0x4b'))){_0x257268['limit']=qs[_0xae13('0x2e')](_0x535b0b[_0xae13('0x45')][_0xae13('0x2e')]);_0x257268[_0xae13('0x2b')]=qs['offset'](_0x535b0b[_0xae13('0x45')][_0xae13('0x2b')]);}_0x257268[_0xae13('0x4c')]=qs[_0xae13('0x4d')](_0x535b0b[_0xae13('0x45')][_0xae13('0x4d')]);_0x257268[_0xae13('0x4e')]=qs[_0xae13('0x46')](_['pick'](_0x535b0b[_0xae13('0x45')],_0xd7006d['filters']),_0x3c3202);if(_0x535b0b[_0xae13('0x45')][_0xae13('0x4f')]){_0x257268[_0xae13('0x4e')]=_[_0xae13('0x38')](_0x257268['where'],{'$or':_[_0xae13('0x43')](_0x3c3202,function(_0x54891d){if(_0x54891d[_0xae13('0x41')]!==_0xae13('0x50')){var _0x5118da={};_0x5118da[_0x54891d[_0xae13('0x44')]]={'$like':'%'+_0x535b0b[_0xae13('0x45')][_0xae13('0x4f')]+'%'};return _0x5118da;}})});}_0x257268=_[_0xae13('0x38')]({},_0x257268,_0x535b0b[_0xae13('0x51')]);var _0x31934b={'where':_0x257268['where']};return db[_0xae13('0x3e')][_0xae13('0x2d')](_0x31934b)[_0xae13('0x1f')](function(_0x3dbfb7){_0x120346[_0xae13('0x2d')]=_0x3dbfb7;if(_0x535b0b['query'][_0xae13('0x52')]){_0x257268[_0xae13('0x53')]=[{'all':!![]}];}return db[_0xae13('0x3e')]['findAll'](_0x257268);})['then'](function(_0x498db2){_0x120346['rows']=_0x498db2;return _0x120346;})[_0xae13('0x1f')](respondWithFilteredResult(_0x5f0870,_0x257268))['catch'](handleError(_0x5f0870,null));};exports[_0xae13('0x54')]=function(_0x5554a6,_0x1e609d){var _0x24531f={'raw':![],'where':{'id':_0x5554a6[_0xae13('0x55')]['id']}},_0x3d2f4a={};_0x3d2f4a[_0xae13('0x42')]=_['keys'](db[_0xae13('0x3e')][_0xae13('0x3f')]);_0x3d2f4a['query']=_[_0xae13('0x56')](_0x5554a6[_0xae13('0x45')]);_0x3d2f4a['filters']=_['intersection'](_0x3d2f4a['model'],_0x3d2f4a['query']);_0x24531f[_0xae13('0x48')]=_[_0xae13('0x47')](_0x3d2f4a['model'],qs[_0xae13('0x49')](_0x5554a6[_0xae13('0x45')]['fields']));_0x24531f[_0xae13('0x48')]=_0x24531f[_0xae13('0x48')][_0xae13('0x57')]?_0x24531f[_0xae13('0x48')]:_0x3d2f4a[_0xae13('0x42')];if(_0x5554a6[_0xae13('0x45')][_0xae13('0x52')]){_0x24531f[_0xae13('0x53')]=[{'all':!![]}];}_0x24531f=_[_0xae13('0x38')]({},_0x24531f,_0x5554a6[_0xae13('0x51')]);return db['DeskConfiguration'][_0xae13('0x58')](_0x24531f)[_0xae13('0x1f')](handleEntityNotFound(_0x1e609d,null))[_0xae13('0x1f')](respondWithResult(_0x1e609d,null))['catch'](handleError(_0x1e609d,null));};exports[_0xae13('0x59')]=function(_0x4ed163,_0xcf345d){return db[_0xae13('0x3e')][_0xae13('0x59')](_0x4ed163['body'],{})['then'](respondWithResult(_0xcf345d,0xc9))[_0xae13('0x28')](handleError(_0xcf345d,null));};exports[_0xae13('0x5a')]=function(_0x21d732,_0x3ce119){if(_0x21d732[_0xae13('0x39')]['id']){delete _0x21d732[_0xae13('0x39')]['id'];}return db[_0xae13('0x3e')]['find']({'where':{'id':_0x21d732[_0xae13('0x55')]['id']}})[_0xae13('0x1f')](handleEntityNotFound(_0x3ce119,null))[_0xae13('0x1f')](saveUpdates(_0x21d732[_0xae13('0x39')],null))[_0xae13('0x1f')](respondWithResult(_0x3ce119,null))[_0xae13('0x28')](handleError(_0x3ce119,null));};exports[_0xae13('0x34')]=function(_0x54c748,_0x40439f){return db[_0xae13('0x3e')]['find']({'where':{'id':_0x54c748[_0xae13('0x55')]['id']}})[_0xae13('0x1f')](handleEntityNotFound(_0x40439f,null))[_0xae13('0x1f')](removeEntity(_0x40439f,null))['catch'](handleError(_0x40439f,null));};exports[_0xae13('0x5b')]=function(_0x7fa6c5,_0x50166a,_0x3ee96f){var _0xaabdd3={};var _0x19e673={};var _0x1a839a;var _0x13f508;return db[_0xae13('0x3e')]['findOne']({'where':{'id':_0x7fa6c5['params']['id']}})[_0xae13('0x1f')](handleEntityNotFound(_0x50166a,null))[_0xae13('0x1f')](function(_0x135704){if(_0x135704){_0x1a839a=_0x135704;_0x19e673[_0xae13('0x42')]=_[_0xae13('0x56')](db[_0xae13('0x5c')]['rawAttributes']);_0x19e673[_0xae13('0x45')]=_[_0xae13('0x56')](_0x7fa6c5['query']);_0x19e673['filters']=_['intersection'](_0x19e673[_0xae13('0x42')],_0x19e673[_0xae13('0x45')]);_0xaabdd3[_0xae13('0x48')]=_[_0xae13('0x47')](_0x19e673[_0xae13('0x42')],qs[_0xae13('0x49')](_0x7fa6c5[_0xae13('0x45')][_0xae13('0x49')]));_0xaabdd3[_0xae13('0x48')]=_0xaabdd3[_0xae13('0x48')][_0xae13('0x57')]?_0xaabdd3[_0xae13('0x48')]:_0x19e673[_0xae13('0x42')];_0xaabdd3[_0xae13('0x4c')]=qs[_0xae13('0x4d')](_0x7fa6c5['query'][_0xae13('0x4d')]);_0xaabdd3[_0xae13('0x4e')]=qs['filters'](_[_0xae13('0x5d')](_0x7fa6c5['query'],_0x19e673['filters']));if(_0x7fa6c5[_0xae13('0x45')][_0xae13('0x4f')]){_0xaabdd3[_0xae13('0x4e')]=_[_0xae13('0x38')](_0xaabdd3[_0xae13('0x4e')],{'$or':_[_0xae13('0x43')](_0xaabdd3['attributes'],function(_0x4f9fc1){var _0x25fd2e={};_0x25fd2e[_0x4f9fc1]={'$like':'%'+_0x7fa6c5[_0xae13('0x45')][_0xae13('0x4f')]+'%'};return _0x25fd2e;})});}_0xaabdd3=_['merge']({},_0xaabdd3,_0x7fa6c5[_0xae13('0x51')]);return _0x1a839a['getFields'](_0xaabdd3);}})[_0xae13('0x1f')](function(_0xb29110){if(_0xb29110){_0x13f508=_0xb29110[_0xae13('0x57')];if(!_0x7fa6c5[_0xae13('0x45')][_0xae13('0x4a')]('nolimit')){_0xaabdd3[_0xae13('0x2e')]=qs[_0xae13('0x2e')](_0x7fa6c5['query'][_0xae13('0x2e')]);_0xaabdd3[_0xae13('0x2b')]=qs[_0xae13('0x2b')](_0x7fa6c5[_0xae13('0x45')][_0xae13('0x2b')]);}return _0x1a839a[_0xae13('0x5b')](_0xaabdd3);}})['then'](function(_0x1bec78){if(_0x1bec78){return _0x1bec78?{'count':_0x13f508,'rows':_0x1bec78}:null;}})['then'](respondWithResult(_0x50166a,null))[_0xae13('0x28')](handleError(_0x50166a,null));};exports['getSubjects']=function(_0x2e7648,_0x3e55d2,_0x5b1880){var _0x19c84d={};var _0x235eee={};var _0x2ed2b5;var _0xb00dd6;return db[_0xae13('0x3e')][_0xae13('0x5e')]({'where':{'id':_0x2e7648[_0xae13('0x55')]['id']}})[_0xae13('0x1f')](handleEntityNotFound(_0x3e55d2,null))['then'](function(_0x1fd0c3){if(_0x1fd0c3){_0x2ed2b5=_0x1fd0c3;_0x235eee[_0xae13('0x42')]=_[_0xae13('0x56')](db[_0xae13('0x5c')][_0xae13('0x3f')]);_0x235eee[_0xae13('0x45')]=_[_0xae13('0x56')](_0x2e7648[_0xae13('0x45')]);_0x235eee[_0xae13('0x46')]=_[_0xae13('0x47')](_0x235eee['model'],_0x235eee[_0xae13('0x45')]);_0x19c84d['attributes']=_['intersection'](_0x235eee[_0xae13('0x42')],qs[_0xae13('0x49')](_0x2e7648[_0xae13('0x45')]['fields']));_0x19c84d[_0xae13('0x48')]=_0x19c84d['attributes'][_0xae13('0x57')]?_0x19c84d['attributes']:_0x235eee[_0xae13('0x42')];_0x19c84d[_0xae13('0x4c')]=qs['sort'](_0x2e7648[_0xae13('0x45')][_0xae13('0x4d')]);_0x19c84d['where']=qs['filters'](_[_0xae13('0x5d')](_0x2e7648['query'],_0x235eee['filters']));if(_0x2e7648[_0xae13('0x45')]['filter']){_0x19c84d[_0xae13('0x4e')]=_['merge'](_0x19c84d[_0xae13('0x4e')],{'$or':_[_0xae13('0x43')](_0x19c84d[_0xae13('0x48')],function(_0x88d31){var _0x263ee1={};_0x263ee1[_0x88d31]={'$like':'%'+_0x2e7648[_0xae13('0x45')]['filter']+'%'};return _0x263ee1;})});}_0x19c84d=_[_0xae13('0x38')]({},_0x19c84d,_0x2e7648[_0xae13('0x51')]);return _0x2ed2b5['getSubjects'](_0x19c84d);}})['then'](function(_0x4e6511){if(_0x4e6511){_0xb00dd6=_0x4e6511[_0xae13('0x57')];if(!_0x2e7648['query'][_0xae13('0x4a')]('nolimit')){_0x19c84d['limit']=qs[_0xae13('0x2e')](_0x2e7648[_0xae13('0x45')][_0xae13('0x2e')]);_0x19c84d[_0xae13('0x2b')]=qs[_0xae13('0x2b')](_0x2e7648[_0xae13('0x45')]['offset']);}return _0x2ed2b5[_0xae13('0x5f')](_0x19c84d);}})[_0xae13('0x1f')](function(_0x145373){if(_0x145373){return _0x145373?{'count':_0xb00dd6,'rows':_0x145373}:null;}})[_0xae13('0x1f')](respondWithResult(_0x3e55d2,null))['catch'](handleError(_0x3e55d2,null));};exports[_0xae13('0x60')]=function(_0x1ef79f,_0xb623d2,_0x50bd1b){var _0x4f1a8f={};var _0x3428f5={};var _0x45a73b;var _0x405cc2;return db[_0xae13('0x3e')][_0xae13('0x5e')]({'where':{'id':_0x1ef79f[_0xae13('0x55')]['id']}})[_0xae13('0x1f')](handleEntityNotFound(_0xb623d2,null))[_0xae13('0x1f')](function(_0x4fae2d){if(_0x4fae2d){_0x45a73b=_0x4fae2d;_0x3428f5[_0xae13('0x42')]=_[_0xae13('0x56')](db['DeskField'][_0xae13('0x3f')]);_0x3428f5[_0xae13('0x45')]=_['keys'](_0x1ef79f[_0xae13('0x45')]);_0x3428f5[_0xae13('0x46')]=_['intersection'](_0x3428f5[_0xae13('0x42')],_0x3428f5[_0xae13('0x45')]);_0x4f1a8f[_0xae13('0x48')]=_['intersection'](_0x3428f5['model'],qs[_0xae13('0x49')](_0x1ef79f[_0xae13('0x45')][_0xae13('0x49')]));_0x4f1a8f['attributes']=_0x4f1a8f[_0xae13('0x48')]['length']?_0x4f1a8f[_0xae13('0x48')]:_0x3428f5[_0xae13('0x42')];_0x4f1a8f[_0xae13('0x4c')]=qs[_0xae13('0x4d')](_0x1ef79f[_0xae13('0x45')][_0xae13('0x4d')]);_0x4f1a8f[_0xae13('0x4e')]=qs[_0xae13('0x46')](_[_0xae13('0x5d')](_0x1ef79f[_0xae13('0x45')],_0x3428f5['filters']));if(_0x1ef79f[_0xae13('0x45')]['filter']){_0x4f1a8f[_0xae13('0x4e')]=_[_0xae13('0x38')](_0x4f1a8f[_0xae13('0x4e')],{'$or':_[_0xae13('0x43')](_0x4f1a8f[_0xae13('0x48')],function(_0x716a4c){var _0x3c00a4={};_0x3c00a4[_0x716a4c]={'$like':'%'+_0x1ef79f[_0xae13('0x45')][_0xae13('0x4f')]+'%'};return _0x3c00a4;})});}_0x4f1a8f=_[_0xae13('0x38')]({},_0x4f1a8f,_0x1ef79f['options']);return _0x45a73b[_0xae13('0x60')](_0x4f1a8f);}})[_0xae13('0x1f')](function(_0x2bbd9f){if(_0x2bbd9f){_0x405cc2=_0x2bbd9f[_0xae13('0x57')];if(!_0x1ef79f[_0xae13('0x45')][_0xae13('0x4a')](_0xae13('0x4b'))){_0x4f1a8f[_0xae13('0x2e')]=qs['limit'](_0x1ef79f[_0xae13('0x45')][_0xae13('0x2e')]);_0x4f1a8f[_0xae13('0x2b')]=qs[_0xae13('0x2b')](_0x1ef79f[_0xae13('0x45')][_0xae13('0x2b')]);}return _0x45a73b[_0xae13('0x60')](_0x4f1a8f);}})['then'](function(_0x2eaf8b){if(_0x2eaf8b){return _0x2eaf8b?{'count':_0x405cc2,'rows':_0x2eaf8b}:null;}})[_0xae13('0x1f')](respondWithResult(_0xb623d2,null))[_0xae13('0x28')](handleError(_0xb623d2,null));};exports[_0xae13('0x61')]=function(_0x46090b,_0x2ced73,_0x4a5551){var _0xbcae23={};var _0x17c277={};var _0x1a02dc;var _0x17badb;return db[_0xae13('0x3e')][_0xae13('0x5e')]({'where':{'id':_0x46090b[_0xae13('0x55')]['id']}})[_0xae13('0x1f')](handleEntityNotFound(_0x2ced73,null))[_0xae13('0x1f')](function(_0x1a586d){if(_0x1a586d){_0x1a02dc=_0x1a586d;_0x17c277[_0xae13('0x42')]=_['keys'](db[_0xae13('0x62')][_0xae13('0x3f')]);_0x17c277[_0xae13('0x45')]=_[_0xae13('0x56')](_0x46090b[_0xae13('0x45')]);_0x17c277[_0xae13('0x46')]=_['intersection'](_0x17c277['model'],_0x17c277[_0xae13('0x45')]);_0xbcae23['attributes']=_[_0xae13('0x47')](_0x17c277[_0xae13('0x42')],qs[_0xae13('0x49')](_0x46090b[_0xae13('0x45')]['fields']));_0xbcae23['attributes']=_0xbcae23[_0xae13('0x48')][_0xae13('0x57')]?_0xbcae23[_0xae13('0x48')]:_0x17c277['model'];_0xbcae23['order']=qs[_0xae13('0x4d')](_0x46090b[_0xae13('0x45')][_0xae13('0x4d')]);_0xbcae23[_0xae13('0x4e')]=qs[_0xae13('0x46')](_[_0xae13('0x5d')](_0x46090b['query'],_0x17c277[_0xae13('0x46')]));if(_0x46090b[_0xae13('0x45')][_0xae13('0x4f')]){_0xbcae23['where']=_['merge'](_0xbcae23[_0xae13('0x4e')],{'$or':_[_0xae13('0x43')](_0xbcae23[_0xae13('0x48')],function(_0x43ce15){var _0x234305={};_0x234305[_0x43ce15]={'$like':'%'+_0x46090b[_0xae13('0x45')][_0xae13('0x4f')]+'%'};return _0x234305;})});}_0xbcae23=_['merge']({},_0xbcae23,_0x46090b[_0xae13('0x51')]);return _0x1a02dc[_0xae13('0x61')](_0xbcae23);}})[_0xae13('0x1f')](function(_0x2a6940){if(_0x2a6940){_0x17badb=_0x2a6940['length'];if(!_0x46090b[_0xae13('0x45')][_0xae13('0x4a')](_0xae13('0x4b'))){_0xbcae23[_0xae13('0x2e')]=qs[_0xae13('0x2e')](_0x46090b[_0xae13('0x45')][_0xae13('0x2e')]);_0xbcae23[_0xae13('0x2b')]=qs['offset'](_0x46090b[_0xae13('0x45')][_0xae13('0x2b')]);}return _0x1a02dc[_0xae13('0x61')](_0xbcae23);}})[_0xae13('0x1f')](function(_0x3ce7a5){if(_0x3ce7a5){return _0x3ce7a5?{'count':_0x17badb,'rows':_0x3ce7a5}:null;}})['then'](respondWithResult(_0x2ced73,null))['catch'](handleError(_0x2ced73,null));};exports[_0xae13('0x63')]=function(_0x1954fb,_0x403c09,_0x33921b){if(_0x1954fb[_0xae13('0x39')]['id']){delete _0x1954fb[_0xae13('0x39')]['id'];}return db[_0xae13('0x3e')][_0xae13('0x5e')]({'where':{'id':_0x1954fb['params']['id']}})['then'](handleEntityNotFound(_0x403c09,null))['then'](function(_0x530eb9){if(_0x530eb9){return _0x530eb9['setTags'](_0x1954fb[_0xae13('0x39')][_0xae13('0x64')]||[]);}return null;})['then'](respondWithResult(_0x403c09,null))[_0xae13('0x28')](handleError(_0x403c09,null));}; \ No newline at end of file +var _0x55ca=['DeskField','order','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','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','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','end','sendStatus','stack','name','render','merge','contact','agent','account','index','map','type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','sort','where','pick','filter','VIRTUAL','options','DeskConfiguration','include','findAll','params','rawAttributes','length','create','body','find','getFields','findOne'];(function(_0x3e72b3,_0x549d13){var _0x2a3804=function(_0x58013f){while(--_0x58013f){_0x3e72b3['push'](_0x3e72b3['shift']());}};_0x2a3804(++_0x549d13);}(_0x55ca,0x126));var _0xa55c=function(_0x5a42d9,_0x2d397e){_0x5a42d9=_0x5a42d9-0x0;var _0x190cf2=_0x55ca[_0x5a42d9];return _0x190cf2;};'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'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576044,_0x5a3672,_0x59ea8d,_0x18ee85){return new BPromise(function(_0x3930e4,_0x462cd6){var _0x938bd6=_0x18ee85||client;return _0x938bd6[_0xa55c('0x19')](_0x576044,_0x59ea8d)[_0xa55c('0x1a')](function(_0x4e0b2f){logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,_0xa55c('0x1d'));logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x5a3672,_0xa55c('0x1d'),JSON[_0xa55c('0x20')](_0x4e0b2f));if(_0x4e0b2f[_0xa55c('0x21')]){if(_0x4e0b2f[_0xa55c('0x21')]['code']===0x1f4){logger[_0xa55c('0x21')](_0xa55c('0x1c'),_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x462cd6(_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x3930e4(_0x4e0b2f[_0xa55c('0x21')]['message']);}else{logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,'request\x20sent');_0x3930e4(_0x4e0b2f[_0xa55c('0x23')][_0xa55c('0x22')]);}})[_0xa55c('0x24')](function(_0x1965f1){logger[_0xa55c('0x21')]('DeskConfiguration,\x20%s,\x20%s',_0x5a3672,_0x1965f1);_0x462cd6(_0x1965f1);});});}function respondWithStatusCode(_0x1fc828,_0x504c24){_0x504c24=_0x504c24||0xcc;return function(_0x5ba836){if(_0x5ba836){return _0x1fc828['sendStatus'](_0x504c24);}return _0x1fc828[_0xa55c('0x25')](_0x504c24)['end']();};}function respondWithResult(_0x3ecbe7,_0x190757){_0x190757=_0x190757||0xc8;return function(_0x3f64de){if(_0x3f64de){return _0x3ecbe7[_0xa55c('0x25')](_0x190757)[_0xa55c('0x26')](_0x3f64de);}};}function respondWithFilteredResult(_0x170ba4,_0x1da633){return function(_0x11e7f7){if(_0x11e7f7){var _0x192df2=typeof _0x1da633[_0xa55c('0x27')]===_0xa55c('0x28')&&typeof _0x1da633['limit']===_0xa55c('0x28');var _0x28814f=_0x11e7f7[_0xa55c('0x29')];var _0x906caa=_0x192df2?0x0:_0x1da633['offset'];var _0x1377b0=_0x192df2?_0x11e7f7[_0xa55c('0x29')]:_0x1da633[_0xa55c('0x27')]+_0x1da633[_0xa55c('0x2a')];var _0x45ee8d;if(_0x1377b0>=_0x28814f){_0x1377b0=_0x28814f;_0x45ee8d=0xc8;}else{_0x45ee8d=0xce;}_0x170ba4[_0xa55c('0x25')](_0x45ee8d);return _0x170ba4['set'](_0xa55c('0x2b'),_0x906caa+'-'+_0x1377b0+'/'+_0x28814f)['json'](_0x11e7f7);}return null;};}function patchUpdates(_0x35c9c2){return function(_0x1d730b){try{jsonpatch[_0xa55c('0x2c')](_0x1d730b,_0x35c9c2,!![]);}catch(_0x223813){return BPromise['reject'](_0x223813);}return _0x1d730b[_0xa55c('0x2d')]();};}function saveUpdates(_0x2096ae,_0x331e58){return function(_0x20da31){if(_0x20da31){return _0x20da31[_0xa55c('0x2e')](_0x2096ae)[_0xa55c('0x1a')](function(_0x29748a){return _0x29748a;});}return null;};}function removeEntity(_0x24d44d,_0x2808e9){return function(_0xcbaf2e){if(_0xcbaf2e){return _0xcbaf2e[_0xa55c('0x2f')]()['then'](function(){_0x24d44d['status'](0xcc)[_0xa55c('0x30')]();});}};}function handleEntityNotFound(_0x19733e,_0x4932d0){return function(_0x30fadd){if(!_0x30fadd){_0x19733e[_0xa55c('0x31')](0x194);}return _0x30fadd;};}function handleError(_0x2e9623,_0x1839ac){_0x1839ac=_0x1839ac||0x1f4;return function(_0x30d4f8){logger[_0xa55c('0x21')](_0x30d4f8[_0xa55c('0x32')]);if(_0x30d4f8[_0xa55c('0x33')]){delete _0x30d4f8[_0xa55c('0x33')];}_0x2e9623['status'](_0x1839ac)['send'](_0x30d4f8);};}function getMustacheRender(_0x4b23d3,_0x3fd75f){return Mustache[_0xa55c('0x34')](_0x4b23d3,_[_0xa55c('0x35')](_0x3fd75f['body'],{'contact':_0x3fd75f[_0xa55c('0x36')],'message':_0x3fd75f['message'],'agent':_0x3fd75f[_0xa55c('0x37')],'interaction':_0x3fd75f['interaction'],'account':_0x3fd75f[_0xa55c('0x38')]}))||'';}exports[_0xa55c('0x39')]=function(_0x3c0ec1,_0x4d3eb5){var _0x7c4a47={},_0x30f23b={},_0x47e93c={'count':0x0,'rows':[]};var _0x6f9c4c=_[_0xa55c('0x3a')](db['DeskConfiguration']['rawAttributes'],function(_0x235f6b){return{'name':_0x235f6b['fieldName'],'type':_0x235f6b[_0xa55c('0x3b')][_0xa55c('0x3c')]};});_0x30f23b['model']=_['map'](_0x6f9c4c,'name');_0x30f23b['query']=_[_0xa55c('0x3d')](_0x3c0ec1[_0xa55c('0x3e')]);_0x30f23b[_0xa55c('0x3f')]=_[_0xa55c('0x40')](_0x30f23b[_0xa55c('0x41')],_0x30f23b['query']);_0x7c4a47[_0xa55c('0x42')]=_[_0xa55c('0x40')](_0x30f23b[_0xa55c('0x41')],qs[_0xa55c('0x43')](_0x3c0ec1[_0xa55c('0x3e')][_0xa55c('0x43')]));_0x7c4a47['attributes']=_0x7c4a47[_0xa55c('0x42')]['length']?_0x7c4a47['attributes']:_0x30f23b[_0xa55c('0x41')];if(!_0x3c0ec1[_0xa55c('0x3e')]['hasOwnProperty'](_0xa55c('0x44'))){_0x7c4a47['limit']=qs['limit'](_0x3c0ec1[_0xa55c('0x3e')][_0xa55c('0x2a')]);_0x7c4a47[_0xa55c('0x27')]=qs['offset'](_0x3c0ec1[_0xa55c('0x3e')][_0xa55c('0x27')]);}_0x7c4a47['order']=qs[_0xa55c('0x45')](_0x3c0ec1['query'][_0xa55c('0x45')]);_0x7c4a47[_0xa55c('0x46')]=qs['filters'](_[_0xa55c('0x47')](_0x3c0ec1[_0xa55c('0x3e')],_0x30f23b['filters']),_0x6f9c4c);if(_0x3c0ec1[_0xa55c('0x3e')][_0xa55c('0x48')]){_0x7c4a47[_0xa55c('0x46')]=_['merge'](_0x7c4a47[_0xa55c('0x46')],{'$or':_['map'](_0x6f9c4c,function(_0x2f9717){if(_0x2f9717[_0xa55c('0x3b')]!==_0xa55c('0x49')){var _0x51d663={};_0x51d663[_0x2f9717[_0xa55c('0x33')]]={'$like':'%'+_0x3c0ec1[_0xa55c('0x3e')]['filter']+'%'};return _0x51d663;}})});}_0x7c4a47=_[_0xa55c('0x35')]({},_0x7c4a47,_0x3c0ec1[_0xa55c('0x4a')]);var _0x5d5cf6={'where':_0x7c4a47[_0xa55c('0x46')]};return db[_0xa55c('0x4b')]['count'](_0x5d5cf6)[_0xa55c('0x1a')](function(_0x81cee8){_0x47e93c[_0xa55c('0x29')]=_0x81cee8;if(_0x3c0ec1[_0xa55c('0x3e')]['includeAll']){_0x7c4a47[_0xa55c('0x4c')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xa55c('0x4d')](_0x7c4a47);})[_0xa55c('0x1a')](function(_0x194a79){_0x47e93c['rows']=_0x194a79;return _0x47e93c;})[_0xa55c('0x1a')](respondWithFilteredResult(_0x4d3eb5,_0x7c4a47))[_0xa55c('0x24')](handleError(_0x4d3eb5,null));};exports['show']=function(_0x5be06,_0x34de95){var _0x3822b7={'raw':![],'where':{'id':_0x5be06[_0xa55c('0x4e')]['id']}},_0xcd78c5={};_0xcd78c5[_0xa55c('0x41')]=_[_0xa55c('0x3d')](db[_0xa55c('0x4b')][_0xa55c('0x4f')]);_0xcd78c5[_0xa55c('0x3e')]=_['keys'](_0x5be06[_0xa55c('0x3e')]);_0xcd78c5[_0xa55c('0x3f')]=_[_0xa55c('0x40')](_0xcd78c5['model'],_0xcd78c5[_0xa55c('0x3e')]);_0x3822b7[_0xa55c('0x42')]=_['intersection'](_0xcd78c5[_0xa55c('0x41')],qs['fields'](_0x5be06[_0xa55c('0x3e')][_0xa55c('0x43')]));_0x3822b7[_0xa55c('0x42')]=_0x3822b7[_0xa55c('0x42')][_0xa55c('0x50')]?_0x3822b7['attributes']:_0xcd78c5[_0xa55c('0x41')];if(_0x5be06[_0xa55c('0x3e')]['includeAll']){_0x3822b7[_0xa55c('0x4c')]=[{'all':!![]}];}_0x3822b7=_[_0xa55c('0x35')]({},_0x3822b7,_0x5be06[_0xa55c('0x4a')]);return db[_0xa55c('0x4b')]['find'](_0x3822b7)['then'](handleEntityNotFound(_0x34de95,null))[_0xa55c('0x1a')](respondWithResult(_0x34de95,null))[_0xa55c('0x24')](handleError(_0x34de95,null));};exports[_0xa55c('0x51')]=function(_0x44ac57,_0x54cbde){return db[_0xa55c('0x4b')]['create'](_0x44ac57[_0xa55c('0x52')],{})[_0xa55c('0x1a')](respondWithResult(_0x54cbde,0xc9))[_0xa55c('0x24')](handleError(_0x54cbde,null));};exports[_0xa55c('0x2e')]=function(_0xec640,_0x53b2f7){if(_0xec640[_0xa55c('0x52')]['id']){delete _0xec640['body']['id'];}return db[_0xa55c('0x4b')][_0xa55c('0x53')]({'where':{'id':_0xec640[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x53b2f7,null))[_0xa55c('0x1a')](saveUpdates(_0xec640[_0xa55c('0x52')],null))[_0xa55c('0x1a')](respondWithResult(_0x53b2f7,null))['catch'](handleError(_0x53b2f7,null));};exports[_0xa55c('0x2f')]=function(_0x449e00,_0x2f2d21){return db[_0xa55c('0x4b')][_0xa55c('0x53')]({'where':{'id':_0x449e00['params']['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x2f2d21,null))[_0xa55c('0x1a')](removeEntity(_0x2f2d21,null))[_0xa55c('0x24')](handleError(_0x2f2d21,null));};exports[_0xa55c('0x54')]=function(_0x3cbb63,_0x493f51,_0xdd92c1){var _0x21725b={};var _0x43136b={};var _0x16d9b2;var _0x3ba56d;return db['DeskConfiguration'][_0xa55c('0x55')]({'where':{'id':_0x3cbb63['params']['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x493f51,null))['then'](function(_0x3495a7){if(_0x3495a7){_0x16d9b2=_0x3495a7;_0x43136b['model']=_[_0xa55c('0x3d')](db[_0xa55c('0x56')][_0xa55c('0x4f')]);_0x43136b[_0xa55c('0x3e')]=_[_0xa55c('0x3d')](_0x3cbb63[_0xa55c('0x3e')]);_0x43136b[_0xa55c('0x3f')]=_[_0xa55c('0x40')](_0x43136b[_0xa55c('0x41')],_0x43136b[_0xa55c('0x3e')]);_0x21725b['attributes']=_[_0xa55c('0x40')](_0x43136b[_0xa55c('0x41')],qs['fields'](_0x3cbb63[_0xa55c('0x3e')][_0xa55c('0x43')]));_0x21725b[_0xa55c('0x42')]=_0x21725b[_0xa55c('0x42')][_0xa55c('0x50')]?_0x21725b[_0xa55c('0x42')]:_0x43136b[_0xa55c('0x41')];_0x21725b[_0xa55c('0x57')]=qs['sort'](_0x3cbb63[_0xa55c('0x3e')][_0xa55c('0x45')]);_0x21725b[_0xa55c('0x46')]=qs[_0xa55c('0x3f')](_[_0xa55c('0x47')](_0x3cbb63[_0xa55c('0x3e')],_0x43136b[_0xa55c('0x3f')]));if(_0x3cbb63[_0xa55c('0x3e')][_0xa55c('0x48')]){_0x21725b['where']=_[_0xa55c('0x35')](_0x21725b[_0xa55c('0x46')],{'$or':_[_0xa55c('0x3a')](_0x21725b[_0xa55c('0x42')],function(_0x3a269d){var _0x10e711={};_0x10e711[_0x3a269d]={'$like':'%'+_0x3cbb63[_0xa55c('0x3e')][_0xa55c('0x48')]+'%'};return _0x10e711;})});}_0x21725b=_[_0xa55c('0x35')]({},_0x21725b,_0x3cbb63[_0xa55c('0x4a')]);return _0x16d9b2[_0xa55c('0x54')](_0x21725b);}})['then'](function(_0xe42233){if(_0xe42233){_0x3ba56d=_0xe42233['length'];if(!_0x3cbb63[_0xa55c('0x3e')][_0xa55c('0x58')](_0xa55c('0x44'))){_0x21725b['limit']=qs['limit'](_0x3cbb63[_0xa55c('0x3e')][_0xa55c('0x2a')]);_0x21725b[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x3cbb63['query'][_0xa55c('0x27')]);}return _0x16d9b2[_0xa55c('0x54')](_0x21725b);}})[_0xa55c('0x1a')](function(_0x3a9910){if(_0x3a9910){return _0x3a9910?{'count':_0x3ba56d,'rows':_0x3a9910}:null;}})[_0xa55c('0x1a')](respondWithResult(_0x493f51,null))['catch'](handleError(_0x493f51,null));};exports['getSubjects']=function(_0x3f7fca,_0x38689e,_0x3f9d0a){var _0x36ee32={};var _0x1af9d5={};var _0x4b2032;var _0x14febc;return db[_0xa55c('0x4b')]['findOne']({'where':{'id':_0x3f7fca[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x38689e,null))[_0xa55c('0x1a')](function(_0x4dcb93){if(_0x4dcb93){_0x4b2032=_0x4dcb93;_0x1af9d5[_0xa55c('0x41')]=_[_0xa55c('0x3d')](db[_0xa55c('0x56')][_0xa55c('0x4f')]);_0x1af9d5[_0xa55c('0x3e')]=_['keys'](_0x3f7fca[_0xa55c('0x3e')]);_0x1af9d5[_0xa55c('0x3f')]=_['intersection'](_0x1af9d5['model'],_0x1af9d5[_0xa55c('0x3e')]);_0x36ee32['attributes']=_[_0xa55c('0x40')](_0x1af9d5[_0xa55c('0x41')],qs[_0xa55c('0x43')](_0x3f7fca[_0xa55c('0x3e')][_0xa55c('0x43')]));_0x36ee32[_0xa55c('0x42')]=_0x36ee32[_0xa55c('0x42')][_0xa55c('0x50')]?_0x36ee32[_0xa55c('0x42')]:_0x1af9d5['model'];_0x36ee32[_0xa55c('0x57')]=qs[_0xa55c('0x45')](_0x3f7fca[_0xa55c('0x3e')][_0xa55c('0x45')]);_0x36ee32['where']=qs[_0xa55c('0x3f')](_[_0xa55c('0x47')](_0x3f7fca[_0xa55c('0x3e')],_0x1af9d5[_0xa55c('0x3f')]));if(_0x3f7fca['query']['filter']){_0x36ee32[_0xa55c('0x46')]=_[_0xa55c('0x35')](_0x36ee32[_0xa55c('0x46')],{'$or':_[_0xa55c('0x3a')](_0x36ee32['attributes'],function(_0x55ee0d){var _0x40663={};_0x40663[_0x55ee0d]={'$like':'%'+_0x3f7fca[_0xa55c('0x3e')][_0xa55c('0x48')]+'%'};return _0x40663;})});}_0x36ee32=_[_0xa55c('0x35')]({},_0x36ee32,_0x3f7fca[_0xa55c('0x4a')]);return _0x4b2032[_0xa55c('0x59')](_0x36ee32);}})[_0xa55c('0x1a')](function(_0x51b58e){if(_0x51b58e){_0x14febc=_0x51b58e[_0xa55c('0x50')];if(!_0x3f7fca['query'][_0xa55c('0x58')]('nolimit')){_0x36ee32[_0xa55c('0x2a')]=qs[_0xa55c('0x2a')](_0x3f7fca[_0xa55c('0x3e')][_0xa55c('0x2a')]);_0x36ee32[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x3f7fca[_0xa55c('0x3e')][_0xa55c('0x27')]);}return _0x4b2032['getSubjects'](_0x36ee32);}})['then'](function(_0x14cb74){if(_0x14cb74){return _0x14cb74?{'count':_0x14febc,'rows':_0x14cb74}:null;}})[_0xa55c('0x1a')](respondWithResult(_0x38689e,null))[_0xa55c('0x24')](handleError(_0x38689e,null));};exports[_0xa55c('0x5a')]=function(_0x1622cb,_0x137728,_0x47e8e2){var _0x889869={};var _0x124740={};var _0x301e56;var _0x3b117e;return db[_0xa55c('0x4b')][_0xa55c('0x55')]({'where':{'id':_0x1622cb[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x137728,null))['then'](function(_0x25d09d){if(_0x25d09d){_0x301e56=_0x25d09d;_0x124740[_0xa55c('0x41')]=_[_0xa55c('0x3d')](db[_0xa55c('0x56')][_0xa55c('0x4f')]);_0x124740['query']=_[_0xa55c('0x3d')](_0x1622cb[_0xa55c('0x3e')]);_0x124740['filters']=_['intersection'](_0x124740[_0xa55c('0x41')],_0x124740[_0xa55c('0x3e')]);_0x889869['attributes']=_['intersection'](_0x124740['model'],qs['fields'](_0x1622cb[_0xa55c('0x3e')][_0xa55c('0x43')]));_0x889869[_0xa55c('0x42')]=_0x889869[_0xa55c('0x42')][_0xa55c('0x50')]?_0x889869[_0xa55c('0x42')]:_0x124740['model'];_0x889869[_0xa55c('0x57')]=qs[_0xa55c('0x45')](_0x1622cb[_0xa55c('0x3e')][_0xa55c('0x45')]);_0x889869['where']=qs[_0xa55c('0x3f')](_[_0xa55c('0x47')](_0x1622cb[_0xa55c('0x3e')],_0x124740['filters']));if(_0x1622cb[_0xa55c('0x3e')]['filter']){_0x889869['where']=_[_0xa55c('0x35')](_0x889869[_0xa55c('0x46')],{'$or':_[_0xa55c('0x3a')](_0x889869[_0xa55c('0x42')],function(_0x2544c1){var _0x45d068={};_0x45d068[_0x2544c1]={'$like':'%'+_0x1622cb[_0xa55c('0x3e')]['filter']+'%'};return _0x45d068;})});}_0x889869=_['merge']({},_0x889869,_0x1622cb[_0xa55c('0x4a')]);return _0x301e56[_0xa55c('0x5a')](_0x889869);}})[_0xa55c('0x1a')](function(_0x1f4bc8){if(_0x1f4bc8){_0x3b117e=_0x1f4bc8[_0xa55c('0x50')];if(!_0x1622cb[_0xa55c('0x3e')][_0xa55c('0x58')](_0xa55c('0x44'))){_0x889869[_0xa55c('0x2a')]=qs[_0xa55c('0x2a')](_0x1622cb['query'][_0xa55c('0x2a')]);_0x889869[_0xa55c('0x27')]=qs['offset'](_0x1622cb[_0xa55c('0x3e')]['offset']);}return _0x301e56[_0xa55c('0x5a')](_0x889869);}})[_0xa55c('0x1a')](function(_0x3fe34d){if(_0x3fe34d){return _0x3fe34d?{'count':_0x3b117e,'rows':_0x3fe34d}:null;}})[_0xa55c('0x1a')](respondWithResult(_0x137728,null))[_0xa55c('0x24')](handleError(_0x137728,null));};exports['getTags']=function(_0x22092a,_0x12e516,_0x1f2f86){var _0x376c1f={};var _0x3300a9={};var _0x31287c;var _0x193208;return db['DeskConfiguration']['findOne']({'where':{'id':_0x22092a['params']['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x12e516,null))['then'](function(_0x266014){if(_0x266014){_0x31287c=_0x266014;_0x3300a9[_0xa55c('0x41')]=_[_0xa55c('0x3d')](db[_0xa55c('0x5b')][_0xa55c('0x4f')]);_0x3300a9['query']=_[_0xa55c('0x3d')](_0x22092a['query']);_0x3300a9[_0xa55c('0x3f')]=_[_0xa55c('0x40')](_0x3300a9[_0xa55c('0x41')],_0x3300a9[_0xa55c('0x3e')]);_0x376c1f['attributes']=_[_0xa55c('0x40')](_0x3300a9[_0xa55c('0x41')],qs[_0xa55c('0x43')](_0x22092a[_0xa55c('0x3e')][_0xa55c('0x43')]));_0x376c1f[_0xa55c('0x42')]=_0x376c1f[_0xa55c('0x42')][_0xa55c('0x50')]?_0x376c1f['attributes']:_0x3300a9[_0xa55c('0x41')];_0x376c1f[_0xa55c('0x57')]=qs[_0xa55c('0x45')](_0x22092a[_0xa55c('0x3e')][_0xa55c('0x45')]);_0x376c1f[_0xa55c('0x46')]=qs['filters'](_[_0xa55c('0x47')](_0x22092a['query'],_0x3300a9[_0xa55c('0x3f')]));if(_0x22092a['query'][_0xa55c('0x48')]){_0x376c1f[_0xa55c('0x46')]=_[_0xa55c('0x35')](_0x376c1f['where'],{'$or':_[_0xa55c('0x3a')](_0x376c1f[_0xa55c('0x42')],function(_0x156959){var _0x5133bd={};_0x5133bd[_0x156959]={'$like':'%'+_0x22092a[_0xa55c('0x3e')]['filter']+'%'};return _0x5133bd;})});}_0x376c1f=_[_0xa55c('0x35')]({},_0x376c1f,_0x22092a[_0xa55c('0x4a')]);return _0x31287c['getTags'](_0x376c1f);}})[_0xa55c('0x1a')](function(_0x4d7e6c){if(_0x4d7e6c){_0x193208=_0x4d7e6c[_0xa55c('0x50')];if(!_0x22092a[_0xa55c('0x3e')]['hasOwnProperty'](_0xa55c('0x44'))){_0x376c1f[_0xa55c('0x2a')]=qs['limit'](_0x22092a[_0xa55c('0x3e')][_0xa55c('0x2a')]);_0x376c1f['offset']=qs[_0xa55c('0x27')](_0x22092a['query']['offset']);}return _0x31287c[_0xa55c('0x5c')](_0x376c1f);}})[_0xa55c('0x1a')](function(_0x28a71e){if(_0x28a71e){return _0x28a71e?{'count':_0x193208,'rows':_0x28a71e}:null;}})[_0xa55c('0x1a')](respondWithResult(_0x12e516,null))['catch'](handleError(_0x12e516,null));};exports[_0xa55c('0x5d')]=function(_0x5c08a9,_0x2f1fc7,_0x48004b){if(_0x5c08a9['body']['id']){delete _0x5c08a9['body']['id'];}return db[_0xa55c('0x4b')]['findOne']({'where':{'id':_0x5c08a9['params']['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x2f1fc7,null))[_0xa55c('0x1a')](function(_0x1744ad){if(_0x1744ad){return _0x1744ad[_0xa55c('0x5d')](_0x5c08a9[_0xa55c('0x52')][_0xa55c('0x5e')]||[]);}return null;})[_0xa55c('0x1a')](respondWithResult(_0x2f1fc7,null))[_0xa55c('0x24')](handleError(_0x2f1fc7,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 66b4191..b228ea0 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 _0xd00a=['request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','lodash','util','../../config/logger','moment','bluebird'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0xd00a,0x7f));var _0xad00=function(_0xa4ed5,_0x5c6be2){_0xa4ed5=_0xa4ed5-0x0;var _0xd24744=_0xd00a[_0xa4ed5];return _0xd24744;};'use strict';var _=require(_0xad00('0x0'));var util=require(_0xad00('0x1'));var logger=require(_0xad00('0x2'))('api');var moment=require(_0xad00('0x3'));var BPromise=require(_0xad00('0x4'));var rp=require(_0xad00('0x5'));var fs=require('fs');var path=require(_0xad00('0x6'));var rimraf=require(_0xad00('0x7'));var config=require(_0xad00('0x8'));var attributes=require(_0xad00('0x9'));module[_0xad00('0xa')]=function(_0x4b9319,_0x54e05e){return _0x4b9319['define']('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x200b=['int_desk_configurations','util','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration'];(function(_0x183d0e,_0x1f520f){var _0x278ff8=function(_0x49b6d1){while(--_0x49b6d1){_0x183d0e['push'](_0x183d0e['shift']());}};_0x278ff8(++_0x1f520f);}(_0x200b,0x91));var _0xb200=function(_0x3e03bd,_0x39f41b){_0x3e03bd=_0x3e03bd-0x0;var _0x181b15=_0x200b[_0x3e03bd];return _0x181b15;};'use strict';var _=require('lodash');var util=require(_0xb200('0x0'));var logger=require('../../config/logger')(_0xb200('0x1'));var moment=require(_0xb200('0x2'));var BPromise=require('bluebird');var rp=require(_0xb200('0x3'));var fs=require('fs');var path=require(_0xb200('0x4'));var rimraf=require(_0xb200('0x5'));var config=require(_0xb200('0x6'));var attributes=require(_0xb200('0x7'));module[_0xb200('0x8')]=function(_0x43dda1,_0x137506){return _0x43dda1[_0xb200('0x9')](_0xb200('0xa'),attributes,{'tableName':_0xb200('0xb'),'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 c04a140..629f1da 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 _0xbefe=['request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','DeskConfiguration,\x20%s,\x20%s'];(function(_0x178015,_0x4bcd41){var _0x5ef3c5=function(_0x17c930){while(--_0x17c930){_0x178015['push'](_0x178015['shift']());}};_0x5ef3c5(++_0x4bcd41);}(_0xbefe,0x168));var _0xebef=function(_0x2a0346,_0x2c1300){_0x2a0346=_0x2a0346-0x0;var _0x1f5232=_0xbefe[_0x2a0346];return _0x1f5232;};'use strict';var _=require('lodash');var util=require(_0xebef('0x0'));var moment=require('moment');var BPromise=require(_0xebef('0x1'));var rs=require(_0xebef('0x2'));var fs=require('fs');var Redis=require(_0xebef('0x3'));var db=require(_0xebef('0x4'))['db'];var utils=require(_0xebef('0x5'));var logger=require(_0xebef('0x6'))(_0xebef('0x7'));var config=require(_0xebef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xebef('0x9')][_0xebef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e89ca,_0x4fb4fa,_0x4286bf){return new BPromise(function(_0x2fbd2c,_0x598d6d){return client['request'](_0x3e89ca,_0x4286bf)[_0xebef('0xb')](function(_0xa0a8ef){logger[_0xebef('0xc')](_0xebef('0xd'),_0x4fb4fa,_0xebef('0xe'));logger[_0xebef('0xf')](_0xebef('0x10'),_0x4fb4fa,_0xebef('0xe'),JSON['stringify'](_0xa0a8ef));if(_0xa0a8ef[_0xebef('0x11')]){if(_0xa0a8ef[_0xebef('0x11')][_0xebef('0x12')]===0x1f4){logger[_0xebef('0x11')](_0xebef('0xd'),_0x4fb4fa,_0xa0a8ef['error']['message']);return _0x598d6d(_0xa0a8ef['error']['message']);}logger[_0xebef('0x11')](_0xebef('0xd'),_0x4fb4fa,_0xa0a8ef[_0xebef('0x11')][_0xebef('0x13')]);return _0x2fbd2c(_0xa0a8ef[_0xebef('0x11')][_0xebef('0x13')]);}else{logger['info'](_0xebef('0xd'),_0x4fb4fa,_0xebef('0xe'));_0x2fbd2c(_0xa0a8ef[_0xebef('0x14')][_0xebef('0x13')]);}})[_0xebef('0x15')](function(_0x8e7044){logger[_0xebef('0x11')](_0xebef('0xd'),_0x4fb4fa,_0x8e7044);_0x598d6d(_0x8e7044);});});} \ No newline at end of file +var _0xb469=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','DeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x456be1,_0x248c6e){var _0x43fa66=function(_0x8c0df9){while(--_0x8c0df9){_0x456be1['push'](_0x456be1['shift']());}};_0x43fa66(++_0x248c6e);}(_0xb469,0x13b));var _0x9b46=function(_0x110fa0,_0x395441){_0x110fa0=_0x110fa0-0x0;var _0x1c05ea=_0xb469[_0x110fa0];return _0x1c05ea;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var moment=require(_0x9b46('0x2'));var BPromise=require(_0x9b46('0x3'));var rs=require(_0x9b46('0x4'));var fs=require('fs');var Redis=require(_0x9b46('0x5'));var db=require(_0x9b46('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b46('0x7'))(_0x9b46('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b46('0x9'));var client=jayson[_0x9b46('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b2dd3,_0x5bd834,_0x4c1ed9){return new BPromise(function(_0x34c0de,_0x545b6c){return client[_0x9b46('0xb')](_0x1b2dd3,_0x4c1ed9)[_0x9b46('0xc')](function(_0x43a112){logger['info'](_0x9b46('0xd'),_0x5bd834,'request\x20sent');logger[_0x9b46('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5bd834,_0x9b46('0xf'),JSON['stringify'](_0x43a112));if(_0x43a112[_0x9b46('0x10')]){if(_0x43a112[_0x9b46('0x10')]['code']===0x1f4){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112['error'][_0x9b46('0x11')]);return _0x545b6c(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);return _0x34c0de(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}else{logger[_0x9b46('0x12')](_0x9b46('0xd'),_0x5bd834,_0x9b46('0xf'));_0x34c0de(_0x43a112[_0x9b46('0x13')]['message']);}})['catch'](function(_0x52c1b8){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x52c1b8);_0x545b6c(_0x52c1b8);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 8d2acb6..54a6c81 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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x7a54,0x106));var _0x47a5=function(_0x50d311,_0x53f26f){_0x50d311=_0x50d311-0x0;var _0x7378ca=_0x7a54[_0x50d311];return _0x7378ca;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x7a54,0x106));var _0x47a5=function(_0x1f2199,_0x5caaf4){_0x1f2199=_0x1f2199-0x0;var _0x3e02f7=_0x7a54[_0x1f2199];return _0x3e02f7;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 317317e..2e6755b 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 _0x50fd=['keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x5d06a9,_0x304a55){var _0x607055=function(_0x1a7d3b){while(--_0x1a7d3b){_0x5d06a9['push'](_0x5d06a9['shift']());}};_0x607055(++_0x304a55);}(_0x50fd,0x19c));var _0xd50f=function(_0x13e177,_0x23107e){_0x13e177=_0x13e177-0x0;var _0x5820ad=_0x50fd[_0x13e177];return _0x5820ad;};'use strict';var Sequelize=require(_0xd50f('0x0'));module['exports']={'type':{'type':Sequelize[_0xd50f('0x1')](_0xd50f('0x2'),_0xd50f('0x3'),'customVariable',_0xd50f('0x4'),_0xd50f('0x5')),'defaultValue':_0xd50f('0x2')},'content':{'type':Sequelize[_0xd50f('0x6')]},'key':{'type':Sequelize[_0xd50f('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xd50f('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xd50f('0x6')]},'idField':{'type':Sequelize[_0xd50f('0x6')]},'nameField':{'type':Sequelize[_0xd50f('0x6')]},'customField':{'type':Sequelize[_0xd50f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd50f('0x6')]}}; \ No newline at end of file +var _0x72da=['string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','exports'];(function(_0x4a6815,_0x599828){var _0x152a4e=function(_0x23a87c){while(--_0x23a87c){_0x4a6815['push'](_0x4a6815['shift']());}};_0x152a4e(++_0x599828);}(_0x72da,0x155));var _0xa72d=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x72da[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require('sequelize');module[_0xa72d('0x0')]={'type':{'type':Sequelize['ENUM'](_0xa72d('0x1'),_0xa72d('0x2'),_0xa72d('0x3'),_0xa72d('0x4'),_0xa72d('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa72d('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa72d('0x7')](_0xa72d('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa72d('0x6')]},'nameField':{'type':Sequelize[_0xa72d('0x6')]},'customField':{'type':Sequelize[_0xa72d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa72d('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 0697711..ce5e1a2 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 _0x2fbe=['lodash','crypto','jsforce','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','render','body','contact','agent','interaction','index','DeskField','rawAttributes','fieldName','key','model','map','name','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra'];(function(_0xb4bf8f,_0x120758){var _0x45f1af=function(_0x179317){while(--_0x179317){_0xb4bf8f['push'](_0xb4bf8f['shift']());}};_0x45f1af(++_0x120758);}(_0x2fbe,0x178));var _0xe2fb=function(_0x5b764d,_0x491ae7){_0x5b764d=_0x5b764d-0x0;var _0x101178=_0x2fbe[_0x5b764d];return _0x101178;};'use strict';var emlformat=require(_0xe2fb('0x0'));var rimraf=require(_0xe2fb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe2fb('0x2'));var rp=require(_0xe2fb('0x3'));var moment=require(_0xe2fb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe2fb('0x5'));var sox=require(_0xe2fb('0x6'));var csv=require('to-csv');var ejs=require(_0xe2fb('0x7'));var fs=require('fs');var fs_extra=require(_0xe2fb('0x8'));var _=require(_0xe2fb('0x9'));var squel=require('squel');var crypto=require(_0xe2fb('0xa'));var jsforce=require(_0xe2fb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe2fb('0xc'));var querystring=require('querystring');var Papa=require(_0xe2fb('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe2fb('0xe'));var as=require(_0xe2fb('0xf'));var hardwareService=require(_0xe2fb('0x10'));var logger=require('../../config/logger')(_0xe2fb('0x11'));var utils=require(_0xe2fb('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xe2fb('0x13'));var db=require(_0xe2fb('0x14'))['db'];function respondWithStatusCode(_0x3840df,_0x378d6a){_0x378d6a=_0x378d6a||0xcc;return function(_0x573ecd){if(_0x573ecd){return _0x3840df[_0xe2fb('0x15')](_0x378d6a);}return _0x3840df['status'](_0x378d6a)[_0xe2fb('0x16')]();};}function respondWithResult(_0x35c4a6,_0x57b578){_0x57b578=_0x57b578||0xc8;return function(_0x34be00){if(_0x34be00){return _0x35c4a6[_0xe2fb('0x17')](_0x57b578)[_0xe2fb('0x18')](_0x34be00);}};}function respondWithFilteredResult(_0x54b639,_0x301542){return function(_0x4d5d8f){if(_0x4d5d8f){var _0x2573bc=typeof _0x301542[_0xe2fb('0x19')]===_0xe2fb('0x1a')&&typeof _0x301542[_0xe2fb('0x1b')]===_0xe2fb('0x1a');var _0x18ee09=_0x4d5d8f[_0xe2fb('0x1c')];var _0x386ba3=_0x2573bc?0x0:_0x301542[_0xe2fb('0x19')];var _0x278ec8=_0x2573bc?_0x4d5d8f[_0xe2fb('0x1c')]:_0x301542['offset']+_0x301542[_0xe2fb('0x1b')];var _0x39216c;if(_0x278ec8>=_0x18ee09){_0x278ec8=_0x18ee09;_0x39216c=0xc8;}else{_0x39216c=0xce;}_0x54b639[_0xe2fb('0x17')](_0x39216c);return _0x54b639[_0xe2fb('0x1d')](_0xe2fb('0x1e'),_0x386ba3+'-'+_0x278ec8+'/'+_0x18ee09)[_0xe2fb('0x18')](_0x4d5d8f);}return null;};}function patchUpdates(_0x1cc8e0){return function(_0x261647){try{jsonpatch[_0xe2fb('0x1f')](_0x261647,_0x1cc8e0,!![]);}catch(_0x202791){return BPromise[_0xe2fb('0x20')](_0x202791);}return _0x261647[_0xe2fb('0x21')]();};}function saveUpdates(_0x14bb54,_0x4febe6){return function(_0x562afb){if(_0x562afb){return _0x562afb[_0xe2fb('0x22')](_0x14bb54)[_0xe2fb('0x23')](function(_0x3d87d7){return _0x3d87d7;});}return null;};}function removeEntity(_0x19521b,_0x71fb5e){return function(_0x479e36){if(_0x479e36){return _0x479e36[_0xe2fb('0x24')]()[_0xe2fb('0x23')](function(){_0x19521b[_0xe2fb('0x17')](0xcc)[_0xe2fb('0x16')]();});}};}function handleEntityNotFound(_0x505e01,_0x158b06){return function(_0x28c2b5){if(!_0x28c2b5){_0x505e01[_0xe2fb('0x15')](0x194);}return _0x28c2b5;};}function handleError(_0x1f9b9e,_0x36a6a0){_0x36a6a0=_0x36a6a0||0x1f4;return function(_0x4cb990){logger[_0xe2fb('0x25')](_0x4cb990[_0xe2fb('0x26')]);if(_0x4cb990['name']){delete _0x4cb990['name'];}_0x1f9b9e[_0xe2fb('0x17')](_0x36a6a0)[_0xe2fb('0x27')](_0x4cb990);};}function getMustacheRender(_0x1e2902,_0x4d941c){return Mustache[_0xe2fb('0x28')](_0x1e2902,_['merge'](_0x4d941c[_0xe2fb('0x29')],{'contact':_0x4d941c[_0xe2fb('0x2a')],'message':_0x4d941c['message'],'agent':_0x4d941c[_0xe2fb('0x2b')],'interaction':_0x4d941c[_0xe2fb('0x2c')],'account':_0x4d941c['account']}))||'';}exports[_0xe2fb('0x2d')]=function(_0x1b768a,_0x5f1773){var _0x2b4cdb={},_0x428898={},_0xa17953={'count':0x0,'rows':[]};var _0x3e3769=_['map'](db[_0xe2fb('0x2e')][_0xe2fb('0x2f')],function(_0x5a66ce){return{'name':_0x5a66ce[_0xe2fb('0x30')],'type':_0x5a66ce['type'][_0xe2fb('0x31')]};});_0x428898[_0xe2fb('0x32')]=_[_0xe2fb('0x33')](_0x3e3769,_0xe2fb('0x34'));_0x428898[_0xe2fb('0x35')]=_[_0xe2fb('0x36')](_0x1b768a[_0xe2fb('0x35')]);_0x428898['filters']=_[_0xe2fb('0x37')](_0x428898[_0xe2fb('0x32')],_0x428898[_0xe2fb('0x35')]);_0x2b4cdb[_0xe2fb('0x38')]=_[_0xe2fb('0x37')](_0x428898['model'],qs[_0xe2fb('0x39')](_0x1b768a[_0xe2fb('0x35')][_0xe2fb('0x39')]));_0x2b4cdb['attributes']=_0x2b4cdb[_0xe2fb('0x38')][_0xe2fb('0x3a')]?_0x2b4cdb['attributes']:_0x428898[_0xe2fb('0x32')];if(!_0x1b768a[_0xe2fb('0x35')]['hasOwnProperty'](_0xe2fb('0x3b'))){_0x2b4cdb['limit']=qs[_0xe2fb('0x1b')](_0x1b768a['query'][_0xe2fb('0x1b')]);_0x2b4cdb[_0xe2fb('0x19')]=qs[_0xe2fb('0x19')](_0x1b768a[_0xe2fb('0x35')][_0xe2fb('0x19')]);}_0x2b4cdb['order']=qs[_0xe2fb('0x3c')](_0x1b768a[_0xe2fb('0x35')][_0xe2fb('0x3c')]);_0x2b4cdb[_0xe2fb('0x3d')]=qs['filters'](_['pick'](_0x1b768a[_0xe2fb('0x35')],_0x428898[_0xe2fb('0x3e')]),_0x3e3769);if(_0x1b768a['query']['filter']){_0x2b4cdb[_0xe2fb('0x3d')]=_[_0xe2fb('0x3f')](_0x2b4cdb['where'],{'$or':_[_0xe2fb('0x33')](_0x3e3769,function(_0x4c4913){if(_0x4c4913[_0xe2fb('0x40')]!==_0xe2fb('0x41')){var _0x568c6a={};_0x568c6a[_0x4c4913[_0xe2fb('0x34')]]={'$like':'%'+_0x1b768a[_0xe2fb('0x35')][_0xe2fb('0x42')]+'%'};return _0x568c6a;}})});}_0x2b4cdb=_['merge']({},_0x2b4cdb,_0x1b768a['options']);var _0xe508b6={'where':_0x2b4cdb[_0xe2fb('0x3d')]};return db['DeskField'][_0xe2fb('0x1c')](_0xe508b6)[_0xe2fb('0x23')](function(_0x5dd64c){_0xa17953[_0xe2fb('0x1c')]=_0x5dd64c;if(_0x1b768a[_0xe2fb('0x35')][_0xe2fb('0x43')]){_0x2b4cdb[_0xe2fb('0x44')]=[{'all':!![]}];}return db[_0xe2fb('0x2e')][_0xe2fb('0x45')](_0x2b4cdb);})[_0xe2fb('0x23')](function(_0x11dedb){_0xa17953[_0xe2fb('0x46')]=_0x11dedb;return _0xa17953;})[_0xe2fb('0x23')](respondWithFilteredResult(_0x5f1773,_0x2b4cdb))[_0xe2fb('0x47')](handleError(_0x5f1773,null));};exports[_0xe2fb('0x48')]=function(_0x482245,_0x344fcf){var _0x3ae1da={'raw':!![],'where':{'id':_0x482245[_0xe2fb('0x49')]['id']}},_0x2f7e5d={};_0x2f7e5d[_0xe2fb('0x32')]=_[_0xe2fb('0x36')](db[_0xe2fb('0x2e')][_0xe2fb('0x2f')]);_0x2f7e5d[_0xe2fb('0x35')]=_[_0xe2fb('0x36')](_0x482245[_0xe2fb('0x35')]);_0x2f7e5d['filters']=_[_0xe2fb('0x37')](_0x2f7e5d['model'],_0x2f7e5d[_0xe2fb('0x35')]);_0x3ae1da[_0xe2fb('0x38')]=_['intersection'](_0x2f7e5d['model'],qs[_0xe2fb('0x39')](_0x482245[_0xe2fb('0x35')][_0xe2fb('0x39')]));_0x3ae1da[_0xe2fb('0x38')]=_0x3ae1da[_0xe2fb('0x38')][_0xe2fb('0x3a')]?_0x3ae1da[_0xe2fb('0x38')]:_0x2f7e5d['model'];if(_0x482245[_0xe2fb('0x35')][_0xe2fb('0x43')]){_0x3ae1da[_0xe2fb('0x44')]=[{'all':!![]}];}_0x3ae1da=_[_0xe2fb('0x3f')]({},_0x3ae1da,_0x482245[_0xe2fb('0x4a')]);return db[_0xe2fb('0x2e')][_0xe2fb('0x4b')](_0x3ae1da)[_0xe2fb('0x23')](handleEntityNotFound(_0x344fcf,null))[_0xe2fb('0x23')](respondWithResult(_0x344fcf,null))['catch'](handleError(_0x344fcf,null));};exports[_0xe2fb('0x4c')]=function(_0x1f9498,_0x4dc7be){return db[_0xe2fb('0x2e')][_0xe2fb('0x4c')](_0x1f9498[_0xe2fb('0x29')],{})[_0xe2fb('0x23')](respondWithResult(_0x4dc7be,0xc9))[_0xe2fb('0x47')](handleError(_0x4dc7be,null));};exports['update']=function(_0x218c83,_0x3bbfee){if(_0x218c83[_0xe2fb('0x29')]['id']){delete _0x218c83[_0xe2fb('0x29')]['id'];}return db[_0xe2fb('0x2e')][_0xe2fb('0x4b')]({'where':{'id':_0x218c83['params']['id']}})[_0xe2fb('0x23')](handleEntityNotFound(_0x3bbfee,null))[_0xe2fb('0x23')](saveUpdates(_0x218c83['body'],null))[_0xe2fb('0x23')](respondWithResult(_0x3bbfee,null))[_0xe2fb('0x47')](handleError(_0x3bbfee,null));};exports[_0xe2fb('0x24')]=function(_0x43460b,_0x4ab47b){return db['DeskField'][_0xe2fb('0x4b')]({'where':{'id':_0x43460b['params']['id']}})[_0xe2fb('0x23')](handleEntityNotFound(_0x4ab47b,null))[_0xe2fb('0x23')](removeEntity(_0x4ab47b,null))[_0xe2fb('0x47')](handleError(_0x4ab47b,null));}; \ No newline at end of file +var _0xf8ef=['limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','render','merge','body','contact','message','agent','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','options','DeskField','includeAll','include','findAll','rows','catch','params','find','create','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x33aa74,_0xbfd49b){var _0x59f2fc=function(_0x2f941a){while(--_0x2f941a){_0x33aa74['push'](_0x33aa74['shift']());}};_0x59f2fc(++_0xbfd49b);}(_0xf8ef,0x7e));var _0xff8e=function(_0x542705,_0x58731d){_0x542705=_0x542705-0x0;var _0x164fa1=_0xf8ef[_0x542705];return _0x164fa1;};'use strict';var emlformat=require(_0xff8e('0x0'));var rimraf=require(_0xff8e('0x1'));var zipdir=require(_0xff8e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff8e('0x3'));var moment=require('moment');var BPromise=require(_0xff8e('0x4'));var Mustache=require(_0xff8e('0x5'));var util=require(_0xff8e('0x6'));var path=require('path');var sox=require(_0xff8e('0x7'));var csv=require(_0xff8e('0x8'));var ejs=require(_0xff8e('0x9'));var fs=require('fs');var fs_extra=require(_0xff8e('0xa'));var _=require('lodash');var squel=require(_0xff8e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xff8e('0xc'));var Papa=require(_0xff8e('0xd'));var Redis=require('ioredis');var authService=require(_0xff8e('0xe'));var qs=require(_0xff8e('0xf'));var as=require(_0xff8e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff8e('0x11'))(_0xff8e('0x12'));var utils=require(_0xff8e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xff8e('0x14'));var db=require(_0xff8e('0x15'))['db'];function respondWithStatusCode(_0x2329cf,_0x3b1cc2){_0x3b1cc2=_0x3b1cc2||0xcc;return function(_0x5a3f67){if(_0x5a3f67){return _0x2329cf[_0xff8e('0x16')](_0x3b1cc2);}return _0x2329cf[_0xff8e('0x17')](_0x3b1cc2)[_0xff8e('0x18')]();};}function respondWithResult(_0x2a8136,_0x3c479f){_0x3c479f=_0x3c479f||0xc8;return function(_0x7df4e8){if(_0x7df4e8){return _0x2a8136[_0xff8e('0x17')](_0x3c479f)[_0xff8e('0x19')](_0x7df4e8);}};}function respondWithFilteredResult(_0x8d7b6f,_0x48c8fc){return function(_0x4b1c5b){if(_0x4b1c5b){var _0x273298=typeof _0x48c8fc[_0xff8e('0x1a')]===_0xff8e('0x1b')&&typeof _0x48c8fc[_0xff8e('0x1c')]===_0xff8e('0x1b');var _0x4be5fc=_0x4b1c5b[_0xff8e('0x1d')];var _0x34f159=_0x273298?0x0:_0x48c8fc[_0xff8e('0x1a')];var _0x1bc455=_0x273298?_0x4b1c5b[_0xff8e('0x1d')]:_0x48c8fc['offset']+_0x48c8fc[_0xff8e('0x1c')];var _0x203640;if(_0x1bc455>=_0x4be5fc){_0x1bc455=_0x4be5fc;_0x203640=0xc8;}else{_0x203640=0xce;}_0x8d7b6f[_0xff8e('0x17')](_0x203640);return _0x8d7b6f[_0xff8e('0x1e')]('Content-Range',_0x34f159+'-'+_0x1bc455+'/'+_0x4be5fc)['json'](_0x4b1c5b);}return null;};}function patchUpdates(_0x23adf5){return function(_0x107632){try{jsonpatch[_0xff8e('0x1f')](_0x107632,_0x23adf5,!![]);}catch(_0x7ab966){return BPromise[_0xff8e('0x20')](_0x7ab966);}return _0x107632[_0xff8e('0x21')]();};}function saveUpdates(_0x36b6c7,_0x18c87d){return function(_0x157ccb){if(_0x157ccb){return _0x157ccb[_0xff8e('0x22')](_0x36b6c7)[_0xff8e('0x23')](function(_0x3dc2ab){return _0x3dc2ab;});}return null;};}function removeEntity(_0x213da3,_0x32e5af){return function(_0x2bbe07){if(_0x2bbe07){return _0x2bbe07[_0xff8e('0x24')]()[_0xff8e('0x23')](function(){_0x213da3[_0xff8e('0x17')](0xcc)[_0xff8e('0x18')]();});}};}function handleEntityNotFound(_0x2cfabc,_0x250332){return function(_0x2a4eb7){if(!_0x2a4eb7){_0x2cfabc[_0xff8e('0x16')](0x194);}return _0x2a4eb7;};}function handleError(_0x179aed,_0x43fbf7){_0x43fbf7=_0x43fbf7||0x1f4;return function(_0xc05c7e){logger[_0xff8e('0x25')](_0xc05c7e[_0xff8e('0x26')]);if(_0xc05c7e[_0xff8e('0x27')]){delete _0xc05c7e[_0xff8e('0x27')];}_0x179aed[_0xff8e('0x17')](_0x43fbf7)[_0xff8e('0x28')](_0xc05c7e);};}function getMustacheRender(_0x11bff5,_0x3d1c9a){return Mustache[_0xff8e('0x29')](_0x11bff5,_[_0xff8e('0x2a')](_0x3d1c9a[_0xff8e('0x2b')],{'contact':_0x3d1c9a[_0xff8e('0x2c')],'message':_0x3d1c9a[_0xff8e('0x2d')],'agent':_0x3d1c9a[_0xff8e('0x2e')],'interaction':_0x3d1c9a['interaction'],'account':_0x3d1c9a['account']}))||'';}exports[_0xff8e('0x2f')]=function(_0xd2b46d,_0x319bba){var _0x4af15e={},_0x4b53ac={},_0x6be3e={'count':0x0,'rows':[]};var _0x5650d5=_[_0xff8e('0x30')](db['DeskField'][_0xff8e('0x31')],function(_0x4248ff){return{'name':_0x4248ff[_0xff8e('0x32')],'type':_0x4248ff['type'][_0xff8e('0x33')]};});_0x4b53ac[_0xff8e('0x34')]=_[_0xff8e('0x30')](_0x5650d5,_0xff8e('0x27'));_0x4b53ac[_0xff8e('0x35')]=_[_0xff8e('0x36')](_0xd2b46d[_0xff8e('0x35')]);_0x4b53ac[_0xff8e('0x37')]=_[_0xff8e('0x38')](_0x4b53ac['model'],_0x4b53ac[_0xff8e('0x35')]);_0x4af15e[_0xff8e('0x39')]=_[_0xff8e('0x38')](_0x4b53ac['model'],qs[_0xff8e('0x3a')](_0xd2b46d['query'][_0xff8e('0x3a')]));_0x4af15e[_0xff8e('0x39')]=_0x4af15e[_0xff8e('0x39')][_0xff8e('0x3b')]?_0x4af15e['attributes']:_0x4b53ac['model'];if(!_0xd2b46d[_0xff8e('0x35')][_0xff8e('0x3c')]('nolimit')){_0x4af15e[_0xff8e('0x1c')]=qs['limit'](_0xd2b46d[_0xff8e('0x35')][_0xff8e('0x1c')]);_0x4af15e['offset']=qs[_0xff8e('0x1a')](_0xd2b46d['query'][_0xff8e('0x1a')]);}_0x4af15e[_0xff8e('0x3d')]=qs[_0xff8e('0x3e')](_0xd2b46d[_0xff8e('0x35')][_0xff8e('0x3e')]);_0x4af15e[_0xff8e('0x3f')]=qs[_0xff8e('0x37')](_[_0xff8e('0x40')](_0xd2b46d[_0xff8e('0x35')],_0x4b53ac[_0xff8e('0x37')]),_0x5650d5);if(_0xd2b46d['query'][_0xff8e('0x41')]){_0x4af15e[_0xff8e('0x3f')]=_[_0xff8e('0x2a')](_0x4af15e[_0xff8e('0x3f')],{'$or':_[_0xff8e('0x30')](_0x5650d5,function(_0x25e058){if(_0x25e058[_0xff8e('0x42')]!=='VIRTUAL'){var _0x498992={};_0x498992[_0x25e058['name']]={'$like':'%'+_0xd2b46d[_0xff8e('0x35')][_0xff8e('0x41')]+'%'};return _0x498992;}})});}_0x4af15e=_[_0xff8e('0x2a')]({},_0x4af15e,_0xd2b46d[_0xff8e('0x43')]);var _0x45503e={'where':_0x4af15e[_0xff8e('0x3f')]};return db[_0xff8e('0x44')][_0xff8e('0x1d')](_0x45503e)[_0xff8e('0x23')](function(_0xe84f3b){_0x6be3e[_0xff8e('0x1d')]=_0xe84f3b;if(_0xd2b46d['query'][_0xff8e('0x45')]){_0x4af15e[_0xff8e('0x46')]=[{'all':!![]}];}return db[_0xff8e('0x44')][_0xff8e('0x47')](_0x4af15e);})[_0xff8e('0x23')](function(_0x2d0ca3){_0x6be3e[_0xff8e('0x48')]=_0x2d0ca3;return _0x6be3e;})[_0xff8e('0x23')](respondWithFilteredResult(_0x319bba,_0x4af15e))[_0xff8e('0x49')](handleError(_0x319bba,null));};exports['show']=function(_0x3afe72,_0x51599f){var _0x797286={'raw':!![],'where':{'id':_0x3afe72[_0xff8e('0x4a')]['id']}},_0x500a70={};_0x500a70[_0xff8e('0x34')]=_[_0xff8e('0x36')](db[_0xff8e('0x44')][_0xff8e('0x31')]);_0x500a70[_0xff8e('0x35')]=_['keys'](_0x3afe72[_0xff8e('0x35')]);_0x500a70[_0xff8e('0x37')]=_[_0xff8e('0x38')](_0x500a70[_0xff8e('0x34')],_0x500a70[_0xff8e('0x35')]);_0x797286[_0xff8e('0x39')]=_[_0xff8e('0x38')](_0x500a70[_0xff8e('0x34')],qs['fields'](_0x3afe72[_0xff8e('0x35')][_0xff8e('0x3a')]));_0x797286['attributes']=_0x797286[_0xff8e('0x39')][_0xff8e('0x3b')]?_0x797286[_0xff8e('0x39')]:_0x500a70['model'];if(_0x3afe72['query'][_0xff8e('0x45')]){_0x797286[_0xff8e('0x46')]=[{'all':!![]}];}_0x797286=_['merge']({},_0x797286,_0x3afe72['options']);return db[_0xff8e('0x44')][_0xff8e('0x4b')](_0x797286)['then'](handleEntityNotFound(_0x51599f,null))[_0xff8e('0x23')](respondWithResult(_0x51599f,null))[_0xff8e('0x49')](handleError(_0x51599f,null));};exports['create']=function(_0x32be54,_0x3d822a){return db[_0xff8e('0x44')][_0xff8e('0x4c')](_0x32be54[_0xff8e('0x2b')],{})[_0xff8e('0x23')](respondWithResult(_0x3d822a,0xc9))[_0xff8e('0x49')](handleError(_0x3d822a,null));};exports[_0xff8e('0x22')]=function(_0x44e22a,_0x2866b2){if(_0x44e22a[_0xff8e('0x2b')]['id']){delete _0x44e22a[_0xff8e('0x2b')]['id'];}return db[_0xff8e('0x44')]['find']({'where':{'id':_0x44e22a[_0xff8e('0x4a')]['id']}})[_0xff8e('0x23')](handleEntityNotFound(_0x2866b2,null))[_0xff8e('0x23')](saveUpdates(_0x44e22a['body'],null))[_0xff8e('0x23')](respondWithResult(_0x2866b2,null))['catch'](handleError(_0x2866b2,null));};exports['destroy']=function(_0x272180,_0x532c9a){return db[_0xff8e('0x44')]['find']({'where':{'id':_0x272180[_0xff8e('0x4a')]['id']}})[_0xff8e('0x23')](handleEntityNotFound(_0x532c9a,null))[_0xff8e('0x23')](removeEntity(_0x532c9a,null))[_0xff8e('0x49')](handleError(_0x532c9a,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 99fd1cc..641d07c 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 _0xba9e=['rimraf','./intDeskField.attributes','define','DeskField','int_desk_fields','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x47dcf6,_0x2bd422){var _0x2dfdc5=function(_0x5d0eb8){while(--_0x5d0eb8){_0x47dcf6['push'](_0x47dcf6['shift']());}};_0x2dfdc5(++_0x2bd422);}(_0xba9e,0xa3));var _0xeba9=function(_0x516a5d,_0x2a0609){_0x516a5d=_0x516a5d-0x0;var _0x541796=_0xba9e[_0x516a5d];return _0x541796;};'use strict';var _=require(_0xeba9('0x0'));var util=require(_0xeba9('0x1'));var logger=require(_0xeba9('0x2'))(_0xeba9('0x3'));var moment=require('moment');var BPromise=require(_0xeba9('0x4'));var rp=require(_0xeba9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeba9('0x6'));var config=require('../../config/environment');var attributes=require(_0xeba9('0x7'));module['exports']=function(_0x38477c,_0x59d00e){return _0x38477c[_0xeba9('0x8')](_0xeba9('0x9'),attributes,{'tableName':_0xeba9('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xeba9('0xb'),_0xeba9('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x000c=['request-promise','rimraf','../../config/environment','define','DeskField','int_desk_fields','desk_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5ecbbc,_0x14bc04){var _0x5a7948=function(_0x51bff1){while(--_0x51bff1){_0x5ecbbc['push'](_0x5ecbbc['shift']());}};_0x5a7948(++_0x14bc04);}(_0x000c,0x19b));var _0xc000=function(_0x35e126,_0x1e2ea6){_0x35e126=_0x35e126-0x0;var _0xf2511b=_0x000c[_0x35e126];return _0xf2511b;};'use strict';var _=require(_0xc000('0x0'));var util=require(_0xc000('0x1'));var logger=require(_0xc000('0x2'))('api');var moment=require(_0xc000('0x3'));var BPromise=require(_0xc000('0x4'));var rp=require(_0xc000('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc000('0x6'));var config=require(_0xc000('0x7'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x55e5ca,_0x5bd6e3){return _0x55e5ca[_0xc000('0x8')](_0xc000('0x9'),attributes,{'tableName':_0xc000('0xa'),'paranoid':![],'indexes':[{'name':_0xc000('0xb'),'fields':['idField',_0xc000('0xc')],'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 3204005..0a7fbfb 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 _0xee30=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','catch'];(function(_0x50392a,_0x2d4ed9){var _0x417b0a=function(_0x1e278f){while(--_0x1e278f){_0x50392a['push'](_0x50392a['shift']());}};_0x417b0a(++_0x2d4ed9);}(_0xee30,0x1cc));var _0x0ee3=function(_0x16253e,_0x48a850){_0x16253e=_0x16253e-0x0;var _0x4b043f=_0xee30[_0x16253e];return _0x4b043f;};'use strict';var _=require('lodash');var util=require(_0x0ee3('0x0'));var moment=require(_0x0ee3('0x1'));var BPromise=require(_0x0ee3('0x2'));var rs=require(_0x0ee3('0x3'));var fs=require('fs');var Redis=require(_0x0ee3('0x4'));var db=require(_0x0ee3('0x5'))['db'];var utils=require(_0x0ee3('0x6'));var logger=require(_0x0ee3('0x7'))(_0x0ee3('0x8'));var config=require(_0x0ee3('0x9'));var jayson=require(_0x0ee3('0xa'));var client=jayson[_0x0ee3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfa3792,_0x385251,_0x2a94dc){return new BPromise(function(_0x39fb66,_0x28d81d){return client['request'](_0xfa3792,_0x2a94dc)['then'](function(_0x5d933d){logger[_0x0ee3('0xc')]('DeskField,\x20%s,\x20%s',_0x385251,'request\x20sent');logger[_0x0ee3('0xd')](_0x0ee3('0xe'),_0x385251,_0x0ee3('0xf'),JSON[_0x0ee3('0x10')](_0x5d933d));if(_0x5d933d[_0x0ee3('0x11')]){if(_0x5d933d[_0x0ee3('0x11')][_0x0ee3('0x12')]===0x1f4){logger[_0x0ee3('0x11')](_0x0ee3('0x13'),_0x385251,_0x5d933d[_0x0ee3('0x11')][_0x0ee3('0x14')]);return _0x28d81d(_0x5d933d[_0x0ee3('0x11')][_0x0ee3('0x14')]);}logger[_0x0ee3('0x11')](_0x0ee3('0x13'),_0x385251,_0x5d933d[_0x0ee3('0x11')]['message']);return _0x39fb66(_0x5d933d['error']['message']);}else{logger[_0x0ee3('0xc')]('DeskField,\x20%s,\x20%s',_0x385251,_0x0ee3('0xf'));_0x39fb66(_0x5d933d[_0x0ee3('0x15')][_0x0ee3('0x14')]);}})[_0x0ee3('0x16')](function(_0x3a355f){logger[_0x0ee3('0x11')]('DeskField,\x20%s,\x20%s',_0x385251,_0x3a355f);_0x28d81d(_0x3a355f);});});} \ No newline at end of file +var _0x61bb=['result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3f6227,_0x4a4fb2){var _0x35b489=function(_0x5961ac){while(--_0x5961ac){_0x3f6227['push'](_0x3f6227['shift']());}};_0x35b489(++_0x4a4fb2);}(_0x61bb,0x1b1));var _0xb61b=function(_0x2e2ede,_0x24e9e9){_0x2e2ede=_0x2e2ede-0x0;var _0x41e40a=_0x61bb[_0x2e2ede];return _0x41e40a;};'use strict';var _=require('lodash');var util=require(_0xb61b('0x0'));var moment=require(_0xb61b('0x1'));var BPromise=require(_0xb61b('0x2'));var rs=require(_0xb61b('0x3'));var fs=require('fs');var Redis=require(_0xb61b('0x4'));var db=require(_0xb61b('0x5'))['db'];var utils=require(_0xb61b('0x6'));var logger=require(_0xb61b('0x7'))(_0xb61b('0x8'));var config=require(_0xb61b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb61b('0xa')][_0xb61b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a989b,_0x177110,_0x1df38d){return new BPromise(function(_0x4ed4b1,_0x26559a){return client[_0xb61b('0xc')](_0x3a989b,_0x1df38d)[_0xb61b('0xd')](function(_0x1bf60c){logger['info'](_0xb61b('0xe'),_0x177110,_0xb61b('0xf'));logger[_0xb61b('0x10')](_0xb61b('0x11'),_0x177110,'request\x20sent',JSON[_0xb61b('0x12')](_0x1bf60c));if(_0x1bf60c[_0xb61b('0x13')]){if(_0x1bf60c[_0xb61b('0x13')][_0xb61b('0x14')]===0x1f4){logger[_0xb61b('0x13')](_0xb61b('0xe'),_0x177110,_0x1bf60c['error'][_0xb61b('0x15')]);return _0x26559a(_0x1bf60c[_0xb61b('0x13')][_0xb61b('0x15')]);}logger[_0xb61b('0x13')](_0xb61b('0xe'),_0x177110,_0x1bf60c['error'][_0xb61b('0x15')]);return _0x4ed4b1(_0x1bf60c['error'][_0xb61b('0x15')]);}else{logger[_0xb61b('0x16')](_0xb61b('0xe'),_0x177110,_0xb61b('0xf'));_0x4ed4b1(_0x1bf60c[_0xb61b('0x17')][_0xb61b('0x15')]);}})['catch'](function(_0x439412){logger[_0xb61b('0x13')]('DeskField,\x20%s,\x20%s',_0x177110,_0x439412);_0x26559a(_0x439412);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 226d155..25af785 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 _0xf03a=['express','Router','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','put','update','exports','multer','util','path','connect-timeout'];(function(_0x17394b,_0x150d38){var _0x5959c4=function(_0x1da5ea){while(--_0x1da5ea){_0x17394b['push'](_0x17394b['shift']());}};_0x5959c4(++_0x150d38);}(_0xf03a,0xb9));var _0xaf03=function(_0x4c5b1a,_0x386e40){_0x4c5b1a=_0x4c5b1a-0x0;var _0x1e362c=_0xf03a[_0x4c5b1a];return _0x1e362c;};'use strict';var multer=require(_0xaf03('0x0'));var util=require(_0xaf03('0x1'));var path=require(_0xaf03('0x2'));var timeout=require(_0xaf03('0x3'));var express=require(_0xaf03('0x4'));var router=express[_0xaf03('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaf03('0x6'));var controller=require(_0xaf03('0x7'));router[_0xaf03('0x8')]('/',auth[_0xaf03('0x9')](),controller[_0xaf03('0xa')]);router[_0xaf03('0x8')](_0xaf03('0xb'),auth['isAuthenticated'](),controller[_0xaf03('0xc')]);router[_0xaf03('0x8')]('/:id/configurations',auth[_0xaf03('0x9')](),controller[_0xaf03('0xd')]);router[_0xaf03('0x8')](_0xaf03('0xe'),auth[_0xaf03('0x9')](),controller[_0xaf03('0xf')]);router[_0xaf03('0x10')]('/',auth[_0xaf03('0x9')](),controller[_0xaf03('0x11')]);router['post']('/:id/configurations',auth[_0xaf03('0x9')](),controller['addConfiguration']);router[_0xaf03('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xaf03('0x13')]);router['delete'](_0xaf03('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xaf03('0x14')]=router; \ No newline at end of file +var _0x87bd=['getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','/:id/configurations'];(function(_0x1fba98,_0x2b35a3){var _0x4e0a00=function(_0x28d0b7){while(--_0x28d0b7){_0x1fba98['push'](_0x1fba98['shift']());}};_0x4e0a00(++_0x2b35a3);}(_0x87bd,0xe1));var _0xd87b=function(_0x5a9055,_0x48668d){_0x5a9055=_0x5a9055-0x0;var _0x24a9ae=_0x87bd[_0x5a9055];return _0x24a9ae;};'use strict';var multer=require(_0xd87b('0x0'));var util=require(_0xd87b('0x1'));var path=require(_0xd87b('0x2'));var timeout=require(_0xd87b('0x3'));var express=require(_0xd87b('0x4'));var router=express[_0xd87b('0x5')]();var fs_extra=require(_0xd87b('0x6'));var auth=require(_0xd87b('0x7'));var interaction=require(_0xd87b('0x8'));var config=require(_0xd87b('0x9'));var controller=require(_0xd87b('0xa'));router[_0xd87b('0xb')]('/',auth[_0xd87b('0xc')](),controller['index']);router[_0xd87b('0xb')](_0xd87b('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xd87b('0xe'),auth[_0xd87b('0xc')](),controller[_0xd87b('0xf')]);router[_0xd87b('0xb')](_0xd87b('0x10'),auth[_0xd87b('0xc')](),controller[_0xd87b('0x11')]);router['post']('/',auth[_0xd87b('0xc')](),controller['create']);router[_0xd87b('0x12')](_0xd87b('0xe'),auth[_0xd87b('0xc')](),controller['addConfiguration']);router[_0xd87b('0x13')](_0xd87b('0xd'),auth[_0xd87b('0xc')](),controller[_0xd87b('0x14')]);router[_0xd87b('0x15')](_0xd87b('0xd'),auth[_0xd87b('0xc')](),controller[_0xd87b('0x16')]);module[_0xd87b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index b0d87fb..2bcf99f 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 _0x5542=['STRING','exports'];(function(_0x3a83db,_0x5e6b20){var _0x5269e8=function(_0x3fe911){while(--_0x3fe911){_0x3a83db['push'](_0x3a83db['shift']());}};_0x5269e8(++_0x5e6b20);}(_0x5542,0x1cb));var _0x2554=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0x5542[_0x1d1219];return _0x5b5b89;};'use strict';var Sequelize=require('sequelize');module[_0x2554('0x0')]={'name':{'type':Sequelize[_0x2554('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x2554('0x1')]},'remoteUri':{'type':Sequelize[_0x2554('0x1')]},'tenantId':{'type':Sequelize[_0x2554('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x2554('0x1')]},'serverUrl':{'type':Sequelize[_0x2554('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x2554('0x1')]}}; \ No newline at end of file +var _0x998c=['exports','STRING'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x998c,0x172));var _0xc998=function(_0x19921b,_0x5c0c2d){_0x19921b=_0x19921b-0x0;var _0x273545=_0x998c[_0x19921b];return _0x273545;};'use strict';var Sequelize=require('sequelize');module[_0xc998('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc998('0x1')]},'password':{'type':Sequelize[_0xc998('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xc998('0x1')]},'clientId':{'type':Sequelize[_0xc998('0x1')]},'clientSecret':{'type':Sequelize[_0xc998('0x1')]},'serverUrl':{'type':Sequelize[_0xc998('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index bc37292..b0ebf5e 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 _0x6b11=['moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','end','stack','name','send','render','merge','body','contact','agent','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','find','create','params','getConfigurations','findOne','Dynamics365Configuration','sort','pick','hasOwnProperty','AccountId','getSubjects','channel','Descriptions','Dynamics365Field','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','entitlementidname','entityimage_timestamp','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','password','remoteUri','clientId','clientSecret','slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','username','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','statusCode','test','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','zip-dir','fast-json-patch'];(function(_0x10838b,_0xacdd5b){var _0x298669=function(_0x47e419){while(--_0x47e419){_0x10838b['push'](_0x10838b['shift']());}};_0x298669(++_0xacdd5b);}(_0x6b11,0xd4));var _0x16b1=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0x6b11[_0x10dbf6];return _0x452147;};'use strict';var emlformat=require(_0x16b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x16b1('0x1'));var jsonpatch=require(_0x16b1('0x2'));var rp=require('request-promise');var moment=require(_0x16b1('0x3'));var BPromise=require(_0x16b1('0x4'));var Mustache=require('mustache');var util=require(_0x16b1('0x5'));var path=require(_0x16b1('0x6'));var sox=require(_0x16b1('0x7'));var csv=require(_0x16b1('0x8'));var ejs=require(_0x16b1('0x9'));var fs=require('fs');var fs_extra=require(_0x16b1('0xa'));var _=require(_0x16b1('0xb'));var squel=require('squel');var crypto=require(_0x16b1('0xc'));var jsforce=require(_0x16b1('0xd'));var deskjs=require(_0x16b1('0xe'));var toCsv=require(_0x16b1('0x8'));var querystring=require(_0x16b1('0xf'));var Papa=require('papaparse');var Redis=require(_0x16b1('0x10'));var authService=require(_0x16b1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x16b1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x16b1('0x13'));var utils=require(_0x16b1('0x14'));var config=require(_0x16b1('0x15'));var licenseUtil=require(_0x16b1('0x16'));var db=require(_0x16b1('0x17'))['db'];var integrations=require(_0x16b1('0x18'));var jayson=require(_0x16b1('0x19'));var client=jayson[_0x16b1('0x1a')][_0x16b1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2ca482,_0x5af0d8,_0xfaf7ac,_0x34f7d3){return new BPromise(function(_0xc56d9c,_0x5f0c5d){var _0x4642e0=_0x34f7d3||client;return _0x4642e0['request'](_0x2ca482,_0xfaf7ac)['then'](function(_0x27d351){logger['info'](_0x16b1('0x1c'),_0x5af0d8,_0x16b1('0x1d'));logger[_0x16b1('0x1e')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x5af0d8,_0x16b1('0x1d'),JSON[_0x16b1('0x1f')](_0x27d351));if(_0x27d351['error']){if(_0x27d351[_0x16b1('0x20')][_0x16b1('0x21')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x5af0d8,_0x27d351[_0x16b1('0x20')][_0x16b1('0x22')]);return _0x5f0c5d(_0x27d351[_0x16b1('0x20')]['message']);}logger[_0x16b1('0x20')](_0x16b1('0x1c'),_0x5af0d8,_0x27d351[_0x16b1('0x20')][_0x16b1('0x22')]);return _0xc56d9c(_0x27d351[_0x16b1('0x20')][_0x16b1('0x22')]);}else{logger[_0x16b1('0x23')](_0x16b1('0x1c'),_0x5af0d8,_0x16b1('0x1d'));_0xc56d9c(_0x27d351['result'][_0x16b1('0x22')]);}})[_0x16b1('0x24')](function(_0x128ac3){logger[_0x16b1('0x20')](_0x16b1('0x1c'),_0x5af0d8,_0x128ac3);_0x5f0c5d(_0x128ac3);});});}function respondWithStatusCode(_0x3fd566,_0x16e899){_0x16e899=_0x16e899||0xcc;return function(_0x6b2f83){if(_0x6b2f83){return _0x3fd566[_0x16b1('0x25')](_0x16e899);}return _0x3fd566['status'](_0x16e899)['end']();};}function respondWithResult(_0x362269,_0x1228d8){_0x1228d8=_0x1228d8||0xc8;return function(_0x548f6e){if(_0x548f6e){return _0x362269[_0x16b1('0x26')](_0x1228d8)[_0x16b1('0x27')](_0x548f6e);}};}function respondWithFilteredResult(_0xc2da66,_0x1474f7){return function(_0x28ac57){if(_0x28ac57){var _0x5082a9=typeof _0x1474f7[_0x16b1('0x28')]==='undefined'&&typeof _0x1474f7[_0x16b1('0x29')]===_0x16b1('0x2a');var _0x31ee69=_0x28ac57[_0x16b1('0x2b')];var _0x3a4dfc=_0x5082a9?0x0:_0x1474f7[_0x16b1('0x28')];var _0x906bc9=_0x5082a9?_0x28ac57[_0x16b1('0x2b')]:_0x1474f7[_0x16b1('0x28')]+_0x1474f7[_0x16b1('0x29')];var _0x1a2fd9;if(_0x906bc9>=_0x31ee69){_0x906bc9=_0x31ee69;_0x1a2fd9=0xc8;}else{_0x1a2fd9=0xce;}_0xc2da66['status'](_0x1a2fd9);return _0xc2da66['set'](_0x16b1('0x2c'),_0x3a4dfc+'-'+_0x906bc9+'/'+_0x31ee69)[_0x16b1('0x27')](_0x28ac57);}return null;};}function patchUpdates(_0x1266e7){return function(_0x548055){try{jsonpatch[_0x16b1('0x2d')](_0x548055,_0x1266e7,!![]);}catch(_0x2a48d4){return BPromise['reject'](_0x2a48d4);}return _0x548055[_0x16b1('0x2e')]();};}function saveUpdates(_0x1b2eed,_0x21ed6f){return function(_0x59c6ce){if(_0x59c6ce){return _0x59c6ce[_0x16b1('0x2f')](_0x1b2eed)[_0x16b1('0x30')](function(_0xfb0c0d){return _0xfb0c0d;});}return null;};}function removeEntity(_0x415f7a,_0x4779e4){return function(_0x1bc161){if(_0x1bc161){return _0x1bc161[_0x16b1('0x31')]()[_0x16b1('0x30')](function(){_0x415f7a[_0x16b1('0x26')](0xcc)[_0x16b1('0x32')]();});}};}function handleEntityNotFound(_0x1a660f,_0x5eeb47){return function(_0x53bf7c){if(!_0x53bf7c){_0x1a660f['sendStatus'](0x194);}return _0x53bf7c;};}function handleError(_0x52850a,_0x4108d0){_0x4108d0=_0x4108d0||0x1f4;return function(_0xef9721){logger[_0x16b1('0x20')](_0xef9721[_0x16b1('0x33')]);if(_0xef9721[_0x16b1('0x34')]){delete _0xef9721[_0x16b1('0x34')];}_0x52850a[_0x16b1('0x26')](_0x4108d0)[_0x16b1('0x35')](_0xef9721);};}function getMustacheRender(_0x58c56d,_0x40933c){return Mustache[_0x16b1('0x36')](_0x58c56d,_[_0x16b1('0x37')](_0x40933c[_0x16b1('0x38')],{'contact':_0x40933c[_0x16b1('0x39')],'message':_0x40933c[_0x16b1('0x22')],'agent':_0x40933c[_0x16b1('0x3a')],'interaction':_0x40933c['interaction'],'account':_0x40933c['account']}))||'';}exports[_0x16b1('0x3b')]=function(_0x3ad783,_0x5bc8a2){var _0x2efa4c={},_0x4e7615={},_0x1cd2f3={'count':0x0,'rows':[]};var _0x348527=_[_0x16b1('0x3c')](db[_0x16b1('0x3d')][_0x16b1('0x3e')],function(_0x1eec41){return{'name':_0x1eec41[_0x16b1('0x3f')],'type':_0x1eec41[_0x16b1('0x40')][_0x16b1('0x41')]};});_0x4e7615[_0x16b1('0x42')]=_[_0x16b1('0x3c')](_0x348527,_0x16b1('0x34'));_0x4e7615[_0x16b1('0x43')]=_[_0x16b1('0x44')](_0x3ad783[_0x16b1('0x43')]);_0x4e7615[_0x16b1('0x45')]=_['intersection'](_0x4e7615[_0x16b1('0x42')],_0x4e7615['query']);_0x2efa4c[_0x16b1('0x46')]=_[_0x16b1('0x47')](_0x4e7615['model'],qs[_0x16b1('0x48')](_0x3ad783[_0x16b1('0x43')][_0x16b1('0x48')]));_0x2efa4c['attributes']=_0x2efa4c['attributes'][_0x16b1('0x49')]?_0x2efa4c[_0x16b1('0x46')]:_0x4e7615[_0x16b1('0x42')];if(!_0x3ad783[_0x16b1('0x43')]['hasOwnProperty'](_0x16b1('0x4a'))){_0x2efa4c[_0x16b1('0x29')]=qs[_0x16b1('0x29')](_0x3ad783['query'][_0x16b1('0x29')]);_0x2efa4c[_0x16b1('0x28')]=qs[_0x16b1('0x28')](_0x3ad783['query'][_0x16b1('0x28')]);}_0x2efa4c[_0x16b1('0x4b')]=qs['sort'](_0x3ad783[_0x16b1('0x43')]['sort']);_0x2efa4c[_0x16b1('0x4c')]=qs[_0x16b1('0x45')](_['pick'](_0x3ad783[_0x16b1('0x43')],_0x4e7615[_0x16b1('0x45')]),_0x348527);if(_0x3ad783[_0x16b1('0x43')][_0x16b1('0x4d')]){_0x2efa4c[_0x16b1('0x4c')]=_['merge'](_0x2efa4c[_0x16b1('0x4c')],{'$or':_[_0x16b1('0x3c')](_0x348527,function(_0x1238dd){if(_0x1238dd[_0x16b1('0x40')]!==_0x16b1('0x4e')){var _0xba5394={};_0xba5394[_0x1238dd['name']]={'$like':'%'+_0x3ad783['query'][_0x16b1('0x4d')]+'%'};return _0xba5394;}})});}_0x2efa4c=_[_0x16b1('0x37')]({},_0x2efa4c,_0x3ad783[_0x16b1('0x4f')]);var _0x55a585={'where':_0x2efa4c[_0x16b1('0x4c')]};return db[_0x16b1('0x3d')][_0x16b1('0x2b')](_0x55a585)['then'](function(_0x6ada65){_0x1cd2f3[_0x16b1('0x2b')]=_0x6ada65;if(_0x3ad783['query'][_0x16b1('0x50')]){_0x2efa4c[_0x16b1('0x51')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x16b1('0x52')](_0x2efa4c);})[_0x16b1('0x30')](function(_0x257cf8){_0x1cd2f3[_0x16b1('0x53')]=_0x257cf8;return _0x1cd2f3;})[_0x16b1('0x30')](respondWithFilteredResult(_0x5bc8a2,_0x2efa4c))[_0x16b1('0x24')](handleError(_0x5bc8a2,null));};exports['show']=function(_0x5ca7e9,_0x2e2cc9){var _0x3f2684={'raw':![],'where':{'id':_0x5ca7e9['params']['id']}},_0x46cd8b={};_0x46cd8b['model']=_['keys'](db[_0x16b1('0x3d')][_0x16b1('0x3e')]);_0x46cd8b['query']=_[_0x16b1('0x44')](_0x5ca7e9[_0x16b1('0x43')]);_0x46cd8b['filters']=_[_0x16b1('0x47')](_0x46cd8b[_0x16b1('0x42')],_0x46cd8b['query']);_0x3f2684[_0x16b1('0x46')]=_[_0x16b1('0x47')](_0x46cd8b[_0x16b1('0x42')],qs['fields'](_0x5ca7e9[_0x16b1('0x43')]['fields']));_0x3f2684[_0x16b1('0x46')]=_0x3f2684[_0x16b1('0x46')]['length']?_0x3f2684[_0x16b1('0x46')]:_0x46cd8b[_0x16b1('0x42')];if(_0x5ca7e9[_0x16b1('0x43')]['includeAll']){_0x3f2684['include']=[{'all':!![]}];}_0x3f2684=_[_0x16b1('0x37')]({},_0x3f2684,_0x5ca7e9[_0x16b1('0x4f')]);return db[_0x16b1('0x3d')][_0x16b1('0x54')](_0x3f2684)[_0x16b1('0x30')](handleEntityNotFound(_0x2e2cc9,null))[_0x16b1('0x30')](respondWithResult(_0x2e2cc9,null))[_0x16b1('0x24')](handleError(_0x2e2cc9,null));};exports[_0x16b1('0x55')]=function(_0xb0f461,_0x4b8a0e){return db[_0x16b1('0x3d')][_0x16b1('0x55')](_0xb0f461['body'],{})[_0x16b1('0x30')](respondWithResult(_0x4b8a0e,0xc9))[_0x16b1('0x24')](handleError(_0x4b8a0e,null));};exports[_0x16b1('0x2f')]=function(_0x2ce4d1,_0x363bba){if(_0x2ce4d1[_0x16b1('0x38')]['id']){delete _0x2ce4d1[_0x16b1('0x38')]['id'];}return db[_0x16b1('0x3d')][_0x16b1('0x54')]({'where':{'id':_0x2ce4d1[_0x16b1('0x56')]['id']}})[_0x16b1('0x30')](handleEntityNotFound(_0x363bba,null))['then'](saveUpdates(_0x2ce4d1[_0x16b1('0x38')],null))[_0x16b1('0x30')](respondWithResult(_0x363bba,null))[_0x16b1('0x24')](handleError(_0x363bba,null));};exports[_0x16b1('0x31')]=function(_0xf754ad,_0x35aa70){return db[_0x16b1('0x3d')]['find']({'where':{'id':_0xf754ad[_0x16b1('0x56')]['id']}})[_0x16b1('0x30')](handleEntityNotFound(_0x35aa70,null))[_0x16b1('0x30')](removeEntity(_0x35aa70,null))[_0x16b1('0x24')](handleError(_0x35aa70,null));};exports[_0x16b1('0x57')]=function(_0x20de46,_0x5e148a,_0x5734bd){var _0x173c86={};var _0x3df63a={};var _0x1de1b4;var _0x569147;return db['Dynamics365Account'][_0x16b1('0x58')]({'where':{'id':_0x20de46[_0x16b1('0x56')]['id']}})[_0x16b1('0x30')](handleEntityNotFound(_0x5e148a,null))[_0x16b1('0x30')](function(_0x29dd29){if(_0x29dd29){_0x1de1b4=_0x29dd29;_0x3df63a['model']=_[_0x16b1('0x44')](db[_0x16b1('0x59')][_0x16b1('0x3e')]);_0x3df63a[_0x16b1('0x43')]=_[_0x16b1('0x44')](_0x20de46[_0x16b1('0x43')]);_0x3df63a[_0x16b1('0x45')]=_[_0x16b1('0x47')](_0x3df63a[_0x16b1('0x42')],_0x3df63a[_0x16b1('0x43')]);_0x173c86[_0x16b1('0x46')]=_[_0x16b1('0x47')](_0x3df63a['model'],qs[_0x16b1('0x48')](_0x20de46['query'][_0x16b1('0x48')]));_0x173c86['attributes']=_0x173c86[_0x16b1('0x46')][_0x16b1('0x49')]?_0x173c86['attributes']:_0x3df63a[_0x16b1('0x42')];_0x173c86[_0x16b1('0x4b')]=qs[_0x16b1('0x5a')](_0x20de46['query'][_0x16b1('0x5a')]);_0x173c86[_0x16b1('0x4c')]=qs[_0x16b1('0x45')](_[_0x16b1('0x5b')](_0x20de46[_0x16b1('0x43')],_0x3df63a[_0x16b1('0x45')]));if(_0x20de46[_0x16b1('0x43')][_0x16b1('0x4d')]){_0x173c86[_0x16b1('0x4c')]=_[_0x16b1('0x37')](_0x173c86['where'],{'$or':_[_0x16b1('0x3c')](_0x173c86[_0x16b1('0x46')],function(_0x472c52){var _0x545f91={};_0x545f91[_0x472c52]={'$like':'%'+_0x20de46[_0x16b1('0x43')][_0x16b1('0x4d')]+'%'};return _0x545f91;})});}_0x173c86=_[_0x16b1('0x37')]({},_0x173c86,_0x20de46[_0x16b1('0x4f')]);return _0x1de1b4['getConfigurations'](_0x173c86);}})[_0x16b1('0x30')](function(_0x4061dc){if(_0x4061dc){_0x569147=_0x4061dc['length'];if(!_0x20de46[_0x16b1('0x43')][_0x16b1('0x5c')](_0x16b1('0x4a'))){_0x173c86[_0x16b1('0x29')]=qs['limit'](_0x20de46['query'][_0x16b1('0x29')]);_0x173c86[_0x16b1('0x28')]=qs[_0x16b1('0x28')](_0x20de46['query']['offset']);}return _0x1de1b4['getConfigurations'](_0x173c86);}})['then'](function(_0x1390ba){if(_0x1390ba){return _0x1390ba?{'count':_0x569147,'rows':_0x1390ba}:null;}})[_0x16b1('0x30')](respondWithResult(_0x5e148a,null))[_0x16b1('0x24')](handleError(_0x5e148a,null));};exports['addConfiguration']=function(_0x5e7090,_0x4a33a8,_0xf0ca9c){if(_0x5e7090[_0x16b1('0x38')]['id']){delete _0x5e7090[_0x16b1('0x38')]['id'];}return db['Dynamics365Account'][_0x16b1('0x58')]({'where':{'id':_0x5e7090[_0x16b1('0x56')]['id']}})[_0x16b1('0x30')](handleEntityNotFound(_0x4a33a8,null))['then'](function(_0x3b9ef3){if(_0x3b9ef3){_0x5e7090['body'][_0x16b1('0x5d')]=_0x3b9ef3['id'];_0x5e7090[_0x16b1('0x38')]['Subjects']=integrations[_0x16b1('0x5e')](_0x5e7090[_0x16b1('0x38')][_0x16b1('0x5f')],_0x5e7090[_0x16b1('0x38')]['type']);_0x5e7090['body'][_0x16b1('0x60')]=integrations['getDescriptions'](_0x5e7090['body'][_0x16b1('0x5f')],_0x5e7090[_0x16b1('0x38')][_0x16b1('0x40')]);return db[_0x16b1('0x59')][_0x16b1('0x55')](_0x5e7090[_0x16b1('0x38')],{'include':[{'model':db[_0x16b1('0x61')],'as':'Subjects'},{'model':db[_0x16b1('0x61')],'as':_0x16b1('0x60')}]});}return null;})[_0x16b1('0x30')](respondWithResult(_0x4a33a8,null))[_0x16b1('0x24')](handleError(_0x4a33a8,null));};exports['getFields']=function(_0x1a1fa1,_0x17e386,_0x464516){var _0x18bfae=_0x1a1fa1[_0x16b1('0x43')]['ticketType'];var _0x1ca326=_0x18bfae==='incident'?_0x16b1('0x62'):_0x16b1('0x63');var _0x3407b3='';var _0x54a9ea='';var _0x6f8b3f='';var _0x9f9f04='';var _0x44862d='';var _0x1545d8='';var _0x1bcbb4='';var _0xf09542='';var _0x1404d6=[_0x16b1('0x64'),_0x16b1('0x65'),'customerid',_0x16b1('0x66'),_0x16b1('0x67'),_0x16b1('0x68'),'phonenumber','regardingobjectid','directioncode',_0x16b1('0x69')];var _0x408f35=[_0x16b1('0x6a'),_0x16b1('0x6b'),_0x16b1('0x6c'),'billedserviceunits',_0x16b1('0x6d'),_0x16b1('0x6e'),_0x16b1('0x6f'),_0x16b1('0x70'),_0x16b1('0x71'),_0x16b1('0x72'),'createdbyname',_0x16b1('0x73'),'createdon',_0x16b1('0x74'),_0x16b1('0x75'),'customeridname',_0x16b1('0x76'),'customeridyominame','emailaddress',_0x16b1('0x77'),_0x16b1('0x78'),'entityimage_url',_0x16b1('0x79'),'exchangerate',_0x16b1('0x7a'),_0x16b1('0x7b'),_0x16b1('0x7c'),'influencescore',_0x16b1('0x7d'),_0x16b1('0x7e'),_0x16b1('0x7f'),_0x16b1('0x80'),'modifiedbyexternalpartyyominame',_0x16b1('0x81'),_0x16b1('0x82'),_0x16b1('0x83'),_0x16b1('0x84'),'modifiedonbehalfbyyominame',_0x16b1('0x85'),_0x16b1('0x86'),_0x16b1('0x87'),_0x16b1('0x88'),_0x16b1('0x89'),_0x16b1('0x8a'),_0x16b1('0x8b'),_0x16b1('0x8c'),'parentcaseidname',_0x16b1('0x8d'),_0x16b1('0x8e'),_0x16b1('0x8f'),_0x16b1('0x90'),_0x16b1('0x91'),_0x16b1('0x92'),_0x16b1('0x93'),_0x16b1('0x94'),_0x16b1('0x95'),'responsiblecontactidyominame',_0x16b1('0x96'),_0x16b1('0x97'),_0x16b1('0x98'),_0x16b1('0x99'),_0x16b1('0x9a'),_0x16b1('0x9b'),_0x16b1('0x9c'),_0x16b1('0x9d'),_0x16b1('0x9e'),_0x16b1('0x9f'),_0x16b1('0xa0'),'utcconversiontimezonecode',_0x16b1('0xa1')];var _0xd5b4e3=_0x1404d6[_0x16b1('0xa2')](_0x408f35);return db[_0x16b1('0x3d')]['findOne']({'where':{'id':_0x1a1fa1['params']['id']},'attributes':['id','username',_0x16b1('0xa3'),_0x16b1('0xa4'),'tenantId',_0x16b1('0xa5'),_0x16b1('0xa6')]})[_0x16b1('0x30')](handleEntityNotFound(_0x17e386,null))[_0x16b1('0x30')](function(_0x56d82a){if(_0x56d82a){_0xf09542=_0x56d82a['remoteUri'];var _0x47b779=_0xf09542[_0x16b1('0xa7')](-0x1);if(_0x47b779==='/'){_0xf09542=_0xf09542[_0x16b1('0xa8')](0x0,_0xf09542[_0x16b1('0xa9')](_0x47b779));}_0x1bcbb4=util['format'](_0x16b1('0xaa'),_0xf09542);var _0x4f7c52={'method':_0x16b1('0xab'),'uri':_0x16b1('0xac')+_0x56d82a[_0x16b1('0xad')]+_0x16b1('0xae'),'form':{'client_id':_0x56d82a['clientId'],'resource':_0xf09542,'username':_0x56d82a[_0x16b1('0xaf')],'password':_0x56d82a[_0x16b1('0xa3')],'grant_type':_0x16b1('0xa3'),'client_secret':_0x56d82a[_0x16b1('0xa6')]},'json':!![]};return rp(_0x4f7c52);}})[_0x16b1('0x30')](function(_0x466337){_0x1545d8=_0x466337[_0x16b1('0xb0')];var _0x46d1c2={'method':_0x16b1('0xb1'),'uri':encodeURI(_0x1bcbb4+_0x16b1('0xb2')+_0x1ca326+'\x27'),'headers':{'Authorization':_0x16b1('0xb3')+_0x1545d8,'If-None-Match':null,'OData-Version':_0x16b1('0xb4')},'json':!![]};return rp(_0x46d1c2);})['then'](function(_0x120255){var _0x1d0d06=_0x120255['value'][0x0];var _0x5745b0=_0x1d0d06[_0x16b1('0xb5')];var _0x51dd2a={'method':_0x16b1('0xb1'),'uri':_0x1bcbb4+_0x16b1('0xb6')+_0x5745b0+_0x16b1('0xb7'),'headers':{'Authorization':_0x16b1('0xb3')+_0x1545d8,'If-None-Match':null,'OData-Version':_0x16b1('0xb4')},'json':!![]};return rp(_0x51dd2a);})[_0x16b1('0x30')](function(_0x16b70e){_0x3407b3=_0x16b70e;_0x54a9ea=_0x3407b3[_0x16b1('0xb8')];_0x54a9ea=_[_0x16b1('0xb9')](_0x54a9ea,function(_0x3a4111){return!_0xd5b4e3['includes'](_0x3a4111[_0x16b1('0xba')]);});var _0x3ae65a=[];var _0x583907=[];_0x54a9ea[_0x16b1('0xbb')](function(_0xf589e){if(_0xf589e[_0x16b1('0xbc')]){var _0x365357=_0xf589e['@odata.type'][_0x16b1('0xa8')](_0xf589e[_0x16b1('0xbc')][_0x16b1('0xa9')]('.')+0x1);if(_0x365357===_0x16b1('0xbd')){_0x3ae65a[_0x16b1('0xbe')](getSelectList(_0x1bcbb4,_0x18bfae,_0x583907,_0x3407b3[_0x16b1('0xb5')],_0xf589e['MetadataId'],_0x1545d8));}}});return Promise['all'](_0x3ae65a);})[_0x16b1('0x30')](function(_0x272f3d){_0x6f8b3f=_0x272f3d[0x0];var _0xd27a7b=[];var _0x3630db=[];_0x54a9ea['forEach'](function(_0x50db47){if(!_[_0x16b1('0xbf')](_0x50db47[_0x16b1('0xbc')])){var _0x1e4f75=_0x50db47['@odata.type'][_0x16b1('0xa8')](_0x50db47[_0x16b1('0xbc')][_0x16b1('0xa9')]('.')+0x1);if(_0x1e4f75===_0x16b1('0xc0')){_0xd27a7b['push'](getBooleanList(_0x1bcbb4,_0x18bfae,_0x3630db,_0x3407b3[_0x16b1('0xb5')],_0x50db47[_0x16b1('0xb5')],_0x1545d8));}}});return Promise['all'](_0xd27a7b);})[_0x16b1('0x30')](function(_0x1c16b8){_0x9f9f04=_0x1c16b8[0x0];var _0xce869f=[];var _0x5ca2d6=[];_0x54a9ea[_0x16b1('0xbb')](function(_0x288386){if(_0x288386[_0x16b1('0xbc')]){var _0x54e76d=_0x288386[_0x16b1('0xbc')]['substring'](_0x288386[_0x16b1('0xbc')][_0x16b1('0xa9')]('.')+0x1);if(_0x54e76d===_0x16b1('0xc1')||_0x54e76d==='DoubleAttributeMetadata'||_0x54e76d===_0x16b1('0xc2')||_0x54e76d===_0x16b1('0xc3')||_0x54e76d==='MemoAttributeMetadata'||_0x54e76d===_0x16b1('0xc4')||_0x54e76d===_0x16b1('0xc5')||_0x54e76d===_0x16b1('0xc6')||_0x54e76d==='StateAttributeMetadata'||_0x54e76d===_0x16b1('0xc7')){_0xce869f[_0x16b1('0xbe')](getInputList(_0x1bcbb4,_0x18bfae,_0x54e76d,_0x5ca2d6,_0x3407b3[_0x16b1('0xb5')],_0x288386[_0x16b1('0xb5')],_0x1545d8));}}});return Promise['all'](_0xce869f);})[_0x16b1('0x30')](function(_0x4f02e0){_0x44862d=_0x4f02e0[0x0];var _0x14b9e6=_0x6f8b3f[_0x16b1('0xa2')](_0x9f9f04)['concat'](_0x44862d);var _0x51542a={'count':_0x14b9e6[_0x16b1('0x49')],'rows':_0x14b9e6};return _0x51542a;})['then'](respondWithResult(_0x17e386,null))[_0x16b1('0x24')](function(_0x2ed32a){var _0x2cf02f=_0x1a1fa1['query']['test']?0x1f4:_0x2ed32a[_0x16b1('0xc8')]||0x1f4;logger[_0x16b1('0x20')](_0x2ed32a[_0x16b1('0x33')]);delete _0x2ed32a[_0x16b1('0x34')];if(_0x2cf02f===0x191){_0x2cf02f=0x190;}_0x17e386[_0x16b1('0x26')](_0x2cf02f)['send'](_0x1a1fa1[_0x16b1('0x43')][_0x16b1('0xc9')]?{'message':_0x16b1('0xca'),'statusCode':_0x2ed32a[_0x16b1('0xc8')]}:_0x2ed32a);});};function getSelectList(_0x517617,_0x9f1a17,_0x4bf5ca,_0x5d7a74,_0x458c3a,_0x249284){var _0xb58c96={'method':'GET','uri':_0x517617+_0x16b1('0xb6')+_0x5d7a74+_0x16b1('0xcb')+_0x458c3a+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x16b1('0xcc'),'headers':{'Authorization':_0x16b1('0xb3')+_0x249284,'If-None-Match':null,'OData-Version':_0x16b1('0xb4')},'json':!![]};return rp(_0xb58c96)[_0x16b1('0x30')](function(_0x53e6dd){var _0x1e0ae0=[];var _0x566766=_0x53e6dd[_0x16b1('0xcd')]['Options'];_0x566766[_0x16b1('0xbb')](function(_0xc4ac1d){_0x1e0ae0['push']({'name':_0xc4ac1d[_0x16b1('0xce')][_0x16b1('0xcf')]['Label'],'value':String(_0xc4ac1d[_0x16b1('0xd0')])});});var _0x3f93a6={'id':_0x9f1a17+'_'+_0x53e6dd['LogicalName'],'name':_0x53e6dd[_0x16b1('0xd1')][_0x16b1('0xcf')][_0x16b1('0xce')],'custom':![],'options':_0x1e0ae0};_0x4bf5ca[_0x16b1('0xbe')](_0x3f93a6);return _0x4bf5ca;});}function getBooleanList(_0x30ddf7,_0x10f869,_0x2b36f4,_0x38a03c,_0x47a9f2,_0x2d93d2){var _0x5ca6ab={'method':_0x16b1('0xb1'),'uri':_0x30ddf7+_0x16b1('0xb6')+_0x38a03c+_0x16b1('0xcb')+_0x47a9f2+_0x16b1('0xd2'),'headers':{'Authorization':_0x16b1('0xb3')+_0x2d93d2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5ca6ab)[_0x16b1('0x30')](function(_0x29b298){var _0x433ec1=[];_0x433ec1[_0x16b1('0xbe')]({'name':_0x29b298[_0x16b1('0xcd')]['TrueOption'][_0x16b1('0xce')][_0x16b1('0xcf')][_0x16b1('0xce')],'value':_0x16b1('0xd3')},{'name':_0x29b298[_0x16b1('0xcd')][_0x16b1('0xd4')]['Label']['UserLocalizedLabel']['Label'],'value':'false'});var _0x2c955b={'id':_0x10f869+'_'+_0x29b298[_0x16b1('0xba')],'name':_0x29b298['DisplayName'][_0x16b1('0xcf')][_0x16b1('0xce')],'custom':![],'options':_0x433ec1};_0x2b36f4[_0x16b1('0xbe')](_0x2c955b);return _0x2b36f4;});}function getInputList(_0x59ce9f,_0x1b05dd,_0x5be1b2,_0x43ad66,_0x7e7ca9,_0x3f67fa,_0x34e570){var _0x245e93={'method':_0x16b1('0xb1'),'uri':_0x59ce9f+'EntityDefinitions('+_0x7e7ca9+_0x16b1('0xcb')+_0x3f67fa+_0x16b1('0xd5')+_0x5be1b2+_0x16b1('0xd6'),'headers':{'Authorization':_0x16b1('0xb3')+_0x34e570,'If-None-Match':null,'OData-Version':_0x16b1('0xb4')},'json':!![]};return rp(_0x245e93)[_0x16b1('0x30')](function(_0x333406){var _0x3b6b0c={'id':_0x1b05dd+'_'+_0x333406[_0x16b1('0xba')],'name':_0x333406[_0x16b1('0xd1')]['UserLocalizedLabel']?_0x333406[_0x16b1('0xd1')][_0x16b1('0xcf')][_0x16b1('0xce')]:_0x333406['LogicalName'],'custom':![],'options':[]};_0x43ad66[_0x16b1('0xbe')](_0x3b6b0c);return _0x43ad66;});} \ No newline at end of file +var _0x952c=['StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','test','Wrong\x20credentials','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Attributes(','TrueOption','true','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','name','send','render','merge','body','contact','agent','interaction','account','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','pick','filter','where','VIRTUAL','includeAll','include','findAll','show','length','options','find','create','update','params','getConfigurations','findOne','Dynamics365Configuration','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','phonecall_activity_parties','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','emailaddress','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','tenantId','clientId','clientSecret','remoteUri','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata'];(function(_0xf378c2,_0x348e58){var _0x1d7c00=function(_0x15a76a){while(--_0x15a76a){_0xf378c2['push'](_0xf378c2['shift']());}};_0x1d7c00(++_0x348e58);}(_0x952c,0xed));var _0xc952=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0x952c[_0x2bf888];return _0x3038d6;};'use strict';var emlformat=require(_0xc952('0x0'));var rimraf=require(_0xc952('0x1'));var zipdir=require(_0xc952('0x2'));var jsonpatch=require(_0xc952('0x3'));var rp=require('request-promise');var moment=require(_0xc952('0x4'));var BPromise=require(_0xc952('0x5'));var Mustache=require(_0xc952('0x6'));var util=require(_0xc952('0x7'));var path=require(_0xc952('0x8'));var sox=require(_0xc952('0x9'));var csv=require(_0xc952('0xa'));var ejs=require(_0xc952('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc952('0xc'));var squel=require(_0xc952('0xd'));var crypto=require(_0xc952('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc952('0xf'));var toCsv=require(_0xc952('0xa'));var querystring=require(_0xc952('0x10'));var Papa=require(_0xc952('0x11'));var Redis=require(_0xc952('0x12'));var authService=require(_0xc952('0x13'));var qs=require(_0xc952('0x14'));var as=require(_0xc952('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc952('0x16'))('api');var utils=require(_0xc952('0x17'));var config=require(_0xc952('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc952('0x19'))['db'];var integrations=require(_0xc952('0x1a'));var jayson=require(_0xc952('0x1b'));var client=jayson[_0xc952('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554233,_0x576835,_0x163ba6,_0x4d8019){return new BPromise(function(_0x5b7225,_0x58bb23){var _0xccad86=_0x4d8019||client;return _0xccad86['request'](_0x554233,_0x163ba6)['then'](function(_0x336b82){logger[_0xc952('0x1d')](_0xc952('0x1e'),_0x576835,_0xc952('0x1f'));logger[_0xc952('0x20')](_0xc952('0x21'),_0x576835,_0xc952('0x1f'),JSON['stringify'](_0x336b82));if(_0x336b82[_0xc952('0x22')]){if(_0x336b82[_0xc952('0x22')][_0xc952('0x23')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x576835,_0x336b82[_0xc952('0x22')][_0xc952('0x24')]);return _0x58bb23(_0x336b82[_0xc952('0x22')][_0xc952('0x24')]);}logger[_0xc952('0x22')](_0xc952('0x1e'),_0x576835,_0x336b82[_0xc952('0x22')][_0xc952('0x24')]);return _0x5b7225(_0x336b82[_0xc952('0x22')]['message']);}else{logger[_0xc952('0x1d')](_0xc952('0x1e'),_0x576835,'request\x20sent');_0x5b7225(_0x336b82[_0xc952('0x25')][_0xc952('0x24')]);}})[_0xc952('0x26')](function(_0x7c6edf){logger[_0xc952('0x22')]('Dynamics365Account,\x20%s,\x20%s',_0x576835,_0x7c6edf);_0x58bb23(_0x7c6edf);});});}function respondWithStatusCode(_0x46853e,_0x3aa6e7){_0x3aa6e7=_0x3aa6e7||0xcc;return function(_0x4006b0){if(_0x4006b0){return _0x46853e[_0xc952('0x27')](_0x3aa6e7);}return _0x46853e[_0xc952('0x28')](_0x3aa6e7)[_0xc952('0x29')]();};}function respondWithResult(_0x25a9b8,_0x425d7e){_0x425d7e=_0x425d7e||0xc8;return function(_0x3f8e4f){if(_0x3f8e4f){return _0x25a9b8[_0xc952('0x28')](_0x425d7e)[_0xc952('0x2a')](_0x3f8e4f);}};}function respondWithFilteredResult(_0x26f5f9,_0x2c7992){return function(_0x1c0785){if(_0x1c0785){var _0x307e42=typeof _0x2c7992[_0xc952('0x2b')]===_0xc952('0x2c')&&typeof _0x2c7992[_0xc952('0x2d')]===_0xc952('0x2c');var _0x3d23ad=_0x1c0785['count'];var _0x520000=_0x307e42?0x0:_0x2c7992[_0xc952('0x2b')];var _0x68295e=_0x307e42?_0x1c0785[_0xc952('0x2e')]:_0x2c7992['offset']+_0x2c7992[_0xc952('0x2d')];var _0x12f911;if(_0x68295e>=_0x3d23ad){_0x68295e=_0x3d23ad;_0x12f911=0xc8;}else{_0x12f911=0xce;}_0x26f5f9[_0xc952('0x28')](_0x12f911);return _0x26f5f9[_0xc952('0x2f')](_0xc952('0x30'),_0x520000+'-'+_0x68295e+'/'+_0x3d23ad)[_0xc952('0x2a')](_0x1c0785);}return null;};}function patchUpdates(_0xb4917c){return function(_0x8c54c0){try{jsonpatch[_0xc952('0x31')](_0x8c54c0,_0xb4917c,!![]);}catch(_0x47ae14){return BPromise[_0xc952('0x32')](_0x47ae14);}return _0x8c54c0[_0xc952('0x33')]();};}function saveUpdates(_0x161832,_0x3c9ba9){return function(_0x482adc){if(_0x482adc){return _0x482adc['update'](_0x161832)[_0xc952('0x34')](function(_0x110fc6){return _0x110fc6;});}return null;};}function removeEntity(_0x2c910f,_0x2a2c9a){return function(_0x189e06){if(_0x189e06){return _0x189e06[_0xc952('0x35')]()[_0xc952('0x34')](function(){_0x2c910f[_0xc952('0x28')](0xcc)[_0xc952('0x29')]();});}};}function handleEntityNotFound(_0x289390,_0x55676c){return function(_0x141b73){if(!_0x141b73){_0x289390[_0xc952('0x27')](0x194);}return _0x141b73;};}function handleError(_0x2abb6d,_0x339c49){_0x339c49=_0x339c49||0x1f4;return function(_0x21822d){logger[_0xc952('0x22')](_0x21822d['stack']);if(_0x21822d[_0xc952('0x36')]){delete _0x21822d[_0xc952('0x36')];}_0x2abb6d[_0xc952('0x28')](_0x339c49)[_0xc952('0x37')](_0x21822d);};}function getMustacheRender(_0x51840c,_0xab851f){return Mustache[_0xc952('0x38')](_0x51840c,_[_0xc952('0x39')](_0xab851f[_0xc952('0x3a')],{'contact':_0xab851f[_0xc952('0x3b')],'message':_0xab851f[_0xc952('0x24')],'agent':_0xab851f[_0xc952('0x3c')],'interaction':_0xab851f[_0xc952('0x3d')],'account':_0xab851f[_0xc952('0x3e')]}))||'';}exports['index']=function(_0x421c27,_0x4e8fd4){var _0x4ab7aa={},_0x36c5fe={},_0x29d811={'count':0x0,'rows':[]};var _0x1eb3fd=_['map'](db[_0xc952('0x3f')][_0xc952('0x40')],function(_0x3063ef){return{'name':_0x3063ef[_0xc952('0x41')],'type':_0x3063ef[_0xc952('0x42')][_0xc952('0x43')]};});_0x36c5fe[_0xc952('0x44')]=_[_0xc952('0x45')](_0x1eb3fd,_0xc952('0x36'));_0x36c5fe[_0xc952('0x46')]=_[_0xc952('0x47')](_0x421c27[_0xc952('0x46')]);_0x36c5fe[_0xc952('0x48')]=_[_0xc952('0x49')](_0x36c5fe[_0xc952('0x44')],_0x36c5fe[_0xc952('0x46')]);_0x4ab7aa['attributes']=_[_0xc952('0x49')](_0x36c5fe[_0xc952('0x44')],qs[_0xc952('0x4a')](_0x421c27[_0xc952('0x46')][_0xc952('0x4a')]));_0x4ab7aa[_0xc952('0x4b')]=_0x4ab7aa[_0xc952('0x4b')]['length']?_0x4ab7aa[_0xc952('0x4b')]:_0x36c5fe[_0xc952('0x44')];if(!_0x421c27[_0xc952('0x46')][_0xc952('0x4c')]('nolimit')){_0x4ab7aa[_0xc952('0x2d')]=qs[_0xc952('0x2d')](_0x421c27[_0xc952('0x46')][_0xc952('0x2d')]);_0x4ab7aa[_0xc952('0x2b')]=qs[_0xc952('0x2b')](_0x421c27[_0xc952('0x46')][_0xc952('0x2b')]);}_0x4ab7aa['order']=qs[_0xc952('0x4d')](_0x421c27[_0xc952('0x46')][_0xc952('0x4d')]);_0x4ab7aa['where']=qs[_0xc952('0x48')](_[_0xc952('0x4e')](_0x421c27[_0xc952('0x46')],_0x36c5fe['filters']),_0x1eb3fd);if(_0x421c27[_0xc952('0x46')][_0xc952('0x4f')]){_0x4ab7aa[_0xc952('0x50')]=_[_0xc952('0x39')](_0x4ab7aa[_0xc952('0x50')],{'$or':_[_0xc952('0x45')](_0x1eb3fd,function(_0x40ffa6){if(_0x40ffa6[_0xc952('0x42')]!==_0xc952('0x51')){var _0x75692c={};_0x75692c[_0x40ffa6[_0xc952('0x36')]]={'$like':'%'+_0x421c27[_0xc952('0x46')][_0xc952('0x4f')]+'%'};return _0x75692c;}})});}_0x4ab7aa=_[_0xc952('0x39')]({},_0x4ab7aa,_0x421c27['options']);var _0x4cd41b={'where':_0x4ab7aa[_0xc952('0x50')]};return db[_0xc952('0x3f')][_0xc952('0x2e')](_0x4cd41b)[_0xc952('0x34')](function(_0x1388e1){_0x29d811['count']=_0x1388e1;if(_0x421c27[_0xc952('0x46')][_0xc952('0x52')]){_0x4ab7aa[_0xc952('0x53')]=[{'all':!![]}];}return db[_0xc952('0x3f')][_0xc952('0x54')](_0x4ab7aa);})['then'](function(_0x650f43){_0x29d811['rows']=_0x650f43;return _0x29d811;})['then'](respondWithFilteredResult(_0x4e8fd4,_0x4ab7aa))[_0xc952('0x26')](handleError(_0x4e8fd4,null));};exports[_0xc952('0x55')]=function(_0x534bc4,_0x19fc6f){var _0x311153={'raw':![],'where':{'id':_0x534bc4['params']['id']}},_0x2563e={};_0x2563e[_0xc952('0x44')]=_[_0xc952('0x47')](db[_0xc952('0x3f')][_0xc952('0x40')]);_0x2563e['query']=_['keys'](_0x534bc4['query']);_0x2563e['filters']=_[_0xc952('0x49')](_0x2563e[_0xc952('0x44')],_0x2563e[_0xc952('0x46')]);_0x311153[_0xc952('0x4b')]=_[_0xc952('0x49')](_0x2563e[_0xc952('0x44')],qs[_0xc952('0x4a')](_0x534bc4[_0xc952('0x46')][_0xc952('0x4a')]));_0x311153[_0xc952('0x4b')]=_0x311153[_0xc952('0x4b')][_0xc952('0x56')]?_0x311153[_0xc952('0x4b')]:_0x2563e[_0xc952('0x44')];if(_0x534bc4[_0xc952('0x46')][_0xc952('0x52')]){_0x311153[_0xc952('0x53')]=[{'all':!![]}];}_0x311153=_['merge']({},_0x311153,_0x534bc4[_0xc952('0x57')]);return db[_0xc952('0x3f')][_0xc952('0x58')](_0x311153)[_0xc952('0x34')](handleEntityNotFound(_0x19fc6f,null))['then'](respondWithResult(_0x19fc6f,null))[_0xc952('0x26')](handleError(_0x19fc6f,null));};exports[_0xc952('0x59')]=function(_0x1670ca,_0x1f8669){return db['Dynamics365Account'][_0xc952('0x59')](_0x1670ca[_0xc952('0x3a')],{})[_0xc952('0x34')](respondWithResult(_0x1f8669,0xc9))[_0xc952('0x26')](handleError(_0x1f8669,null));};exports[_0xc952('0x5a')]=function(_0x72bca2,_0x37bd6c){if(_0x72bca2[_0xc952('0x3a')]['id']){delete _0x72bca2[_0xc952('0x3a')]['id'];}return db[_0xc952('0x3f')][_0xc952('0x58')]({'where':{'id':_0x72bca2[_0xc952('0x5b')]['id']}})[_0xc952('0x34')](handleEntityNotFound(_0x37bd6c,null))[_0xc952('0x34')](saveUpdates(_0x72bca2[_0xc952('0x3a')],null))[_0xc952('0x34')](respondWithResult(_0x37bd6c,null))[_0xc952('0x26')](handleError(_0x37bd6c,null));};exports[_0xc952('0x35')]=function(_0x1aff66,_0x1050f0){return db[_0xc952('0x3f')]['find']({'where':{'id':_0x1aff66[_0xc952('0x5b')]['id']}})[_0xc952('0x34')](handleEntityNotFound(_0x1050f0,null))['then'](removeEntity(_0x1050f0,null))[_0xc952('0x26')](handleError(_0x1050f0,null));};exports[_0xc952('0x5c')]=function(_0x1c4041,_0x32cbdf,_0x17bc17){var _0x22b6df={};var _0x1c1910={};var _0x5ea9cf;var _0x1cac6d;return db[_0xc952('0x3f')][_0xc952('0x5d')]({'where':{'id':_0x1c4041[_0xc952('0x5b')]['id']}})['then'](handleEntityNotFound(_0x32cbdf,null))[_0xc952('0x34')](function(_0x19b28b){if(_0x19b28b){_0x5ea9cf=_0x19b28b;_0x1c1910['model']=_[_0xc952('0x47')](db[_0xc952('0x5e')]['rawAttributes']);_0x1c1910['query']=_['keys'](_0x1c4041['query']);_0x1c1910[_0xc952('0x48')]=_['intersection'](_0x1c1910[_0xc952('0x44')],_0x1c1910[_0xc952('0x46')]);_0x22b6df[_0xc952('0x4b')]=_['intersection'](_0x1c1910[_0xc952('0x44')],qs[_0xc952('0x4a')](_0x1c4041[_0xc952('0x46')][_0xc952('0x4a')]));_0x22b6df[_0xc952('0x4b')]=_0x22b6df[_0xc952('0x4b')][_0xc952('0x56')]?_0x22b6df[_0xc952('0x4b')]:_0x1c1910['model'];_0x22b6df[_0xc952('0x5f')]=qs['sort'](_0x1c4041[_0xc952('0x46')][_0xc952('0x4d')]);_0x22b6df['where']=qs[_0xc952('0x48')](_['pick'](_0x1c4041['query'],_0x1c1910['filters']));if(_0x1c4041[_0xc952('0x46')][_0xc952('0x4f')]){_0x22b6df[_0xc952('0x50')]=_['merge'](_0x22b6df[_0xc952('0x50')],{'$or':_[_0xc952('0x45')](_0x22b6df[_0xc952('0x4b')],function(_0x38cd8c){var _0x53a322={};_0x53a322[_0x38cd8c]={'$like':'%'+_0x1c4041[_0xc952('0x46')][_0xc952('0x4f')]+'%'};return _0x53a322;})});}_0x22b6df=_[_0xc952('0x39')]({},_0x22b6df,_0x1c4041[_0xc952('0x57')]);return _0x5ea9cf[_0xc952('0x5c')](_0x22b6df);}})[_0xc952('0x34')](function(_0x40ec5d){if(_0x40ec5d){_0x1cac6d=_0x40ec5d['length'];if(!_0x1c4041[_0xc952('0x46')][_0xc952('0x4c')](_0xc952('0x60'))){_0x22b6df[_0xc952('0x2d')]=qs[_0xc952('0x2d')](_0x1c4041[_0xc952('0x46')][_0xc952('0x2d')]);_0x22b6df['offset']=qs['offset'](_0x1c4041[_0xc952('0x46')][_0xc952('0x2b')]);}return _0x5ea9cf['getConfigurations'](_0x22b6df);}})['then'](function(_0x27470c){if(_0x27470c){return _0x27470c?{'count':_0x1cac6d,'rows':_0x27470c}:null;}})[_0xc952('0x34')](respondWithResult(_0x32cbdf,null))[_0xc952('0x26')](handleError(_0x32cbdf,null));};exports[_0xc952('0x61')]=function(_0x669eb0,_0x567694,_0x2d91da){if(_0x669eb0[_0xc952('0x3a')]['id']){delete _0x669eb0[_0xc952('0x3a')]['id'];}return db['Dynamics365Account'][_0xc952('0x5d')]({'where':{'id':_0x669eb0[_0xc952('0x5b')]['id']}})[_0xc952('0x34')](handleEntityNotFound(_0x567694,null))['then'](function(_0x37669a){if(_0x37669a){_0x669eb0[_0xc952('0x3a')][_0xc952('0x62')]=_0x37669a['id'];_0x669eb0[_0xc952('0x3a')][_0xc952('0x63')]=integrations[_0xc952('0x64')](_0x669eb0[_0xc952('0x3a')][_0xc952('0x65')],_0x669eb0['body'][_0xc952('0x42')]);_0x669eb0['body'][_0xc952('0x66')]=integrations[_0xc952('0x67')](_0x669eb0[_0xc952('0x3a')][_0xc952('0x65')],_0x669eb0['body'][_0xc952('0x42')]);return db[_0xc952('0x5e')][_0xc952('0x59')](_0x669eb0[_0xc952('0x3a')],{'include':[{'model':db[_0xc952('0x68')],'as':_0xc952('0x63')},{'model':db[_0xc952('0x68')],'as':_0xc952('0x66')}]});}return null;})[_0xc952('0x34')](respondWithResult(_0x567694,null))[_0xc952('0x26')](handleError(_0x567694,null));};exports[_0xc952('0x69')]=function(_0x6c5265,_0x437731,_0x9f45d7){var _0x3c479e=_0x6c5265['query'][_0xc952('0x6a')];var _0x212f62=_0x3c479e===_0xc952('0x6b')?_0xc952('0x6c'):_0xc952('0x6d');var _0x366b3e='';var _0x145bbe='';var _0x18d36a='';var _0x27388e='';var _0x5bd424='';var _0x46088b='';var _0x200554='';var _0x4e0726='';var _0x3ca4ce=['title',_0xc952('0x6e'),_0xc952('0x6f'),_0xc952('0x70'),_0xc952('0x71'),'subject',_0xc952('0x72'),_0xc952('0x73'),'directioncode',_0xc952('0x74')];var _0x326f86=['accountidname','accountidyominame',_0xc952('0x75'),_0xc952('0x76'),'contactidname',_0xc952('0x77'),_0xc952('0x78'),_0xc952('0x79'),_0xc952('0x7a'),_0xc952('0x7b'),_0xc952('0x7c'),_0xc952('0x7d'),_0xc952('0x7e'),_0xc952('0x7f'),_0xc952('0x80'),_0xc952('0x81'),'customeridtype','customeridyominame',_0xc952('0x82'),'entitlementidname',_0xc952('0x83'),_0xc952('0x84'),'escalatedon',_0xc952('0x85'),_0xc952('0x86'),_0xc952('0x87'),_0xc952('0x88'),'influencescore',_0xc952('0x89'),_0xc952('0x8a'),_0xc952('0x8b'),'modifiedbyexternalpartyname',_0xc952('0x8c'),'modifiedbyname','modifiedbyyominame','modifiedon',_0xc952('0x8d'),'modifiedonbehalfbyyominame',_0xc952('0x8e'),_0xc952('0x8f'),_0xc952('0x90'),_0xc952('0x91'),_0xc952('0x92'),_0xc952('0x93'),_0xc952('0x94'),'owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame',_0xc952('0x95'),_0xc952('0x96'),_0xc952('0x97'),_0xc952('0x98'),_0xc952('0x99'),'responseby',_0xc952('0x9a'),_0xc952('0x9b'),'sentimentvalue',_0xc952('0x9c'),'slaname',_0xc952('0x9d'),_0xc952('0x9e'),_0xc952('0x9f'),_0xc952('0xa0'),_0xc952('0xa1'),_0xc952('0xa2'),'transactioncurrencyidname',_0xc952('0xa3'),_0xc952('0xa4'),_0xc952('0xa5')];var _0x2710e1=_0x3ca4ce[_0xc952('0xa6')](_0x326f86);return db['Dynamics365Account'][_0xc952('0x5d')]({'where':{'id':_0x6c5265[_0xc952('0x5b')]['id']},'attributes':['id','username',_0xc952('0xa7'),'remoteUri',_0xc952('0xa8'),_0xc952('0xa9'),_0xc952('0xaa')]})[_0xc952('0x34')](handleEntityNotFound(_0x437731,null))[_0xc952('0x34')](function(_0x45a9e0){if(_0x45a9e0){_0x4e0726=_0x45a9e0[_0xc952('0xab')];var _0x433591=_0x4e0726['slice'](-0x1);if(_0x433591==='/'){_0x4e0726=_0x4e0726[_0xc952('0xac')](0x0,_0x4e0726[_0xc952('0xad')](_0x433591));}_0x200554=util[_0xc952('0xae')](_0xc952('0xaf'),_0x4e0726);var _0x14658e={'method':_0xc952('0xb0'),'uri':_0xc952('0xb1')+_0x45a9e0[_0xc952('0xa8')]+_0xc952('0xb2'),'form':{'client_id':_0x45a9e0[_0xc952('0xa9')],'resource':_0x4e0726,'username':_0x45a9e0['username'],'password':_0x45a9e0[_0xc952('0xa7')],'grant_type':_0xc952('0xa7'),'client_secret':_0x45a9e0['clientSecret']},'json':!![]};return rp(_0x14658e);}})[_0xc952('0x34')](function(_0x667f3){_0x46088b=_0x667f3[_0xc952('0xb3')];var _0x54a508={'method':_0xc952('0xb4'),'uri':encodeURI(_0x200554+_0xc952('0xb5')+_0x212f62+'\x27'),'headers':{'Authorization':_0xc952('0xb6')+_0x46088b,'If-None-Match':null,'OData-Version':_0xc952('0xb7')},'json':!![]};return rp(_0x54a508);})[_0xc952('0x34')](function(_0x53ea03){var _0xe133b9=_0x53ea03[_0xc952('0xb8')][0x0];var _0x1f56b6=_0xe133b9[_0xc952('0xb9')];var _0x530757={'method':_0xc952('0xb4'),'uri':_0x200554+_0xc952('0xba')+_0x1f56b6+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xc952('0xb6')+_0x46088b,'If-None-Match':null,'OData-Version':_0xc952('0xb7')},'json':!![]};return rp(_0x530757);})[_0xc952('0x34')](function(_0x30224f){_0x366b3e=_0x30224f;_0x145bbe=_0x366b3e[_0xc952('0xbb')];_0x145bbe=_['remove'](_0x145bbe,function(_0x1ae87f){return!_0x2710e1[_0xc952('0xbc')](_0x1ae87f[_0xc952('0xbd')]);});var _0x5cd04a=[];var _0x437149=[];_0x145bbe[_0xc952('0xbe')](function(_0x2131f5){if(_0x2131f5['@odata.type']){var _0x3aaf13=_0x2131f5[_0xc952('0xbf')][_0xc952('0xac')](_0x2131f5[_0xc952('0xbf')]['lastIndexOf']('.')+0x1);if(_0x3aaf13===_0xc952('0xc0')){_0x5cd04a[_0xc952('0xc1')](getSelectList(_0x200554,_0x3c479e,_0x437149,_0x366b3e[_0xc952('0xb9')],_0x2131f5[_0xc952('0xb9')],_0x46088b));}}});return Promise[_0xc952('0xc2')](_0x5cd04a);})[_0xc952('0x34')](function(_0x269fd8){_0x18d36a=_0x269fd8[0x0];var _0x471d01=[];var _0x59719f=[];_0x145bbe['forEach'](function(_0x1a6a62){if(!_[_0xc952('0xc3')](_0x1a6a62['@odata.type'])){var _0x2f5f8a=_0x1a6a62[_0xc952('0xbf')][_0xc952('0xac')](_0x1a6a62[_0xc952('0xbf')][_0xc952('0xad')]('.')+0x1);if(_0x2f5f8a==='BooleanAttributeMetadata'){_0x471d01[_0xc952('0xc1')](getBooleanList(_0x200554,_0x3c479e,_0x59719f,_0x366b3e[_0xc952('0xb9')],_0x1a6a62['MetadataId'],_0x46088b));}}});return Promise[_0xc952('0xc2')](_0x471d01);})['then'](function(_0x1255e7){_0x27388e=_0x1255e7[0x0];var _0x56c8aa=[];var _0x4b40a4=[];_0x145bbe[_0xc952('0xbe')](function(_0x11fb7a){if(_0x11fb7a['@odata.type']){var _0x3c5226=_0x11fb7a[_0xc952('0xbf')][_0xc952('0xac')](_0x11fb7a[_0xc952('0xbf')][_0xc952('0xad')]('.')+0x1);if(_0x3c5226==='StringAttributeMetadata'||_0x3c5226===_0xc952('0xc4')||_0x3c5226===_0xc952('0xc5')||_0x3c5226===_0xc952('0xc6')||_0x3c5226==='MemoAttributeMetadata'||_0x3c5226==='DateTimeAttributeMetadata'||_0x3c5226===_0xc952('0xc7')||_0x3c5226===_0xc952('0xc8')||_0x3c5226===_0xc952('0xc9')||_0x3c5226===_0xc952('0xca')){_0x56c8aa[_0xc952('0xc1')](getInputList(_0x200554,_0x3c479e,_0x3c5226,_0x4b40a4,_0x366b3e[_0xc952('0xb9')],_0x11fb7a[_0xc952('0xb9')],_0x46088b));}}});return Promise[_0xc952('0xc2')](_0x56c8aa);})[_0xc952('0x34')](function(_0x2c139a){_0x5bd424=_0x2c139a[0x0];var _0x1c83d6=_0x18d36a[_0xc952('0xa6')](_0x27388e)[_0xc952('0xa6')](_0x5bd424);var _0x36ee6d={'count':_0x1c83d6[_0xc952('0x56')],'rows':_0x1c83d6};return _0x36ee6d;})[_0xc952('0x34')](respondWithResult(_0x437731,null))[_0xc952('0x26')](function(_0x29165f){var _0x272b6c=_0x6c5265[_0xc952('0x46')]['test']?0x1f4:_0x29165f[_0xc952('0xcb')]||0x1f4;logger[_0xc952('0x22')](_0x29165f['stack']);delete _0x29165f[_0xc952('0x36')];if(_0x272b6c===0x191){_0x272b6c=0x190;}_0x437731[_0xc952('0x28')](_0x272b6c)[_0xc952('0x37')](_0x6c5265['query'][_0xc952('0xcc')]?{'message':_0xc952('0xcd'),'statusCode':_0x29165f[_0xc952('0xcb')]}:_0x29165f);});};function getSelectList(_0x55d738,_0x41fc7,_0xfb9c02,_0x7f4e0,_0x267b9c,_0x4b30c1){var _0x48a350={'method':_0xc952('0xb4'),'uri':_0x55d738+_0xc952('0xba')+_0x7f4e0+')/Attributes('+_0x267b9c+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xc952('0xce'),'headers':{'Authorization':_0xc952('0xb6')+_0x4b30c1,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x48a350)['then'](function(_0x485a34){var _0xe6e79c=[];var _0x208594=_0x485a34[_0xc952('0xcf')][_0xc952('0xd0')];_0x208594[_0xc952('0xbe')](function(_0x4ac83e){_0xe6e79c[_0xc952('0xc1')]({'name':_0x4ac83e[_0xc952('0xd1')][_0xc952('0xd2')][_0xc952('0xd1')],'value':String(_0x4ac83e[_0xc952('0xd3')])});});var _0x290681={'id':_0x41fc7+'_'+_0x485a34[_0xc952('0xbd')],'name':_0x485a34['DisplayName'][_0xc952('0xd2')]['Label'],'custom':![],'options':_0xe6e79c};_0xfb9c02[_0xc952('0xc1')](_0x290681);return _0xfb9c02;});}function getBooleanList(_0x45a43a,_0x34d017,_0x1ad904,_0x464719,_0x34e66,_0x2896cd){var _0x10c68a={'method':_0xc952('0xb4'),'uri':_0x45a43a+_0xc952('0xba')+_0x464719+_0xc952('0xd4')+_0x34e66+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xc952('0xb6')+_0x2896cd,'If-None-Match':null,'OData-Version':_0xc952('0xb7')},'json':!![]};return rp(_0x10c68a)['then'](function(_0x3ccc08){var _0x471a0b=[];_0x471a0b[_0xc952('0xc1')]({'name':_0x3ccc08[_0xc952('0xcf')][_0xc952('0xd5')]['Label']['UserLocalizedLabel'][_0xc952('0xd1')],'value':_0xc952('0xd6')},{'name':_0x3ccc08[_0xc952('0xcf')]['FalseOption'][_0xc952('0xd1')]['UserLocalizedLabel'][_0xc952('0xd1')],'value':'false'});var _0x3b403a={'id':_0x34d017+'_'+_0x3ccc08[_0xc952('0xbd')],'name':_0x3ccc08[_0xc952('0xd7')][_0xc952('0xd2')]['Label'],'custom':![],'options':_0x471a0b};_0x1ad904[_0xc952('0xc1')](_0x3b403a);return _0x1ad904;});}function getInputList(_0x42d84b,_0xfcaee4,_0x537812,_0x45c3ad,_0x5dea46,_0x1e269f,_0x2c4dc8){var _0x318263={'method':_0xc952('0xb4'),'uri':_0x42d84b+_0xc952('0xba')+_0x5dea46+_0xc952('0xd4')+_0x1e269f+_0xc952('0xd8')+_0x537812+_0xc952('0xd9'),'headers':{'Authorization':_0xc952('0xb6')+_0x2c4dc8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x318263)[_0xc952('0x34')](function(_0x40cab1){var _0x4cbe7c={'id':_0xfcaee4+'_'+_0x40cab1[_0xc952('0xbd')],'name':_0x40cab1[_0xc952('0xd7')][_0xc952('0xd2')]?_0x40cab1[_0xc952('0xd7')]['UserLocalizedLabel']['Label']:_0x40cab1[_0xc952('0xbd')],'custom':![],'options':[]};_0x45c3ad[_0xc952('0xc1')](_0x4cbe7c);return _0x45c3ad;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index f7ef37e..51f4f19 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 _0x2e7d=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x158fa5,_0x6df3f4){var _0x598e82=function(_0x325c3f){while(--_0x325c3f){_0x158fa5['push'](_0x158fa5['shift']());}};_0x598e82(++_0x6df3f4);}(_0x2e7d,0xfc));var _0xd2e7=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x2e7d[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0xd2e7('0x0'));var util=require(_0xd2e7('0x1'));var logger=require(_0xd2e7('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd2e7('0x3'));var rp=require(_0xd2e7('0x4'));var fs=require('fs');var path=require(_0xd2e7('0x5'));var rimraf=require(_0xd2e7('0x6'));var config=require(_0xd2e7('0x7'));var attributes=require(_0xd2e7('0x8'));var integrations=require(_0xd2e7('0x9'));module[_0xd2e7('0xa')]=function(_0x55bf63,_0x4bab01){return _0x55bf63[_0xd2e7('0xb')](_0xd2e7('0xc'),attributes,{'tableName':_0xd2e7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30d1=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','Dynamics365Account','int_dynamics365_accounts','util'];(function(_0x1ba4a7,_0x5d02d9){var _0x5b231d=function(_0xfdfa7b){while(--_0xfdfa7b){_0x1ba4a7['push'](_0x1ba4a7['shift']());}};_0x5b231d(++_0x5d02d9);}(_0x30d1,0xa4));var _0x130d=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0x30d1[_0x30cc1a];return _0xb3f18f;};'use strict';var _=require('lodash');var util=require(_0x130d('0x0'));var logger=require('../../config/logger')(_0x130d('0x1'));var moment=require(_0x130d('0x2'));var BPromise=require(_0x130d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x130d('0x4'));var config=require(_0x130d('0x5'));var attributes=require(_0x130d('0x6'));var integrations=require(_0x130d('0x7'));module[_0x130d('0x8')]=function(_0x3db444,_0x38d3e8){return _0x3db444['define'](_0x130d('0x9'),attributes,{'tableName':_0x130d('0xa'),'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 654c2fb..65f020e 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 _0xdbfa=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','model','map','GetDynamics365Account','find','ShowDynamics365Account','bluebird'];(function(_0x21a1a9,_0x5c0d44){var _0x26f1f1=function(_0x1c4ba9){while(--_0x1c4ba9){_0x21a1a9['push'](_0x21a1a9['shift']());}};_0x26f1f1(++_0x5c0d44);}(_0xdbfa,0x128));var _0xadbf=function(_0x1dc2c9,_0x5554a9){_0x1dc2c9=_0x1dc2c9-0x0;var _0x17d78f=_0xdbfa[_0x1dc2c9];return _0x17d78f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xadbf('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadbf('0x1'));var db=require(_0xadbf('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xadbf('0x3'))(_0xadbf('0x4'));var config=require(_0xadbf('0x5'));var jayson=require(_0xadbf('0x6'));var client=jayson[_0xadbf('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1204f4,_0x30f643,_0x16704e){return new BPromise(function(_0x2bbd13,_0x4daabe){return client[_0xadbf('0x8')](_0x1204f4,_0x16704e)[_0xadbf('0x9')](function(_0x39e467){logger['info'](_0xadbf('0xa'),_0x30f643,_0xadbf('0xb'));logger[_0xadbf('0xc')](_0xadbf('0xd'),_0x30f643,_0xadbf('0xb'),JSON[_0xadbf('0xe')](_0x39e467));if(_0x39e467[_0xadbf('0xf')]){if(_0x39e467[_0xadbf('0xf')]['code']===0x1f4){logger[_0xadbf('0xf')](_0xadbf('0xa'),_0x30f643,_0x39e467['error'][_0xadbf('0x10')]);return _0x4daabe(_0x39e467[_0xadbf('0xf')]['message']);}logger['error'](_0xadbf('0xa'),_0x30f643,_0x39e467['error'][_0xadbf('0x10')]);return _0x2bbd13(_0x39e467[_0xadbf('0xf')][_0xadbf('0x10')]);}else{logger[_0xadbf('0x11')](_0xadbf('0xa'),_0x30f643,_0xadbf('0xb'));_0x2bbd13(_0x39e467[_0xadbf('0x12')][_0xadbf('0x10')]);}})[_0xadbf('0x13')](function(_0x59712){logger[_0xadbf('0xf')](_0xadbf('0xa'),_0x30f643,_0x59712);_0x4daabe(_0x59712);});});}exports['GetDynamics365Account']=function(_0x1b8639){var _0x353028=this;return new Promise(function(_0x38e3f2,_0x3585e0){return db[_0xadbf('0x14')][_0xadbf('0x15')]({'raw':_0x1b8639['options']?_0x1b8639[_0xadbf('0x16')][_0xadbf('0x17')]===undefined?!![]:![]:!![],'where':_0x1b8639[_0xadbf('0x16')]?_0x1b8639[_0xadbf('0x16')][_0xadbf('0x18')]||null:null,'attributes':_0x1b8639[_0xadbf('0x16')]?_0x1b8639[_0xadbf('0x16')][_0xadbf('0x19')]||null:null,'limit':_0x1b8639[_0xadbf('0x16')]?_0x1b8639['options'][_0xadbf('0x1a')]||null:null,'include':_0x1b8639[_0xadbf('0x16')]?_0x1b8639[_0xadbf('0x16')][_0xadbf('0x1b')]?_['map'](_0x1b8639[_0xadbf('0x16')][_0xadbf('0x1b')],function(_0x1d49c6){return{'model':db[_0x1d49c6[_0xadbf('0x1c')]],'as':_0x1d49c6['as'],'attributes':_0x1d49c6[_0xadbf('0x19')],'include':_0x1d49c6['include']?_['map'](_0x1d49c6['include'],function(_0x52da57){return{'model':db[_0x52da57[_0xadbf('0x1c')]],'as':_0x52da57['as'],'attributes':_0x52da57[_0xadbf('0x19')],'include':_0x52da57[_0xadbf('0x1b')]?_[_0xadbf('0x1d')](_0x52da57[_0xadbf('0x1b')],function(_0x5a17e7){return{'model':db[_0x5a17e7[_0xadbf('0x1c')]],'as':_0x5a17e7['as'],'attributes':_0x5a17e7[_0xadbf('0x19')]};}):[]};}):[]};}):[]:[]})[_0xadbf('0x9')](function(_0x4c0a5b){logger[_0xadbf('0x11')](_0xadbf('0x1e'),_0x1b8639);logger[_0xadbf('0xc')](_0xadbf('0x1e'),_0x1b8639,JSON[_0xadbf('0xe')](_0x4c0a5b));_0x38e3f2(_0x4c0a5b);})[_0xadbf('0x13')](function(_0x35d8ba){logger['error']('GetDynamics365Account',_0x35d8ba[_0xadbf('0x10')],_0x1b8639);_0x3585e0(_0x353028[_0xadbf('0xf')](0x1f4,_0x35d8ba[_0xadbf('0x10')]));});});};exports['ShowDynamics365Account']=function(_0xf422d6){var _0x41fdb6=this;return new Promise(function(_0x2555b0,_0x5f27bc){return db[_0xadbf('0x14')][_0xadbf('0x1f')]({'raw':_0xf422d6['options']?_0xf422d6[_0xadbf('0x16')][_0xadbf('0x17')]===undefined?!![]:![]:!![],'where':_0xf422d6[_0xadbf('0x16')]?_0xf422d6[_0xadbf('0x16')][_0xadbf('0x18')]||null:null,'attributes':_0xf422d6[_0xadbf('0x16')]?_0xf422d6[_0xadbf('0x16')][_0xadbf('0x19')]||null:null,'include':_0xf422d6[_0xadbf('0x16')]?_0xf422d6[_0xadbf('0x16')][_0xadbf('0x1b')]?_[_0xadbf('0x1d')](_0xf422d6[_0xadbf('0x16')]['include'],function(_0x3f097e){return{'model':db[_0x3f097e['model']],'as':_0x3f097e['as'],'attributes':_0x3f097e[_0xadbf('0x19')],'include':_0x3f097e[_0xadbf('0x1b')]?_[_0xadbf('0x1d')](_0x3f097e[_0xadbf('0x1b')],function(_0x1ff22c){return{'model':db[_0x1ff22c[_0xadbf('0x1c')]],'as':_0x1ff22c['as'],'attributes':_0x1ff22c[_0xadbf('0x19')],'include':_0x1ff22c[_0xadbf('0x1b')]?_[_0xadbf('0x1d')](_0x1ff22c[_0xadbf('0x1b')],function(_0x371716){return{'model':db[_0x371716[_0xadbf('0x1c')]],'as':_0x371716['as'],'attributes':_0x371716['attributes']};}):[]};}):[]};}):[]:[]})[_0xadbf('0x9')](function(_0x477628){logger[_0xadbf('0x11')](_0xadbf('0x20'),_0xf422d6);logger[_0xadbf('0xc')]('ShowDynamics365Account',_0xf422d6,JSON[_0xadbf('0xe')](_0x477628));_0x2555b0(_0x477628);})[_0xadbf('0x13')](function(_0x3be1be){logger[_0xadbf('0xf')](_0xadbf('0x20'),_0x3be1be[_0xadbf('0x10')],_0xf422d6);_0x5f27bc(_0x41fdb6[_0xadbf('0xf')](0x1f4,_0x3be1be[_0xadbf('0x10')]));});});}; \ No newline at end of file +var _0x3d4b=['stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','limit','include','model','map','attributes','then','debug','ShowDynamics365Account','find','where','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0x5e40e5,_0x167823){var _0x188e19=function(_0x45ccd6){while(--_0x45ccd6){_0x5e40e5['push'](_0x5e40e5['shift']());}};_0x188e19(++_0x167823);}(_0x3d4b,0xf3));var _0xb3d4=function(_0x152314,_0x3891bb){_0x152314=_0x152314-0x0;var _0x49bac4=_0x3d4b[_0x152314];return _0x49bac4;};'use strict';var _=require(_0xb3d4('0x0'));var util=require(_0xb3d4('0x1'));var moment=require('moment');var BPromise=require(_0xb3d4('0x2'));var rs=require(_0xb3d4('0x3'));var fs=require('fs');var Redis=require(_0xb3d4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb3d4('0x5'));var logger=require(_0xb3d4('0x6'))(_0xb3d4('0x7'));var config=require(_0xb3d4('0x8'));var jayson=require(_0xb3d4('0x9'));var client=jayson[_0xb3d4('0xa')][_0xb3d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x448c49,_0x43bc45,_0x35e0b3){return new BPromise(function(_0xd1d4c4,_0x2eb3b3){return client['request'](_0x448c49,_0x35e0b3)['then'](function(_0x343c8d){logger[_0xb3d4('0xc')](_0xb3d4('0xd'),_0x43bc45,_0xb3d4('0xe'));logger['debug'](_0xb3d4('0xf'),_0x43bc45,_0xb3d4('0xe'),JSON[_0xb3d4('0x10')](_0x343c8d));if(_0x343c8d[_0xb3d4('0x11')]){if(_0x343c8d[_0xb3d4('0x11')][_0xb3d4('0x12')]===0x1f4){logger[_0xb3d4('0x11')](_0xb3d4('0xd'),_0x43bc45,_0x343c8d[_0xb3d4('0x11')]['message']);return _0x2eb3b3(_0x343c8d['error'][_0xb3d4('0x13')]);}logger[_0xb3d4('0x11')](_0xb3d4('0xd'),_0x43bc45,_0x343c8d['error'][_0xb3d4('0x13')]);return _0xd1d4c4(_0x343c8d[_0xb3d4('0x11')]['message']);}else{logger[_0xb3d4('0xc')](_0xb3d4('0xd'),_0x43bc45,'request\x20sent');_0xd1d4c4(_0x343c8d[_0xb3d4('0x14')]['message']);}})['catch'](function(_0x539d5){logger['error'](_0xb3d4('0xd'),_0x43bc45,_0x539d5);_0x2eb3b3(_0x539d5);});});}exports[_0xb3d4('0x15')]=function(_0x1676a5){var _0x270298=this;return new Promise(function(_0x233adc,_0x5688d4){return db[_0xb3d4('0x16')][_0xb3d4('0x17')]({'raw':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')][_0xb3d4('0x19')]===undefined?!![]:![]:!![],'where':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')]['where']||null:null,'attributes':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')]['attributes']||null:null,'limit':_0x1676a5['options']?_0x1676a5['options'][_0xb3d4('0x1a')]||null:null,'include':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')][_0xb3d4('0x1b')]?_['map'](_0x1676a5['options'][_0xb3d4('0x1b')],function(_0x51c3a9){return{'model':db[_0x51c3a9[_0xb3d4('0x1c')]],'as':_0x51c3a9['as'],'attributes':_0x51c3a9['attributes'],'include':_0x51c3a9['include']?_[_0xb3d4('0x1d')](_0x51c3a9[_0xb3d4('0x1b')],function(_0x1fdbf6){return{'model':db[_0x1fdbf6['model']],'as':_0x1fdbf6['as'],'attributes':_0x1fdbf6[_0xb3d4('0x1e')],'include':_0x1fdbf6['include']?_['map'](_0x1fdbf6[_0xb3d4('0x1b')],function(_0x5482a4){return{'model':db[_0x5482a4[_0xb3d4('0x1c')]],'as':_0x5482a4['as'],'attributes':_0x5482a4[_0xb3d4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb3d4('0x1f')](function(_0x552da8){logger['info'](_0xb3d4('0x15'),_0x1676a5);logger[_0xb3d4('0x20')](_0xb3d4('0x15'),_0x1676a5,JSON['stringify'](_0x552da8));_0x233adc(_0x552da8);})['catch'](function(_0x4921c1){logger[_0xb3d4('0x11')](_0xb3d4('0x15'),_0x4921c1[_0xb3d4('0x13')],_0x1676a5);_0x5688d4(_0x270298['error'](0x1f4,_0x4921c1[_0xb3d4('0x13')]));});});};exports[_0xb3d4('0x21')]=function(_0x37cff4){var _0x5a3fe7=this;return new Promise(function(_0x447200,_0x98a5ff){return db['Dynamics365Account'][_0xb3d4('0x22')]({'raw':_0x37cff4['options']?_0x37cff4['options'][_0xb3d4('0x19')]===undefined?!![]:![]:!![],'where':_0x37cff4[_0xb3d4('0x18')]?_0x37cff4[_0xb3d4('0x18')][_0xb3d4('0x23')]||null:null,'attributes':_0x37cff4[_0xb3d4('0x18')]?_0x37cff4[_0xb3d4('0x18')][_0xb3d4('0x1e')]||null:null,'include':_0x37cff4[_0xb3d4('0x18')]?_0x37cff4[_0xb3d4('0x18')]['include']?_[_0xb3d4('0x1d')](_0x37cff4[_0xb3d4('0x18')][_0xb3d4('0x1b')],function(_0x4e6473){return{'model':db[_0x4e6473[_0xb3d4('0x1c')]],'as':_0x4e6473['as'],'attributes':_0x4e6473['attributes'],'include':_0x4e6473['include']?_['map'](_0x4e6473[_0xb3d4('0x1b')],function(_0x359084){return{'model':db[_0x359084['model']],'as':_0x359084['as'],'attributes':_0x359084[_0xb3d4('0x1e')],'include':_0x359084['include']?_[_0xb3d4('0x1d')](_0x359084[_0xb3d4('0x1b')],function(_0x4d61cf){return{'model':db[_0x4d61cf[_0xb3d4('0x1c')]],'as':_0x4d61cf['as'],'attributes':_0x4d61cf[_0xb3d4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb3d4('0x1f')](function(_0x1e0941){logger['info'](_0xb3d4('0x21'),_0x37cff4);logger[_0xb3d4('0x20')](_0xb3d4('0x21'),_0x37cff4,JSON[_0xb3d4('0x10')](_0x1e0941));_0x447200(_0x1e0941);})[_0xb3d4('0x24')](function(_0x330517){logger[_0xb3d4('0x11')]('ShowDynamics365Account',_0x330517['message'],_0x37cff4);_0x98a5ff(_0x5a3fe7[_0xb3d4('0x11')](0x1f4,_0x330517['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 672f02e..6940357 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 _0x53d9=['isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0x53d9,0xd4));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[_0x953d('0x5')]();var fs_extra=require(_0x953d('0x6'));var auth=require(_0x953d('0x7'));var interaction=require(_0x953d('0x8'));var config=require(_0x953d('0x9'));var controller=require(_0x953d('0xa'));router[_0x953d('0xb')]('/',auth[_0x953d('0xc')](),controller[_0x953d('0xd')]);router[_0x953d('0xb')](_0x953d('0xe'),auth[_0x953d('0xc')](),controller[_0x953d('0xf')]);router['get'](_0x953d('0x10'),auth[_0x953d('0xc')](),controller[_0x953d('0x11')]);router[_0x953d('0xb')](_0x953d('0x12'),auth[_0x953d('0xc')](),controller[_0x953d('0x13')]);router[_0x953d('0xb')](_0x953d('0x14'),auth['isAuthenticated'](),controller[_0x953d('0x15')]);router[_0x953d('0x16')]('/',auth[_0x953d('0xc')](),controller[_0x953d('0x17')]);router[_0x953d('0x18')](_0x953d('0xe'),auth[_0x953d('0xc')](),controller[_0x953d('0x19')]);router[_0x953d('0x1a')](_0x953d('0xe'),auth[_0x953d('0xc')](),controller['destroy']);module[_0x953d('0x1b')]=router; \ No newline at end of file +var _0xeba1=['get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0x56e4f7,_0x860f5){var _0x1f15e6=function(_0x103a45){while(--_0x103a45){_0x56e4f7['push'](_0x56e4f7['shift']());}};_0x1f15e6(++_0x860f5);}(_0xeba1,0x12f));var _0x1eba=function(_0x175f6f,_0x1a4a05){_0x175f6f=_0x175f6f-0x0;var _0x1aa501=_0xeba1[_0x175f6f];return _0x1aa501;};'use strict';var multer=require(_0x1eba('0x0'));var util=require(_0x1eba('0x1'));var path=require(_0x1eba('0x2'));var timeout=require('connect-timeout');var express=require(_0x1eba('0x3'));var router=express[_0x1eba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1eba('0x5'));var interaction=require(_0x1eba('0x6'));var config=require(_0x1eba('0x7'));var controller=require(_0x1eba('0x8'));router[_0x1eba('0x9')]('/',auth[_0x1eba('0xa')](),controller['index']);router[_0x1eba('0x9')]('/:id',auth[_0x1eba('0xa')](),controller[_0x1eba('0xb')]);router[_0x1eba('0x9')](_0x1eba('0xc'),auth['isAuthenticated'](),controller[_0x1eba('0xd')]);router[_0x1eba('0x9')](_0x1eba('0xe'),auth[_0x1eba('0xa')](),controller[_0x1eba('0xf')]);router['get'](_0x1eba('0x10'),auth['isAuthenticated'](),controller[_0x1eba('0x11')]);router[_0x1eba('0x12')]('/',auth[_0x1eba('0xa')](),controller[_0x1eba('0x13')]);router[_0x1eba('0x14')](_0x1eba('0x15'),auth[_0x1eba('0xa')](),controller[_0x1eba('0x16')]);router[_0x1eba('0x17')](_0x1eba('0x15'),auth[_0x1eba('0xa')](),controller[_0x1eba('0x18')]);module[_0x1eba('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index d696e18..177b2bb 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 _0xa594=['sequelize','exports','ENUM','incident','phonecall'];(function(_0x3077a5,_0xe8a73c){var _0x278875=function(_0x25c7a2){while(--_0x25c7a2){_0x3077a5['push'](_0x3077a5['shift']());}};_0x278875(++_0xe8a73c);}(_0xa594,0x1cc));var _0x4a59=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xa594[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x4a59('0x0'));module[_0x4a59('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x4a59('0x2')](_0x4a59('0x3'),_0x4a59('0x4')),'defaultValue':_0x4a59('0x3')}}; \ No newline at end of file +var _0x50cf=['sequelize','exports','STRING','ENUM','phonecall','incident'];(function(_0x3d817d,_0x2d9dde){var _0xbad350=function(_0x413635){while(--_0x413635){_0x3d817d['push'](_0x3d817d['shift']());}};_0xbad350(++_0x2d9dde);}(_0x50cf,0xd2));var _0xf50c=function(_0x5da723,_0x26a51b){_0x5da723=_0x5da723-0x0;var _0x433626=_0x50cf[_0x5da723];return _0x433626;};'use strict';var Sequelize=require(_0xf50c('0x0'));module[_0xf50c('0x1')]={'name':{'type':Sequelize[_0xf50c('0x2')]},'description':{'type':Sequelize[_0xf50c('0x2')]},'ticketType':{'type':Sequelize[_0xf50c('0x3')]('incident',_0xf50c('0x4')),'defaultValue':_0xf50c('0x5')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index d496750..67390b2 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 _0x5f2f=['nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','Dynamics365Configuration','includeAll','findAll','rows','params','rawAttributes','include','find','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','sendStatus','stack','name','send','merge','body','contact','agent','account','map','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x31e00f,_0x1a4e77){var _0x260194=function(_0x58c57a){while(--_0x58c57a){_0x31e00f['push'](_0x31e00f['shift']());}};_0x260194(++_0x1a4e77);}(_0x5f2f,0x73));var _0xf5f2=function(_0x150a05,_0x202df2){_0x150a05=_0x150a05-0x0;var _0x670fd3=_0x5f2f[_0x150a05];return _0x670fd3;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];var jayson=require(_0xf5f2('0x18'));var client=jayson[_0xf5f2('0x19')][_0xf5f2('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3e5956,_0x5c01b8,_0x5850f4,_0xea612c){return new BPromise(function(_0x269909,_0x1c1a5c){var _0x422b55=_0xea612c||client;return _0x422b55['request'](_0x3e5956,_0x5850f4)[_0xf5f2('0x1b')](function(_0x286197){logger[_0xf5f2('0x1c')](_0xf5f2('0x1d'),_0x5c01b8,_0xf5f2('0x1e'));logger[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x5c01b8,_0xf5f2('0x1e'),JSON[_0xf5f2('0x21')](_0x286197));if(_0x286197[_0xf5f2('0x22')]){if(_0x286197[_0xf5f2('0x22')][_0xf5f2('0x23')]===0x1f4){logger[_0xf5f2('0x22')](_0xf5f2('0x1d'),_0x5c01b8,_0x286197[_0xf5f2('0x22')][_0xf5f2('0x24')]);return _0x1c1a5c(_0x286197[_0xf5f2('0x22')]['message']);}logger[_0xf5f2('0x22')](_0xf5f2('0x1d'),_0x5c01b8,_0x286197['error']['message']);return _0x269909(_0x286197[_0xf5f2('0x22')][_0xf5f2('0x24')]);}else{logger['info'](_0xf5f2('0x1d'),_0x5c01b8,_0xf5f2('0x1e'));_0x269909(_0x286197[_0xf5f2('0x25')][_0xf5f2('0x24')]);}})[_0xf5f2('0x26')](function(_0x4c691a){logger[_0xf5f2('0x22')](_0xf5f2('0x1d'),_0x5c01b8,_0x4c691a);_0x1c1a5c(_0x4c691a);});});}function respondWithStatusCode(_0x4e8bda,_0x2833fe){_0x2833fe=_0x2833fe||0xcc;return function(_0x287ad5){if(_0x287ad5){return _0x4e8bda['sendStatus'](_0x2833fe);}return _0x4e8bda['status'](_0x2833fe)[_0xf5f2('0x27')]();};}function respondWithResult(_0x3f79d5,_0x13da6f){_0x13da6f=_0x13da6f||0xc8;return function(_0x1a5bb3){if(_0x1a5bb3){return _0x3f79d5[_0xf5f2('0x28')](_0x13da6f)[_0xf5f2('0x29')](_0x1a5bb3);}};}function respondWithFilteredResult(_0x13a3be,_0x281ec8){return function(_0x294414){if(_0x294414){var _0x4ab014=typeof _0x281ec8[_0xf5f2('0x2a')]===_0xf5f2('0x2b')&&typeof _0x281ec8[_0xf5f2('0x2c')]===_0xf5f2('0x2b');var _0x198c73=_0x294414[_0xf5f2('0x2d')];var _0x5b6672=_0x4ab014?0x0:_0x281ec8['offset'];var _0x22c826=_0x4ab014?_0x294414[_0xf5f2('0x2d')]:_0x281ec8[_0xf5f2('0x2a')]+_0x281ec8['limit'];var _0x5a2c7e;if(_0x22c826>=_0x198c73){_0x22c826=_0x198c73;_0x5a2c7e=0xc8;}else{_0x5a2c7e=0xce;}_0x13a3be[_0xf5f2('0x28')](_0x5a2c7e);return _0x13a3be[_0xf5f2('0x2e')](_0xf5f2('0x2f'),_0x5b6672+'-'+_0x22c826+'/'+_0x198c73)[_0xf5f2('0x29')](_0x294414);}return null;};}function patchUpdates(_0x1b381e){return function(_0x54c0c8){try{jsonpatch['apply'](_0x54c0c8,_0x1b381e,!![]);}catch(_0x2f4778){return BPromise['reject'](_0x2f4778);}return _0x54c0c8[_0xf5f2('0x30')]();};}function saveUpdates(_0x58a4df,_0x45b643){return function(_0x31087c){if(_0x31087c){return _0x31087c[_0xf5f2('0x31')](_0x58a4df)[_0xf5f2('0x1b')](function(_0x256bd9){return _0x256bd9;});}return null;};}function removeEntity(_0x277eee,_0x2ac089){return function(_0x2c0e05){if(_0x2c0e05){return _0x2c0e05['destroy']()[_0xf5f2('0x1b')](function(){_0x277eee[_0xf5f2('0x28')](0xcc)[_0xf5f2('0x27')]();});}};}function handleEntityNotFound(_0x43c77d,_0x1408b9){return function(_0x27c0e7){if(!_0x27c0e7){_0x43c77d[_0xf5f2('0x32')](0x194);}return _0x27c0e7;};}function handleError(_0x48d64d,_0x144646){_0x144646=_0x144646||0x1f4;return function(_0xf503e8){logger['error'](_0xf503e8[_0xf5f2('0x33')]);if(_0xf503e8['name']){delete _0xf503e8[_0xf5f2('0x34')];}_0x48d64d[_0xf5f2('0x28')](_0x144646)[_0xf5f2('0x35')](_0xf503e8);};}function getMustacheRender(_0x2e3cca,_0x59a6dd){return Mustache['render'](_0x2e3cca,_[_0xf5f2('0x36')](_0x59a6dd[_0xf5f2('0x37')],{'contact':_0x59a6dd[_0xf5f2('0x38')],'message':_0x59a6dd['message'],'agent':_0x59a6dd[_0xf5f2('0x39')],'interaction':_0x59a6dd['interaction'],'account':_0x59a6dd[_0xf5f2('0x3a')]}))||'';}exports['index']=function(_0x46f464,_0x456764){var _0x5337a6={},_0x29694f={},_0x46eb22={'count':0x0,'rows':[]};var _0x5a4441=_[_0xf5f2('0x3b')](db['Dynamics365Configuration']['rawAttributes'],function(_0x3d328f){return{'name':_0x3d328f[_0xf5f2('0x3c')],'type':_0x3d328f[_0xf5f2('0x3d')][_0xf5f2('0x3e')]};});_0x29694f[_0xf5f2('0x3f')]=_[_0xf5f2('0x3b')](_0x5a4441,_0xf5f2('0x34'));_0x29694f['query']=_[_0xf5f2('0x40')](_0x46f464[_0xf5f2('0x41')]);_0x29694f['filters']=_[_0xf5f2('0x42')](_0x29694f[_0xf5f2('0x3f')],_0x29694f[_0xf5f2('0x41')]);_0x5337a6[_0xf5f2('0x43')]=_[_0xf5f2('0x42')](_0x29694f[_0xf5f2('0x3f')],qs[_0xf5f2('0x44')](_0x46f464[_0xf5f2('0x41')]['fields']));_0x5337a6[_0xf5f2('0x43')]=_0x5337a6[_0xf5f2('0x43')][_0xf5f2('0x45')]?_0x5337a6['attributes']:_0x29694f['model'];if(!_0x46f464['query'][_0xf5f2('0x46')](_0xf5f2('0x47'))){_0x5337a6['limit']=qs[_0xf5f2('0x2c')](_0x46f464[_0xf5f2('0x41')][_0xf5f2('0x2c')]);_0x5337a6[_0xf5f2('0x2a')]=qs[_0xf5f2('0x2a')](_0x46f464[_0xf5f2('0x41')][_0xf5f2('0x2a')]);}_0x5337a6[_0xf5f2('0x48')]=qs[_0xf5f2('0x49')](_0x46f464[_0xf5f2('0x41')][_0xf5f2('0x49')]);_0x5337a6[_0xf5f2('0x4a')]=qs[_0xf5f2('0x4b')](_[_0xf5f2('0x4c')](_0x46f464['query'],_0x29694f[_0xf5f2('0x4b')]),_0x5a4441);if(_0x46f464['query'][_0xf5f2('0x4d')]){_0x5337a6[_0xf5f2('0x4a')]=_[_0xf5f2('0x36')](_0x5337a6[_0xf5f2('0x4a')],{'$or':_[_0xf5f2('0x3b')](_0x5a4441,function(_0x3721c4){if(_0x3721c4['type']!==_0xf5f2('0x4e')){var _0x2e7193={};_0x2e7193[_0x3721c4[_0xf5f2('0x34')]]={'$like':'%'+_0x46f464[_0xf5f2('0x41')][_0xf5f2('0x4d')]+'%'};return _0x2e7193;}})});}_0x5337a6=_[_0xf5f2('0x36')]({},_0x5337a6,_0x46f464[_0xf5f2('0x4f')]);var _0x297f07={'where':_0x5337a6['where']};return db[_0xf5f2('0x50')][_0xf5f2('0x2d')](_0x297f07)[_0xf5f2('0x1b')](function(_0x492eea){_0x46eb22[_0xf5f2('0x2d')]=_0x492eea;if(_0x46f464[_0xf5f2('0x41')][_0xf5f2('0x51')]){_0x5337a6['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xf5f2('0x52')](_0x5337a6);})[_0xf5f2('0x1b')](function(_0x5db519){_0x46eb22[_0xf5f2('0x53')]=_0x5db519;return _0x46eb22;})['then'](respondWithFilteredResult(_0x456764,_0x5337a6))[_0xf5f2('0x26')](handleError(_0x456764,null));};exports['show']=function(_0x2cbd9d,_0x5d9120){var _0x2d9017={'raw':![],'where':{'id':_0x2cbd9d[_0xf5f2('0x54')]['id']}},_0xb8ea3a={};_0xb8ea3a[_0xf5f2('0x3f')]=_['keys'](db[_0xf5f2('0x50')][_0xf5f2('0x55')]);_0xb8ea3a['query']=_['keys'](_0x2cbd9d[_0xf5f2('0x41')]);_0xb8ea3a[_0xf5f2('0x4b')]=_['intersection'](_0xb8ea3a[_0xf5f2('0x3f')],_0xb8ea3a[_0xf5f2('0x41')]);_0x2d9017[_0xf5f2('0x43')]=_[_0xf5f2('0x42')](_0xb8ea3a['model'],qs['fields'](_0x2cbd9d[_0xf5f2('0x41')][_0xf5f2('0x44')]));_0x2d9017['attributes']=_0x2d9017[_0xf5f2('0x43')][_0xf5f2('0x45')]?_0x2d9017[_0xf5f2('0x43')]:_0xb8ea3a[_0xf5f2('0x3f')];if(_0x2cbd9d[_0xf5f2('0x41')][_0xf5f2('0x51')]){_0x2d9017[_0xf5f2('0x56')]=[{'all':!![]}];}_0x2d9017=_['merge']({},_0x2d9017,_0x2cbd9d['options']);return db[_0xf5f2('0x50')][_0xf5f2('0x57')](_0x2d9017)[_0xf5f2('0x1b')](handleEntityNotFound(_0x5d9120,null))[_0xf5f2('0x1b')](respondWithResult(_0x5d9120,null))[_0xf5f2('0x26')](handleError(_0x5d9120,null));};exports['create']=function(_0xdb1106,_0x20ba91){return db[_0xf5f2('0x50')]['create'](_0xdb1106[_0xf5f2('0x37')],{})['then'](respondWithResult(_0x20ba91,0xc9))[_0xf5f2('0x26')](handleError(_0x20ba91,null));};exports[_0xf5f2('0x31')]=function(_0x28cce5,_0x10f391){if(_0x28cce5['body']['id']){delete _0x28cce5['body']['id'];}return db[_0xf5f2('0x50')]['find']({'where':{'id':_0x28cce5[_0xf5f2('0x54')]['id']}})[_0xf5f2('0x1b')](handleEntityNotFound(_0x10f391,null))['then'](saveUpdates(_0x28cce5[_0xf5f2('0x37')],null))[_0xf5f2('0x1b')](respondWithResult(_0x10f391,null))[_0xf5f2('0x26')](handleError(_0x10f391,null));};exports['destroy']=function(_0x397b99,_0xcf7a50){return db[_0xf5f2('0x50')][_0xf5f2('0x57')]({'where':{'id':_0x397b99['params']['id']}})[_0xf5f2('0x1b')](handleEntityNotFound(_0xcf7a50,null))['then'](removeEntity(_0xcf7a50,null))[_0xf5f2('0x26')](handleError(_0xcf7a50,null));};exports[_0xf5f2('0x58')]=function(_0x2e6f5d,_0x380c08,_0x9f210e){var _0x5583c2={};var _0xda8dda={};var _0xacd80;var _0x3461e5;return db[_0xf5f2('0x50')][_0xf5f2('0x59')]({'where':{'id':_0x2e6f5d['params']['id']}})[_0xf5f2('0x1b')](handleEntityNotFound(_0x380c08,null))['then'](function(_0x4c96ee){if(_0x4c96ee){_0xacd80=_0x4c96ee;_0xda8dda[_0xf5f2('0x3f')]=_['keys'](db[_0xf5f2('0x5a')][_0xf5f2('0x55')]);_0xda8dda[_0xf5f2('0x41')]=_[_0xf5f2('0x40')](_0x2e6f5d['query']);_0xda8dda[_0xf5f2('0x4b')]=_[_0xf5f2('0x42')](_0xda8dda[_0xf5f2('0x3f')],_0xda8dda[_0xf5f2('0x41')]);_0x5583c2[_0xf5f2('0x43')]=_[_0xf5f2('0x42')](_0xda8dda[_0xf5f2('0x3f')],qs['fields'](_0x2e6f5d[_0xf5f2('0x41')][_0xf5f2('0x44')]));_0x5583c2[_0xf5f2('0x43')]=_0x5583c2[_0xf5f2('0x43')]['length']?_0x5583c2[_0xf5f2('0x43')]:_0xda8dda['model'];_0x5583c2[_0xf5f2('0x48')]=qs[_0xf5f2('0x49')](_0x2e6f5d['query'][_0xf5f2('0x49')]);_0x5583c2[_0xf5f2('0x4a')]=qs[_0xf5f2('0x4b')](_[_0xf5f2('0x4c')](_0x2e6f5d[_0xf5f2('0x41')],_0xda8dda['filters']));if(_0x2e6f5d[_0xf5f2('0x41')][_0xf5f2('0x4d')]){_0x5583c2[_0xf5f2('0x4a')]=_[_0xf5f2('0x36')](_0x5583c2[_0xf5f2('0x4a')],{'$or':_[_0xf5f2('0x3b')](_0x5583c2['attributes'],function(_0x321d4d){var _0x3f475e={};_0x3f475e[_0x321d4d]={'$like':'%'+_0x2e6f5d['query'][_0xf5f2('0x4d')]+'%'};return _0x3f475e;})});}_0x5583c2=_[_0xf5f2('0x36')]({},_0x5583c2,_0x2e6f5d[_0xf5f2('0x4f')]);return _0xacd80['getFields'](_0x5583c2);}})['then'](function(_0x4f3df6){if(_0x4f3df6){_0x3461e5=_0x4f3df6[_0xf5f2('0x45')];if(!_0x2e6f5d[_0xf5f2('0x41')][_0xf5f2('0x46')](_0xf5f2('0x47'))){_0x5583c2[_0xf5f2('0x2c')]=qs['limit'](_0x2e6f5d[_0xf5f2('0x41')][_0xf5f2('0x2c')]);_0x5583c2[_0xf5f2('0x2a')]=qs[_0xf5f2('0x2a')](_0x2e6f5d[_0xf5f2('0x41')][_0xf5f2('0x2a')]);}return _0xacd80[_0xf5f2('0x58')](_0x5583c2);}})[_0xf5f2('0x1b')](function(_0x155f45){if(_0x155f45){return _0x155f45?{'count':_0x3461e5,'rows':_0x155f45}:null;}})[_0xf5f2('0x1b')](respondWithResult(_0x380c08,null))[_0xf5f2('0x26')](handleError(_0x380c08,null));};exports['getSubjects']=function(_0x5e4e07,_0x5a143f,_0x40f362){var _0xafba8e={};var _0x3d3181={};var _0x878e8b;var _0x1bb752;return db['Dynamics365Configuration'][_0xf5f2('0x59')]({'where':{'id':_0x5e4e07[_0xf5f2('0x54')]['id']}})[_0xf5f2('0x1b')](handleEntityNotFound(_0x5a143f,null))[_0xf5f2('0x1b')](function(_0x44d119){if(_0x44d119){_0x878e8b=_0x44d119;_0x3d3181['model']=_[_0xf5f2('0x40')](db[_0xf5f2('0x5a')]['rawAttributes']);_0x3d3181[_0xf5f2('0x41')]=_[_0xf5f2('0x40')](_0x5e4e07[_0xf5f2('0x41')]);_0x3d3181[_0xf5f2('0x4b')]=_['intersection'](_0x3d3181[_0xf5f2('0x3f')],_0x3d3181[_0xf5f2('0x41')]);_0xafba8e[_0xf5f2('0x43')]=_[_0xf5f2('0x42')](_0x3d3181[_0xf5f2('0x3f')],qs['fields'](_0x5e4e07['query'][_0xf5f2('0x44')]));_0xafba8e[_0xf5f2('0x43')]=_0xafba8e[_0xf5f2('0x43')][_0xf5f2('0x45')]?_0xafba8e['attributes']:_0x3d3181['model'];_0xafba8e[_0xf5f2('0x48')]=qs['sort'](_0x5e4e07['query']['sort']);_0xafba8e['where']=qs[_0xf5f2('0x4b')](_[_0xf5f2('0x4c')](_0x5e4e07[_0xf5f2('0x41')],_0x3d3181[_0xf5f2('0x4b')]));if(_0x5e4e07[_0xf5f2('0x41')][_0xf5f2('0x4d')]){_0xafba8e[_0xf5f2('0x4a')]=_[_0xf5f2('0x36')](_0xafba8e[_0xf5f2('0x4a')],{'$or':_[_0xf5f2('0x3b')](_0xafba8e[_0xf5f2('0x43')],function(_0x2afeac){var _0x1ba503={};_0x1ba503[_0x2afeac]={'$like':'%'+_0x5e4e07[_0xf5f2('0x41')][_0xf5f2('0x4d')]+'%'};return _0x1ba503;})});}_0xafba8e=_[_0xf5f2('0x36')]({},_0xafba8e,_0x5e4e07[_0xf5f2('0x4f')]);return _0x878e8b[_0xf5f2('0x5b')](_0xafba8e);}})['then'](function(_0xe7ac8){if(_0xe7ac8){_0x1bb752=_0xe7ac8[_0xf5f2('0x45')];if(!_0x5e4e07[_0xf5f2('0x41')][_0xf5f2('0x46')](_0xf5f2('0x47'))){_0xafba8e[_0xf5f2('0x2c')]=qs[_0xf5f2('0x2c')](_0x5e4e07[_0xf5f2('0x41')]['limit']);_0xafba8e[_0xf5f2('0x2a')]=qs['offset'](_0x5e4e07['query']['offset']);}return _0x878e8b['getSubjects'](_0xafba8e);}})['then'](function(_0x4dc9d0){if(_0x4dc9d0){return _0x4dc9d0?{'count':_0x1bb752,'rows':_0x4dc9d0}:null;}})[_0xf5f2('0x1b')](respondWithResult(_0x5a143f,null))[_0xf5f2('0x26')](handleError(_0x5a143f,null));};exports[_0xf5f2('0x5c')]=function(_0x375bc9,_0x145d4d,_0x3cf857){var _0x5dc63f={};var _0x4a0005={};var _0x2fb1a6;var _0x578a22;return db[_0xf5f2('0x50')][_0xf5f2('0x59')]({'where':{'id':_0x375bc9['params']['id']}})['then'](handleEntityNotFound(_0x145d4d,null))[_0xf5f2('0x1b')](function(_0x274aa3){if(_0x274aa3){_0x2fb1a6=_0x274aa3;_0x4a0005['model']=_[_0xf5f2('0x40')](db[_0xf5f2('0x5a')]['rawAttributes']);_0x4a0005[_0xf5f2('0x41')]=_[_0xf5f2('0x40')](_0x375bc9[_0xf5f2('0x41')]);_0x4a0005['filters']=_[_0xf5f2('0x42')](_0x4a0005[_0xf5f2('0x3f')],_0x4a0005[_0xf5f2('0x41')]);_0x5dc63f[_0xf5f2('0x43')]=_[_0xf5f2('0x42')](_0x4a0005[_0xf5f2('0x3f')],qs[_0xf5f2('0x44')](_0x375bc9[_0xf5f2('0x41')][_0xf5f2('0x44')]));_0x5dc63f[_0xf5f2('0x43')]=_0x5dc63f[_0xf5f2('0x43')][_0xf5f2('0x45')]?_0x5dc63f[_0xf5f2('0x43')]:_0x4a0005[_0xf5f2('0x3f')];_0x5dc63f[_0xf5f2('0x48')]=qs[_0xf5f2('0x49')](_0x375bc9[_0xf5f2('0x41')][_0xf5f2('0x49')]);_0x5dc63f[_0xf5f2('0x4a')]=qs[_0xf5f2('0x4b')](_[_0xf5f2('0x4c')](_0x375bc9['query'],_0x4a0005[_0xf5f2('0x4b')]));if(_0x375bc9[_0xf5f2('0x41')]['filter']){_0x5dc63f[_0xf5f2('0x4a')]=_[_0xf5f2('0x36')](_0x5dc63f['where'],{'$or':_[_0xf5f2('0x3b')](_0x5dc63f[_0xf5f2('0x43')],function(_0x335d9b){var _0x50474a={};_0x50474a[_0x335d9b]={'$like':'%'+_0x375bc9['query'][_0xf5f2('0x4d')]+'%'};return _0x50474a;})});}_0x5dc63f=_[_0xf5f2('0x36')]({},_0x5dc63f,_0x375bc9[_0xf5f2('0x4f')]);return _0x2fb1a6['getDescriptions'](_0x5dc63f);}})['then'](function(_0x2572c0){if(_0x2572c0){_0x578a22=_0x2572c0[_0xf5f2('0x45')];if(!_0x375bc9[_0xf5f2('0x41')]['hasOwnProperty']('nolimit')){_0x5dc63f['limit']=qs['limit'](_0x375bc9['query'][_0xf5f2('0x2c')]);_0x5dc63f['offset']=qs[_0xf5f2('0x2a')](_0x375bc9[_0xf5f2('0x41')][_0xf5f2('0x2a')]);}return _0x2fb1a6[_0xf5f2('0x5c')](_0x5dc63f);}})[_0xf5f2('0x1b')](function(_0x398f2b){if(_0x398f2b){return _0x398f2b?{'count':_0x578a22,'rows':_0x398f2b}:null;}})[_0xf5f2('0x1b')](respondWithResult(_0x145d4d,null))[_0xf5f2('0x26')](handleError(_0x145d4d,null));}; \ No newline at end of file +var _0xbaf0=['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','jayson/promise','client','http','request','then','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','sendStatus','name','send','render','merge','contact','interaction','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne','Dynamics365Field','length','getSubjects','nolimit','getDescriptions','rimraf','zip-dir'];(function(_0x12bb35,_0x12ba36){var _0x48bbfe=function(_0x1c0a7a){while(--_0x1c0a7a){_0x12bb35['push'](_0x12bb35['shift']());}};_0x48bbfe(++_0x12ba36);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'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'];var jayson=require(_0x0baf('0x1b'));var client=jayson[_0x0baf('0x1c')][_0x0baf('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x13df17,_0x5a0583,_0x2ab33e,_0x49e44b){return new BPromise(function(_0x1c76a8,_0x1f50c3){var _0x7fbf67=_0x49e44b||client;return _0x7fbf67[_0x0baf('0x1e')](_0x13df17,_0x2ab33e)[_0x0baf('0x1f')](function(_0x469599){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x5a0583,_0x0baf('0x20'));logger[_0x0baf('0x21')](_0x0baf('0x22'),_0x5a0583,_0x0baf('0x20'),JSON[_0x0baf('0x23')](_0x469599));if(_0x469599[_0x0baf('0x24')]){if(_0x469599['error'][_0x0baf('0x25')]===0x1f4){logger[_0x0baf('0x24')](_0x0baf('0x26'),_0x5a0583,_0x469599[_0x0baf('0x24')][_0x0baf('0x27')]);return _0x1f50c3(_0x469599[_0x0baf('0x24')]['message']);}logger['error'](_0x0baf('0x26'),_0x5a0583,_0x469599[_0x0baf('0x24')][_0x0baf('0x27')]);return _0x1c76a8(_0x469599[_0x0baf('0x24')][_0x0baf('0x27')]);}else{logger[_0x0baf('0x28')](_0x0baf('0x26'),_0x5a0583,_0x0baf('0x20'));_0x1c76a8(_0x469599[_0x0baf('0x29')][_0x0baf('0x27')]);}})['catch'](function(_0x334bd6){logger['error'](_0x0baf('0x26'),_0x5a0583,_0x334bd6);_0x1f50c3(_0x334bd6);});});}function respondWithStatusCode(_0x5dbf00,_0x4de74c){_0x4de74c=_0x4de74c||0xcc;return function(_0x2ef0aa){if(_0x2ef0aa){return _0x5dbf00['sendStatus'](_0x4de74c);}return _0x5dbf00['status'](_0x4de74c)[_0x0baf('0x2a')]();};}function respondWithResult(_0x27b59c,_0x34e264){_0x34e264=_0x34e264||0xc8;return function(_0x19d9fd){if(_0x19d9fd){return _0x27b59c[_0x0baf('0x2b')](_0x34e264)['json'](_0x19d9fd);}};}function respondWithFilteredResult(_0x448617,_0x4681c5){return function(_0x1ca35a){if(_0x1ca35a){var _0x366e71=typeof _0x4681c5[_0x0baf('0x2c')]===_0x0baf('0x2d')&&typeof _0x4681c5[_0x0baf('0x2e')]==='undefined';var _0x1590b4=_0x1ca35a[_0x0baf('0x2f')];var _0xcaf13d=_0x366e71?0x0:_0x4681c5[_0x0baf('0x2c')];var _0x55c715=_0x366e71?_0x1ca35a[_0x0baf('0x2f')]:_0x4681c5[_0x0baf('0x2c')]+_0x4681c5['limit'];var _0x44ec31;if(_0x55c715>=_0x1590b4){_0x55c715=_0x1590b4;_0x44ec31=0xc8;}else{_0x44ec31=0xce;}_0x448617[_0x0baf('0x2b')](_0x44ec31);return _0x448617[_0x0baf('0x30')](_0x0baf('0x31'),_0xcaf13d+'-'+_0x55c715+'/'+_0x1590b4)[_0x0baf('0x32')](_0x1ca35a);}return null;};}function patchUpdates(_0x366924){return function(_0x213a6a){try{jsonpatch['apply'](_0x213a6a,_0x366924,!![]);}catch(_0xe92c2c){return BPromise[_0x0baf('0x33')](_0xe92c2c);}return _0x213a6a[_0x0baf('0x34')]();};}function saveUpdates(_0x3ed995,_0x24ecee){return function(_0x275ea1){if(_0x275ea1){return _0x275ea1[_0x0baf('0x35')](_0x3ed995)[_0x0baf('0x1f')](function(_0x59431b){return _0x59431b;});}return null;};}function removeEntity(_0x3ded64,_0x2adfd7){return function(_0x165d14){if(_0x165d14){return _0x165d14[_0x0baf('0x36')]()[_0x0baf('0x1f')](function(){_0x3ded64['status'](0xcc)[_0x0baf('0x2a')]();});}};}function handleEntityNotFound(_0x53ae1d,_0x1aa474){return function(_0x2b205b){if(!_0x2b205b){_0x53ae1d[_0x0baf('0x37')](0x194);}return _0x2b205b;};}function handleError(_0x3d65f2,_0x5300a5){_0x5300a5=_0x5300a5||0x1f4;return function(_0x1a2b03){logger[_0x0baf('0x24')](_0x1a2b03['stack']);if(_0x1a2b03[_0x0baf('0x38')]){delete _0x1a2b03[_0x0baf('0x38')];}_0x3d65f2[_0x0baf('0x2b')](_0x5300a5)[_0x0baf('0x39')](_0x1a2b03);};}function getMustacheRender(_0x1f60bd,_0x1b0991){return Mustache[_0x0baf('0x3a')](_0x1f60bd,_[_0x0baf('0x3b')](_0x1b0991['body'],{'contact':_0x1b0991[_0x0baf('0x3c')],'message':_0x1b0991[_0x0baf('0x27')],'agent':_0x1b0991['agent'],'interaction':_0x1b0991[_0x0baf('0x3d')],'account':_0x1b0991['account']}))||'';}exports['index']=function(_0x11bc49,_0x81af83){var _0x5d3ad1={},_0x49e792={},_0x628603={'count':0x0,'rows':[]};var _0x2243f1=_[_0x0baf('0x3e')](db[_0x0baf('0x3f')][_0x0baf('0x40')],function(_0x2028ad){return{'name':_0x2028ad[_0x0baf('0x41')],'type':_0x2028ad[_0x0baf('0x42')][_0x0baf('0x43')]};});_0x49e792[_0x0baf('0x44')]=_[_0x0baf('0x3e')](_0x2243f1,_0x0baf('0x38'));_0x49e792[_0x0baf('0x45')]=_[_0x0baf('0x46')](_0x11bc49['query']);_0x49e792[_0x0baf('0x47')]=_[_0x0baf('0x48')](_0x49e792['model'],_0x49e792[_0x0baf('0x45')]);_0x5d3ad1[_0x0baf('0x49')]=_[_0x0baf('0x48')](_0x49e792[_0x0baf('0x44')],qs[_0x0baf('0x4a')](_0x11bc49[_0x0baf('0x45')]['fields']));_0x5d3ad1[_0x0baf('0x49')]=_0x5d3ad1[_0x0baf('0x49')]['length']?_0x5d3ad1[_0x0baf('0x49')]:_0x49e792[_0x0baf('0x44')];if(!_0x11bc49[_0x0baf('0x45')][_0x0baf('0x4b')]('nolimit')){_0x5d3ad1[_0x0baf('0x2e')]=qs[_0x0baf('0x2e')](_0x11bc49[_0x0baf('0x45')][_0x0baf('0x2e')]);_0x5d3ad1[_0x0baf('0x2c')]=qs[_0x0baf('0x2c')](_0x11bc49[_0x0baf('0x45')][_0x0baf('0x2c')]);}_0x5d3ad1[_0x0baf('0x4c')]=qs[_0x0baf('0x4d')](_0x11bc49['query'][_0x0baf('0x4d')]);_0x5d3ad1[_0x0baf('0x4e')]=qs[_0x0baf('0x47')](_[_0x0baf('0x4f')](_0x11bc49[_0x0baf('0x45')],_0x49e792['filters']),_0x2243f1);if(_0x11bc49[_0x0baf('0x45')][_0x0baf('0x50')]){_0x5d3ad1[_0x0baf('0x4e')]=_[_0x0baf('0x3b')](_0x5d3ad1[_0x0baf('0x4e')],{'$or':_['map'](_0x2243f1,function(_0x2a0924){if(_0x2a0924[_0x0baf('0x42')]!==_0x0baf('0x51')){var _0x1522b0={};_0x1522b0[_0x2a0924[_0x0baf('0x38')]]={'$like':'%'+_0x11bc49[_0x0baf('0x45')][_0x0baf('0x50')]+'%'};return _0x1522b0;}})});}_0x5d3ad1=_['merge']({},_0x5d3ad1,_0x11bc49[_0x0baf('0x52')]);var _0x167fb8={'where':_0x5d3ad1[_0x0baf('0x4e')]};return db['Dynamics365Configuration'][_0x0baf('0x2f')](_0x167fb8)[_0x0baf('0x1f')](function(_0x10fa62){_0x628603[_0x0baf('0x2f')]=_0x10fa62;if(_0x11bc49[_0x0baf('0x45')][_0x0baf('0x53')]){_0x5d3ad1[_0x0baf('0x54')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x0baf('0x55')](_0x5d3ad1);})[_0x0baf('0x1f')](function(_0x214a1d){_0x628603[_0x0baf('0x56')]=_0x214a1d;return _0x628603;})[_0x0baf('0x1f')](respondWithFilteredResult(_0x81af83,_0x5d3ad1))[_0x0baf('0x57')](handleError(_0x81af83,null));};exports[_0x0baf('0x58')]=function(_0x1af4aa,_0x2be7fe){var _0x19c008={'raw':![],'where':{'id':_0x1af4aa['params']['id']}},_0x2c6cdf={};_0x2c6cdf['model']=_[_0x0baf('0x46')](db[_0x0baf('0x3f')][_0x0baf('0x40')]);_0x2c6cdf[_0x0baf('0x45')]=_[_0x0baf('0x46')](_0x1af4aa[_0x0baf('0x45')]);_0x2c6cdf[_0x0baf('0x47')]=_['intersection'](_0x2c6cdf[_0x0baf('0x44')],_0x2c6cdf[_0x0baf('0x45')]);_0x19c008[_0x0baf('0x49')]=_[_0x0baf('0x48')](_0x2c6cdf[_0x0baf('0x44')],qs[_0x0baf('0x4a')](_0x1af4aa['query'][_0x0baf('0x4a')]));_0x19c008['attributes']=_0x19c008[_0x0baf('0x49')]['length']?_0x19c008[_0x0baf('0x49')]:_0x2c6cdf['model'];if(_0x1af4aa[_0x0baf('0x45')]['includeAll']){_0x19c008[_0x0baf('0x54')]=[{'all':!![]}];}_0x19c008=_[_0x0baf('0x3b')]({},_0x19c008,_0x1af4aa[_0x0baf('0x52')]);return db[_0x0baf('0x3f')][_0x0baf('0x59')](_0x19c008)['then'](handleEntityNotFound(_0x2be7fe,null))[_0x0baf('0x1f')](respondWithResult(_0x2be7fe,null))[_0x0baf('0x57')](handleError(_0x2be7fe,null));};exports[_0x0baf('0x5a')]=function(_0xb45360,_0x5fbabf){return db[_0x0baf('0x3f')]['create'](_0xb45360[_0x0baf('0x5b')],{})[_0x0baf('0x1f')](respondWithResult(_0x5fbabf,0xc9))[_0x0baf('0x57')](handleError(_0x5fbabf,null));};exports[_0x0baf('0x35')]=function(_0xbc7cc2,_0x1a7ffb){if(_0xbc7cc2[_0x0baf('0x5b')]['id']){delete _0xbc7cc2['body']['id'];}return db['Dynamics365Configuration'][_0x0baf('0x59')]({'where':{'id':_0xbc7cc2[_0x0baf('0x5c')]['id']}})[_0x0baf('0x1f')](handleEntityNotFound(_0x1a7ffb,null))[_0x0baf('0x1f')](saveUpdates(_0xbc7cc2[_0x0baf('0x5b')],null))[_0x0baf('0x1f')](respondWithResult(_0x1a7ffb,null))[_0x0baf('0x57')](handleError(_0x1a7ffb,null));};exports[_0x0baf('0x36')]=function(_0x3d9a32,_0x585969){return db[_0x0baf('0x3f')][_0x0baf('0x59')]({'where':{'id':_0x3d9a32[_0x0baf('0x5c')]['id']}})[_0x0baf('0x1f')](handleEntityNotFound(_0x585969,null))[_0x0baf('0x1f')](removeEntity(_0x585969,null))[_0x0baf('0x57')](handleError(_0x585969,null));};exports[_0x0baf('0x5d')]=function(_0x51d75f,_0x17189d,_0x27f580){var _0x437980={};var _0x37f313={};var _0x1c7d88;var _0x1a6d22;return db[_0x0baf('0x3f')][_0x0baf('0x5e')]({'where':{'id':_0x51d75f['params']['id']}})[_0x0baf('0x1f')](handleEntityNotFound(_0x17189d,null))['then'](function(_0x3c00e7){if(_0x3c00e7){_0x1c7d88=_0x3c00e7;_0x37f313['model']=_['keys'](db[_0x0baf('0x5f')]['rawAttributes']);_0x37f313[_0x0baf('0x45')]=_[_0x0baf('0x46')](_0x51d75f['query']);_0x37f313[_0x0baf('0x47')]=_[_0x0baf('0x48')](_0x37f313[_0x0baf('0x44')],_0x37f313['query']);_0x437980['attributes']=_[_0x0baf('0x48')](_0x37f313[_0x0baf('0x44')],qs[_0x0baf('0x4a')](_0x51d75f[_0x0baf('0x45')][_0x0baf('0x4a')]));_0x437980['attributes']=_0x437980[_0x0baf('0x49')]['length']?_0x437980['attributes']:_0x37f313['model'];_0x437980[_0x0baf('0x4c')]=qs['sort'](_0x51d75f['query'][_0x0baf('0x4d')]);_0x437980[_0x0baf('0x4e')]=qs[_0x0baf('0x47')](_[_0x0baf('0x4f')](_0x51d75f[_0x0baf('0x45')],_0x37f313[_0x0baf('0x47')]));if(_0x51d75f['query'][_0x0baf('0x50')]){_0x437980[_0x0baf('0x4e')]=_[_0x0baf('0x3b')](_0x437980[_0x0baf('0x4e')],{'$or':_[_0x0baf('0x3e')](_0x437980[_0x0baf('0x49')],function(_0x5cf3d3){var _0x42e8ad={};_0x42e8ad[_0x5cf3d3]={'$like':'%'+_0x51d75f[_0x0baf('0x45')][_0x0baf('0x50')]+'%'};return _0x42e8ad;})});}_0x437980=_['merge']({},_0x437980,_0x51d75f[_0x0baf('0x52')]);return _0x1c7d88[_0x0baf('0x5d')](_0x437980);}})[_0x0baf('0x1f')](function(_0x2c20fe){if(_0x2c20fe){_0x1a6d22=_0x2c20fe[_0x0baf('0x60')];if(!_0x51d75f[_0x0baf('0x45')][_0x0baf('0x4b')]('nolimit')){_0x437980['limit']=qs['limit'](_0x51d75f[_0x0baf('0x45')][_0x0baf('0x2e')]);_0x437980[_0x0baf('0x2c')]=qs[_0x0baf('0x2c')](_0x51d75f[_0x0baf('0x45')][_0x0baf('0x2c')]);}return _0x1c7d88['getFields'](_0x437980);}})['then'](function(_0x34c1f4){if(_0x34c1f4){return _0x34c1f4?{'count':_0x1a6d22,'rows':_0x34c1f4}:null;}})['then'](respondWithResult(_0x17189d,null))[_0x0baf('0x57')](handleError(_0x17189d,null));};exports[_0x0baf('0x61')]=function(_0x4cca39,_0xf45ec3,_0x44dfe2){var _0x147f98={};var _0xb1d719={};var _0x115ff5;var _0x33a5af;return db[_0x0baf('0x3f')][_0x0baf('0x5e')]({'where':{'id':_0x4cca39[_0x0baf('0x5c')]['id']}})['then'](handleEntityNotFound(_0xf45ec3,null))['then'](function(_0x58a079){if(_0x58a079){_0x115ff5=_0x58a079;_0xb1d719['model']=_['keys'](db[_0x0baf('0x5f')][_0x0baf('0x40')]);_0xb1d719[_0x0baf('0x45')]=_[_0x0baf('0x46')](_0x4cca39['query']);_0xb1d719[_0x0baf('0x47')]=_[_0x0baf('0x48')](_0xb1d719['model'],_0xb1d719['query']);_0x147f98[_0x0baf('0x49')]=_[_0x0baf('0x48')](_0xb1d719[_0x0baf('0x44')],qs[_0x0baf('0x4a')](_0x4cca39[_0x0baf('0x45')][_0x0baf('0x4a')]));_0x147f98[_0x0baf('0x49')]=_0x147f98[_0x0baf('0x49')]['length']?_0x147f98[_0x0baf('0x49')]:_0xb1d719[_0x0baf('0x44')];_0x147f98['order']=qs[_0x0baf('0x4d')](_0x4cca39[_0x0baf('0x45')]['sort']);_0x147f98[_0x0baf('0x4e')]=qs[_0x0baf('0x47')](_[_0x0baf('0x4f')](_0x4cca39[_0x0baf('0x45')],_0xb1d719[_0x0baf('0x47')]));if(_0x4cca39['query']['filter']){_0x147f98[_0x0baf('0x4e')]=_[_0x0baf('0x3b')](_0x147f98['where'],{'$or':_[_0x0baf('0x3e')](_0x147f98[_0x0baf('0x49')],function(_0x21ad25){var _0x574833={};_0x574833[_0x21ad25]={'$like':'%'+_0x4cca39[_0x0baf('0x45')][_0x0baf('0x50')]+'%'};return _0x574833;})});}_0x147f98=_[_0x0baf('0x3b')]({},_0x147f98,_0x4cca39['options']);return _0x115ff5[_0x0baf('0x61')](_0x147f98);}})['then'](function(_0x316397){if(_0x316397){_0x33a5af=_0x316397[_0x0baf('0x60')];if(!_0x4cca39[_0x0baf('0x45')][_0x0baf('0x4b')](_0x0baf('0x62'))){_0x147f98['limit']=qs[_0x0baf('0x2e')](_0x4cca39[_0x0baf('0x45')]['limit']);_0x147f98[_0x0baf('0x2c')]=qs[_0x0baf('0x2c')](_0x4cca39[_0x0baf('0x45')][_0x0baf('0x2c')]);}return _0x115ff5[_0x0baf('0x61')](_0x147f98);}})[_0x0baf('0x1f')](function(_0xa4fd1b){if(_0xa4fd1b){return _0xa4fd1b?{'count':_0x33a5af,'rows':_0xa4fd1b}:null;}})[_0x0baf('0x1f')](respondWithResult(_0xf45ec3,null))[_0x0baf('0x57')](handleError(_0xf45ec3,null));};exports[_0x0baf('0x63')]=function(_0x3b7abf,_0x2c2f09,_0x5985f9){var _0x599ac0={};var _0x29a036={};var _0x322a09;var _0x384c29;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x3b7abf[_0x0baf('0x5c')]['id']}})[_0x0baf('0x1f')](handleEntityNotFound(_0x2c2f09,null))[_0x0baf('0x1f')](function(_0x371b78){if(_0x371b78){_0x322a09=_0x371b78;_0x29a036[_0x0baf('0x44')]=_[_0x0baf('0x46')](db[_0x0baf('0x5f')][_0x0baf('0x40')]);_0x29a036[_0x0baf('0x45')]=_['keys'](_0x3b7abf[_0x0baf('0x45')]);_0x29a036[_0x0baf('0x47')]=_[_0x0baf('0x48')](_0x29a036[_0x0baf('0x44')],_0x29a036['query']);_0x599ac0['attributes']=_['intersection'](_0x29a036[_0x0baf('0x44')],qs[_0x0baf('0x4a')](_0x3b7abf['query']['fields']));_0x599ac0[_0x0baf('0x49')]=_0x599ac0[_0x0baf('0x49')]['length']?_0x599ac0[_0x0baf('0x49')]:_0x29a036[_0x0baf('0x44')];_0x599ac0[_0x0baf('0x4c')]=qs[_0x0baf('0x4d')](_0x3b7abf[_0x0baf('0x45')][_0x0baf('0x4d')]);_0x599ac0[_0x0baf('0x4e')]=qs[_0x0baf('0x47')](_[_0x0baf('0x4f')](_0x3b7abf[_0x0baf('0x45')],_0x29a036[_0x0baf('0x47')]));if(_0x3b7abf[_0x0baf('0x45')]['filter']){_0x599ac0[_0x0baf('0x4e')]=_[_0x0baf('0x3b')](_0x599ac0[_0x0baf('0x4e')],{'$or':_[_0x0baf('0x3e')](_0x599ac0[_0x0baf('0x49')],function(_0x195303){var _0x49d411={};_0x49d411[_0x195303]={'$like':'%'+_0x3b7abf[_0x0baf('0x45')][_0x0baf('0x50')]+'%'};return _0x49d411;})});}_0x599ac0=_[_0x0baf('0x3b')]({},_0x599ac0,_0x3b7abf[_0x0baf('0x52')]);return _0x322a09[_0x0baf('0x63')](_0x599ac0);}})['then'](function(_0x3761b5){if(_0x3761b5){_0x384c29=_0x3761b5[_0x0baf('0x60')];if(!_0x3b7abf[_0x0baf('0x45')][_0x0baf('0x4b')](_0x0baf('0x62'))){_0x599ac0['limit']=qs['limit'](_0x3b7abf[_0x0baf('0x45')]['limit']);_0x599ac0[_0x0baf('0x2c')]=qs['offset'](_0x3b7abf[_0x0baf('0x45')][_0x0baf('0x2c')]);}return _0x322a09[_0x0baf('0x63')](_0x599ac0);}})[_0x0baf('0x1f')](function(_0x4f4385){if(_0x4f4385){return _0x4f4385?{'count':_0x384c29,'rows':_0x4f4385}:null;}})[_0x0baf('0x1f')](respondWithResult(_0x2c2f09,null))[_0x0baf('0x57')](handleError(_0x2c2f09,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 5beaf04..4c4a715 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 _0xed52=['int_dynamics365_configurations','lodash','api','bluebird','path','rimraf','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration'];(function(_0x1c0991,_0x4f22d2){var _0x5034de=function(_0x520f49){while(--_0x520f49){_0x1c0991['push'](_0x1c0991['shift']());}};_0x5034de(++_0x4f22d2);}(_0xed52,0x12d));var _0x2ed5=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xed52[_0x521929];return _0x632436;};'use strict';var _=require(_0x2ed5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2ed5('0x1'));var moment=require('moment');var BPromise=require(_0x2ed5('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ed5('0x3'));var rimraf=require(_0x2ed5('0x4'));var config=require('../../config/environment');var attributes=require(_0x2ed5('0x5'));module[_0x2ed5('0x6')]=function(_0x12eb85,_0x20af3b){return _0x12eb85[_0x2ed5('0x7')](_0x2ed5('0x8'),attributes,{'tableName':_0x2ed5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb41e=['Dynamics365Configuration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x3f3f19,_0x18179b){var _0x2214f3=function(_0x29cec4){while(--_0x29cec4){_0x3f3f19['push'](_0x3f3f19['shift']());}};_0x2214f3(++_0x18179b);}(_0xb41e,0x1f0));var _0xeb41=function(_0x463d71,_0x4cd285){_0x463d71=_0x463d71-0x0;var _0x5f4d10=_0xb41e[_0x463d71];return _0x5f4d10;};'use strict';var _=require(_0xeb41('0x0'));var util=require('util');var logger=require(_0xeb41('0x1'))(_0xeb41('0x2'));var moment=require(_0xeb41('0x3'));var BPromise=require(_0xeb41('0x4'));var rp=require(_0xeb41('0x5'));var fs=require('fs');var path=require(_0xeb41('0x6'));var rimraf=require('rimraf');var config=require(_0xeb41('0x7'));var attributes=require(_0xeb41('0x8'));module[_0xeb41('0x9')]=function(_0x2c29a8,_0x265fe7){return _0x2c29a8['define'](_0xeb41('0xa'),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 92725c2..71fbab3 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 _0xcd8d=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xcd8d,0x197));var _0xdcd8=function(_0x31df6f,_0x380e73){_0x31df6f=_0x31df6f-0x0;var _0x31e353=_0xcd8d[_0x31df6f];return _0x31e353;};'use strict';var _=require(_0xdcd8('0x0'));var util=require(_0xdcd8('0x1'));var moment=require(_0xdcd8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcd8('0x3'));var db=require(_0xdcd8('0x4'))['db'];var utils=require(_0xdcd8('0x5'));var logger=require('../../config/logger')(_0xdcd8('0x6'));var config=require(_0xdcd8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdcd8('0x8')][_0xdcd8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc7ba06,_0x394488,_0x1f55ba){return new BPromise(function(_0x48be35,_0xeafccc){return client['request'](_0xc7ba06,_0x1f55ba)['then'](function(_0x3a26d3){logger[_0xdcd8('0xa')](_0xdcd8('0xb'),_0x394488,_0xdcd8('0xc'));logger[_0xdcd8('0xd')](_0xdcd8('0xe'),_0x394488,_0xdcd8('0xc'),JSON[_0xdcd8('0xf')](_0x3a26d3));if(_0x3a26d3[_0xdcd8('0x10')]){if(_0x3a26d3[_0xdcd8('0x10')]['code']===0x1f4){logger[_0xdcd8('0x10')](_0xdcd8('0xb'),_0x394488,_0x3a26d3[_0xdcd8('0x10')][_0xdcd8('0x11')]);return _0xeafccc(_0x3a26d3[_0xdcd8('0x10')][_0xdcd8('0x11')]);}logger['error'](_0xdcd8('0xb'),_0x394488,_0x3a26d3[_0xdcd8('0x10')][_0xdcd8('0x11')]);return _0x48be35(_0x3a26d3[_0xdcd8('0x10')][_0xdcd8('0x11')]);}else{logger['info'](_0xdcd8('0xb'),_0x394488,'request\x20sent');_0x48be35(_0x3a26d3[_0xdcd8('0x12')][_0xdcd8('0x11')]);}})[_0xdcd8('0x13')](function(_0x1d90b2){logger[_0xdcd8('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x394488,_0x1d90b2);_0xeafccc(_0x1d90b2);});});} \ No newline at end of file +var _0x21e8=['../../config/environment','jayson/promise','client','http','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x21e8,0x1db));var _0x821e=function(_0x927da7,_0x2e04ee){_0x927da7=_0x927da7-0x0;var _0x2ea06c=_0x21e8[_0x927da7];return _0x2ea06c;};'use strict';var _=require(_0x821e('0x0'));var util=require(_0x821e('0x1'));var moment=require(_0x821e('0x2'));var BPromise=require(_0x821e('0x3'));var rs=require(_0x821e('0x4'));var fs=require('fs');var Redis=require(_0x821e('0x5'));var db=require(_0x821e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x821e('0x7'))(_0x821e('0x8'));var config=require(_0x821e('0x9'));var jayson=require(_0x821e('0xa'));var client=jayson[_0x821e('0xb')][_0x821e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55e811,_0x3ab16d,_0x4dbca9){return new BPromise(function(_0x47524d,_0x344fe5){return client['request'](_0x55e811,_0x4dbca9)['then'](function(_0x30be8c){logger[_0x821e('0xd')](_0x821e('0xe'),_0x3ab16d,_0x821e('0xf'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3ab16d,_0x821e('0xf'),JSON[_0x821e('0x10')](_0x30be8c));if(_0x30be8c[_0x821e('0x11')]){if(_0x30be8c[_0x821e('0x11')][_0x821e('0x12')]===0x1f4){logger[_0x821e('0x11')](_0x821e('0xe'),_0x3ab16d,_0x30be8c[_0x821e('0x11')][_0x821e('0x13')]);return _0x344fe5(_0x30be8c[_0x821e('0x11')][_0x821e('0x13')]);}logger[_0x821e('0x11')](_0x821e('0xe'),_0x3ab16d,_0x30be8c[_0x821e('0x11')][_0x821e('0x13')]);return _0x47524d(_0x30be8c[_0x821e('0x11')][_0x821e('0x13')]);}else{logger[_0x821e('0xd')](_0x821e('0xe'),_0x3ab16d,'request\x20sent');_0x47524d(_0x30be8c[_0x821e('0x14')][_0x821e('0x13')]);}})[_0x821e('0x15')](function(_0x27e8d9){logger[_0x821e('0x11')](_0x821e('0xe'),_0x3ab16d,_0x27e8d9);_0x344fe5(_0x27e8d9);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 83d4c34..9049e7e 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 _0xa73a=['../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','create','put','destroy','util','path','connect-timeout','express','Router'];(function(_0x457e9f,_0x4fbeee){var _0x5e72e6=function(_0xe7e24b){while(--_0xe7e24b){_0x457e9f['push'](_0x457e9f['shift']());}};_0x5e72e6(++_0x4fbeee);}(_0xa73a,0x82));var _0xaa73=function(_0x1e53ca,_0x2692ed){_0x1e53ca=_0x1e53ca-0x0;var _0x55e658=_0xa73a[_0x1e53ca];return _0x55e658;};'use strict';var multer=require('multer');var util=require(_0xaa73('0x0'));var path=require(_0xaa73('0x1'));var timeout=require(_0xaa73('0x2'));var express=require(_0xaa73('0x3'));var router=express[_0xaa73('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaa73('0x5'));var controller=require(_0xaa73('0x6'));router[_0xaa73('0x7')]('/',auth[_0xaa73('0x8')](),controller[_0xaa73('0x9')]);router[_0xaa73('0x7')](_0xaa73('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xaa73('0xb')]('/',auth[_0xaa73('0x8')](),controller[_0xaa73('0xc')]);router[_0xaa73('0xd')](_0xaa73('0xa'),auth[_0xaa73('0x8')](),controller['update']);router['delete'](_0xaa73('0xa'),auth['isAuthenticated'](),controller[_0xaa73('0xe')]);module['exports']=router; \ No newline at end of file +var _0xfa4b=['/:id','isAuthenticated','show','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index'];(function(_0x4a9a28,_0x18c27f){var _0x3b29e1=function(_0x2c6109){while(--_0x2c6109){_0x4a9a28['push'](_0x4a9a28['shift']());}};_0x3b29e1(++_0x18c27f);}(_0xfa4b,0x175));var _0xbfa4=function(_0xa0c6b5,_0x1d9855){_0xa0c6b5=_0xa0c6b5-0x0;var _0x4b4fb3=_0xfa4b[_0xa0c6b5];return _0x4b4fb3;};'use strict';var multer=require(_0xbfa4('0x0'));var util=require(_0xbfa4('0x1'));var path=require(_0xbfa4('0x2'));var timeout=require(_0xbfa4('0x3'));var express=require(_0xbfa4('0x4'));var router=express[_0xbfa4('0x5')]();var fs_extra=require(_0xbfa4('0x6'));var auth=require(_0xbfa4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbfa4('0x8'));var controller=require('./intDynamics365Field.controller');router[_0xbfa4('0x9')]('/',auth['isAuthenticated'](),controller[_0xbfa4('0xa')]);router[_0xbfa4('0x9')](_0xbfa4('0xb'),auth[_0xbfa4('0xc')](),controller[_0xbfa4('0xd')]);router['post']('/',auth[_0xbfa4('0xc')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xbfa4('0xe')]);router['delete'](_0xbfa4('0xb'),auth[_0xbfa4('0xc')](),controller[_0xbfa4('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 3dd4d8f..99be48b 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 _0xae24=['BOOLEAN','sequelize','ENUM','variable','customVariable','string','STRING'];(function(_0x514c15,_0x486901){var _0x16283e=function(_0x53b7d0){while(--_0x53b7d0){_0x514c15['push'](_0x514c15['shift']());}};_0x16283e(++_0x486901);}(_0xae24,0x182));var _0x4ae2=function(_0x5b118a,_0x32c146){_0x5b118a=_0x5b118a-0x0;var _0x5b1f6c=_0xae24[_0x5b118a];return _0x5b1f6c;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'type':{'type':Sequelize[_0x4ae2('0x1')]('string',_0x4ae2('0x2'),_0x4ae2('0x3'),'keyValue','picklist'),'defaultValue':_0x4ae2('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4ae2('0x5')]},'keyType':{'type':Sequelize[_0x4ae2('0x1')](_0x4ae2('0x4'),_0x4ae2('0x2'),_0x4ae2('0x3'))},'keyContent':{'type':Sequelize[_0x4ae2('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4ae2('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xac9d=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x21bf0f,_0x512d7c){var _0x19410e=function(_0x33013){while(--_0x33013){_0x21bf0f['push'](_0x21bf0f['shift']());}};_0x19410e(++_0x512d7c);}(_0xac9d,0x14d));var _0xdac9=function(_0x568cf0,_0x1a44cb){_0x568cf0=_0x568cf0-0x0;var _0x360f81=_0xac9d[_0x568cf0];return _0x360f81;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'type':{'type':Sequelize[_0xdac9('0x2')](_0xdac9('0x3'),_0xdac9('0x4'),_0xdac9('0x5'),_0xdac9('0x6'),_0xdac9('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xdac9('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xdac9('0x2')](_0xdac9('0x3'),_0xdac9('0x4'),_0xdac9('0x5'))},'keyContent':{'type':Sequelize[_0xdac9('0x8')]},'idField':{'type':Sequelize[_0xdac9('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xdac9('0x9')],'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 9031ea6..03565de 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 _0xc3ca=['Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','render','merge','contact','message','agent','interaction','account','map','rawAttributes','type','key','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','Dynamics365Field','includeAll','include','params','keys','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset'];(function(_0x2d982d,_0x121028){var _0x4f36b0=function(_0x11f3a9){while(--_0x11f3a9){_0x2d982d['push'](_0x2d982d['shift']());}};_0x4f36b0(++_0x121028);}(_0xc3ca,0x1bf));var _0xac3c=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xc3ca[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require(_0xac3c('0x0'));var rimraf=require(_0xac3c('0x1'));var zipdir=require(_0xac3c('0x2'));var jsonpatch=require(_0xac3c('0x3'));var rp=require(_0xac3c('0x4'));var moment=require('moment');var BPromise=require(_0xac3c('0x5'));var Mustache=require(_0xac3c('0x6'));var util=require(_0xac3c('0x7'));var path=require(_0xac3c('0x8'));var sox=require(_0xac3c('0x9'));var csv=require(_0xac3c('0xa'));var ejs=require(_0xac3c('0xb'));var fs=require('fs');var fs_extra=require(_0xac3c('0xc'));var _=require('lodash');var squel=require(_0xac3c('0xd'));var crypto=require(_0xac3c('0xe'));var jsforce=require(_0xac3c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xac3c('0xa'));var querystring=require(_0xac3c('0x10'));var Papa=require(_0xac3c('0x11'));var Redis=require(_0xac3c('0x12'));var authService=require(_0xac3c('0x13'));var qs=require(_0xac3c('0x14'));var as=require(_0xac3c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac3c('0x16'))(_0xac3c('0x17'));var utils=require('../../config/utils');var config=require(_0xac3c('0x18'));var licenseUtil=require(_0xac3c('0x19'));var db=require(_0xac3c('0x1a'))['db'];function respondWithStatusCode(_0x25c0c3,_0x51cd2b){_0x51cd2b=_0x51cd2b||0xcc;return function(_0x29e544){if(_0x29e544){return _0x25c0c3['sendStatus'](_0x51cd2b);}return _0x25c0c3[_0xac3c('0x1b')](_0x51cd2b)[_0xac3c('0x1c')]();};}function respondWithResult(_0x5f385c,_0x111e8c){_0x111e8c=_0x111e8c||0xc8;return function(_0x48101e){if(_0x48101e){return _0x5f385c[_0xac3c('0x1b')](_0x111e8c)['json'](_0x48101e);}};}function respondWithFilteredResult(_0x38aa53,_0x2a9c32){return function(_0x252fcb){if(_0x252fcb){var _0xc74c7a=typeof _0x2a9c32['offset']===_0xac3c('0x1d')&&typeof _0x2a9c32[_0xac3c('0x1e')]==='undefined';var _0x42cebf=_0x252fcb[_0xac3c('0x1f')];var _0x5e39fc=_0xc74c7a?0x0:_0x2a9c32[_0xac3c('0x20')];var _0x54aa2f=_0xc74c7a?_0x252fcb[_0xac3c('0x1f')]:_0x2a9c32[_0xac3c('0x20')]+_0x2a9c32[_0xac3c('0x1e')];var _0x4f8963;if(_0x54aa2f>=_0x42cebf){_0x54aa2f=_0x42cebf;_0x4f8963=0xc8;}else{_0x4f8963=0xce;}_0x38aa53[_0xac3c('0x1b')](_0x4f8963);return _0x38aa53['set'](_0xac3c('0x21'),_0x5e39fc+'-'+_0x54aa2f+'/'+_0x42cebf)[_0xac3c('0x22')](_0x252fcb);}return null;};}function patchUpdates(_0x4ebfb0){return function(_0x2459fa){try{jsonpatch['apply'](_0x2459fa,_0x4ebfb0,!![]);}catch(_0x37ece1){return BPromise[_0xac3c('0x23')](_0x37ece1);}return _0x2459fa[_0xac3c('0x24')]();};}function saveUpdates(_0x2ad8f8,_0x3933ed){return function(_0x392975){if(_0x392975){return _0x392975[_0xac3c('0x25')](_0x2ad8f8)[_0xac3c('0x26')](function(_0x3224b5){return _0x3224b5;});}return null;};}function removeEntity(_0x5a14ed,_0x4de7c9){return function(_0x1bc955){if(_0x1bc955){return _0x1bc955[_0xac3c('0x27')]()[_0xac3c('0x26')](function(){_0x5a14ed['status'](0xcc)[_0xac3c('0x1c')]();});}};}function handleEntityNotFound(_0x70974d,_0x2cd4b3){return function(_0x5ce07e){if(!_0x5ce07e){_0x70974d[_0xac3c('0x28')](0x194);}return _0x5ce07e;};}function handleError(_0x141562,_0x420da2){_0x420da2=_0x420da2||0x1f4;return function(_0x2de2bb){logger[_0xac3c('0x29')](_0x2de2bb[_0xac3c('0x2a')]);if(_0x2de2bb['name']){delete _0x2de2bb[_0xac3c('0x2b')];}_0x141562[_0xac3c('0x1b')](_0x420da2)[_0xac3c('0x2c')](_0x2de2bb);};}function getMustacheRender(_0x5107a7,_0x5deeb5){return Mustache[_0xac3c('0x2d')](_0x5107a7,_[_0xac3c('0x2e')](_0x5deeb5['body'],{'contact':_0x5deeb5[_0xac3c('0x2f')],'message':_0x5deeb5[_0xac3c('0x30')],'agent':_0x5deeb5[_0xac3c('0x31')],'interaction':_0x5deeb5[_0xac3c('0x32')],'account':_0x5deeb5[_0xac3c('0x33')]}))||'';}exports['index']=function(_0x4328a9,_0x402573){var _0x41e2c0={},_0xad65d2={},_0x3e0618={'count':0x0,'rows':[]};var _0x1a8ac9=_[_0xac3c('0x34')](db['Dynamics365Field'][_0xac3c('0x35')],function(_0x33c8a8){return{'name':_0x33c8a8['fieldName'],'type':_0x33c8a8[_0xac3c('0x36')][_0xac3c('0x37')]};});_0xad65d2[_0xac3c('0x38')]=_[_0xac3c('0x34')](_0x1a8ac9,'name');_0xad65d2['query']=_['keys'](_0x4328a9['query']);_0xad65d2[_0xac3c('0x39')]=_[_0xac3c('0x3a')](_0xad65d2['model'],_0xad65d2[_0xac3c('0x3b')]);_0x41e2c0[_0xac3c('0x3c')]=_['intersection'](_0xad65d2[_0xac3c('0x38')],qs[_0xac3c('0x3d')](_0x4328a9['query'][_0xac3c('0x3d')]));_0x41e2c0[_0xac3c('0x3c')]=_0x41e2c0[_0xac3c('0x3c')]['length']?_0x41e2c0[_0xac3c('0x3c')]:_0xad65d2[_0xac3c('0x38')];if(!_0x4328a9[_0xac3c('0x3b')][_0xac3c('0x3e')](_0xac3c('0x3f'))){_0x41e2c0[_0xac3c('0x1e')]=qs['limit'](_0x4328a9[_0xac3c('0x3b')][_0xac3c('0x1e')]);_0x41e2c0[_0xac3c('0x20')]=qs[_0xac3c('0x20')](_0x4328a9[_0xac3c('0x3b')][_0xac3c('0x20')]);}_0x41e2c0[_0xac3c('0x40')]=qs[_0xac3c('0x41')](_0x4328a9[_0xac3c('0x3b')]['sort']);_0x41e2c0[_0xac3c('0x42')]=qs['filters'](_[_0xac3c('0x43')](_0x4328a9['query'],_0xad65d2[_0xac3c('0x39')]),_0x1a8ac9);if(_0x4328a9[_0xac3c('0x3b')][_0xac3c('0x44')]){_0x41e2c0[_0xac3c('0x42')]=_[_0xac3c('0x2e')](_0x41e2c0['where'],{'$or':_[_0xac3c('0x34')](_0x1a8ac9,function(_0x437a17){if(_0x437a17[_0xac3c('0x36')]!==_0xac3c('0x45')){var _0x121fb8={};_0x121fb8[_0x437a17[_0xac3c('0x2b')]]={'$like':'%'+_0x4328a9[_0xac3c('0x3b')][_0xac3c('0x44')]+'%'};return _0x121fb8;}})});}_0x41e2c0=_['merge']({},_0x41e2c0,_0x4328a9[_0xac3c('0x46')]);var _0x3f4cfe={'where':_0x41e2c0[_0xac3c('0x42')]};return db[_0xac3c('0x47')]['count'](_0x3f4cfe)[_0xac3c('0x26')](function(_0x3cd3e2){_0x3e0618[_0xac3c('0x1f')]=_0x3cd3e2;if(_0x4328a9[_0xac3c('0x3b')][_0xac3c('0x48')]){_0x41e2c0[_0xac3c('0x49')]=[{'all':!![]}];}return db[_0xac3c('0x47')]['findAll'](_0x41e2c0);})[_0xac3c('0x26')](function(_0x43d4f4){_0x3e0618['rows']=_0x43d4f4;return _0x3e0618;})['then'](respondWithFilteredResult(_0x402573,_0x41e2c0))['catch'](handleError(_0x402573,null));};exports['show']=function(_0x260fa1,_0x15dcae){var _0x344e96={'raw':!![],'where':{'id':_0x260fa1[_0xac3c('0x4a')]['id']}},_0x47090b={};_0x47090b[_0xac3c('0x38')]=_[_0xac3c('0x4b')](db[_0xac3c('0x47')]['rawAttributes']);_0x47090b[_0xac3c('0x3b')]=_[_0xac3c('0x4b')](_0x260fa1[_0xac3c('0x3b')]);_0x47090b['filters']=_[_0xac3c('0x3a')](_0x47090b[_0xac3c('0x38')],_0x47090b[_0xac3c('0x3b')]);_0x344e96[_0xac3c('0x3c')]=_['intersection'](_0x47090b[_0xac3c('0x38')],qs['fields'](_0x260fa1[_0xac3c('0x3b')][_0xac3c('0x3d')]));_0x344e96[_0xac3c('0x3c')]=_0x344e96[_0xac3c('0x3c')]['length']?_0x344e96[_0xac3c('0x3c')]:_0x47090b[_0xac3c('0x38')];if(_0x260fa1[_0xac3c('0x3b')]['includeAll']){_0x344e96[_0xac3c('0x49')]=[{'all':!![]}];}_0x344e96=_[_0xac3c('0x2e')]({},_0x344e96,_0x260fa1['options']);return db[_0xac3c('0x47')][_0xac3c('0x4c')](_0x344e96)[_0xac3c('0x26')](handleEntityNotFound(_0x15dcae,null))[_0xac3c('0x26')](respondWithResult(_0x15dcae,null))[_0xac3c('0x4d')](handleError(_0x15dcae,null));};exports[_0xac3c('0x4e')]=function(_0x5975fe,_0xbf346b){return db[_0xac3c('0x47')][_0xac3c('0x4e')](_0x5975fe[_0xac3c('0x4f')],{})[_0xac3c('0x26')](respondWithResult(_0xbf346b,0xc9))[_0xac3c('0x4d')](handleError(_0xbf346b,null));};exports[_0xac3c('0x25')]=function(_0x25129e,_0x3581b3){if(_0x25129e[_0xac3c('0x4f')]['id']){delete _0x25129e['body']['id'];}return db[_0xac3c('0x47')]['find']({'where':{'id':_0x25129e[_0xac3c('0x4a')]['id']}})[_0xac3c('0x26')](handleEntityNotFound(_0x3581b3,null))[_0xac3c('0x26')](saveUpdates(_0x25129e['body'],null))[_0xac3c('0x26')](respondWithResult(_0x3581b3,null))['catch'](handleError(_0x3581b3,null));};exports['destroy']=function(_0x1a3fb4,_0x219ac3){return db['Dynamics365Field'][_0xac3c('0x4c')]({'where':{'id':_0x1a3fb4['params']['id']}})['then'](handleEntityNotFound(_0x219ac3,null))[_0xac3c('0x26')](removeEntity(_0x219ac3,null))[_0xac3c('0x4d')](handleError(_0x219ac3,null));}; \ No newline at end of file +var _0x163e=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','Dynamics365Field','includeAll','findAll','rows','show','rawAttributes','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','render','contact','interaction','account','index','map','fieldName','key','model'];(function(_0x3ff491,_0x287ece){var _0xa5b633=function(_0x1e565f){while(--_0x1e565f){_0x3ff491['push'](_0x3ff491['shift']());}};_0xa5b633(++_0x287ece);}(_0x163e,0x6a));var _0xe163=function(_0x51c938,_0x7b322){_0x51c938=_0x51c938-0x0;var _0x4bb8b2=_0x163e[_0x51c938];return _0x4bb8b2;};'use strict';var emlformat=require(_0xe163('0x0'));var rimraf=require(_0xe163('0x1'));var zipdir=require(_0xe163('0x2'));var jsonpatch=require(_0xe163('0x3'));var rp=require(_0xe163('0x4'));var moment=require(_0xe163('0x5'));var BPromise=require(_0xe163('0x6'));var Mustache=require('mustache');var util=require(_0xe163('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe163('0x8'));var ejs=require(_0xe163('0x9'));var fs=require('fs');var fs_extra=require(_0xe163('0xa'));var _=require(_0xe163('0xb'));var squel=require(_0xe163('0xc'));var crypto=require(_0xe163('0xd'));var jsforce=require(_0xe163('0xe'));var deskjs=require(_0xe163('0xf'));var toCsv=require(_0xe163('0x8'));var querystring=require('querystring');var Papa=require(_0xe163('0x10'));var Redis=require('ioredis');var authService=require(_0xe163('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe163('0x12'));var utils=require(_0xe163('0x13'));var config=require(_0xe163('0x14'));var licenseUtil=require(_0xe163('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4365d5,_0x3116b0){_0x3116b0=_0x3116b0||0xcc;return function(_0x5c69ca){if(_0x5c69ca){return _0x4365d5['sendStatus'](_0x3116b0);}return _0x4365d5['status'](_0x3116b0)['end']();};}function respondWithResult(_0x58f6e1,_0x5d0c87){_0x5d0c87=_0x5d0c87||0xc8;return function(_0x48950d){if(_0x48950d){return _0x58f6e1['status'](_0x5d0c87)[_0xe163('0x16')](_0x48950d);}};}function respondWithFilteredResult(_0x229c95,_0x113a74){return function(_0x30cf29){if(_0x30cf29){var _0x20b342=typeof _0x113a74[_0xe163('0x17')]==='undefined'&&typeof _0x113a74[_0xe163('0x18')]===_0xe163('0x19');var _0x57e2e9=_0x30cf29[_0xe163('0x1a')];var _0x372c1b=_0x20b342?0x0:_0x113a74[_0xe163('0x17')];var _0x1cfa03=_0x20b342?_0x30cf29['count']:_0x113a74[_0xe163('0x17')]+_0x113a74[_0xe163('0x18')];var _0x4b6022;if(_0x1cfa03>=_0x57e2e9){_0x1cfa03=_0x57e2e9;_0x4b6022=0xc8;}else{_0x4b6022=0xce;}_0x229c95[_0xe163('0x1b')](_0x4b6022);return _0x229c95[_0xe163('0x1c')](_0xe163('0x1d'),_0x372c1b+'-'+_0x1cfa03+'/'+_0x57e2e9)[_0xe163('0x16')](_0x30cf29);}return null;};}function patchUpdates(_0x563b18){return function(_0x47296a){try{jsonpatch[_0xe163('0x1e')](_0x47296a,_0x563b18,!![]);}catch(_0x5cc9ac){return BPromise[_0xe163('0x1f')](_0x5cc9ac);}return _0x47296a[_0xe163('0x20')]();};}function saveUpdates(_0x7c1148,_0x4138f0){return function(_0x1ae1b6){if(_0x1ae1b6){return _0x1ae1b6[_0xe163('0x21')](_0x7c1148)[_0xe163('0x22')](function(_0x13d811){return _0x13d811;});}return null;};}function removeEntity(_0x343c16,_0x2467fe){return function(_0x2480c7){if(_0x2480c7){return _0x2480c7[_0xe163('0x23')]()[_0xe163('0x22')](function(){_0x343c16[_0xe163('0x1b')](0xcc)[_0xe163('0x24')]();});}};}function handleEntityNotFound(_0x5c124e,_0xdae913){return function(_0x3f0602){if(!_0x3f0602){_0x5c124e[_0xe163('0x25')](0x194);}return _0x3f0602;};}function handleError(_0x2fe0be,_0x507939){_0x507939=_0x507939||0x1f4;return function(_0x7437f6){logger['error'](_0x7437f6[_0xe163('0x26')]);if(_0x7437f6[_0xe163('0x27')]){delete _0x7437f6[_0xe163('0x27')];}_0x2fe0be[_0xe163('0x1b')](_0x507939)[_0xe163('0x28')](_0x7437f6);};}function getMustacheRender(_0x456ca9,_0x459712){return Mustache[_0xe163('0x29')](_0x456ca9,_['merge'](_0x459712['body'],{'contact':_0x459712[_0xe163('0x2a')],'message':_0x459712['message'],'agent':_0x459712['agent'],'interaction':_0x459712[_0xe163('0x2b')],'account':_0x459712[_0xe163('0x2c')]}))||'';}exports[_0xe163('0x2d')]=function(_0x28cedc,_0x24a7c3){var _0xf7320e={},_0x583d86={},_0x15a31b={'count':0x0,'rows':[]};var _0x44759f=_[_0xe163('0x2e')](db['Dynamics365Field']['rawAttributes'],function(_0x4c5792){return{'name':_0x4c5792[_0xe163('0x2f')],'type':_0x4c5792['type'][_0xe163('0x30')]};});_0x583d86[_0xe163('0x31')]=_[_0xe163('0x2e')](_0x44759f,_0xe163('0x27'));_0x583d86[_0xe163('0x32')]=_[_0xe163('0x33')](_0x28cedc[_0xe163('0x32')]);_0x583d86['filters']=_[_0xe163('0x34')](_0x583d86[_0xe163('0x31')],_0x583d86['query']);_0xf7320e[_0xe163('0x35')]=_[_0xe163('0x34')](_0x583d86['model'],qs[_0xe163('0x36')](_0x28cedc[_0xe163('0x32')][_0xe163('0x36')]));_0xf7320e[_0xe163('0x35')]=_0xf7320e['attributes'][_0xe163('0x37')]?_0xf7320e[_0xe163('0x35')]:_0x583d86[_0xe163('0x31')];if(!_0x28cedc['query'][_0xe163('0x38')](_0xe163('0x39'))){_0xf7320e['limit']=qs[_0xe163('0x18')](_0x28cedc[_0xe163('0x32')]['limit']);_0xf7320e[_0xe163('0x17')]=qs[_0xe163('0x17')](_0x28cedc[_0xe163('0x32')][_0xe163('0x17')]);}_0xf7320e[_0xe163('0x3a')]=qs[_0xe163('0x3b')](_0x28cedc[_0xe163('0x32')][_0xe163('0x3b')]);_0xf7320e[_0xe163('0x3c')]=qs[_0xe163('0x3d')](_[_0xe163('0x3e')](_0x28cedc['query'],_0x583d86['filters']),_0x44759f);if(_0x28cedc[_0xe163('0x32')][_0xe163('0x3f')]){_0xf7320e['where']=_['merge'](_0xf7320e['where'],{'$or':_[_0xe163('0x2e')](_0x44759f,function(_0x46daf3){if(_0x46daf3[_0xe163('0x40')]!==_0xe163('0x41')){var _0x3d87e2={};_0x3d87e2[_0x46daf3['name']]={'$like':'%'+_0x28cedc['query'][_0xe163('0x3f')]+'%'};return _0x3d87e2;}})});}_0xf7320e=_['merge']({},_0xf7320e,_0x28cedc['options']);var _0x5aa771={'where':_0xf7320e[_0xe163('0x3c')]};return db[_0xe163('0x42')]['count'](_0x5aa771)[_0xe163('0x22')](function(_0x685987){_0x15a31b[_0xe163('0x1a')]=_0x685987;if(_0x28cedc['query'][_0xe163('0x43')]){_0xf7320e['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0xe163('0x44')](_0xf7320e);})[_0xe163('0x22')](function(_0x459223){_0x15a31b[_0xe163('0x45')]=_0x459223;return _0x15a31b;})[_0xe163('0x22')](respondWithFilteredResult(_0x24a7c3,_0xf7320e))['catch'](handleError(_0x24a7c3,null));};exports[_0xe163('0x46')]=function(_0xcf246b,_0x3ac5c1){var _0x34cdde={'raw':!![],'where':{'id':_0xcf246b['params']['id']}},_0x30f46e={};_0x30f46e[_0xe163('0x31')]=_['keys'](db['Dynamics365Field'][_0xe163('0x47')]);_0x30f46e[_0xe163('0x32')]=_[_0xe163('0x33')](_0xcf246b[_0xe163('0x32')]);_0x30f46e[_0xe163('0x3d')]=_['intersection'](_0x30f46e['model'],_0x30f46e['query']);_0x34cdde[_0xe163('0x35')]=_['intersection'](_0x30f46e[_0xe163('0x31')],qs[_0xe163('0x36')](_0xcf246b[_0xe163('0x32')][_0xe163('0x36')]));_0x34cdde['attributes']=_0x34cdde['attributes'][_0xe163('0x37')]?_0x34cdde[_0xe163('0x35')]:_0x30f46e['model'];if(_0xcf246b['query'][_0xe163('0x43')]){_0x34cdde['include']=[{'all':!![]}];}_0x34cdde=_['merge']({},_0x34cdde,_0xcf246b[_0xe163('0x48')]);return db[_0xe163('0x42')][_0xe163('0x49')](_0x34cdde)[_0xe163('0x22')](handleEntityNotFound(_0x3ac5c1,null))['then'](respondWithResult(_0x3ac5c1,null))[_0xe163('0x4a')](handleError(_0x3ac5c1,null));};exports[_0xe163('0x4b')]=function(_0x121a38,_0x21b106){return db[_0xe163('0x42')][_0xe163('0x4b')](_0x121a38[_0xe163('0x4c')],{})[_0xe163('0x22')](respondWithResult(_0x21b106,0xc9))[_0xe163('0x4a')](handleError(_0x21b106,null));};exports['update']=function(_0x88bfa8,_0x353223){if(_0x88bfa8[_0xe163('0x4c')]['id']){delete _0x88bfa8[_0xe163('0x4c')]['id'];}return db[_0xe163('0x42')][_0xe163('0x49')]({'where':{'id':_0x88bfa8[_0xe163('0x4d')]['id']}})[_0xe163('0x22')](handleEntityNotFound(_0x353223,null))['then'](saveUpdates(_0x88bfa8[_0xe163('0x4c')],null))[_0xe163('0x22')](respondWithResult(_0x353223,null))[_0xe163('0x4a')](handleError(_0x353223,null));};exports[_0xe163('0x23')]=function(_0x349612,_0x40bd51){return db[_0xe163('0x42')][_0xe163('0x49')]({'where':{'id':_0x349612['params']['id']}})[_0xe163('0x22')](handleEntityNotFound(_0x40bd51,null))[_0xe163('0x22')](removeEntity(_0x40bd51,null))[_0xe163('0x4a')](handleError(_0x40bd51,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 67c97b0..7f085ce 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 _0xe6b3=['exports','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x2d828d,_0x511d7e){var _0x3ab056=function(_0x2666fa){while(--_0x2666fa){_0x2d828d['push'](_0x2d828d['shift']());}};_0x3ab056(++_0x511d7e);}(_0xe6b3,0x6e));var _0x3e6b=function(_0x4903a0,_0x11bf7f){_0x4903a0=_0x4903a0-0x0;var _0x47f48d=_0xe6b3[_0x4903a0];return _0x47f48d;};'use strict';var _=require(_0x3e6b('0x0'));var util=require(_0x3e6b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3e6b('0x2'));var BPromise=require(_0x3e6b('0x3'));var rp=require(_0x3e6b('0x4'));var fs=require('fs');var path=require(_0x3e6b('0x5'));var rimraf=require(_0x3e6b('0x6'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0x3e6b('0x7')]=function(_0x385491,_0x146638){return _0x385491[_0x3e6b('0x8')](_0x3e6b('0x9'),attributes,{'tableName':_0x3e6b('0xa'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x3e6b('0xb'),_0x3e6b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x212c=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intDynamics365Field.attributes','define'];(function(_0xb58b99,_0x5249a9){var _0x5b9949=function(_0x979d74){while(--_0x979d74){_0xb58b99['push'](_0xb58b99['shift']());}};_0x5b9949(++_0x5249a9);}(_0x212c,0xb9));var _0xc212=function(_0x53e311,_0x17c0f9){_0x53e311=_0x53e311-0x0;var _0x5bb62d=_0x212c[_0x53e311];return _0x5bb62d;};'use strict';var _=require(_0xc212('0x0'));var util=require(_0xc212('0x1'));var logger=require(_0xc212('0x2'))(_0xc212('0x3'));var moment=require(_0xc212('0x4'));var BPromise=require(_0xc212('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc212('0x6'));var rimraf=require(_0xc212('0x7'));var config=require('../../config/environment');var attributes=require(_0xc212('0x8'));module['exports']=function(_0x96156,_0x34eb27){return _0x96156[_0xc212('0x9')](_0xc212('0xa'),attributes,{'tableName':_0xc212('0xb'),'paranoid':![],'indexes':[{'name':_0xc212('0xc'),'fields':[_0xc212('0xd'),_0xc212('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 663ec2e..36cdcb8 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 _0x5f6f=['http','request','then','request\x20sent','debug','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4d05dd,_0x258cdd){var _0x1c5226=function(_0x1a857c){while(--_0x1a857c){_0x4d05dd['push'](_0x4d05dd['shift']());}};_0x1c5226(++_0x258cdd);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x1f244d,_0x19e830){_0x1f244d=_0x1f244d-0x0;var _0x16003a=_0x5f6f[_0x1f244d];return _0x16003a;};'use strict';var _=require(_0xf5f6('0x0'));var util=require(_0xf5f6('0x1'));var moment=require(_0xf5f6('0x2'));var BPromise=require(_0xf5f6('0x3'));var rs=require(_0xf5f6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5f6('0x5'))['db'];var utils=require(_0xf5f6('0x6'));var logger=require(_0xf5f6('0x7'))('rpc');var config=require(_0xf5f6('0x8'));var jayson=require(_0xf5f6('0x9'));var client=jayson[_0xf5f6('0xa')][_0xf5f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x508c02,_0x54054c,_0xa635ff){return new BPromise(function(_0x2fa090,_0x22f837){return client[_0xf5f6('0xc')](_0x508c02,_0xa635ff)[_0xf5f6('0xd')](function(_0x13cb75){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x54054c,_0xf5f6('0xe'));logger[_0xf5f6('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x54054c,_0xf5f6('0xe'),JSON[_0xf5f6('0x10')](_0x13cb75));if(_0x13cb75[_0xf5f6('0x11')]){if(_0x13cb75[_0xf5f6('0x11')][_0xf5f6('0x12')]===0x1f4){logger['error'](_0xf5f6('0x13'),_0x54054c,_0x13cb75['error'][_0xf5f6('0x14')]);return _0x22f837(_0x13cb75[_0xf5f6('0x11')][_0xf5f6('0x14')]);}logger[_0xf5f6('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x54054c,_0x13cb75[_0xf5f6('0x11')][_0xf5f6('0x14')]);return _0x2fa090(_0x13cb75[_0xf5f6('0x11')][_0xf5f6('0x14')]);}else{logger['info'](_0xf5f6('0x13'),_0x54054c,_0xf5f6('0xe'));_0x2fa090(_0x13cb75[_0xf5f6('0x15')][_0xf5f6('0x14')]);}})['catch'](function(_0x5bc2dc){logger[_0xf5f6('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x54054c,_0x5bc2dc);_0x22f837(_0x5bc2dc);});});} \ No newline at end of file +var _0x2d2c=['jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x5c3ea5,_0xa9ed0c){_0x5c3ea5=_0x5c3ea5-0x0;var _0x102b61=_0x2d2c[_0x5c3ea5];return _0x102b61;};'use strict';var _=require(_0xc2d2('0x0'));var util=require(_0xc2d2('0x1'));var moment=require(_0xc2d2('0x2'));var BPromise=require(_0xc2d2('0x3'));var rs=require(_0xc2d2('0x4'));var fs=require('fs');var Redis=require(_0xc2d2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc2d2('0x6'));var logger=require('../../config/logger')(_0xc2d2('0x7'));var config=require(_0xc2d2('0x8'));var jayson=require(_0xc2d2('0x9'));var client=jayson[_0xc2d2('0xa')][_0xc2d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d2d3f,_0x54136b,_0x241c02){return new BPromise(function(_0x13c6c6,_0x2ebe63){return client[_0xc2d2('0xc')](_0x5d2d3f,_0x241c02)[_0xc2d2('0xd')](function(_0xf5fcf2){logger[_0xc2d2('0xe')](_0xc2d2('0xf'),_0x54136b,_0xc2d2('0x10'));logger[_0xc2d2('0x11')](_0xc2d2('0x12'),_0x54136b,_0xc2d2('0x10'),JSON['stringify'](_0xf5fcf2));if(_0xf5fcf2[_0xc2d2('0x13')]){if(_0xf5fcf2[_0xc2d2('0x13')][_0xc2d2('0x14')]===0x1f4){logger['error'](_0xc2d2('0xf'),_0x54136b,_0xf5fcf2[_0xc2d2('0x13')]['message']);return _0x2ebe63(_0xf5fcf2[_0xc2d2('0x13')][_0xc2d2('0x15')]);}logger['error'](_0xc2d2('0xf'),_0x54136b,_0xf5fcf2['error']['message']);return _0x13c6c6(_0xf5fcf2[_0xc2d2('0x13')][_0xc2d2('0x15')]);}else{logger[_0xc2d2('0xe')](_0xc2d2('0xf'),_0x54136b,_0xc2d2('0x10'));_0x13c6c6(_0xf5fcf2[_0xc2d2('0x16')][_0xc2d2('0x15')]);}})[_0xc2d2('0x17')](function(_0x34f5a9){logger[_0xc2d2('0x13')](_0xc2d2('0xf'),_0x54136b,_0x34f5a9);_0x2ebe63(_0x34f5a9);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 1aadb8a..28731de 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 _0x1a3a=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update'];(function(_0x164760,_0x5874b0){var _0x8b91b2=function(_0x40d20a){while(--_0x40d20a){_0x164760['push'](_0x164760['shift']());}};_0x8b91b2(++_0x5874b0);}(_0x1a3a,0x12e));var _0xa1a3=function(_0x46eb97,_0xb9ff42){_0x46eb97=_0x46eb97-0x0;var _0x23e20d=_0x1a3a[_0x46eb97];return _0x23e20d;};'use strict';var multer=require('multer');var util=require(_0xa1a3('0x0'));var path=require(_0xa1a3('0x1'));var timeout=require(_0xa1a3('0x2'));var express=require(_0xa1a3('0x3'));var router=express[_0xa1a3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa1a3('0x5'));var interaction=require(_0xa1a3('0x6'));var config=require('../../config/environment');var controller=require(_0xa1a3('0x7'));router[_0xa1a3('0x8')]('/',auth[_0xa1a3('0x9')](),controller['index']);router[_0xa1a3('0x8')](_0xa1a3('0xa'),auth[_0xa1a3('0x9')](),controller['show']);router[_0xa1a3('0x8')](_0xa1a3('0xb'),auth['isAuthenticated'](),controller[_0xa1a3('0xc')]);router[_0xa1a3('0x8')](_0xa1a3('0xd'),auth['isAuthenticated'](),controller[_0xa1a3('0xe')]);router[_0xa1a3('0xf')]('/',auth['isAuthenticated'](),controller[_0xa1a3('0x10')]);router[_0xa1a3('0xf')](_0xa1a3('0xb'),auth['isAuthenticated'](),controller[_0xa1a3('0x11')]);router[_0xa1a3('0x12')](_0xa1a3('0xa'),auth['isAuthenticated'](),controller[_0xa1a3('0x13')]);router[_0xa1a3('0x14')](_0xa1a3('0xa'),auth['isAuthenticated'](),controller[_0xa1a3('0x15')]);module[_0xa1a3('0x16')]=router; \ No newline at end of file +var _0x32fb=['/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0x32fb,0x1f0));var _0xb32f=function(_0x2840a5,_0x1444e4){_0x2840a5=_0x2840a5-0x0;var _0x43d2d5=_0x32fb[_0x2840a5];return _0x43d2d5;};'use strict';var multer=require(_0xb32f('0x0'));var util=require(_0xb32f('0x1'));var path=require(_0xb32f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb32f('0x3')]();var fs_extra=require(_0xb32f('0x4'));var auth=require(_0xb32f('0x5'));var interaction=require(_0xb32f('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xb32f('0x7')]('/',auth[_0xb32f('0x8')](),controller[_0xb32f('0x9')]);router[_0xb32f('0x7')](_0xb32f('0xa'),auth[_0xb32f('0x8')](),controller['show']);router[_0xb32f('0x7')](_0xb32f('0xb'),auth[_0xb32f('0x8')](),controller[_0xb32f('0xc')]);router[_0xb32f('0x7')](_0xb32f('0xd'),auth[_0xb32f('0x8')](),controller[_0xb32f('0xe')]);router[_0xb32f('0xf')]('/',auth[_0xb32f('0x8')](),controller[_0xb32f('0x10')]);router[_0xb32f('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xb32f('0x11')]);router[_0xb32f('0x12')]('/:id',auth[_0xb32f('0x8')](),controller[_0xb32f('0x13')]);router[_0xb32f('0x14')](_0xb32f('0xa'),auth[_0xb32f('0x8')](),controller[_0xb32f('0x15')]);module[_0xb32f('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 98e341e..33b71a1 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 _0x76b1=['STRING','username','sequelize','exports'];(function(_0x5a831b,_0x1aa6a6){var _0x22a856=function(_0x45d058){while(--_0x45d058){_0x5a831b['push'](_0x5a831b['shift']());}};_0x22a856(++_0x1aa6a6);}(_0x76b1,0x19e));var _0x176b=function(_0x46efed,_0x2105a7){_0x46efed=_0x46efed-0x0;var _0x506e63=_0x76b1[_0x46efed];return _0x506e63;};'use strict';var Sequelize=require(_0x176b('0x0'));module[_0x176b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x176b('0x2')],'unique':_0x176b('0x3')},'apiKey':{'type':Sequelize[_0x176b('0x2')]},'remoteUri':{'type':Sequelize[_0x176b('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x63cd=['sequelize','exports','STRING','remoteUri'];(function(_0x5b4296,_0x48ca4f){var _0x59fe7c=function(_0x4092b6){while(--_0x4092b6){_0x5b4296['push'](_0x5b4296['shift']());}};_0x59fe7c(++_0x48ca4f);}(_0x63cd,0x16c));var _0xd63c=function(_0x1dd9d1,_0x820055){_0x1dd9d1=_0x1dd9d1-0x0;var _0x352f5d=_0x63cd[_0x1dd9d1];return _0x352f5d;};'use strict';var Sequelize=require(_0xd63c('0x0'));module[_0xd63c('0x1')]={'name':{'type':Sequelize[_0xd63c('0x2')]},'description':{'type':Sequelize[_0xd63c('0x2')]},'username':{'type':Sequelize[_0xd63c('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xd63c('0x2')]},'remoteUri':{'type':Sequelize[_0xd63c('0x2')],'unique':_0xd63c('0x3')},'serverUrl':{'type':Sequelize[_0xd63c('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 8330f8f..58ade5a 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 _0x8c7a=['custom_text','custom_dropdown','label','default','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','merge','contact','interaction','index','map','FreshdeskAccount','rawAttributes','type','model','intersection','fields','attributes','length','query','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','create','body','getConfigurations','FreshdeskConfiguration','order','addConfiguration','findOne','Subjects','getSubjects','getDescriptions','channel','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','subject','agent','description','priority','group','source','company','remove','includes'];(function(_0xe8880,_0x4c3b78){var _0x120d60=function(_0x1ac5f9){while(--_0x1ac5f9){_0xe8880['push'](_0xe8880['shift']());}};_0x120d60(++_0x4c3b78);}(_0x8c7a,0x8c));var _0xa8c7=function(_0x130021,_0x2f5e55){_0x130021=_0x130021-0x0;var _0x3f165e=_0x8c7a[_0x130021];return _0x3f165e;};'use strict';var emlformat=require(_0xa8c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa8c7('0x1'));var rp=require('request-promise');var moment=require(_0xa8c7('0x2'));var BPromise=require(_0xa8c7('0x3'));var Mustache=require(_0xa8c7('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa8c7('0x5'));var csv=require(_0xa8c7('0x6'));var ejs=require(_0xa8c7('0x7'));var fs=require('fs');var fs_extra=require(_0xa8c7('0x8'));var _=require(_0xa8c7('0x9'));var squel=require('squel');var crypto=require(_0xa8c7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa8c7('0xb'));var toCsv=require(_0xa8c7('0x6'));var querystring=require(_0xa8c7('0xc'));var Papa=require(_0xa8c7('0xd'));var Redis=require(_0xa8c7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa8c7('0xf'));var as=require(_0xa8c7('0x10'));var hardwareService=require(_0xa8c7('0x11'));var logger=require(_0xa8c7('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa8c7('0x13'));var db=require(_0xa8c7('0x14'))['db'];var integrations=require(_0xa8c7('0x15'));var jayson=require(_0xa8c7('0x16'));var client=jayson[_0xa8c7('0x17')][_0xa8c7('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x380fb8,_0x3c7fd8,_0x5452a3,_0x1e2b54){return new BPromise(function(_0x198791,_0x14e583){var _0x7e7ed6=_0x1e2b54||client;return _0x7e7ed6[_0xa8c7('0x19')](_0x380fb8,_0x5452a3)[_0xa8c7('0x1a')](function(_0xd70374){logger[_0xa8c7('0x1b')](_0xa8c7('0x1c'),_0x3c7fd8,_0xa8c7('0x1d'));logger[_0xa8c7('0x1e')](_0xa8c7('0x1f'),_0x3c7fd8,'request\x20sent',JSON[_0xa8c7('0x20')](_0xd70374));if(_0xd70374[_0xa8c7('0x21')]){if(_0xd70374[_0xa8c7('0x21')][_0xa8c7('0x22')]===0x1f4){logger[_0xa8c7('0x21')](_0xa8c7('0x1c'),_0x3c7fd8,_0xd70374['error'][_0xa8c7('0x23')]);return _0x14e583(_0xd70374[_0xa8c7('0x21')][_0xa8c7('0x23')]);}logger[_0xa8c7('0x21')](_0xa8c7('0x1c'),_0x3c7fd8,_0xd70374[_0xa8c7('0x21')][_0xa8c7('0x23')]);return _0x198791(_0xd70374[_0xa8c7('0x21')][_0xa8c7('0x23')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x3c7fd8,_0xa8c7('0x1d'));_0x198791(_0xd70374[_0xa8c7('0x24')][_0xa8c7('0x23')]);}})[_0xa8c7('0x25')](function(_0x2b1b7f){logger[_0xa8c7('0x21')](_0xa8c7('0x1c'),_0x3c7fd8,_0x2b1b7f);_0x14e583(_0x2b1b7f);});});}function respondWithStatusCode(_0x186417,_0x2bab45){_0x2bab45=_0x2bab45||0xcc;return function(_0x190f04){if(_0x190f04){return _0x186417[_0xa8c7('0x26')](_0x2bab45);}return _0x186417['status'](_0x2bab45)[_0xa8c7('0x27')]();};}function respondWithResult(_0x24f4a4,_0x5dee78){_0x5dee78=_0x5dee78||0xc8;return function(_0x1cf95d){if(_0x1cf95d){return _0x24f4a4[_0xa8c7('0x28')](_0x5dee78)['json'](_0x1cf95d);}};}function respondWithFilteredResult(_0x2364d4,_0x57bd0c){return function(_0x3b3db2){if(_0x3b3db2){var _0x29fae4=typeof _0x57bd0c['offset']===_0xa8c7('0x29')&&typeof _0x57bd0c[_0xa8c7('0x2a')]===_0xa8c7('0x29');var _0x49b0bb=_0x3b3db2[_0xa8c7('0x2b')];var _0x413ef4=_0x29fae4?0x0:_0x57bd0c['offset'];var _0x4a632c=_0x29fae4?_0x3b3db2['count']:_0x57bd0c['offset']+_0x57bd0c[_0xa8c7('0x2a')];var _0x15a73e;if(_0x4a632c>=_0x49b0bb){_0x4a632c=_0x49b0bb;_0x15a73e=0xc8;}else{_0x15a73e=0xce;}_0x2364d4[_0xa8c7('0x28')](_0x15a73e);return _0x2364d4[_0xa8c7('0x2c')](_0xa8c7('0x2d'),_0x413ef4+'-'+_0x4a632c+'/'+_0x49b0bb)[_0xa8c7('0x2e')](_0x3b3db2);}return null;};}function patchUpdates(_0x15deb6){return function(_0xd23ba1){try{jsonpatch[_0xa8c7('0x2f')](_0xd23ba1,_0x15deb6,!![]);}catch(_0x4181ed){return BPromise[_0xa8c7('0x30')](_0x4181ed);}return _0xd23ba1['save']();};}function saveUpdates(_0x25d471,_0x3e6edc){return function(_0x38b876){if(_0x38b876){return _0x38b876[_0xa8c7('0x31')](_0x25d471)['then'](function(_0xa33693){return _0xa33693;});}return null;};}function removeEntity(_0x184cb2,_0x2b1ab2){return function(_0xc964d7){if(_0xc964d7){return _0xc964d7[_0xa8c7('0x32')]()[_0xa8c7('0x1a')](function(){_0x184cb2[_0xa8c7('0x28')](0xcc)[_0xa8c7('0x27')]();});}};}function handleEntityNotFound(_0x11ebf2,_0x3653c5){return function(_0x3370a7){if(!_0x3370a7){_0x11ebf2[_0xa8c7('0x26')](0x194);}return _0x3370a7;};}function handleError(_0x9d850a,_0xe544eb){_0xe544eb=_0xe544eb||0x1f4;return function(_0x4c761a){logger[_0xa8c7('0x21')](_0x4c761a[_0xa8c7('0x33')]);if(_0x4c761a['name']){delete _0x4c761a[_0xa8c7('0x34')];}_0x9d850a[_0xa8c7('0x28')](_0xe544eb)[_0xa8c7('0x35')](_0x4c761a);};}function getMustacheRender(_0x245b4c,_0x439df7){return Mustache['render'](_0x245b4c,_[_0xa8c7('0x36')](_0x439df7['body'],{'contact':_0x439df7[_0xa8c7('0x37')],'message':_0x439df7['message'],'agent':_0x439df7['agent'],'interaction':_0x439df7[_0xa8c7('0x38')],'account':_0x439df7['account']}))||'';}exports[_0xa8c7('0x39')]=function(_0x23d2cd,_0xfa316a){var _0x2de129={},_0x194378={},_0x46cb2f={'count':0x0,'rows':[]};var _0x7b50c2=_[_0xa8c7('0x3a')](db[_0xa8c7('0x3b')][_0xa8c7('0x3c')],function(_0x39fa17){return{'name':_0x39fa17['fieldName'],'type':_0x39fa17[_0xa8c7('0x3d')]['key']};});_0x194378[_0xa8c7('0x3e')]=_['map'](_0x7b50c2,'name');_0x194378['query']=_['keys'](_0x23d2cd['query']);_0x194378['filters']=_[_0xa8c7('0x3f')](_0x194378[_0xa8c7('0x3e')],_0x194378['query']);_0x2de129['attributes']=_[_0xa8c7('0x3f')](_0x194378[_0xa8c7('0x3e')],qs[_0xa8c7('0x40')](_0x23d2cd['query'][_0xa8c7('0x40')]));_0x2de129[_0xa8c7('0x41')]=_0x2de129['attributes'][_0xa8c7('0x42')]?_0x2de129[_0xa8c7('0x41')]:_0x194378[_0xa8c7('0x3e')];if(!_0x23d2cd[_0xa8c7('0x43')][_0xa8c7('0x44')](_0xa8c7('0x45'))){_0x2de129[_0xa8c7('0x2a')]=qs[_0xa8c7('0x2a')](_0x23d2cd[_0xa8c7('0x43')][_0xa8c7('0x2a')]);_0x2de129[_0xa8c7('0x46')]=qs[_0xa8c7('0x46')](_0x23d2cd['query'][_0xa8c7('0x46')]);}_0x2de129['order']=qs[_0xa8c7('0x47')](_0x23d2cd[_0xa8c7('0x43')]['sort']);_0x2de129[_0xa8c7('0x48')]=qs[_0xa8c7('0x49')](_[_0xa8c7('0x4a')](_0x23d2cd[_0xa8c7('0x43')],_0x194378['filters']),_0x7b50c2);if(_0x23d2cd[_0xa8c7('0x43')][_0xa8c7('0x4b')]){_0x2de129[_0xa8c7('0x48')]=_[_0xa8c7('0x36')](_0x2de129[_0xa8c7('0x48')],{'$or':_[_0xa8c7('0x3a')](_0x7b50c2,function(_0x324162){if(_0x324162[_0xa8c7('0x3d')]!==_0xa8c7('0x4c')){var _0x2b3ccd={};_0x2b3ccd[_0x324162['name']]={'$like':'%'+_0x23d2cd[_0xa8c7('0x43')][_0xa8c7('0x4b')]+'%'};return _0x2b3ccd;}})});}_0x2de129=_[_0xa8c7('0x36')]({},_0x2de129,_0x23d2cd[_0xa8c7('0x4d')]);var _0x5ba18b={'where':_0x2de129['where']};return db['FreshdeskAccount'][_0xa8c7('0x2b')](_0x5ba18b)[_0xa8c7('0x1a')](function(_0x317f27){_0x46cb2f[_0xa8c7('0x2b')]=_0x317f27;if(_0x23d2cd[_0xa8c7('0x43')][_0xa8c7('0x4e')]){_0x2de129[_0xa8c7('0x4f')]=[{'all':!![]}];}return db[_0xa8c7('0x3b')][_0xa8c7('0x50')](_0x2de129);})[_0xa8c7('0x1a')](function(_0x4b0737){_0x46cb2f['rows']=_0x4b0737;return _0x46cb2f;})[_0xa8c7('0x1a')](respondWithFilteredResult(_0xfa316a,_0x2de129))[_0xa8c7('0x25')](handleError(_0xfa316a,null));};exports[_0xa8c7('0x51')]=function(_0x55731a,_0x4ceea9){var _0x3b07d8={'raw':![],'where':{'id':_0x55731a[_0xa8c7('0x52')]['id']}},_0x26266b={};_0x26266b['model']=_[_0xa8c7('0x53')](db[_0xa8c7('0x3b')][_0xa8c7('0x3c')]);_0x26266b[_0xa8c7('0x43')]=_[_0xa8c7('0x53')](_0x55731a[_0xa8c7('0x43')]);_0x26266b[_0xa8c7('0x49')]=_[_0xa8c7('0x3f')](_0x26266b[_0xa8c7('0x3e')],_0x26266b[_0xa8c7('0x43')]);_0x3b07d8[_0xa8c7('0x41')]=_[_0xa8c7('0x3f')](_0x26266b[_0xa8c7('0x3e')],qs['fields'](_0x55731a['query'][_0xa8c7('0x40')]));_0x3b07d8[_0xa8c7('0x41')]=_0x3b07d8[_0xa8c7('0x41')][_0xa8c7('0x42')]?_0x3b07d8[_0xa8c7('0x41')]:_0x26266b[_0xa8c7('0x3e')];if(_0x55731a[_0xa8c7('0x43')]['includeAll']){_0x3b07d8[_0xa8c7('0x4f')]=[{'all':!![]}];}_0x3b07d8=_['merge']({},_0x3b07d8,_0x55731a[_0xa8c7('0x4d')]);return db['FreshdeskAccount'][_0xa8c7('0x54')](_0x3b07d8)[_0xa8c7('0x1a')](handleEntityNotFound(_0x4ceea9,null))[_0xa8c7('0x1a')](respondWithResult(_0x4ceea9,null))['catch'](handleError(_0x4ceea9,null));};exports[_0xa8c7('0x55')]=function(_0x208bb4,_0x40c6b9){return db[_0xa8c7('0x3b')][_0xa8c7('0x55')](_0x208bb4[_0xa8c7('0x56')],{})[_0xa8c7('0x1a')](respondWithResult(_0x40c6b9,0xc9))[_0xa8c7('0x25')](handleError(_0x40c6b9,null));};exports[_0xa8c7('0x31')]=function(_0x5e45a8,_0x3b720d){if(_0x5e45a8[_0xa8c7('0x56')]['id']){delete _0x5e45a8[_0xa8c7('0x56')]['id'];}return db[_0xa8c7('0x3b')][_0xa8c7('0x54')]({'where':{'id':_0x5e45a8['params']['id']}})['then'](handleEntityNotFound(_0x3b720d,null))[_0xa8c7('0x1a')](saveUpdates(_0x5e45a8[_0xa8c7('0x56')],null))[_0xa8c7('0x1a')](respondWithResult(_0x3b720d,null))[_0xa8c7('0x25')](handleError(_0x3b720d,null));};exports['destroy']=function(_0x4d5499,_0x16d40b){return db[_0xa8c7('0x3b')]['find']({'where':{'id':_0x4d5499[_0xa8c7('0x52')]['id']}})[_0xa8c7('0x1a')](handleEntityNotFound(_0x16d40b,null))[_0xa8c7('0x1a')](removeEntity(_0x16d40b,null))[_0xa8c7('0x25')](handleError(_0x16d40b,null));};exports[_0xa8c7('0x57')]=function(_0x19454,_0x4ddc16,_0x929889){var _0x4b8029={};var _0x2209a7={};var _0x500787;var _0x532e0e;return db[_0xa8c7('0x3b')]['findOne']({'where':{'id':_0x19454['params']['id']}})[_0xa8c7('0x1a')](handleEntityNotFound(_0x4ddc16,null))['then'](function(_0xbe865){if(_0xbe865){_0x500787=_0xbe865;_0x2209a7[_0xa8c7('0x3e')]=_['keys'](db[_0xa8c7('0x58')][_0xa8c7('0x3c')]);_0x2209a7[_0xa8c7('0x43')]=_[_0xa8c7('0x53')](_0x19454[_0xa8c7('0x43')]);_0x2209a7[_0xa8c7('0x49')]=_['intersection'](_0x2209a7[_0xa8c7('0x3e')],_0x2209a7['query']);_0x4b8029[_0xa8c7('0x41')]=_[_0xa8c7('0x3f')](_0x2209a7[_0xa8c7('0x3e')],qs['fields'](_0x19454[_0xa8c7('0x43')][_0xa8c7('0x40')]));_0x4b8029[_0xa8c7('0x41')]=_0x4b8029['attributes'][_0xa8c7('0x42')]?_0x4b8029[_0xa8c7('0x41')]:_0x2209a7[_0xa8c7('0x3e')];_0x4b8029[_0xa8c7('0x59')]=qs[_0xa8c7('0x47')](_0x19454[_0xa8c7('0x43')][_0xa8c7('0x47')]);_0x4b8029['where']=qs[_0xa8c7('0x49')](_['pick'](_0x19454[_0xa8c7('0x43')],_0x2209a7['filters']));if(_0x19454['query'][_0xa8c7('0x4b')]){_0x4b8029[_0xa8c7('0x48')]=_['merge'](_0x4b8029['where'],{'$or':_[_0xa8c7('0x3a')](_0x4b8029[_0xa8c7('0x41')],function(_0x2f59fd){var _0x2a469c={};_0x2a469c[_0x2f59fd]={'$like':'%'+_0x19454[_0xa8c7('0x43')][_0xa8c7('0x4b')]+'%'};return _0x2a469c;})});}_0x4b8029=_[_0xa8c7('0x36')]({},_0x4b8029,_0x19454[_0xa8c7('0x4d')]);return _0x500787[_0xa8c7('0x57')](_0x4b8029);}})[_0xa8c7('0x1a')](function(_0x2e6e24){if(_0x2e6e24){_0x532e0e=_0x2e6e24[_0xa8c7('0x42')];if(!_0x19454[_0xa8c7('0x43')][_0xa8c7('0x44')](_0xa8c7('0x45'))){_0x4b8029[_0xa8c7('0x2a')]=qs['limit'](_0x19454[_0xa8c7('0x43')][_0xa8c7('0x2a')]);_0x4b8029[_0xa8c7('0x46')]=qs[_0xa8c7('0x46')](_0x19454[_0xa8c7('0x43')][_0xa8c7('0x46')]);}return _0x500787[_0xa8c7('0x57')](_0x4b8029);}})[_0xa8c7('0x1a')](function(_0x39e9d0){if(_0x39e9d0){return _0x39e9d0?{'count':_0x532e0e,'rows':_0x39e9d0}:null;}})[_0xa8c7('0x1a')](respondWithResult(_0x4ddc16,null))['catch'](handleError(_0x4ddc16,null));};exports[_0xa8c7('0x5a')]=function(_0x20feb3,_0x3c8c1a,_0xd8d9a5){if(_0x20feb3[_0xa8c7('0x56')]['id']){delete _0x20feb3[_0xa8c7('0x56')]['id'];}return db[_0xa8c7('0x3b')][_0xa8c7('0x5b')]({'where':{'id':_0x20feb3[_0xa8c7('0x52')]['id']}})[_0xa8c7('0x1a')](handleEntityNotFound(_0x3c8c1a,null))[_0xa8c7('0x1a')](function(_0x20c697){if(_0x20c697){_0x20feb3[_0xa8c7('0x56')]['AccountId']=_0x20c697['id'];_0x20feb3[_0xa8c7('0x56')][_0xa8c7('0x5c')]=integrations[_0xa8c7('0x5d')](_0x20feb3[_0xa8c7('0x56')]['channel'],_0x20feb3[_0xa8c7('0x56')][_0xa8c7('0x3d')]);_0x20feb3[_0xa8c7('0x56')]['Descriptions']=integrations[_0xa8c7('0x5e')](_0x20feb3['body'][_0xa8c7('0x5f')],_0x20feb3[_0xa8c7('0x56')][_0xa8c7('0x3d')]);return db[_0xa8c7('0x58')]['create'](_0x20feb3[_0xa8c7('0x56')],{'include':[{'model':db['FreshdeskField'],'as':_0xa8c7('0x5c')},{'model':db[_0xa8c7('0x60')],'as':_0xa8c7('0x61')}]});}return null;})[_0xa8c7('0x1a')](respondWithResult(_0x3c8c1a,null))['catch'](handleError(_0x3c8c1a,null));};exports[_0xa8c7('0x62')]=function(_0x5eaa0f,_0x40058a,_0x37cd25){var _0x21091e='';return db[_0xa8c7('0x3b')]['findOne']({'where':{'id':_0x5eaa0f[_0xa8c7('0x52')]['id']},'attributes':['id',_0xa8c7('0x63'),_0xa8c7('0x64')]})[_0xa8c7('0x1a')](handleEntityNotFound(_0x40058a,null))[_0xa8c7('0x1a')](function(_0x451db6){if(_0x451db6){_0x21091e=_0x451db6[_0xa8c7('0x63')];var _0x43c0ab=_0x21091e['slice'](-0x1);if(_0x43c0ab==='/'){_0x21091e=_0x21091e[_0xa8c7('0x65')](0x0,_0x21091e[_0xa8c7('0x66')](_0x43c0ab));}return rp({'method':_0xa8c7('0x67'),'uri':util[_0xa8c7('0x68')](_0xa8c7('0x69'),_0x21091e,_0xa8c7('0x6a')),'headers':{'Authorization':util[_0xa8c7('0x68')](_0xa8c7('0x6b'),new Buffer(util[_0xa8c7('0x68')]('%s:X',_0x451db6[_0xa8c7('0x64')]))[_0xa8c7('0x6c')](_0xa8c7('0x6d')))},'json':!![]});}})['then'](function(_0x1c5622){if(_0x1c5622){var _0x2ca880=[_0xa8c7('0x6e'),_0xa8c7('0x6f'),_0xa8c7('0x70'),_0xa8c7('0x71'),_0xa8c7('0x28'),_0xa8c7('0x72'),_0xa8c7('0x73'),_0xa8c7('0x74'),'ticket_type',_0xa8c7('0x73'),_0xa8c7('0x75')];_[_0xa8c7('0x76')](_0x1c5622,function(_0x26716e){return _0x2ca880[_0xa8c7('0x77')](_0x26716e[_0xa8c7('0x34')])||!_0x26716e['default']&&_0x26716e['type']!==_0xa8c7('0x78')&&_0x26716e[_0xa8c7('0x3d')]!==_0xa8c7('0x79');});return{'count':_0x1c5622[_0xa8c7('0x42')],'rows':_[_0xa8c7('0x3a')](_0x1c5622,function(_0x4dcc65){return{'id':_0x4dcc65[_0xa8c7('0x34')],'name':_0x4dcc65[_0xa8c7('0x7a')],'custom':!_0x4dcc65[_0xa8c7('0x7b')],'options':_0x4dcc65['choices']?_['map'](_0x4dcc65[_0xa8c7('0x7c')],function(_0x2ff25a){return{'name':_[_0xa8c7('0x7d')](_0x2ff25a),'value':_0x2ff25a};}):[]};})};}})['then'](respondWithResult(_0x40058a,null))[_0xa8c7('0x25')](function(_0x34840e){var _0x13f4a6=_0x5eaa0f[_0xa8c7('0x43')][_0xa8c7('0x7e')]?0x1f4:_0x34840e['statusCode']||0x1f4;logger[_0xa8c7('0x21')](_0xa8c7('0x7f'),'getFields',_0x13f4a6,JSON['stringify'](_0x34840e));delete _0x34840e[_0xa8c7('0x34')];if(_0x13f4a6===0x191){_0x13f4a6=0x190;}_0x40058a['status'](_0x13f4a6)[_0xa8c7('0x35')](_0x5eaa0f[_0xa8c7('0x43')][_0xa8c7('0x7e')]?{'message':_0xa8c7('0x80'),'statusCode':_0x34840e[_0xa8c7('0x81')]}:_0x34840e);});}; \ No newline at end of file +var _0x94df=['Descriptions','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','description','priority','ticket_type','group','company','includes','default','custom_dropdown','label','capitalize','statusCode','getFields','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','count','set','Content-Range','apply','update','stack','name','render','merge','body','contact','agent','interaction','account','index','map','FreshdeskAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','includeAll','include','rows','show','params','find','create','findOne','options','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField'];(function(_0x407d0f,_0x5cafa2){var _0xdeeb73=function(_0x476b28){while(--_0x476b28){_0x407d0f['push'](_0x407d0f['shift']());}};_0xdeeb73(++_0x5cafa2);}(_0x94df,0xa3));var _0xf94d=function(_0xeccf44,_0x525eb7){_0xeccf44=_0xeccf44-0x0;var _0x468b78=_0x94df[_0xeccf44];return _0x468b78;};'use strict';var emlformat=require(_0xf94d('0x0'));var rimraf=require(_0xf94d('0x1'));var zipdir=require(_0xf94d('0x2'));var jsonpatch=require(_0xf94d('0x3'));var rp=require(_0xf94d('0x4'));var moment=require(_0xf94d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf94d('0x6'));var util=require(_0xf94d('0x7'));var path=require(_0xf94d('0x8'));var sox=require(_0xf94d('0x9'));var csv=require(_0xf94d('0xa'));var ejs=require(_0xf94d('0xb'));var fs=require('fs');var fs_extra=require(_0xf94d('0xc'));var _=require(_0xf94d('0xd'));var squel=require(_0xf94d('0xe'));var crypto=require(_0xf94d('0xf'));var jsforce=require(_0xf94d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf94d('0xa'));var querystring=require(_0xf94d('0x11'));var Papa=require(_0xf94d('0x12'));var Redis=require(_0xf94d('0x13'));var authService=require(_0xf94d('0x14'));var qs=require(_0xf94d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf94d('0x16'));var logger=require(_0xf94d('0x17'))(_0xf94d('0x18'));var utils=require(_0xf94d('0x19'));var config=require(_0xf94d('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xf94d('0x1b'));var jayson=require(_0xf94d('0x1c'));var client=jayson[_0xf94d('0x1d')][_0xf94d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x186034,_0x381a5f,_0x509c69,_0x596da8){return new BPromise(function(_0x36ff94,_0x17234f){var _0x305c5f=_0x596da8||client;return _0x305c5f[_0xf94d('0x1f')](_0x186034,_0x509c69)[_0xf94d('0x20')](function(_0x14020b){logger[_0xf94d('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x381a5f,_0xf94d('0x22'));logger['debug'](_0xf94d('0x23'),_0x381a5f,'request\x20sent',JSON[_0xf94d('0x24')](_0x14020b));if(_0x14020b['error']){if(_0x14020b[_0xf94d('0x25')][_0xf94d('0x26')]===0x1f4){logger[_0xf94d('0x25')](_0xf94d('0x27'),_0x381a5f,_0x14020b['error'][_0xf94d('0x28')]);return _0x17234f(_0x14020b['error'][_0xf94d('0x28')]);}logger[_0xf94d('0x25')](_0xf94d('0x27'),_0x381a5f,_0x14020b[_0xf94d('0x25')]['message']);return _0x36ff94(_0x14020b[_0xf94d('0x25')]['message']);}else{logger[_0xf94d('0x21')](_0xf94d('0x27'),_0x381a5f,_0xf94d('0x22'));_0x36ff94(_0x14020b['result'][_0xf94d('0x28')]);}})[_0xf94d('0x29')](function(_0x2142a1){logger[_0xf94d('0x25')](_0xf94d('0x27'),_0x381a5f,_0x2142a1);_0x17234f(_0x2142a1);});});}function respondWithStatusCode(_0x533714,_0x301d2e){_0x301d2e=_0x301d2e||0xcc;return function(_0x51f7f8){if(_0x51f7f8){return _0x533714[_0xf94d('0x2a')](_0x301d2e);}return _0x533714[_0xf94d('0x2b')](_0x301d2e)[_0xf94d('0x2c')]();};}function respondWithResult(_0x6a2879,_0x997b6c){_0x997b6c=_0x997b6c||0xc8;return function(_0x1c4bdf){if(_0x1c4bdf){return _0x6a2879[_0xf94d('0x2b')](_0x997b6c)[_0xf94d('0x2d')](_0x1c4bdf);}};}function respondWithFilteredResult(_0x3c9fe3,_0x13c229){return function(_0x18ccd7){if(_0x18ccd7){var _0x4545b4=typeof _0x13c229[_0xf94d('0x2e')]==='undefined'&&typeof _0x13c229['limit']==='undefined';var _0x5e63bb=_0x18ccd7[_0xf94d('0x2f')];var _0x1e8242=_0x4545b4?0x0:_0x13c229['offset'];var _0x167585=_0x4545b4?_0x18ccd7[_0xf94d('0x2f')]:_0x13c229[_0xf94d('0x2e')]+_0x13c229['limit'];var _0x41b863;if(_0x167585>=_0x5e63bb){_0x167585=_0x5e63bb;_0x41b863=0xc8;}else{_0x41b863=0xce;}_0x3c9fe3['status'](_0x41b863);return _0x3c9fe3[_0xf94d('0x30')](_0xf94d('0x31'),_0x1e8242+'-'+_0x167585+'/'+_0x5e63bb)['json'](_0x18ccd7);}return null;};}function patchUpdates(_0x2378b0){return function(_0x4a0dd7){try{jsonpatch[_0xf94d('0x32')](_0x4a0dd7,_0x2378b0,!![]);}catch(_0x5ece47){return BPromise['reject'](_0x5ece47);}return _0x4a0dd7['save']();};}function saveUpdates(_0x20a270,_0x92e253){return function(_0x4b8b8f){if(_0x4b8b8f){return _0x4b8b8f[_0xf94d('0x33')](_0x20a270)['then'](function(_0x42a266){return _0x42a266;});}return null;};}function removeEntity(_0x251608,_0x56bfa4){return function(_0x458f27){if(_0x458f27){return _0x458f27['destroy']()[_0xf94d('0x20')](function(){_0x251608['status'](0xcc)[_0xf94d('0x2c')]();});}};}function handleEntityNotFound(_0x48c214,_0x3afb42){return function(_0x1ada36){if(!_0x1ada36){_0x48c214[_0xf94d('0x2a')](0x194);}return _0x1ada36;};}function handleError(_0x162163,_0x580939){_0x580939=_0x580939||0x1f4;return function(_0x5c9b2e){logger['error'](_0x5c9b2e[_0xf94d('0x34')]);if(_0x5c9b2e[_0xf94d('0x35')]){delete _0x5c9b2e[_0xf94d('0x35')];}_0x162163[_0xf94d('0x2b')](_0x580939)['send'](_0x5c9b2e);};}function getMustacheRender(_0x47efbc,_0x5db44c){return Mustache[_0xf94d('0x36')](_0x47efbc,_[_0xf94d('0x37')](_0x5db44c[_0xf94d('0x38')],{'contact':_0x5db44c[_0xf94d('0x39')],'message':_0x5db44c['message'],'agent':_0x5db44c[_0xf94d('0x3a')],'interaction':_0x5db44c[_0xf94d('0x3b')],'account':_0x5db44c[_0xf94d('0x3c')]}))||'';}exports[_0xf94d('0x3d')]=function(_0x565907,_0x446189){var _0x19d52={},_0x11e155={},_0x430d67={'count':0x0,'rows':[]};var _0x371110=_[_0xf94d('0x3e')](db[_0xf94d('0x3f')][_0xf94d('0x40')],function(_0xe9510e){return{'name':_0xe9510e[_0xf94d('0x41')],'type':_0xe9510e['type']['key']};});_0x11e155[_0xf94d('0x42')]=_['map'](_0x371110,_0xf94d('0x35'));_0x11e155['query']=_[_0xf94d('0x43')](_0x565907[_0xf94d('0x44')]);_0x11e155[_0xf94d('0x45')]=_[_0xf94d('0x46')](_0x11e155[_0xf94d('0x42')],_0x11e155['query']);_0x19d52[_0xf94d('0x47')]=_['intersection'](_0x11e155[_0xf94d('0x42')],qs['fields'](_0x565907[_0xf94d('0x44')][_0xf94d('0x48')]));_0x19d52[_0xf94d('0x47')]=_0x19d52[_0xf94d('0x47')][_0xf94d('0x49')]?_0x19d52[_0xf94d('0x47')]:_0x11e155[_0xf94d('0x42')];if(!_0x565907['query'][_0xf94d('0x4a')](_0xf94d('0x4b'))){_0x19d52[_0xf94d('0x4c')]=qs['limit'](_0x565907[_0xf94d('0x44')][_0xf94d('0x4c')]);_0x19d52[_0xf94d('0x2e')]=qs[_0xf94d('0x2e')](_0x565907[_0xf94d('0x44')][_0xf94d('0x2e')]);}_0x19d52[_0xf94d('0x4d')]=qs['sort'](_0x565907[_0xf94d('0x44')][_0xf94d('0x4e')]);_0x19d52[_0xf94d('0x4f')]=qs[_0xf94d('0x45')](_[_0xf94d('0x50')](_0x565907[_0xf94d('0x44')],_0x11e155['filters']),_0x371110);if(_0x565907['query'][_0xf94d('0x51')]){_0x19d52[_0xf94d('0x4f')]=_[_0xf94d('0x37')](_0x19d52[_0xf94d('0x4f')],{'$or':_[_0xf94d('0x3e')](_0x371110,function(_0x568036){if(_0x568036[_0xf94d('0x52')]!=='VIRTUAL'){var _0x319255={};_0x319255[_0x568036[_0xf94d('0x35')]]={'$like':'%'+_0x565907[_0xf94d('0x44')][_0xf94d('0x51')]+'%'};return _0x319255;}})});}_0x19d52=_[_0xf94d('0x37')]({},_0x19d52,_0x565907['options']);var _0x1c2247={'where':_0x19d52[_0xf94d('0x4f')]};return db[_0xf94d('0x3f')][_0xf94d('0x2f')](_0x1c2247)['then'](function(_0x159fb8){_0x430d67['count']=_0x159fb8;if(_0x565907['query'][_0xf94d('0x53')]){_0x19d52[_0xf94d('0x54')]=[{'all':!![]}];}return db[_0xf94d('0x3f')]['findAll'](_0x19d52);})[_0xf94d('0x20')](function(_0x560a26){_0x430d67[_0xf94d('0x55')]=_0x560a26;return _0x430d67;})[_0xf94d('0x20')](respondWithFilteredResult(_0x446189,_0x19d52))[_0xf94d('0x29')](handleError(_0x446189,null));};exports[_0xf94d('0x56')]=function(_0x1c0fbc,_0x24aceb){var _0x5c18f0={'raw':![],'where':{'id':_0x1c0fbc[_0xf94d('0x57')]['id']}},_0x213c7={};_0x213c7[_0xf94d('0x42')]=_[_0xf94d('0x43')](db['FreshdeskAccount'][_0xf94d('0x40')]);_0x213c7['query']=_[_0xf94d('0x43')](_0x1c0fbc['query']);_0x213c7[_0xf94d('0x45')]=_[_0xf94d('0x46')](_0x213c7[_0xf94d('0x42')],_0x213c7[_0xf94d('0x44')]);_0x5c18f0[_0xf94d('0x47')]=_['intersection'](_0x213c7['model'],qs[_0xf94d('0x48')](_0x1c0fbc[_0xf94d('0x44')][_0xf94d('0x48')]));_0x5c18f0[_0xf94d('0x47')]=_0x5c18f0[_0xf94d('0x47')][_0xf94d('0x49')]?_0x5c18f0['attributes']:_0x213c7[_0xf94d('0x42')];if(_0x1c0fbc[_0xf94d('0x44')][_0xf94d('0x53')]){_0x5c18f0[_0xf94d('0x54')]=[{'all':!![]}];}_0x5c18f0=_['merge']({},_0x5c18f0,_0x1c0fbc['options']);return db[_0xf94d('0x3f')][_0xf94d('0x58')](_0x5c18f0)[_0xf94d('0x20')](handleEntityNotFound(_0x24aceb,null))['then'](respondWithResult(_0x24aceb,null))[_0xf94d('0x29')](handleError(_0x24aceb,null));};exports[_0xf94d('0x59')]=function(_0xf716d1,_0x21f188){return db[_0xf94d('0x3f')][_0xf94d('0x59')](_0xf716d1[_0xf94d('0x38')],{})[_0xf94d('0x20')](respondWithResult(_0x21f188,0xc9))[_0xf94d('0x29')](handleError(_0x21f188,null));};exports['update']=function(_0x138089,_0x5d397d){if(_0x138089[_0xf94d('0x38')]['id']){delete _0x138089['body']['id'];}return db[_0xf94d('0x3f')][_0xf94d('0x58')]({'where':{'id':_0x138089[_0xf94d('0x57')]['id']}})['then'](handleEntityNotFound(_0x5d397d,null))[_0xf94d('0x20')](saveUpdates(_0x138089[_0xf94d('0x38')],null))[_0xf94d('0x20')](respondWithResult(_0x5d397d,null))[_0xf94d('0x29')](handleError(_0x5d397d,null));};exports['destroy']=function(_0x4bbbea,_0x35411b){return db['FreshdeskAccount']['find']({'where':{'id':_0x4bbbea[_0xf94d('0x57')]['id']}})[_0xf94d('0x20')](handleEntityNotFound(_0x35411b,null))['then'](removeEntity(_0x35411b,null))[_0xf94d('0x29')](handleError(_0x35411b,null));};exports['getConfigurations']=function(_0x5121ed,_0x5d6af6,_0xd0f734){var _0x4fe495={};var _0x2a1f61={};var _0x5caa6e;var _0x54f0c4;return db['FreshdeskAccount'][_0xf94d('0x5a')]({'where':{'id':_0x5121ed['params']['id']}})['then'](handleEntityNotFound(_0x5d6af6,null))[_0xf94d('0x20')](function(_0x5dff88){if(_0x5dff88){_0x5caa6e=_0x5dff88;_0x2a1f61[_0xf94d('0x42')]=_[_0xf94d('0x43')](db['FreshdeskConfiguration'][_0xf94d('0x40')]);_0x2a1f61['query']=_['keys'](_0x5121ed[_0xf94d('0x44')]);_0x2a1f61['filters']=_[_0xf94d('0x46')](_0x2a1f61[_0xf94d('0x42')],_0x2a1f61[_0xf94d('0x44')]);_0x4fe495[_0xf94d('0x47')]=_['intersection'](_0x2a1f61[_0xf94d('0x42')],qs[_0xf94d('0x48')](_0x5121ed[_0xf94d('0x44')][_0xf94d('0x48')]));_0x4fe495[_0xf94d('0x47')]=_0x4fe495[_0xf94d('0x47')]['length']?_0x4fe495[_0xf94d('0x47')]:_0x2a1f61[_0xf94d('0x42')];_0x4fe495[_0xf94d('0x4d')]=qs[_0xf94d('0x4e')](_0x5121ed[_0xf94d('0x44')]['sort']);_0x4fe495[_0xf94d('0x4f')]=qs[_0xf94d('0x45')](_[_0xf94d('0x50')](_0x5121ed[_0xf94d('0x44')],_0x2a1f61['filters']));if(_0x5121ed[_0xf94d('0x44')][_0xf94d('0x51')]){_0x4fe495[_0xf94d('0x4f')]=_[_0xf94d('0x37')](_0x4fe495[_0xf94d('0x4f')],{'$or':_[_0xf94d('0x3e')](_0x4fe495[_0xf94d('0x47')],function(_0x25faca){var _0x170a3f={};_0x170a3f[_0x25faca]={'$like':'%'+_0x5121ed[_0xf94d('0x44')][_0xf94d('0x51')]+'%'};return _0x170a3f;})});}_0x4fe495=_[_0xf94d('0x37')]({},_0x4fe495,_0x5121ed[_0xf94d('0x5b')]);return _0x5caa6e[_0xf94d('0x5c')](_0x4fe495);}})[_0xf94d('0x20')](function(_0x663aed){if(_0x663aed){_0x54f0c4=_0x663aed[_0xf94d('0x49')];if(!_0x5121ed[_0xf94d('0x44')][_0xf94d('0x4a')](_0xf94d('0x4b'))){_0x4fe495[_0xf94d('0x4c')]=qs[_0xf94d('0x4c')](_0x5121ed[_0xf94d('0x44')]['limit']);_0x4fe495['offset']=qs[_0xf94d('0x2e')](_0x5121ed[_0xf94d('0x44')][_0xf94d('0x2e')]);}return _0x5caa6e[_0xf94d('0x5c')](_0x4fe495);}})['then'](function(_0x203e5e){if(_0x203e5e){return _0x203e5e?{'count':_0x54f0c4,'rows':_0x203e5e}:null;}})[_0xf94d('0x20')](respondWithResult(_0x5d6af6,null))['catch'](handleError(_0x5d6af6,null));};exports[_0xf94d('0x5d')]=function(_0x5dca3e,_0x4383dd,_0xa20522){if(_0x5dca3e[_0xf94d('0x38')]['id']){delete _0x5dca3e[_0xf94d('0x38')]['id'];}return db[_0xf94d('0x3f')][_0xf94d('0x5a')]({'where':{'id':_0x5dca3e[_0xf94d('0x57')]['id']}})[_0xf94d('0x20')](handleEntityNotFound(_0x4383dd,null))['then'](function(_0x20551b){if(_0x20551b){_0x5dca3e[_0xf94d('0x38')][_0xf94d('0x5e')]=_0x20551b['id'];_0x5dca3e[_0xf94d('0x38')][_0xf94d('0x5f')]=integrations[_0xf94d('0x60')](_0x5dca3e[_0xf94d('0x38')][_0xf94d('0x61')],_0x5dca3e['body'][_0xf94d('0x52')]);_0x5dca3e[_0xf94d('0x38')]['Descriptions']=integrations[_0xf94d('0x62')](_0x5dca3e[_0xf94d('0x38')][_0xf94d('0x61')],_0x5dca3e['body']['type']);return db[_0xf94d('0x63')][_0xf94d('0x59')](_0x5dca3e[_0xf94d('0x38')],{'include':[{'model':db[_0xf94d('0x64')],'as':'Subjects'},{'model':db[_0xf94d('0x64')],'as':_0xf94d('0x65')}]});}return null;})[_0xf94d('0x20')](respondWithResult(_0x4383dd,null))[_0xf94d('0x29')](handleError(_0x4383dd,null));};exports['getFields']=function(_0x2445e1,_0x19f9ff,_0x4e5011){var _0x42fbc4='';return db[_0xf94d('0x3f')]['findOne']({'where':{'id':_0x2445e1[_0xf94d('0x57')]['id']},'attributes':['id',_0xf94d('0x66'),'apiKey']})[_0xf94d('0x20')](handleEntityNotFound(_0x19f9ff,null))['then'](function(_0x19cad4){if(_0x19cad4){_0x42fbc4=_0x19cad4[_0xf94d('0x66')];var _0x27329a=_0x42fbc4[_0xf94d('0x67')](-0x1);if(_0x27329a==='/'){_0x42fbc4=_0x42fbc4[_0xf94d('0x68')](0x0,_0x42fbc4[_0xf94d('0x69')](_0x27329a));}return rp({'method':_0xf94d('0x6a'),'uri':util[_0xf94d('0x6b')](_0xf94d('0x6c'),_0x42fbc4,_0xf94d('0x6d')),'headers':{'Authorization':util[_0xf94d('0x6b')](_0xf94d('0x6e'),new Buffer(util['format'](_0xf94d('0x6f'),_0x19cad4[_0xf94d('0x70')]))[_0xf94d('0x71')](_0xf94d('0x72')))},'json':!![]});}})[_0xf94d('0x20')](function(_0x212e6d){if(_0x212e6d){var _0x2f7b93=[_0xf94d('0x73'),_0xf94d('0x74'),_0xf94d('0x3a'),_0xf94d('0x75'),_0xf94d('0x2b'),_0xf94d('0x76'),'group','source',_0xf94d('0x77'),_0xf94d('0x78'),_0xf94d('0x79')];_['remove'](_0x212e6d,function(_0x5ce347){return _0x2f7b93[_0xf94d('0x7a')](_0x5ce347[_0xf94d('0x35')])||!_0x5ce347[_0xf94d('0x7b')]&&_0x5ce347[_0xf94d('0x52')]!=='custom_text'&&_0x5ce347['type']!==_0xf94d('0x7c');});return{'count':_0x212e6d[_0xf94d('0x49')],'rows':_[_0xf94d('0x3e')](_0x212e6d,function(_0x2f0881){return{'id':_0x2f0881[_0xf94d('0x35')],'name':_0x2f0881[_0xf94d('0x7d')],'custom':!_0x2f0881[_0xf94d('0x7b')],'options':_0x2f0881['choices']?_['map'](_0x2f0881['choices'],function(_0x3860ee){return{'name':_[_0xf94d('0x7e')](_0x3860ee),'value':_0x3860ee};}):[]};})};}})[_0xf94d('0x20')](respondWithResult(_0x19f9ff,null))[_0xf94d('0x29')](function(_0x80ec55){var _0x4025c9=_0x2445e1[_0xf94d('0x44')]['test']?0x1f4:_0x80ec55[_0xf94d('0x7f')]||0x1f4;logger[_0xf94d('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xf94d('0x80'),_0x4025c9,JSON[_0xf94d('0x24')](_0x80ec55));delete _0x80ec55[_0xf94d('0x35')];if(_0x4025c9===0x191){_0x4025c9=0x190;}_0x19f9ff[_0xf94d('0x2b')](_0x4025c9)[_0xf94d('0x81')](_0x2445e1[_0xf94d('0x44')][_0xf94d('0x82')]?{'message':_0xf94d('0x83'),'statusCode':_0x80ec55[_0xf94d('0x7f')]}:_0x80ec55);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index cd3991a..f72be99 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 _0x4ece=['rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','path'];(function(_0x166e71,_0x3a1cd4){var _0x2ebc75=function(_0x4889d9){while(--_0x4889d9){_0x166e71['push'](_0x166e71['shift']());}};_0x2ebc75(++_0x3a1cd4);}(_0x4ece,0x10b));var _0xe4ec=function(_0x36dd97,_0x5a3b4f){_0x36dd97=_0x36dd97-0x0;var _0x228d36=_0x4ece[_0x36dd97];return _0x228d36;};'use strict';var _=require(_0xe4ec('0x0'));var util=require(_0xe4ec('0x1'));var logger=require(_0xe4ec('0x2'))(_0xe4ec('0x3'));var moment=require(_0xe4ec('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4ec('0x5'));var rimraf=require(_0xe4ec('0x6'));var config=require(_0xe4ec('0x7'));var attributes=require(_0xe4ec('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xe4ec('0x9')]=function(_0x2261b3,_0x485152){return _0x2261b3[_0xe4ec('0xa')](_0xe4ec('0xb'),attributes,{'tableName':_0xe4ec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3261=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x261b7e,_0x4f830a){var _0x5c4ff8=function(_0x262093){while(--_0x262093){_0x261b7e['push'](_0x261b7e['shift']());}};_0x5c4ff8(++_0x4f830a);}(_0x3261,0xbb));var _0x1326=function(_0x249d21,_0x1e9ae4){_0x249d21=_0x249d21-0x0;var _0x44e285=_0x3261[_0x249d21];return _0x44e285;};'use strict';var _=require(_0x1326('0x0'));var util=require(_0x1326('0x1'));var logger=require(_0x1326('0x2'))('api');var moment=require(_0x1326('0x3'));var BPromise=require(_0x1326('0x4'));var rp=require(_0x1326('0x5'));var fs=require('fs');var path=require(_0x1326('0x6'));var rimraf=require(_0x1326('0x7'));var config=require(_0x1326('0x8'));var attributes=require(_0x1326('0x9'));var integrations=require(_0x1326('0xa'));module['exports']=function(_0x259603,_0x468a4e){return _0x259603['define']('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 5f350b8..e344106 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 _0xcf09=['../../config/environment','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','map','include','model','then','ShowFreshdeskAccount','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x21f3bf,_0xfb0f59){var _0x249d08=function(_0x37e6c2){while(--_0x37e6c2){_0x21f3bf['push'](_0x21f3bf['shift']());}};_0x249d08(++_0xfb0f59);}(_0xcf09,0xb4));var _0x9cf0=function(_0xb9b734,_0x47e117){_0xb9b734=_0xb9b734-0x0;var _0x461011=_0xcf09[_0xb9b734];return _0x461011;};'use strict';var _=require(_0x9cf0('0x0'));var util=require(_0x9cf0('0x1'));var moment=require('moment');var BPromise=require(_0x9cf0('0x2'));var rs=require(_0x9cf0('0x3'));var fs=require('fs');var Redis=require(_0x9cf0('0x4'));var db=require(_0x9cf0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9cf0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9cf0('0x7')][_0x9cf0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e290b,_0x1e2deb,_0x10b85b){return new BPromise(function(_0x4ad5d7,_0x306384){return client[_0x9cf0('0x9')](_0x1e290b,_0x10b85b)['then'](function(_0x4bd347){logger[_0x9cf0('0xa')](_0x9cf0('0xb'),_0x1e2deb,_0x9cf0('0xc'));logger[_0x9cf0('0xd')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x1e2deb,_0x9cf0('0xc'),JSON[_0x9cf0('0xe')](_0x4bd347));if(_0x4bd347[_0x9cf0('0xf')]){if(_0x4bd347[_0x9cf0('0xf')][_0x9cf0('0x10')]===0x1f4){logger['error'](_0x9cf0('0xb'),_0x1e2deb,_0x4bd347[_0x9cf0('0xf')][_0x9cf0('0x11')]);return _0x306384(_0x4bd347[_0x9cf0('0xf')][_0x9cf0('0x11')]);}logger[_0x9cf0('0xf')](_0x9cf0('0xb'),_0x1e2deb,_0x4bd347[_0x9cf0('0xf')]['message']);return _0x4ad5d7(_0x4bd347[_0x9cf0('0xf')]['message']);}else{logger[_0x9cf0('0xa')](_0x9cf0('0xb'),_0x1e2deb,_0x9cf0('0xc'));_0x4ad5d7(_0x4bd347['result'][_0x9cf0('0x11')]);}})[_0x9cf0('0x12')](function(_0x33548e){logger[_0x9cf0('0xf')](_0x9cf0('0xb'),_0x1e2deb,_0x33548e);_0x306384(_0x33548e);});});}exports[_0x9cf0('0x13')]=function(_0x332914){var _0x4271fb=this;return new Promise(function(_0x35ef02,_0x40fe81){return db[_0x9cf0('0x14')][_0x9cf0('0x15')]({'raw':_0x332914[_0x9cf0('0x16')]?_0x332914[_0x9cf0('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x332914[_0x9cf0('0x16')]?_0x332914['options'][_0x9cf0('0x17')]||null:null,'attributes':_0x332914[_0x9cf0('0x16')]?_0x332914[_0x9cf0('0x16')][_0x9cf0('0x18')]||null:null,'limit':_0x332914[_0x9cf0('0x16')]?_0x332914[_0x9cf0('0x16')]['limit']||null:null,'include':_0x332914['options']?_0x332914[_0x9cf0('0x16')]['include']?_[_0x9cf0('0x19')](_0x332914['options']['include'],function(_0x289043){return{'model':db[_0x289043['model']],'as':_0x289043['as'],'attributes':_0x289043[_0x9cf0('0x18')],'include':_0x289043['include']?_[_0x9cf0('0x19')](_0x289043[_0x9cf0('0x1a')],function(_0xef61a1){return{'model':db[_0xef61a1[_0x9cf0('0x1b')]],'as':_0xef61a1['as'],'attributes':_0xef61a1[_0x9cf0('0x18')],'include':_0xef61a1[_0x9cf0('0x1a')]?_[_0x9cf0('0x19')](_0xef61a1[_0x9cf0('0x1a')],function(_0x356a10){return{'model':db[_0x356a10[_0x9cf0('0x1b')]],'as':_0x356a10['as'],'attributes':_0x356a10[_0x9cf0('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9cf0('0x1c')](function(_0x44ecfb){logger[_0x9cf0('0xa')]('GetFreshdeskAccount',_0x332914);logger[_0x9cf0('0xd')]('GetFreshdeskAccount',_0x332914,JSON[_0x9cf0('0xe')](_0x44ecfb));_0x35ef02(_0x44ecfb);})['catch'](function(_0x7feb1b){logger[_0x9cf0('0xf')](_0x9cf0('0x13'),_0x7feb1b[_0x9cf0('0x11')],_0x332914);_0x40fe81(_0x4271fb[_0x9cf0('0xf')](0x1f4,_0x7feb1b[_0x9cf0('0x11')]));});});};exports[_0x9cf0('0x1d')]=function(_0xbd8e87){var _0x83f2b4=this;return new Promise(function(_0xfdcf9c,_0x250a92){return db[_0x9cf0('0x14')]['find']({'raw':_0xbd8e87[_0x9cf0('0x16')]?_0xbd8e87[_0x9cf0('0x16')][_0x9cf0('0x1e')]===undefined?!![]:![]:!![],'where':_0xbd8e87[_0x9cf0('0x16')]?_0xbd8e87[_0x9cf0('0x16')][_0x9cf0('0x17')]||null:null,'attributes':_0xbd8e87[_0x9cf0('0x16')]?_0xbd8e87[_0x9cf0('0x16')]['attributes']||null:null,'include':_0xbd8e87[_0x9cf0('0x16')]?_0xbd8e87['options'][_0x9cf0('0x1a')]?_[_0x9cf0('0x19')](_0xbd8e87[_0x9cf0('0x16')]['include'],function(_0x184751){return{'model':db[_0x184751[_0x9cf0('0x1b')]],'as':_0x184751['as'],'attributes':_0x184751['attributes'],'include':_0x184751[_0x9cf0('0x1a')]?_['map'](_0x184751[_0x9cf0('0x1a')],function(_0x2d43c5){return{'model':db[_0x2d43c5[_0x9cf0('0x1b')]],'as':_0x2d43c5['as'],'attributes':_0x2d43c5[_0x9cf0('0x18')],'include':_0x2d43c5[_0x9cf0('0x1a')]?_[_0x9cf0('0x19')](_0x2d43c5['include'],function(_0xdcac1c){return{'model':db[_0xdcac1c[_0x9cf0('0x1b')]],'as':_0xdcac1c['as'],'attributes':_0xdcac1c['attributes']};}):[]};}):[]};}):[]:[]})[_0x9cf0('0x1c')](function(_0x4d4688){logger[_0x9cf0('0xa')](_0x9cf0('0x1d'),_0xbd8e87);logger[_0x9cf0('0xd')](_0x9cf0('0x1d'),_0xbd8e87,JSON[_0x9cf0('0xe')](_0x4d4688));_0xfdcf9c(_0x4d4688);})[_0x9cf0('0x12')](function(_0x329f1d){logger['error'](_0x9cf0('0x1d'),_0x329f1d[_0x9cf0('0x11')],_0xbd8e87);_0x250a92(_0x83f2b4[_0x9cf0('0xf')](0x1f4,_0x329f1d[_0x9cf0('0x11')]));});});}; \ No newline at end of file +var _0x6c29=['options','raw','where','attributes','include','map','model','GetFreshdeskAccount','stringify','ShowFreshdeskAccount','find','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','FreshdeskAccount','findAll'];(function(_0xa14087,_0x3fe52c){var _0xdc789d=function(_0x1a78f2){while(--_0x1a78f2){_0xa14087['push'](_0xa14087['shift']());}};_0xdc789d(++_0x3fe52c);}(_0x6c29,0x135));var _0x96c2=function(_0x582f72,_0x886d8){_0x582f72=_0x582f72-0x0;var _0x4cd5fe=_0x6c29[_0x582f72];return _0x4cd5fe;};'use strict';var _=require(_0x96c2('0x0'));var util=require(_0x96c2('0x1'));var moment=require(_0x96c2('0x2'));var BPromise=require('bluebird');var rs=require(_0x96c2('0x3'));var fs=require('fs');var Redis=require(_0x96c2('0x4'));var db=require(_0x96c2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x96c2('0x6'))('rpc');var config=require(_0x96c2('0x7'));var jayson=require(_0x96c2('0x8'));var client=jayson[_0x96c2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x560ff5,_0x45ed8f,_0x5e0f60){return new BPromise(function(_0x44d503,_0x289fa3){return client[_0x96c2('0xa')](_0x560ff5,_0x5e0f60)[_0x96c2('0xb')](function(_0x37f50b){logger[_0x96c2('0xc')](_0x96c2('0xd'),_0x45ed8f,_0x96c2('0xe'));logger[_0x96c2('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x45ed8f,'request\x20sent',JSON['stringify'](_0x37f50b));if(_0x37f50b[_0x96c2('0x10')]){if(_0x37f50b[_0x96c2('0x10')][_0x96c2('0x11')]===0x1f4){logger[_0x96c2('0x10')](_0x96c2('0xd'),_0x45ed8f,_0x37f50b[_0x96c2('0x10')][_0x96c2('0x12')]);return _0x289fa3(_0x37f50b[_0x96c2('0x10')][_0x96c2('0x12')]);}logger[_0x96c2('0x10')](_0x96c2('0xd'),_0x45ed8f,_0x37f50b[_0x96c2('0x10')][_0x96c2('0x12')]);return _0x44d503(_0x37f50b[_0x96c2('0x10')][_0x96c2('0x12')]);}else{logger[_0x96c2('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x45ed8f,_0x96c2('0xe'));_0x44d503(_0x37f50b['result'][_0x96c2('0x12')]);}})['catch'](function(_0x3a0dd3){logger['error'](_0x96c2('0xd'),_0x45ed8f,_0x3a0dd3);_0x289fa3(_0x3a0dd3);});});}exports['GetFreshdeskAccount']=function(_0xd2872b){var _0x15c826=this;return new Promise(function(_0x89f20,_0x4729a7){return db[_0x96c2('0x13')][_0x96c2('0x14')]({'raw':_0xd2872b[_0x96c2('0x15')]?_0xd2872b[_0x96c2('0x15')][_0x96c2('0x16')]===undefined?!![]:![]:!![],'where':_0xd2872b[_0x96c2('0x15')]?_0xd2872b[_0x96c2('0x15')][_0x96c2('0x17')]||null:null,'attributes':_0xd2872b['options']?_0xd2872b[_0x96c2('0x15')][_0x96c2('0x18')]||null:null,'limit':_0xd2872b[_0x96c2('0x15')]?_0xd2872b['options']['limit']||null:null,'include':_0xd2872b['options']?_0xd2872b[_0x96c2('0x15')][_0x96c2('0x19')]?_[_0x96c2('0x1a')](_0xd2872b[_0x96c2('0x15')][_0x96c2('0x19')],function(_0x2e2750){return{'model':db[_0x2e2750[_0x96c2('0x1b')]],'as':_0x2e2750['as'],'attributes':_0x2e2750[_0x96c2('0x18')],'include':_0x2e2750[_0x96c2('0x19')]?_[_0x96c2('0x1a')](_0x2e2750[_0x96c2('0x19')],function(_0x38230a){return{'model':db[_0x38230a[_0x96c2('0x1b')]],'as':_0x38230a['as'],'attributes':_0x38230a[_0x96c2('0x18')],'include':_0x38230a[_0x96c2('0x19')]?_[_0x96c2('0x1a')](_0x38230a['include'],function(_0x15c99d){return{'model':db[_0x15c99d[_0x96c2('0x1b')]],'as':_0x15c99d['as'],'attributes':_0x15c99d[_0x96c2('0x18')]};}):[]};}):[]};}):[]:[]})[_0x96c2('0xb')](function(_0x5e5b3f){logger[_0x96c2('0xc')](_0x96c2('0x1c'),_0xd2872b);logger[_0x96c2('0xf')]('GetFreshdeskAccount',_0xd2872b,JSON[_0x96c2('0x1d')](_0x5e5b3f));_0x89f20(_0x5e5b3f);})['catch'](function(_0x540a07){logger[_0x96c2('0x10')](_0x96c2('0x1c'),_0x540a07[_0x96c2('0x12')],_0xd2872b);_0x4729a7(_0x15c826[_0x96c2('0x10')](0x1f4,_0x540a07[_0x96c2('0x12')]));});});};exports[_0x96c2('0x1e')]=function(_0x3a22aa){var _0x3274cb=this;return new Promise(function(_0x4d68d7,_0x3262b3){return db[_0x96c2('0x13')][_0x96c2('0x1f')]({'raw':_0x3a22aa[_0x96c2('0x15')]?_0x3a22aa[_0x96c2('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3a22aa['options']?_0x3a22aa[_0x96c2('0x15')][_0x96c2('0x17')]||null:null,'attributes':_0x3a22aa[_0x96c2('0x15')]?_0x3a22aa['options'][_0x96c2('0x18')]||null:null,'include':_0x3a22aa[_0x96c2('0x15')]?_0x3a22aa[_0x96c2('0x15')][_0x96c2('0x19')]?_['map'](_0x3a22aa[_0x96c2('0x15')][_0x96c2('0x19')],function(_0x37d0e1){return{'model':db[_0x37d0e1[_0x96c2('0x1b')]],'as':_0x37d0e1['as'],'attributes':_0x37d0e1[_0x96c2('0x18')],'include':_0x37d0e1['include']?_['map'](_0x37d0e1[_0x96c2('0x19')],function(_0x60b6a8){return{'model':db[_0x60b6a8[_0x96c2('0x1b')]],'as':_0x60b6a8['as'],'attributes':_0x60b6a8[_0x96c2('0x18')],'include':_0x60b6a8[_0x96c2('0x19')]?_[_0x96c2('0x1a')](_0x60b6a8[_0x96c2('0x19')],function(_0x5c4838){return{'model':db[_0x5c4838['model']],'as':_0x5c4838['as'],'attributes':_0x5c4838[_0x96c2('0x18')]};}):[]};}):[]};}):[]:[]})[_0x96c2('0xb')](function(_0x1aba03){logger[_0x96c2('0xc')](_0x96c2('0x1e'),_0x3a22aa);logger[_0x96c2('0xf')](_0x96c2('0x1e'),_0x3a22aa,JSON[_0x96c2('0x1d')](_0x1aba03));_0x4d68d7(_0x1aba03);})[_0x96c2('0x20')](function(_0x2e871e){logger['error']('ShowFreshdeskAccount',_0x2e871e[_0x96c2('0x12')],_0x3a22aa);_0x3262b3(_0x3274cb['error'](0x1f4,_0x2e871e[_0x96c2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 2501da2..bc56239 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 _0xef0d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','multer','util'];(function(_0x10976b,_0x362472){var _0x4cd35e=function(_0x1d508f){while(--_0x1d508f){_0x10976b['push'](_0x10976b['shift']());}};_0x4cd35e(++_0x362472);}(_0xef0d,0x6a));var _0xdef0=function(_0x54557e,_0x16c93a){_0x54557e=_0x54557e-0x0;var _0x2a90f6=_0xef0d[_0x54557e];return _0x2a90f6;};'use strict';var multer=require(_0xdef0('0x0'));var util=require(_0xdef0('0x1'));var path=require('path');var timeout=require(_0xdef0('0x2'));var express=require(_0xdef0('0x3'));var router=express[_0xdef0('0x4')]();var fs_extra=require(_0xdef0('0x5'));var auth=require(_0xdef0('0x6'));var interaction=require(_0xdef0('0x7'));var config=require(_0xdef0('0x8'));var controller=require(_0xdef0('0x9'));router[_0xdef0('0xa')]('/',auth[_0xdef0('0xb')](),controller[_0xdef0('0xc')]);router['get'](_0xdef0('0xd'),auth['isAuthenticated'](),controller[_0xdef0('0xe')]);router[_0xdef0('0xa')]('/:id/fields',auth[_0xdef0('0xb')](),controller[_0xdef0('0xf')]);router[_0xdef0('0xa')](_0xdef0('0x10'),auth[_0xdef0('0xb')](),controller[_0xdef0('0x11')]);router[_0xdef0('0xa')](_0xdef0('0x12'),auth[_0xdef0('0xb')](),controller['getDescriptions']);router[_0xdef0('0xa')](_0xdef0('0x13'),auth[_0xdef0('0xb')](),controller[_0xdef0('0x14')]);router[_0xdef0('0x15')]('/',auth[_0xdef0('0xb')](),controller['create']);router[_0xdef0('0x15')]('/:id/tags',auth['isAuthenticated'](),controller[_0xdef0('0x16')]);router[_0xdef0('0x17')](_0xdef0('0xd'),auth[_0xdef0('0xb')](),controller[_0xdef0('0x18')]);router[_0xdef0('0x19')]('/:id',auth[_0xdef0('0xb')](),controller[_0xdef0('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x7162=['/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects'];(function(_0x3f4f44,_0x59b2fd){var _0x3e2e14=function(_0x4bd8db){while(--_0x4bd8db){_0x3f4f44['push'](_0x3f4f44['shift']());}};_0x3e2e14(++_0x59b2fd);}(_0x7162,0xe2));var _0x2716=function(_0x1aaee5,_0x24d737){_0x1aaee5=_0x1aaee5-0x0;var _0x1985a2=_0x7162[_0x1aaee5];return _0x1985a2;};'use strict';var multer=require(_0x2716('0x0'));var util=require(_0x2716('0x1'));var path=require('path');var timeout=require(_0x2716('0x2'));var express=require(_0x2716('0x3'));var router=express[_0x2716('0x4')]();var fs_extra=require(_0x2716('0x5'));var auth=require(_0x2716('0x6'));var interaction=require(_0x2716('0x7'));var config=require(_0x2716('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x2716('0x9')]('/',auth[_0x2716('0xa')](),controller[_0x2716('0xb')]);router['get'](_0x2716('0xc'),auth[_0x2716('0xa')](),controller[_0x2716('0xd')]);router[_0x2716('0x9')](_0x2716('0xe'),auth[_0x2716('0xa')](),controller[_0x2716('0xf')]);router[_0x2716('0x9')]('/:id/subjects',auth[_0x2716('0xa')](),controller[_0x2716('0x10')]);router[_0x2716('0x9')](_0x2716('0x11'),auth[_0x2716('0xa')](),controller[_0x2716('0x12')]);router['get'](_0x2716('0x13'),auth[_0x2716('0xa')](),controller[_0x2716('0x14')]);router[_0x2716('0x15')]('/',auth[_0x2716('0xa')](),controller['create']);router['post'](_0x2716('0x13'),auth[_0x2716('0xa')](),controller[_0x2716('0x16')]);router['put'](_0x2716('0xc'),auth[_0x2716('0xa')](),controller[_0x2716('0x17')]);router[_0x2716('0x18')](_0x2716('0xc'),auth['isAuthenticated'](),controller[_0x2716('0x19')]);module[_0x2716('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index a836b57..31688fb 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 _0x3a4a=['STRING','sequelize'];(function(_0xacea21,_0x158b7c){var _0x2a7dae=function(_0x53ef6c){while(--_0x53ef6c){_0xacea21['push'](_0xacea21['shift']());}};_0x2a7dae(++_0x158b7c);}(_0x3a4a,0x83));var _0xa3a4=function(_0x43747e,_0x13b832){_0x43747e=_0x43747e-0x0;var _0x7fb853=_0x3a4a[_0x43747e];return _0x7fb853;};'use strict';var Sequelize=require(_0xa3a4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa3a4('0x1')]}}; \ No newline at end of file +var _0x527b=['STRING','sequelize','exports'];(function(_0x46bbdf,_0xa1f48f){var _0x262c71=function(_0x52c9d6){while(--_0x52c9d6){_0x46bbdf['push'](_0x46bbdf['shift']());}};_0x262c71(++_0xa1f48f);}(_0x527b,0xf1));var _0xb527=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0x527b[_0x1314d4];return _0x584ba5;};'use strict';var Sequelize=require(_0xb527('0x0'));module[_0xb527('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb527('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index ba35ba0..4d0702d 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 _0x26d4=['send','render','merge','body','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','VIRTUAL','filter','FreshdeskConfiguration','includeAll','include','findAll','rows','show','params','length','find','create','getFields','findOne','keys','FreshdeskField','order','pick','options','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','sendStatus','stack','name'];(function(_0x1287b3,_0x58e7c9){var _0x5529ab=function(_0x182f0e){while(--_0x182f0e){_0x1287b3['push'](_0x1287b3['shift']());}};_0x5529ab(++_0x58e7c9);}(_0x26d4,0x1c6));var _0x426d=function(_0x3412df,_0x4f5c57){_0x3412df=_0x3412df-0x0;var _0x3e5af4=_0x26d4[_0x3412df];return _0x3e5af4;};'use strict';var emlformat=require(_0x426d('0x0'));var rimraf=require(_0x426d('0x1'));var zipdir=require(_0x426d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x426d('0x3'));var moment=require('moment');var BPromise=require(_0x426d('0x4'));var Mustache=require(_0x426d('0x5'));var util=require(_0x426d('0x6'));var path=require(_0x426d('0x7'));var sox=require(_0x426d('0x8'));var csv=require(_0x426d('0x9'));var ejs=require(_0x426d('0xa'));var fs=require('fs');var fs_extra=require(_0x426d('0xb'));var _=require(_0x426d('0xc'));var squel=require(_0x426d('0xd'));var crypto=require(_0x426d('0xe'));var jsforce=require(_0x426d('0xf'));var deskjs=require(_0x426d('0x10'));var toCsv=require(_0x426d('0x9'));var querystring=require(_0x426d('0x11'));var Papa=require(_0x426d('0x12'));var Redis=require('ioredis');var authService=require(_0x426d('0x13'));var qs=require(_0x426d('0x14'));var as=require(_0x426d('0x15'));var hardwareService=require(_0x426d('0x16'));var logger=require(_0x426d('0x17'))(_0x426d('0x18'));var utils=require('../../config/utils');var config=require(_0x426d('0x19'));var licenseUtil=require(_0x426d('0x1a'));var db=require(_0x426d('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x426d('0x1c')][_0x426d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x43fc04,_0xce91c2,_0x33c9eb,_0x4ffff3){return new BPromise(function(_0x1f2e8a,_0x545326){var _0x205945=_0x4ffff3||client;return _0x205945[_0x426d('0x1e')](_0x43fc04,_0x33c9eb)[_0x426d('0x1f')](function(_0x5c90c9){logger[_0x426d('0x20')](_0x426d('0x21'),_0xce91c2,_0x426d('0x22'));logger[_0x426d('0x23')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0xce91c2,'request\x20sent',JSON[_0x426d('0x24')](_0x5c90c9));if(_0x5c90c9[_0x426d('0x25')]){if(_0x5c90c9['error']['code']===0x1f4){logger['error'](_0x426d('0x21'),_0xce91c2,_0x5c90c9[_0x426d('0x25')][_0x426d('0x26')]);return _0x545326(_0x5c90c9[_0x426d('0x25')][_0x426d('0x26')]);}logger[_0x426d('0x25')](_0x426d('0x21'),_0xce91c2,_0x5c90c9[_0x426d('0x25')][_0x426d('0x26')]);return _0x1f2e8a(_0x5c90c9['error'][_0x426d('0x26')]);}else{logger['info'](_0x426d('0x21'),_0xce91c2,_0x426d('0x22'));_0x1f2e8a(_0x5c90c9[_0x426d('0x27')][_0x426d('0x26')]);}})[_0x426d('0x28')](function(_0x59064a){logger[_0x426d('0x25')](_0x426d('0x21'),_0xce91c2,_0x59064a);_0x545326(_0x59064a);});});}function respondWithStatusCode(_0x4694b4,_0xf19a94){_0xf19a94=_0xf19a94||0xcc;return function(_0x290007){if(_0x290007){return _0x4694b4['sendStatus'](_0xf19a94);}return _0x4694b4[_0x426d('0x29')](_0xf19a94)[_0x426d('0x2a')]();};}function respondWithResult(_0x4f3bf6,_0x2320e9){_0x2320e9=_0x2320e9||0xc8;return function(_0x4aa366){if(_0x4aa366){return _0x4f3bf6[_0x426d('0x29')](_0x2320e9)[_0x426d('0x2b')](_0x4aa366);}};}function respondWithFilteredResult(_0x1be1f8,_0x15d715){return function(_0x298380){if(_0x298380){var _0x4885d6=typeof _0x15d715[_0x426d('0x2c')]===_0x426d('0x2d')&&typeof _0x15d715[_0x426d('0x2e')]==='undefined';var _0x1d784f=_0x298380[_0x426d('0x2f')];var _0x38ae49=_0x4885d6?0x0:_0x15d715['offset'];var _0x2a8b9e=_0x4885d6?_0x298380[_0x426d('0x2f')]:_0x15d715[_0x426d('0x2c')]+_0x15d715[_0x426d('0x2e')];var _0x1b6a64;if(_0x2a8b9e>=_0x1d784f){_0x2a8b9e=_0x1d784f;_0x1b6a64=0xc8;}else{_0x1b6a64=0xce;}_0x1be1f8[_0x426d('0x29')](_0x1b6a64);return _0x1be1f8[_0x426d('0x30')]('Content-Range',_0x38ae49+'-'+_0x2a8b9e+'/'+_0x1d784f)[_0x426d('0x2b')](_0x298380);}return null;};}function patchUpdates(_0xcff0c9){return function(_0x97a7ee){try{jsonpatch['apply'](_0x97a7ee,_0xcff0c9,!![]);}catch(_0xc2d8ac){return BPromise[_0x426d('0x31')](_0xc2d8ac);}return _0x97a7ee[_0x426d('0x32')]();};}function saveUpdates(_0x1eb980,_0x437a3e){return function(_0x23c579){if(_0x23c579){return _0x23c579[_0x426d('0x33')](_0x1eb980)[_0x426d('0x1f')](function(_0x2cce12){return _0x2cce12;});}return null;};}function removeEntity(_0x42d438,_0x3c6638){return function(_0x55d30e){if(_0x55d30e){return _0x55d30e[_0x426d('0x34')]()[_0x426d('0x1f')](function(){_0x42d438[_0x426d('0x29')](0xcc)[_0x426d('0x2a')]();});}};}function handleEntityNotFound(_0x291a27,_0x594d6d){return function(_0x5eef06){if(!_0x5eef06){_0x291a27[_0x426d('0x35')](0x194);}return _0x5eef06;};}function handleError(_0x4d6225,_0x7d5869){_0x7d5869=_0x7d5869||0x1f4;return function(_0x312781){logger[_0x426d('0x25')](_0x312781[_0x426d('0x36')]);if(_0x312781[_0x426d('0x37')]){delete _0x312781[_0x426d('0x37')];}_0x4d6225['status'](_0x7d5869)[_0x426d('0x38')](_0x312781);};}function getMustacheRender(_0x20dea3,_0x116f6a){return Mustache[_0x426d('0x39')](_0x20dea3,_[_0x426d('0x3a')](_0x116f6a[_0x426d('0x3b')],{'contact':_0x116f6a['contact'],'message':_0x116f6a[_0x426d('0x26')],'agent':_0x116f6a[_0x426d('0x3c')],'interaction':_0x116f6a[_0x426d('0x3d')],'account':_0x116f6a[_0x426d('0x3e')]}))||'';}exports[_0x426d('0x3f')]=function(_0x28645e,_0x2c7583){var _0x44c1a1={},_0xa50514={},_0x3622c1={'count':0x0,'rows':[]};var _0x3d5fed=_[_0x426d('0x40')](db['FreshdeskConfiguration'][_0x426d('0x41')],function(_0x424263){return{'name':_0x424263[_0x426d('0x42')],'type':_0x424263[_0x426d('0x43')][_0x426d('0x44')]};});_0xa50514[_0x426d('0x45')]=_['map'](_0x3d5fed,_0x426d('0x37'));_0xa50514[_0x426d('0x46')]=_['keys'](_0x28645e[_0x426d('0x46')]);_0xa50514[_0x426d('0x47')]=_[_0x426d('0x48')](_0xa50514[_0x426d('0x45')],_0xa50514[_0x426d('0x46')]);_0x44c1a1[_0x426d('0x49')]=_[_0x426d('0x48')](_0xa50514[_0x426d('0x45')],qs[_0x426d('0x4a')](_0x28645e['query'][_0x426d('0x4a')]));_0x44c1a1[_0x426d('0x49')]=_0x44c1a1[_0x426d('0x49')]['length']?_0x44c1a1[_0x426d('0x49')]:_0xa50514[_0x426d('0x45')];if(!_0x28645e[_0x426d('0x46')][_0x426d('0x4b')]('nolimit')){_0x44c1a1[_0x426d('0x2e')]=qs[_0x426d('0x2e')](_0x28645e[_0x426d('0x46')][_0x426d('0x2e')]);_0x44c1a1['offset']=qs[_0x426d('0x2c')](_0x28645e[_0x426d('0x46')][_0x426d('0x2c')]);}_0x44c1a1['order']=qs[_0x426d('0x4c')](_0x28645e[_0x426d('0x46')][_0x426d('0x4c')]);_0x44c1a1[_0x426d('0x4d')]=qs[_0x426d('0x47')](_['pick'](_0x28645e[_0x426d('0x46')],_0xa50514[_0x426d('0x47')]),_0x3d5fed);if(_0x28645e[_0x426d('0x46')]['filter']){_0x44c1a1['where']=_[_0x426d('0x3a')](_0x44c1a1[_0x426d('0x4d')],{'$or':_[_0x426d('0x40')](_0x3d5fed,function(_0xabf0d0){if(_0xabf0d0[_0x426d('0x43')]!==_0x426d('0x4e')){var _0x26ca44={};_0x26ca44[_0xabf0d0['name']]={'$like':'%'+_0x28645e[_0x426d('0x46')][_0x426d('0x4f')]+'%'};return _0x26ca44;}})});}_0x44c1a1=_[_0x426d('0x3a')]({},_0x44c1a1,_0x28645e['options']);var _0x45c442={'where':_0x44c1a1[_0x426d('0x4d')]};return db[_0x426d('0x50')]['count'](_0x45c442)['then'](function(_0x39cab1){_0x3622c1['count']=_0x39cab1;if(_0x28645e[_0x426d('0x46')][_0x426d('0x51')]){_0x44c1a1[_0x426d('0x52')]=[{'all':!![]}];}return db[_0x426d('0x50')][_0x426d('0x53')](_0x44c1a1);})[_0x426d('0x1f')](function(_0x558228){_0x3622c1[_0x426d('0x54')]=_0x558228;return _0x3622c1;})[_0x426d('0x1f')](respondWithFilteredResult(_0x2c7583,_0x44c1a1))[_0x426d('0x28')](handleError(_0x2c7583,null));};exports[_0x426d('0x55')]=function(_0x5469d1,_0x1cc469){var _0x2b4ead={'raw':![],'where':{'id':_0x5469d1[_0x426d('0x56')]['id']}},_0xcd0690={};_0xcd0690['model']=_['keys'](db[_0x426d('0x50')][_0x426d('0x41')]);_0xcd0690['query']=_['keys'](_0x5469d1[_0x426d('0x46')]);_0xcd0690[_0x426d('0x47')]=_[_0x426d('0x48')](_0xcd0690['model'],_0xcd0690[_0x426d('0x46')]);_0x2b4ead[_0x426d('0x49')]=_[_0x426d('0x48')](_0xcd0690[_0x426d('0x45')],qs[_0x426d('0x4a')](_0x5469d1[_0x426d('0x46')][_0x426d('0x4a')]));_0x2b4ead[_0x426d('0x49')]=_0x2b4ead[_0x426d('0x49')][_0x426d('0x57')]?_0x2b4ead[_0x426d('0x49')]:_0xcd0690[_0x426d('0x45')];if(_0x5469d1[_0x426d('0x46')][_0x426d('0x51')]){_0x2b4ead[_0x426d('0x52')]=[{'all':!![]}];}_0x2b4ead=_[_0x426d('0x3a')]({},_0x2b4ead,_0x5469d1['options']);return db[_0x426d('0x50')][_0x426d('0x58')](_0x2b4ead)['then'](handleEntityNotFound(_0x1cc469,null))[_0x426d('0x1f')](respondWithResult(_0x1cc469,null))[_0x426d('0x28')](handleError(_0x1cc469,null));};exports[_0x426d('0x59')]=function(_0x105c0a,_0x3c6da4){return db[_0x426d('0x50')][_0x426d('0x59')](_0x105c0a[_0x426d('0x3b')],{})[_0x426d('0x1f')](respondWithResult(_0x3c6da4,0xc9))[_0x426d('0x28')](handleError(_0x3c6da4,null));};exports['update']=function(_0x4dd4ba,_0x3fe8be){if(_0x4dd4ba[_0x426d('0x3b')]['id']){delete _0x4dd4ba[_0x426d('0x3b')]['id'];}return db[_0x426d('0x50')][_0x426d('0x58')]({'where':{'id':_0x4dd4ba[_0x426d('0x56')]['id']}})[_0x426d('0x1f')](handleEntityNotFound(_0x3fe8be,null))[_0x426d('0x1f')](saveUpdates(_0x4dd4ba[_0x426d('0x3b')],null))[_0x426d('0x1f')](respondWithResult(_0x3fe8be,null))[_0x426d('0x28')](handleError(_0x3fe8be,null));};exports[_0x426d('0x34')]=function(_0x1619ef,_0x354cc3){return db[_0x426d('0x50')][_0x426d('0x58')]({'where':{'id':_0x1619ef[_0x426d('0x56')]['id']}})['then'](handleEntityNotFound(_0x354cc3,null))['then'](removeEntity(_0x354cc3,null))[_0x426d('0x28')](handleError(_0x354cc3,null));};exports[_0x426d('0x5a')]=function(_0x50ed1e,_0x1d61f9,_0x419eff){var _0x367fd4={};var _0x57879f={};var _0x242ea7;var _0xab4225;return db[_0x426d('0x50')][_0x426d('0x5b')]({'where':{'id':_0x50ed1e[_0x426d('0x56')]['id']}})[_0x426d('0x1f')](handleEntityNotFound(_0x1d61f9,null))[_0x426d('0x1f')](function(_0x30c7f2){if(_0x30c7f2){_0x242ea7=_0x30c7f2;_0x57879f[_0x426d('0x45')]=_[_0x426d('0x5c')](db[_0x426d('0x5d')][_0x426d('0x41')]);_0x57879f[_0x426d('0x46')]=_['keys'](_0x50ed1e[_0x426d('0x46')]);_0x57879f[_0x426d('0x47')]=_['intersection'](_0x57879f[_0x426d('0x45')],_0x57879f[_0x426d('0x46')]);_0x367fd4[_0x426d('0x49')]=_['intersection'](_0x57879f[_0x426d('0x45')],qs[_0x426d('0x4a')](_0x50ed1e[_0x426d('0x46')][_0x426d('0x4a')]));_0x367fd4['attributes']=_0x367fd4[_0x426d('0x49')][_0x426d('0x57')]?_0x367fd4[_0x426d('0x49')]:_0x57879f['model'];_0x367fd4[_0x426d('0x5e')]=qs[_0x426d('0x4c')](_0x50ed1e[_0x426d('0x46')][_0x426d('0x4c')]);_0x367fd4[_0x426d('0x4d')]=qs[_0x426d('0x47')](_[_0x426d('0x5f')](_0x50ed1e['query'],_0x57879f['filters']));if(_0x50ed1e[_0x426d('0x46')][_0x426d('0x4f')]){_0x367fd4[_0x426d('0x4d')]=_[_0x426d('0x3a')](_0x367fd4[_0x426d('0x4d')],{'$or':_[_0x426d('0x40')](_0x367fd4[_0x426d('0x49')],function(_0x9edf8c){var _0x1424cb={};_0x1424cb[_0x9edf8c]={'$like':'%'+_0x50ed1e['query'][_0x426d('0x4f')]+'%'};return _0x1424cb;})});}_0x367fd4=_[_0x426d('0x3a')]({},_0x367fd4,_0x50ed1e[_0x426d('0x60')]);return _0x242ea7[_0x426d('0x5a')](_0x367fd4);}})[_0x426d('0x1f')](function(_0x14fbb5){if(_0x14fbb5){_0xab4225=_0x14fbb5[_0x426d('0x57')];if(!_0x50ed1e[_0x426d('0x46')][_0x426d('0x4b')]('nolimit')){_0x367fd4[_0x426d('0x2e')]=qs['limit'](_0x50ed1e[_0x426d('0x46')]['limit']);_0x367fd4[_0x426d('0x2c')]=qs[_0x426d('0x2c')](_0x50ed1e[_0x426d('0x46')][_0x426d('0x2c')]);}return _0x242ea7[_0x426d('0x5a')](_0x367fd4);}})['then'](function(_0x52822a){if(_0x52822a){return _0x52822a?{'count':_0xab4225,'rows':_0x52822a}:null;}})[_0x426d('0x1f')](respondWithResult(_0x1d61f9,null))[_0x426d('0x28')](handleError(_0x1d61f9,null));};exports[_0x426d('0x61')]=function(_0x2213b8,_0x6cc698,_0x51cb75){var _0x26aee1={};var _0x171d4d={};var _0x78474c;var _0x11d5a8;return db[_0x426d('0x50')]['findOne']({'where':{'id':_0x2213b8[_0x426d('0x56')]['id']}})['then'](handleEntityNotFound(_0x6cc698,null))[_0x426d('0x1f')](function(_0x4a6aef){if(_0x4a6aef){_0x78474c=_0x4a6aef;_0x171d4d[_0x426d('0x45')]=_[_0x426d('0x5c')](db[_0x426d('0x5d')][_0x426d('0x41')]);_0x171d4d[_0x426d('0x46')]=_[_0x426d('0x5c')](_0x2213b8['query']);_0x171d4d[_0x426d('0x47')]=_[_0x426d('0x48')](_0x171d4d[_0x426d('0x45')],_0x171d4d[_0x426d('0x46')]);_0x26aee1[_0x426d('0x49')]=_['intersection'](_0x171d4d['model'],qs['fields'](_0x2213b8[_0x426d('0x46')][_0x426d('0x4a')]));_0x26aee1[_0x426d('0x49')]=_0x26aee1[_0x426d('0x49')]['length']?_0x26aee1[_0x426d('0x49')]:_0x171d4d['model'];_0x26aee1[_0x426d('0x5e')]=qs['sort'](_0x2213b8[_0x426d('0x46')][_0x426d('0x4c')]);_0x26aee1[_0x426d('0x4d')]=qs[_0x426d('0x47')](_[_0x426d('0x5f')](_0x2213b8[_0x426d('0x46')],_0x171d4d['filters']));if(_0x2213b8[_0x426d('0x46')][_0x426d('0x4f')]){_0x26aee1[_0x426d('0x4d')]=_[_0x426d('0x3a')](_0x26aee1[_0x426d('0x4d')],{'$or':_[_0x426d('0x40')](_0x26aee1[_0x426d('0x49')],function(_0x3f8e6d){var _0x353f70={};_0x353f70[_0x3f8e6d]={'$like':'%'+_0x2213b8['query'][_0x426d('0x4f')]+'%'};return _0x353f70;})});}_0x26aee1=_[_0x426d('0x3a')]({},_0x26aee1,_0x2213b8[_0x426d('0x60')]);return _0x78474c[_0x426d('0x61')](_0x26aee1);}})[_0x426d('0x1f')](function(_0x2cf0dd){if(_0x2cf0dd){_0x11d5a8=_0x2cf0dd['length'];if(!_0x2213b8['query']['hasOwnProperty']('nolimit')){_0x26aee1[_0x426d('0x2e')]=qs[_0x426d('0x2e')](_0x2213b8[_0x426d('0x46')]['limit']);_0x26aee1[_0x426d('0x2c')]=qs[_0x426d('0x2c')](_0x2213b8['query'][_0x426d('0x2c')]);}return _0x78474c[_0x426d('0x61')](_0x26aee1);}})[_0x426d('0x1f')](function(_0x1b708e){if(_0x1b708e){return _0x1b708e?{'count':_0x11d5a8,'rows':_0x1b708e}:null;}})[_0x426d('0x1f')](respondWithResult(_0x6cc698,null))[_0x426d('0x28')](handleError(_0x6cc698,null));};exports[_0x426d('0x62')]=function(_0x47a677,_0x5c77ff,_0x1fcac5){var _0x11f39c={};var _0x1c86cc={};var _0x223c3e;var _0xbec503;return db[_0x426d('0x50')][_0x426d('0x5b')]({'where':{'id':_0x47a677[_0x426d('0x56')]['id']}})[_0x426d('0x1f')](handleEntityNotFound(_0x5c77ff,null))[_0x426d('0x1f')](function(_0x4c6e88){if(_0x4c6e88){_0x223c3e=_0x4c6e88;_0x1c86cc[_0x426d('0x45')]=_[_0x426d('0x5c')](db[_0x426d('0x5d')]['rawAttributes']);_0x1c86cc['query']=_[_0x426d('0x5c')](_0x47a677[_0x426d('0x46')]);_0x1c86cc[_0x426d('0x47')]=_[_0x426d('0x48')](_0x1c86cc['model'],_0x1c86cc['query']);_0x11f39c['attributes']=_['intersection'](_0x1c86cc[_0x426d('0x45')],qs[_0x426d('0x4a')](_0x47a677[_0x426d('0x46')][_0x426d('0x4a')]));_0x11f39c[_0x426d('0x49')]=_0x11f39c[_0x426d('0x49')]['length']?_0x11f39c[_0x426d('0x49')]:_0x1c86cc['model'];_0x11f39c[_0x426d('0x5e')]=qs[_0x426d('0x4c')](_0x47a677[_0x426d('0x46')][_0x426d('0x4c')]);_0x11f39c[_0x426d('0x4d')]=qs['filters'](_[_0x426d('0x5f')](_0x47a677[_0x426d('0x46')],_0x1c86cc[_0x426d('0x47')]));if(_0x47a677[_0x426d('0x46')]['filter']){_0x11f39c[_0x426d('0x4d')]=_[_0x426d('0x3a')](_0x11f39c[_0x426d('0x4d')],{'$or':_[_0x426d('0x40')](_0x11f39c[_0x426d('0x49')],function(_0x1f4d3d){var _0x418175={};_0x418175[_0x1f4d3d]={'$like':'%'+_0x47a677[_0x426d('0x46')][_0x426d('0x4f')]+'%'};return _0x418175;})});}_0x11f39c=_[_0x426d('0x3a')]({},_0x11f39c,_0x47a677[_0x426d('0x60')]);return _0x223c3e[_0x426d('0x62')](_0x11f39c);}})['then'](function(_0x5b5562){if(_0x5b5562){_0xbec503=_0x5b5562[_0x426d('0x57')];if(!_0x47a677['query'][_0x426d('0x4b')]('nolimit')){_0x11f39c[_0x426d('0x2e')]=qs[_0x426d('0x2e')](_0x47a677[_0x426d('0x46')]['limit']);_0x11f39c[_0x426d('0x2c')]=qs['offset'](_0x47a677[_0x426d('0x46')][_0x426d('0x2c')]);}return _0x223c3e[_0x426d('0x62')](_0x11f39c);}})[_0x426d('0x1f')](function(_0xfd204c){if(_0xfd204c){return _0xfd204c?{'count':_0xbec503,'rows':_0xfd204c}:null;}})[_0x426d('0x1f')](respondWithResult(_0x5c77ff,null))[_0x426d('0x28')](handleError(_0x5c77ff,null));};exports[_0x426d('0x63')]=function(_0x6378d2,_0x596927,_0x2d4b96){var _0x4c4c70={};var _0x25f843={};var _0x10d909;var _0x563f56;return db['FreshdeskConfiguration'][_0x426d('0x5b')]({'where':{'id':_0x6378d2[_0x426d('0x56')]['id']}})[_0x426d('0x1f')](handleEntityNotFound(_0x596927,null))[_0x426d('0x1f')](function(_0x5bb3ab){if(_0x5bb3ab){_0x10d909=_0x5bb3ab;_0x25f843[_0x426d('0x45')]=_[_0x426d('0x5c')](db['Tag'][_0x426d('0x41')]);_0x25f843[_0x426d('0x46')]=_['keys'](_0x6378d2[_0x426d('0x46')]);_0x25f843['filters']=_[_0x426d('0x48')](_0x25f843[_0x426d('0x45')],_0x25f843[_0x426d('0x46')]);_0x4c4c70[_0x426d('0x49')]=_[_0x426d('0x48')](_0x25f843[_0x426d('0x45')],qs[_0x426d('0x4a')](_0x6378d2[_0x426d('0x46')][_0x426d('0x4a')]));_0x4c4c70[_0x426d('0x49')]=_0x4c4c70['attributes']['length']?_0x4c4c70[_0x426d('0x49')]:_0x25f843[_0x426d('0x45')];_0x4c4c70[_0x426d('0x5e')]=qs['sort'](_0x6378d2[_0x426d('0x46')]['sort']);_0x4c4c70[_0x426d('0x4d')]=qs[_0x426d('0x47')](_[_0x426d('0x5f')](_0x6378d2[_0x426d('0x46')],_0x25f843[_0x426d('0x47')]));if(_0x6378d2[_0x426d('0x46')]['filter']){_0x4c4c70['where']=_['merge'](_0x4c4c70['where'],{'$or':_[_0x426d('0x40')](_0x4c4c70[_0x426d('0x49')],function(_0x198a99){var _0x2b3b00={};_0x2b3b00[_0x198a99]={'$like':'%'+_0x6378d2[_0x426d('0x46')][_0x426d('0x4f')]+'%'};return _0x2b3b00;})});}_0x4c4c70=_[_0x426d('0x3a')]({},_0x4c4c70,_0x6378d2[_0x426d('0x60')]);return _0x10d909[_0x426d('0x63')](_0x4c4c70);}})[_0x426d('0x1f')](function(_0x1994f0){if(_0x1994f0){_0x563f56=_0x1994f0['length'];if(!_0x6378d2['query'][_0x426d('0x4b')]('nolimit')){_0x4c4c70[_0x426d('0x2e')]=qs[_0x426d('0x2e')](_0x6378d2['query'][_0x426d('0x2e')]);_0x4c4c70[_0x426d('0x2c')]=qs[_0x426d('0x2c')](_0x6378d2['query'][_0x426d('0x2c')]);}return _0x10d909[_0x426d('0x63')](_0x4c4c70);}})[_0x426d('0x1f')](function(_0x44ee46){if(_0x44ee46){return _0x44ee46?{'count':_0x563f56,'rows':_0x44ee46}:null;}})[_0x426d('0x1f')](respondWithResult(_0x596927,null))['catch'](handleError(_0x596927,null));};exports['setTags']=function(_0x44c764,_0x311e2c,_0x36cb9c){if(_0x44c764[_0x426d('0x3b')]['id']){delete _0x44c764[_0x426d('0x3b')]['id'];}return db[_0x426d('0x50')][_0x426d('0x5b')]({'where':{'id':_0x44c764['params']['id']}})['then'](handleEntityNotFound(_0x311e2c,null))[_0x426d('0x1f')](function(_0x442b44){if(_0x442b44){return _0x442b44[_0x426d('0x64')](_0x44c764[_0x426d('0x3b')][_0x426d('0x65')]||[]);}return null;})[_0x426d('0x1f')](respondWithResult(_0x311e2c,null))[_0x426d('0x28')](handleError(_0x311e2c,null));}; \ No newline at end of file +var _0xd591=['options','getFields','getSubjects','FreshdeskField','findOne','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','set','json','apply','save','update','destroy','stack','name','render','body','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','FreshdeskConfiguration','include','findAll','rows','show','params','keys','includeAll','find','create','order'];(function(_0x1f8bfa,_0x5e2757){var _0x33d0aa=function(_0x32d871){while(--_0x32d871){_0x1f8bfa['push'](_0x1f8bfa['shift']());}};_0x33d0aa(++_0x5e2757);}(_0xd591,0xd1));var _0x1d59=function(_0x54df83,_0x18c243){_0x54df83=_0x54df83-0x0;var _0x56ad3b=_0xd591[_0x54df83];return _0x56ad3b;};'use strict';var emlformat=require(_0x1d59('0x0'));var rimraf=require(_0x1d59('0x1'));var zipdir=require(_0x1d59('0x2'));var jsonpatch=require(_0x1d59('0x3'));var rp=require(_0x1d59('0x4'));var moment=require('moment');var BPromise=require(_0x1d59('0x5'));var Mustache=require('mustache');var util=require(_0x1d59('0x6'));var path=require(_0x1d59('0x7'));var sox=require('sox');var csv=require(_0x1d59('0x8'));var ejs=require(_0x1d59('0x9'));var fs=require('fs');var fs_extra=require(_0x1d59('0xa'));var _=require(_0x1d59('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1d59('0xc'));var deskjs=require(_0x1d59('0xd'));var toCsv=require(_0x1d59('0x8'));var querystring=require(_0x1d59('0xe'));var Papa=require(_0x1d59('0xf'));var Redis=require(_0x1d59('0x10'));var authService=require(_0x1d59('0x11'));var qs=require(_0x1d59('0x12'));var as=require(_0x1d59('0x13'));var hardwareService=require(_0x1d59('0x14'));var logger=require('../../config/logger')(_0x1d59('0x15'));var utils=require(_0x1d59('0x16'));var config=require(_0x1d59('0x17'));var licenseUtil=require(_0x1d59('0x18'));var db=require(_0x1d59('0x19'))['db'];var jayson=require(_0x1d59('0x1a'));var client=jayson[_0x1d59('0x1b')][_0x1d59('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5093aa,_0x47655b,_0x33fa9d,_0x4928b1){return new BPromise(function(_0x3d9d89,_0x29d574){var _0x160cb7=_0x4928b1||client;return _0x160cb7['request'](_0x5093aa,_0x33fa9d)[_0x1d59('0x1d')](function(_0x274628){logger[_0x1d59('0x1e')](_0x1d59('0x1f'),_0x47655b,_0x1d59('0x20'));logger[_0x1d59('0x21')](_0x1d59('0x22'),_0x47655b,_0x1d59('0x20'),JSON[_0x1d59('0x23')](_0x274628));if(_0x274628[_0x1d59('0x24')]){if(_0x274628[_0x1d59('0x24')][_0x1d59('0x25')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x47655b,_0x274628['error'][_0x1d59('0x26')]);return _0x29d574(_0x274628[_0x1d59('0x24')][_0x1d59('0x26')]);}logger[_0x1d59('0x24')](_0x1d59('0x1f'),_0x47655b,_0x274628[_0x1d59('0x24')][_0x1d59('0x26')]);return _0x3d9d89(_0x274628[_0x1d59('0x24')]['message']);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x47655b,_0x1d59('0x20'));_0x3d9d89(_0x274628['result'][_0x1d59('0x26')]);}})[_0x1d59('0x27')](function(_0x22ec94){logger[_0x1d59('0x24')](_0x1d59('0x1f'),_0x47655b,_0x22ec94);_0x29d574(_0x22ec94);});});}function respondWithStatusCode(_0x529d2a,_0x369916){_0x369916=_0x369916||0xcc;return function(_0x5a4905){if(_0x5a4905){return _0x529d2a[_0x1d59('0x28')](_0x369916);}return _0x529d2a[_0x1d59('0x29')](_0x369916)[_0x1d59('0x2a')]();};}function respondWithResult(_0x3db51e,_0xdd8efd){_0xdd8efd=_0xdd8efd||0xc8;return function(_0x5ca755){if(_0x5ca755){return _0x3db51e[_0x1d59('0x29')](_0xdd8efd)['json'](_0x5ca755);}};}function respondWithFilteredResult(_0x2e3bc0,_0x39098b){return function(_0x4484a1){if(_0x4484a1){var _0x46e647=typeof _0x39098b[_0x1d59('0x2b')]===_0x1d59('0x2c')&&typeof _0x39098b[_0x1d59('0x2d')]===_0x1d59('0x2c');var _0x4f3cd4=_0x4484a1['count'];var _0x3083ca=_0x46e647?0x0:_0x39098b[_0x1d59('0x2b')];var _0x5a3f4b=_0x46e647?_0x4484a1['count']:_0x39098b[_0x1d59('0x2b')]+_0x39098b[_0x1d59('0x2d')];var _0x2cd5da;if(_0x5a3f4b>=_0x4f3cd4){_0x5a3f4b=_0x4f3cd4;_0x2cd5da=0xc8;}else{_0x2cd5da=0xce;}_0x2e3bc0['status'](_0x2cd5da);return _0x2e3bc0[_0x1d59('0x2e')]('Content-Range',_0x3083ca+'-'+_0x5a3f4b+'/'+_0x4f3cd4)[_0x1d59('0x2f')](_0x4484a1);}return null;};}function patchUpdates(_0x15c52b){return function(_0x4283ae){try{jsonpatch[_0x1d59('0x30')](_0x4283ae,_0x15c52b,!![]);}catch(_0x3f62b1){return BPromise['reject'](_0x3f62b1);}return _0x4283ae[_0x1d59('0x31')]();};}function saveUpdates(_0x279afb,_0x3a39b1){return function(_0xb84328){if(_0xb84328){return _0xb84328[_0x1d59('0x32')](_0x279afb)[_0x1d59('0x1d')](function(_0x43a870){return _0x43a870;});}return null;};}function removeEntity(_0x7cb3f6,_0x3610fa){return function(_0x5c5f6b){if(_0x5c5f6b){return _0x5c5f6b[_0x1d59('0x33')]()[_0x1d59('0x1d')](function(){_0x7cb3f6[_0x1d59('0x29')](0xcc)[_0x1d59('0x2a')]();});}};}function handleEntityNotFound(_0x5931c3,_0x390222){return function(_0x3262b9){if(!_0x3262b9){_0x5931c3[_0x1d59('0x28')](0x194);}return _0x3262b9;};}function handleError(_0x28af71,_0x27c7c3){_0x27c7c3=_0x27c7c3||0x1f4;return function(_0x4e5f81){logger[_0x1d59('0x24')](_0x4e5f81[_0x1d59('0x34')]);if(_0x4e5f81[_0x1d59('0x35')]){delete _0x4e5f81[_0x1d59('0x35')];}_0x28af71['status'](_0x27c7c3)['send'](_0x4e5f81);};}function getMustacheRender(_0x39a129,_0x5903bc){return Mustache[_0x1d59('0x36')](_0x39a129,_['merge'](_0x5903bc[_0x1d59('0x37')],{'contact':_0x5903bc[_0x1d59('0x38')],'message':_0x5903bc['message'],'agent':_0x5903bc[_0x1d59('0x39')],'interaction':_0x5903bc[_0x1d59('0x3a')],'account':_0x5903bc[_0x1d59('0x3b')]}))||'';}exports[_0x1d59('0x3c')]=function(_0x48851c,_0x2c8f0b){var _0x33b32f={},_0x4e6db4={},_0x977a27={'count':0x0,'rows':[]};var _0x240479=_[_0x1d59('0x3d')](db['FreshdeskConfiguration'][_0x1d59('0x3e')],function(_0x2e5ca1){return{'name':_0x2e5ca1[_0x1d59('0x3f')],'type':_0x2e5ca1[_0x1d59('0x40')]['key']};});_0x4e6db4['model']=_[_0x1d59('0x3d')](_0x240479,_0x1d59('0x35'));_0x4e6db4[_0x1d59('0x41')]=_['keys'](_0x48851c['query']);_0x4e6db4['filters']=_[_0x1d59('0x42')](_0x4e6db4[_0x1d59('0x43')],_0x4e6db4['query']);_0x33b32f['attributes']=_[_0x1d59('0x42')](_0x4e6db4['model'],qs[_0x1d59('0x44')](_0x48851c[_0x1d59('0x41')][_0x1d59('0x44')]));_0x33b32f[_0x1d59('0x45')]=_0x33b32f[_0x1d59('0x45')][_0x1d59('0x46')]?_0x33b32f[_0x1d59('0x45')]:_0x4e6db4[_0x1d59('0x43')];if(!_0x48851c[_0x1d59('0x41')][_0x1d59('0x47')](_0x1d59('0x48'))){_0x33b32f[_0x1d59('0x2d')]=qs['limit'](_0x48851c[_0x1d59('0x41')][_0x1d59('0x2d')]);_0x33b32f[_0x1d59('0x2b')]=qs[_0x1d59('0x2b')](_0x48851c[_0x1d59('0x41')][_0x1d59('0x2b')]);}_0x33b32f['order']=qs[_0x1d59('0x49')](_0x48851c[_0x1d59('0x41')][_0x1d59('0x49')]);_0x33b32f[_0x1d59('0x4a')]=qs[_0x1d59('0x4b')](_[_0x1d59('0x4c')](_0x48851c[_0x1d59('0x41')],_0x4e6db4[_0x1d59('0x4b')]),_0x240479);if(_0x48851c[_0x1d59('0x41')]['filter']){_0x33b32f[_0x1d59('0x4a')]=_['merge'](_0x33b32f['where'],{'$or':_['map'](_0x240479,function(_0x3755b5){if(_0x3755b5[_0x1d59('0x40')]!==_0x1d59('0x4d')){var _0xfb0168={};_0xfb0168[_0x3755b5[_0x1d59('0x35')]]={'$like':'%'+_0x48851c[_0x1d59('0x41')][_0x1d59('0x4e')]+'%'};return _0xfb0168;}})});}_0x33b32f=_[_0x1d59('0x4f')]({},_0x33b32f,_0x48851c['options']);var _0x3a3d55={'where':_0x33b32f[_0x1d59('0x4a')]};return db[_0x1d59('0x50')]['count'](_0x3a3d55)['then'](function(_0x4855e5){_0x977a27['count']=_0x4855e5;if(_0x48851c[_0x1d59('0x41')]['includeAll']){_0x33b32f[_0x1d59('0x51')]=[{'all':!![]}];}return db[_0x1d59('0x50')][_0x1d59('0x52')](_0x33b32f);})[_0x1d59('0x1d')](function(_0x4ee2c0){_0x977a27[_0x1d59('0x53')]=_0x4ee2c0;return _0x977a27;})[_0x1d59('0x1d')](respondWithFilteredResult(_0x2c8f0b,_0x33b32f))[_0x1d59('0x27')](handleError(_0x2c8f0b,null));};exports[_0x1d59('0x54')]=function(_0x3af766,_0x4df0f0){var _0x582ef3={'raw':![],'where':{'id':_0x3af766[_0x1d59('0x55')]['id']}},_0xdde678={};_0xdde678[_0x1d59('0x43')]=_[_0x1d59('0x56')](db[_0x1d59('0x50')][_0x1d59('0x3e')]);_0xdde678[_0x1d59('0x41')]=_[_0x1d59('0x56')](_0x3af766[_0x1d59('0x41')]);_0xdde678[_0x1d59('0x4b')]=_[_0x1d59('0x42')](_0xdde678[_0x1d59('0x43')],_0xdde678['query']);_0x582ef3['attributes']=_['intersection'](_0xdde678['model'],qs[_0x1d59('0x44')](_0x3af766['query']['fields']));_0x582ef3['attributes']=_0x582ef3[_0x1d59('0x45')][_0x1d59('0x46')]?_0x582ef3[_0x1d59('0x45')]:_0xdde678[_0x1d59('0x43')];if(_0x3af766[_0x1d59('0x41')][_0x1d59('0x57')]){_0x582ef3['include']=[{'all':!![]}];}_0x582ef3=_[_0x1d59('0x4f')]({},_0x582ef3,_0x3af766['options']);return db[_0x1d59('0x50')][_0x1d59('0x58')](_0x582ef3)[_0x1d59('0x1d')](handleEntityNotFound(_0x4df0f0,null))['then'](respondWithResult(_0x4df0f0,null))[_0x1d59('0x27')](handleError(_0x4df0f0,null));};exports[_0x1d59('0x59')]=function(_0xf069fd,_0x12cbf5){return db['FreshdeskConfiguration']['create'](_0xf069fd[_0x1d59('0x37')],{})[_0x1d59('0x1d')](respondWithResult(_0x12cbf5,0xc9))[_0x1d59('0x27')](handleError(_0x12cbf5,null));};exports['update']=function(_0x2e59ec,_0x5c9859){if(_0x2e59ec[_0x1d59('0x37')]['id']){delete _0x2e59ec[_0x1d59('0x37')]['id'];}return db['FreshdeskConfiguration'][_0x1d59('0x58')]({'where':{'id':_0x2e59ec[_0x1d59('0x55')]['id']}})['then'](handleEntityNotFound(_0x5c9859,null))['then'](saveUpdates(_0x2e59ec[_0x1d59('0x37')],null))[_0x1d59('0x1d')](respondWithResult(_0x5c9859,null))[_0x1d59('0x27')](handleError(_0x5c9859,null));};exports[_0x1d59('0x33')]=function(_0x41ea6a,_0x2c5c97){return db[_0x1d59('0x50')][_0x1d59('0x58')]({'where':{'id':_0x41ea6a[_0x1d59('0x55')]['id']}})[_0x1d59('0x1d')](handleEntityNotFound(_0x2c5c97,null))[_0x1d59('0x1d')](removeEntity(_0x2c5c97,null))[_0x1d59('0x27')](handleError(_0x2c5c97,null));};exports['getFields']=function(_0xb476ae,_0x134164,_0x20e38a){var _0x3d1ed2={};var _0x5d7a87={};var _0x11794c;var _0x58f4e2;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0xb476ae['params']['id']}})[_0x1d59('0x1d')](handleEntityNotFound(_0x134164,null))[_0x1d59('0x1d')](function(_0x173b7e){if(_0x173b7e){_0x11794c=_0x173b7e;_0x5d7a87[_0x1d59('0x43')]=_[_0x1d59('0x56')](db['FreshdeskField'][_0x1d59('0x3e')]);_0x5d7a87[_0x1d59('0x41')]=_[_0x1d59('0x56')](_0xb476ae[_0x1d59('0x41')]);_0x5d7a87['filters']=_['intersection'](_0x5d7a87[_0x1d59('0x43')],_0x5d7a87['query']);_0x3d1ed2['attributes']=_[_0x1d59('0x42')](_0x5d7a87[_0x1d59('0x43')],qs[_0x1d59('0x44')](_0xb476ae[_0x1d59('0x41')][_0x1d59('0x44')]));_0x3d1ed2[_0x1d59('0x45')]=_0x3d1ed2['attributes']['length']?_0x3d1ed2['attributes']:_0x5d7a87[_0x1d59('0x43')];_0x3d1ed2[_0x1d59('0x5a')]=qs[_0x1d59('0x49')](_0xb476ae[_0x1d59('0x41')][_0x1d59('0x49')]);_0x3d1ed2[_0x1d59('0x4a')]=qs[_0x1d59('0x4b')](_[_0x1d59('0x4c')](_0xb476ae['query'],_0x5d7a87[_0x1d59('0x4b')]));if(_0xb476ae[_0x1d59('0x41')][_0x1d59('0x4e')]){_0x3d1ed2[_0x1d59('0x4a')]=_[_0x1d59('0x4f')](_0x3d1ed2['where'],{'$or':_['map'](_0x3d1ed2[_0x1d59('0x45')],function(_0x51aa3f){var _0x5e9cce={};_0x5e9cce[_0x51aa3f]={'$like':'%'+_0xb476ae[_0x1d59('0x41')]['filter']+'%'};return _0x5e9cce;})});}_0x3d1ed2=_[_0x1d59('0x4f')]({},_0x3d1ed2,_0xb476ae[_0x1d59('0x5b')]);return _0x11794c[_0x1d59('0x5c')](_0x3d1ed2);}})['then'](function(_0x113148){if(_0x113148){_0x58f4e2=_0x113148[_0x1d59('0x46')];if(!_0xb476ae[_0x1d59('0x41')][_0x1d59('0x47')]('nolimit')){_0x3d1ed2[_0x1d59('0x2d')]=qs[_0x1d59('0x2d')](_0xb476ae['query'][_0x1d59('0x2d')]);_0x3d1ed2[_0x1d59('0x2b')]=qs[_0x1d59('0x2b')](_0xb476ae[_0x1d59('0x41')]['offset']);}return _0x11794c[_0x1d59('0x5c')](_0x3d1ed2);}})[_0x1d59('0x1d')](function(_0x251f27){if(_0x251f27){return _0x251f27?{'count':_0x58f4e2,'rows':_0x251f27}:null;}})[_0x1d59('0x1d')](respondWithResult(_0x134164,null))[_0x1d59('0x27')](handleError(_0x134164,null));};exports[_0x1d59('0x5d')]=function(_0x291dae,_0x3fe479,_0x12be4d){var _0x8505e0={};var _0x1c43a7={};var _0x59f61a;var _0x2755c5;return db[_0x1d59('0x50')]['findOne']({'where':{'id':_0x291dae['params']['id']}})[_0x1d59('0x1d')](handleEntityNotFound(_0x3fe479,null))[_0x1d59('0x1d')](function(_0x3d1d58){if(_0x3d1d58){_0x59f61a=_0x3d1d58;_0x1c43a7[_0x1d59('0x43')]=_['keys'](db[_0x1d59('0x5e')][_0x1d59('0x3e')]);_0x1c43a7[_0x1d59('0x41')]=_[_0x1d59('0x56')](_0x291dae['query']);_0x1c43a7[_0x1d59('0x4b')]=_[_0x1d59('0x42')](_0x1c43a7[_0x1d59('0x43')],_0x1c43a7[_0x1d59('0x41')]);_0x8505e0[_0x1d59('0x45')]=_[_0x1d59('0x42')](_0x1c43a7[_0x1d59('0x43')],qs[_0x1d59('0x44')](_0x291dae[_0x1d59('0x41')][_0x1d59('0x44')]));_0x8505e0['attributes']=_0x8505e0['attributes'][_0x1d59('0x46')]?_0x8505e0[_0x1d59('0x45')]:_0x1c43a7[_0x1d59('0x43')];_0x8505e0[_0x1d59('0x5a')]=qs[_0x1d59('0x49')](_0x291dae[_0x1d59('0x41')][_0x1d59('0x49')]);_0x8505e0[_0x1d59('0x4a')]=qs['filters'](_[_0x1d59('0x4c')](_0x291dae[_0x1d59('0x41')],_0x1c43a7[_0x1d59('0x4b')]));if(_0x291dae[_0x1d59('0x41')]['filter']){_0x8505e0[_0x1d59('0x4a')]=_[_0x1d59('0x4f')](_0x8505e0['where'],{'$or':_[_0x1d59('0x3d')](_0x8505e0[_0x1d59('0x45')],function(_0x2a2336){var _0x2cf95d={};_0x2cf95d[_0x2a2336]={'$like':'%'+_0x291dae[_0x1d59('0x41')][_0x1d59('0x4e')]+'%'};return _0x2cf95d;})});}_0x8505e0=_['merge']({},_0x8505e0,_0x291dae[_0x1d59('0x5b')]);return _0x59f61a[_0x1d59('0x5d')](_0x8505e0);}})[_0x1d59('0x1d')](function(_0x2834c4){if(_0x2834c4){_0x2755c5=_0x2834c4[_0x1d59('0x46')];if(!_0x291dae[_0x1d59('0x41')][_0x1d59('0x47')](_0x1d59('0x48'))){_0x8505e0['limit']=qs[_0x1d59('0x2d')](_0x291dae[_0x1d59('0x41')][_0x1d59('0x2d')]);_0x8505e0[_0x1d59('0x2b')]=qs['offset'](_0x291dae['query']['offset']);}return _0x59f61a[_0x1d59('0x5d')](_0x8505e0);}})[_0x1d59('0x1d')](function(_0x339187){if(_0x339187){return _0x339187?{'count':_0x2755c5,'rows':_0x339187}:null;}})[_0x1d59('0x1d')](respondWithResult(_0x3fe479,null))[_0x1d59('0x27')](handleError(_0x3fe479,null));};exports['getDescriptions']=function(_0x328c68,_0x4dc6b5,_0x27fed7){var _0x57e257={};var _0x401e43={};var _0x1c3d31;var _0x2b21e5;return db['FreshdeskConfiguration'][_0x1d59('0x5f')]({'where':{'id':_0x328c68['params']['id']}})[_0x1d59('0x1d')](handleEntityNotFound(_0x4dc6b5,null))[_0x1d59('0x1d')](function(_0xcfb4b9){if(_0xcfb4b9){_0x1c3d31=_0xcfb4b9;_0x401e43[_0x1d59('0x43')]=_[_0x1d59('0x56')](db[_0x1d59('0x5e')][_0x1d59('0x3e')]);_0x401e43[_0x1d59('0x41')]=_[_0x1d59('0x56')](_0x328c68[_0x1d59('0x41')]);_0x401e43[_0x1d59('0x4b')]=_['intersection'](_0x401e43[_0x1d59('0x43')],_0x401e43['query']);_0x57e257['attributes']=_[_0x1d59('0x42')](_0x401e43[_0x1d59('0x43')],qs[_0x1d59('0x44')](_0x328c68['query']['fields']));_0x57e257[_0x1d59('0x45')]=_0x57e257[_0x1d59('0x45')][_0x1d59('0x46')]?_0x57e257[_0x1d59('0x45')]:_0x401e43[_0x1d59('0x43')];_0x57e257[_0x1d59('0x5a')]=qs['sort'](_0x328c68['query'][_0x1d59('0x49')]);_0x57e257[_0x1d59('0x4a')]=qs[_0x1d59('0x4b')](_['pick'](_0x328c68[_0x1d59('0x41')],_0x401e43[_0x1d59('0x4b')]));if(_0x328c68['query'][_0x1d59('0x4e')]){_0x57e257[_0x1d59('0x4a')]=_[_0x1d59('0x4f')](_0x57e257[_0x1d59('0x4a')],{'$or':_['map'](_0x57e257[_0x1d59('0x45')],function(_0x56f50a){var _0x1d1bbe={};_0x1d1bbe[_0x56f50a]={'$like':'%'+_0x328c68[_0x1d59('0x41')][_0x1d59('0x4e')]+'%'};return _0x1d1bbe;})});}_0x57e257=_[_0x1d59('0x4f')]({},_0x57e257,_0x328c68[_0x1d59('0x5b')]);return _0x1c3d31[_0x1d59('0x60')](_0x57e257);}})[_0x1d59('0x1d')](function(_0x29a56d){if(_0x29a56d){_0x2b21e5=_0x29a56d[_0x1d59('0x46')];if(!_0x328c68[_0x1d59('0x41')][_0x1d59('0x47')](_0x1d59('0x48'))){_0x57e257[_0x1d59('0x2d')]=qs[_0x1d59('0x2d')](_0x328c68[_0x1d59('0x41')]['limit']);_0x57e257[_0x1d59('0x2b')]=qs['offset'](_0x328c68[_0x1d59('0x41')][_0x1d59('0x2b')]);}return _0x1c3d31[_0x1d59('0x60')](_0x57e257);}})['then'](function(_0x28e367){if(_0x28e367){return _0x28e367?{'count':_0x2b21e5,'rows':_0x28e367}:null;}})[_0x1d59('0x1d')](respondWithResult(_0x4dc6b5,null))[_0x1d59('0x27')](handleError(_0x4dc6b5,null));};exports[_0x1d59('0x61')]=function(_0x14472c,_0x29607d,_0x3e1501){var _0x5c1dd2={};var _0x44804f={};var _0xcb74d9;var _0x29c06b;return db[_0x1d59('0x50')][_0x1d59('0x5f')]({'where':{'id':_0x14472c[_0x1d59('0x55')]['id']}})[_0x1d59('0x1d')](handleEntityNotFound(_0x29607d,null))[_0x1d59('0x1d')](function(_0x1f1c25){if(_0x1f1c25){_0xcb74d9=_0x1f1c25;_0x44804f[_0x1d59('0x43')]=_[_0x1d59('0x56')](db['Tag']['rawAttributes']);_0x44804f[_0x1d59('0x41')]=_['keys'](_0x14472c[_0x1d59('0x41')]);_0x44804f[_0x1d59('0x4b')]=_[_0x1d59('0x42')](_0x44804f[_0x1d59('0x43')],_0x44804f[_0x1d59('0x41')]);_0x5c1dd2[_0x1d59('0x45')]=_[_0x1d59('0x42')](_0x44804f['model'],qs[_0x1d59('0x44')](_0x14472c[_0x1d59('0x41')][_0x1d59('0x44')]));_0x5c1dd2[_0x1d59('0x45')]=_0x5c1dd2[_0x1d59('0x45')][_0x1d59('0x46')]?_0x5c1dd2[_0x1d59('0x45')]:_0x44804f[_0x1d59('0x43')];_0x5c1dd2['order']=qs[_0x1d59('0x49')](_0x14472c[_0x1d59('0x41')][_0x1d59('0x49')]);_0x5c1dd2[_0x1d59('0x4a')]=qs[_0x1d59('0x4b')](_[_0x1d59('0x4c')](_0x14472c[_0x1d59('0x41')],_0x44804f[_0x1d59('0x4b')]));if(_0x14472c[_0x1d59('0x41')][_0x1d59('0x4e')]){_0x5c1dd2[_0x1d59('0x4a')]=_[_0x1d59('0x4f')](_0x5c1dd2['where'],{'$or':_[_0x1d59('0x3d')](_0x5c1dd2[_0x1d59('0x45')],function(_0x559f3e){var _0x3d9482={};_0x3d9482[_0x559f3e]={'$like':'%'+_0x14472c[_0x1d59('0x41')][_0x1d59('0x4e')]+'%'};return _0x3d9482;})});}_0x5c1dd2=_['merge']({},_0x5c1dd2,_0x14472c['options']);return _0xcb74d9[_0x1d59('0x61')](_0x5c1dd2);}})[_0x1d59('0x1d')](function(_0x1ee52d){if(_0x1ee52d){_0x29c06b=_0x1ee52d[_0x1d59('0x46')];if(!_0x14472c['query'][_0x1d59('0x47')](_0x1d59('0x48'))){_0x5c1dd2[_0x1d59('0x2d')]=qs[_0x1d59('0x2d')](_0x14472c[_0x1d59('0x41')][_0x1d59('0x2d')]);_0x5c1dd2['offset']=qs[_0x1d59('0x2b')](_0x14472c[_0x1d59('0x41')][_0x1d59('0x2b')]);}return _0xcb74d9[_0x1d59('0x61')](_0x5c1dd2);}})[_0x1d59('0x1d')](function(_0x1fadc7){if(_0x1fadc7){return _0x1fadc7?{'count':_0x29c06b,'rows':_0x1fadc7}:null;}})[_0x1d59('0x1d')](respondWithResult(_0x29607d,null))[_0x1d59('0x27')](handleError(_0x29607d,null));};exports[_0x1d59('0x62')]=function(_0x2832ef,_0x148ab0,_0x3fba93){if(_0x2832ef[_0x1d59('0x37')]['id']){delete _0x2832ef['body']['id'];}return db[_0x1d59('0x50')]['findOne']({'where':{'id':_0x2832ef[_0x1d59('0x55')]['id']}})[_0x1d59('0x1d')](handleEntityNotFound(_0x148ab0,null))[_0x1d59('0x1d')](function(_0x3b9a56){if(_0x3b9a56){return _0x3b9a56[_0x1d59('0x62')](_0x2832ef[_0x1d59('0x37')][_0x1d59('0x63')]||[]);}return null;})[_0x1d59('0x1d')](respondWithResult(_0x148ab0,null))[_0x1d59('0x27')](handleError(_0x148ab0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 1142844..c190067 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 _0xa038=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x39194a,_0x10366c){var _0x21af77=function(_0x6e421b){while(--_0x6e421b){_0x39194a['push'](_0x39194a['shift']());}};_0x21af77(++_0x10366c);}(_0xa038,0x107));var _0x8a03=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xa038[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x8a03('0x0'));var util=require(_0x8a03('0x1'));var logger=require('../../config/logger')(_0x8a03('0x2'));var moment=require(_0x8a03('0x3'));var BPromise=require(_0x8a03('0x4'));var rp=require(_0x8a03('0x5'));var fs=require('fs');var path=require(_0x8a03('0x6'));var rimraf=require('rimraf');var config=require(_0x8a03('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x8a03('0x8')]=function(_0x58f347,_0x5940cb){return _0x58f347[_0x8a03('0x9')](_0x8a03('0xa'),attributes,{'tableName':_0x8a03('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb647=['int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xb647,0x119));var _0x7b64=function(_0xdf7918,_0x2ed746){_0xdf7918=_0xdf7918-0x0;var _0x485651=_0xb647[_0xdf7918];return _0x485651;};'use strict';var _=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var logger=require(_0x7b64('0x2'))(_0x7b64('0x3'));var moment=require(_0x7b64('0x4'));var BPromise=require(_0x7b64('0x5'));var rp=require(_0x7b64('0x6'));var fs=require('fs');var path=require(_0x7b64('0x7'));var rimraf=require(_0x7b64('0x8'));var config=require(_0x7b64('0x9'));var attributes=require(_0x7b64('0xa'));module['exports']=function(_0x42b12a,_0x2e2633){return _0x42b12a[_0x7b64('0xb')](_0x7b64('0xc'),attributes,{'tableName':_0x7b64('0xd'),'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 69064ff..005a944 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 _0xe185=['FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x28e05c,_0x2dfe3a){var _0x3fa72f=function(_0x5c90df){while(--_0x5c90df){_0x28e05c['push'](_0x28e05c['shift']());}};_0x3fa72f(++_0x2dfe3a);}(_0xe185,0x11d));var _0x5e18=function(_0x882cf2,_0x434f39){_0x882cf2=_0x882cf2-0x0;var _0x265b3a=_0xe185[_0x882cf2];return _0x265b3a;};'use strict';var _=require(_0x5e18('0x0'));var util=require('util');var moment=require(_0x5e18('0x1'));var BPromise=require(_0x5e18('0x2'));var rs=require(_0x5e18('0x3'));var fs=require('fs');var Redis=require(_0x5e18('0x4'));var db=require(_0x5e18('0x5'))['db'];var utils=require(_0x5e18('0x6'));var logger=require(_0x5e18('0x7'))(_0x5e18('0x8'));var config=require(_0x5e18('0x9'));var jayson=require(_0x5e18('0xa'));var client=jayson[_0x5e18('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ed420,_0x30d687,_0x101017){return new BPromise(function(_0x16ef25,_0x2f5cda){return client[_0x5e18('0xc')](_0x3ed420,_0x101017)['then'](function(_0x10f4dd){logger[_0x5e18('0xd')](_0x5e18('0xe'),_0x30d687,_0x5e18('0xf'));logger[_0x5e18('0x10')](_0x5e18('0x11'),_0x30d687,_0x5e18('0xf'),JSON[_0x5e18('0x12')](_0x10f4dd));if(_0x10f4dd[_0x5e18('0x13')]){if(_0x10f4dd[_0x5e18('0x13')][_0x5e18('0x14')]===0x1f4){logger['error'](_0x5e18('0xe'),_0x30d687,_0x10f4dd[_0x5e18('0x13')][_0x5e18('0x15')]);return _0x2f5cda(_0x10f4dd[_0x5e18('0x13')]['message']);}logger[_0x5e18('0x13')](_0x5e18('0xe'),_0x30d687,_0x10f4dd[_0x5e18('0x13')]['message']);return _0x16ef25(_0x10f4dd[_0x5e18('0x13')][_0x5e18('0x15')]);}else{logger[_0x5e18('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x30d687,'request\x20sent');_0x16ef25(_0x10f4dd[_0x5e18('0x16')][_0x5e18('0x15')]);}})['catch'](function(_0xc2e4d2){logger[_0x5e18('0x13')](_0x5e18('0xe'),_0x30d687,_0xc2e4d2);_0x2f5cda(_0xc2e4d2);});});} \ No newline at end of file +var _0xdd16=['info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x38c874,_0x4e0365){var _0x59bf52=function(_0x544692){while(--_0x544692){_0x38c874['push'](_0x38c874['shift']());}};_0x59bf52(++_0x4e0365);}(_0xdd16,0x1ed));var _0x6dd1=function(_0x870b1e,_0x58c16e){_0x870b1e=_0x870b1e-0x0;var _0x3a63b0=_0xdd16[_0x870b1e];return _0x3a63b0;};'use strict';var _=require(_0x6dd1('0x0'));var util=require(_0x6dd1('0x1'));var moment=require('moment');var BPromise=require(_0x6dd1('0x2'));var rs=require(_0x6dd1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6dd1('0x4'));var logger=require(_0x6dd1('0x5'))('rpc');var config=require(_0x6dd1('0x6'));var jayson=require(_0x6dd1('0x7'));var client=jayson[_0x6dd1('0x8')][_0x6dd1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52d4d3,_0x1e2fc9,_0xc3864f){return new BPromise(function(_0x2df023,_0x44735d){return client[_0x6dd1('0xa')](_0x52d4d3,_0xc3864f)['then'](function(_0x1df70e){logger[_0x6dd1('0xb')](_0x6dd1('0xc'),_0x1e2fc9,_0x6dd1('0xd'));logger[_0x6dd1('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1e2fc9,_0x6dd1('0xd'),JSON[_0x6dd1('0xf')](_0x1df70e));if(_0x1df70e[_0x6dd1('0x10')]){if(_0x1df70e[_0x6dd1('0x10')][_0x6dd1('0x11')]===0x1f4){logger[_0x6dd1('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e2fc9,_0x1df70e[_0x6dd1('0x10')][_0x6dd1('0x12')]);return _0x44735d(_0x1df70e[_0x6dd1('0x10')][_0x6dd1('0x12')]);}logger[_0x6dd1('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e2fc9,_0x1df70e[_0x6dd1('0x10')][_0x6dd1('0x12')]);return _0x2df023(_0x1df70e[_0x6dd1('0x10')][_0x6dd1('0x12')]);}else{logger[_0x6dd1('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e2fc9,_0x6dd1('0xd'));_0x2df023(_0x1df70e[_0x6dd1('0x13')][_0x6dd1('0x12')]);}})[_0x6dd1('0x14')](function(_0x4e3a68){logger[_0x6dd1('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e2fc9,_0x4e3a68);_0x44735d(_0x4e3a68);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 91ac415..9bf4421 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 _0x4d73=['/:id','delete','exports','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','put'];(function(_0x103aa2,_0x4a4375){var _0x3f2be3=function(_0x15b133){while(--_0x15b133){_0x103aa2['push'](_0x103aa2['shift']());}};_0x3f2be3(++_0x4a4375);}(_0x4d73,0xe0));var _0x34d7=function(_0x2d438c,_0x28de80){_0x2d438c=_0x2d438c-0x0;var _0x127e3e=_0x4d73[_0x2d438c];return _0x127e3e;};'use strict';var multer=require('multer');var util=require(_0x34d7('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x34d7('0x1')]();var fs_extra=require(_0x34d7('0x2'));var auth=require(_0x34d7('0x3'));var interaction=require(_0x34d7('0x4'));var config=require('../../config/environment');var controller=require(_0x34d7('0x5'));router[_0x34d7('0x6')]('/',auth[_0x34d7('0x7')](),controller[_0x34d7('0x8')]);router[_0x34d7('0x6')]('/:id',auth[_0x34d7('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x34d7('0x9')](_0x34d7('0xa'),auth[_0x34d7('0x7')](),controller['update']);router[_0x34d7('0xb')]('/:id',auth[_0x34d7('0x7')](),controller['destroy']);module[_0x34d7('0xc')]=router; \ No newline at end of file +var _0x8bf1=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x399ca8,_0x5b6ff3){var _0x4a4530=function(_0x5c9585){while(--_0x5c9585){_0x399ca8['push'](_0x399ca8['shift']());}};_0x4a4530(++_0x5b6ff3);}(_0x8bf1,0x187));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x18bf('0x0'));var path=require(_0x18bf('0x1'));var timeout=require(_0x18bf('0x2'));var express=require(_0x18bf('0x3'));var router=express[_0x18bf('0x4')]();var fs_extra=require(_0x18bf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x18bf('0x6'));var controller=require(_0x18bf('0x7'));router[_0x18bf('0x8')]('/',auth[_0x18bf('0x9')](),controller['index']);router[_0x18bf('0x8')](_0x18bf('0xa'),auth[_0x18bf('0x9')](),controller[_0x18bf('0xb')]);router[_0x18bf('0xc')]('/',auth[_0x18bf('0x9')](),controller[_0x18bf('0xd')]);router[_0x18bf('0xe')]('/:id',auth[_0x18bf('0x9')](),controller[_0x18bf('0xf')]);router[_0x18bf('0x10')]('/:id',auth[_0x18bf('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 89af052..f56884e 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 _0xc3fe=['exports','ENUM','variable','customVariable','keyValue','string','STRING','sequelize'];(function(_0x52a592,_0x2926b4){var _0x511e55=function(_0x11afac){while(--_0x11afac){_0x52a592['push'](_0x52a592['shift']());}};_0x511e55(++_0x2926b4);}(_0xc3fe,0xff));var _0xec3f=function(_0x3092d0,_0x2b0899){_0x3092d0=_0x3092d0-0x0;var _0xda4527=_0xc3fe[_0x3092d0];return _0xda4527;};'use strict';var Sequelize=require(_0xec3f('0x0'));module[_0xec3f('0x1')]={'type':{'type':Sequelize[_0xec3f('0x2')]('string',_0xec3f('0x3'),_0xec3f('0x4'),_0xec3f('0x5'),'picklist'),'defaultValue':_0xec3f('0x6')},'content':{'type':Sequelize[_0xec3f('0x7')]},'key':{'type':Sequelize[_0xec3f('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0xec3f('0x3'),_0xec3f('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xec3f('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xec3f('0x7')]}}; \ No newline at end of file +var _0x8ce3=['keyValue','picklist','STRING','sequelize','exports','string','variable','customVariable'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x8ce3,0xc3));var _0x38ce=function(_0x1b3251,_0x58f958){_0x1b3251=_0x1b3251-0x0;var _0x370769=_0x8ce3[_0x1b3251];return _0x370769;};'use strict';var Sequelize=require(_0x38ce('0x0'));module[_0x38ce('0x1')]={'type':{'type':Sequelize['ENUM'](_0x38ce('0x2'),_0x38ce('0x3'),_0x38ce('0x4'),_0x38ce('0x5'),_0x38ce('0x6')),'defaultValue':_0x38ce('0x2')},'content':{'type':Sequelize[_0x38ce('0x7')]},'key':{'type':Sequelize[_0x38ce('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x38ce('0x2'),_0x38ce('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x38ce('0x7')]},'idField':{'type':Sequelize[_0x38ce('0x7')]},'nameField':{'type':Sequelize[_0x38ce('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x38ce('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 8c0b161..56bcc21 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 _0xba9f=['create','body','find','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','apply','reject','save','update','then','destroy','stack','name','send','merge','contact','message','interaction','account','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','options','FreshdeskField','includeAll','findAll','show','params','catch'];(function(_0x2e3416,_0x5073f4){var _0x1749ff=function(_0x3322d1){while(--_0x3322d1){_0x2e3416['push'](_0x2e3416['shift']());}};_0x1749ff(++_0x5073f4);}(_0xba9f,0x193));var _0xfba9=function(_0x4612bf,_0x1d12b5){_0x4612bf=_0x4612bf-0x0;var _0x188526=_0xba9f[_0x4612bf];return _0x188526;};'use strict';var emlformat=require(_0xfba9('0x0'));var rimraf=require(_0xfba9('0x1'));var zipdir=require(_0xfba9('0x2'));var jsonpatch=require(_0xfba9('0x3'));var rp=require(_0xfba9('0x4'));var moment=require(_0xfba9('0x5'));var BPromise=require(_0xfba9('0x6'));var Mustache=require(_0xfba9('0x7'));var util=require(_0xfba9('0x8'));var path=require(_0xfba9('0x9'));var sox=require(_0xfba9('0xa'));var csv=require(_0xfba9('0xb'));var ejs=require(_0xfba9('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfba9('0xd'));var squel=require(_0xfba9('0xe'));var crypto=require(_0xfba9('0xf'));var jsforce=require(_0xfba9('0x10'));var deskjs=require(_0xfba9('0x11'));var toCsv=require('to-csv');var querystring=require(_0xfba9('0x12'));var Papa=require('papaparse');var Redis=require(_0xfba9('0x13'));var authService=require(_0xfba9('0x14'));var qs=require(_0xfba9('0x15'));var as=require(_0xfba9('0x16'));var hardwareService=require(_0xfba9('0x17'));var logger=require('../../config/logger')(_0xfba9('0x18'));var utils=require(_0xfba9('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xfba9('0x1a'));var db=require(_0xfba9('0x1b'))['db'];function respondWithStatusCode(_0x359dd3,_0x4496e2){_0x4496e2=_0x4496e2||0xcc;return function(_0x363aaf){if(_0x363aaf){return _0x359dd3[_0xfba9('0x1c')](_0x4496e2);}return _0x359dd3[_0xfba9('0x1d')](_0x4496e2)[_0xfba9('0x1e')]();};}function respondWithResult(_0x3912ac,_0x3c6f47){_0x3c6f47=_0x3c6f47||0xc8;return function(_0x9f7540){if(_0x9f7540){return _0x3912ac[_0xfba9('0x1d')](_0x3c6f47)[_0xfba9('0x1f')](_0x9f7540);}};}function respondWithFilteredResult(_0x2731d6,_0x1a2feb){return function(_0xc3d204){if(_0xc3d204){var _0x11dd8a=typeof _0x1a2feb['offset']==='undefined'&&typeof _0x1a2feb[_0xfba9('0x20')]===_0xfba9('0x21');var _0x460c12=_0xc3d204['count'];var _0xb5ddf6=_0x11dd8a?0x0:_0x1a2feb[_0xfba9('0x22')];var _0x36be7e=_0x11dd8a?_0xc3d204[_0xfba9('0x23')]:_0x1a2feb[_0xfba9('0x22')]+_0x1a2feb[_0xfba9('0x20')];var _0x3ce3bf;if(_0x36be7e>=_0x460c12){_0x36be7e=_0x460c12;_0x3ce3bf=0xc8;}else{_0x3ce3bf=0xce;}_0x2731d6['status'](_0x3ce3bf);return _0x2731d6[_0xfba9('0x24')]('Content-Range',_0xb5ddf6+'-'+_0x36be7e+'/'+_0x460c12)[_0xfba9('0x1f')](_0xc3d204);}return null;};}function patchUpdates(_0x11b2c9){return function(_0x5a391e){try{jsonpatch[_0xfba9('0x25')](_0x5a391e,_0x11b2c9,!![]);}catch(_0x3d3406){return BPromise[_0xfba9('0x26')](_0x3d3406);}return _0x5a391e[_0xfba9('0x27')]();};}function saveUpdates(_0xf3db14,_0x1e9513){return function(_0x26f211){if(_0x26f211){return _0x26f211[_0xfba9('0x28')](_0xf3db14)[_0xfba9('0x29')](function(_0x44d0ef){return _0x44d0ef;});}return null;};}function removeEntity(_0x43c323,_0x4c2647){return function(_0x3165f1){if(_0x3165f1){return _0x3165f1[_0xfba9('0x2a')]()[_0xfba9('0x29')](function(){_0x43c323['status'](0xcc)[_0xfba9('0x1e')]();});}};}function handleEntityNotFound(_0x1e8c3d,_0x5582bf){return function(_0x209281){if(!_0x209281){_0x1e8c3d[_0xfba9('0x1c')](0x194);}return _0x209281;};}function handleError(_0x2e7154,_0x50db23){_0x50db23=_0x50db23||0x1f4;return function(_0x3e4bc8){logger['error'](_0x3e4bc8[_0xfba9('0x2b')]);if(_0x3e4bc8[_0xfba9('0x2c')]){delete _0x3e4bc8[_0xfba9('0x2c')];}_0x2e7154['status'](_0x50db23)[_0xfba9('0x2d')](_0x3e4bc8);};}function getMustacheRender(_0x2410a1,_0x4f0b7b){return Mustache['render'](_0x2410a1,_[_0xfba9('0x2e')](_0x4f0b7b['body'],{'contact':_0x4f0b7b[_0xfba9('0x2f')],'message':_0x4f0b7b[_0xfba9('0x30')],'agent':_0x4f0b7b['agent'],'interaction':_0x4f0b7b[_0xfba9('0x31')],'account':_0x4f0b7b[_0xfba9('0x32')]}))||'';}exports[_0xfba9('0x33')]=function(_0xa03ba6,_0xc6bff8){var _0x12c505={},_0x2c21b2={},_0x55e7a4={'count':0x0,'rows':[]};var _0x165fea=_[_0xfba9('0x34')](db['FreshdeskField'][_0xfba9('0x35')],function(_0x489795){return{'name':_0x489795[_0xfba9('0x36')],'type':_0x489795['type'][_0xfba9('0x37')]};});_0x2c21b2[_0xfba9('0x38')]=_[_0xfba9('0x34')](_0x165fea,'name');_0x2c21b2[_0xfba9('0x39')]=_[_0xfba9('0x3a')](_0xa03ba6[_0xfba9('0x39')]);_0x2c21b2[_0xfba9('0x3b')]=_[_0xfba9('0x3c')](_0x2c21b2[_0xfba9('0x38')],_0x2c21b2[_0xfba9('0x39')]);_0x12c505[_0xfba9('0x3d')]=_[_0xfba9('0x3c')](_0x2c21b2[_0xfba9('0x38')],qs[_0xfba9('0x3e')](_0xa03ba6['query'][_0xfba9('0x3e')]));_0x12c505[_0xfba9('0x3d')]=_0x12c505['attributes'][_0xfba9('0x3f')]?_0x12c505[_0xfba9('0x3d')]:_0x2c21b2['model'];if(!_0xa03ba6[_0xfba9('0x39')][_0xfba9('0x40')]('nolimit')){_0x12c505['limit']=qs[_0xfba9('0x20')](_0xa03ba6[_0xfba9('0x39')][_0xfba9('0x20')]);_0x12c505[_0xfba9('0x22')]=qs[_0xfba9('0x22')](_0xa03ba6[_0xfba9('0x39')][_0xfba9('0x22')]);}_0x12c505[_0xfba9('0x41')]=qs[_0xfba9('0x42')](_0xa03ba6[_0xfba9('0x39')]['sort']);_0x12c505[_0xfba9('0x43')]=qs[_0xfba9('0x3b')](_[_0xfba9('0x44')](_0xa03ba6['query'],_0x2c21b2[_0xfba9('0x3b')]),_0x165fea);if(_0xa03ba6[_0xfba9('0x39')]['filter']){_0x12c505[_0xfba9('0x43')]=_['merge'](_0x12c505[_0xfba9('0x43')],{'$or':_[_0xfba9('0x34')](_0x165fea,function(_0x4ef830){if(_0x4ef830[_0xfba9('0x45')]!=='VIRTUAL'){var _0x3023c1={};_0x3023c1[_0x4ef830[_0xfba9('0x2c')]]={'$like':'%'+_0xa03ba6['query']['filter']+'%'};return _0x3023c1;}})});}_0x12c505=_[_0xfba9('0x2e')]({},_0x12c505,_0xa03ba6[_0xfba9('0x46')]);var _0x2270da={'where':_0x12c505['where']};return db[_0xfba9('0x47')][_0xfba9('0x23')](_0x2270da)['then'](function(_0x53a657){_0x55e7a4[_0xfba9('0x23')]=_0x53a657;if(_0xa03ba6[_0xfba9('0x39')][_0xfba9('0x48')]){_0x12c505['include']=[{'all':!![]}];}return db['FreshdeskField'][_0xfba9('0x49')](_0x12c505);})['then'](function(_0x1985d9){_0x55e7a4['rows']=_0x1985d9;return _0x55e7a4;})['then'](respondWithFilteredResult(_0xc6bff8,_0x12c505))['catch'](handleError(_0xc6bff8,null));};exports[_0xfba9('0x4a')]=function(_0x2d14d2,_0x477c74){var _0x36ecc1={'raw':!![],'where':{'id':_0x2d14d2[_0xfba9('0x4b')]['id']}},_0x3e7001={};_0x3e7001[_0xfba9('0x38')]=_[_0xfba9('0x3a')](db['FreshdeskField'][_0xfba9('0x35')]);_0x3e7001[_0xfba9('0x39')]=_[_0xfba9('0x3a')](_0x2d14d2['query']);_0x3e7001[_0xfba9('0x3b')]=_[_0xfba9('0x3c')](_0x3e7001[_0xfba9('0x38')],_0x3e7001[_0xfba9('0x39')]);_0x36ecc1[_0xfba9('0x3d')]=_[_0xfba9('0x3c')](_0x3e7001[_0xfba9('0x38')],qs[_0xfba9('0x3e')](_0x2d14d2[_0xfba9('0x39')][_0xfba9('0x3e')]));_0x36ecc1[_0xfba9('0x3d')]=_0x36ecc1['attributes']['length']?_0x36ecc1[_0xfba9('0x3d')]:_0x3e7001['model'];if(_0x2d14d2[_0xfba9('0x39')][_0xfba9('0x48')]){_0x36ecc1['include']=[{'all':!![]}];}_0x36ecc1=_[_0xfba9('0x2e')]({},_0x36ecc1,_0x2d14d2[_0xfba9('0x46')]);return db[_0xfba9('0x47')]['find'](_0x36ecc1)['then'](handleEntityNotFound(_0x477c74,null))[_0xfba9('0x29')](respondWithResult(_0x477c74,null))[_0xfba9('0x4c')](handleError(_0x477c74,null));};exports[_0xfba9('0x4d')]=function(_0x29de0a,_0x5dd27c){return db[_0xfba9('0x47')][_0xfba9('0x4d')](_0x29de0a[_0xfba9('0x4e')],{})[_0xfba9('0x29')](respondWithResult(_0x5dd27c,0xc9))[_0xfba9('0x4c')](handleError(_0x5dd27c,null));};exports[_0xfba9('0x28')]=function(_0xcb1c60,_0x44a51d){if(_0xcb1c60['body']['id']){delete _0xcb1c60[_0xfba9('0x4e')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0xcb1c60['params']['id']}})[_0xfba9('0x29')](handleEntityNotFound(_0x44a51d,null))[_0xfba9('0x29')](saveUpdates(_0xcb1c60[_0xfba9('0x4e')],null))[_0xfba9('0x29')](respondWithResult(_0x44a51d,null))[_0xfba9('0x4c')](handleError(_0x44a51d,null));};exports[_0xfba9('0x2a')]=function(_0x4ce500,_0x294312){return db[_0xfba9('0x47')][_0xfba9('0x4f')]({'where':{'id':_0x4ce500['params']['id']}})[_0xfba9('0x29')](handleEntityNotFound(_0x294312,null))[_0xfba9('0x29')](removeEntity(_0x294312,null))[_0xfba9('0x4c')](handleError(_0x294312,null));}; \ No newline at end of file +var _0x424b=['undefined','count','limit','set','Content-Range','apply','save','update','then','error','stack','send','render','merge','body','contact','message','interaction','account','map','FreshdeskField','rawAttributes','type','name','intersection','model','query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','includeAll','include','findAll','rows','catch','keys','fields','length','options','create','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset'];(function(_0x54ba07,_0x763a12){var _0x277595=function(_0x2f9fd4){while(--_0x2f9fd4){_0x54ba07['push'](_0x54ba07['shift']());}};_0x277595(++_0x763a12);}(_0x424b,0x7c));var _0xb424=function(_0x46b7c4,_0x119ebc){_0x46b7c4=_0x46b7c4-0x0;var _0x7ab83=_0x424b[_0x46b7c4];return _0x7ab83;};'use strict';var emlformat=require(_0xb424('0x0'));var rimraf=require(_0xb424('0x1'));var zipdir=require(_0xb424('0x2'));var jsonpatch=require(_0xb424('0x3'));var rp=require(_0xb424('0x4'));var moment=require(_0xb424('0x5'));var BPromise=require(_0xb424('0x6'));var Mustache=require(_0xb424('0x7'));var util=require(_0xb424('0x8'));var path=require(_0xb424('0x9'));var sox=require(_0xb424('0xa'));var csv=require(_0xb424('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb424('0xc'));var _=require(_0xb424('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb424('0xe'));var deskjs=require(_0xb424('0xf'));var toCsv=require(_0xb424('0xb'));var querystring=require(_0xb424('0x10'));var Papa=require(_0xb424('0x11'));var Redis=require(_0xb424('0x12'));var authService=require(_0xb424('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb424('0x14'));var utils=require(_0xb424('0x15'));var config=require(_0xb424('0x16'));var licenseUtil=require(_0xb424('0x17'));var db=require(_0xb424('0x18'))['db'];function respondWithStatusCode(_0x5cf6e9,_0x4a73c5){_0x4a73c5=_0x4a73c5||0xcc;return function(_0x47ea1b){if(_0x47ea1b){return _0x5cf6e9[_0xb424('0x19')](_0x4a73c5);}return _0x5cf6e9[_0xb424('0x1a')](_0x4a73c5)['end']();};}function respondWithResult(_0x560e53,_0x15a864){_0x15a864=_0x15a864||0xc8;return function(_0x317a64){if(_0x317a64){return _0x560e53[_0xb424('0x1a')](_0x15a864)['json'](_0x317a64);}};}function respondWithFilteredResult(_0x2b022c,_0x5d5929){return function(_0x572286){if(_0x572286){var _0x33bf5f=typeof _0x5d5929[_0xb424('0x1b')]===_0xb424('0x1c')&&typeof _0x5d5929['limit']===_0xb424('0x1c');var _0x11fd59=_0x572286[_0xb424('0x1d')];var _0x52413b=_0x33bf5f?0x0:_0x5d5929[_0xb424('0x1b')];var _0x2e6081=_0x33bf5f?_0x572286[_0xb424('0x1d')]:_0x5d5929[_0xb424('0x1b')]+_0x5d5929[_0xb424('0x1e')];var _0x33a4ca;if(_0x2e6081>=_0x11fd59){_0x2e6081=_0x11fd59;_0x33a4ca=0xc8;}else{_0x33a4ca=0xce;}_0x2b022c[_0xb424('0x1a')](_0x33a4ca);return _0x2b022c[_0xb424('0x1f')](_0xb424('0x20'),_0x52413b+'-'+_0x2e6081+'/'+_0x11fd59)['json'](_0x572286);}return null;};}function patchUpdates(_0x38c535){return function(_0x25c0f8){try{jsonpatch[_0xb424('0x21')](_0x25c0f8,_0x38c535,!![]);}catch(_0x20d8e4){return BPromise['reject'](_0x20d8e4);}return _0x25c0f8[_0xb424('0x22')]();};}function saveUpdates(_0x2d690f,_0x3917ba){return function(_0x331c99){if(_0x331c99){return _0x331c99[_0xb424('0x23')](_0x2d690f)[_0xb424('0x24')](function(_0x41a18b){return _0x41a18b;});}return null;};}function removeEntity(_0x241c3d,_0x3c2574){return function(_0x1eecd1){if(_0x1eecd1){return _0x1eecd1['destroy']()[_0xb424('0x24')](function(){_0x241c3d[_0xb424('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x473387,_0x44f9cf){return function(_0x4eaac4){if(!_0x4eaac4){_0x473387[_0xb424('0x19')](0x194);}return _0x4eaac4;};}function handleError(_0x454f1c,_0x5f108c){_0x5f108c=_0x5f108c||0x1f4;return function(_0x4b97cd){logger[_0xb424('0x25')](_0x4b97cd[_0xb424('0x26')]);if(_0x4b97cd['name']){delete _0x4b97cd['name'];}_0x454f1c[_0xb424('0x1a')](_0x5f108c)[_0xb424('0x27')](_0x4b97cd);};}function getMustacheRender(_0x3f0de0,_0x1cd2c3){return Mustache[_0xb424('0x28')](_0x3f0de0,_[_0xb424('0x29')](_0x1cd2c3[_0xb424('0x2a')],{'contact':_0x1cd2c3[_0xb424('0x2b')],'message':_0x1cd2c3[_0xb424('0x2c')],'agent':_0x1cd2c3['agent'],'interaction':_0x1cd2c3[_0xb424('0x2d')],'account':_0x1cd2c3[_0xb424('0x2e')]}))||'';}exports['index']=function(_0x28a574,_0x18b242){var _0x1c6381={},_0x39f09f={},_0x3c6b9a={'count':0x0,'rows':[]};var _0x4ac34c=_[_0xb424('0x2f')](db[_0xb424('0x30')][_0xb424('0x31')],function(_0x3710dd){return{'name':_0x3710dd['fieldName'],'type':_0x3710dd[_0xb424('0x32')]['key']};});_0x39f09f['model']=_[_0xb424('0x2f')](_0x4ac34c,_0xb424('0x33'));_0x39f09f['query']=_['keys'](_0x28a574['query']);_0x39f09f['filters']=_[_0xb424('0x34')](_0x39f09f[_0xb424('0x35')],_0x39f09f[_0xb424('0x36')]);_0x1c6381['attributes']=_[_0xb424('0x34')](_0x39f09f[_0xb424('0x35')],qs['fields'](_0x28a574['query']['fields']));_0x1c6381[_0xb424('0x37')]=_0x1c6381['attributes']['length']?_0x1c6381[_0xb424('0x37')]:_0x39f09f[_0xb424('0x35')];if(!_0x28a574[_0xb424('0x36')][_0xb424('0x38')](_0xb424('0x39'))){_0x1c6381[_0xb424('0x1e')]=qs[_0xb424('0x1e')](_0x28a574[_0xb424('0x36')][_0xb424('0x1e')]);_0x1c6381[_0xb424('0x1b')]=qs[_0xb424('0x1b')](_0x28a574[_0xb424('0x36')]['offset']);}_0x1c6381[_0xb424('0x3a')]=qs[_0xb424('0x3b')](_0x28a574[_0xb424('0x36')]['sort']);_0x1c6381[_0xb424('0x3c')]=qs['filters'](_[_0xb424('0x3d')](_0x28a574[_0xb424('0x36')],_0x39f09f[_0xb424('0x3e')]),_0x4ac34c);if(_0x28a574[_0xb424('0x36')]['filter']){_0x1c6381[_0xb424('0x3c')]=_[_0xb424('0x29')](_0x1c6381[_0xb424('0x3c')],{'$or':_[_0xb424('0x2f')](_0x4ac34c,function(_0x3df53e){if(_0x3df53e[_0xb424('0x32')]!==_0xb424('0x3f')){var _0x44a026={};_0x44a026[_0x3df53e[_0xb424('0x33')]]={'$like':'%'+_0x28a574[_0xb424('0x36')][_0xb424('0x40')]+'%'};return _0x44a026;}})});}_0x1c6381=_[_0xb424('0x29')]({},_0x1c6381,_0x28a574['options']);var _0x57fc44={'where':_0x1c6381[_0xb424('0x3c')]};return db[_0xb424('0x30')][_0xb424('0x1d')](_0x57fc44)[_0xb424('0x24')](function(_0x483e7e){_0x3c6b9a[_0xb424('0x1d')]=_0x483e7e;if(_0x28a574[_0xb424('0x36')][_0xb424('0x41')]){_0x1c6381[_0xb424('0x42')]=[{'all':!![]}];}return db[_0xb424('0x30')][_0xb424('0x43')](_0x1c6381);})[_0xb424('0x24')](function(_0x51053e){_0x3c6b9a[_0xb424('0x44')]=_0x51053e;return _0x3c6b9a;})['then'](respondWithFilteredResult(_0x18b242,_0x1c6381))[_0xb424('0x45')](handleError(_0x18b242,null));};exports['show']=function(_0x57fbe2,_0x511619){var _0xd2f137={'raw':!![],'where':{'id':_0x57fbe2['params']['id']}},_0x2c138d={};_0x2c138d['model']=_[_0xb424('0x46')](db[_0xb424('0x30')][_0xb424('0x31')]);_0x2c138d[_0xb424('0x36')]=_[_0xb424('0x46')](_0x57fbe2[_0xb424('0x36')]);_0x2c138d['filters']=_['intersection'](_0x2c138d[_0xb424('0x35')],_0x2c138d[_0xb424('0x36')]);_0xd2f137[_0xb424('0x37')]=_['intersection'](_0x2c138d[_0xb424('0x35')],qs[_0xb424('0x47')](_0x57fbe2[_0xb424('0x36')][_0xb424('0x47')]));_0xd2f137[_0xb424('0x37')]=_0xd2f137['attributes'][_0xb424('0x48')]?_0xd2f137[_0xb424('0x37')]:_0x2c138d[_0xb424('0x35')];if(_0x57fbe2[_0xb424('0x36')]['includeAll']){_0xd2f137['include']=[{'all':!![]}];}_0xd2f137=_[_0xb424('0x29')]({},_0xd2f137,_0x57fbe2[_0xb424('0x49')]);return db[_0xb424('0x30')]['find'](_0xd2f137)[_0xb424('0x24')](handleEntityNotFound(_0x511619,null))[_0xb424('0x24')](respondWithResult(_0x511619,null))[_0xb424('0x45')](handleError(_0x511619,null));};exports[_0xb424('0x4a')]=function(_0x5e0847,_0x3d5fb2){return db[_0xb424('0x30')][_0xb424('0x4a')](_0x5e0847[_0xb424('0x2a')],{})[_0xb424('0x24')](respondWithResult(_0x3d5fb2,0xc9))[_0xb424('0x45')](handleError(_0x3d5fb2,null));};exports[_0xb424('0x23')]=function(_0x172f14,_0x551491){if(_0x172f14['body']['id']){delete _0x172f14[_0xb424('0x2a')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x172f14['params']['id']}})[_0xb424('0x24')](handleEntityNotFound(_0x551491,null))['then'](saveUpdates(_0x172f14[_0xb424('0x2a')],null))['then'](respondWithResult(_0x551491,null))['catch'](handleError(_0x551491,null));};exports['destroy']=function(_0x338349,_0x3c9ce8){return db[_0xb424('0x30')]['find']({'where':{'id':_0x338349[_0xb424('0x4b')]['id']}})[_0xb424('0x24')](handleEntityNotFound(_0x3c9ce8,null))[_0xb424('0x24')](removeEntity(_0x3c9ce8,null))[_0xb424('0x45')](handleError(_0x3c9ce8,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index b3f3e45..1278835 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 _0xc81a=['moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x54d684,_0x53cb0a){var _0x5ac2dd=function(_0x48fe69){while(--_0x48fe69){_0x54d684['push'](_0x54d684['shift']());}};_0x5ac2dd(++_0x53cb0a);}(_0xc81a,0x166));var _0xac81=function(_0x11d119,_0x16a5b6){_0x11d119=_0x11d119-0x0;var _0x2d690d=_0xc81a[_0x11d119];return _0x2d690d;};'use strict';var _=require(_0xac81('0x0'));var util=require('util');var logger=require(_0xac81('0x1'))('api');var moment=require(_0xac81('0x2'));var BPromise=require(_0xac81('0x3'));var rp=require(_0xac81('0x4'));var fs=require('fs');var path=require(_0xac81('0x5'));var rimraf=require('rimraf');var config=require(_0xac81('0x6'));var attributes=require(_0xac81('0x7'));module[_0xac81('0x8')]=function(_0xcb202f,_0x43db52){return _0xcb202f[_0xac81('0x9')](_0xac81('0xa'),attributes,{'tableName':_0xac81('0xb'),'paranoid':![],'indexes':[{'name':_0xac81('0xc'),'fields':[_0xac81('0xd'),_0xac81('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2dbb=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x2dbb,0x188));var _0xb2db=function(_0x29e661,_0x536def){_0x29e661=_0x29e661-0x0;var _0x3361a7=_0x2dbb[_0x29e661];return _0x3361a7;};'use strict';var _=require(_0xb2db('0x0'));var util=require(_0xb2db('0x1'));var logger=require(_0xb2db('0x2'))(_0xb2db('0x3'));var moment=require(_0xb2db('0x4'));var BPromise=require(_0xb2db('0x5'));var rp=require(_0xb2db('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2db('0x7'));var config=require('../../config/environment');var attributes=require(_0xb2db('0x8'));module[_0xb2db('0x9')]=function(_0x23a112,_0x1e4086){return _0x23a112[_0xb2db('0xa')]('FreshdeskField',attributes,{'tableName':_0xb2db('0xb'),'paranoid':![],'indexes':[{'name':_0xb2db('0xc'),'fields':[_0xb2db('0xd'),_0xb2db('0xe')],'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 6c48e26..8c57edd 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x1de884,_0x378699){_0x1de884=_0x1de884-0x0;var _0x3fd67e=_0x7a54[_0x1de884];return _0x3fd67e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x19d7d9,_0x3974e9){var _0xc951e7=function(_0x2a8923){while(--_0x2a8923){_0x19d7d9['push'](_0x19d7d9['shift']());}};_0xc951e7(++_0x3974e9);}(_0xb10b,0x12a));var _0xbb10=function(_0x14bbf3,_0xca820f){_0x14bbf3=_0x14bbf3-0x0;var _0x1b280c=_0xb10b[_0x14bbf3];return _0x1b280c;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 3899925..d3c2ddd 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 _0x3b8c=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util'];(function(_0xc62fdc,_0x4a8107){var _0x5f521f=function(_0x2943e5){while(--_0x2943e5){_0xc62fdc['push'](_0xc62fdc['shift']());}};_0x5f521f(++_0x4a8107);}(_0x3b8c,0x1b3));var _0xc3b8=function(_0x299125,_0x4d12f6){_0x299125=_0x299125-0x0;var _0x108ed0=_0x3b8c[_0x299125];return _0x108ed0;};'use strict';var multer=require(_0xc3b8('0x0'));var util=require(_0xc3b8('0x1'));var path=require(_0xc3b8('0x2'));var timeout=require(_0xc3b8('0x3'));var express=require(_0xc3b8('0x4'));var router=express['Router']();var fs_extra=require(_0xc3b8('0x5'));var auth=require(_0xc3b8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc3b8('0x7'));var controller=require(_0xc3b8('0x8'));router[_0xc3b8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc3b8('0x9')](_0xc3b8('0xa'),auth['isAuthenticated'](),controller[_0xc3b8('0xb')]);router[_0xc3b8('0x9')](_0xc3b8('0xc'),auth[_0xc3b8('0xd')](),controller[_0xc3b8('0xe')]);router[_0xc3b8('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xc3b8('0xf')]('/',auth[_0xc3b8('0xd')](),controller[_0xc3b8('0x10')]);router[_0xc3b8('0xf')](_0xc3b8('0xc'),auth['isAuthenticated'](),controller[_0xc3b8('0x11')]);router[_0xc3b8('0x12')](_0xc3b8('0xa'),auth[_0xc3b8('0xd')](),controller[_0xc3b8('0x13')]);router[_0xc3b8('0x14')](_0xc3b8('0xa'),auth[_0xc3b8('0xd')](),controller[_0xc3b8('0x15')]);module[_0xc3b8('0x16')]=router; \ No newline at end of file +var _0xcba0=['/:id','isAuthenticated','/:id/configurations','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x2c5b7a,_0x26a264){var _0x394296=function(_0x286f36){while(--_0x286f36){_0x2c5b7a['push'](_0x2c5b7a['shift']());}};_0x394296(++_0x26a264);}(_0xcba0,0xe3));var _0x0cba=function(_0xab910e,_0x24bf22){_0xab910e=_0xab910e-0x0;var _0x486256=_0xcba0[_0xab910e];return _0x486256;};'use strict';var multer=require(_0x0cba('0x0'));var util=require(_0x0cba('0x1'));var path=require(_0x0cba('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0cba('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0cba('0x4'));var config=require(_0x0cba('0x5'));var controller=require('./intFreshsalesAccount.controller');router[_0x0cba('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0cba('0x7'),auth[_0x0cba('0x8')](),controller['show']);router[_0x0cba('0x6')](_0x0cba('0x9'),auth[_0x0cba('0x8')](),controller['getConfigurations']);router[_0x0cba('0x6')]('/:id/fields',auth[_0x0cba('0x8')](),controller[_0x0cba('0xa')]);router[_0x0cba('0xb')]('/',auth[_0x0cba('0x8')](),controller[_0x0cba('0xc')]);router[_0x0cba('0xb')]('/:id/configurations',auth[_0x0cba('0x8')](),controller[_0x0cba('0xd')]);router['put'](_0x0cba('0x7'),auth[_0x0cba('0x8')](),controller[_0x0cba('0xe')]);router[_0x0cba('0xf')](_0x0cba('0x7'),auth[_0x0cba('0x8')](),controller[_0x0cba('0x10')]);module[_0x0cba('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index f8b0ae5..10b7c70 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 _0xb087=['remoteUri','STRING'];(function(_0x23c22f,_0x467889){var _0x10c5e8=function(_0x14cb79){while(--_0x14cb79){_0x23c22f['push'](_0x23c22f['shift']());}};_0x10c5e8(++_0x467889);}(_0xb087,0xff));var _0x7b08=function(_0x5d372f,_0x54c99c){_0x5d372f=_0x5d372f-0x0;var _0x3ad4c0=_0xb087[_0x5d372f];return _0x3ad4c0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7b08('0x0')]},'description':{'type':Sequelize[_0x7b08('0x0')]},'username':{'type':Sequelize[_0x7b08('0x0')],'unique':'username'},'apiKey':{'type':Sequelize[_0x7b08('0x0')]},'remoteUri':{'type':Sequelize[_0x7b08('0x0')],'unique':_0x7b08('0x1')},'serverUrl':{'type':Sequelize[_0x7b08('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x7f36=['exports','STRING','username','remoteUri','sequelize'];(function(_0x472072,_0x5add18){var _0x38ca35=function(_0x197592){while(--_0x197592){_0x472072['push'](_0x472072['shift']());}};_0x38ca35(++_0x5add18);}(_0x7f36,0x1d0));var _0x67f3=function(_0x4ceb68,_0x429b5a){_0x4ceb68=_0x4ceb68-0x0;var _0x17bf7e=_0x7f36[_0x4ceb68];return _0x17bf7e;};'use strict';var Sequelize=require(_0x67f3('0x0'));module[_0x67f3('0x1')]={'name':{'type':Sequelize[_0x67f3('0x2')]},'description':{'type':Sequelize[_0x67f3('0x2')]},'username':{'type':Sequelize[_0x67f3('0x2')],'unique':_0x67f3('0x3')},'apiKey':{'type':Sequelize[_0x67f3('0x2')]},'remoteUri':{'type':Sequelize[_0x67f3('0x2')],'unique':_0x67f3('0x4')},'serverUrl':{'type':Sequelize[_0x67f3('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 d1fc981..3a64fab 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 _0xa9e0=['merge','body','contact','interaction','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','VIRTUAL','options','FreshsalesAccount','includeAll','include','findAll','rows','show','intersection','find','create','params','getConfigurations','FreshsalesConfiguration','order','addConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','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','../../components/integrations/configuration','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','FreshsalesAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','render'];(function(_0x1d39ba,_0x5196f9){var _0xc1453e=function(_0x52df5c){while(--_0x52df5c){_0x1d39ba['push'](_0x1d39ba['shift']());}};_0xc1453e(++_0x5196f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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'];var integrations=require(_0x0a9e('0x15'));var jayson=require(_0x0a9e('0x16'));var client=jayson[_0x0a9e('0x17')][_0x0a9e('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5db4b0,_0x4283ce,_0x239b12,_0x2b4227){return new BPromise(function(_0x281129,_0x44dcfd){var _0x4d5611=_0x2b4227||client;return _0x4d5611['request'](_0x5db4b0,_0x239b12)[_0x0a9e('0x19')](function(_0x5d0880){logger[_0x0a9e('0x1a')]('FreshsalesAccount,\x20%s,\x20%s',_0x4283ce,_0x0a9e('0x1b'));logger[_0x0a9e('0x1c')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4283ce,_0x0a9e('0x1b'),JSON['stringify'](_0x5d0880));if(_0x5d0880[_0x0a9e('0x1d')]){if(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x1f'),_0x4283ce,_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);return _0x44dcfd(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x1f'),_0x4283ce,_0x5d0880[_0x0a9e('0x1d')]['message']);return _0x281129(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);}else{logger['info'](_0x0a9e('0x1f'),_0x4283ce,'request\x20sent');_0x281129(_0x5d0880['result'][_0x0a9e('0x20')]);}})[_0x0a9e('0x21')](function(_0x38e7c4){logger[_0x0a9e('0x1d')]('FreshsalesAccount,\x20%s,\x20%s',_0x4283ce,_0x38e7c4);_0x44dcfd(_0x38e7c4);});});}function respondWithStatusCode(_0xfb6e48,_0x2fb0e4){_0x2fb0e4=_0x2fb0e4||0xcc;return function(_0x3b45bc){if(_0x3b45bc){return _0xfb6e48[_0x0a9e('0x22')](_0x2fb0e4);}return _0xfb6e48[_0x0a9e('0x23')](_0x2fb0e4)[_0x0a9e('0x24')]();};}function respondWithResult(_0x16b1ca,_0x5ea472){_0x5ea472=_0x5ea472||0xc8;return function(_0x59181e){if(_0x59181e){return _0x16b1ca[_0x0a9e('0x23')](_0x5ea472)[_0x0a9e('0x25')](_0x59181e);}};}function respondWithFilteredResult(_0x40c424,_0x33161b){return function(_0x526cf3){if(_0x526cf3){var _0x384319=typeof _0x33161b['offset']===_0x0a9e('0x26')&&typeof _0x33161b['limit']===_0x0a9e('0x26');var _0x34dc65=_0x526cf3[_0x0a9e('0x27')];var _0x14433c=_0x384319?0x0:_0x33161b[_0x0a9e('0x28')];var _0x1538a4=_0x384319?_0x526cf3[_0x0a9e('0x27')]:_0x33161b[_0x0a9e('0x28')]+_0x33161b['limit'];var _0x3652a7;if(_0x1538a4>=_0x34dc65){_0x1538a4=_0x34dc65;_0x3652a7=0xc8;}else{_0x3652a7=0xce;}_0x40c424[_0x0a9e('0x23')](_0x3652a7);return _0x40c424[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x14433c+'-'+_0x1538a4+'/'+_0x34dc65)['json'](_0x526cf3);}return null;};}function patchUpdates(_0x15b200){return function(_0x40e7a3){try{jsonpatch[_0x0a9e('0x2b')](_0x40e7a3,_0x15b200,!![]);}catch(_0x824a4f){return BPromise[_0x0a9e('0x2c')](_0x824a4f);}return _0x40e7a3[_0x0a9e('0x2d')]();};}function saveUpdates(_0x296f41,_0x2e8759){return function(_0x1dbde2){if(_0x1dbde2){return _0x1dbde2['update'](_0x296f41)[_0x0a9e('0x19')](function(_0x5d1e0e){return _0x5d1e0e;});}return null;};}function removeEntity(_0x2407f9,_0x3ae878){return function(_0x1122db){if(_0x1122db){return _0x1122db[_0x0a9e('0x2e')]()[_0x0a9e('0x19')](function(){_0x2407f9['status'](0xcc)[_0x0a9e('0x24')]();});}};}function handleEntityNotFound(_0x46f0a5,_0x40cb85){return function(_0x2da5c0){if(!_0x2da5c0){_0x46f0a5[_0x0a9e('0x22')](0x194);}return _0x2da5c0;};}function handleError(_0x409319,_0x332d35){_0x332d35=_0x332d35||0x1f4;return function(_0x39e565){logger['error'](_0x39e565[_0x0a9e('0x2f')]);if(_0x39e565['name']){delete _0x39e565[_0x0a9e('0x30')];}_0x409319[_0x0a9e('0x23')](_0x332d35)[_0x0a9e('0x31')](_0x39e565);};}function getMustacheRender(_0x3f3d41,_0x567193){return Mustache[_0x0a9e('0x32')](_0x3f3d41,_[_0x0a9e('0x33')](_0x567193[_0x0a9e('0x34')],{'contact':_0x567193[_0x0a9e('0x35')],'message':_0x567193['message'],'agent':_0x567193['agent'],'interaction':_0x567193[_0x0a9e('0x36')],'account':_0x567193['account']}))||'';}exports[_0x0a9e('0x37')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x38')](db['FreshsalesAccount'][_0x0a9e('0x39')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x3a')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x38')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x3c')]=_[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x3c')]);_0x4f41ae[_0x0a9e('0x3e')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x3c')]);_0x1ef87a[_0x0a9e('0x3f')]=_['intersection'](_0x4f41ae[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x3d9717[_0x0a9e('0x3c')]['fields']));_0x1ef87a[_0x0a9e('0x3f')]=_0x1ef87a[_0x0a9e('0x3f')][_0x0a9e('0x41')]?_0x1ef87a[_0x0a9e('0x3f')]:_0x4f41ae[_0x0a9e('0x3b')];if(!_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x0a9e('0x43'))){_0x1ef87a[_0x0a9e('0x44')]=qs[_0x0a9e('0x44')](_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x44')]);_0x1ef87a[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x3d9717[_0x0a9e('0x3c')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x45')](_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x45')]);_0x1ef87a[_0x0a9e('0x46')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x47')](_0x3d9717[_0x0a9e('0x3c')],_0x4f41ae[_0x0a9e('0x3e')]),_0x3bfce8);if(_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x48')]){_0x1ef87a[_0x0a9e('0x46')]=_[_0x0a9e('0x33')](_0x1ef87a['where'],{'$or':_[_0x0a9e('0x38')](_0x3bfce8,function(_0x138b8b){if(_0x138b8b[_0x0a9e('0x49')]!==_0x0a9e('0x4a')){var _0x2e8caf={};_0x2e8caf[_0x138b8b[_0x0a9e('0x30')]]={'$like':'%'+_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x48')]+'%'};return _0x2e8caf;}})});}_0x1ef87a=_['merge']({},_0x1ef87a,_0x3d9717[_0x0a9e('0x4b')]);var _0x48fd45={'where':_0x1ef87a[_0x0a9e('0x46')]};return db[_0x0a9e('0x4c')][_0x0a9e('0x27')](_0x48fd45)['then'](function(_0x14bec2){_0x31916f[_0x0a9e('0x27')]=_0x14bec2;if(_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x4d')]){_0x1ef87a[_0x0a9e('0x4e')]=[{'all':!![]}];}return db[_0x0a9e('0x4c')][_0x0a9e('0x4f')](_0x1ef87a);})['then'](function(_0x13f44d){_0x31916f[_0x0a9e('0x50')]=_0x13f44d;return _0x31916f;})[_0x0a9e('0x19')](respondWithFilteredResult(_0x381c37,_0x1ef87a))[_0x0a9e('0x21')](handleError(_0x381c37,null));};exports[_0x0a9e('0x51')]=function(_0x992c77,_0x6054ee){var _0x19383e={'raw':![],'where':{'id':_0x992c77['params']['id']}},_0x34febd={};_0x34febd[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](db['FreshsalesAccount']['rawAttributes']);_0x34febd['query']=_[_0x0a9e('0x3d')](_0x992c77[_0x0a9e('0x3c')]);_0x34febd[_0x0a9e('0x3e')]=_[_0x0a9e('0x52')](_0x34febd[_0x0a9e('0x3b')],_0x34febd[_0x0a9e('0x3c')]);_0x19383e[_0x0a9e('0x3f')]=_[_0x0a9e('0x52')](_0x34febd['model'],qs['fields'](_0x992c77['query'][_0x0a9e('0x40')]));_0x19383e[_0x0a9e('0x3f')]=_0x19383e[_0x0a9e('0x3f')]['length']?_0x19383e[_0x0a9e('0x3f')]:_0x34febd[_0x0a9e('0x3b')];if(_0x992c77['query']['includeAll']){_0x19383e[_0x0a9e('0x4e')]=[{'all':!![]}];}_0x19383e=_['merge']({},_0x19383e,_0x992c77[_0x0a9e('0x4b')]);return db['FreshsalesAccount'][_0x0a9e('0x53')](_0x19383e)[_0x0a9e('0x19')](handleEntityNotFound(_0x6054ee,null))[_0x0a9e('0x19')](respondWithResult(_0x6054ee,null))['catch'](handleError(_0x6054ee,null));};exports[_0x0a9e('0x54')]=function(_0x1bf38a,_0x508b47){return db['FreshsalesAccount'][_0x0a9e('0x54')](_0x1bf38a[_0x0a9e('0x34')],{})['then'](respondWithResult(_0x508b47,0xc9))[_0x0a9e('0x21')](handleError(_0x508b47,null));};exports['update']=function(_0x211ef9,_0x523cd2){if(_0x211ef9[_0x0a9e('0x34')]['id']){delete _0x211ef9['body']['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x211ef9[_0x0a9e('0x55')]['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x19')](saveUpdates(_0x211ef9[_0x0a9e('0x34')],null))[_0x0a9e('0x19')](respondWithResult(_0x523cd2,null))[_0x0a9e('0x21')](handleError(_0x523cd2,null));};exports[_0x0a9e('0x2e')]=function(_0x272738,_0xd10662){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x272738[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0xd10662,null))[_0x0a9e('0x19')](removeEntity(_0xd10662,null))[_0x0a9e('0x21')](handleError(_0xd10662,null));};exports[_0x0a9e('0x56')]=function(_0x156662,_0x5d86e9,_0x956fbe){var _0x26bc80={};var _0x5239ef={};var _0x3649cc;var _0x5cc8fb;return db[_0x0a9e('0x4c')]['findOne']({'where':{'id':_0x156662['params']['id']}})['then'](handleEntityNotFound(_0x5d86e9,null))[_0x0a9e('0x19')](function(_0x49d231){if(_0x49d231){_0x3649cc=_0x49d231;_0x5239ef[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](db[_0x0a9e('0x57')][_0x0a9e('0x39')]);_0x5239ef[_0x0a9e('0x3c')]=_[_0x0a9e('0x3d')](_0x156662['query']);_0x5239ef[_0x0a9e('0x3e')]=_['intersection'](_0x5239ef[_0x0a9e('0x3b')],_0x5239ef[_0x0a9e('0x3c')]);_0x26bc80[_0x0a9e('0x3f')]=_['intersection'](_0x5239ef[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x40')]));_0x26bc80['attributes']=_0x26bc80[_0x0a9e('0x3f')][_0x0a9e('0x41')]?_0x26bc80['attributes']:_0x5239ef[_0x0a9e('0x3b')];_0x26bc80[_0x0a9e('0x58')]=qs[_0x0a9e('0x45')](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x45')]);_0x26bc80['where']=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x47')](_0x156662[_0x0a9e('0x3c')],_0x5239ef['filters']));if(_0x156662[_0x0a9e('0x3c')]['filter']){_0x26bc80['where']=_[_0x0a9e('0x33')](_0x26bc80[_0x0a9e('0x46')],{'$or':_[_0x0a9e('0x38')](_0x26bc80[_0x0a9e('0x3f')],function(_0x186f39){var _0xc8c264={};_0xc8c264[_0x186f39]={'$like':'%'+_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x48')]+'%'};return _0xc8c264;})});}_0x26bc80=_[_0x0a9e('0x33')]({},_0x26bc80,_0x156662[_0x0a9e('0x4b')]);return _0x3649cc[_0x0a9e('0x56')](_0x26bc80);}})[_0x0a9e('0x19')](function(_0x2bbb86){if(_0x2bbb86){_0x5cc8fb=_0x2bbb86[_0x0a9e('0x41')];if(!_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x0a9e('0x43'))){_0x26bc80[_0x0a9e('0x44')]=qs['limit'](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x44')]);_0x26bc80[_0x0a9e('0x28')]=qs['offset'](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x28')]);}return _0x3649cc['getConfigurations'](_0x26bc80);}})[_0x0a9e('0x19')](function(_0x56e31e){if(_0x56e31e){return _0x56e31e?{'count':_0x5cc8fb,'rows':_0x56e31e}:null;}})[_0x0a9e('0x19')](respondWithResult(_0x5d86e9,null))[_0x0a9e('0x21')](handleError(_0x5d86e9,null));};exports[_0x0a9e('0x59')]=function(_0x4a43a8,_0x50cdce,_0x4a2438){if(_0x4a43a8[_0x0a9e('0x34')]['id']){delete _0x4a43a8[_0x0a9e('0x34')]['id'];}return db[_0x0a9e('0x4c')][_0x0a9e('0x5a')]({'where':{'id':_0x4a43a8[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x50cdce,null))[_0x0a9e('0x19')](function(_0x1a0677){if(_0x1a0677){_0x4a43a8['body'][_0x0a9e('0x5b')]=_0x1a0677['id'];_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x5c')]=integrations['getSubjects'](_0x4a43a8[_0x0a9e('0x34')]['channel'],_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x49')]);_0x4a43a8['body'][_0x0a9e('0x5d')]=integrations[_0x0a9e('0x5e')](_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x5f')],_0x4a43a8['body'][_0x0a9e('0x49')]);return db[_0x0a9e('0x57')][_0x0a9e('0x54')](_0x4a43a8[_0x0a9e('0x34')],{'include':[{'model':db['FreshsalesField'],'as':_0x0a9e('0x5c')},{'model':db[_0x0a9e('0x60')],'as':_0x0a9e('0x5d')}]});}return null;})[_0x0a9e('0x19')](respondWithResult(_0x50cdce,null))['catch'](handleError(_0x50cdce,null));};exports[_0x0a9e('0x61')]=function(_0x3511c9,_0x30a4c7,_0xf410e5){var _0x332367='';var _0xdb98ca='';return db[_0x0a9e('0x4c')][_0x0a9e('0x5a')]({'where':{'id':_0x3511c9[_0x0a9e('0x55')]['id']},'attributes':['id',_0x0a9e('0x62'),_0x0a9e('0x63'),_0x0a9e('0x64')]})[_0x0a9e('0x19')](handleEntityNotFound(_0x30a4c7,null))[_0x0a9e('0x19')](function(_0x5b35db){if(_0x5b35db){_0xdb98ca=_0x5b35db[_0x0a9e('0x62')];_0x332367=_0x5b35db[_0x0a9e('0x63')];var _0xc599b3=_0x5b35db['remoteUri'][_0x0a9e('0x65')](-0x1);if(_0xc599b3==='/'){_0x332367=_0x332367[_0x0a9e('0x66')](0x0,_0x332367[_0x0a9e('0x67')](_0xc599b3));}return rp({'method':_0x0a9e('0x68'),'uri':util['format']('%s%s',_0x332367,_0x0a9e('0x69')),'headers':{'Authorization':_0x0a9e('0x6a')+_0x5b35db['apiKey']},'json':!![]});}})[_0x0a9e('0x19')](function(_0x53a6a1){if(_0x53a6a1){var _0x260f4b=_0x53a6a1[_0x0a9e('0x6b')];var _0x5637a1=![];var _0x28a942=null;for(_0x28a942=0x0;_0x28a942<_0x260f4b[_0x0a9e('0x41')];_0x28a942++){if(_0x260f4b[_0x28a942][_0x0a9e('0x6c')]===_0xdb98ca){_0x5637a1=!![];}}if(_0x5637a1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0a9e('0x6d')});}}})[_0x0a9e('0x19')](respondWithResult(_0x30a4c7,null))[_0x0a9e('0x21')](function(_0x444f1f){var _0x482ca2=_0x3511c9[_0x0a9e('0x3c')][_0x0a9e('0x6e')]?0x1f4:_0x444f1f[_0x0a9e('0x6f')]||0x1f4;logger[_0x0a9e('0x1d')]('getFields,\x20%s,\x20%s,\x20%s',_0x0a9e('0x61'),_0x482ca2,JSON[_0x0a9e('0x70')](_0x444f1f));delete _0x444f1f['name'];if(_0x482ca2===0x191){_0x482ca2=0x190;}_0x30a4c7[_0x0a9e('0x23')](_0x482ca2)['send'](_0x3511c9[_0x0a9e('0x3c')][_0x0a9e('0x6e')]?{'message':_0x0a9e('0x71'),'statusCode':_0x444f1f[_0x0a9e('0x6f')]}:_0x444f1f);});}; \ No newline at end of file +var _0xa9e0=['merge','body','contact','interaction','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','VIRTUAL','options','FreshsalesAccount','includeAll','include','findAll','rows','show','intersection','find','create','params','getConfigurations','FreshsalesConfiguration','order','addConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','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','../../components/integrations/configuration','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','FreshsalesAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','render'];(function(_0x4adaf8,_0x5b8c48){var _0x174112=function(_0x35bdc7){while(--_0x35bdc7){_0x4adaf8['push'](_0x4adaf8['shift']());}};_0x174112(++_0x5b8c48);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var integrations=require(_0x0a9e('0x15'));var jayson=require(_0x0a9e('0x16'));var client=jayson[_0x0a9e('0x17')][_0x0a9e('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5db4b0,_0x4283ce,_0x239b12,_0x2b4227){return new BPromise(function(_0x281129,_0x44dcfd){var _0x4d5611=_0x2b4227||client;return _0x4d5611['request'](_0x5db4b0,_0x239b12)[_0x0a9e('0x19')](function(_0x5d0880){logger[_0x0a9e('0x1a')]('FreshsalesAccount,\x20%s,\x20%s',_0x4283ce,_0x0a9e('0x1b'));logger[_0x0a9e('0x1c')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4283ce,_0x0a9e('0x1b'),JSON['stringify'](_0x5d0880));if(_0x5d0880[_0x0a9e('0x1d')]){if(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x1f'),_0x4283ce,_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);return _0x44dcfd(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x1f'),_0x4283ce,_0x5d0880[_0x0a9e('0x1d')]['message']);return _0x281129(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);}else{logger['info'](_0x0a9e('0x1f'),_0x4283ce,'request\x20sent');_0x281129(_0x5d0880['result'][_0x0a9e('0x20')]);}})[_0x0a9e('0x21')](function(_0x38e7c4){logger[_0x0a9e('0x1d')]('FreshsalesAccount,\x20%s,\x20%s',_0x4283ce,_0x38e7c4);_0x44dcfd(_0x38e7c4);});});}function respondWithStatusCode(_0xfb6e48,_0x2fb0e4){_0x2fb0e4=_0x2fb0e4||0xcc;return function(_0x3b45bc){if(_0x3b45bc){return _0xfb6e48[_0x0a9e('0x22')](_0x2fb0e4);}return _0xfb6e48[_0x0a9e('0x23')](_0x2fb0e4)[_0x0a9e('0x24')]();};}function respondWithResult(_0x16b1ca,_0x5ea472){_0x5ea472=_0x5ea472||0xc8;return function(_0x59181e){if(_0x59181e){return _0x16b1ca[_0x0a9e('0x23')](_0x5ea472)[_0x0a9e('0x25')](_0x59181e);}};}function respondWithFilteredResult(_0x40c424,_0x33161b){return function(_0x526cf3){if(_0x526cf3){var _0x384319=typeof _0x33161b['offset']===_0x0a9e('0x26')&&typeof _0x33161b['limit']===_0x0a9e('0x26');var _0x34dc65=_0x526cf3[_0x0a9e('0x27')];var _0x14433c=_0x384319?0x0:_0x33161b[_0x0a9e('0x28')];var _0x1538a4=_0x384319?_0x526cf3[_0x0a9e('0x27')]:_0x33161b[_0x0a9e('0x28')]+_0x33161b['limit'];var _0x3652a7;if(_0x1538a4>=_0x34dc65){_0x1538a4=_0x34dc65;_0x3652a7=0xc8;}else{_0x3652a7=0xce;}_0x40c424[_0x0a9e('0x23')](_0x3652a7);return _0x40c424[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x14433c+'-'+_0x1538a4+'/'+_0x34dc65)['json'](_0x526cf3);}return null;};}function patchUpdates(_0x15b200){return function(_0x40e7a3){try{jsonpatch[_0x0a9e('0x2b')](_0x40e7a3,_0x15b200,!![]);}catch(_0x824a4f){return BPromise[_0x0a9e('0x2c')](_0x824a4f);}return _0x40e7a3[_0x0a9e('0x2d')]();};}function saveUpdates(_0x296f41,_0x2e8759){return function(_0x1dbde2){if(_0x1dbde2){return _0x1dbde2['update'](_0x296f41)[_0x0a9e('0x19')](function(_0x5d1e0e){return _0x5d1e0e;});}return null;};}function removeEntity(_0x2407f9,_0x3ae878){return function(_0x1122db){if(_0x1122db){return _0x1122db[_0x0a9e('0x2e')]()[_0x0a9e('0x19')](function(){_0x2407f9['status'](0xcc)[_0x0a9e('0x24')]();});}};}function handleEntityNotFound(_0x46f0a5,_0x40cb85){return function(_0x2da5c0){if(!_0x2da5c0){_0x46f0a5[_0x0a9e('0x22')](0x194);}return _0x2da5c0;};}function handleError(_0x409319,_0x332d35){_0x332d35=_0x332d35||0x1f4;return function(_0x39e565){logger['error'](_0x39e565[_0x0a9e('0x2f')]);if(_0x39e565['name']){delete _0x39e565[_0x0a9e('0x30')];}_0x409319[_0x0a9e('0x23')](_0x332d35)[_0x0a9e('0x31')](_0x39e565);};}function getMustacheRender(_0x3f3d41,_0x567193){return Mustache[_0x0a9e('0x32')](_0x3f3d41,_[_0x0a9e('0x33')](_0x567193[_0x0a9e('0x34')],{'contact':_0x567193[_0x0a9e('0x35')],'message':_0x567193['message'],'agent':_0x567193['agent'],'interaction':_0x567193[_0x0a9e('0x36')],'account':_0x567193['account']}))||'';}exports[_0x0a9e('0x37')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x38')](db['FreshsalesAccount'][_0x0a9e('0x39')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x3a')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x38')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x3c')]=_[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x3c')]);_0x4f41ae[_0x0a9e('0x3e')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x3c')]);_0x1ef87a[_0x0a9e('0x3f')]=_['intersection'](_0x4f41ae[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x3d9717[_0x0a9e('0x3c')]['fields']));_0x1ef87a[_0x0a9e('0x3f')]=_0x1ef87a[_0x0a9e('0x3f')][_0x0a9e('0x41')]?_0x1ef87a[_0x0a9e('0x3f')]:_0x4f41ae[_0x0a9e('0x3b')];if(!_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x0a9e('0x43'))){_0x1ef87a[_0x0a9e('0x44')]=qs[_0x0a9e('0x44')](_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x44')]);_0x1ef87a[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x3d9717[_0x0a9e('0x3c')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x45')](_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x45')]);_0x1ef87a[_0x0a9e('0x46')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x47')](_0x3d9717[_0x0a9e('0x3c')],_0x4f41ae[_0x0a9e('0x3e')]),_0x3bfce8);if(_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x48')]){_0x1ef87a[_0x0a9e('0x46')]=_[_0x0a9e('0x33')](_0x1ef87a['where'],{'$or':_[_0x0a9e('0x38')](_0x3bfce8,function(_0x138b8b){if(_0x138b8b[_0x0a9e('0x49')]!==_0x0a9e('0x4a')){var _0x2e8caf={};_0x2e8caf[_0x138b8b[_0x0a9e('0x30')]]={'$like':'%'+_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x48')]+'%'};return _0x2e8caf;}})});}_0x1ef87a=_['merge']({},_0x1ef87a,_0x3d9717[_0x0a9e('0x4b')]);var _0x48fd45={'where':_0x1ef87a[_0x0a9e('0x46')]};return db[_0x0a9e('0x4c')][_0x0a9e('0x27')](_0x48fd45)['then'](function(_0x14bec2){_0x31916f[_0x0a9e('0x27')]=_0x14bec2;if(_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x4d')]){_0x1ef87a[_0x0a9e('0x4e')]=[{'all':!![]}];}return db[_0x0a9e('0x4c')][_0x0a9e('0x4f')](_0x1ef87a);})['then'](function(_0x13f44d){_0x31916f[_0x0a9e('0x50')]=_0x13f44d;return _0x31916f;})[_0x0a9e('0x19')](respondWithFilteredResult(_0x381c37,_0x1ef87a))[_0x0a9e('0x21')](handleError(_0x381c37,null));};exports[_0x0a9e('0x51')]=function(_0x992c77,_0x6054ee){var _0x19383e={'raw':![],'where':{'id':_0x992c77['params']['id']}},_0x34febd={};_0x34febd[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](db['FreshsalesAccount']['rawAttributes']);_0x34febd['query']=_[_0x0a9e('0x3d')](_0x992c77[_0x0a9e('0x3c')]);_0x34febd[_0x0a9e('0x3e')]=_[_0x0a9e('0x52')](_0x34febd[_0x0a9e('0x3b')],_0x34febd[_0x0a9e('0x3c')]);_0x19383e[_0x0a9e('0x3f')]=_[_0x0a9e('0x52')](_0x34febd['model'],qs['fields'](_0x992c77['query'][_0x0a9e('0x40')]));_0x19383e[_0x0a9e('0x3f')]=_0x19383e[_0x0a9e('0x3f')]['length']?_0x19383e[_0x0a9e('0x3f')]:_0x34febd[_0x0a9e('0x3b')];if(_0x992c77['query']['includeAll']){_0x19383e[_0x0a9e('0x4e')]=[{'all':!![]}];}_0x19383e=_['merge']({},_0x19383e,_0x992c77[_0x0a9e('0x4b')]);return db['FreshsalesAccount'][_0x0a9e('0x53')](_0x19383e)[_0x0a9e('0x19')](handleEntityNotFound(_0x6054ee,null))[_0x0a9e('0x19')](respondWithResult(_0x6054ee,null))['catch'](handleError(_0x6054ee,null));};exports[_0x0a9e('0x54')]=function(_0x1bf38a,_0x508b47){return db['FreshsalesAccount'][_0x0a9e('0x54')](_0x1bf38a[_0x0a9e('0x34')],{})['then'](respondWithResult(_0x508b47,0xc9))[_0x0a9e('0x21')](handleError(_0x508b47,null));};exports['update']=function(_0x211ef9,_0x523cd2){if(_0x211ef9[_0x0a9e('0x34')]['id']){delete _0x211ef9['body']['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x211ef9[_0x0a9e('0x55')]['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x19')](saveUpdates(_0x211ef9[_0x0a9e('0x34')],null))[_0x0a9e('0x19')](respondWithResult(_0x523cd2,null))[_0x0a9e('0x21')](handleError(_0x523cd2,null));};exports[_0x0a9e('0x2e')]=function(_0x272738,_0xd10662){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x272738[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0xd10662,null))[_0x0a9e('0x19')](removeEntity(_0xd10662,null))[_0x0a9e('0x21')](handleError(_0xd10662,null));};exports[_0x0a9e('0x56')]=function(_0x156662,_0x5d86e9,_0x956fbe){var _0x26bc80={};var _0x5239ef={};var _0x3649cc;var _0x5cc8fb;return db[_0x0a9e('0x4c')]['findOne']({'where':{'id':_0x156662['params']['id']}})['then'](handleEntityNotFound(_0x5d86e9,null))[_0x0a9e('0x19')](function(_0x49d231){if(_0x49d231){_0x3649cc=_0x49d231;_0x5239ef[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](db[_0x0a9e('0x57')][_0x0a9e('0x39')]);_0x5239ef[_0x0a9e('0x3c')]=_[_0x0a9e('0x3d')](_0x156662['query']);_0x5239ef[_0x0a9e('0x3e')]=_['intersection'](_0x5239ef[_0x0a9e('0x3b')],_0x5239ef[_0x0a9e('0x3c')]);_0x26bc80[_0x0a9e('0x3f')]=_['intersection'](_0x5239ef[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x40')]));_0x26bc80['attributes']=_0x26bc80[_0x0a9e('0x3f')][_0x0a9e('0x41')]?_0x26bc80['attributes']:_0x5239ef[_0x0a9e('0x3b')];_0x26bc80[_0x0a9e('0x58')]=qs[_0x0a9e('0x45')](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x45')]);_0x26bc80['where']=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x47')](_0x156662[_0x0a9e('0x3c')],_0x5239ef['filters']));if(_0x156662[_0x0a9e('0x3c')]['filter']){_0x26bc80['where']=_[_0x0a9e('0x33')](_0x26bc80[_0x0a9e('0x46')],{'$or':_[_0x0a9e('0x38')](_0x26bc80[_0x0a9e('0x3f')],function(_0x186f39){var _0xc8c264={};_0xc8c264[_0x186f39]={'$like':'%'+_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x48')]+'%'};return _0xc8c264;})});}_0x26bc80=_[_0x0a9e('0x33')]({},_0x26bc80,_0x156662[_0x0a9e('0x4b')]);return _0x3649cc[_0x0a9e('0x56')](_0x26bc80);}})[_0x0a9e('0x19')](function(_0x2bbb86){if(_0x2bbb86){_0x5cc8fb=_0x2bbb86[_0x0a9e('0x41')];if(!_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x0a9e('0x43'))){_0x26bc80[_0x0a9e('0x44')]=qs['limit'](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x44')]);_0x26bc80[_0x0a9e('0x28')]=qs['offset'](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x28')]);}return _0x3649cc['getConfigurations'](_0x26bc80);}})[_0x0a9e('0x19')](function(_0x56e31e){if(_0x56e31e){return _0x56e31e?{'count':_0x5cc8fb,'rows':_0x56e31e}:null;}})[_0x0a9e('0x19')](respondWithResult(_0x5d86e9,null))[_0x0a9e('0x21')](handleError(_0x5d86e9,null));};exports[_0x0a9e('0x59')]=function(_0x4a43a8,_0x50cdce,_0x4a2438){if(_0x4a43a8[_0x0a9e('0x34')]['id']){delete _0x4a43a8[_0x0a9e('0x34')]['id'];}return db[_0x0a9e('0x4c')][_0x0a9e('0x5a')]({'where':{'id':_0x4a43a8[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x50cdce,null))[_0x0a9e('0x19')](function(_0x1a0677){if(_0x1a0677){_0x4a43a8['body'][_0x0a9e('0x5b')]=_0x1a0677['id'];_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x5c')]=integrations['getSubjects'](_0x4a43a8[_0x0a9e('0x34')]['channel'],_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x49')]);_0x4a43a8['body'][_0x0a9e('0x5d')]=integrations[_0x0a9e('0x5e')](_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x5f')],_0x4a43a8['body'][_0x0a9e('0x49')]);return db[_0x0a9e('0x57')][_0x0a9e('0x54')](_0x4a43a8[_0x0a9e('0x34')],{'include':[{'model':db['FreshsalesField'],'as':_0x0a9e('0x5c')},{'model':db[_0x0a9e('0x60')],'as':_0x0a9e('0x5d')}]});}return null;})[_0x0a9e('0x19')](respondWithResult(_0x50cdce,null))['catch'](handleError(_0x50cdce,null));};exports[_0x0a9e('0x61')]=function(_0x3511c9,_0x30a4c7,_0xf410e5){var _0x332367='';var _0xdb98ca='';return db[_0x0a9e('0x4c')][_0x0a9e('0x5a')]({'where':{'id':_0x3511c9[_0x0a9e('0x55')]['id']},'attributes':['id',_0x0a9e('0x62'),_0x0a9e('0x63'),_0x0a9e('0x64')]})[_0x0a9e('0x19')](handleEntityNotFound(_0x30a4c7,null))[_0x0a9e('0x19')](function(_0x5b35db){if(_0x5b35db){_0xdb98ca=_0x5b35db[_0x0a9e('0x62')];_0x332367=_0x5b35db[_0x0a9e('0x63')];var _0xc599b3=_0x5b35db['remoteUri'][_0x0a9e('0x65')](-0x1);if(_0xc599b3==='/'){_0x332367=_0x332367[_0x0a9e('0x66')](0x0,_0x332367[_0x0a9e('0x67')](_0xc599b3));}return rp({'method':_0x0a9e('0x68'),'uri':util['format']('%s%s',_0x332367,_0x0a9e('0x69')),'headers':{'Authorization':_0x0a9e('0x6a')+_0x5b35db['apiKey']},'json':!![]});}})[_0x0a9e('0x19')](function(_0x53a6a1){if(_0x53a6a1){var _0x260f4b=_0x53a6a1[_0x0a9e('0x6b')];var _0x5637a1=![];var _0x28a942=null;for(_0x28a942=0x0;_0x28a942<_0x260f4b[_0x0a9e('0x41')];_0x28a942++){if(_0x260f4b[_0x28a942][_0x0a9e('0x6c')]===_0xdb98ca){_0x5637a1=!![];}}if(_0x5637a1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0a9e('0x6d')});}}})[_0x0a9e('0x19')](respondWithResult(_0x30a4c7,null))[_0x0a9e('0x21')](function(_0x444f1f){var _0x482ca2=_0x3511c9[_0x0a9e('0x3c')][_0x0a9e('0x6e')]?0x1f4:_0x444f1f[_0x0a9e('0x6f')]||0x1f4;logger[_0x0a9e('0x1d')]('getFields,\x20%s,\x20%s,\x20%s',_0x0a9e('0x61'),_0x482ca2,JSON[_0x0a9e('0x70')](_0x444f1f));delete _0x444f1f['name'];if(_0x482ca2===0x191){_0x482ca2=0x190;}_0x30a4c7[_0x0a9e('0x23')](_0x482ca2)['send'](_0x3511c9[_0x0a9e('0x3c')][_0x0a9e('0x6e')]?{'message':_0x0a9e('0x71'),'statusCode':_0x444f1f[_0x0a9e('0x6f')]}:_0x444f1f);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index ff135ec..5a80d80 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 _0x341c=['request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','moment','bluebird'];(function(_0x377f50,_0x5589ba){var _0x14a9d2=function(_0x4ab38b){while(--_0x4ab38b){_0x377f50['push'](_0x377f50['shift']());}};_0x14a9d2(++_0x5589ba);}(_0x341c,0xcc));var _0xc341=function(_0x4812c9,_0x154b76){_0x4812c9=_0x4812c9-0x0;var _0x4de61f=_0x341c[_0x4812c9];return _0x4de61f;};'use strict';var _=require(_0xc341('0x0'));var util=require('util');var logger=require(_0xc341('0x1'))('api');var moment=require(_0xc341('0x2'));var BPromise=require(_0xc341('0x3'));var rp=require(_0xc341('0x4'));var fs=require('fs');var path=require(_0xc341('0x5'));var rimraf=require(_0xc341('0x6'));var config=require(_0xc341('0x7'));var attributes=require(_0xc341('0x8'));var integrations=require(_0xc341('0x9'));module['exports']=function(_0xf9fe84,_0x13c5b4){return _0xf9fe84[_0xc341('0xa')](_0xc341('0xb'),attributes,{'tableName':_0xc341('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe60=['../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xbe60,0x1d4));var _0x0be6=function(_0x16e9a0,_0x467200){_0x16e9a0=_0x16e9a0-0x0;var _0x220ddb=_0xbe60[_0x16e9a0];return _0x220ddb;};'use strict';var _=require(_0x0be6('0x0'));var util=require(_0x0be6('0x1'));var logger=require(_0x0be6('0x2'))(_0x0be6('0x3'));var moment=require(_0x0be6('0x4'));var BPromise=require('bluebird');var rp=require(_0x0be6('0x5'));var fs=require('fs');var path=require(_0x0be6('0x6'));var rimraf=require(_0x0be6('0x7'));var config=require(_0x0be6('0x8'));var attributes=require(_0x0be6('0x9'));var integrations=require(_0x0be6('0xa'));module[_0x0be6('0xb')]=function(_0x68ad28,_0x14f46e){return _0x68ad28[_0x0be6('0xc')](_0x0be6('0xd'),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 bef43bf..c7689f7 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 _0x0570=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','findAll','options','raw','where','attributes','limit','map','model','include','GetFreshsalesAccount','catch','ShowFreshsalesAccount','FreshsalesAccount','find','util','moment','bluebird','ioredis'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x0570,0x172));var _0x0057=function(_0x3c0823,_0x3a50bb){_0x3c0823=_0x3c0823-0x0;var _0x3d9905=_0x0570[_0x3c0823];return _0x3d9905;};'use strict';var _=require('lodash');var util=require(_0x0057('0x0'));var moment=require(_0x0057('0x1'));var BPromise=require(_0x0057('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0057('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0057('0x4'));var logger=require('../../config/logger')(_0x0057('0x5'));var config=require(_0x0057('0x6'));var jayson=require(_0x0057('0x7'));var client=jayson[_0x0057('0x8')][_0x0057('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5096e2,_0xc86734,_0x529f55){return new BPromise(function(_0x15d424,_0x2f9d7f){return client[_0x0057('0xa')](_0x5096e2,_0x529f55)[_0x0057('0xb')](function(_0x29b7c6){logger['info'](_0x0057('0xc'),_0xc86734,_0x0057('0xd'));logger[_0x0057('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0xc86734,_0x0057('0xd'),JSON[_0x0057('0xf')](_0x29b7c6));if(_0x29b7c6['error']){if(_0x29b7c6['error'][_0x0057('0x10')]===0x1f4){logger[_0x0057('0x11')](_0x0057('0xc'),_0xc86734,_0x29b7c6['error'][_0x0057('0x12')]);return _0x2f9d7f(_0x29b7c6[_0x0057('0x11')][_0x0057('0x12')]);}logger[_0x0057('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0xc86734,_0x29b7c6[_0x0057('0x11')][_0x0057('0x12')]);return _0x15d424(_0x29b7c6['error'][_0x0057('0x12')]);}else{logger[_0x0057('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0xc86734,_0x0057('0xd'));_0x15d424(_0x29b7c6['result'][_0x0057('0x12')]);}})['catch'](function(_0x4be851){logger[_0x0057('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0xc86734,_0x4be851);_0x2f9d7f(_0x4be851);});});}exports['GetFreshsalesAccount']=function(_0x3644fa){var _0x3f64ec=this;return new Promise(function(_0x5f3919,_0x1b7886){return db['FreshsalesAccount'][_0x0057('0x14')]({'raw':_0x3644fa[_0x0057('0x15')]?_0x3644fa[_0x0057('0x15')][_0x0057('0x16')]===undefined?!![]:![]:!![],'where':_0x3644fa[_0x0057('0x15')]?_0x3644fa[_0x0057('0x15')][_0x0057('0x17')]||null:null,'attributes':_0x3644fa[_0x0057('0x15')]?_0x3644fa[_0x0057('0x15')][_0x0057('0x18')]||null:null,'limit':_0x3644fa[_0x0057('0x15')]?_0x3644fa[_0x0057('0x15')][_0x0057('0x19')]||null:null,'include':_0x3644fa[_0x0057('0x15')]?_0x3644fa[_0x0057('0x15')]['include']?_[_0x0057('0x1a')](_0x3644fa[_0x0057('0x15')]['include'],function(_0x620fcc){return{'model':db[_0x620fcc[_0x0057('0x1b')]],'as':_0x620fcc['as'],'attributes':_0x620fcc['attributes'],'include':_0x620fcc[_0x0057('0x1c')]?_[_0x0057('0x1a')](_0x620fcc[_0x0057('0x1c')],function(_0x5cbae2){return{'model':db[_0x5cbae2['model']],'as':_0x5cbae2['as'],'attributes':_0x5cbae2[_0x0057('0x18')],'include':_0x5cbae2[_0x0057('0x1c')]?_[_0x0057('0x1a')](_0x5cbae2[_0x0057('0x1c')],function(_0xb26a41){return{'model':db[_0xb26a41[_0x0057('0x1b')]],'as':_0xb26a41['as'],'attributes':_0xb26a41['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cc3e0){logger[_0x0057('0x13')](_0x0057('0x1d'),_0x3644fa);logger[_0x0057('0xe')]('GetFreshsalesAccount',_0x3644fa,JSON[_0x0057('0xf')](_0x5cc3e0));_0x5f3919(_0x5cc3e0);})[_0x0057('0x1e')](function(_0x1e38e2){logger[_0x0057('0x11')]('GetFreshsalesAccount',_0x1e38e2['message'],_0x3644fa);_0x1b7886(_0x3f64ec[_0x0057('0x11')](0x1f4,_0x1e38e2['message']));});});};exports[_0x0057('0x1f')]=function(_0x2acb91){var _0x3475a5=this;return new Promise(function(_0x28ca74,_0x3914dd){return db[_0x0057('0x20')][_0x0057('0x21')]({'raw':_0x2acb91[_0x0057('0x15')]?_0x2acb91['options'][_0x0057('0x16')]===undefined?!![]:![]:!![],'where':_0x2acb91['options']?_0x2acb91[_0x0057('0x15')]['where']||null:null,'attributes':_0x2acb91['options']?_0x2acb91[_0x0057('0x15')][_0x0057('0x18')]||null:null,'include':_0x2acb91[_0x0057('0x15')]?_0x2acb91[_0x0057('0x15')]['include']?_[_0x0057('0x1a')](_0x2acb91[_0x0057('0x15')][_0x0057('0x1c')],function(_0xabf6e6){return{'model':db[_0xabf6e6[_0x0057('0x1b')]],'as':_0xabf6e6['as'],'attributes':_0xabf6e6[_0x0057('0x18')],'include':_0xabf6e6['include']?_[_0x0057('0x1a')](_0xabf6e6['include'],function(_0x2d8ac8){return{'model':db[_0x2d8ac8[_0x0057('0x1b')]],'as':_0x2d8ac8['as'],'attributes':_0x2d8ac8[_0x0057('0x18')],'include':_0x2d8ac8['include']?_[_0x0057('0x1a')](_0x2d8ac8['include'],function(_0x4dd3b1){return{'model':db[_0x4dd3b1[_0x0057('0x1b')]],'as':_0x4dd3b1['as'],'attributes':_0x4dd3b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x0057('0xb')](function(_0x237c5e){logger['info'](_0x0057('0x1f'),_0x2acb91);logger['debug'](_0x0057('0x1f'),_0x2acb91,JSON[_0x0057('0xf')](_0x237c5e));_0x28ca74(_0x237c5e);})[_0x0057('0x1e')](function(_0x171ea8){logger[_0x0057('0x11')]('ShowFreshsalesAccount',_0x171ea8[_0x0057('0x12')],_0x2acb91);_0x3914dd(_0x3475a5[_0x0057('0x11')](0x1f4,_0x171ea8[_0x0057('0x12')]));});});}; \ No newline at end of file +var _0x2aa3=['jayson/promise','http','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','FreshsalesAccount,\x20%s,\x20%s','message','catch','options','raw','where','attributes','limit','include','map','model','GetFreshsalesAccount','stringify','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x281d47,_0x44992b){var _0x3113ed=function(_0x5591fd){while(--_0x5591fd){_0x281d47['push'](_0x281d47['shift']());}};_0x3113ed(++_0x44992b);}(_0x2aa3,0x83));var _0x32aa=function(_0x550bd6,_0x1475ea){_0x550bd6=_0x550bd6-0x0;var _0x20790c=_0x2aa3[_0x550bd6];return _0x20790c;};'use strict';var _=require(_0x32aa('0x0'));var util=require(_0x32aa('0x1'));var moment=require(_0x32aa('0x2'));var BPromise=require(_0x32aa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32aa('0x4'))['db'];var utils=require(_0x32aa('0x5'));var logger=require(_0x32aa('0x6'))(_0x32aa('0x7'));var config=require(_0x32aa('0x8'));var jayson=require(_0x32aa('0x9'));var client=jayson['client'][_0x32aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x112396,_0x3ee18a,_0x20efbe){return new BPromise(function(_0x18ded0,_0x40c96a){return client[_0x32aa('0xb')](_0x112396,_0x20efbe)[_0x32aa('0xc')](function(_0x5d280e){logger[_0x32aa('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x3ee18a,_0x32aa('0xe'));logger[_0x32aa('0xf')](_0x32aa('0x10'),_0x3ee18a,_0x32aa('0xe'),JSON['stringify'](_0x5d280e));if(_0x5d280e[_0x32aa('0x11')]){if(_0x5d280e[_0x32aa('0x11')][_0x32aa('0x12')]===0x1f4){logger['error'](_0x32aa('0x13'),_0x3ee18a,_0x5d280e[_0x32aa('0x11')][_0x32aa('0x14')]);return _0x40c96a(_0x5d280e[_0x32aa('0x11')][_0x32aa('0x14')]);}logger[_0x32aa('0x11')](_0x32aa('0x13'),_0x3ee18a,_0x5d280e[_0x32aa('0x11')]['message']);return _0x18ded0(_0x5d280e[_0x32aa('0x11')][_0x32aa('0x14')]);}else{logger[_0x32aa('0xd')](_0x32aa('0x13'),_0x3ee18a,_0x32aa('0xe'));_0x18ded0(_0x5d280e['result'][_0x32aa('0x14')]);}})[_0x32aa('0x15')](function(_0x463b91){logger[_0x32aa('0x11')](_0x32aa('0x13'),_0x3ee18a,_0x463b91);_0x40c96a(_0x463b91);});});}exports['GetFreshsalesAccount']=function(_0x5196c0){var _0x3e0a23=this;return new Promise(function(_0x34dcaf,_0x257be0){return db['FreshsalesAccount']['findAll']({'raw':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x17')]===undefined?!![]:![]:!![],'where':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x18')]||null:null,'attributes':_0x5196c0['options']?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x19')]||null:null,'limit':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x1a')]||null:null,'include':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0x5196c0['options'][_0x32aa('0x1b')],function(_0x5c82d2){return{'model':db[_0x5c82d2[_0x32aa('0x1d')]],'as':_0x5c82d2['as'],'attributes':_0x5c82d2[_0x32aa('0x19')],'include':_0x5c82d2['include']?_['map'](_0x5c82d2[_0x32aa('0x1b')],function(_0x313930){return{'model':db[_0x313930[_0x32aa('0x1d')]],'as':_0x313930['as'],'attributes':_0x313930[_0x32aa('0x19')],'include':_0x313930[_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0x313930[_0x32aa('0x1b')],function(_0x405b03){return{'model':db[_0x405b03[_0x32aa('0x1d')]],'as':_0x405b03['as'],'attributes':_0x405b03['attributes']};}):[]};}):[]};}):[]:[]})[_0x32aa('0xc')](function(_0x2e3a5d){logger['info'](_0x32aa('0x1e'),_0x5196c0);logger['debug']('GetFreshsalesAccount',_0x5196c0,JSON[_0x32aa('0x1f')](_0x2e3a5d));_0x34dcaf(_0x2e3a5d);})[_0x32aa('0x15')](function(_0x1d1c80){logger[_0x32aa('0x11')]('GetFreshsalesAccount',_0x1d1c80[_0x32aa('0x14')],_0x5196c0);_0x257be0(_0x3e0a23[_0x32aa('0x11')](0x1f4,_0x1d1c80[_0x32aa('0x14')]));});});};exports[_0x32aa('0x20')]=function(_0x19efc6){var _0x44887c=this;return new Promise(function(_0x4b0d5a,_0x5b410f){return db[_0x32aa('0x21')][_0x32aa('0x22')]({'raw':_0x19efc6[_0x32aa('0x16')]?_0x19efc6[_0x32aa('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x19efc6['options']?_0x19efc6[_0x32aa('0x16')]['where']||null:null,'attributes':_0x19efc6[_0x32aa('0x16')]?_0x19efc6[_0x32aa('0x16')]['attributes']||null:null,'include':_0x19efc6[_0x32aa('0x16')]?_0x19efc6[_0x32aa('0x16')]['include']?_[_0x32aa('0x1c')](_0x19efc6[_0x32aa('0x16')][_0x32aa('0x1b')],function(_0xd23473){return{'model':db[_0xd23473[_0x32aa('0x1d')]],'as':_0xd23473['as'],'attributes':_0xd23473[_0x32aa('0x19')],'include':_0xd23473[_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0xd23473[_0x32aa('0x1b')],function(_0x2a2f9d){return{'model':db[_0x2a2f9d[_0x32aa('0x1d')]],'as':_0x2a2f9d['as'],'attributes':_0x2a2f9d[_0x32aa('0x19')],'include':_0x2a2f9d[_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0x2a2f9d['include'],function(_0x5b0fe2){return{'model':db[_0x5b0fe2[_0x32aa('0x1d')]],'as':_0x5b0fe2['as'],'attributes':_0x5b0fe2[_0x32aa('0x19')]};}):[]};}):[]};}):[]:[]})[_0x32aa('0xc')](function(_0x193d10){logger['info'](_0x32aa('0x20'),_0x19efc6);logger[_0x32aa('0xf')](_0x32aa('0x20'),_0x19efc6,JSON[_0x32aa('0x1f')](_0x193d10));_0x4b0d5a(_0x193d10);})[_0x32aa('0x15')](function(_0xa48198){logger[_0x32aa('0x11')](_0x32aa('0x20'),_0xa48198[_0x32aa('0x14')],_0x19efc6);_0x5b410f(_0x44887c[_0x32aa('0x11')](0x1f4,_0xa48198[_0x32aa('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index dd4a05b..2f53797 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 _0xef92=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSubjects','getDescriptions','getFields','post','create','update','delete','destroy','exports'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0xef92,0xf2));var _0x2ef9=function(_0x292c7a,_0x13ea33){_0x292c7a=_0x292c7a-0x0;var _0x55ec4d=_0xef92[_0x292c7a];return _0x55ec4d;};'use strict';var multer=require(_0x2ef9('0x0'));var util=require(_0x2ef9('0x1'));var path=require(_0x2ef9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2ef9('0x3')]();var fs_extra=require(_0x2ef9('0x4'));var auth=require(_0x2ef9('0x5'));var interaction=require(_0x2ef9('0x6'));var config=require(_0x2ef9('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x2ef9('0x8')]('/',auth[_0x2ef9('0x9')](),controller[_0x2ef9('0xa')]);router[_0x2ef9('0x8')](_0x2ef9('0xb'),auth['isAuthenticated'](),controller[_0x2ef9('0xc')]);router['get']('/:id/subjects',auth[_0x2ef9('0x9')](),controller[_0x2ef9('0xd')]);router[_0x2ef9('0x8')]('/:id/descriptions',auth[_0x2ef9('0x9')](),controller[_0x2ef9('0xe')]);router[_0x2ef9('0x8')]('/:id/fields',auth[_0x2ef9('0x9')](),controller[_0x2ef9('0xf')]);router[_0x2ef9('0x10')]('/',auth[_0x2ef9('0x9')](),controller[_0x2ef9('0x11')]);router['put']('/:id',auth[_0x2ef9('0x9')](),controller[_0x2ef9('0x12')]);router[_0x2ef9('0x13')](_0x2ef9('0xb'),auth[_0x2ef9('0x9')](),controller[_0x2ef9('0x14')]);module[_0x2ef9('0x15')]=router; \ No newline at end of file +var _0x78b2=['getSubjects','getDescriptions','/:id/fields','getFields','post','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/subjects'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x78b2,0x143));var _0x278b=function(_0x5baa9d,_0x58a3e3){_0x5baa9d=_0x5baa9d-0x0;var _0x215a1d=_0x78b2[_0x5baa9d];return _0x215a1d;};'use strict';var multer=require(_0x278b('0x0'));var util=require(_0x278b('0x1'));var path=require('path');var timeout=require(_0x278b('0x2'));var express=require(_0x278b('0x3'));var router=express[_0x278b('0x4')]();var fs_extra=require(_0x278b('0x5'));var auth=require(_0x278b('0x6'));var interaction=require(_0x278b('0x7'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0x278b('0x8')]('/',auth[_0x278b('0x9')](),controller[_0x278b('0xa')]);router[_0x278b('0x8')](_0x278b('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x278b('0xc'),auth[_0x278b('0x9')](),controller[_0x278b('0xd')]);router[_0x278b('0x8')]('/:id/descriptions',auth[_0x278b('0x9')](),controller[_0x278b('0xe')]);router['get'](_0x278b('0xf'),auth['isAuthenticated'](),controller[_0x278b('0x10')]);router[_0x278b('0x11')]('/',auth[_0x278b('0x9')](),controller['create']);router[_0x278b('0x12')](_0x278b('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x278b('0xb'),auth[_0x278b('0x9')](),controller[_0x278b('0x13')]);module[_0x278b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 23f35b1..98f763e 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 _0x47b9=['STRING','sequelize','exports'];(function(_0x1a03fb,_0x3b9f5d){var _0x3d769d=function(_0x3871d3){while(--_0x3871d3){_0x1a03fb['push'](_0x1a03fb['shift']());}};_0x3d769d(++_0x3b9f5d);}(_0x47b9,0xa0));var _0x947b=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0x47b9[_0x438fe1];return _0x3c8e1b;};'use strict';var Sequelize=require(_0x947b('0x0'));module[_0x947b('0x1')]={'name':{'type':Sequelize[_0x947b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe595=['sequelize','exports','STRING'];(function(_0xc0cfa7,_0xf2ef30){var _0xb5bbfc=function(_0xb3f2bc){while(--_0xb3f2bc){_0xc0cfa7['push'](_0xc0cfa7['shift']());}};_0xb5bbfc(++_0xf2ef30);}(_0xe595,0x153));var _0x5e59=function(_0x1552aa,_0x4fbfef){_0x1552aa=_0x1552aa-0x0;var _0x5e1e4d=_0xe595[_0x1552aa];return _0x5e1e4d;};'use strict';var Sequelize=require(_0x5e59('0x0'));module[_0x5e59('0x1')]={'name':{'type':Sequelize[_0x5e59('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 6e6282d..5e32456 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 _0xd825=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','json','offset','undefined','count','apply','reject','save','destroy','sendStatus','stack','name','send','render','merge','contact','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','update','getSubjects','findOne','FreshsalesField','filter','getDescriptions','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x407231,_0x8280c8){var _0x2f7706=function(_0x5e71ab){while(--_0x5e71ab){_0x407231['push'](_0x407231['shift']());}};_0x2f7706(++_0x8280c8);}(_0xd825,0x1c5));var _0x5d82=function(_0x230ec6,_0x1ac3f0){_0x230ec6=_0x230ec6-0x0;var _0x37a0b3=_0xd825[_0x230ec6];return _0x37a0b3;};'use strict';var emlformat=require(_0x5d82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d82('0x1'));var jsonpatch=require(_0x5d82('0x2'));var rp=require(_0x5d82('0x3'));var moment=require(_0x5d82('0x4'));var BPromise=require(_0x5d82('0x5'));var Mustache=require('mustache');var util=require(_0x5d82('0x6'));var path=require(_0x5d82('0x7'));var sox=require('sox');var csv=require(_0x5d82('0x8'));var ejs=require(_0x5d82('0x9'));var fs=require('fs');var fs_extra=require(_0x5d82('0xa'));var _=require(_0x5d82('0xb'));var squel=require(_0x5d82('0xc'));var crypto=require('crypto');var jsforce=require(_0x5d82('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5d82('0x8'));var querystring=require(_0x5d82('0xe'));var Papa=require(_0x5d82('0xf'));var Redis=require(_0x5d82('0x10'));var authService=require(_0x5d82('0x11'));var qs=require(_0x5d82('0x12'));var as=require(_0x5d82('0x13'));var hardwareService=require(_0x5d82('0x14'));var logger=require(_0x5d82('0x15'))(_0x5d82('0x16'));var utils=require(_0x5d82('0x17'));var config=require(_0x5d82('0x18'));var licenseUtil=require(_0x5d82('0x19'));var db=require(_0x5d82('0x1a'))['db'];var jayson=require(_0x5d82('0x1b'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xcd748d,_0xd0a126,_0x1e2531,_0x254767){return new BPromise(function(_0x2b5302,_0x56317c){var _0x370ba6=_0x254767||client;return _0x370ba6[_0x5d82('0x1c')](_0xcd748d,_0x1e2531)[_0x5d82('0x1d')](function(_0x3478fb){logger[_0x5d82('0x1e')](_0x5d82('0x1f'),_0xd0a126,_0x5d82('0x20'));logger[_0x5d82('0x21')](_0x5d82('0x22'),_0xd0a126,'request\x20sent',JSON[_0x5d82('0x23')](_0x3478fb));if(_0x3478fb[_0x5d82('0x24')]){if(_0x3478fb[_0x5d82('0x24')][_0x5d82('0x25')]===0x1f4){logger[_0x5d82('0x24')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xd0a126,_0x3478fb[_0x5d82('0x24')][_0x5d82('0x26')]);return _0x56317c(_0x3478fb[_0x5d82('0x24')][_0x5d82('0x26')]);}logger[_0x5d82('0x24')](_0x5d82('0x1f'),_0xd0a126,_0x3478fb[_0x5d82('0x24')][_0x5d82('0x26')]);return _0x2b5302(_0x3478fb[_0x5d82('0x24')][_0x5d82('0x26')]);}else{logger[_0x5d82('0x1e')](_0x5d82('0x1f'),_0xd0a126,_0x5d82('0x20'));_0x2b5302(_0x3478fb['result']['message']);}})['catch'](function(_0x9aaaf2){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0xd0a126,_0x9aaaf2);_0x56317c(_0x9aaaf2);});});}function respondWithStatusCode(_0x116642,_0x170374){_0x170374=_0x170374||0xcc;return function(_0x219e5d){if(_0x219e5d){return _0x116642['sendStatus'](_0x170374);}return _0x116642[_0x5d82('0x27')](_0x170374)[_0x5d82('0x28')]();};}function respondWithResult(_0x997ea1,_0x16f545){_0x16f545=_0x16f545||0xc8;return function(_0x5f5433){if(_0x5f5433){return _0x997ea1[_0x5d82('0x27')](_0x16f545)[_0x5d82('0x29')](_0x5f5433);}};}function respondWithFilteredResult(_0x36f03d,_0x345521){return function(_0xfad7a7){if(_0xfad7a7){var _0x269c39=typeof _0x345521[_0x5d82('0x2a')]==='undefined'&&typeof _0x345521['limit']===_0x5d82('0x2b');var _0x4a08db=_0xfad7a7['count'];var _0x47a075=_0x269c39?0x0:_0x345521['offset'];var _0x396666=_0x269c39?_0xfad7a7[_0x5d82('0x2c')]:_0x345521[_0x5d82('0x2a')]+_0x345521['limit'];var _0x3ab6aa;if(_0x396666>=_0x4a08db){_0x396666=_0x4a08db;_0x3ab6aa=0xc8;}else{_0x3ab6aa=0xce;}_0x36f03d[_0x5d82('0x27')](_0x3ab6aa);return _0x36f03d['set']('Content-Range',_0x47a075+'-'+_0x396666+'/'+_0x4a08db)[_0x5d82('0x29')](_0xfad7a7);}return null;};}function patchUpdates(_0x42a11f){return function(_0x5e0d05){try{jsonpatch[_0x5d82('0x2d')](_0x5e0d05,_0x42a11f,!![]);}catch(_0x704b6b){return BPromise[_0x5d82('0x2e')](_0x704b6b);}return _0x5e0d05[_0x5d82('0x2f')]();};}function saveUpdates(_0x64ef4c,_0x46a437){return function(_0x2c89b4){if(_0x2c89b4){return _0x2c89b4['update'](_0x64ef4c)['then'](function(_0x337a4d){return _0x337a4d;});}return null;};}function removeEntity(_0x2409b3,_0x5b8aaa){return function(_0x3a7fcd){if(_0x3a7fcd){return _0x3a7fcd[_0x5d82('0x30')]()['then'](function(){_0x2409b3[_0x5d82('0x27')](0xcc)[_0x5d82('0x28')]();});}};}function handleEntityNotFound(_0x2caf48,_0x1c266d){return function(_0x5799cd){if(!_0x5799cd){_0x2caf48[_0x5d82('0x31')](0x194);}return _0x5799cd;};}function handleError(_0x19ad4d,_0x322caa){_0x322caa=_0x322caa||0x1f4;return function(_0x582344){logger[_0x5d82('0x24')](_0x582344[_0x5d82('0x32')]);if(_0x582344[_0x5d82('0x33')]){delete _0x582344[_0x5d82('0x33')];}_0x19ad4d['status'](_0x322caa)[_0x5d82('0x34')](_0x582344);};}function getMustacheRender(_0x40839c,_0x463001){return Mustache[_0x5d82('0x35')](_0x40839c,_[_0x5d82('0x36')](_0x463001['body'],{'contact':_0x463001[_0x5d82('0x37')],'message':_0x463001['message'],'agent':_0x463001['agent'],'interaction':_0x463001['interaction'],'account':_0x463001['account']}))||'';}exports[_0x5d82('0x38')]=function(_0x3fff57,_0x4fccfc){var _0x21cff3={},_0x25ef4f={},_0x35f809={'count':0x0,'rows':[]};var _0x3c02ed=_[_0x5d82('0x39')](db[_0x5d82('0x3a')][_0x5d82('0x3b')],function(_0x5c8095){return{'name':_0x5c8095[_0x5d82('0x3c')],'type':_0x5c8095[_0x5d82('0x3d')]['key']};});_0x25ef4f[_0x5d82('0x3e')]=_['map'](_0x3c02ed,_0x5d82('0x33'));_0x25ef4f[_0x5d82('0x3f')]=_[_0x5d82('0x40')](_0x3fff57[_0x5d82('0x3f')]);_0x25ef4f[_0x5d82('0x41')]=_['intersection'](_0x25ef4f[_0x5d82('0x3e')],_0x25ef4f[_0x5d82('0x3f')]);_0x21cff3[_0x5d82('0x42')]=_[_0x5d82('0x43')](_0x25ef4f[_0x5d82('0x3e')],qs[_0x5d82('0x44')](_0x3fff57[_0x5d82('0x3f')][_0x5d82('0x44')]));_0x21cff3['attributes']=_0x21cff3[_0x5d82('0x42')]['length']?_0x21cff3[_0x5d82('0x42')]:_0x25ef4f['model'];if(!_0x3fff57[_0x5d82('0x3f')][_0x5d82('0x45')](_0x5d82('0x46'))){_0x21cff3['limit']=qs[_0x5d82('0x47')](_0x3fff57[_0x5d82('0x3f')][_0x5d82('0x47')]);_0x21cff3[_0x5d82('0x2a')]=qs[_0x5d82('0x2a')](_0x3fff57['query'][_0x5d82('0x2a')]);}_0x21cff3[_0x5d82('0x48')]=qs[_0x5d82('0x49')](_0x3fff57[_0x5d82('0x3f')][_0x5d82('0x49')]);_0x21cff3[_0x5d82('0x4a')]=qs[_0x5d82('0x41')](_[_0x5d82('0x4b')](_0x3fff57['query'],_0x25ef4f[_0x5d82('0x41')]),_0x3c02ed);if(_0x3fff57[_0x5d82('0x3f')]['filter']){_0x21cff3[_0x5d82('0x4a')]=_[_0x5d82('0x36')](_0x21cff3[_0x5d82('0x4a')],{'$or':_[_0x5d82('0x39')](_0x3c02ed,function(_0x1dcba3){if(_0x1dcba3[_0x5d82('0x3d')]!==_0x5d82('0x4c')){var _0x494045={};_0x494045[_0x1dcba3['name']]={'$like':'%'+_0x3fff57[_0x5d82('0x3f')]['filter']+'%'};return _0x494045;}})});}_0x21cff3=_['merge']({},_0x21cff3,_0x3fff57[_0x5d82('0x4d')]);var _0x482dbc={'where':_0x21cff3[_0x5d82('0x4a')]};return db['FreshsalesConfiguration'][_0x5d82('0x2c')](_0x482dbc)[_0x5d82('0x1d')](function(_0x27d509){_0x35f809['count']=_0x27d509;if(_0x3fff57[_0x5d82('0x3f')][_0x5d82('0x4e')]){_0x21cff3[_0x5d82('0x4f')]=[{'all':!![]}];}return db[_0x5d82('0x3a')]['findAll'](_0x21cff3);})[_0x5d82('0x1d')](function(_0x9e0d0b){_0x35f809[_0x5d82('0x50')]=_0x9e0d0b;return _0x35f809;})['then'](respondWithFilteredResult(_0x4fccfc,_0x21cff3))[_0x5d82('0x51')](handleError(_0x4fccfc,null));};exports[_0x5d82('0x52')]=function(_0x4e7322,_0x237a30){var _0x5088fb={'raw':![],'where':{'id':_0x4e7322[_0x5d82('0x53')]['id']}},_0x29560d={};_0x29560d[_0x5d82('0x3e')]=_[_0x5d82('0x40')](db[_0x5d82('0x3a')]['rawAttributes']);_0x29560d[_0x5d82('0x3f')]=_['keys'](_0x4e7322['query']);_0x29560d[_0x5d82('0x41')]=_[_0x5d82('0x43')](_0x29560d[_0x5d82('0x3e')],_0x29560d[_0x5d82('0x3f')]);_0x5088fb['attributes']=_[_0x5d82('0x43')](_0x29560d[_0x5d82('0x3e')],qs[_0x5d82('0x44')](_0x4e7322[_0x5d82('0x3f')][_0x5d82('0x44')]));_0x5088fb['attributes']=_0x5088fb['attributes'][_0x5d82('0x54')]?_0x5088fb[_0x5d82('0x42')]:_0x29560d[_0x5d82('0x3e')];if(_0x4e7322['query'][_0x5d82('0x4e')]){_0x5088fb['include']=[{'all':!![]}];}_0x5088fb=_[_0x5d82('0x36')]({},_0x5088fb,_0x4e7322[_0x5d82('0x4d')]);return db['FreshsalesConfiguration'][_0x5d82('0x55')](_0x5088fb)[_0x5d82('0x1d')](handleEntityNotFound(_0x237a30,null))[_0x5d82('0x1d')](respondWithResult(_0x237a30,null))[_0x5d82('0x51')](handleError(_0x237a30,null));};exports[_0x5d82('0x56')]=function(_0x5dd0af,_0x31c70e){return db[_0x5d82('0x3a')][_0x5d82('0x56')](_0x5dd0af[_0x5d82('0x57')],{})[_0x5d82('0x1d')](respondWithResult(_0x31c70e,0xc9))[_0x5d82('0x51')](handleError(_0x31c70e,null));};exports[_0x5d82('0x58')]=function(_0x2c19e2,_0x14dbbe){if(_0x2c19e2[_0x5d82('0x57')]['id']){delete _0x2c19e2['body']['id'];}return db[_0x5d82('0x3a')][_0x5d82('0x55')]({'where':{'id':_0x2c19e2[_0x5d82('0x53')]['id']}})['then'](handleEntityNotFound(_0x14dbbe,null))['then'](saveUpdates(_0x2c19e2[_0x5d82('0x57')],null))[_0x5d82('0x1d')](respondWithResult(_0x14dbbe,null))['catch'](handleError(_0x14dbbe,null));};exports[_0x5d82('0x30')]=function(_0x1e25f8,_0x44793e){return db['FreshsalesConfiguration'][_0x5d82('0x55')]({'where':{'id':_0x1e25f8[_0x5d82('0x53')]['id']}})[_0x5d82('0x1d')](handleEntityNotFound(_0x44793e,null))[_0x5d82('0x1d')](removeEntity(_0x44793e,null))[_0x5d82('0x51')](handleError(_0x44793e,null));};exports[_0x5d82('0x59')]=function(_0x7d38c1,_0x332711,_0x2716fa){var _0x387c37={};var _0x3579d4={};var _0x1061c0;var _0x13a257;return db[_0x5d82('0x3a')][_0x5d82('0x5a')]({'where':{'id':_0x7d38c1[_0x5d82('0x53')]['id']}})[_0x5d82('0x1d')](handleEntityNotFound(_0x332711,null))['then'](function(_0x21b1ee){if(_0x21b1ee){_0x1061c0=_0x21b1ee;_0x3579d4[_0x5d82('0x3e')]=_[_0x5d82('0x40')](db[_0x5d82('0x5b')][_0x5d82('0x3b')]);_0x3579d4['query']=_[_0x5d82('0x40')](_0x7d38c1['query']);_0x3579d4[_0x5d82('0x41')]=_[_0x5d82('0x43')](_0x3579d4[_0x5d82('0x3e')],_0x3579d4[_0x5d82('0x3f')]);_0x387c37[_0x5d82('0x42')]=_[_0x5d82('0x43')](_0x3579d4[_0x5d82('0x3e')],qs[_0x5d82('0x44')](_0x7d38c1['query'][_0x5d82('0x44')]));_0x387c37[_0x5d82('0x42')]=_0x387c37[_0x5d82('0x42')][_0x5d82('0x54')]?_0x387c37['attributes']:_0x3579d4[_0x5d82('0x3e')];_0x387c37[_0x5d82('0x48')]=qs[_0x5d82('0x49')](_0x7d38c1[_0x5d82('0x3f')][_0x5d82('0x49')]);_0x387c37[_0x5d82('0x4a')]=qs[_0x5d82('0x41')](_[_0x5d82('0x4b')](_0x7d38c1[_0x5d82('0x3f')],_0x3579d4[_0x5d82('0x41')]));if(_0x7d38c1['query'][_0x5d82('0x5c')]){_0x387c37[_0x5d82('0x4a')]=_[_0x5d82('0x36')](_0x387c37[_0x5d82('0x4a')],{'$or':_[_0x5d82('0x39')](_0x387c37['attributes'],function(_0x448e48){var _0xa3e34e={};_0xa3e34e[_0x448e48]={'$like':'%'+_0x7d38c1[_0x5d82('0x3f')][_0x5d82('0x5c')]+'%'};return _0xa3e34e;})});}_0x387c37=_[_0x5d82('0x36')]({},_0x387c37,_0x7d38c1['options']);return _0x1061c0['getSubjects'](_0x387c37);}})[_0x5d82('0x1d')](function(_0x39bff0){if(_0x39bff0){_0x13a257=_0x39bff0[_0x5d82('0x54')];if(!_0x7d38c1['query'][_0x5d82('0x45')](_0x5d82('0x46'))){_0x387c37['limit']=qs[_0x5d82('0x47')](_0x7d38c1[_0x5d82('0x3f')][_0x5d82('0x47')]);_0x387c37[_0x5d82('0x2a')]=qs[_0x5d82('0x2a')](_0x7d38c1[_0x5d82('0x3f')][_0x5d82('0x2a')]);}return _0x1061c0['getSubjects'](_0x387c37);}})[_0x5d82('0x1d')](function(_0x591fbe){if(_0x591fbe){return _0x591fbe?{'count':_0x13a257,'rows':_0x591fbe}:null;}})[_0x5d82('0x1d')](respondWithResult(_0x332711,null))['catch'](handleError(_0x332711,null));};exports['getDescriptions']=function(_0x4bc8dc,_0x5131da,_0x2448e6){var _0x48f1c5={};var _0x3f240a={};var _0x718e5f;var _0x50c3e8;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x4bc8dc[_0x5d82('0x53')]['id']}})[_0x5d82('0x1d')](handleEntityNotFound(_0x5131da,null))[_0x5d82('0x1d')](function(_0x3797cf){if(_0x3797cf){_0x718e5f=_0x3797cf;_0x3f240a['model']=_[_0x5d82('0x40')](db['FreshsalesField'][_0x5d82('0x3b')]);_0x3f240a[_0x5d82('0x3f')]=_[_0x5d82('0x40')](_0x4bc8dc[_0x5d82('0x3f')]);_0x3f240a[_0x5d82('0x41')]=_[_0x5d82('0x43')](_0x3f240a[_0x5d82('0x3e')],_0x3f240a[_0x5d82('0x3f')]);_0x48f1c5[_0x5d82('0x42')]=_[_0x5d82('0x43')](_0x3f240a[_0x5d82('0x3e')],qs[_0x5d82('0x44')](_0x4bc8dc[_0x5d82('0x3f')]['fields']));_0x48f1c5[_0x5d82('0x42')]=_0x48f1c5['attributes'][_0x5d82('0x54')]?_0x48f1c5[_0x5d82('0x42')]:_0x3f240a['model'];_0x48f1c5[_0x5d82('0x48')]=qs[_0x5d82('0x49')](_0x4bc8dc[_0x5d82('0x3f')]['sort']);_0x48f1c5[_0x5d82('0x4a')]=qs[_0x5d82('0x41')](_[_0x5d82('0x4b')](_0x4bc8dc[_0x5d82('0x3f')],_0x3f240a[_0x5d82('0x41')]));if(_0x4bc8dc[_0x5d82('0x3f')][_0x5d82('0x5c')]){_0x48f1c5['where']=_[_0x5d82('0x36')](_0x48f1c5[_0x5d82('0x4a')],{'$or':_[_0x5d82('0x39')](_0x48f1c5[_0x5d82('0x42')],function(_0x18828d){var _0x15ee7e={};_0x15ee7e[_0x18828d]={'$like':'%'+_0x4bc8dc['query'][_0x5d82('0x5c')]+'%'};return _0x15ee7e;})});}_0x48f1c5=_[_0x5d82('0x36')]({},_0x48f1c5,_0x4bc8dc[_0x5d82('0x4d')]);return _0x718e5f[_0x5d82('0x5d')](_0x48f1c5);}})[_0x5d82('0x1d')](function(_0x3a499f){if(_0x3a499f){_0x50c3e8=_0x3a499f['length'];if(!_0x4bc8dc[_0x5d82('0x3f')]['hasOwnProperty'](_0x5d82('0x46'))){_0x48f1c5[_0x5d82('0x47')]=qs[_0x5d82('0x47')](_0x4bc8dc['query'][_0x5d82('0x47')]);_0x48f1c5[_0x5d82('0x2a')]=qs[_0x5d82('0x2a')](_0x4bc8dc[_0x5d82('0x3f')][_0x5d82('0x2a')]);}return _0x718e5f['getDescriptions'](_0x48f1c5);}})[_0x5d82('0x1d')](function(_0x1095af){if(_0x1095af){return _0x1095af?{'count':_0x50c3e8,'rows':_0x1095af}:null;}})[_0x5d82('0x1d')](respondWithResult(_0x5131da,null))[_0x5d82('0x51')](handleError(_0x5131da,null));};exports[_0x5d82('0x5e')]=function(_0x4ae443,_0x1b2233,_0x40d019){var _0x255568={};var _0x39cee8={};var _0x3f89df;var _0x43c1af;return db[_0x5d82('0x3a')][_0x5d82('0x5a')]({'where':{'id':_0x4ae443[_0x5d82('0x53')]['id']}})[_0x5d82('0x1d')](handleEntityNotFound(_0x1b2233,null))[_0x5d82('0x1d')](function(_0x13e286){if(_0x13e286){_0x3f89df=_0x13e286;_0x39cee8[_0x5d82('0x3e')]=_[_0x5d82('0x40')](db[_0x5d82('0x5b')][_0x5d82('0x3b')]);_0x39cee8['query']=_['keys'](_0x4ae443['query']);_0x39cee8[_0x5d82('0x41')]=_['intersection'](_0x39cee8['model'],_0x39cee8[_0x5d82('0x3f')]);_0x255568[_0x5d82('0x42')]=_['intersection'](_0x39cee8[_0x5d82('0x3e')],qs['fields'](_0x4ae443[_0x5d82('0x3f')]['fields']));_0x255568[_0x5d82('0x42')]=_0x255568[_0x5d82('0x42')][_0x5d82('0x54')]?_0x255568[_0x5d82('0x42')]:_0x39cee8[_0x5d82('0x3e')];_0x255568[_0x5d82('0x48')]=qs['sort'](_0x4ae443[_0x5d82('0x3f')][_0x5d82('0x49')]);_0x255568['where']=qs[_0x5d82('0x41')](_[_0x5d82('0x4b')](_0x4ae443[_0x5d82('0x3f')],_0x39cee8[_0x5d82('0x41')]));if(_0x4ae443['query']['filter']){_0x255568[_0x5d82('0x4a')]=_[_0x5d82('0x36')](_0x255568[_0x5d82('0x4a')],{'$or':_[_0x5d82('0x39')](_0x255568[_0x5d82('0x42')],function(_0x33009b){var _0x63c92={};_0x63c92[_0x33009b]={'$like':'%'+_0x4ae443['query'][_0x5d82('0x5c')]+'%'};return _0x63c92;})});}_0x255568=_['merge']({},_0x255568,_0x4ae443[_0x5d82('0x4d')]);return _0x3f89df[_0x5d82('0x5e')](_0x255568);}})[_0x5d82('0x1d')](function(_0x1d7850){if(_0x1d7850){_0x43c1af=_0x1d7850[_0x5d82('0x54')];if(!_0x4ae443[_0x5d82('0x3f')][_0x5d82('0x45')]('nolimit')){_0x255568[_0x5d82('0x47')]=qs[_0x5d82('0x47')](_0x4ae443[_0x5d82('0x3f')][_0x5d82('0x47')]);_0x255568[_0x5d82('0x2a')]=qs[_0x5d82('0x2a')](_0x4ae443[_0x5d82('0x3f')][_0x5d82('0x2a')]);}return _0x3f89df[_0x5d82('0x5e')](_0x255568);}})[_0x5d82('0x1d')](function(_0x1d9258){if(_0x1d9258){return _0x1d9258?{'count':_0x43c1af,'rows':_0x1d9258}:null;}})[_0x5d82('0x1d')](respondWithResult(_0x1b2233,null))[_0x5d82('0x51')](handleError(_0x1b2233,null));}; \ No newline at end of file +var _0x4ce7=['sendStatus','name','render','merge','body','contact','interaction','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','params','find','create','destroy','getSubjects','pick','getDescriptions','FreshsalesField','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','status','end','offset','undefined','limit','count','set','apply','save','update'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x4ce7,0x1ea));var _0x74ce=function(_0x44a066,_0x4b3a82){_0x44a066=_0x44a066-0x0;var _0x263cfd=_0x4ce7[_0x44a066];return _0x263cfd;};'use strict';var emlformat=require(_0x74ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74ce('0x1'));var jsonpatch=require(_0x74ce('0x2'));var rp=require(_0x74ce('0x3'));var moment=require(_0x74ce('0x4'));var BPromise=require(_0x74ce('0x5'));var Mustache=require(_0x74ce('0x6'));var util=require('util');var path=require(_0x74ce('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x74ce('0x8'));var _=require(_0x74ce('0x9'));var squel=require(_0x74ce('0xa'));var crypto=require('crypto');var jsforce=require(_0x74ce('0xb'));var deskjs=require(_0x74ce('0xc'));var toCsv=require('to-csv');var querystring=require(_0x74ce('0xd'));var Papa=require(_0x74ce('0xe'));var Redis=require(_0x74ce('0xf'));var authService=require(_0x74ce('0x10'));var qs=require(_0x74ce('0x11'));var as=require(_0x74ce('0x12'));var hardwareService=require(_0x74ce('0x13'));var logger=require(_0x74ce('0x14'))('api');var utils=require(_0x74ce('0x15'));var config=require(_0x74ce('0x16'));var licenseUtil=require(_0x74ce('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x74ce('0x18'));var client=jayson[_0x74ce('0x19')][_0x74ce('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x244645,_0x4a9830,_0x10a2cf,_0x5b7146){return new BPromise(function(_0x5bc528,_0x2fa0c5){var _0x29b351=_0x5b7146||client;return _0x29b351[_0x74ce('0x1b')](_0x244645,_0x10a2cf)[_0x74ce('0x1c')](function(_0x3c098e){logger['info'](_0x74ce('0x1d'),_0x4a9830,'request\x20sent');logger[_0x74ce('0x1e')](_0x74ce('0x1f'),_0x4a9830,_0x74ce('0x20'),JSON[_0x74ce('0x21')](_0x3c098e));if(_0x3c098e[_0x74ce('0x22')]){if(_0x3c098e[_0x74ce('0x22')][_0x74ce('0x23')]===0x1f4){logger[_0x74ce('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4a9830,_0x3c098e[_0x74ce('0x22')][_0x74ce('0x24')]);return _0x2fa0c5(_0x3c098e['error'][_0x74ce('0x24')]);}logger['error'](_0x74ce('0x1d'),_0x4a9830,_0x3c098e[_0x74ce('0x22')][_0x74ce('0x24')]);return _0x5bc528(_0x3c098e[_0x74ce('0x22')][_0x74ce('0x24')]);}else{logger[_0x74ce('0x25')](_0x74ce('0x1d'),_0x4a9830,_0x74ce('0x20'));_0x5bc528(_0x3c098e[_0x74ce('0x26')][_0x74ce('0x24')]);}})[_0x74ce('0x27')](function(_0x14e9b6){logger['error'](_0x74ce('0x1d'),_0x4a9830,_0x14e9b6);_0x2fa0c5(_0x14e9b6);});});}function respondWithStatusCode(_0x22714f,_0x23a585){_0x23a585=_0x23a585||0xcc;return function(_0xc27991){if(_0xc27991){return _0x22714f['sendStatus'](_0x23a585);}return _0x22714f[_0x74ce('0x28')](_0x23a585)[_0x74ce('0x29')]();};}function respondWithResult(_0xdea565,_0x3799e3){_0x3799e3=_0x3799e3||0xc8;return function(_0xca7d56){if(_0xca7d56){return _0xdea565[_0x74ce('0x28')](_0x3799e3)['json'](_0xca7d56);}};}function respondWithFilteredResult(_0x53f56b,_0x5605ec){return function(_0x592850){if(_0x592850){var _0xc069a9=typeof _0x5605ec[_0x74ce('0x2a')]===_0x74ce('0x2b')&&typeof _0x5605ec[_0x74ce('0x2c')]===_0x74ce('0x2b');var _0x447cd5=_0x592850[_0x74ce('0x2d')];var _0xdf6839=_0xc069a9?0x0:_0x5605ec['offset'];var _0x2c7822=_0xc069a9?_0x592850[_0x74ce('0x2d')]:_0x5605ec[_0x74ce('0x2a')]+_0x5605ec[_0x74ce('0x2c')];var _0x332403;if(_0x2c7822>=_0x447cd5){_0x2c7822=_0x447cd5;_0x332403=0xc8;}else{_0x332403=0xce;}_0x53f56b[_0x74ce('0x28')](_0x332403);return _0x53f56b[_0x74ce('0x2e')]('Content-Range',_0xdf6839+'-'+_0x2c7822+'/'+_0x447cd5)['json'](_0x592850);}return null;};}function patchUpdates(_0x5d7952){return function(_0x25f0cf){try{jsonpatch[_0x74ce('0x2f')](_0x25f0cf,_0x5d7952,!![]);}catch(_0x29453f){return BPromise['reject'](_0x29453f);}return _0x25f0cf[_0x74ce('0x30')]();};}function saveUpdates(_0x49eeef,_0x5621df){return function(_0x2d9bd8){if(_0x2d9bd8){return _0x2d9bd8[_0x74ce('0x31')](_0x49eeef)[_0x74ce('0x1c')](function(_0x53c7a9){return _0x53c7a9;});}return null;};}function removeEntity(_0x11006c,_0x121b22){return function(_0x111e51){if(_0x111e51){return _0x111e51['destroy']()[_0x74ce('0x1c')](function(){_0x11006c[_0x74ce('0x28')](0xcc)[_0x74ce('0x29')]();});}};}function handleEntityNotFound(_0x2e459b,_0x19c2c8){return function(_0xc7ae58){if(!_0xc7ae58){_0x2e459b[_0x74ce('0x32')](0x194);}return _0xc7ae58;};}function handleError(_0x7da78d,_0x3fd201){_0x3fd201=_0x3fd201||0x1f4;return function(_0x278067){logger[_0x74ce('0x22')](_0x278067['stack']);if(_0x278067[_0x74ce('0x33')]){delete _0x278067[_0x74ce('0x33')];}_0x7da78d['status'](_0x3fd201)['send'](_0x278067);};}function getMustacheRender(_0x5966e5,_0x3d99f1){return Mustache[_0x74ce('0x34')](_0x5966e5,_[_0x74ce('0x35')](_0x3d99f1[_0x74ce('0x36')],{'contact':_0x3d99f1[_0x74ce('0x37')],'message':_0x3d99f1['message'],'agent':_0x3d99f1['agent'],'interaction':_0x3d99f1[_0x74ce('0x38')],'account':_0x3d99f1['account']}))||'';}exports['index']=function(_0x3e8d2a,_0x4734c1){var _0x10d960={},_0x3c811a={},_0x41fc54={'count':0x0,'rows':[]};var _0x289c78=_['map'](db[_0x74ce('0x39')][_0x74ce('0x3a')],function(_0x2076fb){return{'name':_0x2076fb[_0x74ce('0x3b')],'type':_0x2076fb[_0x74ce('0x3c')][_0x74ce('0x3d')]};});_0x3c811a[_0x74ce('0x3e')]=_[_0x74ce('0x3f')](_0x289c78,_0x74ce('0x33'));_0x3c811a[_0x74ce('0x40')]=_[_0x74ce('0x41')](_0x3e8d2a[_0x74ce('0x40')]);_0x3c811a[_0x74ce('0x42')]=_[_0x74ce('0x43')](_0x3c811a[_0x74ce('0x3e')],_0x3c811a[_0x74ce('0x40')]);_0x10d960[_0x74ce('0x44')]=_['intersection'](_0x3c811a[_0x74ce('0x3e')],qs['fields'](_0x3e8d2a[_0x74ce('0x40')][_0x74ce('0x45')]));_0x10d960[_0x74ce('0x44')]=_0x10d960[_0x74ce('0x44')][_0x74ce('0x46')]?_0x10d960[_0x74ce('0x44')]:_0x3c811a[_0x74ce('0x3e')];if(!_0x3e8d2a[_0x74ce('0x40')][_0x74ce('0x47')](_0x74ce('0x48'))){_0x10d960[_0x74ce('0x2c')]=qs[_0x74ce('0x2c')](_0x3e8d2a['query']['limit']);_0x10d960[_0x74ce('0x2a')]=qs['offset'](_0x3e8d2a['query']['offset']);}_0x10d960[_0x74ce('0x49')]=qs[_0x74ce('0x4a')](_0x3e8d2a['query'][_0x74ce('0x4a')]);_0x10d960[_0x74ce('0x4b')]=qs[_0x74ce('0x42')](_['pick'](_0x3e8d2a[_0x74ce('0x40')],_0x3c811a['filters']),_0x289c78);if(_0x3e8d2a['query'][_0x74ce('0x4c')]){_0x10d960['where']=_[_0x74ce('0x35')](_0x10d960['where'],{'$or':_['map'](_0x289c78,function(_0x306d74){if(_0x306d74['type']!==_0x74ce('0x4d')){var _0xa1d2af={};_0xa1d2af[_0x306d74[_0x74ce('0x33')]]={'$like':'%'+_0x3e8d2a[_0x74ce('0x40')][_0x74ce('0x4c')]+'%'};return _0xa1d2af;}})});}_0x10d960=_[_0x74ce('0x35')]({},_0x10d960,_0x3e8d2a[_0x74ce('0x4e')]);var _0x333c83={'where':_0x10d960['where']};return db[_0x74ce('0x39')][_0x74ce('0x2d')](_0x333c83)[_0x74ce('0x1c')](function(_0x529335){_0x41fc54[_0x74ce('0x2d')]=_0x529335;if(_0x3e8d2a[_0x74ce('0x40')][_0x74ce('0x4f')]){_0x10d960[_0x74ce('0x50')]=[{'all':!![]}];}return db[_0x74ce('0x39')]['findAll'](_0x10d960);})[_0x74ce('0x1c')](function(_0x2d8502){_0x41fc54['rows']=_0x2d8502;return _0x41fc54;})['then'](respondWithFilteredResult(_0x4734c1,_0x10d960))[_0x74ce('0x27')](handleError(_0x4734c1,null));};exports['show']=function(_0x364e8a,_0x5a270e){var _0x1630c6={'raw':![],'where':{'id':_0x364e8a[_0x74ce('0x51')]['id']}},_0x515b1e={};_0x515b1e['model']=_[_0x74ce('0x41')](db['FreshsalesConfiguration'][_0x74ce('0x3a')]);_0x515b1e[_0x74ce('0x40')]=_['keys'](_0x364e8a[_0x74ce('0x40')]);_0x515b1e[_0x74ce('0x42')]=_[_0x74ce('0x43')](_0x515b1e[_0x74ce('0x3e')],_0x515b1e['query']);_0x1630c6[_0x74ce('0x44')]=_['intersection'](_0x515b1e['model'],qs['fields'](_0x364e8a['query'][_0x74ce('0x45')]));_0x1630c6[_0x74ce('0x44')]=_0x1630c6[_0x74ce('0x44')][_0x74ce('0x46')]?_0x1630c6[_0x74ce('0x44')]:_0x515b1e[_0x74ce('0x3e')];if(_0x364e8a[_0x74ce('0x40')][_0x74ce('0x4f')]){_0x1630c6[_0x74ce('0x50')]=[{'all':!![]}];}_0x1630c6=_[_0x74ce('0x35')]({},_0x1630c6,_0x364e8a[_0x74ce('0x4e')]);return db[_0x74ce('0x39')][_0x74ce('0x52')](_0x1630c6)[_0x74ce('0x1c')](handleEntityNotFound(_0x5a270e,null))['then'](respondWithResult(_0x5a270e,null))[_0x74ce('0x27')](handleError(_0x5a270e,null));};exports['create']=function(_0x790001,_0x1e077f){return db[_0x74ce('0x39')][_0x74ce('0x53')](_0x790001[_0x74ce('0x36')],{})[_0x74ce('0x1c')](respondWithResult(_0x1e077f,0xc9))[_0x74ce('0x27')](handleError(_0x1e077f,null));};exports[_0x74ce('0x31')]=function(_0x552cf0,_0x220fc6){if(_0x552cf0[_0x74ce('0x36')]['id']){delete _0x552cf0[_0x74ce('0x36')]['id'];}return db[_0x74ce('0x39')][_0x74ce('0x52')]({'where':{'id':_0x552cf0[_0x74ce('0x51')]['id']}})[_0x74ce('0x1c')](handleEntityNotFound(_0x220fc6,null))[_0x74ce('0x1c')](saveUpdates(_0x552cf0[_0x74ce('0x36')],null))['then'](respondWithResult(_0x220fc6,null))[_0x74ce('0x27')](handleError(_0x220fc6,null));};exports[_0x74ce('0x54')]=function(_0x360cff,_0x4d1b99){return db['FreshsalesConfiguration'][_0x74ce('0x52')]({'where':{'id':_0x360cff['params']['id']}})[_0x74ce('0x1c')](handleEntityNotFound(_0x4d1b99,null))[_0x74ce('0x1c')](removeEntity(_0x4d1b99,null))[_0x74ce('0x27')](handleError(_0x4d1b99,null));};exports[_0x74ce('0x55')]=function(_0x5c02a9,_0x873101,_0x46550a){var _0x454179={};var _0xabc48a={};var _0x47e249;var _0x19c994;return db[_0x74ce('0x39')]['findOne']({'where':{'id':_0x5c02a9[_0x74ce('0x51')]['id']}})[_0x74ce('0x1c')](handleEntityNotFound(_0x873101,null))[_0x74ce('0x1c')](function(_0x3222f9){if(_0x3222f9){_0x47e249=_0x3222f9;_0xabc48a[_0x74ce('0x3e')]=_[_0x74ce('0x41')](db['FreshsalesField']['rawAttributes']);_0xabc48a[_0x74ce('0x40')]=_[_0x74ce('0x41')](_0x5c02a9['query']);_0xabc48a[_0x74ce('0x42')]=_['intersection'](_0xabc48a[_0x74ce('0x3e')],_0xabc48a[_0x74ce('0x40')]);_0x454179['attributes']=_[_0x74ce('0x43')](_0xabc48a[_0x74ce('0x3e')],qs[_0x74ce('0x45')](_0x5c02a9[_0x74ce('0x40')][_0x74ce('0x45')]));_0x454179['attributes']=_0x454179[_0x74ce('0x44')][_0x74ce('0x46')]?_0x454179['attributes']:_0xabc48a[_0x74ce('0x3e')];_0x454179[_0x74ce('0x49')]=qs['sort'](_0x5c02a9[_0x74ce('0x40')][_0x74ce('0x4a')]);_0x454179['where']=qs[_0x74ce('0x42')](_[_0x74ce('0x56')](_0x5c02a9['query'],_0xabc48a[_0x74ce('0x42')]));if(_0x5c02a9[_0x74ce('0x40')][_0x74ce('0x4c')]){_0x454179[_0x74ce('0x4b')]=_[_0x74ce('0x35')](_0x454179['where'],{'$or':_[_0x74ce('0x3f')](_0x454179[_0x74ce('0x44')],function(_0x42952c){var _0x4ffec9={};_0x4ffec9[_0x42952c]={'$like':'%'+_0x5c02a9[_0x74ce('0x40')][_0x74ce('0x4c')]+'%'};return _0x4ffec9;})});}_0x454179=_[_0x74ce('0x35')]({},_0x454179,_0x5c02a9[_0x74ce('0x4e')]);return _0x47e249[_0x74ce('0x55')](_0x454179);}})['then'](function(_0x1e4fd2){if(_0x1e4fd2){_0x19c994=_0x1e4fd2[_0x74ce('0x46')];if(!_0x5c02a9['query']['hasOwnProperty']('nolimit')){_0x454179[_0x74ce('0x2c')]=qs[_0x74ce('0x2c')](_0x5c02a9[_0x74ce('0x40')]['limit']);_0x454179[_0x74ce('0x2a')]=qs[_0x74ce('0x2a')](_0x5c02a9[_0x74ce('0x40')][_0x74ce('0x2a')]);}return _0x47e249['getSubjects'](_0x454179);}})[_0x74ce('0x1c')](function(_0x592cfd){if(_0x592cfd){return _0x592cfd?{'count':_0x19c994,'rows':_0x592cfd}:null;}})[_0x74ce('0x1c')](respondWithResult(_0x873101,null))['catch'](handleError(_0x873101,null));};exports[_0x74ce('0x57')]=function(_0x5e914c,_0x41bb22,_0x2f9d62){var _0x33ff95={};var _0x37f9b7={};var _0x5679ee;var _0x401719;return db[_0x74ce('0x39')]['findOne']({'where':{'id':_0x5e914c[_0x74ce('0x51')]['id']}})[_0x74ce('0x1c')](handleEntityNotFound(_0x41bb22,null))[_0x74ce('0x1c')](function(_0x2cd365){if(_0x2cd365){_0x5679ee=_0x2cd365;_0x37f9b7[_0x74ce('0x3e')]=_[_0x74ce('0x41')](db[_0x74ce('0x58')]['rawAttributes']);_0x37f9b7[_0x74ce('0x40')]=_[_0x74ce('0x41')](_0x5e914c[_0x74ce('0x40')]);_0x37f9b7[_0x74ce('0x42')]=_[_0x74ce('0x43')](_0x37f9b7[_0x74ce('0x3e')],_0x37f9b7[_0x74ce('0x40')]);_0x33ff95[_0x74ce('0x44')]=_['intersection'](_0x37f9b7[_0x74ce('0x3e')],qs[_0x74ce('0x45')](_0x5e914c[_0x74ce('0x40')]['fields']));_0x33ff95[_0x74ce('0x44')]=_0x33ff95[_0x74ce('0x44')][_0x74ce('0x46')]?_0x33ff95[_0x74ce('0x44')]:_0x37f9b7[_0x74ce('0x3e')];_0x33ff95[_0x74ce('0x49')]=qs['sort'](_0x5e914c['query'][_0x74ce('0x4a')]);_0x33ff95[_0x74ce('0x4b')]=qs['filters'](_[_0x74ce('0x56')](_0x5e914c[_0x74ce('0x40')],_0x37f9b7[_0x74ce('0x42')]));if(_0x5e914c['query']['filter']){_0x33ff95[_0x74ce('0x4b')]=_['merge'](_0x33ff95[_0x74ce('0x4b')],{'$or':_[_0x74ce('0x3f')](_0x33ff95['attributes'],function(_0xa6420f){var _0x2b8593={};_0x2b8593[_0xa6420f]={'$like':'%'+_0x5e914c[_0x74ce('0x40')][_0x74ce('0x4c')]+'%'};return _0x2b8593;})});}_0x33ff95=_['merge']({},_0x33ff95,_0x5e914c[_0x74ce('0x4e')]);return _0x5679ee[_0x74ce('0x57')](_0x33ff95);}})[_0x74ce('0x1c')](function(_0x2622a6){if(_0x2622a6){_0x401719=_0x2622a6[_0x74ce('0x46')];if(!_0x5e914c['query']['hasOwnProperty'](_0x74ce('0x48'))){_0x33ff95[_0x74ce('0x2c')]=qs[_0x74ce('0x2c')](_0x5e914c[_0x74ce('0x40')][_0x74ce('0x2c')]);_0x33ff95[_0x74ce('0x2a')]=qs['offset'](_0x5e914c[_0x74ce('0x40')][_0x74ce('0x2a')]);}return _0x5679ee[_0x74ce('0x57')](_0x33ff95);}})['then'](function(_0x6921af){if(_0x6921af){return _0x6921af?{'count':_0x401719,'rows':_0x6921af}:null;}})[_0x74ce('0x1c')](respondWithResult(_0x41bb22,null))['catch'](handleError(_0x41bb22,null));};exports[_0x74ce('0x59')]=function(_0xdd3752,_0x2f5960,_0x643201){var _0x7c177d={};var _0x16be19={};var _0x22b7f2;var _0x2bd3c4;return db[_0x74ce('0x39')]['findOne']({'where':{'id':_0xdd3752[_0x74ce('0x51')]['id']}})[_0x74ce('0x1c')](handleEntityNotFound(_0x2f5960,null))[_0x74ce('0x1c')](function(_0x185664){if(_0x185664){_0x22b7f2=_0x185664;_0x16be19[_0x74ce('0x3e')]=_['keys'](db[_0x74ce('0x58')][_0x74ce('0x3a')]);_0x16be19[_0x74ce('0x40')]=_[_0x74ce('0x41')](_0xdd3752[_0x74ce('0x40')]);_0x16be19[_0x74ce('0x42')]=_[_0x74ce('0x43')](_0x16be19['model'],_0x16be19[_0x74ce('0x40')]);_0x7c177d[_0x74ce('0x44')]=_[_0x74ce('0x43')](_0x16be19['model'],qs['fields'](_0xdd3752['query'][_0x74ce('0x45')]));_0x7c177d['attributes']=_0x7c177d['attributes'][_0x74ce('0x46')]?_0x7c177d[_0x74ce('0x44')]:_0x16be19['model'];_0x7c177d[_0x74ce('0x49')]=qs[_0x74ce('0x4a')](_0xdd3752[_0x74ce('0x40')][_0x74ce('0x4a')]);_0x7c177d[_0x74ce('0x4b')]=qs[_0x74ce('0x42')](_[_0x74ce('0x56')](_0xdd3752['query'],_0x16be19[_0x74ce('0x42')]));if(_0xdd3752[_0x74ce('0x40')][_0x74ce('0x4c')]){_0x7c177d[_0x74ce('0x4b')]=_[_0x74ce('0x35')](_0x7c177d[_0x74ce('0x4b')],{'$or':_[_0x74ce('0x3f')](_0x7c177d[_0x74ce('0x44')],function(_0x3006dd){var _0x36ac27={};_0x36ac27[_0x3006dd]={'$like':'%'+_0xdd3752[_0x74ce('0x40')]['filter']+'%'};return _0x36ac27;})});}_0x7c177d=_[_0x74ce('0x35')]({},_0x7c177d,_0xdd3752[_0x74ce('0x4e')]);return _0x22b7f2['getFields'](_0x7c177d);}})[_0x74ce('0x1c')](function(_0x414fec){if(_0x414fec){_0x2bd3c4=_0x414fec[_0x74ce('0x46')];if(!_0xdd3752[_0x74ce('0x40')][_0x74ce('0x47')](_0x74ce('0x48'))){_0x7c177d['limit']=qs[_0x74ce('0x2c')](_0xdd3752[_0x74ce('0x40')][_0x74ce('0x2c')]);_0x7c177d[_0x74ce('0x2a')]=qs['offset'](_0xdd3752[_0x74ce('0x40')][_0x74ce('0x2a')]);}return _0x22b7f2[_0x74ce('0x59')](_0x7c177d);}})[_0x74ce('0x1c')](function(_0x1b86d5){if(_0x1b86d5){return _0x1b86d5?{'count':_0x2bd3c4,'rows':_0x1b86d5}:null;}})[_0x74ce('0x1c')](respondWithResult(_0x2f5960,null))[_0x74ce('0x27')](handleError(_0x2f5960,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index a036884..9c3e434 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 _0x13f7=['bluebird','path','rimraf','../../config/environment','define','lodash','util','../../config/logger','api'];(function(_0x3a1a12,_0x3cc82f){var _0x6ab74c=function(_0x22ba06){while(--_0x22ba06){_0x3a1a12['push'](_0x3a1a12['shift']());}};_0x6ab74c(++_0x3cc82f);}(_0x13f7,0x164));var _0x713f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x13f7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x713f('0x0'));var util=require(_0x713f('0x1'));var logger=require(_0x713f('0x2'))(_0x713f('0x3'));var moment=require('moment');var BPromise=require(_0x713f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x713f('0x5'));var rimraf=require(_0x713f('0x6'));var config=require(_0x713f('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x5ea16f,_0x463eea){return _0x5ea16f[_0x713f('0x8')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8278=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util'];(function(_0x41cf29,_0x216a99){var _0x566462=function(_0x31311a){while(--_0x31311a){_0x41cf29['push'](_0x41cf29['shift']());}};_0x566462(++_0x216a99);}(_0x8278,0x1ae));var _0x8827=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8278[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8827('0x0'));var util=require(_0x8827('0x1'));var logger=require(_0x8827('0x2'))(_0x8827('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8827('0x4'));var fs=require('fs');var path=require(_0x8827('0x5'));var rimraf=require(_0x8827('0x6'));var config=require(_0x8827('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x8827('0x8')]=function(_0x4342d7,_0x11797a){return _0x4342d7[_0x8827('0x9')](_0x8827('0xa'),attributes,{'tableName':_0x8827('0xb'),'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 477caf8..35475ce 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 _0xefe3=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','randomstring'];(function(_0x4cecf8,_0x522f97){var _0x311797=function(_0x243bcb){while(--_0x243bcb){_0x4cecf8['push'](_0x4cecf8['shift']());}};_0x311797(++_0x522f97);}(_0xefe3,0xf5));var _0x3efe=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xefe3[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x3efe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3efe('0x1'));var fs=require('fs');var Redis=require(_0x3efe('0x2'));var db=require(_0x3efe('0x3'))['db'];var utils=require(_0x3efe('0x4'));var logger=require('../../config/logger')(_0x3efe('0x5'));var config=require('../../config/environment');var jayson=require(_0x3efe('0x6'));var client=jayson['client'][_0x3efe('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x60487e,_0x1f697b,_0x195d5d){return new BPromise(function(_0x30d2e8,_0x474c9a){return client['request'](_0x60487e,_0x195d5d)[_0x3efe('0x8')](function(_0x54fec1){logger[_0x3efe('0x9')](_0x3efe('0xa'),_0x1f697b,_0x3efe('0xb'));logger[_0x3efe('0xc')](_0x3efe('0xd'),_0x1f697b,_0x3efe('0xb'),JSON['stringify'](_0x54fec1));if(_0x54fec1['error']){if(_0x54fec1[_0x3efe('0xe')][_0x3efe('0xf')]===0x1f4){logger[_0x3efe('0xe')](_0x3efe('0xa'),_0x1f697b,_0x54fec1[_0x3efe('0xe')][_0x3efe('0x10')]);return _0x474c9a(_0x54fec1[_0x3efe('0xe')][_0x3efe('0x10')]);}logger[_0x3efe('0xe')](_0x3efe('0xa'),_0x1f697b,_0x54fec1[_0x3efe('0xe')]['message']);return _0x30d2e8(_0x54fec1[_0x3efe('0xe')][_0x3efe('0x10')]);}else{logger[_0x3efe('0x9')](_0x3efe('0xa'),_0x1f697b,'request\x20sent');_0x30d2e8(_0x54fec1[_0x3efe('0x11')][_0x3efe('0x10')]);}})[_0x3efe('0x12')](function(_0x515e1b){logger['error'](_0x3efe('0xa'),_0x1f697b,_0x515e1b);_0x474c9a(_0x515e1b);});});} \ No newline at end of file +var _0x0490=['debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3b1acd,_0x194aa4){var _0x11bc50=function(_0x2c5eae){while(--_0x2c5eae){_0x3b1acd['push'](_0x3b1acd['shift']());}};_0x11bc50(++_0x194aa4);}(_0x0490,0x147));var _0x0049=function(_0x3b8e50,_0x1c6c1f){_0x3b8e50=_0x3b8e50-0x0;var _0x425f35=_0x0490[_0x3b8e50];return _0x425f35;};'use strict';var _=require('lodash');var util=require(_0x0049('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0049('0x1'))['db'];var utils=require(_0x0049('0x2'));var logger=require(_0x0049('0x3'))(_0x0049('0x4'));var config=require(_0x0049('0x5'));var jayson=require(_0x0049('0x6'));var client=jayson[_0x0049('0x7')][_0x0049('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28c8d2,_0x57fca5,_0x18bff7){return new BPromise(function(_0xe091c4,_0x154219){return client['request'](_0x28c8d2,_0x18bff7)[_0x0049('0x9')](function(_0x3f2ca1){logger[_0x0049('0xa')](_0x0049('0xb'),_0x57fca5,_0x0049('0xc'));logger[_0x0049('0xd')](_0x0049('0xe'),_0x57fca5,_0x0049('0xc'),JSON[_0x0049('0xf')](_0x3f2ca1));if(_0x3f2ca1['error']){if(_0x3f2ca1[_0x0049('0x10')][_0x0049('0x11')]===0x1f4){logger[_0x0049('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x57fca5,_0x3f2ca1['error'][_0x0049('0x12')]);return _0x154219(_0x3f2ca1[_0x0049('0x10')][_0x0049('0x12')]);}logger[_0x0049('0x10')](_0x0049('0xb'),_0x57fca5,_0x3f2ca1['error'][_0x0049('0x12')]);return _0xe091c4(_0x3f2ca1[_0x0049('0x10')]['message']);}else{logger[_0x0049('0xa')](_0x0049('0xb'),_0x57fca5,_0x0049('0xc'));_0xe091c4(_0x3f2ca1[_0x0049('0x13')]['message']);}})['catch'](function(_0x4315b5){logger[_0x0049('0x10')](_0x0049('0xb'),_0x57fca5,_0x4315b5);_0x154219(_0x4315b5);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index b949547..f476a63 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 _0x3c81=['delete','destroy','exports','multer','util','connect-timeout','express','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x125233,_0x522bf1){var _0x42d385=function(_0x5544d5){while(--_0x5544d5){_0x125233['push'](_0x125233['shift']());}};_0x42d385(++_0x522bf1);}(_0x3c81,0x102));var _0x13c8=function(_0x5bea32,_0x2ef5a0){_0x5bea32=_0x5bea32-0x0;var _0x5d0c17=_0x3c81[_0x5bea32];return _0x5d0c17;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['post']('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0xb')]);router[_0x13c8('0xc')](_0x13c8('0x9'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xd')]);router[_0x13c8('0xe')](_0x13c8('0x9'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xf')]);module[_0x13c8('0x10')]=router; \ No newline at end of file +var _0x1775=['../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x46a5e9,_0x1a5966){var _0x2466bb=function(_0x2dbc98){while(--_0x2dbc98){_0x46a5e9['push'](_0x46a5e9['shift']());}};_0x2466bb(++_0x1a5966);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var fs_extra=require(_0x5177('0x5'));var auth=require(_0x5177('0x6'));var interaction=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var controller=require(_0x5177('0x9'));router[_0x5177('0xa')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0xc')]);router[_0x5177('0xa')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0xe')]);router[_0x5177('0xf')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0x10')]);router[_0x5177('0x11')](_0x5177('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5177('0x12')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0x13')]);module[_0x5177('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index cf3e219..0ab3cef 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 _0x326f=['ENUM','sequelize','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x326f,0xd1));var _0xf326=function(_0x2fec12,_0x41922b){_0x2fec12=_0x2fec12-0x0;var _0x5aa2c1=_0x326f[_0x2fec12];return _0x5aa2c1;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xf326('0x1'),_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5')),'defaultValue':_0xf326('0x1')},'content':{'type':Sequelize[_0xf326('0x6')]},'key':{'type':Sequelize[_0xf326('0x6')]},'keyType':{'type':Sequelize[_0xf326('0x7')](_0xf326('0x1'),'variable',_0xf326('0x3'))},'keyContent':{'type':Sequelize[_0xf326('0x6')]},'idField':{'type':Sequelize[_0xf326('0x6')]},'nameField':{'type':Sequelize[_0xf326('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4819=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0x4819,0xcd));var _0x9481=function(_0x26447e,_0x2e9c94){_0x26447e=_0x26447e-0x0;var _0x38cc1a=_0x4819[_0x26447e];return _0x38cc1a;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'type':{'type':Sequelize[_0x9481('0x1')](_0x9481('0x2'),_0x9481('0x3'),_0x9481('0x4'),_0x9481('0x5'),_0x9481('0x6')),'defaultValue':_0x9481('0x2')},'content':{'type':Sequelize[_0x9481('0x7')]},'key':{'type':Sequelize[_0x9481('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x9481('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x9481('0x7')]},'idField':{'type':Sequelize[_0x9481('0x7')]},'nameField':{'type':Sequelize[_0x9481('0x7')]},'customField':{'type':Sequelize[_0x9481('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9481('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 09dbeab..b08bb3f 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 _0x5ed0=['render','merge','contact','message','agent','interaction','account','map','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','filters','filter','VIRTUAL','options','FreshsalesField','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','find','rimraf','zip-dir','request-promise','moment','bluebird','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','json','reject','save','destroy','then','sendStatus','error','stack','name'];(function(_0x2c3bab,_0x29a2ea){var _0x5c869d=function(_0x26e8f9){while(--_0x26e8f9){_0x2c3bab['push'](_0x2c3bab['shift']());}};_0x5c869d(++_0x29a2ea);}(_0x5ed0,0xbc));var _0x05ed=function(_0x3ebd57,_0x15a573){_0x3ebd57=_0x3ebd57-0x0;var _0x133757=_0x5ed0[_0x3ebd57];return _0x133757;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x05ed('0x0'));var zipdir=require(_0x05ed('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05ed('0x2'));var moment=require(_0x05ed('0x3'));var BPromise=require(_0x05ed('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x05ed('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x05ed('0x6'));var fs=require('fs');var fs_extra=require(_0x05ed('0x7'));var _=require(_0x05ed('0x8'));var squel=require(_0x05ed('0x9'));var crypto=require(_0x05ed('0xa'));var jsforce=require(_0x05ed('0xb'));var deskjs=require(_0x05ed('0xc'));var toCsv=require(_0x05ed('0xd'));var querystring=require(_0x05ed('0xe'));var Papa=require(_0x05ed('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x05ed('0x10'));var hardwareService=require(_0x05ed('0x11'));var logger=require(_0x05ed('0x12'))('api');var utils=require(_0x05ed('0x13'));var config=require(_0x05ed('0x14'));var licenseUtil=require(_0x05ed('0x15'));var db=require(_0x05ed('0x16'))['db'];function respondWithStatusCode(_0x381e90,_0x5e8dcf){_0x5e8dcf=_0x5e8dcf||0xcc;return function(_0x18d127){if(_0x18d127){return _0x381e90['sendStatus'](_0x5e8dcf);}return _0x381e90[_0x05ed('0x17')](_0x5e8dcf)[_0x05ed('0x18')]();};}function respondWithResult(_0x327cd2,_0x215c68){_0x215c68=_0x215c68||0xc8;return function(_0x1eb826){if(_0x1eb826){return _0x327cd2[_0x05ed('0x17')](_0x215c68)['json'](_0x1eb826);}};}function respondWithFilteredResult(_0x3567e4,_0xf338a7){return function(_0x490416){if(_0x490416){var _0x3c16fc=typeof _0xf338a7[_0x05ed('0x19')]===_0x05ed('0x1a')&&typeof _0xf338a7['limit']===_0x05ed('0x1a');var _0x26c850=_0x490416[_0x05ed('0x1b')];var _0x2a7471=_0x3c16fc?0x0:_0xf338a7[_0x05ed('0x19')];var _0x2af903=_0x3c16fc?_0x490416[_0x05ed('0x1b')]:_0xf338a7[_0x05ed('0x19')]+_0xf338a7['limit'];var _0x14b9f8;if(_0x2af903>=_0x26c850){_0x2af903=_0x26c850;_0x14b9f8=0xc8;}else{_0x14b9f8=0xce;}_0x3567e4[_0x05ed('0x17')](_0x14b9f8);return _0x3567e4['set']('Content-Range',_0x2a7471+'-'+_0x2af903+'/'+_0x26c850)[_0x05ed('0x1c')](_0x490416);}return null;};}function patchUpdates(_0x4424b4){return function(_0x365d30){try{jsonpatch['apply'](_0x365d30,_0x4424b4,!![]);}catch(_0x2591ef){return BPromise[_0x05ed('0x1d')](_0x2591ef);}return _0x365d30[_0x05ed('0x1e')]();};}function saveUpdates(_0x4bdca4,_0x3e5c65){return function(_0x2f2046){if(_0x2f2046){return _0x2f2046['update'](_0x4bdca4)['then'](function(_0x5ea041){return _0x5ea041;});}return null;};}function removeEntity(_0x12a67a,_0xf29acd){return function(_0xcb6cf5){if(_0xcb6cf5){return _0xcb6cf5[_0x05ed('0x1f')]()[_0x05ed('0x20')](function(){_0x12a67a[_0x05ed('0x17')](0xcc)[_0x05ed('0x18')]();});}};}function handleEntityNotFound(_0x284d25,_0x496425){return function(_0x429c72){if(!_0x429c72){_0x284d25[_0x05ed('0x21')](0x194);}return _0x429c72;};}function handleError(_0x25f339,_0x9e10a3){_0x9e10a3=_0x9e10a3||0x1f4;return function(_0x4e9123){logger[_0x05ed('0x22')](_0x4e9123[_0x05ed('0x23')]);if(_0x4e9123[_0x05ed('0x24')]){delete _0x4e9123[_0x05ed('0x24')];}_0x25f339[_0x05ed('0x17')](_0x9e10a3)['send'](_0x4e9123);};}function getMustacheRender(_0x54341e,_0x3f5d0d){return Mustache[_0x05ed('0x25')](_0x54341e,_[_0x05ed('0x26')](_0x3f5d0d['body'],{'contact':_0x3f5d0d[_0x05ed('0x27')],'message':_0x3f5d0d[_0x05ed('0x28')],'agent':_0x3f5d0d[_0x05ed('0x29')],'interaction':_0x3f5d0d[_0x05ed('0x2a')],'account':_0x3f5d0d[_0x05ed('0x2b')]}))||'';}exports['index']=function(_0x3a8949,_0xae50aa){var _0x356fa1={},_0x2823a0={},_0x35921f={'count':0x0,'rows':[]};var _0x3554ea=_[_0x05ed('0x2c')](db['FreshsalesField'][_0x05ed('0x2d')],function(_0x12845b){return{'name':_0x12845b['fieldName'],'type':_0x12845b[_0x05ed('0x2e')][_0x05ed('0x2f')]};});_0x2823a0[_0x05ed('0x30')]=_['map'](_0x3554ea,_0x05ed('0x24'));_0x2823a0[_0x05ed('0x31')]=_['keys'](_0x3a8949[_0x05ed('0x31')]);_0x2823a0['filters']=_[_0x05ed('0x32')](_0x2823a0['model'],_0x2823a0[_0x05ed('0x31')]);_0x356fa1[_0x05ed('0x33')]=_['intersection'](_0x2823a0[_0x05ed('0x30')],qs[_0x05ed('0x34')](_0x3a8949[_0x05ed('0x31')][_0x05ed('0x34')]));_0x356fa1[_0x05ed('0x33')]=_0x356fa1[_0x05ed('0x33')]['length']?_0x356fa1[_0x05ed('0x33')]:_0x2823a0[_0x05ed('0x30')];if(!_0x3a8949[_0x05ed('0x31')][_0x05ed('0x35')](_0x05ed('0x36'))){_0x356fa1['limit']=qs[_0x05ed('0x37')](_0x3a8949[_0x05ed('0x31')][_0x05ed('0x37')]);_0x356fa1[_0x05ed('0x19')]=qs[_0x05ed('0x19')](_0x3a8949[_0x05ed('0x31')][_0x05ed('0x19')]);}_0x356fa1[_0x05ed('0x38')]=qs['sort'](_0x3a8949[_0x05ed('0x31')]['sort']);_0x356fa1[_0x05ed('0x39')]=qs[_0x05ed('0x3a')](_['pick'](_0x3a8949['query'],_0x2823a0[_0x05ed('0x3a')]),_0x3554ea);if(_0x3a8949[_0x05ed('0x31')][_0x05ed('0x3b')]){_0x356fa1[_0x05ed('0x39')]=_[_0x05ed('0x26')](_0x356fa1[_0x05ed('0x39')],{'$or':_[_0x05ed('0x2c')](_0x3554ea,function(_0x2d0974){if(_0x2d0974[_0x05ed('0x2e')]!==_0x05ed('0x3c')){var _0x3cad11={};_0x3cad11[_0x2d0974[_0x05ed('0x24')]]={'$like':'%'+_0x3a8949['query'][_0x05ed('0x3b')]+'%'};return _0x3cad11;}})});}_0x356fa1=_[_0x05ed('0x26')]({},_0x356fa1,_0x3a8949[_0x05ed('0x3d')]);var _0x2819a0={'where':_0x356fa1[_0x05ed('0x39')]};return db[_0x05ed('0x3e')][_0x05ed('0x1b')](_0x2819a0)[_0x05ed('0x20')](function(_0x59b4c2){_0x35921f[_0x05ed('0x1b')]=_0x59b4c2;if(_0x3a8949['query'][_0x05ed('0x3f')]){_0x356fa1[_0x05ed('0x40')]=[{'all':!![]}];}return db['FreshsalesField'][_0x05ed('0x41')](_0x356fa1);})[_0x05ed('0x20')](function(_0x3ef507){_0x35921f[_0x05ed('0x42')]=_0x3ef507;return _0x35921f;})[_0x05ed('0x20')](respondWithFilteredResult(_0xae50aa,_0x356fa1))[_0x05ed('0x43')](handleError(_0xae50aa,null));};exports[_0x05ed('0x44')]=function(_0x1117d6,_0x34455f){var _0x490b6f={'raw':!![],'where':{'id':_0x1117d6[_0x05ed('0x45')]['id']}},_0x148349={};_0x148349['model']=_[_0x05ed('0x46')](db[_0x05ed('0x3e')][_0x05ed('0x2d')]);_0x148349[_0x05ed('0x31')]=_['keys'](_0x1117d6['query']);_0x148349[_0x05ed('0x3a')]=_[_0x05ed('0x32')](_0x148349[_0x05ed('0x30')],_0x148349['query']);_0x490b6f[_0x05ed('0x33')]=_[_0x05ed('0x32')](_0x148349[_0x05ed('0x30')],qs[_0x05ed('0x34')](_0x1117d6[_0x05ed('0x31')][_0x05ed('0x34')]));_0x490b6f[_0x05ed('0x33')]=_0x490b6f[_0x05ed('0x33')][_0x05ed('0x47')]?_0x490b6f['attributes']:_0x148349[_0x05ed('0x30')];if(_0x1117d6[_0x05ed('0x31')][_0x05ed('0x3f')]){_0x490b6f['include']=[{'all':!![]}];}_0x490b6f=_['merge']({},_0x490b6f,_0x1117d6[_0x05ed('0x3d')]);return db[_0x05ed('0x3e')]['find'](_0x490b6f)[_0x05ed('0x20')](handleEntityNotFound(_0x34455f,null))[_0x05ed('0x20')](respondWithResult(_0x34455f,null))[_0x05ed('0x43')](handleError(_0x34455f,null));};exports[_0x05ed('0x48')]=function(_0x4e71b1,_0x4f4cb2){return db[_0x05ed('0x3e')][_0x05ed('0x48')](_0x4e71b1['body'],{})['then'](respondWithResult(_0x4f4cb2,0xc9))['catch'](handleError(_0x4f4cb2,null));};exports['update']=function(_0x148cfc,_0xbe4c55){if(_0x148cfc[_0x05ed('0x49')]['id']){delete _0x148cfc[_0x05ed('0x49')]['id'];}return db[_0x05ed('0x3e')][_0x05ed('0x4a')]({'where':{'id':_0x148cfc['params']['id']}})[_0x05ed('0x20')](handleEntityNotFound(_0xbe4c55,null))[_0x05ed('0x20')](saveUpdates(_0x148cfc['body'],null))[_0x05ed('0x20')](respondWithResult(_0xbe4c55,null))[_0x05ed('0x43')](handleError(_0xbe4c55,null));};exports[_0x05ed('0x1f')]=function(_0x2600cd,_0x39d3c4){return db[_0x05ed('0x3e')][_0x05ed('0x4a')]({'where':{'id':_0x2600cd['params']['id']}})[_0x05ed('0x20')](handleEntityNotFound(_0x39d3c4,null))[_0x05ed('0x20')](removeEntity(_0x39d3c4,null))[_0x05ed('0x43')](handleError(_0x39d3c4,null));}; \ No newline at end of file +var _0x37b6=['limit','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','name','render','merge','message','agent','interaction','account','index','FreshsalesField','fieldName','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','rimraf','zip-dir','fast-json-patch','mustache','util','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x37b6,0x1bb));var _0x637b=function(_0x461e2b,_0xca19dd){_0x461e2b=_0x461e2b-0x0;var _0xbfe26=_0x37b6[_0x461e2b];return _0xbfe26;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x637b('0x0'));var zipdir=require(_0x637b('0x1'));var jsonpatch=require(_0x637b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x637b('0x3'));var util=require(_0x637b('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x637b('0x5'));var fs=require('fs');var fs_extra=require(_0x637b('0x6'));var _=require(_0x637b('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x637b('0x8'));var deskjs=require(_0x637b('0x9'));var toCsv=require(_0x637b('0xa'));var querystring=require(_0x637b('0xb'));var Papa=require(_0x637b('0xc'));var Redis=require('ioredis');var authService=require(_0x637b('0xd'));var qs=require(_0x637b('0xe'));var as=require(_0x637b('0xf'));var hardwareService=require(_0x637b('0x10'));var logger=require(_0x637b('0x11'))('api');var utils=require(_0x637b('0x12'));var config=require(_0x637b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x637b('0x14'))['db'];function respondWithStatusCode(_0x464b1c,_0x31a533){_0x31a533=_0x31a533||0xcc;return function(_0x20fe5e){if(_0x20fe5e){return _0x464b1c['sendStatus'](_0x31a533);}return _0x464b1c[_0x637b('0x15')](_0x31a533)[_0x637b('0x16')]();};}function respondWithResult(_0x45ff3d,_0x55a793){_0x55a793=_0x55a793||0xc8;return function(_0x2af07e){if(_0x2af07e){return _0x45ff3d[_0x637b('0x15')](_0x55a793)[_0x637b('0x17')](_0x2af07e);}};}function respondWithFilteredResult(_0x11bc6c,_0x514a07){return function(_0x51b328){if(_0x51b328){var _0x52615c=typeof _0x514a07['offset']===_0x637b('0x18')&&typeof _0x514a07[_0x637b('0x19')]===_0x637b('0x18');var _0x4f7b2d=_0x51b328[_0x637b('0x1a')];var _0x13aac7=_0x52615c?0x0:_0x514a07['offset'];var _0x1eec5b=_0x52615c?_0x51b328[_0x637b('0x1a')]:_0x514a07[_0x637b('0x1b')]+_0x514a07['limit'];var _0x238c62;if(_0x1eec5b>=_0x4f7b2d){_0x1eec5b=_0x4f7b2d;_0x238c62=0xc8;}else{_0x238c62=0xce;}_0x11bc6c[_0x637b('0x15')](_0x238c62);return _0x11bc6c[_0x637b('0x1c')]('Content-Range',_0x13aac7+'-'+_0x1eec5b+'/'+_0x4f7b2d)[_0x637b('0x17')](_0x51b328);}return null;};}function patchUpdates(_0x13287d){return function(_0xee48d0){try{jsonpatch[_0x637b('0x1d')](_0xee48d0,_0x13287d,!![]);}catch(_0xdafa73){return BPromise[_0x637b('0x1e')](_0xdafa73);}return _0xee48d0[_0x637b('0x1f')]();};}function saveUpdates(_0x52f120,_0x11ce7a){return function(_0x545870){if(_0x545870){return _0x545870[_0x637b('0x20')](_0x52f120)[_0x637b('0x21')](function(_0x479a7c){return _0x479a7c;});}return null;};}function removeEntity(_0x1e8b7f,_0x68fcc4){return function(_0xfcad8f){if(_0xfcad8f){return _0xfcad8f[_0x637b('0x22')]()[_0x637b('0x21')](function(){_0x1e8b7f[_0x637b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26f281,_0x55dd31){return function(_0x5e2699){if(!_0x5e2699){_0x26f281[_0x637b('0x23')](0x194);}return _0x5e2699;};}function handleError(_0x2562b3,_0x12673a){_0x12673a=_0x12673a||0x1f4;return function(_0x1ed667){logger[_0x637b('0x24')](_0x1ed667['stack']);if(_0x1ed667[_0x637b('0x25')]){delete _0x1ed667[_0x637b('0x25')];}_0x2562b3['status'](_0x12673a)['send'](_0x1ed667);};}function getMustacheRender(_0x1e7f2d,_0xa62161){return Mustache[_0x637b('0x26')](_0x1e7f2d,_[_0x637b('0x27')](_0xa62161['body'],{'contact':_0xa62161['contact'],'message':_0xa62161[_0x637b('0x28')],'agent':_0xa62161[_0x637b('0x29')],'interaction':_0xa62161[_0x637b('0x2a')],'account':_0xa62161[_0x637b('0x2b')]}))||'';}exports[_0x637b('0x2c')]=function(_0x507fe2,_0x1d1b55){var _0x32f2c4={},_0x41a9cf={},_0x1b624f={'count':0x0,'rows':[]};var _0x53026f=_['map'](db[_0x637b('0x2d')]['rawAttributes'],function(_0x592abc){return{'name':_0x592abc[_0x637b('0x2e')],'type':_0x592abc['type'][_0x637b('0x2f')]};});_0x41a9cf[_0x637b('0x30')]=_[_0x637b('0x31')](_0x53026f,_0x637b('0x25'));_0x41a9cf['query']=_[_0x637b('0x32')](_0x507fe2[_0x637b('0x33')]);_0x41a9cf[_0x637b('0x34')]=_['intersection'](_0x41a9cf[_0x637b('0x30')],_0x41a9cf[_0x637b('0x33')]);_0x32f2c4[_0x637b('0x35')]=_['intersection'](_0x41a9cf['model'],qs[_0x637b('0x36')](_0x507fe2['query'][_0x637b('0x36')]));_0x32f2c4[_0x637b('0x35')]=_0x32f2c4[_0x637b('0x35')][_0x637b('0x37')]?_0x32f2c4[_0x637b('0x35')]:_0x41a9cf['model'];if(!_0x507fe2['query'][_0x637b('0x38')](_0x637b('0x39'))){_0x32f2c4[_0x637b('0x19')]=qs[_0x637b('0x19')](_0x507fe2[_0x637b('0x33')]['limit']);_0x32f2c4[_0x637b('0x1b')]=qs['offset'](_0x507fe2[_0x637b('0x33')][_0x637b('0x1b')]);}_0x32f2c4[_0x637b('0x3a')]=qs[_0x637b('0x3b')](_0x507fe2[_0x637b('0x33')][_0x637b('0x3b')]);_0x32f2c4[_0x637b('0x3c')]=qs['filters'](_[_0x637b('0x3d')](_0x507fe2['query'],_0x41a9cf['filters']),_0x53026f);if(_0x507fe2[_0x637b('0x33')][_0x637b('0x3e')]){_0x32f2c4[_0x637b('0x3c')]=_[_0x637b('0x27')](_0x32f2c4[_0x637b('0x3c')],{'$or':_[_0x637b('0x31')](_0x53026f,function(_0x3de4c8){if(_0x3de4c8[_0x637b('0x3f')]!==_0x637b('0x40')){var _0x4a6aac={};_0x4a6aac[_0x3de4c8['name']]={'$like':'%'+_0x507fe2[_0x637b('0x33')][_0x637b('0x3e')]+'%'};return _0x4a6aac;}})});}_0x32f2c4=_[_0x637b('0x27')]({},_0x32f2c4,_0x507fe2[_0x637b('0x41')]);var _0x5d39be={'where':_0x32f2c4[_0x637b('0x3c')]};return db[_0x637b('0x2d')][_0x637b('0x1a')](_0x5d39be)[_0x637b('0x21')](function(_0x1bb650){_0x1b624f[_0x637b('0x1a')]=_0x1bb650;if(_0x507fe2[_0x637b('0x33')][_0x637b('0x42')]){_0x32f2c4[_0x637b('0x43')]=[{'all':!![]}];}return db[_0x637b('0x2d')][_0x637b('0x44')](_0x32f2c4);})[_0x637b('0x21')](function(_0x4aae1d){_0x1b624f[_0x637b('0x45')]=_0x4aae1d;return _0x1b624f;})[_0x637b('0x21')](respondWithFilteredResult(_0x1d1b55,_0x32f2c4))[_0x637b('0x46')](handleError(_0x1d1b55,null));};exports[_0x637b('0x47')]=function(_0xba115c,_0x20af2f){var _0x5b5713={'raw':!![],'where':{'id':_0xba115c[_0x637b('0x48')]['id']}},_0x4c29bd={};_0x4c29bd['model']=_['keys'](db[_0x637b('0x2d')][_0x637b('0x49')]);_0x4c29bd[_0x637b('0x33')]=_[_0x637b('0x32')](_0xba115c[_0x637b('0x33')]);_0x4c29bd[_0x637b('0x34')]=_['intersection'](_0x4c29bd[_0x637b('0x30')],_0x4c29bd['query']);_0x5b5713[_0x637b('0x35')]=_[_0x637b('0x4a')](_0x4c29bd['model'],qs['fields'](_0xba115c[_0x637b('0x33')]['fields']));_0x5b5713[_0x637b('0x35')]=_0x5b5713[_0x637b('0x35')][_0x637b('0x37')]?_0x5b5713[_0x637b('0x35')]:_0x4c29bd[_0x637b('0x30')];if(_0xba115c[_0x637b('0x33')]['includeAll']){_0x5b5713[_0x637b('0x43')]=[{'all':!![]}];}_0x5b5713=_[_0x637b('0x27')]({},_0x5b5713,_0xba115c['options']);return db[_0x637b('0x2d')][_0x637b('0x4b')](_0x5b5713)[_0x637b('0x21')](handleEntityNotFound(_0x20af2f,null))[_0x637b('0x21')](respondWithResult(_0x20af2f,null))[_0x637b('0x46')](handleError(_0x20af2f,null));};exports[_0x637b('0x4c')]=function(_0xe5e11,_0x51711f){return db['FreshsalesField'][_0x637b('0x4c')](_0xe5e11[_0x637b('0x4d')],{})['then'](respondWithResult(_0x51711f,0xc9))['catch'](handleError(_0x51711f,null));};exports[_0x637b('0x20')]=function(_0x577ae5,_0x433450){if(_0x577ae5['body']['id']){delete _0x577ae5['body']['id'];}return db[_0x637b('0x2d')][_0x637b('0x4b')]({'where':{'id':_0x577ae5[_0x637b('0x48')]['id']}})[_0x637b('0x21')](handleEntityNotFound(_0x433450,null))[_0x637b('0x21')](saveUpdates(_0x577ae5[_0x637b('0x4d')],null))[_0x637b('0x21')](respondWithResult(_0x433450,null))['catch'](handleError(_0x433450,null));};exports[_0x637b('0x22')]=function(_0x5742be,_0x345248){return db[_0x637b('0x2d')][_0x637b('0x4b')]({'where':{'id':_0x5742be[_0x637b('0x48')]['id']}})[_0x637b('0x21')](handleEntityNotFound(_0x345248,null))[_0x637b('0x21')](removeEntity(_0x345248,null))[_0x637b('0x46')](handleError(_0x345248,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index b4af003..71702b4 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 _0x0b4f=['./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1ca9c1,_0x27e4eb){var _0xa9391e=function(_0x10171a){while(--_0x10171a){_0x1ca9c1['push'](_0x1ca9c1['shift']());}};_0xa9391e(++_0x27e4eb);}(_0x0b4f,0xf6));var _0xf0b4=function(_0x17856a,_0x481a88){_0x17856a=_0x17856a-0x0;var _0x52aff6=_0x0b4f[_0x17856a];return _0x52aff6;};'use strict';var _=require(_0xf0b4('0x0'));var util=require(_0xf0b4('0x1'));var logger=require(_0xf0b4('0x2'))(_0xf0b4('0x3'));var moment=require(_0xf0b4('0x4'));var BPromise=require('bluebird');var rp=require(_0xf0b4('0x5'));var fs=require('fs');var path=require(_0xf0b4('0x6'));var rimraf=require(_0xf0b4('0x7'));var config=require(_0xf0b4('0x8'));var attributes=require(_0xf0b4('0x9'));module[_0xf0b4('0xa')]=function(_0x322bba,_0x27107e){return _0x322bba[_0xf0b4('0xb')](_0xf0b4('0xc'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xf0b4('0xd'),'fields':[_0xf0b4('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f94=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','freshsales_unique_index','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f94,0x1ad));var _0x40f9=function(_0x34c939,_0x3f8b1b){_0x34c939=_0x34c939-0x0;var _0x3c0f65=_0x0f94[_0x34c939];return _0x3c0f65;};'use strict';var _=require(_0x40f9('0x0'));var util=require(_0x40f9('0x1'));var logger=require(_0x40f9('0x2'))(_0x40f9('0x3'));var moment=require(_0x40f9('0x4'));var BPromise=require(_0x40f9('0x5'));var rp=require(_0x40f9('0x6'));var fs=require('fs');var path=require(_0x40f9('0x7'));var rimraf=require(_0x40f9('0x8'));var config=require(_0x40f9('0x9'));var attributes=require(_0x40f9('0xa'));module['exports']=function(_0x1f5c24,_0x4cfc57){return _0x1f5c24[_0x40f9('0xb')](_0x40f9('0xc'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x40f9('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 38eb541..c78d2fa 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 _0xcf8f=['stringify','code','error','FreshsalesField,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then','request\x20sent','debug'];(function(_0xe0c564,_0x2ff569){var _0x32e0f6=function(_0x3fd0fc){while(--_0x3fd0fc){_0xe0c564['push'](_0xe0c564['shift']());}};_0x32e0f6(++_0x2ff569);}(_0xcf8f,0x78));var _0xfcf8=function(_0x4b8021,_0x11dd37){_0x4b8021=_0x4b8021-0x0;var _0x36d34d=_0xcf8f[_0x4b8021];return _0x36d34d;};'use strict';var _=require(_0xfcf8('0x0'));var util=require(_0xfcf8('0x1'));var moment=require(_0xfcf8('0x2'));var BPromise=require('bluebird');var rs=require(_0xfcf8('0x3'));var fs=require('fs');var Redis=require(_0xfcf8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcf8('0x5'));var logger=require(_0xfcf8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfcf8('0x7'));var client=jayson[_0xfcf8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x572efd,_0x6933e3,_0x22627b){return new BPromise(function(_0x12e8e5,_0x305001){return client[_0xfcf8('0x9')](_0x572efd,_0x22627b)[_0xfcf8('0xa')](function(_0x12f969){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x6933e3,_0xfcf8('0xb'));logger[_0xfcf8('0xc')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x6933e3,_0xfcf8('0xb'),JSON[_0xfcf8('0xd')](_0x12f969));if(_0x12f969['error']){if(_0x12f969['error'][_0xfcf8('0xe')]===0x1f4){logger[_0xfcf8('0xf')](_0xfcf8('0x10'),_0x6933e3,_0x12f969[_0xfcf8('0xf')][_0xfcf8('0x11')]);return _0x305001(_0x12f969[_0xfcf8('0xf')][_0xfcf8('0x11')]);}logger[_0xfcf8('0xf')](_0xfcf8('0x10'),_0x6933e3,_0x12f969[_0xfcf8('0xf')]['message']);return _0x12e8e5(_0x12f969[_0xfcf8('0xf')]['message']);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x6933e3,'request\x20sent');_0x12e8e5(_0x12f969['result'][_0xfcf8('0x11')]);}})[_0xfcf8('0x12')](function(_0x22e1dd){logger['error'](_0xfcf8('0x10'),_0x6933e3,_0x22e1dd);_0x305001(_0x22e1dd);});});} \ No newline at end of file +var _0xfaf3=['stringify','error','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','client','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x595ab7,_0x3a7304){var _0x1b564c=function(_0x312bff){while(--_0x312bff){_0x595ab7['push'](_0x595ab7['shift']());}};_0x1b564c(++_0x3a7304);}(_0xfaf3,0x137));var _0x3faf=function(_0x2fd774,_0x31c8a1){_0x2fd774=_0x2fd774-0x0;var _0x51926d=_0xfaf3[_0x2fd774];return _0x51926d;};'use strict';var _=require('lodash');var util=require(_0x3faf('0x0'));var moment=require('moment');var BPromise=require(_0x3faf('0x1'));var rs=require(_0x3faf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3faf('0x3'))['db'];var utils=require(_0x3faf('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3faf('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45ca4f,_0xbb654c,_0x7bae98){return new BPromise(function(_0x2711b1,_0x588a30){return client[_0x3faf('0x6')](_0x45ca4f,_0x7bae98)[_0x3faf('0x7')](function(_0x4482ae){logger[_0x3faf('0x8')](_0x3faf('0x9'),_0xbb654c,_0x3faf('0xa'));logger[_0x3faf('0xb')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0xbb654c,_0x3faf('0xa'),JSON[_0x3faf('0xc')](_0x4482ae));if(_0x4482ae['error']){if(_0x4482ae[_0x3faf('0xd')]['code']===0x1f4){logger[_0x3faf('0xd')](_0x3faf('0x9'),_0xbb654c,_0x4482ae[_0x3faf('0xd')][_0x3faf('0xe')]);return _0x588a30(_0x4482ae[_0x3faf('0xd')][_0x3faf('0xe')]);}logger[_0x3faf('0xd')](_0x3faf('0x9'),_0xbb654c,_0x4482ae[_0x3faf('0xd')]['message']);return _0x2711b1(_0x4482ae[_0x3faf('0xd')][_0x3faf('0xe')]);}else{logger['info'](_0x3faf('0x9'),_0xbb654c,_0x3faf('0xa'));_0x2711b1(_0x4482ae[_0x3faf('0xf')][_0x3faf('0xe')]);}})[_0x3faf('0x10')](function(_0x240596){logger[_0x3faf('0xd')]('FreshsalesField,\x20%s,\x20%s',_0xbb654c,_0x240596);_0x588a30(_0x240596);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 62e8b16..7c53d42 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 _0xcc71=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x37db68,_0x20f6d1){var _0x4fc86f=function(_0x567db6){while(--_0x567db6){_0x37db68['push'](_0x37db68['shift']());}};_0x4fc86f(++_0x20f6d1);}(_0xcc71,0x145));var _0x1cc7=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xcc71[_0x45d55e];return _0x29812a;};'use strict';var multer=require(_0x1cc7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1cc7('0x1'));var express=require(_0x1cc7('0x2'));var router=express['Router']();var fs_extra=require(_0x1cc7('0x3'));var auth=require(_0x1cc7('0x4'));var interaction=require(_0x1cc7('0x5'));var config=require(_0x1cc7('0x6'));var controller=require('./intSalesforceAccount.controller');router[_0x1cc7('0x7')]('/',auth[_0x1cc7('0x8')](),controller[_0x1cc7('0x9')]);router[_0x1cc7('0x7')](_0x1cc7('0xa'),auth['isAuthenticated'](),controller[_0x1cc7('0xb')]);router[_0x1cc7('0x7')](_0x1cc7('0xc'),auth['isAuthenticated'](),controller[_0x1cc7('0xd')]);router[_0x1cc7('0x7')](_0x1cc7('0xe'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x1cc7('0x8')](),controller[_0x1cc7('0xf')]);router['post']('/:id/configurations',auth[_0x1cc7('0x8')](),controller[_0x1cc7('0x10')]);router[_0x1cc7('0x11')](_0x1cc7('0xa'),auth[_0x1cc7('0x8')](),controller[_0x1cc7('0x12')]);router[_0x1cc7('0x13')](_0x1cc7('0xa'),auth[_0x1cc7('0x8')](),controller[_0x1cc7('0x14')]);module[_0x1cc7('0x15')]=router; \ No newline at end of file +var _0x3c7f=['isAuthenticated','index','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','/:id','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3c7f,0x65));var _0xf3c7=function(_0x3dc1e9,_0x20484c){_0x3dc1e9=_0x3dc1e9-0x0;var _0x1a8e32=_0x3c7f[_0x3dc1e9];return _0x1a8e32;};'use strict';var multer=require(_0xf3c7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf3c7('0x1'));var express=require(_0xf3c7('0x2'));var router=express[_0xf3c7('0x3')]();var fs_extra=require(_0xf3c7('0x4'));var auth=require(_0xf3c7('0x5'));var interaction=require(_0xf3c7('0x6'));var config=require(_0xf3c7('0x7'));var controller=require('./intSalesforceAccount.controller');router[_0xf3c7('0x8')]('/',auth[_0xf3c7('0x9')](),controller[_0xf3c7('0xa')]);router[_0xf3c7('0x8')]('/:id',auth[_0xf3c7('0x9')](),controller[_0xf3c7('0xb')]);router[_0xf3c7('0x8')]('/:id/configurations',auth[_0xf3c7('0x9')](),controller[_0xf3c7('0xc')]);router[_0xf3c7('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xf3c7('0xd')]);router[_0xf3c7('0xe')]('/',auth[_0xf3c7('0x9')](),controller[_0xf3c7('0xf')]);router['post'](_0xf3c7('0x10'),auth[_0xf3c7('0x9')](),controller[_0xf3c7('0x11')]);router['put'](_0xf3c7('0x12'),auth[_0xf3c7('0x9')](),controller[_0xf3c7('0x13')]);router[_0xf3c7('0x14')](_0xf3c7('0x12'),auth['isAuthenticated'](),controller[_0xf3c7('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index a4978de..4cad748 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 _0xce0a=['username','integrationTab','newTab','sequelize','STRING'];(function(_0x257bbc,_0x1101e9){var _0x13a941=function(_0x1a02d8){while(--_0x1a02d8){_0x257bbc['push'](_0x257bbc['shift']());}};_0x13a941(++_0x1101e9);}(_0xce0a,0xc1));var _0xace0=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xce0a[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xace0('0x0'));module['exports']={'name':{'type':Sequelize[_0xace0('0x1')]},'description':{'type':Sequelize[_0xace0('0x1')]},'username':{'type':Sequelize[_0xace0('0x1')],'unique':_0xace0('0x2')},'remoteUri':{'type':Sequelize[_0xace0('0x1')]},'password':{'type':Sequelize[_0xace0('0x1')]},'clientId':{'type':Sequelize[_0xace0('0x1')]},'clientSecret':{'type':Sequelize[_0xace0('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xace0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xace0('0x3'),_0xace0('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x9045=['username','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x5da0e9,_0x43c898){var _0x4b022d=function(_0x2aefc2){while(--_0x2aefc2){_0x5da0e9['push'](_0x5da0e9['shift']());}};_0x4b022d(++_0x43c898);}(_0x9045,0x138));var _0x5904=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x9045[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x5904('0x0'));module[_0x5904('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5904('0x2')]},'username':{'type':Sequelize[_0x5904('0x2')],'unique':_0x5904('0x3')},'remoteUri':{'type':Sequelize[_0x5904('0x2')]},'password':{'type':Sequelize[_0x5904('0x2')]},'clientId':{'type':Sequelize[_0x5904('0x2')]},'clientSecret':{'type':Sequelize[_0x5904('0x2')]},'securityToken':{'type':Sequelize[_0x5904('0x2')]},'serverUrl':{'type':Sequelize[_0x5904('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5904('0x4')](_0x5904('0x5'),_0x5904('0x6')),'defaultValue':_0x5904('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 4677632..596882f 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 _0xa5bc=['slice','substring','lastIndexOf','clientId','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','string','int','boolean','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','end','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','findOne','SalesforceConfiguration','getConfigurations','nolimit','addConfiguration','getSubjects','channel','getDescriptions','create','SalesforceField','Subjects','getFields','Task','clientSecret','password'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa5bc,0x132));var _0xca5b=function(_0x2e35ba,_0x35a5b7){_0x2e35ba=_0x2e35ba-0x0;var _0x920767=_0xa5bc[_0x2e35ba];return _0x920767;};'use strict';var emlformat=require(_0xca5b('0x0'));var rimraf=require(_0xca5b('0x1'));var zipdir=require(_0xca5b('0x2'));var jsonpatch=require(_0xca5b('0x3'));var rp=require(_0xca5b('0x4'));var moment=require(_0xca5b('0x5'));var BPromise=require(_0xca5b('0x6'));var Mustache=require(_0xca5b('0x7'));var util=require(_0xca5b('0x8'));var path=require(_0xca5b('0x9'));var sox=require('sox');var csv=require(_0xca5b('0xa'));var ejs=require(_0xca5b('0xb'));var fs=require('fs');var fs_extra=require(_0xca5b('0xc'));var _=require(_0xca5b('0xd'));var squel=require(_0xca5b('0xe'));var crypto=require(_0xca5b('0xf'));var jsforce=require(_0xca5b('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xca5b('0xa'));var querystring=require(_0xca5b('0x11'));var Papa=require(_0xca5b('0x12'));var Redis=require(_0xca5b('0x13'));var authService=require(_0xca5b('0x14'));var qs=require(_0xca5b('0x15'));var as=require(_0xca5b('0x16'));var hardwareService=require(_0xca5b('0x17'));var logger=require(_0xca5b('0x18'))('api');var utils=require(_0xca5b('0x19'));var config=require(_0xca5b('0x1a'));var licenseUtil=require(_0xca5b('0x1b'));var db=require(_0xca5b('0x1c'))['db'];var integrations=require(_0xca5b('0x1d'));var jayson=require(_0xca5b('0x1e'));var client=jayson[_0xca5b('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a5cdd,_0x4c69c9,_0x4f9105,_0x1d2430){return new BPromise(function(_0x4687ab,_0x2bc9d2){var _0xd771d1=_0x1d2430||client;return _0xd771d1[_0xca5b('0x20')](_0x1a5cdd,_0x4f9105)[_0xca5b('0x21')](function(_0x311459){logger[_0xca5b('0x22')](_0xca5b('0x23'),_0x4c69c9,_0xca5b('0x24'));logger[_0xca5b('0x25')](_0xca5b('0x26'),_0x4c69c9,_0xca5b('0x24'),JSON[_0xca5b('0x27')](_0x311459));if(_0x311459[_0xca5b('0x28')]){if(_0x311459[_0xca5b('0x28')]['code']===0x1f4){logger[_0xca5b('0x28')]('SalesforceAccount,\x20%s,\x20%s',_0x4c69c9,_0x311459[_0xca5b('0x28')][_0xca5b('0x29')]);return _0x2bc9d2(_0x311459[_0xca5b('0x28')][_0xca5b('0x29')]);}logger['error'](_0xca5b('0x23'),_0x4c69c9,_0x311459[_0xca5b('0x28')][_0xca5b('0x29')]);return _0x4687ab(_0x311459[_0xca5b('0x28')][_0xca5b('0x29')]);}else{logger[_0xca5b('0x22')](_0xca5b('0x23'),_0x4c69c9,'request\x20sent');_0x4687ab(_0x311459[_0xca5b('0x2a')]['message']);}})['catch'](function(_0xf95b20){logger[_0xca5b('0x28')]('SalesforceAccount,\x20%s,\x20%s',_0x4c69c9,_0xf95b20);_0x2bc9d2(_0xf95b20);});});}function respondWithStatusCode(_0x5ae860,_0x5dd452){_0x5dd452=_0x5dd452||0xcc;return function(_0x67f67f){if(_0x67f67f){return _0x5ae860[_0xca5b('0x2b')](_0x5dd452);}return _0x5ae860[_0xca5b('0x2c')](_0x5dd452)['end']();};}function respondWithResult(_0x44ce12,_0x5394ae){_0x5394ae=_0x5394ae||0xc8;return function(_0x146d43){if(_0x146d43){return _0x44ce12[_0xca5b('0x2c')](_0x5394ae)[_0xca5b('0x2d')](_0x146d43);}};}function respondWithFilteredResult(_0x2c57ea,_0x1c45dc){return function(_0x329340){if(_0x329340){var _0x6e5abc=typeof _0x1c45dc[_0xca5b('0x2e')]===_0xca5b('0x2f')&&typeof _0x1c45dc[_0xca5b('0x30')]===_0xca5b('0x2f');var _0x287211=_0x329340[_0xca5b('0x31')];var _0x58cbd3=_0x6e5abc?0x0:_0x1c45dc[_0xca5b('0x2e')];var _0x48dcd9=_0x6e5abc?_0x329340[_0xca5b('0x31')]:_0x1c45dc[_0xca5b('0x2e')]+_0x1c45dc['limit'];var _0x32bf04;if(_0x48dcd9>=_0x287211){_0x48dcd9=_0x287211;_0x32bf04=0xc8;}else{_0x32bf04=0xce;}_0x2c57ea['status'](_0x32bf04);return _0x2c57ea[_0xca5b('0x32')](_0xca5b('0x33'),_0x58cbd3+'-'+_0x48dcd9+'/'+_0x287211)[_0xca5b('0x2d')](_0x329340);}return null;};}function patchUpdates(_0x5689d4){return function(_0xfc05d9){try{jsonpatch['apply'](_0xfc05d9,_0x5689d4,!![]);}catch(_0x15d96b){return BPromise['reject'](_0x15d96b);}return _0xfc05d9[_0xca5b('0x34')]();};}function saveUpdates(_0x1a48ff,_0xae8e72){return function(_0x4af96c){if(_0x4af96c){return _0x4af96c[_0xca5b('0x35')](_0x1a48ff)[_0xca5b('0x21')](function(_0x8d7ab5){return _0x8d7ab5;});}return null;};}function removeEntity(_0x286032,_0x5f5b45){return function(_0x56c4ed){if(_0x56c4ed){return _0x56c4ed[_0xca5b('0x36')]()[_0xca5b('0x21')](function(){_0x286032[_0xca5b('0x2c')](0xcc)[_0xca5b('0x37')]();});}};}function handleEntityNotFound(_0x4c8be6,_0x1e326b){return function(_0x111a51){if(!_0x111a51){_0x4c8be6['sendStatus'](0x194);}return _0x111a51;};}function handleError(_0x5c97dc,_0x354e6e){_0x354e6e=_0x354e6e||0x1f4;return function(_0x5359f3){logger['error'](_0x5359f3[_0xca5b('0x38')]);if(_0x5359f3[_0xca5b('0x39')]){delete _0x5359f3[_0xca5b('0x39')];}_0x5c97dc['status'](_0x354e6e)[_0xca5b('0x3a')](_0x5359f3);};}function getMustacheRender(_0x96af91,_0x3dd7d9){return Mustache[_0xca5b('0x3b')](_0x96af91,_[_0xca5b('0x3c')](_0x3dd7d9[_0xca5b('0x3d')],{'contact':_0x3dd7d9[_0xca5b('0x3e')],'message':_0x3dd7d9[_0xca5b('0x29')],'agent':_0x3dd7d9[_0xca5b('0x3f')],'interaction':_0x3dd7d9[_0xca5b('0x40')],'account':_0x3dd7d9[_0xca5b('0x41')]}))||'';}exports[_0xca5b('0x42')]=function(_0x37391c,_0x283fcf){var _0x412b26={},_0x5a0fe0={},_0x1e9b70={'count':0x0,'rows':[]};var _0xd81b1d=_[_0xca5b('0x43')](db[_0xca5b('0x44')][_0xca5b('0x45')],function(_0x1ba543){return{'name':_0x1ba543[_0xca5b('0x46')],'type':_0x1ba543[_0xca5b('0x47')][_0xca5b('0x48')]};});_0x5a0fe0[_0xca5b('0x49')]=_[_0xca5b('0x43')](_0xd81b1d,_0xca5b('0x39'));_0x5a0fe0[_0xca5b('0x4a')]=_[_0xca5b('0x4b')](_0x37391c[_0xca5b('0x4a')]);_0x5a0fe0[_0xca5b('0x4c')]=_[_0xca5b('0x4d')](_0x5a0fe0[_0xca5b('0x49')],_0x5a0fe0[_0xca5b('0x4a')]);_0x412b26[_0xca5b('0x4e')]=_['intersection'](_0x5a0fe0['model'],qs[_0xca5b('0x4f')](_0x37391c[_0xca5b('0x4a')]['fields']));_0x412b26['attributes']=_0x412b26[_0xca5b('0x4e')][_0xca5b('0x50')]?_0x412b26['attributes']:_0x5a0fe0['model'];if(!_0x37391c['query'][_0xca5b('0x51')]('nolimit')){_0x412b26[_0xca5b('0x30')]=qs[_0xca5b('0x30')](_0x37391c['query'][_0xca5b('0x30')]);_0x412b26[_0xca5b('0x2e')]=qs[_0xca5b('0x2e')](_0x37391c[_0xca5b('0x4a')][_0xca5b('0x2e')]);}_0x412b26[_0xca5b('0x52')]=qs[_0xca5b('0x53')](_0x37391c['query'][_0xca5b('0x53')]);_0x412b26['where']=qs[_0xca5b('0x4c')](_[_0xca5b('0x54')](_0x37391c[_0xca5b('0x4a')],_0x5a0fe0[_0xca5b('0x4c')]),_0xd81b1d);if(_0x37391c[_0xca5b('0x4a')][_0xca5b('0x55')]){_0x412b26[_0xca5b('0x56')]=_[_0xca5b('0x3c')](_0x412b26[_0xca5b('0x56')],{'$or':_[_0xca5b('0x43')](_0xd81b1d,function(_0x1924b5){if(_0x1924b5[_0xca5b('0x47')]!==_0xca5b('0x57')){var _0x86131={};_0x86131[_0x1924b5['name']]={'$like':'%'+_0x37391c['query'][_0xca5b('0x55')]+'%'};return _0x86131;}})});}_0x412b26=_[_0xca5b('0x3c')]({},_0x412b26,_0x37391c[_0xca5b('0x58')]);var _0xf7c0b8={'where':_0x412b26[_0xca5b('0x56')]};return db[_0xca5b('0x44')]['count'](_0xf7c0b8)[_0xca5b('0x21')](function(_0x35f9d2){_0x1e9b70[_0xca5b('0x31')]=_0x35f9d2;if(_0x37391c[_0xca5b('0x4a')][_0xca5b('0x59')]){_0x412b26[_0xca5b('0x5a')]=[{'all':!![]}];}return db[_0xca5b('0x44')][_0xca5b('0x5b')](_0x412b26);})[_0xca5b('0x21')](function(_0x9cfdf3){_0x1e9b70[_0xca5b('0x5c')]=_0x9cfdf3;return _0x1e9b70;})['then'](respondWithFilteredResult(_0x283fcf,_0x412b26))[_0xca5b('0x5d')](handleError(_0x283fcf,null));};exports['show']=function(_0x544f1f,_0x43797b){var _0x3fb830={'raw':![],'where':{'id':_0x544f1f[_0xca5b('0x5e')]['id']}},_0x3180e9={};_0x3180e9[_0xca5b('0x49')]=_[_0xca5b('0x4b')](db[_0xca5b('0x44')][_0xca5b('0x45')]);_0x3180e9['query']=_[_0xca5b('0x4b')](_0x544f1f[_0xca5b('0x4a')]);_0x3180e9[_0xca5b('0x4c')]=_[_0xca5b('0x4d')](_0x3180e9['model'],_0x3180e9[_0xca5b('0x4a')]);_0x3fb830[_0xca5b('0x4e')]=_[_0xca5b('0x4d')](_0x3180e9[_0xca5b('0x49')],qs[_0xca5b('0x4f')](_0x544f1f['query'][_0xca5b('0x4f')]));_0x3fb830[_0xca5b('0x4e')]=_0x3fb830[_0xca5b('0x4e')][_0xca5b('0x50')]?_0x3fb830[_0xca5b('0x4e')]:_0x3180e9[_0xca5b('0x49')];if(_0x544f1f[_0xca5b('0x4a')][_0xca5b('0x59')]){_0x3fb830['include']=[{'all':!![]}];}_0x3fb830=_[_0xca5b('0x3c')]({},_0x3fb830,_0x544f1f[_0xca5b('0x58')]);return db[_0xca5b('0x44')]['find'](_0x3fb830)[_0xca5b('0x21')](handleEntityNotFound(_0x43797b,null))['then'](respondWithResult(_0x43797b,null))[_0xca5b('0x5d')](handleError(_0x43797b,null));};exports['create']=function(_0x2b6bbd,_0x4fadc0){return db[_0xca5b('0x44')]['create'](_0x2b6bbd[_0xca5b('0x3d')],{})['then'](respondWithResult(_0x4fadc0,0xc9))[_0xca5b('0x5d')](handleError(_0x4fadc0,null));};exports[_0xca5b('0x35')]=function(_0x4adfbb,_0x2e0b03){if(_0x4adfbb[_0xca5b('0x3d')]['id']){delete _0x4adfbb[_0xca5b('0x3d')]['id'];}return db['SalesforceAccount'][_0xca5b('0x5f')]({'where':{'id':_0x4adfbb['params']['id']}})[_0xca5b('0x21')](handleEntityNotFound(_0x2e0b03,null))[_0xca5b('0x21')](saveUpdates(_0x4adfbb[_0xca5b('0x3d')],null))['then'](respondWithResult(_0x2e0b03,null))[_0xca5b('0x5d')](handleError(_0x2e0b03,null));};exports[_0xca5b('0x36')]=function(_0x959e3,_0x2bc663){return db[_0xca5b('0x44')][_0xca5b('0x5f')]({'where':{'id':_0x959e3[_0xca5b('0x5e')]['id']}})[_0xca5b('0x21')](handleEntityNotFound(_0x2bc663,null))['then'](removeEntity(_0x2bc663,null))[_0xca5b('0x5d')](handleError(_0x2bc663,null));};exports['getConfigurations']=function(_0x4a7cdc,_0x10a36a,_0x594017){var _0x24dcc0={};var _0xa0a5da={};var _0x7ea8c9;var _0x2bba3e;return db[_0xca5b('0x44')][_0xca5b('0x60')]({'where':{'id':_0x4a7cdc[_0xca5b('0x5e')]['id']}})[_0xca5b('0x21')](handleEntityNotFound(_0x10a36a,null))['then'](function(_0x32a23f){if(_0x32a23f){_0x7ea8c9=_0x32a23f;_0xa0a5da['model']=_[_0xca5b('0x4b')](db[_0xca5b('0x61')][_0xca5b('0x45')]);_0xa0a5da[_0xca5b('0x4a')]=_[_0xca5b('0x4b')](_0x4a7cdc[_0xca5b('0x4a')]);_0xa0a5da[_0xca5b('0x4c')]=_[_0xca5b('0x4d')](_0xa0a5da[_0xca5b('0x49')],_0xa0a5da[_0xca5b('0x4a')]);_0x24dcc0['attributes']=_[_0xca5b('0x4d')](_0xa0a5da['model'],qs[_0xca5b('0x4f')](_0x4a7cdc['query'][_0xca5b('0x4f')]));_0x24dcc0[_0xca5b('0x4e')]=_0x24dcc0[_0xca5b('0x4e')][_0xca5b('0x50')]?_0x24dcc0['attributes']:_0xa0a5da[_0xca5b('0x49')];_0x24dcc0[_0xca5b('0x52')]=qs[_0xca5b('0x53')](_0x4a7cdc[_0xca5b('0x4a')][_0xca5b('0x53')]);_0x24dcc0[_0xca5b('0x56')]=qs['filters'](_[_0xca5b('0x54')](_0x4a7cdc['query'],_0xa0a5da[_0xca5b('0x4c')]));if(_0x4a7cdc[_0xca5b('0x4a')][_0xca5b('0x55')]){_0x24dcc0[_0xca5b('0x56')]=_[_0xca5b('0x3c')](_0x24dcc0[_0xca5b('0x56')],{'$or':_[_0xca5b('0x43')](_0x24dcc0[_0xca5b('0x4e')],function(_0x2f986c){var _0x34f97e={};_0x34f97e[_0x2f986c]={'$like':'%'+_0x4a7cdc[_0xca5b('0x4a')][_0xca5b('0x55')]+'%'};return _0x34f97e;})});}_0x24dcc0=_[_0xca5b('0x3c')]({},_0x24dcc0,_0x4a7cdc[_0xca5b('0x58')]);return _0x7ea8c9[_0xca5b('0x62')](_0x24dcc0);}})['then'](function(_0x4ec8f4){if(_0x4ec8f4){_0x2bba3e=_0x4ec8f4[_0xca5b('0x50')];if(!_0x4a7cdc[_0xca5b('0x4a')]['hasOwnProperty'](_0xca5b('0x63'))){_0x24dcc0[_0xca5b('0x30')]=qs[_0xca5b('0x30')](_0x4a7cdc[_0xca5b('0x4a')][_0xca5b('0x30')]);_0x24dcc0[_0xca5b('0x2e')]=qs['offset'](_0x4a7cdc[_0xca5b('0x4a')]['offset']);}return _0x7ea8c9[_0xca5b('0x62')](_0x24dcc0);}})[_0xca5b('0x21')](function(_0x1bfc0d){if(_0x1bfc0d){return _0x1bfc0d?{'count':_0x2bba3e,'rows':_0x1bfc0d}:null;}})[_0xca5b('0x21')](respondWithResult(_0x10a36a,null))['catch'](handleError(_0x10a36a,null));};exports[_0xca5b('0x64')]=function(_0x5f32dd,_0x16e7dc,_0x23ce26){if(_0x5f32dd[_0xca5b('0x3d')]['id']){delete _0x5f32dd['body']['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x5f32dd[_0xca5b('0x5e')]['id']}})[_0xca5b('0x21')](handleEntityNotFound(_0x16e7dc,null))['then'](function(_0x5a1238){if(_0x5a1238){_0x5f32dd['body']['AccountId']=_0x5a1238['id'];_0x5f32dd[_0xca5b('0x3d')]['Subjects']=integrations[_0xca5b('0x65')](_0x5f32dd[_0xca5b('0x3d')][_0xca5b('0x66')],_0x5f32dd[_0xca5b('0x3d')][_0xca5b('0x47')]);_0x5f32dd[_0xca5b('0x3d')]['Descriptions']=integrations[_0xca5b('0x67')](_0x5f32dd[_0xca5b('0x3d')][_0xca5b('0x66')],_0x5f32dd['body']['type']);return db[_0xca5b('0x61')][_0xca5b('0x68')](_0x5f32dd[_0xca5b('0x3d')],{'include':[{'model':db[_0xca5b('0x69')],'as':_0xca5b('0x6a')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0xca5b('0x21')](respondWithResult(_0x16e7dc,null))[_0xca5b('0x5d')](handleError(_0x16e7dc,null));};exports[_0xca5b('0x6b')]=function(_0x4d7136,_0xa52740,_0x2fc9b7){var _0x577196;var _0x149dd9='';var _0x2c4d67=_0xca5b('0x6c');return db[_0xca5b('0x44')][_0xca5b('0x60')]({'where':{'id':_0x4d7136['params']['id']},'attributes':['id','remoteUri','clientId',_0xca5b('0x6d'),'username',_0xca5b('0x6e'),'securityToken']})[_0xca5b('0x21')](handleEntityNotFound(_0xa52740,null))[_0xca5b('0x21')](function(_0x31657f){if(_0x31657f){_0x149dd9=_0x31657f['remoteUri'];var _0x1dc14d=_0x149dd9[_0xca5b('0x6f')](-0x1);if(_0x1dc14d==='/'){_0x149dd9=_0x149dd9[_0xca5b('0x70')](0x0,_0x149dd9[_0xca5b('0x71')](_0x1dc14d));}_0x577196=new jsforce['Connection']({'oauth2':{'loginUrl':_0x149dd9,'clientId':_0x31657f[_0xca5b('0x72')],'clientSecret':_0x31657f[_0xca5b('0x6d')]}});return _0x577196['login'](_0x31657f['username'],_0x31657f[_0xca5b('0x6e')]['concat'](_0x31657f['securityToken']));}})[_0xca5b('0x21')](function(_0xe3e86a){if(_0xe3e86a){if(!_[_0xca5b('0x73')](_0x4d7136[_0xca5b('0x4a')][_0xca5b('0x74')])){_0x2c4d67=_0x4d7136[_0xca5b('0x4a')][_0xca5b('0x74')];}return _0x577196['sobject'](_0x2c4d67)[_0xca5b('0x75')]();}})[_0xca5b('0x21')](function(_0x112a21){var _0x3c50d6=[_0xca5b('0x76'),_0xca5b('0x77'),_0xca5b('0x78'),'IsRecurrence',_0xca5b('0x79'),_0xca5b('0x7a')];var _0x958fb3=[_0xca5b('0x7b'),_0xca5b('0x7c'),'picklist',_0xca5b('0x7d'),'email','textarea',_0xca5b('0x7e')];if(_0x112a21){_[_0xca5b('0x7f')](_0x112a21['fields'],function(_0x5881e8){return _0x3c50d6['includes'](_0x5881e8['name'])||!_0x958fb3[_0xca5b('0x80')](_0x5881e8['type']);});return{'count':_0x112a21['fields']['length'],'rows':_[_0xca5b('0x43')](_0x112a21['fields'],function(_0x2460ff){return{'id':_0x2460ff[_0xca5b('0x39')],'name':_0x2460ff[_0xca5b('0x81')],'custom':_0x2460ff[_0xca5b('0x82')],'options':_0x2460ff[_0xca5b('0x83')]['length']>0x0?_['map'](_0x2460ff[_0xca5b('0x83')],function(_0x1b1736){return{'name':_0x1b1736[_0xca5b('0x81')],'value':_0x1b1736[_0xca5b('0x84')]};}):_0x2460ff[_0xca5b('0x47')]=='boolean'?[{'name':_0xca5b('0x85'),'value':_0xca5b('0x86')},{'name':_0xca5b('0x87'),'value':_0xca5b('0x88')}]:[]};})};}})[_0xca5b('0x21')](respondWithResult(_0xa52740,null))[_0xca5b('0x5d')](function(_0x2fd4e1){var _0x14c08f=_0x4d7136['query'][_0xca5b('0x89')]?0x1f4:_0x2fd4e1[_0xca5b('0x8a')]||0x1f4;logger[_0xca5b('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xca5b('0x6b'),_0x14c08f,JSON[_0xca5b('0x27')](_0x2fd4e1));delete _0x2fd4e1[_0xca5b('0x39')];if(_0x14c08f===0x191){_0x14c08f=0x190;}_0xa52740[_0xca5b('0x2c')](_0x14c08f)[_0xca5b('0x3a')](_0x4d7136['query'][_0xca5b('0x89')]?{'message':'Wrong\x20credentials','statusCode':_0x2fd4e1[_0xca5b('0x8a')]}:_0x2fd4e1);});}; \ No newline at end of file +var _0x7edf=['status','stack','name','send','render','body','contact','agent','interaction','account','index','SalesforceAccount','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','keys','find','create','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','phone','includes','label','picklistValues','value','true','False','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy'];(function(_0x1bf424,_0x33ce7d){var _0x53f515=function(_0x1d796f){while(--_0x1d796f){_0x1bf424['push'](_0x1bf424['shift']());}};_0x53f515(++_0x33ce7d);}(_0x7edf,0x17a));var _0xf7ed=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0x7edf[_0x1034bb];return _0x453fdb;};'use strict';var emlformat=require(_0xf7ed('0x0'));var rimraf=require(_0xf7ed('0x1'));var zipdir=require(_0xf7ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7ed('0x3'));var moment=require(_0xf7ed('0x4'));var BPromise=require(_0xf7ed('0x5'));var Mustache=require(_0xf7ed('0x6'));var util=require('util');var path=require(_0xf7ed('0x7'));var sox=require(_0xf7ed('0x8'));var csv=require(_0xf7ed('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7ed('0xa'));var _=require(_0xf7ed('0xb'));var squel=require(_0xf7ed('0xc'));var crypto=require(_0xf7ed('0xd'));var jsforce=require(_0xf7ed('0xe'));var deskjs=require(_0xf7ed('0xf'));var toCsv=require(_0xf7ed('0x9'));var querystring=require('querystring');var Papa=require(_0xf7ed('0x10'));var Redis=require(_0xf7ed('0x11'));var authService=require(_0xf7ed('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf7ed('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7ed('0x14'))('api');var utils=require(_0xf7ed('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf7ed('0x16'))['db'];var integrations=require(_0xf7ed('0x17'));var jayson=require(_0xf7ed('0x18'));var client=jayson[_0xf7ed('0x19')][_0xf7ed('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4ec488,_0x429328,_0x27ce42,_0xdfe060){return new BPromise(function(_0x29a561,_0x5d3fed){var _0x5502b2=_0xdfe060||client;return _0x5502b2[_0xf7ed('0x1b')](_0x4ec488,_0x27ce42)['then'](function(_0x58ae94){logger[_0xf7ed('0x1c')](_0xf7ed('0x1d'),_0x429328,_0xf7ed('0x1e'));logger[_0xf7ed('0x1f')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x429328,'request\x20sent',JSON[_0xf7ed('0x20')](_0x58ae94));if(_0x58ae94[_0xf7ed('0x21')]){if(_0x58ae94[_0xf7ed('0x21')][_0xf7ed('0x22')]===0x1f4){logger[_0xf7ed('0x21')](_0xf7ed('0x1d'),_0x429328,_0x58ae94['error'][_0xf7ed('0x23')]);return _0x5d3fed(_0x58ae94['error']['message']);}logger['error'](_0xf7ed('0x1d'),_0x429328,_0x58ae94[_0xf7ed('0x21')][_0xf7ed('0x23')]);return _0x29a561(_0x58ae94[_0xf7ed('0x21')][_0xf7ed('0x23')]);}else{logger[_0xf7ed('0x1c')]('SalesforceAccount,\x20%s,\x20%s',_0x429328,'request\x20sent');_0x29a561(_0x58ae94['result'][_0xf7ed('0x23')]);}})[_0xf7ed('0x24')](function(_0x4966b3){logger[_0xf7ed('0x21')](_0xf7ed('0x1d'),_0x429328,_0x4966b3);_0x5d3fed(_0x4966b3);});});}function respondWithStatusCode(_0x50fec6,_0x1c407a){_0x1c407a=_0x1c407a||0xcc;return function(_0x32a88e){if(_0x32a88e){return _0x50fec6[_0xf7ed('0x25')](_0x1c407a);}return _0x50fec6['status'](_0x1c407a)[_0xf7ed('0x26')]();};}function respondWithResult(_0x37e5ca,_0x3070d5){_0x3070d5=_0x3070d5||0xc8;return function(_0x1b56cf){if(_0x1b56cf){return _0x37e5ca['status'](_0x3070d5)[_0xf7ed('0x27')](_0x1b56cf);}};}function respondWithFilteredResult(_0x2717d5,_0x183c4c){return function(_0x5a0699){if(_0x5a0699){var _0x99a237=typeof _0x183c4c[_0xf7ed('0x28')]===_0xf7ed('0x29')&&typeof _0x183c4c[_0xf7ed('0x2a')]==='undefined';var _0x312c7c=_0x5a0699[_0xf7ed('0x2b')];var _0x289c65=_0x99a237?0x0:_0x183c4c[_0xf7ed('0x28')];var _0x4e432c=_0x99a237?_0x5a0699['count']:_0x183c4c['offset']+_0x183c4c[_0xf7ed('0x2a')];var _0x55a510;if(_0x4e432c>=_0x312c7c){_0x4e432c=_0x312c7c;_0x55a510=0xc8;}else{_0x55a510=0xce;}_0x2717d5['status'](_0x55a510);return _0x2717d5[_0xf7ed('0x2c')]('Content-Range',_0x289c65+'-'+_0x4e432c+'/'+_0x312c7c)[_0xf7ed('0x27')](_0x5a0699);}return null;};}function patchUpdates(_0x3f023f){return function(_0x46984e){try{jsonpatch[_0xf7ed('0x2d')](_0x46984e,_0x3f023f,!![]);}catch(_0x284156){return BPromise[_0xf7ed('0x2e')](_0x284156);}return _0x46984e[_0xf7ed('0x2f')]();};}function saveUpdates(_0x10992d,_0x4cd92b){return function(_0x32c199){if(_0x32c199){return _0x32c199[_0xf7ed('0x30')](_0x10992d)[_0xf7ed('0x31')](function(_0x28fc88){return _0x28fc88;});}return null;};}function removeEntity(_0x39e771,_0x1a0b2c){return function(_0xa98d13){if(_0xa98d13){return _0xa98d13[_0xf7ed('0x32')]()[_0xf7ed('0x31')](function(){_0x39e771[_0xf7ed('0x33')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d1d2f,_0x320339){return function(_0x72c10c){if(!_0x72c10c){_0x5d1d2f[_0xf7ed('0x25')](0x194);}return _0x72c10c;};}function handleError(_0x52ef23,_0x4e2edd){_0x4e2edd=_0x4e2edd||0x1f4;return function(_0x5e4d94){logger[_0xf7ed('0x21')](_0x5e4d94[_0xf7ed('0x34')]);if(_0x5e4d94[_0xf7ed('0x35')]){delete _0x5e4d94['name'];}_0x52ef23['status'](_0x4e2edd)[_0xf7ed('0x36')](_0x5e4d94);};}function getMustacheRender(_0x3319e5,_0x1ae947){return Mustache[_0xf7ed('0x37')](_0x3319e5,_['merge'](_0x1ae947[_0xf7ed('0x38')],{'contact':_0x1ae947[_0xf7ed('0x39')],'message':_0x1ae947[_0xf7ed('0x23')],'agent':_0x1ae947[_0xf7ed('0x3a')],'interaction':_0x1ae947[_0xf7ed('0x3b')],'account':_0x1ae947[_0xf7ed('0x3c')]}))||'';}exports[_0xf7ed('0x3d')]=function(_0x5e0de1,_0x5537c8){var _0x1fdb1e={},_0x9bdb69={},_0x2b3100={'count':0x0,'rows':[]};var _0x146ea2=_['map'](db[_0xf7ed('0x3e')][_0xf7ed('0x3f')],function(_0x511021){return{'name':_0x511021[_0xf7ed('0x40')],'type':_0x511021['type'][_0xf7ed('0x41')]};});_0x9bdb69[_0xf7ed('0x42')]=_[_0xf7ed('0x43')](_0x146ea2,_0xf7ed('0x35'));_0x9bdb69[_0xf7ed('0x44')]=_['keys'](_0x5e0de1[_0xf7ed('0x44')]);_0x9bdb69[_0xf7ed('0x45')]=_[_0xf7ed('0x46')](_0x9bdb69[_0xf7ed('0x42')],_0x9bdb69[_0xf7ed('0x44')]);_0x1fdb1e[_0xf7ed('0x47')]=_[_0xf7ed('0x46')](_0x9bdb69[_0xf7ed('0x42')],qs[_0xf7ed('0x48')](_0x5e0de1[_0xf7ed('0x44')][_0xf7ed('0x48')]));_0x1fdb1e['attributes']=_0x1fdb1e[_0xf7ed('0x47')][_0xf7ed('0x49')]?_0x1fdb1e[_0xf7ed('0x47')]:_0x9bdb69[_0xf7ed('0x42')];if(!_0x5e0de1[_0xf7ed('0x44')][_0xf7ed('0x4a')](_0xf7ed('0x4b'))){_0x1fdb1e[_0xf7ed('0x2a')]=qs[_0xf7ed('0x2a')](_0x5e0de1[_0xf7ed('0x44')]['limit']);_0x1fdb1e[_0xf7ed('0x28')]=qs[_0xf7ed('0x28')](_0x5e0de1[_0xf7ed('0x44')][_0xf7ed('0x28')]);}_0x1fdb1e[_0xf7ed('0x4c')]=qs['sort'](_0x5e0de1[_0xf7ed('0x44')][_0xf7ed('0x4d')]);_0x1fdb1e[_0xf7ed('0x4e')]=qs[_0xf7ed('0x45')](_[_0xf7ed('0x4f')](_0x5e0de1['query'],_0x9bdb69[_0xf7ed('0x45')]),_0x146ea2);if(_0x5e0de1['query'][_0xf7ed('0x50')]){_0x1fdb1e[_0xf7ed('0x4e')]=_['merge'](_0x1fdb1e[_0xf7ed('0x4e')],{'$or':_['map'](_0x146ea2,function(_0xb5c11a){if(_0xb5c11a[_0xf7ed('0x51')]!==_0xf7ed('0x52')){var _0x3c1eab={};_0x3c1eab[_0xb5c11a[_0xf7ed('0x35')]]={'$like':'%'+_0x5e0de1[_0xf7ed('0x44')][_0xf7ed('0x50')]+'%'};return _0x3c1eab;}})});}_0x1fdb1e=_[_0xf7ed('0x53')]({},_0x1fdb1e,_0x5e0de1[_0xf7ed('0x54')]);var _0x52568b={'where':_0x1fdb1e[_0xf7ed('0x4e')]};return db[_0xf7ed('0x3e')][_0xf7ed('0x2b')](_0x52568b)[_0xf7ed('0x31')](function(_0x164e92){_0x2b3100[_0xf7ed('0x2b')]=_0x164e92;if(_0x5e0de1[_0xf7ed('0x44')][_0xf7ed('0x55')]){_0x1fdb1e[_0xf7ed('0x56')]=[{'all':!![]}];}return db[_0xf7ed('0x3e')][_0xf7ed('0x57')](_0x1fdb1e);})[_0xf7ed('0x31')](function(_0x978495){_0x2b3100['rows']=_0x978495;return _0x2b3100;})['then'](respondWithFilteredResult(_0x5537c8,_0x1fdb1e))['catch'](handleError(_0x5537c8,null));};exports[_0xf7ed('0x58')]=function(_0x5e64f1,_0xff0382){var _0x233db0={'raw':![],'where':{'id':_0x5e64f1[_0xf7ed('0x59')]['id']}},_0x535cb7={};_0x535cb7[_0xf7ed('0x42')]=_[_0xf7ed('0x5a')](db['SalesforceAccount'][_0xf7ed('0x3f')]);_0x535cb7['query']=_[_0xf7ed('0x5a')](_0x5e64f1['query']);_0x535cb7['filters']=_[_0xf7ed('0x46')](_0x535cb7[_0xf7ed('0x42')],_0x535cb7[_0xf7ed('0x44')]);_0x233db0[_0xf7ed('0x47')]=_[_0xf7ed('0x46')](_0x535cb7['model'],qs[_0xf7ed('0x48')](_0x5e64f1['query'][_0xf7ed('0x48')]));_0x233db0[_0xf7ed('0x47')]=_0x233db0[_0xf7ed('0x47')]['length']?_0x233db0[_0xf7ed('0x47')]:_0x535cb7[_0xf7ed('0x42')];if(_0x5e64f1['query'][_0xf7ed('0x55')]){_0x233db0['include']=[{'all':!![]}];}_0x233db0=_[_0xf7ed('0x53')]({},_0x233db0,_0x5e64f1['options']);return db[_0xf7ed('0x3e')][_0xf7ed('0x5b')](_0x233db0)[_0xf7ed('0x31')](handleEntityNotFound(_0xff0382,null))[_0xf7ed('0x31')](respondWithResult(_0xff0382,null))[_0xf7ed('0x24')](handleError(_0xff0382,null));};exports[_0xf7ed('0x5c')]=function(_0x30a116,_0x573c0){return db[_0xf7ed('0x3e')][_0xf7ed('0x5c')](_0x30a116['body'],{})['then'](respondWithResult(_0x573c0,0xc9))['catch'](handleError(_0x573c0,null));};exports[_0xf7ed('0x30')]=function(_0x2399c4,_0x8c30c2){if(_0x2399c4[_0xf7ed('0x38')]['id']){delete _0x2399c4[_0xf7ed('0x38')]['id'];}return db[_0xf7ed('0x3e')][_0xf7ed('0x5b')]({'where':{'id':_0x2399c4['params']['id']}})[_0xf7ed('0x31')](handleEntityNotFound(_0x8c30c2,null))[_0xf7ed('0x31')](saveUpdates(_0x2399c4[_0xf7ed('0x38')],null))[_0xf7ed('0x31')](respondWithResult(_0x8c30c2,null))[_0xf7ed('0x24')](handleError(_0x8c30c2,null));};exports['destroy']=function(_0x23d508,_0x3c0147){return db[_0xf7ed('0x3e')][_0xf7ed('0x5b')]({'where':{'id':_0x23d508[_0xf7ed('0x59')]['id']}})[_0xf7ed('0x31')](handleEntityNotFound(_0x3c0147,null))[_0xf7ed('0x31')](removeEntity(_0x3c0147,null))['catch'](handleError(_0x3c0147,null));};exports[_0xf7ed('0x5d')]=function(_0x2eeff6,_0x108587,_0x2f8ed8){var _0x26a733={};var _0x4a98eb={};var _0x3e4954;var _0x20faf6;return db[_0xf7ed('0x3e')][_0xf7ed('0x5e')]({'where':{'id':_0x2eeff6[_0xf7ed('0x59')]['id']}})[_0xf7ed('0x31')](handleEntityNotFound(_0x108587,null))[_0xf7ed('0x31')](function(_0x5fad6c){if(_0x5fad6c){_0x3e4954=_0x5fad6c;_0x4a98eb[_0xf7ed('0x42')]=_[_0xf7ed('0x5a')](db[_0xf7ed('0x5f')]['rawAttributes']);_0x4a98eb[_0xf7ed('0x44')]=_[_0xf7ed('0x5a')](_0x2eeff6[_0xf7ed('0x44')]);_0x4a98eb[_0xf7ed('0x45')]=_['intersection'](_0x4a98eb['model'],_0x4a98eb[_0xf7ed('0x44')]);_0x26a733[_0xf7ed('0x47')]=_['intersection'](_0x4a98eb['model'],qs[_0xf7ed('0x48')](_0x2eeff6[_0xf7ed('0x44')][_0xf7ed('0x48')]));_0x26a733['attributes']=_0x26a733[_0xf7ed('0x47')][_0xf7ed('0x49')]?_0x26a733[_0xf7ed('0x47')]:_0x4a98eb[_0xf7ed('0x42')];_0x26a733['order']=qs[_0xf7ed('0x4d')](_0x2eeff6[_0xf7ed('0x44')][_0xf7ed('0x4d')]);_0x26a733[_0xf7ed('0x4e')]=qs[_0xf7ed('0x45')](_['pick'](_0x2eeff6[_0xf7ed('0x44')],_0x4a98eb[_0xf7ed('0x45')]));if(_0x2eeff6[_0xf7ed('0x44')][_0xf7ed('0x50')]){_0x26a733[_0xf7ed('0x4e')]=_['merge'](_0x26a733[_0xf7ed('0x4e')],{'$or':_['map'](_0x26a733[_0xf7ed('0x47')],function(_0x4220e6){var _0x1fbc39={};_0x1fbc39[_0x4220e6]={'$like':'%'+_0x2eeff6[_0xf7ed('0x44')][_0xf7ed('0x50')]+'%'};return _0x1fbc39;})});}_0x26a733=_['merge']({},_0x26a733,_0x2eeff6[_0xf7ed('0x54')]);return _0x3e4954['getConfigurations'](_0x26a733);}})[_0xf7ed('0x31')](function(_0x51b322){if(_0x51b322){_0x20faf6=_0x51b322['length'];if(!_0x2eeff6[_0xf7ed('0x44')][_0xf7ed('0x4a')](_0xf7ed('0x4b'))){_0x26a733[_0xf7ed('0x2a')]=qs['limit'](_0x2eeff6[_0xf7ed('0x44')][_0xf7ed('0x2a')]);_0x26a733['offset']=qs[_0xf7ed('0x28')](_0x2eeff6[_0xf7ed('0x44')][_0xf7ed('0x28')]);}return _0x3e4954[_0xf7ed('0x5d')](_0x26a733);}})[_0xf7ed('0x31')](function(_0x1bb6b0){if(_0x1bb6b0){return _0x1bb6b0?{'count':_0x20faf6,'rows':_0x1bb6b0}:null;}})[_0xf7ed('0x31')](respondWithResult(_0x108587,null))[_0xf7ed('0x24')](handleError(_0x108587,null));};exports[_0xf7ed('0x60')]=function(_0x568f0c,_0x26fe08,_0x2c95ce){if(_0x568f0c[_0xf7ed('0x38')]['id']){delete _0x568f0c[_0xf7ed('0x38')]['id'];}return db['SalesforceAccount'][_0xf7ed('0x5e')]({'where':{'id':_0x568f0c[_0xf7ed('0x59')]['id']}})[_0xf7ed('0x31')](handleEntityNotFound(_0x26fe08,null))['then'](function(_0x43a5b0){if(_0x43a5b0){_0x568f0c[_0xf7ed('0x38')][_0xf7ed('0x61')]=_0x43a5b0['id'];_0x568f0c[_0xf7ed('0x38')][_0xf7ed('0x62')]=integrations[_0xf7ed('0x63')](_0x568f0c[_0xf7ed('0x38')][_0xf7ed('0x64')],_0x568f0c[_0xf7ed('0x38')][_0xf7ed('0x51')]);_0x568f0c[_0xf7ed('0x38')]['Descriptions']=integrations[_0xf7ed('0x65')](_0x568f0c[_0xf7ed('0x38')][_0xf7ed('0x64')],_0x568f0c[_0xf7ed('0x38')][_0xf7ed('0x51')]);return db['SalesforceConfiguration'][_0xf7ed('0x5c')](_0x568f0c[_0xf7ed('0x38')],{'include':[{'model':db['SalesforceField'],'as':_0xf7ed('0x62')},{'model':db[_0xf7ed('0x66')],'as':_0xf7ed('0x67')}]});}return null;})[_0xf7ed('0x31')](respondWithResult(_0x26fe08,null))[_0xf7ed('0x24')](handleError(_0x26fe08,null));};exports[_0xf7ed('0x68')]=function(_0x34a23a,_0x48684b,_0x25a863){var _0x53db3c;var _0x345f95='';var _0x4cf46a=_0xf7ed('0x69');return db[_0xf7ed('0x3e')]['findOne']({'where':{'id':_0x34a23a[_0xf7ed('0x59')]['id']},'attributes':['id',_0xf7ed('0x6a'),_0xf7ed('0x6b'),_0xf7ed('0x6c'),_0xf7ed('0x6d'),_0xf7ed('0x6e'),_0xf7ed('0x6f')]})['then'](handleEntityNotFound(_0x48684b,null))[_0xf7ed('0x31')](function(_0x51b9cf){if(_0x51b9cf){_0x345f95=_0x51b9cf[_0xf7ed('0x6a')];var _0x4f7f5d=_0x345f95[_0xf7ed('0x70')](-0x1);if(_0x4f7f5d==='/'){_0x345f95=_0x345f95[_0xf7ed('0x71')](0x0,_0x345f95[_0xf7ed('0x72')](_0x4f7f5d));}_0x53db3c=new jsforce[(_0xf7ed('0x73'))]({'oauth2':{'loginUrl':_0x345f95,'clientId':_0x51b9cf[_0xf7ed('0x6b')],'clientSecret':_0x51b9cf['clientSecret']}});return _0x53db3c[_0xf7ed('0x74')](_0x51b9cf[_0xf7ed('0x6d')],_0x51b9cf['password'][_0xf7ed('0x75')](_0x51b9cf[_0xf7ed('0x6f')]));}})[_0xf7ed('0x31')](function(_0x12c70a){if(_0x12c70a){if(!_[_0xf7ed('0x76')](_0x34a23a[_0xf7ed('0x44')]['ticketType'])){_0x4cf46a=_0x34a23a[_0xf7ed('0x44')][_0xf7ed('0x77')];}return _0x53db3c[_0xf7ed('0x78')](_0x4cf46a)[_0xf7ed('0x79')]();}})['then'](function(_0x30f63d){var _0x421b5b=[_0xf7ed('0x7a'),_0xf7ed('0x7b'),_0xf7ed('0x7c'),_0xf7ed('0x7d'),_0xf7ed('0x7e'),_0xf7ed('0x7f')];var _0x30cbc9=[_0xf7ed('0x80'),_0xf7ed('0x81'),_0xf7ed('0x82'),_0xf7ed('0x83'),_0xf7ed('0x84'),'textarea',_0xf7ed('0x85')];if(_0x30f63d){_['remove'](_0x30f63d['fields'],function(_0x15d42c){return _0x421b5b[_0xf7ed('0x86')](_0x15d42c['name'])||!_0x30cbc9[_0xf7ed('0x86')](_0x15d42c[_0xf7ed('0x51')]);});return{'count':_0x30f63d[_0xf7ed('0x48')][_0xf7ed('0x49')],'rows':_[_0xf7ed('0x43')](_0x30f63d['fields'],function(_0x40db83){return{'id':_0x40db83[_0xf7ed('0x35')],'name':_0x40db83[_0xf7ed('0x87')],'custom':_0x40db83['custom'],'options':_0x40db83[_0xf7ed('0x88')]['length']>0x0?_[_0xf7ed('0x43')](_0x40db83['picklistValues'],function(_0x381a30){return{'name':_0x381a30[_0xf7ed('0x87')],'value':_0x381a30[_0xf7ed('0x89')]};}):_0x40db83[_0xf7ed('0x51')]==_0xf7ed('0x83')?[{'name':'True','value':_0xf7ed('0x8a')},{'name':_0xf7ed('0x8b'),'value':'false'}]:[]};})};}})[_0xf7ed('0x31')](respondWithResult(_0x48684b,null))[_0xf7ed('0x24')](function(_0x3efd26){var _0x573551=_0x34a23a[_0xf7ed('0x44')]['test']?0x1f4:_0x3efd26['statusCode']||0x1f4;logger[_0xf7ed('0x21')](_0xf7ed('0x8c'),_0xf7ed('0x68'),_0x573551,JSON[_0xf7ed('0x20')](_0x3efd26));delete _0x3efd26['name'];if(_0x573551===0x191){_0x573551=0x190;}_0x48684b[_0xf7ed('0x33')](_0x573551)[_0xf7ed('0x36')](_0x34a23a[_0xf7ed('0x44')]['test']?{'message':_0xf7ed('0x8d'),'statusCode':_0x3efd26[_0xf7ed('0x8e')]}:_0x3efd26);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index f28d8d2..c6886ce 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 _0x27e6=['path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','int_salesforce_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x44a709,_0x2f7b99){var _0x4721c5=function(_0x495b96){while(--_0x495b96){_0x44a709['push'](_0x44a709['shift']());}};_0x4721c5(++_0x2f7b99);}(_0x27e6,0x1db));var _0x627e=function(_0x3c964d,_0x276602){_0x3c964d=_0x3c964d-0x0;var _0x4d9603=_0x27e6[_0x3c964d];return _0x4d9603;};'use strict';var _=require('lodash');var util=require(_0x627e('0x0'));var logger=require(_0x627e('0x1'))(_0x627e('0x2'));var moment=require(_0x627e('0x3'));var BPromise=require(_0x627e('0x4'));var rp=require(_0x627e('0x5'));var fs=require('fs');var path=require(_0x627e('0x6'));var rimraf=require(_0x627e('0x7'));var config=require('../../config/environment');var attributes=require(_0x627e('0x8'));var integrations=require(_0x627e('0x9'));module[_0x627e('0xa')]=function(_0x2ef367,_0x521fa0){return _0x2ef367[_0x627e('0xb')]('SalesforceAccount',attributes,{'tableName':_0x627e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3990=['../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x17fbe9,_0x1f37b8){var _0x1afe3d=function(_0x5c667c){while(--_0x5c667c){_0x17fbe9['push'](_0x17fbe9['shift']());}};_0x1afe3d(++_0x1f37b8);}(_0x3990,0x19a));var _0x0399=function(_0x311460,_0x3485f5){_0x311460=_0x311460-0x0;var _0x3037b2=_0x3990[_0x311460];return _0x3037b2;};'use strict';var _=require(_0x0399('0x0'));var util=require(_0x0399('0x1'));var logger=require(_0x0399('0x2'))(_0x0399('0x3'));var moment=require(_0x0399('0x4'));var BPromise=require(_0x0399('0x5'));var rp=require(_0x0399('0x6'));var fs=require('fs');var path=require(_0x0399('0x7'));var rimraf=require('rimraf');var config=require(_0x0399('0x8'));var attributes=require(_0x0399('0x9'));var integrations=require(_0x0399('0xa'));module[_0x0399('0xb')]=function(_0xc8a39c,_0x680136){return _0xc8a39c[_0x0399('0xc')](_0x0399('0xd'),attributes,{'tableName':'int_salesforce_accounts','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 7d53a4e..86248b5 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 _0xb903=['info','result','findAll','options','raw','where','attributes','limit','map','include','model','then','GetSalesforceAccount','debug','stringify','ShowSalesforceAccount','SalesforceAccount','find','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','SalesforceAccount,\x20%s,\x20%s','message'];(function(_0x149db1,_0x25f28b){var _0x2059a8=function(_0x1e9890){while(--_0x1e9890){_0x149db1['push'](_0x149db1['shift']());}};_0x2059a8(++_0x25f28b);}(_0xb903,0x185));var _0x3b90=function(_0x5a348b,_0x362a14){_0x5a348b=_0x5a348b-0x0;var _0x41bc32=_0xb903[_0x5a348b];return _0x41bc32;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e845a,_0x55792c,_0x153283){return new BPromise(function(_0x2e4c06,_0x42efe8){return client[_0x3b90('0xc')](_0x5e845a,_0x153283)['then'](function(_0x5cda1d){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x55792c,'request\x20sent');logger['debug'](_0x3b90('0xd'),_0x55792c,_0x3b90('0xe'),JSON['stringify'](_0x5cda1d));if(_0x5cda1d[_0x3b90('0xf')]){if(_0x5cda1d[_0x3b90('0xf')]['code']===0x1f4){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x5cda1d[_0x3b90('0xf')]['message']);return _0x42efe8(_0x5cda1d['error'][_0x3b90('0x11')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x55792c,_0x5cda1d[_0x3b90('0xf')][_0x3b90('0x11')]);return _0x2e4c06(_0x5cda1d['error']['message']);}else{logger[_0x3b90('0x12')](_0x3b90('0x10'),_0x55792c,_0x3b90('0xe'));_0x2e4c06(_0x5cda1d[_0x3b90('0x13')][_0x3b90('0x11')]);}})['catch'](function(_0x494970){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x494970);_0x42efe8(_0x494970);});});}exports['GetSalesforceAccount']=function(_0x269488){var _0x3cf281=this;return new Promise(function(_0x11ad7d,_0x131f3f){return db['SalesforceAccount'][_0x3b90('0x14')]({'raw':_0x269488['options']?_0x269488[_0x3b90('0x15')][_0x3b90('0x16')]===undefined?!![]:![]:!![],'where':_0x269488['options']?_0x269488[_0x3b90('0x15')][_0x3b90('0x17')]||null:null,'attributes':_0x269488[_0x3b90('0x15')]?_0x269488[_0x3b90('0x15')][_0x3b90('0x18')]||null:null,'limit':_0x269488[_0x3b90('0x15')]?_0x269488[_0x3b90('0x15')][_0x3b90('0x19')]||null:null,'include':_0x269488[_0x3b90('0x15')]?_0x269488[_0x3b90('0x15')]['include']?_[_0x3b90('0x1a')](_0x269488[_0x3b90('0x15')][_0x3b90('0x1b')],function(_0x7faee){return{'model':db[_0x7faee[_0x3b90('0x1c')]],'as':_0x7faee['as'],'attributes':_0x7faee[_0x3b90('0x18')],'include':_0x7faee['include']?_['map'](_0x7faee[_0x3b90('0x1b')],function(_0x29d472){return{'model':db[_0x29d472[_0x3b90('0x1c')]],'as':_0x29d472['as'],'attributes':_0x29d472[_0x3b90('0x18')],'include':_0x29d472['include']?_[_0x3b90('0x1a')](_0x29d472[_0x3b90('0x1b')],function(_0x1787d1){return{'model':db[_0x1787d1['model']],'as':_0x1787d1['as'],'attributes':_0x1787d1[_0x3b90('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3b90('0x1d')](function(_0x17ec7f){logger[_0x3b90('0x12')](_0x3b90('0x1e'),_0x269488);logger[_0x3b90('0x1f')]('GetSalesforceAccount',_0x269488,JSON[_0x3b90('0x20')](_0x17ec7f));_0x11ad7d(_0x17ec7f);})['catch'](function(_0xaf453c){logger[_0x3b90('0xf')](_0x3b90('0x1e'),_0xaf453c[_0x3b90('0x11')],_0x269488);_0x131f3f(_0x3cf281[_0x3b90('0xf')](0x1f4,_0xaf453c[_0x3b90('0x11')]));});});};exports[_0x3b90('0x21')]=function(_0x2430ec){var _0x500ceb=this;return new Promise(function(_0x4d1f31,_0x43bd4f){return db[_0x3b90('0x22')][_0x3b90('0x23')]({'raw':_0x2430ec[_0x3b90('0x15')]?_0x2430ec['options']['raw']===undefined?!![]:![]:!![],'where':_0x2430ec[_0x3b90('0x15')]?_0x2430ec[_0x3b90('0x15')][_0x3b90('0x17')]||null:null,'attributes':_0x2430ec['options']?_0x2430ec[_0x3b90('0x15')]['attributes']||null:null,'include':_0x2430ec['options']?_0x2430ec[_0x3b90('0x15')][_0x3b90('0x1b')]?_['map'](_0x2430ec[_0x3b90('0x15')][_0x3b90('0x1b')],function(_0x3e30b8){return{'model':db[_0x3e30b8['model']],'as':_0x3e30b8['as'],'attributes':_0x3e30b8['attributes'],'include':_0x3e30b8[_0x3b90('0x1b')]?_[_0x3b90('0x1a')](_0x3e30b8[_0x3b90('0x1b')],function(_0x401dc5){return{'model':db[_0x401dc5['model']],'as':_0x401dc5['as'],'attributes':_0x401dc5['attributes'],'include':_0x401dc5[_0x3b90('0x1b')]?_[_0x3b90('0x1a')](_0x401dc5['include'],function(_0x57946d){return{'model':db[_0x57946d[_0x3b90('0x1c')]],'as':_0x57946d['as'],'attributes':_0x57946d[_0x3b90('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3b90('0x1d')](function(_0x298df6){logger['info'](_0x3b90('0x21'),_0x2430ec);logger['debug'](_0x3b90('0x21'),_0x2430ec,JSON[_0x3b90('0x20')](_0x298df6));_0x4d1f31(_0x298df6);})[_0x3b90('0x24')](function(_0x20abf8){logger[_0x3b90('0xf')](_0x3b90('0x21'),_0x20abf8[_0x3b90('0x11')],_0x2430ec);_0x43bd4f(_0x500ceb['error'](0x1f4,_0x20abf8[_0x3b90('0x11')]));});});}; \ No newline at end of file +var _0x2dae=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SalesforceAccount','options','where','attributes','include','map','model','info','GetSalesforceAccount','ShowSalesforceAccount','find','lodash','moment','bluebird'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2dae,0xc3));var _0xe2da=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0x2dae[_0x547456];return _0xc1fd7b;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var moment=require(_0xe2da('0x1'));var BPromise=require(_0xe2da('0x2'));var rs=require(_0xe2da('0x3'));var fs=require('fs');var Redis=require(_0xe2da('0x4'));var db=require(_0xe2da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2da('0x6'))(_0xe2da('0x7'));var config=require(_0xe2da('0x8'));var jayson=require(_0xe2da('0x9'));var client=jayson['client'][_0xe2da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x89c70b,_0x34cc98,_0x2efbd8){return new BPromise(function(_0x238da3,_0x1c71ea){return client[_0xe2da('0xb')](_0x89c70b,_0x2efbd8)[_0xe2da('0xc')](function(_0x68aa40){logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));logger[_0xe2da('0xf')](_0xe2da('0x10'),_0x34cc98,_0xe2da('0xe'),JSON[_0xe2da('0x11')](_0x68aa40));if(_0x68aa40[_0xe2da('0x12')]){if(_0x68aa40[_0xe2da('0x12')]['code']===0x1f4){logger[_0xe2da('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x34cc98,_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);return _0x1c71ea(_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);}logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x68aa40[_0xe2da('0x12')]['message']);return _0x238da3(_0x68aa40[_0xe2da('0x12')]['message']);}else{logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));_0x238da3(_0x68aa40[_0xe2da('0x14')]['message']);}})[_0xe2da('0x15')](function(_0x2c0353){logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x2c0353);_0x1c71ea(_0x2c0353);});});}exports['GetSalesforceAccount']=function(_0x45bb92){var _0x1f7d33=this;return new Promise(function(_0x417363,_0x2e5730){return db[_0xe2da('0x16')]['findAll']({'raw':_0x45bb92[_0xe2da('0x17')]?_0x45bb92[_0xe2da('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x45bb92[_0xe2da('0x17')]?_0x45bb92[_0xe2da('0x17')][_0xe2da('0x18')]||null:null,'attributes':_0x45bb92[_0xe2da('0x17')]?_0x45bb92[_0xe2da('0x17')][_0xe2da('0x19')]||null:null,'limit':_0x45bb92['options']?_0x45bb92[_0xe2da('0x17')]['limit']||null:null,'include':_0x45bb92[_0xe2da('0x17')]?_0x45bb92[_0xe2da('0x17')][_0xe2da('0x1a')]?_[_0xe2da('0x1b')](_0x45bb92[_0xe2da('0x17')][_0xe2da('0x1a')],function(_0x38f2c4){return{'model':db[_0x38f2c4[_0xe2da('0x1c')]],'as':_0x38f2c4['as'],'attributes':_0x38f2c4['attributes'],'include':_0x38f2c4[_0xe2da('0x1a')]?_[_0xe2da('0x1b')](_0x38f2c4[_0xe2da('0x1a')],function(_0x14704d){return{'model':db[_0x14704d[_0xe2da('0x1c')]],'as':_0x14704d['as'],'attributes':_0x14704d[_0xe2da('0x19')],'include':_0x14704d[_0xe2da('0x1a')]?_['map'](_0x14704d[_0xe2da('0x1a')],function(_0x3e23d7){return{'model':db[_0x3e23d7[_0xe2da('0x1c')]],'as':_0x3e23d7['as'],'attributes':_0x3e23d7[_0xe2da('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe2da('0xc')](function(_0x2b6c9e){logger[_0xe2da('0x1d')](_0xe2da('0x1e'),_0x45bb92);logger['debug']('GetSalesforceAccount',_0x45bb92,JSON['stringify'](_0x2b6c9e));_0x417363(_0x2b6c9e);})[_0xe2da('0x15')](function(_0x8c91db){logger[_0xe2da('0x12')](_0xe2da('0x1e'),_0x8c91db['message'],_0x45bb92);_0x2e5730(_0x1f7d33['error'](0x1f4,_0x8c91db[_0xe2da('0x13')]));});});};exports[_0xe2da('0x1f')]=function(_0x262d40){var _0x39f983=this;return new Promise(function(_0x7ab5ee,_0x15df33){return db[_0xe2da('0x16')][_0xe2da('0x20')]({'raw':_0x262d40[_0xe2da('0x17')]?_0x262d40['options']['raw']===undefined?!![]:![]:!![],'where':_0x262d40[_0xe2da('0x17')]?_0x262d40[_0xe2da('0x17')][_0xe2da('0x18')]||null:null,'attributes':_0x262d40[_0xe2da('0x17')]?_0x262d40[_0xe2da('0x17')][_0xe2da('0x19')]||null:null,'include':_0x262d40[_0xe2da('0x17')]?_0x262d40[_0xe2da('0x17')][_0xe2da('0x1a')]?_[_0xe2da('0x1b')](_0x262d40[_0xe2da('0x17')][_0xe2da('0x1a')],function(_0x4ef546){return{'model':db[_0x4ef546[_0xe2da('0x1c')]],'as':_0x4ef546['as'],'attributes':_0x4ef546[_0xe2da('0x19')],'include':_0x4ef546[_0xe2da('0x1a')]?_[_0xe2da('0x1b')](_0x4ef546[_0xe2da('0x1a')],function(_0x5a078e){return{'model':db[_0x5a078e[_0xe2da('0x1c')]],'as':_0x5a078e['as'],'attributes':_0x5a078e[_0xe2da('0x19')],'include':_0x5a078e[_0xe2da('0x1a')]?_['map'](_0x5a078e[_0xe2da('0x1a')],function(_0x10b8f5){return{'model':db[_0x10b8f5[_0xe2da('0x1c')]],'as':_0x10b8f5['as'],'attributes':_0x10b8f5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x156deb){logger[_0xe2da('0x1d')]('ShowSalesforceAccount',_0x262d40);logger[_0xe2da('0xf')](_0xe2da('0x1f'),_0x262d40,JSON[_0xe2da('0x11')](_0x156deb));_0x7ab5ee(_0x156deb);})[_0xe2da('0x15')](function(_0x3a6ca3){logger['error'](_0xe2da('0x1f'),_0x3a6ca3['message'],_0x262d40);_0x15df33(_0x39f983['error'](0x1f4,_0x3a6ca3[_0xe2da('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index f64e451..664b232 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 _0x1d5b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x1d5b,0x1d5));var _0xb1d5=function(_0x253ca9,_0x5c404d){_0x253ca9=_0x253ca9-0x0;var _0x5ac36c=_0x1d5b[_0x253ca9];return _0x5ac36c;};'use strict';var multer=require(_0xb1d5('0x0'));var util=require(_0xb1d5('0x1'));var path=require(_0xb1d5('0x2'));var timeout=require('connect-timeout');var express=require(_0xb1d5('0x3'));var router=express[_0xb1d5('0x4')]();var fs_extra=require(_0xb1d5('0x5'));var auth=require(_0xb1d5('0x6'));var interaction=require(_0xb1d5('0x7'));var config=require(_0xb1d5('0x8'));var controller=require(_0xb1d5('0x9'));router[_0xb1d5('0xa')]('/',auth[_0xb1d5('0xb')](),controller['index']);router['get'](_0xb1d5('0xc'),auth[_0xb1d5('0xb')](),controller[_0xb1d5('0xd')]);router['get'](_0xb1d5('0xe'),auth[_0xb1d5('0xb')](),controller['getFields']);router[_0xb1d5('0xa')](_0xb1d5('0xf'),auth[_0xb1d5('0xb')](),controller[_0xb1d5('0x10')]);router[_0xb1d5('0xa')](_0xb1d5('0x11'),auth[_0xb1d5('0xb')](),controller[_0xb1d5('0x12')]);router[_0xb1d5('0x13')]('/',auth[_0xb1d5('0xb')](),controller[_0xb1d5('0x14')]);router[_0xb1d5('0x15')](_0xb1d5('0xc'),auth[_0xb1d5('0xb')](),controller[_0xb1d5('0x16')]);router[_0xb1d5('0x17')](_0xb1d5('0xc'),auth[_0xb1d5('0xb')](),controller['destroy']);module[_0xb1d5('0x18')]=router; \ No newline at end of file +var _0x1053=['getSubjects','/:id/descriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x428b47,_0x5b313e){var _0x5c47af=function(_0x500e57){while(--_0x500e57){_0x428b47['push'](_0x428b47['shift']());}};_0x5c47af(++_0x5b313e);}(_0x1053,0x18f));var _0x3105=function(_0x13bcbb,_0x2eb915){_0x13bcbb=_0x13bcbb-0x0;var _0x457c81=_0x1053[_0x13bcbb];return _0x457c81;};'use strict';var multer=require(_0x3105('0x0'));var util=require(_0x3105('0x1'));var path=require(_0x3105('0x2'));var timeout=require(_0x3105('0x3'));var express=require('express');var router=express[_0x3105('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3105('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3105('0x6'));router[_0x3105('0x7')]('/',auth[_0x3105('0x8')](),controller[_0x3105('0x9')]);router[_0x3105('0x7')](_0x3105('0xa'),auth[_0x3105('0x8')](),controller[_0x3105('0xb')]);router['get'](_0x3105('0xc'),auth[_0x3105('0x8')](),controller[_0x3105('0xd')]);router[_0x3105('0x7')](_0x3105('0xe'),auth[_0x3105('0x8')](),controller[_0x3105('0xf')]);router[_0x3105('0x7')](_0x3105('0x10'),auth[_0x3105('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x3105('0x8')](),controller[_0x3105('0x11')]);router[_0x3105('0x12')](_0x3105('0xa'),auth[_0x3105('0x8')](),controller[_0x3105('0x13')]);router[_0x3105('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3105('0x15')]);module[_0x3105('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index fa40998..73d279d 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 _0x1a4b=['account_contact_lead','account','contact_lead','nothing','exports','STRING','ENUM','Task','contact','lead'];(function(_0x28471e,_0x1de789){var _0x1b4552=function(_0x528621){while(--_0x528621){_0x28471e['push'](_0x28471e['shift']());}};_0x1b4552(++_0x1de789);}(_0x1a4b,0x86));var _0xb1a4=function(_0x4f5c1f,_0xcf24cf){_0x4f5c1f=_0x4f5c1f-0x0;var _0x527d70=_0x1a4b[_0x4f5c1f];return _0x527d70;};'use strict';var Sequelize=require('sequelize');module[_0xb1a4('0x0')]={'name':{'type':Sequelize[_0xb1a4('0x1')]},'description':{'type':Sequelize[_0xb1a4('0x1')]},'ticketType':{'type':Sequelize[_0xb1a4('0x2')]('Task','Case'),'defaultValue':_0xb1a4('0x3')},'moduleSearch':{'type':Sequelize[_0xb1a4('0x2')]('contact_lead',_0xb1a4('0x4'),_0xb1a4('0x5'),_0xb1a4('0x6'),_0xb1a4('0x7')),'defaultValue':_0xb1a4('0x8')},'moduleCreate':{'type':Sequelize['ENUM'](_0xb1a4('0x9'),'contact',_0xb1a4('0x5'),'account'),'defaultValue':_0xb1a4('0x5')},'leadId':{'type':Sequelize[_0xb1a4('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xb1a4('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xb1a4('0x1')]}}; \ No newline at end of file +var _0x5c22=['STRING','ENUM','Case','Task','contact_lead','account_contact_lead','account','nothing','contact','lead','sequelize','exports'];(function(_0x435b2f,_0x4c44da){var _0x181648=function(_0x3d753e){while(--_0x3d753e){_0x435b2f['push'](_0x435b2f['shift']());}};_0x181648(++_0x4c44da);}(_0x5c22,0x196));var _0x25c2=function(_0x48f9cf,_0x441b6d){_0x48f9cf=_0x48f9cf-0x0;var _0x37eaff=_0x5c22[_0x48f9cf];return _0x37eaff;};'use strict';var Sequelize=require(_0x25c2('0x0'));module[_0x25c2('0x1')]={'name':{'type':Sequelize[_0x25c2('0x2')]},'description':{'type':Sequelize[_0x25c2('0x2')]},'ticketType':{'type':Sequelize[_0x25c2('0x3')]('Task',_0x25c2('0x4')),'defaultValue':_0x25c2('0x5')},'moduleSearch':{'type':Sequelize['ENUM'](_0x25c2('0x6'),'contact','lead',_0x25c2('0x7'),_0x25c2('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x25c2('0x3')](_0x25c2('0x9'),_0x25c2('0xa'),_0x25c2('0xb'),_0x25c2('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x25c2('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x25c2('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x25c2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 7a5582d..d3b3aca 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 _0xa1fb=['map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','options','SalesforceConfiguration','includeAll','findAll','rows','show','include','find','create','params','getFields','findOne','SalesforceField','hasOwnProperty','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','render','merge','body','agent','interaction'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xa1fb,0x82));var _0xba1f=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xa1fb[_0x11005e];return _0x29338f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba1f('0x0'));var zipdir=require(_0xba1f('0x1'));var jsonpatch=require(_0xba1f('0x2'));var rp=require(_0xba1f('0x3'));var moment=require('moment');var BPromise=require(_0xba1f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xba1f('0x5'));var sox=require(_0xba1f('0x6'));var csv=require(_0xba1f('0x7'));var ejs=require(_0xba1f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba1f('0x9'));var squel=require(_0xba1f('0xa'));var crypto=require(_0xba1f('0xb'));var jsforce=require(_0xba1f('0xc'));var deskjs=require(_0xba1f('0xd'));var toCsv=require(_0xba1f('0x7'));var querystring=require(_0xba1f('0xe'));var Papa=require('papaparse');var Redis=require(_0xba1f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xba1f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba1f('0x11'));var logger=require(_0xba1f('0x12'))(_0xba1f('0x13'));var utils=require('../../config/utils');var config=require(_0xba1f('0x14'));var licenseUtil=require(_0xba1f('0x15'));var db=require(_0xba1f('0x16'))['db'];var jayson=require(_0xba1f('0x17'));var client=jayson[_0xba1f('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29d504,_0xda235a,_0x537004,_0x2f76fc){return new BPromise(function(_0x2d41c7,_0x425b9f){var _0x4c70ff=_0x2f76fc||client;return _0x4c70ff[_0xba1f('0x19')](_0x29d504,_0x537004)['then'](function(_0x2b69f6){logger[_0xba1f('0x1a')](_0xba1f('0x1b'),_0xda235a,_0xba1f('0x1c'));logger[_0xba1f('0x1d')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0xda235a,_0xba1f('0x1c'),JSON[_0xba1f('0x1e')](_0x2b69f6));if(_0x2b69f6[_0xba1f('0x1f')]){if(_0x2b69f6[_0xba1f('0x1f')]['code']===0x1f4){logger[_0xba1f('0x1f')](_0xba1f('0x1b'),_0xda235a,_0x2b69f6[_0xba1f('0x1f')]['message']);return _0x425b9f(_0x2b69f6[_0xba1f('0x1f')][_0xba1f('0x20')]);}logger[_0xba1f('0x1f')](_0xba1f('0x1b'),_0xda235a,_0x2b69f6[_0xba1f('0x1f')][_0xba1f('0x20')]);return _0x2d41c7(_0x2b69f6['error'][_0xba1f('0x20')]);}else{logger['info'](_0xba1f('0x1b'),_0xda235a,_0xba1f('0x1c'));_0x2d41c7(_0x2b69f6[_0xba1f('0x21')][_0xba1f('0x20')]);}})[_0xba1f('0x22')](function(_0x70f5ac){logger[_0xba1f('0x1f')](_0xba1f('0x1b'),_0xda235a,_0x70f5ac);_0x425b9f(_0x70f5ac);});});}function respondWithStatusCode(_0x4b731b,_0x4559d0){_0x4559d0=_0x4559d0||0xcc;return function(_0x4cbdc3){if(_0x4cbdc3){return _0x4b731b['sendStatus'](_0x4559d0);}return _0x4b731b[_0xba1f('0x23')](_0x4559d0)[_0xba1f('0x24')]();};}function respondWithResult(_0x4575fd,_0xde2cf3){_0xde2cf3=_0xde2cf3||0xc8;return function(_0x28bf10){if(_0x28bf10){return _0x4575fd[_0xba1f('0x23')](_0xde2cf3)[_0xba1f('0x25')](_0x28bf10);}};}function respondWithFilteredResult(_0xbb9972,_0x48768c){return function(_0x10cd53){if(_0x10cd53){var _0x5c2447=typeof _0x48768c[_0xba1f('0x26')]===_0xba1f('0x27')&&typeof _0x48768c[_0xba1f('0x28')]===_0xba1f('0x27');var _0x36822b=_0x10cd53[_0xba1f('0x29')];var _0x5abd51=_0x5c2447?0x0:_0x48768c[_0xba1f('0x26')];var _0x115684=_0x5c2447?_0x10cd53[_0xba1f('0x29')]:_0x48768c[_0xba1f('0x26')]+_0x48768c[_0xba1f('0x28')];var _0x6400c4;if(_0x115684>=_0x36822b){_0x115684=_0x36822b;_0x6400c4=0xc8;}else{_0x6400c4=0xce;}_0xbb9972[_0xba1f('0x23')](_0x6400c4);return _0xbb9972['set'](_0xba1f('0x2a'),_0x5abd51+'-'+_0x115684+'/'+_0x36822b)[_0xba1f('0x25')](_0x10cd53);}return null;};}function patchUpdates(_0x14b48c){return function(_0x404e5f){try{jsonpatch[_0xba1f('0x2b')](_0x404e5f,_0x14b48c,!![]);}catch(_0x1386b4){return BPromise[_0xba1f('0x2c')](_0x1386b4);}return _0x404e5f[_0xba1f('0x2d')]();};}function saveUpdates(_0x3b40b,_0x4a2c1b){return function(_0x379889){if(_0x379889){return _0x379889[_0xba1f('0x2e')](_0x3b40b)[_0xba1f('0x2f')](function(_0x400071){return _0x400071;});}return null;};}function removeEntity(_0x153a50,_0x250445){return function(_0x234d50){if(_0x234d50){return _0x234d50[_0xba1f('0x30')]()[_0xba1f('0x2f')](function(){_0x153a50[_0xba1f('0x23')](0xcc)[_0xba1f('0x24')]();});}};}function handleEntityNotFound(_0x1397a6,_0x27904f){return function(_0x4049c5){if(!_0x4049c5){_0x1397a6[_0xba1f('0x31')](0x194);}return _0x4049c5;};}function handleError(_0x37876,_0x139a30){_0x139a30=_0x139a30||0x1f4;return function(_0x1a3c4f){logger['error'](_0x1a3c4f[_0xba1f('0x32')]);if(_0x1a3c4f[_0xba1f('0x33')]){delete _0x1a3c4f[_0xba1f('0x33')];}_0x37876[_0xba1f('0x23')](_0x139a30)[_0xba1f('0x34')](_0x1a3c4f);};}function getMustacheRender(_0x43e06d,_0x4e5acd){return Mustache[_0xba1f('0x35')](_0x43e06d,_[_0xba1f('0x36')](_0x4e5acd[_0xba1f('0x37')],{'contact':_0x4e5acd['contact'],'message':_0x4e5acd[_0xba1f('0x20')],'agent':_0x4e5acd[_0xba1f('0x38')],'interaction':_0x4e5acd[_0xba1f('0x39')],'account':_0x4e5acd['account']}))||'';}exports['index']=function(_0x3d909c,_0x430e67){var _0x47bb1b={},_0x6d15d8={},_0x48fad8={'count':0x0,'rows':[]};var _0x103e56=_[_0xba1f('0x3a')](db['SalesforceConfiguration'][_0xba1f('0x3b')],function(_0x387e64){return{'name':_0x387e64[_0xba1f('0x3c')],'type':_0x387e64[_0xba1f('0x3d')][_0xba1f('0x3e')]};});_0x6d15d8[_0xba1f('0x3f')]=_[_0xba1f('0x3a')](_0x103e56,_0xba1f('0x33'));_0x6d15d8[_0xba1f('0x40')]=_[_0xba1f('0x41')](_0x3d909c['query']);_0x6d15d8[_0xba1f('0x42')]=_[_0xba1f('0x43')](_0x6d15d8[_0xba1f('0x3f')],_0x6d15d8[_0xba1f('0x40')]);_0x47bb1b['attributes']=_['intersection'](_0x6d15d8['model'],qs[_0xba1f('0x44')](_0x3d909c[_0xba1f('0x40')][_0xba1f('0x44')]));_0x47bb1b[_0xba1f('0x45')]=_0x47bb1b[_0xba1f('0x45')][_0xba1f('0x46')]?_0x47bb1b[_0xba1f('0x45')]:_0x6d15d8[_0xba1f('0x3f')];if(!_0x3d909c[_0xba1f('0x40')]['hasOwnProperty']('nolimit')){_0x47bb1b[_0xba1f('0x28')]=qs[_0xba1f('0x28')](_0x3d909c[_0xba1f('0x40')]['limit']);_0x47bb1b['offset']=qs['offset'](_0x3d909c['query'][_0xba1f('0x26')]);}_0x47bb1b[_0xba1f('0x47')]=qs[_0xba1f('0x48')](_0x3d909c[_0xba1f('0x40')][_0xba1f('0x48')]);_0x47bb1b[_0xba1f('0x49')]=qs[_0xba1f('0x42')](_[_0xba1f('0x4a')](_0x3d909c['query'],_0x6d15d8[_0xba1f('0x42')]),_0x103e56);if(_0x3d909c['query'][_0xba1f('0x4b')]){_0x47bb1b[_0xba1f('0x49')]=_[_0xba1f('0x36')](_0x47bb1b['where'],{'$or':_[_0xba1f('0x3a')](_0x103e56,function(_0x18b7b4){if(_0x18b7b4[_0xba1f('0x3d')]!==_0xba1f('0x4c')){var _0x2ee01a={};_0x2ee01a[_0x18b7b4[_0xba1f('0x33')]]={'$like':'%'+_0x3d909c[_0xba1f('0x40')][_0xba1f('0x4b')]+'%'};return _0x2ee01a;}})});}_0x47bb1b=_[_0xba1f('0x36')]({},_0x47bb1b,_0x3d909c[_0xba1f('0x4d')]);var _0x3b453e={'where':_0x47bb1b['where']};return db[_0xba1f('0x4e')][_0xba1f('0x29')](_0x3b453e)[_0xba1f('0x2f')](function(_0x43887c){_0x48fad8['count']=_0x43887c;if(_0x3d909c['query'][_0xba1f('0x4f')]){_0x47bb1b['include']=[{'all':!![]}];}return db[_0xba1f('0x4e')][_0xba1f('0x50')](_0x47bb1b);})['then'](function(_0x1b3112){_0x48fad8[_0xba1f('0x51')]=_0x1b3112;return _0x48fad8;})[_0xba1f('0x2f')](respondWithFilteredResult(_0x430e67,_0x47bb1b))[_0xba1f('0x22')](handleError(_0x430e67,null));};exports[_0xba1f('0x52')]=function(_0x173d22,_0x2c8503){var _0x203c22={'raw':![],'where':{'id':_0x173d22['params']['id']}},_0x3179f8={};_0x3179f8[_0xba1f('0x3f')]=_[_0xba1f('0x41')](db[_0xba1f('0x4e')]['rawAttributes']);_0x3179f8[_0xba1f('0x40')]=_[_0xba1f('0x41')](_0x173d22[_0xba1f('0x40')]);_0x3179f8[_0xba1f('0x42')]=_[_0xba1f('0x43')](_0x3179f8[_0xba1f('0x3f')],_0x3179f8[_0xba1f('0x40')]);_0x203c22[_0xba1f('0x45')]=_['intersection'](_0x3179f8[_0xba1f('0x3f')],qs[_0xba1f('0x44')](_0x173d22[_0xba1f('0x40')][_0xba1f('0x44')]));_0x203c22[_0xba1f('0x45')]=_0x203c22['attributes'][_0xba1f('0x46')]?_0x203c22[_0xba1f('0x45')]:_0x3179f8[_0xba1f('0x3f')];if(_0x173d22[_0xba1f('0x40')][_0xba1f('0x4f')]){_0x203c22[_0xba1f('0x53')]=[{'all':!![]}];}_0x203c22=_['merge']({},_0x203c22,_0x173d22[_0xba1f('0x4d')]);return db[_0xba1f('0x4e')][_0xba1f('0x54')](_0x203c22)[_0xba1f('0x2f')](handleEntityNotFound(_0x2c8503,null))['then'](respondWithResult(_0x2c8503,null))[_0xba1f('0x22')](handleError(_0x2c8503,null));};exports[_0xba1f('0x55')]=function(_0x11bf86,_0x4d4123){return db[_0xba1f('0x4e')][_0xba1f('0x55')](_0x11bf86[_0xba1f('0x37')],{})[_0xba1f('0x2f')](respondWithResult(_0x4d4123,0xc9))['catch'](handleError(_0x4d4123,null));};exports[_0xba1f('0x2e')]=function(_0x52458d,_0x176441){if(_0x52458d['body']['id']){delete _0x52458d[_0xba1f('0x37')]['id'];}return db['SalesforceConfiguration'][_0xba1f('0x54')]({'where':{'id':_0x52458d[_0xba1f('0x56')]['id']}})[_0xba1f('0x2f')](handleEntityNotFound(_0x176441,null))[_0xba1f('0x2f')](saveUpdates(_0x52458d[_0xba1f('0x37')],null))[_0xba1f('0x2f')](respondWithResult(_0x176441,null))['catch'](handleError(_0x176441,null));};exports[_0xba1f('0x30')]=function(_0x51f1cb,_0x1746ea){return db['SalesforceConfiguration'][_0xba1f('0x54')]({'where':{'id':_0x51f1cb['params']['id']}})[_0xba1f('0x2f')](handleEntityNotFound(_0x1746ea,null))['then'](removeEntity(_0x1746ea,null))['catch'](handleError(_0x1746ea,null));};exports[_0xba1f('0x57')]=function(_0x56ac2f,_0x1384b4,_0x251809){var _0x18afdd={};var _0x45941b={};var _0x2904ed;var _0x3e007f;return db[_0xba1f('0x4e')][_0xba1f('0x58')]({'where':{'id':_0x56ac2f['params']['id']}})[_0xba1f('0x2f')](handleEntityNotFound(_0x1384b4,null))[_0xba1f('0x2f')](function(_0x4d9c16){if(_0x4d9c16){_0x2904ed=_0x4d9c16;_0x45941b[_0xba1f('0x3f')]=_[_0xba1f('0x41')](db[_0xba1f('0x59')][_0xba1f('0x3b')]);_0x45941b[_0xba1f('0x40')]=_[_0xba1f('0x41')](_0x56ac2f['query']);_0x45941b[_0xba1f('0x42')]=_['intersection'](_0x45941b[_0xba1f('0x3f')],_0x45941b['query']);_0x18afdd[_0xba1f('0x45')]=_[_0xba1f('0x43')](_0x45941b[_0xba1f('0x3f')],qs[_0xba1f('0x44')](_0x56ac2f[_0xba1f('0x40')][_0xba1f('0x44')]));_0x18afdd[_0xba1f('0x45')]=_0x18afdd[_0xba1f('0x45')][_0xba1f('0x46')]?_0x18afdd[_0xba1f('0x45')]:_0x45941b[_0xba1f('0x3f')];_0x18afdd['order']=qs[_0xba1f('0x48')](_0x56ac2f[_0xba1f('0x40')][_0xba1f('0x48')]);_0x18afdd[_0xba1f('0x49')]=qs[_0xba1f('0x42')](_[_0xba1f('0x4a')](_0x56ac2f['query'],_0x45941b[_0xba1f('0x42')]));if(_0x56ac2f['query'][_0xba1f('0x4b')]){_0x18afdd[_0xba1f('0x49')]=_[_0xba1f('0x36')](_0x18afdd[_0xba1f('0x49')],{'$or':_[_0xba1f('0x3a')](_0x18afdd[_0xba1f('0x45')],function(_0x579401){var _0x350a6a={};_0x350a6a[_0x579401]={'$like':'%'+_0x56ac2f[_0xba1f('0x40')][_0xba1f('0x4b')]+'%'};return _0x350a6a;})});}_0x18afdd=_[_0xba1f('0x36')]({},_0x18afdd,_0x56ac2f[_0xba1f('0x4d')]);return _0x2904ed[_0xba1f('0x57')](_0x18afdd);}})[_0xba1f('0x2f')](function(_0x3889c8){if(_0x3889c8){_0x3e007f=_0x3889c8[_0xba1f('0x46')];if(!_0x56ac2f['query'][_0xba1f('0x5a')](_0xba1f('0x5b'))){_0x18afdd[_0xba1f('0x28')]=qs[_0xba1f('0x28')](_0x56ac2f[_0xba1f('0x40')][_0xba1f('0x28')]);_0x18afdd[_0xba1f('0x26')]=qs['offset'](_0x56ac2f['query'][_0xba1f('0x26')]);}return _0x2904ed['getFields'](_0x18afdd);}})[_0xba1f('0x2f')](function(_0x1b3102){if(_0x1b3102){return _0x1b3102?{'count':_0x3e007f,'rows':_0x1b3102}:null;}})[_0xba1f('0x2f')](respondWithResult(_0x1384b4,null))[_0xba1f('0x22')](handleError(_0x1384b4,null));};exports[_0xba1f('0x5c')]=function(_0x237b9a,_0xeb7c7f,_0x2a3aac){var _0x4f6f21={};var _0x2eff5a={};var _0x1e6b07;var _0x5b619d;return db[_0xba1f('0x4e')][_0xba1f('0x58')]({'where':{'id':_0x237b9a[_0xba1f('0x56')]['id']}})[_0xba1f('0x2f')](handleEntityNotFound(_0xeb7c7f,null))['then'](function(_0x24621c){if(_0x24621c){_0x1e6b07=_0x24621c;_0x2eff5a[_0xba1f('0x3f')]=_[_0xba1f('0x41')](db[_0xba1f('0x59')][_0xba1f('0x3b')]);_0x2eff5a[_0xba1f('0x40')]=_[_0xba1f('0x41')](_0x237b9a[_0xba1f('0x40')]);_0x2eff5a[_0xba1f('0x42')]=_[_0xba1f('0x43')](_0x2eff5a[_0xba1f('0x3f')],_0x2eff5a[_0xba1f('0x40')]);_0x4f6f21['attributes']=_[_0xba1f('0x43')](_0x2eff5a['model'],qs[_0xba1f('0x44')](_0x237b9a[_0xba1f('0x40')][_0xba1f('0x44')]));_0x4f6f21[_0xba1f('0x45')]=_0x4f6f21[_0xba1f('0x45')]['length']?_0x4f6f21[_0xba1f('0x45')]:_0x2eff5a[_0xba1f('0x3f')];_0x4f6f21[_0xba1f('0x47')]=qs[_0xba1f('0x48')](_0x237b9a[_0xba1f('0x40')]['sort']);_0x4f6f21[_0xba1f('0x49')]=qs[_0xba1f('0x42')](_[_0xba1f('0x4a')](_0x237b9a[_0xba1f('0x40')],_0x2eff5a[_0xba1f('0x42')]));if(_0x237b9a[_0xba1f('0x40')][_0xba1f('0x4b')]){_0x4f6f21[_0xba1f('0x49')]=_[_0xba1f('0x36')](_0x4f6f21[_0xba1f('0x49')],{'$or':_[_0xba1f('0x3a')](_0x4f6f21[_0xba1f('0x45')],function(_0x3cca57){var _0x4b90f7={};_0x4b90f7[_0x3cca57]={'$like':'%'+_0x237b9a[_0xba1f('0x40')][_0xba1f('0x4b')]+'%'};return _0x4b90f7;})});}_0x4f6f21=_[_0xba1f('0x36')]({},_0x4f6f21,_0x237b9a[_0xba1f('0x4d')]);return _0x1e6b07[_0xba1f('0x5c')](_0x4f6f21);}})[_0xba1f('0x2f')](function(_0x312d34){if(_0x312d34){_0x5b619d=_0x312d34['length'];if(!_0x237b9a[_0xba1f('0x40')][_0xba1f('0x5a')](_0xba1f('0x5b'))){_0x4f6f21[_0xba1f('0x28')]=qs[_0xba1f('0x28')](_0x237b9a['query'][_0xba1f('0x28')]);_0x4f6f21[_0xba1f('0x26')]=qs['offset'](_0x237b9a[_0xba1f('0x40')][_0xba1f('0x26')]);}return _0x1e6b07[_0xba1f('0x5c')](_0x4f6f21);}})['then'](function(_0x560d98){if(_0x560d98){return _0x560d98?{'count':_0x5b619d,'rows':_0x560d98}:null;}})['then'](respondWithResult(_0xeb7c7f,null))[_0xba1f('0x22')](handleError(_0xeb7c7f,null));};exports['getDescriptions']=function(_0x4dca1c,_0x47ae7a,_0x88318d){var _0x5d38ae={};var _0x463a95={};var _0x2184d1;var _0x3712dc;return db[_0xba1f('0x4e')]['findOne']({'where':{'id':_0x4dca1c[_0xba1f('0x56')]['id']}})['then'](handleEntityNotFound(_0x47ae7a,null))[_0xba1f('0x2f')](function(_0x32cc4d){if(_0x32cc4d){_0x2184d1=_0x32cc4d;_0x463a95['model']=_[_0xba1f('0x41')](db['SalesforceField'][_0xba1f('0x3b')]);_0x463a95['query']=_[_0xba1f('0x41')](_0x4dca1c[_0xba1f('0x40')]);_0x463a95[_0xba1f('0x42')]=_[_0xba1f('0x43')](_0x463a95[_0xba1f('0x3f')],_0x463a95[_0xba1f('0x40')]);_0x5d38ae[_0xba1f('0x45')]=_[_0xba1f('0x43')](_0x463a95[_0xba1f('0x3f')],qs[_0xba1f('0x44')](_0x4dca1c['query'][_0xba1f('0x44')]));_0x5d38ae[_0xba1f('0x45')]=_0x5d38ae['attributes']['length']?_0x5d38ae[_0xba1f('0x45')]:_0x463a95['model'];_0x5d38ae[_0xba1f('0x47')]=qs[_0xba1f('0x48')](_0x4dca1c[_0xba1f('0x40')][_0xba1f('0x48')]);_0x5d38ae[_0xba1f('0x49')]=qs[_0xba1f('0x42')](_['pick'](_0x4dca1c['query'],_0x463a95['filters']));if(_0x4dca1c[_0xba1f('0x40')]['filter']){_0x5d38ae[_0xba1f('0x49')]=_[_0xba1f('0x36')](_0x5d38ae[_0xba1f('0x49')],{'$or':_['map'](_0x5d38ae[_0xba1f('0x45')],function(_0x3450bf){var _0x5df490={};_0x5df490[_0x3450bf]={'$like':'%'+_0x4dca1c[_0xba1f('0x40')]['filter']+'%'};return _0x5df490;})});}_0x5d38ae=_['merge']({},_0x5d38ae,_0x4dca1c['options']);return _0x2184d1[_0xba1f('0x5d')](_0x5d38ae);}})[_0xba1f('0x2f')](function(_0x328071){if(_0x328071){_0x3712dc=_0x328071[_0xba1f('0x46')];if(!_0x4dca1c[_0xba1f('0x40')][_0xba1f('0x5a')](_0xba1f('0x5b'))){_0x5d38ae[_0xba1f('0x28')]=qs[_0xba1f('0x28')](_0x4dca1c['query']['limit']);_0x5d38ae[_0xba1f('0x26')]=qs[_0xba1f('0x26')](_0x4dca1c[_0xba1f('0x40')][_0xba1f('0x26')]);}return _0x2184d1['getDescriptions'](_0x5d38ae);}})[_0xba1f('0x2f')](function(_0x7065d8){if(_0x7065d8){return _0x7065d8?{'count':_0x3712dc,'rows':_0x7065d8}:null;}})[_0xba1f('0x2f')](respondWithResult(_0x47ae7a,null))[_0xba1f('0x22')](handleError(_0x47ae7a,null));}; \ No newline at end of file +var _0x1810=['intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','map','type','filter','includeAll','rows','show','params','keys','rawAttributes','include','options','create','find','getFields','findOne','SalesforceField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','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','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','sendStatus','name','render','merge','body','agent','index','SalesforceConfiguration','fieldName','model','query'];(function(_0x2a38f5,_0x5bbbc3){var _0xdeb357=function(_0x41a514){while(--_0x41a514){_0x2a38f5['push'](_0x2a38f5['shift']());}};_0xdeb357(++_0x5bbbc3);}(_0x1810,0x137));var _0x0181=function(_0x4b0830,_0x2e3b0a){_0x4b0830=_0x4b0830-0x0;var _0x1f53a7=_0x1810[_0x4b0830];return _0x1f53a7;};'use strict';var emlformat=require(_0x0181('0x0'));var rimraf=require(_0x0181('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0181('0x2'));var rp=require(_0x0181('0x3'));var moment=require(_0x0181('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0181('0x5'));var util=require(_0x0181('0x6'));var path=require(_0x0181('0x7'));var sox=require(_0x0181('0x8'));var csv=require(_0x0181('0x9'));var ejs=require(_0x0181('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0181('0xb'));var squel=require('squel');var crypto=require(_0x0181('0xc'));var jsforce=require(_0x0181('0xd'));var deskjs=require(_0x0181('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0181('0xf'));var Papa=require(_0x0181('0x10'));var Redis=require(_0x0181('0x11'));var authService=require(_0x0181('0x12'));var qs=require(_0x0181('0x13'));var as=require(_0x0181('0x14'));var hardwareService=require(_0x0181('0x15'));var logger=require('../../config/logger')(_0x0181('0x16'));var utils=require(_0x0181('0x17'));var config=require(_0x0181('0x18'));var licenseUtil=require(_0x0181('0x19'));var db=require(_0x0181('0x1a'))['db'];var jayson=require(_0x0181('0x1b'));var client=jayson[_0x0181('0x1c')][_0x0181('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4d8819,_0x4fb93c,_0xcbab6b,_0x4b2555){return new BPromise(function(_0x6b1599,_0x1cf008){var _0x22cd35=_0x4b2555||client;return _0x22cd35[_0x0181('0x1e')](_0x4d8819,_0xcbab6b)['then'](function(_0xe080de){logger[_0x0181('0x1f')](_0x0181('0x20'),_0x4fb93c,_0x0181('0x21'));logger['debug'](_0x0181('0x22'),_0x4fb93c,'request\x20sent',JSON[_0x0181('0x23')](_0xe080de));if(_0xe080de[_0x0181('0x24')]){if(_0xe080de['error'][_0x0181('0x25')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4fb93c,_0xe080de['error'][_0x0181('0x26')]);return _0x1cf008(_0xe080de[_0x0181('0x24')][_0x0181('0x26')]);}logger[_0x0181('0x24')](_0x0181('0x20'),_0x4fb93c,_0xe080de[_0x0181('0x24')][_0x0181('0x26')]);return _0x6b1599(_0xe080de[_0x0181('0x24')][_0x0181('0x26')]);}else{logger[_0x0181('0x1f')](_0x0181('0x20'),_0x4fb93c,_0x0181('0x21'));_0x6b1599(_0xe080de[_0x0181('0x27')]['message']);}})[_0x0181('0x28')](function(_0x806697){logger[_0x0181('0x24')](_0x0181('0x20'),_0x4fb93c,_0x806697);_0x1cf008(_0x806697);});});}function respondWithStatusCode(_0x50ca5a,_0x3ab967){_0x3ab967=_0x3ab967||0xcc;return function(_0x101970){if(_0x101970){return _0x50ca5a['sendStatus'](_0x3ab967);}return _0x50ca5a[_0x0181('0x29')](_0x3ab967)[_0x0181('0x2a')]();};}function respondWithResult(_0x3b538a,_0x31a7ba){_0x31a7ba=_0x31a7ba||0xc8;return function(_0x41194d){if(_0x41194d){return _0x3b538a[_0x0181('0x29')](_0x31a7ba)[_0x0181('0x2b')](_0x41194d);}};}function respondWithFilteredResult(_0x32c790,_0x2f068f){return function(_0x5241d6){if(_0x5241d6){var _0x19549d=typeof _0x2f068f[_0x0181('0x2c')]===_0x0181('0x2d')&&typeof _0x2f068f[_0x0181('0x2e')]==='undefined';var _0x2d63e5=_0x5241d6[_0x0181('0x2f')];var _0xd83250=_0x19549d?0x0:_0x2f068f[_0x0181('0x2c')];var _0x56eb6a=_0x19549d?_0x5241d6['count']:_0x2f068f[_0x0181('0x2c')]+_0x2f068f[_0x0181('0x2e')];var _0x116005;if(_0x56eb6a>=_0x2d63e5){_0x56eb6a=_0x2d63e5;_0x116005=0xc8;}else{_0x116005=0xce;}_0x32c790[_0x0181('0x29')](_0x116005);return _0x32c790['set']('Content-Range',_0xd83250+'-'+_0x56eb6a+'/'+_0x2d63e5)[_0x0181('0x2b')](_0x5241d6);}return null;};}function patchUpdates(_0x5af2eb){return function(_0x5b6fd5){try{jsonpatch[_0x0181('0x30')](_0x5b6fd5,_0x5af2eb,!![]);}catch(_0x4d1655){return BPromise[_0x0181('0x31')](_0x4d1655);}return _0x5b6fd5[_0x0181('0x32')]();};}function saveUpdates(_0x9fbd50,_0x450f13){return function(_0x2129b0){if(_0x2129b0){return _0x2129b0[_0x0181('0x33')](_0x9fbd50)['then'](function(_0x427419){return _0x427419;});}return null;};}function removeEntity(_0x49bcdd,_0x26af5f){return function(_0xb10c0e){if(_0xb10c0e){return _0xb10c0e[_0x0181('0x34')]()[_0x0181('0x35')](function(){_0x49bcdd[_0x0181('0x29')](0xcc)[_0x0181('0x2a')]();});}};}function handleEntityNotFound(_0x1c0a35,_0x52b8d9){return function(_0x499ef4){if(!_0x499ef4){_0x1c0a35[_0x0181('0x36')](0x194);}return _0x499ef4;};}function handleError(_0xfa40ba,_0x3d5b50){_0x3d5b50=_0x3d5b50||0x1f4;return function(_0x3433da){logger['error'](_0x3433da['stack']);if(_0x3433da[_0x0181('0x37')]){delete _0x3433da['name'];}_0xfa40ba[_0x0181('0x29')](_0x3d5b50)['send'](_0x3433da);};}function getMustacheRender(_0x1ca59c,_0x5b336d){return Mustache[_0x0181('0x38')](_0x1ca59c,_[_0x0181('0x39')](_0x5b336d[_0x0181('0x3a')],{'contact':_0x5b336d['contact'],'message':_0x5b336d[_0x0181('0x26')],'agent':_0x5b336d[_0x0181('0x3b')],'interaction':_0x5b336d['interaction'],'account':_0x5b336d['account']}))||'';}exports[_0x0181('0x3c')]=function(_0x456db2,_0x4c8ce4){var _0x339b03={},_0x6916ab={},_0x4b207e={'count':0x0,'rows':[]};var _0xc4e52f=_['map'](db[_0x0181('0x3d')]['rawAttributes'],function(_0x502456){return{'name':_0x502456[_0x0181('0x3e')],'type':_0x502456['type']['key']};});_0x6916ab[_0x0181('0x3f')]=_['map'](_0xc4e52f,'name');_0x6916ab[_0x0181('0x40')]=_['keys'](_0x456db2[_0x0181('0x40')]);_0x6916ab['filters']=_[_0x0181('0x41')](_0x6916ab[_0x0181('0x3f')],_0x6916ab[_0x0181('0x40')]);_0x339b03['attributes']=_[_0x0181('0x41')](_0x6916ab['model'],qs['fields'](_0x456db2['query'][_0x0181('0x42')]));_0x339b03['attributes']=_0x339b03[_0x0181('0x43')][_0x0181('0x44')]?_0x339b03[_0x0181('0x43')]:_0x6916ab[_0x0181('0x3f')];if(!_0x456db2[_0x0181('0x40')][_0x0181('0x45')]('nolimit')){_0x339b03['limit']=qs['limit'](_0x456db2[_0x0181('0x40')][_0x0181('0x2e')]);_0x339b03['offset']=qs['offset'](_0x456db2[_0x0181('0x40')]['offset']);}_0x339b03[_0x0181('0x46')]=qs[_0x0181('0x47')](_0x456db2['query'][_0x0181('0x47')]);_0x339b03[_0x0181('0x48')]=qs[_0x0181('0x49')](_[_0x0181('0x4a')](_0x456db2['query'],_0x6916ab[_0x0181('0x49')]),_0xc4e52f);if(_0x456db2[_0x0181('0x40')]['filter']){_0x339b03[_0x0181('0x48')]=_[_0x0181('0x39')](_0x339b03[_0x0181('0x48')],{'$or':_[_0x0181('0x4b')](_0xc4e52f,function(_0x3ef7df){if(_0x3ef7df[_0x0181('0x4c')]!=='VIRTUAL'){var _0x5480cd={};_0x5480cd[_0x3ef7df['name']]={'$like':'%'+_0x456db2[_0x0181('0x40')][_0x0181('0x4d')]+'%'};return _0x5480cd;}})});}_0x339b03=_[_0x0181('0x39')]({},_0x339b03,_0x456db2['options']);var _0x51e8a7={'where':_0x339b03[_0x0181('0x48')]};return db[_0x0181('0x3d')]['count'](_0x51e8a7)[_0x0181('0x35')](function(_0x3aff16){_0x4b207e[_0x0181('0x2f')]=_0x3aff16;if(_0x456db2[_0x0181('0x40')][_0x0181('0x4e')]){_0x339b03['include']=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x339b03);})[_0x0181('0x35')](function(_0x52e79e){_0x4b207e[_0x0181('0x4f')]=_0x52e79e;return _0x4b207e;})[_0x0181('0x35')](respondWithFilteredResult(_0x4c8ce4,_0x339b03))[_0x0181('0x28')](handleError(_0x4c8ce4,null));};exports[_0x0181('0x50')]=function(_0x25539a,_0x4d5105){var _0x2f7456={'raw':![],'where':{'id':_0x25539a[_0x0181('0x51')]['id']}},_0x59cfcf={};_0x59cfcf[_0x0181('0x3f')]=_[_0x0181('0x52')](db[_0x0181('0x3d')][_0x0181('0x53')]);_0x59cfcf[_0x0181('0x40')]=_[_0x0181('0x52')](_0x25539a[_0x0181('0x40')]);_0x59cfcf[_0x0181('0x49')]=_[_0x0181('0x41')](_0x59cfcf['model'],_0x59cfcf[_0x0181('0x40')]);_0x2f7456[_0x0181('0x43')]=_[_0x0181('0x41')](_0x59cfcf['model'],qs[_0x0181('0x42')](_0x25539a['query']['fields']));_0x2f7456[_0x0181('0x43')]=_0x2f7456[_0x0181('0x43')][_0x0181('0x44')]?_0x2f7456['attributes']:_0x59cfcf[_0x0181('0x3f')];if(_0x25539a['query']['includeAll']){_0x2f7456[_0x0181('0x54')]=[{'all':!![]}];}_0x2f7456=_[_0x0181('0x39')]({},_0x2f7456,_0x25539a[_0x0181('0x55')]);return db[_0x0181('0x3d')]['find'](_0x2f7456)[_0x0181('0x35')](handleEntityNotFound(_0x4d5105,null))['then'](respondWithResult(_0x4d5105,null))['catch'](handleError(_0x4d5105,null));};exports[_0x0181('0x56')]=function(_0x2ab4ee,_0x1f6369){return db[_0x0181('0x3d')][_0x0181('0x56')](_0x2ab4ee[_0x0181('0x3a')],{})[_0x0181('0x35')](respondWithResult(_0x1f6369,0xc9))[_0x0181('0x28')](handleError(_0x1f6369,null));};exports['update']=function(_0x397cfd,_0x27406){if(_0x397cfd[_0x0181('0x3a')]['id']){delete _0x397cfd[_0x0181('0x3a')]['id'];}return db[_0x0181('0x3d')][_0x0181('0x57')]({'where':{'id':_0x397cfd[_0x0181('0x51')]['id']}})[_0x0181('0x35')](handleEntityNotFound(_0x27406,null))[_0x0181('0x35')](saveUpdates(_0x397cfd[_0x0181('0x3a')],null))[_0x0181('0x35')](respondWithResult(_0x27406,null))[_0x0181('0x28')](handleError(_0x27406,null));};exports[_0x0181('0x34')]=function(_0x2fdfd0,_0x3202a8){return db[_0x0181('0x3d')][_0x0181('0x57')]({'where':{'id':_0x2fdfd0[_0x0181('0x51')]['id']}})[_0x0181('0x35')](handleEntityNotFound(_0x3202a8,null))[_0x0181('0x35')](removeEntity(_0x3202a8,null))[_0x0181('0x28')](handleError(_0x3202a8,null));};exports[_0x0181('0x58')]=function(_0x5685fe,_0x2a28fb,_0x258227){var _0x50de7b={};var _0x4e121c={};var _0x59b1b9;var _0x2d3373;return db[_0x0181('0x3d')][_0x0181('0x59')]({'where':{'id':_0x5685fe[_0x0181('0x51')]['id']}})[_0x0181('0x35')](handleEntityNotFound(_0x2a28fb,null))['then'](function(_0x1b4b54){if(_0x1b4b54){_0x59b1b9=_0x1b4b54;_0x4e121c[_0x0181('0x3f')]=_['keys'](db[_0x0181('0x5a')][_0x0181('0x53')]);_0x4e121c['query']=_[_0x0181('0x52')](_0x5685fe[_0x0181('0x40')]);_0x4e121c[_0x0181('0x49')]=_[_0x0181('0x41')](_0x4e121c[_0x0181('0x3f')],_0x4e121c['query']);_0x50de7b[_0x0181('0x43')]=_[_0x0181('0x41')](_0x4e121c[_0x0181('0x3f')],qs[_0x0181('0x42')](_0x5685fe['query']['fields']));_0x50de7b[_0x0181('0x43')]=_0x50de7b[_0x0181('0x43')][_0x0181('0x44')]?_0x50de7b['attributes']:_0x4e121c['model'];_0x50de7b[_0x0181('0x46')]=qs[_0x0181('0x47')](_0x5685fe[_0x0181('0x40')][_0x0181('0x47')]);_0x50de7b[_0x0181('0x48')]=qs['filters'](_[_0x0181('0x4a')](_0x5685fe[_0x0181('0x40')],_0x4e121c['filters']));if(_0x5685fe[_0x0181('0x40')][_0x0181('0x4d')]){_0x50de7b[_0x0181('0x48')]=_['merge'](_0x50de7b['where'],{'$or':_[_0x0181('0x4b')](_0x50de7b[_0x0181('0x43')],function(_0x13341b){var _0x5b3bdc={};_0x5b3bdc[_0x13341b]={'$like':'%'+_0x5685fe[_0x0181('0x40')]['filter']+'%'};return _0x5b3bdc;})});}_0x50de7b=_[_0x0181('0x39')]({},_0x50de7b,_0x5685fe[_0x0181('0x55')]);return _0x59b1b9[_0x0181('0x58')](_0x50de7b);}})['then'](function(_0x39f045){if(_0x39f045){_0x2d3373=_0x39f045[_0x0181('0x44')];if(!_0x5685fe[_0x0181('0x40')]['hasOwnProperty'](_0x0181('0x5b'))){_0x50de7b[_0x0181('0x2e')]=qs['limit'](_0x5685fe[_0x0181('0x40')][_0x0181('0x2e')]);_0x50de7b[_0x0181('0x2c')]=qs[_0x0181('0x2c')](_0x5685fe[_0x0181('0x40')][_0x0181('0x2c')]);}return _0x59b1b9[_0x0181('0x58')](_0x50de7b);}})[_0x0181('0x35')](function(_0xd161ca){if(_0xd161ca){return _0xd161ca?{'count':_0x2d3373,'rows':_0xd161ca}:null;}})[_0x0181('0x35')](respondWithResult(_0x2a28fb,null))['catch'](handleError(_0x2a28fb,null));};exports[_0x0181('0x5c')]=function(_0x2562ed,_0x15af5a,_0x34e5aa){var _0x333897={};var _0x3f7cb3={};var _0x7e2134;var _0x51552f;return db[_0x0181('0x3d')][_0x0181('0x59')]({'where':{'id':_0x2562ed[_0x0181('0x51')]['id']}})[_0x0181('0x35')](handleEntityNotFound(_0x15af5a,null))[_0x0181('0x35')](function(_0xb73738){if(_0xb73738){_0x7e2134=_0xb73738;_0x3f7cb3[_0x0181('0x3f')]=_[_0x0181('0x52')](db['SalesforceField']['rawAttributes']);_0x3f7cb3[_0x0181('0x40')]=_[_0x0181('0x52')](_0x2562ed['query']);_0x3f7cb3[_0x0181('0x49')]=_[_0x0181('0x41')](_0x3f7cb3[_0x0181('0x3f')],_0x3f7cb3['query']);_0x333897['attributes']=_['intersection'](_0x3f7cb3[_0x0181('0x3f')],qs[_0x0181('0x42')](_0x2562ed[_0x0181('0x40')]['fields']));_0x333897[_0x0181('0x43')]=_0x333897[_0x0181('0x43')][_0x0181('0x44')]?_0x333897[_0x0181('0x43')]:_0x3f7cb3['model'];_0x333897[_0x0181('0x46')]=qs[_0x0181('0x47')](_0x2562ed[_0x0181('0x40')][_0x0181('0x47')]);_0x333897['where']=qs[_0x0181('0x49')](_[_0x0181('0x4a')](_0x2562ed['query'],_0x3f7cb3['filters']));if(_0x2562ed[_0x0181('0x40')][_0x0181('0x4d')]){_0x333897['where']=_[_0x0181('0x39')](_0x333897[_0x0181('0x48')],{'$or':_[_0x0181('0x4b')](_0x333897[_0x0181('0x43')],function(_0x54f549){var _0x5ac580={};_0x5ac580[_0x54f549]={'$like':'%'+_0x2562ed[_0x0181('0x40')][_0x0181('0x4d')]+'%'};return _0x5ac580;})});}_0x333897=_[_0x0181('0x39')]({},_0x333897,_0x2562ed[_0x0181('0x55')]);return _0x7e2134[_0x0181('0x5c')](_0x333897);}})['then'](function(_0x3f6259){if(_0x3f6259){_0x51552f=_0x3f6259[_0x0181('0x44')];if(!_0x2562ed[_0x0181('0x40')][_0x0181('0x45')](_0x0181('0x5b'))){_0x333897[_0x0181('0x2e')]=qs[_0x0181('0x2e')](_0x2562ed['query'][_0x0181('0x2e')]);_0x333897[_0x0181('0x2c')]=qs[_0x0181('0x2c')](_0x2562ed[_0x0181('0x40')][_0x0181('0x2c')]);}return _0x7e2134[_0x0181('0x5c')](_0x333897);}})['then'](function(_0x3e9fd9){if(_0x3e9fd9){return _0x3e9fd9?{'count':_0x51552f,'rows':_0x3e9fd9}:null;}})[_0x0181('0x35')](respondWithResult(_0x15af5a,null))[_0x0181('0x28')](handleError(_0x15af5a,null));};exports[_0x0181('0x5d')]=function(_0x1e2028,_0x1e8f84,_0x528078){var _0x249fa0={};var _0x31a176={};var _0xa7d0b7;var _0x26e8ad;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x1e2028['params']['id']}})[_0x0181('0x35')](handleEntityNotFound(_0x1e8f84,null))[_0x0181('0x35')](function(_0x288599){if(_0x288599){_0xa7d0b7=_0x288599;_0x31a176[_0x0181('0x3f')]=_['keys'](db['SalesforceField'][_0x0181('0x53')]);_0x31a176[_0x0181('0x40')]=_[_0x0181('0x52')](_0x1e2028[_0x0181('0x40')]);_0x31a176['filters']=_[_0x0181('0x41')](_0x31a176[_0x0181('0x3f')],_0x31a176[_0x0181('0x40')]);_0x249fa0[_0x0181('0x43')]=_[_0x0181('0x41')](_0x31a176[_0x0181('0x3f')],qs['fields'](_0x1e2028['query'][_0x0181('0x42')]));_0x249fa0[_0x0181('0x43')]=_0x249fa0[_0x0181('0x43')][_0x0181('0x44')]?_0x249fa0[_0x0181('0x43')]:_0x31a176['model'];_0x249fa0[_0x0181('0x46')]=qs[_0x0181('0x47')](_0x1e2028[_0x0181('0x40')][_0x0181('0x47')]);_0x249fa0[_0x0181('0x48')]=qs[_0x0181('0x49')](_[_0x0181('0x4a')](_0x1e2028[_0x0181('0x40')],_0x31a176[_0x0181('0x49')]));if(_0x1e2028[_0x0181('0x40')][_0x0181('0x4d')]){_0x249fa0['where']=_[_0x0181('0x39')](_0x249fa0[_0x0181('0x48')],{'$or':_['map'](_0x249fa0['attributes'],function(_0x410851){var _0x471bec={};_0x471bec[_0x410851]={'$like':'%'+_0x1e2028[_0x0181('0x40')]['filter']+'%'};return _0x471bec;})});}_0x249fa0=_[_0x0181('0x39')]({},_0x249fa0,_0x1e2028['options']);return _0xa7d0b7['getDescriptions'](_0x249fa0);}})[_0x0181('0x35')](function(_0x278233){if(_0x278233){_0x26e8ad=_0x278233['length'];if(!_0x1e2028[_0x0181('0x40')]['hasOwnProperty'](_0x0181('0x5b'))){_0x249fa0['limit']=qs['limit'](_0x1e2028[_0x0181('0x40')][_0x0181('0x2e')]);_0x249fa0[_0x0181('0x2c')]=qs['offset'](_0x1e2028['query'][_0x0181('0x2c')]);}return _0xa7d0b7['getDescriptions'](_0x249fa0);}})['then'](function(_0x5e49ac){if(_0x5e49ac){return _0x5e49ac?{'count':_0x26e8ad,'rows':_0x5e49ac}:null;}})[_0x0181('0x35')](respondWithResult(_0x1e8f84,null))['catch'](handleError(_0x1e8f84,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 92c17cb..7ed2314 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 _0xa9f3=['SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x4a48be,_0x8fd845){var _0x5cec1b=function(_0xfd43c8){while(--_0xfd43c8){_0x4a48be['push'](_0x4a48be['shift']());}};_0x5cec1b(++_0x8fd845);}(_0xa9f3,0x13a));var _0x3a9f=function(_0x2ca8bd,_0x161a6f){_0x2ca8bd=_0x2ca8bd-0x0;var _0x3f72dd=_0xa9f3[_0x2ca8bd];return _0x3f72dd;};'use strict';var _=require(_0x3a9f('0x0'));var util=require('util');var logger=require(_0x3a9f('0x1'))(_0x3a9f('0x2'));var moment=require(_0x3a9f('0x3'));var BPromise=require(_0x3a9f('0x4'));var rp=require(_0x3a9f('0x5'));var fs=require('fs');var path=require(_0x3a9f('0x6'));var rimraf=require(_0x3a9f('0x7'));var config=require(_0x3a9f('0x8'));var attributes=require(_0x3a9f('0x9'));module['exports']=function(_0x597694,_0x93df10){return _0x597694['define'](_0x3a9f('0xa'),attributes,{'tableName':_0x3a9f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x977c=['exports','define','int_salesforce_configurations','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x1f6582,_0x53a13d){var _0x56f4f0=function(_0x505b24){while(--_0x505b24){_0x1f6582['push'](_0x1f6582['shift']());}};_0x56f4f0(++_0x53a13d);}(_0x977c,0x85));var _0xc977=function(_0x1e921d,_0x40b492){_0x1e921d=_0x1e921d-0x0;var _0x216006=_0x977c[_0x1e921d];return _0x216006;};'use strict';var _=require(_0xc977('0x0'));var util=require('util');var logger=require(_0xc977('0x1'))(_0xc977('0x2'));var moment=require('moment');var BPromise=require(_0xc977('0x3'));var rp=require(_0xc977('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc977('0x5'));var attributes=require(_0xc977('0x6'));module[_0xc977('0x7')]=function(_0x1f4378,_0x4da457){return _0x1f4378[_0xc977('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0xc977('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 cd89dc9..48b5237 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 _0x0353=['../../config/logger','rpc','../../config/environment','jayson/promise','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x457957,_0x136453){var _0x801cc7=function(_0xe685b){while(--_0xe685b){_0x457957['push'](_0x457957['shift']());}};_0x801cc7(++_0x136453);}(_0x0353,0x1b0));var _0x3035=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x0353[_0x166742];return _0xb7814a;};'use strict';var _=require('lodash');var util=require(_0x3035('0x0'));var moment=require(_0x3035('0x1'));var BPromise=require(_0x3035('0x2'));var rs=require(_0x3035('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3035('0x4'));var logger=require(_0x3035('0x5'))(_0x3035('0x6'));var config=require(_0x3035('0x7'));var jayson=require(_0x3035('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32717d,_0x5cd7d8,_0x4acc0c){return new BPromise(function(_0x3a0b71,_0x47aff9){return client['request'](_0x32717d,_0x4acc0c)[_0x3035('0x9')](function(_0x5a104c){logger[_0x3035('0xa')](_0x3035('0xb'),_0x5cd7d8,_0x3035('0xc'));logger[_0x3035('0xd')](_0x3035('0xe'),_0x5cd7d8,_0x3035('0xc'),JSON[_0x3035('0xf')](_0x5a104c));if(_0x5a104c[_0x3035('0x10')]){if(_0x5a104c[_0x3035('0x10')]['code']===0x1f4){logger['error'](_0x3035('0xb'),_0x5cd7d8,_0x5a104c[_0x3035('0x10')][_0x3035('0x11')]);return _0x47aff9(_0x5a104c['error'][_0x3035('0x11')]);}logger[_0x3035('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5cd7d8,_0x5a104c[_0x3035('0x10')][_0x3035('0x11')]);return _0x3a0b71(_0x5a104c[_0x3035('0x10')][_0x3035('0x11')]);}else{logger[_0x3035('0xa')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5cd7d8,'request\x20sent');_0x3a0b71(_0x5a104c[_0x3035('0x12')][_0x3035('0x11')]);}})['catch'](function(_0x1ae853){logger[_0x3035('0x10')](_0x3035('0xb'),_0x5cd7d8,_0x1ae853);_0x47aff9(_0x1ae853);});});} \ No newline at end of file +var _0xe7b2=['info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x369180,_0x21bfd6){var _0x3f9897=function(_0xc7435d){while(--_0xc7435d){_0x369180['push'](_0x369180['shift']());}};_0x3f9897(++_0x21bfd6);}(_0xe7b2,0x1ed));var _0x2e7b=function(_0x354c14,_0x2dc124){_0x354c14=_0x354c14-0x0;var _0x31476d=_0xe7b2[_0x354c14];return _0x31476d;};'use strict';var _=require('lodash');var util=require(_0x2e7b('0x0'));var moment=require(_0x2e7b('0x1'));var BPromise=require(_0x2e7b('0x2'));var rs=require(_0x2e7b('0x3'));var fs=require('fs');var Redis=require(_0x2e7b('0x4'));var db=require(_0x2e7b('0x5'))['db'];var utils=require(_0x2e7b('0x6'));var logger=require(_0x2e7b('0x7'))(_0x2e7b('0x8'));var config=require(_0x2e7b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2e7b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x190f78,_0x2c0cd1,_0x28b225){return new BPromise(function(_0x3f852b,_0xc16165){return client[_0x2e7b('0xb')](_0x190f78,_0x28b225)[_0x2e7b('0xc')](function(_0x32087f){logger[_0x2e7b('0xd')](_0x2e7b('0xe'),_0x2c0cd1,_0x2e7b('0xf'));logger[_0x2e7b('0x10')](_0x2e7b('0x11'),_0x2c0cd1,_0x2e7b('0xf'),JSON[_0x2e7b('0x12')](_0x32087f));if(_0x32087f[_0x2e7b('0x13')]){if(_0x32087f[_0x2e7b('0x13')]['code']===0x1f4){logger[_0x2e7b('0x13')](_0x2e7b('0xe'),_0x2c0cd1,_0x32087f[_0x2e7b('0x13')][_0x2e7b('0x14')]);return _0xc16165(_0x32087f['error'][_0x2e7b('0x14')]);}logger[_0x2e7b('0x13')](_0x2e7b('0xe'),_0x2c0cd1,_0x32087f[_0x2e7b('0x13')]['message']);return _0x3f852b(_0x32087f[_0x2e7b('0x13')]['message']);}else{logger[_0x2e7b('0xd')](_0x2e7b('0xe'),_0x2c0cd1,_0x2e7b('0xf'));_0x3f852b(_0x32087f[_0x2e7b('0x15')][_0x2e7b('0x14')]);}})['catch'](function(_0x434cb8){logger[_0x2e7b('0x13')](_0x2e7b('0xe'),_0x2c0cd1,_0x434cb8);_0xc16165(_0x434cb8);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index ab9c681..3ce0b2f 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 _0x8212=['isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller'];(function(_0x27e537,_0xb9513e){var _0x50cc25=function(_0x800413){while(--_0x800413){_0x27e537['push'](_0x27e537['shift']());}};_0x50cc25(++_0xb9513e);}(_0x8212,0xb3));var _0x2821=function(_0x585b47,_0x1d322b){_0x585b47=_0x585b47-0x0;var _0x53519b=_0x8212[_0x585b47];return _0x53519b;};'use strict';var multer=require(_0x2821('0x0'));var util=require(_0x2821('0x1'));var path=require('path');var timeout=require(_0x2821('0x2'));var express=require(_0x2821('0x3'));var router=express[_0x2821('0x4')]();var fs_extra=require(_0x2821('0x5'));var auth=require(_0x2821('0x6'));var interaction=require(_0x2821('0x7'));var config=require(_0x2821('0x8'));var controller=require(_0x2821('0x9'));router['get']('/',auth[_0x2821('0xa')](),controller['index']);router[_0x2821('0xb')](_0x2821('0xc'),auth['isAuthenticated'](),controller[_0x2821('0xd')]);router[_0x2821('0xe')]('/',auth[_0x2821('0xa')](),controller[_0x2821('0xf')]);router[_0x2821('0x10')](_0x2821('0xc'),auth[_0x2821('0xa')](),controller[_0x2821('0x11')]);router[_0x2821('0x12')]('/:id',auth[_0x2821('0xa')](),controller[_0x2821('0x13')]);module[_0x2821('0x14')]=router; \ No newline at end of file +var _0x17a7=['express','Router','fs-extra','../../components/interaction/service','./intSalesforceField.controller','get','index','/:id','isAuthenticated','post','create','update','destroy','exports','connect-timeout'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0x17a7,0xc2));var _0x717a=function(_0xad5656,_0x57638d){_0xad5656=_0xad5656-0x0;var _0x37a359=_0x17a7[_0xad5656];return _0x37a359;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x717a('0x0'));var express=require(_0x717a('0x1'));var router=express[_0x717a('0x2')]();var fs_extra=require(_0x717a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x717a('0x4'));var config=require('../../config/environment');var controller=require(_0x717a('0x5'));router[_0x717a('0x6')]('/',auth['isAuthenticated'](),controller[_0x717a('0x7')]);router[_0x717a('0x6')](_0x717a('0x8'),auth[_0x717a('0x9')](),controller['show']);router[_0x717a('0xa')]('/',auth['isAuthenticated'](),controller[_0x717a('0xb')]);router['put'](_0x717a('0x8'),auth[_0x717a('0x9')](),controller[_0x717a('0xc')]);router['delete']('/:id',auth[_0x717a('0x9')](),controller[_0x717a('0xd')]);module[_0x717a('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 5bca0bc..b4e303b 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 _0xe706=['STRING','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x412092,_0x48c962){var _0x3667d4=function(_0x144b7d){while(--_0x144b7d){_0x412092['push'](_0x412092['shift']());}};_0x3667d4(++_0x48c962);}(_0xe706,0xa3));var _0x6e70=function(_0x11bee4,_0x117d71){_0x11bee4=_0x11bee4-0x0;var _0x110e2a=_0xe706[_0x11bee4];return _0x110e2a;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'type':{'type':Sequelize[_0x6e70('0x2')]('string',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'defaultValue':_0x6e70('0x7')},'content':{'type':Sequelize[_0x6e70('0x8')]},'key':{'type':Sequelize[_0x6e70('0x8')]},'keyType':{'type':Sequelize[_0x6e70('0x2')](_0x6e70('0x7'),_0x6e70('0x3'),_0x6e70('0x4'))},'keyContent':{'type':Sequelize[_0x6e70('0x8')]},'idField':{'type':Sequelize[_0x6e70('0x8')]},'variableName':{'type':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0x9c44=['variable','customVariable','keyValue','picklist','STRING','ENUM','string'];(function(_0x2d92bd,_0x416726){var _0x51a00f=function(_0x12f323){while(--_0x12f323){_0x2d92bd['push'](_0x2d92bd['shift']());}};_0x51a00f(++_0x416726);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x49c4('0x0')](_0x49c4('0x1'),_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x49c4('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x49c4('0x1'),_0x49c4('0x2'),_0x49c4('0x3'))},'keyContent':{'type':Sequelize[_0x49c4('0x6')]},'idField':{'type':Sequelize[_0x49c4('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 21f3790..f991a98 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 _0x726b=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','fields','length','find','create','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','reject','update','then','destroy','error','stack','name','send','render','body','message','agent','interaction','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','order','sort'];(function(_0x2504a6,_0x5438e0){var _0x3ce9a3=function(_0x30bd4a){while(--_0x30bd4a){_0x2504a6['push'](_0x2504a6['shift']());}};_0x3ce9a3(++_0x5438e0);}(_0x726b,0x134));var _0xb726=function(_0xef87eb,_0x361a46){_0xef87eb=_0xef87eb-0x0;var _0x481a16=_0x726b[_0xef87eb];return _0x481a16;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb726('0x0'));var zipdir=require(_0xb726('0x1'));var jsonpatch=require(_0xb726('0x2'));var rp=require(_0xb726('0x3'));var moment=require(_0xb726('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb726('0x5'));var util=require(_0xb726('0x6'));var path=require(_0xb726('0x7'));var sox=require('sox');var csv=require(_0xb726('0x8'));var ejs=require(_0xb726('0x9'));var fs=require('fs');var fs_extra=require(_0xb726('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb726('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb726('0x8'));var querystring=require(_0xb726('0xc'));var Papa=require(_0xb726('0xd'));var Redis=require('ioredis');var authService=require(_0xb726('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb726('0xf'));var logger=require(_0xb726('0x10'))(_0xb726('0x11'));var utils=require(_0xb726('0x12'));var config=require(_0xb726('0x13'));var licenseUtil=require(_0xb726('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x487796,_0x4edf4e){_0x4edf4e=_0x4edf4e||0xcc;return function(_0x527e87){if(_0x527e87){return _0x487796[_0xb726('0x15')](_0x4edf4e);}return _0x487796['status'](_0x4edf4e)[_0xb726('0x16')]();};}function respondWithResult(_0x488589,_0x50b516){_0x50b516=_0x50b516||0xc8;return function(_0xf94ba8){if(_0xf94ba8){return _0x488589[_0xb726('0x17')](_0x50b516)[_0xb726('0x18')](_0xf94ba8);}};}function respondWithFilteredResult(_0x206880,_0x5698f4){return function(_0x23b41b){if(_0x23b41b){var _0x4d2a32=typeof _0x5698f4['offset']===_0xb726('0x19')&&typeof _0x5698f4[_0xb726('0x1a')]===_0xb726('0x19');var _0xb4757=_0x23b41b[_0xb726('0x1b')];var _0x508f9a=_0x4d2a32?0x0:_0x5698f4['offset'];var _0x56f907=_0x4d2a32?_0x23b41b[_0xb726('0x1b')]:_0x5698f4[_0xb726('0x1c')]+_0x5698f4[_0xb726('0x1a')];var _0x2188bd;if(_0x56f907>=_0xb4757){_0x56f907=_0xb4757;_0x2188bd=0xc8;}else{_0x2188bd=0xce;}_0x206880[_0xb726('0x17')](_0x2188bd);return _0x206880['set'](_0xb726('0x1d'),_0x508f9a+'-'+_0x56f907+'/'+_0xb4757)['json'](_0x23b41b);}return null;};}function patchUpdates(_0x4a4e67){return function(_0x3a0d31){try{jsonpatch['apply'](_0x3a0d31,_0x4a4e67,!![]);}catch(_0x2db672){return BPromise[_0xb726('0x1e')](_0x2db672);}return _0x3a0d31['save']();};}function saveUpdates(_0x38be18,_0x4b27d3){return function(_0xbe42fb){if(_0xbe42fb){return _0xbe42fb[_0xb726('0x1f')](_0x38be18)[_0xb726('0x20')](function(_0x33345a){return _0x33345a;});}return null;};}function removeEntity(_0x255718,_0x8511e0){return function(_0xa9a4f4){if(_0xa9a4f4){return _0xa9a4f4[_0xb726('0x21')]()[_0xb726('0x20')](function(){_0x255718['status'](0xcc)[_0xb726('0x16')]();});}};}function handleEntityNotFound(_0x145c29,_0x53e858){return function(_0x2755f6){if(!_0x2755f6){_0x145c29[_0xb726('0x15')](0x194);}return _0x2755f6;};}function handleError(_0x286fb2,_0x5294f2){_0x5294f2=_0x5294f2||0x1f4;return function(_0x929add){logger[_0xb726('0x22')](_0x929add[_0xb726('0x23')]);if(_0x929add[_0xb726('0x24')]){delete _0x929add[_0xb726('0x24')];}_0x286fb2[_0xb726('0x17')](_0x5294f2)[_0xb726('0x25')](_0x929add);};}function getMustacheRender(_0x59ba88,_0x3082c0){return Mustache[_0xb726('0x26')](_0x59ba88,_['merge'](_0x3082c0[_0xb726('0x27')],{'contact':_0x3082c0['contact'],'message':_0x3082c0[_0xb726('0x28')],'agent':_0x3082c0[_0xb726('0x29')],'interaction':_0x3082c0[_0xb726('0x2a')],'account':_0x3082c0['account']}))||'';}exports['index']=function(_0x12fc21,_0x3ba8b1){var _0x5e02af={},_0x27416a={},_0x211397={'count':0x0,'rows':[]};var _0x569a14=_[_0xb726('0x2b')](db[_0xb726('0x2c')][_0xb726('0x2d')],function(_0x4684a4){return{'name':_0x4684a4[_0xb726('0x2e')],'type':_0x4684a4[_0xb726('0x2f')][_0xb726('0x30')]};});_0x27416a[_0xb726('0x31')]=_[_0xb726('0x2b')](_0x569a14,_0xb726('0x24'));_0x27416a[_0xb726('0x32')]=_[_0xb726('0x33')](_0x12fc21[_0xb726('0x32')]);_0x27416a[_0xb726('0x34')]=_[_0xb726('0x35')](_0x27416a[_0xb726('0x31')],_0x27416a['query']);_0x5e02af[_0xb726('0x36')]=_[_0xb726('0x35')](_0x27416a[_0xb726('0x31')],qs['fields'](_0x12fc21['query']['fields']));_0x5e02af[_0xb726('0x36')]=_0x5e02af[_0xb726('0x36')]['length']?_0x5e02af[_0xb726('0x36')]:_0x27416a[_0xb726('0x31')];if(!_0x12fc21[_0xb726('0x32')]['hasOwnProperty']('nolimit')){_0x5e02af[_0xb726('0x1a')]=qs[_0xb726('0x1a')](_0x12fc21[_0xb726('0x32')]['limit']);_0x5e02af['offset']=qs[_0xb726('0x1c')](_0x12fc21['query'][_0xb726('0x1c')]);}_0x5e02af[_0xb726('0x37')]=qs[_0xb726('0x38')](_0x12fc21[_0xb726('0x32')]['sort']);_0x5e02af[_0xb726('0x39')]=qs[_0xb726('0x34')](_[_0xb726('0x3a')](_0x12fc21['query'],_0x27416a[_0xb726('0x34')]),_0x569a14);if(_0x12fc21['query'][_0xb726('0x3b')]){_0x5e02af[_0xb726('0x39')]=_[_0xb726('0x3c')](_0x5e02af['where'],{'$or':_[_0xb726('0x2b')](_0x569a14,function(_0xafe1a0){if(_0xafe1a0[_0xb726('0x2f')]!==_0xb726('0x3d')){var _0x2c1ea8={};_0x2c1ea8[_0xafe1a0[_0xb726('0x24')]]={'$like':'%'+_0x12fc21['query'][_0xb726('0x3b')]+'%'};return _0x2c1ea8;}})});}_0x5e02af=_[_0xb726('0x3c')]({},_0x5e02af,_0x12fc21[_0xb726('0x3e')]);var _0x1cf33d={'where':_0x5e02af[_0xb726('0x39')]};return db[_0xb726('0x2c')][_0xb726('0x1b')](_0x1cf33d)[_0xb726('0x20')](function(_0x388d58){_0x211397['count']=_0x388d58;if(_0x12fc21[_0xb726('0x32')][_0xb726('0x3f')]){_0x5e02af[_0xb726('0x40')]=[{'all':!![]}];}return db['SalesforceField'][_0xb726('0x41')](_0x5e02af);})[_0xb726('0x20')](function(_0x3dd084){_0x211397[_0xb726('0x42')]=_0x3dd084;return _0x211397;})[_0xb726('0x20')](respondWithFilteredResult(_0x3ba8b1,_0x5e02af))[_0xb726('0x43')](handleError(_0x3ba8b1,null));};exports['show']=function(_0x217b97,_0x12534f){var _0x3917e8={'raw':!![],'where':{'id':_0x217b97['params']['id']}},_0x3d08b6={};_0x3d08b6[_0xb726('0x31')]=_['keys'](db[_0xb726('0x2c')][_0xb726('0x2d')]);_0x3d08b6[_0xb726('0x32')]=_[_0xb726('0x33')](_0x217b97[_0xb726('0x32')]);_0x3d08b6[_0xb726('0x34')]=_[_0xb726('0x35')](_0x3d08b6[_0xb726('0x31')],_0x3d08b6[_0xb726('0x32')]);_0x3917e8[_0xb726('0x36')]=_[_0xb726('0x35')](_0x3d08b6[_0xb726('0x31')],qs[_0xb726('0x44')](_0x217b97[_0xb726('0x32')][_0xb726('0x44')]));_0x3917e8['attributes']=_0x3917e8[_0xb726('0x36')][_0xb726('0x45')]?_0x3917e8['attributes']:_0x3d08b6[_0xb726('0x31')];if(_0x217b97[_0xb726('0x32')][_0xb726('0x3f')]){_0x3917e8[_0xb726('0x40')]=[{'all':!![]}];}_0x3917e8=_[_0xb726('0x3c')]({},_0x3917e8,_0x217b97[_0xb726('0x3e')]);return db['SalesforceField'][_0xb726('0x46')](_0x3917e8)[_0xb726('0x20')](handleEntityNotFound(_0x12534f,null))['then'](respondWithResult(_0x12534f,null))[_0xb726('0x43')](handleError(_0x12534f,null));};exports[_0xb726('0x47')]=function(_0xe0aa92,_0x37b770){return db[_0xb726('0x2c')][_0xb726('0x47')](_0xe0aa92[_0xb726('0x27')],{})[_0xb726('0x20')](respondWithResult(_0x37b770,0xc9))[_0xb726('0x43')](handleError(_0x37b770,null));};exports[_0xb726('0x1f')]=function(_0x73fdba,_0x44fd9b){if(_0x73fdba[_0xb726('0x27')]['id']){delete _0x73fdba[_0xb726('0x27')]['id'];}return db[_0xb726('0x2c')][_0xb726('0x46')]({'where':{'id':_0x73fdba[_0xb726('0x48')]['id']}})[_0xb726('0x20')](handleEntityNotFound(_0x44fd9b,null))[_0xb726('0x20')](saveUpdates(_0x73fdba[_0xb726('0x27')],null))[_0xb726('0x20')](respondWithResult(_0x44fd9b,null))[_0xb726('0x43')](handleError(_0x44fd9b,null));};exports[_0xb726('0x21')]=function(_0x1b6939,_0x57b69a){return db['SalesforceField'][_0xb726('0x46')]({'where':{'id':_0x1b6939[_0xb726('0x48')]['id']}})[_0xb726('0x20')](handleEntityNotFound(_0x57b69a,null))['then'](removeEntity(_0x57b69a,null))[_0xb726('0x43')](handleError(_0x57b69a,null));}; \ No newline at end of file +var _0x17bf=['merge','body','contact','message','agent','interaction','account','index','map','SalesforceField','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send'];(function(_0xee1d95,_0x1eb0a9){var _0x141d5d=function(_0x47b07c){while(--_0x47b07c){_0xee1d95['push'](_0xee1d95['shift']());}};_0x141d5d(++_0x1eb0a9);}(_0x17bf,0x71));var _0xf17b=function(_0x447a65,_0x130db1){_0x447a65=_0x447a65-0x0;var _0x2336f1=_0x17bf[_0x447a65];return _0x2336f1;};'use strict';var emlformat=require(_0xf17b('0x0'));var rimraf=require(_0xf17b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf17b('0x2'));var rp=require(_0xf17b('0x3'));var moment=require(_0xf17b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf17b('0x5'));var util=require('util');var path=require(_0xf17b('0x6'));var sox=require(_0xf17b('0x7'));var csv=require(_0xf17b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf17b('0x9'));var _=require(_0xf17b('0xa'));var squel=require(_0xf17b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf17b('0xc'));var Papa=require(_0xf17b('0xd'));var Redis=require(_0xf17b('0xe'));var authService=require(_0xf17b('0xf'));var qs=require(_0xf17b('0x10'));var as=require(_0xf17b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf17b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf17b('0x13'));var licenseUtil=require(_0xf17b('0x14'));var db=require(_0xf17b('0x15'))['db'];function respondWithStatusCode(_0x442cf1,_0x2e23c6){_0x2e23c6=_0x2e23c6||0xcc;return function(_0x57415a){if(_0x57415a){return _0x442cf1[_0xf17b('0x16')](_0x2e23c6);}return _0x442cf1[_0xf17b('0x17')](_0x2e23c6)['end']();};}function respondWithResult(_0x3ba628,_0x2282b3){_0x2282b3=_0x2282b3||0xc8;return function(_0x1efe61){if(_0x1efe61){return _0x3ba628[_0xf17b('0x17')](_0x2282b3)[_0xf17b('0x18')](_0x1efe61);}};}function respondWithFilteredResult(_0x2973d5,_0x27c8ae){return function(_0x3461bd){if(_0x3461bd){var _0x57f8b7=typeof _0x27c8ae[_0xf17b('0x19')]==='undefined'&&typeof _0x27c8ae[_0xf17b('0x1a')]==='undefined';var _0x4e1629=_0x3461bd[_0xf17b('0x1b')];var _0x5627a1=_0x57f8b7?0x0:_0x27c8ae[_0xf17b('0x19')];var _0x1f6d9d=_0x57f8b7?_0x3461bd[_0xf17b('0x1b')]:_0x27c8ae[_0xf17b('0x19')]+_0x27c8ae[_0xf17b('0x1a')];var _0x7450fe;if(_0x1f6d9d>=_0x4e1629){_0x1f6d9d=_0x4e1629;_0x7450fe=0xc8;}else{_0x7450fe=0xce;}_0x2973d5['status'](_0x7450fe);return _0x2973d5[_0xf17b('0x1c')](_0xf17b('0x1d'),_0x5627a1+'-'+_0x1f6d9d+'/'+_0x4e1629)['json'](_0x3461bd);}return null;};}function patchUpdates(_0x60dad7){return function(_0x3c6c7a){try{jsonpatch[_0xf17b('0x1e')](_0x3c6c7a,_0x60dad7,!![]);}catch(_0x4b14e9){return BPromise[_0xf17b('0x1f')](_0x4b14e9);}return _0x3c6c7a[_0xf17b('0x20')]();};}function saveUpdates(_0x5e613d,_0x34d065){return function(_0x349fa7){if(_0x349fa7){return _0x349fa7[_0xf17b('0x21')](_0x5e613d)[_0xf17b('0x22')](function(_0x5259c1){return _0x5259c1;});}return null;};}function removeEntity(_0x4caa00,_0x2e90f7){return function(_0x4949b1){if(_0x4949b1){return _0x4949b1[_0xf17b('0x23')]()[_0xf17b('0x22')](function(){_0x4caa00[_0xf17b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fc057,_0x4a0fed){return function(_0x51d879){if(!_0x51d879){_0x4fc057[_0xf17b('0x16')](0x194);}return _0x51d879;};}function handleError(_0x21cfe0,_0x5052dd){_0x5052dd=_0x5052dd||0x1f4;return function(_0x854f85){logger[_0xf17b('0x24')](_0x854f85['stack']);if(_0x854f85[_0xf17b('0x25')]){delete _0x854f85['name'];}_0x21cfe0[_0xf17b('0x17')](_0x5052dd)[_0xf17b('0x26')](_0x854f85);};}function getMustacheRender(_0x151ca4,_0x2913cc){return Mustache['render'](_0x151ca4,_[_0xf17b('0x27')](_0x2913cc[_0xf17b('0x28')],{'contact':_0x2913cc[_0xf17b('0x29')],'message':_0x2913cc[_0xf17b('0x2a')],'agent':_0x2913cc[_0xf17b('0x2b')],'interaction':_0x2913cc[_0xf17b('0x2c')],'account':_0x2913cc[_0xf17b('0x2d')]}))||'';}exports[_0xf17b('0x2e')]=function(_0x100617,_0x570512){var _0x2a3062={},_0x14737a={},_0x437cae={'count':0x0,'rows':[]};var _0x26b91a=_[_0xf17b('0x2f')](db[_0xf17b('0x30')][_0xf17b('0x31')],function(_0x4afcde){return{'name':_0x4afcde[_0xf17b('0x32')],'type':_0x4afcde['type']['key']};});_0x14737a[_0xf17b('0x33')]=_[_0xf17b('0x2f')](_0x26b91a,_0xf17b('0x25'));_0x14737a[_0xf17b('0x34')]=_[_0xf17b('0x35')](_0x100617['query']);_0x14737a[_0xf17b('0x36')]=_[_0xf17b('0x37')](_0x14737a['model'],_0x14737a[_0xf17b('0x34')]);_0x2a3062['attributes']=_[_0xf17b('0x37')](_0x14737a[_0xf17b('0x33')],qs[_0xf17b('0x38')](_0x100617[_0xf17b('0x34')][_0xf17b('0x38')]));_0x2a3062[_0xf17b('0x39')]=_0x2a3062[_0xf17b('0x39')][_0xf17b('0x3a')]?_0x2a3062['attributes']:_0x14737a[_0xf17b('0x33')];if(!_0x100617['query'][_0xf17b('0x3b')]('nolimit')){_0x2a3062['limit']=qs['limit'](_0x100617[_0xf17b('0x34')][_0xf17b('0x1a')]);_0x2a3062[_0xf17b('0x19')]=qs['offset'](_0x100617[_0xf17b('0x34')][_0xf17b('0x19')]);}_0x2a3062[_0xf17b('0x3c')]=qs['sort'](_0x100617[_0xf17b('0x34')][_0xf17b('0x3d')]);_0x2a3062[_0xf17b('0x3e')]=qs['filters'](_[_0xf17b('0x3f')](_0x100617[_0xf17b('0x34')],_0x14737a['filters']),_0x26b91a);if(_0x100617['query'][_0xf17b('0x40')]){_0x2a3062[_0xf17b('0x3e')]=_['merge'](_0x2a3062[_0xf17b('0x3e')],{'$or':_[_0xf17b('0x2f')](_0x26b91a,function(_0x3081df){if(_0x3081df['type']!==_0xf17b('0x41')){var _0x38f99c={};_0x38f99c[_0x3081df[_0xf17b('0x25')]]={'$like':'%'+_0x100617[_0xf17b('0x34')][_0xf17b('0x40')]+'%'};return _0x38f99c;}})});}_0x2a3062=_[_0xf17b('0x27')]({},_0x2a3062,_0x100617[_0xf17b('0x42')]);var _0x1d26ca={'where':_0x2a3062[_0xf17b('0x3e')]};return db['SalesforceField'][_0xf17b('0x1b')](_0x1d26ca)[_0xf17b('0x22')](function(_0x99d602){_0x437cae['count']=_0x99d602;if(_0x100617[_0xf17b('0x34')]['includeAll']){_0x2a3062[_0xf17b('0x43')]=[{'all':!![]}];}return db[_0xf17b('0x30')][_0xf17b('0x44')](_0x2a3062);})[_0xf17b('0x22')](function(_0x39c1fe){_0x437cae[_0xf17b('0x45')]=_0x39c1fe;return _0x437cae;})[_0xf17b('0x22')](respondWithFilteredResult(_0x570512,_0x2a3062))[_0xf17b('0x46')](handleError(_0x570512,null));};exports[_0xf17b('0x47')]=function(_0xafb341,_0xbf1775){var _0x48f145={'raw':!![],'where':{'id':_0xafb341[_0xf17b('0x48')]['id']}},_0x479646={};_0x479646[_0xf17b('0x33')]=_[_0xf17b('0x35')](db[_0xf17b('0x30')]['rawAttributes']);_0x479646[_0xf17b('0x34')]=_[_0xf17b('0x35')](_0xafb341['query']);_0x479646['filters']=_[_0xf17b('0x37')](_0x479646[_0xf17b('0x33')],_0x479646[_0xf17b('0x34')]);_0x48f145[_0xf17b('0x39')]=_[_0xf17b('0x37')](_0x479646[_0xf17b('0x33')],qs['fields'](_0xafb341[_0xf17b('0x34')][_0xf17b('0x38')]));_0x48f145[_0xf17b('0x39')]=_0x48f145[_0xf17b('0x39')]['length']?_0x48f145[_0xf17b('0x39')]:_0x479646[_0xf17b('0x33')];if(_0xafb341['query'][_0xf17b('0x49')]){_0x48f145[_0xf17b('0x43')]=[{'all':!![]}];}_0x48f145=_['merge']({},_0x48f145,_0xafb341[_0xf17b('0x42')]);return db[_0xf17b('0x30')][_0xf17b('0x4a')](_0x48f145)[_0xf17b('0x22')](handleEntityNotFound(_0xbf1775,null))['then'](respondWithResult(_0xbf1775,null))[_0xf17b('0x46')](handleError(_0xbf1775,null));};exports[_0xf17b('0x4b')]=function(_0x1a428a,_0x40b653){return db[_0xf17b('0x30')][_0xf17b('0x4b')](_0x1a428a['body'],{})[_0xf17b('0x22')](respondWithResult(_0x40b653,0xc9))[_0xf17b('0x46')](handleError(_0x40b653,null));};exports[_0xf17b('0x21')]=function(_0x1b1204,_0x5e83c3){if(_0x1b1204[_0xf17b('0x28')]['id']){delete _0x1b1204[_0xf17b('0x28')]['id'];}return db[_0xf17b('0x30')][_0xf17b('0x4a')]({'where':{'id':_0x1b1204['params']['id']}})['then'](handleEntityNotFound(_0x5e83c3,null))[_0xf17b('0x22')](saveUpdates(_0x1b1204[_0xf17b('0x28')],null))[_0xf17b('0x22')](respondWithResult(_0x5e83c3,null))['catch'](handleError(_0x5e83c3,null));};exports[_0xf17b('0x23')]=function(_0x1c92ba,_0x33041c){return db[_0xf17b('0x30')]['find']({'where':{'id':_0x1c92ba[_0xf17b('0x48')]['id']}})['then'](handleEntityNotFound(_0x33041c,null))[_0xf17b('0x22')](removeEntity(_0x33041c,null))[_0xf17b('0x46')](handleError(_0x33041c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index c29c71b..b745de0 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 _0x1d25=['exports','define','int_salesforce_fields','idField','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intSalesforceField.attributes'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1d25,0xba));var _0x51d2=function(_0x176d14,_0x3984ea){_0x176d14=_0x176d14-0x0;var _0x89522c=_0x1d25[_0x176d14];return _0x89522c;};'use strict';var _=require(_0x51d2('0x0'));var util=require(_0x51d2('0x1'));var logger=require(_0x51d2('0x2'))(_0x51d2('0x3'));var moment=require(_0x51d2('0x4'));var BPromise=require('bluebird');var rp=require(_0x51d2('0x5'));var fs=require('fs');var path=require(_0x51d2('0x6'));var rimraf=require('rimraf');var config=require(_0x51d2('0x7'));var attributes=require(_0x51d2('0x8'));module[_0x51d2('0x9')]=function(_0x407091,_0x449fec){return _0x407091[_0x51d2('0xa')]('SalesforceField',attributes,{'tableName':_0x51d2('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x51d2('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e84=['./intSalesforceField.attributes','SalesforceField','int_salesforce_fields','salesforce_unique_index','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3e84,0xd4));var _0x43e8=function(_0x4b3d13,_0x1993d5){_0x4b3d13=_0x4b3d13-0x0;var _0xf64dd8=_0x3e84[_0x4b3d13];return _0xf64dd8;};'use strict';var _=require('lodash');var util=require(_0x43e8('0x0'));var logger=require(_0x43e8('0x1'))(_0x43e8('0x2'));var moment=require(_0x43e8('0x3'));var BPromise=require(_0x43e8('0x4'));var rp=require(_0x43e8('0x5'));var fs=require('fs');var path=require(_0x43e8('0x6'));var rimraf=require(_0x43e8('0x7'));var config=require(_0x43e8('0x8'));var attributes=require(_0x43e8('0x9'));module['exports']=function(_0x53fc95,_0x20463e){return _0x53fc95['define'](_0x43e8('0xa'),attributes,{'tableName':_0x43e8('0xb'),'paranoid':![],'indexes':[{'name':_0x43e8('0xc'),'fields':['idField','FieldId'],'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 cae85a5..b734a6c 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 _0x750a=['error','code','SalesforceField,\x20%s,\x20%s','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify'];(function(_0x46c51a,_0x5dd2e8){var _0x9fe477=function(_0x794225){while(--_0x794225){_0x46c51a['push'](_0x46c51a['shift']());}};_0x9fe477(++_0x5dd2e8);}(_0x750a,0x140));var _0xa750=function(_0x44c02b,_0x3a13b0){_0x44c02b=_0x44c02b-0x0;var _0x3aa190=_0x750a[_0x44c02b];return _0x3aa190;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('SalesforceField,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x38fa3d,_0x3ff44a){var _0x284fdb=function(_0x4dae43){while(--_0x4dae43){_0x38fa3d['push'](_0x38fa3d['shift']());}};_0x284fdb(++_0x3ff44a);}(_0xe706,0xa3));var _0x6e70=function(_0x5f2fea,_0x9fde07){_0x5f2fea=_0x5f2fea-0x0;var _0x198a0c=_0xe706[_0x5f2fea];return _0x198a0c;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('SalesforceField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 4325b7b..10caa7d 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 _0x7916=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','destroy','multer','path','connect-timeout'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7916,0x128));var _0x6791=function(_0x446fe7,_0x32c2c9){_0x446fe7=_0x446fe7-0x0;var _0x5a076e=_0x7916[_0x446fe7];return _0x5a076e;};'use strict';var multer=require(_0x6791('0x0'));var util=require('util');var path=require(_0x6791('0x1'));var timeout=require(_0x6791('0x2'));var express=require('express');var router=express[_0x6791('0x3')]();var fs_extra=require(_0x6791('0x4'));var auth=require(_0x6791('0x5'));var interaction=require(_0x6791('0x6'));var config=require('../../config/environment');var controller=require(_0x6791('0x7'));router['get']('/',auth[_0x6791('0x8')](),controller[_0x6791('0x9')]);router['get'](_0x6791('0xa'),auth['isAuthenticated'](),controller[_0x6791('0xb')]);router['get']('/:id/configurations',auth[_0x6791('0x8')](),controller[_0x6791('0xc')]);router['get'](_0x6791('0xd'),auth[_0x6791('0x8')](),controller[_0x6791('0xe')]);router['post']('/',auth[_0x6791('0x8')](),controller[_0x6791('0xf')]);router[_0x6791('0x10')](_0x6791('0x11'),auth[_0x6791('0x8')](),controller[_0x6791('0x12')]);router[_0x6791('0x13')](_0x6791('0xa'),auth[_0x6791('0x8')](),controller[_0x6791('0x14')]);router[_0x6791('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x6791('0x16')]);module['exports']=router; \ No newline at end of file +var _0x0598=['delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','create','post','put','update'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0x0598,0x92));var _0x8059=function(_0x47af81,_0x21a81e){_0x47af81=_0x47af81-0x0;var _0xd796c7=_0x0598[_0x47af81];return _0xd796c7;};'use strict';var multer=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var path=require('path');var timeout=require(_0x8059('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8059('0x3'));var auth=require(_0x8059('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0x8059('0x5')]('/',auth[_0x8059('0x6')](),controller['index']);router['get'](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0x8')]);router[_0x8059('0x5')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8059('0x9')]);router[_0x8059('0x5')](_0x8059('0xa'),auth[_0x8059('0x6')](),controller[_0x8059('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8059('0xc')]);router[_0x8059('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x8059('0xe')](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0xf')]);router[_0x8059('0x10')]('/:id',auth[_0x8059('0x6')](),controller['destroy']);module[_0x8059('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 68a58a9..5df502b 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 _0x4468=['username','sequelize','exports','STRING'];(function(_0xaf025d,_0x586d7a){var _0x1c77cb=function(_0x560b3a){while(--_0x560b3a){_0xaf025d['push'](_0xaf025d['shift']());}};_0x1c77cb(++_0x586d7a);}(_0x4468,0xad));var _0x8446=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x4468[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require(_0x8446('0x0'));module[_0x8446('0x1')]={'name':{'type':Sequelize[_0x8446('0x2')]},'description':{'type':Sequelize[_0x8446('0x2')]},'username':{'type':Sequelize[_0x8446('0x2')],'unique':_0x8446('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8446('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x8446('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0ac8=['STRING','username','exports'];(function(_0x4904af,_0x4418bc){var _0x2a2f45=function(_0x282c43){while(--_0x282c43){_0x4904af['push'](_0x4904af['shift']());}};_0x2a2f45(++_0x4418bc);}(_0x0ac8,0x1c1));var _0x80ac=function(_0x32b5b1,_0x1da9ad){_0x32b5b1=_0x32b5b1-0x0;var _0x1fcc4c=_0x0ac8[_0x32b5b1];return _0x1fcc4c;};'use strict';var Sequelize=require('sequelize');module[_0x80ac('0x0')]={'name':{'type':Sequelize[_0x80ac('0x1')]},'description':{'type':Sequelize[_0x80ac('0x1')]},'username':{'type':Sequelize[_0x80ac('0x1')],'unique':_0x80ac('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x80ac('0x1')]},'remoteUri':{'type':Sequelize[_0x80ac('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x80ac('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index a93b429..a817475 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 _0xd365=['sox','to-csv','fs-extra','lodash','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','../../components/integrations/configuration','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','count','set','json','apply','save','update','then','destroy','name','send','render','merge','body','contact','agent','interaction','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','includeAll','include','findAll','rows','find','create','params','getConfigurations','findOne','pick','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','hold_reason','knowledge','close_code','notify','incident_state','severity','category','parent','made_sla','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','rfc','expected_start','opened_at','work_end','reopened_time','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','contact_type','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','all','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','statusCode','stack','test','Wrong\x20credentials','boolean','true','False','false','value','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd365,0x183));var _0x5d36=function(_0x5d215a,_0x41b551){_0x5d215a=_0x5d215a-0x0;var _0x320ba2=_0xd365[_0x5d215a];return _0x320ba2;};'use strict';var emlformat=require(_0x5d36('0x0'));var rimraf=require(_0x5d36('0x1'));var zipdir=require(_0x5d36('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d36('0x3'));var moment=require(_0x5d36('0x4'));var BPromise=require(_0x5d36('0x5'));var Mustache=require('mustache');var util=require(_0x5d36('0x6'));var path=require('path');var sox=require(_0x5d36('0x7'));var csv=require(_0x5d36('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5d36('0x9'));var _=require(_0x5d36('0xa'));var squel=require('squel');var crypto=require(_0x5d36('0xb'));var jsforce=require(_0x5d36('0xc'));var deskjs=require(_0x5d36('0xd'));var toCsv=require(_0x5d36('0x8'));var querystring=require(_0x5d36('0xe'));var Papa=require(_0x5d36('0xf'));var Redis=require(_0x5d36('0x10'));var authService=require(_0x5d36('0x11'));var qs=require(_0x5d36('0x12'));var as=require(_0x5d36('0x13'));var hardwareService=require(_0x5d36('0x14'));var logger=require('../../config/logger')(_0x5d36('0x15'));var utils=require(_0x5d36('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5d36('0x17'));var db=require(_0x5d36('0x18'))['db'];var integrations=require(_0x5d36('0x19'));var jayson=require(_0x5d36('0x1a'));var client=jayson[_0x5d36('0x1b')][_0x5d36('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xa71f8d,_0x4ad599,_0x696ad8,_0x8f223d){return new BPromise(function(_0x3b646b,_0x3a4096){var _0x55a81f=_0x8f223d||client;return _0x55a81f[_0x5d36('0x1d')](_0xa71f8d,_0x696ad8)['then'](function(_0x308531){logger[_0x5d36('0x1e')](_0x5d36('0x1f'),_0x4ad599,_0x5d36('0x20'));logger[_0x5d36('0x21')](_0x5d36('0x22'),_0x4ad599,_0x5d36('0x20'),JSON[_0x5d36('0x23')](_0x308531));if(_0x308531[_0x5d36('0x24')]){if(_0x308531[_0x5d36('0x24')][_0x5d36('0x25')]===0x1f4){logger['error'](_0x5d36('0x1f'),_0x4ad599,_0x308531['error']['message']);return _0x3a4096(_0x308531[_0x5d36('0x24')][_0x5d36('0x26')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x4ad599,_0x308531[_0x5d36('0x24')][_0x5d36('0x26')]);return _0x3b646b(_0x308531[_0x5d36('0x24')][_0x5d36('0x26')]);}else{logger[_0x5d36('0x1e')]('ServicenowAccount,\x20%s,\x20%s',_0x4ad599,_0x5d36('0x20'));_0x3b646b(_0x308531[_0x5d36('0x27')][_0x5d36('0x26')]);}})[_0x5d36('0x28')](function(_0x3bf3cb){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x4ad599,_0x3bf3cb);_0x3a4096(_0x3bf3cb);});});}function respondWithStatusCode(_0x3f8ed8,_0x590998){_0x590998=_0x590998||0xcc;return function(_0x1b50f6){if(_0x1b50f6){return _0x3f8ed8[_0x5d36('0x29')](_0x590998);}return _0x3f8ed8[_0x5d36('0x2a')](_0x590998)[_0x5d36('0x2b')]();};}function respondWithResult(_0xc906a2,_0x33ea0c){_0x33ea0c=_0x33ea0c||0xc8;return function(_0x452825){if(_0x452825){return _0xc906a2[_0x5d36('0x2a')](_0x33ea0c)['json'](_0x452825);}};}function respondWithFilteredResult(_0xfba56c,_0x188824){return function(_0x776ebd){if(_0x776ebd){var _0xc95c1e=typeof _0x188824[_0x5d36('0x2c')]==='undefined'&&typeof _0x188824[_0x5d36('0x2d')]==='undefined';var _0x24d9c2=_0x776ebd[_0x5d36('0x2e')];var _0x1f5a24=_0xc95c1e?0x0:_0x188824[_0x5d36('0x2c')];var _0x1b41ab=_0xc95c1e?_0x776ebd[_0x5d36('0x2e')]:_0x188824[_0x5d36('0x2c')]+_0x188824[_0x5d36('0x2d')];var _0x5367f7;if(_0x1b41ab>=_0x24d9c2){_0x1b41ab=_0x24d9c2;_0x5367f7=0xc8;}else{_0x5367f7=0xce;}_0xfba56c[_0x5d36('0x2a')](_0x5367f7);return _0xfba56c[_0x5d36('0x2f')]('Content-Range',_0x1f5a24+'-'+_0x1b41ab+'/'+_0x24d9c2)[_0x5d36('0x30')](_0x776ebd);}return null;};}function patchUpdates(_0x16fb72){return function(_0x245845){try{jsonpatch[_0x5d36('0x31')](_0x245845,_0x16fb72,!![]);}catch(_0x2b037b){return BPromise['reject'](_0x2b037b);}return _0x245845[_0x5d36('0x32')]();};}function saveUpdates(_0x4e13d9,_0x572978){return function(_0x34e791){if(_0x34e791){return _0x34e791[_0x5d36('0x33')](_0x4e13d9)[_0x5d36('0x34')](function(_0x53696e){return _0x53696e;});}return null;};}function removeEntity(_0x52f952,_0x381fac){return function(_0x4b8280){if(_0x4b8280){return _0x4b8280[_0x5d36('0x35')]()[_0x5d36('0x34')](function(){_0x52f952[_0x5d36('0x2a')](0xcc)[_0x5d36('0x2b')]();});}};}function handleEntityNotFound(_0x2f1bce,_0x357cb3){return function(_0x42a886){if(!_0x42a886){_0x2f1bce[_0x5d36('0x29')](0x194);}return _0x42a886;};}function handleError(_0x418037,_0x5126b2){_0x5126b2=_0x5126b2||0x1f4;return function(_0x469795){logger[_0x5d36('0x24')](_0x469795['stack']);if(_0x469795['name']){delete _0x469795[_0x5d36('0x36')];}_0x418037[_0x5d36('0x2a')](_0x5126b2)[_0x5d36('0x37')](_0x469795);};}function getMustacheRender(_0x376e10,_0x30e5ac){return Mustache[_0x5d36('0x38')](_0x376e10,_[_0x5d36('0x39')](_0x30e5ac[_0x5d36('0x3a')],{'contact':_0x30e5ac[_0x5d36('0x3b')],'message':_0x30e5ac[_0x5d36('0x26')],'agent':_0x30e5ac[_0x5d36('0x3c')],'interaction':_0x30e5ac[_0x5d36('0x3d')],'account':_0x30e5ac['account']}))||'';}exports['index']=function(_0x4e0ed4,_0x4bb2d2){var _0x31284f={},_0x37c8df={},_0x3cfe6f={'count':0x0,'rows':[]};var _0x4b8da7=_[_0x5d36('0x3e')](db[_0x5d36('0x3f')][_0x5d36('0x40')],function(_0x55804c){return{'name':_0x55804c[_0x5d36('0x41')],'type':_0x55804c[_0x5d36('0x42')][_0x5d36('0x43')]};});_0x37c8df[_0x5d36('0x44')]=_[_0x5d36('0x3e')](_0x4b8da7,_0x5d36('0x36'));_0x37c8df[_0x5d36('0x45')]=_[_0x5d36('0x46')](_0x4e0ed4[_0x5d36('0x45')]);_0x37c8df['filters']=_[_0x5d36('0x47')](_0x37c8df[_0x5d36('0x44')],_0x37c8df['query']);_0x31284f[_0x5d36('0x48')]=_['intersection'](_0x37c8df['model'],qs[_0x5d36('0x49')](_0x4e0ed4[_0x5d36('0x45')][_0x5d36('0x49')]));_0x31284f[_0x5d36('0x48')]=_0x31284f[_0x5d36('0x48')][_0x5d36('0x4a')]?_0x31284f[_0x5d36('0x48')]:_0x37c8df['model'];if(!_0x4e0ed4[_0x5d36('0x45')][_0x5d36('0x4b')](_0x5d36('0x4c'))){_0x31284f[_0x5d36('0x2d')]=qs[_0x5d36('0x2d')](_0x4e0ed4['query'][_0x5d36('0x2d')]);_0x31284f[_0x5d36('0x2c')]=qs['offset'](_0x4e0ed4[_0x5d36('0x45')][_0x5d36('0x2c')]);}_0x31284f[_0x5d36('0x4d')]=qs['sort'](_0x4e0ed4['query'][_0x5d36('0x4e')]);_0x31284f[_0x5d36('0x4f')]=qs[_0x5d36('0x50')](_['pick'](_0x4e0ed4[_0x5d36('0x45')],_0x37c8df['filters']),_0x4b8da7);if(_0x4e0ed4[_0x5d36('0x45')][_0x5d36('0x51')]){_0x31284f[_0x5d36('0x4f')]=_[_0x5d36('0x39')](_0x31284f['where'],{'$or':_[_0x5d36('0x3e')](_0x4b8da7,function(_0xe5d909){if(_0xe5d909[_0x5d36('0x42')]!==_0x5d36('0x52')){var _0x4260ce={};_0x4260ce[_0xe5d909['name']]={'$like':'%'+_0x4e0ed4[_0x5d36('0x45')][_0x5d36('0x51')]+'%'};return _0x4260ce;}})});}_0x31284f=_[_0x5d36('0x39')]({},_0x31284f,_0x4e0ed4[_0x5d36('0x53')]);var _0x406fc1={'where':_0x31284f[_0x5d36('0x4f')]};return db[_0x5d36('0x3f')][_0x5d36('0x2e')](_0x406fc1)[_0x5d36('0x34')](function(_0x526ec8){_0x3cfe6f['count']=_0x526ec8;if(_0x4e0ed4[_0x5d36('0x45')][_0x5d36('0x54')]){_0x31284f[_0x5d36('0x55')]=[{'all':!![]}];}return db[_0x5d36('0x3f')][_0x5d36('0x56')](_0x31284f);})[_0x5d36('0x34')](function(_0x53faad){_0x3cfe6f[_0x5d36('0x57')]=_0x53faad;return _0x3cfe6f;})[_0x5d36('0x34')](respondWithFilteredResult(_0x4bb2d2,_0x31284f))[_0x5d36('0x28')](handleError(_0x4bb2d2,null));};exports['show']=function(_0x1b39d1,_0x42de26){var _0x541d29={'raw':![],'where':{'id':_0x1b39d1['params']['id']}},_0x528800={};_0x528800[_0x5d36('0x44')]=_[_0x5d36('0x46')](db[_0x5d36('0x3f')][_0x5d36('0x40')]);_0x528800['query']=_[_0x5d36('0x46')](_0x1b39d1[_0x5d36('0x45')]);_0x528800[_0x5d36('0x50')]=_[_0x5d36('0x47')](_0x528800['model'],_0x528800[_0x5d36('0x45')]);_0x541d29['attributes']=_['intersection'](_0x528800[_0x5d36('0x44')],qs['fields'](_0x1b39d1['query']['fields']));_0x541d29[_0x5d36('0x48')]=_0x541d29[_0x5d36('0x48')][_0x5d36('0x4a')]?_0x541d29['attributes']:_0x528800[_0x5d36('0x44')];if(_0x1b39d1[_0x5d36('0x45')][_0x5d36('0x54')]){_0x541d29[_0x5d36('0x55')]=[{'all':!![]}];}_0x541d29=_[_0x5d36('0x39')]({},_0x541d29,_0x1b39d1[_0x5d36('0x53')]);return db['ServicenowAccount'][_0x5d36('0x58')](_0x541d29)[_0x5d36('0x34')](handleEntityNotFound(_0x42de26,null))[_0x5d36('0x34')](respondWithResult(_0x42de26,null))[_0x5d36('0x28')](handleError(_0x42de26,null));};exports[_0x5d36('0x59')]=function(_0xb49ad8,_0x33cbcb){return db[_0x5d36('0x3f')][_0x5d36('0x59')](_0xb49ad8[_0x5d36('0x3a')],{})[_0x5d36('0x34')](respondWithResult(_0x33cbcb,0xc9))[_0x5d36('0x28')](handleError(_0x33cbcb,null));};exports[_0x5d36('0x33')]=function(_0x149c76,_0x1f24d4){if(_0x149c76[_0x5d36('0x3a')]['id']){delete _0x149c76[_0x5d36('0x3a')]['id'];}return db['ServicenowAccount'][_0x5d36('0x58')]({'where':{'id':_0x149c76[_0x5d36('0x5a')]['id']}})[_0x5d36('0x34')](handleEntityNotFound(_0x1f24d4,null))['then'](saveUpdates(_0x149c76[_0x5d36('0x3a')],null))[_0x5d36('0x34')](respondWithResult(_0x1f24d4,null))[_0x5d36('0x28')](handleError(_0x1f24d4,null));};exports[_0x5d36('0x35')]=function(_0x1b44b,_0x4cb963){return db[_0x5d36('0x3f')]['find']({'where':{'id':_0x1b44b[_0x5d36('0x5a')]['id']}})[_0x5d36('0x34')](handleEntityNotFound(_0x4cb963,null))[_0x5d36('0x34')](removeEntity(_0x4cb963,null))[_0x5d36('0x28')](handleError(_0x4cb963,null));};exports[_0x5d36('0x5b')]=function(_0x45601c,_0x242005,_0x4f7287){var _0x5cab77={};var _0x589785={};var _0x12fe40;var _0x28e0d2;return db[_0x5d36('0x3f')][_0x5d36('0x5c')]({'where':{'id':_0x45601c[_0x5d36('0x5a')]['id']}})[_0x5d36('0x34')](handleEntityNotFound(_0x242005,null))['then'](function(_0x37cd27){if(_0x37cd27){_0x12fe40=_0x37cd27;_0x589785['model']=_[_0x5d36('0x46')](db['ServicenowConfiguration'][_0x5d36('0x40')]);_0x589785['query']=_[_0x5d36('0x46')](_0x45601c['query']);_0x589785[_0x5d36('0x50')]=_['intersection'](_0x589785[_0x5d36('0x44')],_0x589785[_0x5d36('0x45')]);_0x5cab77[_0x5d36('0x48')]=_[_0x5d36('0x47')](_0x589785[_0x5d36('0x44')],qs[_0x5d36('0x49')](_0x45601c['query'][_0x5d36('0x49')]));_0x5cab77['attributes']=_0x5cab77[_0x5d36('0x48')][_0x5d36('0x4a')]?_0x5cab77[_0x5d36('0x48')]:_0x589785[_0x5d36('0x44')];_0x5cab77[_0x5d36('0x4d')]=qs[_0x5d36('0x4e')](_0x45601c[_0x5d36('0x45')][_0x5d36('0x4e')]);_0x5cab77[_0x5d36('0x4f')]=qs[_0x5d36('0x50')](_[_0x5d36('0x5d')](_0x45601c[_0x5d36('0x45')],_0x589785[_0x5d36('0x50')]));if(_0x45601c[_0x5d36('0x45')][_0x5d36('0x51')]){_0x5cab77[_0x5d36('0x4f')]=_['merge'](_0x5cab77[_0x5d36('0x4f')],{'$or':_[_0x5d36('0x3e')](_0x5cab77[_0x5d36('0x48')],function(_0x1d54b6){var _0x6c38f8={};_0x6c38f8[_0x1d54b6]={'$like':'%'+_0x45601c[_0x5d36('0x45')][_0x5d36('0x51')]+'%'};return _0x6c38f8;})});}_0x5cab77=_['merge']({},_0x5cab77,_0x45601c[_0x5d36('0x53')]);return _0x12fe40['getConfigurations'](_0x5cab77);}})[_0x5d36('0x34')](function(_0x232d06){if(_0x232d06){_0x28e0d2=_0x232d06[_0x5d36('0x4a')];if(!_0x45601c['query'][_0x5d36('0x4b')](_0x5d36('0x4c'))){_0x5cab77[_0x5d36('0x2d')]=qs[_0x5d36('0x2d')](_0x45601c[_0x5d36('0x45')][_0x5d36('0x2d')]);_0x5cab77[_0x5d36('0x2c')]=qs['offset'](_0x45601c[_0x5d36('0x45')]['offset']);}return _0x12fe40[_0x5d36('0x5b')](_0x5cab77);}})['then'](function(_0x4ac270){if(_0x4ac270){return _0x4ac270?{'count':_0x28e0d2,'rows':_0x4ac270}:null;}})[_0x5d36('0x34')](respondWithResult(_0x242005,null))[_0x5d36('0x28')](handleError(_0x242005,null));};exports['addConfiguration']=function(_0x1eef4f,_0x897f90,_0x4d6cb3){if(_0x1eef4f[_0x5d36('0x3a')]['id']){delete _0x1eef4f[_0x5d36('0x3a')]['id'];}return db[_0x5d36('0x3f')][_0x5d36('0x5c')]({'where':{'id':_0x1eef4f[_0x5d36('0x5a')]['id']}})[_0x5d36('0x34')](handleEntityNotFound(_0x897f90,null))[_0x5d36('0x34')](function(_0x283ef0){if(_0x283ef0){_0x1eef4f[_0x5d36('0x3a')][_0x5d36('0x5e')]=_0x283ef0['id'];_0x1eef4f[_0x5d36('0x3a')][_0x5d36('0x5f')]=integrations[_0x5d36('0x60')](_0x1eef4f[_0x5d36('0x3a')][_0x5d36('0x61')],_0x1eef4f[_0x5d36('0x3a')][_0x5d36('0x42')]);_0x1eef4f[_0x5d36('0x3a')][_0x5d36('0x62')]=integrations[_0x5d36('0x63')](_0x1eef4f[_0x5d36('0x3a')][_0x5d36('0x61')],_0x1eef4f[_0x5d36('0x3a')]['type']);return db[_0x5d36('0x64')][_0x5d36('0x59')](_0x1eef4f['body'],{'include':[{'model':db['ServicenowField'],'as':_0x5d36('0x5f')},{'model':db[_0x5d36('0x65')],'as':_0x5d36('0x62')}]});}return null;})[_0x5d36('0x34')](respondWithResult(_0x897f90,null))[_0x5d36('0x28')](handleError(_0x897f90,null));};exports['getFields']=function(_0x5a0138,_0x5bf3da,_0x4cbb14){var _0xf5d2ad=['made_sla',_0x5d36('0x66'),_0x5d36('0x67'),'subcategory',_0x5d36('0x68'),_0x5d36('0x69'),_0x5d36('0x6a'),_0x5d36('0x6b'),_0x5d36('0x6c')];var _0x2384d4=[_0x5d36('0x6d'),_0x5d36('0x6e'),_0x5d36('0x6f'),_0x5d36('0x70'),'upon_reject',_0x5d36('0x71'),_0x5d36('0x72'),_0x5d36('0x66'),_0x5d36('0x73'),'number',_0x5d36('0x74'),_0x5d36('0x75'),_0x5d36('0x76'),_0x5d36('0x77'),_0x5d36('0x78'),_0x5d36('0x79'),_0x5d36('0x7a'),_0x5d36('0x7b'),_0x5d36('0x67'),_0x5d36('0x4d'),_0x5d36('0x7c'),'closed_at','cmdb_ci',_0x5d36('0x7d'),_0x5d36('0x7e'),_0x5d36('0x7f'),_0x5d36('0x80'),'business_service',_0x5d36('0x81'),_0x5d36('0x82'),_0x5d36('0x83'),'time_worked',_0x5d36('0x84'),_0x5d36('0x85'),'business_duration','group_list',_0x5d36('0x86'),_0x5d36('0x87'),'resolved_at',_0x5d36('0x88'),_0x5d36('0x89'),_0x5d36('0x8a'),_0x5d36('0x8b'),_0x5d36('0x8c'),_0x5d36('0x68'),_0x5d36('0x8d'),'delivery_task','work_start',_0x5d36('0x8e'),_0x5d36('0x8f'),_0x5d36('0x90'),_0x5d36('0x91'),'calendar_duration',_0x5d36('0x69'),_0x5d36('0x92'),_0x5d36('0x93'),_0x5d36('0x94'),_0x5d36('0x95'),'parent_incident','sys_id',_0x5d36('0x96'),'reopened_by','incident_state','urgency','problem_id',_0x5d36('0x97'),'reassignment_count',_0x5d36('0x98'),_0x5d36('0x99'),'severity',_0x5d36('0x9a'),_0x5d36('0x9b'),_0x5d36('0x9c'),_0x5d36('0x9d'),_0x5d36('0x9e'),'sys_mod_count',_0x5d36('0x9f'),_0x5d36('0xa0'),_0x5d36('0xa1'),_0x5d36('0xa2'),_0x5d36('0xa3'),_0x5d36('0xa4'),'category'];var _0x3c3869='';var _0x1da19f='';var _0x3ce3d7=[];var _0x371f1c='';var _0x3726bd='';var _0x2b26a0=[];var _0x5cfbb3='';var _0x4dd93f='';var _0x418d33={};var _0x5a6eb9='';return db[_0x5d36('0x3f')][_0x5d36('0x5c')]({'where':{'id':_0x5a0138[_0x5d36('0x5a')]['id']},'attributes':['id',_0x5d36('0xa5'),_0x5d36('0xa6'),'email',_0x5d36('0xa7'),_0x5d36('0xa8')]})[_0x5d36('0x34')](handleEntityNotFound(_0x5bf3da,null))[_0x5d36('0x34')](function(_0x694b4f){if(_0x694b4f){_0x5a6eb9=_0x694b4f[_0x5d36('0xa7')];var _0x3befa6=_0x5a6eb9[_0x5d36('0xa9')](-0x1);if(_0x3befa6==='/'){_0x5a6eb9=_0x5a6eb9[_0x5d36('0xaa')](0x0,_0x5a6eb9['lastIndexOf'](_0x3befa6));}_0x4dd93f=util[_0x5d36('0xab')](_0x5d36('0xac'),_0x5a6eb9);_0x5cfbb3=util['format'](_0x5d36('0xad'),_0x5a6eb9);_0x418d33={'user':_0x694b4f['username'],'pass':_0x694b4f[_0x5d36('0xa6')]};var _0x400282={'method':_0x5d36('0xae'),'uri':_0x4dd93f+_0x5d36('0xaf'),'auth':_0x418d33,'json':!![]};return rp(_0x400282);}})[_0x5d36('0x34')](function(_0x1572ad){if(_0x1572ad[_0x5d36('0x27')]['length']>0x0){_0x3c3869=_0x1572ad[_0x5d36('0x27')];}console[_0x5d36('0xb0')](_0x5d36('0xb1'),_0x3c3869);_0x2b26a0=[];_0x1da19f=Object[_0x5d36('0xb2')]([],_0x3c3869);_['remove'](_0x1da19f,function(_0x1e5b26){return!_0xf5d2ad[_0x5d36('0xb3')](_0x1e5b26['name']);});_0x1da19f[_0x5d36('0xb4')](function(_0x35f355){var _0x50beab=createFieldObject(_0x5cfbb3,_0x418d33,_0x35f355[_0x5d36('0xb5')],_0x35f355[_0x5d36('0x36')],_0x35f355[_0x5d36('0xb6')],![]);_0x2b26a0[_0x5d36('0xb7')](_0x50beab);});return Promise[_0x5d36('0xb8')](_0x2b26a0);})['then'](function(_0x4d4c12){_0x3ce3d7=_0x4d4c12;_0x371f1c=Object[_0x5d36('0xb2')]([],_0x3c3869);console[_0x5d36('0xb0')]('TCL:\x20_object',_0x3c3869);_[_0x5d36('0xb9')](_0x371f1c,function(_0x486581){return _0x2384d4['includes'](_0x486581[_0x5d36('0x36')]);});console[_0x5d36('0xb0')](_0x5d36('0xba'),_0x371f1c);_0x2b26a0=[];_0x371f1c[_0x5d36('0xb4')](function(_0x377ef6){var _0x2af6b4=createFieldObject(_0x5cfbb3,_0x418d33,_0x377ef6['internalType'],_0x377ef6[_0x5d36('0x36')],_0x377ef6[_0x5d36('0xb6')],!![]);_0x2b26a0['push'](_0x2af6b4);});return Promise[_0x5d36('0xb8')](_0x2b26a0);})[_0x5d36('0x34')](function(_0x831063){_0x3726bd=_0x831063;var _0x615061=_0x3ce3d7[_0x5d36('0xbb')](_0x3726bd);return{'count':_0x615061[_0x5d36('0x4a')],'rows':_0x615061};})['then'](respondWithResult(_0x5bf3da,null))[_0x5d36('0x28')](function(_0x165df6){console[_0x5d36('0xb0')]('ServiceNow\x20error:\x20'+_0x165df6);var _0x13b1d9=_0x5a0138[_0x5d36('0x45')]['test']?0x1f4:_0x165df6[_0x5d36('0xbc')]||0x1f4;logger[_0x5d36('0x24')](_0x165df6[_0x5d36('0xbd')]);delete _0x165df6[_0x5d36('0x36')];if(_0x13b1d9===0x191){_0x13b1d9=0x190;}_0x5bf3da[_0x5d36('0x2a')](_0x13b1d9)['send'](_0x5a0138[_0x5d36('0x45')][_0x5d36('0xbe')]?{'message':_0x5d36('0xbf'),'statusCode':_0x165df6[_0x5d36('0xbc')]}:_0x165df6);});};function createFieldObject(_0x4343d7,_0x2f410d,_0xc7b58b,_0x21dab3,_0x33d823,_0xc5b260){return new Promise(function(_0x445a65,_0x2cf555){var _0xbc34d6={'id':_0x21dab3,'name':_0x33d823,'custom':_0xc5b260};if(_0xc7b58b===_0x5d36('0xc0')){_0xbc34d6[_0x5d36('0x53')]=[{'name':'True','value':_0x5d36('0xc1')},{'name':_0x5d36('0xc2'),'value':_0x5d36('0xc3')}];_0x445a65(_0xbc34d6);}else{var _0x5f53ae={'method':'GET','uri':_0x4343d7+'sys_choice?sysparm_query=name=incident^element='+_0x21dab3,'auth':_0x2f410d,'json':!![]};return rp(_0x5f53ae)['then'](function(_0x26555a){var _0xf56efa=[];if(_0x26555a['result'][_0x5d36('0x4a')]>0x0){_0x26555a['result']['forEach'](function(_0x5857c0){if(_0x5857c0['inactive']==='false'){var _0x365c69={'name':_0x5857c0[_0x5d36('0xb6')],'value':_0x5857c0[_0x5d36('0xc4')]};_0xf56efa[_0x5d36('0xb7')](_0x365c69);}});}_0xbc34d6['options']=_0xf56efa;if(_0xbc34d6[_0x5d36('0x53')]['length']>0x0){_0x445a65(_0xbc34d6);}else{if(_0xc5b260==![]){_0x445a65();}else{_0x445a65(_0xbc34d6);}}});}});} \ No newline at end of file +var _0x0fac=['addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','severity','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','resolved_by','opened_by','sys_created_on','sys_domain','state','calendar_stc','closed_at','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','log','includes','forEach','internalType','label','all','assign','TCL:\x20_object','remove','push','statusCode','test','Wrong\x20credentials','true','False','false','inactive','value','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','render','merge','contact','agent','interaction','account','index','map','ServicenowAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','show','params','find','create','body','getConfigurations','ServicenowConfiguration'];(function(_0x2c603c,_0x5e12ae){var _0x2bdff3=function(_0x2766e3){while(--_0x2766e3){_0x2c603c['push'](_0x2c603c['shift']());}};_0x2bdff3(++_0x5e12ae);}(_0x0fac,0x132));var _0xc0fa=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0fac[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc0fa('0x0'));var zipdir=require(_0xc0fa('0x1'));var jsonpatch=require(_0xc0fa('0x2'));var rp=require(_0xc0fa('0x3'));var moment=require(_0xc0fa('0x4'));var BPromise=require(_0xc0fa('0x5'));var Mustache=require(_0xc0fa('0x6'));var util=require(_0xc0fa('0x7'));var path=require(_0xc0fa('0x8'));var sox=require(_0xc0fa('0x9'));var csv=require(_0xc0fa('0xa'));var ejs=require(_0xc0fa('0xb'));var fs=require('fs');var fs_extra=require(_0xc0fa('0xc'));var _=require(_0xc0fa('0xd'));var squel=require(_0xc0fa('0xe'));var crypto=require(_0xc0fa('0xf'));var jsforce=require(_0xc0fa('0x10'));var deskjs=require(_0xc0fa('0x11'));var toCsv=require('to-csv');var querystring=require(_0xc0fa('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc0fa('0x13'));var qs=require(_0xc0fa('0x14'));var as=require(_0xc0fa('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0fa('0x16'))(_0xc0fa('0x17'));var utils=require(_0xc0fa('0x18'));var config=require(_0xc0fa('0x19'));var licenseUtil=require(_0xc0fa('0x1a'));var db=require(_0xc0fa('0x1b'))['db'];var integrations=require(_0xc0fa('0x1c'));var jayson=require(_0xc0fa('0x1d'));var client=jayson[_0xc0fa('0x1e')][_0xc0fa('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x24a154,_0x2f6dd5,_0x38f660,_0x151477){return new BPromise(function(_0x180dfe,_0x373e74){var _0x60a2d0=_0x151477||client;return _0x60a2d0[_0xc0fa('0x20')](_0x24a154,_0x38f660)[_0xc0fa('0x21')](function(_0x35bea1){logger[_0xc0fa('0x22')]('ServicenowAccount,\x20%s,\x20%s',_0x2f6dd5,'request\x20sent');logger[_0xc0fa('0x23')](_0xc0fa('0x24'),_0x2f6dd5,_0xc0fa('0x25'),JSON[_0xc0fa('0x26')](_0x35bea1));if(_0x35bea1['error']){if(_0x35bea1[_0xc0fa('0x27')]['code']===0x1f4){logger[_0xc0fa('0x27')](_0xc0fa('0x28'),_0x2f6dd5,_0x35bea1[_0xc0fa('0x27')][_0xc0fa('0x29')]);return _0x373e74(_0x35bea1[_0xc0fa('0x27')][_0xc0fa('0x29')]);}logger['error'](_0xc0fa('0x28'),_0x2f6dd5,_0x35bea1[_0xc0fa('0x27')][_0xc0fa('0x29')]);return _0x180dfe(_0x35bea1[_0xc0fa('0x27')][_0xc0fa('0x29')]);}else{logger[_0xc0fa('0x22')](_0xc0fa('0x28'),_0x2f6dd5,_0xc0fa('0x25'));_0x180dfe(_0x35bea1[_0xc0fa('0x2a')][_0xc0fa('0x29')]);}})[_0xc0fa('0x2b')](function(_0x159b08){logger[_0xc0fa('0x27')]('ServicenowAccount,\x20%s,\x20%s',_0x2f6dd5,_0x159b08);_0x373e74(_0x159b08);});});}function respondWithStatusCode(_0x3aa286,_0x2ce7f1){_0x2ce7f1=_0x2ce7f1||0xcc;return function(_0x20701e){if(_0x20701e){return _0x3aa286[_0xc0fa('0x2c')](_0x2ce7f1);}return _0x3aa286[_0xc0fa('0x2d')](_0x2ce7f1)[_0xc0fa('0x2e')]();};}function respondWithResult(_0x3a5b8a,_0x3656a4){_0x3656a4=_0x3656a4||0xc8;return function(_0x269a70){if(_0x269a70){return _0x3a5b8a[_0xc0fa('0x2d')](_0x3656a4)[_0xc0fa('0x2f')](_0x269a70);}};}function respondWithFilteredResult(_0x5740ae,_0x36cc83){return function(_0x135dd7){if(_0x135dd7){var _0x1227b5=typeof _0x36cc83['offset']==='undefined'&&typeof _0x36cc83[_0xc0fa('0x30')]===_0xc0fa('0x31');var _0x2622b9=_0x135dd7['count'];var _0x29fc53=_0x1227b5?0x0:_0x36cc83[_0xc0fa('0x32')];var _0x2508b4=_0x1227b5?_0x135dd7['count']:_0x36cc83[_0xc0fa('0x32')]+_0x36cc83[_0xc0fa('0x30')];var _0xbaba1;if(_0x2508b4>=_0x2622b9){_0x2508b4=_0x2622b9;_0xbaba1=0xc8;}else{_0xbaba1=0xce;}_0x5740ae['status'](_0xbaba1);return _0x5740ae[_0xc0fa('0x33')](_0xc0fa('0x34'),_0x29fc53+'-'+_0x2508b4+'/'+_0x2622b9)[_0xc0fa('0x2f')](_0x135dd7);}return null;};}function patchUpdates(_0x14f837){return function(_0x2de425){try{jsonpatch[_0xc0fa('0x35')](_0x2de425,_0x14f837,!![]);}catch(_0x5ecc4d){return BPromise[_0xc0fa('0x36')](_0x5ecc4d);}return _0x2de425[_0xc0fa('0x37')]();};}function saveUpdates(_0x58c482,_0xf53b30){return function(_0x220af5){if(_0x220af5){return _0x220af5['update'](_0x58c482)[_0xc0fa('0x21')](function(_0x3c4f6c){return _0x3c4f6c;});}return null;};}function removeEntity(_0x410fb5,_0x2ac920){return function(_0x1ca946){if(_0x1ca946){return _0x1ca946[_0xc0fa('0x38')]()[_0xc0fa('0x21')](function(){_0x410fb5['status'](0xcc)[_0xc0fa('0x2e')]();});}};}function handleEntityNotFound(_0x2a66a2,_0x1c3748){return function(_0x43fc73){if(!_0x43fc73){_0x2a66a2[_0xc0fa('0x2c')](0x194);}return _0x43fc73;};}function handleError(_0x5e0178,_0x52b1bf){_0x52b1bf=_0x52b1bf||0x1f4;return function(_0x2f6bd8){logger[_0xc0fa('0x27')](_0x2f6bd8[_0xc0fa('0x39')]);if(_0x2f6bd8[_0xc0fa('0x3a')]){delete _0x2f6bd8['name'];}_0x5e0178[_0xc0fa('0x2d')](_0x52b1bf)[_0xc0fa('0x3b')](_0x2f6bd8);};}function getMustacheRender(_0xb728dc,_0x3ff265){return Mustache[_0xc0fa('0x3c')](_0xb728dc,_[_0xc0fa('0x3d')](_0x3ff265['body'],{'contact':_0x3ff265[_0xc0fa('0x3e')],'message':_0x3ff265['message'],'agent':_0x3ff265[_0xc0fa('0x3f')],'interaction':_0x3ff265[_0xc0fa('0x40')],'account':_0x3ff265[_0xc0fa('0x41')]}))||'';}exports[_0xc0fa('0x42')]=function(_0x2da256,_0x29b3e8){var _0x18a46c={},_0x162cb5={},_0x425149={'count':0x0,'rows':[]};var _0x26dfe9=_[_0xc0fa('0x43')](db[_0xc0fa('0x44')][_0xc0fa('0x45')],function(_0x57598c){return{'name':_0x57598c[_0xc0fa('0x46')],'type':_0x57598c[_0xc0fa('0x47')]['key']};});_0x162cb5[_0xc0fa('0x48')]=_[_0xc0fa('0x43')](_0x26dfe9,_0xc0fa('0x3a'));_0x162cb5[_0xc0fa('0x49')]=_[_0xc0fa('0x4a')](_0x2da256[_0xc0fa('0x49')]);_0x162cb5[_0xc0fa('0x4b')]=_[_0xc0fa('0x4c')](_0x162cb5[_0xc0fa('0x48')],_0x162cb5['query']);_0x18a46c[_0xc0fa('0x4d')]=_[_0xc0fa('0x4c')](_0x162cb5['model'],qs['fields'](_0x2da256[_0xc0fa('0x49')][_0xc0fa('0x4e')]));_0x18a46c[_0xc0fa('0x4d')]=_0x18a46c[_0xc0fa('0x4d')][_0xc0fa('0x4f')]?_0x18a46c['attributes']:_0x162cb5[_0xc0fa('0x48')];if(!_0x2da256[_0xc0fa('0x49')][_0xc0fa('0x50')](_0xc0fa('0x51'))){_0x18a46c[_0xc0fa('0x30')]=qs[_0xc0fa('0x30')](_0x2da256['query'][_0xc0fa('0x30')]);_0x18a46c[_0xc0fa('0x32')]=qs[_0xc0fa('0x32')](_0x2da256[_0xc0fa('0x49')]['offset']);}_0x18a46c[_0xc0fa('0x52')]=qs[_0xc0fa('0x53')](_0x2da256[_0xc0fa('0x49')][_0xc0fa('0x53')]);_0x18a46c[_0xc0fa('0x54')]=qs['filters'](_[_0xc0fa('0x55')](_0x2da256['query'],_0x162cb5[_0xc0fa('0x4b')]),_0x26dfe9);if(_0x2da256['query'][_0xc0fa('0x56')]){_0x18a46c[_0xc0fa('0x54')]=_[_0xc0fa('0x3d')](_0x18a46c[_0xc0fa('0x54')],{'$or':_[_0xc0fa('0x43')](_0x26dfe9,function(_0x294565){if(_0x294565[_0xc0fa('0x47')]!==_0xc0fa('0x57')){var _0x1b96e4={};_0x1b96e4[_0x294565[_0xc0fa('0x3a')]]={'$like':'%'+_0x2da256[_0xc0fa('0x49')][_0xc0fa('0x56')]+'%'};return _0x1b96e4;}})});}_0x18a46c=_[_0xc0fa('0x3d')]({},_0x18a46c,_0x2da256[_0xc0fa('0x58')]);var _0x4741b2={'where':_0x18a46c[_0xc0fa('0x54')]};return db[_0xc0fa('0x44')][_0xc0fa('0x59')](_0x4741b2)[_0xc0fa('0x21')](function(_0x38d2b1){_0x425149[_0xc0fa('0x59')]=_0x38d2b1;if(_0x2da256['query'][_0xc0fa('0x5a')]){_0x18a46c[_0xc0fa('0x5b')]=[{'all':!![]}];}return db[_0xc0fa('0x44')][_0xc0fa('0x5c')](_0x18a46c);})[_0xc0fa('0x21')](function(_0x1fe8ea){_0x425149['rows']=_0x1fe8ea;return _0x425149;})[_0xc0fa('0x21')](respondWithFilteredResult(_0x29b3e8,_0x18a46c))[_0xc0fa('0x2b')](handleError(_0x29b3e8,null));};exports[_0xc0fa('0x5d')]=function(_0x55a91f,_0x336d90){var _0x5c1208={'raw':![],'where':{'id':_0x55a91f[_0xc0fa('0x5e')]['id']}},_0x591dcc={};_0x591dcc[_0xc0fa('0x48')]=_['keys'](db[_0xc0fa('0x44')][_0xc0fa('0x45')]);_0x591dcc[_0xc0fa('0x49')]=_[_0xc0fa('0x4a')](_0x55a91f[_0xc0fa('0x49')]);_0x591dcc['filters']=_[_0xc0fa('0x4c')](_0x591dcc[_0xc0fa('0x48')],_0x591dcc[_0xc0fa('0x49')]);_0x5c1208[_0xc0fa('0x4d')]=_[_0xc0fa('0x4c')](_0x591dcc[_0xc0fa('0x48')],qs['fields'](_0x55a91f[_0xc0fa('0x49')][_0xc0fa('0x4e')]));_0x5c1208[_0xc0fa('0x4d')]=_0x5c1208['attributes']['length']?_0x5c1208['attributes']:_0x591dcc[_0xc0fa('0x48')];if(_0x55a91f[_0xc0fa('0x49')][_0xc0fa('0x5a')]){_0x5c1208[_0xc0fa('0x5b')]=[{'all':!![]}];}_0x5c1208=_['merge']({},_0x5c1208,_0x55a91f[_0xc0fa('0x58')]);return db['ServicenowAccount'][_0xc0fa('0x5f')](_0x5c1208)[_0xc0fa('0x21')](handleEntityNotFound(_0x336d90,null))[_0xc0fa('0x21')](respondWithResult(_0x336d90,null))['catch'](handleError(_0x336d90,null));};exports['create']=function(_0x186344,_0x5ad360){return db['ServicenowAccount'][_0xc0fa('0x60')](_0x186344[_0xc0fa('0x61')],{})[_0xc0fa('0x21')](respondWithResult(_0x5ad360,0xc9))[_0xc0fa('0x2b')](handleError(_0x5ad360,null));};exports['update']=function(_0x1c6556,_0x3b8301){if(_0x1c6556[_0xc0fa('0x61')]['id']){delete _0x1c6556[_0xc0fa('0x61')]['id'];}return db[_0xc0fa('0x44')][_0xc0fa('0x5f')]({'where':{'id':_0x1c6556[_0xc0fa('0x5e')]['id']}})[_0xc0fa('0x21')](handleEntityNotFound(_0x3b8301,null))['then'](saveUpdates(_0x1c6556['body'],null))[_0xc0fa('0x21')](respondWithResult(_0x3b8301,null))['catch'](handleError(_0x3b8301,null));};exports['destroy']=function(_0x3eb8fc,_0x5da0b7){return db[_0xc0fa('0x44')]['find']({'where':{'id':_0x3eb8fc['params']['id']}})[_0xc0fa('0x21')](handleEntityNotFound(_0x5da0b7,null))[_0xc0fa('0x21')](removeEntity(_0x5da0b7,null))[_0xc0fa('0x2b')](handleError(_0x5da0b7,null));};exports[_0xc0fa('0x62')]=function(_0x18bdea,_0x1d4939,_0x4206b2){var _0x404b28={};var _0x470b67={};var _0x27a408;var _0xdbb9b;return db['ServicenowAccount']['findOne']({'where':{'id':_0x18bdea[_0xc0fa('0x5e')]['id']}})[_0xc0fa('0x21')](handleEntityNotFound(_0x1d4939,null))['then'](function(_0x12b6dc){if(_0x12b6dc){_0x27a408=_0x12b6dc;_0x470b67[_0xc0fa('0x48')]=_[_0xc0fa('0x4a')](db[_0xc0fa('0x63')][_0xc0fa('0x45')]);_0x470b67[_0xc0fa('0x49')]=_[_0xc0fa('0x4a')](_0x18bdea['query']);_0x470b67[_0xc0fa('0x4b')]=_[_0xc0fa('0x4c')](_0x470b67[_0xc0fa('0x48')],_0x470b67[_0xc0fa('0x49')]);_0x404b28[_0xc0fa('0x4d')]=_[_0xc0fa('0x4c')](_0x470b67[_0xc0fa('0x48')],qs[_0xc0fa('0x4e')](_0x18bdea[_0xc0fa('0x49')]['fields']));_0x404b28[_0xc0fa('0x4d')]=_0x404b28[_0xc0fa('0x4d')][_0xc0fa('0x4f')]?_0x404b28[_0xc0fa('0x4d')]:_0x470b67['model'];_0x404b28['order']=qs['sort'](_0x18bdea[_0xc0fa('0x49')]['sort']);_0x404b28['where']=qs['filters'](_[_0xc0fa('0x55')](_0x18bdea[_0xc0fa('0x49')],_0x470b67[_0xc0fa('0x4b')]));if(_0x18bdea[_0xc0fa('0x49')]['filter']){_0x404b28[_0xc0fa('0x54')]=_[_0xc0fa('0x3d')](_0x404b28['where'],{'$or':_[_0xc0fa('0x43')](_0x404b28[_0xc0fa('0x4d')],function(_0x22403e){var _0x2281d0={};_0x2281d0[_0x22403e]={'$like':'%'+_0x18bdea[_0xc0fa('0x49')][_0xc0fa('0x56')]+'%'};return _0x2281d0;})});}_0x404b28=_[_0xc0fa('0x3d')]({},_0x404b28,_0x18bdea[_0xc0fa('0x58')]);return _0x27a408['getConfigurations'](_0x404b28);}})[_0xc0fa('0x21')](function(_0xcc18f9){if(_0xcc18f9){_0xdbb9b=_0xcc18f9[_0xc0fa('0x4f')];if(!_0x18bdea[_0xc0fa('0x49')][_0xc0fa('0x50')]('nolimit')){_0x404b28[_0xc0fa('0x30')]=qs[_0xc0fa('0x30')](_0x18bdea[_0xc0fa('0x49')][_0xc0fa('0x30')]);_0x404b28['offset']=qs[_0xc0fa('0x32')](_0x18bdea['query']['offset']);}return _0x27a408[_0xc0fa('0x62')](_0x404b28);}})[_0xc0fa('0x21')](function(_0x39d9a2){if(_0x39d9a2){return _0x39d9a2?{'count':_0xdbb9b,'rows':_0x39d9a2}:null;}})[_0xc0fa('0x21')](respondWithResult(_0x1d4939,null))[_0xc0fa('0x2b')](handleError(_0x1d4939,null));};exports[_0xc0fa('0x64')]=function(_0x27b1f5,_0x3a07e9,_0x411d28){if(_0x27b1f5[_0xc0fa('0x61')]['id']){delete _0x27b1f5[_0xc0fa('0x61')]['id'];}return db[_0xc0fa('0x44')]['findOne']({'where':{'id':_0x27b1f5[_0xc0fa('0x5e')]['id']}})[_0xc0fa('0x21')](handleEntityNotFound(_0x3a07e9,null))[_0xc0fa('0x21')](function(_0x47f3b6){if(_0x47f3b6){_0x27b1f5[_0xc0fa('0x61')]['AccountId']=_0x47f3b6['id'];_0x27b1f5[_0xc0fa('0x61')][_0xc0fa('0x65')]=integrations[_0xc0fa('0x66')](_0x27b1f5[_0xc0fa('0x61')][_0xc0fa('0x67')],_0x27b1f5['body'][_0xc0fa('0x47')]);_0x27b1f5['body'][_0xc0fa('0x68')]=integrations[_0xc0fa('0x69')](_0x27b1f5[_0xc0fa('0x61')]['channel'],_0x27b1f5[_0xc0fa('0x61')][_0xc0fa('0x47')]);return db[_0xc0fa('0x63')][_0xc0fa('0x60')](_0x27b1f5[_0xc0fa('0x61')],{'include':[{'model':db['ServicenowField'],'as':_0xc0fa('0x65')},{'model':db[_0xc0fa('0x6a')],'as':_0xc0fa('0x68')}]});}return null;})[_0xc0fa('0x21')](respondWithResult(_0x3a07e9,null))[_0xc0fa('0x2b')](handleError(_0x3a07e9,null));};exports[_0xc0fa('0x6b')]=function(_0x12499d,_0x628c02,_0xa980ca){var _0xc7cbbd=[_0xc0fa('0x6c'),_0xc0fa('0x6d'),_0xc0fa('0x6e'),_0xc0fa('0x6f'),_0xc0fa('0x70'),_0xc0fa('0x71'),'incident_state',_0xc0fa('0x72'),_0xc0fa('0x73')];var _0x202035=[_0xc0fa('0x74'),_0xc0fa('0x6c'),_0xc0fa('0x75'),'watch_list',_0xc0fa('0x76'),_0xc0fa('0x77'),_0xc0fa('0x78'),'hold_reason','approval_history','number',_0xc0fa('0x79'),'sys_updated_by',_0xc0fa('0x7a'),'user_input',_0xc0fa('0x7b'),_0xc0fa('0x7c'),_0xc0fa('0x7d'),'sys_created_by',_0xc0fa('0x6e'),_0xc0fa('0x52'),_0xc0fa('0x7e'),_0xc0fa('0x7f'),'cmdb_ci',_0xc0fa('0x80'),_0xc0fa('0x81'),'active',_0xc0fa('0x82'),_0xc0fa('0x83'),_0xc0fa('0x84'),_0xc0fa('0x85'),'rfc','time_worked',_0xc0fa('0x86'),_0xc0fa('0x87'),_0xc0fa('0x88'),_0xc0fa('0x89'),_0xc0fa('0x8a'),_0xc0fa('0x8b'),_0xc0fa('0x8c'),_0xc0fa('0x8d'),_0xc0fa('0x8e'),_0xc0fa('0x6f'),_0xc0fa('0x8f'),'short_description','close_code',_0xc0fa('0x90'),_0xc0fa('0x91'),_0xc0fa('0x92'),_0xc0fa('0x93'),'business_stc',_0xc0fa('0x94'),_0xc0fa('0x95'),_0xc0fa('0x96'),_0xc0fa('0x71'),'sys_class_name',_0xc0fa('0x97'),_0xc0fa('0x98'),_0xc0fa('0x99'),_0xc0fa('0x9a'),_0xc0fa('0x9b'),_0xc0fa('0x9c'),_0xc0fa('0x9d'),_0xc0fa('0x9e'),_0xc0fa('0x9f'),_0xc0fa('0xa0'),_0xc0fa('0xa1'),'reassignment_count',_0xc0fa('0xa2'),_0xc0fa('0xa3'),_0xc0fa('0x72'),'comments',_0xc0fa('0xa4'),_0xc0fa('0xa5'),_0xc0fa('0xa6'),'due_date','sys_mod_count',_0xc0fa('0xa7'),_0xc0fa('0xa8'),_0xc0fa('0xa9'),_0xc0fa('0xaa'),_0xc0fa('0xab'),_0xc0fa('0xac'),_0xc0fa('0x73')];var _0x3420b7='';var _0x5824c5='';var _0xbab047=[];var _0x279a2d='';var _0x5db16d='';var _0x5a12f5=[];var _0x32020b='';var _0x5982d8='';var _0x13c6e5={};var _0x348761='';return db[_0xc0fa('0x44')]['findOne']({'where':{'id':_0x12499d['params']['id']},'attributes':['id',_0xc0fa('0xad'),'password',_0xc0fa('0xae'),_0xc0fa('0xaf'),_0xc0fa('0xb0')]})[_0xc0fa('0x21')](handleEntityNotFound(_0x628c02,null))[_0xc0fa('0x21')](function(_0x35c42f){if(_0x35c42f){_0x348761=_0x35c42f[_0xc0fa('0xaf')];var _0x1ff1b2=_0x348761[_0xc0fa('0xb1')](-0x1);if(_0x1ff1b2==='/'){_0x348761=_0x348761[_0xc0fa('0xb2')](0x0,_0x348761[_0xc0fa('0xb3')](_0x1ff1b2));}_0x5982d8=util['format'](_0xc0fa('0xb4'),_0x348761);_0x32020b=util['format'](_0xc0fa('0xb5'),_0x348761);_0x13c6e5={'user':_0x35c42f[_0xc0fa('0xad')],'pass':_0x35c42f[_0xc0fa('0xb6')]};var _0x3db0ea={'method':_0xc0fa('0xb7'),'uri':_0x5982d8+_0xc0fa('0xb8'),'auth':_0x13c6e5,'json':!![]};return rp(_0x3db0ea);}})['then'](function(_0x1a2e88){if(_0x1a2e88[_0xc0fa('0x2a')]['length']>0x0){_0x3420b7=_0x1a2e88[_0xc0fa('0x2a')];}console[_0xc0fa('0xb9')]('incident\x20table\x20objects',_0x3420b7);_0x5a12f5=[];_0x5824c5=Object['assign']([],_0x3420b7);_['remove'](_0x5824c5,function(_0x4be94f){return!_0xc7cbbd[_0xc0fa('0xba')](_0x4be94f[_0xc0fa('0x3a')]);});_0x5824c5[_0xc0fa('0xbb')](function(_0x9755e4){var _0xdda441=createFieldObject(_0x32020b,_0x13c6e5,_0x9755e4[_0xc0fa('0xbc')],_0x9755e4[_0xc0fa('0x3a')],_0x9755e4[_0xc0fa('0xbd')],![]);_0x5a12f5['push'](_0xdda441);});return Promise[_0xc0fa('0xbe')](_0x5a12f5);})[_0xc0fa('0x21')](function(_0x9ad628){_0xbab047=_0x9ad628;_0x279a2d=Object[_0xc0fa('0xbf')]([],_0x3420b7);console[_0xc0fa('0xb9')](_0xc0fa('0xc0'),_0x3420b7);_[_0xc0fa('0xc1')](_0x279a2d,function(_0x5cbb95){return _0x202035[_0xc0fa('0xba')](_0x5cbb95[_0xc0fa('0x3a')]);});console[_0xc0fa('0xb9')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x279a2d);_0x5a12f5=[];_0x279a2d[_0xc0fa('0xbb')](function(_0x253502){var _0x3604a1=createFieldObject(_0x32020b,_0x13c6e5,_0x253502[_0xc0fa('0xbc')],_0x253502['name'],_0x253502[_0xc0fa('0xbd')],!![]);_0x5a12f5[_0xc0fa('0xc2')](_0x3604a1);});return Promise[_0xc0fa('0xbe')](_0x5a12f5);})['then'](function(_0x340cfb){_0x5db16d=_0x340cfb;var _0x1576b4=_0xbab047['concat'](_0x5db16d);return{'count':_0x1576b4[_0xc0fa('0x4f')],'rows':_0x1576b4};})['then'](respondWithResult(_0x628c02,null))[_0xc0fa('0x2b')](function(_0x27bbe7){console['log']('ServiceNow\x20error:\x20'+_0x27bbe7);var _0x34cb91=_0x12499d[_0xc0fa('0x49')]['test']?0x1f4:_0x27bbe7[_0xc0fa('0xc3')]||0x1f4;logger[_0xc0fa('0x27')](_0x27bbe7[_0xc0fa('0x39')]);delete _0x27bbe7[_0xc0fa('0x3a')];if(_0x34cb91===0x191){_0x34cb91=0x190;}_0x628c02[_0xc0fa('0x2d')](_0x34cb91)[_0xc0fa('0x3b')](_0x12499d[_0xc0fa('0x49')][_0xc0fa('0xc4')]?{'message':_0xc0fa('0xc5'),'statusCode':_0x27bbe7['statusCode']}:_0x27bbe7);});};function createFieldObject(_0x4a01b0,_0x160b99,_0x18bca1,_0x32d38a,_0x1cbf67,_0x264351){return new Promise(function(_0x598910,_0x1f1d8c){var _0x5d2144={'id':_0x32d38a,'name':_0x1cbf67,'custom':_0x264351};if(_0x18bca1==='boolean'){_0x5d2144[_0xc0fa('0x58')]=[{'name':'True','value':_0xc0fa('0xc6')},{'name':_0xc0fa('0xc7'),'value':_0xc0fa('0xc8')}];_0x598910(_0x5d2144);}else{var _0x2649c0={'method':'GET','uri':_0x4a01b0+'sys_choice?sysparm_query=name=incident^element='+_0x32d38a,'auth':_0x160b99,'json':!![]};return rp(_0x2649c0)[_0xc0fa('0x21')](function(_0x2f5f78){var _0x1c1023=[];if(_0x2f5f78[_0xc0fa('0x2a')][_0xc0fa('0x4f')]>0x0){_0x2f5f78[_0xc0fa('0x2a')][_0xc0fa('0xbb')](function(_0x2edfae){if(_0x2edfae[_0xc0fa('0xc9')]==='false'){var _0x184b7c={'name':_0x2edfae[_0xc0fa('0xbd')],'value':_0x2edfae[_0xc0fa('0xca')]};_0x1c1023[_0xc0fa('0xc2')](_0x184b7c);}});}_0x5d2144[_0xc0fa('0x58')]=_0x1c1023;if(_0x5d2144[_0xc0fa('0x58')][_0xc0fa('0x4f')]>0x0){_0x598910(_0x5d2144);}else{if(_0x264351==![]){_0x598910();}else{_0x598910(_0x5d2144);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 4611934..c87ea1c 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 _0x2123=['request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x2123,0x190));var _0x3212=function(_0x22f59d,_0x12eca8){_0x22f59d=_0x22f59d-0x0;var _0x2176f8=_0x2123[_0x22f59d];return _0x2176f8;};'use strict';var _=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var logger=require(_0x3212('0x2'))(_0x3212('0x3'));var moment=require(_0x3212('0x4'));var BPromise=require(_0x3212('0x5'));var rp=require(_0x3212('0x6'));var fs=require('fs');var path=require(_0x3212('0x7'));var rimraf=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var attributes=require(_0x3212('0xa'));var integrations=require(_0x3212('0xb'));module['exports']=function(_0x3859e4,_0x2b1302){return _0x3859e4[_0x3212('0xc')]('ServicenowAccount',attributes,{'tableName':_0x3212('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d17=['ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment','request-promise','path','../../config/environment','../../components/integrations/configuration'];(function(_0x27d647,_0x4a10a0){var _0x50df92=function(_0xd8d02){while(--_0xd8d02){_0x27d647['push'](_0x27d647['shift']());}};_0x50df92(++_0x4a10a0);}(_0x2d17,0x17e));var _0x72d1=function(_0x50bdab,_0x3646d9){_0x50bdab=_0x50bdab-0x0;var _0x10b44f=_0x2d17[_0x50bdab];return _0x10b44f;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var logger=require('../../config/logger')(_0x72d1('0x2'));var moment=require(_0x72d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x72d1('0x4'));var fs=require('fs');var path=require(_0x72d1('0x5'));var rimraf=require('rimraf');var config=require(_0x72d1('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x72d1('0x7'));module['exports']=function(_0x139ba0,_0x239d1f){return _0x139ba0['define'](_0x72d1('0x8'),attributes,{'tableName':_0x72d1('0x9'),'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 a77263a..cadb4b4 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 _0x3b38=['../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','ServicenowAccount','findAll','where','options','attributes','limit','map','include','model','GetServicenowAccount','stringify','ShowServicenowAccount','find','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b38,0x87));var _0x83b3=function(_0x44fc68,_0x588bc6){_0x44fc68=_0x44fc68-0x0;var _0x5528db=_0x3b38[_0x44fc68];return _0x5528db;};'use strict';var _=require(_0x83b3('0x0'));var util=require(_0x83b3('0x1'));var moment=require('moment');var BPromise=require(_0x83b3('0x2'));var rs=require(_0x83b3('0x3'));var fs=require('fs');var Redis=require(_0x83b3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x83b3('0x5'));var logger=require('../../config/logger')(_0x83b3('0x6'));var config=require(_0x83b3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x83b3('0x8')][_0x83b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1857fa,_0x1b4b35,_0x146a42){return new BPromise(function(_0x2dd67e,_0x3044f3){return client[_0x83b3('0xa')](_0x1857fa,_0x146a42)[_0x83b3('0xb')](function(_0x504868){logger[_0x83b3('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x1b4b35,_0x83b3('0xd'));logger[_0x83b3('0xe')](_0x83b3('0xf'),_0x1b4b35,_0x83b3('0xd'),JSON['stringify'](_0x504868));if(_0x504868[_0x83b3('0x10')]){if(_0x504868[_0x83b3('0x10')][_0x83b3('0x11')]===0x1f4){logger[_0x83b3('0x10')](_0x83b3('0x12'),_0x1b4b35,_0x504868['error'][_0x83b3('0x13')]);return _0x3044f3(_0x504868[_0x83b3('0x10')][_0x83b3('0x13')]);}logger[_0x83b3('0x10')](_0x83b3('0x12'),_0x1b4b35,_0x504868[_0x83b3('0x10')][_0x83b3('0x13')]);return _0x2dd67e(_0x504868[_0x83b3('0x10')]['message']);}else{logger[_0x83b3('0xc')](_0x83b3('0x12'),_0x1b4b35,_0x83b3('0xd'));_0x2dd67e(_0x504868[_0x83b3('0x14')][_0x83b3('0x13')]);}})[_0x83b3('0x15')](function(_0x2cac90){logger['error'](_0x83b3('0x12'),_0x1b4b35,_0x2cac90);_0x3044f3(_0x2cac90);});});}exports['GetServicenowAccount']=function(_0x1d212d){var _0x2d8acb=this;return new Promise(function(_0x8d0170,_0x5e4d82){return db[_0x83b3('0x16')][_0x83b3('0x17')]({'raw':_0x1d212d['options']?_0x1d212d['options']['raw']===undefined?!![]:![]:!![],'where':_0x1d212d['options']?_0x1d212d['options'][_0x83b3('0x18')]||null:null,'attributes':_0x1d212d[_0x83b3('0x19')]?_0x1d212d[_0x83b3('0x19')][_0x83b3('0x1a')]||null:null,'limit':_0x1d212d[_0x83b3('0x19')]?_0x1d212d[_0x83b3('0x19')][_0x83b3('0x1b')]||null:null,'include':_0x1d212d['options']?_0x1d212d[_0x83b3('0x19')]['include']?_[_0x83b3('0x1c')](_0x1d212d['options'][_0x83b3('0x1d')],function(_0x1dfcd3){return{'model':db[_0x1dfcd3['model']],'as':_0x1dfcd3['as'],'attributes':_0x1dfcd3['attributes'],'include':_0x1dfcd3['include']?_['map'](_0x1dfcd3['include'],function(_0x50d1c5){return{'model':db[_0x50d1c5[_0x83b3('0x1e')]],'as':_0x50d1c5['as'],'attributes':_0x50d1c5[_0x83b3('0x1a')],'include':_0x50d1c5[_0x83b3('0x1d')]?_[_0x83b3('0x1c')](_0x50d1c5[_0x83b3('0x1d')],function(_0x723227){return{'model':db[_0x723227[_0x83b3('0x1e')]],'as':_0x723227['as'],'attributes':_0x723227[_0x83b3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x83b3('0xb')](function(_0x4755d0){logger[_0x83b3('0xc')](_0x83b3('0x1f'),_0x1d212d);logger[_0x83b3('0xe')](_0x83b3('0x1f'),_0x1d212d,JSON[_0x83b3('0x20')](_0x4755d0));_0x8d0170(_0x4755d0);})['catch'](function(_0x79bcdd){logger['error'](_0x83b3('0x1f'),_0x79bcdd[_0x83b3('0x13')],_0x1d212d);_0x5e4d82(_0x2d8acb[_0x83b3('0x10')](0x1f4,_0x79bcdd[_0x83b3('0x13')]));});});};exports[_0x83b3('0x21')]=function(_0x3e6e67){var _0x3d3573=this;return new Promise(function(_0x5a4272,_0x9f8173){return db[_0x83b3('0x16')][_0x83b3('0x22')]({'raw':_0x3e6e67[_0x83b3('0x19')]?_0x3e6e67[_0x83b3('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3e6e67[_0x83b3('0x19')]?_0x3e6e67[_0x83b3('0x19')][_0x83b3('0x18')]||null:null,'attributes':_0x3e6e67['options']?_0x3e6e67[_0x83b3('0x19')][_0x83b3('0x1a')]||null:null,'include':_0x3e6e67['options']?_0x3e6e67[_0x83b3('0x19')][_0x83b3('0x1d')]?_[_0x83b3('0x1c')](_0x3e6e67[_0x83b3('0x19')]['include'],function(_0x31f840){return{'model':db[_0x31f840[_0x83b3('0x1e')]],'as':_0x31f840['as'],'attributes':_0x31f840[_0x83b3('0x1a')],'include':_0x31f840[_0x83b3('0x1d')]?_['map'](_0x31f840['include'],function(_0xebec93){return{'model':db[_0xebec93['model']],'as':_0xebec93['as'],'attributes':_0xebec93[_0x83b3('0x1a')],'include':_0xebec93[_0x83b3('0x1d')]?_[_0x83b3('0x1c')](_0xebec93[_0x83b3('0x1d')],function(_0x2be614){return{'model':db[_0x2be614[_0x83b3('0x1e')]],'as':_0x2be614['as'],'attributes':_0x2be614[_0x83b3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x83b3('0xb')](function(_0x541d70){logger['info'](_0x83b3('0x21'),_0x3e6e67);logger['debug']('ShowServicenowAccount',_0x3e6e67,JSON[_0x83b3('0x20')](_0x541d70));_0x5a4272(_0x541d70);})[_0x83b3('0x15')](function(_0x482b5f){logger[_0x83b3('0x10')](_0x83b3('0x21'),_0x482b5f[_0x83b3('0x13')],_0x3e6e67);_0x9f8173(_0x3d3573['error'](0x1f4,_0x482b5f[_0x83b3('0x13')]));});});}; \ No newline at end of file +var _0x1b4e=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','model','GetServicenowAccount','stringify','ShowServicenowAccount','find','map','util','moment','bluebird','../../config/utils'];(function(_0x47b39a,_0x7ff6bf){var _0x4c902b=function(_0x22c31b){while(--_0x22c31b){_0x47b39a['push'](_0x47b39a['shift']());}};_0x4c902b(++_0x7ff6bf);}(_0x1b4e,0xa6));var _0xe1b4=function(_0x8c55ff,_0x3d9260){_0x8c55ff=_0x8c55ff-0x0;var _0x24f4a1=_0x1b4e[_0x8c55ff];return _0x24f4a1;};'use strict';var _=require('lodash');var util=require(_0xe1b4('0x0'));var moment=require(_0xe1b4('0x1'));var BPromise=require(_0xe1b4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe1b4('0x3'));var logger=require('../../config/logger')(_0xe1b4('0x4'));var config=require(_0xe1b4('0x5'));var jayson=require(_0xe1b4('0x6'));var client=jayson[_0xe1b4('0x7')][_0xe1b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10cfa0,_0x11b800,_0x5a8749){return new BPromise(function(_0x4aacdc,_0x526933){return client[_0xe1b4('0x9')](_0x10cfa0,_0x5a8749)[_0xe1b4('0xa')](function(_0x5b7077){logger[_0xe1b4('0xb')](_0xe1b4('0xc'),_0x11b800,_0xe1b4('0xd'));logger[_0xe1b4('0xe')](_0xe1b4('0xf'),_0x11b800,_0xe1b4('0xd'),JSON['stringify'](_0x5b7077));if(_0x5b7077[_0xe1b4('0x10')]){if(_0x5b7077[_0xe1b4('0x10')][_0xe1b4('0x11')]===0x1f4){logger['error'](_0xe1b4('0xc'),_0x11b800,_0x5b7077['error'][_0xe1b4('0x12')]);return _0x526933(_0x5b7077[_0xe1b4('0x10')][_0xe1b4('0x12')]);}logger[_0xe1b4('0x10')](_0xe1b4('0xc'),_0x11b800,_0x5b7077['error'][_0xe1b4('0x12')]);return _0x4aacdc(_0x5b7077['error']['message']);}else{logger[_0xe1b4('0xb')](_0xe1b4('0xc'),_0x11b800,_0xe1b4('0xd'));_0x4aacdc(_0x5b7077[_0xe1b4('0x13')][_0xe1b4('0x12')]);}})[_0xe1b4('0x14')](function(_0x2588c9){logger[_0xe1b4('0x10')](_0xe1b4('0xc'),_0x11b800,_0x2588c9);_0x526933(_0x2588c9);});});}exports['GetServicenowAccount']=function(_0x370c4d){var _0x3261b2=this;return new Promise(function(_0x2f49a4,_0x16450a){return db['ServicenowAccount'][_0xe1b4('0x15')]({'raw':_0x370c4d[_0xe1b4('0x16')]?_0x370c4d[_0xe1b4('0x16')][_0xe1b4('0x17')]===undefined?!![]:![]:!![],'where':_0x370c4d[_0xe1b4('0x16')]?_0x370c4d[_0xe1b4('0x16')][_0xe1b4('0x18')]||null:null,'attributes':_0x370c4d[_0xe1b4('0x16')]?_0x370c4d[_0xe1b4('0x16')][_0xe1b4('0x19')]||null:null,'limit':_0x370c4d[_0xe1b4('0x16')]?_0x370c4d[_0xe1b4('0x16')][_0xe1b4('0x1a')]||null:null,'include':_0x370c4d[_0xe1b4('0x16')]?_0x370c4d[_0xe1b4('0x16')][_0xe1b4('0x1b')]?_['map'](_0x370c4d['options'][_0xe1b4('0x1b')],function(_0x47c8c5){return{'model':db[_0x47c8c5[_0xe1b4('0x1c')]],'as':_0x47c8c5['as'],'attributes':_0x47c8c5[_0xe1b4('0x19')],'include':_0x47c8c5[_0xe1b4('0x1b')]?_['map'](_0x47c8c5[_0xe1b4('0x1b')],function(_0x141400){return{'model':db[_0x141400['model']],'as':_0x141400['as'],'attributes':_0x141400[_0xe1b4('0x19')],'include':_0x141400[_0xe1b4('0x1b')]?_['map'](_0x141400['include'],function(_0x642945){return{'model':db[_0x642945[_0xe1b4('0x1c')]],'as':_0x642945['as'],'attributes':_0x642945[_0xe1b4('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe1b4('0xa')](function(_0x45fabf){logger[_0xe1b4('0xb')]('GetServicenowAccount',_0x370c4d);logger['debug'](_0xe1b4('0x1d'),_0x370c4d,JSON[_0xe1b4('0x1e')](_0x45fabf));_0x2f49a4(_0x45fabf);})[_0xe1b4('0x14')](function(_0x14b93d){logger['error'](_0xe1b4('0x1d'),_0x14b93d[_0xe1b4('0x12')],_0x370c4d);_0x16450a(_0x3261b2[_0xe1b4('0x10')](0x1f4,_0x14b93d[_0xe1b4('0x12')]));});});};exports[_0xe1b4('0x1f')]=function(_0x32d88f){var _0x3b38ba=this;return new Promise(function(_0x2feb97,_0x39fe2c){return db['ServicenowAccount'][_0xe1b4('0x20')]({'raw':_0x32d88f[_0xe1b4('0x16')]?_0x32d88f['options'][_0xe1b4('0x17')]===undefined?!![]:![]:!![],'where':_0x32d88f[_0xe1b4('0x16')]?_0x32d88f['options'][_0xe1b4('0x18')]||null:null,'attributes':_0x32d88f[_0xe1b4('0x16')]?_0x32d88f['options']['attributes']||null:null,'include':_0x32d88f[_0xe1b4('0x16')]?_0x32d88f[_0xe1b4('0x16')][_0xe1b4('0x1b')]?_[_0xe1b4('0x21')](_0x32d88f[_0xe1b4('0x16')][_0xe1b4('0x1b')],function(_0x299393){return{'model':db[_0x299393[_0xe1b4('0x1c')]],'as':_0x299393['as'],'attributes':_0x299393[_0xe1b4('0x19')],'include':_0x299393[_0xe1b4('0x1b')]?_[_0xe1b4('0x21')](_0x299393['include'],function(_0x3c5440){return{'model':db[_0x3c5440['model']],'as':_0x3c5440['as'],'attributes':_0x3c5440['attributes'],'include':_0x3c5440[_0xe1b4('0x1b')]?_['map'](_0x3c5440[_0xe1b4('0x1b')],function(_0x538468){return{'model':db[_0x538468['model']],'as':_0x538468['as'],'attributes':_0x538468[_0xe1b4('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5eee52){logger[_0xe1b4('0xb')]('ShowServicenowAccount',_0x32d88f);logger[_0xe1b4('0xe')](_0xe1b4('0x1f'),_0x32d88f,JSON['stringify'](_0x5eee52));_0x2feb97(_0x5eee52);})[_0xe1b4('0x14')](function(_0x450053){logger['error'](_0xe1b4('0x1f'),_0x450053[_0xe1b4('0x12')],_0x32d88f);_0x39fe2c(_0x3b38ba[_0xe1b4('0x10')](0x1f4,_0x450053['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 38e8d07..2a6ebd5 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 _0xa2d1=['getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','/:id','update','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0xa2d1,0x14b));var _0x1a2d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa2d1[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x1a2d('0x0'));var util=require(_0x1a2d('0x1'));var path=require(_0x1a2d('0x2'));var timeout=require('connect-timeout');var express=require(_0x1a2d('0x3'));var router=express[_0x1a2d('0x4')]();var fs_extra=require(_0x1a2d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1a2d('0x6'));var config=require(_0x1a2d('0x7'));var controller=require(_0x1a2d('0x8'));router[_0x1a2d('0x9')]('/',auth['isAuthenticated'](),controller[_0x1a2d('0xa')]);router[_0x1a2d('0x9')]('/:id',auth[_0x1a2d('0xb')](),controller[_0x1a2d('0xc')]);router['get'](_0x1a2d('0xd'),auth['isAuthenticated'](),controller[_0x1a2d('0xe')]);router[_0x1a2d('0x9')](_0x1a2d('0xf'),auth[_0x1a2d('0xb')](),controller[_0x1a2d('0x10')]);router['get'](_0x1a2d('0x11'),auth[_0x1a2d('0xb')](),controller['getDescriptions']);router[_0x1a2d('0x12')]('/',auth[_0x1a2d('0xb')](),controller[_0x1a2d('0x13')]);router[_0x1a2d('0x14')](_0x1a2d('0x15'),auth[_0x1a2d('0xb')](),controller[_0x1a2d('0x16')]);router['delete'](_0x1a2d('0x15'),auth[_0x1a2d('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0a8e=['destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update'];(function(_0x2f80e3,_0x597c16){var _0x818c13=function(_0x45def){while(--_0x45def){_0x2f80e3['push'](_0x2f80e3['shift']());}};_0x818c13(++_0x597c16);}(_0x0a8e,0xb1));var _0xe0a8=function(_0x3c2b73,_0x56ad42){_0x3c2b73=_0x3c2b73-0x0;var _0x530b46=_0x0a8e[_0x3c2b73];return _0x530b46;};'use strict';var multer=require(_0xe0a8('0x0'));var util=require(_0xe0a8('0x1'));var path=require(_0xe0a8('0x2'));var timeout=require(_0xe0a8('0x3'));var express=require('express');var router=express[_0xe0a8('0x4')]();var fs_extra=require(_0xe0a8('0x5'));var auth=require(_0xe0a8('0x6'));var interaction=require(_0xe0a8('0x7'));var config=require(_0xe0a8('0x8'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe0a8('0x9')](_0xe0a8('0xa'),auth[_0xe0a8('0xb')](),controller[_0xe0a8('0xc')]);router[_0xe0a8('0x9')](_0xe0a8('0xd'),auth['isAuthenticated'](),controller[_0xe0a8('0xe')]);router[_0xe0a8('0x9')](_0xe0a8('0xf'),auth[_0xe0a8('0xb')](),controller[_0xe0a8('0x10')]);router[_0xe0a8('0x9')](_0xe0a8('0x11'),auth[_0xe0a8('0xb')](),controller['getDescriptions']);router[_0xe0a8('0x12')]('/',auth[_0xe0a8('0xb')](),controller['create']);router[_0xe0a8('0x13')](_0xe0a8('0xa'),auth[_0xe0a8('0xb')](),controller[_0xe0a8('0x14')]);router['delete'](_0xe0a8('0xa'),auth['isAuthenticated'](),controller[_0xe0a8('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 0d48f88..cd0b2f3 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 _0xa254=['STRING','sequelize'];(function(_0xbd3fbd,_0x1f1561){var _0x1d58e9=function(_0x15d6cb){while(--_0x15d6cb){_0xbd3fbd['push'](_0xbd3fbd['shift']());}};_0x1d58e9(++_0x1f1561);}(_0xa254,0x1cd));var _0x4a25=function(_0x264eeb,_0xc05998){_0x264eeb=_0x264eeb-0x0;var _0xa45c83=_0xa254[_0x264eeb];return _0xa45c83;};'use strict';var Sequelize=require(_0x4a25('0x0'));module['exports']={'name':{'type':Sequelize[_0x4a25('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb336=['sequelize','exports','STRING'];(function(_0x34c187,_0x249c9d){var _0x42e793=function(_0x5b436d){while(--_0x5b436d){_0x34c187['push'](_0x34c187['shift']());}};_0x42e793(++_0x249c9d);}(_0xb336,0x1f2));var _0x6b33=function(_0x40939b,_0x2f37a5){_0x40939b=_0x40939b-0x0;var _0x21e73b=_0xb336[_0x40939b];return _0x21e73b;};'use strict';var Sequelize=require(_0x6b33('0x0'));module[_0x6b33('0x1')]={'name':{'type':Sequelize[_0x6b33('0x2')]},'description':{'type':Sequelize[_0x6b33('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index d3b5e9b..d4e8038 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 _0xf917=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','render','body','contact','agent','interaction','account','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','show','params','find','create','getFields','findOne','getSubjects','options','getDescriptions','ServicenowField','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x2a99ea,_0x1bfb13){var _0x5887ae=function(_0x55dfc2){while(--_0x55dfc2){_0x2a99ea['push'](_0x2a99ea['shift']());}};_0x5887ae(++_0x1bfb13);}(_0xf917,0xbc));var _0x7f91=function(_0x413924,_0x4d74a0){_0x413924=_0x413924-0x0;var _0x30a095=_0xf917[_0x413924];return _0x30a095;};'use strict';var emlformat=require(_0x7f91('0x0'));var rimraf=require(_0x7f91('0x1'));var zipdir=require(_0x7f91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f91('0x3'));var moment=require(_0x7f91('0x4'));var BPromise=require(_0x7f91('0x5'));var Mustache=require(_0x7f91('0x6'));var util=require(_0x7f91('0x7'));var path=require(_0x7f91('0x8'));var sox=require('sox');var csv=require(_0x7f91('0x9'));var ejs=require(_0x7f91('0xa'));var fs=require('fs');var fs_extra=require(_0x7f91('0xb'));var _=require(_0x7f91('0xc'));var squel=require(_0x7f91('0xd'));var crypto=require(_0x7f91('0xe'));var jsforce=require(_0x7f91('0xf'));var deskjs=require(_0x7f91('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7f91('0x11'));var Papa=require(_0x7f91('0x12'));var Redis=require(_0x7f91('0x13'));var authService=require(_0x7f91('0x14'));var qs=require(_0x7f91('0x15'));var as=require(_0x7f91('0x16'));var hardwareService=require(_0x7f91('0x17'));var logger=require(_0x7f91('0x18'))(_0x7f91('0x19'));var utils=require('../../config/utils');var config=require(_0x7f91('0x1a'));var licenseUtil=require(_0x7f91('0x1b'));var db=require(_0x7f91('0x1c'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7f91('0x1d')][_0x7f91('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x473d94,_0x4450cb,_0x4e6265,_0xbcf1ec){return new BPromise(function(_0x1961fe,_0x45b44c){var _0x39c2a4=_0xbcf1ec||client;return _0x39c2a4[_0x7f91('0x1f')](_0x473d94,_0x4e6265)['then'](function(_0x321752){logger[_0x7f91('0x20')](_0x7f91('0x21'),_0x4450cb,_0x7f91('0x22'));logger[_0x7f91('0x23')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4450cb,'request\x20sent',JSON['stringify'](_0x321752));if(_0x321752[_0x7f91('0x24')]){if(_0x321752[_0x7f91('0x24')][_0x7f91('0x25')]===0x1f4){logger[_0x7f91('0x24')](_0x7f91('0x21'),_0x4450cb,_0x321752[_0x7f91('0x24')][_0x7f91('0x26')]);return _0x45b44c(_0x321752[_0x7f91('0x24')][_0x7f91('0x26')]);}logger[_0x7f91('0x24')](_0x7f91('0x21'),_0x4450cb,_0x321752[_0x7f91('0x24')][_0x7f91('0x26')]);return _0x1961fe(_0x321752[_0x7f91('0x24')][_0x7f91('0x26')]);}else{logger['info'](_0x7f91('0x21'),_0x4450cb,_0x7f91('0x22'));_0x1961fe(_0x321752[_0x7f91('0x27')][_0x7f91('0x26')]);}})[_0x7f91('0x28')](function(_0x54845d){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x4450cb,_0x54845d);_0x45b44c(_0x54845d);});});}function respondWithStatusCode(_0x1f8cba,_0x1d4ac5){_0x1d4ac5=_0x1d4ac5||0xcc;return function(_0x79fb6d){if(_0x79fb6d){return _0x1f8cba[_0x7f91('0x29')](_0x1d4ac5);}return _0x1f8cba[_0x7f91('0x2a')](_0x1d4ac5)[_0x7f91('0x2b')]();};}function respondWithResult(_0x296ef1,_0x3e6ce4){_0x3e6ce4=_0x3e6ce4||0xc8;return function(_0x4b8a25){if(_0x4b8a25){return _0x296ef1[_0x7f91('0x2a')](_0x3e6ce4)[_0x7f91('0x2c')](_0x4b8a25);}};}function respondWithFilteredResult(_0x4182c3,_0x5d2493){return function(_0x268a76){if(_0x268a76){var _0x592c13=typeof _0x5d2493['offset']==='undefined'&&typeof _0x5d2493[_0x7f91('0x2d')]===_0x7f91('0x2e');var _0x49ca97=_0x268a76['count'];var _0x2f91b9=_0x592c13?0x0:_0x5d2493[_0x7f91('0x2f')];var _0x5394d7=_0x592c13?_0x268a76[_0x7f91('0x30')]:_0x5d2493[_0x7f91('0x2f')]+_0x5d2493[_0x7f91('0x2d')];var _0x44aa39;if(_0x5394d7>=_0x49ca97){_0x5394d7=_0x49ca97;_0x44aa39=0xc8;}else{_0x44aa39=0xce;}_0x4182c3[_0x7f91('0x2a')](_0x44aa39);return _0x4182c3[_0x7f91('0x31')](_0x7f91('0x32'),_0x2f91b9+'-'+_0x5394d7+'/'+_0x49ca97)['json'](_0x268a76);}return null;};}function patchUpdates(_0x539ce3){return function(_0x56ba5d){try{jsonpatch['apply'](_0x56ba5d,_0x539ce3,!![]);}catch(_0xee3682){return BPromise[_0x7f91('0x33')](_0xee3682);}return _0x56ba5d[_0x7f91('0x34')]();};}function saveUpdates(_0x4a4b77,_0x178b44){return function(_0x1652c2){if(_0x1652c2){return _0x1652c2[_0x7f91('0x35')](_0x4a4b77)[_0x7f91('0x36')](function(_0x128789){return _0x128789;});}return null;};}function removeEntity(_0x17d5b0,_0x1cc960){return function(_0x96a562){if(_0x96a562){return _0x96a562[_0x7f91('0x37')]()[_0x7f91('0x36')](function(){_0x17d5b0[_0x7f91('0x2a')](0xcc)[_0x7f91('0x2b')]();});}};}function handleEntityNotFound(_0x412241,_0x6d7a16){return function(_0x25b168){if(!_0x25b168){_0x412241[_0x7f91('0x29')](0x194);}return _0x25b168;};}function handleError(_0x511b1d,_0x2c70b4){_0x2c70b4=_0x2c70b4||0x1f4;return function(_0x41dcf7){logger[_0x7f91('0x24')](_0x41dcf7[_0x7f91('0x38')]);if(_0x41dcf7[_0x7f91('0x39')]){delete _0x41dcf7[_0x7f91('0x39')];}_0x511b1d[_0x7f91('0x2a')](_0x2c70b4)[_0x7f91('0x3a')](_0x41dcf7);};}function getMustacheRender(_0x199b8f,_0x400607){return Mustache[_0x7f91('0x3b')](_0x199b8f,_['merge'](_0x400607[_0x7f91('0x3c')],{'contact':_0x400607[_0x7f91('0x3d')],'message':_0x400607['message'],'agent':_0x400607[_0x7f91('0x3e')],'interaction':_0x400607[_0x7f91('0x3f')],'account':_0x400607[_0x7f91('0x40')]}))||'';}exports[_0x7f91('0x41')]=function(_0x4678cc,_0x7e8e40){var _0x21b47b={},_0x15c2bc={},_0x2a2701={'count':0x0,'rows':[]};var _0x25184e=_[_0x7f91('0x42')](db[_0x7f91('0x43')][_0x7f91('0x44')],function(_0x3a4fe9){return{'name':_0x3a4fe9[_0x7f91('0x45')],'type':_0x3a4fe9[_0x7f91('0x46')][_0x7f91('0x47')]};});_0x15c2bc[_0x7f91('0x48')]=_['map'](_0x25184e,_0x7f91('0x39'));_0x15c2bc['query']=_[_0x7f91('0x49')](_0x4678cc['query']);_0x15c2bc[_0x7f91('0x4a')]=_['intersection'](_0x15c2bc[_0x7f91('0x48')],_0x15c2bc[_0x7f91('0x4b')]);_0x21b47b[_0x7f91('0x4c')]=_[_0x7f91('0x4d')](_0x15c2bc['model'],qs['fields'](_0x4678cc[_0x7f91('0x4b')][_0x7f91('0x4e')]));_0x21b47b[_0x7f91('0x4c')]=_0x21b47b[_0x7f91('0x4c')][_0x7f91('0x4f')]?_0x21b47b['attributes']:_0x15c2bc['model'];if(!_0x4678cc[_0x7f91('0x4b')][_0x7f91('0x50')](_0x7f91('0x51'))){_0x21b47b[_0x7f91('0x2d')]=qs['limit'](_0x4678cc['query'][_0x7f91('0x2d')]);_0x21b47b[_0x7f91('0x2f')]=qs[_0x7f91('0x2f')](_0x4678cc[_0x7f91('0x4b')]['offset']);}_0x21b47b[_0x7f91('0x52')]=qs['sort'](_0x4678cc[_0x7f91('0x4b')][_0x7f91('0x53')]);_0x21b47b[_0x7f91('0x54')]=qs[_0x7f91('0x4a')](_[_0x7f91('0x55')](_0x4678cc[_0x7f91('0x4b')],_0x15c2bc[_0x7f91('0x4a')]),_0x25184e);if(_0x4678cc[_0x7f91('0x4b')]['filter']){_0x21b47b[_0x7f91('0x54')]=_[_0x7f91('0x56')](_0x21b47b[_0x7f91('0x54')],{'$or':_['map'](_0x25184e,function(_0x1c97ed){if(_0x1c97ed['type']!==_0x7f91('0x57')){var _0x129176={};_0x129176[_0x1c97ed[_0x7f91('0x39')]]={'$like':'%'+_0x4678cc['query'][_0x7f91('0x58')]+'%'};return _0x129176;}})});}_0x21b47b=_[_0x7f91('0x56')]({},_0x21b47b,_0x4678cc['options']);var _0x3c07d8={'where':_0x21b47b[_0x7f91('0x54')]};return db[_0x7f91('0x43')][_0x7f91('0x30')](_0x3c07d8)['then'](function(_0x4d6a76){_0x2a2701[_0x7f91('0x30')]=_0x4d6a76;if(_0x4678cc['query'][_0x7f91('0x59')]){_0x21b47b[_0x7f91('0x5a')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x21b47b);})[_0x7f91('0x36')](function(_0x556c67){_0x2a2701[_0x7f91('0x5b')]=_0x556c67;return _0x2a2701;})[_0x7f91('0x36')](respondWithFilteredResult(_0x7e8e40,_0x21b47b))['catch'](handleError(_0x7e8e40,null));};exports[_0x7f91('0x5c')]=function(_0xd5b9f,_0x338981){var _0x1d9d23={'raw':![],'where':{'id':_0xd5b9f[_0x7f91('0x5d')]['id']}},_0x2aa6c1={};_0x2aa6c1[_0x7f91('0x48')]=_[_0x7f91('0x49')](db['ServicenowConfiguration'][_0x7f91('0x44')]);_0x2aa6c1['query']=_['keys'](_0xd5b9f[_0x7f91('0x4b')]);_0x2aa6c1['filters']=_[_0x7f91('0x4d')](_0x2aa6c1['model'],_0x2aa6c1['query']);_0x1d9d23[_0x7f91('0x4c')]=_[_0x7f91('0x4d')](_0x2aa6c1[_0x7f91('0x48')],qs['fields'](_0xd5b9f[_0x7f91('0x4b')][_0x7f91('0x4e')]));_0x1d9d23[_0x7f91('0x4c')]=_0x1d9d23[_0x7f91('0x4c')]['length']?_0x1d9d23[_0x7f91('0x4c')]:_0x2aa6c1['model'];if(_0xd5b9f[_0x7f91('0x4b')][_0x7f91('0x59')]){_0x1d9d23['include']=[{'all':!![]}];}_0x1d9d23=_[_0x7f91('0x56')]({},_0x1d9d23,_0xd5b9f['options']);return db[_0x7f91('0x43')][_0x7f91('0x5e')](_0x1d9d23)[_0x7f91('0x36')](handleEntityNotFound(_0x338981,null))['then'](respondWithResult(_0x338981,null))['catch'](handleError(_0x338981,null));};exports['create']=function(_0x4d5424,_0x2881cf){return db[_0x7f91('0x43')][_0x7f91('0x5f')](_0x4d5424[_0x7f91('0x3c')],{})[_0x7f91('0x36')](respondWithResult(_0x2881cf,0xc9))[_0x7f91('0x28')](handleError(_0x2881cf,null));};exports[_0x7f91('0x35')]=function(_0xe6a8d3,_0x123d47){if(_0xe6a8d3[_0x7f91('0x3c')]['id']){delete _0xe6a8d3[_0x7f91('0x3c')]['id'];}return db[_0x7f91('0x43')][_0x7f91('0x5e')]({'where':{'id':_0xe6a8d3['params']['id']}})[_0x7f91('0x36')](handleEntityNotFound(_0x123d47,null))[_0x7f91('0x36')](saveUpdates(_0xe6a8d3['body'],null))[_0x7f91('0x36')](respondWithResult(_0x123d47,null))[_0x7f91('0x28')](handleError(_0x123d47,null));};exports[_0x7f91('0x37')]=function(_0x1f02e7,_0x5cf49c){return db['ServicenowConfiguration'][_0x7f91('0x5e')]({'where':{'id':_0x1f02e7[_0x7f91('0x5d')]['id']}})[_0x7f91('0x36')](handleEntityNotFound(_0x5cf49c,null))[_0x7f91('0x36')](removeEntity(_0x5cf49c,null))['catch'](handleError(_0x5cf49c,null));};exports[_0x7f91('0x60')]=function(_0x2bfe3c,_0x339915,_0x5d0961){var _0x580dad={};var _0x152a5={};var _0x45c081;var _0x1c84ed;return db[_0x7f91('0x43')][_0x7f91('0x61')]({'where':{'id':_0x2bfe3c[_0x7f91('0x5d')]['id']}})[_0x7f91('0x36')](handleEntityNotFound(_0x339915,null))[_0x7f91('0x36')](function(_0x3e2ed2){if(_0x3e2ed2){_0x45c081=_0x3e2ed2;_0x152a5[_0x7f91('0x48')]=_[_0x7f91('0x49')](db['ServicenowField'][_0x7f91('0x44')]);_0x152a5['query']=_['keys'](_0x2bfe3c[_0x7f91('0x4b')]);_0x152a5[_0x7f91('0x4a')]=_['intersection'](_0x152a5[_0x7f91('0x48')],_0x152a5[_0x7f91('0x4b')]);_0x580dad['attributes']=_[_0x7f91('0x4d')](_0x152a5[_0x7f91('0x48')],qs['fields'](_0x2bfe3c['query']['fields']));_0x580dad['attributes']=_0x580dad['attributes'][_0x7f91('0x4f')]?_0x580dad[_0x7f91('0x4c')]:_0x152a5[_0x7f91('0x48')];_0x580dad[_0x7f91('0x52')]=qs[_0x7f91('0x53')](_0x2bfe3c[_0x7f91('0x4b')][_0x7f91('0x53')]);_0x580dad[_0x7f91('0x54')]=qs[_0x7f91('0x4a')](_[_0x7f91('0x55')](_0x2bfe3c[_0x7f91('0x4b')],_0x152a5[_0x7f91('0x4a')]));if(_0x2bfe3c[_0x7f91('0x4b')][_0x7f91('0x58')]){_0x580dad[_0x7f91('0x54')]=_['merge'](_0x580dad['where'],{'$or':_[_0x7f91('0x42')](_0x580dad[_0x7f91('0x4c')],function(_0x5f2d2d){var _0x4b677c={};_0x4b677c[_0x5f2d2d]={'$like':'%'+_0x2bfe3c[_0x7f91('0x4b')][_0x7f91('0x58')]+'%'};return _0x4b677c;})});}_0x580dad=_[_0x7f91('0x56')]({},_0x580dad,_0x2bfe3c['options']);return _0x45c081[_0x7f91('0x60')](_0x580dad);}})[_0x7f91('0x36')](function(_0x452edd){if(_0x452edd){_0x1c84ed=_0x452edd[_0x7f91('0x4f')];if(!_0x2bfe3c['query']['hasOwnProperty'](_0x7f91('0x51'))){_0x580dad['limit']=qs[_0x7f91('0x2d')](_0x2bfe3c[_0x7f91('0x4b')][_0x7f91('0x2d')]);_0x580dad['offset']=qs[_0x7f91('0x2f')](_0x2bfe3c[_0x7f91('0x4b')][_0x7f91('0x2f')]);}return _0x45c081[_0x7f91('0x60')](_0x580dad);}})[_0x7f91('0x36')](function(_0x32fbc9){if(_0x32fbc9){return _0x32fbc9?{'count':_0x1c84ed,'rows':_0x32fbc9}:null;}})['then'](respondWithResult(_0x339915,null))['catch'](handleError(_0x339915,null));};exports[_0x7f91('0x62')]=function(_0x454b69,_0x2cfeaa,_0x5e6260){var _0x6a9927={};var _0x2e2e8b={};var _0xbe01f1;var _0x8ade04;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x454b69[_0x7f91('0x5d')]['id']}})[_0x7f91('0x36')](handleEntityNotFound(_0x2cfeaa,null))['then'](function(_0x1424c0){if(_0x1424c0){_0xbe01f1=_0x1424c0;_0x2e2e8b[_0x7f91('0x48')]=_[_0x7f91('0x49')](db['ServicenowField']['rawAttributes']);_0x2e2e8b[_0x7f91('0x4b')]=_['keys'](_0x454b69['query']);_0x2e2e8b[_0x7f91('0x4a')]=_[_0x7f91('0x4d')](_0x2e2e8b[_0x7f91('0x48')],_0x2e2e8b['query']);_0x6a9927[_0x7f91('0x4c')]=_['intersection'](_0x2e2e8b[_0x7f91('0x48')],qs[_0x7f91('0x4e')](_0x454b69['query'][_0x7f91('0x4e')]));_0x6a9927['attributes']=_0x6a9927[_0x7f91('0x4c')]['length']?_0x6a9927[_0x7f91('0x4c')]:_0x2e2e8b['model'];_0x6a9927[_0x7f91('0x52')]=qs['sort'](_0x454b69['query']['sort']);_0x6a9927[_0x7f91('0x54')]=qs[_0x7f91('0x4a')](_[_0x7f91('0x55')](_0x454b69[_0x7f91('0x4b')],_0x2e2e8b[_0x7f91('0x4a')]));if(_0x454b69[_0x7f91('0x4b')][_0x7f91('0x58')]){_0x6a9927['where']=_[_0x7f91('0x56')](_0x6a9927[_0x7f91('0x54')],{'$or':_[_0x7f91('0x42')](_0x6a9927['attributes'],function(_0x173d77){var _0x4bb816={};_0x4bb816[_0x173d77]={'$like':'%'+_0x454b69[_0x7f91('0x4b')]['filter']+'%'};return _0x4bb816;})});}_0x6a9927=_[_0x7f91('0x56')]({},_0x6a9927,_0x454b69[_0x7f91('0x63')]);return _0xbe01f1[_0x7f91('0x62')](_0x6a9927);}})[_0x7f91('0x36')](function(_0x4a4bb2){if(_0x4a4bb2){_0x8ade04=_0x4a4bb2['length'];if(!_0x454b69[_0x7f91('0x4b')]['hasOwnProperty'](_0x7f91('0x51'))){_0x6a9927[_0x7f91('0x2d')]=qs[_0x7f91('0x2d')](_0x454b69[_0x7f91('0x4b')][_0x7f91('0x2d')]);_0x6a9927[_0x7f91('0x2f')]=qs['offset'](_0x454b69[_0x7f91('0x4b')]['offset']);}return _0xbe01f1[_0x7f91('0x62')](_0x6a9927);}})[_0x7f91('0x36')](function(_0xe19a01){if(_0xe19a01){return _0xe19a01?{'count':_0x8ade04,'rows':_0xe19a01}:null;}})[_0x7f91('0x36')](respondWithResult(_0x2cfeaa,null))[_0x7f91('0x28')](handleError(_0x2cfeaa,null));};exports[_0x7f91('0x64')]=function(_0x25373b,_0x3dd598,_0x6b820f){var _0x111afb={};var _0x512d50={};var _0x5a2a6e;var _0x3a8cd1;return db['ServicenowConfiguration'][_0x7f91('0x61')]({'where':{'id':_0x25373b['params']['id']}})['then'](handleEntityNotFound(_0x3dd598,null))[_0x7f91('0x36')](function(_0x59d260){if(_0x59d260){_0x5a2a6e=_0x59d260;_0x512d50[_0x7f91('0x48')]=_[_0x7f91('0x49')](db[_0x7f91('0x65')][_0x7f91('0x44')]);_0x512d50[_0x7f91('0x4b')]=_[_0x7f91('0x49')](_0x25373b[_0x7f91('0x4b')]);_0x512d50[_0x7f91('0x4a')]=_[_0x7f91('0x4d')](_0x512d50[_0x7f91('0x48')],_0x512d50[_0x7f91('0x4b')]);_0x111afb[_0x7f91('0x4c')]=_[_0x7f91('0x4d')](_0x512d50['model'],qs[_0x7f91('0x4e')](_0x25373b[_0x7f91('0x4b')][_0x7f91('0x4e')]));_0x111afb[_0x7f91('0x4c')]=_0x111afb[_0x7f91('0x4c')][_0x7f91('0x4f')]?_0x111afb[_0x7f91('0x4c')]:_0x512d50['model'];_0x111afb['order']=qs['sort'](_0x25373b['query'][_0x7f91('0x53')]);_0x111afb[_0x7f91('0x54')]=qs[_0x7f91('0x4a')](_[_0x7f91('0x55')](_0x25373b[_0x7f91('0x4b')],_0x512d50[_0x7f91('0x4a')]));if(_0x25373b[_0x7f91('0x4b')][_0x7f91('0x58')]){_0x111afb[_0x7f91('0x54')]=_[_0x7f91('0x56')](_0x111afb[_0x7f91('0x54')],{'$or':_[_0x7f91('0x42')](_0x111afb[_0x7f91('0x4c')],function(_0x419da8){var _0x42c2f6={};_0x42c2f6[_0x419da8]={'$like':'%'+_0x25373b[_0x7f91('0x4b')]['filter']+'%'};return _0x42c2f6;})});}_0x111afb=_['merge']({},_0x111afb,_0x25373b[_0x7f91('0x63')]);return _0x5a2a6e[_0x7f91('0x64')](_0x111afb);}})[_0x7f91('0x36')](function(_0x266856){if(_0x266856){_0x3a8cd1=_0x266856[_0x7f91('0x4f')];if(!_0x25373b[_0x7f91('0x4b')][_0x7f91('0x50')](_0x7f91('0x51'))){_0x111afb[_0x7f91('0x2d')]=qs[_0x7f91('0x2d')](_0x25373b[_0x7f91('0x4b')]['limit']);_0x111afb[_0x7f91('0x2f')]=qs[_0x7f91('0x2f')](_0x25373b[_0x7f91('0x4b')][_0x7f91('0x2f')]);}return _0x5a2a6e['getDescriptions'](_0x111afb);}})['then'](function(_0x48c6b6){if(_0x48c6b6){return _0x48c6b6?{'count':_0x3a8cd1,'rows':_0x48c6b6}:null;}})[_0x7f91('0x36')](respondWithResult(_0x3dd598,null))[_0x7f91('0x28')](handleError(_0x3dd598,null));}; \ No newline at end of file +var _0x14e8=['util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','stack','name','merge','body','contact','interaction','account','index','ServicenowConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','update','destroy','findOne','order','filter','getFields','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14e8,0x11b));var _0x814e=function(_0x2d6f38,_0x9c35ad){_0x2d6f38=_0x2d6f38-0x0;var _0x36c329=_0x14e8[_0x2d6f38];return _0x36c329;};'use strict';var emlformat=require(_0x814e('0x0'));var rimraf=require(_0x814e('0x1'));var zipdir=require(_0x814e('0x2'));var jsonpatch=require(_0x814e('0x3'));var rp=require(_0x814e('0x4'));var moment=require(_0x814e('0x5'));var BPromise=require(_0x814e('0x6'));var Mustache=require(_0x814e('0x7'));var util=require(_0x814e('0x8'));var path=require(_0x814e('0x9'));var sox=require(_0x814e('0xa'));var csv=require('to-csv');var ejs=require(_0x814e('0xb'));var fs=require('fs');var fs_extra=require(_0x814e('0xc'));var _=require(_0x814e('0xd'));var squel=require('squel');var crypto=require(_0x814e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x814e('0xf'));var toCsv=require(_0x814e('0x10'));var querystring=require('querystring');var Papa=require(_0x814e('0x11'));var Redis=require(_0x814e('0x12'));var authService=require(_0x814e('0x13'));var qs=require(_0x814e('0x14'));var as=require(_0x814e('0x15'));var hardwareService=require(_0x814e('0x16'));var logger=require(_0x814e('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x814e('0x18'));var licenseUtil=require(_0x814e('0x19'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x814e('0x1a')][_0x814e('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x954f8f,_0x144095,_0x17f205,_0x50fbad){return new BPromise(function(_0x2e7d87,_0x1d074d){var _0x111e46=_0x50fbad||client;return _0x111e46[_0x814e('0x1c')](_0x954f8f,_0x17f205)[_0x814e('0x1d')](function(_0x3e6e35){logger['info'](_0x814e('0x1e'),_0x144095,'request\x20sent');logger['debug'](_0x814e('0x1f'),_0x144095,_0x814e('0x20'),JSON[_0x814e('0x21')](_0x3e6e35));if(_0x3e6e35['error']){if(_0x3e6e35['error'][_0x814e('0x22')]===0x1f4){logger[_0x814e('0x23')](_0x814e('0x1e'),_0x144095,_0x3e6e35['error'][_0x814e('0x24')]);return _0x1d074d(_0x3e6e35[_0x814e('0x23')][_0x814e('0x24')]);}logger[_0x814e('0x23')](_0x814e('0x1e'),_0x144095,_0x3e6e35[_0x814e('0x23')][_0x814e('0x24')]);return _0x2e7d87(_0x3e6e35[_0x814e('0x23')][_0x814e('0x24')]);}else{logger[_0x814e('0x25')]('ServicenowConfiguration,\x20%s,\x20%s',_0x144095,_0x814e('0x20'));_0x2e7d87(_0x3e6e35[_0x814e('0x26')][_0x814e('0x24')]);}})['catch'](function(_0x426ae5){logger['error'](_0x814e('0x1e'),_0x144095,_0x426ae5);_0x1d074d(_0x426ae5);});});}function respondWithStatusCode(_0x4ed7b1,_0x52da99){_0x52da99=_0x52da99||0xcc;return function(_0x2c4009){if(_0x2c4009){return _0x4ed7b1[_0x814e('0x27')](_0x52da99);}return _0x4ed7b1['status'](_0x52da99)[_0x814e('0x28')]();};}function respondWithResult(_0x6486b8,_0x2a45ed){_0x2a45ed=_0x2a45ed||0xc8;return function(_0xe8d3db){if(_0xe8d3db){return _0x6486b8['status'](_0x2a45ed)[_0x814e('0x29')](_0xe8d3db);}};}function respondWithFilteredResult(_0x4745d2,_0x32e595){return function(_0x50d244){if(_0x50d244){var _0x384a7e=typeof _0x32e595[_0x814e('0x2a')]===_0x814e('0x2b')&&typeof _0x32e595[_0x814e('0x2c')]===_0x814e('0x2b');var _0xb0c822=_0x50d244['count'];var _0x54d907=_0x384a7e?0x0:_0x32e595['offset'];var _0x42b307=_0x384a7e?_0x50d244[_0x814e('0x2d')]:_0x32e595['offset']+_0x32e595['limit'];var _0x2a1763;if(_0x42b307>=_0xb0c822){_0x42b307=_0xb0c822;_0x2a1763=0xc8;}else{_0x2a1763=0xce;}_0x4745d2[_0x814e('0x2e')](_0x2a1763);return _0x4745d2[_0x814e('0x2f')](_0x814e('0x30'),_0x54d907+'-'+_0x42b307+'/'+_0xb0c822)[_0x814e('0x29')](_0x50d244);}return null;};}function patchUpdates(_0x2f1fcd){return function(_0x1810dd){try{jsonpatch['apply'](_0x1810dd,_0x2f1fcd,!![]);}catch(_0x42adcb){return BPromise[_0x814e('0x31')](_0x42adcb);}return _0x1810dd[_0x814e('0x32')]();};}function saveUpdates(_0x16e0a9,_0x5524d9){return function(_0x32fe96){if(_0x32fe96){return _0x32fe96['update'](_0x16e0a9)[_0x814e('0x1d')](function(_0x3569bf){return _0x3569bf;});}return null;};}function removeEntity(_0x12b2c7,_0x23bb1f){return function(_0x5ad90c){if(_0x5ad90c){return _0x5ad90c['destroy']()[_0x814e('0x1d')](function(){_0x12b2c7[_0x814e('0x2e')](0xcc)[_0x814e('0x28')]();});}};}function handleEntityNotFound(_0x44be47,_0x2ec68c){return function(_0x565257){if(!_0x565257){_0x44be47[_0x814e('0x27')](0x194);}return _0x565257;};}function handleError(_0x5749f4,_0x47c54f){_0x47c54f=_0x47c54f||0x1f4;return function(_0x3f43e6){logger[_0x814e('0x23')](_0x3f43e6[_0x814e('0x33')]);if(_0x3f43e6[_0x814e('0x34')]){delete _0x3f43e6['name'];}_0x5749f4['status'](_0x47c54f)['send'](_0x3f43e6);};}function getMustacheRender(_0x96a082,_0xdb4746){return Mustache['render'](_0x96a082,_[_0x814e('0x35')](_0xdb4746[_0x814e('0x36')],{'contact':_0xdb4746[_0x814e('0x37')],'message':_0xdb4746[_0x814e('0x24')],'agent':_0xdb4746['agent'],'interaction':_0xdb4746[_0x814e('0x38')],'account':_0xdb4746[_0x814e('0x39')]}))||'';}exports[_0x814e('0x3a')]=function(_0x45215c,_0x1a6f07){var _0x53a16b={},_0x3b0e57={},_0x1dfff4={'count':0x0,'rows':[]};var _0xf80ac6=_['map'](db[_0x814e('0x3b')][_0x814e('0x3c')],function(_0x5813fe){return{'name':_0x5813fe[_0x814e('0x3d')],'type':_0x5813fe[_0x814e('0x3e')]['key']};});_0x3b0e57[_0x814e('0x3f')]=_['map'](_0xf80ac6,_0x814e('0x34'));_0x3b0e57['query']=_[_0x814e('0x40')](_0x45215c[_0x814e('0x41')]);_0x3b0e57[_0x814e('0x42')]=_['intersection'](_0x3b0e57[_0x814e('0x3f')],_0x3b0e57[_0x814e('0x41')]);_0x53a16b[_0x814e('0x43')]=_[_0x814e('0x44')](_0x3b0e57[_0x814e('0x3f')],qs[_0x814e('0x45')](_0x45215c['query'][_0x814e('0x45')]));_0x53a16b[_0x814e('0x43')]=_0x53a16b[_0x814e('0x43')]['length']?_0x53a16b[_0x814e('0x43')]:_0x3b0e57[_0x814e('0x3f')];if(!_0x45215c[_0x814e('0x41')][_0x814e('0x46')](_0x814e('0x47'))){_0x53a16b[_0x814e('0x2c')]=qs[_0x814e('0x2c')](_0x45215c['query'][_0x814e('0x2c')]);_0x53a16b[_0x814e('0x2a')]=qs['offset'](_0x45215c[_0x814e('0x41')][_0x814e('0x2a')]);}_0x53a16b['order']=qs['sort'](_0x45215c['query'][_0x814e('0x48')]);_0x53a16b[_0x814e('0x49')]=qs[_0x814e('0x42')](_[_0x814e('0x4a')](_0x45215c[_0x814e('0x41')],_0x3b0e57[_0x814e('0x42')]),_0xf80ac6);if(_0x45215c['query']['filter']){_0x53a16b[_0x814e('0x49')]=_['merge'](_0x53a16b[_0x814e('0x49')],{'$or':_[_0x814e('0x4b')](_0xf80ac6,function(_0x3c0151){if(_0x3c0151['type']!==_0x814e('0x4c')){var _0x414d27={};_0x414d27[_0x3c0151[_0x814e('0x34')]]={'$like':'%'+_0x45215c[_0x814e('0x41')]['filter']+'%'};return _0x414d27;}})});}_0x53a16b=_['merge']({},_0x53a16b,_0x45215c['options']);var _0x18476f={'where':_0x53a16b[_0x814e('0x49')]};return db[_0x814e('0x3b')][_0x814e('0x2d')](_0x18476f)[_0x814e('0x1d')](function(_0x1a8a0a){_0x1dfff4[_0x814e('0x2d')]=_0x1a8a0a;if(_0x45215c[_0x814e('0x41')][_0x814e('0x4d')]){_0x53a16b[_0x814e('0x4e')]=[{'all':!![]}];}return db[_0x814e('0x3b')][_0x814e('0x4f')](_0x53a16b);})['then'](function(_0xa4257f){_0x1dfff4[_0x814e('0x50')]=_0xa4257f;return _0x1dfff4;})[_0x814e('0x1d')](respondWithFilteredResult(_0x1a6f07,_0x53a16b))[_0x814e('0x51')](handleError(_0x1a6f07,null));};exports[_0x814e('0x52')]=function(_0x448980,_0x37e782){var _0x3b0db6={'raw':![],'where':{'id':_0x448980[_0x814e('0x53')]['id']}},_0x29542a={};_0x29542a[_0x814e('0x3f')]=_[_0x814e('0x40')](db[_0x814e('0x3b')]['rawAttributes']);_0x29542a['query']=_['keys'](_0x448980[_0x814e('0x41')]);_0x29542a[_0x814e('0x42')]=_['intersection'](_0x29542a[_0x814e('0x3f')],_0x29542a['query']);_0x3b0db6[_0x814e('0x43')]=_[_0x814e('0x44')](_0x29542a[_0x814e('0x3f')],qs[_0x814e('0x45')](_0x448980[_0x814e('0x41')][_0x814e('0x45')]));_0x3b0db6[_0x814e('0x43')]=_0x3b0db6[_0x814e('0x43')][_0x814e('0x54')]?_0x3b0db6['attributes']:_0x29542a[_0x814e('0x3f')];if(_0x448980['query'][_0x814e('0x4d')]){_0x3b0db6['include']=[{'all':!![]}];}_0x3b0db6=_[_0x814e('0x35')]({},_0x3b0db6,_0x448980[_0x814e('0x55')]);return db[_0x814e('0x3b')][_0x814e('0x56')](_0x3b0db6)['then'](handleEntityNotFound(_0x37e782,null))[_0x814e('0x1d')](respondWithResult(_0x37e782,null))[_0x814e('0x51')](handleError(_0x37e782,null));};exports['create']=function(_0x2af8e1,_0x32e23e){return db[_0x814e('0x3b')][_0x814e('0x57')](_0x2af8e1[_0x814e('0x36')],{})[_0x814e('0x1d')](respondWithResult(_0x32e23e,0xc9))[_0x814e('0x51')](handleError(_0x32e23e,null));};exports[_0x814e('0x58')]=function(_0x143912,_0x17c92c){if(_0x143912[_0x814e('0x36')]['id']){delete _0x143912[_0x814e('0x36')]['id'];}return db[_0x814e('0x3b')]['find']({'where':{'id':_0x143912['params']['id']}})[_0x814e('0x1d')](handleEntityNotFound(_0x17c92c,null))[_0x814e('0x1d')](saveUpdates(_0x143912[_0x814e('0x36')],null))[_0x814e('0x1d')](respondWithResult(_0x17c92c,null))['catch'](handleError(_0x17c92c,null));};exports[_0x814e('0x59')]=function(_0x20f191,_0x1cab7c){return db[_0x814e('0x3b')][_0x814e('0x56')]({'where':{'id':_0x20f191[_0x814e('0x53')]['id']}})[_0x814e('0x1d')](handleEntityNotFound(_0x1cab7c,null))[_0x814e('0x1d')](removeEntity(_0x1cab7c,null))[_0x814e('0x51')](handleError(_0x1cab7c,null));};exports['getFields']=function(_0xf350eb,_0x55e293,_0x13c561){var _0x309358={};var _0xa8c972={};var _0x180332;var _0x50b751;return db[_0x814e('0x3b')][_0x814e('0x5a')]({'where':{'id':_0xf350eb['params']['id']}})[_0x814e('0x1d')](handleEntityNotFound(_0x55e293,null))[_0x814e('0x1d')](function(_0x3b5390){if(_0x3b5390){_0x180332=_0x3b5390;_0xa8c972[_0x814e('0x3f')]=_[_0x814e('0x40')](db['ServicenowField'][_0x814e('0x3c')]);_0xa8c972[_0x814e('0x41')]=_[_0x814e('0x40')](_0xf350eb[_0x814e('0x41')]);_0xa8c972[_0x814e('0x42')]=_['intersection'](_0xa8c972[_0x814e('0x3f')],_0xa8c972['query']);_0x309358[_0x814e('0x43')]=_['intersection'](_0xa8c972[_0x814e('0x3f')],qs[_0x814e('0x45')](_0xf350eb[_0x814e('0x41')][_0x814e('0x45')]));_0x309358[_0x814e('0x43')]=_0x309358[_0x814e('0x43')][_0x814e('0x54')]?_0x309358[_0x814e('0x43')]:_0xa8c972[_0x814e('0x3f')];_0x309358[_0x814e('0x5b')]=qs[_0x814e('0x48')](_0xf350eb[_0x814e('0x41')]['sort']);_0x309358[_0x814e('0x49')]=qs[_0x814e('0x42')](_[_0x814e('0x4a')](_0xf350eb[_0x814e('0x41')],_0xa8c972[_0x814e('0x42')]));if(_0xf350eb[_0x814e('0x41')][_0x814e('0x5c')]){_0x309358['where']=_['merge'](_0x309358['where'],{'$or':_[_0x814e('0x4b')](_0x309358[_0x814e('0x43')],function(_0x1da58d){var _0x4d4c4a={};_0x4d4c4a[_0x1da58d]={'$like':'%'+_0xf350eb[_0x814e('0x41')]['filter']+'%'};return _0x4d4c4a;})});}_0x309358=_[_0x814e('0x35')]({},_0x309358,_0xf350eb[_0x814e('0x55')]);return _0x180332[_0x814e('0x5d')](_0x309358);}})[_0x814e('0x1d')](function(_0x426aea){if(_0x426aea){_0x50b751=_0x426aea[_0x814e('0x54')];if(!_0xf350eb['query']['hasOwnProperty'](_0x814e('0x47'))){_0x309358[_0x814e('0x2c')]=qs['limit'](_0xf350eb[_0x814e('0x41')][_0x814e('0x2c')]);_0x309358[_0x814e('0x2a')]=qs[_0x814e('0x2a')](_0xf350eb[_0x814e('0x41')][_0x814e('0x2a')]);}return _0x180332[_0x814e('0x5d')](_0x309358);}})[_0x814e('0x1d')](function(_0x38f61e){if(_0x38f61e){return _0x38f61e?{'count':_0x50b751,'rows':_0x38f61e}:null;}})[_0x814e('0x1d')](respondWithResult(_0x55e293,null))[_0x814e('0x51')](handleError(_0x55e293,null));};exports[_0x814e('0x5e')]=function(_0xd954c6,_0x1be7be,_0x3b5255){var _0x2fd954={};var _0x44a7a4={};var _0x317e25;var _0x52b0e0;return db[_0x814e('0x3b')]['findOne']({'where':{'id':_0xd954c6[_0x814e('0x53')]['id']}})[_0x814e('0x1d')](handleEntityNotFound(_0x1be7be,null))[_0x814e('0x1d')](function(_0x587523){if(_0x587523){_0x317e25=_0x587523;_0x44a7a4[_0x814e('0x3f')]=_['keys'](db[_0x814e('0x5f')][_0x814e('0x3c')]);_0x44a7a4[_0x814e('0x41')]=_[_0x814e('0x40')](_0xd954c6[_0x814e('0x41')]);_0x44a7a4[_0x814e('0x42')]=_['intersection'](_0x44a7a4[_0x814e('0x3f')],_0x44a7a4['query']);_0x2fd954['attributes']=_[_0x814e('0x44')](_0x44a7a4[_0x814e('0x3f')],qs[_0x814e('0x45')](_0xd954c6['query'][_0x814e('0x45')]));_0x2fd954[_0x814e('0x43')]=_0x2fd954[_0x814e('0x43')]['length']?_0x2fd954[_0x814e('0x43')]:_0x44a7a4[_0x814e('0x3f')];_0x2fd954['order']=qs['sort'](_0xd954c6[_0x814e('0x41')][_0x814e('0x48')]);_0x2fd954[_0x814e('0x49')]=qs[_0x814e('0x42')](_[_0x814e('0x4a')](_0xd954c6['query'],_0x44a7a4['filters']));if(_0xd954c6[_0x814e('0x41')]['filter']){_0x2fd954[_0x814e('0x49')]=_[_0x814e('0x35')](_0x2fd954['where'],{'$or':_[_0x814e('0x4b')](_0x2fd954['attributes'],function(_0x50cb2c){var _0x28d20a={};_0x28d20a[_0x50cb2c]={'$like':'%'+_0xd954c6['query'][_0x814e('0x5c')]+'%'};return _0x28d20a;})});}_0x2fd954=_[_0x814e('0x35')]({},_0x2fd954,_0xd954c6[_0x814e('0x55')]);return _0x317e25[_0x814e('0x5e')](_0x2fd954);}})[_0x814e('0x1d')](function(_0x3ea007){if(_0x3ea007){_0x52b0e0=_0x3ea007[_0x814e('0x54')];if(!_0xd954c6[_0x814e('0x41')]['hasOwnProperty']('nolimit')){_0x2fd954[_0x814e('0x2c')]=qs[_0x814e('0x2c')](_0xd954c6[_0x814e('0x41')][_0x814e('0x2c')]);_0x2fd954['offset']=qs[_0x814e('0x2a')](_0xd954c6['query'][_0x814e('0x2a')]);}return _0x317e25['getSubjects'](_0x2fd954);}})['then'](function(_0x25d27c){if(_0x25d27c){return _0x25d27c?{'count':_0x52b0e0,'rows':_0x25d27c}:null;}})[_0x814e('0x1d')](respondWithResult(_0x1be7be,null))['catch'](handleError(_0x1be7be,null));};exports[_0x814e('0x60')]=function(_0x26fdca,_0x4ba39d,_0x1520d6){var _0x13a032={};var _0x33fe08={};var _0x2c5540;var _0x172e6a;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x26fdca['params']['id']}})[_0x814e('0x1d')](handleEntityNotFound(_0x4ba39d,null))['then'](function(_0x12b9d5){if(_0x12b9d5){_0x2c5540=_0x12b9d5;_0x33fe08[_0x814e('0x3f')]=_[_0x814e('0x40')](db[_0x814e('0x5f')]['rawAttributes']);_0x33fe08[_0x814e('0x41')]=_[_0x814e('0x40')](_0x26fdca['query']);_0x33fe08['filters']=_[_0x814e('0x44')](_0x33fe08[_0x814e('0x3f')],_0x33fe08['query']);_0x13a032[_0x814e('0x43')]=_[_0x814e('0x44')](_0x33fe08[_0x814e('0x3f')],qs[_0x814e('0x45')](_0x26fdca[_0x814e('0x41')][_0x814e('0x45')]));_0x13a032[_0x814e('0x43')]=_0x13a032[_0x814e('0x43')][_0x814e('0x54')]?_0x13a032[_0x814e('0x43')]:_0x33fe08[_0x814e('0x3f')];_0x13a032[_0x814e('0x5b')]=qs[_0x814e('0x48')](_0x26fdca[_0x814e('0x41')]['sort']);_0x13a032[_0x814e('0x49')]=qs[_0x814e('0x42')](_[_0x814e('0x4a')](_0x26fdca[_0x814e('0x41')],_0x33fe08[_0x814e('0x42')]));if(_0x26fdca[_0x814e('0x41')][_0x814e('0x5c')]){_0x13a032[_0x814e('0x49')]=_[_0x814e('0x35')](_0x13a032['where'],{'$or':_['map'](_0x13a032[_0x814e('0x43')],function(_0x18a519){var _0x39fb86={};_0x39fb86[_0x18a519]={'$like':'%'+_0x26fdca[_0x814e('0x41')][_0x814e('0x5c')]+'%'};return _0x39fb86;})});}_0x13a032=_[_0x814e('0x35')]({},_0x13a032,_0x26fdca[_0x814e('0x55')]);return _0x2c5540['getDescriptions'](_0x13a032);}})[_0x814e('0x1d')](function(_0x2492cd){if(_0x2492cd){_0x172e6a=_0x2492cd['length'];if(!_0x26fdca[_0x814e('0x41')]['hasOwnProperty'](_0x814e('0x47'))){_0x13a032[_0x814e('0x2c')]=qs[_0x814e('0x2c')](_0x26fdca[_0x814e('0x41')][_0x814e('0x2c')]);_0x13a032[_0x814e('0x2a')]=qs['offset'](_0x26fdca[_0x814e('0x41')]['offset']);}return _0x2c5540[_0x814e('0x60')](_0x13a032);}})['then'](function(_0x4c2dae){if(_0x4c2dae){return _0x4c2dae?{'count':_0x172e6a,'rows':_0x4c2dae}:null;}})[_0x814e('0x1d')](respondWithResult(_0x4ba39d,null))[_0x814e('0x51')](handleError(_0x4ba39d,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index a7e67c8..c2ebf79 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 _0x63dd=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0x63dd,0xcf));var _0xd63d=function(_0x10bb45,_0xa57a18){_0x10bb45=_0x10bb45-0x0;var _0x4f1846=_0x63dd[_0x10bb45];return _0x4f1846;};'use strict';var _=require(_0xd63d('0x0'));var util=require('util');var logger=require(_0xd63d('0x1'))(_0xd63d('0x2'));var moment=require(_0xd63d('0x3'));var BPromise=require(_0xd63d('0x4'));var rp=require(_0xd63d('0x5'));var fs=require('fs');var path=require(_0xd63d('0x6'));var rimraf=require(_0xd63d('0x7'));var config=require(_0xd63d('0x8'));var attributes=require(_0xd63d('0x9'));module[_0xd63d('0xa')]=function(_0x3fa27e,_0x964191){return _0x3fa27e['define'](_0xd63d('0xb'),attributes,{'tableName':_0xd63d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7eba=['ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./intServicenowConfiguration.attributes','exports'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x7eba,0x162));var _0xa7eb=function(_0x582991,_0x49cfd7){_0x582991=_0x582991-0x0;var _0x10b480=_0x7eba[_0x582991];return _0x10b480;};'use strict';var _=require(_0xa7eb('0x0'));var util=require(_0xa7eb('0x1'));var logger=require(_0xa7eb('0x2'))(_0xa7eb('0x3'));var moment=require(_0xa7eb('0x4'));var BPromise=require('bluebird');var rp=require(_0xa7eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa7eb('0x6'));var config=require('../../config/environment');var attributes=require(_0xa7eb('0x7'));module[_0xa7eb('0x8')]=function(_0x56a991,_0x30999c){return _0x56a991['define'](_0xa7eb('0x9'),attributes,{'tableName':_0xa7eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index f59869b..59ec6b7 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 _0x2181=['lodash','util','moment','bluebird','randomstring','../../config/logger','jayson/promise','request','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','catch'];(function(_0xc2cbc0,_0x1f9a82){var _0x12810b=function(_0x54f3cf){while(--_0x54f3cf){_0xc2cbc0['push'](_0xc2cbc0['shift']());}};_0x12810b(++_0x1f9a82);}(_0x2181,0x1db));var _0x1218=function(_0x20238a,_0x9aff80){_0x20238a=_0x20238a-0x0;var _0x259b82=_0x2181[_0x20238a];return _0x259b82;};'use strict';var _=require(_0x1218('0x0'));var util=require(_0x1218('0x1'));var moment=require(_0x1218('0x2'));var BPromise=require(_0x1218('0x3'));var rs=require(_0x1218('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1218('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1218('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10d22d,_0x1b6d81,_0x2a5808){return new BPromise(function(_0x501558,_0x2fd0be){return client[_0x1218('0x7')](_0x10d22d,_0x2a5808)[_0x1218('0x8')](function(_0x4a85cf){logger[_0x1218('0x9')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1b6d81,_0x1218('0xa'));logger[_0x1218('0xb')](_0x1218('0xc'),_0x1b6d81,_0x1218('0xa'),JSON[_0x1218('0xd')](_0x4a85cf));if(_0x4a85cf[_0x1218('0xe')]){if(_0x4a85cf['error'][_0x1218('0xf')]===0x1f4){logger['error'](_0x1218('0x10'),_0x1b6d81,_0x4a85cf[_0x1218('0xe')][_0x1218('0x11')]);return _0x2fd0be(_0x4a85cf[_0x1218('0xe')][_0x1218('0x11')]);}logger[_0x1218('0xe')](_0x1218('0x10'),_0x1b6d81,_0x4a85cf[_0x1218('0xe')]['message']);return _0x501558(_0x4a85cf[_0x1218('0xe')][_0x1218('0x11')]);}else{logger[_0x1218('0x9')](_0x1218('0x10'),_0x1b6d81,_0x1218('0xa'));_0x501558(_0x4a85cf['result'][_0x1218('0x11')]);}})[_0x1218('0x12')](function(_0x4601cb){logger[_0x1218('0xe')](_0x1218('0x10'),_0x1b6d81,_0x4601cb);_0x2fd0be(_0x4601cb);});});} \ No newline at end of file +var _0xdc22=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x2c20b2,_0x359863){var _0x5c0161=function(_0x2b7ec6){while(--_0x2b7ec6){_0x2c20b2['push'](_0x2c20b2['shift']());}};_0x5c0161(++_0x359863);}(_0xdc22,0xd7));var _0x2dc2=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0xdc22[_0x100682];return _0xcb6e87;};'use strict';var _=require(_0x2dc2('0x0'));var util=require(_0x2dc2('0x1'));var moment=require(_0x2dc2('0x2'));var BPromise=require(_0x2dc2('0x3'));var rs=require(_0x2dc2('0x4'));var fs=require('fs');var Redis=require(_0x2dc2('0x5'));var db=require(_0x2dc2('0x6'))['db'];var utils=require(_0x2dc2('0x7'));var logger=require(_0x2dc2('0x8'))(_0x2dc2('0x9'));var config=require(_0x2dc2('0xa'));var jayson=require(_0x2dc2('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x413d2f,_0x33bed7,_0xd446e9){return new BPromise(function(_0x341a8d,_0x13073c){return client['request'](_0x413d2f,_0xd446e9)[_0x2dc2('0xc')](function(_0x5a0a90){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x33bed7,_0x2dc2('0xd'));logger[_0x2dc2('0xe')](_0x2dc2('0xf'),_0x33bed7,_0x2dc2('0xd'),JSON[_0x2dc2('0x10')](_0x5a0a90));if(_0x5a0a90[_0x2dc2('0x11')]){if(_0x5a0a90['error'][_0x2dc2('0x12')]===0x1f4){logger[_0x2dc2('0x11')](_0x2dc2('0x13'),_0x33bed7,_0x5a0a90[_0x2dc2('0x11')]['message']);return _0x13073c(_0x5a0a90['error'][_0x2dc2('0x14')]);}logger['error'](_0x2dc2('0x13'),_0x33bed7,_0x5a0a90[_0x2dc2('0x11')]['message']);return _0x341a8d(_0x5a0a90[_0x2dc2('0x11')][_0x2dc2('0x14')]);}else{logger[_0x2dc2('0x15')](_0x2dc2('0x13'),_0x33bed7,_0x2dc2('0xd'));_0x341a8d(_0x5a0a90[_0x2dc2('0x16')]['message']);}})[_0x2dc2('0x17')](function(_0x2aef7c){logger[_0x2dc2('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x33bed7,_0x2aef7c);_0x13073c(_0x2aef7c);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 1ba1e7e..3494727 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 _0x1004=['../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','post','/:id','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1f7ffb,_0x201156){var _0x16396f=function(_0x22b9ff){while(--_0x22b9ff){_0x1f7ffb['push'](_0x1f7ffb['shift']());}};_0x16396f(++_0x201156);}(_0x1004,0x133));var _0x4100=function(_0x45a052,_0x3dbcaa){_0x45a052=_0x45a052-0x0;var _0x7a621b=_0x1004[_0x45a052];return _0x7a621b;};'use strict';var multer=require(_0x4100('0x0'));var util=require(_0x4100('0x1'));var path=require(_0x4100('0x2'));var timeout=require(_0x4100('0x3'));var express=require(_0x4100('0x4'));var router=express[_0x4100('0x5')]();var fs_extra=require(_0x4100('0x6'));var auth=require(_0x4100('0x7'));var interaction=require(_0x4100('0x8'));var config=require('../../config/environment');var controller=require(_0x4100('0x9'));router[_0x4100('0xa')]('/',auth[_0x4100('0xb')](),controller['index']);router[_0x4100('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4100('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x4100('0xd'),auth[_0x4100('0xb')](),controller[_0x4100('0xe')]);router['delete'](_0x4100('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb247=['../../components/interaction/service','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xb247,0x176));var _0x7b24=function(_0x356307,_0xe0a012){_0x356307=_0x356307-0x0;var _0x59e722=_0xb247[_0x356307];return _0x59e722;};'use strict';var multer=require(_0x7b24('0x0'));var util=require(_0x7b24('0x1'));var path=require('path');var timeout=require(_0x7b24('0x2'));var express=require(_0x7b24('0x3'));var router=express[_0x7b24('0x4')]();var fs_extra=require(_0x7b24('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7b24('0x6'));var config=require('../../config/environment');var controller=require(_0x7b24('0x7'));router['get']('/',auth[_0x7b24('0x8')](),controller[_0x7b24('0x9')]);router[_0x7b24('0xa')](_0x7b24('0xb'),auth[_0x7b24('0x8')](),controller[_0x7b24('0xc')]);router[_0x7b24('0xd')]('/',auth[_0x7b24('0x8')](),controller[_0x7b24('0xe')]);router[_0x7b24('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x7b24('0x10')]);router[_0x7b24('0x11')](_0x7b24('0xb'),auth[_0x7b24('0x8')](),controller[_0x7b24('0x12')]);module[_0x7b24('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index aa9d4c0..ad15371 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 _0xb091=['string','variable','keyValue','STRING','customVariable','BOOLEAN','exports','ENUM'];(function(_0x29e2af,_0x15e2b1){var _0x1ea06a=function(_0x34d736){while(--_0x34d736){_0x29e2af['push'](_0x29e2af['shift']());}};_0x1ea06a(++_0x15e2b1);}(_0xb091,0x16e));var _0x1b09=function(_0x1e9a89,_0x29e978){_0x1e9a89=_0x1e9a89-0x0;var _0x2383b8=_0xb091[_0x1e9a89];return _0x2383b8;};'use strict';var Sequelize=require('sequelize');module[_0x1b09('0x0')]={'type':{'type':Sequelize[_0x1b09('0x1')](_0x1b09('0x2'),_0x1b09('0x3'),'customVariable',_0x1b09('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x1b09('0x5')]},'key':{'type':Sequelize[_0x1b09('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x1b09('0x2'),_0x1b09('0x3'),_0x1b09('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1b09('0x5')]},'nameField':{'type':Sequelize[_0x1b09('0x5')]},'customField':{'type':Sequelize[_0x1b09('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1b09('0x5')]}}; \ No newline at end of file +var _0x56a4=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','picklist'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x56a4,0x11b));var _0x456a=function(_0xef34c5,_0xd17a9d){_0xef34c5=_0xef34c5-0x0;var _0x1de207=_0x56a4[_0xef34c5];return _0x1de207;};'use strict';var Sequelize=require(_0x456a('0x0'));module[_0x456a('0x1')]={'type':{'type':Sequelize['ENUM'](_0x456a('0x2'),_0x456a('0x3'),'customVariable','keyValue',_0x456a('0x4')),'defaultValue':_0x456a('0x2')},'content':{'type':Sequelize[_0x456a('0x5')]},'key':{'type':Sequelize[_0x456a('0x5')]},'keyType':{'type':Sequelize[_0x456a('0x6')]('string',_0x456a('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x456a('0x5')]},'nameField':{'type':Sequelize[_0x456a('0x5')]},'customField':{'type':Sequelize[_0x456a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 15d249a..87c5a2b 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 _0xa7f7=['merge','contact','message','agent','account','map','ServicenowField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','offset','order','sort','where','pick','type','options','findAll','rows','catch','show','include','find','create','update','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','render'];(function(_0x385c76,_0xb97335){var _0x5c8367=function(_0xdfcd3){while(--_0xdfcd3){_0x385c76['push'](_0x385c76['shift']());}};_0x5c8367(++_0xb97335);}(_0xa7f7,0x154));var _0x7a7f=function(_0x470e67,_0x4a596d){_0x470e67=_0x470e67-0x0;var _0x28bbde=_0xa7f7[_0x470e67];return _0x28bbde;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a7f('0x0'));var zipdir=require(_0x7a7f('0x1'));var jsonpatch=require(_0x7a7f('0x2'));var rp=require(_0x7a7f('0x3'));var moment=require(_0x7a7f('0x4'));var BPromise=require(_0x7a7f('0x5'));var Mustache=require(_0x7a7f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7a7f('0x7'));var csv=require(_0x7a7f('0x8'));var ejs=require(_0x7a7f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7a7f('0xa'));var crypto=require(_0x7a7f('0xb'));var jsforce=require(_0x7a7f('0xc'));var deskjs=require(_0x7a7f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7a7f('0xe'));var Papa=require(_0x7a7f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7a7f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a7f('0x11'));var logger=require(_0x7a7f('0x12'))(_0x7a7f('0x13'));var utils=require('../../config/utils');var config=require(_0x7a7f('0x14'));var licenseUtil=require(_0x7a7f('0x15'));var db=require(_0x7a7f('0x16'))['db'];function respondWithStatusCode(_0x26028,_0x5ae20a){_0x5ae20a=_0x5ae20a||0xcc;return function(_0x4dd022){if(_0x4dd022){return _0x26028['sendStatus'](_0x5ae20a);}return _0x26028[_0x7a7f('0x17')](_0x5ae20a)['end']();};}function respondWithResult(_0x144893,_0x47a20e){_0x47a20e=_0x47a20e||0xc8;return function(_0x4f59e8){if(_0x4f59e8){return _0x144893[_0x7a7f('0x17')](_0x47a20e)[_0x7a7f('0x18')](_0x4f59e8);}};}function respondWithFilteredResult(_0x1ec412,_0xd7fe85){return function(_0x40355a){if(_0x40355a){var _0x24d5c6=typeof _0xd7fe85['offset']===_0x7a7f('0x19')&&typeof _0xd7fe85[_0x7a7f('0x1a')]===_0x7a7f('0x19');var _0x4d1fcb=_0x40355a['count'];var _0x33e312=_0x24d5c6?0x0:_0xd7fe85['offset'];var _0x437f4e=_0x24d5c6?_0x40355a[_0x7a7f('0x1b')]:_0xd7fe85['offset']+_0xd7fe85[_0x7a7f('0x1a')];var _0x590830;if(_0x437f4e>=_0x4d1fcb){_0x437f4e=_0x4d1fcb;_0x590830=0xc8;}else{_0x590830=0xce;}_0x1ec412['status'](_0x590830);return _0x1ec412[_0x7a7f('0x1c')](_0x7a7f('0x1d'),_0x33e312+'-'+_0x437f4e+'/'+_0x4d1fcb)[_0x7a7f('0x18')](_0x40355a);}return null;};}function patchUpdates(_0x14dce7){return function(_0x2e4d38){try{jsonpatch[_0x7a7f('0x1e')](_0x2e4d38,_0x14dce7,!![]);}catch(_0x450221){return BPromise[_0x7a7f('0x1f')](_0x450221);}return _0x2e4d38[_0x7a7f('0x20')]();};}function saveUpdates(_0x4fa1ad,_0x3a819f){return function(_0x4ce937){if(_0x4ce937){return _0x4ce937['update'](_0x4fa1ad)[_0x7a7f('0x21')](function(_0x20c2ae){return _0x20c2ae;});}return null;};}function removeEntity(_0x3e4151,_0x1f4efc){return function(_0x5d3c64){if(_0x5d3c64){return _0x5d3c64[_0x7a7f('0x22')]()[_0x7a7f('0x21')](function(){_0x3e4151[_0x7a7f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34e7db,_0x3a02b1){return function(_0x19fdcd){if(!_0x19fdcd){_0x34e7db['sendStatus'](0x194);}return _0x19fdcd;};}function handleError(_0x1fbcd3,_0x431d06){_0x431d06=_0x431d06||0x1f4;return function(_0x561625){logger[_0x7a7f('0x23')](_0x561625[_0x7a7f('0x24')]);if(_0x561625[_0x7a7f('0x25')]){delete _0x561625[_0x7a7f('0x25')];}_0x1fbcd3[_0x7a7f('0x17')](_0x431d06)[_0x7a7f('0x26')](_0x561625);};}function getMustacheRender(_0x5602d5,_0x3c8fed){return Mustache[_0x7a7f('0x27')](_0x5602d5,_[_0x7a7f('0x28')](_0x3c8fed['body'],{'contact':_0x3c8fed[_0x7a7f('0x29')],'message':_0x3c8fed[_0x7a7f('0x2a')],'agent':_0x3c8fed[_0x7a7f('0x2b')],'interaction':_0x3c8fed['interaction'],'account':_0x3c8fed[_0x7a7f('0x2c')]}))||'';}exports['index']=function(_0x5bb9ac,_0xe36c94){var _0x5f022a={},_0x37434a={},_0x3adbe5={'count':0x0,'rows':[]};var _0x5ea62a=_[_0x7a7f('0x2d')](db[_0x7a7f('0x2e')][_0x7a7f('0x2f')],function(_0x403f79){return{'name':_0x403f79[_0x7a7f('0x30')],'type':_0x403f79['type'][_0x7a7f('0x31')]};});_0x37434a[_0x7a7f('0x32')]=_[_0x7a7f('0x2d')](_0x5ea62a,'name');_0x37434a[_0x7a7f('0x33')]=_[_0x7a7f('0x34')](_0x5bb9ac[_0x7a7f('0x33')]);_0x37434a[_0x7a7f('0x35')]=_['intersection'](_0x37434a['model'],_0x37434a[_0x7a7f('0x33')]);_0x5f022a[_0x7a7f('0x36')]=_[_0x7a7f('0x37')](_0x37434a[_0x7a7f('0x32')],qs[_0x7a7f('0x38')](_0x5bb9ac[_0x7a7f('0x33')][_0x7a7f('0x38')]));_0x5f022a[_0x7a7f('0x36')]=_0x5f022a['attributes'][_0x7a7f('0x39')]?_0x5f022a[_0x7a7f('0x36')]:_0x37434a[_0x7a7f('0x32')];if(!_0x5bb9ac[_0x7a7f('0x33')]['hasOwnProperty'](_0x7a7f('0x3a'))){_0x5f022a[_0x7a7f('0x1a')]=qs[_0x7a7f('0x1a')](_0x5bb9ac[_0x7a7f('0x33')][_0x7a7f('0x1a')]);_0x5f022a['offset']=qs[_0x7a7f('0x3b')](_0x5bb9ac['query'][_0x7a7f('0x3b')]);}_0x5f022a[_0x7a7f('0x3c')]=qs[_0x7a7f('0x3d')](_0x5bb9ac[_0x7a7f('0x33')][_0x7a7f('0x3d')]);_0x5f022a[_0x7a7f('0x3e')]=qs['filters'](_[_0x7a7f('0x3f')](_0x5bb9ac[_0x7a7f('0x33')],_0x37434a[_0x7a7f('0x35')]),_0x5ea62a);if(_0x5bb9ac[_0x7a7f('0x33')]['filter']){_0x5f022a[_0x7a7f('0x3e')]=_['merge'](_0x5f022a[_0x7a7f('0x3e')],{'$or':_[_0x7a7f('0x2d')](_0x5ea62a,function(_0x802981){if(_0x802981[_0x7a7f('0x40')]!=='VIRTUAL'){var _0xbb8d5d={};_0xbb8d5d[_0x802981['name']]={'$like':'%'+_0x5bb9ac[_0x7a7f('0x33')]['filter']+'%'};return _0xbb8d5d;}})});}_0x5f022a=_[_0x7a7f('0x28')]({},_0x5f022a,_0x5bb9ac[_0x7a7f('0x41')]);var _0x15a0a3={'where':_0x5f022a[_0x7a7f('0x3e')]};return db[_0x7a7f('0x2e')]['count'](_0x15a0a3)['then'](function(_0x263187){_0x3adbe5['count']=_0x263187;if(_0x5bb9ac['query']['includeAll']){_0x5f022a['include']=[{'all':!![]}];}return db[_0x7a7f('0x2e')][_0x7a7f('0x42')](_0x5f022a);})[_0x7a7f('0x21')](function(_0x3ed34f){_0x3adbe5[_0x7a7f('0x43')]=_0x3ed34f;return _0x3adbe5;})['then'](respondWithFilteredResult(_0xe36c94,_0x5f022a))[_0x7a7f('0x44')](handleError(_0xe36c94,null));};exports[_0x7a7f('0x45')]=function(_0x4e7e8c,_0x183c11){var _0x14b5bc={'raw':!![],'where':{'id':_0x4e7e8c['params']['id']}},_0x25ba35={};_0x25ba35['model']=_[_0x7a7f('0x34')](db[_0x7a7f('0x2e')][_0x7a7f('0x2f')]);_0x25ba35['query']=_[_0x7a7f('0x34')](_0x4e7e8c[_0x7a7f('0x33')]);_0x25ba35['filters']=_[_0x7a7f('0x37')](_0x25ba35[_0x7a7f('0x32')],_0x25ba35['query']);_0x14b5bc[_0x7a7f('0x36')]=_[_0x7a7f('0x37')](_0x25ba35[_0x7a7f('0x32')],qs[_0x7a7f('0x38')](_0x4e7e8c['query'][_0x7a7f('0x38')]));_0x14b5bc[_0x7a7f('0x36')]=_0x14b5bc['attributes'][_0x7a7f('0x39')]?_0x14b5bc[_0x7a7f('0x36')]:_0x25ba35[_0x7a7f('0x32')];if(_0x4e7e8c[_0x7a7f('0x33')]['includeAll']){_0x14b5bc[_0x7a7f('0x46')]=[{'all':!![]}];}_0x14b5bc=_[_0x7a7f('0x28')]({},_0x14b5bc,_0x4e7e8c[_0x7a7f('0x41')]);return db[_0x7a7f('0x2e')][_0x7a7f('0x47')](_0x14b5bc)[_0x7a7f('0x21')](handleEntityNotFound(_0x183c11,null))[_0x7a7f('0x21')](respondWithResult(_0x183c11,null))[_0x7a7f('0x44')](handleError(_0x183c11,null));};exports[_0x7a7f('0x48')]=function(_0x12a06e,_0x2f119e){return db['ServicenowField']['create'](_0x12a06e['body'],{})[_0x7a7f('0x21')](respondWithResult(_0x2f119e,0xc9))['catch'](handleError(_0x2f119e,null));};exports[_0x7a7f('0x49')]=function(_0x32f318,_0x58db48){if(_0x32f318[_0x7a7f('0x4a')]['id']){delete _0x32f318['body']['id'];}return db[_0x7a7f('0x2e')][_0x7a7f('0x47')]({'where':{'id':_0x32f318[_0x7a7f('0x4b')]['id']}})[_0x7a7f('0x21')](handleEntityNotFound(_0x58db48,null))[_0x7a7f('0x21')](saveUpdates(_0x32f318[_0x7a7f('0x4a')],null))[_0x7a7f('0x21')](respondWithResult(_0x58db48,null))[_0x7a7f('0x44')](handleError(_0x58db48,null));};exports[_0x7a7f('0x22')]=function(_0x4ed04d,_0x2b0273){return db[_0x7a7f('0x2e')]['find']({'where':{'id':_0x4ed04d[_0x7a7f('0x4b')]['id']}})[_0x7a7f('0x21')](handleEntityNotFound(_0x2b0273,null))['then'](removeEntity(_0x2b0273,null))[_0x7a7f('0x44')](handleError(_0x2b0273,null));}; \ No newline at end of file +var _0x64bd=['util','path','sox','fs-extra','lodash','squel','desk.js','papaparse','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','limit','undefined','count','offset','set','Content-Range','apply','update','destroy','then','error','stack','name','send','render','merge','body','message','agent','interaction','account','index','ServicenowField','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','params','rawAttributes','fields','includeAll','catch','create','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x64bd,0xe6));var _0xd64b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x64bd[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xd64b('0x0'));var rimraf=require(_0xd64b('0x1'));var zipdir=require(_0xd64b('0x2'));var jsonpatch=require(_0xd64b('0x3'));var rp=require(_0xd64b('0x4'));var moment=require(_0xd64b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd64b('0x6'));var util=require(_0xd64b('0x7'));var path=require(_0xd64b('0x8'));var sox=require(_0xd64b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd64b('0xa'));var _=require(_0xd64b('0xb'));var squel=require(_0xd64b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd64b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd64b('0xe'));var Redis=require(_0xd64b('0xf'));var authService=require(_0xd64b('0x10'));var qs=require(_0xd64b('0x11'));var as=require(_0xd64b('0x12'));var hardwareService=require(_0xd64b('0x13'));var logger=require(_0xd64b('0x14'))('api');var utils=require(_0xd64b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd64b('0x16'));var db=require(_0xd64b('0x17'))['db'];function respondWithStatusCode(_0x406a11,_0x4727cf){_0x4727cf=_0x4727cf||0xcc;return function(_0x4be60f){if(_0x4be60f){return _0x406a11[_0xd64b('0x18')](_0x4727cf);}return _0x406a11['status'](_0x4727cf)[_0xd64b('0x19')]();};}function respondWithResult(_0x141e66,_0x19628a){_0x19628a=_0x19628a||0xc8;return function(_0x30313f){if(_0x30313f){return _0x141e66[_0xd64b('0x1a')](_0x19628a)[_0xd64b('0x1b')](_0x30313f);}};}function respondWithFilteredResult(_0x1613e8,_0x3884da){return function(_0x1b2d51){if(_0x1b2d51){var _0x1db9e4=typeof _0x3884da['offset']==='undefined'&&typeof _0x3884da[_0xd64b('0x1c')]===_0xd64b('0x1d');var _0x3fcbc0=_0x1b2d51[_0xd64b('0x1e')];var _0x4fe02d=_0x1db9e4?0x0:_0x3884da[_0xd64b('0x1f')];var _0x10ea8a=_0x1db9e4?_0x1b2d51[_0xd64b('0x1e')]:_0x3884da[_0xd64b('0x1f')]+_0x3884da[_0xd64b('0x1c')];var _0x248d70;if(_0x10ea8a>=_0x3fcbc0){_0x10ea8a=_0x3fcbc0;_0x248d70=0xc8;}else{_0x248d70=0xce;}_0x1613e8[_0xd64b('0x1a')](_0x248d70);return _0x1613e8[_0xd64b('0x20')](_0xd64b('0x21'),_0x4fe02d+'-'+_0x10ea8a+'/'+_0x3fcbc0)[_0xd64b('0x1b')](_0x1b2d51);}return null;};}function patchUpdates(_0x465588){return function(_0x3ccef5){try{jsonpatch[_0xd64b('0x22')](_0x3ccef5,_0x465588,!![]);}catch(_0x6c1649){return BPromise['reject'](_0x6c1649);}return _0x3ccef5['save']();};}function saveUpdates(_0x443715,_0x124832){return function(_0x23223e){if(_0x23223e){return _0x23223e[_0xd64b('0x23')](_0x443715)['then'](function(_0x5a9aef){return _0x5a9aef;});}return null;};}function removeEntity(_0x1140f2,_0x4cf943){return function(_0x553bb7){if(_0x553bb7){return _0x553bb7[_0xd64b('0x24')]()[_0xd64b('0x25')](function(){_0x1140f2[_0xd64b('0x1a')](0xcc)[_0xd64b('0x19')]();});}};}function handleEntityNotFound(_0x3baf2e,_0x36a199){return function(_0x298a1c){if(!_0x298a1c){_0x3baf2e[_0xd64b('0x18')](0x194);}return _0x298a1c;};}function handleError(_0x493b35,_0x4309ad){_0x4309ad=_0x4309ad||0x1f4;return function(_0x1a2204){logger[_0xd64b('0x26')](_0x1a2204[_0xd64b('0x27')]);if(_0x1a2204[_0xd64b('0x28')]){delete _0x1a2204['name'];}_0x493b35[_0xd64b('0x1a')](_0x4309ad)[_0xd64b('0x29')](_0x1a2204);};}function getMustacheRender(_0x4a8bcc,_0x4c6caf){return Mustache[_0xd64b('0x2a')](_0x4a8bcc,_[_0xd64b('0x2b')](_0x4c6caf[_0xd64b('0x2c')],{'contact':_0x4c6caf['contact'],'message':_0x4c6caf[_0xd64b('0x2d')],'agent':_0x4c6caf[_0xd64b('0x2e')],'interaction':_0x4c6caf[_0xd64b('0x2f')],'account':_0x4c6caf[_0xd64b('0x30')]}))||'';}exports[_0xd64b('0x31')]=function(_0xc06050,_0x300ef0){var _0x49d9d8={},_0x40a810={},_0x56739c={'count':0x0,'rows':[]};var _0xa5fda3=_['map'](db[_0xd64b('0x32')]['rawAttributes'],function(_0x219832){return{'name':_0x219832[_0xd64b('0x33')],'type':_0x219832['type'][_0xd64b('0x34')]};});_0x40a810[_0xd64b('0x35')]=_[_0xd64b('0x36')](_0xa5fda3,_0xd64b('0x28'));_0x40a810[_0xd64b('0x37')]=_[_0xd64b('0x38')](_0xc06050['query']);_0x40a810[_0xd64b('0x39')]=_[_0xd64b('0x3a')](_0x40a810[_0xd64b('0x35')],_0x40a810[_0xd64b('0x37')]);_0x49d9d8[_0xd64b('0x3b')]=_[_0xd64b('0x3a')](_0x40a810[_0xd64b('0x35')],qs['fields'](_0xc06050[_0xd64b('0x37')]['fields']));_0x49d9d8[_0xd64b('0x3b')]=_0x49d9d8[_0xd64b('0x3b')][_0xd64b('0x3c')]?_0x49d9d8[_0xd64b('0x3b')]:_0x40a810['model'];if(!_0xc06050[_0xd64b('0x37')][_0xd64b('0x3d')]('nolimit')){_0x49d9d8[_0xd64b('0x1c')]=qs['limit'](_0xc06050[_0xd64b('0x37')][_0xd64b('0x1c')]);_0x49d9d8[_0xd64b('0x1f')]=qs[_0xd64b('0x1f')](_0xc06050[_0xd64b('0x37')][_0xd64b('0x1f')]);}_0x49d9d8[_0xd64b('0x3e')]=qs[_0xd64b('0x3f')](_0xc06050[_0xd64b('0x37')][_0xd64b('0x3f')]);_0x49d9d8[_0xd64b('0x40')]=qs[_0xd64b('0x39')](_[_0xd64b('0x41')](_0xc06050[_0xd64b('0x37')],_0x40a810[_0xd64b('0x39')]),_0xa5fda3);if(_0xc06050[_0xd64b('0x37')][_0xd64b('0x42')]){_0x49d9d8['where']=_['merge'](_0x49d9d8[_0xd64b('0x40')],{'$or':_['map'](_0xa5fda3,function(_0x2ae594){if(_0x2ae594['type']!==_0xd64b('0x43')){var _0x3a5330={};_0x3a5330[_0x2ae594['name']]={'$like':'%'+_0xc06050[_0xd64b('0x37')][_0xd64b('0x42')]+'%'};return _0x3a5330;}})});}_0x49d9d8=_[_0xd64b('0x2b')]({},_0x49d9d8,_0xc06050[_0xd64b('0x44')]);var _0x30ebaf={'where':_0x49d9d8[_0xd64b('0x40')]};return db[_0xd64b('0x32')][_0xd64b('0x1e')](_0x30ebaf)[_0xd64b('0x25')](function(_0x423d7d){_0x56739c[_0xd64b('0x1e')]=_0x423d7d;if(_0xc06050[_0xd64b('0x37')]['includeAll']){_0x49d9d8[_0xd64b('0x45')]=[{'all':!![]}];}return db[_0xd64b('0x32')][_0xd64b('0x46')](_0x49d9d8);})[_0xd64b('0x25')](function(_0x49dd00){_0x56739c[_0xd64b('0x47')]=_0x49dd00;return _0x56739c;})['then'](respondWithFilteredResult(_0x300ef0,_0x49d9d8))['catch'](handleError(_0x300ef0,null));};exports['show']=function(_0x5431f1,_0x19592e){var _0xa969d1={'raw':!![],'where':{'id':_0x5431f1[_0xd64b('0x48')]['id']}},_0x4fa91f={};_0x4fa91f[_0xd64b('0x35')]=_[_0xd64b('0x38')](db['ServicenowField'][_0xd64b('0x49')]);_0x4fa91f[_0xd64b('0x37')]=_[_0xd64b('0x38')](_0x5431f1['query']);_0x4fa91f[_0xd64b('0x39')]=_[_0xd64b('0x3a')](_0x4fa91f[_0xd64b('0x35')],_0x4fa91f[_0xd64b('0x37')]);_0xa969d1[_0xd64b('0x3b')]=_['intersection'](_0x4fa91f[_0xd64b('0x35')],qs[_0xd64b('0x4a')](_0x5431f1[_0xd64b('0x37')]['fields']));_0xa969d1[_0xd64b('0x3b')]=_0xa969d1['attributes'][_0xd64b('0x3c')]?_0xa969d1[_0xd64b('0x3b')]:_0x4fa91f[_0xd64b('0x35')];if(_0x5431f1[_0xd64b('0x37')][_0xd64b('0x4b')]){_0xa969d1['include']=[{'all':!![]}];}_0xa969d1=_['merge']({},_0xa969d1,_0x5431f1[_0xd64b('0x44')]);return db['ServicenowField']['find'](_0xa969d1)['then'](handleEntityNotFound(_0x19592e,null))['then'](respondWithResult(_0x19592e,null))[_0xd64b('0x4c')](handleError(_0x19592e,null));};exports['create']=function(_0x548690,_0x25f5d8){return db[_0xd64b('0x32')][_0xd64b('0x4d')](_0x548690[_0xd64b('0x2c')],{})[_0xd64b('0x25')](respondWithResult(_0x25f5d8,0xc9))[_0xd64b('0x4c')](handleError(_0x25f5d8,null));};exports[_0xd64b('0x23')]=function(_0x34037e,_0xa129b6){if(_0x34037e[_0xd64b('0x2c')]['id']){delete _0x34037e['body']['id'];}return db['ServicenowField'][_0xd64b('0x4e')]({'where':{'id':_0x34037e[_0xd64b('0x48')]['id']}})[_0xd64b('0x25')](handleEntityNotFound(_0xa129b6,null))['then'](saveUpdates(_0x34037e[_0xd64b('0x2c')],null))[_0xd64b('0x25')](respondWithResult(_0xa129b6,null))[_0xd64b('0x4c')](handleError(_0xa129b6,null));};exports[_0xd64b('0x24')]=function(_0x5beb84,_0x4876b1){return db[_0xd64b('0x32')][_0xd64b('0x4e')]({'where':{'id':_0x5beb84[_0xd64b('0x48')]['id']}})['then'](handleEntityNotFound(_0x4876b1,null))[_0xd64b('0x25')](removeEntity(_0x4876b1,null))[_0xd64b('0x4c')](handleError(_0x4876b1,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 17d092e..7487ac4 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 _0xbe2f=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','idField','FieldId','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe2f,0x1d3));var _0xfbe2=function(_0x3ec2a4,_0x320b03){_0x3ec2a4=_0x3ec2a4-0x0;var _0x4f546d=_0xbe2f[_0x3ec2a4];return _0x4f546d;};'use strict';var _=require('lodash');var util=require(_0xfbe2('0x0'));var logger=require('../../config/logger')(_0xfbe2('0x1'));var moment=require('moment');var BPromise=require(_0xfbe2('0x2'));var rp=require(_0xfbe2('0x3'));var fs=require('fs');var path=require(_0xfbe2('0x4'));var rimraf=require(_0xfbe2('0x5'));var config=require(_0xfbe2('0x6'));var attributes=require(_0xfbe2('0x7'));module['exports']=function(_0x27dfc2,_0x21ee96){return _0x27dfc2[_0xfbe2('0x8')](_0xfbe2('0x9'),attributes,{'tableName':_0xfbe2('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xfbe2('0xb'),_0xfbe2('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x747f=['rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x143022,_0x58cf55){var _0x34a969=function(_0x1fdbe2){while(--_0x1fdbe2){_0x143022['push'](_0x143022['shift']());}};_0x34a969(++_0x58cf55);}(_0x747f,0x88));var _0xf747=function(_0x193977,_0x36bc62){_0x193977=_0x193977-0x0;var _0x439bd7=_0x747f[_0x193977];return _0x439bd7;};'use strict';var _=require(_0xf747('0x0'));var util=require(_0xf747('0x1'));var logger=require(_0xf747('0x2'))(_0xf747('0x3'));var moment=require(_0xf747('0x4'));var BPromise=require(_0xf747('0x5'));var rp=require(_0xf747('0x6'));var fs=require('fs');var path=require(_0xf747('0x7'));var rimraf=require(_0xf747('0x8'));var config=require(_0xf747('0x9'));var attributes=require(_0xf747('0xa'));module[_0xf747('0xb')]=function(_0x39fb59,_0x4de683){return _0x39fb59[_0xf747('0xc')](_0xf747('0xd'),attributes,{'tableName':_0xf747('0xe'),'paranoid':![],'indexes':[{'name':_0xf747('0xf'),'fields':[_0xf747('0x10'),_0xf747('0x11')],'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 96b4ecd..cbb10bf 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 _0xc02b=['client','http','request','then','ServicenowField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x255e15,_0x22702b){var _0x27d27e=function(_0xfff767){while(--_0xfff767){_0x255e15['push'](_0x255e15['shift']());}};_0x27d27e(++_0x22702b);}(_0xc02b,0x16d));var _0xbc02=function(_0x4a9beb,_0x159482){_0x4a9beb=_0x4a9beb-0x0;var _0x2d4c58=_0xc02b[_0x4a9beb];return _0x2d4c58;};'use strict';var _=require(_0xbc02('0x0'));var util=require(_0xbc02('0x1'));var moment=require(_0xbc02('0x2'));var BPromise=require(_0xbc02('0x3'));var rs=require(_0xbc02('0x4'));var fs=require('fs');var Redis=require(_0xbc02('0x5'));var db=require(_0xbc02('0x6'))['db'];var utils=require(_0xbc02('0x7'));var logger=require(_0xbc02('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbc02('0x9')][_0xbc02('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bcc09,_0x2ad7b9,_0x5a8b5a){return new BPromise(function(_0x73cba5,_0x986288){return client[_0xbc02('0xb')](_0x4bcc09,_0x5a8b5a)[_0xbc02('0xc')](function(_0x449bc5){logger['info'](_0xbc02('0xd'),_0x2ad7b9,_0xbc02('0xe'));logger['debug']('ServicenowField,\x20%s,\x20%s,\x20%s',_0x2ad7b9,_0xbc02('0xe'),JSON[_0xbc02('0xf')](_0x449bc5));if(_0x449bc5[_0xbc02('0x10')]){if(_0x449bc5[_0xbc02('0x10')][_0xbc02('0x11')]===0x1f4){logger[_0xbc02('0x10')](_0xbc02('0xd'),_0x2ad7b9,_0x449bc5[_0xbc02('0x10')][_0xbc02('0x12')]);return _0x986288(_0x449bc5[_0xbc02('0x10')][_0xbc02('0x12')]);}logger[_0xbc02('0x10')](_0xbc02('0xd'),_0x2ad7b9,_0x449bc5[_0xbc02('0x10')][_0xbc02('0x12')]);return _0x73cba5(_0x449bc5['error']['message']);}else{logger[_0xbc02('0x13')](_0xbc02('0xd'),_0x2ad7b9,_0xbc02('0xe'));_0x73cba5(_0x449bc5[_0xbc02('0x14')][_0xbc02('0x12')]);}})[_0xbc02('0x15')](function(_0x439875){logger[_0xbc02('0x10')](_0xbc02('0xd'),_0x2ad7b9,_0x439875);_0x986288(_0x439875);});});} \ No newline at end of file +var _0x54e0=['message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x17b375,_0xa7238c){var _0x1c64cb=function(_0x3e14e){while(--_0x3e14e){_0x17b375['push'](_0x17b375['shift']());}};_0x1c64cb(++_0xa7238c);}(_0x54e0,0x80));var _0x054e=function(_0x4e730b,_0x511ba2){_0x4e730b=_0x4e730b-0x0;var _0xc43d32=_0x54e0[_0x4e730b];return _0xc43d32;};'use strict';var _=require('lodash');var util=require(_0x054e('0x0'));var moment=require(_0x054e('0x1'));var BPromise=require(_0x054e('0x2'));var rs=require(_0x054e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x054e('0x4'))['db'];var utils=require(_0x054e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x054e('0x6'));var jayson=require(_0x054e('0x7'));var client=jayson[_0x054e('0x8')][_0x054e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f23a7,_0x163fba,_0x1f033c){return new BPromise(function(_0x4bf1a2,_0x3a813b){return client[_0x054e('0xa')](_0x3f23a7,_0x1f033c)[_0x054e('0xb')](function(_0x949ece){logger[_0x054e('0xc')](_0x054e('0xd'),_0x163fba,_0x054e('0xe'));logger[_0x054e('0xf')](_0x054e('0x10'),_0x163fba,'request\x20sent',JSON[_0x054e('0x11')](_0x949ece));if(_0x949ece[_0x054e('0x12')]){if(_0x949ece[_0x054e('0x12')]['code']===0x1f4){logger['error'](_0x054e('0xd'),_0x163fba,_0x949ece[_0x054e('0x12')][_0x054e('0x13')]);return _0x3a813b(_0x949ece['error'][_0x054e('0x13')]);}logger[_0x054e('0x12')](_0x054e('0xd'),_0x163fba,_0x949ece[_0x054e('0x12')][_0x054e('0x13')]);return _0x4bf1a2(_0x949ece[_0x054e('0x12')][_0x054e('0x13')]);}else{logger['info'](_0x054e('0xd'),_0x163fba,'request\x20sent');_0x4bf1a2(_0x949ece['result']['message']);}})[_0x054e('0x14')](function(_0x2f2e66){logger[_0x054e('0x12')](_0x054e('0xd'),_0x163fba,_0x2f2e66);_0x3a813b(_0x2f2e66);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 9db48ec..bf3536c 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 _0xef15=['get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','index','/:id','isAuthenticated','show'];(function(_0x4b5ce8,_0x25f0dd){var _0x2bbc3b=function(_0x483638){while(--_0x483638){_0x4b5ce8['push'](_0x4b5ce8['shift']());}};_0x2bbc3b(++_0x25f0dd);}(_0xef15,0x1ee));var _0x5ef1=function(_0x5aca71,_0x583dfa){_0x5aca71=_0x5aca71-0x0;var _0x375f79=_0xef15[_0x5aca71];return _0x375f79;};'use strict';var multer=require('multer');var util=require(_0x5ef1('0x0'));var path=require('path');var timeout=require(_0x5ef1('0x1'));var express=require(_0x5ef1('0x2'));var router=express[_0x5ef1('0x3')]();var fs_extra=require(_0x5ef1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5ef1('0x5'));var config=require(_0x5ef1('0x6'));var controller=require(_0x5ef1('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5ef1('0x8')]);router['get'](_0x5ef1('0x9'),auth[_0x5ef1('0xa')](),controller[_0x5ef1('0xb')]);router[_0x5ef1('0xc')](_0x5ef1('0xd'),auth[_0x5ef1('0xa')](),controller[_0x5ef1('0xe')]);router[_0x5ef1('0xc')](_0x5ef1('0xf'),auth[_0x5ef1('0xa')](),controller[_0x5ef1('0x10')]);router[_0x5ef1('0x11')]('/',auth[_0x5ef1('0xa')](),controller[_0x5ef1('0x12')]);router[_0x5ef1('0x11')](_0x5ef1('0xd'),auth[_0x5ef1('0xa')](),controller[_0x5ef1('0x13')]);router['put'](_0x5ef1('0x9'),auth[_0x5ef1('0xa')](),controller['update']);router[_0x5ef1('0x14')]('/:id',auth[_0x5ef1('0xa')](),controller[_0x5ef1('0x15')]);module[_0x5ef1('0x16')]=router; \ No newline at end of file +var _0x4e07=['/:id','isAuthenticated','show','/:id/configurations','/:id/fields','create','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','index'];(function(_0x43c7b1,_0x3cda06){var _0x585cfe=function(_0x442bae){while(--_0x442bae){_0x43c7b1['push'](_0x43c7b1['shift']());}};_0x585cfe(++_0x3cda06);}(_0x4e07,0x84));var _0x74e0=function(_0x2ed1aa,_0x3b18e2){_0x2ed1aa=_0x2ed1aa-0x0;var _0x108e12=_0x4e07[_0x2ed1aa];return _0x108e12;};'use strict';var multer=require(_0x74e0('0x0'));var util=require(_0x74e0('0x1'));var path=require(_0x74e0('0x2'));var timeout=require(_0x74e0('0x3'));var express=require(_0x74e0('0x4'));var router=express[_0x74e0('0x5')]();var fs_extra=require(_0x74e0('0x6'));var auth=require(_0x74e0('0x7'));var interaction=require(_0x74e0('0x8'));var config=require('../../config/environment');var controller=require(_0x74e0('0x9'));router[_0x74e0('0xa')]('/',auth['isAuthenticated'](),controller[_0x74e0('0xb')]);router[_0x74e0('0xa')](_0x74e0('0xc'),auth[_0x74e0('0xd')](),controller[_0x74e0('0xe')]);router[_0x74e0('0xa')](_0x74e0('0xf'),auth[_0x74e0('0xd')](),controller['getConfigurations']);router[_0x74e0('0xa')](_0x74e0('0x10'),auth[_0x74e0('0xd')](),controller['getFields']);router['post']('/',auth[_0x74e0('0xd')](),controller[_0x74e0('0x11')]);router[_0x74e0('0x12')](_0x74e0('0xf'),auth[_0x74e0('0xd')](),controller['addConfiguration']);router[_0x74e0('0x13')](_0x74e0('0xc'),auth[_0x74e0('0xd')](),controller[_0x74e0('0x14')]);router[_0x74e0('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x74e0('0x16')]);module[_0x74e0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 1df06eb..ffc0be3 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 _0x5754=['remoteUri','STRING','username'];(function(_0x5d4f12,_0x4c59c8){var _0x4791b3=function(_0x40e593){while(--_0x40e593){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4791b3(++_0x4c59c8);}(_0x5754,0xd6));var _0x4575=function(_0x523b88,_0x4bb314){_0x523b88=_0x523b88-0x0;var _0x42f951=_0x5754[_0x523b88];return _0x42f951;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4575('0x0')]},'description':{'type':Sequelize[_0x4575('0x0')]},'username':{'type':Sequelize[_0x4575('0x0')],'unique':_0x4575('0x1')},'password':{'type':Sequelize[_0x4575('0x0')]},'remoteUri':{'type':Sequelize[_0x4575('0x0')],'unique':_0x4575('0x2')},'serverUrl':{'type':Sequelize[_0x4575('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x1153=['exports','STRING'];(function(_0x1b07e8,_0x3616c9){var _0x1dece9=function(_0x16ecd8){while(--_0x16ecd8){_0x1b07e8['push'](_0x1b07e8['shift']());}};_0x1dece9(++_0x3616c9);}(_0x1153,0x150));var _0x3115=function(_0x261137,_0x5c213e){_0x261137=_0x261137-0x0;var _0x378466=_0x1153[_0x261137];return _0x378466;};'use strict';var Sequelize=require('sequelize');module[_0x3115('0x0')]={'name':{'type':Sequelize[_0x3115('0x1')]},'description':{'type':Sequelize[_0x3115('0x1')]},'username':{'type':Sequelize[_0x3115('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x3115('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index eb1c92e..8c86472 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 _0x7da5=['Calls','values','module_fields','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','destroy','name','send','render','merge','body','contact','agent','interaction','index','map','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','SugarcrmAccount','includeAll','findAll','rows','show','params','keys','find','create','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','getSubjects','channel','getDescriptions','SugarcrmField','Subjects','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','format','/service/v4_1/rest.php','login','JSON','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7da5,0x119));var _0x57da=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7da5[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57da('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x57da('0x1'));var moment=require(_0x57da('0x2'));var BPromise=require(_0x57da('0x3'));var Mustache=require(_0x57da('0x4'));var util=require('util');var path=require('path');var sox=require(_0x57da('0x5'));var csv=require(_0x57da('0x6'));var ejs=require(_0x57da('0x7'));var fs=require('fs');var fs_extra=require(_0x57da('0x8'));var _=require(_0x57da('0x9'));var squel=require(_0x57da('0xa'));var crypto=require('crypto');var jsforce=require(_0x57da('0xb'));var deskjs=require(_0x57da('0xc'));var toCsv=require(_0x57da('0x6'));var querystring=require(_0x57da('0xd'));var Papa=require(_0x57da('0xe'));var Redis=require(_0x57da('0xf'));var authService=require(_0x57da('0x10'));var qs=require(_0x57da('0x11'));var as=require(_0x57da('0x12'));var hardwareService=require(_0x57da('0x13'));var logger=require(_0x57da('0x14'))(_0x57da('0x15'));var utils=require(_0x57da('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x57da('0x17'));var db=require(_0x57da('0x18'))['db'];var integrations=require(_0x57da('0x19'));var jayson=require(_0x57da('0x1a'));var client=jayson[_0x57da('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x366749,_0xefd205,_0xf29de1,_0x297227){return new BPromise(function(_0x556651,_0x2f5e4a){var _0x129291=_0x297227||client;return _0x129291['request'](_0x366749,_0xf29de1)[_0x57da('0x1c')](function(_0x437f3f){logger[_0x57da('0x1d')](_0x57da('0x1e'),_0xefd205,_0x57da('0x1f'));logger[_0x57da('0x20')](_0x57da('0x21'),_0xefd205,'request\x20sent',JSON['stringify'](_0x437f3f));if(_0x437f3f[_0x57da('0x22')]){if(_0x437f3f[_0x57da('0x22')]['code']===0x1f4){logger['error'](_0x57da('0x1e'),_0xefd205,_0x437f3f[_0x57da('0x22')][_0x57da('0x23')]);return _0x2f5e4a(_0x437f3f[_0x57da('0x22')][_0x57da('0x23')]);}logger[_0x57da('0x22')]('SugarcrmAccount,\x20%s,\x20%s',_0xefd205,_0x437f3f['error'][_0x57da('0x23')]);return _0x556651(_0x437f3f[_0x57da('0x22')]['message']);}else{logger['info'](_0x57da('0x1e'),_0xefd205,_0x57da('0x1f'));_0x556651(_0x437f3f[_0x57da('0x24')][_0x57da('0x23')]);}})[_0x57da('0x25')](function(_0x33caf8){logger[_0x57da('0x22')](_0x57da('0x1e'),_0xefd205,_0x33caf8);_0x2f5e4a(_0x33caf8);});});}function respondWithStatusCode(_0x3d41ff,_0x5e1eca){_0x5e1eca=_0x5e1eca||0xcc;return function(_0x5f4cbc){if(_0x5f4cbc){return _0x3d41ff[_0x57da('0x26')](_0x5e1eca);}return _0x3d41ff[_0x57da('0x27')](_0x5e1eca)[_0x57da('0x28')]();};}function respondWithResult(_0x495a6f,_0x12f387){_0x12f387=_0x12f387||0xc8;return function(_0x1aa862){if(_0x1aa862){return _0x495a6f[_0x57da('0x27')](_0x12f387)[_0x57da('0x29')](_0x1aa862);}};}function respondWithFilteredResult(_0x38a6ac,_0x6f28e2){return function(_0x1ed9f9){if(_0x1ed9f9){var _0x45b2a0=typeof _0x6f28e2[_0x57da('0x2a')]==='undefined'&&typeof _0x6f28e2['limit']==='undefined';var _0x127a17=_0x1ed9f9[_0x57da('0x2b')];var _0x2b4681=_0x45b2a0?0x0:_0x6f28e2[_0x57da('0x2a')];var _0x35316d=_0x45b2a0?_0x1ed9f9[_0x57da('0x2b')]:_0x6f28e2[_0x57da('0x2a')]+_0x6f28e2[_0x57da('0x2c')];var _0x440b1e;if(_0x35316d>=_0x127a17){_0x35316d=_0x127a17;_0x440b1e=0xc8;}else{_0x440b1e=0xce;}_0x38a6ac[_0x57da('0x27')](_0x440b1e);return _0x38a6ac[_0x57da('0x2d')](_0x57da('0x2e'),_0x2b4681+'-'+_0x35316d+'/'+_0x127a17)[_0x57da('0x29')](_0x1ed9f9);}return null;};}function patchUpdates(_0x509c4c){return function(_0x107744){try{jsonpatch[_0x57da('0x2f')](_0x107744,_0x509c4c,!![]);}catch(_0x3d358a){return BPromise[_0x57da('0x30')](_0x3d358a);}return _0x107744['save']();};}function saveUpdates(_0x1ea477,_0x12ca99){return function(_0x4083d6){if(_0x4083d6){return _0x4083d6[_0x57da('0x31')](_0x1ea477)[_0x57da('0x1c')](function(_0x41d4e9){return _0x41d4e9;});}return null;};}function removeEntity(_0x14c679,_0x2b1b5e){return function(_0x42230e){if(_0x42230e){return _0x42230e[_0x57da('0x32')]()[_0x57da('0x1c')](function(){_0x14c679[_0x57da('0x27')](0xcc)[_0x57da('0x28')]();});}};}function handleEntityNotFound(_0x20e542,_0x2a8e09){return function(_0x1100e2){if(!_0x1100e2){_0x20e542[_0x57da('0x26')](0x194);}return _0x1100e2;};}function handleError(_0x4dcfb3,_0x479f65){_0x479f65=_0x479f65||0x1f4;return function(_0x121c7d){logger[_0x57da('0x22')](_0x121c7d['stack']);if(_0x121c7d[_0x57da('0x33')]){delete _0x121c7d[_0x57da('0x33')];}_0x4dcfb3['status'](_0x479f65)[_0x57da('0x34')](_0x121c7d);};}function getMustacheRender(_0x1d86b7,_0x53bd1d){return Mustache[_0x57da('0x35')](_0x1d86b7,_[_0x57da('0x36')](_0x53bd1d[_0x57da('0x37')],{'contact':_0x53bd1d[_0x57da('0x38')],'message':_0x53bd1d[_0x57da('0x23')],'agent':_0x53bd1d[_0x57da('0x39')],'interaction':_0x53bd1d[_0x57da('0x3a')],'account':_0x53bd1d['account']}))||'';}exports[_0x57da('0x3b')]=function(_0x5c44c2,_0x30792b){var _0x235c46={},_0x44cb47={},_0x1f3c91={'count':0x0,'rows':[]};var _0xe3595d=_[_0x57da('0x3c')](db['SugarcrmAccount'][_0x57da('0x3d')],function(_0x1c2db1){return{'name':_0x1c2db1[_0x57da('0x3e')],'type':_0x1c2db1[_0x57da('0x3f')]['key']};});_0x44cb47[_0x57da('0x40')]=_[_0x57da('0x3c')](_0xe3595d,'name');_0x44cb47[_0x57da('0x41')]=_['keys'](_0x5c44c2[_0x57da('0x41')]);_0x44cb47['filters']=_[_0x57da('0x42')](_0x44cb47['model'],_0x44cb47['query']);_0x235c46['attributes']=_[_0x57da('0x42')](_0x44cb47[_0x57da('0x40')],qs[_0x57da('0x43')](_0x5c44c2['query'][_0x57da('0x43')]));_0x235c46[_0x57da('0x44')]=_0x235c46['attributes'][_0x57da('0x45')]?_0x235c46[_0x57da('0x44')]:_0x44cb47[_0x57da('0x40')];if(!_0x5c44c2[_0x57da('0x41')][_0x57da('0x46')](_0x57da('0x47'))){_0x235c46[_0x57da('0x2c')]=qs['limit'](_0x5c44c2[_0x57da('0x41')][_0x57da('0x2c')]);_0x235c46[_0x57da('0x2a')]=qs['offset'](_0x5c44c2[_0x57da('0x41')][_0x57da('0x2a')]);}_0x235c46[_0x57da('0x48')]=qs[_0x57da('0x49')](_0x5c44c2['query'][_0x57da('0x49')]);_0x235c46[_0x57da('0x4a')]=qs['filters'](_[_0x57da('0x4b')](_0x5c44c2[_0x57da('0x41')],_0x44cb47[_0x57da('0x4c')]),_0xe3595d);if(_0x5c44c2[_0x57da('0x41')][_0x57da('0x4d')]){_0x235c46['where']=_['merge'](_0x235c46[_0x57da('0x4a')],{'$or':_['map'](_0xe3595d,function(_0x5c5cde){if(_0x5c5cde['type']!==_0x57da('0x4e')){var _0x301b3c={};_0x301b3c[_0x5c5cde[_0x57da('0x33')]]={'$like':'%'+_0x5c44c2['query'][_0x57da('0x4d')]+'%'};return _0x301b3c;}})});}_0x235c46=_[_0x57da('0x36')]({},_0x235c46,_0x5c44c2[_0x57da('0x4f')]);var _0x2e5553={'where':_0x235c46['where']};return db[_0x57da('0x50')][_0x57da('0x2b')](_0x2e5553)['then'](function(_0x3eb24f){_0x1f3c91['count']=_0x3eb24f;if(_0x5c44c2[_0x57da('0x41')][_0x57da('0x51')]){_0x235c46['include']=[{'all':!![]}];}return db[_0x57da('0x50')][_0x57da('0x52')](_0x235c46);})[_0x57da('0x1c')](function(_0x424c46){_0x1f3c91[_0x57da('0x53')]=_0x424c46;return _0x1f3c91;})[_0x57da('0x1c')](respondWithFilteredResult(_0x30792b,_0x235c46))[_0x57da('0x25')](handleError(_0x30792b,null));};exports[_0x57da('0x54')]=function(_0x266a6e,_0x4c7503){var _0x4c9dbb={'raw':![],'where':{'id':_0x266a6e[_0x57da('0x55')]['id']}},_0x1f83d3={};_0x1f83d3[_0x57da('0x40')]=_[_0x57da('0x56')](db[_0x57da('0x50')][_0x57da('0x3d')]);_0x1f83d3['query']=_[_0x57da('0x56')](_0x266a6e[_0x57da('0x41')]);_0x1f83d3[_0x57da('0x4c')]=_[_0x57da('0x42')](_0x1f83d3['model'],_0x1f83d3[_0x57da('0x41')]);_0x4c9dbb[_0x57da('0x44')]=_[_0x57da('0x42')](_0x1f83d3['model'],qs[_0x57da('0x43')](_0x266a6e[_0x57da('0x41')][_0x57da('0x43')]));_0x4c9dbb['attributes']=_0x4c9dbb[_0x57da('0x44')][_0x57da('0x45')]?_0x4c9dbb[_0x57da('0x44')]:_0x1f83d3['model'];if(_0x266a6e[_0x57da('0x41')][_0x57da('0x51')]){_0x4c9dbb['include']=[{'all':!![]}];}_0x4c9dbb=_[_0x57da('0x36')]({},_0x4c9dbb,_0x266a6e[_0x57da('0x4f')]);return db[_0x57da('0x50')][_0x57da('0x57')](_0x4c9dbb)[_0x57da('0x1c')](handleEntityNotFound(_0x4c7503,null))['then'](respondWithResult(_0x4c7503,null))[_0x57da('0x25')](handleError(_0x4c7503,null));};exports[_0x57da('0x58')]=function(_0x227142,_0x7cad3c){return db[_0x57da('0x50')][_0x57da('0x58')](_0x227142['body'],{})[_0x57da('0x1c')](respondWithResult(_0x7cad3c,0xc9))[_0x57da('0x25')](handleError(_0x7cad3c,null));};exports[_0x57da('0x31')]=function(_0xcd1261,_0x117e80){if(_0xcd1261[_0x57da('0x37')]['id']){delete _0xcd1261['body']['id'];}return db[_0x57da('0x50')][_0x57da('0x57')]({'where':{'id':_0xcd1261[_0x57da('0x55')]['id']}})[_0x57da('0x1c')](handleEntityNotFound(_0x117e80,null))['then'](saveUpdates(_0xcd1261[_0x57da('0x37')],null))[_0x57da('0x1c')](respondWithResult(_0x117e80,null))[_0x57da('0x25')](handleError(_0x117e80,null));};exports[_0x57da('0x32')]=function(_0x51d24e,_0x4cbf40){return db['SugarcrmAccount'][_0x57da('0x57')]({'where':{'id':_0x51d24e['params']['id']}})['then'](handleEntityNotFound(_0x4cbf40,null))[_0x57da('0x1c')](removeEntity(_0x4cbf40,null))[_0x57da('0x25')](handleError(_0x4cbf40,null));};exports[_0x57da('0x59')]=function(_0x498859,_0x29186a,_0x222675){var _0x337e6a={};var _0x343e31={};var _0x5ca145;var _0x49ff2e;return db[_0x57da('0x50')][_0x57da('0x5a')]({'where':{'id':_0x498859[_0x57da('0x55')]['id']}})[_0x57da('0x1c')](handleEntityNotFound(_0x29186a,null))[_0x57da('0x1c')](function(_0x301339){if(_0x301339){_0x5ca145=_0x301339;_0x343e31['model']=_[_0x57da('0x56')](db[_0x57da('0x5b')][_0x57da('0x3d')]);_0x343e31[_0x57da('0x41')]=_[_0x57da('0x56')](_0x498859[_0x57da('0x41')]);_0x343e31[_0x57da('0x4c')]=_[_0x57da('0x42')](_0x343e31[_0x57da('0x40')],_0x343e31[_0x57da('0x41')]);_0x337e6a[_0x57da('0x44')]=_[_0x57da('0x42')](_0x343e31['model'],qs['fields'](_0x498859[_0x57da('0x41')]['fields']));_0x337e6a[_0x57da('0x44')]=_0x337e6a['attributes']['length']?_0x337e6a['attributes']:_0x343e31[_0x57da('0x40')];_0x337e6a[_0x57da('0x48')]=qs[_0x57da('0x49')](_0x498859[_0x57da('0x41')][_0x57da('0x49')]);_0x337e6a[_0x57da('0x4a')]=qs[_0x57da('0x4c')](_[_0x57da('0x4b')](_0x498859[_0x57da('0x41')],_0x343e31['filters']));if(_0x498859[_0x57da('0x41')][_0x57da('0x4d')]){_0x337e6a['where']=_[_0x57da('0x36')](_0x337e6a[_0x57da('0x4a')],{'$or':_['map'](_0x337e6a[_0x57da('0x44')],function(_0x51cedc){var _0x28fbcc={};_0x28fbcc[_0x51cedc]={'$like':'%'+_0x498859[_0x57da('0x41')][_0x57da('0x4d')]+'%'};return _0x28fbcc;})});}_0x337e6a=_[_0x57da('0x36')]({},_0x337e6a,_0x498859[_0x57da('0x4f')]);return _0x5ca145['getConfigurations'](_0x337e6a);}})['then'](function(_0x1bccae){if(_0x1bccae){_0x49ff2e=_0x1bccae[_0x57da('0x45')];if(!_0x498859['query']['hasOwnProperty'](_0x57da('0x47'))){_0x337e6a[_0x57da('0x2c')]=qs['limit'](_0x498859[_0x57da('0x41')][_0x57da('0x2c')]);_0x337e6a['offset']=qs[_0x57da('0x2a')](_0x498859[_0x57da('0x41')][_0x57da('0x2a')]);}return _0x5ca145[_0x57da('0x59')](_0x337e6a);}})[_0x57da('0x1c')](function(_0x1234bd){if(_0x1234bd){return _0x1234bd?{'count':_0x49ff2e,'rows':_0x1234bd}:null;}})[_0x57da('0x1c')](respondWithResult(_0x29186a,null))[_0x57da('0x25')](handleError(_0x29186a,null));};exports[_0x57da('0x5c')]=function(_0x3b7db8,_0x47e01e,_0x29ce21){if(_0x3b7db8[_0x57da('0x37')]['id']){delete _0x3b7db8['body']['id'];}return db[_0x57da('0x50')][_0x57da('0x5a')]({'where':{'id':_0x3b7db8[_0x57da('0x55')]['id']}})['then'](handleEntityNotFound(_0x47e01e,null))[_0x57da('0x1c')](function(_0x23d651){if(_0x23d651){_0x3b7db8['body'][_0x57da('0x5d')]=_0x23d651['id'];_0x3b7db8[_0x57da('0x37')]['Subjects']=integrations[_0x57da('0x5e')](_0x3b7db8[_0x57da('0x37')][_0x57da('0x5f')],_0x3b7db8[_0x57da('0x37')][_0x57da('0x3f')]);_0x3b7db8[_0x57da('0x37')]['Descriptions']=integrations[_0x57da('0x60')](_0x3b7db8[_0x57da('0x37')]['channel'],_0x3b7db8[_0x57da('0x37')][_0x57da('0x3f')]);return db[_0x57da('0x5b')]['create'](_0x3b7db8[_0x57da('0x37')],{'include':[{'model':db[_0x57da('0x61')],'as':_0x57da('0x62')},{'model':db['SugarcrmField'],'as':_0x57da('0x63')}]});}return null;})[_0x57da('0x1c')](respondWithResult(_0x47e01e,null))[_0x57da('0x25')](handleError(_0x47e01e,null));};exports[_0x57da('0x64')]=function(_0x49cc68,_0x88a832,_0x324bab){var _0x436bc3='';var _0x955a32=['id',_0x57da('0x33'),_0x57da('0x65'),_0x57da('0x66'),_0x57da('0x67'),_0x57da('0x68'),_0x57da('0x69'),_0x57da('0x6a'),'parent_id',_0x57da('0x6b'),_0x57da('0x6c'),_0x57da('0x6d')];return db['SugarcrmAccount'][_0x57da('0x5a')]({'where':{'id':_0x49cc68[_0x57da('0x55')]['id']},'attributes':['id',_0x57da('0x6e'),_0x57da('0x6f'),'remoteUri']})[_0x57da('0x1c')](handleEntityNotFound(_0x88a832,null))[_0x57da('0x1c')](function(_0x4e86ff){if(_0x4e86ff){_0x436bc3=_0x4e86ff[_0x57da('0x70')];var _0x5a1103=_0x436bc3[_0x57da('0x71')](-0x1);if(_0x5a1103==='/'){_0x436bc3=_0x436bc3[_0x57da('0x72')](0x0,_0x436bc3['lastIndexOf'](_0x5a1103));}return rp({'method':'POST','uri':util[_0x57da('0x73')]('%s%s',_0x436bc3,_0x57da('0x74')),'json':!![],'form':{'method':_0x57da('0x75'),'input_type':_0x57da('0x76'),'response_type':_0x57da('0x76'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4e86ff[_0x57da('0x6e')],'password':_0x4e86ff[_0x57da('0x6f')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x57da('0x1c')](function(_0x6eb346){if(_0x6eb346&&_0x6eb346[_0x57da('0x33')]!==_0x57da('0x77')&&_0x6eb346[_0x57da('0x33')]!==_0x57da('0x78')){return rp({'method':'POST','uri':util[_0x57da('0x73')](_0x57da('0x79'),_0x436bc3,_0x57da('0x74')),'json':!![],'form':{'method':_0x57da('0x7a'),'input_type':_0x57da('0x76'),'response_type':_0x57da('0x76'),'rest_data':JSON[_0x57da('0x7b')]({'session':_0x6eb346['id'],'module_name':_0x57da('0x7c')})}})[_0x57da('0x1c')](function(_0x1ee8d8){if(_0x1ee8d8){var _0x25f56e=_[_0x57da('0x7d')](_0x1ee8d8[_0x57da('0x7e')]);_['remove'](_0x25f56e,function(_0x27c920){return _0x955a32[_0x57da('0x7f')](_0x27c920[_0x57da('0x33')]);});return{'count':_0x25f56e[_0x57da('0x45')],'rows':_[_0x57da('0x3c')](_0x25f56e,function(_0x3e1cc7){return{'id':_0x3e1cc7[_0x57da('0x33')],'name':_0x3e1cc7[_0x57da('0x80')],'custom':_[_0x57da('0x81')](_0x3e1cc7[_0x57da('0x33')],'_c')?!![]:![],'options':_0x3e1cc7[_0x57da('0x4f')]?_[_0x57da('0x3c')](_['values'](_0x3e1cc7[_0x57da('0x4f')]),function(_0x280193){return{'name':_0x280193[_0x57da('0x82')],'value':_0x280193[_0x57da('0x33')]};}):[]};})};}})[_0x57da('0x1c')](respondWithResult(_0x88a832,null))[_0x57da('0x25')](function(_0x3a2583){var _0x4decfe=_0x49cc68[_0x57da('0x41')]['test']?0x1f4:_0x3a2583[_0x57da('0x83')]||0x1f4;logger['error'](_0x57da('0x84'),_0x57da('0x64'),_0x4decfe,JSON[_0x57da('0x7b')](_0x3a2583));delete _0x3a2583['name'];if(_0x4decfe===0x191){_0x4decfe=0x190;}_0x88a832[_0x57da('0x27')](_0x4decfe)[_0x57da('0x34')](_0x49cc68[_0x57da('0x41')][_0x57da('0x85')]?{'message':_0x57da('0x86'),'statusCode':_0x3a2583[_0x57da('0x83')]}:_0x3a2583);});}else{var _0x24d377=0x1f4;_0x88a832[_0x57da('0x27')](_0x24d377)['send']({'message':_0x57da('0x86'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x59a8=['values','module_fields','includes','label','endsWith','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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','../../mysqldb','../../components/integrations/configuration','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','destroy','end','stack','name','send','merge','body','contact','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','include','findAll','rows','params','keys','includeAll','options','create','find','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','format','/service/v4_1/rest.php','login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','stringify'];(function(_0x4c5b40,_0x415615){var _0x2317a5=function(_0x13b039){while(--_0x13b039){_0x4c5b40['push'](_0x4c5b40['shift']());}};_0x2317a5(++_0x415615);}(_0x59a8,0x111));var _0x859a=function(_0x5a1f5e,_0x75f621){_0x5a1f5e=_0x5a1f5e-0x0;var _0x36b860=_0x59a8[_0x5a1f5e];return _0x36b860;};'use strict';var emlformat=require(_0x859a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x859a('0x1'));var jsonpatch=require(_0x859a('0x2'));var rp=require(_0x859a('0x3'));var moment=require('moment');var BPromise=require(_0x859a('0x4'));var Mustache=require(_0x859a('0x5'));var util=require(_0x859a('0x6'));var path=require(_0x859a('0x7'));var sox=require('sox');var csv=require(_0x859a('0x8'));var ejs=require(_0x859a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x859a('0xa'));var squel=require(_0x859a('0xb'));var crypto=require(_0x859a('0xc'));var jsforce=require(_0x859a('0xd'));var deskjs=require(_0x859a('0xe'));var toCsv=require(_0x859a('0x8'));var querystring=require('querystring');var Papa=require(_0x859a('0xf'));var Redis=require('ioredis');var authService=require(_0x859a('0x10'));var qs=require(_0x859a('0x11'));var as=require(_0x859a('0x12'));var hardwareService=require(_0x859a('0x13'));var logger=require(_0x859a('0x14'))(_0x859a('0x15'));var utils=require(_0x859a('0x16'));var config=require(_0x859a('0x17'));var licenseUtil=require(_0x859a('0x18'));var db=require(_0x859a('0x19'))['db'];var integrations=require(_0x859a('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0x859a('0x1b')][_0x859a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x38ffe9,_0x2a282d,_0x4fca6b,_0x28784a){return new BPromise(function(_0x25a44f,_0x3881a1){var _0x3ba3f3=_0x28784a||client;return _0x3ba3f3[_0x859a('0x1d')](_0x38ffe9,_0x4fca6b)[_0x859a('0x1e')](function(_0x5445b8){logger['info'](_0x859a('0x1f'),_0x2a282d,_0x859a('0x20'));logger['debug'](_0x859a('0x21'),_0x2a282d,_0x859a('0x20'),JSON['stringify'](_0x5445b8));if(_0x5445b8['error']){if(_0x5445b8[_0x859a('0x22')]['code']===0x1f4){logger['error'](_0x859a('0x1f'),_0x2a282d,_0x5445b8[_0x859a('0x22')][_0x859a('0x23')]);return _0x3881a1(_0x5445b8['error'][_0x859a('0x23')]);}logger[_0x859a('0x22')](_0x859a('0x1f'),_0x2a282d,_0x5445b8['error'][_0x859a('0x23')]);return _0x25a44f(_0x5445b8[_0x859a('0x22')]['message']);}else{logger[_0x859a('0x24')](_0x859a('0x1f'),_0x2a282d,_0x859a('0x20'));_0x25a44f(_0x5445b8[_0x859a('0x25')][_0x859a('0x23')]);}})[_0x859a('0x26')](function(_0x5a5e00){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x2a282d,_0x5a5e00);_0x3881a1(_0x5a5e00);});});}function respondWithStatusCode(_0x5b6d27,_0x1880b5){_0x1880b5=_0x1880b5||0xcc;return function(_0x25c8f1){if(_0x25c8f1){return _0x5b6d27[_0x859a('0x27')](_0x1880b5);}return _0x5b6d27[_0x859a('0x28')](_0x1880b5)['end']();};}function respondWithResult(_0x11b3c3,_0x10072d){_0x10072d=_0x10072d||0xc8;return function(_0x1ff67e){if(_0x1ff67e){return _0x11b3c3[_0x859a('0x28')](_0x10072d)['json'](_0x1ff67e);}};}function respondWithFilteredResult(_0x5c1d96,_0x75a536){return function(_0x4846e1){if(_0x4846e1){var _0x2e4a3b=typeof _0x75a536[_0x859a('0x29')]===_0x859a('0x2a')&&typeof _0x75a536[_0x859a('0x2b')]===_0x859a('0x2a');var _0x5300f9=_0x4846e1[_0x859a('0x2c')];var _0x4853f8=_0x2e4a3b?0x0:_0x75a536['offset'];var _0x133427=_0x2e4a3b?_0x4846e1['count']:_0x75a536[_0x859a('0x29')]+_0x75a536[_0x859a('0x2b')];var _0x450e0f;if(_0x133427>=_0x5300f9){_0x133427=_0x5300f9;_0x450e0f=0xc8;}else{_0x450e0f=0xce;}_0x5c1d96[_0x859a('0x28')](_0x450e0f);return _0x5c1d96['set'](_0x859a('0x2d'),_0x4853f8+'-'+_0x133427+'/'+_0x5300f9)[_0x859a('0x2e')](_0x4846e1);}return null;};}function patchUpdates(_0x1fd3cd){return function(_0x28294b){try{jsonpatch[_0x859a('0x2f')](_0x28294b,_0x1fd3cd,!![]);}catch(_0x91e20b){return BPromise['reject'](_0x91e20b);}return _0x28294b[_0x859a('0x30')]();};}function saveUpdates(_0x4545d2,_0x1be2e0){return function(_0x3004a3){if(_0x3004a3){return _0x3004a3[_0x859a('0x31')](_0x4545d2)[_0x859a('0x1e')](function(_0x363bd7){return _0x363bd7;});}return null;};}function removeEntity(_0x208ce0,_0x4aa13b){return function(_0xa917a6){if(_0xa917a6){return _0xa917a6[_0x859a('0x32')]()['then'](function(){_0x208ce0[_0x859a('0x28')](0xcc)[_0x859a('0x33')]();});}};}function handleEntityNotFound(_0x340742,_0x2cb3d1){return function(_0x206991){if(!_0x206991){_0x340742[_0x859a('0x27')](0x194);}return _0x206991;};}function handleError(_0x36bfb9,_0x13c525){_0x13c525=_0x13c525||0x1f4;return function(_0x9b10b1){logger[_0x859a('0x22')](_0x9b10b1[_0x859a('0x34')]);if(_0x9b10b1[_0x859a('0x35')]){delete _0x9b10b1[_0x859a('0x35')];}_0x36bfb9[_0x859a('0x28')](_0x13c525)[_0x859a('0x36')](_0x9b10b1);};}function getMustacheRender(_0x3e224a,_0x53fdc2){return Mustache['render'](_0x3e224a,_[_0x859a('0x37')](_0x53fdc2[_0x859a('0x38')],{'contact':_0x53fdc2[_0x859a('0x39')],'message':_0x53fdc2[_0x859a('0x23')],'agent':_0x53fdc2['agent'],'interaction':_0x53fdc2['interaction'],'account':_0x53fdc2['account']}))||'';}exports[_0x859a('0x3a')]=function(_0x36a2a5,_0x108e85){var _0x5b59d4={},_0x526834={},_0x282907={'count':0x0,'rows':[]};var _0x5e7a74=_[_0x859a('0x3b')](db[_0x859a('0x3c')][_0x859a('0x3d')],function(_0x55138e){return{'name':_0x55138e[_0x859a('0x3e')],'type':_0x55138e[_0x859a('0x3f')][_0x859a('0x40')]};});_0x526834[_0x859a('0x41')]=_[_0x859a('0x3b')](_0x5e7a74,'name');_0x526834[_0x859a('0x42')]=_['keys'](_0x36a2a5[_0x859a('0x42')]);_0x526834['filters']=_[_0x859a('0x43')](_0x526834[_0x859a('0x41')],_0x526834['query']);_0x5b59d4[_0x859a('0x44')]=_[_0x859a('0x43')](_0x526834[_0x859a('0x41')],qs[_0x859a('0x45')](_0x36a2a5[_0x859a('0x42')][_0x859a('0x45')]));_0x5b59d4[_0x859a('0x44')]=_0x5b59d4[_0x859a('0x44')][_0x859a('0x46')]?_0x5b59d4[_0x859a('0x44')]:_0x526834['model'];if(!_0x36a2a5[_0x859a('0x42')][_0x859a('0x47')](_0x859a('0x48'))){_0x5b59d4[_0x859a('0x2b')]=qs['limit'](_0x36a2a5[_0x859a('0x42')][_0x859a('0x2b')]);_0x5b59d4[_0x859a('0x29')]=qs[_0x859a('0x29')](_0x36a2a5[_0x859a('0x42')][_0x859a('0x29')]);}_0x5b59d4[_0x859a('0x49')]=qs[_0x859a('0x4a')](_0x36a2a5[_0x859a('0x42')][_0x859a('0x4a')]);_0x5b59d4[_0x859a('0x4b')]=qs[_0x859a('0x4c')](_[_0x859a('0x4d')](_0x36a2a5[_0x859a('0x42')],_0x526834[_0x859a('0x4c')]),_0x5e7a74);if(_0x36a2a5['query'][_0x859a('0x4e')]){_0x5b59d4[_0x859a('0x4b')]=_[_0x859a('0x37')](_0x5b59d4[_0x859a('0x4b')],{'$or':_['map'](_0x5e7a74,function(_0x1b62ad){if(_0x1b62ad[_0x859a('0x3f')]!==_0x859a('0x4f')){var _0x9ad66d={};_0x9ad66d[_0x1b62ad[_0x859a('0x35')]]={'$like':'%'+_0x36a2a5[_0x859a('0x42')][_0x859a('0x4e')]+'%'};return _0x9ad66d;}})});}_0x5b59d4=_[_0x859a('0x37')]({},_0x5b59d4,_0x36a2a5['options']);var _0x4d9619={'where':_0x5b59d4[_0x859a('0x4b')]};return db[_0x859a('0x3c')][_0x859a('0x2c')](_0x4d9619)[_0x859a('0x1e')](function(_0x4fe248){_0x282907[_0x859a('0x2c')]=_0x4fe248;if(_0x36a2a5['query']['includeAll']){_0x5b59d4[_0x859a('0x50')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x859a('0x51')](_0x5b59d4);})['then'](function(_0x82195a){_0x282907[_0x859a('0x52')]=_0x82195a;return _0x282907;})[_0x859a('0x1e')](respondWithFilteredResult(_0x108e85,_0x5b59d4))[_0x859a('0x26')](handleError(_0x108e85,null));};exports['show']=function(_0x479599,_0x3b2585){var _0x555c59={'raw':![],'where':{'id':_0x479599[_0x859a('0x53')]['id']}},_0x5e82c2={};_0x5e82c2[_0x859a('0x41')]=_['keys'](db[_0x859a('0x3c')][_0x859a('0x3d')]);_0x5e82c2[_0x859a('0x42')]=_[_0x859a('0x54')](_0x479599[_0x859a('0x42')]);_0x5e82c2[_0x859a('0x4c')]=_[_0x859a('0x43')](_0x5e82c2[_0x859a('0x41')],_0x5e82c2[_0x859a('0x42')]);_0x555c59[_0x859a('0x44')]=_[_0x859a('0x43')](_0x5e82c2['model'],qs['fields'](_0x479599['query'][_0x859a('0x45')]));_0x555c59[_0x859a('0x44')]=_0x555c59[_0x859a('0x44')][_0x859a('0x46')]?_0x555c59[_0x859a('0x44')]:_0x5e82c2['model'];if(_0x479599[_0x859a('0x42')][_0x859a('0x55')]){_0x555c59[_0x859a('0x50')]=[{'all':!![]}];}_0x555c59=_['merge']({},_0x555c59,_0x479599[_0x859a('0x56')]);return db['SugarcrmAccount']['find'](_0x555c59)['then'](handleEntityNotFound(_0x3b2585,null))[_0x859a('0x1e')](respondWithResult(_0x3b2585,null))['catch'](handleError(_0x3b2585,null));};exports[_0x859a('0x57')]=function(_0xa20a81,_0x306523){return db[_0x859a('0x3c')]['create'](_0xa20a81[_0x859a('0x38')],{})[_0x859a('0x1e')](respondWithResult(_0x306523,0xc9))[_0x859a('0x26')](handleError(_0x306523,null));};exports[_0x859a('0x31')]=function(_0x9cb83c,_0x3076eb){if(_0x9cb83c[_0x859a('0x38')]['id']){delete _0x9cb83c[_0x859a('0x38')]['id'];}return db[_0x859a('0x3c')][_0x859a('0x58')]({'where':{'id':_0x9cb83c[_0x859a('0x53')]['id']}})[_0x859a('0x1e')](handleEntityNotFound(_0x3076eb,null))[_0x859a('0x1e')](saveUpdates(_0x9cb83c[_0x859a('0x38')],null))[_0x859a('0x1e')](respondWithResult(_0x3076eb,null))[_0x859a('0x26')](handleError(_0x3076eb,null));};exports[_0x859a('0x32')]=function(_0x5ce3d1,_0x556f83){return db[_0x859a('0x3c')][_0x859a('0x58')]({'where':{'id':_0x5ce3d1[_0x859a('0x53')]['id']}})[_0x859a('0x1e')](handleEntityNotFound(_0x556f83,null))[_0x859a('0x1e')](removeEntity(_0x556f83,null))[_0x859a('0x26')](handleError(_0x556f83,null));};exports['getConfigurations']=function(_0x45dd53,_0x5d4cbc,_0x428b20){var _0x1e9d06={};var _0x3e39e1={};var _0x122c8d;var _0xf47803;return db[_0x859a('0x3c')][_0x859a('0x59')]({'where':{'id':_0x45dd53[_0x859a('0x53')]['id']}})[_0x859a('0x1e')](handleEntityNotFound(_0x5d4cbc,null))[_0x859a('0x1e')](function(_0x227b2c){if(_0x227b2c){_0x122c8d=_0x227b2c;_0x3e39e1[_0x859a('0x41')]=_[_0x859a('0x54')](db[_0x859a('0x5a')][_0x859a('0x3d')]);_0x3e39e1[_0x859a('0x42')]=_[_0x859a('0x54')](_0x45dd53[_0x859a('0x42')]);_0x3e39e1[_0x859a('0x4c')]=_[_0x859a('0x43')](_0x3e39e1['model'],_0x3e39e1[_0x859a('0x42')]);_0x1e9d06[_0x859a('0x44')]=_[_0x859a('0x43')](_0x3e39e1[_0x859a('0x41')],qs[_0x859a('0x45')](_0x45dd53['query']['fields']));_0x1e9d06['attributes']=_0x1e9d06[_0x859a('0x44')][_0x859a('0x46')]?_0x1e9d06[_0x859a('0x44')]:_0x3e39e1['model'];_0x1e9d06[_0x859a('0x49')]=qs['sort'](_0x45dd53[_0x859a('0x42')][_0x859a('0x4a')]);_0x1e9d06[_0x859a('0x4b')]=qs[_0x859a('0x4c')](_[_0x859a('0x4d')](_0x45dd53[_0x859a('0x42')],_0x3e39e1[_0x859a('0x4c')]));if(_0x45dd53[_0x859a('0x42')][_0x859a('0x4e')]){_0x1e9d06['where']=_[_0x859a('0x37')](_0x1e9d06['where'],{'$or':_[_0x859a('0x3b')](_0x1e9d06[_0x859a('0x44')],function(_0x5b282d){var _0x1a3bc8={};_0x1a3bc8[_0x5b282d]={'$like':'%'+_0x45dd53['query'][_0x859a('0x4e')]+'%'};return _0x1a3bc8;})});}_0x1e9d06=_[_0x859a('0x37')]({},_0x1e9d06,_0x45dd53[_0x859a('0x56')]);return _0x122c8d['getConfigurations'](_0x1e9d06);}})['then'](function(_0x3e31b8){if(_0x3e31b8){_0xf47803=_0x3e31b8[_0x859a('0x46')];if(!_0x45dd53[_0x859a('0x42')][_0x859a('0x47')]('nolimit')){_0x1e9d06['limit']=qs['limit'](_0x45dd53['query']['limit']);_0x1e9d06[_0x859a('0x29')]=qs[_0x859a('0x29')](_0x45dd53['query']['offset']);}return _0x122c8d['getConfigurations'](_0x1e9d06);}})[_0x859a('0x1e')](function(_0x523e44){if(_0x523e44){return _0x523e44?{'count':_0xf47803,'rows':_0x523e44}:null;}})[_0x859a('0x1e')](respondWithResult(_0x5d4cbc,null))[_0x859a('0x26')](handleError(_0x5d4cbc,null));};exports[_0x859a('0x5b')]=function(_0x366b6e,_0x5298ef,_0x3eea26){if(_0x366b6e[_0x859a('0x38')]['id']){delete _0x366b6e[_0x859a('0x38')]['id'];}return db['SugarcrmAccount'][_0x859a('0x59')]({'where':{'id':_0x366b6e[_0x859a('0x53')]['id']}})[_0x859a('0x1e')](handleEntityNotFound(_0x5298ef,null))[_0x859a('0x1e')](function(_0x312730){if(_0x312730){_0x366b6e[_0x859a('0x38')][_0x859a('0x5c')]=_0x312730['id'];_0x366b6e[_0x859a('0x38')][_0x859a('0x5d')]=integrations[_0x859a('0x5e')](_0x366b6e[_0x859a('0x38')][_0x859a('0x5f')],_0x366b6e[_0x859a('0x38')]['type']);_0x366b6e[_0x859a('0x38')][_0x859a('0x60')]=integrations[_0x859a('0x61')](_0x366b6e['body']['channel'],_0x366b6e[_0x859a('0x38')][_0x859a('0x3f')]);return db[_0x859a('0x5a')][_0x859a('0x57')](_0x366b6e[_0x859a('0x38')],{'include':[{'model':db[_0x859a('0x62')],'as':_0x859a('0x5d')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x859a('0x1e')](respondWithResult(_0x5298ef,null))[_0x859a('0x26')](handleError(_0x5298ef,null));};exports[_0x859a('0x63')]=function(_0x41a055,_0x1a3dd1,_0x3046d9){var _0x286806='';var _0x456113=['id','name',_0x859a('0x64'),_0x859a('0x65'),_0x859a('0x66'),_0x859a('0x67'),_0x859a('0x68'),'duration_minutes',_0x859a('0x69'),_0x859a('0x6a'),_0x859a('0x6b'),_0x859a('0x6c')];return db[_0x859a('0x3c')][_0x859a('0x59')]({'where':{'id':_0x41a055['params']['id']},'attributes':['id',_0x859a('0x6d'),'password',_0x859a('0x6e')]})[_0x859a('0x1e')](handleEntityNotFound(_0x1a3dd1,null))[_0x859a('0x1e')](function(_0x3754cd){if(_0x3754cd){_0x286806=_0x3754cd[_0x859a('0x6e')];var _0xe94a77=_0x286806[_0x859a('0x6f')](-0x1);if(_0xe94a77==='/'){_0x286806=_0x286806[_0x859a('0x70')](0x0,_0x286806[_0x859a('0x71')](_0xe94a77));}return rp({'method':'POST','uri':util[_0x859a('0x72')]('%s%s',_0x286806,_0x859a('0x73')),'json':!![],'form':{'method':_0x859a('0x74'),'input_type':_0x859a('0x75'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3754cd[_0x859a('0x6d')],'password':_0x3754cd[_0x859a('0x76')],'encryption':_0x859a('0x77')},'application':_0x859a('0x78')})}});}})[_0x859a('0x1e')](function(_0x39307c){if(_0x39307c&&_0x39307c['name']!==_0x859a('0x79')&&_0x39307c[_0x859a('0x35')]!==_0x859a('0x7a')){return rp({'method':'POST','uri':util['format'](_0x859a('0x7b'),_0x286806,_0x859a('0x73')),'json':!![],'form':{'method':_0x859a('0x7c'),'input_type':_0x859a('0x75'),'response_type':_0x859a('0x75'),'rest_data':JSON[_0x859a('0x7d')]({'session':_0x39307c['id'],'module_name':'Calls'})}})[_0x859a('0x1e')](function(_0x4946b5){if(_0x4946b5){var _0x10132e=_[_0x859a('0x7e')](_0x4946b5[_0x859a('0x7f')]);_['remove'](_0x10132e,function(_0x4449d3){return _0x456113[_0x859a('0x80')](_0x4449d3[_0x859a('0x35')]);});return{'count':_0x10132e[_0x859a('0x46')],'rows':_['map'](_0x10132e,function(_0x2f0ace){return{'id':_0x2f0ace[_0x859a('0x35')],'name':_0x2f0ace[_0x859a('0x81')],'custom':_[_0x859a('0x82')](_0x2f0ace[_0x859a('0x35')],'_c')?!![]:![],'options':_0x2f0ace[_0x859a('0x56')]?_['map'](_[_0x859a('0x7e')](_0x2f0ace[_0x859a('0x56')]),function(_0x5e4e1b){return{'name':_0x5e4e1b['value'],'value':_0x5e4e1b[_0x859a('0x35')]};}):[]};})};}})[_0x859a('0x1e')](respondWithResult(_0x1a3dd1,null))[_0x859a('0x26')](function(_0x5595a4){var _0x545e75=_0x41a055[_0x859a('0x42')]['test']?0x1f4:_0x5595a4['statusCode']||0x1f4;logger[_0x859a('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x859a('0x63'),_0x545e75,JSON[_0x859a('0x7d')](_0x5595a4));delete _0x5595a4[_0x859a('0x35')];if(_0x545e75===0x191){_0x545e75=0x190;}_0x1a3dd1['status'](_0x545e75)[_0x859a('0x36')](_0x41a055['query'][_0x859a('0x83')]?{'message':_0x859a('0x84'),'statusCode':_0x5595a4['statusCode']}:_0x5595a4);});}else{var _0x72e46c=0x1f4;_0x1a3dd1[_0x859a('0x28')](_0x72e46c)['send']({'message':_0x859a('0x84'),'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 c5db3c6..6252f53 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 _0xc3a1=['api','moment','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0xc3a1,0xd9));var _0x1c3a=function(_0x35e215,_0xdd6e08){_0x35e215=_0x35e215-0x0;var _0xa243e6=_0xc3a1[_0x35e215];return _0xa243e6;};'use strict';var _=require(_0x1c3a('0x0'));var util=require(_0x1c3a('0x1'));var logger=require(_0x1c3a('0x2'))(_0x1c3a('0x3'));var moment=require(_0x1c3a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1c3a('0x5'));var config=require('../../config/environment');var attributes=require(_0x1c3a('0x6'));var integrations=require(_0x1c3a('0x7'));module[_0x1c3a('0x8')]=function(_0x3c2535,_0x5c8ce5){return _0x3c2535[_0x1c3a('0x9')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa531=['exports','define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x3b5a64,_0x341488){var _0x2852e3=function(_0xb6928c){while(--_0xb6928c){_0x3b5a64['push'](_0x3b5a64['shift']());}};_0x2852e3(++_0x341488);}(_0xa531,0x12e));var _0x1a53=function(_0x334e95,_0x305878){_0x334e95=_0x334e95-0x0;var _0x5eb054=_0xa531[_0x334e95];return _0x5eb054;};'use strict';var _=require(_0x1a53('0x0'));var util=require(_0x1a53('0x1'));var logger=require(_0x1a53('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1a53('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a53('0x4'));var rimraf=require(_0x1a53('0x5'));var config=require(_0x1a53('0x6'));var attributes=require(_0x1a53('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x1a53('0x8')]=function(_0x1bbc60,_0x2d1d3f){return _0x1bbc60[_0x1a53('0x9')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 9c38241..f7928d2 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 _0x55eb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','attributes','limit','include','map','model','stringify','ShowSugarcrmAccount','raw','where','lodash','util'];(function(_0x1f9bc0,_0x1edaaf){var _0x40de7a=function(_0xa6ad68){while(--_0xa6ad68){_0x1f9bc0['push'](_0x1f9bc0['shift']());}};_0x40de7a(++_0x1edaaf);}(_0x55eb,0x1c5));var _0xb55e=function(_0x4905cb,_0xe9a314){_0x4905cb=_0x4905cb-0x0;var _0x2da117=_0x55eb[_0x4905cb];return _0x2da117;};'use strict';var _=require(_0xb55e('0x0'));var util=require(_0xb55e('0x1'));var moment=require(_0xb55e('0x2'));var BPromise=require(_0xb55e('0x3'));var rs=require(_0xb55e('0x4'));var fs=require('fs');var Redis=require(_0xb55e('0x5'));var db=require(_0xb55e('0x6'))['db'];var utils=require(_0xb55e('0x7'));var logger=require('../../config/logger')(_0xb55e('0x8'));var config=require(_0xb55e('0x9'));var jayson=require(_0xb55e('0xa'));var client=jayson['client'][_0xb55e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x305fb1,_0x26040d,_0x57d90a){return new BPromise(function(_0xf92511,_0x25076c){return client[_0xb55e('0xc')](_0x305fb1,_0x57d90a)[_0xb55e('0xd')](function(_0xf70e7a){logger[_0xb55e('0xe')](_0xb55e('0xf'),_0x26040d,_0xb55e('0x10'));logger[_0xb55e('0x11')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x26040d,_0xb55e('0x10'),JSON['stringify'](_0xf70e7a));if(_0xf70e7a[_0xb55e('0x12')]){if(_0xf70e7a[_0xb55e('0x12')][_0xb55e('0x13')]===0x1f4){logger['error'](_0xb55e('0xf'),_0x26040d,_0xf70e7a[_0xb55e('0x12')][_0xb55e('0x14')]);return _0x25076c(_0xf70e7a[_0xb55e('0x12')][_0xb55e('0x14')]);}logger[_0xb55e('0x12')](_0xb55e('0xf'),_0x26040d,_0xf70e7a[_0xb55e('0x12')][_0xb55e('0x14')]);return _0xf92511(_0xf70e7a['error'][_0xb55e('0x14')]);}else{logger[_0xb55e('0xe')](_0xb55e('0xf'),_0x26040d,'request\x20sent');_0xf92511(_0xf70e7a['result'][_0xb55e('0x14')]);}})[_0xb55e('0x15')](function(_0x43c598){logger[_0xb55e('0x12')](_0xb55e('0xf'),_0x26040d,_0x43c598);_0x25076c(_0x43c598);});});}exports[_0xb55e('0x16')]=function(_0x197508){var _0x31531=this;return new Promise(function(_0x1dfdc6,_0x18c66f){return db[_0xb55e('0x17')][_0xb55e('0x18')]({'raw':_0x197508['options']?_0x197508[_0xb55e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x197508[_0xb55e('0x19')]?_0x197508[_0xb55e('0x19')]['where']||null:null,'attributes':_0x197508['options']?_0x197508['options'][_0xb55e('0x1a')]||null:null,'limit':_0x197508[_0xb55e('0x19')]?_0x197508['options'][_0xb55e('0x1b')]||null:null,'include':_0x197508[_0xb55e('0x19')]?_0x197508[_0xb55e('0x19')][_0xb55e('0x1c')]?_[_0xb55e('0x1d')](_0x197508['options'][_0xb55e('0x1c')],function(_0x585d5f){return{'model':db[_0x585d5f[_0xb55e('0x1e')]],'as':_0x585d5f['as'],'attributes':_0x585d5f['attributes'],'include':_0x585d5f[_0xb55e('0x1c')]?_[_0xb55e('0x1d')](_0x585d5f['include'],function(_0x2da274){return{'model':db[_0x2da274[_0xb55e('0x1e')]],'as':_0x2da274['as'],'attributes':_0x2da274[_0xb55e('0x1a')],'include':_0x2da274[_0xb55e('0x1c')]?_[_0xb55e('0x1d')](_0x2da274['include'],function(_0x3e81db){return{'model':db[_0x3e81db[_0xb55e('0x1e')]],'as':_0x3e81db['as'],'attributes':_0x3e81db['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x46c4df){logger['info'](_0xb55e('0x16'),_0x197508);logger['debug'](_0xb55e('0x16'),_0x197508,JSON[_0xb55e('0x1f')](_0x46c4df));_0x1dfdc6(_0x46c4df);})[_0xb55e('0x15')](function(_0x403903){logger['error'](_0xb55e('0x16'),_0x403903['message'],_0x197508);_0x18c66f(_0x31531[_0xb55e('0x12')](0x1f4,_0x403903[_0xb55e('0x14')]));});});};exports[_0xb55e('0x20')]=function(_0x116182){var _0x179fb1=this;return new Promise(function(_0x37c60e,_0x1832f3){return db['SugarcrmAccount']['find']({'raw':_0x116182['options']?_0x116182[_0xb55e('0x19')][_0xb55e('0x21')]===undefined?!![]:![]:!![],'where':_0x116182[_0xb55e('0x19')]?_0x116182[_0xb55e('0x19')][_0xb55e('0x22')]||null:null,'attributes':_0x116182[_0xb55e('0x19')]?_0x116182[_0xb55e('0x19')][_0xb55e('0x1a')]||null:null,'include':_0x116182[_0xb55e('0x19')]?_0x116182[_0xb55e('0x19')][_0xb55e('0x1c')]?_[_0xb55e('0x1d')](_0x116182[_0xb55e('0x19')][_0xb55e('0x1c')],function(_0x4b80ce){return{'model':db[_0x4b80ce[_0xb55e('0x1e')]],'as':_0x4b80ce['as'],'attributes':_0x4b80ce[_0xb55e('0x1a')],'include':_0x4b80ce[_0xb55e('0x1c')]?_[_0xb55e('0x1d')](_0x4b80ce[_0xb55e('0x1c')],function(_0x58108f){return{'model':db[_0x58108f[_0xb55e('0x1e')]],'as':_0x58108f['as'],'attributes':_0x58108f[_0xb55e('0x1a')],'include':_0x58108f[_0xb55e('0x1c')]?_['map'](_0x58108f[_0xb55e('0x1c')],function(_0x18033f){return{'model':db[_0x18033f[_0xb55e('0x1e')]],'as':_0x18033f['as'],'attributes':_0x18033f[_0xb55e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb55e('0xd')](function(_0x35f7d2){logger['info'](_0xb55e('0x20'),_0x116182);logger[_0xb55e('0x11')](_0xb55e('0x20'),_0x116182,JSON['stringify'](_0x35f7d2));_0x37c60e(_0x35f7d2);})[_0xb55e('0x15')](function(_0x5d3d70){logger['error'](_0xb55e('0x20'),_0x5d3d70[_0xb55e('0x14')],_0x116182);_0x1832f3(_0x179fb1[_0xb55e('0x12')](0x1f4,_0x5d3d70[_0xb55e('0x14')]));});});}; \ No newline at end of file +var _0xf10d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetSugarcrmAccount','findAll','options','where','attributes','limit','include','map','model','SugarcrmAccount','find','raw','ShowSugarcrmAccount','lodash','util'];(function(_0x360c2c,_0x4b8e5a){var _0x441f4a=function(_0x201f10){while(--_0x201f10){_0x360c2c['push'](_0x360c2c['shift']());}};_0x441f4a(++_0x4b8e5a);}(_0xf10d,0x116));var _0xdf10=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf10d[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xdf10('0x0'));var util=require(_0xdf10('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdf10('0x2'));var fs=require('fs');var Redis=require(_0xdf10('0x3'));var db=require(_0xdf10('0x4'))['db'];var utils=require(_0xdf10('0x5'));var logger=require(_0xdf10('0x6'))('rpc');var config=require(_0xdf10('0x7'));var jayson=require(_0xdf10('0x8'));var client=jayson[_0xdf10('0x9')][_0xdf10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ed6b9,_0xa94673,_0x312379){return new BPromise(function(_0x1a114a,_0xd1a5b5){return client[_0xdf10('0xb')](_0x4ed6b9,_0x312379)[_0xdf10('0xc')](function(_0x4a3dc4){logger[_0xdf10('0xd')](_0xdf10('0xe'),_0xa94673,_0xdf10('0xf'));logger[_0xdf10('0x10')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0xa94673,_0xdf10('0xf'),JSON[_0xdf10('0x11')](_0x4a3dc4));if(_0x4a3dc4[_0xdf10('0x12')]){if(_0x4a3dc4[_0xdf10('0x12')][_0xdf10('0x13')]===0x1f4){logger['error'](_0xdf10('0xe'),_0xa94673,_0x4a3dc4[_0xdf10('0x12')][_0xdf10('0x14')]);return _0xd1a5b5(_0x4a3dc4[_0xdf10('0x12')][_0xdf10('0x14')]);}logger[_0xdf10('0x12')](_0xdf10('0xe'),_0xa94673,_0x4a3dc4[_0xdf10('0x12')]['message']);return _0x1a114a(_0x4a3dc4[_0xdf10('0x12')][_0xdf10('0x14')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0xa94673,_0xdf10('0xf'));_0x1a114a(_0x4a3dc4['result'][_0xdf10('0x14')]);}})[_0xdf10('0x15')](function(_0xe235e2){logger['error'](_0xdf10('0xe'),_0xa94673,_0xe235e2);_0xd1a5b5(_0xe235e2);});});}exports[_0xdf10('0x16')]=function(_0xd0f221){var _0x51c10e=this;return new Promise(function(_0x38788d,_0x50cfb6){return db['SugarcrmAccount'][_0xdf10('0x17')]({'raw':_0xd0f221[_0xdf10('0x18')]?_0xd0f221[_0xdf10('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xd0f221['options']?_0xd0f221['options'][_0xdf10('0x19')]||null:null,'attributes':_0xd0f221[_0xdf10('0x18')]?_0xd0f221[_0xdf10('0x18')][_0xdf10('0x1a')]||null:null,'limit':_0xd0f221[_0xdf10('0x18')]?_0xd0f221[_0xdf10('0x18')][_0xdf10('0x1b')]||null:null,'include':_0xd0f221[_0xdf10('0x18')]?_0xd0f221['options'][_0xdf10('0x1c')]?_[_0xdf10('0x1d')](_0xd0f221[_0xdf10('0x18')][_0xdf10('0x1c')],function(_0x2fb446){return{'model':db[_0x2fb446[_0xdf10('0x1e')]],'as':_0x2fb446['as'],'attributes':_0x2fb446[_0xdf10('0x1a')],'include':_0x2fb446[_0xdf10('0x1c')]?_[_0xdf10('0x1d')](_0x2fb446[_0xdf10('0x1c')],function(_0x311db3){return{'model':db[_0x311db3[_0xdf10('0x1e')]],'as':_0x311db3['as'],'attributes':_0x311db3['attributes'],'include':_0x311db3[_0xdf10('0x1c')]?_[_0xdf10('0x1d')](_0x311db3[_0xdf10('0x1c')],function(_0x2bd277){return{'model':db[_0x2bd277[_0xdf10('0x1e')]],'as':_0x2bd277['as'],'attributes':_0x2bd277['attributes']};}):[]};}):[]};}):[]:[]})[_0xdf10('0xc')](function(_0x4354c8){logger[_0xdf10('0xd')](_0xdf10('0x16'),_0xd0f221);logger['debug'](_0xdf10('0x16'),_0xd0f221,JSON[_0xdf10('0x11')](_0x4354c8));_0x38788d(_0x4354c8);})[_0xdf10('0x15')](function(_0x214512){logger['error'](_0xdf10('0x16'),_0x214512['message'],_0xd0f221);_0x50cfb6(_0x51c10e[_0xdf10('0x12')](0x1f4,_0x214512[_0xdf10('0x14')]));});});};exports['ShowSugarcrmAccount']=function(_0x2584a0){var _0x372998=this;return new Promise(function(_0xacd06b,_0x4638d7){return db[_0xdf10('0x1f')][_0xdf10('0x20')]({'raw':_0x2584a0['options']?_0x2584a0[_0xdf10('0x18')][_0xdf10('0x21')]===undefined?!![]:![]:!![],'where':_0x2584a0[_0xdf10('0x18')]?_0x2584a0[_0xdf10('0x18')][_0xdf10('0x19')]||null:null,'attributes':_0x2584a0['options']?_0x2584a0[_0xdf10('0x18')][_0xdf10('0x1a')]||null:null,'include':_0x2584a0[_0xdf10('0x18')]?_0x2584a0[_0xdf10('0x18')][_0xdf10('0x1c')]?_['map'](_0x2584a0[_0xdf10('0x18')][_0xdf10('0x1c')],function(_0x28379c){return{'model':db[_0x28379c[_0xdf10('0x1e')]],'as':_0x28379c['as'],'attributes':_0x28379c['attributes'],'include':_0x28379c[_0xdf10('0x1c')]?_[_0xdf10('0x1d')](_0x28379c['include'],function(_0x3384c7){return{'model':db[_0x3384c7[_0xdf10('0x1e')]],'as':_0x3384c7['as'],'attributes':_0x3384c7['attributes'],'include':_0x3384c7[_0xdf10('0x1c')]?_[_0xdf10('0x1d')](_0x3384c7['include'],function(_0x508f5e){return{'model':db[_0x508f5e['model']],'as':_0x508f5e['as'],'attributes':_0x508f5e['attributes']};}):[]};}):[]};}):[]:[]})[_0xdf10('0xc')](function(_0x506912){logger[_0xdf10('0xd')]('ShowSugarcrmAccount',_0x2584a0);logger[_0xdf10('0x10')](_0xdf10('0x22'),_0x2584a0,JSON[_0xdf10('0x11')](_0x506912));_0xacd06b(_0x506912);})[_0xdf10('0x15')](function(_0x2660b3){logger['error']('ShowSugarcrmAccount',_0x2660b3[_0xdf10('0x14')],_0x2584a0);_0x4638d7(_0x372998['error'](0x1f4,_0x2660b3[_0xdf10('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index d4f28ef..f12ed5e 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 _0x97d9=['post','create','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x570243,_0x477232){var _0x24afaf=function(_0x58fd7e){while(--_0x58fd7e){_0x570243['push'](_0x570243['shift']());}};_0x24afaf(++_0x477232);}(_0x97d9,0x186));var _0x997d=function(_0x4ebe14,_0x3ff78e){_0x4ebe14=_0x4ebe14-0x0;var _0x562a52=_0x97d9[_0x4ebe14];return _0x562a52;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x997d('0x0'));var timeout=require(_0x997d('0x1'));var express=require(_0x997d('0x2'));var router=express[_0x997d('0x3')]();var fs_extra=require(_0x997d('0x4'));var auth=require(_0x997d('0x5'));var interaction=require(_0x997d('0x6'));var config=require(_0x997d('0x7'));var controller=require(_0x997d('0x8'));router[_0x997d('0x9')]('/',auth[_0x997d('0xa')](),controller[_0x997d('0xb')]);router[_0x997d('0x9')](_0x997d('0xc'),auth[_0x997d('0xa')](),controller['show']);router[_0x997d('0x9')](_0x997d('0xd'),auth[_0x997d('0xa')](),controller[_0x997d('0xe')]);router[_0x997d('0x9')](_0x997d('0xf'),auth[_0x997d('0xa')](),controller[_0x997d('0x10')]);router[_0x997d('0x9')]('/:id/descriptions',auth[_0x997d('0xa')](),controller[_0x997d('0x11')]);router[_0x997d('0x12')]('/',auth[_0x997d('0xa')](),controller[_0x997d('0x13')]);router[_0x997d('0x14')](_0x997d('0xc'),auth['isAuthenticated'](),controller[_0x997d('0x15')]);router['delete'](_0x997d('0xc'),auth[_0x997d('0xa')](),controller[_0x997d('0x16')]);module[_0x997d('0x17')]=router; \ No newline at end of file +var _0xb408=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','index'];(function(_0x3f498c,_0x571a61){var _0x12fd70=function(_0x41ad31){while(--_0x41ad31){_0x3f498c['push'](_0x3f498c['shift']());}};_0x12fd70(++_0x571a61);}(_0xb408,0x15f));var _0x8b40=function(_0x120d71,_0x57a0e2){_0x120d71=_0x120d71-0x0;var _0xa896c6=_0xb408[_0x120d71];return _0xa896c6;};'use strict';var multer=require(_0x8b40('0x0'));var util=require(_0x8b40('0x1'));var path=require('path');var timeout=require(_0x8b40('0x2'));var express=require(_0x8b40('0x3'));var router=express['Router']();var fs_extra=require(_0x8b40('0x4'));var auth=require(_0x8b40('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0x8b40('0x6')]('/',auth[_0x8b40('0x7')](),controller[_0x8b40('0x8')]);router[_0x8b40('0x6')](_0x8b40('0x9'),auth[_0x8b40('0x7')](),controller[_0x8b40('0xa')]);router[_0x8b40('0x6')](_0x8b40('0xb'),auth['isAuthenticated'](),controller[_0x8b40('0xc')]);router[_0x8b40('0x6')](_0x8b40('0xd'),auth[_0x8b40('0x7')](),controller[_0x8b40('0xe')]);router[_0x8b40('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x8b40('0xf')]);router[_0x8b40('0x10')]('/',auth[_0x8b40('0x7')](),controller['create']);router[_0x8b40('0x11')](_0x8b40('0x9'),auth[_0x8b40('0x7')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8b40('0x12')]);module[_0x8b40('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 9f73a0f..c90c82d 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 _0xfaae=['sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfaae,0x1a4));var _0xefaa=function(_0x26f3ef,_0x2add06){_0x26f3ef=_0x26f3ef-0x0;var _0x5c837e=_0xfaae[_0x26f3ef];return _0x5c837e;};'use strict';var Sequelize=require(_0xefaa('0x0'));module[_0xefaa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xefaa('0x2')]}}; \ No newline at end of file +var _0x318e=['STRING','sequelize','exports'];(function(_0x2284f8,_0x353aab){var _0x116145=function(_0x1a1513){while(--_0x1a1513){_0x2284f8['push'](_0x2284f8['shift']());}};_0x116145(++_0x353aab);}(_0x318e,0x1c6));var _0xe318=function(_0x7c610a,_0x2ffd26){_0x7c610a=_0x7c610a-0x0;var _0x835b35=_0x318e[_0x7c610a];return _0x835b35;};'use strict';var Sequelize=require(_0xe318('0x0'));module[_0xe318('0x1')]={'name':{'type':Sequelize[_0xe318('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 3df60f8..4cbb83a 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 _0xa9e0=['fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','find','getFields','findOne','SugarcrmField','rawAttributes','order','options','getSubjects','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','jayson/promise','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','merge','body','contact','account','map','SugarcrmConfiguration','fieldName','type','keys','query','filters','intersection','attributes'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_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 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'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=typeof _0x40c424[_0x0a9e('0x27')]==='undefined'&&typeof _0x40c424[_0x0a9e('0x28')]==='undefined';var _0x1dc186=_0x33161b[_0x0a9e('0x29')];var _0x25fba9=_0x526cf3?0x0:_0x40c424[_0x0a9e('0x27')];var _0x140511=_0x526cf3?_0x33161b[_0x0a9e('0x29')]:_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')];var _0x5a101a;if(_0x140511>=_0x1dc186){_0x140511=_0x1dc186;_0x5a101a=0xc8;}else{_0x5a101a=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x5a101a);return _0x3a8e58[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x25fba9+'-'+_0x140511+'/'+_0x1dc186)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x5c877d){return function(_0x15b200){try{jsonpatch[_0x0a9e('0x2c')](_0x15b200,_0x5c877d,!![]);}catch(_0x1843b2){return BPromise[_0x0a9e('0x2d')](_0x1843b2);}return _0x15b200[_0x0a9e('0x2e')]();};}function saveUpdates(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x2f')](_0x563b45)['then'](function(_0x426950){return _0x426950;});}return null;};}function removeEntity(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x30')]()[_0x0a9e('0x31')](function(){_0x5d1e0e[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x66c1d2,_0x46f0a5){return function(_0x40cb85){if(!_0x40cb85){_0x66c1d2[_0x0a9e('0x23')](0x194);}return _0x40cb85;};}function handleError(_0x2b45ea,_0x409319){_0x409319=_0x409319||0x1f4;return function(_0x332d35){logger[_0x0a9e('0x1d')](_0x332d35['stack']);if(_0x332d35[_0x0a9e('0x32')]){delete _0x332d35['name'];}_0x2b45ea[_0x0a9e('0x24')](_0x409319)[_0x0a9e('0x33')](_0x332d35);};}function getMustacheRender(_0x2b7e7f,_0x3f3d41){return Mustache['render'](_0x2b7e7f,_[_0x0a9e('0x34')](_0x3f3d41[_0x0a9e('0x35')],{'contact':_0x3f3d41[_0x0a9e('0x36')],'message':_0x3f3d41[_0x0a9e('0x1f')],'agent':_0x3f3d41['agent'],'interaction':_0x3f3d41['interaction'],'account':_0x3f3d41[_0x0a9e('0x37')]}))||'';}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x38')](db[_0x0a9e('0x39')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3a')],'type':_0x1dbf74[_0x0a9e('0x3b')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x38')](_0x31916f,_0x0a9e('0x32'));_0x1ef87a['query']=_[_0x0a9e('0x3c')](_0x24936a[_0x0a9e('0x3d')]);_0x1ef87a[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x1ef87a['model'],qs[_0x0a9e('0x41')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x381c37[_0x0a9e('0x40')]:_0x1ef87a[_0x0a9e('0x43')];if(!_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x381c37[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x28')]);_0x381c37[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x381c37[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x48')](_0x24936a[_0x0a9e('0x3d')],_0x1ef87a[_0x0a9e('0x3e')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x381c37[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x381c37[_0x0a9e('0x47')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3b')]!==_0x0a9e('0x4a')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x32')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x34')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x39')][_0x0a9e('0x29')](_0x2e9d90)[_0x0a9e('0x31')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x29')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x4c')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x4d')](_0x381c37);})[_0x0a9e('0x31')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x4e')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x31')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x22')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x4f')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':![],'where':{'id':_0x409789[_0x0a9e('0x50')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3c')](db[_0x0a9e('0x39')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3d')]);_0x19383e[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x19383e[_0x0a9e('0x43')],_0x19383e[_0x0a9e('0x3d')]);_0x6054ee[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x19383e[_0x0a9e('0x43')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x40')]=_0x6054ee[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x43')];if(_0x409789[_0x0a9e('0x3d')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x34')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x39')]['find'](_0x6054ee)[_0x0a9e('0x31')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x31')](respondWithResult(_0x992c77,null))[_0x0a9e('0x22')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['SugarcrmConfiguration']['create'](_0x2f82da[_0x0a9e('0x35')],{})[_0x0a9e('0x31')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x2f')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x35')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x35')],null))[_0x0a9e('0x31')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x22')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x30')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x39')][_0x0a9e('0x51')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x31')](removeEntity(_0x272738,null))[_0x0a9e('0x22')](handleError(_0x272738,null));};exports[_0x0a9e('0x52')]=function(_0xb83dfd,_0x156662,_0x5d86e9){var _0x956fbe={};var _0x26bc80={};var _0x5239ef;var _0x3649cc;return db['SugarcrmConfiguration'][_0x0a9e('0x53')]({'where':{'id':_0xb83dfd['params']['id']}})['then'](handleEntityNotFound(_0x156662,null))['then'](function(_0x273cb5){if(_0x273cb5){_0x5239ef=_0x273cb5;_0x26bc80['model']=_[_0x0a9e('0x3c')](db[_0x0a9e('0x54')][_0x0a9e('0x55')]);_0x26bc80[_0x0a9e('0x3d')]=_[_0x0a9e('0x3c')](_0xb83dfd[_0x0a9e('0x3d')]);_0x26bc80['filters']=_[_0x0a9e('0x3f')](_0x26bc80['model'],_0x26bc80[_0x0a9e('0x3d')]);_0x956fbe[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x26bc80['model'],qs[_0x0a9e('0x41')](_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x956fbe[_0x0a9e('0x40')]=_0x956fbe['attributes'][_0x0a9e('0x42')]?_0x956fbe[_0x0a9e('0x40')]:_0x26bc80['model'];_0x956fbe[_0x0a9e('0x56')]=qs[_0x0a9e('0x46')](_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x956fbe[_0x0a9e('0x47')]=qs['filters'](_[_0x0a9e('0x48')](_0xb83dfd[_0x0a9e('0x3d')],_0x26bc80[_0x0a9e('0x3e')]));if(_0xb83dfd['query'][_0x0a9e('0x49')]){_0x956fbe['where']=_['merge'](_0x956fbe[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x956fbe[_0x0a9e('0x40')],function(_0x19c995){var _0x186f39={};_0x186f39[_0x19c995]={'$like':'%'+_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0x186f39;})});}_0x956fbe=_[_0x0a9e('0x34')]({},_0x956fbe,_0xb83dfd[_0x0a9e('0x57')]);return _0x5239ef[_0x0a9e('0x52')](_0x956fbe);}})[_0x0a9e('0x31')](function(_0x19012b){if(_0x19012b){_0x3649cc=_0x19012b[_0x0a9e('0x42')];if(!_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x956fbe[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0xb83dfd['query'][_0x0a9e('0x28')]);_0x956fbe[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0xb83dfd['query'][_0x0a9e('0x27')]);}return _0x5239ef[_0x0a9e('0x52')](_0x956fbe);}})['then'](function(_0x83f0b2){if(_0x83f0b2){return _0x83f0b2?{'count':_0x3649cc,'rows':_0x83f0b2}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x156662,null))[_0x0a9e('0x22')](handleError(_0x156662,null));};exports[_0x0a9e('0x58')]=function(_0x13b5c0,_0x4a43a8,_0x50cdce){var _0x4a2438={};var _0x40fb85={};var _0x18bf5d;var _0x1104ad;return db[_0x0a9e('0x39')][_0x0a9e('0x53')]({'where':{'id':_0x13b5c0[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x4a43a8,null))[_0x0a9e('0x31')](function(_0x5512d1){if(_0x5512d1){_0x18bf5d=_0x5512d1;_0x40fb85[_0x0a9e('0x43')]=_[_0x0a9e('0x3c')](db[_0x0a9e('0x54')]['rawAttributes']);_0x40fb85[_0x0a9e('0x3d')]=_['keys'](_0x13b5c0[_0x0a9e('0x3d')]);_0x40fb85[_0x0a9e('0x3e')]=_['intersection'](_0x40fb85[_0x0a9e('0x43')],_0x40fb85[_0x0a9e('0x3d')]);_0x4a2438[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x40fb85['model'],qs[_0x0a9e('0x41')](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x4a2438[_0x0a9e('0x40')]=_0x4a2438['attributes'][_0x0a9e('0x42')]?_0x4a2438[_0x0a9e('0x40')]:_0x40fb85[_0x0a9e('0x43')];_0x4a2438[_0x0a9e('0x56')]=qs['sort'](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x4a2438[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x48')](_0x13b5c0[_0x0a9e('0x3d')],_0x40fb85[_0x0a9e('0x3e')]));if(_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x4a2438[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x4a2438[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x4a2438[_0x0a9e('0x40')],function(_0x5b35db){var _0xf4120f={};_0xf4120f[_0x5b35db]={'$like':'%'+_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0xf4120f;})});}_0x4a2438=_['merge']({},_0x4a2438,_0x13b5c0[_0x0a9e('0x57')]);return _0x18bf5d[_0x0a9e('0x58')](_0x4a2438);}})[_0x0a9e('0x31')](function(_0x2b9463){if(_0x2b9463){_0x1104ad=_0x2b9463['length'];if(!_0x13b5c0['query'][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x4a2438['limit']=qs[_0x0a9e('0x28')](_0x13b5c0['query'][_0x0a9e('0x28')]);_0x4a2438[_0x0a9e('0x27')]=qs['offset'](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}return _0x18bf5d[_0x0a9e('0x58')](_0x4a2438);}})[_0x0a9e('0x31')](function(_0x3755fe){if(_0x3755fe){return _0x3755fe?{'count':_0x1104ad,'rows':_0x3755fe}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x4a43a8,null))[_0x0a9e('0x22')](handleError(_0x4a43a8,null));};exports['getDescriptions']=function(_0x2973d3,_0x3ca9b9,_0x45c109){var _0x16e5b9={};var _0x492543={};var _0xf51744;var _0xf0db1;return db['SugarcrmConfiguration'][_0x0a9e('0x53')]({'where':{'id':_0x2973d3['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x3ca9b9,null))[_0x0a9e('0x31')](function(_0x3003eb){if(_0x3003eb){_0xf51744=_0x3003eb;_0x492543[_0x0a9e('0x43')]=_['keys'](db['SugarcrmField'][_0x0a9e('0x55')]);_0x492543[_0x0a9e('0x3d')]=_[_0x0a9e('0x3c')](_0x2973d3['query']);_0x492543[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x492543['model'],_0x492543['query']);_0x16e5b9[_0x0a9e('0x40')]=_['intersection'](_0x492543['model'],qs['fields'](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x16e5b9[_0x0a9e('0x40')]=_0x16e5b9[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x16e5b9[_0x0a9e('0x40')]:_0x492543['model'];_0x16e5b9[_0x0a9e('0x56')]=qs['sort'](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x16e5b9[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_['pick'](_0x2973d3[_0x0a9e('0x3d')],_0x492543[_0x0a9e('0x3e')]));if(_0x2973d3[_0x0a9e('0x3d')]['filter']){_0x16e5b9[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x16e5b9[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x16e5b9[_0x0a9e('0x40')],function(_0x1910bf){var _0x32b9bd={};_0x32b9bd[_0x1910bf]={'$like':'%'+_0x2973d3[_0x0a9e('0x3d')]['filter']+'%'};return _0x32b9bd;})});}_0x16e5b9=_[_0x0a9e('0x34')]({},_0x16e5b9,_0x2973d3[_0x0a9e('0x57')]);return _0xf51744['getDescriptions'](_0x16e5b9);}})[_0x0a9e('0x31')](function(_0x982340){if(_0x982340){_0xf0db1=_0x982340[_0x0a9e('0x42')];if(!_0x2973d3['query'][_0x0a9e('0x44')]('nolimit')){_0x16e5b9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x28')]);_0x16e5b9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}return _0xf51744['getDescriptions'](_0x16e5b9);}})[_0x0a9e('0x31')](function(_0x31d25a){if(_0x31d25a){return _0x31d25a?{'count':_0xf0db1,'rows':_0x31d25a}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x3ca9b9,null))[_0x0a9e('0x22')](handleError(_0x3ca9b9,null));}; \ No newline at end of file +var _0xa9e0=['fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','find','getFields','findOne','SugarcrmField','rawAttributes','order','options','getSubjects','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','jayson/promise','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','merge','body','contact','account','map','SugarcrmConfiguration','fieldName','type','keys','query','filters','intersection','attributes'];(function(_0x112e2a,_0x364486){var _0x4f8af9=function(_0xa11c0d){while(--_0xa11c0d){_0x112e2a['push'](_0x112e2a['shift']());}};_0x4f8af9(++_0x364486);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=typeof _0x40c424[_0x0a9e('0x27')]==='undefined'&&typeof _0x40c424[_0x0a9e('0x28')]==='undefined';var _0x1dc186=_0x33161b[_0x0a9e('0x29')];var _0x25fba9=_0x526cf3?0x0:_0x40c424[_0x0a9e('0x27')];var _0x140511=_0x526cf3?_0x33161b[_0x0a9e('0x29')]:_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')];var _0x5a101a;if(_0x140511>=_0x1dc186){_0x140511=_0x1dc186;_0x5a101a=0xc8;}else{_0x5a101a=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x5a101a);return _0x3a8e58[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x25fba9+'-'+_0x140511+'/'+_0x1dc186)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x5c877d){return function(_0x15b200){try{jsonpatch[_0x0a9e('0x2c')](_0x15b200,_0x5c877d,!![]);}catch(_0x1843b2){return BPromise[_0x0a9e('0x2d')](_0x1843b2);}return _0x15b200[_0x0a9e('0x2e')]();};}function saveUpdates(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x2f')](_0x563b45)['then'](function(_0x426950){return _0x426950;});}return null;};}function removeEntity(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x30')]()[_0x0a9e('0x31')](function(){_0x5d1e0e[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x66c1d2,_0x46f0a5){return function(_0x40cb85){if(!_0x40cb85){_0x66c1d2[_0x0a9e('0x23')](0x194);}return _0x40cb85;};}function handleError(_0x2b45ea,_0x409319){_0x409319=_0x409319||0x1f4;return function(_0x332d35){logger[_0x0a9e('0x1d')](_0x332d35['stack']);if(_0x332d35[_0x0a9e('0x32')]){delete _0x332d35['name'];}_0x2b45ea[_0x0a9e('0x24')](_0x409319)[_0x0a9e('0x33')](_0x332d35);};}function getMustacheRender(_0x2b7e7f,_0x3f3d41){return Mustache['render'](_0x2b7e7f,_[_0x0a9e('0x34')](_0x3f3d41[_0x0a9e('0x35')],{'contact':_0x3f3d41[_0x0a9e('0x36')],'message':_0x3f3d41[_0x0a9e('0x1f')],'agent':_0x3f3d41['agent'],'interaction':_0x3f3d41['interaction'],'account':_0x3f3d41[_0x0a9e('0x37')]}))||'';}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x38')](db[_0x0a9e('0x39')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3a')],'type':_0x1dbf74[_0x0a9e('0x3b')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x38')](_0x31916f,_0x0a9e('0x32'));_0x1ef87a['query']=_[_0x0a9e('0x3c')](_0x24936a[_0x0a9e('0x3d')]);_0x1ef87a[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x1ef87a['model'],qs[_0x0a9e('0x41')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x381c37[_0x0a9e('0x40')]:_0x1ef87a[_0x0a9e('0x43')];if(!_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x381c37[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x28')]);_0x381c37[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x381c37[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x48')](_0x24936a[_0x0a9e('0x3d')],_0x1ef87a[_0x0a9e('0x3e')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x381c37[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x381c37[_0x0a9e('0x47')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3b')]!==_0x0a9e('0x4a')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x32')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x34')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x39')][_0x0a9e('0x29')](_0x2e9d90)[_0x0a9e('0x31')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x29')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x4c')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x4d')](_0x381c37);})[_0x0a9e('0x31')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x4e')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x31')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x22')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x4f')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':![],'where':{'id':_0x409789[_0x0a9e('0x50')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3c')](db[_0x0a9e('0x39')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3d')]);_0x19383e[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x19383e[_0x0a9e('0x43')],_0x19383e[_0x0a9e('0x3d')]);_0x6054ee[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x19383e[_0x0a9e('0x43')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x40')]=_0x6054ee[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x43')];if(_0x409789[_0x0a9e('0x3d')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x34')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x39')]['find'](_0x6054ee)[_0x0a9e('0x31')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x31')](respondWithResult(_0x992c77,null))[_0x0a9e('0x22')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['SugarcrmConfiguration']['create'](_0x2f82da[_0x0a9e('0x35')],{})[_0x0a9e('0x31')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x2f')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x35')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x35')],null))[_0x0a9e('0x31')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x22')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x30')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x39')][_0x0a9e('0x51')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x31')](removeEntity(_0x272738,null))[_0x0a9e('0x22')](handleError(_0x272738,null));};exports[_0x0a9e('0x52')]=function(_0xb83dfd,_0x156662,_0x5d86e9){var _0x956fbe={};var _0x26bc80={};var _0x5239ef;var _0x3649cc;return db['SugarcrmConfiguration'][_0x0a9e('0x53')]({'where':{'id':_0xb83dfd['params']['id']}})['then'](handleEntityNotFound(_0x156662,null))['then'](function(_0x273cb5){if(_0x273cb5){_0x5239ef=_0x273cb5;_0x26bc80['model']=_[_0x0a9e('0x3c')](db[_0x0a9e('0x54')][_0x0a9e('0x55')]);_0x26bc80[_0x0a9e('0x3d')]=_[_0x0a9e('0x3c')](_0xb83dfd[_0x0a9e('0x3d')]);_0x26bc80['filters']=_[_0x0a9e('0x3f')](_0x26bc80['model'],_0x26bc80[_0x0a9e('0x3d')]);_0x956fbe[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x26bc80['model'],qs[_0x0a9e('0x41')](_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x956fbe[_0x0a9e('0x40')]=_0x956fbe['attributes'][_0x0a9e('0x42')]?_0x956fbe[_0x0a9e('0x40')]:_0x26bc80['model'];_0x956fbe[_0x0a9e('0x56')]=qs[_0x0a9e('0x46')](_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x956fbe[_0x0a9e('0x47')]=qs['filters'](_[_0x0a9e('0x48')](_0xb83dfd[_0x0a9e('0x3d')],_0x26bc80[_0x0a9e('0x3e')]));if(_0xb83dfd['query'][_0x0a9e('0x49')]){_0x956fbe['where']=_['merge'](_0x956fbe[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x956fbe[_0x0a9e('0x40')],function(_0x19c995){var _0x186f39={};_0x186f39[_0x19c995]={'$like':'%'+_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0x186f39;})});}_0x956fbe=_[_0x0a9e('0x34')]({},_0x956fbe,_0xb83dfd[_0x0a9e('0x57')]);return _0x5239ef[_0x0a9e('0x52')](_0x956fbe);}})[_0x0a9e('0x31')](function(_0x19012b){if(_0x19012b){_0x3649cc=_0x19012b[_0x0a9e('0x42')];if(!_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x956fbe[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0xb83dfd['query'][_0x0a9e('0x28')]);_0x956fbe[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0xb83dfd['query'][_0x0a9e('0x27')]);}return _0x5239ef[_0x0a9e('0x52')](_0x956fbe);}})['then'](function(_0x83f0b2){if(_0x83f0b2){return _0x83f0b2?{'count':_0x3649cc,'rows':_0x83f0b2}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x156662,null))[_0x0a9e('0x22')](handleError(_0x156662,null));};exports[_0x0a9e('0x58')]=function(_0x13b5c0,_0x4a43a8,_0x50cdce){var _0x4a2438={};var _0x40fb85={};var _0x18bf5d;var _0x1104ad;return db[_0x0a9e('0x39')][_0x0a9e('0x53')]({'where':{'id':_0x13b5c0[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x4a43a8,null))[_0x0a9e('0x31')](function(_0x5512d1){if(_0x5512d1){_0x18bf5d=_0x5512d1;_0x40fb85[_0x0a9e('0x43')]=_[_0x0a9e('0x3c')](db[_0x0a9e('0x54')]['rawAttributes']);_0x40fb85[_0x0a9e('0x3d')]=_['keys'](_0x13b5c0[_0x0a9e('0x3d')]);_0x40fb85[_0x0a9e('0x3e')]=_['intersection'](_0x40fb85[_0x0a9e('0x43')],_0x40fb85[_0x0a9e('0x3d')]);_0x4a2438[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x40fb85['model'],qs[_0x0a9e('0x41')](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x4a2438[_0x0a9e('0x40')]=_0x4a2438['attributes'][_0x0a9e('0x42')]?_0x4a2438[_0x0a9e('0x40')]:_0x40fb85[_0x0a9e('0x43')];_0x4a2438[_0x0a9e('0x56')]=qs['sort'](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x4a2438[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x48')](_0x13b5c0[_0x0a9e('0x3d')],_0x40fb85[_0x0a9e('0x3e')]));if(_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x4a2438[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x4a2438[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x4a2438[_0x0a9e('0x40')],function(_0x5b35db){var _0xf4120f={};_0xf4120f[_0x5b35db]={'$like':'%'+_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0xf4120f;})});}_0x4a2438=_['merge']({},_0x4a2438,_0x13b5c0[_0x0a9e('0x57')]);return _0x18bf5d[_0x0a9e('0x58')](_0x4a2438);}})[_0x0a9e('0x31')](function(_0x2b9463){if(_0x2b9463){_0x1104ad=_0x2b9463['length'];if(!_0x13b5c0['query'][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x4a2438['limit']=qs[_0x0a9e('0x28')](_0x13b5c0['query'][_0x0a9e('0x28')]);_0x4a2438[_0x0a9e('0x27')]=qs['offset'](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}return _0x18bf5d[_0x0a9e('0x58')](_0x4a2438);}})[_0x0a9e('0x31')](function(_0x3755fe){if(_0x3755fe){return _0x3755fe?{'count':_0x1104ad,'rows':_0x3755fe}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x4a43a8,null))[_0x0a9e('0x22')](handleError(_0x4a43a8,null));};exports['getDescriptions']=function(_0x2973d3,_0x3ca9b9,_0x45c109){var _0x16e5b9={};var _0x492543={};var _0xf51744;var _0xf0db1;return db['SugarcrmConfiguration'][_0x0a9e('0x53')]({'where':{'id':_0x2973d3['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x3ca9b9,null))[_0x0a9e('0x31')](function(_0x3003eb){if(_0x3003eb){_0xf51744=_0x3003eb;_0x492543[_0x0a9e('0x43')]=_['keys'](db['SugarcrmField'][_0x0a9e('0x55')]);_0x492543[_0x0a9e('0x3d')]=_[_0x0a9e('0x3c')](_0x2973d3['query']);_0x492543[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x492543['model'],_0x492543['query']);_0x16e5b9[_0x0a9e('0x40')]=_['intersection'](_0x492543['model'],qs['fields'](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x16e5b9[_0x0a9e('0x40')]=_0x16e5b9[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x16e5b9[_0x0a9e('0x40')]:_0x492543['model'];_0x16e5b9[_0x0a9e('0x56')]=qs['sort'](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x16e5b9[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_['pick'](_0x2973d3[_0x0a9e('0x3d')],_0x492543[_0x0a9e('0x3e')]));if(_0x2973d3[_0x0a9e('0x3d')]['filter']){_0x16e5b9[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x16e5b9[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x16e5b9[_0x0a9e('0x40')],function(_0x1910bf){var _0x32b9bd={};_0x32b9bd[_0x1910bf]={'$like':'%'+_0x2973d3[_0x0a9e('0x3d')]['filter']+'%'};return _0x32b9bd;})});}_0x16e5b9=_[_0x0a9e('0x34')]({},_0x16e5b9,_0x2973d3[_0x0a9e('0x57')]);return _0xf51744['getDescriptions'](_0x16e5b9);}})[_0x0a9e('0x31')](function(_0x982340){if(_0x982340){_0xf0db1=_0x982340[_0x0a9e('0x42')];if(!_0x2973d3['query'][_0x0a9e('0x44')]('nolimit')){_0x16e5b9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x28')]);_0x16e5b9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}return _0xf51744['getDescriptions'](_0x16e5b9);}})[_0x0a9e('0x31')](function(_0x31d25a){if(_0x31d25a){return _0x31d25a?{'count':_0xf0db1,'rows':_0x31d25a}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x3ca9b9,null))[_0x0a9e('0x22')](handleError(_0x3ca9b9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 701db6e..a3dde17 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 _0xed35=['bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','moment'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xed35,0x1de));var _0x5ed3=function(_0x5c9c9f,_0x3116f4){_0x5c9c9f=_0x5c9c9f-0x0;var _0x1a86f7=_0xed35[_0x5c9c9f];return _0x1a86f7;};'use strict';var _=require(_0x5ed3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5ed3('0x1'));var BPromise=require(_0x5ed3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ed3('0x3'));var rimraf=require(_0x5ed3('0x4'));var config=require(_0x5ed3('0x5'));var attributes=require(_0x5ed3('0x6'));module[_0x5ed3('0x7')]=function(_0x2cb6bf,_0x4e534f){return _0x2cb6bf['define'](_0x5ed3('0x8'),attributes,{'tableName':_0x5ed3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaff9=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','api','moment'];(function(_0x450976,_0x20a184){var _0x4be3b9=function(_0x5948ec){while(--_0x5948ec){_0x450976['push'](_0x450976['shift']());}};_0x4be3b9(++_0x20a184);}(_0xaff9,0x8b));var _0x9aff=function(_0x31c99e,_0x1eeb82){_0x31c99e=_0x31c99e-0x0;var _0x10646d=_0xaff9[_0x31c99e];return _0x10646d;};'use strict';var _=require(_0x9aff('0x0'));var util=require(_0x9aff('0x1'));var logger=require('../../config/logger')(_0x9aff('0x2'));var moment=require(_0x9aff('0x3'));var BPromise=require(_0x9aff('0x4'));var rp=require(_0x9aff('0x5'));var fs=require('fs');var path=require(_0x9aff('0x6'));var rimraf=require(_0x9aff('0x7'));var config=require(_0x9aff('0x8'));var attributes=require(_0x9aff('0x9'));module['exports']=function(_0x608578,_0x284bb2){return _0x608578[_0x9aff('0xa')](_0x9aff('0xb'),attributes,{'tableName':_0x9aff('0xc'),'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 9b44291..b2f32a7 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 _0x9f60=['message','result','lodash','moment','bluebird','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x29412b,_0x2855d5){var _0x473e64=function(_0x5c8e91){while(--_0x5c8e91){_0x29412b['push'](_0x29412b['shift']());}};_0x473e64(++_0x2855d5);}(_0x9f60,0x1e8));var _0x09f6=function(_0x3bb5b9,_0x53b3a8){_0x3bb5b9=_0x3bb5b9-0x0;var _0x4bb629=_0x9f60[_0x3bb5b9];return _0x4bb629;};'use strict';var _=require(_0x09f6('0x0'));var util=require('util');var moment=require(_0x09f6('0x1'));var BPromise=require(_0x09f6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x09f6('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x09f6('0x4'));var jayson=require(_0x09f6('0x5'));var client=jayson[_0x09f6('0x6')][_0x09f6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x38fc77,_0x54628a,_0x3937e2){return new BPromise(function(_0x34fdd8,_0x15f1d2){return client['request'](_0x38fc77,_0x3937e2)[_0x09f6('0x8')](function(_0x13800e){logger[_0x09f6('0x9')](_0x09f6('0xa'),_0x54628a,_0x09f6('0xb'));logger[_0x09f6('0xc')](_0x09f6('0xd'),_0x54628a,_0x09f6('0xb'),JSON['stringify'](_0x13800e));if(_0x13800e[_0x09f6('0xe')]){if(_0x13800e['error'][_0x09f6('0xf')]===0x1f4){logger[_0x09f6('0xe')](_0x09f6('0xa'),_0x54628a,_0x13800e['error'][_0x09f6('0x10')]);return _0x15f1d2(_0x13800e['error'][_0x09f6('0x10')]);}logger[_0x09f6('0xe')](_0x09f6('0xa'),_0x54628a,_0x13800e[_0x09f6('0xe')][_0x09f6('0x10')]);return _0x34fdd8(_0x13800e[_0x09f6('0xe')][_0x09f6('0x10')]);}else{logger[_0x09f6('0x9')](_0x09f6('0xa'),_0x54628a,_0x09f6('0xb'));_0x34fdd8(_0x13800e[_0x09f6('0x11')][_0x09f6('0x10')]);}})['catch'](function(_0x32c57f){logger[_0x09f6('0xe')](_0x09f6('0xa'),_0x54628a,_0x32c57f);_0x15f1d2(_0x32c57f);});});} \ No newline at end of file +var _0x1366=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','util','bluebird'];(function(_0x52f8ae,_0xd40e9){var _0x1ab251=function(_0x5ec019){while(--_0x5ec019){_0x52f8ae['push'](_0x52f8ae['shift']());}};_0x1ab251(++_0xd40e9);}(_0x1366,0x1c6));var _0x6136=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1366[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x6136('0x0'));var moment=require('moment');var BPromise=require(_0x6136('0x1'));var rs=require(_0x6136('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6136('0x3'))['db'];var utils=require(_0x6136('0x4'));var logger=require(_0x6136('0x5'))(_0x6136('0x6'));var config=require(_0x6136('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6136('0x8')][_0x6136('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f173d,_0x324e6d,_0x4042be){return new BPromise(function(_0x45c9d2,_0x53e4fe){return client[_0x6136('0xa')](_0x3f173d,_0x4042be)['then'](function(_0x5c6055){logger[_0x6136('0xb')](_0x6136('0xc'),_0x324e6d,_0x6136('0xd'));logger[_0x6136('0xe')](_0x6136('0xf'),_0x324e6d,_0x6136('0xd'),JSON['stringify'](_0x5c6055));if(_0x5c6055[_0x6136('0x10')]){if(_0x5c6055[_0x6136('0x10')][_0x6136('0x11')]===0x1f4){logger[_0x6136('0x10')](_0x6136('0xc'),_0x324e6d,_0x5c6055[_0x6136('0x10')][_0x6136('0x12')]);return _0x53e4fe(_0x5c6055[_0x6136('0x10')][_0x6136('0x12')]);}logger[_0x6136('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x324e6d,_0x5c6055['error'][_0x6136('0x12')]);return _0x45c9d2(_0x5c6055['error']['message']);}else{logger['info'](_0x6136('0xc'),_0x324e6d,_0x6136('0xd'));_0x45c9d2(_0x5c6055['result'][_0x6136('0x12')]);}})['catch'](function(_0x40a710){logger[_0x6136('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x324e6d,_0x40a710);_0x53e4fe(_0x40a710);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 3d020c0..64da61f 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 _0x2d6a=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x4f7991,_0x1484f2){var _0x26978b=function(_0x27809a){while(--_0x27809a){_0x4f7991['push'](_0x4f7991['shift']());}};_0x26978b(++_0x1484f2);}(_0x2d6a,0x16a));var _0xa2d6=function(_0x362821,_0x439b18){_0x362821=_0x362821-0x0;var _0xb772ca=_0x2d6a[_0x362821];return _0xb772ca;};'use strict';var multer=require(_0xa2d6('0x0'));var util=require(_0xa2d6('0x1'));var path=require(_0xa2d6('0x2'));var timeout=require(_0xa2d6('0x3'));var express=require(_0xa2d6('0x4'));var router=express['Router']();var fs_extra=require(_0xa2d6('0x5'));var auth=require(_0xa2d6('0x6'));var interaction=require(_0xa2d6('0x7'));var config=require(_0xa2d6('0x8'));var controller=require(_0xa2d6('0x9'));router[_0xa2d6('0xa')]('/',auth[_0xa2d6('0xb')](),controller[_0xa2d6('0xc')]);router[_0xa2d6('0xa')](_0xa2d6('0xd'),auth[_0xa2d6('0xb')](),controller[_0xa2d6('0xe')]);router['post']('/',auth[_0xa2d6('0xb')](),controller[_0xa2d6('0xf')]);router[_0xa2d6('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa2d6('0x11')]);router['delete'](_0xa2d6('0xd'),auth[_0xa2d6('0xb')](),controller['destroy']);module[_0xa2d6('0x12')]=router; \ No newline at end of file +var _0x0726=['util','path','express','Router','../../components/auth/service','./intSugarcrmField.controller','index','get','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','multer'];(function(_0x355b83,_0x23e3b1){var _0x5ebfaa=function(_0x2005f2){while(--_0x2005f2){_0x355b83['push'](_0x355b83['shift']());}};_0x5ebfaa(++_0x23e3b1);}(_0x0726,0x131));var _0x6072=function(_0x4e659c,_0x26e3bf){_0x4e659c=_0x4e659c-0x0;var _0x34d772=_0x0726[_0x4e659c];return _0x34d772;};'use strict';var multer=require(_0x6072('0x0'));var util=require(_0x6072('0x1'));var path=require(_0x6072('0x2'));var timeout=require('connect-timeout');var express=require(_0x6072('0x3'));var router=express[_0x6072('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6072('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6072('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x6072('0x7')]);router[_0x6072('0x8')](_0x6072('0x9'),auth['isAuthenticated'](),controller[_0x6072('0xa')]);router['post']('/',auth[_0x6072('0xb')](),controller[_0x6072('0xc')]);router[_0x6072('0xd')]('/:id',auth[_0x6072('0xb')](),controller[_0x6072('0xe')]);router[_0x6072('0xf')](_0x6072('0x9'),auth[_0x6072('0xb')](),controller[_0x6072('0x10')]);module[_0x6072('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index f98532a..e6a1542 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 _0x29d4=['variable','customVariable','keyValue','STRING','sequelize','ENUM','string'];(function(_0x3459ed,_0x1bee20){var _0x4519a3=function(_0x792b8d){while(--_0x792b8d){_0x3459ed['push'](_0x3459ed['shift']());}};_0x4519a3(++_0x1bee20);}(_0x29d4,0x1a1));var _0x429d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x29d4[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x429d('0x0'));module['exports']={'type':{'type':Sequelize[_0x429d('0x1')](_0x429d('0x2'),_0x429d('0x3'),_0x429d('0x4'),_0x429d('0x5'),'picklist'),'defaultValue':_0x429d('0x2')},'content':{'type':Sequelize[_0x429d('0x6')]},'key':{'type':Sequelize[_0x429d('0x6')]},'keyType':{'type':Sequelize[_0x429d('0x1')](_0x429d('0x2'),_0x429d('0x3'),_0x429d('0x4'))},'keyContent':{'type':Sequelize[_0x429d('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x429d('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x429d('0x6')]}}; \ No newline at end of file +var _0x72b1=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','ENUM'];(function(_0x161ac3,_0x142e49){var _0x3bb837=function(_0x269c7c){while(--_0x269c7c){_0x161ac3['push'](_0x161ac3['shift']());}};_0x3bb837(++_0x142e49);}(_0x72b1,0x16e));var _0x172b=function(_0x4ca273,_0x1b217d){_0x4ca273=_0x4ca273-0x0;var _0x4a3561=_0x72b1[_0x4ca273];return _0x4a3561;};'use strict';var Sequelize=require(_0x172b('0x0'));module['exports']={'type':{'type':Sequelize[_0x172b('0x1')](_0x172b('0x2'),_0x172b('0x3'),_0x172b('0x4'),_0x172b('0x5'),_0x172b('0x6')),'defaultValue':_0x172b('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x172b('0x7')]},'keyType':{'type':Sequelize[_0x172b('0x1')](_0x172b('0x2'),_0x172b('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x172b('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x172b('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x172b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 1158652..5299b8a 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 _0xcecd=['merge','body','message','agent','interaction','account','index','map','SugarcrmField','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','create','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','render'];(function(_0x3755a2,_0x5be61e){var _0x2df8e4=function(_0x316bae){while(--_0x316bae){_0x3755a2['push'](_0x3755a2['shift']());}};_0x2df8e4(++_0x5be61e);}(_0xcecd,0x171));var _0xdcec=function(_0xf3b6f0,_0x2ae4a6){_0xf3b6f0=_0xf3b6f0-0x0;var _0x71a86f=_0xcecd[_0xf3b6f0];return _0x71a86f;};'use strict';var emlformat=require(_0xdcec('0x0'));var rimraf=require(_0xdcec('0x1'));var zipdir=require(_0xdcec('0x2'));var jsonpatch=require(_0xdcec('0x3'));var rp=require(_0xdcec('0x4'));var moment=require(_0xdcec('0x5'));var BPromise=require(_0xdcec('0x6'));var Mustache=require(_0xdcec('0x7'));var util=require(_0xdcec('0x8'));var path=require(_0xdcec('0x9'));var sox=require(_0xdcec('0xa'));var csv=require(_0xdcec('0xb'));var ejs=require(_0xdcec('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdcec('0xd'));var squel=require(_0xdcec('0xe'));var crypto=require(_0xdcec('0xf'));var jsforce=require(_0xdcec('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdcec('0x11'));var Papa=require(_0xdcec('0x12'));var Redis=require(_0xdcec('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xdcec('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdcec('0x15'));var logger=require(_0xdcec('0x16'))(_0xdcec('0x17'));var utils=require('../../config/utils');var config=require(_0xdcec('0x18'));var licenseUtil=require(_0xdcec('0x19'));var db=require(_0xdcec('0x1a'))['db'];function respondWithStatusCode(_0x5c6d01,_0x1d5f64){_0x1d5f64=_0x1d5f64||0xcc;return function(_0x4ce941){if(_0x4ce941){return _0x5c6d01[_0xdcec('0x1b')](_0x1d5f64);}return _0x5c6d01[_0xdcec('0x1c')](_0x1d5f64)[_0xdcec('0x1d')]();};}function respondWithResult(_0x5aefc4,_0x986417){_0x986417=_0x986417||0xc8;return function(_0x3faae1){if(_0x3faae1){return _0x5aefc4[_0xdcec('0x1c')](_0x986417)[_0xdcec('0x1e')](_0x3faae1);}};}function respondWithFilteredResult(_0x2281e2,_0x115f32){return function(_0x247f42){if(_0x247f42){var _0x10f42a=typeof _0x115f32[_0xdcec('0x1f')]===_0xdcec('0x20')&&typeof _0x115f32[_0xdcec('0x21')]==='undefined';var _0x552976=_0x247f42['count'];var _0xbda1e0=_0x10f42a?0x0:_0x115f32[_0xdcec('0x1f')];var _0xc347e9=_0x10f42a?_0x247f42[_0xdcec('0x22')]:_0x115f32[_0xdcec('0x1f')]+_0x115f32[_0xdcec('0x21')];var _0x308bdc;if(_0xc347e9>=_0x552976){_0xc347e9=_0x552976;_0x308bdc=0xc8;}else{_0x308bdc=0xce;}_0x2281e2[_0xdcec('0x1c')](_0x308bdc);return _0x2281e2[_0xdcec('0x23')](_0xdcec('0x24'),_0xbda1e0+'-'+_0xc347e9+'/'+_0x552976)['json'](_0x247f42);}return null;};}function patchUpdates(_0x3b9249){return function(_0x37e83c){try{jsonpatch[_0xdcec('0x25')](_0x37e83c,_0x3b9249,!![]);}catch(_0xf0b8d3){return BPromise[_0xdcec('0x26')](_0xf0b8d3);}return _0x37e83c['save']();};}function saveUpdates(_0x3afd78,_0x549782){return function(_0x57ecc4){if(_0x57ecc4){return _0x57ecc4[_0xdcec('0x27')](_0x3afd78)[_0xdcec('0x28')](function(_0x239411){return _0x239411;});}return null;};}function removeEntity(_0x17299c,_0x59ec54){return function(_0x1f3f18){if(_0x1f3f18){return _0x1f3f18[_0xdcec('0x29')]()['then'](function(){_0x17299c[_0xdcec('0x1c')](0xcc)[_0xdcec('0x1d')]();});}};}function handleEntityNotFound(_0x30d897,_0x556417){return function(_0x2ca14c){if(!_0x2ca14c){_0x30d897['sendStatus'](0x194);}return _0x2ca14c;};}function handleError(_0x25e00f,_0x3c6c22){_0x3c6c22=_0x3c6c22||0x1f4;return function(_0x1b6331){logger['error'](_0x1b6331[_0xdcec('0x2a')]);if(_0x1b6331[_0xdcec('0x2b')]){delete _0x1b6331[_0xdcec('0x2b')];}_0x25e00f[_0xdcec('0x1c')](_0x3c6c22)[_0xdcec('0x2c')](_0x1b6331);};}function getMustacheRender(_0x469f48,_0xab2fb6){return Mustache[_0xdcec('0x2d')](_0x469f48,_[_0xdcec('0x2e')](_0xab2fb6[_0xdcec('0x2f')],{'contact':_0xab2fb6['contact'],'message':_0xab2fb6[_0xdcec('0x30')],'agent':_0xab2fb6[_0xdcec('0x31')],'interaction':_0xab2fb6[_0xdcec('0x32')],'account':_0xab2fb6[_0xdcec('0x33')]}))||'';}exports[_0xdcec('0x34')]=function(_0x4e18b1,_0x4ff8e0){var _0x6bcd4c={},_0x1784a4={},_0x3bac92={'count':0x0,'rows':[]};var _0x550ff2=_[_0xdcec('0x35')](db[_0xdcec('0x36')]['rawAttributes'],function(_0x40ecb8){return{'name':_0x40ecb8[_0xdcec('0x37')],'type':_0x40ecb8[_0xdcec('0x38')]['key']};});_0x1784a4['model']=_['map'](_0x550ff2,_0xdcec('0x2b'));_0x1784a4[_0xdcec('0x39')]=_[_0xdcec('0x3a')](_0x4e18b1[_0xdcec('0x39')]);_0x1784a4[_0xdcec('0x3b')]=_[_0xdcec('0x3c')](_0x1784a4[_0xdcec('0x3d')],_0x1784a4['query']);_0x6bcd4c[_0xdcec('0x3e')]=_[_0xdcec('0x3c')](_0x1784a4[_0xdcec('0x3d')],qs['fields'](_0x4e18b1['query'][_0xdcec('0x3f')]));_0x6bcd4c[_0xdcec('0x3e')]=_0x6bcd4c[_0xdcec('0x3e')][_0xdcec('0x40')]?_0x6bcd4c[_0xdcec('0x3e')]:_0x1784a4[_0xdcec('0x3d')];if(!_0x4e18b1['query'][_0xdcec('0x41')](_0xdcec('0x42'))){_0x6bcd4c['limit']=qs[_0xdcec('0x21')](_0x4e18b1[_0xdcec('0x39')][_0xdcec('0x21')]);_0x6bcd4c['offset']=qs['offset'](_0x4e18b1[_0xdcec('0x39')][_0xdcec('0x1f')]);}_0x6bcd4c[_0xdcec('0x43')]=qs[_0xdcec('0x44')](_0x4e18b1[_0xdcec('0x39')]['sort']);_0x6bcd4c['where']=qs[_0xdcec('0x3b')](_[_0xdcec('0x45')](_0x4e18b1[_0xdcec('0x39')],_0x1784a4['filters']),_0x550ff2);if(_0x4e18b1[_0xdcec('0x39')][_0xdcec('0x46')]){_0x6bcd4c[_0xdcec('0x47')]=_['merge'](_0x6bcd4c[_0xdcec('0x47')],{'$or':_[_0xdcec('0x35')](_0x550ff2,function(_0x13d21b){if(_0x13d21b['type']!==_0xdcec('0x48')){var _0x544f65={};_0x544f65[_0x13d21b[_0xdcec('0x2b')]]={'$like':'%'+_0x4e18b1[_0xdcec('0x39')][_0xdcec('0x46')]+'%'};return _0x544f65;}})});}_0x6bcd4c=_['merge']({},_0x6bcd4c,_0x4e18b1[_0xdcec('0x49')]);var _0x48933d={'where':_0x6bcd4c[_0xdcec('0x47')]};return db[_0xdcec('0x36')]['count'](_0x48933d)['then'](function(_0x3df5a5){_0x3bac92['count']=_0x3df5a5;if(_0x4e18b1[_0xdcec('0x39')][_0xdcec('0x4a')]){_0x6bcd4c[_0xdcec('0x4b')]=[{'all':!![]}];}return db[_0xdcec('0x36')]['findAll'](_0x6bcd4c);})[_0xdcec('0x28')](function(_0x29f203){_0x3bac92[_0xdcec('0x4c')]=_0x29f203;return _0x3bac92;})[_0xdcec('0x28')](respondWithFilteredResult(_0x4ff8e0,_0x6bcd4c))['catch'](handleError(_0x4ff8e0,null));};exports[_0xdcec('0x4d')]=function(_0x1c49d3,_0x2f52c7){var _0x471434={'raw':!![],'where':{'id':_0x1c49d3[_0xdcec('0x4e')]['id']}},_0x33e293={};_0x33e293[_0xdcec('0x3d')]=_[_0xdcec('0x3a')](db[_0xdcec('0x36')][_0xdcec('0x4f')]);_0x33e293['query']=_[_0xdcec('0x3a')](_0x1c49d3[_0xdcec('0x39')]);_0x33e293[_0xdcec('0x3b')]=_[_0xdcec('0x3c')](_0x33e293[_0xdcec('0x3d')],_0x33e293['query']);_0x471434[_0xdcec('0x3e')]=_[_0xdcec('0x3c')](_0x33e293[_0xdcec('0x3d')],qs[_0xdcec('0x3f')](_0x1c49d3[_0xdcec('0x39')]['fields']));_0x471434['attributes']=_0x471434['attributes'][_0xdcec('0x40')]?_0x471434[_0xdcec('0x3e')]:_0x33e293['model'];if(_0x1c49d3[_0xdcec('0x39')]['includeAll']){_0x471434['include']=[{'all':!![]}];}_0x471434=_[_0xdcec('0x2e')]({},_0x471434,_0x1c49d3[_0xdcec('0x49')]);return db[_0xdcec('0x36')][_0xdcec('0x50')](_0x471434)[_0xdcec('0x28')](handleEntityNotFound(_0x2f52c7,null))[_0xdcec('0x28')](respondWithResult(_0x2f52c7,null))['catch'](handleError(_0x2f52c7,null));};exports[_0xdcec('0x51')]=function(_0x31797a,_0x5f5d3a){return db['SugarcrmField'][_0xdcec('0x51')](_0x31797a[_0xdcec('0x2f')],{})[_0xdcec('0x28')](respondWithResult(_0x5f5d3a,0xc9))[_0xdcec('0x52')](handleError(_0x5f5d3a,null));};exports[_0xdcec('0x27')]=function(_0x5e211f,_0x2d4c6d){if(_0x5e211f['body']['id']){delete _0x5e211f[_0xdcec('0x2f')]['id'];}return db['SugarcrmField'][_0xdcec('0x50')]({'where':{'id':_0x5e211f[_0xdcec('0x4e')]['id']}})[_0xdcec('0x28')](handleEntityNotFound(_0x2d4c6d,null))[_0xdcec('0x28')](saveUpdates(_0x5e211f[_0xdcec('0x2f')],null))[_0xdcec('0x28')](respondWithResult(_0x2d4c6d,null))[_0xdcec('0x52')](handleError(_0x2d4c6d,null));};exports[_0xdcec('0x29')]=function(_0x348839,_0x5ccc02){return db[_0xdcec('0x36')]['find']({'where':{'id':_0x348839[_0xdcec('0x4e')]['id']}})[_0xdcec('0x28')](handleEntityNotFound(_0x5ccc02,null))[_0xdcec('0x28')](removeEntity(_0x5ccc02,null))[_0xdcec('0x52')](handleError(_0x5ccc02,null));}; \ No newline at end of file +var _0x80c3=['key','map','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','eml-format','rimraf','moment','mustache','util','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','render','merge','message','interaction','account','SugarcrmField','rawAttributes','fieldName'];(function(_0x1f531c,_0x2b72ac){var _0x492387=function(_0x1e12a8){while(--_0x1e12a8){_0x1f531c['push'](_0x1f531c['shift']());}};_0x492387(++_0x2b72ac);}(_0x80c3,0xf9));var _0x380c=function(_0xaf29da,_0x117f5a){_0xaf29da=_0xaf29da-0x0;var _0x295c51=_0x80c3[_0xaf29da];return _0x295c51;};'use strict';var emlformat=require(_0x380c('0x0'));var rimraf=require(_0x380c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x380c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x380c('0x3'));var util=require(_0x380c('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x380c('0x5'));var fs=require('fs');var fs_extra=require(_0x380c('0x6'));var _=require(_0x380c('0x7'));var squel=require(_0x380c('0x8'));var crypto=require('crypto');var jsforce=require(_0x380c('0x9'));var deskjs=require(_0x380c('0xa'));var toCsv=require(_0x380c('0xb'));var querystring=require('querystring');var Papa=require(_0x380c('0xc'));var Redis=require('ioredis');var authService=require(_0x380c('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x380c('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x380c('0xf'))(_0x380c('0x10'));var utils=require(_0x380c('0x11'));var config=require(_0x380c('0x12'));var licenseUtil=require(_0x380c('0x13'));var db=require(_0x380c('0x14'))['db'];function respondWithStatusCode(_0x17677d,_0x5024ea){_0x5024ea=_0x5024ea||0xcc;return function(_0x2177f7){if(_0x2177f7){return _0x17677d[_0x380c('0x15')](_0x5024ea);}return _0x17677d['status'](_0x5024ea)[_0x380c('0x16')]();};}function respondWithResult(_0x44e892,_0x4fff9f){_0x4fff9f=_0x4fff9f||0xc8;return function(_0x244aa5){if(_0x244aa5){return _0x44e892[_0x380c('0x17')](_0x4fff9f)[_0x380c('0x18')](_0x244aa5);}};}function respondWithFilteredResult(_0x15dfd3,_0x2f6d4f){return function(_0x2a9451){if(_0x2a9451){var _0x5a2077=typeof _0x2f6d4f['offset']===_0x380c('0x19')&&typeof _0x2f6d4f[_0x380c('0x1a')]==='undefined';var _0x37023d=_0x2a9451[_0x380c('0x1b')];var _0x3e9ca6=_0x5a2077?0x0:_0x2f6d4f[_0x380c('0x1c')];var _0x48454e=_0x5a2077?_0x2a9451['count']:_0x2f6d4f['offset']+_0x2f6d4f[_0x380c('0x1a')];var _0x10bd72;if(_0x48454e>=_0x37023d){_0x48454e=_0x37023d;_0x10bd72=0xc8;}else{_0x10bd72=0xce;}_0x15dfd3[_0x380c('0x17')](_0x10bd72);return _0x15dfd3[_0x380c('0x1d')]('Content-Range',_0x3e9ca6+'-'+_0x48454e+'/'+_0x37023d)[_0x380c('0x18')](_0x2a9451);}return null;};}function patchUpdates(_0x414572){return function(_0x5d57fe){try{jsonpatch[_0x380c('0x1e')](_0x5d57fe,_0x414572,!![]);}catch(_0x2119bb){return BPromise[_0x380c('0x1f')](_0x2119bb);}return _0x5d57fe[_0x380c('0x20')]();};}function saveUpdates(_0x1bb372,_0x14ddc5){return function(_0x5dad99){if(_0x5dad99){return _0x5dad99[_0x380c('0x21')](_0x1bb372)[_0x380c('0x22')](function(_0x115eb1){return _0x115eb1;});}return null;};}function removeEntity(_0x24eebc,_0x353e0b){return function(_0x525b36){if(_0x525b36){return _0x525b36[_0x380c('0x23')]()['then'](function(){_0x24eebc[_0x380c('0x17')](0xcc)[_0x380c('0x16')]();});}};}function handleEntityNotFound(_0x1e8fe4,_0x5ddc62){return function(_0x243458){if(!_0x243458){_0x1e8fe4[_0x380c('0x15')](0x194);}return _0x243458;};}function handleError(_0x38453a,_0x397e8b){_0x397e8b=_0x397e8b||0x1f4;return function(_0x59e211){logger[_0x380c('0x24')](_0x59e211[_0x380c('0x25')]);if(_0x59e211[_0x380c('0x26')]){delete _0x59e211[_0x380c('0x26')];}_0x38453a[_0x380c('0x17')](_0x397e8b)['send'](_0x59e211);};}function getMustacheRender(_0x160ae1,_0x47bd67){return Mustache[_0x380c('0x27')](_0x160ae1,_[_0x380c('0x28')](_0x47bd67['body'],{'contact':_0x47bd67['contact'],'message':_0x47bd67[_0x380c('0x29')],'agent':_0x47bd67['agent'],'interaction':_0x47bd67[_0x380c('0x2a')],'account':_0x47bd67[_0x380c('0x2b')]}))||'';}exports['index']=function(_0x292521,_0x3c4402){var _0x1e9ca2={},_0x10b680={},_0x3b88eb={'count':0x0,'rows':[]};var _0x2434e7=_['map'](db[_0x380c('0x2c')][_0x380c('0x2d')],function(_0xa16438){return{'name':_0xa16438[_0x380c('0x2e')],'type':_0xa16438['type'][_0x380c('0x2f')]};});_0x10b680['model']=_[_0x380c('0x30')](_0x2434e7,_0x380c('0x26'));_0x10b680['query']=_[_0x380c('0x31')](_0x292521[_0x380c('0x32')]);_0x10b680[_0x380c('0x33')]=_['intersection'](_0x10b680[_0x380c('0x34')],_0x10b680[_0x380c('0x32')]);_0x1e9ca2[_0x380c('0x35')]=_['intersection'](_0x10b680[_0x380c('0x34')],qs[_0x380c('0x36')](_0x292521[_0x380c('0x32')]['fields']));_0x1e9ca2['attributes']=_0x1e9ca2[_0x380c('0x35')][_0x380c('0x37')]?_0x1e9ca2['attributes']:_0x10b680[_0x380c('0x34')];if(!_0x292521[_0x380c('0x32')][_0x380c('0x38')](_0x380c('0x39'))){_0x1e9ca2['limit']=qs[_0x380c('0x1a')](_0x292521['query'][_0x380c('0x1a')]);_0x1e9ca2['offset']=qs[_0x380c('0x1c')](_0x292521[_0x380c('0x32')][_0x380c('0x1c')]);}_0x1e9ca2[_0x380c('0x3a')]=qs[_0x380c('0x3b')](_0x292521['query']['sort']);_0x1e9ca2[_0x380c('0x3c')]=qs['filters'](_['pick'](_0x292521[_0x380c('0x32')],_0x10b680[_0x380c('0x33')]),_0x2434e7);if(_0x292521[_0x380c('0x32')]['filter']){_0x1e9ca2[_0x380c('0x3c')]=_[_0x380c('0x28')](_0x1e9ca2[_0x380c('0x3c')],{'$or':_[_0x380c('0x30')](_0x2434e7,function(_0x17a009){if(_0x17a009['type']!==_0x380c('0x3d')){var _0x39ab61={};_0x39ab61[_0x17a009[_0x380c('0x26')]]={'$like':'%'+_0x292521[_0x380c('0x32')][_0x380c('0x3e')]+'%'};return _0x39ab61;}})});}_0x1e9ca2=_[_0x380c('0x28')]({},_0x1e9ca2,_0x292521['options']);var _0x4ae30c={'where':_0x1e9ca2[_0x380c('0x3c')]};return db[_0x380c('0x2c')]['count'](_0x4ae30c)[_0x380c('0x22')](function(_0x43d571){_0x3b88eb[_0x380c('0x1b')]=_0x43d571;if(_0x292521[_0x380c('0x32')][_0x380c('0x3f')]){_0x1e9ca2[_0x380c('0x40')]=[{'all':!![]}];}return db[_0x380c('0x2c')][_0x380c('0x41')](_0x1e9ca2);})[_0x380c('0x22')](function(_0x32c420){_0x3b88eb[_0x380c('0x42')]=_0x32c420;return _0x3b88eb;})[_0x380c('0x22')](respondWithFilteredResult(_0x3c4402,_0x1e9ca2))[_0x380c('0x43')](handleError(_0x3c4402,null));};exports[_0x380c('0x44')]=function(_0x545dba,_0x25ea7e){var _0x22bb16={'raw':!![],'where':{'id':_0x545dba[_0x380c('0x45')]['id']}},_0x5abd65={};_0x5abd65[_0x380c('0x34')]=_[_0x380c('0x31')](db['SugarcrmField'][_0x380c('0x2d')]);_0x5abd65[_0x380c('0x32')]=_['keys'](_0x545dba[_0x380c('0x32')]);_0x5abd65[_0x380c('0x33')]=_['intersection'](_0x5abd65['model'],_0x5abd65[_0x380c('0x32')]);_0x22bb16[_0x380c('0x35')]=_[_0x380c('0x46')](_0x5abd65['model'],qs[_0x380c('0x36')](_0x545dba[_0x380c('0x32')][_0x380c('0x36')]));_0x22bb16[_0x380c('0x35')]=_0x22bb16['attributes'][_0x380c('0x37')]?_0x22bb16[_0x380c('0x35')]:_0x5abd65[_0x380c('0x34')];if(_0x545dba[_0x380c('0x32')]['includeAll']){_0x22bb16[_0x380c('0x40')]=[{'all':!![]}];}_0x22bb16=_[_0x380c('0x28')]({},_0x22bb16,_0x545dba['options']);return db[_0x380c('0x2c')][_0x380c('0x47')](_0x22bb16)[_0x380c('0x22')](handleEntityNotFound(_0x25ea7e,null))[_0x380c('0x22')](respondWithResult(_0x25ea7e,null))[_0x380c('0x43')](handleError(_0x25ea7e,null));};exports[_0x380c('0x48')]=function(_0x4a235f,_0x2aeca6){return db['SugarcrmField'][_0x380c('0x48')](_0x4a235f[_0x380c('0x49')],{})['then'](respondWithResult(_0x2aeca6,0xc9))['catch'](handleError(_0x2aeca6,null));};exports['update']=function(_0x2980ed,_0x352d80){if(_0x2980ed['body']['id']){delete _0x2980ed[_0x380c('0x49')]['id'];}return db[_0x380c('0x2c')][_0x380c('0x47')]({'where':{'id':_0x2980ed['params']['id']}})[_0x380c('0x22')](handleEntityNotFound(_0x352d80,null))[_0x380c('0x22')](saveUpdates(_0x2980ed['body'],null))['then'](respondWithResult(_0x352d80,null))[_0x380c('0x43')](handleError(_0x352d80,null));};exports['destroy']=function(_0x430ec7,_0x101acd){return db[_0x380c('0x2c')][_0x380c('0x47')]({'where':{'id':_0x430ec7[_0x380c('0x45')]['id']}})[_0x380c('0x22')](handleEntityNotFound(_0x101acd,null))[_0x380c('0x22')](removeEntity(_0x101acd,null))[_0x380c('0x43')](handleError(_0x101acd,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index b122883..d2bc0be 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 _0xab49=['../../config/logger','api','moment','path','rimraf','../../config/environment','./intSugarcrmField.attributes','define','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','util'];(function(_0x33ae3e,_0x1add40){var _0x3e1d9b=function(_0xfa73df){while(--_0xfa73df){_0x33ae3e['push'](_0x33ae3e['shift']());}};_0x3e1d9b(++_0x1add40);}(_0xab49,0x1eb));var _0x9ab4=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0xab49[_0x2085f3];return _0x384e3c;};'use strict';var _=require('lodash');var util=require(_0x9ab4('0x0'));var logger=require(_0x9ab4('0x1'))(_0x9ab4('0x2'));var moment=require(_0x9ab4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ab4('0x4'));var rimraf=require(_0x9ab4('0x5'));var config=require(_0x9ab4('0x6'));var attributes=require(_0x9ab4('0x7'));module['exports']=function(_0x26e681,_0x28ca58){return _0x26e681[_0x9ab4('0x8')]('SugarcrmField',attributes,{'tableName':_0x9ab4('0x9'),'paranoid':![],'indexes':[{'name':_0x9ab4('0xa'),'fields':['idField',_0x9ab4('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x42b4=['bluebird','path','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','idField','lodash','../../config/logger','api','moment'];(function(_0x19726c,_0x140544){var _0x4a5d0b=function(_0x2ba174){while(--_0x2ba174){_0x19726c['push'](_0x19726c['shift']());}};_0x4a5d0b(++_0x140544);}(_0x42b4,0x167));var _0x442b=function(_0x53aced,_0x46dace){_0x53aced=_0x53aced-0x0;var _0x5d7978=_0x42b4[_0x53aced];return _0x5d7978;};'use strict';var _=require(_0x442b('0x0'));var util=require('util');var logger=require(_0x442b('0x1'))(_0x442b('0x2'));var moment=require(_0x442b('0x3'));var BPromise=require(_0x442b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x442b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x442b('0x6'));module[_0x442b('0x7')]=function(_0x206d92,_0x5cd6d8){return _0x206d92[_0x442b('0x8')]('SugarcrmField',attributes,{'tableName':_0x442b('0x9'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x442b('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 3d1b860..227e49a 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 _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8603,0x190));var _0x3860=function(_0x244832,_0x146a08){_0x244832=_0x244832-0x0;var _0x2cc97e=_0x8603[_0x244832];return _0x2cc97e;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file +var _0x757a=['request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1d1533,_0x399bcf){var _0x13f4ce=function(_0x2ac875){while(--_0x2ac875){_0x1d1533['push'](_0x1d1533['shift']());}};_0x13f4ce(++_0x399bcf);}(_0x757a,0xde));var _0xa757=function(_0x4e4623,_0x1927e0){_0x4e4623=_0x4e4623-0x0;var _0x15fcec=_0x757a[_0x4e4623];return _0x15fcec;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 42d4889..fcf3aee 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 _0xb78f=['/:id/configurations','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id','show'];(function(_0x3d6e0b,_0x454431){var _0x4e6f9f=function(_0x3d36dc){while(--_0x3d36dc){_0x3d6e0b['push'](_0x3d6e0b['shift']());}};_0x4e6f9f(++_0x454431);}(_0xb78f,0x134));var _0xfb78=function(_0x2e2a76,_0x1a73df){_0x2e2a76=_0x2e2a76-0x0;var _0x1a4e96=_0xb78f[_0x2e2a76];return _0x1a4e96;};'use strict';var multer=require(_0xfb78('0x0'));var util=require(_0xfb78('0x1'));var path=require(_0xfb78('0x2'));var timeout=require(_0xfb78('0x3'));var express=require(_0xfb78('0x4'));var router=express[_0xfb78('0x5')]();var fs_extra=require(_0xfb78('0x6'));var auth=require(_0xfb78('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xfb78('0x8'));var controller=require(_0xfb78('0x9'));router[_0xfb78('0xa')]('/',auth['isAuthenticated'](),controller[_0xfb78('0xb')]);router[_0xfb78('0xa')](_0xfb78('0xc'),auth['isAuthenticated'](),controller[_0xfb78('0xd')]);router[_0xfb78('0xa')](_0xfb78('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0xfb78('0xf')](),controller[_0xfb78('0x10')]);router[_0xfb78('0x11')]('/',auth[_0xfb78('0xf')](),controller['create']);router[_0xfb78('0x11')](_0xfb78('0xe'),auth[_0xfb78('0xf')](),controller[_0xfb78('0x12')]);router[_0xfb78('0x13')](_0xfb78('0xc'),auth['isAuthenticated'](),controller[_0xfb78('0x14')]);router['delete'](_0xfb78('0xc'),auth[_0xfb78('0xf')](),controller[_0xfb78('0x15')]);module[_0xfb78('0x16')]=router; \ No newline at end of file +var _0x039c=['destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete'];(function(_0x3e36ce,_0x432a1c){var _0x361cd3=function(_0x3080d9){while(--_0x3080d9){_0x3e36ce['push'](_0x3e36ce['shift']());}};_0x361cd3(++_0x432a1c);}(_0x039c,0x15b));var _0xc039=function(_0x233877,_0x26ff0e){_0x233877=_0x233877-0x0;var _0x12b075=_0x039c[_0x233877];return _0x12b075;};'use strict';var multer=require('multer');var util=require(_0xc039('0x0'));var path=require(_0xc039('0x1'));var timeout=require(_0xc039('0x2'));var express=require('express');var router=express[_0xc039('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc039('0x4'));var interaction=require(_0xc039('0x5'));var config=require(_0xc039('0x6'));var controller=require(_0xc039('0x7'));router[_0xc039('0x8')]('/',auth[_0xc039('0x9')](),controller['index']);router[_0xc039('0x8')](_0xc039('0xa'),auth[_0xc039('0x9')](),controller[_0xc039('0xb')]);router['get'](_0xc039('0xc'),auth[_0xc039('0x9')](),controller[_0xc039('0xd')]);router[_0xc039('0x8')](_0xc039('0xe'),auth[_0xc039('0x9')](),controller[_0xc039('0xf')]);router[_0xc039('0x10')]('/',auth[_0xc039('0x9')](),controller['create']);router[_0xc039('0x10')](_0xc039('0xc'),auth[_0xc039('0x9')](),controller[_0xc039('0x11')]);router[_0xc039('0x12')]('/:id',auth[_0xc039('0x9')](),controller[_0xc039('0x13')]);router[_0xc039('0x14')]('/:id',auth[_0xc039('0x9')](),controller[_0xc039('0x15')]);module[_0xc039('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 ace17f8..046d897 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 _0xf5dc=['HelpDesk','STRING'];(function(_0x5cf418,_0xa039f9){var _0x2dddc8=function(_0x16402a){while(--_0x16402a){_0x5cf418['push'](_0x5cf418['shift']());}};_0x2dddc8(++_0xa039f9);}(_0xf5dc,0x117));var _0xcf5d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xf5dc[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcf5d('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xcf5d('0x0')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xcf5d('0x0')],'allowNull':![],'defaultValue':_0xcf5d('0x1')},'remoteUri':{'type':Sequelize[_0xcf5d('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xcf5d('0x0')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xcf5d('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x6358=['sequelize','exports','STRING'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x6358,0xba));var _0x8635=function(_0x286291,_0x334235){_0x286291=_0x286291-0x0;var _0x6f4e9f=_0x6358[_0x286291];return _0x6f4e9f;};'use strict';var Sequelize=require(_0x8635('0x0'));module[_0x8635('0x1')]={'name':{'type':Sequelize[_0x8635('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8635('0x2')]},'username':{'type':Sequelize[_0x8635('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8635('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x8635('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8635('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index da111a6..5abcf80 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 _0x34b7=['startsWith','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','stack','name','send','merge','contact','agent','interaction','account','index','VtigerAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','show','keys','fields','create','body','catch','find','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','addConfiguration','params','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','getFields','description','moduleName','remoteUri','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','login','token','autogenerated','remove','editable','false'];(function(_0x50e04d,_0x5e9c4e){var _0x448df3=function(_0x39ea96){while(--_0x39ea96){_0x50e04d['push'](_0x50e04d['shift']());}};_0x448df3(++_0x5e9c4e);}(_0x34b7,0x196));var _0x734b=function(_0x2a0ab3,_0xcdddf1){_0x2a0ab3=_0x2a0ab3-0x0;var _0x73f2ad=_0x34b7[_0x2a0ab3];return _0x73f2ad;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];var integrations=require(_0x734b('0x18'));var jayson=require(_0x734b('0x19'));var client=jayson[_0x734b('0x1a')][_0x734b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1c893d,_0x5a5613,_0x18fc18,_0x252510){return new BPromise(function(_0x47791c,_0xd1ab2a){var _0x19f427=_0x252510||client;return _0x19f427[_0x734b('0x1c')](_0x1c893d,_0x18fc18)[_0x734b('0x1d')](function(_0x2c03bd){logger[_0x734b('0x1e')](_0x734b('0x1f'),_0x5a5613,_0x734b('0x20'));logger['debug'](_0x734b('0x21'),_0x5a5613,_0x734b('0x20'),JSON[_0x734b('0x22')](_0x2c03bd));if(_0x2c03bd[_0x734b('0x23')]){if(_0x2c03bd['error']['code']===0x1f4){logger[_0x734b('0x23')](_0x734b('0x1f'),_0x5a5613,_0x2c03bd[_0x734b('0x23')][_0x734b('0x24')]);return _0xd1ab2a(_0x2c03bd[_0x734b('0x23')][_0x734b('0x24')]);}logger[_0x734b('0x23')](_0x734b('0x1f'),_0x5a5613,_0x2c03bd[_0x734b('0x23')][_0x734b('0x24')]);return _0x47791c(_0x2c03bd[_0x734b('0x23')][_0x734b('0x24')]);}else{logger[_0x734b('0x1e')](_0x734b('0x1f'),_0x5a5613,'request\x20sent');_0x47791c(_0x2c03bd[_0x734b('0x25')][_0x734b('0x24')]);}})['catch'](function(_0x38154d){logger[_0x734b('0x23')](_0x734b('0x1f'),_0x5a5613,_0x38154d);_0xd1ab2a(_0x38154d);});});}function respondWithStatusCode(_0x11fb8e,_0x46d432){_0x46d432=_0x46d432||0xcc;return function(_0x26d118){if(_0x26d118){return _0x11fb8e[_0x734b('0x26')](_0x46d432);}return _0x11fb8e[_0x734b('0x27')](_0x46d432)[_0x734b('0x28')]();};}function respondWithResult(_0x3abbe6,_0x44ffa9){_0x44ffa9=_0x44ffa9||0xc8;return function(_0x148abe){if(_0x148abe){return _0x3abbe6[_0x734b('0x27')](_0x44ffa9)['json'](_0x148abe);}};}function respondWithFilteredResult(_0x49732b,_0x13cc5a){return function(_0x3680a0){if(_0x3680a0){var _0x47a0a9=typeof _0x13cc5a[_0x734b('0x29')]===_0x734b('0x2a')&&typeof _0x13cc5a[_0x734b('0x2b')]===_0x734b('0x2a');var _0x43edea=_0x3680a0[_0x734b('0x2c')];var _0x3ba39c=_0x47a0a9?0x0:_0x13cc5a['offset'];var _0x1f3652=_0x47a0a9?_0x3680a0[_0x734b('0x2c')]:_0x13cc5a[_0x734b('0x29')]+_0x13cc5a[_0x734b('0x2b')];var _0x729431;if(_0x1f3652>=_0x43edea){_0x1f3652=_0x43edea;_0x729431=0xc8;}else{_0x729431=0xce;}_0x49732b[_0x734b('0x27')](_0x729431);return _0x49732b[_0x734b('0x2d')](_0x734b('0x2e'),_0x3ba39c+'-'+_0x1f3652+'/'+_0x43edea)[_0x734b('0x2f')](_0x3680a0);}return null;};}function patchUpdates(_0x3065b0){return function(_0x5dcabf){try{jsonpatch[_0x734b('0x30')](_0x5dcabf,_0x3065b0,!![]);}catch(_0x37f1a1){return BPromise['reject'](_0x37f1a1);}return _0x5dcabf[_0x734b('0x31')]();};}function saveUpdates(_0x3cfce2,_0xf4ef21){return function(_0x2fe7d5){if(_0x2fe7d5){return _0x2fe7d5[_0x734b('0x32')](_0x3cfce2)[_0x734b('0x1d')](function(_0x3e095a){return _0x3e095a;});}return null;};}function removeEntity(_0x43900b,_0x1e53fb){return function(_0x17c6e0){if(_0x17c6e0){return _0x17c6e0[_0x734b('0x33')]()[_0x734b('0x1d')](function(){_0x43900b[_0x734b('0x27')](0xcc)[_0x734b('0x28')]();});}};}function handleEntityNotFound(_0x4512fc,_0x51557f){return function(_0x2d658f){if(!_0x2d658f){_0x4512fc['sendStatus'](0x194);}return _0x2d658f;};}function handleError(_0x2ecfaa,_0x21c368){_0x21c368=_0x21c368||0x1f4;return function(_0x3413bf){logger[_0x734b('0x23')](_0x3413bf[_0x734b('0x34')]);if(_0x3413bf[_0x734b('0x35')]){delete _0x3413bf['name'];}_0x2ecfaa['status'](_0x21c368)[_0x734b('0x36')](_0x3413bf);};}function getMustacheRender(_0x5ee908,_0x3cc627){return Mustache['render'](_0x5ee908,_[_0x734b('0x37')](_0x3cc627['body'],{'contact':_0x3cc627[_0x734b('0x38')],'message':_0x3cc627['message'],'agent':_0x3cc627[_0x734b('0x39')],'interaction':_0x3cc627[_0x734b('0x3a')],'account':_0x3cc627[_0x734b('0x3b')]}))||'';}exports[_0x734b('0x3c')]=function(_0x37876a,_0x29f8d0){var _0x1e3632={},_0x54e863={},_0x4132d8={'count':0x0,'rows':[]};var _0x317d32=_['map'](db[_0x734b('0x3d')][_0x734b('0x3e')],function(_0x2bb422){return{'name':_0x2bb422[_0x734b('0x3f')],'type':_0x2bb422['type'][_0x734b('0x40')]};});_0x54e863[_0x734b('0x41')]=_['map'](_0x317d32,_0x734b('0x35'));_0x54e863[_0x734b('0x42')]=_['keys'](_0x37876a[_0x734b('0x42')]);_0x54e863[_0x734b('0x43')]=_[_0x734b('0x44')](_0x54e863[_0x734b('0x41')],_0x54e863['query']);_0x1e3632['attributes']=_[_0x734b('0x44')](_0x54e863['model'],qs['fields'](_0x37876a[_0x734b('0x42')]['fields']));_0x1e3632[_0x734b('0x45')]=_0x1e3632['attributes'][_0x734b('0x46')]?_0x1e3632[_0x734b('0x45')]:_0x54e863[_0x734b('0x41')];if(!_0x37876a['query']['hasOwnProperty'](_0x734b('0x47'))){_0x1e3632['limit']=qs['limit'](_0x37876a[_0x734b('0x42')][_0x734b('0x2b')]);_0x1e3632['offset']=qs[_0x734b('0x29')](_0x37876a['query'][_0x734b('0x29')]);}_0x1e3632[_0x734b('0x48')]=qs[_0x734b('0x49')](_0x37876a['query'][_0x734b('0x49')]);_0x1e3632[_0x734b('0x4a')]=qs[_0x734b('0x43')](_[_0x734b('0x4b')](_0x37876a['query'],_0x54e863['filters']),_0x317d32);if(_0x37876a['query'][_0x734b('0x4c')]){_0x1e3632['where']=_['merge'](_0x1e3632[_0x734b('0x4a')],{'$or':_['map'](_0x317d32,function(_0x68ea5f){if(_0x68ea5f[_0x734b('0x4d')]!==_0x734b('0x4e')){var _0x26d78e={};_0x26d78e[_0x68ea5f['name']]={'$like':'%'+_0x37876a[_0x734b('0x42')]['filter']+'%'};return _0x26d78e;}})});}_0x1e3632=_[_0x734b('0x37')]({},_0x1e3632,_0x37876a[_0x734b('0x4f')]);var _0x452532={'where':_0x1e3632['where']};return db[_0x734b('0x3d')]['count'](_0x452532)[_0x734b('0x1d')](function(_0x331a87){_0x4132d8['count']=_0x331a87;if(_0x37876a[_0x734b('0x42')][_0x734b('0x50')]){_0x1e3632[_0x734b('0x51')]=[{'all':!![]}];}return db[_0x734b('0x3d')][_0x734b('0x52')](_0x1e3632);})['then'](function(_0x1c0eaa){_0x4132d8['rows']=_0x1c0eaa;return _0x4132d8;})[_0x734b('0x1d')](respondWithFilteredResult(_0x29f8d0,_0x1e3632))['catch'](handleError(_0x29f8d0,null));};exports[_0x734b('0x53')]=function(_0xa2fd9d,_0x1a7e12){var _0x46e883={'raw':![],'where':{'id':_0xa2fd9d['params']['id']}},_0x13ed8f={};_0x13ed8f['model']=_['keys'](db[_0x734b('0x3d')][_0x734b('0x3e')]);_0x13ed8f['query']=_[_0x734b('0x54')](_0xa2fd9d[_0x734b('0x42')]);_0x13ed8f['filters']=_[_0x734b('0x44')](_0x13ed8f[_0x734b('0x41')],_0x13ed8f[_0x734b('0x42')]);_0x46e883['attributes']=_[_0x734b('0x44')](_0x13ed8f[_0x734b('0x41')],qs[_0x734b('0x55')](_0xa2fd9d[_0x734b('0x42')]['fields']));_0x46e883[_0x734b('0x45')]=_0x46e883[_0x734b('0x45')][_0x734b('0x46')]?_0x46e883[_0x734b('0x45')]:_0x13ed8f['model'];if(_0xa2fd9d[_0x734b('0x42')]['includeAll']){_0x46e883[_0x734b('0x51')]=[{'all':!![]}];}_0x46e883=_[_0x734b('0x37')]({},_0x46e883,_0xa2fd9d[_0x734b('0x4f')]);return db[_0x734b('0x3d')]['find'](_0x46e883)[_0x734b('0x1d')](handleEntityNotFound(_0x1a7e12,null))[_0x734b('0x1d')](respondWithResult(_0x1a7e12,null))['catch'](handleError(_0x1a7e12,null));};exports['create']=function(_0x145b3f,_0x577735){return db[_0x734b('0x3d')][_0x734b('0x56')](_0x145b3f[_0x734b('0x57')],{})['then'](respondWithResult(_0x577735,0xc9))[_0x734b('0x58')](handleError(_0x577735,null));};exports['update']=function(_0xfc2d8d,_0x46ece1){if(_0xfc2d8d[_0x734b('0x57')]['id']){delete _0xfc2d8d[_0x734b('0x57')]['id'];}return db['VtigerAccount'][_0x734b('0x59')]({'where':{'id':_0xfc2d8d['params']['id']}})[_0x734b('0x1d')](handleEntityNotFound(_0x46ece1,null))[_0x734b('0x1d')](saveUpdates(_0xfc2d8d[_0x734b('0x57')],null))['then'](respondWithResult(_0x46ece1,null))[_0x734b('0x58')](handleError(_0x46ece1,null));};exports['destroy']=function(_0x2c81a1,_0x17a217){return db[_0x734b('0x3d')][_0x734b('0x59')]({'where':{'id':_0x2c81a1['params']['id']}})[_0x734b('0x1d')](handleEntityNotFound(_0x17a217,null))['then'](removeEntity(_0x17a217,null))[_0x734b('0x58')](handleError(_0x17a217,null));};exports[_0x734b('0x5a')]=function(_0x2268ca,_0x4dbff2,_0x22f1ff){var _0x279ca1={};var _0x366379={};var _0x3b16bb;var _0x228f85;return db[_0x734b('0x3d')][_0x734b('0x5b')]({'where':{'id':_0x2268ca['params']['id']}})[_0x734b('0x1d')](handleEntityNotFound(_0x4dbff2,null))[_0x734b('0x1d')](function(_0x365050){if(_0x365050){_0x3b16bb=_0x365050;_0x366379['model']=_['keys'](db[_0x734b('0x5c')][_0x734b('0x3e')]);_0x366379[_0x734b('0x42')]=_[_0x734b('0x54')](_0x2268ca['query']);_0x366379['filters']=_['intersection'](_0x366379[_0x734b('0x41')],_0x366379[_0x734b('0x42')]);_0x279ca1[_0x734b('0x45')]=_[_0x734b('0x44')](_0x366379[_0x734b('0x41')],qs[_0x734b('0x55')](_0x2268ca[_0x734b('0x42')][_0x734b('0x55')]));_0x279ca1[_0x734b('0x45')]=_0x279ca1[_0x734b('0x45')][_0x734b('0x46')]?_0x279ca1[_0x734b('0x45')]:_0x366379[_0x734b('0x41')];_0x279ca1[_0x734b('0x48')]=qs[_0x734b('0x49')](_0x2268ca[_0x734b('0x42')][_0x734b('0x49')]);_0x279ca1[_0x734b('0x4a')]=qs[_0x734b('0x43')](_[_0x734b('0x4b')](_0x2268ca[_0x734b('0x42')],_0x366379['filters']));if(_0x2268ca[_0x734b('0x42')][_0x734b('0x4c')]){_0x279ca1[_0x734b('0x4a')]=_[_0x734b('0x37')](_0x279ca1[_0x734b('0x4a')],{'$or':_['map'](_0x279ca1[_0x734b('0x45')],function(_0x1da545){var _0x19fd96={};_0x19fd96[_0x1da545]={'$like':'%'+_0x2268ca[_0x734b('0x42')][_0x734b('0x4c')]+'%'};return _0x19fd96;})});}_0x279ca1=_[_0x734b('0x37')]({},_0x279ca1,_0x2268ca['options']);return _0x3b16bb['getConfigurations'](_0x279ca1);}})['then'](function(_0x5658dd){if(_0x5658dd){_0x228f85=_0x5658dd['length'];if(!_0x2268ca[_0x734b('0x42')][_0x734b('0x5d')](_0x734b('0x47'))){_0x279ca1[_0x734b('0x2b')]=qs['limit'](_0x2268ca['query'][_0x734b('0x2b')]);_0x279ca1[_0x734b('0x29')]=qs[_0x734b('0x29')](_0x2268ca[_0x734b('0x42')]['offset']);}return _0x3b16bb[_0x734b('0x5a')](_0x279ca1);}})[_0x734b('0x1d')](function(_0x200f2d){if(_0x200f2d){return _0x200f2d?{'count':_0x228f85,'rows':_0x200f2d}:null;}})[_0x734b('0x1d')](respondWithResult(_0x4dbff2,null))['catch'](handleError(_0x4dbff2,null));};exports[_0x734b('0x5e')]=function(_0x547be2,_0xec80d2,_0x4602c9){if(_0x547be2[_0x734b('0x57')]['id']){delete _0x547be2[_0x734b('0x57')]['id'];}return db[_0x734b('0x3d')]['findOne']({'where':{'id':_0x547be2[_0x734b('0x5f')]['id']}})[_0x734b('0x1d')](handleEntityNotFound(_0xec80d2,null))[_0x734b('0x1d')](function(_0xa869f5){if(_0xa869f5){_0x547be2[_0x734b('0x57')]['AccountId']=_0xa869f5['id'];_0x547be2[_0x734b('0x57')][_0x734b('0x60')]=integrations[_0x734b('0x61')](_0x547be2[_0x734b('0x57')]['channel'],_0x547be2[_0x734b('0x57')][_0x734b('0x4d')]);_0x547be2[_0x734b('0x57')][_0x734b('0x62')]=integrations[_0x734b('0x63')](_0x547be2['body'][_0x734b('0x64')],_0x547be2['body'][_0x734b('0x4d')]);return db[_0x734b('0x5c')][_0x734b('0x56')](_0x547be2[_0x734b('0x57')],{'include':[{'model':db[_0x734b('0x65')],'as':_0x734b('0x60')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xec80d2,null))[_0x734b('0x58')](handleError(_0xec80d2,null));};var md5=require('md5');exports[_0x734b('0x66')]=function(_0x3ecdb3,_0x4f3065,_0x7059c9){var _0x3ec9e1=null;var _0x17749f=null;var _0x2a3c8d=null;var _0x1d0bfb=null;var _0xfcd081='';return db[_0x734b('0x3d')][_0x734b('0x5b')]({'where':{'id':_0x3ecdb3[_0x734b('0x5f')]['id']},'attributes':['id',_0x734b('0x35'),'username',_0x734b('0x67'),_0x734b('0x68'),_0x734b('0x69'),'serverUrl',_0x734b('0x6a')]})[_0x734b('0x1d')](handleEntityNotFound(_0x4f3065,null))[_0x734b('0x1d')](function(_0x13f1fd){if(_0x13f1fd){_0x3ec9e1=_0x13f1fd[_0x734b('0x6b')];_0x17749f=_0x13f1fd[_0x734b('0x6a')];_0x2a3c8d=_0x13f1fd[_0x734b('0x68')];_0xfcd081=_0x13f1fd[_0x734b('0x69')];var _0x59694a=_0xfcd081[_0x734b('0x6c')](-0x1);if(_0x59694a==='/'){_0xfcd081=_0xfcd081[_0x734b('0x6d')](0x0,_0xfcd081[_0x734b('0x6e')](_0x59694a));}_0x1d0bfb=util[_0x734b('0x6f')](_0x734b('0x70'),_0xfcd081);var _0x18df73={'method':_0x734b('0x71'),'uri':_0x1d0bfb,'qs':{'operation':_0x734b('0x72'),'username':_0x13f1fd[_0x734b('0x6b')]},'json':!![]};return rp(_0x18df73);}})['then'](function(_0x442e6b){if(_0x442e6b[_0x734b('0x73')]){var _0x41eca7={'method':'POST','uri':_0x1d0bfb,'form':{'operation':_0x734b('0x74'),'username':_0x3ec9e1,'accessKey':md5(_0x442e6b[_0x734b('0x25')][_0x734b('0x75')]+_0x17749f)},'json':!![]};return rp(_0x41eca7);}})[_0x734b('0x1d')](function(_0x9befc7){if(_0x9befc7[_0x734b('0x73')]){var _0x516a66={'method':_0x734b('0x71'),'uri':_0x1d0bfb,'qs':{'operation':'describe','username':_0x3ec9e1,'sessionName':_0x9befc7['result']['sessionName'],'elementType':_0x2a3c8d},'json':!![]};return rp(_0x516a66);}})['then'](function(_0x5d128e){if(_0x5d128e[_0x734b('0x73')]){var _0x2d522e=[_0x734b('0x76'),'reference','owner'];_[_0x734b('0x77')](_0x5d128e['result'][_0x734b('0x55')],function(_0x33da30){return _0x2d522e['includes'](_0x33da30[_0x734b('0x4d')]['name']);});_['remove'](_0x5d128e['result'][_0x734b('0x55')],function(_0x28d272){return _0x28d272[_0x734b('0x78')]===_0x734b('0x79');});return{'count':_0x5d128e['result'][_0x734b('0x55')][_0x734b('0x46')],'rows':_['map'](_0x5d128e[_0x734b('0x25')][_0x734b('0x55')],function(_0x53327b){return{'id':_0x53327b[_0x734b('0x35')],'name':_0x53327b['label'],'custom':_[_0x734b('0x7a')](_0x53327b[_0x734b('0x35')],_0x734b('0x7b'))?!![]:![],'options':_0x53327b[_0x734b('0x4d')][_0x734b('0x35')]===_0x734b('0x7c')&&_0x53327b[_0x734b('0x4d')]['picklistValues']['length']>0x0?_['map'](_0x53327b[_0x734b('0x4d')][_0x734b('0x7d')],function(_0x562007){return{'name':_0x562007[_0x734b('0x7e')],'value':_0x562007[_0x734b('0x7f')]};}):[]};})};}})[_0x734b('0x1d')](respondWithResult(_0x4f3065,null))['catch'](function(_0x3a6c31){console[_0x734b('0x80')](_0x734b('0x81')+_0x3a6c31);var _0x4c8142=_0x3ecdb3[_0x734b('0x42')][_0x734b('0x82')]?0x1f4:_0x3a6c31[_0x734b('0x83')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4c8142,JSON[_0x734b('0x22')](_0x3a6c31));delete _0x3a6c31['name'];if(_0x4c8142===0x191){_0x4c8142=0x190;}_0x4f3065[_0x734b('0x27')](_0x4c8142)[_0x734b('0x36')](_0x3ecdb3[_0x734b('0x42')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3a6c31[_0x734b('0x83')]}:_0x3a6c31);});}; \ No newline at end of file +var _0xee5b=['../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','request','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','name','render','merge','body','contact','agent','interaction','account','VtigerAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','where','map','VIRTUAL','filter','options','includeAll','findAll','show','params','rawAttributes','include','find','create','getConfigurations','order','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','getFields','findOne','description','moduleName','accessKey','slice','substring','lastIndexOf','format','GET','username','success','POST','login','token','sessionName','autogenerated','reference','owner','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xee5b,0x1f4));var _0xbee5=function(_0x46e88b,_0x3fe459){_0x46e88b=_0x46e88b-0x0;var _0x89cc73=_0xee5b[_0x46e88b];return _0x89cc73;};'use strict';var emlformat=require(_0xbee5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbee5('0x1'));var jsonpatch=require(_0xbee5('0x2'));var rp=require('request-promise');var moment=require(_0xbee5('0x3'));var BPromise=require(_0xbee5('0x4'));var Mustache=require(_0xbee5('0x5'));var util=require(_0xbee5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbee5('0x7'));var ejs=require(_0xbee5('0x8'));var fs=require('fs');var fs_extra=require(_0xbee5('0x9'));var _=require(_0xbee5('0xa'));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(_0xbee5('0xb'));var Papa=require(_0xbee5('0xc'));var Redis=require(_0xbee5('0xd'));var authService=require(_0xbee5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbee5('0xf'));var hardwareService=require(_0xbee5('0x10'));var logger=require(_0xbee5('0x11'))(_0xbee5('0x12'));var utils=require(_0xbee5('0x13'));var config=require(_0xbee5('0x14'));var licenseUtil=require(_0xbee5('0x15'));var db=require(_0xbee5('0x16'))['db'];var integrations=require(_0xbee5('0x17'));var jayson=require('jayson/promise');var client=jayson[_0xbee5('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x183877,_0x180edd,_0x8a268f,_0x593ecb){return new BPromise(function(_0x5092f2,_0x3c6e56){var _0x4cf5a8=_0x593ecb||client;return _0x4cf5a8[_0xbee5('0x19')](_0x183877,_0x8a268f)['then'](function(_0x1a24bd){logger[_0xbee5('0x1a')](_0xbee5('0x1b'),_0x180edd,'request\x20sent');logger[_0xbee5('0x1c')](_0xbee5('0x1d'),_0x180edd,'request\x20sent',JSON[_0xbee5('0x1e')](_0x1a24bd));if(_0x1a24bd[_0xbee5('0x1f')]){if(_0x1a24bd[_0xbee5('0x1f')][_0xbee5('0x20')]===0x1f4){logger[_0xbee5('0x1f')](_0xbee5('0x1b'),_0x180edd,_0x1a24bd[_0xbee5('0x1f')][_0xbee5('0x21')]);return _0x3c6e56(_0x1a24bd[_0xbee5('0x1f')][_0xbee5('0x21')]);}logger[_0xbee5('0x1f')](_0xbee5('0x1b'),_0x180edd,_0x1a24bd[_0xbee5('0x1f')][_0xbee5('0x21')]);return _0x5092f2(_0x1a24bd[_0xbee5('0x1f')]['message']);}else{logger['info'](_0xbee5('0x1b'),_0x180edd,'request\x20sent');_0x5092f2(_0x1a24bd[_0xbee5('0x22')][_0xbee5('0x21')]);}})[_0xbee5('0x23')](function(_0x2bfb0f){logger[_0xbee5('0x1f')](_0xbee5('0x1b'),_0x180edd,_0x2bfb0f);_0x3c6e56(_0x2bfb0f);});});}function respondWithStatusCode(_0x359ccf,_0x3cfa8d){_0x3cfa8d=_0x3cfa8d||0xcc;return function(_0xc79035){if(_0xc79035){return _0x359ccf['sendStatus'](_0x3cfa8d);}return _0x359ccf['status'](_0x3cfa8d)['end']();};}function respondWithResult(_0x519473,_0x50d774){_0x50d774=_0x50d774||0xc8;return function(_0x1af3de){if(_0x1af3de){return _0x519473[_0xbee5('0x24')](_0x50d774)[_0xbee5('0x25')](_0x1af3de);}};}function respondWithFilteredResult(_0x28c74d,_0x169042){return function(_0x20e7e8){if(_0x20e7e8){var _0x3c8643=typeof _0x169042['offset']===_0xbee5('0x26')&&typeof _0x169042[_0xbee5('0x27')]===_0xbee5('0x26');var _0x39da95=_0x20e7e8[_0xbee5('0x28')];var _0x5f0419=_0x3c8643?0x0:_0x169042[_0xbee5('0x29')];var _0x15ffb1=_0x3c8643?_0x20e7e8[_0xbee5('0x28')]:_0x169042[_0xbee5('0x29')]+_0x169042[_0xbee5('0x27')];var _0x26abe3;if(_0x15ffb1>=_0x39da95){_0x15ffb1=_0x39da95;_0x26abe3=0xc8;}else{_0x26abe3=0xce;}_0x28c74d[_0xbee5('0x24')](_0x26abe3);return _0x28c74d[_0xbee5('0x2a')](_0xbee5('0x2b'),_0x5f0419+'-'+_0x15ffb1+'/'+_0x39da95)['json'](_0x20e7e8);}return null;};}function patchUpdates(_0x22df5f){return function(_0x5b10a6){try{jsonpatch[_0xbee5('0x2c')](_0x5b10a6,_0x22df5f,!![]);}catch(_0x493976){return BPromise[_0xbee5('0x2d')](_0x493976);}return _0x5b10a6['save']();};}function saveUpdates(_0x35609d,_0x5c1109){return function(_0x3220bf){if(_0x3220bf){return _0x3220bf[_0xbee5('0x2e')](_0x35609d)[_0xbee5('0x2f')](function(_0x751489){return _0x751489;});}return null;};}function removeEntity(_0x502e55,_0xefbf7c){return function(_0x17aa8d){if(_0x17aa8d){return _0x17aa8d[_0xbee5('0x30')]()[_0xbee5('0x2f')](function(){_0x502e55['status'](0xcc)[_0xbee5('0x31')]();});}};}function handleEntityNotFound(_0x28f8e3,_0x23ce3f){return function(_0x30a2fc){if(!_0x30a2fc){_0x28f8e3['sendStatus'](0x194);}return _0x30a2fc;};}function handleError(_0x1b092d,_0xe61341){_0xe61341=_0xe61341||0x1f4;return function(_0x3e854){logger[_0xbee5('0x1f')](_0x3e854['stack']);if(_0x3e854[_0xbee5('0x32')]){delete _0x3e854['name'];}_0x1b092d[_0xbee5('0x24')](_0xe61341)['send'](_0x3e854);};}function getMustacheRender(_0x5edf19,_0x59bf49){return Mustache[_0xbee5('0x33')](_0x5edf19,_[_0xbee5('0x34')](_0x59bf49[_0xbee5('0x35')],{'contact':_0x59bf49[_0xbee5('0x36')],'message':_0x59bf49[_0xbee5('0x21')],'agent':_0x59bf49[_0xbee5('0x37')],'interaction':_0x59bf49[_0xbee5('0x38')],'account':_0x59bf49[_0xbee5('0x39')]}))||'';}exports['index']=function(_0x3e99c9,_0x55f98a){var _0x30307c={},_0x16ea3e={},_0x4618e4={'count':0x0,'rows':[]};var _0x49d700=_['map'](db[_0xbee5('0x3a')]['rawAttributes'],function(_0x565e9f){return{'name':_0x565e9f[_0xbee5('0x3b')],'type':_0x565e9f[_0xbee5('0x3c')][_0xbee5('0x3d')]};});_0x16ea3e[_0xbee5('0x3e')]=_['map'](_0x49d700,_0xbee5('0x32'));_0x16ea3e[_0xbee5('0x3f')]=_[_0xbee5('0x40')](_0x3e99c9[_0xbee5('0x3f')]);_0x16ea3e[_0xbee5('0x41')]=_[_0xbee5('0x42')](_0x16ea3e[_0xbee5('0x3e')],_0x16ea3e[_0xbee5('0x3f')]);_0x30307c[_0xbee5('0x43')]=_[_0xbee5('0x42')](_0x16ea3e['model'],qs[_0xbee5('0x44')](_0x3e99c9[_0xbee5('0x3f')]['fields']));_0x30307c[_0xbee5('0x43')]=_0x30307c[_0xbee5('0x43')][_0xbee5('0x45')]?_0x30307c[_0xbee5('0x43')]:_0x16ea3e['model'];if(!_0x3e99c9['query']['hasOwnProperty'](_0xbee5('0x46'))){_0x30307c[_0xbee5('0x27')]=qs[_0xbee5('0x27')](_0x3e99c9[_0xbee5('0x3f')][_0xbee5('0x27')]);_0x30307c[_0xbee5('0x29')]=qs[_0xbee5('0x29')](_0x3e99c9[_0xbee5('0x3f')][_0xbee5('0x29')]);}_0x30307c['order']=qs['sort'](_0x3e99c9[_0xbee5('0x3f')]['sort']);_0x30307c[_0xbee5('0x47')]=qs[_0xbee5('0x41')](_['pick'](_0x3e99c9[_0xbee5('0x3f')],_0x16ea3e[_0xbee5('0x41')]),_0x49d700);if(_0x3e99c9['query']['filter']){_0x30307c[_0xbee5('0x47')]=_[_0xbee5('0x34')](_0x30307c['where'],{'$or':_[_0xbee5('0x48')](_0x49d700,function(_0x2974f6){if(_0x2974f6['type']!==_0xbee5('0x49')){var _0x382b80={};_0x382b80[_0x2974f6[_0xbee5('0x32')]]={'$like':'%'+_0x3e99c9[_0xbee5('0x3f')][_0xbee5('0x4a')]+'%'};return _0x382b80;}})});}_0x30307c=_[_0xbee5('0x34')]({},_0x30307c,_0x3e99c9[_0xbee5('0x4b')]);var _0x5c1451={'where':_0x30307c[_0xbee5('0x47')]};return db[_0xbee5('0x3a')][_0xbee5('0x28')](_0x5c1451)[_0xbee5('0x2f')](function(_0x5ba5f1){_0x4618e4[_0xbee5('0x28')]=_0x5ba5f1;if(_0x3e99c9[_0xbee5('0x3f')][_0xbee5('0x4c')]){_0x30307c['include']=[{'all':!![]}];}return db[_0xbee5('0x3a')][_0xbee5('0x4d')](_0x30307c);})['then'](function(_0x5a6cc2){_0x4618e4['rows']=_0x5a6cc2;return _0x4618e4;})[_0xbee5('0x2f')](respondWithFilteredResult(_0x55f98a,_0x30307c))['catch'](handleError(_0x55f98a,null));};exports[_0xbee5('0x4e')]=function(_0x3ae748,_0x702ce8){var _0x42542c={'raw':![],'where':{'id':_0x3ae748[_0xbee5('0x4f')]['id']}},_0x6db065={};_0x6db065['model']=_[_0xbee5('0x40')](db[_0xbee5('0x3a')][_0xbee5('0x50')]);_0x6db065[_0xbee5('0x3f')]=_['keys'](_0x3ae748[_0xbee5('0x3f')]);_0x6db065['filters']=_[_0xbee5('0x42')](_0x6db065[_0xbee5('0x3e')],_0x6db065[_0xbee5('0x3f')]);_0x42542c[_0xbee5('0x43')]=_[_0xbee5('0x42')](_0x6db065[_0xbee5('0x3e')],qs[_0xbee5('0x44')](_0x3ae748[_0xbee5('0x3f')][_0xbee5('0x44')]));_0x42542c[_0xbee5('0x43')]=_0x42542c[_0xbee5('0x43')][_0xbee5('0x45')]?_0x42542c[_0xbee5('0x43')]:_0x6db065[_0xbee5('0x3e')];if(_0x3ae748[_0xbee5('0x3f')]['includeAll']){_0x42542c[_0xbee5('0x51')]=[{'all':!![]}];}_0x42542c=_[_0xbee5('0x34')]({},_0x42542c,_0x3ae748[_0xbee5('0x4b')]);return db['VtigerAccount'][_0xbee5('0x52')](_0x42542c)[_0xbee5('0x2f')](handleEntityNotFound(_0x702ce8,null))[_0xbee5('0x2f')](respondWithResult(_0x702ce8,null))['catch'](handleError(_0x702ce8,null));};exports[_0xbee5('0x53')]=function(_0x57e5b9,_0x131c45){return db['VtigerAccount'][_0xbee5('0x53')](_0x57e5b9[_0xbee5('0x35')],{})[_0xbee5('0x2f')](respondWithResult(_0x131c45,0xc9))['catch'](handleError(_0x131c45,null));};exports['update']=function(_0x5528e8,_0x90a25a){if(_0x5528e8[_0xbee5('0x35')]['id']){delete _0x5528e8[_0xbee5('0x35')]['id'];}return db['VtigerAccount'][_0xbee5('0x52')]({'where':{'id':_0x5528e8['params']['id']}})[_0xbee5('0x2f')](handleEntityNotFound(_0x90a25a,null))[_0xbee5('0x2f')](saveUpdates(_0x5528e8[_0xbee5('0x35')],null))['then'](respondWithResult(_0x90a25a,null))[_0xbee5('0x23')](handleError(_0x90a25a,null));};exports[_0xbee5('0x30')]=function(_0x1c6f52,_0x3fa83b){return db[_0xbee5('0x3a')][_0xbee5('0x52')]({'where':{'id':_0x1c6f52[_0xbee5('0x4f')]['id']}})[_0xbee5('0x2f')](handleEntityNotFound(_0x3fa83b,null))[_0xbee5('0x2f')](removeEntity(_0x3fa83b,null))[_0xbee5('0x23')](handleError(_0x3fa83b,null));};exports[_0xbee5('0x54')]=function(_0x245521,_0x318016,_0x317b5c){var _0x2c4a4f={};var _0x143fd9={};var _0x32a8d2;var _0x524b12;return db[_0xbee5('0x3a')]['findOne']({'where':{'id':_0x245521['params']['id']}})[_0xbee5('0x2f')](handleEntityNotFound(_0x318016,null))[_0xbee5('0x2f')](function(_0x54faee){if(_0x54faee){_0x32a8d2=_0x54faee;_0x143fd9['model']=_[_0xbee5('0x40')](db['VtigerConfiguration'][_0xbee5('0x50')]);_0x143fd9[_0xbee5('0x3f')]=_['keys'](_0x245521[_0xbee5('0x3f')]);_0x143fd9[_0xbee5('0x41')]=_[_0xbee5('0x42')](_0x143fd9[_0xbee5('0x3e')],_0x143fd9['query']);_0x2c4a4f[_0xbee5('0x43')]=_['intersection'](_0x143fd9[_0xbee5('0x3e')],qs[_0xbee5('0x44')](_0x245521['query'][_0xbee5('0x44')]));_0x2c4a4f[_0xbee5('0x43')]=_0x2c4a4f['attributes'][_0xbee5('0x45')]?_0x2c4a4f[_0xbee5('0x43')]:_0x143fd9['model'];_0x2c4a4f[_0xbee5('0x55')]=qs['sort'](_0x245521[_0xbee5('0x3f')]['sort']);_0x2c4a4f[_0xbee5('0x47')]=qs['filters'](_['pick'](_0x245521[_0xbee5('0x3f')],_0x143fd9[_0xbee5('0x41')]));if(_0x245521[_0xbee5('0x3f')][_0xbee5('0x4a')]){_0x2c4a4f[_0xbee5('0x47')]=_[_0xbee5('0x34')](_0x2c4a4f['where'],{'$or':_[_0xbee5('0x48')](_0x2c4a4f[_0xbee5('0x43')],function(_0x36586a){var _0x70f14d={};_0x70f14d[_0x36586a]={'$like':'%'+_0x245521[_0xbee5('0x3f')][_0xbee5('0x4a')]+'%'};return _0x70f14d;})});}_0x2c4a4f=_[_0xbee5('0x34')]({},_0x2c4a4f,_0x245521[_0xbee5('0x4b')]);return _0x32a8d2[_0xbee5('0x54')](_0x2c4a4f);}})['then'](function(_0x35da4d){if(_0x35da4d){_0x524b12=_0x35da4d[_0xbee5('0x45')];if(!_0x245521[_0xbee5('0x3f')][_0xbee5('0x56')]('nolimit')){_0x2c4a4f[_0xbee5('0x27')]=qs[_0xbee5('0x27')](_0x245521[_0xbee5('0x3f')][_0xbee5('0x27')]);_0x2c4a4f[_0xbee5('0x29')]=qs[_0xbee5('0x29')](_0x245521[_0xbee5('0x3f')][_0xbee5('0x29')]);}return _0x32a8d2[_0xbee5('0x54')](_0x2c4a4f);}})[_0xbee5('0x2f')](function(_0x185974){if(_0x185974){return _0x185974?{'count':_0x524b12,'rows':_0x185974}:null;}})[_0xbee5('0x2f')](respondWithResult(_0x318016,null))['catch'](handleError(_0x318016,null));};exports[_0xbee5('0x57')]=function(_0x184f67,_0x522463,_0x3612ee){if(_0x184f67['body']['id']){delete _0x184f67[_0xbee5('0x35')]['id'];}return db[_0xbee5('0x3a')]['findOne']({'where':{'id':_0x184f67[_0xbee5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x522463,null))['then'](function(_0x58ca95){if(_0x58ca95){_0x184f67['body']['AccountId']=_0x58ca95['id'];_0x184f67['body'][_0xbee5('0x58')]=integrations[_0xbee5('0x59')](_0x184f67[_0xbee5('0x35')][_0xbee5('0x5a')],_0x184f67[_0xbee5('0x35')][_0xbee5('0x3c')]);_0x184f67[_0xbee5('0x35')][_0xbee5('0x5b')]=integrations[_0xbee5('0x5c')](_0x184f67[_0xbee5('0x35')][_0xbee5('0x5a')],_0x184f67[_0xbee5('0x35')]['type']);return db[_0xbee5('0x5d')][_0xbee5('0x53')](_0x184f67['body'],{'include':[{'model':db['VtigerField'],'as':_0xbee5('0x58')},{'model':db[_0xbee5('0x5e')],'as':_0xbee5('0x5b')}]});}return null;})['then'](respondWithResult(_0x522463,null))[_0xbee5('0x23')](handleError(_0x522463,null));};var md5=require(_0xbee5('0x5f'));exports[_0xbee5('0x60')]=function(_0x54e70c,_0x4d8e58,_0x529f67){var _0x3b0d82=null;var _0x185219=null;var _0x4707e6=null;var _0x13cb41=null;var _0x1d39a7='';return db[_0xbee5('0x3a')][_0xbee5('0x61')]({'where':{'id':_0x54e70c[_0xbee5('0x4f')]['id']},'attributes':['id','name','username',_0xbee5('0x62'),_0xbee5('0x63'),'remoteUri','serverUrl',_0xbee5('0x64')]})['then'](handleEntityNotFound(_0x4d8e58,null))['then'](function(_0x382cd4){if(_0x382cd4){_0x3b0d82=_0x382cd4['username'];_0x185219=_0x382cd4[_0xbee5('0x64')];_0x4707e6=_0x382cd4[_0xbee5('0x63')];_0x1d39a7=_0x382cd4['remoteUri'];var _0x16a9c7=_0x1d39a7[_0xbee5('0x65')](-0x1);if(_0x16a9c7==='/'){_0x1d39a7=_0x1d39a7[_0xbee5('0x66')](0x0,_0x1d39a7[_0xbee5('0x67')](_0x16a9c7));}_0x13cb41=util[_0xbee5('0x68')]('%s/webservice.php',_0x1d39a7);var _0x5b5603={'method':_0xbee5('0x69'),'uri':_0x13cb41,'qs':{'operation':'getchallenge','username':_0x382cd4[_0xbee5('0x6a')]},'json':!![]};return rp(_0x5b5603);}})['then'](function(_0x11142b){if(_0x11142b[_0xbee5('0x6b')]){var _0x42d198={'method':_0xbee5('0x6c'),'uri':_0x13cb41,'form':{'operation':_0xbee5('0x6d'),'username':_0x3b0d82,'accessKey':md5(_0x11142b[_0xbee5('0x22')][_0xbee5('0x6e')]+_0x185219)},'json':!![]};return rp(_0x42d198);}})[_0xbee5('0x2f')](function(_0x36b248){if(_0x36b248[_0xbee5('0x6b')]){var _0x1a07ac={'method':_0xbee5('0x69'),'uri':_0x13cb41,'qs':{'operation':'describe','username':_0x3b0d82,'sessionName':_0x36b248[_0xbee5('0x22')][_0xbee5('0x6f')],'elementType':_0x4707e6},'json':!![]};return rp(_0x1a07ac);}})[_0xbee5('0x2f')](function(_0x1585bc){if(_0x1585bc['success']){var _0x1e58f0=[_0xbee5('0x70'),_0xbee5('0x71'),_0xbee5('0x72')];_[_0xbee5('0x73')](_0x1585bc[_0xbee5('0x22')][_0xbee5('0x44')],function(_0x1486f5){return _0x1e58f0['includes'](_0x1486f5[_0xbee5('0x3c')][_0xbee5('0x32')]);});_[_0xbee5('0x73')](_0x1585bc[_0xbee5('0x22')][_0xbee5('0x44')],function(_0x20516b){return _0x20516b[_0xbee5('0x74')]===_0xbee5('0x75');});return{'count':_0x1585bc[_0xbee5('0x22')][_0xbee5('0x44')][_0xbee5('0x45')],'rows':_['map'](_0x1585bc[_0xbee5('0x22')][_0xbee5('0x44')],function(_0x5030f9){return{'id':_0x5030f9[_0xbee5('0x32')],'name':_0x5030f9[_0xbee5('0x76')],'custom':_[_0xbee5('0x77')](_0x5030f9['name'],_0xbee5('0x78'))?!![]:![],'options':_0x5030f9[_0xbee5('0x3c')][_0xbee5('0x32')]===_0xbee5('0x79')&&_0x5030f9[_0xbee5('0x3c')][_0xbee5('0x7a')][_0xbee5('0x45')]>0x0?_[_0xbee5('0x48')](_0x5030f9[_0xbee5('0x3c')][_0xbee5('0x7a')],function(_0x1f9e1d){return{'name':_0x1f9e1d[_0xbee5('0x76')],'value':_0x1f9e1d['value']};}):[]};})};}})[_0xbee5('0x2f')](respondWithResult(_0x4d8e58,null))['catch'](function(_0x5f05ad){console[_0xbee5('0x7b')](_0xbee5('0x7c')+_0x5f05ad);var _0x5aa8f7=_0x54e70c['query'][_0xbee5('0x7d')]?0x1f4:_0x5f05ad[_0xbee5('0x7e')]||0x1f4;logger[_0xbee5('0x1f')](_0xbee5('0x7f'),_0xbee5('0x60'),_0x5aa8f7,JSON[_0xbee5('0x1e')](_0x5f05ad));delete _0x5f05ad[_0xbee5('0x32')];if(_0x5aa8f7===0x191){_0x5aa8f7=0x190;}_0x4d8e58['status'](_0x5aa8f7)[_0xbee5('0x80')](_0x54e70c[_0xbee5('0x3f')][_0xbee5('0x7d')]?{'message':_0xbee5('0x81'),'statusCode':_0x5f05ad[_0xbee5('0x7e')]}:_0x5f05ad);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 1f7344c..46bae37 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 _0x6729=['api','moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0x154205,_0x1f3948){var _0x132f8d=function(_0x2bbe1f){while(--_0x2bbe1f){_0x154205['push'](_0x154205['shift']());}};_0x132f8d(++_0x1f3948);}(_0x6729,0x1d5));var _0x9672=function(_0x26b937,_0x2f900c){_0x26b937=_0x26b937-0x0;var _0x6a2604=_0x6729[_0x26b937];return _0x6a2604;};'use strict';var _=require(_0x9672('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9672('0x1'));var moment=require(_0x9672('0x2'));var BPromise=require('bluebird');var rp=require(_0x9672('0x3'));var fs=require('fs');var path=require(_0x9672('0x4'));var rimraf=require(_0x9672('0x5'));var config=require(_0x9672('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x9672('0x7'));module['exports']=function(_0xe14b32,_0x5225b2){return _0xe14b32['define'](_0x9672('0x8'),attributes,{'tableName':_0x9672('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x978a=['exports','define','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x24c06b,_0x3da583){var _0x46398a=function(_0x12d220){while(--_0x12d220){_0x24c06b['push'](_0x24c06b['shift']());}};_0x46398a(++_0x3da583);}(_0x978a,0x1bb));var _0xa978=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x978a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa978('0x0'));var util=require(_0xa978('0x1'));var logger=require(_0xa978('0x2'))('api');var moment=require(_0xa978('0x3'));var BPromise=require(_0xa978('0x4'));var rp=require(_0xa978('0x5'));var fs=require('fs');var path=require(_0xa978('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xa978('0x7')]=function(_0x53b63e,_0x5b29f4){return _0x53b63e[_0xa978('0x8')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 41a53b1..2e08bdd 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 _0xc75a=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','options','where','attributes','limit','map','include','model','stringify','ShowVtigerAccount','find','raw','then'];(function(_0x1dae5e,_0x2db058){var _0x1f497a=function(_0x2a9286){while(--_0x2a9286){_0x1dae5e['push'](_0x1dae5e['shift']());}};_0x1f497a(++_0x2db058);}(_0xc75a,0x1d4));var _0xac75=function(_0x8bb4c1,_0x2d6e53){_0x8bb4c1=_0x8bb4c1-0x0;var _0x67a6e1=_0xc75a[_0x8bb4c1];return _0x67a6e1;};'use strict';var _=require(_0xac75('0x0'));var util=require(_0xac75('0x1'));var moment=require(_0xac75('0x2'));var BPromise=require(_0xac75('0x3'));var rs=require(_0xac75('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac75('0x5'))['db'];var utils=require(_0xac75('0x6'));var logger=require(_0xac75('0x7'))(_0xac75('0x8'));var config=require(_0xac75('0x9'));var jayson=require(_0xac75('0xa'));var client=jayson['client'][_0xac75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53f9e3,_0x5ad609,_0x59f2d9){return new BPromise(function(_0x285ff7,_0xa76a){return client[_0xac75('0xc')](_0x53f9e3,_0x59f2d9)['then'](function(_0x1b99d4){logger[_0xac75('0xd')](_0xac75('0xe'),_0x5ad609,_0xac75('0xf'));logger[_0xac75('0x10')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x5ad609,_0xac75('0xf'),JSON['stringify'](_0x1b99d4));if(_0x1b99d4[_0xac75('0x11')]){if(_0x1b99d4[_0xac75('0x11')][_0xac75('0x12')]===0x1f4){logger['error'](_0xac75('0xe'),_0x5ad609,_0x1b99d4[_0xac75('0x11')][_0xac75('0x13')]);return _0xa76a(_0x1b99d4[_0xac75('0x11')][_0xac75('0x13')]);}logger[_0xac75('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x5ad609,_0x1b99d4[_0xac75('0x11')]['message']);return _0x285ff7(_0x1b99d4[_0xac75('0x11')][_0xac75('0x13')]);}else{logger[_0xac75('0xd')](_0xac75('0xe'),_0x5ad609,'request\x20sent');_0x285ff7(_0x1b99d4[_0xac75('0x14')][_0xac75('0x13')]);}})[_0xac75('0x15')](function(_0x15af13){logger[_0xac75('0x11')](_0xac75('0xe'),_0x5ad609,_0x15af13);_0xa76a(_0x15af13);});});}exports[_0xac75('0x16')]=function(_0x51d124){var _0x46ce4e=this;return new Promise(function(_0xf6573c,_0x4d6a52){return db[_0xac75('0x17')]['findAll']({'raw':_0x51d124[_0xac75('0x18')]?_0x51d124['options']['raw']===undefined?!![]:![]:!![],'where':_0x51d124['options']?_0x51d124[_0xac75('0x18')][_0xac75('0x19')]||null:null,'attributes':_0x51d124[_0xac75('0x18')]?_0x51d124['options'][_0xac75('0x1a')]||null:null,'limit':_0x51d124[_0xac75('0x18')]?_0x51d124[_0xac75('0x18')][_0xac75('0x1b')]||null:null,'include':_0x51d124[_0xac75('0x18')]?_0x51d124[_0xac75('0x18')]['include']?_[_0xac75('0x1c')](_0x51d124[_0xac75('0x18')][_0xac75('0x1d')],function(_0x528de9){return{'model':db[_0x528de9[_0xac75('0x1e')]],'as':_0x528de9['as'],'attributes':_0x528de9['attributes'],'include':_0x528de9['include']?_[_0xac75('0x1c')](_0x528de9[_0xac75('0x1d')],function(_0x51752b){return{'model':db[_0x51752b[_0xac75('0x1e')]],'as':_0x51752b['as'],'attributes':_0x51752b['attributes'],'include':_0x51752b['include']?_[_0xac75('0x1c')](_0x51752b[_0xac75('0x1d')],function(_0x5b02fb){return{'model':db[_0x5b02fb[_0xac75('0x1e')]],'as':_0x5b02fb['as'],'attributes':_0x5b02fb[_0xac75('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3106af){logger[_0xac75('0xd')](_0xac75('0x16'),_0x51d124);logger[_0xac75('0x10')](_0xac75('0x16'),_0x51d124,JSON[_0xac75('0x1f')](_0x3106af));_0xf6573c(_0x3106af);})[_0xac75('0x15')](function(_0x4d6561){logger[_0xac75('0x11')](_0xac75('0x16'),_0x4d6561[_0xac75('0x13')],_0x51d124);_0x4d6a52(_0x46ce4e[_0xac75('0x11')](0x1f4,_0x4d6561[_0xac75('0x13')]));});});};exports[_0xac75('0x20')]=function(_0x49d25b){var _0x56480b=this;return new Promise(function(_0x22cb4f,_0x1a1767){return db['VtigerAccount'][_0xac75('0x21')]({'raw':_0x49d25b[_0xac75('0x18')]?_0x49d25b[_0xac75('0x18')][_0xac75('0x22')]===undefined?!![]:![]:!![],'where':_0x49d25b[_0xac75('0x18')]?_0x49d25b[_0xac75('0x18')]['where']||null:null,'attributes':_0x49d25b[_0xac75('0x18')]?_0x49d25b[_0xac75('0x18')]['attributes']||null:null,'include':_0x49d25b['options']?_0x49d25b[_0xac75('0x18')][_0xac75('0x1d')]?_[_0xac75('0x1c')](_0x49d25b[_0xac75('0x18')][_0xac75('0x1d')],function(_0x2164e6){return{'model':db[_0x2164e6['model']],'as':_0x2164e6['as'],'attributes':_0x2164e6[_0xac75('0x1a')],'include':_0x2164e6[_0xac75('0x1d')]?_[_0xac75('0x1c')](_0x2164e6[_0xac75('0x1d')],function(_0x56af95){return{'model':db[_0x56af95[_0xac75('0x1e')]],'as':_0x56af95['as'],'attributes':_0x56af95[_0xac75('0x1a')],'include':_0x56af95[_0xac75('0x1d')]?_[_0xac75('0x1c')](_0x56af95[_0xac75('0x1d')],function(_0x5beb83){return{'model':db[_0x5beb83[_0xac75('0x1e')]],'as':_0x5beb83['as'],'attributes':_0x5beb83[_0xac75('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xac75('0x23')](function(_0x2102ae){logger[_0xac75('0xd')]('ShowVtigerAccount',_0x49d25b);logger[_0xac75('0x10')]('ShowVtigerAccount',_0x49d25b,JSON[_0xac75('0x1f')](_0x2102ae));_0x22cb4f(_0x2102ae);})[_0xac75('0x15')](function(_0xd16e33){logger[_0xac75('0x11')]('ShowVtigerAccount',_0xd16e33['message'],_0x49d25b);_0x1a1767(_0x56480b[_0xac75('0x11')](0x1f4,_0xd16e33[_0xac75('0x13')]));});});}; \ No newline at end of file +var _0xf49f=['code','message','catch','options','raw','limit','map','include','attributes','model','GetVtigerAccount','VtigerAccount','find','where','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','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','error'];(function(_0x4473be,_0x529ba7){var _0x4a2ede=function(_0x422651){while(--_0x422651){_0x4473be['push'](_0x4473be['shift']());}};_0x4a2ede(++_0x529ba7);}(_0xf49f,0x1e3));var _0xff49=function(_0x3e0b3f,_0x28d5ba){_0x3e0b3f=_0x3e0b3f-0x0;var _0x244a93=_0xf49f[_0x3e0b3f];return _0x244a93;};'use strict';var _=require(_0xff49('0x0'));var util=require(_0xff49('0x1'));var moment=require(_0xff49('0x2'));var BPromise=require(_0xff49('0x3'));var rs=require(_0xff49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xff49('0x5'));var logger=require(_0xff49('0x6'))(_0xff49('0x7'));var config=require(_0xff49('0x8'));var jayson=require(_0xff49('0x9'));var client=jayson[_0xff49('0xa')][_0xff49('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36f9c7,_0x37b623,_0x34e049){return new BPromise(function(_0x1439f8,_0x471ace){return client[_0xff49('0xc')](_0x36f9c7,_0x34e049)[_0xff49('0xd')](function(_0x35df6a){logger[_0xff49('0xe')](_0xff49('0xf'),_0x37b623,_0xff49('0x10'));logger[_0xff49('0x11')](_0xff49('0x12'),_0x37b623,_0xff49('0x10'),JSON[_0xff49('0x13')](_0x35df6a));if(_0x35df6a[_0xff49('0x14')]){if(_0x35df6a[_0xff49('0x14')][_0xff49('0x15')]===0x1f4){logger['error'](_0xff49('0xf'),_0x37b623,_0x35df6a[_0xff49('0x14')][_0xff49('0x16')]);return _0x471ace(_0x35df6a[_0xff49('0x14')]['message']);}logger[_0xff49('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x37b623,_0x35df6a['error'][_0xff49('0x16')]);return _0x1439f8(_0x35df6a[_0xff49('0x14')]['message']);}else{logger[_0xff49('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x37b623,_0xff49('0x10'));_0x1439f8(_0x35df6a['result'][_0xff49('0x16')]);}})[_0xff49('0x17')](function(_0x54a73f){logger[_0xff49('0x14')](_0xff49('0xf'),_0x37b623,_0x54a73f);_0x471ace(_0x54a73f);});});}exports['GetVtigerAccount']=function(_0x4359f9){var _0x37d2c5=this;return new Promise(function(_0x5307bb,_0x23135b){return db['VtigerAccount']['findAll']({'raw':_0x4359f9[_0xff49('0x18')]?_0x4359f9[_0xff49('0x18')][_0xff49('0x19')]===undefined?!![]:![]:!![],'where':_0x4359f9[_0xff49('0x18')]?_0x4359f9[_0xff49('0x18')]['where']||null:null,'attributes':_0x4359f9[_0xff49('0x18')]?_0x4359f9[_0xff49('0x18')]['attributes']||null:null,'limit':_0x4359f9[_0xff49('0x18')]?_0x4359f9[_0xff49('0x18')][_0xff49('0x1a')]||null:null,'include':_0x4359f9[_0xff49('0x18')]?_0x4359f9[_0xff49('0x18')]['include']?_[_0xff49('0x1b')](_0x4359f9[_0xff49('0x18')][_0xff49('0x1c')],function(_0x4e5735){return{'model':db[_0x4e5735['model']],'as':_0x4e5735['as'],'attributes':_0x4e5735[_0xff49('0x1d')],'include':_0x4e5735[_0xff49('0x1c')]?_['map'](_0x4e5735[_0xff49('0x1c')],function(_0x54c956){return{'model':db[_0x54c956['model']],'as':_0x54c956['as'],'attributes':_0x54c956[_0xff49('0x1d')],'include':_0x54c956[_0xff49('0x1c')]?_[_0xff49('0x1b')](_0x54c956[_0xff49('0x1c')],function(_0x2a0445){return{'model':db[_0x2a0445[_0xff49('0x1e')]],'as':_0x2a0445['as'],'attributes':_0x2a0445[_0xff49('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xff49('0xd')](function(_0x4d6d21){logger[_0xff49('0xe')](_0xff49('0x1f'),_0x4359f9);logger['debug'](_0xff49('0x1f'),_0x4359f9,JSON[_0xff49('0x13')](_0x4d6d21));_0x5307bb(_0x4d6d21);})[_0xff49('0x17')](function(_0x5dc1fd){logger[_0xff49('0x14')](_0xff49('0x1f'),_0x5dc1fd[_0xff49('0x16')],_0x4359f9);_0x23135b(_0x37d2c5[_0xff49('0x14')](0x1f4,_0x5dc1fd['message']));});});};exports['ShowVtigerAccount']=function(_0x945931){var _0x310db4=this;return new Promise(function(_0x6f4d42,_0x2cf45e){return db[_0xff49('0x20')][_0xff49('0x21')]({'raw':_0x945931[_0xff49('0x18')]?_0x945931[_0xff49('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x945931[_0xff49('0x18')]?_0x945931[_0xff49('0x18')][_0xff49('0x22')]||null:null,'attributes':_0x945931['options']?_0x945931['options'][_0xff49('0x1d')]||null:null,'include':_0x945931[_0xff49('0x18')]?_0x945931['options'][_0xff49('0x1c')]?_[_0xff49('0x1b')](_0x945931[_0xff49('0x18')]['include'],function(_0x3281d8){return{'model':db[_0x3281d8[_0xff49('0x1e')]],'as':_0x3281d8['as'],'attributes':_0x3281d8[_0xff49('0x1d')],'include':_0x3281d8[_0xff49('0x1c')]?_['map'](_0x3281d8['include'],function(_0x55c034){return{'model':db[_0x55c034['model']],'as':_0x55c034['as'],'attributes':_0x55c034[_0xff49('0x1d')],'include':_0x55c034['include']?_[_0xff49('0x1b')](_0x55c034[_0xff49('0x1c')],function(_0x5968e2){return{'model':db[_0x5968e2['model']],'as':_0x5968e2['as'],'attributes':_0x5968e2[_0xff49('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xff49('0xd')](function(_0x2d37fb){logger['info'](_0xff49('0x23'),_0x945931);logger[_0xff49('0x11')]('ShowVtigerAccount',_0x945931,JSON[_0xff49('0x13')](_0x2d37fb));_0x6f4d42(_0x2d37fb);})[_0xff49('0x17')](function(_0x7f1702){logger[_0xff49('0x14')](_0xff49('0x23'),_0x7f1702['message'],_0x945931);_0x2cf45e(_0x310db4['error'](0x1f4,_0x7f1702[_0xff49('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 3601b29..463374b 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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x4f3678,_0x29efeb){var _0x266faf=function(_0x5f0055){while(--_0x5f0055){_0x4f3678['push'](_0x4f3678['shift']());}};_0x266faf(++_0x29efeb);}(_0xadb5,0xad));var _0x5adb=function(_0x2ecf3d,_0x4f22c9){_0x2ecf3d=_0x2ecf3d-0x0;var _0x361431=_0xadb5[_0x2ecf3d];return _0x361431;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intVtigerConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x18a523,_0x8d7ec0){var _0x55488c=function(_0x3ed421){while(--_0x3ed421){_0x18a523['push'](_0x18a523['shift']());}};_0x55488c(++_0x8d7ec0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3c3523,_0x6cc7c){_0x3c3523=_0x3c3523-0x0;var _0xe1192d=_0x5f2f[_0x3c3523];return _0xe1192d;};'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('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 713e1af..ceae185 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 _0x6316=['sequelize','exports','STRING'];(function(_0x42c2ca,_0x29705d){var _0x58662e=function(_0x1fe752){while(--_0x1fe752){_0x42c2ca['push'](_0x42c2ca['shift']());}};_0x58662e(++_0x29705d);}(_0x6316,0xb4));var _0x6631=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6316[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x6631('0x0'));module[_0x6631('0x1')]={'name':{'type':Sequelize[_0x6631('0x2')]},'description':{'type':Sequelize[_0x6631('0x2')]}}; \ No newline at end of file +var _0xbd3d=['STRING','sequelize','exports'];(function(_0x3054b8,_0xada5fe){var _0x556ec0=function(_0x9b191c){while(--_0x9b191c){_0x3054b8['push'](_0x3054b8['shift']());}};_0x556ec0(++_0xada5fe);}(_0xbd3d,0x1ab));var _0xdbd3=function(_0x24b31a,_0x11de82){_0x24b31a=_0x24b31a-0x0;var _0x50edd8=_0xbd3d[_0x24b31a];return _0x50edd8;};'use strict';var Sequelize=require(_0xdbd3('0x0'));module[_0xdbd3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdbd3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index a3de530..029e8bd 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 _0xb145=['http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','end','status','json','offset','undefined','limit','count','set','apply','destroy','sendStatus','name','send','render','body','contact','agent','account','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','intersection','find','create','update','getFields','findOne','getSubjects','getDescriptions','VtigerField','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client'];(function(_0x369481,_0x9cb921){var _0x5746cf=function(_0x31ee5d){while(--_0x31ee5d){_0x369481['push'](_0x369481['shift']());}};_0x5746cf(++_0x9cb921);}(_0xb145,0xa3));var _0x5b14=function(_0x45fe88,_0x590ccd){_0x45fe88=_0x45fe88-0x0;var _0x5810dc=_0xb145[_0x45fe88];return _0x5810dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b14('0x0'));var zipdir=require(_0x5b14('0x1'));var jsonpatch=require(_0x5b14('0x2'));var rp=require(_0x5b14('0x3'));var moment=require(_0x5b14('0x4'));var BPromise=require(_0x5b14('0x5'));var Mustache=require(_0x5b14('0x6'));var util=require(_0x5b14('0x7'));var path=require('path');var sox=require(_0x5b14('0x8'));var csv=require(_0x5b14('0x9'));var ejs=require(_0x5b14('0xa'));var fs=require('fs');var fs_extra=require(_0x5b14('0xb'));var _=require('lodash');var squel=require(_0x5b14('0xc'));var crypto=require(_0x5b14('0xd'));var jsforce=require(_0x5b14('0xe'));var deskjs=require(_0x5b14('0xf'));var toCsv=require(_0x5b14('0x9'));var querystring=require('querystring');var Papa=require(_0x5b14('0x10'));var Redis=require(_0x5b14('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5b14('0x12'));var as=require(_0x5b14('0x13'));var hardwareService=require(_0x5b14('0x14'));var logger=require(_0x5b14('0x15'))(_0x5b14('0x16'));var utils=require('../../config/utils');var config=require(_0x5b14('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b14('0x18'))['db'];var jayson=require(_0x5b14('0x19'));var client=jayson[_0x5b14('0x1a')][_0x5b14('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x18b267,_0x40577a,_0x52ffa9,_0x27b34b){return new BPromise(function(_0x16f2a1,_0x35fb8b){var _0x1dfa26=_0x27b34b||client;return _0x1dfa26[_0x5b14('0x1c')](_0x18b267,_0x52ffa9)[_0x5b14('0x1d')](function(_0x68f695){logger[_0x5b14('0x1e')](_0x5b14('0x1f'),_0x40577a,_0x5b14('0x20'));logger[_0x5b14('0x21')](_0x5b14('0x22'),_0x40577a,'request\x20sent',JSON[_0x5b14('0x23')](_0x68f695));if(_0x68f695['error']){if(_0x68f695['error']['code']===0x1f4){logger[_0x5b14('0x24')](_0x5b14('0x1f'),_0x40577a,_0x68f695[_0x5b14('0x24')][_0x5b14('0x25')]);return _0x35fb8b(_0x68f695[_0x5b14('0x24')][_0x5b14('0x25')]);}logger[_0x5b14('0x24')]('VtigerConfiguration,\x20%s,\x20%s',_0x40577a,_0x68f695['error']['message']);return _0x16f2a1(_0x68f695[_0x5b14('0x24')][_0x5b14('0x25')]);}else{logger[_0x5b14('0x1e')](_0x5b14('0x1f'),_0x40577a,'request\x20sent');_0x16f2a1(_0x68f695[_0x5b14('0x26')][_0x5b14('0x25')]);}})['catch'](function(_0x2d7b38){logger[_0x5b14('0x24')]('VtigerConfiguration,\x20%s,\x20%s',_0x40577a,_0x2d7b38);_0x35fb8b(_0x2d7b38);});});}function respondWithStatusCode(_0x33a293,_0x54073f){_0x54073f=_0x54073f||0xcc;return function(_0x59282c){if(_0x59282c){return _0x33a293['sendStatus'](_0x54073f);}return _0x33a293['status'](_0x54073f)[_0x5b14('0x27')]();};}function respondWithResult(_0x2d5f56,_0x153a25){_0x153a25=_0x153a25||0xc8;return function(_0x5da505){if(_0x5da505){return _0x2d5f56[_0x5b14('0x28')](_0x153a25)[_0x5b14('0x29')](_0x5da505);}};}function respondWithFilteredResult(_0x2ac7b0,_0x143648){return function(_0xe6851b){if(_0xe6851b){var _0x1bbbd7=typeof _0x143648[_0x5b14('0x2a')]===_0x5b14('0x2b')&&typeof _0x143648[_0x5b14('0x2c')]===_0x5b14('0x2b');var _0xbe39bc=_0xe6851b[_0x5b14('0x2d')];var _0x1c3c52=_0x1bbbd7?0x0:_0x143648[_0x5b14('0x2a')];var _0x4cfd66=_0x1bbbd7?_0xe6851b[_0x5b14('0x2d')]:_0x143648[_0x5b14('0x2a')]+_0x143648['limit'];var _0x4ecf7c;if(_0x4cfd66>=_0xbe39bc){_0x4cfd66=_0xbe39bc;_0x4ecf7c=0xc8;}else{_0x4ecf7c=0xce;}_0x2ac7b0[_0x5b14('0x28')](_0x4ecf7c);return _0x2ac7b0[_0x5b14('0x2e')]('Content-Range',_0x1c3c52+'-'+_0x4cfd66+'/'+_0xbe39bc)['json'](_0xe6851b);}return null;};}function patchUpdates(_0x21b43b){return function(_0x4d3905){try{jsonpatch[_0x5b14('0x2f')](_0x4d3905,_0x21b43b,!![]);}catch(_0x3d317b){return BPromise['reject'](_0x3d317b);}return _0x4d3905['save']();};}function saveUpdates(_0x2ead60,_0x3bf143){return function(_0x185bdf){if(_0x185bdf){return _0x185bdf['update'](_0x2ead60)[_0x5b14('0x1d')](function(_0x5a5393){return _0x5a5393;});}return null;};}function removeEntity(_0x364658,_0x291c92){return function(_0x3f3c5f){if(_0x3f3c5f){return _0x3f3c5f[_0x5b14('0x30')]()['then'](function(){_0x364658[_0x5b14('0x28')](0xcc)[_0x5b14('0x27')]();});}};}function handleEntityNotFound(_0x2a1aa7,_0x37f62c){return function(_0x5a3a43){if(!_0x5a3a43){_0x2a1aa7[_0x5b14('0x31')](0x194);}return _0x5a3a43;};}function handleError(_0x3a11a2,_0x17bd9f){_0x17bd9f=_0x17bd9f||0x1f4;return function(_0x5604d5){logger[_0x5b14('0x24')](_0x5604d5['stack']);if(_0x5604d5[_0x5b14('0x32')]){delete _0x5604d5[_0x5b14('0x32')];}_0x3a11a2['status'](_0x17bd9f)[_0x5b14('0x33')](_0x5604d5);};}function getMustacheRender(_0x2a83d4,_0x5643c1){return Mustache[_0x5b14('0x34')](_0x2a83d4,_['merge'](_0x5643c1[_0x5b14('0x35')],{'contact':_0x5643c1[_0x5b14('0x36')],'message':_0x5643c1[_0x5b14('0x25')],'agent':_0x5643c1[_0x5b14('0x37')],'interaction':_0x5643c1['interaction'],'account':_0x5643c1[_0x5b14('0x38')]}))||'';}exports[_0x5b14('0x39')]=function(_0x15d4c4,_0x228fe2){var _0x2f8714={},_0x2428b0={},_0x30888f={'count':0x0,'rows':[]};var _0x28dfe6=_[_0x5b14('0x3a')](db[_0x5b14('0x3b')][_0x5b14('0x3c')],function(_0x3f9d1d){return{'name':_0x3f9d1d[_0x5b14('0x3d')],'type':_0x3f9d1d[_0x5b14('0x3e')][_0x5b14('0x3f')]};});_0x2428b0[_0x5b14('0x40')]=_['map'](_0x28dfe6,_0x5b14('0x32'));_0x2428b0['query']=_[_0x5b14('0x41')](_0x15d4c4[_0x5b14('0x42')]);_0x2428b0['filters']=_['intersection'](_0x2428b0['model'],_0x2428b0[_0x5b14('0x42')]);_0x2f8714[_0x5b14('0x43')]=_['intersection'](_0x2428b0[_0x5b14('0x40')],qs[_0x5b14('0x44')](_0x15d4c4[_0x5b14('0x42')][_0x5b14('0x44')]));_0x2f8714[_0x5b14('0x43')]=_0x2f8714['attributes'][_0x5b14('0x45')]?_0x2f8714[_0x5b14('0x43')]:_0x2428b0['model'];if(!_0x15d4c4[_0x5b14('0x42')][_0x5b14('0x46')](_0x5b14('0x47'))){_0x2f8714[_0x5b14('0x2c')]=qs['limit'](_0x15d4c4[_0x5b14('0x42')][_0x5b14('0x2c')]);_0x2f8714[_0x5b14('0x2a')]=qs[_0x5b14('0x2a')](_0x15d4c4['query'][_0x5b14('0x2a')]);}_0x2f8714[_0x5b14('0x48')]=qs[_0x5b14('0x49')](_0x15d4c4[_0x5b14('0x42')]['sort']);_0x2f8714['where']=qs[_0x5b14('0x4a')](_[_0x5b14('0x4b')](_0x15d4c4['query'],_0x2428b0[_0x5b14('0x4a')]),_0x28dfe6);if(_0x15d4c4['query'][_0x5b14('0x4c')]){_0x2f8714[_0x5b14('0x4d')]=_[_0x5b14('0x4e')](_0x2f8714[_0x5b14('0x4d')],{'$or':_[_0x5b14('0x3a')](_0x28dfe6,function(_0x557ff4){if(_0x557ff4[_0x5b14('0x3e')]!==_0x5b14('0x4f')){var _0x285881={};_0x285881[_0x557ff4[_0x5b14('0x32')]]={'$like':'%'+_0x15d4c4[_0x5b14('0x42')]['filter']+'%'};return _0x285881;}})});}_0x2f8714=_['merge']({},_0x2f8714,_0x15d4c4[_0x5b14('0x50')]);var _0x51af0f={'where':_0x2f8714['where']};return db['VtigerConfiguration'][_0x5b14('0x2d')](_0x51af0f)[_0x5b14('0x1d')](function(_0x1fcea6){_0x30888f[_0x5b14('0x2d')]=_0x1fcea6;if(_0x15d4c4[_0x5b14('0x42')][_0x5b14('0x51')]){_0x2f8714[_0x5b14('0x52')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x2f8714);})['then'](function(_0x5d3ce6){_0x30888f['rows']=_0x5d3ce6;return _0x30888f;})[_0x5b14('0x1d')](respondWithFilteredResult(_0x228fe2,_0x2f8714))[_0x5b14('0x53')](handleError(_0x228fe2,null));};exports[_0x5b14('0x54')]=function(_0x5ad24d,_0x2547d6){var _0x56dda8={'raw':![],'where':{'id':_0x5ad24d[_0x5b14('0x55')]['id']}},_0x47af7b={};_0x47af7b[_0x5b14('0x40')]=_['keys'](db[_0x5b14('0x3b')][_0x5b14('0x3c')]);_0x47af7b['query']=_['keys'](_0x5ad24d[_0x5b14('0x42')]);_0x47af7b[_0x5b14('0x4a')]=_[_0x5b14('0x56')](_0x47af7b['model'],_0x47af7b[_0x5b14('0x42')]);_0x56dda8[_0x5b14('0x43')]=_[_0x5b14('0x56')](_0x47af7b[_0x5b14('0x40')],qs[_0x5b14('0x44')](_0x5ad24d[_0x5b14('0x42')][_0x5b14('0x44')]));_0x56dda8['attributes']=_0x56dda8[_0x5b14('0x43')]['length']?_0x56dda8[_0x5b14('0x43')]:_0x47af7b[_0x5b14('0x40')];if(_0x5ad24d[_0x5b14('0x42')][_0x5b14('0x51')]){_0x56dda8[_0x5b14('0x52')]=[{'all':!![]}];}_0x56dda8=_[_0x5b14('0x4e')]({},_0x56dda8,_0x5ad24d[_0x5b14('0x50')]);return db[_0x5b14('0x3b')][_0x5b14('0x57')](_0x56dda8)[_0x5b14('0x1d')](handleEntityNotFound(_0x2547d6,null))[_0x5b14('0x1d')](respondWithResult(_0x2547d6,null))[_0x5b14('0x53')](handleError(_0x2547d6,null));};exports['create']=function(_0x59326e,_0x4d1a88){return db[_0x5b14('0x3b')][_0x5b14('0x58')](_0x59326e[_0x5b14('0x35')],{})[_0x5b14('0x1d')](respondWithResult(_0x4d1a88,0xc9))[_0x5b14('0x53')](handleError(_0x4d1a88,null));};exports[_0x5b14('0x59')]=function(_0x1ad816,_0x4a4c77){if(_0x1ad816[_0x5b14('0x35')]['id']){delete _0x1ad816[_0x5b14('0x35')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x1ad816[_0x5b14('0x55')]['id']}})[_0x5b14('0x1d')](handleEntityNotFound(_0x4a4c77,null))[_0x5b14('0x1d')](saveUpdates(_0x1ad816[_0x5b14('0x35')],null))[_0x5b14('0x1d')](respondWithResult(_0x4a4c77,null))[_0x5b14('0x53')](handleError(_0x4a4c77,null));};exports['destroy']=function(_0x2629ad,_0x48ffb3){return db[_0x5b14('0x3b')]['find']({'where':{'id':_0x2629ad[_0x5b14('0x55')]['id']}})[_0x5b14('0x1d')](handleEntityNotFound(_0x48ffb3,null))[_0x5b14('0x1d')](removeEntity(_0x48ffb3,null))['catch'](handleError(_0x48ffb3,null));};exports[_0x5b14('0x5a')]=function(_0x566063,_0x2975bb,_0x2b4f44){var _0xe8343f={};var _0x5ac9a5={};var _0xe18ccf;var _0x1e4539;return db[_0x5b14('0x3b')][_0x5b14('0x5b')]({'where':{'id':_0x566063['params']['id']}})[_0x5b14('0x1d')](handleEntityNotFound(_0x2975bb,null))['then'](function(_0x259da7){if(_0x259da7){_0xe18ccf=_0x259da7;_0x5ac9a5[_0x5b14('0x40')]=_['keys'](db['VtigerField'][_0x5b14('0x3c')]);_0x5ac9a5[_0x5b14('0x42')]=_[_0x5b14('0x41')](_0x566063['query']);_0x5ac9a5[_0x5b14('0x4a')]=_[_0x5b14('0x56')](_0x5ac9a5['model'],_0x5ac9a5[_0x5b14('0x42')]);_0xe8343f[_0x5b14('0x43')]=_[_0x5b14('0x56')](_0x5ac9a5[_0x5b14('0x40')],qs[_0x5b14('0x44')](_0x566063['query'][_0x5b14('0x44')]));_0xe8343f[_0x5b14('0x43')]=_0xe8343f['attributes']['length']?_0xe8343f[_0x5b14('0x43')]:_0x5ac9a5[_0x5b14('0x40')];_0xe8343f['order']=qs['sort'](_0x566063[_0x5b14('0x42')][_0x5b14('0x49')]);_0xe8343f[_0x5b14('0x4d')]=qs['filters'](_[_0x5b14('0x4b')](_0x566063[_0x5b14('0x42')],_0x5ac9a5[_0x5b14('0x4a')]));if(_0x566063['query'][_0x5b14('0x4c')]){_0xe8343f[_0x5b14('0x4d')]=_[_0x5b14('0x4e')](_0xe8343f['where'],{'$or':_[_0x5b14('0x3a')](_0xe8343f[_0x5b14('0x43')],function(_0x215072){var _0x2ca6dd={};_0x2ca6dd[_0x215072]={'$like':'%'+_0x566063[_0x5b14('0x42')][_0x5b14('0x4c')]+'%'};return _0x2ca6dd;})});}_0xe8343f=_[_0x5b14('0x4e')]({},_0xe8343f,_0x566063['options']);return _0xe18ccf['getFields'](_0xe8343f);}})['then'](function(_0x4e33f1){if(_0x4e33f1){_0x1e4539=_0x4e33f1[_0x5b14('0x45')];if(!_0x566063[_0x5b14('0x42')][_0x5b14('0x46')](_0x5b14('0x47'))){_0xe8343f[_0x5b14('0x2c')]=qs['limit'](_0x566063['query'][_0x5b14('0x2c')]);_0xe8343f[_0x5b14('0x2a')]=qs[_0x5b14('0x2a')](_0x566063[_0x5b14('0x42')][_0x5b14('0x2a')]);}return _0xe18ccf['getFields'](_0xe8343f);}})['then'](function(_0x1dded6){if(_0x1dded6){return _0x1dded6?{'count':_0x1e4539,'rows':_0x1dded6}:null;}})[_0x5b14('0x1d')](respondWithResult(_0x2975bb,null))[_0x5b14('0x53')](handleError(_0x2975bb,null));};exports[_0x5b14('0x5c')]=function(_0x18de83,_0x1c464f,_0x221759){var _0x29bf88={};var _0x334792={};var _0x56fb17;var _0x18960b;return db['VtigerConfiguration'][_0x5b14('0x5b')]({'where':{'id':_0x18de83[_0x5b14('0x55')]['id']}})[_0x5b14('0x1d')](handleEntityNotFound(_0x1c464f,null))[_0x5b14('0x1d')](function(_0x4665d7){if(_0x4665d7){_0x56fb17=_0x4665d7;_0x334792[_0x5b14('0x40')]=_[_0x5b14('0x41')](db['VtigerField']['rawAttributes']);_0x334792[_0x5b14('0x42')]=_[_0x5b14('0x41')](_0x18de83[_0x5b14('0x42')]);_0x334792[_0x5b14('0x4a')]=_[_0x5b14('0x56')](_0x334792['model'],_0x334792[_0x5b14('0x42')]);_0x29bf88[_0x5b14('0x43')]=_[_0x5b14('0x56')](_0x334792[_0x5b14('0x40')],qs[_0x5b14('0x44')](_0x18de83[_0x5b14('0x42')][_0x5b14('0x44')]));_0x29bf88[_0x5b14('0x43')]=_0x29bf88[_0x5b14('0x43')][_0x5b14('0x45')]?_0x29bf88['attributes']:_0x334792['model'];_0x29bf88[_0x5b14('0x48')]=qs[_0x5b14('0x49')](_0x18de83['query'][_0x5b14('0x49')]);_0x29bf88[_0x5b14('0x4d')]=qs[_0x5b14('0x4a')](_[_0x5b14('0x4b')](_0x18de83['query'],_0x334792[_0x5b14('0x4a')]));if(_0x18de83[_0x5b14('0x42')][_0x5b14('0x4c')]){_0x29bf88[_0x5b14('0x4d')]=_[_0x5b14('0x4e')](_0x29bf88[_0x5b14('0x4d')],{'$or':_[_0x5b14('0x3a')](_0x29bf88['attributes'],function(_0x4b0e12){var _0x516b50={};_0x516b50[_0x4b0e12]={'$like':'%'+_0x18de83[_0x5b14('0x42')][_0x5b14('0x4c')]+'%'};return _0x516b50;})});}_0x29bf88=_[_0x5b14('0x4e')]({},_0x29bf88,_0x18de83[_0x5b14('0x50')]);return _0x56fb17[_0x5b14('0x5c')](_0x29bf88);}})[_0x5b14('0x1d')](function(_0x324b4d){if(_0x324b4d){_0x18960b=_0x324b4d[_0x5b14('0x45')];if(!_0x18de83[_0x5b14('0x42')][_0x5b14('0x46')](_0x5b14('0x47'))){_0x29bf88['limit']=qs[_0x5b14('0x2c')](_0x18de83[_0x5b14('0x42')][_0x5b14('0x2c')]);_0x29bf88[_0x5b14('0x2a')]=qs['offset'](_0x18de83[_0x5b14('0x42')][_0x5b14('0x2a')]);}return _0x56fb17[_0x5b14('0x5c')](_0x29bf88);}})[_0x5b14('0x1d')](function(_0x27fe05){if(_0x27fe05){return _0x27fe05?{'count':_0x18960b,'rows':_0x27fe05}:null;}})[_0x5b14('0x1d')](respondWithResult(_0x1c464f,null))[_0x5b14('0x53')](handleError(_0x1c464f,null));};exports[_0x5b14('0x5d')]=function(_0x189368,_0x16045a,_0x2bc863){var _0x100d1e={};var _0xe047e0={};var _0x261d24;var _0xd583b2;return db['VtigerConfiguration'][_0x5b14('0x5b')]({'where':{'id':_0x189368[_0x5b14('0x55')]['id']}})[_0x5b14('0x1d')](handleEntityNotFound(_0x16045a,null))[_0x5b14('0x1d')](function(_0x6cabb5){if(_0x6cabb5){_0x261d24=_0x6cabb5;_0xe047e0['model']=_['keys'](db[_0x5b14('0x5e')]['rawAttributes']);_0xe047e0[_0x5b14('0x42')]=_[_0x5b14('0x41')](_0x189368[_0x5b14('0x42')]);_0xe047e0[_0x5b14('0x4a')]=_[_0x5b14('0x56')](_0xe047e0[_0x5b14('0x40')],_0xe047e0['query']);_0x100d1e[_0x5b14('0x43')]=_['intersection'](_0xe047e0['model'],qs[_0x5b14('0x44')](_0x189368[_0x5b14('0x42')][_0x5b14('0x44')]));_0x100d1e['attributes']=_0x100d1e['attributes']['length']?_0x100d1e['attributes']:_0xe047e0[_0x5b14('0x40')];_0x100d1e[_0x5b14('0x48')]=qs[_0x5b14('0x49')](_0x189368['query']['sort']);_0x100d1e[_0x5b14('0x4d')]=qs[_0x5b14('0x4a')](_['pick'](_0x189368[_0x5b14('0x42')],_0xe047e0[_0x5b14('0x4a')]));if(_0x189368['query']['filter']){_0x100d1e['where']=_['merge'](_0x100d1e[_0x5b14('0x4d')],{'$or':_['map'](_0x100d1e[_0x5b14('0x43')],function(_0x7de41b){var _0x578df9={};_0x578df9[_0x7de41b]={'$like':'%'+_0x189368[_0x5b14('0x42')]['filter']+'%'};return _0x578df9;})});}_0x100d1e=_[_0x5b14('0x4e')]({},_0x100d1e,_0x189368['options']);return _0x261d24[_0x5b14('0x5d')](_0x100d1e);}})[_0x5b14('0x1d')](function(_0x52df2d){if(_0x52df2d){_0xd583b2=_0x52df2d[_0x5b14('0x45')];if(!_0x189368[_0x5b14('0x42')][_0x5b14('0x46')](_0x5b14('0x47'))){_0x100d1e['limit']=qs[_0x5b14('0x2c')](_0x189368[_0x5b14('0x42')]['limit']);_0x100d1e[_0x5b14('0x2a')]=qs[_0x5b14('0x2a')](_0x189368[_0x5b14('0x42')]['offset']);}return _0x261d24[_0x5b14('0x5d')](_0x100d1e);}})[_0x5b14('0x1d')](function(_0xe32822){if(_0xe32822){return _0xe32822?{'count':_0xd583b2,'rows':_0xe32822}:null;}})['then'](respondWithResult(_0x16045a,null))[_0x5b14('0x53')](handleError(_0x16045a,null));}; \ No newline at end of file +var _0x8ace=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','offset','undefined','count','limit','Content-Range','save','update','sendStatus','stack','name','send','merge','body','agent','interaction','account','map','VtigerConfiguration','rawAttributes','fieldName','type','filters','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','rows','params','keys','length','options','find','destroy','findOne','VtigerField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x53995f,_0x1b135c){_0x53995f=_0x53995f-0x0;var _0x1649a9=_0x8ace[_0x53995f];return _0x1649a9;};'use strict';var emlformat=require(_0xe8ac('0x0'));var rimraf=require(_0xe8ac('0x1'));var zipdir=require(_0xe8ac('0x2'));var jsonpatch=require(_0xe8ac('0x3'));var rp=require(_0xe8ac('0x4'));var moment=require(_0xe8ac('0x5'));var BPromise=require(_0xe8ac('0x6'));var Mustache=require(_0xe8ac('0x7'));var util=require(_0xe8ac('0x8'));var path=require(_0xe8ac('0x9'));var sox=require(_0xe8ac('0xa'));var csv=require(_0xe8ac('0xb'));var ejs=require(_0xe8ac('0xc'));var fs=require('fs');var fs_extra=require(_0xe8ac('0xd'));var _=require('lodash');var squel=require(_0xe8ac('0xe'));var crypto=require(_0xe8ac('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe8ac('0xb'));var querystring=require('querystring');var Papa=require(_0xe8ac('0x10'));var Redis=require(_0xe8ac('0x11'));var authService=require(_0xe8ac('0x12'));var qs=require(_0xe8ac('0x13'));var as=require(_0xe8ac('0x14'));var hardwareService=require(_0xe8ac('0x15'));var logger=require('../../config/logger')(_0xe8ac('0x16'));var utils=require(_0xe8ac('0x17'));var config=require(_0xe8ac('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe8ac('0x19'))['db'];var jayson=require(_0xe8ac('0x1a'));var client=jayson['client'][_0xe8ac('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2d2935,_0x383fe0,_0x101b33,_0x268f61){return new BPromise(function(_0x317078,_0x1be138){var _0x10609d=_0x268f61||client;return _0x10609d[_0xe8ac('0x1c')](_0x2d2935,_0x101b33)[_0xe8ac('0x1d')](function(_0x5e4495){logger[_0xe8ac('0x1e')](_0xe8ac('0x1f'),_0x383fe0,'request\x20sent');logger[_0xe8ac('0x20')](_0xe8ac('0x21'),_0x383fe0,_0xe8ac('0x22'),JSON[_0xe8ac('0x23')](_0x5e4495));if(_0x5e4495[_0xe8ac('0x24')]){if(_0x5e4495[_0xe8ac('0x24')]['code']===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x383fe0,_0x5e4495[_0xe8ac('0x24')][_0xe8ac('0x25')]);return _0x1be138(_0x5e4495['error'][_0xe8ac('0x25')]);}logger['error'](_0xe8ac('0x1f'),_0x383fe0,_0x5e4495[_0xe8ac('0x24')]['message']);return _0x317078(_0x5e4495[_0xe8ac('0x24')][_0xe8ac('0x25')]);}else{logger[_0xe8ac('0x1e')](_0xe8ac('0x1f'),_0x383fe0,'request\x20sent');_0x317078(_0x5e4495[_0xe8ac('0x26')]['message']);}})[_0xe8ac('0x27')](function(_0x3933d2){logger[_0xe8ac('0x24')](_0xe8ac('0x1f'),_0x383fe0,_0x3933d2);_0x1be138(_0x3933d2);});});}function respondWithStatusCode(_0x36108c,_0x31956a){_0x31956a=_0x31956a||0xcc;return function(_0x38565d){if(_0x38565d){return _0x36108c['sendStatus'](_0x31956a);}return _0x36108c[_0xe8ac('0x28')](_0x31956a)[_0xe8ac('0x29')]();};}function respondWithResult(_0x183dbf,_0x7c3450){_0x7c3450=_0x7c3450||0xc8;return function(_0x340ae0){if(_0x340ae0){return _0x183dbf[_0xe8ac('0x28')](_0x7c3450)[_0xe8ac('0x2a')](_0x340ae0);}};}function respondWithFilteredResult(_0x3e3fc2,_0x44b07c){return function(_0x562e44){if(_0x562e44){var _0x5a1b69=typeof _0x44b07c[_0xe8ac('0x2b')]===_0xe8ac('0x2c')&&typeof _0x44b07c['limit']===_0xe8ac('0x2c');var _0x5948aa=_0x562e44['count'];var _0x4c1d08=_0x5a1b69?0x0:_0x44b07c[_0xe8ac('0x2b')];var _0x41294e=_0x5a1b69?_0x562e44[_0xe8ac('0x2d')]:_0x44b07c[_0xe8ac('0x2b')]+_0x44b07c[_0xe8ac('0x2e')];var _0x41ffe8;if(_0x41294e>=_0x5948aa){_0x41294e=_0x5948aa;_0x41ffe8=0xc8;}else{_0x41ffe8=0xce;}_0x3e3fc2[_0xe8ac('0x28')](_0x41ffe8);return _0x3e3fc2['set'](_0xe8ac('0x2f'),_0x4c1d08+'-'+_0x41294e+'/'+_0x5948aa)['json'](_0x562e44);}return null;};}function patchUpdates(_0x2aef04){return function(_0x5c4089){try{jsonpatch['apply'](_0x5c4089,_0x2aef04,!![]);}catch(_0x5d7337){return BPromise['reject'](_0x5d7337);}return _0x5c4089[_0xe8ac('0x30')]();};}function saveUpdates(_0x2ca924,_0x301548){return function(_0x29b92f){if(_0x29b92f){return _0x29b92f[_0xe8ac('0x31')](_0x2ca924)[_0xe8ac('0x1d')](function(_0x312743){return _0x312743;});}return null;};}function removeEntity(_0x553753,_0x1cacb0){return function(_0x539fad){if(_0x539fad){return _0x539fad['destroy']()['then'](function(){_0x553753[_0xe8ac('0x28')](0xcc)[_0xe8ac('0x29')]();});}};}function handleEntityNotFound(_0xc68a5f,_0x56feff){return function(_0x4a323a){if(!_0x4a323a){_0xc68a5f[_0xe8ac('0x32')](0x194);}return _0x4a323a;};}function handleError(_0x2e95c4,_0x307f67){_0x307f67=_0x307f67||0x1f4;return function(_0x2850a7){logger['error'](_0x2850a7[_0xe8ac('0x33')]);if(_0x2850a7[_0xe8ac('0x34')]){delete _0x2850a7[_0xe8ac('0x34')];}_0x2e95c4[_0xe8ac('0x28')](_0x307f67)[_0xe8ac('0x35')](_0x2850a7);};}function getMustacheRender(_0x9e5777,_0x46e88c){return Mustache['render'](_0x9e5777,_[_0xe8ac('0x36')](_0x46e88c[_0xe8ac('0x37')],{'contact':_0x46e88c['contact'],'message':_0x46e88c[_0xe8ac('0x25')],'agent':_0x46e88c[_0xe8ac('0x38')],'interaction':_0x46e88c[_0xe8ac('0x39')],'account':_0x46e88c[_0xe8ac('0x3a')]}))||'';}exports['index']=function(_0x97e206,_0x5e63b3){var _0x5cfcb6={},_0x28f061={},_0x21d397={'count':0x0,'rows':[]};var _0x2d1150=_[_0xe8ac('0x3b')](db[_0xe8ac('0x3c')][_0xe8ac('0x3d')],function(_0x78f1ea){return{'name':_0x78f1ea[_0xe8ac('0x3e')],'type':_0x78f1ea[_0xe8ac('0x3f')]['key']};});_0x28f061['model']=_[_0xe8ac('0x3b')](_0x2d1150,_0xe8ac('0x34'));_0x28f061['query']=_['keys'](_0x97e206['query']);_0x28f061[_0xe8ac('0x40')]=_[_0xe8ac('0x41')](_0x28f061[_0xe8ac('0x42')],_0x28f061[_0xe8ac('0x43')]);_0x5cfcb6['attributes']=_[_0xe8ac('0x41')](_0x28f061[_0xe8ac('0x42')],qs['fields'](_0x97e206[_0xe8ac('0x43')][_0xe8ac('0x44')]));_0x5cfcb6[_0xe8ac('0x45')]=_0x5cfcb6[_0xe8ac('0x45')]['length']?_0x5cfcb6['attributes']:_0x28f061['model'];if(!_0x97e206[_0xe8ac('0x43')][_0xe8ac('0x46')](_0xe8ac('0x47'))){_0x5cfcb6[_0xe8ac('0x2e')]=qs['limit'](_0x97e206['query'][_0xe8ac('0x2e')]);_0x5cfcb6[_0xe8ac('0x2b')]=qs[_0xe8ac('0x2b')](_0x97e206[_0xe8ac('0x43')][_0xe8ac('0x2b')]);}_0x5cfcb6[_0xe8ac('0x48')]=qs[_0xe8ac('0x49')](_0x97e206[_0xe8ac('0x43')][_0xe8ac('0x49')]);_0x5cfcb6[_0xe8ac('0x4a')]=qs[_0xe8ac('0x40')](_[_0xe8ac('0x4b')](_0x97e206[_0xe8ac('0x43')],_0x28f061[_0xe8ac('0x40')]),_0x2d1150);if(_0x97e206['query'][_0xe8ac('0x4c')]){_0x5cfcb6['where']=_['merge'](_0x5cfcb6['where'],{'$or':_['map'](_0x2d1150,function(_0x368e31){if(_0x368e31['type']!==_0xe8ac('0x4d')){var _0x49c0af={};_0x49c0af[_0x368e31[_0xe8ac('0x34')]]={'$like':'%'+_0x97e206[_0xe8ac('0x43')]['filter']+'%'};return _0x49c0af;}})});}_0x5cfcb6=_[_0xe8ac('0x36')]({},_0x5cfcb6,_0x97e206['options']);var _0x160dfb={'where':_0x5cfcb6[_0xe8ac('0x4a')]};return db[_0xe8ac('0x3c')]['count'](_0x160dfb)[_0xe8ac('0x1d')](function(_0x46b06d){_0x21d397[_0xe8ac('0x2d')]=_0x46b06d;if(_0x97e206['query'][_0xe8ac('0x4e')]){_0x5cfcb6[_0xe8ac('0x4f')]=[{'all':!![]}];}return db[_0xe8ac('0x3c')]['findAll'](_0x5cfcb6);})[_0xe8ac('0x1d')](function(_0x4b84d6){_0x21d397[_0xe8ac('0x50')]=_0x4b84d6;return _0x21d397;})[_0xe8ac('0x1d')](respondWithFilteredResult(_0x5e63b3,_0x5cfcb6))[_0xe8ac('0x27')](handleError(_0x5e63b3,null));};exports['show']=function(_0x477448,_0x26c467){var _0x1d1101={'raw':![],'where':{'id':_0x477448[_0xe8ac('0x51')]['id']}},_0x39e173={};_0x39e173[_0xe8ac('0x42')]=_[_0xe8ac('0x52')](db[_0xe8ac('0x3c')][_0xe8ac('0x3d')]);_0x39e173[_0xe8ac('0x43')]=_['keys'](_0x477448[_0xe8ac('0x43')]);_0x39e173[_0xe8ac('0x40')]=_[_0xe8ac('0x41')](_0x39e173['model'],_0x39e173[_0xe8ac('0x43')]);_0x1d1101[_0xe8ac('0x45')]=_[_0xe8ac('0x41')](_0x39e173[_0xe8ac('0x42')],qs[_0xe8ac('0x44')](_0x477448[_0xe8ac('0x43')][_0xe8ac('0x44')]));_0x1d1101[_0xe8ac('0x45')]=_0x1d1101[_0xe8ac('0x45')][_0xe8ac('0x53')]?_0x1d1101[_0xe8ac('0x45')]:_0x39e173['model'];if(_0x477448[_0xe8ac('0x43')][_0xe8ac('0x4e')]){_0x1d1101[_0xe8ac('0x4f')]=[{'all':!![]}];}_0x1d1101=_[_0xe8ac('0x36')]({},_0x1d1101,_0x477448[_0xe8ac('0x54')]);return db[_0xe8ac('0x3c')][_0xe8ac('0x55')](_0x1d1101)[_0xe8ac('0x1d')](handleEntityNotFound(_0x26c467,null))[_0xe8ac('0x1d')](respondWithResult(_0x26c467,null))[_0xe8ac('0x27')](handleError(_0x26c467,null));};exports['create']=function(_0x13f08b,_0xade23d){return db[_0xe8ac('0x3c')]['create'](_0x13f08b[_0xe8ac('0x37')],{})[_0xe8ac('0x1d')](respondWithResult(_0xade23d,0xc9))[_0xe8ac('0x27')](handleError(_0xade23d,null));};exports[_0xe8ac('0x31')]=function(_0x37dd9d,_0x347cc7){if(_0x37dd9d[_0xe8ac('0x37')]['id']){delete _0x37dd9d[_0xe8ac('0x37')]['id'];}return db[_0xe8ac('0x3c')][_0xe8ac('0x55')]({'where':{'id':_0x37dd9d[_0xe8ac('0x51')]['id']}})[_0xe8ac('0x1d')](handleEntityNotFound(_0x347cc7,null))[_0xe8ac('0x1d')](saveUpdates(_0x37dd9d['body'],null))[_0xe8ac('0x1d')](respondWithResult(_0x347cc7,null))[_0xe8ac('0x27')](handleError(_0x347cc7,null));};exports[_0xe8ac('0x56')]=function(_0x5ae2a5,_0x133ac1){return db['VtigerConfiguration'][_0xe8ac('0x55')]({'where':{'id':_0x5ae2a5[_0xe8ac('0x51')]['id']}})[_0xe8ac('0x1d')](handleEntityNotFound(_0x133ac1,null))[_0xe8ac('0x1d')](removeEntity(_0x133ac1,null))[_0xe8ac('0x27')](handleError(_0x133ac1,null));};exports['getFields']=function(_0x5d4e08,_0x3f6d6a,_0x238f39){var _0x2d09b0={};var _0x5a387f={};var _0x1c9e9b;var _0x22c557;return db[_0xe8ac('0x3c')][_0xe8ac('0x57')]({'where':{'id':_0x5d4e08[_0xe8ac('0x51')]['id']}})[_0xe8ac('0x1d')](handleEntityNotFound(_0x3f6d6a,null))[_0xe8ac('0x1d')](function(_0x5c1835){if(_0x5c1835){_0x1c9e9b=_0x5c1835;_0x5a387f[_0xe8ac('0x42')]=_[_0xe8ac('0x52')](db[_0xe8ac('0x58')][_0xe8ac('0x3d')]);_0x5a387f[_0xe8ac('0x43')]=_[_0xe8ac('0x52')](_0x5d4e08[_0xe8ac('0x43')]);_0x5a387f[_0xe8ac('0x40')]=_['intersection'](_0x5a387f['model'],_0x5a387f[_0xe8ac('0x43')]);_0x2d09b0['attributes']=_['intersection'](_0x5a387f[_0xe8ac('0x42')],qs[_0xe8ac('0x44')](_0x5d4e08[_0xe8ac('0x43')]['fields']));_0x2d09b0['attributes']=_0x2d09b0['attributes'][_0xe8ac('0x53')]?_0x2d09b0['attributes']:_0x5a387f[_0xe8ac('0x42')];_0x2d09b0['order']=qs[_0xe8ac('0x49')](_0x5d4e08[_0xe8ac('0x43')][_0xe8ac('0x49')]);_0x2d09b0[_0xe8ac('0x4a')]=qs[_0xe8ac('0x40')](_[_0xe8ac('0x4b')](_0x5d4e08[_0xe8ac('0x43')],_0x5a387f[_0xe8ac('0x40')]));if(_0x5d4e08[_0xe8ac('0x43')]['filter']){_0x2d09b0[_0xe8ac('0x4a')]=_[_0xe8ac('0x36')](_0x2d09b0[_0xe8ac('0x4a')],{'$or':_[_0xe8ac('0x3b')](_0x2d09b0[_0xe8ac('0x45')],function(_0x40dac2){var _0x50741c={};_0x50741c[_0x40dac2]={'$like':'%'+_0x5d4e08['query'][_0xe8ac('0x4c')]+'%'};return _0x50741c;})});}_0x2d09b0=_['merge']({},_0x2d09b0,_0x5d4e08['options']);return _0x1c9e9b[_0xe8ac('0x59')](_0x2d09b0);}})[_0xe8ac('0x1d')](function(_0x48e360){if(_0x48e360){_0x22c557=_0x48e360[_0xe8ac('0x53')];if(!_0x5d4e08[_0xe8ac('0x43')][_0xe8ac('0x46')](_0xe8ac('0x47'))){_0x2d09b0['limit']=qs[_0xe8ac('0x2e')](_0x5d4e08[_0xe8ac('0x43')][_0xe8ac('0x2e')]);_0x2d09b0[_0xe8ac('0x2b')]=qs[_0xe8ac('0x2b')](_0x5d4e08[_0xe8ac('0x43')][_0xe8ac('0x2b')]);}return _0x1c9e9b[_0xe8ac('0x59')](_0x2d09b0);}})[_0xe8ac('0x1d')](function(_0x50de53){if(_0x50de53){return _0x50de53?{'count':_0x22c557,'rows':_0x50de53}:null;}})[_0xe8ac('0x1d')](respondWithResult(_0x3f6d6a,null))[_0xe8ac('0x27')](handleError(_0x3f6d6a,null));};exports[_0xe8ac('0x5a')]=function(_0x454f86,_0x2a8ea4,_0x494603){var _0x1a218f={};var _0x3dfe17={};var _0x4b535a;var _0x1a3aba;return db[_0xe8ac('0x3c')]['findOne']({'where':{'id':_0x454f86['params']['id']}})[_0xe8ac('0x1d')](handleEntityNotFound(_0x2a8ea4,null))[_0xe8ac('0x1d')](function(_0x47304b){if(_0x47304b){_0x4b535a=_0x47304b;_0x3dfe17[_0xe8ac('0x42')]=_[_0xe8ac('0x52')](db['VtigerField']['rawAttributes']);_0x3dfe17['query']=_[_0xe8ac('0x52')](_0x454f86[_0xe8ac('0x43')]);_0x3dfe17[_0xe8ac('0x40')]=_[_0xe8ac('0x41')](_0x3dfe17[_0xe8ac('0x42')],_0x3dfe17['query']);_0x1a218f[_0xe8ac('0x45')]=_[_0xe8ac('0x41')](_0x3dfe17[_0xe8ac('0x42')],qs[_0xe8ac('0x44')](_0x454f86[_0xe8ac('0x43')][_0xe8ac('0x44')]));_0x1a218f[_0xe8ac('0x45')]=_0x1a218f[_0xe8ac('0x45')][_0xe8ac('0x53')]?_0x1a218f[_0xe8ac('0x45')]:_0x3dfe17[_0xe8ac('0x42')];_0x1a218f[_0xe8ac('0x48')]=qs[_0xe8ac('0x49')](_0x454f86[_0xe8ac('0x43')][_0xe8ac('0x49')]);_0x1a218f[_0xe8ac('0x4a')]=qs[_0xe8ac('0x40')](_['pick'](_0x454f86[_0xe8ac('0x43')],_0x3dfe17[_0xe8ac('0x40')]));if(_0x454f86[_0xe8ac('0x43')][_0xe8ac('0x4c')]){_0x1a218f[_0xe8ac('0x4a')]=_[_0xe8ac('0x36')](_0x1a218f[_0xe8ac('0x4a')],{'$or':_[_0xe8ac('0x3b')](_0x1a218f['attributes'],function(_0x5bcd39){var _0x5ce973={};_0x5ce973[_0x5bcd39]={'$like':'%'+_0x454f86[_0xe8ac('0x43')][_0xe8ac('0x4c')]+'%'};return _0x5ce973;})});}_0x1a218f=_[_0xe8ac('0x36')]({},_0x1a218f,_0x454f86[_0xe8ac('0x54')]);return _0x4b535a[_0xe8ac('0x5a')](_0x1a218f);}})['then'](function(_0x33cedc){if(_0x33cedc){_0x1a3aba=_0x33cedc[_0xe8ac('0x53')];if(!_0x454f86[_0xe8ac('0x43')][_0xe8ac('0x46')](_0xe8ac('0x47'))){_0x1a218f[_0xe8ac('0x2e')]=qs['limit'](_0x454f86[_0xe8ac('0x43')]['limit']);_0x1a218f['offset']=qs['offset'](_0x454f86['query'][_0xe8ac('0x2b')]);}return _0x4b535a[_0xe8ac('0x5a')](_0x1a218f);}})[_0xe8ac('0x1d')](function(_0x56b6f8){if(_0x56b6f8){return _0x56b6f8?{'count':_0x1a3aba,'rows':_0x56b6f8}:null;}})['then'](respondWithResult(_0x2a8ea4,null))[_0xe8ac('0x27')](handleError(_0x2a8ea4,null));};exports[_0xe8ac('0x5b')]=function(_0x591c95,_0x59dfeb,_0x2de3dc){var _0x3e77a8={};var _0x10a170={};var _0x207a13;var _0x5275de;return db[_0xe8ac('0x3c')][_0xe8ac('0x57')]({'where':{'id':_0x591c95['params']['id']}})['then'](handleEntityNotFound(_0x59dfeb,null))['then'](function(_0x27b090){if(_0x27b090){_0x207a13=_0x27b090;_0x10a170[_0xe8ac('0x42')]=_['keys'](db[_0xe8ac('0x58')]['rawAttributes']);_0x10a170[_0xe8ac('0x43')]=_['keys'](_0x591c95[_0xe8ac('0x43')]);_0x10a170[_0xe8ac('0x40')]=_[_0xe8ac('0x41')](_0x10a170[_0xe8ac('0x42')],_0x10a170[_0xe8ac('0x43')]);_0x3e77a8[_0xe8ac('0x45')]=_[_0xe8ac('0x41')](_0x10a170[_0xe8ac('0x42')],qs['fields'](_0x591c95[_0xe8ac('0x43')]['fields']));_0x3e77a8[_0xe8ac('0x45')]=_0x3e77a8[_0xe8ac('0x45')][_0xe8ac('0x53')]?_0x3e77a8[_0xe8ac('0x45')]:_0x10a170['model'];_0x3e77a8[_0xe8ac('0x48')]=qs[_0xe8ac('0x49')](_0x591c95[_0xe8ac('0x43')]['sort']);_0x3e77a8[_0xe8ac('0x4a')]=qs[_0xe8ac('0x40')](_[_0xe8ac('0x4b')](_0x591c95['query'],_0x10a170['filters']));if(_0x591c95[_0xe8ac('0x43')][_0xe8ac('0x4c')]){_0x3e77a8[_0xe8ac('0x4a')]=_['merge'](_0x3e77a8[_0xe8ac('0x4a')],{'$or':_[_0xe8ac('0x3b')](_0x3e77a8[_0xe8ac('0x45')],function(_0x57be43){var _0x4b2bba={};_0x4b2bba[_0x57be43]={'$like':'%'+_0x591c95[_0xe8ac('0x43')][_0xe8ac('0x4c')]+'%'};return _0x4b2bba;})});}_0x3e77a8=_['merge']({},_0x3e77a8,_0x591c95[_0xe8ac('0x54')]);return _0x207a13[_0xe8ac('0x5b')](_0x3e77a8);}})[_0xe8ac('0x1d')](function(_0x461d99){if(_0x461d99){_0x5275de=_0x461d99[_0xe8ac('0x53')];if(!_0x591c95[_0xe8ac('0x43')][_0xe8ac('0x46')](_0xe8ac('0x47'))){_0x3e77a8[_0xe8ac('0x2e')]=qs[_0xe8ac('0x2e')](_0x591c95[_0xe8ac('0x43')]['limit']);_0x3e77a8[_0xe8ac('0x2b')]=qs[_0xe8ac('0x2b')](_0x591c95[_0xe8ac('0x43')]['offset']);}return _0x207a13[_0xe8ac('0x5b')](_0x3e77a8);}})[_0xe8ac('0x1d')](function(_0x15d0b0){if(_0x15d0b0){return _0x15d0b0?{'count':_0x5275de,'rows':_0x15d0b0}:null;}})[_0xe8ac('0x1d')](respondWithResult(_0x59dfeb,null))[_0xe8ac('0x27')](handleError(_0x59dfeb,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 5f82197..e0adee5 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 _0xdc1a=['int_vtiger_configurations','lodash','util','../../config/logger','request-promise','../../config/environment','define','VtigerConfiguration'];(function(_0x85a0e8,_0x3b6734){var _0x459d4d=function(_0x5a2b02){while(--_0x5a2b02){_0x85a0e8['push'](_0x85a0e8['shift']());}};_0x459d4d(++_0x3b6734);}(_0xdc1a,0x1a9));var _0xadc1=function(_0xb6a31a,_0x50998b){_0xb6a31a=_0xb6a31a-0x0;var _0x21959c=_0xdc1a[_0xb6a31a];return _0x21959c;};'use strict';var _=require(_0xadc1('0x0'));var util=require(_0xadc1('0x1'));var logger=require(_0xadc1('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xadc1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xadc1('0x4'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x1b9589,_0x2c91d3){return _0x1b9589[_0xadc1('0x5')](_0xadc1('0x6'),attributes,{'tableName':_0xadc1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5f1=['define','VtigerConfiguration','lodash','util','api','bluebird','request-promise','../../config/environment'];(function(_0x341a65,_0x4bef74){var _0x1c855f=function(_0x55ffdb){while(--_0x55ffdb){_0x341a65['push'](_0x341a65['shift']());}};_0x1c855f(++_0x4bef74);}(_0xe5f1,0x102));var _0x1e5f=function(_0x46eda8,_0x3e1a21){_0x46eda8=_0x46eda8-0x0;var _0x346fc7=_0xe5f1[_0x46eda8];return _0x346fc7;};'use strict';var _=require(_0x1e5f('0x0'));var util=require(_0x1e5f('0x1'));var logger=require('../../config/logger')(_0x1e5f('0x2'));var moment=require('moment');var BPromise=require(_0x1e5f('0x3'));var rp=require(_0x1e5f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1e5f('0x5'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x328d03,_0x5d8056){return _0x328d03[_0x1e5f('0x6')](_0x1e5f('0x7'),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 a28bb8e..835f4e2 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 _0x2090=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','info','result','catch'];(function(_0x441363,_0x924e39){var _0x25f08d=function(_0x186826){while(--_0x186826){_0x441363['push'](_0x441363['shift']());}};_0x25f08d(++_0x924e39);}(_0x2090,0xfc));var _0x0209=function(_0x2d896e,_0x19885f){_0x2d896e=_0x2d896e-0x0;var _0x4a2000=_0x2090[_0x2d896e];return _0x4a2000;};'use strict';var _=require('lodash');var util=require(_0x0209('0x0'));var moment=require(_0x0209('0x1'));var BPromise=require('bluebird');var rs=require(_0x0209('0x2'));var fs=require('fs');var Redis=require(_0x0209('0x3'));var db=require(_0x0209('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0209('0x5'))(_0x0209('0x6'));var config=require(_0x0209('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0209('0x8')][_0x0209('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x539d1d,_0x483d60,_0x47c505){return new BPromise(function(_0x218b5b,_0x5b6226){return client['request'](_0x539d1d,_0x47c505)['then'](function(_0x2164e8){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x483d60,'request\x20sent');logger[_0x0209('0xa')](_0x0209('0xb'),_0x483d60,_0x0209('0xc'),JSON[_0x0209('0xd')](_0x2164e8));if(_0x2164e8[_0x0209('0xe')]){if(_0x2164e8['error'][_0x0209('0xf')]===0x1f4){logger[_0x0209('0xe')](_0x0209('0x10'),_0x483d60,_0x2164e8[_0x0209('0xe')][_0x0209('0x11')]);return _0x5b6226(_0x2164e8[_0x0209('0xe')][_0x0209('0x11')]);}logger[_0x0209('0xe')](_0x0209('0x10'),_0x483d60,_0x2164e8[_0x0209('0xe')][_0x0209('0x11')]);return _0x218b5b(_0x2164e8[_0x0209('0xe')][_0x0209('0x11')]);}else{logger[_0x0209('0x12')](_0x0209('0x10'),_0x483d60,'request\x20sent');_0x218b5b(_0x2164e8[_0x0209('0x13')]['message']);}})[_0x0209('0x14')](function(_0x442285){logger[_0x0209('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x483d60,_0x442285);_0x5b6226(_0x442285);});});} \ No newline at end of file +var _0xba3b=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash'];(function(_0x255b3d,_0xfd2ba9){var _0x911b51=function(_0x450fcb){while(--_0x450fcb){_0x255b3d['push'](_0x255b3d['shift']());}};_0x911b51(++_0xfd2ba9);}(_0xba3b,0x137));var _0xbba3=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xba3b[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xbba3('0x0'));var util=require(_0xbba3('0x1'));var moment=require(_0xbba3('0x2'));var BPromise=require(_0xbba3('0x3'));var rs=require(_0xbba3('0x4'));var fs=require('fs');var Redis=require(_0xbba3('0x5'));var db=require(_0xbba3('0x6'))['db'];var utils=require(_0xbba3('0x7'));var logger=require(_0xbba3('0x8'))('rpc');var config=require(_0xbba3('0x9'));var jayson=require(_0xbba3('0xa'));var client=jayson[_0xbba3('0xb')][_0xbba3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c7f01,_0x321dfa,_0x5a27eb){return new BPromise(function(_0x38f18e,_0x28bc47){return client[_0xbba3('0xd')](_0x2c7f01,_0x5a27eb)[_0xbba3('0xe')](function(_0x2e440e){logger[_0xbba3('0xf')](_0xbba3('0x10'),_0x321dfa,'request\x20sent');logger[_0xbba3('0x11')](_0xbba3('0x12'),_0x321dfa,_0xbba3('0x13'),JSON[_0xbba3('0x14')](_0x2e440e));if(_0x2e440e['error']){if(_0x2e440e['error'][_0xbba3('0x15')]===0x1f4){logger[_0xbba3('0x16')](_0xbba3('0x10'),_0x321dfa,_0x2e440e['error']['message']);return _0x28bc47(_0x2e440e['error'][_0xbba3('0x17')]);}logger['error'](_0xbba3('0x10'),_0x321dfa,_0x2e440e['error'][_0xbba3('0x17')]);return _0x38f18e(_0x2e440e[_0xbba3('0x16')][_0xbba3('0x17')]);}else{logger[_0xbba3('0xf')](_0xbba3('0x10'),_0x321dfa,_0xbba3('0x13'));_0x38f18e(_0x2e440e[_0xbba3('0x18')][_0xbba3('0x17')]);}})[_0xbba3('0x19')](function(_0x3aa250){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x321dfa,_0x3aa250);_0x28bc47(_0x3aa250);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 1c896f5..25cd29b 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 _0x1261=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','index','get','isAuthenticated','show','post','create','/:id','update'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0x1261,0x144));var _0x1126=function(_0x229e80,_0x414425){_0x229e80=_0x229e80-0x0;var _0x30c4a4=_0x1261[_0x229e80];return _0x30c4a4;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xe')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0xf')]);router['put'](_0x1126('0x10'),auth[_0x1126('0xc')](),controller[_0x1126('0x11')]);router['delete'](_0x1126('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x1126('0x12')]=router; \ No newline at end of file +var _0xadb5=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x267ae4,_0x58c7cf){var _0x519990=function(_0x42b0f3){while(--_0x42b0f3){_0x267ae4['push'](_0x267ae4['shift']());}};_0x519990(++_0x58c7cf);}(_0xadb5,0xad));var _0x5adb=function(_0x7525b1,_0x27c5f3){_0x7525b1=_0x7525b1-0x0;var _0x4dd162=_0xadb5[_0x7525b1];return _0x4dd162;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intVtigerField.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0xc')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xf')]);router['delete']('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);module[_0x5adb('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 08aa3cd..d53231c 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 _0x3a25=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3a25,0x15d));var _0x53a2=function(_0x574193,_0x2815ef){_0x574193=_0x574193-0x0;var _0x188ae0=_0x3a25[_0x574193];return _0x188ae0;};'use strict';var Sequelize=require(_0x53a2('0x0'));module[_0x53a2('0x1')]={'type':{'type':Sequelize[_0x53a2('0x2')](_0x53a2('0x3'),_0x53a2('0x4'),_0x53a2('0x5'),_0x53a2('0x6'),_0x53a2('0x7')),'defaultValue':_0x53a2('0x3')},'content':{'type':Sequelize[_0x53a2('0x8')]},'key':{'type':Sequelize[_0x53a2('0x8')]},'keyType':{'type':Sequelize[_0x53a2('0x2')](_0x53a2('0x3'),_0x53a2('0x4'),_0x53a2('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x53a2('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x53a2('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x53a2('0x8')]}}; \ No newline at end of file +var _0x19ea=['variable','BOOLEAN','sequelize','string','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x388ac2,_0x3ede4f){var _0x20aa72=function(_0x163ea0){while(--_0x163ea0){_0x388ac2['push'](_0x388ac2['shift']());}};_0x20aa72(++_0x3ede4f);}(_0x19ea,0xfe));var _0xa19e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x19ea[_0x387777];return _0x3f84c0;};'use strict';var Sequelize=require(_0xa19e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa19e('0x1'),'variable',_0xa19e('0x2'),_0xa19e('0x3'),_0xa19e('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa19e('0x5')]},'keyType':{'type':Sequelize[_0xa19e('0x6')](_0xa19e('0x1'),_0xa19e('0x7'),_0xa19e('0x2'))},'keyContent':{'type':Sequelize[_0xa19e('0x5')]},'idField':{'type':Sequelize[_0xa19e('0x5')]},'nameField':{'type':Sequelize[_0xa19e('0x5')]},'customField':{'type':Sequelize[_0xa19e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa19e('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index b123576..de5cca5 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 _0x19ec=['set','reject','save','update','destroy','then','sendStatus','stack','name','send','render','merge','contact','agent','index','VtigerField','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x5e9817,_0xa29439){var _0x25b437=function(_0x46851b){while(--_0x46851b){_0x5e9817['push'](_0x5e9817['shift']());}};_0x25b437(++_0xa29439);}(_0x19ec,0x76));var _0xc19e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x19ec[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0xc19e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc19e('0x1'));var jsonpatch=require(_0xc19e('0x2'));var rp=require(_0xc19e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc19e('0x4'));var util=require(_0xc19e('0x5'));var path=require(_0xc19e('0x6'));var sox=require('sox');var csv=require(_0xc19e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc19e('0x8'));var _=require('lodash');var squel=require(_0xc19e('0x9'));var crypto=require(_0xc19e('0xa'));var jsforce=require(_0xc19e('0xb'));var deskjs=require(_0xc19e('0xc'));var toCsv=require(_0xc19e('0x7'));var querystring=require('querystring');var Papa=require(_0xc19e('0xd'));var Redis=require('ioredis');var authService=require(_0xc19e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc19e('0xf'));var hardwareService=require(_0xc19e('0x10'));var logger=require('../../config/logger')(_0xc19e('0x11'));var utils=require(_0xc19e('0x12'));var config=require(_0xc19e('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc19e('0x14'))['db'];function respondWithStatusCode(_0x1fa7c9,_0xdae225){_0xdae225=_0xdae225||0xcc;return function(_0x5e7c21){if(_0x5e7c21){return _0x1fa7c9['sendStatus'](_0xdae225);}return _0x1fa7c9[_0xc19e('0x15')](_0xdae225)[_0xc19e('0x16')]();};}function respondWithResult(_0x3d0e51,_0x494242){_0x494242=_0x494242||0xc8;return function(_0x533fdf){if(_0x533fdf){return _0x3d0e51[_0xc19e('0x15')](_0x494242)[_0xc19e('0x17')](_0x533fdf);}};}function respondWithFilteredResult(_0x211b69,_0x290605){return function(_0x310d15){if(_0x310d15){var _0x502de8=typeof _0x290605[_0xc19e('0x18')]===_0xc19e('0x19')&&typeof _0x290605[_0xc19e('0x1a')]===_0xc19e('0x19');var _0x54fffd=_0x310d15[_0xc19e('0x1b')];var _0x4073aa=_0x502de8?0x0:_0x290605[_0xc19e('0x18')];var _0x4709c5=_0x502de8?_0x310d15[_0xc19e('0x1b')]:_0x290605[_0xc19e('0x18')]+_0x290605[_0xc19e('0x1a')];var _0x42cbf4;if(_0x4709c5>=_0x54fffd){_0x4709c5=_0x54fffd;_0x42cbf4=0xc8;}else{_0x42cbf4=0xce;}_0x211b69[_0xc19e('0x15')](_0x42cbf4);return _0x211b69[_0xc19e('0x1c')]('Content-Range',_0x4073aa+'-'+_0x4709c5+'/'+_0x54fffd)[_0xc19e('0x17')](_0x310d15);}return null;};}function patchUpdates(_0x49d4fb){return function(_0x46aeab){try{jsonpatch['apply'](_0x46aeab,_0x49d4fb,!![]);}catch(_0x492193){return BPromise[_0xc19e('0x1d')](_0x492193);}return _0x46aeab[_0xc19e('0x1e')]();};}function saveUpdates(_0x3ec8f0,_0x484fec){return function(_0x4259e0){if(_0x4259e0){return _0x4259e0[_0xc19e('0x1f')](_0x3ec8f0)['then'](function(_0x6e2c66){return _0x6e2c66;});}return null;};}function removeEntity(_0x48f83f,_0x594b76){return function(_0x2e4ad1){if(_0x2e4ad1){return _0x2e4ad1[_0xc19e('0x20')]()[_0xc19e('0x21')](function(){_0x48f83f[_0xc19e('0x15')](0xcc)[_0xc19e('0x16')]();});}};}function handleEntityNotFound(_0x5a507f,_0x8d3a06){return function(_0x461ec2){if(!_0x461ec2){_0x5a507f[_0xc19e('0x22')](0x194);}return _0x461ec2;};}function handleError(_0x5dfb2a,_0x4be576){_0x4be576=_0x4be576||0x1f4;return function(_0xb967f2){logger['error'](_0xb967f2[_0xc19e('0x23')]);if(_0xb967f2['name']){delete _0xb967f2[_0xc19e('0x24')];}_0x5dfb2a['status'](_0x4be576)[_0xc19e('0x25')](_0xb967f2);};}function getMustacheRender(_0x579ddb,_0x90c41c){return Mustache[_0xc19e('0x26')](_0x579ddb,_[_0xc19e('0x27')](_0x90c41c['body'],{'contact':_0x90c41c[_0xc19e('0x28')],'message':_0x90c41c['message'],'agent':_0x90c41c[_0xc19e('0x29')],'interaction':_0x90c41c['interaction'],'account':_0x90c41c['account']}))||'';}exports[_0xc19e('0x2a')]=function(_0x310e2f,_0x4cc7e2){var _0x3af21f={},_0x23b65c={},_0xa5e86f={'count':0x0,'rows':[]};var _0x39c19a=_['map'](db[_0xc19e('0x2b')][_0xc19e('0x2c')],function(_0x1e6207){return{'name':_0x1e6207[_0xc19e('0x2d')],'type':_0x1e6207[_0xc19e('0x2e')]['key']};});_0x23b65c[_0xc19e('0x2f')]=_[_0xc19e('0x30')](_0x39c19a,'name');_0x23b65c[_0xc19e('0x31')]=_[_0xc19e('0x32')](_0x310e2f[_0xc19e('0x31')]);_0x23b65c[_0xc19e('0x33')]=_[_0xc19e('0x34')](_0x23b65c['model'],_0x23b65c[_0xc19e('0x31')]);_0x3af21f['attributes']=_[_0xc19e('0x34')](_0x23b65c[_0xc19e('0x2f')],qs[_0xc19e('0x35')](_0x310e2f[_0xc19e('0x31')]['fields']));_0x3af21f[_0xc19e('0x36')]=_0x3af21f['attributes'][_0xc19e('0x37')]?_0x3af21f[_0xc19e('0x36')]:_0x23b65c[_0xc19e('0x2f')];if(!_0x310e2f[_0xc19e('0x31')][_0xc19e('0x38')]('nolimit')){_0x3af21f[_0xc19e('0x1a')]=qs[_0xc19e('0x1a')](_0x310e2f['query'][_0xc19e('0x1a')]);_0x3af21f['offset']=qs[_0xc19e('0x18')](_0x310e2f[_0xc19e('0x31')][_0xc19e('0x18')]);}_0x3af21f['order']=qs['sort'](_0x310e2f['query'][_0xc19e('0x39')]);_0x3af21f[_0xc19e('0x3a')]=qs[_0xc19e('0x33')](_[_0xc19e('0x3b')](_0x310e2f['query'],_0x23b65c[_0xc19e('0x33')]),_0x39c19a);if(_0x310e2f[_0xc19e('0x31')][_0xc19e('0x3c')]){_0x3af21f[_0xc19e('0x3a')]=_['merge'](_0x3af21f['where'],{'$or':_[_0xc19e('0x30')](_0x39c19a,function(_0x4057e7){if(_0x4057e7[_0xc19e('0x2e')]!==_0xc19e('0x3d')){var _0x47dcf4={};_0x47dcf4[_0x4057e7[_0xc19e('0x24')]]={'$like':'%'+_0x310e2f[_0xc19e('0x31')][_0xc19e('0x3c')]+'%'};return _0x47dcf4;}})});}_0x3af21f=_['merge']({},_0x3af21f,_0x310e2f[_0xc19e('0x3e')]);var _0x3e3a0c={'where':_0x3af21f[_0xc19e('0x3a')]};return db[_0xc19e('0x2b')]['count'](_0x3e3a0c)[_0xc19e('0x21')](function(_0x441a7b){_0xa5e86f[_0xc19e('0x1b')]=_0x441a7b;if(_0x310e2f['query']['includeAll']){_0x3af21f[_0xc19e('0x3f')]=[{'all':!![]}];}return db['VtigerField'][_0xc19e('0x40')](_0x3af21f);})['then'](function(_0x34c4bc){_0xa5e86f[_0xc19e('0x41')]=_0x34c4bc;return _0xa5e86f;})['then'](respondWithFilteredResult(_0x4cc7e2,_0x3af21f))[_0xc19e('0x42')](handleError(_0x4cc7e2,null));};exports[_0xc19e('0x43')]=function(_0x189e80,_0x428552){var _0x3bfa6b={'raw':!![],'where':{'id':_0x189e80[_0xc19e('0x44')]['id']}},_0x4a15a0={};_0x4a15a0[_0xc19e('0x2f')]=_[_0xc19e('0x32')](db[_0xc19e('0x2b')][_0xc19e('0x2c')]);_0x4a15a0[_0xc19e('0x31')]=_[_0xc19e('0x32')](_0x189e80['query']);_0x4a15a0[_0xc19e('0x33')]=_[_0xc19e('0x34')](_0x4a15a0[_0xc19e('0x2f')],_0x4a15a0['query']);_0x3bfa6b['attributes']=_[_0xc19e('0x34')](_0x4a15a0[_0xc19e('0x2f')],qs['fields'](_0x189e80[_0xc19e('0x31')][_0xc19e('0x35')]));_0x3bfa6b[_0xc19e('0x36')]=_0x3bfa6b['attributes'][_0xc19e('0x37')]?_0x3bfa6b['attributes']:_0x4a15a0[_0xc19e('0x2f')];if(_0x189e80['query'][_0xc19e('0x45')]){_0x3bfa6b[_0xc19e('0x3f')]=[{'all':!![]}];}_0x3bfa6b=_[_0xc19e('0x27')]({},_0x3bfa6b,_0x189e80[_0xc19e('0x3e')]);return db['VtigerField'][_0xc19e('0x46')](_0x3bfa6b)['then'](handleEntityNotFound(_0x428552,null))[_0xc19e('0x21')](respondWithResult(_0x428552,null))[_0xc19e('0x42')](handleError(_0x428552,null));};exports[_0xc19e('0x47')]=function(_0x91b585,_0x457074){return db[_0xc19e('0x2b')][_0xc19e('0x47')](_0x91b585['body'],{})['then'](respondWithResult(_0x457074,0xc9))['catch'](handleError(_0x457074,null));};exports[_0xc19e('0x1f')]=function(_0x5b7a6d,_0x4a9c73){if(_0x5b7a6d[_0xc19e('0x48')]['id']){delete _0x5b7a6d[_0xc19e('0x48')]['id'];}return db[_0xc19e('0x2b')][_0xc19e('0x46')]({'where':{'id':_0x5b7a6d[_0xc19e('0x44')]['id']}})[_0xc19e('0x21')](handleEntityNotFound(_0x4a9c73,null))[_0xc19e('0x21')](saveUpdates(_0x5b7a6d['body'],null))['then'](respondWithResult(_0x4a9c73,null))[_0xc19e('0x42')](handleError(_0x4a9c73,null));};exports[_0xc19e('0x20')]=function(_0x3e215a,_0x5d8fd6){return db['VtigerField'][_0xc19e('0x46')]({'where':{'id':_0x3e215a[_0xc19e('0x44')]['id']}})[_0xc19e('0x21')](handleEntityNotFound(_0x5d8fd6,null))[_0xc19e('0x21')](removeEntity(_0x5d8fd6,null))[_0xc19e('0x42')](handleError(_0x5d8fd6,null));}; \ No newline at end of file +var _0x3241=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','render','merge','body','contact','message','interaction','account','index','map','VtigerField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x22b6d3,_0xf5a930){var _0x316caa=function(_0x3d5f19){while(--_0x3d5f19){_0x22b6d3['push'](_0x22b6d3['shift']());}};_0x316caa(++_0xf5a930);}(_0x3241,0x1d8));var _0x1324=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3241[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1324('0x0'));var rimraf=require(_0x1324('0x1'));var zipdir=require(_0x1324('0x2'));var jsonpatch=require(_0x1324('0x3'));var rp=require(_0x1324('0x4'));var moment=require(_0x1324('0x5'));var BPromise=require(_0x1324('0x6'));var Mustache=require(_0x1324('0x7'));var util=require(_0x1324('0x8'));var path=require(_0x1324('0x9'));var sox=require(_0x1324('0xa'));var csv=require(_0x1324('0xb'));var ejs=require(_0x1324('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1324('0xd'));var squel=require(_0x1324('0xe'));var crypto=require(_0x1324('0xf'));var jsforce=require(_0x1324('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x1324('0xb'));var querystring=require(_0x1324('0x11'));var Papa=require(_0x1324('0x12'));var Redis=require(_0x1324('0x13'));var authService=require(_0x1324('0x14'));var qs=require(_0x1324('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1324('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x1324('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1324('0x18'));var db=require(_0x1324('0x19'))['db'];function respondWithStatusCode(_0x1beccf,_0x1eeca4){_0x1eeca4=_0x1eeca4||0xcc;return function(_0x82fccc){if(_0x82fccc){return _0x1beccf[_0x1324('0x1a')](_0x1eeca4);}return _0x1beccf['status'](_0x1eeca4)['end']();};}function respondWithResult(_0x5c2ff2,_0x1fbde9){_0x1fbde9=_0x1fbde9||0xc8;return function(_0x1b352a){if(_0x1b352a){return _0x5c2ff2[_0x1324('0x1b')](_0x1fbde9)[_0x1324('0x1c')](_0x1b352a);}};}function respondWithFilteredResult(_0x488742,_0x345742){return function(_0x43e767){if(_0x43e767){var _0xcf7dd8=typeof _0x345742[_0x1324('0x1d')]===_0x1324('0x1e')&&typeof _0x345742[_0x1324('0x1f')]===_0x1324('0x1e');var _0x540ac1=_0x43e767['count'];var _0x163b96=_0xcf7dd8?0x0:_0x345742[_0x1324('0x1d')];var _0xc9d037=_0xcf7dd8?_0x43e767[_0x1324('0x20')]:_0x345742[_0x1324('0x1d')]+_0x345742['limit'];var _0x38d30e;if(_0xc9d037>=_0x540ac1){_0xc9d037=_0x540ac1;_0x38d30e=0xc8;}else{_0x38d30e=0xce;}_0x488742[_0x1324('0x1b')](_0x38d30e);return _0x488742[_0x1324('0x21')](_0x1324('0x22'),_0x163b96+'-'+_0xc9d037+'/'+_0x540ac1)[_0x1324('0x1c')](_0x43e767);}return null;};}function patchUpdates(_0x58368d){return function(_0x2da8af){try{jsonpatch[_0x1324('0x23')](_0x2da8af,_0x58368d,!![]);}catch(_0x250d2f){return BPromise[_0x1324('0x24')](_0x250d2f);}return _0x2da8af['save']();};}function saveUpdates(_0x50367d,_0xaeffd0){return function(_0xa8f10){if(_0xa8f10){return _0xa8f10[_0x1324('0x25')](_0x50367d)['then'](function(_0xc8266){return _0xc8266;});}return null;};}function removeEntity(_0x540cd2,_0x5cc758){return function(_0x12209a){if(_0x12209a){return _0x12209a[_0x1324('0x26')]()[_0x1324('0x27')](function(){_0x540cd2['status'](0xcc)[_0x1324('0x28')]();});}};}function handleEntityNotFound(_0x360b19,_0x2de10f){return function(_0xe57b61){if(!_0xe57b61){_0x360b19[_0x1324('0x1a')](0x194);}return _0xe57b61;};}function handleError(_0x456d87,_0x5d6269){_0x5d6269=_0x5d6269||0x1f4;return function(_0x4ba4ff){logger[_0x1324('0x29')](_0x4ba4ff[_0x1324('0x2a')]);if(_0x4ba4ff[_0x1324('0x2b')]){delete _0x4ba4ff[_0x1324('0x2b')];}_0x456d87['status'](_0x5d6269)[_0x1324('0x2c')](_0x4ba4ff);};}function getMustacheRender(_0x36a133,_0x53de74){return Mustache[_0x1324('0x2d')](_0x36a133,_[_0x1324('0x2e')](_0x53de74[_0x1324('0x2f')],{'contact':_0x53de74[_0x1324('0x30')],'message':_0x53de74[_0x1324('0x31')],'agent':_0x53de74['agent'],'interaction':_0x53de74[_0x1324('0x32')],'account':_0x53de74[_0x1324('0x33')]}))||'';}exports[_0x1324('0x34')]=function(_0xd4bc37,_0x1f1b8c){var _0x383b18={},_0xf4421a={},_0x3791d6={'count':0x0,'rows':[]};var _0x3e5ae4=_[_0x1324('0x35')](db[_0x1324('0x36')][_0x1324('0x37')],function(_0x5173f3){return{'name':_0x5173f3[_0x1324('0x38')],'type':_0x5173f3[_0x1324('0x39')]['key']};});_0xf4421a['model']=_[_0x1324('0x35')](_0x3e5ae4,_0x1324('0x2b'));_0xf4421a[_0x1324('0x3a')]=_[_0x1324('0x3b')](_0xd4bc37[_0x1324('0x3a')]);_0xf4421a[_0x1324('0x3c')]=_[_0x1324('0x3d')](_0xf4421a[_0x1324('0x3e')],_0xf4421a['query']);_0x383b18[_0x1324('0x3f')]=_[_0x1324('0x3d')](_0xf4421a['model'],qs[_0x1324('0x40')](_0xd4bc37[_0x1324('0x3a')][_0x1324('0x40')]));_0x383b18[_0x1324('0x3f')]=_0x383b18['attributes'][_0x1324('0x41')]?_0x383b18[_0x1324('0x3f')]:_0xf4421a[_0x1324('0x3e')];if(!_0xd4bc37[_0x1324('0x3a')][_0x1324('0x42')](_0x1324('0x43'))){_0x383b18[_0x1324('0x1f')]=qs['limit'](_0xd4bc37[_0x1324('0x3a')][_0x1324('0x1f')]);_0x383b18[_0x1324('0x1d')]=qs[_0x1324('0x1d')](_0xd4bc37[_0x1324('0x3a')]['offset']);}_0x383b18[_0x1324('0x44')]=qs[_0x1324('0x45')](_0xd4bc37[_0x1324('0x3a')][_0x1324('0x45')]);_0x383b18[_0x1324('0x46')]=qs[_0x1324('0x3c')](_[_0x1324('0x47')](_0xd4bc37[_0x1324('0x3a')],_0xf4421a['filters']),_0x3e5ae4);if(_0xd4bc37[_0x1324('0x3a')][_0x1324('0x48')]){_0x383b18[_0x1324('0x46')]=_[_0x1324('0x2e')](_0x383b18[_0x1324('0x46')],{'$or':_['map'](_0x3e5ae4,function(_0xf83e3e){if(_0xf83e3e[_0x1324('0x39')]!==_0x1324('0x49')){var _0x299dcf={};_0x299dcf[_0xf83e3e[_0x1324('0x2b')]]={'$like':'%'+_0xd4bc37[_0x1324('0x3a')][_0x1324('0x48')]+'%'};return _0x299dcf;}})});}_0x383b18=_[_0x1324('0x2e')]({},_0x383b18,_0xd4bc37[_0x1324('0x4a')]);var _0x2ed1f8={'where':_0x383b18[_0x1324('0x46')]};return db[_0x1324('0x36')][_0x1324('0x20')](_0x2ed1f8)[_0x1324('0x27')](function(_0xc26545){_0x3791d6[_0x1324('0x20')]=_0xc26545;if(_0xd4bc37[_0x1324('0x3a')]['includeAll']){_0x383b18[_0x1324('0x4b')]=[{'all':!![]}];}return db[_0x1324('0x36')]['findAll'](_0x383b18);})['then'](function(_0x675a59){_0x3791d6[_0x1324('0x4c')]=_0x675a59;return _0x3791d6;})[_0x1324('0x27')](respondWithFilteredResult(_0x1f1b8c,_0x383b18))[_0x1324('0x4d')](handleError(_0x1f1b8c,null));};exports[_0x1324('0x4e')]=function(_0x2181ea,_0x138f71){var _0x261429={'raw':!![],'where':{'id':_0x2181ea[_0x1324('0x4f')]['id']}},_0x64f0b6={};_0x64f0b6[_0x1324('0x3e')]=_['keys'](db[_0x1324('0x36')][_0x1324('0x37')]);_0x64f0b6[_0x1324('0x3a')]=_[_0x1324('0x3b')](_0x2181ea[_0x1324('0x3a')]);_0x64f0b6['filters']=_['intersection'](_0x64f0b6[_0x1324('0x3e')],_0x64f0b6['query']);_0x261429[_0x1324('0x3f')]=_[_0x1324('0x3d')](_0x64f0b6[_0x1324('0x3e')],qs[_0x1324('0x40')](_0x2181ea['query'][_0x1324('0x40')]));_0x261429[_0x1324('0x3f')]=_0x261429[_0x1324('0x3f')][_0x1324('0x41')]?_0x261429[_0x1324('0x3f')]:_0x64f0b6[_0x1324('0x3e')];if(_0x2181ea[_0x1324('0x3a')][_0x1324('0x50')]){_0x261429[_0x1324('0x4b')]=[{'all':!![]}];}_0x261429=_[_0x1324('0x2e')]({},_0x261429,_0x2181ea[_0x1324('0x4a')]);return db[_0x1324('0x36')][_0x1324('0x51')](_0x261429)[_0x1324('0x27')](handleEntityNotFound(_0x138f71,null))[_0x1324('0x27')](respondWithResult(_0x138f71,null))[_0x1324('0x4d')](handleError(_0x138f71,null));};exports[_0x1324('0x52')]=function(_0x17b060,_0x3cf8f5){return db[_0x1324('0x36')][_0x1324('0x52')](_0x17b060[_0x1324('0x2f')],{})[_0x1324('0x27')](respondWithResult(_0x3cf8f5,0xc9))[_0x1324('0x4d')](handleError(_0x3cf8f5,null));};exports[_0x1324('0x25')]=function(_0x3b9065,_0x22dc56){if(_0x3b9065[_0x1324('0x2f')]['id']){delete _0x3b9065[_0x1324('0x2f')]['id'];}return db[_0x1324('0x36')][_0x1324('0x51')]({'where':{'id':_0x3b9065[_0x1324('0x4f')]['id']}})[_0x1324('0x27')](handleEntityNotFound(_0x22dc56,null))[_0x1324('0x27')](saveUpdates(_0x3b9065['body'],null))[_0x1324('0x27')](respondWithResult(_0x22dc56,null))[_0x1324('0x4d')](handleError(_0x22dc56,null));};exports['destroy']=function(_0x3f80f9,_0x485f88){return db[_0x1324('0x36')][_0x1324('0x51')]({'where':{'id':_0x3f80f9[_0x1324('0x4f')]['id']}})[_0x1324('0x27')](handleEntityNotFound(_0x485f88,null))[_0x1324('0x27')](removeEntity(_0x485f88,null))[_0x1324('0x4d')](handleError(_0x485f88,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index e64983c..82f45df 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x58d025,_0xc33b35){var _0x5478e8=function(_0x2c0423){while(--_0x2c0423){_0x58d025['push'](_0x58d025['shift']());}};_0x5478e8(++_0xc33b35);}(_0x7a54,0x106));var _0x47a5=function(_0x3f7dfd,_0x3d3634){_0x3f7dfd=_0x3f7dfd-0x0;var _0x48f43f=_0x7a54[_0x3f7dfd];return _0x48f43f;};'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':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 8e32094..e5a4a1e 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 _0x48ac=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','bluebird','randomstring','ioredis'];(function(_0x16b85d,_0x454552){var _0x408b39=function(_0x52ddc6){while(--_0x52ddc6){_0x16b85d['push'](_0x16b85d['shift']());}};_0x408b39(++_0x454552);}(_0x48ac,0xe0));var _0xc48a=function(_0x27a87f,_0x3e052e){_0x27a87f=_0x27a87f-0x0;var _0x33d56a=_0x48ac[_0x27a87f];return _0x33d56a;};'use strict';var _=require('lodash');var util=require(_0xc48a('0x0'));var moment=require('moment');var BPromise=require(_0xc48a('0x1'));var rs=require(_0xc48a('0x2'));var fs=require('fs');var Redis=require(_0xc48a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc48a('0x4'));var logger=require(_0xc48a('0x5'))(_0xc48a('0x6'));var config=require(_0xc48a('0x7'));var jayson=require(_0xc48a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5df462,_0x5cffd4,_0x1e1e1a){return new BPromise(function(_0xf0c31b,_0x2c3285){return client['request'](_0x5df462,_0x1e1e1a)[_0xc48a('0x9')](function(_0x43461a){logger[_0xc48a('0xa')](_0xc48a('0xb'),_0x5cffd4,_0xc48a('0xc'));logger[_0xc48a('0xd')](_0xc48a('0xe'),_0x5cffd4,_0xc48a('0xc'),JSON[_0xc48a('0xf')](_0x43461a));if(_0x43461a[_0xc48a('0x10')]){if(_0x43461a[_0xc48a('0x10')]['code']===0x1f4){logger[_0xc48a('0x10')](_0xc48a('0xb'),_0x5cffd4,_0x43461a[_0xc48a('0x10')]['message']);return _0x2c3285(_0x43461a[_0xc48a('0x10')][_0xc48a('0x11')]);}logger['error'](_0xc48a('0xb'),_0x5cffd4,_0x43461a[_0xc48a('0x10')][_0xc48a('0x11')]);return _0xf0c31b(_0x43461a['error'][_0xc48a('0x11')]);}else{logger[_0xc48a('0xa')](_0xc48a('0xb'),_0x5cffd4,'request\x20sent');_0xf0c31b(_0x43461a[_0xc48a('0x12')][_0xc48a('0x11')]);}})['catch'](function(_0x5c319b){logger[_0xc48a('0x10')]('VtigerField,\x20%s,\x20%s',_0x5cffd4,_0x5c319b);_0x2c3285(_0x5c319b);});});} \ No newline at end of file +var _0xe1aa=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xe1aa,0xfc));var _0xae1a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe1aa[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xae1a('0x0'));var util=require(_0xae1a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xae1a('0x2'));var fs=require('fs');var Redis=require(_0xae1a('0x3'));var db=require(_0xae1a('0x4'))['db'];var utils=require(_0xae1a('0x5'));var logger=require(_0xae1a('0x6'))('rpc');var config=require(_0xae1a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xae1a('0x8')][_0xae1a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5efd03,_0x5c11d7,_0x288c00){return new BPromise(function(_0x156a91,_0x5df7ee){return client[_0xae1a('0xa')](_0x5efd03,_0x288c00)[_0xae1a('0xb')](function(_0x47d3f6){logger[_0xae1a('0xc')](_0xae1a('0xd'),_0x5c11d7,_0xae1a('0xe'));logger[_0xae1a('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x5c11d7,_0xae1a('0xe'),JSON[_0xae1a('0x10')](_0x47d3f6));if(_0x47d3f6['error']){if(_0x47d3f6[_0xae1a('0x11')][_0xae1a('0x12')]===0x1f4){logger[_0xae1a('0x11')](_0xae1a('0xd'),_0x5c11d7,_0x47d3f6[_0xae1a('0x11')][_0xae1a('0x13')]);return _0x5df7ee(_0x47d3f6[_0xae1a('0x11')][_0xae1a('0x13')]);}logger[_0xae1a('0x11')](_0xae1a('0xd'),_0x5c11d7,_0x47d3f6['error']['message']);return _0x156a91(_0x47d3f6['error']['message']);}else{logger[_0xae1a('0xc')](_0xae1a('0xd'),_0x5c11d7,_0xae1a('0xe'));_0x156a91(_0x47d3f6[_0xae1a('0x14')][_0xae1a('0x13')]);}})['catch'](function(_0x1cf96d){logger[_0xae1a('0x11')]('VtigerField,\x20%s,\x20%s',_0x5c11d7,_0x1cf96d);_0x5df7ee(_0x1cf96d);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 0ccdd40..e9b3c95 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 _0x74f3=['create','addConfiguration','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x155ff8,_0x36724a){var _0x7b6794=function(_0x5e8916){while(--_0x5e8916){_0x155ff8['push'](_0x155ff8['shift']());}};_0x7b6794(++_0x36724a);}(_0x74f3,0x164));var _0x374f=function(_0x506ba3,_0xad9ee6){_0x506ba3=_0x506ba3-0x0;var _0x1aec66=_0x74f3[_0x506ba3];return _0x1aec66;};'use strict';var multer=require(_0x374f('0x0'));var util=require(_0x374f('0x1'));var path=require(_0x374f('0x2'));var timeout=require('connect-timeout');var express=require(_0x374f('0x3'));var router=express[_0x374f('0x4')]();var fs_extra=require(_0x374f('0x5'));var auth=require(_0x374f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x374f('0x7'));var controller=require(_0x374f('0x8'));router['get']('/',auth[_0x374f('0x9')](),controller[_0x374f('0xa')]);router[_0x374f('0xb')](_0x374f('0xc'),auth[_0x374f('0x9')](),controller[_0x374f('0xd')]);router[_0x374f('0xb')](_0x374f('0xe'),auth['isAuthenticated'](),controller[_0x374f('0xf')]);router[_0x374f('0xb')](_0x374f('0x10'),auth[_0x374f('0x9')](),controller[_0x374f('0x11')]);router['post']('/',auth[_0x374f('0x9')](),controller[_0x374f('0x12')]);router['post'](_0x374f('0xe'),auth[_0x374f('0x9')](),controller[_0x374f('0x13')]);router['put'](_0x374f('0xc'),auth[_0x374f('0x9')](),controller['update']);router[_0x374f('0x14')](_0x374f('0xc'),auth['isAuthenticated'](),controller[_0x374f('0x15')]);module['exports']=router; \ No newline at end of file +var _0xafdd=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','multer','util','path','connect-timeout'];(function(_0x6f39eb,_0x380120){var _0x4d1a03=function(_0x587cd5){while(--_0x587cd5){_0x6f39eb['push'](_0x6f39eb['shift']());}};_0x4d1a03(++_0x380120);}(_0xafdd,0x19a));var _0xdafd=function(_0x37923c,_0x4cf826){_0x37923c=_0x37923c-0x0;var _0x303420=_0xafdd[_0x37923c];return _0x303420;};'use strict';var multer=require(_0xdafd('0x0'));var util=require(_0xdafd('0x1'));var path=require(_0xdafd('0x2'));var timeout=require(_0xdafd('0x3'));var express=require(_0xdafd('0x4'));var router=express[_0xdafd('0x5')]();var fs_extra=require(_0xdafd('0x6'));var auth=require(_0xdafd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdafd('0x8'));var controller=require(_0xdafd('0x9'));router[_0xdafd('0xa')]('/',auth[_0xdafd('0xb')](),controller[_0xdafd('0xc')]);router[_0xdafd('0xa')](_0xdafd('0xd'),auth['isAuthenticated'](),controller[_0xdafd('0xe')]);router[_0xdafd('0xa')](_0xdafd('0xf'),auth['isAuthenticated'](),controller[_0xdafd('0x10')]);router[_0xdafd('0xa')](_0xdafd('0x11'),auth[_0xdafd('0xb')](),controller['getFields']);router[_0xdafd('0x12')]('/',auth[_0xdafd('0xb')](),controller[_0xdafd('0x13')]);router[_0xdafd('0x12')](_0xdafd('0xf'),auth[_0xdafd('0xb')](),controller['addConfiguration']);router[_0xdafd('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xdafd('0x15')]);router[_0xdafd('0x16')]('/:id',auth[_0xdafd('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index d324c11..5dddcf8 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 _0x7b4c=['password','token','integrationTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x4d3523,_0x25d958){var _0x5a06c3=function(_0x18e47f){while(--_0x18e47f){_0x4d3523['push'](_0x4d3523['shift']());}};_0x5a06c3(++_0x25d958);}(_0x7b4c,0x66));var _0xc7b4=function(_0x3ca4e8,_0x1a615f){_0x3ca4e8=_0x3ca4e8-0x0;var _0x9b05dd=_0x7b4c[_0x3ca4e8];return _0x9b05dd;};'use strict';var Sequelize=require(_0xc7b4('0x0'));module[_0xc7b4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc7b4('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc7b4('0x3')},'password':{'type':Sequelize[_0xc7b4('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc7b4('0x2')],'unique':_0xc7b4('0x4')},'authType':{'type':Sequelize[_0xc7b4('0x5')](_0xc7b4('0x6'),_0xc7b4('0x7')),'defaultValue':_0xc7b4('0x6')},'serverUrl':{'type':Sequelize[_0xc7b4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc7b4('0x5')](_0xc7b4('0x8'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x31ef=['sequelize','exports','STRING','username','remoteUri','ENUM','password','token','integrationTab','newTab'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x31ef,0x17c));var _0xf31e=function(_0x57467e,_0x47b9e4){_0x57467e=_0x57467e-0x0;var _0x324dfd=_0x31ef[_0x57467e];return _0x324dfd;};'use strict';var Sequelize=require(_0xf31e('0x0'));module[_0xf31e('0x1')]={'name':{'type':Sequelize[_0xf31e('0x2')]},'description':{'type':Sequelize[_0xf31e('0x2')]},'username':{'type':Sequelize[_0xf31e('0x2')],'unique':_0xf31e('0x3')},'password':{'type':Sequelize[_0xf31e('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf31e('0x2')],'unique':_0xf31e('0x4')},'authType':{'type':Sequelize[_0xf31e('0x5')](_0xf31e('0x6'),_0xf31e('0x7')),'defaultValue':_0xf31e('0x6')},'serverUrl':{'type':Sequelize[_0xf31e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf31e('0x8'),_0xf31e('0x9')),'defaultValue':_0xf31e('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index fb17ca4..315c032 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 _0x0df6=['../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','merge','contact','agent','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','getConfigurations','nolimit','findOne','AccountId','getSubjects','channel','Descriptions','ZendeskConfiguration','ZendeskField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','authType','password','format','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0df6,0x68));var _0x60df=function(_0x1ffb79,_0x3ac7c9){_0x1ffb79=_0x1ffb79-0x0;var _0x1ba54f=_0x0df6[_0x1ffb79];return _0x1ba54f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x60df('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x60df('0x1'));var util=require(_0x60df('0x2'));var path=require(_0x60df('0x3'));var sox=require(_0x60df('0x4'));var csv=require(_0x60df('0x5'));var ejs=require(_0x60df('0x6'));var fs=require('fs');var fs_extra=require(_0x60df('0x7'));var _=require(_0x60df('0x8'));var squel=require(_0x60df('0x9'));var crypto=require(_0x60df('0xa'));var jsforce=require(_0x60df('0xb'));var deskjs=require(_0x60df('0xc'));var toCsv=require(_0x60df('0x5'));var querystring=require('querystring');var Papa=require(_0x60df('0xd'));var Redis=require(_0x60df('0xe'));var authService=require(_0x60df('0xf'));var qs=require(_0x60df('0x10'));var as=require(_0x60df('0x11'));var hardwareService=require(_0x60df('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x60df('0x13'));var config=require(_0x60df('0x14'));var licenseUtil=require(_0x60df('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x60df('0x16'));var jayson=require(_0x60df('0x17'));var client=jayson[_0x60df('0x18')][_0x60df('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4d87c2,_0x225aab,_0x4e25c7,_0x2057d3){return new BPromise(function(_0x5c6743,_0x28247b){var _0xa1dc29=_0x2057d3||client;return _0xa1dc29[_0x60df('0x1a')](_0x4d87c2,_0x4e25c7)[_0x60df('0x1b')](function(_0x30506a){logger['info'](_0x60df('0x1c'),_0x225aab,'request\x20sent');logger['debug'](_0x60df('0x1d'),_0x225aab,_0x60df('0x1e'),JSON[_0x60df('0x1f')](_0x30506a));if(_0x30506a[_0x60df('0x20')]){if(_0x30506a['error']['code']===0x1f4){logger[_0x60df('0x20')](_0x60df('0x1c'),_0x225aab,_0x30506a[_0x60df('0x20')][_0x60df('0x21')]);return _0x28247b(_0x30506a[_0x60df('0x20')]['message']);}logger[_0x60df('0x20')](_0x60df('0x1c'),_0x225aab,_0x30506a[_0x60df('0x20')][_0x60df('0x21')]);return _0x5c6743(_0x30506a[_0x60df('0x20')][_0x60df('0x21')]);}else{logger['info'](_0x60df('0x1c'),_0x225aab,_0x60df('0x1e'));_0x5c6743(_0x30506a['result'][_0x60df('0x21')]);}})[_0x60df('0x22')](function(_0xf5b8f2){logger['error'](_0x60df('0x1c'),_0x225aab,_0xf5b8f2);_0x28247b(_0xf5b8f2);});});}function respondWithStatusCode(_0x21ab5f,_0x44948e){_0x44948e=_0x44948e||0xcc;return function(_0x299436){if(_0x299436){return _0x21ab5f[_0x60df('0x23')](_0x44948e);}return _0x21ab5f[_0x60df('0x24')](_0x44948e)[_0x60df('0x25')]();};}function respondWithResult(_0x1b80d5,_0x561bb0){_0x561bb0=_0x561bb0||0xc8;return function(_0x4e630d){if(_0x4e630d){return _0x1b80d5[_0x60df('0x24')](_0x561bb0)[_0x60df('0x26')](_0x4e630d);}};}function respondWithFilteredResult(_0x1070a9,_0x536716){return function(_0x18af0a){if(_0x18af0a){var _0xc892ce=typeof _0x536716[_0x60df('0x27')]===_0x60df('0x28')&&typeof _0x536716[_0x60df('0x29')]==='undefined';var _0xf93841=_0x18af0a[_0x60df('0x2a')];var _0x1b16cc=_0xc892ce?0x0:_0x536716['offset'];var _0x559863=_0xc892ce?_0x18af0a[_0x60df('0x2a')]:_0x536716[_0x60df('0x27')]+_0x536716[_0x60df('0x29')];var _0x2406a6;if(_0x559863>=_0xf93841){_0x559863=_0xf93841;_0x2406a6=0xc8;}else{_0x2406a6=0xce;}_0x1070a9[_0x60df('0x24')](_0x2406a6);return _0x1070a9['set'](_0x60df('0x2b'),_0x1b16cc+'-'+_0x559863+'/'+_0xf93841)['json'](_0x18af0a);}return null;};}function patchUpdates(_0x3286a7){return function(_0x7e19e){try{jsonpatch[_0x60df('0x2c')](_0x7e19e,_0x3286a7,!![]);}catch(_0x536a1e){return BPromise[_0x60df('0x2d')](_0x536a1e);}return _0x7e19e[_0x60df('0x2e')]();};}function saveUpdates(_0x35a218,_0x19202a){return function(_0x101382){if(_0x101382){return _0x101382[_0x60df('0x2f')](_0x35a218)['then'](function(_0x55d7d1){return _0x55d7d1;});}return null;};}function removeEntity(_0x4adca3,_0x46459d){return function(_0x208c82){if(_0x208c82){return _0x208c82[_0x60df('0x30')]()[_0x60df('0x1b')](function(){_0x4adca3[_0x60df('0x24')](0xcc)[_0x60df('0x25')]();});}};}function handleEntityNotFound(_0x144b81,_0x4ad20a){return function(_0x43fab4){if(!_0x43fab4){_0x144b81[_0x60df('0x23')](0x194);}return _0x43fab4;};}function handleError(_0x173da9,_0x1b4e4){_0x1b4e4=_0x1b4e4||0x1f4;return function(_0xd90754){logger[_0x60df('0x20')](_0xd90754[_0x60df('0x31')]);if(_0xd90754[_0x60df('0x32')]){delete _0xd90754[_0x60df('0x32')];}_0x173da9[_0x60df('0x24')](_0x1b4e4)[_0x60df('0x33')](_0xd90754);};}function getMustacheRender(_0x566291,_0x37db47){return Mustache['render'](_0x566291,_[_0x60df('0x34')](_0x37db47['body'],{'contact':_0x37db47[_0x60df('0x35')],'message':_0x37db47[_0x60df('0x21')],'agent':_0x37db47[_0x60df('0x36')],'interaction':_0x37db47['interaction'],'account':_0x37db47['account']}))||'';}exports['index']=function(_0x2d9555,_0x4c5510){var _0x25817a={},_0x43ba1b={},_0x43d021={'count':0x0,'rows':[]};var _0x5a13f0=_[_0x60df('0x37')](db[_0x60df('0x38')][_0x60df('0x39')],function(_0x326d15){return{'name':_0x326d15[_0x60df('0x3a')],'type':_0x326d15[_0x60df('0x3b')][_0x60df('0x3c')]};});_0x43ba1b[_0x60df('0x3d')]=_[_0x60df('0x37')](_0x5a13f0,_0x60df('0x32'));_0x43ba1b[_0x60df('0x3e')]=_[_0x60df('0x3f')](_0x2d9555[_0x60df('0x3e')]);_0x43ba1b[_0x60df('0x40')]=_[_0x60df('0x41')](_0x43ba1b[_0x60df('0x3d')],_0x43ba1b[_0x60df('0x3e')]);_0x25817a['attributes']=_['intersection'](_0x43ba1b[_0x60df('0x3d')],qs['fields'](_0x2d9555[_0x60df('0x3e')][_0x60df('0x42')]));_0x25817a[_0x60df('0x43')]=_0x25817a[_0x60df('0x43')][_0x60df('0x44')]?_0x25817a[_0x60df('0x43')]:_0x43ba1b[_0x60df('0x3d')];if(!_0x2d9555['query'][_0x60df('0x45')]('nolimit')){_0x25817a[_0x60df('0x29')]=qs[_0x60df('0x29')](_0x2d9555[_0x60df('0x3e')]['limit']);_0x25817a[_0x60df('0x27')]=qs['offset'](_0x2d9555[_0x60df('0x3e')][_0x60df('0x27')]);}_0x25817a[_0x60df('0x46')]=qs[_0x60df('0x47')](_0x2d9555[_0x60df('0x3e')]['sort']);_0x25817a[_0x60df('0x48')]=qs['filters'](_[_0x60df('0x49')](_0x2d9555[_0x60df('0x3e')],_0x43ba1b[_0x60df('0x40')]),_0x5a13f0);if(_0x2d9555[_0x60df('0x3e')][_0x60df('0x4a')]){_0x25817a[_0x60df('0x48')]=_[_0x60df('0x34')](_0x25817a[_0x60df('0x48')],{'$or':_[_0x60df('0x37')](_0x5a13f0,function(_0x236710){if(_0x236710[_0x60df('0x3b')]!==_0x60df('0x4b')){var _0x3227dc={};_0x3227dc[_0x236710[_0x60df('0x32')]]={'$like':'%'+_0x2d9555[_0x60df('0x3e')]['filter']+'%'};return _0x3227dc;}})});}_0x25817a=_['merge']({},_0x25817a,_0x2d9555[_0x60df('0x4c')]);var _0x3ed057={'where':_0x25817a['where']};return db[_0x60df('0x38')][_0x60df('0x2a')](_0x3ed057)['then'](function(_0x59afdd){_0x43d021[_0x60df('0x2a')]=_0x59afdd;if(_0x2d9555[_0x60df('0x3e')][_0x60df('0x4d')]){_0x25817a[_0x60df('0x4e')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x60df('0x4f')](_0x25817a);})[_0x60df('0x1b')](function(_0x6d3636){_0x43d021[_0x60df('0x50')]=_0x6d3636;return _0x43d021;})['then'](respondWithFilteredResult(_0x4c5510,_0x25817a))['catch'](handleError(_0x4c5510,null));};exports['show']=function(_0x1829f9,_0xc2c594){var _0x1fc4ab={'raw':![],'where':{'id':_0x1829f9[_0x60df('0x51')]['id']}},_0x2d80e6={};_0x2d80e6[_0x60df('0x3d')]=_[_0x60df('0x3f')](db[_0x60df('0x38')]['rawAttributes']);_0x2d80e6[_0x60df('0x3e')]=_[_0x60df('0x3f')](_0x1829f9['query']);_0x2d80e6[_0x60df('0x40')]=_['intersection'](_0x2d80e6['model'],_0x2d80e6[_0x60df('0x3e')]);_0x1fc4ab[_0x60df('0x43')]=_[_0x60df('0x41')](_0x2d80e6[_0x60df('0x3d')],qs[_0x60df('0x42')](_0x1829f9['query'][_0x60df('0x42')]));_0x1fc4ab[_0x60df('0x43')]=_0x1fc4ab[_0x60df('0x43')][_0x60df('0x44')]?_0x1fc4ab[_0x60df('0x43')]:_0x2d80e6[_0x60df('0x3d')];if(_0x1829f9[_0x60df('0x3e')][_0x60df('0x4d')]){_0x1fc4ab[_0x60df('0x4e')]=[{'all':!![]}];}_0x1fc4ab=_[_0x60df('0x34')]({},_0x1fc4ab,_0x1829f9[_0x60df('0x4c')]);return db[_0x60df('0x38')][_0x60df('0x52')](_0x1fc4ab)[_0x60df('0x1b')](handleEntityNotFound(_0xc2c594,null))['then'](respondWithResult(_0xc2c594,null))[_0x60df('0x22')](handleError(_0xc2c594,null));};exports['create']=function(_0xfc7076,_0x37231e){return db[_0x60df('0x38')][_0x60df('0x53')](_0xfc7076[_0x60df('0x54')],{})[_0x60df('0x1b')](respondWithResult(_0x37231e,0xc9))['catch'](handleError(_0x37231e,null));};exports[_0x60df('0x2f')]=function(_0x4c2e91,_0x286397){if(_0x4c2e91[_0x60df('0x54')]['id']){delete _0x4c2e91[_0x60df('0x54')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x4c2e91[_0x60df('0x51')]['id']}})[_0x60df('0x1b')](handleEntityNotFound(_0x286397,null))[_0x60df('0x1b')](saveUpdates(_0x4c2e91['body'],null))[_0x60df('0x1b')](respondWithResult(_0x286397,null))[_0x60df('0x22')](handleError(_0x286397,null));};exports[_0x60df('0x30')]=function(_0x390d05,_0x19a649){return db[_0x60df('0x38')][_0x60df('0x52')]({'where':{'id':_0x390d05[_0x60df('0x51')]['id']}})[_0x60df('0x1b')](handleEntityNotFound(_0x19a649,null))[_0x60df('0x1b')](removeEntity(_0x19a649,null))[_0x60df('0x22')](handleError(_0x19a649,null));};exports[_0x60df('0x55')]=function(_0x1450d5,_0x2fe04d,_0x1c25c6){var _0x1a80d2={};var _0x261424={};var _0x43511e;var _0x53d196;return db[_0x60df('0x38')]['findOne']({'where':{'id':_0x1450d5['params']['id']}})[_0x60df('0x1b')](handleEntityNotFound(_0x2fe04d,null))['then'](function(_0x15a5f4){if(_0x15a5f4){_0x43511e=_0x15a5f4;_0x261424[_0x60df('0x3d')]=_[_0x60df('0x3f')](db['ZendeskConfiguration'][_0x60df('0x39')]);_0x261424['query']=_[_0x60df('0x3f')](_0x1450d5[_0x60df('0x3e')]);_0x261424[_0x60df('0x40')]=_['intersection'](_0x261424[_0x60df('0x3d')],_0x261424['query']);_0x1a80d2[_0x60df('0x43')]=_[_0x60df('0x41')](_0x261424[_0x60df('0x3d')],qs[_0x60df('0x42')](_0x1450d5[_0x60df('0x3e')][_0x60df('0x42')]));_0x1a80d2[_0x60df('0x43')]=_0x1a80d2['attributes'][_0x60df('0x44')]?_0x1a80d2[_0x60df('0x43')]:_0x261424[_0x60df('0x3d')];_0x1a80d2[_0x60df('0x46')]=qs[_0x60df('0x47')](_0x1450d5[_0x60df('0x3e')]['sort']);_0x1a80d2[_0x60df('0x48')]=qs['filters'](_[_0x60df('0x49')](_0x1450d5['query'],_0x261424['filters']));if(_0x1450d5['query'][_0x60df('0x4a')]){_0x1a80d2[_0x60df('0x48')]=_[_0x60df('0x34')](_0x1a80d2[_0x60df('0x48')],{'$or':_['map'](_0x1a80d2['attributes'],function(_0x1957af){var _0x477823={};_0x477823[_0x1957af]={'$like':'%'+_0x1450d5[_0x60df('0x3e')]['filter']+'%'};return _0x477823;})});}_0x1a80d2=_[_0x60df('0x34')]({},_0x1a80d2,_0x1450d5[_0x60df('0x4c')]);return _0x43511e[_0x60df('0x55')](_0x1a80d2);}})['then'](function(_0x5d7100){if(_0x5d7100){_0x53d196=_0x5d7100[_0x60df('0x44')];if(!_0x1450d5['query']['hasOwnProperty'](_0x60df('0x56'))){_0x1a80d2[_0x60df('0x29')]=qs[_0x60df('0x29')](_0x1450d5[_0x60df('0x3e')][_0x60df('0x29')]);_0x1a80d2[_0x60df('0x27')]=qs[_0x60df('0x27')](_0x1450d5[_0x60df('0x3e')][_0x60df('0x27')]);}return _0x43511e[_0x60df('0x55')](_0x1a80d2);}})[_0x60df('0x1b')](function(_0x59403d){if(_0x59403d){return _0x59403d?{'count':_0x53d196,'rows':_0x59403d}:null;}})[_0x60df('0x1b')](respondWithResult(_0x2fe04d,null))['catch'](handleError(_0x2fe04d,null));};exports['addConfiguration']=function(_0x557ee8,_0x589c73,_0x4d6428){if(_0x557ee8[_0x60df('0x54')]['id']){delete _0x557ee8['body']['id'];}return db[_0x60df('0x38')][_0x60df('0x57')]({'where':{'id':_0x557ee8[_0x60df('0x51')]['id']}})[_0x60df('0x1b')](handleEntityNotFound(_0x589c73,null))[_0x60df('0x1b')](function(_0xc15342){if(_0xc15342){_0x557ee8[_0x60df('0x54')][_0x60df('0x58')]=_0xc15342['id'];_0x557ee8[_0x60df('0x54')]['Subjects']=integrations[_0x60df('0x59')](_0x557ee8[_0x60df('0x54')][_0x60df('0x5a')],_0x557ee8['body']['type']);_0x557ee8[_0x60df('0x54')][_0x60df('0x5b')]=integrations['getDescriptions'](_0x557ee8[_0x60df('0x54')]['channel'],_0x557ee8[_0x60df('0x54')][_0x60df('0x3b')]);return db[_0x60df('0x5c')][_0x60df('0x53')](_0x557ee8[_0x60df('0x54')],{'include':[{'model':db[_0x60df('0x5d')],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x60df('0x5b')}]});}return null;})['then'](respondWithResult(_0x589c73,null))[_0x60df('0x22')](handleError(_0x589c73,null));};exports[_0x60df('0x5e')]=function(_0x588a35,_0x290e20,_0x4f56b9){var _0xace5fb='';return db[_0x60df('0x38')][_0x60df('0x57')]({'where':{'id':_0x588a35[_0x60df('0x51')]['id']},'attributes':['id',_0x60df('0x5f'),'password','token','authType',_0x60df('0x60')]})[_0x60df('0x1b')](handleEntityNotFound(_0x290e20,null))[_0x60df('0x1b')](function(_0x5d3d2b){if(_0x5d3d2b){_0xace5fb=_0x5d3d2b[_0x60df('0x60')];var _0x5e8e00=_0xace5fb[_0x60df('0x61')](-0x1);if(_0x5e8e00==='/'){_0xace5fb=_0xace5fb[_0x60df('0x62')](0x0,_0xace5fb[_0x60df('0x63')](_0x5e8e00));}var _0xa3756f={'method':_0x60df('0x64'),'uri':util['format'](_0x60df('0x65'),_0xace5fb,'ticket_fields'),'json':!![]};switch(_0x5d3d2b[_0x60df('0x66')]){case _0x60df('0x67'):_0xa3756f['headers']={'Authorization':util[_0x60df('0x68')](_0x60df('0x69'),new Buffer(util['format'](_0x60df('0x6a'),_0x5d3d2b[_0x60df('0x5f')],_0x5d3d2b[_0x60df('0x67')]))[_0x60df('0x6b')](_0x60df('0x6c')))};break;case _0x60df('0x6d'):_0xa3756f['headers']={'Authorization':util[_0x60df('0x68')](_0x60df('0x69'),new Buffer(util[_0x60df('0x68')](_0x60df('0x6e'),_0x5d3d2b['username'],_0x5d3d2b[_0x60df('0x6d')]))[_0x60df('0x6b')](_0x60df('0x6c')))};break;default:throw new db['Sequelize']['ValidationError'](_0x60df('0x6f'));}return rp(_0xa3756f);}})[_0x60df('0x1b')](function(_0x28147c){if(_0x28147c){var _0x421c60=[_0x60df('0x70'),_0x60df('0x71'),_0x60df('0x72'),'assignee'];_['remove'](_0x28147c[_0x60df('0x73')],function(_0x2244c4){return _0x421c60[_0x60df('0x74')](_0x2244c4[_0x60df('0x3b')]);});return{'count':_0x28147c['ticket_fields'][_0x60df('0x44')],'rows':_['map'](_0x28147c[_0x60df('0x73')],function(_0x409153){return{'id':_0x409153['id'],'name':_0x409153[_0x60df('0x75')]>0x7?_0x409153[_0x60df('0x76')]:_0x409153[_0x60df('0x3b')],'custom':_0x409153[_0x60df('0x75')]>0x7?!![]:![],'options':_0x409153[_0x60df('0x77')]?_0x409153[_0x60df('0x77')]:_0x409153['custom_field_options']?_0x409153[_0x60df('0x78')]:[]};})};}})[_0x60df('0x1b')](respondWithResult(_0x290e20,null))['catch'](function(_0x29a19e){var _0xd2c139=_0x588a35[_0x60df('0x3e')][_0x60df('0x79')]?0x1f4:_0x29a19e[_0x60df('0x7a')]||0x1f4;logger[_0x60df('0x20')](_0x60df('0x7b'),_0x60df('0x5e'),_0xd2c139,JSON[_0x60df('0x1f')](_0x29a19e));delete _0x29a19e['name'];if(_0xd2c139===0x191){_0xd2c139=0x190;}_0x290e20[_0x60df('0x24')](_0xd2c139)[_0x60df('0x33')](_0x588a35[_0x60df('0x3e')]['test']?{'message':_0x60df('0x7c'),'statusCode':_0x29a19e[_0x60df('0x7a')]}:_0x29a19e);});}; \ No newline at end of file +var _0x9016=['api','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','options','ZendeskAccount','includeAll','include','findAll','rows','catch','show','rawAttributes','create','update','find','params','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','base64','Basic\x20%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','test','statusCode','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2386f3,_0x4bb6ef){var _0xa263ea=function(_0x1c7e5b){while(--_0x1c7e5b){_0x2386f3['push'](_0x2386f3['shift']());}};_0xa263ea(++_0x4bb6ef);}(_0x9016,0xf9));var _0x6901=function(_0x339217,_0x41b09d){_0x339217=_0x339217-0x0;var _0x582141=_0x9016[_0x339217];return _0x582141;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6901('0x0'));var zipdir=require(_0x6901('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6901('0x2'));var moment=require(_0x6901('0x3'));var BPromise=require(_0x6901('0x4'));var Mustache=require(_0x6901('0x5'));var util=require(_0x6901('0x6'));var path=require('path');var sox=require(_0x6901('0x7'));var csv=require(_0x6901('0x8'));var ejs=require(_0x6901('0x9'));var fs=require('fs');var fs_extra=require(_0x6901('0xa'));var _=require(_0x6901('0xb'));var squel=require(_0x6901('0xc'));var crypto=require('crypto');var jsforce=require(_0x6901('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6901('0xe'));var Redis=require(_0x6901('0xf'));var authService=require(_0x6901('0x10'));var qs=require(_0x6901('0x11'));var as=require(_0x6901('0x12'));var hardwareService=require(_0x6901('0x13'));var logger=require(_0x6901('0x14'))(_0x6901('0x15'));var utils=require('../../config/utils');var config=require(_0x6901('0x16'));var licenseUtil=require(_0x6901('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6901('0x18'));var jayson=require(_0x6901('0x19'));var client=jayson[_0x6901('0x1a')][_0x6901('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4e9f4d,_0xbf1b57,_0x42cb93,_0x1c9015){return new BPromise(function(_0x53a79f,_0x1ab783){var _0x5bd23b=_0x1c9015||client;return _0x5bd23b[_0x6901('0x1c')](_0x4e9f4d,_0x42cb93)['then'](function(_0x382c22){logger[_0x6901('0x1d')](_0x6901('0x1e'),_0xbf1b57,_0x6901('0x1f'));logger[_0x6901('0x20')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0xbf1b57,_0x6901('0x1f'),JSON[_0x6901('0x21')](_0x382c22));if(_0x382c22[_0x6901('0x22')]){if(_0x382c22[_0x6901('0x22')][_0x6901('0x23')]===0x1f4){logger['error'](_0x6901('0x1e'),_0xbf1b57,_0x382c22[_0x6901('0x22')]['message']);return _0x1ab783(_0x382c22[_0x6901('0x22')][_0x6901('0x24')]);}logger[_0x6901('0x22')](_0x6901('0x1e'),_0xbf1b57,_0x382c22[_0x6901('0x22')]['message']);return _0x53a79f(_0x382c22[_0x6901('0x22')][_0x6901('0x24')]);}else{logger[_0x6901('0x1d')](_0x6901('0x1e'),_0xbf1b57,_0x6901('0x1f'));_0x53a79f(_0x382c22[_0x6901('0x25')]['message']);}})['catch'](function(_0x4118bf){logger[_0x6901('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0xbf1b57,_0x4118bf);_0x1ab783(_0x4118bf);});});}function respondWithStatusCode(_0x1a5efc,_0x3e4411){_0x3e4411=_0x3e4411||0xcc;return function(_0x3c67e5){if(_0x3c67e5){return _0x1a5efc['sendStatus'](_0x3e4411);}return _0x1a5efc[_0x6901('0x26')](_0x3e4411)[_0x6901('0x27')]();};}function respondWithResult(_0x5f1f36,_0x2ceea8){_0x2ceea8=_0x2ceea8||0xc8;return function(_0x40f627){if(_0x40f627){return _0x5f1f36[_0x6901('0x26')](_0x2ceea8)[_0x6901('0x28')](_0x40f627);}};}function respondWithFilteredResult(_0xb5edef,_0x36a9ae){return function(_0x46c736){if(_0x46c736){var _0x55c811=typeof _0x36a9ae[_0x6901('0x29')]===_0x6901('0x2a')&&typeof _0x36a9ae[_0x6901('0x2b')]===_0x6901('0x2a');var _0x12338c=_0x46c736[_0x6901('0x2c')];var _0x158c44=_0x55c811?0x0:_0x36a9ae[_0x6901('0x29')];var _0x30da03=_0x55c811?_0x46c736[_0x6901('0x2c')]:_0x36a9ae[_0x6901('0x29')]+_0x36a9ae[_0x6901('0x2b')];var _0x9c010b;if(_0x30da03>=_0x12338c){_0x30da03=_0x12338c;_0x9c010b=0xc8;}else{_0x9c010b=0xce;}_0xb5edef[_0x6901('0x26')](_0x9c010b);return _0xb5edef[_0x6901('0x2d')](_0x6901('0x2e'),_0x158c44+'-'+_0x30da03+'/'+_0x12338c)[_0x6901('0x28')](_0x46c736);}return null;};}function patchUpdates(_0x3277b6){return function(_0x5df333){try{jsonpatch[_0x6901('0x2f')](_0x5df333,_0x3277b6,!![]);}catch(_0x2a0872){return BPromise[_0x6901('0x30')](_0x2a0872);}return _0x5df333[_0x6901('0x31')]();};}function saveUpdates(_0x436bdb,_0xc41488){return function(_0x495b9f){if(_0x495b9f){return _0x495b9f['update'](_0x436bdb)[_0x6901('0x32')](function(_0x2d458e){return _0x2d458e;});}return null;};}function removeEntity(_0x3ddb9f,_0x3d2244){return function(_0xa7924f){if(_0xa7924f){return _0xa7924f[_0x6901('0x33')]()[_0x6901('0x32')](function(){_0x3ddb9f['status'](0xcc)[_0x6901('0x27')]();});}};}function handleEntityNotFound(_0x24b5b3,_0x19e464){return function(_0x95454e){if(!_0x95454e){_0x24b5b3['sendStatus'](0x194);}return _0x95454e;};}function handleError(_0xc618c3,_0x4f2389){_0x4f2389=_0x4f2389||0x1f4;return function(_0x98d2d3){logger[_0x6901('0x22')](_0x98d2d3[_0x6901('0x34')]);if(_0x98d2d3[_0x6901('0x35')]){delete _0x98d2d3[_0x6901('0x35')];}_0xc618c3[_0x6901('0x26')](_0x4f2389)[_0x6901('0x36')](_0x98d2d3);};}function getMustacheRender(_0x155aa7,_0x15d9d3){return Mustache[_0x6901('0x37')](_0x155aa7,_[_0x6901('0x38')](_0x15d9d3[_0x6901('0x39')],{'contact':_0x15d9d3[_0x6901('0x3a')],'message':_0x15d9d3[_0x6901('0x24')],'agent':_0x15d9d3[_0x6901('0x3b')],'interaction':_0x15d9d3[_0x6901('0x3c')],'account':_0x15d9d3[_0x6901('0x3d')]}))||'';}exports[_0x6901('0x3e')]=function(_0x162198,_0x2cfc3c){var _0x46f423={},_0x1b7923={},_0x4706ab={'count':0x0,'rows':[]};var _0x5820b=_[_0x6901('0x3f')](db['ZendeskAccount']['rawAttributes'],function(_0x2417ff){return{'name':_0x2417ff['fieldName'],'type':_0x2417ff[_0x6901('0x40')][_0x6901('0x41')]};});_0x1b7923['model']=_['map'](_0x5820b,_0x6901('0x35'));_0x1b7923[_0x6901('0x42')]=_[_0x6901('0x43')](_0x162198[_0x6901('0x42')]);_0x1b7923['filters']=_[_0x6901('0x44')](_0x1b7923[_0x6901('0x45')],_0x1b7923[_0x6901('0x42')]);_0x46f423['attributes']=_['intersection'](_0x1b7923[_0x6901('0x45')],qs[_0x6901('0x46')](_0x162198[_0x6901('0x42')]['fields']));_0x46f423[_0x6901('0x47')]=_0x46f423['attributes'][_0x6901('0x48')]?_0x46f423[_0x6901('0x47')]:_0x1b7923[_0x6901('0x45')];if(!_0x162198[_0x6901('0x42')][_0x6901('0x49')](_0x6901('0x4a'))){_0x46f423[_0x6901('0x2b')]=qs[_0x6901('0x2b')](_0x162198[_0x6901('0x42')]['limit']);_0x46f423[_0x6901('0x29')]=qs[_0x6901('0x29')](_0x162198[_0x6901('0x42')][_0x6901('0x29')]);}_0x46f423[_0x6901('0x4b')]=qs[_0x6901('0x4c')](_0x162198[_0x6901('0x42')][_0x6901('0x4c')]);_0x46f423[_0x6901('0x4d')]=qs[_0x6901('0x4e')](_[_0x6901('0x4f')](_0x162198['query'],_0x1b7923[_0x6901('0x4e')]),_0x5820b);if(_0x162198[_0x6901('0x42')]['filter']){_0x46f423[_0x6901('0x4d')]=_[_0x6901('0x38')](_0x46f423[_0x6901('0x4d')],{'$or':_[_0x6901('0x3f')](_0x5820b,function(_0x53a317){if(_0x53a317['type']!==_0x6901('0x50')){var _0x178007={};_0x178007[_0x53a317[_0x6901('0x35')]]={'$like':'%'+_0x162198['query'][_0x6901('0x51')]+'%'};return _0x178007;}})});}_0x46f423=_[_0x6901('0x38')]({},_0x46f423,_0x162198[_0x6901('0x52')]);var _0x2c4cc3={'where':_0x46f423[_0x6901('0x4d')]};return db[_0x6901('0x53')][_0x6901('0x2c')](_0x2c4cc3)[_0x6901('0x32')](function(_0x8d098e){_0x4706ab[_0x6901('0x2c')]=_0x8d098e;if(_0x162198['query'][_0x6901('0x54')]){_0x46f423[_0x6901('0x55')]=[{'all':!![]}];}return db[_0x6901('0x53')][_0x6901('0x56')](_0x46f423);})[_0x6901('0x32')](function(_0x406a76){_0x4706ab[_0x6901('0x57')]=_0x406a76;return _0x4706ab;})[_0x6901('0x32')](respondWithFilteredResult(_0x2cfc3c,_0x46f423))[_0x6901('0x58')](handleError(_0x2cfc3c,null));};exports[_0x6901('0x59')]=function(_0x44b04b,_0x3d5464){var _0x365c98={'raw':![],'where':{'id':_0x44b04b['params']['id']}},_0x5b1de8={};_0x5b1de8[_0x6901('0x45')]=_['keys'](db[_0x6901('0x53')][_0x6901('0x5a')]);_0x5b1de8['query']=_[_0x6901('0x43')](_0x44b04b[_0x6901('0x42')]);_0x5b1de8[_0x6901('0x4e')]=_[_0x6901('0x44')](_0x5b1de8[_0x6901('0x45')],_0x5b1de8[_0x6901('0x42')]);_0x365c98[_0x6901('0x47')]=_[_0x6901('0x44')](_0x5b1de8[_0x6901('0x45')],qs['fields'](_0x44b04b[_0x6901('0x42')]['fields']));_0x365c98['attributes']=_0x365c98['attributes'][_0x6901('0x48')]?_0x365c98[_0x6901('0x47')]:_0x5b1de8['model'];if(_0x44b04b[_0x6901('0x42')][_0x6901('0x54')]){_0x365c98['include']=[{'all':!![]}];}_0x365c98=_[_0x6901('0x38')]({},_0x365c98,_0x44b04b['options']);return db['ZendeskAccount']['find'](_0x365c98)['then'](handleEntityNotFound(_0x3d5464,null))[_0x6901('0x32')](respondWithResult(_0x3d5464,null))[_0x6901('0x58')](handleError(_0x3d5464,null));};exports[_0x6901('0x5b')]=function(_0x2b31c5,_0x59a11f){return db[_0x6901('0x53')][_0x6901('0x5b')](_0x2b31c5[_0x6901('0x39')],{})[_0x6901('0x32')](respondWithResult(_0x59a11f,0xc9))[_0x6901('0x58')](handleError(_0x59a11f,null));};exports[_0x6901('0x5c')]=function(_0xb91c0f,_0x1c6c28){if(_0xb91c0f[_0x6901('0x39')]['id']){delete _0xb91c0f[_0x6901('0x39')]['id'];}return db[_0x6901('0x53')]['find']({'where':{'id':_0xb91c0f['params']['id']}})[_0x6901('0x32')](handleEntityNotFound(_0x1c6c28,null))[_0x6901('0x32')](saveUpdates(_0xb91c0f['body'],null))['then'](respondWithResult(_0x1c6c28,null))[_0x6901('0x58')](handleError(_0x1c6c28,null));};exports[_0x6901('0x33')]=function(_0x2e4945,_0x5a1451){return db[_0x6901('0x53')][_0x6901('0x5d')]({'where':{'id':_0x2e4945[_0x6901('0x5e')]['id']}})[_0x6901('0x32')](handleEntityNotFound(_0x5a1451,null))[_0x6901('0x32')](removeEntity(_0x5a1451,null))[_0x6901('0x58')](handleError(_0x5a1451,null));};exports[_0x6901('0x5f')]=function(_0x4c998c,_0x22e732,_0x4ecc50){var _0x5a32bd={};var _0x50467a={};var _0x2bd915;var _0x4b4c86;return db['ZendeskAccount'][_0x6901('0x60')]({'where':{'id':_0x4c998c[_0x6901('0x5e')]['id']}})['then'](handleEntityNotFound(_0x22e732,null))[_0x6901('0x32')](function(_0x2e5be6){if(_0x2e5be6){_0x2bd915=_0x2e5be6;_0x50467a['model']=_[_0x6901('0x43')](db[_0x6901('0x61')][_0x6901('0x5a')]);_0x50467a[_0x6901('0x42')]=_[_0x6901('0x43')](_0x4c998c[_0x6901('0x42')]);_0x50467a[_0x6901('0x4e')]=_[_0x6901('0x44')](_0x50467a['model'],_0x50467a[_0x6901('0x42')]);_0x5a32bd['attributes']=_['intersection'](_0x50467a[_0x6901('0x45')],qs[_0x6901('0x46')](_0x4c998c[_0x6901('0x42')][_0x6901('0x46')]));_0x5a32bd[_0x6901('0x47')]=_0x5a32bd[_0x6901('0x47')][_0x6901('0x48')]?_0x5a32bd[_0x6901('0x47')]:_0x50467a[_0x6901('0x45')];_0x5a32bd[_0x6901('0x4b')]=qs[_0x6901('0x4c')](_0x4c998c[_0x6901('0x42')][_0x6901('0x4c')]);_0x5a32bd[_0x6901('0x4d')]=qs[_0x6901('0x4e')](_[_0x6901('0x4f')](_0x4c998c['query'],_0x50467a[_0x6901('0x4e')]));if(_0x4c998c[_0x6901('0x42')]['filter']){_0x5a32bd[_0x6901('0x4d')]=_[_0x6901('0x38')](_0x5a32bd[_0x6901('0x4d')],{'$or':_[_0x6901('0x3f')](_0x5a32bd[_0x6901('0x47')],function(_0x4a59c2){var _0x16f9e4={};_0x16f9e4[_0x4a59c2]={'$like':'%'+_0x4c998c['query'][_0x6901('0x51')]+'%'};return _0x16f9e4;})});}_0x5a32bd=_['merge']({},_0x5a32bd,_0x4c998c['options']);return _0x2bd915[_0x6901('0x5f')](_0x5a32bd);}})[_0x6901('0x32')](function(_0x52035b){if(_0x52035b){_0x4b4c86=_0x52035b[_0x6901('0x48')];if(!_0x4c998c['query']['hasOwnProperty'](_0x6901('0x4a'))){_0x5a32bd['limit']=qs[_0x6901('0x2b')](_0x4c998c[_0x6901('0x42')][_0x6901('0x2b')]);_0x5a32bd[_0x6901('0x29')]=qs[_0x6901('0x29')](_0x4c998c[_0x6901('0x42')]['offset']);}return _0x2bd915[_0x6901('0x5f')](_0x5a32bd);}})[_0x6901('0x32')](function(_0x3d0433){if(_0x3d0433){return _0x3d0433?{'count':_0x4b4c86,'rows':_0x3d0433}:null;}})['then'](respondWithResult(_0x22e732,null))['catch'](handleError(_0x22e732,null));};exports[_0x6901('0x62')]=function(_0x3f1744,_0x3873c2,_0x559d3d){if(_0x3f1744[_0x6901('0x39')]['id']){delete _0x3f1744[_0x6901('0x39')]['id'];}return db[_0x6901('0x53')][_0x6901('0x60')]({'where':{'id':_0x3f1744[_0x6901('0x5e')]['id']}})[_0x6901('0x32')](handleEntityNotFound(_0x3873c2,null))['then'](function(_0x16fc1b){if(_0x16fc1b){_0x3f1744[_0x6901('0x39')][_0x6901('0x63')]=_0x16fc1b['id'];_0x3f1744[_0x6901('0x39')][_0x6901('0x64')]=integrations[_0x6901('0x65')](_0x3f1744[_0x6901('0x39')][_0x6901('0x66')],_0x3f1744['body'][_0x6901('0x40')]);_0x3f1744[_0x6901('0x39')][_0x6901('0x67')]=integrations[_0x6901('0x68')](_0x3f1744[_0x6901('0x39')]['channel'],_0x3f1744[_0x6901('0x39')]['type']);return db[_0x6901('0x61')][_0x6901('0x5b')](_0x3f1744['body'],{'include':[{'model':db[_0x6901('0x69')],'as':_0x6901('0x64')},{'model':db[_0x6901('0x69')],'as':_0x6901('0x67')}]});}return null;})[_0x6901('0x32')](respondWithResult(_0x3873c2,null))[_0x6901('0x58')](handleError(_0x3873c2,null));};exports[_0x6901('0x6a')]=function(_0x34196,_0xe7f497,_0x2b3aae){var _0x265de2='';return db['ZendeskAccount'][_0x6901('0x60')]({'where':{'id':_0x34196[_0x6901('0x5e')]['id']},'attributes':['id',_0x6901('0x6b'),_0x6901('0x6c'),_0x6901('0x6d'),_0x6901('0x6e'),_0x6901('0x6f')]})[_0x6901('0x32')](handleEntityNotFound(_0xe7f497,null))['then'](function(_0x161925){if(_0x161925){_0x265de2=_0x161925[_0x6901('0x6f')];var _0x5d2e8a=_0x265de2[_0x6901('0x70')](-0x1);if(_0x5d2e8a==='/'){_0x265de2=_0x265de2[_0x6901('0x71')](0x0,_0x265de2[_0x6901('0x72')](_0x5d2e8a));}var _0x2b6cc9={'method':'GET','uri':util[_0x6901('0x73')](_0x6901('0x74'),_0x265de2,_0x6901('0x75')),'json':!![]};switch(_0x161925['authType']){case'password':_0x2b6cc9[_0x6901('0x76')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x6901('0x73')]('%s:%s',_0x161925[_0x6901('0x6b')],_0x161925['password']))['toString'](_0x6901('0x77')))};break;case _0x6901('0x6d'):_0x2b6cc9[_0x6901('0x76')]={'Authorization':util['format'](_0x6901('0x78'),new Buffer(util['format']('%s/token:%s',_0x161925[_0x6901('0x6b')],_0x161925[_0x6901('0x6d')]))['toString'](_0x6901('0x77')))};break;default:throw new db[(_0x6901('0x79'))][(_0x6901('0x7a'))](_0x6901('0x7b'));}return rp(_0x2b6cc9);}})[_0x6901('0x32')](function(_0x42fb10){if(_0x42fb10){var _0x2e5953=[_0x6901('0x7c'),_0x6901('0x7d'),_0x6901('0x7e'),_0x6901('0x7f')];_[_0x6901('0x80')](_0x42fb10[_0x6901('0x75')],function(_0x4dcd7a){return _0x2e5953[_0x6901('0x81')](_0x4dcd7a[_0x6901('0x40')]);});return{'count':_0x42fb10['ticket_fields'][_0x6901('0x48')],'rows':_[_0x6901('0x3f')](_0x42fb10[_0x6901('0x75')],function(_0x5a0f22){return{'id':_0x5a0f22['id'],'name':_0x5a0f22[_0x6901('0x82')]>0x7?_0x5a0f22[_0x6901('0x83')]:_0x5a0f22[_0x6901('0x40')],'custom':_0x5a0f22[_0x6901('0x82')]>0x7?!![]:![],'options':_0x5a0f22[_0x6901('0x84')]?_0x5a0f22[_0x6901('0x84')]:_0x5a0f22['custom_field_options']?_0x5a0f22['custom_field_options']:[]};})};}})[_0x6901('0x32')](respondWithResult(_0xe7f497,null))[_0x6901('0x58')](function(_0x3d525e){var _0x389937=_0x34196[_0x6901('0x42')][_0x6901('0x85')]?0x1f4:_0x3d525e['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x6901('0x6a'),_0x389937,JSON[_0x6901('0x21')](_0x3d525e));delete _0x3d525e[_0x6901('0x35')];if(_0x389937===0x191){_0x389937=0x190;}_0xe7f497[_0x6901('0x26')](_0x389937)[_0x6901('0x36')](_0x34196['query'][_0x6901('0x85')]?{'message':'Wrong\x20credentials','statusCode':_0x3d525e[_0x6901('0x86')]}:_0x3d525e);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index b43ef83..660e5b1 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 _0x1275=['../../config/logger','api','moment','bluebird','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','util'];(function(_0x5c7dd2,_0xa7f3f2){var _0x512735=function(_0x375195){while(--_0x375195){_0x5c7dd2['push'](_0x5c7dd2['shift']());}};_0x512735(++_0xa7f3f2);}(_0x1275,0x112));var _0x5127=function(_0x387ede,_0x20dbcc){_0x387ede=_0x387ede-0x0;var _0x41ff0d=_0x1275[_0x387ede];return _0x41ff0d;};'use strict';var _=require(_0x5127('0x0'));var util=require(_0x5127('0x1'));var logger=require(_0x5127('0x2'))(_0x5127('0x3'));var moment=require(_0x5127('0x4'));var BPromise=require(_0x5127('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5127('0x6'));var attributes=require(_0x5127('0x7'));var integrations=require(_0x5127('0x8'));module[_0x5127('0x9')]=function(_0x30c978,_0x18479b){return _0x30c978['define'](_0x5127('0xa'),attributes,{'tableName':_0x5127('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x686a=['../../config/environment','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','request-promise','path'];(function(_0x5515fa,_0x41f7fb){var _0x2e0253=function(_0x2ddb07){while(--_0x2ddb07){_0x5515fa['push'](_0x5515fa['shift']());}};_0x2e0253(++_0x41f7fb);}(_0x686a,0x195));var _0xa686=function(_0x511907,_0x4ae413){_0x511907=_0x511907-0x0;var _0x5e58e6=_0x686a[_0x511907];return _0x5e58e6;};'use strict';var _=require('lodash');var util=require(_0xa686('0x0'));var logger=require(_0xa686('0x1'))(_0xa686('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa686('0x3'));var fs=require('fs');var path=require(_0xa686('0x4'));var rimraf=require('rimraf');var config=require(_0xa686('0x5'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xa686('0x6'));module[_0xa686('0x7')]=function(_0x2147f2,_0x42f4b5){return _0x2147f2['define'](_0xa686('0x8'),attributes,{'tableName':_0xa686('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 88c2844..4cd6197 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 _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowZendeskAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1f5887,_0x2fa1f1){_0x1f5887=_0x1f5887-0x0;var _0x21774b=_0xcb91[_0x1f5887];return _0x21774b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetZendeskAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['ZendeskAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowZendeskAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file +var _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowZendeskAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0xcb91[_0x56825b];return _0x69ce77;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetZendeskAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['ZendeskAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowZendeskAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index f9f20b6..b61c5ce 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 _0x9776=['/:id','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x3b22e9,_0x354406){var _0x230314=function(_0x29ae96){while(--_0x29ae96){_0x3b22e9['push'](_0x3b22e9['shift']());}};_0x230314(++_0x354406);}(_0x9776,0x83));var _0x6977=function(_0x221aca,_0xc87daf){_0x221aca=_0x221aca-0x0;var _0x35b0e8=_0x9776[_0x221aca];return _0x35b0e8;};'use strict';var multer=require(_0x6977('0x0'));var util=require(_0x6977('0x1'));var path=require(_0x6977('0x2'));var timeout=require(_0x6977('0x3'));var express=require(_0x6977('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6977('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6977('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x6977('0x7')]('/',auth[_0x6977('0x8')](),controller['index']);router[_0x6977('0x7')](_0x6977('0x9'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/fields',auth[_0x6977('0x8')](),controller[_0x6977('0xa')]);router['get'](_0x6977('0xb'),auth[_0x6977('0x8')](),controller['getSubjects']);router['get'](_0x6977('0xc'),auth['isAuthenticated'](),controller[_0x6977('0xd')]);router['get'](_0x6977('0xe'),auth[_0x6977('0x8')](),controller[_0x6977('0xf')]);router[_0x6977('0x10')]('/',auth[_0x6977('0x8')](),controller['create']);router[_0x6977('0x10')](_0x6977('0xe'),auth[_0x6977('0x8')](),controller['setTags']);router['put']('/:id',auth[_0x6977('0x8')](),controller[_0x6977('0x11')]);router[_0x6977('0x12')]('/:id',auth[_0x6977('0x8')](),controller[_0x6977('0x13')]);module['exports']=router; \ No newline at end of file +var _0xadb0=['index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','create','setTags','put','update','delete','destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0xadb0,0x197));var _0x0adb=function(_0x530638,_0x51ee58){_0x530638=_0x530638-0x0;var _0x18f7b8=_0xadb0[_0x530638];return _0x18f7b8;};'use strict';var multer=require('multer');var util=require(_0x0adb('0x0'));var path=require('path');var timeout=require(_0x0adb('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0adb('0x2'));var auth=require(_0x0adb('0x3'));var interaction=require(_0x0adb('0x4'));var config=require(_0x0adb('0x5'));var controller=require(_0x0adb('0x6'));router[_0x0adb('0x7')]('/',auth[_0x0adb('0x8')](),controller[_0x0adb('0x9')]);router[_0x0adb('0x7')](_0x0adb('0xa'),auth[_0x0adb('0x8')](),controller[_0x0adb('0xb')]);router[_0x0adb('0x7')](_0x0adb('0xc'),auth[_0x0adb('0x8')](),controller[_0x0adb('0xd')]);router['get'](_0x0adb('0xe'),auth[_0x0adb('0x8')](),controller[_0x0adb('0xf')]);router['get']('/:id/descriptions',auth[_0x0adb('0x8')](),controller[_0x0adb('0x10')]);router['get'](_0x0adb('0x11'),auth[_0x0adb('0x8')](),controller['getTags']);router[_0x0adb('0x12')]('/',auth[_0x0adb('0x8')](),controller[_0x0adb('0x13')]);router[_0x0adb('0x12')]('/:id/tags',auth[_0x0adb('0x8')](),controller[_0x0adb('0x14')]);router[_0x0adb('0x15')]('/:id',auth[_0x0adb('0x8')](),controller[_0x0adb('0x16')]);router[_0x0adb('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x0adb('0x18')]);module[_0x0adb('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 82ee1d4..9386620 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 _0xef5b=['sequelize','exports','STRING'];(function(_0x30fb53,_0xb7e79e){var _0x3c3aad=function(_0x147fe8){while(--_0x147fe8){_0x30fb53['push'](_0x30fb53['shift']());}};_0x3c3aad(++_0xb7e79e);}(_0xef5b,0x156));var _0xbef5=function(_0x57a336,_0x22ea48){_0x57a336=_0x57a336-0x0;var _0x580a52=_0xef5b[_0x57a336];return _0x580a52;};'use strict';var Sequelize=require(_0xbef5('0x0'));module[_0xbef5('0x1')]={'name':{'type':Sequelize[_0xbef5('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x48b1=['exports','STRING','sequelize'];(function(_0x37c61d,_0x20f2a9){var _0x50c3a7=function(_0x5f2bd2){while(--_0x5f2bd2){_0x37c61d['push'](_0x37c61d['shift']());}};_0x50c3a7(++_0x20f2a9);}(_0x48b1,0x19d));var _0x148b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x48b1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x148b('0x0'));module[_0x148b('0x1')]={'name':{'type':Sequelize[_0x148b('0x2')]},'description':{'type':Sequelize[_0x148b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 427ca3b..23723d9 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 _0x2e21=['../../mysqldb','jayson/promise','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','end','name','send','render','merge','contact','agent','interaction','account','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','findOne','sort','pick','getFields','getSubjects','ZendeskField','getDescriptions','hasOwnProperty','getTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x216b8f,_0x42c863){var _0xd62932=function(_0xa8af52){while(--_0xa8af52){_0x216b8f['push'](_0x216b8f['shift']());}};_0xd62932(++_0x42c863);}(_0x2e21,0x17f));var _0x12e2=function(_0x157fd2,_0x4d1b49){_0x157fd2=_0x157fd2-0x0;var _0x3d8e94=_0x2e21[_0x157fd2];return _0x3d8e94;};'use strict';var emlformat=require(_0x12e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x12e2('0x1'));var jsonpatch=require(_0x12e2('0x2'));var rp=require(_0x12e2('0x3'));var moment=require(_0x12e2('0x4'));var BPromise=require(_0x12e2('0x5'));var Mustache=require(_0x12e2('0x6'));var util=require(_0x12e2('0x7'));var path=require(_0x12e2('0x8'));var sox=require(_0x12e2('0x9'));var csv=require(_0x12e2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x12e2('0xb'));var _=require(_0x12e2('0xc'));var squel=require('squel');var crypto=require(_0x12e2('0xd'));var jsforce=require(_0x12e2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x12e2('0xa'));var querystring=require(_0x12e2('0xf'));var Papa=require(_0x12e2('0x10'));var Redis=require(_0x12e2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x12e2('0x12'));var as=require(_0x12e2('0x13'));var hardwareService=require(_0x12e2('0x14'));var logger=require(_0x12e2('0x15'))('api');var utils=require(_0x12e2('0x16'));var config=require(_0x12e2('0x17'));var licenseUtil=require(_0x12e2('0x18'));var db=require(_0x12e2('0x19'))['db'];var jayson=require(_0x12e2('0x1a'));var client=jayson['client'][_0x12e2('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3f8969,_0xf2fca2,_0x25dc7a,_0x290352){return new BPromise(function(_0x380493,_0x5dfa8f){var _0x20b8e9=_0x290352||client;return _0x20b8e9[_0x12e2('0x1c')](_0x3f8969,_0x25dc7a)[_0x12e2('0x1d')](function(_0x180e5c){logger['info'](_0x12e2('0x1e'),_0xf2fca2,_0x12e2('0x1f'));logger[_0x12e2('0x20')](_0x12e2('0x21'),_0xf2fca2,_0x12e2('0x1f'),JSON[_0x12e2('0x22')](_0x180e5c));if(_0x180e5c['error']){if(_0x180e5c[_0x12e2('0x23')]['code']===0x1f4){logger[_0x12e2('0x23')](_0x12e2('0x1e'),_0xf2fca2,_0x180e5c['error'][_0x12e2('0x24')]);return _0x5dfa8f(_0x180e5c['error']['message']);}logger[_0x12e2('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0xf2fca2,_0x180e5c[_0x12e2('0x23')][_0x12e2('0x24')]);return _0x380493(_0x180e5c['error'][_0x12e2('0x24')]);}else{logger[_0x12e2('0x25')]('ZendeskConfiguration,\x20%s,\x20%s',_0xf2fca2,_0x12e2('0x1f'));_0x380493(_0x180e5c[_0x12e2('0x26')][_0x12e2('0x24')]);}})[_0x12e2('0x27')](function(_0x56a48a){logger[_0x12e2('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0xf2fca2,_0x56a48a);_0x5dfa8f(_0x56a48a);});});}function respondWithStatusCode(_0x1da42c,_0x1f764f){_0x1f764f=_0x1f764f||0xcc;return function(_0x120a35){if(_0x120a35){return _0x1da42c[_0x12e2('0x28')](_0x1f764f);}return _0x1da42c['status'](_0x1f764f)['end']();};}function respondWithResult(_0x1c3bfc,_0x3f8e25){_0x3f8e25=_0x3f8e25||0xc8;return function(_0x3076c6){if(_0x3076c6){return _0x1c3bfc[_0x12e2('0x29')](_0x3f8e25)['json'](_0x3076c6);}};}function respondWithFilteredResult(_0x3e94f2,_0x4e220b){return function(_0x2228b3){if(_0x2228b3){var _0x31cf5a=typeof _0x4e220b[_0x12e2('0x2a')]===_0x12e2('0x2b')&&typeof _0x4e220b[_0x12e2('0x2c')]==='undefined';var _0x4e72ed=_0x2228b3[_0x12e2('0x2d')];var _0xb89c75=_0x31cf5a?0x0:_0x4e220b[_0x12e2('0x2a')];var _0x12554e=_0x31cf5a?_0x2228b3['count']:_0x4e220b['offset']+_0x4e220b[_0x12e2('0x2c')];var _0x54c945;if(_0x12554e>=_0x4e72ed){_0x12554e=_0x4e72ed;_0x54c945=0xc8;}else{_0x54c945=0xce;}_0x3e94f2[_0x12e2('0x29')](_0x54c945);return _0x3e94f2[_0x12e2('0x2e')](_0x12e2('0x2f'),_0xb89c75+'-'+_0x12554e+'/'+_0x4e72ed)[_0x12e2('0x30')](_0x2228b3);}return null;};}function patchUpdates(_0x31b048){return function(_0x1b684b){try{jsonpatch[_0x12e2('0x31')](_0x1b684b,_0x31b048,!![]);}catch(_0x910b8c){return BPromise[_0x12e2('0x32')](_0x910b8c);}return _0x1b684b['save']();};}function saveUpdates(_0x3215ef,_0x491364){return function(_0x4e9f05){if(_0x4e9f05){return _0x4e9f05[_0x12e2('0x33')](_0x3215ef)[_0x12e2('0x1d')](function(_0x3771c4){return _0x3771c4;});}return null;};}function removeEntity(_0x13d48c,_0x5a46af){return function(_0x4d1b98){if(_0x4d1b98){return _0x4d1b98[_0x12e2('0x34')]()[_0x12e2('0x1d')](function(){_0x13d48c[_0x12e2('0x29')](0xcc)[_0x12e2('0x35')]();});}};}function handleEntityNotFound(_0x57314a,_0x22a3c2){return function(_0x1422fd){if(!_0x1422fd){_0x57314a[_0x12e2('0x28')](0x194);}return _0x1422fd;};}function handleError(_0x31724a,_0xd15218){_0xd15218=_0xd15218||0x1f4;return function(_0x3a0662){logger[_0x12e2('0x23')](_0x3a0662['stack']);if(_0x3a0662[_0x12e2('0x36')]){delete _0x3a0662['name'];}_0x31724a['status'](_0xd15218)[_0x12e2('0x37')](_0x3a0662);};}function getMustacheRender(_0x479636,_0x21f7b4){return Mustache[_0x12e2('0x38')](_0x479636,_[_0x12e2('0x39')](_0x21f7b4['body'],{'contact':_0x21f7b4[_0x12e2('0x3a')],'message':_0x21f7b4[_0x12e2('0x24')],'agent':_0x21f7b4[_0x12e2('0x3b')],'interaction':_0x21f7b4[_0x12e2('0x3c')],'account':_0x21f7b4[_0x12e2('0x3d')]}))||'';}exports[_0x12e2('0x3e')]=function(_0x57603a,_0x349d65){var _0x3f040a={},_0x377b08={},_0x324539={'count':0x0,'rows':[]};var _0x26cd73=_[_0x12e2('0x3f')](db[_0x12e2('0x40')][_0x12e2('0x41')],function(_0x3831b6){return{'name':_0x3831b6[_0x12e2('0x42')],'type':_0x3831b6[_0x12e2('0x43')][_0x12e2('0x44')]};});_0x377b08[_0x12e2('0x45')]=_[_0x12e2('0x3f')](_0x26cd73,_0x12e2('0x36'));_0x377b08[_0x12e2('0x46')]=_['keys'](_0x57603a['query']);_0x377b08[_0x12e2('0x47')]=_[_0x12e2('0x48')](_0x377b08[_0x12e2('0x45')],_0x377b08[_0x12e2('0x46')]);_0x3f040a['attributes']=_[_0x12e2('0x48')](_0x377b08['model'],qs['fields'](_0x57603a[_0x12e2('0x46')][_0x12e2('0x49')]));_0x3f040a[_0x12e2('0x4a')]=_0x3f040a[_0x12e2('0x4a')][_0x12e2('0x4b')]?_0x3f040a[_0x12e2('0x4a')]:_0x377b08[_0x12e2('0x45')];if(!_0x57603a[_0x12e2('0x46')]['hasOwnProperty'](_0x12e2('0x4c'))){_0x3f040a[_0x12e2('0x2c')]=qs['limit'](_0x57603a[_0x12e2('0x46')]['limit']);_0x3f040a['offset']=qs[_0x12e2('0x2a')](_0x57603a[_0x12e2('0x46')][_0x12e2('0x2a')]);}_0x3f040a[_0x12e2('0x4d')]=qs['sort'](_0x57603a[_0x12e2('0x46')]['sort']);_0x3f040a[_0x12e2('0x4e')]=qs[_0x12e2('0x47')](_['pick'](_0x57603a[_0x12e2('0x46')],_0x377b08['filters']),_0x26cd73);if(_0x57603a[_0x12e2('0x46')][_0x12e2('0x4f')]){_0x3f040a[_0x12e2('0x4e')]=_[_0x12e2('0x39')](_0x3f040a[_0x12e2('0x4e')],{'$or':_[_0x12e2('0x3f')](_0x26cd73,function(_0x206bed){if(_0x206bed[_0x12e2('0x43')]!==_0x12e2('0x50')){var _0x221efa={};_0x221efa[_0x206bed[_0x12e2('0x36')]]={'$like':'%'+_0x57603a[_0x12e2('0x46')][_0x12e2('0x4f')]+'%'};return _0x221efa;}})});}_0x3f040a=_[_0x12e2('0x39')]({},_0x3f040a,_0x57603a[_0x12e2('0x51')]);var _0x283247={'where':_0x3f040a[_0x12e2('0x4e')]};return db[_0x12e2('0x40')][_0x12e2('0x2d')](_0x283247)[_0x12e2('0x1d')](function(_0x56c3b5){_0x324539[_0x12e2('0x2d')]=_0x56c3b5;if(_0x57603a[_0x12e2('0x46')][_0x12e2('0x52')]){_0x3f040a[_0x12e2('0x53')]=[{'all':!![]}];}return db[_0x12e2('0x40')][_0x12e2('0x54')](_0x3f040a);})[_0x12e2('0x1d')](function(_0xae9c13){_0x324539[_0x12e2('0x55')]=_0xae9c13;return _0x324539;})[_0x12e2('0x1d')](respondWithFilteredResult(_0x349d65,_0x3f040a))[_0x12e2('0x27')](handleError(_0x349d65,null));};exports[_0x12e2('0x56')]=function(_0x4d491b,_0x16afed){var _0xac47cf={'raw':![],'where':{'id':_0x4d491b[_0x12e2('0x57')]['id']}},_0x6bfe8={};_0x6bfe8[_0x12e2('0x45')]=_[_0x12e2('0x58')](db[_0x12e2('0x40')][_0x12e2('0x41')]);_0x6bfe8['query']=_['keys'](_0x4d491b[_0x12e2('0x46')]);_0x6bfe8[_0x12e2('0x47')]=_[_0x12e2('0x48')](_0x6bfe8[_0x12e2('0x45')],_0x6bfe8['query']);_0xac47cf['attributes']=_[_0x12e2('0x48')](_0x6bfe8[_0x12e2('0x45')],qs['fields'](_0x4d491b['query'][_0x12e2('0x49')]));_0xac47cf['attributes']=_0xac47cf[_0x12e2('0x4a')][_0x12e2('0x4b')]?_0xac47cf['attributes']:_0x6bfe8[_0x12e2('0x45')];if(_0x4d491b[_0x12e2('0x46')][_0x12e2('0x52')]){_0xac47cf['include']=[{'all':!![]}];}_0xac47cf=_[_0x12e2('0x39')]({},_0xac47cf,_0x4d491b[_0x12e2('0x51')]);return db[_0x12e2('0x40')][_0x12e2('0x59')](_0xac47cf)[_0x12e2('0x1d')](handleEntityNotFound(_0x16afed,null))['then'](respondWithResult(_0x16afed,null))[_0x12e2('0x27')](handleError(_0x16afed,null));};exports[_0x12e2('0x5a')]=function(_0x1fafd9,_0x35d002){return db['ZendeskConfiguration'][_0x12e2('0x5a')](_0x1fafd9[_0x12e2('0x5b')],{})[_0x12e2('0x1d')](respondWithResult(_0x35d002,0xc9))[_0x12e2('0x27')](handleError(_0x35d002,null));};exports[_0x12e2('0x33')]=function(_0x29e2e8,_0x12bf26){if(_0x29e2e8[_0x12e2('0x5b')]['id']){delete _0x29e2e8[_0x12e2('0x5b')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x29e2e8['params']['id']}})[_0x12e2('0x1d')](handleEntityNotFound(_0x12bf26,null))[_0x12e2('0x1d')](saveUpdates(_0x29e2e8[_0x12e2('0x5b')],null))[_0x12e2('0x1d')](respondWithResult(_0x12bf26,null))[_0x12e2('0x27')](handleError(_0x12bf26,null));};exports[_0x12e2('0x34')]=function(_0x4b47ab,_0x5bc8a8){return db[_0x12e2('0x40')][_0x12e2('0x59')]({'where':{'id':_0x4b47ab[_0x12e2('0x57')]['id']}})['then'](handleEntityNotFound(_0x5bc8a8,null))[_0x12e2('0x1d')](removeEntity(_0x5bc8a8,null))[_0x12e2('0x27')](handleError(_0x5bc8a8,null));};exports['getFields']=function(_0x3b4140,_0x5639f8,_0x3870a0){var _0x29e1c2={};var _0x5b62a7={};var _0x1786a8;var _0x4a14c3;return db['ZendeskConfiguration'][_0x12e2('0x5c')]({'where':{'id':_0x3b4140[_0x12e2('0x57')]['id']}})[_0x12e2('0x1d')](handleEntityNotFound(_0x5639f8,null))[_0x12e2('0x1d')](function(_0x437c77){if(_0x437c77){_0x1786a8=_0x437c77;_0x5b62a7[_0x12e2('0x45')]=_[_0x12e2('0x58')](db['ZendeskField'][_0x12e2('0x41')]);_0x5b62a7[_0x12e2('0x46')]=_['keys'](_0x3b4140[_0x12e2('0x46')]);_0x5b62a7[_0x12e2('0x47')]=_[_0x12e2('0x48')](_0x5b62a7[_0x12e2('0x45')],_0x5b62a7[_0x12e2('0x46')]);_0x29e1c2[_0x12e2('0x4a')]=_[_0x12e2('0x48')](_0x5b62a7['model'],qs[_0x12e2('0x49')](_0x3b4140[_0x12e2('0x46')][_0x12e2('0x49')]));_0x29e1c2['attributes']=_0x29e1c2[_0x12e2('0x4a')][_0x12e2('0x4b')]?_0x29e1c2[_0x12e2('0x4a')]:_0x5b62a7[_0x12e2('0x45')];_0x29e1c2[_0x12e2('0x4d')]=qs[_0x12e2('0x5d')](_0x3b4140['query']['sort']);_0x29e1c2[_0x12e2('0x4e')]=qs[_0x12e2('0x47')](_[_0x12e2('0x5e')](_0x3b4140[_0x12e2('0x46')],_0x5b62a7[_0x12e2('0x47')]));if(_0x3b4140['query'][_0x12e2('0x4f')]){_0x29e1c2[_0x12e2('0x4e')]=_[_0x12e2('0x39')](_0x29e1c2[_0x12e2('0x4e')],{'$or':_[_0x12e2('0x3f')](_0x29e1c2[_0x12e2('0x4a')],function(_0x1aff72){var _0x372735={};_0x372735[_0x1aff72]={'$like':'%'+_0x3b4140[_0x12e2('0x46')][_0x12e2('0x4f')]+'%'};return _0x372735;})});}_0x29e1c2=_[_0x12e2('0x39')]({},_0x29e1c2,_0x3b4140[_0x12e2('0x51')]);return _0x1786a8[_0x12e2('0x5f')](_0x29e1c2);}})[_0x12e2('0x1d')](function(_0xa98202){if(_0xa98202){_0x4a14c3=_0xa98202[_0x12e2('0x4b')];if(!_0x3b4140[_0x12e2('0x46')]['hasOwnProperty'](_0x12e2('0x4c'))){_0x29e1c2[_0x12e2('0x2c')]=qs[_0x12e2('0x2c')](_0x3b4140[_0x12e2('0x46')][_0x12e2('0x2c')]);_0x29e1c2[_0x12e2('0x2a')]=qs[_0x12e2('0x2a')](_0x3b4140[_0x12e2('0x46')][_0x12e2('0x2a')]);}return _0x1786a8[_0x12e2('0x5f')](_0x29e1c2);}})[_0x12e2('0x1d')](function(_0xbabf1b){if(_0xbabf1b){return _0xbabf1b?{'count':_0x4a14c3,'rows':_0xbabf1b}:null;}})[_0x12e2('0x1d')](respondWithResult(_0x5639f8,null))[_0x12e2('0x27')](handleError(_0x5639f8,null));};exports[_0x12e2('0x60')]=function(_0x318292,_0x5ed8a9,_0x4e1a9d){var _0x4122db={};var _0xbd825c={};var _0x67239;var _0x59bd61;return db[_0x12e2('0x40')]['findOne']({'where':{'id':_0x318292['params']['id']}})['then'](handleEntityNotFound(_0x5ed8a9,null))['then'](function(_0xc86d9){if(_0xc86d9){_0x67239=_0xc86d9;_0xbd825c[_0x12e2('0x45')]=_[_0x12e2('0x58')](db[_0x12e2('0x61')][_0x12e2('0x41')]);_0xbd825c[_0x12e2('0x46')]=_[_0x12e2('0x58')](_0x318292[_0x12e2('0x46')]);_0xbd825c['filters']=_['intersection'](_0xbd825c[_0x12e2('0x45')],_0xbd825c[_0x12e2('0x46')]);_0x4122db[_0x12e2('0x4a')]=_[_0x12e2('0x48')](_0xbd825c['model'],qs[_0x12e2('0x49')](_0x318292[_0x12e2('0x46')]['fields']));_0x4122db[_0x12e2('0x4a')]=_0x4122db[_0x12e2('0x4a')][_0x12e2('0x4b')]?_0x4122db['attributes']:_0xbd825c['model'];_0x4122db[_0x12e2('0x4d')]=qs[_0x12e2('0x5d')](_0x318292[_0x12e2('0x46')][_0x12e2('0x5d')]);_0x4122db[_0x12e2('0x4e')]=qs[_0x12e2('0x47')](_[_0x12e2('0x5e')](_0x318292[_0x12e2('0x46')],_0xbd825c[_0x12e2('0x47')]));if(_0x318292[_0x12e2('0x46')]['filter']){_0x4122db[_0x12e2('0x4e')]=_[_0x12e2('0x39')](_0x4122db['where'],{'$or':_[_0x12e2('0x3f')](_0x4122db[_0x12e2('0x4a')],function(_0x45273f){var _0x404d65={};_0x404d65[_0x45273f]={'$like':'%'+_0x318292[_0x12e2('0x46')][_0x12e2('0x4f')]+'%'};return _0x404d65;})});}_0x4122db=_[_0x12e2('0x39')]({},_0x4122db,_0x318292[_0x12e2('0x51')]);return _0x67239['getSubjects'](_0x4122db);}})[_0x12e2('0x1d')](function(_0xda9193){if(_0xda9193){_0x59bd61=_0xda9193[_0x12e2('0x4b')];if(!_0x318292[_0x12e2('0x46')]['hasOwnProperty'](_0x12e2('0x4c'))){_0x4122db[_0x12e2('0x2c')]=qs[_0x12e2('0x2c')](_0x318292['query'][_0x12e2('0x2c')]);_0x4122db['offset']=qs[_0x12e2('0x2a')](_0x318292[_0x12e2('0x46')][_0x12e2('0x2a')]);}return _0x67239[_0x12e2('0x60')](_0x4122db);}})['then'](function(_0x28203c){if(_0x28203c){return _0x28203c?{'count':_0x59bd61,'rows':_0x28203c}:null;}})[_0x12e2('0x1d')](respondWithResult(_0x5ed8a9,null))[_0x12e2('0x27')](handleError(_0x5ed8a9,null));};exports[_0x12e2('0x62')]=function(_0x4054c9,_0x546490,_0x3ca809){var _0x1d855f={};var _0x3fe142={};var _0xefde42;var _0x45a6a5;return db[_0x12e2('0x40')][_0x12e2('0x5c')]({'where':{'id':_0x4054c9['params']['id']}})['then'](handleEntityNotFound(_0x546490,null))[_0x12e2('0x1d')](function(_0x323839){if(_0x323839){_0xefde42=_0x323839;_0x3fe142['model']=_[_0x12e2('0x58')](db[_0x12e2('0x61')][_0x12e2('0x41')]);_0x3fe142['query']=_[_0x12e2('0x58')](_0x4054c9[_0x12e2('0x46')]);_0x3fe142[_0x12e2('0x47')]=_[_0x12e2('0x48')](_0x3fe142['model'],_0x3fe142[_0x12e2('0x46')]);_0x1d855f['attributes']=_[_0x12e2('0x48')](_0x3fe142[_0x12e2('0x45')],qs[_0x12e2('0x49')](_0x4054c9['query'][_0x12e2('0x49')]));_0x1d855f[_0x12e2('0x4a')]=_0x1d855f[_0x12e2('0x4a')][_0x12e2('0x4b')]?_0x1d855f[_0x12e2('0x4a')]:_0x3fe142[_0x12e2('0x45')];_0x1d855f[_0x12e2('0x4d')]=qs[_0x12e2('0x5d')](_0x4054c9['query'][_0x12e2('0x5d')]);_0x1d855f[_0x12e2('0x4e')]=qs['filters'](_[_0x12e2('0x5e')](_0x4054c9[_0x12e2('0x46')],_0x3fe142['filters']));if(_0x4054c9['query'][_0x12e2('0x4f')]){_0x1d855f[_0x12e2('0x4e')]=_[_0x12e2('0x39')](_0x1d855f['where'],{'$or':_[_0x12e2('0x3f')](_0x1d855f[_0x12e2('0x4a')],function(_0x175acb){var _0x37154f={};_0x37154f[_0x175acb]={'$like':'%'+_0x4054c9[_0x12e2('0x46')][_0x12e2('0x4f')]+'%'};return _0x37154f;})});}_0x1d855f=_[_0x12e2('0x39')]({},_0x1d855f,_0x4054c9['options']);return _0xefde42[_0x12e2('0x62')](_0x1d855f);}})[_0x12e2('0x1d')](function(_0x2ffa49){if(_0x2ffa49){_0x45a6a5=_0x2ffa49[_0x12e2('0x4b')];if(!_0x4054c9[_0x12e2('0x46')][_0x12e2('0x63')](_0x12e2('0x4c'))){_0x1d855f[_0x12e2('0x2c')]=qs['limit'](_0x4054c9[_0x12e2('0x46')][_0x12e2('0x2c')]);_0x1d855f[_0x12e2('0x2a')]=qs[_0x12e2('0x2a')](_0x4054c9[_0x12e2('0x46')]['offset']);}return _0xefde42[_0x12e2('0x62')](_0x1d855f);}})[_0x12e2('0x1d')](function(_0xed11d2){if(_0xed11d2){return _0xed11d2?{'count':_0x45a6a5,'rows':_0xed11d2}:null;}})['then'](respondWithResult(_0x546490,null))[_0x12e2('0x27')](handleError(_0x546490,null));};exports[_0x12e2('0x64')]=function(_0x450362,_0x573b1f,_0x580a74){var _0x56f4fa={};var _0x59c26e={};var _0x43792e;var _0x53e653;return db[_0x12e2('0x40')][_0x12e2('0x5c')]({'where':{'id':_0x450362[_0x12e2('0x57')]['id']}})[_0x12e2('0x1d')](handleEntityNotFound(_0x573b1f,null))[_0x12e2('0x1d')](function(_0x10c54e){if(_0x10c54e){_0x43792e=_0x10c54e;_0x59c26e[_0x12e2('0x45')]=_['keys'](db['Tag']['rawAttributes']);_0x59c26e[_0x12e2('0x46')]=_[_0x12e2('0x58')](_0x450362[_0x12e2('0x46')]);_0x59c26e[_0x12e2('0x47')]=_[_0x12e2('0x48')](_0x59c26e['model'],_0x59c26e[_0x12e2('0x46')]);_0x56f4fa['attributes']=_[_0x12e2('0x48')](_0x59c26e[_0x12e2('0x45')],qs[_0x12e2('0x49')](_0x450362['query']['fields']));_0x56f4fa[_0x12e2('0x4a')]=_0x56f4fa[_0x12e2('0x4a')][_0x12e2('0x4b')]?_0x56f4fa[_0x12e2('0x4a')]:_0x59c26e[_0x12e2('0x45')];_0x56f4fa[_0x12e2('0x4d')]=qs[_0x12e2('0x5d')](_0x450362[_0x12e2('0x46')]['sort']);_0x56f4fa['where']=qs[_0x12e2('0x47')](_[_0x12e2('0x5e')](_0x450362[_0x12e2('0x46')],_0x59c26e[_0x12e2('0x47')]));if(_0x450362[_0x12e2('0x46')][_0x12e2('0x4f')]){_0x56f4fa['where']=_[_0x12e2('0x39')](_0x56f4fa[_0x12e2('0x4e')],{'$or':_[_0x12e2('0x3f')](_0x56f4fa[_0x12e2('0x4a')],function(_0x466e9c){var _0x2b977c={};_0x2b977c[_0x466e9c]={'$like':'%'+_0x450362[_0x12e2('0x46')][_0x12e2('0x4f')]+'%'};return _0x2b977c;})});}_0x56f4fa=_['merge']({},_0x56f4fa,_0x450362[_0x12e2('0x51')]);return _0x43792e[_0x12e2('0x64')](_0x56f4fa);}})[_0x12e2('0x1d')](function(_0x18383c){if(_0x18383c){_0x53e653=_0x18383c[_0x12e2('0x4b')];if(!_0x450362[_0x12e2('0x46')][_0x12e2('0x63')]('nolimit')){_0x56f4fa['limit']=qs['limit'](_0x450362[_0x12e2('0x46')][_0x12e2('0x2c')]);_0x56f4fa[_0x12e2('0x2a')]=qs['offset'](_0x450362['query'][_0x12e2('0x2a')]);}return _0x43792e[_0x12e2('0x64')](_0x56f4fa);}})[_0x12e2('0x1d')](function(_0x291e2d){if(_0x291e2d){return _0x291e2d?{'count':_0x53e653,'rows':_0x291e2d}:null;}})[_0x12e2('0x1d')](respondWithResult(_0x573b1f,null))[_0x12e2('0x27')](handleError(_0x573b1f,null));};exports['setTags']=function(_0x3d8a1b,_0x382288,_0x4b3faa){if(_0x3d8a1b[_0x12e2('0x5b')]['id']){delete _0x3d8a1b[_0x12e2('0x5b')]['id'];}return db[_0x12e2('0x40')][_0x12e2('0x5c')]({'where':{'id':_0x3d8a1b['params']['id']}})[_0x12e2('0x1d')](handleEntityNotFound(_0x382288,null))['then'](function(_0x7996dc){if(_0x7996dc){return _0x7996dc['setTags'](_0x3d8a1b[_0x12e2('0x5b')][_0x12e2('0x65')]||[]);}return null;})[_0x12e2('0x1d')](respondWithResult(_0x382288,null))[_0x12e2('0x27')](handleError(_0x382288,null));}; \ No newline at end of file +var _0x5698=['reject','update','then','stack','name','send','render','merge','contact','agent','interaction','account','ZendeskConfiguration','rawAttributes','type','key','keys','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','map','VIRTUAL','options','include','catch','show','params','create','body','find','getFields','ZendeskField','findOne','getSubjects','getDescriptions','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply'];(function(_0x573307,_0x5a7b41){var _0x15f84b=function(_0x5efbc0){while(--_0x5efbc0){_0x573307['push'](_0x573307['shift']());}};_0x15f84b(++_0x5a7b41);}(_0x5698,0xf4));var _0x8569=function(_0x5e9850,_0x291edf){_0x5e9850=_0x5e9850-0x0;var _0x2d3d96=_0x5698[_0x5e9850];return _0x2d3d96;};'use strict';var emlformat=require(_0x8569('0x0'));var rimraf=require(_0x8569('0x1'));var zipdir=require(_0x8569('0x2'));var jsonpatch=require(_0x8569('0x3'));var rp=require(_0x8569('0x4'));var moment=require(_0x8569('0x5'));var BPromise=require(_0x8569('0x6'));var Mustache=require(_0x8569('0x7'));var util=require(_0x8569('0x8'));var path=require(_0x8569('0x9'));var sox=require(_0x8569('0xa'));var csv=require(_0x8569('0xb'));var ejs=require(_0x8569('0xc'));var fs=require('fs');var fs_extra=require(_0x8569('0xd'));var _=require(_0x8569('0xe'));var squel=require('squel');var crypto=require(_0x8569('0xf'));var jsforce=require(_0x8569('0x10'));var deskjs=require(_0x8569('0x11'));var toCsv=require(_0x8569('0xb'));var querystring=require(_0x8569('0x12'));var Papa=require('papaparse');var Redis=require(_0x8569('0x13'));var authService=require(_0x8569('0x14'));var qs=require(_0x8569('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8569('0x16'));var logger=require(_0x8569('0x17'))(_0x8569('0x18'));var utils=require(_0x8569('0x19'));var config=require(_0x8569('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x8569('0x1b'))['db'];var jayson=require(_0x8569('0x1c'));var client=jayson[_0x8569('0x1d')][_0x8569('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2c5c57,_0x62a4da,_0x41547e,_0x38339f){return new BPromise(function(_0x28d97f,_0x30e092){var _0x346511=_0x38339f||client;return _0x346511['request'](_0x2c5c57,_0x41547e)['then'](function(_0x13c968){logger['info'](_0x8569('0x1f'),_0x62a4da,'request\x20sent');logger[_0x8569('0x20')](_0x8569('0x21'),_0x62a4da,_0x8569('0x22'),JSON[_0x8569('0x23')](_0x13c968));if(_0x13c968[_0x8569('0x24')]){if(_0x13c968[_0x8569('0x24')][_0x8569('0x25')]===0x1f4){logger[_0x8569('0x24')](_0x8569('0x1f'),_0x62a4da,_0x13c968[_0x8569('0x24')][_0x8569('0x26')]);return _0x30e092(_0x13c968[_0x8569('0x24')][_0x8569('0x26')]);}logger[_0x8569('0x24')]('ZendeskConfiguration,\x20%s,\x20%s',_0x62a4da,_0x13c968[_0x8569('0x24')][_0x8569('0x26')]);return _0x28d97f(_0x13c968[_0x8569('0x24')][_0x8569('0x26')]);}else{logger[_0x8569('0x27')](_0x8569('0x1f'),_0x62a4da,'request\x20sent');_0x28d97f(_0x13c968['result'][_0x8569('0x26')]);}})['catch'](function(_0x36bbc8){logger[_0x8569('0x24')](_0x8569('0x1f'),_0x62a4da,_0x36bbc8);_0x30e092(_0x36bbc8);});});}function respondWithStatusCode(_0x341092,_0x316835){_0x316835=_0x316835||0xcc;return function(_0x2973e7){if(_0x2973e7){return _0x341092[_0x8569('0x28')](_0x316835);}return _0x341092[_0x8569('0x29')](_0x316835)[_0x8569('0x2a')]();};}function respondWithResult(_0x29b62e,_0x5b9f7c){_0x5b9f7c=_0x5b9f7c||0xc8;return function(_0x4e8b90){if(_0x4e8b90){return _0x29b62e['status'](_0x5b9f7c)['json'](_0x4e8b90);}};}function respondWithFilteredResult(_0x4f90d1,_0x1377c0){return function(_0x34e0ce){if(_0x34e0ce){var _0x32969d=typeof _0x1377c0[_0x8569('0x2b')]===_0x8569('0x2c')&&typeof _0x1377c0[_0x8569('0x2d')]===_0x8569('0x2c');var _0x3cf83b=_0x34e0ce[_0x8569('0x2e')];var _0x350964=_0x32969d?0x0:_0x1377c0['offset'];var _0x5921e9=_0x32969d?_0x34e0ce[_0x8569('0x2e')]:_0x1377c0['offset']+_0x1377c0[_0x8569('0x2d')];var _0x15e7ae;if(_0x5921e9>=_0x3cf83b){_0x5921e9=_0x3cf83b;_0x15e7ae=0xc8;}else{_0x15e7ae=0xce;}_0x4f90d1['status'](_0x15e7ae);return _0x4f90d1['set'](_0x8569('0x2f'),_0x350964+'-'+_0x5921e9+'/'+_0x3cf83b)[_0x8569('0x30')](_0x34e0ce);}return null;};}function patchUpdates(_0x1d1cad){return function(_0x13af64){try{jsonpatch[_0x8569('0x31')](_0x13af64,_0x1d1cad,!![]);}catch(_0x592d71){return BPromise[_0x8569('0x32')](_0x592d71);}return _0x13af64['save']();};}function saveUpdates(_0x1b29de,_0x29e801){return function(_0x37c6ce){if(_0x37c6ce){return _0x37c6ce[_0x8569('0x33')](_0x1b29de)[_0x8569('0x34')](function(_0x50f1de){return _0x50f1de;});}return null;};}function removeEntity(_0x5eefa9,_0x18ae5e){return function(_0x2deccc){if(_0x2deccc){return _0x2deccc['destroy']()['then'](function(){_0x5eefa9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cfa8e,_0x131744){return function(_0x34bc58){if(!_0x34bc58){_0x2cfa8e['sendStatus'](0x194);}return _0x34bc58;};}function handleError(_0x30249d,_0x504b08){_0x504b08=_0x504b08||0x1f4;return function(_0x2c6a12){logger[_0x8569('0x24')](_0x2c6a12[_0x8569('0x35')]);if(_0x2c6a12[_0x8569('0x36')]){delete _0x2c6a12['name'];}_0x30249d['status'](_0x504b08)[_0x8569('0x37')](_0x2c6a12);};}function getMustacheRender(_0x13e90f,_0x5234c5){return Mustache[_0x8569('0x38')](_0x13e90f,_[_0x8569('0x39')](_0x5234c5['body'],{'contact':_0x5234c5[_0x8569('0x3a')],'message':_0x5234c5[_0x8569('0x26')],'agent':_0x5234c5[_0x8569('0x3b')],'interaction':_0x5234c5[_0x8569('0x3c')],'account':_0x5234c5[_0x8569('0x3d')]}))||'';}exports['index']=function(_0x27ae57,_0x35221c){var _0x1ee91d={},_0x3b9262={},_0x202ee9={'count':0x0,'rows':[]};var _0x4a2f3c=_['map'](db[_0x8569('0x3e')][_0x8569('0x3f')],function(_0x45d726){return{'name':_0x45d726['fieldName'],'type':_0x45d726[_0x8569('0x40')][_0x8569('0x41')]};});_0x3b9262['model']=_['map'](_0x4a2f3c,'name');_0x3b9262['query']=_[_0x8569('0x42')](_0x27ae57[_0x8569('0x43')]);_0x3b9262['filters']=_['intersection'](_0x3b9262['model'],_0x3b9262[_0x8569('0x43')]);_0x1ee91d[_0x8569('0x44')]=_[_0x8569('0x45')](_0x3b9262[_0x8569('0x46')],qs[_0x8569('0x47')](_0x27ae57[_0x8569('0x43')][_0x8569('0x47')]));_0x1ee91d['attributes']=_0x1ee91d[_0x8569('0x44')][_0x8569('0x48')]?_0x1ee91d['attributes']:_0x3b9262[_0x8569('0x46')];if(!_0x27ae57[_0x8569('0x43')][_0x8569('0x49')](_0x8569('0x4a'))){_0x1ee91d[_0x8569('0x2d')]=qs['limit'](_0x27ae57['query'][_0x8569('0x2d')]);_0x1ee91d['offset']=qs[_0x8569('0x2b')](_0x27ae57['query'][_0x8569('0x2b')]);}_0x1ee91d[_0x8569('0x4b')]=qs[_0x8569('0x4c')](_0x27ae57[_0x8569('0x43')][_0x8569('0x4c')]);_0x1ee91d['where']=qs[_0x8569('0x4d')](_[_0x8569('0x4e')](_0x27ae57[_0x8569('0x43')],_0x3b9262[_0x8569('0x4d')]),_0x4a2f3c);if(_0x27ae57[_0x8569('0x43')][_0x8569('0x4f')]){_0x1ee91d[_0x8569('0x50')]=_[_0x8569('0x39')](_0x1ee91d[_0x8569('0x50')],{'$or':_[_0x8569('0x51')](_0x4a2f3c,function(_0x5b412c){if(_0x5b412c[_0x8569('0x40')]!==_0x8569('0x52')){var _0x5cf4df={};_0x5cf4df[_0x5b412c[_0x8569('0x36')]]={'$like':'%'+_0x27ae57[_0x8569('0x43')][_0x8569('0x4f')]+'%'};return _0x5cf4df;}})});}_0x1ee91d=_['merge']({},_0x1ee91d,_0x27ae57[_0x8569('0x53')]);var _0x52af5d={'where':_0x1ee91d[_0x8569('0x50')]};return db[_0x8569('0x3e')][_0x8569('0x2e')](_0x52af5d)[_0x8569('0x34')](function(_0x28dcbf){_0x202ee9[_0x8569('0x2e')]=_0x28dcbf;if(_0x27ae57['query']['includeAll']){_0x1ee91d[_0x8569('0x54')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x1ee91d);})['then'](function(_0x5cbb35){_0x202ee9['rows']=_0x5cbb35;return _0x202ee9;})[_0x8569('0x34')](respondWithFilteredResult(_0x35221c,_0x1ee91d))[_0x8569('0x55')](handleError(_0x35221c,null));};exports[_0x8569('0x56')]=function(_0x2d4458,_0x5b053e){var _0x37433d={'raw':![],'where':{'id':_0x2d4458[_0x8569('0x57')]['id']}},_0x2b6fd1={};_0x2b6fd1[_0x8569('0x46')]=_[_0x8569('0x42')](db[_0x8569('0x3e')][_0x8569('0x3f')]);_0x2b6fd1['query']=_['keys'](_0x2d4458[_0x8569('0x43')]);_0x2b6fd1[_0x8569('0x4d')]=_[_0x8569('0x45')](_0x2b6fd1[_0x8569('0x46')],_0x2b6fd1[_0x8569('0x43')]);_0x37433d['attributes']=_[_0x8569('0x45')](_0x2b6fd1[_0x8569('0x46')],qs[_0x8569('0x47')](_0x2d4458['query'][_0x8569('0x47')]));_0x37433d[_0x8569('0x44')]=_0x37433d[_0x8569('0x44')][_0x8569('0x48')]?_0x37433d[_0x8569('0x44')]:_0x2b6fd1[_0x8569('0x46')];if(_0x2d4458[_0x8569('0x43')]['includeAll']){_0x37433d[_0x8569('0x54')]=[{'all':!![]}];}_0x37433d=_[_0x8569('0x39')]({},_0x37433d,_0x2d4458[_0x8569('0x53')]);return db[_0x8569('0x3e')]['find'](_0x37433d)[_0x8569('0x34')](handleEntityNotFound(_0x5b053e,null))[_0x8569('0x34')](respondWithResult(_0x5b053e,null))[_0x8569('0x55')](handleError(_0x5b053e,null));};exports['create']=function(_0xc30a81,_0x219cba){return db[_0x8569('0x3e')][_0x8569('0x58')](_0xc30a81[_0x8569('0x59')],{})['then'](respondWithResult(_0x219cba,0xc9))[_0x8569('0x55')](handleError(_0x219cba,null));};exports[_0x8569('0x33')]=function(_0x271448,_0x2db8fa){if(_0x271448[_0x8569('0x59')]['id']){delete _0x271448[_0x8569('0x59')]['id'];}return db[_0x8569('0x3e')][_0x8569('0x5a')]({'where':{'id':_0x271448[_0x8569('0x57')]['id']}})[_0x8569('0x34')](handleEntityNotFound(_0x2db8fa,null))[_0x8569('0x34')](saveUpdates(_0x271448[_0x8569('0x59')],null))[_0x8569('0x34')](respondWithResult(_0x2db8fa,null))[_0x8569('0x55')](handleError(_0x2db8fa,null));};exports['destroy']=function(_0x5ea6f6,_0x2f9c2d){return db[_0x8569('0x3e')]['find']({'where':{'id':_0x5ea6f6[_0x8569('0x57')]['id']}})[_0x8569('0x34')](handleEntityNotFound(_0x2f9c2d,null))[_0x8569('0x34')](removeEntity(_0x2f9c2d,null))[_0x8569('0x55')](handleError(_0x2f9c2d,null));};exports[_0x8569('0x5b')]=function(_0x3f3b37,_0x59b3be,_0x5f3d0a){var _0x1642e5={};var _0xff40ec={};var _0x2d5c3;var _0x3deb40;return db[_0x8569('0x3e')]['findOne']({'where':{'id':_0x3f3b37[_0x8569('0x57')]['id']}})[_0x8569('0x34')](handleEntityNotFound(_0x59b3be,null))[_0x8569('0x34')](function(_0x1b1ed2){if(_0x1b1ed2){_0x2d5c3=_0x1b1ed2;_0xff40ec[_0x8569('0x46')]=_[_0x8569('0x42')](db[_0x8569('0x5c')][_0x8569('0x3f')]);_0xff40ec[_0x8569('0x43')]=_[_0x8569('0x42')](_0x3f3b37[_0x8569('0x43')]);_0xff40ec[_0x8569('0x4d')]=_[_0x8569('0x45')](_0xff40ec[_0x8569('0x46')],_0xff40ec[_0x8569('0x43')]);_0x1642e5[_0x8569('0x44')]=_['intersection'](_0xff40ec[_0x8569('0x46')],qs['fields'](_0x3f3b37[_0x8569('0x43')]['fields']));_0x1642e5[_0x8569('0x44')]=_0x1642e5[_0x8569('0x44')]['length']?_0x1642e5['attributes']:_0xff40ec[_0x8569('0x46')];_0x1642e5[_0x8569('0x4b')]=qs[_0x8569('0x4c')](_0x3f3b37['query']['sort']);_0x1642e5[_0x8569('0x50')]=qs[_0x8569('0x4d')](_['pick'](_0x3f3b37[_0x8569('0x43')],_0xff40ec['filters']));if(_0x3f3b37[_0x8569('0x43')][_0x8569('0x4f')]){_0x1642e5['where']=_[_0x8569('0x39')](_0x1642e5['where'],{'$or':_[_0x8569('0x51')](_0x1642e5[_0x8569('0x44')],function(_0x41c3e0){var _0x174296={};_0x174296[_0x41c3e0]={'$like':'%'+_0x3f3b37['query'][_0x8569('0x4f')]+'%'};return _0x174296;})});}_0x1642e5=_[_0x8569('0x39')]({},_0x1642e5,_0x3f3b37[_0x8569('0x53')]);return _0x2d5c3['getFields'](_0x1642e5);}})[_0x8569('0x34')](function(_0x5c18f6){if(_0x5c18f6){_0x3deb40=_0x5c18f6[_0x8569('0x48')];if(!_0x3f3b37[_0x8569('0x43')][_0x8569('0x49')]('nolimit')){_0x1642e5[_0x8569('0x2d')]=qs[_0x8569('0x2d')](_0x3f3b37['query']['limit']);_0x1642e5['offset']=qs[_0x8569('0x2b')](_0x3f3b37[_0x8569('0x43')]['offset']);}return _0x2d5c3['getFields'](_0x1642e5);}})[_0x8569('0x34')](function(_0x4607d1){if(_0x4607d1){return _0x4607d1?{'count':_0x3deb40,'rows':_0x4607d1}:null;}})[_0x8569('0x34')](respondWithResult(_0x59b3be,null))['catch'](handleError(_0x59b3be,null));};exports['getSubjects']=function(_0x11adc7,_0x4e9a0e,_0x5988d2){var _0x4d9c2a={};var _0x29f02f={};var _0x252154;var _0x386445;return db['ZendeskConfiguration'][_0x8569('0x5d')]({'where':{'id':_0x11adc7[_0x8569('0x57')]['id']}})[_0x8569('0x34')](handleEntityNotFound(_0x4e9a0e,null))[_0x8569('0x34')](function(_0x251ce6){if(_0x251ce6){_0x252154=_0x251ce6;_0x29f02f[_0x8569('0x46')]=_[_0x8569('0x42')](db[_0x8569('0x5c')][_0x8569('0x3f')]);_0x29f02f['query']=_['keys'](_0x11adc7[_0x8569('0x43')]);_0x29f02f[_0x8569('0x4d')]=_[_0x8569('0x45')](_0x29f02f['model'],_0x29f02f[_0x8569('0x43')]);_0x4d9c2a[_0x8569('0x44')]=_[_0x8569('0x45')](_0x29f02f[_0x8569('0x46')],qs['fields'](_0x11adc7[_0x8569('0x43')][_0x8569('0x47')]));_0x4d9c2a[_0x8569('0x44')]=_0x4d9c2a[_0x8569('0x44')]['length']?_0x4d9c2a['attributes']:_0x29f02f['model'];_0x4d9c2a[_0x8569('0x4b')]=qs['sort'](_0x11adc7['query'][_0x8569('0x4c')]);_0x4d9c2a['where']=qs[_0x8569('0x4d')](_[_0x8569('0x4e')](_0x11adc7['query'],_0x29f02f[_0x8569('0x4d')]));if(_0x11adc7[_0x8569('0x43')][_0x8569('0x4f')]){_0x4d9c2a['where']=_['merge'](_0x4d9c2a[_0x8569('0x50')],{'$or':_['map'](_0x4d9c2a['attributes'],function(_0x4b3aa0){var _0x10a6b3={};_0x10a6b3[_0x4b3aa0]={'$like':'%'+_0x11adc7[_0x8569('0x43')][_0x8569('0x4f')]+'%'};return _0x10a6b3;})});}_0x4d9c2a=_[_0x8569('0x39')]({},_0x4d9c2a,_0x11adc7[_0x8569('0x53')]);return _0x252154[_0x8569('0x5e')](_0x4d9c2a);}})[_0x8569('0x34')](function(_0xdfa19c){if(_0xdfa19c){_0x386445=_0xdfa19c[_0x8569('0x48')];if(!_0x11adc7[_0x8569('0x43')][_0x8569('0x49')](_0x8569('0x4a'))){_0x4d9c2a['limit']=qs[_0x8569('0x2d')](_0x11adc7[_0x8569('0x43')]['limit']);_0x4d9c2a[_0x8569('0x2b')]=qs[_0x8569('0x2b')](_0x11adc7[_0x8569('0x43')][_0x8569('0x2b')]);}return _0x252154[_0x8569('0x5e')](_0x4d9c2a);}})['then'](function(_0x2f80e0){if(_0x2f80e0){return _0x2f80e0?{'count':_0x386445,'rows':_0x2f80e0}:null;}})[_0x8569('0x34')](respondWithResult(_0x4e9a0e,null))[_0x8569('0x55')](handleError(_0x4e9a0e,null));};exports['getDescriptions']=function(_0x5a11a0,_0x3e570d,_0x1199fc){var _0x4575a8={};var _0x39bd60={};var _0x2c05e8;var _0x5449c1;return db[_0x8569('0x3e')][_0x8569('0x5d')]({'where':{'id':_0x5a11a0['params']['id']}})['then'](handleEntityNotFound(_0x3e570d,null))[_0x8569('0x34')](function(_0x127b9d){if(_0x127b9d){_0x2c05e8=_0x127b9d;_0x39bd60['model']=_['keys'](db[_0x8569('0x5c')][_0x8569('0x3f')]);_0x39bd60[_0x8569('0x43')]=_[_0x8569('0x42')](_0x5a11a0[_0x8569('0x43')]);_0x39bd60[_0x8569('0x4d')]=_[_0x8569('0x45')](_0x39bd60[_0x8569('0x46')],_0x39bd60[_0x8569('0x43')]);_0x4575a8['attributes']=_[_0x8569('0x45')](_0x39bd60['model'],qs[_0x8569('0x47')](_0x5a11a0['query'][_0x8569('0x47')]));_0x4575a8[_0x8569('0x44')]=_0x4575a8[_0x8569('0x44')][_0x8569('0x48')]?_0x4575a8[_0x8569('0x44')]:_0x39bd60[_0x8569('0x46')];_0x4575a8['order']=qs[_0x8569('0x4c')](_0x5a11a0[_0x8569('0x43')][_0x8569('0x4c')]);_0x4575a8['where']=qs[_0x8569('0x4d')](_[_0x8569('0x4e')](_0x5a11a0['query'],_0x39bd60[_0x8569('0x4d')]));if(_0x5a11a0[_0x8569('0x43')][_0x8569('0x4f')]){_0x4575a8[_0x8569('0x50')]=_[_0x8569('0x39')](_0x4575a8[_0x8569('0x50')],{'$or':_[_0x8569('0x51')](_0x4575a8['attributes'],function(_0x422fe6){var _0x3cb94a={};_0x3cb94a[_0x422fe6]={'$like':'%'+_0x5a11a0[_0x8569('0x43')][_0x8569('0x4f')]+'%'};return _0x3cb94a;})});}_0x4575a8=_[_0x8569('0x39')]({},_0x4575a8,_0x5a11a0['options']);return _0x2c05e8['getDescriptions'](_0x4575a8);}})[_0x8569('0x34')](function(_0x4df029){if(_0x4df029){_0x5449c1=_0x4df029[_0x8569('0x48')];if(!_0x5a11a0[_0x8569('0x43')][_0x8569('0x49')]('nolimit')){_0x4575a8[_0x8569('0x2d')]=qs[_0x8569('0x2d')](_0x5a11a0[_0x8569('0x43')][_0x8569('0x2d')]);_0x4575a8[_0x8569('0x2b')]=qs[_0x8569('0x2b')](_0x5a11a0[_0x8569('0x43')][_0x8569('0x2b')]);}return _0x2c05e8[_0x8569('0x5f')](_0x4575a8);}})[_0x8569('0x34')](function(_0x4ea51f){if(_0x4ea51f){return _0x4ea51f?{'count':_0x5449c1,'rows':_0x4ea51f}:null;}})[_0x8569('0x34')](respondWithResult(_0x3e570d,null))['catch'](handleError(_0x3e570d,null));};exports[_0x8569('0x60')]=function(_0xec7d63,_0x3f82db,_0x3918be){var _0x4fdb42={};var _0x5b1154={};var _0x1932b5;var _0x4c03aa;return db[_0x8569('0x3e')][_0x8569('0x5d')]({'where':{'id':_0xec7d63['params']['id']}})[_0x8569('0x34')](handleEntityNotFound(_0x3f82db,null))[_0x8569('0x34')](function(_0x1328f4){if(_0x1328f4){_0x1932b5=_0x1328f4;_0x5b1154[_0x8569('0x46')]=_[_0x8569('0x42')](db['Tag'][_0x8569('0x3f')]);_0x5b1154[_0x8569('0x43')]=_[_0x8569('0x42')](_0xec7d63[_0x8569('0x43')]);_0x5b1154[_0x8569('0x4d')]=_[_0x8569('0x45')](_0x5b1154[_0x8569('0x46')],_0x5b1154[_0x8569('0x43')]);_0x4fdb42[_0x8569('0x44')]=_[_0x8569('0x45')](_0x5b1154[_0x8569('0x46')],qs['fields'](_0xec7d63[_0x8569('0x43')][_0x8569('0x47')]));_0x4fdb42[_0x8569('0x44')]=_0x4fdb42[_0x8569('0x44')]['length']?_0x4fdb42[_0x8569('0x44')]:_0x5b1154[_0x8569('0x46')];_0x4fdb42[_0x8569('0x4b')]=qs[_0x8569('0x4c')](_0xec7d63[_0x8569('0x43')][_0x8569('0x4c')]);_0x4fdb42[_0x8569('0x50')]=qs[_0x8569('0x4d')](_[_0x8569('0x4e')](_0xec7d63['query'],_0x5b1154[_0x8569('0x4d')]));if(_0xec7d63[_0x8569('0x43')][_0x8569('0x4f')]){_0x4fdb42[_0x8569('0x50')]=_[_0x8569('0x39')](_0x4fdb42[_0x8569('0x50')],{'$or':_['map'](_0x4fdb42[_0x8569('0x44')],function(_0x257446){var _0x2e98b2={};_0x2e98b2[_0x257446]={'$like':'%'+_0xec7d63['query']['filter']+'%'};return _0x2e98b2;})});}_0x4fdb42=_[_0x8569('0x39')]({},_0x4fdb42,_0xec7d63[_0x8569('0x53')]);return _0x1932b5[_0x8569('0x60')](_0x4fdb42);}})[_0x8569('0x34')](function(_0x8d1dee){if(_0x8d1dee){_0x4c03aa=_0x8d1dee[_0x8569('0x48')];if(!_0xec7d63['query'][_0x8569('0x49')](_0x8569('0x4a'))){_0x4fdb42[_0x8569('0x2d')]=qs[_0x8569('0x2d')](_0xec7d63[_0x8569('0x43')]['limit']);_0x4fdb42[_0x8569('0x2b')]=qs['offset'](_0xec7d63[_0x8569('0x43')][_0x8569('0x2b')]);}return _0x1932b5[_0x8569('0x60')](_0x4fdb42);}})[_0x8569('0x34')](function(_0x217d8b){if(_0x217d8b){return _0x217d8b?{'count':_0x4c03aa,'rows':_0x217d8b}:null;}})[_0x8569('0x34')](respondWithResult(_0x3f82db,null))['catch'](handleError(_0x3f82db,null));};exports[_0x8569('0x61')]=function(_0x43025b,_0x346343,_0x42a6c){if(_0x43025b[_0x8569('0x59')]['id']){delete _0x43025b[_0x8569('0x59')]['id'];}return db['ZendeskConfiguration'][_0x8569('0x5d')]({'where':{'id':_0x43025b['params']['id']}})[_0x8569('0x34')](handleEntityNotFound(_0x346343,null))[_0x8569('0x34')](function(_0x456559){if(_0x456559){return _0x456559[_0x8569('0x61')](_0x43025b['body']['ids']||[]);}return null;})[_0x8569('0x34')](respondWithResult(_0x346343,null))[_0x8569('0x55')](handleError(_0x346343,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 6e1f34c..0ed38d0 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 _0x86bb=['moment','request-promise','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api'];(function(_0x3932e2,_0x450dec){var _0x28b2c1=function(_0x1f467e){while(--_0x1f467e){_0x3932e2['push'](_0x3932e2['shift']());}};_0x28b2c1(++_0x450dec);}(_0x86bb,0x197));var _0xb86b=function(_0x11f28f,_0x30ebf9){_0x11f28f=_0x11f28f-0x0;var _0x413f1a=_0x86bb[_0x11f28f];return _0x413f1a;};'use strict';var _=require(_0xb86b('0x0'));var util=require(_0xb86b('0x1'));var logger=require('../../config/logger')(_0xb86b('0x2'));var moment=require(_0xb86b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb86b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb86b('0x5'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xb86b('0x6')]=function(_0x4b65a9,_0x29aab1){return _0x4b65a9[_0xb86b('0x7')](_0xb86b('0x8'),attributes,{'tableName':_0xb86b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe19a=['int_zendesk_configurations','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe19a,0x194));var _0xae19=function(_0xb14c00,_0x281183){_0xb14c00=_0xb14c00-0x0;var _0x236a87=_0xe19a[_0xb14c00];return _0x236a87;};'use strict';var _=require(_0xae19('0x0'));var util=require(_0xae19('0x1'));var logger=require(_0xae19('0x2'))(_0xae19('0x3'));var moment=require(_0xae19('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xae19('0x5'));var rimraf=require(_0xae19('0x6'));var config=require(_0xae19('0x7'));var attributes=require(_0xae19('0x8'));module[_0xae19('0x9')]=function(_0x5790bc,_0x53ede2){return _0x5790bc[_0xae19('0xa')](_0xae19('0xb'),attributes,{'tableName':_0xae19('0xc'),'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 0d0ecef..f403113 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 _0x075d=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x4d84f4,_0x592eb8){var _0xac5fa5=function(_0x220b45){while(--_0x220b45){_0x4d84f4['push'](_0x4d84f4['shift']());}};_0xac5fa5(++_0x592eb8);}(_0x075d,0x134));var _0xd075=function(_0x1edd20,_0x1dbc2f){_0x1edd20=_0x1edd20-0x0;var _0x4188b9=_0x075d[_0x1edd20];return _0x4188b9;};'use strict';var _=require(_0xd075('0x0'));var util=require('util');var moment=require(_0xd075('0x1'));var BPromise=require('bluebird');var rs=require(_0xd075('0x2'));var fs=require('fs');var Redis=require(_0xd075('0x3'));var db=require(_0xd075('0x4'))['db'];var utils=require(_0xd075('0x5'));var logger=require('../../config/logger')(_0xd075('0x6'));var config=require(_0xd075('0x7'));var jayson=require(_0xd075('0x8'));var client=jayson[_0xd075('0x9')][_0xd075('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a34d3,_0x4139b8,_0x447fe2){return new BPromise(function(_0x1def55,_0x4ff209){return client[_0xd075('0xb')](_0x2a34d3,_0x447fe2)[_0xd075('0xc')](function(_0x428458){logger[_0xd075('0xd')](_0xd075('0xe'),_0x4139b8,_0xd075('0xf'));logger[_0xd075('0x10')](_0xd075('0x11'),_0x4139b8,_0xd075('0xf'),JSON[_0xd075('0x12')](_0x428458));if(_0x428458[_0xd075('0x13')]){if(_0x428458['error']['code']===0x1f4){logger[_0xd075('0x13')](_0xd075('0xe'),_0x4139b8,_0x428458[_0xd075('0x13')]['message']);return _0x4ff209(_0x428458[_0xd075('0x13')][_0xd075('0x14')]);}logger['error'](_0xd075('0xe'),_0x4139b8,_0x428458[_0xd075('0x13')][_0xd075('0x14')]);return _0x1def55(_0x428458[_0xd075('0x13')][_0xd075('0x14')]);}else{logger[_0xd075('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4139b8,_0xd075('0xf'));_0x1def55(_0x428458[_0xd075('0x15')]['message']);}})['catch'](function(_0x59d83f){logger[_0xd075('0x13')](_0xd075('0xe'),_0x4139b8,_0x59d83f);_0x4ff209(_0x59d83f);});});} \ No newline at end of file +var _0x5fc3=['result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3c57c7,_0x18e494){var _0x9c2cbb=function(_0x4195d0){while(--_0x4195d0){_0x3c57c7['push'](_0x3c57c7['shift']());}};_0x9c2cbb(++_0x18e494);}(_0x5fc3,0xd3));var _0x35fc=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x5fc3[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x35fc('0x0'));var BPromise=require(_0x35fc('0x1'));var rs=require(_0x35fc('0x2'));var fs=require('fs');var Redis=require(_0x35fc('0x3'));var db=require(_0x35fc('0x4'))['db'];var utils=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('rpc');var config=require(_0x35fc('0x7'));var jayson=require(_0x35fc('0x8'));var client=jayson[_0x35fc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2826db,_0x11ac31,_0x3ea841){return new BPromise(function(_0x47718a,_0x2edddf){return client[_0x35fc('0xa')](_0x2826db,_0x3ea841)[_0x35fc('0xb')](function(_0x591885){logger[_0x35fc('0xc')](_0x35fc('0xd'),_0x11ac31,_0x35fc('0xe'));logger[_0x35fc('0xf')](_0x35fc('0x10'),_0x11ac31,_0x35fc('0xe'),JSON['stringify'](_0x591885));if(_0x591885[_0x35fc('0x11')]){if(_0x591885[_0x35fc('0x11')][_0x35fc('0x12')]===0x1f4){logger[_0x35fc('0x11')](_0x35fc('0xd'),_0x11ac31,_0x591885[_0x35fc('0x11')]['message']);return _0x2edddf(_0x591885[_0x35fc('0x11')][_0x35fc('0x13')]);}logger[_0x35fc('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x11ac31,_0x591885[_0x35fc('0x11')]['message']);return _0x47718a(_0x591885[_0x35fc('0x11')]['message']);}else{logger['info'](_0x35fc('0xd'),_0x11ac31,_0x35fc('0xe'));_0x47718a(_0x591885[_0x35fc('0x14')][_0x35fc('0x13')]);}})['catch'](function(_0x4d61a0){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x11ac31,_0x4d61a0);_0x2edddf(_0x4d61a0);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 1d30875..dd6abe4 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 _0x7221=['show','create','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id'];(function(_0xf0a9fe,_0x4746be){var _0x5c4b7e=function(_0x2d414c){while(--_0x2d414c){_0xf0a9fe['push'](_0xf0a9fe['shift']());}};_0x5c4b7e(++_0x4746be);}(_0x7221,0x124));var _0x1722=function(_0x1729d5,_0x5921c5){_0x1729d5=_0x1729d5-0x0;var _0x6bb300=_0x7221[_0x1729d5];return _0x6bb300;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1722('0x0'));var timeout=require(_0x1722('0x1'));var express=require(_0x1722('0x2'));var router=express[_0x1722('0x3')]();var fs_extra=require(_0x1722('0x4'));var auth=require(_0x1722('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1722('0x6'));var controller=require(_0x1722('0x7'));router['get']('/',auth[_0x1722('0x8')](),controller[_0x1722('0x9')]);router[_0x1722('0xa')](_0x1722('0xb'),auth['isAuthenticated'](),controller[_0x1722('0xc')]);router['post']('/',auth[_0x1722('0x8')](),controller[_0x1722('0xd')]);router['put'](_0x1722('0xb'),auth[_0x1722('0x8')](),controller[_0x1722('0xe')]);router['delete'](_0x1722('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1722('0xf')]=router; \ No newline at end of file +var _0xf5ca=['path','express','Router','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','post','create','put','multer','util'];(function(_0xe574fc,_0x59cc04){var _0x5f3deb=function(_0xcfd59a){while(--_0xcfd59a){_0xe574fc['push'](_0xe574fc['shift']());}};_0x5f3deb(++_0x59cc04);}(_0xf5ca,0x1cf));var _0xaf5c=function(_0x2a1465,_0x8bf785){_0x2a1465=_0x2a1465-0x0;var _0x128933=_0xf5ca[_0x2a1465];return _0x128933;};'use strict';var multer=require(_0xaf5c('0x0'));var util=require(_0xaf5c('0x1'));var path=require(_0xaf5c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf5c('0x3'));var router=express[_0xaf5c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaf5c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaf5c('0x6'));var controller=require(_0xaf5c('0x7'));router[_0xaf5c('0x8')]('/',auth[_0xaf5c('0x9')](),controller[_0xaf5c('0xa')]);router[_0xaf5c('0x8')](_0xaf5c('0xb'),auth[_0xaf5c('0x9')](),controller['show']);router[_0xaf5c('0xc')]('/',auth[_0xaf5c('0x9')](),controller[_0xaf5c('0xd')]);router[_0xaf5c('0xe')](_0xaf5c('0xb'),auth[_0xaf5c('0x9')](),controller['update']);router['delete'](_0xaf5c('0xb'),auth[_0xaf5c('0x9')](),controller['destroy']);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 1b2a106..bdaba25 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 _0x32ef=['STRING','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0xe8e912,_0x14a97a){var _0x252b6f=function(_0x4ce80f){while(--_0x4ce80f){_0xe8e912['push'](_0xe8e912['shift']());}};_0x252b6f(++_0x14a97a);}(_0x32ef,0xf9));var _0xf32e=function(_0x51cdaa,_0x16aafa){_0x51cdaa=_0x51cdaa-0x0;var _0x4a1b46=_0x32ef[_0x51cdaa];return _0x4a1b46;};'use strict';var Sequelize=require(_0xf32e('0x0'));module[_0xf32e('0x1')]={'type':{'type':Sequelize[_0xf32e('0x2')](_0xf32e('0x3'),_0xf32e('0x4'),_0xf32e('0x5'),'keyValue',_0xf32e('0x6')),'defaultValue':_0xf32e('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf32e('0x7')]},'keyType':{'type':Sequelize[_0xf32e('0x2')](_0xf32e('0x3'),_0xf32e('0x4'),_0xf32e('0x5'))},'keyContent':{'type':Sequelize[_0xf32e('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf32e('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf32e('0x7')]}}; \ No newline at end of file +var _0x2fed=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','sequelize','exports'];(function(_0x1b1711,_0x48ce12){var _0x2d7532=function(_0x141a81){while(--_0x141a81){_0x1b1711['push'](_0x1b1711['shift']());}};_0x2d7532(++_0x48ce12);}(_0x2fed,0x7c));var _0xd2fe=function(_0x546566,_0x4d1d8a){_0x546566=_0x546566-0x0;var _0x4cb0ae=_0x2fed[_0x546566];return _0x4cb0ae;};'use strict';var Sequelize=require(_0xd2fe('0x0'));module[_0xd2fe('0x1')]={'type':{'type':Sequelize[_0xd2fe('0x2')](_0xd2fe('0x3'),_0xd2fe('0x4'),'customVariable',_0xd2fe('0x5'),_0xd2fe('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd2fe('0x7')]},'keyType':{'type':Sequelize[_0xd2fe('0x2')](_0xd2fe('0x3'),'variable',_0xd2fe('0x8'))},'keyContent':{'type':Sequelize[_0xd2fe('0x7')]},'idField':{'type':Sequelize[_0xd2fe('0x7')]},'nameField':{'type':Sequelize[_0xd2fe('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd2fe('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 4e1af7c..ca639e0 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 _0x4e9b=['filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','end','name','send','contact','message','agent','account','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x40bd3a,_0x5b22a3){var _0x207fab=function(_0x2fbf29){while(--_0x2fbf29){_0x40bd3a['push'](_0x40bd3a['shift']());}};_0x207fab(++_0x5b22a3);}(_0x4e9b,0x156));var _0xb4e9=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x4e9b[_0x36ed3c];return _0x52a2e0;};'use strict';var emlformat=require(_0xb4e9('0x0'));var rimraf=require(_0xb4e9('0x1'));var zipdir=require(_0xb4e9('0x2'));var jsonpatch=require(_0xb4e9('0x3'));var rp=require('request-promise');var moment=require(_0xb4e9('0x4'));var BPromise=require(_0xb4e9('0x5'));var Mustache=require('mustache');var util=require(_0xb4e9('0x6'));var path=require(_0xb4e9('0x7'));var sox=require(_0xb4e9('0x8'));var csv=require('to-csv');var ejs=require(_0xb4e9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb4e9('0xa'));var squel=require('squel');var crypto=require(_0xb4e9('0xb'));var jsforce=require(_0xb4e9('0xc'));var deskjs=require(_0xb4e9('0xd'));var toCsv=require(_0xb4e9('0xe'));var querystring=require(_0xb4e9('0xf'));var Papa=require(_0xb4e9('0x10'));var Redis=require(_0xb4e9('0x11'));var authService=require(_0xb4e9('0x12'));var qs=require(_0xb4e9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb4e9('0x14'));var logger=require(_0xb4e9('0x15'))(_0xb4e9('0x16'));var utils=require(_0xb4e9('0x17'));var config=require(_0xb4e9('0x18'));var licenseUtil=require(_0xb4e9('0x19'));var db=require(_0xb4e9('0x1a'))['db'];function respondWithStatusCode(_0x1240e1,_0x2c3c1d){_0x2c3c1d=_0x2c3c1d||0xcc;return function(_0x4c5c0d){if(_0x4c5c0d){return _0x1240e1[_0xb4e9('0x1b')](_0x2c3c1d);}return _0x1240e1['status'](_0x2c3c1d)['end']();};}function respondWithResult(_0x3f4372,_0x4f5a0c){_0x4f5a0c=_0x4f5a0c||0xc8;return function(_0x3fa0f3){if(_0x3fa0f3){return _0x3f4372['status'](_0x4f5a0c)['json'](_0x3fa0f3);}};}function respondWithFilteredResult(_0x4b1519,_0x5c3204){return function(_0xeb2b1b){if(_0xeb2b1b){var _0x497d26=typeof _0x5c3204[_0xb4e9('0x1c')]===_0xb4e9('0x1d')&&typeof _0x5c3204[_0xb4e9('0x1e')]===_0xb4e9('0x1d');var _0x51490f=_0xeb2b1b[_0xb4e9('0x1f')];var _0x44948a=_0x497d26?0x0:_0x5c3204[_0xb4e9('0x1c')];var _0x45e2c4=_0x497d26?_0xeb2b1b[_0xb4e9('0x1f')]:_0x5c3204[_0xb4e9('0x1c')]+_0x5c3204[_0xb4e9('0x1e')];var _0x2f1d08;if(_0x45e2c4>=_0x51490f){_0x45e2c4=_0x51490f;_0x2f1d08=0xc8;}else{_0x2f1d08=0xce;}_0x4b1519[_0xb4e9('0x20')](_0x2f1d08);return _0x4b1519[_0xb4e9('0x21')](_0xb4e9('0x22'),_0x44948a+'-'+_0x45e2c4+'/'+_0x51490f)['json'](_0xeb2b1b);}return null;};}function patchUpdates(_0x4d68cd){return function(_0x45d5fe){try{jsonpatch[_0xb4e9('0x23')](_0x45d5fe,_0x4d68cd,!![]);}catch(_0x33f7ca){return BPromise[_0xb4e9('0x24')](_0x33f7ca);}return _0x45d5fe[_0xb4e9('0x25')]();};}function saveUpdates(_0xa4f442,_0x1fd410){return function(_0x168ee8){if(_0x168ee8){return _0x168ee8[_0xb4e9('0x26')](_0xa4f442)['then'](function(_0x3eea8c){return _0x3eea8c;});}return null;};}function removeEntity(_0x3f4602,_0x21da5b){return function(_0x3e67bd){if(_0x3e67bd){return _0x3e67bd[_0xb4e9('0x27')]()[_0xb4e9('0x28')](function(){_0x3f4602[_0xb4e9('0x20')](0xcc)[_0xb4e9('0x29')]();});}};}function handleEntityNotFound(_0x51fc4e,_0x44c98e){return function(_0x3b1073){if(!_0x3b1073){_0x51fc4e[_0xb4e9('0x1b')](0x194);}return _0x3b1073;};}function handleError(_0x1e9601,_0x1ff12c){_0x1ff12c=_0x1ff12c||0x1f4;return function(_0x13d1f5){logger['error'](_0x13d1f5['stack']);if(_0x13d1f5[_0xb4e9('0x2a')]){delete _0x13d1f5[_0xb4e9('0x2a')];}_0x1e9601[_0xb4e9('0x20')](_0x1ff12c)[_0xb4e9('0x2b')](_0x13d1f5);};}function getMustacheRender(_0x11f8b2,_0x5f20f4){return Mustache['render'](_0x11f8b2,_['merge'](_0x5f20f4['body'],{'contact':_0x5f20f4[_0xb4e9('0x2c')],'message':_0x5f20f4[_0xb4e9('0x2d')],'agent':_0x5f20f4[_0xb4e9('0x2e')],'interaction':_0x5f20f4['interaction'],'account':_0x5f20f4[_0xb4e9('0x2f')]}))||'';}exports[_0xb4e9('0x30')]=function(_0x3f10f9,_0x5182d0){var _0x26aacd={},_0x105c62={},_0x262ef5={'count':0x0,'rows':[]};var _0x25decd=_[_0xb4e9('0x31')](db[_0xb4e9('0x32')][_0xb4e9('0x33')],function(_0x25e286){return{'name':_0x25e286[_0xb4e9('0x34')],'type':_0x25e286[_0xb4e9('0x35')][_0xb4e9('0x36')]};});_0x105c62[_0xb4e9('0x37')]=_[_0xb4e9('0x31')](_0x25decd,'name');_0x105c62[_0xb4e9('0x38')]=_[_0xb4e9('0x39')](_0x3f10f9[_0xb4e9('0x38')]);_0x105c62[_0xb4e9('0x3a')]=_['intersection'](_0x105c62['model'],_0x105c62['query']);_0x26aacd[_0xb4e9('0x3b')]=_[_0xb4e9('0x3c')](_0x105c62[_0xb4e9('0x37')],qs[_0xb4e9('0x3d')](_0x3f10f9[_0xb4e9('0x38')][_0xb4e9('0x3d')]));_0x26aacd[_0xb4e9('0x3b')]=_0x26aacd['attributes'][_0xb4e9('0x3e')]?_0x26aacd[_0xb4e9('0x3b')]:_0x105c62[_0xb4e9('0x37')];if(!_0x3f10f9[_0xb4e9('0x38')][_0xb4e9('0x3f')]('nolimit')){_0x26aacd[_0xb4e9('0x1e')]=qs['limit'](_0x3f10f9[_0xb4e9('0x38')][_0xb4e9('0x1e')]);_0x26aacd['offset']=qs[_0xb4e9('0x1c')](_0x3f10f9[_0xb4e9('0x38')][_0xb4e9('0x1c')]);}_0x26aacd[_0xb4e9('0x40')]=qs[_0xb4e9('0x41')](_0x3f10f9['query'][_0xb4e9('0x41')]);_0x26aacd['where']=qs['filters'](_[_0xb4e9('0x42')](_0x3f10f9[_0xb4e9('0x38')],_0x105c62['filters']),_0x25decd);if(_0x3f10f9[_0xb4e9('0x38')][_0xb4e9('0x43')]){_0x26aacd[_0xb4e9('0x44')]=_[_0xb4e9('0x45')](_0x26aacd['where'],{'$or':_['map'](_0x25decd,function(_0x70a0b0){if(_0x70a0b0['type']!==_0xb4e9('0x46')){var _0x1a4bc4={};_0x1a4bc4[_0x70a0b0[_0xb4e9('0x2a')]]={'$like':'%'+_0x3f10f9[_0xb4e9('0x38')][_0xb4e9('0x43')]+'%'};return _0x1a4bc4;}})});}_0x26aacd=_[_0xb4e9('0x45')]({},_0x26aacd,_0x3f10f9[_0xb4e9('0x47')]);var _0x54115b={'where':_0x26aacd[_0xb4e9('0x44')]};return db[_0xb4e9('0x32')][_0xb4e9('0x1f')](_0x54115b)['then'](function(_0x41a834){_0x262ef5['count']=_0x41a834;if(_0x3f10f9[_0xb4e9('0x38')][_0xb4e9('0x48')]){_0x26aacd['include']=[{'all':!![]}];}return db[_0xb4e9('0x32')]['findAll'](_0x26aacd);})[_0xb4e9('0x28')](function(_0x5ae2f4){_0x262ef5[_0xb4e9('0x49')]=_0x5ae2f4;return _0x262ef5;})['then'](respondWithFilteredResult(_0x5182d0,_0x26aacd))[_0xb4e9('0x4a')](handleError(_0x5182d0,null));};exports[_0xb4e9('0x4b')]=function(_0x398b64,_0x5f959d){var _0x3b34cc={'raw':!![],'where':{'id':_0x398b64['params']['id']}},_0x109f10={};_0x109f10[_0xb4e9('0x37')]=_['keys'](db['ZendeskField'][_0xb4e9('0x33')]);_0x109f10[_0xb4e9('0x38')]=_[_0xb4e9('0x39')](_0x398b64[_0xb4e9('0x38')]);_0x109f10[_0xb4e9('0x3a')]=_['intersection'](_0x109f10['model'],_0x109f10[_0xb4e9('0x38')]);_0x3b34cc['attributes']=_[_0xb4e9('0x3c')](_0x109f10[_0xb4e9('0x37')],qs[_0xb4e9('0x3d')](_0x398b64['query'][_0xb4e9('0x3d')]));_0x3b34cc['attributes']=_0x3b34cc[_0xb4e9('0x3b')][_0xb4e9('0x3e')]?_0x3b34cc[_0xb4e9('0x3b')]:_0x109f10['model'];if(_0x398b64[_0xb4e9('0x38')][_0xb4e9('0x48')]){_0x3b34cc['include']=[{'all':!![]}];}_0x3b34cc=_['merge']({},_0x3b34cc,_0x398b64[_0xb4e9('0x47')]);return db['ZendeskField'][_0xb4e9('0x4c')](_0x3b34cc)['then'](handleEntityNotFound(_0x5f959d,null))[_0xb4e9('0x28')](respondWithResult(_0x5f959d,null))[_0xb4e9('0x4a')](handleError(_0x5f959d,null));};exports[_0xb4e9('0x4d')]=function(_0x17cae5,_0x317614){return db['ZendeskField'][_0xb4e9('0x4d')](_0x17cae5[_0xb4e9('0x4e')],{})[_0xb4e9('0x28')](respondWithResult(_0x317614,0xc9))[_0xb4e9('0x4a')](handleError(_0x317614,null));};exports[_0xb4e9('0x26')]=function(_0x40311a,_0x46f361){if(_0x40311a[_0xb4e9('0x4e')]['id']){delete _0x40311a[_0xb4e9('0x4e')]['id'];}return db[_0xb4e9('0x32')][_0xb4e9('0x4c')]({'where':{'id':_0x40311a[_0xb4e9('0x4f')]['id']}})[_0xb4e9('0x28')](handleEntityNotFound(_0x46f361,null))['then'](saveUpdates(_0x40311a['body'],null))['then'](respondWithResult(_0x46f361,null))[_0xb4e9('0x4a')](handleError(_0x46f361,null));};exports[_0xb4e9('0x27')]=function(_0x4a6c3b,_0x4d0142){return db['ZendeskField']['find']({'where':{'id':_0x4a6c3b[_0xb4e9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4d0142,null))['then'](removeEntity(_0x4d0142,null))[_0xb4e9('0x4a')](handleError(_0x4d0142,null));}; \ No newline at end of file +var _0xec37=['then','destroy','end','error','stack','name','render','merge','body','agent','account','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','VIRTUAL','includeAll','include','ZendeskField','findAll','rows','catch','show','params','options','find','create','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update'];(function(_0x1c8a44,_0x566974){var _0x182bd6=function(_0x380158){while(--_0x380158){_0x1c8a44['push'](_0x1c8a44['shift']());}};_0x182bd6(++_0x566974);}(_0xec37,0x114));var _0x7ec3=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0xec37[_0x585d81];return _0x1aca0d;};'use strict';var emlformat=require(_0x7ec3('0x0'));var rimraf=require(_0x7ec3('0x1'));var zipdir=require(_0x7ec3('0x2'));var jsonpatch=require(_0x7ec3('0x3'));var rp=require('request-promise');var moment=require(_0x7ec3('0x4'));var BPromise=require(_0x7ec3('0x5'));var Mustache=require(_0x7ec3('0x6'));var util=require(_0x7ec3('0x7'));var path=require(_0x7ec3('0x8'));var sox=require(_0x7ec3('0x9'));var csv=require(_0x7ec3('0xa'));var ejs=require(_0x7ec3('0xb'));var fs=require('fs');var fs_extra=require(_0x7ec3('0xc'));var _=require(_0x7ec3('0xd'));var squel=require('squel');var crypto=require(_0x7ec3('0xe'));var jsforce=require(_0x7ec3('0xf'));var deskjs=require(_0x7ec3('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7ec3('0x11'));var Papa=require(_0x7ec3('0x12'));var Redis=require('ioredis');var authService=require(_0x7ec3('0x13'));var qs=require(_0x7ec3('0x14'));var as=require(_0x7ec3('0x15'));var hardwareService=require(_0x7ec3('0x16'));var logger=require(_0x7ec3('0x17'))('api');var utils=require(_0x7ec3('0x18'));var config=require(_0x7ec3('0x19'));var licenseUtil=require(_0x7ec3('0x1a'));var db=require(_0x7ec3('0x1b'))['db'];function respondWithStatusCode(_0x31ca53,_0x2ac3ef){_0x2ac3ef=_0x2ac3ef||0xcc;return function(_0x3cec05){if(_0x3cec05){return _0x31ca53[_0x7ec3('0x1c')](_0x2ac3ef);}return _0x31ca53[_0x7ec3('0x1d')](_0x2ac3ef)['end']();};}function respondWithResult(_0x292b95,_0x23ff3d){_0x23ff3d=_0x23ff3d||0xc8;return function(_0x5db7e0){if(_0x5db7e0){return _0x292b95[_0x7ec3('0x1d')](_0x23ff3d)['json'](_0x5db7e0);}};}function respondWithFilteredResult(_0x4a9796,_0x28dbec){return function(_0x1819dc){if(_0x1819dc){var _0x58e170=typeof _0x28dbec[_0x7ec3('0x1e')]===_0x7ec3('0x1f')&&typeof _0x28dbec[_0x7ec3('0x20')]===_0x7ec3('0x1f');var _0x481298=_0x1819dc[_0x7ec3('0x21')];var _0x2a3694=_0x58e170?0x0:_0x28dbec['offset'];var _0x226af9=_0x58e170?_0x1819dc['count']:_0x28dbec[_0x7ec3('0x1e')]+_0x28dbec[_0x7ec3('0x20')];var _0x2cbcf2;if(_0x226af9>=_0x481298){_0x226af9=_0x481298;_0x2cbcf2=0xc8;}else{_0x2cbcf2=0xce;}_0x4a9796[_0x7ec3('0x1d')](_0x2cbcf2);return _0x4a9796[_0x7ec3('0x22')]('Content-Range',_0x2a3694+'-'+_0x226af9+'/'+_0x481298)[_0x7ec3('0x23')](_0x1819dc);}return null;};}function patchUpdates(_0x1ce374){return function(_0x8a3989){try{jsonpatch[_0x7ec3('0x24')](_0x8a3989,_0x1ce374,!![]);}catch(_0x21b9b9){return BPromise[_0x7ec3('0x25')](_0x21b9b9);}return _0x8a3989[_0x7ec3('0x26')]();};}function saveUpdates(_0xc0b263,_0x86a1e1){return function(_0x1b32fc){if(_0x1b32fc){return _0x1b32fc[_0x7ec3('0x27')](_0xc0b263)[_0x7ec3('0x28')](function(_0x52d384){return _0x52d384;});}return null;};}function removeEntity(_0x588ba2,_0x452c60){return function(_0x2c2341){if(_0x2c2341){return _0x2c2341[_0x7ec3('0x29')]()[_0x7ec3('0x28')](function(){_0x588ba2[_0x7ec3('0x1d')](0xcc)[_0x7ec3('0x2a')]();});}};}function handleEntityNotFound(_0x85c10d,_0x180493){return function(_0x16d0a1){if(!_0x16d0a1){_0x85c10d[_0x7ec3('0x1c')](0x194);}return _0x16d0a1;};}function handleError(_0x251c9d,_0x22e662){_0x22e662=_0x22e662||0x1f4;return function(_0x5c4468){logger[_0x7ec3('0x2b')](_0x5c4468[_0x7ec3('0x2c')]);if(_0x5c4468['name']){delete _0x5c4468[_0x7ec3('0x2d')];}_0x251c9d[_0x7ec3('0x1d')](_0x22e662)['send'](_0x5c4468);};}function getMustacheRender(_0x1f8e0a,_0x524197){return Mustache[_0x7ec3('0x2e')](_0x1f8e0a,_[_0x7ec3('0x2f')](_0x524197[_0x7ec3('0x30')],{'contact':_0x524197['contact'],'message':_0x524197['message'],'agent':_0x524197[_0x7ec3('0x31')],'interaction':_0x524197['interaction'],'account':_0x524197[_0x7ec3('0x32')]}))||'';}exports[_0x7ec3('0x33')]=function(_0x22c601,_0x4b4ca6){var _0x55052b={},_0x456be4={},_0x284990={'count':0x0,'rows':[]};var _0x1b832d=_[_0x7ec3('0x34')](db['ZendeskField'][_0x7ec3('0x35')],function(_0x14530a){return{'name':_0x14530a['fieldName'],'type':_0x14530a[_0x7ec3('0x36')]['key']};});_0x456be4[_0x7ec3('0x37')]=_[_0x7ec3('0x34')](_0x1b832d,'name');_0x456be4[_0x7ec3('0x38')]=_[_0x7ec3('0x39')](_0x22c601[_0x7ec3('0x38')]);_0x456be4[_0x7ec3('0x3a')]=_[_0x7ec3('0x3b')](_0x456be4[_0x7ec3('0x37')],_0x456be4['query']);_0x55052b[_0x7ec3('0x3c')]=_['intersection'](_0x456be4[_0x7ec3('0x37')],qs[_0x7ec3('0x3d')](_0x22c601[_0x7ec3('0x38')][_0x7ec3('0x3d')]));_0x55052b[_0x7ec3('0x3c')]=_0x55052b[_0x7ec3('0x3c')][_0x7ec3('0x3e')]?_0x55052b[_0x7ec3('0x3c')]:_0x456be4[_0x7ec3('0x37')];if(!_0x22c601[_0x7ec3('0x38')][_0x7ec3('0x3f')]('nolimit')){_0x55052b['limit']=qs[_0x7ec3('0x20')](_0x22c601[_0x7ec3('0x38')][_0x7ec3('0x20')]);_0x55052b['offset']=qs[_0x7ec3('0x1e')](_0x22c601['query'][_0x7ec3('0x1e')]);}_0x55052b['order']=qs['sort'](_0x22c601[_0x7ec3('0x38')]['sort']);_0x55052b[_0x7ec3('0x40')]=qs[_0x7ec3('0x3a')](_[_0x7ec3('0x41')](_0x22c601[_0x7ec3('0x38')],_0x456be4[_0x7ec3('0x3a')]),_0x1b832d);if(_0x22c601['query'][_0x7ec3('0x42')]){_0x55052b[_0x7ec3('0x40')]=_['merge'](_0x55052b['where'],{'$or':_[_0x7ec3('0x34')](_0x1b832d,function(_0x514edc){if(_0x514edc['type']!==_0x7ec3('0x43')){var _0x4dfb2b={};_0x4dfb2b[_0x514edc[_0x7ec3('0x2d')]]={'$like':'%'+_0x22c601[_0x7ec3('0x38')][_0x7ec3('0x42')]+'%'};return _0x4dfb2b;}})});}_0x55052b=_[_0x7ec3('0x2f')]({},_0x55052b,_0x22c601['options']);var _0x3f1b0c={'where':_0x55052b[_0x7ec3('0x40')]};return db['ZendeskField'][_0x7ec3('0x21')](_0x3f1b0c)[_0x7ec3('0x28')](function(_0x489ebc){_0x284990['count']=_0x489ebc;if(_0x22c601[_0x7ec3('0x38')][_0x7ec3('0x44')]){_0x55052b[_0x7ec3('0x45')]=[{'all':!![]}];}return db[_0x7ec3('0x46')][_0x7ec3('0x47')](_0x55052b);})[_0x7ec3('0x28')](function(_0x285ad2){_0x284990[_0x7ec3('0x48')]=_0x285ad2;return _0x284990;})[_0x7ec3('0x28')](respondWithFilteredResult(_0x4b4ca6,_0x55052b))[_0x7ec3('0x49')](handleError(_0x4b4ca6,null));};exports[_0x7ec3('0x4a')]=function(_0x538dd0,_0x5be855){var _0x216597={'raw':!![],'where':{'id':_0x538dd0[_0x7ec3('0x4b')]['id']}},_0x25025c={};_0x25025c[_0x7ec3('0x37')]=_[_0x7ec3('0x39')](db[_0x7ec3('0x46')][_0x7ec3('0x35')]);_0x25025c[_0x7ec3('0x38')]=_['keys'](_0x538dd0[_0x7ec3('0x38')]);_0x25025c[_0x7ec3('0x3a')]=_[_0x7ec3('0x3b')](_0x25025c['model'],_0x25025c['query']);_0x216597[_0x7ec3('0x3c')]=_['intersection'](_0x25025c[_0x7ec3('0x37')],qs[_0x7ec3('0x3d')](_0x538dd0['query']['fields']));_0x216597[_0x7ec3('0x3c')]=_0x216597['attributes']['length']?_0x216597[_0x7ec3('0x3c')]:_0x25025c[_0x7ec3('0x37')];if(_0x538dd0[_0x7ec3('0x38')][_0x7ec3('0x44')]){_0x216597['include']=[{'all':!![]}];}_0x216597=_[_0x7ec3('0x2f')]({},_0x216597,_0x538dd0[_0x7ec3('0x4c')]);return db[_0x7ec3('0x46')][_0x7ec3('0x4d')](_0x216597)['then'](handleEntityNotFound(_0x5be855,null))[_0x7ec3('0x28')](respondWithResult(_0x5be855,null))['catch'](handleError(_0x5be855,null));};exports[_0x7ec3('0x4e')]=function(_0x17e16,_0x3ac06f){return db['ZendeskField']['create'](_0x17e16['body'],{})[_0x7ec3('0x28')](respondWithResult(_0x3ac06f,0xc9))[_0x7ec3('0x49')](handleError(_0x3ac06f,null));};exports[_0x7ec3('0x27')]=function(_0x311e31,_0x2dd196){if(_0x311e31[_0x7ec3('0x30')]['id']){delete _0x311e31[_0x7ec3('0x30')]['id'];}return db['ZendeskField'][_0x7ec3('0x4d')]({'where':{'id':_0x311e31['params']['id']}})[_0x7ec3('0x28')](handleEntityNotFound(_0x2dd196,null))[_0x7ec3('0x28')](saveUpdates(_0x311e31['body'],null))[_0x7ec3('0x28')](respondWithResult(_0x2dd196,null))[_0x7ec3('0x49')](handleError(_0x2dd196,null));};exports[_0x7ec3('0x29')]=function(_0x57d1e9,_0x226537){return db['ZendeskField'][_0x7ec3('0x4d')]({'where':{'id':_0x57d1e9['params']['id']}})['then'](handleEntityNotFound(_0x226537,null))[_0x7ec3('0x28')](removeEntity(_0x226537,null))[_0x7ec3('0x49')](handleError(_0x226537,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 01633b3..f267fbb 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 _0x8b2b=['rimraf','../../config/environment','define','ZendeskField','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3b0358,_0x4b0b30){var _0x9857f5=function(_0x4c4b42){while(--_0x4c4b42){_0x3b0358['push'](_0x3b0358['shift']());}};_0x9857f5(++_0x4b0b30);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x54598c,_0x3b1edd){_0x54598c=_0x54598c-0x0;var _0x457007=_0x8b2b[_0x54598c];return _0x457007;};'use strict';var _=require(_0xb8b2('0x0'));var util=require(_0xb8b2('0x1'));var logger=require(_0xb8b2('0x2'))('api');var moment=require(_0xb8b2('0x3'));var BPromise=require(_0xb8b2('0x4'));var rp=require(_0xb8b2('0x5'));var fs=require('fs');var path=require(_0xb8b2('0x6'));var rimraf=require(_0xb8b2('0x7'));var config=require(_0xb8b2('0x8'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0xba7734,_0x31b3f9){return _0xba7734[_0xb8b2('0x9')](_0xb8b2('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xb8b2('0xb'),_0xb8b2('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ba2=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','idField'];(function(_0x175916,_0x5aa198){var _0x86c00e=function(_0x6be656){while(--_0x6be656){_0x175916['push'](_0x175916['shift']());}};_0x86c00e(++_0x5aa198);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x21ba('0x0'));var util=require('util');var logger=require(_0x21ba('0x1'))('api');var moment=require(_0x21ba('0x2'));var BPromise=require(_0x21ba('0x3'));var rp=require(_0x21ba('0x4'));var fs=require('fs');var path=require(_0x21ba('0x5'));var rimraf=require(_0x21ba('0x6'));var config=require('../../config/environment');var attributes=require(_0x21ba('0x7'));module[_0x21ba('0x8')]=function(_0x4a07e8,_0x10dae1){return _0x4a07e8['define'](_0x21ba('0x9'),attributes,{'tableName':_0x21ba('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x21ba('0xb'),'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 fefec0b..e80bc6a 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 _0xd940=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','request','then','info','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskField,\x20%s,\x20%s'];(function(_0x487044,_0x4ea0f3){var _0x1abdba=function(_0x1c4ee3){while(--_0x1c4ee3){_0x487044['push'](_0x487044['shift']());}};_0x1abdba(++_0x4ea0f3);}(_0xd940,0x129));var _0x0d94=function(_0x4178af,_0x388652){_0x4178af=_0x4178af-0x0;var _0x20f4b1=_0xd940[_0x4178af];return _0x20f4b1;};'use strict';var _=require(_0x0d94('0x0'));var util=require(_0x0d94('0x1'));var moment=require(_0x0d94('0x2'));var BPromise=require(_0x0d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d94('0x4'));var db=require(_0x0d94('0x5'))['db'];var utils=require(_0x0d94('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0d94('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5d79aa,_0x548fe8,_0x4273ba){return new BPromise(function(_0x3bbec7,_0x14ae75){return client[_0x0d94('0x8')](_0x5d79aa,_0x4273ba)[_0x0d94('0x9')](function(_0x1ca44c){logger[_0x0d94('0xa')]('ZendeskField,\x20%s,\x20%s',_0x548fe8,'request\x20sent');logger[_0x0d94('0xb')](_0x0d94('0xc'),_0x548fe8,_0x0d94('0xd'),JSON[_0x0d94('0xe')](_0x1ca44c));if(_0x1ca44c[_0x0d94('0xf')]){if(_0x1ca44c[_0x0d94('0xf')][_0x0d94('0x10')]===0x1f4){logger[_0x0d94('0xf')](_0x0d94('0x11'),_0x548fe8,_0x1ca44c[_0x0d94('0xf')]['message']);return _0x14ae75(_0x1ca44c[_0x0d94('0xf')][_0x0d94('0x12')]);}logger[_0x0d94('0xf')]('ZendeskField,\x20%s,\x20%s',_0x548fe8,_0x1ca44c[_0x0d94('0xf')][_0x0d94('0x12')]);return _0x3bbec7(_0x1ca44c[_0x0d94('0xf')][_0x0d94('0x12')]);}else{logger[_0x0d94('0xa')](_0x0d94('0x11'),_0x548fe8,'request\x20sent');_0x3bbec7(_0x1ca44c[_0x0d94('0x13')][_0x0d94('0x12')]);}})[_0x0d94('0x14')](function(_0x34c482){logger[_0x0d94('0xf')]('ZendeskField,\x20%s,\x20%s',_0x548fe8,_0x34c482);_0x14ae75(_0x34c482);});});} \ No newline at end of file +var _0x4b0d=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0x4b0d,0xe8));var _0xd4b0=function(_0x1d56fd,_0x36c2d4){_0x1d56fd=_0x1d56fd-0x0;var _0x1f9f71=_0x4b0d[_0x1d56fd];return _0x1f9f71;};'use strict';var _=require(_0xd4b0('0x0'));var util=require(_0xd4b0('0x1'));var moment=require(_0xd4b0('0x2'));var BPromise=require(_0xd4b0('0x3'));var rs=require(_0xd4b0('0x4'));var fs=require('fs');var Redis=require(_0xd4b0('0x5'));var db=require(_0xd4b0('0x6'))['db'];var utils=require(_0xd4b0('0x7'));var logger=require(_0xd4b0('0x8'))(_0xd4b0('0x9'));var config=require(_0xd4b0('0xa'));var jayson=require(_0xd4b0('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e3e00,_0x36cd66,_0xe2921c){return new BPromise(function(_0x2282a6,_0x42e4d3){return client[_0xd4b0('0xc')](_0x4e3e00,_0xe2921c)[_0xd4b0('0xd')](function(_0x2c5231){logger['info'](_0xd4b0('0xe'),_0x36cd66,'request\x20sent');logger[_0xd4b0('0xf')](_0xd4b0('0x10'),_0x36cd66,_0xd4b0('0x11'),JSON[_0xd4b0('0x12')](_0x2c5231));if(_0x2c5231[_0xd4b0('0x13')]){if(_0x2c5231[_0xd4b0('0x13')][_0xd4b0('0x14')]===0x1f4){logger[_0xd4b0('0x13')](_0xd4b0('0xe'),_0x36cd66,_0x2c5231['error']['message']);return _0x42e4d3(_0x2c5231[_0xd4b0('0x13')][_0xd4b0('0x15')]);}logger[_0xd4b0('0x13')](_0xd4b0('0xe'),_0x36cd66,_0x2c5231[_0xd4b0('0x13')][_0xd4b0('0x15')]);return _0x2282a6(_0x2c5231['error'][_0xd4b0('0x15')]);}else{logger['info'](_0xd4b0('0xe'),_0x36cd66,_0xd4b0('0x11'));_0x2282a6(_0x2c5231['result']['message']);}})[_0xd4b0('0x16')](function(_0x2f8723){logger[_0xd4b0('0x13')](_0xd4b0('0xe'),_0x36cd66,_0x2f8723);_0x42e4d3(_0x2f8723);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 391f6fa..af84375 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 _0xef60=['destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xef60,0x136));var _0x0ef6=function(_0x243cfe,_0x10839c){_0x243cfe=_0x243cfe-0x0;var _0x236e72=_0xef60[_0x243cfe];return _0x236e72;};'use strict';var multer=require(_0x0ef6('0x0'));var util=require(_0x0ef6('0x1'));var path=require(_0x0ef6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0ef6('0x3')]();var fs_extra=require(_0x0ef6('0x4'));var auth=require(_0x0ef6('0x5'));var interaction=require(_0x0ef6('0x6'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0x0ef6('0x7')]('/',auth[_0x0ef6('0x8')](),controller['index']);router[_0x0ef6('0x7')](_0x0ef6('0x9'),auth[_0x0ef6('0x8')](),controller[_0x0ef6('0xa')]);router[_0x0ef6('0x7')](_0x0ef6('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0ef6('0x7')](_0x0ef6('0xc'),auth[_0x0ef6('0x8')](),controller[_0x0ef6('0xd')]);router['post']('/',auth[_0x0ef6('0x8')](),controller[_0x0ef6('0xe')]);router[_0x0ef6('0xf')](_0x0ef6('0xb'),auth['isAuthenticated'](),controller[_0x0ef6('0x10')]);router[_0x0ef6('0x11')](_0x0ef6('0x9'),auth[_0x0ef6('0x8')](),controller[_0x0ef6('0x12')]);router[_0x0ef6('0x13')](_0x0ef6('0x9'),auth[_0x0ef6('0x8')](),controller[_0x0ef6('0x14')]);module[_0x0ef6('0x15')]=router; \ No newline at end of file +var _0x8a1d=['destroy','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x572d97,_0x385624){var _0x28e899=function(_0x5778ba){while(--_0x5778ba){_0x572d97['push'](_0x572d97['shift']());}};_0x28e899(++_0x385624);}(_0x8a1d,0xb5));var _0xd8a1=function(_0x204140,_0x3f3b77){_0x204140=_0x204140-0x0;var _0x41f139=_0x8a1d[_0x204140];return _0x41f139;};'use strict';var multer=require(_0xd8a1('0x0'));var util=require(_0xd8a1('0x1'));var path=require('path');var timeout=require(_0xd8a1('0x2'));var express=require(_0xd8a1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd8a1('0x4'));var config=require(_0xd8a1('0x5'));var controller=require(_0xd8a1('0x6'));router['get']('/',auth[_0xd8a1('0x7')](),controller['index']);router['get'](_0xd8a1('0x8'),auth[_0xd8a1('0x7')](),controller[_0xd8a1('0x9')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xd8a1('0xa')]);router['get'](_0xd8a1('0xb'),auth[_0xd8a1('0x7')](),controller[_0xd8a1('0xc')]);router[_0xd8a1('0xd')]('/',auth['isAuthenticated'](),controller[_0xd8a1('0xe')]);router[_0xd8a1('0xd')]('/:id/configurations',auth[_0xd8a1('0x7')](),controller[_0xd8a1('0xf')]);router[_0xd8a1('0x10')](_0xd8a1('0x8'),auth[_0xd8a1('0x7')](),controller['update']);router['delete'](_0xd8a1('0x8'),auth[_0xd8a1('0x7')](),controller[_0xd8a1('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 7148efd..6fa1459 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 _0x68e2=['STRING','sequelize'];(function(_0x4ed315,_0x4bb2a4){var _0x41a423=function(_0x2ec802){while(--_0x2ec802){_0x4ed315['push'](_0x4ed315['shift']());}};_0x41a423(++_0x4bb2a4);}(_0x68e2,0xad));var _0x268e=function(_0x4c15ae,_0x6b2e57){_0x4c15ae=_0x4c15ae-0x0;var _0x3266aa=_0x68e2[_0x4c15ae];return _0x3266aa;};'use strict';var Sequelize=require(_0x268e('0x0'));module['exports']={'name':{'type':Sequelize[_0x268e('0x1')]},'description':{'type':Sequelize[_0x268e('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x268e('0x1')]},'clientId':{'type':Sequelize[_0x268e('0x1')]},'clientSecret':{'type':Sequelize[_0x268e('0x1')]},'serverUrl':{'type':Sequelize[_0x268e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x268e('0x1')]}}; \ No newline at end of file +var _0x3a39=['exports','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3a39,0x9a));var _0x93a3=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x3a39[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require('sequelize');module[_0x93a3('0x0')]={'name':{'type':Sequelize[_0x93a3('0x1')]},'description':{'type':Sequelize[_0x93a3('0x1')]},'host':{'type':Sequelize[_0x93a3('0x1')]},'zone':{'type':Sequelize[_0x93a3('0x1')]},'clientId':{'type':Sequelize[_0x93a3('0x1')]},'clientSecret':{'type':Sequelize[_0x93a3('0x1')]},'serverUrl':{'type':Sequelize[_0x93a3('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x93a3('0x1')]},'refreshToken':{'type':Sequelize[_0x93a3('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 5ec7551..49d1b61 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 _0x4784=['reject','update','destroy','end','stack','name','send','render','merge','body','contact','agent','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','ZohoAccount','include','findAll','rows','show','includeAll','find','create','params','getConfigurations','findOne','nolimit','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','code','host','zoho.eu','com','serverUrl','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','api_name','push','custom_field','data_type','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','offset','undefined','limit','count','set','json','apply'];(function(_0x42a969,_0x269a24){var _0x3a082d=function(_0xe78853){while(--_0xe78853){_0x42a969['push'](_0x42a969['shift']());}};_0x3a082d(++_0x269a24);}(_0x4784,0xe4));var _0x4478=function(_0x279e6f,_0x566574){_0x279e6f=_0x279e6f-0x0;var _0x489a5f=_0x4784[_0x279e6f];return _0x489a5f;};'use strict';var emlformat=require(_0x4478('0x0'));var rimraf=require(_0x4478('0x1'));var zipdir=require(_0x4478('0x2'));var jsonpatch=require(_0x4478('0x3'));var rp=require(_0x4478('0x4'));var moment=require(_0x4478('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4478('0x6'));var util=require(_0x4478('0x7'));var path=require(_0x4478('0x8'));var sox=require('sox');var csv=require(_0x4478('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4478('0xa'));var _=require('lodash');var squel=require(_0x4478('0xb'));var crypto=require(_0x4478('0xc'));var jsforce=require(_0x4478('0xd'));var deskjs=require(_0x4478('0xe'));var toCsv=require(_0x4478('0x9'));var querystring=require('querystring');var Papa=require(_0x4478('0xf'));var Redis=require(_0x4478('0x10'));var authService=require(_0x4478('0x11'));var qs=require(_0x4478('0x12'));var as=require(_0x4478('0x13'));var hardwareService=require(_0x4478('0x14'));var logger=require(_0x4478('0x15'))('api');var utils=require(_0x4478('0x16'));var config=require(_0x4478('0x17'));var licenseUtil=require(_0x4478('0x18'));var db=require(_0x4478('0x19'))['db'];var integrations=require(_0x4478('0x1a'));var jayson=require(_0x4478('0x1b'));var client=jayson['client'][_0x4478('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x26b881,_0x4286ce,_0x36dacc,_0x38bcfc){return new BPromise(function(_0x4d74ee,_0x52cd71){var _0x3b7af6=_0x38bcfc||client;return _0x3b7af6[_0x4478('0x1d')](_0x26b881,_0x36dacc)[_0x4478('0x1e')](function(_0x31f653){logger[_0x4478('0x1f')](_0x4478('0x20'),_0x4286ce,_0x4478('0x21'));logger['debug'](_0x4478('0x22'),_0x4286ce,_0x4478('0x21'),JSON[_0x4478('0x23')](_0x31f653));if(_0x31f653[_0x4478('0x24')]){if(_0x31f653[_0x4478('0x24')]['code']===0x1f4){logger[_0x4478('0x24')](_0x4478('0x20'),_0x4286ce,_0x31f653['error'][_0x4478('0x25')]);return _0x52cd71(_0x31f653[_0x4478('0x24')]['message']);}logger[_0x4478('0x24')](_0x4478('0x20'),_0x4286ce,_0x31f653[_0x4478('0x24')][_0x4478('0x25')]);return _0x4d74ee(_0x31f653[_0x4478('0x24')]['message']);}else{logger['info'](_0x4478('0x20'),_0x4286ce,_0x4478('0x21'));_0x4d74ee(_0x31f653['result'][_0x4478('0x25')]);}})[_0x4478('0x26')](function(_0xaa6f9e){logger['error'](_0x4478('0x20'),_0x4286ce,_0xaa6f9e);_0x52cd71(_0xaa6f9e);});});}function respondWithStatusCode(_0xc6717d,_0x12a4aa){_0x12a4aa=_0x12a4aa||0xcc;return function(_0x5bd9fa){if(_0x5bd9fa){return _0xc6717d[_0x4478('0x27')](_0x12a4aa);}return _0xc6717d[_0x4478('0x28')](_0x12a4aa)['end']();};}function respondWithResult(_0x5ce9f6,_0x25fcaa){_0x25fcaa=_0x25fcaa||0xc8;return function(_0x1f9cc1){if(_0x1f9cc1){return _0x5ce9f6[_0x4478('0x28')](_0x25fcaa)['json'](_0x1f9cc1);}};}function respondWithFilteredResult(_0x3d5405,_0xcf0038){return function(_0x46055a){if(_0x46055a){var _0xc82990=typeof _0xcf0038[_0x4478('0x29')]===_0x4478('0x2a')&&typeof _0xcf0038[_0x4478('0x2b')]===_0x4478('0x2a');var _0x4b06fa=_0x46055a[_0x4478('0x2c')];var _0x15d081=_0xc82990?0x0:_0xcf0038[_0x4478('0x29')];var _0x4cb71b=_0xc82990?_0x46055a['count']:_0xcf0038[_0x4478('0x29')]+_0xcf0038[_0x4478('0x2b')];var _0x19a18c;if(_0x4cb71b>=_0x4b06fa){_0x4cb71b=_0x4b06fa;_0x19a18c=0xc8;}else{_0x19a18c=0xce;}_0x3d5405[_0x4478('0x28')](_0x19a18c);return _0x3d5405[_0x4478('0x2d')]('Content-Range',_0x15d081+'-'+_0x4cb71b+'/'+_0x4b06fa)[_0x4478('0x2e')](_0x46055a);}return null;};}function patchUpdates(_0x400d50){return function(_0x184ab5){try{jsonpatch[_0x4478('0x2f')](_0x184ab5,_0x400d50,!![]);}catch(_0x27d859){return BPromise[_0x4478('0x30')](_0x27d859);}return _0x184ab5['save']();};}function saveUpdates(_0x2f3514,_0x330266){return function(_0x3cc5d1){if(_0x3cc5d1){return _0x3cc5d1[_0x4478('0x31')](_0x2f3514)[_0x4478('0x1e')](function(_0x5311e8){return _0x5311e8;});}return null;};}function removeEntity(_0x3a1615,_0x90e6c){return function(_0x11c0af){if(_0x11c0af){return _0x11c0af[_0x4478('0x32')]()[_0x4478('0x1e')](function(){_0x3a1615[_0x4478('0x28')](0xcc)[_0x4478('0x33')]();});}};}function handleEntityNotFound(_0x4b783a,_0x2e6797){return function(_0x46af2e){if(!_0x46af2e){_0x4b783a[_0x4478('0x27')](0x194);}return _0x46af2e;};}function handleError(_0x2ea746,_0x3d1c9a){_0x3d1c9a=_0x3d1c9a||0x1f4;return function(_0x3b840f){logger['error'](_0x3b840f[_0x4478('0x34')]);if(_0x3b840f['name']){delete _0x3b840f[_0x4478('0x35')];}_0x2ea746[_0x4478('0x28')](_0x3d1c9a)[_0x4478('0x36')](_0x3b840f);};}function getMustacheRender(_0x1f6dee,_0x270a59){return Mustache[_0x4478('0x37')](_0x1f6dee,_[_0x4478('0x38')](_0x270a59[_0x4478('0x39')],{'contact':_0x270a59[_0x4478('0x3a')],'message':_0x270a59[_0x4478('0x25')],'agent':_0x270a59[_0x4478('0x3b')],'interaction':_0x270a59['interaction'],'account':_0x270a59['account']}))||'';}exports[_0x4478('0x3c')]=function(_0x329976,_0x41098d){var _0x2a389f={},_0x1b8cee={},_0x8364d0={'count':0x0,'rows':[]};var _0x521643=_[_0x4478('0x3d')](db['ZohoAccount'][_0x4478('0x3e')],function(_0x18042d){return{'name':_0x18042d['fieldName'],'type':_0x18042d[_0x4478('0x3f')]['key']};});_0x1b8cee[_0x4478('0x40')]=_[_0x4478('0x3d')](_0x521643,_0x4478('0x35'));_0x1b8cee[_0x4478('0x41')]=_[_0x4478('0x42')](_0x329976[_0x4478('0x41')]);_0x1b8cee[_0x4478('0x43')]=_[_0x4478('0x44')](_0x1b8cee['model'],_0x1b8cee['query']);_0x2a389f[_0x4478('0x45')]=_[_0x4478('0x44')](_0x1b8cee['model'],qs['fields'](_0x329976[_0x4478('0x41')][_0x4478('0x46')]));_0x2a389f['attributes']=_0x2a389f[_0x4478('0x45')][_0x4478('0x47')]?_0x2a389f['attributes']:_0x1b8cee[_0x4478('0x40')];if(!_0x329976[_0x4478('0x41')][_0x4478('0x48')]('nolimit')){_0x2a389f[_0x4478('0x2b')]=qs['limit'](_0x329976['query']['limit']);_0x2a389f[_0x4478('0x29')]=qs[_0x4478('0x29')](_0x329976['query'][_0x4478('0x29')]);}_0x2a389f[_0x4478('0x49')]=qs[_0x4478('0x4a')](_0x329976['query'][_0x4478('0x4a')]);_0x2a389f[_0x4478('0x4b')]=qs[_0x4478('0x43')](_[_0x4478('0x4c')](_0x329976[_0x4478('0x41')],_0x1b8cee[_0x4478('0x43')]),_0x521643);if(_0x329976[_0x4478('0x41')]['filter']){_0x2a389f[_0x4478('0x4b')]=_['merge'](_0x2a389f[_0x4478('0x4b')],{'$or':_[_0x4478('0x3d')](_0x521643,function(_0x33b7fb){if(_0x33b7fb[_0x4478('0x3f')]!==_0x4478('0x4d')){var _0x3fd721={};_0x3fd721[_0x33b7fb[_0x4478('0x35')]]={'$like':'%'+_0x329976['query'][_0x4478('0x4e')]+'%'};return _0x3fd721;}})});}_0x2a389f=_[_0x4478('0x38')]({},_0x2a389f,_0x329976[_0x4478('0x4f')]);var _0x3a3c12={'where':_0x2a389f[_0x4478('0x4b')]};return db[_0x4478('0x50')]['count'](_0x3a3c12)['then'](function(_0x26e186){_0x8364d0['count']=_0x26e186;if(_0x329976[_0x4478('0x41')]['includeAll']){_0x2a389f[_0x4478('0x51')]=[{'all':!![]}];}return db['ZohoAccount'][_0x4478('0x52')](_0x2a389f);})['then'](function(_0x385b57){_0x8364d0[_0x4478('0x53')]=_0x385b57;return _0x8364d0;})[_0x4478('0x1e')](respondWithFilteredResult(_0x41098d,_0x2a389f))[_0x4478('0x26')](handleError(_0x41098d,null));};exports[_0x4478('0x54')]=function(_0x231736,_0x549af9){var _0xa17b77={'raw':![],'where':{'id':_0x231736['params']['id']}},_0x5f5b7e={};_0x5f5b7e[_0x4478('0x40')]=_['keys'](db[_0x4478('0x50')][_0x4478('0x3e')]);_0x5f5b7e[_0x4478('0x41')]=_[_0x4478('0x42')](_0x231736['query']);_0x5f5b7e[_0x4478('0x43')]=_['intersection'](_0x5f5b7e[_0x4478('0x40')],_0x5f5b7e[_0x4478('0x41')]);_0xa17b77[_0x4478('0x45')]=_['intersection'](_0x5f5b7e[_0x4478('0x40')],qs[_0x4478('0x46')](_0x231736[_0x4478('0x41')]['fields']));_0xa17b77[_0x4478('0x45')]=_0xa17b77[_0x4478('0x45')][_0x4478('0x47')]?_0xa17b77['attributes']:_0x5f5b7e[_0x4478('0x40')];if(_0x231736[_0x4478('0x41')][_0x4478('0x55')]){_0xa17b77[_0x4478('0x51')]=[{'all':!![]}];}_0xa17b77=_[_0x4478('0x38')]({},_0xa17b77,_0x231736[_0x4478('0x4f')]);return db[_0x4478('0x50')][_0x4478('0x56')](_0xa17b77)[_0x4478('0x1e')](handleEntityNotFound(_0x549af9,null))[_0x4478('0x1e')](respondWithResult(_0x549af9,null))['catch'](handleError(_0x549af9,null));};exports[_0x4478('0x57')]=function(_0x2a8019,_0x3a512f){return db[_0x4478('0x50')][_0x4478('0x57')](_0x2a8019[_0x4478('0x39')],{})['then'](respondWithResult(_0x3a512f,0xc9))['catch'](handleError(_0x3a512f,null));};exports[_0x4478('0x31')]=function(_0x59101c,_0x3169ee){if(_0x59101c['body']['id']){delete _0x59101c[_0x4478('0x39')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x59101c[_0x4478('0x58')]['id']}})[_0x4478('0x1e')](handleEntityNotFound(_0x3169ee,null))['then'](saveUpdates(_0x59101c['body'],null))[_0x4478('0x1e')](respondWithResult(_0x3169ee,null))['catch'](handleError(_0x3169ee,null));};exports[_0x4478('0x32')]=function(_0x8bf4e0,_0x41c852){return db[_0x4478('0x50')][_0x4478('0x56')]({'where':{'id':_0x8bf4e0[_0x4478('0x58')]['id']}})[_0x4478('0x1e')](handleEntityNotFound(_0x41c852,null))[_0x4478('0x1e')](removeEntity(_0x41c852,null))[_0x4478('0x26')](handleError(_0x41c852,null));};exports[_0x4478('0x59')]=function(_0x3a044a,_0x2b64a0,_0x36b456){var _0x2af2af={};var _0x1e0839={};var _0x40b12b;var _0x946b01;return db['ZohoAccount'][_0x4478('0x5a')]({'where':{'id':_0x3a044a[_0x4478('0x58')]['id']}})['then'](handleEntityNotFound(_0x2b64a0,null))[_0x4478('0x1e')](function(_0x18d245){if(_0x18d245){_0x40b12b=_0x18d245;_0x1e0839[_0x4478('0x40')]=_[_0x4478('0x42')](db['ZohoConfiguration'][_0x4478('0x3e')]);_0x1e0839[_0x4478('0x41')]=_[_0x4478('0x42')](_0x3a044a[_0x4478('0x41')]);_0x1e0839['filters']=_[_0x4478('0x44')](_0x1e0839[_0x4478('0x40')],_0x1e0839[_0x4478('0x41')]);_0x2af2af[_0x4478('0x45')]=_[_0x4478('0x44')](_0x1e0839[_0x4478('0x40')],qs['fields'](_0x3a044a[_0x4478('0x41')]['fields']));_0x2af2af[_0x4478('0x45')]=_0x2af2af[_0x4478('0x45')][_0x4478('0x47')]?_0x2af2af['attributes']:_0x1e0839[_0x4478('0x40')];_0x2af2af['order']=qs[_0x4478('0x4a')](_0x3a044a[_0x4478('0x41')][_0x4478('0x4a')]);_0x2af2af[_0x4478('0x4b')]=qs[_0x4478('0x43')](_[_0x4478('0x4c')](_0x3a044a[_0x4478('0x41')],_0x1e0839[_0x4478('0x43')]));if(_0x3a044a[_0x4478('0x41')]['filter']){_0x2af2af[_0x4478('0x4b')]=_[_0x4478('0x38')](_0x2af2af[_0x4478('0x4b')],{'$or':_[_0x4478('0x3d')](_0x2af2af[_0x4478('0x45')],function(_0x1c4b08){var _0x4acd35={};_0x4acd35[_0x1c4b08]={'$like':'%'+_0x3a044a[_0x4478('0x41')][_0x4478('0x4e')]+'%'};return _0x4acd35;})});}_0x2af2af=_[_0x4478('0x38')]({},_0x2af2af,_0x3a044a['options']);return _0x40b12b[_0x4478('0x59')](_0x2af2af);}})[_0x4478('0x1e')](function(_0x1d142d){if(_0x1d142d){_0x946b01=_0x1d142d['length'];if(!_0x3a044a['query'][_0x4478('0x48')](_0x4478('0x5b'))){_0x2af2af[_0x4478('0x2b')]=qs[_0x4478('0x2b')](_0x3a044a[_0x4478('0x41')]['limit']);_0x2af2af['offset']=qs[_0x4478('0x29')](_0x3a044a[_0x4478('0x41')][_0x4478('0x29')]);}return _0x40b12b[_0x4478('0x59')](_0x2af2af);}})[_0x4478('0x1e')](function(_0x50c76f){if(_0x50c76f){return _0x50c76f?{'count':_0x946b01,'rows':_0x50c76f}:null;}})[_0x4478('0x1e')](respondWithResult(_0x2b64a0,null))['catch'](handleError(_0x2b64a0,null));};exports['addConfiguration']=function(_0x50af08,_0x498c0d,_0x25b7ef){if(_0x50af08[_0x4478('0x39')]['id']){delete _0x50af08[_0x4478('0x39')]['id'];}return db[_0x4478('0x50')][_0x4478('0x5a')]({'where':{'id':_0x50af08['params']['id']}})['then'](handleEntityNotFound(_0x498c0d,null))['then'](function(_0x3e8f2d){if(_0x3e8f2d){_0x50af08['body']['AccountId']=_0x3e8f2d['id'];_0x50af08[_0x4478('0x39')][_0x4478('0x5c')]=integrations[_0x4478('0x5d')](_0x50af08['body'][_0x4478('0x5e')],_0x50af08[_0x4478('0x39')]['type']);_0x50af08[_0x4478('0x39')][_0x4478('0x5f')]=integrations[_0x4478('0x60')](_0x50af08[_0x4478('0x39')][_0x4478('0x5e')],_0x50af08[_0x4478('0x39')][_0x4478('0x3f')]);return db['ZohoConfiguration'][_0x4478('0x57')](_0x50af08[_0x4478('0x39')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x4478('0x61')],'as':'Descriptions'}]});}return null;})[_0x4478('0x1e')](respondWithResult(_0x498c0d,null))[_0x4478('0x26')](handleError(_0x498c0d,null));};function getAccessToken(_0x51f2a0){return new Promise(function(_0x4ce0cf,_0x370c47){var _0x5b4422;switch(_0x51f2a0[_0x4478('0x62')]){case'US':_0x5b4422=_0x4478('0x63');break;case'AU':_0x5b4422=_0x4478('0x64');break;case'EU':_0x5b4422='https://accounts.zoho.eu';break;case'IN':_0x5b4422=_0x4478('0x65');break;case'CN':_0x5b4422=_0x4478('0x66');break;default:_0x5b4422='https://accounts.zoho.eu';break;}var _0x5a426c={'method':_0x4478('0x67'),'uri':_0x5b4422+'/oauth/v2/token','qs':{'refresh_token':_0x51f2a0[_0x4478('0x68')],'client_id':_0x51f2a0[_0x4478('0x69')],'client_secret':_0x51f2a0[_0x4478('0x6a')],'grant_type':_0x4478('0x6b')},'json':!![]};return rp(_0x5a426c)[_0x4478('0x1e')](function(_0x4bb953){if(_0x4bb953['access_token']){_0x4ce0cf(_0x4bb953['access_token']);}else{_0x370c47(_0x4478('0x6c'));}})[_0x4478('0x26')](function(_0x152d20){_0x370c47(_0x152d20);});});}exports['getFields']=function(_0xddc5b9,_0x54b34e,_0xafbcad){var _0x49b0ff,_0x493c0d,_0x3a2715,_0x39cc1d,_0x4fea10;return db['ZohoAccount'][_0x4478('0x5a')]({'where':{'id':_0xddc5b9[_0x4478('0x58')]['id']},'attributes':['id','host','zone',_0x4478('0x69'),'clientSecret','serverUrl',_0x4478('0x6d'),'refreshToken']})[_0x4478('0x1e')](handleEntityNotFound(_0x54b34e,null))[_0x4478('0x1e')](function(_0x34b81e){_0x4fea10=_0x34b81e;_0x49b0ff=_0x4fea10[_0x4478('0x6e')];_0x493c0d=_0x49b0ff===_0x4478('0x6f')?'eu':_0x4478('0x70');_0x3a2715=_0x4fea10[_0x4478('0x71')];var _0x565521=_0x3a2715[_0x4478('0x72')](-0x1);if(_0x565521==='/'||_0x565521==='\x5c'||_0x565521===':'){_0x3a2715=_0x3a2715['substring'](0x0,_0x3a2715['lastIndexOf'](_0x565521));}if(!_0x4fea10['refreshToken']){throw new Error(_0x4478('0x73'));}return getAccessToken(_0x4fea10);})[_0x4478('0x1e')](function(_0x40f470){if(_0x40f470){return rp({'method':_0x4478('0x74'),'uri':util[_0x4478('0x75')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x493c0d),'qs':{'module':_0x4478('0x76')},'headers':{'Authorization':_0x4478('0x77')+_0x40f470},'json':!![]});}})[_0x4478('0x1e')](function(_0x4e3bd4){if(_0x4e3bd4){if(_0x4e3bd4[_0x4478('0x78')]&&_0x4e3bd4['response']['error']){throw new Error(_0x4e3bd4['response'][_0x4478('0x24')][_0x4478('0x25')]);}var _0x5247ed=[];var _0x29deac=[];var _0x51b816=[_0x4478('0x79'),'Subject',_0x4478('0x7a'),_0x4478('0x7b'),_0x4478('0x7c'),_0x4478('0x7d'),_0x4478('0x7e'),_0x4478('0x7f')];_0x29deac=_[_0x4478('0x80')](_0x4e3bd4['fields'],function(_0x44c8b5){return _0x51b816['includes'](_0x44c8b5[_0x4478('0x81')]);});for(var _0x2b4a42=0x0;_0x2b4a42<_0x29deac[_0x4478('0x47')];_0x2b4a42++){if(_0x29deac[_0x2b4a42]['system_mandatory']===![]){_0x5247ed[_0x4478('0x82')]({'id':_0x29deac[_0x2b4a42]['id'],'name':_0x29deac[_0x2b4a42]['display_label'],'custom':_0x29deac[_0x2b4a42][_0x4478('0x83')],'options':_0x29deac[_0x2b4a42][_0x4478('0x84')]==='picklist'&&_0x29deac[_0x2b4a42][_0x4478('0x85')][_0x4478('0x47')]>-0x1?_['map'](_0x29deac[_0x2b4a42][_0x4478('0x85')],function(_0x13fe2a){return{'name':_0x13fe2a,'value':_0x13fe2a};}):[]});}}return{'count':_0x5247ed[_0x4478('0x47')],'rows':_0x5247ed};}else{return{'count':0x0,'rows':[]};}})[_0x4478('0x1e')](respondWithResult(_0x54b34e,null))[_0x4478('0x26')](function(_0x5bcbbc){var _0x255e8a=_0xddc5b9[_0x4478('0x41')][_0x4478('0x86')]?0x1f4:_0x5bcbbc['statusCode']||0x1f4;logger[_0x4478('0x24')](_0x4478('0x87'),'getFields',_0x255e8a,JSON['stringify'](_0x5bcbbc));delete _0x5bcbbc[_0x4478('0x35')];if(_0x255e8a===0x191){_0x255e8a=0x190;}_0x54b34e[_0x4478('0x28')](_0x255e8a)[_0x4478('0x36')](_0xddc5b9[_0x4478('0x41')][_0x4478('0x86')]?{'message':_0x4478('0x88'),'statusCode':_0x5bcbbc[_0x4478('0x89')]}:_0x5bcbbc);});}; \ No newline at end of file +var _0xe384=['key','model','keys','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','rawAttributes','length','find','create','params','destroy','getConfigurations','findOne','ZohoConfiguration','nolimit','addConfiguration','Subjects','getSubjects','getDescriptions','channel','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','refreshToken','slice','substring','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','lodash','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','stack','name','send','render','merge','body','agent','interaction','account','index','map','ZohoAccount','fieldName','type'];(function(_0x2ed612,_0x5090f5){var _0xff695b=function(_0x1bf6df){while(--_0x1bf6df){_0x2ed612['push'](_0x2ed612['shift']());}};_0xff695b(++_0x5090f5);}(_0xe384,0x160));var _0x4e38=function(_0x2e6c58,_0x1cebc0){_0x2e6c58=_0x2e6c58-0x0;var _0x4a280b=_0xe384[_0x2e6c58];return _0x4a280b;};'use strict';var emlformat=require(_0x4e38('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e38('0x1'));var jsonpatch=require(_0x4e38('0x2'));var rp=require(_0x4e38('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4e38('0x4'));var util=require(_0x4e38('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x4e38('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e38('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4e38('0x8'));var deskjs=require(_0x4e38('0x9'));var toCsv=require(_0x4e38('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4e38('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x4e38('0xb'));var as=require(_0x4e38('0xc'));var hardwareService=require(_0x4e38('0xd'));var logger=require(_0x4e38('0xe'))(_0x4e38('0xf'));var utils=require(_0x4e38('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4e38('0x11'));var db=require(_0x4e38('0x12'))['db'];var integrations=require(_0x4e38('0x13'));var jayson=require('jayson/promise');var client=jayson[_0x4e38('0x14')][_0x4e38('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x57388d,_0x1abed0,_0x59f68a,_0x4d242e){return new BPromise(function(_0x4433cc,_0x44699a){var _0x4b09eb=_0x4d242e||client;return _0x4b09eb[_0x4e38('0x16')](_0x57388d,_0x59f68a)[_0x4e38('0x17')](function(_0x24d8c8){logger['info'](_0x4e38('0x18'),_0x1abed0,_0x4e38('0x19'));logger[_0x4e38('0x1a')](_0x4e38('0x1b'),_0x1abed0,_0x4e38('0x19'),JSON['stringify'](_0x24d8c8));if(_0x24d8c8[_0x4e38('0x1c')]){if(_0x24d8c8[_0x4e38('0x1c')][_0x4e38('0x1d')]===0x1f4){logger[_0x4e38('0x1c')](_0x4e38('0x18'),_0x1abed0,_0x24d8c8[_0x4e38('0x1c')][_0x4e38('0x1e')]);return _0x44699a(_0x24d8c8['error'][_0x4e38('0x1e')]);}logger[_0x4e38('0x1c')](_0x4e38('0x18'),_0x1abed0,_0x24d8c8[_0x4e38('0x1c')][_0x4e38('0x1e')]);return _0x4433cc(_0x24d8c8[_0x4e38('0x1c')][_0x4e38('0x1e')]);}else{logger[_0x4e38('0x1f')](_0x4e38('0x18'),_0x1abed0,'request\x20sent');_0x4433cc(_0x24d8c8[_0x4e38('0x20')][_0x4e38('0x1e')]);}})[_0x4e38('0x21')](function(_0x26dbc5){logger[_0x4e38('0x1c')](_0x4e38('0x18'),_0x1abed0,_0x26dbc5);_0x44699a(_0x26dbc5);});});}function respondWithStatusCode(_0x33bc64,_0x1daccd){_0x1daccd=_0x1daccd||0xcc;return function(_0x470a8b){if(_0x470a8b){return _0x33bc64[_0x4e38('0x22')](_0x1daccd);}return _0x33bc64['status'](_0x1daccd)[_0x4e38('0x23')]();};}function respondWithResult(_0x47b09b,_0x2c1006){_0x2c1006=_0x2c1006||0xc8;return function(_0x33d49e){if(_0x33d49e){return _0x47b09b[_0x4e38('0x24')](_0x2c1006)[_0x4e38('0x25')](_0x33d49e);}};}function respondWithFilteredResult(_0x3a3a97,_0x3eed38){return function(_0x1f2d03){if(_0x1f2d03){var _0x4f749c=typeof _0x3eed38['offset']===_0x4e38('0x26')&&typeof _0x3eed38[_0x4e38('0x27')]===_0x4e38('0x26');var _0x2adcb7=_0x1f2d03[_0x4e38('0x28')];var _0x5afd46=_0x4f749c?0x0:_0x3eed38[_0x4e38('0x29')];var _0xf55f4f=_0x4f749c?_0x1f2d03['count']:_0x3eed38[_0x4e38('0x29')]+_0x3eed38[_0x4e38('0x27')];var _0x42cfad;if(_0xf55f4f>=_0x2adcb7){_0xf55f4f=_0x2adcb7;_0x42cfad=0xc8;}else{_0x42cfad=0xce;}_0x3a3a97['status'](_0x42cfad);return _0x3a3a97['set'](_0x4e38('0x2a'),_0x5afd46+'-'+_0xf55f4f+'/'+_0x2adcb7)['json'](_0x1f2d03);}return null;};}function patchUpdates(_0xaf002){return function(_0x17f755){try{jsonpatch[_0x4e38('0x2b')](_0x17f755,_0xaf002,!![]);}catch(_0x43c72c){return BPromise['reject'](_0x43c72c);}return _0x17f755[_0x4e38('0x2c')]();};}function saveUpdates(_0x1a5d9b,_0x8b55ed){return function(_0x12d858){if(_0x12d858){return _0x12d858['update'](_0x1a5d9b)[_0x4e38('0x17')](function(_0x4f2e7f){return _0x4f2e7f;});}return null;};}function removeEntity(_0x909bdf,_0x5d62ff){return function(_0x52d28c){if(_0x52d28c){return _0x52d28c['destroy']()[_0x4e38('0x17')](function(){_0x909bdf[_0x4e38('0x24')](0xcc)[_0x4e38('0x23')]();});}};}function handleEntityNotFound(_0x1bdd2d,_0x4fc7e8){return function(_0x4e3fdb){if(!_0x4e3fdb){_0x1bdd2d[_0x4e38('0x22')](0x194);}return _0x4e3fdb;};}function handleError(_0x7f49e6,_0x488ab4){_0x488ab4=_0x488ab4||0x1f4;return function(_0x2cc8f8){logger['error'](_0x2cc8f8[_0x4e38('0x2d')]);if(_0x2cc8f8[_0x4e38('0x2e')]){delete _0x2cc8f8[_0x4e38('0x2e')];}_0x7f49e6[_0x4e38('0x24')](_0x488ab4)[_0x4e38('0x2f')](_0x2cc8f8);};}function getMustacheRender(_0x54caef,_0x3aa16c){return Mustache[_0x4e38('0x30')](_0x54caef,_[_0x4e38('0x31')](_0x3aa16c[_0x4e38('0x32')],{'contact':_0x3aa16c['contact'],'message':_0x3aa16c[_0x4e38('0x1e')],'agent':_0x3aa16c[_0x4e38('0x33')],'interaction':_0x3aa16c[_0x4e38('0x34')],'account':_0x3aa16c[_0x4e38('0x35')]}))||'';}exports[_0x4e38('0x36')]=function(_0x7ab539,_0x4a0541){var _0x34abd7={},_0x23f242={},_0x5944c7={'count':0x0,'rows':[]};var _0x7af284=_[_0x4e38('0x37')](db[_0x4e38('0x38')]['rawAttributes'],function(_0x2bfedf){return{'name':_0x2bfedf[_0x4e38('0x39')],'type':_0x2bfedf[_0x4e38('0x3a')][_0x4e38('0x3b')]};});_0x23f242[_0x4e38('0x3c')]=_['map'](_0x7af284,_0x4e38('0x2e'));_0x23f242['query']=_[_0x4e38('0x3d')](_0x7ab539[_0x4e38('0x3e')]);_0x23f242['filters']=_[_0x4e38('0x3f')](_0x23f242[_0x4e38('0x3c')],_0x23f242[_0x4e38('0x3e')]);_0x34abd7['attributes']=_[_0x4e38('0x3f')](_0x23f242[_0x4e38('0x3c')],qs['fields'](_0x7ab539['query'][_0x4e38('0x40')]));_0x34abd7['attributes']=_0x34abd7[_0x4e38('0x41')]['length']?_0x34abd7[_0x4e38('0x41')]:_0x23f242[_0x4e38('0x3c')];if(!_0x7ab539[_0x4e38('0x3e')][_0x4e38('0x42')]('nolimit')){_0x34abd7[_0x4e38('0x27')]=qs['limit'](_0x7ab539[_0x4e38('0x3e')][_0x4e38('0x27')]);_0x34abd7[_0x4e38('0x29')]=qs[_0x4e38('0x29')](_0x7ab539[_0x4e38('0x3e')][_0x4e38('0x29')]);}_0x34abd7[_0x4e38('0x43')]=qs[_0x4e38('0x44')](_0x7ab539[_0x4e38('0x3e')]['sort']);_0x34abd7[_0x4e38('0x45')]=qs[_0x4e38('0x46')](_[_0x4e38('0x47')](_0x7ab539[_0x4e38('0x3e')],_0x23f242[_0x4e38('0x46')]),_0x7af284);if(_0x7ab539[_0x4e38('0x3e')][_0x4e38('0x48')]){_0x34abd7['where']=_['merge'](_0x34abd7[_0x4e38('0x45')],{'$or':_['map'](_0x7af284,function(_0x3c3710){if(_0x3c3710[_0x4e38('0x3a')]!==_0x4e38('0x49')){var _0x8c1bf={};_0x8c1bf[_0x3c3710['name']]={'$like':'%'+_0x7ab539[_0x4e38('0x3e')][_0x4e38('0x48')]+'%'};return _0x8c1bf;}})});}_0x34abd7=_['merge']({},_0x34abd7,_0x7ab539[_0x4e38('0x4a')]);var _0x50842a={'where':_0x34abd7[_0x4e38('0x45')]};return db[_0x4e38('0x38')][_0x4e38('0x28')](_0x50842a)[_0x4e38('0x17')](function(_0xe63ddb){_0x5944c7['count']=_0xe63ddb;if(_0x7ab539[_0x4e38('0x3e')][_0x4e38('0x4b')]){_0x34abd7[_0x4e38('0x4c')]=[{'all':!![]}];}return db[_0x4e38('0x38')][_0x4e38('0x4d')](_0x34abd7);})[_0x4e38('0x17')](function(_0x5381d5){_0x5944c7[_0x4e38('0x4e')]=_0x5381d5;return _0x5944c7;})[_0x4e38('0x17')](respondWithFilteredResult(_0x4a0541,_0x34abd7))[_0x4e38('0x21')](handleError(_0x4a0541,null));};exports['show']=function(_0x2796e8,_0x1ad09b){var _0x4141cc={'raw':![],'where':{'id':_0x2796e8['params']['id']}},_0x4a8185={};_0x4a8185[_0x4e38('0x3c')]=_['keys'](db[_0x4e38('0x38')][_0x4e38('0x4f')]);_0x4a8185['query']=_[_0x4e38('0x3d')](_0x2796e8[_0x4e38('0x3e')]);_0x4a8185[_0x4e38('0x46')]=_[_0x4e38('0x3f')](_0x4a8185['model'],_0x4a8185[_0x4e38('0x3e')]);_0x4141cc[_0x4e38('0x41')]=_[_0x4e38('0x3f')](_0x4a8185[_0x4e38('0x3c')],qs[_0x4e38('0x40')](_0x2796e8['query'][_0x4e38('0x40')]));_0x4141cc[_0x4e38('0x41')]=_0x4141cc[_0x4e38('0x41')][_0x4e38('0x50')]?_0x4141cc[_0x4e38('0x41')]:_0x4a8185['model'];if(_0x2796e8[_0x4e38('0x3e')][_0x4e38('0x4b')]){_0x4141cc['include']=[{'all':!![]}];}_0x4141cc=_[_0x4e38('0x31')]({},_0x4141cc,_0x2796e8[_0x4e38('0x4a')]);return db[_0x4e38('0x38')][_0x4e38('0x51')](_0x4141cc)[_0x4e38('0x17')](handleEntityNotFound(_0x1ad09b,null))['then'](respondWithResult(_0x1ad09b,null))[_0x4e38('0x21')](handleError(_0x1ad09b,null));};exports[_0x4e38('0x52')]=function(_0x467817,_0x370e6d){return db[_0x4e38('0x38')][_0x4e38('0x52')](_0x467817[_0x4e38('0x32')],{})[_0x4e38('0x17')](respondWithResult(_0x370e6d,0xc9))['catch'](handleError(_0x370e6d,null));};exports['update']=function(_0x9e8422,_0x9c4a8){if(_0x9e8422[_0x4e38('0x32')]['id']){delete _0x9e8422['body']['id'];}return db[_0x4e38('0x38')][_0x4e38('0x51')]({'where':{'id':_0x9e8422[_0x4e38('0x53')]['id']}})[_0x4e38('0x17')](handleEntityNotFound(_0x9c4a8,null))[_0x4e38('0x17')](saveUpdates(_0x9e8422[_0x4e38('0x32')],null))[_0x4e38('0x17')](respondWithResult(_0x9c4a8,null))[_0x4e38('0x21')](handleError(_0x9c4a8,null));};exports[_0x4e38('0x54')]=function(_0x32f92f,_0x434b08){return db[_0x4e38('0x38')][_0x4e38('0x51')]({'where':{'id':_0x32f92f['params']['id']}})['then'](handleEntityNotFound(_0x434b08,null))['then'](removeEntity(_0x434b08,null))[_0x4e38('0x21')](handleError(_0x434b08,null));};exports[_0x4e38('0x55')]=function(_0x56adf3,_0x394659,_0x4d47fa){var _0xdf903c={};var _0x4523fe={};var _0x4bfbe1;var _0x2f7c71;return db['ZohoAccount'][_0x4e38('0x56')]({'where':{'id':_0x56adf3[_0x4e38('0x53')]['id']}})[_0x4e38('0x17')](handleEntityNotFound(_0x394659,null))[_0x4e38('0x17')](function(_0x117745){if(_0x117745){_0x4bfbe1=_0x117745;_0x4523fe[_0x4e38('0x3c')]=_[_0x4e38('0x3d')](db[_0x4e38('0x57')][_0x4e38('0x4f')]);_0x4523fe[_0x4e38('0x3e')]=_[_0x4e38('0x3d')](_0x56adf3[_0x4e38('0x3e')]);_0x4523fe[_0x4e38('0x46')]=_['intersection'](_0x4523fe[_0x4e38('0x3c')],_0x4523fe['query']);_0xdf903c[_0x4e38('0x41')]=_[_0x4e38('0x3f')](_0x4523fe[_0x4e38('0x3c')],qs[_0x4e38('0x40')](_0x56adf3[_0x4e38('0x3e')]['fields']));_0xdf903c[_0x4e38('0x41')]=_0xdf903c[_0x4e38('0x41')][_0x4e38('0x50')]?_0xdf903c[_0x4e38('0x41')]:_0x4523fe[_0x4e38('0x3c')];_0xdf903c['order']=qs['sort'](_0x56adf3[_0x4e38('0x3e')][_0x4e38('0x44')]);_0xdf903c['where']=qs[_0x4e38('0x46')](_['pick'](_0x56adf3['query'],_0x4523fe[_0x4e38('0x46')]));if(_0x56adf3[_0x4e38('0x3e')][_0x4e38('0x48')]){_0xdf903c[_0x4e38('0x45')]=_[_0x4e38('0x31')](_0xdf903c[_0x4e38('0x45')],{'$or':_['map'](_0xdf903c[_0x4e38('0x41')],function(_0x487056){var _0x3a52f4={};_0x3a52f4[_0x487056]={'$like':'%'+_0x56adf3[_0x4e38('0x3e')]['filter']+'%'};return _0x3a52f4;})});}_0xdf903c=_[_0x4e38('0x31')]({},_0xdf903c,_0x56adf3['options']);return _0x4bfbe1[_0x4e38('0x55')](_0xdf903c);}})[_0x4e38('0x17')](function(_0x449177){if(_0x449177){_0x2f7c71=_0x449177[_0x4e38('0x50')];if(!_0x56adf3[_0x4e38('0x3e')][_0x4e38('0x42')](_0x4e38('0x58'))){_0xdf903c[_0x4e38('0x27')]=qs['limit'](_0x56adf3['query'][_0x4e38('0x27')]);_0xdf903c[_0x4e38('0x29')]=qs['offset'](_0x56adf3[_0x4e38('0x3e')][_0x4e38('0x29')]);}return _0x4bfbe1[_0x4e38('0x55')](_0xdf903c);}})['then'](function(_0x2fd29e){if(_0x2fd29e){return _0x2fd29e?{'count':_0x2f7c71,'rows':_0x2fd29e}:null;}})['then'](respondWithResult(_0x394659,null))[_0x4e38('0x21')](handleError(_0x394659,null));};exports[_0x4e38('0x59')]=function(_0x53e701,_0x2b0f05,_0x5bcec2){if(_0x53e701['body']['id']){delete _0x53e701['body']['id'];}return db[_0x4e38('0x38')][_0x4e38('0x56')]({'where':{'id':_0x53e701[_0x4e38('0x53')]['id']}})[_0x4e38('0x17')](handleEntityNotFound(_0x2b0f05,null))[_0x4e38('0x17')](function(_0x3aade5){if(_0x3aade5){_0x53e701[_0x4e38('0x32')]['AccountId']=_0x3aade5['id'];_0x53e701[_0x4e38('0x32')][_0x4e38('0x5a')]=integrations[_0x4e38('0x5b')](_0x53e701[_0x4e38('0x32')]['channel'],_0x53e701['body'][_0x4e38('0x3a')]);_0x53e701[_0x4e38('0x32')]['Descriptions']=integrations[_0x4e38('0x5c')](_0x53e701[_0x4e38('0x32')][_0x4e38('0x5d')],_0x53e701[_0x4e38('0x32')][_0x4e38('0x3a')]);return db[_0x4e38('0x57')]['create'](_0x53e701['body'],{'include':[{'model':db[_0x4e38('0x5e')],'as':_0x4e38('0x5a')},{'model':db[_0x4e38('0x5e')],'as':_0x4e38('0x5f')}]});}return null;})[_0x4e38('0x17')](respondWithResult(_0x2b0f05,null))[_0x4e38('0x21')](handleError(_0x2b0f05,null));};function getAccessToken(_0x3d037a){return new Promise(function(_0x598f54,_0x438493){var _0x53e699;switch(_0x3d037a[_0x4e38('0x60')]){case'US':_0x53e699=_0x4e38('0x61');break;case'AU':_0x53e699='https://accounts.zoho.com.au';break;case'EU':_0x53e699=_0x4e38('0x62');break;case'IN':_0x53e699=_0x4e38('0x63');break;case'CN':_0x53e699=_0x4e38('0x64');break;default:_0x53e699=_0x4e38('0x62');break;}var _0x481787={'method':_0x4e38('0x65'),'uri':_0x53e699+'/oauth/v2/token','qs':{'refresh_token':_0x3d037a['refreshToken'],'client_id':_0x3d037a[_0x4e38('0x66')],'client_secret':_0x3d037a[_0x4e38('0x67')],'grant_type':_0x4e38('0x68')},'json':!![]};return rp(_0x481787)[_0x4e38('0x17')](function(_0x4c6eb1){if(_0x4c6eb1['access_token']){_0x598f54(_0x4c6eb1[_0x4e38('0x69')]);}else{_0x438493(_0x4e38('0x6a'));}})[_0x4e38('0x21')](function(_0x54bcc6){_0x438493(_0x54bcc6);});});}exports[_0x4e38('0x6b')]=function(_0x1d731c,_0x102617,_0x5e5ee2){var _0x2d2697,_0x22233f,_0xea53a5,_0x132f7f,_0x35e19a;return db[_0x4e38('0x38')]['findOne']({'where':{'id':_0x1d731c[_0x4e38('0x53')]['id']},'attributes':['id',_0x4e38('0x6c'),_0x4e38('0x60'),_0x4e38('0x66'),'clientSecret','serverUrl',_0x4e38('0x1d'),_0x4e38('0x6d')]})[_0x4e38('0x17')](handleEntityNotFound(_0x102617,null))[_0x4e38('0x17')](function(_0x326900){_0x35e19a=_0x326900;_0x2d2697=_0x35e19a[_0x4e38('0x6c')];_0x22233f=_0x2d2697==='zoho.eu'?'eu':'com';_0xea53a5=_0x35e19a['serverUrl'];var _0x406a4c=_0xea53a5[_0x4e38('0x6e')](-0x1);if(_0x406a4c==='/'||_0x406a4c==='\x5c'||_0x406a4c===':'){_0xea53a5=_0xea53a5[_0x4e38('0x6f')](0x0,_0xea53a5['lastIndexOf'](_0x406a4c));}if(!_0x35e19a[_0x4e38('0x6d')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x35e19a);})[_0x4e38('0x17')](function(_0x817ce0){if(_0x817ce0){return rp({'method':_0x4e38('0x70'),'uri':util[_0x4e38('0x71')](_0x4e38('0x72'),_0x22233f),'qs':{'module':_0x4e38('0x73')},'headers':{'Authorization':_0x4e38('0x74')+_0x817ce0},'json':!![]});}})[_0x4e38('0x17')](function(_0x695b02){if(_0x695b02){if(_0x695b02[_0x4e38('0x75')]&&_0x695b02[_0x4e38('0x75')][_0x4e38('0x1c')]){throw new Error(_0x695b02[_0x4e38('0x75')][_0x4e38('0x1c')][_0x4e38('0x1e')]);}var _0x1ef91f=[];var _0x54e2ab=[];var _0x3e6f14=[_0x4e38('0x76'),_0x4e38('0x77'),_0x4e38('0x78'),_0x4e38('0x79'),'Call_Duration',_0x4e38('0x7a'),'Call_Start_Time',_0x4e38('0x7b')];_0x54e2ab=_[_0x4e38('0x7c')](_0x695b02[_0x4e38('0x40')],function(_0x3af60a){return _0x3e6f14[_0x4e38('0x7d')](_0x3af60a[_0x4e38('0x7e')]);});for(var _0x198330=0x0;_0x198330<_0x54e2ab[_0x4e38('0x50')];_0x198330++){if(_0x54e2ab[_0x198330][_0x4e38('0x7f')]===![]){_0x1ef91f[_0x4e38('0x80')]({'id':_0x54e2ab[_0x198330]['id'],'name':_0x54e2ab[_0x198330][_0x4e38('0x81')],'custom':_0x54e2ab[_0x198330]['custom_field'],'options':_0x54e2ab[_0x198330]['data_type']===_0x4e38('0x82')&&_0x54e2ab[_0x198330][_0x4e38('0x83')][_0x4e38('0x50')]>-0x1?_[_0x4e38('0x37')](_0x54e2ab[_0x198330]['pick_list_values'],function(_0xc1957e){return{'name':_0xc1957e,'value':_0xc1957e};}):[]});}}return{'count':_0x1ef91f[_0x4e38('0x50')],'rows':_0x1ef91f};}else{return{'count':0x0,'rows':[]};}})[_0x4e38('0x17')](respondWithResult(_0x102617,null))[_0x4e38('0x21')](function(_0x12313d){var _0x2f3d82=_0x1d731c[_0x4e38('0x3e')][_0x4e38('0x84')]?0x1f4:_0x12313d['statusCode']||0x1f4;logger[_0x4e38('0x1c')](_0x4e38('0x85'),_0x4e38('0x6b'),_0x2f3d82,JSON[_0x4e38('0x86')](_0x12313d));delete _0x12313d['name'];if(_0x2f3d82===0x191){_0x2f3d82=0x190;}_0x102617['status'](_0x2f3d82)[_0x4e38('0x2f')](_0x1d731c[_0x4e38('0x3e')][_0x4e38('0x84')]?{'message':_0x4e38('0x87'),'statusCode':_0x12313d[_0x4e38('0x88')]}:_0x12313d);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 7e15afb..53ff3dd 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 _0xbb74=['lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','code','application/x-www-form-urlencoded','then','parse','refresh_token','info','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','name','slice','https://accounts.zoho.com.au','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','host','substring'];(function(_0x328668,_0x1ab9b2){var _0xaaddf1=function(_0x334d31){while(--_0x334d31){_0x328668['push'](_0x328668['shift']());}};_0xaaddf1(++_0x1ab9b2);}(_0xbb74,0x6f));var _0x4bb7=function(_0x212c1d,_0x216f92){_0x212c1d=_0x212c1d-0x0;var _0x97d7b=_0xbb74[_0x212c1d];return _0x97d7b;};'use strict';var _=require(_0x4bb7('0x0'));var util=require(_0x4bb7('0x1'));var logger=require(_0x4bb7('0x2'))(_0x4bb7('0x3'));var moment=require(_0x4bb7('0x4'));var BPromise=require(_0x4bb7('0x5'));var rp=require(_0x4bb7('0x6'));var fs=require('fs');var path=require(_0x4bb7('0x7'));var rimraf=require(_0x4bb7('0x8'));var config=require(_0x4bb7('0x9'));var attributes=require(_0x4bb7('0xa'));var integrations=require(_0x4bb7('0xb'));module[_0x4bb7('0xc')]=function(_0x10f6ee,_0x5afacc){return _0x10f6ee[_0x4bb7('0xd')]('ZohoAccount',attributes,{'tableName':_0x4bb7('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5522d4,_0x212ddf,_0xc7aa65){if(_0x5522d4[_0x4bb7('0xf')](_0x4bb7('0x10'))||_0x5522d4[_0x4bb7('0xf')](_0x4bb7('0x11'))||_0x5522d4[_0x4bb7('0xf')](_0x4bb7('0x12'))||_0x5522d4['changed']('clientSecret')||_0x5522d4[_0x4bb7('0xf')]('code')||_0x5522d4['changed'](_0x4bb7('0x13'))){var _0x15e2eb,_0x3afd65;_0x15e2eb=_0x5522d4[_0x4bb7('0x11')];var _0x3bf547=_0x15e2eb['slice'](-0x1);if(_0x3bf547==='/'||_0x3bf547==='\x5c'||_0x3bf547===':'){_0x15e2eb=_0x15e2eb[_0x4bb7('0x14')](0x0,_0x15e2eb[_0x4bb7('0x15')](_0x3bf547));}switch(_0x5522d4[_0x4bb7('0x10')]){case'US':_0x3afd65=_0x4bb7('0x16');break;case'AU':_0x3afd65='https://accounts.zoho.com.au';break;case'IN':_0x3afd65=_0x4bb7('0x17');break;case'CN':_0x3afd65=_0x4bb7('0x18');break;default:_0x3afd65=_0x4bb7('0x19');break;}var _0x31a455={'method':_0x4bb7('0x1a'),'uri':_0x3afd65+_0x4bb7('0x1b'),'form':{'grant_type':_0x4bb7('0x1c'),'client_id':_0x5522d4['clientId'],'client_secret':_0x5522d4[_0x4bb7('0x1d')],'redirect_uri':_0x5522d4[_0x4bb7('0x11')],'code':_0x5522d4[_0x4bb7('0x1e')]},'headers':{'Content-Type':_0x4bb7('0x1f')}};return rp(_0x31a455)[_0x4bb7('0x20')](function(_0x4c9bb0){var _0x4755ff=JSON[_0x4bb7('0x21')](_0x4c9bb0);if(_0x4755ff[_0x4bb7('0x22')]){_0x5522d4['refreshToken']=_0x4755ff[_0x4bb7('0x22')];logger[_0x4bb7('0x23')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5522d4['name'],_0x5522d4['id']));}else{logger[_0x4bb7('0x24')](util[_0x4bb7('0x25')](_0x4bb7('0x26'),_0x5522d4['name'],_0x5522d4['id']),util[_0x4bb7('0x27')](_0x4755ff,{'showHidden':![],'depth':null}));}return _0xc7aa65(null,_0x212ddf);})[_0x4bb7('0x28')](function(_0x1db6c3){logger[_0x4bb7('0x24')](util['format'](_0x4bb7('0x26'),_0x5522d4[_0x4bb7('0x29')],_0x5522d4['id']),util[_0x4bb7('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0xc7aa65(_0x1db6c3);});}else{return _0xc7aa65(null,_0x212ddf);}},'beforeUpdate':function(_0x20a5ba,_0x16031b,_0x86ddf){if(_0x20a5ba[_0x4bb7('0xf')](_0x4bb7('0x10'))||_0x20a5ba[_0x4bb7('0xf')](_0x4bb7('0x11'))||_0x20a5ba[_0x4bb7('0xf')](_0x4bb7('0x12'))||_0x20a5ba['changed'](_0x4bb7('0x1d'))||_0x20a5ba[_0x4bb7('0xf')]('code')||_0x20a5ba[_0x4bb7('0xf')](_0x4bb7('0x13'))){var _0x476f49,_0x5d33b2;_0x476f49=_0x20a5ba[_0x4bb7('0x11')];var _0xe4d0fd=_0x476f49[_0x4bb7('0x2a')](-0x1);if(_0xe4d0fd==='/'||_0xe4d0fd==='\x5c'||_0xe4d0fd===':'){_0x476f49=_0x476f49[_0x4bb7('0x14')](0x0,_0x476f49[_0x4bb7('0x15')](_0xe4d0fd));}switch(_0x20a5ba['zone']){case'US':_0x5d33b2='https://accounts.zoho.com';break;case'AU':_0x5d33b2=_0x4bb7('0x2b');break;case'IN':_0x5d33b2='https://accounts.zoho.in';break;case'CN':_0x5d33b2=_0x4bb7('0x18');break;default:_0x5d33b2=_0x4bb7('0x19');break;}var _0x176e6a={'method':_0x4bb7('0x1a'),'uri':_0x5d33b2+_0x4bb7('0x1b'),'form':{'grant_type':'authorization_code','client_id':_0x20a5ba[_0x4bb7('0x12')],'client_secret':_0x20a5ba[_0x4bb7('0x1d')],'redirect_uri':_0x20a5ba[_0x4bb7('0x11')],'code':_0x20a5ba[_0x4bb7('0x1e')]},'headers':{'Content-Type':_0x4bb7('0x1f')}};return rp(_0x176e6a)[_0x4bb7('0x20')](function(_0x2cbcaf){var _0x32c1a6=JSON['parse'](_0x2cbcaf);if(_0x32c1a6[_0x4bb7('0x22')]){_0x20a5ba['refreshToken']=_0x32c1a6[_0x4bb7('0x22')];logger[_0x4bb7('0x23')](util[_0x4bb7('0x25')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x20a5ba[_0x4bb7('0x29')],_0x20a5ba['id']));}else{logger['error'](util[_0x4bb7('0x25')](_0x4bb7('0x26'),_0x20a5ba['name'],_0x20a5ba['id']),util['inspect'](_0x32c1a6,{'showHidden':![],'depth':null}));}return _0x86ddf(null,_0x16031b);})[_0x4bb7('0x28')](function(_0x3f5ba3){logger['error'](util[_0x4bb7('0x25')](_0x4bb7('0x26'),_0x20a5ba[_0x4bb7('0x29')],_0x20a5ba['id']),util[_0x4bb7('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x86ddf(_0x3f5ba3);});}else{return _0x86ddf(null,_0x16031b);}}}});}; \ No newline at end of file +var _0x8c98=['lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','/oauth/v2/token','authorization_code','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','substring','https://accounts.zoho.com.cn','https://accounts.zoho.eu','application/x-www-form-urlencoded','then','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','serverUrl','slice'];(function(_0x13351f,_0x19f972){var _0x1bb620=function(_0x2a9fb1){while(--_0x2a9fb1){_0x13351f['push'](_0x13351f['shift']());}};_0x1bb620(++_0x19f972);}(_0x8c98,0x1e5));var _0x88c9=function(_0x11fff7,_0x46baaf){_0x11fff7=_0x11fff7-0x0;var _0x5214a5=_0x8c98[_0x11fff7];return _0x5214a5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x88c9('0x0'))(_0x88c9('0x1'));var moment=require(_0x88c9('0x2'));var BPromise=require(_0x88c9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x88c9('0x4'));var rimraf=require(_0x88c9('0x5'));var config=require(_0x88c9('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x88c9('0x7'));module[_0x88c9('0x8')]=function(_0x10c496,_0x4353ee){return _0x10c496[_0x88c9('0x9')]('ZohoAccount',attributes,{'tableName':_0x88c9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1374d4,_0x1c8786,_0x2b2ac1){if(_0x1374d4[_0x88c9('0xb')](_0x88c9('0xc'))||_0x1374d4['changed']('serverUrl')||_0x1374d4['changed'](_0x88c9('0xd'))||_0x1374d4[_0x88c9('0xb')](_0x88c9('0xe'))||_0x1374d4[_0x88c9('0xb')](_0x88c9('0xf'))||_0x1374d4['changed'](_0x88c9('0x10'))){var _0x4d7bc3,_0x3fb49d;_0x4d7bc3=_0x1374d4[_0x88c9('0x11')];var _0x307d27=_0x4d7bc3[_0x88c9('0x12')](-0x1);if(_0x307d27==='/'||_0x307d27==='\x5c'||_0x307d27===':'){_0x4d7bc3=_0x4d7bc3['substring'](0x0,_0x4d7bc3[_0x88c9('0x13')](_0x307d27));}switch(_0x1374d4[_0x88c9('0xc')]){case'US':_0x3fb49d=_0x88c9('0x14');break;case'AU':_0x3fb49d=_0x88c9('0x15');break;case'IN':_0x3fb49d=_0x88c9('0x16');break;case'CN':_0x3fb49d='https://accounts.zoho.com.cn';break;default:_0x3fb49d='https://accounts.zoho.eu';break;}var _0x300098={'method':_0x88c9('0x17'),'uri':_0x3fb49d+_0x88c9('0x18'),'form':{'grant_type':_0x88c9('0x19'),'client_id':_0x1374d4[_0x88c9('0xd')],'client_secret':_0x1374d4['clientSecret'],'redirect_uri':_0x1374d4[_0x88c9('0x11')],'code':_0x1374d4['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x300098)['then'](function(_0x2524ce){var _0x12d135=JSON[_0x88c9('0x1a')](_0x2524ce);if(_0x12d135[_0x88c9('0x1b')]){_0x1374d4[_0x88c9('0x1c')]=_0x12d135['refresh_token'];logger[_0x88c9('0x1d')](util[_0x88c9('0x1e')](_0x88c9('0x1f'),_0x1374d4[_0x88c9('0x20')],_0x1374d4['id']));}else{logger[_0x88c9('0x21')](util[_0x88c9('0x1e')](_0x88c9('0x22'),_0x1374d4['name'],_0x1374d4['id']),util[_0x88c9('0x23')](_0x12d135,{'showHidden':![],'depth':null}));}return _0x2b2ac1(null,_0x1c8786);})[_0x88c9('0x24')](function(_0x3812c8){logger[_0x88c9('0x21')](util[_0x88c9('0x1e')](_0x88c9('0x22'),_0x1374d4['name'],_0x1374d4['id']),util[_0x88c9('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x2b2ac1(_0x3812c8);});}else{return _0x2b2ac1(null,_0x1c8786);}},'beforeUpdate':function(_0x583d74,_0xb5ddad,_0x315871){if(_0x583d74[_0x88c9('0xb')](_0x88c9('0xc'))||_0x583d74[_0x88c9('0xb')](_0x88c9('0x11'))||_0x583d74[_0x88c9('0xb')](_0x88c9('0xd'))||_0x583d74['changed'](_0x88c9('0xe'))||_0x583d74[_0x88c9('0xb')](_0x88c9('0xf'))||_0x583d74[_0x88c9('0xb')](_0x88c9('0x10'))){var _0x48a959,_0x1b3def;_0x48a959=_0x583d74[_0x88c9('0x11')];var _0x204d1a=_0x48a959[_0x88c9('0x12')](-0x1);if(_0x204d1a==='/'||_0x204d1a==='\x5c'||_0x204d1a===':'){_0x48a959=_0x48a959[_0x88c9('0x25')](0x0,_0x48a959[_0x88c9('0x13')](_0x204d1a));}switch(_0x583d74[_0x88c9('0xc')]){case'US':_0x1b3def=_0x88c9('0x14');break;case'AU':_0x1b3def=_0x88c9('0x15');break;case'IN':_0x1b3def=_0x88c9('0x16');break;case'CN':_0x1b3def=_0x88c9('0x26');break;default:_0x1b3def=_0x88c9('0x27');break;}var _0x4d9190={'method':_0x88c9('0x17'),'uri':_0x1b3def+'/oauth/v2/token','form':{'grant_type':_0x88c9('0x19'),'client_id':_0x583d74[_0x88c9('0xd')],'client_secret':_0x583d74[_0x88c9('0xe')],'redirect_uri':_0x583d74['serverUrl'],'code':_0x583d74['code']},'headers':{'Content-Type':_0x88c9('0x28')}};return rp(_0x4d9190)[_0x88c9('0x29')](function(_0x427add){var _0x3e53bb=JSON['parse'](_0x427add);if(_0x3e53bb[_0x88c9('0x1b')]){_0x583d74[_0x88c9('0x1c')]=_0x3e53bb[_0x88c9('0x1b')];logger[_0x88c9('0x1d')](util[_0x88c9('0x1e')](_0x88c9('0x1f'),_0x583d74[_0x88c9('0x20')],_0x583d74['id']));}else{logger[_0x88c9('0x21')](util[_0x88c9('0x1e')](_0x88c9('0x22'),_0x583d74['name'],_0x583d74['id']),util[_0x88c9('0x23')](_0x3e53bb,{'showHidden':![],'depth':null}));}return _0x315871(null,_0xb5ddad);})[_0x88c9('0x24')](function(_0x246259){logger[_0x88c9('0x21')](util[_0x88c9('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x583d74[_0x88c9('0x20')],_0x583d74['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x315871(_0x246259);});}else{return _0x315871(null,_0xb5ddad);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 7413e9d..63cdb9e 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 _0x9295=['attributes','ShowZohoAccount','find','where','model','lodash','bluebird','randomstring','rpc','../../config/environment','request','then','info','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','result','catch','GetZohoAccount','ZohoAccount','options','raw','limit','include','map'];(function(_0x162d79,_0x5bf570){var _0x1f4600=function(_0x18fae2){while(--_0x18fae2){_0x162d79['push'](_0x162d79['shift']());}};_0x1f4600(++_0x5bf570);}(_0x9295,0x9b));var _0x5929=function(_0x12c68b,_0x11d5e6){_0x12c68b=_0x12c68b-0x0;var _0x5923c3=_0x9295[_0x12c68b];return _0x5923c3;};'use strict';var _=require(_0x5929('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5929('0x1'));var rs=require(_0x5929('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5929('0x3'));var config=require(_0x5929('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf22f83,_0x273af0,_0xe6e1d9){return new BPromise(function(_0x2f3cc8,_0x7efc6e){return client[_0x5929('0x5')](_0xf22f83,_0xe6e1d9)[_0x5929('0x6')](function(_0x1a85ce){logger[_0x5929('0x7')]('ZohoAccount,\x20%s,\x20%s',_0x273af0,'request\x20sent');logger[_0x5929('0x8')](_0x5929('0x9'),_0x273af0,_0x5929('0xa'),JSON[_0x5929('0xb')](_0x1a85ce));if(_0x1a85ce[_0x5929('0xc')]){if(_0x1a85ce['error'][_0x5929('0xd')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x273af0,_0x1a85ce[_0x5929('0xc')]['message']);return _0x7efc6e(_0x1a85ce[_0x5929('0xc')][_0x5929('0xe')]);}logger['error'](_0x5929('0xf'),_0x273af0,_0x1a85ce[_0x5929('0xc')][_0x5929('0xe')]);return _0x2f3cc8(_0x1a85ce[_0x5929('0xc')][_0x5929('0xe')]);}else{logger[_0x5929('0x7')]('ZohoAccount,\x20%s,\x20%s',_0x273af0,'request\x20sent');_0x2f3cc8(_0x1a85ce[_0x5929('0x10')][_0x5929('0xe')]);}})[_0x5929('0x11')](function(_0x2910cc){logger[_0x5929('0xc')](_0x5929('0xf'),_0x273af0,_0x2910cc);_0x7efc6e(_0x2910cc);});});}exports[_0x5929('0x12')]=function(_0x1d6fcc){var _0x4b8e7d=this;return new Promise(function(_0x2d7ce3,_0x2e581c){return db[_0x5929('0x13')]['findAll']({'raw':_0x1d6fcc[_0x5929('0x14')]?_0x1d6fcc[_0x5929('0x14')][_0x5929('0x15')]===undefined?!![]:![]:!![],'where':_0x1d6fcc[_0x5929('0x14')]?_0x1d6fcc['options']['where']||null:null,'attributes':_0x1d6fcc[_0x5929('0x14')]?_0x1d6fcc[_0x5929('0x14')]['attributes']||null:null,'limit':_0x1d6fcc[_0x5929('0x14')]?_0x1d6fcc[_0x5929('0x14')][_0x5929('0x16')]||null:null,'include':_0x1d6fcc[_0x5929('0x14')]?_0x1d6fcc[_0x5929('0x14')][_0x5929('0x17')]?_[_0x5929('0x18')](_0x1d6fcc[_0x5929('0x14')][_0x5929('0x17')],function(_0x2418f0){return{'model':db[_0x2418f0['model']],'as':_0x2418f0['as'],'attributes':_0x2418f0[_0x5929('0x19')],'include':_0x2418f0[_0x5929('0x17')]?_[_0x5929('0x18')](_0x2418f0[_0x5929('0x17')],function(_0x3477ec){return{'model':db[_0x3477ec['model']],'as':_0x3477ec['as'],'attributes':_0x3477ec[_0x5929('0x19')],'include':_0x3477ec[_0x5929('0x17')]?_[_0x5929('0x18')](_0x3477ec[_0x5929('0x17')],function(_0x4707a0){return{'model':db[_0x4707a0['model']],'as':_0x4707a0['as'],'attributes':_0x4707a0[_0x5929('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5929('0x6')](function(_0x517fe6){logger['info'](_0x5929('0x12'),_0x1d6fcc);logger['debug'](_0x5929('0x12'),_0x1d6fcc,JSON[_0x5929('0xb')](_0x517fe6));_0x2d7ce3(_0x517fe6);})[_0x5929('0x11')](function(_0x59e2dd){logger[_0x5929('0xc')](_0x5929('0x12'),_0x59e2dd[_0x5929('0xe')],_0x1d6fcc);_0x2e581c(_0x4b8e7d[_0x5929('0xc')](0x1f4,_0x59e2dd[_0x5929('0xe')]));});});};exports[_0x5929('0x1a')]=function(_0x58dd99){var _0x132e22=this;return new Promise(function(_0x5ab170,_0x31358d){return db[_0x5929('0x13')][_0x5929('0x1b')]({'raw':_0x58dd99[_0x5929('0x14')]?_0x58dd99['options'][_0x5929('0x15')]===undefined?!![]:![]:!![],'where':_0x58dd99['options']?_0x58dd99[_0x5929('0x14')][_0x5929('0x1c')]||null:null,'attributes':_0x58dd99['options']?_0x58dd99['options']['attributes']||null:null,'include':_0x58dd99[_0x5929('0x14')]?_0x58dd99['options'][_0x5929('0x17')]?_[_0x5929('0x18')](_0x58dd99[_0x5929('0x14')][_0x5929('0x17')],function(_0x4fbc99){return{'model':db[_0x4fbc99[_0x5929('0x1d')]],'as':_0x4fbc99['as'],'attributes':_0x4fbc99[_0x5929('0x19')],'include':_0x4fbc99[_0x5929('0x17')]?_[_0x5929('0x18')](_0x4fbc99['include'],function(_0x484c7a){return{'model':db[_0x484c7a['model']],'as':_0x484c7a['as'],'attributes':_0x484c7a['attributes'],'include':_0x484c7a[_0x5929('0x17')]?_['map'](_0x484c7a[_0x5929('0x17')],function(_0x5c7838){return{'model':db[_0x5c7838[_0x5929('0x1d')]],'as':_0x5c7838['as'],'attributes':_0x5c7838[_0x5929('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5929('0x6')](function(_0x4e2dab){logger['info']('ShowZohoAccount',_0x58dd99);logger[_0x5929('0x8')](_0x5929('0x1a'),_0x58dd99,JSON['stringify'](_0x4e2dab));_0x5ab170(_0x4e2dab);})['catch'](function(_0x58ddde){logger[_0x5929('0xc')]('ShowZohoAccount',_0x58ddde[_0x5929('0xe')],_0x58dd99);_0x31358d(_0x132e22['error'](0x1f4,_0x58ddde[_0x5929('0xe')]));});});}; \ No newline at end of file +var _0xd296=['include','map','model','debug','stringify','ShowZohoAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message','info','catch','GetZohoAccount','ZohoAccount','options','raw','where','attributes'];(function(_0xcd7e33,_0x3a9279){var _0x5c2e7a=function(_0x2b9879){while(--_0x2b9879){_0xcd7e33['push'](_0xcd7e33['shift']());}};_0x5c2e7a(++_0x3a9279);}(_0xd296,0xa2));var _0x6d29=function(_0x23576d,_0x2432c7){_0x23576d=_0x23576d-0x0;var _0x144aff=_0xd296[_0x23576d];return _0x144aff;};'use strict';var _=require('lodash');var util=require(_0x6d29('0x0'));var moment=require('moment');var BPromise=require(_0x6d29('0x1'));var rs=require(_0x6d29('0x2'));var fs=require('fs');var Redis=require(_0x6d29('0x3'));var db=require(_0x6d29('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6d29('0x5'));var jayson=require(_0x6d29('0x6'));var client=jayson[_0x6d29('0x7')][_0x6d29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3eff79,_0x1acc83,_0x229ea4){return new BPromise(function(_0x205f9d,_0x2e225b){return client[_0x6d29('0x9')](_0x3eff79,_0x229ea4)[_0x6d29('0xa')](function(_0x4c5c55){logger['info'](_0x6d29('0xb'),_0x1acc83,_0x6d29('0xc'));logger['debug'](_0x6d29('0xd'),_0x1acc83,_0x6d29('0xc'),JSON['stringify'](_0x4c5c55));if(_0x4c5c55[_0x6d29('0xe')]){if(_0x4c5c55[_0x6d29('0xe')]['code']===0x1f4){logger[_0x6d29('0xe')](_0x6d29('0xb'),_0x1acc83,_0x4c5c55[_0x6d29('0xe')][_0x6d29('0xf')]);return _0x2e225b(_0x4c5c55[_0x6d29('0xe')][_0x6d29('0xf')]);}logger[_0x6d29('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x1acc83,_0x4c5c55[_0x6d29('0xe')]['message']);return _0x205f9d(_0x4c5c55[_0x6d29('0xe')][_0x6d29('0xf')]);}else{logger[_0x6d29('0x10')](_0x6d29('0xb'),_0x1acc83,_0x6d29('0xc'));_0x205f9d(_0x4c5c55['result']['message']);}})[_0x6d29('0x11')](function(_0x189e4d){logger[_0x6d29('0xe')](_0x6d29('0xb'),_0x1acc83,_0x189e4d);_0x2e225b(_0x189e4d);});});}exports[_0x6d29('0x12')]=function(_0x4745e1){var _0xf8bcee=this;return new Promise(function(_0x1885fd,_0xc5a641){return db[_0x6d29('0x13')]['findAll']({'raw':_0x4745e1[_0x6d29('0x14')]?_0x4745e1['options'][_0x6d29('0x15')]===undefined?!![]:![]:!![],'where':_0x4745e1[_0x6d29('0x14')]?_0x4745e1[_0x6d29('0x14')][_0x6d29('0x16')]||null:null,'attributes':_0x4745e1[_0x6d29('0x14')]?_0x4745e1[_0x6d29('0x14')][_0x6d29('0x17')]||null:null,'limit':_0x4745e1[_0x6d29('0x14')]?_0x4745e1[_0x6d29('0x14')]['limit']||null:null,'include':_0x4745e1[_0x6d29('0x14')]?_0x4745e1[_0x6d29('0x14')][_0x6d29('0x18')]?_[_0x6d29('0x19')](_0x4745e1[_0x6d29('0x14')][_0x6d29('0x18')],function(_0x258f70){return{'model':db[_0x258f70[_0x6d29('0x1a')]],'as':_0x258f70['as'],'attributes':_0x258f70[_0x6d29('0x17')],'include':_0x258f70[_0x6d29('0x18')]?_[_0x6d29('0x19')](_0x258f70[_0x6d29('0x18')],function(_0x3161f4){return{'model':db[_0x3161f4[_0x6d29('0x1a')]],'as':_0x3161f4['as'],'attributes':_0x3161f4[_0x6d29('0x17')],'include':_0x3161f4[_0x6d29('0x18')]?_['map'](_0x3161f4[_0x6d29('0x18')],function(_0x342a4f){return{'model':db[_0x342a4f[_0x6d29('0x1a')]],'as':_0x342a4f['as'],'attributes':_0x342a4f[_0x6d29('0x17')]};}):[]};}):[]};}):[]:[]})[_0x6d29('0xa')](function(_0x4ee0e4){logger[_0x6d29('0x10')]('GetZohoAccount',_0x4745e1);logger[_0x6d29('0x1b')](_0x6d29('0x12'),_0x4745e1,JSON[_0x6d29('0x1c')](_0x4ee0e4));_0x1885fd(_0x4ee0e4);})[_0x6d29('0x11')](function(_0x1dbdd5){logger[_0x6d29('0xe')](_0x6d29('0x12'),_0x1dbdd5['message'],_0x4745e1);_0xc5a641(_0xf8bcee[_0x6d29('0xe')](0x1f4,_0x1dbdd5['message']));});});};exports[_0x6d29('0x1d')]=function(_0xba7218){var _0x589a2f=this;return new Promise(function(_0x29dcd7,_0x3fdd1f){return db[_0x6d29('0x13')][_0x6d29('0x1e')]({'raw':_0xba7218[_0x6d29('0x14')]?_0xba7218[_0x6d29('0x14')][_0x6d29('0x15')]===undefined?!![]:![]:!![],'where':_0xba7218[_0x6d29('0x14')]?_0xba7218[_0x6d29('0x14')][_0x6d29('0x16')]||null:null,'attributes':_0xba7218['options']?_0xba7218[_0x6d29('0x14')][_0x6d29('0x17')]||null:null,'include':_0xba7218[_0x6d29('0x14')]?_0xba7218[_0x6d29('0x14')][_0x6d29('0x18')]?_['map'](_0xba7218[_0x6d29('0x14')][_0x6d29('0x18')],function(_0x464032){return{'model':db[_0x464032[_0x6d29('0x1a')]],'as':_0x464032['as'],'attributes':_0x464032['attributes'],'include':_0x464032[_0x6d29('0x18')]?_[_0x6d29('0x19')](_0x464032[_0x6d29('0x18')],function(_0x44ff2d){return{'model':db[_0x44ff2d['model']],'as':_0x44ff2d['as'],'attributes':_0x44ff2d[_0x6d29('0x17')],'include':_0x44ff2d[_0x6d29('0x18')]?_[_0x6d29('0x19')](_0x44ff2d[_0x6d29('0x18')],function(_0x169022){return{'model':db[_0x169022[_0x6d29('0x1a')]],'as':_0x169022['as'],'attributes':_0x169022[_0x6d29('0x17')]};}):[]};}):[]};}):[]:[]})[_0x6d29('0xa')](function(_0x69febd){logger['info'](_0x6d29('0x1d'),_0xba7218);logger['debug'](_0x6d29('0x1d'),_0xba7218,JSON[_0x6d29('0x1c')](_0x69febd));_0x29dcd7(_0x69febd);})[_0x6d29('0x11')](function(_0xc12897){logger[_0x6d29('0xe')](_0x6d29('0x1d'),_0xc12897[_0x6d29('0xf')],_0xba7218);_0x3fdd1f(_0x589a2f[_0x6d29('0xe')](0x1f4,_0xc12897[_0x6d29('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 7efe8a6..5b21262 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 _0x2e50=['get','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show'];(function(_0x4f7d08,_0x47b629){var _0x2bb656=function(_0x4b1b6d){while(--_0x4b1b6d){_0x4f7d08['push'](_0x4f7d08['shift']());}};_0x2bb656(++_0x47b629);}(_0x2e50,0x1c3));var _0x02e5=function(_0x209302,_0x5826ac){_0x209302=_0x209302-0x0;var _0x1df8e9=_0x2e50[_0x209302];return _0x1df8e9;};'use strict';var multer=require(_0x02e5('0x0'));var util=require(_0x02e5('0x1'));var path=require(_0x02e5('0x2'));var timeout=require('connect-timeout');var express=require(_0x02e5('0x3'));var router=express['Router']();var fs_extra=require(_0x02e5('0x4'));var auth=require(_0x02e5('0x5'));var interaction=require(_0x02e5('0x6'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router['get']('/',auth[_0x02e5('0x7')](),controller[_0x02e5('0x8')]);router['get'](_0x02e5('0x9'),auth['isAuthenticated'](),controller[_0x02e5('0xa')]);router[_0x02e5('0xb')]('/:id/fields',auth[_0x02e5('0x7')](),controller[_0x02e5('0xc')]);router[_0x02e5('0xb')]('/:id/subjects',auth[_0x02e5('0x7')](),controller[_0x02e5('0xd')]);router[_0x02e5('0xb')](_0x02e5('0xe'),auth[_0x02e5('0x7')](),controller[_0x02e5('0xf')]);router[_0x02e5('0x10')]('/',auth[_0x02e5('0x7')](),controller[_0x02e5('0x11')]);router[_0x02e5('0x12')](_0x02e5('0x9'),auth[_0x02e5('0x7')](),controller[_0x02e5('0x13')]);router['delete'](_0x02e5('0x9'),auth[_0x02e5('0x7')](),controller[_0x02e5('0x14')]);module[_0x02e5('0x15')]=router; \ No newline at end of file +var _0x76f6=['get','index','/:id','show','/:id/fields','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller'];(function(_0x29c4ac,_0x14fd35){var _0x479366=function(_0x64747a){while(--_0x64747a){_0x29c4ac['push'](_0x29c4ac['shift']());}};_0x479366(++_0x14fd35);}(_0x76f6,0x10a));var _0x676f=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x76f6[_0x2e4e19];return _0x9ba20b;};'use strict';var multer=require(_0x676f('0x0'));var util=require(_0x676f('0x1'));var path=require(_0x676f('0x2'));var timeout=require('connect-timeout');var express=require(_0x676f('0x3'));var router=express[_0x676f('0x4')]();var fs_extra=require(_0x676f('0x5'));var auth=require(_0x676f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x676f('0x7'));var controller=require(_0x676f('0x8'));router[_0x676f('0x9')]('/',auth['isAuthenticated'](),controller[_0x676f('0xa')]);router['get'](_0x676f('0xb'),auth['isAuthenticated'](),controller[_0x676f('0xc')]);router['get'](_0x676f('0xd'),auth['isAuthenticated'](),controller[_0x676f('0xe')]);router[_0x676f('0x9')](_0x676f('0xf'),auth[_0x676f('0x10')](),controller[_0x676f('0x11')]);router[_0x676f('0x9')](_0x676f('0x12'),auth[_0x676f('0x10')](),controller[_0x676f('0x13')]);router['post']('/',auth[_0x676f('0x10')](),controller[_0x676f('0x14')]);router[_0x676f('0x15')](_0x676f('0xb'),auth[_0x676f('0x10')](),controller[_0x676f('0x16')]);router['delete'](_0x676f('0xb'),auth[_0x676f('0x10')](),controller[_0x676f('0x17')]);module[_0x676f('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index b9c6ca2..8b4701e 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 _0xe80d=['sequelize','exports','STRING','ENUM','lead','nothing','contact_lead','contact'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xe80d,0x1d8));var _0xde80=function(_0x113696,_0x1843cc){_0x113696=_0x113696-0x0;var _0x1fb234=_0xe80d[_0x113696];return _0x1fb234;};'use strict';var Sequelize=require(_0xde80('0x0'));module[_0xde80('0x1')]={'name':{'type':Sequelize[_0xde80('0x2')]},'moduleCreate':{'type':Sequelize[_0xde80('0x3')](_0xde80('0x4'),'contact',_0xde80('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0xde80('0x6'),_0xde80('0x7'),_0xde80('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7668=['contact','nothing','ENUM','contact_lead','sequelize','exports','STRING','lead'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7668,0x19c));var _0x8766=function(_0x499e36,_0xc35951){_0x499e36=_0x499e36-0x0;var _0x95bf7b=_0x7668[_0x499e36];return _0x95bf7b;};'use strict';var Sequelize=require(_0x8766('0x0'));module[_0x8766('0x1')]={'name':{'type':Sequelize[_0x8766('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x8766('0x3'),_0x8766('0x4'),_0x8766('0x5')),'defaultValue':_0x8766('0x3')},'moduleSearch':{'type':Sequelize[_0x8766('0x6')](_0x8766('0x7'),'contact',_0x8766('0x3')),'defaultValue':_0x8766('0x7')},'description':{'type':Sequelize[_0x8766('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index c65aaba..bca6da8 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 _0xac73=['includeAll','include','findAll','catch','params','ZohoConfiguration','intersection','find','create','body','update','findOne','ZohoField','getFields','getSubjects','getDescriptions','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','stack','name','send','render','contact','agent','interaction','account','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0xfa847c,_0x444a8c){var _0x3b22bf=function(_0x32de11){while(--_0x32de11){_0xfa847c['push'](_0xfa847c['shift']());}};_0x3b22bf(++_0x444a8c);}(_0xac73,0x12d));var _0x3ac7=function(_0x3947f6,_0x59a2b1){_0x3947f6=_0x3947f6-0x0;var _0x23b285=_0xac73[_0x3947f6];return _0x23b285;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3ac7('0x0'));var rp=require('request-promise');var moment=require(_0x3ac7('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x3ac7('0x2'));var util=require(_0x3ac7('0x3'));var path=require(_0x3ac7('0x4'));var sox=require('sox');var csv=require(_0x3ac7('0x5'));var ejs=require(_0x3ac7('0x6'));var fs=require('fs');var fs_extra=require(_0x3ac7('0x7'));var _=require(_0x3ac7('0x8'));var squel=require(_0x3ac7('0x9'));var crypto=require(_0x3ac7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3ac7('0xb'));var toCsv=require(_0x3ac7('0x5'));var querystring=require(_0x3ac7('0xc'));var Papa=require(_0x3ac7('0xd'));var Redis=require(_0x3ac7('0xe'));var authService=require(_0x3ac7('0xf'));var qs=require(_0x3ac7('0x10'));var as=require(_0x3ac7('0x11'));var hardwareService=require(_0x3ac7('0x12'));var logger=require(_0x3ac7('0x13'))(_0x3ac7('0x14'));var utils=require(_0x3ac7('0x15'));var config=require(_0x3ac7('0x16'));var licenseUtil=require(_0x3ac7('0x17'));var db=require(_0x3ac7('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x3ac7('0x19')][_0x3ac7('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3ab98b,_0x27e7aa,_0x4fcc57,_0x8c7cd4){return new BPromise(function(_0x2fa24b,_0x1d2d36){var _0x48d463=_0x8c7cd4||client;return _0x48d463['request'](_0x3ab98b,_0x4fcc57)[_0x3ac7('0x1b')](function(_0x31bc88){logger['info'](_0x3ac7('0x1c'),_0x27e7aa,_0x3ac7('0x1d'));logger[_0x3ac7('0x1e')](_0x3ac7('0x1f'),_0x27e7aa,'request\x20sent',JSON['stringify'](_0x31bc88));if(_0x31bc88['error']){if(_0x31bc88[_0x3ac7('0x20')][_0x3ac7('0x21')]===0x1f4){logger[_0x3ac7('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x27e7aa,_0x31bc88['error'][_0x3ac7('0x22')]);return _0x1d2d36(_0x31bc88[_0x3ac7('0x20')][_0x3ac7('0x22')]);}logger[_0x3ac7('0x20')](_0x3ac7('0x1c'),_0x27e7aa,_0x31bc88['error'][_0x3ac7('0x22')]);return _0x2fa24b(_0x31bc88[_0x3ac7('0x20')][_0x3ac7('0x22')]);}else{logger[_0x3ac7('0x23')](_0x3ac7('0x1c'),_0x27e7aa,_0x3ac7('0x1d'));_0x2fa24b(_0x31bc88[_0x3ac7('0x24')][_0x3ac7('0x22')]);}})['catch'](function(_0x384c03){logger[_0x3ac7('0x20')](_0x3ac7('0x1c'),_0x27e7aa,_0x384c03);_0x1d2d36(_0x384c03);});});}function respondWithStatusCode(_0x4f11b0,_0x2fe008){_0x2fe008=_0x2fe008||0xcc;return function(_0x85b479){if(_0x85b479){return _0x4f11b0[_0x3ac7('0x25')](_0x2fe008);}return _0x4f11b0['status'](_0x2fe008)[_0x3ac7('0x26')]();};}function respondWithResult(_0x551426,_0x21e212){_0x21e212=_0x21e212||0xc8;return function(_0x30e25a){if(_0x30e25a){return _0x551426[_0x3ac7('0x27')](_0x21e212)[_0x3ac7('0x28')](_0x30e25a);}};}function respondWithFilteredResult(_0x15972e,_0x4324fa){return function(_0x9c1819){if(_0x9c1819){var _0xb22aa5=typeof _0x4324fa[_0x3ac7('0x29')]===_0x3ac7('0x2a')&&typeof _0x4324fa['limit']==='undefined';var _0x5e4926=_0x9c1819[_0x3ac7('0x2b')];var _0x3cb9de=_0xb22aa5?0x0:_0x4324fa[_0x3ac7('0x29')];var _0x4205e0=_0xb22aa5?_0x9c1819[_0x3ac7('0x2b')]:_0x4324fa[_0x3ac7('0x29')]+_0x4324fa[_0x3ac7('0x2c')];var _0x5081fd;if(_0x4205e0>=_0x5e4926){_0x4205e0=_0x5e4926;_0x5081fd=0xc8;}else{_0x5081fd=0xce;}_0x15972e['status'](_0x5081fd);return _0x15972e[_0x3ac7('0x2d')](_0x3ac7('0x2e'),_0x3cb9de+'-'+_0x4205e0+'/'+_0x5e4926)['json'](_0x9c1819);}return null;};}function patchUpdates(_0x4ebbe8){return function(_0x36d7d6){try{jsonpatch['apply'](_0x36d7d6,_0x4ebbe8,!![]);}catch(_0x27606e){return BPromise[_0x3ac7('0x2f')](_0x27606e);}return _0x36d7d6[_0x3ac7('0x30')]();};}function saveUpdates(_0x29b5bd,_0x3b90c8){return function(_0x1563e3){if(_0x1563e3){return _0x1563e3['update'](_0x29b5bd)['then'](function(_0xc859f8){return _0xc859f8;});}return null;};}function removeEntity(_0x46af96,_0x305f49){return function(_0xf3e16d){if(_0xf3e16d){return _0xf3e16d[_0x3ac7('0x31')]()['then'](function(){_0x46af96[_0x3ac7('0x27')](0xcc)[_0x3ac7('0x26')]();});}};}function handleEntityNotFound(_0x4f9a15,_0x308617){return function(_0x4321ab){if(!_0x4321ab){_0x4f9a15[_0x3ac7('0x25')](0x194);}return _0x4321ab;};}function handleError(_0x409a5d,_0x3d43f0){_0x3d43f0=_0x3d43f0||0x1f4;return function(_0x18f064){logger['error'](_0x18f064[_0x3ac7('0x32')]);if(_0x18f064[_0x3ac7('0x33')]){delete _0x18f064[_0x3ac7('0x33')];}_0x409a5d[_0x3ac7('0x27')](_0x3d43f0)[_0x3ac7('0x34')](_0x18f064);};}function getMustacheRender(_0x1f15fb,_0xdc5c8f){return Mustache[_0x3ac7('0x35')](_0x1f15fb,_['merge'](_0xdc5c8f['body'],{'contact':_0xdc5c8f[_0x3ac7('0x36')],'message':_0xdc5c8f['message'],'agent':_0xdc5c8f[_0x3ac7('0x37')],'interaction':_0xdc5c8f[_0x3ac7('0x38')],'account':_0xdc5c8f[_0x3ac7('0x39')]}))||'';}exports['index']=function(_0x5e6545,_0x262909){var _0x3054b3={},_0x36e158={},_0x93f273={'count':0x0,'rows':[]};var _0x28eeac=_['map'](db['ZohoConfiguration'][_0x3ac7('0x3a')],function(_0x48bf68){return{'name':_0x48bf68[_0x3ac7('0x3b')],'type':_0x48bf68[_0x3ac7('0x3c')]['key']};});_0x36e158[_0x3ac7('0x3d')]=_[_0x3ac7('0x3e')](_0x28eeac,'name');_0x36e158['query']=_[_0x3ac7('0x3f')](_0x5e6545[_0x3ac7('0x40')]);_0x36e158[_0x3ac7('0x41')]=_['intersection'](_0x36e158[_0x3ac7('0x3d')],_0x36e158[_0x3ac7('0x40')]);_0x3054b3[_0x3ac7('0x42')]=_['intersection'](_0x36e158[_0x3ac7('0x3d')],qs[_0x3ac7('0x43')](_0x5e6545[_0x3ac7('0x40')][_0x3ac7('0x43')]));_0x3054b3['attributes']=_0x3054b3['attributes'][_0x3ac7('0x44')]?_0x3054b3['attributes']:_0x36e158[_0x3ac7('0x3d')];if(!_0x5e6545[_0x3ac7('0x40')][_0x3ac7('0x45')](_0x3ac7('0x46'))){_0x3054b3[_0x3ac7('0x2c')]=qs[_0x3ac7('0x2c')](_0x5e6545[_0x3ac7('0x40')][_0x3ac7('0x2c')]);_0x3054b3['offset']=qs[_0x3ac7('0x29')](_0x5e6545[_0x3ac7('0x40')][_0x3ac7('0x29')]);}_0x3054b3[_0x3ac7('0x47')]=qs[_0x3ac7('0x48')](_0x5e6545[_0x3ac7('0x40')]['sort']);_0x3054b3[_0x3ac7('0x49')]=qs[_0x3ac7('0x41')](_[_0x3ac7('0x4a')](_0x5e6545['query'],_0x36e158[_0x3ac7('0x41')]),_0x28eeac);if(_0x5e6545[_0x3ac7('0x40')]['filter']){_0x3054b3[_0x3ac7('0x49')]=_[_0x3ac7('0x4b')](_0x3054b3[_0x3ac7('0x49')],{'$or':_['map'](_0x28eeac,function(_0xa66db1){if(_0xa66db1['type']!==_0x3ac7('0x4c')){var _0x16190d={};_0x16190d[_0xa66db1[_0x3ac7('0x33')]]={'$like':'%'+_0x5e6545[_0x3ac7('0x40')][_0x3ac7('0x4d')]+'%'};return _0x16190d;}})});}_0x3054b3=_[_0x3ac7('0x4b')]({},_0x3054b3,_0x5e6545[_0x3ac7('0x4e')]);var _0x10de90={'where':_0x3054b3['where']};return db['ZohoConfiguration']['count'](_0x10de90)[_0x3ac7('0x1b')](function(_0x34a9db){_0x93f273[_0x3ac7('0x2b')]=_0x34a9db;if(_0x5e6545['query'][_0x3ac7('0x4f')]){_0x3054b3[_0x3ac7('0x50')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x3ac7('0x51')](_0x3054b3);})[_0x3ac7('0x1b')](function(_0x4806b7){_0x93f273['rows']=_0x4806b7;return _0x93f273;})['then'](respondWithFilteredResult(_0x262909,_0x3054b3))[_0x3ac7('0x52')](handleError(_0x262909,null));};exports['show']=function(_0x67536e,_0x3e0c8c){var _0x1474af={'raw':![],'where':{'id':_0x67536e[_0x3ac7('0x53')]['id']}},_0x45fdbe={};_0x45fdbe['model']=_['keys'](db[_0x3ac7('0x54')][_0x3ac7('0x3a')]);_0x45fdbe['query']=_[_0x3ac7('0x3f')](_0x67536e[_0x3ac7('0x40')]);_0x45fdbe[_0x3ac7('0x41')]=_[_0x3ac7('0x55')](_0x45fdbe[_0x3ac7('0x3d')],_0x45fdbe['query']);_0x1474af[_0x3ac7('0x42')]=_[_0x3ac7('0x55')](_0x45fdbe['model'],qs[_0x3ac7('0x43')](_0x67536e[_0x3ac7('0x40')]['fields']));_0x1474af[_0x3ac7('0x42')]=_0x1474af[_0x3ac7('0x42')][_0x3ac7('0x44')]?_0x1474af['attributes']:_0x45fdbe[_0x3ac7('0x3d')];if(_0x67536e[_0x3ac7('0x40')]['includeAll']){_0x1474af[_0x3ac7('0x50')]=[{'all':!![]}];}_0x1474af=_[_0x3ac7('0x4b')]({},_0x1474af,_0x67536e[_0x3ac7('0x4e')]);return db[_0x3ac7('0x54')][_0x3ac7('0x56')](_0x1474af)[_0x3ac7('0x1b')](handleEntityNotFound(_0x3e0c8c,null))['then'](respondWithResult(_0x3e0c8c,null))[_0x3ac7('0x52')](handleError(_0x3e0c8c,null));};exports[_0x3ac7('0x57')]=function(_0x2b42d0,_0x5f327f){return db['ZohoConfiguration'][_0x3ac7('0x57')](_0x2b42d0[_0x3ac7('0x58')],{})[_0x3ac7('0x1b')](respondWithResult(_0x5f327f,0xc9))[_0x3ac7('0x52')](handleError(_0x5f327f,null));};exports[_0x3ac7('0x59')]=function(_0x170bdc,_0xe275a1){if(_0x170bdc[_0x3ac7('0x58')]['id']){delete _0x170bdc[_0x3ac7('0x58')]['id'];}return db[_0x3ac7('0x54')][_0x3ac7('0x56')]({'where':{'id':_0x170bdc[_0x3ac7('0x53')]['id']}})[_0x3ac7('0x1b')](handleEntityNotFound(_0xe275a1,null))[_0x3ac7('0x1b')](saveUpdates(_0x170bdc[_0x3ac7('0x58')],null))[_0x3ac7('0x1b')](respondWithResult(_0xe275a1,null))[_0x3ac7('0x52')](handleError(_0xe275a1,null));};exports[_0x3ac7('0x31')]=function(_0x5154f3,_0x2c9b20){return db[_0x3ac7('0x54')]['find']({'where':{'id':_0x5154f3['params']['id']}})[_0x3ac7('0x1b')](handleEntityNotFound(_0x2c9b20,null))['then'](removeEntity(_0x2c9b20,null))['catch'](handleError(_0x2c9b20,null));};exports['getFields']=function(_0x2a3f21,_0x41f1fe,_0x4450ae){var _0x19c557={};var _0x2563a5={};var _0xd95d70;var _0x3ee6f6;return db[_0x3ac7('0x54')][_0x3ac7('0x5a')]({'where':{'id':_0x2a3f21[_0x3ac7('0x53')]['id']}})[_0x3ac7('0x1b')](handleEntityNotFound(_0x41f1fe,null))[_0x3ac7('0x1b')](function(_0x3a25c6){if(_0x3a25c6){_0xd95d70=_0x3a25c6;_0x2563a5[_0x3ac7('0x3d')]=_[_0x3ac7('0x3f')](db[_0x3ac7('0x5b')]['rawAttributes']);_0x2563a5[_0x3ac7('0x40')]=_['keys'](_0x2a3f21[_0x3ac7('0x40')]);_0x2563a5[_0x3ac7('0x41')]=_[_0x3ac7('0x55')](_0x2563a5['model'],_0x2563a5[_0x3ac7('0x40')]);_0x19c557[_0x3ac7('0x42')]=_[_0x3ac7('0x55')](_0x2563a5[_0x3ac7('0x3d')],qs[_0x3ac7('0x43')](_0x2a3f21[_0x3ac7('0x40')][_0x3ac7('0x43')]));_0x19c557['attributes']=_0x19c557[_0x3ac7('0x42')][_0x3ac7('0x44')]?_0x19c557[_0x3ac7('0x42')]:_0x2563a5[_0x3ac7('0x3d')];_0x19c557[_0x3ac7('0x47')]=qs[_0x3ac7('0x48')](_0x2a3f21['query'][_0x3ac7('0x48')]);_0x19c557['where']=qs[_0x3ac7('0x41')](_[_0x3ac7('0x4a')](_0x2a3f21[_0x3ac7('0x40')],_0x2563a5[_0x3ac7('0x41')]));if(_0x2a3f21[_0x3ac7('0x40')]['filter']){_0x19c557['where']=_[_0x3ac7('0x4b')](_0x19c557['where'],{'$or':_['map'](_0x19c557[_0x3ac7('0x42')],function(_0x4891cd){var _0x43fd84={};_0x43fd84[_0x4891cd]={'$like':'%'+_0x2a3f21[_0x3ac7('0x40')][_0x3ac7('0x4d')]+'%'};return _0x43fd84;})});}_0x19c557=_['merge']({},_0x19c557,_0x2a3f21['options']);return _0xd95d70[_0x3ac7('0x5c')](_0x19c557);}})[_0x3ac7('0x1b')](function(_0x49037d){if(_0x49037d){_0x3ee6f6=_0x49037d[_0x3ac7('0x44')];if(!_0x2a3f21[_0x3ac7('0x40')]['hasOwnProperty'](_0x3ac7('0x46'))){_0x19c557[_0x3ac7('0x2c')]=qs[_0x3ac7('0x2c')](_0x2a3f21[_0x3ac7('0x40')]['limit']);_0x19c557[_0x3ac7('0x29')]=qs[_0x3ac7('0x29')](_0x2a3f21[_0x3ac7('0x40')][_0x3ac7('0x29')]);}return _0xd95d70['getFields'](_0x19c557);}})['then'](function(_0x8d808c){if(_0x8d808c){return _0x8d808c?{'count':_0x3ee6f6,'rows':_0x8d808c}:null;}})[_0x3ac7('0x1b')](respondWithResult(_0x41f1fe,null))[_0x3ac7('0x52')](handleError(_0x41f1fe,null));};exports[_0x3ac7('0x5d')]=function(_0x5f163a,_0x291c81,_0x2b03d4){var _0x49d1b8={};var _0x369b47={};var _0xcb3d50;var _0x2f0fff;return db[_0x3ac7('0x54')][_0x3ac7('0x5a')]({'where':{'id':_0x5f163a['params']['id']}})[_0x3ac7('0x1b')](handleEntityNotFound(_0x291c81,null))[_0x3ac7('0x1b')](function(_0x25b5b3){if(_0x25b5b3){_0xcb3d50=_0x25b5b3;_0x369b47[_0x3ac7('0x3d')]=_[_0x3ac7('0x3f')](db[_0x3ac7('0x5b')][_0x3ac7('0x3a')]);_0x369b47['query']=_['keys'](_0x5f163a['query']);_0x369b47[_0x3ac7('0x41')]=_['intersection'](_0x369b47['model'],_0x369b47[_0x3ac7('0x40')]);_0x49d1b8['attributes']=_['intersection'](_0x369b47[_0x3ac7('0x3d')],qs[_0x3ac7('0x43')](_0x5f163a[_0x3ac7('0x40')][_0x3ac7('0x43')]));_0x49d1b8[_0x3ac7('0x42')]=_0x49d1b8[_0x3ac7('0x42')][_0x3ac7('0x44')]?_0x49d1b8[_0x3ac7('0x42')]:_0x369b47[_0x3ac7('0x3d')];_0x49d1b8[_0x3ac7('0x47')]=qs[_0x3ac7('0x48')](_0x5f163a[_0x3ac7('0x40')][_0x3ac7('0x48')]);_0x49d1b8['where']=qs[_0x3ac7('0x41')](_['pick'](_0x5f163a['query'],_0x369b47[_0x3ac7('0x41')]));if(_0x5f163a['query'][_0x3ac7('0x4d')]){_0x49d1b8[_0x3ac7('0x49')]=_[_0x3ac7('0x4b')](_0x49d1b8['where'],{'$or':_[_0x3ac7('0x3e')](_0x49d1b8[_0x3ac7('0x42')],function(_0x26b269){var _0x2592b4={};_0x2592b4[_0x26b269]={'$like':'%'+_0x5f163a[_0x3ac7('0x40')][_0x3ac7('0x4d')]+'%'};return _0x2592b4;})});}_0x49d1b8=_[_0x3ac7('0x4b')]({},_0x49d1b8,_0x5f163a[_0x3ac7('0x4e')]);return _0xcb3d50[_0x3ac7('0x5d')](_0x49d1b8);}})[_0x3ac7('0x1b')](function(_0x5f3337){if(_0x5f3337){_0x2f0fff=_0x5f3337[_0x3ac7('0x44')];if(!_0x5f163a[_0x3ac7('0x40')][_0x3ac7('0x45')](_0x3ac7('0x46'))){_0x49d1b8[_0x3ac7('0x2c')]=qs[_0x3ac7('0x2c')](_0x5f163a['query'][_0x3ac7('0x2c')]);_0x49d1b8['offset']=qs[_0x3ac7('0x29')](_0x5f163a[_0x3ac7('0x40')][_0x3ac7('0x29')]);}return _0xcb3d50[_0x3ac7('0x5d')](_0x49d1b8);}})[_0x3ac7('0x1b')](function(_0x4c299a){if(_0x4c299a){return _0x4c299a?{'count':_0x2f0fff,'rows':_0x4c299a}:null;}})[_0x3ac7('0x1b')](respondWithResult(_0x291c81,null))[_0x3ac7('0x52')](handleError(_0x291c81,null));};exports[_0x3ac7('0x5e')]=function(_0x1671f2,_0x49d6f2,_0x47e725){var _0x5e083d={};var _0x42744d={};var _0x58e765;var _0x56bf9b;return db['ZohoConfiguration'][_0x3ac7('0x5a')]({'where':{'id':_0x1671f2[_0x3ac7('0x53')]['id']}})[_0x3ac7('0x1b')](handleEntityNotFound(_0x49d6f2,null))[_0x3ac7('0x1b')](function(_0x3ca058){if(_0x3ca058){_0x58e765=_0x3ca058;_0x42744d['model']=_[_0x3ac7('0x3f')](db['ZohoField']['rawAttributes']);_0x42744d[_0x3ac7('0x40')]=_[_0x3ac7('0x3f')](_0x1671f2[_0x3ac7('0x40')]);_0x42744d[_0x3ac7('0x41')]=_['intersection'](_0x42744d[_0x3ac7('0x3d')],_0x42744d['query']);_0x5e083d[_0x3ac7('0x42')]=_[_0x3ac7('0x55')](_0x42744d[_0x3ac7('0x3d')],qs[_0x3ac7('0x43')](_0x1671f2[_0x3ac7('0x40')][_0x3ac7('0x43')]));_0x5e083d[_0x3ac7('0x42')]=_0x5e083d[_0x3ac7('0x42')][_0x3ac7('0x44')]?_0x5e083d[_0x3ac7('0x42')]:_0x42744d[_0x3ac7('0x3d')];_0x5e083d[_0x3ac7('0x47')]=qs[_0x3ac7('0x48')](_0x1671f2[_0x3ac7('0x40')]['sort']);_0x5e083d[_0x3ac7('0x49')]=qs[_0x3ac7('0x41')](_[_0x3ac7('0x4a')](_0x1671f2[_0x3ac7('0x40')],_0x42744d[_0x3ac7('0x41')]));if(_0x1671f2[_0x3ac7('0x40')][_0x3ac7('0x4d')]){_0x5e083d['where']=_[_0x3ac7('0x4b')](_0x5e083d[_0x3ac7('0x49')],{'$or':_[_0x3ac7('0x3e')](_0x5e083d['attributes'],function(_0x344fef){var _0x5219f9={};_0x5219f9[_0x344fef]={'$like':'%'+_0x1671f2[_0x3ac7('0x40')][_0x3ac7('0x4d')]+'%'};return _0x5219f9;})});}_0x5e083d=_[_0x3ac7('0x4b')]({},_0x5e083d,_0x1671f2['options']);return _0x58e765['getDescriptions'](_0x5e083d);}})[_0x3ac7('0x1b')](function(_0x2701c7){if(_0x2701c7){_0x56bf9b=_0x2701c7['length'];if(!_0x1671f2['query']['hasOwnProperty'](_0x3ac7('0x46'))){_0x5e083d[_0x3ac7('0x2c')]=qs[_0x3ac7('0x2c')](_0x1671f2[_0x3ac7('0x40')][_0x3ac7('0x2c')]);_0x5e083d['offset']=qs[_0x3ac7('0x29')](_0x1671f2[_0x3ac7('0x40')]['offset']);}return _0x58e765[_0x3ac7('0x5e')](_0x5e083d);}})[_0x3ac7('0x1b')](function(_0x1ff636){if(_0x1ff636){return _0x1ff636?{'count':_0x56bf9b,'rows':_0x1ff636}:null;}})[_0x3ac7('0x1b')](respondWithResult(_0x49d6f2,null))[_0x3ac7('0x52')](handleError(_0x49d6f2,null));}; \ No newline at end of file +var _0x537f=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','limit','offset','count','set','Content-Range','apply','reject','save','update','stack','name','send','render','body','contact','agent','interaction','account','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','ZohoConfiguration','include','rows','show','params','includeAll','find','destroy','getFields','findOne','ZohoField','pick','filter','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','crypto','desk.js'];(function(_0xef225b,_0x3f5a0d){var _0x251195=function(_0x96456d){while(--_0x96456d){_0xef225b['push'](_0xef225b['shift']());}};_0x251195(++_0x3f5a0d);}(_0x537f,0x1c5));var _0xf537=function(_0x660c48,_0x150b0a){_0x660c48=_0x660c48-0x0;var _0xdc5e90=_0x537f[_0x660c48];return _0xdc5e90;};'use strict';var emlformat=require(_0xf537('0x0'));var rimraf=require(_0xf537('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf537('0x2'));var rp=require(_0xf537('0x3'));var moment=require(_0xf537('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf537('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf537('0x6'));var csv=require(_0xf537('0x7'));var ejs=require(_0xf537('0x8'));var fs=require('fs');var fs_extra=require(_0xf537('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf537('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf537('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf537('0xc'));var Papa=require('papaparse');var Redis=require(_0xf537('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf537('0xe'));var as=require(_0xf537('0xf'));var hardwareService=require(_0xf537('0x10'));var logger=require(_0xf537('0x11'))('api');var utils=require(_0xf537('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf537('0x13'))['db'];var jayson=require(_0xf537('0x14'));var client=jayson[_0xf537('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb8bcc4,_0x466308,_0x21da0e,_0x18c63d){return new BPromise(function(_0x49be48,_0x242f2b){var _0x297811=_0x18c63d||client;return _0x297811[_0xf537('0x16')](_0xb8bcc4,_0x21da0e)[_0xf537('0x17')](function(_0x2db86a){logger[_0xf537('0x18')](_0xf537('0x19'),_0x466308,_0xf537('0x1a'));logger[_0xf537('0x1b')](_0xf537('0x1c'),_0x466308,_0xf537('0x1a'),JSON[_0xf537('0x1d')](_0x2db86a));if(_0x2db86a['error']){if(_0x2db86a[_0xf537('0x1e')][_0xf537('0x1f')]===0x1f4){logger[_0xf537('0x1e')](_0xf537('0x19'),_0x466308,_0x2db86a[_0xf537('0x1e')][_0xf537('0x20')]);return _0x242f2b(_0x2db86a[_0xf537('0x1e')][_0xf537('0x20')]);}logger[_0xf537('0x1e')](_0xf537('0x19'),_0x466308,_0x2db86a[_0xf537('0x1e')][_0xf537('0x20')]);return _0x49be48(_0x2db86a['error'][_0xf537('0x20')]);}else{logger[_0xf537('0x18')](_0xf537('0x19'),_0x466308,_0xf537('0x1a'));_0x49be48(_0x2db86a['result'][_0xf537('0x20')]);}})[_0xf537('0x21')](function(_0x1bd9f6){logger[_0xf537('0x1e')](_0xf537('0x19'),_0x466308,_0x1bd9f6);_0x242f2b(_0x1bd9f6);});});}function respondWithStatusCode(_0x458588,_0x4801cd){_0x4801cd=_0x4801cd||0xcc;return function(_0x453287){if(_0x453287){return _0x458588[_0xf537('0x22')](_0x4801cd);}return _0x458588['status'](_0x4801cd)[_0xf537('0x23')]();};}function respondWithResult(_0x30f7c9,_0x7b7a0){_0x7b7a0=_0x7b7a0||0xc8;return function(_0x557116){if(_0x557116){return _0x30f7c9[_0xf537('0x24')](_0x7b7a0)[_0xf537('0x25')](_0x557116);}};}function respondWithFilteredResult(_0x429b3b,_0x6697e2){return function(_0x5bedde){if(_0x5bedde){var _0x10638d=typeof _0x6697e2['offset']==='undefined'&&typeof _0x6697e2[_0xf537('0x26')]==='undefined';var _0x332d29=_0x5bedde['count'];var _0x24740b=_0x10638d?0x0:_0x6697e2[_0xf537('0x27')];var _0x349a3a=_0x10638d?_0x5bedde[_0xf537('0x28')]:_0x6697e2[_0xf537('0x27')]+_0x6697e2['limit'];var _0x2ce240;if(_0x349a3a>=_0x332d29){_0x349a3a=_0x332d29;_0x2ce240=0xc8;}else{_0x2ce240=0xce;}_0x429b3b[_0xf537('0x24')](_0x2ce240);return _0x429b3b[_0xf537('0x29')](_0xf537('0x2a'),_0x24740b+'-'+_0x349a3a+'/'+_0x332d29)[_0xf537('0x25')](_0x5bedde);}return null;};}function patchUpdates(_0x2d6a57){return function(_0x2ccadd){try{jsonpatch[_0xf537('0x2b')](_0x2ccadd,_0x2d6a57,!![]);}catch(_0x4f8203){return BPromise[_0xf537('0x2c')](_0x4f8203);}return _0x2ccadd[_0xf537('0x2d')]();};}function saveUpdates(_0x3a30fe,_0x1b12db){return function(_0x1555d4){if(_0x1555d4){return _0x1555d4[_0xf537('0x2e')](_0x3a30fe)[_0xf537('0x17')](function(_0x444cbe){return _0x444cbe;});}return null;};}function removeEntity(_0x51981c,_0xeea127){return function(_0xcb28e1){if(_0xcb28e1){return _0xcb28e1['destroy']()[_0xf537('0x17')](function(){_0x51981c[_0xf537('0x24')](0xcc)[_0xf537('0x23')]();});}};}function handleEntityNotFound(_0x5281d8,_0x8595d){return function(_0x93e308){if(!_0x93e308){_0x5281d8[_0xf537('0x22')](0x194);}return _0x93e308;};}function handleError(_0x1d949e,_0x3d025d){_0x3d025d=_0x3d025d||0x1f4;return function(_0x3024c9){logger['error'](_0x3024c9[_0xf537('0x2f')]);if(_0x3024c9[_0xf537('0x30')]){delete _0x3024c9['name'];}_0x1d949e['status'](_0x3d025d)[_0xf537('0x31')](_0x3024c9);};}function getMustacheRender(_0x259dfc,_0x5e8e88){return Mustache[_0xf537('0x32')](_0x259dfc,_['merge'](_0x5e8e88[_0xf537('0x33')],{'contact':_0x5e8e88[_0xf537('0x34')],'message':_0x5e8e88[_0xf537('0x20')],'agent':_0x5e8e88[_0xf537('0x35')],'interaction':_0x5e8e88[_0xf537('0x36')],'account':_0x5e8e88[_0xf537('0x37')]}))||'';}exports[_0xf537('0x38')]=function(_0x40b8fe,_0x3f0193){var _0x5a5fd5={},_0x297250={},_0x433853={'count':0x0,'rows':[]};var _0x5c95e1=_['map'](db['ZohoConfiguration'][_0xf537('0x39')],function(_0x10adb0){return{'name':_0x10adb0[_0xf537('0x3a')],'type':_0x10adb0[_0xf537('0x3b')][_0xf537('0x3c')]};});_0x297250[_0xf537('0x3d')]=_[_0xf537('0x3e')](_0x5c95e1,_0xf537('0x30'));_0x297250[_0xf537('0x3f')]=_[_0xf537('0x40')](_0x40b8fe[_0xf537('0x3f')]);_0x297250[_0xf537('0x41')]=_[_0xf537('0x42')](_0x297250[_0xf537('0x3d')],_0x297250[_0xf537('0x3f')]);_0x5a5fd5['attributes']=_[_0xf537('0x42')](_0x297250[_0xf537('0x3d')],qs[_0xf537('0x43')](_0x40b8fe['query'][_0xf537('0x43')]));_0x5a5fd5['attributes']=_0x5a5fd5[_0xf537('0x44')][_0xf537('0x45')]?_0x5a5fd5[_0xf537('0x44')]:_0x297250[_0xf537('0x3d')];if(!_0x40b8fe[_0xf537('0x3f')][_0xf537('0x46')]('nolimit')){_0x5a5fd5[_0xf537('0x26')]=qs[_0xf537('0x26')](_0x40b8fe[_0xf537('0x3f')][_0xf537('0x26')]);_0x5a5fd5['offset']=qs[_0xf537('0x27')](_0x40b8fe[_0xf537('0x3f')][_0xf537('0x27')]);}_0x5a5fd5[_0xf537('0x47')]=qs[_0xf537('0x48')](_0x40b8fe['query'][_0xf537('0x48')]);_0x5a5fd5[_0xf537('0x49')]=qs[_0xf537('0x41')](_['pick'](_0x40b8fe['query'],_0x297250[_0xf537('0x41')]),_0x5c95e1);if(_0x40b8fe['query']['filter']){_0x5a5fd5[_0xf537('0x49')]=_[_0xf537('0x4a')](_0x5a5fd5[_0xf537('0x49')],{'$or':_[_0xf537('0x3e')](_0x5c95e1,function(_0x541d4b){if(_0x541d4b['type']!==_0xf537('0x4b')){var _0x2847d5={};_0x2847d5[_0x541d4b[_0xf537('0x30')]]={'$like':'%'+_0x40b8fe[_0xf537('0x3f')]['filter']+'%'};return _0x2847d5;}})});}_0x5a5fd5=_[_0xf537('0x4a')]({},_0x5a5fd5,_0x40b8fe[_0xf537('0x4c')]);var _0x71197b={'where':_0x5a5fd5['where']};return db[_0xf537('0x4d')]['count'](_0x71197b)[_0xf537('0x17')](function(_0x546b87){_0x433853[_0xf537('0x28')]=_0x546b87;if(_0x40b8fe[_0xf537('0x3f')]['includeAll']){_0x5a5fd5[_0xf537('0x4e')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x5a5fd5);})[_0xf537('0x17')](function(_0x715852){_0x433853[_0xf537('0x4f')]=_0x715852;return _0x433853;})[_0xf537('0x17')](respondWithFilteredResult(_0x3f0193,_0x5a5fd5))['catch'](handleError(_0x3f0193,null));};exports[_0xf537('0x50')]=function(_0x47d7e0,_0x441f89){var _0x3e959a={'raw':![],'where':{'id':_0x47d7e0[_0xf537('0x51')]['id']}},_0x73372a={};_0x73372a[_0xf537('0x3d')]=_[_0xf537('0x40')](db[_0xf537('0x4d')]['rawAttributes']);_0x73372a[_0xf537('0x3f')]=_[_0xf537('0x40')](_0x47d7e0[_0xf537('0x3f')]);_0x73372a[_0xf537('0x41')]=_['intersection'](_0x73372a[_0xf537('0x3d')],_0x73372a[_0xf537('0x3f')]);_0x3e959a[_0xf537('0x44')]=_['intersection'](_0x73372a[_0xf537('0x3d')],qs[_0xf537('0x43')](_0x47d7e0[_0xf537('0x3f')][_0xf537('0x43')]));_0x3e959a[_0xf537('0x44')]=_0x3e959a[_0xf537('0x44')][_0xf537('0x45')]?_0x3e959a[_0xf537('0x44')]:_0x73372a['model'];if(_0x47d7e0[_0xf537('0x3f')][_0xf537('0x52')]){_0x3e959a[_0xf537('0x4e')]=[{'all':!![]}];}_0x3e959a=_[_0xf537('0x4a')]({},_0x3e959a,_0x47d7e0[_0xf537('0x4c')]);return db[_0xf537('0x4d')]['find'](_0x3e959a)['then'](handleEntityNotFound(_0x441f89,null))[_0xf537('0x17')](respondWithResult(_0x441f89,null))[_0xf537('0x21')](handleError(_0x441f89,null));};exports['create']=function(_0x13cd4a,_0x237a58){return db['ZohoConfiguration']['create'](_0x13cd4a[_0xf537('0x33')],{})[_0xf537('0x17')](respondWithResult(_0x237a58,0xc9))['catch'](handleError(_0x237a58,null));};exports['update']=function(_0x554943,_0x45ff9c){if(_0x554943[_0xf537('0x33')]['id']){delete _0x554943[_0xf537('0x33')]['id'];}return db[_0xf537('0x4d')][_0xf537('0x53')]({'where':{'id':_0x554943[_0xf537('0x51')]['id']}})[_0xf537('0x17')](handleEntityNotFound(_0x45ff9c,null))[_0xf537('0x17')](saveUpdates(_0x554943[_0xf537('0x33')],null))[_0xf537('0x17')](respondWithResult(_0x45ff9c,null))[_0xf537('0x21')](handleError(_0x45ff9c,null));};exports[_0xf537('0x54')]=function(_0x5b4952,_0x309fcb){return db[_0xf537('0x4d')][_0xf537('0x53')]({'where':{'id':_0x5b4952[_0xf537('0x51')]['id']}})[_0xf537('0x17')](handleEntityNotFound(_0x309fcb,null))['then'](removeEntity(_0x309fcb,null))[_0xf537('0x21')](handleError(_0x309fcb,null));};exports[_0xf537('0x55')]=function(_0x2c0f01,_0x6b7cf2,_0x3061bb){var _0xa35dd1={};var _0x5dc6c9={};var _0x268e11;var _0x3f88ce;return db[_0xf537('0x4d')][_0xf537('0x56')]({'where':{'id':_0x2c0f01[_0xf537('0x51')]['id']}})[_0xf537('0x17')](handleEntityNotFound(_0x6b7cf2,null))[_0xf537('0x17')](function(_0x4c34c7){if(_0x4c34c7){_0x268e11=_0x4c34c7;_0x5dc6c9[_0xf537('0x3d')]=_['keys'](db[_0xf537('0x57')][_0xf537('0x39')]);_0x5dc6c9['query']=_[_0xf537('0x40')](_0x2c0f01[_0xf537('0x3f')]);_0x5dc6c9['filters']=_[_0xf537('0x42')](_0x5dc6c9[_0xf537('0x3d')],_0x5dc6c9[_0xf537('0x3f')]);_0xa35dd1[_0xf537('0x44')]=_[_0xf537('0x42')](_0x5dc6c9[_0xf537('0x3d')],qs[_0xf537('0x43')](_0x2c0f01[_0xf537('0x3f')][_0xf537('0x43')]));_0xa35dd1[_0xf537('0x44')]=_0xa35dd1[_0xf537('0x44')][_0xf537('0x45')]?_0xa35dd1[_0xf537('0x44')]:_0x5dc6c9['model'];_0xa35dd1[_0xf537('0x47')]=qs['sort'](_0x2c0f01[_0xf537('0x3f')][_0xf537('0x48')]);_0xa35dd1[_0xf537('0x49')]=qs[_0xf537('0x41')](_[_0xf537('0x58')](_0x2c0f01[_0xf537('0x3f')],_0x5dc6c9[_0xf537('0x41')]));if(_0x2c0f01['query'][_0xf537('0x59')]){_0xa35dd1['where']=_[_0xf537('0x4a')](_0xa35dd1[_0xf537('0x49')],{'$or':_[_0xf537('0x3e')](_0xa35dd1['attributes'],function(_0x427ee6){var _0x2dd8bc={};_0x2dd8bc[_0x427ee6]={'$like':'%'+_0x2c0f01[_0xf537('0x3f')][_0xf537('0x59')]+'%'};return _0x2dd8bc;})});}_0xa35dd1=_[_0xf537('0x4a')]({},_0xa35dd1,_0x2c0f01['options']);return _0x268e11[_0xf537('0x55')](_0xa35dd1);}})[_0xf537('0x17')](function(_0x538715){if(_0x538715){_0x3f88ce=_0x538715[_0xf537('0x45')];if(!_0x2c0f01[_0xf537('0x3f')][_0xf537('0x46')](_0xf537('0x5a'))){_0xa35dd1['limit']=qs['limit'](_0x2c0f01['query'][_0xf537('0x26')]);_0xa35dd1[_0xf537('0x27')]=qs[_0xf537('0x27')](_0x2c0f01['query'][_0xf537('0x27')]);}return _0x268e11[_0xf537('0x55')](_0xa35dd1);}})[_0xf537('0x17')](function(_0x33126e){if(_0x33126e){return _0x33126e?{'count':_0x3f88ce,'rows':_0x33126e}:null;}})[_0xf537('0x17')](respondWithResult(_0x6b7cf2,null))[_0xf537('0x21')](handleError(_0x6b7cf2,null));};exports[_0xf537('0x5b')]=function(_0x1739ea,_0x324106,_0x2d2e24){var _0x28bd30={};var _0x335112={};var _0x2d0b85;var _0x156cb5;return db['ZohoConfiguration'][_0xf537('0x56')]({'where':{'id':_0x1739ea[_0xf537('0x51')]['id']}})[_0xf537('0x17')](handleEntityNotFound(_0x324106,null))[_0xf537('0x17')](function(_0x407657){if(_0x407657){_0x2d0b85=_0x407657;_0x335112[_0xf537('0x3d')]=_[_0xf537('0x40')](db[_0xf537('0x57')]['rawAttributes']);_0x335112[_0xf537('0x3f')]=_['keys'](_0x1739ea[_0xf537('0x3f')]);_0x335112[_0xf537('0x41')]=_['intersection'](_0x335112[_0xf537('0x3d')],_0x335112[_0xf537('0x3f')]);_0x28bd30[_0xf537('0x44')]=_['intersection'](_0x335112[_0xf537('0x3d')],qs[_0xf537('0x43')](_0x1739ea['query'][_0xf537('0x43')]));_0x28bd30['attributes']=_0x28bd30[_0xf537('0x44')]['length']?_0x28bd30[_0xf537('0x44')]:_0x335112[_0xf537('0x3d')];_0x28bd30[_0xf537('0x47')]=qs[_0xf537('0x48')](_0x1739ea['query'][_0xf537('0x48')]);_0x28bd30[_0xf537('0x49')]=qs[_0xf537('0x41')](_['pick'](_0x1739ea['query'],_0x335112['filters']));if(_0x1739ea[_0xf537('0x3f')][_0xf537('0x59')]){_0x28bd30[_0xf537('0x49')]=_['merge'](_0x28bd30[_0xf537('0x49')],{'$or':_[_0xf537('0x3e')](_0x28bd30['attributes'],function(_0x234e6f){var _0x508d0d={};_0x508d0d[_0x234e6f]={'$like':'%'+_0x1739ea[_0xf537('0x3f')][_0xf537('0x59')]+'%'};return _0x508d0d;})});}_0x28bd30=_[_0xf537('0x4a')]({},_0x28bd30,_0x1739ea['options']);return _0x2d0b85[_0xf537('0x5b')](_0x28bd30);}})[_0xf537('0x17')](function(_0x39d208){if(_0x39d208){_0x156cb5=_0x39d208[_0xf537('0x45')];if(!_0x1739ea['query']['hasOwnProperty'](_0xf537('0x5a'))){_0x28bd30[_0xf537('0x26')]=qs[_0xf537('0x26')](_0x1739ea['query']['limit']);_0x28bd30[_0xf537('0x27')]=qs[_0xf537('0x27')](_0x1739ea[_0xf537('0x3f')][_0xf537('0x27')]);}return _0x2d0b85[_0xf537('0x5b')](_0x28bd30);}})['then'](function(_0x14360f){if(_0x14360f){return _0x14360f?{'count':_0x156cb5,'rows':_0x14360f}:null;}})[_0xf537('0x17')](respondWithResult(_0x324106,null))[_0xf537('0x21')](handleError(_0x324106,null));};exports['getDescriptions']=function(_0x3cb048,_0x933d9c,_0x29f54e){var _0x43982b={};var _0x35cc7b={};var _0x6cdbbc;var _0x48045a;return db[_0xf537('0x4d')][_0xf537('0x56')]({'where':{'id':_0x3cb048['params']['id']}})[_0xf537('0x17')](handleEntityNotFound(_0x933d9c,null))['then'](function(_0x3f2a73){if(_0x3f2a73){_0x6cdbbc=_0x3f2a73;_0x35cc7b[_0xf537('0x3d')]=_[_0xf537('0x40')](db['ZohoField'][_0xf537('0x39')]);_0x35cc7b[_0xf537('0x3f')]=_[_0xf537('0x40')](_0x3cb048['query']);_0x35cc7b[_0xf537('0x41')]=_[_0xf537('0x42')](_0x35cc7b[_0xf537('0x3d')],_0x35cc7b[_0xf537('0x3f')]);_0x43982b[_0xf537('0x44')]=_[_0xf537('0x42')](_0x35cc7b[_0xf537('0x3d')],qs[_0xf537('0x43')](_0x3cb048[_0xf537('0x3f')][_0xf537('0x43')]));_0x43982b['attributes']=_0x43982b[_0xf537('0x44')][_0xf537('0x45')]?_0x43982b[_0xf537('0x44')]:_0x35cc7b[_0xf537('0x3d')];_0x43982b[_0xf537('0x47')]=qs[_0xf537('0x48')](_0x3cb048[_0xf537('0x3f')]['sort']);_0x43982b[_0xf537('0x49')]=qs['filters'](_['pick'](_0x3cb048[_0xf537('0x3f')],_0x35cc7b['filters']));if(_0x3cb048['query'][_0xf537('0x59')]){_0x43982b[_0xf537('0x49')]=_[_0xf537('0x4a')](_0x43982b[_0xf537('0x49')],{'$or':_[_0xf537('0x3e')](_0x43982b[_0xf537('0x44')],function(_0xa1fab3){var _0xd764ce={};_0xd764ce[_0xa1fab3]={'$like':'%'+_0x3cb048[_0xf537('0x3f')][_0xf537('0x59')]+'%'};return _0xd764ce;})});}_0x43982b=_['merge']({},_0x43982b,_0x3cb048[_0xf537('0x4c')]);return _0x6cdbbc[_0xf537('0x5c')](_0x43982b);}})[_0xf537('0x17')](function(_0x40ea2f){if(_0x40ea2f){_0x48045a=_0x40ea2f[_0xf537('0x45')];if(!_0x3cb048['query']['hasOwnProperty'](_0xf537('0x5a'))){_0x43982b['limit']=qs[_0xf537('0x26')](_0x3cb048[_0xf537('0x3f')][_0xf537('0x26')]);_0x43982b[_0xf537('0x27')]=qs[_0xf537('0x27')](_0x3cb048[_0xf537('0x3f')]['offset']);}return _0x6cdbbc[_0xf537('0x5c')](_0x43982b);}})[_0xf537('0x17')](function(_0x4fd108){if(_0x4fd108){return _0x4fd108?{'count':_0x48045a,'rows':_0x4fd108}:null;}})[_0xf537('0x17')](respondWithResult(_0x933d9c,null))[_0xf537('0x21')](handleError(_0x933d9c,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index c488b38..fb7e1b7 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 _0x8bb1=['int_zoho_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intZohoConfiguration.attributes','define','ZohoConfiguration'];(function(_0x449d2e,_0x314ac0){var _0x3cd8ec=function(_0x524f2a){while(--_0x524f2a){_0x449d2e['push'](_0x449d2e['shift']());}};_0x3cd8ec(++_0x314ac0);}(_0x8bb1,0x85));var _0x18bb=function(_0x385496,_0x152ff6){_0x385496=_0x385496-0x0;var _0x2e0f08=_0x8bb1[_0x385496];return _0x2e0f08;};'use strict';var _=require(_0x18bb('0x0'));var util=require(_0x18bb('0x1'));var logger=require('../../config/logger')(_0x18bb('0x2'));var moment=require(_0x18bb('0x3'));var BPromise=require(_0x18bb('0x4'));var rp=require(_0x18bb('0x5'));var fs=require('fs');var path=require(_0x18bb('0x6'));var rimraf=require(_0x18bb('0x7'));var config=require('../../config/environment');var attributes=require(_0x18bb('0x8'));module['exports']=function(_0x5baa3e,_0x13d638){return _0x5baa3e[_0x18bb('0x9')](_0x18bb('0xa'),attributes,{'tableName':_0x18bb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4241=['define','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5ddda9,_0x43e558){var _0x53a004=function(_0x2794a1){while(--_0x2794a1){_0x5ddda9['push'](_0x5ddda9['shift']());}};_0x53a004(++_0x43e558);}(_0x4241,0x1f1));var _0x1424=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4241[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require(_0x1424('0x0'));var logger=require('../../config/logger')(_0x1424('0x1'));var moment=require(_0x1424('0x2'));var BPromise=require(_0x1424('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1424('0x4'));var rimraf=require(_0x1424('0x5'));var config=require(_0x1424('0x6'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x13bc85,_0x4d3d9e){return _0x13bc85[_0x1424('0x7')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index fd1adab..4896c0a 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 _0x5ce2=['request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s'];(function(_0x3dde25,_0x398490){var _0x574d16=function(_0x430173){while(--_0x430173){_0x3dde25['push'](_0x3dde25['shift']());}};_0x574d16(++_0x398490);}(_0x5ce2,0xef));var _0x25ce=function(_0x11c632,_0x37a6d1){_0x11c632=_0x11c632-0x0;var _0x552909=_0x5ce2[_0x11c632];return _0x552909;};'use strict';var _=require(_0x25ce('0x0'));var util=require(_0x25ce('0x1'));var moment=require(_0x25ce('0x2'));var BPromise=require(_0x25ce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25ce('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x25ce('0x5'))(_0x25ce('0x6'));var config=require(_0x25ce('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x25ce('0x8')][_0x25ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c2872,_0x1bd79d,_0x3bc620){return new BPromise(function(_0x48c1ab,_0x336559){return client[_0x25ce('0xa')](_0x3c2872,_0x3bc620)['then'](function(_0x1e54a8){logger[_0x25ce('0xb')](_0x25ce('0xc'),_0x1bd79d,_0x25ce('0xd'));logger[_0x25ce('0xe')](_0x25ce('0xf'),_0x1bd79d,_0x25ce('0xd'),JSON['stringify'](_0x1e54a8));if(_0x1e54a8[_0x25ce('0x10')]){if(_0x1e54a8[_0x25ce('0x10')][_0x25ce('0x11')]===0x1f4){logger[_0x25ce('0x10')](_0x25ce('0xc'),_0x1bd79d,_0x1e54a8[_0x25ce('0x10')][_0x25ce('0x12')]);return _0x336559(_0x1e54a8[_0x25ce('0x10')]['message']);}logger[_0x25ce('0x10')](_0x25ce('0xc'),_0x1bd79d,_0x1e54a8[_0x25ce('0x10')][_0x25ce('0x12')]);return _0x48c1ab(_0x1e54a8[_0x25ce('0x10')][_0x25ce('0x12')]);}else{logger[_0x25ce('0xb')](_0x25ce('0xc'),_0x1bd79d,_0x25ce('0xd'));_0x48c1ab(_0x1e54a8[_0x25ce('0x13')][_0x25ce('0x12')]);}})[_0x25ce('0x14')](function(_0x50dfe6){logger[_0x25ce('0x10')](_0x25ce('0xc'),_0x1bd79d,_0x50dfe6);_0x336559(_0x50dfe6);});});} \ No newline at end of file +var _0x137f=['rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x137f,0x178));var _0xf137=function(_0x2401ca,_0x171f6e){_0x2401ca=_0x2401ca-0x0;var _0x5bb607=_0x137f[_0x2401ca];return _0x5bb607;};'use strict';var _=require(_0xf137('0x0'));var util=require(_0xf137('0x1'));var moment=require(_0xf137('0x2'));var BPromise=require(_0xf137('0x3'));var rs=require(_0xf137('0x4'));var fs=require('fs');var Redis=require(_0xf137('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf137('0x6'));var logger=require(_0xf137('0x7'))(_0xf137('0x8'));var config=require(_0xf137('0x9'));var jayson=require(_0xf137('0xa'));var client=jayson[_0xf137('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4896e4,_0x4241e9,_0x107715){return new BPromise(function(_0x5db66d,_0xa7e5a4){return client[_0xf137('0xc')](_0x4896e4,_0x107715)[_0xf137('0xd')](function(_0x557bef){logger[_0xf137('0xe')](_0xf137('0xf'),_0x4241e9,_0xf137('0x10'));logger[_0xf137('0x11')](_0xf137('0x12'),_0x4241e9,_0xf137('0x10'),JSON[_0xf137('0x13')](_0x557bef));if(_0x557bef[_0xf137('0x14')]){if(_0x557bef[_0xf137('0x14')]['code']===0x1f4){logger[_0xf137('0x14')](_0xf137('0xf'),_0x4241e9,_0x557bef[_0xf137('0x14')][_0xf137('0x15')]);return _0xa7e5a4(_0x557bef[_0xf137('0x14')][_0xf137('0x15')]);}logger[_0xf137('0x14')](_0xf137('0xf'),_0x4241e9,_0x557bef[_0xf137('0x14')][_0xf137('0x15')]);return _0x5db66d(_0x557bef[_0xf137('0x14')]['message']);}else{logger[_0xf137('0xe')](_0xf137('0xf'),_0x4241e9,_0xf137('0x10'));_0x5db66d(_0x557bef[_0xf137('0x16')][_0xf137('0x15')]);}})[_0xf137('0x17')](function(_0x53dc1e){logger[_0xf137('0x14')](_0xf137('0xf'),_0x4241e9,_0x53dc1e);_0xa7e5a4(_0x53dc1e);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 47c6e8f..287e73f 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 _0x2b4f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util'];(function(_0x1f1e31,_0x27b5c3){var _0x229b56=function(_0x16db77){while(--_0x16db77){_0x1f1e31['push'](_0x1f1e31['shift']());}};_0x229b56(++_0x27b5c3);}(_0x2b4f,0x142));var _0xf2b4=function(_0x30c626,_0x1b0daf){_0x30c626=_0x30c626-0x0;var _0xb78148=_0x2b4f[_0x30c626];return _0xb78148;};'use strict';var multer=require('multer');var util=require(_0xf2b4('0x0'));var path=require('path');var timeout=require(_0xf2b4('0x1'));var express=require(_0xf2b4('0x2'));var router=express[_0xf2b4('0x3')]();var fs_extra=require(_0xf2b4('0x4'));var auth=require(_0xf2b4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf2b4('0x6'));var controller=require(_0xf2b4('0x7'));router[_0xf2b4('0x8')]('/',auth[_0xf2b4('0x9')](),controller['index']);router[_0xf2b4('0x8')]('/:id',auth[_0xf2b4('0x9')](),controller[_0xf2b4('0xa')]);router[_0xf2b4('0xb')]('/',auth[_0xf2b4('0x9')](),controller[_0xf2b4('0xc')]);router[_0xf2b4('0xd')](_0xf2b4('0xe'),auth[_0xf2b4('0x9')](),controller[_0xf2b4('0xf')]);router[_0xf2b4('0x10')](_0xf2b4('0xe'),auth[_0xf2b4('0x9')](),controller[_0xf2b4('0x11')]);module[_0xf2b4('0x12')]=router; \ No newline at end of file +var _0xa7fa=['multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','isAuthenticated','post','create','put','update','/:id','destroy','exports'];(function(_0x2047bf,_0x429ed5){var _0xce1d9f=function(_0x323bae){while(--_0x323bae){_0x2047bf['push'](_0x2047bf['shift']());}};_0xce1d9f(++_0x429ed5);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xaa7f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaa7f('0x1'));var express=require(_0xaa7f('0x2'));var router=express[_0xaa7f('0x3')]();var fs_extra=require(_0xaa7f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaa7f('0x5'));var config=require(_0xaa7f('0x6'));var controller=require(_0xaa7f('0x7'));router[_0xaa7f('0x8')]('/',auth['isAuthenticated'](),controller[_0xaa7f('0x9')]);router['get']('/:id',auth[_0xaa7f('0xa')](),controller['show']);router[_0xaa7f('0xb')]('/',auth[_0xaa7f('0xa')](),controller[_0xaa7f('0xc')]);router[_0xaa7f('0xd')]('/:id',auth[_0xaa7f('0xa')](),controller[_0xaa7f('0xe')]);router['delete'](_0xaa7f('0xf'),auth[_0xaa7f('0xa')](),controller[_0xaa7f('0x10')]);module[_0xaa7f('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 34b9a04..c952e66 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 _0x0207=['STRING','BOOLEAN','exports','variable','customVariable','keyValue','picklist','string'];(function(_0x3bc918,_0x1d7396){var _0x50ec86=function(_0x585b6b){while(--_0x585b6b){_0x3bc918['push'](_0x3bc918['shift']());}};_0x50ec86(++_0x1d7396);}(_0x0207,0x162));var _0x7020=function(_0x56007e,_0x14b813){_0x56007e=_0x56007e-0x0;var _0x192962=_0x0207[_0x56007e];return _0x192962;};'use strict';var Sequelize=require('sequelize');module[_0x7020('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x7020('0x1'),_0x7020('0x2'),_0x7020('0x3'),_0x7020('0x4')),'defaultValue':_0x7020('0x5')},'content':{'type':Sequelize[_0x7020('0x6')]},'key':{'type':Sequelize[_0x7020('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x7020('0x1'),_0x7020('0x2'))},'keyContent':{'type':Sequelize[_0x7020('0x6')]},'idField':{'type':Sequelize[_0x7020('0x6')]},'nameField':{'type':Sequelize[_0x7020('0x6')]},'customField':{'type':Sequelize[_0x7020('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7020('0x6')]}}; \ No newline at end of file +var _0xb07f=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x4b0df0,_0x40f572){var _0x1b3672=function(_0x3980f9){while(--_0x3980f9){_0x4b0df0['push'](_0x4b0df0['shift']());}};_0x1b3672(++_0x40f572);}(_0xb07f,0x109));var _0xfb07=function(_0x2e9c98,_0x33e31e){_0x2e9c98=_0x2e9c98-0x0;var _0xda3039=_0xb07f[_0x2e9c98];return _0xda3039;};'use strict';var Sequelize=require(_0xfb07('0x0'));module[_0xfb07('0x1')]={'type':{'type':Sequelize[_0xfb07('0x2')](_0xfb07('0x3'),_0xfb07('0x4'),_0xfb07('0x5'),_0xfb07('0x6'),_0xfb07('0x7')),'defaultValue':_0xfb07('0x3')},'content':{'type':Sequelize[_0xfb07('0x8')]},'key':{'type':Sequelize[_0xfb07('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xfb07('0x3'),_0xfb07('0x4'),_0xfb07('0x5'))},'keyContent':{'type':Sequelize[_0xfb07('0x8')]},'idField':{'type':Sequelize[_0xfb07('0x8')]},'nameField':{'type':Sequelize[_0xfb07('0x8')]},'customField':{'type':Sequelize[_0xfb07('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfb07('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 0668e1a..477a25a 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 _0xcee7=['interaction','account','map','ZohoField','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','show','params','length','find','catch','create','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','render','merge','body','message','agent'];(function(_0x4337b5,_0x56edbf){var _0x55b94b=function(_0x38b2e7){while(--_0x38b2e7){_0x4337b5['push'](_0x4337b5['shift']());}};_0x55b94b(++_0x56edbf);}(_0xcee7,0x1a6));var _0x7cee=function(_0x165496,_0x39e9b6){_0x165496=_0x165496-0x0;var _0x3a3768=_0xcee7[_0x165496];return _0x3a3768;};'use strict';var emlformat=require(_0x7cee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7cee('0x1'));var jsonpatch=require(_0x7cee('0x2'));var rp=require('request-promise');var moment=require(_0x7cee('0x3'));var BPromise=require(_0x7cee('0x4'));var Mustache=require(_0x7cee('0x5'));var util=require('util');var path=require('path');var sox=require(_0x7cee('0x6'));var csv=require(_0x7cee('0x7'));var ejs=require(_0x7cee('0x8'));var fs=require('fs');var fs_extra=require(_0x7cee('0x9'));var _=require(_0x7cee('0xa'));var squel=require('squel');var crypto=require(_0x7cee('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7cee('0xc'));var toCsv=require(_0x7cee('0x7'));var querystring=require(_0x7cee('0xd'));var Papa=require('papaparse');var Redis=require(_0x7cee('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7cee('0xf'));var as=require(_0x7cee('0x10'));var hardwareService=require(_0x7cee('0x11'));var logger=require('../../config/logger')(_0x7cee('0x12'));var utils=require(_0x7cee('0x13'));var config=require(_0x7cee('0x14'));var licenseUtil=require(_0x7cee('0x15'));var db=require(_0x7cee('0x16'))['db'];function respondWithStatusCode(_0x15adc5,_0x24736a){_0x24736a=_0x24736a||0xcc;return function(_0x20a045){if(_0x20a045){return _0x15adc5['sendStatus'](_0x24736a);}return _0x15adc5['status'](_0x24736a)[_0x7cee('0x17')]();};}function respondWithResult(_0x51243c,_0x42971a){_0x42971a=_0x42971a||0xc8;return function(_0x57cada){if(_0x57cada){return _0x51243c[_0x7cee('0x18')](_0x42971a)[_0x7cee('0x19')](_0x57cada);}};}function respondWithFilteredResult(_0x4b5fcc,_0x3af7a3){return function(_0x8f9f75){if(_0x8f9f75){var _0x245108=typeof _0x3af7a3['offset']==='undefined'&&typeof _0x3af7a3[_0x7cee('0x1a')]==='undefined';var _0x5ad2a0=_0x8f9f75[_0x7cee('0x1b')];var _0x7e55ea=_0x245108?0x0:_0x3af7a3[_0x7cee('0x1c')];var _0x79e72b=_0x245108?_0x8f9f75[_0x7cee('0x1b')]:_0x3af7a3[_0x7cee('0x1c')]+_0x3af7a3[_0x7cee('0x1a')];var _0x17e873;if(_0x79e72b>=_0x5ad2a0){_0x79e72b=_0x5ad2a0;_0x17e873=0xc8;}else{_0x17e873=0xce;}_0x4b5fcc[_0x7cee('0x18')](_0x17e873);return _0x4b5fcc[_0x7cee('0x1d')](_0x7cee('0x1e'),_0x7e55ea+'-'+_0x79e72b+'/'+_0x5ad2a0)[_0x7cee('0x19')](_0x8f9f75);}return null;};}function patchUpdates(_0x2c84f0){return function(_0x562c80){try{jsonpatch[_0x7cee('0x1f')](_0x562c80,_0x2c84f0,!![]);}catch(_0x250478){return BPromise[_0x7cee('0x20')](_0x250478);}return _0x562c80[_0x7cee('0x21')]();};}function saveUpdates(_0x12712f,_0x27d3ae){return function(_0x58f042){if(_0x58f042){return _0x58f042['update'](_0x12712f)[_0x7cee('0x22')](function(_0x25cf39){return _0x25cf39;});}return null;};}function removeEntity(_0x160cc6,_0x335a3e){return function(_0x38875c){if(_0x38875c){return _0x38875c[_0x7cee('0x23')]()[_0x7cee('0x22')](function(){_0x160cc6[_0x7cee('0x18')](0xcc)[_0x7cee('0x17')]();});}};}function handleEntityNotFound(_0x137fa3,_0x18049e){return function(_0x2da4d4){if(!_0x2da4d4){_0x137fa3[_0x7cee('0x24')](0x194);}return _0x2da4d4;};}function handleError(_0x28c8e1,_0x156bb1){_0x156bb1=_0x156bb1||0x1f4;return function(_0x176e3f){logger[_0x7cee('0x25')](_0x176e3f[_0x7cee('0x26')]);if(_0x176e3f[_0x7cee('0x27')]){delete _0x176e3f['name'];}_0x28c8e1[_0x7cee('0x18')](_0x156bb1)[_0x7cee('0x28')](_0x176e3f);};}function getMustacheRender(_0x1bf4d3,_0x2cd121){return Mustache[_0x7cee('0x29')](_0x1bf4d3,_[_0x7cee('0x2a')](_0x2cd121[_0x7cee('0x2b')],{'contact':_0x2cd121['contact'],'message':_0x2cd121[_0x7cee('0x2c')],'agent':_0x2cd121[_0x7cee('0x2d')],'interaction':_0x2cd121[_0x7cee('0x2e')],'account':_0x2cd121[_0x7cee('0x2f')]}))||'';}exports['index']=function(_0xb29fff,_0x5ee15e){var _0x272145={},_0x31e228={},_0x279d77={'count':0x0,'rows':[]};var _0x582c11=_[_0x7cee('0x30')](db[_0x7cee('0x31')][_0x7cee('0x32')],function(_0x131e5d){return{'name':_0x131e5d[_0x7cee('0x33')],'type':_0x131e5d['type'][_0x7cee('0x34')]};});_0x31e228[_0x7cee('0x35')]=_[_0x7cee('0x30')](_0x582c11,'name');_0x31e228[_0x7cee('0x36')]=_[_0x7cee('0x37')](_0xb29fff['query']);_0x31e228['filters']=_['intersection'](_0x31e228['model'],_0x31e228[_0x7cee('0x36')]);_0x272145[_0x7cee('0x38')]=_[_0x7cee('0x39')](_0x31e228[_0x7cee('0x35')],qs[_0x7cee('0x3a')](_0xb29fff['query'][_0x7cee('0x3a')]));_0x272145[_0x7cee('0x38')]=_0x272145['attributes']['length']?_0x272145[_0x7cee('0x38')]:_0x31e228[_0x7cee('0x35')];if(!_0xb29fff['query']['hasOwnProperty'](_0x7cee('0x3b'))){_0x272145[_0x7cee('0x1a')]=qs[_0x7cee('0x1a')](_0xb29fff['query'][_0x7cee('0x1a')]);_0x272145[_0x7cee('0x1c')]=qs[_0x7cee('0x1c')](_0xb29fff['query'][_0x7cee('0x1c')]);}_0x272145[_0x7cee('0x3c')]=qs['sort'](_0xb29fff[_0x7cee('0x36')][_0x7cee('0x3d')]);_0x272145[_0x7cee('0x3e')]=qs[_0x7cee('0x3f')](_[_0x7cee('0x40')](_0xb29fff[_0x7cee('0x36')],_0x31e228[_0x7cee('0x3f')]),_0x582c11);if(_0xb29fff['query'][_0x7cee('0x41')]){_0x272145[_0x7cee('0x3e')]=_[_0x7cee('0x2a')](_0x272145[_0x7cee('0x3e')],{'$or':_[_0x7cee('0x30')](_0x582c11,function(_0x5bc996){if(_0x5bc996[_0x7cee('0x42')]!==_0x7cee('0x43')){var _0x152aa6={};_0x152aa6[_0x5bc996[_0x7cee('0x27')]]={'$like':'%'+_0xb29fff[_0x7cee('0x36')][_0x7cee('0x41')]+'%'};return _0x152aa6;}})});}_0x272145=_['merge']({},_0x272145,_0xb29fff[_0x7cee('0x44')]);var _0x45a7f8={'where':_0x272145[_0x7cee('0x3e')]};return db[_0x7cee('0x31')]['count'](_0x45a7f8)[_0x7cee('0x22')](function(_0x250068){_0x279d77[_0x7cee('0x1b')]=_0x250068;if(_0xb29fff[_0x7cee('0x36')][_0x7cee('0x45')]){_0x272145[_0x7cee('0x46')]=[{'all':!![]}];}return db[_0x7cee('0x31')][_0x7cee('0x47')](_0x272145);})[_0x7cee('0x22')](function(_0x11de48){_0x279d77['rows']=_0x11de48;return _0x279d77;})[_0x7cee('0x22')](respondWithFilteredResult(_0x5ee15e,_0x272145))['catch'](handleError(_0x5ee15e,null));};exports[_0x7cee('0x48')]=function(_0x4a13be,_0x3266c7){var _0x4ed305={'raw':!![],'where':{'id':_0x4a13be[_0x7cee('0x49')]['id']}},_0x52f3a8={};_0x52f3a8[_0x7cee('0x35')]=_['keys'](db[_0x7cee('0x31')][_0x7cee('0x32')]);_0x52f3a8['query']=_['keys'](_0x4a13be['query']);_0x52f3a8[_0x7cee('0x3f')]=_[_0x7cee('0x39')](_0x52f3a8['model'],_0x52f3a8[_0x7cee('0x36')]);_0x4ed305[_0x7cee('0x38')]=_[_0x7cee('0x39')](_0x52f3a8[_0x7cee('0x35')],qs[_0x7cee('0x3a')](_0x4a13be['query'][_0x7cee('0x3a')]));_0x4ed305[_0x7cee('0x38')]=_0x4ed305[_0x7cee('0x38')][_0x7cee('0x4a')]?_0x4ed305['attributes']:_0x52f3a8['model'];if(_0x4a13be[_0x7cee('0x36')][_0x7cee('0x45')]){_0x4ed305[_0x7cee('0x46')]=[{'all':!![]}];}_0x4ed305=_[_0x7cee('0x2a')]({},_0x4ed305,_0x4a13be[_0x7cee('0x44')]);return db[_0x7cee('0x31')][_0x7cee('0x4b')](_0x4ed305)[_0x7cee('0x22')](handleEntityNotFound(_0x3266c7,null))[_0x7cee('0x22')](respondWithResult(_0x3266c7,null))[_0x7cee('0x4c')](handleError(_0x3266c7,null));};exports['create']=function(_0x4aca3e,_0x2c13e0){return db[_0x7cee('0x31')][_0x7cee('0x4d')](_0x4aca3e[_0x7cee('0x2b')],{})[_0x7cee('0x22')](respondWithResult(_0x2c13e0,0xc9))[_0x7cee('0x4c')](handleError(_0x2c13e0,null));};exports['update']=function(_0x1db200,_0x55e786){if(_0x1db200[_0x7cee('0x2b')]['id']){delete _0x1db200[_0x7cee('0x2b')]['id'];}return db['ZohoField'][_0x7cee('0x4b')]({'where':{'id':_0x1db200[_0x7cee('0x49')]['id']}})[_0x7cee('0x22')](handleEntityNotFound(_0x55e786,null))[_0x7cee('0x22')](saveUpdates(_0x1db200[_0x7cee('0x2b')],null))['then'](respondWithResult(_0x55e786,null))['catch'](handleError(_0x55e786,null));};exports[_0x7cee('0x23')]=function(_0x547b4,_0x2c06d7){return db[_0x7cee('0x31')][_0x7cee('0x4b')]({'where':{'id':_0x547b4[_0x7cee('0x49')]['id']}})[_0x7cee('0x22')](handleEntityNotFound(_0x2c06d7,null))[_0x7cee('0x22')](removeEntity(_0x2c06d7,null))['catch'](handleError(_0x2c06d7,null));}; \ No newline at end of file +var _0x79ce=['send','render','merge','contact','agent','account','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','where','filter','VIRTUAL','options','includeAll','include','ZohoField','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','save','then','destroy','end','error','name'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0x79ce,0xb7));var _0xe79c=function(_0x9f863e,_0xa4d9a6){_0x9f863e=_0x9f863e-0x0;var _0x24a8cd=_0x79ce[_0x9f863e];return _0x24a8cd;};'use strict';var emlformat=require(_0xe79c('0x0'));var rimraf=require(_0xe79c('0x1'));var zipdir=require(_0xe79c('0x2'));var jsonpatch=require(_0xe79c('0x3'));var rp=require(_0xe79c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe79c('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe79c('0x6'));var csv=require(_0xe79c('0x7'));var ejs=require(_0xe79c('0x8'));var fs=require('fs');var fs_extra=require(_0xe79c('0x9'));var _=require('lodash');var squel=require(_0xe79c('0xa'));var crypto=require(_0xe79c('0xb'));var jsforce=require(_0xe79c('0xc'));var deskjs=require(_0xe79c('0xd'));var toCsv=require(_0xe79c('0x7'));var querystring=require(_0xe79c('0xe'));var Papa=require(_0xe79c('0xf'));var Redis=require(_0xe79c('0x10'));var authService=require(_0xe79c('0x11'));var qs=require(_0xe79c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe79c('0x13'));var logger=require(_0xe79c('0x14'))(_0xe79c('0x15'));var utils=require(_0xe79c('0x16'));var config=require(_0xe79c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55ff15,_0xd3647b){_0xd3647b=_0xd3647b||0xcc;return function(_0x4f099c){if(_0x4f099c){return _0x55ff15[_0xe79c('0x18')](_0xd3647b);}return _0x55ff15['status'](_0xd3647b)['end']();};}function respondWithResult(_0x51c8b2,_0x4bcbb1){_0x4bcbb1=_0x4bcbb1||0xc8;return function(_0x463334){if(_0x463334){return _0x51c8b2[_0xe79c('0x19')](_0x4bcbb1)['json'](_0x463334);}};}function respondWithFilteredResult(_0x2dc1c9,_0x5a9bb9){return function(_0x54a784){if(_0x54a784){var _0x133a3a=typeof _0x5a9bb9[_0xe79c('0x1a')]===_0xe79c('0x1b')&&typeof _0x5a9bb9['limit']==='undefined';var _0x5e2222=_0x54a784[_0xe79c('0x1c')];var _0x3edf29=_0x133a3a?0x0:_0x5a9bb9['offset'];var _0x586b65=_0x133a3a?_0x54a784[_0xe79c('0x1c')]:_0x5a9bb9[_0xe79c('0x1a')]+_0x5a9bb9['limit'];var _0x3ee9d6;if(_0x586b65>=_0x5e2222){_0x586b65=_0x5e2222;_0x3ee9d6=0xc8;}else{_0x3ee9d6=0xce;}_0x2dc1c9[_0xe79c('0x19')](_0x3ee9d6);return _0x2dc1c9[_0xe79c('0x1d')](_0xe79c('0x1e'),_0x3edf29+'-'+_0x586b65+'/'+_0x5e2222)[_0xe79c('0x1f')](_0x54a784);}return null;};}function patchUpdates(_0x237924){return function(_0x32f4c2){try{jsonpatch[_0xe79c('0x20')](_0x32f4c2,_0x237924,!![]);}catch(_0x4b1d06){return BPromise['reject'](_0x4b1d06);}return _0x32f4c2[_0xe79c('0x21')]();};}function saveUpdates(_0x3c7509,_0x1d30f3){return function(_0x48d2ea){if(_0x48d2ea){return _0x48d2ea['update'](_0x3c7509)[_0xe79c('0x22')](function(_0xde1de0){return _0xde1de0;});}return null;};}function removeEntity(_0x448299,_0x5b8521){return function(_0x5510b3){if(_0x5510b3){return _0x5510b3[_0xe79c('0x23')]()[_0xe79c('0x22')](function(){_0x448299[_0xe79c('0x19')](0xcc)[_0xe79c('0x24')]();});}};}function handleEntityNotFound(_0x43d952,_0x5055dd){return function(_0x208a9f){if(!_0x208a9f){_0x43d952[_0xe79c('0x18')](0x194);}return _0x208a9f;};}function handleError(_0x33ed00,_0xced4a6){_0xced4a6=_0xced4a6||0x1f4;return function(_0x5498a0){logger[_0xe79c('0x25')](_0x5498a0['stack']);if(_0x5498a0[_0xe79c('0x26')]){delete _0x5498a0[_0xe79c('0x26')];}_0x33ed00[_0xe79c('0x19')](_0xced4a6)[_0xe79c('0x27')](_0x5498a0);};}function getMustacheRender(_0x18bb24,_0x2b8556){return Mustache[_0xe79c('0x28')](_0x18bb24,_[_0xe79c('0x29')](_0x2b8556['body'],{'contact':_0x2b8556[_0xe79c('0x2a')],'message':_0x2b8556['message'],'agent':_0x2b8556[_0xe79c('0x2b')],'interaction':_0x2b8556['interaction'],'account':_0x2b8556[_0xe79c('0x2c')]}))||'';}exports['index']=function(_0x263620,_0x442581){var _0x4ec434={},_0x52396b={},_0x43c77f={'count':0x0,'rows':[]};var _0x10b8bc=_[_0xe79c('0x2d')](db['ZohoField'][_0xe79c('0x2e')],function(_0x22550c){return{'name':_0x22550c[_0xe79c('0x2f')],'type':_0x22550c[_0xe79c('0x30')]['key']};});_0x52396b['model']=_[_0xe79c('0x2d')](_0x10b8bc,_0xe79c('0x26'));_0x52396b['query']=_[_0xe79c('0x31')](_0x263620[_0xe79c('0x32')]);_0x52396b[_0xe79c('0x33')]=_[_0xe79c('0x34')](_0x52396b[_0xe79c('0x35')],_0x52396b[_0xe79c('0x32')]);_0x4ec434[_0xe79c('0x36')]=_[_0xe79c('0x34')](_0x52396b[_0xe79c('0x35')],qs[_0xe79c('0x37')](_0x263620['query'][_0xe79c('0x37')]));_0x4ec434[_0xe79c('0x36')]=_0x4ec434[_0xe79c('0x36')][_0xe79c('0x38')]?_0x4ec434['attributes']:_0x52396b['model'];if(!_0x263620[_0xe79c('0x32')][_0xe79c('0x39')]('nolimit')){_0x4ec434[_0xe79c('0x3a')]=qs[_0xe79c('0x3a')](_0x263620[_0xe79c('0x32')][_0xe79c('0x3a')]);_0x4ec434[_0xe79c('0x1a')]=qs[_0xe79c('0x1a')](_0x263620[_0xe79c('0x32')][_0xe79c('0x1a')]);}_0x4ec434[_0xe79c('0x3b')]=qs['sort'](_0x263620[_0xe79c('0x32')]['sort']);_0x4ec434[_0xe79c('0x3c')]=qs[_0xe79c('0x33')](_['pick'](_0x263620[_0xe79c('0x32')],_0x52396b[_0xe79c('0x33')]),_0x10b8bc);if(_0x263620['query'][_0xe79c('0x3d')]){_0x4ec434[_0xe79c('0x3c')]=_[_0xe79c('0x29')](_0x4ec434[_0xe79c('0x3c')],{'$or':_[_0xe79c('0x2d')](_0x10b8bc,function(_0x4c5883){if(_0x4c5883[_0xe79c('0x30')]!==_0xe79c('0x3e')){var _0x79db2={};_0x79db2[_0x4c5883[_0xe79c('0x26')]]={'$like':'%'+_0x263620[_0xe79c('0x32')][_0xe79c('0x3d')]+'%'};return _0x79db2;}})});}_0x4ec434=_['merge']({},_0x4ec434,_0x263620[_0xe79c('0x3f')]);var _0x364494={'where':_0x4ec434[_0xe79c('0x3c')]};return db['ZohoField']['count'](_0x364494)[_0xe79c('0x22')](function(_0x511edb){_0x43c77f[_0xe79c('0x1c')]=_0x511edb;if(_0x263620[_0xe79c('0x32')][_0xe79c('0x40')]){_0x4ec434[_0xe79c('0x41')]=[{'all':!![]}];}return db[_0xe79c('0x42')]['findAll'](_0x4ec434);})['then'](function(_0x368d30){_0x43c77f['rows']=_0x368d30;return _0x43c77f;})[_0xe79c('0x22')](respondWithFilteredResult(_0x442581,_0x4ec434))[_0xe79c('0x43')](handleError(_0x442581,null));};exports[_0xe79c('0x44')]=function(_0x3ebfb3,_0x268e71){var _0x246b26={'raw':!![],'where':{'id':_0x3ebfb3[_0xe79c('0x45')]['id']}},_0x3b2570={};_0x3b2570[_0xe79c('0x35')]=_[_0xe79c('0x31')](db[_0xe79c('0x42')]['rawAttributes']);_0x3b2570['query']=_['keys'](_0x3ebfb3['query']);_0x3b2570[_0xe79c('0x33')]=_[_0xe79c('0x34')](_0x3b2570[_0xe79c('0x35')],_0x3b2570['query']);_0x246b26[_0xe79c('0x36')]=_[_0xe79c('0x34')](_0x3b2570[_0xe79c('0x35')],qs[_0xe79c('0x37')](_0x3ebfb3[_0xe79c('0x32')][_0xe79c('0x37')]));_0x246b26['attributes']=_0x246b26[_0xe79c('0x36')][_0xe79c('0x38')]?_0x246b26[_0xe79c('0x36')]:_0x3b2570[_0xe79c('0x35')];if(_0x3ebfb3[_0xe79c('0x32')][_0xe79c('0x40')]){_0x246b26[_0xe79c('0x41')]=[{'all':!![]}];}_0x246b26=_['merge']({},_0x246b26,_0x3ebfb3[_0xe79c('0x3f')]);return db['ZohoField'][_0xe79c('0x46')](_0x246b26)['then'](handleEntityNotFound(_0x268e71,null))[_0xe79c('0x22')](respondWithResult(_0x268e71,null))['catch'](handleError(_0x268e71,null));};exports[_0xe79c('0x47')]=function(_0x56878a,_0x54cfb8){return db[_0xe79c('0x42')][_0xe79c('0x47')](_0x56878a[_0xe79c('0x48')],{})[_0xe79c('0x22')](respondWithResult(_0x54cfb8,0xc9))[_0xe79c('0x43')](handleError(_0x54cfb8,null));};exports[_0xe79c('0x49')]=function(_0x5a81b6,_0x44cfee){if(_0x5a81b6[_0xe79c('0x48')]['id']){delete _0x5a81b6[_0xe79c('0x48')]['id'];}return db[_0xe79c('0x42')][_0xe79c('0x46')]({'where':{'id':_0x5a81b6[_0xe79c('0x45')]['id']}})['then'](handleEntityNotFound(_0x44cfee,null))[_0xe79c('0x22')](saveUpdates(_0x5a81b6[_0xe79c('0x48')],null))['then'](respondWithResult(_0x44cfee,null))['catch'](handleError(_0x44cfee,null));};exports['destroy']=function(_0x39814b,_0x3657a3){return db[_0xe79c('0x42')][_0xe79c('0x46')]({'where':{'id':_0x39814b['params']['id']}})['then'](handleEntityNotFound(_0x3657a3,null))[_0xe79c('0x22')](removeEntity(_0x3657a3,null))[_0xe79c('0x43')](handleError(_0x3657a3,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 9298803..93e1a63 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 _0x4040=['./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4040,0x132));var _0x0404=function(_0xef584a,_0x43e8b8){_0xef584a=_0xef584a-0x0;var _0x47a8a0=_0x4040[_0xef584a];return _0x47a8a0;};'use strict';var _=require(_0x0404('0x0'));var util=require(_0x0404('0x1'));var logger=require(_0x0404('0x2'))(_0x0404('0x3'));var moment=require(_0x0404('0x4'));var BPromise=require('bluebird');var rp=require(_0x0404('0x5'));var fs=require('fs');var path=require(_0x0404('0x6'));var rimraf=require(_0x0404('0x7'));var config=require(_0x0404('0x8'));var attributes=require(_0x0404('0x9'));module[_0x0404('0xa')]=function(_0x30f588,_0x362446){return _0x30f588[_0x0404('0xb')](_0x0404('0xc'),attributes,{'tableName':_0x0404('0xd'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x0404('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x82c2=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash'];(function(_0x13c1ca,_0x324061){var _0x31a494=function(_0x2eec89){while(--_0x2eec89){_0x13c1ca['push'](_0x13c1ca['shift']());}};_0x31a494(++_0x324061);}(_0x82c2,0x12b));var _0x282c=function(_0xd5a842,_0x3bef1f){_0xd5a842=_0xd5a842-0x0;var _0xcedd84=_0x82c2[_0xd5a842];return _0xcedd84;};'use strict';var _=require(_0x282c('0x0'));var util=require(_0x282c('0x1'));var logger=require('../../config/logger')(_0x282c('0x2'));var moment=require(_0x282c('0x3'));var BPromise=require(_0x282c('0x4'));var rp=require(_0x282c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x282c('0x6'));var config=require(_0x282c('0x7'));var attributes=require(_0x282c('0x8'));module[_0x282c('0x9')]=function(_0x244b0c,_0x4446e7){return _0x244b0c[_0x282c('0xa')](_0x282c('0xb'),attributes,{'tableName':_0x282c('0xc'),'paranoid':![],'indexes':[{'name':_0x282c('0xd'),'fields':['idField',_0x282c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 3062669..b1c27e8 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 _0xd0bb=['debug','stringify','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x473daa,_0x49be19){var _0x52ff04=function(_0x350fb6){while(--_0x350fb6){_0x473daa['push'](_0x473daa['shift']());}};_0x52ff04(++_0x49be19);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x146907,_0x541dcb){_0x146907=_0x146907-0x0;var _0x47e370=_0xd0bb[_0x146907];return _0x47e370;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37c205,_0x809599,_0x5eb975){return new BPromise(function(_0x2a4075,_0x4533ff){return client[_0xbd0b('0xa')](_0x37c205,_0x5eb975)[_0xbd0b('0xb')](function(_0x16e185){logger['info']('ZohoField,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'));logger[_0xbd0b('0xd')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'),JSON[_0xbd0b('0xe')](_0x16e185));if(_0x16e185['error']){if(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x10')]===0x1f4){logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);return _0x4533ff(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);}logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')]['message']);return _0x2a4075(_0x16e185[_0xbd0b('0xf')]['message']);}else{logger['info'](_0xbd0b('0x11'),_0x809599,_0xbd0b('0xc'));_0x2a4075(_0x16e185[_0xbd0b('0x13')][_0xbd0b('0x12')]);}})[_0xbd0b('0x14')](function(_0x546db3){logger['error'](_0xbd0b('0x11'),_0x809599,_0x546db3);_0x4533ff(_0x546db3);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xc3f169,_0x5c2120){var _0x5edc66=function(_0x11121a){while(--_0x11121a){_0xc3f169['push'](_0xc3f169['shift']());}};_0x5edc66(++_0x5c2120);}(_0x34e8,0x12c));var _0x834e=function(_0x1faa06,_0x3d90f3){_0x1faa06=_0x1faa06-0x0;var _0x14490f=_0x34e8[_0x1faa06];return _0x14490f;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('ZohoField,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('ZohoField,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 4105431..b33c754 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 _0xa788=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3cf0a7,_0xb827eb){var _0x1391e0=function(_0x1c45f4){while(--_0x1c45f4){_0x3cf0a7['push'](_0x3cf0a7['shift']());}};_0x1391e0(++_0xb827eb);}(_0xa788,0x70));var _0x8a78=function(_0x3f89bc,_0x579902){_0x3f89bc=_0x3f89bc-0x0;var _0x176174=_0xa788[_0x3f89bc];return _0x176174;};'use strict';var multer=require(_0x8a78('0x0'));var util=require(_0x8a78('0x1'));var path=require(_0x8a78('0x2'));var timeout=require(_0x8a78('0x3'));var express=require('express');var router=express[_0x8a78('0x4')]();var fs_extra=require(_0x8a78('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8a78('0x6'));var config=require(_0x8a78('0x7'));module['exports']=router; \ No newline at end of file +var _0x8cc8=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f6ac5,_0x166ce0){var _0x418591=function(_0x1eb763){while(--_0x1eb763){_0x4f6ac5['push'](_0x4f6ac5['shift']());}};_0x418591(++_0x166ce0);}(_0x8cc8,0x177));var _0x88cc=function(_0x552204,_0x222864){_0x552204=_0x552204-0x0;var _0x24988d=_0x8cc8[_0x552204];return _0x24988d;};'use strict';var multer=require(_0x88cc('0x0'));var util=require(_0x88cc('0x1'));var path=require(_0x88cc('0x2'));var timeout=require(_0x88cc('0x3'));var express=require(_0x88cc('0x4'));var router=express[_0x88cc('0x5')]();var fs_extra=require(_0x88cc('0x6'));var auth=require(_0x88cc('0x7'));var interaction=require(_0x88cc('0x8'));var config=require(_0x88cc('0x9'));module[_0x88cc('0xa')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 3eba481..f2bc8b6 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 _0xfee5=['exports','unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN'];(function(_0x56085e,_0x5c69e9){var _0x4de130=function(_0x120b34){while(--_0x120b34){_0x56085e['push'](_0x56085e['shift']());}};_0x4de130(++_0x5c69e9);}(_0xfee5,0x11a));var _0x5fee=function(_0x50b90c,_0x140ed){_0x50b90c=_0x50b90c-0x0;var _0x37e5e3=_0xfee5[_0x50b90c];return _0x37e5e3;};'use strict';var Sequelize=require('sequelize');module[_0x5fee('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5fee('0x1')},'version':{'type':Sequelize[_0x5fee('0x2')],'allowNull':![],'unique':_0x5fee('0x1')},'main':{'type':Sequelize[_0x5fee('0x2')],'defaultValue':_0x5fee('0x3')},'filename':{'type':Sequelize[_0x5fee('0x2')]},'path':{'type':Sequelize[_0x5fee('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x5fee('0x4')]},'active':{'type':Sequelize[_0x5fee('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x5fee('0x2')]},'logo':{'type':Sequelize[_0x5fee('0x2')]},'state':{'type':Sequelize[_0x5fee('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x5fee('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x5fee('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x9802=['STRING','unique_name_and_version','INTEGER','BOOLEAN','state'];(function(_0x130705,_0x2d266b){var _0x1fa991=function(_0x395639){while(--_0x395639){_0x130705['push'](_0x130705['shift']());}};_0x1fa991(++_0x2d266b);}(_0x9802,0xd7));var _0x2980=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9802[_0x3511d3];return _0x5d6321;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2980('0x0')],'allowNull':![],'unique':_0x2980('0x1')},'version':{'type':Sequelize[_0x2980('0x0')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x2980('0x0')]},'path':{'type':Sequelize[_0x2980('0x0')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x2980('0x2')]},'active':{'type':Sequelize[_0x2980('0x3')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x2980('0x0')]},'state':{'type':Sequelize[_0x2980('0x0')],'unique':_0x2980('0x4')},'description':{'type':Sequelize[_0x2980('0x0')]},'title':{'type':Sequelize[_0x2980('0x0')]},'remoteUri':{'type':Sequelize[_0x2980('0x0')]},'link':{'type':Sequelize[_0x2980('0x0')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index fac7f37..a68ce5b 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 _0x3586=['create','params','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','undefined','count','offset','limit','status','set','Content-Range','reject','update','then','destroy','stack','name','send','merge','body','contact','message','agent','interaction','index','map','Integration','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x3586,0x179));var _0x6358=function(_0x185ef3,_0x551adf){_0x185ef3=_0x185ef3-0x0;var _0x22f0ab=_0x3586[_0x185ef3];return _0x22f0ab;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6358('0x0'));var jsonpatch=require(_0x6358('0x1'));var rp=require(_0x6358('0x2'));var moment=require('moment');var BPromise=require(_0x6358('0x3'));var Mustache=require(_0x6358('0x4'));var util=require('util');var path=require(_0x6358('0x5'));var sox=require(_0x6358('0x6'));var csv=require(_0x6358('0x7'));var ejs=require(_0x6358('0x8'));var fs=require('fs');var fs_extra=require(_0x6358('0x9'));var _=require('lodash');var squel=require(_0x6358('0xa'));var crypto=require(_0x6358('0xb'));var jsforce=require(_0x6358('0xc'));var deskjs=require(_0x6358('0xd'));var toCsv=require(_0x6358('0x7'));var querystring=require(_0x6358('0xe'));var Papa=require('papaparse');var Redis=require(_0x6358('0xf'));var authService=require(_0x6358('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6358('0x11'))(_0x6358('0x12'));var utils=require(_0x6358('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6358('0x14'));var db=require(_0x6358('0x15'))['db'];function respondWithStatusCode(_0x5713ea,_0x5db3eb){_0x5db3eb=_0x5db3eb||0xcc;return function(_0x7a34ee){if(_0x7a34ee){return _0x5713ea[_0x6358('0x16')](_0x5db3eb);}return _0x5713ea['status'](_0x5db3eb)[_0x6358('0x17')]();};}function respondWithResult(_0x4751e3,_0x414477){_0x414477=_0x414477||0xc8;return function(_0x4f907c){if(_0x4f907c){return _0x4751e3['status'](_0x414477)['json'](_0x4f907c);}};}function respondWithFilteredResult(_0x210454,_0x451442){return function(_0x2ae593){if(_0x2ae593){var _0x5d544d=typeof _0x451442['offset']===_0x6358('0x18')&&typeof _0x451442['limit']===_0x6358('0x18');var _0x33e06f=_0x2ae593[_0x6358('0x19')];var _0xad924e=_0x5d544d?0x0:_0x451442['offset'];var _0xdddc12=_0x5d544d?_0x2ae593[_0x6358('0x19')]:_0x451442[_0x6358('0x1a')]+_0x451442[_0x6358('0x1b')];var _0x51cc06;if(_0xdddc12>=_0x33e06f){_0xdddc12=_0x33e06f;_0x51cc06=0xc8;}else{_0x51cc06=0xce;}_0x210454[_0x6358('0x1c')](_0x51cc06);return _0x210454[_0x6358('0x1d')](_0x6358('0x1e'),_0xad924e+'-'+_0xdddc12+'/'+_0x33e06f)['json'](_0x2ae593);}return null;};}function patchUpdates(_0x2cf3ff){return function(_0x2fd252){try{jsonpatch['apply'](_0x2fd252,_0x2cf3ff,!![]);}catch(_0x285ba8){return BPromise[_0x6358('0x1f')](_0x285ba8);}return _0x2fd252['save']();};}function saveUpdates(_0x38685c,_0xbbd8fd){return function(_0x54137e){if(_0x54137e){return _0x54137e[_0x6358('0x20')](_0x38685c)[_0x6358('0x21')](function(_0xd86345){return _0xd86345;});}return null;};}function removeEntity(_0x5df020,_0x19aaa7){return function(_0x3f2c4b){if(_0x3f2c4b){return _0x3f2c4b[_0x6358('0x22')]()[_0x6358('0x21')](function(){_0x5df020[_0x6358('0x1c')](0xcc)[_0x6358('0x17')]();});}};}function handleEntityNotFound(_0x2d405a,_0xab8bb0){return function(_0x3d7f76){if(!_0x3d7f76){_0x2d405a[_0x6358('0x16')](0x194);}return _0x3d7f76;};}function handleError(_0x3b127f,_0xd4e516){_0xd4e516=_0xd4e516||0x1f4;return function(_0x48e016){logger['error'](_0x48e016[_0x6358('0x23')]);if(_0x48e016[_0x6358('0x24')]){delete _0x48e016[_0x6358('0x24')];}_0x3b127f[_0x6358('0x1c')](_0xd4e516)[_0x6358('0x25')](_0x48e016);};}function getMustacheRender(_0x51f0aa,_0x4078b8){return Mustache['render'](_0x51f0aa,_[_0x6358('0x26')](_0x4078b8[_0x6358('0x27')],{'contact':_0x4078b8[_0x6358('0x28')],'message':_0x4078b8[_0x6358('0x29')],'agent':_0x4078b8[_0x6358('0x2a')],'interaction':_0x4078b8[_0x6358('0x2b')],'account':_0x4078b8['account']}))||'';}exports[_0x6358('0x2c')]=function(_0x171deb,_0x447581){var _0x514075={},_0x4289de={},_0x5a168={'count':0x0,'rows':[]};var _0x28e4b2=_[_0x6358('0x2d')](db[_0x6358('0x2e')]['rawAttributes'],function(_0x5ba208){return{'name':_0x5ba208['fieldName'],'type':_0x5ba208[_0x6358('0x2f')][_0x6358('0x30')]};});_0x4289de[_0x6358('0x31')]=_[_0x6358('0x2d')](_0x28e4b2,_0x6358('0x24'));_0x4289de[_0x6358('0x32')]=_[_0x6358('0x33')](_0x171deb['query']);_0x4289de[_0x6358('0x34')]=_[_0x6358('0x35')](_0x4289de[_0x6358('0x31')],_0x4289de[_0x6358('0x32')]);_0x514075[_0x6358('0x36')]=_['intersection'](_0x4289de[_0x6358('0x31')],qs[_0x6358('0x37')](_0x171deb[_0x6358('0x32')][_0x6358('0x37')]));_0x514075[_0x6358('0x36')]=_0x514075[_0x6358('0x36')][_0x6358('0x38')]?_0x514075[_0x6358('0x36')]:_0x4289de['model'];if(!_0x171deb[_0x6358('0x32')][_0x6358('0x39')](_0x6358('0x3a'))){_0x514075['limit']=qs['limit'](_0x171deb[_0x6358('0x32')]['limit']);_0x514075[_0x6358('0x1a')]=qs[_0x6358('0x1a')](_0x171deb[_0x6358('0x32')][_0x6358('0x1a')]);}_0x514075[_0x6358('0x3b')]=qs[_0x6358('0x3c')](_0x171deb[_0x6358('0x32')][_0x6358('0x3c')]);_0x514075[_0x6358('0x3d')]=qs[_0x6358('0x34')](_[_0x6358('0x3e')](_0x171deb[_0x6358('0x32')],_0x4289de[_0x6358('0x34')]),_0x28e4b2);if(_0x171deb['query'][_0x6358('0x3f')]){_0x514075[_0x6358('0x3d')]=_[_0x6358('0x26')](_0x514075[_0x6358('0x3d')],{'$or':_[_0x6358('0x2d')](_0x28e4b2,function(_0x12e4e5){if(_0x12e4e5['type']!=='VIRTUAL'){var _0x7a6754={};_0x7a6754[_0x12e4e5[_0x6358('0x24')]]={'$like':'%'+_0x171deb[_0x6358('0x32')][_0x6358('0x3f')]+'%'};return _0x7a6754;}})});}_0x514075=_[_0x6358('0x26')]({},_0x514075,_0x171deb[_0x6358('0x40')]);var _0x25a1c9={'where':_0x514075[_0x6358('0x3d')]};return db[_0x6358('0x2e')][_0x6358('0x19')](_0x25a1c9)['then'](function(_0x10ad8a){_0x5a168[_0x6358('0x19')]=_0x10ad8a;if(_0x171deb[_0x6358('0x32')][_0x6358('0x41')]){_0x514075[_0x6358('0x42')]=[{'all':!![]}];}return db[_0x6358('0x2e')][_0x6358('0x43')](_0x514075);})[_0x6358('0x21')](function(_0x5468a6){_0x5a168[_0x6358('0x44')]=_0x5468a6;return _0x5a168;})[_0x6358('0x21')](respondWithFilteredResult(_0x447581,_0x514075))[_0x6358('0x45')](handleError(_0x447581,null));};exports[_0x6358('0x46')]=function(_0x4018fe,_0x17a719){var _0x4e79c2={'raw':![],'where':{'id':_0x4018fe['params']['id']}},_0x1c7705={};_0x1c7705['model']=_[_0x6358('0x33')](db[_0x6358('0x2e')][_0x6358('0x47')]);_0x1c7705[_0x6358('0x32')]=_[_0x6358('0x33')](_0x4018fe['query']);_0x1c7705[_0x6358('0x34')]=_[_0x6358('0x35')](_0x1c7705[_0x6358('0x31')],_0x1c7705[_0x6358('0x32')]);_0x4e79c2[_0x6358('0x36')]=_[_0x6358('0x35')](_0x1c7705[_0x6358('0x31')],qs['fields'](_0x4018fe[_0x6358('0x32')][_0x6358('0x37')]));_0x4e79c2[_0x6358('0x36')]=_0x4e79c2[_0x6358('0x36')][_0x6358('0x38')]?_0x4e79c2[_0x6358('0x36')]:_0x1c7705['model'];if(_0x4018fe[_0x6358('0x32')][_0x6358('0x41')]){_0x4e79c2[_0x6358('0x42')]=[{'all':!![]}];}_0x4e79c2=_[_0x6358('0x26')]({},_0x4e79c2,_0x4018fe[_0x6358('0x40')]);return db[_0x6358('0x2e')][_0x6358('0x48')](_0x4e79c2)['then'](handleEntityNotFound(_0x17a719,null))[_0x6358('0x21')](respondWithResult(_0x17a719,null))[_0x6358('0x45')](handleError(_0x17a719,null));};exports[_0x6358('0x49')]=function(_0x2a1f22,_0xa841b3){return db['Integration']['create'](_0x2a1f22['body'],{})['then'](respondWithResult(_0xa841b3,0xc9))[_0x6358('0x45')](handleError(_0xa841b3,null));};exports[_0x6358('0x20')]=function(_0x1a1a63,_0x3bb4bb){if(_0x1a1a63[_0x6358('0x27')]['id']){delete _0x1a1a63[_0x6358('0x27')]['id'];}return db[_0x6358('0x2e')][_0x6358('0x48')]({'where':{'id':_0x1a1a63[_0x6358('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3bb4bb,null))[_0x6358('0x21')](saveUpdates(_0x1a1a63[_0x6358('0x27')],null))[_0x6358('0x21')](respondWithResult(_0x3bb4bb,null))[_0x6358('0x45')](handleError(_0x3bb4bb,null));};exports['destroy']=function(_0x10ce03,_0x1bdfe3){return db[_0x6358('0x2e')][_0x6358('0x48')]({'where':{'id':_0x10ce03['params']['id']}})[_0x6358('0x21')](handleEntityNotFound(_0x1bdfe3,null))['then'](removeEntity(_0x1bdfe3,null))[_0x6358('0x45')](handleError(_0x1bdfe3,null));}; \ No newline at end of file +var _0x559e=['show','keys','create','update','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','name','send','body','message','agent','interaction','account','index','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Integration','includeAll','include','findAll','catch'];(function(_0x5b5f4c,_0xf1e942){var _0x29ccbf=function(_0x3d6e16){while(--_0x3d6e16){_0x5b5f4c['push'](_0x5b5f4c['shift']());}};_0x29ccbf(++_0xf1e942);}(_0x559e,0xf6));var _0xe559=function(_0x194bc1,_0x14199d){_0x194bc1=_0x194bc1-0x0;var _0x3892fb=_0x559e[_0x194bc1];return _0x3892fb;};'use strict';var emlformat=require(_0xe559('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe559('0x1'));var jsonpatch=require(_0xe559('0x2'));var rp=require(_0xe559('0x3'));var moment=require('moment');var BPromise=require(_0xe559('0x4'));var Mustache=require('mustache');var util=require(_0xe559('0x5'));var path=require(_0xe559('0x6'));var sox=require(_0xe559('0x7'));var csv=require(_0xe559('0x8'));var ejs=require(_0xe559('0x9'));var fs=require('fs');var fs_extra=require(_0xe559('0xa'));var _=require(_0xe559('0xb'));var squel=require(_0xe559('0xc'));var crypto=require(_0xe559('0xd'));var jsforce=require(_0xe559('0xe'));var deskjs=require(_0xe559('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe559('0x10'));var Papa=require(_0xe559('0x11'));var Redis=require(_0xe559('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe559('0x13'));var as=require(_0xe559('0x14'));var hardwareService=require(_0xe559('0x15'));var logger=require('../../config/logger')(_0xe559('0x16'));var utils=require(_0xe559('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe559('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ddfb5,_0xbe5e0){_0xbe5e0=_0xbe5e0||0xcc;return function(_0x233cba){if(_0x233cba){return _0x4ddfb5[_0xe559('0x19')](_0xbe5e0);}return _0x4ddfb5['status'](_0xbe5e0)[_0xe559('0x1a')]();};}function respondWithResult(_0x2bbb8d,_0x4f5bb5){_0x4f5bb5=_0x4f5bb5||0xc8;return function(_0x4208ec){if(_0x4208ec){return _0x2bbb8d[_0xe559('0x1b')](_0x4f5bb5)[_0xe559('0x1c')](_0x4208ec);}};}function respondWithFilteredResult(_0x296667,_0x3cfef7){return function(_0x279f29){if(_0x279f29){var _0x1f537e=typeof _0x3cfef7[_0xe559('0x1d')]===_0xe559('0x1e')&&typeof _0x3cfef7[_0xe559('0x1f')]===_0xe559('0x1e');var _0x114d1d=_0x279f29['count'];var _0x52fbd7=_0x1f537e?0x0:_0x3cfef7[_0xe559('0x1d')];var _0x1e3ba1=_0x1f537e?_0x279f29[_0xe559('0x20')]:_0x3cfef7[_0xe559('0x1d')]+_0x3cfef7['limit'];var _0x9d7374;if(_0x1e3ba1>=_0x114d1d){_0x1e3ba1=_0x114d1d;_0x9d7374=0xc8;}else{_0x9d7374=0xce;}_0x296667[_0xe559('0x1b')](_0x9d7374);return _0x296667[_0xe559('0x21')](_0xe559('0x22'),_0x52fbd7+'-'+_0x1e3ba1+'/'+_0x114d1d)[_0xe559('0x1c')](_0x279f29);}return null;};}function patchUpdates(_0x7fdf4e){return function(_0x5427c5){try{jsonpatch[_0xe559('0x23')](_0x5427c5,_0x7fdf4e,!![]);}catch(_0x28f0a0){return BPromise[_0xe559('0x24')](_0x28f0a0);}return _0x5427c5['save']();};}function saveUpdates(_0x415070,_0x51f8a0){return function(_0x208488){if(_0x208488){return _0x208488['update'](_0x415070)['then'](function(_0x1c62c3){return _0x1c62c3;});}return null;};}function removeEntity(_0x3ef344,_0x3fc9ce){return function(_0x46eb89){if(_0x46eb89){return _0x46eb89['destroy']()[_0xe559('0x25')](function(){_0x3ef344['status'](0xcc)[_0xe559('0x1a')]();});}};}function handleEntityNotFound(_0x2cb1d7,_0x3bc407){return function(_0xcfe3a2){if(!_0xcfe3a2){_0x2cb1d7[_0xe559('0x19')](0x194);}return _0xcfe3a2;};}function handleError(_0x5d8000,_0x307c0c){_0x307c0c=_0x307c0c||0x1f4;return function(_0x311fec){logger[_0xe559('0x26')](_0x311fec['stack']);if(_0x311fec[_0xe559('0x27')]){delete _0x311fec[_0xe559('0x27')];}_0x5d8000['status'](_0x307c0c)[_0xe559('0x28')](_0x311fec);};}function getMustacheRender(_0x172e15,_0x531c29){return Mustache['render'](_0x172e15,_['merge'](_0x531c29[_0xe559('0x29')],{'contact':_0x531c29['contact'],'message':_0x531c29[_0xe559('0x2a')],'agent':_0x531c29[_0xe559('0x2b')],'interaction':_0x531c29[_0xe559('0x2c')],'account':_0x531c29[_0xe559('0x2d')]}))||'';}exports[_0xe559('0x2e')]=function(_0xb2802e,_0x32e7f0){var _0x4d8184={},_0x2d34ac={},_0xbd4e34={'count':0x0,'rows':[]};var _0x1016b2=_['map'](db['Integration'][_0xe559('0x2f')],function(_0x1c405){return{'name':_0x1c405[_0xe559('0x30')],'type':_0x1c405[_0xe559('0x31')][_0xe559('0x32')]};});_0x2d34ac[_0xe559('0x33')]=_[_0xe559('0x34')](_0x1016b2,_0xe559('0x27'));_0x2d34ac['query']=_['keys'](_0xb2802e[_0xe559('0x35')]);_0x2d34ac[_0xe559('0x36')]=_['intersection'](_0x2d34ac[_0xe559('0x33')],_0x2d34ac[_0xe559('0x35')]);_0x4d8184[_0xe559('0x37')]=_[_0xe559('0x38')](_0x2d34ac[_0xe559('0x33')],qs[_0xe559('0x39')](_0xb2802e[_0xe559('0x35')][_0xe559('0x39')]));_0x4d8184[_0xe559('0x37')]=_0x4d8184[_0xe559('0x37')][_0xe559('0x3a')]?_0x4d8184[_0xe559('0x37')]:_0x2d34ac[_0xe559('0x33')];if(!_0xb2802e[_0xe559('0x35')][_0xe559('0x3b')](_0xe559('0x3c'))){_0x4d8184[_0xe559('0x1f')]=qs[_0xe559('0x1f')](_0xb2802e[_0xe559('0x35')][_0xe559('0x1f')]);_0x4d8184[_0xe559('0x1d')]=qs[_0xe559('0x1d')](_0xb2802e[_0xe559('0x35')]['offset']);}_0x4d8184[_0xe559('0x3d')]=qs[_0xe559('0x3e')](_0xb2802e[_0xe559('0x35')][_0xe559('0x3e')]);_0x4d8184['where']=qs[_0xe559('0x36')](_[_0xe559('0x3f')](_0xb2802e[_0xe559('0x35')],_0x2d34ac[_0xe559('0x36')]),_0x1016b2);if(_0xb2802e[_0xe559('0x35')][_0xe559('0x40')]){_0x4d8184[_0xe559('0x41')]=_[_0xe559('0x42')](_0x4d8184[_0xe559('0x41')],{'$or':_['map'](_0x1016b2,function(_0x374df7){if(_0x374df7['type']!==_0xe559('0x43')){var _0x1d9862={};_0x1d9862[_0x374df7[_0xe559('0x27')]]={'$like':'%'+_0xb2802e[_0xe559('0x35')]['filter']+'%'};return _0x1d9862;}})});}_0x4d8184=_[_0xe559('0x42')]({},_0x4d8184,_0xb2802e[_0xe559('0x44')]);var _0x2a5d67={'where':_0x4d8184[_0xe559('0x41')]};return db[_0xe559('0x45')][_0xe559('0x20')](_0x2a5d67)[_0xe559('0x25')](function(_0x25410b){_0xbd4e34[_0xe559('0x20')]=_0x25410b;if(_0xb2802e[_0xe559('0x35')][_0xe559('0x46')]){_0x4d8184[_0xe559('0x47')]=[{'all':!![]}];}return db['Integration'][_0xe559('0x48')](_0x4d8184);})['then'](function(_0x5a8c40){_0xbd4e34['rows']=_0x5a8c40;return _0xbd4e34;})[_0xe559('0x25')](respondWithFilteredResult(_0x32e7f0,_0x4d8184))[_0xe559('0x49')](handleError(_0x32e7f0,null));};exports[_0xe559('0x4a')]=function(_0x4785f4,_0x2f6fdd){var _0x1f88cc={'raw':![],'where':{'id':_0x4785f4['params']['id']}},_0x5309c1={};_0x5309c1[_0xe559('0x33')]=_['keys'](db[_0xe559('0x45')][_0xe559('0x2f')]);_0x5309c1[_0xe559('0x35')]=_[_0xe559('0x4b')](_0x4785f4[_0xe559('0x35')]);_0x5309c1[_0xe559('0x36')]=_[_0xe559('0x38')](_0x5309c1[_0xe559('0x33')],_0x5309c1[_0xe559('0x35')]);_0x1f88cc[_0xe559('0x37')]=_['intersection'](_0x5309c1[_0xe559('0x33')],qs[_0xe559('0x39')](_0x4785f4[_0xe559('0x35')][_0xe559('0x39')]));_0x1f88cc['attributes']=_0x1f88cc[_0xe559('0x37')][_0xe559('0x3a')]?_0x1f88cc[_0xe559('0x37')]:_0x5309c1['model'];if(_0x4785f4['query'][_0xe559('0x46')]){_0x1f88cc[_0xe559('0x47')]=[{'all':!![]}];}_0x1f88cc=_[_0xe559('0x42')]({},_0x1f88cc,_0x4785f4[_0xe559('0x44')]);return db[_0xe559('0x45')]['find'](_0x1f88cc)[_0xe559('0x25')](handleEntityNotFound(_0x2f6fdd,null))['then'](respondWithResult(_0x2f6fdd,null))[_0xe559('0x49')](handleError(_0x2f6fdd,null));};exports['create']=function(_0x464835,_0xf6aace){return db[_0xe559('0x45')][_0xe559('0x4c')](_0x464835['body'],{})[_0xe559('0x25')](respondWithResult(_0xf6aace,0xc9))[_0xe559('0x49')](handleError(_0xf6aace,null));};exports[_0xe559('0x4d')]=function(_0x4b3d4b,_0x4073fd){if(_0x4b3d4b[_0xe559('0x29')]['id']){delete _0x4b3d4b['body']['id'];}return db[_0xe559('0x45')]['find']({'where':{'id':_0x4b3d4b[_0xe559('0x4e')]['id']}})[_0xe559('0x25')](handleEntityNotFound(_0x4073fd,null))[_0xe559('0x25')](saveUpdates(_0x4b3d4b['body'],null))[_0xe559('0x25')](respondWithResult(_0x4073fd,null))[_0xe559('0x49')](handleError(_0x4073fd,null));};exports[_0xe559('0x4f')]=function(_0x550141,_0x27d659){return db[_0xe559('0x45')]['find']({'where':{'id':_0x550141[_0xe559('0x4e')]['id']}})[_0xe559('0x25')](handleEntityNotFound(_0x27d659,null))['then'](removeEntity(_0x27d659,null))[_0xe559('0x49')](handleError(_0x27d659,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 1429667..fc97295 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 _0x9498=['moment','bluebird','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9498,0x122));var _0x8949=function(_0x1e125c,_0x1c72cd){_0x1e125c=_0x1e125c-0x0;var _0x4d2d12=_0x9498[_0x1e125c];return _0x4d2d12;};'use strict';var _=require(_0x8949('0x0'));var util=require(_0x8949('0x1'));var logger=require(_0x8949('0x2'))(_0x8949('0x3'));var moment=require(_0x8949('0x4'));var BPromise=require(_0x8949('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8949('0x6'));var rimraf=require(_0x8949('0x7'));var config=require(_0x8949('0x8'));var attributes=require(_0x8949('0x9'));module[_0x8949('0xa')]=function(_0x187dc8,_0xbaff2e){return _0x187dc8[_0x8949('0xb')](_0x8949('0xc'),attributes,{'tableName':_0x8949('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8752=['../../config/environment','exports','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x58ab17,_0x437620){var _0x1f01bc=function(_0xccc4e5){while(--_0xccc4e5){_0x58ab17['push'](_0x58ab17['shift']());}};_0x1f01bc(++_0x437620);}(_0x8752,0x173));var _0x2875=function(_0x2a1208,_0x50b11e){_0x2a1208=_0x2a1208-0x0;var _0x8f2fd4=_0x8752[_0x2a1208];return _0x8f2fd4;};'use strict';var _=require(_0x2875('0x0'));var util=require(_0x2875('0x1'));var logger=require('../../config/logger')(_0x2875('0x2'));var moment=require('moment');var BPromise=require(_0x2875('0x3'));var rp=require(_0x2875('0x4'));var fs=require('fs');var path=require(_0x2875('0x5'));var rimraf=require(_0x2875('0x6'));var config=require(_0x2875('0x7'));var attributes=require('./integration.attributes');module[_0x2875('0x8')]=function(_0x17beaa,_0x21bd50){return _0x17beaa['define']('Integration',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 083f4e1..a49f681 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 _0x3a0f=['info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x3f01aa,_0x3afafe){var _0xebb4b3=function(_0x28fa28){while(--_0x28fa28){_0x3f01aa['push'](_0x3f01aa['shift']());}};_0xebb4b3(++_0x3afafe);}(_0x3a0f,0x145));var _0xf3a0=function(_0xdda5f1,_0x253856){_0xdda5f1=_0xdda5f1-0x0;var _0x7283f5=_0x3a0f[_0xdda5f1];return _0x7283f5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf3a0('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3a0('0x1'));var db=require(_0xf3a0('0x2'))['db'];var utils=require(_0xf3a0('0x3'));var logger=require(_0xf3a0('0x4'))(_0xf3a0('0x5'));var config=require(_0xf3a0('0x6'));var jayson=require(_0xf3a0('0x7'));var client=jayson[_0xf3a0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4736b7,_0x313b13,_0x3e550f){return new BPromise(function(_0xb2784d,_0x5d64bc){return client[_0xf3a0('0x9')](_0x4736b7,_0x3e550f)[_0xf3a0('0xa')](function(_0x214171){logger[_0xf3a0('0xb')](_0xf3a0('0xc'),_0x313b13,_0xf3a0('0xd'));logger[_0xf3a0('0xe')](_0xf3a0('0xf'),_0x313b13,'request\x20sent',JSON[_0xf3a0('0x10')](_0x214171));if(_0x214171[_0xf3a0('0x11')]){if(_0x214171[_0xf3a0('0x11')]['code']===0x1f4){logger[_0xf3a0('0x11')](_0xf3a0('0xc'),_0x313b13,_0x214171[_0xf3a0('0x11')]['message']);return _0x5d64bc(_0x214171['error'][_0xf3a0('0x12')]);}logger[_0xf3a0('0x11')](_0xf3a0('0xc'),_0x313b13,_0x214171[_0xf3a0('0x11')]['message']);return _0xb2784d(_0x214171[_0xf3a0('0x11')][_0xf3a0('0x12')]);}else{logger[_0xf3a0('0xb')](_0xf3a0('0xc'),_0x313b13,_0xf3a0('0xd'));_0xb2784d(_0x214171[_0xf3a0('0x13')][_0xf3a0('0x12')]);}})[_0xf3a0('0x14')](function(_0x59061a){logger['error'](_0xf3a0('0xc'),_0x313b13,_0x59061a);_0x5d64bc(_0x59061a);});});} \ No newline at end of file +var _0x8cce=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','Integration,\x20%s,\x20%s','result','message','lodash','util','randomstring','ioredis'];(function(_0x28a97e,_0x200fa9){var _0x1433dc=function(_0x26a5e0){while(--_0x26a5e0){_0x28a97e['push'](_0x28a97e['shift']());}};_0x1433dc(++_0x200fa9);}(_0x8cce,0xee));var _0xe8cc=function(_0x586864,_0x101f90){_0x586864=_0x586864-0x0;var _0x31e121=_0x8cce[_0x586864];return _0x31e121;};'use strict';var _=require(_0xe8cc('0x0'));var util=require(_0xe8cc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe8cc('0x2'));var fs=require('fs');var Redis=require(_0xe8cc('0x3'));var db=require(_0xe8cc('0x4'))['db'];var utils=require(_0xe8cc('0x5'));var logger=require(_0xe8cc('0x6'))(_0xe8cc('0x7'));var config=require(_0xe8cc('0x8'));var jayson=require(_0xe8cc('0x9'));var client=jayson[_0xe8cc('0xa')][_0xe8cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33a9d5,_0x422191,_0x77ba0a){return new BPromise(function(_0x4226b7,_0x5a35e0){return client['request'](_0x33a9d5,_0x77ba0a)[_0xe8cc('0xc')](function(_0x1763d2){logger[_0xe8cc('0xd')]('Integration,\x20%s,\x20%s',_0x422191,_0xe8cc('0xe'));logger[_0xe8cc('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x422191,_0xe8cc('0xe'),JSON[_0xe8cc('0x10')](_0x1763d2));if(_0x1763d2[_0xe8cc('0x11')]){if(_0x1763d2[_0xe8cc('0x11')][_0xe8cc('0x12')]===0x1f4){logger['error'](_0xe8cc('0x13'),_0x422191,_0x1763d2[_0xe8cc('0x11')]['message']);return _0x5a35e0(_0x1763d2[_0xe8cc('0x11')]['message']);}logger[_0xe8cc('0x11')](_0xe8cc('0x13'),_0x422191,_0x1763d2[_0xe8cc('0x11')]['message']);return _0x4226b7(_0x1763d2[_0xe8cc('0x11')]['message']);}else{logger[_0xe8cc('0xd')]('Integration,\x20%s,\x20%s',_0x422191,_0xe8cc('0xe'));_0x4226b7(_0x1763d2[_0xe8cc('0x14')][_0xe8cc('0x15')]);}})['catch'](function(_0x52714c){logger[_0xe8cc('0x11')]('Integration,\x20%s,\x20%s',_0x422191,_0x52714c);_0x5a35e0(_0x52714c);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 4ef4d6f..ac96dab 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 _0xc993=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete'];(function(_0x4177e3,_0x2cfcdb){var _0x2b9c1c=function(_0xc811d7){while(--_0xc811d7){_0x4177e3['push'](_0x4177e3['shift']());}};_0x2b9c1c(++_0x2cfcdb);}(_0xc993,0x17c));var _0x3c99=function(_0x2f58c9,_0x19bfd1){_0x2f58c9=_0x2f58c9-0x0;var _0x254ee4=_0xc993[_0x2f58c9];return _0x254ee4;};'use strict';var multer=require(_0x3c99('0x0'));var util=require(_0x3c99('0x1'));var path=require('path');var timeout=require(_0x3c99('0x2'));var express=require(_0x3c99('0x3'));var router=express[_0x3c99('0x4')]();var fs_extra=require(_0x3c99('0x5'));var auth=require(_0x3c99('0x6'));var interaction=require(_0x3c99('0x7'));var config=require('../../config/environment');var controller=require(_0x3c99('0x8'));router[_0x3c99('0x9')]('/',auth[_0x3c99('0xa')](),controller[_0x3c99('0xb')]);router[_0x3c99('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x3c99('0x9')]('/:id',auth[_0x3c99('0xa')](),controller[_0x3c99('0xc')]);router[_0x3c99('0xd')]('/',auth[_0x3c99('0xa')](),controller[_0x3c99('0xe')]);router[_0x3c99('0xf')](_0x3c99('0x10'),auth['isAuthenticated'](),controller[_0x3c99('0x11')]);router[_0x3c99('0x12')](_0x3c99('0x10'),auth[_0x3c99('0xa')](),controller[_0x3c99('0x13')]);module[_0x3c99('0x14')]=router; \ No newline at end of file +var _0xa90f=['fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','util','connect-timeout','Router'];(function(_0x3a7398,_0x4d56a1){var _0x20e884=function(_0x526372){while(--_0x526372){_0x3a7398['push'](_0x3a7398['shift']());}};_0x20e884(++_0x4d56a1);}(_0xa90f,0x7b));var _0xfa90=function(_0x3ab53f,_0x508ae7){_0x3ab53f=_0x3ab53f-0x0;var _0x42c654=_0xa90f[_0x3ab53f];return _0x42c654;};'use strict';var multer=require('multer');var util=require(_0xfa90('0x0'));var path=require('path');var timeout=require(_0xfa90('0x1'));var express=require('express');var router=express[_0xfa90('0x2')]();var fs_extra=require(_0xfa90('0x3'));var auth=require(_0xfa90('0x4'));var interaction=require(_0xfa90('0x5'));var config=require('../../config/environment');var controller=require(_0xfa90('0x6'));router[_0xfa90('0x7')]('/',auth[_0xfa90('0x8')](),controller[_0xfa90('0x9')]);router[_0xfa90('0x7')](_0xfa90('0xa'),auth[_0xfa90('0x8')](),controller[_0xfa90('0xb')]);router[_0xfa90('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xfa90('0xc')]);router[_0xfa90('0xd')]('/',auth[_0xfa90('0x8')](),controller[_0xfa90('0xe')]);router[_0xfa90('0xf')](_0xfa90('0x10'),auth[_0xfa90('0x8')](),controller[_0xfa90('0x11')]);router['delete']('/:id',auth[_0xfa90('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 9ab4e7c..4e704cd 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 _0x869a=['BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x300b37,_0x3b4f8b){var _0x3a89b4=function(_0x161da8){while(--_0x161da8){_0x300b37['push'](_0x300b37['shift']());}};_0x3a89b4(++_0x3b4f8b);}(_0x869a,0x1db));var _0xa869=function(_0x3e21cb,_0x1f6f52){_0x3e21cb=_0x3e21cb-0x0;var _0x5d172d=_0x869a[_0x3e21cb];return _0x5d172d;};'use strict';var Sequelize=require(_0xa869('0x0'));module[_0xa869('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xa869('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xa869('0x2')]},'uniqueid':{'type':Sequelize[_0xa869('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xa869('0x2')]},'membername':{'type':Sequelize[_0xa869('0x2')]},'agentcalledAt':{'type':Sequelize[_0xa869('0x3')]},'agentconnectAt':{'type':Sequelize[_0xa869('0x3')]},'holdtime':{'type':Sequelize[_0xa869('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa869('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xa869('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xa869('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xa869('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xa869('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xa869('0x3')]},'lastevent':{'type':Sequelize[_0xa869('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xa869('0x4')]},'channelstatedesc':{'type':Sequelize[_0xa869('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa869('0x2')]},'connectedlinename':{'type':Sequelize[_0xa869('0x2')]},'language':{'type':Sequelize[_0xa869('0x2')]},'accountcode':{'type':Sequelize[_0xa869('0x2')]},'context':{'type':Sequelize[_0xa869('0x2')]},'exten':{'type':Sequelize[_0xa869('0x2')]},'priority':{'type':Sequelize[_0xa869('0x2')]},'destchannel':{'type':Sequelize[_0xa869('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa869('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa869('0x2')]},'destcalleridname':{'type':Sequelize[_0xa869('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa869('0x2')]},'destlanguage':{'type':Sequelize[_0xa869('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xa869('0x2')]},'destexten':{'type':Sequelize[_0xa869('0x2')]},'destpriority':{'type':Sequelize[_0xa869('0x2')]},'destuniqueid':{'type':Sequelize[_0xa869('0x2')]},'messageId':{'type':Sequelize[_0xa869('0x2')]},'inReplyTo':{'type':Sequelize[_0xa869('0x2')]},'subject':{'type':Sequelize[_0xa869('0x2')]},'from':{'type':Sequelize[_0xa869('0x2')]},'to':{'type':Sequelize[_0xa869('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xa869('0x6')]},'html':{'type':Sequelize[_0xa869('0x6')]},'text':{'type':Sequelize[_0xa869('0x6')]},'status':{'type':Sequelize[_0xa869('0x7')](_0xa869('0x8'),_0xa869('0x9'),_0xa869('0xa'),_0xa869('0xb'))},'url':{'type':Sequelize[_0xa869('0x2')]},'app':{'type':Sequelize[_0xa869('0x2')]},'appdata':{'type':Sequelize[_0xa869('0x2')]},'projectId':{'type':Sequelize[_0xa869('0x4')]}}; \ No newline at end of file +var _0x8f41=['BOOLEAN','INTEGER','TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize','exports','STRING','DATE'];(function(_0x48082f,_0x531427){var _0x3b9355=function(_0x3fbb07){while(--_0x3fbb07){_0x48082f['push'](_0x48082f['shift']());}};_0x3b9355(++_0x531427);}(_0x8f41,0x8b));var _0x18f4=function(_0x1b5589,_0x460567){_0x1b5589=_0x1b5589-0x0;var _0xc935cd=_0x8f41[_0x1b5589];return _0xc935cd;};'use strict';var Sequelize=require(_0x18f4('0x0'));module[_0x18f4('0x1')]={'integration':{'type':Sequelize[_0x18f4('0x2')]},'eventChannel':{'type':Sequelize[_0x18f4('0x2')]},'exitStatus':{'type':Sequelize[_0x18f4('0x2')]},'ticketId':{'type':Sequelize[_0x18f4('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x18f4('0x2')]},'uniqueid':{'type':Sequelize[_0x18f4('0x2')]},'calleridnum':{'type':Sequelize[_0x18f4('0x2')]},'calleridname':{'type':Sequelize[_0x18f4('0x2')]},'queue':{'type':Sequelize[_0x18f4('0x2')]},'interface':{'type':Sequelize[_0x18f4('0x2')]},'membername':{'type':Sequelize[_0x18f4('0x2')]},'agentcalledAt':{'type':Sequelize[_0x18f4('0x3')]},'agentconnectAt':{'type':Sequelize[_0x18f4('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x18f4('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x18f4('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x18f4('0x3')]},'agentdump':{'type':Sequelize[_0x18f4('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x18f4('0x3')]},'lastevent':{'type':Sequelize[_0x18f4('0x2')]},'channel':{'type':Sequelize[_0x18f4('0x2')]},'channelstate':{'type':Sequelize[_0x18f4('0x5')]},'channelstatedesc':{'type':Sequelize[_0x18f4('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x18f4('0x2')]},'language':{'type':Sequelize[_0x18f4('0x2')]},'accountcode':{'type':Sequelize[_0x18f4('0x2')]},'context':{'type':Sequelize[_0x18f4('0x2')]},'exten':{'type':Sequelize[_0x18f4('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x18f4('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x18f4('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x18f4('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x18f4('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x18f4('0x2')]},'destuniqueid':{'type':Sequelize[_0x18f4('0x2')]},'messageId':{'type':Sequelize[_0x18f4('0x2')]},'inReplyTo':{'type':Sequelize[_0x18f4('0x2')]},'subject':{'type':Sequelize[_0x18f4('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x18f4('0x2')]},'cc':{'type':Sequelize[_0x18f4('0x2')]},'attachment':{'type':Sequelize[_0x18f4('0x6')]},'html':{'type':Sequelize[_0x18f4('0x6')]},'text':{'type':Sequelize[_0x18f4('0x6')]},'status':{'type':Sequelize[_0x18f4('0x7')](_0x18f4('0x8'),_0x18f4('0x9'),_0x18f4('0xa'),'FAILED')},'url':{'type':Sequelize[_0x18f4('0x2')]},'app':{'type':Sequelize[_0x18f4('0x2')]},'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 81b1c32..dc437f7 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 _0x73d2=['includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','then','error','stack','name','send','merge','contact','message','agent','account','index','map','IntegrationReport','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL'];(function(_0xbb285d,_0x3aab98){var _0x37aeb7=function(_0x946f3c){while(--_0x946f3c){_0xbb285d['push'](_0xbb285d['shift']());}};_0x37aeb7(++_0x3aab98);}(_0x73d2,0xf5));var _0x273d=function(_0x4518fa,_0xa8aad9){_0x4518fa=_0x4518fa-0x0;var _0x21090c=_0x73d2[_0x4518fa];return _0x21090c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x273d('0x0'));var zipdir=require(_0x273d('0x1'));var jsonpatch=require(_0x273d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x273d('0x3'));var Mustache=require(_0x273d('0x4'));var util=require(_0x273d('0x5'));var path=require(_0x273d('0x6'));var sox=require(_0x273d('0x7'));var csv=require(_0x273d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x273d('0x9'));var _=require(_0x273d('0xa'));var squel=require('squel');var crypto=require(_0x273d('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x273d('0x8'));var querystring=require(_0x273d('0xc'));var Papa=require(_0x273d('0xd'));var Redis=require('ioredis');var authService=require(_0x273d('0xe'));var qs=require(_0x273d('0xf'));var as=require(_0x273d('0x10'));var hardwareService=require(_0x273d('0x11'));var logger=require(_0x273d('0x12'))(_0x273d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x273d('0x14'));var db=require(_0x273d('0x15'))['db'];function respondWithStatusCode(_0x4cb178,_0x38b748){_0x38b748=_0x38b748||0xcc;return function(_0x2f9f9e){if(_0x2f9f9e){return _0x4cb178[_0x273d('0x16')](_0x38b748);}return _0x4cb178[_0x273d('0x17')](_0x38b748)[_0x273d('0x18')]();};}function respondWithResult(_0x4f418f,_0x20decc){_0x20decc=_0x20decc||0xc8;return function(_0x429981){if(_0x429981){return _0x4f418f[_0x273d('0x17')](_0x20decc)[_0x273d('0x19')](_0x429981);}};}function respondWithFilteredResult(_0x5532c2,_0x3d1f69){return function(_0x5448dc){if(_0x5448dc){var _0x149934=typeof _0x3d1f69['offset']===_0x273d('0x1a')&&typeof _0x3d1f69[_0x273d('0x1b')]===_0x273d('0x1a');var _0x1d671e=_0x5448dc['count'];var _0x35dfa3=_0x149934?0x0:_0x3d1f69[_0x273d('0x1c')];var _0x5291f8=_0x149934?_0x5448dc[_0x273d('0x1d')]:_0x3d1f69['offset']+_0x3d1f69[_0x273d('0x1b')];var _0x3296cf;if(_0x5291f8>=_0x1d671e){_0x5291f8=_0x1d671e;_0x3296cf=0xc8;}else{_0x3296cf=0xce;}_0x5532c2[_0x273d('0x17')](_0x3296cf);return _0x5532c2['set'](_0x273d('0x1e'),_0x35dfa3+'-'+_0x5291f8+'/'+_0x1d671e)[_0x273d('0x19')](_0x5448dc);}return null;};}function patchUpdates(_0x19f19e){return function(_0x1ec6d1){try{jsonpatch[_0x273d('0x1f')](_0x1ec6d1,_0x19f19e,!![]);}catch(_0x2565b5){return BPromise[_0x273d('0x20')](_0x2565b5);}return _0x1ec6d1[_0x273d('0x21')]();};}function saveUpdates(_0x3e6988,_0x523a03){return function(_0x31ba97){if(_0x31ba97){return _0x31ba97['update'](_0x3e6988)['then'](function(_0x11ade0){return _0x11ade0;});}return null;};}function removeEntity(_0x16f2d9,_0x5b4440){return function(_0x209586){if(_0x209586){return _0x209586['destroy']()[_0x273d('0x22')](function(){_0x16f2d9[_0x273d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x365123,_0x2e8dbc){return function(_0x57d33b){if(!_0x57d33b){_0x365123[_0x273d('0x16')](0x194);}return _0x57d33b;};}function handleError(_0x10f3ee,_0x40f25f){_0x40f25f=_0x40f25f||0x1f4;return function(_0x3c4d96){logger[_0x273d('0x23')](_0x3c4d96[_0x273d('0x24')]);if(_0x3c4d96[_0x273d('0x25')]){delete _0x3c4d96[_0x273d('0x25')];}_0x10f3ee[_0x273d('0x17')](_0x40f25f)[_0x273d('0x26')](_0x3c4d96);};}function getMustacheRender(_0x32162e,_0x301073){return Mustache['render'](_0x32162e,_[_0x273d('0x27')](_0x301073['body'],{'contact':_0x301073[_0x273d('0x28')],'message':_0x301073[_0x273d('0x29')],'agent':_0x301073[_0x273d('0x2a')],'interaction':_0x301073['interaction'],'account':_0x301073[_0x273d('0x2b')]}))||'';}exports[_0x273d('0x2c')]=function(_0x2deccd,_0x128c83){var _0x1b2e34={},_0x49377e={},_0x13069={'count':0x0,'rows':[]};var _0x4c7971=_[_0x273d('0x2d')](db[_0x273d('0x2e')][_0x273d('0x2f')],function(_0x18c65f){return{'name':_0x18c65f['fieldName'],'type':_0x18c65f[_0x273d('0x30')]['key']};});_0x49377e[_0x273d('0x31')]=_[_0x273d('0x2d')](_0x4c7971,_0x273d('0x25'));_0x49377e[_0x273d('0x32')]=_['keys'](_0x2deccd[_0x273d('0x32')]);_0x49377e[_0x273d('0x33')]=_['intersection'](_0x49377e[_0x273d('0x31')],_0x49377e[_0x273d('0x32')]);_0x1b2e34[_0x273d('0x34')]=_[_0x273d('0x35')](_0x49377e[_0x273d('0x31')],qs[_0x273d('0x36')](_0x2deccd[_0x273d('0x32')][_0x273d('0x36')]));_0x1b2e34[_0x273d('0x34')]=_0x1b2e34[_0x273d('0x34')][_0x273d('0x37')]?_0x1b2e34[_0x273d('0x34')]:_0x49377e['model'];if(!_0x2deccd['query'][_0x273d('0x38')](_0x273d('0x39'))){_0x1b2e34[_0x273d('0x1b')]=qs[_0x273d('0x1b')](_0x2deccd[_0x273d('0x32')][_0x273d('0x1b')]);_0x1b2e34[_0x273d('0x1c')]=qs['offset'](_0x2deccd[_0x273d('0x32')][_0x273d('0x1c')]);}_0x1b2e34['order']=qs[_0x273d('0x3a')](_0x2deccd[_0x273d('0x32')]['sort']);_0x1b2e34[_0x273d('0x3b')]=qs[_0x273d('0x33')](_[_0x273d('0x3c')](_0x2deccd[_0x273d('0x32')],_0x49377e[_0x273d('0x33')]),_0x4c7971);if(_0x2deccd['query'][_0x273d('0x3d')]){_0x1b2e34[_0x273d('0x3b')]=_['merge'](_0x1b2e34[_0x273d('0x3b')],{'$or':_[_0x273d('0x2d')](_0x4c7971,function(_0x208f01){if(_0x208f01[_0x273d('0x30')]!==_0x273d('0x3e')){var _0x2284e2={};_0x2284e2[_0x208f01[_0x273d('0x25')]]={'$like':'%'+_0x2deccd[_0x273d('0x32')][_0x273d('0x3d')]+'%'};return _0x2284e2;}})});}_0x1b2e34=_[_0x273d('0x27')]({},_0x1b2e34,_0x2deccd['options']);var _0x20ab9a={'where':_0x1b2e34[_0x273d('0x3b')]};return db[_0x273d('0x2e')]['count'](_0x20ab9a)[_0x273d('0x22')](function(_0xf84e41){_0x13069[_0x273d('0x1d')]=_0xf84e41;if(_0x2deccd[_0x273d('0x32')][_0x273d('0x3f')]){_0x1b2e34[_0x273d('0x40')]=[{'all':!![]}];}return db[_0x273d('0x2e')][_0x273d('0x41')](_0x1b2e34);})[_0x273d('0x22')](function(_0x3939f2){_0x13069[_0x273d('0x42')]=_0x3939f2;return _0x13069;})[_0x273d('0x22')](respondWithFilteredResult(_0x128c83,_0x1b2e34))[_0x273d('0x43')](handleError(_0x128c83,null));};exports[_0x273d('0x44')]=function(_0x3baecf,_0x4834c6){var _0x4a8858={'raw':![],'where':{'id':_0x3baecf[_0x273d('0x45')]['id']}},_0x2bd013={};_0x2bd013[_0x273d('0x31')]=_[_0x273d('0x46')](db[_0x273d('0x2e')][_0x273d('0x2f')]);_0x2bd013['query']=_[_0x273d('0x46')](_0x3baecf[_0x273d('0x32')]);_0x2bd013[_0x273d('0x33')]=_[_0x273d('0x35')](_0x2bd013[_0x273d('0x31')],_0x2bd013[_0x273d('0x32')]);_0x4a8858[_0x273d('0x34')]=_[_0x273d('0x35')](_0x2bd013[_0x273d('0x31')],qs[_0x273d('0x36')](_0x3baecf[_0x273d('0x32')][_0x273d('0x36')]));_0x4a8858['attributes']=_0x4a8858['attributes'][_0x273d('0x37')]?_0x4a8858[_0x273d('0x34')]:_0x2bd013[_0x273d('0x31')];if(_0x3baecf[_0x273d('0x32')][_0x273d('0x3f')]){_0x4a8858['include']=[{'all':!![]}];}_0x4a8858=_[_0x273d('0x27')]({},_0x4a8858,_0x3baecf[_0x273d('0x47')]);return db[_0x273d('0x2e')][_0x273d('0x48')](_0x4a8858)['then'](handleEntityNotFound(_0x4834c6,null))[_0x273d('0x22')](respondWithResult(_0x4834c6,null))[_0x273d('0x43')](handleError(_0x4834c6,null));};exports[_0x273d('0x49')]=function(_0x5292a0,_0x4c8a36){return db[_0x273d('0x2e')][_0x273d('0x49')](_0x5292a0[_0x273d('0x4a')],{})[_0x273d('0x22')](respondWithResult(_0x4c8a36,0xc9))['catch'](handleError(_0x4c8a36,null));};exports[_0x273d('0x4b')]=function(_0x29c1e1,_0x102340){if(_0x29c1e1[_0x273d('0x4a')]['id']){delete _0x29c1e1['body']['id'];}return db[_0x273d('0x2e')][_0x273d('0x48')]({'where':{'id':_0x29c1e1['params']['id']}})[_0x273d('0x22')](handleEntityNotFound(_0x102340,null))['then'](saveUpdates(_0x29c1e1[_0x273d('0x4a')],null))[_0x273d('0x22')](respondWithResult(_0x102340,null))['catch'](handleError(_0x102340,null));};exports['destroy']=function(_0x486dbc,_0x48d8db){return db['IntegrationReport']['find']({'where':{'id':_0x486dbc[_0x273d('0x45')]['id']}})[_0x273d('0x22')](handleEntityNotFound(_0x48d8db,null))['then'](removeEntity(_0x48d8db,null))['catch'](handleError(_0x48d8db,null));};exports[_0x273d('0x4c')]=function(_0x2ac66f,_0x2dc281){return db[_0x273d('0x2e')][_0x273d('0x4c')]()[_0x273d('0x22')](respondWithResult(_0x2dc281,null))[_0x273d('0x43')](handleError(_0x2dc281,null));}; \ No newline at end of file +var _0x803c=['order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','error','stack','name','send','render','merge','contact','message','agent','interaction','account','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x2ab1ea,_0x1cf9bf){var _0x5dbbc5=function(_0x5bb1e4){while(--_0x5bb1e4){_0x2ab1ea['push'](_0x2ab1ea['shift']());}};_0x5dbbc5(++_0x1cf9bf);}(_0x803c,0x67));var _0xc803=function(_0x55f209,_0x500316){_0x55f209=_0x55f209-0x0;var _0x31acd1=_0x803c[_0x55f209];return _0x31acd1;};'use strict';var emlformat=require(_0xc803('0x0'));var rimraf=require(_0xc803('0x1'));var zipdir=require(_0xc803('0x2'));var jsonpatch=require(_0xc803('0x3'));var rp=require(_0xc803('0x4'));var moment=require('moment');var BPromise=require(_0xc803('0x5'));var Mustache=require(_0xc803('0x6'));var util=require('util');var path=require(_0xc803('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc803('0x8'));var fs=require('fs');var fs_extra=require(_0xc803('0x9'));var _=require(_0xc803('0xa'));var squel=require(_0xc803('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc803('0xc'));var toCsv=require(_0xc803('0xd'));var querystring=require(_0xc803('0xe'));var Papa=require(_0xc803('0xf'));var Redis=require(_0xc803('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc803('0x11'));var as=require(_0xc803('0x12'));var hardwareService=require(_0xc803('0x13'));var logger=require(_0xc803('0x14'))(_0xc803('0x15'));var utils=require('../../config/utils');var config=require(_0xc803('0x16'));var licenseUtil=require(_0xc803('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cc025,_0x4975c4){_0x4975c4=_0x4975c4||0xcc;return function(_0x2288ac){if(_0x2288ac){return _0x1cc025[_0xc803('0x18')](_0x4975c4);}return _0x1cc025['status'](_0x4975c4)[_0xc803('0x19')]();};}function respondWithResult(_0x2bb6bf,_0x2f9227){_0x2f9227=_0x2f9227||0xc8;return function(_0x21ccf6){if(_0x21ccf6){return _0x2bb6bf[_0xc803('0x1a')](_0x2f9227)[_0xc803('0x1b')](_0x21ccf6);}};}function respondWithFilteredResult(_0x4c85b0,_0x4f0f26){return function(_0x35207a){if(_0x35207a){var _0x3e64b4=typeof _0x4f0f26[_0xc803('0x1c')]===_0xc803('0x1d')&&typeof _0x4f0f26[_0xc803('0x1e')]===_0xc803('0x1d');var _0x43ff72=_0x35207a[_0xc803('0x1f')];var _0x51faad=_0x3e64b4?0x0:_0x4f0f26[_0xc803('0x1c')];var _0x27f198=_0x3e64b4?_0x35207a[_0xc803('0x1f')]:_0x4f0f26[_0xc803('0x1c')]+_0x4f0f26[_0xc803('0x1e')];var _0x47284c;if(_0x27f198>=_0x43ff72){_0x27f198=_0x43ff72;_0x47284c=0xc8;}else{_0x47284c=0xce;}_0x4c85b0[_0xc803('0x1a')](_0x47284c);return _0x4c85b0[_0xc803('0x20')](_0xc803('0x21'),_0x51faad+'-'+_0x27f198+'/'+_0x43ff72)[_0xc803('0x1b')](_0x35207a);}return null;};}function patchUpdates(_0x4c5e82){return function(_0x135232){try{jsonpatch['apply'](_0x135232,_0x4c5e82,!![]);}catch(_0x1eb9fb){return BPromise[_0xc803('0x22')](_0x1eb9fb);}return _0x135232[_0xc803('0x23')]();};}function saveUpdates(_0x3b7c20,_0x2eed2c){return function(_0x3b372d){if(_0x3b372d){return _0x3b372d['update'](_0x3b7c20)[_0xc803('0x24')](function(_0x3a0420){return _0x3a0420;});}return null;};}function removeEntity(_0x6898e7,_0x507dde){return function(_0x57b42a){if(_0x57b42a){return _0x57b42a['destroy']()[_0xc803('0x24')](function(){_0x6898e7[_0xc803('0x1a')](0xcc)[_0xc803('0x19')]();});}};}function handleEntityNotFound(_0x370b6d,_0x4d0aa4){return function(_0x8f3bc9){if(!_0x8f3bc9){_0x370b6d[_0xc803('0x18')](0x194);}return _0x8f3bc9;};}function handleError(_0x3f6ee4,_0x3c8f13){_0x3c8f13=_0x3c8f13||0x1f4;return function(_0x401e20){logger[_0xc803('0x25')](_0x401e20[_0xc803('0x26')]);if(_0x401e20[_0xc803('0x27')]){delete _0x401e20[_0xc803('0x27')];}_0x3f6ee4[_0xc803('0x1a')](_0x3c8f13)[_0xc803('0x28')](_0x401e20);};}function getMustacheRender(_0x5a55a5,_0x1129a0){return Mustache[_0xc803('0x29')](_0x5a55a5,_[_0xc803('0x2a')](_0x1129a0['body'],{'contact':_0x1129a0[_0xc803('0x2b')],'message':_0x1129a0[_0xc803('0x2c')],'agent':_0x1129a0[_0xc803('0x2d')],'interaction':_0x1129a0[_0xc803('0x2e')],'account':_0x1129a0[_0xc803('0x2f')]}))||'';}exports[_0xc803('0x30')]=function(_0x44b062,_0x110693){var _0x24bc73={},_0x25f8b9={},_0x5186e2={'count':0x0,'rows':[]};var _0x2ed5e2=_[_0xc803('0x31')](db[_0xc803('0x32')][_0xc803('0x33')],function(_0x28dfd5){return{'name':_0x28dfd5[_0xc803('0x34')],'type':_0x28dfd5[_0xc803('0x35')][_0xc803('0x36')]};});_0x25f8b9[_0xc803('0x37')]=_[_0xc803('0x31')](_0x2ed5e2,_0xc803('0x27'));_0x25f8b9[_0xc803('0x38')]=_[_0xc803('0x39')](_0x44b062[_0xc803('0x38')]);_0x25f8b9[_0xc803('0x3a')]=_[_0xc803('0x3b')](_0x25f8b9[_0xc803('0x37')],_0x25f8b9[_0xc803('0x38')]);_0x24bc73[_0xc803('0x3c')]=_['intersection'](_0x25f8b9[_0xc803('0x37')],qs[_0xc803('0x3d')](_0x44b062[_0xc803('0x38')][_0xc803('0x3d')]));_0x24bc73[_0xc803('0x3c')]=_0x24bc73['attributes'][_0xc803('0x3e')]?_0x24bc73[_0xc803('0x3c')]:_0x25f8b9['model'];if(!_0x44b062[_0xc803('0x38')][_0xc803('0x3f')](_0xc803('0x40'))){_0x24bc73[_0xc803('0x1e')]=qs['limit'](_0x44b062[_0xc803('0x38')]['limit']);_0x24bc73['offset']=qs[_0xc803('0x1c')](_0x44b062[_0xc803('0x38')][_0xc803('0x1c')]);}_0x24bc73[_0xc803('0x41')]=qs['sort'](_0x44b062['query'][_0xc803('0x42')]);_0x24bc73[_0xc803('0x43')]=qs[_0xc803('0x3a')](_[_0xc803('0x44')](_0x44b062['query'],_0x25f8b9[_0xc803('0x3a')]),_0x2ed5e2);if(_0x44b062[_0xc803('0x38')][_0xc803('0x45')]){_0x24bc73['where']=_[_0xc803('0x2a')](_0x24bc73[_0xc803('0x43')],{'$or':_['map'](_0x2ed5e2,function(_0x5297d1){if(_0x5297d1[_0xc803('0x35')]!=='VIRTUAL'){var _0x51529c={};_0x51529c[_0x5297d1[_0xc803('0x27')]]={'$like':'%'+_0x44b062[_0xc803('0x38')]['filter']+'%'};return _0x51529c;}})});}_0x24bc73=_[_0xc803('0x2a')]({},_0x24bc73,_0x44b062[_0xc803('0x46')]);var _0x5c6a3d={'where':_0x24bc73['where']};return db['IntegrationReport']['count'](_0x5c6a3d)['then'](function(_0x105dc2){_0x5186e2[_0xc803('0x1f')]=_0x105dc2;if(_0x44b062[_0xc803('0x38')][_0xc803('0x47')]){_0x24bc73[_0xc803('0x48')]=[{'all':!![]}];}return db[_0xc803('0x32')][_0xc803('0x49')](_0x24bc73);})[_0xc803('0x24')](function(_0x3af255){_0x5186e2[_0xc803('0x4a')]=_0x3af255;return _0x5186e2;})[_0xc803('0x24')](respondWithFilteredResult(_0x110693,_0x24bc73))[_0xc803('0x4b')](handleError(_0x110693,null));};exports[_0xc803('0x4c')]=function(_0x42aca3,_0x3dca9e){var _0x304b4c={'raw':![],'where':{'id':_0x42aca3['params']['id']}},_0x69379={};_0x69379[_0xc803('0x37')]=_[_0xc803('0x39')](db[_0xc803('0x32')][_0xc803('0x33')]);_0x69379[_0xc803('0x38')]=_[_0xc803('0x39')](_0x42aca3['query']);_0x69379[_0xc803('0x3a')]=_[_0xc803('0x3b')](_0x69379['model'],_0x69379[_0xc803('0x38')]);_0x304b4c[_0xc803('0x3c')]=_[_0xc803('0x3b')](_0x69379[_0xc803('0x37')],qs[_0xc803('0x3d')](_0x42aca3[_0xc803('0x38')][_0xc803('0x3d')]));_0x304b4c[_0xc803('0x3c')]=_0x304b4c[_0xc803('0x3c')][_0xc803('0x3e')]?_0x304b4c[_0xc803('0x3c')]:_0x69379[_0xc803('0x37')];if(_0x42aca3[_0xc803('0x38')][_0xc803('0x47')]){_0x304b4c[_0xc803('0x48')]=[{'all':!![]}];}_0x304b4c=_['merge']({},_0x304b4c,_0x42aca3[_0xc803('0x46')]);return db[_0xc803('0x32')][_0xc803('0x4d')](_0x304b4c)['then'](handleEntityNotFound(_0x3dca9e,null))[_0xc803('0x24')](respondWithResult(_0x3dca9e,null))[_0xc803('0x4b')](handleError(_0x3dca9e,null));};exports[_0xc803('0x4e')]=function(_0x5b005b,_0x4f53b8){return db[_0xc803('0x32')][_0xc803('0x4e')](_0x5b005b[_0xc803('0x4f')],{})[_0xc803('0x24')](respondWithResult(_0x4f53b8,0xc9))[_0xc803('0x4b')](handleError(_0x4f53b8,null));};exports[_0xc803('0x50')]=function(_0x1c13fb,_0x2e2803){if(_0x1c13fb[_0xc803('0x4f')]['id']){delete _0x1c13fb[_0xc803('0x4f')]['id'];}return db[_0xc803('0x32')]['find']({'where':{'id':_0x1c13fb[_0xc803('0x51')]['id']}})[_0xc803('0x24')](handleEntityNotFound(_0x2e2803,null))[_0xc803('0x24')](saveUpdates(_0x1c13fb[_0xc803('0x4f')],null))[_0xc803('0x24')](respondWithResult(_0x2e2803,null))[_0xc803('0x4b')](handleError(_0x2e2803,null));};exports[_0xc803('0x52')]=function(_0x11698f,_0x52bfbc){return db[_0xc803('0x32')][_0xc803('0x4d')]({'where':{'id':_0x11698f[_0xc803('0x51')]['id']}})['then'](handleEntityNotFound(_0x52bfbc,null))[_0xc803('0x24')](removeEntity(_0x52bfbc,null))[_0xc803('0x4b')](handleError(_0x52bfbc,null));};exports['describe']=function(_0x1c7e54,_0x52836b){return db[_0xc803('0x32')][_0xc803('0x53')]()[_0xc803('0x24')](respondWithResult(_0x52836b,null))[_0xc803('0x4b')](handleError(_0x52836b,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index e8c1ba7..55f4d4b 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 _0x7225=['util','../../config/logger','bluebird','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration'];(function(_0x54c45b,_0x1f41c6){var _0x504d10=function(_0x275e59){while(--_0x275e59){_0x54c45b['push'](_0x54c45b['shift']());}};_0x504d10(++_0x1f41c6);}(_0x7225,0xfc));var _0x5722=function(_0x415991,_0x2cdec4){_0x415991=_0x415991-0x0;var _0x108557=_0x7225[_0x415991];return _0x108557;};'use strict';var _=require('lodash');var util=require(_0x5722('0x0'));var logger=require(_0x5722('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5722('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5722('0x3'));var attributes=require(_0x5722('0x4'));module[_0x5722('0x5')]=function(_0x2d08f5,_0x3ebd46){return _0x2d08f5[_0x5722('0x6')](_0x5722('0x7'),attributes,{'tableName':_0x5722('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39e6=['define','IntegrationReport','report_integration','util','api','moment','bluebird','path','../../config/environment','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x39e6,0x7b));var _0x639e=function(_0x32a202,_0x51052a){_0x32a202=_0x32a202-0x0;var _0x141ab6=_0x39e6[_0x32a202];return _0x141ab6;};'use strict';var _=require('lodash');var util=require(_0x639e('0x0'));var logger=require('../../config/logger')(_0x639e('0x1'));var moment=require(_0x639e('0x2'));var BPromise=require(_0x639e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x639e('0x4'));var rimraf=require('rimraf');var config=require(_0x639e('0x5'));var attributes=require('./integrationReport.attributes');module[_0x639e('0x6')]=function(_0x25f2fe,_0x2fb0a4){return _0x25f2fe[_0x639e('0x7')](_0x639e('0x8'),attributes,{'tableName':_0x639e('0x9'),'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 129cfac..334f794 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x25b022,_0x394a08){var _0x2e13a5=function(_0xe9495d){while(--_0xe9495d){_0x25b022['push'](_0x25b022['shift']());}};_0x2e13a5(++_0x394a08);}(_0x14a0,0x8e));var _0x014a=function(_0x263a5e,_0x10702e){_0x263a5e=_0x263a5e-0x0;var _0x2245fe=_0x14a0[_0x263a5e];return _0x2245fe;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0xbaf0=['client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x538c70,_0x35531f){var _0x42ae01=function(_0x5c7368){while(--_0x5c7368){_0x538c70['push'](_0x538c70['shift']());}};_0x42ae01(++_0x35531f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index b3de2a9..bdd1378 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 _0x27d0=['post','create','addInterval','addIntervals','put','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','./interval.controller','get','isAuthenticated','/:id','show','/:id/sub_intervals'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x27d0,0x84));var _0x027d=function(_0x28907a,_0x50ab9e){_0x28907a=_0x28907a-0x0;var _0xef7b93=_0x27d0[_0x28907a];return _0xef7b93;};'use strict';var multer=require(_0x027d('0x0'));var util=require(_0x027d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x027d('0x2'));var router=express[_0x027d('0x3')]();var fs_extra=require(_0x027d('0x4'));var auth=require(_0x027d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x027d('0x6'));router[_0x027d('0x7')]('/',auth[_0x027d('0x8')](),controller['index']);router[_0x027d('0x7')](_0x027d('0x9'),auth['isAuthenticated'](),controller[_0x027d('0xa')]);router[_0x027d('0x7')](_0x027d('0xb'),auth[_0x027d('0x8')](),controller['getIntervals']);router[_0x027d('0xc')]('/',auth[_0x027d('0x8')](),controller[_0x027d('0xd')]);router[_0x027d('0xc')](_0x027d('0xb'),auth['isAuthenticated'](),controller[_0x027d('0xe')]);router[_0x027d('0xc')]('/:id/sub_intervals/create_many',auth[_0x027d('0x8')](),controller[_0x027d('0xf')]);router[_0x027d('0x10')](_0x027d('0x9'),auth[_0x027d('0x8')](),controller['update']);router['delete'](_0x027d('0x9'),auth[_0x027d('0x8')](),controller[_0x027d('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe6a5=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xe6a5,0x13b));var _0x5e6a=function(_0x2171eb,_0x56d6b7){_0x2171eb=_0x2171eb-0x0;var _0x35c9fc=_0xe6a5[_0x2171eb];return _0x35c9fc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5e6a('0x0'));var express=require(_0x5e6a('0x1'));var router=express[_0x5e6a('0x2')]();var fs_extra=require(_0x5e6a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5e6a('0x4'));var config=require('../../config/environment');var controller=require(_0x5e6a('0x5'));router[_0x5e6a('0x6')]('/',auth[_0x5e6a('0x7')](),controller[_0x5e6a('0x8')]);router[_0x5e6a('0x6')](_0x5e6a('0x9'),auth[_0x5e6a('0x7')](),controller[_0x5e6a('0xa')]);router[_0x5e6a('0x6')](_0x5e6a('0xb'),auth[_0x5e6a('0x7')](),controller['getIntervals']);router[_0x5e6a('0xc')]('/',auth['isAuthenticated'](),controller[_0x5e6a('0xd')]);router[_0x5e6a('0xc')]('/:id/sub_intervals',auth[_0x5e6a('0x7')](),controller[_0x5e6a('0xe')]);router[_0x5e6a('0xc')](_0x5e6a('0xf'),auth[_0x5e6a('0x7')](),controller[_0x5e6a('0x10')]);router[_0x5e6a('0x11')](_0x5e6a('0x9'),auth['isAuthenticated'](),controller[_0x5e6a('0x12')]);router[_0x5e6a('0x13')](_0x5e6a('0x9'),auth[_0x5e6a('0x7')](),controller['destroy']);module[_0x5e6a('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 4aee08b..588f91e 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 _0xad4a=['STRING','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xad4a,0x18a));var _0xaad4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xad4a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaad4('0x0'));module[_0xaad4('0x1')]={'name':{'type':Sequelize[_0xaad4('0x2')]},'description':{'type':Sequelize[_0xaad4('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x0efb=['exports','STRING','sequelize'];(function(_0x3776b4,_0x19a1e3){var _0x1636d9=function(_0x320ae3){while(--_0x320ae3){_0x3776b4['push'](_0x3776b4['shift']());}};_0x1636d9(++_0x19a1e3);}(_0x0efb,0x1c7));var _0xb0ef=function(_0x8c8176,_0x5360a1){_0x8c8176=_0x8c8176-0x0;var _0x4dc47b=_0x0efb[_0x8c8176];return _0x4dc47b;};'use strict';var Sequelize=require(_0xb0ef('0x0'));module[_0xb0ef('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb0ef('0x2')]},'interval':{'type':Sequelize[_0xb0ef('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 13b2d88..85cb307 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 _0xdcdf=['params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','findOne','length','addIntervals','transaction','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','get','Intervals','UserProfileResource','destroy','then','end','sendStatus','error','name','send','render','merge','contact','message','agent','interaction','account','index','map','Interval','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','findAll','rows','catch','show'];(function(_0x39c23d,_0x1da070){var _0x300680=function(_0x965f59){while(--_0x965f59){_0x39c23d['push'](_0x39c23d['shift']());}};_0x300680(++_0x1da070);}(_0xdcdf,0x132));var _0xfdcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdcdf[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfdcd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfdcd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfdcd('0x2'));var moment=require(_0xfdcd('0x3'));var BPromise=require(_0xfdcd('0x4'));var Mustache=require('mustache');var util=require(_0xfdcd('0x5'));var path=require('path');var sox=require(_0xfdcd('0x6'));var csv=require(_0xfdcd('0x7'));var ejs=require(_0xfdcd('0x8'));var fs=require('fs');var fs_extra=require(_0xfdcd('0x9'));var _=require(_0xfdcd('0xa'));var squel=require('squel');var crypto=require(_0xfdcd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfdcd('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfdcd('0xd'));var Papa=require('papaparse');var Redis=require(_0xfdcd('0xe'));var authService=require(_0xfdcd('0xf'));var qs=require(_0xfdcd('0x10'));var as=require(_0xfdcd('0x11'));var hardwareService=require(_0xfdcd('0x12'));var logger=require(_0xfdcd('0x13'))(_0xfdcd('0x14'));var utils=require('../../config/utils');var config=require(_0xfdcd('0x15'));var licenseUtil=require(_0xfdcd('0x16'));var db=require(_0xfdcd('0x17'))['db'];var extensions=require(_0xfdcd('0x18'));function respondWithStatusCode(_0x2af953,_0xbc5f52){_0xbc5f52=_0xbc5f52||0xcc;return function(_0x55efd7){if(_0x55efd7){return _0x2af953['sendStatus'](_0xbc5f52);}return _0x2af953[_0xfdcd('0x19')](_0xbc5f52)['end']();};}function respondWithResult(_0x24fece,_0x295015){_0x295015=_0x295015||0xc8;return function(_0x319109){if(_0x319109){return _0x24fece['status'](_0x295015)[_0xfdcd('0x1a')](_0x319109);}};}function respondWithFilteredResult(_0x150af1,_0x311828){return function(_0x4a1b87){if(_0x4a1b87){var _0x54f654=typeof _0x311828[_0xfdcd('0x1b')]==='undefined'&&typeof _0x311828[_0xfdcd('0x1c')]===_0xfdcd('0x1d');var _0x48b31d=_0x4a1b87[_0xfdcd('0x1e')];var _0x169ece=_0x54f654?0x0:_0x311828[_0xfdcd('0x1b')];var _0x71bc8=_0x54f654?_0x4a1b87[_0xfdcd('0x1e')]:_0x311828[_0xfdcd('0x1b')]+_0x311828[_0xfdcd('0x1c')];var _0x58e244;if(_0x71bc8>=_0x48b31d){_0x71bc8=_0x48b31d;_0x58e244=0xc8;}else{_0x58e244=0xce;}_0x150af1[_0xfdcd('0x19')](_0x58e244);return _0x150af1[_0xfdcd('0x1f')](_0xfdcd('0x20'),_0x169ece+'-'+_0x71bc8+'/'+_0x48b31d)[_0xfdcd('0x1a')](_0x4a1b87);}return null;};}function patchUpdates(_0x363c39){return function(_0x1b0fa0){try{jsonpatch[_0xfdcd('0x21')](_0x1b0fa0,_0x363c39,!![]);}catch(_0x1cb630){return BPromise['reject'](_0x1cb630);}return _0x1b0fa0[_0xfdcd('0x22')]();};}function saveUpdates(_0x49e540,_0x5750af){return function(_0xdf75b7){if(_0xdf75b7){return _0xdf75b7['update'](_0x49e540)['then'](function(_0x4eb568){return _0x4eb568;});}return null;};}function removeEntity(_0x40c673,_0x34f00e){return function(_0x105037){if(_0x105037){return _0x105037['destroy']()['then'](function(){var _0x143cc7=_0x105037[_0xfdcd('0x23')]({'plain':!![]});var _0x1e0cfd=_0xfdcd('0x24');return db[_0xfdcd('0x25')][_0xfdcd('0x26')]({'where':{'type':_0x1e0cfd,'resourceId':_0x143cc7['id']}})[_0xfdcd('0x27')](function(){return _0x105037;});})[_0xfdcd('0x27')](function(){_0x40c673[_0xfdcd('0x19')](0xcc)[_0xfdcd('0x28')]();});}};}function handleEntityNotFound(_0x15abcb,_0x59cd74){return function(_0x1193a3){if(!_0x1193a3){_0x15abcb[_0xfdcd('0x29')](0x194);}return _0x1193a3;};}function handleError(_0x5d1876,_0xdbedd2){_0xdbedd2=_0xdbedd2||0x1f4;return function(_0x12d39d){logger[_0xfdcd('0x2a')](_0x12d39d['stack']);if(_0x12d39d[_0xfdcd('0x2b')]){delete _0x12d39d['name'];}_0x5d1876[_0xfdcd('0x19')](_0xdbedd2)[_0xfdcd('0x2c')](_0x12d39d);};}function getMustacheRender(_0x3771a4,_0x559a17){return Mustache[_0xfdcd('0x2d')](_0x3771a4,_[_0xfdcd('0x2e')](_0x559a17['body'],{'contact':_0x559a17[_0xfdcd('0x2f')],'message':_0x559a17[_0xfdcd('0x30')],'agent':_0x559a17[_0xfdcd('0x31')],'interaction':_0x559a17[_0xfdcd('0x32')],'account':_0x559a17[_0xfdcd('0x33')]}))||'';}exports[_0xfdcd('0x34')]=function(_0x1afc8b,_0x115359){var _0x5a8abd={},_0x3880b9={},_0x1347cf={'count':0x0,'rows':[]};var _0x353b9b=_[_0xfdcd('0x35')](db[_0xfdcd('0x36')][_0xfdcd('0x37')],function(_0x142430){return{'name':_0x142430[_0xfdcd('0x38')],'type':_0x142430[_0xfdcd('0x39')][_0xfdcd('0x3a')]};});_0x3880b9['model']=_['map'](_0x353b9b,_0xfdcd('0x2b'));_0x3880b9[_0xfdcd('0x3b')]=_['keys'](_0x1afc8b[_0xfdcd('0x3b')]);_0x3880b9[_0xfdcd('0x3c')]=_[_0xfdcd('0x3d')](_0x3880b9[_0xfdcd('0x3e')],_0x3880b9[_0xfdcd('0x3b')]);_0x5a8abd['attributes']=_[_0xfdcd('0x3d')](_0x3880b9[_0xfdcd('0x3e')],qs['fields'](_0x1afc8b[_0xfdcd('0x3b')][_0xfdcd('0x3f')]));_0x5a8abd[_0xfdcd('0x40')]=_0x5a8abd[_0xfdcd('0x40')]['length']?_0x5a8abd[_0xfdcd('0x40')]:_0x3880b9[_0xfdcd('0x3e')];if(!_0x1afc8b[_0xfdcd('0x3b')][_0xfdcd('0x41')](_0xfdcd('0x42'))){_0x5a8abd['limit']=qs[_0xfdcd('0x1c')](_0x1afc8b[_0xfdcd('0x3b')]['limit']);_0x5a8abd['offset']=qs[_0xfdcd('0x1b')](_0x1afc8b['query'][_0xfdcd('0x1b')]);}_0x5a8abd[_0xfdcd('0x43')]=qs[_0xfdcd('0x44')](_0x1afc8b[_0xfdcd('0x3b')][_0xfdcd('0x44')]);_0x5a8abd[_0xfdcd('0x45')]=qs[_0xfdcd('0x3c')](_[_0xfdcd('0x46')](_0x1afc8b[_0xfdcd('0x3b')],_0x3880b9[_0xfdcd('0x3c')]),_0x353b9b);if(_0x1afc8b[_0xfdcd('0x3b')]['filter']){_0x5a8abd[_0xfdcd('0x45')]=_[_0xfdcd('0x2e')](_0x5a8abd['where'],{'$or':_[_0xfdcd('0x35')](_0x353b9b,function(_0x2d1bd7){if(_0x2d1bd7[_0xfdcd('0x39')]!=='VIRTUAL'){var _0x440974={};_0x440974[_0x2d1bd7['name']]={'$like':'%'+_0x1afc8b[_0xfdcd('0x3b')][_0xfdcd('0x47')]+'%'};return _0x440974;}})});}_0x5a8abd=_[_0xfdcd('0x2e')]({},_0x5a8abd,_0x1afc8b[_0xfdcd('0x48')]);var _0x7eeff1={'where':_0x5a8abd[_0xfdcd('0x45')]};return db['Interval'][_0xfdcd('0x1e')](_0x7eeff1)['then'](function(_0x279700){_0x1347cf[_0xfdcd('0x1e')]=_0x279700;if(_0x1afc8b[_0xfdcd('0x3b')][_0xfdcd('0x49')]){_0x5a8abd['include']=[{'all':!![]}];}return db[_0xfdcd('0x36')][_0xfdcd('0x4a')](_0x5a8abd);})[_0xfdcd('0x27')](function(_0x44dab0){_0x1347cf[_0xfdcd('0x4b')]=_0x44dab0;return _0x1347cf;})[_0xfdcd('0x27')](respondWithFilteredResult(_0x115359,_0x5a8abd))[_0xfdcd('0x4c')](handleError(_0x115359,null));};exports[_0xfdcd('0x4d')]=function(_0x39b271,_0x13080b){var _0x28e722={'raw':!![],'where':{'id':_0x39b271[_0xfdcd('0x4e')]['id']}},_0x4f4502={};_0x4f4502['model']=_['keys'](db[_0xfdcd('0x36')][_0xfdcd('0x37')]);_0x4f4502[_0xfdcd('0x3b')]=_[_0xfdcd('0x4f')](_0x39b271['query']);_0x4f4502['filters']=_['intersection'](_0x4f4502[_0xfdcd('0x3e')],_0x4f4502[_0xfdcd('0x3b')]);_0x28e722[_0xfdcd('0x40')]=_[_0xfdcd('0x3d')](_0x4f4502['model'],qs[_0xfdcd('0x3f')](_0x39b271[_0xfdcd('0x3b')][_0xfdcd('0x3f')]));_0x28e722[_0xfdcd('0x40')]=_0x28e722[_0xfdcd('0x40')]['length']?_0x28e722[_0xfdcd('0x40')]:_0x4f4502[_0xfdcd('0x3e')];if(_0x39b271[_0xfdcd('0x3b')]['includeAll']){_0x28e722['include']=[{'all':!![]}];}_0x28e722=_['merge']({},_0x28e722,_0x39b271[_0xfdcd('0x48')]);return db[_0xfdcd('0x36')][_0xfdcd('0x50')](_0x28e722)['then'](handleEntityNotFound(_0x13080b,null))[_0xfdcd('0x27')](respondWithResult(_0x13080b,null))[_0xfdcd('0x4c')](handleError(_0x13080b,null));};exports['create']=function(_0x47919e,_0x3f04f7){return db[_0xfdcd('0x36')][_0xfdcd('0x51')](_0x47919e[_0xfdcd('0x52')],{})[_0xfdcd('0x27')](function(_0x1f53f6){var _0x41db9b=_0x47919e[_0xfdcd('0x53')]['get']({'plain':!![]});if(!_0x41db9b)throw new Error(_0xfdcd('0x54'));if(_0x41db9b[_0xfdcd('0x55')]==='user'){var _0x5151b4=_0x1f53f6[_0xfdcd('0x23')]({'plain':!![]});var _0x594516='Intervals';return db['UserProfileSection']['find']({'where':{'name':_0x594516,'userProfileId':_0x41db9b[_0xfdcd('0x56')]},'raw':!![]})[_0xfdcd('0x27')](function(_0x31212c){if(_0x31212c&&_0x31212c['autoAssociation']===0x0){return db[_0xfdcd('0x25')][_0xfdcd('0x51')]({'name':_0x5151b4[_0xfdcd('0x2b')],'resourceId':_0x5151b4['id'],'type':_0x31212c['name'],'sectionId':_0x31212c['id']},{})[_0xfdcd('0x27')](function(){return _0x1f53f6;});}else{return _0x1f53f6;}})[_0xfdcd('0x4c')](function(_0x4b398e){logger[_0xfdcd('0x2a')](_0xfdcd('0x57'),_0x4b398e);throw _0x4b398e;});}return _0x1f53f6;})[_0xfdcd('0x27')](respondWithResult(_0x3f04f7,0xc9))['catch'](handleError(_0x3f04f7,null));};exports[_0xfdcd('0x58')]=function(_0x3127c4,_0x5df76b){if(_0x3127c4['body']['id']){delete _0x3127c4[_0xfdcd('0x52')]['id'];}return db[_0xfdcd('0x36')][_0xfdcd('0x50')]({'where':{'id':_0x3127c4[_0xfdcd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5df76b,null))[_0xfdcd('0x27')](saveUpdates(_0x3127c4[_0xfdcd('0x52')],null))[_0xfdcd('0x27')](respondWithResult(_0x5df76b,null))[_0xfdcd('0x4c')](handleError(_0x5df76b,null));};exports[_0xfdcd('0x26')]=function(_0x4d9cad,_0x463097){return db[_0xfdcd('0x36')][_0xfdcd('0x50')]({'where':{'id':_0x4d9cad[_0xfdcd('0x4e')]['id']}})[_0xfdcd('0x27')](handleEntityNotFound(_0x463097,null))[_0xfdcd('0x27')](removeEntity(_0x463097,null))[_0xfdcd('0x4c')](handleError(_0x463097,null));};exports[_0xfdcd('0x59')]=function(_0x410929,_0x4387b4,_0x2ea7b1){if(_0x410929[_0xfdcd('0x52')]['id']){delete _0x410929[_0xfdcd('0x52')]['id'];}return db[_0xfdcd('0x36')][_0xfdcd('0x50')]({'where':{'id':_0x410929[_0xfdcd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4387b4,null))[_0xfdcd('0x27')](function(_0x460da0){if(_0x460da0){_0x410929[_0xfdcd('0x52')][_0xfdcd('0x5a')]=_0x460da0['id'];return db[_0xfdcd('0x36')][_0xfdcd('0x51')](_0x410929['body']);}})[_0xfdcd('0x27')](respondWithResult(_0x4387b4,null))['catch'](handleError(_0x4387b4,null));};exports[_0xfdcd('0x5b')]=function(_0xeb60f0,_0x34cf33,_0x26e7b9){var _0x48da36={};var _0x4ff905={};var _0x400b61;var _0x5f591d;return db[_0xfdcd('0x36')][_0xfdcd('0x5c')]({'where':{'id':_0xeb60f0['params']['id']}})[_0xfdcd('0x27')](handleEntityNotFound(_0x34cf33,null))[_0xfdcd('0x27')](function(_0x468c70){if(_0x468c70){_0x400b61=_0x468c70;_0x4ff905['model']=_['keys'](db[_0xfdcd('0x36')][_0xfdcd('0x37')]);_0x4ff905[_0xfdcd('0x3b')]=_[_0xfdcd('0x4f')](_0xeb60f0[_0xfdcd('0x3b')]);_0x4ff905['filters']=_[_0xfdcd('0x3d')](_0x4ff905['model'],_0x4ff905[_0xfdcd('0x3b')]);_0x48da36[_0xfdcd('0x40')]=_[_0xfdcd('0x3d')](_0x4ff905[_0xfdcd('0x3e')],qs['fields'](_0xeb60f0['query'][_0xfdcd('0x3f')]));_0x48da36[_0xfdcd('0x40')]=_0x48da36['attributes'][_0xfdcd('0x5d')]?_0x48da36[_0xfdcd('0x40')]:_0x4ff905[_0xfdcd('0x3e')];_0x48da36['order']=qs[_0xfdcd('0x44')](_0xeb60f0[_0xfdcd('0x3b')][_0xfdcd('0x44')]);_0x48da36[_0xfdcd('0x45')]=qs[_0xfdcd('0x3c')](_[_0xfdcd('0x46')](_0xeb60f0['query'],_0x4ff905[_0xfdcd('0x3c')]));if(_0xeb60f0['query'][_0xfdcd('0x47')]){_0x48da36[_0xfdcd('0x45')]=_['merge'](_0x48da36[_0xfdcd('0x45')],{'$or':_[_0xfdcd('0x35')](_0x48da36[_0xfdcd('0x40')],function(_0x236023){var _0x33ebf8={};_0x33ebf8[_0x236023]={'$like':'%'+_0xeb60f0[_0xfdcd('0x3b')][_0xfdcd('0x47')]+'%'};return _0x33ebf8;})});}_0x48da36=_[_0xfdcd('0x2e')]({},_0x48da36,_0xeb60f0['options']);return _0x400b61[_0xfdcd('0x5b')](_0x48da36);}})[_0xfdcd('0x27')](function(_0x249560){if(_0x249560){_0x5f591d=_0x249560[_0xfdcd('0x5d')];if(!_0xeb60f0['query'][_0xfdcd('0x41')](_0xfdcd('0x42'))){_0x48da36[_0xfdcd('0x1c')]=qs[_0xfdcd('0x1c')](_0xeb60f0[_0xfdcd('0x3b')]['limit']);_0x48da36[_0xfdcd('0x1b')]=qs[_0xfdcd('0x1b')](_0xeb60f0[_0xfdcd('0x3b')][_0xfdcd('0x1b')]);}return _0x400b61[_0xfdcd('0x5b')](_0x48da36);}})[_0xfdcd('0x27')](function(_0x1a6cfc){if(_0x1a6cfc){return _0x1a6cfc?{'count':_0x5f591d,'rows':_0x1a6cfc}:null;}})[_0xfdcd('0x27')](respondWithResult(_0x34cf33,null))['catch'](handleError(_0x34cf33,null));};exports[_0xfdcd('0x5e')]=function(_0x13db6b,_0x5d32b8,_0xa0c33e){return db[_0xfdcd('0x36')][_0xfdcd('0x5c')]({'where':{'id':_0x13db6b['params']['id']}})['then'](handleEntityNotFound(_0x5d32b8,null))[_0xfdcd('0x27')](function(_0x5ef2a6){if(_0x5ef2a6){return db['sequelize'][_0xfdcd('0x5f')](function(_0x4235b7){return db[_0xfdcd('0x36')]['destroy']({'where':{'IntervalId':_0x13db6b[_0xfdcd('0x4e')]['id']},'transaction':_0x4235b7})['then'](function(_0x4c32f0){var _0x49859a=_[_0xfdcd('0x35')](_0x13db6b[_0xfdcd('0x52')],function(_0x86a300){delete _0x86a300['id'];_0x86a300[_0xfdcd('0x5a')]=_0x13db6b[_0xfdcd('0x4e')]['id'];return _0x86a300;});return db[_0xfdcd('0x36')]['bulkCreate'](_0x49859a,{'transaction':_0x4235b7});});})[_0xfdcd('0x27')](function(){return db[_0xfdcd('0x36')]['findAll']({'where':{'IntervalId':_0x13db6b[_0xfdcd('0x4e')]['id']}});});}})[_0xfdcd('0x27')](respondWithResult(_0x5d32b8,null))[_0xfdcd('0x4c')](handleError(_0x5d32b8,null));}; \ No newline at end of file +var _0xfd1f=['save','destroy','then','get','Intervals','UserProfileResource','end','error','stack','name','render','merge','body','contact','message','agent','interaction','account','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','Interval','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','addInterval','IntervalId','nolimit','addIntervals','findOne','sequelize','transaction','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd1f,0x1be));var _0xffd1=function(_0x4d3983,_0x435738){_0x4d3983=_0x4d3983-0x0;var _0xc7a65e=_0xfd1f[_0x4d3983];return _0xc7a65e;};'use strict';var emlformat=require(_0xffd1('0x0'));var rimraf=require(_0xffd1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xffd1('0x2'));var rp=require(_0xffd1('0x3'));var moment=require('moment');var BPromise=require(_0xffd1('0x4'));var Mustache=require(_0xffd1('0x5'));var util=require(_0xffd1('0x6'));var path=require(_0xffd1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xffd1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xffd1('0x9'));var squel=require(_0xffd1('0xa'));var crypto=require('crypto');var jsforce=require(_0xffd1('0xb'));var deskjs=require(_0xffd1('0xc'));var toCsv=require(_0xffd1('0xd'));var querystring=require('querystring');var Papa=require(_0xffd1('0xe'));var Redis=require('ioredis');var authService=require(_0xffd1('0xf'));var qs=require(_0xffd1('0x10'));var as=require(_0xffd1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xffd1('0x12'))(_0xffd1('0x13'));var utils=require(_0xffd1('0x14'));var config=require(_0xffd1('0x15'));var licenseUtil=require(_0xffd1('0x16'));var db=require(_0xffd1('0x17'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x3cb4b4,_0x4b1802){_0x4b1802=_0x4b1802||0xcc;return function(_0x693de8){if(_0x693de8){return _0x3cb4b4[_0xffd1('0x18')](_0x4b1802);}return _0x3cb4b4['status'](_0x4b1802)['end']();};}function respondWithResult(_0x545501,_0x119bd1){_0x119bd1=_0x119bd1||0xc8;return function(_0x5f5c9f){if(_0x5f5c9f){return _0x545501[_0xffd1('0x19')](_0x119bd1)[_0xffd1('0x1a')](_0x5f5c9f);}};}function respondWithFilteredResult(_0x57e56b,_0x5e803e){return function(_0x47df47){if(_0x47df47){var _0x416152=typeof _0x5e803e[_0xffd1('0x1b')]===_0xffd1('0x1c')&&typeof _0x5e803e[_0xffd1('0x1d')]===_0xffd1('0x1c');var _0x229bb5=_0x47df47['count'];var _0x463db0=_0x416152?0x0:_0x5e803e['offset'];var _0x2e4742=_0x416152?_0x47df47[_0xffd1('0x1e')]:_0x5e803e[_0xffd1('0x1b')]+_0x5e803e[_0xffd1('0x1d')];var _0x29c8ec;if(_0x2e4742>=_0x229bb5){_0x2e4742=_0x229bb5;_0x29c8ec=0xc8;}else{_0x29c8ec=0xce;}_0x57e56b[_0xffd1('0x19')](_0x29c8ec);return _0x57e56b['set'](_0xffd1('0x1f'),_0x463db0+'-'+_0x2e4742+'/'+_0x229bb5)[_0xffd1('0x1a')](_0x47df47);}return null;};}function patchUpdates(_0x7e19fa){return function(_0xac5657){try{jsonpatch[_0xffd1('0x20')](_0xac5657,_0x7e19fa,!![]);}catch(_0x17f9ea){return BPromise[_0xffd1('0x21')](_0x17f9ea);}return _0xac5657[_0xffd1('0x22')]();};}function saveUpdates(_0x51993b,_0x172769){return function(_0x4405bd){if(_0x4405bd){return _0x4405bd['update'](_0x51993b)['then'](function(_0x58d884){return _0x58d884;});}return null;};}function removeEntity(_0x324acd,_0x88eef5){return function(_0xa49331){if(_0xa49331){return _0xa49331[_0xffd1('0x23')]()[_0xffd1('0x24')](function(){var _0x3a7eaf=_0xa49331[_0xffd1('0x25')]({'plain':!![]});var _0x5bfefa=_0xffd1('0x26');return db[_0xffd1('0x27')][_0xffd1('0x23')]({'where':{'type':_0x5bfefa,'resourceId':_0x3a7eaf['id']}})[_0xffd1('0x24')](function(){return _0xa49331;});})[_0xffd1('0x24')](function(){_0x324acd['status'](0xcc)[_0xffd1('0x28')]();});}};}function handleEntityNotFound(_0x1a216a,_0x2a2501){return function(_0x1deeef){if(!_0x1deeef){_0x1a216a[_0xffd1('0x18')](0x194);}return _0x1deeef;};}function handleError(_0x3d98a8,_0x47a898){_0x47a898=_0x47a898||0x1f4;return function(_0x23d3e3){logger[_0xffd1('0x29')](_0x23d3e3[_0xffd1('0x2a')]);if(_0x23d3e3[_0xffd1('0x2b')]){delete _0x23d3e3[_0xffd1('0x2b')];}_0x3d98a8[_0xffd1('0x19')](_0x47a898)['send'](_0x23d3e3);};}function getMustacheRender(_0x5b42a9,_0xcf462b){return Mustache[_0xffd1('0x2c')](_0x5b42a9,_[_0xffd1('0x2d')](_0xcf462b[_0xffd1('0x2e')],{'contact':_0xcf462b[_0xffd1('0x2f')],'message':_0xcf462b[_0xffd1('0x30')],'agent':_0xcf462b[_0xffd1('0x31')],'interaction':_0xcf462b[_0xffd1('0x32')],'account':_0xcf462b[_0xffd1('0x33')]}))||'';}exports[_0xffd1('0x34')]=function(_0x4fc851,_0x3f0233){var _0x4f05c8={},_0x2c469b={},_0x2e616d={'count':0x0,'rows':[]};var _0xda9362=_[_0xffd1('0x35')](db['Interval'][_0xffd1('0x36')],function(_0x644cbd){return{'name':_0x644cbd[_0xffd1('0x37')],'type':_0x644cbd[_0xffd1('0x38')]['key']};});_0x2c469b[_0xffd1('0x39')]=_[_0xffd1('0x35')](_0xda9362,_0xffd1('0x2b'));_0x2c469b[_0xffd1('0x3a')]=_[_0xffd1('0x3b')](_0x4fc851[_0xffd1('0x3a')]);_0x2c469b[_0xffd1('0x3c')]=_['intersection'](_0x2c469b[_0xffd1('0x39')],_0x2c469b[_0xffd1('0x3a')]);_0x4f05c8[_0xffd1('0x3d')]=_['intersection'](_0x2c469b['model'],qs[_0xffd1('0x3e')](_0x4fc851[_0xffd1('0x3a')][_0xffd1('0x3e')]));_0x4f05c8['attributes']=_0x4f05c8['attributes'][_0xffd1('0x3f')]?_0x4f05c8[_0xffd1('0x3d')]:_0x2c469b[_0xffd1('0x39')];if(!_0x4fc851[_0xffd1('0x3a')][_0xffd1('0x40')]('nolimit')){_0x4f05c8[_0xffd1('0x1d')]=qs[_0xffd1('0x1d')](_0x4fc851[_0xffd1('0x3a')]['limit']);_0x4f05c8[_0xffd1('0x1b')]=qs[_0xffd1('0x1b')](_0x4fc851[_0xffd1('0x3a')][_0xffd1('0x1b')]);}_0x4f05c8[_0xffd1('0x41')]=qs[_0xffd1('0x42')](_0x4fc851['query']['sort']);_0x4f05c8[_0xffd1('0x43')]=qs[_0xffd1('0x3c')](_[_0xffd1('0x44')](_0x4fc851[_0xffd1('0x3a')],_0x2c469b[_0xffd1('0x3c')]),_0xda9362);if(_0x4fc851[_0xffd1('0x3a')]['filter']){_0x4f05c8['where']=_[_0xffd1('0x2d')](_0x4f05c8['where'],{'$or':_[_0xffd1('0x35')](_0xda9362,function(_0x535c4c){if(_0x535c4c[_0xffd1('0x38')]!=='VIRTUAL'){var _0x2fdeee={};_0x2fdeee[_0x535c4c[_0xffd1('0x2b')]]={'$like':'%'+_0x4fc851[_0xffd1('0x3a')][_0xffd1('0x45')]+'%'};return _0x2fdeee;}})});}_0x4f05c8=_[_0xffd1('0x2d')]({},_0x4f05c8,_0x4fc851[_0xffd1('0x46')]);var _0x585e7b={'where':_0x4f05c8['where']};return db['Interval'][_0xffd1('0x1e')](_0x585e7b)[_0xffd1('0x24')](function(_0x550dfb){_0x2e616d[_0xffd1('0x1e')]=_0x550dfb;if(_0x4fc851[_0xffd1('0x3a')][_0xffd1('0x47')]){_0x4f05c8[_0xffd1('0x48')]=[{'all':!![]}];}return db['Interval'][_0xffd1('0x49')](_0x4f05c8);})[_0xffd1('0x24')](function(_0x4b494f){_0x2e616d[_0xffd1('0x4a')]=_0x4b494f;return _0x2e616d;})[_0xffd1('0x24')](respondWithFilteredResult(_0x3f0233,_0x4f05c8))[_0xffd1('0x4b')](handleError(_0x3f0233,null));};exports[_0xffd1('0x4c')]=function(_0x43b5d1,_0x3ca637){var _0x3cc862={'raw':!![],'where':{'id':_0x43b5d1[_0xffd1('0x4d')]['id']}},_0x3fee86={};_0x3fee86[_0xffd1('0x39')]=_[_0xffd1('0x3b')](db['Interval']['rawAttributes']);_0x3fee86[_0xffd1('0x3a')]=_['keys'](_0x43b5d1[_0xffd1('0x3a')]);_0x3fee86[_0xffd1('0x3c')]=_[_0xffd1('0x4e')](_0x3fee86[_0xffd1('0x39')],_0x3fee86[_0xffd1('0x3a')]);_0x3cc862['attributes']=_[_0xffd1('0x4e')](_0x3fee86[_0xffd1('0x39')],qs[_0xffd1('0x3e')](_0x43b5d1[_0xffd1('0x3a')]['fields']));_0x3cc862[_0xffd1('0x3d')]=_0x3cc862[_0xffd1('0x3d')][_0xffd1('0x3f')]?_0x3cc862[_0xffd1('0x3d')]:_0x3fee86['model'];if(_0x43b5d1['query'][_0xffd1('0x47')]){_0x3cc862[_0xffd1('0x48')]=[{'all':!![]}];}_0x3cc862=_[_0xffd1('0x2d')]({},_0x3cc862,_0x43b5d1[_0xffd1('0x46')]);return db['Interval'][_0xffd1('0x4f')](_0x3cc862)[_0xffd1('0x24')](handleEntityNotFound(_0x3ca637,null))[_0xffd1('0x24')](respondWithResult(_0x3ca637,null))[_0xffd1('0x4b')](handleError(_0x3ca637,null));};exports[_0xffd1('0x50')]=function(_0x44dcb8,_0x4dfd4e){return db[_0xffd1('0x51')]['create'](_0x44dcb8[_0xffd1('0x2e')],{})[_0xffd1('0x24')](function(_0x381b6f){var _0x4f1430=_0x44dcb8[_0xffd1('0x52')]['get']({'plain':!![]});if(!_0x4f1430)throw new Error(_0xffd1('0x53'));if(_0x4f1430[_0xffd1('0x54')]===_0xffd1('0x52')){var _0x388d32=_0x381b6f[_0xffd1('0x25')]({'plain':!![]});var _0x4245d9='Intervals';return db[_0xffd1('0x55')][_0xffd1('0x4f')]({'where':{'name':_0x4245d9,'userProfileId':_0x4f1430[_0xffd1('0x56')]},'raw':!![]})[_0xffd1('0x24')](function(_0x20bdaa){if(_0x20bdaa&&_0x20bdaa[_0xffd1('0x57')]===0x0){return db['UserProfileResource'][_0xffd1('0x50')]({'name':_0x388d32[_0xffd1('0x2b')],'resourceId':_0x388d32['id'],'type':_0x20bdaa[_0xffd1('0x2b')],'sectionId':_0x20bdaa['id']},{})['then'](function(){return _0x381b6f;});}else{return _0x381b6f;}})[_0xffd1('0x4b')](function(_0x36151a){logger[_0xffd1('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36151a);throw _0x36151a;});}return _0x381b6f;})[_0xffd1('0x24')](respondWithResult(_0x4dfd4e,0xc9))[_0xffd1('0x4b')](handleError(_0x4dfd4e,null));};exports[_0xffd1('0x58')]=function(_0x30568e,_0x2f9a16){if(_0x30568e[_0xffd1('0x2e')]['id']){delete _0x30568e['body']['id'];}return db[_0xffd1('0x51')][_0xffd1('0x4f')]({'where':{'id':_0x30568e[_0xffd1('0x4d')]['id']}})[_0xffd1('0x24')](handleEntityNotFound(_0x2f9a16,null))['then'](saveUpdates(_0x30568e[_0xffd1('0x2e')],null))[_0xffd1('0x24')](respondWithResult(_0x2f9a16,null))[_0xffd1('0x4b')](handleError(_0x2f9a16,null));};exports[_0xffd1('0x23')]=function(_0x1bf40c,_0x3c73d5){return db['Interval'][_0xffd1('0x4f')]({'where':{'id':_0x1bf40c['params']['id']}})[_0xffd1('0x24')](handleEntityNotFound(_0x3c73d5,null))[_0xffd1('0x24')](removeEntity(_0x3c73d5,null))[_0xffd1('0x4b')](handleError(_0x3c73d5,null));};exports[_0xffd1('0x59')]=function(_0x1b2d48,_0x6cd33b,_0x3d33c9){if(_0x1b2d48['body']['id']){delete _0x1b2d48[_0xffd1('0x2e')]['id'];}return db[_0xffd1('0x51')][_0xffd1('0x4f')]({'where':{'id':_0x1b2d48['params']['id']}})[_0xffd1('0x24')](handleEntityNotFound(_0x6cd33b,null))['then'](function(_0x14840c){if(_0x14840c){_0x1b2d48[_0xffd1('0x2e')][_0xffd1('0x5a')]=_0x14840c['id'];return db['Interval'][_0xffd1('0x50')](_0x1b2d48[_0xffd1('0x2e')]);}})[_0xffd1('0x24')](respondWithResult(_0x6cd33b,null))[_0xffd1('0x4b')](handleError(_0x6cd33b,null));};exports['getIntervals']=function(_0x549a7a,_0x967c24,_0x43cd00){var _0x4267e0={};var _0xba759e={};var _0x465f6b;var _0x5cfee9;return db[_0xffd1('0x51')]['findOne']({'where':{'id':_0x549a7a[_0xffd1('0x4d')]['id']}})[_0xffd1('0x24')](handleEntityNotFound(_0x967c24,null))[_0xffd1('0x24')](function(_0x4aef07){if(_0x4aef07){_0x465f6b=_0x4aef07;_0xba759e[_0xffd1('0x39')]=_[_0xffd1('0x3b')](db[_0xffd1('0x51')][_0xffd1('0x36')]);_0xba759e[_0xffd1('0x3a')]=_[_0xffd1('0x3b')](_0x549a7a['query']);_0xba759e[_0xffd1('0x3c')]=_[_0xffd1('0x4e')](_0xba759e[_0xffd1('0x39')],_0xba759e['query']);_0x4267e0[_0xffd1('0x3d')]=_['intersection'](_0xba759e['model'],qs[_0xffd1('0x3e')](_0x549a7a[_0xffd1('0x3a')][_0xffd1('0x3e')]));_0x4267e0[_0xffd1('0x3d')]=_0x4267e0[_0xffd1('0x3d')][_0xffd1('0x3f')]?_0x4267e0[_0xffd1('0x3d')]:_0xba759e[_0xffd1('0x39')];_0x4267e0[_0xffd1('0x41')]=qs[_0xffd1('0x42')](_0x549a7a[_0xffd1('0x3a')][_0xffd1('0x42')]);_0x4267e0[_0xffd1('0x43')]=qs[_0xffd1('0x3c')](_[_0xffd1('0x44')](_0x549a7a['query'],_0xba759e[_0xffd1('0x3c')]));if(_0x549a7a[_0xffd1('0x3a')][_0xffd1('0x45')]){_0x4267e0['where']=_[_0xffd1('0x2d')](_0x4267e0[_0xffd1('0x43')],{'$or':_[_0xffd1('0x35')](_0x4267e0['attributes'],function(_0x5981e0){var _0x3a9ee5={};_0x3a9ee5[_0x5981e0]={'$like':'%'+_0x549a7a['query'][_0xffd1('0x45')]+'%'};return _0x3a9ee5;})});}_0x4267e0=_['merge']({},_0x4267e0,_0x549a7a[_0xffd1('0x46')]);return _0x465f6b['getIntervals'](_0x4267e0);}})['then'](function(_0x16829b){if(_0x16829b){_0x5cfee9=_0x16829b[_0xffd1('0x3f')];if(!_0x549a7a['query'][_0xffd1('0x40')](_0xffd1('0x5b'))){_0x4267e0[_0xffd1('0x1d')]=qs['limit'](_0x549a7a[_0xffd1('0x3a')]['limit']);_0x4267e0[_0xffd1('0x1b')]=qs[_0xffd1('0x1b')](_0x549a7a[_0xffd1('0x3a')][_0xffd1('0x1b')]);}return _0x465f6b['getIntervals'](_0x4267e0);}})[_0xffd1('0x24')](function(_0x2788c4){if(_0x2788c4){return _0x2788c4?{'count':_0x5cfee9,'rows':_0x2788c4}:null;}})[_0xffd1('0x24')](respondWithResult(_0x967c24,null))[_0xffd1('0x4b')](handleError(_0x967c24,null));};exports[_0xffd1('0x5c')]=function(_0x24ed73,_0x2dd04a,_0x18d8a6){return db['Interval'][_0xffd1('0x5d')]({'where':{'id':_0x24ed73[_0xffd1('0x4d')]['id']}})[_0xffd1('0x24')](handleEntityNotFound(_0x2dd04a,null))['then'](function(_0x1fd1ba){if(_0x1fd1ba){return db[_0xffd1('0x5e')][_0xffd1('0x5f')](function(_0x5cfabb){return db['Interval'][_0xffd1('0x23')]({'where':{'IntervalId':_0x24ed73[_0xffd1('0x4d')]['id']},'transaction':_0x5cfabb})[_0xffd1('0x24')](function(_0x230903){var _0x4d8367=_[_0xffd1('0x35')](_0x24ed73['body'],function(_0x48bde3){delete _0x48bde3['id'];_0x48bde3[_0xffd1('0x5a')]=_0x24ed73[_0xffd1('0x4d')]['id'];return _0x48bde3;});return db['Interval']['bulkCreate'](_0x4d8367,{'transaction':_0x5cfabb});});})[_0xffd1('0x24')](function(){return db[_0xffd1('0x51')][_0xffd1('0x49')]({'where':{'IntervalId':_0x24ed73[_0xffd1('0x4d')]['id']}});});}})['then'](respondWithResult(_0x2dd04a,null))[_0xffd1('0x4b')](handleError(_0x2dd04a,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 71ac76c..a7f46bb 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 _0x9114=['tools_intervals','rewrite','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval'];(function(_0x180bd1,_0x576c42){var _0x317a81=function(_0x45fbb2){while(--_0x45fbb2){_0x180bd1['push'](_0x180bd1['shift']());}};_0x317a81(++_0x576c42);}(_0x9114,0x72));var _0x4911=function(_0x5656b5,_0x13ed36){_0x5656b5=_0x5656b5-0x0;var _0x49f66a=_0x9114[_0x5656b5];return _0x49f66a;};'use strict';var _=require(_0x4911('0x0'));var util=require(_0x4911('0x1'));var logger=require(_0x4911('0x2'))(_0x4911('0x3'));var moment=require('moment');var BPromise=require(_0x4911('0x4'));var rp=require(_0x4911('0x5'));var fs=require('fs');var path=require(_0x4911('0x6'));var rimraf=require(_0x4911('0x7'));var config=require(_0x4911('0x8'));var attributes=require(_0x4911('0x9'));var extensions=require(_0x4911('0xa'));module[_0x4911('0xb')]=function(_0x3d2e11,_0x483d72){return _0x3d2e11[_0x4911('0xc')](_0x4911('0xd'),attributes,{'tableName':_0x4911('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x39be30,_0x141b4f){extensions[_0x4911('0xf')](_0x3d2e11,_0x39be30);},'afterBulkCreate':function(_0x2353c0,_0x2263fc,_0x14bb85){_0x14bb85();extensions[_0x4911('0xf')](_0x3d2e11,_0x2353c0[0x0]);},'afterUpdate':function(_0x37c43e,_0x5a053c){extensions[_0x4911('0xf')](_0x3d2e11,_0x37c43e);},'afterDestroy':function(_0x2f07c2,_0x439d81){extensions[_0x4911('0xf')](_0x3d2e11,_0x2f07c2);}}});}; \ No newline at end of file +var _0x5d31=['define','tools_intervals','rewrite','lodash','util','../../config/logger','moment','bluebird','path','./interval.attributes','../../components/extensions/rewrite','exports'];(function(_0x5f210d,_0x1b804b){var _0x52293f=function(_0x5b193b){while(--_0x5b193b){_0x5f210d['push'](_0x5f210d['shift']());}};_0x52293f(++_0x1b804b);}(_0x5d31,0xb7));var _0x15d3=function(_0x2b18c9,_0x49659f){_0x2b18c9=_0x2b18c9-0x0;var _0x8b913c=_0x5d31[_0x2b18c9];return _0x8b913c;};'use strict';var _=require(_0x15d3('0x0'));var util=require(_0x15d3('0x1'));var logger=require(_0x15d3('0x2'))('api');var moment=require(_0x15d3('0x3'));var BPromise=require(_0x15d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x15d3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x15d3('0x6'));var extensions=require(_0x15d3('0x7'));module[_0x15d3('0x8')]=function(_0x378cb7,_0x1f7128){return _0x378cb7[_0x15d3('0x9')]('Interval',attributes,{'tableName':_0x15d3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f690b,_0x719223){extensions['rewrite'](_0x378cb7,_0x1f690b);},'afterBulkCreate':function(_0x37d3ae,_0x51da1f,_0x52a1c1){_0x52a1c1();extensions[_0x15d3('0xb')](_0x378cb7,_0x37d3ae[0x0]);},'afterUpdate':function(_0x43c62e,_0x40273d){extensions[_0x15d3('0xb')](_0x378cb7,_0x43c62e);},'afterDestroy':function(_0x38cd69,_0x1d4a66){extensions[_0x15d3('0xb')](_0x378cb7,_0x38cd69);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 63a6979..7190b17 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 _0x89dc=['map','include','model','find','ShowInterval','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','Interval,\x20%s,\x20%s','message','catch','GetInterval','Interval','findAll','options','raw','where','attributes','limit'];(function(_0xb3bd02,_0x583307){var _0x9054e8=function(_0x2809d7){while(--_0x2809d7){_0xb3bd02['push'](_0xb3bd02['shift']());}};_0x9054e8(++_0x583307);}(_0x89dc,0xd1));var _0xc89d=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x89dc[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xc89d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc89d('0x1'));var rs=require(_0xc89d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc89d('0x3'))['db'];var utils=require(_0xc89d('0x4'));var logger=require(_0xc89d('0x5'))(_0xc89d('0x6'));var config=require(_0xc89d('0x7'));var jayson=require(_0xc89d('0x8'));var client=jayson[_0xc89d('0x9')][_0xc89d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x213c66,_0x3b3b01,_0x30ccc4){return new BPromise(function(_0x31d26d,_0x47826a){return client['request'](_0x213c66,_0x30ccc4)[_0xc89d('0xb')](function(_0x29e7f1){logger[_0xc89d('0xc')]('Interval,\x20%s,\x20%s',_0x3b3b01,_0xc89d('0xd'));logger[_0xc89d('0xe')](_0xc89d('0xf'),_0x3b3b01,'request\x20sent',JSON[_0xc89d('0x10')](_0x29e7f1));if(_0x29e7f1[_0xc89d('0x11')]){if(_0x29e7f1[_0xc89d('0x11')]['code']===0x1f4){logger[_0xc89d('0x11')](_0xc89d('0x12'),_0x3b3b01,_0x29e7f1['error'][_0xc89d('0x13')]);return _0x47826a(_0x29e7f1[_0xc89d('0x11')]['message']);}logger[_0xc89d('0x11')](_0xc89d('0x12'),_0x3b3b01,_0x29e7f1[_0xc89d('0x11')]['message']);return _0x31d26d(_0x29e7f1[_0xc89d('0x11')]['message']);}else{logger['info'](_0xc89d('0x12'),_0x3b3b01,_0xc89d('0xd'));_0x31d26d(_0x29e7f1['result'][_0xc89d('0x13')]);}})[_0xc89d('0x14')](function(_0x23495f){logger[_0xc89d('0x11')]('Interval,\x20%s,\x20%s',_0x3b3b01,_0x23495f);_0x47826a(_0x23495f);});});}exports[_0xc89d('0x15')]=function(_0x2ff129){var _0x43af73=this;return new Promise(function(_0x5b63c1,_0x1238a8){return db[_0xc89d('0x16')][_0xc89d('0x17')]({'raw':_0x2ff129[_0xc89d('0x18')]?_0x2ff129[_0xc89d('0x18')][_0xc89d('0x19')]===undefined?!![]:![]:!![],'where':_0x2ff129[_0xc89d('0x18')]?_0x2ff129[_0xc89d('0x18')][_0xc89d('0x1a')]||null:null,'attributes':_0x2ff129[_0xc89d('0x18')]?_0x2ff129[_0xc89d('0x18')][_0xc89d('0x1b')]||null:null,'limit':_0x2ff129[_0xc89d('0x18')]?_0x2ff129[_0xc89d('0x18')][_0xc89d('0x1c')]||null:null,'include':_0x2ff129[_0xc89d('0x18')]?_0x2ff129[_0xc89d('0x18')]['include']?_[_0xc89d('0x1d')](_0x2ff129[_0xc89d('0x18')][_0xc89d('0x1e')],function(_0x159d3c){return{'model':db[_0x159d3c[_0xc89d('0x1f')]],'as':_0x159d3c['as'],'attributes':_0x159d3c[_0xc89d('0x1b')],'include':_0x159d3c[_0xc89d('0x1e')]?_['map'](_0x159d3c[_0xc89d('0x1e')],function(_0x4a3311){return{'model':db[_0x4a3311['model']],'as':_0x4a3311['as'],'attributes':_0x4a3311['attributes'],'include':_0x4a3311[_0xc89d('0x1e')]?_[_0xc89d('0x1d')](_0x4a3311[_0xc89d('0x1e')],function(_0x7f5020){return{'model':db[_0x7f5020[_0xc89d('0x1f')]],'as':_0x7f5020['as'],'attributes':_0x7f5020['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d209d){logger[_0xc89d('0xc')](_0xc89d('0x15'),_0x2ff129);logger[_0xc89d('0xe')](_0xc89d('0x15'),_0x2ff129,JSON[_0xc89d('0x10')](_0x3d209d));_0x5b63c1(_0x3d209d);})[_0xc89d('0x14')](function(_0x3e4188){logger[_0xc89d('0x11')](_0xc89d('0x15'),_0x3e4188[_0xc89d('0x13')],_0x2ff129);_0x1238a8(_0x43af73[_0xc89d('0x11')](0x1f4,_0x3e4188[_0xc89d('0x13')]));});});};exports['ShowInterval']=function(_0x66fb97){var _0xda78d8=this;return new Promise(function(_0x26f1fb,_0x16943d){return db[_0xc89d('0x16')][_0xc89d('0x20')]({'raw':_0x66fb97['options']?_0x66fb97[_0xc89d('0x18')][_0xc89d('0x19')]===undefined?!![]:![]:!![],'where':_0x66fb97[_0xc89d('0x18')]?_0x66fb97[_0xc89d('0x18')][_0xc89d('0x1a')]||null:null,'attributes':_0x66fb97[_0xc89d('0x18')]?_0x66fb97[_0xc89d('0x18')][_0xc89d('0x1b')]||null:null,'include':_0x66fb97[_0xc89d('0x18')]?_0x66fb97[_0xc89d('0x18')][_0xc89d('0x1e')]?_[_0xc89d('0x1d')](_0x66fb97[_0xc89d('0x18')][_0xc89d('0x1e')],function(_0x68b033){return{'model':db[_0x68b033['model']],'as':_0x68b033['as'],'attributes':_0x68b033[_0xc89d('0x1b')],'include':_0x68b033[_0xc89d('0x1e')]?_['map'](_0x68b033[_0xc89d('0x1e')],function(_0x291275){return{'model':db[_0x291275[_0xc89d('0x1f')]],'as':_0x291275['as'],'attributes':_0x291275[_0xc89d('0x1b')],'include':_0x291275[_0xc89d('0x1e')]?_[_0xc89d('0x1d')](_0x291275[_0xc89d('0x1e')],function(_0x3361cb){return{'model':db[_0x3361cb[_0xc89d('0x1f')]],'as':_0x3361cb['as'],'attributes':_0x3361cb['attributes']};}):[]};}):[]};}):[]:[]})[_0xc89d('0xb')](function(_0x224ec9){logger[_0xc89d('0xc')](_0xc89d('0x21'),_0x66fb97);logger[_0xc89d('0xe')](_0xc89d('0x21'),_0x66fb97,JSON[_0xc89d('0x10')](_0x224ec9));_0x26f1fb(_0x224ec9);})[_0xc89d('0x14')](function(_0x2825c9){logger['error'](_0xc89d('0x21'),_0x2825c9[_0xc89d('0x13')],_0x66fb97);_0x16943d(_0xda78d8[_0xc89d('0x11')](0x1f4,_0x2825c9['message']));});});}; \ No newline at end of file +var _0x81ad=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','then','info','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','error','code','message','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetInterval','stringify','ShowInterval','Interval','find'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0x81ad,0x1d1));var _0xd81a=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0x81ad[_0x234ae1];return _0x227ba0;};'use strict';var _=require(_0xd81a('0x0'));var util=require(_0xd81a('0x1'));var moment=require(_0xd81a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd81a('0x3'));var db=require(_0xd81a('0x4'))['db'];var utils=require(_0xd81a('0x5'));var logger=require(_0xd81a('0x6'))('rpc');var config=require(_0xd81a('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9ef758,_0xb3822a,_0x20885a){return new BPromise(function(_0x5a5472,_0x3f8fcf){return client['request'](_0x9ef758,_0x20885a)[_0xd81a('0x8')](function(_0x2107bd){logger[_0xd81a('0x9')](_0xd81a('0xa'),_0xb3822a,'request\x20sent');logger[_0xd81a('0xb')](_0xd81a('0xc'),_0xb3822a,'request\x20sent',JSON['stringify'](_0x2107bd));if(_0x2107bd[_0xd81a('0xd')]){if(_0x2107bd[_0xd81a('0xd')][_0xd81a('0xe')]===0x1f4){logger[_0xd81a('0xd')](_0xd81a('0xa'),_0xb3822a,_0x2107bd[_0xd81a('0xd')][_0xd81a('0xf')]);return _0x3f8fcf(_0x2107bd[_0xd81a('0xd')][_0xd81a('0xf')]);}logger[_0xd81a('0xd')]('Interval,\x20%s,\x20%s',_0xb3822a,_0x2107bd[_0xd81a('0xd')][_0xd81a('0xf')]);return _0x5a5472(_0x2107bd[_0xd81a('0xd')]['message']);}else{logger[_0xd81a('0x9')]('Interval,\x20%s,\x20%s',_0xb3822a,'request\x20sent');_0x5a5472(_0x2107bd['result']['message']);}})[_0xd81a('0x10')](function(_0x1b6c62){logger[_0xd81a('0xd')](_0xd81a('0xa'),_0xb3822a,_0x1b6c62);_0x3f8fcf(_0x1b6c62);});});}exports['GetInterval']=function(_0x33759b){var _0x13985e=this;return new Promise(function(_0x5c1223,_0xfa5713){return db['Interval'][_0xd81a('0x11')]({'raw':_0x33759b[_0xd81a('0x12')]?_0x33759b[_0xd81a('0x12')][_0xd81a('0x13')]===undefined?!![]:![]:!![],'where':_0x33759b[_0xd81a('0x12')]?_0x33759b['options'][_0xd81a('0x14')]||null:null,'attributes':_0x33759b[_0xd81a('0x12')]?_0x33759b['options'][_0xd81a('0x15')]||null:null,'limit':_0x33759b[_0xd81a('0x12')]?_0x33759b[_0xd81a('0x12')][_0xd81a('0x16')]||null:null,'include':_0x33759b[_0xd81a('0x12')]?_0x33759b['options'][_0xd81a('0x17')]?_[_0xd81a('0x18')](_0x33759b[_0xd81a('0x12')][_0xd81a('0x17')],function(_0x5d2537){return{'model':db[_0x5d2537[_0xd81a('0x19')]],'as':_0x5d2537['as'],'attributes':_0x5d2537[_0xd81a('0x15')],'include':_0x5d2537[_0xd81a('0x17')]?_[_0xd81a('0x18')](_0x5d2537[_0xd81a('0x17')],function(_0x34f317){return{'model':db[_0x34f317['model']],'as':_0x34f317['as'],'attributes':_0x34f317[_0xd81a('0x15')],'include':_0x34f317[_0xd81a('0x17')]?_[_0xd81a('0x18')](_0x34f317[_0xd81a('0x17')],function(_0x181b6f){return{'model':db[_0x181b6f[_0xd81a('0x19')]],'as':_0x181b6f['as'],'attributes':_0x181b6f[_0xd81a('0x15')]};}):[]};}):[]};}):[]:[]})[_0xd81a('0x8')](function(_0xe3d6a4){logger[_0xd81a('0x9')]('GetInterval',_0x33759b);logger['debug'](_0xd81a('0x1a'),_0x33759b,JSON[_0xd81a('0x1b')](_0xe3d6a4));_0x5c1223(_0xe3d6a4);})[_0xd81a('0x10')](function(_0x312b53){logger[_0xd81a('0xd')]('GetInterval',_0x312b53[_0xd81a('0xf')],_0x33759b);_0xfa5713(_0x13985e[_0xd81a('0xd')](0x1f4,_0x312b53[_0xd81a('0xf')]));});});};exports[_0xd81a('0x1c')]=function(_0x31fcc3){var _0x551946=this;return new Promise(function(_0x2820e7,_0x1dcb17){return db[_0xd81a('0x1d')][_0xd81a('0x1e')]({'raw':_0x31fcc3[_0xd81a('0x12')]?_0x31fcc3[_0xd81a('0x12')][_0xd81a('0x13')]===undefined?!![]:![]:!![],'where':_0x31fcc3[_0xd81a('0x12')]?_0x31fcc3[_0xd81a('0x12')][_0xd81a('0x14')]||null:null,'attributes':_0x31fcc3[_0xd81a('0x12')]?_0x31fcc3[_0xd81a('0x12')]['attributes']||null:null,'include':_0x31fcc3['options']?_0x31fcc3[_0xd81a('0x12')][_0xd81a('0x17')]?_[_0xd81a('0x18')](_0x31fcc3[_0xd81a('0x12')]['include'],function(_0x39fab2){return{'model':db[_0x39fab2[_0xd81a('0x19')]],'as':_0x39fab2['as'],'attributes':_0x39fab2[_0xd81a('0x15')],'include':_0x39fab2[_0xd81a('0x17')]?_[_0xd81a('0x18')](_0x39fab2[_0xd81a('0x17')],function(_0x5af224){return{'model':db[_0x5af224[_0xd81a('0x19')]],'as':_0x5af224['as'],'attributes':_0x5af224[_0xd81a('0x15')],'include':_0x5af224['include']?_[_0xd81a('0x18')](_0x5af224['include'],function(_0x574efc){return{'model':db[_0x574efc[_0xd81a('0x19')]],'as':_0x574efc['as'],'attributes':_0x574efc[_0xd81a('0x15')]};}):[]};}):[]};}):[]:[]})[_0xd81a('0x8')](function(_0x28f94d){logger[_0xd81a('0x9')](_0xd81a('0x1c'),_0x31fcc3);logger['debug'](_0xd81a('0x1c'),_0x31fcc3,JSON[_0xd81a('0x1b')](_0x28f94d));_0x2820e7(_0x28f94d);})['catch'](function(_0x5f1dfe){logger[_0xd81a('0xd')](_0xd81a('0x1c'),_0x5f1dfe[_0xd81a('0xf')],_0x31fcc3);_0x1dcb17(_0x551946[_0xd81a('0xd')](0x1f4,_0x5f1dfe[_0xd81a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index e0818cc..4f55d94 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 _0x3884=['send','express','Router','../../components/auth/service','post','isAuthenticated'];(function(_0x349444,_0xc2a2df){var _0x5e173a=function(_0x552fe9){while(--_0x552fe9){_0x349444['push'](_0x349444['shift']());}};_0x5e173a(++_0xc2a2df);}(_0x3884,0x139));var _0x4388=function(_0x525290,_0x493c29){_0x525290=_0x525290-0x0;var _0x1231ca=_0x3884[_0x525290];return _0x1231ca;};'use strict';var express=require(_0x4388('0x0'));var router=express[_0x4388('0x1')]();var auth=require(_0x4388('0x2'));var controller=require('./jira.controller');router[_0x4388('0x3')]('/',auth[_0x4388('0x4')](),controller[_0x4388('0x5')]);module['exports']=router; \ No newline at end of file +var _0x74df=['./jira.controller','post','isAuthenticated','send','exports','Router','../../components/auth/service'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x74df,0xc2));var _0xf74d=function(_0x107315,_0xd8be5f){_0x107315=_0x107315-0x0;var _0x3def72=_0x74df[_0x107315];return _0x3def72;};'use strict';var express=require('express');var router=express[_0xf74d('0x0')]();var auth=require(_0xf74d('0x1'));var controller=require(_0xf74d('0x2'));router[_0xf74d('0x3')]('/',auth[_0xf74d('0x4')](),controller[_0xf74d('0x5')]);module[_0xf74d('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 1519c93..b4b9b00 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 _0x5a75=['../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','description','issuetype','fields','customfield_11500','email','customfield_11502','newToken','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','data','end','statusCode','parse','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','https'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x5a75,0x1d8));var _0x55a7=function(_0x27d10a,_0x35ff44){_0x27d10a=_0x27d10a-0x0;var _0x63302e=_0x5a75[_0x27d10a];return _0x63302e;};'use strict';var BPromise=require('bluebird');var https=require(_0x55a7('0x0'));var logger=require(_0x55a7('0x1'))(_0x55a7('0x2'));var USERNAME=_0x55a7('0x3');var PASSWORD=_0x55a7('0x4');function openIssue(_0x2afb62,_0x41f41a){var _0x479087={'fields':{'project':{'key':_0x2afb62['key']||_0x55a7('0x5')},'summary':(_0x2afb62[_0x55a7('0x6')]||_0x55a7('0x7'))+_0x55a7('0x8')+_0x2afb62['ip'],'description':_0x2afb62[_0x55a7('0x9')]||JSON['stringify'](_0x2afb62),'issuetype':{'name':_0x2afb62[_0x55a7('0xa')]||'Bug'}}};_0x479087[_0x55a7('0xb')][_0x55a7('0xc')]=_0x2afb62[_0x55a7('0xd')];_0x479087['fields']['customfield_11501']=_0x2afb62['oldToken'];_0x479087[_0x55a7('0xb')][_0x55a7('0xe')]=_0x2afb62[_0x55a7('0xf')];_0x479087['fields']['customfield_11503']=_0x2afb62[_0x55a7('0x10')];_0x479087[_0x55a7('0xb')]['customfield_11504']=_0x2afb62[_0x55a7('0x11')];_0x479087[_0x55a7('0xb')][_0x55a7('0x12')]=_0x2afb62['ip'];var _0x4b80c7={'host':_0x55a7('0x13'),'port':0x1bb,'path':_0x55a7('0x14'),'method':_0x55a7('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x55a7('0x16'),'Authorization':_0x55a7('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x55a7('0x18')](_0x55a7('0x19'))}};var _0x3e0e27=JSON['stringify'](_0x479087);var _0x49eed5=https[_0x55a7('0x1a')](_0x4b80c7,function(_0x3b473b){_0x3b473b[_0x55a7('0x1b')]('utf8');var _0x1e377e='';_0x3b473b['on'](_0x55a7('0x1c'),function(_0x7f034e){_0x1e377e+=_0x7f034e;});_0x3b473b['on'](_0x55a7('0x1d'),function(){if(_0x41f41a){return _0x41f41a['status'](_0x3b473b[_0x55a7('0x1e')])['json'](JSON[_0x55a7('0x1f')](_0x1e377e));}});});_0x49eed5['on']('error',function(_0x4e28ef){if(_0x41f41a){return _0x41f41a['status'](0x1f4)[_0x55a7('0x20')]({'errors':[{'message':_0x55a7('0x21'),'type':'api.jira'}]});}});_0x49eed5[_0x55a7('0x22')](_0x3e0e27);_0x49eed5[_0x55a7('0x1d')]();}exports[_0x55a7('0x23')]=openIssue;exports[_0x55a7('0x24')]=function(_0x195f6a,_0x2ff42d){_0x195f6a[_0x55a7('0x25')]['ip']=_0x195f6a[_0x55a7('0x26')][_0x55a7('0x27')]||_0x195f6a[_0x55a7('0x28')]['remoteAddress']||_0x195f6a[_0x55a7('0x29')]['remoteAddress']||_0x195f6a['connection'][_0x55a7('0x29')][_0x55a7('0x2a')];return openIssue(_0x195f6a[_0x55a7('0x25')],_0x2ff42d);}; \ No newline at end of file +var _0x2347=['json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype','fields','email','customfield_11501','customfield_11503','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','request','setEncoding','data','end','status','statusCode'];(function(_0x4dc957,_0xf5890a){var _0x26bb75=function(_0x20144a){while(--_0x20144a){_0x4dc957['push'](_0x4dc957['shift']());}};_0x26bb75(++_0xf5890a);}(_0x2347,0x1b1));var _0x7234=function(_0x2d1548,_0x441423){_0x2d1548=_0x2d1548-0x0;var _0x10e52c=_0x2347[_0x2d1548];return _0x10e52c;};'use strict';var BPromise=require(_0x7234('0x0'));var https=require(_0x7234('0x1'));var logger=require('../../config/logger')(_0x7234('0x2'));var USERNAME=_0x7234('0x3');var PASSWORD=_0x7234('0x4');function openIssue(_0x11a416,_0x4d598d){var _0x5d3334={'fields':{'project':{'key':_0x11a416[_0x7234('0x5')]||_0x7234('0x6')},'summary':(_0x11a416[_0x7234('0x7')]||_0x7234('0x8'))+'\x20from\x20'+_0x11a416['ip'],'description':_0x11a416[_0x7234('0x9')]||JSON[_0x7234('0xa')](_0x11a416),'issuetype':{'name':_0x11a416[_0x7234('0xb')]||'Bug'}}};_0x5d3334[_0x7234('0xc')]['customfield_11500']=_0x11a416[_0x7234('0xd')];_0x5d3334['fields'][_0x7234('0xe')]=_0x11a416['oldToken'];_0x5d3334[_0x7234('0xc')]['customfield_11502']=_0x11a416['newToken'];_0x5d3334[_0x7234('0xc')][_0x7234('0xf')]=_0x11a416['name'];_0x5d3334[_0x7234('0xc')][_0x7234('0x10')]=_0x11a416[_0x7234('0x11')];_0x5d3334[_0x7234('0xc')]['customfield_10102']=_0x11a416['ip'];var _0x44c723={'host':_0x7234('0x12'),'port':0x1bb,'path':_0x7234('0x13'),'method':_0x7234('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x7234('0x15'),'Authorization':_0x7234('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0xdc228a=JSON[_0x7234('0xa')](_0x5d3334);var _0x1612b0=https[_0x7234('0x17')](_0x44c723,function(_0x4014ae){_0x4014ae[_0x7234('0x18')]('utf8');var _0x444d48='';_0x4014ae['on'](_0x7234('0x19'),function(_0x10e171){_0x444d48+=_0x10e171;});_0x4014ae['on'](_0x7234('0x1a'),function(){if(_0x4d598d){return _0x4d598d[_0x7234('0x1b')](_0x4014ae[_0x7234('0x1c')])[_0x7234('0x1d')](JSON[_0x7234('0x1e')](_0x444d48));}});});_0x1612b0['on'](_0x7234('0x1f'),function(_0x3c8768){if(_0x4d598d){return _0x4d598d[_0x7234('0x1b')](0x1f4)[_0x7234('0x1d')]({'errors':[{'message':_0x7234('0x20'),'type':'api.jira'}]});}});_0x1612b0[_0x7234('0x21')](_0xdc228a);_0x1612b0[_0x7234('0x1a')]();}exports[_0x7234('0x22')]=openIssue;exports[_0x7234('0x23')]=function(_0x315432,_0x343b31){_0x315432[_0x7234('0x24')]['ip']=_0x315432[_0x7234('0x25')][_0x7234('0x26')]||_0x315432[_0x7234('0x27')][_0x7234('0x28')]||_0x315432[_0x7234('0x29')]['remoteAddress']||_0x315432[_0x7234('0x27')]['socket']['remoteAddress'];return openIssue(_0x315432[_0x7234('0x24')],_0x343b31);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 2eba440..9ef0808 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 _0xabc8=['/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xabc8,0x104));var _0x8abc=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xabc8[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require(_0x8abc('0x0'));var util=require(_0x8abc('0x1'));var path=require(_0x8abc('0x2'));var timeout=require(_0x8abc('0x3'));var express=require(_0x8abc('0x4'));var router=express[_0x8abc('0x5')]();var fs_extra=require(_0x8abc('0x6'));var auth=require(_0x8abc('0x7'));var interaction=require(_0x8abc('0x8'));var config=require('../../config/environment');var controller=require(_0x8abc('0x9'));router[_0x8abc('0xa')]('/',auth[_0x8abc('0xb')](),controller['index']);router[_0x8abc('0xa')]('/describe',auth[_0x8abc('0xb')](),controller[_0x8abc('0xc')]);router[_0x8abc('0xa')](_0x8abc('0xd'),auth[_0x8abc('0xb')](),controller[_0x8abc('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8abc('0xf')]);router[_0x8abc('0x10')](_0x8abc('0xd'),auth[_0x8abc('0xb')](),controller[_0x8abc('0x11')]);router[_0x8abc('0x12')](_0x8abc('0xd'),auth[_0x8abc('0xb')](),controller[_0x8abc('0x13')]);module[_0x8abc('0x14')]=router; \ No newline at end of file +var _0xe8c9=['fs-extra','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id','create','put','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x131f2f,_0x1da6c3){var _0x6e9954=function(_0x2653a4){while(--_0x2653a4){_0x131f2f['push'](_0x131f2f['shift']());}};_0x6e9954(++_0x1da6c3);}(_0xe8c9,0x1d8));var _0x9e8c=function(_0x1a27d2,_0x40290a){_0x1a27d2=_0x1a27d2-0x0;var _0xb25974=_0xe8c9[_0x1a27d2];return _0xb25974;};'use strict';var multer=require('multer');var util=require(_0x9e8c('0x0'));var path=require(_0x9e8c('0x1'));var timeout=require(_0x9e8c('0x2'));var express=require('express');var router=express[_0x9e8c('0x3')]();var fs_extra=require(_0x9e8c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9e8c('0x5'));var config=require('../../config/environment');var controller=require(_0x9e8c('0x6'));router[_0x9e8c('0x7')]('/',auth[_0x9e8c('0x8')](),controller[_0x9e8c('0x9')]);router[_0x9e8c('0x7')]('/describe',auth[_0x9e8c('0x8')](),controller[_0x9e8c('0xa')]);router[_0x9e8c('0x7')](_0x9e8c('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x9e8c('0x8')](),controller[_0x9e8c('0xc')]);router[_0x9e8c('0xd')](_0x9e8c('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9e8c('0xe')]('/:id',auth[_0x9e8c('0x8')](),controller[_0x9e8c('0xf')]);module[_0x9e8c('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 5482f9a..6ca0d17 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 _0x36ee=['STRING','TEXT','long'];(function(_0x116bdf,_0x23b2a5){var _0x3a6a98=function(_0x55490a){while(--_0x55490a){_0x116bdf['push'](_0x116bdf['shift']());}};_0x3a6a98(++_0x23b2a5);}(_0x36ee,0xe8));var _0xe36e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x36ee[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0xe36e('0x0')]},'answer':{'type':Sequelize['TEXT'](_0xe36e('0x1'))},'membername':{'type':Sequelize[_0xe36e('0x2')]},'projectname':{'type':Sequelize[_0xe36e('0x2')]},'queue':{'type':Sequelize[_0xe36e('0x2')]},'uniqueid':{'type':Sequelize[_0xe36e('0x2')]},'calleridname':{'type':Sequelize[_0xe36e('0x2')]},'calleridnum':{'type':Sequelize[_0xe36e('0x2')]},'questionId':{'type':Sequelize[_0xe36e('0x2')]}}; \ No newline at end of file +var _0x6b20=['STRING','sequelize','exports','TEXT'];(function(_0x35485a,_0x91cdd4){var _0x5148e6=function(_0x27ed1d){while(--_0x27ed1d){_0x35485a['push'](_0x35485a['shift']());}};_0x5148e6(++_0x91cdd4);}(_0x6b20,0xd1));var _0x06b2=function(_0x233ab7,_0x5629c5){_0x233ab7=_0x233ab7-0x0;var _0x420be7=_0x6b20[_0x233ab7];return _0x420be7;};'use strict';var Sequelize=require(_0x06b2('0x0'));module[_0x06b2('0x1')]={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize[_0x06b2('0x2')]('long')},'membername':{'type':Sequelize[_0x06b2('0x3')]},'projectname':{'type':Sequelize[_0x06b2('0x3')]},'queue':{'type':Sequelize[_0x06b2('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x06b2('0x3')]},'calleridnum':{'type':Sequelize[_0x06b2('0x3')]},'questionId':{'type':Sequelize[_0x06b2('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 65373a3..237a60c 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 _0x4ded=['save','update','then','destroy','stack','name','render','body','contact','message','interaction','account','map','JscriptyAnswerReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','params','rawAttributes','length','includeAll','catch','create','find','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject'];(function(_0x15a7c4,_0x328d4c){var _0x3e7d4c=function(_0x3ce9ca){while(--_0x3ce9ca){_0x15a7c4['push'](_0x15a7c4['shift']());}};_0x3e7d4c(++_0x328d4c);}(_0x4ded,0x116));var _0xd4de=function(_0x44b443,_0x52079a){_0x44b443=_0x44b443-0x0;var _0x158019=_0x4ded[_0x44b443];return _0x158019;};'use strict';var emlformat=require(_0xd4de('0x0'));var rimraf=require(_0xd4de('0x1'));var zipdir=require(_0xd4de('0x2'));var jsonpatch=require(_0xd4de('0x3'));var rp=require(_0xd4de('0x4'));var moment=require(_0xd4de('0x5'));var BPromise=require(_0xd4de('0x6'));var Mustache=require(_0xd4de('0x7'));var util=require(_0xd4de('0x8'));var path=require(_0xd4de('0x9'));var sox=require(_0xd4de('0xa'));var csv=require(_0xd4de('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4de('0xc'));var _=require(_0xd4de('0xd'));var squel=require(_0xd4de('0xe'));var crypto=require(_0xd4de('0xf'));var jsforce=require(_0xd4de('0x10'));var deskjs=require(_0xd4de('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd4de('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd4de('0x13'));var as=require(_0xd4de('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd4de('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd4de('0x16'));var db=require(_0xd4de('0x17'))['db'];function respondWithStatusCode(_0x104dad,_0x2aa09d){_0x2aa09d=_0x2aa09d||0xcc;return function(_0x3ffc72){if(_0x3ffc72){return _0x104dad[_0xd4de('0x18')](_0x2aa09d);}return _0x104dad[_0xd4de('0x19')](_0x2aa09d)[_0xd4de('0x1a')]();};}function respondWithResult(_0x3e3735,_0x37cb9f){_0x37cb9f=_0x37cb9f||0xc8;return function(_0x691ba9){if(_0x691ba9){return _0x3e3735[_0xd4de('0x19')](_0x37cb9f)[_0xd4de('0x1b')](_0x691ba9);}};}function respondWithFilteredResult(_0xbb4f7e,_0x102e5b){return function(_0xa7c18b){if(_0xa7c18b){var _0x325fba=typeof _0x102e5b['offset']==='undefined'&&typeof _0x102e5b[_0xd4de('0x1c')]===_0xd4de('0x1d');var _0x17b377=_0xa7c18b[_0xd4de('0x1e')];var _0x5b1d1c=_0x325fba?0x0:_0x102e5b['offset'];var _0x1e91d5=_0x325fba?_0xa7c18b['count']:_0x102e5b[_0xd4de('0x1f')]+_0x102e5b[_0xd4de('0x1c')];var _0x50b9e3;if(_0x1e91d5>=_0x17b377){_0x1e91d5=_0x17b377;_0x50b9e3=0xc8;}else{_0x50b9e3=0xce;}_0xbb4f7e[_0xd4de('0x19')](_0x50b9e3);return _0xbb4f7e['set'](_0xd4de('0x20'),_0x5b1d1c+'-'+_0x1e91d5+'/'+_0x17b377)[_0xd4de('0x1b')](_0xa7c18b);}return null;};}function patchUpdates(_0x2bad14){return function(_0x8e8712){try{jsonpatch['apply'](_0x8e8712,_0x2bad14,!![]);}catch(_0x318658){return BPromise[_0xd4de('0x21')](_0x318658);}return _0x8e8712[_0xd4de('0x22')]();};}function saveUpdates(_0xdb3fc,_0x1c631a){return function(_0x2d092a){if(_0x2d092a){return _0x2d092a[_0xd4de('0x23')](_0xdb3fc)[_0xd4de('0x24')](function(_0x2f9de6){return _0x2f9de6;});}return null;};}function removeEntity(_0x413f68,_0x534b37){return function(_0xad333f){if(_0xad333f){return _0xad333f[_0xd4de('0x25')]()[_0xd4de('0x24')](function(){_0x413f68[_0xd4de('0x19')](0xcc)[_0xd4de('0x1a')]();});}};}function handleEntityNotFound(_0x984904,_0xffe1cc){return function(_0x36308c){if(!_0x36308c){_0x984904[_0xd4de('0x18')](0x194);}return _0x36308c;};}function handleError(_0x260c5c,_0x2ea712){_0x2ea712=_0x2ea712||0x1f4;return function(_0xb2d8a1){logger['error'](_0xb2d8a1[_0xd4de('0x26')]);if(_0xb2d8a1[_0xd4de('0x27')]){delete _0xb2d8a1['name'];}_0x260c5c[_0xd4de('0x19')](_0x2ea712)['send'](_0xb2d8a1);};}function getMustacheRender(_0x44b710,_0x32e407){return Mustache[_0xd4de('0x28')](_0x44b710,_['merge'](_0x32e407[_0xd4de('0x29')],{'contact':_0x32e407[_0xd4de('0x2a')],'message':_0x32e407[_0xd4de('0x2b')],'agent':_0x32e407['agent'],'interaction':_0x32e407[_0xd4de('0x2c')],'account':_0x32e407[_0xd4de('0x2d')]}))||'';}exports['index']=function(_0x5103b5,_0x5706fe){var _0x3f6491={},_0x496795={},_0x1dc67b={'count':0x0,'rows':[]};var _0x1429ba=_[_0xd4de('0x2e')](db[_0xd4de('0x2f')]['rawAttributes'],function(_0x3fe6c8){return{'name':_0x3fe6c8[_0xd4de('0x30')],'type':_0x3fe6c8['type'][_0xd4de('0x31')]};});_0x496795[_0xd4de('0x32')]=_['map'](_0x1429ba,'name');_0x496795[_0xd4de('0x33')]=_[_0xd4de('0x34')](_0x5103b5[_0xd4de('0x33')]);_0x496795[_0xd4de('0x35')]=_['intersection'](_0x496795[_0xd4de('0x32')],_0x496795[_0xd4de('0x33')]);_0x3f6491['attributes']=_[_0xd4de('0x36')](_0x496795[_0xd4de('0x32')],qs[_0xd4de('0x37')](_0x5103b5[_0xd4de('0x33')][_0xd4de('0x37')]));_0x3f6491[_0xd4de('0x38')]=_0x3f6491['attributes']['length']?_0x3f6491[_0xd4de('0x38')]:_0x496795[_0xd4de('0x32')];if(!_0x5103b5[_0xd4de('0x33')]['hasOwnProperty'](_0xd4de('0x39'))){_0x3f6491[_0xd4de('0x1c')]=qs['limit'](_0x5103b5[_0xd4de('0x33')][_0xd4de('0x1c')]);_0x3f6491[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x5103b5['query']['offset']);}_0x3f6491[_0xd4de('0x3a')]=qs['sort'](_0x5103b5[_0xd4de('0x33')]['sort']);_0x3f6491[_0xd4de('0x3b')]=qs[_0xd4de('0x35')](_[_0xd4de('0x3c')](_0x5103b5[_0xd4de('0x33')],_0x496795['filters']),_0x1429ba);if(_0x5103b5[_0xd4de('0x33')]['filter']){_0x3f6491[_0xd4de('0x3b')]=_[_0xd4de('0x3d')](_0x3f6491[_0xd4de('0x3b')],{'$or':_[_0xd4de('0x2e')](_0x1429ba,function(_0x349c5f){if(_0x349c5f[_0xd4de('0x3e')]!==_0xd4de('0x3f')){var _0x4ba399={};_0x4ba399[_0x349c5f[_0xd4de('0x27')]]={'$like':'%'+_0x5103b5[_0xd4de('0x33')][_0xd4de('0x40')]+'%'};return _0x4ba399;}})});}_0x3f6491=_[_0xd4de('0x3d')]({},_0x3f6491,_0x5103b5[_0xd4de('0x41')]);var _0x567294={'where':_0x3f6491[_0xd4de('0x3b')]};return db[_0xd4de('0x2f')][_0xd4de('0x1e')](_0x567294)['then'](function(_0x3eaa14){_0x1dc67b[_0xd4de('0x1e')]=_0x3eaa14;if(_0x5103b5[_0xd4de('0x33')]['includeAll']){_0x3f6491[_0xd4de('0x42')]=[{'all':!![]}];}return db[_0xd4de('0x2f')][_0xd4de('0x43')](_0x3f6491);})[_0xd4de('0x24')](function(_0x3267bd){_0x1dc67b[_0xd4de('0x44')]=_0x3267bd;return _0x1dc67b;})[_0xd4de('0x24')](respondWithFilteredResult(_0x5706fe,_0x3f6491))['catch'](handleError(_0x5706fe,null));};exports[_0xd4de('0x45')]=function(_0x164bde,_0x58082a){var _0x4d251e={'raw':!![],'where':{'id':_0x164bde[_0xd4de('0x46')]['id']}},_0x307edd={};_0x307edd[_0xd4de('0x32')]=_['keys'](db['JscriptyAnswerReport'][_0xd4de('0x47')]);_0x307edd[_0xd4de('0x33')]=_['keys'](_0x164bde[_0xd4de('0x33')]);_0x307edd[_0xd4de('0x35')]=_[_0xd4de('0x36')](_0x307edd[_0xd4de('0x32')],_0x307edd['query']);_0x4d251e[_0xd4de('0x38')]=_[_0xd4de('0x36')](_0x307edd[_0xd4de('0x32')],qs[_0xd4de('0x37')](_0x164bde[_0xd4de('0x33')][_0xd4de('0x37')]));_0x4d251e['attributes']=_0x4d251e[_0xd4de('0x38')][_0xd4de('0x48')]?_0x4d251e[_0xd4de('0x38')]:_0x307edd[_0xd4de('0x32')];if(_0x164bde[_0xd4de('0x33')][_0xd4de('0x49')]){_0x4d251e[_0xd4de('0x42')]=[{'all':!![]}];}_0x4d251e=_[_0xd4de('0x3d')]({},_0x4d251e,_0x164bde[_0xd4de('0x41')]);return db[_0xd4de('0x2f')]['find'](_0x4d251e)[_0xd4de('0x24')](handleEntityNotFound(_0x58082a,null))[_0xd4de('0x24')](respondWithResult(_0x58082a,null))[_0xd4de('0x4a')](handleError(_0x58082a,null));};exports['create']=function(_0x13a900,_0x199204){return db[_0xd4de('0x2f')][_0xd4de('0x4b')](_0x13a900[_0xd4de('0x29')],{})[_0xd4de('0x24')](respondWithResult(_0x199204,0xc9))[_0xd4de('0x4a')](handleError(_0x199204,null));};exports[_0xd4de('0x23')]=function(_0x182b35,_0x138b04){if(_0x182b35['body']['id']){delete _0x182b35[_0xd4de('0x29')]['id'];}return db[_0xd4de('0x2f')][_0xd4de('0x4c')]({'where':{'id':_0x182b35[_0xd4de('0x46')]['id']}})[_0xd4de('0x24')](handleEntityNotFound(_0x138b04,null))['then'](saveUpdates(_0x182b35['body'],null))[_0xd4de('0x24')](respondWithResult(_0x138b04,null))[_0xd4de('0x4a')](handleError(_0x138b04,null));};exports['destroy']=function(_0x48cb7d,_0x2d8589){return db[_0xd4de('0x2f')][_0xd4de('0x4c')]({'where':{'id':_0x48cb7d[_0xd4de('0x46')]['id']}})[_0xd4de('0x24')](handleEntityNotFound(_0x2d8589,null))[_0xd4de('0x24')](removeEntity(_0x2d8589,null))[_0xd4de('0x4a')](handleError(_0x2d8589,null));};exports[_0xd4de('0x4d')]=function(_0x109e3a,_0x45a08f){return db[_0xd4de('0x2f')][_0xd4de('0x4d')]()['then'](respondWithResult(_0x45a08f,null))[_0xd4de('0x4a')](handleError(_0x45a08f,null));}; \ No newline at end of file +var _0x4c6d=['undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','render','merge','body','contact','message','agent','interaction','account','index','map','JscriptyAnswerReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset'];(function(_0x2cdf43,_0xca4d44){var _0x5b39e1=function(_0x5ebcc1){while(--_0x5ebcc1){_0x2cdf43['push'](_0x2cdf43['shift']());}};_0x5b39e1(++_0xca4d44);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x500786,_0x5462b9){_0x500786=_0x500786-0x0;var _0x24468d=_0x4c6d[_0x500786];return _0x24468d;};'use strict';var emlformat=require(_0xd4c6('0x0'));var rimraf=require(_0xd4c6('0x1'));var zipdir=require(_0xd4c6('0x2'));var jsonpatch=require(_0xd4c6('0x3'));var rp=require(_0xd4c6('0x4'));var moment=require('moment');var BPromise=require(_0xd4c6('0x5'));var Mustache=require(_0xd4c6('0x6'));var util=require(_0xd4c6('0x7'));var path=require('path');var sox=require(_0xd4c6('0x8'));var csv=require(_0xd4c6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4c6('0xa'));var _=require(_0xd4c6('0xb'));var squel=require(_0xd4c6('0xc'));var crypto=require('crypto');var jsforce=require(_0xd4c6('0xd'));var deskjs=require(_0xd4c6('0xe'));var toCsv=require(_0xd4c6('0x9'));var querystring=require('querystring');var Papa=require(_0xd4c6('0xf'));var Redis=require(_0xd4c6('0x10'));var authService=require(_0xd4c6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd4c6('0x12'));var hardwareService=require(_0xd4c6('0x13'));var logger=require(_0xd4c6('0x14'))(_0xd4c6('0x15'));var utils=require(_0xd4c6('0x16'));var config=require(_0xd4c6('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35b902,_0x489171){_0x489171=_0x489171||0xcc;return function(_0x162681){if(_0x162681){return _0x35b902[_0xd4c6('0x18')](_0x489171);}return _0x35b902[_0xd4c6('0x19')](_0x489171)[_0xd4c6('0x1a')]();};}function respondWithResult(_0x3a2143,_0x384a98){_0x384a98=_0x384a98||0xc8;return function(_0x94f42e){if(_0x94f42e){return _0x3a2143['status'](_0x384a98)['json'](_0x94f42e);}};}function respondWithFilteredResult(_0x11e6c2,_0x3deb85){return function(_0x25e1fb){if(_0x25e1fb){var _0x25204d=typeof _0x3deb85[_0xd4c6('0x1b')]===_0xd4c6('0x1c')&&typeof _0x3deb85[_0xd4c6('0x1d')]==='undefined';var _0x761a3e=_0x25e1fb[_0xd4c6('0x1e')];var _0x23a16f=_0x25204d?0x0:_0x3deb85[_0xd4c6('0x1b')];var _0x31f328=_0x25204d?_0x25e1fb['count']:_0x3deb85[_0xd4c6('0x1b')]+_0x3deb85[_0xd4c6('0x1d')];var _0x359577;if(_0x31f328>=_0x761a3e){_0x31f328=_0x761a3e;_0x359577=0xc8;}else{_0x359577=0xce;}_0x11e6c2['status'](_0x359577);return _0x11e6c2[_0xd4c6('0x1f')](_0xd4c6('0x20'),_0x23a16f+'-'+_0x31f328+'/'+_0x761a3e)[_0xd4c6('0x21')](_0x25e1fb);}return null;};}function patchUpdates(_0x3b1658){return function(_0x48dbf8){try{jsonpatch[_0xd4c6('0x22')](_0x48dbf8,_0x3b1658,!![]);}catch(_0x4a10d8){return BPromise[_0xd4c6('0x23')](_0x4a10d8);}return _0x48dbf8[_0xd4c6('0x24')]();};}function saveUpdates(_0x2750c9,_0x222813){return function(_0xf536e0){if(_0xf536e0){return _0xf536e0[_0xd4c6('0x25')](_0x2750c9)[_0xd4c6('0x26')](function(_0x3f99e8){return _0x3f99e8;});}return null;};}function removeEntity(_0x155cb3,_0x466330){return function(_0x1ebb17){if(_0x1ebb17){return _0x1ebb17[_0xd4c6('0x27')]()['then'](function(){_0x155cb3['status'](0xcc)[_0xd4c6('0x1a')]();});}};}function handleEntityNotFound(_0x2febbf,_0x4a5390){return function(_0x1dee19){if(!_0x1dee19){_0x2febbf[_0xd4c6('0x18')](0x194);}return _0x1dee19;};}function handleError(_0x100411,_0x565b25){_0x565b25=_0x565b25||0x1f4;return function(_0x35b50c){logger[_0xd4c6('0x28')](_0x35b50c['stack']);if(_0x35b50c[_0xd4c6('0x29')]){delete _0x35b50c[_0xd4c6('0x29')];}_0x100411[_0xd4c6('0x19')](_0x565b25)['send'](_0x35b50c);};}function getMustacheRender(_0x3ce942,_0x3b656d){return Mustache[_0xd4c6('0x2a')](_0x3ce942,_[_0xd4c6('0x2b')](_0x3b656d[_0xd4c6('0x2c')],{'contact':_0x3b656d[_0xd4c6('0x2d')],'message':_0x3b656d[_0xd4c6('0x2e')],'agent':_0x3b656d[_0xd4c6('0x2f')],'interaction':_0x3b656d[_0xd4c6('0x30')],'account':_0x3b656d[_0xd4c6('0x31')]}))||'';}exports[_0xd4c6('0x32')]=function(_0x31e3d0,_0x15d312){var _0x112969={},_0x5d7997={},_0x25229b={'count':0x0,'rows':[]};var _0x334f2a=_[_0xd4c6('0x33')](db[_0xd4c6('0x34')]['rawAttributes'],function(_0x4f8a76){return{'name':_0x4f8a76['fieldName'],'type':_0x4f8a76[_0xd4c6('0x35')][_0xd4c6('0x36')]};});_0x5d7997[_0xd4c6('0x37')]=_[_0xd4c6('0x33')](_0x334f2a,_0xd4c6('0x29'));_0x5d7997[_0xd4c6('0x38')]=_[_0xd4c6('0x39')](_0x31e3d0['query']);_0x5d7997[_0xd4c6('0x3a')]=_[_0xd4c6('0x3b')](_0x5d7997[_0xd4c6('0x37')],_0x5d7997['query']);_0x112969[_0xd4c6('0x3c')]=_[_0xd4c6('0x3b')](_0x5d7997[_0xd4c6('0x37')],qs['fields'](_0x31e3d0[_0xd4c6('0x38')][_0xd4c6('0x3d')]));_0x112969[_0xd4c6('0x3c')]=_0x112969[_0xd4c6('0x3c')]['length']?_0x112969[_0xd4c6('0x3c')]:_0x5d7997[_0xd4c6('0x37')];if(!_0x31e3d0[_0xd4c6('0x38')][_0xd4c6('0x3e')](_0xd4c6('0x3f'))){_0x112969['limit']=qs[_0xd4c6('0x1d')](_0x31e3d0[_0xd4c6('0x38')][_0xd4c6('0x1d')]);_0x112969[_0xd4c6('0x1b')]=qs[_0xd4c6('0x1b')](_0x31e3d0[_0xd4c6('0x38')]['offset']);}_0x112969[_0xd4c6('0x40')]=qs[_0xd4c6('0x41')](_0x31e3d0[_0xd4c6('0x38')]['sort']);_0x112969[_0xd4c6('0x42')]=qs[_0xd4c6('0x3a')](_[_0xd4c6('0x43')](_0x31e3d0[_0xd4c6('0x38')],_0x5d7997[_0xd4c6('0x3a')]),_0x334f2a);if(_0x31e3d0[_0xd4c6('0x38')][_0xd4c6('0x44')]){_0x112969[_0xd4c6('0x42')]=_[_0xd4c6('0x2b')](_0x112969['where'],{'$or':_[_0xd4c6('0x33')](_0x334f2a,function(_0x47e104){if(_0x47e104['type']!==_0xd4c6('0x45')){var _0x409c11={};_0x409c11[_0x47e104[_0xd4c6('0x29')]]={'$like':'%'+_0x31e3d0[_0xd4c6('0x38')][_0xd4c6('0x44')]+'%'};return _0x409c11;}})});}_0x112969=_['merge']({},_0x112969,_0x31e3d0['options']);var _0x38e3c2={'where':_0x112969[_0xd4c6('0x42')]};return db[_0xd4c6('0x34')][_0xd4c6('0x1e')](_0x38e3c2)['then'](function(_0x211d47){_0x25229b['count']=_0x211d47;if(_0x31e3d0[_0xd4c6('0x38')][_0xd4c6('0x46')]){_0x112969[_0xd4c6('0x47')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xd4c6('0x48')](_0x112969);})[_0xd4c6('0x26')](function(_0x313073){_0x25229b[_0xd4c6('0x49')]=_0x313073;return _0x25229b;})[_0xd4c6('0x26')](respondWithFilteredResult(_0x15d312,_0x112969))[_0xd4c6('0x4a')](handleError(_0x15d312,null));};exports[_0xd4c6('0x4b')]=function(_0x3beb89,_0x343d94){var _0x563c61={'raw':!![],'where':{'id':_0x3beb89[_0xd4c6('0x4c')]['id']}},_0x1333f4={};_0x1333f4[_0xd4c6('0x37')]=_['keys'](db[_0xd4c6('0x34')][_0xd4c6('0x4d')]);_0x1333f4[_0xd4c6('0x38')]=_['keys'](_0x3beb89['query']);_0x1333f4[_0xd4c6('0x3a')]=_[_0xd4c6('0x3b')](_0x1333f4[_0xd4c6('0x37')],_0x1333f4['query']);_0x563c61[_0xd4c6('0x3c')]=_[_0xd4c6('0x3b')](_0x1333f4[_0xd4c6('0x37')],qs[_0xd4c6('0x3d')](_0x3beb89[_0xd4c6('0x38')][_0xd4c6('0x3d')]));_0x563c61['attributes']=_0x563c61[_0xd4c6('0x3c')][_0xd4c6('0x4e')]?_0x563c61[_0xd4c6('0x3c')]:_0x1333f4[_0xd4c6('0x37')];if(_0x3beb89[_0xd4c6('0x38')][_0xd4c6('0x46')]){_0x563c61[_0xd4c6('0x47')]=[{'all':!![]}];}_0x563c61=_[_0xd4c6('0x2b')]({},_0x563c61,_0x3beb89['options']);return db['JscriptyAnswerReport'][_0xd4c6('0x4f')](_0x563c61)[_0xd4c6('0x26')](handleEntityNotFound(_0x343d94,null))[_0xd4c6('0x26')](respondWithResult(_0x343d94,null))['catch'](handleError(_0x343d94,null));};exports[_0xd4c6('0x50')]=function(_0x400d66,_0x380bef){return db['JscriptyAnswerReport'][_0xd4c6('0x50')](_0x400d66[_0xd4c6('0x2c')],{})[_0xd4c6('0x26')](respondWithResult(_0x380bef,0xc9))[_0xd4c6('0x4a')](handleError(_0x380bef,null));};exports['update']=function(_0xf82f71,_0x175a59){if(_0xf82f71[_0xd4c6('0x2c')]['id']){delete _0xf82f71[_0xd4c6('0x2c')]['id'];}return db[_0xd4c6('0x34')][_0xd4c6('0x4f')]({'where':{'id':_0xf82f71[_0xd4c6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x175a59,null))[_0xd4c6('0x26')](saveUpdates(_0xf82f71[_0xd4c6('0x2c')],null))[_0xd4c6('0x26')](respondWithResult(_0x175a59,null))['catch'](handleError(_0x175a59,null));};exports[_0xd4c6('0x27')]=function(_0x1ca24a,_0x46bf10){return db[_0xd4c6('0x34')][_0xd4c6('0x4f')]({'where':{'id':_0x1ca24a[_0xd4c6('0x4c')]['id']}})[_0xd4c6('0x26')](handleEntityNotFound(_0x46bf10,null))['then'](removeEntity(_0x46bf10,null))[_0xd4c6('0x4a')](handleError(_0x46bf10,null));};exports['describe']=function(_0x4b56b2,_0x435189){return db['JscriptyAnswerReport'][_0xd4c6('0x51')]()['then'](respondWithResult(_0x435189,null))[_0xd4c6('0x4a')](handleError(_0x435189,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index b27ebf3..3c9262a 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 _0x79bf=['../../config/logger','api','bluebird','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','util'];(function(_0x40750d,_0x593094){var _0x42d026=function(_0x1168bb){while(--_0x1168bb){_0x40750d['push'](_0x40750d['shift']());}};_0x42d026(++_0x593094);}(_0x79bf,0x171));var _0xf79b=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0x79bf[_0xce93c];return _0x230720;};'use strict';var _=require('lodash');var util=require(_0xf79b('0x0'));var logger=require(_0xf79b('0x1'))(_0xf79b('0x2'));var moment=require('moment');var BPromise=require(_0xf79b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf79b('0x4'));var rimraf=require(_0xf79b('0x5'));var config=require('../../config/environment');var attributes=require(_0xf79b('0x6'));module[_0xf79b('0x7')]=function(_0x3b031c,_0x5da04e){return _0x3b031c[_0xf79b('0x8')](_0xf79b('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc775=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','path','./jscriptyAnswerReport.attributes','define'];(function(_0x3a8b76,_0x3f124b){var _0x48c78a=function(_0x251730){while(--_0x251730){_0x3a8b76['push'](_0x3a8b76['shift']());}};_0x48c78a(++_0x3f124b);}(_0xc775,0x183));var _0x5c77=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc775[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x5c77('0x0'));var util=require(_0x5c77('0x1'));var logger=require(_0x5c77('0x2'))(_0x5c77('0x3'));var moment=require(_0x5c77('0x4'));var BPromise=require(_0x5c77('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c77('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5c77('0x7'));module['exports']=function(_0x13971d,_0x224603){return _0x13971d[_0x5c77('0x8')](_0x5c77('0x9'),attributes,{'tableName':_0x5c77('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 09c7b66..bbefb6d 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 _0x0c98=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird'];(function(_0xc10dd9,_0x6b6547){var _0x33a94a=function(_0x2f283d){while(--_0x2f283d){_0xc10dd9['push'](_0xc10dd9['shift']());}};_0x33a94a(++_0x6b6547);}(_0x0c98,0x11c));var _0x80c9=function(_0x15fdee,_0x2bb83b){_0x15fdee=_0x15fdee-0x0;var _0x4c65fa=_0x0c98[_0x15fdee];return _0x4c65fa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x80c9('0x0'));var BPromise=require(_0x80c9('0x1'));var rs=require(_0x80c9('0x2'));var fs=require('fs');var Redis=require(_0x80c9('0x3'));var db=require(_0x80c9('0x4'))['db'];var utils=require(_0x80c9('0x5'));var logger=require(_0x80c9('0x6'))(_0x80c9('0x7'));var config=require(_0x80c9('0x8'));var jayson=require(_0x80c9('0x9'));var client=jayson[_0x80c9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51dd0c,_0x52bb70,_0x2fccb0){return new BPromise(function(_0x4a3713,_0x2c7fda){return client[_0x80c9('0xb')](_0x51dd0c,_0x2fccb0)['then'](function(_0x438a15){logger[_0x80c9('0xc')](_0x80c9('0xd'),_0x52bb70,'request\x20sent');logger[_0x80c9('0xe')](_0x80c9('0xf'),_0x52bb70,'request\x20sent',JSON[_0x80c9('0x10')](_0x438a15));if(_0x438a15['error']){if(_0x438a15[_0x80c9('0x11')][_0x80c9('0x12')]===0x1f4){logger[_0x80c9('0x11')](_0x80c9('0xd'),_0x52bb70,_0x438a15[_0x80c9('0x11')][_0x80c9('0x13')]);return _0x2c7fda(_0x438a15[_0x80c9('0x11')][_0x80c9('0x13')]);}logger[_0x80c9('0x11')](_0x80c9('0xd'),_0x52bb70,_0x438a15[_0x80c9('0x11')][_0x80c9('0x13')]);return _0x4a3713(_0x438a15[_0x80c9('0x11')][_0x80c9('0x13')]);}else{logger['info'](_0x80c9('0xd'),_0x52bb70,'request\x20sent');_0x4a3713(_0x438a15[_0x80c9('0x14')][_0x80c9('0x13')]);}})[_0x80c9('0x15')](function(_0x1cb1a2){logger[_0x80c9('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x52bb70,_0x1cb1a2);_0x2c7fda(_0x1cb1a2);});});} \ No newline at end of file +var _0xb874=['JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2c072a,_0x426a24){var _0x1c1615=function(_0x189069){while(--_0x189069){_0x2c072a['push'](_0x2c072a['shift']());}};_0x1c1615(++_0x426a24);}(_0xb874,0x171));var _0x4b87=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb874[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x4b87('0x0'));var util=require(_0x4b87('0x1'));var moment=require(_0x4b87('0x2'));var BPromise=require(_0x4b87('0x3'));var rs=require(_0x4b87('0x4'));var fs=require('fs');var Redis=require(_0x4b87('0x5'));var db=require(_0x4b87('0x6'))['db'];var utils=require(_0x4b87('0x7'));var logger=require('../../config/logger')(_0x4b87('0x8'));var config=require(_0x4b87('0x9'));var jayson=require(_0x4b87('0xa'));var client=jayson[_0x4b87('0xb')][_0x4b87('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d00e4,_0x13791a,_0x45f652){return new BPromise(function(_0x28e730,_0xbbb056){return client[_0x4b87('0xd')](_0x2d00e4,_0x45f652)[_0x4b87('0xe')](function(_0x3b4b07){logger['info'](_0x4b87('0xf'),_0x13791a,_0x4b87('0x10'));logger['debug'](_0x4b87('0x11'),_0x13791a,_0x4b87('0x10'),JSON[_0x4b87('0x12')](_0x3b4b07));if(_0x3b4b07[_0x4b87('0x13')]){if(_0x3b4b07['error'][_0x4b87('0x14')]===0x1f4){logger[_0x4b87('0x13')](_0x4b87('0xf'),_0x13791a,_0x3b4b07[_0x4b87('0x13')]['message']);return _0xbbb056(_0x3b4b07['error'][_0x4b87('0x15')]);}logger['error'](_0x4b87('0xf'),_0x13791a,_0x3b4b07['error'][_0x4b87('0x15')]);return _0x28e730(_0x3b4b07[_0x4b87('0x13')][_0x4b87('0x15')]);}else{logger[_0x4b87('0x16')](_0x4b87('0xf'),_0x13791a,'request\x20sent');_0x28e730(_0x3b4b07[_0x4b87('0x17')][_0x4b87('0x15')]);}})['catch'](function(_0xbd2307){logger[_0x4b87('0x13')](_0x4b87('0xf'),_0x13791a,_0xbd2307);_0xbbb056(_0xbd2307);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index aef2e1c..af0ea75 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 _0x3d04=['get','isAuthenticated','show','/:id/sessions','getSessions','/:id/summary','30s','getSummary','create','/:id/clone','clone','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller'];(function(_0x56fd90,_0x4e59d0){var _0x1a19ea=function(_0x286598){while(--_0x286598){_0x56fd90['push'](_0x56fd90['shift']());}};_0x1a19ea(++_0x4e59d0);}(_0x3d04,0xbe));var _0x43d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3d04[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var fs_extra=require(_0x43d0('0x6'));var auth=require(_0x43d0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x43d0('0x8'));var controller=require(_0x43d0('0x9'));router[_0x43d0('0xa')]('/',auth[_0x43d0('0xb')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x43d0('0xc')]);router[_0x43d0('0xa')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0xe')]);router['get']('/:id/answers',auth[_0x43d0('0xb')](),controller['getAnswers']);router['get'](_0x43d0('0xf'),auth[_0x43d0('0xb')](),timeout(_0x43d0('0x10')),controller[_0x43d0('0x11')]);router['post']('/',auth[_0x43d0('0xb')](),controller[_0x43d0('0x12')]);router['post'](_0x43d0('0x13'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x14')]);router['put'](_0x43d0('0x15'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x16')]);router['delete'](_0x43d0('0x15'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x17')]);module[_0x43d0('0x18')]=router; \ No newline at end of file +var _0xdeb3=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','get','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','post','create','put','/:id','delete','destroy','exports','util'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xdeb3,0xb7));var _0x3deb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdeb3[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require(_0x3deb('0x0'));var path=require(_0x3deb('0x1'));var timeout=require(_0x3deb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3deb('0x3'));var auth=require(_0x3deb('0x4'));var interaction=require(_0x3deb('0x5'));var config=require(_0x3deb('0x6'));var controller=require(_0x3deb('0x7'));router['get']('/',auth[_0x3deb('0x8')](),controller['index']);router[_0x3deb('0x9')]('/:id',auth[_0x3deb('0x8')](),controller[_0x3deb('0xa')]);router[_0x3deb('0x9')](_0x3deb('0xb'),auth[_0x3deb('0x8')](),controller[_0x3deb('0xc')]);router[_0x3deb('0x9')](_0x3deb('0xd'),auth[_0x3deb('0x8')](),controller['getAnswers']);router['get'](_0x3deb('0xe'),auth[_0x3deb('0x8')](),timeout(_0x3deb('0xf')),controller['getSummary']);router[_0x3deb('0x10')]('/',auth[_0x3deb('0x8')](),controller[_0x3deb('0x11')]);router[_0x3deb('0x10')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x3deb('0x12')](_0x3deb('0x13'),auth[_0x3deb('0x8')](),controller['update']);router[_0x3deb('0x14')](_0x3deb('0x13'),auth['isAuthenticated'](),controller[_0x3deb('0x15')]);module[_0x3deb('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 85c42e9..c5af67b 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 _0xed11=['STRING','name','long','isObjectLike','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util','exports'];(function(_0x4e0718,_0x126e97){var _0x44aba5=function(_0x33ddc6){while(--_0x33ddc6){_0x4e0718['push'](_0x4e0718['shift']());}};_0x44aba5(++_0x126e97);}(_0xed11,0x146));var _0x1ed1=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xed11[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x1ed1('0x0'));var _=require(_0x1ed1('0x1'));var util=require(_0x1ed1('0x2'));module[_0x1ed1('0x3')]={'name':{'type':Sequelize[_0x1ed1('0x4')],'unique':_0x1ed1('0x5')},'description':{'type':Sequelize[_0x1ed1('0x4')]},'formData':{'type':Sequelize['TEXT'](_0x1ed1('0x6')),'set':function(_0x422c8f){if(_[_0x1ed1('0x7')](_0x422c8f)){this[_0x1ed1('0x8')](_0x1ed1('0x9'),JSON[_0x1ed1('0xa')](_0x422c8f));}else if(_['isString'](_0x422c8f)){this['setDataValue'](_0x1ed1('0x9'),_0x422c8f);}else{this[_0x1ed1('0x8')](_0x1ed1('0x9'),util[_0x1ed1('0xb')](_0x1ed1('0xc'),this[_0x1ed1('0xd')](_0x1ed1('0x5'))||'',this[_0x1ed1('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1ed1('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x1ed1('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xeef6=['util','exports','name','TEXT','long','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize'];(function(_0x349530,_0x45d85e){var _0x373ed4=function(_0x2a1f1e){while(--_0x2a1f1e){_0x349530['push'](_0x349530['shift']());}};_0x373ed4(++_0x45d85e);}(_0xeef6,0x137));var _0x6eef=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xeef6[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x6eef('0x0'));var _=require('lodash');var util=require(_0x6eef('0x1'));module[_0x6eef('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x6eef('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x6eef('0x4')](_0x6eef('0x5')),'set':function(_0x2cd763){if(_['isObjectLike'](_0x2cd763)){this[_0x6eef('0x6')](_0x6eef('0x7'),JSON['stringify'](_0x2cd763));}else if(_['isString'](_0x2cd763)){this[_0x6eef('0x6')](_0x6eef('0x7'),_0x2cd763);}else{this['setDataValue']('formData',util[_0x6eef('0x8')](_0x6eef('0x9'),this[_0x6eef('0xa')](_0x6eef('0x3'))||'',this[_0x6eef('0xa')](_0x6eef('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6eef('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 59eecc3..e204464 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 _0x1de1=['question','format','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','get','Projects','UserProfileResource','destroy','stack','name','render','merge','contact','message','agent','index','map','JscriptyProject','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','clone','rawAttributes','includeAll','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','JscriptySessionReport','nolimit','rows','getAnswers','ProjectId','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','startTime','starttime','-createdAt','questionId'];(function(_0xc2eea8,_0x55432c){var _0x1c1010=function(_0x54cc3b){while(--_0x54cc3b){_0xc2eea8['push'](_0xc2eea8['shift']());}};_0x1c1010(++_0x55432c);}(_0x1de1,0x1d4));var _0x11de=function(_0x14c375,_0xc0bdb){_0x14c375=_0x14c375-0x0;var _0x26302e=_0x1de1[_0x14c375];return _0x26302e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11de('0x0'));var jsonpatch=require(_0x11de('0x1'));var rp=require(_0x11de('0x2'));var moment=require(_0x11de('0x3'));var BPromise=require(_0x11de('0x4'));var Mustache=require('mustache');var util=require(_0x11de('0x5'));var path=require('path');var sox=require(_0x11de('0x6'));var csv=require(_0x11de('0x7'));var ejs=require(_0x11de('0x8'));var fs=require('fs');var fs_extra=require(_0x11de('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x11de('0xa'));var jsforce=require(_0x11de('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x11de('0x7'));var querystring=require(_0x11de('0xc'));var Papa=require(_0x11de('0xd'));var Redis=require('ioredis');var authService=require(_0x11de('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x11de('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x11de('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x11de('0x11'))['db'];function respondWithStatusCode(_0x5225fe,_0x28c02e){_0x28c02e=_0x28c02e||0xcc;return function(_0x315221){if(_0x315221){return _0x5225fe[_0x11de('0x12')](_0x28c02e);}return _0x5225fe[_0x11de('0x13')](_0x28c02e)[_0x11de('0x14')]();};}function respondWithResult(_0x5360d4,_0xd7f969){_0xd7f969=_0xd7f969||0xc8;return function(_0xb460d7){if(_0xb460d7){return _0x5360d4[_0x11de('0x13')](_0xd7f969)[_0x11de('0x15')](_0xb460d7);}};}function respondWithFilteredResult(_0x11a48a,_0x4d6047){return function(_0x20cbb9){if(_0x20cbb9){var _0x2abbe9=typeof _0x4d6047[_0x11de('0x16')]===_0x11de('0x17')&&typeof _0x4d6047['limit']===_0x11de('0x17');var _0x3edb08=_0x20cbb9[_0x11de('0x18')];var _0x4ae595=_0x2abbe9?0x0:_0x4d6047[_0x11de('0x16')];var _0x2edade=_0x2abbe9?_0x20cbb9[_0x11de('0x18')]:_0x4d6047[_0x11de('0x16')]+_0x4d6047['limit'];var _0x2e22e4;if(_0x2edade>=_0x3edb08){_0x2edade=_0x3edb08;_0x2e22e4=0xc8;}else{_0x2e22e4=0xce;}_0x11a48a[_0x11de('0x13')](_0x2e22e4);return _0x11a48a[_0x11de('0x19')]('Content-Range',_0x4ae595+'-'+_0x2edade+'/'+_0x3edb08)[_0x11de('0x15')](_0x20cbb9);}return null;};}function patchUpdates(_0x39f20d){return function(_0x3e0b46){try{jsonpatch[_0x11de('0x1a')](_0x3e0b46,_0x39f20d,!![]);}catch(_0x20ae1b){return BPromise[_0x11de('0x1b')](_0x20ae1b);}return _0x3e0b46[_0x11de('0x1c')]();};}function saveUpdates(_0x1ca2ee,_0x3cfd41){return function(_0x617cba){if(_0x617cba){return _0x617cba[_0x11de('0x1d')](_0x1ca2ee)['then'](function(_0x37f32b){return _0x37f32b;});}return null;};}function removeEntity(_0x591038,_0x4aad53){return function(_0x26e5c9){if(_0x26e5c9){return _0x26e5c9['destroy']()[_0x11de('0x1e')](function(){var _0x31ceb2=_0x26e5c9[_0x11de('0x1f')]({'plain':!![]});var _0x222714=_0x11de('0x20');return db[_0x11de('0x21')][_0x11de('0x22')]({'where':{'type':_0x222714,'resourceId':_0x31ceb2['id']}})[_0x11de('0x1e')](function(){return _0x26e5c9;});})[_0x11de('0x1e')](function(){_0x591038[_0x11de('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0xee5f62,_0x3ac217){return function(_0x33f280){if(!_0x33f280){_0xee5f62[_0x11de('0x12')](0x194);}return _0x33f280;};}function handleError(_0x1db78b,_0x4dcf8e){_0x4dcf8e=_0x4dcf8e||0x1f4;return function(_0x2339e3){logger['error'](_0x2339e3[_0x11de('0x23')]);if(_0x2339e3['name']){delete _0x2339e3[_0x11de('0x24')];}_0x1db78b[_0x11de('0x13')](_0x4dcf8e)['send'](_0x2339e3);};}function getMustacheRender(_0x33dfce,_0x31d6b2){return Mustache[_0x11de('0x25')](_0x33dfce,_[_0x11de('0x26')](_0x31d6b2['body'],{'contact':_0x31d6b2[_0x11de('0x27')],'message':_0x31d6b2[_0x11de('0x28')],'agent':_0x31d6b2[_0x11de('0x29')],'interaction':_0x31d6b2['interaction'],'account':_0x31d6b2['account']}))||'';}exports[_0x11de('0x2a')]=function(_0x2c8e04,_0x1b49ed){var _0x3bfa10={},_0x17d3c3={},_0x337e6e={'count':0x0,'rows':[]};var _0x4b280e=_[_0x11de('0x2b')](db[_0x11de('0x2c')]['rawAttributes'],function(_0x58213c){return{'name':_0x58213c[_0x11de('0x2d')],'type':_0x58213c[_0x11de('0x2e')][_0x11de('0x2f')]};});_0x17d3c3[_0x11de('0x30')]=_[_0x11de('0x2b')](_0x4b280e,'name');_0x17d3c3[_0x11de('0x31')]=_[_0x11de('0x32')](_0x2c8e04[_0x11de('0x31')]);_0x17d3c3[_0x11de('0x33')]=_[_0x11de('0x34')](_0x17d3c3['model'],_0x17d3c3['query']);_0x3bfa10[_0x11de('0x35')]=_['intersection'](_0x17d3c3['model'],qs[_0x11de('0x36')](_0x2c8e04[_0x11de('0x31')][_0x11de('0x36')]));_0x3bfa10['attributes']=_0x3bfa10[_0x11de('0x35')][_0x11de('0x37')]?_0x3bfa10[_0x11de('0x35')]:_0x17d3c3[_0x11de('0x30')];if(!_0x2c8e04[_0x11de('0x31')][_0x11de('0x38')]('nolimit')){_0x3bfa10[_0x11de('0x39')]=qs['limit'](_0x2c8e04[_0x11de('0x31')][_0x11de('0x39')]);_0x3bfa10[_0x11de('0x16')]=qs['offset'](_0x2c8e04[_0x11de('0x31')][_0x11de('0x16')]);}_0x3bfa10[_0x11de('0x3a')]=qs[_0x11de('0x3b')](_0x2c8e04[_0x11de('0x31')][_0x11de('0x3b')]);_0x3bfa10[_0x11de('0x3c')]=qs[_0x11de('0x33')](_[_0x11de('0x3d')](_0x2c8e04['query'],_0x17d3c3[_0x11de('0x33')]),_0x4b280e);if(_0x2c8e04[_0x11de('0x31')][_0x11de('0x3e')]){_0x3bfa10[_0x11de('0x3c')]=_[_0x11de('0x26')](_0x3bfa10[_0x11de('0x3c')],{'$or':_[_0x11de('0x2b')](_0x4b280e,function(_0x52a651){if(_0x52a651[_0x11de('0x2e')]!==_0x11de('0x3f')){var _0x54ffbc={};_0x54ffbc[_0x52a651[_0x11de('0x24')]]={'$like':'%'+_0x2c8e04['query'][_0x11de('0x3e')]+'%'};return _0x54ffbc;}})});}_0x3bfa10=_[_0x11de('0x26')]({},_0x3bfa10,_0x2c8e04[_0x11de('0x40')]);var _0x48c259={'where':_0x3bfa10['where']};return db['JscriptyProject'][_0x11de('0x18')](_0x48c259)[_0x11de('0x1e')](function(_0x2f6e32){_0x337e6e[_0x11de('0x18')]=_0x2f6e32;if(_0x2c8e04[_0x11de('0x31')]['includeAll']){_0x3bfa10[_0x11de('0x41')]=[{'all':!![]}];}return db[_0x11de('0x2c')][_0x11de('0x42')](_0x3bfa10);})['then'](function(_0x9194e7){_0x337e6e['rows']=_0x9194e7;return _0x337e6e;})[_0x11de('0x1e')](respondWithFilteredResult(_0x1b49ed,_0x3bfa10))[_0x11de('0x43')](handleError(_0x1b49ed,null));};exports[_0x11de('0x44')]=function(_0x40942e,_0x3e4016){var _0xa03bef={'raw':![],'where':{'id':_0x40942e[_0x11de('0x45')]['id']}},_0x336768={};_0x336768[_0x11de('0x30')]=_['keys'](db[_0x11de('0x2c')]['rawAttributes']);_0x336768[_0x11de('0x31')]=_[_0x11de('0x32')](_0x40942e[_0x11de('0x31')]);_0x336768['filters']=_[_0x11de('0x34')](_0x336768[_0x11de('0x30')],_0x336768[_0x11de('0x31')]);_0xa03bef[_0x11de('0x35')]=_['intersection'](_0x336768[_0x11de('0x30')],qs[_0x11de('0x36')](_0x40942e[_0x11de('0x31')]['fields']));_0xa03bef[_0x11de('0x35')]=_0xa03bef['attributes'][_0x11de('0x37')]?_0xa03bef[_0x11de('0x35')]:_0x336768[_0x11de('0x30')];if(_0x40942e[_0x11de('0x31')]['includeAll']){_0xa03bef['include']=[{'all':!![]}];}_0xa03bef=_[_0x11de('0x26')]({},_0xa03bef,_0x40942e['options']);return db[_0x11de('0x2c')]['find'](_0xa03bef)['then'](handleEntityNotFound(_0x3e4016,null))[_0x11de('0x1e')](respondWithResult(_0x3e4016,null))[_0x11de('0x43')](handleError(_0x3e4016,null));};exports['create']=function(_0x238d6f,_0x5d3904){return db[_0x11de('0x2c')][_0x11de('0x46')](_0x238d6f[_0x11de('0x47')],{})[_0x11de('0x1e')](function(_0x1ec05b){var _0x17f868=_0x238d6f[_0x11de('0x48')][_0x11de('0x1f')]({'plain':!![]});if(!_0x17f868)throw new Error(_0x11de('0x49'));if(_0x17f868['role']==='user'){var _0x1700a3=_0x1ec05b[_0x11de('0x1f')]({'plain':!![]});var _0x187fc4='Projects';return db[_0x11de('0x4a')][_0x11de('0x4b')]({'where':{'name':_0x187fc4,'userProfileId':_0x17f868[_0x11de('0x4c')]},'raw':!![]})[_0x11de('0x1e')](function(_0x49b5ec){if(_0x49b5ec&&_0x49b5ec[_0x11de('0x4d')]===0x0){return db[_0x11de('0x21')][_0x11de('0x46')]({'name':_0x1700a3['name'],'resourceId':_0x1700a3['id'],'type':_0x49b5ec['name'],'sectionId':_0x49b5ec['id']},{})[_0x11de('0x1e')](function(){return _0x1ec05b;});}else{return _0x1ec05b;}})[_0x11de('0x43')](function(_0x1b9e58){logger[_0x11de('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b9e58);throw _0x1b9e58;});}return _0x1ec05b;})[_0x11de('0x1e')](respondWithResult(_0x5d3904,0xc9))[_0x11de('0x43')](handleError(_0x5d3904,null));};exports[_0x11de('0x4f')]=function(_0x44daab,_0x56f1cd){var _0x267a71={'where':{'id':_0x44daab[_0x11de('0x45')]['id']}},_0x4a66cd={};_0x4a66cd[_0x11de('0x30')]=_[_0x11de('0x32')](db[_0x11de('0x2c')][_0x11de('0x50')]);_0x267a71[_0x11de('0x35')]=_[_0x11de('0x34')](_0x4a66cd['model'],qs[_0x11de('0x36')](_0x44daab['query'][_0x11de('0x36')]));_0x267a71['attributes']=_0x267a71['attributes'][_0x11de('0x37')]?_0x267a71[_0x11de('0x35')]:_0x4a66cd[_0x11de('0x30')];if(_0x44daab[_0x11de('0x31')][_0x11de('0x51')]){_0x267a71[_0x11de('0x41')]=[{'all':!![]}];}_0x267a71=_[_0x11de('0x26')]({},_0x267a71,_0x44daab[_0x11de('0x40')]);return db['JscriptyProject'][_0x11de('0x4b')](_0x267a71)[_0x11de('0x1e')](handleEntityNotFound(_0x56f1cd,null))['then'](function(_0x29806b){if(_0x29806b){var _0x496944=_0x29806b[_0x11de('0x1f')]({'plain':!![]});_0x496944=qs[_0x11de('0x52')](_0x496944,['id',_0x11de('0x53'),_0x11de('0x54')]);_0x44daab['body']=_['omit'](_0x44daab['body'],['id',_0x11de('0x53'),'updatedAt']);return db[_0x11de('0x2c')][_0x11de('0x46')](_[_0x11de('0x26')](_0x496944,_0x44daab[_0x11de('0x47')]),{'include':_0x44daab[_0x11de('0x31')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x4650c4){var _0x15da76=_0x44daab[_0x11de('0x48')][_0x11de('0x1f')]({'plain':!![]});if(!_0x15da76)throw new Error(_0x11de('0x49'));if(_0x15da76['role']==='user'){var _0x52c0ff=_0x4650c4[_0x11de('0x1f')]({'plain':!![]});var _0x4a14c7=_0x11de('0x20');return db['UserProfileSection'][_0x11de('0x4b')]({'where':{'name':_0x4a14c7,'userProfileId':_0x15da76[_0x11de('0x4c')]},'raw':!![]})[_0x11de('0x1e')](function(_0x14fb6f){if(_0x14fb6f&&_0x14fb6f[_0x11de('0x4d')]===0x0){return db[_0x11de('0x21')][_0x11de('0x46')]({'name':_0x52c0ff['name'],'resourceId':_0x52c0ff['id'],'type':_0x14fb6f['name'],'sectionId':_0x14fb6f['id']},{})[_0x11de('0x1e')](function(){return _0x4650c4;});}else{return _0x4650c4;}})[_0x11de('0x43')](function(_0x50905f){logger['error'](_0x11de('0x55'),_0x50905f);throw _0x50905f;});}return _0x4650c4;});}})['then'](respondWithResult(_0x56f1cd,0xc9))[_0x11de('0x43')](handleError(_0x56f1cd,null));};exports[_0x11de('0x1d')]=function(_0x50d27f,_0x5d8e60){if(_0x50d27f['body']['id']){delete _0x50d27f['body']['id'];}return db[_0x11de('0x2c')]['find']({'where':{'id':_0x50d27f[_0x11de('0x45')]['id']}})[_0x11de('0x1e')](handleEntityNotFound(_0x5d8e60,null))[_0x11de('0x1e')](saveUpdates(_0x50d27f[_0x11de('0x47')],null))[_0x11de('0x1e')](respondWithResult(_0x5d8e60,null))[_0x11de('0x43')](handleError(_0x5d8e60,null));};exports[_0x11de('0x22')]=function(_0x582e1a,_0x2557b5){return db[_0x11de('0x2c')][_0x11de('0x4b')]({'where':{'id':_0x582e1a['params']['id']}})[_0x11de('0x1e')](handleEntityNotFound(_0x2557b5,null))['then'](removeEntity(_0x2557b5,null))['catch'](handleError(_0x2557b5,null));};exports['getSessions']=function(_0x1171f0,_0x19effd,_0x4e17ce){var _0x1ddf09={'raw':!![],'where':{}};var _0x4488b2={};var _0x513b6e={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x11de('0x56')]({'where':{'id':_0x1171f0[_0x11de('0x45')]['id']}})[_0x11de('0x1e')](handleEntityNotFound(_0x19effd,null))[_0x11de('0x1e')](function(_0x81ab49){if(_0x81ab49){_0x4488b2[_0x11de('0x30')]=_['keys'](db[_0x11de('0x57')][_0x11de('0x50')]);_0x4488b2[_0x11de('0x31')]=_[_0x11de('0x32')](_0x1171f0[_0x11de('0x31')]);_0x4488b2['filters']=_[_0x11de('0x34')](_0x4488b2[_0x11de('0x30')],_0x4488b2['query']);_0x1ddf09['attributes']=_['intersection'](_0x4488b2['model'],qs[_0x11de('0x36')](_0x1171f0[_0x11de('0x31')][_0x11de('0x36')]));_0x1ddf09['attributes']=_0x1ddf09['attributes'][_0x11de('0x37')]?_0x1ddf09[_0x11de('0x35')]:_0x4488b2[_0x11de('0x30')];if(!_0x1171f0[_0x11de('0x31')]['hasOwnProperty'](_0x11de('0x58'))){_0x1ddf09[_0x11de('0x39')]=qs[_0x11de('0x39')](_0x1171f0[_0x11de('0x31')][_0x11de('0x39')]);_0x1ddf09[_0x11de('0x16')]=qs['offset'](_0x1171f0[_0x11de('0x31')]['offset']);}_0x1ddf09[_0x11de('0x3a')]=qs[_0x11de('0x3b')](_0x1171f0['query']['sort']);_0x1ddf09[_0x11de('0x3c')]=qs[_0x11de('0x33')](_['pick'](_0x1171f0[_0x11de('0x31')],_0x4488b2[_0x11de('0x33')]));_0x1ddf09[_0x11de('0x3c')]['ProjectId']=_0x81ab49['id'];if(_0x1171f0[_0x11de('0x31')]['filter']){_0x1ddf09[_0x11de('0x3c')]=_[_0x11de('0x26')](_0x1ddf09[_0x11de('0x3c')],{'$or':_['map'](_0x1ddf09['attributes'],function(_0xd4dcc1){var _0x528472={};_0x528472[_0xd4dcc1]={'$like':'%'+_0x1171f0[_0x11de('0x31')][_0x11de('0x3e')]+'%'};return _0x528472;})});}_0x1ddf09=_[_0x11de('0x26')]({},_0x1ddf09,_0x1171f0[_0x11de('0x40')]);return db[_0x11de('0x57')][_0x11de('0x18')]({'where':_0x1ddf09[_0x11de('0x3c')]})['then'](function(_0x1504e4){_0x513b6e[_0x11de('0x18')]=_0x1504e4;if(_0x1171f0[_0x11de('0x31')][_0x11de('0x51')]){_0x1ddf09[_0x11de('0x41')]=[{'all':!![]}];}return db[_0x11de('0x57')][_0x11de('0x42')](_0x1ddf09);})[_0x11de('0x1e')](function(_0x334596){_0x513b6e[_0x11de('0x59')]=_0x334596;return _0x513b6e;});}})[_0x11de('0x1e')](respondWithFilteredResult(_0x19effd,_0x1ddf09))['catch'](handleError(_0x19effd,null));};exports[_0x11de('0x5a')]=function(_0x2aca23,_0x3c8862,_0x316cdc){var _0x226b5e={'raw':!![],'where':{}};var _0x4cb9b9={};var _0x5c2873={'count':0x0,'rows':[]};return db[_0x11de('0x2c')][_0x11de('0x56')]({'where':{'id':_0x2aca23[_0x11de('0x45')]['id']}})[_0x11de('0x1e')](handleEntityNotFound(_0x3c8862,null))['then'](function(_0x2d610b){if(_0x2d610b){_0x4cb9b9[_0x11de('0x30')]=_[_0x11de('0x32')](db['JscriptyAnswerReport']['rawAttributes']);_0x4cb9b9['query']=_[_0x11de('0x32')](_0x2aca23['query']);_0x4cb9b9['filters']=_[_0x11de('0x34')](_0x4cb9b9[_0x11de('0x30')],_0x4cb9b9[_0x11de('0x31')]);_0x226b5e['attributes']=_[_0x11de('0x34')](_0x4cb9b9[_0x11de('0x30')],qs[_0x11de('0x36')](_0x2aca23['query'][_0x11de('0x36')]));_0x226b5e[_0x11de('0x35')]=_0x226b5e['attributes'][_0x11de('0x37')]?_0x226b5e['attributes']:_0x4cb9b9['model'];if(!_0x2aca23[_0x11de('0x31')][_0x11de('0x38')](_0x11de('0x58'))){_0x226b5e[_0x11de('0x39')]=qs[_0x11de('0x39')](_0x2aca23[_0x11de('0x31')][_0x11de('0x39')]);_0x226b5e[_0x11de('0x16')]=qs[_0x11de('0x16')](_0x2aca23[_0x11de('0x31')][_0x11de('0x16')]);}_0x226b5e[_0x11de('0x3a')]=qs[_0x11de('0x3b')](_0x2aca23['query'][_0x11de('0x3b')]);_0x226b5e[_0x11de('0x3c')]=qs[_0x11de('0x33')](_['pick'](_0x2aca23[_0x11de('0x31')],_0x4cb9b9[_0x11de('0x33')]));_0x226b5e['where'][_0x11de('0x5b')]=_0x2d610b['id'];if(_0x2aca23[_0x11de('0x31')]['filter']){_0x226b5e[_0x11de('0x3c')]=_[_0x11de('0x26')](_0x226b5e[_0x11de('0x3c')],{'$or':_[_0x11de('0x2b')](_0x226b5e[_0x11de('0x35')],function(_0x2467cc){var _0x397836={};_0x397836[_0x2467cc]={'$like':'%'+_0x2aca23['query'][_0x11de('0x3e')]+'%'};return _0x397836;})});}_0x226b5e=_[_0x11de('0x26')]({},_0x226b5e,_0x2aca23[_0x11de('0x40')]);return db[_0x11de('0x5c')][_0x11de('0x18')]({'where':_0x226b5e[_0x11de('0x3c')]})[_0x11de('0x1e')](function(_0x289ae5){_0x5c2873[_0x11de('0x18')]=_0x289ae5;if(_0x2aca23[_0x11de('0x31')][_0x11de('0x51')]){_0x226b5e['include']=[{'all':!![]}];}return db[_0x11de('0x5c')][_0x11de('0x42')](_0x226b5e);})[_0x11de('0x1e')](function(_0x497865){_0x5c2873[_0x11de('0x59')]=_0x497865;return _0x5c2873;});}})[_0x11de('0x1e')](respondWithFilteredResult(_0x3c8862,_0x226b5e))[_0x11de('0x43')](handleError(_0x3c8862,null));};function char(_0x19807d){return _0x11de('0x5d')===typeof _0x19807d?String['fromCharCode']['apply'](null,arguments):_0x19807d;}function needsEncapsulation(_0x1f6b3b){return!!_0x1f6b3b&&(_0x1f6b3b[_0x11de('0x5e')]()[_0x11de('0x5f')](char(0xd))>=0x0||_0x1f6b3b[_0x11de('0x5e')]()[_0x11de('0x5f')](char(0xa))>=0x0||_0x1f6b3b[_0x11de('0x5e')]()[_0x11de('0x5f')](char(0x2c))>=0x0||_0x1f6b3b[_0x11de('0x5e')]()[_0x11de('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x55c061){var _0x2eb71a=char(0x22),_0x5960b9='\x5c'+char(0x22),_0x562bac=_0x55c061[_0x11de('0x5e')]()[_0x11de('0x60')](new RegExp(_0x2eb71a,'g'),_0x5960b9);return _0x2eb71a+_0x562bac+_0x2eb71a;}exports[_0x11de('0x61')]=function(_0x447c41,_0x2ffaef,_0x408a1a){var _0x4a506b,_0x697e85;var _0x77668={'where':{'ProjectId':_0x447c41[_0x11de('0x45')]['id']}};if(_0x447c41[_0x11de('0x31')][_0x11de('0x62')]){_0x77668[_0x11de('0x3c')][_0x11de('0x63')]=JSON['parse'](_0x447c41['query'][_0x11de('0x62')]);}return db[_0x11de('0x57')][_0x11de('0x42')](_0x77668)[_0x11de('0x1e')](handleEntityNotFound(_0x2ffaef,null))[_0x11de('0x1e')](function(_0x16a19b){if(_0x16a19b){_0x4a506b=_0x16a19b;return db['JscriptyQuestionReport'][_0x11de('0x42')]({'where':{'SessionId':{'$in':_['map'](_0x4a506b,'id')},'ProjectId':_0x447c41[_0x11de('0x45')]['id']},'order':_0x11de('0x64')});}})['then'](handleEntityNotFound(_0x2ffaef,null))[_0x11de('0x1e')](function(_0x31b64c){if(_0x31b64c){_0x697e85=_0x31b64c;var _0x491b5e={};for(var _0x5ccfa3=0x0,_0x76011e=_0x697e85[_0x11de('0x37')];_0x5ccfa3<_0x76011e;_0x5ccfa3++){if(!_0x491b5e[_0x11de('0x38')](_0x697e85[_0x5ccfa3][_0x11de('0x65')])){_0x491b5e[_0x697e85[_0x5ccfa3][_0x11de('0x65')]]=needsEncapsulation(_0x697e85[_0x5ccfa3][_0x11de('0x66')])?encapsulate(_0x697e85[_0x5ccfa3][_0x11de('0x66')]):_0x697e85[_0x5ccfa3][_0x11de('0x66')];}}var _0x3ad1be=[],_0x430f68={};for(var _0x22777a=0x0,_0x14a620=_0x4a506b[_0x11de('0x37')];_0x22777a<_0x14a620;_0x22777a++){_0x430f68={'ProjectId':_0x447c41[_0x11de('0x45')]['id'],'SessionId':_0x4a506b[_0x22777a]['id'],'StartTime':moment(_0x4a506b[_0x22777a][_0x11de('0x63')])[_0x11de('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x2ffdc9=0x0,_0x87f4e2=_0x697e85[_0x11de('0x37')];_0x2ffdc9<_0x87f4e2;_0x2ffdc9++){if(_0x697e85[_0x2ffdc9]['SessionId']==_0x4a506b[_0x22777a]['id']&&_0x491b5e[_0x11de('0x38')](_0x697e85[_0x2ffdc9][_0x11de('0x65')])){_0x430f68[_0x491b5e[_0x697e85[_0x2ffdc9][_0x11de('0x65')]]]=_0x697e85[_0x2ffdc9][_0x11de('0x68')];}}for(var _0x392ffd in _0x491b5e){if(!_0x430f68[_0x11de('0x38')](_0x491b5e[_0x392ffd])){_0x430f68[_0x491b5e[_0x392ffd]]=null;}}_0x3ad1be['push'](_0x430f68);}return _0x3ad1be;}})[_0x11de('0x1e')](function(_0x36a042){if(!_[_0x11de('0x69')](_0x36a042)){var _0x2774c4=toCsv(_0x36a042);var _0x1d3621=Date[_0x11de('0x6a')]();fs[_0x11de('0x6b')](util['format'](_0x11de('0x6c'),_0x447c41[_0x11de('0x45')]['id'],_0x1d3621),_0x2774c4);_0x2ffaef[_0x11de('0x6d')]('Content-disposition',_0x11de('0x6e')+util[_0x11de('0x67')](_0x11de('0x6f'),_0x447c41[_0x11de('0x45')]['id'],_0x1d3621));_0x2ffaef[_0x11de('0x6d')](_0x11de('0x70'),'text/csv');return _0x2ffaef[_0x11de('0x71')](util[_0x11de('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x447c41['params']['id'],_0x1d3621));}else{return _0x2ffaef[_0x11de('0x12')](0xcc);}})[_0x11de('0x43')](handleError(_0x2ffaef,null));}; \ No newline at end of file +var _0x0047=['text/csv','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','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','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','options','JscriptyProject','includeAll','include','findAll','rows','show','params','length','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','clone','omit','createdAt','updatedAt','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','sort','pick','getAnswers','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv'];(function(_0x4b8257,_0x547b98){var _0x3cb919=function(_0x194390){while(--_0x194390){_0x4b8257['push'](_0x4b8257['shift']());}};_0x3cb919(++_0x547b98);}(_0x0047,0x187));var _0x7004=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0x0047[_0x1314d4];return _0x584ba5;};'use strict';var emlformat=require(_0x7004('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7004('0x1'));var jsonpatch=require(_0x7004('0x2'));var rp=require(_0x7004('0x3'));var moment=require(_0x7004('0x4'));var BPromise=require(_0x7004('0x5'));var Mustache=require(_0x7004('0x6'));var util=require(_0x7004('0x7'));var path=require(_0x7004('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7004('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7004('0xa'));var squel=require(_0x7004('0xb'));var crypto=require('crypto');var jsforce=require(_0x7004('0xc'));var deskjs=require(_0x7004('0xd'));var toCsv=require(_0x7004('0xe'));var querystring=require(_0x7004('0xf'));var Papa=require(_0x7004('0x10'));var Redis=require(_0x7004('0x11'));var authService=require(_0x7004('0x12'));var qs=require(_0x7004('0x13'));var as=require(_0x7004('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7004('0x15'))(_0x7004('0x16'));var utils=require('../../config/utils');var config=require(_0x7004('0x17'));var licenseUtil=require(_0x7004('0x18'));var db=require(_0x7004('0x19'))['db'];function respondWithStatusCode(_0x4e8d0e,_0x59ae01){_0x59ae01=_0x59ae01||0xcc;return function(_0x583a67){if(_0x583a67){return _0x4e8d0e[_0x7004('0x1a')](_0x59ae01);}return _0x4e8d0e['status'](_0x59ae01)[_0x7004('0x1b')]();};}function respondWithResult(_0x4a4e82,_0x5bff7a){_0x5bff7a=_0x5bff7a||0xc8;return function(_0x1a4fa8){if(_0x1a4fa8){return _0x4a4e82[_0x7004('0x1c')](_0x5bff7a)[_0x7004('0x1d')](_0x1a4fa8);}};}function respondWithFilteredResult(_0x229538,_0x5f1a4f){return function(_0x17707b){if(_0x17707b){var _0x2389cd=typeof _0x5f1a4f[_0x7004('0x1e')]===_0x7004('0x1f')&&typeof _0x5f1a4f[_0x7004('0x20')]===_0x7004('0x1f');var _0x45559f=_0x17707b[_0x7004('0x21')];var _0x2c623f=_0x2389cd?0x0:_0x5f1a4f['offset'];var _0x5e3f6a=_0x2389cd?_0x17707b['count']:_0x5f1a4f[_0x7004('0x1e')]+_0x5f1a4f[_0x7004('0x20')];var _0x58bbcd;if(_0x5e3f6a>=_0x45559f){_0x5e3f6a=_0x45559f;_0x58bbcd=0xc8;}else{_0x58bbcd=0xce;}_0x229538[_0x7004('0x1c')](_0x58bbcd);return _0x229538[_0x7004('0x22')](_0x7004('0x23'),_0x2c623f+'-'+_0x5e3f6a+'/'+_0x45559f)[_0x7004('0x1d')](_0x17707b);}return null;};}function patchUpdates(_0x5cc1c4){return function(_0x185de9){try{jsonpatch[_0x7004('0x24')](_0x185de9,_0x5cc1c4,!![]);}catch(_0x4dbd0b){return BPromise[_0x7004('0x25')](_0x4dbd0b);}return _0x185de9[_0x7004('0x26')]();};}function saveUpdates(_0x3feef5,_0x4e3045){return function(_0xc01587){if(_0xc01587){return _0xc01587[_0x7004('0x27')](_0x3feef5)[_0x7004('0x28')](function(_0x17303b){return _0x17303b;});}return null;};}function removeEntity(_0x15d679,_0x3c9311){return function(_0x1217de){if(_0x1217de){return _0x1217de[_0x7004('0x29')]()['then'](function(){var _0x42a4a2=_0x1217de[_0x7004('0x2a')]({'plain':!![]});var _0x124ad4='Projects';return db['UserProfileResource'][_0x7004('0x29')]({'where':{'type':_0x124ad4,'resourceId':_0x42a4a2['id']}})['then'](function(){return _0x1217de;});})['then'](function(){_0x15d679[_0x7004('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x558db0,_0x4aec39){return function(_0x1d5248){if(!_0x1d5248){_0x558db0[_0x7004('0x1a')](0x194);}return _0x1d5248;};}function handleError(_0x5a28f5,_0x49bcd2){_0x49bcd2=_0x49bcd2||0x1f4;return function(_0x265fda){logger[_0x7004('0x2b')](_0x265fda[_0x7004('0x2c')]);if(_0x265fda['name']){delete _0x265fda[_0x7004('0x2d')];}_0x5a28f5['status'](_0x49bcd2)[_0x7004('0x2e')](_0x265fda);};}function getMustacheRender(_0x5ba1f0,_0x4e7659){return Mustache[_0x7004('0x2f')](_0x5ba1f0,_[_0x7004('0x30')](_0x4e7659[_0x7004('0x31')],{'contact':_0x4e7659[_0x7004('0x32')],'message':_0x4e7659[_0x7004('0x33')],'agent':_0x4e7659[_0x7004('0x34')],'interaction':_0x4e7659[_0x7004('0x35')],'account':_0x4e7659[_0x7004('0x36')]}))||'';}exports['index']=function(_0x56faac,_0x2074b2){var _0x452292={},_0x447803={},_0x2ce5a4={'count':0x0,'rows':[]};var _0x22d2a7=_[_0x7004('0x37')](db['JscriptyProject'][_0x7004('0x38')],function(_0x2deda3){return{'name':_0x2deda3[_0x7004('0x39')],'type':_0x2deda3[_0x7004('0x3a')][_0x7004('0x3b')]};});_0x447803['model']=_['map'](_0x22d2a7,'name');_0x447803[_0x7004('0x3c')]=_[_0x7004('0x3d')](_0x56faac[_0x7004('0x3c')]);_0x447803[_0x7004('0x3e')]=_[_0x7004('0x3f')](_0x447803['model'],_0x447803['query']);_0x452292['attributes']=_[_0x7004('0x3f')](_0x447803[_0x7004('0x40')],qs[_0x7004('0x41')](_0x56faac[_0x7004('0x3c')][_0x7004('0x41')]));_0x452292[_0x7004('0x42')]=_0x452292['attributes']['length']?_0x452292[_0x7004('0x42')]:_0x447803[_0x7004('0x40')];if(!_0x56faac[_0x7004('0x3c')][_0x7004('0x43')](_0x7004('0x44'))){_0x452292['limit']=qs[_0x7004('0x20')](_0x56faac[_0x7004('0x3c')]['limit']);_0x452292['offset']=qs[_0x7004('0x1e')](_0x56faac[_0x7004('0x3c')][_0x7004('0x1e')]);}_0x452292[_0x7004('0x45')]=qs['sort'](_0x56faac[_0x7004('0x3c')]['sort']);_0x452292[_0x7004('0x46')]=qs[_0x7004('0x3e')](_['pick'](_0x56faac['query'],_0x447803[_0x7004('0x3e')]),_0x22d2a7);if(_0x56faac[_0x7004('0x3c')][_0x7004('0x47')]){_0x452292[_0x7004('0x46')]=_[_0x7004('0x30')](_0x452292[_0x7004('0x46')],{'$or':_[_0x7004('0x37')](_0x22d2a7,function(_0x2107e3){if(_0x2107e3[_0x7004('0x3a')]!==_0x7004('0x48')){var _0x49f289={};_0x49f289[_0x2107e3['name']]={'$like':'%'+_0x56faac[_0x7004('0x3c')]['filter']+'%'};return _0x49f289;}})});}_0x452292=_['merge']({},_0x452292,_0x56faac[_0x7004('0x49')]);var _0x34c6b9={'where':_0x452292[_0x7004('0x46')]};return db[_0x7004('0x4a')][_0x7004('0x21')](_0x34c6b9)[_0x7004('0x28')](function(_0x55d535){_0x2ce5a4[_0x7004('0x21')]=_0x55d535;if(_0x56faac[_0x7004('0x3c')][_0x7004('0x4b')]){_0x452292[_0x7004('0x4c')]=[{'all':!![]}];}return db[_0x7004('0x4a')][_0x7004('0x4d')](_0x452292);})[_0x7004('0x28')](function(_0x3f4419){_0x2ce5a4[_0x7004('0x4e')]=_0x3f4419;return _0x2ce5a4;})['then'](respondWithFilteredResult(_0x2074b2,_0x452292))['catch'](handleError(_0x2074b2,null));};exports[_0x7004('0x4f')]=function(_0xa97f6c,_0x2cbb92){var _0xa203f={'raw':![],'where':{'id':_0xa97f6c[_0x7004('0x50')]['id']}},_0x1813af={};_0x1813af['model']=_['keys'](db[_0x7004('0x4a')][_0x7004('0x38')]);_0x1813af[_0x7004('0x3c')]=_[_0x7004('0x3d')](_0xa97f6c['query']);_0x1813af['filters']=_['intersection'](_0x1813af['model'],_0x1813af['query']);_0xa203f[_0x7004('0x42')]=_[_0x7004('0x3f')](_0x1813af[_0x7004('0x40')],qs['fields'](_0xa97f6c[_0x7004('0x3c')][_0x7004('0x41')]));_0xa203f[_0x7004('0x42')]=_0xa203f[_0x7004('0x42')][_0x7004('0x51')]?_0xa203f[_0x7004('0x42')]:_0x1813af[_0x7004('0x40')];if(_0xa97f6c['query'][_0x7004('0x4b')]){_0xa203f['include']=[{'all':!![]}];}_0xa203f=_[_0x7004('0x30')]({},_0xa203f,_0xa97f6c['options']);return db[_0x7004('0x4a')]['find'](_0xa203f)['then'](handleEntityNotFound(_0x2cbb92,null))[_0x7004('0x28')](respondWithResult(_0x2cbb92,null))[_0x7004('0x52')](handleError(_0x2cbb92,null));};exports[_0x7004('0x53')]=function(_0x2c35e8,_0x20d386){return db['JscriptyProject'][_0x7004('0x53')](_0x2c35e8[_0x7004('0x31')],{})[_0x7004('0x28')](function(_0x596464){var _0x36e005=_0x2c35e8[_0x7004('0x54')]['get']({'plain':!![]});if(!_0x36e005)throw new Error(_0x7004('0x55'));if(_0x36e005['role']===_0x7004('0x54')){var _0x4e9154=_0x596464[_0x7004('0x2a')]({'plain':!![]});var _0x50d072=_0x7004('0x56');return db[_0x7004('0x57')][_0x7004('0x58')]({'where':{'name':_0x50d072,'userProfileId':_0x36e005[_0x7004('0x59')]},'raw':!![]})[_0x7004('0x28')](function(_0x35aa7f){if(_0x35aa7f&&_0x35aa7f[_0x7004('0x5a')]===0x0){return db[_0x7004('0x5b')]['create']({'name':_0x4e9154['name'],'resourceId':_0x4e9154['id'],'type':_0x35aa7f[_0x7004('0x2d')],'sectionId':_0x35aa7f['id']},{})['then'](function(){return _0x596464;});}else{return _0x596464;}})[_0x7004('0x52')](function(_0x5c9774){logger[_0x7004('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c9774);throw _0x5c9774;});}return _0x596464;})[_0x7004('0x28')](respondWithResult(_0x20d386,0xc9))[_0x7004('0x52')](handleError(_0x20d386,null));};exports[_0x7004('0x5c')]=function(_0x258069,_0x46c84d){var _0x20c535={'where':{'id':_0x258069[_0x7004('0x50')]['id']}},_0x333ae4={};_0x333ae4[_0x7004('0x40')]=_['keys'](db[_0x7004('0x4a')][_0x7004('0x38')]);_0x20c535[_0x7004('0x42')]=_[_0x7004('0x3f')](_0x333ae4[_0x7004('0x40')],qs['fields'](_0x258069[_0x7004('0x3c')][_0x7004('0x41')]));_0x20c535[_0x7004('0x42')]=_0x20c535[_0x7004('0x42')][_0x7004('0x51')]?_0x20c535[_0x7004('0x42')]:_0x333ae4[_0x7004('0x40')];if(_0x258069[_0x7004('0x3c')][_0x7004('0x4b')]){_0x20c535[_0x7004('0x4c')]=[{'all':!![]}];}_0x20c535=_['merge']({},_0x20c535,_0x258069[_0x7004('0x49')]);return db[_0x7004('0x4a')][_0x7004('0x58')](_0x20c535)[_0x7004('0x28')](handleEntityNotFound(_0x46c84d,null))[_0x7004('0x28')](function(_0x564587){if(_0x564587){var _0x4b29a8=_0x564587[_0x7004('0x2a')]({'plain':!![]});_0x4b29a8=qs[_0x7004('0x5d')](_0x4b29a8,['id',_0x7004('0x5e'),_0x7004('0x5f')]);_0x258069[_0x7004('0x31')]=_['omit'](_0x258069[_0x7004('0x31')],['id','createdAt',_0x7004('0x5f')]);return db[_0x7004('0x4a')]['create'](_[_0x7004('0x30')](_0x4b29a8,_0x258069[_0x7004('0x31')]),{'include':_0x258069[_0x7004('0x3c')][_0x7004('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x5e6673){var _0x4f7d5e=_0x258069[_0x7004('0x54')][_0x7004('0x2a')]({'plain':!![]});if(!_0x4f7d5e)throw new Error(_0x7004('0x55'));if(_0x4f7d5e[_0x7004('0x60')]===_0x7004('0x54')){var _0x5345dd=_0x5e6673[_0x7004('0x2a')]({'plain':!![]});var _0x345129=_0x7004('0x56');return db['UserProfileSection'][_0x7004('0x58')]({'where':{'name':_0x345129,'userProfileId':_0x4f7d5e[_0x7004('0x59')]},'raw':!![]})[_0x7004('0x28')](function(_0x377dae){if(_0x377dae&&_0x377dae['autoAssociation']===0x0){return db[_0x7004('0x5b')][_0x7004('0x53')]({'name':_0x5345dd[_0x7004('0x2d')],'resourceId':_0x5345dd['id'],'type':_0x377dae['name'],'sectionId':_0x377dae['id']},{})[_0x7004('0x28')](function(){return _0x5e6673;});}else{return _0x5e6673;}})[_0x7004('0x52')](function(_0x11e984){logger['error'](_0x7004('0x61'),_0x11e984);throw _0x11e984;});}return _0x5e6673;});}})[_0x7004('0x28')](respondWithResult(_0x46c84d,0xc9))[_0x7004('0x52')](handleError(_0x46c84d,null));};exports[_0x7004('0x27')]=function(_0x498ddf,_0x470222){if(_0x498ddf[_0x7004('0x31')]['id']){delete _0x498ddf['body']['id'];}return db[_0x7004('0x4a')][_0x7004('0x58')]({'where':{'id':_0x498ddf[_0x7004('0x50')]['id']}})[_0x7004('0x28')](handleEntityNotFound(_0x470222,null))[_0x7004('0x28')](saveUpdates(_0x498ddf[_0x7004('0x31')],null))[_0x7004('0x28')](respondWithResult(_0x470222,null))[_0x7004('0x52')](handleError(_0x470222,null));};exports['destroy']=function(_0x323082,_0x2a9bd4){return db[_0x7004('0x4a')][_0x7004('0x58')]({'where':{'id':_0x323082[_0x7004('0x50')]['id']}})[_0x7004('0x28')](handleEntityNotFound(_0x2a9bd4,null))[_0x7004('0x28')](removeEntity(_0x2a9bd4,null))['catch'](handleError(_0x2a9bd4,null));};exports[_0x7004('0x62')]=function(_0x1698cb,_0x1923dd,_0x587351){var _0x4e3a9a={'raw':!![],'where':{}};var _0x2d5faf={};var _0x27e422={'count':0x0,'rows':[]};return db[_0x7004('0x4a')][_0x7004('0x63')]({'where':{'id':_0x1698cb[_0x7004('0x50')]['id']}})[_0x7004('0x28')](handleEntityNotFound(_0x1923dd,null))[_0x7004('0x28')](function(_0x10b4cb){if(_0x10b4cb){_0x2d5faf[_0x7004('0x40')]=_[_0x7004('0x3d')](db[_0x7004('0x64')][_0x7004('0x38')]);_0x2d5faf['query']=_['keys'](_0x1698cb[_0x7004('0x3c')]);_0x2d5faf[_0x7004('0x3e')]=_[_0x7004('0x3f')](_0x2d5faf[_0x7004('0x40')],_0x2d5faf[_0x7004('0x3c')]);_0x4e3a9a[_0x7004('0x42')]=_[_0x7004('0x3f')](_0x2d5faf['model'],qs[_0x7004('0x41')](_0x1698cb['query'][_0x7004('0x41')]));_0x4e3a9a[_0x7004('0x42')]=_0x4e3a9a[_0x7004('0x42')][_0x7004('0x51')]?_0x4e3a9a[_0x7004('0x42')]:_0x2d5faf[_0x7004('0x40')];if(!_0x1698cb[_0x7004('0x3c')][_0x7004('0x43')](_0x7004('0x44'))){_0x4e3a9a[_0x7004('0x20')]=qs[_0x7004('0x20')](_0x1698cb[_0x7004('0x3c')]['limit']);_0x4e3a9a[_0x7004('0x1e')]=qs[_0x7004('0x1e')](_0x1698cb[_0x7004('0x3c')][_0x7004('0x1e')]);}_0x4e3a9a[_0x7004('0x45')]=qs[_0x7004('0x65')](_0x1698cb[_0x7004('0x3c')]['sort']);_0x4e3a9a[_0x7004('0x46')]=qs['filters'](_[_0x7004('0x66')](_0x1698cb[_0x7004('0x3c')],_0x2d5faf[_0x7004('0x3e')]));_0x4e3a9a[_0x7004('0x46')]['ProjectId']=_0x10b4cb['id'];if(_0x1698cb['query'][_0x7004('0x47')]){_0x4e3a9a[_0x7004('0x46')]=_[_0x7004('0x30')](_0x4e3a9a[_0x7004('0x46')],{'$or':_['map'](_0x4e3a9a[_0x7004('0x42')],function(_0x70fec1){var _0x318fe8={};_0x318fe8[_0x70fec1]={'$like':'%'+_0x1698cb[_0x7004('0x3c')][_0x7004('0x47')]+'%'};return _0x318fe8;})});}_0x4e3a9a=_['merge']({},_0x4e3a9a,_0x1698cb[_0x7004('0x49')]);return db['JscriptySessionReport'][_0x7004('0x21')]({'where':_0x4e3a9a[_0x7004('0x46')]})[_0x7004('0x28')](function(_0x4f68da){_0x27e422['count']=_0x4f68da;if(_0x1698cb[_0x7004('0x3c')]['includeAll']){_0x4e3a9a['include']=[{'all':!![]}];}return db[_0x7004('0x64')]['findAll'](_0x4e3a9a);})[_0x7004('0x28')](function(_0x2c5977){_0x27e422['rows']=_0x2c5977;return _0x27e422;});}})['then'](respondWithFilteredResult(_0x1923dd,_0x4e3a9a))[_0x7004('0x52')](handleError(_0x1923dd,null));};exports[_0x7004('0x67')]=function(_0x748638,_0x462ffe,_0x4fef5e){var _0x2692a0={'raw':!![],'where':{}};var _0x374c87={};var _0x2543f5={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x7004('0x63')]({'where':{'id':_0x748638['params']['id']}})[_0x7004('0x28')](handleEntityNotFound(_0x462ffe,null))[_0x7004('0x28')](function(_0x5896af){if(_0x5896af){_0x374c87['model']=_['keys'](db[_0x7004('0x68')][_0x7004('0x38')]);_0x374c87[_0x7004('0x3c')]=_[_0x7004('0x3d')](_0x748638['query']);_0x374c87[_0x7004('0x3e')]=_[_0x7004('0x3f')](_0x374c87[_0x7004('0x40')],_0x374c87[_0x7004('0x3c')]);_0x2692a0[_0x7004('0x42')]=_['intersection'](_0x374c87['model'],qs[_0x7004('0x41')](_0x748638[_0x7004('0x3c')]['fields']));_0x2692a0[_0x7004('0x42')]=_0x2692a0[_0x7004('0x42')]['length']?_0x2692a0[_0x7004('0x42')]:_0x374c87['model'];if(!_0x748638[_0x7004('0x3c')][_0x7004('0x43')](_0x7004('0x44'))){_0x2692a0['limit']=qs[_0x7004('0x20')](_0x748638[_0x7004('0x3c')][_0x7004('0x20')]);_0x2692a0[_0x7004('0x1e')]=qs[_0x7004('0x1e')](_0x748638[_0x7004('0x3c')][_0x7004('0x1e')]);}_0x2692a0[_0x7004('0x45')]=qs[_0x7004('0x65')](_0x748638['query']['sort']);_0x2692a0[_0x7004('0x46')]=qs[_0x7004('0x3e')](_[_0x7004('0x66')](_0x748638[_0x7004('0x3c')],_0x374c87['filters']));_0x2692a0[_0x7004('0x46')][_0x7004('0x69')]=_0x5896af['id'];if(_0x748638[_0x7004('0x3c')][_0x7004('0x47')]){_0x2692a0[_0x7004('0x46')]=_['merge'](_0x2692a0[_0x7004('0x46')],{'$or':_[_0x7004('0x37')](_0x2692a0[_0x7004('0x42')],function(_0x59a651){var _0x41547f={};_0x41547f[_0x59a651]={'$like':'%'+_0x748638[_0x7004('0x3c')]['filter']+'%'};return _0x41547f;})});}_0x2692a0=_['merge']({},_0x2692a0,_0x748638[_0x7004('0x49')]);return db[_0x7004('0x68')][_0x7004('0x21')]({'where':_0x2692a0[_0x7004('0x46')]})[_0x7004('0x28')](function(_0x2d931c){_0x2543f5['count']=_0x2d931c;if(_0x748638['query']['includeAll']){_0x2692a0[_0x7004('0x4c')]=[{'all':!![]}];}return db[_0x7004('0x68')][_0x7004('0x4d')](_0x2692a0);})[_0x7004('0x28')](function(_0x53f1ec){_0x2543f5[_0x7004('0x4e')]=_0x53f1ec;return _0x2543f5;});}})[_0x7004('0x28')](respondWithFilteredResult(_0x462ffe,_0x2692a0))[_0x7004('0x52')](handleError(_0x462ffe,null));};function char(_0x4f6b09){return _0x7004('0x6a')===typeof _0x4f6b09?String[_0x7004('0x6b')]['apply'](null,arguments):_0x4f6b09;}function needsEncapsulation(_0x4744a1){return!!_0x4744a1&&(_0x4744a1[_0x7004('0x6c')]()[_0x7004('0x6d')](char(0xd))>=0x0||_0x4744a1['toString']()[_0x7004('0x6d')](char(0xa))>=0x0||_0x4744a1[_0x7004('0x6c')]()[_0x7004('0x6d')](char(0x2c))>=0x0||_0x4744a1[_0x7004('0x6c')]()[_0x7004('0x6d')](char(0x22))>=0x0);}function encapsulate(_0x5cdb3a){var _0x5e61cc=char(0x22),_0x1388e0='\x5c'+char(0x22),_0x7e0adc=_0x5cdb3a[_0x7004('0x6c')]()[_0x7004('0x6e')](new RegExp(_0x5e61cc,'g'),_0x1388e0);return _0x5e61cc+_0x7e0adc+_0x5e61cc;}exports[_0x7004('0x6f')]=function(_0x3657a6,_0x275fae,_0x286ce0){var _0x3680e0,_0x221d4d;var _0x69a8eb={'where':{'ProjectId':_0x3657a6['params']['id']}};if(_0x3657a6[_0x7004('0x3c')][_0x7004('0x70')]){_0x69a8eb[_0x7004('0x46')][_0x7004('0x71')]=JSON[_0x7004('0x72')](_0x3657a6[_0x7004('0x3c')]['startTime']);}return db['JscriptySessionReport']['findAll'](_0x69a8eb)[_0x7004('0x28')](handleEntityNotFound(_0x275fae,null))['then'](function(_0x5ba8a1){if(_0x5ba8a1){_0x3680e0=_0x5ba8a1;return db[_0x7004('0x73')][_0x7004('0x4d')]({'where':{'SessionId':{'$in':_[_0x7004('0x37')](_0x3680e0,'id')},'ProjectId':_0x3657a6['params']['id']},'order':'-createdAt'});}})[_0x7004('0x28')](handleEntityNotFound(_0x275fae,null))[_0x7004('0x28')](function(_0x4df74c){if(_0x4df74c){_0x221d4d=_0x4df74c;var _0x189f58={};for(var _0x20cef0=0x0,_0x2742d6=_0x221d4d[_0x7004('0x51')];_0x20cef0<_0x2742d6;_0x20cef0++){if(!_0x189f58[_0x7004('0x43')](_0x221d4d[_0x20cef0]['questionId'])){_0x189f58[_0x221d4d[_0x20cef0][_0x7004('0x74')]]=needsEncapsulation(_0x221d4d[_0x20cef0]['question'])?encapsulate(_0x221d4d[_0x20cef0][_0x7004('0x75')]):_0x221d4d[_0x20cef0]['question'];}}var _0x338091=[],_0x57c0c7={};for(var _0x4bbdff=0x0,_0xaa908c=_0x3680e0['length'];_0x4bbdff<_0xaa908c;_0x4bbdff++){_0x57c0c7={'ProjectId':_0x3657a6[_0x7004('0x50')]['id'],'SessionId':_0x3680e0[_0x4bbdff]['id'],'StartTime':moment(_0x3680e0[_0x4bbdff][_0x7004('0x71')])[_0x7004('0x76')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x48d2bb=0x0,_0x2da24b=_0x221d4d['length'];_0x48d2bb<_0x2da24b;_0x48d2bb++){if(_0x221d4d[_0x48d2bb][_0x7004('0x77')]==_0x3680e0[_0x4bbdff]['id']&&_0x189f58['hasOwnProperty'](_0x221d4d[_0x48d2bb][_0x7004('0x74')])){_0x57c0c7[_0x189f58[_0x221d4d[_0x48d2bb][_0x7004('0x74')]]]=_0x221d4d[_0x48d2bb][_0x7004('0x78')];}}for(var _0x294bc4 in _0x189f58){if(!_0x57c0c7['hasOwnProperty'](_0x189f58[_0x294bc4])){_0x57c0c7[_0x189f58[_0x294bc4]]=null;}}_0x338091[_0x7004('0x79')](_0x57c0c7);}return _0x338091;}})[_0x7004('0x28')](function(_0x12deae){if(!_[_0x7004('0x7a')](_0x12deae)){var _0x39f9e2=toCsv(_0x12deae);var _0x1c30e8=Date[_0x7004('0x7b')]();fs[_0x7004('0x7c')](util[_0x7004('0x76')](_0x7004('0x7d'),_0x3657a6[_0x7004('0x50')]['id'],_0x1c30e8),_0x39f9e2);_0x275fae[_0x7004('0x7e')](_0x7004('0x7f'),'attachment;\x20filename='+util[_0x7004('0x76')](_0x7004('0x80'),_0x3657a6['params']['id'],_0x1c30e8));_0x275fae['setHeader']('Content-type',_0x7004('0x81'));return _0x275fae['download'](util[_0x7004('0x76')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3657a6['params']['id'],_0x1c30e8));}else{return _0x275fae[_0x7004('0x1a')](0xcc);}})[_0x7004('0x52')](handleError(_0x275fae,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 9ac4698..197635a 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 _0xd9eb=['moment','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','util','../../config/logger','api'];(function(_0x35686a,_0x5aed7f){var _0x21f030=function(_0x3a0632){while(--_0x3a0632){_0x35686a['push'](_0x35686a['shift']());}};_0x21f030(++_0x5aed7f);}(_0xd9eb,0x11d));var _0xbd9e=function(_0x246568,_0x57af04){_0x246568=_0x246568-0x0;var _0x19b302=_0xd9eb[_0x246568];return _0x19b302;};'use strict';var _=require('lodash');var util=require(_0xbd9e('0x0'));var logger=require(_0xbd9e('0x1'))(_0xbd9e('0x2'));var moment=require(_0xbd9e('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd9e('0x4'));var fs=require('fs');var path=require(_0xbd9e('0x5'));var rimraf=require(_0xbd9e('0x6'));var config=require(_0xbd9e('0x7'));var attributes=require(_0xbd9e('0x8'));module[_0xbd9e('0x9')]=function(_0x28c8bd,_0x301607){return _0x28c8bd[_0xbd9e('0xa')](_0xbd9e('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa48b=['./jscriptyProject.attributes','exports','jscripty_projects','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa48b,0x157));var _0xba48=function(_0x16ef9c,_0x55568f){_0x16ef9c=_0x16ef9c-0x0;var _0x38ad91=_0xa48b[_0x16ef9c];return _0x38ad91;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xba48('0x0'));var moment=require(_0xba48('0x1'));var BPromise=require(_0xba48('0x2'));var rp=require(_0xba48('0x3'));var fs=require('fs');var path=require(_0xba48('0x4'));var rimraf=require(_0xba48('0x5'));var config=require(_0xba48('0x6'));var attributes=require(_0xba48('0x7'));module[_0xba48('0x8')]=function(_0x29d44a,_0x1ffe4c){return _0x29d44a['define']('JscriptyProject',attributes,{'tableName':_0xba48('0x9'),'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 1321a74..516ca88 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 _0x602b=['../../config/environment','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x3d5feb,_0x9773a2){var _0x28a3b0=function(_0x3a534e){while(--_0x3a534e){_0x3d5feb['push'](_0x3d5feb['shift']());}};_0x28a3b0(++_0x9773a2);}(_0x602b,0x191));var _0xb602=function(_0x3bcd8a,_0x2e15e3){_0x3bcd8a=_0x3bcd8a-0x0;var _0x2806cc=_0x602b[_0x3bcd8a];return _0x2806cc;};'use strict';var _=require(_0xb602('0x0'));var util=require(_0xb602('0x1'));var moment=require(_0xb602('0x2'));var BPromise=require(_0xb602('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb602('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb602('0x5'));var logger=require(_0xb602('0x6'))('rpc');var config=require(_0xb602('0x7'));var jayson=require(_0xb602('0x8'));var client=jayson[_0xb602('0x9')][_0xb602('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99b004,_0x485fcd,_0x4de947){return new BPromise(function(_0x27b347,_0x4cd121){return client[_0xb602('0xb')](_0x99b004,_0x4de947)[_0xb602('0xc')](function(_0x1ff8b2){logger[_0xb602('0xd')](_0xb602('0xe'),_0x485fcd,_0xb602('0xf'));logger[_0xb602('0x10')](_0xb602('0x11'),_0x485fcd,_0xb602('0xf'),JSON[_0xb602('0x12')](_0x1ff8b2));if(_0x1ff8b2[_0xb602('0x13')]){if(_0x1ff8b2[_0xb602('0x13')][_0xb602('0x14')]===0x1f4){logger[_0xb602('0x13')](_0xb602('0xe'),_0x485fcd,_0x1ff8b2[_0xb602('0x13')][_0xb602('0x15')]);return _0x4cd121(_0x1ff8b2[_0xb602('0x13')][_0xb602('0x15')]);}logger['error'](_0xb602('0xe'),_0x485fcd,_0x1ff8b2[_0xb602('0x13')][_0xb602('0x15')]);return _0x27b347(_0x1ff8b2['error'][_0xb602('0x15')]);}else{logger[_0xb602('0xd')](_0xb602('0xe'),_0x485fcd,_0xb602('0xf'));_0x27b347(_0x1ff8b2[_0xb602('0x16')]['message']);}})[_0xb602('0x17')](function(_0x36b6b8){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x485fcd,_0x36b6b8);_0x4cd121(_0x36b6b8);});});} \ No newline at end of file +var _0xa798=['info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0xecd664,_0x50afdb){var _0x24cb22=function(_0x12aad0){while(--_0x12aad0){_0xecd664['push'](_0xecd664['shift']());}};_0x24cb22(++_0x50afdb);}(_0xa798,0xd1));var _0x8a79=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa798[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x8a79('0x0'));var util=require(_0x8a79('0x1'));var moment=require(_0x8a79('0x2'));var BPromise=require(_0x8a79('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8a79('0x4'));var logger=require(_0x8a79('0x5'))(_0x8a79('0x6'));var config=require('../../config/environment');var jayson=require(_0x8a79('0x7'));var client=jayson[_0x8a79('0x8')][_0x8a79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f5124,_0x383fc8,_0x3d9154){return new BPromise(function(_0x82f1fc,_0x58c1bc){return client[_0x8a79('0xa')](_0x1f5124,_0x3d9154)['then'](function(_0xb854a5){logger[_0x8a79('0xb')](_0x8a79('0xc'),_0x383fc8,_0x8a79('0xd'));logger[_0x8a79('0xe')](_0x8a79('0xf'),_0x383fc8,'request\x20sent',JSON[_0x8a79('0x10')](_0xb854a5));if(_0xb854a5['error']){if(_0xb854a5[_0x8a79('0x11')][_0x8a79('0x12')]===0x1f4){logger['error'](_0x8a79('0xc'),_0x383fc8,_0xb854a5['error'][_0x8a79('0x13')]);return _0x58c1bc(_0xb854a5[_0x8a79('0x11')]['message']);}logger['error'](_0x8a79('0xc'),_0x383fc8,_0xb854a5[_0x8a79('0x11')][_0x8a79('0x13')]);return _0x82f1fc(_0xb854a5[_0x8a79('0x11')][_0x8a79('0x13')]);}else{logger[_0x8a79('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x383fc8,_0x8a79('0xd'));_0x82f1fc(_0xb854a5[_0x8a79('0x14')]['message']);}})[_0x8a79('0x15')](function(_0x407e77){logger[_0x8a79('0x11')]('JscriptyProject,\x20%s,\x20%s',_0x383fc8,_0x407e77);_0x58c1bc(_0x407e77);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 03366e5..012614b 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 _0x3f43=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','post','create','delete','destroy','exports'];(function(_0x173db5,_0xdb80bb){var _0xb89b6e=function(_0x88c6d7){while(--_0x88c6d7){_0x173db5['push'](_0x173db5['shift']());}};_0xb89b6e(++_0xdb80bb);}(_0x3f43,0x1e6));var _0x33f4=function(_0x27f3db,_0x19ee6b){_0x27f3db=_0x27f3db-0x0;var _0x5ed5d8=_0x3f43[_0x27f3db];return _0x5ed5d8;};'use strict';var multer=require(_0x33f4('0x0'));var util=require(_0x33f4('0x1'));var path=require(_0x33f4('0x2'));var timeout=require('connect-timeout');var express=require(_0x33f4('0x3'));var router=express[_0x33f4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x33f4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x33f4('0x6'));var controller=require('./jscriptyQuestionReport.controller');router[_0x33f4('0x7')]('/',auth['isAuthenticated'](),controller[_0x33f4('0x8')]);router[_0x33f4('0x7')]('/describe',auth[_0x33f4('0x9')](),controller[_0x33f4('0xa')]);router[_0x33f4('0x7')](_0x33f4('0xb'),auth[_0x33f4('0x9')](),controller[_0x33f4('0xc')]);router[_0x33f4('0xd')]('/',auth[_0x33f4('0x9')](),controller[_0x33f4('0xe')]);router['put'](_0x33f4('0xb'),auth[_0x33f4('0x9')](),controller['update']);router[_0x33f4('0xf')](_0x33f4('0xb'),auth['isAuthenticated'](),controller[_0x33f4('0x10')]);module[_0x33f4('0x11')]=router; \ No newline at end of file +var _0x6078=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3afb2b,_0x3cf264){var _0x33cb0f=function(_0x11db22){while(--_0x11db22){_0x3afb2b['push'](_0x3afb2b['shift']());}};_0x33cb0f(++_0x3cf264);}(_0x6078,0x13e));var _0x8607=function(_0x57d383,_0x391a80){_0x57d383=_0x57d383-0x0;var _0x2625f4=_0x6078[_0x57d383];return _0x2625f4;};'use strict';var multer=require(_0x8607('0x0'));var util=require(_0x8607('0x1'));var path=require(_0x8607('0x2'));var timeout=require(_0x8607('0x3'));var express=require('express');var router=express[_0x8607('0x4')]();var fs_extra=require(_0x8607('0x5'));var auth=require(_0x8607('0x6'));var interaction=require(_0x8607('0x7'));var config=require('../../config/environment');var controller=require(_0x8607('0x8'));router[_0x8607('0x9')]('/',auth[_0x8607('0xa')](),controller[_0x8607('0xb')]);router[_0x8607('0x9')](_0x8607('0xc'),auth['isAuthenticated'](),controller[_0x8607('0xd')]);router[_0x8607('0x9')](_0x8607('0xe'),auth[_0x8607('0xa')](),controller[_0x8607('0xf')]);router[_0x8607('0x10')]('/',auth[_0x8607('0xa')](),controller[_0x8607('0x11')]);router[_0x8607('0x12')]('/:id',auth[_0x8607('0xa')](),controller[_0x8607('0x13')]);router[_0x8607('0x14')]('/:id',auth[_0x8607('0xa')](),controller[_0x8607('0x15')]);module[_0x8607('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 26e5649..6cd6e25 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 _0xbee3=['exports','long','STRING'];(function(_0x31dd7e,_0x72d5da){var _0x2a6bfd=function(_0x34a241){while(--_0x34a241){_0x31dd7e['push'](_0x31dd7e['shift']());}};_0x2a6bfd(++_0x72d5da);}(_0xbee3,0xd5));var _0x3bee=function(_0x20d685,_0x1178fe){_0x20d685=_0x20d685-0x0;var _0x5bb421=_0xbee3[_0x20d685];return _0x5bb421;};'use strict';var Sequelize=require('sequelize');module[_0x3bee('0x0')]={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize['TEXT'](_0x3bee('0x1'))},'membername':{'type':Sequelize[_0x3bee('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3bee('0x2')]},'uniqueid':{'type':Sequelize[_0x3bee('0x2')]},'calleridname':{'type':Sequelize[_0x3bee('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x3bee('0x2')]}}; \ No newline at end of file +var _0xd4f4=['exports','TEXT','long','STRING','sequelize'];(function(_0x35ee85,_0x1a870c){var _0x173aed=function(_0x3b7720){while(--_0x3b7720){_0x35ee85['push'](_0x35ee85['shift']());}};_0x173aed(++_0x1a870c);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x3ef1a3,_0x2123f5){_0x3ef1a3=_0x3ef1a3-0x0;var _0x425579=_0xd4f4[_0x3ef1a3];return _0x425579;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'question':{'type':Sequelize[_0x4d4f('0x2')]},'answer':{'type':Sequelize[_0x4d4f('0x2')](_0x4d4f('0x3'))},'membername':{'type':Sequelize[_0x4d4f('0x4')]},'projectname':{'type':Sequelize[_0x4d4f('0x4')]},'queue':{'type':Sequelize[_0x4d4f('0x4')]},'uniqueid':{'type':Sequelize[_0x4d4f('0x4')]},'calleridname':{'type':Sequelize[_0x4d4f('0x4')]},'calleridnum':{'type':Sequelize[_0x4d4f('0x4')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 978354d..e013ed5 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 _0x6bc0=['end','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','JscriptyQuestionReport','rawAttributes','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','options','includeAll','findAll','rows','params','include','find','catch','create','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','Content-Range','reject','save','update','then','destroy'];(function(_0x5d939e,_0x47258f){var _0x1c6ec6=function(_0x59fe32){while(--_0x59fe32){_0x5d939e['push'](_0x5d939e['shift']());}};_0x1c6ec6(++_0x47258f);}(_0x6bc0,0xc7));var _0x06bc=function(_0x1516de,_0x3846f9){_0x1516de=_0x1516de-0x0;var _0xbff31a=_0x6bc0[_0x1516de];return _0xbff31a;};'use strict';var emlformat=require(_0x06bc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x06bc('0x1'));var jsonpatch=require(_0x06bc('0x2'));var rp=require(_0x06bc('0x3'));var moment=require(_0x06bc('0x4'));var BPromise=require(_0x06bc('0x5'));var Mustache=require(_0x06bc('0x6'));var util=require(_0x06bc('0x7'));var path=require(_0x06bc('0x8'));var sox=require(_0x06bc('0x9'));var csv=require(_0x06bc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06bc('0xb'));var squel=require(_0x06bc('0xc'));var crypto=require(_0x06bc('0xd'));var jsforce=require(_0x06bc('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x06bc('0xf'));var Papa=require('papaparse');var Redis=require(_0x06bc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x06bc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06bc('0x12'));var logger=require(_0x06bc('0x13'))(_0x06bc('0x14'));var utils=require(_0x06bc('0x15'));var config=require(_0x06bc('0x16'));var licenseUtil=require(_0x06bc('0x17'));var db=require(_0x06bc('0x18'))['db'];function respondWithStatusCode(_0x98f531,_0x3b34ef){_0x3b34ef=_0x3b34ef||0xcc;return function(_0xfd556){if(_0xfd556){return _0x98f531[_0x06bc('0x19')](_0x3b34ef);}return _0x98f531[_0x06bc('0x1a')](_0x3b34ef)['end']();};}function respondWithResult(_0xfff92a,_0x5d4fe5){_0x5d4fe5=_0x5d4fe5||0xc8;return function(_0x2f48df){if(_0x2f48df){return _0xfff92a['status'](_0x5d4fe5)[_0x06bc('0x1b')](_0x2f48df);}};}function respondWithFilteredResult(_0x427d28,_0x1489dc){return function(_0x12be9c){if(_0x12be9c){var _0x53428d=typeof _0x1489dc['offset']===_0x06bc('0x1c')&&typeof _0x1489dc['limit']===_0x06bc('0x1c');var _0x32b8dd=_0x12be9c[_0x06bc('0x1d')];var _0x4e071b=_0x53428d?0x0:_0x1489dc['offset'];var _0x43c707=_0x53428d?_0x12be9c[_0x06bc('0x1d')]:_0x1489dc[_0x06bc('0x1e')]+_0x1489dc[_0x06bc('0x1f')];var _0x5023d7;if(_0x43c707>=_0x32b8dd){_0x43c707=_0x32b8dd;_0x5023d7=0xc8;}else{_0x5023d7=0xce;}_0x427d28[_0x06bc('0x1a')](_0x5023d7);return _0x427d28['set'](_0x06bc('0x20'),_0x4e071b+'-'+_0x43c707+'/'+_0x32b8dd)[_0x06bc('0x1b')](_0x12be9c);}return null;};}function patchUpdates(_0x249b0a){return function(_0x21f9fe){try{jsonpatch['apply'](_0x21f9fe,_0x249b0a,!![]);}catch(_0xe0b60d){return BPromise[_0x06bc('0x21')](_0xe0b60d);}return _0x21f9fe[_0x06bc('0x22')]();};}function saveUpdates(_0x1a5109,_0x13d942){return function(_0x2e539c){if(_0x2e539c){return _0x2e539c[_0x06bc('0x23')](_0x1a5109)[_0x06bc('0x24')](function(_0x2ff956){return _0x2ff956;});}return null;};}function removeEntity(_0x1315d8,_0x45df01){return function(_0x298fc5){if(_0x298fc5){return _0x298fc5[_0x06bc('0x25')]()[_0x06bc('0x24')](function(){_0x1315d8['status'](0xcc)[_0x06bc('0x26')]();});}};}function handleEntityNotFound(_0x381f6c,_0x5e3bcd){return function(_0x413602){if(!_0x413602){_0x381f6c[_0x06bc('0x19')](0x194);}return _0x413602;};}function handleError(_0x1baf72,_0x376c77){_0x376c77=_0x376c77||0x1f4;return function(_0x3850dd){logger[_0x06bc('0x27')](_0x3850dd[_0x06bc('0x28')]);if(_0x3850dd[_0x06bc('0x29')]){delete _0x3850dd[_0x06bc('0x29')];}_0x1baf72[_0x06bc('0x1a')](_0x376c77)[_0x06bc('0x2a')](_0x3850dd);};}function getMustacheRender(_0x4d64e7,_0x19d4d5){return Mustache[_0x06bc('0x2b')](_0x4d64e7,_[_0x06bc('0x2c')](_0x19d4d5[_0x06bc('0x2d')],{'contact':_0x19d4d5[_0x06bc('0x2e')],'message':_0x19d4d5[_0x06bc('0x2f')],'agent':_0x19d4d5[_0x06bc('0x30')],'interaction':_0x19d4d5[_0x06bc('0x31')],'account':_0x19d4d5[_0x06bc('0x32')]}))||'';}exports[_0x06bc('0x33')]=function(_0x5e3d13,_0x540ed6){var _0x3d113a={},_0x4fc5b8={},_0x1931ce={'count':0x0,'rows':[]};var _0x47e108=_[_0x06bc('0x34')](db[_0x06bc('0x35')][_0x06bc('0x36')],function(_0xed87c7){return{'name':_0xed87c7['fieldName'],'type':_0xed87c7[_0x06bc('0x37')][_0x06bc('0x38')]};});_0x4fc5b8[_0x06bc('0x39')]=_[_0x06bc('0x34')](_0x47e108,_0x06bc('0x29'));_0x4fc5b8['query']=_[_0x06bc('0x3a')](_0x5e3d13['query']);_0x4fc5b8[_0x06bc('0x3b')]=_['intersection'](_0x4fc5b8[_0x06bc('0x39')],_0x4fc5b8[_0x06bc('0x3c')]);_0x3d113a[_0x06bc('0x3d')]=_[_0x06bc('0x3e')](_0x4fc5b8[_0x06bc('0x39')],qs['fields'](_0x5e3d13['query'][_0x06bc('0x3f')]));_0x3d113a[_0x06bc('0x3d')]=_0x3d113a[_0x06bc('0x3d')][_0x06bc('0x40')]?_0x3d113a[_0x06bc('0x3d')]:_0x4fc5b8[_0x06bc('0x39')];if(!_0x5e3d13[_0x06bc('0x3c')][_0x06bc('0x41')]('nolimit')){_0x3d113a[_0x06bc('0x1f')]=qs[_0x06bc('0x1f')](_0x5e3d13[_0x06bc('0x3c')][_0x06bc('0x1f')]);_0x3d113a[_0x06bc('0x1e')]=qs['offset'](_0x5e3d13['query'][_0x06bc('0x1e')]);}_0x3d113a['order']=qs['sort'](_0x5e3d13[_0x06bc('0x3c')][_0x06bc('0x42')]);_0x3d113a[_0x06bc('0x43')]=qs[_0x06bc('0x3b')](_['pick'](_0x5e3d13[_0x06bc('0x3c')],_0x4fc5b8[_0x06bc('0x3b')]),_0x47e108);if(_0x5e3d13[_0x06bc('0x3c')][_0x06bc('0x44')]){_0x3d113a['where']=_['merge'](_0x3d113a[_0x06bc('0x43')],{'$or':_[_0x06bc('0x34')](_0x47e108,function(_0x38ae89){if(_0x38ae89[_0x06bc('0x37')]!=='VIRTUAL'){var _0x256824={};_0x256824[_0x38ae89[_0x06bc('0x29')]]={'$like':'%'+_0x5e3d13[_0x06bc('0x3c')][_0x06bc('0x44')]+'%'};return _0x256824;}})});}_0x3d113a=_[_0x06bc('0x2c')]({},_0x3d113a,_0x5e3d13[_0x06bc('0x45')]);var _0x5136f2={'where':_0x3d113a[_0x06bc('0x43')]};return db[_0x06bc('0x35')][_0x06bc('0x1d')](_0x5136f2)[_0x06bc('0x24')](function(_0x50c517){_0x1931ce[_0x06bc('0x1d')]=_0x50c517;if(_0x5e3d13[_0x06bc('0x3c')][_0x06bc('0x46')]){_0x3d113a['include']=[{'all':!![]}];}return db[_0x06bc('0x35')][_0x06bc('0x47')](_0x3d113a);})[_0x06bc('0x24')](function(_0x2db130){_0x1931ce[_0x06bc('0x48')]=_0x2db130;return _0x1931ce;})[_0x06bc('0x24')](respondWithFilteredResult(_0x540ed6,_0x3d113a))['catch'](handleError(_0x540ed6,null));};exports['show']=function(_0x1ca103,_0x5d3398){var _0x3e6463={'raw':!![],'where':{'id':_0x1ca103[_0x06bc('0x49')]['id']}},_0x273723={};_0x273723[_0x06bc('0x39')]=_[_0x06bc('0x3a')](db[_0x06bc('0x35')]['rawAttributes']);_0x273723[_0x06bc('0x3c')]=_['keys'](_0x1ca103[_0x06bc('0x3c')]);_0x273723[_0x06bc('0x3b')]=_[_0x06bc('0x3e')](_0x273723[_0x06bc('0x39')],_0x273723[_0x06bc('0x3c')]);_0x3e6463[_0x06bc('0x3d')]=_[_0x06bc('0x3e')](_0x273723[_0x06bc('0x39')],qs[_0x06bc('0x3f')](_0x1ca103[_0x06bc('0x3c')][_0x06bc('0x3f')]));_0x3e6463['attributes']=_0x3e6463[_0x06bc('0x3d')][_0x06bc('0x40')]?_0x3e6463[_0x06bc('0x3d')]:_0x273723[_0x06bc('0x39')];if(_0x1ca103[_0x06bc('0x3c')][_0x06bc('0x46')]){_0x3e6463[_0x06bc('0x4a')]=[{'all':!![]}];}_0x3e6463=_[_0x06bc('0x2c')]({},_0x3e6463,_0x1ca103['options']);return db[_0x06bc('0x35')][_0x06bc('0x4b')](_0x3e6463)['then'](handleEntityNotFound(_0x5d3398,null))['then'](respondWithResult(_0x5d3398,null))[_0x06bc('0x4c')](handleError(_0x5d3398,null));};exports[_0x06bc('0x4d')]=function(_0xe8dfe6,_0x2e619b){return db[_0x06bc('0x35')]['create'](_0xe8dfe6[_0x06bc('0x2d')],{})[_0x06bc('0x24')](respondWithResult(_0x2e619b,0xc9))[_0x06bc('0x4c')](handleError(_0x2e619b,null));};exports['update']=function(_0x258f8a,_0x3cf525){if(_0x258f8a[_0x06bc('0x2d')]['id']){delete _0x258f8a[_0x06bc('0x2d')]['id'];}return db[_0x06bc('0x35')]['find']({'where':{'id':_0x258f8a[_0x06bc('0x49')]['id']}})[_0x06bc('0x24')](handleEntityNotFound(_0x3cf525,null))['then'](saveUpdates(_0x258f8a[_0x06bc('0x2d')],null))[_0x06bc('0x24')](respondWithResult(_0x3cf525,null))[_0x06bc('0x4c')](handleError(_0x3cf525,null));};exports[_0x06bc('0x25')]=function(_0x42ea2f,_0x9f1bce){return db[_0x06bc('0x35')][_0x06bc('0x4b')]({'where':{'id':_0x42ea2f['params']['id']}})[_0x06bc('0x24')](handleEntityNotFound(_0x9f1bce,null))['then'](removeEntity(_0x9f1bce,null))[_0x06bc('0x4c')](handleError(_0x9f1bce,null));};exports[_0x06bc('0x4e')]=function(_0x1f9b29,_0x599414){return db[_0x06bc('0x35')][_0x06bc('0x4e')]()[_0x06bc('0x24')](respondWithResult(_0x599414,null))[_0x06bc('0x4c')](handleError(_0x599414,null));}; \ No newline at end of file +var _0x852c=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','destroy','then','end','sendStatus','error','stack','name','send','render','merge','body','contact','message','interaction','account','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','count','includeAll','include','findAll','rows','catch','show','keys','length','find','create','params','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring'];(function(_0x9a3e0f,_0x2f796d){var _0x3d2a9a=function(_0x3aeb03){while(--_0x3aeb03){_0x9a3e0f['push'](_0x9a3e0f['shift']());}};_0x3d2a9a(++_0x2f796d);}(_0x852c,0x179));var _0xc852=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x852c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc852('0x0'));var rimraf=require(_0xc852('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc852('0x2'));var rp=require(_0xc852('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc852('0x4'));var util=require(_0xc852('0x5'));var path=require(_0xc852('0x6'));var sox=require(_0xc852('0x7'));var csv=require(_0xc852('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc852('0x9'));var squel=require(_0xc852('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc852('0xb'));var toCsv=require(_0xc852('0x8'));var querystring=require(_0xc852('0xc'));var Papa=require(_0xc852('0xd'));var Redis=require(_0xc852('0xe'));var authService=require(_0xc852('0xf'));var qs=require(_0xc852('0x10'));var as=require(_0xc852('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc852('0x12'))('api');var utils=require(_0xc852('0x13'));var config=require(_0xc852('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc852('0x15'))['db'];function respondWithStatusCode(_0x5dcae3,_0x1b0e2a){_0x1b0e2a=_0x1b0e2a||0xcc;return function(_0x2de381){if(_0x2de381){return _0x5dcae3['sendStatus'](_0x1b0e2a);}return _0x5dcae3[_0xc852('0x16')](_0x1b0e2a)['end']();};}function respondWithResult(_0x2efe73,_0x23eb5a){_0x23eb5a=_0x23eb5a||0xc8;return function(_0x400e0c){if(_0x400e0c){return _0x2efe73[_0xc852('0x16')](_0x23eb5a)[_0xc852('0x17')](_0x400e0c);}};}function respondWithFilteredResult(_0x374345,_0x2e3a3f){return function(_0x4c6429){if(_0x4c6429){var _0x4f3095=typeof _0x2e3a3f[_0xc852('0x18')]===_0xc852('0x19')&&typeof _0x2e3a3f['limit']==='undefined';var _0x23968d=_0x4c6429['count'];var _0xb9f57b=_0x4f3095?0x0:_0x2e3a3f[_0xc852('0x18')];var _0x1df328=_0x4f3095?_0x4c6429['count']:_0x2e3a3f[_0xc852('0x18')]+_0x2e3a3f[_0xc852('0x1a')];var _0x44de00;if(_0x1df328>=_0x23968d){_0x1df328=_0x23968d;_0x44de00=0xc8;}else{_0x44de00=0xce;}_0x374345[_0xc852('0x16')](_0x44de00);return _0x374345[_0xc852('0x1b')](_0xc852('0x1c'),_0xb9f57b+'-'+_0x1df328+'/'+_0x23968d)[_0xc852('0x17')](_0x4c6429);}return null;};}function patchUpdates(_0x3442e2){return function(_0x4b68cf){try{jsonpatch[_0xc852('0x1d')](_0x4b68cf,_0x3442e2,!![]);}catch(_0x393981){return BPromise['reject'](_0x393981);}return _0x4b68cf[_0xc852('0x1e')]();};}function saveUpdates(_0x1b04b5,_0x80bb62){return function(_0x312a2a){if(_0x312a2a){return _0x312a2a[_0xc852('0x1f')](_0x1b04b5)['then'](function(_0x43c34a){return _0x43c34a;});}return null;};}function removeEntity(_0x4ca57c,_0x64510e){return function(_0x267c07){if(_0x267c07){return _0x267c07[_0xc852('0x20')]()[_0xc852('0x21')](function(){_0x4ca57c[_0xc852('0x16')](0xcc)[_0xc852('0x22')]();});}};}function handleEntityNotFound(_0xcc516a,_0x5f03c2){return function(_0x1c6c58){if(!_0x1c6c58){_0xcc516a[_0xc852('0x23')](0x194);}return _0x1c6c58;};}function handleError(_0x354d67,_0x1a1327){_0x1a1327=_0x1a1327||0x1f4;return function(_0x1a7b45){logger[_0xc852('0x24')](_0x1a7b45[_0xc852('0x25')]);if(_0x1a7b45['name']){delete _0x1a7b45[_0xc852('0x26')];}_0x354d67[_0xc852('0x16')](_0x1a1327)[_0xc852('0x27')](_0x1a7b45);};}function getMustacheRender(_0x560c91,_0x1266e0){return Mustache[_0xc852('0x28')](_0x560c91,_[_0xc852('0x29')](_0x1266e0[_0xc852('0x2a')],{'contact':_0x1266e0[_0xc852('0x2b')],'message':_0x1266e0[_0xc852('0x2c')],'agent':_0x1266e0['agent'],'interaction':_0x1266e0[_0xc852('0x2d')],'account':_0x1266e0[_0xc852('0x2e')]}))||'';}exports[_0xc852('0x2f')]=function(_0x53d5a1,_0x159d85){var _0x1895e0={},_0x4bed90={},_0x3eb665={'count':0x0,'rows':[]};var _0x27c4e9=_[_0xc852('0x30')](db[_0xc852('0x31')][_0xc852('0x32')],function(_0x5f2055){return{'name':_0x5f2055[_0xc852('0x33')],'type':_0x5f2055[_0xc852('0x34')]['key']};});_0x4bed90[_0xc852('0x35')]=_[_0xc852('0x30')](_0x27c4e9,_0xc852('0x26'));_0x4bed90[_0xc852('0x36')]=_['keys'](_0x53d5a1['query']);_0x4bed90[_0xc852('0x37')]=_[_0xc852('0x38')](_0x4bed90['model'],_0x4bed90[_0xc852('0x36')]);_0x1895e0['attributes']=_[_0xc852('0x38')](_0x4bed90[_0xc852('0x35')],qs[_0xc852('0x39')](_0x53d5a1[_0xc852('0x36')]['fields']));_0x1895e0[_0xc852('0x3a')]=_0x1895e0['attributes']['length']?_0x1895e0[_0xc852('0x3a')]:_0x4bed90[_0xc852('0x35')];if(!_0x53d5a1[_0xc852('0x36')]['hasOwnProperty'](_0xc852('0x3b'))){_0x1895e0[_0xc852('0x1a')]=qs['limit'](_0x53d5a1[_0xc852('0x36')][_0xc852('0x1a')]);_0x1895e0[_0xc852('0x18')]=qs['offset'](_0x53d5a1[_0xc852('0x36')][_0xc852('0x18')]);}_0x1895e0[_0xc852('0x3c')]=qs[_0xc852('0x3d')](_0x53d5a1[_0xc852('0x36')][_0xc852('0x3d')]);_0x1895e0[_0xc852('0x3e')]=qs[_0xc852('0x37')](_[_0xc852('0x3f')](_0x53d5a1[_0xc852('0x36')],_0x4bed90[_0xc852('0x37')]),_0x27c4e9);if(_0x53d5a1[_0xc852('0x36')][_0xc852('0x40')]){_0x1895e0[_0xc852('0x3e')]=_[_0xc852('0x29')](_0x1895e0[_0xc852('0x3e')],{'$or':_[_0xc852('0x30')](_0x27c4e9,function(_0x56fa88){if(_0x56fa88[_0xc852('0x34')]!=='VIRTUAL'){var _0x696b10={};_0x696b10[_0x56fa88[_0xc852('0x26')]]={'$like':'%'+_0x53d5a1[_0xc852('0x36')][_0xc852('0x40')]+'%'};return _0x696b10;}})});}_0x1895e0=_[_0xc852('0x29')]({},_0x1895e0,_0x53d5a1['options']);var _0x39a7ec={'where':_0x1895e0[_0xc852('0x3e')]};return db['JscriptyQuestionReport'][_0xc852('0x41')](_0x39a7ec)[_0xc852('0x21')](function(_0x4c4272){_0x3eb665[_0xc852('0x41')]=_0x4c4272;if(_0x53d5a1['query'][_0xc852('0x42')]){_0x1895e0[_0xc852('0x43')]=[{'all':!![]}];}return db[_0xc852('0x31')][_0xc852('0x44')](_0x1895e0);})['then'](function(_0x335396){_0x3eb665[_0xc852('0x45')]=_0x335396;return _0x3eb665;})[_0xc852('0x21')](respondWithFilteredResult(_0x159d85,_0x1895e0))[_0xc852('0x46')](handleError(_0x159d85,null));};exports[_0xc852('0x47')]=function(_0x208ec0,_0xed13eb){var _0x5aa7ba={'raw':!![],'where':{'id':_0x208ec0['params']['id']}},_0x5a13ce={};_0x5a13ce[_0xc852('0x35')]=_[_0xc852('0x48')](db[_0xc852('0x31')][_0xc852('0x32')]);_0x5a13ce[_0xc852('0x36')]=_[_0xc852('0x48')](_0x208ec0[_0xc852('0x36')]);_0x5a13ce[_0xc852('0x37')]=_[_0xc852('0x38')](_0x5a13ce[_0xc852('0x35')],_0x5a13ce[_0xc852('0x36')]);_0x5aa7ba['attributes']=_[_0xc852('0x38')](_0x5a13ce[_0xc852('0x35')],qs[_0xc852('0x39')](_0x208ec0[_0xc852('0x36')][_0xc852('0x39')]));_0x5aa7ba[_0xc852('0x3a')]=_0x5aa7ba[_0xc852('0x3a')][_0xc852('0x49')]?_0x5aa7ba[_0xc852('0x3a')]:_0x5a13ce[_0xc852('0x35')];if(_0x208ec0[_0xc852('0x36')][_0xc852('0x42')]){_0x5aa7ba[_0xc852('0x43')]=[{'all':!![]}];}_0x5aa7ba=_[_0xc852('0x29')]({},_0x5aa7ba,_0x208ec0['options']);return db[_0xc852('0x31')][_0xc852('0x4a')](_0x5aa7ba)[_0xc852('0x21')](handleEntityNotFound(_0xed13eb,null))[_0xc852('0x21')](respondWithResult(_0xed13eb,null))[_0xc852('0x46')](handleError(_0xed13eb,null));};exports['create']=function(_0x16e93f,_0x96abea){return db[_0xc852('0x31')][_0xc852('0x4b')](_0x16e93f[_0xc852('0x2a')],{})[_0xc852('0x21')](respondWithResult(_0x96abea,0xc9))[_0xc852('0x46')](handleError(_0x96abea,null));};exports[_0xc852('0x1f')]=function(_0x4331e7,_0xcbb110){if(_0x4331e7[_0xc852('0x2a')]['id']){delete _0x4331e7['body']['id'];}return db[_0xc852('0x31')][_0xc852('0x4a')]({'where':{'id':_0x4331e7['params']['id']}})[_0xc852('0x21')](handleEntityNotFound(_0xcbb110,null))[_0xc852('0x21')](saveUpdates(_0x4331e7['body'],null))[_0xc852('0x21')](respondWithResult(_0xcbb110,null))[_0xc852('0x46')](handleError(_0xcbb110,null));};exports['destroy']=function(_0x1237c7,_0x2e04de){return db['JscriptyQuestionReport'][_0xc852('0x4a')]({'where':{'id':_0x1237c7[_0xc852('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e04de,null))[_0xc852('0x21')](removeEntity(_0x2e04de,null))[_0xc852('0x46')](handleError(_0x2e04de,null));};exports[_0xc852('0x4d')]=function(_0xc26c15,_0x1f7ee3){return db[_0xc852('0x31')][_0xc852('0x4d')]()['then'](respondWithResult(_0x1f7ee3,null))[_0xc852('0x46')](handleError(_0x1f7ee3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 3888b0e..2ee5043 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 _0xe14f=['define','JscriptyQuestionReport','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','exports'];(function(_0x54e6f5,_0x4f4e99){var _0x5e8794=function(_0x27512b){while(--_0x27512b){_0x54e6f5['push'](_0x54e6f5['shift']());}};_0x5e8794(++_0x4f4e99);}(_0xe14f,0x160));var _0xfe14=function(_0x5b7703,_0x3bb139){_0x5b7703=_0x5b7703-0x0;var _0x3cb756=_0xe14f[_0x5b7703];return _0x3cb756;};'use strict';var _=require(_0xfe14('0x0'));var util=require(_0xfe14('0x1'));var logger=require(_0xfe14('0x2'))('api');var moment=require(_0xfe14('0x3'));var BPromise=require(_0xfe14('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe14('0x5'));var rimraf=require('rimraf');var config=require(_0xfe14('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xfe14('0x7')]=function(_0x5cf60e,_0x170f7f){return _0x5cf60e[_0xfe14('0x8')](_0xfe14('0x9'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x881b=['rimraf','exports','define','JscriptyQuestionReport','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1ff229,_0x399aa4){var _0x1cb059=function(_0x2e82fb){while(--_0x2e82fb){_0x1ff229['push'](_0x1ff229['shift']());}};_0x1cb059(++_0x399aa4);}(_0x881b,0xae));var _0xb881=function(_0x4ebe24,_0x495919){_0x4ebe24=_0x4ebe24-0x0;var _0x2a4300=_0x881b[_0x4ebe24];return _0x2a4300;};'use strict';var _=require(_0xb881('0x0'));var util=require('util');var logger=require(_0xb881('0x1'))('api');var moment=require(_0xb881('0x2'));var BPromise=require(_0xb881('0x3'));var rp=require(_0xb881('0x4'));var fs=require('fs');var path=require(_0xb881('0x5'));var rimraf=require(_0xb881('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module[_0xb881('0x7')]=function(_0x57b53f,_0x448ed3){return _0x57b53f[_0xb881('0x8')](_0xb881('0x9'),attributes,{'tableName':'report_jscripty_questions','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 f72f57a..ea7857f 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 _0xcf2a=['code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','client','http','request','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5d30ea,_0x18ae71){var _0x51af83=function(_0x53f656){while(--_0x53f656){_0x5d30ea['push'](_0x5d30ea['shift']());}};_0x51af83(++_0x18ae71);}(_0xcf2a,0x70));var _0xacf2=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xcf2a[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require('lodash');var util=require(_0xacf2('0x0'));var moment=require(_0xacf2('0x1'));var BPromise=require(_0xacf2('0x2'));var rs=require(_0xacf2('0x3'));var fs=require('fs');var Redis=require(_0xacf2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xacf2('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xacf2('0x6')][_0xacf2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x54abc1,_0x4a8083,_0x2c0cea){return new BPromise(function(_0x17a602,_0x46f5c2){return client[_0xacf2('0x8')](_0x54abc1,_0x2c0cea)['then'](function(_0x2b3619){logger['info'](_0xacf2('0x9'),_0x4a8083,_0xacf2('0xa'));logger[_0xacf2('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x4a8083,_0xacf2('0xa'),JSON[_0xacf2('0xc')](_0x2b3619));if(_0x2b3619['error']){if(_0x2b3619[_0xacf2('0xd')][_0xacf2('0xe')]===0x1f4){logger[_0xacf2('0xd')](_0xacf2('0x9'),_0x4a8083,_0x2b3619[_0xacf2('0xd')][_0xacf2('0xf')]);return _0x46f5c2(_0x2b3619[_0xacf2('0xd')]['message']);}logger[_0xacf2('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4a8083,_0x2b3619[_0xacf2('0xd')]['message']);return _0x17a602(_0x2b3619[_0xacf2('0xd')]['message']);}else{logger[_0xacf2('0x10')](_0xacf2('0x9'),_0x4a8083,_0xacf2('0xa'));_0x17a602(_0x2b3619['result'][_0xacf2('0xf')]);}})[_0xacf2('0x11')](function(_0x274e8b){logger[_0xacf2('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4a8083,_0x274e8b);_0x46f5c2(_0x274e8b);});});} \ No newline at end of file +var _0x7f0c=['jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7f0c,0x161));var _0xc7f0=function(_0x11e213,_0x4f2b14){_0x11e213=_0x11e213-0x0;var _0x504df2=_0x7f0c[_0x11e213];return _0x504df2;};'use strict';var _=require(_0xc7f0('0x0'));var util=require(_0xc7f0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc7f0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7f0('0x3'))['db'];var utils=require(_0xc7f0('0x4'));var logger=require(_0xc7f0('0x5'))(_0xc7f0('0x6'));var config=require('../../config/environment');var jayson=require(_0xc7f0('0x7'));var client=jayson[_0xc7f0('0x8')][_0xc7f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31bedf,_0x584125,_0x3ae446){return new BPromise(function(_0x2852b2,_0x43b862){return client[_0xc7f0('0xa')](_0x31bedf,_0x3ae446)['then'](function(_0x27971a){logger[_0xc7f0('0xb')](_0xc7f0('0xc'),_0x584125,_0xc7f0('0xd'));logger[_0xc7f0('0xe')](_0xc7f0('0xf'),_0x584125,_0xc7f0('0xd'),JSON['stringify'](_0x27971a));if(_0x27971a[_0xc7f0('0x10')]){if(_0x27971a['error'][_0xc7f0('0x11')]===0x1f4){logger[_0xc7f0('0x10')](_0xc7f0('0xc'),_0x584125,_0x27971a[_0xc7f0('0x10')][_0xc7f0('0x12')]);return _0x43b862(_0x27971a[_0xc7f0('0x10')]['message']);}logger[_0xc7f0('0x10')](_0xc7f0('0xc'),_0x584125,_0x27971a[_0xc7f0('0x10')]['message']);return _0x2852b2(_0x27971a[_0xc7f0('0x10')][_0xc7f0('0x12')]);}else{logger['info'](_0xc7f0('0xc'),_0x584125,_0xc7f0('0xd'));_0x2852b2(_0x27971a['result'][_0xc7f0('0x12')]);}})[_0xc7f0('0x13')](function(_0x59c642){logger[_0xc7f0('0x10')](_0xc7f0('0xc'),_0x584125,_0x59c642);_0x43b862(_0x59c642);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index b2b97ed..d7c7b06 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 _0xb138=['../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','/describe','describe','/:id','/:id/questions','getQuestions','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb138,0x1dd));var _0x8b13=function(_0x2243fc,_0x49e831){_0x2243fc=_0x2243fc-0x0;var _0x3affa6=_0xb138[_0x2243fc];return _0x3affa6;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var fs_extra=require(_0x8b13('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var controller=require(_0x8b13('0x9'));router['get']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xb')]);router['get'](_0x8b13('0xc'),auth[_0x8b13('0xa')](),controller[_0x8b13('0xd')]);router['get'](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller['show']);router['get'](_0x8b13('0xf'),auth[_0x8b13('0xa')](),controller[_0x8b13('0x10')]);router[_0x8b13('0x11')]('/',auth[_0x8b13('0xa')](),controller['create']);router[_0x8b13('0x12')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller[_0x8b13('0x13')]);router[_0x8b13('0x14')](_0x8b13('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x8b13('0x15')]=router; \ No newline at end of file +var _0x326f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','show','/:id/questions','getQuestions','put','delete','/:id','destroy','exports','multer'];(function(_0xe57cc,_0x2e16cb){var _0x1e21a2=function(_0x21b5b3){while(--_0x21b5b3){_0xe57cc['push'](_0xe57cc['shift']());}};_0x1e21a2(++_0x2e16cb);}(_0x326f,0xd1));var _0xf326=function(_0x53a35c,_0x3acfd8){_0x53a35c=_0x53a35c-0x0;var _0x46982f=_0x326f[_0x53a35c];return _0x46982f;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['post']('/',auth[_0xf326('0xa')](),controller['create']);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')](_0xf326('0x12'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);module[_0xf326('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 15d220c..d7bfefb 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 _0x7a69=['YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment','exports','setDataValue','starttime','endtime'];(function(_0xa4e4f9,_0x290dd0){var _0x261f8e=function(_0x44e3f7){while(--_0x44e3f7){_0xa4e4f9['push'](_0xa4e4f9['shift']());}};_0x261f8e(++_0x290dd0);}(_0x7a69,0xe5));var _0x97a6=function(_0x8ac594,_0x3a46b7){_0x8ac594=_0x8ac594-0x0;var _0x50a040=_0x7a69[_0x8ac594];return _0x50a040;};'use strict';var moment=require(_0x97a6('0x0'));var Sequelize=require('sequelize');module[_0x97a6('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x1f273f){this[_0x97a6('0x2')](_0x97a6('0x3'),_0x1f273f);this['setDataValue'](_0x97a6('0x4'),moment()['format'](_0x97a6('0x5')));}},'endtime':{'type':Sequelize[_0x97a6('0x6')]},'membername':{'type':Sequelize[_0x97a6('0x7')]},'projectname':{'type':Sequelize[_0x97a6('0x7')]},'queue':{'type':Sequelize[_0x97a6('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x97a6('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x97a6('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x5797=['moment','sequelize','exports','DATE','setDataValue','endtime','format','STRING','BOOLEAN'];(function(_0x4b0c3e,_0x50754a){var _0xa99d4e=function(_0x1034a2){while(--_0x1034a2){_0x4b0c3e['push'](_0x4b0c3e['shift']());}};_0xa99d4e(++_0x50754a);}(_0x5797,0x1e6));var _0x7579=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x5797[_0x1762b4];return _0x29beda;};'use strict';var moment=require(_0x7579('0x0'));var Sequelize=require(_0x7579('0x1'));module[_0x7579('0x2')]={'starttime':{'type':Sequelize[_0x7579('0x3')],'set':function(_0x44954f){this[_0x7579('0x4')]('starttime',_0x44954f);this[_0x7579('0x4')](_0x7579('0x5'),moment()[_0x7579('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x7579('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7579('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x7579('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 6ae373e..fdc04a5 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 _0x1e78=['type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','pick','filter','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','destroy','describe','getQuestions','findOne','hasOwnProperty','order','sort','SessionId','JscriptyQuestionReport','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','render','merge','body','message','agent','interaction','account','JscriptySessionReport','rawAttributes','fieldName'];(function(_0x185d2a,_0x308609){var _0x4dea27=function(_0x513443){while(--_0x513443){_0x185d2a['push'](_0x185d2a['shift']());}};_0x4dea27(++_0x308609);}(_0x1e78,0x7b));var _0x81e7=function(_0x1e12a0,_0x4f6458){_0x1e12a0=_0x1e12a0-0x0;var _0x4fc28a=_0x1e78[_0x1e12a0];return _0x4fc28a;};'use strict';var emlformat=require(_0x81e7('0x0'));var rimraf=require(_0x81e7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x81e7('0x2'));var rp=require('request-promise');var moment=require(_0x81e7('0x3'));var BPromise=require(_0x81e7('0x4'));var Mustache=require(_0x81e7('0x5'));var util=require(_0x81e7('0x6'));var path=require(_0x81e7('0x7'));var sox=require('sox');var csv=require(_0x81e7('0x8'));var ejs=require(_0x81e7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x81e7('0xa'));var squel=require(_0x81e7('0xb'));var crypto=require('crypto');var jsforce=require(_0x81e7('0xc'));var deskjs=require(_0x81e7('0xd'));var toCsv=require('to-csv');var querystring=require(_0x81e7('0xe'));var Papa=require(_0x81e7('0xf'));var Redis=require('ioredis');var authService=require(_0x81e7('0x10'));var qs=require(_0x81e7('0x11'));var as=require(_0x81e7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x81e7('0x13'))(_0x81e7('0x14'));var utils=require(_0x81e7('0x15'));var config=require(_0x81e7('0x16'));var licenseUtil=require(_0x81e7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e2a70,_0x4b28fe){_0x4b28fe=_0x4b28fe||0xcc;return function(_0xb0340e){if(_0xb0340e){return _0x4e2a70[_0x81e7('0x18')](_0x4b28fe);}return _0x4e2a70['status'](_0x4b28fe)['end']();};}function respondWithResult(_0x1d1af9,_0x3a16db){_0x3a16db=_0x3a16db||0xc8;return function(_0x2d6905){if(_0x2d6905){return _0x1d1af9[_0x81e7('0x19')](_0x3a16db)[_0x81e7('0x1a')](_0x2d6905);}};}function respondWithFilteredResult(_0xf8cd63,_0x564e25){return function(_0x29d37d){if(_0x29d37d){var _0x1dfcf7=typeof _0x564e25[_0x81e7('0x1b')]===_0x81e7('0x1c')&&typeof _0x564e25[_0x81e7('0x1d')]===_0x81e7('0x1c');var _0x11a407=_0x29d37d[_0x81e7('0x1e')];var _0x2140f1=_0x1dfcf7?0x0:_0x564e25[_0x81e7('0x1b')];var _0x5738e7=_0x1dfcf7?_0x29d37d[_0x81e7('0x1e')]:_0x564e25[_0x81e7('0x1b')]+_0x564e25['limit'];var _0x304d4f;if(_0x5738e7>=_0x11a407){_0x5738e7=_0x11a407;_0x304d4f=0xc8;}else{_0x304d4f=0xce;}_0xf8cd63[_0x81e7('0x19')](_0x304d4f);return _0xf8cd63[_0x81e7('0x1f')](_0x81e7('0x20'),_0x2140f1+'-'+_0x5738e7+'/'+_0x11a407)[_0x81e7('0x1a')](_0x29d37d);}return null;};}function patchUpdates(_0x4db626){return function(_0x4bf81c){try{jsonpatch[_0x81e7('0x21')](_0x4bf81c,_0x4db626,!![]);}catch(_0x1f1004){return BPromise[_0x81e7('0x22')](_0x1f1004);}return _0x4bf81c[_0x81e7('0x23')]();};}function saveUpdates(_0x468e0a,_0x11ded8){return function(_0x4b4df1){if(_0x4b4df1){return _0x4b4df1[_0x81e7('0x24')](_0x468e0a)['then'](function(_0x164bc6){return _0x164bc6;});}return null;};}function removeEntity(_0x412b83,_0x37e4ae){return function(_0x2c0490){if(_0x2c0490){return _0x2c0490['destroy']()[_0x81e7('0x25')](function(){_0x412b83[_0x81e7('0x19')](0xcc)[_0x81e7('0x26')]();});}};}function handleEntityNotFound(_0x2f3d21,_0x517ef3){return function(_0xd45440){if(!_0xd45440){_0x2f3d21[_0x81e7('0x18')](0x194);}return _0xd45440;};}function handleError(_0x21a2b6,_0x694005){_0x694005=_0x694005||0x1f4;return function(_0x7c17ba){logger[_0x81e7('0x27')](_0x7c17ba[_0x81e7('0x28')]);if(_0x7c17ba['name']){delete _0x7c17ba[_0x81e7('0x29')];}_0x21a2b6[_0x81e7('0x19')](_0x694005)[_0x81e7('0x2a')](_0x7c17ba);};}function getMustacheRender(_0x86487f,_0x2a84c2){return Mustache[_0x81e7('0x2b')](_0x86487f,_[_0x81e7('0x2c')](_0x2a84c2[_0x81e7('0x2d')],{'contact':_0x2a84c2['contact'],'message':_0x2a84c2[_0x81e7('0x2e')],'agent':_0x2a84c2[_0x81e7('0x2f')],'interaction':_0x2a84c2[_0x81e7('0x30')],'account':_0x2a84c2[_0x81e7('0x31')]}))||'';}exports['index']=function(_0x26dc2f,_0x73fa50){var _0x2a7115={},_0x3b4797={},_0x2284a1={'count':0x0,'rows':[]};var _0x2a5677=_['map'](db[_0x81e7('0x32')][_0x81e7('0x33')],function(_0x53e920){return{'name':_0x53e920[_0x81e7('0x34')],'type':_0x53e920[_0x81e7('0x35')][_0x81e7('0x36')]};});_0x3b4797['model']=_[_0x81e7('0x37')](_0x2a5677,_0x81e7('0x29'));_0x3b4797[_0x81e7('0x38')]=_[_0x81e7('0x39')](_0x26dc2f['query']);_0x3b4797[_0x81e7('0x3a')]=_[_0x81e7('0x3b')](_0x3b4797[_0x81e7('0x3c')],_0x3b4797[_0x81e7('0x38')]);_0x2a7115[_0x81e7('0x3d')]=_[_0x81e7('0x3b')](_0x3b4797[_0x81e7('0x3c')],qs[_0x81e7('0x3e')](_0x26dc2f['query'][_0x81e7('0x3e')]));_0x2a7115[_0x81e7('0x3d')]=_0x2a7115[_0x81e7('0x3d')][_0x81e7('0x3f')]?_0x2a7115[_0x81e7('0x3d')]:_0x3b4797[_0x81e7('0x3c')];if(!_0x26dc2f[_0x81e7('0x38')]['hasOwnProperty'](_0x81e7('0x40'))){_0x2a7115['limit']=qs['limit'](_0x26dc2f[_0x81e7('0x38')][_0x81e7('0x1d')]);_0x2a7115['offset']=qs[_0x81e7('0x1b')](_0x26dc2f[_0x81e7('0x38')]['offset']);}_0x2a7115['order']=qs['sort'](_0x26dc2f[_0x81e7('0x38')]['sort']);_0x2a7115['where']=qs['filters'](_[_0x81e7('0x41')](_0x26dc2f['query'],_0x3b4797[_0x81e7('0x3a')]),_0x2a5677);if(_0x26dc2f[_0x81e7('0x38')][_0x81e7('0x42')]){_0x2a7115[_0x81e7('0x43')]=_[_0x81e7('0x2c')](_0x2a7115[_0x81e7('0x43')],{'$or':_[_0x81e7('0x37')](_0x2a5677,function(_0x36cb3b){if(_0x36cb3b[_0x81e7('0x35')]!==_0x81e7('0x44')){var _0x5aa01f={};_0x5aa01f[_0x36cb3b['name']]={'$like':'%'+_0x26dc2f['query'][_0x81e7('0x42')]+'%'};return _0x5aa01f;}})});}_0x2a7115=_[_0x81e7('0x2c')]({},_0x2a7115,_0x26dc2f[_0x81e7('0x45')]);var _0x4535d5={'where':_0x2a7115[_0x81e7('0x43')]};return db['JscriptySessionReport'][_0x81e7('0x1e')](_0x4535d5)[_0x81e7('0x25')](function(_0x3140b2){_0x2284a1[_0x81e7('0x1e')]=_0x3140b2;if(_0x26dc2f[_0x81e7('0x38')][_0x81e7('0x46')]){_0x2a7115['include']=[{'all':!![]}];}return db[_0x81e7('0x32')][_0x81e7('0x47')](_0x2a7115);})['then'](function(_0x5c26c5){_0x2284a1[_0x81e7('0x48')]=_0x5c26c5;return _0x2284a1;})[_0x81e7('0x25')](respondWithFilteredResult(_0x73fa50,_0x2a7115))[_0x81e7('0x49')](handleError(_0x73fa50,null));};exports[_0x81e7('0x4a')]=function(_0x242a3b,_0x157e89){var _0x285010={'raw':!![],'where':{'id':_0x242a3b[_0x81e7('0x4b')]['id']}},_0x15cbd9={};_0x15cbd9['model']=_[_0x81e7('0x39')](db[_0x81e7('0x32')][_0x81e7('0x33')]);_0x15cbd9[_0x81e7('0x38')]=_[_0x81e7('0x39')](_0x242a3b[_0x81e7('0x38')]);_0x15cbd9[_0x81e7('0x3a')]=_[_0x81e7('0x3b')](_0x15cbd9[_0x81e7('0x3c')],_0x15cbd9[_0x81e7('0x38')]);_0x285010['attributes']=_['intersection'](_0x15cbd9[_0x81e7('0x3c')],qs[_0x81e7('0x3e')](_0x242a3b[_0x81e7('0x38')][_0x81e7('0x3e')]));_0x285010[_0x81e7('0x3d')]=_0x285010[_0x81e7('0x3d')][_0x81e7('0x3f')]?_0x285010[_0x81e7('0x3d')]:_0x15cbd9[_0x81e7('0x3c')];if(_0x242a3b[_0x81e7('0x38')]['includeAll']){_0x285010[_0x81e7('0x4c')]=[{'all':!![]}];}_0x285010=_[_0x81e7('0x2c')]({},_0x285010,_0x242a3b['options']);return db[_0x81e7('0x32')][_0x81e7('0x4d')](_0x285010)['then'](handleEntityNotFound(_0x157e89,null))[_0x81e7('0x25')](respondWithResult(_0x157e89,null))[_0x81e7('0x49')](handleError(_0x157e89,null));};exports[_0x81e7('0x4e')]=function(_0x3e6867,_0x11d4f6){return db['JscriptySessionReport'][_0x81e7('0x4e')](_0x3e6867['body'],{})[_0x81e7('0x25')](respondWithResult(_0x11d4f6,0xc9))[_0x81e7('0x49')](handleError(_0x11d4f6,null));};exports[_0x81e7('0x24')]=function(_0x5c4edc,_0xf7c893){if(_0x5c4edc[_0x81e7('0x2d')]['id']){delete _0x5c4edc[_0x81e7('0x2d')]['id'];}return db[_0x81e7('0x32')][_0x81e7('0x4d')]({'where':{'id':_0x5c4edc['params']['id']}})[_0x81e7('0x25')](handleEntityNotFound(_0xf7c893,null))['then'](saveUpdates(_0x5c4edc[_0x81e7('0x2d')],null))['then'](respondWithResult(_0xf7c893,null))[_0x81e7('0x49')](handleError(_0xf7c893,null));};exports[_0x81e7('0x4f')]=function(_0xa5bb2c,_0x45114d){return db[_0x81e7('0x32')][_0x81e7('0x4d')]({'where':{'id':_0xa5bb2c[_0x81e7('0x4b')]['id']}})[_0x81e7('0x25')](handleEntityNotFound(_0x45114d,null))['then'](removeEntity(_0x45114d,null))[_0x81e7('0x49')](handleError(_0x45114d,null));};exports['describe']=function(_0x3db931,_0x46d004){return db[_0x81e7('0x32')][_0x81e7('0x50')]()[_0x81e7('0x25')](respondWithResult(_0x46d004,null))[_0x81e7('0x49')](handleError(_0x46d004,null));};exports[_0x81e7('0x51')]=function(_0x5bf922,_0x1acf68,_0x65b318){var _0x1ae31c={'raw':!![],'where':{}};var _0x26be1e={};var _0x418f07={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x81e7('0x52')]({'where':{'id':_0x5bf922[_0x81e7('0x4b')]['id']}})[_0x81e7('0x25')](handleEntityNotFound(_0x1acf68,null))[_0x81e7('0x25')](function(_0x36c8ee){if(_0x36c8ee){_0x26be1e[_0x81e7('0x3c')]=_[_0x81e7('0x39')](db['JscriptyQuestionReport']['rawAttributes']);_0x26be1e[_0x81e7('0x38')]=_[_0x81e7('0x39')](_0x5bf922[_0x81e7('0x38')]);_0x26be1e[_0x81e7('0x3a')]=_[_0x81e7('0x3b')](_0x26be1e[_0x81e7('0x3c')],_0x26be1e[_0x81e7('0x38')]);_0x1ae31c[_0x81e7('0x3d')]=_[_0x81e7('0x3b')](_0x26be1e['model'],qs['fields'](_0x5bf922['query'][_0x81e7('0x3e')]));_0x1ae31c[_0x81e7('0x3d')]=_0x1ae31c[_0x81e7('0x3d')][_0x81e7('0x3f')]?_0x1ae31c[_0x81e7('0x3d')]:_0x26be1e[_0x81e7('0x3c')];if(!_0x5bf922[_0x81e7('0x38')][_0x81e7('0x53')](_0x81e7('0x40'))){_0x1ae31c[_0x81e7('0x1d')]=qs[_0x81e7('0x1d')](_0x5bf922['query'][_0x81e7('0x1d')]);_0x1ae31c[_0x81e7('0x1b')]=qs[_0x81e7('0x1b')](_0x5bf922[_0x81e7('0x38')][_0x81e7('0x1b')]);}_0x1ae31c[_0x81e7('0x54')]=qs[_0x81e7('0x55')](_0x5bf922['query'][_0x81e7('0x55')]);_0x1ae31c[_0x81e7('0x43')]=qs['filters'](_['pick'](_0x5bf922[_0x81e7('0x38')],_0x26be1e['filters']));_0x1ae31c[_0x81e7('0x43')][_0x81e7('0x56')]=_0x36c8ee['id'];if(_0x5bf922[_0x81e7('0x38')]['filter']){_0x1ae31c[_0x81e7('0x43')]=_[_0x81e7('0x2c')](_0x1ae31c[_0x81e7('0x43')],{'$or':_[_0x81e7('0x37')](_0x1ae31c[_0x81e7('0x3d')],function(_0x5e6107){var _0x465b1a={};_0x465b1a[_0x5e6107]={'$like':'%'+_0x5bf922[_0x81e7('0x38')]['filter']+'%'};return _0x465b1a;})});}_0x1ae31c=_['merge']({},_0x1ae31c,_0x5bf922[_0x81e7('0x45')]);return db[_0x81e7('0x57')][_0x81e7('0x1e')]({'where':_0x1ae31c[_0x81e7('0x43')]})[_0x81e7('0x25')](function(_0x245fc8){_0x418f07['count']=_0x245fc8;if(_0x5bf922[_0x81e7('0x38')][_0x81e7('0x46')]){_0x1ae31c['include']=[{'all':!![]}];}return db[_0x81e7('0x57')][_0x81e7('0x47')](_0x1ae31c);})[_0x81e7('0x25')](function(_0x560da9){_0x418f07[_0x81e7('0x48')]=_0x560da9;return _0x418f07;});}})[_0x81e7('0x25')](respondWithFilteredResult(_0x1acf68,_0x1ae31c))[_0x81e7('0x49')](handleError(_0x1acf68,null));}; \ No newline at end of file +var _0x5ff9=['rows','catch','params','find','create','describe','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','render','merge','body','contact','agent','account','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll'];(function(_0x66baf9,_0x3f9e75){var _0x2b2b52=function(_0x457039){while(--_0x457039){_0x66baf9['push'](_0x66baf9['shift']());}};_0x2b2b52(++_0x3f9e75);}(_0x5ff9,0x1ef));var _0x95ff=function(_0x408286,_0x3e8a49){_0x408286=_0x408286-0x0;var _0x28d1ac=_0x5ff9[_0x408286];return _0x28d1ac;};'use strict';var emlformat=require(_0x95ff('0x0'));var rimraf=require(_0x95ff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95ff('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x95ff('0x3'));var Mustache=require(_0x95ff('0x4'));var util=require(_0x95ff('0x5'));var path=require(_0x95ff('0x6'));var sox=require(_0x95ff('0x7'));var csv=require(_0x95ff('0x8'));var ejs=require(_0x95ff('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95ff('0xa'));var squel=require(_0x95ff('0xb'));var crypto=require(_0x95ff('0xc'));var jsforce=require(_0x95ff('0xd'));var deskjs=require(_0x95ff('0xe'));var toCsv=require(_0x95ff('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x95ff('0xf'));var authService=require(_0x95ff('0x10'));var qs=require(_0x95ff('0x11'));var as=require(_0x95ff('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x95ff('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x95ff('0x14'));var licenseUtil=require(_0x95ff('0x15'));var db=require(_0x95ff('0x16'))['db'];function respondWithStatusCode(_0x245388,_0x5bf54a){_0x5bf54a=_0x5bf54a||0xcc;return function(_0xf3ce4c){if(_0xf3ce4c){return _0x245388[_0x95ff('0x17')](_0x5bf54a);}return _0x245388[_0x95ff('0x18')](_0x5bf54a)['end']();};}function respondWithResult(_0x27845e,_0x50076a){_0x50076a=_0x50076a||0xc8;return function(_0x46fd5d){if(_0x46fd5d){return _0x27845e[_0x95ff('0x18')](_0x50076a)[_0x95ff('0x19')](_0x46fd5d);}};}function respondWithFilteredResult(_0x4f8a94,_0x51e4e6){return function(_0x2eca86){if(_0x2eca86){var _0x545271=typeof _0x51e4e6[_0x95ff('0x1a')]==='undefined'&&typeof _0x51e4e6[_0x95ff('0x1b')]===_0x95ff('0x1c');var _0x53feb4=_0x2eca86[_0x95ff('0x1d')];var _0x125351=_0x545271?0x0:_0x51e4e6[_0x95ff('0x1a')];var _0x10517b=_0x545271?_0x2eca86[_0x95ff('0x1d')]:_0x51e4e6['offset']+_0x51e4e6[_0x95ff('0x1b')];var _0x46e91e;if(_0x10517b>=_0x53feb4){_0x10517b=_0x53feb4;_0x46e91e=0xc8;}else{_0x46e91e=0xce;}_0x4f8a94[_0x95ff('0x18')](_0x46e91e);return _0x4f8a94[_0x95ff('0x1e')](_0x95ff('0x1f'),_0x125351+'-'+_0x10517b+'/'+_0x53feb4)['json'](_0x2eca86);}return null;};}function patchUpdates(_0xa6854a){return function(_0x56f7ab){try{jsonpatch['apply'](_0x56f7ab,_0xa6854a,!![]);}catch(_0x5cc988){return BPromise[_0x95ff('0x20')](_0x5cc988);}return _0x56f7ab[_0x95ff('0x21')]();};}function saveUpdates(_0x1d3065,_0x3025ab){return function(_0x2b21f7){if(_0x2b21f7){return _0x2b21f7[_0x95ff('0x22')](_0x1d3065)[_0x95ff('0x23')](function(_0xa314b0){return _0xa314b0;});}return null;};}function removeEntity(_0x4143d0,_0x5dfd76){return function(_0x22ca54){if(_0x22ca54){return _0x22ca54[_0x95ff('0x24')]()[_0x95ff('0x23')](function(){_0x4143d0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x599ba1,_0x5c9d29){return function(_0x2324c7){if(!_0x2324c7){_0x599ba1[_0x95ff('0x17')](0x194);}return _0x2324c7;};}function handleError(_0x1dfc6b,_0x2e7d0b){_0x2e7d0b=_0x2e7d0b||0x1f4;return function(_0xeeb27){logger[_0x95ff('0x25')](_0xeeb27['stack']);if(_0xeeb27[_0x95ff('0x26')]){delete _0xeeb27[_0x95ff('0x26')];}_0x1dfc6b['status'](_0x2e7d0b)[_0x95ff('0x27')](_0xeeb27);};}function getMustacheRender(_0x102e8d,_0x2dc41b){return Mustache[_0x95ff('0x28')](_0x102e8d,_[_0x95ff('0x29')](_0x2dc41b[_0x95ff('0x2a')],{'contact':_0x2dc41b[_0x95ff('0x2b')],'message':_0x2dc41b['message'],'agent':_0x2dc41b[_0x95ff('0x2c')],'interaction':_0x2dc41b['interaction'],'account':_0x2dc41b[_0x95ff('0x2d')]}))||'';}exports[_0x95ff('0x2e')]=function(_0x10688b,_0x4204c3){var _0x4fb84b={},_0x3e23bf={},_0x3ef0f5={'count':0x0,'rows':[]};var _0x180751=_[_0x95ff('0x2f')](db[_0x95ff('0x30')][_0x95ff('0x31')],function(_0x4aa4be){return{'name':_0x4aa4be[_0x95ff('0x32')],'type':_0x4aa4be[_0x95ff('0x33')]['key']};});_0x3e23bf[_0x95ff('0x34')]=_[_0x95ff('0x2f')](_0x180751,_0x95ff('0x26'));_0x3e23bf[_0x95ff('0x35')]=_[_0x95ff('0x36')](_0x10688b['query']);_0x3e23bf[_0x95ff('0x37')]=_[_0x95ff('0x38')](_0x3e23bf[_0x95ff('0x34')],_0x3e23bf[_0x95ff('0x35')]);_0x4fb84b[_0x95ff('0x39')]=_[_0x95ff('0x38')](_0x3e23bf['model'],qs['fields'](_0x10688b[_0x95ff('0x35')][_0x95ff('0x3a')]));_0x4fb84b[_0x95ff('0x39')]=_0x4fb84b[_0x95ff('0x39')][_0x95ff('0x3b')]?_0x4fb84b['attributes']:_0x3e23bf[_0x95ff('0x34')];if(!_0x10688b[_0x95ff('0x35')][_0x95ff('0x3c')](_0x95ff('0x3d'))){_0x4fb84b['limit']=qs[_0x95ff('0x1b')](_0x10688b['query']['limit']);_0x4fb84b[_0x95ff('0x1a')]=qs['offset'](_0x10688b[_0x95ff('0x35')][_0x95ff('0x1a')]);}_0x4fb84b[_0x95ff('0x3e')]=qs[_0x95ff('0x3f')](_0x10688b[_0x95ff('0x35')][_0x95ff('0x3f')]);_0x4fb84b[_0x95ff('0x40')]=qs[_0x95ff('0x37')](_[_0x95ff('0x41')](_0x10688b['query'],_0x3e23bf[_0x95ff('0x37')]),_0x180751);if(_0x10688b[_0x95ff('0x35')][_0x95ff('0x42')]){_0x4fb84b[_0x95ff('0x40')]=_[_0x95ff('0x29')](_0x4fb84b[_0x95ff('0x40')],{'$or':_['map'](_0x180751,function(_0x89bc9b){if(_0x89bc9b['type']!==_0x95ff('0x43')){var _0x5e6778={};_0x5e6778[_0x89bc9b[_0x95ff('0x26')]]={'$like':'%'+_0x10688b[_0x95ff('0x35')][_0x95ff('0x42')]+'%'};return _0x5e6778;}})});}_0x4fb84b=_[_0x95ff('0x29')]({},_0x4fb84b,_0x10688b[_0x95ff('0x44')]);var _0x84e35a={'where':_0x4fb84b[_0x95ff('0x40')]};return db[_0x95ff('0x30')][_0x95ff('0x1d')](_0x84e35a)[_0x95ff('0x23')](function(_0x56e24e){_0x3ef0f5[_0x95ff('0x1d')]=_0x56e24e;if(_0x10688b[_0x95ff('0x35')][_0x95ff('0x45')]){_0x4fb84b[_0x95ff('0x46')]=[{'all':!![]}];}return db[_0x95ff('0x30')][_0x95ff('0x47')](_0x4fb84b);})[_0x95ff('0x23')](function(_0x4245fc){_0x3ef0f5[_0x95ff('0x48')]=_0x4245fc;return _0x3ef0f5;})['then'](respondWithFilteredResult(_0x4204c3,_0x4fb84b))[_0x95ff('0x49')](handleError(_0x4204c3,null));};exports['show']=function(_0x3af177,_0x233cd1){var _0x3e2628={'raw':!![],'where':{'id':_0x3af177[_0x95ff('0x4a')]['id']}},_0x16fdff={};_0x16fdff['model']=_['keys'](db[_0x95ff('0x30')][_0x95ff('0x31')]);_0x16fdff[_0x95ff('0x35')]=_['keys'](_0x3af177[_0x95ff('0x35')]);_0x16fdff[_0x95ff('0x37')]=_[_0x95ff('0x38')](_0x16fdff['model'],_0x16fdff['query']);_0x3e2628[_0x95ff('0x39')]=_[_0x95ff('0x38')](_0x16fdff[_0x95ff('0x34')],qs[_0x95ff('0x3a')](_0x3af177[_0x95ff('0x35')][_0x95ff('0x3a')]));_0x3e2628[_0x95ff('0x39')]=_0x3e2628['attributes'][_0x95ff('0x3b')]?_0x3e2628[_0x95ff('0x39')]:_0x16fdff['model'];if(_0x3af177['query'][_0x95ff('0x45')]){_0x3e2628[_0x95ff('0x46')]=[{'all':!![]}];}_0x3e2628=_[_0x95ff('0x29')]({},_0x3e2628,_0x3af177['options']);return db[_0x95ff('0x30')][_0x95ff('0x4b')](_0x3e2628)[_0x95ff('0x23')](handleEntityNotFound(_0x233cd1,null))[_0x95ff('0x23')](respondWithResult(_0x233cd1,null))[_0x95ff('0x49')](handleError(_0x233cd1,null));};exports[_0x95ff('0x4c')]=function(_0x17f08e,_0x3d255b){return db[_0x95ff('0x30')]['create'](_0x17f08e['body'],{})[_0x95ff('0x23')](respondWithResult(_0x3d255b,0xc9))[_0x95ff('0x49')](handleError(_0x3d255b,null));};exports[_0x95ff('0x22')]=function(_0x2d7bb2,_0x40a0b2){if(_0x2d7bb2[_0x95ff('0x2a')]['id']){delete _0x2d7bb2[_0x95ff('0x2a')]['id'];}return db[_0x95ff('0x30')][_0x95ff('0x4b')]({'where':{'id':_0x2d7bb2[_0x95ff('0x4a')]['id']}})[_0x95ff('0x23')](handleEntityNotFound(_0x40a0b2,null))[_0x95ff('0x23')](saveUpdates(_0x2d7bb2[_0x95ff('0x2a')],null))[_0x95ff('0x23')](respondWithResult(_0x40a0b2,null))['catch'](handleError(_0x40a0b2,null));};exports[_0x95ff('0x24')]=function(_0x334ada,_0x41a52c){return db[_0x95ff('0x30')][_0x95ff('0x4b')]({'where':{'id':_0x334ada[_0x95ff('0x4a')]['id']}})[_0x95ff('0x23')](handleEntityNotFound(_0x41a52c,null))[_0x95ff('0x23')](removeEntity(_0x41a52c,null))[_0x95ff('0x49')](handleError(_0x41a52c,null));};exports[_0x95ff('0x4d')]=function(_0x5d4da1,_0x4b4700){return db['JscriptySessionReport'][_0x95ff('0x4d')]()[_0x95ff('0x23')](respondWithResult(_0x4b4700,null))['catch'](handleError(_0x4b4700,null));};exports['getQuestions']=function(_0x20730c,_0x4b05d7,_0x17a70d){var _0x41298f={'raw':!![],'where':{}};var _0x79b691={};var _0x4a2779={'count':0x0,'rows':[]};return db[_0x95ff('0x30')][_0x95ff('0x4e')]({'where':{'id':_0x20730c['params']['id']}})['then'](handleEntityNotFound(_0x4b05d7,null))['then'](function(_0x5da81d){if(_0x5da81d){_0x79b691['model']=_[_0x95ff('0x36')](db[_0x95ff('0x4f')][_0x95ff('0x31')]);_0x79b691[_0x95ff('0x35')]=_[_0x95ff('0x36')](_0x20730c['query']);_0x79b691[_0x95ff('0x37')]=_[_0x95ff('0x38')](_0x79b691[_0x95ff('0x34')],_0x79b691[_0x95ff('0x35')]);_0x41298f[_0x95ff('0x39')]=_[_0x95ff('0x38')](_0x79b691[_0x95ff('0x34')],qs[_0x95ff('0x3a')](_0x20730c[_0x95ff('0x35')]['fields']));_0x41298f[_0x95ff('0x39')]=_0x41298f['attributes'][_0x95ff('0x3b')]?_0x41298f[_0x95ff('0x39')]:_0x79b691[_0x95ff('0x34')];if(!_0x20730c[_0x95ff('0x35')][_0x95ff('0x3c')](_0x95ff('0x3d'))){_0x41298f[_0x95ff('0x1b')]=qs['limit'](_0x20730c[_0x95ff('0x35')][_0x95ff('0x1b')]);_0x41298f[_0x95ff('0x1a')]=qs[_0x95ff('0x1a')](_0x20730c['query']['offset']);}_0x41298f[_0x95ff('0x3e')]=qs[_0x95ff('0x3f')](_0x20730c[_0x95ff('0x35')][_0x95ff('0x3f')]);_0x41298f[_0x95ff('0x40')]=qs[_0x95ff('0x37')](_[_0x95ff('0x41')](_0x20730c[_0x95ff('0x35')],_0x79b691[_0x95ff('0x37')]));_0x41298f[_0x95ff('0x40')][_0x95ff('0x50')]=_0x5da81d['id'];if(_0x20730c[_0x95ff('0x35')]['filter']){_0x41298f[_0x95ff('0x40')]=_[_0x95ff('0x29')](_0x41298f[_0x95ff('0x40')],{'$or':_[_0x95ff('0x2f')](_0x41298f[_0x95ff('0x39')],function(_0x1362e3){var _0x1ab897={};_0x1ab897[_0x1362e3]={'$like':'%'+_0x20730c['query'][_0x95ff('0x42')]+'%'};return _0x1ab897;})});}_0x41298f=_['merge']({},_0x41298f,_0x20730c['options']);return db[_0x95ff('0x4f')][_0x95ff('0x1d')]({'where':_0x41298f['where']})[_0x95ff('0x23')](function(_0xbfa624){_0x4a2779[_0x95ff('0x1d')]=_0xbfa624;if(_0x20730c[_0x95ff('0x35')][_0x95ff('0x45')]){_0x41298f[_0x95ff('0x46')]=[{'all':!![]}];}return db[_0x95ff('0x4f')][_0x95ff('0x47')](_0x41298f);})[_0x95ff('0x23')](function(_0x488f91){_0x4a2779['rows']=_0x488f91;return _0x4a2779;});}})[_0x95ff('0x23')](respondWithFilteredResult(_0x4b05d7,_0x41298f))[_0x95ff('0x49')](handleError(_0x4b05d7,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 13f57e3..d3b0462 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 _0xaecd=['../../config/environment','./jscriptySessionReport.attributes','define','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x3a8af2,_0x261d9e){var _0x5ab34e=function(_0x163324){while(--_0x163324){_0x3a8af2['push'](_0x3a8af2['shift']());}};_0x5ab34e(++_0x261d9e);}(_0xaecd,0x1bc));var _0xdaec=function(_0x2bc9c8,_0x37e54f){_0x2bc9c8=_0x2bc9c8-0x0;var _0x3003c0=_0xaecd[_0x2bc9c8];return _0x3003c0;};'use strict';var _=require('lodash');var util=require(_0xdaec('0x0'));var logger=require(_0xdaec('0x1'))(_0xdaec('0x2'));var moment=require(_0xdaec('0x3'));var BPromise=require(_0xdaec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdaec('0x5'));var config=require(_0xdaec('0x6'));var attributes=require(_0xdaec('0x7'));module['exports']=function(_0x1ec1f6,_0x33ea5c){return _0x1ec1f6[_0xdaec('0x8')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc562=['path','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger','api','bluebird','request-promise'];(function(_0x492b1c,_0x58840e){var _0xfd2d4c=function(_0x468aa){while(--_0x468aa){_0x492b1c['push'](_0x492b1c['shift']());}};_0xfd2d4c(++_0x58840e);}(_0xc562,0x1e7));var _0x2c56=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0xc562[_0x4b73a2];return _0x383c66;};'use strict';var _=require('lodash');var util=require(_0x2c56('0x0'));var logger=require(_0x2c56('0x1'))(_0x2c56('0x2'));var moment=require('moment');var BPromise=require(_0x2c56('0x3'));var rp=require(_0x2c56('0x4'));var fs=require('fs');var path=require(_0x2c56('0x5'));var rimraf=require(_0x2c56('0x6'));var config=require('../../config/environment');var attributes=require(_0x2c56('0x7'));module[_0x2c56('0x8')]=function(_0x5c3d2c,_0xcbc6ed){return _0x5c3d2c[_0x2c56('0x9')](_0x2c56('0xa'),attributes,{'tableName':_0x2c56('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index fb730a5..d556a4e 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 _0x008d=['then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x008d,0x9b));var _0xd008=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x008d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd008('0x0'));var util=require(_0xd008('0x1'));var moment=require(_0xd008('0x2'));var BPromise=require(_0xd008('0x3'));var rs=require(_0xd008('0x4'));var fs=require('fs');var Redis=require(_0xd008('0x5'));var db=require(_0xd008('0x6'))['db'];var utils=require(_0xd008('0x7'));var logger=require(_0xd008('0x8'))('rpc');var config=require(_0xd008('0x9'));var jayson=require(_0xd008('0xa'));var client=jayson[_0xd008('0xb')][_0xd008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x367e24,_0x376da2,_0xca4961){return new BPromise(function(_0xa4df7d,_0x1f6a6d){return client['request'](_0x367e24,_0xca4961)[_0xd008('0xd')](function(_0x4fc9bb){logger[_0xd008('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x376da2,_0xd008('0xf'));logger[_0xd008('0x10')](_0xd008('0x11'),_0x376da2,'request\x20sent',JSON['stringify'](_0x4fc9bb));if(_0x4fc9bb[_0xd008('0x12')]){if(_0x4fc9bb[_0xd008('0x12')][_0xd008('0x13')]===0x1f4){logger[_0xd008('0x12')](_0xd008('0x14'),_0x376da2,_0x4fc9bb['error'][_0xd008('0x15')]);return _0x1f6a6d(_0x4fc9bb[_0xd008('0x12')][_0xd008('0x15')]);}logger[_0xd008('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x376da2,_0x4fc9bb[_0xd008('0x12')][_0xd008('0x15')]);return _0xa4df7d(_0x4fc9bb[_0xd008('0x12')][_0xd008('0x15')]);}else{logger[_0xd008('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x376da2,'request\x20sent');_0xa4df7d(_0x4fc9bb[_0xd008('0x16')][_0xd008('0x15')]);}})[_0xd008('0x17')](function(_0x1836af){logger[_0xd008('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x376da2,_0x1836af);_0x1f6a6d(_0x1836af);});});} \ No newline at end of file +var _0x0d2a=['JscriptySessionReport,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x33f3eb,_0x3e37ee){var _0x7d9105=function(_0xe27ea){while(--_0xe27ea){_0x33f3eb['push'](_0x33f3eb['shift']());}};_0x7d9105(++_0x3e37ee);}(_0x0d2a,0x1e6));var _0xa0d2=function(_0x4f1b45,_0x557296){_0x4f1b45=_0x4f1b45-0x0;var _0x459c65=_0x0d2a[_0x4f1b45];return _0x459c65;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa0d2('0x0'));var BPromise=require(_0xa0d2('0x1'));var rs=require(_0xa0d2('0x2'));var fs=require('fs');var Redis=require(_0xa0d2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0d2('0x4'));var logger=require(_0xa0d2('0x5'))(_0xa0d2('0x6'));var config=require(_0xa0d2('0x7'));var jayson=require(_0xa0d2('0x8'));var client=jayson[_0xa0d2('0x9')][_0xa0d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b8bc5,_0x586a64,_0x1fd15b){return new BPromise(function(_0x222209,_0x1b30a7){return client['request'](_0x1b8bc5,_0x1fd15b)[_0xa0d2('0xb')](function(_0x39e731){logger[_0xa0d2('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x586a64,'request\x20sent');logger[_0xa0d2('0xd')](_0xa0d2('0xe'),_0x586a64,_0xa0d2('0xf'),JSON['stringify'](_0x39e731));if(_0x39e731[_0xa0d2('0x10')]){if(_0x39e731[_0xa0d2('0x10')]['code']===0x1f4){logger[_0xa0d2('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x586a64,_0x39e731[_0xa0d2('0x10')][_0xa0d2('0x11')]);return _0x1b30a7(_0x39e731[_0xa0d2('0x10')][_0xa0d2('0x11')]);}logger[_0xa0d2('0x10')](_0xa0d2('0x12'),_0x586a64,_0x39e731[_0xa0d2('0x10')][_0xa0d2('0x11')]);return _0x222209(_0x39e731['error'][_0xa0d2('0x11')]);}else{logger[_0xa0d2('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x586a64,_0xa0d2('0xf'));_0x222209(_0x39e731[_0xa0d2('0x13')][_0xa0d2('0x11')]);}})[_0xa0d2('0x14')](function(_0x23c2f9){logger[_0xa0d2('0x10')](_0xa0d2('0x12'),_0x586a64,_0x23c2f9);_0x1b30a7(_0x23c2f9);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 35978ce..51c714b 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 _0x0cc3=['../../components/interaction/service','../../config/environment','get','index','put','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5e03d4,_0x319d4a){var _0x344905=function(_0x24c26f){while(--_0x24c26f){_0x5e03d4['push'](_0x5e03d4['shift']());}};_0x344905(++_0x319d4a);}(_0x0cc3,0x1d4));var _0x30cc=function(_0x591472,_0x3d5935){_0x591472=_0x591472-0x0;var _0x381d72=_0x0cc3[_0x591472];return _0x381d72;};'use strict';var multer=require(_0x30cc('0x0'));var util=require(_0x30cc('0x1'));var path=require(_0x30cc('0x2'));var timeout=require(_0x30cc('0x3'));var express=require(_0x30cc('0x4'));var router=express[_0x30cc('0x5')]();var fs_extra=require(_0x30cc('0x6'));var auth=require(_0x30cc('0x7'));var interaction=require(_0x30cc('0x8'));var config=require(_0x30cc('0x9'));var controller=require('./license.controller');router[_0x30cc('0xa')]('/',controller[_0x30cc('0xb')]);router[_0x30cc('0xc')](_0x30cc('0xd'),auth[_0x30cc('0xe')](),controller[_0x30cc('0xf')]);module[_0x30cc('0x10')]=router; \ No newline at end of file +var _0x9a4c=['./license.controller','get','index','/:id','isAuthenticated','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x15b02e,_0x251144){var _0x7e35a1=function(_0x2420a5){while(--_0x2420a5){_0x15b02e['push'](_0x15b02e['shift']());}};_0x7e35a1(++_0x251144);}(_0x9a4c,0x110));var _0xc9a4=function(_0x357025,_0x53285f){_0x357025=_0x357025-0x0;var _0x56d378=_0x9a4c[_0x357025];return _0x56d378;};'use strict';var multer=require(_0xc9a4('0x0'));var util=require(_0xc9a4('0x1'));var path=require(_0xc9a4('0x2'));var timeout=require(_0xc9a4('0x3'));var express=require(_0xc9a4('0x4'));var router=express['Router']();var fs_extra=require(_0xc9a4('0x5'));var auth=require(_0xc9a4('0x6'));var interaction=require(_0xc9a4('0x7'));var config=require('../../config/environment');var controller=require(_0xc9a4('0x8'));router[_0xc9a4('0x9')]('/',controller[_0xc9a4('0xa')]);router['put'](_0xc9a4('0xb'),auth[_0xc9a4('0xc')](),controller[_0xc9a4('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 8b5cb3f..acf5197 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 _0xda19=['exports','TEXT','STRING'];(function(_0x468310,_0x699f87){var _0x2cf691=function(_0x2f6b4f){while(--_0x2f6b4f){_0x468310['push'](_0x468310['shift']());}};_0x2cf691(++_0x699f87);}(_0xda19,0xd5));var _0x9da1=function(_0x158098,_0x5488fb){_0x158098=_0x158098-0x0;var _0x2064c6=_0xda19[_0x158098];return _0x2064c6;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'license':{'type':Sequelize[_0x9da1('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x9da1('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1cb9=['STRING','INTEGER','sequelize','TEXT'];(function(_0x3f75ab,_0x3b8a71){var _0x1d8fdb=function(_0x170f4d){while(--_0x170f4d){_0x3f75ab['push'](_0x3f75ab['shift']());}};_0x1d8fdb(++_0x3b8a71);}(_0x1cb9,0x14e));var _0x91cb=function(_0x43eeed,_0x4dfb8b){_0x43eeed=_0x43eeed-0x0;var _0x21e6c4=_0x1cb9[_0x43eeed];return _0x21e6c4;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'license':{'type':Sequelize[_0x91cb('0x1')]},'data1':{'type':Sequelize[_0x91cb('0x2')]},'data2':{'type':Sequelize[_0x91cb('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x91cb('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 a81283a..746b129 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 _0xa35a=['query','keys','filters','model','attributes','intersection','fields','length','options','getLicense','catch','body','find','get','checkLicense','key','demo','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','merge','contact','message','agent','account','License','rawAttributes'];(function(_0x24236e,_0x113457){var _0x32d154=function(_0x432f49){while(--_0x432f49){_0x24236e['push'](_0x24236e['shift']());}};_0x32d154(++_0x113457);}(_0xa35a,0x97));var _0xaa35=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0xa35a[_0x476bf4];return _0x788ffe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa35('0x0'));var zipdir=require(_0xaa35('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa35('0x2'));var moment=require('moment');var BPromise=require(_0xaa35('0x3'));var Mustache=require(_0xaa35('0x4'));var util=require('util');var path=require(_0xaa35('0x5'));var sox=require(_0xaa35('0x6'));var csv=require(_0xaa35('0x7'));var ejs=require(_0xaa35('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa35('0x9'));var squel=require(_0xaa35('0xa'));var crypto=require(_0xaa35('0xb'));var jsforce=require(_0xaa35('0xc'));var deskjs=require(_0xaa35('0xd'));var toCsv=require(_0xaa35('0x7'));var querystring=require(_0xaa35('0xe'));var Papa=require('papaparse');var Redis=require(_0xaa35('0xf'));var authService=require(_0xaa35('0x10'));var qs=require(_0xaa35('0x11'));var as=require(_0xaa35('0x12'));var hardwareService=require(_0xaa35('0x13'));var logger=require('../../config/logger')(_0xaa35('0x14'));var utils=require(_0xaa35('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xaa35('0x16'));var db=require(_0xaa35('0x17'))['db'];function respondWithStatusCode(_0x32e723,_0x3142cc){_0x3142cc=_0x3142cc||0xcc;return function(_0x5c89a5){if(_0x5c89a5){return _0x32e723[_0xaa35('0x18')](_0x3142cc);}return _0x32e723[_0xaa35('0x19')](_0x3142cc)[_0xaa35('0x1a')]();};}function respondWithResult(_0x33cc16,_0x2df582){_0x2df582=_0x2df582||0xc8;return function(_0x454490){if(_0x454490){return _0x33cc16[_0xaa35('0x19')](_0x2df582)[_0xaa35('0x1b')](_0x454490);}};}function respondWithFilteredResult(_0x4a63a3,_0x2cd6be){return function(_0x14e89d){if(_0x14e89d){var _0x546eae=typeof _0x2cd6be[_0xaa35('0x1c')]==='undefined'&&typeof _0x2cd6be[_0xaa35('0x1d')]===_0xaa35('0x1e');var _0x3243f8=_0x14e89d['count'];var _0x545d81=_0x546eae?0x0:_0x2cd6be[_0xaa35('0x1c')];var _0x18d0e0=_0x546eae?_0x14e89d['count']:_0x2cd6be[_0xaa35('0x1c')]+_0x2cd6be['limit'];var _0x57f319;if(_0x18d0e0>=_0x3243f8){_0x18d0e0=_0x3243f8;_0x57f319=0xc8;}else{_0x57f319=0xce;}_0x4a63a3['status'](_0x57f319);return _0x4a63a3[_0xaa35('0x1f')](_0xaa35('0x20'),_0x545d81+'-'+_0x18d0e0+'/'+_0x3243f8)['json'](_0x14e89d);}return null;};}function patchUpdates(_0x21fe0b){return function(_0x4d7667){try{jsonpatch[_0xaa35('0x21')](_0x4d7667,_0x21fe0b,!![]);}catch(_0xe861d6){return BPromise[_0xaa35('0x22')](_0xe861d6);}return _0x4d7667[_0xaa35('0x23')]();};}function saveUpdates(_0x5043f1,_0x3240ba){return function(_0x1b0be5){if(_0x1b0be5){return _0x1b0be5[_0xaa35('0x24')](_0x5043f1)[_0xaa35('0x25')](function(_0x48ff45){return _0x48ff45;});}return null;};}function removeEntity(_0x18e0d8,_0x4ff692){return function(_0x176179){if(_0x176179){return _0x176179[_0xaa35('0x26')]()[_0xaa35('0x25')](function(){_0x18e0d8['status'](0xcc)[_0xaa35('0x1a')]();});}};}function handleEntityNotFound(_0x1fb797,_0x38bd9d){return function(_0x448e83){if(!_0x448e83){_0x1fb797[_0xaa35('0x18')](0x194);}return _0x448e83;};}function handleError(_0xaff6db,_0x1afd07){_0x1afd07=_0x1afd07||0x1f4;return function(_0x7743dc){logger[_0xaa35('0x27')](_0x7743dc[_0xaa35('0x28')]);if(_0x7743dc['name']){delete _0x7743dc[_0xaa35('0x29')];}_0xaff6db[_0xaa35('0x19')](_0x1afd07)[_0xaa35('0x2a')](_0x7743dc);};}function getMustacheRender(_0x490913,_0x212fac){return Mustache['render'](_0x490913,_[_0xaa35('0x2b')](_0x212fac['body'],{'contact':_0x212fac[_0xaa35('0x2c')],'message':_0x212fac[_0xaa35('0x2d')],'agent':_0x212fac[_0xaa35('0x2e')],'interaction':_0x212fac['interaction'],'account':_0x212fac[_0xaa35('0x2f')]}))||'';}var utilLicense=require(_0xaa35('0x16'));exports['index']=function(_0xf6f497,_0xfd35b0){var _0x1d3a0a={'raw':!![],'where':{'id':0x1}},_0x559176={};_0x559176['model']=_['keys'](db[_0xaa35('0x30')][_0xaa35('0x31')]);_0x559176[_0xaa35('0x32')]=_[_0xaa35('0x33')](_0xf6f497['query']);_0x559176[_0xaa35('0x34')]=_['intersection'](_0x559176[_0xaa35('0x35')],_0x559176['query']);_0x1d3a0a[_0xaa35('0x36')]=_[_0xaa35('0x37')](_0x559176[_0xaa35('0x35')],qs[_0xaa35('0x38')](_0xf6f497[_0xaa35('0x32')]['fields']));_0x1d3a0a[_0xaa35('0x36')]=_0x1d3a0a[_0xaa35('0x36')][_0xaa35('0x39')]?_0x1d3a0a['attributes']:_0x559176[_0xaa35('0x35')];_0x1d3a0a=_['merge']({},_0x1d3a0a,_0xf6f497[_0xaa35('0x3a')]);return utilLicense[_0xaa35('0x3b')](_0x1d3a0a)[_0xaa35('0x25')](respondWithResult(_0xfd35b0,null))[_0xaa35('0x3c')](handleError(_0xfd35b0,null));};exports[_0xaa35('0x24')]=function(_0x4fb841,_0x30eeec){if(_0x4fb841['body']['id']){delete _0x4fb841[_0xaa35('0x3d')]['id'];}return db[_0xaa35('0x30')][_0xaa35('0x3e')]({'where':{'id':_0x4fb841['params']['id']}})['then'](handleEntityNotFound(_0x30eeec,null))[_0xaa35('0x25')](function(_0x5ac303){var _0x11eac9=_0x5ac303[_0xaa35('0x3f')]({'plain':!![]});return utilLicense[_0xaa35('0x40')](_0x11eac9,_0x4fb841[_0xaa35('0x3d')][_0xaa35('0x41')]);})[_0xaa35('0x25')](function(_0x310b80){if(!_0x310b80[_0xaa35('0x42')]){return saveUpdates(_0x4fb841[_0xaa35('0x3d')],null);}return _0x310b80;})['then'](respondWithResult(_0x30eeec,null))[_0xaa35('0x3c')](handleError(_0x30eeec,null));}; \ No newline at end of file +var _0x6c7b=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','error','stack','name','send','render','merge','agent','interaction','account','index','model','License','rawAttributes','query','keys','intersection','attributes','length','options','catch','body','find','params','get','checkLicense','key','demo','eml-format','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x320cb3,_0x49c0cf){var _0x899c86=function(_0x9fc8f){while(--_0x9fc8f){_0x320cb3['push'](_0x320cb3['shift']());}};_0x899c86(++_0x49c0cf);}(_0x6c7b,0x129));var _0xb6c7=function(_0x150e5c,_0xfe2869){_0x150e5c=_0x150e5c-0x0;var _0x96300a=_0x6c7b[_0x150e5c];return _0x96300a;};'use strict';var emlformat=require(_0xb6c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb6c7('0x1'));var BPromise=require(_0xb6c7('0x2'));var Mustache=require(_0xb6c7('0x3'));var util=require('util');var path=require(_0xb6c7('0x4'));var sox=require(_0xb6c7('0x5'));var csv=require(_0xb6c7('0x6'));var ejs=require(_0xb6c7('0x7'));var fs=require('fs');var fs_extra=require(_0xb6c7('0x8'));var _=require(_0xb6c7('0x9'));var squel=require(_0xb6c7('0xa'));var crypto=require('crypto');var jsforce=require(_0xb6c7('0xb'));var deskjs=require(_0xb6c7('0xc'));var toCsv=require(_0xb6c7('0x6'));var querystring=require(_0xb6c7('0xd'));var Papa=require(_0xb6c7('0xe'));var Redis=require(_0xb6c7('0xf'));var authService=require(_0xb6c7('0x10'));var qs=require(_0xb6c7('0x11'));var as=require(_0xb6c7('0x12'));var hardwareService=require(_0xb6c7('0x13'));var logger=require(_0xb6c7('0x14'))(_0xb6c7('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb6c7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cc045,_0x425e89){_0x425e89=_0x425e89||0xcc;return function(_0x1ec6c2){if(_0x1ec6c2){return _0x1cc045[_0xb6c7('0x17')](_0x425e89);}return _0x1cc045[_0xb6c7('0x18')](_0x425e89)['end']();};}function respondWithResult(_0x14f004,_0x536e95){_0x536e95=_0x536e95||0xc8;return function(_0x5ae219){if(_0x5ae219){return _0x14f004['status'](_0x536e95)[_0xb6c7('0x19')](_0x5ae219);}};}function respondWithFilteredResult(_0x2d07c4,_0x4e44e9){return function(_0x2ac46c){if(_0x2ac46c){var _0x3c304d=typeof _0x4e44e9[_0xb6c7('0x1a')]===_0xb6c7('0x1b')&&typeof _0x4e44e9['limit']===_0xb6c7('0x1b');var _0x2e2075=_0x2ac46c[_0xb6c7('0x1c')];var _0x13eb22=_0x3c304d?0x0:_0x4e44e9['offset'];var _0x193aa9=_0x3c304d?_0x2ac46c[_0xb6c7('0x1c')]:_0x4e44e9[_0xb6c7('0x1a')]+_0x4e44e9['limit'];var _0x3f3217;if(_0x193aa9>=_0x2e2075){_0x193aa9=_0x2e2075;_0x3f3217=0xc8;}else{_0x3f3217=0xce;}_0x2d07c4[_0xb6c7('0x18')](_0x3f3217);return _0x2d07c4[_0xb6c7('0x1d')](_0xb6c7('0x1e'),_0x13eb22+'-'+_0x193aa9+'/'+_0x2e2075)[_0xb6c7('0x19')](_0x2ac46c);}return null;};}function patchUpdates(_0x5da0d0){return function(_0x152afe){try{jsonpatch['apply'](_0x152afe,_0x5da0d0,!![]);}catch(_0x3a54ce){return BPromise[_0xb6c7('0x1f')](_0x3a54ce);}return _0x152afe[_0xb6c7('0x20')]();};}function saveUpdates(_0x4929e9,_0x5f004c){return function(_0x28ed22){if(_0x28ed22){return _0x28ed22[_0xb6c7('0x21')](_0x4929e9)[_0xb6c7('0x22')](function(_0x3d5728){return _0x3d5728;});}return null;};}function removeEntity(_0x3efe97,_0xd24b4f){return function(_0x576726){if(_0x576726){return _0x576726['destroy']()['then'](function(){_0x3efe97[_0xb6c7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1843db,_0x17b222){return function(_0x3d2b32){if(!_0x3d2b32){_0x1843db[_0xb6c7('0x17')](0x194);}return _0x3d2b32;};}function handleError(_0x195ee8,_0x498f1d){_0x498f1d=_0x498f1d||0x1f4;return function(_0x3980ee){logger[_0xb6c7('0x23')](_0x3980ee[_0xb6c7('0x24')]);if(_0x3980ee[_0xb6c7('0x25')]){delete _0x3980ee[_0xb6c7('0x25')];}_0x195ee8['status'](_0x498f1d)[_0xb6c7('0x26')](_0x3980ee);};}function getMustacheRender(_0xc8f1,_0x4fb882){return Mustache[_0xb6c7('0x27')](_0xc8f1,_[_0xb6c7('0x28')](_0x4fb882['body'],{'contact':_0x4fb882['contact'],'message':_0x4fb882['message'],'agent':_0x4fb882[_0xb6c7('0x29')],'interaction':_0x4fb882[_0xb6c7('0x2a')],'account':_0x4fb882[_0xb6c7('0x2b')]}))||'';}var utilLicense=require(_0xb6c7('0x16'));exports[_0xb6c7('0x2c')]=function(_0x163ce1,_0x20da14){var _0x15dc3d={'raw':!![],'where':{'id':0x1}},_0x117535={};_0x117535[_0xb6c7('0x2d')]=_['keys'](db[_0xb6c7('0x2e')][_0xb6c7('0x2f')]);_0x117535[_0xb6c7('0x30')]=_[_0xb6c7('0x31')](_0x163ce1[_0xb6c7('0x30')]);_0x117535['filters']=_[_0xb6c7('0x32')](_0x117535[_0xb6c7('0x2d')],_0x117535[_0xb6c7('0x30')]);_0x15dc3d[_0xb6c7('0x33')]=_[_0xb6c7('0x32')](_0x117535[_0xb6c7('0x2d')],qs['fields'](_0x163ce1[_0xb6c7('0x30')]['fields']));_0x15dc3d[_0xb6c7('0x33')]=_0x15dc3d[_0xb6c7('0x33')][_0xb6c7('0x34')]?_0x15dc3d[_0xb6c7('0x33')]:_0x117535[_0xb6c7('0x2d')];_0x15dc3d=_['merge']({},_0x15dc3d,_0x163ce1[_0xb6c7('0x35')]);return utilLicense['getLicense'](_0x15dc3d)[_0xb6c7('0x22')](respondWithResult(_0x20da14,null))[_0xb6c7('0x36')](handleError(_0x20da14,null));};exports[_0xb6c7('0x21')]=function(_0x4e7ee3,_0x4002d9){if(_0x4e7ee3['body']['id']){delete _0x4e7ee3[_0xb6c7('0x37')]['id'];}return db['License'][_0xb6c7('0x38')]({'where':{'id':_0x4e7ee3[_0xb6c7('0x39')]['id']}})['then'](handleEntityNotFound(_0x4002d9,null))[_0xb6c7('0x22')](function(_0x4d325f){var _0x1a6a2d=_0x4d325f[_0xb6c7('0x3a')]({'plain':!![]});return utilLicense[_0xb6c7('0x3b')](_0x1a6a2d,_0x4e7ee3['body'][_0xb6c7('0x3c')]);})[_0xb6c7('0x22')](function(_0x2e43a9){if(!_0x2e43a9[_0xb6c7('0x3d')]){return saveUpdates(_0x4e7ee3[_0xb6c7('0x37')],null);}return _0x2e43a9;})['then'](respondWithResult(_0x4002d9,null))[_0xb6c7('0x36')](handleError(_0x4002d9,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 2d5b119..21718c9 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 _0x7f47=['exports','License','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./license.attributes'];(function(_0x39479f,_0x822ae4){var _0x4a6d96=function(_0x55bfba){while(--_0x55bfba){_0x39479f['push'](_0x39479f['shift']());}};_0x4a6d96(++_0x822ae4);}(_0x7f47,0x12e));var _0x77f4=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0x7f47[_0x118139];return _0x2fece9;};'use strict';var _=require(_0x77f4('0x0'));var util=require(_0x77f4('0x1'));var logger=require(_0x77f4('0x2'))(_0x77f4('0x3'));var moment=require(_0x77f4('0x4'));var BPromise=require(_0x77f4('0x5'));var rp=require(_0x77f4('0x6'));var fs=require('fs');var path=require(_0x77f4('0x7'));var rimraf=require('rimraf');var config=require(_0x77f4('0x8'));var attributes=require(_0x77f4('0x9'));module[_0x77f4('0xa')]=function(_0x5f0951,_0x2cfdcf){return _0x5f0951['define'](_0x77f4('0xb'),attributes,{'tableName':_0x77f4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcea5=['api','moment','request-promise','path','rimraf','../../config/environment','exports','lodash','util','../../config/logger'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xcea5,0xed));var _0x5cea=function(_0x3fea74,_0x4f224d){_0x3fea74=_0x3fea74-0x0;var _0x64b8f0=_0xcea5[_0x3fea74];return _0x64b8f0;};'use strict';var _=require(_0x5cea('0x0'));var util=require(_0x5cea('0x1'));var logger=require(_0x5cea('0x2'))(_0x5cea('0x3'));var moment=require(_0x5cea('0x4'));var BPromise=require('bluebird');var rp=require(_0x5cea('0x5'));var fs=require('fs');var path=require(_0x5cea('0x6'));var rimraf=require(_0x5cea('0x7'));var config=require(_0x5cea('0x8'));var attributes=require('./license.attributes');module[_0x5cea('0x9')]=function(_0x31e6f3,_0x599bc5){return _0x31e6f3['define']('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 42935e2..98e9b13 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 _0x98b7=['message','info','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x378569,_0x5073e8){var _0x48acea=function(_0x12479c){while(--_0x12479c){_0x378569['push'](_0x378569['shift']());}};_0x48acea(++_0x5073e8);}(_0x98b7,0xc1));var _0x798b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x98b7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x798b('0x0'));var util=require(_0x798b('0x1'));var moment=require(_0x798b('0x2'));var BPromise=require(_0x798b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x798b('0x4'));var logger=require(_0x798b('0x5'))(_0x798b('0x6'));var config=require(_0x798b('0x7'));var jayson=require(_0x798b('0x8'));var client=jayson['client'][_0x798b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d70b2,_0x2b904b,_0xbf4c6c){return new BPromise(function(_0x3fb4de,_0x14994d){return client[_0x798b('0xa')](_0x5d70b2,_0xbf4c6c)['then'](function(_0x24b028){logger['info'](_0x798b('0xb'),_0x2b904b,'request\x20sent');logger[_0x798b('0xc')](_0x798b('0xd'),_0x2b904b,_0x798b('0xe'),JSON['stringify'](_0x24b028));if(_0x24b028['error']){if(_0x24b028[_0x798b('0xf')][_0x798b('0x10')]===0x1f4){logger[_0x798b('0xf')]('License,\x20%s,\x20%s',_0x2b904b,_0x24b028[_0x798b('0xf')]['message']);return _0x14994d(_0x24b028[_0x798b('0xf')]['message']);}logger[_0x798b('0xf')](_0x798b('0xb'),_0x2b904b,_0x24b028[_0x798b('0xf')][_0x798b('0x11')]);return _0x3fb4de(_0x24b028[_0x798b('0xf')][_0x798b('0x11')]);}else{logger[_0x798b('0x12')]('License,\x20%s,\x20%s',_0x2b904b,'request\x20sent');_0x3fb4de(_0x24b028[_0x798b('0x13')][_0x798b('0x11')]);}})[_0x798b('0x14')](function(_0x19b15c){logger[_0x798b('0xf')](_0x798b('0xb'),_0x2b904b,_0x19b15c);_0x14994d(_0x19b15c);});});} \ No newline at end of file +var _0x21f8=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x21f8,0x71));var _0x821f=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0x21f8[_0x1ff575];return _0x48fc9e;};'use strict';var _=require(_0x821f('0x0'));var util=require(_0x821f('0x1'));var moment=require(_0x821f('0x2'));var BPromise=require(_0x821f('0x3'));var rs=require(_0x821f('0x4'));var fs=require('fs');var Redis=require(_0x821f('0x5'));var db=require(_0x821f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x821f('0x7'));var jayson=require(_0x821f('0x8'));var client=jayson[_0x821f('0x9')][_0x821f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cd13a,_0x3a42fe,_0x1b9945){return new BPromise(function(_0xfcb0a,_0x4e260d){return client['request'](_0x3cd13a,_0x1b9945)[_0x821f('0xb')](function(_0x15b547){logger[_0x821f('0xc')]('License,\x20%s,\x20%s',_0x3a42fe,_0x821f('0xd'));logger[_0x821f('0xe')](_0x821f('0xf'),_0x3a42fe,_0x821f('0xd'),JSON[_0x821f('0x10')](_0x15b547));if(_0x15b547[_0x821f('0x11')]){if(_0x15b547[_0x821f('0x11')][_0x821f('0x12')]===0x1f4){logger[_0x821f('0x11')](_0x821f('0x13'),_0x3a42fe,_0x15b547['error']['message']);return _0x4e260d(_0x15b547[_0x821f('0x11')][_0x821f('0x14')]);}logger[_0x821f('0x11')](_0x821f('0x13'),_0x3a42fe,_0x15b547[_0x821f('0x11')][_0x821f('0x14')]);return _0xfcb0a(_0x15b547[_0x821f('0x11')][_0x821f('0x14')]);}else{logger[_0x821f('0xc')](_0x821f('0x13'),_0x3a42fe,'request\x20sent');_0xfcb0a(_0x15b547[_0x821f('0x15')]['message']);}})[_0x821f('0x16')](function(_0x497c37){logger[_0x821f('0x11')](_0x821f('0x13'),_0x3a42fe,_0x497c37);_0x4e260d(_0x497c37);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index b13b79c..e293a52 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 _0xdd14=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','isAuthenticated','get','describe','/:id','show','getDispositions','/:id/canned_answers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addAnswer','create','/:id/in_servers','addImap','/:id/applications','addApplications','send','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xdd14,0x1ef));var _0x4dd1=function(_0x4e234a,_0x302a07){_0x4e234a=_0x4e234a-0x0;var _0x272aa0=_0xdd14[_0x4e234a];return _0x272aa0;};'use strict';var multer=require('multer');var util=require(_0x4dd1('0x0'));var path=require(_0x4dd1('0x1'));var timeout=require(_0x4dd1('0x2'));var express=require(_0x4dd1('0x3'));var router=express[_0x4dd1('0x4')]();var fs_extra=require(_0x4dd1('0x5'));var auth=require(_0x4dd1('0x6'));var interaction=require(_0x4dd1('0x7'));var config=require('../../config/environment');var controller=require(_0x4dd1('0x8'));router['get']('/',auth[_0x4dd1('0x9')](),controller['index']);router[_0x4dd1('0xa')]('/describe',auth[_0x4dd1('0x9')](),controller[_0x4dd1('0xb')]);router[_0x4dd1('0xa')](_0x4dd1('0xc'),auth[_0x4dd1('0x9')](),controller[_0x4dd1('0xd')]);router[_0x4dd1('0xa')]('/:id/dispositions',auth[_0x4dd1('0x9')](),controller[_0x4dd1('0xe')]);router[_0x4dd1('0xa')](_0x4dd1('0xf'),auth[_0x4dd1('0x9')](),controller['getAnswers']);router['get']('/:id/in_servers',auth[_0x4dd1('0x9')](),controller[_0x4dd1('0x10')]);router[_0x4dd1('0xa')](_0x4dd1('0x11'),auth[_0x4dd1('0x9')](),controller[_0x4dd1('0x12')]);router['get'](_0x4dd1('0x13'),auth[_0x4dd1('0x9')](),controller[_0x4dd1('0x14')]);router['get']('/:id/applications',auth[_0x4dd1('0x9')](),controller['getApplications']);router[_0x4dd1('0xa')]('/:id/messages',auth[_0x4dd1('0x9')](),controller[_0x4dd1('0x15')]);router[_0x4dd1('0xa')](_0x4dd1('0x16'),auth['isAuthenticated'](),controller[_0x4dd1('0x17')]);router[_0x4dd1('0xa')](_0x4dd1('0x18'),auth[_0x4dd1('0x9')](),controller[_0x4dd1('0x19')]);router[_0x4dd1('0x1a')](_0x4dd1('0x1b'),auth[_0x4dd1('0x9')](),controller['addDisposition']);router[_0x4dd1('0x1a')]('/:id/canned_answers',auth[_0x4dd1('0x9')](),controller[_0x4dd1('0x1c')]);router[_0x4dd1('0x1a')]('/',auth[_0x4dd1('0x9')](),controller[_0x4dd1('0x1d')]);router[_0x4dd1('0x1a')](_0x4dd1('0x1e'),auth[_0x4dd1('0x9')](),controller[_0x4dd1('0x1f')]);router[_0x4dd1('0x1a')](_0x4dd1('0x11'),auth[_0x4dd1('0x9')](),controller['addSmtp']);router[_0x4dd1('0x1a')](_0x4dd1('0x13'),auth[_0x4dd1('0x9')](),controller['addInteraction']);router['post'](_0x4dd1('0x20'),auth[_0x4dd1('0x9')](),controller[_0x4dd1('0x21')]);router['post']('/:id/send',auth[_0x4dd1('0x9')](),controller[_0x4dd1('0x22')]);router['post'](_0x4dd1('0x18'),auth[_0x4dd1('0x9')](),controller[_0x4dd1('0x23')]);router[_0x4dd1('0x24')](_0x4dd1('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4dd1('0x25')](_0x4dd1('0x1b'),auth[_0x4dd1('0x9')](),controller[_0x4dd1('0x26')]);router[_0x4dd1('0x25')](_0x4dd1('0xf'),auth[_0x4dd1('0x9')](),controller[_0x4dd1('0x27')]);router[_0x4dd1('0x25')](_0x4dd1('0x1e'),auth[_0x4dd1('0x9')](),controller[_0x4dd1('0x28')]);router['delete']('/:id/out_servers',auth[_0x4dd1('0x9')](),controller[_0x4dd1('0x29')]);router['delete'](_0x4dd1('0xc'),auth['isAuthenticated'](),controller[_0x4dd1('0x2a')]);router[_0x4dd1('0x25')](_0x4dd1('0x18'),auth[_0x4dd1('0x9')](),controller[_0x4dd1('0x2b')]);module[_0x4dd1('0x2c')]=router; \ No newline at end of file +var _0xd6ad=['/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','/:id/interactions','getApplications','/:id/messages','/:id/verify','getAgents','post','addDisposition','create','addImap','addSmtp','addApplications','/:id/send','send','/:id/users','addAgents','put','/:id','update','delete','/:id/dispositions','removeDispositions','removeImap','removeSmtp','destroy','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index'];(function(_0x33cf0d,_0x39c4ef){var _0x5d174b=function(_0x2a1d5f){while(--_0x2a1d5f){_0x33cf0d['push'](_0x33cf0d['shift']());}};_0x5d174b(++_0x39c4ef);}(_0xd6ad,0x102));var _0xdd6a=function(_0x40b66c,_0x578758){_0x40b66c=_0x40b66c-0x0;var _0x2fd22b=_0xd6ad[_0x40b66c];return _0x2fd22b;};'use strict';var multer=require(_0xdd6a('0x0'));var util=require(_0xdd6a('0x1'));var path=require(_0xdd6a('0x2'));var timeout=require(_0xdd6a('0x3'));var express=require('express');var router=express[_0xdd6a('0x4')]();var fs_extra=require(_0xdd6a('0x5'));var auth=require(_0xdd6a('0x6'));var interaction=require(_0xdd6a('0x7'));var config=require('../../config/environment');var controller=require(_0xdd6a('0x8'));router[_0xdd6a('0x9')]('/',auth[_0xdd6a('0xa')](),controller[_0xdd6a('0xb')]);router[_0xdd6a('0x9')](_0xdd6a('0xc'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0xd')]);router[_0xdd6a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdd6a('0xe')]);router[_0xdd6a('0x9')]('/:id/dispositions',auth[_0xdd6a('0xa')](),controller[_0xdd6a('0xf')]);router[_0xdd6a('0x9')](_0xdd6a('0x10'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x11')]);router['get'](_0xdd6a('0x12'),auth[_0xdd6a('0xa')](),controller['getImap']);router[_0xdd6a('0x9')](_0xdd6a('0x13'),auth[_0xdd6a('0xa')](),controller['getSmtp']);router[_0xdd6a('0x9')](_0xdd6a('0x14'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xdd6a('0x9')]('/:id/applications',auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x15')]);router['get'](_0xdd6a('0x16'),auth[_0xdd6a('0xa')](),controller['getMessages']);router[_0xdd6a('0x9')](_0xdd6a('0x17'),auth[_0xdd6a('0xa')](),controller['verifySmtp']);router[_0xdd6a('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xdd6a('0x18')]);router[_0xdd6a('0x19')]('/:id/dispositions',auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x1a')]);router[_0xdd6a('0x19')](_0xdd6a('0x10'),auth[_0xdd6a('0xa')](),controller['addAnswer']);router[_0xdd6a('0x19')]('/',auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x1b')]);router[_0xdd6a('0x19')](_0xdd6a('0x12'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x1c')]);router[_0xdd6a('0x19')](_0xdd6a('0x13'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x1d')]);router[_0xdd6a('0x19')](_0xdd6a('0x14'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xdd6a('0x19')]('/:id/applications',auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x1e')]);router[_0xdd6a('0x19')](_0xdd6a('0x1f'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x20')]);router[_0xdd6a('0x19')](_0xdd6a('0x21'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x22')]);router[_0xdd6a('0x23')](_0xdd6a('0x24'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x25')]);router[_0xdd6a('0x26')](_0xdd6a('0x27'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x28')]);router[_0xdd6a('0x26')](_0xdd6a('0x10'),auth[_0xdd6a('0xa')](),controller['removeAnswers']);router['delete'](_0xdd6a('0x12'),auth['isAuthenticated'](),controller[_0xdd6a('0x29')]);router['delete'](_0xdd6a('0x13'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x2a')]);router[_0xdd6a('0x26')](_0xdd6a('0x24'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x2b')]);router[_0xdd6a('0x26')](_0xdd6a('0x21'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x2c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 619c4fe..2e12c77 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 _0xb9e8=['INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xb9e8,0xb0));var _0x8b9e=function(_0x129216,_0x5c208d){_0x129216=_0x129216-0x0;var _0x2a0306=_0xb9e8[_0x129216];return _0x2a0306;};'use strict';var Sequelize=require(_0x8b9e('0x0'));module[_0x8b9e('0x1')]={'description':{'type':Sequelize[_0x8b9e('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x8b9e('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x8b9e('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x8b9e('0x4')]},'markAsUnread':{'type':Sequelize[_0x8b9e('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x8b9e('0x2')],'allowNull':![],'defaultValue':_0x8b9e('0x5')},'fontSize':{'type':Sequelize[_0x8b9e('0x6')](0x2)[_0x8b9e('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x8b9e('0x4')],'defaultValue':function(){return _0x8b9e('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8b9e('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8b9e('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8b9e('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8b9e('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x8b9e('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x8b9e('0x3')],'defaultValue':![],'comment':_0x8b9e('0xa'),'set':function(_0x3ee03c){if(!_0x3ee03c)this[_0x8b9e('0xb')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x8b9e('0xc'),_0x3ee03c);}}}; \ No newline at end of file +var _0xc461=['sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition'];(function(_0x6eb98e,_0x43ba66){var _0x36557a=function(_0x1a736d){while(--_0x1a736d){_0x6eb98e['push'](_0x6eb98e['shift']());}};_0x36557a(++_0x43ba66);}(_0xc461,0xd8));var _0x1c46=function(_0x443fc9,_0x24fc48){_0x443fc9=_0x443fc9-0x0;var _0x13fdb4=_0xc461[_0x443fc9];return _0x13fdb4;};'use strict';var Sequelize=require(_0x1c46('0x0'));module[_0x1c46('0x1')]={'description':{'type':Sequelize[_0x1c46('0x2')]},'name':{'type':Sequelize[_0x1c46('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x1c46('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1c46('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x1c46('0x4')]},'markAsUnread':{'type':Sequelize[_0x1c46('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x1c46('0x2')],'allowNull':![],'defaultValue':_0x1c46('0x5')},'fontSize':{'type':Sequelize[_0x1c46('0x6')](0x2)[_0x1c46('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1c46('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['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1c46('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1c46('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1c46('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1c46('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1c46('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1c46('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x1c46('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1c46('0x9'),'set':function(_0x2cbf66){if(!_0x2cbf66)this[_0x1c46('0xa')]('mandatoryDispositionPauseId',null);this[_0x1c46('0xa')](_0x1c46('0xb'),_0x2cbf66);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index a77d8eb..3409b52 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 _0xb568=['name','render','body','contact','interaction','account','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','count','includeAll','include','rows','length','params','describe','MailAccountId','create','getDispositions','findOne','pick','findAll','removeDispositions','find','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','pass','cpassword','authentication','host','port','service','password','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','getApplications','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','send','Contacts','from','format','attachments','join','root','server/files/attachments','auth','secure','sendMail','List\x20not\x20found','List','subject','attach','out','messageId','Interaction','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','json','offset','limit','status','Content-Range','apply','save','update','destroy','get','UserProfileResource','stack'];(function(_0x257a28,_0x2cd00d){var _0x13bccc=function(_0x32c46f){while(--_0x32c46f){_0x257a28['push'](_0x257a28['shift']());}};_0x13bccc(++_0x2cd00d);}(_0xb568,0x8b));var _0x8b56=function(_0x15cbf1,_0x4243a5){_0x15cbf1=_0x15cbf1-0x0;var _0x27aa81=_0xb568[_0x15cbf1];return _0x27aa81;};'use strict';var emlformat=require(_0x8b56('0x0'));var rimraf=require(_0x8b56('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b56('0x2'));var rp=require(_0x8b56('0x3'));var moment=require('moment');var BPromise=require(_0x8b56('0x4'));var Mustache=require(_0x8b56('0x5'));var util=require(_0x8b56('0x6'));var path=require(_0x8b56('0x7'));var sox=require(_0x8b56('0x8'));var csv=require(_0x8b56('0x9'));var ejs=require(_0x8b56('0xa'));var fs=require('fs');var fs_extra=require(_0x8b56('0xb'));var _=require(_0x8b56('0xc'));var squel=require(_0x8b56('0xd'));var crypto=require(_0x8b56('0xe'));var jsforce=require(_0x8b56('0xf'));var deskjs=require(_0x8b56('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8b56('0x11'));var Papa=require('papaparse');var htmlToText=require(_0x8b56('0x12'));var juice=require(_0x8b56('0x13'));var Redis=require(_0x8b56('0x14'));var authService=require(_0x8b56('0x15'));var qs=require(_0x8b56('0x16'));var as=require(_0x8b56('0x17'));var hardwareService=require(_0x8b56('0x18'));var logger=require('../../config/logger')(_0x8b56('0x19'));var utils=require(_0x8b56('0x1a'));var config=require(_0x8b56('0x1b'));var licenseUtil=require(_0x8b56('0x1c'));var db=require('../../mysqldb')['db'];config[_0x8b56('0x1d')]=_[_0x8b56('0x1e')](config[_0x8b56('0x1d')],{'host':_0x8b56('0x1f'),'port':0x18eb});var socket=require(_0x8b56('0x20'))(new Redis(config[_0x8b56('0x1d')]));require(_0x8b56('0x21'))[_0x8b56('0x22')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x3c381c,_0x442dfd,_0x53b4e1,_0x5a98f5){return new BPromise(function(_0x1e5fa5,_0x11e414){var _0x1fdadb=_0x5a98f5||client;return _0x1fdadb['request'](_0x3c381c,_0x53b4e1)[_0x8b56('0x23')](function(_0x1dca5d){logger[_0x8b56('0x24')](_0x8b56('0x25'),_0x442dfd,_0x8b56('0x26'));logger[_0x8b56('0x27')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x442dfd,_0x8b56('0x26'),JSON[_0x8b56('0x28')](_0x1dca5d));if(_0x1dca5d[_0x8b56('0x29')]){if(_0x1dca5d[_0x8b56('0x29')][_0x8b56('0x2a')]===0x1f4){logger[_0x8b56('0x29')](_0x8b56('0x25'),_0x442dfd,_0x1dca5d[_0x8b56('0x29')][_0x8b56('0x2b')]);return _0x11e414(_0x1dca5d[_0x8b56('0x29')][_0x8b56('0x2b')]);}logger[_0x8b56('0x29')](_0x8b56('0x25'),_0x442dfd,_0x1dca5d[_0x8b56('0x29')][_0x8b56('0x2b')]);return _0x1e5fa5(_0x1dca5d[_0x8b56('0x29')][_0x8b56('0x2b')]);}else{logger[_0x8b56('0x24')](_0x8b56('0x25'),_0x442dfd,_0x8b56('0x26'));_0x1e5fa5(_0x1dca5d[_0x8b56('0x2c')][_0x8b56('0x2b')]);}})[_0x8b56('0x2d')](function(_0x23f74a){logger[_0x8b56('0x29')](_0x8b56('0x25'),_0x442dfd,_0x23f74a);_0x11e414(_0x23f74a);});});}function respondWithStatusCode(_0x207cc0,_0x49f88e){_0x49f88e=_0x49f88e||0xcc;return function(_0x472d57){if(_0x472d57){return _0x207cc0[_0x8b56('0x2e')](_0x49f88e);}return _0x207cc0['status'](_0x49f88e)[_0x8b56('0x2f')]();};}function respondWithResult(_0xc0ed3e,_0x11ae01){_0x11ae01=_0x11ae01||0xc8;return function(_0x47a968){if(_0x47a968){return _0xc0ed3e['status'](_0x11ae01)[_0x8b56('0x30')](_0x47a968);}};}function respondWithFilteredResult(_0x3a18fb,_0x108cd7){return function(_0x3d22bc){if(_0x3d22bc){var _0x534289=typeof _0x108cd7[_0x8b56('0x31')]==='undefined'&&typeof _0x108cd7[_0x8b56('0x32')]==='undefined';var _0x3c268f=_0x3d22bc['count'];var _0x21c18a=_0x534289?0x0:_0x108cd7[_0x8b56('0x31')];var _0x1f59ac=_0x534289?_0x3d22bc['count']:_0x108cd7[_0x8b56('0x31')]+_0x108cd7['limit'];var _0x14dce9;if(_0x1f59ac>=_0x3c268f){_0x1f59ac=_0x3c268f;_0x14dce9=0xc8;}else{_0x14dce9=0xce;}_0x3a18fb[_0x8b56('0x33')](_0x14dce9);return _0x3a18fb['set'](_0x8b56('0x34'),_0x21c18a+'-'+_0x1f59ac+'/'+_0x3c268f)[_0x8b56('0x30')](_0x3d22bc);}return null;};}function patchUpdates(_0x4da272){return function(_0x48a24c){try{jsonpatch[_0x8b56('0x35')](_0x48a24c,_0x4da272,!![]);}catch(_0x3b48e1){return BPromise['reject'](_0x3b48e1);}return _0x48a24c[_0x8b56('0x36')]();};}function saveUpdates(_0x18295c,_0x7decce){return function(_0x57c482){if(_0x57c482){return _0x57c482[_0x8b56('0x37')](_0x18295c)[_0x8b56('0x23')](function(_0x260123){return _0x260123;});}return null;};}function removeEntity(_0x5c83ec,_0x4f90ad){return function(_0x2f33e9){if(_0x2f33e9){return _0x2f33e9[_0x8b56('0x38')]()[_0x8b56('0x23')](function(){var _0x49ea4b=_0x2f33e9[_0x8b56('0x39')]({'plain':!![]});var _0x395f36='MailAccounts';return db[_0x8b56('0x3a')][_0x8b56('0x38')]({'where':{'type':_0x395f36,'resourceId':_0x49ea4b['id']}})[_0x8b56('0x23')](function(){return _0x2f33e9;});})['then'](function(){_0x5c83ec[_0x8b56('0x33')](0xcc)[_0x8b56('0x2f')]();});}};}function handleEntityNotFound(_0xdac7a1,_0x316f21){return function(_0x2230de){if(!_0x2230de){_0xdac7a1[_0x8b56('0x2e')](0x194);}return _0x2230de;};}function handleError(_0x17f541,_0x3c353d){_0x3c353d=_0x3c353d||0x1f4;return function(_0x2ec443){logger['error'](_0x2ec443[_0x8b56('0x3b')]);if(_0x2ec443[_0x8b56('0x3c')]){delete _0x2ec443[_0x8b56('0x3c')];}_0x17f541[_0x8b56('0x33')](_0x3c353d)['send'](_0x2ec443);};}function getMustacheRender(_0x5a85a4,_0x3adeed){return Mustache[_0x8b56('0x3d')](_0x5a85a4,_['merge'](_0x3adeed[_0x8b56('0x3e')],{'contact':_0x3adeed[_0x8b56('0x3f')],'message':_0x3adeed['message'],'agent':_0x3adeed['agent'],'interaction':_0x3adeed[_0x8b56('0x40')],'account':_0x3adeed[_0x8b56('0x41')]}))||'';}exports[_0x8b56('0x42')]=function(_0x44c748,_0x1e38e1){var _0x3d59ba={'include':[{'model':db[_0x8b56('0x43')],'as':_0x8b56('0x44')},{'model':db[_0x8b56('0x45')],'as':_0x8b56('0x46')},{'model':db[_0x8b56('0x47')],'as':_0x8b56('0x48')}]},_0x1bbe86={},_0x200fdd={'count':0x0,'rows':[]};var _0x1daae4=_['map'](db[_0x8b56('0x49')][_0x8b56('0x4a')],function(_0x5aa922){return{'name':_0x5aa922[_0x8b56('0x4b')],'type':_0x5aa922[_0x8b56('0x4c')][_0x8b56('0x4d')]};});_0x1bbe86['model']=_[_0x8b56('0x4e')](_0x1daae4,_0x8b56('0x3c'));_0x1bbe86[_0x8b56('0x4f')]=_[_0x8b56('0x50')](_0x44c748['query']);_0x1bbe86['filters']=_[_0x8b56('0x51')](_0x1bbe86[_0x8b56('0x52')],_0x1bbe86[_0x8b56('0x4f')]);_0x3d59ba[_0x8b56('0x53')]=_[_0x8b56('0x51')](_0x1bbe86[_0x8b56('0x52')],qs[_0x8b56('0x54')](_0x44c748['query'][_0x8b56('0x54')]));_0x3d59ba[_0x8b56('0x53')]=_0x3d59ba['attributes']['length']?_0x3d59ba['attributes']:_0x1bbe86['model'];if(!_0x44c748[_0x8b56('0x4f')][_0x8b56('0x55')](_0x8b56('0x56'))){_0x3d59ba[_0x8b56('0x32')]=qs['limit'](_0x44c748['query']['limit']);_0x3d59ba[_0x8b56('0x31')]=qs[_0x8b56('0x31')](_0x44c748[_0x8b56('0x4f')][_0x8b56('0x31')]);}_0x3d59ba[_0x8b56('0x57')]=qs[_0x8b56('0x58')](_0x44c748['query'][_0x8b56('0x58')]);_0x3d59ba['where']=qs[_0x8b56('0x59')](_['pick'](_0x44c748[_0x8b56('0x4f')],_0x1bbe86['filters']),_0x1daae4);if(_0x44c748[_0x8b56('0x4f')][_0x8b56('0x5a')]){_0x3d59ba[_0x8b56('0x5b')]=_['merge'](_0x3d59ba[_0x8b56('0x5b')],{'$or':_[_0x8b56('0x4e')](_0x1daae4,function(_0x48f70b){if(_0x48f70b[_0x8b56('0x4c')]!=='VIRTUAL'){var _0x5ee698={};_0x5ee698[_0x48f70b[_0x8b56('0x3c')]]={'$like':'%'+_0x44c748[_0x8b56('0x4f')][_0x8b56('0x5a')]+'%'};return _0x5ee698;}})});}_0x3d59ba=_[_0x8b56('0x5c')]({},_0x3d59ba,_0x44c748[_0x8b56('0x5d')]);var _0x216931={'where':_0x3d59ba[_0x8b56('0x5b')]};return db[_0x8b56('0x49')][_0x8b56('0x5e')](_0x216931)['then'](function(_0x577b32){_0x200fdd['count']=_0x577b32;if(_0x44c748[_0x8b56('0x4f')][_0x8b56('0x5f')]){_0x3d59ba[_0x8b56('0x60')]=[{'all':!![]}];}return db[_0x8b56('0x49')]['findAll'](_0x3d59ba);})['then'](function(_0x147e6c){_0x200fdd[_0x8b56('0x61')]=_0x147e6c;return _0x200fdd;})[_0x8b56('0x23')](respondWithFilteredResult(_0x1e38e1,_0x3d59ba))[_0x8b56('0x2d')](handleError(_0x1e38e1,null));};exports['show']=function(_0xc21fb3,_0x5df7e8){var _0x362cd7={'raw':![],'where':{'id':_0xc21fb3['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x8b56('0x44')},{'model':db[_0x8b56('0x45')],'as':_0x8b56('0x46')},{'model':db[_0x8b56('0x47')],'as':'mandatoryDispositionPause'}]},_0x4da767={};_0x4da767['model']=_[_0x8b56('0x50')](db[_0x8b56('0x49')][_0x8b56('0x4a')]);_0x4da767[_0x8b56('0x4f')]=_[_0x8b56('0x50')](_0xc21fb3[_0x8b56('0x4f')]);_0x4da767[_0x8b56('0x59')]=_[_0x8b56('0x51')](_0x4da767['model'],_0x4da767['query']);_0x362cd7[_0x8b56('0x53')]=_[_0x8b56('0x51')](_0x4da767[_0x8b56('0x52')],qs['fields'](_0xc21fb3[_0x8b56('0x4f')][_0x8b56('0x54')]));_0x362cd7[_0x8b56('0x53')]=_0x362cd7['attributes'][_0x8b56('0x62')]?_0x362cd7[_0x8b56('0x53')]:_0x4da767['model'];if(_0xc21fb3['query'][_0x8b56('0x5f')]){_0x362cd7[_0x8b56('0x60')]=[{'all':!![]}];}_0x362cd7=_[_0x8b56('0x5c')]({},_0x362cd7,_0xc21fb3[_0x8b56('0x5d')]);return db[_0x8b56('0x49')]['find'](_0x362cd7)[_0x8b56('0x23')](handleEntityNotFound(_0x5df7e8,null))[_0x8b56('0x23')](respondWithResult(_0x5df7e8,null))['catch'](handleError(_0x5df7e8,null));};exports[_0x8b56('0x37')]=function(_0x5028b6,_0x22d06e){if(_0x5028b6['body']['id']){delete _0x5028b6[_0x8b56('0x3e')]['id'];}return db[_0x8b56('0x49')]['find']({'where':{'id':_0x5028b6[_0x8b56('0x63')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x8b56('0x44')},{'model':db[_0x8b56('0x45')],'as':_0x8b56('0x46')},{'model':db['Pause'],'as':_0x8b56('0x48')}]})[_0x8b56('0x23')](handleEntityNotFound(_0x22d06e,null))[_0x8b56('0x23')](saveUpdates(_0x5028b6[_0x8b56('0x3e')],null))[_0x8b56('0x23')](function(_0x10627d){if(_0x10627d&&_0x5028b6[_0x8b56('0x3e')][_0x8b56('0x44')]){return db[_0x8b56('0x43')][_0x8b56('0x37')](_0x5028b6[_0x8b56('0x3e')][_0x8b56('0x44')],{'where':{'MailAccountId':_0x10627d['id']}})[_0x8b56('0x23')](function(){return _0x10627d;});}return _0x10627d;})['then'](function(_0x5cbf4e){if(_0x5cbf4e&&_0x5028b6[_0x8b56('0x3e')][_0x8b56('0x46')]){return db[_0x8b56('0x45')][_0x8b56('0x37')](_0x5028b6[_0x8b56('0x3e')][_0x8b56('0x46')],{'where':{'MailAccountId':_0x5cbf4e['id']}})[_0x8b56('0x23')](function(){return _0x5cbf4e;});}return _0x5cbf4e;})['then'](respondWithResult(_0x22d06e,null))[_0x8b56('0x2d')](handleError(_0x22d06e,null));};exports['describe']=function(_0x3a82f4,_0x46825b){return db[_0x8b56('0x49')][_0x8b56('0x64')]()[_0x8b56('0x23')](respondWithResult(_0x46825b,null))[_0x8b56('0x2d')](handleError(_0x46825b,null));};exports['addDisposition']=function(_0x2a7e10,_0x1af754,_0x31ea93){if(_0x2a7e10['body']['id']){delete _0x2a7e10['body']['id'];}return db[_0x8b56('0x49')]['find']({'where':{'id':_0x2a7e10['params']['id']}})['then'](handleEntityNotFound(_0x1af754,null))[_0x8b56('0x23')](function(_0xfea6f6){if(_0xfea6f6){_0x2a7e10[_0x8b56('0x3e')][_0x8b56('0x65')]=_0xfea6f6['id'];return db['Disposition'][_0x8b56('0x66')](_0x2a7e10[_0x8b56('0x3e')]);}})['then'](respondWithResult(_0x1af754,null))[_0x8b56('0x2d')](handleError(_0x1af754,null));};exports[_0x8b56('0x67')]=function(_0x29ca37,_0xf7f4a2,_0x30e98e){var _0x1862f5={'raw':![],'where':{}};var _0x4e2971={};var _0x28df47={'count':0x0,'rows':[]};return db[_0x8b56('0x49')][_0x8b56('0x68')]({'where':{'id':_0x29ca37[_0x8b56('0x63')]['id']}})[_0x8b56('0x23')](handleEntityNotFound(_0xf7f4a2,null))[_0x8b56('0x23')](function(_0x3a64d3){if(_0x3a64d3){_0x4e2971['model']=_[_0x8b56('0x50')](db['Disposition'][_0x8b56('0x4a')]);_0x4e2971[_0x8b56('0x4f')]=_[_0x8b56('0x50')](_0x29ca37[_0x8b56('0x4f')]);_0x4e2971['filters']=_[_0x8b56('0x51')](_0x4e2971[_0x8b56('0x52')],_0x4e2971['query']);_0x1862f5[_0x8b56('0x53')]=_[_0x8b56('0x51')](_0x4e2971[_0x8b56('0x52')],qs[_0x8b56('0x54')](_0x29ca37['query'][_0x8b56('0x54')]));_0x1862f5[_0x8b56('0x53')]=_0x1862f5['attributes'][_0x8b56('0x62')]?_0x1862f5[_0x8b56('0x53')]:_0x4e2971[_0x8b56('0x52')];if(!_0x29ca37['query'][_0x8b56('0x55')](_0x8b56('0x56'))){_0x1862f5[_0x8b56('0x32')]=qs['limit'](_0x29ca37[_0x8b56('0x4f')][_0x8b56('0x32')]);_0x1862f5['offset']=qs[_0x8b56('0x31')](_0x29ca37[_0x8b56('0x4f')][_0x8b56('0x31')]);}_0x1862f5['order']=qs[_0x8b56('0x58')](_0x29ca37[_0x8b56('0x4f')][_0x8b56('0x58')]);_0x1862f5[_0x8b56('0x5b')]=qs[_0x8b56('0x59')](_[_0x8b56('0x69')](_0x29ca37['query'],_0x4e2971[_0x8b56('0x59')]));_0x1862f5['where'][_0x8b56('0x65')]=_0x3a64d3['id'];if(_0x29ca37[_0x8b56('0x4f')][_0x8b56('0x5a')]){_0x1862f5[_0x8b56('0x5b')]=_[_0x8b56('0x5c')](_0x1862f5[_0x8b56('0x5b')],{'$or':_['map'](_0x1862f5[_0x8b56('0x53')],function(_0xd9826f){var _0x3a37e9={};_0x3a37e9[_0xd9826f]={'$like':'%'+_0x29ca37[_0x8b56('0x4f')][_0x8b56('0x5a')]+'%'};return _0x3a37e9;})});}_0x1862f5=_[_0x8b56('0x5c')]({},_0x1862f5,_0x29ca37[_0x8b56('0x5d')]);return db['Disposition'][_0x8b56('0x5e')]({'where':_0x1862f5[_0x8b56('0x5b')]})[_0x8b56('0x23')](function(_0x2603c0){_0x28df47[_0x8b56('0x5e')]=_0x2603c0;if(_0x29ca37[_0x8b56('0x4f')][_0x8b56('0x5f')]){_0x1862f5[_0x8b56('0x60')]=[{'all':!![]}];}return db['Disposition'][_0x8b56('0x6a')](_0x1862f5);})['then'](function(_0x2c6c9d){_0x28df47[_0x8b56('0x61')]=_0x2c6c9d;return _0x28df47;});}})[_0x8b56('0x23')](respondWithFilteredResult(_0xf7f4a2,_0x1862f5))[_0x8b56('0x2d')](handleError(_0xf7f4a2,null));};exports[_0x8b56('0x6b')]=function(_0x22991e,_0xce51a1,_0x113b39){return db[_0x8b56('0x49')][_0x8b56('0x6c')]({'where':{'id':_0x22991e[_0x8b56('0x63')]['id']}})['then'](handleEntityNotFound(_0xce51a1,null))['then'](function(_0x24becf){if(_0x24becf){return _0x24becf[_0x8b56('0x6b')](_0x22991e['query'][_0x8b56('0x6d')]);}})['then'](respondWithStatusCode(_0xce51a1,null))[_0x8b56('0x2d')](handleError(_0xce51a1,null));};exports[_0x8b56('0x6e')]=function(_0x123bb7,_0x356ccf,_0x56489a){if(_0x123bb7[_0x8b56('0x3e')]['id']){delete _0x123bb7[_0x8b56('0x3e')]['id'];}return db[_0x8b56('0x49')][_0x8b56('0x6c')]({'where':{'id':_0x123bb7[_0x8b56('0x63')]['id']}})[_0x8b56('0x23')](handleEntityNotFound(_0x356ccf,null))[_0x8b56('0x23')](function(_0x4994d9){if(_0x4994d9){_0x123bb7[_0x8b56('0x3e')][_0x8b56('0x65')]=_0x4994d9['id'];return db[_0x8b56('0x6f')][_0x8b56('0x66')](_0x123bb7[_0x8b56('0x3e')]);}})[_0x8b56('0x23')](respondWithResult(_0x356ccf,null))['catch'](handleError(_0x356ccf,null));};exports[_0x8b56('0x70')]=function(_0x3cd06c,_0x2d1e89,_0x277d52){var _0x4f8773={'raw':![],'where':{}};var _0x88c0ce={};var _0x31c4a7={'count':0x0,'rows':[]};return db[_0x8b56('0x49')]['findOne']({'where':{'id':_0x3cd06c[_0x8b56('0x63')]['id']}})[_0x8b56('0x23')](handleEntityNotFound(_0x2d1e89,null))['then'](function(_0x38c1ee){if(_0x38c1ee){_0x88c0ce[_0x8b56('0x52')]=_[_0x8b56('0x50')](db[_0x8b56('0x6f')]['rawAttributes']);_0x88c0ce['query']=_[_0x8b56('0x50')](_0x3cd06c[_0x8b56('0x4f')]);_0x88c0ce[_0x8b56('0x59')]=_[_0x8b56('0x51')](_0x88c0ce[_0x8b56('0x52')],_0x88c0ce[_0x8b56('0x4f')]);_0x4f8773[_0x8b56('0x53')]=_[_0x8b56('0x51')](_0x88c0ce['model'],qs[_0x8b56('0x54')](_0x3cd06c[_0x8b56('0x4f')][_0x8b56('0x54')]));_0x4f8773[_0x8b56('0x53')]=_0x4f8773[_0x8b56('0x53')][_0x8b56('0x62')]?_0x4f8773[_0x8b56('0x53')]:_0x88c0ce[_0x8b56('0x52')];if(!_0x3cd06c[_0x8b56('0x4f')][_0x8b56('0x55')](_0x8b56('0x56'))){_0x4f8773[_0x8b56('0x32')]=qs[_0x8b56('0x32')](_0x3cd06c[_0x8b56('0x4f')][_0x8b56('0x32')]);_0x4f8773[_0x8b56('0x31')]=qs['offset'](_0x3cd06c[_0x8b56('0x4f')]['offset']);}_0x4f8773[_0x8b56('0x57')]=qs['sort'](_0x3cd06c[_0x8b56('0x4f')][_0x8b56('0x58')]);_0x4f8773['where']=qs[_0x8b56('0x59')](_[_0x8b56('0x69')](_0x3cd06c[_0x8b56('0x4f')],_0x88c0ce[_0x8b56('0x59')]));_0x4f8773['where'][_0x8b56('0x65')]=_0x38c1ee['id'];if(_0x3cd06c[_0x8b56('0x4f')][_0x8b56('0x5a')]){_0x4f8773[_0x8b56('0x5b')]=_[_0x8b56('0x5c')](_0x4f8773[_0x8b56('0x5b')],{'$or':_[_0x8b56('0x4e')](_0x4f8773[_0x8b56('0x53')],function(_0x22780e){var _0x1f8ec6={};_0x1f8ec6[_0x22780e]={'$like':'%'+_0x3cd06c[_0x8b56('0x4f')]['filter']+'%'};return _0x1f8ec6;})});}_0x4f8773=_[_0x8b56('0x5c')]({},_0x4f8773,_0x3cd06c[_0x8b56('0x5d')]);return db[_0x8b56('0x6f')][_0x8b56('0x5e')]({'where':_0x4f8773[_0x8b56('0x5b')]})['then'](function(_0x2579e4){_0x31c4a7[_0x8b56('0x5e')]=_0x2579e4;if(_0x3cd06c[_0x8b56('0x4f')][_0x8b56('0x5f')]){_0x4f8773[_0x8b56('0x60')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8b56('0x6a')](_0x4f8773);})[_0x8b56('0x23')](function(_0x333993){_0x31c4a7[_0x8b56('0x61')]=_0x333993;return _0x31c4a7;});}})[_0x8b56('0x23')](respondWithFilteredResult(_0x2d1e89,_0x4f8773))[_0x8b56('0x2d')](handleError(_0x2d1e89,null));};exports[_0x8b56('0x71')]=function(_0x8a429,_0x286a16,_0x4fcb7c){return db['MailAccount']['find']({'where':{'id':_0x8a429[_0x8b56('0x63')]['id']}})[_0x8b56('0x23')](handleEntityNotFound(_0x286a16,null))[_0x8b56('0x23')](function(_0x38740d){if(_0x38740d){return _0x38740d[_0x8b56('0x71')](_0x8a429[_0x8b56('0x4f')][_0x8b56('0x6d')]);}})[_0x8b56('0x23')](respondWithStatusCode(_0x286a16,null))[_0x8b56('0x2d')](handleError(_0x286a16,null));};exports['create']=function(_0x3136f2,_0x786386){var _0x3d6b15={'name':_0x3136f2[_0x8b56('0x3e')][_0x8b56('0x3c')],'key':_0x3136f2['body'][_0x8b56('0x4d')],'email':_0x3136f2[_0x8b56('0x3e')][_0x8b56('0x72')],'ListId':_0x3136f2['body'][_0x8b56('0x73')],'active':!_[_0x8b56('0x74')](_0x3136f2[_0x8b56('0x3e')][_0x8b56('0x75')])?_0x3136f2[_0x8b56('0x3e')][_0x8b56('0x75')]:!![],'description':_0x3136f2[_0x8b56('0x3e')][_0x8b56('0x76')]||null,'Imap':{},'Smtp':{}};if(_[_0x8b56('0x74')](_0x3136f2['body'][_0x8b56('0x77')])){if(_0x3136f2[_0x8b56('0x3e')][_0x8b56('0x78')]){_0x3d6b15[_0x8b56('0x44')][_0x8b56('0x79')]=_0x3d6b15[_0x8b56('0x46')][_0x8b56('0x79')]=_0x3136f2[_0x8b56('0x3e')][_0x8b56('0x7a')];_0x3d6b15[_0x8b56('0x44')]['password']=_0x3d6b15[_0x8b56('0x46')][_0x8b56('0x7b')]=_0x3136f2[_0x8b56('0x3e')][_0x8b56('0x7c')];}else{_0x3d6b15[_0x8b56('0x44')][_0x8b56('0x7d')]=_0x3d6b15[_0x8b56('0x46')][_0x8b56('0x7d')]=![];}_0x3d6b15[_0x8b56('0x44')][_0x8b56('0x7e')]=_0x3136f2[_0x8b56('0x3e')][_0x8b56('0x44')]['host'];_0x3d6b15[_0x8b56('0x44')][_0x8b56('0x7f')]=_0x3136f2[_0x8b56('0x3e')][_0x8b56('0x44')]['port'];_0x3d6b15[_0x8b56('0x46')][_0x8b56('0x7e')]=_0x3136f2[_0x8b56('0x3e')][_0x8b56('0x46')][_0x8b56('0x7e')];_0x3d6b15[_0x8b56('0x46')][_0x8b56('0x7f')]=_0x3136f2[_0x8b56('0x3e')]['Smtp'][_0x8b56('0x7f')];}else{_0x3d6b15['Imap'][_0x8b56('0x80')]=_0x3d6b15[_0x8b56('0x46')][_0x8b56('0x80')]=_0x3136f2['body'][_0x8b56('0x77')];_0x3d6b15[_0x8b56('0x44')][_0x8b56('0x79')]=_0x3d6b15[_0x8b56('0x46')][_0x8b56('0x79')]=_0x3136f2[_0x8b56('0x3e')][_0x8b56('0x7a')];_0x3d6b15[_0x8b56('0x44')][_0x8b56('0x81')]=_0x3d6b15[_0x8b56('0x46')][_0x8b56('0x7b')]=_0x3136f2[_0x8b56('0x3e')][_0x8b56('0x7c')];}return db[_0x8b56('0x49')][_0x8b56('0x66')](_0x3d6b15,{'include':[{'model':db[_0x8b56('0x45')],'as':_0x8b56('0x46')},{'model':db[_0x8b56('0x43')],'as':_0x8b56('0x44')}]})[_0x8b56('0x23')](function(_0x326dcb){var _0x1071f8=_0x3136f2[_0x8b56('0x79')]['get']({'plain':!![]});if(!_0x1071f8)throw new Error(_0x8b56('0x82'));if(_0x1071f8[_0x8b56('0x83')]===_0x8b56('0x79')){var _0x10edf9=_0x326dcb[_0x8b56('0x39')]({'plain':!![]});return db[_0x8b56('0x84')][_0x8b56('0x6c')]({'where':{'name':'MailAccounts','userProfileId':_0x1071f8['userProfileId']},'raw':!![]})[_0x8b56('0x23')](function(_0x425335){if(_0x425335&&_0x425335['autoAssociation']===0x0){return db[_0x8b56('0x3a')][_0x8b56('0x66')]({'name':_0x10edf9['name'],'resourceId':_0x10edf9['id'],'type':_0x425335[_0x8b56('0x3c')],'sectionId':_0x425335['id']},{})['then'](function(){return _0x326dcb;});}else{return _0x326dcb;}})[_0x8b56('0x2d')](function(_0xe69108){logger[_0x8b56('0x29')](_0x8b56('0x85'),_0xe69108);throw _0xe69108;});}return _0x326dcb;})[_0x8b56('0x23')](respondWithResult(_0x786386,0xc9))['catch'](handleError(_0x786386,null));};exports['getImap']=function(_0x101a15,_0x1a0fd4,_0x2a4f78){return db[_0x8b56('0x49')][_0x8b56('0x68')]({'where':{'id':_0x101a15[_0x8b56('0x63')]['id']}})[_0x8b56('0x23')](handleEntityNotFound(_0x1a0fd4,null))[_0x8b56('0x23')](function(_0x2d2452){if(_0x2d2452){return _0x2d2452[_0x8b56('0x86')]();}return null;})[_0x8b56('0x23')](respondWithResult(_0x1a0fd4,null))[_0x8b56('0x2d')](handleError(_0x1a0fd4,null));};exports[_0x8b56('0x87')]=function(_0x429d90,_0x14d521,_0x567685){if(_0x429d90['body']['id']){delete _0x429d90[_0x8b56('0x3e')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x429d90[_0x8b56('0x63')]['id']}})[_0x8b56('0x23')](handleEntityNotFound(_0x14d521,null))['then'](function(_0x3504ca){if(_0x3504ca){_0x429d90[_0x8b56('0x3e')]['MailAccountId']=_0x3504ca['id'];return db[_0x8b56('0x43')][_0x8b56('0x66')](_0x429d90['body']);}})[_0x8b56('0x23')](respondWithResult(_0x14d521,null))[_0x8b56('0x2d')](handleError(_0x14d521,null));};exports[_0x8b56('0x88')]=function(_0x1b4c2b,_0x2ec70d,_0x404902){return db[_0x8b56('0x49')][_0x8b56('0x68')]({'where':{'id':_0x1b4c2b['params']['id']}})[_0x8b56('0x23')](handleEntityNotFound(_0x2ec70d,null))['then'](function(_0x2ab774){if(_0x2ab774){return _0x2ab774[_0x8b56('0x89')](null);}return null;})[_0x8b56('0x23')](respondWithStatusCode(_0x2ec70d,null))[_0x8b56('0x2d')](handleError(_0x2ec70d,null));};exports[_0x8b56('0x8a')]=function(_0x41f657,_0x85554f,_0x2a35a5){return db['MailAccount'][_0x8b56('0x68')]({'where':{'id':_0x41f657[_0x8b56('0x63')]['id']}})[_0x8b56('0x23')](handleEntityNotFound(_0x85554f,null))['then'](function(_0x349f38){if(_0x349f38){return _0x349f38[_0x8b56('0x8a')]();}return null;})['then'](respondWithResult(_0x85554f,null))['catch'](handleError(_0x85554f,null));};exports[_0x8b56('0x8b')]=function(_0x833fef,_0x43b3ae,_0x429290){if(_0x833fef[_0x8b56('0x3e')]['id']){delete _0x833fef[_0x8b56('0x3e')]['id'];}return db[_0x8b56('0x49')][_0x8b56('0x6c')]({'where':{'id':_0x833fef['params']['id']}})[_0x8b56('0x23')](handleEntityNotFound(_0x43b3ae,null))[_0x8b56('0x23')](function(_0x226d0a){if(_0x226d0a){_0x833fef['body'][_0x8b56('0x65')]=_0x226d0a['id'];return db[_0x8b56('0x45')][_0x8b56('0x66')](_0x833fef[_0x8b56('0x3e')]);}})[_0x8b56('0x23')](respondWithResult(_0x43b3ae,null))[_0x8b56('0x2d')](handleError(_0x43b3ae,null));};exports[_0x8b56('0x8c')]=function(_0x83fca0,_0x2046cd,_0x401c12){return db['MailAccount']['findOne']({'where':{'id':_0x83fca0[_0x8b56('0x63')]['id']}})[_0x8b56('0x23')](handleEntityNotFound(_0x2046cd,null))[_0x8b56('0x23')](function(_0x295899){if(_0x295899){return _0x295899['setSmtp'](null);}return null;})[_0x8b56('0x23')](respondWithStatusCode(_0x2046cd,null))[_0x8b56('0x2d')](handleError(_0x2046cd,null));};exports[_0x8b56('0x8d')]=function(_0x1e17d7,_0x4fe9df,_0x313783){return db[_0x8b56('0x8e')][_0x8b56('0x6c')]({'where':{'id':_0x1e17d7[_0x8b56('0x63')]['id']}})[_0x8b56('0x23')](handleEntityNotFound(_0x4fe9df,null))[_0x8b56('0x23')](function(_0x686c61){if(_0x686c61){return _0x686c61[_0x8b56('0x8d')](_0x1e17d7[_0x8b56('0x3e')][_0x8b56('0x6d')],_[_0x8b56('0x8f')](_0x1e17d7['body'],['ids','id'])||{});}})[_0x8b56('0x23')](respondWithResult(_0x4fe9df,null))[_0x8b56('0x2d')](handleError(_0x4fe9df,null));};exports[_0x8b56('0x90')]=function(_0x469e56,_0x18709a,_0x56142b){var _0x278b70={'raw':![],'where':{}};var _0x20f240={};var _0x345c85={'count':0x0,'rows':[]};return db['MailAccount'][_0x8b56('0x68')]({'where':{'id':_0x469e56[_0x8b56('0x63')]['id']}})[_0x8b56('0x23')](handleEntityNotFound(_0x18709a,null))['then'](function(_0x230dbe){if(_0x230dbe){_0x20f240['model']=_[_0x8b56('0x50')](db['MailInteraction'][_0x8b56('0x4a')]);_0x20f240[_0x8b56('0x4f')]=_[_0x8b56('0x50')](_0x469e56['query']);_0x20f240[_0x8b56('0x59')]=_[_0x8b56('0x51')](_0x20f240[_0x8b56('0x52')],_0x20f240[_0x8b56('0x4f')]);_0x278b70['attributes']=_[_0x8b56('0x51')](_0x20f240['model'],qs[_0x8b56('0x54')](_0x469e56['query'][_0x8b56('0x54')]));_0x278b70[_0x8b56('0x53')]=_0x278b70['attributes'][_0x8b56('0x62')]?_0x278b70['attributes']:_0x20f240['model'];if(!_0x469e56[_0x8b56('0x4f')][_0x8b56('0x55')](_0x8b56('0x56'))){_0x278b70['limit']=qs[_0x8b56('0x32')](_0x469e56[_0x8b56('0x4f')][_0x8b56('0x32')]);_0x278b70[_0x8b56('0x31')]=qs[_0x8b56('0x31')](_0x469e56['query'][_0x8b56('0x31')]);}_0x278b70[_0x8b56('0x57')]=qs['sort'](_0x469e56['query'][_0x8b56('0x58')]);_0x278b70[_0x8b56('0x5b')]=qs['filters'](_['pick'](_0x469e56['query'],_0x20f240[_0x8b56('0x59')]));_0x278b70[_0x8b56('0x5b')][_0x8b56('0x65')]=_0x230dbe['id'];if(_0x469e56[_0x8b56('0x4f')][_0x8b56('0x5a')]){_0x278b70[_0x8b56('0x5b')]=_[_0x8b56('0x5c')](_0x278b70['where'],{'$or':_[_0x8b56('0x4e')](_0x278b70[_0x8b56('0x53')],function(_0xe2fb08){var _0x4afffd={};_0x4afffd[_0xe2fb08]={'$like':'%'+_0x469e56[_0x8b56('0x4f')][_0x8b56('0x5a')]+'%'};return _0x4afffd;})});}_0x278b70=_[_0x8b56('0x5c')]({},_0x278b70,_0x469e56[_0x8b56('0x5d')]);return db[_0x8b56('0x8e')][_0x8b56('0x5e')]({'where':_0x278b70[_0x8b56('0x5b')]})[_0x8b56('0x23')](function(_0x181c25){_0x345c85['count']=_0x181c25;if(_0x469e56[_0x8b56('0x4f')][_0x8b56('0x5f')]){_0x278b70[_0x8b56('0x60')]=[{'model':db[_0x8b56('0x91')],'as':_0x8b56('0x92'),'required':![]},{'model':db[_0x8b56('0x93')],'as':_0x8b56('0x94'),'attributes':[_0x8b56('0x3c'),_0x8b56('0x95'),_0x8b56('0x96')],'required':![]},{'model':db['Tag'],'as':_0x8b56('0x97'),'attributes':['id','name',_0x8b56('0x98')],'where':_0x469e56[_0x8b56('0x4f')][_0x8b56('0x99')]?{'id':_0x469e56[_0x8b56('0x4f')][_0x8b56('0x99')]}:undefined,'required':_0x469e56[_0x8b56('0x4f')][_0x8b56('0x99')]?!![]:![]}];}return db[_0x8b56('0x8e')][_0x8b56('0x6a')](_0x278b70);})['then'](function(_0x3c4bf6){_0x345c85['rows']=_0x3c4bf6;return _0x345c85;});}})[_0x8b56('0x23')](respondWithFilteredResult(_0x18709a,_0x278b70))['catch'](handleError(_0x18709a,null));};exports[_0x8b56('0x9a')]=function(_0x29516b,_0x1df486,_0x53a11c){return db[_0x8b56('0x49')][_0x8b56('0x68')]({'where':{'id':_0x29516b['params']['id']}})[_0x8b56('0x23')](handleEntityNotFound(_0x1df486,null))[_0x8b56('0x23')](function(_0x482733){if(_0x482733){return db[_0x8b56('0x9b')][_0x8b56('0x9c')](function(_0x2612af){return db[_0x8b56('0x9d')][_0x8b56('0x38')]({'where':{'MailAccountId':_0x29516b[_0x8b56('0x63')]['id']},'transaction':_0x2612af})[_0x8b56('0x23')](function(_0x2d7343){var _0xb9dcc1=_[_0x8b56('0x4e')](_0x29516b[_0x8b56('0x3e')],function(_0x377b36){_0x377b36[_0x8b56('0x65')]=_0x29516b[_0x8b56('0x63')]['id'];return _0x377b36;});return db[_0x8b56('0x9d')][_0x8b56('0x9e')](_0xb9dcc1,{'transaction':_0x2612af});});})['then'](function(){return db[_0x8b56('0x9d')][_0x8b56('0x9f')]({'where':{'MailAccountId':_0x29516b[_0x8b56('0x63')]['id']},'order':'priority'});});}})[_0x8b56('0x23')](respondWithResult(_0x1df486,null))['catch'](handleError(_0x1df486,null));};exports[_0x8b56('0xa0')]=function(_0x2b3e7b,_0x5e55a4,_0x403ddd){var _0x88f0e0={};var _0x3450e9={};var _0x582f68;var _0x176dcc;return db[_0x8b56('0x49')][_0x8b56('0x68')]({'where':{'id':_0x2b3e7b[_0x8b56('0x63')]['id']}})['then'](handleEntityNotFound(_0x5e55a4,null))[_0x8b56('0x23')](function(_0x7c98bd){if(_0x7c98bd){_0x582f68=_0x7c98bd;_0x3450e9[_0x8b56('0x52')]=_[_0x8b56('0x50')](db['MailApplication'][_0x8b56('0x4a')]);_0x3450e9['query']=_[_0x8b56('0x50')](_0x2b3e7b[_0x8b56('0x4f')]);_0x3450e9[_0x8b56('0x59')]=_[_0x8b56('0x51')](_0x3450e9[_0x8b56('0x52')],_0x3450e9[_0x8b56('0x4f')]);_0x88f0e0[_0x8b56('0x53')]=_[_0x8b56('0x51')](_0x3450e9['model'],qs[_0x8b56('0x54')](_0x2b3e7b[_0x8b56('0x4f')][_0x8b56('0x54')]));_0x88f0e0[_0x8b56('0x53')]=_0x88f0e0[_0x8b56('0x53')][_0x8b56('0x62')]?_0x88f0e0[_0x8b56('0x53')]:_0x3450e9[_0x8b56('0x52')];_0x88f0e0['order']=qs[_0x8b56('0x58')](_0x2b3e7b[_0x8b56('0x4f')][_0x8b56('0x58')]);_0x88f0e0[_0x8b56('0x5b')]=qs[_0x8b56('0x59')](_['pick'](_0x2b3e7b['query'],_0x3450e9[_0x8b56('0x59')]));if(_0x2b3e7b[_0x8b56('0x4f')][_0x8b56('0x5a')]){_0x88f0e0['where']=_['merge'](_0x88f0e0[_0x8b56('0x5b')],{'$or':_['map'](_0x88f0e0['attributes'],function(_0x254934){var _0x7963de={};_0x7963de[_0x254934]={'$like':'%'+_0x2b3e7b['query']['filter']+'%'};return _0x7963de;})});}_0x88f0e0=_[_0x8b56('0x5c')]({},_0x88f0e0,_0x2b3e7b[_0x8b56('0x5d')]);return _0x582f68[_0x8b56('0xa0')](_0x88f0e0);}})[_0x8b56('0x23')](function(_0x3d73b9){if(_0x3d73b9){_0x176dcc=_0x3d73b9['length'];if(!_0x2b3e7b[_0x8b56('0x4f')]['hasOwnProperty'](_0x8b56('0x56'))){_0x88f0e0[_0x8b56('0x32')]=qs['limit'](_0x2b3e7b[_0x8b56('0x4f')][_0x8b56('0x32')]);_0x88f0e0[_0x8b56('0x31')]=qs[_0x8b56('0x31')](_0x2b3e7b[_0x8b56('0x4f')][_0x8b56('0x31')]);}return _0x582f68[_0x8b56('0xa0')](_0x88f0e0);}})[_0x8b56('0x23')](function(_0x2094a9){if(_0x2094a9){return _0x2094a9?{'count':_0x176dcc,'rows':_0x2094a9}:null;}})['then'](respondWithResult(_0x5e55a4,null))['catch'](handleError(_0x5e55a4,null));};exports[_0x8b56('0xa1')]=function(_0x21ac7f,_0x30b1b3,_0x4804a2){var _0x46a73e={'raw':!![],'where':{}};var _0xdef5d={};var _0x224349={'count':0x0,'rows':[]};return db['MailAccount'][_0x8b56('0x68')]({'where':{'id':_0x21ac7f[_0x8b56('0x63')]['id']}})[_0x8b56('0x23')](handleEntityNotFound(_0x30b1b3,null))[_0x8b56('0x23')](function(_0x1784ac){if(_0x1784ac){_0xdef5d[_0x8b56('0x52')]=_[_0x8b56('0x50')](db['MailMessage'][_0x8b56('0x4a')]);_0xdef5d[_0x8b56('0x4f')]=_[_0x8b56('0x50')](_0x21ac7f[_0x8b56('0x4f')]);_0xdef5d[_0x8b56('0x59')]=_['intersection'](_0xdef5d['model'],_0xdef5d[_0x8b56('0x4f')]);_0x46a73e['attributes']=_[_0x8b56('0x51')](_0xdef5d[_0x8b56('0x52')],qs['fields'](_0x21ac7f['query']['fields']));_0x46a73e['attributes']=_0x46a73e[_0x8b56('0x53')][_0x8b56('0x62')]?_0x46a73e['attributes']:_0xdef5d[_0x8b56('0x52')];if(!_0x21ac7f[_0x8b56('0x4f')][_0x8b56('0x55')](_0x8b56('0x56'))){_0x46a73e[_0x8b56('0x32')]=qs[_0x8b56('0x32')](_0x21ac7f['query'][_0x8b56('0x32')]);_0x46a73e[_0x8b56('0x31')]=qs[_0x8b56('0x31')](_0x21ac7f[_0x8b56('0x4f')][_0x8b56('0x31')]);}_0x46a73e[_0x8b56('0x57')]=qs[_0x8b56('0x58')](_0x21ac7f[_0x8b56('0x4f')]['sort']);_0x46a73e[_0x8b56('0x5b')]=qs['filters'](_[_0x8b56('0x69')](_0x21ac7f[_0x8b56('0x4f')],_0xdef5d['filters']));_0x46a73e[_0x8b56('0x5b')][_0x8b56('0x65')]=_0x1784ac['id'];if(_0x21ac7f['query']['filter']){_0x46a73e['where']=_[_0x8b56('0x5c')](_0x46a73e[_0x8b56('0x5b')],{'$or':_[_0x8b56('0x4e')](_0x46a73e['attributes'],function(_0x8e9b50){var _0x491e6={};_0x491e6[_0x8e9b50]={'$like':'%'+_0x21ac7f['query'][_0x8b56('0x5a')]+'%'};return _0x491e6;})});}if(_0x21ac7f[_0x8b56('0x4f')][_0x8b56('0xa2')]){var _0x4b0f56=_0x21ac7f[_0x8b56('0x4f')][_0x8b56('0xa2')][_0x8b56('0xa3')](',');var _0x282d0d={};_0x282d0d[_0x4b0f56[0x0]]={'$gte':moment(_0x4b0f56[0x1])['format'](_0x8b56('0xa4'))};_0x46a73e[_0x8b56('0x5b')]=_[_0x8b56('0x5c')](_0x46a73e['where'],_0x282d0d);}_0x46a73e=_['merge']({},_0x46a73e,_0x21ac7f[_0x8b56('0x5d')]);return db[_0x8b56('0xa5')][_0x8b56('0x5e')]({'where':_0x46a73e[_0x8b56('0x5b')]})[_0x8b56('0x23')](function(_0x598b62){_0x224349[_0x8b56('0x5e')]=_0x598b62;if(_0x21ac7f[_0x8b56('0x4f')][_0x8b56('0x5f')]){_0x46a73e[_0x8b56('0x60')]=[{'all':!![]}];}return db[_0x8b56('0xa5')][_0x8b56('0x6a')](_0x46a73e);})['then'](function(_0x42da74){if(_0x21ac7f['query'][_0x8b56('0xa6')]===_0x8b56('0xa7')){for(var _0x1d3e53=0x0;_0x1d3e53<_0x42da74['length'];_0x1d3e53++){_0x42da74[_0x1d3e53][_0x8b56('0x3e')]=juice(_0x42da74[_0x1d3e53]['body']);}}_0x224349['rows']=_0x42da74;return _0x224349;});}})[_0x8b56('0x23')](respondWithFilteredResult(_0x30b1b3,_0x46a73e))[_0x8b56('0x2d')](handleError(_0x30b1b3,null));};exports[_0x8b56('0xa8')]=function(_0x18e1e8,_0x4ea4c5,_0xcb965){var _0x40c23e,_0x2ebbae={},_0x23b9d7;if(_0x18e1e8[_0x8b56('0x3e')]['to']){_0x23b9d7=_0x18e1e8['body']['to'][_0x8b56('0xa3')](',')[0x0];}return db['MailAccount'][_0x8b56('0x6c')]({'where':{'id':_0x18e1e8[_0x8b56('0x63')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x8b56('0x91')],'as':_0x8b56('0xa9'),'where':{'email':_0x23b9d7},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x8b56('0x45')],'as':'Smtp','raw':!![]}]})[_0x8b56('0x23')](handleEntityNotFound(_0x4ea4c5,null))[_0x8b56('0x23')](function(_0x2bde64){if(_0x2bde64){_0x40c23e=_0x2bde64;if(_0x2bde64['Smtp']){if(_[_0x8b56('0x74')](_0x18e1e8[_0x8b56('0x3e')][_0x8b56('0xaa')])){_0x18e1e8['body'][_0x8b56('0xaa')]=util[_0x8b56('0xab')]('%s\x20<%s>',_0x2bde64[_0x8b56('0x3c')],_0x2bde64[_0x8b56('0x72')]||_0x2bde64['Smtp']['user']);}if(_0x18e1e8['body'][_0x8b56('0xac')]&&_0x18e1e8[_0x8b56('0x3e')][_0x8b56('0xac')][_0x8b56('0x62')]){for(var _0x43e0d2=0x0;_0x43e0d2<_0x18e1e8['body'][_0x8b56('0xac')][_0x8b56('0x62')];_0x43e0d2+=0x1){_0x18e1e8[_0x8b56('0x3e')][_0x8b56('0xac')][_0x43e0d2]={'filename':_0x18e1e8[_0x8b56('0x3e')][_0x8b56('0xac')][_0x43e0d2][_0x8b56('0x3c')],'path':path[_0x8b56('0xad')](config[_0x8b56('0xae')],_0x8b56('0xaf'),_0x18e1e8[_0x8b56('0x3e')][_0x8b56('0xac')][_0x43e0d2]['basename'])};}}var _0x15b44a={'tls':{'rejectUnauthorized':![]}};if(_[_0x8b56('0x74')](_0x2bde64[_0x8b56('0x46')][_0x8b56('0x80')])){if(_0x2bde64[_0x8b56('0x46')][_0x8b56('0x7d')]){_0x15b44a[_0x8b56('0xb0')]={'user':_0x2bde64[_0x8b56('0x46')][_0x8b56('0x79')],'pass':_0x2bde64[_0x8b56('0x46')]['pass']};}_0x15b44a[_0x8b56('0x7e')]=_0x2bde64[_0x8b56('0x46')][_0x8b56('0x7e')];_0x15b44a[_0x8b56('0x7f')]=_0x2bde64[_0x8b56('0x46')][_0x8b56('0x7f')];_0x15b44a[_0x8b56('0xb1')]=_0x2bde64[_0x8b56('0x46')][_0x8b56('0xb1')];}else{_0x15b44a['service']=_0x2bde64[_0x8b56('0x46')]['service'];_0x15b44a[_0x8b56('0xb0')]={'user':_0x2bde64[_0x8b56('0x46')][_0x8b56('0x79')],'pass':_0x2bde64['Smtp'][_0x8b56('0x7b')]};}return respondWithRpcPromise('SendMail',_0x8b56('0xb2'),{'account':_0x15b44a,'message':_0x18e1e8['body']});}else{throw new Error(_0x8b56('0xb3'));}}})[_0x8b56('0x23')](function(_0x33a263){if(_0x33a263){_0x2ebbae=_0x33a263;if(_0x40c23e[_0x8b56('0xb4')]){if(_0x40c23e[_0x8b56('0xb4')][_0x8b56('0xa9')][_0x8b56('0x62')]){return _0x40c23e[_0x8b56('0xb4')][_0x8b56('0xa9')][0x0];}else{return db[_0x8b56('0x91')]['create'](_[_0x8b56('0x1e')](_0x18e1e8[_0x8b56('0x3e')],{'firstName':_0x18e1e8[_0x8b56('0x3e')]['to'],'email':_0x18e1e8[_0x8b56('0x3e')]['to'],'phone':_0x18e1e8[_0x8b56('0x3e')]['to'],'ListId':_0x40c23e[_0x8b56('0x73')]}));}}else{throw new Error(_0x8b56('0xb3'));}}})['then'](function(_0x2757cc){if(_0x2757cc){var _0x2c135b={'UserId':_0x18e1e8[_0x8b56('0x79')]['id'],'ContactId':_0x2757cc['id'],'MailAccountId':_0x40c23e['id'],'inReplyTo':_0x2ebbae['messageId'],'to':_0x18e1e8['body'][_0x8b56('0xaa')],'cc':_0x18e1e8[_0x8b56('0x3e')]['cc'],'subject':_0x18e1e8[_0x8b56('0x3e')][_0x8b56('0xb5')],'attach':_0x18e1e8[_0x8b56('0x3e')][_0x8b56('0xb6')],'firstMsgDirection':_0x8b56('0xb7'),'lastMsgAt':moment()['format'](_0x8b56('0xa4')),'lastMsgDirection':'out','Messages':[_['merge'](_0x18e1e8[_0x8b56('0x3e')],{'messageId':_0x2ebbae[_0x8b56('0xb8')],'sentAt':moment()[_0x8b56('0xab')](_0x8b56('0xa4')),'read':!![],'MailAccountId':_0x40c23e['id'],'UserId':_0x18e1e8['user']['id'],'ContactId':_0x2757cc['id']})]};if(_0x18e1e8[_0x8b56('0x3e')]['Interaction']){_0x2c135b=_[_0x8b56('0x5c')](_0x2c135b,_0x18e1e8[_0x8b56('0x3e')][_0x8b56('0xb9')]);}return db[_0x8b56('0x8e')][_0x8b56('0x66')](_0x2c135b,{'include':[{'model':db[_0x8b56('0xa5')],'as':_0x8b56('0xba')}]});}})[_0x8b56('0x23')](respondWithResult(_0x4ea4c5,null))[_0x8b56('0x2d')](handleError(_0x4ea4c5,null));};exports[_0x8b56('0xbb')]=function(_0x20b529,_0x400f24,_0xffe635){return db[_0x8b56('0x49')][_0x8b56('0x6c')]({'where':{'id':_0x20b529[_0x8b56('0x63')]['id']},'include':[{'model':db[_0x8b56('0x45')],'as':_0x8b56('0x46'),'raw':!![]}]})['then'](handleEntityNotFound(_0x400f24,null))[_0x8b56('0x23')](function(_0x3edb18){if(_0x3edb18&&_0x3edb18[_0x8b56('0x46')]){var _0x72443a={'id':_0x3edb18['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3edb18['Smtp'][_0x8b56('0x80')]){_0x72443a['service']=_0x3edb18[_0x8b56('0x46')][_0x8b56('0x80')];}else{_0x72443a[_0x8b56('0x7e')]=_0x3edb18[_0x8b56('0x46')][_0x8b56('0x7e')];_0x72443a[_0x8b56('0x7f')]=_0x3edb18[_0x8b56('0x46')][_0x8b56('0x7f')];_0x72443a[_0x8b56('0xb1')]=_0x3edb18[_0x8b56('0x46')][_0x8b56('0xb1')];}if(_0x3edb18[_0x8b56('0x46')][_0x8b56('0x7d')]){_0x72443a[_0x8b56('0xb0')]={'user':_0x3edb18['Smtp'][_0x8b56('0x79')],'pass':_0x3edb18['Smtp']['pass']};}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x72443a});}})['then'](respondWithResult(_0x400f24,null))['catch'](handleError(_0x400f24,null));};exports[_0x8b56('0x38')]=function(_0x256d84,_0x3066fe){return db[_0x8b56('0x49')][_0x8b56('0x6c')]({'where':{'id':_0x256d84[_0x8b56('0x63')]['id']}})[_0x8b56('0x23')](handleEntityNotFound(_0x3066fe,null))[_0x8b56('0x23')](function(_0x4990b9){if(_0x4990b9&&_0x4990b9[_0x8b56('0x80')]){throw new db[(_0x8b56('0xbc'))][(_0x8b56('0xbd'))](_0x8b56('0xbe'));}return _0x4990b9;})[_0x8b56('0x23')](removeEntity(_0x3066fe,null))['catch'](handleError(_0x3066fe,null));};exports[_0x8b56('0xbf')]=function(_0x5d76f7,_0x4bf5d9,_0x5af536){return db[_0x8b56('0x49')][_0x8b56('0x6c')]({'where':{'id':_0x5d76f7[_0x8b56('0x63')]['id']}})['then'](handleEntityNotFound(_0x4bf5d9,null))[_0x8b56('0x23')](function(_0x1b6392){if(_0x1b6392){return _0x1b6392['addAgents'](_0x5d76f7[_0x8b56('0x3e')][_0x8b56('0x6d')],_[_0x8b56('0x8f')](_0x5d76f7[_0x8b56('0x3e')],['ids','id'])||{})[_0x8b56('0xc0')](function(_0x1fb22c){for(var _0x21bbf7=0x0;_0x21bbf7<_0x5d76f7[_0x8b56('0x3e')][_0x8b56('0x6d')][_0x8b56('0x62')];_0x21bbf7+=0x1){socket[_0x8b56('0xc1')](_0x8b56('0xc2'),{'UserId':_0x5d76f7[_0x8b56('0x3e')]['ids'][_0x21bbf7],'MailAccountId':_0x5d76f7[_0x8b56('0x63')]['id']});}return _0x1fb22c;});}})[_0x8b56('0x23')](respondWithResult(_0x4bf5d9,null))[_0x8b56('0x2d')](handleError(_0x4bf5d9,null));};exports[_0x8b56('0xc3')]=function(_0x27c584,_0x762186,_0x197d21){return db[_0x8b56('0x49')]['find']({'where':{'id':_0x27c584[_0x8b56('0x63')]['id']}})[_0x8b56('0x23')](handleEntityNotFound(_0x762186,null))[_0x8b56('0x23')](function(_0xdc6e78){if(_0xdc6e78){return _0xdc6e78[_0x8b56('0xc3')](_0x27c584[_0x8b56('0x4f')][_0x8b56('0x6d')])['then'](function(){if(_[_0x8b56('0xc4')](_0x27c584['query'][_0x8b56('0x6d')])){for(var _0x560312=0x0;_0x560312<_0x27c584['query'][_0x8b56('0x6d')][_0x8b56('0x62')];_0x560312+=0x1){socket[_0x8b56('0xc1')](_0x8b56('0xc5'),{'UserId':Number(_0x27c584[_0x8b56('0x4f')][_0x8b56('0x6d')][_0x560312]),'MailAccountId':Number(_0x27c584[_0x8b56('0x63')]['id'])});}}else{socket[_0x8b56('0xc1')](_0x8b56('0xc5'),{'UserId':Number(_0x27c584[_0x8b56('0x4f')][_0x8b56('0x6d')]),'MailAccountId':Number(_0x27c584[_0x8b56('0x63')]['id'])});}});}})[_0x8b56('0x23')](respondWithStatusCode(_0x762186,null))[_0x8b56('0x2d')](handleError(_0x762186,null));};exports[_0x8b56('0xc6')]=function(_0x46adf0,_0x4bd43a,_0x39b276){var _0x15b785={};var _0x344e63={};var _0x7c17fe;var _0x198e49;return db[_0x8b56('0x49')]['findOne']({'where':{'id':_0x46adf0[_0x8b56('0x63')]['id']}})[_0x8b56('0x23')](handleEntityNotFound(_0x4bd43a,null))[_0x8b56('0x23')](function(_0x2381ac){if(_0x2381ac){_0x7c17fe=_0x2381ac;_0x344e63[_0x8b56('0x52')]=_[_0x8b56('0x50')](db[_0x8b56('0x93')][_0x8b56('0x4a')]);_0x344e63[_0x8b56('0x4f')]=_['keys'](_0x46adf0[_0x8b56('0x4f')]);_0x344e63[_0x8b56('0x59')]=_[_0x8b56('0x51')](_0x344e63['model'],_0x344e63[_0x8b56('0x4f')]);_0x15b785[_0x8b56('0x53')]=_[_0x8b56('0x51')](_0x344e63['model'],qs[_0x8b56('0x54')](_0x46adf0[_0x8b56('0x4f')][_0x8b56('0x54')]));_0x15b785['attributes']=_0x15b785[_0x8b56('0x53')]['length']?_0x15b785[_0x8b56('0x53')]:_0x344e63[_0x8b56('0x52')];_0x15b785[_0x8b56('0x57')]=qs[_0x8b56('0x58')](_0x46adf0[_0x8b56('0x4f')][_0x8b56('0x58')]);_0x15b785[_0x8b56('0x5b')]=qs[_0x8b56('0x59')](_['pick'](_0x46adf0[_0x8b56('0x4f')],_0x344e63[_0x8b56('0x59')]));if(_0x46adf0[_0x8b56('0x4f')]['filter']){_0x15b785['where']=_[_0x8b56('0x5c')](_0x15b785[_0x8b56('0x5b')],{'$or':_[_0x8b56('0x4e')](_0x15b785[_0x8b56('0x53')],function(_0x7da4f6){var _0x597ebc={};_0x597ebc[_0x7da4f6]={'$like':'%'+_0x46adf0['query'][_0x8b56('0x5a')]+'%'};return _0x597ebc;})});}_0x15b785=_[_0x8b56('0x5c')]({},_0x15b785,_0x46adf0[_0x8b56('0x5d')]);return _0x7c17fe[_0x8b56('0xc6')](_0x15b785);}})[_0x8b56('0x23')](function(_0x23e257){if(_0x23e257){_0x198e49=_0x23e257[_0x8b56('0x62')];if(!_0x46adf0[_0x8b56('0x4f')][_0x8b56('0x55')](_0x8b56('0x56'))){_0x15b785[_0x8b56('0x32')]=qs[_0x8b56('0x32')](_0x46adf0['query']['limit']);_0x15b785[_0x8b56('0x31')]=qs[_0x8b56('0x31')](_0x46adf0[_0x8b56('0x4f')][_0x8b56('0x31')]);}return _0x7c17fe[_0x8b56('0xc6')](_0x15b785);}})['then'](function(_0x1e47e1){if(_0x1e47e1){return _0x1e47e1?{'count':_0x198e49,'rows':_0x1e47e1}:null;}})[_0x8b56('0x23')](respondWithResult(_0x4bd43a,null))[_0x8b56('0x2d')](handleError(_0x4bd43a,null));}; \ No newline at end of file +var _0xedee=['rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','html-to-text','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','get','destroy','end','stack','name','send','render','merge','contact','agent','interaction','account','index','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','where','VIRTUAL','filter','options','include','show','params','MailServerIn','MailAccount','rawAttributes','includeAll','find','body','update','describe','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','nolimit','sort','pick','rows','removeDispositions','addAnswer','CannedAnswer','findAll','removeAnswers','ids','ListId','isNil','active','cservice','cauthentication','user','pass','cpassword','authentication','port','host','password','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MailAccounts','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','User','Owner','internal','Tags','tag','addApplications','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','Contacts','DESC','from','attachments','server/files/attachments','basename','service','auth','secure','sendMail','List\x20not\x20found','subject','attach','out','messageId','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','eml-format'];(function(_0x68cf9b,_0x250d5b){var _0x4cf44d=function(_0x4b5f11){while(--_0x4b5f11){_0x68cf9b['push'](_0x68cf9b['shift']());}};_0x4cf44d(++_0x250d5b);}(_0xedee,0xbf));var _0xeede=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xedee[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0xeede('0x0'));var rimraf=require(_0xeede('0x1'));var zipdir=require(_0xeede('0x2'));var jsonpatch=require(_0xeede('0x3'));var rp=require(_0xeede('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeede('0x5'));var util=require(_0xeede('0x6'));var path=require(_0xeede('0x7'));var sox=require(_0xeede('0x8'));var csv=require(_0xeede('0x9'));var ejs=require(_0xeede('0xa'));var fs=require('fs');var fs_extra=require(_0xeede('0xb'));var _=require(_0xeede('0xc'));var squel=require(_0xeede('0xd'));var crypto=require('crypto');var jsforce=require(_0xeede('0xe'));var deskjs=require(_0xeede('0xf'));var toCsv=require(_0xeede('0x9'));var querystring=require(_0xeede('0x10'));var Papa=require(_0xeede('0x11'));var htmlToText=require(_0xeede('0x12'));var juice=require(_0xeede('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeede('0x14'));var as=require(_0xeede('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeede('0x16'));var utils=require('../../config/utils');var config=require(_0xeede('0x17'));var licenseUtil=require(_0xeede('0x18'));var db=require(_0xeede('0x19'))['db'];config[_0xeede('0x1a')]=_[_0xeede('0x1b')](config[_0xeede('0x1a')],{'host':_0xeede('0x1c'),'port':0x18eb});var socket=require(_0xeede('0x1d'))(new Redis(config[_0xeede('0x1a')]));require('./mailAccount.socket')[_0xeede('0x1e')](socket);var jayson=require(_0xeede('0x1f'));var client=jayson[_0xeede('0x20')]['http']({'port':0x232b});function respondWithRpcPromise(_0xadeb4e,_0x29658f,_0x302c29,_0xcd2aa9){return new BPromise(function(_0x3fd759,_0x12c19e){var _0x30e8b9=_0xcd2aa9||client;return _0x30e8b9[_0xeede('0x21')](_0xadeb4e,_0x302c29)[_0xeede('0x22')](function(_0x1abd5a){logger[_0xeede('0x23')](_0xeede('0x24'),_0x29658f,'request\x20sent');logger[_0xeede('0x25')](_0xeede('0x26'),_0x29658f,_0xeede('0x27'),JSON[_0xeede('0x28')](_0x1abd5a));if(_0x1abd5a[_0xeede('0x29')]){if(_0x1abd5a[_0xeede('0x29')][_0xeede('0x2a')]===0x1f4){logger[_0xeede('0x29')](_0xeede('0x24'),_0x29658f,_0x1abd5a[_0xeede('0x29')][_0xeede('0x2b')]);return _0x12c19e(_0x1abd5a[_0xeede('0x29')][_0xeede('0x2b')]);}logger[_0xeede('0x29')](_0xeede('0x24'),_0x29658f,_0x1abd5a[_0xeede('0x29')][_0xeede('0x2b')]);return _0x3fd759(_0x1abd5a[_0xeede('0x29')][_0xeede('0x2b')]);}else{logger[_0xeede('0x23')](_0xeede('0x24'),_0x29658f,_0xeede('0x27'));_0x3fd759(_0x1abd5a[_0xeede('0x2c')]['message']);}})[_0xeede('0x2d')](function(_0x1b0729){logger[_0xeede('0x29')](_0xeede('0x24'),_0x29658f,_0x1b0729);_0x12c19e(_0x1b0729);});});}function respondWithStatusCode(_0x171220,_0x370eb9){_0x370eb9=_0x370eb9||0xcc;return function(_0x4f2107){if(_0x4f2107){return _0x171220[_0xeede('0x2e')](_0x370eb9);}return _0x171220[_0xeede('0x2f')](_0x370eb9)['end']();};}function respondWithResult(_0x5aa153,_0x57898b){_0x57898b=_0x57898b||0xc8;return function(_0x264041){if(_0x264041){return _0x5aa153[_0xeede('0x2f')](_0x57898b)[_0xeede('0x30')](_0x264041);}};}function respondWithFilteredResult(_0x20f621,_0x5e50f3){return function(_0x20026e){if(_0x20026e){var _0x30fe7d=typeof _0x5e50f3[_0xeede('0x31')]===_0xeede('0x32')&&typeof _0x5e50f3[_0xeede('0x33')]===_0xeede('0x32');var _0x5ce538=_0x20026e[_0xeede('0x34')];var _0x2ff7d2=_0x30fe7d?0x0:_0x5e50f3[_0xeede('0x31')];var _0x19b377=_0x30fe7d?_0x20026e[_0xeede('0x34')]:_0x5e50f3['offset']+_0x5e50f3[_0xeede('0x33')];var _0x1f57ad;if(_0x19b377>=_0x5ce538){_0x19b377=_0x5ce538;_0x1f57ad=0xc8;}else{_0x1f57ad=0xce;}_0x20f621[_0xeede('0x2f')](_0x1f57ad);return _0x20f621[_0xeede('0x35')](_0xeede('0x36'),_0x2ff7d2+'-'+_0x19b377+'/'+_0x5ce538)['json'](_0x20026e);}return null;};}function patchUpdates(_0x3d3a1e){return function(_0x2818d0){try{jsonpatch[_0xeede('0x37')](_0x2818d0,_0x3d3a1e,!![]);}catch(_0x1d3d90){return BPromise[_0xeede('0x38')](_0x1d3d90);}return _0x2818d0['save']();};}function saveUpdates(_0x48b3c7,_0x2e04bd){return function(_0x30a2b4){if(_0x30a2b4){return _0x30a2b4['update'](_0x48b3c7)[_0xeede('0x22')](function(_0x3b643e){return _0x3b643e;});}return null;};}function removeEntity(_0x55c660,_0x202419){return function(_0x102ef4){if(_0x102ef4){return _0x102ef4['destroy']()[_0xeede('0x22')](function(){var _0x3765a1=_0x102ef4[_0xeede('0x39')]({'plain':!![]});var _0x79059c='MailAccounts';return db['UserProfileResource'][_0xeede('0x3a')]({'where':{'type':_0x79059c,'resourceId':_0x3765a1['id']}})[_0xeede('0x22')](function(){return _0x102ef4;});})[_0xeede('0x22')](function(){_0x55c660[_0xeede('0x2f')](0xcc)[_0xeede('0x3b')]();});}};}function handleEntityNotFound(_0x1f1f85,_0x4ea89f){return function(_0x2046d4){if(!_0x2046d4){_0x1f1f85[_0xeede('0x2e')](0x194);}return _0x2046d4;};}function handleError(_0x9d9b7,_0x2246fa){_0x2246fa=_0x2246fa||0x1f4;return function(_0x3d34ed){logger[_0xeede('0x29')](_0x3d34ed[_0xeede('0x3c')]);if(_0x3d34ed[_0xeede('0x3d')]){delete _0x3d34ed[_0xeede('0x3d')];}_0x9d9b7[_0xeede('0x2f')](_0x2246fa)[_0xeede('0x3e')](_0x3d34ed);};}function getMustacheRender(_0x2286e3,_0x3f3b1f){return Mustache[_0xeede('0x3f')](_0x2286e3,_[_0xeede('0x40')](_0x3f3b1f['body'],{'contact':_0x3f3b1f[_0xeede('0x41')],'message':_0x3f3b1f[_0xeede('0x2b')],'agent':_0x3f3b1f[_0xeede('0x42')],'interaction':_0x3f3b1f[_0xeede('0x43')],'account':_0x3f3b1f[_0xeede('0x44')]}))||'';}exports[_0xeede('0x45')]=function(_0x4d918f,_0x55720f){var _0x45e735={'include':[{'model':db['MailServerIn'],'as':_0xeede('0x46')},{'model':db[_0xeede('0x47')],'as':_0xeede('0x48')},{'model':db[_0xeede('0x49')],'as':_0xeede('0x4a')}]},_0x297a75={},_0x402333={'count':0x0,'rows':[]};var _0x5a397f=_[_0xeede('0x4b')](db['MailAccount']['rawAttributes'],function(_0x1b9d09){return{'name':_0x1b9d09['fieldName'],'type':_0x1b9d09[_0xeede('0x4c')][_0xeede('0x4d')]};});_0x297a75[_0xeede('0x4e')]=_[_0xeede('0x4b')](_0x5a397f,'name');_0x297a75['query']=_[_0xeede('0x4f')](_0x4d918f[_0xeede('0x50')]);_0x297a75[_0xeede('0x51')]=_[_0xeede('0x52')](_0x297a75[_0xeede('0x4e')],_0x297a75[_0xeede('0x50')]);_0x45e735[_0xeede('0x53')]=_[_0xeede('0x52')](_0x297a75['model'],qs[_0xeede('0x54')](_0x4d918f[_0xeede('0x50')][_0xeede('0x54')]));_0x45e735['attributes']=_0x45e735[_0xeede('0x53')][_0xeede('0x55')]?_0x45e735[_0xeede('0x53')]:_0x297a75[_0xeede('0x4e')];if(!_0x4d918f[_0xeede('0x50')]['hasOwnProperty']('nolimit')){_0x45e735[_0xeede('0x33')]=qs['limit'](_0x4d918f[_0xeede('0x50')][_0xeede('0x33')]);_0x45e735['offset']=qs[_0xeede('0x31')](_0x4d918f['query'][_0xeede('0x31')]);}_0x45e735[_0xeede('0x56')]=qs['sort'](_0x4d918f[_0xeede('0x50')]['sort']);_0x45e735[_0xeede('0x57')]=qs['filters'](_['pick'](_0x4d918f['query'],_0x297a75[_0xeede('0x51')]),_0x5a397f);if(_0x4d918f[_0xeede('0x50')]['filter']){_0x45e735[_0xeede('0x57')]=_[_0xeede('0x40')](_0x45e735[_0xeede('0x57')],{'$or':_['map'](_0x5a397f,function(_0x207a83){if(_0x207a83[_0xeede('0x4c')]!==_0xeede('0x58')){var _0x323e8a={};_0x323e8a[_0x207a83['name']]={'$like':'%'+_0x4d918f[_0xeede('0x50')][_0xeede('0x59')]+'%'};return _0x323e8a;}})});}_0x45e735=_[_0xeede('0x40')]({},_0x45e735,_0x4d918f[_0xeede('0x5a')]);var _0x3c6244={'where':_0x45e735[_0xeede('0x57')]};return db['MailAccount'][_0xeede('0x34')](_0x3c6244)[_0xeede('0x22')](function(_0x3dbb85){_0x402333[_0xeede('0x34')]=_0x3dbb85;if(_0x4d918f[_0xeede('0x50')]['includeAll']){_0x45e735[_0xeede('0x5b')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x45e735);})['then'](function(_0x1f3f0d){_0x402333['rows']=_0x1f3f0d;return _0x402333;})[_0xeede('0x22')](respondWithFilteredResult(_0x55720f,_0x45e735))['catch'](handleError(_0x55720f,null));};exports[_0xeede('0x5c')]=function(_0x3cc517,_0x4a8815){var _0x218e61={'raw':![],'where':{'id':_0x3cc517[_0xeede('0x5d')]['id']},'include':[{'model':db[_0xeede('0x5e')],'as':_0xeede('0x46')},{'model':db[_0xeede('0x47')],'as':_0xeede('0x48')},{'model':db[_0xeede('0x49')],'as':_0xeede('0x4a')}]},_0xb9f24a={};_0xb9f24a[_0xeede('0x4e')]=_[_0xeede('0x4f')](db[_0xeede('0x5f')][_0xeede('0x60')]);_0xb9f24a['query']=_[_0xeede('0x4f')](_0x3cc517['query']);_0xb9f24a[_0xeede('0x51')]=_[_0xeede('0x52')](_0xb9f24a[_0xeede('0x4e')],_0xb9f24a[_0xeede('0x50')]);_0x218e61[_0xeede('0x53')]=_[_0xeede('0x52')](_0xb9f24a[_0xeede('0x4e')],qs[_0xeede('0x54')](_0x3cc517[_0xeede('0x50')][_0xeede('0x54')]));_0x218e61[_0xeede('0x53')]=_0x218e61['attributes'][_0xeede('0x55')]?_0x218e61['attributes']:_0xb9f24a[_0xeede('0x4e')];if(_0x3cc517[_0xeede('0x50')][_0xeede('0x61')]){_0x218e61[_0xeede('0x5b')]=[{'all':!![]}];}_0x218e61=_[_0xeede('0x40')]({},_0x218e61,_0x3cc517[_0xeede('0x5a')]);return db['MailAccount'][_0xeede('0x62')](_0x218e61)[_0xeede('0x22')](handleEntityNotFound(_0x4a8815,null))[_0xeede('0x22')](respondWithResult(_0x4a8815,null))['catch'](handleError(_0x4a8815,null));};exports['update']=function(_0x482ba0,_0x1f64c4){if(_0x482ba0[_0xeede('0x63')]['id']){delete _0x482ba0[_0xeede('0x63')]['id'];}return db[_0xeede('0x5f')][_0xeede('0x62')]({'where':{'id':_0x482ba0['params']['id']},'include':[{'model':db[_0xeede('0x5e')],'as':'Imap'},{'model':db[_0xeede('0x47')],'as':_0xeede('0x48')},{'model':db['Pause'],'as':_0xeede('0x4a')}]})[_0xeede('0x22')](handleEntityNotFound(_0x1f64c4,null))[_0xeede('0x22')](saveUpdates(_0x482ba0[_0xeede('0x63')],null))[_0xeede('0x22')](function(_0x2b9e58){if(_0x2b9e58&&_0x482ba0[_0xeede('0x63')]['Imap']){return db[_0xeede('0x5e')][_0xeede('0x64')](_0x482ba0[_0xeede('0x63')][_0xeede('0x46')],{'where':{'MailAccountId':_0x2b9e58['id']}})[_0xeede('0x22')](function(){return _0x2b9e58;});}return _0x2b9e58;})[_0xeede('0x22')](function(_0xd66719){if(_0xd66719&&_0x482ba0[_0xeede('0x63')]['Smtp']){return db[_0xeede('0x47')][_0xeede('0x64')](_0x482ba0['body'][_0xeede('0x48')],{'where':{'MailAccountId':_0xd66719['id']}})[_0xeede('0x22')](function(){return _0xd66719;});}return _0xd66719;})[_0xeede('0x22')](respondWithResult(_0x1f64c4,null))[_0xeede('0x2d')](handleError(_0x1f64c4,null));};exports['describe']=function(_0xe520c5,_0x11e436){return db['MailAccount'][_0xeede('0x65')]()[_0xeede('0x22')](respondWithResult(_0x11e436,null))['catch'](handleError(_0x11e436,null));};exports['addDisposition']=function(_0x326f6b,_0x1d66d4,_0x5ea9bd){if(_0x326f6b[_0xeede('0x63')]['id']){delete _0x326f6b['body']['id'];}return db['MailAccount'][_0xeede('0x62')]({'where':{'id':_0x326f6b[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x1d66d4,null))['then'](function(_0x114c38){if(_0x114c38){_0x326f6b['body'][_0xeede('0x66')]=_0x114c38['id'];return db[_0xeede('0x67')][_0xeede('0x68')](_0x326f6b['body']);}})[_0xeede('0x22')](respondWithResult(_0x1d66d4,null))['catch'](handleError(_0x1d66d4,null));};exports[_0xeede('0x69')]=function(_0x19c003,_0x20f216,_0x5b0705){var _0x4e4a9={'raw':![],'where':{}};var _0xc1c895={};var _0x1e229e={'count':0x0,'rows':[]};return db[_0xeede('0x5f')][_0xeede('0x6a')]({'where':{'id':_0x19c003[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x20f216,null))[_0xeede('0x22')](function(_0x5ac2d0){if(_0x5ac2d0){_0xc1c895['model']=_[_0xeede('0x4f')](db[_0xeede('0x67')][_0xeede('0x60')]);_0xc1c895[_0xeede('0x50')]=_[_0xeede('0x4f')](_0x19c003[_0xeede('0x50')]);_0xc1c895[_0xeede('0x51')]=_[_0xeede('0x52')](_0xc1c895[_0xeede('0x4e')],_0xc1c895[_0xeede('0x50')]);_0x4e4a9[_0xeede('0x53')]=_[_0xeede('0x52')](_0xc1c895[_0xeede('0x4e')],qs['fields'](_0x19c003['query'][_0xeede('0x54')]));_0x4e4a9[_0xeede('0x53')]=_0x4e4a9[_0xeede('0x53')]['length']?_0x4e4a9[_0xeede('0x53')]:_0xc1c895[_0xeede('0x4e')];if(!_0x19c003['query'][_0xeede('0x6b')](_0xeede('0x6c'))){_0x4e4a9[_0xeede('0x33')]=qs[_0xeede('0x33')](_0x19c003[_0xeede('0x50')][_0xeede('0x33')]);_0x4e4a9['offset']=qs[_0xeede('0x31')](_0x19c003['query'][_0xeede('0x31')]);}_0x4e4a9[_0xeede('0x56')]=qs[_0xeede('0x6d')](_0x19c003[_0xeede('0x50')][_0xeede('0x6d')]);_0x4e4a9['where']=qs['filters'](_[_0xeede('0x6e')](_0x19c003[_0xeede('0x50')],_0xc1c895[_0xeede('0x51')]));_0x4e4a9[_0xeede('0x57')][_0xeede('0x66')]=_0x5ac2d0['id'];if(_0x19c003[_0xeede('0x50')][_0xeede('0x59')]){_0x4e4a9['where']=_[_0xeede('0x40')](_0x4e4a9[_0xeede('0x57')],{'$or':_[_0xeede('0x4b')](_0x4e4a9[_0xeede('0x53')],function(_0x120293){var _0x221b99={};_0x221b99[_0x120293]={'$like':'%'+_0x19c003[_0xeede('0x50')][_0xeede('0x59')]+'%'};return _0x221b99;})});}_0x4e4a9=_[_0xeede('0x40')]({},_0x4e4a9,_0x19c003[_0xeede('0x5a')]);return db[_0xeede('0x67')]['count']({'where':_0x4e4a9[_0xeede('0x57')]})['then'](function(_0x35ccfa){_0x1e229e['count']=_0x35ccfa;if(_0x19c003[_0xeede('0x50')][_0xeede('0x61')]){_0x4e4a9[_0xeede('0x5b')]=[{'all':!![]}];}return db[_0xeede('0x67')]['findAll'](_0x4e4a9);})[_0xeede('0x22')](function(_0x2927d2){_0x1e229e[_0xeede('0x6f')]=_0x2927d2;return _0x1e229e;});}})[_0xeede('0x22')](respondWithFilteredResult(_0x20f216,_0x4e4a9))[_0xeede('0x2d')](handleError(_0x20f216,null));};exports['removeDispositions']=function(_0x25eb4e,_0x42e2bc,_0x44e9b3){return db[_0xeede('0x5f')][_0xeede('0x62')]({'where':{'id':_0x25eb4e[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x42e2bc,null))[_0xeede('0x22')](function(_0x292484){if(_0x292484){return _0x292484[_0xeede('0x70')](_0x25eb4e[_0xeede('0x50')]['ids']);}})[_0xeede('0x22')](respondWithStatusCode(_0x42e2bc,null))['catch'](handleError(_0x42e2bc,null));};exports[_0xeede('0x71')]=function(_0x516e95,_0x4fa231,_0x3e6ffa){if(_0x516e95['body']['id']){delete _0x516e95[_0xeede('0x63')]['id'];}return db[_0xeede('0x5f')][_0xeede('0x62')]({'where':{'id':_0x516e95[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x4fa231,null))[_0xeede('0x22')](function(_0x27b20e){if(_0x27b20e){_0x516e95['body']['MailAccountId']=_0x27b20e['id'];return db[_0xeede('0x72')][_0xeede('0x68')](_0x516e95[_0xeede('0x63')]);}})['then'](respondWithResult(_0x4fa231,null))['catch'](handleError(_0x4fa231,null));};exports['getAnswers']=function(_0x3d11ce,_0x252b4f,_0x3dd56a){var _0x58d0cf={'raw':![],'where':{}};var _0x885bab={};var _0x208dc1={'count':0x0,'rows':[]};return db[_0xeede('0x5f')]['findOne']({'where':{'id':_0x3d11ce['params']['id']}})['then'](handleEntityNotFound(_0x252b4f,null))['then'](function(_0x385caf){if(_0x385caf){_0x885bab[_0xeede('0x4e')]=_['keys'](db['CannedAnswer'][_0xeede('0x60')]);_0x885bab[_0xeede('0x50')]=_[_0xeede('0x4f')](_0x3d11ce['query']);_0x885bab[_0xeede('0x51')]=_[_0xeede('0x52')](_0x885bab[_0xeede('0x4e')],_0x885bab[_0xeede('0x50')]);_0x58d0cf['attributes']=_[_0xeede('0x52')](_0x885bab[_0xeede('0x4e')],qs[_0xeede('0x54')](_0x3d11ce['query'][_0xeede('0x54')]));_0x58d0cf['attributes']=_0x58d0cf[_0xeede('0x53')][_0xeede('0x55')]?_0x58d0cf[_0xeede('0x53')]:_0x885bab[_0xeede('0x4e')];if(!_0x3d11ce[_0xeede('0x50')]['hasOwnProperty'](_0xeede('0x6c'))){_0x58d0cf[_0xeede('0x33')]=qs['limit'](_0x3d11ce[_0xeede('0x50')][_0xeede('0x33')]);_0x58d0cf[_0xeede('0x31')]=qs[_0xeede('0x31')](_0x3d11ce[_0xeede('0x50')][_0xeede('0x31')]);}_0x58d0cf[_0xeede('0x56')]=qs[_0xeede('0x6d')](_0x3d11ce[_0xeede('0x50')][_0xeede('0x6d')]);_0x58d0cf['where']=qs['filters'](_['pick'](_0x3d11ce[_0xeede('0x50')],_0x885bab[_0xeede('0x51')]));_0x58d0cf[_0xeede('0x57')][_0xeede('0x66')]=_0x385caf['id'];if(_0x3d11ce['query']['filter']){_0x58d0cf['where']=_[_0xeede('0x40')](_0x58d0cf[_0xeede('0x57')],{'$or':_[_0xeede('0x4b')](_0x58d0cf['attributes'],function(_0x4e1f90){var _0x3df5d0={};_0x3df5d0[_0x4e1f90]={'$like':'%'+_0x3d11ce[_0xeede('0x50')][_0xeede('0x59')]+'%'};return _0x3df5d0;})});}_0x58d0cf=_[_0xeede('0x40')]({},_0x58d0cf,_0x3d11ce['options']);return db[_0xeede('0x72')]['count']({'where':_0x58d0cf['where']})[_0xeede('0x22')](function(_0x9b7ea3){_0x208dc1[_0xeede('0x34')]=_0x9b7ea3;if(_0x3d11ce[_0xeede('0x50')][_0xeede('0x61')]){_0x58d0cf['include']=[{'all':!![]}];}return db[_0xeede('0x72')][_0xeede('0x73')](_0x58d0cf);})[_0xeede('0x22')](function(_0x2264c8){_0x208dc1[_0xeede('0x6f')]=_0x2264c8;return _0x208dc1;});}})[_0xeede('0x22')](respondWithFilteredResult(_0x252b4f,_0x58d0cf))[_0xeede('0x2d')](handleError(_0x252b4f,null));};exports[_0xeede('0x74')]=function(_0x38c129,_0x268189,_0x2d4292){return db[_0xeede('0x5f')][_0xeede('0x62')]({'where':{'id':_0x38c129[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x268189,null))['then'](function(_0x5b60a9){if(_0x5b60a9){return _0x5b60a9['removeAnswers'](_0x38c129[_0xeede('0x50')][_0xeede('0x75')]);}})[_0xeede('0x22')](respondWithStatusCode(_0x268189,null))['catch'](handleError(_0x268189,null));};exports[_0xeede('0x68')]=function(_0x4188a0,_0xf478d2){var _0x46a086={'name':_0x4188a0['body'][_0xeede('0x3d')],'key':_0x4188a0['body'][_0xeede('0x4d')],'email':_0x4188a0[_0xeede('0x63')]['email'],'ListId':_0x4188a0[_0xeede('0x63')][_0xeede('0x76')],'active':!_[_0xeede('0x77')](_0x4188a0[_0xeede('0x63')][_0xeede('0x78')])?_0x4188a0[_0xeede('0x63')][_0xeede('0x78')]:!![],'description':_0x4188a0[_0xeede('0x63')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0xeede('0x77')](_0x4188a0[_0xeede('0x63')][_0xeede('0x79')])){if(_0x4188a0[_0xeede('0x63')][_0xeede('0x7a')]){_0x46a086[_0xeede('0x46')][_0xeede('0x7b')]=_0x46a086[_0xeede('0x48')][_0xeede('0x7b')]=_0x4188a0[_0xeede('0x63')]['cuser'];_0x46a086['Imap']['password']=_0x46a086['Smtp'][_0xeede('0x7c')]=_0x4188a0[_0xeede('0x63')][_0xeede('0x7d')];}else{_0x46a086[_0xeede('0x46')][_0xeede('0x7e')]=_0x46a086['Smtp'][_0xeede('0x7e')]=![];}_0x46a086[_0xeede('0x46')]['host']=_0x4188a0['body'][_0xeede('0x46')]['host'];_0x46a086[_0xeede('0x46')][_0xeede('0x7f')]=_0x4188a0[_0xeede('0x63')][_0xeede('0x46')][_0xeede('0x7f')];_0x46a086[_0xeede('0x48')][_0xeede('0x80')]=_0x4188a0[_0xeede('0x63')][_0xeede('0x48')][_0xeede('0x80')];_0x46a086[_0xeede('0x48')]['port']=_0x4188a0[_0xeede('0x63')][_0xeede('0x48')][_0xeede('0x7f')];}else{_0x46a086['Imap']['service']=_0x46a086['Smtp']['service']=_0x4188a0[_0xeede('0x63')]['cservice'];_0x46a086['Imap'][_0xeede('0x7b')]=_0x46a086[_0xeede('0x48')][_0xeede('0x7b')]=_0x4188a0[_0xeede('0x63')]['cuser'];_0x46a086[_0xeede('0x46')][_0xeede('0x81')]=_0x46a086[_0xeede('0x48')][_0xeede('0x7c')]=_0x4188a0[_0xeede('0x63')][_0xeede('0x7d')];}return db['MailAccount'][_0xeede('0x68')](_0x46a086,{'include':[{'model':db[_0xeede('0x47')],'as':_0xeede('0x48')},{'model':db[_0xeede('0x5e')],'as':'Imap'}]})['then'](function(_0x217398){var _0x53de8f=_0x4188a0['user'][_0xeede('0x39')]({'plain':!![]});if(!_0x53de8f)throw new Error(_0xeede('0x82'));if(_0x53de8f['role']===_0xeede('0x7b')){var _0x108f0c=_0x217398['get']({'plain':!![]});return db[_0xeede('0x83')][_0xeede('0x62')]({'where':{'name':_0xeede('0x84'),'userProfileId':_0x53de8f['userProfileId']},'raw':!![]})[_0xeede('0x22')](function(_0x52d3ff){if(_0x52d3ff&&_0x52d3ff['autoAssociation']===0x0){return db['UserProfileResource'][_0xeede('0x68')]({'name':_0x108f0c[_0xeede('0x3d')],'resourceId':_0x108f0c['id'],'type':_0x52d3ff[_0xeede('0x3d')],'sectionId':_0x52d3ff['id']},{})[_0xeede('0x22')](function(){return _0x217398;});}else{return _0x217398;}})[_0xeede('0x2d')](function(_0x632db0){logger['error'](_0xeede('0x85'),_0x632db0);throw _0x632db0;});}return _0x217398;})[_0xeede('0x22')](respondWithResult(_0xf478d2,0xc9))['catch'](handleError(_0xf478d2,null));};exports[_0xeede('0x86')]=function(_0x28c4d9,_0x3b633b,_0x3de351){return db['MailAccount'][_0xeede('0x6a')]({'where':{'id':_0x28c4d9[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x3b633b,null))[_0xeede('0x22')](function(_0x2527c7){if(_0x2527c7){return _0x2527c7['getImap']();}return null;})[_0xeede('0x22')](respondWithResult(_0x3b633b,null))[_0xeede('0x2d')](handleError(_0x3b633b,null));};exports[_0xeede('0x87')]=function(_0x50bc03,_0x68edf3,_0x37f52b){if(_0x50bc03[_0xeede('0x63')]['id']){delete _0x50bc03[_0xeede('0x63')]['id'];}return db['MailAccount'][_0xeede('0x62')]({'where':{'id':_0x50bc03[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x68edf3,null))['then'](function(_0x5806d3){if(_0x5806d3){_0x50bc03['body'][_0xeede('0x66')]=_0x5806d3['id'];return db[_0xeede('0x5e')][_0xeede('0x68')](_0x50bc03['body']);}})[_0xeede('0x22')](respondWithResult(_0x68edf3,null))[_0xeede('0x2d')](handleError(_0x68edf3,null));};exports['removeImap']=function(_0x400bd7,_0x4d8ef1,_0x1a8a2a){return db[_0xeede('0x5f')][_0xeede('0x6a')]({'where':{'id':_0x400bd7[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x4d8ef1,null))['then'](function(_0x21de5e){if(_0x21de5e){return _0x21de5e['setImap'](null);}return null;})[_0xeede('0x22')](respondWithStatusCode(_0x4d8ef1,null))[_0xeede('0x2d')](handleError(_0x4d8ef1,null));};exports[_0xeede('0x88')]=function(_0x412cff,_0x5f0a94,_0x579fd0){return db['MailAccount'][_0xeede('0x6a')]({'where':{'id':_0x412cff[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x5f0a94,null))[_0xeede('0x22')](function(_0x4d6bba){if(_0x4d6bba){return _0x4d6bba[_0xeede('0x88')]();}return null;})[_0xeede('0x22')](respondWithResult(_0x5f0a94,null))[_0xeede('0x2d')](handleError(_0x5f0a94,null));};exports[_0xeede('0x89')]=function(_0x2daec0,_0x340b44,_0x3283f0){if(_0x2daec0[_0xeede('0x63')]['id']){delete _0x2daec0[_0xeede('0x63')]['id'];}return db[_0xeede('0x5f')][_0xeede('0x62')]({'where':{'id':_0x2daec0['params']['id']}})['then'](handleEntityNotFound(_0x340b44,null))[_0xeede('0x22')](function(_0x11590e){if(_0x11590e){_0x2daec0[_0xeede('0x63')]['MailAccountId']=_0x11590e['id'];return db[_0xeede('0x47')][_0xeede('0x68')](_0x2daec0[_0xeede('0x63')]);}})['then'](respondWithResult(_0x340b44,null))[_0xeede('0x2d')](handleError(_0x340b44,null));};exports['removeSmtp']=function(_0x3dfd7e,_0x39d2a2,_0x48976d){return db[_0xeede('0x5f')][_0xeede('0x6a')]({'where':{'id':_0x3dfd7e[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x39d2a2,null))[_0xeede('0x22')](function(_0x55e4fc){if(_0x55e4fc){return _0x55e4fc[_0xeede('0x8a')](null);}return null;})[_0xeede('0x22')](respondWithStatusCode(_0x39d2a2,null))[_0xeede('0x2d')](handleError(_0x39d2a2,null));};exports[_0xeede('0x8b')]=function(_0x574042,_0x61430b,_0x50c501){return db[_0xeede('0x8c')][_0xeede('0x62')]({'where':{'id':_0x574042[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x61430b,null))['then'](function(_0x291492){if(_0x291492){return _0x291492[_0xeede('0x8b')](_0x574042[_0xeede('0x63')]['ids'],_[_0xeede('0x8d')](_0x574042[_0xeede('0x63')],[_0xeede('0x75'),'id'])||{});}})[_0xeede('0x22')](respondWithResult(_0x61430b,null))[_0xeede('0x2d')](handleError(_0x61430b,null));};exports[_0xeede('0x8e')]=function(_0x5d7d6f,_0x11a918,_0x48bef1){var _0x3a53d3={'raw':![],'where':{}};var _0xbef590={};var _0xe42168={'count':0x0,'rows':[]};return db[_0xeede('0x5f')]['findOne']({'where':{'id':_0x5d7d6f[_0xeede('0x5d')]['id']}})['then'](handleEntityNotFound(_0x11a918,null))[_0xeede('0x22')](function(_0x2469f7){if(_0x2469f7){_0xbef590[_0xeede('0x4e')]=_['keys'](db[_0xeede('0x8c')]['rawAttributes']);_0xbef590[_0xeede('0x50')]=_[_0xeede('0x4f')](_0x5d7d6f[_0xeede('0x50')]);_0xbef590[_0xeede('0x51')]=_[_0xeede('0x52')](_0xbef590['model'],_0xbef590[_0xeede('0x50')]);_0x3a53d3['attributes']=_[_0xeede('0x52')](_0xbef590[_0xeede('0x4e')],qs[_0xeede('0x54')](_0x5d7d6f[_0xeede('0x50')][_0xeede('0x54')]));_0x3a53d3['attributes']=_0x3a53d3[_0xeede('0x53')][_0xeede('0x55')]?_0x3a53d3['attributes']:_0xbef590[_0xeede('0x4e')];if(!_0x5d7d6f[_0xeede('0x50')]['hasOwnProperty'](_0xeede('0x6c'))){_0x3a53d3['limit']=qs[_0xeede('0x33')](_0x5d7d6f[_0xeede('0x50')]['limit']);_0x3a53d3[_0xeede('0x31')]=qs[_0xeede('0x31')](_0x5d7d6f[_0xeede('0x50')][_0xeede('0x31')]);}_0x3a53d3[_0xeede('0x56')]=qs[_0xeede('0x6d')](_0x5d7d6f[_0xeede('0x50')][_0xeede('0x6d')]);_0x3a53d3[_0xeede('0x57')]=qs['filters'](_[_0xeede('0x6e')](_0x5d7d6f[_0xeede('0x50')],_0xbef590[_0xeede('0x51')]));_0x3a53d3[_0xeede('0x57')]['MailAccountId']=_0x2469f7['id'];if(_0x5d7d6f['query']['filter']){_0x3a53d3[_0xeede('0x57')]=_['merge'](_0x3a53d3['where'],{'$or':_[_0xeede('0x4b')](_0x3a53d3[_0xeede('0x53')],function(_0x57938f){var _0x26f44d={};_0x26f44d[_0x57938f]={'$like':'%'+_0x5d7d6f['query']['filter']+'%'};return _0x26f44d;})});}_0x3a53d3=_['merge']({},_0x3a53d3,_0x5d7d6f['options']);return db[_0xeede('0x8c')][_0xeede('0x34')]({'where':_0x3a53d3[_0xeede('0x57')]})['then'](function(_0x1aafbe){_0xe42168[_0xeede('0x34')]=_0x1aafbe;if(_0x5d7d6f['query'][_0xeede('0x61')]){_0x3a53d3[_0xeede('0x5b')]=[{'model':db[_0xeede('0x8f')],'as':'Contact','required':![]},{'model':db[_0xeede('0x90')],'as':_0xeede('0x91'),'attributes':['name','fullname',_0xeede('0x92')],'required':![]},{'model':db['Tag'],'as':_0xeede('0x93'),'attributes':['id',_0xeede('0x3d'),'color'],'where':_0x5d7d6f['query'][_0xeede('0x94')]?{'id':_0x5d7d6f['query'][_0xeede('0x94')]}:undefined,'required':_0x5d7d6f[_0xeede('0x50')][_0xeede('0x94')]?!![]:![]}];}return db[_0xeede('0x8c')]['findAll'](_0x3a53d3);})['then'](function(_0x5596cd){_0xe42168[_0xeede('0x6f')]=_0x5596cd;return _0xe42168;});}})[_0xeede('0x22')](respondWithFilteredResult(_0x11a918,_0x3a53d3))[_0xeede('0x2d')](handleError(_0x11a918,null));};exports[_0xeede('0x95')]=function(_0x14fedd,_0x5e12f4,_0x115b60){return db[_0xeede('0x5f')][_0xeede('0x6a')]({'where':{'id':_0x14fedd[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x5e12f4,null))['then'](function(_0x3b193d){if(_0x3b193d){return db['sequelize'][_0xeede('0x96')](function(_0x2a0269){return db['MailApplication'][_0xeede('0x3a')]({'where':{'MailAccountId':_0x14fedd['params']['id']},'transaction':_0x2a0269})[_0xeede('0x22')](function(_0x501a42){var _0x32b1a9=_[_0xeede('0x4b')](_0x14fedd[_0xeede('0x63')],function(_0x12b0f6){_0x12b0f6[_0xeede('0x66')]=_0x14fedd[_0xeede('0x5d')]['id'];return _0x12b0f6;});return db[_0xeede('0x97')][_0xeede('0x98')](_0x32b1a9,{'transaction':_0x2a0269});});})[_0xeede('0x22')](function(){return db[_0xeede('0x97')][_0xeede('0x99')]({'where':{'MailAccountId':_0x14fedd[_0xeede('0x5d')]['id']},'order':_0xeede('0x9a')});});}})[_0xeede('0x22')](respondWithResult(_0x5e12f4,null))[_0xeede('0x2d')](handleError(_0x5e12f4,null));};exports[_0xeede('0x9b')]=function(_0x57e38b,_0x312c67,_0x404b41){var _0x5be2d9={};var _0x48581c={};var _0x286796;var _0x188493;return db[_0xeede('0x5f')][_0xeede('0x6a')]({'where':{'id':_0x57e38b[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x312c67,null))['then'](function(_0xf9f303){if(_0xf9f303){_0x286796=_0xf9f303;_0x48581c[_0xeede('0x4e')]=_[_0xeede('0x4f')](db[_0xeede('0x97')][_0xeede('0x60')]);_0x48581c[_0xeede('0x50')]=_[_0xeede('0x4f')](_0x57e38b[_0xeede('0x50')]);_0x48581c['filters']=_[_0xeede('0x52')](_0x48581c[_0xeede('0x4e')],_0x48581c[_0xeede('0x50')]);_0x5be2d9[_0xeede('0x53')]=_[_0xeede('0x52')](_0x48581c['model'],qs[_0xeede('0x54')](_0x57e38b['query'][_0xeede('0x54')]));_0x5be2d9[_0xeede('0x53')]=_0x5be2d9[_0xeede('0x53')][_0xeede('0x55')]?_0x5be2d9[_0xeede('0x53')]:_0x48581c[_0xeede('0x4e')];_0x5be2d9[_0xeede('0x56')]=qs['sort'](_0x57e38b[_0xeede('0x50')]['sort']);_0x5be2d9[_0xeede('0x57')]=qs[_0xeede('0x51')](_['pick'](_0x57e38b['query'],_0x48581c[_0xeede('0x51')]));if(_0x57e38b[_0xeede('0x50')][_0xeede('0x59')]){_0x5be2d9[_0xeede('0x57')]=_[_0xeede('0x40')](_0x5be2d9[_0xeede('0x57')],{'$or':_['map'](_0x5be2d9[_0xeede('0x53')],function(_0x4a9a1b){var _0x2cb589={};_0x2cb589[_0x4a9a1b]={'$like':'%'+_0x57e38b[_0xeede('0x50')][_0xeede('0x59')]+'%'};return _0x2cb589;})});}_0x5be2d9=_[_0xeede('0x40')]({},_0x5be2d9,_0x57e38b[_0xeede('0x5a')]);return _0x286796['getApplications'](_0x5be2d9);}})[_0xeede('0x22')](function(_0x4db5b4){if(_0x4db5b4){_0x188493=_0x4db5b4[_0xeede('0x55')];if(!_0x57e38b[_0xeede('0x50')][_0xeede('0x6b')](_0xeede('0x6c'))){_0x5be2d9[_0xeede('0x33')]=qs[_0xeede('0x33')](_0x57e38b['query']['limit']);_0x5be2d9[_0xeede('0x31')]=qs[_0xeede('0x31')](_0x57e38b[_0xeede('0x50')][_0xeede('0x31')]);}return _0x286796[_0xeede('0x9b')](_0x5be2d9);}})[_0xeede('0x22')](function(_0x44d0db){if(_0x44d0db){return _0x44d0db?{'count':_0x188493,'rows':_0x44d0db}:null;}})['then'](respondWithResult(_0x312c67,null))[_0xeede('0x2d')](handleError(_0x312c67,null));};exports[_0xeede('0x9c')]=function(_0x10629d,_0x537cad,_0x1f530c){var _0x5499fa={'raw':!![],'where':{}};var _0x37f581={};var _0x57dd8b={'count':0x0,'rows':[]};return db[_0xeede('0x5f')][_0xeede('0x6a')]({'where':{'id':_0x10629d['params']['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x537cad,null))['then'](function(_0x5da27b){if(_0x5da27b){_0x37f581[_0xeede('0x4e')]=_[_0xeede('0x4f')](db[_0xeede('0x9d')][_0xeede('0x60')]);_0x37f581[_0xeede('0x50')]=_[_0xeede('0x4f')](_0x10629d[_0xeede('0x50')]);_0x37f581['filters']=_['intersection'](_0x37f581[_0xeede('0x4e')],_0x37f581[_0xeede('0x50')]);_0x5499fa[_0xeede('0x53')]=_[_0xeede('0x52')](_0x37f581[_0xeede('0x4e')],qs[_0xeede('0x54')](_0x10629d[_0xeede('0x50')]['fields']));_0x5499fa['attributes']=_0x5499fa[_0xeede('0x53')][_0xeede('0x55')]?_0x5499fa['attributes']:_0x37f581[_0xeede('0x4e')];if(!_0x10629d[_0xeede('0x50')][_0xeede('0x6b')](_0xeede('0x6c'))){_0x5499fa['limit']=qs[_0xeede('0x33')](_0x10629d[_0xeede('0x50')][_0xeede('0x33')]);_0x5499fa[_0xeede('0x31')]=qs[_0xeede('0x31')](_0x10629d[_0xeede('0x50')][_0xeede('0x31')]);}_0x5499fa['order']=qs[_0xeede('0x6d')](_0x10629d[_0xeede('0x50')]['sort']);_0x5499fa[_0xeede('0x57')]=qs['filters'](_[_0xeede('0x6e')](_0x10629d['query'],_0x37f581[_0xeede('0x51')]));_0x5499fa[_0xeede('0x57')][_0xeede('0x66')]=_0x5da27b['id'];if(_0x10629d[_0xeede('0x50')][_0xeede('0x59')]){_0x5499fa[_0xeede('0x57')]=_['merge'](_0x5499fa[_0xeede('0x57')],{'$or':_[_0xeede('0x4b')](_0x5499fa[_0xeede('0x53')],function(_0x2b7874){var _0x1eccff={};_0x1eccff[_0x2b7874]={'$like':'%'+_0x10629d[_0xeede('0x50')][_0xeede('0x59')]+'%'};return _0x1eccff;})});}if(_0x10629d['query'][_0xeede('0x9e')]){var _0x315313=_0x10629d[_0xeede('0x50')]['$gte'][_0xeede('0x9f')](',');var _0x3f48ac={};_0x3f48ac[_0x315313[0x0]]={'$gte':moment(_0x315313[0x1])[_0xeede('0xa0')](_0xeede('0xa1'))};_0x5499fa[_0xeede('0x57')]=_[_0xeede('0x40')](_0x5499fa['where'],_0x3f48ac);}_0x5499fa=_['merge']({},_0x5499fa,_0x10629d[_0xeede('0x5a')]);return db[_0xeede('0x9d')][_0xeede('0x34')]({'where':_0x5499fa[_0xeede('0x57')]})[_0xeede('0x22')](function(_0x57e188){_0x57dd8b[_0xeede('0x34')]=_0x57e188;if(_0x10629d['query'][_0xeede('0x61')]){_0x5499fa[_0xeede('0x5b')]=[{'all':!![]}];}return db[_0xeede('0x9d')]['findAll'](_0x5499fa);})['then'](function(_0x45cccb){if(_0x10629d['query']['inlineCss']===_0xeede('0xa2')){for(var _0x4bcc4d=0x0;_0x4bcc4d<_0x45cccb[_0xeede('0x55')];_0x4bcc4d++){_0x45cccb[_0x4bcc4d][_0xeede('0x63')]=juice(_0x45cccb[_0x4bcc4d][_0xeede('0x63')]);}}_0x57dd8b['rows']=_0x45cccb;return _0x57dd8b;});}})[_0xeede('0x22')](respondWithFilteredResult(_0x537cad,_0x5499fa))[_0xeede('0x2d')](handleError(_0x537cad,null));};exports['send']=function(_0x2ab7f1,_0x508bc2,_0x3b7ec5){var _0x485696,_0x56b673={},_0x199cf7;if(_0x2ab7f1[_0xeede('0x63')]['to']){_0x199cf7=_0x2ab7f1[_0xeede('0x63')]['to']['split'](',')[0x0];}return db['MailAccount'][_0xeede('0x62')]({'where':{'id':_0x2ab7f1[_0xeede('0x5d')]['id']},'include':[{'model':db[_0xeede('0xa3')],'as':_0xeede('0xa4'),'include':[{'model':db[_0xeede('0x8f')],'as':_0xeede('0xa5'),'where':{'email':_0x199cf7},'limit':0x1,'order':[['updatedAt',_0xeede('0xa6')]]}]},{'model':db[_0xeede('0x47')],'as':_0xeede('0x48'),'raw':!![]}]})['then'](handleEntityNotFound(_0x508bc2,null))[_0xeede('0x22')](function(_0x5cf9ad){if(_0x5cf9ad){_0x485696=_0x5cf9ad;if(_0x5cf9ad[_0xeede('0x48')]){if(_['isNil'](_0x2ab7f1[_0xeede('0x63')][_0xeede('0xa7')])){_0x2ab7f1['body'][_0xeede('0xa7')]=util[_0xeede('0xa0')]('%s\x20<%s>',_0x5cf9ad[_0xeede('0x3d')],_0x5cf9ad['email']||_0x5cf9ad[_0xeede('0x48')][_0xeede('0x7b')]);}if(_0x2ab7f1[_0xeede('0x63')]['attachments']&&_0x2ab7f1['body']['attachments'][_0xeede('0x55')]){for(var _0x3c5a72=0x0;_0x3c5a72<_0x2ab7f1[_0xeede('0x63')][_0xeede('0xa8')]['length'];_0x3c5a72+=0x1){_0x2ab7f1[_0xeede('0x63')][_0xeede('0xa8')][_0x3c5a72]={'filename':_0x2ab7f1[_0xeede('0x63')][_0xeede('0xa8')][_0x3c5a72][_0xeede('0x3d')],'path':path['join'](config['root'],_0xeede('0xa9'),_0x2ab7f1['body'][_0xeede('0xa8')][_0x3c5a72][_0xeede('0xaa')])};}}var _0x49953a={'tls':{'rejectUnauthorized':![]}};if(_[_0xeede('0x77')](_0x5cf9ad['Smtp'][_0xeede('0xab')])){if(_0x5cf9ad[_0xeede('0x48')]['authentication']){_0x49953a[_0xeede('0xac')]={'user':_0x5cf9ad['Smtp'][_0xeede('0x7b')],'pass':_0x5cf9ad[_0xeede('0x48')][_0xeede('0x7c')]};}_0x49953a['host']=_0x5cf9ad[_0xeede('0x48')][_0xeede('0x80')];_0x49953a[_0xeede('0x7f')]=_0x5cf9ad[_0xeede('0x48')]['port'];_0x49953a[_0xeede('0xad')]=_0x5cf9ad['Smtp']['secure'];}else{_0x49953a[_0xeede('0xab')]=_0x5cf9ad[_0xeede('0x48')][_0xeede('0xab')];_0x49953a['auth']={'user':_0x5cf9ad[_0xeede('0x48')][_0xeede('0x7b')],'pass':_0x5cf9ad[_0xeede('0x48')][_0xeede('0x7c')]};}return respondWithRpcPromise('SendMail',_0xeede('0xae'),{'account':_0x49953a,'message':_0x2ab7f1[_0xeede('0x63')]});}else{throw new Error('List\x20not\x20found');}}})[_0xeede('0x22')](function(_0x13cf4a){if(_0x13cf4a){_0x56b673=_0x13cf4a;if(_0x485696['List']){if(_0x485696[_0xeede('0xa4')]['Contacts'][_0xeede('0x55')]){return _0x485696[_0xeede('0xa4')][_0xeede('0xa5')][0x0];}else{return db[_0xeede('0x8f')][_0xeede('0x68')](_['defaults'](_0x2ab7f1[_0xeede('0x63')],{'firstName':_0x2ab7f1[_0xeede('0x63')]['to'],'email':_0x2ab7f1[_0xeede('0x63')]['to'],'phone':_0x2ab7f1[_0xeede('0x63')]['to'],'ListId':_0x485696[_0xeede('0x76')]}));}}else{throw new Error(_0xeede('0xaf'));}}})[_0xeede('0x22')](function(_0x56f4c7){if(_0x56f4c7){var _0x511bea={'UserId':_0x2ab7f1[_0xeede('0x7b')]['id'],'ContactId':_0x56f4c7['id'],'MailAccountId':_0x485696['id'],'inReplyTo':_0x56b673['messageId'],'to':_0x2ab7f1[_0xeede('0x63')][_0xeede('0xa7')],'cc':_0x2ab7f1[_0xeede('0x63')]['cc'],'subject':_0x2ab7f1[_0xeede('0x63')][_0xeede('0xb0')],'attach':_0x2ab7f1[_0xeede('0x63')][_0xeede('0xb1')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0xeede('0xa1')),'lastMsgDirection':_0xeede('0xb2'),'Messages':[_[_0xeede('0x40')](_0x2ab7f1['body'],{'messageId':_0x56b673[_0xeede('0xb3')],'sentAt':moment()['format'](_0xeede('0xa1')),'read':!![],'MailAccountId':_0x485696['id'],'UserId':_0x2ab7f1['user']['id'],'ContactId':_0x56f4c7['id']})]};if(_0x2ab7f1['body']['Interaction']){_0x511bea=_[_0xeede('0x40')](_0x511bea,_0x2ab7f1['body'][_0xeede('0xb4')]);}return db[_0xeede('0x8c')][_0xeede('0x68')](_0x511bea,{'include':[{'model':db[_0xeede('0x9d')],'as':'Messages'}]});}})[_0xeede('0x22')](respondWithResult(_0x508bc2,null))['catch'](handleError(_0x508bc2,null));};exports[_0xeede('0xb5')]=function(_0x319cd6,_0x270e86,_0x42573b){return db[_0xeede('0x5f')][_0xeede('0x62')]({'where':{'id':_0x319cd6[_0xeede('0x5d')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xeede('0x48'),'raw':!![]}]})[_0xeede('0x22')](handleEntityNotFound(_0x270e86,null))[_0xeede('0x22')](function(_0x4fc92f){if(_0x4fc92f&&_0x4fc92f[_0xeede('0x48')]){var _0x5accd0={'id':_0x4fc92f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4fc92f[_0xeede('0x48')][_0xeede('0xab')]){_0x5accd0[_0xeede('0xab')]=_0x4fc92f['Smtp'][_0xeede('0xab')];}else{_0x5accd0[_0xeede('0x80')]=_0x4fc92f[_0xeede('0x48')][_0xeede('0x80')];_0x5accd0['port']=_0x4fc92f[_0xeede('0x48')][_0xeede('0x7f')];_0x5accd0['secure']=_0x4fc92f['Smtp'][_0xeede('0xad')];}if(_0x4fc92f['Smtp']['authentication']){_0x5accd0[_0xeede('0xac')]={'user':_0x4fc92f[_0xeede('0x48')][_0xeede('0x7b')],'pass':_0x4fc92f[_0xeede('0x48')][_0xeede('0x7c')]};}return respondWithRpcPromise(_0xeede('0xb6'),_0xeede('0xb5'),{'account':_0x5accd0});}})[_0xeede('0x22')](respondWithResult(_0x270e86,null))[_0xeede('0x2d')](handleError(_0x270e86,null));};exports['destroy']=function(_0x4a80c7,_0x56c7b2){return db[_0xeede('0x5f')][_0xeede('0x62')]({'where':{'id':_0x4a80c7['params']['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x56c7b2,null))[_0xeede('0x22')](function(_0x3b9385){if(_0x3b9385&&_0x3b9385[_0xeede('0xab')]){throw new db[(_0xeede('0xb7'))][(_0xeede('0xb8'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x3b9385;})[_0xeede('0x22')](removeEntity(_0x56c7b2,null))[_0xeede('0x2d')](handleError(_0x56c7b2,null));};exports[_0xeede('0xb9')]=function(_0xbcad57,_0x5296fd,_0x225ba4){return db['MailAccount'][_0xeede('0x62')]({'where':{'id':_0xbcad57['params']['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x5296fd,null))[_0xeede('0x22')](function(_0x28047e){if(_0x28047e){return _0x28047e[_0xeede('0xb9')](_0xbcad57['body'][_0xeede('0x75')],_['omit'](_0xbcad57[_0xeede('0x63')],[_0xeede('0x75'),'id'])||{})[_0xeede('0xba')](function(_0x1e9ad0){for(var _0x32b628=0x0;_0x32b628<_0xbcad57['body'][_0xeede('0x75')][_0xeede('0x55')];_0x32b628+=0x1){socket[_0xeede('0xbb')](_0xeede('0xbc'),{'UserId':_0xbcad57[_0xeede('0x63')]['ids'][_0x32b628],'MailAccountId':_0xbcad57[_0xeede('0x5d')]['id']});}return _0x1e9ad0;});}})['then'](respondWithResult(_0x5296fd,null))[_0xeede('0x2d')](handleError(_0x5296fd,null));};exports[_0xeede('0xbd')]=function(_0x524e14,_0x2951c6,_0x53eecd){return db['MailAccount'][_0xeede('0x62')]({'where':{'id':_0x524e14[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x2951c6,null))[_0xeede('0x22')](function(_0x150820){if(_0x150820){return _0x150820['removeAgents'](_0x524e14['query'][_0xeede('0x75')])[_0xeede('0x22')](function(){if(_['isArray'](_0x524e14[_0xeede('0x50')][_0xeede('0x75')])){for(var _0x489f1f=0x0;_0x489f1f<_0x524e14['query'][_0xeede('0x75')][_0xeede('0x55')];_0x489f1f+=0x1){socket[_0xeede('0xbb')](_0xeede('0xbe'),{'UserId':Number(_0x524e14[_0xeede('0x50')][_0xeede('0x75')][_0x489f1f]),'MailAccountId':Number(_0x524e14[_0xeede('0x5d')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x524e14[_0xeede('0x50')][_0xeede('0x75')]),'MailAccountId':Number(_0x524e14[_0xeede('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x2951c6,null))[_0xeede('0x2d')](handleError(_0x2951c6,null));};exports['getAgents']=function(_0x41e9cc,_0x368ea1,_0x3da8e9){var _0x38af4d={};var _0x36607f={};var _0x5b7b76;var _0x3600cf;return db[_0xeede('0x5f')]['findOne']({'where':{'id':_0x41e9cc['params']['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x368ea1,null))[_0xeede('0x22')](function(_0x10376a){if(_0x10376a){_0x5b7b76=_0x10376a;_0x36607f[_0xeede('0x4e')]=_['keys'](db[_0xeede('0x90')][_0xeede('0x60')]);_0x36607f[_0xeede('0x50')]=_['keys'](_0x41e9cc[_0xeede('0x50')]);_0x36607f[_0xeede('0x51')]=_['intersection'](_0x36607f[_0xeede('0x4e')],_0x36607f[_0xeede('0x50')]);_0x38af4d[_0xeede('0x53')]=_[_0xeede('0x52')](_0x36607f[_0xeede('0x4e')],qs[_0xeede('0x54')](_0x41e9cc['query'][_0xeede('0x54')]));_0x38af4d[_0xeede('0x53')]=_0x38af4d[_0xeede('0x53')][_0xeede('0x55')]?_0x38af4d['attributes']:_0x36607f[_0xeede('0x4e')];_0x38af4d[_0xeede('0x56')]=qs['sort'](_0x41e9cc[_0xeede('0x50')][_0xeede('0x6d')]);_0x38af4d[_0xeede('0x57')]=qs[_0xeede('0x51')](_[_0xeede('0x6e')](_0x41e9cc[_0xeede('0x50')],_0x36607f[_0xeede('0x51')]));if(_0x41e9cc[_0xeede('0x50')][_0xeede('0x59')]){_0x38af4d[_0xeede('0x57')]=_[_0xeede('0x40')](_0x38af4d[_0xeede('0x57')],{'$or':_[_0xeede('0x4b')](_0x38af4d['attributes'],function(_0x54f4cb){var _0x59b9a7={};_0x59b9a7[_0x54f4cb]={'$like':'%'+_0x41e9cc[_0xeede('0x50')]['filter']+'%'};return _0x59b9a7;})});}_0x38af4d=_[_0xeede('0x40')]({},_0x38af4d,_0x41e9cc['options']);return _0x5b7b76['getAgents'](_0x38af4d);}})[_0xeede('0x22')](function(_0x41fc99){if(_0x41fc99){_0x3600cf=_0x41fc99[_0xeede('0x55')];if(!_0x41e9cc[_0xeede('0x50')][_0xeede('0x6b')](_0xeede('0x6c'))){_0x38af4d[_0xeede('0x33')]=qs[_0xeede('0x33')](_0x41e9cc[_0xeede('0x50')][_0xeede('0x33')]);_0x38af4d[_0xeede('0x31')]=qs['offset'](_0x41e9cc[_0xeede('0x50')][_0xeede('0x31')]);}return _0x5b7b76[_0xeede('0xbf')](_0x38af4d);}})[_0xeede('0x22')](function(_0x48f67d){if(_0x48f67d){return _0x48f67d?{'count':_0x3600cf,'rows':_0x48f67d}:null;}})[_0xeede('0x22')](respondWithResult(_0x368ea1,null))[_0xeede('0x2d')](handleError(_0x368ea1,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 800c17d..1498881 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 _0xb99f=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x250adb,_0x1ae302){var _0x3a45d6=function(_0x2bdec6){while(--_0x2bdec6){_0x250adb['push'](_0x250adb['shift']());}};_0x3a45d6(++_0x1ae302);}(_0xb99f,0x95));var _0xfb99=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xb99f[_0x1694f5];return _0x5b4321;};'use strict';var EventEmitter=require(_0xfb99('0x0'));var MailAccount=require(_0xfb99('0x1'))['db'][_0xfb99('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xfb99('0x3')](0x0);var events={'afterCreate':_0xfb99('0x4'),'afterUpdate':_0xfb99('0x5'),'afterDestroy':_0xfb99('0x6')};function emitEvent(_0x12b46e){return function(_0x2cf0f0,_0x55e01d,_0x3ec705){MailAccountEvents[_0xfb99('0x7')](_0x12b46e+':'+_0x2cf0f0['id'],_0x2cf0f0);MailAccountEvents['emit'](_0x12b46e,_0x2cf0f0);_0x3ec705(null);};}for(var e in events){if(events[_0xfb99('0x8')](e)){var event=events[e];MailAccount[_0xfb99('0x9')](e,emitEvent(event));}}module[_0xfb99('0xa')]=MailAccountEvents; \ No newline at end of file +var _0x1cba=['events','MailAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1cba,0x1c2));var _0xa1cb=function(_0x58c531,_0x126bc6){_0x58c531=_0x58c531-0x0;var _0xddcc4a=_0x1cba[_0x58c531];return _0xddcc4a;};'use strict';var EventEmitter=require(_0xa1cb('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xa1cb('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa1cb('0x2')](0x0);var events={'afterCreate':_0xa1cb('0x3'),'afterUpdate':'update','afterDestroy':_0xa1cb('0x4')};function emitEvent(_0x1fba56){return function(_0x2fe469,_0x225345,_0x32dde1){MailAccountEvents['emit'](_0x1fba56+':'+_0x2fe469['id'],_0x2fe469);MailAccountEvents[_0xa1cb('0x5')](_0x1fba56,_0x2fe469);_0x32dde1(null);};}for(var e in events){if(events[_0xa1cb('0x6')](e)){var event=events[e];MailAccount[_0xa1cb('0x7')](e,emitEvent(event));}}module[_0xa1cb('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 25dc8f2..4b0ceed 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 _0xe3f3=['request-promise','path','rimraf','../../config/environment','MailAccount','mail_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x69b99a,_0x2e58d2){var _0x3bb5a3=function(_0x210a15){while(--_0x210a15){_0x69b99a['push'](_0x69b99a['shift']());}};_0x3bb5a3(++_0x2e58d2);}(_0xe3f3,0xed));var _0x3e3f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3f3[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x3e3f('0x0'));var util=require(_0x3e3f('0x1'));var logger=require(_0x3e3f('0x2'))(_0x3e3f('0x3'));var moment=require(_0x3e3f('0x4'));var BPromise=require('bluebird');var rp=require(_0x3e3f('0x5'));var fs=require('fs');var path=require(_0x3e3f('0x6'));var rimraf=require(_0x3e3f('0x7'));var config=require(_0x3e3f('0x8'));var attributes=require('./mailAccount.attributes');module['exports']=function(_0x5e6f11,_0x3f3536){return _0x5e6f11['define'](_0x3e3f('0x9'),attributes,{'tableName':_0x3e3f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fc4=['lodash','util','../../config/logger','bluebird','path','rimraf','exports','MailAccount','mail_accounts'];(function(_0x3d9557,_0x5d09d2){var _0x359ff8=function(_0x784fa){while(--_0x784fa){_0x3d9557['push'](_0x3d9557['shift']());}};_0x359ff8(++_0x5d09d2);}(_0x3fc4,0x1c2));var _0x43fc=function(_0xb9d024,_0x1b1d58){_0xb9d024=_0xb9d024-0x0;var _0x133c31=_0x3fc4[_0xb9d024];return _0x133c31;};'use strict';var _=require(_0x43fc('0x0'));var util=require(_0x43fc('0x1'));var logger=require(_0x43fc('0x2'))('api');var moment=require('moment');var BPromise=require(_0x43fc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x43fc('0x4'));var rimraf=require(_0x43fc('0x5'));var config=require('../../config/environment');var attributes=require('./mailAccount.attributes');module[_0x43fc('0x6')]=function(_0x479e04,_0x97d9d6){return _0x479e04['define'](_0x43fc('0x7'),attributes,{'tableName':_0x43fc('0x8'),'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 5d7d893..0aab44f 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 _0xdb77=['message','result','GetMailAccount','MailAccount','findAll','options','raw','attributes','include','map','model','then','catch','ShowMailAccount','find','where','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','CmContact','Applications','MailServerOut','get','omit','list','orderBy','applications','asc','length','close','autoclose','Contacts','create','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','attach','interaction','created','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5e05fe,_0x254ea2){var _0x3fbab3=function(_0x35ed15){while(--_0x35ed15){_0x5e05fe['push'](_0x5e05fe['shift']());}};_0x3fbab3(++_0x254ea2);}(_0xdb77,0x1e2));var _0x7db7=function(_0x44e12e,_0x48ac87){_0x44e12e=_0x44e12e-0x0;var _0x566404=_0xdb77[_0x44e12e];return _0x566404;};'use strict';var _=require(_0x7db7('0x0'));var util=require(_0x7db7('0x1'));var moment=require(_0x7db7('0x2'));var BPromise=require(_0x7db7('0x3'));var rs=require(_0x7db7('0x4'));var fs=require('fs');var Redis=require(_0x7db7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7db7('0x6'));var logger=require(_0x7db7('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7db7('0x8'));var client=jayson[_0x7db7('0x9')]['http']({'port':0x232c});config[_0x7db7('0xa')]=_[_0x7db7('0xb')](config[_0x7db7('0xa')],{'host':_0x7db7('0xc'),'port':0x18eb});var socket=require(_0x7db7('0xd'))(new Redis(config[_0x7db7('0xa')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x15906e,_0x508ed8,_0x271215){return new BPromise(function(_0x2f5f46,_0x127f85){return client[_0x7db7('0xe')](_0x15906e,_0x271215)['then'](function(_0x4c2dde){logger[_0x7db7('0xf')](_0x7db7('0x10'),_0x508ed8,'request\x20sent');logger[_0x7db7('0x11')](_0x7db7('0x12'),_0x508ed8,_0x7db7('0x13'),JSON[_0x7db7('0x14')](_0x4c2dde));if(_0x4c2dde[_0x7db7('0x15')]){if(_0x4c2dde[_0x7db7('0x15')][_0x7db7('0x16')]===0x1f4){logger['error'](_0x7db7('0x10'),_0x508ed8,_0x4c2dde[_0x7db7('0x15')][_0x7db7('0x17')]);return _0x127f85(_0x4c2dde['error'][_0x7db7('0x17')]);}logger['error'](_0x7db7('0x10'),_0x508ed8,_0x4c2dde[_0x7db7('0x15')][_0x7db7('0x17')]);return _0x2f5f46(_0x4c2dde[_0x7db7('0x15')][_0x7db7('0x17')]);}else{logger[_0x7db7('0xf')](_0x7db7('0x10'),_0x508ed8,_0x7db7('0x13'));_0x2f5f46(_0x4c2dde[_0x7db7('0x18')][_0x7db7('0x17')]);}})['catch'](function(_0x1d807f){logger[_0x7db7('0x15')](_0x7db7('0x10'),_0x508ed8,_0x1d807f);_0x127f85(_0x1d807f);});});}exports[_0x7db7('0x19')]=function(_0x1fc6bb){var _0x47f3d6=this;return new Promise(function(_0x4d28ce,_0x5e2661){return db[_0x7db7('0x1a')][_0x7db7('0x1b')]({'raw':_0x1fc6bb['options']?_0x1fc6bb[_0x7db7('0x1c')][_0x7db7('0x1d')]===undefined?!![]:![]:!![],'where':_0x1fc6bb[_0x7db7('0x1c')]?_0x1fc6bb[_0x7db7('0x1c')]['where']||null:null,'attributes':_0x1fc6bb[_0x7db7('0x1c')]?_0x1fc6bb[_0x7db7('0x1c')][_0x7db7('0x1e')]||null:null,'limit':_0x1fc6bb['options']?_0x1fc6bb[_0x7db7('0x1c')]['limit']||null:null,'include':_0x1fc6bb[_0x7db7('0x1c')]?_0x1fc6bb[_0x7db7('0x1c')][_0x7db7('0x1f')]?_[_0x7db7('0x20')](_0x1fc6bb[_0x7db7('0x1c')][_0x7db7('0x1f')],function(_0x4192dc){return{'model':db[_0x4192dc[_0x7db7('0x21')]],'as':_0x4192dc['as'],'attributes':_0x4192dc[_0x7db7('0x1e')],'include':_0x4192dc[_0x7db7('0x1f')]?_[_0x7db7('0x20')](_0x4192dc[_0x7db7('0x1f')],function(_0x4f7d36){return{'model':db[_0x4f7d36[_0x7db7('0x21')]],'as':_0x4f7d36['as'],'attributes':_0x4f7d36[_0x7db7('0x1e')],'include':_0x4f7d36['include']?_['map'](_0x4f7d36['include'],function(_0x2fb01c){return{'model':db[_0x2fb01c[_0x7db7('0x21')]],'as':_0x2fb01c['as'],'attributes':_0x2fb01c['attributes']};}):[]};}):[]};}):[]:[]})[_0x7db7('0x22')](function(_0xc957b9){logger[_0x7db7('0xf')](_0x7db7('0x19'),_0x1fc6bb);logger[_0x7db7('0x11')](_0x7db7('0x19'),_0x1fc6bb,JSON['stringify'](_0xc957b9));_0x4d28ce(_0xc957b9);})[_0x7db7('0x23')](function(_0x49d388){logger[_0x7db7('0x15')](_0x7db7('0x19'),_0x49d388[_0x7db7('0x17')],_0x1fc6bb);_0x5e2661(_0x47f3d6[_0x7db7('0x15')](0x1f4,_0x49d388[_0x7db7('0x17')]));});});};exports[_0x7db7('0x24')]=function(_0xcc7c6f){var _0x3171ce=this;return new Promise(function(_0x4c23c3,_0xcd81c4){return db['MailAccount'][_0x7db7('0x25')]({'raw':_0xcc7c6f[_0x7db7('0x1c')]?_0xcc7c6f[_0x7db7('0x1c')][_0x7db7('0x1d')]===undefined?!![]:![]:!![],'where':_0xcc7c6f['options']?_0xcc7c6f[_0x7db7('0x1c')][_0x7db7('0x26')]||null:null,'attributes':_0xcc7c6f['options']?_0xcc7c6f[_0x7db7('0x1c')]['attributes']||null:null,'include':_0xcc7c6f['options']?_0xcc7c6f['options'][_0x7db7('0x1f')]?_[_0x7db7('0x20')](_0xcc7c6f[_0x7db7('0x1c')][_0x7db7('0x1f')],function(_0x5835e2){return{'model':db[_0x5835e2[_0x7db7('0x21')]],'as':_0x5835e2['as'],'attributes':_0x5835e2[_0x7db7('0x1e')],'include':_0x5835e2['include']?_['map'](_0x5835e2[_0x7db7('0x1f')],function(_0x4642d4){return{'model':db[_0x4642d4[_0x7db7('0x21')]],'as':_0x4642d4['as'],'attributes':_0x4642d4['attributes'],'include':_0x4642d4[_0x7db7('0x1f')]?_['map'](_0x4642d4[_0x7db7('0x1f')],function(_0x234689){return{'model':db[_0x234689[_0x7db7('0x21')]],'as':_0x234689['as'],'attributes':_0x234689[_0x7db7('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27ff70){logger[_0x7db7('0xf')](_0x7db7('0x24'),_0xcc7c6f);logger[_0x7db7('0x11')](_0x7db7('0x24'),_0xcc7c6f,JSON[_0x7db7('0x14')](_0x27ff70));_0x4c23c3(_0x27ff70);})['catch'](function(_0x4851e0){logger[_0x7db7('0x15')](_0x7db7('0x24'),_0x4851e0[_0x7db7('0x17')],_0xcc7c6f);_0xcd81c4(_0x3171ce[_0x7db7('0x15')](0x1f4,_0x4851e0[_0x7db7('0x17')]));});});};exports[_0x7db7('0x27')]=function(_0x5bd10d){var _0xdea41=this;return new Promise(function(_0x1c0455,_0x1f3d71){var _0x486cf3={'body':_0x5bd10d[_0x7db7('0x28')],'channel':_0x7db7('0x29')};var _0x5e662b=_[_0x7db7('0x2a')](_[_0x7db7('0x2b')](db['CmContact'][_0x7db7('0x2c')]),[_0x7db7('0x2d'),_0x7db7('0x2e'),_0x7db7('0x2f'),_0x7db7('0x30')]);var _0x541881=![];if(_0x5bd10d[_0x7db7('0x28')]['id']){delete _0x5bd10d[_0x7db7('0x28')]['id'];}if(_[_0x7db7('0x31')](_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x32')])){return _0x1f3d71(_0xdea41['error'](0x1f4,_0x7db7('0x33')));}if(_[_0x7db7('0x31')](_0x5bd10d[_0x7db7('0x28')]['body'])||_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x28')]===''){return _0x1f3d71(_0xdea41[_0x7db7('0x15')](0x1f4,_0x7db7('0x34')));}if(_['isNil'](_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x35')])){return _0x1f3d71(_0xdea41['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5e662b));}if(!_['includes'](_0x5e662b,_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x35')])){return _0x1f3d71(_0xdea41[_0x7db7('0x15')](0x1f4,_0x7db7('0x36')+_0x5e662b));}var _0x5c280a={};_0x5c280a[_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x35')]]=_0x5bd10d['body'][_0x7db7('0x32')];return db['MailAccount']['find']({'where':{'id':_0x5bd10d[_0x7db7('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0x7db7('0x38'),'include':[{'model':db[_0x7db7('0x39')],'as':'Contacts','where':_0x5c280a,'limit':0x1,'order':[[_0x7db7('0x2e'),'DESC']]}]},{'model':db['MailApplication'],'as':_0x7db7('0x3a')},{'model':db[_0x7db7('0x3b')],'as':'Smtp'}]})[_0x7db7('0x22')](function(_0x30f71d){if(_0x30f71d&&_0x30f71d[_0x7db7('0x38')]){var _0x3d6aa3=_0x30f71d[_0x7db7('0x3c')]({'plain':!![]});_0x486cf3[_0x7db7('0x37')]=_[_0x7db7('0x3d')](_0x3d6aa3,[_0x7db7('0x3a'),_0x7db7('0x38')]);_0x486cf3['applications']=_0x3d6aa3['Applications'];_0x486cf3[_0x7db7('0x3e')]=_0x3d6aa3[_0x7db7('0x38')];_0x486cf3['applications']=_[_0x7db7('0x3f')](_0x486cf3[_0x7db7('0x40')],['priority'],[_0x7db7('0x41')]);if(_0x486cf3['account']&&_0x486cf3[_0x7db7('0x37')]['autoclose']){_0x486cf3[_0x7db7('0x40')]['push']({'id':0x0,'priority':_0x486cf3[_0x7db7('0x40')][_0x7db7('0x42')]+0x1,'app':_0x7db7('0x43'),'appdata':_0x7db7('0x44'),'interval':'*,*,*,*'});}if(_0x486cf3[_0x7db7('0x37')][_0x7db7('0x3a')]){delete _0x486cf3[_0x7db7('0x37')][_0x7db7('0x3a')];}if(_0x486cf3['account'][_0x7db7('0x38')]){delete _0x486cf3[_0x7db7('0x37')]['List'];}if(_0x3d6aa3[_0x7db7('0x38')][_0x7db7('0x45')][_0x7db7('0x42')]){return _0x3d6aa3['List'][_0x7db7('0x45')][0x0];}var _0x3aac7b=_['defaults'](_0x5bd10d[_0x7db7('0x28')],{'firstName':_0x5bd10d[_0x7db7('0x28')]['from'],'ListId':_0x3d6aa3['ListId']});_0x3aac7b[_0x5bd10d['body'][_0x7db7('0x35')]]=_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x32')];return db[_0x7db7('0x39')][_0x7db7('0x46')](_0x3aac7b);}else{throw new Error('List\x20not\x20found');}})[_0x7db7('0x22')](function(_0x335669){_0x486cf3[_0x7db7('0x47')]=_0x335669;if(_0x335669){if(!_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x17')][_0x7db7('0x48')]){_0x5bd10d[_0x7db7('0x28')]['message'][_0x7db7('0x48')]=rs[_0x7db7('0x49')]()+'\x20'+_0x5bd10d[_0x7db7('0x28')]['message']['from'];}var _0x412f3e={'ContactId':_0x335669['id'],'MailAccountId':_0x5bd10d[_0x7db7('0x37')]['id'],'inReplyTo':_0x5bd10d[_0x7db7('0x28')]['message'][_0x7db7('0x48')],'to':_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x17')][_0x7db7('0x32')],'cc':_0x5bd10d['body'][_0x7db7('0x17')]['cc'],'subject':_0x5bd10d['body'][_0x7db7('0x17')][_0x7db7('0x4a')],'attach':_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x17')]['attach'],'lastMsgAt':moment()[_0x7db7('0x4b')](_0x7db7('0x4c')),'lastMsgDirection':'in'};return db[_0x7db7('0x4d')][_0x7db7('0x25')]({'where':{'closed':![],'MailAccountId':_0x5bd10d[_0x7db7('0x37')]['id']},'include':[{'model':db[_0x7db7('0x4e')],'as':_0x7db7('0x4f'),'attributes':[_0x7db7('0x48')],'where':{'messageId':_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x17')][_0x7db7('0x50')]}}]})[_0x7db7('0x22')](function(_0x5d3fa4){if(_0x5d3fa4){return[_0x5d3fa4,![]];}return db[_0x7db7('0x4d')][_0x7db7('0x46')](_0x412f3e)[_0x7db7('0x22')](function(_0x232a1a){return[_0x232a1a,!![]];});});}else{throw new Error(_0x7db7('0x51'));}})['spread'](function(_0x5de83c,_0x3e978b){if(_0x5de83c){_0x541881=_0x3e978b;if(!_0x3e978b){return _0x5de83c['update']({'inReplyTo':_0x5bd10d['body'][_0x7db7('0x17')][_0x7db7('0x48')],'to':_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x17')][_0x7db7('0x32')],'cc':_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x17')]['cc'],'subject':_0x5bd10d['body'][_0x7db7('0x17')]['subject'],'attach':_0x5de83c[_0x7db7('0x52')]?_0x5de83c['attach']:_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x17')]['attach'],'substatus':null,'substatusAt':moment()[_0x7db7('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x7db7('0x4b')](_0x7db7('0x4c')),'lastMsgDirection':'in'});}else{return _0x5de83c;}}})[_0x7db7('0x22')](function(_0x4c6c5e){_0x486cf3[_0x7db7('0x53')]=_0x4c6c5e[_0x7db7('0x3c')]({'plain':!![]});_0x486cf3[_0x7db7('0x53')][_0x7db7('0x54')]=_0x541881;return db['MailMessage'][_0x7db7('0x46')]({'body':_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x28')],'MailAccountId':_0x5bd10d['account']['id'],'MailInteractionId':_0x4c6c5e['id'],'direction':'in','ContactId':_0x486cf3[_0x7db7('0x47')]['id'],'messageId':_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x17')][_0x7db7('0x48')],'from':_0x5bd10d['body']['message'][_0x7db7('0x32')],'to':_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x17')]['to'],'cc':_0x5bd10d[_0x7db7('0x28')]['message']['cc'],'subject':_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x17')][_0x7db7('0x4a')],'attach':_0x5bd10d[_0x7db7('0x28')]['message'][_0x7db7('0x52')],'Attachments':_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x17')]['attachments'],'originTo':_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x17')][_0x7db7('0x55')],'originCc':_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x17')][_0x7db7('0x56')],'bcc':_0x5bd10d['body']['message']['bcc'],'ChatWebsiteId':_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x17')][_0x7db7('0x57')]||null,'originChannel':_0x5bd10d[_0x7db7('0x28')]['message'][_0x7db7('0x58')]||_0x7db7('0x59'),'ChatOfflineMessageId':_0x5bd10d[_0x7db7('0x28')][_0x7db7('0x17')][_0x7db7('0x5a')]||null},{'include':[{'model':db[_0x7db7('0x5b')],'as':_0x7db7('0x5c')}]});})[_0x7db7('0x22')](function(_0x2c5642){_0x486cf3[_0x7db7('0x17')]=_0x2c5642;if(_0x486cf3[_0x7db7('0x53')][_0x7db7('0x5d')]){return db[_0x7db7('0x5e')]['find']({'attributes':['id',_0x7db7('0x5f')],'where':{'id':_0x486cf3[_0x7db7('0x53')][_0x7db7('0x5d')]}})[_0x7db7('0x22')](function(_0x4852df){if(_0x4852df){_0x486cf3[_0x7db7('0x40')][_0x7db7('0x60')]({'id':0x0,'priority':0x0,'app':_0x7db7('0x61'),'appdata':_0x4852df[_0x7db7('0x5f')]+','+(_0x486cf3[_0x7db7('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0x7db7('0x62')});}return respondWithRpcPromise(_0x7db7('0x63'),_0x7db7('0x64'),_0x486cf3);});}return respondWithRpcPromise('Start',_0x7db7('0x64'),_0x486cf3);})['then'](function(_0x3131e4){_0x1c0455(_0x3131e4);})[_0x7db7('0x23')](function(_0x4080f8){_0x1f3d71(_0xdea41['error'](0x1f4,_0x4080f8['message']));});});}; \ No newline at end of file +var _0x2b8a=['DESC','Applications','List','get','omit','applications','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts','create','messageId','generate','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','format','interaction','created','contact','subject','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','UserId','User','name','agent','waitForTheAssignedAgent','startRouting','Start','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailAccount','options','include','map','model','attributes','GetMailAccount','ShowMailAccount','find','raw','where','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','account','CmList','CmContact'];(function(_0x23fbf0,_0x505f60){var _0x443648=function(_0x310c10){while(--_0x310c10){_0x23fbf0['push'](_0x23fbf0['shift']());}};_0x443648(++_0x505f60);}(_0x2b8a,0xf9));var _0xa2b8=function(_0x14b735,_0x40d235){_0x14b735=_0x14b735-0x0;var _0x1f95d2=_0x2b8a[_0x14b735];return _0x1f95d2;};'use strict';var _=require(_0xa2b8('0x0'));var util=require(_0xa2b8('0x1'));var moment=require('moment');var BPromise=require(_0xa2b8('0x2'));var rs=require(_0xa2b8('0x3'));var fs=require('fs');var Redis=require(_0xa2b8('0x4'));var db=require(_0xa2b8('0x5'))['db'];var utils=require(_0xa2b8('0x6'));var logger=require(_0xa2b8('0x7'))(_0xa2b8('0x8'));var config=require('../../config/environment');var jayson=require(_0xa2b8('0x9'));var client=jayson['client'][_0xa2b8('0xa')]({'port':0x232c});config[_0xa2b8('0xb')]=_[_0xa2b8('0xc')](config[_0xa2b8('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa2b8('0xb')]));require(_0xa2b8('0xd'))[_0xa2b8('0xe')](socket);function respondWithRpcPromise(_0x13743e,_0x18b00b,_0x10be04){return new BPromise(function(_0x3f6ea9,_0x287114){return client[_0xa2b8('0xf')](_0x13743e,_0x10be04)[_0xa2b8('0x10')](function(_0x5a38b4){logger[_0xa2b8('0x11')](_0xa2b8('0x12'),_0x18b00b,_0xa2b8('0x13'));logger[_0xa2b8('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x18b00b,_0xa2b8('0x13'),JSON[_0xa2b8('0x15')](_0x5a38b4));if(_0x5a38b4['error']){if(_0x5a38b4[_0xa2b8('0x16')][_0xa2b8('0x17')]===0x1f4){logger[_0xa2b8('0x16')](_0xa2b8('0x12'),_0x18b00b,_0x5a38b4['error'][_0xa2b8('0x18')]);return _0x287114(_0x5a38b4[_0xa2b8('0x16')]['message']);}logger[_0xa2b8('0x16')]('MailAccount,\x20%s,\x20%s',_0x18b00b,_0x5a38b4['error'][_0xa2b8('0x18')]);return _0x3f6ea9(_0x5a38b4[_0xa2b8('0x16')][_0xa2b8('0x18')]);}else{logger[_0xa2b8('0x11')]('MailAccount,\x20%s,\x20%s',_0x18b00b,_0xa2b8('0x13'));_0x3f6ea9(_0x5a38b4[_0xa2b8('0x19')][_0xa2b8('0x18')]);}})[_0xa2b8('0x1a')](function(_0x4a6f6b){logger['error'](_0xa2b8('0x12'),_0x18b00b,_0x4a6f6b);_0x287114(_0x4a6f6b);});});}exports['GetMailAccount']=function(_0x2b74fb){var _0x3844c1=this;return new Promise(function(_0x11d1b9,_0x70ba2e){return db[_0xa2b8('0x1b')]['findAll']({'raw':_0x2b74fb['options']?_0x2b74fb[_0xa2b8('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2b74fb['options']?_0x2b74fb[_0xa2b8('0x1c')]['where']||null:null,'attributes':_0x2b74fb[_0xa2b8('0x1c')]?_0x2b74fb[_0xa2b8('0x1c')]['attributes']||null:null,'limit':_0x2b74fb[_0xa2b8('0x1c')]?_0x2b74fb[_0xa2b8('0x1c')]['limit']||null:null,'include':_0x2b74fb[_0xa2b8('0x1c')]?_0x2b74fb['options'][_0xa2b8('0x1d')]?_[_0xa2b8('0x1e')](_0x2b74fb[_0xa2b8('0x1c')][_0xa2b8('0x1d')],function(_0x5e9645){return{'model':db[_0x5e9645[_0xa2b8('0x1f')]],'as':_0x5e9645['as'],'attributes':_0x5e9645['attributes'],'include':_0x5e9645[_0xa2b8('0x1d')]?_[_0xa2b8('0x1e')](_0x5e9645[_0xa2b8('0x1d')],function(_0x534b37){return{'model':db[_0x534b37[_0xa2b8('0x1f')]],'as':_0x534b37['as'],'attributes':_0x534b37[_0xa2b8('0x20')],'include':_0x534b37[_0xa2b8('0x1d')]?_[_0xa2b8('0x1e')](_0x534b37[_0xa2b8('0x1d')],function(_0x679d5c){return{'model':db[_0x679d5c['model']],'as':_0x679d5c['as'],'attributes':_0x679d5c[_0xa2b8('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa2b8('0x10')](function(_0x23db3f){logger[_0xa2b8('0x11')](_0xa2b8('0x21'),_0x2b74fb);logger[_0xa2b8('0x14')](_0xa2b8('0x21'),_0x2b74fb,JSON[_0xa2b8('0x15')](_0x23db3f));_0x11d1b9(_0x23db3f);})[_0xa2b8('0x1a')](function(_0x568fc5){logger[_0xa2b8('0x16')]('GetMailAccount',_0x568fc5[_0xa2b8('0x18')],_0x2b74fb);_0x70ba2e(_0x3844c1['error'](0x1f4,_0x568fc5[_0xa2b8('0x18')]));});});};exports[_0xa2b8('0x22')]=function(_0x3ae2bb){var _0x17a583=this;return new Promise(function(_0x35394d,_0x400515){return db[_0xa2b8('0x1b')][_0xa2b8('0x23')]({'raw':_0x3ae2bb[_0xa2b8('0x1c')]?_0x3ae2bb[_0xa2b8('0x1c')][_0xa2b8('0x24')]===undefined?!![]:![]:!![],'where':_0x3ae2bb[_0xa2b8('0x1c')]?_0x3ae2bb[_0xa2b8('0x1c')][_0xa2b8('0x25')]||null:null,'attributes':_0x3ae2bb['options']?_0x3ae2bb[_0xa2b8('0x1c')]['attributes']||null:null,'include':_0x3ae2bb[_0xa2b8('0x1c')]?_0x3ae2bb[_0xa2b8('0x1c')][_0xa2b8('0x1d')]?_['map'](_0x3ae2bb[_0xa2b8('0x1c')][_0xa2b8('0x1d')],function(_0x324926){return{'model':db[_0x324926['model']],'as':_0x324926['as'],'attributes':_0x324926[_0xa2b8('0x20')],'include':_0x324926['include']?_[_0xa2b8('0x1e')](_0x324926['include'],function(_0x1e5272){return{'model':db[_0x1e5272['model']],'as':_0x1e5272['as'],'attributes':_0x1e5272[_0xa2b8('0x20')],'include':_0x1e5272[_0xa2b8('0x1d')]?_[_0xa2b8('0x1e')](_0x1e5272[_0xa2b8('0x1d')],function(_0x4ac437){return{'model':db[_0x4ac437[_0xa2b8('0x1f')]],'as':_0x4ac437['as'],'attributes':_0x4ac437[_0xa2b8('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b3d27){logger[_0xa2b8('0x11')](_0xa2b8('0x22'),_0x3ae2bb);logger[_0xa2b8('0x14')]('ShowMailAccount',_0x3ae2bb,JSON['stringify'](_0x2b3d27));_0x35394d(_0x2b3d27);})[_0xa2b8('0x1a')](function(_0x5f1eb3){logger['error'](_0xa2b8('0x22'),_0x5f1eb3['message'],_0x3ae2bb);_0x400515(_0x17a583[_0xa2b8('0x16')](0x1f4,_0x5f1eb3[_0xa2b8('0x18')]));});});};exports[_0xa2b8('0x26')]=function(_0xa67e37){var _0x30a68f=this;return new Promise(function(_0x7d154d,_0x1b6b73){var _0x3d19a0={'body':_0xa67e37[_0xa2b8('0x27')],'channel':_0xa2b8('0x28')};var _0x381913=_[_0xa2b8('0x29')](_[_0xa2b8('0x2a')](db['CmContact'][_0xa2b8('0x2b')]),[_0xa2b8('0x2c'),_0xa2b8('0x2d'),_0xa2b8('0x2e'),_0xa2b8('0x2f')]);var _0x5350a7=![];if(_0xa67e37[_0xa2b8('0x27')]['id']){delete _0xa67e37[_0xa2b8('0x27')]['id'];}if(_[_0xa2b8('0x30')](_0xa67e37['body'][_0xa2b8('0x31')])){return _0x1b6b73(_0x30a68f[_0xa2b8('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xa2b8('0x30')](_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x27')])||_0xa67e37['body'][_0xa2b8('0x27')]===''){return _0x1b6b73(_0x30a68f[_0xa2b8('0x16')](0x1f4,_0xa2b8('0x32')));}if(_['isNil'](_0xa67e37[_0xa2b8('0x27')]['mapKey'])){return _0x1b6b73(_0x30a68f[_0xa2b8('0x16')](0x1f4,_0xa2b8('0x33')+_0x381913));}if(!_[_0xa2b8('0x34')](_0x381913,_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x35')])){return _0x1b6b73(_0x30a68f[_0xa2b8('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x381913));}var _0x2ce9f1={};_0x2ce9f1[_0xa67e37[_0xa2b8('0x27')]['mapKey']]=_0xa67e37[_0xa2b8('0x27')]['from'];return db['MailAccount']['find']({'where':{'id':_0xa67e37[_0xa2b8('0x36')]['id']},'include':[{'model':db[_0xa2b8('0x37')],'as':'List','include':[{'model':db[_0xa2b8('0x38')],'as':'Contacts','where':_0x2ce9f1,'limit':0x1,'order':[[_0xa2b8('0x2d'),_0xa2b8('0x39')]]}]},{'model':db['MailApplication'],'as':_0xa2b8('0x3a')},{'model':db['MailServerOut'],'as':'Smtp'}]})[_0xa2b8('0x10')](function(_0x47244c){if(_0x47244c&&_0x47244c[_0xa2b8('0x3b')]){var _0x3f96cb=_0x47244c[_0xa2b8('0x3c')]({'plain':!![]});_0x3d19a0[_0xa2b8('0x36')]=_[_0xa2b8('0x3d')](_0x3f96cb,[_0xa2b8('0x3a'),_0xa2b8('0x3b')]);_0x3d19a0['applications']=_0x3f96cb[_0xa2b8('0x3a')];_0x3d19a0['list']=_0x3f96cb['List'];_0x3d19a0[_0xa2b8('0x3e')]=_[_0xa2b8('0x3f')](_0x3d19a0[_0xa2b8('0x3e')],[_0xa2b8('0x40')],[_0xa2b8('0x41')]);if(_0x3d19a0['account']&&_0x3d19a0[_0xa2b8('0x36')][_0xa2b8('0x42')]){_0x3d19a0[_0xa2b8('0x3e')][_0xa2b8('0x43')]({'id':0x0,'priority':_0x3d19a0[_0xa2b8('0x3e')][_0xa2b8('0x44')]+0x1,'app':_0xa2b8('0x45'),'appdata':_0xa2b8('0x42'),'interval':_0xa2b8('0x46')});}if(_0x3d19a0[_0xa2b8('0x36')][_0xa2b8('0x3a')]){delete _0x3d19a0[_0xa2b8('0x36')][_0xa2b8('0x3a')];}if(_0x3d19a0[_0xa2b8('0x36')][_0xa2b8('0x3b')]){delete _0x3d19a0[_0xa2b8('0x36')][_0xa2b8('0x3b')];}if(_0x3f96cb['List']['Contacts'][_0xa2b8('0x44')]){return _0x3f96cb['List'][_0xa2b8('0x47')][0x0];}var _0x586d3f=_[_0xa2b8('0xc')](_0xa67e37[_0xa2b8('0x27')],{'firstName':_0xa67e37[_0xa2b8('0x27')]['from'],'ListId':_0x3f96cb[_0xa2b8('0x2f')]});_0x586d3f[_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x35')]]=_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x31')];return db[_0xa2b8('0x38')][_0xa2b8('0x48')](_0x586d3f);}else{throw new Error('List\x20not\x20found');}})[_0xa2b8('0x10')](function(_0x763631){_0x3d19a0['contact']=_0x763631;if(_0x763631){if(!_0xa67e37[_0xa2b8('0x27')]['message'][_0xa2b8('0x49')]){_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x49')]=rs[_0xa2b8('0x4a')]()+'\x20'+_0xa67e37['body'][_0xa2b8('0x18')][_0xa2b8('0x31')];}var _0x500342={'ContactId':_0x763631['id'],'MailAccountId':_0xa67e37[_0xa2b8('0x36')]['id'],'inReplyTo':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x49')],'to':_0xa67e37[_0xa2b8('0x27')]['message'][_0xa2b8('0x31')],'cc':_0xa67e37['body'][_0xa2b8('0x18')]['cc'],'subject':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')]['subject'],'attach':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x4b')],'lastMsgAt':moment()['format'](_0xa2b8('0x4c')),'lastMsgDirection':'in'};return db[_0xa2b8('0x4d')][_0xa2b8('0x23')]({'where':{'closed':![],'MailAccountId':_0xa67e37[_0xa2b8('0x36')]['id']},'include':[{'model':db[_0xa2b8('0x4e')],'as':_0xa2b8('0x4f'),'attributes':['messageId'],'where':{'messageId':_0xa67e37['body']['message'][_0xa2b8('0x50')]}}]})['then'](function(_0x505de3){if(_0x505de3){return[_0x505de3,![]];}return db[_0xa2b8('0x4d')][_0xa2b8('0x48')](_0x500342)[_0xa2b8('0x10')](function(_0x3919db){return[_0x3919db,!![]];});});}else{throw new Error(_0xa2b8('0x51'));}})[_0xa2b8('0x52')](function(_0x34ae77,_0x2660c1){if(_0x34ae77){_0x5350a7=_0x2660c1;if(!_0x2660c1){return _0x34ae77[_0xa2b8('0x53')]({'inReplyTo':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')]['messageId'],'to':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x31')],'cc':_0xa67e37[_0xa2b8('0x27')]['message']['cc'],'subject':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')]['subject'],'attach':_0x34ae77[_0xa2b8('0x4b')]?_0x34ae77[_0xa2b8('0x4b')]:_0xa67e37['body'][_0xa2b8('0x18')][_0xa2b8('0x4b')],'substatus':null,'substatusAt':moment()[_0xa2b8('0x54')](_0xa2b8('0x4c')),'lastMsgAt':moment()[_0xa2b8('0x54')](_0xa2b8('0x4c')),'lastMsgDirection':'in'});}else{return _0x34ae77;}}})['then'](function(_0x40c0e5){_0x3d19a0['interaction']=_0x40c0e5[_0xa2b8('0x3c')]({'plain':!![]});_0x3d19a0[_0xa2b8('0x55')][_0xa2b8('0x56')]=_0x5350a7;return db[_0xa2b8('0x4e')]['create']({'body':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x27')],'MailAccountId':_0xa67e37[_0xa2b8('0x36')]['id'],'MailInteractionId':_0x40c0e5['id'],'direction':'in','ContactId':_0x3d19a0[_0xa2b8('0x57')]['id'],'messageId':_0xa67e37['body'][_0xa2b8('0x18')][_0xa2b8('0x49')],'from':_0xa67e37[_0xa2b8('0x27')]['message']['from'],'to':_0xa67e37['body'][_0xa2b8('0x18')]['to'],'cc':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')]['cc'],'subject':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x58')],'attach':_0xa67e37[_0xa2b8('0x27')]['message']['attach'],'Attachments':_0xa67e37[_0xa2b8('0x27')]['message']['attachments'],'originTo':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x59')],'originCc':_0xa67e37[_0xa2b8('0x27')]['message'][_0xa2b8('0x5a')],'bcc':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')]['bcc'],'ChatWebsiteId':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x5b')]||null,'originChannel':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x5c')]||_0xa2b8('0x5d'),'ChatOfflineMessageId':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x5e')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0xa2b8('0x10')](function(_0x316250){_0x3d19a0[_0xa2b8('0x18')]=_0x316250;if(_0x3d19a0[_0xa2b8('0x55')][_0xa2b8('0x5f')]){return db[_0xa2b8('0x60')][_0xa2b8('0x23')]({'attributes':['id',_0xa2b8('0x61')],'where':{'id':_0x3d19a0[_0xa2b8('0x55')][_0xa2b8('0x5f')]}})[_0xa2b8('0x10')](function(_0x4b66cb){if(_0x4b66cb){_0x3d19a0[_0xa2b8('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0xa2b8('0x62'),'appdata':_0x4b66cb[_0xa2b8('0x61')]+','+(_0x3d19a0[_0xa2b8('0x36')][_0xa2b8('0x63')]||0xa),'interval':_0xa2b8('0x46')});}return respondWithRpcPromise('Start',_0xa2b8('0x64'),_0x3d19a0);});}return respondWithRpcPromise(_0xa2b8('0x65'),_0xa2b8('0x64'),_0x3d19a0);})[_0xa2b8('0x10')](function(_0x31e8dc){_0x7d154d(_0x31e8dc);})[_0xa2b8('0x1a')](function(_0xc76ab5){_0x1b6b73(_0x30a68f[_0xa2b8('0x16')](0x1f4,_0xc76ab5[_0xa2b8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index b95d4d4..16a3504 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 _0x5398=['length','mailAccount:','save','remove','update','emit','removeListener','register'];(function(_0x528eb7,_0x452240){var _0x2e12e7=function(_0x166902){while(--_0x166902){_0x528eb7['push'](_0x528eb7['shift']());}};_0x2e12e7(++_0x452240);}(_0x5398,0xe2));var _0x8539=function(_0x2128ea,_0x1aab59){_0x2128ea=_0x2128ea-0x0;var _0x21b777=_0x5398[_0x2128ea];return _0x21b777;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x8539('0x0'),_0x8539('0x1'),_0x8539('0x2')];function createListener(_0x2d92fc,_0x553f52){return function(_0xea6a27){_0x553f52[_0x8539('0x3')](_0x2d92fc,_0xea6a27);};}function removeListener(_0x4e7787,_0x5ed870){return function(){MailAccountEvents[_0x8539('0x4')](_0x4e7787,_0x5ed870);};}exports[_0x8539('0x5')]=function(_0x14ddc9){for(var _0xcca1c0=0x0,_0x28f25c=events[_0x8539('0x6')];_0xcca1c0<_0x28f25c;_0xcca1c0++){var _0x47c5be=events[_0xcca1c0];var _0x1fad89=createListener(_0x8539('0x7')+_0x47c5be,_0x14ddc9);MailAccountEvents['on'](_0x47c5be,_0x1fad89);}}; \ No newline at end of file +var _0x5e11=['register','length','mailAccount:','./mailAccount.events','remove','update','emit'];(function(_0x4797bb,_0xfe9665){var _0x2025c0=function(_0x51ed4e){while(--_0x51ed4e){_0x4797bb['push'](_0x4797bb['shift']());}};_0x2025c0(++_0xfe9665);}(_0x5e11,0x1c3));var _0x15e1=function(_0x1b6563,_0x3bf0f1){_0x1b6563=_0x1b6563-0x0;var _0xdea7b8=_0x5e11[_0x1b6563];return _0xdea7b8;};'use strict';var MailAccountEvents=require(_0x15e1('0x0'));var events=['save',_0x15e1('0x1'),_0x15e1('0x2')];function createListener(_0x197058,_0xd2c9d9){return function(_0x82943a){_0xd2c9d9[_0x15e1('0x3')](_0x197058,_0x82943a);};}function removeListener(_0x598eda,_0x2409d8){return function(){MailAccountEvents['removeListener'](_0x598eda,_0x2409d8);};}exports[_0x15e1('0x4')]=function(_0x41b56c){for(var _0xa0d783=0x0,_0xfabd74=events[_0x15e1('0x5')];_0xa0d783<_0xfabd74;_0xa0d783++){var _0x50b131=events[_0xa0d783];var _0xe0b339=createListener(_0x15e1('0x6')+_0x50b131,_0x41b56c);MailAccountEvents['on'](_0x50b131,_0xe0b339);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 972b133..cf93e11 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 _0x326f=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','put','isAuthenticated','destroy'];(function(_0x6ad559,_0x1713c9){var _0x31fa42=function(_0x2214ba){while(--_0x2214ba){_0x6ad559['push'](_0x6ad559['shift']());}};_0x31fa42(++_0x1713c9);}(_0x326f,0xd1));var _0xf326=function(_0x8edc32,_0x9f20d3){_0x8edc32=_0x8edc32-0x0;var _0x5b130=_0x326f[_0x8edc32];return _0x5b130;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')](_0xf326('0xa'),auth['isAuthenticated'](),controller[_0xf326('0xb')]);router[_0xf326('0xc')](_0xf326('0xa'),auth[_0xf326('0xd')](),controller['update']);router['delete']('/:id',auth[_0xf326('0xd')](),controller[_0xf326('0xe')]);module[_0xf326('0xf')]=router; \ No newline at end of file +var _0xc4aa=['show','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'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')](_0xac4a('0x9'),auth[_0xac4a('0xa')](),controller[_0xac4a('0xb')]);router[_0xac4a('0xc')](_0xac4a('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xac4a('0xd')](_0xac4a('0x9'),auth[_0xac4a('0xa')](),controller['destroy']);module[_0xac4a('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index b10c901..daa2416 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 _0xd8b3=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x31bf1e,_0xbf56bf){var _0x3514e7=function(_0x1f6036){while(--_0x1f6036){_0x31bf1e['push'](_0x31bf1e['shift']());}};_0x3514e7(++_0xbf56bf);}(_0xd8b3,0xc7));var _0x3d8b=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0xd8b3[_0x10df18];return _0x1f9a1d;};'use strict';var Sequelize=require(_0x3d8b('0x0'));module[_0x3d8b('0x1')]={'priority':{'type':Sequelize[_0x3d8b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3d8b('0x3')],'allowNull':![],'defaultValue':_0x3d8b('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3d8b('0x3')]},'interval':{'type':Sequelize[_0x3d8b('0x3')],'defaultValue':_0x3d8b('0x5')}}; \ No newline at end of file +var _0xdbcc=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbcc,0xea));var _0xcdbc=function(_0x571230,_0x111867){_0x571230=_0x571230-0x0;var _0x1867ac=_0xdbcc[_0x571230];return _0x1867ac;};'use strict';var Sequelize=require(_0xcdbc('0x0'));module[_0xcdbc('0x1')]={'priority':{'type':Sequelize[_0xcdbc('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xcdbc('0x3')],'allowNull':![],'defaultValue':_0xcdbc('0x4')},'appdata':{'type':Sequelize[_0xcdbc('0x5')]()},'description':{'type':Sequelize[_0xcdbc('0x3')]},'interval':{'type':Sequelize[_0xcdbc('0x3')],'defaultValue':_0xcdbc('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 44c730f..6a4b2bc 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 _0x5079=['error','name','send','render','body','contact','message','agent','interaction','account','show','keys','MailApplication','rawAttributes','query','model','intersection','fields','attributes','includeAll','include','options','find','catch','destroy','params','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then'];(function(_0x4b8b74,_0x1e5dc3){var _0x12e5b0=function(_0x219d09){while(--_0x219d09){_0x4b8b74['push'](_0x4b8b74['shift']());}};_0x12e5b0(++_0x1e5dc3);}(_0x5079,0x1a6));var _0x9507=function(_0x371f33,_0x278a69){_0x371f33=_0x371f33-0x0;var _0x246c96=_0x5079[_0x371f33];return _0x246c96;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9507('0x0'));var zipdir=require(_0x9507('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9507('0x2'));var moment=require('moment');var BPromise=require(_0x9507('0x3'));var Mustache=require(_0x9507('0x4'));var util=require(_0x9507('0x5'));var path=require(_0x9507('0x6'));var sox=require(_0x9507('0x7'));var csv=require(_0x9507('0x8'));var ejs=require(_0x9507('0x9'));var fs=require('fs');var fs_extra=require(_0x9507('0xa'));var _=require(_0x9507('0xb'));var squel=require(_0x9507('0xc'));var crypto=require('crypto');var jsforce=require(_0x9507('0xd'));var deskjs=require(_0x9507('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9507('0xf'));var Papa=require(_0x9507('0x10'));var Redis=require(_0x9507('0x11'));var authService=require(_0x9507('0x12'));var qs=require(_0x9507('0x13'));var as=require(_0x9507('0x14'));var hardwareService=require(_0x9507('0x15'));var logger=require(_0x9507('0x16'))(_0x9507('0x17'));var utils=require(_0x9507('0x18'));var config=require(_0x9507('0x19'));var licenseUtil=require(_0x9507('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdfaec4,_0x528dff){_0x528dff=_0x528dff||0xcc;return function(_0x4620fb){if(_0x4620fb){return _0xdfaec4[_0x9507('0x1b')](_0x528dff);}return _0xdfaec4[_0x9507('0x1c')](_0x528dff)[_0x9507('0x1d')]();};}function respondWithResult(_0x22ffca,_0x2978dc){_0x2978dc=_0x2978dc||0xc8;return function(_0x571ebf){if(_0x571ebf){return _0x22ffca[_0x9507('0x1c')](_0x2978dc)[_0x9507('0x1e')](_0x571ebf);}};}function respondWithFilteredResult(_0x27aeb0,_0x626690){return function(_0x41d263){if(_0x41d263){var _0x3148f5=typeof _0x626690['offset']===_0x9507('0x1f')&&typeof _0x626690[_0x9507('0x20')]===_0x9507('0x1f');var _0x547a5b=_0x41d263[_0x9507('0x21')];var _0x12be8b=_0x3148f5?0x0:_0x626690['offset'];var _0x1d28b9=_0x3148f5?_0x41d263[_0x9507('0x21')]:_0x626690[_0x9507('0x22')]+_0x626690[_0x9507('0x20')];var _0x425143;if(_0x1d28b9>=_0x547a5b){_0x1d28b9=_0x547a5b;_0x425143=0xc8;}else{_0x425143=0xce;}_0x27aeb0[_0x9507('0x1c')](_0x425143);return _0x27aeb0[_0x9507('0x23')](_0x9507('0x24'),_0x12be8b+'-'+_0x1d28b9+'/'+_0x547a5b)['json'](_0x41d263);}return null;};}function patchUpdates(_0x349dfb){return function(_0x41ea3f){try{jsonpatch[_0x9507('0x25')](_0x41ea3f,_0x349dfb,!![]);}catch(_0x424599){return BPromise['reject'](_0x424599);}return _0x41ea3f['save']();};}function saveUpdates(_0x354584,_0x1af7b4){return function(_0x3d7830){if(_0x3d7830){return _0x3d7830[_0x9507('0x26')](_0x354584)[_0x9507('0x27')](function(_0x4174e6){return _0x4174e6;});}return null;};}function removeEntity(_0xea92db,_0x28edd0){return function(_0x41c15c){if(_0x41c15c){return _0x41c15c['destroy']()[_0x9507('0x27')](function(){_0xea92db['status'](0xcc)[_0x9507('0x1d')]();});}};}function handleEntityNotFound(_0xaec11,_0x195590){return function(_0x318808){if(!_0x318808){_0xaec11[_0x9507('0x1b')](0x194);}return _0x318808;};}function handleError(_0xbb3c5e,_0x14ee40){_0x14ee40=_0x14ee40||0x1f4;return function(_0x540fe0){logger[_0x9507('0x28')](_0x540fe0['stack']);if(_0x540fe0[_0x9507('0x29')]){delete _0x540fe0['name'];}_0xbb3c5e['status'](_0x14ee40)[_0x9507('0x2a')](_0x540fe0);};}function getMustacheRender(_0x174059,_0xc3c4ca){return Mustache[_0x9507('0x2b')](_0x174059,_['merge'](_0xc3c4ca[_0x9507('0x2c')],{'contact':_0xc3c4ca[_0x9507('0x2d')],'message':_0xc3c4ca[_0x9507('0x2e')],'agent':_0xc3c4ca[_0x9507('0x2f')],'interaction':_0xc3c4ca[_0x9507('0x30')],'account':_0xc3c4ca[_0x9507('0x31')]}))||'';}exports[_0x9507('0x32')]=function(_0x3db9f2,_0x3da5a9){var _0x257e5d={'raw':!![],'where':{'id':_0x3db9f2['params']['id']}},_0x155e5d={};_0x155e5d['model']=_[_0x9507('0x33')](db[_0x9507('0x34')][_0x9507('0x35')]);_0x155e5d[_0x9507('0x36')]=_[_0x9507('0x33')](_0x3db9f2[_0x9507('0x36')]);_0x155e5d['filters']=_['intersection'](_0x155e5d[_0x9507('0x37')],_0x155e5d[_0x9507('0x36')]);_0x257e5d['attributes']=_[_0x9507('0x38')](_0x155e5d['model'],qs[_0x9507('0x39')](_0x3db9f2[_0x9507('0x36')]['fields']));_0x257e5d[_0x9507('0x3a')]=_0x257e5d['attributes']['length']?_0x257e5d[_0x9507('0x3a')]:_0x155e5d[_0x9507('0x37')];if(_0x3db9f2['query'][_0x9507('0x3b')]){_0x257e5d[_0x9507('0x3c')]=[{'all':!![]}];}_0x257e5d=_['merge']({},_0x257e5d,_0x3db9f2[_0x9507('0x3d')]);return db['MailApplication'][_0x9507('0x3e')](_0x257e5d)[_0x9507('0x27')](handleEntityNotFound(_0x3da5a9,null))[_0x9507('0x27')](respondWithResult(_0x3da5a9,null))[_0x9507('0x3f')](handleError(_0x3da5a9,null));};exports[_0x9507('0x26')]=function(_0x1ef34c,_0x3fe6d9){if(_0x1ef34c[_0x9507('0x2c')]['id']){delete _0x1ef34c['body']['id'];}return db[_0x9507('0x34')][_0x9507('0x3e')]({'where':{'id':_0x1ef34c['params']['id']}})[_0x9507('0x27')](handleEntityNotFound(_0x3fe6d9,null))['then'](saveUpdates(_0x1ef34c[_0x9507('0x2c')],null))[_0x9507('0x27')](respondWithResult(_0x3fe6d9,null))[_0x9507('0x3f')](handleError(_0x3fe6d9,null));};exports[_0x9507('0x40')]=function(_0x292ed8,_0x1f1783){return db['MailApplication']['find']({'where':{'id':_0x292ed8[_0x9507('0x41')]['id']}})[_0x9507('0x27')](handleEntityNotFound(_0x1f1783,null))[_0x9507('0x27')](removeEntity(_0x1f1783,null))[_0x9507('0x3f')](handleError(_0x1f1783,null));}; \ No newline at end of file +var _0x2dfc=['apply','save','update','then','destroy','sendStatus','error','stack','send','render','merge','body','contact','message','agent','interaction','show','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','attributes','fields','includeAll','options','find','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','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','offset','undefined','count','limit','Content-Range','json'];(function(_0x4ebd76,_0x2ff5e8){var _0x42c3ab=function(_0x2a619b){while(--_0x2a619b){_0x4ebd76['push'](_0x4ebd76['shift']());}};_0x42c3ab(++_0x2ff5e8);}(_0x2dfc,0x9f));var _0xc2df=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2dfc[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc2df('0x0'));var zipdir=require(_0xc2df('0x1'));var jsonpatch=require(_0xc2df('0x2'));var rp=require(_0xc2df('0x3'));var moment=require(_0xc2df('0x4'));var BPromise=require(_0xc2df('0x5'));var Mustache=require(_0xc2df('0x6'));var util=require(_0xc2df('0x7'));var path=require(_0xc2df('0x8'));var sox=require(_0xc2df('0x9'));var csv=require(_0xc2df('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc2df('0xb'));var _=require('lodash');var squel=require(_0xc2df('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc2df('0xa'));var querystring=require(_0xc2df('0xd'));var Papa=require(_0xc2df('0xe'));var Redis=require(_0xc2df('0xf'));var authService=require(_0xc2df('0x10'));var qs=require(_0xc2df('0x11'));var as=require(_0xc2df('0x12'));var hardwareService=require(_0xc2df('0x13'));var logger=require('../../config/logger')(_0xc2df('0x14'));var utils=require(_0xc2df('0x15'));var config=require(_0xc2df('0x16'));var licenseUtil=require(_0xc2df('0x17'));var db=require(_0xc2df('0x18'))['db'];function respondWithStatusCode(_0x10822b,_0x1aab3d){_0x1aab3d=_0x1aab3d||0xcc;return function(_0x1f981c){if(_0x1f981c){return _0x10822b['sendStatus'](_0x1aab3d);}return _0x10822b[_0xc2df('0x19')](_0x1aab3d)[_0xc2df('0x1a')]();};}function respondWithResult(_0xa24c40,_0x2eca47){_0x2eca47=_0x2eca47||0xc8;return function(_0x3660de){if(_0x3660de){return _0xa24c40['status'](_0x2eca47)['json'](_0x3660de);}};}function respondWithFilteredResult(_0x6f9b8c,_0x1efa7e){return function(_0x297112){if(_0x297112){var _0xc8d1bf=typeof _0x1efa7e[_0xc2df('0x1b')]===_0xc2df('0x1c')&&typeof _0x1efa7e['limit']==='undefined';var _0x1ba441=_0x297112[_0xc2df('0x1d')];var _0x32ac7a=_0xc8d1bf?0x0:_0x1efa7e['offset'];var _0x179aeb=_0xc8d1bf?_0x297112[_0xc2df('0x1d')]:_0x1efa7e[_0xc2df('0x1b')]+_0x1efa7e[_0xc2df('0x1e')];var _0x537841;if(_0x179aeb>=_0x1ba441){_0x179aeb=_0x1ba441;_0x537841=0xc8;}else{_0x537841=0xce;}_0x6f9b8c['status'](_0x537841);return _0x6f9b8c['set'](_0xc2df('0x1f'),_0x32ac7a+'-'+_0x179aeb+'/'+_0x1ba441)[_0xc2df('0x20')](_0x297112);}return null;};}function patchUpdates(_0x1c7cab){return function(_0x41958d){try{jsonpatch[_0xc2df('0x21')](_0x41958d,_0x1c7cab,!![]);}catch(_0x2f64dc){return BPromise['reject'](_0x2f64dc);}return _0x41958d[_0xc2df('0x22')]();};}function saveUpdates(_0x51f2e5,_0x5e1eac){return function(_0x5f37de){if(_0x5f37de){return _0x5f37de[_0xc2df('0x23')](_0x51f2e5)[_0xc2df('0x24')](function(_0x39ee0f){return _0x39ee0f;});}return null;};}function removeEntity(_0x58a028,_0x1f4457){return function(_0x62c939){if(_0x62c939){return _0x62c939[_0xc2df('0x25')]()[_0xc2df('0x24')](function(){_0x58a028[_0xc2df('0x19')](0xcc)[_0xc2df('0x1a')]();});}};}function handleEntityNotFound(_0x22985f,_0x17bb59){return function(_0x53d649){if(!_0x53d649){_0x22985f[_0xc2df('0x26')](0x194);}return _0x53d649;};}function handleError(_0x1b30cb,_0x43355b){_0x43355b=_0x43355b||0x1f4;return function(_0x3465f6){logger[_0xc2df('0x27')](_0x3465f6[_0xc2df('0x28')]);if(_0x3465f6['name']){delete _0x3465f6['name'];}_0x1b30cb[_0xc2df('0x19')](_0x43355b)[_0xc2df('0x29')](_0x3465f6);};}function getMustacheRender(_0xe87b4b,_0x1b9e52){return Mustache[_0xc2df('0x2a')](_0xe87b4b,_[_0xc2df('0x2b')](_0x1b9e52[_0xc2df('0x2c')],{'contact':_0x1b9e52[_0xc2df('0x2d')],'message':_0x1b9e52[_0xc2df('0x2e')],'agent':_0x1b9e52[_0xc2df('0x2f')],'interaction':_0x1b9e52[_0xc2df('0x30')],'account':_0x1b9e52['account']}))||'';}exports[_0xc2df('0x31')]=function(_0x3a4e4a,_0x4c7175){var _0x389a10={'raw':!![],'where':{'id':_0x3a4e4a[_0xc2df('0x32')]['id']}},_0x2bb7c6={};_0x2bb7c6['model']=_[_0xc2df('0x33')](db[_0xc2df('0x34')][_0xc2df('0x35')]);_0x2bb7c6[_0xc2df('0x36')]=_['keys'](_0x3a4e4a[_0xc2df('0x36')]);_0x2bb7c6[_0xc2df('0x37')]=_[_0xc2df('0x38')](_0x2bb7c6[_0xc2df('0x39')],_0x2bb7c6[_0xc2df('0x36')]);_0x389a10[_0xc2df('0x3a')]=_[_0xc2df('0x38')](_0x2bb7c6['model'],qs['fields'](_0x3a4e4a[_0xc2df('0x36')][_0xc2df('0x3b')]));_0x389a10[_0xc2df('0x3a')]=_0x389a10[_0xc2df('0x3a')]['length']?_0x389a10[_0xc2df('0x3a')]:_0x2bb7c6[_0xc2df('0x39')];if(_0x3a4e4a[_0xc2df('0x36')][_0xc2df('0x3c')]){_0x389a10['include']=[{'all':!![]}];}_0x389a10=_[_0xc2df('0x2b')]({},_0x389a10,_0x3a4e4a[_0xc2df('0x3d')]);return db['MailApplication'][_0xc2df('0x3e')](_0x389a10)[_0xc2df('0x24')](handleEntityNotFound(_0x4c7175,null))[_0xc2df('0x24')](respondWithResult(_0x4c7175,null))[_0xc2df('0x3f')](handleError(_0x4c7175,null));};exports[_0xc2df('0x23')]=function(_0x5af478,_0x3af286){if(_0x5af478[_0xc2df('0x2c')]['id']){delete _0x5af478[_0xc2df('0x2c')]['id'];}return db[_0xc2df('0x34')][_0xc2df('0x3e')]({'where':{'id':_0x5af478['params']['id']}})[_0xc2df('0x24')](handleEntityNotFound(_0x3af286,null))[_0xc2df('0x24')](saveUpdates(_0x5af478[_0xc2df('0x2c')],null))[_0xc2df('0x24')](respondWithResult(_0x3af286,null))[_0xc2df('0x3f')](handleError(_0x3af286,null));};exports[_0xc2df('0x25')]=function(_0x18ea7d,_0x447154){return db[_0xc2df('0x34')][_0xc2df('0x3e')]({'where':{'id':_0x18ea7d[_0xc2df('0x32')]['id']}})[_0xc2df('0x24')](handleEntityNotFound(_0x447154,null))[_0xc2df('0x24')](removeEntity(_0x447154,null))[_0xc2df('0x3f')](handleError(_0x447154,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index e47728e..5351e11 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 _0xa613=['mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define'];(function(_0x289ccb,_0x6fd15b){var _0x5d35a8=function(_0x341df9){while(--_0x341df9){_0x289ccb['push'](_0x289ccb['shift']());}};_0x5d35a8(++_0x6fd15b);}(_0xa613,0x8a));var _0x3a61=function(_0x50e51a,_0x39e949){_0x50e51a=_0x50e51a-0x0;var _0xe02402=_0xa613[_0x50e51a];return _0xe02402;};'use strict';var _=require(_0x3a61('0x0'));var util=require('util');var logger=require(_0x3a61('0x1'))(_0x3a61('0x2'));var moment=require(_0x3a61('0x3'));var BPromise=require(_0x3a61('0x4'));var rp=require(_0x3a61('0x5'));var fs=require('fs');var path=require(_0x3a61('0x6'));var rimraf=require(_0x3a61('0x7'));var config=require(_0x3a61('0x8'));var attributes=require(_0x3a61('0x9'));module[_0x3a61('0xa')]=function(_0x50a744,_0x37904a){return _0x50a744[_0x3a61('0xb')]('MailApplication',attributes,{'tableName':_0x3a61('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3a61('0xd'),'collate':_0x3a61('0xe')});}; \ No newline at end of file +var _0xa958=['exports','define','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./mailApplication.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa958,0x94));var _0x8a95=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xa958[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x8a95('0x0'));var util=require('util');var logger=require(_0x8a95('0x1'))(_0x8a95('0x2'));var moment=require(_0x8a95('0x3'));var BPromise=require(_0x8a95('0x4'));var rp=require(_0x8a95('0x5'));var fs=require('fs');var path=require(_0x8a95('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8a95('0x7'));module[_0x8a95('0x8')]=function(_0x403364,_0x141f82){return _0x403364[_0x8a95('0x9')](_0x8a95('0xa'),attributes,{'tableName':_0x8a95('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8a95('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 5238145..f29b7ab 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 _0xc057=['../../config/environment','jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','update','options','raw','where','attributes','limit','UpdateMailApplication','lodash','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x98aa6f,_0x1c2cb0){var _0x1371ec=function(_0x56db51){while(--_0x56db51){_0x98aa6f['push'](_0x98aa6f['shift']());}};_0x1371ec(++_0x1c2cb0);}(_0xc057,0x13a));var _0x7c05=function(_0x3e7fb3,_0x2d9a8e){_0x3e7fb3=_0x3e7fb3-0x0;var _0x14d83d=_0xc057[_0x3e7fb3];return _0x14d83d;};'use strict';var _=require(_0x7c05('0x0'));var util=require('util');var moment=require(_0x7c05('0x1'));var BPromise=require('bluebird');var rs=require(_0x7c05('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7c05('0x3'));var logger=require(_0x7c05('0x4'))('rpc');var config=require(_0x7c05('0x5'));var jayson=require(_0x7c05('0x6'));var client=jayson[_0x7c05('0x7')][_0x7c05('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56c434,_0x429970,_0x207c3a){return new BPromise(function(_0x47d17c,_0x2bcc71){return client[_0x7c05('0x9')](_0x56c434,_0x207c3a)[_0x7c05('0xa')](function(_0x1ede13){logger['info'](_0x7c05('0xb'),_0x429970,_0x7c05('0xc'));logger[_0x7c05('0xd')](_0x7c05('0xe'),_0x429970,_0x7c05('0xc'),JSON[_0x7c05('0xf')](_0x1ede13));if(_0x1ede13[_0x7c05('0x10')]){if(_0x1ede13[_0x7c05('0x10')][_0x7c05('0x11')]===0x1f4){logger['error'](_0x7c05('0xb'),_0x429970,_0x1ede13['error'][_0x7c05('0x12')]);return _0x2bcc71(_0x1ede13[_0x7c05('0x10')][_0x7c05('0x12')]);}logger['error'](_0x7c05('0xb'),_0x429970,_0x1ede13[_0x7c05('0x10')][_0x7c05('0x12')]);return _0x47d17c(_0x1ede13['error']['message']);}else{logger[_0x7c05('0x13')](_0x7c05('0xb'),_0x429970,_0x7c05('0xc'));_0x47d17c(_0x1ede13[_0x7c05('0x14')][_0x7c05('0x12')]);}})[_0x7c05('0x15')](function(_0x2960c3){logger[_0x7c05('0x10')]('MailApplication,\x20%s,\x20%s',_0x429970,_0x2960c3);_0x2bcc71(_0x2960c3);});});}exports['UpdateMailApplication']=function(_0x65a6a9){var _0x732203=this;return new Promise(function(_0x1a5f4b,_0x3e5153){return db['MailApplication'][_0x7c05('0x16')](_0x65a6a9['body'],{'raw':_0x65a6a9[_0x7c05('0x17')]?_0x65a6a9[_0x7c05('0x17')][_0x7c05('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x65a6a9['options']?_0x65a6a9['options'][_0x7c05('0x19')]||null:null,'attributes':_0x65a6a9['options']?_0x65a6a9[_0x7c05('0x17')][_0x7c05('0x1a')]||null:null,'limit':_0x65a6a9[_0x7c05('0x17')]?_0x65a6a9[_0x7c05('0x17')][_0x7c05('0x1b')]||null:null})[_0x7c05('0xa')](function(_0x1181cc){logger[_0x7c05('0x13')](_0x7c05('0x1c'),_0x65a6a9);logger['debug']('UpdateMailApplication',_0x65a6a9,JSON['stringify'](_0x1181cc));_0x1a5f4b(_0x1181cc);})[_0x7c05('0x15')](function(_0x33f555){logger['error']('UpdateMailApplication',_0x33f555[_0x7c05('0x12')],_0x65a6a9);_0x3e5153(_0x732203[_0x7c05('0x10')](0x1f4,_0x33f555[_0x7c05('0x12')]));});});}; \ No newline at end of file +var _0x1c31=['stringify','error','code','message','result','UpdateMailApplication','update','body','options','raw','where','attributes','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x1c31,0x1cd));var _0x11c3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1c31[_0x432682];return _0x463d05;};'use strict';var _=require(_0x11c3('0x0'));var util=require('util');var moment=require(_0x11c3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11c3('0x2'));var db=require(_0x11c3('0x3'))['db'];var utils=require(_0x11c3('0x4'));var logger=require(_0x11c3('0x5'))('rpc');var config=require(_0x11c3('0x6'));var jayson=require(_0x11c3('0x7'));var client=jayson[_0x11c3('0x8')][_0x11c3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11a39b,_0x4244cf,_0x266e6d){return new BPromise(function(_0x1daa30,_0x5b0337){return client['request'](_0x11a39b,_0x266e6d)[_0x11c3('0xa')](function(_0x3a7c77){logger[_0x11c3('0xb')](_0x11c3('0xc'),_0x4244cf,_0x11c3('0xd'));logger['debug'](_0x11c3('0xe'),_0x4244cf,_0x11c3('0xd'),JSON[_0x11c3('0xf')](_0x3a7c77));if(_0x3a7c77[_0x11c3('0x10')]){if(_0x3a7c77[_0x11c3('0x10')][_0x11c3('0x11')]===0x1f4){logger['error'](_0x11c3('0xc'),_0x4244cf,_0x3a7c77[_0x11c3('0x10')][_0x11c3('0x12')]);return _0x5b0337(_0x3a7c77[_0x11c3('0x10')][_0x11c3('0x12')]);}logger[_0x11c3('0x10')](_0x11c3('0xc'),_0x4244cf,_0x3a7c77[_0x11c3('0x10')]['message']);return _0x1daa30(_0x3a7c77[_0x11c3('0x10')]['message']);}else{logger[_0x11c3('0xb')](_0x11c3('0xc'),_0x4244cf,_0x11c3('0xd'));_0x1daa30(_0x3a7c77[_0x11c3('0x13')][_0x11c3('0x12')]);}})['catch'](function(_0x1897eb){logger['error'](_0x11c3('0xc'),_0x4244cf,_0x1897eb);_0x5b0337(_0x1897eb);});});}exports[_0x11c3('0x14')]=function(_0x13fee6){var _0x31669c=this;return new Promise(function(_0x20edee,_0x237e97){return db['MailApplication'][_0x11c3('0x15')](_0x13fee6[_0x11c3('0x16')],{'raw':_0x13fee6[_0x11c3('0x17')]?_0x13fee6[_0x11c3('0x17')][_0x11c3('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13fee6[_0x11c3('0x17')]?_0x13fee6[_0x11c3('0x17')][_0x11c3('0x19')]||null:null,'attributes':_0x13fee6[_0x11c3('0x17')]?_0x13fee6[_0x11c3('0x17')][_0x11c3('0x1a')]||null:null,'limit':_0x13fee6[_0x11c3('0x17')]?_0x13fee6[_0x11c3('0x17')]['limit']||null:null})['then'](function(_0x2b1fc3){logger[_0x11c3('0xb')]('UpdateMailApplication',_0x13fee6);logger['debug'](_0x11c3('0x14'),_0x13fee6,JSON[_0x11c3('0xf')](_0x2b1fc3));_0x20edee(_0x2b1fc3);})[_0x11c3('0x1b')](function(_0x2eb682){logger[_0x11c3('0x10')](_0x11c3('0x14'),_0x2eb682[_0x11c3('0x12')],_0x13fee6);_0x237e97(_0x31669c[_0x11c3('0x10')](0x1f4,_0x2eb682[_0x11c3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 1e59ae7..a6f9360 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 _0x168a=['index','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','addTags','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated'];(function(_0x2cb9ac,_0x5d6a75){var _0x4ba8ac=function(_0x4ebec9){while(--_0x4ebec9){_0x2cb9ac['push'](_0x2cb9ac['shift']());}};_0x4ba8ac(++_0x5d6a75);}(_0x168a,0x99));var _0xa168=function(_0xe2b7cc,_0x23d063){_0xe2b7cc=_0xe2b7cc-0x0;var _0x148742=_0x168a[_0xe2b7cc];return _0x148742;};'use strict';var multer=require(_0xa168('0x0'));var util=require(_0xa168('0x1'));var path=require(_0xa168('0x2'));var timeout=require(_0xa168('0x3'));var express=require(_0xa168('0x4'));var router=express[_0xa168('0x5')]();var fs_extra=require(_0xa168('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa168('0x7'));var config=require(_0xa168('0x8'));var controller=require(_0xa168('0x9'));router[_0xa168('0xa')]('/',auth[_0xa168('0xb')](),controller[_0xa168('0xc')]);router[_0xa168('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xa168('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xa168('0xd')]);router[_0xa168('0xa')](_0xa168('0xe'),auth[_0xa168('0xb')](),controller[_0xa168('0xf')]);router[_0xa168('0xa')](_0xa168('0x10'),auth[_0xa168('0xb')](),controller[_0xa168('0x11')]);router[_0xa168('0x12')]('/',auth[_0xa168('0xb')](),controller[_0xa168('0x13')]);router['post'](_0xa168('0xe'),auth['isAuthenticated'](),controller[_0xa168('0x14')]);router['post'](_0xa168('0x15'),auth['isAuthenticated'](),interaction[_0xa168('0x16')](_0xa168('0x17'),'mailinteraction:addtags'),controller[_0xa168('0x18')]);router[_0xa168('0x19')](_0xa168('0x1a'),auth[_0xa168('0xb')](),interaction['tracked'](_0xa168('0x17'),_0xa168('0x1b')),controller[_0xa168('0x1c')]);router[_0xa168('0x1d')](_0xa168('0x1a'),auth['isAuthenticated'](),interaction[_0xa168('0x16')]('mail',_0xa168('0x1e')),controller[_0xa168('0x1f')]);router[_0xa168('0x1d')]('/:id/tags',auth[_0xa168('0xb')](),controller['removeTags']);module[_0xa168('0x20')]=router; \ No newline at end of file +var _0x62cf=['getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','delete','mailinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages'];(function(_0x4c7bcc,_0x46780d){var _0x196738=function(_0x59f896){while(--_0x59f896){_0x4c7bcc['push'](_0x4c7bcc['shift']());}};_0x196738(++_0x46780d);}(_0x62cf,0x143));var _0xf62c=function(_0x2b8a54,_0x569c4d){_0x2b8a54=_0x2b8a54-0x0;var _0x2596a4=_0x62cf[_0x2b8a54];return _0x2596a4;};'use strict';var multer=require('multer');var util=require(_0xf62c('0x0'));var path=require(_0xf62c('0x1'));var timeout=require(_0xf62c('0x2'));var express=require(_0xf62c('0x3'));var router=express[_0xf62c('0x4')]();var fs_extra=require(_0xf62c('0x5'));var auth=require(_0xf62c('0x6'));var interaction=require(_0xf62c('0x7'));var config=require('../../config/environment');var controller=require(_0xf62c('0x8'));router[_0xf62c('0x9')]('/',auth[_0xf62c('0xa')](),controller[_0xf62c('0xb')]);router[_0xf62c('0x9')](_0xf62c('0xc'),auth[_0xf62c('0xa')](),controller[_0xf62c('0xd')]);router['get'](_0xf62c('0xe'),auth[_0xf62c('0xa')](),controller[_0xf62c('0xf')]);router['get'](_0xf62c('0x10'),auth['isAuthenticated'](),controller[_0xf62c('0x11')]);router[_0xf62c('0x9')](_0xf62c('0x12'),auth['isAuthenticated'](),controller[_0xf62c('0x13')]);router[_0xf62c('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf62c('0x14')](_0xf62c('0x10'),auth[_0xf62c('0xa')](),controller[_0xf62c('0x15')]);router[_0xf62c('0x14')](_0xf62c('0x16'),auth[_0xf62c('0xa')](),interaction[_0xf62c('0x17')](_0xf62c('0x18'),_0xf62c('0x19')),controller[_0xf62c('0x1a')]);router[_0xf62c('0x1b')](_0xf62c('0xe'),auth[_0xf62c('0xa')](),interaction[_0xf62c('0x17')](_0xf62c('0x18'),'mailinteraction:update'),controller[_0xf62c('0x1c')]);router[_0xf62c('0x1d')](_0xf62c('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0xf62c('0x18'),_0xf62c('0x1e')),controller[_0xf62c('0x1f')]);router[_0xf62c('0x1d')]('/:id/tags',auth[_0xf62c('0xa')](),controller[_0xf62c('0x20')]);module[_0xf62c('0x21')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 20d096b..3287639 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 _0x05a0=['TEXT','DATE','out','ENUM','sequelize','iconv','exports','BOOLEAN','STRING'];(function(_0x3a90b6,_0x782086){var _0x56f71a=function(_0x14ff5e){while(--_0x14ff5e){_0x3a90b6['push'](_0x3a90b6['shift']());}};_0x56f71a(++_0x782086);}(_0x05a0,0x94));var _0x005a=function(_0x4c7919,_0x7c6f36){_0x4c7919=_0x4c7919-0x0;var _0x2ec363=_0x05a0[_0x4c7919];return _0x2ec363;};'use strict';var Sequelize=require(_0x005a('0x0'));var iconv=require(_0x005a('0x1'));module[_0x005a('0x2')]={'closed':{'type':Sequelize[_0x005a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x005a('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x005a('0x4')](0x1fe)},'to':{'type':Sequelize[_0x005a('0x4')]},'cc':{'type':Sequelize[_0x005a('0x5')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x005a('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x005a('0x6')]},'substatus':{'type':Sequelize[_0x005a('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x005a('0x6')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x005a('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x005a('0x8')]('in',_0x005a('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x5e0a=['ENUM','out','sequelize','iconv','exports','BOOLEAN','STRING','TEXT','long','DATE'];(function(_0x3b8f2e,_0x5a99a8){var _0x1433d5=function(_0x5e0353){while(--_0x5e0353){_0x3b8f2e['push'](_0x3b8f2e['shift']());}};_0x1433d5(++_0x5a99a8);}(_0x5e0a,0x16a));var _0xa5e0=function(_0x4744f8,_0x482233){_0x4744f8=_0x4744f8-0x0;var _0x1894b=_0x5e0a[_0x4744f8];return _0x1894b;};'use strict';var Sequelize=require(_0xa5e0('0x0'));var iconv=require(_0xa5e0('0x1'));module[_0xa5e0('0x2')]={'closed':{'type':Sequelize[_0xa5e0('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xa5e0('0x4')]},'secondDisposition':{'type':Sequelize[_0xa5e0('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa5e0('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xa5e0('0x4')]},'cc':{'type':Sequelize[_0xa5e0('0x5')](_0xa5e0('0x6'))},'subject':{'type':Sequelize[_0xa5e0('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xa5e0('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xa5e0('0x7')]},'firstMsgDirection':{'type':Sequelize[_0xa5e0('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa5e0('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xa5e0('0x8')]('in',_0xa5e0('0x9')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 55ddf83..5dcae50 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 _0x9dfd=['color','from','tools_tags','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\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','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','compact','isEmpty','MailAccountId','concat','parse','$lte','null','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closedAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.UserId','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','show','params','includeAll','include','options','create','describe','addMessage','ids','omit','getMessages','rawAttributes','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','addTags','setTags','spread','emit','removeTags','download','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','build','writeFileSync','message%d.eml','log','err','rimraf','fast-json-patch','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','html-to-text','juice','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','count','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','render','merge','body','contact','agent','account','Users','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','plainBody','catch','index','MailInteraction','fieldName','type','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','select','field'];(function(_0x30e1c3,_0x386355){var _0x46ece2=function(_0xb8a692){while(--_0xb8a692){_0x30e1c3['push'](_0x30e1c3['shift']());}};_0x46ece2(++_0x386355);}(_0x9dfd,0x190));var _0xd9df=function(_0x3ace5e,_0x2f54e9){_0x3ace5e=_0x3ace5e-0x0;var _0x5c64d3=_0x9dfd[_0x3ace5e];return _0x5c64d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd9df('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd9df('0x1'));var rp=require('request-promise');var moment=require(_0xd9df('0x2'));var BPromise=require(_0xd9df('0x3'));var Mustache=require('mustache');var util=require(_0xd9df('0x4'));var path=require('path');var sox=require(_0xd9df('0x5'));var csv=require('to-csv');var ejs=require(_0xd9df('0x6'));var fs=require('fs');var fs_extra=require(_0xd9df('0x7'));var _=require(_0xd9df('0x8'));var squel=require('squel');var crypto=require(_0xd9df('0x9'));var jsforce=require(_0xd9df('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd9df('0xb'));var querystring=require('querystring');var Papa=require(_0xd9df('0xc'));var htmlToText=require(_0xd9df('0xd'));var juice=require(_0xd9df('0xe'));var Redis=require('ioredis');var authService=require(_0xd9df('0xf'));var qs=require(_0xd9df('0x10'));var as=require(_0xd9df('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd9df('0x12'))(_0xd9df('0x13'));var utils=require(_0xd9df('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd9df('0x15'))['db'];config[_0xd9df('0x16')]=_[_0xd9df('0x17')](config['redis'],{'host':_0xd9df('0x18'),'port':0x18eb});var socket=require(_0xd9df('0x19'))(new Redis(config[_0xd9df('0x16')]));require('./mailInteraction.socket')[_0xd9df('0x1a')](socket);function respondWithStatusCode(_0x4e3db3,_0x3fe310){_0x3fe310=_0x3fe310||0xcc;return function(_0xbe0884){if(_0xbe0884){return _0x4e3db3[_0xd9df('0x1b')](_0x3fe310);}return _0x4e3db3['status'](_0x3fe310)[_0xd9df('0x1c')]();};}function respondWithResult(_0x51508f,_0x2086a0){_0x2086a0=_0x2086a0||0xc8;return function(_0x30d1e1){if(_0x30d1e1){return _0x51508f['status'](_0x2086a0)[_0xd9df('0x1d')](_0x30d1e1);}};}function respondWithFilteredResult(_0x3b2910,_0x4fd500){return function(_0x3320b5){if(_0x3320b5){var _0x8ad506=typeof _0x4fd500[_0xd9df('0x1e')]===_0xd9df('0x1f')&&typeof _0x4fd500['limit']===_0xd9df('0x1f');var _0xfe2298=_0x3320b5[_0xd9df('0x20')];var _0xf52339=_0x8ad506?0x0:_0x4fd500['offset'];var _0x55b295=_0x8ad506?_0x3320b5[_0xd9df('0x20')]:_0x4fd500['offset']+_0x4fd500['limit'];var _0x3897fb;if(_0x55b295>=_0xfe2298){_0x55b295=_0xfe2298;_0x3897fb=0xc8;}else{_0x3897fb=0xce;}_0x3b2910[_0xd9df('0x21')](_0x3897fb);return _0x3b2910['set'](_0xd9df('0x22'),_0xf52339+'-'+_0x55b295+'/'+_0xfe2298)[_0xd9df('0x1d')](_0x3320b5);}return null;};}function patchUpdates(_0x270ad4){return function(_0x5f1354){try{jsonpatch[_0xd9df('0x23')](_0x5f1354,_0x270ad4,!![]);}catch(_0xdd556){return BPromise[_0xd9df('0x24')](_0xdd556);}return _0x5f1354[_0xd9df('0x25')]();};}function saveUpdates(_0x53da92,_0x53214a){return function(_0x20701c){if(_0x20701c){return _0x20701c[_0xd9df('0x26')](_0x53da92)[_0xd9df('0x27')](function(_0x142250){return _0x142250;});}return null;};}function removeEntity(_0x3648e6,_0x21aecd){return function(_0xbbb07c){if(_0xbbb07c){return _0xbbb07c[_0xd9df('0x28')]()['then'](function(){_0x3648e6[_0xd9df('0x21')](0xcc)[_0xd9df('0x1c')]();});}};}function handleEntityNotFound(_0x1fae9d,_0x3a846e){return function(_0x54615d){if(!_0x54615d){_0x1fae9d[_0xd9df('0x1b')](0x194);}return _0x54615d;};}function handleError(_0x48eb80,_0x50693d){_0x50693d=_0x50693d||0x1f4;return function(_0xb1ac77){logger[_0xd9df('0x29')](_0xb1ac77[_0xd9df('0x2a')]);if(_0xb1ac77['name']){delete _0xb1ac77[_0xd9df('0x2b')];}_0x48eb80[_0xd9df('0x21')](_0x50693d)[_0xd9df('0x2c')](_0xb1ac77);};}function getMustacheRender(_0x34e746,_0x2a36e9){return Mustache[_0xd9df('0x2d')](_0x34e746,_[_0xd9df('0x2e')](_0x2a36e9[_0xd9df('0x2f')],{'contact':_0x2a36e9[_0xd9df('0x30')],'message':_0x2a36e9['message'],'agent':_0x2a36e9[_0xd9df('0x31')],'interaction':_0x2a36e9['interaction'],'account':_0x2a36e9[_0xd9df('0x32')]}))||'';}function getInteractionUsers(_0x14dd15,_0x52cc58){return new BPromise(function(_0x2244b3,_0x4c22bd){try{if(_0x52cc58[_0x14dd15['id']]){_0x14dd15[_0xd9df('0x33')]=_[_0xd9df('0x34')](_0x52cc58[_0x14dd15['id']],function(_0x30887b){return{'id':_0x30887b['id'],'fullname':_0x30887b[_0xd9df('0x35')]};});}}catch(_0x40ae10){_0x4c22bd(_0x40ae10);}_0x2244b3(_0x14dd15);});}function getInteractionTags(_0x5ed73f,_0x213b4d){return new BPromise(function(_0x3aa071,_0x5ee8bb){try{if(_0x5ed73f[_0xd9df('0x36')]){_0x5ed73f[_0xd9df('0x37')]=[];_0x5ed73f['TagIds'][_0xd9df('0x38')](',')[_0xd9df('0x39')](function(_0x5f3bcf){_0x5ed73f[_0xd9df('0x37')][_0xd9df('0x3a')](_0x213b4d[_0x5f3bcf]);});}delete _0x5ed73f[_0xd9df('0x36')];}catch(_0x2358b9){_0x5ee8bb(_0x2358b9);}_0x3aa071(_0x5ed73f);});}function getLastMessageText(_0x533150){return new BPromise(function(_0x2e232f,_0x31fe6a){return db[_0xd9df('0x3b')][_0xd9df('0x3c')]({'where':{'$and':[{'MailInteractionId':_0x533150['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xd9df('0x3d')],'order':'-id','raw':!![]})[_0xd9df('0x27')](function(_0x33989e){if(_0x33989e&&_0x33989e[_0xd9df('0x3d')]){_0x533150['lastMsgText']=_['trimStart'](_0x33989e[_0xd9df('0x3d')]);}_0x2e232f(_0x533150);})[_0xd9df('0x3e')](function(_0x3109bf){_0x31fe6a(_0x3109bf);});});}function updateMailInteraction(_0x3a8c67,_0x57397e,_0x900784,_0x5ddf8f){return new BPromise(function(_0x54ef8a,_0xd35fb2){return getInteractionUsers(_0x3a8c67,_0x900784)[_0xd9df('0x27')](function(_0x566f41){return getInteractionTags(_0x566f41,_0x57397e);})[_0xd9df('0x27')](function(_0x130b1b){if(_0x5ddf8f){_0x54ef8a(getLastMessageText(_0x130b1b));}else{_0x54ef8a(_0x130b1b);}})[_0xd9df('0x3e')](function(_0x48001d){_0xd35fb2(_0x48001d);});});}exports[_0xd9df('0x3f')]=function(_0x58d25e,_0x4668e4){var _0x1addc6={},_0x42e312={},_0x1b5830={'count':0x0,'rows':[]};var _0x307404=_[_0xd9df('0x34')](db[_0xd9df('0x40')]['rawAttributes'],function(_0x52d3c5){return{'name':_0x52d3c5[_0xd9df('0x41')],'type':_0x52d3c5[_0xd9df('0x42')]['key']};});_0x42e312[_0xd9df('0x43')]=_[_0xd9df('0x34')](_0x307404,_0xd9df('0x2b'));_0x42e312['query']=_[_0xd9df('0x44')](_0x58d25e['query']);_0x42e312['filters']=_[_0xd9df('0x45')](_0x42e312[_0xd9df('0x43')],_0x42e312['query']);_0x1addc6[_0xd9df('0x46')]=_[_0xd9df('0x45')](_0x42e312[_0xd9df('0x43')],qs[_0xd9df('0x47')](_0x58d25e['query'][_0xd9df('0x47')]));_0x1addc6[_0xd9df('0x46')]=_0x1addc6['attributes'][_0xd9df('0x48')]?_0x1addc6[_0xd9df('0x46')]:_0x42e312[_0xd9df('0x43')];if(!_0x58d25e[_0xd9df('0x49')][_0xd9df('0x4a')](_0xd9df('0x4b'))){_0x1addc6[_0xd9df('0x4c')]=qs['limit'](_0x58d25e['query'][_0xd9df('0x4c')]);_0x1addc6[_0xd9df('0x1e')]=qs[_0xd9df('0x1e')](_0x58d25e['query'][_0xd9df('0x1e')]);}_0x1addc6[_0xd9df('0x4d')]=qs[_0xd9df('0x4e')](_0x58d25e[_0xd9df('0x49')][_0xd9df('0x4e')]);_0x1addc6[_0xd9df('0x4f')]=qs[_0xd9df('0x50')](_[_0xd9df('0x51')](_0x58d25e['query'],_0x42e312[_0xd9df('0x50')]),_0x307404);var _0x2f0f5f=[];var _0x4aeb24=squel[_0xd9df('0x52')]()[_0xd9df('0x53')]('id')[_0xd9df('0x53')](_0xd9df('0x2b'))[_0xd9df('0x53')](_0xd9df('0x54'))[_0xd9df('0x55')](_0xd9df('0x56'));var _0x24aa00=squel[_0xd9df('0x52')]()['field']('u.id')[_0xd9df('0x53')]('u.fullname')[_0xd9df('0x53')](_0xd9df('0x57'))[_0xd9df('0x55')](_0xd9df('0x58'),'ui')[_0xd9df('0x59')]('users','u',_0xd9df('0x5a'));var _0x393264=squel[_0xd9df('0x52')]()['from']('mail_interactions','i')['left_join']('cm_contacts','c',_0xd9df('0x5b'))[_0xd9df('0x59')]('users','o',_0xd9df('0x5c'))['left_join'](_0xd9df('0x5d'),'a',_0xd9df('0x5e'))[_0xd9df('0x59')](_0xd9df('0x5f'),'me','me.MailInteractionId\x20=\x20i.id')['left_join'](_0xd9df('0x60'),'it',_0xd9df('0x61'))[_0xd9df('0x59')](_0xd9df('0x56'),'t',_0xd9df('0x62'));var _0x176d6c=squel[_0xd9df('0x63')]();var _0x5596e7=[];var _0x26f0df=squel[_0xd9df('0x63')]();var _0x30cd8f;if(_0x58d25e[_0xd9df('0x49')][_0xd9df('0x64')]){_0x30cd8f=as[_0xd9df('0x65')](_0x58d25e['query']['search']);var _0x44076c=_0x30cd8f[_0xd9df('0x66')];for(var _0x264fe5=0x0;_0x264fe5<_0x30cd8f[_0xd9df('0x67')]['length'];_0x264fe5++){var _0x15d45b=_0x30cd8f['conditions'][_0x264fe5];var _0x5cf5e7='i';var _0x15d8b0=_[_0xd9df('0x68')](_0x307404,[_0xd9df('0x2b'),_0x15d45b[_0xd9df('0x53')]]);if(!_0x15d8b0){switch(_0x15d45b[_0xd9df('0x53')]){case _0xd9df('0x69'):if(_0x15d45b[_0xd9df('0x6a')]==0x1){_0x393264['having']('`'+_0x15d45b['field']+_0xd9df('0x6b'));}else{_0x393264['having']('`'+_0x15d45b[_0xd9df('0x53')]+_0xd9df('0x6c'));}break;case _0xd9df('0x6d'):if(_0x15d45b['operator']===_0xd9df('0x6e')){if(_0x15d45b['value'][_0xd9df('0x38')]('\x20')[_0xd9df('0x48')]>0x1){_0x176d6c[_0x44076c](_0xd9df('0x6f'),qs[_0xd9df('0x70')](_0x15d45b[_0xd9df('0x6a')]),null);}else{var _0x44fef9='%'+_0x15d45b[_0xd9df('0x6a')]+'%';_0x176d6c[_0x44076c](_0xd9df('0x71'),_0x44fef9,_0x44fef9,_0x44fef9);}}else{_0x15d8b0=_[_0xd9df('0x68')](_0x307404,[_0xd9df('0x2b'),'ContactId']);_0x15d45b[_0xd9df('0x53')]='ContactId';_0x32bc7f=as['buildExpression'](_0x5cf5e7,_0x15d8b0[_0xd9df('0x42')],_0x15d45b);_0x176d6c[_0x44076c](_0x32bc7f[_0xd9df('0x72')],_0x32bc7f['value'][_0xd9df('0x73')],_0x32bc7f[_0xd9df('0x6a')]['end']);}break;case'Tag':var _0x5ad23f=_0x15d45b[_0xd9df('0x6a')]['split'](',')[_0xd9df('0x34')](function(_0x44e3bd){return Number(_0x44e3bd);});_0x5ad23f[_0xd9df('0x39')](function(_0x3874dd){_0x26f0df['or'](_0xd9df('0x74'),'%,'+_0x3874dd+',%');});_0x5596e7=_['union'](_0x5596e7,_0x5ad23f);break;case _0xd9df('0x75'):if(_0x15d45b[_0xd9df('0x76')]===_0xd9df('0x6e')){_0x176d6c[_0x44076c](_0xd9df('0x77'),'%'+_0x15d45b[_0xd9df('0x6a')]+'%',null);}else{_0x15d8b0=_[_0xd9df('0x68')](_0x307404,['name',_0xd9df('0x78')]);_0x15d45b[_0xd9df('0x53')]=_0xd9df('0x78');_0x32bc7f=as[_0xd9df('0x79')](_0x5cf5e7,_0x15d8b0[_0xd9df('0x42')],_0x15d45b);_0x176d6c[_0x44076c](_0x32bc7f[_0xd9df('0x72')],_0x32bc7f[_0xd9df('0x6a')]['start'],_0x32bc7f[_0xd9df('0x6a')][_0xd9df('0x1c')]);}break;case _0xd9df('0x3d'):_0x32bc7f=as[_0xd9df('0x79')]('me',null,_0x15d45b);_0x176d6c[_0x44076c](_0x32bc7f['text'],_0x32bc7f[_0xd9df('0x6a')][_0xd9df('0x73')],_0x32bc7f[_0xd9df('0x6a')][_0xd9df('0x1c')]);break;}}else{var _0x32bc7f=as[_0xd9df('0x79')](_0x5cf5e7,_0x15d8b0[_0xd9df('0x42')],_0x15d45b);_0x176d6c[_0x44076c](_0x32bc7f[_0xd9df('0x72')],_0x32bc7f[_0xd9df('0x6a')][_0xd9df('0x73')],_0x32bc7f[_0xd9df('0x6a')][_0xd9df('0x1c')]);}}}else{var _0x32e7d7=_(_0x58d25e['query'])['keys']()[_0xd9df('0x34')](function(_0x425ea6){return _[_0xd9df('0x7a')](_0x307404,[_0xd9df('0x2b'),_0x425ea6])?_0x425ea6:undefined;})[_0xd9df('0x7b')]()[_0xd9df('0x6a')]();if(!_[_0xd9df('0x7c')](_0x32e7d7)){_0x32e7d7[_0xd9df('0x39')](function(_0x1590b2){if(_0x1590b2===_0xd9df('0x7d')){_0x393264[_0xd9df('0x4f')]('i.MailAccountId\x20IN\x20?',[][_0xd9df('0x7e')](_0x58d25e[_0xd9df('0x49')][_0x1590b2]));}else if(_0x1590b2==='createdAt'){var _0x534b1b=JSON[_0xd9df('0x7f')](_0x58d25e['query'][_0x1590b2])['$gte'];var _0x3657c8=JSON['parse'](_0x58d25e['query'][_0x1590b2])[_0xd9df('0x80')];_0x393264[_0xd9df('0x4f')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x534b1b,_0x3657c8);}else{if(_0x58d25e[_0xd9df('0x49')][_0x1590b2]===_0xd9df('0x81')){_0x393264['where']('i.'+_0x1590b2+'\x20IS\x20NULL');}else{_0x393264[_0xd9df('0x4f')]('i.'+_0x1590b2+_0xd9df('0x82'),_0x58d25e[_0xd9df('0x49')][_0x1590b2]);}}});}if(_0x58d25e[_0xd9df('0x49')][_0xd9df('0x83')]){if(_0x58d25e[_0xd9df('0x49')][_0xd9df('0x83')]==0x1){_0x393264[_0xd9df('0x84')](_0xd9df('0x85'));}else{_0x393264[_0xd9df('0x84')](_0xd9df('0x86'));}}if(_0x58d25e[_0xd9df('0x49')][_0xd9df('0x87')]){_0x5596e7=_[_0xd9df('0x88')](_0x58d25e[_0xd9df('0x49')][_0xd9df('0x87')])?_0x58d25e[_0xd9df('0x49')][_0xd9df('0x87')]:new Array(_0x58d25e[_0xd9df('0x49')]['tag']);_0x5596e7[_0xd9df('0x39')](function(_0x174013){_0x26f0df['or'](_0xd9df('0x74'),'%,'+_0x174013+',%');});}if(_0x58d25e[_0xd9df('0x49')][_0xd9df('0x89')]){var _0x6cd0a=_0x58d25e[_0xd9df('0x49')][_0xd9df('0x89')][_0xd9df('0x8a')]('\x5c','\x5c\x5c')[_0xd9df('0x8a')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x6cd0a)){_0x176d6c['or'](_0xd9df('0x8b'),_0x6cd0a+'%');}else if(qs[_0xd9df('0x8c')](_0x6cd0a)){_0x176d6c['or'](_0xd9df('0x8d'),_0x6cd0a+'%');}else{_0x176d6c['or'](_0xd9df('0x8e'),qs['getFullTextValue'](_0x6cd0a))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd9df('0x70')](_0x6cd0a));}}}_0x393264[_0xd9df('0x4f')](_0x176d6c);_0x393264[_0xd9df('0x8f')](_0xd9df('0x90'));var _0x14c05e={'type':db['Sequelize'][_0xd9df('0x91')][_0xd9df('0x92')],'raw':!![]};var _0x1aeb38=_0x393264['clone']();_0x1aeb38[_0xd9df('0x53')](_0xd9df('0x90'));_0x1aeb38[_0xd9df('0x53')](_0xd9df('0x93'),_0xd9df('0x69'));if(_0x1addc6[_0xd9df('0x4d')]){_0x1addc6[_0xd9df('0x4d')][_0xd9df('0x39')](function(_0x2fac51){var _0x3ca200=_0x2fac51[0x0]==='contactName'?_0x2fac51[0x0]:'i.'+_0x2fac51[0x0];_0x393264[_0xd9df('0x4d')](_0x3ca200,_0x2fac51[0x1]===_0xd9df('0x94')?![]:!![]);});}if(!_[_0xd9df('0x7c')](_0x5596e7)){_0x393264[_0xd9df('0x84')](_0x26f0df);_0x1aeb38['where'](_0xd9df('0x95'),_0x5596e7);}BPromise[_0xd9df('0x96')]()['then'](function(){if(!_0x30cd8f){if(_0x58d25e[_0xd9df('0x49')][_0xd9df('0x7d')])return;_0x1aeb38[_0xd9df('0x4f')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x393264['where'](_0xd9df('0x97'));return;}if(_0x58d25e[_0xd9df('0x98')][_0xd9df('0x99')]!==_0xd9df('0x31'))return;return _0x58d25e[_0xd9df('0x98')][_0xd9df('0x9a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4898e7){if(_[_0xd9df('0x7c')](_0x4898e7)){_0x1aeb38['where']('i.MailAccountId\x20IS\x20NULL');_0x393264[_0xd9df('0x4f')]('i.MailAccountId\x20IS\x20NULL');}else{_0x1aeb38['where'](_0xd9df('0x9b'),_[_0xd9df('0x34')](_0x4898e7,'id'));_0x393264[_0xd9df('0x4f')](_0xd9df('0x9b'),_['map'](_0x4898e7,'id'));}});})[_0xd9df('0x27')](function(){if(_0x58d25e[_0xd9df('0x98')][_0xd9df('0x99')]===_0xd9df('0x31')&&!_0x30cd8f&&!_0x58d25e[_0xd9df('0x49')][_0xd9df('0x7d')])return[];return db[_0xd9df('0x9c')][_0xd9df('0x49')](_0x1aeb38[_0xd9df('0x9d')](),_0x14c05e);})['then'](function(_0x1a1caa){_0x1b5830[_0xd9df('0x20')]=_0x1a1caa[_0xd9df('0x48')];if(_0x1b5830[_0xd9df('0x20')]===0x0)return[];return db[_0xd9df('0x9c')]['query'](_0x4aeb24[_0xd9df('0x9d')](),_0x14c05e)[_0xd9df('0x27')](function(_0x2be184){_0x2f0f5f=_[_0xd9df('0x9e')](_0x2be184,'id');_0x14c05e=_[_0xd9df('0x2e')](_0x14c05e,{'model':db[_0xd9df('0x40')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x58d25e['query']['fields']){_0x1addc6[_0xd9df('0x46')][_0xd9df('0x39')](function(_0x42120e){_0x393264[_0xd9df('0x53')]('i.'+_0x42120e);});}else{_0x393264[_0xd9df('0x53')](_0xd9df('0x93'),_0xd9df('0x69'));_0x393264[_0xd9df('0x53')](_0xd9df('0x9f'),_0xd9df('0xa0'));_0x393264['field'](_0xd9df('0xa1'),'Account.mandatoryDisposition');_0x393264[_0xd9df('0x53')](_0xd9df('0xa2'),_0xd9df('0xa3'));_0x393264['field']('i.id');_0x393264[_0xd9df('0x53')](_0xd9df('0xa4'));_0x393264[_0xd9df('0x53')](_0xd9df('0xa5'));_0x393264[_0xd9df('0x53')]('i.closed');_0x393264[_0xd9df('0x53')](_0xd9df('0xa6'));_0x393264[_0xd9df('0x53')]('i.attach');_0x393264[_0xd9df('0x53')]('i.lastMsgAt');_0x393264['field'](_0xd9df('0xa7'));_0x393264[_0xd9df('0x53')](_0xd9df('0xa8'));_0x393264['field'](_0xd9df('0xa9'));_0x393264[_0xd9df('0x53')](_0xd9df('0xaa'));_0x393264[_0xd9df('0x53')](_0xd9df('0xab'));_0x393264[_0xd9df('0x53')]('i.substatus');_0x393264['field']('i.to');_0x393264[_0xd9df('0x53')]('i.ContactId');_0x393264[_0xd9df('0x53')]('i.MailAccountId');_0x393264[_0xd9df('0x53')](_0xd9df('0xac'));_0x393264['field'](_0xd9df('0xad'),_0xd9df('0xae'));_0x393264['field']('c.lastName',_0xd9df('0xaf'));_0x393264[_0xd9df('0x53')]('c.email',_0xd9df('0xb0'));_0x393264[_0xd9df('0x53')](_0xd9df('0xb1'),'Contact.phone');_0x393264[_0xd9df('0x53')](_0xd9df('0xb2'),_0xd9df('0xb3'));_0x393264['field'](_0xd9df('0xb4'),_0xd9df('0xb5'));_0x393264[_0xd9df('0x53')]('o.fullname',_0xd9df('0xb6'));_0x393264[_0xd9df('0x53')](_0xd9df('0xb7'),_0xd9df('0xb8'));_0x393264[_0xd9df('0x53')](_0xd9df('0xb9'),_0xd9df('0x36'));}if(_0x1addc6[_0xd9df('0x4c')])_0x393264[_0xd9df('0x4c')](_0x1addc6[_0xd9df('0x4c')]);if(_0x1addc6[_0xd9df('0x1e')])_0x393264['offset'](_0x1addc6[_0xd9df('0x1e')]);return db['sequelize']['query'](_0x393264[_0xd9df('0x9d')](),_0x14c05e);})[_0xd9df('0x27')](function(_0x3d639d){if(_0x3d639d[_0xd9df('0x48')]>0x0)_0x24aa00[_0xd9df('0x4f')](_0xd9df('0xba'),_['map'](_0x3d639d,'id'));return db['sequelize'][_0xd9df('0x49')](_0x24aa00['toString'](),_0x14c05e)[_0xd9df('0x27')](function(_0x2e7c04){var _0x366bab=_[_0xd9df('0xbb')](_0x2e7c04,_0xd9df('0xbc'));var _0x599cd4=[];return db[_0xd9df('0xbd')][_0xd9df('0x3c')]({'attributes':[_0xd9df('0xbe')],'raw':!![]})[_0xd9df('0x27')](function(_0x2a2749){var _0x15f0b6=_0x2a2749[_0xd9df('0xbe')];_0x3d639d[_0xd9df('0x39')](function(_0x4e0b15){_0x599cd4[_0xd9df('0x3a')](updateMailInteraction(_0x4e0b15,_0x2f0f5f,_0x366bab,_0x15f0b6));});return BPromise[_0xd9df('0xbf')](_0x599cd4);});});});})[_0xd9df('0x27')](function(_0x1fd745){_0x1b5830['rows']=_0x1fd745;return _0x1b5830;})[_0xd9df('0x27')](respondWithFilteredResult(_0x4668e4,_0x1addc6))[_0xd9df('0x3e')](handleError(_0x4668e4,null));};exports[_0xd9df('0xc0')]=function(_0x3eed75,_0x58ee0e){var _0x3f356a={'raw':![],'where':{'id':_0x3eed75[_0xd9df('0xc1')]['id']}},_0x3626ee={};_0x3626ee[_0xd9df('0x43')]=_[_0xd9df('0x44')](db[_0xd9df('0x40')]['rawAttributes']);_0x3626ee[_0xd9df('0x49')]=_[_0xd9df('0x44')](_0x3eed75[_0xd9df('0x49')]);_0x3626ee[_0xd9df('0x50')]=_['intersection'](_0x3626ee[_0xd9df('0x43')],_0x3626ee[_0xd9df('0x49')]);_0x3f356a[_0xd9df('0x46')]=_[_0xd9df('0x45')](_0x3626ee[_0xd9df('0x43')],qs['fields'](_0x3eed75[_0xd9df('0x49')]['fields']));_0x3f356a['attributes']=_0x3f356a['attributes']['length']?_0x3f356a[_0xd9df('0x46')]:_0x3626ee[_0xd9df('0x43')];if(_0x3eed75[_0xd9df('0x49')][_0xd9df('0xc2')]){_0x3f356a[_0xd9df('0xc3')]=[{'all':!![]}];}_0x3f356a=_['merge']({},_0x3f356a,_0x3eed75[_0xd9df('0xc4')]);return db[_0xd9df('0x40')][_0xd9df('0x68')](_0x3f356a)['then'](handleEntityNotFound(_0x58ee0e,null))[_0xd9df('0x27')](respondWithResult(_0x58ee0e,null))[_0xd9df('0x3e')](handleError(_0x58ee0e,null));};exports[_0xd9df('0xc5')]=function(_0x26def5,_0xb2c313){return db[_0xd9df('0x40')][_0xd9df('0xc5')](_0x26def5[_0xd9df('0x2f')],{})['then'](respondWithResult(_0xb2c313,0xc9))['catch'](handleError(_0xb2c313,null));};exports[_0xd9df('0x26')]=function(_0x8de17b,_0x2360c0){if(_0x8de17b[_0xd9df('0x2f')]['id']){delete _0x8de17b['body']['id'];}return db['MailInteraction'][_0xd9df('0x68')]({'where':{'id':_0x8de17b['params']['id']}})['then'](handleEntityNotFound(_0x2360c0,null))[_0xd9df('0x27')](saveUpdates(_0x8de17b[_0xd9df('0x2f')],null))[_0xd9df('0x27')](respondWithResult(_0x2360c0,null))[_0xd9df('0x3e')](handleError(_0x2360c0,null));};exports[_0xd9df('0x28')]=function(_0x257d97,_0x3dd320){return db[_0xd9df('0x40')][_0xd9df('0x68')]({'where':{'id':_0x257d97['params']['id']}})[_0xd9df('0x27')](handleEntityNotFound(_0x3dd320,null))[_0xd9df('0x27')](removeEntity(_0x3dd320,null))[_0xd9df('0x3e')](handleError(_0x3dd320,null));};exports[_0xd9df('0xc6')]=function(_0x5d8622,_0x34782b){return db[_0xd9df('0x40')][_0xd9df('0xc6')]()['then'](respondWithResult(_0x34782b,null))[_0xd9df('0x3e')](handleError(_0x34782b,null));};exports[_0xd9df('0xc7')]=function(_0x43b4e4,_0x3e2de5,_0xe5b13d){return db['MailMessage']['find']({'where':{'id':_0x43b4e4[_0xd9df('0xc1')]['id']}})[_0xd9df('0x27')](handleEntityNotFound(_0x3e2de5,null))[_0xd9df('0x27')](function(_0x42f307){if(_0x42f307){return _0x42f307[_0xd9df('0xc7')](_0x43b4e4[_0xd9df('0x2f')][_0xd9df('0xc8')],_[_0xd9df('0xc9')](_0x43b4e4[_0xd9df('0x2f')],[_0xd9df('0xc8'),'id'])||{});}})[_0xd9df('0x27')](respondWithResult(_0x3e2de5,null))[_0xd9df('0x3e')](handleError(_0x3e2de5,null));};exports[_0xd9df('0xca')]=function(_0xd4dc4b,_0x3e1140,_0x5085e7){var _0xc320f7={'raw':![],'where':{}};var _0x5a75bc={};var _0x1bd17f={'count':0x0,'rows':[]};return db['MailInteraction'][_0xd9df('0x3c')]({'where':{'id':_0xd4dc4b[_0xd9df('0xc1')]['id']}})['then'](handleEntityNotFound(_0x3e1140,null))[_0xd9df('0x27')](function(_0x1e7326){if(_0x1e7326){_0x5a75bc[_0xd9df('0x43')]=_[_0xd9df('0x44')](db[_0xd9df('0x3b')][_0xd9df('0xcb')]);_0x5a75bc['query']=_[_0xd9df('0x44')](_0xd4dc4b[_0xd9df('0x49')]);_0x5a75bc[_0xd9df('0x50')]=_[_0xd9df('0x45')](_0x5a75bc[_0xd9df('0x43')],_0x5a75bc[_0xd9df('0x49')]);_0xc320f7[_0xd9df('0x46')]=_[_0xd9df('0x45')](_0x5a75bc[_0xd9df('0x43')],qs[_0xd9df('0x47')](_0xd4dc4b['query'][_0xd9df('0x47')]));_0xc320f7['attributes']=_0xc320f7[_0xd9df('0x46')][_0xd9df('0x48')]?_0xc320f7[_0xd9df('0x46')]:_0x5a75bc['model'];if(!_0xd4dc4b[_0xd9df('0x49')][_0xd9df('0x4a')](_0xd9df('0x4b'))){_0xc320f7['limit']=qs[_0xd9df('0x4c')](_0xd4dc4b[_0xd9df('0x49')][_0xd9df('0x4c')]);_0xc320f7['offset']=qs[_0xd9df('0x1e')](_0xd4dc4b['query']['offset']);}_0xc320f7[_0xd9df('0x4d')]=qs[_0xd9df('0x4e')](_0xd4dc4b[_0xd9df('0x49')][_0xd9df('0x4e')]);_0xc320f7[_0xd9df('0x4f')]=qs[_0xd9df('0x50')](_[_0xd9df('0x51')](_0xd4dc4b[_0xd9df('0x49')],_0x5a75bc['filters']));_0xc320f7[_0xd9df('0x4f')][_0xd9df('0xbc')]=_0x1e7326['id'];if(_0xd4dc4b[_0xd9df('0x49')][_0xd9df('0x89')]){_0xc320f7[_0xd9df('0x4f')]=_['merge'](_0xc320f7[_0xd9df('0x4f')],{'$or':_[_0xd9df('0x34')](_0xc320f7[_0xd9df('0x46')],function(_0x4ba2fd){var _0x43582d={};_0x43582d[_0x4ba2fd]={'$like':'%'+_0xd4dc4b[_0xd9df('0x49')]['filter']+'%'};return _0x43582d;})});}if(_0xd4dc4b[_0xd9df('0x49')][_0xd9df('0xcc')]){var _0x12ce5b=_0xd4dc4b['query'][_0xd9df('0xcc')]['split'](',');var _0x16a7aa={};_0x16a7aa[_0x12ce5b[0x0]]={'$gte':moment(_0x12ce5b[0x1])[_0xd9df('0xcd')](_0xd9df('0xce'))};_0xc320f7[_0xd9df('0x4f')]=_[_0xd9df('0x2e')](_0xc320f7['where'],_0x16a7aa);}_0xc320f7=_['merge']({},_0xc320f7,_0xd4dc4b[_0xd9df('0xc4')]);return db['MailMessage'][_0xd9df('0x20')]({'where':_0xc320f7[_0xd9df('0x4f')]})['then'](function(_0x473a3f){_0x1bd17f[_0xd9df('0x20')]=_0x473a3f;if(_0xd4dc4b['query']['includeAll']){_0xc320f7[_0xd9df('0xc3')]=[{'all':!![]}];}return db[_0xd9df('0x3b')][_0xd9df('0xcf')](_0xc320f7);})[_0xd9df('0x27')](function(_0x784015){if(_0xd4dc4b[_0xd9df('0x49')][_0xd9df('0xd0')]==='true'){for(var _0x2f552a=0x0;_0x2f552a<_0x784015[_0xd9df('0x48')];_0x2f552a++){_0x784015[_0x2f552a][_0xd9df('0x2f')]=juice(_0x784015[_0x2f552a]['body']);}}_0x1bd17f[_0xd9df('0xd1')]=_0x784015;return _0x1bd17f;});}})[_0xd9df('0x27')](respondWithFilteredResult(_0x3e1140,_0xc320f7))[_0xd9df('0x3e')](handleError(_0x3e1140,null));};exports[_0xd9df('0xd2')]=function(_0x4575a7,_0x1ddf92,_0x449621){return db['MailInteraction']['find']({'where':{'id':_0x4575a7[_0xd9df('0xc1')]['id']}})[_0xd9df('0x27')](handleEntityNotFound(_0x1ddf92,null))[_0xd9df('0x27')](function(_0x295895){if(_0x295895){return _0x295895[_0xd9df('0xd3')](_0x4575a7[_0xd9df('0x2f')]['ids'],_[_0xd9df('0xc9')](_0x4575a7[_0xd9df('0x2f')],['ids','id'])||{})[_0xd9df('0xd4')](function(){return db['Tag']['findAll']({'attributes':['id',_0xd9df('0x2b'),_0xd9df('0x54')],'where':{'id':_0x4575a7[_0xd9df('0x2f')][_0xd9df('0xc8')]}});})[_0xd9df('0x27')](function(_0x44c220){socket[_0xd9df('0xd5')]('mailInteractionTags:save',{'id':Number(_0x4575a7['params']['id']),'tags':_0x44c220||[]});return{'id':Number(_0x4575a7['params']['id']),'tags':_0x44c220||[]};});}})['then'](respondWithResult(_0x1ddf92,null))[_0xd9df('0x3e')](handleError(_0x1ddf92,null));};exports['removeTags']=function(_0x2e9231,_0x33faca,_0x396e86){return db['MailInteraction']['find']({'where':{'id':_0x2e9231[_0xd9df('0xc1')]['id']}})[_0xd9df('0x27')](handleEntityNotFound(_0x33faca,null))[_0xd9df('0x27')](function(_0x3605b4){if(_0x3605b4){return _0x3605b4[_0xd9df('0xd6')](_0x2e9231[_0xd9df('0x49')]['ids']);}})['then'](respondWithStatusCode(_0x33faca,null))['catch'](handleError(_0x33faca,null));};exports[_0xd9df('0xd7')]=function(_0x2fa7de,_0x3afe22){var _0x4c424d=moment()[_0xd9df('0xd8')]()[_0xd9df('0x9d')]();var _0x5760b4=path[_0xd9df('0xd9')](config[_0xd9df('0xda')],_0xd9df('0xdb'),'files',_0xd9df('0xdc'));var _0x24020e=path[_0xd9df('0xd9')](config[_0xd9df('0xda')],_0xd9df('0xdb'),_0xd9df('0xdd'),_0xd9df('0xde'));var _0x54660d=path[_0xd9df('0xd9')](_0x5760b4,_0x4c424d);var _0x40ea0e=util['format'](_0xd9df('0xdf'),_0x2fa7de['params']['id'],_0x4c424d);var _0x55f537=path[_0xd9df('0xd9')](_0x5760b4,_0x40ea0e);var _0x5aa4b5=[];if(_0x2fa7de['query'][_0xd9df('0xde')]){_0x5aa4b5[_0xd9df('0x3a')]({'model':db[_0xd9df('0xe0')],'as':_0xd9df('0xe1'),'raw':!![]});}var _0x2d8cb0=[{'model':db['MailMessage'],'as':_0xd9df('0xe2'),'attributes':['id',_0xd9df('0x2f'),_0xd9df('0x55'),'to','cc',_0xd9df('0xe3'),_0xd9df('0xe4'),_0xd9df('0xe5')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x5aa4b5}];return db['MailInteraction'][_0xd9df('0x68')]({'where':{'id':_0x2fa7de['params']['id']},'include':_0x2d8cb0})['then'](handleEntityNotFound(_0x3afe22,null))['then'](function(_0x3aaf71){if(_0x3aaf71&&_0x3aaf71[_0xd9df('0xe2')]){var _0x37cfce=_0x3aaf71[_0xd9df('0xe6')]({'plain':!![]});fs[_0xd9df('0xe7')](_0x54660d);return BPromise[_0xd9df('0xe8')](_0x37cfce[_0xd9df('0xe2')],function(_0x11afdf,_0xb41533){var _0x4c000e={'from':_0x11afdf[_0xd9df('0x55')],'to':_0x11afdf['to'],'subject':_0x11afdf['subject'],'html':_0x11afdf['body'],'headers':{'Date':moment(_0x11afdf[_0xd9df('0xe5')])[_0xd9df('0xcd')](_0xd9df('0xe9'))},'attachments':[]};if(_0x11afdf['cc']){_0x4c000e[_0xd9df('0xea')]['Cc']=_0x11afdf['cc'];}if(_0x11afdf[_0xd9df('0xe3')]){_0x4c000e[_0xd9df('0xea')][_0xd9df('0xeb')]=_0x11afdf[_0xd9df('0xe3')];}return new BPromise(function(_0x5b2957,_0x185835){if(_0x11afdf[_0xd9df('0xe1')]){for(var _0x42d821=0x0;_0x42d821<_0x11afdf[_0xd9df('0xe1')][_0xd9df('0x48')];_0x42d821++){var _0x58f7db=_0x11afdf[_0xd9df('0xe1')][_0x42d821];var _0x4a4244=path[_0xd9df('0xd9')](_0x24020e,_0x58f7db['basename']);if(fs[_0xd9df('0xec')](_0x4a4244)){_0x4c000e[_0xd9df('0xde')][_0xd9df('0x3a')]({'name':_0x58f7db[_0xd9df('0x2b')],'contentType':_0x58f7db['type'],'data':fs['readFileSync'](_0x4a4244)});}}}emlformat[_0xd9df('0xed')](_0x4c000e,function(_0x4506b4,_0xc648e2){if(_0x4506b4)return _0x185835(_0x4506b4);fs[_0xd9df('0xee')](path[_0xd9df('0xd9')](_0x54660d,util[_0xd9df('0xcd')](_0xd9df('0xef'),_0xb41533)),_0xc648e2);return _0x5b2957(_0xc648e2);});});})['then'](function(){return new BPromise(function(_0x3ae180,_0x511c4a){zipdir(_0x54660d,{'saveTo':_0x55f537},function(_0x32b0ca,_0x8080cf){if(_0x32b0ca)return _0x511c4a(_0x32b0ca);return _0x3ae180(_0x8080cf);});})['then'](function(){return new BPromise(function(_0x54b1ba,_0x2e11ca){rimraf(_0x54660d,function(_0x10a605){if(_0x10a605)_0x2e11ca(_0x10a605);return _0x54b1ba();});});})['then'](function(){return _0x3afe22[_0xd9df('0xd7')](_0x55f537,_0x40ea0e,function(_0x12448c){if(_0x12448c){console[_0xd9df('0xf0')](_0xd9df('0xf1'),_0x12448c);}else{fs['unlinkSync'](_0x55f537);}});});});}else{return _0x3afe22[_0xd9df('0x1b')](0xc8);}})[_0xd9df('0x3e')](handleError(_0x3afe22,null));}; \ No newline at end of file +var _0x0360=['parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','some','compact','isEmpty','MailAccountId','createdAt','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.closed','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','includeAll','include','options','catch','create','params','describe','addMessage','ids','omit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','spread','emit','mailInteractionTags:save','unix','join','files','root','server','attachments','transcript-%d-%s.zip','push','Messages','subject','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','err','unlinkSync','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','juice','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','Users','map','fullname','TagIds','Tags','forEach','MailMessage','findOne','out','plainBody','-id','trimStart','MailInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','field','color','from','select','u.id','u.fullname','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search'];(function(_0x3193dd,_0x590238){var _0x1baffa=function(_0x2523f1){while(--_0x2523f1){_0x3193dd['push'](_0x3193dd['shift']());}};_0x1baffa(++_0x590238);}(_0x0360,0x181));var _0x0036=function(_0xf017ad,_0x12f42f){_0xf017ad=_0xf017ad-0x0;var _0x29e990=_0x0360[_0xf017ad];return _0x29e990;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0036('0x0'));var zipdir=require(_0x0036('0x1'));var jsonpatch=require(_0x0036('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0036('0x3'));var Mustache=require('mustache');var util=require(_0x0036('0x4'));var path=require('path');var sox=require(_0x0036('0x5'));var csv=require(_0x0036('0x6'));var ejs=require(_0x0036('0x7'));var fs=require('fs');var fs_extra=require(_0x0036('0x8'));var _=require('lodash');var squel=require(_0x0036('0x9'));var crypto=require('crypto');var jsforce=require(_0x0036('0xa'));var deskjs=require(_0x0036('0xb'));var toCsv=require(_0x0036('0x6'));var querystring=require('querystring');var Papa=require(_0x0036('0xc'));var htmlToText=require('html-to-text');var juice=require(_0x0036('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0036('0xe'));var hardwareService=require(_0x0036('0xf'));var logger=require(_0x0036('0x10'))(_0x0036('0x11'));var utils=require('../../config/utils');var config=require(_0x0036('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x0036('0x13'))['db'];config[_0x0036('0x14')]=_[_0x0036('0x15')](config[_0x0036('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x0036('0x16'))(new Redis(config[_0x0036('0x14')]));require(_0x0036('0x17'))[_0x0036('0x18')](socket);function respondWithStatusCode(_0x4ec321,_0x186ce1){_0x186ce1=_0x186ce1||0xcc;return function(_0x421e62){if(_0x421e62){return _0x4ec321[_0x0036('0x19')](_0x186ce1);}return _0x4ec321[_0x0036('0x1a')](_0x186ce1)['end']();};}function respondWithResult(_0x578b9d,_0x3cff4b){_0x3cff4b=_0x3cff4b||0xc8;return function(_0x3905b4){if(_0x3905b4){return _0x578b9d[_0x0036('0x1a')](_0x3cff4b)[_0x0036('0x1b')](_0x3905b4);}};}function respondWithFilteredResult(_0x4b9421,_0xde2c32){return function(_0x47d490){if(_0x47d490){var _0x5be1de=typeof _0xde2c32[_0x0036('0x1c')]===_0x0036('0x1d')&&typeof _0xde2c32[_0x0036('0x1e')]===_0x0036('0x1d');var _0x2dab73=_0x47d490[_0x0036('0x1f')];var _0x592007=_0x5be1de?0x0:_0xde2c32[_0x0036('0x1c')];var _0x33b6f9=_0x5be1de?_0x47d490['count']:_0xde2c32[_0x0036('0x1c')]+_0xde2c32['limit'];var _0x369e1a;if(_0x33b6f9>=_0x2dab73){_0x33b6f9=_0x2dab73;_0x369e1a=0xc8;}else{_0x369e1a=0xce;}_0x4b9421['status'](_0x369e1a);return _0x4b9421[_0x0036('0x20')](_0x0036('0x21'),_0x592007+'-'+_0x33b6f9+'/'+_0x2dab73)[_0x0036('0x1b')](_0x47d490);}return null;};}function patchUpdates(_0x172d6d){return function(_0x58a88b){try{jsonpatch[_0x0036('0x22')](_0x58a88b,_0x172d6d,!![]);}catch(_0x39b614){return BPromise[_0x0036('0x23')](_0x39b614);}return _0x58a88b['save']();};}function saveUpdates(_0x5a06b3,_0x4a59cd){return function(_0x181034){if(_0x181034){return _0x181034[_0x0036('0x24')](_0x5a06b3)[_0x0036('0x25')](function(_0x54603b){return _0x54603b;});}return null;};}function removeEntity(_0x30100a,_0x4fc74e){return function(_0x4cf1af){if(_0x4cf1af){return _0x4cf1af[_0x0036('0x26')]()['then'](function(){_0x30100a[_0x0036('0x1a')](0xcc)[_0x0036('0x27')]();});}};}function handleEntityNotFound(_0x3a3b9e,_0x479d07){return function(_0x33da67){if(!_0x33da67){_0x3a3b9e[_0x0036('0x19')](0x194);}return _0x33da67;};}function handleError(_0x385ba6,_0x242a5d){_0x242a5d=_0x242a5d||0x1f4;return function(_0x3a767b){logger[_0x0036('0x28')](_0x3a767b[_0x0036('0x29')]);if(_0x3a767b[_0x0036('0x2a')]){delete _0x3a767b[_0x0036('0x2a')];}_0x385ba6[_0x0036('0x1a')](_0x242a5d)[_0x0036('0x2b')](_0x3a767b);};}function getMustacheRender(_0x4e8faf,_0x57df2a){return Mustache[_0x0036('0x2c')](_0x4e8faf,_[_0x0036('0x2d')](_0x57df2a[_0x0036('0x2e')],{'contact':_0x57df2a[_0x0036('0x2f')],'message':_0x57df2a[_0x0036('0x30')],'agent':_0x57df2a[_0x0036('0x31')],'interaction':_0x57df2a[_0x0036('0x32')],'account':_0x57df2a[_0x0036('0x33')]}))||'';}function getInteractionUsers(_0x16c65f,_0x4078c4){return new BPromise(function(_0x1d7120,_0x4a9877){try{if(_0x4078c4[_0x16c65f['id']]){_0x16c65f[_0x0036('0x34')]=_[_0x0036('0x35')](_0x4078c4[_0x16c65f['id']],function(_0x5122c2){return{'id':_0x5122c2['id'],'fullname':_0x5122c2[_0x0036('0x36')]};});}}catch(_0x319874){_0x4a9877(_0x319874);}_0x1d7120(_0x16c65f);});}function getInteractionTags(_0x3ee814,_0x53423a){return new BPromise(function(_0x412773,_0x571143){try{if(_0x3ee814[_0x0036('0x37')]){_0x3ee814[_0x0036('0x38')]=[];_0x3ee814['TagIds']['split'](',')[_0x0036('0x39')](function(_0x310039){_0x3ee814['Tags']['push'](_0x53423a[_0x310039]);});}delete _0x3ee814[_0x0036('0x37')];}catch(_0xec0db3){_0x571143(_0xec0db3);}_0x412773(_0x3ee814);});}function getLastMessageText(_0x30b82c){return new BPromise(function(_0xf33aa7,_0xc3e366){return db[_0x0036('0x3a')][_0x0036('0x3b')]({'where':{'$and':[{'MailInteractionId':_0x30b82c['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0036('0x3c')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x0036('0x3d')],'order':_0x0036('0x3e'),'raw':!![]})[_0x0036('0x25')](function(_0x51c03e){if(_0x51c03e&&_0x51c03e[_0x0036('0x3d')]){_0x30b82c['lastMsgText']=_[_0x0036('0x3f')](_0x51c03e['plainBody']);}_0xf33aa7(_0x30b82c);})['catch'](function(_0x7b4b78){_0xc3e366(_0x7b4b78);});});}function updateMailInteraction(_0x555e3e,_0x26dc8f,_0x4d9c8f,_0x2ba52a){return new BPromise(function(_0x5c1e79,_0x3e96f9){return getInteractionUsers(_0x555e3e,_0x4d9c8f)[_0x0036('0x25')](function(_0x23fb99){return getInteractionTags(_0x23fb99,_0x26dc8f);})[_0x0036('0x25')](function(_0x59d99b){if(_0x2ba52a){_0x5c1e79(getLastMessageText(_0x59d99b));}else{_0x5c1e79(_0x59d99b);}})['catch'](function(_0x970cc4){_0x3e96f9(_0x970cc4);});});}exports['index']=function(_0x1da95c,_0x9cdeb2){var _0x550d11={},_0x406afd={},_0x519ff3={'count':0x0,'rows':[]};var _0x2082a3=_[_0x0036('0x35')](db[_0x0036('0x40')][_0x0036('0x41')],function(_0x3ab8d8){return{'name':_0x3ab8d8[_0x0036('0x42')],'type':_0x3ab8d8[_0x0036('0x43')][_0x0036('0x44')]};});_0x406afd[_0x0036('0x45')]=_[_0x0036('0x35')](_0x2082a3,_0x0036('0x2a'));_0x406afd['query']=_[_0x0036('0x46')](_0x1da95c[_0x0036('0x47')]);_0x406afd[_0x0036('0x48')]=_[_0x0036('0x49')](_0x406afd['model'],_0x406afd[_0x0036('0x47')]);_0x550d11[_0x0036('0x4a')]=_[_0x0036('0x49')](_0x406afd[_0x0036('0x45')],qs[_0x0036('0x4b')](_0x1da95c['query'][_0x0036('0x4b')]));_0x550d11['attributes']=_0x550d11['attributes'][_0x0036('0x4c')]?_0x550d11[_0x0036('0x4a')]:_0x406afd[_0x0036('0x45')];if(!_0x1da95c[_0x0036('0x47')][_0x0036('0x4d')](_0x0036('0x4e'))){_0x550d11[_0x0036('0x1e')]=qs[_0x0036('0x1e')](_0x1da95c[_0x0036('0x47')][_0x0036('0x1e')]);_0x550d11[_0x0036('0x1c')]=qs[_0x0036('0x1c')](_0x1da95c[_0x0036('0x47')][_0x0036('0x1c')]);}_0x550d11[_0x0036('0x4f')]=qs[_0x0036('0x50')](_0x1da95c['query'][_0x0036('0x50')]);_0x550d11['where']=qs['filters'](_['pick'](_0x1da95c['query'],_0x406afd[_0x0036('0x48')]),_0x2082a3);var _0x3605b3=[];var _0xbf8c17=squel['select']()[_0x0036('0x51')]('id')[_0x0036('0x51')](_0x0036('0x2a'))[_0x0036('0x51')](_0x0036('0x52'))[_0x0036('0x53')]('tools_tags');var _0xc3009b=squel[_0x0036('0x54')]()[_0x0036('0x51')](_0x0036('0x55'))[_0x0036('0x51')](_0x0036('0x56'))['field'](_0x0036('0x57'))[_0x0036('0x53')]('user_has_mail_interactions','ui')[_0x0036('0x58')](_0x0036('0x59'),'u',_0x0036('0x5a'));var _0x30d9ad=squel[_0x0036('0x54')]()[_0x0036('0x53')](_0x0036('0x5b'),'i')[_0x0036('0x58')]('cm_contacts','c',_0x0036('0x5c'))[_0x0036('0x58')](_0x0036('0x59'),'o',_0x0036('0x5d'))['left_join'](_0x0036('0x5e'),'a',_0x0036('0x5f'))[_0x0036('0x58')]('mail_messages','me',_0x0036('0x60'))[_0x0036('0x58')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')[_0x0036('0x58')](_0x0036('0x61'),'t',_0x0036('0x62'));var _0x145f03=squel['expr']();var _0x5e344f=[];var _0x23744f=squel[_0x0036('0x63')]();var _0x52a209;if(_0x1da95c[_0x0036('0x47')][_0x0036('0x64')]){_0x52a209=as[_0x0036('0x65')](_0x1da95c[_0x0036('0x47')][_0x0036('0x64')]);var _0x7d2576=_0x52a209['sqlOperator'];for(var _0x5ef39a=0x0;_0x5ef39a<_0x52a209[_0x0036('0x66')][_0x0036('0x4c')];_0x5ef39a++){var _0xbd2d34=_0x52a209['conditions'][_0x5ef39a];var _0x2cfc89='i';var _0x381b1a=_['find'](_0x2082a3,[_0x0036('0x2a'),_0xbd2d34['field']]);if(!_0x381b1a){switch(_0xbd2d34['field']){case _0x0036('0x67'):if(_0xbd2d34[_0x0036('0x68')]==0x1){_0x30d9ad[_0x0036('0x69')]('`'+_0xbd2d34['field']+_0x0036('0x6a'));}else{_0x30d9ad['having']('`'+_0xbd2d34[_0x0036('0x51')]+'`\x20>\x200');}break;case _0x0036('0x6b'):if(_0xbd2d34[_0x0036('0x6c')]==='$substring'){if(_0xbd2d34['value'][_0x0036('0x6d')]('\x20')[_0x0036('0x4c')]>0x1){_0x145f03[_0x7d2576](_0x0036('0x6e'),qs[_0x0036('0x6f')](_0xbd2d34[_0x0036('0x68')]),null);}else{var _0x32d2f0='%'+_0xbd2d34['value']+'%';_0x145f03[_0x7d2576]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x32d2f0,_0x32d2f0,_0x32d2f0);}}else{_0x381b1a=_[_0x0036('0x70')](_0x2082a3,[_0x0036('0x2a'),_0x0036('0x71')]);_0xbd2d34[_0x0036('0x51')]=_0x0036('0x71');_0x176ae2=as[_0x0036('0x72')](_0x2cfc89,_0x381b1a['type'],_0xbd2d34);_0x145f03[_0x7d2576](_0x176ae2['text'],_0x176ae2[_0x0036('0x68')][_0x0036('0x73')],_0x176ae2[_0x0036('0x68')][_0x0036('0x27')]);}break;case _0x0036('0x74'):var _0xa29e41=_0xbd2d34[_0x0036('0x68')][_0x0036('0x6d')](',')[_0x0036('0x35')](function(_0x42132a){return Number(_0x42132a);});_0xa29e41[_0x0036('0x39')](function(_0x61d588){_0x23744f['or'](_0x0036('0x75'),'%,'+_0x61d588+',%');});_0x5e344f=_[_0x0036('0x76')](_0x5e344f,_0xa29e41);break;case _0x0036('0x77'):if(_0xbd2d34[_0x0036('0x6c')]===_0x0036('0x78')){_0x145f03[_0x7d2576](_0x0036('0x79'),'%'+_0xbd2d34[_0x0036('0x68')]+'%',null);}else{_0x381b1a=_[_0x0036('0x70')](_0x2082a3,[_0x0036('0x2a'),'UserId']);_0xbd2d34[_0x0036('0x51')]='UserId';_0x176ae2=as[_0x0036('0x72')](_0x2cfc89,_0x381b1a[_0x0036('0x43')],_0xbd2d34);_0x145f03[_0x7d2576](_0x176ae2[_0x0036('0x7a')],_0x176ae2[_0x0036('0x68')][_0x0036('0x73')],_0x176ae2[_0x0036('0x68')][_0x0036('0x27')]);}break;case _0x0036('0x3d'):_0x176ae2=as[_0x0036('0x72')]('me',null,_0xbd2d34);_0x145f03[_0x7d2576](_0x176ae2[_0x0036('0x7a')],_0x176ae2[_0x0036('0x68')]['start'],_0x176ae2[_0x0036('0x68')][_0x0036('0x27')]);break;}}else{var _0x176ae2=as[_0x0036('0x72')](_0x2cfc89,_0x381b1a['type'],_0xbd2d34);_0x145f03[_0x7d2576](_0x176ae2[_0x0036('0x7a')],_0x176ae2[_0x0036('0x68')]['start'],_0x176ae2[_0x0036('0x68')]['end']);}}}else{var _0x32c7d2=_(_0x1da95c[_0x0036('0x47')])[_0x0036('0x46')]()[_0x0036('0x35')](function(_0x217509){return _[_0x0036('0x7b')](_0x2082a3,['name',_0x217509])?_0x217509:undefined;})[_0x0036('0x7c')]()[_0x0036('0x68')]();if(!_[_0x0036('0x7d')](_0x32c7d2)){_0x32c7d2['forEach'](function(_0x4aa92f){if(_0x4aa92f===_0x0036('0x7e')){_0x30d9ad['where']('i.MailAccountId\x20IN\x20?',[]['concat'](_0x1da95c[_0x0036('0x47')][_0x4aa92f]));}else if(_0x4aa92f===_0x0036('0x7f')){var _0x52082a=JSON[_0x0036('0x80')](_0x1da95c[_0x0036('0x47')][_0x4aa92f])['$gte'];var _0x29cc1e=JSON[_0x0036('0x80')](_0x1da95c[_0x0036('0x47')][_0x4aa92f])[_0x0036('0x81')];_0x30d9ad[_0x0036('0x82')](_0x0036('0x83'),_0x52082a,_0x29cc1e);}else{if(_0x1da95c[_0x0036('0x47')][_0x4aa92f]===_0x0036('0x84')){_0x30d9ad[_0x0036('0x82')]('i.'+_0x4aa92f+'\x20IS\x20NULL');}else{_0x30d9ad['where']('i.'+_0x4aa92f+_0x0036('0x85'),_0x1da95c[_0x0036('0x47')][_0x4aa92f]);}}});}if(_0x1da95c[_0x0036('0x47')][_0x0036('0x86')]){if(_0x1da95c[_0x0036('0x47')]['read']==0x1){_0x30d9ad[_0x0036('0x69')]('`unreadMessages`\x20=\x200');}else{_0x30d9ad[_0x0036('0x69')](_0x0036('0x87'));}}if(_0x1da95c['query'][_0x0036('0x88')]){_0x5e344f=_[_0x0036('0x89')](_0x1da95c[_0x0036('0x47')][_0x0036('0x88')])?_0x1da95c[_0x0036('0x47')][_0x0036('0x88')]:new Array(_0x1da95c['query'][_0x0036('0x88')]);_0x5e344f[_0x0036('0x39')](function(_0x1295b8){_0x23744f['or'](_0x0036('0x75'),'%,'+_0x1295b8+',%');});}if(_0x1da95c[_0x0036('0x47')][_0x0036('0x8a')]){var _0x5dd363=_0x1da95c[_0x0036('0x47')][_0x0036('0x8a')][_0x0036('0x8b')]('\x5c','\x5c\x5c')[_0x0036('0x8b')](/'/g,'\x27\x27');if(qs[_0x0036('0x8c')](_0x5dd363)){_0x145f03['or']('i.id\x20LIKE\x20?',_0x5dd363+'%');}else if(qs[_0x0036('0x8d')](_0x5dd363)){_0x145f03['or'](_0x0036('0x8e'),_0x5dd363+'%');}else{_0x145f03['or'](_0x0036('0x8f'),qs[_0x0036('0x6f')](_0x5dd363))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0036('0x6f')](_0x5dd363));}}}_0x30d9ad[_0x0036('0x82')](_0x145f03);_0x30d9ad[_0x0036('0x90')](_0x0036('0x91'));var _0x3efc56={'type':db[_0x0036('0x92')][_0x0036('0x93')][_0x0036('0x94')],'raw':!![]};var _0x3ec91c=_0x30d9ad[_0x0036('0x95')]();_0x3ec91c[_0x0036('0x51')]('i.id');_0x3ec91c[_0x0036('0x51')](_0x0036('0x96'),_0x0036('0x67'));if(_0x550d11[_0x0036('0x4f')]){_0x550d11[_0x0036('0x4f')]['forEach'](function(_0x58b2f6){var _0x432396=_0x58b2f6[0x0]==='contactName'?_0x58b2f6[0x0]:'i.'+_0x58b2f6[0x0];_0x30d9ad[_0x0036('0x4f')](_0x432396,_0x58b2f6[0x1]===_0x0036('0x97')?![]:!![]);});}if(!_['isEmpty'](_0x5e344f)){_0x30d9ad[_0x0036('0x69')](_0x23744f);_0x3ec91c[_0x0036('0x82')](_0x0036('0x98'),_0x5e344f);}BPromise[_0x0036('0x99')]()['then'](function(){if(!_0x52a209){if(_0x1da95c[_0x0036('0x47')][_0x0036('0x7e')])return;_0x3ec91c[_0x0036('0x82')](_0x0036('0x9a'));_0x30d9ad[_0x0036('0x82')](_0x0036('0x9a'));return;}if(_0x1da95c[_0x0036('0x9b')]['role']!=='agent')return;return _0x1da95c['user'][_0x0036('0x9c')]({'attributes':['id'],'raw':!![]})[_0x0036('0x25')](function(_0x1f832e){if(_[_0x0036('0x7d')](_0x1f832e)){_0x3ec91c['where'](_0x0036('0x9d'));_0x30d9ad['where'](_0x0036('0x9d'));}else{_0x3ec91c[_0x0036('0x82')](_0x0036('0x9e'),_[_0x0036('0x35')](_0x1f832e,'id'));_0x30d9ad[_0x0036('0x82')](_0x0036('0x9e'),_['map'](_0x1f832e,'id'));}});})[_0x0036('0x25')](function(){if(_0x1da95c[_0x0036('0x9b')]['role']===_0x0036('0x31')&&!_0x52a209&&!_0x1da95c['query'][_0x0036('0x7e')])return[];return db[_0x0036('0x9f')][_0x0036('0x47')](_0x3ec91c[_0x0036('0xa0')](),_0x3efc56);})[_0x0036('0x25')](function(_0xe773b8){_0x519ff3[_0x0036('0x1f')]=_0xe773b8[_0x0036('0x4c')];if(_0x519ff3[_0x0036('0x1f')]===0x0)return[];return db['sequelize']['query'](_0xbf8c17[_0x0036('0xa0')](),_0x3efc56)[_0x0036('0x25')](function(_0x44dac3){_0x3605b3=_[_0x0036('0xa1')](_0x44dac3,'id');_0x3efc56=_[_0x0036('0x2d')](_0x3efc56,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1da95c[_0x0036('0x47')][_0x0036('0x4b')]){_0x550d11['attributes'][_0x0036('0x39')](function(_0x1de7e3){_0x30d9ad['field']('i.'+_0x1de7e3);});}else{_0x30d9ad[_0x0036('0x51')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0036('0x67'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xa2'),_0x0036('0xa3'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xa4'),_0x0036('0xa5'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xa6'),_0x0036('0xa7'));_0x30d9ad[_0x0036('0x51')](_0x0036('0x91'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xa8'));_0x30d9ad[_0x0036('0x51')]('i.updatedAt');_0x30d9ad[_0x0036('0x51')](_0x0036('0xa9'));_0x30d9ad[_0x0036('0x51')]('i.closedAt');_0x30d9ad[_0x0036('0x51')]('i.attach');_0x30d9ad[_0x0036('0x51')](_0x0036('0xaa'));_0x30d9ad['field'](_0x0036('0xab'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xac'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xad'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xae'));_0x30d9ad[_0x0036('0x51')]('i.thirdDisposition');_0x30d9ad[_0x0036('0x51')](_0x0036('0xaf'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xb0'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xb1'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xb2'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xb3'));_0x30d9ad['field'](_0x0036('0xb4'),_0x0036('0xb5'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xb6'),'Contact.lastName');_0x30d9ad[_0x0036('0x51')]('c.email',_0x0036('0xb7'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xb8'),_0x0036('0xb9'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xba'),'Contact.mobile');_0x30d9ad[_0x0036('0x51')]('c.fax','Contact.fax');_0x30d9ad['field'](_0x0036('0xbb'),'Owner.fullname');_0x30d9ad[_0x0036('0x51')]('o.internal',_0x0036('0xbc'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xbd'),_0x0036('0x37'));}if(_0x550d11['limit'])_0x30d9ad[_0x0036('0x1e')](_0x550d11[_0x0036('0x1e')]);if(_0x550d11[_0x0036('0x1c')])_0x30d9ad[_0x0036('0x1c')](_0x550d11[_0x0036('0x1c')]);return db[_0x0036('0x9f')]['query'](_0x30d9ad['toString'](),_0x3efc56);})[_0x0036('0x25')](function(_0x3524d8){if(_0x3524d8[_0x0036('0x4c')]>0x0)_0xc3009b[_0x0036('0x82')](_0x0036('0xbe'),_['map'](_0x3524d8,'id'));return db['sequelize'][_0x0036('0x47')](_0xc3009b[_0x0036('0xa0')](),_0x3efc56)[_0x0036('0x25')](function(_0x4b31d2){var _0x2e9776=_[_0x0036('0xbf')](_0x4b31d2,_0x0036('0xc0'));var _0x3f116d=[];return db[_0x0036('0xc1')]['findOne']({'attributes':[_0x0036('0xc2')],'raw':!![]})[_0x0036('0x25')](function(_0xe56710){var _0xc414fd=_0xe56710[_0x0036('0xc2')];_0x3524d8[_0x0036('0x39')](function(_0x14ed82){_0x3f116d['push'](updateMailInteraction(_0x14ed82,_0x3605b3,_0x2e9776,_0xc414fd));});return BPromise[_0x0036('0xc3')](_0x3f116d);});});});})['then'](function(_0x1b2015){_0x519ff3[_0x0036('0xc4')]=_0x1b2015;return _0x519ff3;})['then'](respondWithFilteredResult(_0x9cdeb2,_0x550d11))['catch'](handleError(_0x9cdeb2,null));};exports[_0x0036('0xc5')]=function(_0x1c90f2,_0x580fe7){var _0x5451bc={'raw':![],'where':{'id':_0x1c90f2['params']['id']}},_0x344e7e={};_0x344e7e[_0x0036('0x45')]=_['keys'](db[_0x0036('0x40')]['rawAttributes']);_0x344e7e['query']=_[_0x0036('0x46')](_0x1c90f2[_0x0036('0x47')]);_0x344e7e[_0x0036('0x48')]=_[_0x0036('0x49')](_0x344e7e[_0x0036('0x45')],_0x344e7e['query']);_0x5451bc[_0x0036('0x4a')]=_['intersection'](_0x344e7e[_0x0036('0x45')],qs[_0x0036('0x4b')](_0x1c90f2[_0x0036('0x47')][_0x0036('0x4b')]));_0x5451bc['attributes']=_0x5451bc['attributes'][_0x0036('0x4c')]?_0x5451bc[_0x0036('0x4a')]:_0x344e7e[_0x0036('0x45')];if(_0x1c90f2[_0x0036('0x47')][_0x0036('0xc6')]){_0x5451bc[_0x0036('0xc7')]=[{'all':!![]}];}_0x5451bc=_['merge']({},_0x5451bc,_0x1c90f2[_0x0036('0xc8')]);return db[_0x0036('0x40')][_0x0036('0x70')](_0x5451bc)[_0x0036('0x25')](handleEntityNotFound(_0x580fe7,null))[_0x0036('0x25')](respondWithResult(_0x580fe7,null))[_0x0036('0xc9')](handleError(_0x580fe7,null));};exports[_0x0036('0xca')]=function(_0x1b4b24,_0x1430df){return db['MailInteraction'][_0x0036('0xca')](_0x1b4b24[_0x0036('0x2e')],{})[_0x0036('0x25')](respondWithResult(_0x1430df,0xc9))['catch'](handleError(_0x1430df,null));};exports[_0x0036('0x24')]=function(_0x397c3f,_0x5a58fd){if(_0x397c3f[_0x0036('0x2e')]['id']){delete _0x397c3f[_0x0036('0x2e')]['id'];}return db[_0x0036('0x40')]['find']({'where':{'id':_0x397c3f[_0x0036('0xcb')]['id']}})[_0x0036('0x25')](handleEntityNotFound(_0x5a58fd,null))[_0x0036('0x25')](saveUpdates(_0x397c3f['body'],null))[_0x0036('0x25')](respondWithResult(_0x5a58fd,null))[_0x0036('0xc9')](handleError(_0x5a58fd,null));};exports[_0x0036('0x26')]=function(_0x5f07bb,_0x441ccc){return db[_0x0036('0x40')][_0x0036('0x70')]({'where':{'id':_0x5f07bb[_0x0036('0xcb')]['id']}})[_0x0036('0x25')](handleEntityNotFound(_0x441ccc,null))[_0x0036('0x25')](removeEntity(_0x441ccc,null))[_0x0036('0xc9')](handleError(_0x441ccc,null));};exports[_0x0036('0xcc')]=function(_0x13c628,_0x1cf9fc){return db[_0x0036('0x40')][_0x0036('0xcc')]()[_0x0036('0x25')](respondWithResult(_0x1cf9fc,null))[_0x0036('0xc9')](handleError(_0x1cf9fc,null));};exports[_0x0036('0xcd')]=function(_0x3ce8a3,_0x1ecf54,_0x47adda){return db[_0x0036('0x3a')]['find']({'where':{'id':_0x3ce8a3[_0x0036('0xcb')]['id']}})[_0x0036('0x25')](handleEntityNotFound(_0x1ecf54,null))[_0x0036('0x25')](function(_0x3344f5){if(_0x3344f5){return _0x3344f5['addMessage'](_0x3ce8a3[_0x0036('0x2e')][_0x0036('0xce')],_[_0x0036('0xcf')](_0x3ce8a3[_0x0036('0x2e')],[_0x0036('0xce'),'id'])||{});}})['then'](respondWithResult(_0x1ecf54,null))['catch'](handleError(_0x1ecf54,null));};exports['getMessages']=function(_0x5f1e2d,_0xc9cb48,_0x40ad95){var _0x5b2527={'raw':![],'where':{}};var _0x338f46={};var _0x47179f={'count':0x0,'rows':[]};return db[_0x0036('0x40')]['findOne']({'where':{'id':_0x5f1e2d[_0x0036('0xcb')]['id']}})[_0x0036('0x25')](handleEntityNotFound(_0xc9cb48,null))[_0x0036('0x25')](function(_0x2ab355){if(_0x2ab355){_0x338f46[_0x0036('0x45')]=_[_0x0036('0x46')](db[_0x0036('0x3a')][_0x0036('0x41')]);_0x338f46[_0x0036('0x47')]=_['keys'](_0x5f1e2d[_0x0036('0x47')]);_0x338f46[_0x0036('0x48')]=_[_0x0036('0x49')](_0x338f46[_0x0036('0x45')],_0x338f46[_0x0036('0x47')]);_0x5b2527['attributes']=_['intersection'](_0x338f46['model'],qs[_0x0036('0x4b')](_0x5f1e2d[_0x0036('0x47')][_0x0036('0x4b')]));_0x5b2527[_0x0036('0x4a')]=_0x5b2527['attributes'][_0x0036('0x4c')]?_0x5b2527[_0x0036('0x4a')]:_0x338f46['model'];if(!_0x5f1e2d[_0x0036('0x47')][_0x0036('0x4d')]('nolimit')){_0x5b2527[_0x0036('0x1e')]=qs[_0x0036('0x1e')](_0x5f1e2d['query'][_0x0036('0x1e')]);_0x5b2527[_0x0036('0x1c')]=qs['offset'](_0x5f1e2d[_0x0036('0x47')][_0x0036('0x1c')]);}_0x5b2527[_0x0036('0x4f')]=qs[_0x0036('0x50')](_0x5f1e2d[_0x0036('0x47')][_0x0036('0x50')]);_0x5b2527[_0x0036('0x82')]=qs[_0x0036('0x48')](_[_0x0036('0xd0')](_0x5f1e2d[_0x0036('0x47')],_0x338f46[_0x0036('0x48')]));_0x5b2527[_0x0036('0x82')][_0x0036('0xc0')]=_0x2ab355['id'];if(_0x5f1e2d[_0x0036('0x47')]['filter']){_0x5b2527[_0x0036('0x82')]=_[_0x0036('0x2d')](_0x5b2527[_0x0036('0x82')],{'$or':_['map'](_0x5b2527[_0x0036('0x4a')],function(_0x108153){var _0x5f2dec={};_0x5f2dec[_0x108153]={'$like':'%'+_0x5f1e2d[_0x0036('0x47')]['filter']+'%'};return _0x5f2dec;})});}if(_0x5f1e2d['query'][_0x0036('0xd1')]){var _0x59a49e=_0x5f1e2d[_0x0036('0x47')][_0x0036('0xd1')][_0x0036('0x6d')](',');var _0x450159={};_0x450159[_0x59a49e[0x0]]={'$gte':moment(_0x59a49e[0x1])[_0x0036('0xd2')](_0x0036('0xd3'))};_0x5b2527[_0x0036('0x82')]=_['merge'](_0x5b2527['where'],_0x450159);}_0x5b2527=_[_0x0036('0x2d')]({},_0x5b2527,_0x5f1e2d[_0x0036('0xc8')]);return db[_0x0036('0x3a')][_0x0036('0x1f')]({'where':_0x5b2527[_0x0036('0x82')]})['then'](function(_0x434d1b){_0x47179f[_0x0036('0x1f')]=_0x434d1b;if(_0x5f1e2d[_0x0036('0x47')][_0x0036('0xc6')]){_0x5b2527['include']=[{'all':!![]}];}return db[_0x0036('0x3a')][_0x0036('0xd4')](_0x5b2527);})['then'](function(_0x46e1d5){if(_0x5f1e2d[_0x0036('0x47')][_0x0036('0xd5')]===_0x0036('0xd6')){for(var _0x2e2c11=0x0;_0x2e2c11<_0x46e1d5[_0x0036('0x4c')];_0x2e2c11++){_0x46e1d5[_0x2e2c11]['body']=juice(_0x46e1d5[_0x2e2c11]['body']);}}_0x47179f[_0x0036('0xc4')]=_0x46e1d5;return _0x47179f;});}})[_0x0036('0x25')](respondWithFilteredResult(_0xc9cb48,_0x5b2527))[_0x0036('0xc9')](handleError(_0xc9cb48,null));};exports[_0x0036('0xd7')]=function(_0x59e51c,_0x42e91c,_0x24a41d){return db[_0x0036('0x40')][_0x0036('0x70')]({'where':{'id':_0x59e51c[_0x0036('0xcb')]['id']}})[_0x0036('0x25')](handleEntityNotFound(_0x42e91c,null))[_0x0036('0x25')](function(_0x679bb){if(_0x679bb){return _0x679bb['setTags'](_0x59e51c['body'][_0x0036('0xce')],_[_0x0036('0xcf')](_0x59e51c['body'],[_0x0036('0xce'),'id'])||{})[_0x0036('0xd8')](function(){return db[_0x0036('0x74')]['findAll']({'attributes':['id',_0x0036('0x2a'),'color'],'where':{'id':_0x59e51c[_0x0036('0x2e')][_0x0036('0xce')]}});})[_0x0036('0x25')](function(_0x1f933d){socket[_0x0036('0xd9')](_0x0036('0xda'),{'id':Number(_0x59e51c[_0x0036('0xcb')]['id']),'tags':_0x1f933d||[]});return{'id':Number(_0x59e51c[_0x0036('0xcb')]['id']),'tags':_0x1f933d||[]};});}})[_0x0036('0x25')](respondWithResult(_0x42e91c,null))['catch'](handleError(_0x42e91c,null));};exports['removeTags']=function(_0x47fd14,_0x4c31a0,_0xc885ee){return db[_0x0036('0x40')][_0x0036('0x70')]({'where':{'id':_0x47fd14[_0x0036('0xcb')]['id']}})[_0x0036('0x25')](handleEntityNotFound(_0x4c31a0,null))['then'](function(_0x4d9f73){if(_0x4d9f73){return _0x4d9f73['removeTags'](_0x47fd14[_0x0036('0x47')][_0x0036('0xce')]);}})[_0x0036('0x25')](respondWithStatusCode(_0x4c31a0,null))[_0x0036('0xc9')](handleError(_0x4c31a0,null));};exports['download']=function(_0x269613,_0x300446){var _0xa88dc9=moment()[_0x0036('0xdb')]()[_0x0036('0xa0')]();var _0x2c1104=path[_0x0036('0xdc')](config['root'],'server',_0x0036('0xdd'),'tmp');var _0x372ea9=path[_0x0036('0xdc')](config[_0x0036('0xde')],_0x0036('0xdf'),_0x0036('0xdd'),_0x0036('0xe0'));var _0x2b9764=path[_0x0036('0xdc')](_0x2c1104,_0xa88dc9);var _0x7257d5=util[_0x0036('0xd2')](_0x0036('0xe1'),_0x269613[_0x0036('0xcb')]['id'],_0xa88dc9);var _0xbf296d=path[_0x0036('0xdc')](_0x2c1104,_0x7257d5);var _0x40161e=[];if(_0x269613['query']['attachments']){_0x40161e[_0x0036('0xe2')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x1ffbd2=[{'model':db[_0x0036('0x3a')],'as':_0x0036('0xe3'),'attributes':['id','body',_0x0036('0x53'),'to','cc','bcc',_0x0036('0xe4'),'createdAt'],'where':{'secret':![]},'order':qs[_0x0036('0x50')]('id'),'include':_0x40161e}];return db[_0x0036('0x40')][_0x0036('0x70')]({'where':{'id':_0x269613[_0x0036('0xcb')]['id']},'include':_0x1ffbd2})['then'](handleEntityNotFound(_0x300446,null))[_0x0036('0x25')](function(_0xa4b36c){if(_0xa4b36c&&_0xa4b36c[_0x0036('0xe3')]){var _0x55777b=_0xa4b36c[_0x0036('0xe5')]({'plain':!![]});fs[_0x0036('0xe6')](_0x2b9764);return BPromise[_0x0036('0xe7')](_0x55777b[_0x0036('0xe3')],function(_0xffaf8d,_0x15b0ea){var _0x1a0d28={'from':_0xffaf8d['from'],'to':_0xffaf8d['to'],'subject':_0xffaf8d[_0x0036('0xe4')],'html':_0xffaf8d[_0x0036('0x2e')],'headers':{'Date':moment(_0xffaf8d['createdAt'])[_0x0036('0xd2')](_0x0036('0xe8'))},'attachments':[]};if(_0xffaf8d['cc']){_0x1a0d28['headers']['Cc']=_0xffaf8d['cc'];}if(_0xffaf8d['bcc']){_0x1a0d28[_0x0036('0xe9')]['Bcc']=_0xffaf8d[_0x0036('0xea')];}return new BPromise(function(_0x57643a,_0x1f0ea6){if(_0xffaf8d[_0x0036('0xeb')]){for(var _0x1ac0bb=0x0;_0x1ac0bb<_0xffaf8d[_0x0036('0xeb')][_0x0036('0x4c')];_0x1ac0bb++){var _0x3ff740=_0xffaf8d['Attachments'][_0x1ac0bb];var _0x437f02=path[_0x0036('0xdc')](_0x372ea9,_0x3ff740[_0x0036('0xec')]);if(fs[_0x0036('0xed')](_0x437f02)){_0x1a0d28[_0x0036('0xe0')]['push']({'name':_0x3ff740[_0x0036('0x2a')],'contentType':_0x3ff740[_0x0036('0x43')],'data':fs[_0x0036('0xee')](_0x437f02)});}}}emlformat[_0x0036('0xef')](_0x1a0d28,function(_0x479527,_0x391f47){if(_0x479527)return _0x1f0ea6(_0x479527);fs[_0x0036('0xf0')](path[_0x0036('0xdc')](_0x2b9764,util[_0x0036('0xd2')]('message%d.eml',_0x15b0ea)),_0x391f47);return _0x57643a(_0x391f47);});});})['then'](function(){return new BPromise(function(_0x5bcb43,_0x337db6){zipdir(_0x2b9764,{'saveTo':_0xbf296d},function(_0x2bdf31,_0x3b3a44){if(_0x2bdf31)return _0x337db6(_0x2bdf31);return _0x5bcb43(_0x3b3a44);});})[_0x0036('0x25')](function(){return new BPromise(function(_0x253267,_0x44b119){rimraf(_0x2b9764,function(_0x5b01ad){if(_0x5b01ad)_0x44b119(_0x5b01ad);return _0x253267();});});})[_0x0036('0x25')](function(){return _0x300446['download'](_0xbf296d,_0x7257d5,function(_0xa84a18){if(_0xa84a18){console['log'](_0x0036('0xf1'),_0xa84a18);}else{fs[_0x0036('0xf2')](_0xbf296d);}});});});}else{return _0x300446['sendStatus'](0xc8);}})[_0x0036('0xc9')](handleError(_0x300446,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index fec7919..b7e9d79 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 _0x4f7c=['MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction'];(function(_0x45e2e1,_0x434dc3){var _0x2bd503=function(_0x5c7f93){while(--_0x5c7f93){_0x45e2e1['push'](_0x45e2e1['shift']());}};_0x2bd503(++_0x434dc3);}(_0x4f7c,0x151));var _0xc4f7=function(_0x3c4e3e,_0x123f0b){_0x3c4e3e=_0x3c4e3e-0x0;var _0x1254ac=_0x4f7c[_0x3c4e3e];return _0x1254ac;};'use strict';var EventEmitter=require(_0xc4f7('0x0'));var MailInteraction=require(_0xc4f7('0x1'))['db'][_0xc4f7('0x2')];var MailMessage=require('../../mysqldb')['db'][_0xc4f7('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xc4f7('0x4')](0x0);var events={'afterCreate':_0xc4f7('0x5'),'afterUpdate':_0xc4f7('0x6'),'afterDestroy':_0xc4f7('0x7')};function emitEvent(_0x200436){return function(_0x4aa382,_0x224976,_0x311d94){_0x4aa382[_0xc4f7('0x8')]({'attributes':['id'],'raw':!![]})[_0xc4f7('0x9')](function(_0xe9b306){_0x4aa382[_0xc4f7('0xa')](_0xc4f7('0xb'),_0xe9b306['map'](function(_0x594b0d){return{'id':_0x594b0d['id']};}));return MailMessage[_0xc4f7('0xc')]({'where':{'MailInteractionId':_0x4aa382['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc4f7('0x9')](function(_0x57932e){_0x4aa382[_0xc4f7('0xa')](_0xc4f7('0xd'),_0x57932e[_0xc4f7('0xe')]);MailInteractionEvents['emit'](_0x200436+':'+_0x4aa382['id'],_0x4aa382);MailInteractionEvents[_0xc4f7('0xf')](_0x200436,_0x4aa382);_0x311d94(null);})[_0xc4f7('0x10')](_0x311d94(null));};}for(var e in events){if(events[_0xc4f7('0x11')](e)){var event=events[e];MailInteraction[_0xc4f7('0x12')](e,emitEvent(event));}}module[_0xc4f7('0x13')]=MailInteractionEvents; \ No newline at end of file +var _0x9c42=['emit','hasOwnProperty','events','MailInteraction','../../mysqldb','MailMessage','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','length'];(function(_0x93b83c,_0xee637e){var _0x5d4831=function(_0x2a7f53){while(--_0x2a7f53){_0x93b83c['push'](_0x93b83c['shift']());}};_0x5d4831(++_0xee637e);}(_0x9c42,0xb2));var _0x29c4=function(_0x3e690a,_0x31aa0f){_0x3e690a=_0x3e690a-0x0;var _0x435ca0=_0x9c42[_0x3e690a];return _0x435ca0;};'use strict';var EventEmitter=require(_0x29c4('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x29c4('0x1')];var MailMessage=require(_0x29c4('0x2'))['db'][_0x29c4('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x29c4('0x4'),'afterUpdate':_0x29c4('0x5'),'afterDestroy':_0x29c4('0x6')};function emitEvent(_0x448320){return function(_0x300e6b,_0x6a57fd,_0x5bfedb){_0x300e6b[_0x29c4('0x7')]({'attributes':['id'],'raw':!![]})[_0x29c4('0x8')](function(_0x12f44e){_0x300e6b[_0x29c4('0x9')](_0x29c4('0xa'),_0x12f44e[_0x29c4('0xb')](function(_0xa2aaf){return{'id':_0xa2aaf['id']};}));return MailMessage[_0x29c4('0xc')]({'where':{'MailInteractionId':_0x300e6b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x29c4('0x8')](function(_0x459606){_0x300e6b[_0x29c4('0x9')]('unreadMessages',_0x459606[_0x29c4('0xd')]);MailInteractionEvents[_0x29c4('0xe')](_0x448320+':'+_0x300e6b['id'],_0x300e6b);MailInteractionEvents[_0x29c4('0xe')](_0x448320,_0x300e6b);_0x5bfedb(null);})['catch'](_0x5bfedb(null));};}for(var e in events){if(events[_0x29c4('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 2c1c310..c88054b 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 _0x7a84=['rimraf','../../config/environment','./mailInteraction.attributes','mail_interactions','fti_mail_interactions','subject','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','models','get','MailMessage','catch','utf8mb4','lodash','util','../../config/logger','api','path'];(function(_0x28ffd8,_0x477923){var _0x2a4d3e=function(_0x4eec07){while(--_0x4eec07){_0x28ffd8['push'](_0x28ffd8['shift']());}};_0x2a4d3e(++_0x477923);}(_0x7a84,0x182));var _0x47a8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a84[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x47a8('0x0'));var util=require(_0x47a8('0x1'));var logger=require(_0x47a8('0x2'))(_0x47a8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a8('0x4'));var rimraf=require(_0x47a8('0x5'));var config=require(_0x47a8('0x6'));var attributes=require(_0x47a8('0x7'));module['exports']=function(_0x431bc9,_0x259aca){return _0x431bc9['define']('MailInteraction',attributes,{'tableName':_0x47a8('0x8'),'paranoid':![],'indexes':[{'name':_0x47a8('0x9'),'fields':[_0x47a8('0xa'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2ddec5,_0x5c76d2,_0x346615){if(_0x2ddec5[_0x47a8('0xb')]){_0x2ddec5['substatusAt']=moment()[_0x47a8('0xc')](_0x47a8('0xd'));}if(_0x2ddec5[_0x47a8('0xe')]){_0x2ddec5[_0x47a8('0xf')]=moment()[_0x47a8('0xc')](_0x47a8('0xd'));}_0x346615(null,_0x5c76d2);},'beforeUpdate':function(_0x3bdda2,_0xc3b51,_0x4dcccb){if(_0x3bdda2[_0x47a8('0x10')](_0x47a8('0xb'))){_0x3bdda2[_0x47a8('0x11')]=_0x3bdda2[_0x47a8('0xb')]?moment()[_0x47a8('0xc')](_0x47a8('0xd')):null;}if(_0x3bdda2[_0x47a8('0x10')](_0x47a8('0xe'))){_0x3bdda2[_0x47a8('0xf')]=moment()[_0x47a8('0xc')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bdda2[_0x47a8('0xb')]=null;_0x3bdda2[_0x47a8('0x11')]=null;}_0x4dcccb(null,_0x3bdda2);},'afterUpdate':function(_0x1e80c3,_0x2253cb,_0x141838){var _0x45967e=_0x431bc9[_0x47a8('0x12')];var _0x15b97f=_0x1e80c3[_0x47a8('0x13')]({'plain':!![]});if(_0x15b97f[_0x47a8('0xe')]){return _0x45967e[_0x47a8('0x14')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x15b97f['id']}})['then'](function(){_0x141838();})[_0x47a8('0x15')](function(_0x45fb75){_0x141838(_0x45fb75);});}else{_0x141838();}}},'charset':_0x47a8('0x16'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x94ca=['./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','models','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x94ca,0xde));var _0xa94c=function(_0x25cf2a,_0x196f17){_0x25cf2a=_0x25cf2a-0x0;var _0x37fdf5=_0x94ca[_0x25cf2a];return _0x37fdf5;};'use strict';var _=require(_0xa94c('0x0'));var util=require(_0xa94c('0x1'));var logger=require(_0xa94c('0x2'))(_0xa94c('0x3'));var moment=require(_0xa94c('0x4'));var BPromise=require(_0xa94c('0x5'));var rp=require(_0xa94c('0x6'));var fs=require('fs');var path=require(_0xa94c('0x7'));var rimraf=require(_0xa94c('0x8'));var config=require(_0xa94c('0x9'));var attributes=require(_0xa94c('0xa'));module[_0xa94c('0xb')]=function(_0x60c649,_0x4fb3d0){return _0x60c649[_0xa94c('0xc')](_0xa94c('0xd'),attributes,{'tableName':_0xa94c('0xe'),'paranoid':![],'indexes':[{'name':_0xa94c('0xf'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x536701,_0x5dcf28,_0x85b984){if(_0x536701[_0xa94c('0x10')]){_0x536701['substatusAt']=moment()[_0xa94c('0x11')](_0xa94c('0x12'));}if(_0x536701[_0xa94c('0x13')]){_0x536701[_0xa94c('0x14')]=moment()[_0xa94c('0x11')](_0xa94c('0x12'));}_0x85b984(null,_0x5dcf28);},'beforeUpdate':function(_0x553ae5,_0x4bb43f,_0x492c96){if(_0x553ae5[_0xa94c('0x15')](_0xa94c('0x10'))){_0x553ae5[_0xa94c('0x16')]=_0x553ae5[_0xa94c('0x10')]?moment()[_0xa94c('0x11')](_0xa94c('0x12')):null;}if(_0x553ae5[_0xa94c('0x15')](_0xa94c('0x13'))){_0x553ae5[_0xa94c('0x14')]=moment()['format'](_0xa94c('0x12'));_0x553ae5[_0xa94c('0x10')]=null;_0x553ae5[_0xa94c('0x16')]=null;}_0x492c96(null,_0x553ae5);},'afterUpdate':function(_0x20d81d,_0x5bbf1a,_0x1ba732){var _0x2ff7aa=_0x60c649[_0xa94c('0x17')];var _0x1284e8=_0x20d81d['get']({'plain':!![]});if(_0x1284e8['closed']){return _0x2ff7aa[_0xa94c('0x18')][_0xa94c('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x1284e8['id']}})['then'](function(){_0x1ba732();})[_0xa94c('0x1a')](function(_0x84e72a){_0x1ba732(_0x84e72a);});}else{_0x1ba732();}}},'charset':_0xa94c('0x1b'),'collate':_0xa94c('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 0a416c7..7306fd9 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 _0x6427=['update','options','raw','where','attributes','limit','UpdateMailInteraction','catch','addTags','body','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailInteraction'];(function(_0x410c9f,_0x1c464a){var _0xfc4322=function(_0x42e52c){while(--_0x42e52c){_0x410c9f['push'](_0x410c9f['shift']());}};_0xfc4322(++_0x1c464a);}(_0x6427,0xbe));var _0x7642=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x6427[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require(_0x7642('0x0'));var moment=require(_0x7642('0x1'));var BPromise=require(_0x7642('0x2'));var rs=require(_0x7642('0x3'));var fs=require('fs');var Redis=require(_0x7642('0x4'));var db=require(_0x7642('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7642('0x6'))(_0x7642('0x7'));var config=require(_0x7642('0x8'));var jayson=require(_0x7642('0x9'));var client=jayson[_0x7642('0xa')][_0x7642('0xb')]({'port':0x232a});config[_0x7642('0xc')]=_[_0x7642('0xd')](config[_0x7642('0xc')],{'host':_0x7642('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7642('0xf'))[_0x7642('0x10')](socket);function respondWithRpcPromise(_0x1ef8d3,_0x4d6fc,_0x15f559){return new BPromise(function(_0xfbf358,_0x3c7409){return client[_0x7642('0x11')](_0x1ef8d3,_0x15f559)[_0x7642('0x12')](function(_0x179ed0){logger[_0x7642('0x13')](_0x7642('0x14'),_0x4d6fc,_0x7642('0x15'));logger[_0x7642('0x16')](_0x7642('0x17'),_0x4d6fc,_0x7642('0x15'),JSON[_0x7642('0x18')](_0x179ed0));if(_0x179ed0['error']){if(_0x179ed0[_0x7642('0x19')][_0x7642('0x1a')]===0x1f4){logger['error'](_0x7642('0x14'),_0x4d6fc,_0x179ed0['error'][_0x7642('0x1b')]);return _0x3c7409(_0x179ed0['error'][_0x7642('0x1b')]);}logger[_0x7642('0x19')](_0x7642('0x14'),_0x4d6fc,_0x179ed0[_0x7642('0x19')][_0x7642('0x1b')]);return _0xfbf358(_0x179ed0[_0x7642('0x19')][_0x7642('0x1b')]);}else{logger['info'](_0x7642('0x14'),_0x4d6fc,_0x7642('0x15'));_0xfbf358(_0x179ed0[_0x7642('0x1c')][_0x7642('0x1b')]);}})['catch'](function(_0x577d34){logger[_0x7642('0x19')](_0x7642('0x14'),_0x4d6fc,_0x577d34);_0x3c7409(_0x577d34);});});}exports['UpdateMailInteraction']=function(_0x3a76e7){var _0x3f0612=this;return new Promise(function(_0x49bfb0,_0x503c13){return db[_0x7642('0x1d')][_0x7642('0x1e')](_0x3a76e7['body'],{'raw':_0x3a76e7['options']?_0x3a76e7[_0x7642('0x1f')][_0x7642('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a76e7[_0x7642('0x1f')]?_0x3a76e7['options'][_0x7642('0x21')]||null:null,'attributes':_0x3a76e7[_0x7642('0x1f')]?_0x3a76e7['options'][_0x7642('0x22')]||null:null,'limit':_0x3a76e7[_0x7642('0x1f')]?_0x3a76e7[_0x7642('0x1f')][_0x7642('0x23')]||null:null})['then'](function(_0x1987bb){logger[_0x7642('0x13')](_0x7642('0x24'),_0x3a76e7);logger[_0x7642('0x16')]('UpdateMailInteraction',_0x3a76e7,JSON[_0x7642('0x18')](_0x1987bb));_0x49bfb0(_0x1987bb);})[_0x7642('0x25')](function(_0x1993e3){logger[_0x7642('0x19')]('UpdateMailInteraction',_0x1993e3[_0x7642('0x1b')],_0x3a76e7);_0x503c13(_0x3f0612[_0x7642('0x19')](0x1f4,_0x1993e3[_0x7642('0x1b')]));});});};exports['AddTagsToMailInteraction']=function(_0x3894df){return new Promise(function(_0x58f8fb,_0x3f4764){return db[_0x7642('0x1d')]['find']({'where':_0x3894df[_0x7642('0x1f')]?_0x3894df['options'][_0x7642('0x21')]||null:null})[_0x7642('0x12')](function(_0x3189ca){if(_0x3189ca){return _0x3189ca[_0x7642('0x26')](_0x3894df[_0x7642('0x27')][_0x7642('0x28')],_[_0x7642('0x29')](_0x3894df[_0x7642('0x27')],[_0x7642('0x28'),'id'])||{});}})[_0x7642('0x2a')](function(_0xa9e30d){logger[_0x7642('0x13')]('AddTags',_0x3894df);logger['debug'](_0x7642('0x2b'),_0x3894df,JSON[_0x7642('0x18')](_0xa9e30d));_0x58f8fb(_0xa9e30d);})[_0x7642('0x25')](function(_0x5ab606){logger[_0x7642('0x19')](_0x7642('0x2b'),_0x5ab606['message'],_0x3894df);_0x3f4764(_this[_0x7642('0x19')](0x1f4,_0x5ab606['message']));});});}; \ No newline at end of file +var _0x82b0=['jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','limit','debug','stringify','AddTagsToMailInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2499b4,_0x50738d){var _0x159617=function(_0x196de3){while(--_0x196de3){_0x2499b4['push'](_0x2499b4['shift']());}};_0x159617(++_0x50738d);}(_0x82b0,0x81));var _0x082b=function(_0x1e03e4,_0x362f76){_0x1e03e4=_0x1e03e4-0x0;var _0x4a887e=_0x82b0[_0x1e03e4];return _0x4a887e;};'use strict';var _=require(_0x082b('0x0'));var util=require(_0x082b('0x1'));var moment=require(_0x082b('0x2'));var BPromise=require('bluebird');var rs=require(_0x082b('0x3'));var fs=require('fs');var Redis=require(_0x082b('0x4'));var db=require(_0x082b('0x5'))['db'];var utils=require(_0x082b('0x6'));var logger=require('../../config/logger')(_0x082b('0x7'));var config=require(_0x082b('0x8'));var jayson=require(_0x082b('0x9'));var client=jayson[_0x082b('0xa')][_0x082b('0xb')]({'port':0x232a});config['redis']=_[_0x082b('0xc')](config[_0x082b('0xd')],{'host':_0x082b('0xe'),'port':0x18eb});var socket=require(_0x082b('0xf'))(new Redis(config[_0x082b('0xd')]));require(_0x082b('0x10'))[_0x082b('0x11')](socket);function respondWithRpcPromise(_0x303c1e,_0x1483c3,_0x1066e8){return new BPromise(function(_0x18a27f,_0x181a6e){return client[_0x082b('0x12')](_0x303c1e,_0x1066e8)[_0x082b('0x13')](function(_0x4e9133){logger['info'](_0x082b('0x14'),_0x1483c3,'request\x20sent');logger['debug'](_0x082b('0x15'),_0x1483c3,_0x082b('0x16'),JSON['stringify'](_0x4e9133));if(_0x4e9133[_0x082b('0x17')]){if(_0x4e9133[_0x082b('0x17')][_0x082b('0x18')]===0x1f4){logger[_0x082b('0x17')](_0x082b('0x14'),_0x1483c3,_0x4e9133['error'][_0x082b('0x19')]);return _0x181a6e(_0x4e9133[_0x082b('0x17')]['message']);}logger[_0x082b('0x17')]('MailInteraction,\x20%s,\x20%s',_0x1483c3,_0x4e9133[_0x082b('0x17')][_0x082b('0x19')]);return _0x18a27f(_0x4e9133['error'][_0x082b('0x19')]);}else{logger[_0x082b('0x1a')](_0x082b('0x14'),_0x1483c3,_0x082b('0x16'));_0x18a27f(_0x4e9133['result'][_0x082b('0x19')]);}})[_0x082b('0x1b')](function(_0x7d188d){logger[_0x082b('0x17')](_0x082b('0x14'),_0x1483c3,_0x7d188d);_0x181a6e(_0x7d188d);});});}exports[_0x082b('0x1c')]=function(_0x101654){var _0x18074e=this;return new Promise(function(_0x5dee52,_0x9faf2){return db[_0x082b('0x1d')][_0x082b('0x1e')](_0x101654['body'],{'raw':_0x101654[_0x082b('0x1f')]?_0x101654[_0x082b('0x1f')][_0x082b('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x101654['options']?_0x101654['options'][_0x082b('0x21')]||null:null,'attributes':_0x101654['options']?_0x101654['options'][_0x082b('0x22')]||null:null,'limit':_0x101654[_0x082b('0x1f')]?_0x101654[_0x082b('0x1f')][_0x082b('0x23')]||null:null})[_0x082b('0x13')](function(_0x4ed723){logger[_0x082b('0x1a')](_0x082b('0x1c'),_0x101654);logger[_0x082b('0x24')](_0x082b('0x1c'),_0x101654,JSON[_0x082b('0x25')](_0x4ed723));_0x5dee52(_0x4ed723);})[_0x082b('0x1b')](function(_0x1b6dfc){logger['error'](_0x082b('0x1c'),_0x1b6dfc['message'],_0x101654);_0x9faf2(_0x18074e[_0x082b('0x17')](0x1f4,_0x1b6dfc['message']));});});};exports[_0x082b('0x26')]=function(_0x15c093){return new Promise(function(_0x545fd6,_0x2279d7){return db['MailInteraction'][_0x082b('0x27')]({'where':_0x15c093['options']?_0x15c093[_0x082b('0x1f')][_0x082b('0x21')]||null:null})[_0x082b('0x13')](function(_0x23b651){if(_0x23b651){return _0x23b651[_0x082b('0x28')](_0x15c093[_0x082b('0x29')][_0x082b('0x2a')],_[_0x082b('0x2b')](_0x15c093[_0x082b('0x29')],[_0x082b('0x2a'),'id'])||{});}})[_0x082b('0x2c')](function(_0x11be3b){logger['info'](_0x082b('0x2d'),_0x15c093);logger[_0x082b('0x24')](_0x082b('0x2d'),_0x15c093,JSON[_0x082b('0x25')](_0x11be3b));_0x545fd6(_0x11be3b);})[_0x082b('0x1b')](function(_0x50d5fd){logger['error'](_0x082b('0x2d'),_0x50d5fd[_0x082b('0x19')],_0x15c093);_0x2279d7(_this['error'](0x1f4,_0x50d5fd[_0x082b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index c1ed062..76a59eb 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 _0xd4ee=['./mailInteraction.events','save','emit','removeListener','register'];(function(_0x213ca9,_0x189ac8){var _0x254dfa=function(_0x1626a4){while(--_0x1626a4){_0x213ca9['push'](_0x213ca9['shift']());}};_0x254dfa(++_0x189ac8);}(_0xd4ee,0x131));var _0xed4e=function(_0x293fbf,_0x25329b){_0x293fbf=_0x293fbf-0x0;var _0x3332df=_0xd4ee[_0x293fbf];return _0x3332df;};'use strict';var MailInteractionEvents=require(_0xed4e('0x0'));var events=[_0xed4e('0x1'),'remove','update'];function createListener(_0x4eea15,_0xc98627){return function(_0x54ced7){_0xc98627[_0xed4e('0x2')](_0x4eea15,_0x54ced7);};}function removeListener(_0x86d95e,_0x1e442a){return function(){MailInteractionEvents[_0xed4e('0x3')](_0x86d95e,_0x1e442a);};}exports[_0xed4e('0x4')]=function(_0x21e390){for(var _0x5e212d=0x0,_0x2296cc=events['length'];_0x5e212d<_0x2296cc;_0x5e212d++){var _0x42d98e=events[_0x5e212d];var _0x5e1ed4=createListener('mailInteraction:'+_0x42d98e,_0x21e390);MailInteractionEvents['on'](_0x42d98e,_0x5e1ed4);}}; \ No newline at end of file +var _0x9644=['emit','length','./mailInteraction.events','save','remove'];(function(_0x25b9c7,_0x370ece){var _0x4ec3ad=function(_0x16d4c6){while(--_0x16d4c6){_0x25b9c7['push'](_0x25b9c7['shift']());}};_0x4ec3ad(++_0x370ece);}(_0x9644,0x1dd));var _0x4964=function(_0x55253a,_0x39b0a0){_0x55253a=_0x55253a-0x0;var _0x1b7e6b=_0x9644[_0x55253a];return _0x1b7e6b;};'use strict';var MailInteractionEvents=require(_0x4964('0x0'));var events=[_0x4964('0x1'),_0x4964('0x2'),'update'];function createListener(_0x51d818,_0x53acea){return function(_0x15833b){_0x53acea[_0x4964('0x3')](_0x51d818,_0x15833b);};}function removeListener(_0x403c61,_0x1c6fa2){return function(){MailInteractionEvents['removeListener'](_0x403c61,_0x1c6fa2);};}exports['register']=function(_0x50b65b){for(var _0x10a59d=0x0,_0x155648=events[_0x4964('0x4')];_0x10a59d<_0x155648;_0x10a59d++){var _0x425091=events[_0x10a59d];var _0xef2268=createListener('mailInteraction:'+_0x425091,_0x50b65b);MailInteractionEvents['on'](_0x425091,_0xef2268);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 02fddbf..8466641 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 _0x1114=['/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','download','post','tracked','mailmessage:create','put'];(function(_0x100360,_0x238a96){var _0x19f78f=function(_0x2cb846){while(--_0x2cb846){_0x100360['push'](_0x100360['shift']());}};_0x19f78f(++_0x238a96);}(_0x1114,0xb5));var _0x4111=function(_0x27227e,_0x38898c){_0x27227e=_0x27227e-0x0;var _0x54f517=_0x1114[_0x27227e];return _0x54f517;};'use strict';var multer=require(_0x4111('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4111('0x1'));var express=require(_0x4111('0x2'));var router=express[_0x4111('0x3')]();var fs_extra=require(_0x4111('0x4'));var auth=require(_0x4111('0x5'));var interaction=require(_0x4111('0x6'));var config=require('../../config/environment');var controller=require(_0x4111('0x7'));router[_0x4111('0x8')]('/',auth[_0x4111('0x9')](),controller[_0x4111('0xa')]);router[_0x4111('0x8')](_0x4111('0xb'),auth[_0x4111('0x9')](),controller[_0x4111('0xc')]);router[_0x4111('0x8')](_0x4111('0xd'),auth[_0x4111('0x9')](),controller['show']);router['get']('/:id/download',auth[_0x4111('0x9')](),controller[_0x4111('0xe')]);router[_0x4111('0xf')]('/',auth[_0x4111('0x9')](),interaction[_0x4111('0x10')]('mail',_0x4111('0x11')),controller['create']);router[_0x4111('0x12')]('/:id',auth[_0x4111('0x9')](),controller['update']);router[_0x4111('0x12')](_0x4111('0x13'),auth[_0x4111('0x9')](),controller[_0x4111('0x14')]);router[_0x4111('0x12')](_0x4111('0x15'),auth[_0x4111('0x9')](),controller[_0x4111('0x16')]);router[_0x4111('0x17')](_0x4111('0xd'),auth[_0x4111('0x9')](),controller[_0x4111('0x18')]);module['exports']=router; \ No newline at end of file +var _0xb1b8=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','update','put','/:id/accept','/:id/reject','reject','delete'];(function(_0x1029c4,_0x4b5da3){var _0x52c091=function(_0x3d9704){while(--_0x3d9704){_0x1029c4['push'](_0x1029c4['shift']());}};_0x52c091(++_0x4b5da3);}(_0xb1b8,0x12e));var _0x8b1b=function(_0x31880d,_0x4f0ff3){_0x31880d=_0x31880d-0x0;var _0x423823=_0xb1b8[_0x31880d];return _0x423823;};'use strict';var multer=require(_0x8b1b('0x0'));var util=require(_0x8b1b('0x1'));var path=require(_0x8b1b('0x2'));var timeout=require(_0x8b1b('0x3'));var express=require(_0x8b1b('0x4'));var router=express[_0x8b1b('0x5')]();var fs_extra=require(_0x8b1b('0x6'));var auth=require(_0x8b1b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8b1b('0x8'));var controller=require(_0x8b1b('0x9'));router[_0x8b1b('0xa')]('/',auth[_0x8b1b('0xb')](),controller[_0x8b1b('0xc')]);router[_0x8b1b('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x8b1b('0xd')]);router['get'](_0x8b1b('0xe'),auth[_0x8b1b('0xb')](),controller[_0x8b1b('0xf')]);router['get'](_0x8b1b('0x10'),auth[_0x8b1b('0xb')](),controller[_0x8b1b('0x11')]);router[_0x8b1b('0x12')]('/',auth[_0x8b1b('0xb')](),interaction[_0x8b1b('0x13')](_0x8b1b('0x14'),_0x8b1b('0x15')),controller['create']);router['put'](_0x8b1b('0xe'),auth[_0x8b1b('0xb')](),controller[_0x8b1b('0x16')]);router[_0x8b1b('0x17')](_0x8b1b('0x18'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x8b1b('0x19'),auth['isAuthenticated'](),controller[_0x8b1b('0x1a')]);router[_0x8b1b('0x1b')](_0x8b1b('0xe'),auth[_0x8b1b('0xb')](),controller[_0x8b1b('0x1c')]);module[_0x8b1b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index fd7bd1a..40bce59 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 _0x55fc=['long','ENUM','out','STRING','DATE','INTEGER','BOOLEAN','Email','lodash','exports','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55fc,0x131));var _0xc55f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x55fc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var _=require(_0xc55f('0x0'));module[_0xc55f('0x1')]={'body':{'type':Sequelize[_0xc55f('0x2')](_0xc55f('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xc55f('0x2')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc55f('0x4')]('in',_0xc55f('0x5')),'defaultValue':_0xc55f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc55f('0x6')](0x1fe)},'from':{'type':Sequelize[_0xc55f('0x6')]},'to':{'type':Sequelize[_0xc55f('0x2')](_0xc55f('0x3'))},'cc':{'type':Sequelize[_0xc55f('0x2')]('long')},'bcc':{'type':Sequelize[_0xc55f('0x2')](_0xc55f('0x3'))},'subject':{'type':Sequelize[_0xc55f('0x2')]},'sentAt':{'type':Sequelize[_0xc55f('0x7')]},'attach':{'type':Sequelize[_0xc55f('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xc55f('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xc55f('0x7')]},'originTo':{'type':Sequelize['TEXT'](_0xc55f('0x3'))},'originCc':{'type':Sequelize[_0xc55f('0x2')](_0xc55f('0x3'))},'originChannel':{'type':Sequelize['ENUM'](_0xc55f('0xa'),'Chat'),'defaultValue':_0xc55f('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x111e=['ENUM','out','STRING','TEXT','long','DATE','INTEGER','Email','sequelize','lodash','exports','medium','BOOLEAN'];(function(_0x933b98,_0xa0fc6a){var _0x5cd1f9=function(_0x20e030){while(--_0x20e030){_0x933b98['push'](_0x933b98['shift']());}};_0x5cd1f9(++_0xa0fc6a);}(_0x111e,0xcb));var _0xe111=function(_0x1a16b0,_0x5d1b36){_0x1a16b0=_0x1a16b0-0x0;var _0xb655f4=_0x111e[_0x1a16b0];return _0xb655f4;};'use strict';var Sequelize=require(_0xe111('0x0'));var _=require(_0xe111('0x1'));module[_0xe111('0x2')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xe111('0x3'))},'read':{'type':Sequelize[_0xe111('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe111('0x5')]('in','out'),'defaultValue':_0xe111('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xe111('0x7')]},'to':{'type':Sequelize[_0xe111('0x8')](_0xe111('0x9'))},'cc':{'type':Sequelize[_0xe111('0x8')](_0xe111('0x9'))},'bcc':{'type':Sequelize[_0xe111('0x8')](_0xe111('0x9'))},'subject':{'type':Sequelize[_0xe111('0x8')]},'sentAt':{'type':Sequelize[_0xe111('0xa')]},'attach':{'type':Sequelize[_0xe111('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe111('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xe111('0xa')]},'originTo':{'type':Sequelize[_0xe111('0x8')]('long')},'originCc':{'type':Sequelize[_0xe111('0x8')](_0xe111('0x9'))},'originChannel':{'type':Sequelize[_0xe111('0x5')](_0xe111('0xc'),'Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 77ec568..db62406 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 _0xce1a=['server','files','tmp','message-%s.eml','subject','createdAt','Attachment','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','bcc','existsSync','push','readFileSync','build','writeFileSync','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','jayson/promise','client','http','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','name','send','render','merge','body','contact','interaction','account','index','map','MailMessage','rawAttributes','type','key','model','query','keys','attributes','fields','nolimit','order','sort','where','filters','VIRTUAL','filter','options','includeAll','include','findAll','rows','intersection','length','find','params','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmContact','Contacts','updatedAt','DESC','Smtp','isNil','host','port','secure','service','auth','user','pass','attachments','join','root','server/files/attachments','basename','List','defaults','ListId','List\x20not\x20found','SendMail','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','UserId','agent','Contact','MailInteraction','MailInteractionId','read1stAt','format','get','AcceptMessage','acceptMessage','manual','channel','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SIP/%s','event','rejectmessage','download','unix','toString'];(function(_0x47a5d1,_0x4402c4){var _0x139c25=function(_0x36b76f){while(--_0x36b76f){_0x47a5d1['push'](_0x47a5d1['shift']());}};_0x139c25(++_0x4402c4);}(_0xce1a,0xbf));var _0xace1=function(_0x4a91fc,_0x515ea2){_0x4a91fc=_0x4a91fc-0x0;var _0x35de82=_0xce1a[_0x4a91fc];return _0x35de82;};'use strict';var emlformat=require(_0xace1('0x0'));var rimraf=require(_0xace1('0x1'));var zipdir=require(_0xace1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xace1('0x3'));var moment=require('moment');var BPromise=require(_0xace1('0x4'));var Mustache=require('mustache');var util=require(_0xace1('0x5'));var path=require(_0xace1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xace1('0x7'));var fs=require('fs');var fs_extra=require(_0xace1('0x8'));var _=require(_0xace1('0x9'));var squel=require(_0xace1('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xace1('0xb'));var toCsv=require(_0xace1('0xc'));var querystring=require('querystring');var Papa=require(_0xace1('0xd'));var Redis=require(_0xace1('0xe'));var authService=require(_0xace1('0xf'));var qs=require(_0xace1('0x10'));var as=require(_0xace1('0x11'));var hardwareService=require(_0xace1('0x12'));var logger=require(_0xace1('0x13'))(_0xace1('0x14'));var utils=require(_0xace1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xace1('0x16'));var db=require(_0xace1('0x17'))['db'];config[_0xace1('0x18')]=_['defaults'](config[_0xace1('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xace1('0x18')]));require('./mailMessage.socket')['register'](socket);var jayson=require(_0xace1('0x19'));var client=jayson[_0xace1('0x1a')]['http']({'port':0x232c});var client9003=jayson['client'][_0xace1('0x1b')]({'port':0x232b});var client9002=jayson[_0xace1('0x1a')][_0xace1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3c7b16,_0x3cabcf,_0x4846eb,_0x50c53a){return new BPromise(function(_0x5996e8,_0x40c970){var _0x53da29=_0x50c53a||client;return _0x53da29[_0xace1('0x1c')](_0x3c7b16,_0x4846eb)[_0xace1('0x1d')](function(_0x7a1fb5){logger[_0xace1('0x1e')]('MailMessage,\x20%s,\x20%s',_0x3cabcf,_0xace1('0x1f'));logger['debug'](_0xace1('0x20'),_0x3cabcf,_0xace1('0x1f'),JSON[_0xace1('0x21')](_0x7a1fb5));if(_0x7a1fb5[_0xace1('0x22')]){if(_0x7a1fb5[_0xace1('0x22')][_0xace1('0x23')]===0x1f4){logger[_0xace1('0x22')](_0xace1('0x24'),_0x3cabcf,_0x7a1fb5[_0xace1('0x22')][_0xace1('0x25')]);return _0x40c970(_0x7a1fb5[_0xace1('0x22')]['message']);}logger[_0xace1('0x22')](_0xace1('0x24'),_0x3cabcf,_0x7a1fb5['error']['message']);return _0x5996e8(_0x7a1fb5[_0xace1('0x22')][_0xace1('0x25')]);}else{logger[_0xace1('0x1e')]('MailMessage,\x20%s,\x20%s',_0x3cabcf,_0xace1('0x1f'));_0x5996e8(_0x7a1fb5[_0xace1('0x26')][_0xace1('0x25')]);}})[_0xace1('0x27')](function(_0x5bff91){logger[_0xace1('0x22')]('MailMessage,\x20%s,\x20%s',_0x3cabcf,_0x5bff91);_0x40c970(_0x5bff91);});});}function respondWithStatusCode(_0xb0107a,_0x467642){_0x467642=_0x467642||0xcc;return function(_0x17e6b6){if(_0x17e6b6){return _0xb0107a[_0xace1('0x28')](_0x467642);}return _0xb0107a[_0xace1('0x29')](_0x467642)[_0xace1('0x2a')]();};}function respondWithResult(_0x431e58,_0x5d0f8c){_0x5d0f8c=_0x5d0f8c||0xc8;return function(_0x200d75){if(_0x200d75){return _0x431e58[_0xace1('0x29')](_0x5d0f8c)['json'](_0x200d75);}};}function respondWithFilteredResult(_0x233316,_0x244d19){return function(_0x530c66){if(_0x530c66){var _0x16af10=typeof _0x244d19['offset']===_0xace1('0x2b')&&typeof _0x244d19[_0xace1('0x2c')]===_0xace1('0x2b');var _0x30b745=_0x530c66[_0xace1('0x2d')];var _0x49d832=_0x16af10?0x0:_0x244d19['offset'];var _0x5cad42=_0x16af10?_0x530c66['count']:_0x244d19[_0xace1('0x2e')]+_0x244d19[_0xace1('0x2c')];var _0x4968e8;if(_0x5cad42>=_0x30b745){_0x5cad42=_0x30b745;_0x4968e8=0xc8;}else{_0x4968e8=0xce;}_0x233316[_0xace1('0x29')](_0x4968e8);return _0x233316[_0xace1('0x2f')](_0xace1('0x30'),_0x49d832+'-'+_0x5cad42+'/'+_0x30b745)[_0xace1('0x31')](_0x530c66);}return null;};}function patchUpdates(_0x535da1){return function(_0x10b139){try{jsonpatch[_0xace1('0x32')](_0x10b139,_0x535da1,!![]);}catch(_0x4fc1ae){return BPromise['reject'](_0x4fc1ae);}return _0x10b139[_0xace1('0x33')]();};}function saveUpdates(_0x44b31c,_0x1992d7){return function(_0x1ca3dd){if(_0x1ca3dd){return _0x1ca3dd[_0xace1('0x34')](_0x44b31c)[_0xace1('0x1d')](function(_0x4f1707){return _0x4f1707;});}return null;};}function removeEntity(_0x355a5b,_0x30f56c){return function(_0x991964){if(_0x991964){return _0x991964[_0xace1('0x35')]()[_0xace1('0x1d')](function(){_0x355a5b[_0xace1('0x29')](0xcc)[_0xace1('0x2a')]();});}};}function handleEntityNotFound(_0x52ab46,_0x25aef5){return function(_0x4b98a8){if(!_0x4b98a8){_0x52ab46[_0xace1('0x28')](0x194);}return _0x4b98a8;};}function handleError(_0x5dfad3,_0x1ff895){_0x1ff895=_0x1ff895||0x1f4;return function(_0x5c031f){logger[_0xace1('0x22')](_0x5c031f['stack']);if(_0x5c031f['name']){delete _0x5c031f[_0xace1('0x36')];}_0x5dfad3['status'](_0x1ff895)[_0xace1('0x37')](_0x5c031f);};}function getMustacheRender(_0xaa0913,_0x3ad51b){return Mustache[_0xace1('0x38')](_0xaa0913,_[_0xace1('0x39')](_0x3ad51b[_0xace1('0x3a')],{'contact':_0x3ad51b[_0xace1('0x3b')],'message':_0x3ad51b[_0xace1('0x25')],'agent':_0x3ad51b['agent'],'interaction':_0x3ad51b[_0xace1('0x3c')],'account':_0x3ad51b[_0xace1('0x3d')]}))||'';}exports[_0xace1('0x3e')]=function(_0x1d44a4,_0x3ff39b){var _0x2b0cac={},_0x4f7dc6={},_0x4f5863={'count':0x0,'rows':[]};var _0x329f6b=_[_0xace1('0x3f')](db[_0xace1('0x40')][_0xace1('0x41')],function(_0x3b314c){return{'name':_0x3b314c['fieldName'],'type':_0x3b314c[_0xace1('0x42')][_0xace1('0x43')]};});_0x4f7dc6[_0xace1('0x44')]=_[_0xace1('0x3f')](_0x329f6b,'name');_0x4f7dc6[_0xace1('0x45')]=_[_0xace1('0x46')](_0x1d44a4[_0xace1('0x45')]);_0x4f7dc6['filters']=_['intersection'](_0x4f7dc6[_0xace1('0x44')],_0x4f7dc6[_0xace1('0x45')]);_0x2b0cac[_0xace1('0x47')]=_['intersection'](_0x4f7dc6[_0xace1('0x44')],qs[_0xace1('0x48')](_0x1d44a4[_0xace1('0x45')]['fields']));_0x2b0cac[_0xace1('0x47')]=_0x2b0cac['attributes']['length']?_0x2b0cac[_0xace1('0x47')]:_0x4f7dc6[_0xace1('0x44')];if(!_0x1d44a4[_0xace1('0x45')]['hasOwnProperty'](_0xace1('0x49'))){_0x2b0cac[_0xace1('0x2c')]=qs[_0xace1('0x2c')](_0x1d44a4[_0xace1('0x45')][_0xace1('0x2c')]);_0x2b0cac[_0xace1('0x2e')]=qs[_0xace1('0x2e')](_0x1d44a4[_0xace1('0x45')][_0xace1('0x2e')]);}_0x2b0cac[_0xace1('0x4a')]=qs[_0xace1('0x4b')](_0x1d44a4[_0xace1('0x45')][_0xace1('0x4b')]);_0x2b0cac[_0xace1('0x4c')]=qs[_0xace1('0x4d')](_['pick'](_0x1d44a4[_0xace1('0x45')],_0x4f7dc6[_0xace1('0x4d')]),_0x329f6b);if(_0x1d44a4['query']['filter']){_0x2b0cac[_0xace1('0x4c')]=_[_0xace1('0x39')](_0x2b0cac[_0xace1('0x4c')],{'$or':_[_0xace1('0x3f')](_0x329f6b,function(_0x4a1036){if(_0x4a1036[_0xace1('0x42')]!==_0xace1('0x4e')){var _0x316b64={};_0x316b64[_0x4a1036['name']]={'$like':'%'+_0x1d44a4[_0xace1('0x45')][_0xace1('0x4f')]+'%'};return _0x316b64;}})});}_0x2b0cac=_[_0xace1('0x39')]({},_0x2b0cac,_0x1d44a4[_0xace1('0x50')]);var _0x5bcb08={'where':_0x2b0cac[_0xace1('0x4c')]};return db['MailMessage'][_0xace1('0x2d')](_0x5bcb08)[_0xace1('0x1d')](function(_0x1d10e7){_0x4f5863[_0xace1('0x2d')]=_0x1d10e7;if(_0x1d44a4[_0xace1('0x45')][_0xace1('0x51')]){_0x2b0cac[_0xace1('0x52')]=[{'all':!![]}];}return db[_0xace1('0x40')][_0xace1('0x53')](_0x2b0cac);})[_0xace1('0x1d')](function(_0x4bc1c4){_0x4f5863[_0xace1('0x54')]=_0x4bc1c4;return _0x4f5863;})[_0xace1('0x1d')](respondWithFilteredResult(_0x3ff39b,_0x2b0cac))['catch'](handleError(_0x3ff39b,null));};exports['show']=function(_0x379db0,_0x4112ba){var _0x232f70={'raw':!![],'where':{'id':_0x379db0['params']['id']}},_0x16cbb4={};_0x16cbb4[_0xace1('0x44')]=_[_0xace1('0x46')](db[_0xace1('0x40')][_0xace1('0x41')]);_0x16cbb4['query']=_[_0xace1('0x46')](_0x379db0[_0xace1('0x45')]);_0x16cbb4[_0xace1('0x4d')]=_[_0xace1('0x55')](_0x16cbb4[_0xace1('0x44')],_0x16cbb4[_0xace1('0x45')]);_0x232f70[_0xace1('0x47')]=_['intersection'](_0x16cbb4[_0xace1('0x44')],qs[_0xace1('0x48')](_0x379db0[_0xace1('0x45')][_0xace1('0x48')]));_0x232f70[_0xace1('0x47')]=_0x232f70[_0xace1('0x47')][_0xace1('0x56')]?_0x232f70[_0xace1('0x47')]:_0x16cbb4['model'];if(_0x379db0[_0xace1('0x45')][_0xace1('0x51')]){_0x232f70[_0xace1('0x52')]=[{'all':!![]}];}_0x232f70=_['merge']({},_0x232f70,_0x379db0['options']);return db[_0xace1('0x40')][_0xace1('0x57')](_0x232f70)[_0xace1('0x1d')](handleEntityNotFound(_0x4112ba,null))[_0xace1('0x1d')](respondWithResult(_0x4112ba,null))[_0xace1('0x27')](handleError(_0x4112ba,null));};exports[_0xace1('0x34')]=function(_0x5d2abc,_0x24fb06){if(_0x5d2abc[_0xace1('0x3a')]['id']){delete _0x5d2abc[_0xace1('0x3a')]['id'];}return db[_0xace1('0x40')][_0xace1('0x57')]({'where':{'id':_0x5d2abc[_0xace1('0x58')]['id']}})[_0xace1('0x1d')](handleEntityNotFound(_0x24fb06,null))[_0xace1('0x1d')](saveUpdates(_0x5d2abc[_0xace1('0x3a')],null))[_0xace1('0x1d')](respondWithResult(_0x24fb06,null))[_0xace1('0x27')](handleError(_0x24fb06,null));};exports[_0xace1('0x35')]=function(_0xf97dda,_0x3a753a){return db[_0xace1('0x40')][_0xace1('0x57')]({'where':{'id':_0xf97dda['params']['id']}})['then'](handleEntityNotFound(_0x3a753a,null))[_0xace1('0x1d')](removeEntity(_0x3a753a,null))['catch'](handleError(_0x3a753a,null));};exports[_0xace1('0x59')]=function(_0x5637cc,_0x498845){return db[_0xace1('0x40')][_0xace1('0x59')]()['then'](respondWithResult(_0x498845,null))[_0xace1('0x27')](handleError(_0x498845,null));};exports[_0xace1('0x5a')]=function(_0x38c2a2,_0x5583dd){return db['MailMessage'][_0xace1('0x5a')](_0x38c2a2['body'])[_0xace1('0x1d')](function(_0x3c0c52){if(_0x3c0c52){if(_0x3c0c52[_0xace1('0x5b')]===_0xace1('0x5c')&&!_0x3c0c52[_0xace1('0x5d')]){var _0x2297b2,_0x125340,_0x36dba7;if(_0x38c2a2[_0xace1('0x3a')]['to']){_0x125340=_0x38c2a2['body']['to'][_0xace1('0x5e')](',')[0x0];}return db[_0xace1('0x5f')][_0xace1('0x60')]({'where':{'id':_0x3c0c52[_0xace1('0x61')]},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xace1('0x62')],'as':_0xace1('0x63'),'where':{'email':_0x125340},'limit':0x1,'order':[[_0xace1('0x64'),_0xace1('0x65')]]}]},{'model':db['MailServerOut'],'as':_0xace1('0x66'),'raw':!![]}]})[_0xace1('0x1d')](function(_0x5a3adb){_0x2297b2=_0x5a3adb;if(_0x2297b2&&_0x2297b2[_0xace1('0x66')]){var _0x485aca={'tls':{'rejectUnauthorized':![]}};if(_[_0xace1('0x67')](_0x2297b2[_0xace1('0x66')]['service'])){_0x485aca['host']=_0x2297b2[_0xace1('0x66')][_0xace1('0x68')];_0x485aca[_0xace1('0x69')]=_0x2297b2[_0xace1('0x66')][_0xace1('0x69')];_0x485aca[_0xace1('0x6a')]=_0x2297b2[_0xace1('0x66')]['secure'];if(_0x2297b2[_0xace1('0x66')]['authentication']){_0x485aca['auth']={'user':_0x2297b2[_0xace1('0x66')]['user'],'pass':_0x2297b2['Smtp']['pass']};}}else{_0x485aca['service']=_0x2297b2[_0xace1('0x66')][_0xace1('0x6b')];_0x485aca[_0xace1('0x6c')]={'user':_0x2297b2[_0xace1('0x66')][_0xace1('0x6d')],'pass':_0x2297b2['Smtp'][_0xace1('0x6e')]};_0x485aca[_0xace1('0x6a')]=_0x2297b2[_0xace1('0x66')][_0xace1('0x6a')];}if(_0x38c2a2[_0xace1('0x3a')][_0xace1('0x6f')]&&_0x38c2a2['body'][_0xace1('0x6f')]['length']){for(var _0x41d50d=0x0;_0x41d50d<_0x38c2a2[_0xace1('0x3a')]['attachments'][_0xace1('0x56')];_0x41d50d+=0x1){_0x38c2a2['body'][_0xace1('0x6f')][_0x41d50d]={'filename':_0x38c2a2[_0xace1('0x3a')][_0xace1('0x6f')][_0x41d50d][_0xace1('0x36')],'path':path[_0xace1('0x70')](config[_0xace1('0x71')],_0xace1('0x72'),_0x38c2a2[_0xace1('0x3a')]['attachments'][_0x41d50d][_0xace1('0x73')])};}}_0x36dba7={'account':_0x485aca,'message':_0x38c2a2[_0xace1('0x3a')]};return;}})[_0xace1('0x1d')](function(){if(_0x2297b2[_0xace1('0x74')]){if(_0x2297b2[_0xace1('0x74')]['Contacts'][_0xace1('0x56')]){return _0x2297b2['List']['Contacts'][0x0];}else{return db[_0xace1('0x62')][_0xace1('0x5a')](_[_0xace1('0x75')](_0x38c2a2[_0xace1('0x3a')],{'firstName':_0x38c2a2[_0xace1('0x3a')]['to'],'email':_0x38c2a2[_0xace1('0x3a')]['to'],'phone':_0x38c2a2[_0xace1('0x3a')]['to'],'ListId':_0x2297b2[_0xace1('0x76')]}));}}else{throw new Error(_0xace1('0x77'));}})[_0xace1('0x1d')](function(){if(_0x36dba7){return respondWithRpcPromise(_0xace1('0x78'),'sendMail',_0x36dba7,client9003)[_0xace1('0x1d')](function(_0x342cf3){return _0x3c0c52[_0xace1('0x34')]({'read':!![],'messageId':_0x342cf3['messageId'],'sentAt':moment()['format'](_0xace1('0x79'))});})['catch'](function(_0x14a662){logger['error']('%s',JSON[_0xace1('0x21')](_0x14a662));return _0x3c0c52;});}return _0x3c0c52;});}return _0x3c0c52;}})['then'](respondWithResult(_0x5583dd,0xc9))[_0xace1('0x27')](handleError(_0x5583dd,null));};var interaction_log=require(_0xace1('0x13'))(_0xace1('0x7a'));exports[_0xace1('0x7b')]=function(_0x4a9984,_0x51c1a4,_0x5dcbc5){var _0x20edee={'agent':{},'channel':_0xace1('0x7c')};if(_0x4a9984['body']['id']){delete _0x4a9984[_0xace1('0x3a')]['id'];}_0x4a9984[_0xace1('0x3a')][_0xace1('0x7d')]=!![];_0x4a9984['body']['readAt']=moment()['format'](_0xace1('0x79'));_0x4a9984['body'][_0xace1('0x7e')]=_0x4a9984[_0xace1('0x3a')][_0xace1('0x7e')]||_0x4a9984[_0xace1('0x6d')]['id'];_0x20edee[_0xace1('0x7f')]['id']=_0x4a9984['body'][_0xace1('0x7e')];return db[_0xace1('0x40')][_0xace1('0x57')]({'where':{'id':_0x4a9984[_0xace1('0x58')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xace1('0x80')}]})[_0xace1('0x1d')](handleEntityNotFound(_0x51c1a4,null))[_0xace1('0x1d')](saveUpdates(_0x4a9984[_0xace1('0x3a')],null))['then'](function(_0x31e35d){if(_0x31e35d){_0x20edee[_0xace1('0x25')]=_0x31e35d['get']({'plain':!![]});return db[_0xace1('0x81')][_0xace1('0x57')]({'where':{'id':_0x31e35d[_0xace1('0x82')]}});}return null;})['then'](handleEntityNotFound(_0x51c1a4,null))['then'](function(_0x14e143){if(_0x14e143){return _0x14e143['update']({'UserId':_0x4a9984[_0xace1('0x3a')]['UserId'],'read1stAt':_[_0xace1('0x67')](_0x14e143[_0xace1('0x83')])?moment()[_0xace1('0x84')](_0xace1('0x79')):undefined});}return null;})['then'](function(_0x5bb4b7){if(_0x5bb4b7){_0x20edee['interaction']=_0x5bb4b7[_0xace1('0x85')]({'plain':!![]});interaction_log[_0xace1('0x1e')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a9984[_0xace1('0x6d')]['id'],_0x4a9984[_0xace1('0x6d')]['name'],_0x4a9984[_0xace1('0x6d')]['role'],_0x20edee[_0xace1('0x3c')]['id'],_0x4a9984[_0xace1('0x3a')]?JSON[_0xace1('0x21')](_0x4a9984[_0xace1('0x3a')]):'null');return respondWithRpcPromise(_0xace1('0x86'),_0xace1('0x87'),_0x20edee);}return null;})[_0xace1('0x1d')](function(_0x47d8a1){if(_0x47d8a1){if(_0x4a9984[_0xace1('0x3a')][_0xace1('0x88')]){_0x20edee[_0xace1('0x25')]['interface']=util[_0xace1('0x84')]('SIP/%s',_0x4a9984[_0xace1('0x6d')][_0xace1('0x36')]);_0x20edee['message']['channel']=_0x20edee[_0xace1('0x89')];_0x20edee[_0xace1('0x25')]['event']=_0xace1('0x7b');return respondWithRpcPromise(_0xace1('0x8a'),_0xace1('0x8a'),{'event':_0xace1('0x8b'),'message':_0x20edee[_0xace1('0x25')]},client9002)[_0xace1('0x1d')](function(){return _0x20edee;});}return _0x20edee;}return null;})[_0xace1('0x1d')](respondWithResult(_0x51c1a4,null))[_0xace1('0x27')](handleError(_0x51c1a4,null));};var interaction_log=require(_0xace1('0x13'))('mail-interactions');exports[_0xace1('0x8c')]=function(_0x8968cf,_0x34ed06,_0x2ca22f){var _0x2cb56f={'agent':{},'channel':_0xace1('0x7c')};if(_0x8968cf[_0xace1('0x3a')]['id']){delete _0x8968cf[_0xace1('0x3a')]['id'];}_0x8968cf[_0xace1('0x3a')][_0xace1('0x7e')]=_0x8968cf[_0xace1('0x3a')][_0xace1('0x7e')]||_0x8968cf[_0xace1('0x6d')]['id'];_0x2cb56f[_0xace1('0x7f')]['id']=_0x8968cf[_0xace1('0x3a')][_0xace1('0x7e')];return db[_0xace1('0x40')]['find']({'where':{'id':_0x8968cf[_0xace1('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x34ed06,null))['then'](function(_0x1bef2e){if(_0x1bef2e){_0x2cb56f[_0xace1('0x25')]=_0x1bef2e[_0xace1('0x85')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x1bef2e[_0xace1('0x82')]}});}return null;})[_0xace1('0x1d')](handleEntityNotFound(_0x34ed06,null))['then'](function(_0xe822f4){if(_0xe822f4){_0x2cb56f[_0xace1('0x3c')]=_0xe822f4[_0xace1('0x85')]({'plain':!![]});interaction_log[_0xace1('0x1e')](_0xace1('0x8d'),_0x8968cf[_0xace1('0x6d')]['id'],_0x8968cf[_0xace1('0x6d')][_0xace1('0x36')],_0x8968cf[_0xace1('0x6d')]['role'],_0x2cb56f['interaction']['id'],_0x8968cf[_0xace1('0x3a')]?JSON[_0xace1('0x21')](_0x8968cf['body']):'null');return respondWithRpcPromise('RejectMessage',_0xace1('0x8e'),_0x2cb56f);}return null;})[_0xace1('0x1d')](function(_0x5f211d){if(_0x5f211d){_0x5f211d[_0xace1('0x25')]['interface']=util[_0xace1('0x84')](_0xace1('0x8f'),_0x8968cf[_0xace1('0x6d')]['name']);_0x5f211d[_0xace1('0x25')][_0xace1('0x89')]=_0x2cb56f[_0xace1('0x89')];_0x5f211d[_0xace1('0x25')][_0xace1('0x90')]=_0xace1('0x8c');respondWithRpcPromise(_0xace1('0x8a'),_0xace1('0x8a'),{'event':_0xace1('0x91'),'message':_0x5f211d[_0xace1('0x25')]},client9002);return _0x2cb56f;}return null;})[_0xace1('0x1d')](respondWithResult(_0x34ed06,null))[_0xace1('0x27')](handleError(_0x34ed06,null));};exports[_0xace1('0x92')]=function(_0x21cb28,_0x194cf7){var _0x2ef7a6=moment()[_0xace1('0x93')]()[_0xace1('0x94')]();var _0xec779b=path['join'](config[_0xace1('0x71')],_0xace1('0x95'),_0xace1('0x96'),_0xace1('0x97'));var _0x566100=path[_0xace1('0x70')](config[_0xace1('0x71')],_0xace1('0x95'),_0xace1('0x96'),_0xace1('0x6f'));var _0x3764ff=util['format'](_0xace1('0x98'),_0x2ef7a6);return db[_0xace1('0x40')][_0xace1('0x57')]({'where':{'id':_0x21cb28[_0xace1('0x58')]['id']},'attributes':['id',_0xace1('0x3a'),'from','to','cc','bcc',_0xace1('0x99'),_0xace1('0x9a')],'include':_0x21cb28['query']['attachments']?[{'model':db[_0xace1('0x9b')],'as':_0xace1('0x9c')}]:undefined})[_0xace1('0x1d')](handleEntityNotFound(_0x194cf7,null))[_0xace1('0x1d')](function(_0x346b39){if(_0x346b39){var _0x25a7b2=_0x346b39;var _0x1e19f9={'from':_0x25a7b2[_0xace1('0x9d')],'to':_0x25a7b2['to'],'subject':_0x25a7b2[_0xace1('0x99')],'html':_0x25a7b2[_0xace1('0x3a')],'headers':{'Date':moment(_0x25a7b2['createdAt'])[_0xace1('0x84')](_0xace1('0x9e'))},'attachments':[]};if(_0x346b39['cc']){_0x1e19f9['headers']['Cc']=_0x346b39['cc'];}if(_0x346b39['bcc']){_0x1e19f9[_0xace1('0x9f')][_0xace1('0xa0')]=_0x346b39[_0xace1('0xa1')];}return new BPromise(function(_0x1e940f,_0x238e61){if(_0x346b39[_0xace1('0x9c')]){for(var _0x39aabf=0x0;_0x39aabf<_0x346b39[_0xace1('0x9c')]['length'];_0x39aabf++){var _0xc5b648=_0x346b39[_0xace1('0x9c')][_0x39aabf];var _0x371cd7=path[_0xace1('0x70')](_0x566100,_0xc5b648[_0xace1('0x73')]);if(fs[_0xace1('0xa2')](_0x371cd7)){_0x1e19f9[_0xace1('0x6f')][_0xace1('0xa3')]({'name':_0xc5b648[_0xace1('0x36')],'contentType':_0xc5b648[_0xace1('0x42')],'data':fs[_0xace1('0xa4')](_0x371cd7)});}}}emlformat[_0xace1('0xa5')](_0x1e19f9,function(_0x2d9d85,_0xec781){if(_0x2d9d85)return _0x238e61(_0x2d9d85);fs[_0xace1('0xa6')](path['join'](_0xec779b,_0x3764ff),_0xec781);return _0x1e940f(_0xec781);});});}})[_0xace1('0x1d')](function(_0x458447){if(_0x458447){return _0x194cf7[_0xace1('0x92')](path[_0xace1('0x70')](_0xec779b,_0x3764ff),_0x3764ff,function(_0x2b9ce2){if(_0x2b9ce2){console[_0xace1('0xa7')](_0xace1('0xa8'),_0x2b9ce2);}else{fs[_0xace1('0xa9')](path[_0xace1('0x70')](_0xec779b,_0x3764ff));}});}})[_0xace1('0x27')](handleError(_0x194cf7,null));}; \ No newline at end of file +var _0xc494=['rejectMessage','rejectmessage','download','unix','toString','root','server','files','tmp','message-%s.eml','bcc','subject','createdAt','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','build','writeFileSync','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','render','merge','body','interaction','account','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','MailMessage','includeAll','include','findAll','rows','params','length','find','describe','create','direction','out','secret','split','MailAccount','MailAccountId','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','authentication','auth','user','pass','secure','attachments','join','server/files/attachments','basename','ListId','List\x20not\x20found','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','read','readAt','UserId','agent','Contact','MailInteraction','MailInteractionId','read1stAt','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','null','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail-interactions','mail','RejectMessage'];(function(_0x102363,_0x158232){var _0x59c3ed=function(_0x145da9){while(--_0x145da9){_0x102363['push'](_0x102363['shift']());}};_0x59c3ed(++_0x158232);}(_0xc494,0x170));var _0x4c49=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0xc494[_0xf55e73];return _0x116b99;};'use strict';var emlformat=require(_0x4c49('0x0'));var rimraf=require(_0x4c49('0x1'));var zipdir=require(_0x4c49('0x2'));var jsonpatch=require(_0x4c49('0x3'));var rp=require(_0x4c49('0x4'));var moment=require(_0x4c49('0x5'));var BPromise=require(_0x4c49('0x6'));var Mustache=require(_0x4c49('0x7'));var util=require(_0x4c49('0x8'));var path=require(_0x4c49('0x9'));var sox=require(_0x4c49('0xa'));var csv=require('to-csv');var ejs=require(_0x4c49('0xb'));var fs=require('fs');var fs_extra=require(_0x4c49('0xc'));var _=require(_0x4c49('0xd'));var squel=require(_0x4c49('0xe'));var crypto=require('crypto');var jsforce=require(_0x4c49('0xf'));var deskjs=require(_0x4c49('0x10'));var toCsv=require(_0x4c49('0x11'));var querystring=require(_0x4c49('0x12'));var Papa=require(_0x4c49('0x13'));var Redis=require('ioredis');var authService=require(_0x4c49('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4c49('0x15'));var hardwareService=require(_0x4c49('0x16'));var logger=require('../../config/logger')(_0x4c49('0x17'));var utils=require(_0x4c49('0x18'));var config=require(_0x4c49('0x19'));var licenseUtil=require(_0x4c49('0x1a'));var db=require(_0x4c49('0x1b'))['db'];config[_0x4c49('0x1c')]=_[_0x4c49('0x1d')](config['redis'],{'host':_0x4c49('0x1e'),'port':0x18eb});var socket=require(_0x4c49('0x1f'))(new Redis(config[_0x4c49('0x1c')]));require(_0x4c49('0x20'))['register'](socket);var jayson=require(_0x4c49('0x21'));var client=jayson[_0x4c49('0x22')][_0x4c49('0x23')]({'port':0x232c});var client9003=jayson['client'][_0x4c49('0x23')]({'port':0x232b});var client9002=jayson[_0x4c49('0x22')][_0x4c49('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x1ec1cf,_0x2a19dd,_0x348f92,_0x4124b1){return new BPromise(function(_0x4b7190,_0x37fb78){var _0x343263=_0x4124b1||client;return _0x343263['request'](_0x1ec1cf,_0x348f92)[_0x4c49('0x24')](function(_0xf239d0){logger[_0x4c49('0x25')](_0x4c49('0x26'),_0x2a19dd,'request\x20sent');logger[_0x4c49('0x27')](_0x4c49('0x28'),_0x2a19dd,'request\x20sent',JSON[_0x4c49('0x29')](_0xf239d0));if(_0xf239d0['error']){if(_0xf239d0[_0x4c49('0x2a')][_0x4c49('0x2b')]===0x1f4){logger[_0x4c49('0x2a')]('MailMessage,\x20%s,\x20%s',_0x2a19dd,_0xf239d0[_0x4c49('0x2a')]['message']);return _0x37fb78(_0xf239d0[_0x4c49('0x2a')][_0x4c49('0x2c')]);}logger[_0x4c49('0x2a')](_0x4c49('0x26'),_0x2a19dd,_0xf239d0[_0x4c49('0x2a')][_0x4c49('0x2c')]);return _0x4b7190(_0xf239d0[_0x4c49('0x2a')][_0x4c49('0x2c')]);}else{logger['info'](_0x4c49('0x26'),_0x2a19dd,_0x4c49('0x2d'));_0x4b7190(_0xf239d0[_0x4c49('0x2e')][_0x4c49('0x2c')]);}})[_0x4c49('0x2f')](function(_0x36f14b){logger['error'](_0x4c49('0x26'),_0x2a19dd,_0x36f14b);_0x37fb78(_0x36f14b);});});}function respondWithStatusCode(_0x4bfba2,_0x19860e){_0x19860e=_0x19860e||0xcc;return function(_0x951f61){if(_0x951f61){return _0x4bfba2['sendStatus'](_0x19860e);}return _0x4bfba2[_0x4c49('0x30')](_0x19860e)['end']();};}function respondWithResult(_0x1c1343,_0x229417){_0x229417=_0x229417||0xc8;return function(_0x14f664){if(_0x14f664){return _0x1c1343[_0x4c49('0x30')](_0x229417)[_0x4c49('0x31')](_0x14f664);}};}function respondWithFilteredResult(_0x2eac13,_0x2f2219){return function(_0x4fb9fd){if(_0x4fb9fd){var _0x39aa9c=typeof _0x2f2219[_0x4c49('0x32')]===_0x4c49('0x33')&&typeof _0x2f2219[_0x4c49('0x34')]==='undefined';var _0x5b58d5=_0x4fb9fd[_0x4c49('0x35')];var _0x389dcd=_0x39aa9c?0x0:_0x2f2219[_0x4c49('0x32')];var _0x23cf72=_0x39aa9c?_0x4fb9fd[_0x4c49('0x35')]:_0x2f2219['offset']+_0x2f2219['limit'];var _0xccc7dd;if(_0x23cf72>=_0x5b58d5){_0x23cf72=_0x5b58d5;_0xccc7dd=0xc8;}else{_0xccc7dd=0xce;}_0x2eac13[_0x4c49('0x30')](_0xccc7dd);return _0x2eac13[_0x4c49('0x36')](_0x4c49('0x37'),_0x389dcd+'-'+_0x23cf72+'/'+_0x5b58d5)['json'](_0x4fb9fd);}return null;};}function patchUpdates(_0x2127c8){return function(_0x39f9f4){try{jsonpatch[_0x4c49('0x38')](_0x39f9f4,_0x2127c8,!![]);}catch(_0x25f92d){return BPromise[_0x4c49('0x39')](_0x25f92d);}return _0x39f9f4[_0x4c49('0x3a')]();};}function saveUpdates(_0x6662f7,_0x3d14f6){return function(_0x20c9d3){if(_0x20c9d3){return _0x20c9d3[_0x4c49('0x3b')](_0x6662f7)[_0x4c49('0x24')](function(_0x27e91b){return _0x27e91b;});}return null;};}function removeEntity(_0x1a3fe3,_0x25900d){return function(_0x568988){if(_0x568988){return _0x568988[_0x4c49('0x3c')]()[_0x4c49('0x24')](function(){_0x1a3fe3['status'](0xcc)[_0x4c49('0x3d')]();});}};}function handleEntityNotFound(_0x455241,_0x5cefe6){return function(_0xd54a0b){if(!_0xd54a0b){_0x455241['sendStatus'](0x194);}return _0xd54a0b;};}function handleError(_0x356d18,_0x1f1f8e){_0x1f1f8e=_0x1f1f8e||0x1f4;return function(_0x26e944){logger[_0x4c49('0x2a')](_0x26e944[_0x4c49('0x3e')]);if(_0x26e944['name']){delete _0x26e944['name'];}_0x356d18['status'](_0x1f1f8e)['send'](_0x26e944);};}function getMustacheRender(_0x227ee6,_0xafb0dc){return Mustache[_0x4c49('0x3f')](_0x227ee6,_[_0x4c49('0x40')](_0xafb0dc[_0x4c49('0x41')],{'contact':_0xafb0dc['contact'],'message':_0xafb0dc[_0x4c49('0x2c')],'agent':_0xafb0dc['agent'],'interaction':_0xafb0dc[_0x4c49('0x42')],'account':_0xafb0dc[_0x4c49('0x43')]}))||'';}exports[_0x4c49('0x44')]=function(_0x20e16e,_0x503a66){var _0x54eaa1={},_0x3a6aa7={},_0x44ef06={'count':0x0,'rows':[]};var _0x4d8ece=_[_0x4c49('0x45')](db['MailMessage'][_0x4c49('0x46')],function(_0x205ff6){return{'name':_0x205ff6['fieldName'],'type':_0x205ff6[_0x4c49('0x47')]['key']};});_0x3a6aa7[_0x4c49('0x48')]=_[_0x4c49('0x45')](_0x4d8ece,'name');_0x3a6aa7[_0x4c49('0x49')]=_[_0x4c49('0x4a')](_0x20e16e[_0x4c49('0x49')]);_0x3a6aa7['filters']=_[_0x4c49('0x4b')](_0x3a6aa7[_0x4c49('0x48')],_0x3a6aa7['query']);_0x54eaa1[_0x4c49('0x4c')]=_[_0x4c49('0x4b')](_0x3a6aa7[_0x4c49('0x48')],qs[_0x4c49('0x4d')](_0x20e16e[_0x4c49('0x49')][_0x4c49('0x4d')]));_0x54eaa1[_0x4c49('0x4c')]=_0x54eaa1[_0x4c49('0x4c')]['length']?_0x54eaa1[_0x4c49('0x4c')]:_0x3a6aa7[_0x4c49('0x48')];if(!_0x20e16e[_0x4c49('0x49')][_0x4c49('0x4e')](_0x4c49('0x4f'))){_0x54eaa1[_0x4c49('0x34')]=qs[_0x4c49('0x34')](_0x20e16e[_0x4c49('0x49')]['limit']);_0x54eaa1[_0x4c49('0x32')]=qs[_0x4c49('0x32')](_0x20e16e['query'][_0x4c49('0x32')]);}_0x54eaa1[_0x4c49('0x50')]=qs[_0x4c49('0x51')](_0x20e16e[_0x4c49('0x49')][_0x4c49('0x51')]);_0x54eaa1[_0x4c49('0x52')]=qs[_0x4c49('0x53')](_['pick'](_0x20e16e[_0x4c49('0x49')],_0x3a6aa7[_0x4c49('0x53')]),_0x4d8ece);if(_0x20e16e['query'][_0x4c49('0x54')]){_0x54eaa1[_0x4c49('0x52')]=_[_0x4c49('0x40')](_0x54eaa1['where'],{'$or':_[_0x4c49('0x45')](_0x4d8ece,function(_0x4ac065){if(_0x4ac065[_0x4c49('0x47')]!==_0x4c49('0x55')){var _0x5aac56={};_0x5aac56[_0x4ac065['name']]={'$like':'%'+_0x20e16e[_0x4c49('0x49')][_0x4c49('0x54')]+'%'};return _0x5aac56;}})});}_0x54eaa1=_[_0x4c49('0x40')]({},_0x54eaa1,_0x20e16e[_0x4c49('0x56')]);var _0x381276={'where':_0x54eaa1[_0x4c49('0x52')]};return db[_0x4c49('0x57')][_0x4c49('0x35')](_0x381276)['then'](function(_0x289c2c){_0x44ef06[_0x4c49('0x35')]=_0x289c2c;if(_0x20e16e[_0x4c49('0x49')][_0x4c49('0x58')]){_0x54eaa1[_0x4c49('0x59')]=[{'all':!![]}];}return db[_0x4c49('0x57')][_0x4c49('0x5a')](_0x54eaa1);})['then'](function(_0x4e9f9a){_0x44ef06[_0x4c49('0x5b')]=_0x4e9f9a;return _0x44ef06;})[_0x4c49('0x24')](respondWithFilteredResult(_0x503a66,_0x54eaa1))[_0x4c49('0x2f')](handleError(_0x503a66,null));};exports['show']=function(_0x369f5e,_0x1fc4cf){var _0x38b328={'raw':!![],'where':{'id':_0x369f5e[_0x4c49('0x5c')]['id']}},_0x18b095={};_0x18b095[_0x4c49('0x48')]=_[_0x4c49('0x4a')](db['MailMessage'][_0x4c49('0x46')]);_0x18b095[_0x4c49('0x49')]=_[_0x4c49('0x4a')](_0x369f5e['query']);_0x18b095[_0x4c49('0x53')]=_[_0x4c49('0x4b')](_0x18b095[_0x4c49('0x48')],_0x18b095['query']);_0x38b328[_0x4c49('0x4c')]=_[_0x4c49('0x4b')](_0x18b095[_0x4c49('0x48')],qs[_0x4c49('0x4d')](_0x369f5e[_0x4c49('0x49')][_0x4c49('0x4d')]));_0x38b328['attributes']=_0x38b328[_0x4c49('0x4c')][_0x4c49('0x5d')]?_0x38b328['attributes']:_0x18b095[_0x4c49('0x48')];if(_0x369f5e[_0x4c49('0x49')][_0x4c49('0x58')]){_0x38b328[_0x4c49('0x59')]=[{'all':!![]}];}_0x38b328=_[_0x4c49('0x40')]({},_0x38b328,_0x369f5e[_0x4c49('0x56')]);return db[_0x4c49('0x57')][_0x4c49('0x5e')](_0x38b328)['then'](handleEntityNotFound(_0x1fc4cf,null))[_0x4c49('0x24')](respondWithResult(_0x1fc4cf,null))[_0x4c49('0x2f')](handleError(_0x1fc4cf,null));};exports[_0x4c49('0x3b')]=function(_0x4fec69,_0x17dfdb){if(_0x4fec69[_0x4c49('0x41')]['id']){delete _0x4fec69[_0x4c49('0x41')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x4fec69['params']['id']}})['then'](handleEntityNotFound(_0x17dfdb,null))[_0x4c49('0x24')](saveUpdates(_0x4fec69[_0x4c49('0x41')],null))[_0x4c49('0x24')](respondWithResult(_0x17dfdb,null))[_0x4c49('0x2f')](handleError(_0x17dfdb,null));};exports[_0x4c49('0x3c')]=function(_0x25aea2,_0x36e938){return db['MailMessage']['find']({'where':{'id':_0x25aea2[_0x4c49('0x5c')]['id']}})[_0x4c49('0x24')](handleEntityNotFound(_0x36e938,null))[_0x4c49('0x24')](removeEntity(_0x36e938,null))[_0x4c49('0x2f')](handleError(_0x36e938,null));};exports[_0x4c49('0x5f')]=function(_0x141760,_0x462d64){return db[_0x4c49('0x57')][_0x4c49('0x5f')]()['then'](respondWithResult(_0x462d64,null))[_0x4c49('0x2f')](handleError(_0x462d64,null));};exports[_0x4c49('0x60')]=function(_0xa7c841,_0x3fd706){return db[_0x4c49('0x57')][_0x4c49('0x60')](_0xa7c841[_0x4c49('0x41')])[_0x4c49('0x24')](function(_0x3b9f2f){if(_0x3b9f2f){if(_0x3b9f2f[_0x4c49('0x61')]===_0x4c49('0x62')&&!_0x3b9f2f[_0x4c49('0x63')]){var _0x5c07b8,_0xd435c1,_0x2b4553;if(_0xa7c841['body']['to']){_0xd435c1=_0xa7c841[_0x4c49('0x41')]['to'][_0x4c49('0x64')](',')[0x0];}return db[_0x4c49('0x65')]['findOne']({'where':{'id':_0x3b9f2f[_0x4c49('0x66')]},'include':[{'model':db['CmList'],'as':_0x4c49('0x67'),'include':[{'model':db[_0x4c49('0x68')],'as':_0x4c49('0x69'),'where':{'email':_0xd435c1},'limit':0x1,'order':[['updatedAt',_0x4c49('0x6a')]]}]},{'model':db[_0x4c49('0x6b')],'as':_0x4c49('0x6c'),'raw':!![]}]})['then'](function(_0x11823f){_0x5c07b8=_0x11823f;if(_0x5c07b8&&_0x5c07b8[_0x4c49('0x6c')]){var _0x5c9f78={'tls':{'rejectUnauthorized':![]}};if(_[_0x4c49('0x6d')](_0x5c07b8[_0x4c49('0x6c')][_0x4c49('0x6e')])){_0x5c9f78[_0x4c49('0x6f')]=_0x5c07b8[_0x4c49('0x6c')]['host'];_0x5c9f78[_0x4c49('0x70')]=_0x5c07b8[_0x4c49('0x6c')]['port'];_0x5c9f78['secure']=_0x5c07b8[_0x4c49('0x6c')]['secure'];if(_0x5c07b8[_0x4c49('0x6c')][_0x4c49('0x71')]){_0x5c9f78[_0x4c49('0x72')]={'user':_0x5c07b8['Smtp'][_0x4c49('0x73')],'pass':_0x5c07b8[_0x4c49('0x6c')][_0x4c49('0x74')]};}}else{_0x5c9f78['service']=_0x5c07b8['Smtp'][_0x4c49('0x6e')];_0x5c9f78[_0x4c49('0x72')]={'user':_0x5c07b8[_0x4c49('0x6c')][_0x4c49('0x73')],'pass':_0x5c07b8['Smtp'][_0x4c49('0x74')]};_0x5c9f78['secure']=_0x5c07b8['Smtp'][_0x4c49('0x75')];}if(_0xa7c841[_0x4c49('0x41')]['attachments']&&_0xa7c841[_0x4c49('0x41')][_0x4c49('0x76')][_0x4c49('0x5d')]){for(var _0x142f48=0x0;_0x142f48<_0xa7c841[_0x4c49('0x41')][_0x4c49('0x76')]['length'];_0x142f48+=0x1){_0xa7c841[_0x4c49('0x41')]['attachments'][_0x142f48]={'filename':_0xa7c841['body'][_0x4c49('0x76')][_0x142f48]['name'],'path':path[_0x4c49('0x77')](config['root'],_0x4c49('0x78'),_0xa7c841[_0x4c49('0x41')][_0x4c49('0x76')][_0x142f48][_0x4c49('0x79')])};}}_0x2b4553={'account':_0x5c9f78,'message':_0xa7c841[_0x4c49('0x41')]};return;}})[_0x4c49('0x24')](function(){if(_0x5c07b8[_0x4c49('0x67')]){if(_0x5c07b8[_0x4c49('0x67')]['Contacts'][_0x4c49('0x5d')]){return _0x5c07b8[_0x4c49('0x67')][_0x4c49('0x69')][0x0];}else{return db['CmContact'][_0x4c49('0x60')](_[_0x4c49('0x1d')](_0xa7c841[_0x4c49('0x41')],{'firstName':_0xa7c841[_0x4c49('0x41')]['to'],'email':_0xa7c841['body']['to'],'phone':_0xa7c841[_0x4c49('0x41')]['to'],'ListId':_0x5c07b8[_0x4c49('0x7a')]}));}}else{throw new Error(_0x4c49('0x7b'));}})[_0x4c49('0x24')](function(){if(_0x2b4553){return respondWithRpcPromise('SendMail','sendMail',_0x2b4553,client9003)[_0x4c49('0x24')](function(_0x1e08f4){return _0x3b9f2f[_0x4c49('0x3b')]({'read':!![],'messageId':_0x1e08f4['messageId'],'sentAt':moment()[_0x4c49('0x7c')](_0x4c49('0x7d'))});})[_0x4c49('0x2f')](function(_0x38b97d){logger['error']('%s',JSON[_0x4c49('0x29')](_0x38b97d));return _0x3b9f2f;});}return _0x3b9f2f;});}return _0x3b9f2f;}})[_0x4c49('0x24')](respondWithResult(_0x3fd706,0xc9))['catch'](handleError(_0x3fd706,null));};var interaction_log=require(_0x4c49('0x7e'))('mail-interactions');exports[_0x4c49('0x7f')]=function(_0x432502,_0x7dbb90,_0x5a2de8){var _0x56c601={'agent':{},'channel':'mail'};if(_0x432502[_0x4c49('0x41')]['id']){delete _0x432502[_0x4c49('0x41')]['id'];}_0x432502[_0x4c49('0x41')][_0x4c49('0x80')]=!![];_0x432502[_0x4c49('0x41')][_0x4c49('0x81')]=moment()[_0x4c49('0x7c')](_0x4c49('0x7d'));_0x432502['body'][_0x4c49('0x82')]=_0x432502[_0x4c49('0x41')][_0x4c49('0x82')]||_0x432502[_0x4c49('0x73')]['id'];_0x56c601[_0x4c49('0x83')]['id']=_0x432502[_0x4c49('0x41')][_0x4c49('0x82')];return db[_0x4c49('0x57')]['find']({'where':{'id':_0x432502[_0x4c49('0x5c')]['id'],'UserId':null},'include':[{'model':db[_0x4c49('0x68')],'as':_0x4c49('0x84')}]})[_0x4c49('0x24')](handleEntityNotFound(_0x7dbb90,null))[_0x4c49('0x24')](saveUpdates(_0x432502[_0x4c49('0x41')],null))[_0x4c49('0x24')](function(_0x249d3a){if(_0x249d3a){_0x56c601[_0x4c49('0x2c')]=_0x249d3a['get']({'plain':!![]});return db[_0x4c49('0x85')][_0x4c49('0x5e')]({'where':{'id':_0x249d3a[_0x4c49('0x86')]}});}return null;})[_0x4c49('0x24')](handleEntityNotFound(_0x7dbb90,null))['then'](function(_0x18a25a){if(_0x18a25a){return _0x18a25a[_0x4c49('0x3b')]({'UserId':_0x432502[_0x4c49('0x41')]['UserId'],'read1stAt':_['isNil'](_0x18a25a[_0x4c49('0x87')])?moment()[_0x4c49('0x7c')](_0x4c49('0x7d')):undefined});}return null;})['then'](function(_0x5b9e2e){if(_0x5b9e2e){_0x56c601[_0x4c49('0x42')]=_0x5b9e2e[_0x4c49('0x88')]({'plain':!![]});interaction_log[_0x4c49('0x25')](_0x4c49('0x89'),_0x432502[_0x4c49('0x73')]['id'],_0x432502['user'][_0x4c49('0x8a')],_0x432502[_0x4c49('0x73')][_0x4c49('0x8b')],_0x56c601[_0x4c49('0x42')]['id'],_0x432502[_0x4c49('0x41')]?JSON['stringify'](_0x432502[_0x4c49('0x41')]):_0x4c49('0x8c'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x56c601);}return null;})[_0x4c49('0x24')](function(_0x55ad14){if(_0x55ad14){if(_0x432502['body'][_0x4c49('0x8d')]){_0x56c601[_0x4c49('0x2c')][_0x4c49('0x8e')]=util['format'](_0x4c49('0x8f'),_0x432502[_0x4c49('0x73')][_0x4c49('0x8a')]);_0x56c601['message'][_0x4c49('0x90')]=_0x56c601['channel'];_0x56c601[_0x4c49('0x2c')][_0x4c49('0x91')]=_0x4c49('0x7f');return respondWithRpcPromise('EventManager',_0x4c49('0x92'),{'event':_0x4c49('0x93'),'message':_0x56c601[_0x4c49('0x2c')]},client9002)['then'](function(){return _0x56c601;});}return _0x56c601;}return null;})['then'](respondWithResult(_0x7dbb90,null))[_0x4c49('0x2f')](handleError(_0x7dbb90,null));};var interaction_log=require(_0x4c49('0x7e'))(_0x4c49('0x94'));exports[_0x4c49('0x39')]=function(_0x261b76,_0x5624e4,_0x4681d7){var _0x3987ce={'agent':{},'channel':_0x4c49('0x95')};if(_0x261b76[_0x4c49('0x41')]['id']){delete _0x261b76[_0x4c49('0x41')]['id'];}_0x261b76[_0x4c49('0x41')][_0x4c49('0x82')]=_0x261b76['body'][_0x4c49('0x82')]||_0x261b76[_0x4c49('0x73')]['id'];_0x3987ce[_0x4c49('0x83')]['id']=_0x261b76[_0x4c49('0x41')][_0x4c49('0x82')];return db['MailMessage']['find']({'where':{'id':_0x261b76[_0x4c49('0x5c')]['id'],'UserId':null}})[_0x4c49('0x24')](handleEntityNotFound(_0x5624e4,null))[_0x4c49('0x24')](function(_0x48c48a){if(_0x48c48a){_0x3987ce['message']=_0x48c48a[_0x4c49('0x88')]({'plain':!![]});return db[_0x4c49('0x85')][_0x4c49('0x5e')]({'where':{'id':_0x48c48a[_0x4c49('0x86')]}});}return null;})[_0x4c49('0x24')](handleEntityNotFound(_0x5624e4,null))[_0x4c49('0x24')](function(_0x5c662a){if(_0x5c662a){_0x3987ce['interaction']=_0x5c662a[_0x4c49('0x88')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x261b76[_0x4c49('0x73')]['id'],_0x261b76[_0x4c49('0x73')][_0x4c49('0x8a')],_0x261b76['user'][_0x4c49('0x8b')],_0x3987ce['interaction']['id'],_0x261b76[_0x4c49('0x41')]?JSON[_0x4c49('0x29')](_0x261b76[_0x4c49('0x41')]):_0x4c49('0x8c'));return respondWithRpcPromise(_0x4c49('0x96'),_0x4c49('0x97'),_0x3987ce);}return null;})[_0x4c49('0x24')](function(_0x1eebee){if(_0x1eebee){_0x1eebee[_0x4c49('0x2c')][_0x4c49('0x8e')]=util[_0x4c49('0x7c')](_0x4c49('0x8f'),_0x261b76[_0x4c49('0x73')]['name']);_0x1eebee[_0x4c49('0x2c')][_0x4c49('0x90')]=_0x3987ce[_0x4c49('0x90')];_0x1eebee[_0x4c49('0x2c')][_0x4c49('0x91')]=_0x4c49('0x39');respondWithRpcPromise(_0x4c49('0x92'),'EventManager',{'event':_0x4c49('0x98'),'message':_0x1eebee[_0x4c49('0x2c')]},client9002);return _0x3987ce;}return null;})[_0x4c49('0x24')](respondWithResult(_0x5624e4,null))[_0x4c49('0x2f')](handleError(_0x5624e4,null));};exports[_0x4c49('0x99')]=function(_0x2f2a2b,_0x480f40){var _0x4ac715=moment()[_0x4c49('0x9a')]()[_0x4c49('0x9b')]();var _0x4810a1=path[_0x4c49('0x77')](config[_0x4c49('0x9c')],_0x4c49('0x9d'),_0x4c49('0x9e'),_0x4c49('0x9f'));var _0x57b52d=path[_0x4c49('0x77')](config[_0x4c49('0x9c')],_0x4c49('0x9d'),_0x4c49('0x9e'),_0x4c49('0x76'));var _0x2823d1=util[_0x4c49('0x7c')](_0x4c49('0xa0'),_0x4ac715);return db[_0x4c49('0x57')][_0x4c49('0x5e')]({'where':{'id':_0x2f2a2b['params']['id']},'attributes':['id','body','from','to','cc',_0x4c49('0xa1'),_0x4c49('0xa2'),_0x4c49('0xa3')],'include':_0x2f2a2b[_0x4c49('0x49')][_0x4c49('0x76')]?[{'model':db['Attachment'],'as':_0x4c49('0xa4')}]:undefined})[_0x4c49('0x24')](handleEntityNotFound(_0x480f40,null))[_0x4c49('0x24')](function(_0xd98d35){if(_0xd98d35){var _0x2ba796=_0xd98d35;var _0x26270f={'from':_0x2ba796[_0x4c49('0xa5')],'to':_0x2ba796['to'],'subject':_0x2ba796[_0x4c49('0xa2')],'html':_0x2ba796['body'],'headers':{'Date':moment(_0x2ba796[_0x4c49('0xa3')])[_0x4c49('0x7c')](_0x4c49('0xa6'))},'attachments':[]};if(_0xd98d35['cc']){_0x26270f[_0x4c49('0xa7')]['Cc']=_0xd98d35['cc'];}if(_0xd98d35[_0x4c49('0xa1')]){_0x26270f[_0x4c49('0xa7')]['Bcc']=_0xd98d35[_0x4c49('0xa1')];}return new BPromise(function(_0x5959f6,_0x469fb7){if(_0xd98d35[_0x4c49('0xa4')]){for(var _0x23c8f3=0x0;_0x23c8f3<_0xd98d35[_0x4c49('0xa4')]['length'];_0x23c8f3++){var _0x36df0b=_0xd98d35[_0x4c49('0xa4')][_0x23c8f3];var _0x108c5d=path[_0x4c49('0x77')](_0x57b52d,_0x36df0b[_0x4c49('0x79')]);if(fs[_0x4c49('0xa8')](_0x108c5d)){_0x26270f[_0x4c49('0x76')][_0x4c49('0xa9')]({'name':_0x36df0b[_0x4c49('0x8a')],'contentType':_0x36df0b[_0x4c49('0x47')],'data':fs['readFileSync'](_0x108c5d)});}}}emlformat[_0x4c49('0xaa')](_0x26270f,function(_0x234ce4,_0x147363){if(_0x234ce4)return _0x469fb7(_0x234ce4);fs[_0x4c49('0xab')](path[_0x4c49('0x77')](_0x4810a1,_0x2823d1),_0x147363);return _0x5959f6(_0x147363);});});}})[_0x4c49('0x24')](function(_0x51c6a8){if(_0x51c6a8){return _0x480f40[_0x4c49('0x99')](path[_0x4c49('0x77')](_0x4810a1,_0x2823d1),_0x2823d1,function(_0x2c2fca){if(_0x2c2fca){console[_0x4c49('0xac')]('err',_0x2c2fca);}else{fs['unlinkSync'](path[_0x4c49('0x77')](_0x4810a1,_0x2823d1));}});}})[_0x4c49('0x2f')](handleError(_0x480f40,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index fac24f3..a447e94 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 _0xaad0=['hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','remove','emit'];(function(_0x46451c,_0x88ddd){var _0x12dce4=function(_0x2e4087){while(--_0x2e4087){_0x46451c['push'](_0x46451c['shift']());}};_0x12dce4(++_0x88ddd);}(_0xaad0,0x1df));var _0x0aad=function(_0x5e6b72,_0x1c3770){_0x5e6b72=_0x5e6b72-0x0;var _0xf76b50=_0xaad0[_0x5e6b72];return _0xf76b50;};'use strict';var EventEmitter=require(_0x0aad('0x0'));var MailMessage=require(_0x0aad('0x1'))['db'][_0x0aad('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x0aad('0x3')](0x0);var events={'afterCreate':_0x0aad('0x4'),'afterUpdate':'update','afterDestroy':_0x0aad('0x5')};function emitEvent(_0x34624a){return function(_0x3dfa53,_0x1a072e,_0x4f7a40){MailMessageEvents[_0x0aad('0x6')](_0x34624a+':'+_0x3dfa53['id'],_0x3dfa53);MailMessageEvents[_0x0aad('0x6')](_0x34624a,_0x3dfa53);_0x4f7a40(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x0aad('0x7')](e,emitEvent(event));}}module[_0x0aad('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x8913=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','save','update'];(function(_0x1d509c,_0x95dd8d){var _0x2c5933=function(_0x3525b6){while(--_0x3525b6){_0x1d509c['push'](_0x1d509c['shift']());}};_0x2c5933(++_0x95dd8d);}(_0x8913,0x9c));var _0x3891=function(_0x18e0fd,_0x4e1cb4){_0x18e0fd=_0x18e0fd-0x0;var _0x6ba47a=_0x8913[_0x18e0fd];return _0x6ba47a;};'use strict';var EventEmitter=require(_0x3891('0x0'));var MailMessage=require(_0x3891('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3891('0x2'),'afterUpdate':_0x3891('0x3'),'afterDestroy':_0x3891('0x4')};function emitEvent(_0x3234c9){return function(_0x2fa248,_0x172e10,_0x2ad7a4){MailMessageEvents[_0x3891('0x5')](_0x3234c9+':'+_0x2fa248['id'],_0x2fa248);MailMessageEvents[_0x3891('0x5')](_0x3234c9,_0x2fa248);_0x2ad7a4(null);};}for(var e in events){if(events[_0x3891('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x3891('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index e1928b5..910b54a 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 _0xfb75=['out','secret','isNil','MailInteraction','findOne','MailInteractionId','update','createdAt','catch','error','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','define','MailMessage','messageId','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xfb75,0x1cd));var _0x5fb7=function(_0x4fc827,_0x37d920){_0x4fc827=_0x4fc827-0x0;var _0x2c6bf9=_0xfb75[_0x4fc827];return _0x2c6bf9;};'use strict';var _=require('lodash');var util=require(_0x5fb7('0x0'));var logger=require(_0x5fb7('0x1'))('api');var moment=require(_0x5fb7('0x2'));var BPromise=require(_0x5fb7('0x3'));var rp=require(_0x5fb7('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x5fb7('0x5'));var rimraf=require('rimraf');var config=require(_0x5fb7('0x6'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x3b992b,_0x49ab59){return _0x3b992b[_0x5fb7('0x7')](_0x5fb7('0x8'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x5fb7('0x9'),'fields':['messageId']},{'name':'fti_mail_messages','fields':[_0x5fb7('0xa'),_0x5fb7('0xb')],'type':_0x5fb7('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2a26a9,_0x577593,_0x377042){if(_0x2a26a9[_0x5fb7('0xd')]){_0x2a26a9[_0x5fb7('0xa')]=htmlToText[_0x5fb7('0xe')](_0x2a26a9['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x377042(null,_0x577593);},'afterCreate':function(_0x3f95ac,_0x15f44d,_0x307d27){var _0x2293a7=_0x3b992b[_0x5fb7('0xf')];var _0x48e324=_0x3f95ac[_0x5fb7('0x10')]({'plain':!![]});if(_0x48e324[_0x5fb7('0x11')][_0x5fb7('0x12')]()==='in'||_0x48e324['direction'][_0x5fb7('0x12')]()===_0x5fb7('0x13')&&!_0x48e324[_0x5fb7('0x14')]&&!_[_0x5fb7('0x15')](_0x48e324['UserId'])){_0x2293a7[_0x5fb7('0x16')][_0x5fb7('0x17')]({'where':{'id':_0x48e324[_0x5fb7('0x18')]}})['then'](function(_0xc6f242){if(_0xc6f242){_0xc6f242[_0x5fb7('0x19')]({'lastMsgAt':_0x48e324[_0x5fb7('0x1a')],'lastMsgDirection':_0x48e324['direction']['toLowerCase']()});}})[_0x5fb7('0x1b')](function(_0x2da65f){console[_0x5fb7('0x1c')](_0x2da65f);});}_0x307d27();}},'charset':_0x5fb7('0x1d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x07b8=['define','MailMessage','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','get','direction','toLowerCase','secret','UserId','MailInteractionId','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x07b8,0x1d4));var _0x807b=function(_0x1c21cc,_0x322a71){_0x1c21cc=_0x1c21cc-0x0;var _0x7af1cb=_0x07b8[_0x1c21cc];return _0x7af1cb;};'use strict';var _=require(_0x807b('0x0'));var util=require(_0x807b('0x1'));var logger=require(_0x807b('0x2'))(_0x807b('0x3'));var moment=require(_0x807b('0x4'));var BPromise=require(_0x807b('0x5'));var rp=require(_0x807b('0x6'));var htmlToText=require(_0x807b('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0x807b('0x8'));var config=require(_0x807b('0x9'));var attributes=require(_0x807b('0xa'));module[_0x807b('0xb')]=function(_0x143485,_0x49dbe5){return _0x143485[_0x807b('0xc')](_0x807b('0xd'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x807b('0xe'),'fields':[_0x807b('0xe')]},{'name':_0x807b('0xf'),'fields':[_0x807b('0x10'),'subject'],'type':_0x807b('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x258248,_0x2160c7,_0x5aa1de){if(_0x258248[_0x807b('0x12')]){_0x258248[_0x807b('0x10')]=htmlToText[_0x807b('0x13')](_0x258248['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5aa1de(null,_0x2160c7);},'afterCreate':function(_0x5b969c,_0x1c439c,_0x595a17){var _0x40297f=_0x143485[_0x807b('0x14')];var _0x52a272=_0x5b969c[_0x807b('0x15')]({'plain':!![]});if(_0x52a272[_0x807b('0x16')][_0x807b('0x17')]()==='in'||_0x52a272['direction'][_0x807b('0x17')]()==='out'&&!_0x52a272[_0x807b('0x18')]&&!_['isNil'](_0x52a272[_0x807b('0x19')])){_0x40297f['MailInteraction']['findOne']({'where':{'id':_0x52a272[_0x807b('0x1a')]}})[_0x807b('0x1b')](function(_0x3aa8d5){if(_0x3aa8d5){_0x3aa8d5['update']({'lastMsgAt':_0x52a272[_0x807b('0x1c')],'lastMsgDirection':_0x52a272[_0x807b('0x16')][_0x807b('0x17')]()});}})['catch'](function(_0x12fd34){console[_0x807b('0x1d')](_0x12fd34);});}_0x595a17();}},'charset':_0x807b('0x1e'),'collate':_0x807b('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 4baf763..1b78dc9 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 _0x572a=['MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','CreateMailMessage','MailMessage','create','options','raw','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./mailMessage.socket','register','MailMessage,\x20%s,\x20%s','debug'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x572a,0x12f));var _0xa572=function(_0x3cc00a,_0x2b5d0b){_0x3cc00a=_0x3cc00a-0x0;var _0x3a62c6=_0x572a[_0x3cc00a];return _0x3a62c6;};'use strict';var _=require(_0xa572('0x0'));var util=require('util');var moment=require(_0xa572('0x1'));var BPromise=require(_0xa572('0x2'));var rs=require(_0xa572('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa572('0x4'))['db'];var utils=require(_0xa572('0x5'));var logger=require(_0xa572('0x6'))(_0xa572('0x7'));var config=require('../../config/environment');var jayson=require(_0xa572('0x8'));var client=jayson['client'][_0xa572('0x9')]({'port':0x232a});config[_0xa572('0xa')]=_['defaults'](config[_0xa572('0xa')],{'host':_0xa572('0xb'),'port':0x18eb});var socket=require(_0xa572('0xc'))(new Redis(config[_0xa572('0xa')]));require(_0xa572('0xd'))[_0xa572('0xe')](socket);function respondWithRpcPromise(_0x38f308,_0xef6b8d,_0x5d03d8){return new BPromise(function(_0x57cf7a,_0x4ec2df){return client['request'](_0x38f308,_0x5d03d8)['then'](function(_0x1a5816){logger['info'](_0xa572('0xf'),_0xef6b8d,'request\x20sent');logger[_0xa572('0x10')](_0xa572('0x11'),_0xef6b8d,_0xa572('0x12'),JSON[_0xa572('0x13')](_0x1a5816));if(_0x1a5816['error']){if(_0x1a5816['error'][_0xa572('0x14')]===0x1f4){logger[_0xa572('0x15')](_0xa572('0xf'),_0xef6b8d,_0x1a5816[_0xa572('0x15')]['message']);return _0x4ec2df(_0x1a5816[_0xa572('0x15')][_0xa572('0x16')]);}logger[_0xa572('0x15')]('MailMessage,\x20%s,\x20%s',_0xef6b8d,_0x1a5816[_0xa572('0x15')][_0xa572('0x16')]);return _0x57cf7a(_0x1a5816[_0xa572('0x15')][_0xa572('0x16')]);}else{logger[_0xa572('0x17')]('MailMessage,\x20%s,\x20%s',_0xef6b8d,_0xa572('0x12'));_0x57cf7a(_0x1a5816[_0xa572('0x18')][_0xa572('0x16')]);}})[_0xa572('0x19')](function(_0x8a9ef0){logger[_0xa572('0x15')](_0xa572('0xf'),_0xef6b8d,_0x8a9ef0);_0x4ec2df(_0x8a9ef0);});});}exports[_0xa572('0x1a')]=function(_0x4faeb4){var _0x23b65e=this;return new Promise(function(_0x2fe659,_0x4ec2e4){return db[_0xa572('0x1b')][_0xa572('0x1c')](_0x4faeb4['body'],{'raw':_0x4faeb4[_0xa572('0x1d')]?_0x4faeb4[_0xa572('0x1d')][_0xa572('0x1e')]===undefined?!![]:![]:!![]})[_0xa572('0x1f')](function(_0x523a79){logger[_0xa572('0x17')](_0xa572('0x1a'),_0x4faeb4);logger[_0xa572('0x10')](_0xa572('0x1a'),_0x4faeb4,JSON['stringify'](_0x523a79));_0x2fe659(_0x523a79);})['catch'](function(_0x24a798){logger[_0xa572('0x15')]('CreateMailMessage',_0x24a798[_0xa572('0x16')],_0x4faeb4);_0x4ec2e4(_0x23b65e[_0xa572('0x15')](0x1f4,_0x24a798['message']));});});}; \ No newline at end of file +var _0xdea1=['error','code','message','result','catch','MailMessage','create','body','raw','CreateMailMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xd8a5c5,_0x34222f){var _0x1ee77b=function(_0xa03e74){while(--_0xa03e74){_0xd8a5c5['push'](_0xd8a5c5['shift']());}};_0x1ee77b(++_0x34222f);}(_0xdea1,0x1f4));var _0x1dea=function(_0x19eea1,_0x30edd4){_0x19eea1=_0x19eea1-0x0;var _0x5679a2=_0xdea1[_0x19eea1];return _0x5679a2;};'use strict';var _=require(_0x1dea('0x0'));var util=require(_0x1dea('0x1'));var moment=require(_0x1dea('0x2'));var BPromise=require(_0x1dea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1dea('0x4'));var db=require(_0x1dea('0x5'))['db'];var utils=require(_0x1dea('0x6'));var logger=require(_0x1dea('0x7'))(_0x1dea('0x8'));var config=require('../../config/environment');var jayson=require(_0x1dea('0x9'));var client=jayson[_0x1dea('0xa')][_0x1dea('0xb')]({'port':0x232a});config[_0x1dea('0xc')]=_[_0x1dea('0xd')](config[_0x1dea('0xc')],{'host':_0x1dea('0xe'),'port':0x18eb});var socket=require(_0x1dea('0xf'))(new Redis(config[_0x1dea('0xc')]));require(_0x1dea('0x10'))[_0x1dea('0x11')](socket);function respondWithRpcPromise(_0xd9ee10,_0x1efefb,_0x5c2b88){return new BPromise(function(_0x3d49f0,_0x22a726){return client[_0x1dea('0x12')](_0xd9ee10,_0x5c2b88)[_0x1dea('0x13')](function(_0x47abf2){logger[_0x1dea('0x14')](_0x1dea('0x15'),_0x1efefb,_0x1dea('0x16'));logger['debug'](_0x1dea('0x17'),_0x1efefb,_0x1dea('0x16'),JSON[_0x1dea('0x18')](_0x47abf2));if(_0x47abf2[_0x1dea('0x19')]){if(_0x47abf2['error'][_0x1dea('0x1a')]===0x1f4){logger['error'](_0x1dea('0x15'),_0x1efefb,_0x47abf2[_0x1dea('0x19')][_0x1dea('0x1b')]);return _0x22a726(_0x47abf2[_0x1dea('0x19')][_0x1dea('0x1b')]);}logger[_0x1dea('0x19')](_0x1dea('0x15'),_0x1efefb,_0x47abf2[_0x1dea('0x19')][_0x1dea('0x1b')]);return _0x3d49f0(_0x47abf2['error'][_0x1dea('0x1b')]);}else{logger[_0x1dea('0x14')](_0x1dea('0x15'),_0x1efefb,_0x1dea('0x16'));_0x3d49f0(_0x47abf2[_0x1dea('0x1c')][_0x1dea('0x1b')]);}})[_0x1dea('0x1d')](function(_0x2d210f){logger[_0x1dea('0x19')](_0x1dea('0x15'),_0x1efefb,_0x2d210f);_0x22a726(_0x2d210f);});});}exports['CreateMailMessage']=function(_0x2c5865){var _0x3c5280=this;return new Promise(function(_0x1f6eb2,_0x1e3198){return db[_0x1dea('0x1e')][_0x1dea('0x1f')](_0x2c5865[_0x1dea('0x20')],{'raw':_0x2c5865['options']?_0x2c5865['options'][_0x1dea('0x21')]===undefined?!![]:![]:!![]})[_0x1dea('0x13')](function(_0x5ba09a){logger[_0x1dea('0x14')]('CreateMailMessage',_0x2c5865);logger['debug'](_0x1dea('0x22'),_0x2c5865,JSON['stringify'](_0x5ba09a));_0x1f6eb2(_0x5ba09a);})['catch'](function(_0x31292d){logger['error']('CreateMailMessage',_0x31292d[_0x1dea('0x1b')],_0x2c5865);_0x1e3198(_0x3c5280[_0x1dea('0x19')](0x1f4,_0x31292d[_0x1dea('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 64a40bd..decfe9a 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 _0x43e8=['save','remove','register','length','./mailMessage.events'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x43e8,0x81));var _0x843e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x43e8[_0x9df060];return _0x338dfe;};'use strict';var MailMessageEvents=require(_0x843e('0x0'));var events=[_0x843e('0x1'),_0x843e('0x2'),'update'];function createListener(_0x124ce4,_0xb0191){return function(_0x34e125){_0xb0191['emit'](_0x124ce4,_0x34e125);};}function removeListener(_0x1a3672,_0x30f45e){return function(){MailMessageEvents['removeListener'](_0x1a3672,_0x30f45e);};}exports[_0x843e('0x3')]=function(_0x22aa5e){for(var _0x1ca8b9=0x0,_0x45b392=events[_0x843e('0x4')];_0x1ca8b9<_0x45b392;_0x1ca8b9++){var _0x34ef30=events[_0x1ca8b9];var _0x3421a9=createListener('mailMessage:'+_0x34ef30,_0x22aa5e);MailMessageEvents['on'](_0x34ef30,_0x3421a9);}}; \ No newline at end of file +var _0xd6d2=['save','update','removeListener','length','mailMessage:','./mailMessage.events'];(function(_0x475eed,_0x1e1ffb){var _0x1e3e69=function(_0x46b201){while(--_0x46b201){_0x475eed['push'](_0x475eed['shift']());}};_0x1e3e69(++_0x1e1ffb);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x3dc443,_0x473b37){_0x3dc443=_0x3dc443-0x0;var _0x30ce0c=_0xd6d2[_0x3dc443];return _0x30ce0c;};'use strict';var MailMessageEvents=require(_0x2d6d('0x0'));var events=[_0x2d6d('0x1'),'remove',_0x2d6d('0x2')];function createListener(_0x224caa,_0x5b4a5b){return function(_0x2c2dd9){_0x5b4a5b['emit'](_0x224caa,_0x2c2dd9);};}function removeListener(_0x1c5e54,_0x3ee519){return function(){MailMessageEvents[_0x2d6d('0x3')](_0x1c5e54,_0x3ee519);};}exports['register']=function(_0xfcdb1d){for(var _0x132361=0x0,_0xf59b20=events[_0x2d6d('0x4')];_0x132361<_0xf59b20;_0x132361++){var _0x4002b7=events[_0x132361];var _0x42d802=createListener(_0x2d6d('0x5')+_0x4002b7,_0xfcdb1d);MailMessageEvents['on'](_0x4002b7,_0x42d802);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index d854747..82a6716 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 _0x41aa=['./mailQueue.controller','get','isAuthenticated','index','describe','show','/:id/teams','/:id/users','post','create','addTeams','addAgents','put','/:id','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x249192,_0x38beb8){var _0x1ad6bb=function(_0x1c8ee7){while(--_0x1c8ee7){_0x249192['push'](_0x249192['shift']());}};_0x1ad6bb(++_0x38beb8);}(_0x41aa,0xbb));var _0xa41a=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x41aa[_0xb833b1];return _0x1ab87a;};'use strict';var multer=require(_0xa41a('0x0'));var util=require(_0xa41a('0x1'));var path=require(_0xa41a('0x2'));var timeout=require(_0xa41a('0x3'));var express=require(_0xa41a('0x4'));var router=express[_0xa41a('0x5')]();var fs_extra=require(_0xa41a('0x6'));var auth=require(_0xa41a('0x7'));var interaction=require(_0xa41a('0x8'));var config=require('../../config/environment');var controller=require(_0xa41a('0x9'));router[_0xa41a('0xa')]('/',auth[_0xa41a('0xb')](),controller[_0xa41a('0xc')]);router['get']('/describe',auth[_0xa41a('0xb')](),controller[_0xa41a('0xd')]);router[_0xa41a('0xa')]('/:id',auth[_0xa41a('0xb')](),controller[_0xa41a('0xe')]);router[_0xa41a('0xa')]('/:id/members',auth[_0xa41a('0xb')](),controller['getMembers']);router[_0xa41a('0xa')](_0xa41a('0xf'),auth[_0xa41a('0xb')](),controller['getTeams']);router[_0xa41a('0xa')](_0xa41a('0x10'),auth[_0xa41a('0xb')](),controller['getAgents']);router[_0xa41a('0x11')]('/',auth[_0xa41a('0xb')](),controller[_0xa41a('0x12')]);router[_0xa41a('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0xa41a('0x13')]);router[_0xa41a('0x11')](_0xa41a('0x10'),auth[_0xa41a('0xb')](),controller[_0xa41a('0x14')]);router[_0xa41a('0x15')](_0xa41a('0x16'),auth[_0xa41a('0xb')](),controller[_0xa41a('0x17')]);router[_0xa41a('0x18')](_0xa41a('0x16'),auth[_0xa41a('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xa41a('0xb')](),controller[_0xa41a('0x19')]);router[_0xa41a('0x18')](_0xa41a('0x10'),auth[_0xa41a('0xb')](),controller[_0xa41a('0x1a')]);module[_0xa41a('0x1b')]=router; \ No newline at end of file +var _0x556e=['path','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','update','delete','removeTeams','multer'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x556e,0x1af));var _0xe556=function(_0x5f150e,_0x5e3a1e){_0x5f150e=_0x5f150e-0x0;var _0x2f6957=_0x556e[_0x5f150e];return _0x2f6957;};'use strict';var multer=require(_0xe556('0x0'));var util=require('util');var path=require(_0xe556('0x1'));var timeout=require('connect-timeout');var express=require(_0xe556('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe556('0x3'));var config=require(_0xe556('0x4'));var controller=require('./mailQueue.controller');router[_0xe556('0x5')]('/',auth[_0xe556('0x6')](),controller[_0xe556('0x7')]);router[_0xe556('0x5')](_0xe556('0x8'),auth[_0xe556('0x6')](),controller[_0xe556('0x9')]);router['get'](_0xe556('0xa'),auth[_0xe556('0x6')](),controller[_0xe556('0xb')]);router[_0xe556('0x5')](_0xe556('0xc'),auth[_0xe556('0x6')](),controller[_0xe556('0xd')]);router['get'](_0xe556('0xe'),auth[_0xe556('0x6')](),controller[_0xe556('0xf')]);router['get'](_0xe556('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe556('0x11')]('/',auth[_0xe556('0x6')](),controller[_0xe556('0x12')]);router[_0xe556('0x11')](_0xe556('0xe'),auth[_0xe556('0x6')](),controller[_0xe556('0x13')]);router[_0xe556('0x11')](_0xe556('0x10'),auth[_0xe556('0x6')](),controller[_0xe556('0x14')]);router['put'](_0xe556('0xa'),auth[_0xe556('0x6')](),controller[_0xe556('0x15')]);router[_0xe556('0x16')](_0xe556('0xa'),auth[_0xe556('0x6')](),controller['destroy']);router[_0xe556('0x16')](_0xe556('0xe'),auth[_0xe556('0x6')](),controller[_0xe556('0x17')]);router[_0xe556('0x16')]('/:id/users',auth[_0xe556('0x6')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 6677759..cbcfc8d 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 _0x4b08=['exports','STRING','name','ENUM','beepall','sequelize'];(function(_0xa3463d,_0x32f8da){var _0x50fd67=function(_0xb984fd){while(--_0xb984fd){_0xa3463d['push'](_0xa3463d['shift']());}};_0x50fd67(++_0x32f8da);}(_0x4b08,0x179));var _0x84b0=function(_0x2ba5d4,_0x4df82d){_0x2ba5d4=_0x2ba5d4-0x0;var _0xb7b029=_0x4b08[_0x2ba5d4];return _0xb7b029;};'use strict';var Sequelize=require(_0x84b0('0x0'));module[_0x84b0('0x1')]={'name':{'type':Sequelize[_0x84b0('0x2')],'unique':_0x84b0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x84b0('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x84b0('0x4')]('rrmemory',_0x84b0('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x9ee6=['INTEGER','ENUM','beepall','roundrobin','sequelize','exports','name','STRING'];(function(_0x21be1a,_0x598997){var _0x2f2ab5=function(_0x3be34b){while(--_0x3be34b){_0x21be1a['push'](_0x21be1a['shift']());}};_0x2f2ab5(++_0x598997);}(_0x9ee6,0x84));var _0x69ee=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0x9ee6[_0x5550b3];return _0x4b8fc4;};'use strict';var Sequelize=require(_0x69ee('0x0'));module[_0x69ee('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x69ee('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x69ee('0x3')]},'timeout':{'type':Sequelize[_0x69ee('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x69ee('0x5')]('rrmemory',_0x69ee('0x6'),_0x69ee('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 92f9e4d..1c60d88 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 _0xbcd1=['UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','User','online','voicePause','Agents','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?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','TeamId','includes','union','compact','value','ids','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','destroy','then','get','UserProfileResource','sendStatus','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','MailQueue','rawAttributes','type','key','model','query','keys','filters','fields','length','attributes','nolimit','where','filter','VIRTUAL','options','includeAll','include','rows','catch','show','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','order','sort','pick','MailQueueId','findAll','findAndCountAll'];(function(_0xcb4257,_0x211437){var _0x34ade1=function(_0xfb6553){while(--_0xfb6553){_0xcb4257['push'](_0xcb4257['shift']());}};_0x34ade1(++_0x211437);}(_0xbcd1,0x1ed));var _0x1bcd=function(_0x5d6105,_0x1f5ca9){_0x5d6105=_0x5d6105-0x0;var _0x15f36e=_0xbcd1[_0x5d6105];return _0x15f36e;};'use strict';var emlformat=require(_0x1bcd('0x0'));var rimraf=require(_0x1bcd('0x1'));var zipdir=require(_0x1bcd('0x2'));var jsonpatch=require(_0x1bcd('0x3'));var rp=require(_0x1bcd('0x4'));var moment=require(_0x1bcd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1bcd('0x6'));var util=require(_0x1bcd('0x7'));var path=require('path');var sox=require(_0x1bcd('0x8'));var csv=require(_0x1bcd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1bcd('0xa'));var _=require(_0x1bcd('0xb'));var squel=require(_0x1bcd('0xc'));var crypto=require(_0x1bcd('0xd'));var jsforce=require(_0x1bcd('0xe'));var deskjs=require(_0x1bcd('0xf'));var toCsv=require(_0x1bcd('0x9'));var querystring=require(_0x1bcd('0x10'));var Papa=require(_0x1bcd('0x11'));var Redis=require('ioredis');var authService=require(_0x1bcd('0x12'));var qs=require(_0x1bcd('0x13'));var as=require(_0x1bcd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1bcd('0x15'));var utils=require('../../config/utils');var config=require(_0x1bcd('0x16'));var licenseUtil=require(_0x1bcd('0x17'));var db=require(_0x1bcd('0x18'))['db'];config[_0x1bcd('0x19')]=_['defaults'](config[_0x1bcd('0x19')],{'host':_0x1bcd('0x1a'),'port':0x18eb});var socket=require(_0x1bcd('0x1b'))(new Redis(config['redis']));require(_0x1bcd('0x1c'))['register'](socket);function respondWithStatusCode(_0x335ae5,_0x1ad46e){_0x1ad46e=_0x1ad46e||0xcc;return function(_0xd722a){if(_0xd722a){return _0x335ae5['sendStatus'](_0x1ad46e);}return _0x335ae5[_0x1bcd('0x1d')](_0x1ad46e)[_0x1bcd('0x1e')]();};}function respondWithResult(_0xfca515,_0xbf7d90){_0xbf7d90=_0xbf7d90||0xc8;return function(_0x1d0c55){if(_0x1d0c55){return _0xfca515[_0x1bcd('0x1d')](_0xbf7d90)[_0x1bcd('0x1f')](_0x1d0c55);}};}function respondWithFilteredResult(_0x657b3c,_0x56f0a3){return function(_0x1faf1b){if(_0x1faf1b){var _0x24aad1=typeof _0x56f0a3[_0x1bcd('0x20')]===_0x1bcd('0x21')&&typeof _0x56f0a3[_0x1bcd('0x22')]===_0x1bcd('0x21');var _0x5b1faa=_0x1faf1b[_0x1bcd('0x23')];var _0x24137d=_0x24aad1?0x0:_0x56f0a3[_0x1bcd('0x20')];var _0x2db443=_0x24aad1?_0x1faf1b[_0x1bcd('0x23')]:_0x56f0a3[_0x1bcd('0x20')]+_0x56f0a3[_0x1bcd('0x22')];var _0x5d523a;if(_0x2db443>=_0x5b1faa){_0x2db443=_0x5b1faa;_0x5d523a=0xc8;}else{_0x5d523a=0xce;}_0x657b3c[_0x1bcd('0x1d')](_0x5d523a);return _0x657b3c['set'](_0x1bcd('0x24'),_0x24137d+'-'+_0x2db443+'/'+_0x5b1faa)[_0x1bcd('0x1f')](_0x1faf1b);}return null;};}function patchUpdates(_0x15a09d){return function(_0x1f10d5){try{jsonpatch[_0x1bcd('0x25')](_0x1f10d5,_0x15a09d,!![]);}catch(_0x18e6ca){return BPromise['reject'](_0x18e6ca);}return _0x1f10d5[_0x1bcd('0x26')]();};}function saveUpdates(_0x4b8d80,_0xc6867a){return function(_0x2da26f){if(_0x2da26f){return _0x2da26f['update'](_0x4b8d80)['then'](function(_0x30ee08){return _0x30ee08;});}return null;};}function removeEntity(_0x5411f2,_0x379336){return function(_0x11410c){if(_0x11410c){return _0x11410c[_0x1bcd('0x27')]()[_0x1bcd('0x28')](function(){var _0x242fe4=_0x11410c[_0x1bcd('0x29')]({'plain':!![]});var _0x135211='MailQueues';return db[_0x1bcd('0x2a')][_0x1bcd('0x27')]({'where':{'type':_0x135211,'resourceId':_0x242fe4['id']}})[_0x1bcd('0x28')](function(){return _0x11410c;});})['then'](function(){_0x5411f2[_0x1bcd('0x1d')](0xcc)[_0x1bcd('0x1e')]();});}};}function handleEntityNotFound(_0x46a2b3,_0x5c3777){return function(_0xa64563){if(!_0xa64563){_0x46a2b3[_0x1bcd('0x2b')](0x194);}return _0xa64563;};}function handleError(_0x4d9ccd,_0x13a6aa){_0x13a6aa=_0x13a6aa||0x1f4;return function(_0x2713e0){logger['error'](_0x2713e0[_0x1bcd('0x2c')]);if(_0x2713e0[_0x1bcd('0x2d')]){delete _0x2713e0['name'];}_0x4d9ccd[_0x1bcd('0x1d')](_0x13a6aa)[_0x1bcd('0x2e')](_0x2713e0);};}function getMustacheRender(_0x119346,_0xc2fa76){return Mustache[_0x1bcd('0x2f')](_0x119346,_[_0x1bcd('0x30')](_0xc2fa76[_0x1bcd('0x31')],{'contact':_0xc2fa76[_0x1bcd('0x32')],'message':_0xc2fa76[_0x1bcd('0x33')],'agent':_0xc2fa76[_0x1bcd('0x34')],'interaction':_0xc2fa76[_0x1bcd('0x35')],'account':_0xc2fa76[_0x1bcd('0x36')]}))||'';}exports[_0x1bcd('0x37')]=function(_0x83d0cb,_0xa6f021){var _0x8a8e04={},_0x28f1bf={},_0x48c0ea={'count':0x0,'rows':[]};var _0xa5c78d=_[_0x1bcd('0x38')](db[_0x1bcd('0x39')][_0x1bcd('0x3a')],function(_0x59d35d){return{'name':_0x59d35d['fieldName'],'type':_0x59d35d[_0x1bcd('0x3b')][_0x1bcd('0x3c')]};});_0x28f1bf[_0x1bcd('0x3d')]=_['map'](_0xa5c78d,_0x1bcd('0x2d'));_0x28f1bf[_0x1bcd('0x3e')]=_[_0x1bcd('0x3f')](_0x83d0cb[_0x1bcd('0x3e')]);_0x28f1bf[_0x1bcd('0x40')]=_['intersection'](_0x28f1bf[_0x1bcd('0x3d')],_0x28f1bf['query']);_0x8a8e04['attributes']=_['intersection'](_0x28f1bf[_0x1bcd('0x3d')],qs[_0x1bcd('0x41')](_0x83d0cb[_0x1bcd('0x3e')]['fields']));_0x8a8e04['attributes']=_0x8a8e04['attributes'][_0x1bcd('0x42')]?_0x8a8e04[_0x1bcd('0x43')]:_0x28f1bf[_0x1bcd('0x3d')];if(!_0x83d0cb[_0x1bcd('0x3e')]['hasOwnProperty'](_0x1bcd('0x44'))){_0x8a8e04[_0x1bcd('0x22')]=qs['limit'](_0x83d0cb[_0x1bcd('0x3e')]['limit']);_0x8a8e04[_0x1bcd('0x20')]=qs[_0x1bcd('0x20')](_0x83d0cb[_0x1bcd('0x3e')][_0x1bcd('0x20')]);}_0x8a8e04['order']=qs['sort'](_0x83d0cb[_0x1bcd('0x3e')]['sort']);_0x8a8e04[_0x1bcd('0x45')]=qs[_0x1bcd('0x40')](_['pick'](_0x83d0cb['query'],_0x28f1bf[_0x1bcd('0x40')]),_0xa5c78d);if(_0x83d0cb[_0x1bcd('0x3e')][_0x1bcd('0x46')]){_0x8a8e04[_0x1bcd('0x45')]=_['merge'](_0x8a8e04[_0x1bcd('0x45')],{'$or':_[_0x1bcd('0x38')](_0xa5c78d,function(_0x5eb599){if(_0x5eb599[_0x1bcd('0x3b')]!==_0x1bcd('0x47')){var _0x25c82b={};_0x25c82b[_0x5eb599[_0x1bcd('0x2d')]]={'$like':'%'+_0x83d0cb[_0x1bcd('0x3e')][_0x1bcd('0x46')]+'%'};return _0x25c82b;}})});}_0x8a8e04=_[_0x1bcd('0x30')]({},_0x8a8e04,_0x83d0cb[_0x1bcd('0x48')]);var _0x488af3={'where':_0x8a8e04[_0x1bcd('0x45')]};return db['MailQueue'][_0x1bcd('0x23')](_0x488af3)[_0x1bcd('0x28')](function(_0x364e6a){_0x48c0ea['count']=_0x364e6a;if(_0x83d0cb[_0x1bcd('0x3e')][_0x1bcd('0x49')]){_0x8a8e04[_0x1bcd('0x4a')]=[{'all':!![]}];}return db[_0x1bcd('0x39')]['findAll'](_0x8a8e04);})[_0x1bcd('0x28')](function(_0x5d7f9f){_0x48c0ea[_0x1bcd('0x4b')]=_0x5d7f9f;return _0x48c0ea;})[_0x1bcd('0x28')](respondWithFilteredResult(_0xa6f021,_0x8a8e04))[_0x1bcd('0x4c')](handleError(_0xa6f021,null));};exports[_0x1bcd('0x4d')]=function(_0x408571,_0x2c0612){var _0x17676f={'raw':!![],'where':{'id':_0x408571['params']['id']}},_0x5e1818={};_0x5e1818[_0x1bcd('0x3d')]=_[_0x1bcd('0x3f')](db[_0x1bcd('0x39')][_0x1bcd('0x3a')]);_0x5e1818[_0x1bcd('0x3e')]=_[_0x1bcd('0x3f')](_0x408571[_0x1bcd('0x3e')]);_0x5e1818[_0x1bcd('0x40')]=_[_0x1bcd('0x4e')](_0x5e1818[_0x1bcd('0x3d')],_0x5e1818[_0x1bcd('0x3e')]);_0x17676f[_0x1bcd('0x43')]=_[_0x1bcd('0x4e')](_0x5e1818[_0x1bcd('0x3d')],qs[_0x1bcd('0x41')](_0x408571[_0x1bcd('0x3e')]['fields']));_0x17676f[_0x1bcd('0x43')]=_0x17676f[_0x1bcd('0x43')][_0x1bcd('0x42')]?_0x17676f['attributes']:_0x5e1818['model'];if(_0x408571[_0x1bcd('0x3e')][_0x1bcd('0x49')]){_0x17676f['include']=[{'all':!![]}];}_0x17676f=_[_0x1bcd('0x30')]({},_0x17676f,_0x408571[_0x1bcd('0x48')]);return db[_0x1bcd('0x39')][_0x1bcd('0x4f')](_0x17676f)[_0x1bcd('0x28')](handleEntityNotFound(_0x2c0612,null))[_0x1bcd('0x28')](respondWithResult(_0x2c0612,null))['catch'](handleError(_0x2c0612,null));};exports[_0x1bcd('0x50')]=function(_0x2c92a0,_0x287f54){return db[_0x1bcd('0x39')][_0x1bcd('0x50')](_0x2c92a0[_0x1bcd('0x31')],{})[_0x1bcd('0x28')](function(_0x32999b){var _0x4dfd34=_0x2c92a0[_0x1bcd('0x51')][_0x1bcd('0x29')]({'plain':!![]});if(!_0x4dfd34)throw new Error(_0x1bcd('0x52'));if(_0x4dfd34[_0x1bcd('0x53')]==='user'){var _0x1ec73c=_0x32999b[_0x1bcd('0x29')]({'plain':!![]});var _0x6d1187=_0x1bcd('0x54');return db[_0x1bcd('0x55')][_0x1bcd('0x4f')]({'where':{'name':_0x6d1187,'userProfileId':_0x4dfd34[_0x1bcd('0x56')]},'raw':!![]})[_0x1bcd('0x28')](function(_0x14b9a7){if(_0x14b9a7&&_0x14b9a7[_0x1bcd('0x57')]===0x0){return db['UserProfileResource'][_0x1bcd('0x50')]({'name':_0x1ec73c[_0x1bcd('0x2d')],'resourceId':_0x1ec73c['id'],'type':_0x14b9a7[_0x1bcd('0x2d')],'sectionId':_0x14b9a7['id']},{})['then'](function(){return _0x32999b;});}else{return _0x32999b;}})[_0x1bcd('0x4c')](function(_0x11f8b1){logger[_0x1bcd('0x58')](_0x1bcd('0x59'),_0x11f8b1);throw _0x11f8b1;});}return _0x32999b;})[_0x1bcd('0x28')](respondWithResult(_0x287f54,0xc9))[_0x1bcd('0x4c')](handleError(_0x287f54,null));};exports[_0x1bcd('0x5a')]=function(_0x5bcebc,_0x3128ea){if(_0x5bcebc[_0x1bcd('0x31')]['id']){delete _0x5bcebc[_0x1bcd('0x31')]['id'];}return db[_0x1bcd('0x39')][_0x1bcd('0x4f')]({'where':{'id':_0x5bcebc[_0x1bcd('0x5b')]['id']}})[_0x1bcd('0x28')](handleEntityNotFound(_0x3128ea,null))[_0x1bcd('0x28')](saveUpdates(_0x5bcebc[_0x1bcd('0x31')],null))[_0x1bcd('0x28')](respondWithResult(_0x3128ea,null))[_0x1bcd('0x4c')](handleError(_0x3128ea,null));};exports['destroy']=function(_0x54a250,_0x30d4b5){return db['MailQueue'][_0x1bcd('0x4f')]({'where':{'id':_0x54a250[_0x1bcd('0x5b')]['id']}})[_0x1bcd('0x28')](handleEntityNotFound(_0x30d4b5,null))[_0x1bcd('0x28')](removeEntity(_0x30d4b5,null))[_0x1bcd('0x4c')](handleError(_0x30d4b5,null));};exports[_0x1bcd('0x5c')]=function(_0x8feabd,_0x48aafc){return db[_0x1bcd('0x39')][_0x1bcd('0x5c')]()[_0x1bcd('0x28')](respondWithResult(_0x48aafc,null))[_0x1bcd('0x4c')](handleError(_0x48aafc,null));};exports[_0x1bcd('0x5d')]=function(_0x458848,_0x1ebee4,_0x4b1cef){var _0x31ab10={'raw':!![],'where':{}},_0x13cc2a={},_0x269324;return db[_0x1bcd('0x39')][_0x1bcd('0x5e')]({'where':{'id':_0x458848[_0x1bcd('0x5b')]['id']}})[_0x1bcd('0x28')](handleEntityNotFound(_0x1ebee4,null))[_0x1bcd('0x28')](function(_0x5bfb01){if(_0x5bfb01){_0x269324=_0x5bfb01[_0x1bcd('0x29')]({'plain':!![]});_0x13cc2a[_0x1bcd('0x3d')]=_['keys'](db[_0x1bcd('0x5f')][_0x1bcd('0x3a')]);_0x13cc2a[_0x1bcd('0x3e')]=_[_0x1bcd('0x3f')](_0x458848[_0x1bcd('0x3e')]);_0x13cc2a['filters']=_[_0x1bcd('0x4e')](_0x13cc2a[_0x1bcd('0x3d')],_0x13cc2a['query']);_0x31ab10[_0x1bcd('0x43')]=_[_0x1bcd('0x4e')](_0x13cc2a['model'],qs[_0x1bcd('0x41')](_0x458848[_0x1bcd('0x3e')]['fields']));_0x31ab10[_0x1bcd('0x43')]=_0x31ab10[_0x1bcd('0x43')][_0x1bcd('0x42')]?_0x31ab10[_0x1bcd('0x43')]:_0x13cc2a[_0x1bcd('0x3d')];if(!_0x458848[_0x1bcd('0x3e')][_0x1bcd('0x60')](_0x1bcd('0x44'))){_0x31ab10[_0x1bcd('0x22')]=qs['limit'](_0x458848['query'][_0x1bcd('0x22')]);_0x31ab10[_0x1bcd('0x20')]=qs[_0x1bcd('0x20')](_0x458848[_0x1bcd('0x3e')]['offset']);}_0x31ab10[_0x1bcd('0x61')]=qs[_0x1bcd('0x62')](_0x458848['query'][_0x1bcd('0x62')]);_0x31ab10[_0x1bcd('0x45')]=qs['filters'](_[_0x1bcd('0x63')](_0x458848[_0x1bcd('0x3e')],_0x13cc2a[_0x1bcd('0x40')]));_0x31ab10[_0x1bcd('0x45')][_0x1bcd('0x64')]=_0x5bfb01['id'];if(_0x458848[_0x1bcd('0x3e')][_0x1bcd('0x46')]){_0x31ab10['where']=_[_0x1bcd('0x30')](_0x31ab10[_0x1bcd('0x45')],{'$or':_['map'](_0x31ab10[_0x1bcd('0x43')],function(_0x149490){var _0x1ffadb={};_0x1ffadb[_0x149490]={'$like':'%'+_0x458848['query']['filter']+'%'};return _0x1ffadb;})});}_0x31ab10=_['merge']({},_0x31ab10,_0x458848['options']);return db[_0x1bcd('0x5f')][_0x1bcd('0x65')](_0x31ab10);}})[_0x1bcd('0x28')](function(_0x4b20e7){if(_0x4b20e7){return db['User'][_0x1bcd('0x66')]({'where':{'id':_[_0x1bcd('0x38')](_0x4b20e7,_0x1bcd('0x67')),'role':_0x1bcd('0x34')},'attributes':['id',_0x1bcd('0x2d'),_0x1bcd('0x68'),_0x1bcd('0x69'),_0x1bcd('0x6a')]});}})[_0x1bcd('0x28')](function(_0x33eea6){if(_0x33eea6){return{'count':_0x33eea6[_0x1bcd('0x23')],'rows':_[_0x1bcd('0x38')](_0x33eea6[_0x1bcd('0x4b')],function(_0x1418b6){return{'membername':_0x1418b6['name'],'UserId':_0x1418b6['id'],'queue_name':_0x269324[_0x1bcd('0x2d')],'MailQueueId':_0x269324['id'],'interface':util[_0x1bcd('0x6b')](_0x1bcd('0x6c'),_0x1bcd('0x6d'),_0x1418b6['name']),'penalty':0x0,'paused':_0x1418b6[_0x1bcd('0x68')],'createdAt':_0x1418b6['createdAt'],'updatedAt':_0x1418b6[_0x1bcd('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1bcd('0x28')](respondWithFilteredResult(_0x1ebee4,_0x31ab10))[_0x1bcd('0x4c')](handleError(_0x1ebee4,null));};exports['getTeams']=function(_0x571d43,_0x1bf45b,_0xeccf80){var _0x57a682={};var _0x3a5071={};var _0xf6413f;var _0x33ff0f;return db['MailQueue'][_0x1bcd('0x5e')]({'where':{'id':_0x571d43[_0x1bcd('0x5b')]['id']}})[_0x1bcd('0x28')](handleEntityNotFound(_0x1bf45b,null))[_0x1bcd('0x28')](function(_0x59b16c){if(_0x59b16c){_0xf6413f=_0x59b16c;_0x3a5071[_0x1bcd('0x3d')]=_[_0x1bcd('0x3f')](db[_0x1bcd('0x6e')]['rawAttributes']);_0x3a5071[_0x1bcd('0x3e')]=_[_0x1bcd('0x3f')](_0x571d43[_0x1bcd('0x3e')]);_0x3a5071[_0x1bcd('0x40')]=_['intersection'](_0x3a5071[_0x1bcd('0x3d')],_0x3a5071[_0x1bcd('0x3e')]);_0x57a682[_0x1bcd('0x43')]=_['intersection'](_0x3a5071[_0x1bcd('0x3d')],qs['fields'](_0x571d43[_0x1bcd('0x3e')][_0x1bcd('0x41')]));_0x57a682['attributes']=_0x57a682[_0x1bcd('0x43')][_0x1bcd('0x42')]?_0x57a682[_0x1bcd('0x43')]:_0x3a5071[_0x1bcd('0x3d')];_0x57a682[_0x1bcd('0x61')]=qs[_0x1bcd('0x62')](_0x571d43[_0x1bcd('0x3e')]['sort']);_0x57a682[_0x1bcd('0x45')]=qs[_0x1bcd('0x40')](_['pick'](_0x571d43[_0x1bcd('0x3e')],_0x3a5071[_0x1bcd('0x40')]));if(_0x571d43[_0x1bcd('0x3e')][_0x1bcd('0x46')]){_0x57a682[_0x1bcd('0x45')]=_[_0x1bcd('0x30')](_0x57a682[_0x1bcd('0x45')],{'$or':_[_0x1bcd('0x38')](_0x57a682[_0x1bcd('0x43')],function(_0x16caea){var _0x347631={};_0x347631[_0x16caea]={'$like':'%'+_0x571d43['query'][_0x1bcd('0x46')]+'%'};return _0x347631;})});}_0x57a682=_[_0x1bcd('0x30')]({},_0x57a682,_0x571d43[_0x1bcd('0x48')]);return _0xf6413f[_0x1bcd('0x6f')](_0x57a682);}})['then'](function(_0x1bf2f1){if(_0x1bf2f1){_0x33ff0f=_0x1bf2f1[_0x1bcd('0x42')];if(!_0x571d43[_0x1bcd('0x3e')][_0x1bcd('0x60')](_0x1bcd('0x44'))){_0x57a682['limit']=qs[_0x1bcd('0x22')](_0x571d43[_0x1bcd('0x3e')][_0x1bcd('0x22')]);_0x57a682[_0x1bcd('0x20')]=qs[_0x1bcd('0x20')](_0x571d43[_0x1bcd('0x3e')][_0x1bcd('0x20')]);}return _0xf6413f['getTeams'](_0x57a682);}})['then'](function(_0x331ea3){if(_0x331ea3){return _0x331ea3?{'count':_0x33ff0f,'rows':_0x331ea3}:null;}})[_0x1bcd('0x28')](respondWithResult(_0x1bf45b,null))[_0x1bcd('0x4c')](handleError(_0x1bf45b,null));};exports[_0x1bcd('0x70')]=function(_0x50bd97,_0x47ab96,_0x2af998){var _0x4ceb48=_0x50bd97[_0x1bcd('0x31')]['ids'];return db[_0x1bcd('0x6e')][_0x1bcd('0x65')]({'where':{'id':_0x4ceb48},'attributes':['id'],'include':[{'model':db[_0x1bcd('0x71')],'as':'Agents','attributes':['id','name',_0x1bcd('0x72'),_0x1bcd('0x73'),'interface'],'raw':!![]}]})[_0x1bcd('0x28')](function(_0x44ae91){if(_0x44ae91){var _0x3ce520=_['flatMap'](_0x44ae91,function(_0x4b91d6){var _0x1999fb=_0x4b91d6[_0x1bcd('0x29')]({'plain':!![]});return _0x1999fb[_0x1bcd('0x74')];});return db[_0x1bcd('0x39')][_0x1bcd('0x4f')]({'where':{'id':_0x50bd97[_0x1bcd('0x5b')]['id']}})[_0x1bcd('0x28')](function(_0x4ab87c){return db['sequelize'][_0x1bcd('0x75')](function(_0x3ec721){return _0x4ab87c[_0x1bcd('0x70')](_0x4ceb48,{'transaction':_0x3ec721})[_0x1bcd('0x28')](function(){return BPromise[_0x1bcd('0x76')](_0x3ce520,function(_0x46f1de){return db[_0x1bcd('0x5f')][_0x1bcd('0x77')]({'where':{'UserId':_0x46f1de['id'],'MailQueueId':_0x50bd97[_0x1bcd('0x5b')]['id']},'transaction':_0x3ec721});});})['then'](function(){_0x3ce520[_0x1bcd('0x78')](function(_0x1e1563){socket[_0x1bcd('0x79')](_0x1bcd('0x7a'),{'UserId':_0x1e1563['id'],'MailQueueId':_0x4ab87c['id']});});});});});}})[_0x1bcd('0x28')](respondWithStatusCode(_0x47ab96,null))['catch'](handleError(_0x47ab96,null));};exports[_0x1bcd('0x7b')]=function(_0x10a34a,_0x262797,_0x239652){return db['Team'][_0x1bcd('0x65')]({'where':{'id':_0x10a34a['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x1bcd('0x71')],'as':_0x1bcd('0x74'),'attributes':['id'],'raw':!![]}]})[_0x1bcd('0x28')](handleEntityNotFound(_0x262797,null))[_0x1bcd('0x28')](function(_0x5b3fb9){var _0x59c1a4=_[_0x1bcd('0x38')](_0x5b3fb9,'id');var _0x38ac94=[];var _0x200bcb=[];var _0x502a14=squel[_0x1bcd('0x7c')]();_0x502a14[_0x1bcd('0x7d')]('tq.TeamId')[_0x1bcd('0x7e')](_0x1bcd('0x7f'),'tq')['join'](_0x1bcd('0x80'),'ut',_0x1bcd('0x81'))['where'](_0x1bcd('0x82'),_0x10a34a[_0x1bcd('0x5b')]['id']);for(var _0x348b9c=0x0;_0x348b9c<_0x5b3fb9[_0x1bcd('0x42')];_0x348b9c+=0x1){let _0x2ef843=_0x5b3fb9[_0x348b9c];for(var _0x4e3791=0x0;_0x4e3791<_0x2ef843[_0x1bcd('0x74')]['length'];_0x4e3791+=0x1){let _0x29c3d7=_0x2ef843[_0x1bcd('0x74')][_0x4e3791];var _0x296315=_0x502a14['clone']();_0x296315[_0x1bcd('0x45')](_0x1bcd('0x83'),_0x29c3d7['id']);_0x200bcb[_0x1bcd('0x84')](db[_0x1bcd('0x85')][_0x1bcd('0x3e')](_0x296315[_0x1bcd('0x86')](),{'type':db[_0x1bcd('0x85')][_0x1bcd('0x87')]['SELECT']})[_0x1bcd('0x28')](function(_0x6e2588){if(_0x6e2588[_0x1bcd('0x42')]===0x1){return _0x29c3d7['id'];}else{var _0x26d16d=_['every'](_['map'](_0x6e2588,_0x1bcd('0x88')),function(_0x40e2f3){return _[_0x1bcd('0x89')](_0x59c1a4,_0x40e2f3);});if(_0x26d16d){return _0x29c3d7['id'];}}}));}}return BPromise['all'](_0x200bcb)[_0x1bcd('0x28')](function(_0x4622ce){_0x38ac94=_(_0x38ac94)[_0x1bcd('0x8a')](_0x4622ce)[_0x1bcd('0x8b')]()[_0x1bcd('0x8c')]();return db[_0x1bcd('0x39')][_0x1bcd('0x4f')]({'where':{'id':_0x10a34a[_0x1bcd('0x5b')]['id']}})['then'](function(_0x315480){return db['sequelize'][_0x1bcd('0x75')](function(_0x46ae5a){return _0x315480[_0x1bcd('0x7b')](_0x10a34a[_0x1bcd('0x3e')][_0x1bcd('0x8d')],{'transaction':_0x46ae5a})['then'](function(){if(!_['isEmpty'](_0x38ac94)){return _0x315480[_0x1bcd('0x8e')](_0x38ac94,{'transaction':_0x46ae5a});}})['then'](function(){_0x38ac94[_0x1bcd('0x78')](function(_0x317230){socket[_0x1bcd('0x79')](_0x1bcd('0x8f'),{'UserId':_0x317230,'MailQueueId':_0x315480['id']});});});});});});})[_0x1bcd('0x28')](respondWithStatusCode(_0x262797,null))[_0x1bcd('0x4c')](handleError(_0x262797,null));};exports[_0x1bcd('0x90')]=function(_0x387d3a,_0x54bc03,_0x3b9884){return db[_0x1bcd('0x39')][_0x1bcd('0x4f')]({'where':{'id':_0x387d3a[_0x1bcd('0x5b')]['id']}})[_0x1bcd('0x28')](handleEntityNotFound(_0x54bc03,null))[_0x1bcd('0x28')](function(_0x2e92e7){if(_0x2e92e7){return _0x2e92e7[_0x1bcd('0x90')](_0x387d3a[_0x1bcd('0x31')][_0x1bcd('0x8d')],_[_0x1bcd('0x91')](_0x387d3a[_0x1bcd('0x31')],[_0x1bcd('0x8d'),'id'])||{})[_0x1bcd('0x92')](function(_0x2bdc33){for(var _0x1a101e=0x0;_0x1a101e<_0x387d3a['body']['ids']['length'];_0x1a101e+=0x1){socket[_0x1bcd('0x79')](_0x1bcd('0x7a'),{'UserId':_0x387d3a[_0x1bcd('0x31')][_0x1bcd('0x8d')][_0x1a101e],'MailQueueId':_0x387d3a[_0x1bcd('0x5b')]['id']});}return _0x2bdc33;});}})[_0x1bcd('0x28')](respondWithResult(_0x54bc03,null))[_0x1bcd('0x4c')](handleError(_0x54bc03,null));};exports[_0x1bcd('0x8e')]=function(_0x14722e,_0x291a2c,_0x4feade){return db[_0x1bcd('0x39')][_0x1bcd('0x4f')]({'where':{'id':_0x14722e[_0x1bcd('0x5b')]['id']}})[_0x1bcd('0x28')](handleEntityNotFound(_0x291a2c,null))[_0x1bcd('0x28')](function(_0x1f1a24){if(_0x1f1a24){return _0x1f1a24[_0x1bcd('0x8e')](_0x14722e['query']['ids'])[_0x1bcd('0x28')](function(){if(_[_0x1bcd('0x93')](_0x14722e[_0x1bcd('0x3e')][_0x1bcd('0x8d')])){for(var _0x1ca9ad=0x0;_0x1ca9ad<_0x14722e[_0x1bcd('0x3e')][_0x1bcd('0x8d')][_0x1bcd('0x42')];_0x1ca9ad+=0x1){socket[_0x1bcd('0x79')]('userMailQueue:remove',{'UserId':Number(_0x14722e['query'][_0x1bcd('0x8d')][_0x1ca9ad]),'MailQueueId':Number(_0x14722e[_0x1bcd('0x5b')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x14722e[_0x1bcd('0x3e')]['ids']),'MailQueueId':Number(_0x14722e[_0x1bcd('0x5b')]['id'])});}});}})[_0x1bcd('0x28')](respondWithStatusCode(_0x291a2c,null))[_0x1bcd('0x4c')](handleError(_0x291a2c,null));};exports['getAgents']=function(_0xcdad6f,_0x26cea1,_0x7cb006){var _0x1ab557={};var _0x3950a1={};var _0x458973;var _0x1f6260;return db[_0x1bcd('0x39')][_0x1bcd('0x5e')]({'where':{'id':_0xcdad6f['params']['id']}})[_0x1bcd('0x28')](handleEntityNotFound(_0x26cea1,null))[_0x1bcd('0x28')](function(_0x1a44c9){if(_0x1a44c9){_0x458973=_0x1a44c9;_0x3950a1[_0x1bcd('0x3d')]=_[_0x1bcd('0x3f')](db[_0x1bcd('0x71')][_0x1bcd('0x3a')]);_0x3950a1[_0x1bcd('0x3e')]=_['keys'](_0xcdad6f[_0x1bcd('0x3e')]);_0x3950a1[_0x1bcd('0x40')]=_[_0x1bcd('0x4e')](_0x3950a1['model'],_0x3950a1['query']);_0x1ab557['attributes']=_[_0x1bcd('0x4e')](_0x3950a1[_0x1bcd('0x3d')],qs[_0x1bcd('0x41')](_0xcdad6f[_0x1bcd('0x3e')][_0x1bcd('0x41')]));_0x1ab557[_0x1bcd('0x43')]=_0x1ab557[_0x1bcd('0x43')][_0x1bcd('0x42')]?_0x1ab557[_0x1bcd('0x43')]:_0x3950a1[_0x1bcd('0x3d')];_0x1ab557[_0x1bcd('0x61')]=qs[_0x1bcd('0x62')](_0xcdad6f[_0x1bcd('0x3e')][_0x1bcd('0x62')]);_0x1ab557[_0x1bcd('0x45')]=qs[_0x1bcd('0x40')](_[_0x1bcd('0x63')](_0xcdad6f[_0x1bcd('0x3e')],_0x3950a1[_0x1bcd('0x40')]));if(_0xcdad6f[_0x1bcd('0x3e')][_0x1bcd('0x46')]){_0x1ab557['where']=_['merge'](_0x1ab557[_0x1bcd('0x45')],{'$or':_[_0x1bcd('0x38')](_0x1ab557[_0x1bcd('0x43')],function(_0x1138b2){var _0x33eb7={};_0x33eb7[_0x1138b2]={'$like':'%'+_0xcdad6f[_0x1bcd('0x3e')][_0x1bcd('0x46')]+'%'};return _0x33eb7;})});}_0x1ab557=_[_0x1bcd('0x30')]({},_0x1ab557,_0xcdad6f[_0x1bcd('0x48')]);return _0x458973[_0x1bcd('0x94')](_0x1ab557);}})['then'](function(_0x9438e7){if(_0x9438e7){_0x1f6260=_0x9438e7['length'];if(!_0xcdad6f[_0x1bcd('0x3e')]['hasOwnProperty']('nolimit')){_0x1ab557['limit']=qs['limit'](_0xcdad6f['query'][_0x1bcd('0x22')]);_0x1ab557['offset']=qs[_0x1bcd('0x20')](_0xcdad6f[_0x1bcd('0x3e')][_0x1bcd('0x20')]);}return _0x458973['getAgents'](_0x1ab557);}})[_0x1bcd('0x28')](function(_0x6becc1){if(_0x6becc1){return _0x6becc1?{'count':_0x1f6260,'rows':_0x6becc1}:null;}})[_0x1bcd('0x28')](respondWithResult(_0x26cea1,null))[_0x1bcd('0x4c')](handleError(_0x26cea1,null));}; \ No newline at end of file +var _0x837e=['join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','userMailQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','MailQueues','error','name','merge','body','message','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','options','MailQueue','includeAll','findAll','rows','catch','show','params','include','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','length','hasOwnProperty','MailQueueId','User','findAndCountAll','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','Team','addTeams','Agents','interface','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','select','tq.TeamId','team_has_mail_queues'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x837e,0x12b));var _0xe837=function(_0x4798d2,_0x18b5a8){_0x4798d2=_0x4798d2-0x0;var _0x35f965=_0x837e[_0x4798d2];return _0x35f965;};'use strict';var emlformat=require(_0xe837('0x0'));var rimraf=require(_0xe837('0x1'));var zipdir=require(_0xe837('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe837('0x3'));var moment=require(_0xe837('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe837('0x5'));var path=require(_0xe837('0x6'));var sox=require(_0xe837('0x7'));var csv=require(_0xe837('0x8'));var ejs=require(_0xe837('0x9'));var fs=require('fs');var fs_extra=require(_0xe837('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe837('0xb'));var jsforce=require(_0xe837('0xc'));var deskjs=require(_0xe837('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe837('0xe'));var Papa=require(_0xe837('0xf'));var Redis=require(_0xe837('0x10'));var authService=require(_0xe837('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe837('0x12'));var logger=require(_0xe837('0x13'))(_0xe837('0x14'));var utils=require('../../config/utils');var config=require(_0xe837('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe837('0x16')]=_[_0xe837('0x17')](config['redis'],{'host':_0xe837('0x18'),'port':0x18eb});var socket=require(_0xe837('0x19'))(new Redis(config[_0xe837('0x16')]));require('./mailQueue.socket')[_0xe837('0x1a')](socket);function respondWithStatusCode(_0x58d89e,_0x6c43a9){_0x6c43a9=_0x6c43a9||0xcc;return function(_0x260fe0){if(_0x260fe0){return _0x58d89e['sendStatus'](_0x6c43a9);}return _0x58d89e[_0xe837('0x1b')](_0x6c43a9)[_0xe837('0x1c')]();};}function respondWithResult(_0x2d4bed,_0x284153){_0x284153=_0x284153||0xc8;return function(_0x4c7bb3){if(_0x4c7bb3){return _0x2d4bed[_0xe837('0x1b')](_0x284153)[_0xe837('0x1d')](_0x4c7bb3);}};}function respondWithFilteredResult(_0x20979e,_0x15367a){return function(_0x6b4e5f){if(_0x6b4e5f){var _0x363940=typeof _0x15367a['offset']===_0xe837('0x1e')&&typeof _0x15367a[_0xe837('0x1f')]==='undefined';var _0x13db0c=_0x6b4e5f[_0xe837('0x20')];var _0x73dbef=_0x363940?0x0:_0x15367a[_0xe837('0x21')];var _0x140e73=_0x363940?_0x6b4e5f[_0xe837('0x20')]:_0x15367a[_0xe837('0x21')]+_0x15367a['limit'];var _0x2bde72;if(_0x140e73>=_0x13db0c){_0x140e73=_0x13db0c;_0x2bde72=0xc8;}else{_0x2bde72=0xce;}_0x20979e[_0xe837('0x1b')](_0x2bde72);return _0x20979e[_0xe837('0x22')]('Content-Range',_0x73dbef+'-'+_0x140e73+'/'+_0x13db0c)[_0xe837('0x1d')](_0x6b4e5f);}return null;};}function patchUpdates(_0x46eb02){return function(_0x5515bb){try{jsonpatch[_0xe837('0x23')](_0x5515bb,_0x46eb02,!![]);}catch(_0x494bfa){return BPromise[_0xe837('0x24')](_0x494bfa);}return _0x5515bb[_0xe837('0x25')]();};}function saveUpdates(_0x32e5f6,_0x8b542b){return function(_0x4be098){if(_0x4be098){return _0x4be098[_0xe837('0x26')](_0x32e5f6)[_0xe837('0x27')](function(_0x290b91){return _0x290b91;});}return null;};}function removeEntity(_0xfc5598,_0x42a603){return function(_0x3feb71){if(_0x3feb71){return _0x3feb71[_0xe837('0x28')]()[_0xe837('0x27')](function(){var _0x267a22=_0x3feb71['get']({'plain':!![]});var _0x4e1d74=_0xe837('0x29');return db['UserProfileResource'][_0xe837('0x28')]({'where':{'type':_0x4e1d74,'resourceId':_0x267a22['id']}})[_0xe837('0x27')](function(){return _0x3feb71;});})[_0xe837('0x27')](function(){_0xfc5598[_0xe837('0x1b')](0xcc)[_0xe837('0x1c')]();});}};}function handleEntityNotFound(_0x132e8f,_0x475b63){return function(_0x7aa8a6){if(!_0x7aa8a6){_0x132e8f['sendStatus'](0x194);}return _0x7aa8a6;};}function handleError(_0x194999,_0x132eef){_0x132eef=_0x132eef||0x1f4;return function(_0x5cc006){logger[_0xe837('0x2a')](_0x5cc006['stack']);if(_0x5cc006[_0xe837('0x2b')]){delete _0x5cc006[_0xe837('0x2b')];}_0x194999[_0xe837('0x1b')](_0x132eef)['send'](_0x5cc006);};}function getMustacheRender(_0x3aad08,_0x2a2056){return Mustache['render'](_0x3aad08,_[_0xe837('0x2c')](_0x2a2056[_0xe837('0x2d')],{'contact':_0x2a2056['contact'],'message':_0x2a2056[_0xe837('0x2e')],'agent':_0x2a2056[_0xe837('0x2f')],'interaction':_0x2a2056[_0xe837('0x30')],'account':_0x2a2056[_0xe837('0x31')]}))||'';}exports[_0xe837('0x32')]=function(_0x506524,_0x5510a7){var _0x245385={},_0x2368d2={},_0x121a65={'count':0x0,'rows':[]};var _0x1641c7=_[_0xe837('0x33')](db['MailQueue'][_0xe837('0x34')],function(_0x2db96d){return{'name':_0x2db96d[_0xe837('0x35')],'type':_0x2db96d[_0xe837('0x36')][_0xe837('0x37')]};});_0x2368d2['model']=_[_0xe837('0x33')](_0x1641c7,_0xe837('0x2b'));_0x2368d2[_0xe837('0x38')]=_[_0xe837('0x39')](_0x506524['query']);_0x2368d2[_0xe837('0x3a')]=_[_0xe837('0x3b')](_0x2368d2[_0xe837('0x3c')],_0x2368d2['query']);_0x245385[_0xe837('0x3d')]=_['intersection'](_0x2368d2[_0xe837('0x3c')],qs['fields'](_0x506524[_0xe837('0x38')][_0xe837('0x3e')]));_0x245385[_0xe837('0x3d')]=_0x245385[_0xe837('0x3d')]['length']?_0x245385[_0xe837('0x3d')]:_0x2368d2[_0xe837('0x3c')];if(!_0x506524['query']['hasOwnProperty'](_0xe837('0x3f'))){_0x245385[_0xe837('0x1f')]=qs['limit'](_0x506524[_0xe837('0x38')]['limit']);_0x245385[_0xe837('0x21')]=qs[_0xe837('0x21')](_0x506524['query'][_0xe837('0x21')]);}_0x245385[_0xe837('0x40')]=qs[_0xe837('0x41')](_0x506524[_0xe837('0x38')][_0xe837('0x41')]);_0x245385[_0xe837('0x42')]=qs['filters'](_[_0xe837('0x43')](_0x506524[_0xe837('0x38')],_0x2368d2[_0xe837('0x3a')]),_0x1641c7);if(_0x506524['query'][_0xe837('0x44')]){_0x245385[_0xe837('0x42')]=_[_0xe837('0x2c')](_0x245385[_0xe837('0x42')],{'$or':_[_0xe837('0x33')](_0x1641c7,function(_0x19b181){if(_0x19b181[_0xe837('0x36')]!==_0xe837('0x45')){var _0x250aa9={};_0x250aa9[_0x19b181[_0xe837('0x2b')]]={'$like':'%'+_0x506524[_0xe837('0x38')][_0xe837('0x44')]+'%'};return _0x250aa9;}})});}_0x245385=_[_0xe837('0x2c')]({},_0x245385,_0x506524[_0xe837('0x46')]);var _0x5ac3db={'where':_0x245385['where']};return db[_0xe837('0x47')][_0xe837('0x20')](_0x5ac3db)['then'](function(_0x5034fe){_0x121a65['count']=_0x5034fe;if(_0x506524['query'][_0xe837('0x48')]){_0x245385['include']=[{'all':!![]}];}return db[_0xe837('0x47')][_0xe837('0x49')](_0x245385);})[_0xe837('0x27')](function(_0x403053){_0x121a65[_0xe837('0x4a')]=_0x403053;return _0x121a65;})[_0xe837('0x27')](respondWithFilteredResult(_0x5510a7,_0x245385))[_0xe837('0x4b')](handleError(_0x5510a7,null));};exports[_0xe837('0x4c')]=function(_0x16cf4d,_0x29be38){var _0x33fa5c={'raw':!![],'where':{'id':_0x16cf4d[_0xe837('0x4d')]['id']}},_0x5aaae9={};_0x5aaae9[_0xe837('0x3c')]=_[_0xe837('0x39')](db['MailQueue'][_0xe837('0x34')]);_0x5aaae9['query']=_[_0xe837('0x39')](_0x16cf4d[_0xe837('0x38')]);_0x5aaae9['filters']=_[_0xe837('0x3b')](_0x5aaae9[_0xe837('0x3c')],_0x5aaae9[_0xe837('0x38')]);_0x33fa5c['attributes']=_[_0xe837('0x3b')](_0x5aaae9[_0xe837('0x3c')],qs[_0xe837('0x3e')](_0x16cf4d['query'][_0xe837('0x3e')]));_0x33fa5c[_0xe837('0x3d')]=_0x33fa5c[_0xe837('0x3d')]['length']?_0x33fa5c['attributes']:_0x5aaae9[_0xe837('0x3c')];if(_0x16cf4d['query'][_0xe837('0x48')]){_0x33fa5c[_0xe837('0x4e')]=[{'all':!![]}];}_0x33fa5c=_[_0xe837('0x2c')]({},_0x33fa5c,_0x16cf4d[_0xe837('0x46')]);return db[_0xe837('0x47')]['find'](_0x33fa5c)[_0xe837('0x27')](handleEntityNotFound(_0x29be38,null))[_0xe837('0x27')](respondWithResult(_0x29be38,null))[_0xe837('0x4b')](handleError(_0x29be38,null));};exports['create']=function(_0x374959,_0x39e103){return db[_0xe837('0x47')]['create'](_0x374959[_0xe837('0x2d')],{})[_0xe837('0x27')](function(_0x432db9){var _0x4e295b=_0x374959['user'][_0xe837('0x4f')]({'plain':!![]});if(!_0x4e295b)throw new Error(_0xe837('0x50'));if(_0x4e295b['role']===_0xe837('0x51')){var _0x5016d2=_0x432db9[_0xe837('0x4f')]({'plain':!![]});var _0x295c61=_0xe837('0x29');return db[_0xe837('0x52')][_0xe837('0x53')]({'where':{'name':_0x295c61,'userProfileId':_0x4e295b[_0xe837('0x54')]},'raw':!![]})['then'](function(_0x568514){if(_0x568514&&_0x568514['autoAssociation']===0x0){return db[_0xe837('0x55')][_0xe837('0x56')]({'name':_0x5016d2[_0xe837('0x2b')],'resourceId':_0x5016d2['id'],'type':_0x568514[_0xe837('0x2b')],'sectionId':_0x568514['id']},{})[_0xe837('0x27')](function(){return _0x432db9;});}else{return _0x432db9;}})[_0xe837('0x4b')](function(_0x3406a6){logger['error'](_0xe837('0x57'),_0x3406a6);throw _0x3406a6;});}return _0x432db9;})[_0xe837('0x27')](respondWithResult(_0x39e103,0xc9))['catch'](handleError(_0x39e103,null));};exports[_0xe837('0x26')]=function(_0x406720,_0xdb5f27){if(_0x406720[_0xe837('0x2d')]['id']){delete _0x406720[_0xe837('0x2d')]['id'];}return db[_0xe837('0x47')][_0xe837('0x53')]({'where':{'id':_0x406720[_0xe837('0x4d')]['id']}})['then'](handleEntityNotFound(_0xdb5f27,null))[_0xe837('0x27')](saveUpdates(_0x406720[_0xe837('0x2d')],null))[_0xe837('0x27')](respondWithResult(_0xdb5f27,null))[_0xe837('0x4b')](handleError(_0xdb5f27,null));};exports[_0xe837('0x28')]=function(_0x2e1712,_0x29a3fe){return db[_0xe837('0x47')][_0xe837('0x53')]({'where':{'id':_0x2e1712['params']['id']}})['then'](handleEntityNotFound(_0x29a3fe,null))[_0xe837('0x27')](removeEntity(_0x29a3fe,null))[_0xe837('0x4b')](handleError(_0x29a3fe,null));};exports[_0xe837('0x58')]=function(_0x40631b,_0x503b17){return db[_0xe837('0x47')][_0xe837('0x58')]()[_0xe837('0x27')](respondWithResult(_0x503b17,null))[_0xe837('0x4b')](handleError(_0x503b17,null));};exports[_0xe837('0x59')]=function(_0x383c9b,_0x313fc0,_0x1ab15e){var _0x57f8a8={'raw':!![],'where':{}},_0x41c630={},_0x2bed05;return db[_0xe837('0x47')]['findOne']({'where':{'id':_0x383c9b[_0xe837('0x4d')]['id']}})[_0xe837('0x27')](handleEntityNotFound(_0x313fc0,null))[_0xe837('0x27')](function(_0x302181){if(_0x302181){_0x2bed05=_0x302181[_0xe837('0x4f')]({'plain':!![]});_0x41c630['model']=_['keys'](db[_0xe837('0x5a')]['rawAttributes']);_0x41c630[_0xe837('0x38')]=_['keys'](_0x383c9b[_0xe837('0x38')]);_0x41c630['filters']=_[_0xe837('0x3b')](_0x41c630[_0xe837('0x3c')],_0x41c630[_0xe837('0x38')]);_0x57f8a8[_0xe837('0x3d')]=_['intersection'](_0x41c630[_0xe837('0x3c')],qs['fields'](_0x383c9b[_0xe837('0x38')][_0xe837('0x3e')]));_0x57f8a8[_0xe837('0x3d')]=_0x57f8a8[_0xe837('0x3d')][_0xe837('0x5b')]?_0x57f8a8[_0xe837('0x3d')]:_0x41c630[_0xe837('0x3c')];if(!_0x383c9b[_0xe837('0x38')][_0xe837('0x5c')]('nolimit')){_0x57f8a8[_0xe837('0x1f')]=qs[_0xe837('0x1f')](_0x383c9b[_0xe837('0x38')]['limit']);_0x57f8a8['offset']=qs['offset'](_0x383c9b['query'][_0xe837('0x21')]);}_0x57f8a8[_0xe837('0x40')]=qs[_0xe837('0x41')](_0x383c9b[_0xe837('0x38')]['sort']);_0x57f8a8[_0xe837('0x42')]=qs[_0xe837('0x3a')](_[_0xe837('0x43')](_0x383c9b[_0xe837('0x38')],_0x41c630[_0xe837('0x3a')]));_0x57f8a8['where'][_0xe837('0x5d')]=_0x302181['id'];if(_0x383c9b['query'][_0xe837('0x44')]){_0x57f8a8[_0xe837('0x42')]=_[_0xe837('0x2c')](_0x57f8a8[_0xe837('0x42')],{'$or':_[_0xe837('0x33')](_0x57f8a8[_0xe837('0x3d')],function(_0x529c44){var _0x3245e3={};_0x3245e3[_0x529c44]={'$like':'%'+_0x383c9b['query']['filter']+'%'};return _0x3245e3;})});}_0x57f8a8=_[_0xe837('0x2c')]({},_0x57f8a8,_0x383c9b[_0xe837('0x46')]);return db[_0xe837('0x5a')][_0xe837('0x49')](_0x57f8a8);}})[_0xe837('0x27')](function(_0x35e54e){if(_0x35e54e){return db[_0xe837('0x5e')][_0xe837('0x5f')]({'where':{'id':_[_0xe837('0x33')](_0x35e54e,'UserId'),'role':_0xe837('0x2f')},'attributes':['id',_0xe837('0x2b'),_0xe837('0x60'),_0xe837('0x61'),_0xe837('0x62')]});}})[_0xe837('0x27')](function(_0x49cb7d){if(_0x49cb7d){return{'count':_0x49cb7d[_0xe837('0x20')],'rows':_['map'](_0x49cb7d[_0xe837('0x4a')],function(_0x48a473){return{'membername':_0x48a473[_0xe837('0x2b')],'UserId':_0x48a473['id'],'queue_name':_0x2bed05[_0xe837('0x2b')],'MailQueueId':_0x2bed05['id'],'interface':util['format'](_0xe837('0x63'),_0xe837('0x64'),_0x48a473['name']),'penalty':0x0,'paused':_0x48a473[_0xe837('0x60')],'createdAt':_0x48a473['createdAt'],'updatedAt':_0x48a473[_0xe837('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe837('0x27')](respondWithFilteredResult(_0x313fc0,_0x57f8a8))[_0xe837('0x4b')](handleError(_0x313fc0,null));};exports[_0xe837('0x65')]=function(_0x45412e,_0x2d6c14,_0x407442){var _0xe23a5b={};var _0x6221e6={};var _0x4a7be4;var _0x18dad0;return db[_0xe837('0x47')][_0xe837('0x66')]({'where':{'id':_0x45412e['params']['id']}})['then'](handleEntityNotFound(_0x2d6c14,null))['then'](function(_0xef21a3){if(_0xef21a3){_0x4a7be4=_0xef21a3;_0x6221e6[_0xe837('0x3c')]=_[_0xe837('0x39')](db[_0xe837('0x67')]['rawAttributes']);_0x6221e6[_0xe837('0x38')]=_[_0xe837('0x39')](_0x45412e[_0xe837('0x38')]);_0x6221e6[_0xe837('0x3a')]=_[_0xe837('0x3b')](_0x6221e6[_0xe837('0x3c')],_0x6221e6['query']);_0xe23a5b['attributes']=_[_0xe837('0x3b')](_0x6221e6[_0xe837('0x3c')],qs[_0xe837('0x3e')](_0x45412e[_0xe837('0x38')][_0xe837('0x3e')]));_0xe23a5b[_0xe837('0x3d')]=_0xe23a5b[_0xe837('0x3d')]['length']?_0xe23a5b[_0xe837('0x3d')]:_0x6221e6[_0xe837('0x3c')];_0xe23a5b[_0xe837('0x40')]=qs[_0xe837('0x41')](_0x45412e['query']['sort']);_0xe23a5b[_0xe837('0x42')]=qs['filters'](_[_0xe837('0x43')](_0x45412e['query'],_0x6221e6['filters']));if(_0x45412e[_0xe837('0x38')][_0xe837('0x44')]){_0xe23a5b['where']=_['merge'](_0xe23a5b[_0xe837('0x42')],{'$or':_[_0xe837('0x33')](_0xe23a5b[_0xe837('0x3d')],function(_0x30db63){var _0x2d055e={};_0x2d055e[_0x30db63]={'$like':'%'+_0x45412e[_0xe837('0x38')][_0xe837('0x44')]+'%'};return _0x2d055e;})});}_0xe23a5b=_[_0xe837('0x2c')]({},_0xe23a5b,_0x45412e[_0xe837('0x46')]);return _0x4a7be4[_0xe837('0x65')](_0xe23a5b);}})['then'](function(_0x2c0266){if(_0x2c0266){_0x18dad0=_0x2c0266[_0xe837('0x5b')];if(!_0x45412e[_0xe837('0x38')][_0xe837('0x5c')](_0xe837('0x3f'))){_0xe23a5b['limit']=qs['limit'](_0x45412e[_0xe837('0x38')]['limit']);_0xe23a5b[_0xe837('0x21')]=qs['offset'](_0x45412e[_0xe837('0x38')]['offset']);}return _0x4a7be4[_0xe837('0x65')](_0xe23a5b);}})[_0xe837('0x27')](function(_0xb0a296){if(_0xb0a296){return _0xb0a296?{'count':_0x18dad0,'rows':_0xb0a296}:null;}})[_0xe837('0x27')](respondWithResult(_0x2d6c14,null))[_0xe837('0x4b')](handleError(_0x2d6c14,null));};exports[_0xe837('0x68')]=function(_0x30f78d,_0x90c2d0,_0x106c03){var _0x21081a=_0x30f78d[_0xe837('0x2d')]['ids'];return db[_0xe837('0x67')][_0xe837('0x49')]({'where':{'id':_0x21081a},'attributes':['id'],'include':[{'model':db[_0xe837('0x5e')],'as':_0xe837('0x69'),'attributes':['id',_0xe837('0x2b'),'online','voicePause',_0xe837('0x6a')],'raw':!![]}]})[_0xe837('0x27')](function(_0x395c57){if(_0x395c57){var _0x3f2581=_['flatMap'](_0x395c57,function(_0x2bd586){var _0x24750c=_0x2bd586[_0xe837('0x4f')]({'plain':!![]});return _0x24750c['Agents'];});return db['MailQueue'][_0xe837('0x53')]({'where':{'id':_0x30f78d[_0xe837('0x4d')]['id']}})[_0xe837('0x27')](function(_0x32b568){return db[_0xe837('0x6b')][_0xe837('0x6c')](function(_0x5df2df){return _0x32b568[_0xe837('0x68')](_0x21081a,{'transaction':_0x5df2df})['then'](function(){return BPromise[_0xe837('0x6d')](_0x3f2581,function(_0x34330e){return db[_0xe837('0x5a')][_0xe837('0x6e')]({'where':{'UserId':_0x34330e['id'],'MailQueueId':_0x30f78d[_0xe837('0x4d')]['id']},'transaction':_0x5df2df});});})[_0xe837('0x27')](function(){_0x3f2581[_0xe837('0x6f')](function(_0x519000){socket[_0xe837('0x70')]('userMailQueue:save',{'UserId':_0x519000['id'],'MailQueueId':_0x32b568['id']});});});});});}})[_0xe837('0x27')](respondWithStatusCode(_0x90c2d0,null))['catch'](handleError(_0x90c2d0,null));};exports[_0xe837('0x71')]=function(_0x3083b8,_0x52e72b,_0x428d20){return db[_0xe837('0x67')][_0xe837('0x49')]({'where':{'id':_0x3083b8['query'][_0xe837('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe837('0x69'),'attributes':['id'],'raw':!![]}]})[_0xe837('0x27')](handleEntityNotFound(_0x52e72b,null))['then'](function(_0x17a9c8){var _0x199e3e=_[_0xe837('0x33')](_0x17a9c8,'id');var _0x446c5d=[];var _0x36621e=[];var _0x54e5a6=squel[_0xe837('0x73')]();_0x54e5a6['field'](_0xe837('0x74'))['from'](_0xe837('0x75'),'tq')[_0xe837('0x76')](_0xe837('0x77'),'ut',_0xe837('0x78'))[_0xe837('0x42')](_0xe837('0x79'),_0x3083b8[_0xe837('0x4d')]['id']);for(var _0x358eb3=0x0;_0x358eb3<_0x17a9c8['length'];_0x358eb3+=0x1){let _0x186ccd=_0x17a9c8[_0x358eb3];for(var _0x229ebe=0x0;_0x229ebe<_0x186ccd['Agents']['length'];_0x229ebe+=0x1){let _0x22fd8b=_0x186ccd[_0xe837('0x69')][_0x229ebe];var _0x487bea=_0x54e5a6[_0xe837('0x7a')]();_0x487bea['where'](_0xe837('0x7b'),_0x22fd8b['id']);_0x36621e[_0xe837('0x7c')](db[_0xe837('0x6b')][_0xe837('0x38')](_0x487bea['toString'](),{'type':db[_0xe837('0x6b')][_0xe837('0x7d')]['SELECT']})['then'](function(_0x25ebf3){if(_0x25ebf3[_0xe837('0x5b')]===0x1){return _0x22fd8b['id'];}else{var _0x45e934=_['every'](_[_0xe837('0x33')](_0x25ebf3,_0xe837('0x7e')),function(_0x475dba){return _[_0xe837('0x7f')](_0x199e3e,_0x475dba);});if(_0x45e934){return _0x22fd8b['id'];}}}));}}return BPromise[_0xe837('0x80')](_0x36621e)['then'](function(_0x144398){_0x446c5d=_(_0x446c5d)[_0xe837('0x81')](_0x144398)['compact']()[_0xe837('0x82')]();return db[_0xe837('0x47')][_0xe837('0x53')]({'where':{'id':_0x3083b8[_0xe837('0x4d')]['id']}})[_0xe837('0x27')](function(_0x274d38){return db['sequelize']['transaction'](function(_0x5cfa88){return _0x274d38[_0xe837('0x71')](_0x3083b8[_0xe837('0x38')]['ids'],{'transaction':_0x5cfa88})['then'](function(){if(!_[_0xe837('0x83')](_0x446c5d)){return _0x274d38[_0xe837('0x84')](_0x446c5d,{'transaction':_0x5cfa88});}})[_0xe837('0x27')](function(){_0x446c5d['forEach'](function(_0x4a23bd){socket[_0xe837('0x70')](_0xe837('0x85'),{'UserId':_0x4a23bd,'MailQueueId':_0x274d38['id']});});});});});});})[_0xe837('0x27')](respondWithStatusCode(_0x52e72b,null))['catch'](handleError(_0x52e72b,null));};exports[_0xe837('0x86')]=function(_0x1aff8c,_0x6dc731,_0x5273ee){return db[_0xe837('0x47')][_0xe837('0x53')]({'where':{'id':_0x1aff8c[_0xe837('0x4d')]['id']}})[_0xe837('0x27')](handleEntityNotFound(_0x6dc731,null))['then'](function(_0x57386a){if(_0x57386a){return _0x57386a[_0xe837('0x86')](_0x1aff8c[_0xe837('0x2d')][_0xe837('0x72')],_['omit'](_0x1aff8c['body'],[_0xe837('0x72'),'id'])||{})[_0xe837('0x87')](function(_0x51c72a){for(var _0x472100=0x0;_0x472100<_0x1aff8c[_0xe837('0x2d')][_0xe837('0x72')][_0xe837('0x5b')];_0x472100+=0x1){socket['emit'](_0xe837('0x88'),{'UserId':_0x1aff8c[_0xe837('0x2d')][_0xe837('0x72')][_0x472100],'MailQueueId':_0x1aff8c[_0xe837('0x4d')]['id']});}return _0x51c72a;});}})[_0xe837('0x27')](respondWithResult(_0x6dc731,null))[_0xe837('0x4b')](handleError(_0x6dc731,null));};exports[_0xe837('0x84')]=function(_0x354574,_0x2d4443,_0x5c0654){return db[_0xe837('0x47')]['find']({'where':{'id':_0x354574['params']['id']}})[_0xe837('0x27')](handleEntityNotFound(_0x2d4443,null))[_0xe837('0x27')](function(_0x8763d7){if(_0x8763d7){return _0x8763d7[_0xe837('0x84')](_0x354574[_0xe837('0x38')][_0xe837('0x72')])[_0xe837('0x27')](function(){if(_[_0xe837('0x89')](_0x354574[_0xe837('0x38')][_0xe837('0x72')])){for(var _0x3f232a=0x0;_0x3f232a<_0x354574[_0xe837('0x38')][_0xe837('0x72')]['length'];_0x3f232a+=0x1){socket[_0xe837('0x70')](_0xe837('0x85'),{'UserId':Number(_0x354574[_0xe837('0x38')][_0xe837('0x72')][_0x3f232a]),'MailQueueId':Number(_0x354574[_0xe837('0x4d')]['id'])});}}else{socket[_0xe837('0x70')](_0xe837('0x85'),{'UserId':Number(_0x354574[_0xe837('0x38')]['ids']),'MailQueueId':Number(_0x354574[_0xe837('0x4d')]['id'])});}});}})[_0xe837('0x27')](respondWithStatusCode(_0x2d4443,null))[_0xe837('0x4b')](handleError(_0x2d4443,null));};exports[_0xe837('0x8a')]=function(_0x5c520b,_0x288e70,_0x4b90b4){var _0x3eca53={};var _0x293ed1={};var _0x1c37b8;var _0x49b8c5;return db['MailQueue']['findOne']({'where':{'id':_0x5c520b['params']['id']}})['then'](handleEntityNotFound(_0x288e70,null))['then'](function(_0x51ba52){if(_0x51ba52){_0x1c37b8=_0x51ba52;_0x293ed1['model']=_[_0xe837('0x39')](db['User'][_0xe837('0x34')]);_0x293ed1[_0xe837('0x38')]=_[_0xe837('0x39')](_0x5c520b[_0xe837('0x38')]);_0x293ed1[_0xe837('0x3a')]=_[_0xe837('0x3b')](_0x293ed1[_0xe837('0x3c')],_0x293ed1[_0xe837('0x38')]);_0x3eca53['attributes']=_[_0xe837('0x3b')](_0x293ed1[_0xe837('0x3c')],qs[_0xe837('0x3e')](_0x5c520b[_0xe837('0x38')][_0xe837('0x3e')]));_0x3eca53[_0xe837('0x3d')]=_0x3eca53[_0xe837('0x3d')][_0xe837('0x5b')]?_0x3eca53[_0xe837('0x3d')]:_0x293ed1['model'];_0x3eca53[_0xe837('0x40')]=qs[_0xe837('0x41')](_0x5c520b[_0xe837('0x38')][_0xe837('0x41')]);_0x3eca53[_0xe837('0x42')]=qs[_0xe837('0x3a')](_[_0xe837('0x43')](_0x5c520b[_0xe837('0x38')],_0x293ed1[_0xe837('0x3a')]));if(_0x5c520b['query'][_0xe837('0x44')]){_0x3eca53['where']=_[_0xe837('0x2c')](_0x3eca53[_0xe837('0x42')],{'$or':_[_0xe837('0x33')](_0x3eca53['attributes'],function(_0xe3c2ea){var _0x10a571={};_0x10a571[_0xe3c2ea]={'$like':'%'+_0x5c520b[_0xe837('0x38')][_0xe837('0x44')]+'%'};return _0x10a571;})});}_0x3eca53=_['merge']({},_0x3eca53,_0x5c520b['options']);return _0x1c37b8[_0xe837('0x8a')](_0x3eca53);}})[_0xe837('0x27')](function(_0x184614){if(_0x184614){_0x49b8c5=_0x184614[_0xe837('0x5b')];if(!_0x5c520b[_0xe837('0x38')][_0xe837('0x5c')](_0xe837('0x3f'))){_0x3eca53['limit']=qs['limit'](_0x5c520b[_0xe837('0x38')][_0xe837('0x1f')]);_0x3eca53[_0xe837('0x21')]=qs[_0xe837('0x21')](_0x5c520b[_0xe837('0x38')]['offset']);}return _0x1c37b8[_0xe837('0x8a')](_0x3eca53);}})[_0xe837('0x27')](function(_0x50852c){if(_0x50852c){return _0x50852c?{'count':_0x49b8c5,'rows':_0x50852c}:null;}})[_0xe837('0x27')](respondWithResult(_0x288e70,null))['catch'](handleError(_0x288e70,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 72cc164..f06bbb4 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 _0xe9c3=['hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1b542c,_0x505e1c){var _0x44d6a5=function(_0x3fb983){while(--_0x3fb983){_0x1b542c['push'](_0x1b542c['shift']());}};_0x44d6a5(++_0x505e1c);}(_0xe9c3,0xd4));var _0x3e9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9c3[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x3e9c('0x0'));var MailQueue=require(_0x3e9c('0x1'))['db'][_0x3e9c('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3e9c('0x3')](0x0);var events={'afterCreate':_0x3e9c('0x4'),'afterUpdate':_0x3e9c('0x5'),'afterDestroy':'remove'};function emitEvent(_0xa0cf5a){return function(_0x2e39a7,_0x123691,_0x2ad2f6){MailQueueEvents[_0x3e9c('0x6')](_0xa0cf5a+':'+_0x2e39a7['id'],_0x2e39a7);MailQueueEvents[_0x3e9c('0x6')](_0xa0cf5a,_0x2e39a7);_0x2ad2f6(null);};}for(var e in events){if(events[_0x3e9c('0x7')](e)){var event=events[e];MailQueue[_0x3e9c('0x8')](e,emitEvent(event));}}module[_0x3e9c('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x2a2e=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x445801,_0x33e51a){var _0xcb14c9=function(_0x5af3b7){while(--_0x5af3b7){_0x445801['push'](_0x445801['shift']());}};_0xcb14c9(++_0x33e51a);}(_0x2a2e,0x1ad));var _0xe2a2=function(_0x4a5325,_0x5754bb){_0x4a5325=_0x4a5325-0x0;var _0x2d1a2f=_0x2a2e[_0x4a5325];return _0x2d1a2f;};'use strict';var EventEmitter=require(_0xe2a2('0x0'));var MailQueue=require(_0xe2a2('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe2a2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe2a2('0x3'),'afterDestroy':_0xe2a2('0x4')};function emitEvent(_0x503431){return function(_0x43118f,_0x1db76b,_0x3b70ae){MailQueueEvents[_0xe2a2('0x5')](_0x503431+':'+_0x43118f['id'],_0x43118f);MailQueueEvents[_0xe2a2('0x5')](_0x503431,_0x43118f);_0x3b70ae(null);};}for(var e in events){if(events[_0xe2a2('0x6')](e)){var event=events[e];MailQueue[_0xe2a2('0x7')](e,emitEvent(event));}}module[_0xe2a2('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index c1f5de9..054214a 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 _0xace9=['MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','exports','define'];(function(_0x496061,_0x1aba95){var _0x3a6bb3=function(_0x1bec56){while(--_0x1bec56){_0x496061['push'](_0x496061['shift']());}};_0x3a6bb3(++_0x1aba95);}(_0xace9,0xaa));var _0x9ace=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0xace9[_0x4aba15];return _0x1c8122;};'use strict';var _=require(_0x9ace('0x0'));var util=require(_0x9ace('0x1'));var logger=require(_0x9ace('0x2'))(_0x9ace('0x3'));var moment=require(_0x9ace('0x4'));var BPromise=require(_0x9ace('0x5'));var rp=require(_0x9ace('0x6'));var fs=require('fs');var path=require(_0x9ace('0x7'));var rimraf=require('rimraf');var config=require(_0x9ace('0x8'));var attributes=require(_0x9ace('0x9'));module[_0x9ace('0xa')]=function(_0x18b9fe,_0x4c79bb){return _0x18b9fe[_0x9ace('0xb')](_0x9ace('0xc'),attributes,{'tableName':_0x9ace('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a72=['request-promise','path','rimraf','../../config/environment','exports','define','mail_queues','util','../../config/logger','api','moment'];(function(_0x5a8e83,_0x3447fd){var _0x2834f9=function(_0x11026c){while(--_0x11026c){_0x5a8e83['push'](_0x5a8e83['shift']());}};_0x2834f9(++_0x3447fd);}(_0x3a72,0x1a9));var _0x23a7=function(_0x2c9d0b,_0x391f6b){_0x2c9d0b=_0x2c9d0b-0x0;var _0x1f7284=_0x3a72[_0x2c9d0b];return _0x1f7284;};'use strict';var _=require('lodash');var util=require(_0x23a7('0x0'));var logger=require(_0x23a7('0x1'))(_0x23a7('0x2'));var moment=require(_0x23a7('0x3'));var BPromise=require('bluebird');var rp=require(_0x23a7('0x4'));var fs=require('fs');var path=require(_0x23a7('0x5'));var rimraf=require(_0x23a7('0x6'));var config=require(_0x23a7('0x7'));var attributes=require('./mailQueue.attributes');module[_0x23a7('0x8')]=function(_0x38fb13,_0x254490){return _0x38fb13[_0x23a7('0x9')]('MailQueue',attributes,{'tableName':_0x23a7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 6be9a30..cf9fce0 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 _0xdb5b=['localhost','socket.io-emitter','redis','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','MailQueue','findAll','options','raw','where','limit','model','attributes','include','map','GetMailQueue','catch','ShowMailQueue','find','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xdb5b,0x95));var _0xbdb5=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xdb5b[_0x2dea24];return _0x309d58;};'use strict';var _=require('lodash');var util=require(_0xbdb5('0x0'));var moment=require('moment');var BPromise=require(_0xbdb5('0x1'));var rs=require(_0xbdb5('0x2'));var fs=require('fs');var Redis=require(_0xbdb5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbdb5('0x4'));var logger=require('../../config/logger')(_0xbdb5('0x5'));var config=require(_0xbdb5('0x6'));var jayson=require(_0xbdb5('0x7'));var client=jayson[_0xbdb5('0x8')][_0xbdb5('0x9')]({'port':0x232a});config['redis']=_[_0xbdb5('0xa')](config['redis'],{'host':_0xbdb5('0xb'),'port':0x18eb});var socket=require(_0xbdb5('0xc'))(new Redis(config[_0xbdb5('0xd')]));require(_0xbdb5('0xe'))[_0xbdb5('0xf')](socket);function respondWithRpcPromise(_0x493d33,_0x2102de,_0x49efee){return new BPromise(function(_0x299311,_0x593c9a){return client[_0xbdb5('0x10')](_0x493d33,_0x49efee)[_0xbdb5('0x11')](function(_0x48c6e6){logger[_0xbdb5('0x12')](_0xbdb5('0x13'),_0x2102de,_0xbdb5('0x14'));logger[_0xbdb5('0x15')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2102de,_0xbdb5('0x14'),JSON[_0xbdb5('0x16')](_0x48c6e6));if(_0x48c6e6['error']){if(_0x48c6e6['error']['code']===0x1f4){logger['error'](_0xbdb5('0x13'),_0x2102de,_0x48c6e6[_0xbdb5('0x17')][_0xbdb5('0x18')]);return _0x593c9a(_0x48c6e6[_0xbdb5('0x17')][_0xbdb5('0x18')]);}logger[_0xbdb5('0x17')](_0xbdb5('0x13'),_0x2102de,_0x48c6e6['error'][_0xbdb5('0x18')]);return _0x299311(_0x48c6e6[_0xbdb5('0x17')][_0xbdb5('0x18')]);}else{logger[_0xbdb5('0x12')](_0xbdb5('0x13'),_0x2102de,_0xbdb5('0x14'));_0x299311(_0x48c6e6[_0xbdb5('0x19')]['message']);}})['catch'](function(_0xd8a9fb){logger['error'](_0xbdb5('0x13'),_0x2102de,_0xd8a9fb);_0x593c9a(_0xd8a9fb);});});}exports['GetMailQueue']=function(_0x2be70f){var _0x3420f9=this;return new Promise(function(_0x50c814,_0x58675b){return db[_0xbdb5('0x1a')][_0xbdb5('0x1b')]({'raw':_0x2be70f[_0xbdb5('0x1c')]?_0x2be70f['options'][_0xbdb5('0x1d')]===undefined?!![]:![]:!![],'where':_0x2be70f[_0xbdb5('0x1c')]?_0x2be70f['options'][_0xbdb5('0x1e')]||null:null,'attributes':_0x2be70f['options']?_0x2be70f[_0xbdb5('0x1c')]['attributes']||null:null,'limit':_0x2be70f['options']?_0x2be70f['options'][_0xbdb5('0x1f')]||null:null,'include':_0x2be70f[_0xbdb5('0x1c')]?_0x2be70f[_0xbdb5('0x1c')]['include']?_['map'](_0x2be70f['options']['include'],function(_0x31f9ce){return{'model':db[_0x31f9ce[_0xbdb5('0x20')]],'as':_0x31f9ce['as'],'attributes':_0x31f9ce[_0xbdb5('0x21')],'include':_0x31f9ce[_0xbdb5('0x22')]?_[_0xbdb5('0x23')](_0x31f9ce[_0xbdb5('0x22')],function(_0x473268){return{'model':db[_0x473268['model']],'as':_0x473268['as'],'attributes':_0x473268[_0xbdb5('0x21')],'include':_0x473268[_0xbdb5('0x22')]?_[_0xbdb5('0x23')](_0x473268['include'],function(_0x56ae23){return{'model':db[_0x56ae23['model']],'as':_0x56ae23['as'],'attributes':_0x56ae23['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fc5de){logger[_0xbdb5('0x12')](_0xbdb5('0x24'),_0x2be70f);logger['debug'](_0xbdb5('0x24'),_0x2be70f,JSON[_0xbdb5('0x16')](_0x3fc5de));_0x50c814(_0x3fc5de);})[_0xbdb5('0x25')](function(_0x16c76c){logger[_0xbdb5('0x17')](_0xbdb5('0x24'),_0x16c76c[_0xbdb5('0x18')],_0x2be70f);_0x58675b(_0x3420f9['error'](0x1f4,_0x16c76c['message']));});});};exports[_0xbdb5('0x26')]=function(_0x15b30f){var _0x15e370=this;return new Promise(function(_0x1f4dd2,_0x5924d8){return db[_0xbdb5('0x1a')][_0xbdb5('0x27')]({'raw':_0x15b30f[_0xbdb5('0x1c')]?_0x15b30f[_0xbdb5('0x1c')][_0xbdb5('0x1d')]===undefined?!![]:![]:!![],'where':_0x15b30f[_0xbdb5('0x1c')]?_0x15b30f[_0xbdb5('0x1c')]['where']||null:null,'attributes':_0x15b30f['options']?_0x15b30f['options'][_0xbdb5('0x21')]||null:null,'include':_0x15b30f[_0xbdb5('0x1c')]?_0x15b30f['options'][_0xbdb5('0x22')]?_[_0xbdb5('0x23')](_0x15b30f[_0xbdb5('0x1c')][_0xbdb5('0x22')],function(_0xc7cbe8){return{'model':db[_0xc7cbe8[_0xbdb5('0x20')]],'as':_0xc7cbe8['as'],'attributes':_0xc7cbe8[_0xbdb5('0x21')],'include':_0xc7cbe8[_0xbdb5('0x22')]?_[_0xbdb5('0x23')](_0xc7cbe8[_0xbdb5('0x22')],function(_0x3d1a7b){return{'model':db[_0x3d1a7b[_0xbdb5('0x20')]],'as':_0x3d1a7b['as'],'attributes':_0x3d1a7b['attributes'],'include':_0x3d1a7b[_0xbdb5('0x22')]?_[_0xbdb5('0x23')](_0x3d1a7b[_0xbdb5('0x22')],function(_0x15af56){return{'model':db[_0x15af56['model']],'as':_0x15af56['as'],'attributes':_0x15af56[_0xbdb5('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2066d7){logger['info']('ShowMailQueue',_0x15b30f);logger['debug'](_0xbdb5('0x26'),_0x15b30f,JSON[_0xbdb5('0x16')](_0x2066d7));_0x1f4dd2(_0x2066d7);})[_0xbdb5('0x25')](function(_0x875a5e){logger[_0xbdb5('0x17')](_0xbdb5('0x26'),_0x875a5e[_0xbdb5('0x18')],_0x15b30f);_0x5924d8(_0x15e370['error'](0x1f4,_0x875a5e[_0xbdb5('0x18')]));});});}; \ No newline at end of file +var _0x677e=['map','model','GetMailQueue','debug','ShowMailQueue','find','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','MailQueue','options','raw','where','attributes','include'];(function(_0x347ee1,_0x4f30ab){var _0x40e7f6=function(_0x228e65){while(--_0x228e65){_0x347ee1['push'](_0x347ee1['shift']());}};_0x40e7f6(++_0x4f30ab);}(_0x677e,0xd2));var _0xe677=function(_0x200045,_0x4e5da1){_0x200045=_0x200045-0x0;var _0x566a8d=_0x677e[_0x200045];return _0x566a8d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe677('0x0'));var BPromise=require(_0xe677('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe677('0x2'))['db'];var utils=require(_0xe677('0x3'));var logger=require(_0xe677('0x4'))('rpc');var config=require(_0xe677('0x5'));var jayson=require(_0xe677('0x6'));var client=jayson['client'][_0xe677('0x7')]({'port':0x232a});config[_0xe677('0x8')]=_['defaults'](config[_0xe677('0x8')],{'host':_0xe677('0x9'),'port':0x18eb});var socket=require(_0xe677('0xa'))(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x26a8ca,_0x2ee439,_0x3131df){return new BPromise(function(_0x4fd839,_0x289a8e){return client[_0xe677('0xb')](_0x26a8ca,_0x3131df)[_0xe677('0xc')](function(_0x390058){logger['info'](_0xe677('0xd'),_0x2ee439,_0xe677('0xe'));logger['debug'](_0xe677('0xf'),_0x2ee439,'request\x20sent',JSON[_0xe677('0x10')](_0x390058));if(_0x390058['error']){if(_0x390058[_0xe677('0x11')][_0xe677('0x12')]===0x1f4){logger[_0xe677('0x11')]('MailQueue,\x20%s,\x20%s',_0x2ee439,_0x390058['error'][_0xe677('0x13')]);return _0x289a8e(_0x390058[_0xe677('0x11')][_0xe677('0x13')]);}logger[_0xe677('0x11')](_0xe677('0xd'),_0x2ee439,_0x390058[_0xe677('0x11')][_0xe677('0x13')]);return _0x4fd839(_0x390058[_0xe677('0x11')][_0xe677('0x13')]);}else{logger[_0xe677('0x14')](_0xe677('0xd'),_0x2ee439,_0xe677('0xe'));_0x4fd839(_0x390058['result'][_0xe677('0x13')]);}})[_0xe677('0x15')](function(_0x1d294d){logger[_0xe677('0x11')](_0xe677('0xd'),_0x2ee439,_0x1d294d);_0x289a8e(_0x1d294d);});});}exports['GetMailQueue']=function(_0x37c4e2){var _0x50c433=this;return new Promise(function(_0x2ffa66,_0x571503){return db[_0xe677('0x16')]['findAll']({'raw':_0x37c4e2['options']?_0x37c4e2[_0xe677('0x17')][_0xe677('0x18')]===undefined?!![]:![]:!![],'where':_0x37c4e2['options']?_0x37c4e2[_0xe677('0x17')][_0xe677('0x19')]||null:null,'attributes':_0x37c4e2[_0xe677('0x17')]?_0x37c4e2[_0xe677('0x17')][_0xe677('0x1a')]||null:null,'limit':_0x37c4e2[_0xe677('0x17')]?_0x37c4e2[_0xe677('0x17')]['limit']||null:null,'include':_0x37c4e2['options']?_0x37c4e2[_0xe677('0x17')][_0xe677('0x1b')]?_[_0xe677('0x1c')](_0x37c4e2['options'][_0xe677('0x1b')],function(_0x128043){return{'model':db[_0x128043[_0xe677('0x1d')]],'as':_0x128043['as'],'attributes':_0x128043[_0xe677('0x1a')],'include':_0x128043[_0xe677('0x1b')]?_[_0xe677('0x1c')](_0x128043[_0xe677('0x1b')],function(_0x1f0706){return{'model':db[_0x1f0706['model']],'as':_0x1f0706['as'],'attributes':_0x1f0706[_0xe677('0x1a')],'include':_0x1f0706[_0xe677('0x1b')]?_[_0xe677('0x1c')](_0x1f0706[_0xe677('0x1b')],function(_0x29a041){return{'model':db[_0x29a041[_0xe677('0x1d')]],'as':_0x29a041['as'],'attributes':_0x29a041[_0xe677('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe677('0xc')](function(_0x597854){logger[_0xe677('0x14')](_0xe677('0x1e'),_0x37c4e2);logger[_0xe677('0x1f')]('GetMailQueue',_0x37c4e2,JSON[_0xe677('0x10')](_0x597854));_0x2ffa66(_0x597854);})[_0xe677('0x15')](function(_0x1c90c2){logger[_0xe677('0x11')](_0xe677('0x1e'),_0x1c90c2[_0xe677('0x13')],_0x37c4e2);_0x571503(_0x50c433[_0xe677('0x11')](0x1f4,_0x1c90c2[_0xe677('0x13')]));});});};exports[_0xe677('0x20')]=function(_0x42aad8){var _0x992d26=this;return new Promise(function(_0x36fcb5,_0x473038){return db[_0xe677('0x16')][_0xe677('0x21')]({'raw':_0x42aad8[_0xe677('0x17')]?_0x42aad8[_0xe677('0x17')][_0xe677('0x18')]===undefined?!![]:![]:!![],'where':_0x42aad8['options']?_0x42aad8[_0xe677('0x17')][_0xe677('0x19')]||null:null,'attributes':_0x42aad8[_0xe677('0x17')]?_0x42aad8['options'][_0xe677('0x1a')]||null:null,'include':_0x42aad8[_0xe677('0x17')]?_0x42aad8[_0xe677('0x17')][_0xe677('0x1b')]?_[_0xe677('0x1c')](_0x42aad8[_0xe677('0x17')][_0xe677('0x1b')],function(_0x42f719){return{'model':db[_0x42f719[_0xe677('0x1d')]],'as':_0x42f719['as'],'attributes':_0x42f719['attributes'],'include':_0x42f719[_0xe677('0x1b')]?_[_0xe677('0x1c')](_0x42f719['include'],function(_0x25e834){return{'model':db[_0x25e834['model']],'as':_0x25e834['as'],'attributes':_0x25e834[_0xe677('0x1a')],'include':_0x25e834[_0xe677('0x1b')]?_['map'](_0x25e834[_0xe677('0x1b')],function(_0x40900a){return{'model':db[_0x40900a['model']],'as':_0x40900a['as'],'attributes':_0x40900a[_0xe677('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe677('0xc')](function(_0x5d0f06){logger['info']('ShowMailQueue',_0x42aad8);logger[_0xe677('0x1f')]('ShowMailQueue',_0x42aad8,JSON[_0xe677('0x10')](_0x5d0f06));_0x36fcb5(_0x5d0f06);})['catch'](function(_0x2e67f4){logger[_0xe677('0x11')](_0xe677('0x20'),_0x2e67f4[_0xe677('0x13')],_0x42aad8);_0x473038(_0x992d26[_0xe677('0x11')](0x1f4,_0x2e67f4['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 9494a39..cda14bc 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 _0x4375=['remove','emit','register','length','mailQueue:','save'];(function(_0x539274,_0x18f798){var _0x542cb9=function(_0x53fe9a){while(--_0x53fe9a){_0x539274['push'](_0x539274['shift']());}};_0x542cb9(++_0x18f798);}(_0x4375,0x1a3));var _0x5437=function(_0x5f1d29,_0x5c6108){_0x5f1d29=_0x5f1d29-0x0;var _0x416705=_0x4375[_0x5f1d29];return _0x416705;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x5437('0x0'),_0x5437('0x1'),'update'];function createListener(_0x37bc3a,_0x3f6ac4){return function(_0x574846){_0x3f6ac4[_0x5437('0x2')](_0x37bc3a,_0x574846);};}function removeListener(_0x40470e,_0x3eb5fa){return function(){MailQueueEvents['removeListener'](_0x40470e,_0x3eb5fa);};}exports[_0x5437('0x3')]=function(_0x1a46e3){for(var _0x8aa1f9=0x0,_0x80234=events[_0x5437('0x4')];_0x8aa1f9<_0x80234;_0x8aa1f9++){var _0x4781c7=events[_0x8aa1f9];var _0x5a00b6=createListener(_0x5437('0x5')+_0x4781c7,_0x1a46e3);MailQueueEvents['on'](_0x4781c7,_0x5a00b6);}}; \ No newline at end of file +var _0x13e1=['length','./mailQueue.events','save','remove','emit'];(function(_0x3181cc,_0x28447f){var _0x547a4a=function(_0x3ede80){while(--_0x3ede80){_0x3181cc['push'](_0x3181cc['shift']());}};_0x547a4a(++_0x28447f);}(_0x13e1,0xb5));var _0x113e=function(_0x15aa66,_0x2e038b){_0x15aa66=_0x15aa66-0x0;var _0x1e2fed=_0x13e1[_0x15aa66];return _0x1e2fed;};'use strict';var MailQueueEvents=require(_0x113e('0x0'));var events=[_0x113e('0x1'),_0x113e('0x2'),'update'];function createListener(_0x23a533,_0xf5dde9){return function(_0x4ba4e6){_0xf5dde9[_0x113e('0x3')](_0x23a533,_0x4ba4e6);};}function removeListener(_0x2e2f71,_0x44fb08){return function(){MailQueueEvents['removeListener'](_0x2e2f71,_0x44fb08);};}exports['register']=function(_0xd68759){for(var _0x350048=0x0,_0x50f54b=events[_0x113e('0x4')];_0x350048<_0x50f54b;_0x350048++){var _0x29bd0c=events[_0x350048];var _0x5bd87e=createListener('mailQueue:'+_0x29bd0c,_0xd68759);MailQueueEvents['on'](_0x29bd0c,_0x5bd87e);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 39b7eee..331047f 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 _0xe64a=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','delete','destroy'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xe64a,0x1e0));var _0xae64=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe64a[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xae64('0x0'));var util=require(_0xae64('0x1'));var path=require(_0xae64('0x2'));var timeout=require(_0xae64('0x3'));var express=require(_0xae64('0x4'));var router=express[_0xae64('0x5')]();var fs_extra=require(_0xae64('0x6'));var auth=require(_0xae64('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0xae64('0x8')](),controller[_0xae64('0x9')]);router[_0xae64('0xa')](_0xae64('0xb'),auth[_0xae64('0x8')](),controller[_0xae64('0xc')]);router[_0xae64('0xa')](_0xae64('0xd'),auth[_0xae64('0x8')](),controller[_0xae64('0xe')]);router[_0xae64('0xf')]('/',auth['isAuthenticated'](),controller[_0xae64('0x10')]);router['put']('/:id',auth[_0xae64('0x8')](),controller[_0xae64('0x11')]);router[_0xae64('0x12')](_0xae64('0xd'),auth['isAuthenticated'](),controller[_0xae64('0x13')]);module['exports']=router; \ No newline at end of file +var _0x07c0=['../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0xacc5a7,_0x19cf31){var _0x5b2049=function(_0x292569){while(--_0x292569){_0xacc5a7['push'](_0xacc5a7['shift']());}};_0x5b2049(++_0x19cf31);}(_0x07c0,0x18a));var _0x007c=function(_0x57cbfb,_0x2de760){_0x57cbfb=_0x57cbfb-0x0;var _0x4cb933=_0x07c0[_0x57cbfb];return _0x4cb933;};'use strict';var multer=require(_0x007c('0x0'));var util=require(_0x007c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x007c('0x2'));var router=express[_0x007c('0x3')]();var fs_extra=require(_0x007c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x007c('0x5'));var config=require(_0x007c('0x6'));var controller=require(_0x007c('0x7'));router[_0x007c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x007c('0x8')](_0x007c('0x9'),auth[_0x007c('0xa')](),controller[_0x007c('0xb')]);router['get'](_0x007c('0xc'),auth['isAuthenticated'](),controller[_0x007c('0xd')]);router[_0x007c('0xe')]('/',auth['isAuthenticated'](),controller[_0x007c('0xf')]);router[_0x007c('0x10')](_0x007c('0xc'),auth[_0x007c('0xa')](),controller[_0x007c('0x11')]);router[_0x007c('0x12')](_0x007c('0xc'),auth['isAuthenticated'](),controller[_0x007c('0x13')]);module[_0x007c('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 764ec19..29228be 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 _0x9794=['DATE','moment','STRING'];(function(_0xc2f20e,_0x207162){var _0x153010=function(_0x38661f){while(--_0x38661f){_0xc2f20e['push'](_0xc2f20e['shift']());}};_0x153010(++_0x207162);}(_0x9794,0x169));var _0x4979=function(_0x3d1581,_0x3747b2){_0x3d1581=_0x3d1581-0x0;var _0x193c17=_0x9794[_0x3d1581];return _0x193c17;};'use strict';var moment=require(_0x4979('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x4979('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x4979('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4979('0x2')]},'acceptAt':{'type':Sequelize[_0x4979('0x2')]},'exitAt':{'type':Sequelize[_0x4979('0x2')]},'reason':{'type':Sequelize[_0x4979('0x1')]}}; \ No newline at end of file +var _0x8608=['moment','exports','STRING','DATE'];(function(_0x5da4f2,_0x117676){var _0xe521=function(_0x43f6e8){while(--_0x43f6e8){_0x5da4f2['push'](_0x5da4f2['shift']());}};_0xe521(++_0x117676);}(_0x8608,0x15c));var _0x8860=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8608[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x8860('0x0'));var Sequelize=require('sequelize');module[_0x8860('0x1')]={'uniqueid':{'type':Sequelize[_0x8860('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x8860('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8860('0x3')]},'acceptAt':{'type':Sequelize[_0x8860('0x3')]},'exitAt':{'type':Sequelize[_0x8860('0x3')]},'reason':{'type':Sequelize[_0x8860('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index d281c4b..10ce601 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 _0xdb50=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','set','Content-Range','reject','destroy','then','end','stack','name','send','render','merge','body','message','interaction','account','index','MailQueueReport','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','update','describe','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4b41ce,_0x39b3af){var _0x2cd4ce=function(_0x29e5e8){while(--_0x29e5e8){_0x4b41ce['push'](_0x4b41ce['shift']());}};_0x2cd4ce(++_0x39b3af);}(_0xdb50,0xd5));var _0x0db5=function(_0x3b2299,_0x54fbee){_0x3b2299=_0x3b2299-0x0;var _0x4a3977=_0xdb50[_0x3b2299];return _0x4a3977;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0db5('0x0'));var zipdir=require(_0x0db5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0db5('0x2'));var BPromise=require(_0x0db5('0x3'));var Mustache=require(_0x0db5('0x4'));var util=require(_0x0db5('0x5'));var path=require(_0x0db5('0x6'));var sox=require(_0x0db5('0x7'));var csv=require(_0x0db5('0x8'));var ejs=require(_0x0db5('0x9'));var fs=require('fs');var fs_extra=require(_0x0db5('0xa'));var _=require(_0x0db5('0xb'));var squel=require(_0x0db5('0xc'));var crypto=require(_0x0db5('0xd'));var jsforce=require(_0x0db5('0xe'));var deskjs=require(_0x0db5('0xf'));var toCsv=require(_0x0db5('0x8'));var querystring=require(_0x0db5('0x10'));var Papa=require(_0x0db5('0x11'));var Redis=require(_0x0db5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0db5('0x13'));var as=require(_0x0db5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0db5('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0db5('0x16'))['db'];function respondWithStatusCode(_0x4ac74c,_0x407e91){_0x407e91=_0x407e91||0xcc;return function(_0x52086d){if(_0x52086d){return _0x4ac74c['sendStatus'](_0x407e91);}return _0x4ac74c[_0x0db5('0x17')](_0x407e91)['end']();};}function respondWithResult(_0x402fa3,_0x20835d){_0x20835d=_0x20835d||0xc8;return function(_0x450470){if(_0x450470){return _0x402fa3[_0x0db5('0x17')](_0x20835d)[_0x0db5('0x18')](_0x450470);}};}function respondWithFilteredResult(_0x46b8b9,_0x395cc2){return function(_0xe75a34){if(_0xe75a34){var _0x4f3164=typeof _0x395cc2[_0x0db5('0x19')]===_0x0db5('0x1a')&&typeof _0x395cc2['limit']===_0x0db5('0x1a');var _0x4c659a=_0xe75a34['count'];var _0x466594=_0x4f3164?0x0:_0x395cc2[_0x0db5('0x19')];var _0x3eb465=_0x4f3164?_0xe75a34['count']:_0x395cc2[_0x0db5('0x19')]+_0x395cc2[_0x0db5('0x1b')];var _0x14a5d4;if(_0x3eb465>=_0x4c659a){_0x3eb465=_0x4c659a;_0x14a5d4=0xc8;}else{_0x14a5d4=0xce;}_0x46b8b9[_0x0db5('0x17')](_0x14a5d4);return _0x46b8b9[_0x0db5('0x1c')](_0x0db5('0x1d'),_0x466594+'-'+_0x3eb465+'/'+_0x4c659a)[_0x0db5('0x18')](_0xe75a34);}return null;};}function patchUpdates(_0x23ef4f){return function(_0x55ae8d){try{jsonpatch['apply'](_0x55ae8d,_0x23ef4f,!![]);}catch(_0xfff2fd){return BPromise[_0x0db5('0x1e')](_0xfff2fd);}return _0x55ae8d['save']();};}function saveUpdates(_0x2e29a2,_0x5b87ee){return function(_0x4d0ecc){if(_0x4d0ecc){return _0x4d0ecc['update'](_0x2e29a2)['then'](function(_0x3978f8){return _0x3978f8;});}return null;};}function removeEntity(_0x11671a,_0x556f47){return function(_0x4a787e){if(_0x4a787e){return _0x4a787e[_0x0db5('0x1f')]()[_0x0db5('0x20')](function(){_0x11671a[_0x0db5('0x17')](0xcc)[_0x0db5('0x21')]();});}};}function handleEntityNotFound(_0x474151,_0x39dd4a){return function(_0x488e4d){if(!_0x488e4d){_0x474151['sendStatus'](0x194);}return _0x488e4d;};}function handleError(_0x5d64ed,_0x1fe530){_0x1fe530=_0x1fe530||0x1f4;return function(_0x1c8a04){logger['error'](_0x1c8a04[_0x0db5('0x22')]);if(_0x1c8a04[_0x0db5('0x23')]){delete _0x1c8a04[_0x0db5('0x23')];}_0x5d64ed[_0x0db5('0x17')](_0x1fe530)[_0x0db5('0x24')](_0x1c8a04);};}function getMustacheRender(_0x1923b1,_0x9d8d4e){return Mustache[_0x0db5('0x25')](_0x1923b1,_[_0x0db5('0x26')](_0x9d8d4e[_0x0db5('0x27')],{'contact':_0x9d8d4e['contact'],'message':_0x9d8d4e[_0x0db5('0x28')],'agent':_0x9d8d4e['agent'],'interaction':_0x9d8d4e[_0x0db5('0x29')],'account':_0x9d8d4e[_0x0db5('0x2a')]}))||'';}exports[_0x0db5('0x2b')]=function(_0x5d539e,_0x920a95){var _0x4f1d32={},_0x5c40c8={},_0x1950c6={'count':0x0,'rows':[]};var _0x3c3361=_['map'](db[_0x0db5('0x2c')]['rawAttributes'],function(_0x16eadf){return{'name':_0x16eadf[_0x0db5('0x2d')],'type':_0x16eadf[_0x0db5('0x2e')][_0x0db5('0x2f')]};});_0x5c40c8[_0x0db5('0x30')]=_[_0x0db5('0x31')](_0x3c3361,'name');_0x5c40c8[_0x0db5('0x32')]=_[_0x0db5('0x33')](_0x5d539e[_0x0db5('0x32')]);_0x5c40c8[_0x0db5('0x34')]=_[_0x0db5('0x35')](_0x5c40c8[_0x0db5('0x30')],_0x5c40c8[_0x0db5('0x32')]);_0x4f1d32['attributes']=_['intersection'](_0x5c40c8[_0x0db5('0x30')],qs[_0x0db5('0x36')](_0x5d539e[_0x0db5('0x32')][_0x0db5('0x36')]));_0x4f1d32[_0x0db5('0x37')]=_0x4f1d32[_0x0db5('0x37')][_0x0db5('0x38')]?_0x4f1d32['attributes']:_0x5c40c8[_0x0db5('0x30')];if(!_0x5d539e[_0x0db5('0x32')][_0x0db5('0x39')](_0x0db5('0x3a'))){_0x4f1d32[_0x0db5('0x1b')]=qs[_0x0db5('0x1b')](_0x5d539e[_0x0db5('0x32')][_0x0db5('0x1b')]);_0x4f1d32[_0x0db5('0x19')]=qs[_0x0db5('0x19')](_0x5d539e[_0x0db5('0x32')]['offset']);}_0x4f1d32['order']=qs[_0x0db5('0x3b')](_0x5d539e[_0x0db5('0x32')][_0x0db5('0x3b')]);_0x4f1d32[_0x0db5('0x3c')]=qs[_0x0db5('0x34')](_[_0x0db5('0x3d')](_0x5d539e[_0x0db5('0x32')],_0x5c40c8[_0x0db5('0x34')]),_0x3c3361);if(_0x5d539e[_0x0db5('0x32')]['filter']){_0x4f1d32[_0x0db5('0x3c')]=_[_0x0db5('0x26')](_0x4f1d32[_0x0db5('0x3c')],{'$or':_['map'](_0x3c3361,function(_0x14a3df){if(_0x14a3df[_0x0db5('0x2e')]!==_0x0db5('0x3e')){var _0x31883c={};_0x31883c[_0x14a3df[_0x0db5('0x23')]]={'$like':'%'+_0x5d539e[_0x0db5('0x32')][_0x0db5('0x3f')]+'%'};return _0x31883c;}})});}_0x4f1d32=_[_0x0db5('0x26')]({},_0x4f1d32,_0x5d539e[_0x0db5('0x40')]);var _0x62778d={'where':_0x4f1d32['where']};return db['MailQueueReport'][_0x0db5('0x41')](_0x62778d)['then'](function(_0x4d7330){_0x1950c6[_0x0db5('0x41')]=_0x4d7330;if(_0x5d539e[_0x0db5('0x32')][_0x0db5('0x42')]){_0x4f1d32[_0x0db5('0x43')]=[{'all':!![]}];}return db['MailQueueReport'][_0x0db5('0x44')](_0x4f1d32);})[_0x0db5('0x20')](function(_0x20004b){_0x1950c6[_0x0db5('0x45')]=_0x20004b;return _0x1950c6;})[_0x0db5('0x20')](respondWithFilteredResult(_0x920a95,_0x4f1d32))[_0x0db5('0x46')](handleError(_0x920a95,null));};exports['show']=function(_0x544ae4,_0x418248){var _0x409571={'raw':!![],'where':{'id':_0x544ae4[_0x0db5('0x47')]['id']}},_0x5e427a={};_0x5e427a[_0x0db5('0x30')]=_[_0x0db5('0x33')](db[_0x0db5('0x2c')][_0x0db5('0x48')]);_0x5e427a[_0x0db5('0x32')]=_[_0x0db5('0x33')](_0x544ae4[_0x0db5('0x32')]);_0x5e427a[_0x0db5('0x34')]=_[_0x0db5('0x35')](_0x5e427a['model'],_0x5e427a[_0x0db5('0x32')]);_0x409571[_0x0db5('0x37')]=_[_0x0db5('0x35')](_0x5e427a[_0x0db5('0x30')],qs['fields'](_0x544ae4[_0x0db5('0x32')][_0x0db5('0x36')]));_0x409571[_0x0db5('0x37')]=_0x409571['attributes'][_0x0db5('0x38')]?_0x409571[_0x0db5('0x37')]:_0x5e427a[_0x0db5('0x30')];if(_0x544ae4[_0x0db5('0x32')][_0x0db5('0x42')]){_0x409571[_0x0db5('0x43')]=[{'all':!![]}];}_0x409571=_['merge']({},_0x409571,_0x544ae4['options']);return db['MailQueueReport'][_0x0db5('0x49')](_0x409571)[_0x0db5('0x20')](handleEntityNotFound(_0x418248,null))['then'](respondWithResult(_0x418248,null))[_0x0db5('0x46')](handleError(_0x418248,null));};exports[_0x0db5('0x4a')]=function(_0x25c969,_0x4c9bb7){return db[_0x0db5('0x2c')][_0x0db5('0x4a')](_0x25c969[_0x0db5('0x27')],{})[_0x0db5('0x20')](respondWithResult(_0x4c9bb7,0xc9))[_0x0db5('0x46')](handleError(_0x4c9bb7,null));};exports[_0x0db5('0x4b')]=function(_0x4aa572,_0x5f16d9){if(_0x4aa572[_0x0db5('0x27')]['id']){delete _0x4aa572[_0x0db5('0x27')]['id'];}return db[_0x0db5('0x2c')][_0x0db5('0x49')]({'where':{'id':_0x4aa572['params']['id']}})[_0x0db5('0x20')](handleEntityNotFound(_0x5f16d9,null))[_0x0db5('0x20')](saveUpdates(_0x4aa572['body'],null))[_0x0db5('0x20')](respondWithResult(_0x5f16d9,null))[_0x0db5('0x46')](handleError(_0x5f16d9,null));};exports['destroy']=function(_0x159731,_0x17c611){return db['MailQueueReport'][_0x0db5('0x49')]({'where':{'id':_0x159731['params']['id']}})[_0x0db5('0x20')](handleEntityNotFound(_0x17c611,null))['then'](removeEntity(_0x17c611,null))[_0x0db5('0x46')](handleError(_0x17c611,null));};exports[_0x0db5('0x4c')]=function(_0x5eb089,_0xc461e6){return db[_0x0db5('0x2c')][_0x0db5('0x4c')]()[_0x0db5('0x20')](respondWithResult(_0xc461e6,null))[_0x0db5('0x46')](handleError(_0xc461e6,null));}; \ No newline at end of file +var _0xc5e5=['interaction','account','map','MailQueueReport','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','render','merge','body','contact','message','agent'];(function(_0x22a1bd,_0x3e440f){var _0x321421=function(_0x1c8a58){while(--_0x1c8a58){_0x22a1bd['push'](_0x22a1bd['shift']());}};_0x321421(++_0x3e440f);}(_0xc5e5,0x111));var _0x5c5e=function(_0x31a293,_0x14670c){_0x31a293=_0x31a293-0x0;var _0x235cca=_0xc5e5[_0x31a293];return _0x235cca;};'use strict';var emlformat=require(_0x5c5e('0x0'));var rimraf=require(_0x5c5e('0x1'));var zipdir=require(_0x5c5e('0x2'));var jsonpatch=require(_0x5c5e('0x3'));var rp=require(_0x5c5e('0x4'));var moment=require('moment');var BPromise=require(_0x5c5e('0x5'));var Mustache=require('mustache');var util=require(_0x5c5e('0x6'));var path=require(_0x5c5e('0x7'));var sox=require('sox');var csv=require(_0x5c5e('0x8'));var ejs=require(_0x5c5e('0x9'));var fs=require('fs');var fs_extra=require(_0x5c5e('0xa'));var _=require(_0x5c5e('0xb'));var squel=require(_0x5c5e('0xc'));var crypto=require(_0x5c5e('0xd'));var jsforce=require(_0x5c5e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5c5e('0x8'));var querystring=require(_0x5c5e('0xf'));var Papa=require('papaparse');var Redis=require(_0x5c5e('0x10'));var authService=require(_0x5c5e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5c5e('0x12'));var utils=require(_0x5c5e('0x13'));var config=require(_0x5c5e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c5e('0x15'))['db'];function respondWithStatusCode(_0x2899e1,_0x30a82b){_0x30a82b=_0x30a82b||0xcc;return function(_0x3be3f8){if(_0x3be3f8){return _0x2899e1[_0x5c5e('0x16')](_0x30a82b);}return _0x2899e1[_0x5c5e('0x17')](_0x30a82b)[_0x5c5e('0x18')]();};}function respondWithResult(_0x14a7b3,_0x2349d0){_0x2349d0=_0x2349d0||0xc8;return function(_0x2ecf66){if(_0x2ecf66){return _0x14a7b3['status'](_0x2349d0)[_0x5c5e('0x19')](_0x2ecf66);}};}function respondWithFilteredResult(_0x1f181a,_0x1bb9dc){return function(_0x1ff228){if(_0x1ff228){var _0x2a68c7=typeof _0x1bb9dc[_0x5c5e('0x1a')]===_0x5c5e('0x1b')&&typeof _0x1bb9dc[_0x5c5e('0x1c')]==='undefined';var _0x74d2a8=_0x1ff228[_0x5c5e('0x1d')];var _0x3a8e2f=_0x2a68c7?0x0:_0x1bb9dc['offset'];var _0x369b82=_0x2a68c7?_0x1ff228[_0x5c5e('0x1d')]:_0x1bb9dc['offset']+_0x1bb9dc[_0x5c5e('0x1c')];var _0x492885;if(_0x369b82>=_0x74d2a8){_0x369b82=_0x74d2a8;_0x492885=0xc8;}else{_0x492885=0xce;}_0x1f181a[_0x5c5e('0x17')](_0x492885);return _0x1f181a[_0x5c5e('0x1e')]('Content-Range',_0x3a8e2f+'-'+_0x369b82+'/'+_0x74d2a8)[_0x5c5e('0x19')](_0x1ff228);}return null;};}function patchUpdates(_0x16d3d7){return function(_0x34c0d8){try{jsonpatch[_0x5c5e('0x1f')](_0x34c0d8,_0x16d3d7,!![]);}catch(_0x506c88){return BPromise[_0x5c5e('0x20')](_0x506c88);}return _0x34c0d8[_0x5c5e('0x21')]();};}function saveUpdates(_0x2d7b27,_0x498b29){return function(_0x477b9d){if(_0x477b9d){return _0x477b9d[_0x5c5e('0x22')](_0x2d7b27)[_0x5c5e('0x23')](function(_0x55467e){return _0x55467e;});}return null;};}function removeEntity(_0x4f8251,_0x29fa48){return function(_0x1cba51){if(_0x1cba51){return _0x1cba51[_0x5c5e('0x24')]()[_0x5c5e('0x23')](function(){_0x4f8251[_0x5c5e('0x17')](0xcc)[_0x5c5e('0x18')]();});}};}function handleEntityNotFound(_0x60af27,_0x62f0dd){return function(_0x529587){if(!_0x529587){_0x60af27[_0x5c5e('0x16')](0x194);}return _0x529587;};}function handleError(_0x4d6f6e,_0x3dde42){_0x3dde42=_0x3dde42||0x1f4;return function(_0x5f5782){logger[_0x5c5e('0x25')](_0x5f5782[_0x5c5e('0x26')]);if(_0x5f5782[_0x5c5e('0x27')]){delete _0x5f5782[_0x5c5e('0x27')];}_0x4d6f6e[_0x5c5e('0x17')](_0x3dde42)[_0x5c5e('0x28')](_0x5f5782);};}function getMustacheRender(_0xc6660a,_0x2d0a3c){return Mustache[_0x5c5e('0x29')](_0xc6660a,_[_0x5c5e('0x2a')](_0x2d0a3c[_0x5c5e('0x2b')],{'contact':_0x2d0a3c[_0x5c5e('0x2c')],'message':_0x2d0a3c[_0x5c5e('0x2d')],'agent':_0x2d0a3c[_0x5c5e('0x2e')],'interaction':_0x2d0a3c[_0x5c5e('0x2f')],'account':_0x2d0a3c[_0x5c5e('0x30')]}))||'';}exports['index']=function(_0x47e246,_0x360582){var _0x161ac8={},_0x3609a0={},_0x22a5cf={'count':0x0,'rows':[]};var _0x66af7=_[_0x5c5e('0x31')](db[_0x5c5e('0x32')]['rawAttributes'],function(_0xcf9e9){return{'name':_0xcf9e9['fieldName'],'type':_0xcf9e9[_0x5c5e('0x33')][_0x5c5e('0x34')]};});_0x3609a0[_0x5c5e('0x35')]=_['map'](_0x66af7,_0x5c5e('0x27'));_0x3609a0['query']=_[_0x5c5e('0x36')](_0x47e246[_0x5c5e('0x37')]);_0x3609a0['filters']=_[_0x5c5e('0x38')](_0x3609a0['model'],_0x3609a0[_0x5c5e('0x37')]);_0x161ac8['attributes']=_[_0x5c5e('0x38')](_0x3609a0['model'],qs[_0x5c5e('0x39')](_0x47e246[_0x5c5e('0x37')][_0x5c5e('0x39')]));_0x161ac8[_0x5c5e('0x3a')]=_0x161ac8[_0x5c5e('0x3a')]['length']?_0x161ac8['attributes']:_0x3609a0[_0x5c5e('0x35')];if(!_0x47e246[_0x5c5e('0x37')][_0x5c5e('0x3b')](_0x5c5e('0x3c'))){_0x161ac8['limit']=qs['limit'](_0x47e246[_0x5c5e('0x37')]['limit']);_0x161ac8['offset']=qs['offset'](_0x47e246[_0x5c5e('0x37')][_0x5c5e('0x1a')]);}_0x161ac8[_0x5c5e('0x3d')]=qs[_0x5c5e('0x3e')](_0x47e246['query']['sort']);_0x161ac8['where']=qs['filters'](_[_0x5c5e('0x3f')](_0x47e246['query'],_0x3609a0[_0x5c5e('0x40')]),_0x66af7);if(_0x47e246[_0x5c5e('0x37')][_0x5c5e('0x41')]){_0x161ac8[_0x5c5e('0x42')]=_[_0x5c5e('0x2a')](_0x161ac8[_0x5c5e('0x42')],{'$or':_[_0x5c5e('0x31')](_0x66af7,function(_0x45eaf0){if(_0x45eaf0[_0x5c5e('0x33')]!==_0x5c5e('0x43')){var _0x24c7a4={};_0x24c7a4[_0x45eaf0['name']]={'$like':'%'+_0x47e246['query'][_0x5c5e('0x41')]+'%'};return _0x24c7a4;}})});}_0x161ac8=_[_0x5c5e('0x2a')]({},_0x161ac8,_0x47e246[_0x5c5e('0x44')]);var _0x24a7d3={'where':_0x161ac8[_0x5c5e('0x42')]};return db[_0x5c5e('0x32')][_0x5c5e('0x1d')](_0x24a7d3)[_0x5c5e('0x23')](function(_0x3d9e1b){_0x22a5cf[_0x5c5e('0x1d')]=_0x3d9e1b;if(_0x47e246[_0x5c5e('0x37')][_0x5c5e('0x45')]){_0x161ac8[_0x5c5e('0x46')]=[{'all':!![]}];}return db[_0x5c5e('0x32')][_0x5c5e('0x47')](_0x161ac8);})['then'](function(_0x11e67f){_0x22a5cf['rows']=_0x11e67f;return _0x22a5cf;})['then'](respondWithFilteredResult(_0x360582,_0x161ac8))[_0x5c5e('0x48')](handleError(_0x360582,null));};exports[_0x5c5e('0x49')]=function(_0x1980a1,_0x480175){var _0x1a6f03={'raw':!![],'where':{'id':_0x1980a1[_0x5c5e('0x4a')]['id']}},_0x2487c5={};_0x2487c5[_0x5c5e('0x35')]=_[_0x5c5e('0x36')](db['MailQueueReport'][_0x5c5e('0x4b')]);_0x2487c5[_0x5c5e('0x37')]=_['keys'](_0x1980a1['query']);_0x2487c5[_0x5c5e('0x40')]=_['intersection'](_0x2487c5['model'],_0x2487c5['query']);_0x1a6f03[_0x5c5e('0x3a')]=_[_0x5c5e('0x38')](_0x2487c5[_0x5c5e('0x35')],qs[_0x5c5e('0x39')](_0x1980a1[_0x5c5e('0x37')]['fields']));_0x1a6f03[_0x5c5e('0x3a')]=_0x1a6f03['attributes'][_0x5c5e('0x4c')]?_0x1a6f03[_0x5c5e('0x3a')]:_0x2487c5['model'];if(_0x1980a1['query'][_0x5c5e('0x45')]){_0x1a6f03[_0x5c5e('0x46')]=[{'all':!![]}];}_0x1a6f03=_[_0x5c5e('0x2a')]({},_0x1a6f03,_0x1980a1[_0x5c5e('0x44')]);return db[_0x5c5e('0x32')][_0x5c5e('0x4d')](_0x1a6f03)[_0x5c5e('0x23')](handleEntityNotFound(_0x480175,null))['then'](respondWithResult(_0x480175,null))[_0x5c5e('0x48')](handleError(_0x480175,null));};exports[_0x5c5e('0x4e')]=function(_0x4e2a9e,_0x108a40){return db[_0x5c5e('0x32')][_0x5c5e('0x4e')](_0x4e2a9e[_0x5c5e('0x2b')],{})[_0x5c5e('0x23')](respondWithResult(_0x108a40,0xc9))['catch'](handleError(_0x108a40,null));};exports[_0x5c5e('0x22')]=function(_0x150a04,_0x2e9047){if(_0x150a04[_0x5c5e('0x2b')]['id']){delete _0x150a04['body']['id'];}return db[_0x5c5e('0x32')]['find']({'where':{'id':_0x150a04[_0x5c5e('0x4a')]['id']}})[_0x5c5e('0x23')](handleEntityNotFound(_0x2e9047,null))[_0x5c5e('0x23')](saveUpdates(_0x150a04[_0x5c5e('0x2b')],null))[_0x5c5e('0x23')](respondWithResult(_0x2e9047,null))[_0x5c5e('0x48')](handleError(_0x2e9047,null));};exports[_0x5c5e('0x24')]=function(_0x338000,_0x3452ea){return db[_0x5c5e('0x32')]['find']({'where':{'id':_0x338000['params']['id']}})[_0x5c5e('0x23')](handleEntityNotFound(_0x3452ea,null))[_0x5c5e('0x23')](removeEntity(_0x3452ea,null))[_0x5c5e('0x48')](handleError(_0x3452ea,null));};exports[_0x5c5e('0x4f')]=function(_0x5bebb3,_0x40654a){return db[_0x5c5e('0x32')][_0x5c5e('0x4f')]()[_0x5c5e('0x23')](respondWithResult(_0x40654a,null))[_0x5c5e('0x48')](handleError(_0x40654a,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 12e2a01..0fb903b 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 _0xc0c5=['../../config/environment','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xc0c5,0x148));var _0x5c0c=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0xc0c5[_0x102f97];return _0xd22058;};'use strict';var _=require('lodash');var util=require(_0x5c0c('0x0'));var logger=require(_0x5c0c('0x1'))(_0x5c0c('0x2'));var moment=require(_0x5c0c('0x3'));var BPromise=require(_0x5c0c('0x4'));var rp=require(_0x5c0c('0x5'));var fs=require('fs');var path=require(_0x5c0c('0x6'));var rimraf=require(_0x5c0c('0x7'));var config=require(_0x5c0c('0x8'));var attributes=require('./mailQueueReport.attributes');module[_0x5c0c('0x9')]=function(_0x51d33c,_0x502dde){return _0x51d33c[_0x5c0c('0xa')](_0x5c0c('0xb'),attributes,{'tableName':_0x5c0c('0xc'),'paranoid':![],'indexes':[{'name':_0x5c0c('0xd'),'fields':[_0x5c0c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x63f6=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid'];(function(_0x3576f4,_0x26ebb1){var _0x2251dd=function(_0x556a76){while(--_0x556a76){_0x3576f4['push'](_0x3576f4['shift']());}};_0x2251dd(++_0x26ebb1);}(_0x63f6,0xf7));var _0x663f=function(_0x15ad02,_0x56ace9){_0x15ad02=_0x15ad02-0x0;var _0x3c87da=_0x63f6[_0x15ad02];return _0x3c87da;};'use strict';var _=require('lodash');var util=require(_0x663f('0x0'));var logger=require(_0x663f('0x1'))(_0x663f('0x2'));var moment=require(_0x663f('0x3'));var BPromise=require(_0x663f('0x4'));var rp=require(_0x663f('0x5'));var fs=require('fs');var path=require(_0x663f('0x6'));var rimraf=require('rimraf');var config=require(_0x663f('0x7'));var attributes=require(_0x663f('0x8'));module[_0x663f('0x9')]=function(_0x107530,_0x215be6){return _0x107530[_0x663f('0xa')](_0x663f('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x663f('0xc'),'fields':[_0x663f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 83233b1..7c6a246 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 _0xd99b=['CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','where','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','MailQueueReport,\x20%s,\x20%s','message','result','catch'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0xd99b,0x196));var _0xbd99=function(_0x57e5db,_0x3d6ace){_0x57e5db=_0x57e5db-0x0;var _0x2c1f43=_0xd99b[_0x57e5db];return _0x2c1f43;};'use strict';var _=require(_0xbd99('0x0'));var util=require(_0xbd99('0x1'));var moment=require('moment');var BPromise=require(_0xbd99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd99('0x3'));var db=require(_0xbd99('0x4'))['db'];var utils=require(_0xbd99('0x5'));var logger=require(_0xbd99('0x6'))('rpc');var config=require(_0xbd99('0x7'));var jayson=require(_0xbd99('0x8'));var client=jayson[_0xbd99('0x9')][_0xbd99('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x146413,_0x19211e,_0x516104){return new BPromise(function(_0x29f8fa,_0x8c9809){return client[_0xbd99('0xb')](_0x146413,_0x516104)[_0xbd99('0xc')](function(_0x133881){logger[_0xbd99('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x19211e,_0xbd99('0xe'));logger[_0xbd99('0xf')](_0xbd99('0x10'),_0x19211e,_0xbd99('0xe'),JSON[_0xbd99('0x11')](_0x133881));if(_0x133881[_0xbd99('0x12')]){if(_0x133881[_0xbd99('0x12')]['code']===0x1f4){logger['error'](_0xbd99('0x13'),_0x19211e,_0x133881['error']['message']);return _0x8c9809(_0x133881[_0xbd99('0x12')]['message']);}logger[_0xbd99('0x12')](_0xbd99('0x13'),_0x19211e,_0x133881[_0xbd99('0x12')][_0xbd99('0x14')]);return _0x29f8fa(_0x133881['error'][_0xbd99('0x14')]);}else{logger[_0xbd99('0xd')](_0xbd99('0x13'),_0x19211e,_0xbd99('0xe'));_0x29f8fa(_0x133881[_0xbd99('0x15')]['message']);}})[_0xbd99('0x16')](function(_0xf188ae){logger['error'](_0xbd99('0x13'),_0x19211e,_0xf188ae);_0x8c9809(_0xf188ae);});});}exports[_0xbd99('0x17')]=function(_0x2784f0){var _0x142acd=this;return new Promise(function(_0x5e8666,_0x10bc3b){return db[_0xbd99('0x18')][_0xbd99('0x19')](_0x2784f0[_0xbd99('0x1a')],{'raw':_0x2784f0[_0xbd99('0x1b')]?_0x2784f0[_0xbd99('0x1b')][_0xbd99('0x1c')]===undefined?!![]:![]:!![]})[_0xbd99('0xc')](function(_0x30cb92){logger['info'](_0xbd99('0x17'),_0x2784f0);logger[_0xbd99('0xf')](_0xbd99('0x17'),_0x2784f0,JSON[_0xbd99('0x11')](_0x30cb92));_0x5e8666(_0x30cb92);})[_0xbd99('0x16')](function(_0x3645da){logger[_0xbd99('0x12')]('CreateMailQueueReport',_0x3645da[_0xbd99('0x14')],_0x2784f0);_0x10bc3b(_0x142acd[_0xbd99('0x12')](0x1f4,_0x3645da['message']));});});};exports[_0xbd99('0x1d')]=function(_0x4f2972){var _0x25bb68=this;return new Promise(function(_0x2cdcc3,_0x2a4b9e){return db[_0xbd99('0x18')][_0xbd99('0x1e')](_0x4f2972[_0xbd99('0x1a')],{'raw':_0x4f2972['options']?_0x4f2972[_0xbd99('0x1b')][_0xbd99('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f2972[_0xbd99('0x1b')]?_0x4f2972['options'][_0xbd99('0x1f')]||null:null,'attributes':_0x4f2972[_0xbd99('0x1b')]?_0x4f2972['options']['attributes']||null:null,'limit':_0x4f2972[_0xbd99('0x1b')]?_0x4f2972[_0xbd99('0x1b')][_0xbd99('0x20')]||null:null})[_0xbd99('0xc')](function(_0x1243be){logger[_0xbd99('0xd')](_0xbd99('0x1d'),_0x4f2972);logger['debug'](_0xbd99('0x1d'),_0x4f2972,JSON[_0xbd99('0x11')](_0x1243be));_0x2cdcc3(_0x1243be);})[_0xbd99('0x16')](function(_0x947e31){logger[_0xbd99('0x12')](_0xbd99('0x1d'),_0x947e31[_0xbd99('0x14')],_0x4f2972);_0x2a4b9e(_0x25bb68[_0xbd99('0x12')](0x1f4,_0x947e31[_0xbd99('0x14')]));});});}; \ No newline at end of file +var _0xaa81=['result','CreateMailQueueReport','MailQueueReport','create','body','options','UpdateMailQueueReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x29fd93,_0x6a1557){var _0x27ff96=function(_0x551d7a){while(--_0x551d7a){_0x29fd93['push'](_0x29fd93['shift']());}};_0x27ff96(++_0x6a1557);}(_0xaa81,0x1d3));var _0x1aa8=function(_0x42a59f,_0x57944d){_0x42a59f=_0x42a59f-0x0;var _0x2cc836=_0xaa81[_0x42a59f];return _0x2cc836;};'use strict';var _=require(_0x1aa8('0x0'));var util=require(_0x1aa8('0x1'));var moment=require(_0x1aa8('0x2'));var BPromise=require(_0x1aa8('0x3'));var rs=require(_0x1aa8('0x4'));var fs=require('fs');var Redis=require(_0x1aa8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1aa8('0x6'));var logger=require(_0x1aa8('0x7'))(_0x1aa8('0x8'));var config=require(_0x1aa8('0x9'));var jayson=require(_0x1aa8('0xa'));var client=jayson[_0x1aa8('0xb')][_0x1aa8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33f83c,_0x3e2230,_0x2ff39a){return new BPromise(function(_0x36d5d6,_0x425355){return client[_0x1aa8('0xd')](_0x33f83c,_0x2ff39a)[_0x1aa8('0xe')](function(_0x16597e){logger[_0x1aa8('0xf')](_0x1aa8('0x10'),_0x3e2230,'request\x20sent');logger[_0x1aa8('0x11')](_0x1aa8('0x12'),_0x3e2230,_0x1aa8('0x13'),JSON[_0x1aa8('0x14')](_0x16597e));if(_0x16597e[_0x1aa8('0x15')]){if(_0x16597e[_0x1aa8('0x15')]['code']===0x1f4){logger[_0x1aa8('0x15')]('MailQueueReport,\x20%s,\x20%s',_0x3e2230,_0x16597e[_0x1aa8('0x15')][_0x1aa8('0x16')]);return _0x425355(_0x16597e[_0x1aa8('0x15')][_0x1aa8('0x16')]);}logger['error'](_0x1aa8('0x10'),_0x3e2230,_0x16597e[_0x1aa8('0x15')][_0x1aa8('0x16')]);return _0x36d5d6(_0x16597e[_0x1aa8('0x15')][_0x1aa8('0x16')]);}else{logger[_0x1aa8('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3e2230,_0x1aa8('0x13'));_0x36d5d6(_0x16597e[_0x1aa8('0x17')][_0x1aa8('0x16')]);}})['catch'](function(_0x47f9ad){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x3e2230,_0x47f9ad);_0x425355(_0x47f9ad);});});}exports[_0x1aa8('0x18')]=function(_0x2984db){var _0x2b8777=this;return new Promise(function(_0x1fac82,_0x77a30d){return db[_0x1aa8('0x19')][_0x1aa8('0x1a')](_0x2984db[_0x1aa8('0x1b')],{'raw':_0x2984db[_0x1aa8('0x1c')]?_0x2984db[_0x1aa8('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x1aa8('0xe')](function(_0x506ae1){logger[_0x1aa8('0xf')]('CreateMailQueueReport',_0x2984db);logger[_0x1aa8('0x11')]('CreateMailQueueReport',_0x2984db,JSON[_0x1aa8('0x14')](_0x506ae1));_0x1fac82(_0x506ae1);})['catch'](function(_0x3178f3){logger[_0x1aa8('0x15')](_0x1aa8('0x18'),_0x3178f3['message'],_0x2984db);_0x77a30d(_0x2b8777[_0x1aa8('0x15')](0x1f4,_0x3178f3[_0x1aa8('0x16')]));});});};exports[_0x1aa8('0x1d')]=function(_0x28fa58){var _0x37383c=this;return new Promise(function(_0x573195,_0x57edf3){return db[_0x1aa8('0x19')][_0x1aa8('0x1e')](_0x28fa58[_0x1aa8('0x1b')],{'raw':_0x28fa58['options']?_0x28fa58['options'][_0x1aa8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28fa58['options']?_0x28fa58[_0x1aa8('0x1c')][_0x1aa8('0x20')]||null:null,'attributes':_0x28fa58[_0x1aa8('0x1c')]?_0x28fa58[_0x1aa8('0x1c')][_0x1aa8('0x21')]||null:null,'limit':_0x28fa58['options']?_0x28fa58[_0x1aa8('0x1c')][_0x1aa8('0x22')]||null:null})[_0x1aa8('0xe')](function(_0x3ae92f){logger[_0x1aa8('0xf')](_0x1aa8('0x1d'),_0x28fa58);logger[_0x1aa8('0x11')]('UpdateMailQueueReport',_0x28fa58,JSON['stringify'](_0x3ae92f));_0x573195(_0x3ae92f);})['catch'](function(_0x933f4){logger[_0x1aa8('0x15')](_0x1aa8('0x1d'),_0x933f4[_0x1aa8('0x16')],_0x28fa58);_0x57edf3(_0x37383c['error'](0x1f4,_0x933f4[_0x1aa8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 48fd904..9ade637 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 _0x1123=['Router','fs-extra','../../config/environment','exports','path','express'];(function(_0xd07a7c,_0x336f87){var _0x397c71=function(_0x518a48){while(--_0x518a48){_0xd07a7c['push'](_0xd07a7c['shift']());}};_0x397c71(++_0x336f87);}(_0x1123,0x118));var _0x3112=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1123[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3112('0x0'));var timeout=require('connect-timeout');var express=require(_0x3112('0x1'));var router=express[_0x3112('0x2')]();var fs_extra=require(_0x3112('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3112('0x4'));module[_0x3112('0x5')]=router; \ No newline at end of file +var _0x138d=['fs-extra','../../components/auth/service','../../components/interaction/service','exports','multer','util','connect-timeout','express','Router'];(function(_0x2f8d2c,_0x223b81){var _0x3fa002=function(_0x114987){while(--_0x114987){_0x2f8d2c['push'](_0x2f8d2c['shift']());}};_0x3fa002(++_0x223b81);}(_0x138d,0x1ab));var _0xd138=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x138d[_0x433a86];return _0x23000c;};'use strict';var multer=require(_0xd138('0x0'));var util=require(_0xd138('0x1'));var path=require('path');var timeout=require(_0xd138('0x2'));var express=require(_0xd138('0x3'));var router=express[_0xd138('0x4')]();var fs_extra=require(_0xd138('0x5'));var auth=require(_0xd138('0x6'));var interaction=require(_0xd138('0x7'));var config=require('../../config/environment');module[_0xd138('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index a26f1cf..b7c41e7 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 _0x8990=['INBOX','sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0x8990,0x1d2));var _0x0899=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x8990[_0x38ced4];return _0x547c07;};'use strict';var Sequelize=require(_0x0899('0x0'));module['exports']={'description':{'type':Sequelize[_0x0899('0x1')]},'host':{'type':Sequelize[_0x0899('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x0899('0x1')]},'password':{'type':Sequelize[_0x0899('0x1')]},'port':{'type':Sequelize[_0x0899('0x2')]},'tls':{'type':Sequelize[_0x0899('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x0899('0x1')],'defaultValue':_0x0899('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x0899('0x2')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xafb8=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x204ce5,_0x46fb75){var _0x4f5a44=function(_0x55e0ac){while(--_0x55e0ac){_0x204ce5['push'](_0x204ce5['shift']());}};_0x4f5a44(++_0x46fb75);}(_0xafb8,0xa1));var _0x8afb=function(_0x5abce5,_0x453440){_0x5abce5=_0x5abce5-0x0;var _0x239c65=_0xafb8[_0x5abce5];return _0x239c65;};'use strict';var Sequelize=require(_0x8afb('0x0'));module[_0x8afb('0x1')]={'description':{'type':Sequelize[_0x8afb('0x2')]},'host':{'type':Sequelize[_0x8afb('0x2')]},'authentication':{'type':Sequelize[_0x8afb('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x8afb('0x2')]},'password':{'type':Sequelize[_0x8afb('0x2')]},'port':{'type':Sequelize[_0x8afb('0x4')]},'tls':{'type':Sequelize[_0x8afb('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x8afb('0x2')],'defaultValue':_0x8afb('0x5')},'connTimeout':{'type':Sequelize[_0x8afb('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x8afb('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x8afb('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 7946063..ca85a7e 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 _0x4fad=['request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment','bluebird'];(function(_0x128450,_0x5869ba){var _0x4d80ed=function(_0x4a2da3){while(--_0x4a2da3){_0x128450['push'](_0x128450['shift']());}};_0x4d80ed(++_0x5869ba);}(_0x4fad,0xcb));var _0xd4fa=function(_0x14eed5,_0x23699c){_0x14eed5=_0x14eed5-0x0;var _0xc37d14=_0x4fad[_0x14eed5];return _0xc37d14;};'use strict';var _=require(_0xd4fa('0x0'));var util=require(_0xd4fa('0x1'));var logger=require(_0xd4fa('0x2'))('api');var moment=require(_0xd4fa('0x3'));var BPromise=require(_0xd4fa('0x4'));var rp=require(_0xd4fa('0x5'));var fs=require('fs');var path=require(_0xd4fa('0x6'));var rimraf=require(_0xd4fa('0x7'));var config=require(_0xd4fa('0x8'));var attributes=require(_0xd4fa('0x9'));module[_0xd4fa('0xa')]=function(_0x597fbe,_0x2d4e07){return _0x597fbe['define'](_0xd4fa('0xb'),attributes,{'tableName':_0xd4fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96cc=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x28e27c,_0x2216ff){var _0x45ae93=function(_0x15f539){while(--_0x15f539){_0x28e27c['push'](_0x28e27c['shift']());}};_0x45ae93(++_0x2216ff);}(_0x96cc,0x16c));var _0xc96c=function(_0x2c9332,_0x745b0c){_0x2c9332=_0x2c9332-0x0;var _0x4a14a9=_0x96cc[_0x2c9332];return _0x4a14a9;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var logger=require(_0xc96c('0x1'))('api');var moment=require(_0xc96c('0x2'));var BPromise=require(_0xc96c('0x3'));var rp=require(_0xc96c('0x4'));var fs=require('fs');var path=require(_0xc96c('0x5'));var rimraf=require(_0xc96c('0x6'));var config=require(_0xc96c('0x7'));var attributes=require(_0xc96c('0x8'));module[_0xc96c('0x9')]=function(_0x3b7f45,_0x5142cd){return _0x3b7f45[_0xc96c('0xa')](_0xc96c('0xb'),attributes,{'tableName':_0xc96c('0xc'),'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 6fbc7e0..430a1b8 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 _0x32ee=['MailServerIn','options','raw','attributes','limit','include','map','model','stringify','GetMailServerIn','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x32ee,0x6d));var _0xe32e=function(_0x2a4164,_0x38e893){_0x2a4164=_0x2a4164-0x0;var _0x3435a2=_0x32ee[_0x2a4164];return _0x3435a2;};'use strict';var _=require('lodash');var util=require(_0xe32e('0x0'));var moment=require(_0xe32e('0x1'));var BPromise=require(_0xe32e('0x2'));var rs=require(_0xe32e('0x3'));var fs=require('fs');var Redis=require(_0xe32e('0x4'));var db=require(_0xe32e('0x5'))['db'];var utils=require(_0xe32e('0x6'));var logger=require(_0xe32e('0x7'))(_0xe32e('0x8'));var config=require(_0xe32e('0x9'));var jayson=require(_0xe32e('0xa'));var client=jayson[_0xe32e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f3028,_0x1473d4,_0x4b04db){return new BPromise(function(_0x544777,_0xdb1e3e){return client[_0xe32e('0xc')](_0x4f3028,_0x4b04db)[_0xe32e('0xd')](function(_0x5abd5a){logger[_0xe32e('0xe')](_0xe32e('0xf'),_0x1473d4,_0xe32e('0x10'));logger[_0xe32e('0x11')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x1473d4,'request\x20sent',JSON['stringify'](_0x5abd5a));if(_0x5abd5a[_0xe32e('0x12')]){if(_0x5abd5a[_0xe32e('0x12')][_0xe32e('0x13')]===0x1f4){logger[_0xe32e('0x12')](_0xe32e('0xf'),_0x1473d4,_0x5abd5a[_0xe32e('0x12')][_0xe32e('0x14')]);return _0xdb1e3e(_0x5abd5a[_0xe32e('0x12')]['message']);}logger[_0xe32e('0x12')](_0xe32e('0xf'),_0x1473d4,_0x5abd5a[_0xe32e('0x12')][_0xe32e('0x14')]);return _0x544777(_0x5abd5a[_0xe32e('0x12')][_0xe32e('0x14')]);}else{logger[_0xe32e('0xe')](_0xe32e('0xf'),_0x1473d4,'request\x20sent');_0x544777(_0x5abd5a[_0xe32e('0x15')][_0xe32e('0x14')]);}})[_0xe32e('0x16')](function(_0x4a5104){logger[_0xe32e('0x12')]('MailServerIn,\x20%s,\x20%s',_0x1473d4,_0x4a5104);_0xdb1e3e(_0x4a5104);});});}exports['GetMailServerIn']=function(_0x4f2e23){var _0x3aa6d9=this;return new Promise(function(_0x1c73a8,_0x350392){return db[_0xe32e('0x17')]['findAll']({'raw':_0x4f2e23[_0xe32e('0x18')]?_0x4f2e23['options'][_0xe32e('0x19')]===undefined?!![]:![]:!![],'where':_0x4f2e23['options']?_0x4f2e23[_0xe32e('0x18')]['where']||null:null,'attributes':_0x4f2e23[_0xe32e('0x18')]?_0x4f2e23['options'][_0xe32e('0x1a')]||null:null,'limit':_0x4f2e23[_0xe32e('0x18')]?_0x4f2e23['options'][_0xe32e('0x1b')]||null:null,'include':_0x4f2e23[_0xe32e('0x18')]?_0x4f2e23['options'][_0xe32e('0x1c')]?_[_0xe32e('0x1d')](_0x4f2e23[_0xe32e('0x18')][_0xe32e('0x1c')],function(_0x3f3aa){return{'model':db[_0x3f3aa['model']],'as':_0x3f3aa['as'],'attributes':_0x3f3aa['attributes'],'include':_0x3f3aa['include']?_[_0xe32e('0x1d')](_0x3f3aa[_0xe32e('0x1c')],function(_0x5b95ec){return{'model':db[_0x5b95ec[_0xe32e('0x1e')]],'as':_0x5b95ec['as'],'attributes':_0x5b95ec['attributes'],'include':_0x5b95ec[_0xe32e('0x1c')]?_[_0xe32e('0x1d')](_0x5b95ec[_0xe32e('0x1c')],function(_0x4b418f){return{'model':db[_0x4b418f[_0xe32e('0x1e')]],'as':_0x4b418f['as'],'attributes':_0x4b418f[_0xe32e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe32e('0xd')](function(_0xe30de3){logger[_0xe32e('0xe')]('GetMailServerIn',_0x4f2e23);logger['debug']('GetMailServerIn',_0x4f2e23,JSON[_0xe32e('0x1f')](_0xe30de3));_0x1c73a8(_0xe30de3);})[_0xe32e('0x16')](function(_0x281587){logger[_0xe32e('0x12')](_0xe32e('0x20'),_0x281587['message'],_0x4f2e23);_0x350392(_0x3aa6d9[_0xe32e('0x12')](0x1f4,_0x281587['message']));});});}; \ No newline at end of file +var _0x9dee=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetMailServerIn','MailServerIn','findAll','options','where','include','map','model','attributes','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x7a2c83,_0x18b9ac){var _0x2f1532=function(_0x50749b){while(--_0x50749b){_0x7a2c83['push'](_0x7a2c83['shift']());}};_0x2f1532(++_0x18b9ac);}(_0x9dee,0x17b));var _0xe9de=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x9dee[_0x34eb31];return _0x254994;};'use strict';var _=require(_0xe9de('0x0'));var util=require(_0xe9de('0x1'));var moment=require(_0xe9de('0x2'));var BPromise=require(_0xe9de('0x3'));var rs=require(_0xe9de('0x4'));var fs=require('fs');var Redis=require(_0xe9de('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9de('0x6'));var logger=require(_0xe9de('0x7'))(_0xe9de('0x8'));var config=require(_0xe9de('0x9'));var jayson=require(_0xe9de('0xa'));var client=jayson[_0xe9de('0xb')][_0xe9de('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c370b,_0x70d60d,_0x5e8d38){return new BPromise(function(_0xc2cfc6,_0x1de592){return client['request'](_0x5c370b,_0x5e8d38)[_0xe9de('0xd')](function(_0x47a1da){logger[_0xe9de('0xe')](_0xe9de('0xf'),_0x70d60d,_0xe9de('0x10'));logger[_0xe9de('0x11')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x70d60d,_0xe9de('0x10'),JSON[_0xe9de('0x12')](_0x47a1da));if(_0x47a1da[_0xe9de('0x13')]){if(_0x47a1da[_0xe9de('0x13')][_0xe9de('0x14')]===0x1f4){logger[_0xe9de('0x13')](_0xe9de('0xf'),_0x70d60d,_0x47a1da['error'][_0xe9de('0x15')]);return _0x1de592(_0x47a1da[_0xe9de('0x13')][_0xe9de('0x15')]);}logger[_0xe9de('0x13')](_0xe9de('0xf'),_0x70d60d,_0x47a1da[_0xe9de('0x13')][_0xe9de('0x15')]);return _0xc2cfc6(_0x47a1da[_0xe9de('0x13')][_0xe9de('0x15')]);}else{logger[_0xe9de('0xe')](_0xe9de('0xf'),_0x70d60d,_0xe9de('0x10'));_0xc2cfc6(_0x47a1da['result'][_0xe9de('0x15')]);}})['catch'](function(_0x3ba89a){logger[_0xe9de('0x13')](_0xe9de('0xf'),_0x70d60d,_0x3ba89a);_0x1de592(_0x3ba89a);});});}exports[_0xe9de('0x16')]=function(_0x20f21f){var _0x173a3f=this;return new Promise(function(_0x583b9,_0x3f4376){return db[_0xe9de('0x17')][_0xe9de('0x18')]({'raw':_0x20f21f[_0xe9de('0x19')]?_0x20f21f[_0xe9de('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x20f21f[_0xe9de('0x19')]?_0x20f21f[_0xe9de('0x19')][_0xe9de('0x1a')]||null:null,'attributes':_0x20f21f[_0xe9de('0x19')]?_0x20f21f[_0xe9de('0x19')]['attributes']||null:null,'limit':_0x20f21f[_0xe9de('0x19')]?_0x20f21f[_0xe9de('0x19')]['limit']||null:null,'include':_0x20f21f[_0xe9de('0x19')]?_0x20f21f['options'][_0xe9de('0x1b')]?_[_0xe9de('0x1c')](_0x20f21f['options'][_0xe9de('0x1b')],function(_0x69c680){return{'model':db[_0x69c680[_0xe9de('0x1d')]],'as':_0x69c680['as'],'attributes':_0x69c680[_0xe9de('0x1e')],'include':_0x69c680[_0xe9de('0x1b')]?_['map'](_0x69c680[_0xe9de('0x1b')],function(_0x587ad4){return{'model':db[_0x587ad4[_0xe9de('0x1d')]],'as':_0x587ad4['as'],'attributes':_0x587ad4[_0xe9de('0x1e')],'include':_0x587ad4[_0xe9de('0x1b')]?_[_0xe9de('0x1c')](_0x587ad4[_0xe9de('0x1b')],function(_0x13aa53){return{'model':db[_0x13aa53[_0xe9de('0x1d')]],'as':_0x13aa53['as'],'attributes':_0x13aa53[_0xe9de('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe9de('0xd')](function(_0x2d3298){logger[_0xe9de('0xe')](_0xe9de('0x16'),_0x20f21f);logger[_0xe9de('0x11')](_0xe9de('0x16'),_0x20f21f,JSON[_0xe9de('0x12')](_0x2d3298));_0x583b9(_0x2d3298);})[_0xe9de('0x1f')](function(_0x33cb79){logger[_0xe9de('0x13')]('GetMailServerIn',_0x33cb79['message'],_0x20f21f);_0x3f4376(_0x173a3f[_0xe9de('0x13')](0x1f4,_0x33cb79[_0xe9de('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 45eaef8..cbf6913 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 _0x4bc3=['post','create','put','/:id','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','show'];(function(_0x1850e2,_0x7dab61){var _0x1f5de4=function(_0x2cfb85){while(--_0x2cfb85){_0x1850e2['push'](_0x1850e2['shift']());}};_0x1f5de4(++_0x7dab61);}(_0x4bc3,0x16e));var _0x34bc=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x4bc3[_0x556bb1];return _0x45455f;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var fs_extra=require(_0x34bc('0x4'));var auth=require(_0x34bc('0x5'));var interaction=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var controller=require(_0x34bc('0x8'));router[_0x34bc('0x9')]('/',auth[_0x34bc('0xa')](),controller['index']);router[_0x34bc('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x34bc('0xb')]);router[_0x34bc('0xc')]('/',auth[_0x34bc('0xa')](),controller[_0x34bc('0xd')]);router[_0x34bc('0xe')](_0x34bc('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x34bc('0x10')](_0x34bc('0xf'),auth[_0x34bc('0xa')](),controller['destroy']);module[_0x34bc('0x11')]=router; \ No newline at end of file +var _0x54ef=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','index','get','/:id','show','isAuthenticated','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x4c844d,_0x3ac798){var _0x38488a=function(_0x3699ad){while(--_0x3699ad){_0x4c844d['push'](_0x4c844d['shift']());}};_0x38488a(++_0x3ac798);}(_0x54ef,0x112));var _0xf54e=function(_0x38e682,_0x221532){_0x38e682=_0x38e682-0x0;var _0x23b013=_0x54ef[_0x38e682];return _0x23b013;};'use strict';var multer=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var path=require(_0xf54e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf54e('0x3'));var router=express[_0xf54e('0x4')]();var fs_extra=require(_0xf54e('0x5'));var auth=require(_0xf54e('0x6'));var interaction=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var controller=require(_0xf54e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf54e('0xa')]);router[_0xf54e('0xb')](_0xf54e('0xc'),auth['isAuthenticated'](),controller[_0xf54e('0xd')]);router['post']('/',auth[_0xf54e('0xe')](),controller[_0xf54e('0xf')]);router['put'](_0xf54e('0xc'),auth[_0xf54e('0xe')](),controller[_0xf54e('0x10')]);router[_0xf54e('0x11')]('/:id',auth[_0xf54e('0xe')](),controller[_0xf54e('0x12')]);module[_0xf54e('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 211fb78..11306fd 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 _0x31f0=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x3c34d3,_0x586c2d){var _0x15bd5f=function(_0x21a199){while(--_0x21a199){_0x3c34d3['push'](_0x3c34d3['shift']());}};_0x15bd5f(++_0x586c2d);}(_0x31f0,0xb7));var _0x031f=function(_0x425dcd,_0x497c6e){_0x425dcd=_0x425dcd-0x0;var _0x566849=_0x31f0[_0x425dcd];return _0x566849;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'description':{'type':Sequelize[_0x031f('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x031f('0x1')]},'pass':{'type':Sequelize[_0x031f('0x1')]},'port':{'type':Sequelize[_0x031f('0x2')]},'secure':{'type':Sequelize[_0x031f('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x031f('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0c23=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x2f1f9a,_0x34af3f){var _0x447e08=function(_0x3e4a39){while(--_0x3e4a39){_0x2f1f9a['push'](_0x2f1f9a['shift']());}};_0x447e08(++_0x34af3f);}(_0x0c23,0x13e));var _0x30c2=function(_0x3bd823,_0x1918c0){_0x3bd823=_0x3bd823-0x0;var _0x363660=_0x0c23[_0x3bd823];return _0x363660;};'use strict';var Sequelize=require(_0x30c2('0x0'));module[_0x30c2('0x1')]={'description':{'type':Sequelize[_0x30c2('0x2')]},'host':{'type':Sequelize[_0x30c2('0x2')]},'user':{'type':Sequelize[_0x30c2('0x2')]},'pass':{'type':Sequelize[_0x30c2('0x2')]},'port':{'type':Sequelize[_0x30c2('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x30c2('0x2')]},'authentication':{'type':Sequelize[_0x30c2('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 591e16c..a20ff45 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 _0xa9e0=['sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','render','merge','body','contact','message','interaction','account','index','map','MailServerOut','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','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'];(function(_0x306f1f,_0x1c4e96){var _0x127b1b=function(_0x1dea5a){while(--_0x1dea5a){_0x306f1f['push'](_0x306f1f['shift']());}};_0x127b1b(++_0x1c4e96);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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);};}function getMustacheRender(_0x34dc65,_0x25fba9){return Mustache[_0x0a9e('0x27')](_0x34dc65,_[_0x0a9e('0x28')](_0x25fba9[_0x0a9e('0x29')],{'contact':_0x25fba9[_0x0a9e('0x2a')],'message':_0x25fba9[_0x0a9e('0x2b')],'agent':_0x25fba9['agent'],'interaction':_0x25fba9[_0x0a9e('0x2c')],'account':_0x25fba9[_0x0a9e('0x2d')]}))||'';}exports[_0x0a9e('0x2e')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x32')],'type':_0x2e8759['type'][_0x0a9e('0x33')]};});_0x40e7a3['model']=_[_0x0a9e('0x2f')](_0x824a4f,_0x0a9e('0x25'));_0x40e7a3[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x34')]);_0x40e7a3['filters']=_[_0x0a9e('0x36')](_0x40e7a3[_0x0a9e('0x37')],_0x40e7a3[_0x0a9e('0x34')]);_0x15b200[_0x0a9e('0x38')]=_[_0x0a9e('0x36')](_0x40e7a3[_0x0a9e('0x37')],qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x34')]['fields']));_0x15b200[_0x0a9e('0x38')]=_0x15b200['attributes'][_0x0a9e('0x3a')]?_0x15b200[_0x0a9e('0x38')]:_0x40e7a3[_0x0a9e('0x37')];if(!_0x2ec755[_0x0a9e('0x34')]['hasOwnProperty'](_0x0a9e('0x3b'))){_0x15b200[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x2ec755[_0x0a9e('0x34')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1b')](_0x2ec755['query'][_0x0a9e('0x1b')]);}_0x15b200[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2ec755[_0x0a9e('0x34')]['sort']);_0x15b200[_0x0a9e('0x3e')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3f')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x34')][_0x0a9e('0x41')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x2f')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x42')]!==_0x0a9e('0x43')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x25')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x28')]({},_0x15b200,_0x2ec755[_0x0a9e('0x44')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3e')]};return db[_0x0a9e('0x30')][_0x0a9e('0x1c')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1c')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x34')][_0x0a9e('0x45')]){_0x15b200[_0x0a9e('0x46')]=[{'all':!![]}];}return db[_0x0a9e('0x30')][_0x0a9e('0x47')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x48')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x49')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x4a')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':!![],'where':{'id':_0x11ca30[_0x0a9e('0x4b')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x37')]=_[_0x0a9e('0x35')](db[_0x0a9e('0x30')][_0x0a9e('0x31')]);_0x52628e[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x34')]);_0x52628e[_0x0a9e('0x3f')]=_[_0x0a9e('0x36')](_0x52628e[_0x0a9e('0x37')],_0x52628e[_0x0a9e('0x34')]);_0x4d04c8['attributes']=_[_0x0a9e('0x36')](_0x52628e[_0x0a9e('0x37')],qs[_0x0a9e('0x39')](_0x11ca30[_0x0a9e('0x34')][_0x0a9e('0x39')]));_0x4d04c8[_0x0a9e('0x38')]=_0x4d04c8[_0x0a9e('0x38')][_0x0a9e('0x3a')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x37')];if(_0x11ca30['query'][_0x0a9e('0x45')]){_0x4d04c8[_0x0a9e('0x46')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x28')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x30')][_0x0a9e('0x4c')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x49')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4d')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x30')][_0x0a9e('0x4d')](_0x45bf7f[_0x0a9e('0x29')],{})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x49')](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x6054ee,_0x19383e){if(_0x6054ee[_0x0a9e('0x29')]['id']){delete _0x6054ee['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x4c')]({'where':{'id':_0x6054ee['params']['id']}})['then'](handleEntityNotFound(_0x19383e,null))['then'](saveUpdates(_0x6054ee[_0x0a9e('0x29')],null))[_0x0a9e('0x22')](respondWithResult(_0x19383e,null))[_0x0a9e('0x49')](handleError(_0x19383e,null));};exports[_0x0a9e('0x23')]=function(_0x61bb17,_0x30decb){return db[_0x0a9e('0x30')][_0x0a9e('0x4c')]({'where':{'id':_0x61bb17['params']['id']}})['then'](handleEntityNotFound(_0x30decb,null))['then'](removeEntity(_0x30decb,null))[_0x0a9e('0x49')](handleError(_0x30decb,null));}; \ No newline at end of file +var _0xa9e0=['sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','render','merge','body','contact','message','interaction','account','index','map','MailServerOut','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','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'];(function(_0x287a45,_0x428a6e){var _0x347ad4=function(_0x3d93d4){while(--_0x3d93d4){_0x287a45['push'](_0x287a45['shift']());}};_0x347ad4(++_0x428a6e);}(_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'];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);};}function getMustacheRender(_0x34dc65,_0x25fba9){return Mustache[_0x0a9e('0x27')](_0x34dc65,_[_0x0a9e('0x28')](_0x25fba9[_0x0a9e('0x29')],{'contact':_0x25fba9[_0x0a9e('0x2a')],'message':_0x25fba9[_0x0a9e('0x2b')],'agent':_0x25fba9['agent'],'interaction':_0x25fba9[_0x0a9e('0x2c')],'account':_0x25fba9[_0x0a9e('0x2d')]}))||'';}exports[_0x0a9e('0x2e')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x32')],'type':_0x2e8759['type'][_0x0a9e('0x33')]};});_0x40e7a3['model']=_[_0x0a9e('0x2f')](_0x824a4f,_0x0a9e('0x25'));_0x40e7a3[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x34')]);_0x40e7a3['filters']=_[_0x0a9e('0x36')](_0x40e7a3[_0x0a9e('0x37')],_0x40e7a3[_0x0a9e('0x34')]);_0x15b200[_0x0a9e('0x38')]=_[_0x0a9e('0x36')](_0x40e7a3[_0x0a9e('0x37')],qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x34')]['fields']));_0x15b200[_0x0a9e('0x38')]=_0x15b200['attributes'][_0x0a9e('0x3a')]?_0x15b200[_0x0a9e('0x38')]:_0x40e7a3[_0x0a9e('0x37')];if(!_0x2ec755[_0x0a9e('0x34')]['hasOwnProperty'](_0x0a9e('0x3b'))){_0x15b200[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x2ec755[_0x0a9e('0x34')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1b')](_0x2ec755['query'][_0x0a9e('0x1b')]);}_0x15b200[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2ec755[_0x0a9e('0x34')]['sort']);_0x15b200[_0x0a9e('0x3e')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3f')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x34')][_0x0a9e('0x41')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x2f')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x42')]!==_0x0a9e('0x43')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x25')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x28')]({},_0x15b200,_0x2ec755[_0x0a9e('0x44')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3e')]};return db[_0x0a9e('0x30')][_0x0a9e('0x1c')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1c')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x34')][_0x0a9e('0x45')]){_0x15b200[_0x0a9e('0x46')]=[{'all':!![]}];}return db[_0x0a9e('0x30')][_0x0a9e('0x47')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x48')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x49')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x4a')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':!![],'where':{'id':_0x11ca30[_0x0a9e('0x4b')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x37')]=_[_0x0a9e('0x35')](db[_0x0a9e('0x30')][_0x0a9e('0x31')]);_0x52628e[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x34')]);_0x52628e[_0x0a9e('0x3f')]=_[_0x0a9e('0x36')](_0x52628e[_0x0a9e('0x37')],_0x52628e[_0x0a9e('0x34')]);_0x4d04c8['attributes']=_[_0x0a9e('0x36')](_0x52628e[_0x0a9e('0x37')],qs[_0x0a9e('0x39')](_0x11ca30[_0x0a9e('0x34')][_0x0a9e('0x39')]));_0x4d04c8[_0x0a9e('0x38')]=_0x4d04c8[_0x0a9e('0x38')][_0x0a9e('0x3a')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x37')];if(_0x11ca30['query'][_0x0a9e('0x45')]){_0x4d04c8[_0x0a9e('0x46')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x28')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x30')][_0x0a9e('0x4c')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x49')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4d')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x30')][_0x0a9e('0x4d')](_0x45bf7f[_0x0a9e('0x29')],{})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x49')](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x6054ee,_0x19383e){if(_0x6054ee[_0x0a9e('0x29')]['id']){delete _0x6054ee['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x4c')]({'where':{'id':_0x6054ee['params']['id']}})['then'](handleEntityNotFound(_0x19383e,null))['then'](saveUpdates(_0x6054ee[_0x0a9e('0x29')],null))[_0x0a9e('0x22')](respondWithResult(_0x19383e,null))[_0x0a9e('0x49')](handleError(_0x19383e,null));};exports[_0x0a9e('0x23')]=function(_0x61bb17,_0x30decb){return db[_0x0a9e('0x30')][_0x0a9e('0x4c')]({'where':{'id':_0x61bb17['params']['id']}})['then'](handleEntityNotFound(_0x30decb,null))['then'](removeEntity(_0x30decb,null))[_0x0a9e('0x49')](handleError(_0x30decb,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index f429df8..93e188f 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 _0xf2ca=['define','mail_servers_out','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x815c6c,_0x3f5df7){var _0x15b501=function(_0x14cf99){while(--_0x14cf99){_0x815c6c['push'](_0x815c6c['shift']());}};_0x15b501(++_0x3f5df7);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x55d7c2,_0x4ce6fb){_0x55d7c2=_0x55d7c2-0x0;var _0x1755ef=_0xf2ca[_0x55d7c2];return _0x1755ef;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var logger=require(_0xaf2c('0x2'))('api');var moment=require(_0xaf2c('0x3'));var BPromise=require(_0xaf2c('0x4'));var rp=require(_0xaf2c('0x5'));var fs=require('fs');var path=require(_0xaf2c('0x6'));var rimraf=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var attributes=require('./mailServerOut.attributes');module[_0xaf2c('0x9')]=function(_0x100d17,_0x297740){return _0x100d17[_0xaf2c('0xa')]('MailServerOut',attributes,{'tableName':_0xaf2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda19=['exports','define','MailServerOut','mail_servers_out','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./mailServerOut.attributes'];(function(_0xf6844d,_0x4a117d){var _0x221bdb=function(_0x5d20bb){while(--_0x5d20bb){_0xf6844d['push'](_0xf6844d['shift']());}};_0x221bdb(++_0x4a117d);}(_0xda19,0xd5));var _0x9da1=function(_0x18a9bf,_0x698287){_0x18a9bf=_0x18a9bf-0x0;var _0x2596cd=_0xda19[_0x18a9bf];return _0x2596cd;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));module[_0x9da1('0x7')]=function(_0x156faf,_0x2dcbc6){return _0x156faf[_0x9da1('0x8')](_0x9da1('0x9'),attributes,{'tableName':_0x9da1('0xa'),'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 816812e..290eaf6 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 _0xec82=['../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerOut,\x20%s,\x20%s','message','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4b1d97,_0x9f357){var _0x52537c=function(_0x5cbc86){while(--_0x5cbc86){_0x4b1d97['push'](_0x4b1d97['shift']());}};_0x52537c(++_0x9f357);}(_0xec82,0x19f));var _0x2ec8=function(_0x266238,_0x11499a){_0x266238=_0x266238-0x0;var _0x341392=_0xec82[_0x266238];return _0x341392;};'use strict';var _=require('lodash');var util=require(_0x2ec8('0x0'));var moment=require(_0x2ec8('0x1'));var BPromise=require('bluebird');var rs=require(_0x2ec8('0x2'));var fs=require('fs');var Redis=require(_0x2ec8('0x3'));var db=require(_0x2ec8('0x4'))['db'];var utils=require(_0x2ec8('0x5'));var logger=require(_0x2ec8('0x6'))(_0x2ec8('0x7'));var config=require('../../config/environment');var jayson=require(_0x2ec8('0x8'));var client=jayson[_0x2ec8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1525af,_0x288f36,_0x3c8b87){return new BPromise(function(_0x1ec79d,_0x4def10){return client['request'](_0x1525af,_0x3c8b87)[_0x2ec8('0xa')](function(_0x30df81){logger[_0x2ec8('0xb')]('MailServerOut,\x20%s,\x20%s',_0x288f36,_0x2ec8('0xc'));logger[_0x2ec8('0xd')](_0x2ec8('0xe'),_0x288f36,_0x2ec8('0xc'),JSON[_0x2ec8('0xf')](_0x30df81));if(_0x30df81['error']){if(_0x30df81[_0x2ec8('0x10')][_0x2ec8('0x11')]===0x1f4){logger[_0x2ec8('0x10')](_0x2ec8('0x12'),_0x288f36,_0x30df81[_0x2ec8('0x10')][_0x2ec8('0x13')]);return _0x4def10(_0x30df81[_0x2ec8('0x10')]['message']);}logger['error'](_0x2ec8('0x12'),_0x288f36,_0x30df81['error'][_0x2ec8('0x13')]);return _0x1ec79d(_0x30df81['error']['message']);}else{logger[_0x2ec8('0xb')](_0x2ec8('0x12'),_0x288f36,_0x2ec8('0xc'));_0x1ec79d(_0x30df81['result'][_0x2ec8('0x13')]);}})['catch'](function(_0x1e303c){logger[_0x2ec8('0x10')]('MailServerOut,\x20%s,\x20%s',_0x288f36,_0x1e303c);_0x4def10(_0x1e303c);});});} \ No newline at end of file +var _0xb4b5=['info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xb4b5,0x182));var _0x5b4b=function(_0x2e5f9c,_0x134a52){_0x2e5f9c=_0x2e5f9c-0x0;var _0x538b44=_0xb4b5[_0x2e5f9c];return _0x538b44;};'use strict';var _=require(_0x5b4b('0x0'));var util=require(_0x5b4b('0x1'));var moment=require(_0x5b4b('0x2'));var BPromise=require(_0x5b4b('0x3'));var rs=require(_0x5b4b('0x4'));var fs=require('fs');var Redis=require(_0x5b4b('0x5'));var db=require(_0x5b4b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b4b('0x7'))('rpc');var config=require(_0x5b4b('0x8'));var jayson=require(_0x5b4b('0x9'));var client=jayson[_0x5b4b('0xa')][_0x5b4b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39d0c5,_0x435a5f,_0x23b155){return new BPromise(function(_0x103a6b,_0x4fab7e){return client[_0x5b4b('0xc')](_0x39d0c5,_0x23b155)[_0x5b4b('0xd')](function(_0x28f548){logger[_0x5b4b('0xe')](_0x5b4b('0xf'),_0x435a5f,_0x5b4b('0x10'));logger[_0x5b4b('0x11')](_0x5b4b('0x12'),_0x435a5f,_0x5b4b('0x10'),JSON[_0x5b4b('0x13')](_0x28f548));if(_0x28f548[_0x5b4b('0x14')]){if(_0x28f548['error'][_0x5b4b('0x15')]===0x1f4){logger[_0x5b4b('0x14')](_0x5b4b('0xf'),_0x435a5f,_0x28f548[_0x5b4b('0x14')][_0x5b4b('0x16')]);return _0x4fab7e(_0x28f548['error'][_0x5b4b('0x16')]);}logger['error'](_0x5b4b('0xf'),_0x435a5f,_0x28f548[_0x5b4b('0x14')][_0x5b4b('0x16')]);return _0x103a6b(_0x28f548[_0x5b4b('0x14')][_0x5b4b('0x16')]);}else{logger[_0x5b4b('0xe')](_0x5b4b('0xf'),_0x435a5f,_0x5b4b('0x10'));_0x103a6b(_0x28f548[_0x5b4b('0x17')][_0x5b4b('0x16')]);}})[_0x5b4b('0x18')](function(_0x326e24){logger['error'](_0x5b4b('0xf'),_0x435a5f,_0x326e24);_0x4fab7e(_0x326e24);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 4007875..7f12a12 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 _0xf4f4=['show','post','create','put','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x3dc944,_0x1d39fa){_0x3dc944=_0x3dc944-0x0;var _0x38484c=_0xf4f4[_0x3dc944];return _0x38484c;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4f('0x7'));var controller=require('./mailSubstatus.controller');router[_0x4f4f('0x8')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xa')]);router[_0x4f4f('0x8')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0x8')]('/:id',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xd')]);router[_0x4f4f('0xe')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xf')]);router[_0x4f4f('0x10')](_0x4f4f('0x11'),auth[_0x4f4f('0x9')](),controller['update']);router['delete'](_0x4f4f('0x11'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x12')]);module[_0x4f4f('0x13')]=router; \ No newline at end of file +var _0x3f9b=['exports','path','express','Router','../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated','describe','show','/:id','update','delete'];(function(_0x2eece3,_0x238fe6){var _0x3cc1f4=function(_0x46af6d){while(--_0x46af6d){_0x2eece3['push'](_0x2eece3['shift']());}};_0x3cc1f4(++_0x238fe6);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x4d706d,_0x325eb7){_0x4d706d=_0x4d706d-0x0;var _0x195701=_0x3f9b[_0x4d706d];return _0x195701;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb3f9('0x0'));var timeout=require('connect-timeout');var express=require(_0xb3f9('0x1'));var router=express[_0xb3f9('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb3f9('0x3'));var controller=require(_0xb3f9('0x4'));router[_0xb3f9('0x5')]('/',auth['isAuthenticated'](),controller[_0xb3f9('0x6')]);router[_0xb3f9('0x5')](_0xb3f9('0x7'),auth[_0xb3f9('0x8')](),controller[_0xb3f9('0x9')]);router['get']('/:id',auth[_0xb3f9('0x8')](),controller[_0xb3f9('0xa')]);router['post']('/',auth[_0xb3f9('0x8')](),controller['create']);router['put'](_0xb3f9('0xb'),auth[_0xb3f9('0x8')](),controller[_0xb3f9('0xc')]);router[_0xb3f9('0xd')](_0xb3f9('0xb'),auth[_0xb3f9('0x8')](),controller['destroy']);module[_0xb3f9('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index a42b414..42e214c 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 _0x1d11=['STRING','name','sequelize','exports'];(function(_0x2f9e93,_0x96e1e){var _0x51be73=function(_0x472a02){while(--_0x472a02){_0x2f9e93['push'](_0x2f9e93['shift']());}};_0x51be73(++_0x96e1e);}(_0x1d11,0xb6));var _0x11d1=function(_0x120830,_0x4d996a){_0x120830=_0x120830-0x0;var _0x4d4a32=_0x1d11[_0x120830];return _0x4d4a32;};'use strict';var Sequelize=require(_0x11d1('0x0'));module[_0x11d1('0x1')]={'name':{'type':Sequelize[_0x11d1('0x2')],'unique':_0x11d1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x11d1('0x2')]}}; \ No newline at end of file +var _0xfe91=['sequelize','name'];(function(_0x4191af,_0x5783da){var _0x27bebf=function(_0x355be7){while(--_0x355be7){_0x4191af['push'](_0x4191af['shift']());}};_0x27bebf(++_0x5783da);}(_0xfe91,0xd4));var _0x1fe9=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0xfe91[_0x2cd1fb];return _0x48fd2b;};'use strict';var Sequelize=require(_0x1fe9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1fe9('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 2e5a65d..d9ffc63 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 _0xbe35=['VIRTUAL','options','MailSubstatus','include','rows','catch','params','includeAll','create','body','update','destroy','find','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','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','status','end','json','offset','undefined','count','limit','set','reject','save','then','sendStatus','error','stack','name','send','render','merge','contact','message','interaction','account','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','type'];(function(_0x289d09,_0x5bbad2){var _0x2519f6=function(_0x40037c){while(--_0x40037c){_0x289d09['push'](_0x289d09['shift']());}};_0x2519f6(++_0x5bbad2);}(_0xbe35,0xa8));var _0x5be3=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xbe35[_0x342baa];return _0x1208f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5be3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5be3('0x1'));var moment=require(_0x5be3('0x2'));var BPromise=require(_0x5be3('0x3'));var Mustache=require(_0x5be3('0x4'));var util=require(_0x5be3('0x5'));var path=require(_0x5be3('0x6'));var sox=require('sox');var csv=require(_0x5be3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5be3('0x8'));var squel=require(_0x5be3('0x9'));var crypto=require(_0x5be3('0xa'));var jsforce=require(_0x5be3('0xb'));var deskjs=require(_0x5be3('0xc'));var toCsv=require(_0x5be3('0x7'));var querystring=require(_0x5be3('0xd'));var Papa=require(_0x5be3('0xe'));var Redis=require(_0x5be3('0xf'));var authService=require(_0x5be3('0x10'));var qs=require(_0x5be3('0x11'));var as=require(_0x5be3('0x12'));var hardwareService=require(_0x5be3('0x13'));var logger=require(_0x5be3('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26fb12,_0x222db9){_0x222db9=_0x222db9||0xcc;return function(_0x14efd7){if(_0x14efd7){return _0x26fb12['sendStatus'](_0x222db9);}return _0x26fb12[_0x5be3('0x15')](_0x222db9)[_0x5be3('0x16')]();};}function respondWithResult(_0x38a1e1,_0x453233){_0x453233=_0x453233||0xc8;return function(_0xba7d8b){if(_0xba7d8b){return _0x38a1e1[_0x5be3('0x15')](_0x453233)[_0x5be3('0x17')](_0xba7d8b);}};}function respondWithFilteredResult(_0x27224a,_0x28f16f){return function(_0xb6b237){if(_0xb6b237){var _0x2dc964=typeof _0x28f16f[_0x5be3('0x18')]==='undefined'&&typeof _0x28f16f['limit']===_0x5be3('0x19');var _0xff4bf2=_0xb6b237[_0x5be3('0x1a')];var _0x53b85f=_0x2dc964?0x0:_0x28f16f[_0x5be3('0x18')];var _0x54799c=_0x2dc964?_0xb6b237[_0x5be3('0x1a')]:_0x28f16f[_0x5be3('0x18')]+_0x28f16f[_0x5be3('0x1b')];var _0x2b3af7;if(_0x54799c>=_0xff4bf2){_0x54799c=_0xff4bf2;_0x2b3af7=0xc8;}else{_0x2b3af7=0xce;}_0x27224a[_0x5be3('0x15')](_0x2b3af7);return _0x27224a[_0x5be3('0x1c')]('Content-Range',_0x53b85f+'-'+_0x54799c+'/'+_0xff4bf2)[_0x5be3('0x17')](_0xb6b237);}return null;};}function patchUpdates(_0x23c614){return function(_0x4be6e3){try{jsonpatch['apply'](_0x4be6e3,_0x23c614,!![]);}catch(_0xd30c34){return BPromise[_0x5be3('0x1d')](_0xd30c34);}return _0x4be6e3[_0x5be3('0x1e')]();};}function saveUpdates(_0x2fd678,_0x55a70b){return function(_0x2105b7){if(_0x2105b7){return _0x2105b7['update'](_0x2fd678)[_0x5be3('0x1f')](function(_0x5b3f68){return _0x5b3f68;});}return null;};}function removeEntity(_0x3b748a,_0x2b9ece){return function(_0x2f97f8){if(_0x2f97f8){return _0x2f97f8['destroy']()['then'](function(){_0x3b748a[_0x5be3('0x15')](0xcc)[_0x5be3('0x16')]();});}};}function handleEntityNotFound(_0x4af9f0,_0x520d32){return function(_0x2776a4){if(!_0x2776a4){_0x4af9f0[_0x5be3('0x20')](0x194);}return _0x2776a4;};}function handleError(_0x30cc4c,_0x1188e4){_0x1188e4=_0x1188e4||0x1f4;return function(_0x50ef78){logger[_0x5be3('0x21')](_0x50ef78[_0x5be3('0x22')]);if(_0x50ef78[_0x5be3('0x23')]){delete _0x50ef78[_0x5be3('0x23')];}_0x30cc4c[_0x5be3('0x15')](_0x1188e4)[_0x5be3('0x24')](_0x50ef78);};}function getMustacheRender(_0x1fa419,_0x7435a9){return Mustache[_0x5be3('0x25')](_0x1fa419,_[_0x5be3('0x26')](_0x7435a9['body'],{'contact':_0x7435a9[_0x5be3('0x27')],'message':_0x7435a9[_0x5be3('0x28')],'agent':_0x7435a9['agent'],'interaction':_0x7435a9[_0x5be3('0x29')],'account':_0x7435a9[_0x5be3('0x2a')]}))||'';}exports[_0x5be3('0x2b')]=function(_0x328ec2,_0x40781e){var _0x1fb114={},_0x15efd7={},_0x4d35a7={'count':0x0,'rows':[]};var _0x4e29a8=_[_0x5be3('0x2c')](db['MailSubstatus'][_0x5be3('0x2d')],function(_0x3bed81){return{'name':_0x3bed81[_0x5be3('0x2e')],'type':_0x3bed81['type'][_0x5be3('0x2f')]};});_0x15efd7[_0x5be3('0x30')]=_[_0x5be3('0x2c')](_0x4e29a8,_0x5be3('0x23'));_0x15efd7[_0x5be3('0x31')]=_[_0x5be3('0x32')](_0x328ec2[_0x5be3('0x31')]);_0x15efd7['filters']=_[_0x5be3('0x33')](_0x15efd7[_0x5be3('0x30')],_0x15efd7['query']);_0x1fb114[_0x5be3('0x34')]=_[_0x5be3('0x33')](_0x15efd7[_0x5be3('0x30')],qs[_0x5be3('0x35')](_0x328ec2[_0x5be3('0x31')][_0x5be3('0x35')]));_0x1fb114[_0x5be3('0x34')]=_0x1fb114[_0x5be3('0x34')][_0x5be3('0x36')]?_0x1fb114[_0x5be3('0x34')]:_0x15efd7[_0x5be3('0x30')];if(!_0x328ec2['query']['hasOwnProperty'](_0x5be3('0x37'))){_0x1fb114[_0x5be3('0x1b')]=qs['limit'](_0x328ec2[_0x5be3('0x31')][_0x5be3('0x1b')]);_0x1fb114['offset']=qs['offset'](_0x328ec2[_0x5be3('0x31')][_0x5be3('0x18')]);}_0x1fb114[_0x5be3('0x38')]=qs[_0x5be3('0x39')](_0x328ec2[_0x5be3('0x31')]['sort']);_0x1fb114['where']=qs[_0x5be3('0x3a')](_[_0x5be3('0x3b')](_0x328ec2[_0x5be3('0x31')],_0x15efd7[_0x5be3('0x3a')]),_0x4e29a8);if(_0x328ec2[_0x5be3('0x31')][_0x5be3('0x3c')]){_0x1fb114[_0x5be3('0x3d')]=_[_0x5be3('0x26')](_0x1fb114[_0x5be3('0x3d')],{'$or':_[_0x5be3('0x2c')](_0x4e29a8,function(_0x1edab6){if(_0x1edab6[_0x5be3('0x3e')]!==_0x5be3('0x3f')){var _0x20f652={};_0x20f652[_0x1edab6[_0x5be3('0x23')]]={'$like':'%'+_0x328ec2['query']['filter']+'%'};return _0x20f652;}})});}_0x1fb114=_[_0x5be3('0x26')]({},_0x1fb114,_0x328ec2[_0x5be3('0x40')]);var _0x4a7e40={'where':_0x1fb114['where']};return db[_0x5be3('0x41')][_0x5be3('0x1a')](_0x4a7e40)['then'](function(_0x4076a6){_0x4d35a7[_0x5be3('0x1a')]=_0x4076a6;if(_0x328ec2[_0x5be3('0x31')]['includeAll']){_0x1fb114[_0x5be3('0x42')]=[{'all':!![]}];}return db[_0x5be3('0x41')]['findAll'](_0x1fb114);})[_0x5be3('0x1f')](function(_0x76fbb4){_0x4d35a7[_0x5be3('0x43')]=_0x76fbb4;return _0x4d35a7;})[_0x5be3('0x1f')](respondWithFilteredResult(_0x40781e,_0x1fb114))[_0x5be3('0x44')](handleError(_0x40781e,null));};exports['show']=function(_0x5c0db7,_0x2a7558){var _0x30e225={'raw':!![],'where':{'id':_0x5c0db7[_0x5be3('0x45')]['id']}},_0x1607d9={};_0x1607d9[_0x5be3('0x30')]=_['keys'](db['MailSubstatus']['rawAttributes']);_0x1607d9[_0x5be3('0x31')]=_[_0x5be3('0x32')](_0x5c0db7['query']);_0x1607d9[_0x5be3('0x3a')]=_[_0x5be3('0x33')](_0x1607d9[_0x5be3('0x30')],_0x1607d9[_0x5be3('0x31')]);_0x30e225['attributes']=_[_0x5be3('0x33')](_0x1607d9[_0x5be3('0x30')],qs[_0x5be3('0x35')](_0x5c0db7[_0x5be3('0x31')]['fields']));_0x30e225[_0x5be3('0x34')]=_0x30e225['attributes'][_0x5be3('0x36')]?_0x30e225['attributes']:_0x1607d9[_0x5be3('0x30')];if(_0x5c0db7[_0x5be3('0x31')][_0x5be3('0x46')]){_0x30e225['include']=[{'all':!![]}];}_0x30e225=_[_0x5be3('0x26')]({},_0x30e225,_0x5c0db7[_0x5be3('0x40')]);return db['MailSubstatus']['find'](_0x30e225)[_0x5be3('0x1f')](handleEntityNotFound(_0x2a7558,null))[_0x5be3('0x1f')](respondWithResult(_0x2a7558,null))[_0x5be3('0x44')](handleError(_0x2a7558,null));};exports[_0x5be3('0x47')]=function(_0x508876,_0x38856d){return db[_0x5be3('0x41')][_0x5be3('0x47')](_0x508876[_0x5be3('0x48')],{})[_0x5be3('0x1f')](respondWithResult(_0x38856d,0xc9))[_0x5be3('0x44')](handleError(_0x38856d,null));};exports[_0x5be3('0x49')]=function(_0x3f992d,_0x1048a4){if(_0x3f992d[_0x5be3('0x48')]['id']){delete _0x3f992d[_0x5be3('0x48')]['id'];}return db[_0x5be3('0x41')]['find']({'where':{'id':_0x3f992d[_0x5be3('0x45')]['id']}})['then'](handleEntityNotFound(_0x1048a4,null))['then'](saveUpdates(_0x3f992d[_0x5be3('0x48')],null))[_0x5be3('0x1f')](respondWithResult(_0x1048a4,null))[_0x5be3('0x44')](handleError(_0x1048a4,null));};exports[_0x5be3('0x4a')]=function(_0x54eac7,_0x1ee24a){return db[_0x5be3('0x41')][_0x5be3('0x4b')]({'where':{'id':_0x54eac7[_0x5be3('0x45')]['id']}})[_0x5be3('0x1f')](handleEntityNotFound(_0x1ee24a,null))[_0x5be3('0x1f')](removeEntity(_0x1ee24a,null))[_0x5be3('0x44')](handleError(_0x1ee24a,null));};exports['describe']=function(_0xea47e5,_0x3e6549){return db['MailSubstatus'][_0x5be3('0x4c')]()[_0x5be3('0x1f')](respondWithResult(_0x3e6549,null))[_0x5be3('0x44')](handleError(_0x3e6549,null));}; \ No newline at end of file +var _0xb1b8=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','render','merge','body','contact','message','agent','interaction','index','MailSubstatus','rawAttributes','fieldName','key','model','map','query','attributes','intersection','fields','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','options','catch','show','params','keys','includeAll','include','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x4adfa4,_0x121c5a){var _0x14cec1=function(_0x4fd975){while(--_0x4fd975){_0x4adfa4['push'](_0x4adfa4['shift']());}};_0x14cec1(++_0x121c5a);}(_0xb1b8,0x133));var _0x8b1b=function(_0x923ab6,_0x200ec5){_0x923ab6=_0x923ab6-0x0;var _0x484752=_0xb1b8[_0x923ab6];return _0x484752;};'use strict';var emlformat=require(_0x8b1b('0x0'));var rimraf=require(_0x8b1b('0x1'));var zipdir=require(_0x8b1b('0x2'));var jsonpatch=require(_0x8b1b('0x3'));var rp=require('request-promise');var moment=require(_0x8b1b('0x4'));var BPromise=require(_0x8b1b('0x5'));var Mustache=require(_0x8b1b('0x6'));var util=require(_0x8b1b('0x7'));var path=require(_0x8b1b('0x8'));var sox=require(_0x8b1b('0x9'));var csv=require('to-csv');var ejs=require(_0x8b1b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b1b('0xb'));var squel=require(_0x8b1b('0xc'));var crypto=require(_0x8b1b('0xd'));var jsforce=require(_0x8b1b('0xe'));var deskjs=require(_0x8b1b('0xf'));var toCsv=require(_0x8b1b('0x10'));var querystring=require(_0x8b1b('0x11'));var Papa=require(_0x8b1b('0x12'));var Redis=require(_0x8b1b('0x13'));var authService=require(_0x8b1b('0x14'));var qs=require(_0x8b1b('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b1b('0x16'));var logger=require(_0x8b1b('0x17'))('api');var utils=require(_0x8b1b('0x18'));var config=require(_0x8b1b('0x19'));var licenseUtil=require(_0x8b1b('0x1a'));var db=require(_0x8b1b('0x1b'))['db'];function respondWithStatusCode(_0x56d25c,_0x43309c){_0x43309c=_0x43309c||0xcc;return function(_0x29cdad){if(_0x29cdad){return _0x56d25c['sendStatus'](_0x43309c);}return _0x56d25c[_0x8b1b('0x1c')](_0x43309c)['end']();};}function respondWithResult(_0x104580,_0x1b2c63){_0x1b2c63=_0x1b2c63||0xc8;return function(_0x3121c2){if(_0x3121c2){return _0x104580[_0x8b1b('0x1c')](_0x1b2c63)[_0x8b1b('0x1d')](_0x3121c2);}};}function respondWithFilteredResult(_0x47db77,_0x3f4aae){return function(_0x5ce2ac){if(_0x5ce2ac){var _0x276f6e=typeof _0x3f4aae[_0x8b1b('0x1e')]==='undefined'&&typeof _0x3f4aae['limit']==='undefined';var _0x4c8f72=_0x5ce2ac[_0x8b1b('0x1f')];var _0x554174=_0x276f6e?0x0:_0x3f4aae[_0x8b1b('0x1e')];var _0x3ec4ae=_0x276f6e?_0x5ce2ac['count']:_0x3f4aae[_0x8b1b('0x1e')]+_0x3f4aae[_0x8b1b('0x20')];var _0x37bd31;if(_0x3ec4ae>=_0x4c8f72){_0x3ec4ae=_0x4c8f72;_0x37bd31=0xc8;}else{_0x37bd31=0xce;}_0x47db77[_0x8b1b('0x1c')](_0x37bd31);return _0x47db77[_0x8b1b('0x21')](_0x8b1b('0x22'),_0x554174+'-'+_0x3ec4ae+'/'+_0x4c8f72)[_0x8b1b('0x1d')](_0x5ce2ac);}return null;};}function patchUpdates(_0x377ded){return function(_0x42dd3d){try{jsonpatch[_0x8b1b('0x23')](_0x42dd3d,_0x377ded,!![]);}catch(_0x49ebba){return BPromise[_0x8b1b('0x24')](_0x49ebba);}return _0x42dd3d['save']();};}function saveUpdates(_0x22489c,_0xdbfc8){return function(_0x4eb0b2){if(_0x4eb0b2){return _0x4eb0b2[_0x8b1b('0x25')](_0x22489c)[_0x8b1b('0x26')](function(_0x5c295d){return _0x5c295d;});}return null;};}function removeEntity(_0x144933,_0x51bfa4){return function(_0x12e2e8){if(_0x12e2e8){return _0x12e2e8[_0x8b1b('0x27')]()['then'](function(){_0x144933['status'](0xcc)[_0x8b1b('0x28')]();});}};}function handleEntityNotFound(_0xcd8ca7,_0x45e534){return function(_0x2c9fb5){if(!_0x2c9fb5){_0xcd8ca7[_0x8b1b('0x29')](0x194);}return _0x2c9fb5;};}function handleError(_0x570dc5,_0x6893ee){_0x6893ee=_0x6893ee||0x1f4;return function(_0xa25da4){logger[_0x8b1b('0x2a')](_0xa25da4['stack']);if(_0xa25da4[_0x8b1b('0x2b')]){delete _0xa25da4[_0x8b1b('0x2b')];}_0x570dc5[_0x8b1b('0x1c')](_0x6893ee)['send'](_0xa25da4);};}function getMustacheRender(_0x38feb6,_0x239cb7){return Mustache[_0x8b1b('0x2c')](_0x38feb6,_[_0x8b1b('0x2d')](_0x239cb7[_0x8b1b('0x2e')],{'contact':_0x239cb7[_0x8b1b('0x2f')],'message':_0x239cb7[_0x8b1b('0x30')],'agent':_0x239cb7[_0x8b1b('0x31')],'interaction':_0x239cb7[_0x8b1b('0x32')],'account':_0x239cb7['account']}))||'';}exports[_0x8b1b('0x33')]=function(_0x3893d5,_0x204b36){var _0x1c685c={},_0x50a110={},_0x2cf375={'count':0x0,'rows':[]};var _0x1f3e96=_['map'](db[_0x8b1b('0x34')][_0x8b1b('0x35')],function(_0x2c500c){return{'name':_0x2c500c[_0x8b1b('0x36')],'type':_0x2c500c['type'][_0x8b1b('0x37')]};});_0x50a110[_0x8b1b('0x38')]=_[_0x8b1b('0x39')](_0x1f3e96,_0x8b1b('0x2b'));_0x50a110[_0x8b1b('0x3a')]=_['keys'](_0x3893d5[_0x8b1b('0x3a')]);_0x50a110['filters']=_['intersection'](_0x50a110[_0x8b1b('0x38')],_0x50a110[_0x8b1b('0x3a')]);_0x1c685c[_0x8b1b('0x3b')]=_[_0x8b1b('0x3c')](_0x50a110[_0x8b1b('0x38')],qs['fields'](_0x3893d5[_0x8b1b('0x3a')][_0x8b1b('0x3d')]));_0x1c685c['attributes']=_0x1c685c[_0x8b1b('0x3b')]['length']?_0x1c685c[_0x8b1b('0x3b')]:_0x50a110[_0x8b1b('0x38')];if(!_0x3893d5[_0x8b1b('0x3a')]['hasOwnProperty'](_0x8b1b('0x3e'))){_0x1c685c[_0x8b1b('0x20')]=qs[_0x8b1b('0x20')](_0x3893d5['query'][_0x8b1b('0x20')]);_0x1c685c[_0x8b1b('0x1e')]=qs[_0x8b1b('0x1e')](_0x3893d5[_0x8b1b('0x3a')][_0x8b1b('0x1e')]);}_0x1c685c[_0x8b1b('0x3f')]=qs[_0x8b1b('0x40')](_0x3893d5[_0x8b1b('0x3a')][_0x8b1b('0x40')]);_0x1c685c['where']=qs[_0x8b1b('0x41')](_[_0x8b1b('0x42')](_0x3893d5[_0x8b1b('0x3a')],_0x50a110[_0x8b1b('0x41')]),_0x1f3e96);if(_0x3893d5[_0x8b1b('0x3a')][_0x8b1b('0x43')]){_0x1c685c[_0x8b1b('0x44')]=_['merge'](_0x1c685c[_0x8b1b('0x44')],{'$or':_['map'](_0x1f3e96,function(_0x27d010){if(_0x27d010[_0x8b1b('0x45')]!==_0x8b1b('0x46')){var _0x383a24={};_0x383a24[_0x27d010[_0x8b1b('0x2b')]]={'$like':'%'+_0x3893d5[_0x8b1b('0x3a')][_0x8b1b('0x43')]+'%'};return _0x383a24;}})});}_0x1c685c=_['merge']({},_0x1c685c,_0x3893d5[_0x8b1b('0x47')]);var _0x351d8d={'where':_0x1c685c[_0x8b1b('0x44')]};return db[_0x8b1b('0x34')][_0x8b1b('0x1f')](_0x351d8d)[_0x8b1b('0x26')](function(_0x6b5a88){_0x2cf375[_0x8b1b('0x1f')]=_0x6b5a88;if(_0x3893d5[_0x8b1b('0x3a')]['includeAll']){_0x1c685c['include']=[{'all':!![]}];}return db[_0x8b1b('0x34')]['findAll'](_0x1c685c);})[_0x8b1b('0x26')](function(_0x3d693a){_0x2cf375['rows']=_0x3d693a;return _0x2cf375;})[_0x8b1b('0x26')](respondWithFilteredResult(_0x204b36,_0x1c685c))[_0x8b1b('0x48')](handleError(_0x204b36,null));};exports[_0x8b1b('0x49')]=function(_0x5a4ecd,_0x111bce){var _0x3cf39e={'raw':!![],'where':{'id':_0x5a4ecd[_0x8b1b('0x4a')]['id']}},_0x6893c0={};_0x6893c0[_0x8b1b('0x38')]=_[_0x8b1b('0x4b')](db[_0x8b1b('0x34')][_0x8b1b('0x35')]);_0x6893c0['query']=_[_0x8b1b('0x4b')](_0x5a4ecd['query']);_0x6893c0[_0x8b1b('0x41')]=_[_0x8b1b('0x3c')](_0x6893c0['model'],_0x6893c0[_0x8b1b('0x3a')]);_0x3cf39e[_0x8b1b('0x3b')]=_['intersection'](_0x6893c0['model'],qs[_0x8b1b('0x3d')](_0x5a4ecd[_0x8b1b('0x3a')][_0x8b1b('0x3d')]));_0x3cf39e[_0x8b1b('0x3b')]=_0x3cf39e[_0x8b1b('0x3b')]['length']?_0x3cf39e[_0x8b1b('0x3b')]:_0x6893c0[_0x8b1b('0x38')];if(_0x5a4ecd[_0x8b1b('0x3a')][_0x8b1b('0x4c')]){_0x3cf39e[_0x8b1b('0x4d')]=[{'all':!![]}];}_0x3cf39e=_[_0x8b1b('0x2d')]({},_0x3cf39e,_0x5a4ecd['options']);return db[_0x8b1b('0x34')][_0x8b1b('0x4e')](_0x3cf39e)[_0x8b1b('0x26')](handleEntityNotFound(_0x111bce,null))[_0x8b1b('0x26')](respondWithResult(_0x111bce,null))['catch'](handleError(_0x111bce,null));};exports[_0x8b1b('0x4f')]=function(_0x3e3144,_0x1c3fb0){return db[_0x8b1b('0x34')]['create'](_0x3e3144[_0x8b1b('0x2e')],{})[_0x8b1b('0x26')](respondWithResult(_0x1c3fb0,0xc9))[_0x8b1b('0x48')](handleError(_0x1c3fb0,null));};exports[_0x8b1b('0x25')]=function(_0x4c87ec,_0x39ecb7){if(_0x4c87ec['body']['id']){delete _0x4c87ec['body']['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x4c87ec['params']['id']}})['then'](handleEntityNotFound(_0x39ecb7,null))[_0x8b1b('0x26')](saveUpdates(_0x4c87ec['body'],null))['then'](respondWithResult(_0x39ecb7,null))[_0x8b1b('0x48')](handleError(_0x39ecb7,null));};exports['destroy']=function(_0x5dca67,_0x5a6e5a){return db[_0x8b1b('0x34')][_0x8b1b('0x4e')]({'where':{'id':_0x5dca67[_0x8b1b('0x4a')]['id']}})[_0x8b1b('0x26')](handleEntityNotFound(_0x5a6e5a,null))['then'](removeEntity(_0x5a6e5a,null))[_0x8b1b('0x48')](handleError(_0x5a6e5a,null));};exports[_0x8b1b('0x50')]=function(_0x280cb1,_0x511fa8){return db[_0x8b1b('0x34')][_0x8b1b('0x50')]()[_0x8b1b('0x26')](respondWithResult(_0x511fa8,null))['catch'](handleError(_0x511fa8,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index cbf2fff..dfad282 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 _0xeda7=['mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus'];(function(_0x5ed014,_0x1b4e0c){var _0x4a6a98=function(_0x3d2880){while(--_0x3d2880){_0x5ed014['push'](_0x5ed014['shift']());}};_0x4a6a98(++_0x1b4e0c);}(_0xeda7,0x196));var _0x7eda=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xeda7[_0xd09668];return _0x68726;};'use strict';var _=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var logger=require(_0x7eda('0x2'))(_0x7eda('0x3'));var moment=require(_0x7eda('0x4'));var BPromise=require(_0x7eda('0x5'));var rp=require(_0x7eda('0x6'));var fs=require('fs');var path=require(_0x7eda('0x7'));var rimraf=require(_0x7eda('0x8'));var config=require(_0x7eda('0x9'));var attributes=require(_0x7eda('0xa'));module[_0x7eda('0xb')]=function(_0x6ee7be,_0x328430){return _0x6ee7be[_0x7eda('0xc')](_0x7eda('0xd'),attributes,{'tableName':_0x7eda('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69d4=['util','api','moment','bluebird','path','../../config/environment','./mailSubstatus.attributes','exports','define','mail_substatuses','lodash'];(function(_0x1e44bc,_0x4f79ba){var _0x235942=function(_0x148b67){while(--_0x148b67){_0x1e44bc['push'](_0x1e44bc['shift']());}};_0x235942(++_0x4f79ba);}(_0x69d4,0x83));var _0x469d=function(_0x3457b4,_0x4cd8f9){_0x3457b4=_0x3457b4-0x0;var _0xaa8fa9=_0x69d4[_0x3457b4];return _0xaa8fa9;};'use strict';var _=require(_0x469d('0x0'));var util=require(_0x469d('0x1'));var logger=require('../../config/logger')(_0x469d('0x2'));var moment=require(_0x469d('0x3'));var BPromise=require(_0x469d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x469d('0x5'));var rimraf=require('rimraf');var config=require(_0x469d('0x6'));var attributes=require(_0x469d('0x7'));module[_0x469d('0x8')]=function(_0x336101,_0x3d0ec8){return _0x336101[_0x469d('0x9')]('MailSubstatus',attributes,{'tableName':_0x469d('0xa'),'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 7b73379..a70301e 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x3031f8,_0x2cff79){var _0x1538cc=function(_0x24a6be){while(--_0x24a6be){_0x3031f8['push'](_0x3031f8['shift']());}};_0x1538cc(++_0x2cff79);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0xcb91[_0x3a1ea5];return _0xfac9b2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xdace=['request\x20sent','debug','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xdace,0xc5));var _0xedac=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0xdace[_0x27d958];return _0x53e63e;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 6fdaeae..8ee4246 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 _0x9e9b=['delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x39b25f,_0x422e8d){var _0x814f9c=function(_0x835c4f){while(--_0x835c4f){_0x39b25f['push'](_0x39b25f['shift']());}};_0x814f9c(++_0x422e8d);}(_0x9e9b,0x1a7));var _0xb9e9=function(_0x459a0a,_0x25c46f){_0x459a0a=_0x459a0a-0x0;var _0x4ab46c=_0x9e9b[_0x459a0a];return _0x4ab46c;};'use strict';var multer=require(_0xb9e9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb9e9('0x1'));var express=require(_0xb9e9('0x2'));var router=express[_0xb9e9('0x3')]();var fs_extra=require(_0xb9e9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb9e9('0x5'));var config=require(_0xb9e9('0x6'));var controller=require('./mailTransferReport.controller');router[_0xb9e9('0x7')]('/',auth[_0xb9e9('0x8')](),controller[_0xb9e9('0x9')]);router[_0xb9e9('0x7')](_0xb9e9('0xa'),auth[_0xb9e9('0x8')](),controller[_0xb9e9('0xb')]);router[_0xb9e9('0x7')](_0xb9e9('0xc'),auth[_0xb9e9('0x8')](),controller[_0xb9e9('0xd')]);router[_0xb9e9('0xe')]('/',auth['isAuthenticated'](),controller[_0xb9e9('0xf')]);router[_0xb9e9('0x10')]('/:id',auth[_0xb9e9('0x8')](),controller[_0xb9e9('0x11')]);router[_0xb9e9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xb9e9('0x13')]);module[_0xb9e9('0x14')]=router; \ No newline at end of file +var _0x2bdb=['exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0xcb3de4,_0x406723){var _0x4c3c22=function(_0x130f90){while(--_0x130f90){_0xcb3de4['push'](_0xcb3de4['shift']());}};_0x4c3c22(++_0x406723);}(_0x2bdb,0x105));var _0xb2bd=function(_0x5f2c16,_0x3c9ddd){_0x5f2c16=_0x5f2c16-0x0;var _0x28c9f1=_0x2bdb[_0x5f2c16];return _0x28c9f1;};'use strict';var multer=require(_0xb2bd('0x0'));var util=require('util');var path=require(_0xb2bd('0x1'));var timeout=require('connect-timeout');var express=require(_0xb2bd('0x2'));var router=express[_0xb2bd('0x3')]();var fs_extra=require(_0xb2bd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb2bd('0x5'));var config=require(_0xb2bd('0x6'));var controller=require(_0xb2bd('0x7'));router[_0xb2bd('0x8')]('/',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xa')]);router[_0xb2bd('0x8')]('/describe',auth[_0xb2bd('0x9')](),controller['describe']);router[_0xb2bd('0x8')](_0xb2bd('0xb'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xc')]);router[_0xb2bd('0xd')]('/',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xe')]);router[_0xb2bd('0xf')](_0xb2bd('0xb'),auth['isAuthenticated'](),controller[_0xb2bd('0x10')]);router[_0xb2bd('0x11')](_0xb2bd('0xb'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0x12')]);module[_0xb2bd('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 83cd885..91e33c9 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 _0x434c=['ENUM','account','agent','queue','DATE','NOW','exports','STRING'];(function(_0x5b185d,_0x5b8d6f){var _0x1253a5=function(_0x3fef8c){while(--_0x3fef8c){_0x5b185d['push'](_0x5b185d['shift']());}};_0x1253a5(++_0x5b8d6f);}(_0x434c,0x16e));var _0xc434=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x434c[_0x432682];return _0x463d05;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xc434('0x0')]={'uniqueid':{'type':Sequelize[_0xc434('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xc434('0x2')](_0xc434('0x3'),_0xc434('0x4'),_0xc434('0x5')),'allowNull':![],'defaultValue':_0xc434('0x5')},'transferredAt':{'type':Sequelize[_0xc434('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xc434('0x7')]}}; \ No newline at end of file +var _0xdce6=['account','agent','queue','sequelize','STRING','ENUM'];(function(_0x2b01fe,_0x4a70e8){var _0x58e619=function(_0xe80865){while(--_0xe80865){_0x2b01fe['push'](_0x2b01fe['shift']());}};_0x58e619(++_0x4a70e8);}(_0xdce6,0x1d1));var _0x6dce=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xdce6[_0x6c993a];return _0x27f547;};'use strict';var moment=require('moment');var Sequelize=require(_0x6dce('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6dce('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6dce('0x2')](_0x6dce('0x3'),_0x6dce('0x4'),'queue'),'allowNull':![],'defaultValue':_0x6dce('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 479976e..97fa4a0 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 _0xc121=['where','filter','options','include','findAll','rows','catch','show','params','create','find','describe','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','end','error','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','MailTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x99c257,_0x52331b){var _0x30dc8f=function(_0x28295d){while(--_0x28295d){_0x99c257['push'](_0x99c257['shift']());}};_0x30dc8f(++_0x52331b);}(_0xc121,0x18d));var _0x1c12=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xc121[_0x35885a];return _0xe86249;};'use strict';var emlformat=require(_0x1c12('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1c12('0x1'));var rp=require('request-promise');var moment=require(_0x1c12('0x2'));var BPromise=require(_0x1c12('0x3'));var Mustache=require(_0x1c12('0x4'));var util=require('util');var path=require(_0x1c12('0x5'));var sox=require(_0x1c12('0x6'));var csv=require(_0x1c12('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c12('0x8'));var _=require(_0x1c12('0x9'));var squel=require(_0x1c12('0xa'));var crypto=require(_0x1c12('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1c12('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1c12('0xd'));var Redis=require(_0x1c12('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1c12('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c12('0x10'));var logger=require(_0x1c12('0x11'))('api');var utils=require(_0x1c12('0x12'));var config=require(_0x1c12('0x13'));var licenseUtil=require(_0x1c12('0x14'));var db=require(_0x1c12('0x15'))['db'];function respondWithStatusCode(_0x24beb4,_0x30d7fa){_0x30d7fa=_0x30d7fa||0xcc;return function(_0x53b53f){if(_0x53b53f){return _0x24beb4[_0x1c12('0x16')](_0x30d7fa);}return _0x24beb4[_0x1c12('0x17')](_0x30d7fa)['end']();};}function respondWithResult(_0x7d955c,_0x1dfcb6){_0x1dfcb6=_0x1dfcb6||0xc8;return function(_0xab8800){if(_0xab8800){return _0x7d955c[_0x1c12('0x17')](_0x1dfcb6)[_0x1c12('0x18')](_0xab8800);}};}function respondWithFilteredResult(_0x36a3d8,_0x555583){return function(_0x5ba0ea){if(_0x5ba0ea){var _0xc6136a=typeof _0x555583[_0x1c12('0x19')]===_0x1c12('0x1a')&&typeof _0x555583[_0x1c12('0x1b')]===_0x1c12('0x1a');var _0x245c03=_0x5ba0ea[_0x1c12('0x1c')];var _0x510a42=_0xc6136a?0x0:_0x555583[_0x1c12('0x19')];var _0x1f92f4=_0xc6136a?_0x5ba0ea[_0x1c12('0x1c')]:_0x555583['offset']+_0x555583['limit'];var _0x52aba3;if(_0x1f92f4>=_0x245c03){_0x1f92f4=_0x245c03;_0x52aba3=0xc8;}else{_0x52aba3=0xce;}_0x36a3d8['status'](_0x52aba3);return _0x36a3d8[_0x1c12('0x1d')]('Content-Range',_0x510a42+'-'+_0x1f92f4+'/'+_0x245c03)[_0x1c12('0x18')](_0x5ba0ea);}return null;};}function patchUpdates(_0x284538){return function(_0xd1d057){try{jsonpatch[_0x1c12('0x1e')](_0xd1d057,_0x284538,!![]);}catch(_0x544048){return BPromise[_0x1c12('0x1f')](_0x544048);}return _0xd1d057['save']();};}function saveUpdates(_0x3a97f6,_0x4e017f){return function(_0x2131de){if(_0x2131de){return _0x2131de[_0x1c12('0x20')](_0x3a97f6)[_0x1c12('0x21')](function(_0x2262f0){return _0x2262f0;});}return null;};}function removeEntity(_0x210cf1,_0x2a2312){return function(_0x4bfa4d){if(_0x4bfa4d){return _0x4bfa4d[_0x1c12('0x22')]()['then'](function(){_0x210cf1[_0x1c12('0x17')](0xcc)[_0x1c12('0x23')]();});}};}function handleEntityNotFound(_0x2b71aa,_0x37c155){return function(_0x43e2b7){if(!_0x43e2b7){_0x2b71aa[_0x1c12('0x16')](0x194);}return _0x43e2b7;};}function handleError(_0x4b9f66,_0x5d0f16){_0x5d0f16=_0x5d0f16||0x1f4;return function(_0x2fa1ff){logger[_0x1c12('0x24')](_0x2fa1ff['stack']);if(_0x2fa1ff[_0x1c12('0x25')]){delete _0x2fa1ff[_0x1c12('0x25')];}_0x4b9f66[_0x1c12('0x17')](_0x5d0f16)[_0x1c12('0x26')](_0x2fa1ff);};}function getMustacheRender(_0x40c362,_0x5c5f43){return Mustache[_0x1c12('0x27')](_0x40c362,_[_0x1c12('0x28')](_0x5c5f43[_0x1c12('0x29')],{'contact':_0x5c5f43[_0x1c12('0x2a')],'message':_0x5c5f43[_0x1c12('0x2b')],'agent':_0x5c5f43[_0x1c12('0x2c')],'interaction':_0x5c5f43[_0x1c12('0x2d')],'account':_0x5c5f43[_0x1c12('0x2e')]}))||'';}exports[_0x1c12('0x2f')]=function(_0x165387,_0x53271b){var _0x4e8db8={},_0x35acd9={},_0x441dc5={'count':0x0,'rows':[]};var _0x4f98bc=_[_0x1c12('0x30')](db[_0x1c12('0x31')][_0x1c12('0x32')],function(_0x5083bb){return{'name':_0x5083bb['fieldName'],'type':_0x5083bb[_0x1c12('0x33')][_0x1c12('0x34')]};});_0x35acd9[_0x1c12('0x35')]=_[_0x1c12('0x30')](_0x4f98bc,'name');_0x35acd9[_0x1c12('0x36')]=_[_0x1c12('0x37')](_0x165387[_0x1c12('0x36')]);_0x35acd9[_0x1c12('0x38')]=_[_0x1c12('0x39')](_0x35acd9[_0x1c12('0x35')],_0x35acd9[_0x1c12('0x36')]);_0x4e8db8[_0x1c12('0x3a')]=_[_0x1c12('0x39')](_0x35acd9['model'],qs[_0x1c12('0x3b')](_0x165387['query'][_0x1c12('0x3b')]));_0x4e8db8[_0x1c12('0x3a')]=_0x4e8db8[_0x1c12('0x3a')][_0x1c12('0x3c')]?_0x4e8db8[_0x1c12('0x3a')]:_0x35acd9['model'];if(!_0x165387[_0x1c12('0x36')][_0x1c12('0x3d')](_0x1c12('0x3e'))){_0x4e8db8[_0x1c12('0x1b')]=qs[_0x1c12('0x1b')](_0x165387[_0x1c12('0x36')][_0x1c12('0x1b')]);_0x4e8db8['offset']=qs[_0x1c12('0x19')](_0x165387['query']['offset']);}_0x4e8db8[_0x1c12('0x3f')]=qs[_0x1c12('0x40')](_0x165387[_0x1c12('0x36')][_0x1c12('0x40')]);_0x4e8db8[_0x1c12('0x41')]=qs[_0x1c12('0x38')](_['pick'](_0x165387[_0x1c12('0x36')],_0x35acd9[_0x1c12('0x38')]),_0x4f98bc);if(_0x165387[_0x1c12('0x36')]['filter']){_0x4e8db8[_0x1c12('0x41')]=_[_0x1c12('0x28')](_0x4e8db8['where'],{'$or':_[_0x1c12('0x30')](_0x4f98bc,function(_0x11bb36){if(_0x11bb36['type']!=='VIRTUAL'){var _0x4c5a4c={};_0x4c5a4c[_0x11bb36[_0x1c12('0x25')]]={'$like':'%'+_0x165387['query'][_0x1c12('0x42')]+'%'};return _0x4c5a4c;}})});}_0x4e8db8=_[_0x1c12('0x28')]({},_0x4e8db8,_0x165387[_0x1c12('0x43')]);var _0xbf4676={'where':_0x4e8db8[_0x1c12('0x41')]};return db[_0x1c12('0x31')][_0x1c12('0x1c')](_0xbf4676)['then'](function(_0x3327e0){_0x441dc5[_0x1c12('0x1c')]=_0x3327e0;if(_0x165387[_0x1c12('0x36')]['includeAll']){_0x4e8db8[_0x1c12('0x44')]=[{'all':!![]}];}return db[_0x1c12('0x31')][_0x1c12('0x45')](_0x4e8db8);})[_0x1c12('0x21')](function(_0x4e75eb){_0x441dc5[_0x1c12('0x46')]=_0x4e75eb;return _0x441dc5;})[_0x1c12('0x21')](respondWithFilteredResult(_0x53271b,_0x4e8db8))[_0x1c12('0x47')](handleError(_0x53271b,null));};exports[_0x1c12('0x48')]=function(_0x211fb7,_0x4a8bac){var _0x4d20ac={'raw':!![],'where':{'id':_0x211fb7[_0x1c12('0x49')]['id']}},_0x782759={};_0x782759[_0x1c12('0x35')]=_['keys'](db['MailTransferReport'][_0x1c12('0x32')]);_0x782759[_0x1c12('0x36')]=_['keys'](_0x211fb7[_0x1c12('0x36')]);_0x782759[_0x1c12('0x38')]=_[_0x1c12('0x39')](_0x782759[_0x1c12('0x35')],_0x782759[_0x1c12('0x36')]);_0x4d20ac[_0x1c12('0x3a')]=_['intersection'](_0x782759['model'],qs[_0x1c12('0x3b')](_0x211fb7[_0x1c12('0x36')][_0x1c12('0x3b')]));_0x4d20ac[_0x1c12('0x3a')]=_0x4d20ac[_0x1c12('0x3a')]['length']?_0x4d20ac['attributes']:_0x782759[_0x1c12('0x35')];if(_0x211fb7[_0x1c12('0x36')]['includeAll']){_0x4d20ac['include']=[{'all':!![]}];}_0x4d20ac=_['merge']({},_0x4d20ac,_0x211fb7[_0x1c12('0x43')]);return db[_0x1c12('0x31')]['find'](_0x4d20ac)[_0x1c12('0x21')](handleEntityNotFound(_0x4a8bac,null))[_0x1c12('0x21')](respondWithResult(_0x4a8bac,null))[_0x1c12('0x47')](handleError(_0x4a8bac,null));};exports[_0x1c12('0x4a')]=function(_0x577c7c,_0x11420c){return db[_0x1c12('0x31')]['create'](_0x577c7c['body'],{})[_0x1c12('0x21')](respondWithResult(_0x11420c,0xc9))['catch'](handleError(_0x11420c,null));};exports[_0x1c12('0x20')]=function(_0x1f208c,_0x264ff1){if(_0x1f208c[_0x1c12('0x29')]['id']){delete _0x1f208c[_0x1c12('0x29')]['id'];}return db[_0x1c12('0x31')][_0x1c12('0x4b')]({'where':{'id':_0x1f208c[_0x1c12('0x49')]['id']}})[_0x1c12('0x21')](handleEntityNotFound(_0x264ff1,null))[_0x1c12('0x21')](saveUpdates(_0x1f208c[_0x1c12('0x29')],null))['then'](respondWithResult(_0x264ff1,null))['catch'](handleError(_0x264ff1,null));};exports[_0x1c12('0x22')]=function(_0x9638a8,_0x415e14){return db[_0x1c12('0x31')]['find']({'where':{'id':_0x9638a8[_0x1c12('0x49')]['id']}})[_0x1c12('0x21')](handleEntityNotFound(_0x415e14,null))['then'](removeEntity(_0x415e14,null))[_0x1c12('0x47')](handleError(_0x415e14,null));};exports[_0x1c12('0x4c')]=function(_0x1f5587,_0x1cb3cc){return db[_0x1c12('0x31')][_0x1c12('0x4c')]()['then'](respondWithResult(_0x1cb3cc,null))[_0x1c12('0x47')](handleError(_0x1cb3cc,null));}; \ No newline at end of file +var _0x7d83=['bluebird','mustache','util','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','merge','body','contact','message','agent','interaction','account','MailTransferReport','fieldName','type','key','map','query','keys','filters','intersection','attributes','length','model','nolimit','order','sort','pick','filter','where','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','fields','include','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x7d83,0x18f));var _0x37d8=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x7d83[_0x166742];return _0xb7814a;};'use strict';var emlformat=require(_0x37d8('0x0'));var rimraf=require(_0x37d8('0x1'));var zipdir=require(_0x37d8('0x2'));var jsonpatch=require(_0x37d8('0x3'));var rp=require(_0x37d8('0x4'));var moment=require(_0x37d8('0x5'));var BPromise=require(_0x37d8('0x6'));var Mustache=require(_0x37d8('0x7'));var util=require(_0x37d8('0x8'));var path=require('path');var sox=require(_0x37d8('0x9'));var csv=require('to-csv');var ejs=require(_0x37d8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x37d8('0xb'));var crypto=require(_0x37d8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x37d8('0xd'));var toCsv=require(_0x37d8('0xe'));var querystring=require(_0x37d8('0xf'));var Papa=require(_0x37d8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x37d8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37d8('0x12'));var logger=require(_0x37d8('0x13'))(_0x37d8('0x14'));var utils=require(_0x37d8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x37d8('0x16'));var db=require(_0x37d8('0x17'))['db'];function respondWithStatusCode(_0x4d5142,_0x492b7f){_0x492b7f=_0x492b7f||0xcc;return function(_0x333bca){if(_0x333bca){return _0x4d5142[_0x37d8('0x18')](_0x492b7f);}return _0x4d5142[_0x37d8('0x19')](_0x492b7f)[_0x37d8('0x1a')]();};}function respondWithResult(_0x16e9d7,_0xa15eb9){_0xa15eb9=_0xa15eb9||0xc8;return function(_0xd61b2f){if(_0xd61b2f){return _0x16e9d7[_0x37d8('0x19')](_0xa15eb9)[_0x37d8('0x1b')](_0xd61b2f);}};}function respondWithFilteredResult(_0x5eac40,_0x375d88){return function(_0x2d0abb){if(_0x2d0abb){var _0x504ee4=typeof _0x375d88[_0x37d8('0x1c')]===_0x37d8('0x1d')&&typeof _0x375d88[_0x37d8('0x1e')]===_0x37d8('0x1d');var _0x1863f7=_0x2d0abb[_0x37d8('0x1f')];var _0xae2b9c=_0x504ee4?0x0:_0x375d88[_0x37d8('0x1c')];var _0x3c4267=_0x504ee4?_0x2d0abb[_0x37d8('0x1f')]:_0x375d88[_0x37d8('0x1c')]+_0x375d88[_0x37d8('0x1e')];var _0xc07daf;if(_0x3c4267>=_0x1863f7){_0x3c4267=_0x1863f7;_0xc07daf=0xc8;}else{_0xc07daf=0xce;}_0x5eac40[_0x37d8('0x19')](_0xc07daf);return _0x5eac40[_0x37d8('0x20')](_0x37d8('0x21'),_0xae2b9c+'-'+_0x3c4267+'/'+_0x1863f7)[_0x37d8('0x1b')](_0x2d0abb);}return null;};}function patchUpdates(_0xc7ba01){return function(_0x5dca14){try{jsonpatch[_0x37d8('0x22')](_0x5dca14,_0xc7ba01,!![]);}catch(_0x1b9dd8){return BPromise[_0x37d8('0x23')](_0x1b9dd8);}return _0x5dca14[_0x37d8('0x24')]();};}function saveUpdates(_0x142136,_0x350b5a){return function(_0x481ed6){if(_0x481ed6){return _0x481ed6[_0x37d8('0x25')](_0x142136)[_0x37d8('0x26')](function(_0x530367){return _0x530367;});}return null;};}function removeEntity(_0x354bd0,_0x1bded1){return function(_0x398b28){if(_0x398b28){return _0x398b28[_0x37d8('0x27')]()['then'](function(){_0x354bd0[_0x37d8('0x19')](0xcc)[_0x37d8('0x1a')]();});}};}function handleEntityNotFound(_0x2bd7e1,_0x3b4117){return function(_0x2b1a46){if(!_0x2b1a46){_0x2bd7e1[_0x37d8('0x18')](0x194);}return _0x2b1a46;};}function handleError(_0x5083b3,_0x23b91b){_0x23b91b=_0x23b91b||0x1f4;return function(_0x16e430){logger[_0x37d8('0x28')](_0x16e430['stack']);if(_0x16e430[_0x37d8('0x29')]){delete _0x16e430['name'];}_0x5083b3[_0x37d8('0x19')](_0x23b91b)[_0x37d8('0x2a')](_0x16e430);};}function getMustacheRender(_0x32d8e5,_0x479f8f){return Mustache['render'](_0x32d8e5,_[_0x37d8('0x2b')](_0x479f8f[_0x37d8('0x2c')],{'contact':_0x479f8f[_0x37d8('0x2d')],'message':_0x479f8f[_0x37d8('0x2e')],'agent':_0x479f8f[_0x37d8('0x2f')],'interaction':_0x479f8f[_0x37d8('0x30')],'account':_0x479f8f[_0x37d8('0x31')]}))||'';}exports['index']=function(_0x50aae4,_0x74553f){var _0x524628={},_0x2ef540={},_0x237fae={'count':0x0,'rows':[]};var _0x5a558e=_['map'](db[_0x37d8('0x32')]['rawAttributes'],function(_0x270750){return{'name':_0x270750[_0x37d8('0x33')],'type':_0x270750[_0x37d8('0x34')][_0x37d8('0x35')]};});_0x2ef540['model']=_[_0x37d8('0x36')](_0x5a558e,_0x37d8('0x29'));_0x2ef540[_0x37d8('0x37')]=_[_0x37d8('0x38')](_0x50aae4['query']);_0x2ef540[_0x37d8('0x39')]=_[_0x37d8('0x3a')](_0x2ef540['model'],_0x2ef540[_0x37d8('0x37')]);_0x524628['attributes']=_[_0x37d8('0x3a')](_0x2ef540['model'],qs['fields'](_0x50aae4[_0x37d8('0x37')]['fields']));_0x524628[_0x37d8('0x3b')]=_0x524628[_0x37d8('0x3b')][_0x37d8('0x3c')]?_0x524628['attributes']:_0x2ef540[_0x37d8('0x3d')];if(!_0x50aae4[_0x37d8('0x37')]['hasOwnProperty'](_0x37d8('0x3e'))){_0x524628[_0x37d8('0x1e')]=qs[_0x37d8('0x1e')](_0x50aae4[_0x37d8('0x37')][_0x37d8('0x1e')]);_0x524628['offset']=qs[_0x37d8('0x1c')](_0x50aae4[_0x37d8('0x37')][_0x37d8('0x1c')]);}_0x524628[_0x37d8('0x3f')]=qs[_0x37d8('0x40')](_0x50aae4[_0x37d8('0x37')][_0x37d8('0x40')]);_0x524628['where']=qs[_0x37d8('0x39')](_[_0x37d8('0x41')](_0x50aae4[_0x37d8('0x37')],_0x2ef540['filters']),_0x5a558e);if(_0x50aae4[_0x37d8('0x37')][_0x37d8('0x42')]){_0x524628[_0x37d8('0x43')]=_[_0x37d8('0x2b')](_0x524628[_0x37d8('0x43')],{'$or':_[_0x37d8('0x36')](_0x5a558e,function(_0x4fd6c0){if(_0x4fd6c0[_0x37d8('0x34')]!==_0x37d8('0x44')){var _0x407885={};_0x407885[_0x4fd6c0[_0x37d8('0x29')]]={'$like':'%'+_0x50aae4[_0x37d8('0x37')][_0x37d8('0x42')]+'%'};return _0x407885;}})});}_0x524628=_['merge']({},_0x524628,_0x50aae4[_0x37d8('0x45')]);var _0x437a0e={'where':_0x524628[_0x37d8('0x43')]};return db[_0x37d8('0x32')][_0x37d8('0x1f')](_0x437a0e)['then'](function(_0x484ac4){_0x237fae[_0x37d8('0x1f')]=_0x484ac4;if(_0x50aae4[_0x37d8('0x37')]['includeAll']){_0x524628['include']=[{'all':!![]}];}return db['MailTransferReport'][_0x37d8('0x46')](_0x524628);})[_0x37d8('0x26')](function(_0x4b6dd8){_0x237fae[_0x37d8('0x47')]=_0x4b6dd8;return _0x237fae;})['then'](respondWithFilteredResult(_0x74553f,_0x524628))[_0x37d8('0x48')](handleError(_0x74553f,null));};exports[_0x37d8('0x49')]=function(_0x4e115c,_0x3335f4){var _0x2191b3={'raw':!![],'where':{'id':_0x4e115c[_0x37d8('0x4a')]['id']}},_0x43af5c={};_0x43af5c[_0x37d8('0x3d')]=_[_0x37d8('0x38')](db[_0x37d8('0x32')][_0x37d8('0x4b')]);_0x43af5c[_0x37d8('0x37')]=_[_0x37d8('0x38')](_0x4e115c[_0x37d8('0x37')]);_0x43af5c[_0x37d8('0x39')]=_[_0x37d8('0x3a')](_0x43af5c['model'],_0x43af5c[_0x37d8('0x37')]);_0x2191b3['attributes']=_[_0x37d8('0x3a')](_0x43af5c[_0x37d8('0x3d')],qs[_0x37d8('0x4c')](_0x4e115c[_0x37d8('0x37')]['fields']));_0x2191b3[_0x37d8('0x3b')]=_0x2191b3[_0x37d8('0x3b')][_0x37d8('0x3c')]?_0x2191b3[_0x37d8('0x3b')]:_0x43af5c[_0x37d8('0x3d')];if(_0x4e115c['query']['includeAll']){_0x2191b3[_0x37d8('0x4d')]=[{'all':!![]}];}_0x2191b3=_[_0x37d8('0x2b')]({},_0x2191b3,_0x4e115c[_0x37d8('0x45')]);return db['MailTransferReport'][_0x37d8('0x4e')](_0x2191b3)[_0x37d8('0x26')](handleEntityNotFound(_0x3335f4,null))['then'](respondWithResult(_0x3335f4,null))[_0x37d8('0x48')](handleError(_0x3335f4,null));};exports[_0x37d8('0x4f')]=function(_0x2070e8,_0x3c6aaa){return db[_0x37d8('0x32')][_0x37d8('0x4f')](_0x2070e8['body'],{})[_0x37d8('0x26')](respondWithResult(_0x3c6aaa,0xc9))[_0x37d8('0x48')](handleError(_0x3c6aaa,null));};exports[_0x37d8('0x25')]=function(_0x404aaa,_0x3973ef){if(_0x404aaa[_0x37d8('0x2c')]['id']){delete _0x404aaa[_0x37d8('0x2c')]['id'];}return db[_0x37d8('0x32')][_0x37d8('0x4e')]({'where':{'id':_0x404aaa[_0x37d8('0x4a')]['id']}})[_0x37d8('0x26')](handleEntityNotFound(_0x3973ef,null))['then'](saveUpdates(_0x404aaa[_0x37d8('0x2c')],null))[_0x37d8('0x26')](respondWithResult(_0x3973ef,null))[_0x37d8('0x48')](handleError(_0x3973ef,null));};exports[_0x37d8('0x27')]=function(_0x3f97f2,_0x321957){return db[_0x37d8('0x32')][_0x37d8('0x4e')]({'where':{'id':_0x3f97f2[_0x37d8('0x4a')]['id']}})[_0x37d8('0x26')](handleEntityNotFound(_0x321957,null))[_0x37d8('0x26')](removeEntity(_0x321957,null))[_0x37d8('0x48')](handleError(_0x321957,null));};exports['describe']=function(_0xda54c1,_0x5247b0){return db['MailTransferReport'][_0x37d8('0x50')]()['then'](respondWithResult(_0x5247b0,null))[_0x37d8('0x48')](handleError(_0x5247b0,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 0409f48..9ddf83a 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 _0xac6c=['util','../../config/logger','api','moment','bluebird','request-promise','path','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x48e636,_0x4df178){var _0x22398b=function(_0x1744e7){while(--_0x1744e7){_0x48e636['push'](_0x48e636['shift']());}};_0x22398b(++_0x4df178);}(_0xac6c,0x1c8));var _0xcac6=function(_0x252dcb,_0x311906){_0x252dcb=_0x252dcb-0x0;var _0x321048=_0xac6c[_0x252dcb];return _0x321048;};'use strict';var _=require('lodash');var util=require(_0xcac6('0x0'));var logger=require(_0xcac6('0x1'))(_0xcac6('0x2'));var moment=require(_0xcac6('0x3'));var BPromise=require(_0xcac6('0x4'));var rp=require(_0xcac6('0x5'));var fs=require('fs');var path=require(_0xcac6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcac6('0x7'));module['exports']=function(_0x5a7065,_0x2af43d){return _0x5a7065[_0xcac6('0x8')](_0xcac6('0x9'),attributes,{'tableName':_0xcac6('0xa'),'paranoid':![],'indexes':[{'name':_0xcac6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbae5=['request-promise','path','rimraf','../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0xbae5,0xf7));var _0x5bae=function(_0x3f7761,_0x1094b0){_0x3f7761=_0x3f7761-0x0;var _0x10d894=_0xbae5[_0x3f7761];return _0x10d894;};'use strict';var _=require(_0x5bae('0x0'));var util=require(_0x5bae('0x1'));var logger=require(_0x5bae('0x2'))('api');var moment=require(_0x5bae('0x3'));var BPromise=require(_0x5bae('0x4'));var rp=require(_0x5bae('0x5'));var fs=require('fs');var path=require(_0x5bae('0x6'));var rimraf=require(_0x5bae('0x7'));var config=require(_0x5bae('0x8'));var attributes=require('./mailTransferReport.attributes');module[_0x5bae('0x9')]=function(_0x289bd2,_0x3ee26c){return _0x289bd2[_0x5bae('0xa')](_0x5bae('0xb'),attributes,{'tableName':_0x5bae('0xc'),'paranoid':![],'indexes':[{'name':_0x5bae('0xd'),'fields':[_0x5bae('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 76de5dc..1cb0c16 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 _0x0dbb=['then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x14e2bf,_0x24aa11){var _0x59d3f4=function(_0x3e3160){while(--_0x3e3160){_0x14e2bf['push'](_0x14e2bf['shift']());}};_0x59d3f4(++_0x24aa11);}(_0x0dbb,0x1c1));var _0xb0db=function(_0x31fdad,_0x20a2c8){_0x31fdad=_0x31fdad-0x0;var _0x15e8e4=_0x0dbb[_0x31fdad];return _0x15e8e4;};'use strict';var _=require('lodash');var util=require(_0xb0db('0x0'));var moment=require('moment');var BPromise=require(_0xb0db('0x1'));var rs=require(_0xb0db('0x2'));var fs=require('fs');var Redis=require(_0xb0db('0x3'));var db=require(_0xb0db('0x4'))['db'];var utils=require(_0xb0db('0x5'));var logger=require(_0xb0db('0x6'))(_0xb0db('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb0db('0x8')][_0xb0db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45709c,_0x38b8c5,_0x40de45){return new BPromise(function(_0x1bb8cf,_0x1193c8){return client[_0xb0db('0xa')](_0x45709c,_0x40de45)[_0xb0db('0xb')](function(_0x5c562e){logger[_0xb0db('0xc')](_0xb0db('0xd'),_0x38b8c5,_0xb0db('0xe'));logger[_0xb0db('0xf')](_0xb0db('0x10'),_0x38b8c5,'request\x20sent',JSON[_0xb0db('0x11')](_0x5c562e));if(_0x5c562e[_0xb0db('0x12')]){if(_0x5c562e[_0xb0db('0x12')][_0xb0db('0x13')]===0x1f4){logger['error'](_0xb0db('0xd'),_0x38b8c5,_0x5c562e[_0xb0db('0x12')]['message']);return _0x1193c8(_0x5c562e[_0xb0db('0x12')][_0xb0db('0x14')]);}logger[_0xb0db('0x12')](_0xb0db('0xd'),_0x38b8c5,_0x5c562e[_0xb0db('0x12')][_0xb0db('0x14')]);return _0x1bb8cf(_0x5c562e[_0xb0db('0x12')]['message']);}else{logger[_0xb0db('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x38b8c5,_0xb0db('0xe'));_0x1bb8cf(_0x5c562e[_0xb0db('0x15')][_0xb0db('0x14')]);}})[_0xb0db('0x16')](function(_0x26c524){logger[_0xb0db('0x12')](_0xb0db('0xd'),_0x38b8c5,_0x26c524);_0x1193c8(_0x26c524);});});} \ No newline at end of file +var _0x379d=['error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x379d,0xa4));var _0xd379=function(_0x52b334,_0x3e36f4){_0x52b334=_0x52b334-0x0;var _0x52c593=_0x379d[_0x52b334];return _0x52c593;};'use strict';var _=require(_0xd379('0x0'));var util=require('util');var moment=require(_0xd379('0x1'));var BPromise=require(_0xd379('0x2'));var rs=require(_0xd379('0x3'));var fs=require('fs');var Redis=require(_0xd379('0x4'));var db=require(_0xd379('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd379('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd379('0x7'));var client=jayson[_0xd379('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x145ac0,_0x1785b2,_0x250fbd){return new BPromise(function(_0x4789e5,_0x586960){return client[_0xd379('0x9')](_0x145ac0,_0x250fbd)[_0xd379('0xa')](function(_0x3f98f9){logger[_0xd379('0xb')](_0xd379('0xc'),_0x1785b2,_0xd379('0xd'));logger['debug'](_0xd379('0xe'),_0x1785b2,_0xd379('0xd'),JSON[_0xd379('0xf')](_0x3f98f9));if(_0x3f98f9[_0xd379('0x10')]){if(_0x3f98f9[_0xd379('0x10')][_0xd379('0x11')]===0x1f4){logger[_0xd379('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x1785b2,_0x3f98f9['error'][_0xd379('0x12')]);return _0x586960(_0x3f98f9['error'][_0xd379('0x12')]);}logger['error'](_0xd379('0xc'),_0x1785b2,_0x3f98f9[_0xd379('0x10')][_0xd379('0x12')]);return _0x4789e5(_0x3f98f9[_0xd379('0x10')][_0xd379('0x12')]);}else{logger['info'](_0xd379('0xc'),_0x1785b2,_0xd379('0xd'));_0x4789e5(_0x3f98f9[_0xd379('0x13')][_0xd379('0x12')]);}})['catch'](function(_0x2802bd){logger[_0xd379('0x10')](_0xd379('0xc'),_0x1785b2,_0x2802bd);_0x586960(_0x2802bd);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0da1faf..0e03c02 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 _0x0bfd=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','post','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x27cd9e,_0x5a8cc1){var _0x13f94c=function(_0x54aa05){while(--_0x54aa05){_0x27cd9e['push'](_0x27cd9e['shift']());}};_0x13f94c(++_0x5a8cc1);}(_0x0bfd,0x10f));var _0xd0bf=function(_0x1138a7,_0x4fa4f2){_0x1138a7=_0x1138a7-0x0;var _0x258675=_0x0bfd[_0x1138a7];return _0x258675;};'use strict';var multer=require(_0xd0bf('0x0'));var util=require(_0xd0bf('0x1'));var path=require('path');var timeout=require(_0xd0bf('0x2'));var express=require(_0xd0bf('0x3'));var router=express[_0xd0bf('0x4')]();var fs_extra=require(_0xd0bf('0x5'));var auth=require(_0xd0bf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd0bf('0x7'));var controller=require(_0xd0bf('0x8'));router[_0xd0bf('0x9')]('/',auth[_0xd0bf('0xa')](),controller[_0xd0bf('0xb')]);router['get'](_0xd0bf('0xc'),auth['isAuthenticated'](),controller[_0xd0bf('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd0bf('0xe')]('/',auth[_0xd0bf('0xa')](),controller['create']);router[_0xd0bf('0xf')](_0xd0bf('0x10'),auth[_0xd0bf('0xa')](),controller[_0xd0bf('0x11')]);router[_0xd0bf('0x12')](_0xd0bf('0x10'),auth['isAuthenticated'](),controller[_0xd0bf('0x13')]);module[_0xd0bf('0x14')]=router; \ No newline at end of file +var _0x2237=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','put','/:id'];(function(_0xdbbd74,_0x386abd){var _0x6bbe4b=function(_0x345017){while(--_0x345017){_0xdbbd74['push'](_0xdbbd74['shift']());}};_0x6bbe4b(++_0x386abd);}(_0x2237,0x124));var _0x7223=function(_0x44034d,_0x1e3a17){_0x44034d=_0x44034d-0x0;var _0x2d1310=_0x2237[_0x44034d];return _0x2d1310;};'use strict';var multer=require(_0x7223('0x0'));var util=require(_0x7223('0x1'));var path=require(_0x7223('0x2'));var timeout=require(_0x7223('0x3'));var express=require(_0x7223('0x4'));var router=express[_0x7223('0x5')]();var fs_extra=require(_0x7223('0x6'));var auth=require(_0x7223('0x7'));var interaction=require(_0x7223('0x8'));var config=require(_0x7223('0x9'));var controller=require('./memberReport.controller');router[_0x7223('0xa')]('/',auth[_0x7223('0xb')](),controller['index']);router[_0x7223('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x7223('0xb')](),controller['show']);router['post']('/',auth[_0x7223('0xb')](),controller['create']);router[_0x7223('0xc')](_0x7223('0xd'),auth['isAuthenticated'](),controller[_0x7223('0xe')]);router[_0x7223('0xf')]('/:id',auth[_0x7223('0xb')](),controller[_0x7223('0x10')]);module[_0x7223('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 59d9d63..7bbedec 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 _0xbf8b=['exitAt','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xbf8b,0x16f));var _0xbbf8=function(_0x15eaf7,_0x27511b){_0x15eaf7=_0x15eaf7-0x0;var _0x48883d=_0xbf8b[_0x15eaf7];return _0x48883d;};'use strict';var Sequelize=require(_0xbbf8('0x0'));var moment=require(_0xbbf8('0x1'));module[_0xbbf8('0x2')]={'channel':{'type':Sequelize[_0xbbf8('0x3')]},'membername':{'type':Sequelize[_0xbbf8('0x3')]},'interface':{'type':Sequelize[_0xbbf8('0x3')]},'type':{'type':Sequelize[_0xbbf8('0x3')],'defaultValue':_0xbbf8('0x4'),'comment':_0xbbf8('0x5')},'duration':{'type':Sequelize[_0xbbf8('0x6')]},'enterAt':{'type':Sequelize[_0xbbf8('0x7')]},'exitAt':{'type':Sequelize[_0xbbf8('0x7')],'set':function(_0x2296d4){var _0x3ff6bb=moment(_0x2296d4);var _0x3ebff3=moment(this[_0xbbf8('0x8')](_0xbbf8('0x9')));var _0x3f4512=_0x3ff6bb['diff'](_0x3ebff3,_0xbbf8('0xa'));this['setDataValue'](_0xbbf8('0xb'),_0x2296d4);this[_0xbbf8('0xc')]('duration',_0x3f4512||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xbbf8('0xd')},'data2':{'type':Sequelize['STRING'],'comment':_0xbbf8('0xe')},'data3':{'type':Sequelize['STRING'],'comment':_0xbbf8('0xf')},'data4':{'type':Sequelize['STRING'],'comment':_0xbbf8('0x10')},'data5':{'type':Sequelize['STRING'],'comment':_0xbbf8('0x11')},'role':{'type':Sequelize[_0xbbf8('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2239=['exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','enterAt','diff','seconds','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment'];(function(_0x83fd10,_0x308737){var _0x477235=function(_0xf20ee5){while(--_0xf20ee5){_0x83fd10['push'](_0x83fd10['shift']());}};_0x477235(++_0x308737);}(_0x2239,0xee));var _0x9223=function(_0x558d31,_0x12a080){_0x558d31=_0x558d31-0x0;var _0x26f639=_0x2239[_0x558d31];return _0x26f639;};'use strict';var Sequelize=require(_0x9223('0x0'));var moment=require(_0x9223('0x1'));module[_0x9223('0x2')]={'channel':{'type':Sequelize[_0x9223('0x3')]},'membername':{'type':Sequelize[_0x9223('0x3')]},'interface':{'type':Sequelize[_0x9223('0x3')]},'type':{'type':Sequelize[_0x9223('0x3')],'defaultValue':_0x9223('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x9223('0x5')]},'enterAt':{'type':Sequelize[_0x9223('0x6')]},'exitAt':{'type':Sequelize[_0x9223('0x6')],'set':function(_0x3cc5e8){var _0x3daf59=moment(_0x3cc5e8);var _0x2bc122=moment(this['getDataValue'](_0x9223('0x7')));var _0x3ab509=_0x3daf59[_0x9223('0x8')](_0x2bc122,_0x9223('0x9'));this[_0x9223('0xa')]('exitAt',_0x3cc5e8);this[_0x9223('0xa')]('duration',_0x3ab509||null);}},'data1':{'type':Sequelize[_0x9223('0x3')],'comment':_0x9223('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0x9223('0xc')},'data3':{'type':Sequelize[_0x9223('0x3')],'comment':_0x9223('0xd')},'data4':{'type':Sequelize[_0x9223('0x3')],'comment':_0x9223('0xe')},'data5':{'type':Sequelize['STRING'],'comment':_0x9223('0xf')},'role':{'type':Sequelize[_0x9223('0x3')]},'internal':{'type':Sequelize[_0x9223('0x5')]},'uniqueid':{'type':Sequelize[_0x9223('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 00891b6..0be25d9 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 _0xe0c9=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','create','catch','describe','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','name','send','render','body','contact','interaction','account','index','MemberReport','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit'];(function(_0x511e43,_0x56cea5){var _0x60dcf7=function(_0x3a52f8){while(--_0x3a52f8){_0x511e43['push'](_0x511e43['shift']());}};_0x60dcf7(++_0x56cea5);}(_0xe0c9,0xa6));var _0x9e0c=function(_0x1ef808,_0x57d07e){_0x1ef808=_0x1ef808-0x0;var _0x39e0bd=_0xe0c9[_0x1ef808];return _0x39e0bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e0c('0x0'));var zipdir=require(_0x9e0c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9e0c('0x2'));var moment=require(_0x9e0c('0x3'));var BPromise=require(_0x9e0c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9e0c('0x5'));var sox=require(_0x9e0c('0x6'));var csv=require(_0x9e0c('0x7'));var ejs=require(_0x9e0c('0x8'));var fs=require('fs');var fs_extra=require(_0x9e0c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9e0c('0xa'));var jsforce=require(_0x9e0c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9e0c('0x7'));var querystring=require(_0x9e0c('0xc'));var Papa=require('papaparse');var Redis=require(_0x9e0c('0xd'));var authService=require(_0x9e0c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9e0c('0xf'));var hardwareService=require(_0x9e0c('0x10'));var logger=require('../../config/logger')(_0x9e0c('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9e0c('0x12'));var db=require(_0x9e0c('0x13'))['db'];function respondWithStatusCode(_0x7bd2ef,_0x7ff7a0){_0x7ff7a0=_0x7ff7a0||0xcc;return function(_0x1cd743){if(_0x1cd743){return _0x7bd2ef['sendStatus'](_0x7ff7a0);}return _0x7bd2ef[_0x9e0c('0x14')](_0x7ff7a0)['end']();};}function respondWithResult(_0x1168e5,_0x4f7c4a){_0x4f7c4a=_0x4f7c4a||0xc8;return function(_0x1fc12c){if(_0x1fc12c){return _0x1168e5[_0x9e0c('0x14')](_0x4f7c4a)[_0x9e0c('0x15')](_0x1fc12c);}};}function respondWithFilteredResult(_0x38c8d6,_0x8adbfb){return function(_0x130306){if(_0x130306){var _0x3b530a=typeof _0x8adbfb[_0x9e0c('0x16')]===_0x9e0c('0x17')&&typeof _0x8adbfb[_0x9e0c('0x18')]===_0x9e0c('0x17');var _0x3582a5=_0x130306['count'];var _0x3f050d=_0x3b530a?0x0:_0x8adbfb[_0x9e0c('0x16')];var _0x11fca3=_0x3b530a?_0x130306[_0x9e0c('0x19')]:_0x8adbfb['offset']+_0x8adbfb[_0x9e0c('0x18')];var _0x35fe35;if(_0x11fca3>=_0x3582a5){_0x11fca3=_0x3582a5;_0x35fe35=0xc8;}else{_0x35fe35=0xce;}_0x38c8d6['status'](_0x35fe35);return _0x38c8d6['set'](_0x9e0c('0x1a'),_0x3f050d+'-'+_0x11fca3+'/'+_0x3582a5)[_0x9e0c('0x15')](_0x130306);}return null;};}function patchUpdates(_0x37b38f){return function(_0x2b9717){try{jsonpatch[_0x9e0c('0x1b')](_0x2b9717,_0x37b38f,!![]);}catch(_0x4c74a9){return BPromise[_0x9e0c('0x1c')](_0x4c74a9);}return _0x2b9717[_0x9e0c('0x1d')]();};}function saveUpdates(_0x25ea58,_0x30d370){return function(_0x3866a3){if(_0x3866a3){return _0x3866a3[_0x9e0c('0x1e')](_0x25ea58)[_0x9e0c('0x1f')](function(_0x36e585){return _0x36e585;});}return null;};}function removeEntity(_0xaa18b9,_0x2e9e9a){return function(_0x3d3aa9){if(_0x3d3aa9){return _0x3d3aa9[_0x9e0c('0x20')]()['then'](function(){_0xaa18b9[_0x9e0c('0x14')](0xcc)[_0x9e0c('0x21')]();});}};}function handleEntityNotFound(_0x303303,_0xfec83e){return function(_0x54ff03){if(!_0x54ff03){_0x303303[_0x9e0c('0x22')](0x194);}return _0x54ff03;};}function handleError(_0x31642a,_0x15cab4){_0x15cab4=_0x15cab4||0x1f4;return function(_0x42cdc1){logger['error'](_0x42cdc1['stack']);if(_0x42cdc1['name']){delete _0x42cdc1[_0x9e0c('0x23')];}_0x31642a['status'](_0x15cab4)[_0x9e0c('0x24')](_0x42cdc1);};}function getMustacheRender(_0x2f957a,_0x316fdd){return Mustache[_0x9e0c('0x25')](_0x2f957a,_['merge'](_0x316fdd[_0x9e0c('0x26')],{'contact':_0x316fdd[_0x9e0c('0x27')],'message':_0x316fdd['message'],'agent':_0x316fdd['agent'],'interaction':_0x316fdd[_0x9e0c('0x28')],'account':_0x316fdd[_0x9e0c('0x29')]}))||'';}exports[_0x9e0c('0x2a')]=function(_0x56fed6,_0x585fa5){var _0x4c4d31={},_0x19f02f={},_0x453c0f={'count':0x0,'rows':[]};var _0x49e914=_['map'](db[_0x9e0c('0x2b')][_0x9e0c('0x2c')],function(_0x283d0a){return{'name':_0x283d0a['fieldName'],'type':_0x283d0a[_0x9e0c('0x2d')][_0x9e0c('0x2e')]};});_0x19f02f[_0x9e0c('0x2f')]=_[_0x9e0c('0x30')](_0x49e914,'name');_0x19f02f[_0x9e0c('0x31')]=_['keys'](_0x56fed6[_0x9e0c('0x31')]);_0x19f02f[_0x9e0c('0x32')]=_[_0x9e0c('0x33')](_0x19f02f[_0x9e0c('0x2f')],_0x19f02f[_0x9e0c('0x31')]);_0x4c4d31[_0x9e0c('0x34')]=_[_0x9e0c('0x33')](_0x19f02f[_0x9e0c('0x2f')],qs[_0x9e0c('0x35')](_0x56fed6['query'][_0x9e0c('0x35')]));_0x4c4d31[_0x9e0c('0x34')]=_0x4c4d31[_0x9e0c('0x34')][_0x9e0c('0x36')]?_0x4c4d31[_0x9e0c('0x34')]:_0x19f02f[_0x9e0c('0x2f')];if(!_0x56fed6[_0x9e0c('0x31')]['hasOwnProperty'](_0x9e0c('0x37'))){_0x4c4d31[_0x9e0c('0x18')]=qs[_0x9e0c('0x18')](_0x56fed6[_0x9e0c('0x31')]['limit']);_0x4c4d31['offset']=qs['offset'](_0x56fed6[_0x9e0c('0x31')]['offset']);}_0x4c4d31[_0x9e0c('0x38')]=qs[_0x9e0c('0x39')](_0x56fed6['query']['sort']);_0x4c4d31[_0x9e0c('0x3a')]=qs[_0x9e0c('0x32')](_[_0x9e0c('0x3b')](_0x56fed6['query'],_0x19f02f[_0x9e0c('0x32')]),_0x49e914);if(_0x56fed6[_0x9e0c('0x31')][_0x9e0c('0x3c')]){_0x4c4d31[_0x9e0c('0x3a')]=_[_0x9e0c('0x3d')](_0x4c4d31[_0x9e0c('0x3a')],{'$or':_[_0x9e0c('0x30')](_0x49e914,function(_0x1e7ec0){if(_0x1e7ec0[_0x9e0c('0x2d')]!==_0x9e0c('0x3e')){var _0x5b9e1e={};_0x5b9e1e[_0x1e7ec0[_0x9e0c('0x23')]]={'$like':'%'+_0x56fed6[_0x9e0c('0x31')]['filter']+'%'};return _0x5b9e1e;}})});}_0x4c4d31=_[_0x9e0c('0x3d')]({},_0x4c4d31,_0x56fed6[_0x9e0c('0x3f')]);var _0x120b24={'where':_0x4c4d31[_0x9e0c('0x3a')]};return db['MemberReport'][_0x9e0c('0x19')](_0x120b24)[_0x9e0c('0x1f')](function(_0x511c14){_0x453c0f['count']=_0x511c14;if(_0x56fed6[_0x9e0c('0x31')][_0x9e0c('0x40')]){_0x4c4d31[_0x9e0c('0x41')]=[{'all':!![]}];}return db[_0x9e0c('0x2b')][_0x9e0c('0x42')](_0x4c4d31);})[_0x9e0c('0x1f')](function(_0x4a3a8b){_0x453c0f['rows']=_0x4a3a8b;return _0x453c0f;})[_0x9e0c('0x1f')](respondWithFilteredResult(_0x585fa5,_0x4c4d31))['catch'](handleError(_0x585fa5,null));};exports[_0x9e0c('0x43')]=function(_0x12e60b,_0x44af2a){var _0xfc2d1d={'raw':!![],'where':{'id':_0x12e60b[_0x9e0c('0x44')]['id']}},_0x105db7={};_0x105db7[_0x9e0c('0x2f')]=_[_0x9e0c('0x45')](db[_0x9e0c('0x2b')][_0x9e0c('0x2c')]);_0x105db7[_0x9e0c('0x31')]=_['keys'](_0x12e60b['query']);_0x105db7[_0x9e0c('0x32')]=_[_0x9e0c('0x33')](_0x105db7['model'],_0x105db7['query']);_0xfc2d1d[_0x9e0c('0x34')]=_['intersection'](_0x105db7[_0x9e0c('0x2f')],qs['fields'](_0x12e60b[_0x9e0c('0x31')][_0x9e0c('0x35')]));_0xfc2d1d[_0x9e0c('0x34')]=_0xfc2d1d[_0x9e0c('0x34')]['length']?_0xfc2d1d[_0x9e0c('0x34')]:_0x105db7[_0x9e0c('0x2f')];if(_0x12e60b[_0x9e0c('0x31')][_0x9e0c('0x40')]){_0xfc2d1d['include']=[{'all':!![]}];}_0xfc2d1d=_[_0x9e0c('0x3d')]({},_0xfc2d1d,_0x12e60b[_0x9e0c('0x3f')]);return db[_0x9e0c('0x2b')][_0x9e0c('0x46')](_0xfc2d1d)[_0x9e0c('0x1f')](handleEntityNotFound(_0x44af2a,null))[_0x9e0c('0x1f')](respondWithResult(_0x44af2a,null))['catch'](handleError(_0x44af2a,null));};exports[_0x9e0c('0x47')]=function(_0x53beab,_0x2676af){return db[_0x9e0c('0x2b')]['create'](_0x53beab['body'],{})[_0x9e0c('0x1f')](respondWithResult(_0x2676af,0xc9))[_0x9e0c('0x48')](handleError(_0x2676af,null));};exports[_0x9e0c('0x1e')]=function(_0x1f47ed,_0x173546){if(_0x1f47ed[_0x9e0c('0x26')]['id']){delete _0x1f47ed[_0x9e0c('0x26')]['id'];}return db[_0x9e0c('0x2b')][_0x9e0c('0x46')]({'where':{'id':_0x1f47ed[_0x9e0c('0x44')]['id']}})[_0x9e0c('0x1f')](handleEntityNotFound(_0x173546,null))[_0x9e0c('0x1f')](saveUpdates(_0x1f47ed[_0x9e0c('0x26')],null))[_0x9e0c('0x1f')](respondWithResult(_0x173546,null))[_0x9e0c('0x48')](handleError(_0x173546,null));};exports[_0x9e0c('0x20')]=function(_0x26bba5,_0x53f457){return db['MemberReport'][_0x9e0c('0x46')]({'where':{'id':_0x26bba5[_0x9e0c('0x44')]['id']}})[_0x9e0c('0x1f')](handleEntityNotFound(_0x53f457,null))[_0x9e0c('0x1f')](removeEntity(_0x53f457,null))['catch'](handleError(_0x53f457,null));};exports[_0x9e0c('0x49')]=function(_0x573e3c,_0xd38d0a){return db['MemberReport'][_0x9e0c('0x49')]()[_0x9e0c('0x1f')](respondWithResult(_0xd38d0a,null))[_0x9e0c('0x48')](handleError(_0xd38d0a,null));}; \ No newline at end of file +var _0x8336=['intersection','attributes','model','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','then','rows','catch','show','params','fields','MemberReport','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','render','body','interaction','index','map','rawAttributes','fieldName','key','keys','query','filters'];(function(_0x2289cc,_0x25f69f){var _0x1e2edc=function(_0x138327){while(--_0x138327){_0x2289cc['push'](_0x2289cc['shift']());}};_0x1e2edc(++_0x25f69f);}(_0x8336,0x1a5));var _0x6833=function(_0x3a7634,_0x2db384){_0x3a7634=_0x3a7634-0x0;var _0x23bbe9=_0x8336[_0x3a7634];return _0x23bbe9;};'use strict';var emlformat=require(_0x6833('0x0'));var rimraf=require(_0x6833('0x1'));var zipdir=require(_0x6833('0x2'));var jsonpatch=require(_0x6833('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6833('0x4'));var Mustache=require('mustache');var util=require(_0x6833('0x5'));var path=require('path');var sox=require(_0x6833('0x6'));var csv=require(_0x6833('0x7'));var ejs=require(_0x6833('0x8'));var fs=require('fs');var fs_extra=require(_0x6833('0x9'));var _=require(_0x6833('0xa'));var squel=require(_0x6833('0xb'));var crypto=require(_0x6833('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6833('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6833('0xe'));var Papa=require(_0x6833('0xf'));var Redis=require(_0x6833('0x10'));var authService=require(_0x6833('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6833('0x12'));var hardwareService=require(_0x6833('0x13'));var logger=require('../../config/logger')(_0x6833('0x14'));var utils=require(_0x6833('0x15'));var config=require(_0x6833('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6833('0x17'))['db'];function respondWithStatusCode(_0x24074d,_0x28b442){_0x28b442=_0x28b442||0xcc;return function(_0x57f9ed){if(_0x57f9ed){return _0x24074d[_0x6833('0x18')](_0x28b442);}return _0x24074d[_0x6833('0x19')](_0x28b442)[_0x6833('0x1a')]();};}function respondWithResult(_0xb01cc0,_0x239a1b){_0x239a1b=_0x239a1b||0xc8;return function(_0xe69a9){if(_0xe69a9){return _0xb01cc0[_0x6833('0x19')](_0x239a1b)[_0x6833('0x1b')](_0xe69a9);}};}function respondWithFilteredResult(_0xff982,_0x1e5d90){return function(_0x50cb00){if(_0x50cb00){var _0x18a161=typeof _0x1e5d90['offset']===_0x6833('0x1c')&&typeof _0x1e5d90[_0x6833('0x1d')]===_0x6833('0x1c');var _0x1ca707=_0x50cb00[_0x6833('0x1e')];var _0x397580=_0x18a161?0x0:_0x1e5d90[_0x6833('0x1f')];var _0x50b588=_0x18a161?_0x50cb00[_0x6833('0x1e')]:_0x1e5d90[_0x6833('0x1f')]+_0x1e5d90['limit'];var _0x2591e3;if(_0x50b588>=_0x1ca707){_0x50b588=_0x1ca707;_0x2591e3=0xc8;}else{_0x2591e3=0xce;}_0xff982[_0x6833('0x19')](_0x2591e3);return _0xff982[_0x6833('0x20')](_0x6833('0x21'),_0x397580+'-'+_0x50b588+'/'+_0x1ca707)[_0x6833('0x1b')](_0x50cb00);}return null;};}function patchUpdates(_0x32eb79){return function(_0x5702b3){try{jsonpatch[_0x6833('0x22')](_0x5702b3,_0x32eb79,!![]);}catch(_0xd7d80b){return BPromise[_0x6833('0x23')](_0xd7d80b);}return _0x5702b3[_0x6833('0x24')]();};}function saveUpdates(_0x1c1f4e,_0x5f5015){return function(_0x4919c5){if(_0x4919c5){return _0x4919c5[_0x6833('0x25')](_0x1c1f4e)['then'](function(_0x3c5588){return _0x3c5588;});}return null;};}function removeEntity(_0x2156ec,_0x345762){return function(_0x58dc0d){if(_0x58dc0d){return _0x58dc0d[_0x6833('0x26')]()['then'](function(){_0x2156ec[_0x6833('0x19')](0xcc)[_0x6833('0x1a')]();});}};}function handleEntityNotFound(_0x6d3e84,_0x3f36b6){return function(_0x6bfc0){if(!_0x6bfc0){_0x6d3e84[_0x6833('0x18')](0x194);}return _0x6bfc0;};}function handleError(_0x41fe3f,_0x466fc3){_0x466fc3=_0x466fc3||0x1f4;return function(_0x52ef94){logger[_0x6833('0x27')](_0x52ef94[_0x6833('0x28')]);if(_0x52ef94[_0x6833('0x29')]){delete _0x52ef94[_0x6833('0x29')];}_0x41fe3f[_0x6833('0x19')](_0x466fc3)['send'](_0x52ef94);};}function getMustacheRender(_0x124391,_0x5dc3d2){return Mustache[_0x6833('0x2a')](_0x124391,_['merge'](_0x5dc3d2[_0x6833('0x2b')],{'contact':_0x5dc3d2['contact'],'message':_0x5dc3d2['message'],'agent':_0x5dc3d2['agent'],'interaction':_0x5dc3d2[_0x6833('0x2c')],'account':_0x5dc3d2['account']}))||'';}exports[_0x6833('0x2d')]=function(_0x161d38,_0x28e767){var _0xd4fb5={},_0x47668f={},_0x57682f={'count':0x0,'rows':[]};var _0x4d58f9=_[_0x6833('0x2e')](db['MemberReport'][_0x6833('0x2f')],function(_0x38f414){return{'name':_0x38f414[_0x6833('0x30')],'type':_0x38f414['type'][_0x6833('0x31')]};});_0x47668f['model']=_[_0x6833('0x2e')](_0x4d58f9,_0x6833('0x29'));_0x47668f['query']=_[_0x6833('0x32')](_0x161d38[_0x6833('0x33')]);_0x47668f[_0x6833('0x34')]=_[_0x6833('0x35')](_0x47668f['model'],_0x47668f[_0x6833('0x33')]);_0xd4fb5[_0x6833('0x36')]=_['intersection'](_0x47668f[_0x6833('0x37')],qs['fields'](_0x161d38['query']['fields']));_0xd4fb5[_0x6833('0x36')]=_0xd4fb5[_0x6833('0x36')][_0x6833('0x38')]?_0xd4fb5[_0x6833('0x36')]:_0x47668f[_0x6833('0x37')];if(!_0x161d38[_0x6833('0x33')]['hasOwnProperty'](_0x6833('0x39'))){_0xd4fb5[_0x6833('0x1d')]=qs[_0x6833('0x1d')](_0x161d38[_0x6833('0x33')][_0x6833('0x1d')]);_0xd4fb5['offset']=qs[_0x6833('0x1f')](_0x161d38[_0x6833('0x33')][_0x6833('0x1f')]);}_0xd4fb5[_0x6833('0x3a')]=qs[_0x6833('0x3b')](_0x161d38[_0x6833('0x33')][_0x6833('0x3b')]);_0xd4fb5[_0x6833('0x3c')]=qs[_0x6833('0x34')](_[_0x6833('0x3d')](_0x161d38[_0x6833('0x33')],_0x47668f['filters']),_0x4d58f9);if(_0x161d38['query'][_0x6833('0x3e')]){_0xd4fb5[_0x6833('0x3c')]=_[_0x6833('0x3f')](_0xd4fb5[_0x6833('0x3c')],{'$or':_[_0x6833('0x2e')](_0x4d58f9,function(_0x16adda){if(_0x16adda[_0x6833('0x40')]!=='VIRTUAL'){var _0x26decb={};_0x26decb[_0x16adda['name']]={'$like':'%'+_0x161d38[_0x6833('0x33')][_0x6833('0x3e')]+'%'};return _0x26decb;}})});}_0xd4fb5=_[_0x6833('0x3f')]({},_0xd4fb5,_0x161d38[_0x6833('0x41')]);var _0x30f304={'where':_0xd4fb5['where']};return db['MemberReport'][_0x6833('0x1e')](_0x30f304)['then'](function(_0x5f48b5){_0x57682f[_0x6833('0x1e')]=_0x5f48b5;if(_0x161d38[_0x6833('0x33')][_0x6833('0x42')]){_0xd4fb5[_0x6833('0x43')]=[{'all':!![]}];}return db['MemberReport'][_0x6833('0x44')](_0xd4fb5);})[_0x6833('0x45')](function(_0x4c1ace){_0x57682f[_0x6833('0x46')]=_0x4c1ace;return _0x57682f;})['then'](respondWithFilteredResult(_0x28e767,_0xd4fb5))[_0x6833('0x47')](handleError(_0x28e767,null));};exports[_0x6833('0x48')]=function(_0x21acb7,_0x1a1f03){var _0x19f04a={'raw':!![],'where':{'id':_0x21acb7[_0x6833('0x49')]['id']}},_0x15d9c1={};_0x15d9c1[_0x6833('0x37')]=_[_0x6833('0x32')](db['MemberReport'][_0x6833('0x2f')]);_0x15d9c1[_0x6833('0x33')]=_[_0x6833('0x32')](_0x21acb7['query']);_0x15d9c1[_0x6833('0x34')]=_[_0x6833('0x35')](_0x15d9c1[_0x6833('0x37')],_0x15d9c1[_0x6833('0x33')]);_0x19f04a[_0x6833('0x36')]=_[_0x6833('0x35')](_0x15d9c1[_0x6833('0x37')],qs[_0x6833('0x4a')](_0x21acb7[_0x6833('0x33')]['fields']));_0x19f04a[_0x6833('0x36')]=_0x19f04a[_0x6833('0x36')]['length']?_0x19f04a['attributes']:_0x15d9c1['model'];if(_0x21acb7[_0x6833('0x33')][_0x6833('0x42')]){_0x19f04a[_0x6833('0x43')]=[{'all':!![]}];}_0x19f04a=_[_0x6833('0x3f')]({},_0x19f04a,_0x21acb7[_0x6833('0x41')]);return db[_0x6833('0x4b')][_0x6833('0x4c')](_0x19f04a)['then'](handleEntityNotFound(_0x1a1f03,null))[_0x6833('0x45')](respondWithResult(_0x1a1f03,null))[_0x6833('0x47')](handleError(_0x1a1f03,null));};exports['create']=function(_0x474199,_0x131756){return db[_0x6833('0x4b')][_0x6833('0x4d')](_0x474199[_0x6833('0x2b')],{})[_0x6833('0x45')](respondWithResult(_0x131756,0xc9))['catch'](handleError(_0x131756,null));};exports['update']=function(_0x17d5fd,_0x32fa18){if(_0x17d5fd[_0x6833('0x2b')]['id']){delete _0x17d5fd[_0x6833('0x2b')]['id'];}return db['MemberReport'][_0x6833('0x4c')]({'where':{'id':_0x17d5fd[_0x6833('0x49')]['id']}})['then'](handleEntityNotFound(_0x32fa18,null))[_0x6833('0x45')](saveUpdates(_0x17d5fd[_0x6833('0x2b')],null))[_0x6833('0x45')](respondWithResult(_0x32fa18,null))[_0x6833('0x47')](handleError(_0x32fa18,null));};exports[_0x6833('0x26')]=function(_0x14d4e7,_0x28c418){return db[_0x6833('0x4b')][_0x6833('0x4c')]({'where':{'id':_0x14d4e7[_0x6833('0x49')]['id']}})['then'](handleEntityNotFound(_0x28c418,null))[_0x6833('0x45')](removeEntity(_0x28c418,null))[_0x6833('0x47')](handleError(_0x28c418,null));};exports[_0x6833('0x4e')]=function(_0x326e7a,_0x420622){return db[_0x6833('0x4b')]['describe']()[_0x6833('0x45')](respondWithResult(_0x420622,null))['catch'](handleError(_0x420622,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 335aaab..d4ee3e1 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 _0xf360=['define','MemberReport','report_member','membername_interface','membername','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf360,0x1a9));var _0x0f36=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xf360[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x0f36('0x0'));var util=require(_0x0f36('0x1'));var logger=require(_0x0f36('0x2'))(_0x0f36('0x3'));var moment=require('moment');var BPromise=require(_0x0f36('0x4'));var rp=require(_0x0f36('0x5'));var fs=require('fs');var path=require(_0x0f36('0x6'));var rimraf=require('rimraf');var config=require(_0x0f36('0x7'));var attributes=require(_0x0f36('0x8'));module[_0x0f36('0x9')]=function(_0x2b1379,_0x27e477){return _0x2b1379[_0x0f36('0xa')](_0x0f36('0xb'),attributes,{'tableName':_0x0f36('0xc'),'paranoid':![],'indexes':[{'name':_0x0f36('0xd'),'fields':[_0x0f36('0xe'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3fad=['membername_interface','membername','interface','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./memberReport.attributes','exports','define','MemberReport'];(function(_0x3097fa,_0x331eb8){var _0xdc4e33=function(_0x2a048){while(--_0x2a048){_0x3097fa['push'](_0x3097fa['shift']());}};_0xdc4e33(++_0x331eb8);}(_0x3fad,0xc6));var _0xd3fa=function(_0x3b5ea4,_0x530045){_0x3b5ea4=_0x3b5ea4-0x0;var _0x28ac47=_0x3fad[_0x3b5ea4];return _0x28ac47;};'use strict';var _=require(_0xd3fa('0x0'));var util=require('util');var logger=require(_0xd3fa('0x1'))(_0xd3fa('0x2'));var moment=require(_0xd3fa('0x3'));var BPromise=require(_0xd3fa('0x4'));var rp=require(_0xd3fa('0x5'));var fs=require('fs');var path=require(_0xd3fa('0x6'));var rimraf=require(_0xd3fa('0x7'));var config=require('../../config/environment');var attributes=require(_0xd3fa('0x8'));module[_0xd3fa('0x9')]=function(_0x22389f,_0x2f74f1){return _0x22389f[_0xd3fa('0xa')](_0xd3fa('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xd3fa('0xc'),'fields':[_0xd3fa('0xd'),_0xd3fa('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 a070000..19696e1 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 _0x1a82=['body','CreateMemberReport','UpdateMemberReport','update','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../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','info','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','model','map','then','stringify'];(function(_0x468c76,_0x9547d4){var _0x1f8f78=function(_0x582203){while(--_0x582203){_0x468c76['push'](_0x468c76['shift']());}};_0x1f8f78(++_0x9547d4);}(_0x1a82,0x1bc));var _0x21a8=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0x1a82[_0x45d1fd];return _0xd0e542;};'use strict';var _=require(_0x21a8('0x0'));var util=require('util');var moment=require(_0x21a8('0x1'));var BPromise=require('bluebird');var rs=require(_0x21a8('0x2'));var fs=require('fs');var Redis=require(_0x21a8('0x3'));var db=require(_0x21a8('0x4'))['db'];var utils=require(_0x21a8('0x5'));var logger=require(_0x21a8('0x6'))(_0x21a8('0x7'));var config=require(_0x21a8('0x8'));var jayson=require(_0x21a8('0x9'));var client=jayson[_0x21a8('0xa')][_0x21a8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fda79,_0x7087fa,_0x15861f){return new BPromise(function(_0x52360d,_0x1e036){return client[_0x21a8('0xc')](_0x1fda79,_0x15861f)['then'](function(_0x23753f){logger['info'](_0x21a8('0xd'),_0x7087fa,_0x21a8('0xe'));logger[_0x21a8('0xf')](_0x21a8('0x10'),_0x7087fa,_0x21a8('0xe'),JSON['stringify'](_0x23753f));if(_0x23753f[_0x21a8('0x11')]){if(_0x23753f['error'][_0x21a8('0x12')]===0x1f4){logger['error'](_0x21a8('0xd'),_0x7087fa,_0x23753f['error'][_0x21a8('0x13')]);return _0x1e036(_0x23753f['error'][_0x21a8('0x13')]);}logger[_0x21a8('0x11')](_0x21a8('0xd'),_0x7087fa,_0x23753f[_0x21a8('0x11')][_0x21a8('0x13')]);return _0x52360d(_0x23753f[_0x21a8('0x11')]['message']);}else{logger[_0x21a8('0x14')]('MemberReport,\x20%s,\x20%s',_0x7087fa,'request\x20sent');_0x52360d(_0x23753f[_0x21a8('0x15')][_0x21a8('0x13')]);}})[_0x21a8('0x16')](function(_0x4da1e1){logger[_0x21a8('0x11')](_0x21a8('0xd'),_0x7087fa,_0x4da1e1);_0x1e036(_0x4da1e1);});});}exports[_0x21a8('0x17')]=function(_0x59190e){var _0x1b67ed=this;return new Promise(function(_0x432ea7,_0x9229fc){return db[_0x21a8('0x18')][_0x21a8('0x19')]({'raw':_0x59190e[_0x21a8('0x1a')]?_0x59190e[_0x21a8('0x1a')][_0x21a8('0x1b')]===undefined?!![]:![]:!![],'where':_0x59190e[_0x21a8('0x1a')]?_0x59190e[_0x21a8('0x1a')][_0x21a8('0x1c')]||null:null,'attributes':_0x59190e[_0x21a8('0x1a')]?_0x59190e[_0x21a8('0x1a')][_0x21a8('0x1d')]||null:null,'limit':_0x59190e[_0x21a8('0x1a')]?_0x59190e['options'][_0x21a8('0x1e')]||null:null,'include':_0x59190e[_0x21a8('0x1a')]?_0x59190e[_0x21a8('0x1a')][_0x21a8('0x1f')]?_['map'](_0x59190e[_0x21a8('0x1a')][_0x21a8('0x1f')],function(_0x574846){return{'model':db[_0x574846[_0x21a8('0x20')]],'as':_0x574846['as'],'attributes':_0x574846[_0x21a8('0x1d')],'include':_0x574846[_0x21a8('0x1f')]?_[_0x21a8('0x21')](_0x574846[_0x21a8('0x1f')],function(_0x3067e3){return{'model':db[_0x3067e3[_0x21a8('0x20')]],'as':_0x3067e3['as'],'attributes':_0x3067e3[_0x21a8('0x1d')],'include':_0x3067e3[_0x21a8('0x1f')]?_[_0x21a8('0x21')](_0x3067e3[_0x21a8('0x1f')],function(_0x3b0e36){return{'model':db[_0x3b0e36['model']],'as':_0x3b0e36['as'],'attributes':_0x3b0e36[_0x21a8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x21a8('0x22')](function(_0x319419){logger[_0x21a8('0x14')](_0x21a8('0x17'),_0x59190e);logger[_0x21a8('0xf')](_0x21a8('0x17'),_0x59190e,JSON[_0x21a8('0x23')](_0x319419));_0x432ea7(_0x319419);})['catch'](function(_0x1b1f8a){logger[_0x21a8('0x11')]('GetMemberReport',_0x1b1f8a[_0x21a8('0x13')],_0x59190e);_0x9229fc(_0x1b67ed['error'](0x1f4,_0x1b1f8a[_0x21a8('0x13')]));});});};exports['CreateMemberReport']=function(_0x14874b){var _0x59c082=this;return new Promise(function(_0x2caf80,_0x51ed1d){return db[_0x21a8('0x18')]['create'](_0x14874b[_0x21a8('0x24')],{'raw':_0x14874b['options']?_0x14874b[_0x21a8('0x1a')][_0x21a8('0x1b')]===undefined?!![]:![]:!![]})[_0x21a8('0x22')](function(_0x56254c){logger['info']('CreateMemberReport',_0x14874b);logger['debug']('CreateMemberReport',_0x14874b,JSON[_0x21a8('0x23')](_0x56254c));_0x2caf80(_0x56254c);})['catch'](function(_0x148691){logger[_0x21a8('0x11')](_0x21a8('0x25'),_0x148691[_0x21a8('0x13')],_0x14874b);_0x51ed1d(_0x59c082['error'](0x1f4,_0x148691[_0x21a8('0x13')]));});});};exports[_0x21a8('0x26')]=function(_0x4ea5d9){var _0x411a36=this;return new Promise(function(_0x13209b,_0x5a836c){return db['MemberReport'][_0x21a8('0x27')](_0x4ea5d9[_0x21a8('0x24')],{'raw':_0x4ea5d9['options']?_0x4ea5d9[_0x21a8('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ea5d9['options']?_0x4ea5d9['options'][_0x21a8('0x1c')]||null:null,'attributes':_0x4ea5d9[_0x21a8('0x1a')]?_0x4ea5d9[_0x21a8('0x1a')]['attributes']||null:null,'limit':_0x4ea5d9[_0x21a8('0x1a')]?_0x4ea5d9[_0x21a8('0x1a')][_0x21a8('0x1e')]||null:null})[_0x21a8('0x22')](function(_0x549234){logger[_0x21a8('0x14')](_0x21a8('0x26'),_0x4ea5d9);logger[_0x21a8('0xf')](_0x21a8('0x26'),_0x4ea5d9,JSON[_0x21a8('0x23')](_0x549234));_0x13209b(_0x549234);})[_0x21a8('0x16')](function(_0x2fab0d){logger['error'](_0x21a8('0x26'),_0x2fab0d[_0x21a8('0x13')],_0x4ea5d9);_0x5a836c(_0x411a36[_0x21a8('0x11')](0x1f4,_0x2fab0d[_0x21a8('0x13')]));});});}; \ No newline at end of file +var _0xec6d=['debug','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','model','map','CreateMemberReport','create','body','raw','stringify','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0xec6d,0x101));var _0xdec6=function(_0x235ff2,_0x39d506){_0x235ff2=_0x235ff2-0x0;var _0x201bcf=_0xec6d[_0x235ff2];return _0x201bcf;};'use strict';var _=require(_0xdec6('0x0'));var util=require(_0xdec6('0x1'));var moment=require(_0xdec6('0x2'));var BPromise=require(_0xdec6('0x3'));var rs=require(_0xdec6('0x4'));var fs=require('fs');var Redis=require(_0xdec6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdec6('0x6'));var logger=require('../../config/logger')(_0xdec6('0x7'));var config=require('../../config/environment');var jayson=require(_0xdec6('0x8'));var client=jayson[_0xdec6('0x9')][_0xdec6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x428b73,_0x4c917b,_0x15d1cb){return new BPromise(function(_0x5e7761,_0x3b223f){return client[_0xdec6('0xb')](_0x428b73,_0x15d1cb)[_0xdec6('0xc')](function(_0x28239a){logger[_0xdec6('0xd')](_0xdec6('0xe'),_0x4c917b,_0xdec6('0xf'));logger[_0xdec6('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x4c917b,_0xdec6('0xf'),JSON['stringify'](_0x28239a));if(_0x28239a[_0xdec6('0x11')]){if(_0x28239a[_0xdec6('0x11')][_0xdec6('0x12')]===0x1f4){logger[_0xdec6('0x11')](_0xdec6('0xe'),_0x4c917b,_0x28239a[_0xdec6('0x11')]['message']);return _0x3b223f(_0x28239a[_0xdec6('0x11')]['message']);}logger['error'](_0xdec6('0xe'),_0x4c917b,_0x28239a[_0xdec6('0x11')][_0xdec6('0x13')]);return _0x5e7761(_0x28239a['error'][_0xdec6('0x13')]);}else{logger['info'](_0xdec6('0xe'),_0x4c917b,'request\x20sent');_0x5e7761(_0x28239a[_0xdec6('0x14')][_0xdec6('0x13')]);}})[_0xdec6('0x15')](function(_0x55f83f){logger[_0xdec6('0x11')](_0xdec6('0xe'),_0x4c917b,_0x55f83f);_0x3b223f(_0x55f83f);});});}exports[_0xdec6('0x16')]=function(_0x494126){var _0x3b3d27=this;return new Promise(function(_0x1331ca,_0x31ac8a){return db[_0xdec6('0x17')][_0xdec6('0x18')]({'raw':_0x494126['options']?_0x494126['options']['raw']===undefined?!![]:![]:!![],'where':_0x494126[_0xdec6('0x19')]?_0x494126[_0xdec6('0x19')][_0xdec6('0x1a')]||null:null,'attributes':_0x494126[_0xdec6('0x19')]?_0x494126[_0xdec6('0x19')][_0xdec6('0x1b')]||null:null,'limit':_0x494126[_0xdec6('0x19')]?_0x494126[_0xdec6('0x19')][_0xdec6('0x1c')]||null:null,'include':_0x494126['options']?_0x494126[_0xdec6('0x19')][_0xdec6('0x1d')]?_['map'](_0x494126[_0xdec6('0x19')][_0xdec6('0x1d')],function(_0x17afca){return{'model':db[_0x17afca[_0xdec6('0x1e')]],'as':_0x17afca['as'],'attributes':_0x17afca[_0xdec6('0x1b')],'include':_0x17afca[_0xdec6('0x1d')]?_['map'](_0x17afca[_0xdec6('0x1d')],function(_0x4bd9fe){return{'model':db[_0x4bd9fe['model']],'as':_0x4bd9fe['as'],'attributes':_0x4bd9fe['attributes'],'include':_0x4bd9fe[_0xdec6('0x1d')]?_[_0xdec6('0x1f')](_0x4bd9fe[_0xdec6('0x1d')],function(_0x442695){return{'model':db[_0x442695[_0xdec6('0x1e')]],'as':_0x442695['as'],'attributes':_0x442695[_0xdec6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdec6('0xc')](function(_0x350ce9){logger[_0xdec6('0xd')](_0xdec6('0x16'),_0x494126);logger[_0xdec6('0x10')](_0xdec6('0x16'),_0x494126,JSON['stringify'](_0x350ce9));_0x1331ca(_0x350ce9);})['catch'](function(_0xb86a9){logger['error'](_0xdec6('0x16'),_0xb86a9[_0xdec6('0x13')],_0x494126);_0x31ac8a(_0x3b3d27[_0xdec6('0x11')](0x1f4,_0xb86a9[_0xdec6('0x13')]));});});};exports[_0xdec6('0x20')]=function(_0x2b2100){var _0x52a058=this;return new Promise(function(_0x215ccc,_0x317e25){return db[_0xdec6('0x17')][_0xdec6('0x21')](_0x2b2100[_0xdec6('0x22')],{'raw':_0x2b2100[_0xdec6('0x19')]?_0x2b2100[_0xdec6('0x19')][_0xdec6('0x23')]===undefined?!![]:![]:!![]})[_0xdec6('0xc')](function(_0x4a483f){logger['info'](_0xdec6('0x20'),_0x2b2100);logger[_0xdec6('0x10')](_0xdec6('0x20'),_0x2b2100,JSON[_0xdec6('0x24')](_0x4a483f));_0x215ccc(_0x4a483f);})[_0xdec6('0x15')](function(_0x4cf61f){logger[_0xdec6('0x11')](_0xdec6('0x20'),_0x4cf61f[_0xdec6('0x13')],_0x2b2100);_0x317e25(_0x52a058['error'](0x1f4,_0x4cf61f[_0xdec6('0x13')]));});});};exports[_0xdec6('0x25')]=function(_0xd019b4){var _0x24f2bd=this;return new Promise(function(_0x4c46bf,_0x1e9ed6){return db[_0xdec6('0x17')][_0xdec6('0x26')](_0xd019b4['body'],{'raw':_0xd019b4[_0xdec6('0x19')]?_0xd019b4[_0xdec6('0x19')][_0xdec6('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd019b4[_0xdec6('0x19')]?_0xd019b4[_0xdec6('0x19')][_0xdec6('0x1a')]||null:null,'attributes':_0xd019b4[_0xdec6('0x19')]?_0xd019b4[_0xdec6('0x19')][_0xdec6('0x1b')]||null:null,'limit':_0xd019b4[_0xdec6('0x19')]?_0xd019b4[_0xdec6('0x19')]['limit']||null:null})['then'](function(_0x2aea4d){logger[_0xdec6('0xd')](_0xdec6('0x25'),_0xd019b4);logger[_0xdec6('0x10')](_0xdec6('0x25'),_0xd019b4,JSON[_0xdec6('0x24')](_0x2aea4d));_0x4c46bf(_0x2aea4d);})[_0xdec6('0x15')](function(_0x2fd658){logger[_0xdec6('0x11')](_0xdec6('0x25'),_0x2fd658[_0xdec6('0x13')],_0xd019b4);_0x1e9ed6(_0x24f2bd[_0xdec6('0x11')](0x1f4,_0x2fd658[_0xdec6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 1e16211..3bf5e2b 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 _0xcd59=['../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x170b30,_0xfbeb58){var _0x49f408=function(_0x40d018){while(--_0x40d018){_0x170b30['push'](_0x170b30['shift']());}};_0x49f408(++_0xfbeb58);}(_0xcd59,0x14b));var _0x9cd5=function(_0x5b57ae,_0x31bac6){_0x5b57ae=_0x5b57ae-0x0;var _0x1877c2=_0xcd59[_0x5b57ae];return _0x1877c2;};'use strict';var multer=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var path=require(_0x9cd5('0x2'));var timeout=require(_0x9cd5('0x3'));var express=require(_0x9cd5('0x4'));var router=express[_0x9cd5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9cd5('0x6'));var interaction=require(_0x9cd5('0x7'));var config=require(_0x9cd5('0x8'));var controller=require(_0x9cd5('0x9'));router[_0x9cd5('0xa')]('/',controller[_0x9cd5('0xb')]);module[_0x9cd5('0xc')]=router; \ No newline at end of file +var _0x5636=['Router','fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer','util'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0x5636,0x102));var _0x6563=function(_0x693c9c,_0x3f5091){_0x693c9c=_0x693c9c-0x0;var _0x9fc90=_0x5636[_0x693c9c];return _0x9fc90;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6563('0x2')]();var fs_extra=require(_0x6563('0x3'));var auth=require(_0x6563('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6563('0x5'));var controller=require(_0x6563('0x6'));router[_0x6563('0x7')]('/',controller[_0x6563('0x8')]);module[_0x6563('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 4c11bf3..e38811a 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 _0xa389=['version','sequelize','STRING'];(function(_0x493160,_0x53dbb5){var _0x31fcab=function(_0x1098d8){while(--_0x1098d8){_0x493160['push'](_0x493160['shift']());}};_0x31fcab(++_0x53dbb5);}(_0xa389,0xfd));var _0x9a38=function(_0x2291a7,_0x14d1a3){_0x2291a7=_0x2291a7-0x0;var _0x254a44=_0xa389[_0x2291a7];return _0x254a44;};'use strict';var Sequelize=require(_0x9a38('0x0'));module['exports']={'version':{'type':Sequelize[_0x9a38('0x1')],'unique':_0x9a38('0x2')}}; \ No newline at end of file +var _0xb7fc=['exports','STRING','version','sequelize'];(function(_0x3983af,_0x145ad9){var _0x1046ba=function(_0x2b7995){while(--_0x2b7995){_0x3983af['push'](_0x3983af['shift']());}};_0x1046ba(++_0x145ad9);}(_0xb7fc,0x147));var _0xcb7f=function(_0xc3aae7,_0x3bfa91){_0xc3aae7=_0xc3aae7-0x0;var _0x1f365a=_0xb7fc[_0xc3aae7];return _0x1f365a;};'use strict';var Sequelize=require(_0xcb7f('0x0'));module[_0xcb7f('0x1')]={'version':{'type':Sequelize[_0xcb7f('0x2')],'unique':_0xcb7f('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 3e50cf5..569320e 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 _0x7196=['sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','render','merge','body','contact','message','account','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','options','Migration','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x41e3ac,_0x3c2208){var _0x1cbb69=function(_0x5ba0ba){while(--_0x5ba0ba){_0x41e3ac['push'](_0x41e3ac['shift']());}};_0x1cbb69(++_0x3c2208);}(_0x7196,0x165));var _0x6719=function(_0x563ac7,_0x5cf79f){_0x563ac7=_0x563ac7-0x0;var _0x14f408=_0x7196[_0x563ac7];return _0x14f408;};'use strict';var emlformat=require(_0x6719('0x0'));var rimraf=require(_0x6719('0x1'));var zipdir=require(_0x6719('0x2'));var jsonpatch=require(_0x6719('0x3'));var rp=require(_0x6719('0x4'));var moment=require(_0x6719('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6719('0x6'));var util=require(_0x6719('0x7'));var path=require(_0x6719('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6719('0x9'));var fs=require('fs');var fs_extra=require(_0x6719('0xa'));var _=require(_0x6719('0xb'));var squel=require(_0x6719('0xc'));var crypto=require(_0x6719('0xd'));var jsforce=require(_0x6719('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6719('0xf'));var querystring=require(_0x6719('0x10'));var Papa=require(_0x6719('0x11'));var Redis=require(_0x6719('0x12'));var authService=require(_0x6719('0x13'));var qs=require(_0x6719('0x14'));var as=require(_0x6719('0x15'));var hardwareService=require(_0x6719('0x16'));var logger=require('../../config/logger')(_0x6719('0x17'));var utils=require(_0x6719('0x18'));var config=require(_0x6719('0x19'));var licenseUtil=require(_0x6719('0x1a'));var db=require(_0x6719('0x1b'))['db'];function respondWithStatusCode(_0x26b292,_0x278108){_0x278108=_0x278108||0xcc;return function(_0x3d24e3){if(_0x3d24e3){return _0x26b292[_0x6719('0x1c')](_0x278108);}return _0x26b292['status'](_0x278108)[_0x6719('0x1d')]();};}function respondWithResult(_0x4723fb,_0x415204){_0x415204=_0x415204||0xc8;return function(_0x3b248b){if(_0x3b248b){return _0x4723fb[_0x6719('0x1e')](_0x415204)[_0x6719('0x1f')](_0x3b248b);}};}function respondWithFilteredResult(_0x13703f,_0x314c89){return function(_0x332a4f){if(_0x332a4f){var _0x1da500=typeof _0x314c89[_0x6719('0x20')]===_0x6719('0x21')&&typeof _0x314c89[_0x6719('0x22')]===_0x6719('0x21');var _0x1f6deb=_0x332a4f['count'];var _0x5f540b=_0x1da500?0x0:_0x314c89[_0x6719('0x20')];var _0x27ac9c=_0x1da500?_0x332a4f[_0x6719('0x23')]:_0x314c89[_0x6719('0x20')]+_0x314c89[_0x6719('0x22')];var _0x15b51c;if(_0x27ac9c>=_0x1f6deb){_0x27ac9c=_0x1f6deb;_0x15b51c=0xc8;}else{_0x15b51c=0xce;}_0x13703f[_0x6719('0x1e')](_0x15b51c);return _0x13703f[_0x6719('0x24')]('Content-Range',_0x5f540b+'-'+_0x27ac9c+'/'+_0x1f6deb)['json'](_0x332a4f);}return null;};}function patchUpdates(_0xb675a3){return function(_0x1a0a83){try{jsonpatch[_0x6719('0x25')](_0x1a0a83,_0xb675a3,!![]);}catch(_0x3f5381){return BPromise[_0x6719('0x26')](_0x3f5381);}return _0x1a0a83[_0x6719('0x27')]();};}function saveUpdates(_0x2188d0,_0xcbbc8f){return function(_0x4aca23){if(_0x4aca23){return _0x4aca23[_0x6719('0x28')](_0x2188d0)[_0x6719('0x29')](function(_0x4b503b){return _0x4b503b;});}return null;};}function removeEntity(_0x5340fd,_0x13cced){return function(_0x22f92c){if(_0x22f92c){return _0x22f92c[_0x6719('0x2a')]()['then'](function(){_0x5340fd[_0x6719('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x318842,_0x2ca55e){return function(_0x2b5f92){if(!_0x2b5f92){_0x318842[_0x6719('0x1c')](0x194);}return _0x2b5f92;};}function handleError(_0x37e28d,_0x314f5f){_0x314f5f=_0x314f5f||0x1f4;return function(_0x4701dc){logger[_0x6719('0x2b')](_0x4701dc['stack']);if(_0x4701dc[_0x6719('0x2c')]){delete _0x4701dc['name'];}_0x37e28d[_0x6719('0x1e')](_0x314f5f)[_0x6719('0x2d')](_0x4701dc);};}function getMustacheRender(_0x3ec5f1,_0x57dfc6){return Mustache[_0x6719('0x2e')](_0x3ec5f1,_[_0x6719('0x2f')](_0x57dfc6[_0x6719('0x30')],{'contact':_0x57dfc6[_0x6719('0x31')],'message':_0x57dfc6[_0x6719('0x32')],'agent':_0x57dfc6['agent'],'interaction':_0x57dfc6['interaction'],'account':_0x57dfc6[_0x6719('0x33')]}))||'';}exports['index']=function(_0x4edbc5,_0x3164a6){var _0x42b113={},_0x117bf8={},_0x4c3108={'count':0x0,'rows':[]};var _0x31bf1a=_[_0x6719('0x34')](db['Migration'][_0x6719('0x35')],function(_0x32158a){return{'name':_0x32158a[_0x6719('0x36')],'type':_0x32158a[_0x6719('0x37')][_0x6719('0x38')]};});_0x117bf8[_0x6719('0x39')]=_[_0x6719('0x34')](_0x31bf1a,_0x6719('0x2c'));_0x117bf8[_0x6719('0x3a')]=_[_0x6719('0x3b')](_0x4edbc5[_0x6719('0x3a')]);_0x117bf8[_0x6719('0x3c')]=_[_0x6719('0x3d')](_0x117bf8['model'],_0x117bf8[_0x6719('0x3a')]);_0x42b113[_0x6719('0x3e')]=_[_0x6719('0x3d')](_0x117bf8[_0x6719('0x39')],qs[_0x6719('0x3f')](_0x4edbc5[_0x6719('0x3a')][_0x6719('0x3f')]));_0x42b113[_0x6719('0x3e')]=_0x42b113['attributes'][_0x6719('0x40')]?_0x42b113[_0x6719('0x3e')]:_0x117bf8[_0x6719('0x39')];if(!_0x4edbc5[_0x6719('0x3a')][_0x6719('0x41')](_0x6719('0x42'))){_0x42b113['limit']=qs[_0x6719('0x22')](_0x4edbc5[_0x6719('0x3a')][_0x6719('0x22')]);_0x42b113[_0x6719('0x20')]=qs[_0x6719('0x20')](_0x4edbc5[_0x6719('0x3a')][_0x6719('0x20')]);}_0x42b113['order']=qs[_0x6719('0x43')](_0x4edbc5[_0x6719('0x3a')]['sort']);_0x42b113[_0x6719('0x44')]=qs['filters'](_['pick'](_0x4edbc5[_0x6719('0x3a')],_0x117bf8[_0x6719('0x3c')]),_0x31bf1a);if(_0x4edbc5[_0x6719('0x3a')]['filter']){_0x42b113[_0x6719('0x44')]=_[_0x6719('0x2f')](_0x42b113[_0x6719('0x44')],{'$or':_[_0x6719('0x34')](_0x31bf1a,function(_0x29ce0c){if(_0x29ce0c[_0x6719('0x37')]!==_0x6719('0x45')){var _0x3b373b={};_0x3b373b[_0x29ce0c[_0x6719('0x2c')]]={'$like':'%'+_0x4edbc5[_0x6719('0x3a')]['filter']+'%'};return _0x3b373b;}})});}_0x42b113=_['merge']({},_0x42b113,_0x4edbc5[_0x6719('0x46')]);var _0x3f5805={'where':_0x42b113[_0x6719('0x44')]};return db[_0x6719('0x47')][_0x6719('0x23')](_0x3f5805)['then'](function(_0x301175){_0x4c3108[_0x6719('0x23')]=_0x301175;if(_0x4edbc5[_0x6719('0x3a')][_0x6719('0x48')]){_0x42b113[_0x6719('0x49')]=[{'all':!![]}];}return db[_0x6719('0x47')][_0x6719('0x4a')](_0x42b113);})[_0x6719('0x29')](function(_0x44eece){_0x4c3108[_0x6719('0x4b')]=_0x44eece;return _0x4c3108;})[_0x6719('0x29')](respondWithFilteredResult(_0x3164a6,_0x42b113))[_0x6719('0x4c')](handleError(_0x3164a6,null));}; \ No newline at end of file +var _0x5467=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','include','rows','catch','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','render','merge','body','contact','message','interaction','account','index','Migration','rawAttributes','type','key','model','map','query','keys','intersection'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x5467,0x1ab));var _0x7546=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x5467[_0x36dfbd];return _0x4ecad9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7546('0x0'));var zipdir=require(_0x7546('0x1'));var jsonpatch=require(_0x7546('0x2'));var rp=require('request-promise');var moment=require(_0x7546('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7546('0x4'));var util=require(_0x7546('0x5'));var path=require(_0x7546('0x6'));var sox=require(_0x7546('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7546('0x8'));var _=require(_0x7546('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7546('0xa'));var querystring=require('querystring');var Papa=require(_0x7546('0xb'));var Redis=require(_0x7546('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7546('0xd'));var hardwareService=require(_0x7546('0xe'));var logger=require(_0x7546('0xf'))(_0x7546('0x10'));var utils=require(_0x7546('0x11'));var config=require(_0x7546('0x12'));var licenseUtil=require(_0x7546('0x13'));var db=require(_0x7546('0x14'))['db'];function respondWithStatusCode(_0x1bd979,_0x9158c7){_0x9158c7=_0x9158c7||0xcc;return function(_0x177e8d){if(_0x177e8d){return _0x1bd979[_0x7546('0x15')](_0x9158c7);}return _0x1bd979[_0x7546('0x16')](_0x9158c7)[_0x7546('0x17')]();};}function respondWithResult(_0x4a72df,_0x2702ec){_0x2702ec=_0x2702ec||0xc8;return function(_0x3c41ef){if(_0x3c41ef){return _0x4a72df[_0x7546('0x16')](_0x2702ec)['json'](_0x3c41ef);}};}function respondWithFilteredResult(_0x484b78,_0x2af3aa){return function(_0xe4d8d2){if(_0xe4d8d2){var _0x5c6e54=typeof _0x2af3aa[_0x7546('0x18')]==='undefined'&&typeof _0x2af3aa[_0x7546('0x19')]==='undefined';var _0x25da22=_0xe4d8d2['count'];var _0x23e2fa=_0x5c6e54?0x0:_0x2af3aa[_0x7546('0x18')];var _0x2e9545=_0x5c6e54?_0xe4d8d2[_0x7546('0x1a')]:_0x2af3aa[_0x7546('0x18')]+_0x2af3aa[_0x7546('0x19')];var _0x2d52d8;if(_0x2e9545>=_0x25da22){_0x2e9545=_0x25da22;_0x2d52d8=0xc8;}else{_0x2d52d8=0xce;}_0x484b78['status'](_0x2d52d8);return _0x484b78[_0x7546('0x1b')](_0x7546('0x1c'),_0x23e2fa+'-'+_0x2e9545+'/'+_0x25da22)[_0x7546('0x1d')](_0xe4d8d2);}return null;};}function patchUpdates(_0x31cfdb){return function(_0x4f4ce1){try{jsonpatch[_0x7546('0x1e')](_0x4f4ce1,_0x31cfdb,!![]);}catch(_0x21de8b){return BPromise['reject'](_0x21de8b);}return _0x4f4ce1[_0x7546('0x1f')]();};}function saveUpdates(_0x59def6,_0x140809){return function(_0x2c5c96){if(_0x2c5c96){return _0x2c5c96[_0x7546('0x20')](_0x59def6)[_0x7546('0x21')](function(_0xa20fca){return _0xa20fca;});}return null;};}function removeEntity(_0xd08b6d,_0xdfe2c7){return function(_0xe485c4){if(_0xe485c4){return _0xe485c4[_0x7546('0x22')]()[_0x7546('0x21')](function(){_0xd08b6d[_0x7546('0x16')](0xcc)[_0x7546('0x17')]();});}};}function handleEntityNotFound(_0x59b3f9,_0x51fa30){return function(_0x3a74b5){if(!_0x3a74b5){_0x59b3f9[_0x7546('0x15')](0x194);}return _0x3a74b5;};}function handleError(_0x48f067,_0x157089){_0x157089=_0x157089||0x1f4;return function(_0x4316b1){logger[_0x7546('0x23')](_0x4316b1[_0x7546('0x24')]);if(_0x4316b1[_0x7546('0x25')]){delete _0x4316b1[_0x7546('0x25')];}_0x48f067[_0x7546('0x16')](_0x157089)[_0x7546('0x26')](_0x4316b1);};}function getMustacheRender(_0x22588f,_0x1c8735){return Mustache[_0x7546('0x27')](_0x22588f,_[_0x7546('0x28')](_0x1c8735[_0x7546('0x29')],{'contact':_0x1c8735[_0x7546('0x2a')],'message':_0x1c8735[_0x7546('0x2b')],'agent':_0x1c8735['agent'],'interaction':_0x1c8735[_0x7546('0x2c')],'account':_0x1c8735[_0x7546('0x2d')]}))||'';}exports[_0x7546('0x2e')]=function(_0x51caea,_0x1ab151){var _0x3f952a={},_0x32f66a={},_0x51932f={'count':0x0,'rows':[]};var _0x4055e0=_['map'](db[_0x7546('0x2f')][_0x7546('0x30')],function(_0x36ebf6){return{'name':_0x36ebf6['fieldName'],'type':_0x36ebf6[_0x7546('0x31')][_0x7546('0x32')]};});_0x32f66a[_0x7546('0x33')]=_[_0x7546('0x34')](_0x4055e0,_0x7546('0x25'));_0x32f66a[_0x7546('0x35')]=_[_0x7546('0x36')](_0x51caea[_0x7546('0x35')]);_0x32f66a['filters']=_[_0x7546('0x37')](_0x32f66a[_0x7546('0x33')],_0x32f66a[_0x7546('0x35')]);_0x3f952a[_0x7546('0x38')]=_[_0x7546('0x37')](_0x32f66a[_0x7546('0x33')],qs[_0x7546('0x39')](_0x51caea[_0x7546('0x35')]['fields']));_0x3f952a[_0x7546('0x38')]=_0x3f952a[_0x7546('0x38')][_0x7546('0x3a')]?_0x3f952a[_0x7546('0x38')]:_0x32f66a['model'];if(!_0x51caea[_0x7546('0x35')][_0x7546('0x3b')](_0x7546('0x3c'))){_0x3f952a[_0x7546('0x19')]=qs[_0x7546('0x19')](_0x51caea[_0x7546('0x35')]['limit']);_0x3f952a[_0x7546('0x18')]=qs[_0x7546('0x18')](_0x51caea[_0x7546('0x35')]['offset']);}_0x3f952a[_0x7546('0x3d')]=qs[_0x7546('0x3e')](_0x51caea[_0x7546('0x35')][_0x7546('0x3e')]);_0x3f952a[_0x7546('0x3f')]=qs[_0x7546('0x40')](_['pick'](_0x51caea['query'],_0x32f66a['filters']),_0x4055e0);if(_0x51caea[_0x7546('0x35')][_0x7546('0x41')]){_0x3f952a[_0x7546('0x3f')]=_['merge'](_0x3f952a['where'],{'$or':_[_0x7546('0x34')](_0x4055e0,function(_0x355591){if(_0x355591[_0x7546('0x31')]!=='VIRTUAL'){var _0xf3e420={};_0xf3e420[_0x355591['name']]={'$like':'%'+_0x51caea[_0x7546('0x35')][_0x7546('0x41')]+'%'};return _0xf3e420;}})});}_0x3f952a=_[_0x7546('0x28')]({},_0x3f952a,_0x51caea['options']);var _0x1e01e5={'where':_0x3f952a['where']};return db[_0x7546('0x2f')][_0x7546('0x1a')](_0x1e01e5)[_0x7546('0x21')](function(_0x4fc2f4){_0x51932f[_0x7546('0x1a')]=_0x4fc2f4;if(_0x51caea[_0x7546('0x35')]['includeAll']){_0x3f952a[_0x7546('0x42')]=[{'all':!![]}];}return db[_0x7546('0x2f')]['findAll'](_0x3f952a);})[_0x7546('0x21')](function(_0x4d7c9c){_0x51932f[_0x7546('0x43')]=_0x4d7c9c;return _0x51932f;})[_0x7546('0x21')](respondWithFilteredResult(_0x1ab151,_0x3f952a))[_0x7546('0x44')](handleError(_0x1ab151,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 07a61e7..32f0881 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 _0x7a3d=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','util'];(function(_0x17bb83,_0x1b03c3){var _0x4db99a=function(_0x40a57e){while(--_0x40a57e){_0x17bb83['push'](_0x17bb83['shift']());}};_0x4db99a(++_0x1b03c3);}(_0x7a3d,0x15b));var _0xd7a3=function(_0x2913ca,_0x1a51e9){_0x2913ca=_0x2913ca-0x0;var _0x28f35c=_0x7a3d[_0x2913ca];return _0x28f35c;};'use strict';var _=require('lodash');var util=require(_0xd7a3('0x0'));var logger=require(_0xd7a3('0x1'))(_0xd7a3('0x2'));var moment=require(_0xd7a3('0x3'));var BPromise=require(_0xd7a3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd7a3('0x5'));var rimraf=require(_0xd7a3('0x6'));var config=require(_0xd7a3('0x7'));var attributes=require(_0xd7a3('0x8'));module[_0xd7a3('0x9')]=function(_0x539e3c,_0x52adcd){return _0x539e3c[_0xd7a3('0xa')](_0xd7a3('0xb'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68d3=['../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x581a60,_0x5edd11){var _0x178caa=function(_0x523c8c){while(--_0x523c8c){_0x581a60['push'](_0x581a60['shift']());}};_0x178caa(++_0x5edd11);}(_0x68d3,0x6e));var _0x368d=function(_0x4f7bdf,_0xb4a8f7){_0x4f7bdf=_0x4f7bdf-0x0;var _0x2e72b2=_0x68d3[_0x4f7bdf];return _0x2e72b2;};'use strict';var _=require(_0x368d('0x0'));var util=require('util');var logger=require(_0x368d('0x1'))(_0x368d('0x2'));var moment=require(_0x368d('0x3'));var BPromise=require(_0x368d('0x4'));var rp=require(_0x368d('0x5'));var fs=require('fs');var path=require(_0x368d('0x6'));var rimraf=require('rimraf');var config=require(_0x368d('0x7'));var attributes=require(_0x368d('0x8'));module[_0x368d('0x9')]=function(_0x3d375b,_0x33cae8){return _0x3d375b[_0x368d('0xa')](_0x368d('0xb'),attributes,{'tableName':_0x368d('0xc'),'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 f40c5cd..7df063f 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 _0x5919=['http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x146cb9,_0x349d0b){var _0x2dbc9a=function(_0x2917ac){while(--_0x2917ac){_0x146cb9['push'](_0x146cb9['shift']());}};_0x2dbc9a(++_0x349d0b);}(_0x5919,0x198));var _0x9591=function(_0x53e26e,_0x4a5f9c){_0x53e26e=_0x53e26e-0x0;var _0xf87fd2=_0x5919[_0x53e26e];return _0xf87fd2;};'use strict';var _=require(_0x9591('0x0'));var util=require('util');var moment=require(_0x9591('0x1'));var BPromise=require(_0x9591('0x2'));var rs=require(_0x9591('0x3'));var fs=require('fs');var Redis=require(_0x9591('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9591('0x5'));var logger=require(_0x9591('0x6'))(_0x9591('0x7'));var config=require('../../config/environment');var jayson=require(_0x9591('0x8'));var client=jayson[_0x9591('0x9')][_0x9591('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x487925,_0x3239e2,_0x360d03){return new BPromise(function(_0x26d1a8,_0x5deaa9){return client[_0x9591('0xb')](_0x487925,_0x360d03)[_0x9591('0xc')](function(_0x4ae2bf){logger[_0x9591('0xd')](_0x9591('0xe'),_0x3239e2,_0x9591('0xf'));logger[_0x9591('0x10')](_0x9591('0x11'),_0x3239e2,_0x9591('0xf'),JSON['stringify'](_0x4ae2bf));if(_0x4ae2bf[_0x9591('0x12')]){if(_0x4ae2bf[_0x9591('0x12')][_0x9591('0x13')]===0x1f4){logger[_0x9591('0x12')](_0x9591('0xe'),_0x3239e2,_0x4ae2bf[_0x9591('0x12')][_0x9591('0x14')]);return _0x5deaa9(_0x4ae2bf[_0x9591('0x12')][_0x9591('0x14')]);}logger[_0x9591('0x12')](_0x9591('0xe'),_0x3239e2,_0x4ae2bf[_0x9591('0x12')][_0x9591('0x14')]);return _0x26d1a8(_0x4ae2bf[_0x9591('0x12')][_0x9591('0x14')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x3239e2,_0x9591('0xf'));_0x26d1a8(_0x4ae2bf['result']['message']);}})[_0x9591('0x15')](function(_0x41b3a7){logger[_0x9591('0x12')](_0x9591('0xe'),_0x3239e2,_0x41b3a7);_0x5deaa9(_0x41b3a7);});});} \ No newline at end of file +var _0xd958=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x4d6006,_0x4cde28){var _0x5f2638=function(_0x5adf5c){while(--_0x5adf5c){_0x4d6006['push'](_0x4d6006['shift']());}};_0x5f2638(++_0x4cde28);}(_0xd958,0xb8));var _0x8d95=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xd958[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x8d95('0x0'));var util=require(_0x8d95('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8d95('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d95('0x3'))['db'];var utils=require(_0x8d95('0x4'));var logger=require(_0x8d95('0x5'))(_0x8d95('0x6'));var config=require(_0x8d95('0x7'));var jayson=require(_0x8d95('0x8'));var client=jayson[_0x8d95('0x9')][_0x8d95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cc162,_0x429f1e,_0xf80e9a){return new BPromise(function(_0x2e6506,_0x245f1f){return client[_0x8d95('0xb')](_0x4cc162,_0xf80e9a)['then'](function(_0x339ae6){logger[_0x8d95('0xc')](_0x8d95('0xd'),_0x429f1e,'request\x20sent');logger['debug'](_0x8d95('0xe'),_0x429f1e,_0x8d95('0xf'),JSON[_0x8d95('0x10')](_0x339ae6));if(_0x339ae6['error']){if(_0x339ae6[_0x8d95('0x11')]['code']===0x1f4){logger[_0x8d95('0x11')](_0x8d95('0xd'),_0x429f1e,_0x339ae6['error'][_0x8d95('0x12')]);return _0x245f1f(_0x339ae6[_0x8d95('0x11')]['message']);}logger[_0x8d95('0x11')](_0x8d95('0xd'),_0x429f1e,_0x339ae6[_0x8d95('0x11')][_0x8d95('0x12')]);return _0x2e6506(_0x339ae6['error'][_0x8d95('0x12')]);}else{logger[_0x8d95('0xc')]('Migration,\x20%s,\x20%s',_0x429f1e,'request\x20sent');_0x2e6506(_0x339ae6[_0x8d95('0x13')][_0x8d95('0x12')]);}})[_0x8d95('0x14')](function(_0x37eab4){logger[_0x8d95('0x11')](_0x8d95('0xd'),_0x429f1e,_0x37eab4);_0x245f1f(_0x37eab4);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 8cef307..7c9b2a7 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 _0x5c00=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','util','path','connect-timeout','express','Router'];(function(_0x9df164,_0x5c84e2){var _0x34a59c=function(_0x4bc92e){while(--_0x4bc92e){_0x9df164['push'](_0x9df164['shift']());}};_0x34a59c(++_0x5c84e2);}(_0x5c00,0x193));var _0x05c0=function(_0x40ced5,_0x2b8fe9){_0x40ced5=_0x40ced5-0x0;var _0x51024e=_0x5c00[_0x40ced5];return _0x51024e;};'use strict';var multer=require('multer');var util=require(_0x05c0('0x0'));var path=require(_0x05c0('0x1'));var timeout=require(_0x05c0('0x2'));var express=require(_0x05c0('0x3'));var router=express[_0x05c0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x05c0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x05c0('0x6'));var controller=require('./network.controller');router[_0x05c0('0x7')]('/',auth[_0x05c0('0x8')](),controller[_0x05c0('0x9')]);router[_0x05c0('0x7')]('/:id',auth[_0x05c0('0x8')](),controller[_0x05c0('0xa')]);router[_0x05c0('0xb')]('/',auth['isAuthenticated'](),controller[_0x05c0('0xc')]);router[_0x05c0('0xd')](_0x05c0('0xe'),auth['isAuthenticated'](),controller[_0x05c0('0xf')]);router['delete'](_0x05c0('0xe'),auth[_0x05c0('0x8')](),controller[_0x05c0('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7dfb=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports'];(function(_0x369a05,_0x5137a6){var _0x4d258c=function(_0x5a2128){while(--_0x5a2128){_0x369a05['push'](_0x369a05['shift']());}};_0x4d258c(++_0x5137a6);}(_0x7dfb,0x104));var _0xb7df=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x7dfb[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require(_0xb7df('0x0'));var util=require(_0xb7df('0x1'));var path=require(_0xb7df('0x2'));var timeout=require(_0xb7df('0x3'));var express=require(_0xb7df('0x4'));var router=express[_0xb7df('0x5')]();var fs_extra=require(_0xb7df('0x6'));var auth=require(_0xb7df('0x7'));var interaction=require(_0xb7df('0x8'));var config=require(_0xb7df('0x9'));var controller=require('./network.controller');router[_0xb7df('0xa')]('/',auth[_0xb7df('0xb')](),controller[_0xb7df('0xc')]);router[_0xb7df('0xa')](_0xb7df('0xd'),auth[_0xb7df('0xb')](),controller[_0xb7df('0xe')]);router['post']('/',auth[_0xb7df('0xb')](),controller['create']);router[_0xb7df('0xf')]('/:id',auth[_0xb7df('0xb')](),controller[_0xb7df('0x10')]);router[_0xb7df('0x11')](_0xb7df('0xd'),auth[_0xb7df('0xb')](),controller[_0xb7df('0x12')]);module[_0xb7df('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 6810300..f828ac2 100644 --- a/server/api/network/network.attributes.js +++ b/server/api/network/network.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x196d14,_0x559873){var _0x41faa4=function(_0x2b2b75){while(--_0x2b2b75){_0x196d14['push'](_0x196d14['shift']());}};_0x41faa4(++_0x559873);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x4cc124,_0x4c2fc2){var _0x4692ad=function(_0x35720b){while(--_0x35720b){_0x4cc124['push'](_0x4cc124['shift']());}};_0x4692ad(++_0x4c2fc2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 15e7de2..7abf1bf 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 _0x44c8=['merge','body','contact','agent','interaction','account','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','options','Network','include','findAll','rows','show','params','rawAttributes','includeAll','create','sequelize','transaction','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','join','utf8','/etc/asterisk/turn_xcally.conf','Reload','format','toLowerCase','chan_sip.so','find','server/files/templates/turn_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','Network,\x20%s,\x20%s','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','end','name','send'];(function(_0x1f0679,_0x53d43c){var _0x3dc3a4=function(_0x49ba8f){while(--_0x49ba8f){_0x1f0679['push'](_0x1f0679['shift']());}};_0x3dc3a4(++_0x53d43c);}(_0x44c8,0xaa));var _0x844c=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x44c8[_0x273c39];return _0x46d6b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x844c('0x0'));var zipdir=require(_0x844c('0x1'));var jsonpatch=require(_0x844c('0x2'));var rp=require('request-promise');var moment=require(_0x844c('0x3'));var BPromise=require(_0x844c('0x4'));var Mustache=require('mustache');var util=require(_0x844c('0x5'));var path=require(_0x844c('0x6'));var sox=require(_0x844c('0x7'));var csv=require('to-csv');var ejs=require(_0x844c('0x8'));var fs=require('fs');var fs_extra=require(_0x844c('0x9'));var _=require(_0x844c('0xa'));var squel=require(_0x844c('0xb'));var crypto=require(_0x844c('0xc'));var jsforce=require(_0x844c('0xd'));var deskjs=require(_0x844c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x844c('0xf'));var Papa=require(_0x844c('0x10'));var Redis=require('ioredis');var authService=require(_0x844c('0x11'));var qs=require(_0x844c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x844c('0x13'))(_0x844c('0x14'));var utils=require(_0x844c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x844c('0x16'));var db=require(_0x844c('0x17'))['db'];var jayson=require(_0x844c('0x18'));var client=jayson[_0x844c('0x19')][_0x844c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1f6ff3,_0x5ce7ef,_0x8e6432,_0x516de4){return new BPromise(function(_0xfd9775,_0x15326f){var _0x1129d4=_0x516de4||client;return _0x1129d4[_0x844c('0x1b')](_0x1f6ff3,_0x8e6432)[_0x844c('0x1c')](function(_0x17eee1){logger[_0x844c('0x1d')]('Network,\x20%s,\x20%s',_0x5ce7ef,_0x844c('0x1e'));logger[_0x844c('0x1f')](_0x844c('0x20'),_0x5ce7ef,_0x844c('0x1e'),JSON['stringify'](_0x17eee1));if(_0x17eee1[_0x844c('0x21')]){if(_0x17eee1[_0x844c('0x21')][_0x844c('0x22')]===0x1f4){logger[_0x844c('0x21')]('Network,\x20%s,\x20%s',_0x5ce7ef,_0x17eee1[_0x844c('0x21')][_0x844c('0x23')]);return _0x15326f(_0x17eee1[_0x844c('0x21')][_0x844c('0x23')]);}logger['error'](_0x844c('0x24'),_0x5ce7ef,_0x17eee1[_0x844c('0x21')][_0x844c('0x23')]);return _0xfd9775(_0x17eee1['error'][_0x844c('0x23')]);}else{logger[_0x844c('0x1d')](_0x844c('0x24'),_0x5ce7ef,_0x844c('0x1e'));_0xfd9775(_0x17eee1['result']['message']);}})['catch'](function(_0xc96d09){logger['error'](_0x844c('0x24'),_0x5ce7ef,_0xc96d09);_0x15326f(_0xc96d09);});});}function respondWithStatusCode(_0x174b69,_0x534823){_0x534823=_0x534823||0xcc;return function(_0x18c2ca){if(_0x18c2ca){return _0x174b69[_0x844c('0x25')](_0x534823);}return _0x174b69[_0x844c('0x26')](_0x534823)['end']();};}function respondWithResult(_0x44ddfb,_0x3003c6){_0x3003c6=_0x3003c6||0xc8;return function(_0x1dea38){if(_0x1dea38){return _0x44ddfb[_0x844c('0x26')](_0x3003c6)['json'](_0x1dea38);}};}function respondWithFilteredResult(_0x27d425,_0x1c371f){return function(_0x22d317){if(_0x22d317){var _0x515ea7=typeof _0x1c371f['offset']===_0x844c('0x27')&&typeof _0x1c371f[_0x844c('0x28')]===_0x844c('0x27');var _0x1b2fcf=_0x22d317[_0x844c('0x29')];var _0x32337e=_0x515ea7?0x0:_0x1c371f['offset'];var _0x47fc19=_0x515ea7?_0x22d317[_0x844c('0x29')]:_0x1c371f[_0x844c('0x2a')]+_0x1c371f['limit'];var _0x10a039;if(_0x47fc19>=_0x1b2fcf){_0x47fc19=_0x1b2fcf;_0x10a039=0xc8;}else{_0x10a039=0xce;}_0x27d425[_0x844c('0x26')](_0x10a039);return _0x27d425[_0x844c('0x2b')](_0x844c('0x2c'),_0x32337e+'-'+_0x47fc19+'/'+_0x1b2fcf)[_0x844c('0x2d')](_0x22d317);}return null;};}function patchUpdates(_0x413cf6){return function(_0x1b8628){try{jsonpatch[_0x844c('0x2e')](_0x1b8628,_0x413cf6,!![]);}catch(_0x9a33e8){return BPromise[_0x844c('0x2f')](_0x9a33e8);}return _0x1b8628[_0x844c('0x30')]();};}function saveUpdates(_0x1176d5,_0x196b27){return function(_0x3de511){if(_0x3de511){return _0x3de511[_0x844c('0x31')](_0x1176d5)[_0x844c('0x1c')](function(_0x50236e){return _0x50236e;});}return null;};}function removeEntity(_0x5e6317,_0x331152){return function(_0x41178c){if(_0x41178c){return _0x41178c[_0x844c('0x32')]()[_0x844c('0x1c')](function(){_0x5e6317[_0x844c('0x26')](0xcc)[_0x844c('0x33')]();});}};}function handleEntityNotFound(_0x29c475,_0x289de3){return function(_0x15b114){if(!_0x15b114){_0x29c475[_0x844c('0x25')](0x194);}return _0x15b114;};}function handleError(_0x2dbf29,_0x34eaba){_0x34eaba=_0x34eaba||0x1f4;return function(_0x8e9fdb){logger['error'](_0x8e9fdb['stack']);if(_0x8e9fdb['name']){delete _0x8e9fdb[_0x844c('0x34')];}_0x2dbf29[_0x844c('0x26')](_0x34eaba)[_0x844c('0x35')](_0x8e9fdb);};}function getMustacheRender(_0x514595,_0x4fc5c9){return Mustache['render'](_0x514595,_[_0x844c('0x36')](_0x4fc5c9[_0x844c('0x37')],{'contact':_0x4fc5c9[_0x844c('0x38')],'message':_0x4fc5c9[_0x844c('0x23')],'agent':_0x4fc5c9[_0x844c('0x39')],'interaction':_0x4fc5c9[_0x844c('0x3a')],'account':_0x4fc5c9[_0x844c('0x3b')]}))||'';}exports[_0x844c('0x3c')]=function(_0x426f04,_0x3ddcee){var _0x2f1b97={},_0x472bf0={},_0x5c1409={'count':0x0,'rows':[]};var _0x52a0ab=_[_0x844c('0x3d')](db['Network']['rawAttributes'],function(_0x1841af){return{'name':_0x1841af[_0x844c('0x3e')],'type':_0x1841af[_0x844c('0x3f')][_0x844c('0x40')]};});_0x472bf0[_0x844c('0x41')]=_[_0x844c('0x3d')](_0x52a0ab,_0x844c('0x34'));_0x472bf0[_0x844c('0x42')]=_[_0x844c('0x43')](_0x426f04[_0x844c('0x42')]);_0x472bf0['filters']=_[_0x844c('0x44')](_0x472bf0[_0x844c('0x41')],_0x472bf0[_0x844c('0x42')]);_0x2f1b97[_0x844c('0x45')]=_[_0x844c('0x44')](_0x472bf0[_0x844c('0x41')],qs[_0x844c('0x46')](_0x426f04[_0x844c('0x42')][_0x844c('0x46')]));_0x2f1b97[_0x844c('0x45')]=_0x2f1b97['attributes'][_0x844c('0x47')]?_0x2f1b97[_0x844c('0x45')]:_0x472bf0[_0x844c('0x41')];if(!_0x426f04['query'][_0x844c('0x48')]('nolimit')){_0x2f1b97[_0x844c('0x28')]=qs[_0x844c('0x28')](_0x426f04[_0x844c('0x42')][_0x844c('0x28')]);_0x2f1b97[_0x844c('0x2a')]=qs[_0x844c('0x2a')](_0x426f04[_0x844c('0x42')][_0x844c('0x2a')]);}_0x2f1b97[_0x844c('0x49')]=qs[_0x844c('0x4a')](_0x426f04[_0x844c('0x42')]['sort']);_0x2f1b97[_0x844c('0x4b')]=qs['filters'](_['pick'](_0x426f04[_0x844c('0x42')],_0x472bf0[_0x844c('0x4c')]),_0x52a0ab);if(_0x426f04['query'][_0x844c('0x4d')]){_0x2f1b97[_0x844c('0x4b')]=_['merge'](_0x2f1b97[_0x844c('0x4b')],{'$or':_['map'](_0x52a0ab,function(_0x2f712d){if(_0x2f712d[_0x844c('0x3f')]!==_0x844c('0x4e')){var _0x48d708={};_0x48d708[_0x2f712d[_0x844c('0x34')]]={'$like':'%'+_0x426f04['query'][_0x844c('0x4d')]+'%'};return _0x48d708;}})});}_0x2f1b97=_[_0x844c('0x36')]({},_0x2f1b97,_0x426f04[_0x844c('0x4f')]);var _0x4cee52={'where':_0x2f1b97[_0x844c('0x4b')]};return db[_0x844c('0x50')]['count'](_0x4cee52)['then'](function(_0x29abcf){_0x5c1409[_0x844c('0x29')]=_0x29abcf;if(_0x426f04[_0x844c('0x42')]['includeAll']){_0x2f1b97[_0x844c('0x51')]=[{'all':!![]}];}return db[_0x844c('0x50')][_0x844c('0x52')](_0x2f1b97);})['then'](function(_0x41a72f){_0x5c1409[_0x844c('0x53')]=_0x41a72f;return _0x5c1409;})['then'](respondWithFilteredResult(_0x3ddcee,_0x2f1b97))['catch'](handleError(_0x3ddcee,null));};exports[_0x844c('0x54')]=function(_0x3e1fc5,_0x481d12){var _0xd03801={'raw':!![],'where':{'id':_0x3e1fc5[_0x844c('0x55')]['id']}},_0x3e93ae={};_0x3e93ae[_0x844c('0x41')]=_['keys'](db[_0x844c('0x50')][_0x844c('0x56')]);_0x3e93ae[_0x844c('0x42')]=_[_0x844c('0x43')](_0x3e1fc5[_0x844c('0x42')]);_0x3e93ae[_0x844c('0x4c')]=_[_0x844c('0x44')](_0x3e93ae['model'],_0x3e93ae[_0x844c('0x42')]);_0xd03801[_0x844c('0x45')]=_['intersection'](_0x3e93ae[_0x844c('0x41')],qs[_0x844c('0x46')](_0x3e1fc5['query']['fields']));_0xd03801['attributes']=_0xd03801[_0x844c('0x45')][_0x844c('0x47')]?_0xd03801['attributes']:_0x3e93ae[_0x844c('0x41')];if(_0x3e1fc5[_0x844c('0x42')][_0x844c('0x57')]){_0xd03801[_0x844c('0x51')]=[{'all':!![]}];}_0xd03801=_[_0x844c('0x36')]({},_0xd03801,_0x3e1fc5['options']);return db[_0x844c('0x50')]['find'](_0xd03801)[_0x844c('0x1c')](handleEntityNotFound(_0x481d12,null))['then'](respondWithResult(_0x481d12,null))['catch'](handleError(_0x481d12,null));};exports[_0x844c('0x58')]=function(_0x406413,_0x3d428b,_0x30d530){var _0x22e1b8;return db[_0x844c('0x59')][_0x844c('0x5a')](function(_0x100123){return db[_0x844c('0x50')]['create'](_0x406413[_0x844c('0x37')],{'raw':!![]})[_0x844c('0x1c')](function(_0x18fdc6){_0x22e1b8=_0x18fdc6;return db[_0x844c('0x50')][_0x844c('0x52')]({'where':{'type':_0x406413[_0x844c('0x37')][_0x844c('0x3f')]},'raw':!![]});})[_0x844c('0x1c')](function(_0x443254){if(_0x22e1b8['type'][_0x844c('0x5b')]()==_0x844c('0x5c')){var _0x3241ee=fs[_0x844c('0x5d')](path['join'](config[_0x844c('0x5e')],_0x844c('0x5f')),'utf8');var _0x1b5778=ejs[_0x844c('0x60')](_0x3241ee,{'networks':_0x443254||[]});fs[_0x844c('0x61')](_0x844c('0x62'),_0x1b5778);return respondWithRpcPromise('Reload','create',{'module':_0x844c('0x63')});}else if(_0x22e1b8['type'][_0x844c('0x5b')]()==_0x844c('0x64')){var _0x53330=fs[_0x844c('0x5d')](path[_0x844c('0x65')](config[_0x844c('0x5e')],'server/files/templates/turn_multiple.ejs'),_0x844c('0x66'));var _0x4a796d=ejs[_0x844c('0x60')](_0x53330,{'networks':_0x443254||[]});fs['writeFileSync'](_0x844c('0x67'),_0x4a796d);return respondWithRpcPromise(_0x844c('0x68'),_0x844c('0x58'),{'module':_0x844c('0x63')});}else{var _0x3c9ad0=fs[_0x844c('0x5d')](path[_0x844c('0x65')](config[_0x844c('0x5e')],'server/files/templates/network.ejs'),_0x844c('0x66'));var _0x2e93f3=ejs[_0x844c('0x60')](_0x3c9ad0,{'networks':_0x443254||[]});fs[_0x844c('0x61')](util[_0x844c('0x69')]('/etc/asterisk/sip_xcally_%s.conf',_0x406413[_0x844c('0x37')][_0x844c('0x3f')][_0x844c('0x6a')]()),_0x2e93f3);return respondWithRpcPromise(_0x844c('0x68'),'create',{'module':_0x844c('0x6b')});}return null;})[_0x844c('0x1c')](function(){return _0x22e1b8;});})[_0x844c('0x1c')](respondWithResult(_0x3d428b,0xc9))['catch'](handleError(_0x3d428b,null));};exports['update']=function(_0x32153d,_0x4982f1,_0x348297){var _0x571752;return db[_0x844c('0x59')]['transaction'](function(_0x52a6a0){return db[_0x844c('0x50')][_0x844c('0x6c')]({'where':{'id':_0x32153d[_0x844c('0x55')]['id']}})[_0x844c('0x1c')](handleEntityNotFound(_0x4982f1,null))[_0x844c('0x1c')](saveUpdates(_0x32153d[_0x844c('0x37')],null))[_0x844c('0x1c')](function(_0x3cf1f6){if(_0x3cf1f6){_0x571752=_0x3cf1f6;return db[_0x844c('0x50')][_0x844c('0x52')]({'where':{'type':_0x571752[_0x844c('0x3f')]},'raw':!![]});}return null;})[_0x844c('0x1c')](function(_0x5dd367){if(_0x571752['type']['toUpperCase']()==_0x844c('0x5c')){var _0x3fd86d=fs[_0x844c('0x5d')](path['join'](config['root'],_0x844c('0x5f')),_0x844c('0x66'));var _0x385db4=ejs[_0x844c('0x60')](_0x3fd86d,{'networks':_0x5dd367||[]});fs['writeFileSync'](_0x844c('0x62'),_0x385db4);return respondWithRpcPromise(_0x844c('0x68'),_0x844c('0x31'),{'module':_0x844c('0x63')});}else if(_0x571752[_0x844c('0x3f')]['toUpperCase']()=='TURN'){var _0x585a8d=fs[_0x844c('0x5d')](path[_0x844c('0x65')](config[_0x844c('0x5e')],_0x844c('0x6d')),_0x844c('0x66'));var _0x9bb26d=ejs['render'](_0x585a8d,{'networks':_0x5dd367||[]});fs[_0x844c('0x61')](_0x844c('0x67'),_0x9bb26d);return respondWithRpcPromise(_0x844c('0x68'),'update',{'module':_0x844c('0x63')});}else{var _0x2ef2f8=fs[_0x844c('0x5d')](path[_0x844c('0x65')](config[_0x844c('0x5e')],'server/files/templates/network.ejs'),'utf8');var _0x433fbd=ejs[_0x844c('0x60')](_0x2ef2f8,{'networks':_0x5dd367||[]});fs[_0x844c('0x61')](util[_0x844c('0x69')](_0x844c('0x6e'),_0x32153d[_0x844c('0x37')][_0x844c('0x3f')][_0x844c('0x6a')]()),_0x433fbd);return respondWithRpcPromise('Reload',_0x844c('0x31'),{'module':_0x844c('0x6b')});}return null;})[_0x844c('0x1c')](function(_0x477cee){if(_0x477cee){return _0x571752;}return null;});})[_0x844c('0x1c')](respondWithResult(_0x4982f1,null))['catch'](handleError(_0x4982f1,null));};exports[_0x844c('0x32')]=function(_0x3521fb,_0x49d4c1,_0x416438){var _0x532862;return db[_0x844c('0x50')][_0x844c('0x6c')]({'where':{'id':_0x3521fb[_0x844c('0x55')]['id']}})[_0x844c('0x1c')](function(_0x2859c2){_0x532862=_0x2859c2;return _0x2859c2;})[_0x844c('0x1c')](handleEntityNotFound(_0x49d4c1,null))[_0x844c('0x1c')](removeEntity(_0x49d4c1,null))[_0x844c('0x1c')](function(){if(_0x532862){return db[_0x844c('0x50')][_0x844c('0x52')]({'where':{'type':_0x532862['type']},'raw':!![]});}})[_0x844c('0x1c')](function(_0x300e93){if(_0x532862['type'][_0x844c('0x5b')]()==_0x844c('0x5c')){var _0x2fafed=fs[_0x844c('0x5d')](path['join'](config[_0x844c('0x5e')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x5bf533=ejs[_0x844c('0x60')](_0x2fafed,{'networks':_0x300e93||[]});fs[_0x844c('0x61')](_0x844c('0x62'),_0x5bf533);return respondWithRpcPromise(_0x844c('0x68'),_0x844c('0x32'),{'module':_0x844c('0x63')});}else if(_0x532862[_0x844c('0x3f')][_0x844c('0x5b')]()==_0x844c('0x64')){var _0x21dfed=fs[_0x844c('0x5d')](path[_0x844c('0x65')](config['root'],_0x844c('0x6d')),_0x844c('0x66'));var _0xbfa28c=ejs['render'](_0x21dfed,{'networks':_0x300e93||[]});fs[_0x844c('0x61')](_0x844c('0x67'),_0xbfa28c);return respondWithRpcPromise('Reload',_0x844c('0x32'),{'module':'res_stun_monitor.so'});}else{var _0x6009aa=fs['readFileSync'](path[_0x844c('0x65')](config[_0x844c('0x5e')],'server/files/templates/network.ejs'),_0x844c('0x66'));var _0x2bb2b5=ejs[_0x844c('0x60')](_0x6009aa,{'networks':_0x300e93||[]});fs[_0x844c('0x61')](util[_0x844c('0x69')]('/etc/asterisk/sip_xcally_%s.conf',_0x3521fb[_0x844c('0x37')][_0x844c('0x3f')]['toLowerCase']()),_0x2bb2b5);return respondWithRpcPromise('Reload','destroy',{'module':_0x844c('0x6b')});}return null;})[_0x844c('0x6f')](handleError(_0x49d4c1,null));}; \ No newline at end of file +var _0xc125=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','name','send','render','merge','contact','interaction','account','index','fieldName','type','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','Network','includeAll','include','findAll','then','rows','rawAttributes','intersection','find','catch','transaction','body','toUpperCase','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','Reload','create','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','update','params','STUN','/etc/asterisk/stun_xcally.conf','format','toLowerCase','destroy','rimraf','fast-json-patch','request-promise'];(function(_0x1a3625,_0x3c9158){var _0x1adcbc=function(_0x59e803){while(--_0x59e803){_0x1a3625['push'](_0x1a3625['shift']());}};_0x1adcbc(++_0x3c9158);}(_0xc125,0x150));var _0x5c12=function(_0x3d85b2,_0x458cc3){_0x3d85b2=_0x3d85b2-0x0;var _0x547afc=_0xc125[_0x3d85b2];return _0x547afc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5c12('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c12('0x1'));var rp=require(_0x5c12('0x2'));var moment=require(_0x5c12('0x3'));var BPromise=require(_0x5c12('0x4'));var Mustache=require(_0x5c12('0x5'));var util=require(_0x5c12('0x6'));var path=require(_0x5c12('0x7'));var sox=require(_0x5c12('0x8'));var csv=require(_0x5c12('0x9'));var ejs=require(_0x5c12('0xa'));var fs=require('fs');var fs_extra=require(_0x5c12('0xb'));var _=require(_0x5c12('0xc'));var squel=require('squel');var crypto=require(_0x5c12('0xd'));var jsforce=require(_0x5c12('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5c12('0x9'));var querystring=require(_0x5c12('0xf'));var Papa=require(_0x5c12('0x10'));var Redis=require(_0x5c12('0x11'));var authService=require(_0x5c12('0x12'));var qs=require(_0x5c12('0x13'));var as=require(_0x5c12('0x14'));var hardwareService=require(_0x5c12('0x15'));var logger=require('../../config/logger')(_0x5c12('0x16'));var utils=require(_0x5c12('0x17'));var config=require(_0x5c12('0x18'));var licenseUtil=require(_0x5c12('0x19'));var db=require(_0x5c12('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x5c12('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5619bc,_0xb800f2,_0x39440d,_0x448667){return new BPromise(function(_0x4a9910,_0x5676a9){var _0x1fac81=_0x448667||client;return _0x1fac81[_0x5c12('0x1c')](_0x5619bc,_0x39440d)['then'](function(_0x460ff1){logger[_0x5c12('0x1d')](_0x5c12('0x1e'),_0xb800f2,'request\x20sent');logger['debug'](_0x5c12('0x1f'),_0xb800f2,_0x5c12('0x20'),JSON[_0x5c12('0x21')](_0x460ff1));if(_0x460ff1[_0x5c12('0x22')]){if(_0x460ff1[_0x5c12('0x22')][_0x5c12('0x23')]===0x1f4){logger[_0x5c12('0x22')](_0x5c12('0x1e'),_0xb800f2,_0x460ff1['error']['message']);return _0x5676a9(_0x460ff1[_0x5c12('0x22')][_0x5c12('0x24')]);}logger[_0x5c12('0x22')](_0x5c12('0x1e'),_0xb800f2,_0x460ff1['error'][_0x5c12('0x24')]);return _0x4a9910(_0x460ff1['error'][_0x5c12('0x24')]);}else{logger[_0x5c12('0x1d')]('Network,\x20%s,\x20%s',_0xb800f2,'request\x20sent');_0x4a9910(_0x460ff1[_0x5c12('0x25')][_0x5c12('0x24')]);}})['catch'](function(_0x275d5c){logger['error'](_0x5c12('0x1e'),_0xb800f2,_0x275d5c);_0x5676a9(_0x275d5c);});});}function respondWithStatusCode(_0x7bc2ff,_0x1d9e30){_0x1d9e30=_0x1d9e30||0xcc;return function(_0x40f6ab){if(_0x40f6ab){return _0x7bc2ff[_0x5c12('0x26')](_0x1d9e30);}return _0x7bc2ff[_0x5c12('0x27')](_0x1d9e30)[_0x5c12('0x28')]();};}function respondWithResult(_0x370726,_0xca0f79){_0xca0f79=_0xca0f79||0xc8;return function(_0x1d6d76){if(_0x1d6d76){return _0x370726[_0x5c12('0x27')](_0xca0f79)[_0x5c12('0x29')](_0x1d6d76);}};}function respondWithFilteredResult(_0x146bce,_0x598c2b){return function(_0x37979e){if(_0x37979e){var _0x37b639=typeof _0x598c2b[_0x5c12('0x2a')]===_0x5c12('0x2b')&&typeof _0x598c2b[_0x5c12('0x2c')]===_0x5c12('0x2b');var _0x54f4b6=_0x37979e[_0x5c12('0x2d')];var _0x3e9bf5=_0x37b639?0x0:_0x598c2b[_0x5c12('0x2a')];var _0x5939a8=_0x37b639?_0x37979e['count']:_0x598c2b[_0x5c12('0x2a')]+_0x598c2b[_0x5c12('0x2c')];var _0x5d71b2;if(_0x5939a8>=_0x54f4b6){_0x5939a8=_0x54f4b6;_0x5d71b2=0xc8;}else{_0x5d71b2=0xce;}_0x146bce[_0x5c12('0x27')](_0x5d71b2);return _0x146bce[_0x5c12('0x2e')](_0x5c12('0x2f'),_0x3e9bf5+'-'+_0x5939a8+'/'+_0x54f4b6)['json'](_0x37979e);}return null;};}function patchUpdates(_0x41bc6a){return function(_0x57c6e1){try{jsonpatch[_0x5c12('0x30')](_0x57c6e1,_0x41bc6a,!![]);}catch(_0x2d3466){return BPromise[_0x5c12('0x31')](_0x2d3466);}return _0x57c6e1[_0x5c12('0x32')]();};}function saveUpdates(_0xd8c22d,_0x38f1c3){return function(_0x2a9fb3){if(_0x2a9fb3){return _0x2a9fb3['update'](_0xd8c22d)['then'](function(_0x2f4a84){return _0x2f4a84;});}return null;};}function removeEntity(_0x45f7f9,_0x3f65d6){return function(_0xe6ecd1){if(_0xe6ecd1){return _0xe6ecd1['destroy']()['then'](function(){_0x45f7f9[_0x5c12('0x27')](0xcc)[_0x5c12('0x28')]();});}};}function handleEntityNotFound(_0x4ed1d1,_0x5c9940){return function(_0x4b1097){if(!_0x4b1097){_0x4ed1d1[_0x5c12('0x26')](0x194);}return _0x4b1097;};}function handleError(_0x46752d,_0x27025c){_0x27025c=_0x27025c||0x1f4;return function(_0x1725ab){logger[_0x5c12('0x22')](_0x1725ab['stack']);if(_0x1725ab[_0x5c12('0x33')]){delete _0x1725ab[_0x5c12('0x33')];}_0x46752d['status'](_0x27025c)[_0x5c12('0x34')](_0x1725ab);};}function getMustacheRender(_0x173755,_0x3c62d4){return Mustache[_0x5c12('0x35')](_0x173755,_[_0x5c12('0x36')](_0x3c62d4['body'],{'contact':_0x3c62d4[_0x5c12('0x37')],'message':_0x3c62d4[_0x5c12('0x24')],'agent':_0x3c62d4['agent'],'interaction':_0x3c62d4[_0x5c12('0x38')],'account':_0x3c62d4[_0x5c12('0x39')]}))||'';}exports[_0x5c12('0x3a')]=function(_0x4e665a,_0x3b70ae){var _0x241fa5={},_0x46704a={},_0x57a18f={'count':0x0,'rows':[]};var _0x23a28e=_['map'](db['Network']['rawAttributes'],function(_0x1b377f){return{'name':_0x1b377f[_0x5c12('0x3b')],'type':_0x1b377f[_0x5c12('0x3c')][_0x5c12('0x3d')]};});_0x46704a[_0x5c12('0x3e')]=_[_0x5c12('0x3f')](_0x23a28e,_0x5c12('0x33'));_0x46704a['query']=_[_0x5c12('0x40')](_0x4e665a[_0x5c12('0x41')]);_0x46704a[_0x5c12('0x42')]=_['intersection'](_0x46704a['model'],_0x46704a['query']);_0x241fa5[_0x5c12('0x43')]=_['intersection'](_0x46704a[_0x5c12('0x3e')],qs[_0x5c12('0x44')](_0x4e665a[_0x5c12('0x41')][_0x5c12('0x44')]));_0x241fa5[_0x5c12('0x43')]=_0x241fa5[_0x5c12('0x43')][_0x5c12('0x45')]?_0x241fa5['attributes']:_0x46704a[_0x5c12('0x3e')];if(!_0x4e665a[_0x5c12('0x41')][_0x5c12('0x46')](_0x5c12('0x47'))){_0x241fa5[_0x5c12('0x2c')]=qs[_0x5c12('0x2c')](_0x4e665a[_0x5c12('0x41')][_0x5c12('0x2c')]);_0x241fa5[_0x5c12('0x2a')]=qs[_0x5c12('0x2a')](_0x4e665a['query']['offset']);}_0x241fa5[_0x5c12('0x48')]=qs[_0x5c12('0x49')](_0x4e665a[_0x5c12('0x41')][_0x5c12('0x49')]);_0x241fa5[_0x5c12('0x4a')]=qs[_0x5c12('0x42')](_[_0x5c12('0x4b')](_0x4e665a[_0x5c12('0x41')],_0x46704a[_0x5c12('0x42')]),_0x23a28e);if(_0x4e665a[_0x5c12('0x41')][_0x5c12('0x4c')]){_0x241fa5[_0x5c12('0x4a')]=_['merge'](_0x241fa5['where'],{'$or':_[_0x5c12('0x3f')](_0x23a28e,function(_0x43b891){if(_0x43b891[_0x5c12('0x3c')]!=='VIRTUAL'){var _0x42dc27={};_0x42dc27[_0x43b891[_0x5c12('0x33')]]={'$like':'%'+_0x4e665a[_0x5c12('0x41')][_0x5c12('0x4c')]+'%'};return _0x42dc27;}})});}_0x241fa5=_[_0x5c12('0x36')]({},_0x241fa5,_0x4e665a[_0x5c12('0x4d')]);var _0x56d7cf={'where':_0x241fa5[_0x5c12('0x4a')]};return db[_0x5c12('0x4e')][_0x5c12('0x2d')](_0x56d7cf)['then'](function(_0x4e01bf){_0x57a18f[_0x5c12('0x2d')]=_0x4e01bf;if(_0x4e665a[_0x5c12('0x41')][_0x5c12('0x4f')]){_0x241fa5[_0x5c12('0x50')]=[{'all':!![]}];}return db[_0x5c12('0x4e')][_0x5c12('0x51')](_0x241fa5);})[_0x5c12('0x52')](function(_0x4c7943){_0x57a18f[_0x5c12('0x53')]=_0x4c7943;return _0x57a18f;})[_0x5c12('0x52')](respondWithFilteredResult(_0x3b70ae,_0x241fa5))['catch'](handleError(_0x3b70ae,null));};exports['show']=function(_0x830602,_0x2895ab){var _0x4544f5={'raw':!![],'where':{'id':_0x830602['params']['id']}},_0x12fb42={};_0x12fb42[_0x5c12('0x3e')]=_['keys'](db['Network'][_0x5c12('0x54')]);_0x12fb42['query']=_[_0x5c12('0x40')](_0x830602[_0x5c12('0x41')]);_0x12fb42[_0x5c12('0x42')]=_['intersection'](_0x12fb42[_0x5c12('0x3e')],_0x12fb42['query']);_0x4544f5[_0x5c12('0x43')]=_[_0x5c12('0x55')](_0x12fb42[_0x5c12('0x3e')],qs[_0x5c12('0x44')](_0x830602[_0x5c12('0x41')][_0x5c12('0x44')]));_0x4544f5[_0x5c12('0x43')]=_0x4544f5[_0x5c12('0x43')][_0x5c12('0x45')]?_0x4544f5['attributes']:_0x12fb42['model'];if(_0x830602[_0x5c12('0x41')]['includeAll']){_0x4544f5[_0x5c12('0x50')]=[{'all':!![]}];}_0x4544f5=_[_0x5c12('0x36')]({},_0x4544f5,_0x830602[_0x5c12('0x4d')]);return db['Network'][_0x5c12('0x56')](_0x4544f5)[_0x5c12('0x52')](handleEntityNotFound(_0x2895ab,null))['then'](respondWithResult(_0x2895ab,null))[_0x5c12('0x57')](handleError(_0x2895ab,null));};exports['create']=function(_0x1d2866,_0x345c13,_0xc82dd3){var _0x3fdc4b;return db['sequelize'][_0x5c12('0x58')](function(_0x4684e0){return db[_0x5c12('0x4e')]['create'](_0x1d2866[_0x5c12('0x59')],{'raw':!![]})[_0x5c12('0x52')](function(_0x39530c){_0x3fdc4b=_0x39530c;return db[_0x5c12('0x4e')]['findAll']({'where':{'type':_0x1d2866[_0x5c12('0x59')][_0x5c12('0x3c')]},'raw':!![]});})[_0x5c12('0x52')](function(_0x1cb85e){if(_0x3fdc4b[_0x5c12('0x3c')][_0x5c12('0x5a')]()=='STUN'){var _0x4dcfa5=fs['readFileSync'](path[_0x5c12('0x5b')](config[_0x5c12('0x5c')],_0x5c12('0x5d')),_0x5c12('0x5e'));var _0x4b82e4=ejs['render'](_0x4dcfa5,{'networks':_0x1cb85e||[]});fs[_0x5c12('0x5f')]('/etc/asterisk/stun_xcally.conf',_0x4b82e4);return respondWithRpcPromise(_0x5c12('0x60'),_0x5c12('0x61'),{'module':_0x5c12('0x62')});}else if(_0x3fdc4b[_0x5c12('0x3c')][_0x5c12('0x5a')]()==_0x5c12('0x63')){var _0x2df293=fs[_0x5c12('0x64')](path[_0x5c12('0x5b')](config['root'],_0x5c12('0x65')),_0x5c12('0x5e'));var _0x3c5d95=ejs[_0x5c12('0x35')](_0x2df293,{'networks':_0x1cb85e||[]});fs['writeFileSync'](_0x5c12('0x66'),_0x3c5d95);return respondWithRpcPromise(_0x5c12('0x60'),_0x5c12('0x61'),{'module':_0x5c12('0x62')});}else{var _0x1efd5d=fs[_0x5c12('0x64')](path[_0x5c12('0x5b')](config['root'],_0x5c12('0x67')),_0x5c12('0x5e'));var _0x1aba6b=ejs[_0x5c12('0x35')](_0x1efd5d,{'networks':_0x1cb85e||[]});fs['writeFileSync'](util['format'](_0x5c12('0x68'),_0x1d2866[_0x5c12('0x59')][_0x5c12('0x3c')]['toLowerCase']()),_0x1aba6b);return respondWithRpcPromise(_0x5c12('0x60'),_0x5c12('0x61'),{'module':_0x5c12('0x69')});}return null;})[_0x5c12('0x52')](function(){return _0x3fdc4b;});})['then'](respondWithResult(_0x345c13,0xc9))[_0x5c12('0x57')](handleError(_0x345c13,null));};exports[_0x5c12('0x6a')]=function(_0x8cb80d,_0x50795e,_0x122fa6){var _0x40c03b;return db['sequelize'][_0x5c12('0x58')](function(_0x5db6d1){return db['Network'][_0x5c12('0x56')]({'where':{'id':_0x8cb80d[_0x5c12('0x6b')]['id']}})[_0x5c12('0x52')](handleEntityNotFound(_0x50795e,null))[_0x5c12('0x52')](saveUpdates(_0x8cb80d[_0x5c12('0x59')],null))['then'](function(_0x19db32){if(_0x19db32){_0x40c03b=_0x19db32;return db[_0x5c12('0x4e')]['findAll']({'where':{'type':_0x40c03b['type']},'raw':!![]});}return null;})[_0x5c12('0x52')](function(_0xba7496){if(_0x40c03b['type']['toUpperCase']()==_0x5c12('0x6c')){var _0x42a07a=fs['readFileSync'](path[_0x5c12('0x5b')](config[_0x5c12('0x5c')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x27ab29=ejs[_0x5c12('0x35')](_0x42a07a,{'networks':_0xba7496||[]});fs[_0x5c12('0x5f')](_0x5c12('0x6d'),_0x27ab29);return respondWithRpcPromise(_0x5c12('0x60'),_0x5c12('0x6a'),{'module':_0x5c12('0x62')});}else if(_0x40c03b[_0x5c12('0x3c')][_0x5c12('0x5a')]()==_0x5c12('0x63')){var _0xc75e2c=fs[_0x5c12('0x64')](path['join'](config['root'],_0x5c12('0x65')),'utf8');var _0x1af167=ejs['render'](_0xc75e2c,{'networks':_0xba7496||[]});fs[_0x5c12('0x5f')](_0x5c12('0x66'),_0x1af167);return respondWithRpcPromise(_0x5c12('0x60'),_0x5c12('0x6a'),{'module':_0x5c12('0x62')});}else{var _0x159586=fs['readFileSync'](path[_0x5c12('0x5b')](config[_0x5c12('0x5c')],_0x5c12('0x67')),_0x5c12('0x5e'));var _0x3824e7=ejs[_0x5c12('0x35')](_0x159586,{'networks':_0xba7496||[]});fs[_0x5c12('0x5f')](util[_0x5c12('0x6e')](_0x5c12('0x68'),_0x8cb80d['body'][_0x5c12('0x3c')][_0x5c12('0x6f')]()),_0x3824e7);return respondWithRpcPromise('Reload',_0x5c12('0x6a'),{'module':_0x5c12('0x69')});}return null;})[_0x5c12('0x52')](function(_0xfc36aa){if(_0xfc36aa){return _0x40c03b;}return null;});})[_0x5c12('0x52')](respondWithResult(_0x50795e,null))[_0x5c12('0x57')](handleError(_0x50795e,null));};exports[_0x5c12('0x70')]=function(_0x1f8706,_0x594052,_0x14a3f2){var _0x2580a4;return db[_0x5c12('0x4e')][_0x5c12('0x56')]({'where':{'id':_0x1f8706[_0x5c12('0x6b')]['id']}})['then'](function(_0x1f86ac){_0x2580a4=_0x1f86ac;return _0x1f86ac;})[_0x5c12('0x52')](handleEntityNotFound(_0x594052,null))[_0x5c12('0x52')](removeEntity(_0x594052,null))[_0x5c12('0x52')](function(){if(_0x2580a4){return db['Network'][_0x5c12('0x51')]({'where':{'type':_0x2580a4[_0x5c12('0x3c')]},'raw':!![]});}})[_0x5c12('0x52')](function(_0x527c0c){if(_0x2580a4['type']['toUpperCase']()=='STUN'){var _0xe561a2=fs[_0x5c12('0x64')](path[_0x5c12('0x5b')](config[_0x5c12('0x5c')],_0x5c12('0x5d')),'utf8');var _0x9ebfe4=ejs[_0x5c12('0x35')](_0xe561a2,{'networks':_0x527c0c||[]});fs['writeFileSync'](_0x5c12('0x6d'),_0x9ebfe4);return respondWithRpcPromise(_0x5c12('0x60'),_0x5c12('0x70'),{'module':_0x5c12('0x62')});}else if(_0x2580a4[_0x5c12('0x3c')][_0x5c12('0x5a')]()=='TURN'){var _0x51ca11=fs[_0x5c12('0x64')](path['join'](config[_0x5c12('0x5c')],_0x5c12('0x65')),'utf8');var _0x1c3c23=ejs[_0x5c12('0x35')](_0x51ca11,{'networks':_0x527c0c||[]});fs[_0x5c12('0x5f')](_0x5c12('0x66'),_0x1c3c23);return respondWithRpcPromise(_0x5c12('0x60'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x463251=fs['readFileSync'](path[_0x5c12('0x5b')](config[_0x5c12('0x5c')],_0x5c12('0x67')),_0x5c12('0x5e'));var _0x497276=ejs[_0x5c12('0x35')](_0x463251,{'networks':_0x527c0c||[]});fs[_0x5c12('0x5f')](util[_0x5c12('0x6e')](_0x5c12('0x68'),_0x1f8706['body']['type'][_0x5c12('0x6f')]()),_0x497276);return respondWithRpcPromise(_0x5c12('0x60'),'destroy',{'module':_0x5c12('0x69')});}return null;})[_0x5c12('0x57')](handleError(_0x594052,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 5dc33fc..2d6007f 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 _0x1172=['request-promise','../../config/environment','exports','define','Network','network','lodash','util','../../config/logger','api','bluebird'];(function(_0x2d16bd,_0x2746d5){var _0xeab5c=function(_0x21261c){while(--_0x21261c){_0x2d16bd['push'](_0x2d16bd['shift']());}};_0xeab5c(++_0x2746d5);}(_0x1172,0xb6));var _0x2117=function(_0x18ffd7,_0x3ab105){_0x18ffd7=_0x18ffd7-0x0;var _0xc8d75d=_0x1172[_0x18ffd7];return _0xc8d75d;};'use strict';var _=require(_0x2117('0x0'));var util=require(_0x2117('0x1'));var logger=require(_0x2117('0x2'))(_0x2117('0x3'));var moment=require('moment');var BPromise=require(_0x2117('0x4'));var rp=require(_0x2117('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2117('0x6'));var attributes=require('./network.attributes');module[_0x2117('0x7')]=function(_0x499bef,_0x8b0768){return _0x499bef[_0x2117('0x8')](_0x2117('0x9'),attributes,{'tableName':_0x2117('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53eb=['../../config/environment','define','Network','network','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1c55f9,_0x3d4689){var _0x59435c=function(_0x5e7ca2){while(--_0x5e7ca2){_0x1c55f9['push'](_0x1c55f9['shift']());}};_0x59435c(++_0x3d4689);}(_0x53eb,0x16c));var _0xb53e=function(_0x24606c,_0x487147){_0x24606c=_0x24606c-0x0;var _0x2c8a20=_0x53eb[_0x24606c];return _0x2c8a20;};'use strict';var _=require(_0xb53e('0x0'));var util=require(_0xb53e('0x1'));var logger=require(_0xb53e('0x2'))(_0xb53e('0x3'));var moment=require(_0xb53e('0x4'));var BPromise=require('bluebird');var rp=require(_0xb53e('0x5'));var fs=require('fs');var path=require(_0xb53e('0x6'));var rimraf=require(_0xb53e('0x7'));var config=require(_0xb53e('0x8'));var attributes=require('./network.attributes');module['exports']=function(_0x5289b4,_0x261bd5){return _0x5289b4[_0xb53e('0x9')](_0xb53e('0xa'),attributes,{'tableName':_0xb53e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 43db2ec..be1e3ba 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 _0x885f=['Network,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x47af64,_0x450043){var _0x20aefb=function(_0x57cc15){while(--_0x57cc15){_0x47af64['push'](_0x47af64['shift']());}};_0x20aefb(++_0x450043);}(_0x885f,0xa5));var _0xf885=function(_0x5dc755,_0x3254d0){_0x5dc755=_0x5dc755-0x0;var _0x24ce81=_0x885f[_0x5dc755];return _0x24ce81;};'use strict';var _=require(_0xf885('0x0'));var util=require(_0xf885('0x1'));var moment=require(_0xf885('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf885('0x3'));var db=require(_0xf885('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf885('0x5'))(_0xf885('0x6'));var config=require(_0xf885('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf885('0x8')][_0xf885('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa04e61,_0x3900ce,_0x590415){return new BPromise(function(_0x3b66a7,_0x59fb6a){return client[_0xf885('0xa')](_0xa04e61,_0x590415)[_0xf885('0xb')](function(_0x25585c){logger['info'](_0xf885('0xc'),_0x3900ce,_0xf885('0xd'));logger[_0xf885('0xe')](_0xf885('0xf'),_0x3900ce,_0xf885('0xd'),JSON['stringify'](_0x25585c));if(_0x25585c['error']){if(_0x25585c[_0xf885('0x10')]['code']===0x1f4){logger[_0xf885('0x10')](_0xf885('0xc'),_0x3900ce,_0x25585c[_0xf885('0x10')][_0xf885('0x11')]);return _0x59fb6a(_0x25585c[_0xf885('0x10')][_0xf885('0x11')]);}logger[_0xf885('0x10')]('Network,\x20%s,\x20%s',_0x3900ce,_0x25585c[_0xf885('0x10')]['message']);return _0x3b66a7(_0x25585c[_0xf885('0x10')][_0xf885('0x11')]);}else{logger['info'](_0xf885('0xc'),_0x3900ce,_0xf885('0xd'));_0x3b66a7(_0x25585c[_0xf885('0x12')][_0xf885('0x11')]);}})[_0xf885('0x13')](function(_0x5cf219){logger[_0xf885('0x10')](_0xf885('0xc'),_0x3900ce,_0x5cf219);_0x59fb6a(_0x5cf219);});});} \ No newline at end of file +var _0x8634=['code','Network,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','stringify','error'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x8634,0x139));var _0x4863=function(_0x30bd66,_0x36a93d){_0x30bd66=_0x30bd66-0x0;var _0x74c9dd=_0x8634[_0x30bd66];return _0x74c9dd;};'use strict';var _=require(_0x4863('0x0'));var util=require(_0x4863('0x1'));var moment=require(_0x4863('0x2'));var BPromise=require(_0x4863('0x3'));var rs=require(_0x4863('0x4'));var fs=require('fs');var Redis=require(_0x4863('0x5'));var db=require(_0x4863('0x6'))['db'];var utils=require(_0x4863('0x7'));var logger=require(_0x4863('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4863('0x9')][_0x4863('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c514d,_0x102270,_0xd848dd){return new BPromise(function(_0x309fb1,_0x561dee){return client[_0x4863('0xb')](_0x2c514d,_0xd848dd)[_0x4863('0xc')](function(_0x1b4a4f){logger[_0x4863('0xd')]('Network,\x20%s,\x20%s',_0x102270,_0x4863('0xe'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x102270,_0x4863('0xe'),JSON[_0x4863('0xf')](_0x1b4a4f));if(_0x1b4a4f[_0x4863('0x10')]){if(_0x1b4a4f[_0x4863('0x10')][_0x4863('0x11')]===0x1f4){logger[_0x4863('0x10')](_0x4863('0x12'),_0x102270,_0x1b4a4f[_0x4863('0x10')][_0x4863('0x13')]);return _0x561dee(_0x1b4a4f[_0x4863('0x10')][_0x4863('0x13')]);}logger[_0x4863('0x10')](_0x4863('0x12'),_0x102270,_0x1b4a4f[_0x4863('0x10')][_0x4863('0x13')]);return _0x309fb1(_0x1b4a4f[_0x4863('0x10')][_0x4863('0x13')]);}else{logger['info'](_0x4863('0x12'),_0x102270,'request\x20sent');_0x309fb1(_0x1b4a4f[_0x4863('0x14')][_0x4863('0x13')]);}})[_0x4863('0x15')](function(_0x39ca21){logger[_0x4863('0x10')](_0x4863('0x12'),_0x102270,_0x39ca21);_0x561dee(_0x39ca21);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index c866fd7..4faffdc 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 _0x814b=['/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','notify','addAgents','/:id/send','send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications'];(function(_0x39867d,_0x5bca25){var _0x2d6d99=function(_0x51c868){while(--_0x51c868){_0x39867d['push'](_0x39867d['shift']());}};_0x2d6d99(++_0x5bca25);}(_0x814b,0x1a2));var _0xb814=function(_0x4734d8,_0x479950){_0x4734d8=_0x4734d8-0x0;var _0x3b1120=_0x814b[_0x4734d8];return _0x3b1120;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1a')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1c')]);router[_0xb814('0x1a')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller['addAnswer']);router[_0xb814('0x1a')]('/:id/notify',controller[_0xb814('0x1d')]);router[_0xb814('0x1a')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);router[_0xb814('0x1a')](_0xb814('0x1f'),auth['isAuthenticated'](),controller[_0xb814('0x20')]);router['put'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x21')]);router[_0xb814('0x22')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x23')]);router['delete'](_0xb814('0x10'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router[_0xb814('0x22')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x22')](_0xb814('0x18'),auth['isAuthenticated'](),controller[_0xb814('0x26')]);module[_0xb814('0x27')]=router; \ No newline at end of file +var _0x4975=['getInteractions','/:id/users','getAgents','post','addDisposition','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','delete','destroy','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','/:id/interactions'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x4975,0x86));var _0x5497=function(_0x52bc8e,_0x372b88){_0x52bc8e=_0x52bc8e-0x0;var _0x2af402=_0x4975[_0x52bc8e];return _0x2af402;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0xa')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0xa')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller['getAnswers']);router['get']('/:id/applications',auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router[_0x5497('0xa')](_0x5497('0x15'),auth[_0x5497('0xd')](),controller[_0x5497('0x16')]);router[_0x5497('0xa')](_0x5497('0x17'),auth[_0x5497('0xd')](),controller[_0x5497('0x18')]);router['post']('/',auth[_0x5497('0xd')](),controller['create']);router[_0x5497('0x19')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x1a')]);router[_0x5497('0x19')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller['addAnswer']);router['post'](_0x5497('0x1b'),controller[_0x5497('0x1c')]);router[_0x5497('0x19')]('/:id/applications',auth[_0x5497('0xd')](),controller[_0x5497('0x1d')]);router[_0x5497('0x19')](_0x5497('0x17'),auth[_0x5497('0xd')](),controller[_0x5497('0x1e')]);router[_0x5497('0x19')](_0x5497('0x1f'),auth[_0x5497('0xd')](),controller[_0x5497('0x20')]);router[_0x5497('0x21')]('/:id',auth[_0x5497('0xd')](),controller['update']);router[_0x5497('0x22')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x23')]);router[_0x5497('0x22')](_0x5497('0x11'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x5497('0x22')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller[_0x5497('0x24')]);router['delete'](_0x5497('0x17'),auth['isAuthenticated'](),controller[_0x5497('0x25')]);module[_0x5497('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index a656d45..813bce4 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 _0x82ad=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x5f34ac,_0x2f8e19){var _0x11a619=function(_0x4469d6){while(--_0x4469d6){_0x5f34ac['push'](_0x5f34ac['shift']());}};_0x11a619(++_0x2f8e19);}(_0x82ad,0xd5));var _0xd82a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x82ad[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd82a('0x0'));var rs=require(_0xd82a('0x1'));module[_0xd82a('0x2')]={'name':{'type':Sequelize[_0xd82a('0x3')],'unique':_0xd82a('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xd82a('0x3')]},'token':{'type':Sequelize[_0xd82a('0x3')],'defaultValue':function(){return rs[_0xd82a('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xd82a('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd82a('0x6')],'defaultValue':function(){return _0xd82a('0x7');}},'notificationSound':{'type':Sequelize[_0xd82a('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd82a('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd82a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xd82a('0x3')]},'queueTransfer':{'type':Sequelize[_0xd82a('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd82a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd82a('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd82a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xd82a('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5f1275){if(!_0x5f1275)this[_0xd82a('0xb')](_0xd82a('0xc'),null);this[_0xd82a('0xb')](_0xd82a('0xd'),_0x5f1275);}}}; \ No newline at end of file +var _0x1f97=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x5ee5a2,_0x3797ac){var _0xfad5d3=function(_0x35e75c){while(--_0x35e75c){_0x5ee5a2['push'](_0x5ee5a2['shift']());}};_0xfad5d3(++_0x3797ac);}(_0x1f97,0xb5));var _0x71f9=function(_0x3a2bfc,_0x27bc6b){_0x3a2bfc=_0x3a2bfc-0x0;var _0x3ba11b=_0x1f97[_0x3a2bfc];return _0x3ba11b;};'use strict';var Sequelize=require(_0x71f9('0x0'));var rs=require(_0x71f9('0x1'));module['exports']={'name':{'type':Sequelize[_0x71f9('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x71f9('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x71f9('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x71f9('0x3')],'defaultValue':function(){return _0x71f9('0x4');}},'notificationSound':{'type':Sequelize[_0x71f9('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x71f9('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x71f9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x71f9('0x2')]},'queueTransfer':{'type':Sequelize[_0x71f9('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x71f9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x71f9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x71f9('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x71f9('0x5')],'defaultValue':![],'comment':_0x71f9('0x7'),'set':function(_0x3d793d){if(!_0x3d793d)this[_0x71f9('0x8')](_0x71f9('0x9'),null);this[_0x71f9('0x8')](_0x71f9('0xa'),_0x3d793d);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 1626cdb..6bd7d4b 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 _0x028d=['fullname','internal','Tag','Tags','tag','addAgents','emit','userOpenchannelAccount:save','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','set','apply','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','merge','contact','agent','interaction','account','Pause','mandatoryDispositionPause','map','fieldName','type','query','keys','filters','intersection','model','fields','attributes','nolimit','sort','where','filter','VIRTUAL','options','OpenchannelAccount','count','include','rows','show','params','rawAttributes','length','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','order','pick','removeDispositions','ids','CannedAnswer','hasOwnProperty','findAll','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','OpenchannelApplication','Applications','applications','List','priority','ListId','firstName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','lastName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','sequelize','bulkCreate','getApplications','Contact','Owner'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x028d,0x176));var _0xd028=function(_0x387542,_0x4c7d01){_0x387542=_0x387542-0x0;var _0x2fec80=_0x028d[_0x387542];return _0x2fec80;};'use strict';var emlformat=require(_0xd028('0x0'));var rimraf=require(_0xd028('0x1'));var zipdir=require(_0xd028('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd028('0x3'));var Mustache=require(_0xd028('0x4'));var util=require('util');var path=require(_0xd028('0x5'));var sox=require('sox');var csv=require(_0xd028('0x6'));var ejs=require(_0xd028('0x7'));var fs=require('fs');var fs_extra=require(_0xd028('0x8'));var _=require('lodash');var squel=require(_0xd028('0x9'));var crypto=require('crypto');var jsforce=require(_0xd028('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd028('0xb'));var Papa=require(_0xd028('0xc'));var Redis=require(_0xd028('0xd'));var authService=require(_0xd028('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd028('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd028('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xd028('0x11'));var licenseUtil=require(_0xd028('0x12'));var db=require('../../mysqldb')['db'];config[_0xd028('0x13')]=_[_0xd028('0x14')](config[_0xd028('0x13')],{'host':_0xd028('0x15'),'port':0x18eb});var socket=require(_0xd028('0x16'))(new Redis(config[_0xd028('0x13')]));require(_0xd028('0x17'))[_0xd028('0x18')](socket);var jayson=require(_0xd028('0x19'));var client=jayson[_0xd028('0x1a')][_0xd028('0x1b')]({'port':0x232c});var client9002=jayson[_0xd028('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1297b5,_0x36dd9b,_0xfe6057,_0x5a7f1e){return new BPromise(function(_0x366ceb,_0x31a52e){var _0x1d36c5=_0x5a7f1e||client;return _0x1d36c5[_0xd028('0x1c')](_0x1297b5,_0xfe6057)[_0xd028('0x1d')](function(_0x1e0f9a){logger[_0xd028('0x1e')](_0xd028('0x1f'),_0x36dd9b,_0xd028('0x20'));logger[_0xd028('0x21')](_0xd028('0x22'),_0x36dd9b,_0xd028('0x20'),JSON[_0xd028('0x23')](_0x1e0f9a));if(_0x1e0f9a['error']){if(_0x1e0f9a['error'][_0xd028('0x24')]===0x1f4){logger[_0xd028('0x25')](_0xd028('0x1f'),_0x36dd9b,_0x1e0f9a[_0xd028('0x25')][_0xd028('0x26')]);return _0x31a52e(_0x1e0f9a[_0xd028('0x25')][_0xd028('0x26')]);}logger[_0xd028('0x25')](_0xd028('0x1f'),_0x36dd9b,_0x1e0f9a['error'][_0xd028('0x26')]);return _0x366ceb(_0x1e0f9a['error']['message']);}else{logger['info'](_0xd028('0x1f'),_0x36dd9b,_0xd028('0x20'));_0x366ceb(_0x1e0f9a[_0xd028('0x27')]['message']);}})[_0xd028('0x28')](function(_0x55cda4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x36dd9b,_0x55cda4);_0x31a52e(_0x55cda4);});});}function respondWithStatusCode(_0x2159c9,_0x3bb92c){_0x3bb92c=_0x3bb92c||0xcc;return function(_0x16aa53){if(_0x16aa53){return _0x2159c9[_0xd028('0x29')](_0x3bb92c);}return _0x2159c9['status'](_0x3bb92c)[_0xd028('0x2a')]();};}function respondWithResult(_0x277f0c,_0x1a4058){_0x1a4058=_0x1a4058||0xc8;return function(_0x950ab3){if(_0x950ab3){return _0x277f0c[_0xd028('0x2b')](_0x1a4058)[_0xd028('0x2c')](_0x950ab3);}};}function respondWithFilteredResult(_0x393860,_0x5a36d0){return function(_0x45d68c){if(_0x45d68c){var _0x44c81c=typeof _0x5a36d0[_0xd028('0x2d')]===_0xd028('0x2e')&&typeof _0x5a36d0['limit']===_0xd028('0x2e');var _0x31e58a=_0x45d68c['count'];var _0x5d630b=_0x44c81c?0x0:_0x5a36d0[_0xd028('0x2d')];var _0x2d0d66=_0x44c81c?_0x45d68c['count']:_0x5a36d0[_0xd028('0x2d')]+_0x5a36d0[_0xd028('0x2f')];var _0x96269b;if(_0x2d0d66>=_0x31e58a){_0x2d0d66=_0x31e58a;_0x96269b=0xc8;}else{_0x96269b=0xce;}_0x393860['status'](_0x96269b);return _0x393860[_0xd028('0x30')]('Content-Range',_0x5d630b+'-'+_0x2d0d66+'/'+_0x31e58a)[_0xd028('0x2c')](_0x45d68c);}return null;};}function patchUpdates(_0x573a47){return function(_0x120fec){try{jsonpatch[_0xd028('0x31')](_0x120fec,_0x573a47,!![]);}catch(_0x59eee5){return BPromise[_0xd028('0x32')](_0x59eee5);}return _0x120fec['save']();};}function saveUpdates(_0x4052c3,_0x377dfb){return function(_0x97aea6){if(_0x97aea6){return _0x97aea6[_0xd028('0x33')](_0x4052c3)[_0xd028('0x1d')](function(_0x96bed){return _0x96bed;});}return null;};}function removeEntity(_0x1710d3,_0x4e4411){return function(_0x25291c){if(_0x25291c){return _0x25291c[_0xd028('0x34')]()[_0xd028('0x1d')](function(){var _0x1829dd=_0x25291c[_0xd028('0x35')]({'plain':!![]});var _0x3d8e36=_0xd028('0x36');return db[_0xd028('0x37')][_0xd028('0x34')]({'where':{'type':_0x3d8e36,'resourceId':_0x1829dd['id']}})[_0xd028('0x1d')](function(){return _0x25291c;});})[_0xd028('0x1d')](function(){_0x1710d3['status'](0xcc)[_0xd028('0x2a')]();});}};}function handleEntityNotFound(_0xda946e,_0x16ea69){return function(_0x183032){if(!_0x183032){_0xda946e[_0xd028('0x29')](0x194);}return _0x183032;};}function handleError(_0x53aa1b,_0x1f9f04){_0x1f9f04=_0x1f9f04||0x1f4;return function(_0x5cd61d){logger[_0xd028('0x25')](_0x5cd61d['stack']);if(_0x5cd61d[_0xd028('0x38')]){delete _0x5cd61d['name'];}_0x53aa1b[_0xd028('0x2b')](_0x1f9f04)[_0xd028('0x39')](_0x5cd61d);};}function getMustacheRender(_0x96b07f,_0x512acb){return Mustache['render'](_0x96b07f,_[_0xd028('0x3a')](_0x512acb['body'],{'contact':_0x512acb[_0xd028('0x3b')],'message':_0x512acb[_0xd028('0x26')],'agent':_0x512acb[_0xd028('0x3c')],'interaction':_0x512acb[_0xd028('0x3d')],'account':_0x512acb[_0xd028('0x3e')]}))||'';}exports['index']=function(_0x34ebf9,_0x6c559b){var _0x598bf8={'include':[{'model':db[_0xd028('0x3f')],'as':_0xd028('0x40')}]},_0x4ab765={},_0x266463={'count':0x0,'rows':[]};var _0x269982=_[_0xd028('0x41')](db['OpenchannelAccount']['rawAttributes'],function(_0x476b52){return{'name':_0x476b52[_0xd028('0x42')],'type':_0x476b52[_0xd028('0x43')]['key']};});_0x4ab765['model']=_[_0xd028('0x41')](_0x269982,_0xd028('0x38'));_0x4ab765[_0xd028('0x44')]=_[_0xd028('0x45')](_0x34ebf9[_0xd028('0x44')]);_0x4ab765[_0xd028('0x46')]=_[_0xd028('0x47')](_0x4ab765[_0xd028('0x48')],_0x4ab765['query']);_0x598bf8['attributes']=_[_0xd028('0x47')](_0x4ab765[_0xd028('0x48')],qs[_0xd028('0x49')](_0x34ebf9[_0xd028('0x44')][_0xd028('0x49')]));_0x598bf8[_0xd028('0x4a')]=_0x598bf8[_0xd028('0x4a')]['length']?_0x598bf8[_0xd028('0x4a')]:_0x4ab765[_0xd028('0x48')];if(!_0x34ebf9[_0xd028('0x44')]['hasOwnProperty'](_0xd028('0x4b'))){_0x598bf8[_0xd028('0x2f')]=qs[_0xd028('0x2f')](_0x34ebf9[_0xd028('0x44')]['limit']);_0x598bf8[_0xd028('0x2d')]=qs['offset'](_0x34ebf9['query']['offset']);}_0x598bf8['order']=qs[_0xd028('0x4c')](_0x34ebf9['query'][_0xd028('0x4c')]);_0x598bf8[_0xd028('0x4d')]=qs[_0xd028('0x46')](_['pick'](_0x34ebf9[_0xd028('0x44')],_0x4ab765['filters']),_0x269982);if(_0x34ebf9['query'][_0xd028('0x4e')]){_0x598bf8[_0xd028('0x4d')]=_['merge'](_0x598bf8['where'],{'$or':_[_0xd028('0x41')](_0x269982,function(_0x351f2c){if(_0x351f2c[_0xd028('0x43')]!==_0xd028('0x4f')){var _0x40e8a={};_0x40e8a[_0x351f2c[_0xd028('0x38')]]={'$like':'%'+_0x34ebf9[_0xd028('0x44')][_0xd028('0x4e')]+'%'};return _0x40e8a;}})});}_0x598bf8=_[_0xd028('0x3a')]({},_0x598bf8,_0x34ebf9[_0xd028('0x50')]);var _0x177b99={'where':_0x598bf8[_0xd028('0x4d')]};return db[_0xd028('0x51')][_0xd028('0x52')](_0x177b99)[_0xd028('0x1d')](function(_0x3eafa5){_0x266463[_0xd028('0x52')]=_0x3eafa5;if(_0x34ebf9[_0xd028('0x44')]['includeAll']){_0x598bf8[_0xd028('0x53')]=[{'all':!![]}];}return db[_0xd028('0x51')]['findAll'](_0x598bf8);})[_0xd028('0x1d')](function(_0x2e4e78){_0x266463[_0xd028('0x54')]=_0x2e4e78;return _0x266463;})[_0xd028('0x1d')](respondWithFilteredResult(_0x6c559b,_0x598bf8))[_0xd028('0x28')](handleError(_0x6c559b,null));};exports[_0xd028('0x55')]=function(_0x4ece41,_0x33d7f1){var _0x30682a={'raw':![],'where':{'id':_0x4ece41[_0xd028('0x56')]['id']},'include':[{'model':db[_0xd028('0x3f')],'as':_0xd028('0x40')}]},_0x4c2506={};_0x4c2506['model']=_[_0xd028('0x45')](db[_0xd028('0x51')][_0xd028('0x57')]);_0x4c2506[_0xd028('0x44')]=_[_0xd028('0x45')](_0x4ece41[_0xd028('0x44')]);_0x4c2506[_0xd028('0x46')]=_[_0xd028('0x47')](_0x4c2506[_0xd028('0x48')],_0x4c2506[_0xd028('0x44')]);_0x30682a['attributes']=_[_0xd028('0x47')](_0x4c2506[_0xd028('0x48')],qs[_0xd028('0x49')](_0x4ece41[_0xd028('0x44')][_0xd028('0x49')]));_0x30682a['attributes']=_0x30682a['attributes'][_0xd028('0x58')]?_0x30682a[_0xd028('0x4a')]:_0x4c2506[_0xd028('0x48')];if(_0x4ece41[_0xd028('0x44')][_0xd028('0x59')]){_0x30682a[_0xd028('0x53')]=[{'all':!![]}];}_0x30682a=_['merge']({},_0x30682a,_0x4ece41[_0xd028('0x50')]);return db[_0xd028('0x51')]['find'](_0x30682a)[_0xd028('0x1d')](handleEntityNotFound(_0x33d7f1,null))['then'](respondWithResult(_0x33d7f1,null))[_0xd028('0x28')](handleError(_0x33d7f1,null));};exports[_0xd028('0x5a')]=function(_0x10dc49,_0x2fdf81){return db['OpenchannelAccount'][_0xd028('0x5a')](_0x10dc49['body'],{})[_0xd028('0x1d')](function(_0x2c87da){var _0x284f7f=_0x10dc49['user'][_0xd028('0x35')]({'plain':!![]});if(!_0x284f7f)throw new Error(_0xd028('0x5b'));if(_0x284f7f[_0xd028('0x5c')]===_0xd028('0x5d')){var _0x3bf1d7=_0x2c87da['get']({'plain':!![]});var _0x37c54b=_0xd028('0x36');return db[_0xd028('0x5e')][_0xd028('0x5f')]({'where':{'name':_0x37c54b,'userProfileId':_0x284f7f[_0xd028('0x60')]},'raw':!![]})[_0xd028('0x1d')](function(_0x29c4b5){if(_0x29c4b5&&_0x29c4b5['autoAssociation']===0x0){return db[_0xd028('0x37')]['create']({'name':_0x3bf1d7[_0xd028('0x38')],'resourceId':_0x3bf1d7['id'],'type':_0x29c4b5[_0xd028('0x38')],'sectionId':_0x29c4b5['id']},{})[_0xd028('0x1d')](function(){return _0x2c87da;});}else{return _0x2c87da;}})[_0xd028('0x28')](function(_0x595089){logger['error'](_0xd028('0x61'),_0x595089);throw _0x595089;});}return _0x2c87da;})[_0xd028('0x1d')](respondWithResult(_0x2fdf81,0xc9))[_0xd028('0x28')](handleError(_0x2fdf81,null));};exports[_0xd028('0x33')]=function(_0x4c0c74,_0x2e8855){if(_0x4c0c74[_0xd028('0x62')]['id']){delete _0x4c0c74[_0xd028('0x62')]['id'];}return db[_0xd028('0x51')][_0xd028('0x5f')]({'where':{'id':_0x4c0c74[_0xd028('0x56')]['id']},'include':[{'model':db[_0xd028('0x3f')],'as':_0xd028('0x40')}]})[_0xd028('0x1d')](handleEntityNotFound(_0x2e8855,null))['then'](saveUpdates(_0x4c0c74[_0xd028('0x62')],null))['then'](respondWithResult(_0x2e8855,null))[_0xd028('0x28')](handleError(_0x2e8855,null));};exports[_0xd028('0x34')]=function(_0x439ca0,_0x581cc2){return db[_0xd028('0x51')][_0xd028('0x5f')]({'where':{'id':_0x439ca0[_0xd028('0x56')]['id']}})['then'](handleEntityNotFound(_0x581cc2,null))[_0xd028('0x1d')](removeEntity(_0x581cc2,null))[_0xd028('0x28')](handleError(_0x581cc2,null));};exports[_0xd028('0x63')]=function(_0x1a9085,_0x2192a5){return db[_0xd028('0x51')]['describe']()[_0xd028('0x1d')](respondWithResult(_0x2192a5,null))[_0xd028('0x28')](handleError(_0x2192a5,null));};exports[_0xd028('0x64')]=function(_0x1a3910,_0x201509,_0x2f8c44){if(_0x1a3910['body']['id']){delete _0x1a3910['body']['id'];}return db['OpenchannelAccount'][_0xd028('0x5f')]({'where':{'id':_0x1a3910['params']['id']}})[_0xd028('0x1d')](handleEntityNotFound(_0x201509,null))[_0xd028('0x1d')](function(_0x47a45b){if(_0x47a45b){_0x1a3910['body'][_0xd028('0x65')]=_0x47a45b['id'];return db['Disposition'][_0xd028('0x5a')](_0x1a3910[_0xd028('0x62')]);}})['then'](respondWithResult(_0x201509,null))[_0xd028('0x28')](handleError(_0x201509,null));};exports[_0xd028('0x66')]=function(_0x329622,_0x3f5dd0,_0xe1e12d){var _0x3c50a5={'raw':![],'where':{}};var _0x521b34={};var _0x434621={'count':0x0,'rows':[]};return db[_0xd028('0x51')][_0xd028('0x67')]({'where':{'id':_0x329622[_0xd028('0x56')]['id']}})[_0xd028('0x1d')](handleEntityNotFound(_0x3f5dd0,null))[_0xd028('0x1d')](function(_0x5edfab){if(_0x5edfab){_0x521b34[_0xd028('0x48')]=_[_0xd028('0x45')](db[_0xd028('0x68')]['rawAttributes']);_0x521b34['query']=_['keys'](_0x329622[_0xd028('0x44')]);_0x521b34[_0xd028('0x46')]=_[_0xd028('0x47')](_0x521b34[_0xd028('0x48')],_0x521b34[_0xd028('0x44')]);_0x3c50a5[_0xd028('0x4a')]=_[_0xd028('0x47')](_0x521b34['model'],qs['fields'](_0x329622[_0xd028('0x44')][_0xd028('0x49')]));_0x3c50a5[_0xd028('0x4a')]=_0x3c50a5['attributes'][_0xd028('0x58')]?_0x3c50a5[_0xd028('0x4a')]:_0x521b34[_0xd028('0x48')];if(!_0x329622[_0xd028('0x44')]['hasOwnProperty'](_0xd028('0x4b'))){_0x3c50a5[_0xd028('0x2f')]=qs['limit'](_0x329622['query'][_0xd028('0x2f')]);_0x3c50a5['offset']=qs['offset'](_0x329622[_0xd028('0x44')][_0xd028('0x2d')]);}_0x3c50a5[_0xd028('0x69')]=qs[_0xd028('0x4c')](_0x329622[_0xd028('0x44')][_0xd028('0x4c')]);_0x3c50a5[_0xd028('0x4d')]=qs[_0xd028('0x46')](_[_0xd028('0x6a')](_0x329622[_0xd028('0x44')],_0x521b34[_0xd028('0x46')]));_0x3c50a5[_0xd028('0x4d')][_0xd028('0x65')]=_0x5edfab['id'];if(_0x329622[_0xd028('0x44')]['filter']){_0x3c50a5[_0xd028('0x4d')]=_[_0xd028('0x3a')](_0x3c50a5['where'],{'$or':_[_0xd028('0x41')](_0x3c50a5[_0xd028('0x4a')],function(_0x22a93b){var _0x1c4f5b={};_0x1c4f5b[_0x22a93b]={'$like':'%'+_0x329622[_0xd028('0x44')][_0xd028('0x4e')]+'%'};return _0x1c4f5b;})});}_0x3c50a5=_['merge']({},_0x3c50a5,_0x329622[_0xd028('0x50')]);return db[_0xd028('0x68')][_0xd028('0x52')]({'where':_0x3c50a5[_0xd028('0x4d')]})[_0xd028('0x1d')](function(_0x36f53f){_0x434621[_0xd028('0x52')]=_0x36f53f;if(_0x329622[_0xd028('0x44')][_0xd028('0x59')]){_0x3c50a5[_0xd028('0x53')]=[{'all':!![]}];}return db[_0xd028('0x68')]['findAll'](_0x3c50a5);})[_0xd028('0x1d')](function(_0x116951){_0x434621['rows']=_0x116951;return _0x434621;});}})['then'](respondWithFilteredResult(_0x3f5dd0,_0x3c50a5))[_0xd028('0x28')](handleError(_0x3f5dd0,null));};exports[_0xd028('0x6b')]=function(_0x5a82c4,_0x17239f,_0x1990e6){return db[_0xd028('0x51')][_0xd028('0x5f')]({'where':{'id':_0x5a82c4[_0xd028('0x56')]['id']}})[_0xd028('0x1d')](handleEntityNotFound(_0x17239f,null))[_0xd028('0x1d')](function(_0x230397){if(_0x230397){return _0x230397['removeDispositions'](_0x5a82c4[_0xd028('0x44')][_0xd028('0x6c')]);}})[_0xd028('0x1d')](respondWithStatusCode(_0x17239f,null))['catch'](handleError(_0x17239f,null));};exports['addAnswer']=function(_0x39b60a,_0x507558,_0x31c218){if(_0x39b60a[_0xd028('0x62')]['id']){delete _0x39b60a[_0xd028('0x62')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x39b60a[_0xd028('0x56')]['id']}})[_0xd028('0x1d')](handleEntityNotFound(_0x507558,null))['then'](function(_0x143d88){if(_0x143d88){_0x39b60a[_0xd028('0x62')]['OpenchannelAccountId']=_0x143d88['id'];return db[_0xd028('0x6d')][_0xd028('0x5a')](_0x39b60a[_0xd028('0x62')]);}})[_0xd028('0x1d')](respondWithResult(_0x507558,null))[_0xd028('0x28')](handleError(_0x507558,null));};exports['getAnswers']=function(_0x1217cb,_0x525f25,_0x498cec){var _0x5aa586={'raw':![],'where':{}};var _0x15f6a4={};var _0xbd576c={'count':0x0,'rows':[]};return db[_0xd028('0x51')][_0xd028('0x67')]({'where':{'id':_0x1217cb[_0xd028('0x56')]['id']}})[_0xd028('0x1d')](handleEntityNotFound(_0x525f25,null))[_0xd028('0x1d')](function(_0x4cef83){if(_0x4cef83){_0x15f6a4['model']=_['keys'](db[_0xd028('0x6d')][_0xd028('0x57')]);_0x15f6a4[_0xd028('0x44')]=_[_0xd028('0x45')](_0x1217cb[_0xd028('0x44')]);_0x15f6a4[_0xd028('0x46')]=_['intersection'](_0x15f6a4['model'],_0x15f6a4['query']);_0x5aa586[_0xd028('0x4a')]=_['intersection'](_0x15f6a4[_0xd028('0x48')],qs[_0xd028('0x49')](_0x1217cb[_0xd028('0x44')][_0xd028('0x49')]));_0x5aa586[_0xd028('0x4a')]=_0x5aa586[_0xd028('0x4a')][_0xd028('0x58')]?_0x5aa586[_0xd028('0x4a')]:_0x15f6a4[_0xd028('0x48')];if(!_0x1217cb['query'][_0xd028('0x6e')](_0xd028('0x4b'))){_0x5aa586[_0xd028('0x2f')]=qs[_0xd028('0x2f')](_0x1217cb['query'][_0xd028('0x2f')]);_0x5aa586['offset']=qs[_0xd028('0x2d')](_0x1217cb[_0xd028('0x44')][_0xd028('0x2d')]);}_0x5aa586[_0xd028('0x69')]=qs[_0xd028('0x4c')](_0x1217cb[_0xd028('0x44')]['sort']);_0x5aa586['where']=qs[_0xd028('0x46')](_[_0xd028('0x6a')](_0x1217cb[_0xd028('0x44')],_0x15f6a4['filters']));_0x5aa586[_0xd028('0x4d')][_0xd028('0x65')]=_0x4cef83['id'];if(_0x1217cb[_0xd028('0x44')][_0xd028('0x4e')]){_0x5aa586[_0xd028('0x4d')]=_['merge'](_0x5aa586['where'],{'$or':_[_0xd028('0x41')](_0x5aa586['attributes'],function(_0x39ff9b){var _0x5c2878={};_0x5c2878[_0x39ff9b]={'$like':'%'+_0x1217cb[_0xd028('0x44')][_0xd028('0x4e')]+'%'};return _0x5c2878;})});}_0x5aa586=_[_0xd028('0x3a')]({},_0x5aa586,_0x1217cb[_0xd028('0x50')]);return db['CannedAnswer'][_0xd028('0x52')]({'where':_0x5aa586[_0xd028('0x4d')]})[_0xd028('0x1d')](function(_0x5c6dca){_0xbd576c['count']=_0x5c6dca;if(_0x1217cb[_0xd028('0x44')]['includeAll']){_0x5aa586[_0xd028('0x53')]=[{'all':!![]}];}return db[_0xd028('0x6d')][_0xd028('0x6f')](_0x5aa586);})['then'](function(_0x789271){_0xbd576c[_0xd028('0x54')]=_0x789271;return _0xbd576c;});}})[_0xd028('0x1d')](respondWithFilteredResult(_0x525f25,_0x5aa586))[_0xd028('0x28')](handleError(_0x525f25,null));};exports[_0xd028('0x70')]=function(_0x138858,_0x524e7e,_0x179752){return db[_0xd028('0x51')][_0xd028('0x5f')]({'where':{'id':_0x138858['params']['id']}})[_0xd028('0x1d')](handleEntityNotFound(_0x524e7e,null))[_0xd028('0x1d')](function(_0x2dc914){if(_0x2dc914){return _0x2dc914[_0xd028('0x70')](_0x138858[_0xd028('0x44')]['ids']);}})[_0xd028('0x1d')](respondWithStatusCode(_0x524e7e,null))[_0xd028('0x28')](handleError(_0x524e7e,null));};exports[_0xd028('0x71')]=function(_0x454f10,_0x3ea158,_0x825595){var _0x4513e2={'body':_0x454f10['body'],'channel':_0xd028('0x72')};var _0x384739=[];var _0x1aa9da=[];var _0x707bcf={};var _0x5f430a=![];return db[_0xd028('0x73')][_0xd028('0x63')]()[_0xd028('0x1d')](function(_0x553b68){if(!_0x553b68){throw new db[(_0xd028('0x74'))][(_0xd028('0x75'))](_0xd028('0x76'));}_0x384739=_['difference'](_[_0xd028('0x45')](_0x553b68),[_0xd028('0x77'),_0xd028('0x78')]);_0x1aa9da=_['difference'](_['keys'](_0x553b68),[_0xd028('0x77'),'updatedAt',_0xd028('0x79'),'ListId']);if(_0x454f10['body']['id']){delete _0x454f10[_0xd028('0x62')]['id'];}if(_['isNil'](_0x454f10[_0xd028('0x62')][_0xd028('0x7a')])){throw new db[(_0xd028('0x74'))][(_0xd028('0x75'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x454f10['body']['body'])||_0x454f10[_0xd028('0x62')]['body']===''){throw new db[(_0xd028('0x74'))]['ValidationError'](_0xd028('0x7b'));}if(_[_0xd028('0x7c')](_0x454f10['body'][_0xd028('0x7d')])){throw new db[(_0xd028('0x74'))][(_0xd028('0x75'))](_0xd028('0x7e')+_0x1aa9da);}if(!_[_0xd028('0x7f')](_0x1aa9da,_0x454f10[_0xd028('0x62')][_0xd028('0x7d')])){throw new db[(_0xd028('0x74'))][(_0xd028('0x75'))](_0xd028('0x80')+_0x1aa9da);}_0x707bcf[_0x454f10[_0xd028('0x62')][_0xd028('0x7d')]]=_0x454f10[_0xd028('0x62')]['from'];})[_0xd028('0x1d')](function(){return db['OpenchannelAccount'][_0xd028('0x5f')]({'where':{'id':_0x454f10['params']['id']},'include':[{'model':db[_0xd028('0x81')],'as':'List','include':[{'model':db['CmContact'],'as':_0xd028('0x82'),'where':_0x707bcf,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xd028('0x83')],'as':_0xd028('0x84')}]});})[_0xd028('0x1d')](handleEntityNotFound(_0x3ea158,null))[_0xd028('0x1d')](function(_0x2cd96f){if(_0x2cd96f&&_0x2cd96f['List']){_0x4513e2[_0xd028('0x3e')]=_0x2cd96f;_0x4513e2[_0xd028('0x85')]=_0x2cd96f[_0xd028('0x84')];_0x4513e2['list']=_0x2cd96f[_0xd028('0x86')];_0x4513e2[_0xd028('0x85')]=_['orderBy'](_0x4513e2[_0xd028('0x85')],[_0xd028('0x87')],['asc']);if(_0x4513e2['account'][_0xd028('0x84')]){delete _0x4513e2[_0xd028('0x3e')][_0xd028('0x84')];}if(_0x4513e2[_0xd028('0x3e')][_0xd028('0x86')]&&_0x4513e2[_0xd028('0x3e')][_0xd028('0x86')][_0xd028('0x82')]['length']){return _0x4513e2['account'][_0xd028('0x86')][_0xd028('0x82')][0x0];}var _0x49f628=_[_0xd028('0x14')](_0x454f10['body'],{'firstName':_0x454f10['body']['from'],'ListId':_0x2cd96f[_0xd028('0x88')]});_0x49f628[_0x454f10[_0xd028('0x62')][_0xd028('0x7d')]]=_0x454f10[_0xd028('0x62')][_0xd028('0x7a')];return db[_0xd028('0x73')][_0xd028('0x5a')](_0x49f628,{'fields':_0x384739,'raw':!![]});}})[_0xd028('0x1d')](handleEntityNotFound(_0x3ea158,null))[_0xd028('0x1d')](function(_0x29d357){_0x4513e2[_0xd028('0x3b')]=_0x29d357;if(_0x29d357){var _0x1ff00d={'ContactId':_0x29d357['id'],'OpenchannelAccountId':_0x454f10[_0xd028('0x56')]['id'],'from':(_0x29d357[_0xd028('0x89')]||'')+'\x20'+(_0x29d357['lastName']||'')};var _0x3bf3b3={'OpenchannelAccountId':_0x454f10[_0xd028('0x56')]['id'],'closed':![]};if(_0x454f10[_0xd028('0x62')][_0xd028('0x8a')]){_0x3bf3b3[_0xd028('0x8a')]=_0x454f10[_0xd028('0x62')][_0xd028('0x8a')];return db['OpenchannelInteraction'][_0xd028('0x5f')]({'where':_0x3bf3b3})[_0xd028('0x1d')](function(_0x569502){if(_0x569502){return[_0x569502,![]];}_0x1ff00d[_0xd028('0x8a')]=_0x454f10[_0xd028('0x62')]['threadId'];_0x1ff00d[_0xd028('0x8b')]=_0x454f10[_0xd028('0x62')][_0xd028('0x8b')];return db['OpenchannelInteraction']['create'](_0x1ff00d)[_0xd028('0x1d')](function(_0x17d4db){return[_0x17d4db,!![]];});});}else{_0x3bf3b3[_0xd028('0x8a')]=null;}_0x3bf3b3[_0xd028('0x8c')]=_0x29d357['id'];return db[_0xd028('0x8d')][_0xd028('0x5f')]({'where':_0x3bf3b3})['then'](function(_0x2d5286){if(_0x2d5286){return[_0x2d5286,![]];}return db[_0xd028('0x8d')][_0xd028('0x5a')](_0x1ff00d)['then'](function(_0x4361fe){return[_0x4361fe,!![]];});});}})[_0xd028('0x8e')](function(_0xb1e95f,_0x5dec37){if(_0xb1e95f){_0x5f430a=_0x5dec37;if(!_0x5dec37){var _0x4535a3={'from':(_0x4513e2[_0xd028('0x3b')][_0xd028('0x89')]||'')+'\x20'+(_0x4513e2['contact'][_0xd028('0x8f')]||'')};if(_0x454f10[_0xd028('0x62')][_0xd028('0x8a')]&&_0x454f10[_0xd028('0x62')][_0xd028('0x90')]&&_0x454f10[_0xd028('0x62')]['threadId']!=_0x454f10['body'][_0xd028('0x90')]){_0x4535a3['threadId']=_0x454f10[_0xd028('0x62')][_0xd028('0x90')];}return _0xb1e95f[_0xd028('0x33')](_0x4535a3);}else{return _0xb1e95f;}}})['then'](function(_0x527973){_0x4513e2[_0xd028('0x3d')]=_0x527973[_0xd028('0x35')]({'plain':!![]});_0x4513e2[_0xd028('0x3d')]['created']=_0x5f430a;if(_0x4513e2['interaction'][_0xd028('0x91')]){if(_0x4513e2[_0xd028('0x3e')][_0xd028('0x92')]){_0x4513e2[_0xd028('0x85')][_0xd028('0x93')]({'id':0x0,'priority':_0x4513e2['applications'][_0xd028('0x58')]+0x1,'app':_0xd028('0x94'),'appdata':_0xd028('0x95'),'interval':_0xd028('0x96')});}}return db[_0xd028('0x97')][_0xd028('0x5a')]({'body':_0x454f10[_0xd028('0x62')][_0xd028('0x62')],'OpenchannelAccountId':_0x454f10['params']['id'],'OpenchannelInteractionId':_0x527973['id'],'direction':'in','ContactId':_0x4513e2[_0xd028('0x3b')]['id'],'AttachmentId':_0x454f10['body'][_0xd028('0x98')]});})[_0xd028('0x1d')](function(_0x1fd334){_0x4513e2[_0xd028('0x26')]=_0x1fd334;if(_0x4513e2[_0xd028('0x3d')][_0xd028('0x99')]){return db[_0xd028('0x9a')]['find']({'attributes':['id',_0xd028('0x38')],'where':{'id':_0x4513e2[_0xd028('0x3d')]['UserId']}})[_0xd028('0x1d')](function(_0x3842d9){if(_0x3842d9){_0x4513e2[_0xd028('0x85')][_0xd028('0x9b')]({'id':0x0,'priority':0x0,'app':_0xd028('0x3c'),'appdata':_0x3842d9[_0xd028('0x38')]+','+(_0x4513e2[_0xd028('0x3e')][_0xd028('0x9c')]||0xa),'interval':'*,*,*,*'});_0x4513e2[_0xd028('0x9d')]=![];}return respondWithRpcPromise(_0xd028('0x9e'),_0xd028('0x9f'),_0x4513e2);});}return respondWithRpcPromise('Start','startRouting',_0x4513e2);})['then'](function(_0x364261){respondWithRpcPromise(_0xd028('0xa0'),_0xd028('0xa0'),{'event':'notify','message':_0x364261},client9002);return _0x364261;})[_0xd028('0x1d')](respondWithResult(_0x3ea158,null))[_0xd028('0x28')](handleError(_0x3ea158,null));};exports['addApplications']=function(_0x5ebc5c,_0x164907,_0x59d4c4){return db[_0xd028('0x51')][_0xd028('0x67')]({'where':{'id':_0x5ebc5c[_0xd028('0x56')]['id']}})['then'](handleEntityNotFound(_0x164907,null))[_0xd028('0x1d')](function(_0x29a935){if(_0x29a935){return db[_0xd028('0xa1')]['transaction'](function(_0x48ea23){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x5ebc5c[_0xd028('0x56')]['id']},'transaction':_0x48ea23})['then'](function(_0x332be6){var _0x92cbdc=_['map'](_0x5ebc5c['body'],function(_0x32e071){_0x32e071['OpenchannelAccountId']=_0x5ebc5c[_0xd028('0x56')]['id'];return _0x32e071;});return db[_0xd028('0x83')][_0xd028('0xa2')](_0x92cbdc,{'transaction':_0x48ea23});});})['then'](function(){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x5ebc5c[_0xd028('0x56')]['id']},'order':'priority'});});}})[_0xd028('0x1d')](respondWithResult(_0x164907,null))['catch'](handleError(_0x164907,null));};exports[_0xd028('0xa3')]=function(_0x189ef3,_0x4bb5c6,_0xe2fa98){var _0xdb58ec={};var _0x2c6933={};var _0x48ef69;var _0x1e2ec4;return db[_0xd028('0x51')][_0xd028('0x67')]({'where':{'id':_0x189ef3[_0xd028('0x56')]['id']}})['then'](handleEntityNotFound(_0x4bb5c6,null))['then'](function(_0x543522){if(_0x543522){_0x48ef69=_0x543522;_0x2c6933['model']=_[_0xd028('0x45')](db[_0xd028('0x83')][_0xd028('0x57')]);_0x2c6933['query']=_[_0xd028('0x45')](_0x189ef3[_0xd028('0x44')]);_0x2c6933['filters']=_[_0xd028('0x47')](_0x2c6933['model'],_0x2c6933['query']);_0xdb58ec[_0xd028('0x4a')]=_[_0xd028('0x47')](_0x2c6933[_0xd028('0x48')],qs[_0xd028('0x49')](_0x189ef3[_0xd028('0x44')][_0xd028('0x49')]));_0xdb58ec[_0xd028('0x4a')]=_0xdb58ec[_0xd028('0x4a')]['length']?_0xdb58ec[_0xd028('0x4a')]:_0x2c6933[_0xd028('0x48')];_0xdb58ec[_0xd028('0x69')]=qs[_0xd028('0x4c')](_0x189ef3[_0xd028('0x44')][_0xd028('0x4c')]);_0xdb58ec['where']=qs[_0xd028('0x46')](_[_0xd028('0x6a')](_0x189ef3[_0xd028('0x44')],_0x2c6933['filters']));if(_0x189ef3['query'][_0xd028('0x4e')]){_0xdb58ec[_0xd028('0x4d')]=_[_0xd028('0x3a')](_0xdb58ec[_0xd028('0x4d')],{'$or':_[_0xd028('0x41')](_0xdb58ec['attributes'],function(_0x3604d8){var _0x2b4a02={};_0x2b4a02[_0x3604d8]={'$like':'%'+_0x189ef3[_0xd028('0x44')][_0xd028('0x4e')]+'%'};return _0x2b4a02;})});}_0xdb58ec=_[_0xd028('0x3a')]({},_0xdb58ec,_0x189ef3[_0xd028('0x50')]);return _0x48ef69[_0xd028('0xa3')](_0xdb58ec);}})[_0xd028('0x1d')](function(_0x1a525a){if(_0x1a525a){_0x1e2ec4=_0x1a525a[_0xd028('0x58')];if(!_0x189ef3[_0xd028('0x44')][_0xd028('0x6e')](_0xd028('0x4b'))){_0xdb58ec[_0xd028('0x2f')]=qs[_0xd028('0x2f')](_0x189ef3[_0xd028('0x44')]['limit']);_0xdb58ec[_0xd028('0x2d')]=qs['offset'](_0x189ef3[_0xd028('0x44')][_0xd028('0x2d')]);}return _0x48ef69[_0xd028('0xa3')](_0xdb58ec);}})['then'](function(_0x542a10){if(_0x542a10){return _0x542a10?{'count':_0x1e2ec4,'rows':_0x542a10}:null;}})['then'](respondWithResult(_0x4bb5c6,null))[_0xd028('0x28')](handleError(_0x4bb5c6,null));};exports['getInteractions']=function(_0x305596,_0x5b3b55,_0x403bba){var _0x5e43ee={'raw':![],'where':{}};var _0x54bb92={};var _0x1b29f9={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x305596['params']['id']}})['then'](handleEntityNotFound(_0x5b3b55,null))[_0xd028('0x1d')](function(_0x58ed1d){if(_0x58ed1d){_0x54bb92[_0xd028('0x48')]=_[_0xd028('0x45')](db[_0xd028('0x8d')]['rawAttributes']);_0x54bb92[_0xd028('0x44')]=_[_0xd028('0x45')](_0x305596['query']);_0x54bb92[_0xd028('0x46')]=_[_0xd028('0x47')](_0x54bb92[_0xd028('0x48')],_0x54bb92['query']);_0x5e43ee['attributes']=_[_0xd028('0x47')](_0x54bb92[_0xd028('0x48')],qs[_0xd028('0x49')](_0x305596['query']['fields']));_0x5e43ee['attributes']=_0x5e43ee[_0xd028('0x4a')][_0xd028('0x58')]?_0x5e43ee[_0xd028('0x4a')]:_0x54bb92[_0xd028('0x48')];if(!_0x305596[_0xd028('0x44')][_0xd028('0x6e')]('nolimit')){_0x5e43ee[_0xd028('0x2f')]=qs[_0xd028('0x2f')](_0x305596[_0xd028('0x44')][_0xd028('0x2f')]);_0x5e43ee['offset']=qs['offset'](_0x305596['query'][_0xd028('0x2d')]);}_0x5e43ee[_0xd028('0x69')]=qs[_0xd028('0x4c')](_0x305596[_0xd028('0x44')][_0xd028('0x4c')]);_0x5e43ee[_0xd028('0x4d')]=qs['filters'](_[_0xd028('0x6a')](_0x305596['query'],_0x54bb92['filters']));_0x5e43ee[_0xd028('0x4d')][_0xd028('0x65')]=_0x58ed1d['id'];if(_0x305596['query'][_0xd028('0x4e')]){_0x5e43ee[_0xd028('0x4d')]=_[_0xd028('0x3a')](_0x5e43ee[_0xd028('0x4d')],{'$or':_[_0xd028('0x41')](_0x5e43ee[_0xd028('0x4a')],function(_0x15df26){var _0x2b3732={};_0x2b3732[_0x15df26]={'$like':'%'+_0x305596[_0xd028('0x44')]['filter']+'%'};return _0x2b3732;})});}_0x5e43ee=_['merge']({},_0x5e43ee,_0x305596[_0xd028('0x50')]);return db[_0xd028('0x8d')][_0xd028('0x52')]({'where':_0x5e43ee[_0xd028('0x4d')]})[_0xd028('0x1d')](function(_0x50f663){_0x1b29f9[_0xd028('0x52')]=_0x50f663;if(_0x305596[_0xd028('0x44')][_0xd028('0x59')]){_0x5e43ee[_0xd028('0x53')]=[{'model':db[_0xd028('0x73')],'as':_0xd028('0xa4'),'required':![]},{'model':db[_0xd028('0x9a')],'as':_0xd028('0xa5'),'attributes':[_0xd028('0x38'),_0xd028('0xa6'),_0xd028('0xa7')],'required':![]},{'model':db[_0xd028('0xa8')],'as':_0xd028('0xa9'),'attributes':['id',_0xd028('0x38'),'color'],'where':_0x305596['query'][_0xd028('0xaa')]?{'id':_0x305596[_0xd028('0x44')][_0xd028('0xaa')]}:undefined,'required':_0x305596['query'][_0xd028('0xaa')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xd028('0x6f')](_0x5e43ee);})['then'](function(_0x127ae8){_0x1b29f9['rows']=_0x127ae8;return _0x1b29f9;});}})[_0xd028('0x1d')](respondWithFilteredResult(_0x5b3b55,_0x5e43ee))[_0xd028('0x28')](handleError(_0x5b3b55,null));};exports[_0xd028('0xab')]=function(_0x438368,_0x1d193a,_0x1f8ebe){return db[_0xd028('0x51')][_0xd028('0x5f')]({'where':{'id':_0x438368['params']['id']}})[_0xd028('0x1d')](handleEntityNotFound(_0x1d193a,null))['then'](function(_0x282f77){if(_0x282f77){return _0x282f77[_0xd028('0xab')](_0x438368[_0xd028('0x62')][_0xd028('0x6c')],_['omit'](_0x438368[_0xd028('0x62')],['ids','id'])||{})[_0xd028('0x8e')](function(_0x105ad1){for(var _0x23f3ea=0x0;_0x23f3ea<_0x438368[_0xd028('0x62')][_0xd028('0x6c')][_0xd028('0x58')];_0x23f3ea+=0x1){socket[_0xd028('0xac')](_0xd028('0xad'),{'UserId':_0x438368['body'][_0xd028('0x6c')][_0x23f3ea],'OpenchannelAccountId':_0x438368[_0xd028('0x56')]['id']});}return _0x105ad1;});}})[_0xd028('0x1d')](respondWithResult(_0x1d193a,null))[_0xd028('0x28')](handleError(_0x1d193a,null));};exports['removeAgents']=function(_0x507d82,_0x35a3d5,_0x1726a3){return db[_0xd028('0x51')][_0xd028('0x5f')]({'where':{'id':_0x507d82[_0xd028('0x56')]['id']}})[_0xd028('0x1d')](handleEntityNotFound(_0x35a3d5,null))['then'](function(_0x5ace28){if(_0x5ace28){return _0x5ace28['removeAgents'](_0x507d82[_0xd028('0x44')][_0xd028('0x6c')])[_0xd028('0x1d')](function(){if(_[_0xd028('0xae')](_0x507d82['query'][_0xd028('0x6c')])){for(var _0x1aa336=0x0;_0x1aa336<_0x507d82[_0xd028('0x44')][_0xd028('0x6c')]['length'];_0x1aa336+=0x1){socket['emit'](_0xd028('0xaf'),{'UserId':Number(_0x507d82[_0xd028('0x44')][_0xd028('0x6c')][_0x1aa336]),'OpenchannelAccountId':Number(_0x507d82[_0xd028('0x56')]['id'])});}}else{socket['emit'](_0xd028('0xaf'),{'UserId':Number(_0x507d82['query']['ids']),'OpenchannelAccountId':Number(_0x507d82['params']['id'])});}});}})[_0xd028('0x1d')](respondWithStatusCode(_0x35a3d5,null))['catch'](handleError(_0x35a3d5,null));};exports['getAgents']=function(_0x4390e2,_0xa25289,_0xdaa5b9){var _0x1e9747={};var _0x1225db={};var _0x3cda42;var _0x457893;return db[_0xd028('0x51')][_0xd028('0x67')]({'where':{'id':_0x4390e2[_0xd028('0x56')]['id']}})['then'](handleEntityNotFound(_0xa25289,null))[_0xd028('0x1d')](function(_0x36fc45){if(_0x36fc45){_0x3cda42=_0x36fc45;_0x1225db[_0xd028('0x48')]=_[_0xd028('0x45')](db['User'][_0xd028('0x57')]);_0x1225db[_0xd028('0x44')]=_['keys'](_0x4390e2[_0xd028('0x44')]);_0x1225db[_0xd028('0x46')]=_[_0xd028('0x47')](_0x1225db[_0xd028('0x48')],_0x1225db[_0xd028('0x44')]);_0x1e9747[_0xd028('0x4a')]=_[_0xd028('0x47')](_0x1225db['model'],qs[_0xd028('0x49')](_0x4390e2[_0xd028('0x44')][_0xd028('0x49')]));_0x1e9747[_0xd028('0x4a')]=_0x1e9747['attributes'][_0xd028('0x58')]?_0x1e9747[_0xd028('0x4a')]:_0x1225db[_0xd028('0x48')];_0x1e9747[_0xd028('0x69')]=qs[_0xd028('0x4c')](_0x4390e2[_0xd028('0x44')][_0xd028('0x4c')]);_0x1e9747[_0xd028('0x4d')]=qs[_0xd028('0x46')](_[_0xd028('0x6a')](_0x4390e2[_0xd028('0x44')],_0x1225db[_0xd028('0x46')]));if(_0x4390e2[_0xd028('0x44')][_0xd028('0x4e')]){_0x1e9747[_0xd028('0x4d')]=_[_0xd028('0x3a')](_0x1e9747[_0xd028('0x4d')],{'$or':_['map'](_0x1e9747[_0xd028('0x4a')],function(_0xd30663){var _0x3e7c48={};_0x3e7c48[_0xd30663]={'$like':'%'+_0x4390e2[_0xd028('0x44')][_0xd028('0x4e')]+'%'};return _0x3e7c48;})});}_0x1e9747=_['merge']({},_0x1e9747,_0x4390e2[_0xd028('0x50')]);return _0x3cda42[_0xd028('0xb0')](_0x1e9747);}})[_0xd028('0x1d')](function(_0x93023){if(_0x93023){_0x457893=_0x93023[_0xd028('0x58')];if(!_0x4390e2[_0xd028('0x44')][_0xd028('0x6e')](_0xd028('0x4b'))){_0x1e9747['limit']=qs[_0xd028('0x2f')](_0x4390e2[_0xd028('0x44')][_0xd028('0x2f')]);_0x1e9747['offset']=qs[_0xd028('0x2d')](_0x4390e2[_0xd028('0x44')][_0xd028('0x2d')]);}return _0x3cda42[_0xd028('0xb0')](_0x1e9747);}})[_0xd028('0x1d')](function(_0xae9567){if(_0xae9567){return _0xae9567?{'count':_0x457893,'rows':_0xae9567}:null;}})[_0xd028('0x1d')](respondWithResult(_0xa25289,null))[_0xd028('0x28')](handleError(_0xa25289,null));};exports[_0xd028('0x39')]=function(_0x14bf0,_0x714505,_0x1eb2bc){var _0x5ce940,_0x317aee,_0x15ec59;if(_[_0xd028('0x7c')](_0x14bf0[_0xd028('0x62')][_0xd028('0x62')])||_0x14bf0[_0xd028('0x62')][_0xd028('0x62')]===''){throw new db[(_0xd028('0x74'))][(_0xd028('0x75'))](_0xd028('0x7b'));}if(_['isNil'](_0x14bf0['body']['to'])){}_0x5ce940=_0x14bf0['body']['to'];return db[_0xd028('0x51')]['findOne']({'where':{'id':_0x14bf0['params']['id']}})[_0xd028('0x1d')](handleEntityNotFound(_0x714505,null))[_0xd028('0x1d')](function(_0x596de2){if(_0x596de2){return db[_0xd028('0x51')][_0xd028('0x5f')]({'where':{'id':_0x596de2['id']},'include':[{'model':db[_0xd028('0x81')],'as':_0xd028('0x86'),'include':[{'model':db[_0xd028('0x73')],'as':'Contacts','where':{[_0x596de2[_0xd028('0x7d')]]:_0x5ce940},'limit':0x1,'order':[[_0xd028('0x78'),'DESC']]}]}]})[_0xd028('0x1d')](handleEntityNotFound(_0x714505,null))[_0xd028('0x1d')](function(_0x3432fd){if(_0x3432fd&&_0x3432fd[_0xd028('0x86')]){_0x317aee=_0x3432fd[_0xd028('0x35')]({'plain':!![]});if(_0x317aee['List']&&_0x317aee[_0xd028('0x86')][_0xd028('0x82')][_0xd028('0x58')]){return _0x317aee['List'][_0xd028('0x82')][0x0];}return db['CmContact'][_0xd028('0x5a')](_['defaults'](_0x14bf0[_0xd028('0x62')],{'firstName':_0x5ce940,[_0x3432fd['mapKey']]:_0x5ce940,'phone':_0x5ce940,'ListId':_0x317aee[_0xd028('0x88')]}));}})['then'](handleEntityNotFound(_0x714505,null))['then'](function(_0x173269){if(_0x173269){_0x15ec59=_0x173269;return db['OpenchannelInteraction'][_0xd028('0x5f')]({'where':{'ContactId':_0x15ec59['id'],'closed':![],'OpenchannelAccountId':_0x317aee['id']}})[_0xd028('0x1d')](function(_0x5b5de1){if(_0x5b5de1){return[_0x5b5de1,![]];}return db['OpenchannelInteraction'][_0xd028('0x5a')]({'UserId':_0x14bf0[_0xd028('0x5d')]['id'],'ContactId':_0x15ec59['id'],'OpenchannelAccountId':_0x317aee['id'],'lastMsgDirection':_0xd028('0xb1'),'Messages':[_['merge'](_0x14bf0[_0xd028('0x62')],{'read':![],'body':_0x14bf0[_0xd028('0x62')][_0xd028('0x62')],'OpenchannelAccountId':_0x317aee['id'],'UserId':_0x14bf0['user']['id'],'ContactId':_0x15ec59['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xd028('0xb2')}]})['then'](function(_0x3e5a45){return[_0x3e5a45,!![]];});});}})[_0xd028('0x8e')](function(_0x2d8817,_0x1a00bb){if(_0x1a00bb){return _0x2d8817;}return db[_0xd028('0x97')][_0xd028('0x5a')](_[_0xd028('0x3a')](_0x14bf0[_0xd028('0x62')],{'read':![],'body':_0x14bf0[_0xd028('0x62')][_0xd028('0x62')],'OpenchannelAccountId':_0x317aee['id'],'OpenchannelInteractionId':_0x2d8817['id'],'UserId':_0x14bf0[_0xd028('0x5d')]['id'],'ContactId':_0x15ec59['id']}))[_0xd028('0x1d')](function(_0x55b827){_0x2d8817['dataValues'][_0xd028('0xb2')]=[];_0x2d8817[_0xd028('0xb3')][_0xd028('0xb2')][_0xd028('0x93')](_0x55b827[_0xd028('0xb3')]);return _0x2d8817;});});}})['then'](respondWithResult(_0x714505,null))[_0xd028('0x28')](handleError(_0x714505,null));}; \ No newline at end of file +var _0x604c=['removeAnswers','notify','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','Sequelize','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmContact','Contacts','DESC','Applications','applications','list','orderBy','priority','asc','List','defaults','firstName','threadId','OpenchannelInteraction','externalUrl','spread','lastName','messageId','created','autoclose','push','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','OpenchannelApplication','getApplications','getInteractions','Contact','User','Owner','fullname','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','user','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','render','body','contact','interaction','account','index','Pause','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','OpenchannelAccount','includeAll','include','findAll','rows','catch','show','length','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','OpenchannelAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','options'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x604c,0x1bc));var _0xc604=function(_0x531b6a,_0x3922b9){_0x531b6a=_0x531b6a-0x0;var _0x2de747=_0x604c[_0x531b6a];return _0x2de747;};'use strict';var emlformat=require(_0xc604('0x0'));var rimraf=require(_0xc604('0x1'));var zipdir=require(_0xc604('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc604('0x3'));var moment=require(_0xc604('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc604('0x5'));var util=require('util');var path=require(_0xc604('0x6'));var sox=require(_0xc604('0x7'));var csv=require(_0xc604('0x8'));var ejs=require(_0xc604('0x9'));var fs=require('fs');var fs_extra=require(_0xc604('0xa'));var _=require(_0xc604('0xb'));var squel=require('squel');var crypto=require(_0xc604('0xc'));var jsforce=require(_0xc604('0xd'));var deskjs=require(_0xc604('0xe'));var toCsv=require(_0xc604('0x8'));var querystring=require(_0xc604('0xf'));var Papa=require(_0xc604('0x10'));var Redis=require(_0xc604('0x11'));var authService=require(_0xc604('0x12'));var qs=require(_0xc604('0x13'));var as=require(_0xc604('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc604('0x15'))(_0xc604('0x16'));var utils=require(_0xc604('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc604('0x18'));var db=require(_0xc604('0x19'))['db'];config['redis']=_['defaults'](config[_0xc604('0x1a')],{'host':_0xc604('0x1b'),'port':0x18eb});var socket=require(_0xc604('0x1c'))(new Redis(config[_0xc604('0x1a')]));require(_0xc604('0x1d'))[_0xc604('0x1e')](socket);var jayson=require(_0xc604('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xc604('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f6f33,_0x400bca,_0x36c478,_0x5dd600){return new BPromise(function(_0x6185a1,_0x66ec56){var _0x16c686=_0x5dd600||client;return _0x16c686[_0xc604('0x21')](_0x2f6f33,_0x36c478)[_0xc604('0x22')](function(_0x585f8d){logger[_0xc604('0x23')](_0xc604('0x24'),_0x400bca,'request\x20sent');logger[_0xc604('0x25')](_0xc604('0x26'),_0x400bca,'request\x20sent',JSON['stringify'](_0x585f8d));if(_0x585f8d[_0xc604('0x27')]){if(_0x585f8d[_0xc604('0x27')][_0xc604('0x28')]===0x1f4){logger['error'](_0xc604('0x24'),_0x400bca,_0x585f8d[_0xc604('0x27')][_0xc604('0x29')]);return _0x66ec56(_0x585f8d['error']['message']);}logger[_0xc604('0x27')](_0xc604('0x24'),_0x400bca,_0x585f8d[_0xc604('0x27')]['message']);return _0x6185a1(_0x585f8d[_0xc604('0x27')][_0xc604('0x29')]);}else{logger['info'](_0xc604('0x24'),_0x400bca,_0xc604('0x2a'));_0x6185a1(_0x585f8d[_0xc604('0x2b')][_0xc604('0x29')]);}})['catch'](function(_0x7edb71){logger['error'](_0xc604('0x24'),_0x400bca,_0x7edb71);_0x66ec56(_0x7edb71);});});}function respondWithStatusCode(_0x54e27c,_0xce6a04){_0xce6a04=_0xce6a04||0xcc;return function(_0x528723){if(_0x528723){return _0x54e27c[_0xc604('0x2c')](_0xce6a04);}return _0x54e27c['status'](_0xce6a04)[_0xc604('0x2d')]();};}function respondWithResult(_0x3d6998,_0x1d32ae){_0x1d32ae=_0x1d32ae||0xc8;return function(_0x5cba13){if(_0x5cba13){return _0x3d6998[_0xc604('0x2e')](_0x1d32ae)[_0xc604('0x2f')](_0x5cba13);}};}function respondWithFilteredResult(_0x23c93e,_0x1bbd7e){return function(_0x1459b5){if(_0x1459b5){var _0x441775=typeof _0x1bbd7e[_0xc604('0x30')]===_0xc604('0x31')&&typeof _0x1bbd7e[_0xc604('0x32')]===_0xc604('0x31');var _0x5e9e81=_0x1459b5[_0xc604('0x33')];var _0x190fba=_0x441775?0x0:_0x1bbd7e[_0xc604('0x30')];var _0x43025a=_0x441775?_0x1459b5[_0xc604('0x33')]:_0x1bbd7e[_0xc604('0x30')]+_0x1bbd7e[_0xc604('0x32')];var _0x55ae60;if(_0x43025a>=_0x5e9e81){_0x43025a=_0x5e9e81;_0x55ae60=0xc8;}else{_0x55ae60=0xce;}_0x23c93e[_0xc604('0x2e')](_0x55ae60);return _0x23c93e[_0xc604('0x34')](_0xc604('0x35'),_0x190fba+'-'+_0x43025a+'/'+_0x5e9e81)[_0xc604('0x2f')](_0x1459b5);}return null;};}function patchUpdates(_0x9a668d){return function(_0x18d69d){try{jsonpatch[_0xc604('0x36')](_0x18d69d,_0x9a668d,!![]);}catch(_0x4bb599){return BPromise[_0xc604('0x37')](_0x4bb599);}return _0x18d69d[_0xc604('0x38')]();};}function saveUpdates(_0x4ba3f1,_0xd260f8){return function(_0x5720c4){if(_0x5720c4){return _0x5720c4['update'](_0x4ba3f1)[_0xc604('0x22')](function(_0x477958){return _0x477958;});}return null;};}function removeEntity(_0x524b3f,_0x38ba20){return function(_0x24c307){if(_0x24c307){return _0x24c307[_0xc604('0x39')]()['then'](function(){var _0xad013b=_0x24c307[_0xc604('0x3a')]({'plain':!![]});var _0x33d1e3=_0xc604('0x3b');return db[_0xc604('0x3c')][_0xc604('0x39')]({'where':{'type':_0x33d1e3,'resourceId':_0xad013b['id']}})['then'](function(){return _0x24c307;});})[_0xc604('0x22')](function(){_0x524b3f[_0xc604('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29bcc2,_0xbb499c){return function(_0xf5a8cc){if(!_0xf5a8cc){_0x29bcc2[_0xc604('0x2c')](0x194);}return _0xf5a8cc;};}function handleError(_0x5b40f0,_0xaeb186){_0xaeb186=_0xaeb186||0x1f4;return function(_0x358ff4){logger[_0xc604('0x27')](_0x358ff4['stack']);if(_0x358ff4[_0xc604('0x3d')]){delete _0x358ff4[_0xc604('0x3d')];}_0x5b40f0[_0xc604('0x2e')](_0xaeb186)[_0xc604('0x3e')](_0x358ff4);};}function getMustacheRender(_0x10ca80,_0xfd2d3b){return Mustache[_0xc604('0x3f')](_0x10ca80,_['merge'](_0xfd2d3b[_0xc604('0x40')],{'contact':_0xfd2d3b[_0xc604('0x41')],'message':_0xfd2d3b[_0xc604('0x29')],'agent':_0xfd2d3b['agent'],'interaction':_0xfd2d3b[_0xc604('0x42')],'account':_0xfd2d3b[_0xc604('0x43')]}))||'';}exports[_0xc604('0x44')]=function(_0x1fdda8,_0x46dd9f){var _0x183fd2={'include':[{'model':db[_0xc604('0x45')],'as':'mandatoryDispositionPause'}]},_0x5029ef={},_0x3dce75={'count':0x0,'rows':[]};var _0x348d5d=_['map'](db['OpenchannelAccount'][_0xc604('0x46')],function(_0x28c131){return{'name':_0x28c131['fieldName'],'type':_0x28c131[_0xc604('0x47')][_0xc604('0x48')]};});_0x5029ef[_0xc604('0x49')]=_[_0xc604('0x4a')](_0x348d5d,_0xc604('0x3d'));_0x5029ef[_0xc604('0x4b')]=_[_0xc604('0x4c')](_0x1fdda8[_0xc604('0x4b')]);_0x5029ef[_0xc604('0x4d')]=_[_0xc604('0x4e')](_0x5029ef[_0xc604('0x49')],_0x5029ef['query']);_0x183fd2['attributes']=_[_0xc604('0x4e')](_0x5029ef[_0xc604('0x49')],qs[_0xc604('0x4f')](_0x1fdda8['query']['fields']));_0x183fd2[_0xc604('0x50')]=_0x183fd2[_0xc604('0x50')]['length']?_0x183fd2[_0xc604('0x50')]:_0x5029ef[_0xc604('0x49')];if(!_0x1fdda8['query'][_0xc604('0x51')](_0xc604('0x52'))){_0x183fd2[_0xc604('0x32')]=qs[_0xc604('0x32')](_0x1fdda8['query']['limit']);_0x183fd2['offset']=qs[_0xc604('0x30')](_0x1fdda8[_0xc604('0x4b')][_0xc604('0x30')]);}_0x183fd2[_0xc604('0x53')]=qs[_0xc604('0x54')](_0x1fdda8[_0xc604('0x4b')][_0xc604('0x54')]);_0x183fd2[_0xc604('0x55')]=qs[_0xc604('0x4d')](_[_0xc604('0x56')](_0x1fdda8[_0xc604('0x4b')],_0x5029ef[_0xc604('0x4d')]),_0x348d5d);if(_0x1fdda8[_0xc604('0x4b')][_0xc604('0x57')]){_0x183fd2[_0xc604('0x55')]=_[_0xc604('0x58')](_0x183fd2['where'],{'$or':_[_0xc604('0x4a')](_0x348d5d,function(_0x5ae153){if(_0x5ae153['type']!=='VIRTUAL'){var _0x24e3b1={};_0x24e3b1[_0x5ae153[_0xc604('0x3d')]]={'$like':'%'+_0x1fdda8['query']['filter']+'%'};return _0x24e3b1;}})});}_0x183fd2=_[_0xc604('0x58')]({},_0x183fd2,_0x1fdda8['options']);var _0x21cd85={'where':_0x183fd2[_0xc604('0x55')]};return db[_0xc604('0x59')][_0xc604('0x33')](_0x21cd85)[_0xc604('0x22')](function(_0x1314a2){_0x3dce75[_0xc604('0x33')]=_0x1314a2;if(_0x1fdda8[_0xc604('0x4b')][_0xc604('0x5a')]){_0x183fd2[_0xc604('0x5b')]=[{'all':!![]}];}return db[_0xc604('0x59')][_0xc604('0x5c')](_0x183fd2);})[_0xc604('0x22')](function(_0x383d9c){_0x3dce75[_0xc604('0x5d')]=_0x383d9c;return _0x3dce75;})['then'](respondWithFilteredResult(_0x46dd9f,_0x183fd2))[_0xc604('0x5e')](handleError(_0x46dd9f,null));};exports[_0xc604('0x5f')]=function(_0x286f0d,_0x506795){var _0x196aa1={'raw':![],'where':{'id':_0x286f0d['params']['id']},'include':[{'model':db[_0xc604('0x45')],'as':'mandatoryDispositionPause'}]},_0x1c1fc0={};_0x1c1fc0[_0xc604('0x49')]=_[_0xc604('0x4c')](db['OpenchannelAccount'][_0xc604('0x46')]);_0x1c1fc0[_0xc604('0x4b')]=_['keys'](_0x286f0d[_0xc604('0x4b')]);_0x1c1fc0[_0xc604('0x4d')]=_['intersection'](_0x1c1fc0[_0xc604('0x49')],_0x1c1fc0[_0xc604('0x4b')]);_0x196aa1[_0xc604('0x50')]=_[_0xc604('0x4e')](_0x1c1fc0['model'],qs['fields'](_0x286f0d[_0xc604('0x4b')]['fields']));_0x196aa1[_0xc604('0x50')]=_0x196aa1['attributes'][_0xc604('0x60')]?_0x196aa1[_0xc604('0x50')]:_0x1c1fc0[_0xc604('0x49')];if(_0x286f0d['query'][_0xc604('0x5a')]){_0x196aa1[_0xc604('0x5b')]=[{'all':!![]}];}_0x196aa1=_[_0xc604('0x58')]({},_0x196aa1,_0x286f0d['options']);return db[_0xc604('0x59')][_0xc604('0x61')](_0x196aa1)['then'](handleEntityNotFound(_0x506795,null))[_0xc604('0x22')](respondWithResult(_0x506795,null))[_0xc604('0x5e')](handleError(_0x506795,null));};exports['create']=function(_0x223260,_0x2c2d1f){return db[_0xc604('0x59')]['create'](_0x223260[_0xc604('0x40')],{})[_0xc604('0x22')](function(_0x3617a7){var _0x44889b=_0x223260['user'][_0xc604('0x3a')]({'plain':!![]});if(!_0x44889b)throw new Error(_0xc604('0x62'));if(_0x44889b[_0xc604('0x63')]==='user'){var _0x3d9270=_0x3617a7[_0xc604('0x3a')]({'plain':!![]});var _0x559ccf=_0xc604('0x3b');return db[_0xc604('0x64')][_0xc604('0x61')]({'where':{'name':_0x559ccf,'userProfileId':_0x44889b[_0xc604('0x65')]},'raw':!![]})['then'](function(_0x38d382){if(_0x38d382&&_0x38d382['autoAssociation']===0x0){return db[_0xc604('0x3c')]['create']({'name':_0x3d9270[_0xc604('0x3d')],'resourceId':_0x3d9270['id'],'type':_0x38d382[_0xc604('0x3d')],'sectionId':_0x38d382['id']},{})[_0xc604('0x22')](function(){return _0x3617a7;});}else{return _0x3617a7;}})['catch'](function(_0x51695b){logger[_0xc604('0x27')](_0xc604('0x66'),_0x51695b);throw _0x51695b;});}return _0x3617a7;})[_0xc604('0x22')](respondWithResult(_0x2c2d1f,0xc9))['catch'](handleError(_0x2c2d1f,null));};exports[_0xc604('0x67')]=function(_0x8e2873,_0x4df6c9){if(_0x8e2873[_0xc604('0x40')]['id']){delete _0x8e2873[_0xc604('0x40')]['id'];}return db['OpenchannelAccount'][_0xc604('0x61')]({'where':{'id':_0x8e2873[_0xc604('0x68')]['id']},'include':[{'model':db[_0xc604('0x45')],'as':'mandatoryDispositionPause'}]})[_0xc604('0x22')](handleEntityNotFound(_0x4df6c9,null))[_0xc604('0x22')](saveUpdates(_0x8e2873[_0xc604('0x40')],null))[_0xc604('0x22')](respondWithResult(_0x4df6c9,null))[_0xc604('0x5e')](handleError(_0x4df6c9,null));};exports['destroy']=function(_0x3d7255,_0x21a4b1){return db['OpenchannelAccount'][_0xc604('0x61')]({'where':{'id':_0x3d7255[_0xc604('0x68')]['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x21a4b1,null))[_0xc604('0x22')](removeEntity(_0x21a4b1,null))[_0xc604('0x5e')](handleError(_0x21a4b1,null));};exports[_0xc604('0x69')]=function(_0x34014c,_0x3390c3){return db[_0xc604('0x59')]['describe']()[_0xc604('0x22')](respondWithResult(_0x3390c3,null))[_0xc604('0x5e')](handleError(_0x3390c3,null));};exports[_0xc604('0x6a')]=function(_0x307974,_0xd114da,_0x49acc5){if(_0x307974['body']['id']){delete _0x307974[_0xc604('0x40')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x307974['params']['id']}})[_0xc604('0x22')](handleEntityNotFound(_0xd114da,null))[_0xc604('0x22')](function(_0x2f4832){if(_0x2f4832){_0x307974[_0xc604('0x40')][_0xc604('0x6b')]=_0x2f4832['id'];return db[_0xc604('0x6c')][_0xc604('0x6d')](_0x307974['body']);}})[_0xc604('0x22')](respondWithResult(_0xd114da,null))[_0xc604('0x5e')](handleError(_0xd114da,null));};exports[_0xc604('0x6e')]=function(_0xc3c7ca,_0x5e9187,_0xea3ac8){var _0x45e3ae={'raw':![],'where':{}};var _0x4528e1={};var _0x628672={'count':0x0,'rows':[]};return db[_0xc604('0x59')][_0xc604('0x6f')]({'where':{'id':_0xc3c7ca[_0xc604('0x68')]['id']}})['then'](handleEntityNotFound(_0x5e9187,null))[_0xc604('0x22')](function(_0x41878a){if(_0x41878a){_0x4528e1[_0xc604('0x49')]=_[_0xc604('0x4c')](db[_0xc604('0x6c')]['rawAttributes']);_0x4528e1[_0xc604('0x4b')]=_[_0xc604('0x4c')](_0xc3c7ca[_0xc604('0x4b')]);_0x4528e1[_0xc604('0x4d')]=_[_0xc604('0x4e')](_0x4528e1[_0xc604('0x49')],_0x4528e1[_0xc604('0x4b')]);_0x45e3ae[_0xc604('0x50')]=_[_0xc604('0x4e')](_0x4528e1[_0xc604('0x49')],qs['fields'](_0xc3c7ca[_0xc604('0x4b')]['fields']));_0x45e3ae[_0xc604('0x50')]=_0x45e3ae[_0xc604('0x50')][_0xc604('0x60')]?_0x45e3ae[_0xc604('0x50')]:_0x4528e1[_0xc604('0x49')];if(!_0xc3c7ca['query']['hasOwnProperty'](_0xc604('0x52'))){_0x45e3ae[_0xc604('0x32')]=qs[_0xc604('0x32')](_0xc3c7ca['query'][_0xc604('0x32')]);_0x45e3ae[_0xc604('0x30')]=qs[_0xc604('0x30')](_0xc3c7ca[_0xc604('0x4b')][_0xc604('0x30')]);}_0x45e3ae[_0xc604('0x53')]=qs[_0xc604('0x54')](_0xc3c7ca[_0xc604('0x4b')]['sort']);_0x45e3ae['where']=qs['filters'](_['pick'](_0xc3c7ca[_0xc604('0x4b')],_0x4528e1[_0xc604('0x4d')]));_0x45e3ae[_0xc604('0x55')][_0xc604('0x6b')]=_0x41878a['id'];if(_0xc3c7ca[_0xc604('0x4b')][_0xc604('0x57')]){_0x45e3ae[_0xc604('0x55')]=_[_0xc604('0x58')](_0x45e3ae[_0xc604('0x55')],{'$or':_['map'](_0x45e3ae[_0xc604('0x50')],function(_0x2b007a){var _0x433542={};_0x433542[_0x2b007a]={'$like':'%'+_0xc3c7ca[_0xc604('0x4b')][_0xc604('0x57')]+'%'};return _0x433542;})});}_0x45e3ae=_[_0xc604('0x58')]({},_0x45e3ae,_0xc3c7ca['options']);return db[_0xc604('0x6c')][_0xc604('0x33')]({'where':_0x45e3ae['where']})['then'](function(_0x1577b7){_0x628672[_0xc604('0x33')]=_0x1577b7;if(_0xc3c7ca[_0xc604('0x4b')]['includeAll']){_0x45e3ae['include']=[{'all':!![]}];}return db['Disposition'][_0xc604('0x5c')](_0x45e3ae);})[_0xc604('0x22')](function(_0x1b9a2a){_0x628672[_0xc604('0x5d')]=_0x1b9a2a;return _0x628672;});}})[_0xc604('0x22')](respondWithFilteredResult(_0x5e9187,_0x45e3ae))[_0xc604('0x5e')](handleError(_0x5e9187,null));};exports[_0xc604('0x70')]=function(_0x3148ac,_0x10f897,_0x47cee3){return db[_0xc604('0x59')][_0xc604('0x61')]({'where':{'id':_0x3148ac[_0xc604('0x68')]['id']}})['then'](handleEntityNotFound(_0x10f897,null))[_0xc604('0x22')](function(_0x322ea3){if(_0x322ea3){return _0x322ea3[_0xc604('0x70')](_0x3148ac['query'][_0xc604('0x71')]);}})[_0xc604('0x22')](respondWithStatusCode(_0x10f897,null))[_0xc604('0x5e')](handleError(_0x10f897,null));};exports[_0xc604('0x72')]=function(_0x4045b5,_0x89e91f,_0x2d9d77){if(_0x4045b5[_0xc604('0x40')]['id']){delete _0x4045b5['body']['id'];}return db['OpenchannelAccount'][_0xc604('0x61')]({'where':{'id':_0x4045b5['params']['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x89e91f,null))[_0xc604('0x22')](function(_0x3dabad){if(_0x3dabad){_0x4045b5[_0xc604('0x40')][_0xc604('0x6b')]=_0x3dabad['id'];return db[_0xc604('0x73')]['create'](_0x4045b5[_0xc604('0x40')]);}})[_0xc604('0x22')](respondWithResult(_0x89e91f,null))[_0xc604('0x5e')](handleError(_0x89e91f,null));};exports['getAnswers']=function(_0x17ecc1,_0x3cdadd,_0x1426a0){var _0x108c7e={'raw':![],'where':{}};var _0x3971bc={};var _0x59bbcc={'count':0x0,'rows':[]};return db[_0xc604('0x59')][_0xc604('0x6f')]({'where':{'id':_0x17ecc1[_0xc604('0x68')]['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x3cdadd,null))['then'](function(_0x396c1d){if(_0x396c1d){_0x3971bc[_0xc604('0x49')]=_[_0xc604('0x4c')](db['CannedAnswer'][_0xc604('0x46')]);_0x3971bc['query']=_[_0xc604('0x4c')](_0x17ecc1[_0xc604('0x4b')]);_0x3971bc[_0xc604('0x4d')]=_['intersection'](_0x3971bc[_0xc604('0x49')],_0x3971bc[_0xc604('0x4b')]);_0x108c7e['attributes']=_[_0xc604('0x4e')](_0x3971bc['model'],qs['fields'](_0x17ecc1[_0xc604('0x4b')][_0xc604('0x4f')]));_0x108c7e[_0xc604('0x50')]=_0x108c7e[_0xc604('0x50')][_0xc604('0x60')]?_0x108c7e[_0xc604('0x50')]:_0x3971bc[_0xc604('0x49')];if(!_0x17ecc1[_0xc604('0x4b')][_0xc604('0x51')](_0xc604('0x52'))){_0x108c7e[_0xc604('0x32')]=qs[_0xc604('0x32')](_0x17ecc1[_0xc604('0x4b')]['limit']);_0x108c7e[_0xc604('0x30')]=qs[_0xc604('0x30')](_0x17ecc1[_0xc604('0x4b')][_0xc604('0x30')]);}_0x108c7e[_0xc604('0x53')]=qs[_0xc604('0x54')](_0x17ecc1[_0xc604('0x4b')][_0xc604('0x54')]);_0x108c7e[_0xc604('0x55')]=qs[_0xc604('0x4d')](_[_0xc604('0x56')](_0x17ecc1['query'],_0x3971bc['filters']));_0x108c7e[_0xc604('0x55')]['OpenchannelAccountId']=_0x396c1d['id'];if(_0x17ecc1[_0xc604('0x4b')][_0xc604('0x57')]){_0x108c7e[_0xc604('0x55')]=_[_0xc604('0x58')](_0x108c7e['where'],{'$or':_['map'](_0x108c7e[_0xc604('0x50')],function(_0x742d84){var _0x3679a9={};_0x3679a9[_0x742d84]={'$like':'%'+_0x17ecc1['query']['filter']+'%'};return _0x3679a9;})});}_0x108c7e=_[_0xc604('0x58')]({},_0x108c7e,_0x17ecc1[_0xc604('0x74')]);return db['CannedAnswer']['count']({'where':_0x108c7e[_0xc604('0x55')]})[_0xc604('0x22')](function(_0x3cd387){_0x59bbcc[_0xc604('0x33')]=_0x3cd387;if(_0x17ecc1['query'][_0xc604('0x5a')]){_0x108c7e['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xc604('0x5c')](_0x108c7e);})['then'](function(_0x216884){_0x59bbcc['rows']=_0x216884;return _0x59bbcc;});}})[_0xc604('0x22')](respondWithFilteredResult(_0x3cdadd,_0x108c7e))[_0xc604('0x5e')](handleError(_0x3cdadd,null));};exports[_0xc604('0x75')]=function(_0x51f938,_0x251dd4,_0x5e3ef3){return db[_0xc604('0x59')][_0xc604('0x61')]({'where':{'id':_0x51f938['params']['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x251dd4,null))[_0xc604('0x22')](function(_0x5b98e0){if(_0x5b98e0){return _0x5b98e0[_0xc604('0x75')](_0x51f938['query'][_0xc604('0x71')]);}})[_0xc604('0x22')](respondWithStatusCode(_0x251dd4,null))[_0xc604('0x5e')](handleError(_0x251dd4,null));};exports[_0xc604('0x76')]=function(_0x507765,_0x5fe5c0,_0xa4e2c9){var _0x3f7c17={'body':_0x507765[_0xc604('0x40')],'channel':'openchannel'};var _0x35f811=[];var _0x39b0e3=[];var _0x5b2677={};var _0x6b37ca=![];return db['CmContact'][_0xc604('0x69')]()['then'](function(_0x53738e){if(!_0x53738e){throw new db['Sequelize'][(_0xc604('0x77'))](_0xc604('0x78'));}_0x35f811=_['difference'](_[_0xc604('0x4c')](_0x53738e),[_0xc604('0x79'),_0xc604('0x7a')]);_0x39b0e3=_['difference'](_[_0xc604('0x4c')](_0x53738e),[_0xc604('0x79'),_0xc604('0x7a'),_0xc604('0x7b'),_0xc604('0x7c')]);if(_0x507765[_0xc604('0x40')]['id']){delete _0x507765[_0xc604('0x40')]['id'];}if(_[_0xc604('0x7d')](_0x507765[_0xc604('0x40')][_0xc604('0x7e')])){throw new db['Sequelize'][(_0xc604('0x77'))](_0xc604('0x7f'));}if(_[_0xc604('0x7d')](_0x507765[_0xc604('0x40')]['body'])||_0x507765[_0xc604('0x40')][_0xc604('0x40')]===''){throw new db[(_0xc604('0x80'))][(_0xc604('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc604('0x7d')](_0x507765[_0xc604('0x40')]['mapKey'])){throw new db[(_0xc604('0x80'))][(_0xc604('0x77'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x39b0e3);}if(!_[_0xc604('0x81')](_0x39b0e3,_0x507765[_0xc604('0x40')]['mapKey'])){throw new db[(_0xc604('0x80'))][(_0xc604('0x77'))](_0xc604('0x82')+_0x39b0e3);}_0x5b2677[_0x507765[_0xc604('0x40')][_0xc604('0x83')]]=_0x507765[_0xc604('0x40')][_0xc604('0x7e')];})[_0xc604('0x22')](function(){return db['OpenchannelAccount'][_0xc604('0x61')]({'where':{'id':_0x507765[_0xc604('0x68')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xc604('0x84')],'as':_0xc604('0x85'),'where':_0x5b2677,'limit':0x1,'order':[['updatedAt',_0xc604('0x86')]]}]},{'model':db['OpenchannelApplication'],'as':_0xc604('0x87')}]});})[_0xc604('0x22')](handleEntityNotFound(_0x5fe5c0,null))[_0xc604('0x22')](function(_0x3d77a4){if(_0x3d77a4&&_0x3d77a4['List']){_0x3f7c17[_0xc604('0x43')]=_0x3d77a4;_0x3f7c17[_0xc604('0x88')]=_0x3d77a4[_0xc604('0x87')];_0x3f7c17[_0xc604('0x89')]=_0x3d77a4['List'];_0x3f7c17[_0xc604('0x88')]=_[_0xc604('0x8a')](_0x3f7c17[_0xc604('0x88')],[_0xc604('0x8b')],[_0xc604('0x8c')]);if(_0x3f7c17['account'][_0xc604('0x87')]){delete _0x3f7c17['account'][_0xc604('0x87')];}if(_0x3f7c17[_0xc604('0x43')][_0xc604('0x8d')]&&_0x3f7c17[_0xc604('0x43')][_0xc604('0x8d')]['Contacts'][_0xc604('0x60')]){return _0x3f7c17[_0xc604('0x43')][_0xc604('0x8d')][_0xc604('0x85')][0x0];}var _0x418662=_[_0xc604('0x8e')](_0x507765[_0xc604('0x40')],{'firstName':_0x507765[_0xc604('0x40')][_0xc604('0x7e')],'ListId':_0x3d77a4[_0xc604('0x7c')]});_0x418662[_0x507765[_0xc604('0x40')][_0xc604('0x83')]]=_0x507765[_0xc604('0x40')]['from'];return db[_0xc604('0x84')][_0xc604('0x6d')](_0x418662,{'fields':_0x35f811,'raw':!![]});}})[_0xc604('0x22')](handleEntityNotFound(_0x5fe5c0,null))[_0xc604('0x22')](function(_0x19c1f1){_0x3f7c17[_0xc604('0x41')]=_0x19c1f1;if(_0x19c1f1){var _0x3141cd={'ContactId':_0x19c1f1['id'],'OpenchannelAccountId':_0x507765['params']['id'],'from':(_0x19c1f1[_0xc604('0x8f')]||'')+'\x20'+(_0x19c1f1['lastName']||'')};var _0x46566a={'OpenchannelAccountId':_0x507765[_0xc604('0x68')]['id'],'closed':![]};if(_0x507765['body'][_0xc604('0x90')]){_0x46566a['threadId']=_0x507765[_0xc604('0x40')]['threadId'];return db[_0xc604('0x91')][_0xc604('0x61')]({'where':_0x46566a})[_0xc604('0x22')](function(_0x1b1729){if(_0x1b1729){return[_0x1b1729,![]];}_0x3141cd[_0xc604('0x90')]=_0x507765[_0xc604('0x40')][_0xc604('0x90')];_0x3141cd[_0xc604('0x92')]=_0x507765['body'][_0xc604('0x92')];return db[_0xc604('0x91')][_0xc604('0x6d')](_0x3141cd)['then'](function(_0x3dfafd){return[_0x3dfafd,!![]];});});}else{_0x46566a[_0xc604('0x90')]=null;}_0x46566a['ContactId']=_0x19c1f1['id'];return db[_0xc604('0x91')][_0xc604('0x61')]({'where':_0x46566a})['then'](function(_0x5048ac){if(_0x5048ac){return[_0x5048ac,![]];}return db[_0xc604('0x91')][_0xc604('0x6d')](_0x3141cd)['then'](function(_0x4de927){return[_0x4de927,!![]];});});}})[_0xc604('0x93')](function(_0x2c3cf3,_0x11450c){if(_0x2c3cf3){_0x6b37ca=_0x11450c;if(!_0x11450c){var _0x4aa0fc={'from':(_0x3f7c17[_0xc604('0x41')][_0xc604('0x8f')]||'')+'\x20'+(_0x3f7c17[_0xc604('0x41')][_0xc604('0x94')]||'')};if(_0x507765[_0xc604('0x40')][_0xc604('0x90')]&&_0x507765[_0xc604('0x40')][_0xc604('0x95')]&&_0x507765['body'][_0xc604('0x90')]!=_0x507765[_0xc604('0x40')][_0xc604('0x95')]){_0x4aa0fc[_0xc604('0x90')]=_0x507765[_0xc604('0x40')][_0xc604('0x95')];}return _0x2c3cf3[_0xc604('0x67')](_0x4aa0fc);}else{return _0x2c3cf3;}}})['then'](function(_0x462070){_0x3f7c17[_0xc604('0x42')]=_0x462070[_0xc604('0x3a')]({'plain':!![]});_0x3f7c17['interaction'][_0xc604('0x96')]=_0x6b37ca;if(_0x3f7c17[_0xc604('0x42')]['created']){if(_0x3f7c17[_0xc604('0x43')][_0xc604('0x97')]){_0x3f7c17['applications'][_0xc604('0x98')]({'id':0x0,'priority':_0x3f7c17['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0xc604('0x99')});}}return db[_0xc604('0x9a')][_0xc604('0x6d')]({'body':_0x507765[_0xc604('0x40')][_0xc604('0x40')],'OpenchannelAccountId':_0x507765[_0xc604('0x68')]['id'],'OpenchannelInteractionId':_0x462070['id'],'direction':'in','ContactId':_0x3f7c17[_0xc604('0x41')]['id'],'AttachmentId':_0x507765[_0xc604('0x40')][_0xc604('0x9b')]});})['then'](function(_0x84092b){_0x3f7c17[_0xc604('0x29')]=_0x84092b;if(_0x3f7c17[_0xc604('0x42')][_0xc604('0x9c')]){return db['User'][_0xc604('0x61')]({'attributes':['id',_0xc604('0x3d')],'where':{'id':_0x3f7c17[_0xc604('0x42')][_0xc604('0x9c')]}})['then'](function(_0x190004){if(_0x190004){_0x3f7c17[_0xc604('0x88')]['unshift']({'id':0x0,'priority':0x0,'app':_0xc604('0x9d'),'appdata':_0x190004[_0xc604('0x3d')]+','+(_0x3f7c17[_0xc604('0x43')][_0xc604('0x9e')]||0xa),'interval':_0xc604('0x99')});_0x3f7c17[_0xc604('0x9f')]=![];}return respondWithRpcPromise(_0xc604('0xa0'),'startRouting',_0x3f7c17);});}return respondWithRpcPromise(_0xc604('0xa0'),_0xc604('0xa1'),_0x3f7c17);})[_0xc604('0x22')](function(_0x3b3734){respondWithRpcPromise(_0xc604('0xa2'),'EventManager',{'event':_0xc604('0x76'),'message':_0x3b3734},client9002);return _0x3b3734;})[_0xc604('0x22')](respondWithResult(_0x5fe5c0,null))[_0xc604('0x5e')](handleError(_0x5fe5c0,null));};exports[_0xc604('0xa3')]=function(_0x2e1108,_0x536196,_0x36359c){return db[_0xc604('0x59')][_0xc604('0x6f')]({'where':{'id':_0x2e1108[_0xc604('0x68')]['id']}})['then'](handleEntityNotFound(_0x536196,null))[_0xc604('0x22')](function(_0x1e640f){if(_0x1e640f){return db['sequelize'][_0xc604('0xa4')](function(_0x42604f){return db[_0xc604('0xa5')][_0xc604('0x39')]({'where':{'OpenchannelAccountId':_0x2e1108['params']['id']},'transaction':_0x42604f})[_0xc604('0x22')](function(_0xc05974){var _0x5197a7=_[_0xc604('0x4a')](_0x2e1108[_0xc604('0x40')],function(_0x153e4a){_0x153e4a[_0xc604('0x6b')]=_0x2e1108[_0xc604('0x68')]['id'];return _0x153e4a;});return db['OpenchannelApplication']['bulkCreate'](_0x5197a7,{'transaction':_0x42604f});});})[_0xc604('0x22')](function(){return db[_0xc604('0xa5')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x2e1108[_0xc604('0x68')]['id']},'order':_0xc604('0x8b')});});}})[_0xc604('0x22')](respondWithResult(_0x536196,null))[_0xc604('0x5e')](handleError(_0x536196,null));};exports[_0xc604('0xa6')]=function(_0xb17a7,_0x29adca,_0x368784){var _0x18231c={};var _0x27ea54={};var _0x2cf704;var _0x5d153b;return db[_0xc604('0x59')]['findOne']({'where':{'id':_0xb17a7[_0xc604('0x68')]['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x29adca,null))[_0xc604('0x22')](function(_0x3ccac8){if(_0x3ccac8){_0x2cf704=_0x3ccac8;_0x27ea54[_0xc604('0x49')]=_[_0xc604('0x4c')](db[_0xc604('0xa5')]['rawAttributes']);_0x27ea54[_0xc604('0x4b')]=_[_0xc604('0x4c')](_0xb17a7[_0xc604('0x4b')]);_0x27ea54[_0xc604('0x4d')]=_[_0xc604('0x4e')](_0x27ea54[_0xc604('0x49')],_0x27ea54[_0xc604('0x4b')]);_0x18231c[_0xc604('0x50')]=_[_0xc604('0x4e')](_0x27ea54[_0xc604('0x49')],qs[_0xc604('0x4f')](_0xb17a7['query'][_0xc604('0x4f')]));_0x18231c[_0xc604('0x50')]=_0x18231c['attributes'][_0xc604('0x60')]?_0x18231c[_0xc604('0x50')]:_0x27ea54[_0xc604('0x49')];_0x18231c[_0xc604('0x53')]=qs['sort'](_0xb17a7[_0xc604('0x4b')]['sort']);_0x18231c[_0xc604('0x55')]=qs['filters'](_[_0xc604('0x56')](_0xb17a7[_0xc604('0x4b')],_0x27ea54[_0xc604('0x4d')]));if(_0xb17a7[_0xc604('0x4b')][_0xc604('0x57')]){_0x18231c[_0xc604('0x55')]=_[_0xc604('0x58')](_0x18231c[_0xc604('0x55')],{'$or':_['map'](_0x18231c[_0xc604('0x50')],function(_0x56bac1){var _0x1fb9da={};_0x1fb9da[_0x56bac1]={'$like':'%'+_0xb17a7[_0xc604('0x4b')][_0xc604('0x57')]+'%'};return _0x1fb9da;})});}_0x18231c=_[_0xc604('0x58')]({},_0x18231c,_0xb17a7[_0xc604('0x74')]);return _0x2cf704['getApplications'](_0x18231c);}})[_0xc604('0x22')](function(_0x1a7261){if(_0x1a7261){_0x5d153b=_0x1a7261[_0xc604('0x60')];if(!_0xb17a7[_0xc604('0x4b')][_0xc604('0x51')](_0xc604('0x52'))){_0x18231c[_0xc604('0x32')]=qs[_0xc604('0x32')](_0xb17a7['query'][_0xc604('0x32')]);_0x18231c[_0xc604('0x30')]=qs[_0xc604('0x30')](_0xb17a7[_0xc604('0x4b')][_0xc604('0x30')]);}return _0x2cf704['getApplications'](_0x18231c);}})[_0xc604('0x22')](function(_0x517fb9){if(_0x517fb9){return _0x517fb9?{'count':_0x5d153b,'rows':_0x517fb9}:null;}})[_0xc604('0x22')](respondWithResult(_0x29adca,null))['catch'](handleError(_0x29adca,null));};exports[_0xc604('0xa7')]=function(_0x329e10,_0x5d1b7e,_0x369934){var _0x4356ec={'raw':![],'where':{}};var _0x374eb9={};var _0x17a03f={'count':0x0,'rows':[]};return db[_0xc604('0x59')][_0xc604('0x6f')]({'where':{'id':_0x329e10[_0xc604('0x68')]['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x5d1b7e,null))['then'](function(_0xd4a9a){if(_0xd4a9a){_0x374eb9[_0xc604('0x49')]=_[_0xc604('0x4c')](db['OpenchannelInteraction']['rawAttributes']);_0x374eb9[_0xc604('0x4b')]=_['keys'](_0x329e10[_0xc604('0x4b')]);_0x374eb9['filters']=_['intersection'](_0x374eb9[_0xc604('0x49')],_0x374eb9['query']);_0x4356ec['attributes']=_[_0xc604('0x4e')](_0x374eb9[_0xc604('0x49')],qs[_0xc604('0x4f')](_0x329e10['query'][_0xc604('0x4f')]));_0x4356ec[_0xc604('0x50')]=_0x4356ec[_0xc604('0x50')][_0xc604('0x60')]?_0x4356ec[_0xc604('0x50')]:_0x374eb9[_0xc604('0x49')];if(!_0x329e10[_0xc604('0x4b')]['hasOwnProperty'](_0xc604('0x52'))){_0x4356ec[_0xc604('0x32')]=qs[_0xc604('0x32')](_0x329e10[_0xc604('0x4b')][_0xc604('0x32')]);_0x4356ec[_0xc604('0x30')]=qs[_0xc604('0x30')](_0x329e10[_0xc604('0x4b')][_0xc604('0x30')]);}_0x4356ec['order']=qs[_0xc604('0x54')](_0x329e10[_0xc604('0x4b')]['sort']);_0x4356ec[_0xc604('0x55')]=qs[_0xc604('0x4d')](_[_0xc604('0x56')](_0x329e10['query'],_0x374eb9['filters']));_0x4356ec[_0xc604('0x55')][_0xc604('0x6b')]=_0xd4a9a['id'];if(_0x329e10['query'][_0xc604('0x57')]){_0x4356ec['where']=_[_0xc604('0x58')](_0x4356ec[_0xc604('0x55')],{'$or':_['map'](_0x4356ec[_0xc604('0x50')],function(_0x4bff21){var _0x245d92={};_0x245d92[_0x4bff21]={'$like':'%'+_0x329e10[_0xc604('0x4b')][_0xc604('0x57')]+'%'};return _0x245d92;})});}_0x4356ec=_[_0xc604('0x58')]({},_0x4356ec,_0x329e10[_0xc604('0x74')]);return db[_0xc604('0x91')][_0xc604('0x33')]({'where':_0x4356ec[_0xc604('0x55')]})[_0xc604('0x22')](function(_0xe5d7c6){_0x17a03f[_0xc604('0x33')]=_0xe5d7c6;if(_0x329e10['query'][_0xc604('0x5a')]){_0x4356ec[_0xc604('0x5b')]=[{'model':db['CmContact'],'as':_0xc604('0xa8'),'required':![]},{'model':db[_0xc604('0xa9')],'as':_0xc604('0xaa'),'attributes':[_0xc604('0x3d'),_0xc604('0xab'),'internal'],'required':![]},{'model':db[_0xc604('0xac')],'as':'Tags','attributes':['id','name',_0xc604('0xad')],'where':_0x329e10[_0xc604('0x4b')][_0xc604('0xae')]?{'id':_0x329e10[_0xc604('0x4b')][_0xc604('0xae')]}:undefined,'required':_0x329e10[_0xc604('0x4b')][_0xc604('0xae')]?!![]:![]}];}return db[_0xc604('0x91')]['findAll'](_0x4356ec);})['then'](function(_0x1a7463){_0x17a03f[_0xc604('0x5d')]=_0x1a7463;return _0x17a03f;});}})[_0xc604('0x22')](respondWithFilteredResult(_0x5d1b7e,_0x4356ec))[_0xc604('0x5e')](handleError(_0x5d1b7e,null));};exports[_0xc604('0xaf')]=function(_0x47197d,_0x1dc7f4,_0xd2ccb2){return db['OpenchannelAccount'][_0xc604('0x61')]({'where':{'id':_0x47197d['params']['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x1dc7f4,null))['then'](function(_0xc3f6c1){if(_0xc3f6c1){return _0xc3f6c1['addAgents'](_0x47197d[_0xc604('0x40')][_0xc604('0x71')],_[_0xc604('0xb0')](_0x47197d[_0xc604('0x40')],[_0xc604('0x71'),'id'])||{})[_0xc604('0x93')](function(_0x3bb411){for(var _0x920fbe=0x0;_0x920fbe<_0x47197d[_0xc604('0x40')]['ids']['length'];_0x920fbe+=0x1){socket[_0xc604('0xb1')](_0xc604('0xb2'),{'UserId':_0x47197d[_0xc604('0x40')][_0xc604('0x71')][_0x920fbe],'OpenchannelAccountId':_0x47197d['params']['id']});}return _0x3bb411;});}})[_0xc604('0x22')](respondWithResult(_0x1dc7f4,null))['catch'](handleError(_0x1dc7f4,null));};exports[_0xc604('0xb3')]=function(_0x47c9e9,_0x29f7c9,_0x2edbaa){return db[_0xc604('0x59')]['find']({'where':{'id':_0x47c9e9[_0xc604('0x68')]['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x29f7c9,null))[_0xc604('0x22')](function(_0x30061b){if(_0x30061b){return _0x30061b['removeAgents'](_0x47c9e9[_0xc604('0x4b')][_0xc604('0x71')])['then'](function(){if(_[_0xc604('0xb4')](_0x47c9e9[_0xc604('0x4b')]['ids'])){for(var _0x1434c7=0x0;_0x1434c7<_0x47c9e9['query'][_0xc604('0x71')][_0xc604('0x60')];_0x1434c7+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x47c9e9['query']['ids'][_0x1434c7]),'OpenchannelAccountId':Number(_0x47c9e9[_0xc604('0x68')]['id'])});}}else{socket[_0xc604('0xb1')](_0xc604('0xb5'),{'UserId':Number(_0x47c9e9[_0xc604('0x4b')][_0xc604('0x71')]),'OpenchannelAccountId':Number(_0x47c9e9[_0xc604('0x68')]['id'])});}});}})[_0xc604('0x22')](respondWithStatusCode(_0x29f7c9,null))['catch'](handleError(_0x29f7c9,null));};exports['getAgents']=function(_0xd7a4c6,_0x4d0ba6,_0xfee184){var _0x1010d1={};var _0x15f388={};var _0x50f184;var _0x3bac11;return db[_0xc604('0x59')]['findOne']({'where':{'id':_0xd7a4c6[_0xc604('0x68')]['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x4d0ba6,null))['then'](function(_0x581cc6){if(_0x581cc6){_0x50f184=_0x581cc6;_0x15f388[_0xc604('0x49')]=_['keys'](db[_0xc604('0xa9')]['rawAttributes']);_0x15f388['query']=_[_0xc604('0x4c')](_0xd7a4c6[_0xc604('0x4b')]);_0x15f388[_0xc604('0x4d')]=_[_0xc604('0x4e')](_0x15f388[_0xc604('0x49')],_0x15f388['query']);_0x1010d1[_0xc604('0x50')]=_['intersection'](_0x15f388[_0xc604('0x49')],qs[_0xc604('0x4f')](_0xd7a4c6[_0xc604('0x4b')][_0xc604('0x4f')]));_0x1010d1[_0xc604('0x50')]=_0x1010d1['attributes'][_0xc604('0x60')]?_0x1010d1[_0xc604('0x50')]:_0x15f388['model'];_0x1010d1[_0xc604('0x53')]=qs['sort'](_0xd7a4c6[_0xc604('0x4b')][_0xc604('0x54')]);_0x1010d1[_0xc604('0x55')]=qs[_0xc604('0x4d')](_[_0xc604('0x56')](_0xd7a4c6[_0xc604('0x4b')],_0x15f388[_0xc604('0x4d')]));if(_0xd7a4c6[_0xc604('0x4b')][_0xc604('0x57')]){_0x1010d1[_0xc604('0x55')]=_[_0xc604('0x58')](_0x1010d1[_0xc604('0x55')],{'$or':_[_0xc604('0x4a')](_0x1010d1[_0xc604('0x50')],function(_0x22d9e2){var _0x14438f={};_0x14438f[_0x22d9e2]={'$like':'%'+_0xd7a4c6[_0xc604('0x4b')][_0xc604('0x57')]+'%'};return _0x14438f;})});}_0x1010d1=_[_0xc604('0x58')]({},_0x1010d1,_0xd7a4c6[_0xc604('0x74')]);return _0x50f184[_0xc604('0xb6')](_0x1010d1);}})['then'](function(_0x18ef2d){if(_0x18ef2d){_0x3bac11=_0x18ef2d[_0xc604('0x60')];if(!_0xd7a4c6[_0xc604('0x4b')][_0xc604('0x51')](_0xc604('0x52'))){_0x1010d1[_0xc604('0x32')]=qs['limit'](_0xd7a4c6[_0xc604('0x4b')][_0xc604('0x32')]);_0x1010d1['offset']=qs['offset'](_0xd7a4c6['query'][_0xc604('0x30')]);}return _0x50f184['getAgents'](_0x1010d1);}})[_0xc604('0x22')](function(_0x3adae1){if(_0x3adae1){return _0x3adae1?{'count':_0x3bac11,'rows':_0x3adae1}:null;}})['then'](respondWithResult(_0x4d0ba6,null))[_0xc604('0x5e')](handleError(_0x4d0ba6,null));};exports[_0xc604('0x3e')]=function(_0x45e610,_0x494891,_0x535b9e){var _0x385108,_0x41c139,_0x103027;if(_[_0xc604('0x7d')](_0x45e610[_0xc604('0x40')][_0xc604('0x40')])||_0x45e610[_0xc604('0x40')][_0xc604('0x40')]===''){throw new db[(_0xc604('0x80'))][(_0xc604('0x77'))](_0xc604('0xb7'));}if(_[_0xc604('0x7d')](_0x45e610[_0xc604('0x40')]['to'])){}_0x385108=_0x45e610['body']['to'];return db['OpenchannelAccount'][_0xc604('0x6f')]({'where':{'id':_0x45e610[_0xc604('0x68')]['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x494891,null))[_0xc604('0x22')](function(_0x2b427a){if(_0x2b427a){return db[_0xc604('0x59')][_0xc604('0x61')]({'where':{'id':_0x2b427a['id']},'include':[{'model':db['CmList'],'as':_0xc604('0x8d'),'include':[{'model':db[_0xc604('0x84')],'as':_0xc604('0x85'),'where':{[_0x2b427a[_0xc604('0x83')]]:_0x385108},'limit':0x1,'order':[[_0xc604('0x7a'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x494891,null))['then'](function(_0x39df36){if(_0x39df36&&_0x39df36[_0xc604('0x8d')]){_0x41c139=_0x39df36[_0xc604('0x3a')]({'plain':!![]});if(_0x41c139[_0xc604('0x8d')]&&_0x41c139[_0xc604('0x8d')][_0xc604('0x85')][_0xc604('0x60')]){return _0x41c139['List'][_0xc604('0x85')][0x0];}return db[_0xc604('0x84')][_0xc604('0x6d')](_['defaults'](_0x45e610[_0xc604('0x40')],{'firstName':_0x385108,[_0x39df36[_0xc604('0x83')]]:_0x385108,'phone':_0x385108,'ListId':_0x41c139[_0xc604('0x7c')]}));}})[_0xc604('0x22')](handleEntityNotFound(_0x494891,null))['then'](function(_0x20eda3){if(_0x20eda3){_0x103027=_0x20eda3;return db[_0xc604('0x91')]['find']({'where':{'ContactId':_0x103027['id'],'closed':![],'OpenchannelAccountId':_0x41c139['id']}})[_0xc604('0x22')](function(_0x38106f){if(_0x38106f){return[_0x38106f,![]];}return db['OpenchannelInteraction'][_0xc604('0x6d')]({'UserId':_0x45e610[_0xc604('0xb8')]['id'],'ContactId':_0x103027['id'],'OpenchannelAccountId':_0x41c139['id'],'lastMsgDirection':'out','Messages':[_[_0xc604('0x58')](_0x45e610['body'],{'read':![],'body':_0x45e610['body'][_0xc604('0x40')],'OpenchannelAccountId':_0x41c139['id'],'UserId':_0x45e610[_0xc604('0xb8')]['id'],'ContactId':_0x103027['id']})]},{'include':[{'model':db[_0xc604('0x9a')],'as':_0xc604('0xb9')}]})[_0xc604('0x22')](function(_0x47e8fe){return[_0x47e8fe,!![]];});});}})[_0xc604('0x93')](function(_0x5c707b,_0x3a79d1){if(_0x3a79d1){return _0x5c707b;}return db[_0xc604('0x9a')][_0xc604('0x6d')](_['merge'](_0x45e610[_0xc604('0x40')],{'read':![],'body':_0x45e610[_0xc604('0x40')][_0xc604('0x40')],'OpenchannelAccountId':_0x41c139['id'],'OpenchannelInteractionId':_0x5c707b['id'],'UserId':_0x45e610[_0xc604('0xb8')]['id'],'ContactId':_0x103027['id']}))['then'](function(_0x17a372){_0x5c707b['dataValues'][_0xc604('0xb9')]=[];_0x5c707b[_0xc604('0xba')][_0xc604('0xb9')]['push'](_0x17a372['dataValues']);return _0x5c707b;});});}})[_0xc604('0x22')](respondWithResult(_0x494891,null))['catch'](handleError(_0x494891,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index a0d862d..1e88862 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 _0xe92c=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x47413e,_0x158032){var _0x36103b=function(_0x49f486){while(--_0x49f486){_0x47413e['push'](_0x47413e['shift']());}};_0x36103b(++_0x158032);}(_0xe92c,0xaa));var _0xce92=function(_0x56497c,_0x516351){_0x56497c=_0x56497c-0x0;var _0x1a1993=_0xe92c[_0x56497c];return _0x1a1993;};'use strict';var EventEmitter=require(_0xce92('0x0'));var OpenchannelAccount=require(_0xce92('0x1'))['db'][_0xce92('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xce92('0x3')](0x0);var events={'afterCreate':_0xce92('0x4'),'afterUpdate':_0xce92('0x5'),'afterDestroy':_0xce92('0x6')};function emitEvent(_0x21d8c8){return function(_0x37da3a,_0x5927df,_0xf9e9c1){OpenchannelAccountEvents[_0xce92('0x7')](_0x21d8c8+':'+_0x37da3a['id'],_0x37da3a);OpenchannelAccountEvents[_0xce92('0x7')](_0x21d8c8,_0x37da3a);_0xf9e9c1(null);};}for(var e in events){if(events[_0xce92('0x8')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x099f=['setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb','OpenchannelAccount'];(function(_0x1cf46d,_0x1214cf){var _0x2e10a9=function(_0x50ed18){while(--_0x50ed18){_0x1cf46d['push'](_0x1cf46d['shift']());}};_0x2e10a9(++_0x1214cf);}(_0x099f,0xc3));var _0xf099=function(_0x2c4e88,_0x21cfa0){_0x2c4e88=_0x2c4e88-0x0;var _0x493608=_0x099f[_0x2c4e88];return _0x493608;};'use strict';var EventEmitter=require(_0xf099('0x0'));var OpenchannelAccount=require(_0xf099('0x1'))['db'][_0xf099('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf099('0x3')](0x0);var events={'afterCreate':_0xf099('0x4'),'afterUpdate':_0xf099('0x5'),'afterDestroy':_0xf099('0x6')};function emitEvent(_0x129592){return function(_0x427f9d,_0x28a7c3,_0x4225f6){OpenchannelAccountEvents[_0xf099('0x7')](_0x129592+':'+_0x427f9d['id'],_0x427f9d);OpenchannelAccountEvents[_0xf099('0x7')](_0x129592,_0x427f9d);_0x4225f6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xf099('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index f52e122..1214e3e 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 _0x274e=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./openchannelAccount.attributes','exports'];(function(_0x4d6753,_0x456744){var _0x5230fd=function(_0x455e8d){while(--_0x455e8d){_0x4d6753['push'](_0x4d6753['shift']());}};_0x5230fd(++_0x456744);}(_0x274e,0xaa));var _0xe274=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x274e[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0xe274('0x0'));var util=require(_0xe274('0x1'));var logger=require(_0xe274('0x2'))(_0xe274('0x3'));var moment=require(_0xe274('0x4'));var BPromise=require(_0xe274('0x5'));var rp=require(_0xe274('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe274('0x7'));var attributes=require(_0xe274('0x8'));module[_0xe274('0x9')]=function(_0x483050,_0x4ca821){return _0x483050['define']('OpenchannelAccount',attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffde=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash'];(function(_0x46a328,_0x57f635){var _0x18d2cb=function(_0x3e5684){while(--_0x3e5684){_0x46a328['push'](_0x46a328['shift']());}};_0x18d2cb(++_0x57f635);}(_0xffde,0x1e3));var _0xeffd=function(_0x195a55,_0x4c4d1c){_0x195a55=_0x195a55-0x0;var _0xd517b4=_0xffde[_0x195a55];return _0xd517b4;};'use strict';var _=require(_0xeffd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeffd('0x1'));var moment=require(_0xeffd('0x2'));var BPromise=require(_0xeffd('0x3'));var rp=require(_0xeffd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeffd('0x5'));var config=require(_0xeffd('0x6'));var attributes=require(_0xeffd('0x7'));module[_0xeffd('0x8')]=function(_0x5a8808,_0x12ded){return _0x5a8808[_0xeffd('0x9')](_0xeffd('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 76fe937..6701a2d 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 _0x48b4=['result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x4864da,_0x24144f){var _0x24a021=function(_0x486597){while(--_0x486597){_0x4864da['push'](_0x4864da['shift']());}};_0x24a021(++_0x24144f);}(_0x48b4,0x146));var _0x448b=function(_0x2b9058,_0x44574d){_0x2b9058=_0x2b9058-0x0;var _0x1eca64=_0x48b4[_0x2b9058];return _0x1eca64;};'use strict';var _=require(_0x448b('0x0'));var util=require(_0x448b('0x1'));var moment=require('moment');var BPromise=require(_0x448b('0x2'));var rs=require(_0x448b('0x3'));var fs=require('fs');var Redis=require(_0x448b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x448b('0x5'));var logger=require(_0x448b('0x6'))(_0x448b('0x7'));var config=require('../../config/environment');var jayson=require(_0x448b('0x8'));var client=jayson[_0x448b('0x9')][_0x448b('0xa')]({'port':0x232a});config[_0x448b('0xb')]=_[_0x448b('0xc')](config[_0x448b('0xb')],{'host':_0x448b('0xd'),'port':0x18eb});var socket=require(_0x448b('0xe'))(new Redis(config[_0x448b('0xb')]));require(_0x448b('0xf'))[_0x448b('0x10')](socket);function respondWithRpcPromise(_0x586e58,_0x263262,_0xdc5394){return new BPromise(function(_0x41bba7,_0x1ad30e){return client[_0x448b('0x11')](_0x586e58,_0xdc5394)['then'](function(_0x52db2b){logger[_0x448b('0x12')](_0x448b('0x13'),_0x263262,'request\x20sent');logger['debug'](_0x448b('0x14'),_0x263262,_0x448b('0x15'),JSON['stringify'](_0x52db2b));if(_0x52db2b[_0x448b('0x16')]){if(_0x52db2b[_0x448b('0x16')]['code']===0x1f4){logger[_0x448b('0x16')](_0x448b('0x13'),_0x263262,_0x52db2b[_0x448b('0x16')]['message']);return _0x1ad30e(_0x52db2b[_0x448b('0x16')][_0x448b('0x17')]);}logger['error'](_0x448b('0x13'),_0x263262,_0x52db2b[_0x448b('0x16')][_0x448b('0x17')]);return _0x41bba7(_0x52db2b[_0x448b('0x16')][_0x448b('0x17')]);}else{logger[_0x448b('0x12')](_0x448b('0x13'),_0x263262,'request\x20sent');_0x41bba7(_0x52db2b[_0x448b('0x18')][_0x448b('0x17')]);}})['catch'](function(_0x4e0303){logger[_0x448b('0x16')](_0x448b('0x13'),_0x263262,_0x4e0303);_0x1ad30e(_0x4e0303);});});} \ No newline at end of file +var _0x3eea=['redis','defaults','localhost','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','http'];(function(_0x2265b0,_0x279abe){var _0xc4900b=function(_0x549d54){while(--_0x549d54){_0x2265b0['push'](_0x2265b0['shift']());}};_0xc4900b(++_0x279abe);}(_0x3eea,0x151));var _0xa3ee=function(_0x286bb2,_0x41481f){_0x286bb2=_0x286bb2-0x0;var _0x4ebd6e=_0x3eea[_0x286bb2];return _0x4ebd6e;};'use strict';var _=require('lodash');var util=require(_0xa3ee('0x0'));var moment=require(_0xa3ee('0x1'));var BPromise=require(_0xa3ee('0x2'));var rs=require(_0xa3ee('0x3'));var fs=require('fs');var Redis=require(_0xa3ee('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa3ee('0x5'));var config=require('../../config/environment');var jayson=require(_0xa3ee('0x6'));var client=jayson['client'][_0xa3ee('0x7')]({'port':0x232a});config[_0xa3ee('0x8')]=_[_0xa3ee('0x9')](config[_0xa3ee('0x8')],{'host':_0xa3ee('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3ee('0x8')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x37ad25,_0x5d084b,_0x4e15c1){return new BPromise(function(_0x168df7,_0x1d577e){return client[_0xa3ee('0xb')](_0x37ad25,_0x4e15c1)[_0xa3ee('0xc')](function(_0x611252){logger[_0xa3ee('0xd')](_0xa3ee('0xe'),_0x5d084b,_0xa3ee('0xf'));logger[_0xa3ee('0x10')](_0xa3ee('0x11'),_0x5d084b,_0xa3ee('0xf'),JSON[_0xa3ee('0x12')](_0x611252));if(_0x611252[_0xa3ee('0x13')]){if(_0x611252[_0xa3ee('0x13')][_0xa3ee('0x14')]===0x1f4){logger[_0xa3ee('0x13')](_0xa3ee('0xe'),_0x5d084b,_0x611252[_0xa3ee('0x13')][_0xa3ee('0x15')]);return _0x1d577e(_0x611252[_0xa3ee('0x13')]['message']);}logger[_0xa3ee('0x13')](_0xa3ee('0xe'),_0x5d084b,_0x611252[_0xa3ee('0x13')][_0xa3ee('0x15')]);return _0x168df7(_0x611252[_0xa3ee('0x13')][_0xa3ee('0x15')]);}else{logger['info'](_0xa3ee('0xe'),_0x5d084b,_0xa3ee('0xf'));_0x168df7(_0x611252['result']['message']);}})[_0xa3ee('0x16')](function(_0x3c6046){logger['error'](_0xa3ee('0xe'),_0x5d084b,_0x3c6046);_0x1d577e(_0x3c6046);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index e4e762c..544fbc2 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 _0x5476=['./openchannelAccount.events','remove','update','emit','removeListener','register','length','openchannelAccount:'];(function(_0x5c2935,_0x57a86e){var _0x29fd1d=function(_0x16998f){while(--_0x16998f){_0x5c2935['push'](_0x5c2935['shift']());}};_0x29fd1d(++_0x57a86e);}(_0x5476,0x148));var _0x6547=function(_0x45e96c,_0x55b95a){_0x45e96c=_0x45e96c-0x0;var _0x2db63b=_0x5476[_0x45e96c];return _0x2db63b;};'use strict';var OpenchannelAccountEvents=require(_0x6547('0x0'));var events=['save',_0x6547('0x1'),_0x6547('0x2')];function createListener(_0x27a1b1,_0x66cfd){return function(_0x48ba23){_0x66cfd[_0x6547('0x3')](_0x27a1b1,_0x48ba23);};}function removeListener(_0x1df080,_0x55e3a3){return function(){OpenchannelAccountEvents[_0x6547('0x4')](_0x1df080,_0x55e3a3);};}exports[_0x6547('0x5')]=function(_0x30cac0){for(var _0x2e9b8c=0x0,_0x128f0a=events[_0x6547('0x6')];_0x2e9b8c<_0x128f0a;_0x2e9b8c++){var _0x5d4c8f=events[_0x2e9b8c];var _0x26d346=createListener(_0x6547('0x7')+_0x5d4c8f,_0x30cac0);OpenchannelAccountEvents['on'](_0x5d4c8f,_0x26d346);}}; \ No newline at end of file +var _0x3b01=['length','openchannelAccount:','save','remove','emit','removeListener','register'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3b01,0x8e));var _0x13b0=function(_0x174cd6,_0x1086c7){_0x174cd6=_0x174cd6-0x0;var _0x48ecf0=_0x3b01[_0x174cd6];return _0x48ecf0;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x13b0('0x0'),_0x13b0('0x1'),'update'];function createListener(_0x686ae0,_0x185939){return function(_0x1b7eec){_0x185939[_0x13b0('0x2')](_0x686ae0,_0x1b7eec);};}function removeListener(_0x256d1f,_0x555e1b){return function(){OpenchannelAccountEvents[_0x13b0('0x3')](_0x256d1f,_0x555e1b);};}exports[_0x13b0('0x4')]=function(_0x500e60){for(var _0x2f1e18=0x0,_0x3fef7f=events[_0x13b0('0x5')];_0x2f1e18<_0x3fef7f;_0x2f1e18++){var _0x1e875c=events[_0x2f1e18];var _0x32b985=createListener(_0x13b0('0x6')+_0x1e875c,_0x500e60);OpenchannelAccountEvents['on'](_0x1e875c,_0x32b985);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 0edebb4..2b5b677 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 _0x67d0=['index','/:id','show','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated'];(function(_0x2711a0,_0x46ce29){var _0x3701e1=function(_0xaaae5f){while(--_0xaaae5f){_0x2711a0['push'](_0x2711a0['shift']());}};_0x3701e1(++_0x46ce29);}(_0x67d0,0x15c));var _0x067d=function(_0x2e3c86,_0x2e1f10){_0x2e3c86=_0x2e3c86-0x0;var _0x2e36e1=_0x67d0[_0x2e3c86];return _0x2e36e1;};'use strict';var multer=require(_0x067d('0x0'));var util=require(_0x067d('0x1'));var path=require(_0x067d('0x2'));var timeout=require('connect-timeout');var express=require(_0x067d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x067d('0x4'));var interaction=require(_0x067d('0x5'));var config=require('../../config/environment');var controller=require(_0x067d('0x6'));router[_0x067d('0x7')]('/',auth[_0x067d('0x8')](),controller[_0x067d('0x9')]);router[_0x067d('0x7')](_0x067d('0xa'),auth[_0x067d('0x8')](),controller[_0x067d('0xb')]);router['post']('/',auth[_0x067d('0x8')](),controller['create']);router[_0x067d('0xc')](_0x067d('0xa'),auth['isAuthenticated'](),controller[_0x067d('0xd')]);router[_0x067d('0xe')](_0x067d('0xa'),auth[_0x067d('0x8')](),controller[_0x067d('0xf')]);module[_0x067d('0x10')]=router; \ No newline at end of file +var _0x4859=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','index','get','/:id','isAuthenticated','show','put','update'];(function(_0x1856dd,_0x10f82b){var _0x444e1c=function(_0x98c24a){while(--_0x98c24a){_0x1856dd['push'](_0x1856dd['shift']());}};_0x444e1c(++_0x10f82b);}(_0x4859,0x167));var _0x9485=function(_0x25200d,_0xa46165){_0x25200d=_0x25200d-0x0;var _0x1aa675=_0x4859[_0x25200d];return _0x1aa675;};'use strict';var multer=require(_0x9485('0x0'));var util=require(_0x9485('0x1'));var path=require(_0x9485('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9485('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9485('0x4'));var interaction=require(_0x9485('0x5'));var config=require(_0x9485('0x6'));var controller=require(_0x9485('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9485('0x8')]);router[_0x9485('0x9')](_0x9485('0xa'),auth[_0x9485('0xb')](),controller[_0x9485('0xc')]);router['post']('/',auth[_0x9485('0xb')](),controller['create']);router[_0x9485('0xd')]('/:id',auth[_0x9485('0xb')](),controller[_0x9485('0xe')]);router['delete']('/:id',auth[_0x9485('0xb')](),controller[_0x9485('0xf')]);module[_0x9485('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index f904e4f..f4477e9 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 _0x76af=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x4f6322,_0x26c43c){var _0x248854=function(_0x3dcdf8){while(--_0x3dcdf8){_0x4f6322['push'](_0x4f6322['shift']());}};_0x248854(++_0x26c43c);}(_0x76af,0xb1));var _0xf76a=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0x76af[_0x15cbce];return _0x257f29;};'use strict';var Sequelize=require(_0xf76a('0x0'));module[_0xf76a('0x1')]={'priority':{'type':Sequelize[_0xf76a('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf76a('0x3')]()},'description':{'type':Sequelize[_0xf76a('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf76a('0x5')}}; \ No newline at end of file +var _0xf032=['sequelize','exports','INTEGER','TEXT','STRING','*,*,*,*'];(function(_0x1d636d,_0xb47efb){var _0x4002bb=function(_0x42e3f0){while(--_0x42e3f0){_0x1d636d['push'](_0x1d636d['shift']());}};_0x4002bb(++_0xb47efb);}(_0xf032,0x1b6));var _0x2f03=function(_0x50a7b4,_0x4d7b2e){_0x50a7b4=_0x50a7b4-0x0;var _0x566c2d=_0xf032[_0x50a7b4];return _0x566c2d;};'use strict';var Sequelize=require(_0x2f03('0x0'));module[_0x2f03('0x1')]={'priority':{'type':Sequelize[_0x2f03('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2f03('0x3')]()},'description':{'type':Sequelize[_0x2f03('0x4')]},'interval':{'type':Sequelize[_0x2f03('0x4')],'defaultValue':_0x2f03('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index e20acf5..e402bbb 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 _0xd2a1=['moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','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','set','Content-Range','reject','save','update','then','render','merge','contact','agent','interaction','account','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','name','query','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter','include','findAll','rows','catch','params','keys','filters','includeAll','options','find','create','body','destroy','eml-format','rimraf','zip-dir'];(function(_0x37f1e4,_0x1a54c1){var _0x148bfc=function(_0x5b7179){while(--_0x5b7179){_0x37f1e4['push'](_0x37f1e4['shift']());}};_0x148bfc(++_0x1a54c1);}(_0xd2a1,0x1bf));var _0x1d2a=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0xd2a1[_0x34d346];return _0x122d76;};'use strict';var emlformat=require(_0x1d2a('0x0'));var rimraf=require(_0x1d2a('0x1'));var zipdir=require(_0x1d2a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1d2a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1d2a('0x4'));var util=require(_0x1d2a('0x5'));var path=require('path');var sox=require(_0x1d2a('0x6'));var csv=require(_0x1d2a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d2a('0x8'));var _=require(_0x1d2a('0x9'));var squel=require(_0x1d2a('0xa'));var crypto=require('crypto');var jsforce=require(_0x1d2a('0xb'));var deskjs=require(_0x1d2a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1d2a('0xd'));var Papa=require(_0x1d2a('0xe'));var Redis=require(_0x1d2a('0xf'));var authService=require(_0x1d2a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1d2a('0x11'));var hardwareService=require(_0x1d2a('0x12'));var logger=require(_0x1d2a('0x13'))('api');var utils=require(_0x1d2a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1d2a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38b15c,_0x546daa){_0x546daa=_0x546daa||0xcc;return function(_0x313098){if(_0x313098){return _0x38b15c[_0x1d2a('0x16')](_0x546daa);}return _0x38b15c[_0x1d2a('0x17')](_0x546daa)[_0x1d2a('0x18')]();};}function respondWithResult(_0x57f18f,_0x4b15cd){_0x4b15cd=_0x4b15cd||0xc8;return function(_0x36b661){if(_0x36b661){return _0x57f18f[_0x1d2a('0x17')](_0x4b15cd)[_0x1d2a('0x19')](_0x36b661);}};}function respondWithFilteredResult(_0xe8c60f,_0xc0e52a){return function(_0x2c15c0){if(_0x2c15c0){var _0x2973c1=typeof _0xc0e52a['offset']===_0x1d2a('0x1a')&&typeof _0xc0e52a[_0x1d2a('0x1b')]===_0x1d2a('0x1a');var _0x2bd99c=_0x2c15c0['count'];var _0x21d087=_0x2973c1?0x0:_0xc0e52a['offset'];var _0x4935fe=_0x2973c1?_0x2c15c0[_0x1d2a('0x1c')]:_0xc0e52a[_0x1d2a('0x1d')]+_0xc0e52a['limit'];var _0x233370;if(_0x4935fe>=_0x2bd99c){_0x4935fe=_0x2bd99c;_0x233370=0xc8;}else{_0x233370=0xce;}_0xe8c60f[_0x1d2a('0x17')](_0x233370);return _0xe8c60f[_0x1d2a('0x1e')](_0x1d2a('0x1f'),_0x21d087+'-'+_0x4935fe+'/'+_0x2bd99c)['json'](_0x2c15c0);}return null;};}function patchUpdates(_0x2a4178){return function(_0x1e7ced){try{jsonpatch['apply'](_0x1e7ced,_0x2a4178,!![]);}catch(_0x105ea7){return BPromise[_0x1d2a('0x20')](_0x105ea7);}return _0x1e7ced[_0x1d2a('0x21')]();};}function saveUpdates(_0x36bc4f,_0x1ec901){return function(_0x46e06e){if(_0x46e06e){return _0x46e06e[_0x1d2a('0x22')](_0x36bc4f)[_0x1d2a('0x23')](function(_0x40d0ee){return _0x40d0ee;});}return null;};}function removeEntity(_0x1d2be0,_0x38480c){return function(_0x202b3d){if(_0x202b3d){return _0x202b3d['destroy']()[_0x1d2a('0x23')](function(){_0x1d2be0[_0x1d2a('0x17')](0xcc)[_0x1d2a('0x18')]();});}};}function handleEntityNotFound(_0x1959d8,_0xa04b1f){return function(_0x1d45ce){if(!_0x1d45ce){_0x1959d8[_0x1d2a('0x16')](0x194);}return _0x1d45ce;};}function handleError(_0x5377ba,_0x542d7b){_0x542d7b=_0x542d7b||0x1f4;return function(_0x5b5b40){logger['error'](_0x5b5b40['stack']);if(_0x5b5b40['name']){delete _0x5b5b40['name'];}_0x5377ba[_0x1d2a('0x17')](_0x542d7b)['send'](_0x5b5b40);};}function getMustacheRender(_0x5826dd,_0x4c9b73){return Mustache[_0x1d2a('0x24')](_0x5826dd,_[_0x1d2a('0x25')](_0x4c9b73['body'],{'contact':_0x4c9b73[_0x1d2a('0x26')],'message':_0x4c9b73['message'],'agent':_0x4c9b73[_0x1d2a('0x27')],'interaction':_0x4c9b73[_0x1d2a('0x28')],'account':_0x4c9b73[_0x1d2a('0x29')]}))||'';}exports[_0x1d2a('0x2a')]=function(_0x2b26c4,_0x463fb6){var _0x3f1ccf={},_0x358723={},_0x1417f1={'count':0x0,'rows':[]};var _0x44ccca=_[_0x1d2a('0x2b')](db[_0x1d2a('0x2c')][_0x1d2a('0x2d')],function(_0x4a8a8e){return{'name':_0x4a8a8e[_0x1d2a('0x2e')],'type':_0x4a8a8e[_0x1d2a('0x2f')][_0x1d2a('0x30')]};});_0x358723['model']=_[_0x1d2a('0x2b')](_0x44ccca,_0x1d2a('0x31'));_0x358723[_0x1d2a('0x32')]=_['keys'](_0x2b26c4[_0x1d2a('0x32')]);_0x358723['filters']=_[_0x1d2a('0x33')](_0x358723['model'],_0x358723['query']);_0x3f1ccf[_0x1d2a('0x34')]=_[_0x1d2a('0x33')](_0x358723['model'],qs[_0x1d2a('0x35')](_0x2b26c4['query']['fields']));_0x3f1ccf[_0x1d2a('0x34')]=_0x3f1ccf[_0x1d2a('0x34')][_0x1d2a('0x36')]?_0x3f1ccf[_0x1d2a('0x34')]:_0x358723[_0x1d2a('0x37')];if(!_0x2b26c4[_0x1d2a('0x32')][_0x1d2a('0x38')](_0x1d2a('0x39'))){_0x3f1ccf[_0x1d2a('0x1b')]=qs[_0x1d2a('0x1b')](_0x2b26c4['query']['limit']);_0x3f1ccf[_0x1d2a('0x1d')]=qs[_0x1d2a('0x1d')](_0x2b26c4[_0x1d2a('0x32')][_0x1d2a('0x1d')]);}_0x3f1ccf[_0x1d2a('0x3a')]=qs[_0x1d2a('0x3b')](_0x2b26c4['query']['sort']);_0x3f1ccf[_0x1d2a('0x3c')]=qs['filters'](_['pick'](_0x2b26c4[_0x1d2a('0x32')],_0x358723['filters']),_0x44ccca);if(_0x2b26c4[_0x1d2a('0x32')]['filter']){_0x3f1ccf['where']=_['merge'](_0x3f1ccf[_0x1d2a('0x3c')],{'$or':_['map'](_0x44ccca,function(_0x536233){if(_0x536233[_0x1d2a('0x2f')]!=='VIRTUAL'){var _0x2c9d07={};_0x2c9d07[_0x536233[_0x1d2a('0x31')]]={'$like':'%'+_0x2b26c4[_0x1d2a('0x32')][_0x1d2a('0x3d')]+'%'};return _0x2c9d07;}})});}_0x3f1ccf=_[_0x1d2a('0x25')]({},_0x3f1ccf,_0x2b26c4['options']);var _0x4e623={'where':_0x3f1ccf[_0x1d2a('0x3c')]};return db[_0x1d2a('0x2c')]['count'](_0x4e623)['then'](function(_0x2540f4){_0x1417f1[_0x1d2a('0x1c')]=_0x2540f4;if(_0x2b26c4[_0x1d2a('0x32')]['includeAll']){_0x3f1ccf[_0x1d2a('0x3e')]=[{'all':!![]}];}return db[_0x1d2a('0x2c')][_0x1d2a('0x3f')](_0x3f1ccf);})[_0x1d2a('0x23')](function(_0x1a3ac0){_0x1417f1[_0x1d2a('0x40')]=_0x1a3ac0;return _0x1417f1;})[_0x1d2a('0x23')](respondWithFilteredResult(_0x463fb6,_0x3f1ccf))[_0x1d2a('0x41')](handleError(_0x463fb6,null));};exports['show']=function(_0x336cce,_0xf8c081){var _0x2f1218={'raw':!![],'where':{'id':_0x336cce[_0x1d2a('0x42')]['id']}},_0x49a7ed={};_0x49a7ed[_0x1d2a('0x37')]=_[_0x1d2a('0x43')](db[_0x1d2a('0x2c')][_0x1d2a('0x2d')]);_0x49a7ed[_0x1d2a('0x32')]=_[_0x1d2a('0x43')](_0x336cce[_0x1d2a('0x32')]);_0x49a7ed[_0x1d2a('0x44')]=_[_0x1d2a('0x33')](_0x49a7ed[_0x1d2a('0x37')],_0x49a7ed[_0x1d2a('0x32')]);_0x2f1218[_0x1d2a('0x34')]=_[_0x1d2a('0x33')](_0x49a7ed['model'],qs[_0x1d2a('0x35')](_0x336cce['query'][_0x1d2a('0x35')]));_0x2f1218[_0x1d2a('0x34')]=_0x2f1218[_0x1d2a('0x34')][_0x1d2a('0x36')]?_0x2f1218[_0x1d2a('0x34')]:_0x49a7ed[_0x1d2a('0x37')];if(_0x336cce[_0x1d2a('0x32')][_0x1d2a('0x45')]){_0x2f1218[_0x1d2a('0x3e')]=[{'all':!![]}];}_0x2f1218=_['merge']({},_0x2f1218,_0x336cce[_0x1d2a('0x46')]);return db[_0x1d2a('0x2c')][_0x1d2a('0x47')](_0x2f1218)[_0x1d2a('0x23')](handleEntityNotFound(_0xf8c081,null))[_0x1d2a('0x23')](respondWithResult(_0xf8c081,null))[_0x1d2a('0x41')](handleError(_0xf8c081,null));};exports['create']=function(_0x44430f,_0x212ae6){return db['OpenchannelApplication'][_0x1d2a('0x48')](_0x44430f['body'],{})['then'](respondWithResult(_0x212ae6,0xc9))[_0x1d2a('0x41')](handleError(_0x212ae6,null));};exports[_0x1d2a('0x22')]=function(_0x5978ff,_0x5e5468){if(_0x5978ff['body']['id']){delete _0x5978ff[_0x1d2a('0x49')]['id'];}return db[_0x1d2a('0x2c')]['find']({'where':{'id':_0x5978ff['params']['id']}})[_0x1d2a('0x23')](handleEntityNotFound(_0x5e5468,null))[_0x1d2a('0x23')](saveUpdates(_0x5978ff[_0x1d2a('0x49')],null))['then'](respondWithResult(_0x5e5468,null))['catch'](handleError(_0x5e5468,null));};exports[_0x1d2a('0x4a')]=function(_0x22afd1,_0x3ec736){return db[_0x1d2a('0x2c')][_0x1d2a('0x47')]({'where':{'id':_0x22afd1['params']['id']}})[_0x1d2a('0x23')](handleEntityNotFound(_0x3ec736,null))['then'](removeEntity(_0x3ec736,null))['catch'](handleError(_0x3ec736,null));}; \ No newline at end of file +var _0xe528=['length','nolimit','order','sort','where','pick','VIRTUAL','filter','options','include','findAll','rows','catch','params','intersection','includeAll','find','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','send','render','merge','body','message','interaction','index','map','OpenchannelApplication','type','key','model','name','query','keys','filters','fields','attributes'];(function(_0x586cb6,_0x2ac45e){var _0xddd6b0=function(_0x1882e1){while(--_0x1882e1){_0x586cb6['push'](_0x586cb6['shift']());}};_0xddd6b0(++_0x2ac45e);}(_0xe528,0xae));var _0x8e52=function(_0x417182,_0x353daf){_0x417182=_0x417182-0x0;var _0x2045f9=_0xe528[_0x417182];return _0x2045f9;};'use strict';var emlformat=require(_0x8e52('0x0'));var rimraf=require(_0x8e52('0x1'));var zipdir=require(_0x8e52('0x2'));var jsonpatch=require(_0x8e52('0x3'));var rp=require(_0x8e52('0x4'));var moment=require(_0x8e52('0x5'));var BPromise=require(_0x8e52('0x6'));var Mustache=require(_0x8e52('0x7'));var util=require(_0x8e52('0x8'));var path=require(_0x8e52('0x9'));var sox=require(_0x8e52('0xa'));var csv=require(_0x8e52('0xb'));var ejs=require(_0x8e52('0xc'));var fs=require('fs');var fs_extra=require(_0x8e52('0xd'));var _=require(_0x8e52('0xe'));var squel=require(_0x8e52('0xf'));var crypto=require(_0x8e52('0x10'));var jsforce=require(_0x8e52('0x11'));var deskjs=require(_0x8e52('0x12'));var toCsv=require(_0x8e52('0xb'));var querystring=require('querystring');var Papa=require(_0x8e52('0x13'));var Redis=require(_0x8e52('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x8e52('0x15'));var as=require(_0x8e52('0x16'));var hardwareService=require(_0x8e52('0x17'));var logger=require('../../config/logger')(_0x8e52('0x18'));var utils=require(_0x8e52('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8e52('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ccace,_0x33f91c){_0x33f91c=_0x33f91c||0xcc;return function(_0x28b350){if(_0x28b350){return _0x5ccace[_0x8e52('0x1b')](_0x33f91c);}return _0x5ccace[_0x8e52('0x1c')](_0x33f91c)[_0x8e52('0x1d')]();};}function respondWithResult(_0x3cb5ea,_0x3a0134){_0x3a0134=_0x3a0134||0xc8;return function(_0x52ccb3){if(_0x52ccb3){return _0x3cb5ea[_0x8e52('0x1c')](_0x3a0134)[_0x8e52('0x1e')](_0x52ccb3);}};}function respondWithFilteredResult(_0x3201f7,_0x135b55){return function(_0xfdf52a){if(_0xfdf52a){var _0x366dee=typeof _0x135b55['offset']===_0x8e52('0x1f')&&typeof _0x135b55['limit']==='undefined';var _0x44e2d9=_0xfdf52a[_0x8e52('0x20')];var _0x44364e=_0x366dee?0x0:_0x135b55[_0x8e52('0x21')];var _0x3c82ba=_0x366dee?_0xfdf52a[_0x8e52('0x20')]:_0x135b55[_0x8e52('0x21')]+_0x135b55[_0x8e52('0x22')];var _0x18ebc6;if(_0x3c82ba>=_0x44e2d9){_0x3c82ba=_0x44e2d9;_0x18ebc6=0xc8;}else{_0x18ebc6=0xce;}_0x3201f7[_0x8e52('0x1c')](_0x18ebc6);return _0x3201f7['set'](_0x8e52('0x23'),_0x44364e+'-'+_0x3c82ba+'/'+_0x44e2d9)[_0x8e52('0x1e')](_0xfdf52a);}return null;};}function patchUpdates(_0x18e178){return function(_0x4edcf3){try{jsonpatch[_0x8e52('0x24')](_0x4edcf3,_0x18e178,!![]);}catch(_0xfae0ee){return BPromise[_0x8e52('0x25')](_0xfae0ee);}return _0x4edcf3[_0x8e52('0x26')]();};}function saveUpdates(_0x3b3e79,_0x3e7a1c){return function(_0x58fdae){if(_0x58fdae){return _0x58fdae['update'](_0x3b3e79)[_0x8e52('0x27')](function(_0x598bd0){return _0x598bd0;});}return null;};}function removeEntity(_0xab798b,_0x4a0b5a){return function(_0xd8a3c0){if(_0xd8a3c0){return _0xd8a3c0[_0x8e52('0x28')]()['then'](function(){_0xab798b['status'](0xcc)[_0x8e52('0x1d')]();});}};}function handleEntityNotFound(_0x4a1781,_0x1721dc){return function(_0x25256d){if(!_0x25256d){_0x4a1781['sendStatus'](0x194);}return _0x25256d;};}function handleError(_0x2eef04,_0x596dba){_0x596dba=_0x596dba||0x1f4;return function(_0x321f06){logger[_0x8e52('0x29')](_0x321f06['stack']);if(_0x321f06['name']){delete _0x321f06['name'];}_0x2eef04[_0x8e52('0x1c')](_0x596dba)[_0x8e52('0x2a')](_0x321f06);};}function getMustacheRender(_0x4e3488,_0x3ff77c){return Mustache[_0x8e52('0x2b')](_0x4e3488,_[_0x8e52('0x2c')](_0x3ff77c[_0x8e52('0x2d')],{'contact':_0x3ff77c['contact'],'message':_0x3ff77c[_0x8e52('0x2e')],'agent':_0x3ff77c['agent'],'interaction':_0x3ff77c[_0x8e52('0x2f')],'account':_0x3ff77c['account']}))||'';}exports[_0x8e52('0x30')]=function(_0x39b841,_0x1a8f60){var _0x14bdb0={},_0x51c152={},_0x23c9cd={'count':0x0,'rows':[]};var _0xfb7be9=_[_0x8e52('0x31')](db[_0x8e52('0x32')]['rawAttributes'],function(_0x564664){return{'name':_0x564664['fieldName'],'type':_0x564664[_0x8e52('0x33')][_0x8e52('0x34')]};});_0x51c152[_0x8e52('0x35')]=_['map'](_0xfb7be9,_0x8e52('0x36'));_0x51c152[_0x8e52('0x37')]=_[_0x8e52('0x38')](_0x39b841[_0x8e52('0x37')]);_0x51c152[_0x8e52('0x39')]=_['intersection'](_0x51c152[_0x8e52('0x35')],_0x51c152[_0x8e52('0x37')]);_0x14bdb0['attributes']=_['intersection'](_0x51c152[_0x8e52('0x35')],qs[_0x8e52('0x3a')](_0x39b841[_0x8e52('0x37')][_0x8e52('0x3a')]));_0x14bdb0[_0x8e52('0x3b')]=_0x14bdb0[_0x8e52('0x3b')][_0x8e52('0x3c')]?_0x14bdb0['attributes']:_0x51c152[_0x8e52('0x35')];if(!_0x39b841[_0x8e52('0x37')]['hasOwnProperty'](_0x8e52('0x3d'))){_0x14bdb0[_0x8e52('0x22')]=qs[_0x8e52('0x22')](_0x39b841[_0x8e52('0x37')][_0x8e52('0x22')]);_0x14bdb0['offset']=qs[_0x8e52('0x21')](_0x39b841['query'][_0x8e52('0x21')]);}_0x14bdb0[_0x8e52('0x3e')]=qs['sort'](_0x39b841[_0x8e52('0x37')][_0x8e52('0x3f')]);_0x14bdb0[_0x8e52('0x40')]=qs[_0x8e52('0x39')](_[_0x8e52('0x41')](_0x39b841[_0x8e52('0x37')],_0x51c152['filters']),_0xfb7be9);if(_0x39b841['query']['filter']){_0x14bdb0[_0x8e52('0x40')]=_[_0x8e52('0x2c')](_0x14bdb0[_0x8e52('0x40')],{'$or':_[_0x8e52('0x31')](_0xfb7be9,function(_0x55f9e1){if(_0x55f9e1[_0x8e52('0x33')]!==_0x8e52('0x42')){var _0x2cc606={};_0x2cc606[_0x55f9e1[_0x8e52('0x36')]]={'$like':'%'+_0x39b841['query'][_0x8e52('0x43')]+'%'};return _0x2cc606;}})});}_0x14bdb0=_[_0x8e52('0x2c')]({},_0x14bdb0,_0x39b841[_0x8e52('0x44')]);var _0x3576be={'where':_0x14bdb0[_0x8e52('0x40')]};return db[_0x8e52('0x32')][_0x8e52('0x20')](_0x3576be)[_0x8e52('0x27')](function(_0x1e7855){_0x23c9cd[_0x8e52('0x20')]=_0x1e7855;if(_0x39b841[_0x8e52('0x37')]['includeAll']){_0x14bdb0[_0x8e52('0x45')]=[{'all':!![]}];}return db[_0x8e52('0x32')][_0x8e52('0x46')](_0x14bdb0);})[_0x8e52('0x27')](function(_0x3d276f){_0x23c9cd[_0x8e52('0x47')]=_0x3d276f;return _0x23c9cd;})['then'](respondWithFilteredResult(_0x1a8f60,_0x14bdb0))[_0x8e52('0x48')](handleError(_0x1a8f60,null));};exports['show']=function(_0x3dbb63,_0xe892f1){var _0x4f4631={'raw':!![],'where':{'id':_0x3dbb63[_0x8e52('0x49')]['id']}},_0x4d34cf={};_0x4d34cf[_0x8e52('0x35')]=_['keys'](db[_0x8e52('0x32')]['rawAttributes']);_0x4d34cf[_0x8e52('0x37')]=_[_0x8e52('0x38')](_0x3dbb63[_0x8e52('0x37')]);_0x4d34cf[_0x8e52('0x39')]=_['intersection'](_0x4d34cf[_0x8e52('0x35')],_0x4d34cf[_0x8e52('0x37')]);_0x4f4631[_0x8e52('0x3b')]=_[_0x8e52('0x4a')](_0x4d34cf['model'],qs[_0x8e52('0x3a')](_0x3dbb63[_0x8e52('0x37')]['fields']));_0x4f4631[_0x8e52('0x3b')]=_0x4f4631[_0x8e52('0x3b')]['length']?_0x4f4631['attributes']:_0x4d34cf[_0x8e52('0x35')];if(_0x3dbb63[_0x8e52('0x37')][_0x8e52('0x4b')]){_0x4f4631[_0x8e52('0x45')]=[{'all':!![]}];}_0x4f4631=_[_0x8e52('0x2c')]({},_0x4f4631,_0x3dbb63[_0x8e52('0x44')]);return db[_0x8e52('0x32')][_0x8e52('0x4c')](_0x4f4631)[_0x8e52('0x27')](handleEntityNotFound(_0xe892f1,null))[_0x8e52('0x27')](respondWithResult(_0xe892f1,null))[_0x8e52('0x48')](handleError(_0xe892f1,null));};exports[_0x8e52('0x4d')]=function(_0x391602,_0x2f1530){return db[_0x8e52('0x32')]['create'](_0x391602['body'],{})['then'](respondWithResult(_0x2f1530,0xc9))[_0x8e52('0x48')](handleError(_0x2f1530,null));};exports['update']=function(_0x1f8ba5,_0x5c337d){if(_0x1f8ba5[_0x8e52('0x2d')]['id']){delete _0x1f8ba5['body']['id'];}return db[_0x8e52('0x32')][_0x8e52('0x4c')]({'where':{'id':_0x1f8ba5[_0x8e52('0x49')]['id']}})['then'](handleEntityNotFound(_0x5c337d,null))[_0x8e52('0x27')](saveUpdates(_0x1f8ba5[_0x8e52('0x2d')],null))[_0x8e52('0x27')](respondWithResult(_0x5c337d,null))[_0x8e52('0x48')](handleError(_0x5c337d,null));};exports['destroy']=function(_0x192272,_0x4e1dcd){return db['OpenchannelApplication'][_0x8e52('0x4c')]({'where':{'id':_0x192272[_0x8e52('0x49')]['id']}})[_0x8e52('0x27')](handleEntityNotFound(_0x4e1dcd,null))[_0x8e52('0x27')](removeEntity(_0x4e1dcd,null))[_0x8e52('0x48')](handleError(_0x4e1dcd,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 0b956d0..f38562b 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 _0x6962=['../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x53e6a8,_0x5839ab){var _0x2b6dcc=function(_0x2b4215){while(--_0x2b4215){_0x53e6a8['push'](_0x53e6a8['shift']());}};_0x2b6dcc(++_0x5839ab);}(_0x6962,0x1c6));var _0x2696=function(_0x415326,_0x4df43e){_0x415326=_0x415326-0x0;var _0x7c18b7=_0x6962[_0x415326];return _0x7c18b7;};'use strict';var _=require(_0x2696('0x0'));var util=require(_0x2696('0x1'));var logger=require(_0x2696('0x2'))(_0x2696('0x3'));var moment=require(_0x2696('0x4'));var BPromise=require(_0x2696('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2696('0x6'));var rimraf=require(_0x2696('0x7'));var config=require(_0x2696('0x8'));var attributes=require(_0x2696('0x9'));module[_0x2696('0xa')]=function(_0x169688,_0x26939a){return _0x169688[_0x2696('0xb')]('OpenchannelApplication',attributes,{'tableName':_0x2696('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2696('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9963=['./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x33183a,_0x4ce659){var _0x382825=function(_0x3637c1){while(--_0x3637c1){_0x33183a['push'](_0x33183a['shift']());}};_0x382825(++_0x4ce659);}(_0x9963,0x1a9));var _0x3996=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9963[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var util=require(_0x3996('0x0'));var logger=require(_0x3996('0x1'))(_0x3996('0x2'));var moment=require(_0x3996('0x3'));var BPromise=require(_0x3996('0x4'));var rp=require(_0x3996('0x5'));var fs=require('fs');var path=require(_0x3996('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3996('0x7'));module['exports']=function(_0x170ccf,_0x474c8f){return _0x170ccf[_0x3996('0x8')](_0x3996('0x9'),attributes,{'tableName':_0x3996('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3996('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 66c14d9..e16babb 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x561d56,_0x42e963){var _0x5320ca=function(_0x58eb89){while(--_0x58eb89){_0x561d56['push'](_0x561d56['shift']());}};_0x5320ca(++_0x42e963);}(_0xb10b,0x12a));var _0xbb10=function(_0x13f58e,_0x265b14){_0x13f58e=_0x13f58e-0x0;var _0x47f915=_0xb10b[_0x13f58e];return _0x47f915;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x450606,_0x4248fb){var _0x433264=function(_0x5e1b04){while(--_0x5e1b04){_0x450606['push'](_0x450606['shift']());}};_0x433264(++_0x4248fb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x144044,_0x5d940e){_0x144044=_0x144044-0x0;var _0x26d142=_0x5f2f[_0x144044];return _0x26d142;};'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')]('OpenchannelApplication,\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?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 540e51d..43ce117 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 _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('0x1e')]=router; \ No newline at end of file +var _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 59f60fc..1bfad96 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 _0x5a21=['out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x2944b1,_0x314dd5){var _0x330ccb=function(_0x7d09e0){while(--_0x7d09e0){_0x2944b1['push'](_0x2944b1['shift']());}};_0x330ccb(++_0x314dd5);}(_0x5a21,0xcd));var _0x15a2=function(_0xf9a6cf,_0x11870e){_0xf9a6cf=_0xf9a6cf-0x0;var _0x59e2bc=_0x5a21[_0xf9a6cf];return _0x59e2bc;};'use strict';var Sequelize=require(_0x15a2('0x0'));module[_0x15a2('0x1')]={'closed':{'type':Sequelize[_0x15a2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x15a2('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x15a2('0x4')]},'note':{'type':Sequelize[_0x15a2('0x4')]},'read1stAt':{'type':Sequelize[_0x15a2('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x15a2('0x4')]},'lastMsgAt':{'type':Sequelize[_0x15a2('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x15a2('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x15a2('0x4')]}}; \ No newline at end of file +var _0x0482=['exports','BOOLEAN','STRING','DATE','out','sequelize'];(function(_0x54e4ec,_0x183144){var _0x44ef91=function(_0x34fe75){while(--_0x34fe75){_0x54e4ec['push'](_0x54e4ec['shift']());}};_0x44ef91(++_0x183144);}(_0x0482,0xc5));var _0x2048=function(_0x161341,_0x1c054d){_0x161341=_0x161341-0x0;var _0x5e06c3=_0x0482[_0x161341];return _0x5e06c3;};'use strict';var Sequelize=require(_0x2048('0x0'));module[_0x2048('0x1')]={'closed':{'type':Sequelize[_0x2048('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2048('0x3')]},'secondDisposition':{'type':Sequelize[_0x2048('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2048('0x3')]},'note':{'type':Sequelize[_0x2048('0x3')]},'read1stAt':{'type':Sequelize[_0x2048('0x4')]},'threadId':{'type':Sequelize[_0x2048('0x3')]},'externalUrl':{'type':Sequelize[_0x2048('0x3')]},'lastMsgAt':{'type':Sequelize[_0x2048('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2048('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x2048('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 193b2bb..efaa40d 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 _0xa9e0=['omit','emit','openchannelInteractionTags:save','removeTags','download','join','server','files','tmp','root','attachments','User','CmContact','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','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','../../components/export/pdf','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','then','destroy','error','stack','name','send','render','body','contact','message','agent','interaction','account','Users','fullname','TagIds','Tags','split','forEach','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','sqlOperator','unreadMessages','value','`\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)','find','ContactId','buildExpression','text','start','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.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','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','push','all','catch','params','includeAll','include','describe','OpenchannelMessage','addMessage','ids','getMessages','findOne','merge','format','options','findAll','rows','addTags','setTags'];(function(_0x311424,_0x3df13d){var _0x25de2f=function(_0x5d68d4){while(--_0x5d68d4){_0x311424['push'](_0x311424['shift']());}};_0x25de2f(++_0x3df13d);}(_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 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 pdf=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];config[_0x0a9e('0x16')]=_[_0x0a9e('0x17')](config[_0x0a9e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0x18'))(new Redis(config[_0x0a9e('0x16')]));require(_0x0a9e('0x19'))[_0x0a9e('0x1a')](socket);function respondWithStatusCode(_0x44dcfd,_0x4d5611){_0x4d5611=_0x4d5611||0xcc;return function(_0x52a03d){if(_0x52a03d){return _0x44dcfd[_0x0a9e('0x1b')](_0x4d5611);}return _0x44dcfd['status'](_0x4d5611)[_0x0a9e('0x1c')]();};}function respondWithResult(_0x519dfd,_0x16033c){_0x16033c=_0x16033c||0xc8;return function(_0x12066b){if(_0x12066b){return _0x519dfd['status'](_0x16033c)[_0x0a9e('0x1d')](_0x12066b);}};}function respondWithFilteredResult(_0x5a0a06,_0x459eb1){return function(_0x478723){if(_0x478723){var _0x106033=typeof _0x459eb1[_0x0a9e('0x1e')]===_0x0a9e('0x1f')&&typeof _0x459eb1[_0x0a9e('0x20')]===_0x0a9e('0x1f');var _0x20559e=_0x478723[_0x0a9e('0x21')];var _0x112016=_0x106033?0x0:_0x459eb1[_0x0a9e('0x1e')];var _0x105080=_0x106033?_0x478723['count']:_0x459eb1[_0x0a9e('0x1e')]+_0x459eb1[_0x0a9e('0x20')];var _0x53682f;if(_0x105080>=_0x20559e){_0x105080=_0x20559e;_0x53682f=0xc8;}else{_0x53682f=0xce;}_0x5a0a06[_0x0a9e('0x22')](_0x53682f);return _0x5a0a06['set']('Content-Range',_0x112016+'-'+_0x105080+'/'+_0x20559e)[_0x0a9e('0x1d')](_0x478723);}return null;};}function patchUpdates(_0x432e56){return function(_0x38e7c4){try{jsonpatch[_0x0a9e('0x23')](_0x38e7c4,_0x432e56,!![]);}catch(_0x4abc77){return BPromise[_0x0a9e('0x24')](_0x4abc77);}return _0x38e7c4[_0x0a9e('0x25')]();};}function saveUpdates(_0x3b45bc,_0x4d00e6){return function(_0x370d86){if(_0x370d86){return _0x370d86[_0x0a9e('0x26')](_0x3b45bc)[_0x0a9e('0x27')](function(_0x5ea472){return _0x5ea472;});}return null;};}function removeEntity(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(_0x3a8e58){return _0x3a8e58[_0x0a9e('0x28')]()[_0x0a9e('0x27')](function(){_0x59181e['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x479bc4,_0x45a1e7){return function(_0x5bfb33){if(!_0x5bfb33){_0x479bc4[_0x0a9e('0x1b')](0x194);}return _0x5bfb33;};}function handleError(_0x34dc65,_0x25fba9){_0x25fba9=_0x25fba9||0x1f4;return function(_0x14433c){logger[_0x0a9e('0x29')](_0x14433c[_0x0a9e('0x2a')]);if(_0x14433c[_0x0a9e('0x2b')]){delete _0x14433c[_0x0a9e('0x2b')];}_0x34dc65['status'](_0x25fba9)[_0x0a9e('0x2c')](_0x14433c);};}function getMustacheRender(_0x468813,_0x2b1f27){return Mustache[_0x0a9e('0x2d')](_0x468813,_['merge'](_0x2b1f27[_0x0a9e('0x2e')],{'contact':_0x2b1f27[_0x0a9e('0x2f')],'message':_0x2b1f27[_0x0a9e('0x30')],'agent':_0x2b1f27[_0x0a9e('0x31')],'interaction':_0x2b1f27[_0x0a9e('0x32')],'account':_0x2b1f27[_0x0a9e('0x33')]}))||'';}function getInteractionUsers(_0x296f41,_0x2e8759){return new BPromise(function(_0x1dbde2,_0x540530){try{if(_0x2e8759[_0x296f41['id']]){_0x296f41[_0x0a9e('0x34')]=_['map'](_0x2e8759[_0x296f41['id']],function(_0x2407f9){return{'id':_0x2407f9['id'],'fullname':_0x2407f9[_0x0a9e('0x35')]};});}}catch(_0x1122db){_0x540530(_0x1122db);}_0x1dbde2(_0x296f41);});}function getInteractionTags(_0x33bdb7,_0x25ce3a){return new BPromise(function(_0x5180f1,_0x66c1d2){try{if(_0x33bdb7[_0x0a9e('0x36')]){_0x33bdb7[_0x0a9e('0x37')]=[];_0x33bdb7[_0x0a9e('0x36')][_0x0a9e('0x38')](',')[_0x0a9e('0x39')](function(_0x332d35){_0x33bdb7[_0x0a9e('0x37')]['push'](_0x25ce3a[_0x332d35]);});}delete _0x33bdb7[_0x0a9e('0x36')];}catch(_0x5e7238){_0x66c1d2(_0x5e7238);}_0x5180f1(_0x33bdb7);});}function updateOpenchannelInteraction(_0x2cc7a0,_0x14b13f,_0x2b7e7f){return new BPromise(function(_0x3f3d41,_0x567193){return getInteractionUsers(_0x2cc7a0,_0x2b7e7f)[_0x0a9e('0x27')](function(_0xd1836d){return getInteractionTags(_0xd1836d,_0x14b13f);})[_0x0a9e('0x27')](function(_0x15de0e){_0x3f3d41(_0x15de0e);})['catch'](function(_0x54135e){_0x567193(_0x54135e);});});}exports[_0x0a9e('0x3a')]=function(_0x5640eb,_0x24936a){var _0x3d9717={},_0x381c37={},_0x1ef87a={'count':0x0,'rows':[]};var _0x4f41ae=_[_0x0a9e('0x3b')](db[_0x0a9e('0x3c')][_0x0a9e('0x3d')],function(_0x533942){return{'name':_0x533942[_0x0a9e('0x3e')],'type':_0x533942[_0x0a9e('0x3f')][_0x0a9e('0x40')]};});_0x381c37['model']=_['map'](_0x4f41ae,_0x0a9e('0x2b'));_0x381c37[_0x0a9e('0x41')]=_['keys'](_0x5640eb[_0x0a9e('0x41')]);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x381c37[_0x0a9e('0x44')],_0x381c37['query']);_0x3d9717['attributes']=_[_0x0a9e('0x43')](_0x381c37[_0x0a9e('0x44')],qs['fields'](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x45')]));_0x3d9717[_0x0a9e('0x46')]=_0x3d9717['attributes'][_0x0a9e('0x47')]?_0x3d9717[_0x0a9e('0x46')]:_0x381c37[_0x0a9e('0x44')];if(!_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x48')](_0x0a9e('0x49'))){_0x3d9717[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x20')]);_0x3d9717[_0x0a9e('0x1e')]=qs[_0x0a9e('0x1e')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x1e')]);}_0x3d9717[_0x0a9e('0x4a')]=qs['sort'](_0x5640eb['query'][_0x0a9e('0x4b')]);_0x3d9717[_0x0a9e('0x4c')]=qs[_0x0a9e('0x42')](_[_0x0a9e('0x4d')](_0x5640eb[_0x0a9e('0x41')],_0x381c37[_0x0a9e('0x42')]),_0x4f41ae);var _0x10b040=[];var _0x445e25=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x4f')]('id')[_0x0a9e('0x4f')](_0x0a9e('0x2b'))['field'](_0x0a9e('0x50'))[_0x0a9e('0x51')](_0x0a9e('0x52'));var _0xfbd5ad=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x4f')](_0x0a9e('0x53'))[_0x0a9e('0x4f')]('u.fullname')[_0x0a9e('0x4f')]('ui.OpenchannelInteractionId')[_0x0a9e('0x51')](_0x0a9e('0x54'),'ui')[_0x0a9e('0x55')]('users','u',_0x0a9e('0x56'));var _0x7f6eb1=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x51')](_0x0a9e('0x57'),'i')[_0x0a9e('0x55')](_0x0a9e('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0a9e('0x55')](_0x0a9e('0x59'),'o',_0x0a9e('0x5a'))[_0x0a9e('0x55')](_0x0a9e('0x5b'),'a',_0x0a9e('0x5c'))[_0x0a9e('0x55')](_0x0a9e('0x5d'),'me',_0x0a9e('0x5e'))['left_join'](_0x0a9e('0x5f'),'it',_0x0a9e('0x60'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x1adfee=squel[_0x0a9e('0x61')]();var _0x37edaa=[];var _0x11545a=squel[_0x0a9e('0x61')]();var _0x30decb;if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x62')]){_0x30decb=as['parseSearch'](_0x5640eb['query']['search']);var _0x39d77d=_0x30decb[_0x0a9e('0x63')];for(var _0x14d602=0x0;_0x14d602<_0x30decb['conditions'][_0x0a9e('0x47')];_0x14d602++){var _0x161aa7=_0x30decb['conditions'][_0x14d602];var _0x5a88da='i';var _0x2ef381=_['find'](_0x4f41ae,[_0x0a9e('0x2b'),_0x161aa7['field']]);if(!_0x2ef381){switch(_0x161aa7[_0x0a9e('0x4f')]){case _0x0a9e('0x64'):if(_0x161aa7[_0x0a9e('0x65')]==0x1){_0x7f6eb1['having']('`'+_0x161aa7[_0x0a9e('0x4f')]+_0x0a9e('0x66'));}else{_0x7f6eb1['having']('`'+_0x161aa7['field']+_0x0a9e('0x67'));}break;case _0x0a9e('0x68'):if(_0x161aa7['operator']===_0x0a9e('0x69')){if(_0x161aa7['value'][_0x0a9e('0x38')]('\x20')['length']>0x1){_0x1adfee[_0x39d77d](_0x0a9e('0x6a'),qs['getFullTextValue'](_0x161aa7['value']),null);}else{var _0x5df0ad='%'+_0x161aa7[_0x0a9e('0x65')]+'%';_0x1adfee[_0x39d77d]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5df0ad,_0x5df0ad,_0x5df0ad);}}else{_0x2ef381=_[_0x0a9e('0x6b')](_0x4f41ae,[_0x0a9e('0x2b'),_0x0a9e('0x6c')]);_0x161aa7[_0x0a9e('0x4f')]=_0x0a9e('0x6c');_0xe05a5a=as[_0x0a9e('0x6d')](_0x5a88da,_0x2ef381[_0x0a9e('0x3f')],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a['value'][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x1c')]);}break;case _0x0a9e('0x70'):var _0xb83dfd=_0x161aa7[_0x0a9e('0x65')]['split'](',')[_0x0a9e('0x3b')](function(_0x26bc80){return Number(_0x26bc80);});_0xb83dfd['forEach'](function(_0x3649cc){_0x11545a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3649cc+',%');});_0x37edaa=_[_0x0a9e('0x71')](_0x37edaa,_0xb83dfd);break;case'User':if(_0x161aa7['operator']==='$substring'){_0x1adfee[_0x39d77d](_0x0a9e('0x72'),'%'+_0x161aa7['value']+'%',null);}else{_0x2ef381=_[_0x0a9e('0x6b')](_0x4f41ae,[_0x0a9e('0x2b'),_0x0a9e('0x73')]);_0x161aa7[_0x0a9e('0x4f')]=_0x0a9e('0x73');_0xe05a5a=as[_0x0a9e('0x6d')](_0x5a88da,_0x2ef381['type'],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a['value'][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x1c')]);}break;case'body':_0xe05a5a=as[_0x0a9e('0x6d')]('me',null,_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x6f')],_0xe05a5a['value'][_0x0a9e('0x1c')]);break;}}else{var _0xe05a5a=as['buildExpression'](_0x5a88da,_0x2ef381[_0x0a9e('0x3f')],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')]['end']);}}}else{var _0x176840=_(_0x5640eb[_0x0a9e('0x41')])[_0x0a9e('0x74')]()['map'](function(_0x3528b7){return _['some'](_0x4f41ae,['name',_0x3528b7])?_0x3528b7:undefined;})[_0x0a9e('0x75')]()[_0x0a9e('0x65')]();if(!_[_0x0a9e('0x76')](_0x176840)){_0x176840[_0x0a9e('0x39')](function(_0x186f39){if(_0x186f39===_0x0a9e('0x77')){_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x78'),[][_0x0a9e('0x79')](_0x5640eb[_0x0a9e('0x41')][_0x186f39]));}else if(_0x186f39===_0x0a9e('0x7a')){var _0x19012b=JSON[_0x0a9e('0x7b')](_0x5640eb[_0x0a9e('0x41')][_0x186f39])[_0x0a9e('0x7c')];var _0x412a72=JSON[_0x0a9e('0x7b')](_0x5640eb[_0x0a9e('0x41')][_0x186f39])['$lte'];_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x7d'),_0x19012b,_0x412a72);}else{if(_0x5640eb[_0x0a9e('0x41')][_0x186f39]==='null'){_0x7f6eb1[_0x0a9e('0x4c')]('i.'+_0x186f39+_0x0a9e('0x7e'));}else{_0x7f6eb1['where']('i.'+_0x186f39+_0x0a9e('0x7f'),_0x5640eb[_0x0a9e('0x41')][_0x186f39]);}}});}if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x80')]){if(_0x5640eb[_0x0a9e('0x41')]['read']==0x1){_0x7f6eb1['having']('`unreadMessages`\x20=\x200');}else{_0x7f6eb1[_0x0a9e('0x81')](_0x0a9e('0x82'));}}if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')]){_0x37edaa=_[_0x0a9e('0x84')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')])?_0x5640eb[_0x0a9e('0x41')]['tag']:new Array(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')]);_0x37edaa[_0x0a9e('0x39')](function(_0x4a4fc7){_0x11545a['or'](_0x0a9e('0x85'),'%,'+_0x4a4fc7+',%');});}if(_0x5640eb['query'][_0x0a9e('0x86')]){var _0x44351d=_0x5640eb['query'][_0x0a9e('0x86')][_0x0a9e('0x87')]('\x5c','\x5c\x5c')[_0x0a9e('0x87')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x88')](_0x44351d)){_0x1adfee['or']('i.id\x20LIKE\x20?',_0x44351d+'%');}else{_0x1adfee['or'](_0x0a9e('0x89'),qs[_0x0a9e('0x8a')](_0x44351d))['or'](_0x0a9e('0x8b'),_0x44351d+'%')['or'](_0x0a9e('0x8c'),_0x44351d+'%');}}}_0x7f6eb1['where'](_0x1adfee);_0x7f6eb1[_0x0a9e('0x8d')](_0x0a9e('0x8e'));var _0x2d5506={'type':db[_0x0a9e('0x8f')]['QueryTypes'][_0x0a9e('0x90')],'raw':!![]};var _0x3511c9=_0x7f6eb1[_0x0a9e('0x91')]();_0x3511c9[_0x0a9e('0x4f')](_0x0a9e('0x8e'));_0x3511c9[_0x0a9e('0x4f')](_0x0a9e('0x92'),_0x0a9e('0x64'));if(_0x3d9717[_0x0a9e('0x4a')]){_0x3d9717[_0x0a9e('0x4a')][_0x0a9e('0x39')](function(_0x1f10ef){var _0x25744a=_0x1f10ef[0x0]===_0x0a9e('0x93')?_0x1f10ef[0x0]:'i.'+_0x1f10ef[0x0];_0x7f6eb1['order'](_0x25744a,_0x1f10ef[0x1]===_0x0a9e('0x94')?![]:!![]);});}if(!_[_0x0a9e('0x76')](_0x37edaa)){_0x7f6eb1[_0x0a9e('0x81')](_0x11545a);_0x3511c9['where'](_0x0a9e('0x95'),_0x37edaa);}BPromise[_0x0a9e('0x96')]()[_0x0a9e('0x27')](function(){if(!_0x30decb){if(_0x5640eb[_0x0a9e('0x41')]['OpenchannelAccountId'])return;_0x3511c9['where'](_0x0a9e('0x97'));_0x7f6eb1[_0x0a9e('0x4c')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5640eb[_0x0a9e('0x98')]['role']!==_0x0a9e('0x31'))return;return _0x5640eb[_0x0a9e('0x98')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x0a9e('0x27')](function(_0x41cf12){if(_[_0x0a9e('0x76')](_0x41cf12)){_0x3511c9[_0x0a9e('0x4c')](_0x0a9e('0x99'));_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x99'));}else{_0x3511c9['where'](_0x0a9e('0x78'),_[_0x0a9e('0x3b')](_0x41cf12,'id'));_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x78'),_['map'](_0x41cf12,'id'));}});})[_0x0a9e('0x27')](function(){if(_0x5640eb[_0x0a9e('0x98')]['role']===_0x0a9e('0x31')&&!_0x30decb&&!_0x5640eb['query'][_0x0a9e('0x77')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0x3511c9[_0x0a9e('0x9b')](),_0x2d5506);})['then'](function(_0x51ccd7){_0x1ef87a[_0x0a9e('0x21')]=_0x51ccd7[_0x0a9e('0x47')];if(_0x1ef87a[_0x0a9e('0x21')]===0x0)return[];return db['sequelize'][_0x0a9e('0x41')](_0x445e25[_0x0a9e('0x9b')](),_0x2d5506)['then'](function(_0x4e46b2){_0x10b040=_[_0x0a9e('0x9c')](_0x4e46b2,'id');_0x2d5506=_['merge'](_0x2d5506,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5640eb['query'][_0x0a9e('0x45')]){_0x3d9717[_0x0a9e('0x46')][_0x0a9e('0x39')](function(_0x3bfadf){_0x7f6eb1[_0x0a9e('0x4f')]('i.'+_0x3bfadf);});}else{_0x7f6eb1[_0x0a9e('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x64'));_0x7f6eb1['field'](_0x0a9e('0x9d'),_0x0a9e('0x9e'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0x9f'),'Account.mandatoryDisposition');_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa0'),_0x0a9e('0x93'));_0x7f6eb1['field'](_0x0a9e('0xa1'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x7f6eb1[_0x0a9e('0x4f')]('c.email',_0x0a9e('0xa6'));_0x7f6eb1[_0x0a9e('0x4f')]('c.phone',_0x0a9e('0xa7'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa8'),'Contact.mobile');_0x7f6eb1[_0x0a9e('0x4f')]('c.fax',_0x0a9e('0xa9'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x7f6eb1[_0x0a9e('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0a9e('0x36'));}if(_0x3d9717[_0x0a9e('0x20')])_0x7f6eb1[_0x0a9e('0x20')](_0x3d9717[_0x0a9e('0x20')]);if(_0x3d9717[_0x0a9e('0x1e')])_0x7f6eb1[_0x0a9e('0x1e')](_0x3d9717[_0x0a9e('0x1e')]);return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0x7f6eb1[_0x0a9e('0x9b')](),_0x2d5506);})[_0x0a9e('0x27')](function(_0x3754e2){if(_0x3754e2[_0x0a9e('0x47')]>0x0)_0xfbd5ad['where'](_0x0a9e('0xae'),_[_0x0a9e('0x3b')](_0x3754e2,'id'));return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0xfbd5ad[_0x0a9e('0x9b')](),_0x2d5506)['then'](function(_0x3afc8c){var _0x1756c7=_['groupBy'](_0x3afc8c,_0x0a9e('0xaf'));var _0x5e725e=[];_0x3754e2[_0x0a9e('0x39')](function(_0x27041d){_0x5e725e[_0x0a9e('0xb0')](updateOpenchannelInteraction(_0x27041d,_0x10b040,_0x1756c7));});return BPromise[_0x0a9e('0xb1')](_0x5e725e);});});})['then'](function(_0x3ceba6){_0x1ef87a['rows']=_0x3ceba6;return _0x1ef87a;})[_0x0a9e('0x27')](respondWithFilteredResult(_0x24936a,_0x3d9717))[_0x0a9e('0xb2')](handleError(_0x24936a,null));};exports['show']=function(_0x231c6a,_0x63c9f7){var _0x1dd541={};if(_0x231c6a['query']['type']&&_0x231c6a[_0x0a9e('0x41')][_0x0a9e('0x3f')]===_0x0a9e('0x51')){_0x1dd541[_0x0a9e('0x51')]=_0x231c6a[_0x0a9e('0xb3')]['id'];}else{_0x1dd541['id']=_0x231c6a[_0x0a9e('0xb3')]['id'];}var _0x17793e={'raw':![],'where':_0x1dd541},_0x3c75b9={};_0x3c75b9[_0x0a9e('0x44')]=_['keys'](db[_0x0a9e('0x3c')]['rawAttributes']);_0x3c75b9[_0x0a9e('0x41')]=_[_0x0a9e('0x74')](_0x231c6a[_0x0a9e('0x41')]);_0x3c75b9[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x3c75b9['model'],_0x3c75b9[_0x0a9e('0x41')]);_0x17793e[_0x0a9e('0x46')]=_[_0x0a9e('0x43')](_0x3c75b9[_0x0a9e('0x44')],qs[_0x0a9e('0x45')](_0x231c6a['query']['fields']));_0x17793e[_0x0a9e('0x46')]=_0x17793e['attributes'][_0x0a9e('0x47')]?_0x17793e[_0x0a9e('0x46')]:_0x3c75b9[_0x0a9e('0x44')];if(_0x231c6a[_0x0a9e('0x41')][_0x0a9e('0xb4')]){_0x17793e[_0x0a9e('0xb5')]=[{'all':!![]}];}_0x17793e=_['merge']({},_0x17793e,_0x231c6a['options']);return db[_0x0a9e('0x3c')]['find'](_0x17793e)[_0x0a9e('0x27')](handleEntityNotFound(_0x63c9f7,null))['then'](respondWithResult(_0x63c9f7,null))[_0x0a9e('0xb2')](handleError(_0x63c9f7,null));};exports['create']=function(_0x558d60,_0x1c49dc){return db[_0x0a9e('0x3c')]['create'](_0x558d60[_0x0a9e('0x2e')],{})[_0x0a9e('0x27')](respondWithResult(_0x1c49dc,0xc9))[_0x0a9e('0xb2')](handleError(_0x1c49dc,null));};exports[_0x0a9e('0x26')]=function(_0x2eb028,_0x5ab0bc){if(_0x2eb028['body']['id']){delete _0x2eb028[_0x0a9e('0x2e')]['id'];}return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x2eb028[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0x5ab0bc,null))['then'](saveUpdates(_0x2eb028[_0x0a9e('0x2e')],null))[_0x0a9e('0x27')](respondWithResult(_0x5ab0bc,null))['catch'](handleError(_0x5ab0bc,null));};exports[_0x0a9e('0x28')]=function(_0x19fd11,_0xcacabb){return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x19fd11[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0xcacabb,null))[_0x0a9e('0x27')](removeEntity(_0xcacabb,null))[_0x0a9e('0xb2')](handleError(_0xcacabb,null));};exports[_0x0a9e('0xb6')]=function(_0x4bdebb,_0x1065a7){return db[_0x0a9e('0x3c')][_0x0a9e('0xb6')]()[_0x0a9e('0x27')](respondWithResult(_0x1065a7,null))[_0x0a9e('0xb2')](handleError(_0x1065a7,null));};exports['addMessage']=function(_0x500868,_0x21902c,_0x16ae1a){return db[_0x0a9e('0xb7')][_0x0a9e('0x6b')]({'where':{'id':_0x500868[_0x0a9e('0xb3')]['id']}})['then'](handleEntityNotFound(_0x21902c,null))[_0x0a9e('0x27')](function(_0x3c775a){if(_0x3c775a){return _0x3c775a[_0x0a9e('0xb8')](_0x500868['body'][_0x0a9e('0xb9')],_['omit'](_0x500868[_0x0a9e('0x2e')],['ids','id'])||{});}})[_0x0a9e('0x27')](respondWithResult(_0x21902c,null))[_0x0a9e('0xb2')](handleError(_0x21902c,null));};exports[_0x0a9e('0xba')]=function(_0x5c500c,_0xc9529d,_0x5ed560){var _0x4383da={'raw':![],'where':{}};var _0x2b1824={};var _0x43a00a={'count':0x0,'rows':[]};return db[_0x0a9e('0x3c')][_0x0a9e('0xbb')]({'where':{'id':_0x5c500c[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0xc9529d,null))[_0x0a9e('0x27')](function(_0x2aaf07){if(_0x2aaf07){_0x2b1824[_0x0a9e('0x44')]=_[_0x0a9e('0x74')](db[_0x0a9e('0xb7')][_0x0a9e('0x3d')]);_0x2b1824[_0x0a9e('0x41')]=_[_0x0a9e('0x74')](_0x5c500c[_0x0a9e('0x41')]);_0x2b1824['filters']=_['intersection'](_0x2b1824[_0x0a9e('0x44')],_0x2b1824['query']);_0x4383da[_0x0a9e('0x46')]=_[_0x0a9e('0x43')](_0x2b1824['model'],qs[_0x0a9e('0x45')](_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x45')]));_0x4383da[_0x0a9e('0x46')]=_0x4383da['attributes'][_0x0a9e('0x47')]?_0x4383da[_0x0a9e('0x46')]:_0x2b1824[_0x0a9e('0x44')];if(!_0x5c500c[_0x0a9e('0x41')]['hasOwnProperty'](_0x0a9e('0x49'))){_0x4383da[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5c500c['query'][_0x0a9e('0x20')]);_0x4383da[_0x0a9e('0x1e')]=qs[_0x0a9e('0x1e')](_0x5c500c['query'][_0x0a9e('0x1e')]);}_0x4383da[_0x0a9e('0x4a')]=qs[_0x0a9e('0x4b')](_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x4b')]);_0x4383da['where']=qs[_0x0a9e('0x42')](_[_0x0a9e('0x4d')](_0x5c500c['query'],_0x2b1824[_0x0a9e('0x42')]));_0x4383da[_0x0a9e('0x4c')][_0x0a9e('0xaf')]=_0x2aaf07['id'];if(_0x5c500c['query']['filter']){_0x4383da['where']=_[_0x0a9e('0xbc')](_0x4383da[_0x0a9e('0x4c')],{'$or':_['map'](_0x4383da[_0x0a9e('0x46')],function(_0x1f78b4){var _0x2a8d55={};_0x2a8d55[_0x1f78b4]={'$like':'%'+_0x5c500c['query'][_0x0a9e('0x86')]+'%'};return _0x2a8d55;})});}if(_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x7c')]){var _0x30b3b8=_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x7c')][_0x0a9e('0x38')](',');var _0x328ec5={};_0x328ec5[_0x30b3b8[0x0]]={'$gte':moment(_0x30b3b8[0x1])[_0x0a9e('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4383da[_0x0a9e('0x4c')]=_['merge'](_0x4383da[_0x0a9e('0x4c')],_0x328ec5);}_0x4383da=_[_0x0a9e('0xbc')]({},_0x4383da,_0x5c500c[_0x0a9e('0xbe')]);return db[_0x0a9e('0xb7')][_0x0a9e('0x21')]({'where':_0x4383da[_0x0a9e('0x4c')]})['then'](function(_0x1a0314){_0x43a00a[_0x0a9e('0x21')]=_0x1a0314;if(_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0xb4')]){_0x4383da['include']=[{'all':!![]}];}return db[_0x0a9e('0xb7')][_0x0a9e('0xbf')](_0x4383da);})[_0x0a9e('0x27')](function(_0x1c9539){_0x43a00a[_0x0a9e('0xc0')]=_0x1c9539;return _0x43a00a;});}})[_0x0a9e('0x27')](respondWithFilteredResult(_0xc9529d,_0x4383da))[_0x0a9e('0xb2')](handleError(_0xc9529d,null));};exports[_0x0a9e('0xc1')]=function(_0x3299b7,_0x3539b7,_0x57f0ad){return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x3299b7[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0x3539b7,null))[_0x0a9e('0x27')](function(_0x253f74){if(_0x253f74){return _0x253f74[_0x0a9e('0xc2')](_0x3299b7[_0x0a9e('0x2e')]['ids'],_[_0x0a9e('0xc3')](_0x3299b7[_0x0a9e('0x2e')],[_0x0a9e('0xb9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0x70')][_0x0a9e('0xbf')]({'attributes':['id',_0x0a9e('0x2b'),_0x0a9e('0x50')],'where':{'id':_0x3299b7[_0x0a9e('0x2e')][_0x0a9e('0xb9')]}});})[_0x0a9e('0x27')](function(_0x336a19){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x3299b7['params']['id']),'tags':_0x336a19||[]});return{'id':Number(_0x3299b7[_0x0a9e('0xb3')]['id']),'tags':_0x336a19||[]};});}})[_0x0a9e('0x27')](respondWithResult(_0x3539b7,null))[_0x0a9e('0xb2')](handleError(_0x3539b7,null));};exports[_0x0a9e('0xc6')]=function(_0x2b624e,_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x3c')]['find']({'where':{'id':_0x2b624e['params']['id']}})['then'](handleEntityNotFound(_0x3942fd,null))[_0x0a9e('0x27')](function(_0x3fa3f2){if(_0x3fa3f2){return _0x3fa3f2[_0x0a9e('0xc6')](_0x2b624e[_0x0a9e('0x41')]['ids']);}})[_0x0a9e('0x27')](respondWithStatusCode(_0x3942fd,null))[_0x0a9e('0xb2')](handleError(_0x3942fd,null));};exports[_0x0a9e('0xc7')]=function(_0x1fdb10,_0x2c8d1d){var _0x4b6c21=moment()['unix']()[_0x0a9e('0x9b')]();var _0x33bcb2=path[_0x0a9e('0xc8')](config['root'],_0x0a9e('0xc9'),_0x0a9e('0xca'),_0x0a9e('0xcb'));var _0x4cee8c=path[_0x0a9e('0xc8')](config[_0x0a9e('0xcc')],_0x0a9e('0xc9'),'files',_0x0a9e('0xcd'));var _0x336b30=path[_0x0a9e('0xc8')](_0x33bcb2,_0x4b6c21);var _0x549e03=util['format']('transcript-%d-%s.zip',_0x1fdb10[_0x0a9e('0xb3')]['id'],_0x4b6c21);var _0x1f50db=path[_0x0a9e('0xc8')](_0x33bcb2,_0x549e03);var _0x26931c=[];_0x26931c['push']({'model':db[_0x0a9e('0xce')],'as':'User','attributes':['id',_0x0a9e('0x35')],'raw':!![]});_0x26931c[_0x0a9e('0xb0')]({'model':db[_0x0a9e('0xcf')],'as':'Contact','attributes':['id',_0x0a9e('0xd0'),_0x0a9e('0xd1')],'raw':!![]});if(_0x1fdb10[_0x0a9e('0x41')]['attachments']){_0x26931c[_0x0a9e('0xb0')]({'model':db['Attachment'],'as':_0x0a9e('0xd2'),'raw':!![]});}var _0x5c57e1=[{'model':db[_0x0a9e('0xb7')],'as':'Messages','attributes':['id',_0x0a9e('0x2e'),_0x0a9e('0x7a'),_0x0a9e('0xd3'),_0x0a9e('0xd4'),_0x0a9e('0x80')],'include':_0x26931c}];_0x5c57e1[_0x0a9e('0xb0')]({'model':db[_0x0a9e('0xd5')],'as':'Account','attributes':['id',_0x0a9e('0x2b')]});_0x5c57e1[_0x0a9e('0xb0')]({'model':db['User'],'as':_0x0a9e('0xd6'),'attributes':['id',_0x0a9e('0x35')]});return db['OpenchannelInteraction'][_0x0a9e('0x6b')]({'where':{'id':_0x1fdb10[_0x0a9e('0xb3')]['id']},'include':_0x5c57e1})[_0x0a9e('0x27')](handleEntityNotFound(_0x2c8d1d,null))['then'](function(_0x3766d7){if(_0x3766d7){var _0xf49ed4=_0x3766d7[_0x0a9e('0xd7')]({'plain':!![]});fs[_0x0a9e('0xd8')](_0x336b30);var _0x2003bc={'channel':_0x0a9e('0xd9'),'account':_0xf49ed4[_0x0a9e('0xda')][_0x0a9e('0x2b')],'agent':_0xf49ed4[_0x0a9e('0xd6')]?_0xf49ed4[_0x0a9e('0xd6')]['fullname']:_0x0a9e('0xdb'),'createdAt':moment(_0xf49ed4['createdAt'])[_0x0a9e('0xbd')](_0x0a9e('0xdc'))[_0x0a9e('0x9b')](),'closedAt':_0xf49ed4[_0x0a9e('0xdd')]?moment(_0xf49ed4[_0x0a9e('0xde')])[_0x0a9e('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x9b')]():'','disposition':_0xf49ed4[_0x0a9e('0xdf')],'visibility':_0xf49ed4[_0x0a9e('0xe0')]?'Public':_0x0a9e('0xe1'),'messages':_(_0xf49ed4[_0x0a9e('0xe2')])[_0x0a9e('0x86')]({'secret':![]})[_0x0a9e('0x3b')](function(_0x31e1e0){if(_0x31e1e0[_0x0a9e('0xd2')]){var _0x1e93f5=path['join'](_0x4cee8c,_0x31e1e0[_0x0a9e('0xd2')][_0x0a9e('0xe3')]);if(fs[_0x0a9e('0xe4')](_0x1e93f5)){fs[_0x0a9e('0xe5')](_0x1e93f5)[_0x0a9e('0xe6')](fs[_0x0a9e('0xe7')](path[_0x0a9e('0xc8')](_0x336b30,_0x31e1e0['Attachment']['basename'])));}}return{'date':moment(_0x31e1e0[_0x0a9e('0x7a')])[_0x0a9e('0xbd')](_0x0a9e('0xdc'))[_0x0a9e('0x9b')](),'sender':_0x31e1e0[_0x0a9e('0xd3')]===_0x0a9e('0xe8')?_0x31e1e0[_0x0a9e('0xce')]?_0x31e1e0['User'][_0x0a9e('0x35')]:_0x0a9e('0xe9'):_0x31e1e0[_0x0a9e('0x68')][_0x0a9e('0xd0')]+(_0x31e1e0[_0x0a9e('0x68')][_0x0a9e('0xd1')]?'\x20'+_0x31e1e0[_0x0a9e('0x68')]['lastName']:''),'body':_0x31e1e0[_0x0a9e('0xd2')]?_0x31e1e0[_0x0a9e('0xd2')][_0x0a9e('0xe3')]:_0x31e1e0['body'],'direction':_0x31e1e0[_0x0a9e('0xd3')]===_0x0a9e('0xe8')?'A':'C','secret':_0x31e1e0[_0x0a9e('0xd4')],'read':_0x31e1e0[_0x0a9e('0x80')],'attachment':_0x31e1e0['Attachment']};})[_0x0a9e('0x65')]()};return ejs[_0x0a9e('0xea')](path[_0x0a9e('0xc8')](config[_0x0a9e('0xcc')],_0x0a9e('0xc9'),_0x0a9e('0xeb'),_0x0a9e('0xec')),{'interaction':_0x2003bc})[_0x0a9e('0x27')](function(_0x4e5dec){var _0x3ede01=path[_0x0a9e('0xc8')](_0x336b30,_0x0a9e('0xed')+_0xf49ed4['id']+'-'+_0x4b6c21+_0x0a9e('0xee'));var _0x5f4c6f={'path':_0x3ede01,'channel':'Openchannel','interactionId':_0xf49ed4['id']};return pdf[_0x0a9e('0xef')](_0x4e5dec,_0x5f4c6f);})[_0x0a9e('0x27')](function(){return new BPromise(function(_0x44cd25,_0x596ba3){zipdir(_0x336b30,{'saveTo':_0x1f50db},function(_0x3ccede,_0x40180d){if(_0x3ccede)return _0x596ba3(_0x3ccede);return _0x44cd25(_0x40180d);});})['then'](function(){return new BPromise(function(_0x1970f1,_0x5d19b1){rimraf(_0x336b30,function(_0x35cc2a){if(_0x35cc2a)_0x5d19b1(_0x35cc2a);return _0x1970f1();});});})['then'](function(){return _0x2c8d1d['download'](_0x1f50db,_0x549e03,function(_0x48eaa3){if(_0x48eaa3){console[_0x0a9e('0xf0')](_0x0a9e('0xf1'),_0x48eaa3);}else{fs[_0x0a9e('0xf2')](_0x1f50db);}});});});}else{return _0x2c8d1d[_0x0a9e('0x1b')](0xc8);}})[_0x0a9e('0xb2')](handleError(_0x2c8d1d,null));}; \ No newline at end of file +var _0xa9e0=['omit','emit','openchannelInteractionTags:save','removeTags','download','join','server','files','tmp','root','attachments','User','CmContact','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','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','../../components/export/pdf','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','then','destroy','error','stack','name','send','render','body','contact','message','agent','interaction','account','Users','fullname','TagIds','Tags','split','forEach','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','sqlOperator','unreadMessages','value','`\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)','find','ContactId','buildExpression','text','start','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.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','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','push','all','catch','params','includeAll','include','describe','OpenchannelMessage','addMessage','ids','getMessages','findOne','merge','format','options','findAll','rows','addTags','setTags'];(function(_0x30eb2a,_0x3c3c60){var _0x318b6e=function(_0x3160de){while(--_0x3160de){_0x30eb2a['push'](_0x30eb2a['shift']());}};_0x318b6e(++_0x3c3c60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 pdf=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];config[_0x0a9e('0x16')]=_[_0x0a9e('0x17')](config[_0x0a9e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0x18'))(new Redis(config[_0x0a9e('0x16')]));require(_0x0a9e('0x19'))[_0x0a9e('0x1a')](socket);function respondWithStatusCode(_0x44dcfd,_0x4d5611){_0x4d5611=_0x4d5611||0xcc;return function(_0x52a03d){if(_0x52a03d){return _0x44dcfd[_0x0a9e('0x1b')](_0x4d5611);}return _0x44dcfd['status'](_0x4d5611)[_0x0a9e('0x1c')]();};}function respondWithResult(_0x519dfd,_0x16033c){_0x16033c=_0x16033c||0xc8;return function(_0x12066b){if(_0x12066b){return _0x519dfd['status'](_0x16033c)[_0x0a9e('0x1d')](_0x12066b);}};}function respondWithFilteredResult(_0x5a0a06,_0x459eb1){return function(_0x478723){if(_0x478723){var _0x106033=typeof _0x459eb1[_0x0a9e('0x1e')]===_0x0a9e('0x1f')&&typeof _0x459eb1[_0x0a9e('0x20')]===_0x0a9e('0x1f');var _0x20559e=_0x478723[_0x0a9e('0x21')];var _0x112016=_0x106033?0x0:_0x459eb1[_0x0a9e('0x1e')];var _0x105080=_0x106033?_0x478723['count']:_0x459eb1[_0x0a9e('0x1e')]+_0x459eb1[_0x0a9e('0x20')];var _0x53682f;if(_0x105080>=_0x20559e){_0x105080=_0x20559e;_0x53682f=0xc8;}else{_0x53682f=0xce;}_0x5a0a06[_0x0a9e('0x22')](_0x53682f);return _0x5a0a06['set']('Content-Range',_0x112016+'-'+_0x105080+'/'+_0x20559e)[_0x0a9e('0x1d')](_0x478723);}return null;};}function patchUpdates(_0x432e56){return function(_0x38e7c4){try{jsonpatch[_0x0a9e('0x23')](_0x38e7c4,_0x432e56,!![]);}catch(_0x4abc77){return BPromise[_0x0a9e('0x24')](_0x4abc77);}return _0x38e7c4[_0x0a9e('0x25')]();};}function saveUpdates(_0x3b45bc,_0x4d00e6){return function(_0x370d86){if(_0x370d86){return _0x370d86[_0x0a9e('0x26')](_0x3b45bc)[_0x0a9e('0x27')](function(_0x5ea472){return _0x5ea472;});}return null;};}function removeEntity(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(_0x3a8e58){return _0x3a8e58[_0x0a9e('0x28')]()[_0x0a9e('0x27')](function(){_0x59181e['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x479bc4,_0x45a1e7){return function(_0x5bfb33){if(!_0x5bfb33){_0x479bc4[_0x0a9e('0x1b')](0x194);}return _0x5bfb33;};}function handleError(_0x34dc65,_0x25fba9){_0x25fba9=_0x25fba9||0x1f4;return function(_0x14433c){logger[_0x0a9e('0x29')](_0x14433c[_0x0a9e('0x2a')]);if(_0x14433c[_0x0a9e('0x2b')]){delete _0x14433c[_0x0a9e('0x2b')];}_0x34dc65['status'](_0x25fba9)[_0x0a9e('0x2c')](_0x14433c);};}function getMustacheRender(_0x468813,_0x2b1f27){return Mustache[_0x0a9e('0x2d')](_0x468813,_['merge'](_0x2b1f27[_0x0a9e('0x2e')],{'contact':_0x2b1f27[_0x0a9e('0x2f')],'message':_0x2b1f27[_0x0a9e('0x30')],'agent':_0x2b1f27[_0x0a9e('0x31')],'interaction':_0x2b1f27[_0x0a9e('0x32')],'account':_0x2b1f27[_0x0a9e('0x33')]}))||'';}function getInteractionUsers(_0x296f41,_0x2e8759){return new BPromise(function(_0x1dbde2,_0x540530){try{if(_0x2e8759[_0x296f41['id']]){_0x296f41[_0x0a9e('0x34')]=_['map'](_0x2e8759[_0x296f41['id']],function(_0x2407f9){return{'id':_0x2407f9['id'],'fullname':_0x2407f9[_0x0a9e('0x35')]};});}}catch(_0x1122db){_0x540530(_0x1122db);}_0x1dbde2(_0x296f41);});}function getInteractionTags(_0x33bdb7,_0x25ce3a){return new BPromise(function(_0x5180f1,_0x66c1d2){try{if(_0x33bdb7[_0x0a9e('0x36')]){_0x33bdb7[_0x0a9e('0x37')]=[];_0x33bdb7[_0x0a9e('0x36')][_0x0a9e('0x38')](',')[_0x0a9e('0x39')](function(_0x332d35){_0x33bdb7[_0x0a9e('0x37')]['push'](_0x25ce3a[_0x332d35]);});}delete _0x33bdb7[_0x0a9e('0x36')];}catch(_0x5e7238){_0x66c1d2(_0x5e7238);}_0x5180f1(_0x33bdb7);});}function updateOpenchannelInteraction(_0x2cc7a0,_0x14b13f,_0x2b7e7f){return new BPromise(function(_0x3f3d41,_0x567193){return getInteractionUsers(_0x2cc7a0,_0x2b7e7f)[_0x0a9e('0x27')](function(_0xd1836d){return getInteractionTags(_0xd1836d,_0x14b13f);})[_0x0a9e('0x27')](function(_0x15de0e){_0x3f3d41(_0x15de0e);})['catch'](function(_0x54135e){_0x567193(_0x54135e);});});}exports[_0x0a9e('0x3a')]=function(_0x5640eb,_0x24936a){var _0x3d9717={},_0x381c37={},_0x1ef87a={'count':0x0,'rows':[]};var _0x4f41ae=_[_0x0a9e('0x3b')](db[_0x0a9e('0x3c')][_0x0a9e('0x3d')],function(_0x533942){return{'name':_0x533942[_0x0a9e('0x3e')],'type':_0x533942[_0x0a9e('0x3f')][_0x0a9e('0x40')]};});_0x381c37['model']=_['map'](_0x4f41ae,_0x0a9e('0x2b'));_0x381c37[_0x0a9e('0x41')]=_['keys'](_0x5640eb[_0x0a9e('0x41')]);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x381c37[_0x0a9e('0x44')],_0x381c37['query']);_0x3d9717['attributes']=_[_0x0a9e('0x43')](_0x381c37[_0x0a9e('0x44')],qs['fields'](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x45')]));_0x3d9717[_0x0a9e('0x46')]=_0x3d9717['attributes'][_0x0a9e('0x47')]?_0x3d9717[_0x0a9e('0x46')]:_0x381c37[_0x0a9e('0x44')];if(!_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x48')](_0x0a9e('0x49'))){_0x3d9717[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x20')]);_0x3d9717[_0x0a9e('0x1e')]=qs[_0x0a9e('0x1e')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x1e')]);}_0x3d9717[_0x0a9e('0x4a')]=qs['sort'](_0x5640eb['query'][_0x0a9e('0x4b')]);_0x3d9717[_0x0a9e('0x4c')]=qs[_0x0a9e('0x42')](_[_0x0a9e('0x4d')](_0x5640eb[_0x0a9e('0x41')],_0x381c37[_0x0a9e('0x42')]),_0x4f41ae);var _0x10b040=[];var _0x445e25=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x4f')]('id')[_0x0a9e('0x4f')](_0x0a9e('0x2b'))['field'](_0x0a9e('0x50'))[_0x0a9e('0x51')](_0x0a9e('0x52'));var _0xfbd5ad=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x4f')](_0x0a9e('0x53'))[_0x0a9e('0x4f')]('u.fullname')[_0x0a9e('0x4f')]('ui.OpenchannelInteractionId')[_0x0a9e('0x51')](_0x0a9e('0x54'),'ui')[_0x0a9e('0x55')]('users','u',_0x0a9e('0x56'));var _0x7f6eb1=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x51')](_0x0a9e('0x57'),'i')[_0x0a9e('0x55')](_0x0a9e('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0a9e('0x55')](_0x0a9e('0x59'),'o',_0x0a9e('0x5a'))[_0x0a9e('0x55')](_0x0a9e('0x5b'),'a',_0x0a9e('0x5c'))[_0x0a9e('0x55')](_0x0a9e('0x5d'),'me',_0x0a9e('0x5e'))['left_join'](_0x0a9e('0x5f'),'it',_0x0a9e('0x60'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x1adfee=squel[_0x0a9e('0x61')]();var _0x37edaa=[];var _0x11545a=squel[_0x0a9e('0x61')]();var _0x30decb;if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x62')]){_0x30decb=as['parseSearch'](_0x5640eb['query']['search']);var _0x39d77d=_0x30decb[_0x0a9e('0x63')];for(var _0x14d602=0x0;_0x14d602<_0x30decb['conditions'][_0x0a9e('0x47')];_0x14d602++){var _0x161aa7=_0x30decb['conditions'][_0x14d602];var _0x5a88da='i';var _0x2ef381=_['find'](_0x4f41ae,[_0x0a9e('0x2b'),_0x161aa7['field']]);if(!_0x2ef381){switch(_0x161aa7[_0x0a9e('0x4f')]){case _0x0a9e('0x64'):if(_0x161aa7[_0x0a9e('0x65')]==0x1){_0x7f6eb1['having']('`'+_0x161aa7[_0x0a9e('0x4f')]+_0x0a9e('0x66'));}else{_0x7f6eb1['having']('`'+_0x161aa7['field']+_0x0a9e('0x67'));}break;case _0x0a9e('0x68'):if(_0x161aa7['operator']===_0x0a9e('0x69')){if(_0x161aa7['value'][_0x0a9e('0x38')]('\x20')['length']>0x1){_0x1adfee[_0x39d77d](_0x0a9e('0x6a'),qs['getFullTextValue'](_0x161aa7['value']),null);}else{var _0x5df0ad='%'+_0x161aa7[_0x0a9e('0x65')]+'%';_0x1adfee[_0x39d77d]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5df0ad,_0x5df0ad,_0x5df0ad);}}else{_0x2ef381=_[_0x0a9e('0x6b')](_0x4f41ae,[_0x0a9e('0x2b'),_0x0a9e('0x6c')]);_0x161aa7[_0x0a9e('0x4f')]=_0x0a9e('0x6c');_0xe05a5a=as[_0x0a9e('0x6d')](_0x5a88da,_0x2ef381[_0x0a9e('0x3f')],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a['value'][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x1c')]);}break;case _0x0a9e('0x70'):var _0xb83dfd=_0x161aa7[_0x0a9e('0x65')]['split'](',')[_0x0a9e('0x3b')](function(_0x26bc80){return Number(_0x26bc80);});_0xb83dfd['forEach'](function(_0x3649cc){_0x11545a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3649cc+',%');});_0x37edaa=_[_0x0a9e('0x71')](_0x37edaa,_0xb83dfd);break;case'User':if(_0x161aa7['operator']==='$substring'){_0x1adfee[_0x39d77d](_0x0a9e('0x72'),'%'+_0x161aa7['value']+'%',null);}else{_0x2ef381=_[_0x0a9e('0x6b')](_0x4f41ae,[_0x0a9e('0x2b'),_0x0a9e('0x73')]);_0x161aa7[_0x0a9e('0x4f')]=_0x0a9e('0x73');_0xe05a5a=as[_0x0a9e('0x6d')](_0x5a88da,_0x2ef381['type'],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a['value'][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x1c')]);}break;case'body':_0xe05a5a=as[_0x0a9e('0x6d')]('me',null,_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x6f')],_0xe05a5a['value'][_0x0a9e('0x1c')]);break;}}else{var _0xe05a5a=as['buildExpression'](_0x5a88da,_0x2ef381[_0x0a9e('0x3f')],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')]['end']);}}}else{var _0x176840=_(_0x5640eb[_0x0a9e('0x41')])[_0x0a9e('0x74')]()['map'](function(_0x3528b7){return _['some'](_0x4f41ae,['name',_0x3528b7])?_0x3528b7:undefined;})[_0x0a9e('0x75')]()[_0x0a9e('0x65')]();if(!_[_0x0a9e('0x76')](_0x176840)){_0x176840[_0x0a9e('0x39')](function(_0x186f39){if(_0x186f39===_0x0a9e('0x77')){_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x78'),[][_0x0a9e('0x79')](_0x5640eb[_0x0a9e('0x41')][_0x186f39]));}else if(_0x186f39===_0x0a9e('0x7a')){var _0x19012b=JSON[_0x0a9e('0x7b')](_0x5640eb[_0x0a9e('0x41')][_0x186f39])[_0x0a9e('0x7c')];var _0x412a72=JSON[_0x0a9e('0x7b')](_0x5640eb[_0x0a9e('0x41')][_0x186f39])['$lte'];_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x7d'),_0x19012b,_0x412a72);}else{if(_0x5640eb[_0x0a9e('0x41')][_0x186f39]==='null'){_0x7f6eb1[_0x0a9e('0x4c')]('i.'+_0x186f39+_0x0a9e('0x7e'));}else{_0x7f6eb1['where']('i.'+_0x186f39+_0x0a9e('0x7f'),_0x5640eb[_0x0a9e('0x41')][_0x186f39]);}}});}if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x80')]){if(_0x5640eb[_0x0a9e('0x41')]['read']==0x1){_0x7f6eb1['having']('`unreadMessages`\x20=\x200');}else{_0x7f6eb1[_0x0a9e('0x81')](_0x0a9e('0x82'));}}if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')]){_0x37edaa=_[_0x0a9e('0x84')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')])?_0x5640eb[_0x0a9e('0x41')]['tag']:new Array(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')]);_0x37edaa[_0x0a9e('0x39')](function(_0x4a4fc7){_0x11545a['or'](_0x0a9e('0x85'),'%,'+_0x4a4fc7+',%');});}if(_0x5640eb['query'][_0x0a9e('0x86')]){var _0x44351d=_0x5640eb['query'][_0x0a9e('0x86')][_0x0a9e('0x87')]('\x5c','\x5c\x5c')[_0x0a9e('0x87')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x88')](_0x44351d)){_0x1adfee['or']('i.id\x20LIKE\x20?',_0x44351d+'%');}else{_0x1adfee['or'](_0x0a9e('0x89'),qs[_0x0a9e('0x8a')](_0x44351d))['or'](_0x0a9e('0x8b'),_0x44351d+'%')['or'](_0x0a9e('0x8c'),_0x44351d+'%');}}}_0x7f6eb1['where'](_0x1adfee);_0x7f6eb1[_0x0a9e('0x8d')](_0x0a9e('0x8e'));var _0x2d5506={'type':db[_0x0a9e('0x8f')]['QueryTypes'][_0x0a9e('0x90')],'raw':!![]};var _0x3511c9=_0x7f6eb1[_0x0a9e('0x91')]();_0x3511c9[_0x0a9e('0x4f')](_0x0a9e('0x8e'));_0x3511c9[_0x0a9e('0x4f')](_0x0a9e('0x92'),_0x0a9e('0x64'));if(_0x3d9717[_0x0a9e('0x4a')]){_0x3d9717[_0x0a9e('0x4a')][_0x0a9e('0x39')](function(_0x1f10ef){var _0x25744a=_0x1f10ef[0x0]===_0x0a9e('0x93')?_0x1f10ef[0x0]:'i.'+_0x1f10ef[0x0];_0x7f6eb1['order'](_0x25744a,_0x1f10ef[0x1]===_0x0a9e('0x94')?![]:!![]);});}if(!_[_0x0a9e('0x76')](_0x37edaa)){_0x7f6eb1[_0x0a9e('0x81')](_0x11545a);_0x3511c9['where'](_0x0a9e('0x95'),_0x37edaa);}BPromise[_0x0a9e('0x96')]()[_0x0a9e('0x27')](function(){if(!_0x30decb){if(_0x5640eb[_0x0a9e('0x41')]['OpenchannelAccountId'])return;_0x3511c9['where'](_0x0a9e('0x97'));_0x7f6eb1[_0x0a9e('0x4c')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5640eb[_0x0a9e('0x98')]['role']!==_0x0a9e('0x31'))return;return _0x5640eb[_0x0a9e('0x98')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x0a9e('0x27')](function(_0x41cf12){if(_[_0x0a9e('0x76')](_0x41cf12)){_0x3511c9[_0x0a9e('0x4c')](_0x0a9e('0x99'));_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x99'));}else{_0x3511c9['where'](_0x0a9e('0x78'),_[_0x0a9e('0x3b')](_0x41cf12,'id'));_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x78'),_['map'](_0x41cf12,'id'));}});})[_0x0a9e('0x27')](function(){if(_0x5640eb[_0x0a9e('0x98')]['role']===_0x0a9e('0x31')&&!_0x30decb&&!_0x5640eb['query'][_0x0a9e('0x77')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0x3511c9[_0x0a9e('0x9b')](),_0x2d5506);})['then'](function(_0x51ccd7){_0x1ef87a[_0x0a9e('0x21')]=_0x51ccd7[_0x0a9e('0x47')];if(_0x1ef87a[_0x0a9e('0x21')]===0x0)return[];return db['sequelize'][_0x0a9e('0x41')](_0x445e25[_0x0a9e('0x9b')](),_0x2d5506)['then'](function(_0x4e46b2){_0x10b040=_[_0x0a9e('0x9c')](_0x4e46b2,'id');_0x2d5506=_['merge'](_0x2d5506,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5640eb['query'][_0x0a9e('0x45')]){_0x3d9717[_0x0a9e('0x46')][_0x0a9e('0x39')](function(_0x3bfadf){_0x7f6eb1[_0x0a9e('0x4f')]('i.'+_0x3bfadf);});}else{_0x7f6eb1[_0x0a9e('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x64'));_0x7f6eb1['field'](_0x0a9e('0x9d'),_0x0a9e('0x9e'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0x9f'),'Account.mandatoryDisposition');_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa0'),_0x0a9e('0x93'));_0x7f6eb1['field'](_0x0a9e('0xa1'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x7f6eb1[_0x0a9e('0x4f')]('c.email',_0x0a9e('0xa6'));_0x7f6eb1[_0x0a9e('0x4f')]('c.phone',_0x0a9e('0xa7'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa8'),'Contact.mobile');_0x7f6eb1[_0x0a9e('0x4f')]('c.fax',_0x0a9e('0xa9'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x7f6eb1[_0x0a9e('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0a9e('0x36'));}if(_0x3d9717[_0x0a9e('0x20')])_0x7f6eb1[_0x0a9e('0x20')](_0x3d9717[_0x0a9e('0x20')]);if(_0x3d9717[_0x0a9e('0x1e')])_0x7f6eb1[_0x0a9e('0x1e')](_0x3d9717[_0x0a9e('0x1e')]);return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0x7f6eb1[_0x0a9e('0x9b')](),_0x2d5506);})[_0x0a9e('0x27')](function(_0x3754e2){if(_0x3754e2[_0x0a9e('0x47')]>0x0)_0xfbd5ad['where'](_0x0a9e('0xae'),_[_0x0a9e('0x3b')](_0x3754e2,'id'));return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0xfbd5ad[_0x0a9e('0x9b')](),_0x2d5506)['then'](function(_0x3afc8c){var _0x1756c7=_['groupBy'](_0x3afc8c,_0x0a9e('0xaf'));var _0x5e725e=[];_0x3754e2[_0x0a9e('0x39')](function(_0x27041d){_0x5e725e[_0x0a9e('0xb0')](updateOpenchannelInteraction(_0x27041d,_0x10b040,_0x1756c7));});return BPromise[_0x0a9e('0xb1')](_0x5e725e);});});})['then'](function(_0x3ceba6){_0x1ef87a['rows']=_0x3ceba6;return _0x1ef87a;})[_0x0a9e('0x27')](respondWithFilteredResult(_0x24936a,_0x3d9717))[_0x0a9e('0xb2')](handleError(_0x24936a,null));};exports['show']=function(_0x231c6a,_0x63c9f7){var _0x1dd541={};if(_0x231c6a['query']['type']&&_0x231c6a[_0x0a9e('0x41')][_0x0a9e('0x3f')]===_0x0a9e('0x51')){_0x1dd541[_0x0a9e('0x51')]=_0x231c6a[_0x0a9e('0xb3')]['id'];}else{_0x1dd541['id']=_0x231c6a[_0x0a9e('0xb3')]['id'];}var _0x17793e={'raw':![],'where':_0x1dd541},_0x3c75b9={};_0x3c75b9[_0x0a9e('0x44')]=_['keys'](db[_0x0a9e('0x3c')]['rawAttributes']);_0x3c75b9[_0x0a9e('0x41')]=_[_0x0a9e('0x74')](_0x231c6a[_0x0a9e('0x41')]);_0x3c75b9[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x3c75b9['model'],_0x3c75b9[_0x0a9e('0x41')]);_0x17793e[_0x0a9e('0x46')]=_[_0x0a9e('0x43')](_0x3c75b9[_0x0a9e('0x44')],qs[_0x0a9e('0x45')](_0x231c6a['query']['fields']));_0x17793e[_0x0a9e('0x46')]=_0x17793e['attributes'][_0x0a9e('0x47')]?_0x17793e[_0x0a9e('0x46')]:_0x3c75b9[_0x0a9e('0x44')];if(_0x231c6a[_0x0a9e('0x41')][_0x0a9e('0xb4')]){_0x17793e[_0x0a9e('0xb5')]=[{'all':!![]}];}_0x17793e=_['merge']({},_0x17793e,_0x231c6a['options']);return db[_0x0a9e('0x3c')]['find'](_0x17793e)[_0x0a9e('0x27')](handleEntityNotFound(_0x63c9f7,null))['then'](respondWithResult(_0x63c9f7,null))[_0x0a9e('0xb2')](handleError(_0x63c9f7,null));};exports['create']=function(_0x558d60,_0x1c49dc){return db[_0x0a9e('0x3c')]['create'](_0x558d60[_0x0a9e('0x2e')],{})[_0x0a9e('0x27')](respondWithResult(_0x1c49dc,0xc9))[_0x0a9e('0xb2')](handleError(_0x1c49dc,null));};exports[_0x0a9e('0x26')]=function(_0x2eb028,_0x5ab0bc){if(_0x2eb028['body']['id']){delete _0x2eb028[_0x0a9e('0x2e')]['id'];}return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x2eb028[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0x5ab0bc,null))['then'](saveUpdates(_0x2eb028[_0x0a9e('0x2e')],null))[_0x0a9e('0x27')](respondWithResult(_0x5ab0bc,null))['catch'](handleError(_0x5ab0bc,null));};exports[_0x0a9e('0x28')]=function(_0x19fd11,_0xcacabb){return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x19fd11[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0xcacabb,null))[_0x0a9e('0x27')](removeEntity(_0xcacabb,null))[_0x0a9e('0xb2')](handleError(_0xcacabb,null));};exports[_0x0a9e('0xb6')]=function(_0x4bdebb,_0x1065a7){return db[_0x0a9e('0x3c')][_0x0a9e('0xb6')]()[_0x0a9e('0x27')](respondWithResult(_0x1065a7,null))[_0x0a9e('0xb2')](handleError(_0x1065a7,null));};exports['addMessage']=function(_0x500868,_0x21902c,_0x16ae1a){return db[_0x0a9e('0xb7')][_0x0a9e('0x6b')]({'where':{'id':_0x500868[_0x0a9e('0xb3')]['id']}})['then'](handleEntityNotFound(_0x21902c,null))[_0x0a9e('0x27')](function(_0x3c775a){if(_0x3c775a){return _0x3c775a[_0x0a9e('0xb8')](_0x500868['body'][_0x0a9e('0xb9')],_['omit'](_0x500868[_0x0a9e('0x2e')],['ids','id'])||{});}})[_0x0a9e('0x27')](respondWithResult(_0x21902c,null))[_0x0a9e('0xb2')](handleError(_0x21902c,null));};exports[_0x0a9e('0xba')]=function(_0x5c500c,_0xc9529d,_0x5ed560){var _0x4383da={'raw':![],'where':{}};var _0x2b1824={};var _0x43a00a={'count':0x0,'rows':[]};return db[_0x0a9e('0x3c')][_0x0a9e('0xbb')]({'where':{'id':_0x5c500c[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0xc9529d,null))[_0x0a9e('0x27')](function(_0x2aaf07){if(_0x2aaf07){_0x2b1824[_0x0a9e('0x44')]=_[_0x0a9e('0x74')](db[_0x0a9e('0xb7')][_0x0a9e('0x3d')]);_0x2b1824[_0x0a9e('0x41')]=_[_0x0a9e('0x74')](_0x5c500c[_0x0a9e('0x41')]);_0x2b1824['filters']=_['intersection'](_0x2b1824[_0x0a9e('0x44')],_0x2b1824['query']);_0x4383da[_0x0a9e('0x46')]=_[_0x0a9e('0x43')](_0x2b1824['model'],qs[_0x0a9e('0x45')](_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x45')]));_0x4383da[_0x0a9e('0x46')]=_0x4383da['attributes'][_0x0a9e('0x47')]?_0x4383da[_0x0a9e('0x46')]:_0x2b1824[_0x0a9e('0x44')];if(!_0x5c500c[_0x0a9e('0x41')]['hasOwnProperty'](_0x0a9e('0x49'))){_0x4383da[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5c500c['query'][_0x0a9e('0x20')]);_0x4383da[_0x0a9e('0x1e')]=qs[_0x0a9e('0x1e')](_0x5c500c['query'][_0x0a9e('0x1e')]);}_0x4383da[_0x0a9e('0x4a')]=qs[_0x0a9e('0x4b')](_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x4b')]);_0x4383da['where']=qs[_0x0a9e('0x42')](_[_0x0a9e('0x4d')](_0x5c500c['query'],_0x2b1824[_0x0a9e('0x42')]));_0x4383da[_0x0a9e('0x4c')][_0x0a9e('0xaf')]=_0x2aaf07['id'];if(_0x5c500c['query']['filter']){_0x4383da['where']=_[_0x0a9e('0xbc')](_0x4383da[_0x0a9e('0x4c')],{'$or':_['map'](_0x4383da[_0x0a9e('0x46')],function(_0x1f78b4){var _0x2a8d55={};_0x2a8d55[_0x1f78b4]={'$like':'%'+_0x5c500c['query'][_0x0a9e('0x86')]+'%'};return _0x2a8d55;})});}if(_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x7c')]){var _0x30b3b8=_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x7c')][_0x0a9e('0x38')](',');var _0x328ec5={};_0x328ec5[_0x30b3b8[0x0]]={'$gte':moment(_0x30b3b8[0x1])[_0x0a9e('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4383da[_0x0a9e('0x4c')]=_['merge'](_0x4383da[_0x0a9e('0x4c')],_0x328ec5);}_0x4383da=_[_0x0a9e('0xbc')]({},_0x4383da,_0x5c500c[_0x0a9e('0xbe')]);return db[_0x0a9e('0xb7')][_0x0a9e('0x21')]({'where':_0x4383da[_0x0a9e('0x4c')]})['then'](function(_0x1a0314){_0x43a00a[_0x0a9e('0x21')]=_0x1a0314;if(_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0xb4')]){_0x4383da['include']=[{'all':!![]}];}return db[_0x0a9e('0xb7')][_0x0a9e('0xbf')](_0x4383da);})[_0x0a9e('0x27')](function(_0x1c9539){_0x43a00a[_0x0a9e('0xc0')]=_0x1c9539;return _0x43a00a;});}})[_0x0a9e('0x27')](respondWithFilteredResult(_0xc9529d,_0x4383da))[_0x0a9e('0xb2')](handleError(_0xc9529d,null));};exports[_0x0a9e('0xc1')]=function(_0x3299b7,_0x3539b7,_0x57f0ad){return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x3299b7[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0x3539b7,null))[_0x0a9e('0x27')](function(_0x253f74){if(_0x253f74){return _0x253f74[_0x0a9e('0xc2')](_0x3299b7[_0x0a9e('0x2e')]['ids'],_[_0x0a9e('0xc3')](_0x3299b7[_0x0a9e('0x2e')],[_0x0a9e('0xb9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0x70')][_0x0a9e('0xbf')]({'attributes':['id',_0x0a9e('0x2b'),_0x0a9e('0x50')],'where':{'id':_0x3299b7[_0x0a9e('0x2e')][_0x0a9e('0xb9')]}});})[_0x0a9e('0x27')](function(_0x336a19){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x3299b7['params']['id']),'tags':_0x336a19||[]});return{'id':Number(_0x3299b7[_0x0a9e('0xb3')]['id']),'tags':_0x336a19||[]};});}})[_0x0a9e('0x27')](respondWithResult(_0x3539b7,null))[_0x0a9e('0xb2')](handleError(_0x3539b7,null));};exports[_0x0a9e('0xc6')]=function(_0x2b624e,_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x3c')]['find']({'where':{'id':_0x2b624e['params']['id']}})['then'](handleEntityNotFound(_0x3942fd,null))[_0x0a9e('0x27')](function(_0x3fa3f2){if(_0x3fa3f2){return _0x3fa3f2[_0x0a9e('0xc6')](_0x2b624e[_0x0a9e('0x41')]['ids']);}})[_0x0a9e('0x27')](respondWithStatusCode(_0x3942fd,null))[_0x0a9e('0xb2')](handleError(_0x3942fd,null));};exports[_0x0a9e('0xc7')]=function(_0x1fdb10,_0x2c8d1d){var _0x4b6c21=moment()['unix']()[_0x0a9e('0x9b')]();var _0x33bcb2=path[_0x0a9e('0xc8')](config['root'],_0x0a9e('0xc9'),_0x0a9e('0xca'),_0x0a9e('0xcb'));var _0x4cee8c=path[_0x0a9e('0xc8')](config[_0x0a9e('0xcc')],_0x0a9e('0xc9'),'files',_0x0a9e('0xcd'));var _0x336b30=path[_0x0a9e('0xc8')](_0x33bcb2,_0x4b6c21);var _0x549e03=util['format']('transcript-%d-%s.zip',_0x1fdb10[_0x0a9e('0xb3')]['id'],_0x4b6c21);var _0x1f50db=path[_0x0a9e('0xc8')](_0x33bcb2,_0x549e03);var _0x26931c=[];_0x26931c['push']({'model':db[_0x0a9e('0xce')],'as':'User','attributes':['id',_0x0a9e('0x35')],'raw':!![]});_0x26931c[_0x0a9e('0xb0')]({'model':db[_0x0a9e('0xcf')],'as':'Contact','attributes':['id',_0x0a9e('0xd0'),_0x0a9e('0xd1')],'raw':!![]});if(_0x1fdb10[_0x0a9e('0x41')]['attachments']){_0x26931c[_0x0a9e('0xb0')]({'model':db['Attachment'],'as':_0x0a9e('0xd2'),'raw':!![]});}var _0x5c57e1=[{'model':db[_0x0a9e('0xb7')],'as':'Messages','attributes':['id',_0x0a9e('0x2e'),_0x0a9e('0x7a'),_0x0a9e('0xd3'),_0x0a9e('0xd4'),_0x0a9e('0x80')],'include':_0x26931c}];_0x5c57e1[_0x0a9e('0xb0')]({'model':db[_0x0a9e('0xd5')],'as':'Account','attributes':['id',_0x0a9e('0x2b')]});_0x5c57e1[_0x0a9e('0xb0')]({'model':db['User'],'as':_0x0a9e('0xd6'),'attributes':['id',_0x0a9e('0x35')]});return db['OpenchannelInteraction'][_0x0a9e('0x6b')]({'where':{'id':_0x1fdb10[_0x0a9e('0xb3')]['id']},'include':_0x5c57e1})[_0x0a9e('0x27')](handleEntityNotFound(_0x2c8d1d,null))['then'](function(_0x3766d7){if(_0x3766d7){var _0xf49ed4=_0x3766d7[_0x0a9e('0xd7')]({'plain':!![]});fs[_0x0a9e('0xd8')](_0x336b30);var _0x2003bc={'channel':_0x0a9e('0xd9'),'account':_0xf49ed4[_0x0a9e('0xda')][_0x0a9e('0x2b')],'agent':_0xf49ed4[_0x0a9e('0xd6')]?_0xf49ed4[_0x0a9e('0xd6')]['fullname']:_0x0a9e('0xdb'),'createdAt':moment(_0xf49ed4['createdAt'])[_0x0a9e('0xbd')](_0x0a9e('0xdc'))[_0x0a9e('0x9b')](),'closedAt':_0xf49ed4[_0x0a9e('0xdd')]?moment(_0xf49ed4[_0x0a9e('0xde')])[_0x0a9e('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x9b')]():'','disposition':_0xf49ed4[_0x0a9e('0xdf')],'visibility':_0xf49ed4[_0x0a9e('0xe0')]?'Public':_0x0a9e('0xe1'),'messages':_(_0xf49ed4[_0x0a9e('0xe2')])[_0x0a9e('0x86')]({'secret':![]})[_0x0a9e('0x3b')](function(_0x31e1e0){if(_0x31e1e0[_0x0a9e('0xd2')]){var _0x1e93f5=path['join'](_0x4cee8c,_0x31e1e0[_0x0a9e('0xd2')][_0x0a9e('0xe3')]);if(fs[_0x0a9e('0xe4')](_0x1e93f5)){fs[_0x0a9e('0xe5')](_0x1e93f5)[_0x0a9e('0xe6')](fs[_0x0a9e('0xe7')](path[_0x0a9e('0xc8')](_0x336b30,_0x31e1e0['Attachment']['basename'])));}}return{'date':moment(_0x31e1e0[_0x0a9e('0x7a')])[_0x0a9e('0xbd')](_0x0a9e('0xdc'))[_0x0a9e('0x9b')](),'sender':_0x31e1e0[_0x0a9e('0xd3')]===_0x0a9e('0xe8')?_0x31e1e0[_0x0a9e('0xce')]?_0x31e1e0['User'][_0x0a9e('0x35')]:_0x0a9e('0xe9'):_0x31e1e0[_0x0a9e('0x68')][_0x0a9e('0xd0')]+(_0x31e1e0[_0x0a9e('0x68')][_0x0a9e('0xd1')]?'\x20'+_0x31e1e0[_0x0a9e('0x68')]['lastName']:''),'body':_0x31e1e0[_0x0a9e('0xd2')]?_0x31e1e0[_0x0a9e('0xd2')][_0x0a9e('0xe3')]:_0x31e1e0['body'],'direction':_0x31e1e0[_0x0a9e('0xd3')]===_0x0a9e('0xe8')?'A':'C','secret':_0x31e1e0[_0x0a9e('0xd4')],'read':_0x31e1e0[_0x0a9e('0x80')],'attachment':_0x31e1e0['Attachment']};})[_0x0a9e('0x65')]()};return ejs[_0x0a9e('0xea')](path[_0x0a9e('0xc8')](config[_0x0a9e('0xcc')],_0x0a9e('0xc9'),_0x0a9e('0xeb'),_0x0a9e('0xec')),{'interaction':_0x2003bc})[_0x0a9e('0x27')](function(_0x4e5dec){var _0x3ede01=path[_0x0a9e('0xc8')](_0x336b30,_0x0a9e('0xed')+_0xf49ed4['id']+'-'+_0x4b6c21+_0x0a9e('0xee'));var _0x5f4c6f={'path':_0x3ede01,'channel':'Openchannel','interactionId':_0xf49ed4['id']};return pdf[_0x0a9e('0xef')](_0x4e5dec,_0x5f4c6f);})[_0x0a9e('0x27')](function(){return new BPromise(function(_0x44cd25,_0x596ba3){zipdir(_0x336b30,{'saveTo':_0x1f50db},function(_0x3ccede,_0x40180d){if(_0x3ccede)return _0x596ba3(_0x3ccede);return _0x44cd25(_0x40180d);});})['then'](function(){return new BPromise(function(_0x1970f1,_0x5d19b1){rimraf(_0x336b30,function(_0x35cc2a){if(_0x35cc2a)_0x5d19b1(_0x35cc2a);return _0x1970f1();});});})['then'](function(){return _0x2c8d1d['download'](_0x1f50db,_0x549e03,function(_0x48eaa3){if(_0x48eaa3){console[_0x0a9e('0xf0')](_0x0a9e('0xf1'),_0x48eaa3);}else{fs[_0x0a9e('0xf2')](_0x1f50db);}});});});}else{return _0x2c8d1d[_0x0a9e('0x1b')](0xc8);}})[_0x0a9e('0xb2')](handleError(_0x2c8d1d,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 6d95bd3..c445640 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 _0x199d=['findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map'];(function(_0x51824c,_0x468618){var _0x4d1afb=function(_0xb30499){while(--_0xb30499){_0x51824c['push'](_0x51824c['shift']());}};_0x4d1afb(++_0x468618);}(_0x199d,0x1ed));var _0xd199=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0x199d[_0x10f6e8];return _0x35bb3c;};'use strict';var EventEmitter=require(_0xd199('0x0'));var OpenchannelInteraction=require(_0xd199('0x1'))['db'][_0xd199('0x2')];var OpenchannelMessage=require(_0xd199('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xd199('0x3')](0x0);var events={'afterCreate':_0xd199('0x4'),'afterUpdate':_0xd199('0x5'),'afterDestroy':_0xd199('0x6')};function emitEvent(_0x29fe43){return function(_0x3a5b44,_0x4b61d6,_0x5b3d5d){_0x3a5b44[_0xd199('0x7')]({'attributes':['id'],'raw':!![]})[_0xd199('0x8')](function(_0x1f6338){_0x3a5b44[_0xd199('0x9')]('Users',_0x1f6338[_0xd199('0xa')](function(_0x126c54){return{'id':_0x126c54['id']};}));return OpenchannelMessage[_0xd199('0xb')]({'where':{'OpenchannelInteractionId':_0x3a5b44['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd199('0x8')](function(_0x3115ad){_0x3a5b44[_0xd199('0x9')](_0xd199('0xc'),_0x3115ad[_0xd199('0xd')]);OpenchannelInteractionEvents[_0xd199('0xe')](_0x29fe43+':'+_0x3a5b44['id'],_0x3a5b44);OpenchannelInteractionEvents[_0xd199('0xe')](_0x29fe43,_0x3a5b44);_0x5b3d5d(null);})['catch'](_0x5b3d5d(null));};}for(var e in events){if(events[_0xd199('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xd199('0x10')](e,emitEvent(event));}}module[_0xd199('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x1258=['setDataValue','map','findAll','length','emit','catch','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','then'];(function(_0x1969f1,_0x5af4be){var _0x1eb502=function(_0x8b5400){while(--_0x8b5400){_0x1969f1['push'](_0x1969f1['shift']());}};_0x1eb502(++_0x5af4be);}(_0x1258,0x1b8));var _0x8125=function(_0x30b6ae,_0xecd6e2){_0x30b6ae=_0x30b6ae-0x0;var _0x29b061=_0x1258[_0x30b6ae];return _0x29b061;};'use strict';var EventEmitter=require(_0x8125('0x0'));var OpenchannelInteraction=require(_0x8125('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x8125('0x1'))['db'][_0x8125('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8125('0x3')](0x0);var events={'afterCreate':_0x8125('0x4'),'afterUpdate':_0x8125('0x5'),'afterDestroy':'remove'};function emitEvent(_0xc899d8){return function(_0x592a80,_0x253142,_0x4d8d24){_0x592a80[_0x8125('0x6')]({'attributes':['id'],'raw':!![]})[_0x8125('0x7')](function(_0x5a8e3e){_0x592a80[_0x8125('0x8')]('Users',_0x5a8e3e[_0x8125('0x9')](function(_0x97a0bf){return{'id':_0x97a0bf['id']};}));return OpenchannelMessage[_0x8125('0xa')]({'where':{'OpenchannelInteractionId':_0x592a80['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8125('0x7')](function(_0x4f9df9){_0x592a80[_0x8125('0x8')]('unreadMessages',_0x4f9df9[_0x8125('0xb')]);OpenchannelInteractionEvents[_0x8125('0xc')](_0xc899d8+':'+_0x592a80['id'],_0x592a80);OpenchannelInteractionEvents[_0x8125('0xc')](_0xc899d8,_0x592a80);_0x4d8d24(null);})[_0x8125('0xd')](_0x4d8d24(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x8125('0xe')](e,emitEvent(event));}}module[_0x8125('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 3e9203c..95e9dd6 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 _0xe181=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt'];(function(_0x396601,_0x2a426a){var _0x31008b=function(_0x3ea171){while(--_0x3ea171){_0x396601['push'](_0x396601['shift']());}};_0x31008b(++_0x2a426a);}(_0xe181,0x68));var _0x1e18=function(_0x343aa1,_0x443588){_0x343aa1=_0x343aa1-0x0;var _0x145484=_0xe181[_0x343aa1];return _0x145484;};'use strict';var _=require(_0x1e18('0x0'));var util=require('util');var logger=require(_0x1e18('0x1'))(_0x1e18('0x2'));var moment=require(_0x1e18('0x3'));var BPromise=require(_0x1e18('0x4'));var rp=require(_0x1e18('0x5'));var fs=require('fs');var path=require(_0x1e18('0x6'));var rimraf=require(_0x1e18('0x7'));var config=require('../../config/environment');var attributes=require(_0x1e18('0x8'));module['exports']=function(_0x512343,_0x18fabb){return _0x512343[_0x1e18('0x9')](_0x1e18('0xa'),attributes,{'tableName':_0x1e18('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x9f9541,_0x398f77,_0x5e6cd3){if(_0x9f9541[_0x1e18('0xc')](_0x1e18('0xd'))){_0x9f9541[_0x1e18('0xe')]=moment()[_0x1e18('0xf')](_0x1e18('0x10'));}_0x5e6cd3(null,_0x9f9541);}}});}; \ No newline at end of file +var _0x1b20=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x137027,_0x3dd705){var _0x23197d=function(_0x7db70f){while(--_0x7db70f){_0x137027['push'](_0x137027['shift']());}};_0x23197d(++_0x3dd705);}(_0x1b20,0x66));var _0x01b2=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1b20[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x01b2('0x0'));var logger=require(_0x01b2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x01b2('0x2'));var rp=require(_0x01b2('0x3'));var fs=require('fs');var path=require(_0x01b2('0x4'));var rimraf=require(_0x01b2('0x5'));var config=require(_0x01b2('0x6'));var attributes=require(_0x01b2('0x7'));module[_0x01b2('0x8')]=function(_0x28de4a,_0x46e745){return _0x28de4a[_0x01b2('0x9')](_0x01b2('0xa'),attributes,{'tableName':_0x01b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x508add,_0x132a08,_0x591ec0){if(_0x508add[_0x01b2('0xc')](_0x01b2('0xd'))){_0x508add[_0x01b2('0xe')]=moment()[_0x01b2('0xf')](_0x01b2('0x10'));}_0x591ec0(null,_0x508add);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index fcd657b..dffa00b 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 _0xc5a1=['OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','limit','find','where','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xc5a1,0xc8));var _0x1c5a=function(_0x4a8072,_0x435bab){_0x4a8072=_0x4a8072-0x0;var _0x11a4fe=_0xc5a1[_0x4a8072];return _0x11a4fe;};'use strict';var _=require(_0x1c5a('0x0'));var util=require(_0x1c5a('0x1'));var moment=require('moment');var BPromise=require(_0x1c5a('0x2'));var rs=require(_0x1c5a('0x3'));var fs=require('fs');var Redis=require(_0x1c5a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c5a('0x5'));var logger=require(_0x1c5a('0x6'))(_0x1c5a('0x7'));var config=require(_0x1c5a('0x8'));var jayson=require(_0x1c5a('0x9'));var client=jayson[_0x1c5a('0xa')][_0x1c5a('0xb')]({'port':0x232a});config[_0x1c5a('0xc')]=_[_0x1c5a('0xd')](config[_0x1c5a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1c5a('0xe'))(new Redis(config[_0x1c5a('0xc')]));require(_0x1c5a('0xf'))[_0x1c5a('0x10')](socket);function respondWithRpcPromise(_0xc3564c,_0x3eeb0b,_0x3d008d){return new BPromise(function(_0x45c555,_0x410884){return client[_0x1c5a('0x11')](_0xc3564c,_0x3d008d)[_0x1c5a('0x12')](function(_0x91c6c2){logger[_0x1c5a('0x13')](_0x1c5a('0x14'),_0x3eeb0b,_0x1c5a('0x15'));logger[_0x1c5a('0x16')](_0x1c5a('0x17'),_0x3eeb0b,'request\x20sent',JSON[_0x1c5a('0x18')](_0x91c6c2));if(_0x91c6c2[_0x1c5a('0x19')]){if(_0x91c6c2['error'][_0x1c5a('0x1a')]===0x1f4){logger[_0x1c5a('0x19')](_0x1c5a('0x14'),_0x3eeb0b,_0x91c6c2[_0x1c5a('0x19')][_0x1c5a('0x1b')]);return _0x410884(_0x91c6c2[_0x1c5a('0x19')][_0x1c5a('0x1b')]);}logger['error'](_0x1c5a('0x14'),_0x3eeb0b,_0x91c6c2[_0x1c5a('0x19')][_0x1c5a('0x1b')]);return _0x45c555(_0x91c6c2[_0x1c5a('0x19')][_0x1c5a('0x1b')]);}else{logger[_0x1c5a('0x13')](_0x1c5a('0x14'),_0x3eeb0b,'request\x20sent');_0x45c555(_0x91c6c2[_0x1c5a('0x1c')]['message']);}})[_0x1c5a('0x1d')](function(_0x33cc7a){logger[_0x1c5a('0x19')](_0x1c5a('0x14'),_0x3eeb0b,_0x33cc7a);_0x410884(_0x33cc7a);});});}exports[_0x1c5a('0x1e')]=function(_0x5aec4a){var _0x2c29e5=this;return new Promise(function(_0x45676b,_0x261643){return db[_0x1c5a('0x1f')][_0x1c5a('0x20')](_0x5aec4a[_0x1c5a('0x21')],{'raw':_0x5aec4a['options']?_0x5aec4a[_0x1c5a('0x22')][_0x1c5a('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5aec4a[_0x1c5a('0x22')]?_0x5aec4a[_0x1c5a('0x22')]['where']||null:null,'attributes':_0x5aec4a['options']?_0x5aec4a[_0x1c5a('0x22')][_0x1c5a('0x24')]||null:null,'limit':_0x5aec4a[_0x1c5a('0x22')]?_0x5aec4a[_0x1c5a('0x22')][_0x1c5a('0x25')]||null:null})['then'](function(_0x3f1e19){logger[_0x1c5a('0x13')](_0x1c5a('0x1e'),_0x5aec4a);logger[_0x1c5a('0x16')]('UpdateOpenchannelInteraction',_0x5aec4a,JSON[_0x1c5a('0x18')](_0x3f1e19));_0x45676b(_0x3f1e19);})['catch'](function(_0x2767bd){logger[_0x1c5a('0x19')]('UpdateOpenchannelInteraction',_0x2767bd[_0x1c5a('0x1b')],_0x5aec4a);_0x261643(_0x2c29e5[_0x1c5a('0x19')](0x1f4,_0x2767bd[_0x1c5a('0x1b')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x53ebf1){return new Promise(function(_0x15ebb8,_0x32252b){return db[_0x1c5a('0x1f')][_0x1c5a('0x26')]({'where':_0x53ebf1['options']?_0x53ebf1[_0x1c5a('0x22')][_0x1c5a('0x27')]||null:null})[_0x1c5a('0x12')](function(_0x3b8aef){if(_0x3b8aef){return _0x3b8aef['addTags'](_0x53ebf1[_0x1c5a('0x21')][_0x1c5a('0x28')],_[_0x1c5a('0x29')](_0x53ebf1[_0x1c5a('0x21')],[_0x1c5a('0x28'),'id'])||{});}})[_0x1c5a('0x2a')](function(_0x4625f1){logger[_0x1c5a('0x13')](_0x1c5a('0x2b'),_0x53ebf1);logger[_0x1c5a('0x16')]('AddTags',_0x53ebf1,JSON[_0x1c5a('0x18')](_0x4625f1));_0x15ebb8(_0x4625f1);})['catch'](function(_0x513c0a){logger[_0x1c5a('0x19')]('AddTags',_0x513c0a[_0x1c5a('0x1b')],_0x53ebf1);_0x32252b(_this[_0x1c5a('0x19')](0x1f4,_0x513c0a['message']));});});}; \ No newline at end of file +var _0x71d2=['where','attributes','limit','debug','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw'];(function(_0x37b937,_0x15d276){var _0x35c013=function(_0x4d98a1){while(--_0x4d98a1){_0x37b937['push'](_0x37b937['shift']());}};_0x35c013(++_0x15d276);}(_0x71d2,0x8f));var _0x271d=function(_0x3bc9bd,_0x15e411){_0x3bc9bd=_0x3bc9bd-0x0;var _0xdfa386=_0x71d2[_0x3bc9bd];return _0xdfa386;};'use strict';var _=require(_0x271d('0x0'));var util=require('util');var moment=require(_0x271d('0x1'));var BPromise=require(_0x271d('0x2'));var rs=require(_0x271d('0x3'));var fs=require('fs');var Redis=require(_0x271d('0x4'));var db=require(_0x271d('0x5'))['db'];var utils=require(_0x271d('0x6'));var logger=require(_0x271d('0x7'))(_0x271d('0x8'));var config=require('../../config/environment');var jayson=require(_0x271d('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x271d('0xa')]=_[_0x271d('0xb')](config[_0x271d('0xa')],{'host':_0x271d('0xc'),'port':0x18eb});var socket=require(_0x271d('0xd'))(new Redis(config['redis']));require(_0x271d('0xe'))[_0x271d('0xf')](socket);function respondWithRpcPromise(_0x1495c6,_0x359a95,_0x2249fd){return new BPromise(function(_0x4f19b9,_0xebb0d9){return client[_0x271d('0x10')](_0x1495c6,_0x2249fd)[_0x271d('0x11')](function(_0x4d83da){logger[_0x271d('0x12')](_0x271d('0x13'),_0x359a95,_0x271d('0x14'));logger['debug'](_0x271d('0x15'),_0x359a95,_0x271d('0x14'),JSON[_0x271d('0x16')](_0x4d83da));if(_0x4d83da[_0x271d('0x17')]){if(_0x4d83da[_0x271d('0x17')][_0x271d('0x18')]===0x1f4){logger[_0x271d('0x17')](_0x271d('0x13'),_0x359a95,_0x4d83da[_0x271d('0x17')]['message']);return _0xebb0d9(_0x4d83da[_0x271d('0x17')][_0x271d('0x19')]);}logger[_0x271d('0x17')](_0x271d('0x13'),_0x359a95,_0x4d83da[_0x271d('0x17')][_0x271d('0x19')]);return _0x4f19b9(_0x4d83da[_0x271d('0x17')][_0x271d('0x19')]);}else{logger[_0x271d('0x12')](_0x271d('0x13'),_0x359a95,_0x271d('0x14'));_0x4f19b9(_0x4d83da['result'][_0x271d('0x19')]);}})[_0x271d('0x1a')](function(_0xd71e8b){logger[_0x271d('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x359a95,_0xd71e8b);_0xebb0d9(_0xd71e8b);});});}exports[_0x271d('0x1b')]=function(_0x7c615d){var _0x5bf903=this;return new Promise(function(_0x3adff0,_0x527e91){return db[_0x271d('0x1c')][_0x271d('0x1d')](_0x7c615d[_0x271d('0x1e')],{'raw':_0x7c615d[_0x271d('0x1f')]?_0x7c615d[_0x271d('0x1f')][_0x271d('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7c615d[_0x271d('0x1f')]?_0x7c615d['options'][_0x271d('0x21')]||null:null,'attributes':_0x7c615d[_0x271d('0x1f')]?_0x7c615d[_0x271d('0x1f')][_0x271d('0x22')]||null:null,'limit':_0x7c615d[_0x271d('0x1f')]?_0x7c615d[_0x271d('0x1f')][_0x271d('0x23')]||null:null})[_0x271d('0x11')](function(_0x3da359){logger['info'](_0x271d('0x1b'),_0x7c615d);logger[_0x271d('0x24')](_0x271d('0x1b'),_0x7c615d,JSON[_0x271d('0x16')](_0x3da359));_0x3adff0(_0x3da359);})[_0x271d('0x1a')](function(_0x548a9b){logger[_0x271d('0x17')](_0x271d('0x1b'),_0x548a9b[_0x271d('0x19')],_0x7c615d);_0x527e91(_0x5bf903[_0x271d('0x17')](0x1f4,_0x548a9b[_0x271d('0x19')]));});});};exports[_0x271d('0x25')]=function(_0x450a2b){return new Promise(function(_0x31144d,_0x25ab92){return db[_0x271d('0x1c')][_0x271d('0x26')]({'where':_0x450a2b[_0x271d('0x1f')]?_0x450a2b['options']['where']||null:null})['then'](function(_0x31e6e2){if(_0x31e6e2){return _0x31e6e2[_0x271d('0x27')](_0x450a2b[_0x271d('0x1e')][_0x271d('0x28')],_[_0x271d('0x29')](_0x450a2b[_0x271d('0x1e')],[_0x271d('0x28'),'id'])||{});}})[_0x271d('0x2a')](function(_0x58e586){logger[_0x271d('0x12')](_0x271d('0x2b'),_0x450a2b);logger[_0x271d('0x24')](_0x271d('0x2b'),_0x450a2b,JSON[_0x271d('0x16')](_0x58e586));_0x31144d(_0x58e586);})['catch'](function(_0x2a2b2a){logger[_0x271d('0x17')](_0x271d('0x2b'),_0x2a2b2a['message'],_0x450a2b);_0x25ab92(_this[_0x271d('0x17')](0x1f4,_0x2a2b2a[_0x271d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index bd8b003..81143b9 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 _0x3e69=['emit','removeListener','register','length','openchannelInteraction:','save','remove'];(function(_0x299f5b,_0x480201){var _0x2dcf14=function(_0x2e3245){while(--_0x2e3245){_0x299f5b['push'](_0x299f5b['shift']());}};_0x2dcf14(++_0x480201);}(_0x3e69,0x11d));var _0x93e6=function(_0x4b775b,_0x2aadc6){_0x4b775b=_0x4b775b-0x0;var _0xf84d39=_0x3e69[_0x4b775b];return _0xf84d39;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x93e6('0x0'),_0x93e6('0x1'),'update'];function createListener(_0x4292a2,_0xcf7220){return function(_0x1273b9){_0xcf7220[_0x93e6('0x2')](_0x4292a2,_0x1273b9);};}function removeListener(_0x408793,_0xf13ccb){return function(){OpenchannelInteractionEvents[_0x93e6('0x3')](_0x408793,_0xf13ccb);};}exports[_0x93e6('0x4')]=function(_0x5bae0e){for(var _0x290960=0x0,_0x1c3483=events[_0x93e6('0x5')];_0x290960<_0x1c3483;_0x290960++){var _0x1dcc2f=events[_0x290960];var _0x4b31e8=createListener(_0x93e6('0x6')+_0x1dcc2f,_0x5bae0e);OpenchannelInteractionEvents['on'](_0x1dcc2f,_0x4b31e8);}}; \ No newline at end of file +var _0xca59=['removeListener','length','openchannelInteraction:','save','remove','emit'];(function(_0x2badfc,_0x21dec9){var _0x29f9cb=function(_0xed0f05){while(--_0xed0f05){_0x2badfc['push'](_0x2badfc['shift']());}};_0x29f9cb(++_0x21dec9);}(_0xca59,0xf3));var _0x9ca5=function(_0x545716,_0x562e92){_0x545716=_0x545716-0x0;var _0x394ab0=_0xca59[_0x545716];return _0x394ab0;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x9ca5('0x0'),_0x9ca5('0x1'),'update'];function createListener(_0x2caf88,_0x3f7662){return function(_0x2a2aea){_0x3f7662[_0x9ca5('0x2')](_0x2caf88,_0x2a2aea);};}function removeListener(_0x624913,_0x1786be){return function(){OpenchannelInteractionEvents[_0x9ca5('0x3')](_0x624913,_0x1786be);};}exports['register']=function(_0x3b8167){for(var _0x2fcade=0x0,_0x589c7d=events[_0x9ca5('0x4')];_0x2fcade<_0x589c7d;_0x2fcade++){var _0x474d5a=events[_0x2fcade];var _0x5655f5=createListener(_0x9ca5('0x5')+_0x474d5a,_0x3b8167);OpenchannelInteractionEvents['on'](_0x474d5a,_0x5655f5);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 676033a..99cc69b 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 _0xdec3=['put','update','/:id/accept','accept','reject','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','openchannel','openchannelmessage:create'];(function(_0xfc43a1,_0xea8d20){var _0x42beab=function(_0x58e55c){while(--_0x58e55c){_0xfc43a1['push'](_0xfc43a1['shift']());}};_0x42beab(++_0xea8d20);}(_0xdec3,0x89));var _0x3dec=function(_0x40292e,_0x2b88ba){_0x40292e=_0x40292e-0x0;var _0x5e2ab3=_0xdec3[_0x40292e];return _0x5e2ab3;};'use strict';var multer=require(_0x3dec('0x0'));var util=require('util');var path=require(_0x3dec('0x1'));var timeout=require(_0x3dec('0x2'));var express=require(_0x3dec('0x3'));var router=express['Router']();var fs_extra=require(_0x3dec('0x4'));var auth=require(_0x3dec('0x5'));var interaction=require(_0x3dec('0x6'));var config=require(_0x3dec('0x7'));var controller=require('./openchannelMessage.controller');router[_0x3dec('0x8')]('/',auth[_0x3dec('0x9')](),controller[_0x3dec('0xa')]);router[_0x3dec('0x8')](_0x3dec('0xb'),auth[_0x3dec('0x9')](),controller[_0x3dec('0xc')]);router['get'](_0x3dec('0xd'),auth[_0x3dec('0x9')](),controller['show']);router[_0x3dec('0xe')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x3dec('0xf'),_0x3dec('0x10')),controller['create']);router[_0x3dec('0x11')](_0x3dec('0xd'),auth['isAuthenticated'](),controller[_0x3dec('0x12')]);router[_0x3dec('0x11')](_0x3dec('0x13'),auth[_0x3dec('0x9')](),controller[_0x3dec('0x14')]);router[_0x3dec('0x11')]('/:id/reject',auth['isAuthenticated'](),controller[_0x3dec('0x15')]);router['delete'](_0x3dec('0xd'),auth[_0x3dec('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf6c2=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','post','openchannel','openchannelmessage:create','create','put','/:id','update','/:id/accept','accept','delete','destroy','exports'];(function(_0x525147,_0xdab712){var _0x2da357=function(_0x486fac){while(--_0x486fac){_0x525147['push'](_0x525147['shift']());}};_0x2da357(++_0xdab712);}(_0xf6c2,0xcf));var _0x2f6c=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xf6c2[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require('multer');var util=require(_0x2f6c('0x0'));var path=require(_0x2f6c('0x1'));var timeout=require(_0x2f6c('0x2'));var express=require(_0x2f6c('0x3'));var router=express[_0x2f6c('0x4')]();var fs_extra=require(_0x2f6c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2f6c('0x6'));var controller=require('./openchannelMessage.controller');router[_0x2f6c('0x7')]('/',auth[_0x2f6c('0x8')](),controller[_0x2f6c('0x9')]);router[_0x2f6c('0x7')](_0x2f6c('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x2f6c('0x7')]('/:id',auth[_0x2f6c('0x8')](),controller['show']);router[_0x2f6c('0xb')]('/',auth[_0x2f6c('0x8')](),interaction['tracked'](_0x2f6c('0xc'),_0x2f6c('0xd')),controller[_0x2f6c('0xe')]);router[_0x2f6c('0xf')](_0x2f6c('0x10'),auth[_0x2f6c('0x8')](),controller[_0x2f6c('0x11')]);router[_0x2f6c('0xf')](_0x2f6c('0x12'),auth[_0x2f6c('0x8')](),controller[_0x2f6c('0x13')]);router[_0x2f6c('0xf')]('/:id/reject',auth[_0x2f6c('0x8')](),controller['reject']);router[_0x2f6c('0x14')](_0x2f6c('0x10'),auth[_0x2f6c('0x8')](),controller[_0x2f6c('0x15')]);module[_0x2f6c('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 36a5aea..6a371c9 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 _0x7924=['out','DATE','sequelize','TEXT','BOOLEAN','ENUM'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x7924,0x158));var _0x4792=function(_0x2f6233,_0x90172){_0x2f6233=_0x2f6233-0x0;var _0x1c9c36=_0x7924[_0x2f6233];return _0x1c9c36;};'use strict';var Sequelize=require(_0x4792('0x0'));module['exports']={'body':{'type':Sequelize[_0x4792('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4792('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4792('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4792('0x3')]('in',_0x4792('0x4')),'defaultValue':_0x4792('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4792('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4792('0x1')]}}; \ No newline at end of file +var _0xc69e=['out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x115da5,_0x3377ff){var _0x48dc02=function(_0xcae7ab){while(--_0xcae7ab){_0x115da5['push'](_0x115da5['shift']());}};_0x48dc02(++_0x3377ff);}(_0xc69e,0xff));var _0xec69=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc69e[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xec69('0x0'));module[_0xec69('0x1')]={'body':{'type':Sequelize[_0xec69('0x2')](_0xec69('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xec69('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xec69('0x5')]('in',_0xec69('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xec69('0x7')]},'providerName':{'type':Sequelize[_0xec69('0x8')]},'providerResponse':{'type':Sequelize[_0xec69('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 305b33c..44bf0f4 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 _0x0122=['Contact','get','OpenchannelInteractionId','isNil','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','eml-format','zip-dir','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','render','merge','contact','agent','interaction','account','index','map','OpenchannelMessage','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','rawAttributes','catch','create','body','find','describe','openchannel-interactions','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact'];(function(_0x3d40c3,_0x58a3a8){var _0x4b7a81=function(_0x230773){while(--_0x230773){_0x3d40c3['push'](_0x3d40c3['shift']());}};_0x4b7a81(++_0x58a3a8);}(_0x0122,0x92));var _0x2012=function(_0x4b3e99,_0x25e085){_0x4b3e99=_0x4b3e99-0x0;var _0x2f9767=_0x0122[_0x4b3e99];return _0x2f9767;};'use strict';var emlformat=require(_0x2012('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2012('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2012('0x2'));var Mustache=require(_0x2012('0x3'));var util=require(_0x2012('0x4'));var path=require(_0x2012('0x5'));var sox=require('sox');var csv=require(_0x2012('0x6'));var ejs=require(_0x2012('0x7'));var fs=require('fs');var fs_extra=require(_0x2012('0x8'));var _=require(_0x2012('0x9'));var squel=require('squel');var crypto=require(_0x2012('0xa'));var jsforce=require(_0x2012('0xb'));var deskjs=require(_0x2012('0xc'));var toCsv=require(_0x2012('0x6'));var querystring=require(_0x2012('0xd'));var Papa=require(_0x2012('0xe'));var Redis=require(_0x2012('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2012('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2012('0x11'));var logger=require(_0x2012('0x12'))(_0x2012('0x13'));var utils=require(_0x2012('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2012('0x15'));var db=require(_0x2012('0x16'))['db'];config[_0x2012('0x17')]=_['defaults'](config[_0x2012('0x17')],{'host':_0x2012('0x18'),'port':0x18eb});var socket=require(_0x2012('0x19'))(new Redis(config['redis']));require(_0x2012('0x1a'))[_0x2012('0x1b')](socket);var jayson=require(_0x2012('0x1c'));var client=jayson['client'][_0x2012('0x1d')]({'port':0x232c});var client9002=jayson[_0x2012('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x329937,_0x43226f,_0x340ac6,_0x27f2a2){return new BPromise(function(_0x5bab88,_0x48a2da){var _0x5d46bb=_0x27f2a2||client;return _0x5d46bb['request'](_0x329937,_0x340ac6)[_0x2012('0x1f')](function(_0x58f6ca){logger[_0x2012('0x20')](_0x2012('0x21'),_0x43226f,_0x2012('0x22'));logger[_0x2012('0x23')](_0x2012('0x24'),_0x43226f,_0x2012('0x22'),JSON[_0x2012('0x25')](_0x58f6ca));if(_0x58f6ca[_0x2012('0x26')]){if(_0x58f6ca[_0x2012('0x26')]['code']===0x1f4){logger['error'](_0x2012('0x21'),_0x43226f,_0x58f6ca[_0x2012('0x26')][_0x2012('0x27')]);return _0x48a2da(_0x58f6ca[_0x2012('0x26')][_0x2012('0x27')]);}logger[_0x2012('0x26')](_0x2012('0x21'),_0x43226f,_0x58f6ca[_0x2012('0x26')]['message']);return _0x5bab88(_0x58f6ca[_0x2012('0x26')][_0x2012('0x27')]);}else{logger[_0x2012('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x43226f,_0x2012('0x22'));_0x5bab88(_0x58f6ca[_0x2012('0x28')][_0x2012('0x27')]);}})['catch'](function(_0x176b5c){logger[_0x2012('0x26')](_0x2012('0x21'),_0x43226f,_0x176b5c);_0x48a2da(_0x176b5c);});});}function respondWithStatusCode(_0x4975bd,_0x264eb9){_0x264eb9=_0x264eb9||0xcc;return function(_0x130c13){if(_0x130c13){return _0x4975bd[_0x2012('0x29')](_0x264eb9);}return _0x4975bd[_0x2012('0x2a')](_0x264eb9)['end']();};}function respondWithResult(_0x3f65e3,_0x36bed6){_0x36bed6=_0x36bed6||0xc8;return function(_0x109c7c){if(_0x109c7c){return _0x3f65e3[_0x2012('0x2a')](_0x36bed6)[_0x2012('0x2b')](_0x109c7c);}};}function respondWithFilteredResult(_0x2492b2,_0x5e7df3){return function(_0x1c5216){if(_0x1c5216){var _0x495da4=typeof _0x5e7df3[_0x2012('0x2c')]===_0x2012('0x2d')&&typeof _0x5e7df3['limit']===_0x2012('0x2d');var _0xf3b1f8=_0x1c5216[_0x2012('0x2e')];var _0x47e3d5=_0x495da4?0x0:_0x5e7df3[_0x2012('0x2c')];var _0x403240=_0x495da4?_0x1c5216[_0x2012('0x2e')]:_0x5e7df3[_0x2012('0x2c')]+_0x5e7df3[_0x2012('0x2f')];var _0x80ea04;if(_0x403240>=_0xf3b1f8){_0x403240=_0xf3b1f8;_0x80ea04=0xc8;}else{_0x80ea04=0xce;}_0x2492b2['status'](_0x80ea04);return _0x2492b2[_0x2012('0x30')](_0x2012('0x31'),_0x47e3d5+'-'+_0x403240+'/'+_0xf3b1f8)['json'](_0x1c5216);}return null;};}function patchUpdates(_0x55894d){return function(_0x312033){try{jsonpatch[_0x2012('0x32')](_0x312033,_0x55894d,!![]);}catch(_0xd4486){return BPromise[_0x2012('0x33')](_0xd4486);}return _0x312033[_0x2012('0x34')]();};}function saveUpdates(_0x4530bf,_0x39ecaf){return function(_0x37f2bc){if(_0x37f2bc){return _0x37f2bc[_0x2012('0x35')](_0x4530bf)[_0x2012('0x1f')](function(_0xdb166){return _0xdb166;});}return null;};}function removeEntity(_0x18518c,_0x408508){return function(_0x57c808){if(_0x57c808){return _0x57c808[_0x2012('0x36')]()[_0x2012('0x1f')](function(){_0x18518c[_0x2012('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x280c06,_0x12a7c6){return function(_0xea2d8a){if(!_0xea2d8a){_0x280c06[_0x2012('0x29')](0x194);}return _0xea2d8a;};}function handleError(_0x5e517c,_0x2d14c1){_0x2d14c1=_0x2d14c1||0x1f4;return function(_0x5b9ff2){logger[_0x2012('0x26')](_0x5b9ff2[_0x2012('0x37')]);if(_0x5b9ff2['name']){delete _0x5b9ff2[_0x2012('0x38')];}_0x5e517c[_0x2012('0x2a')](_0x2d14c1)[_0x2012('0x39')](_0x5b9ff2);};}function getMustacheRender(_0x2a85fb,_0x16d097){return Mustache[_0x2012('0x3a')](_0x2a85fb,_[_0x2012('0x3b')](_0x16d097['body'],{'contact':_0x16d097[_0x2012('0x3c')],'message':_0x16d097['message'],'agent':_0x16d097[_0x2012('0x3d')],'interaction':_0x16d097[_0x2012('0x3e')],'account':_0x16d097[_0x2012('0x3f')]}))||'';}exports[_0x2012('0x40')]=function(_0x36d7a2,_0x405536){var _0x5df45b={},_0x19b0a5={},_0x3b47e8={'count':0x0,'rows':[]};var _0x469d4c=_[_0x2012('0x41')](db[_0x2012('0x42')]['rawAttributes'],function(_0x383c0f){return{'name':_0x383c0f[_0x2012('0x43')],'type':_0x383c0f[_0x2012('0x44')][_0x2012('0x45')]};});_0x19b0a5[_0x2012('0x46')]=_[_0x2012('0x41')](_0x469d4c,_0x2012('0x38'));_0x19b0a5[_0x2012('0x47')]=_['keys'](_0x36d7a2[_0x2012('0x47')]);_0x19b0a5['filters']=_['intersection'](_0x19b0a5[_0x2012('0x46')],_0x19b0a5['query']);_0x5df45b[_0x2012('0x48')]=_[_0x2012('0x49')](_0x19b0a5[_0x2012('0x46')],qs[_0x2012('0x4a')](_0x36d7a2[_0x2012('0x47')]['fields']));_0x5df45b['attributes']=_0x5df45b[_0x2012('0x48')][_0x2012('0x4b')]?_0x5df45b['attributes']:_0x19b0a5[_0x2012('0x46')];if(!_0x36d7a2['query'][_0x2012('0x4c')](_0x2012('0x4d'))){_0x5df45b[_0x2012('0x2f')]=qs[_0x2012('0x2f')](_0x36d7a2[_0x2012('0x47')][_0x2012('0x2f')]);_0x5df45b['offset']=qs[_0x2012('0x2c')](_0x36d7a2['query'][_0x2012('0x2c')]);}_0x5df45b[_0x2012('0x4e')]=qs['sort'](_0x36d7a2['query'][_0x2012('0x4f')]);_0x5df45b[_0x2012('0x50')]=qs[_0x2012('0x51')](_[_0x2012('0x52')](_0x36d7a2[_0x2012('0x47')],_0x19b0a5[_0x2012('0x51')]),_0x469d4c);if(_0x36d7a2[_0x2012('0x47')][_0x2012('0x53')]){_0x5df45b[_0x2012('0x50')]=_[_0x2012('0x3b')](_0x5df45b[_0x2012('0x50')],{'$or':_[_0x2012('0x41')](_0x469d4c,function(_0x391cad){if(_0x391cad['type']!==_0x2012('0x54')){var _0xb5ba66={};_0xb5ba66[_0x391cad[_0x2012('0x38')]]={'$like':'%'+_0x36d7a2['query'][_0x2012('0x53')]+'%'};return _0xb5ba66;}})});}_0x5df45b=_[_0x2012('0x3b')]({},_0x5df45b,_0x36d7a2[_0x2012('0x55')]);var _0x25bfeb={'where':_0x5df45b[_0x2012('0x50')]};return db[_0x2012('0x42')][_0x2012('0x2e')](_0x25bfeb)[_0x2012('0x1f')](function(_0x4d7dc){_0x3b47e8[_0x2012('0x2e')]=_0x4d7dc;if(_0x36d7a2[_0x2012('0x47')][_0x2012('0x56')]){_0x5df45b[_0x2012('0x57')]=[{'all':!![]}];}return db[_0x2012('0x42')][_0x2012('0x58')](_0x5df45b);})[_0x2012('0x1f')](function(_0x4760f4){_0x3b47e8[_0x2012('0x59')]=_0x4760f4;return _0x3b47e8;})[_0x2012('0x1f')](respondWithFilteredResult(_0x405536,_0x5df45b))['catch'](handleError(_0x405536,null));};exports['show']=function(_0x3afe4a,_0x182ad5){var _0x2c75eb={'raw':!![],'where':{'id':_0x3afe4a[_0x2012('0x5a')]['id']}},_0x183080={};_0x183080[_0x2012('0x46')]=_[_0x2012('0x5b')](db[_0x2012('0x42')][_0x2012('0x5c')]);_0x183080[_0x2012('0x47')]=_[_0x2012('0x5b')](_0x3afe4a['query']);_0x183080[_0x2012('0x51')]=_[_0x2012('0x49')](_0x183080['model'],_0x183080[_0x2012('0x47')]);_0x2c75eb[_0x2012('0x48')]=_[_0x2012('0x49')](_0x183080[_0x2012('0x46')],qs[_0x2012('0x4a')](_0x3afe4a[_0x2012('0x47')]['fields']));_0x2c75eb[_0x2012('0x48')]=_0x2c75eb[_0x2012('0x48')][_0x2012('0x4b')]?_0x2c75eb[_0x2012('0x48')]:_0x183080[_0x2012('0x46')];if(_0x3afe4a[_0x2012('0x47')][_0x2012('0x56')]){_0x2c75eb['include']=[{'all':!![]}];}_0x2c75eb=_[_0x2012('0x3b')]({},_0x2c75eb,_0x3afe4a[_0x2012('0x55')]);return db[_0x2012('0x42')]['find'](_0x2c75eb)[_0x2012('0x1f')](handleEntityNotFound(_0x182ad5,null))['then'](respondWithResult(_0x182ad5,null))[_0x2012('0x5d')](handleError(_0x182ad5,null));};exports['create']=function(_0x1d47b1,_0x5e7ff6){return db[_0x2012('0x42')][_0x2012('0x5e')](_0x1d47b1[_0x2012('0x5f')],{})[_0x2012('0x1f')](respondWithResult(_0x5e7ff6,0xc9))[_0x2012('0x5d')](handleError(_0x5e7ff6,null));};exports[_0x2012('0x35')]=function(_0x3f4d88,_0x51fced){if(_0x3f4d88[_0x2012('0x5f')]['id']){delete _0x3f4d88[_0x2012('0x5f')]['id'];}return db[_0x2012('0x42')][_0x2012('0x60')]({'where':{'id':_0x3f4d88[_0x2012('0x5a')]['id']}})['then'](handleEntityNotFound(_0x51fced,null))['then'](saveUpdates(_0x3f4d88[_0x2012('0x5f')],null))[_0x2012('0x1f')](respondWithResult(_0x51fced,null))[_0x2012('0x5d')](handleError(_0x51fced,null));};exports[_0x2012('0x36')]=function(_0x159620,_0x1c8c2c){return db[_0x2012('0x42')][_0x2012('0x60')]({'where':{'id':_0x159620['params']['id']}})['then'](handleEntityNotFound(_0x1c8c2c,null))[_0x2012('0x1f')](removeEntity(_0x1c8c2c,null))['catch'](handleError(_0x1c8c2c,null));};exports[_0x2012('0x61')]=function(_0x3019bd,_0x3f1708){return db[_0x2012('0x42')][_0x2012('0x61')]()['then'](respondWithResult(_0x3f1708,null))['catch'](handleError(_0x3f1708,null));};var interaction_log=require(_0x2012('0x12'))(_0x2012('0x62'));exports['accept']=function(_0x57ecf3,_0x1a535d,_0x5c1ae4){var _0x406f9a={'agent':{},'channel':_0x2012('0x63')};if(_0x57ecf3['body']['id']){delete _0x57ecf3[_0x2012('0x5f')]['id'];}_0x57ecf3['body'][_0x2012('0x64')]=!![];_0x57ecf3[_0x2012('0x5f')]['readAt']=moment()[_0x2012('0x65')](_0x2012('0x66'));_0x57ecf3[_0x2012('0x5f')][_0x2012('0x67')]=_0x57ecf3['body'][_0x2012('0x67')]||_0x57ecf3[_0x2012('0x68')]['id'];_0x406f9a[_0x2012('0x3d')]['id']=_0x57ecf3[_0x2012('0x5f')][_0x2012('0x67')];return db[_0x2012('0x42')][_0x2012('0x60')]({'where':{'id':_0x57ecf3[_0x2012('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x2012('0x69')],'as':_0x2012('0x6a')}]})['then'](handleEntityNotFound(_0x1a535d,null))['then'](saveUpdates(_0x57ecf3[_0x2012('0x5f')],null))[_0x2012('0x1f')](function(_0x341ca6){if(_0x341ca6){_0x406f9a[_0x2012('0x27')]=_0x341ca6[_0x2012('0x6b')]({'plain':!![]});return db['OpenchannelInteraction'][_0x2012('0x60')]({'where':{'id':_0x341ca6[_0x2012('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0x1a535d,null))[_0x2012('0x1f')](function(_0x250d18){if(_0x250d18){return _0x250d18['update']({'UserId':_0x57ecf3[_0x2012('0x5f')][_0x2012('0x67')],'read1stAt':_[_0x2012('0x6d')](_0x250d18['read1stAt'])?moment()[_0x2012('0x65')](_0x2012('0x66')):undefined});}return null;})[_0x2012('0x1f')](function(_0x308c6c){if(_0x308c6c){_0x406f9a[_0x2012('0x3e')]=_0x308c6c[_0x2012('0x6b')]({'plain':!![]});interaction_log[_0x2012('0x20')](_0x2012('0x6e'),_0x57ecf3[_0x2012('0x68')]['id'],_0x57ecf3[_0x2012('0x68')][_0x2012('0x38')],_0x57ecf3['user'][_0x2012('0x6f')],_0x406f9a[_0x2012('0x3e')]['id'],_0x57ecf3[_0x2012('0x5f')]?JSON[_0x2012('0x25')](_0x57ecf3['body']):_0x2012('0x70'));return respondWithRpcPromise(_0x2012('0x71'),'acceptMessage',_0x406f9a);}return null;})['then'](function(_0x2864c8){if(_0x2864c8){if(_0x57ecf3[_0x2012('0x5f')][_0x2012('0x72')]){_0x406f9a['message'][_0x2012('0x73')]=util['format'](_0x2012('0x74'),_0x57ecf3['user']['name']);_0x406f9a[_0x2012('0x27')][_0x2012('0x75')]=_0x406f9a[_0x2012('0x75')];_0x406f9a[_0x2012('0x27')][_0x2012('0x76')]=_0x2012('0x77');return respondWithRpcPromise(_0x2012('0x78'),_0x2012('0x78'),{'event':_0x2012('0x79'),'message':_0x406f9a['message']},client9002)[_0x2012('0x1f')](function(){return _0x406f9a;});}return _0x406f9a;}return null;})['then'](respondWithResult(_0x1a535d,null))[_0x2012('0x5d')](handleError(_0x1a535d,null));};var interaction_log=require(_0x2012('0x12'))('openchannel-interactions');exports[_0x2012('0x33')]=function(_0x3d1f9d,_0x150c8e,_0x53616b){var _0x3df51a={'agent':{},'channel':_0x2012('0x63')};if(_0x3d1f9d[_0x2012('0x5f')]['id']){delete _0x3d1f9d[_0x2012('0x5f')]['id'];}_0x3d1f9d[_0x2012('0x5f')][_0x2012('0x67')]=_0x3d1f9d[_0x2012('0x5f')][_0x2012('0x67')]||_0x3d1f9d[_0x2012('0x68')]['id'];_0x3df51a[_0x2012('0x3d')]['id']=_0x3d1f9d[_0x2012('0x5f')][_0x2012('0x67')];return db[_0x2012('0x42')][_0x2012('0x60')]({'where':{'id':_0x3d1f9d[_0x2012('0x5a')]['id'],'UserId':null}})[_0x2012('0x1f')](handleEntityNotFound(_0x150c8e,null))[_0x2012('0x1f')](function(_0x141b6c){if(_0x141b6c){_0x3df51a[_0x2012('0x27')]=_0x141b6c[_0x2012('0x6b')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x141b6c['OpenchannelInteractionId']}});}return null;})[_0x2012('0x1f')](handleEntityNotFound(_0x150c8e,null))[_0x2012('0x1f')](function(_0xeccbbf){if(_0xeccbbf){_0x3df51a[_0x2012('0x3e')]=_0xeccbbf[_0x2012('0x6b')]({'plain':!![]});interaction_log[_0x2012('0x20')](_0x2012('0x7a'),_0x3d1f9d[_0x2012('0x68')]['id'],_0x3d1f9d['user']['name'],_0x3d1f9d['user'][_0x2012('0x6f')],_0x3df51a['interaction']['id'],_0x3d1f9d['body']?JSON[_0x2012('0x25')](_0x3d1f9d[_0x2012('0x5f')]):_0x2012('0x70'));return respondWithRpcPromise(_0x2012('0x7b'),_0x2012('0x7c'),_0x3df51a);}return null;})[_0x2012('0x1f')](function(_0x5dcc87){if(_0x5dcc87){_0x5dcc87[_0x2012('0x27')][_0x2012('0x73')]=util['format']('SIP/%s',_0x3d1f9d[_0x2012('0x68')][_0x2012('0x38')]);_0x5dcc87[_0x2012('0x27')]['channel']=_0x3df51a[_0x2012('0x75')];_0x5dcc87[_0x2012('0x27')][_0x2012('0x76')]=_0x2012('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':_0x2012('0x7d'),'message':_0x5dcc87['message']},client9002);return _0x3df51a;}return null;})[_0x2012('0x1f')](respondWithResult(_0x150c8e,null))[_0x2012('0x5d')](handleError(_0x150c8e,null));}; \ No newline at end of file +var _0x9e29=['sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','stack','name','send','merge','body','contact','agent','interaction','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','OpenchannelMessage','includeAll','include','rows','show','params','rawAttributes','options','find','create','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch'];(function(_0x4da097,_0x1bd4f6){var _0x5818bc=function(_0x11cfd8){while(--_0x11cfd8){_0x4da097['push'](_0x4da097['shift']());}};_0x5818bc(++_0x1bd4f6);}(_0x9e29,0xc2));var _0x99e2=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x9e29[_0x47a349];return _0x18ab75;};'use strict';var emlformat=require(_0x99e2('0x0'));var rimraf=require(_0x99e2('0x1'));var zipdir=require(_0x99e2('0x2'));var jsonpatch=require(_0x99e2('0x3'));var rp=require('request-promise');var moment=require(_0x99e2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x99e2('0x5'));var util=require('util');var path=require(_0x99e2('0x6'));var sox=require(_0x99e2('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x99e2('0x8'));var squel=require(_0x99e2('0x9'));var crypto=require('crypto');var jsforce=require(_0x99e2('0xa'));var deskjs=require(_0x99e2('0xb'));var toCsv=require(_0x99e2('0xc'));var querystring=require(_0x99e2('0xd'));var Papa=require(_0x99e2('0xe'));var Redis=require(_0x99e2('0xf'));var authService=require(_0x99e2('0x10'));var qs=require(_0x99e2('0x11'));var as=require(_0x99e2('0x12'));var hardwareService=require(_0x99e2('0x13'));var logger=require(_0x99e2('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x99e2('0x15'));var licenseUtil=require(_0x99e2('0x16'));var db=require('../../mysqldb')['db'];config[_0x99e2('0x17')]=_[_0x99e2('0x18')](config[_0x99e2('0x17')],{'host':_0x99e2('0x19'),'port':0x18eb});var socket=require(_0x99e2('0x1a'))(new Redis(config[_0x99e2('0x17')]));require(_0x99e2('0x1b'))[_0x99e2('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x99e2('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28bf3e,_0x111379,_0x10cf71,_0x2f7c52){return new BPromise(function(_0x31bfc3,_0x439643){var _0x3f4fa8=_0x2f7c52||client;return _0x3f4fa8[_0x99e2('0x1e')](_0x28bf3e,_0x10cf71)[_0x99e2('0x1f')](function(_0x50c51e){logger[_0x99e2('0x20')](_0x99e2('0x21'),_0x111379,'request\x20sent');logger[_0x99e2('0x22')](_0x99e2('0x23'),_0x111379,'request\x20sent',JSON[_0x99e2('0x24')](_0x50c51e));if(_0x50c51e[_0x99e2('0x25')]){if(_0x50c51e[_0x99e2('0x25')]['code']===0x1f4){logger[_0x99e2('0x25')](_0x99e2('0x21'),_0x111379,_0x50c51e[_0x99e2('0x25')][_0x99e2('0x26')]);return _0x439643(_0x50c51e['error'][_0x99e2('0x26')]);}logger[_0x99e2('0x25')](_0x99e2('0x21'),_0x111379,_0x50c51e[_0x99e2('0x25')][_0x99e2('0x26')]);return _0x31bfc3(_0x50c51e[_0x99e2('0x25')][_0x99e2('0x26')]);}else{logger[_0x99e2('0x20')](_0x99e2('0x21'),_0x111379,_0x99e2('0x27'));_0x31bfc3(_0x50c51e[_0x99e2('0x28')][_0x99e2('0x26')]);}})[_0x99e2('0x29')](function(_0x5805a1){logger['error'](_0x99e2('0x21'),_0x111379,_0x5805a1);_0x439643(_0x5805a1);});});}function respondWithStatusCode(_0x429e22,_0x18a07f){_0x18a07f=_0x18a07f||0xcc;return function(_0x44a2bd){if(_0x44a2bd){return _0x429e22[_0x99e2('0x2a')](_0x18a07f);}return _0x429e22[_0x99e2('0x2b')](_0x18a07f)[_0x99e2('0x2c')]();};}function respondWithResult(_0xd0f8dc,_0x2d6df1){_0x2d6df1=_0x2d6df1||0xc8;return function(_0x11f85b){if(_0x11f85b){return _0xd0f8dc[_0x99e2('0x2b')](_0x2d6df1)[_0x99e2('0x2d')](_0x11f85b);}};}function respondWithFilteredResult(_0x27cd82,_0x5044ee){return function(_0x3b157e){if(_0x3b157e){var _0x1138c9=typeof _0x5044ee['offset']==='undefined'&&typeof _0x5044ee['limit']===_0x99e2('0x2e');var _0x24c3d2=_0x3b157e[_0x99e2('0x2f')];var _0x1f9291=_0x1138c9?0x0:_0x5044ee['offset'];var _0x17d35e=_0x1138c9?_0x3b157e[_0x99e2('0x2f')]:_0x5044ee[_0x99e2('0x30')]+_0x5044ee[_0x99e2('0x31')];var _0x25f23f;if(_0x17d35e>=_0x24c3d2){_0x17d35e=_0x24c3d2;_0x25f23f=0xc8;}else{_0x25f23f=0xce;}_0x27cd82[_0x99e2('0x2b')](_0x25f23f);return _0x27cd82[_0x99e2('0x32')](_0x99e2('0x33'),_0x1f9291+'-'+_0x17d35e+'/'+_0x24c3d2)[_0x99e2('0x2d')](_0x3b157e);}return null;};}function patchUpdates(_0x3d2ff1){return function(_0x2bc640){try{jsonpatch['apply'](_0x2bc640,_0x3d2ff1,!![]);}catch(_0x396a92){return BPromise[_0x99e2('0x34')](_0x396a92);}return _0x2bc640[_0x99e2('0x35')]();};}function saveUpdates(_0x4064fb,_0x27d4fc){return function(_0x40375f){if(_0x40375f){return _0x40375f['update'](_0x4064fb)[_0x99e2('0x1f')](function(_0x59e33c){return _0x59e33c;});}return null;};}function removeEntity(_0x50a492,_0x4cc48c){return function(_0x5c436f){if(_0x5c436f){return _0x5c436f['destroy']()[_0x99e2('0x1f')](function(){_0x50a492[_0x99e2('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36fc26,_0x14c9e6){return function(_0x44eec4){if(!_0x44eec4){_0x36fc26[_0x99e2('0x2a')](0x194);}return _0x44eec4;};}function handleError(_0xe2eb9d,_0x5def28){_0x5def28=_0x5def28||0x1f4;return function(_0x4dbf7f){logger[_0x99e2('0x25')](_0x4dbf7f[_0x99e2('0x36')]);if(_0x4dbf7f[_0x99e2('0x37')]){delete _0x4dbf7f['name'];}_0xe2eb9d[_0x99e2('0x2b')](_0x5def28)[_0x99e2('0x38')](_0x4dbf7f);};}function getMustacheRender(_0x579a17,_0x5b154b){return Mustache['render'](_0x579a17,_[_0x99e2('0x39')](_0x5b154b[_0x99e2('0x3a')],{'contact':_0x5b154b[_0x99e2('0x3b')],'message':_0x5b154b['message'],'agent':_0x5b154b[_0x99e2('0x3c')],'interaction':_0x5b154b[_0x99e2('0x3d')],'account':_0x5b154b['account']}))||'';}exports['index']=function(_0x2c7f56,_0x59ff63){var _0x1b0fd5={},_0x47dd9c={},_0x19d7c4={'count':0x0,'rows':[]};var _0x4386d9=_[_0x99e2('0x3e')](db['OpenchannelMessage']['rawAttributes'],function(_0x33485e){return{'name':_0x33485e[_0x99e2('0x3f')],'type':_0x33485e[_0x99e2('0x40')][_0x99e2('0x41')]};});_0x47dd9c[_0x99e2('0x42')]=_[_0x99e2('0x3e')](_0x4386d9,_0x99e2('0x37'));_0x47dd9c['query']=_[_0x99e2('0x43')](_0x2c7f56[_0x99e2('0x44')]);_0x47dd9c[_0x99e2('0x45')]=_[_0x99e2('0x46')](_0x47dd9c[_0x99e2('0x42')],_0x47dd9c['query']);_0x1b0fd5[_0x99e2('0x47')]=_[_0x99e2('0x46')](_0x47dd9c[_0x99e2('0x42')],qs[_0x99e2('0x48')](_0x2c7f56[_0x99e2('0x44')]['fields']));_0x1b0fd5['attributes']=_0x1b0fd5[_0x99e2('0x47')][_0x99e2('0x49')]?_0x1b0fd5[_0x99e2('0x47')]:_0x47dd9c[_0x99e2('0x42')];if(!_0x2c7f56[_0x99e2('0x44')][_0x99e2('0x4a')]('nolimit')){_0x1b0fd5[_0x99e2('0x31')]=qs[_0x99e2('0x31')](_0x2c7f56[_0x99e2('0x44')][_0x99e2('0x31')]);_0x1b0fd5[_0x99e2('0x30')]=qs[_0x99e2('0x30')](_0x2c7f56[_0x99e2('0x44')][_0x99e2('0x30')]);}_0x1b0fd5['order']=qs[_0x99e2('0x4b')](_0x2c7f56['query'][_0x99e2('0x4b')]);_0x1b0fd5[_0x99e2('0x4c')]=qs[_0x99e2('0x45')](_[_0x99e2('0x4d')](_0x2c7f56[_0x99e2('0x44')],_0x47dd9c[_0x99e2('0x45')]),_0x4386d9);if(_0x2c7f56[_0x99e2('0x44')][_0x99e2('0x4e')]){_0x1b0fd5['where']=_[_0x99e2('0x39')](_0x1b0fd5[_0x99e2('0x4c')],{'$or':_['map'](_0x4386d9,function(_0x4f3285){if(_0x4f3285[_0x99e2('0x40')]!=='VIRTUAL'){var _0x528daf={};_0x528daf[_0x4f3285[_0x99e2('0x37')]]={'$like':'%'+_0x2c7f56[_0x99e2('0x44')]['filter']+'%'};return _0x528daf;}})});}_0x1b0fd5=_[_0x99e2('0x39')]({},_0x1b0fd5,_0x2c7f56['options']);var _0x22abd7={'where':_0x1b0fd5[_0x99e2('0x4c')]};return db[_0x99e2('0x4f')][_0x99e2('0x2f')](_0x22abd7)[_0x99e2('0x1f')](function(_0x45c6ee){_0x19d7c4['count']=_0x45c6ee;if(_0x2c7f56['query'][_0x99e2('0x50')]){_0x1b0fd5[_0x99e2('0x51')]=[{'all':!![]}];}return db[_0x99e2('0x4f')]['findAll'](_0x1b0fd5);})['then'](function(_0x72af42){_0x19d7c4[_0x99e2('0x52')]=_0x72af42;return _0x19d7c4;})['then'](respondWithFilteredResult(_0x59ff63,_0x1b0fd5))[_0x99e2('0x29')](handleError(_0x59ff63,null));};exports[_0x99e2('0x53')]=function(_0x1e11c2,_0x397951){var _0xcbf2cd={'raw':!![],'where':{'id':_0x1e11c2[_0x99e2('0x54')]['id']}},_0x24445a={};_0x24445a['model']=_[_0x99e2('0x43')](db['OpenchannelMessage'][_0x99e2('0x55')]);_0x24445a[_0x99e2('0x44')]=_['keys'](_0x1e11c2[_0x99e2('0x44')]);_0x24445a[_0x99e2('0x45')]=_['intersection'](_0x24445a['model'],_0x24445a[_0x99e2('0x44')]);_0xcbf2cd[_0x99e2('0x47')]=_[_0x99e2('0x46')](_0x24445a[_0x99e2('0x42')],qs[_0x99e2('0x48')](_0x1e11c2[_0x99e2('0x44')][_0x99e2('0x48')]));_0xcbf2cd[_0x99e2('0x47')]=_0xcbf2cd[_0x99e2('0x47')][_0x99e2('0x49')]?_0xcbf2cd[_0x99e2('0x47')]:_0x24445a[_0x99e2('0x42')];if(_0x1e11c2[_0x99e2('0x44')][_0x99e2('0x50')]){_0xcbf2cd[_0x99e2('0x51')]=[{'all':!![]}];}_0xcbf2cd=_['merge']({},_0xcbf2cd,_0x1e11c2[_0x99e2('0x56')]);return db[_0x99e2('0x4f')][_0x99e2('0x57')](_0xcbf2cd)[_0x99e2('0x1f')](handleEntityNotFound(_0x397951,null))[_0x99e2('0x1f')](respondWithResult(_0x397951,null))[_0x99e2('0x29')](handleError(_0x397951,null));};exports['create']=function(_0x37798a,_0x274495){return db['OpenchannelMessage'][_0x99e2('0x58')](_0x37798a[_0x99e2('0x3a')],{})[_0x99e2('0x1f')](respondWithResult(_0x274495,0xc9))[_0x99e2('0x29')](handleError(_0x274495,null));};exports['update']=function(_0x27eedb,_0x5520b3){if(_0x27eedb[_0x99e2('0x3a')]['id']){delete _0x27eedb[_0x99e2('0x3a')]['id'];}return db[_0x99e2('0x4f')]['find']({'where':{'id':_0x27eedb['params']['id']}})[_0x99e2('0x1f')](handleEntityNotFound(_0x5520b3,null))[_0x99e2('0x1f')](saveUpdates(_0x27eedb[_0x99e2('0x3a')],null))['then'](respondWithResult(_0x5520b3,null))[_0x99e2('0x29')](handleError(_0x5520b3,null));};exports['destroy']=function(_0x40ad07,_0x279076){return db[_0x99e2('0x4f')]['find']({'where':{'id':_0x40ad07[_0x99e2('0x54')]['id']}})[_0x99e2('0x1f')](handleEntityNotFound(_0x279076,null))['then'](removeEntity(_0x279076,null))[_0x99e2('0x29')](handleError(_0x279076,null));};exports[_0x99e2('0x59')]=function(_0x3ae8cc,_0x26a1ef){return db[_0x99e2('0x4f')][_0x99e2('0x59')]()[_0x99e2('0x1f')](respondWithResult(_0x26a1ef,null))['catch'](handleError(_0x26a1ef,null));};var interaction_log=require('../../config/logger')(_0x99e2('0x5a'));exports[_0x99e2('0x5b')]=function(_0x555266,_0x5adf68,_0x5e9add){var _0x153889={'agent':{},'channel':_0x99e2('0x5c')};if(_0x555266['body']['id']){delete _0x555266['body']['id'];}_0x555266[_0x99e2('0x3a')]['read']=!![];_0x555266[_0x99e2('0x3a')][_0x99e2('0x5d')]=moment()[_0x99e2('0x5e')](_0x99e2('0x5f'));_0x555266[_0x99e2('0x3a')][_0x99e2('0x60')]=_0x555266[_0x99e2('0x3a')]['UserId']||_0x555266['user']['id'];_0x153889['agent']['id']=_0x555266['body'][_0x99e2('0x60')];return db[_0x99e2('0x4f')][_0x99e2('0x57')]({'where':{'id':_0x555266[_0x99e2('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x99e2('0x61')],'as':_0x99e2('0x62')}]})['then'](handleEntityNotFound(_0x5adf68,null))[_0x99e2('0x1f')](saveUpdates(_0x555266[_0x99e2('0x3a')],null))[_0x99e2('0x1f')](function(_0x3a15c0){if(_0x3a15c0){_0x153889['message']=_0x3a15c0[_0x99e2('0x63')]({'plain':!![]});return db[_0x99e2('0x64')][_0x99e2('0x57')]({'where':{'id':_0x3a15c0[_0x99e2('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x5adf68,null))['then'](function(_0x597328){if(_0x597328){return _0x597328['update']({'UserId':_0x555266['body'][_0x99e2('0x60')],'read1stAt':_[_0x99e2('0x66')](_0x597328['read1stAt'])?moment()[_0x99e2('0x5e')](_0x99e2('0x5f')):undefined});}return null;})[_0x99e2('0x1f')](function(_0x198c97){if(_0x198c97){_0x153889['interaction']=_0x198c97[_0x99e2('0x63')]({'plain':!![]});interaction_log[_0x99e2('0x20')](_0x99e2('0x67'),_0x555266[_0x99e2('0x68')]['id'],_0x555266[_0x99e2('0x68')][_0x99e2('0x37')],_0x555266[_0x99e2('0x68')]['role'],_0x153889['interaction']['id'],_0x555266[_0x99e2('0x3a')]?JSON[_0x99e2('0x24')](_0x555266['body']):'null');return respondWithRpcPromise(_0x99e2('0x69'),_0x99e2('0x6a'),_0x153889);}return null;})[_0x99e2('0x1f')](function(_0x581be8){if(_0x581be8){if(_0x555266[_0x99e2('0x3a')][_0x99e2('0x6b')]){_0x153889[_0x99e2('0x26')]['interface']=util[_0x99e2('0x5e')](_0x99e2('0x6c'),_0x555266[_0x99e2('0x68')][_0x99e2('0x37')]);_0x153889[_0x99e2('0x26')][_0x99e2('0x6d')]=_0x153889['channel'];_0x153889[_0x99e2('0x26')][_0x99e2('0x6e')]=_0x99e2('0x5b');return respondWithRpcPromise('EventManager',_0x99e2('0x6f'),{'event':_0x99e2('0x70'),'message':_0x153889['message']},client9002)['then'](function(){return _0x153889;});}return _0x153889;}return null;})[_0x99e2('0x1f')](respondWithResult(_0x5adf68,null))[_0x99e2('0x29')](handleError(_0x5adf68,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports['reject']=function(_0x222d00,_0x15f827,_0x337bb9){var _0x24edbd={'agent':{},'channel':_0x99e2('0x5c')};if(_0x222d00[_0x99e2('0x3a')]['id']){delete _0x222d00[_0x99e2('0x3a')]['id'];}_0x222d00[_0x99e2('0x3a')][_0x99e2('0x60')]=_0x222d00[_0x99e2('0x3a')][_0x99e2('0x60')]||_0x222d00[_0x99e2('0x68')]['id'];_0x24edbd[_0x99e2('0x3c')]['id']=_0x222d00['body'][_0x99e2('0x60')];return db[_0x99e2('0x4f')]['find']({'where':{'id':_0x222d00[_0x99e2('0x54')]['id'],'UserId':null}})[_0x99e2('0x1f')](handleEntityNotFound(_0x15f827,null))[_0x99e2('0x1f')](function(_0x5bed4c){if(_0x5bed4c){_0x24edbd['message']=_0x5bed4c['get']({'plain':!![]});return db[_0x99e2('0x64')]['find']({'where':{'id':_0x5bed4c[_0x99e2('0x65')]}});}return null;})[_0x99e2('0x1f')](handleEntityNotFound(_0x15f827,null))[_0x99e2('0x1f')](function(_0x2d414d){if(_0x2d414d){_0x24edbd[_0x99e2('0x3d')]=_0x2d414d[_0x99e2('0x63')]({'plain':!![]});interaction_log[_0x99e2('0x20')](_0x99e2('0x71'),_0x222d00['user']['id'],_0x222d00[_0x99e2('0x68')]['name'],_0x222d00['user'][_0x99e2('0x72')],_0x24edbd[_0x99e2('0x3d')]['id'],_0x222d00['body']?JSON[_0x99e2('0x24')](_0x222d00[_0x99e2('0x3a')]):'null');return respondWithRpcPromise(_0x99e2('0x73'),_0x99e2('0x74'),_0x24edbd);}return null;})[_0x99e2('0x1f')](function(_0x486db5){if(_0x486db5){_0x486db5[_0x99e2('0x26')]['interface']=util[_0x99e2('0x5e')]('SIP/%s',_0x222d00[_0x99e2('0x68')][_0x99e2('0x37')]);_0x486db5['message'][_0x99e2('0x6d')]=_0x24edbd[_0x99e2('0x6d')];_0x486db5[_0x99e2('0x26')][_0x99e2('0x6e')]=_0x99e2('0x34');respondWithRpcPromise(_0x99e2('0x6f'),_0x99e2('0x6f'),{'event':_0x99e2('0x75'),'message':_0x486db5[_0x99e2('0x26')]},client9002);return _0x24edbd;}return null;})[_0x99e2('0x1f')](respondWithResult(_0x15f827,null))['catch'](handleError(_0x15f827,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 7534c31..cae0cc5 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 _0x61b2=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','save'];(function(_0x45dafa,_0x171e29){var _0xeb385a=function(_0x2491d0){while(--_0x2491d0){_0x45dafa['push'](_0x45dafa['shift']());}};_0xeb385a(++_0x171e29);}(_0x61b2,0x1f0));var _0x261b=function(_0xfbd82,_0x2f6818){_0xfbd82=_0xfbd82-0x0;var _0x21a6dc=_0x61b2[_0xfbd82];return _0x21a6dc;};'use strict';var EventEmitter=require(_0x261b('0x0'));var OpenchannelMessage=require(_0x261b('0x1'))['db'][_0x261b('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x261b('0x3'),'afterUpdate':_0x261b('0x4'),'afterDestroy':_0x261b('0x5')};function emitEvent(_0x13a6c7){return function(_0x8af667,_0x755867,_0x59fbe0){OpenchannelMessageEvents[_0x261b('0x6')](_0x13a6c7+':'+_0x8af667['id'],_0x8af667);OpenchannelMessageEvents[_0x261b('0x6')](_0x13a6c7,_0x8af667);_0x59fbe0(null);};}for(var e in events){if(events[_0x261b('0x7')](e)){var event=events[e];OpenchannelMessage[_0x261b('0x8')](e,emitEvent(event));}}module[_0x261b('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x305c=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','emit','hasOwnProperty','exports','events'];(function(_0x20a712,_0x592e7f){var _0x4f38f8=function(_0x458b16){while(--_0x458b16){_0x20a712['push'](_0x20a712['shift']());}};_0x4f38f8(++_0x592e7f);}(_0x305c,0x8f));var _0xc305=function(_0x44474f,_0x431580){_0x44474f=_0x44474f-0x0;var _0x427d97=_0x305c[_0x44474f];return _0x427d97;};'use strict';var EventEmitter=require(_0xc305('0x0'));var OpenchannelMessage=require(_0xc305('0x1'))['db'][_0xc305('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc305('0x3')](0x0);var events={'afterCreate':_0xc305('0x4'),'afterUpdate':_0xc305('0x5'),'afterDestroy':'remove'};function emitEvent(_0x16ab9c){return function(_0x4094fa,_0x2b3077,_0x1d1d14){OpenchannelMessageEvents['emit'](_0x16ab9c+':'+_0x4094fa['id'],_0x4094fa);OpenchannelMessageEvents[_0xc305('0x6')](_0x16ab9c,_0x4094fa);_0x1d1d14(null);};}for(var e in events){if(events[_0xc305('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xc305('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index c6389fa..eba4b28 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 _0x4761=['omit','Interactions','method','GET','POST','body','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','error','inspect','finally','utf8mb4','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','FULLTEXT','models','direction','toLowerCase','secret','isNil','OpenchannelInteraction','then','createdAt','catch','CmContact','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteractionId','Contact','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction'];(function(_0x5a4936,_0x212490){var _0x6a74f2=function(_0x208b58){while(--_0x208b58){_0x5a4936['push'](_0x5a4936['shift']());}};_0x6a74f2(++_0x212490);}(_0x4761,0x133));var _0x1476=function(_0x2a3968,_0x54f0d3){_0x2a3968=_0x2a3968-0x0;var _0x5500f7=_0x4761[_0x2a3968];return _0x5500f7;};'use strict';var _=require(_0x1476('0x0'));var util=require('util');var logger=require(_0x1476('0x1'))(_0x1476('0x2'));var moment=require('moment');var BPromise=require(_0x1476('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1476('0x4'));var rimraf=require(_0x1476('0x5'));var config=require(_0x1476('0x6'));var attributes=require(_0x1476('0x7'));module[_0x1476('0x8')]=function(_0x5e9931,_0x41fb77){return _0x5e9931[_0x1476('0x9')](_0x1476('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x1476('0xb'),'fields':['body'],'type':_0x1476('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x19f1e2,_0x4dc6ea,_0x1f71b4){var _0x8e06b6=_0x5e9931[_0x1476('0xd')];var _0x236f9c=_0x19f1e2['get']({'plain':!![]});if(_0x236f9c[_0x1476('0xe')][_0x1476('0xf')]()==='in'||_0x236f9c[_0x1476('0xe')][_0x1476('0xf')]()==='out'&&!_0x236f9c[_0x1476('0x10')]&&!_[_0x1476('0x11')](_0x236f9c['UserId'])){_0x8e06b6[_0x1476('0x12')]['findOne']({'where':{'id':_0x236f9c['OpenchannelInteractionId']}})[_0x1476('0x13')](function(_0x1c0a90){if(_0x1c0a90){_0x1c0a90['update']({'lastMsgAt':_0x236f9c[_0x1476('0x14')],'lastMsgDirection':_0x236f9c['direction'][_0x1476('0xf')]()});}})[_0x1476('0x15')](function(_0x436042){console['error'](_0x436042);});}if(_0x236f9c['direction']==='out'&&!_0x236f9c[_0x1476('0x10')]){var _0x338585;_0x8e06b6[_0x1476('0x16')]['describe']()[_0x1476('0x13')](function(_0xe85d9c){return _0x8e06b6[_0x1476('0x17')][_0x1476('0x18')]({'where':{'id':_0x236f9c[_0x1476('0x19')]},'include':[{'model':_0x8e06b6[_0x1476('0x12')],'as':'Interactions','where':{'id':_0x236f9c[_0x1476('0x1a')]},'limit':0x1,'include':[{'model':_0x8e06b6[_0x1476('0x16')],'as':_0x1476('0x1b'),'attributes':_['keys'](_0xe85d9c)}]}]});})[_0x1476('0x13')](function(_0x41ce02){_0x338585=_0x41ce02[_0x1476('0x1c')]({'plain':!![]});if(_0x338585&&_0x338585[_0x1476('0x1d')]){logger[_0x1476('0x1e')](_0x1476('0x1f'),_0x1476('0x20'),util[_0x1476('0x21')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x236f9c['id'],_0x338585[_0x1476('0x1d')]));if(_0x338585['Interactions']&&_0x338585['Interactions'][_0x1476('0x22')]){_0x236f9c[_0x1476('0x23')]=_[_0x1476('0x24')](_0x338585[_0x1476('0x25')][0x0],_0x1476('0x1b'));_0x236f9c[_0x1476('0x1b')]=_0x338585['Interactions'][0x0][_0x1476('0x1b')];}var _0x4dc6ea={'method':'POST','uri':encodeURI(_0x338585[_0x1476('0x1d')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4dc6ea[_0x1476('0x26')]){case _0x1476('0x27'):_0x4dc6ea['qs']=_0x236f9c;break;case _0x1476('0x28'):_0x4dc6ea[_0x1476('0x29')]=_0x236f9c;break;}return rp(_0x4dc6ea)[_0x1476('0x13')](function(_0x5ab2f4){logger[_0x1476('0x1e')](_0x1476('0x1f'),'afterCreate',util[_0x1476('0x21')](_0x1476('0x2a'),_0x236f9c['id'],_0x338585[_0x1476('0x1d')]));if(_0x5ab2f4[_0x1476('0x29')][_0x1476('0x2b')]&&_0x5ab2f4[_0x1476('0x29')][_0x1476('0x2b')]!=_0x236f9c[_0x1476('0x23')][_0x1476('0x2b')]){return _0x8e06b6['OpenchannelInteraction'][_0x1476('0x2c')]({'threadId':_0x5ab2f4['body'][_0x1476('0x2b')]},{'logging':!![],'where':{'id':_0x236f9c[_0x1476('0x23')]['id']}});}else{return;}})[_0x1476('0x13')](function(){return _0x19f1e2[_0x1476('0x2c')]({'read':!![]});})['catch'](function(_0x174314){logger[_0x1476('0x2d')](_0x1476('0x1f'),_0x1476('0x20'),util[_0x1476('0x2e')](_0x174314,{'showHidden':![],'depth':null}));_0x1f71b4();});}else{_0x1f71b4();}})[_0x1476('0x2f')](function(){_0x1f71b4();});}else{_0x1f71b4();}}},'charset':_0x1476('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5711=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','UserId','findOne','OpenchannelInteractionId','then','createdAt','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','Interaction','POST','method','GET','info','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','finally','utf8mb4','lodash','util'];(function(_0x21c988,_0x56fdf3){var _0xe16599=function(_0x5b4a35){while(--_0x5b4a35){_0x21c988['push'](_0x21c988['shift']());}};_0xe16599(++_0x56fdf3);}(_0x5711,0x186));var _0x1571=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x5711[_0x173452];return _0xee3fd0;};'use strict';var _=require(_0x1571('0x0'));var util=require(_0x1571('0x1'));var logger=require(_0x1571('0x2'))(_0x1571('0x3'));var moment=require('moment');var BPromise=require(_0x1571('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1571('0x5'));var rimraf=require(_0x1571('0x6'));var config=require(_0x1571('0x7'));var attributes=require(_0x1571('0x8'));module['exports']=function(_0x41ab85,_0x5e0a5e){return _0x41ab85['define'](_0x1571('0x9'),attributes,{'tableName':_0x1571('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x1571('0xb')],'type':_0x1571('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf025b9,_0x434ac3,_0x4b0910){var _0x569f7c=_0x41ab85[_0x1571('0xd')];var _0x174809=_0xf025b9[_0x1571('0xe')]({'plain':!![]});if(_0x174809['direction'][_0x1571('0xf')]()==='in'||_0x174809[_0x1571('0x10')][_0x1571('0xf')]()===_0x1571('0x11')&&!_0x174809[_0x1571('0x12')]&&!_['isNil'](_0x174809[_0x1571('0x13')])){_0x569f7c['OpenchannelInteraction'][_0x1571('0x14')]({'where':{'id':_0x174809[_0x1571('0x15')]}})[_0x1571('0x16')](function(_0x22f215){if(_0x22f215){_0x22f215['update']({'lastMsgAt':_0x174809[_0x1571('0x17')],'lastMsgDirection':_0x174809[_0x1571('0x10')][_0x1571('0xf')]()});}})['catch'](function(_0x522bdc){console[_0x1571('0x18')](_0x522bdc);});}if(_0x174809['direction']===_0x1571('0x11')&&!_0x174809['secret']){var _0x59b63c;_0x569f7c[_0x1571('0x19')][_0x1571('0x1a')]()[_0x1571('0x16')](function(_0x493e91){return _0x569f7c[_0x1571('0x1b')][_0x1571('0x1c')]({'where':{'id':_0x174809[_0x1571('0x1d')]},'include':[{'model':_0x569f7c[_0x1571('0x1e')],'as':_0x1571('0x1f'),'where':{'id':_0x174809['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x569f7c[_0x1571('0x19')],'as':_0x1571('0x20'),'attributes':_[_0x1571('0x21')](_0x493e91)}]}]});})[_0x1571('0x16')](function(_0x59dea5){_0x59b63c=_0x59dea5[_0x1571('0xe')]({'plain':!![]});if(_0x59b63c&&_0x59b63c[_0x1571('0x22')]){logger['info'](_0x1571('0x23'),_0x1571('0x24'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x174809['id'],_0x59b63c[_0x1571('0x22')]));if(_0x59b63c[_0x1571('0x1f')]&&_0x59b63c[_0x1571('0x1f')][_0x1571('0x25')]){_0x174809[_0x1571('0x26')]=_['omit'](_0x59b63c[_0x1571('0x1f')][0x0],_0x1571('0x20'));_0x174809['Contact']=_0x59b63c[_0x1571('0x1f')][0x0][_0x1571('0x20')];}var _0x434ac3={'method':_0x1571('0x27'),'uri':encodeURI(_0x59b63c[_0x1571('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x434ac3[_0x1571('0x28')]){case _0x1571('0x29'):_0x434ac3['qs']=_0x174809;break;case _0x1571('0x27'):_0x434ac3[_0x1571('0xb')]=_0x174809;break;}return rp(_0x434ac3)['then'](function(_0x12555c){logger[_0x1571('0x2a')](_0x1571('0x23'),'afterCreate',util[_0x1571('0x2b')](_0x1571('0x2c'),_0x174809['id'],_0x59b63c[_0x1571('0x22')]));if(_0x12555c[_0x1571('0xb')]['threadId']&&_0x12555c[_0x1571('0xb')][_0x1571('0x2d')]!=_0x174809[_0x1571('0x26')][_0x1571('0x2d')]){return _0x569f7c['OpenchannelInteraction']['update']({'threadId':_0x12555c['body']['threadId']},{'logging':!![],'where':{'id':_0x174809[_0x1571('0x26')]['id']}});}else{return;}})['then'](function(){return _0xf025b9[_0x1571('0x2e')]({'read':!![]});})['catch'](function(_0x49050f){logger[_0x1571('0x18')](_0x1571('0x23'),'afterCreate',util['inspect'](_0x49050f,{'showHidden':![],'depth':null}));_0x4b0910();});}else{_0x4b0910();}})[_0x1571('0x2f')](function(){_0x4b0910();});}else{_0x4b0910();}}},'charset':_0x1571('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index bd913ea..cac388c 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3b395a,_0x3f8bf7){var _0x2582ba=function(_0x35cfac){while(--_0x35cfac){_0x3b395a['push'](_0x3b395a['shift']());}};_0x2582ba(++_0x3f8bf7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x258b05,_0x256ef5){_0x258b05=_0x258b05-0x0;var _0x38f1ec=_0x5f2f[_0x258b05];return _0x38f1ec;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x29696a,_0x504c71){var _0x1cb7fd=function(_0x1d0f2c){while(--_0x1d0f2c){_0x29696a['push'](_0x29696a['shift']());}};_0x1cb7fd(++_0x504c71);}(_0xb10b,0x12a));var _0xbb10=function(_0x159f91,_0xe8a30f){_0x159f91=_0x159f91-0x0;var _0x26bd65=_0xb10b[_0x159f91];return _0x26bd65;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index a459005..cb7948f 100644 --- a/server/api/openchannelMessage/openchannelMessage.socket.js +++ b/server/api/openchannelMessage/openchannelMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['remove','update','emit','removeListener','register'];(function(_0x8d52a5,_0x3507a3){var _0x50fadf=function(_0x193761){while(--_0x193761){_0x8d52a5['push'](_0x8d52a5['shift']());}};_0x50fadf(++_0x3507a3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0xcb91[_0x3de873];return _0x380b8c;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x1cb9('0x0'),_0x1cb9('0x1')];function createListener(_0x17d4ec,_0x22c4b8){return function(_0x4c37e8){_0x22c4b8[_0x1cb9('0x2')](_0x17d4ec,_0x4c37e8);};}function removeListener(_0x2c17b8,_0x545a34){return function(){OpenchannelMessageEvents[_0x1cb9('0x3')](_0x2c17b8,_0x545a34);};}exports[_0x1cb9('0x4')]=function(_0x53ffbd){for(var _0x226b69=0x0,_0x3f7deb=events['length'];_0x226b69<_0x3f7deb;_0x226b69++){var _0x38737d=events[_0x226b69];var _0x12567c=createListener('openchannelMessage:'+_0x38737d,_0x53ffbd);OpenchannelMessageEvents['on'](_0x38737d,_0x12567c);}}; \ No newline at end of file +var _0xf4eb=['removeListener','register','./openchannelMessage.events'];(function(_0x278b05,_0x34779d){var _0x162002=function(_0x2dc367){while(--_0x2dc367){_0x278b05['push'](_0x278b05['shift']());}};_0x162002(++_0x34779d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4895eb,_0x21a482){_0x4895eb=_0x4895eb-0x0;var _0x80a6cf=_0xf4eb[_0x4895eb];return _0x80a6cf;};'use strict';var OpenchannelMessageEvents=require(_0xbf4e('0x0'));var events=['save','remove','update'];function createListener(_0x5ed5b9,_0xbbbf01){return function(_0x49d80e){_0xbbbf01['emit'](_0x5ed5b9,_0x49d80e);};}function removeListener(_0x2e3070,_0x1c7606){return function(){OpenchannelMessageEvents[_0xbf4e('0x1')](_0x2e3070,_0x1c7606);};}exports[_0xbf4e('0x2')]=function(_0xa4dcf5){for(var _0x2fcfed=0x0,_0x15b99f=events['length'];_0x2fcfed<_0x15b99f;_0x2fcfed++){var _0x449d55=events[_0x2fcfed];var _0x5013c2=createListener('openchannelMessage:'+_0x449d55,_0xa4dcf5);OpenchannelMessageEvents['on'](_0x449d55,_0x5013c2);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 6605afe..53a70df 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 _0xa9e0=['post','create','/:id/teams','addTeams','put','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','show','/:id/members','isAuthenticated','getMembers','/:id/users','getAgents'];(function(_0x11b1c8,_0x14ab47){var _0x63d987=function(_0x3605d1){while(--_0x3605d1){_0x11b1c8['push'](_0x11b1c8['shift']());}};_0x63d987(++_0x14ab47);}(_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/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['post'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x11')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller['addAgents']);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0xd')](),controller['update']);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth['isAuthenticated'](),controller[_0x0a9e('0x18')]);router['delete'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);module[_0x0a9e('0x1b')]=router; \ No newline at end of file +var _0xa9e0=['post','create','/:id/teams','addTeams','put','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','show','/:id/members','isAuthenticated','getMembers','/:id/users','getAgents'];(function(_0x2304e5,_0x1697c0){var _0x5ed68d=function(_0x37ac62){while(--_0x37ac62){_0x2304e5['push'](_0x2304e5['shift']());}};_0x5ed68d(++_0x1697c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['post'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x11')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller['addAgents']);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0xd')](),controller['update']);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth['isAuthenticated'](),controller[_0x0a9e('0x18')]);router['delete'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);module[_0x0a9e('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 6b9b2ff..594a887 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 _0x5b7c=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x1f5ce8,_0xa1cfae){var _0x5baa4f=function(_0x31c767){while(--_0x31c767){_0x1f5ce8['push'](_0x1f5ce8['shift']());}};_0x5baa4f(++_0xa1cfae);}(_0x5b7c,0x9e));var _0xc5b7=function(_0x229423,_0x15c52b){_0x229423=_0x229423-0x0;var _0x384b60=_0x5b7c[_0x229423];return _0x384b60;};'use strict';var Sequelize=require(_0xc5b7('0x0'));module[_0xc5b7('0x1')]={'name':{'type':Sequelize[_0xc5b7('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc5b7('0x2')]},'timeout':{'type':Sequelize[_0xc5b7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc5b7('0x4')](_0xc5b7('0x5'),_0xc5b7('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xd641=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','beepall'];(function(_0x488c7b,_0x2a7949){var _0x6c5f=function(_0x6fce0d){while(--_0x6fce0d){_0x488c7b['push'](_0x488c7b['shift']());}};_0x6c5f(++_0x2a7949);}(_0xd641,0xd9));var _0x1d64=function(_0x3fdacc,_0x5a7391){_0x3fdacc=_0x3fdacc-0x0;var _0x2ca837=_0xd641[_0x3fdacc];return _0x2ca837;};'use strict';var Sequelize=require(_0x1d64('0x0'));module[_0x1d64('0x1')]={'name':{'type':Sequelize[_0x1d64('0x2')],'unique':_0x1d64('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1d64('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1d64('0x5')]('rrmemory',_0x1d64('0x6'),_0x1d64('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 34d8cee..097ab7d 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 _0xce9b=['findOne','UserOpenchannelQueue','pick','User','findAndCountAll','agent','openchannelPause','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','keys','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','all','union','compact','value','removeAgents','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','OpenchannelQueues','UserProfileResource','destroy','stack','send','merge','body','message','account','map','OpenchannelQueue','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','options','include','findAll','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xce9b,0xc6));var _0xbce9=function(_0x2713f4,_0x52f4b6){_0x2713f4=_0x2713f4-0x0;var _0x30d819=_0xce9b[_0x2713f4];return _0x30d819;};'use strict';var emlformat=require(_0xbce9('0x0'));var rimraf=require(_0xbce9('0x1'));var zipdir=require(_0xbce9('0x2'));var jsonpatch=require(_0xbce9('0x3'));var rp=require(_0xbce9('0x4'));var moment=require(_0xbce9('0x5'));var BPromise=require(_0xbce9('0x6'));var Mustache=require(_0xbce9('0x7'));var util=require('util');var path=require(_0xbce9('0x8'));var sox=require(_0xbce9('0x9'));var csv=require(_0xbce9('0xa'));var ejs=require(_0xbce9('0xb'));var fs=require('fs');var fs_extra=require(_0xbce9('0xc'));var _=require(_0xbce9('0xd'));var squel=require(_0xbce9('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbce9('0xf'));var toCsv=require(_0xbce9('0xa'));var querystring=require('querystring');var Papa=require(_0xbce9('0x10'));var Redis=require(_0xbce9('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbce9('0x12'));var hardwareService=require(_0xbce9('0x13'));var logger=require(_0xbce9('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xbce9('0x15'));var licenseUtil=require(_0xbce9('0x16'));var db=require(_0xbce9('0x17'))['db'];config[_0xbce9('0x18')]=_[_0xbce9('0x19')](config[_0xbce9('0x18')],{'host':_0xbce9('0x1a'),'port':0x18eb});var socket=require(_0xbce9('0x1b'))(new Redis(config[_0xbce9('0x18')]));require(_0xbce9('0x1c'))['register'](socket);function respondWithStatusCode(_0x4353ae,_0x3376d3){_0x3376d3=_0x3376d3||0xcc;return function(_0x12d5df){if(_0x12d5df){return _0x4353ae[_0xbce9('0x1d')](_0x3376d3);}return _0x4353ae[_0xbce9('0x1e')](_0x3376d3)['end']();};}function respondWithResult(_0x19f941,_0x3a5312){_0x3a5312=_0x3a5312||0xc8;return function(_0x326a5e){if(_0x326a5e){return _0x19f941[_0xbce9('0x1e')](_0x3a5312)[_0xbce9('0x1f')](_0x326a5e);}};}function respondWithFilteredResult(_0x420efe,_0x22e6ec){return function(_0x2b1104){if(_0x2b1104){var _0x371483=typeof _0x22e6ec[_0xbce9('0x20')]===_0xbce9('0x21')&&typeof _0x22e6ec[_0xbce9('0x22')]==='undefined';var _0x443c95=_0x2b1104[_0xbce9('0x23')];var _0x1c08b8=_0x371483?0x0:_0x22e6ec[_0xbce9('0x20')];var _0x1e1284=_0x371483?_0x2b1104[_0xbce9('0x23')]:_0x22e6ec['offset']+_0x22e6ec[_0xbce9('0x22')];var _0x103f2d;if(_0x1e1284>=_0x443c95){_0x1e1284=_0x443c95;_0x103f2d=0xc8;}else{_0x103f2d=0xce;}_0x420efe[_0xbce9('0x1e')](_0x103f2d);return _0x420efe[_0xbce9('0x24')](_0xbce9('0x25'),_0x1c08b8+'-'+_0x1e1284+'/'+_0x443c95)[_0xbce9('0x1f')](_0x2b1104);}return null;};}function patchUpdates(_0x337210){return function(_0x22ea13){try{jsonpatch[_0xbce9('0x26')](_0x22ea13,_0x337210,!![]);}catch(_0xcb2cf){return BPromise[_0xbce9('0x27')](_0xcb2cf);}return _0x22ea13[_0xbce9('0x28')]();};}function saveUpdates(_0x379567,_0x473645){return function(_0x39e3b8){if(_0x39e3b8){return _0x39e3b8[_0xbce9('0x29')](_0x379567)[_0xbce9('0x2a')](function(_0x2544c8){return _0x2544c8;});}return null;};}function removeEntity(_0x5e73a8,_0x55f5d5){return function(_0x411951){if(_0x411951){return _0x411951['destroy']()[_0xbce9('0x2a')](function(){var _0x3d8777=_0x411951[_0xbce9('0x2b')]({'plain':!![]});var _0x1dd967=_0xbce9('0x2c');return db[_0xbce9('0x2d')][_0xbce9('0x2e')]({'where':{'type':_0x1dd967,'resourceId':_0x3d8777['id']}})[_0xbce9('0x2a')](function(){return _0x411951;});})[_0xbce9('0x2a')](function(){_0x5e73a8[_0xbce9('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53e69d,_0x33aa48){return function(_0x5125f5){if(!_0x5125f5){_0x53e69d[_0xbce9('0x1d')](0x194);}return _0x5125f5;};}function handleError(_0x81b807,_0x5c4db2){_0x5c4db2=_0x5c4db2||0x1f4;return function(_0x1b0cc0){logger['error'](_0x1b0cc0[_0xbce9('0x2f')]);if(_0x1b0cc0['name']){delete _0x1b0cc0['name'];}_0x81b807[_0xbce9('0x1e')](_0x5c4db2)[_0xbce9('0x30')](_0x1b0cc0);};}function getMustacheRender(_0x39b9b1,_0x571198){return Mustache['render'](_0x39b9b1,_[_0xbce9('0x31')](_0x571198[_0xbce9('0x32')],{'contact':_0x571198['contact'],'message':_0x571198[_0xbce9('0x33')],'agent':_0x571198['agent'],'interaction':_0x571198['interaction'],'account':_0x571198[_0xbce9('0x34')]}))||'';}exports['index']=function(_0x1798c8,_0x2b70d7){var _0x3d866f={},_0x1ed362={},_0x1ae905={'count':0x0,'rows':[]};var _0x10f982=_[_0xbce9('0x35')](db[_0xbce9('0x36')][_0xbce9('0x37')],function(_0xb347aa){return{'name':_0xb347aa[_0xbce9('0x38')],'type':_0xb347aa[_0xbce9('0x39')][_0xbce9('0x3a')]};});_0x1ed362['model']=_[_0xbce9('0x35')](_0x10f982,_0xbce9('0x3b'));_0x1ed362[_0xbce9('0x3c')]=_['keys'](_0x1798c8[_0xbce9('0x3c')]);_0x1ed362[_0xbce9('0x3d')]=_[_0xbce9('0x3e')](_0x1ed362[_0xbce9('0x3f')],_0x1ed362[_0xbce9('0x3c')]);_0x3d866f['attributes']=_['intersection'](_0x1ed362['model'],qs[_0xbce9('0x40')](_0x1798c8[_0xbce9('0x3c')][_0xbce9('0x40')]));_0x3d866f[_0xbce9('0x41')]=_0x3d866f[_0xbce9('0x41')][_0xbce9('0x42')]?_0x3d866f[_0xbce9('0x41')]:_0x1ed362[_0xbce9('0x3f')];if(!_0x1798c8[_0xbce9('0x3c')][_0xbce9('0x43')](_0xbce9('0x44'))){_0x3d866f[_0xbce9('0x22')]=qs[_0xbce9('0x22')](_0x1798c8[_0xbce9('0x3c')][_0xbce9('0x22')]);_0x3d866f[_0xbce9('0x20')]=qs[_0xbce9('0x20')](_0x1798c8[_0xbce9('0x3c')][_0xbce9('0x20')]);}_0x3d866f[_0xbce9('0x45')]=qs['sort'](_0x1798c8[_0xbce9('0x3c')][_0xbce9('0x46')]);_0x3d866f[_0xbce9('0x47')]=qs['filters'](_['pick'](_0x1798c8[_0xbce9('0x3c')],_0x1ed362[_0xbce9('0x3d')]),_0x10f982);if(_0x1798c8[_0xbce9('0x3c')][_0xbce9('0x48')]){_0x3d866f['where']=_[_0xbce9('0x31')](_0x3d866f[_0xbce9('0x47')],{'$or':_[_0xbce9('0x35')](_0x10f982,function(_0x10c717){if(_0x10c717[_0xbce9('0x39')]!=='VIRTUAL'){var _0x5d1718={};_0x5d1718[_0x10c717[_0xbce9('0x3b')]]={'$like':'%'+_0x1798c8[_0xbce9('0x3c')][_0xbce9('0x48')]+'%'};return _0x5d1718;}})});}_0x3d866f=_[_0xbce9('0x31')]({},_0x3d866f,_0x1798c8[_0xbce9('0x49')]);var _0x4a994b={'where':_0x3d866f[_0xbce9('0x47')]};return db[_0xbce9('0x36')][_0xbce9('0x23')](_0x4a994b)[_0xbce9('0x2a')](function(_0x6a6fe){_0x1ae905[_0xbce9('0x23')]=_0x6a6fe;if(_0x1798c8[_0xbce9('0x3c')]['includeAll']){_0x3d866f[_0xbce9('0x4a')]=[{'all':!![]}];}return db[_0xbce9('0x36')][_0xbce9('0x4b')](_0x3d866f);})[_0xbce9('0x2a')](function(_0x33cda6){_0x1ae905['rows']=_0x33cda6;return _0x1ae905;})['then'](respondWithFilteredResult(_0x2b70d7,_0x3d866f))[_0xbce9('0x4c')](handleError(_0x2b70d7,null));};exports[_0xbce9('0x4d')]=function(_0x37986f,_0x3e4d5d){var _0xbf501f={'raw':!![],'where':{'id':_0x37986f[_0xbce9('0x4e')]['id']}},_0x2b5a5f={};_0x2b5a5f[_0xbce9('0x3f')]=_['keys'](db[_0xbce9('0x36')][_0xbce9('0x37')]);_0x2b5a5f[_0xbce9('0x3c')]=_['keys'](_0x37986f['query']);_0x2b5a5f[_0xbce9('0x3d')]=_[_0xbce9('0x3e')](_0x2b5a5f[_0xbce9('0x3f')],_0x2b5a5f[_0xbce9('0x3c')]);_0xbf501f[_0xbce9('0x41')]=_[_0xbce9('0x3e')](_0x2b5a5f[_0xbce9('0x3f')],qs[_0xbce9('0x40')](_0x37986f['query']['fields']));_0xbf501f[_0xbce9('0x41')]=_0xbf501f['attributes']['length']?_0xbf501f[_0xbce9('0x41')]:_0x2b5a5f[_0xbce9('0x3f')];if(_0x37986f[_0xbce9('0x3c')][_0xbce9('0x4f')]){_0xbf501f[_0xbce9('0x4a')]=[{'all':!![]}];}_0xbf501f=_[_0xbce9('0x31')]({},_0xbf501f,_0x37986f[_0xbce9('0x49')]);return db[_0xbce9('0x36')][_0xbce9('0x50')](_0xbf501f)[_0xbce9('0x2a')](handleEntityNotFound(_0x3e4d5d,null))['then'](respondWithResult(_0x3e4d5d,null))['catch'](handleError(_0x3e4d5d,null));};exports[_0xbce9('0x51')]=function(_0x4fa483,_0x3305c7){return db[_0xbce9('0x36')]['create'](_0x4fa483['body'],{})[_0xbce9('0x2a')](function(_0xf50cd6){var _0x385dd8=_0x4fa483[_0xbce9('0x52')][_0xbce9('0x2b')]({'plain':!![]});if(!_0x385dd8)throw new Error(_0xbce9('0x53'));if(_0x385dd8[_0xbce9('0x54')]===_0xbce9('0x52')){var _0x485b7f=_0xf50cd6[_0xbce9('0x2b')]({'plain':!![]});var _0x11f116='OpenchannelQueues';return db[_0xbce9('0x55')]['find']({'where':{'name':_0x11f116,'userProfileId':_0x385dd8[_0xbce9('0x56')]},'raw':!![]})[_0xbce9('0x2a')](function(_0x226e0c){if(_0x226e0c&&_0x226e0c[_0xbce9('0x57')]===0x0){return db[_0xbce9('0x2d')]['create']({'name':_0x485b7f['name'],'resourceId':_0x485b7f['id'],'type':_0x226e0c['name'],'sectionId':_0x226e0c['id']},{})['then'](function(){return _0xf50cd6;});}else{return _0xf50cd6;}})['catch'](function(_0x41b4e3){logger['error'](_0xbce9('0x58'),_0x41b4e3);throw _0x41b4e3;});}return _0xf50cd6;})[_0xbce9('0x2a')](respondWithResult(_0x3305c7,0xc9))[_0xbce9('0x4c')](handleError(_0x3305c7,null));};exports[_0xbce9('0x29')]=function(_0x405e06,_0x4aa1e6){if(_0x405e06[_0xbce9('0x32')]['id']){delete _0x405e06[_0xbce9('0x32')]['id'];}return db[_0xbce9('0x36')]['find']({'where':{'id':_0x405e06[_0xbce9('0x4e')]['id']}})[_0xbce9('0x2a')](handleEntityNotFound(_0x4aa1e6,null))[_0xbce9('0x2a')](saveUpdates(_0x405e06[_0xbce9('0x32')],null))['then'](respondWithResult(_0x4aa1e6,null))['catch'](handleError(_0x4aa1e6,null));};exports['destroy']=function(_0x26c928,_0x531e86){return db[_0xbce9('0x36')][_0xbce9('0x50')]({'where':{'id':_0x26c928['params']['id']}})['then'](handleEntityNotFound(_0x531e86,null))['then'](removeEntity(_0x531e86,null))[_0xbce9('0x4c')](handleError(_0x531e86,null));};exports['describe']=function(_0x5558e6,_0x3c76ed){return db['OpenchannelQueue']['describe']()[_0xbce9('0x2a')](respondWithResult(_0x3c76ed,null))[_0xbce9('0x4c')](handleError(_0x3c76ed,null));};exports[_0xbce9('0x59')]=function(_0xa0a88e,_0x3bd4e7,_0x392178){var _0x260c98={'raw':!![],'where':{}},_0x50e53b={},_0xb6999f;return db[_0xbce9('0x36')][_0xbce9('0x5a')]({'where':{'id':_0xa0a88e[_0xbce9('0x4e')]['id']}})[_0xbce9('0x2a')](handleEntityNotFound(_0x3bd4e7,null))['then'](function(_0x52c073){if(_0x52c073){_0xb6999f=_0x52c073['get']({'plain':!![]});_0x50e53b[_0xbce9('0x3f')]=_['keys'](db[_0xbce9('0x5b')][_0xbce9('0x37')]);_0x50e53b[_0xbce9('0x3c')]=_['keys'](_0xa0a88e['query']);_0x50e53b[_0xbce9('0x3d')]=_[_0xbce9('0x3e')](_0x50e53b['model'],_0x50e53b[_0xbce9('0x3c')]);_0x260c98[_0xbce9('0x41')]=_[_0xbce9('0x3e')](_0x50e53b['model'],qs[_0xbce9('0x40')](_0xa0a88e[_0xbce9('0x3c')][_0xbce9('0x40')]));_0x260c98[_0xbce9('0x41')]=_0x260c98[_0xbce9('0x41')]['length']?_0x260c98['attributes']:_0x50e53b[_0xbce9('0x3f')];if(!_0xa0a88e['query'][_0xbce9('0x43')](_0xbce9('0x44'))){_0x260c98['limit']=qs['limit'](_0xa0a88e[_0xbce9('0x3c')][_0xbce9('0x22')]);_0x260c98[_0xbce9('0x20')]=qs[_0xbce9('0x20')](_0xa0a88e[_0xbce9('0x3c')][_0xbce9('0x20')]);}_0x260c98[_0xbce9('0x45')]=qs['sort'](_0xa0a88e['query'][_0xbce9('0x46')]);_0x260c98[_0xbce9('0x47')]=qs[_0xbce9('0x3d')](_[_0xbce9('0x5c')](_0xa0a88e['query'],_0x50e53b[_0xbce9('0x3d')]));_0x260c98[_0xbce9('0x47')]['OpenchannelQueueId']=_0x52c073['id'];if(_0xa0a88e['query'][_0xbce9('0x48')]){_0x260c98[_0xbce9('0x47')]=_[_0xbce9('0x31')](_0x260c98[_0xbce9('0x47')],{'$or':_[_0xbce9('0x35')](_0x260c98[_0xbce9('0x41')],function(_0x1e62af){var _0x1761ec={};_0x1761ec[_0x1e62af]={'$like':'%'+_0xa0a88e[_0xbce9('0x3c')][_0xbce9('0x48')]+'%'};return _0x1761ec;})});}_0x260c98=_[_0xbce9('0x31')]({},_0x260c98,_0xa0a88e[_0xbce9('0x49')]);return db[_0xbce9('0x5b')][_0xbce9('0x4b')](_0x260c98);}})[_0xbce9('0x2a')](function(_0x5743c1){if(_0x5743c1){return db[_0xbce9('0x5d')][_0xbce9('0x5e')]({'where':{'id':_[_0xbce9('0x35')](_0x5743c1,'UserId'),'role':_0xbce9('0x5f')},'attributes':['id','name',_0xbce9('0x60'),'updatedAt',_0xbce9('0x61')]});}})[_0xbce9('0x2a')](function(_0x350650){if(_0x350650){return{'count':_0x350650[_0xbce9('0x23')],'rows':_[_0xbce9('0x35')](_0x350650[_0xbce9('0x62')],function(_0x1f9ff8){return{'membername':_0x1f9ff8[_0xbce9('0x3b')],'UserId':_0x1f9ff8['id'],'queue_name':_0xb6999f[_0xbce9('0x3b')],'OpenchannelQueueId':_0xb6999f['id'],'interface':util[_0xbce9('0x63')](_0xbce9('0x64'),_0xbce9('0x65'),_0x1f9ff8['name']),'penalty':0x0,'paused':_0x1f9ff8['openchannelPause'],'createdAt':_0x1f9ff8[_0xbce9('0x61')],'updatedAt':_0x1f9ff8[_0xbce9('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbce9('0x2a')](respondWithFilteredResult(_0x3bd4e7,_0x260c98))['catch'](handleError(_0x3bd4e7,null));};exports[_0xbce9('0x67')]=function(_0x14d3fa,_0x14e956,_0x447632){var _0x3b6eef={};var _0x5c0bd6={};var _0x566a7c;var _0x2f1bfb;return db[_0xbce9('0x36')][_0xbce9('0x5a')]({'where':{'id':_0x14d3fa[_0xbce9('0x4e')]['id']}})['then'](handleEntityNotFound(_0x14e956,null))[_0xbce9('0x2a')](function(_0x3caac7){if(_0x3caac7){_0x566a7c=_0x3caac7;_0x5c0bd6[_0xbce9('0x3f')]=_[_0xbce9('0x68')](db[_0xbce9('0x69')][_0xbce9('0x37')]);_0x5c0bd6[_0xbce9('0x3c')]=_[_0xbce9('0x68')](_0x14d3fa[_0xbce9('0x3c')]);_0x5c0bd6[_0xbce9('0x3d')]=_[_0xbce9('0x3e')](_0x5c0bd6[_0xbce9('0x3f')],_0x5c0bd6[_0xbce9('0x3c')]);_0x3b6eef['attributes']=_[_0xbce9('0x3e')](_0x5c0bd6[_0xbce9('0x3f')],qs[_0xbce9('0x40')](_0x14d3fa[_0xbce9('0x3c')]['fields']));_0x3b6eef[_0xbce9('0x41')]=_0x3b6eef[_0xbce9('0x41')][_0xbce9('0x42')]?_0x3b6eef[_0xbce9('0x41')]:_0x5c0bd6[_0xbce9('0x3f')];_0x3b6eef['order']=qs[_0xbce9('0x46')](_0x14d3fa['query']['sort']);_0x3b6eef['where']=qs['filters'](_[_0xbce9('0x5c')](_0x14d3fa[_0xbce9('0x3c')],_0x5c0bd6[_0xbce9('0x3d')]));if(_0x14d3fa[_0xbce9('0x3c')][_0xbce9('0x48')]){_0x3b6eef['where']=_[_0xbce9('0x31')](_0x3b6eef[_0xbce9('0x47')],{'$or':_[_0xbce9('0x35')](_0x3b6eef[_0xbce9('0x41')],function(_0x5e22aa){var _0x45ce2f={};_0x45ce2f[_0x5e22aa]={'$like':'%'+_0x14d3fa[_0xbce9('0x3c')][_0xbce9('0x48')]+'%'};return _0x45ce2f;})});}_0x3b6eef=_[_0xbce9('0x31')]({},_0x3b6eef,_0x14d3fa[_0xbce9('0x49')]);return _0x566a7c[_0xbce9('0x67')](_0x3b6eef);}})[_0xbce9('0x2a')](function(_0x47a63a){if(_0x47a63a){_0x2f1bfb=_0x47a63a[_0xbce9('0x42')];if(!_0x14d3fa['query'][_0xbce9('0x43')](_0xbce9('0x44'))){_0x3b6eef['limit']=qs[_0xbce9('0x22')](_0x14d3fa[_0xbce9('0x3c')][_0xbce9('0x22')]);_0x3b6eef[_0xbce9('0x20')]=qs['offset'](_0x14d3fa[_0xbce9('0x3c')][_0xbce9('0x20')]);}return _0x566a7c[_0xbce9('0x67')](_0x3b6eef);}})['then'](function(_0x203893){if(_0x203893){return _0x203893?{'count':_0x2f1bfb,'rows':_0x203893}:null;}})['then'](respondWithResult(_0x14e956,null))['catch'](handleError(_0x14e956,null));};exports[_0xbce9('0x6a')]=function(_0x46dbab,_0x4b2edc,_0x3e81d6){var _0x4bd706=_0x46dbab['body'][_0xbce9('0x6b')];return db[_0xbce9('0x69')][_0xbce9('0x4b')]({'where':{'id':_0x4bd706},'attributes':['id'],'include':[{'model':db[_0xbce9('0x5d')],'as':_0xbce9('0x6c'),'attributes':['id',_0xbce9('0x3b'),_0xbce9('0x6d'),_0xbce9('0x6e'),_0xbce9('0x6f')],'raw':!![]}]})[_0xbce9('0x2a')](function(_0x174019){if(_0x174019){var _0x15a56e=_[_0xbce9('0x70')](_0x174019,function(_0x5e9dff){var _0x4841bd=_0x5e9dff['get']({'plain':!![]});return _0x4841bd[_0xbce9('0x6c')];});return db[_0xbce9('0x36')][_0xbce9('0x50')]({'where':{'id':_0x46dbab['params']['id']}})[_0xbce9('0x2a')](function(_0x322682){return db[_0xbce9('0x71')][_0xbce9('0x72')](function(_0x21531e){return _0x322682['addTeams'](_0x4bd706,{'transaction':_0x21531e})['then'](function(){return BPromise[_0xbce9('0x73')](_0x15a56e,function(_0x382a3b){return db[_0xbce9('0x5b')][_0xbce9('0x74')]({'where':{'UserId':_0x382a3b['id'],'OpenchannelQueueId':_0x46dbab[_0xbce9('0x4e')]['id']},'transaction':_0x21531e});});})[_0xbce9('0x2a')](function(){_0x15a56e[_0xbce9('0x75')](function(_0x455aff){socket[_0xbce9('0x76')](_0xbce9('0x77'),{'UserId':_0x455aff['id'],'OpenchannelQueueId':_0x322682['id']});});});});});}})[_0xbce9('0x2a')](respondWithStatusCode(_0x4b2edc,null))[_0xbce9('0x4c')](handleError(_0x4b2edc,null));};exports[_0xbce9('0x78')]=function(_0x1028a6,_0x343889,_0x504ace){return db[_0xbce9('0x69')][_0xbce9('0x4b')]({'where':{'id':_0x1028a6[_0xbce9('0x3c')][_0xbce9('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xbce9('0x5d')],'as':_0xbce9('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x343889,null))[_0xbce9('0x2a')](function(_0x3ae153){var _0x414f28=_[_0xbce9('0x35')](_0x3ae153,'id');var _0xd49264=[];var _0x59b074=[];var _0x2b83f6=squel[_0xbce9('0x79')]();_0x2b83f6[_0xbce9('0x7a')]('tq.TeamId')[_0xbce9('0x7b')](_0xbce9('0x7c'),'tq')[_0xbce9('0x7d')](_0xbce9('0x7e'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xbce9('0x7f'),_0x1028a6['params']['id']);for(var _0x3c693f=0x0;_0x3c693f<_0x3ae153[_0xbce9('0x42')];_0x3c693f+=0x1){let _0x2f56c4=_0x3ae153[_0x3c693f];for(var _0x5e4851=0x0;_0x5e4851<_0x2f56c4[_0xbce9('0x6c')][_0xbce9('0x42')];_0x5e4851+=0x1){let _0x5a1235=_0x2f56c4[_0xbce9('0x6c')][_0x5e4851];var _0x4d3c59=_0x2b83f6[_0xbce9('0x80')]();_0x4d3c59['where']('ut.UserId\x20=\x20?',_0x5a1235['id']);_0x59b074[_0xbce9('0x81')](db[_0xbce9('0x71')]['query'](_0x4d3c59[_0xbce9('0x82')](),{'type':db[_0xbce9('0x71')][_0xbce9('0x83')]['SELECT']})['then'](function(_0x47d281){if(_0x47d281[_0xbce9('0x42')]===0x1){return _0x5a1235['id'];}else{var _0x1d73d2=_[_0xbce9('0x84')](_[_0xbce9('0x35')](_0x47d281,_0xbce9('0x85')),function(_0x5366a6){return _['includes'](_0x414f28,_0x5366a6);});if(_0x1d73d2){return _0x5a1235['id'];}}}));}}return BPromise[_0xbce9('0x86')](_0x59b074)[_0xbce9('0x2a')](function(_0x379884){_0xd49264=_(_0xd49264)[_0xbce9('0x87')](_0x379884)[_0xbce9('0x88')]()[_0xbce9('0x89')]();return db[_0xbce9('0x36')][_0xbce9('0x50')]({'where':{'id':_0x1028a6[_0xbce9('0x4e')]['id']}})['then'](function(_0x5b2a5b){return db['sequelize'][_0xbce9('0x72')](function(_0x1ccfff){return _0x5b2a5b[_0xbce9('0x78')](_0x1028a6[_0xbce9('0x3c')][_0xbce9('0x6b')],{'transaction':_0x1ccfff})[_0xbce9('0x2a')](function(){if(!_['isEmpty'](_0xd49264)){return _0x5b2a5b[_0xbce9('0x8a')](_0xd49264,{'transaction':_0x1ccfff});}})[_0xbce9('0x2a')](function(){_0xd49264[_0xbce9('0x75')](function(_0x163c45){socket['emit'](_0xbce9('0x8b'),{'UserId':_0x163c45,'OpenchannelQueueId':_0x5b2a5b['id']});});});});});});})[_0xbce9('0x2a')](respondWithStatusCode(_0x343889,null))[_0xbce9('0x4c')](handleError(_0x343889,null));};exports[_0xbce9('0x8c')]=function(_0x3c0b8f,_0x5291a8,_0x59c713){return db[_0xbce9('0x36')][_0xbce9('0x50')]({'where':{'id':_0x3c0b8f[_0xbce9('0x4e')]['id']}})[_0xbce9('0x2a')](handleEntityNotFound(_0x5291a8,null))[_0xbce9('0x2a')](function(_0x274c78){if(_0x274c78){return _0x274c78['addAgents'](_0x3c0b8f[_0xbce9('0x32')][_0xbce9('0x6b')],_['omit'](_0x3c0b8f['body'],[_0xbce9('0x6b'),'id'])||{})[_0xbce9('0x8d')](function(_0x4545be){for(var _0x2cbd1f=0x0;_0x2cbd1f<_0x3c0b8f[_0xbce9('0x32')][_0xbce9('0x6b')][_0xbce9('0x42')];_0x2cbd1f+=0x1){socket['emit'](_0xbce9('0x77'),{'UserId':_0x3c0b8f['body'][_0xbce9('0x6b')][_0x2cbd1f],'OpenchannelQueueId':_0x3c0b8f[_0xbce9('0x4e')]['id']});}return _0x4545be;});}})[_0xbce9('0x2a')](respondWithResult(_0x5291a8,null))[_0xbce9('0x4c')](handleError(_0x5291a8,null));};exports[_0xbce9('0x8a')]=function(_0xe69e8c,_0x1ff64b,_0x53c4c4){return db[_0xbce9('0x36')][_0xbce9('0x50')]({'where':{'id':_0xe69e8c[_0xbce9('0x4e')]['id']}})[_0xbce9('0x2a')](handleEntityNotFound(_0x1ff64b,null))['then'](function(_0x468259){if(_0x468259){return _0x468259[_0xbce9('0x8a')](_0xe69e8c['query'][_0xbce9('0x6b')])['then'](function(){if(_[_0xbce9('0x8e')](_0xe69e8c[_0xbce9('0x3c')][_0xbce9('0x6b')])){for(var _0x5707ae=0x0;_0x5707ae<_0xe69e8c[_0xbce9('0x3c')]['ids'][_0xbce9('0x42')];_0x5707ae+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0xe69e8c[_0xbce9('0x3c')][_0xbce9('0x6b')][_0x5707ae]),'OpenchannelQueueId':Number(_0xe69e8c[_0xbce9('0x4e')]['id'])});}}else{socket[_0xbce9('0x76')]('userOpenchannelQueue:remove',{'UserId':Number(_0xe69e8c[_0xbce9('0x3c')]['ids']),'OpenchannelQueueId':Number(_0xe69e8c[_0xbce9('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x1ff64b,null))[_0xbce9('0x4c')](handleError(_0x1ff64b,null));};exports['getAgents']=function(_0x52f516,_0x413be2,_0x244230){var _0x275713={};var _0x36d9dc={};var _0x97e23d;var _0x35969b;return db[_0xbce9('0x36')][_0xbce9('0x5a')]({'where':{'id':_0x52f516['params']['id']}})[_0xbce9('0x2a')](handleEntityNotFound(_0x413be2,null))[_0xbce9('0x2a')](function(_0x4aa965){if(_0x4aa965){_0x97e23d=_0x4aa965;_0x36d9dc[_0xbce9('0x3f')]=_[_0xbce9('0x68')](db[_0xbce9('0x5d')]['rawAttributes']);_0x36d9dc['query']=_[_0xbce9('0x68')](_0x52f516['query']);_0x36d9dc[_0xbce9('0x3d')]=_[_0xbce9('0x3e')](_0x36d9dc[_0xbce9('0x3f')],_0x36d9dc['query']);_0x275713[_0xbce9('0x41')]=_['intersection'](_0x36d9dc[_0xbce9('0x3f')],qs[_0xbce9('0x40')](_0x52f516['query'][_0xbce9('0x40')]));_0x275713[_0xbce9('0x41')]=_0x275713['attributes']['length']?_0x275713[_0xbce9('0x41')]:_0x36d9dc[_0xbce9('0x3f')];_0x275713['order']=qs['sort'](_0x52f516['query'][_0xbce9('0x46')]);_0x275713['where']=qs[_0xbce9('0x3d')](_[_0xbce9('0x5c')](_0x52f516['query'],_0x36d9dc[_0xbce9('0x3d')]));if(_0x52f516[_0xbce9('0x3c')][_0xbce9('0x48')]){_0x275713[_0xbce9('0x47')]=_[_0xbce9('0x31')](_0x275713[_0xbce9('0x47')],{'$or':_[_0xbce9('0x35')](_0x275713[_0xbce9('0x41')],function(_0x681111){var _0x5e40a7={};_0x5e40a7[_0x681111]={'$like':'%'+_0x52f516[_0xbce9('0x3c')][_0xbce9('0x48')]+'%'};return _0x5e40a7;})});}_0x275713=_[_0xbce9('0x31')]({},_0x275713,_0x52f516[_0xbce9('0x49')]);return _0x97e23d['getAgents'](_0x275713);}})['then'](function(_0x423e4e){if(_0x423e4e){_0x35969b=_0x423e4e['length'];if(!_0x52f516['query'][_0xbce9('0x43')](_0xbce9('0x44'))){_0x275713[_0xbce9('0x22')]=qs[_0xbce9('0x22')](_0x52f516[_0xbce9('0x3c')]['limit']);_0x275713[_0xbce9('0x20')]=qs['offset'](_0x52f516['query']['offset']);}return _0x97e23d[_0xbce9('0x8f')](_0x275713);}})['then'](function(_0x23e54f){if(_0x23e54f){return _0x23e54f?{'count':_0x35969b,'rows':_0x23e54f}:null;}})[_0xbce9('0x2a')](respondWithResult(_0x413be2,null))[_0xbce9('0x4c')](handleError(_0x413be2,null));}; \ No newline at end of file +var _0xcbe1=['all','union','value','transaction','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','rimraf','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','then','get','OpenchannelQueues','error','name','send','body','message','agent','account','map','OpenchannelQueue','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','includeAll','rows','catch','show','params','include','options','create','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','nolimit','OpenchannelQueueId','findAll','User','findAndCountAll','UserId','updatedAt','format','%s/%s','SIP','openchannelPause','findOne','Team','getTeams','addTeams','ids','Agents','interface','flatMap','sequelize','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','every','TeamId'];(function(_0xd1f33c,_0x4bc953){var _0x518316=function(_0x538db8){while(--_0x538db8){_0xd1f33c['push'](_0xd1f33c['shift']());}};_0x518316(++_0x4bc953);}(_0xcbe1,0x1a2));var _0x1cbe=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xcbe1[_0x138f59];return _0x3d114d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1cbe('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1cbe('0x1'));var Mustache=require(_0x1cbe('0x2'));var util=require('util');var path=require(_0x1cbe('0x3'));var sox=require('sox');var csv=require(_0x1cbe('0x4'));var ejs=require(_0x1cbe('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1cbe('0x6'));var squel=require(_0x1cbe('0x7'));var crypto=require(_0x1cbe('0x8'));var jsforce=require(_0x1cbe('0x9'));var deskjs=require(_0x1cbe('0xa'));var toCsv=require(_0x1cbe('0x4'));var querystring=require(_0x1cbe('0xb'));var Papa=require(_0x1cbe('0xc'));var Redis=require('ioredis');var authService=require(_0x1cbe('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x1cbe('0xe'));var hardwareService=require(_0x1cbe('0xf'));var logger=require(_0x1cbe('0x10'))(_0x1cbe('0x11'));var utils=require('../../config/utils');var config=require(_0x1cbe('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x1cbe('0x13'))['db'];config[_0x1cbe('0x14')]=_['defaults'](config[_0x1cbe('0x14')],{'host':_0x1cbe('0x15'),'port':0x18eb});var socket=require(_0x1cbe('0x16'))(new Redis(config['redis']));require(_0x1cbe('0x17'))[_0x1cbe('0x18')](socket);function respondWithStatusCode(_0x2304c2,_0x21b05c){_0x21b05c=_0x21b05c||0xcc;return function(_0x47303f){if(_0x47303f){return _0x2304c2[_0x1cbe('0x19')](_0x21b05c);}return _0x2304c2[_0x1cbe('0x1a')](_0x21b05c)[_0x1cbe('0x1b')]();};}function respondWithResult(_0x109cd7,_0x41eec7){_0x41eec7=_0x41eec7||0xc8;return function(_0x4fd646){if(_0x4fd646){return _0x109cd7[_0x1cbe('0x1a')](_0x41eec7)[_0x1cbe('0x1c')](_0x4fd646);}};}function respondWithFilteredResult(_0x244a1d,_0x5ef1a2){return function(_0x1836a7){if(_0x1836a7){var _0x406d54=typeof _0x5ef1a2[_0x1cbe('0x1d')]==='undefined'&&typeof _0x5ef1a2['limit']===_0x1cbe('0x1e');var _0x75e87a=_0x1836a7[_0x1cbe('0x1f')];var _0x1c579b=_0x406d54?0x0:_0x5ef1a2['offset'];var _0x4a6bfd=_0x406d54?_0x1836a7[_0x1cbe('0x1f')]:_0x5ef1a2[_0x1cbe('0x1d')]+_0x5ef1a2[_0x1cbe('0x20')];var _0x56f3c6;if(_0x4a6bfd>=_0x75e87a){_0x4a6bfd=_0x75e87a;_0x56f3c6=0xc8;}else{_0x56f3c6=0xce;}_0x244a1d['status'](_0x56f3c6);return _0x244a1d[_0x1cbe('0x21')]('Content-Range',_0x1c579b+'-'+_0x4a6bfd+'/'+_0x75e87a)[_0x1cbe('0x1c')](_0x1836a7);}return null;};}function patchUpdates(_0x192a76){return function(_0x16f466){try{jsonpatch[_0x1cbe('0x22')](_0x16f466,_0x192a76,!![]);}catch(_0x19b93f){return BPromise[_0x1cbe('0x23')](_0x19b93f);}return _0x16f466[_0x1cbe('0x24')]();};}function saveUpdates(_0x23495c,_0xbdbfdb){return function(_0x4c7a82){if(_0x4c7a82){return _0x4c7a82[_0x1cbe('0x25')](_0x23495c)['then'](function(_0x1fb6aa){return _0x1fb6aa;});}return null;};}function removeEntity(_0x2208bd,_0x384845){return function(_0x55e751){if(_0x55e751){return _0x55e751[_0x1cbe('0x26')]()[_0x1cbe('0x27')](function(){var _0x1b391d=_0x55e751[_0x1cbe('0x28')]({'plain':!![]});var _0xd9bb05=_0x1cbe('0x29');return db['UserProfileResource'][_0x1cbe('0x26')]({'where':{'type':_0xd9bb05,'resourceId':_0x1b391d['id']}})[_0x1cbe('0x27')](function(){return _0x55e751;});})[_0x1cbe('0x27')](function(){_0x2208bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa30ec5,_0x52d0d5){return function(_0x252a61){if(!_0x252a61){_0xa30ec5['sendStatus'](0x194);}return _0x252a61;};}function handleError(_0x7d95b9,_0x9b12c4){_0x9b12c4=_0x9b12c4||0x1f4;return function(_0x3a937e){logger[_0x1cbe('0x2a')](_0x3a937e['stack']);if(_0x3a937e[_0x1cbe('0x2b')]){delete _0x3a937e[_0x1cbe('0x2b')];}_0x7d95b9[_0x1cbe('0x1a')](_0x9b12c4)[_0x1cbe('0x2c')](_0x3a937e);};}function getMustacheRender(_0x6ac965,_0x1b3465){return Mustache['render'](_0x6ac965,_['merge'](_0x1b3465[_0x1cbe('0x2d')],{'contact':_0x1b3465['contact'],'message':_0x1b3465[_0x1cbe('0x2e')],'agent':_0x1b3465[_0x1cbe('0x2f')],'interaction':_0x1b3465['interaction'],'account':_0x1b3465[_0x1cbe('0x30')]}))||'';}exports['index']=function(_0x33dfee,_0x1c1fa1){var _0xfd9138={},_0x3217e5={},_0x50691c={'count':0x0,'rows':[]};var _0x54c30e=_[_0x1cbe('0x31')](db[_0x1cbe('0x32')][_0x1cbe('0x33')],function(_0x39ed8c){return{'name':_0x39ed8c[_0x1cbe('0x34')],'type':_0x39ed8c['type'][_0x1cbe('0x35')]};});_0x3217e5[_0x1cbe('0x36')]=_['map'](_0x54c30e,_0x1cbe('0x2b'));_0x3217e5[_0x1cbe('0x37')]=_[_0x1cbe('0x38')](_0x33dfee['query']);_0x3217e5['filters']=_[_0x1cbe('0x39')](_0x3217e5[_0x1cbe('0x36')],_0x3217e5[_0x1cbe('0x37')]);_0xfd9138[_0x1cbe('0x3a')]=_[_0x1cbe('0x39')](_0x3217e5[_0x1cbe('0x36')],qs[_0x1cbe('0x3b')](_0x33dfee[_0x1cbe('0x37')]['fields']));_0xfd9138[_0x1cbe('0x3a')]=_0xfd9138['attributes'][_0x1cbe('0x3c')]?_0xfd9138['attributes']:_0x3217e5[_0x1cbe('0x36')];if(!_0x33dfee['query'][_0x1cbe('0x3d')]('nolimit')){_0xfd9138[_0x1cbe('0x20')]=qs[_0x1cbe('0x20')](_0x33dfee['query'][_0x1cbe('0x20')]);_0xfd9138[_0x1cbe('0x1d')]=qs[_0x1cbe('0x1d')](_0x33dfee[_0x1cbe('0x37')][_0x1cbe('0x1d')]);}_0xfd9138[_0x1cbe('0x3e')]=qs[_0x1cbe('0x3f')](_0x33dfee[_0x1cbe('0x37')][_0x1cbe('0x3f')]);_0xfd9138[_0x1cbe('0x40')]=qs['filters'](_[_0x1cbe('0x41')](_0x33dfee[_0x1cbe('0x37')],_0x3217e5[_0x1cbe('0x42')]),_0x54c30e);if(_0x33dfee[_0x1cbe('0x37')][_0x1cbe('0x43')]){_0xfd9138[_0x1cbe('0x40')]=_[_0x1cbe('0x44')](_0xfd9138[_0x1cbe('0x40')],{'$or':_[_0x1cbe('0x31')](_0x54c30e,function(_0x4e43b6){if(_0x4e43b6[_0x1cbe('0x45')]!==_0x1cbe('0x46')){var _0x990972={};_0x990972[_0x4e43b6[_0x1cbe('0x2b')]]={'$like':'%'+_0x33dfee['query']['filter']+'%'};return _0x990972;}})});}_0xfd9138=_[_0x1cbe('0x44')]({},_0xfd9138,_0x33dfee['options']);var _0x5c5b03={'where':_0xfd9138[_0x1cbe('0x40')]};return db[_0x1cbe('0x32')][_0x1cbe('0x1f')](_0x5c5b03)[_0x1cbe('0x27')](function(_0x44f4a4){_0x50691c[_0x1cbe('0x1f')]=_0x44f4a4;if(_0x33dfee[_0x1cbe('0x37')][_0x1cbe('0x47')]){_0xfd9138['include']=[{'all':!![]}];}return db[_0x1cbe('0x32')]['findAll'](_0xfd9138);})[_0x1cbe('0x27')](function(_0x1a2df0){_0x50691c[_0x1cbe('0x48')]=_0x1a2df0;return _0x50691c;})['then'](respondWithFilteredResult(_0x1c1fa1,_0xfd9138))[_0x1cbe('0x49')](handleError(_0x1c1fa1,null));};exports[_0x1cbe('0x4a')]=function(_0xddc7c0,_0xe4b4bb){var _0x81beb5={'raw':!![],'where':{'id':_0xddc7c0[_0x1cbe('0x4b')]['id']}},_0x150e97={};_0x150e97[_0x1cbe('0x36')]=_[_0x1cbe('0x38')](db[_0x1cbe('0x32')]['rawAttributes']);_0x150e97[_0x1cbe('0x37')]=_[_0x1cbe('0x38')](_0xddc7c0[_0x1cbe('0x37')]);_0x150e97[_0x1cbe('0x42')]=_[_0x1cbe('0x39')](_0x150e97['model'],_0x150e97[_0x1cbe('0x37')]);_0x81beb5[_0x1cbe('0x3a')]=_['intersection'](_0x150e97['model'],qs['fields'](_0xddc7c0['query'][_0x1cbe('0x3b')]));_0x81beb5[_0x1cbe('0x3a')]=_0x81beb5[_0x1cbe('0x3a')]['length']?_0x81beb5['attributes']:_0x150e97[_0x1cbe('0x36')];if(_0xddc7c0['query']['includeAll']){_0x81beb5[_0x1cbe('0x4c')]=[{'all':!![]}];}_0x81beb5=_['merge']({},_0x81beb5,_0xddc7c0[_0x1cbe('0x4d')]);return db[_0x1cbe('0x32')]['find'](_0x81beb5)['then'](handleEntityNotFound(_0xe4b4bb,null))['then'](respondWithResult(_0xe4b4bb,null))['catch'](handleError(_0xe4b4bb,null));};exports[_0x1cbe('0x4e')]=function(_0x1d8d72,_0x2a45df){return db[_0x1cbe('0x32')][_0x1cbe('0x4e')](_0x1d8d72[_0x1cbe('0x2d')],{})[_0x1cbe('0x27')](function(_0x3cb509){var _0x429bd5=_0x1d8d72['user'][_0x1cbe('0x28')]({'plain':!![]});if(!_0x429bd5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x429bd5[_0x1cbe('0x4f')]===_0x1cbe('0x50')){var _0x195378=_0x3cb509[_0x1cbe('0x28')]({'plain':!![]});var _0x280b82=_0x1cbe('0x29');return db[_0x1cbe('0x51')][_0x1cbe('0x52')]({'where':{'name':_0x280b82,'userProfileId':_0x429bd5[_0x1cbe('0x53')]},'raw':!![]})[_0x1cbe('0x27')](function(_0x24ceec){if(_0x24ceec&&_0x24ceec[_0x1cbe('0x54')]===0x0){return db[_0x1cbe('0x55')][_0x1cbe('0x4e')]({'name':_0x195378['name'],'resourceId':_0x195378['id'],'type':_0x24ceec[_0x1cbe('0x2b')],'sectionId':_0x24ceec['id']},{})['then'](function(){return _0x3cb509;});}else{return _0x3cb509;}})[_0x1cbe('0x49')](function(_0x503423){logger[_0x1cbe('0x2a')](_0x1cbe('0x56'),_0x503423);throw _0x503423;});}return _0x3cb509;})[_0x1cbe('0x27')](respondWithResult(_0x2a45df,0xc9))['catch'](handleError(_0x2a45df,null));};exports[_0x1cbe('0x25')]=function(_0x1d8251,_0x4c98b9){if(_0x1d8251[_0x1cbe('0x2d')]['id']){delete _0x1d8251[_0x1cbe('0x2d')]['id'];}return db[_0x1cbe('0x32')]['find']({'where':{'id':_0x1d8251[_0x1cbe('0x4b')]['id']}})[_0x1cbe('0x27')](handleEntityNotFound(_0x4c98b9,null))[_0x1cbe('0x27')](saveUpdates(_0x1d8251[_0x1cbe('0x2d')],null))[_0x1cbe('0x27')](respondWithResult(_0x4c98b9,null))[_0x1cbe('0x49')](handleError(_0x4c98b9,null));};exports[_0x1cbe('0x26')]=function(_0x5545ff,_0x5d6acb){return db['OpenchannelQueue'][_0x1cbe('0x52')]({'where':{'id':_0x5545ff[_0x1cbe('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5d6acb,null))[_0x1cbe('0x27')](removeEntity(_0x5d6acb,null))[_0x1cbe('0x49')](handleError(_0x5d6acb,null));};exports[_0x1cbe('0x57')]=function(_0x52ea2b,_0x2a55a5){return db[_0x1cbe('0x32')][_0x1cbe('0x57')]()['then'](respondWithResult(_0x2a55a5,null))[_0x1cbe('0x49')](handleError(_0x2a55a5,null));};exports[_0x1cbe('0x58')]=function(_0x4350e4,_0x9cf408,_0x350cda){var _0x45769f={'raw':!![],'where':{}},_0x58867a={},_0x2751ed;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x4350e4[_0x1cbe('0x4b')]['id']}})[_0x1cbe('0x27')](handleEntityNotFound(_0x9cf408,null))[_0x1cbe('0x27')](function(_0x579107){if(_0x579107){_0x2751ed=_0x579107['get']({'plain':!![]});_0x58867a['model']=_[_0x1cbe('0x38')](db[_0x1cbe('0x59')][_0x1cbe('0x33')]);_0x58867a['query']=_['keys'](_0x4350e4[_0x1cbe('0x37')]);_0x58867a[_0x1cbe('0x42')]=_[_0x1cbe('0x39')](_0x58867a[_0x1cbe('0x36')],_0x58867a['query']);_0x45769f[_0x1cbe('0x3a')]=_['intersection'](_0x58867a[_0x1cbe('0x36')],qs[_0x1cbe('0x3b')](_0x4350e4[_0x1cbe('0x37')][_0x1cbe('0x3b')]));_0x45769f[_0x1cbe('0x3a')]=_0x45769f[_0x1cbe('0x3a')][_0x1cbe('0x3c')]?_0x45769f['attributes']:_0x58867a[_0x1cbe('0x36')];if(!_0x4350e4[_0x1cbe('0x37')][_0x1cbe('0x3d')](_0x1cbe('0x5a'))){_0x45769f['limit']=qs[_0x1cbe('0x20')](_0x4350e4[_0x1cbe('0x37')][_0x1cbe('0x20')]);_0x45769f['offset']=qs[_0x1cbe('0x1d')](_0x4350e4[_0x1cbe('0x37')][_0x1cbe('0x1d')]);}_0x45769f[_0x1cbe('0x3e')]=qs[_0x1cbe('0x3f')](_0x4350e4[_0x1cbe('0x37')][_0x1cbe('0x3f')]);_0x45769f['where']=qs[_0x1cbe('0x42')](_['pick'](_0x4350e4[_0x1cbe('0x37')],_0x58867a[_0x1cbe('0x42')]));_0x45769f['where'][_0x1cbe('0x5b')]=_0x579107['id'];if(_0x4350e4[_0x1cbe('0x37')][_0x1cbe('0x43')]){_0x45769f[_0x1cbe('0x40')]=_[_0x1cbe('0x44')](_0x45769f[_0x1cbe('0x40')],{'$or':_[_0x1cbe('0x31')](_0x45769f[_0x1cbe('0x3a')],function(_0x2b286b){var _0x34ae6e={};_0x34ae6e[_0x2b286b]={'$like':'%'+_0x4350e4[_0x1cbe('0x37')][_0x1cbe('0x43')]+'%'};return _0x34ae6e;})});}_0x45769f=_[_0x1cbe('0x44')]({},_0x45769f,_0x4350e4[_0x1cbe('0x4d')]);return db[_0x1cbe('0x59')][_0x1cbe('0x5c')](_0x45769f);}})[_0x1cbe('0x27')](function(_0x449fd0){if(_0x449fd0){return db[_0x1cbe('0x5d')][_0x1cbe('0x5e')]({'where':{'id':_[_0x1cbe('0x31')](_0x449fd0,_0x1cbe('0x5f')),'role':'agent'},'attributes':['id',_0x1cbe('0x2b'),'openchannelPause',_0x1cbe('0x60'),'createdAt']});}})[_0x1cbe('0x27')](function(_0x4c7633){if(_0x4c7633){return{'count':_0x4c7633['count'],'rows':_[_0x1cbe('0x31')](_0x4c7633[_0x1cbe('0x48')],function(_0x10d10f){return{'membername':_0x10d10f[_0x1cbe('0x2b')],'UserId':_0x10d10f['id'],'queue_name':_0x2751ed[_0x1cbe('0x2b')],'OpenchannelQueueId':_0x2751ed['id'],'interface':util[_0x1cbe('0x61')](_0x1cbe('0x62'),_0x1cbe('0x63'),_0x10d10f[_0x1cbe('0x2b')]),'penalty':0x0,'paused':_0x10d10f[_0x1cbe('0x64')],'createdAt':_0x10d10f['createdAt'],'updatedAt':_0x10d10f[_0x1cbe('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1cbe('0x27')](respondWithFilteredResult(_0x9cf408,_0x45769f))[_0x1cbe('0x49')](handleError(_0x9cf408,null));};exports['getTeams']=function(_0x3e6d63,_0xec6cc1,_0x487d45){var _0x3edc89={};var _0x1c70a6={};var _0x57863a;var _0x4cbb2d;return db['OpenchannelQueue'][_0x1cbe('0x65')]({'where':{'id':_0x3e6d63[_0x1cbe('0x4b')]['id']}})['then'](handleEntityNotFound(_0xec6cc1,null))[_0x1cbe('0x27')](function(_0x155642){if(_0x155642){_0x57863a=_0x155642;_0x1c70a6['model']=_['keys'](db[_0x1cbe('0x66')][_0x1cbe('0x33')]);_0x1c70a6[_0x1cbe('0x37')]=_[_0x1cbe('0x38')](_0x3e6d63[_0x1cbe('0x37')]);_0x1c70a6[_0x1cbe('0x42')]=_['intersection'](_0x1c70a6[_0x1cbe('0x36')],_0x1c70a6[_0x1cbe('0x37')]);_0x3edc89['attributes']=_[_0x1cbe('0x39')](_0x1c70a6[_0x1cbe('0x36')],qs[_0x1cbe('0x3b')](_0x3e6d63[_0x1cbe('0x37')][_0x1cbe('0x3b')]));_0x3edc89[_0x1cbe('0x3a')]=_0x3edc89[_0x1cbe('0x3a')][_0x1cbe('0x3c')]?_0x3edc89[_0x1cbe('0x3a')]:_0x1c70a6[_0x1cbe('0x36')];_0x3edc89[_0x1cbe('0x3e')]=qs[_0x1cbe('0x3f')](_0x3e6d63[_0x1cbe('0x37')][_0x1cbe('0x3f')]);_0x3edc89[_0x1cbe('0x40')]=qs[_0x1cbe('0x42')](_[_0x1cbe('0x41')](_0x3e6d63[_0x1cbe('0x37')],_0x1c70a6['filters']));if(_0x3e6d63[_0x1cbe('0x37')][_0x1cbe('0x43')]){_0x3edc89['where']=_[_0x1cbe('0x44')](_0x3edc89[_0x1cbe('0x40')],{'$or':_[_0x1cbe('0x31')](_0x3edc89[_0x1cbe('0x3a')],function(_0x238a74){var _0x3744a3={};_0x3744a3[_0x238a74]={'$like':'%'+_0x3e6d63[_0x1cbe('0x37')]['filter']+'%'};return _0x3744a3;})});}_0x3edc89=_[_0x1cbe('0x44')]({},_0x3edc89,_0x3e6d63['options']);return _0x57863a[_0x1cbe('0x67')](_0x3edc89);}})[_0x1cbe('0x27')](function(_0x1914cf){if(_0x1914cf){_0x4cbb2d=_0x1914cf[_0x1cbe('0x3c')];if(!_0x3e6d63['query'][_0x1cbe('0x3d')](_0x1cbe('0x5a'))){_0x3edc89[_0x1cbe('0x20')]=qs['limit'](_0x3e6d63['query']['limit']);_0x3edc89[_0x1cbe('0x1d')]=qs[_0x1cbe('0x1d')](_0x3e6d63[_0x1cbe('0x37')][_0x1cbe('0x1d')]);}return _0x57863a['getTeams'](_0x3edc89);}})['then'](function(_0x271654){if(_0x271654){return _0x271654?{'count':_0x4cbb2d,'rows':_0x271654}:null;}})[_0x1cbe('0x27')](respondWithResult(_0xec6cc1,null))[_0x1cbe('0x49')](handleError(_0xec6cc1,null));};exports[_0x1cbe('0x68')]=function(_0x3d7b1a,_0x308748,_0x43ad49){var _0x4efd58=_0x3d7b1a[_0x1cbe('0x2d')][_0x1cbe('0x69')];return db[_0x1cbe('0x66')][_0x1cbe('0x5c')]({'where':{'id':_0x4efd58},'attributes':['id'],'include':[{'model':db[_0x1cbe('0x5d')],'as':_0x1cbe('0x6a'),'attributes':['id',_0x1cbe('0x2b'),'online','voicePause',_0x1cbe('0x6b')],'raw':!![]}]})[_0x1cbe('0x27')](function(_0x13996d){if(_0x13996d){var _0x4f7997=_[_0x1cbe('0x6c')](_0x13996d,function(_0x17fe2d){var _0x264b9b=_0x17fe2d['get']({'plain':!![]});return _0x264b9b[_0x1cbe('0x6a')];});return db[_0x1cbe('0x32')][_0x1cbe('0x52')]({'where':{'id':_0x3d7b1a['params']['id']}})[_0x1cbe('0x27')](function(_0x310d87){return db[_0x1cbe('0x6d')]['transaction'](function(_0x2095be){return _0x310d87[_0x1cbe('0x68')](_0x4efd58,{'transaction':_0x2095be})['then'](function(){return BPromise['each'](_0x4f7997,function(_0x466ca8){return db[_0x1cbe('0x59')][_0x1cbe('0x6e')]({'where':{'UserId':_0x466ca8['id'],'OpenchannelQueueId':_0x3d7b1a[_0x1cbe('0x4b')]['id']},'transaction':_0x2095be});});})[_0x1cbe('0x27')](function(){_0x4f7997[_0x1cbe('0x6f')](function(_0x27c8e6){socket[_0x1cbe('0x70')](_0x1cbe('0x71'),{'UserId':_0x27c8e6['id'],'OpenchannelQueueId':_0x310d87['id']});});});});});}})[_0x1cbe('0x27')](respondWithStatusCode(_0x308748,null))['catch'](handleError(_0x308748,null));};exports[_0x1cbe('0x72')]=function(_0x5308d7,_0x293e0e,_0xca1ed2){return db[_0x1cbe('0x66')][_0x1cbe('0x5c')]({'where':{'id':_0x5308d7[_0x1cbe('0x37')][_0x1cbe('0x69')]},'attributes':['id'],'include':[{'model':db[_0x1cbe('0x5d')],'as':_0x1cbe('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x1cbe('0x27')](handleEntityNotFound(_0x293e0e,null))['then'](function(_0x1bffa8){var _0x43d54a=_['map'](_0x1bffa8,'id');var _0x3f44b6=[];var _0x42558c=[];var _0x51e553=squel[_0x1cbe('0x73')]();_0x51e553['field']('tq.TeamId')[_0x1cbe('0x74')](_0x1cbe('0x75'),'tq')[_0x1cbe('0x76')](_0x1cbe('0x77'),'ut',_0x1cbe('0x78'))[_0x1cbe('0x40')](_0x1cbe('0x79'),_0x5308d7[_0x1cbe('0x4b')]['id']);for(var _0xc6f2bc=0x0;_0xc6f2bc<_0x1bffa8['length'];_0xc6f2bc+=0x1){let _0x50bc6e=_0x1bffa8[_0xc6f2bc];for(var _0x43e018=0x0;_0x43e018<_0x50bc6e[_0x1cbe('0x6a')][_0x1cbe('0x3c')];_0x43e018+=0x1){let _0x1afac1=_0x50bc6e['Agents'][_0x43e018];var _0x2146a3=_0x51e553[_0x1cbe('0x7a')]();_0x2146a3[_0x1cbe('0x40')]('ut.UserId\x20=\x20?',_0x1afac1['id']);_0x42558c[_0x1cbe('0x7b')](db['sequelize'][_0x1cbe('0x37')](_0x2146a3['toString'](),{'type':db[_0x1cbe('0x6d')]['QueryTypes']['SELECT']})[_0x1cbe('0x27')](function(_0x33c091){if(_0x33c091[_0x1cbe('0x3c')]===0x1){return _0x1afac1['id'];}else{var _0x22bd55=_[_0x1cbe('0x7c')](_[_0x1cbe('0x31')](_0x33c091,_0x1cbe('0x7d')),function(_0xb81c6d){return _['includes'](_0x43d54a,_0xb81c6d);});if(_0x22bd55){return _0x1afac1['id'];}}}));}}return BPromise[_0x1cbe('0x7e')](_0x42558c)[_0x1cbe('0x27')](function(_0x247789){_0x3f44b6=_(_0x3f44b6)[_0x1cbe('0x7f')](_0x247789)['compact']()[_0x1cbe('0x80')]();return db[_0x1cbe('0x32')]['find']({'where':{'id':_0x5308d7[_0x1cbe('0x4b')]['id']}})[_0x1cbe('0x27')](function(_0x5da52c){return db[_0x1cbe('0x6d')][_0x1cbe('0x81')](function(_0x46ea25){return _0x5da52c[_0x1cbe('0x72')](_0x5308d7['query']['ids'],{'transaction':_0x46ea25})[_0x1cbe('0x27')](function(){if(!_['isEmpty'](_0x3f44b6)){return _0x5da52c['removeAgents'](_0x3f44b6,{'transaction':_0x46ea25});}})['then'](function(){_0x3f44b6[_0x1cbe('0x6f')](function(_0x1cba8e){socket[_0x1cbe('0x70')]('userOpenchannelQueue:remove',{'UserId':_0x1cba8e,'OpenchannelQueueId':_0x5da52c['id']});});});});});});})['then'](respondWithStatusCode(_0x293e0e,null))[_0x1cbe('0x49')](handleError(_0x293e0e,null));};exports[_0x1cbe('0x82')]=function(_0x489c03,_0x4dab73,_0x2e9f2c){return db[_0x1cbe('0x32')][_0x1cbe('0x52')]({'where':{'id':_0x489c03[_0x1cbe('0x4b')]['id']}})[_0x1cbe('0x27')](handleEntityNotFound(_0x4dab73,null))['then'](function(_0x41912f){if(_0x41912f){return _0x41912f[_0x1cbe('0x82')](_0x489c03[_0x1cbe('0x2d')][_0x1cbe('0x69')],_[_0x1cbe('0x83')](_0x489c03[_0x1cbe('0x2d')],[_0x1cbe('0x69'),'id'])||{})[_0x1cbe('0x84')](function(_0x1776b4){for(var _0xb1a0a6=0x0;_0xb1a0a6<_0x489c03[_0x1cbe('0x2d')][_0x1cbe('0x69')][_0x1cbe('0x3c')];_0xb1a0a6+=0x1){socket[_0x1cbe('0x70')](_0x1cbe('0x71'),{'UserId':_0x489c03[_0x1cbe('0x2d')][_0x1cbe('0x69')][_0xb1a0a6],'OpenchannelQueueId':_0x489c03['params']['id']});}return _0x1776b4;});}})['then'](respondWithResult(_0x4dab73,null))[_0x1cbe('0x49')](handleError(_0x4dab73,null));};exports['removeAgents']=function(_0x3c93b9,_0x371be6,_0x488fed){return db[_0x1cbe('0x32')]['find']({'where':{'id':_0x3c93b9[_0x1cbe('0x4b')]['id']}})[_0x1cbe('0x27')](handleEntityNotFound(_0x371be6,null))['then'](function(_0x483762){if(_0x483762){return _0x483762['removeAgents'](_0x3c93b9[_0x1cbe('0x37')][_0x1cbe('0x69')])[_0x1cbe('0x27')](function(){if(_[_0x1cbe('0x85')](_0x3c93b9['query'][_0x1cbe('0x69')])){for(var _0x3cc098=0x0;_0x3cc098<_0x3c93b9[_0x1cbe('0x37')]['ids']['length'];_0x3cc098+=0x1){socket[_0x1cbe('0x70')](_0x1cbe('0x86'),{'UserId':Number(_0x3c93b9[_0x1cbe('0x37')][_0x1cbe('0x69')][_0x3cc098]),'OpenchannelQueueId':Number(_0x3c93b9[_0x1cbe('0x4b')]['id'])});}}else{socket[_0x1cbe('0x70')](_0x1cbe('0x86'),{'UserId':Number(_0x3c93b9[_0x1cbe('0x37')]['ids']),'OpenchannelQueueId':Number(_0x3c93b9['params']['id'])});}});}})[_0x1cbe('0x27')](respondWithStatusCode(_0x371be6,null))[_0x1cbe('0x49')](handleError(_0x371be6,null));};exports[_0x1cbe('0x87')]=function(_0x42ded7,_0x12842a,_0x26aa89){var _0x449aac={};var _0x7aaab0={};var _0x14a851;var _0x4acf54;return db[_0x1cbe('0x32')][_0x1cbe('0x65')]({'where':{'id':_0x42ded7[_0x1cbe('0x4b')]['id']}})[_0x1cbe('0x27')](handleEntityNotFound(_0x12842a,null))[_0x1cbe('0x27')](function(_0x3ad2ae){if(_0x3ad2ae){_0x14a851=_0x3ad2ae;_0x7aaab0[_0x1cbe('0x36')]=_[_0x1cbe('0x38')](db[_0x1cbe('0x5d')][_0x1cbe('0x33')]);_0x7aaab0[_0x1cbe('0x37')]=_[_0x1cbe('0x38')](_0x42ded7[_0x1cbe('0x37')]);_0x7aaab0[_0x1cbe('0x42')]=_[_0x1cbe('0x39')](_0x7aaab0['model'],_0x7aaab0['query']);_0x449aac['attributes']=_[_0x1cbe('0x39')](_0x7aaab0['model'],qs[_0x1cbe('0x3b')](_0x42ded7[_0x1cbe('0x37')]['fields']));_0x449aac['attributes']=_0x449aac[_0x1cbe('0x3a')]['length']?_0x449aac[_0x1cbe('0x3a')]:_0x7aaab0[_0x1cbe('0x36')];_0x449aac[_0x1cbe('0x3e')]=qs['sort'](_0x42ded7[_0x1cbe('0x37')]['sort']);_0x449aac[_0x1cbe('0x40')]=qs['filters'](_[_0x1cbe('0x41')](_0x42ded7[_0x1cbe('0x37')],_0x7aaab0[_0x1cbe('0x42')]));if(_0x42ded7['query'][_0x1cbe('0x43')]){_0x449aac[_0x1cbe('0x40')]=_[_0x1cbe('0x44')](_0x449aac[_0x1cbe('0x40')],{'$or':_[_0x1cbe('0x31')](_0x449aac[_0x1cbe('0x3a')],function(_0x4941f2){var _0xfb3d0d={};_0xfb3d0d[_0x4941f2]={'$like':'%'+_0x42ded7['query']['filter']+'%'};return _0xfb3d0d;})});}_0x449aac=_[_0x1cbe('0x44')]({},_0x449aac,_0x42ded7[_0x1cbe('0x4d')]);return _0x14a851[_0x1cbe('0x87')](_0x449aac);}})[_0x1cbe('0x27')](function(_0x3a760d){if(_0x3a760d){_0x4acf54=_0x3a760d[_0x1cbe('0x3c')];if(!_0x42ded7[_0x1cbe('0x37')][_0x1cbe('0x3d')](_0x1cbe('0x5a'))){_0x449aac[_0x1cbe('0x20')]=qs[_0x1cbe('0x20')](_0x42ded7['query']['limit']);_0x449aac['offset']=qs[_0x1cbe('0x1d')](_0x42ded7['query'][_0x1cbe('0x1d')]);}return _0x14a851[_0x1cbe('0x87')](_0x449aac);}})[_0x1cbe('0x27')](function(_0x4025ae){if(_0x4025ae){return _0x4025ae?{'count':_0x4acf54,'rows':_0x4025ae}:null;}})[_0x1cbe('0x27')](respondWithResult(_0x12842a,null))[_0x1cbe('0x49')](handleError(_0x12842a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index ce62f09..0306866 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 _0x9262=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update'];(function(_0xb583bf,_0x58da03){var _0x3f9ce7=function(_0x29d75d){while(--_0x29d75d){_0xb583bf['push'](_0xb583bf['shift']());}};_0x3f9ce7(++_0x58da03);}(_0x9262,0x1d1));var _0x2926=function(_0x17e8aa,_0x45ac54){_0x17e8aa=_0x17e8aa-0x0;var _0x2cb612=_0x9262[_0x17e8aa];return _0x2cb612;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x2926('0x0'))['db'][_0x2926('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2926('0x2')](0x0);var events={'afterCreate':_0x2926('0x3'),'afterUpdate':_0x2926('0x4'),'afterDestroy':_0x2926('0x5')};function emitEvent(_0x45472e){return function(_0x31d13c,_0x7ddd41,_0x8281d){OpenchannelQueueEvents[_0x2926('0x6')](_0x45472e+':'+_0x31d13c['id'],_0x31d13c);OpenchannelQueueEvents['emit'](_0x45472e,_0x31d13c);_0x8281d(null);};}for(var e in events){if(events[_0x2926('0x7')](e)){var event=events[e];OpenchannelQueue[_0x2926('0x8')](e,emitEvent(event));}}module[_0x2926('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x9576=['../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x31f69b,_0xc2314){var _0x4dbf13=function(_0x4c5580){while(--_0x4c5580){_0x31f69b['push'](_0x31f69b['shift']());}};_0x4dbf13(++_0xc2314);}(_0x9576,0xa4));var _0x6957=function(_0x2d16b0,_0x17f000){_0x2d16b0=_0x2d16b0-0x0;var _0x291b9a=_0x9576[_0x2d16b0];return _0x291b9a;};'use strict';var EventEmitter=require(_0x6957('0x0'));var OpenchannelQueue=require(_0x6957('0x1'))['db'][_0x6957('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x6957('0x3')](0x0);var events={'afterCreate':_0x6957('0x4'),'afterUpdate':_0x6957('0x5'),'afterDestroy':_0x6957('0x6')};function emitEvent(_0x24bac1){return function(_0x1a683d,_0x5c5adf,_0x3b199a){OpenchannelQueueEvents[_0x6957('0x7')](_0x24bac1+':'+_0x1a683d['id'],_0x1a683d);OpenchannelQueueEvents[_0x6957('0x7')](_0x24bac1,_0x1a683d);_0x3b199a(null);};}for(var e in events){if(events[_0x6957('0x8')](e)){var event=events[e];OpenchannelQueue[_0x6957('0x9')](e,emitEvent(event));}}module[_0x6957('0xa')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index d0294df..0bc1d5d 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 _0x38fd=['./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x38fd,0x117));var _0xd38f=function(_0x38ce7d,_0x53feaa){_0x38ce7d=_0x38ce7d-0x0;var _0x211b83=_0x38fd[_0x38ce7d];return _0x211b83;};'use strict';var _=require(_0xd38f('0x0'));var util=require(_0xd38f('0x1'));var logger=require(_0xd38f('0x2'))('api');var moment=require(_0xd38f('0x3'));var BPromise=require(_0xd38f('0x4'));var rp=require(_0xd38f('0x5'));var fs=require('fs');var path=require(_0xd38f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd38f('0x7'));module[_0xd38f('0x8')]=function(_0x52868c,_0x3e0d55){return _0x52868c[_0xd38f('0x9')]('OpenchannelQueue',attributes,{'tableName':_0xd38f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc302=['OpenchannelQueue','openchannel_queues','lodash','api','bluebird','request-promise','path','rimraf','./openchannelQueue.attributes','define'];(function(_0x217d4c,_0x31dbd8){var _0x5c2fba=function(_0x77c5aa){while(--_0x77c5aa){_0x217d4c['push'](_0x217d4c['shift']());}};_0x5c2fba(++_0x31dbd8);}(_0xc302,0x17e));var _0x2c30=function(_0x5b50a8,_0x346096){_0x5b50a8=_0x5b50a8-0x0;var _0x694327=_0xc302[_0x5b50a8];return _0x694327;};'use strict';var _=require(_0x2c30('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2c30('0x1'));var moment=require('moment');var BPromise=require(_0x2c30('0x2'));var rp=require(_0x2c30('0x3'));var fs=require('fs');var path=require(_0x2c30('0x4'));var rimraf=require(_0x2c30('0x5'));var config=require('../../config/environment');var attributes=require(_0x2c30('0x6'));module['exports']=function(_0x4e4081,_0x43c6cb){return _0x4e4081[_0x2c30('0x7')](_0x2c30('0x8'),attributes,{'tableName':_0x2c30('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 2c94c65..21d6ea7 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 _0x84a4=['findAll','options','raw','limit','include','map','model','attributes','then','GetOpenchannelQueue','debug','catch','ShowOpenchannelQueue','OpenchannelQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','OpenchannelQueue,\x20%s,\x20%s','message','result'];(function(_0x15a000,_0x1f1df2){var _0x50b54a=function(_0x29a9d2){while(--_0x29a9d2){_0x15a000['push'](_0x15a000['shift']());}};_0x50b54a(++_0x1f1df2);}(_0x84a4,0x11e));var _0x484a=function(_0x5d591f,_0x22a860){_0x5d591f=_0x5d591f-0x0;var _0x2daad6=_0x84a4[_0x5d591f];return _0x2daad6;};'use strict';var _=require(_0x484a('0x0'));var util=require(_0x484a('0x1'));var moment=require(_0x484a('0x2'));var BPromise=require(_0x484a('0x3'));var rs=require(_0x484a('0x4'));var fs=require('fs');var Redis=require(_0x484a('0x5'));var db=require(_0x484a('0x6'))['db'];var utils=require(_0x484a('0x7'));var logger=require(_0x484a('0x8'))(_0x484a('0x9'));var config=require(_0x484a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x484a('0xb')][_0x484a('0xc')]({'port':0x232a});config[_0x484a('0xd')]=_[_0x484a('0xe')](config['redis'],{'host':_0x484a('0xf'),'port':0x18eb});var socket=require(_0x484a('0x10'))(new Redis(config[_0x484a('0xd')]));require(_0x484a('0x11'))[_0x484a('0x12')](socket);function respondWithRpcPromise(_0xb301b8,_0x53881a,_0x4668d5){return new BPromise(function(_0x4627ff,_0xff11){return client[_0x484a('0x13')](_0xb301b8,_0x4668d5)['then'](function(_0x98cb8d){logger[_0x484a('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x53881a,_0x484a('0x15'));logger['debug'](_0x484a('0x16'),_0x53881a,_0x484a('0x15'),JSON[_0x484a('0x17')](_0x98cb8d));if(_0x98cb8d['error']){if(_0x98cb8d['error'][_0x484a('0x18')]===0x1f4){logger[_0x484a('0x19')](_0x484a('0x1a'),_0x53881a,_0x98cb8d['error'][_0x484a('0x1b')]);return _0xff11(_0x98cb8d[_0x484a('0x19')][_0x484a('0x1b')]);}logger[_0x484a('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x53881a,_0x98cb8d[_0x484a('0x19')][_0x484a('0x1b')]);return _0x4627ff(_0x98cb8d[_0x484a('0x19')][_0x484a('0x1b')]);}else{logger['info'](_0x484a('0x1a'),_0x53881a,'request\x20sent');_0x4627ff(_0x98cb8d[_0x484a('0x1c')][_0x484a('0x1b')]);}})['catch'](function(_0x4f5583){logger[_0x484a('0x19')](_0x484a('0x1a'),_0x53881a,_0x4f5583);_0xff11(_0x4f5583);});});}exports['GetOpenchannelQueue']=function(_0xf5472b){var _0x46f02e=this;return new Promise(function(_0x45ee94,_0x259c19){return db['OpenchannelQueue'][_0x484a('0x1d')]({'raw':_0xf5472b['options']?_0xf5472b[_0x484a('0x1e')][_0x484a('0x1f')]===undefined?!![]:![]:!![],'where':_0xf5472b['options']?_0xf5472b[_0x484a('0x1e')]['where']||null:null,'attributes':_0xf5472b['options']?_0xf5472b[_0x484a('0x1e')]['attributes']||null:null,'limit':_0xf5472b[_0x484a('0x1e')]?_0xf5472b[_0x484a('0x1e')][_0x484a('0x20')]||null:null,'include':_0xf5472b[_0x484a('0x1e')]?_0xf5472b[_0x484a('0x1e')][_0x484a('0x21')]?_[_0x484a('0x22')](_0xf5472b[_0x484a('0x1e')]['include'],function(_0x48f5fe){return{'model':db[_0x48f5fe[_0x484a('0x23')]],'as':_0x48f5fe['as'],'attributes':_0x48f5fe['attributes'],'include':_0x48f5fe[_0x484a('0x21')]?_[_0x484a('0x22')](_0x48f5fe[_0x484a('0x21')],function(_0x12e092){return{'model':db[_0x12e092[_0x484a('0x23')]],'as':_0x12e092['as'],'attributes':_0x12e092[_0x484a('0x24')],'include':_0x12e092['include']?_[_0x484a('0x22')](_0x12e092[_0x484a('0x21')],function(_0x35c5ff){return{'model':db[_0x35c5ff[_0x484a('0x23')]],'as':_0x35c5ff['as'],'attributes':_0x35c5ff[_0x484a('0x24')]};}):[]};}):[]};}):[]:[]})[_0x484a('0x25')](function(_0x2eb690){logger['info'](_0x484a('0x26'),_0xf5472b);logger[_0x484a('0x27')]('GetOpenchannelQueue',_0xf5472b,JSON[_0x484a('0x17')](_0x2eb690));_0x45ee94(_0x2eb690);})[_0x484a('0x28')](function(_0x3483e0){logger[_0x484a('0x19')](_0x484a('0x26'),_0x3483e0[_0x484a('0x1b')],_0xf5472b);_0x259c19(_0x46f02e[_0x484a('0x19')](0x1f4,_0x3483e0[_0x484a('0x1b')]));});});};exports[_0x484a('0x29')]=function(_0x4828de){var _0x4c288b=this;return new Promise(function(_0x1228a9,_0x103fed){return db[_0x484a('0x2a')][_0x484a('0x2b')]({'raw':_0x4828de['options']?_0x4828de[_0x484a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4828de[_0x484a('0x1e')]?_0x4828de['options'][_0x484a('0x2c')]||null:null,'attributes':_0x4828de[_0x484a('0x1e')]?_0x4828de[_0x484a('0x1e')][_0x484a('0x24')]||null:null,'include':_0x4828de[_0x484a('0x1e')]?_0x4828de[_0x484a('0x1e')][_0x484a('0x21')]?_[_0x484a('0x22')](_0x4828de['options']['include'],function(_0x5724d6){return{'model':db[_0x5724d6[_0x484a('0x23')]],'as':_0x5724d6['as'],'attributes':_0x5724d6[_0x484a('0x24')],'include':_0x5724d6[_0x484a('0x21')]?_[_0x484a('0x22')](_0x5724d6[_0x484a('0x21')],function(_0x377183){return{'model':db[_0x377183[_0x484a('0x23')]],'as':_0x377183['as'],'attributes':_0x377183['attributes'],'include':_0x377183[_0x484a('0x21')]?_['map'](_0x377183[_0x484a('0x21')],function(_0xbce438){return{'model':db[_0xbce438[_0x484a('0x23')]],'as':_0xbce438['as'],'attributes':_0xbce438[_0x484a('0x24')]};}):[]};}):[]};}):[]:[]})[_0x484a('0x25')](function(_0xb1b9ef){logger[_0x484a('0x14')](_0x484a('0x29'),_0x4828de);logger[_0x484a('0x27')]('ShowOpenchannelQueue',_0x4828de,JSON[_0x484a('0x17')](_0xb1b9ef));_0x1228a9(_0xb1b9ef);})['catch'](function(_0x3fcc0d){logger[_0x484a('0x19')](_0x484a('0x29'),_0x3fcc0d[_0x484a('0x1b')],_0x4828de);_0x103fed(_0x4c288b[_0x484a('0x19')](0x1f4,_0x3fcc0d['message']));});});}; \ No newline at end of file +var _0x9a49=['where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','limit','include','attributes','map','model','stringify','catch','ShowOpenchannelQueue','find'];(function(_0x5519ba,_0x583039){var _0xa16629=function(_0x31a274){while(--_0x31a274){_0x5519ba['push'](_0x5519ba['shift']());}};_0xa16629(++_0x583039);}(_0x9a49,0xce));var _0x99a4=function(_0x3f4528,_0x57b7f5){_0x3f4528=_0x3f4528-0x0;var _0x4507b3=_0x9a49[_0x3f4528];return _0x4507b3;};'use strict';var _=require(_0x99a4('0x0'));var util=require('util');var moment=require(_0x99a4('0x1'));var BPromise=require(_0x99a4('0x2'));var rs=require(_0x99a4('0x3'));var fs=require('fs');var Redis=require(_0x99a4('0x4'));var db=require(_0x99a4('0x5'))['db'];var utils=require(_0x99a4('0x6'));var logger=require('../../config/logger')(_0x99a4('0x7'));var config=require('../../config/environment');var jayson=require(_0x99a4('0x8'));var client=jayson[_0x99a4('0x9')][_0x99a4('0xa')]({'port':0x232a});config['redis']=_[_0x99a4('0xb')](config['redis'],{'host':_0x99a4('0xc'),'port':0x18eb});var socket=require(_0x99a4('0xd'))(new Redis(config[_0x99a4('0xe')]));require('./openchannelQueue.socket')[_0x99a4('0xf')](socket);function respondWithRpcPromise(_0xb84ee6,_0x4ebef2,_0x370abe){return new BPromise(function(_0x46e1de,_0x4e92c1){return client[_0x99a4('0x10')](_0xb84ee6,_0x370abe)[_0x99a4('0x11')](function(_0x4bce57){logger[_0x99a4('0x12')](_0x99a4('0x13'),_0x4ebef2,_0x99a4('0x14'));logger[_0x99a4('0x15')](_0x99a4('0x16'),_0x4ebef2,_0x99a4('0x14'),JSON['stringify'](_0x4bce57));if(_0x4bce57[_0x99a4('0x17')]){if(_0x4bce57[_0x99a4('0x17')][_0x99a4('0x18')]===0x1f4){logger[_0x99a4('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x4ebef2,_0x4bce57[_0x99a4('0x17')]['message']);return _0x4e92c1(_0x4bce57['error']['message']);}logger[_0x99a4('0x17')](_0x99a4('0x13'),_0x4ebef2,_0x4bce57['error'][_0x99a4('0x19')]);return _0x46e1de(_0x4bce57['error'][_0x99a4('0x19')]);}else{logger[_0x99a4('0x12')](_0x99a4('0x13'),_0x4ebef2,_0x99a4('0x14'));_0x46e1de(_0x4bce57['result'][_0x99a4('0x19')]);}})['catch'](function(_0x27e81d){logger[_0x99a4('0x17')](_0x99a4('0x13'),_0x4ebef2,_0x27e81d);_0x4e92c1(_0x27e81d);});});}exports[_0x99a4('0x1a')]=function(_0x4abec5){var _0x84e344=this;return new Promise(function(_0x15cc82,_0x2848dd){return db[_0x99a4('0x1b')][_0x99a4('0x1c')]({'raw':_0x4abec5[_0x99a4('0x1d')]?_0x4abec5[_0x99a4('0x1d')][_0x99a4('0x1e')]===undefined?!![]:![]:!![],'where':_0x4abec5[_0x99a4('0x1d')]?_0x4abec5[_0x99a4('0x1d')]['where']||null:null,'attributes':_0x4abec5[_0x99a4('0x1d')]?_0x4abec5['options']['attributes']||null:null,'limit':_0x4abec5['options']?_0x4abec5[_0x99a4('0x1d')][_0x99a4('0x1f')]||null:null,'include':_0x4abec5[_0x99a4('0x1d')]?_0x4abec5['options'][_0x99a4('0x20')]?_['map'](_0x4abec5[_0x99a4('0x1d')][_0x99a4('0x20')],function(_0x57c78a){return{'model':db[_0x57c78a['model']],'as':_0x57c78a['as'],'attributes':_0x57c78a[_0x99a4('0x21')],'include':_0x57c78a['include']?_[_0x99a4('0x22')](_0x57c78a[_0x99a4('0x20')],function(_0x43ece1){return{'model':db[_0x43ece1[_0x99a4('0x23')]],'as':_0x43ece1['as'],'attributes':_0x43ece1[_0x99a4('0x21')],'include':_0x43ece1[_0x99a4('0x20')]?_['map'](_0x43ece1[_0x99a4('0x20')],function(_0x26a9e9){return{'model':db[_0x26a9e9[_0x99a4('0x23')]],'as':_0x26a9e9['as'],'attributes':_0x26a9e9[_0x99a4('0x21')]};}):[]};}):[]};}):[]:[]})[_0x99a4('0x11')](function(_0xf686a7){logger[_0x99a4('0x12')]('GetOpenchannelQueue',_0x4abec5);logger[_0x99a4('0x15')]('GetOpenchannelQueue',_0x4abec5,JSON[_0x99a4('0x24')](_0xf686a7));_0x15cc82(_0xf686a7);})[_0x99a4('0x25')](function(_0x33a190){logger['error'](_0x99a4('0x1a'),_0x33a190[_0x99a4('0x19')],_0x4abec5);_0x2848dd(_0x84e344[_0x99a4('0x17')](0x1f4,_0x33a190[_0x99a4('0x19')]));});});};exports[_0x99a4('0x26')]=function(_0x2bdb9f){var _0x30b8a7=this;return new Promise(function(_0xf463bf,_0x4bf8dc){return db['OpenchannelQueue'][_0x99a4('0x27')]({'raw':_0x2bdb9f['options']?_0x2bdb9f[_0x99a4('0x1d')][_0x99a4('0x1e')]===undefined?!![]:![]:!![],'where':_0x2bdb9f[_0x99a4('0x1d')]?_0x2bdb9f[_0x99a4('0x1d')][_0x99a4('0x28')]||null:null,'attributes':_0x2bdb9f[_0x99a4('0x1d')]?_0x2bdb9f[_0x99a4('0x1d')]['attributes']||null:null,'include':_0x2bdb9f['options']?_0x2bdb9f['options'][_0x99a4('0x20')]?_['map'](_0x2bdb9f[_0x99a4('0x1d')][_0x99a4('0x20')],function(_0x19190e){return{'model':db[_0x19190e[_0x99a4('0x23')]],'as':_0x19190e['as'],'attributes':_0x19190e[_0x99a4('0x21')],'include':_0x19190e[_0x99a4('0x20')]?_[_0x99a4('0x22')](_0x19190e[_0x99a4('0x20')],function(_0x3babb7){return{'model':db[_0x3babb7['model']],'as':_0x3babb7['as'],'attributes':_0x3babb7[_0x99a4('0x21')],'include':_0x3babb7['include']?_[_0x99a4('0x22')](_0x3babb7[_0x99a4('0x20')],function(_0x1cae1a){return{'model':db[_0x1cae1a['model']],'as':_0x1cae1a['as'],'attributes':_0x1cae1a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4340ca){logger[_0x99a4('0x12')](_0x99a4('0x26'),_0x2bdb9f);logger[_0x99a4('0x15')](_0x99a4('0x26'),_0x2bdb9f,JSON['stringify'](_0x4340ca));_0xf463bf(_0x4340ca);})[_0x99a4('0x25')](function(_0x23c96d){logger['error'](_0x99a4('0x26'),_0x23c96d[_0x99a4('0x19')],_0x2bdb9f);_0x4bf8dc(_0x30b8a7[_0x99a4('0x17')](0x1f4,_0x23c96d[_0x99a4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 181c41e..68d2db8 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 _0xa750=['register','length','openchannelQueue:','save','remove','update','removeListener'];(function(_0x1fc47b,_0x3fa1f0){var _0x33a9a4=function(_0x29243e){while(--_0x29243e){_0x1fc47b['push'](_0x1fc47b['shift']());}};_0x33a9a4(++_0x3fa1f0);}(_0xa750,0x137));var _0x0a75=function(_0x3fb1ae,_0x29fa8e){_0x3fb1ae=_0x3fb1ae-0x0;var _0x50d37e=_0xa750[_0x3fb1ae];return _0x50d37e;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x0a75('0x0'),_0x0a75('0x1'),_0x0a75('0x2')];function createListener(_0x15fe31,_0x43cc5b){return function(_0x174c0b){_0x43cc5b['emit'](_0x15fe31,_0x174c0b);};}function removeListener(_0x4197b2,_0x213fc1){return function(){OpenchannelQueueEvents[_0x0a75('0x3')](_0x4197b2,_0x213fc1);};}exports[_0x0a75('0x4')]=function(_0x3240ff){for(var _0x58cfc5=0x0,_0x21225e=events[_0x0a75('0x5')];_0x58cfc5<_0x21225e;_0x58cfc5++){var _0x438c0c=events[_0x58cfc5];var _0xeafcbe=createListener(_0x0a75('0x6')+_0x438c0c,_0x3240ff);OpenchannelQueueEvents['on'](_0x438c0c,_0xeafcbe);}}; \ No newline at end of file +var _0x2167=['update','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x5bdc5e,_0x342a67){var _0x1c22ac=function(_0x20b1d5){while(--_0x20b1d5){_0x5bdc5e['push'](_0x5bdc5e['shift']());}};_0x1c22ac(++_0x342a67);}(_0x2167,0xc5));var _0x7216=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x2167[_0x2b4411];return _0x8e41ef;};'use strict';var OpenchannelQueueEvents=require(_0x7216('0x0'));var events=[_0x7216('0x1'),_0x7216('0x2'),_0x7216('0x3')];function createListener(_0x2d2713,_0x34718a){return function(_0x114e00){_0x34718a['emit'](_0x2d2713,_0x114e00);};}function removeListener(_0x51d0ab,_0x7e77ed){return function(){OpenchannelQueueEvents[_0x7216('0x4')](_0x51d0ab,_0x7e77ed);};}exports[_0x7216('0x5')]=function(_0x414623){for(var _0xbd3cd1=0x0,_0x36b7e1=events[_0x7216('0x6')];_0xbd3cd1<_0x36b7e1;_0xbd3cd1++){var _0x41a2c2=events[_0xbd3cd1];var _0x4c662c=createListener(_0x7216('0x7')+_0x41a2c2,_0x414623);OpenchannelQueueEvents['on'](_0x41a2c2,_0x4c662c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 8bd97fb..2382c4b 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 _0x0c62=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy','exports','path'];(function(_0x16cf30,_0x593b43){var _0x1818ee=function(_0x351a57){while(--_0x351a57){_0x16cf30['push'](_0x16cf30['shift']());}};_0x1818ee(++_0x593b43);}(_0x0c62,0x167));var _0x20c6=function(_0x354a85,_0x3f3765){_0x354a85=_0x354a85-0x0;var _0x1c2b6b=_0x0c62[_0x354a85];return _0x1c2b6b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x20c6('0x0'));var timeout=require(_0x20c6('0x1'));var express=require(_0x20c6('0x2'));var router=express[_0x20c6('0x3')]();var fs_extra=require(_0x20c6('0x4'));var auth=require(_0x20c6('0x5'));var interaction=require(_0x20c6('0x6'));var config=require(_0x20c6('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0x20c6('0x8')]('/',auth[_0x20c6('0x9')](),controller[_0x20c6('0xa')]);router[_0x20c6('0x8')](_0x20c6('0xb'),auth[_0x20c6('0x9')](),controller[_0x20c6('0xc')]);router[_0x20c6('0x8')](_0x20c6('0xd'),auth[_0x20c6('0x9')](),controller[_0x20c6('0xe')]);router[_0x20c6('0xf')]('/',auth[_0x20c6('0x9')](),controller[_0x20c6('0x10')]);router[_0x20c6('0x11')](_0x20c6('0xd'),auth[_0x20c6('0x9')](),controller['update']);router['delete'](_0x20c6('0xd'),auth[_0x20c6('0x9')](),controller[_0x20c6('0x12')]);module[_0x20c6('0x13')]=router; \ No newline at end of file +var _0x60d6=['post','put','update','destroy','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show'];(function(_0x1519b7,_0x228318){var _0x2a17a7=function(_0x512a8c){while(--_0x512a8c){_0x1519b7['push'](_0x1519b7['shift']());}};_0x2a17a7(++_0x228318);}(_0x60d6,0x1b7));var _0x660d=function(_0x49abd4,_0x168516){_0x49abd4=_0x49abd4-0x0;var _0x38f7c3=_0x60d6[_0x49abd4];return _0x38f7c3;};'use strict';var multer=require(_0x660d('0x0'));var util=require(_0x660d('0x1'));var path=require('path');var timeout=require(_0x660d('0x2'));var express=require(_0x660d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x660d('0x4'));var config=require(_0x660d('0x5'));var controller=require('./openchannelQueueReport.controller');router[_0x660d('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x660d('0x6')](_0x660d('0x7'),auth[_0x660d('0x8')](),controller['describe']);router[_0x660d('0x6')](_0x660d('0x9'),auth['isAuthenticated'](),controller[_0x660d('0xa')]);router[_0x660d('0xb')]('/',auth[_0x660d('0x8')](),controller['create']);router[_0x660d('0xc')](_0x660d('0x9'),auth[_0x660d('0x8')](),controller[_0x660d('0xd')]);router['delete'](_0x660d('0x9'),auth[_0x660d('0x8')](),controller[_0x660d('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index c4b21af..b5b67fa 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 _0x2ed7=['STRING','DATE','moment','exports'];(function(_0x3bc82d,_0x59187f){var _0x2cfb3d=function(_0x515ac3){while(--_0x515ac3){_0x3bc82d['push'](_0x3bc82d['shift']());}};_0x2cfb3d(++_0x59187f);}(_0x2ed7,0x9e));var _0x72ed=function(_0x209816,_0x3b363e){_0x209816=_0x209816-0x0;var _0x500e96=_0x2ed7[_0x209816];return _0x500e96;};'use strict';var moment=require(_0x72ed('0x0'));var Sequelize=require('sequelize');module[_0x72ed('0x1')]={'uniqueid':{'type':Sequelize[_0x72ed('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x72ed('0x2')]},'joinAt':{'type':Sequelize[_0x72ed('0x3')]},'leaveAt':{'type':Sequelize[_0x72ed('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7dbc=['STRING','DATE','moment','sequelize','exports'];(function(_0x397f34,_0x3ac328){var _0x272cda=function(_0x2c9756){while(--_0x2c9756){_0x397f34['push'](_0x397f34['shift']());}};_0x272cda(++_0x3ac328);}(_0x7dbc,0xcf));var _0xc7db=function(_0x4e073c,_0x47fdf0){_0x4e073c=_0x4e073c-0x0;var _0x672639=_0x7dbc[_0x4e073c];return _0x672639;};'use strict';var moment=require(_0xc7db('0x0'));var Sequelize=require(_0xc7db('0x1'));module[_0xc7db('0x2')]={'uniqueid':{'type':Sequelize[_0xc7db('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc7db('0x3')]},'joinAt':{'type':Sequelize[_0xc7db('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc7db('0x4')]},'exitAt':{'type':Sequelize[_0xc7db('0x4')]},'reason':{'type':Sequelize[_0xc7db('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index b3ece43..42ae8a4 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 _0x105b=['rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','limit','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','render','merge','contact','message','agent','interaction','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','options','includeAll','findAll'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x105b,0x1a7));var _0xb105=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x105b[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xb105('0x0'));var rimraf=require(_0xb105('0x1'));var zipdir=require(_0xb105('0x2'));var jsonpatch=require(_0xb105('0x3'));var rp=require(_0xb105('0x4'));var moment=require(_0xb105('0x5'));var BPromise=require(_0xb105('0x6'));var Mustache=require('mustache');var util=require(_0xb105('0x7'));var path=require(_0xb105('0x8'));var sox=require(_0xb105('0x9'));var csv=require('to-csv');var ejs=require(_0xb105('0xa'));var fs=require('fs');var fs_extra=require(_0xb105('0xb'));var _=require(_0xb105('0xc'));var squel=require(_0xb105('0xd'));var crypto=require(_0xb105('0xe'));var jsforce=require(_0xb105('0xf'));var deskjs=require(_0xb105('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb105('0x11'));var Papa=require(_0xb105('0x12'));var Redis=require('ioredis');var authService=require(_0xb105('0x13'));var qs=require(_0xb105('0x14'));var as=require(_0xb105('0x15'));var hardwareService=require(_0xb105('0x16'));var logger=require(_0xb105('0x17'))('api');var utils=require(_0xb105('0x18'));var config=require(_0xb105('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb105('0x1a'))['db'];function respondWithStatusCode(_0x3526e6,_0x915163){_0x915163=_0x915163||0xcc;return function(_0x2a91f7){if(_0x2a91f7){return _0x3526e6['sendStatus'](_0x915163);}return _0x3526e6['status'](_0x915163)[_0xb105('0x1b')]();};}function respondWithResult(_0xe9e74b,_0x5539d9){_0x5539d9=_0x5539d9||0xc8;return function(_0x57ef20){if(_0x57ef20){return _0xe9e74b[_0xb105('0x1c')](_0x5539d9)[_0xb105('0x1d')](_0x57ef20);}};}function respondWithFilteredResult(_0x5fa9f8,_0x1000d8){return function(_0x37a7b8){if(_0x37a7b8){var _0x4c17df=typeof _0x1000d8['offset']===_0xb105('0x1e')&&typeof _0x1000d8['limit']==='undefined';var _0x47316a=_0x37a7b8[_0xb105('0x1f')];var _0x9b1007=_0x4c17df?0x0:_0x1000d8[_0xb105('0x20')];var _0x4f6551=_0x4c17df?_0x37a7b8[_0xb105('0x1f')]:_0x1000d8[_0xb105('0x20')]+_0x1000d8[_0xb105('0x21')];var _0x31d840;if(_0x4f6551>=_0x47316a){_0x4f6551=_0x47316a;_0x31d840=0xc8;}else{_0x31d840=0xce;}_0x5fa9f8[_0xb105('0x1c')](_0x31d840);return _0x5fa9f8['set'](_0xb105('0x22'),_0x9b1007+'-'+_0x4f6551+'/'+_0x47316a)[_0xb105('0x1d')](_0x37a7b8);}return null;};}function patchUpdates(_0x7bff86){return function(_0x148e52){try{jsonpatch[_0xb105('0x23')](_0x148e52,_0x7bff86,!![]);}catch(_0x1d9c14){return BPromise['reject'](_0x1d9c14);}return _0x148e52[_0xb105('0x24')]();};}function saveUpdates(_0x28a413,_0x12e28d){return function(_0x4da00b){if(_0x4da00b){return _0x4da00b[_0xb105('0x25')](_0x28a413)[_0xb105('0x26')](function(_0x33700a){return _0x33700a;});}return null;};}function removeEntity(_0x1a085a,_0x51c25f){return function(_0x2f64a0){if(_0x2f64a0){return _0x2f64a0[_0xb105('0x27')]()[_0xb105('0x26')](function(){_0x1a085a[_0xb105('0x1c')](0xcc)[_0xb105('0x1b')]();});}};}function handleEntityNotFound(_0x415deb,_0x470e1b){return function(_0x5364fa){if(!_0x5364fa){_0x415deb[_0xb105('0x28')](0x194);}return _0x5364fa;};}function handleError(_0x5e47a7,_0x53ab1a){_0x53ab1a=_0x53ab1a||0x1f4;return function(_0x27c051){logger[_0xb105('0x29')](_0x27c051[_0xb105('0x2a')]);if(_0x27c051[_0xb105('0x2b')]){delete _0x27c051['name'];}_0x5e47a7[_0xb105('0x1c')](_0x53ab1a)[_0xb105('0x2c')](_0x27c051);};}function getMustacheRender(_0x5061d7,_0xcfd15){return Mustache[_0xb105('0x2d')](_0x5061d7,_[_0xb105('0x2e')](_0xcfd15['body'],{'contact':_0xcfd15[_0xb105('0x2f')],'message':_0xcfd15[_0xb105('0x30')],'agent':_0xcfd15[_0xb105('0x31')],'interaction':_0xcfd15[_0xb105('0x32')],'account':_0xcfd15['account']}))||'';}exports[_0xb105('0x33')]=function(_0x3cec34,_0x519640){var _0x334047={},_0x4cc09c={},_0x17f986={'count':0x0,'rows':[]};var _0x1ba87a=_[_0xb105('0x34')](db[_0xb105('0x35')][_0xb105('0x36')],function(_0x4610f0){return{'name':_0x4610f0[_0xb105('0x37')],'type':_0x4610f0[_0xb105('0x38')][_0xb105('0x39')]};});_0x4cc09c[_0xb105('0x3a')]=_[_0xb105('0x34')](_0x1ba87a,_0xb105('0x2b'));_0x4cc09c[_0xb105('0x3b')]=_[_0xb105('0x3c')](_0x3cec34[_0xb105('0x3b')]);_0x4cc09c[_0xb105('0x3d')]=_[_0xb105('0x3e')](_0x4cc09c[_0xb105('0x3a')],_0x4cc09c[_0xb105('0x3b')]);_0x334047[_0xb105('0x3f')]=_[_0xb105('0x3e')](_0x4cc09c['model'],qs['fields'](_0x3cec34['query'][_0xb105('0x40')]));_0x334047[_0xb105('0x3f')]=_0x334047[_0xb105('0x3f')]['length']?_0x334047['attributes']:_0x4cc09c[_0xb105('0x3a')];if(!_0x3cec34['query'][_0xb105('0x41')](_0xb105('0x42'))){_0x334047[_0xb105('0x21')]=qs['limit'](_0x3cec34[_0xb105('0x3b')][_0xb105('0x21')]);_0x334047[_0xb105('0x20')]=qs[_0xb105('0x20')](_0x3cec34[_0xb105('0x3b')]['offset']);}_0x334047[_0xb105('0x43')]=qs[_0xb105('0x44')](_0x3cec34[_0xb105('0x3b')][_0xb105('0x44')]);_0x334047[_0xb105('0x45')]=qs[_0xb105('0x3d')](_['pick'](_0x3cec34[_0xb105('0x3b')],_0x4cc09c[_0xb105('0x3d')]),_0x1ba87a);if(_0x3cec34[_0xb105('0x3b')]['filter']){_0x334047[_0xb105('0x45')]=_['merge'](_0x334047[_0xb105('0x45')],{'$or':_[_0xb105('0x34')](_0x1ba87a,function(_0x4ba1d2){if(_0x4ba1d2[_0xb105('0x38')]!==_0xb105('0x46')){var _0x27f972={};_0x27f972[_0x4ba1d2[_0xb105('0x2b')]]={'$like':'%'+_0x3cec34[_0xb105('0x3b')][_0xb105('0x47')]+'%'};return _0x27f972;}})});}_0x334047=_['merge']({},_0x334047,_0x3cec34[_0xb105('0x48')]);var _0x5df5f9={'where':_0x334047[_0xb105('0x45')]};return db[_0xb105('0x35')][_0xb105('0x1f')](_0x5df5f9)[_0xb105('0x26')](function(_0x16f6c8){_0x17f986['count']=_0x16f6c8;if(_0x3cec34[_0xb105('0x3b')][_0xb105('0x49')]){_0x334047['include']=[{'all':!![]}];}return db[_0xb105('0x35')][_0xb105('0x4a')](_0x334047);})['then'](function(_0x19e55a){_0x17f986[_0xb105('0x4b')]=_0x19e55a;return _0x17f986;})[_0xb105('0x26')](respondWithFilteredResult(_0x519640,_0x334047))['catch'](handleError(_0x519640,null));};exports[_0xb105('0x4c')]=function(_0x41d66f,_0x1b004c){var _0x5ae358={'raw':!![],'where':{'id':_0x41d66f[_0xb105('0x4d')]['id']}},_0x20607b={};_0x20607b[_0xb105('0x3a')]=_[_0xb105('0x3c')](db[_0xb105('0x35')][_0xb105('0x36')]);_0x20607b[_0xb105('0x3b')]=_[_0xb105('0x3c')](_0x41d66f[_0xb105('0x3b')]);_0x20607b['filters']=_[_0xb105('0x3e')](_0x20607b['model'],_0x20607b[_0xb105('0x3b')]);_0x5ae358[_0xb105('0x3f')]=_[_0xb105('0x3e')](_0x20607b[_0xb105('0x3a')],qs['fields'](_0x41d66f[_0xb105('0x3b')]['fields']));_0x5ae358['attributes']=_0x5ae358['attributes']['length']?_0x5ae358['attributes']:_0x20607b[_0xb105('0x3a')];if(_0x41d66f[_0xb105('0x3b')][_0xb105('0x49')]){_0x5ae358['include']=[{'all':!![]}];}_0x5ae358=_[_0xb105('0x2e')]({},_0x5ae358,_0x41d66f[_0xb105('0x48')]);return db[_0xb105('0x35')][_0xb105('0x4e')](_0x5ae358)[_0xb105('0x26')](handleEntityNotFound(_0x1b004c,null))[_0xb105('0x26')](respondWithResult(_0x1b004c,null))[_0xb105('0x4f')](handleError(_0x1b004c,null));};exports[_0xb105('0x50')]=function(_0x9560dc,_0x4329e1){return db['OpenchannelQueueReport'][_0xb105('0x50')](_0x9560dc[_0xb105('0x51')],{})[_0xb105('0x26')](respondWithResult(_0x4329e1,0xc9))[_0xb105('0x4f')](handleError(_0x4329e1,null));};exports[_0xb105('0x25')]=function(_0x1f9f4f,_0x337de9){if(_0x1f9f4f[_0xb105('0x51')]['id']){delete _0x1f9f4f['body']['id'];}return db[_0xb105('0x35')][_0xb105('0x4e')]({'where':{'id':_0x1f9f4f[_0xb105('0x4d')]['id']}})[_0xb105('0x26')](handleEntityNotFound(_0x337de9,null))[_0xb105('0x26')](saveUpdates(_0x1f9f4f[_0xb105('0x51')],null))[_0xb105('0x26')](respondWithResult(_0x337de9,null))[_0xb105('0x4f')](handleError(_0x337de9,null));};exports['destroy']=function(_0x2816ad,_0xb189b5){return db['OpenchannelQueueReport'][_0xb105('0x4e')]({'where':{'id':_0x2816ad[_0xb105('0x4d')]['id']}})[_0xb105('0x26')](handleEntityNotFound(_0xb189b5,null))[_0xb105('0x26')](removeEntity(_0xb189b5,null))[_0xb105('0x4f')](handleError(_0xb189b5,null));};exports['describe']=function(_0x505b70,_0x1a1efd){return db['OpenchannelQueueReport'][_0xb105('0x52')]()['then'](respondWithResult(_0x1a1efd,null))[_0xb105('0x4f')](handleError(_0x1a1efd,null));}; \ No newline at end of file +var _0xac8d=['findAll','rows','catch','show','params','intersection','options','create','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','destroy','then','name','send','render','merge','body','contact','message','agent','interaction','account','map','OpenchannelQueueReport','rawAttributes','fieldName','type','keys','query','model','attributes','fields','hasOwnProperty','nolimit','filters','pick','filter','where','includeAll','include'];(function(_0x3048fa,_0x21f9ee){var _0x59fc63=function(_0x4ae1a2){while(--_0x4ae1a2){_0x3048fa['push'](_0x3048fa['shift']());}};_0x59fc63(++_0x21f9ee);}(_0xac8d,0x1d8));var _0xdac8=function(_0x32a923,_0x524c14){_0x32a923=_0x32a923-0x0;var _0x11677d=_0xac8d[_0x32a923];return _0x11677d;};'use strict';var emlformat=require(_0xdac8('0x0'));var rimraf=require(_0xdac8('0x1'));var zipdir=require(_0xdac8('0x2'));var jsonpatch=require(_0xdac8('0x3'));var rp=require(_0xdac8('0x4'));var moment=require('moment');var BPromise=require(_0xdac8('0x5'));var Mustache=require('mustache');var util=require(_0xdac8('0x6'));var path=require(_0xdac8('0x7'));var sox=require(_0xdac8('0x8'));var csv=require(_0xdac8('0x9'));var ejs=require(_0xdac8('0xa'));var fs=require('fs');var fs_extra=require(_0xdac8('0xb'));var _=require(_0xdac8('0xc'));var squel=require(_0xdac8('0xd'));var crypto=require(_0xdac8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdac8('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdac8('0x10'));var Papa=require(_0xdac8('0x11'));var Redis=require('ioredis');var authService=require(_0xdac8('0x12'));var qs=require(_0xdac8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdac8('0x14'));var logger=require(_0xdac8('0x15'))('api');var utils=require(_0xdac8('0x16'));var config=require(_0xdac8('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x140c24,_0x2b187c){_0x2b187c=_0x2b187c||0xcc;return function(_0x272916){if(_0x272916){return _0x140c24[_0xdac8('0x18')](_0x2b187c);}return _0x140c24[_0xdac8('0x19')](_0x2b187c)[_0xdac8('0x1a')]();};}function respondWithResult(_0x563795,_0x5cca12){_0x5cca12=_0x5cca12||0xc8;return function(_0x1cbff3){if(_0x1cbff3){return _0x563795[_0xdac8('0x19')](_0x5cca12)[_0xdac8('0x1b')](_0x1cbff3);}};}function respondWithFilteredResult(_0x1b25d8,_0x49481a){return function(_0x3d4920){if(_0x3d4920){var _0x1de867=typeof _0x49481a['offset']==='undefined'&&typeof _0x49481a[_0xdac8('0x1c')]===_0xdac8('0x1d');var _0x44b5e9=_0x3d4920[_0xdac8('0x1e')];var _0x26a7f0=_0x1de867?0x0:_0x49481a[_0xdac8('0x1f')];var _0x315601=_0x1de867?_0x3d4920['count']:_0x49481a['offset']+_0x49481a[_0xdac8('0x1c')];var _0x50e9ed;if(_0x315601>=_0x44b5e9){_0x315601=_0x44b5e9;_0x50e9ed=0xc8;}else{_0x50e9ed=0xce;}_0x1b25d8[_0xdac8('0x19')](_0x50e9ed);return _0x1b25d8[_0xdac8('0x20')](_0xdac8('0x21'),_0x26a7f0+'-'+_0x315601+'/'+_0x44b5e9)[_0xdac8('0x1b')](_0x3d4920);}return null;};}function patchUpdates(_0x26b30f){return function(_0x3839a8){try{jsonpatch[_0xdac8('0x22')](_0x3839a8,_0x26b30f,!![]);}catch(_0x1e101e){return BPromise[_0xdac8('0x23')](_0x1e101e);}return _0x3839a8['save']();};}function saveUpdates(_0xd37405,_0x24b189){return function(_0xee1a32){if(_0xee1a32){return _0xee1a32[_0xdac8('0x24')](_0xd37405)['then'](function(_0x52da68){return _0x52da68;});}return null;};}function removeEntity(_0x143b79,_0x38525c){return function(_0x111ec3){if(_0x111ec3){return _0x111ec3[_0xdac8('0x25')]()[_0xdac8('0x26')](function(){_0x143b79['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x181842,_0x1dbe67){return function(_0x495900){if(!_0x495900){_0x181842['sendStatus'](0x194);}return _0x495900;};}function handleError(_0x3aeedf,_0xd21a47){_0xd21a47=_0xd21a47||0x1f4;return function(_0x470985){logger['error'](_0x470985['stack']);if(_0x470985[_0xdac8('0x27')]){delete _0x470985[_0xdac8('0x27')];}_0x3aeedf[_0xdac8('0x19')](_0xd21a47)[_0xdac8('0x28')](_0x470985);};}function getMustacheRender(_0x304b6c,_0x5d30f3){return Mustache[_0xdac8('0x29')](_0x304b6c,_[_0xdac8('0x2a')](_0x5d30f3[_0xdac8('0x2b')],{'contact':_0x5d30f3[_0xdac8('0x2c')],'message':_0x5d30f3[_0xdac8('0x2d')],'agent':_0x5d30f3[_0xdac8('0x2e')],'interaction':_0x5d30f3[_0xdac8('0x2f')],'account':_0x5d30f3[_0xdac8('0x30')]}))||'';}exports['index']=function(_0x17d023,_0x3bda2a){var _0x19f064={},_0x76625b={},_0x4b19cf={'count':0x0,'rows':[]};var _0x5eddbd=_[_0xdac8('0x31')](db[_0xdac8('0x32')][_0xdac8('0x33')],function(_0x38b2e6){return{'name':_0x38b2e6[_0xdac8('0x34')],'type':_0x38b2e6[_0xdac8('0x35')]['key']};});_0x76625b['model']=_[_0xdac8('0x31')](_0x5eddbd,_0xdac8('0x27'));_0x76625b['query']=_[_0xdac8('0x36')](_0x17d023[_0xdac8('0x37')]);_0x76625b['filters']=_['intersection'](_0x76625b[_0xdac8('0x38')],_0x76625b['query']);_0x19f064[_0xdac8('0x39')]=_['intersection'](_0x76625b[_0xdac8('0x38')],qs[_0xdac8('0x3a')](_0x17d023['query'][_0xdac8('0x3a')]));_0x19f064[_0xdac8('0x39')]=_0x19f064[_0xdac8('0x39')]['length']?_0x19f064['attributes']:_0x76625b[_0xdac8('0x38')];if(!_0x17d023['query'][_0xdac8('0x3b')](_0xdac8('0x3c'))){_0x19f064[_0xdac8('0x1c')]=qs[_0xdac8('0x1c')](_0x17d023['query']['limit']);_0x19f064[_0xdac8('0x1f')]=qs[_0xdac8('0x1f')](_0x17d023[_0xdac8('0x37')]['offset']);}_0x19f064['order']=qs['sort'](_0x17d023[_0xdac8('0x37')]['sort']);_0x19f064['where']=qs[_0xdac8('0x3d')](_[_0xdac8('0x3e')](_0x17d023[_0xdac8('0x37')],_0x76625b[_0xdac8('0x3d')]),_0x5eddbd);if(_0x17d023['query'][_0xdac8('0x3f')]){_0x19f064['where']=_[_0xdac8('0x2a')](_0x19f064['where'],{'$or':_[_0xdac8('0x31')](_0x5eddbd,function(_0xc5c7ac){if(_0xc5c7ac[_0xdac8('0x35')]!=='VIRTUAL'){var _0x19412c={};_0x19412c[_0xc5c7ac[_0xdac8('0x27')]]={'$like':'%'+_0x17d023[_0xdac8('0x37')][_0xdac8('0x3f')]+'%'};return _0x19412c;}})});}_0x19f064=_[_0xdac8('0x2a')]({},_0x19f064,_0x17d023['options']);var _0x31f7bd={'where':_0x19f064[_0xdac8('0x40')]};return db[_0xdac8('0x32')][_0xdac8('0x1e')](_0x31f7bd)[_0xdac8('0x26')](function(_0x349c69){_0x4b19cf[_0xdac8('0x1e')]=_0x349c69;if(_0x17d023[_0xdac8('0x37')][_0xdac8('0x41')]){_0x19f064[_0xdac8('0x42')]=[{'all':!![]}];}return db[_0xdac8('0x32')][_0xdac8('0x43')](_0x19f064);})[_0xdac8('0x26')](function(_0x1535a0){_0x4b19cf[_0xdac8('0x44')]=_0x1535a0;return _0x4b19cf;})['then'](respondWithFilteredResult(_0x3bda2a,_0x19f064))[_0xdac8('0x45')](handleError(_0x3bda2a,null));};exports[_0xdac8('0x46')]=function(_0x23bf1a,_0x495d28){var _0x5283a0={'raw':!![],'where':{'id':_0x23bf1a[_0xdac8('0x47')]['id']}},_0x15c137={};_0x15c137['model']=_[_0xdac8('0x36')](db[_0xdac8('0x32')][_0xdac8('0x33')]);_0x15c137[_0xdac8('0x37')]=_[_0xdac8('0x36')](_0x23bf1a[_0xdac8('0x37')]);_0x15c137['filters']=_[_0xdac8('0x48')](_0x15c137[_0xdac8('0x38')],_0x15c137[_0xdac8('0x37')]);_0x5283a0[_0xdac8('0x39')]=_[_0xdac8('0x48')](_0x15c137[_0xdac8('0x38')],qs[_0xdac8('0x3a')](_0x23bf1a[_0xdac8('0x37')]['fields']));_0x5283a0[_0xdac8('0x39')]=_0x5283a0[_0xdac8('0x39')]['length']?_0x5283a0[_0xdac8('0x39')]:_0x15c137['model'];if(_0x23bf1a['query'][_0xdac8('0x41')]){_0x5283a0[_0xdac8('0x42')]=[{'all':!![]}];}_0x5283a0=_[_0xdac8('0x2a')]({},_0x5283a0,_0x23bf1a[_0xdac8('0x49')]);return db['OpenchannelQueueReport']['find'](_0x5283a0)[_0xdac8('0x26')](handleEntityNotFound(_0x495d28,null))[_0xdac8('0x26')](respondWithResult(_0x495d28,null))[_0xdac8('0x45')](handleError(_0x495d28,null));};exports[_0xdac8('0x4a')]=function(_0x459273,_0x4d2165){return db[_0xdac8('0x32')][_0xdac8('0x4a')](_0x459273['body'],{})[_0xdac8('0x26')](respondWithResult(_0x4d2165,0xc9))[_0xdac8('0x45')](handleError(_0x4d2165,null));};exports['update']=function(_0x40ca73,_0x3de0dc){if(_0x40ca73['body']['id']){delete _0x40ca73['body']['id'];}return db['OpenchannelQueueReport'][_0xdac8('0x4b')]({'where':{'id':_0x40ca73[_0xdac8('0x47')]['id']}})['then'](handleEntityNotFound(_0x3de0dc,null))[_0xdac8('0x26')](saveUpdates(_0x40ca73[_0xdac8('0x2b')],null))['then'](respondWithResult(_0x3de0dc,null))[_0xdac8('0x45')](handleError(_0x3de0dc,null));};exports[_0xdac8('0x25')]=function(_0x3208d4,_0x4784a7){return db['OpenchannelQueueReport'][_0xdac8('0x4b')]({'where':{'id':_0x3208d4[_0xdac8('0x47')]['id']}})[_0xdac8('0x26')](handleEntityNotFound(_0x4784a7,null))['then'](removeEntity(_0x4784a7,null))[_0xdac8('0x45')](handleError(_0x4784a7,null));};exports[_0xdac8('0x4c')]=function(_0x5c3568,_0x31c7c9){return db[_0xdac8('0x32')][_0xdac8('0x4c')]()[_0xdac8('0x26')](respondWithResult(_0x31c7c9,null))[_0xdac8('0x45')](handleError(_0x31c7c9,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 294699e..05787f5 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 _0x8135=['moment','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','util','../../config/logger','api'];(function(_0x3a6dda,_0x350fe5){var _0x5b55f3=function(_0x4c7d80){while(--_0x4c7d80){_0x3a6dda['push'](_0x3a6dda['shift']());}};_0x5b55f3(++_0x350fe5);}(_0x8135,0x99));var _0x5813=function(_0x4e02ab,_0x2882fe){_0x4e02ab=_0x4e02ab-0x0;var _0x56bef8=_0x8135[_0x4e02ab];return _0x56bef8;};'use strict';var _=require('lodash');var util=require(_0x5813('0x0'));var logger=require(_0x5813('0x1'))(_0x5813('0x2'));var moment=require(_0x5813('0x3'));var BPromise=require('bluebird');var rp=require(_0x5813('0x4'));var fs=require('fs');var path=require(_0x5813('0x5'));var rimraf=require(_0x5813('0x6'));var config=require(_0x5813('0x7'));var attributes=require(_0x5813('0x8'));module['exports']=function(_0x57ac38,_0x27599d){return _0x57ac38[_0x5813('0x9')](_0x5813('0xa'),attributes,{'tableName':_0x5813('0xb'),'paranoid':![],'indexes':[{'name':_0x5813('0xc'),'fields':[_0x5813('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd737=['OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','define'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_0xd737,0x85));var _0x7d73=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0xd737[_0x2bf466];return _0x856885;};'use strict';var _=require(_0x7d73('0x0'));var util=require('util');var logger=require(_0x7d73('0x1'))('api');var moment=require(_0x7d73('0x2'));var BPromise=require(_0x7d73('0x3'));var rp=require(_0x7d73('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7d73('0x5'));var attributes=require('./openchannelQueueReport.attributes');module['exports']=function(_0xaa37cc,_0x20b8a9){return _0xaa37cc[_0x7d73('0x6')](_0x7d73('0x7'),attributes,{'tableName':_0x7d73('0x8'),'paranoid':![],'indexes':[{'name':_0x7d73('0x9'),'fields':[_0x7d73('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index d0236f7..6a4a52d 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 _0x79e7=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','body','options','raw','CreateOpenchannelQueueReport','OpenchannelQueueReport','update','attributes','limit','UpdateOpenchannelQueueReport','lodash','util'];(function(_0x1dc747,_0x2864ae){var _0x5c517b=function(_0x2aa04f){while(--_0x2aa04f){_0x1dc747['push'](_0x1dc747['shift']());}};_0x5c517b(++_0x2864ae);}(_0x79e7,0x8a));var _0x779e=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x79e7[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x779e('0x0'));var util=require(_0x779e('0x1'));var moment=require('moment');var BPromise=require(_0x779e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x779e('0x3'));var db=require(_0x779e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x779e('0x5'))(_0x779e('0x6'));var config=require('../../config/environment');var jayson=require(_0x779e('0x7'));var client=jayson['client'][_0x779e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x184772,_0x5c42e4,_0xd5389d){return new BPromise(function(_0x382fb0,_0x239e0c){return client['request'](_0x184772,_0xd5389d)[_0x779e('0x9')](function(_0x375515){logger[_0x779e('0xa')](_0x779e('0xb'),_0x5c42e4,_0x779e('0xc'));logger[_0x779e('0xd')](_0x779e('0xe'),_0x5c42e4,'request\x20sent',JSON[_0x779e('0xf')](_0x375515));if(_0x375515[_0x779e('0x10')]){if(_0x375515[_0x779e('0x10')]['code']===0x1f4){logger['error'](_0x779e('0xb'),_0x5c42e4,_0x375515['error'][_0x779e('0x11')]);return _0x239e0c(_0x375515['error'][_0x779e('0x11')]);}logger[_0x779e('0x10')](_0x779e('0xb'),_0x5c42e4,_0x375515[_0x779e('0x10')]['message']);return _0x382fb0(_0x375515['error'][_0x779e('0x11')]);}else{logger['info'](_0x779e('0xb'),_0x5c42e4,'request\x20sent');_0x382fb0(_0x375515['result']['message']);}})[_0x779e('0x12')](function(_0x8e84d0){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x5c42e4,_0x8e84d0);_0x239e0c(_0x8e84d0);});});}exports['CreateOpenchannelQueueReport']=function(_0x4d24ad){var _0x8aa010=this;return new Promise(function(_0x18834e,_0x25038a){return db['OpenchannelQueueReport']['create'](_0x4d24ad[_0x779e('0x13')],{'raw':_0x4d24ad['options']?_0x4d24ad[_0x779e('0x14')][_0x779e('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x1510c6){logger[_0x779e('0xa')](_0x779e('0x16'),_0x4d24ad);logger[_0x779e('0xd')](_0x779e('0x16'),_0x4d24ad,JSON[_0x779e('0xf')](_0x1510c6));_0x18834e(_0x1510c6);})[_0x779e('0x12')](function(_0x317aad){logger[_0x779e('0x10')](_0x779e('0x16'),_0x317aad[_0x779e('0x11')],_0x4d24ad);_0x25038a(_0x8aa010[_0x779e('0x10')](0x1f4,_0x317aad['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x26c66a){var _0x29a99d=this;return new Promise(function(_0x2cecd8,_0x3b8d4b){return db[_0x779e('0x17')][_0x779e('0x18')](_0x26c66a[_0x779e('0x13')],{'raw':_0x26c66a['options']?_0x26c66a['options'][_0x779e('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26c66a[_0x779e('0x14')]?_0x26c66a[_0x779e('0x14')]['where']||null:null,'attributes':_0x26c66a[_0x779e('0x14')]?_0x26c66a[_0x779e('0x14')][_0x779e('0x19')]||null:null,'limit':_0x26c66a['options']?_0x26c66a[_0x779e('0x14')][_0x779e('0x1a')]||null:null})[_0x779e('0x9')](function(_0x3c2860){logger[_0x779e('0xa')]('UpdateOpenchannelQueueReport',_0x26c66a);logger['debug'](_0x779e('0x1b'),_0x26c66a,JSON['stringify'](_0x3c2860));_0x2cecd8(_0x3c2860);})[_0x779e('0x12')](function(_0x38fb57){logger[_0x779e('0x10')](_0x779e('0x1b'),_0x38fb57[_0x779e('0x11')],_0x26c66a);_0x3b8d4b(_0x29a99d[_0x779e('0x10')](0x1f4,_0x38fb57[_0x779e('0x11')]));});});}; \ No newline at end of file +var _0x257e=['OpenchannelQueueReport,\x20%s,\x20%s','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','then','stringify','catch','attributes','UpdateOpenchannelQueueReport','debug','util','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','info','request\x20sent','error','code'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x257e,0x176));var _0xe257=function(_0x29e2af,_0x15e2b1){_0x29e2af=_0x29e2af-0x0;var _0x1ea06a=_0x257e[_0x29e2af];return _0x1ea06a;};'use strict';var _=require('lodash');var util=require(_0xe257('0x0'));var moment=require('moment');var BPromise=require(_0xe257('0x1'));var rs=require(_0xe257('0x2'));var fs=require('fs');var Redis=require(_0xe257('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe257('0x4'));var jayson=require(_0xe257('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b956b,_0x2de335,_0x4b9947){return new BPromise(function(_0x492af5,_0x371d20){return client['request'](_0x2b956b,_0x4b9947)['then'](function(_0xbfb2a){logger[_0xe257('0x6')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2de335,_0xe257('0x7'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x2de335,'request\x20sent',JSON['stringify'](_0xbfb2a));if(_0xbfb2a[_0xe257('0x8')]){if(_0xbfb2a[_0xe257('0x8')][_0xe257('0x9')]===0x1f4){logger[_0xe257('0x8')](_0xe257('0xa'),_0x2de335,_0xbfb2a[_0xe257('0x8')]['message']);return _0x371d20(_0xbfb2a[_0xe257('0x8')][_0xe257('0xb')]);}logger['error'](_0xe257('0xa'),_0x2de335,_0xbfb2a[_0xe257('0x8')][_0xe257('0xb')]);return _0x492af5(_0xbfb2a[_0xe257('0x8')]['message']);}else{logger['info'](_0xe257('0xa'),_0x2de335,_0xe257('0x7'));_0x492af5(_0xbfb2a[_0xe257('0xc')]['message']);}})['catch'](function(_0x34e06d){logger[_0xe257('0x8')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2de335,_0x34e06d);_0x371d20(_0x34e06d);});});}exports[_0xe257('0xd')]=function(_0x2bc403){var _0x453bb2=this;return new Promise(function(_0x55d779,_0x3f4dc0){return db[_0xe257('0xe')]['create'](_0x2bc403[_0xe257('0xf')],{'raw':_0x2bc403['options']?_0x2bc403[_0xe257('0x10')][_0xe257('0x11')]===undefined?!![]:![]:!![]})[_0xe257('0x12')](function(_0xf532b9){logger['info']('CreateOpenchannelQueueReport',_0x2bc403);logger['debug']('CreateOpenchannelQueueReport',_0x2bc403,JSON[_0xe257('0x13')](_0xf532b9));_0x55d779(_0xf532b9);})[_0xe257('0x14')](function(_0x4de427){logger['error']('CreateOpenchannelQueueReport',_0x4de427[_0xe257('0xb')],_0x2bc403);_0x3f4dc0(_0x453bb2['error'](0x1f4,_0x4de427[_0xe257('0xb')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x5c6d69){var _0x35e060=this;return new Promise(function(_0x2039d2,_0x2f1351){return db[_0xe257('0xe')]['update'](_0x5c6d69[_0xe257('0xf')],{'raw':_0x5c6d69[_0xe257('0x10')]?_0x5c6d69[_0xe257('0x10')][_0xe257('0x11')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c6d69[_0xe257('0x10')]?_0x5c6d69[_0xe257('0x10')]['where']||null:null,'attributes':_0x5c6d69[_0xe257('0x10')]?_0x5c6d69['options'][_0xe257('0x15')]||null:null,'limit':_0x5c6d69[_0xe257('0x10')]?_0x5c6d69[_0xe257('0x10')]['limit']||null:null})[_0xe257('0x12')](function(_0x30dc9f){logger[_0xe257('0x6')](_0xe257('0x16'),_0x5c6d69);logger[_0xe257('0x17')](_0xe257('0x16'),_0x5c6d69,JSON[_0xe257('0x13')](_0x30dc9f));_0x2039d2(_0x30dc9f);})[_0xe257('0x14')](function(_0x5abc41){logger[_0xe257('0x8')](_0xe257('0x16'),_0x5abc41[_0xe257('0xb')],_0x5c6d69);_0x2f1351(_0x35e060['error'](0x1f4,_0x5abc41[_0xe257('0xb')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index b287137..881735b 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 _0xf6d2=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy'];(function(_0x5525d1,_0xf5a77){var _0x40f535=function(_0x2e6f41){while(--_0x2e6f41){_0x5525d1['push'](_0x5525d1['shift']());}};_0x40f535(++_0xf5a77);}(_0xf6d2,0x17b));var _0x2f6d=function(_0x218ef3,_0x3f0dd3){_0x218ef3=_0x218ef3-0x0;var _0x5304f8=_0xf6d2[_0x218ef3];return _0x5304f8;};'use strict';var multer=require('multer');var util=require(_0x2f6d('0x0'));var path=require(_0x2f6d('0x1'));var timeout=require(_0x2f6d('0x2'));var express=require('express');var router=express[_0x2f6d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2f6d('0x4'));var interaction=require(_0x2f6d('0x5'));var config=require(_0x2f6d('0x6'));var controller=require(_0x2f6d('0x7'));router[_0x2f6d('0x8')]('/',auth[_0x2f6d('0x9')](),controller[_0x2f6d('0xa')]);router[_0x2f6d('0x8')](_0x2f6d('0xb'),auth[_0x2f6d('0x9')](),controller[_0x2f6d('0xc')]);router[_0x2f6d('0x8')](_0x2f6d('0xd'),auth[_0x2f6d('0x9')](),controller[_0x2f6d('0xe')]);router[_0x2f6d('0xf')]('/',auth[_0x2f6d('0x9')](),controller['create']);router[_0x2f6d('0x10')]('/:id',auth[_0x2f6d('0x9')](),controller[_0x2f6d('0x11')]);router[_0x2f6d('0x12')](_0x2f6d('0xd'),auth['isAuthenticated'](),controller[_0x2f6d('0x13')]);module[_0x2f6d('0x14')]=router; \ No newline at end of file +var _0x7adf=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller'];(function(_0x45f945,_0x2c5a50){var _0x2866b8=function(_0xdd0398){while(--_0xdd0398){_0x45f945['push'](_0x45f945['shift']());}};_0x2866b8(++_0x2c5a50);}(_0x7adf,0x114));var _0xf7ad=function(_0x378ea7,_0x2a6c7b){_0x378ea7=_0x378ea7-0x0;var _0x4f195d=_0x7adf[_0x378ea7];return _0x4f195d;};'use strict';var multer=require(_0xf7ad('0x0'));var util=require(_0xf7ad('0x1'));var path=require(_0xf7ad('0x2'));var timeout=require(_0xf7ad('0x3'));var express=require(_0xf7ad('0x4'));var router=express[_0xf7ad('0x5')]();var fs_extra=require(_0xf7ad('0x6'));var auth=require(_0xf7ad('0x7'));var interaction=require(_0xf7ad('0x8'));var config=require('../../config/environment');var controller=require(_0xf7ad('0x9'));router[_0xf7ad('0xa')]('/',auth[_0xf7ad('0xb')](),controller[_0xf7ad('0xc')]);router[_0xf7ad('0xa')]('/describe',auth[_0xf7ad('0xb')](),controller['describe']);router[_0xf7ad('0xa')](_0xf7ad('0xd'),auth[_0xf7ad('0xb')](),controller[_0xf7ad('0xe')]);router[_0xf7ad('0xf')]('/',auth['isAuthenticated'](),controller[_0xf7ad('0x10')]);router[_0xf7ad('0x11')](_0xf7ad('0xd'),auth[_0xf7ad('0xb')](),controller[_0xf7ad('0x12')]);router[_0xf7ad('0x13')](_0xf7ad('0xd'),auth[_0xf7ad('0xb')](),controller[_0xf7ad('0x14')]);module[_0xf7ad('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index b015a33..74d517e 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 _0xb669=['sequelize','STRING','ENUM','agent','queue','DATE','NOW','moment'];(function(_0x25c0a5,_0x20ae8e){var _0x2aef17=function(_0x4f1157){while(--_0x4f1157){_0x25c0a5['push'](_0x25c0a5['shift']());}};_0x2aef17(++_0x20ae8e);}(_0xb669,0x19f));var _0x9b66=function(_0x22dd2b,_0x3b116a){_0x22dd2b=_0x22dd2b-0x0;var _0x2c816c=_0xb669[_0x22dd2b];return _0x2c816c;};'use strict';var moment=require(_0x9b66('0x0'));var Sequelize=require(_0x9b66('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x9b66('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9b66('0x3')]('account',_0x9b66('0x4'),_0x9b66('0x5')),'allowNull':![],'defaultValue':_0x9b66('0x5')},'transferredAt':{'type':Sequelize[_0x9b66('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x9b66('0x7')]}}; \ No newline at end of file +var _0xe06b=['STRING','ENUM','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x482471,_0x1934f8){var _0x55625c=function(_0x3251d0){while(--_0x3251d0){_0x482471['push'](_0x482471['shift']());}};_0x55625c(++_0x1934f8);}(_0xe06b,0x1be));var _0xbe06=function(_0x5abe95,_0x4fcfec){_0x5abe95=_0x5abe95-0x0;var _0x4b995e=_0xe06b[_0x5abe95];return _0x4b995e;};'use strict';var moment=require(_0xbe06('0x0'));var Sequelize=require(_0xbe06('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbe06('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbe06('0x3')]('account',_0xbe06('0x4'),_0xbe06('0x5')),'allowNull':![],'defaultValue':_0xbe06('0x5')},'transferredAt':{'type':Sequelize[_0xbe06('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbe06('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 0c21002..021b52c 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 _0x969c=['body','contact','message','interaction','account','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','VIRTUAL','include','rows','show','params','length','includeAll','find','catch','create','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','destroy','then','error','stack','name','send','render','merge'];(function(_0x316231,_0xd781e6){var _0x207ec1=function(_0x20dfbc){while(--_0x20dfbc){_0x316231['push'](_0x316231['shift']());}};_0x207ec1(++_0xd781e6);}(_0x969c,0x1e3));var _0xc969=function(_0x350958,_0x175edc){_0x350958=_0x350958-0x0;var _0x2319cb=_0x969c[_0x350958];return _0x2319cb;};'use strict';var emlformat=require(_0xc969('0x0'));var rimraf=require(_0xc969('0x1'));var zipdir=require(_0xc969('0x2'));var jsonpatch=require(_0xc969('0x3'));var rp=require(_0xc969('0x4'));var moment=require('moment');var BPromise=require(_0xc969('0x5'));var Mustache=require('mustache');var util=require(_0xc969('0x6'));var path=require(_0xc969('0x7'));var sox=require(_0xc969('0x8'));var csv=require('to-csv');var ejs=require(_0xc969('0x9'));var fs=require('fs');var fs_extra=require(_0xc969('0xa'));var _=require(_0xc969('0xb'));var squel=require(_0xc969('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc969('0xd'));var querystring=require(_0xc969('0xe'));var Papa=require('papaparse');var Redis=require(_0xc969('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc969('0x10'));var as=require(_0xc969('0x11'));var hardwareService=require(_0xc969('0x12'));var logger=require(_0xc969('0x13'))(_0xc969('0x14'));var utils=require(_0xc969('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc969('0x16'));var db=require(_0xc969('0x17'))['db'];function respondWithStatusCode(_0x4c8c3c,_0x5b2127){_0x5b2127=_0x5b2127||0xcc;return function(_0x377c60){if(_0x377c60){return _0x4c8c3c[_0xc969('0x18')](_0x5b2127);}return _0x4c8c3c[_0xc969('0x19')](_0x5b2127)[_0xc969('0x1a')]();};}function respondWithResult(_0x564174,_0x1322e8){_0x1322e8=_0x1322e8||0xc8;return function(_0x4ec420){if(_0x4ec420){return _0x564174[_0xc969('0x19')](_0x1322e8)[_0xc969('0x1b')](_0x4ec420);}};}function respondWithFilteredResult(_0x346d4c,_0x1a603f){return function(_0x5cc37f){if(_0x5cc37f){var _0x5ea37b=typeof _0x1a603f[_0xc969('0x1c')]===_0xc969('0x1d')&&typeof _0x1a603f[_0xc969('0x1e')]===_0xc969('0x1d');var _0x21ddfc=_0x5cc37f[_0xc969('0x1f')];var _0x3d8a46=_0x5ea37b?0x0:_0x1a603f[_0xc969('0x1c')];var _0x154d4c=_0x5ea37b?_0x5cc37f['count']:_0x1a603f[_0xc969('0x1c')]+_0x1a603f[_0xc969('0x1e')];var _0x426698;if(_0x154d4c>=_0x21ddfc){_0x154d4c=_0x21ddfc;_0x426698=0xc8;}else{_0x426698=0xce;}_0x346d4c['status'](_0x426698);return _0x346d4c['set']('Content-Range',_0x3d8a46+'-'+_0x154d4c+'/'+_0x21ddfc)[_0xc969('0x1b')](_0x5cc37f);}return null;};}function patchUpdates(_0x396a16){return function(_0x1ae892){try{jsonpatch[_0xc969('0x20')](_0x1ae892,_0x396a16,!![]);}catch(_0x354676){return BPromise['reject'](_0x354676);}return _0x1ae892[_0xc969('0x21')]();};}function saveUpdates(_0x1b629e,_0x5b16af){return function(_0x317bb9){if(_0x317bb9){return _0x317bb9['update'](_0x1b629e)['then'](function(_0x20ddba){return _0x20ddba;});}return null;};}function removeEntity(_0x12fdcf,_0x288a2e){return function(_0x56b072){if(_0x56b072){return _0x56b072[_0xc969('0x22')]()[_0xc969('0x23')](function(){_0x12fdcf[_0xc969('0x19')](0xcc)[_0xc969('0x1a')]();});}};}function handleEntityNotFound(_0x5553d,_0x36ba70){return function(_0x45d2fe){if(!_0x45d2fe){_0x5553d[_0xc969('0x18')](0x194);}return _0x45d2fe;};}function handleError(_0x56697a,_0x1f9e73){_0x1f9e73=_0x1f9e73||0x1f4;return function(_0x556d0e){logger[_0xc969('0x24')](_0x556d0e[_0xc969('0x25')]);if(_0x556d0e[_0xc969('0x26')]){delete _0x556d0e[_0xc969('0x26')];}_0x56697a['status'](_0x1f9e73)[_0xc969('0x27')](_0x556d0e);};}function getMustacheRender(_0x10a588,_0x4b7e72){return Mustache[_0xc969('0x28')](_0x10a588,_[_0xc969('0x29')](_0x4b7e72[_0xc969('0x2a')],{'contact':_0x4b7e72[_0xc969('0x2b')],'message':_0x4b7e72[_0xc969('0x2c')],'agent':_0x4b7e72['agent'],'interaction':_0x4b7e72[_0xc969('0x2d')],'account':_0x4b7e72[_0xc969('0x2e')]}))||'';}exports['index']=function(_0x55bac2,_0x4697e4){var _0x360139={},_0x3ee1e3={},_0x343070={'count':0x0,'rows':[]};var _0x34ec7d=_[_0xc969('0x2f')](db[_0xc969('0x30')][_0xc969('0x31')],function(_0xbed66){return{'name':_0xbed66[_0xc969('0x32')],'type':_0xbed66[_0xc969('0x33')]['key']};});_0x3ee1e3[_0xc969('0x34')]=_[_0xc969('0x2f')](_0x34ec7d,_0xc969('0x26'));_0x3ee1e3[_0xc969('0x35')]=_[_0xc969('0x36')](_0x55bac2[_0xc969('0x35')]);_0x3ee1e3[_0xc969('0x37')]=_['intersection'](_0x3ee1e3[_0xc969('0x34')],_0x3ee1e3[_0xc969('0x35')]);_0x360139[_0xc969('0x38')]=_[_0xc969('0x39')](_0x3ee1e3[_0xc969('0x34')],qs[_0xc969('0x3a')](_0x55bac2[_0xc969('0x35')][_0xc969('0x3a')]));_0x360139[_0xc969('0x38')]=_0x360139[_0xc969('0x38')]['length']?_0x360139['attributes']:_0x3ee1e3[_0xc969('0x34')];if(!_0x55bac2['query']['hasOwnProperty'](_0xc969('0x3b'))){_0x360139['limit']=qs[_0xc969('0x1e')](_0x55bac2[_0xc969('0x35')][_0xc969('0x1e')]);_0x360139[_0xc969('0x1c')]=qs['offset'](_0x55bac2['query']['offset']);}_0x360139[_0xc969('0x3c')]=qs[_0xc969('0x3d')](_0x55bac2['query'][_0xc969('0x3d')]);_0x360139[_0xc969('0x3e')]=qs['filters'](_['pick'](_0x55bac2[_0xc969('0x35')],_0x3ee1e3[_0xc969('0x37')]),_0x34ec7d);if(_0x55bac2[_0xc969('0x35')]['filter']){_0x360139[_0xc969('0x3e')]=_['merge'](_0x360139[_0xc969('0x3e')],{'$or':_['map'](_0x34ec7d,function(_0x118af1){if(_0x118af1[_0xc969('0x33')]!==_0xc969('0x3f')){var _0x3b4573={};_0x3b4573[_0x118af1[_0xc969('0x26')]]={'$like':'%'+_0x55bac2[_0xc969('0x35')]['filter']+'%'};return _0x3b4573;}})});}_0x360139=_[_0xc969('0x29')]({},_0x360139,_0x55bac2['options']);var _0x3cb3db={'where':_0x360139[_0xc969('0x3e')]};return db[_0xc969('0x30')][_0xc969('0x1f')](_0x3cb3db)[_0xc969('0x23')](function(_0x5bab0e){_0x343070[_0xc969('0x1f')]=_0x5bab0e;if(_0x55bac2[_0xc969('0x35')]['includeAll']){_0x360139[_0xc969('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x360139);})[_0xc969('0x23')](function(_0x4b4676){_0x343070[_0xc969('0x41')]=_0x4b4676;return _0x343070;})['then'](respondWithFilteredResult(_0x4697e4,_0x360139))['catch'](handleError(_0x4697e4,null));};exports[_0xc969('0x42')]=function(_0x4f463c,_0x447786){var _0x1c76ae={'raw':!![],'where':{'id':_0x4f463c[_0xc969('0x43')]['id']}},_0x50257a={};_0x50257a[_0xc969('0x34')]=_['keys'](db[_0xc969('0x30')][_0xc969('0x31')]);_0x50257a[_0xc969('0x35')]=_[_0xc969('0x36')](_0x4f463c[_0xc969('0x35')]);_0x50257a['filters']=_[_0xc969('0x39')](_0x50257a[_0xc969('0x34')],_0x50257a[_0xc969('0x35')]);_0x1c76ae['attributes']=_['intersection'](_0x50257a[_0xc969('0x34')],qs[_0xc969('0x3a')](_0x4f463c[_0xc969('0x35')][_0xc969('0x3a')]));_0x1c76ae[_0xc969('0x38')]=_0x1c76ae[_0xc969('0x38')][_0xc969('0x44')]?_0x1c76ae['attributes']:_0x50257a[_0xc969('0x34')];if(_0x4f463c['query'][_0xc969('0x45')]){_0x1c76ae[_0xc969('0x40')]=[{'all':!![]}];}_0x1c76ae=_[_0xc969('0x29')]({},_0x1c76ae,_0x4f463c['options']);return db['OpenchannelTransferReport'][_0xc969('0x46')](_0x1c76ae)[_0xc969('0x23')](handleEntityNotFound(_0x447786,null))['then'](respondWithResult(_0x447786,null))[_0xc969('0x47')](handleError(_0x447786,null));};exports[_0xc969('0x48')]=function(_0x24a631,_0x34acfb){return db[_0xc969('0x30')][_0xc969('0x48')](_0x24a631[_0xc969('0x2a')],{})[_0xc969('0x23')](respondWithResult(_0x34acfb,0xc9))['catch'](handleError(_0x34acfb,null));};exports[_0xc969('0x49')]=function(_0x3749d3,_0x57707f){if(_0x3749d3[_0xc969('0x2a')]['id']){delete _0x3749d3[_0xc969('0x2a')]['id'];}return db[_0xc969('0x30')][_0xc969('0x46')]({'where':{'id':_0x3749d3[_0xc969('0x43')]['id']}})[_0xc969('0x23')](handleEntityNotFound(_0x57707f,null))[_0xc969('0x23')](saveUpdates(_0x3749d3[_0xc969('0x2a')],null))[_0xc969('0x23')](respondWithResult(_0x57707f,null))[_0xc969('0x47')](handleError(_0x57707f,null));};exports[_0xc969('0x22')]=function(_0x41a184,_0x458465){return db['OpenchannelTransferReport'][_0xc969('0x46')]({'where':{'id':_0x41a184[_0xc969('0x43')]['id']}})['then'](handleEntityNotFound(_0x458465,null))[_0xc969('0x23')](removeEntity(_0x458465,null))[_0xc969('0x47')](handleError(_0x458465,null));};exports[_0xc969('0x4a')]=function(_0x133f50,_0x3cd2f6){return db['OpenchannelTransferReport'][_0xc969('0x4a')]()['then'](respondWithResult(_0x3cd2f6,null))['catch'](handleError(_0x3cd2f6,null));}; \ No newline at end of file +var _0x7174=['fields','attributes','length','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','create','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','stack','name','render','merge','body','contact','message','interaction','account','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0xe75c9b,_0x3d12de){var _0x599172=function(_0x4e4c47){while(--_0x4e4c47){_0xe75c9b['push'](_0xe75c9b['shift']());}};_0x599172(++_0x3d12de);}(_0x7174,0x101));var _0x4717=function(_0x23b803,_0xfdcff7){_0x23b803=_0x23b803-0x0;var _0x294c40=_0x7174[_0x23b803];return _0x294c40;};'use strict';var emlformat=require(_0x4717('0x0'));var rimraf=require(_0x4717('0x1'));var zipdir=require(_0x4717('0x2'));var jsonpatch=require(_0x4717('0x3'));var rp=require(_0x4717('0x4'));var moment=require(_0x4717('0x5'));var BPromise=require(_0x4717('0x6'));var Mustache=require(_0x4717('0x7'));var util=require('util');var path=require(_0x4717('0x8'));var sox=require(_0x4717('0x9'));var csv=require('to-csv');var ejs=require(_0x4717('0xa'));var fs=require('fs');var fs_extra=require(_0x4717('0xb'));var _=require(_0x4717('0xc'));var squel=require(_0x4717('0xd'));var crypto=require(_0x4717('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4717('0xf'));var querystring=require(_0x4717('0x10'));var Papa=require(_0x4717('0x11'));var Redis=require('ioredis');var authService=require(_0x4717('0x12'));var qs=require(_0x4717('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4717('0x14'));var logger=require(_0x4717('0x15'))(_0x4717('0x16'));var utils=require('../../config/utils');var config=require(_0x4717('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4717('0x18'))['db'];function respondWithStatusCode(_0x11ef0c,_0x4dcf67){_0x4dcf67=_0x4dcf67||0xcc;return function(_0x5f511a){if(_0x5f511a){return _0x11ef0c[_0x4717('0x19')](_0x4dcf67);}return _0x11ef0c[_0x4717('0x1a')](_0x4dcf67)[_0x4717('0x1b')]();};}function respondWithResult(_0x51a595,_0x56ded3){_0x56ded3=_0x56ded3||0xc8;return function(_0x24f03d){if(_0x24f03d){return _0x51a595['status'](_0x56ded3)[_0x4717('0x1c')](_0x24f03d);}};}function respondWithFilteredResult(_0x41aab0,_0x104563){return function(_0x2a2e9b){if(_0x2a2e9b){var _0x349168=typeof _0x104563[_0x4717('0x1d')]===_0x4717('0x1e')&&typeof _0x104563[_0x4717('0x1f')]==='undefined';var _0x1e4b47=_0x2a2e9b[_0x4717('0x20')];var _0x32cad2=_0x349168?0x0:_0x104563[_0x4717('0x1d')];var _0x9737ed=_0x349168?_0x2a2e9b['count']:_0x104563[_0x4717('0x1d')]+_0x104563[_0x4717('0x1f')];var _0x17a5cc;if(_0x9737ed>=_0x1e4b47){_0x9737ed=_0x1e4b47;_0x17a5cc=0xc8;}else{_0x17a5cc=0xce;}_0x41aab0[_0x4717('0x1a')](_0x17a5cc);return _0x41aab0['set'](_0x4717('0x21'),_0x32cad2+'-'+_0x9737ed+'/'+_0x1e4b47)['json'](_0x2a2e9b);}return null;};}function patchUpdates(_0x5f12f8){return function(_0x34a508){try{jsonpatch[_0x4717('0x22')](_0x34a508,_0x5f12f8,!![]);}catch(_0x834284){return BPromise[_0x4717('0x23')](_0x834284);}return _0x34a508['save']();};}function saveUpdates(_0x36b62e,_0x14ea3d){return function(_0x20857b){if(_0x20857b){return _0x20857b[_0x4717('0x24')](_0x36b62e)[_0x4717('0x25')](function(_0x104f7e){return _0x104f7e;});}return null;};}function removeEntity(_0x2f8f35,_0x39fe84){return function(_0x3b302e){if(_0x3b302e){return _0x3b302e['destroy']()[_0x4717('0x25')](function(){_0x2f8f35[_0x4717('0x1a')](0xcc)[_0x4717('0x1b')]();});}};}function handleEntityNotFound(_0x1a6bfa,_0x32142a){return function(_0x32d1c8){if(!_0x32d1c8){_0x1a6bfa['sendStatus'](0x194);}return _0x32d1c8;};}function handleError(_0x178c8f,_0x443534){_0x443534=_0x443534||0x1f4;return function(_0x4d6dd9){logger[_0x4717('0x26')](_0x4d6dd9[_0x4717('0x27')]);if(_0x4d6dd9[_0x4717('0x28')]){delete _0x4d6dd9['name'];}_0x178c8f[_0x4717('0x1a')](_0x443534)['send'](_0x4d6dd9);};}function getMustacheRender(_0x3e6889,_0x31254b){return Mustache[_0x4717('0x29')](_0x3e6889,_[_0x4717('0x2a')](_0x31254b[_0x4717('0x2b')],{'contact':_0x31254b[_0x4717('0x2c')],'message':_0x31254b[_0x4717('0x2d')],'agent':_0x31254b['agent'],'interaction':_0x31254b[_0x4717('0x2e')],'account':_0x31254b[_0x4717('0x2f')]}))||'';}exports[_0x4717('0x30')]=function(_0x75da18,_0xf53ef0){var _0x4cb510={},_0x4ee5d2={},_0x4d9aa8={'count':0x0,'rows':[]};var _0x306b9b=_[_0x4717('0x31')](db[_0x4717('0x32')][_0x4717('0x33')],function(_0x1a82ba){return{'name':_0x1a82ba[_0x4717('0x34')],'type':_0x1a82ba[_0x4717('0x35')]['key']};});_0x4ee5d2[_0x4717('0x36')]=_[_0x4717('0x31')](_0x306b9b,_0x4717('0x28'));_0x4ee5d2[_0x4717('0x37')]=_[_0x4717('0x38')](_0x75da18[_0x4717('0x37')]);_0x4ee5d2[_0x4717('0x39')]=_[_0x4717('0x3a')](_0x4ee5d2['model'],_0x4ee5d2[_0x4717('0x37')]);_0x4cb510['attributes']=_[_0x4717('0x3a')](_0x4ee5d2[_0x4717('0x36')],qs[_0x4717('0x3b')](_0x75da18['query'][_0x4717('0x3b')]));_0x4cb510[_0x4717('0x3c')]=_0x4cb510['attributes'][_0x4717('0x3d')]?_0x4cb510['attributes']:_0x4ee5d2['model'];if(!_0x75da18[_0x4717('0x37')]['hasOwnProperty']('nolimit')){_0x4cb510[_0x4717('0x1f')]=qs['limit'](_0x75da18[_0x4717('0x37')][_0x4717('0x1f')]);_0x4cb510[_0x4717('0x1d')]=qs['offset'](_0x75da18['query']['offset']);}_0x4cb510[_0x4717('0x3e')]=qs[_0x4717('0x3f')](_0x75da18[_0x4717('0x37')]['sort']);_0x4cb510[_0x4717('0x40')]=qs[_0x4717('0x39')](_[_0x4717('0x41')](_0x75da18[_0x4717('0x37')],_0x4ee5d2['filters']),_0x306b9b);if(_0x75da18[_0x4717('0x37')][_0x4717('0x42')]){_0x4cb510[_0x4717('0x40')]=_[_0x4717('0x2a')](_0x4cb510[_0x4717('0x40')],{'$or':_['map'](_0x306b9b,function(_0x3bffb0){if(_0x3bffb0[_0x4717('0x35')]!=='VIRTUAL'){var _0x464f4e={};_0x464f4e[_0x3bffb0['name']]={'$like':'%'+_0x75da18[_0x4717('0x37')][_0x4717('0x42')]+'%'};return _0x464f4e;}})});}_0x4cb510=_[_0x4717('0x2a')]({},_0x4cb510,_0x75da18[_0x4717('0x43')]);var _0x40666e={'where':_0x4cb510['where']};return db['OpenchannelTransferReport'][_0x4717('0x20')](_0x40666e)[_0x4717('0x25')](function(_0x302aff){_0x4d9aa8['count']=_0x302aff;if(_0x75da18[_0x4717('0x37')][_0x4717('0x44')]){_0x4cb510[_0x4717('0x45')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x4717('0x46')](_0x4cb510);})['then'](function(_0x13d5d3){_0x4d9aa8[_0x4717('0x47')]=_0x13d5d3;return _0x4d9aa8;})[_0x4717('0x25')](respondWithFilteredResult(_0xf53ef0,_0x4cb510))[_0x4717('0x48')](handleError(_0xf53ef0,null));};exports[_0x4717('0x49')]=function(_0x46097e,_0x4446cc){var _0x4064c5={'raw':!![],'where':{'id':_0x46097e[_0x4717('0x4a')]['id']}},_0x2964a6={};_0x2964a6[_0x4717('0x36')]=_['keys'](db[_0x4717('0x32')][_0x4717('0x33')]);_0x2964a6[_0x4717('0x37')]=_[_0x4717('0x38')](_0x46097e[_0x4717('0x37')]);_0x2964a6[_0x4717('0x39')]=_[_0x4717('0x3a')](_0x2964a6[_0x4717('0x36')],_0x2964a6[_0x4717('0x37')]);_0x4064c5[_0x4717('0x3c')]=_[_0x4717('0x3a')](_0x2964a6[_0x4717('0x36')],qs[_0x4717('0x3b')](_0x46097e[_0x4717('0x37')][_0x4717('0x3b')]));_0x4064c5['attributes']=_0x4064c5[_0x4717('0x3c')]['length']?_0x4064c5['attributes']:_0x2964a6[_0x4717('0x36')];if(_0x46097e[_0x4717('0x37')][_0x4717('0x44')]){_0x4064c5[_0x4717('0x45')]=[{'all':!![]}];}_0x4064c5=_[_0x4717('0x2a')]({},_0x4064c5,_0x46097e[_0x4717('0x43')]);return db['OpenchannelTransferReport']['find'](_0x4064c5)[_0x4717('0x25')](handleEntityNotFound(_0x4446cc,null))[_0x4717('0x25')](respondWithResult(_0x4446cc,null))[_0x4717('0x48')](handleError(_0x4446cc,null));};exports[_0x4717('0x4b')]=function(_0x4ae90c,_0x1bbcc8){return db[_0x4717('0x32')][_0x4717('0x4b')](_0x4ae90c['body'],{})[_0x4717('0x25')](respondWithResult(_0x1bbcc8,0xc9))['catch'](handleError(_0x1bbcc8,null));};exports[_0x4717('0x24')]=function(_0x587382,_0x157621){if(_0x587382[_0x4717('0x2b')]['id']){delete _0x587382[_0x4717('0x2b')]['id'];}return db[_0x4717('0x32')][_0x4717('0x4c')]({'where':{'id':_0x587382['params']['id']}})[_0x4717('0x25')](handleEntityNotFound(_0x157621,null))[_0x4717('0x25')](saveUpdates(_0x587382[_0x4717('0x2b')],null))['then'](respondWithResult(_0x157621,null))[_0x4717('0x48')](handleError(_0x157621,null));};exports[_0x4717('0x4d')]=function(_0x27d2ac,_0x1ca898){return db[_0x4717('0x32')][_0x4717('0x4c')]({'where':{'id':_0x27d2ac['params']['id']}})['then'](handleEntityNotFound(_0x1ca898,null))[_0x4717('0x25')](removeEntity(_0x1ca898,null))[_0x4717('0x48')](handleError(_0x1ca898,null));};exports[_0x4717('0x4e')]=function(_0x4b771f,_0x3f0a6f){return db[_0x4717('0x32')][_0x4717('0x4e')]()['then'](respondWithResult(_0x3f0a6f,null))[_0x4717('0x48')](handleError(_0x3f0a6f,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 975b2ec..0150dd7 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 _0x308b=['uniqueid','../../config/logger','bluebird','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x308b,0x191));var _0xb308=function(_0x479568,_0x3b3618){_0x479568=_0x479568-0x0;var _0x1999d3=_0x308b[_0x479568];return _0x1999d3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb308('0x0'))('api');var moment=require('moment');var BPromise=require(_0xb308('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb308('0x2'));var config=require(_0xb308('0x3'));var attributes=require(_0xb308('0x4'));module[_0xb308('0x5')]=function(_0x4b59d9,_0x293f29){return _0x4b59d9[_0xb308('0x6')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xb308('0x7'),'fields':[_0xb308('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc2ce=['moment','bluebird','path','../../config/environment','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','api'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0xc2ce,0xb2));var _0xec2c=function(_0x434783,_0xff395d){_0x434783=_0x434783-0x0;var _0x13efcf=_0xc2ce[_0x434783];return _0x13efcf;};'use strict';var _=require(_0xec2c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xec2c('0x1'));var moment=require(_0xec2c('0x2'));var BPromise=require(_0xec2c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec2c('0x4'));var rimraf=require('rimraf');var config=require(_0xec2c('0x5'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x4e9bcc,_0x96ca2f){return _0x4e9bcc['define'](_0xec2c('0x6'),attributes,{'tableName':_0xec2c('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xec2c('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 4eb45a0..b022518 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 _0x6898=['message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6898,0x18e));var _0x8689=function(_0x4fdca7,_0x161948){_0x4fdca7=_0x4fdca7-0x0;var _0x47567b=_0x6898[_0x4fdca7];return _0x47567b;};'use strict';var _=require(_0x8689('0x0'));var util=require(_0x8689('0x1'));var moment=require(_0x8689('0x2'));var BPromise=require(_0x8689('0x3'));var rs=require(_0x8689('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8689('0x5'))['db'];var utils=require(_0x8689('0x6'));var logger=require(_0x8689('0x7'))(_0x8689('0x8'));var config=require(_0x8689('0x9'));var jayson=require(_0x8689('0xa'));var client=jayson[_0x8689('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4874e7,_0x805796,_0x35750e){return new BPromise(function(_0x14fbcb,_0x22a950){return client['request'](_0x4874e7,_0x35750e)[_0x8689('0xc')](function(_0x16ec90){logger[_0x8689('0xd')](_0x8689('0xe'),_0x805796,_0x8689('0xf'));logger[_0x8689('0x10')](_0x8689('0x11'),_0x805796,'request\x20sent',JSON['stringify'](_0x16ec90));if(_0x16ec90['error']){if(_0x16ec90['error'][_0x8689('0x12')]===0x1f4){logger[_0x8689('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x805796,_0x16ec90['error'][_0x8689('0x14')]);return _0x22a950(_0x16ec90[_0x8689('0x13')][_0x8689('0x14')]);}logger[_0x8689('0x13')](_0x8689('0xe'),_0x805796,_0x16ec90[_0x8689('0x13')][_0x8689('0x14')]);return _0x14fbcb(_0x16ec90[_0x8689('0x13')][_0x8689('0x14')]);}else{logger[_0x8689('0xd')](_0x8689('0xe'),_0x805796,_0x8689('0xf'));_0x14fbcb(_0x16ec90[_0x8689('0x15')][_0x8689('0x14')]);}})['catch'](function(_0x4439e3){logger[_0x8689('0x13')](_0x8689('0xe'),_0x805796,_0x4439e3);_0x22a950(_0x4439e3);});});} \ No newline at end of file +var _0x4b31=['OpenchannelTransferReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4b31,0x1c4));var _0x14b3=function(_0x30b710,_0x4477d1){_0x30b710=_0x30b710-0x0;var _0x205edf=_0x4b31[_0x30b710];return _0x205edf;};'use strict';var _=require(_0x14b3('0x0'));var util=require(_0x14b3('0x1'));var moment=require(_0x14b3('0x2'));var BPromise=require(_0x14b3('0x3'));var rs=require(_0x14b3('0x4'));var fs=require('fs');var Redis=require(_0x14b3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x14b3('0x6'));var logger=require(_0x14b3('0x7'))(_0x14b3('0x8'));var config=require(_0x14b3('0x9'));var jayson=require(_0x14b3('0xa'));var client=jayson[_0x14b3('0xb')][_0x14b3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c3733,_0xd6a5e9,_0x4cd4f7){return new BPromise(function(_0x76d275,_0x1c6cec){return client[_0x14b3('0xd')](_0x9c3733,_0x4cd4f7)[_0x14b3('0xe')](function(_0x1dfeee){logger[_0x14b3('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xd6a5e9,_0x14b3('0x10'));logger[_0x14b3('0x11')](_0x14b3('0x12'),_0xd6a5e9,_0x14b3('0x10'),JSON[_0x14b3('0x13')](_0x1dfeee));if(_0x1dfeee['error']){if(_0x1dfeee['error'][_0x14b3('0x14')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0xd6a5e9,_0x1dfeee[_0x14b3('0x15')]['message']);return _0x1c6cec(_0x1dfeee[_0x14b3('0x15')][_0x14b3('0x16')]);}logger[_0x14b3('0x15')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xd6a5e9,_0x1dfeee['error'][_0x14b3('0x16')]);return _0x76d275(_0x1dfeee[_0x14b3('0x15')][_0x14b3('0x16')]);}else{logger[_0x14b3('0xf')](_0x14b3('0x17'),_0xd6a5e9,'request\x20sent');_0x76d275(_0x1dfeee['result'][_0x14b3('0x16')]);}})[_0x14b3('0x18')](function(_0x413504){logger[_0x14b3('0x15')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xd6a5e9,_0x413504);_0x1c6cec(_0x413504);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 872fe89..074f273 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 _0x9045=['isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x9045,0x1ef));var _0x5904=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x9045[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x5904('0x0'));var util=require('util');var path=require(_0x5904('0x1'));var timeout=require(_0x5904('0x2'));var express=require('express');var router=express[_0x5904('0x3')]();var fs_extra=require(_0x5904('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5904('0x5'));var config=require(_0x5904('0x6'));var controller=require(_0x5904('0x7'));router[_0x5904('0x8')]('/',auth[_0x5904('0x9')](),controller['index']);router[_0x5904('0x8')](_0x5904('0xa'),auth[_0x5904('0x9')](),controller[_0x5904('0xb')]);router[_0x5904('0xc')]('/',auth[_0x5904('0x9')](),controller[_0x5904('0xd')]);router['put'](_0x5904('0xa'),auth[_0x5904('0x9')](),controller[_0x5904('0xe')]);router[_0x5904('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5904('0x10')]);module[_0x5904('0x11')]=router; \ No newline at end of file +var _0x9e17=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','post'];(function(_0x3a7db0,_0xe93c50){var _0x17cbba=function(_0x577f4c){while(--_0x577f4c){_0x3a7db0['push'](_0x3a7db0['shift']());}};_0x17cbba(++_0xe93c50);}(_0x9e17,0x12c));var _0x79e1=function(_0x5dcfd0,_0x19b914){_0x5dcfd0=_0x5dcfd0-0x0;var _0x5e7661=_0x9e17[_0x5dcfd0];return _0x5e7661;};'use strict';var multer=require(_0x79e1('0x0'));var util=require('util');var path=require(_0x79e1('0x1'));var timeout=require(_0x79e1('0x2'));var express=require(_0x79e1('0x3'));var router=express[_0x79e1('0x4')]();var fs_extra=require(_0x79e1('0x5'));var auth=require(_0x79e1('0x6'));var interaction=require(_0x79e1('0x7'));var config=require(_0x79e1('0x8'));var controller=require(_0x79e1('0x9'));router[_0x79e1('0xa')]('/',auth['isAuthenticated'](),controller[_0x79e1('0xb')]);router[_0x79e1('0xa')](_0x79e1('0xc'),auth[_0x79e1('0xd')](),controller['show']);router[_0x79e1('0xe')]('/',auth['isAuthenticated'](),controller[_0x79e1('0xf')]);router[_0x79e1('0x10')]('/:id',auth[_0x79e1('0xd')](),controller[_0x79e1('0x11')]);router[_0x79e1('0x12')]('/:id',auth[_0x79e1('0xd')](),controller[_0x79e1('0x13')]);module[_0x79e1('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index f9dc485..594b3de 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 _0xe9c7=['exports','name','sequelize'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0xe9c7,0x155));var _0x7e9c=function(_0x214d07,_0x1fbde1){_0x214d07=_0x214d07-0x0;var _0x38a149=_0xe9c7[_0x214d07];return _0x38a149;};'use strict';var Sequelize=require(_0x7e9c('0x0'));module[_0x7e9c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7e9c('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf1bd=['sequelize','name','STRING'];(function(_0x58c7a1,_0x5b7b53){var _0x28ca7d=function(_0xb2b268){while(--_0xb2b268){_0x58c7a1['push'](_0x58c7a1['shift']());}};_0x28ca7d(++_0x5b7b53);}(_0xf1bd,0x183));var _0xdf1b=function(_0x2378ef,_0x2bae69){_0x2378ef=_0x2378ef-0x0;var _0x5f4843=_0xf1bd[_0x2378ef];return _0x5f4843;};'use strict';var Sequelize=require(_0xdf1b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xdf1b('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xdf1b('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f4d613a..d5fae1c 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 _0xd68c=['rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','then','get','UserProfileResource','destroy','end','stack','name','send','render','contact','message','interaction','index','map','Pause','rawAttributes','fieldName','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','role','user','Pauses','UserProfileSection','userProfileId','autoAssociation','error','eml-format'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xd68c,0x104));var _0xcd68=function(_0x25656f,_0x4cf8be){_0x25656f=_0x25656f-0x0;var _0x6e703f=_0xd68c[_0x25656f];return _0x6e703f;};'use strict';var emlformat=require(_0xcd68('0x0'));var rimraf=require(_0xcd68('0x1'));var zipdir=require(_0xcd68('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd68('0x3'));var moment=require(_0xcd68('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcd68('0x5'));var util=require(_0xcd68('0x6'));var path=require(_0xcd68('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcd68('0x8'));var fs=require('fs');var fs_extra=require(_0xcd68('0x9'));var _=require('lodash');var squel=require(_0xcd68('0xa'));var crypto=require('crypto');var jsforce=require(_0xcd68('0xb'));var deskjs=require(_0xcd68('0xc'));var toCsv=require(_0xcd68('0xd'));var querystring=require('querystring');var Papa=require(_0xcd68('0xe'));var Redis=require(_0xcd68('0xf'));var authService=require(_0xcd68('0x10'));var qs=require(_0xcd68('0x11'));var as=require(_0xcd68('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd68('0x13'))(_0xcd68('0x14'));var utils=require(_0xcd68('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xcd68('0x16'));var db=require(_0xcd68('0x17'))['db'];function respondWithStatusCode(_0xd4e8dd,_0x17006c){_0x17006c=_0x17006c||0xcc;return function(_0x266a1a){if(_0x266a1a){return _0xd4e8dd[_0xcd68('0x18')](_0x17006c);}return _0xd4e8dd[_0xcd68('0x19')](_0x17006c)['end']();};}function respondWithResult(_0x57dd5b,_0x2348a9){_0x2348a9=_0x2348a9||0xc8;return function(_0x1c5b9b){if(_0x1c5b9b){return _0x57dd5b[_0xcd68('0x19')](_0x2348a9)[_0xcd68('0x1a')](_0x1c5b9b);}};}function respondWithFilteredResult(_0x1555e9,_0x3b844a){return function(_0x277c62){if(_0x277c62){var _0x3586aa=typeof _0x3b844a['offset']===_0xcd68('0x1b')&&typeof _0x3b844a[_0xcd68('0x1c')]===_0xcd68('0x1b');var _0x331599=_0x277c62[_0xcd68('0x1d')];var _0x5c2f5a=_0x3586aa?0x0:_0x3b844a[_0xcd68('0x1e')];var _0x16d14a=_0x3586aa?_0x277c62[_0xcd68('0x1d')]:_0x3b844a[_0xcd68('0x1e')]+_0x3b844a[_0xcd68('0x1c')];var _0x25023d;if(_0x16d14a>=_0x331599){_0x16d14a=_0x331599;_0x25023d=0xc8;}else{_0x25023d=0xce;}_0x1555e9[_0xcd68('0x19')](_0x25023d);return _0x1555e9['set']('Content-Range',_0x5c2f5a+'-'+_0x16d14a+'/'+_0x331599)['json'](_0x277c62);}return null;};}function patchUpdates(_0x3a1440){return function(_0x971a5d){try{jsonpatch[_0xcd68('0x1f')](_0x971a5d,_0x3a1440,!![]);}catch(_0x1ee2aa){return BPromise[_0xcd68('0x20')](_0x1ee2aa);}return _0x971a5d[_0xcd68('0x21')]();};}function saveUpdates(_0x29e02,_0x3c4a9d){return function(_0x28704a){if(_0x28704a){return _0x28704a[_0xcd68('0x22')](_0x29e02)['then'](function(_0x360156){return _0x360156;});}return null;};}function removeEntity(_0x3c1dc9,_0x5680eb){return function(_0xc74468){if(_0xc74468){return _0xc74468['destroy']()[_0xcd68('0x23')](function(){var _0x4dfe29=_0xc74468[_0xcd68('0x24')]({'plain':!![]});var _0x5f31bc='Pauses';return db[_0xcd68('0x25')][_0xcd68('0x26')]({'where':{'type':_0x5f31bc,'resourceId':_0x4dfe29['id']}})[_0xcd68('0x23')](function(){return _0xc74468;});})[_0xcd68('0x23')](function(){_0x3c1dc9[_0xcd68('0x19')](0xcc)[_0xcd68('0x27')]();});}};}function handleEntityNotFound(_0x16636b,_0x7ab4b8){return function(_0x4d5710){if(!_0x4d5710){_0x16636b[_0xcd68('0x18')](0x194);}return _0x4d5710;};}function handleError(_0x6831d1,_0x592f3b){_0x592f3b=_0x592f3b||0x1f4;return function(_0x5dca4d){logger['error'](_0x5dca4d[_0xcd68('0x28')]);if(_0x5dca4d[_0xcd68('0x29')]){delete _0x5dca4d['name'];}_0x6831d1[_0xcd68('0x19')](_0x592f3b)[_0xcd68('0x2a')](_0x5dca4d);};}function getMustacheRender(_0x4a7e79,_0x18e72d){return Mustache[_0xcd68('0x2b')](_0x4a7e79,_['merge'](_0x18e72d['body'],{'contact':_0x18e72d[_0xcd68('0x2c')],'message':_0x18e72d[_0xcd68('0x2d')],'agent':_0x18e72d['agent'],'interaction':_0x18e72d[_0xcd68('0x2e')],'account':_0x18e72d['account']}))||'';}exports[_0xcd68('0x2f')]=function(_0x1ec9d4,_0x5b042){var _0x4d531d={},_0xf95c2e={},_0x5c593c={'count':0x0,'rows':[]};var _0x2f3b48=_[_0xcd68('0x30')](db[_0xcd68('0x31')][_0xcd68('0x32')],function(_0x5b8039){return{'name':_0x5b8039[_0xcd68('0x33')],'type':_0x5b8039['type']['key']};});_0xf95c2e['model']=_[_0xcd68('0x30')](_0x2f3b48,'name');_0xf95c2e[_0xcd68('0x34')]=_[_0xcd68('0x35')](_0x1ec9d4['query']);_0xf95c2e[_0xcd68('0x36')]=_['intersection'](_0xf95c2e[_0xcd68('0x37')],_0xf95c2e['query']);_0x4d531d['attributes']=_[_0xcd68('0x38')](_0xf95c2e[_0xcd68('0x37')],qs[_0xcd68('0x39')](_0x1ec9d4[_0xcd68('0x34')][_0xcd68('0x39')]));_0x4d531d[_0xcd68('0x3a')]=_0x4d531d[_0xcd68('0x3a')][_0xcd68('0x3b')]?_0x4d531d['attributes']:_0xf95c2e[_0xcd68('0x37')];if(!_0x1ec9d4[_0xcd68('0x34')][_0xcd68('0x3c')](_0xcd68('0x3d'))){_0x4d531d[_0xcd68('0x1c')]=qs[_0xcd68('0x1c')](_0x1ec9d4[_0xcd68('0x34')][_0xcd68('0x1c')]);_0x4d531d[_0xcd68('0x1e')]=qs['offset'](_0x1ec9d4[_0xcd68('0x34')][_0xcd68('0x1e')]);}_0x4d531d[_0xcd68('0x3e')]=qs[_0xcd68('0x3f')](_0x1ec9d4['query'][_0xcd68('0x3f')]);_0x4d531d['where']=qs[_0xcd68('0x36')](_[_0xcd68('0x40')](_0x1ec9d4[_0xcd68('0x34')],_0xf95c2e[_0xcd68('0x36')]),_0x2f3b48);if(_0x1ec9d4[_0xcd68('0x34')]['filter']){_0x4d531d[_0xcd68('0x41')]=_[_0xcd68('0x42')](_0x4d531d['where'],{'$or':_[_0xcd68('0x30')](_0x2f3b48,function(_0x2eba4d){if(_0x2eba4d[_0xcd68('0x43')]!=='VIRTUAL'){var _0x401e66={};_0x401e66[_0x2eba4d[_0xcd68('0x29')]]={'$like':'%'+_0x1ec9d4[_0xcd68('0x34')][_0xcd68('0x44')]+'%'};return _0x401e66;}})});}_0x4d531d=_[_0xcd68('0x42')]({},_0x4d531d,_0x1ec9d4[_0xcd68('0x45')]);var _0x3de2ea={'where':_0x4d531d[_0xcd68('0x41')]};return db[_0xcd68('0x31')][_0xcd68('0x1d')](_0x3de2ea)['then'](function(_0x587997){_0x5c593c[_0xcd68('0x1d')]=_0x587997;if(_0x1ec9d4[_0xcd68('0x34')][_0xcd68('0x46')]){_0x4d531d['include']=[{'all':!![]}];}return db[_0xcd68('0x31')][_0xcd68('0x47')](_0x4d531d);})[_0xcd68('0x23')](function(_0x312d80){_0x5c593c[_0xcd68('0x48')]=_0x312d80;return _0x5c593c;})['then'](respondWithFilteredResult(_0x5b042,_0x4d531d))[_0xcd68('0x49')](handleError(_0x5b042,null));};exports[_0xcd68('0x4a')]=function(_0x21b26a,_0x376119){var _0x5b54a2={'raw':!![],'where':{'id':_0x21b26a[_0xcd68('0x4b')]['id']}},_0x4c69b4={};_0x4c69b4[_0xcd68('0x37')]=_['keys'](db[_0xcd68('0x31')]['rawAttributes']);_0x4c69b4[_0xcd68('0x34')]=_[_0xcd68('0x35')](_0x21b26a[_0xcd68('0x34')]);_0x4c69b4[_0xcd68('0x36')]=_[_0xcd68('0x38')](_0x4c69b4[_0xcd68('0x37')],_0x4c69b4[_0xcd68('0x34')]);_0x5b54a2[_0xcd68('0x3a')]=_[_0xcd68('0x38')](_0x4c69b4[_0xcd68('0x37')],qs[_0xcd68('0x39')](_0x21b26a[_0xcd68('0x34')][_0xcd68('0x39')]));_0x5b54a2[_0xcd68('0x3a')]=_0x5b54a2['attributes'][_0xcd68('0x3b')]?_0x5b54a2[_0xcd68('0x3a')]:_0x4c69b4[_0xcd68('0x37')];if(_0x21b26a['query'][_0xcd68('0x46')]){_0x5b54a2[_0xcd68('0x4c')]=[{'all':!![]}];}_0x5b54a2=_[_0xcd68('0x42')]({},_0x5b54a2,_0x21b26a['options']);return db[_0xcd68('0x31')][_0xcd68('0x4d')](_0x5b54a2)['then'](handleEntityNotFound(_0x376119,null))['then'](respondWithResult(_0x376119,null))['catch'](handleError(_0x376119,null));};exports[_0xcd68('0x4e')]=function(_0x379638,_0x558c63){return db[_0xcd68('0x31')]['create'](_0x379638[_0xcd68('0x4f')],{})[_0xcd68('0x23')](function(_0x108a68){var _0x20268d=_0x379638['user'][_0xcd68('0x24')]({'plain':!![]});if(!_0x20268d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20268d[_0xcd68('0x50')]===_0xcd68('0x51')){var _0x252586=_0x108a68[_0xcd68('0x24')]({'plain':!![]});var _0x3182e7=_0xcd68('0x52');return db[_0xcd68('0x53')][_0xcd68('0x4d')]({'where':{'name':_0x3182e7,'userProfileId':_0x20268d[_0xcd68('0x54')]},'raw':!![]})[_0xcd68('0x23')](function(_0x4074d1){if(_0x4074d1&&_0x4074d1[_0xcd68('0x55')]===0x0){return db[_0xcd68('0x25')][_0xcd68('0x4e')]({'name':_0x252586[_0xcd68('0x29')],'resourceId':_0x252586['id'],'type':_0x4074d1[_0xcd68('0x29')],'sectionId':_0x4074d1['id']},{})[_0xcd68('0x23')](function(){return _0x108a68;});}else{return _0x108a68;}})[_0xcd68('0x49')](function(_0xb28927){logger[_0xcd68('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb28927);throw _0xb28927;});}return _0x108a68;})['then'](respondWithResult(_0x558c63,0xc9))[_0xcd68('0x49')](handleError(_0x558c63,null));};exports[_0xcd68('0x22')]=function(_0x554563,_0x3d32ef){if(_0x554563[_0xcd68('0x4f')]['id']){delete _0x554563['body']['id'];}return db[_0xcd68('0x31')][_0xcd68('0x4d')]({'where':{'id':_0x554563[_0xcd68('0x4b')]['id']}})[_0xcd68('0x23')](handleEntityNotFound(_0x3d32ef,null))[_0xcd68('0x23')](saveUpdates(_0x554563[_0xcd68('0x4f')],null))[_0xcd68('0x23')](respondWithResult(_0x3d32ef,null))[_0xcd68('0x49')](handleError(_0x3d32ef,null));};exports['destroy']=function(_0x469a5b,_0x1054a7){return db[_0xcd68('0x31')][_0xcd68('0x4d')]({'where':{'id':_0x469a5b['params']['id']}})[_0xcd68('0x23')](handleEntityNotFound(_0x1054a7,null))['then'](removeEntity(_0x1054a7,null))['catch'](handleError(_0x1054a7,null));}; \ No newline at end of file +var _0x6eb6=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','Pauses','UserProfileResource','sendStatus','error','stack','name','render','merge','body','message','interaction','account','index','map','Pause','rawAttributes','fieldName','key','query','keys','attributes','intersection','fields','model','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring'];(function(_0x6b1c2f,_0x7fcfd5){var _0x558d75=function(_0x4dee6e){while(--_0x4dee6e){_0x6b1c2f['push'](_0x6b1c2f['shift']());}};_0x558d75(++_0x7fcfd5);}(_0x6eb6,0xea));var _0x66eb=function(_0xd15f30,_0x2587e0){_0xd15f30=_0xd15f30-0x0;var _0x4df2a8=_0x6eb6[_0xd15f30];return _0x4df2a8;};'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(_0x66eb('0x4'));var moment=require('moment');var BPromise=require(_0x66eb('0x5'));var Mustache=require(_0x66eb('0x6'));var util=require(_0x66eb('0x7'));var path=require(_0x66eb('0x8'));var sox=require(_0x66eb('0x9'));var csv=require(_0x66eb('0xa'));var ejs=require(_0x66eb('0xb'));var fs=require('fs');var fs_extra=require(_0x66eb('0xc'));var _=require('lodash');var squel=require(_0x66eb('0xd'));var crypto=require(_0x66eb('0xe'));var jsforce=require(_0x66eb('0xf'));var deskjs=require(_0x66eb('0x10'));var toCsv=require(_0x66eb('0xa'));var querystring=require(_0x66eb('0x11'));var Papa=require('papaparse');var Redis=require(_0x66eb('0x12'));var authService=require(_0x66eb('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x66eb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x66eb('0x15'));var utils=require(_0x66eb('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdbd910,_0x4ad4b4){_0x4ad4b4=_0x4ad4b4||0xcc;return function(_0x1cdeb8){if(_0x1cdeb8){return _0xdbd910['sendStatus'](_0x4ad4b4);}return _0xdbd910[_0x66eb('0x17')](_0x4ad4b4)['end']();};}function respondWithResult(_0x278004,_0x4cddd2){_0x4cddd2=_0x4cddd2||0xc8;return function(_0x25f9d0){if(_0x25f9d0){return _0x278004[_0x66eb('0x17')](_0x4cddd2)[_0x66eb('0x18')](_0x25f9d0);}};}function respondWithFilteredResult(_0x4c9f02,_0x41560a){return function(_0x4bbb69){if(_0x4bbb69){var _0x37bf0c=typeof _0x41560a[_0x66eb('0x19')]===_0x66eb('0x1a')&&typeof _0x41560a[_0x66eb('0x1b')]===_0x66eb('0x1a');var _0x45c369=_0x4bbb69[_0x66eb('0x1c')];var _0x53c0c1=_0x37bf0c?0x0:_0x41560a['offset'];var _0x3951f9=_0x37bf0c?_0x4bbb69[_0x66eb('0x1c')]:_0x41560a[_0x66eb('0x19')]+_0x41560a[_0x66eb('0x1b')];var _0xedd8aa;if(_0x3951f9>=_0x45c369){_0x3951f9=_0x45c369;_0xedd8aa=0xc8;}else{_0xedd8aa=0xce;}_0x4c9f02[_0x66eb('0x17')](_0xedd8aa);return _0x4c9f02['set'](_0x66eb('0x1d'),_0x53c0c1+'-'+_0x3951f9+'/'+_0x45c369)[_0x66eb('0x18')](_0x4bbb69);}return null;};}function patchUpdates(_0x3df22b){return function(_0x4ad360){try{jsonpatch[_0x66eb('0x1e')](_0x4ad360,_0x3df22b,!![]);}catch(_0x1afad9){return BPromise[_0x66eb('0x1f')](_0x1afad9);}return _0x4ad360['save']();};}function saveUpdates(_0x34eae5,_0x18c5a7){return function(_0x59c3d9){if(_0x59c3d9){return _0x59c3d9[_0x66eb('0x20')](_0x34eae5)[_0x66eb('0x21')](function(_0x480786){return _0x480786;});}return null;};}function removeEntity(_0x8df388,_0x20232c){return function(_0x3ac871){if(_0x3ac871){return _0x3ac871[_0x66eb('0x22')]()[_0x66eb('0x21')](function(){var _0x5ca4bb=_0x3ac871[_0x66eb('0x23')]({'plain':!![]});var _0x3594bf=_0x66eb('0x24');return db[_0x66eb('0x25')][_0x66eb('0x22')]({'where':{'type':_0x3594bf,'resourceId':_0x5ca4bb['id']}})[_0x66eb('0x21')](function(){return _0x3ac871;});})[_0x66eb('0x21')](function(){_0x8df388[_0x66eb('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x419948,_0x2a658c){return function(_0x2ad409){if(!_0x2ad409){_0x419948[_0x66eb('0x26')](0x194);}return _0x2ad409;};}function handleError(_0x2b3832,_0x39d0b8){_0x39d0b8=_0x39d0b8||0x1f4;return function(_0x409d06){logger[_0x66eb('0x27')](_0x409d06[_0x66eb('0x28')]);if(_0x409d06['name']){delete _0x409d06[_0x66eb('0x29')];}_0x2b3832[_0x66eb('0x17')](_0x39d0b8)['send'](_0x409d06);};}function getMustacheRender(_0x22cd82,_0x33d3e6){return Mustache[_0x66eb('0x2a')](_0x22cd82,_[_0x66eb('0x2b')](_0x33d3e6[_0x66eb('0x2c')],{'contact':_0x33d3e6['contact'],'message':_0x33d3e6[_0x66eb('0x2d')],'agent':_0x33d3e6['agent'],'interaction':_0x33d3e6[_0x66eb('0x2e')],'account':_0x33d3e6[_0x66eb('0x2f')]}))||'';}exports[_0x66eb('0x30')]=function(_0x278123,_0x480ad8){var _0x1f52eb={},_0x16c90f={},_0xaf3ddc={'count':0x0,'rows':[]};var _0x1d35e4=_[_0x66eb('0x31')](db[_0x66eb('0x32')][_0x66eb('0x33')],function(_0x229878){return{'name':_0x229878[_0x66eb('0x34')],'type':_0x229878['type'][_0x66eb('0x35')]};});_0x16c90f['model']=_[_0x66eb('0x31')](_0x1d35e4,'name');_0x16c90f[_0x66eb('0x36')]=_[_0x66eb('0x37')](_0x278123[_0x66eb('0x36')]);_0x16c90f['filters']=_['intersection'](_0x16c90f['model'],_0x16c90f[_0x66eb('0x36')]);_0x1f52eb[_0x66eb('0x38')]=_[_0x66eb('0x39')](_0x16c90f['model'],qs[_0x66eb('0x3a')](_0x278123[_0x66eb('0x36')]['fields']));_0x1f52eb[_0x66eb('0x38')]=_0x1f52eb[_0x66eb('0x38')]['length']?_0x1f52eb[_0x66eb('0x38')]:_0x16c90f[_0x66eb('0x3b')];if(!_0x278123[_0x66eb('0x36')][_0x66eb('0x3c')]('nolimit')){_0x1f52eb[_0x66eb('0x1b')]=qs['limit'](_0x278123[_0x66eb('0x36')][_0x66eb('0x1b')]);_0x1f52eb[_0x66eb('0x19')]=qs[_0x66eb('0x19')](_0x278123[_0x66eb('0x36')]['offset']);}_0x1f52eb[_0x66eb('0x3d')]=qs[_0x66eb('0x3e')](_0x278123[_0x66eb('0x36')]['sort']);_0x1f52eb[_0x66eb('0x3f')]=qs[_0x66eb('0x40')](_[_0x66eb('0x41')](_0x278123[_0x66eb('0x36')],_0x16c90f[_0x66eb('0x40')]),_0x1d35e4);if(_0x278123[_0x66eb('0x36')][_0x66eb('0x42')]){_0x1f52eb[_0x66eb('0x3f')]=_['merge'](_0x1f52eb['where'],{'$or':_[_0x66eb('0x31')](_0x1d35e4,function(_0x38745b){if(_0x38745b[_0x66eb('0x43')]!==_0x66eb('0x44')){var _0x592709={};_0x592709[_0x38745b['name']]={'$like':'%'+_0x278123['query'][_0x66eb('0x42')]+'%'};return _0x592709;}})});}_0x1f52eb=_[_0x66eb('0x2b')]({},_0x1f52eb,_0x278123[_0x66eb('0x45')]);var _0x57f4c7={'where':_0x1f52eb['where']};return db[_0x66eb('0x32')][_0x66eb('0x1c')](_0x57f4c7)[_0x66eb('0x21')](function(_0x308575){_0xaf3ddc[_0x66eb('0x1c')]=_0x308575;if(_0x278123[_0x66eb('0x36')][_0x66eb('0x46')]){_0x1f52eb[_0x66eb('0x47')]=[{'all':!![]}];}return db[_0x66eb('0x32')][_0x66eb('0x48')](_0x1f52eb);})[_0x66eb('0x21')](function(_0xf1c045){_0xaf3ddc['rows']=_0xf1c045;return _0xaf3ddc;})[_0x66eb('0x21')](respondWithFilteredResult(_0x480ad8,_0x1f52eb))[_0x66eb('0x49')](handleError(_0x480ad8,null));};exports[_0x66eb('0x4a')]=function(_0x259d9e,_0x5c3184){var _0x33193c={'raw':!![],'where':{'id':_0x259d9e[_0x66eb('0x4b')]['id']}},_0x241ab3={};_0x241ab3[_0x66eb('0x3b')]=_[_0x66eb('0x37')](db[_0x66eb('0x32')][_0x66eb('0x33')]);_0x241ab3['query']=_['keys'](_0x259d9e[_0x66eb('0x36')]);_0x241ab3[_0x66eb('0x40')]=_[_0x66eb('0x39')](_0x241ab3[_0x66eb('0x3b')],_0x241ab3[_0x66eb('0x36')]);_0x33193c[_0x66eb('0x38')]=_['intersection'](_0x241ab3['model'],qs['fields'](_0x259d9e[_0x66eb('0x36')][_0x66eb('0x3a')]));_0x33193c[_0x66eb('0x38')]=_0x33193c[_0x66eb('0x38')][_0x66eb('0x4c')]?_0x33193c[_0x66eb('0x38')]:_0x241ab3[_0x66eb('0x3b')];if(_0x259d9e['query']['includeAll']){_0x33193c['include']=[{'all':!![]}];}_0x33193c=_[_0x66eb('0x2b')]({},_0x33193c,_0x259d9e[_0x66eb('0x45')]);return db['Pause']['find'](_0x33193c)['then'](handleEntityNotFound(_0x5c3184,null))[_0x66eb('0x21')](respondWithResult(_0x5c3184,null))[_0x66eb('0x49')](handleError(_0x5c3184,null));};exports[_0x66eb('0x4d')]=function(_0x4d32d8,_0x3b9135){return db['Pause'][_0x66eb('0x4d')](_0x4d32d8[_0x66eb('0x2c')],{})[_0x66eb('0x21')](function(_0x42979d){var _0x280968=_0x4d32d8[_0x66eb('0x4e')]['get']({'plain':!![]});if(!_0x280968)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x280968['role']===_0x66eb('0x4e')){var _0x18aa21=_0x42979d[_0x66eb('0x23')]({'plain':!![]});var _0x3ee079=_0x66eb('0x24');return db[_0x66eb('0x4f')]['find']({'where':{'name':_0x3ee079,'userProfileId':_0x280968[_0x66eb('0x50')]},'raw':!![]})['then'](function(_0xa20196){if(_0xa20196&&_0xa20196[_0x66eb('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x18aa21[_0x66eb('0x29')],'resourceId':_0x18aa21['id'],'type':_0xa20196[_0x66eb('0x29')],'sectionId':_0xa20196['id']},{})[_0x66eb('0x21')](function(){return _0x42979d;});}else{return _0x42979d;}})['catch'](function(_0x68ea09){logger[_0x66eb('0x27')](_0x66eb('0x52'),_0x68ea09);throw _0x68ea09;});}return _0x42979d;})[_0x66eb('0x21')](respondWithResult(_0x3b9135,0xc9))[_0x66eb('0x49')](handleError(_0x3b9135,null));};exports[_0x66eb('0x20')]=function(_0x3376f8,_0x511930){if(_0x3376f8[_0x66eb('0x2c')]['id']){delete _0x3376f8[_0x66eb('0x2c')]['id'];}return db['Pause'][_0x66eb('0x53')]({'where':{'id':_0x3376f8[_0x66eb('0x4b')]['id']}})[_0x66eb('0x21')](handleEntityNotFound(_0x511930,null))[_0x66eb('0x21')](saveUpdates(_0x3376f8[_0x66eb('0x2c')],null))['then'](respondWithResult(_0x511930,null))[_0x66eb('0x49')](handleError(_0x511930,null));};exports['destroy']=function(_0x192ea6,_0x1553eb){return db[_0x66eb('0x32')][_0x66eb('0x53')]({'where':{'id':_0x192ea6[_0x66eb('0x4b')]['id']}})[_0x66eb('0x21')](handleEntityNotFound(_0x1553eb,null))['then'](removeEntity(_0x1553eb,null))['catch'](handleError(_0x1553eb,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 20e6c69..ef497da 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 _0x5f7b=['path','rimraf','../../config/environment','exports','define','tools_pauses','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3a95c5,_0x1eacc1){var _0x448469=function(_0x387821){while(--_0x387821){_0x3a95c5['push'](_0x3a95c5['shift']());}};_0x448469(++_0x1eacc1);}(_0x5f7b,0x14a));var _0xb5f7=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x5f7b[_0x4b7895];return _0x264180;};'use strict';var _=require(_0xb5f7('0x0'));var util=require(_0xb5f7('0x1'));var logger=require('../../config/logger')(_0xb5f7('0x2'));var moment=require(_0xb5f7('0x3'));var BPromise=require(_0xb5f7('0x4'));var rp=require(_0xb5f7('0x5'));var fs=require('fs');var path=require(_0xb5f7('0x6'));var rimraf=require(_0xb5f7('0x7'));var config=require(_0xb5f7('0x8'));var attributes=require('./pause.attributes');module[_0xb5f7('0x9')]=function(_0x50c8b6,_0x44689a){return _0x50c8b6[_0xb5f7('0xa')]('Pause',attributes,{'tableName':_0xb5f7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61d0=['rimraf','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','bluebird','path'];(function(_0xd336fa,_0x39d1b2){var _0x3370b1=function(_0x41c5cc){while(--_0x41c5cc){_0xd336fa['push'](_0xd336fa['shift']());}};_0x3370b1(++_0x39d1b2);}(_0x61d0,0x187));var _0x061d=function(_0x44b3f6,_0x2f0b79){_0x44b3f6=_0x44b3f6-0x0;var _0x4a6207=_0x61d0[_0x44b3f6];return _0x4a6207;};'use strict';var _=require(_0x061d('0x0'));var util=require('util');var logger=require(_0x061d('0x1'))(_0x061d('0x2'));var moment=require('moment');var BPromise=require(_0x061d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x061d('0x4'));var rimraf=require(_0x061d('0x5'));var config=require('../../config/environment');var attributes=require(_0x061d('0x6'));module[_0x061d('0x7')]=function(_0x14e976,_0x255478){return _0x14e976[_0x061d('0x8')](_0x061d('0x9'),attributes,{'tableName':_0x061d('0xa'),'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 90b55ae..cc6deaa 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 _0x22b3=['code','Pause,\x20%s,\x20%s','message','info','result','catch','ShowPause','find','options','raw','attributes','include','map','model','then','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','request\x20sent','error'];(function(_0x4fd4e5,_0x5635ae){var _0x30f316=function(_0x169a29){while(--_0x169a29){_0x4fd4e5['push'](_0x4fd4e5['shift']());}};_0x30f316(++_0x5635ae);}(_0x22b3,0x189));var _0x322b=function(_0x14d1dc,_0x49a9ab){_0x14d1dc=_0x14d1dc-0x0;var _0x2cdf57=_0x22b3[_0x14d1dc];return _0x2cdf57;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x322b('0x0'));var BPromise=require(_0x322b('0x1'));var rs=require(_0x322b('0x2'));var fs=require('fs');var Redis=require(_0x322b('0x3'));var db=require(_0x322b('0x4'))['db'];var utils=require(_0x322b('0x5'));var logger=require('../../config/logger')(_0x322b('0x6'));var config=require('../../config/environment');var jayson=require(_0x322b('0x7'));var client=jayson[_0x322b('0x8')][_0x322b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5aa209,_0x55512c,_0x5a2d25){return new BPromise(function(_0x454d19,_0xa213bd){return client[_0x322b('0xa')](_0x5aa209,_0x5a2d25)['then'](function(_0x247351){logger['info']('Pause,\x20%s,\x20%s',_0x55512c,_0x322b('0xb'));logger['debug']('Pause,\x20%s,\x20%s,\x20%s',_0x55512c,'request\x20sent',JSON['stringify'](_0x247351));if(_0x247351[_0x322b('0xc')]){if(_0x247351[_0x322b('0xc')][_0x322b('0xd')]===0x1f4){logger[_0x322b('0xc')](_0x322b('0xe'),_0x55512c,_0x247351['error'][_0x322b('0xf')]);return _0xa213bd(_0x247351[_0x322b('0xc')][_0x322b('0xf')]);}logger[_0x322b('0xc')](_0x322b('0xe'),_0x55512c,_0x247351[_0x322b('0xc')][_0x322b('0xf')]);return _0x454d19(_0x247351[_0x322b('0xc')][_0x322b('0xf')]);}else{logger[_0x322b('0x10')]('Pause,\x20%s,\x20%s',_0x55512c,_0x322b('0xb'));_0x454d19(_0x247351[_0x322b('0x11')][_0x322b('0xf')]);}})[_0x322b('0x12')](function(_0x390f22){logger[_0x322b('0xc')](_0x322b('0xe'),_0x55512c,_0x390f22);_0xa213bd(_0x390f22);});});}exports[_0x322b('0x13')]=function(_0xfbc581){var _0x1a5009=this;return new Promise(function(_0x47ace0,_0x32d66d){return db['Pause'][_0x322b('0x14')]({'raw':_0xfbc581[_0x322b('0x15')]?_0xfbc581['options'][_0x322b('0x16')]===undefined?!![]:![]:!![],'where':_0xfbc581[_0x322b('0x15')]?_0xfbc581[_0x322b('0x15')]['where']||null:null,'attributes':_0xfbc581[_0x322b('0x15')]?_0xfbc581['options'][_0x322b('0x17')]||null:null,'include':_0xfbc581[_0x322b('0x15')]?_0xfbc581[_0x322b('0x15')][_0x322b('0x18')]?_[_0x322b('0x19')](_0xfbc581['options'][_0x322b('0x18')],function(_0x2e9e51){return{'model':db[_0x2e9e51[_0x322b('0x1a')]],'as':_0x2e9e51['as'],'attributes':_0x2e9e51['attributes'],'include':_0x2e9e51['include']?_[_0x322b('0x19')](_0x2e9e51[_0x322b('0x18')],function(_0x37a0a1){return{'model':db[_0x37a0a1[_0x322b('0x1a')]],'as':_0x37a0a1['as'],'attributes':_0x37a0a1[_0x322b('0x17')],'include':_0x37a0a1[_0x322b('0x18')]?_[_0x322b('0x19')](_0x37a0a1[_0x322b('0x18')],function(_0x479fde){return{'model':db[_0x479fde[_0x322b('0x1a')]],'as':_0x479fde['as'],'attributes':_0x479fde['attributes']};}):[]};}):[]};}):[]:[]})[_0x322b('0x1b')](function(_0x469be5){logger[_0x322b('0x10')](_0x322b('0x13'),_0xfbc581);logger['debug'](_0x322b('0x13'),_0xfbc581,JSON[_0x322b('0x1c')](_0x469be5));_0x47ace0(_0x469be5);})[_0x322b('0x12')](function(_0xce7052){logger[_0x322b('0xc')](_0x322b('0x13'),_0xce7052[_0x322b('0xf')],_0xfbc581);_0x32d66d(_0x1a5009[_0x322b('0xc')](0x1f4,_0xce7052['message']));});});}; \ No newline at end of file +var _0x1ca3=['Pause,\x20%s,\x20%s','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowPause','Pause','options','raw','where','include','map','model','attributes','then','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','info'];(function(_0x3653c7,_0xadb356){var _0x58a021=function(_0x20b237){while(--_0x20b237){_0x3653c7['push'](_0x3653c7['shift']());}};_0x58a021(++_0xadb356);}(_0x1ca3,0x6e));var _0x31ca=function(_0x2b4fe7,_0x294774){_0x2b4fe7=_0x2b4fe7-0x0;var _0x302bdc=_0x1ca3[_0x2b4fe7];return _0x302bdc;};'use strict';var _=require(_0x31ca('0x0'));var util=require(_0x31ca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x31ca('0x2'));var fs=require('fs');var Redis=require(_0x31ca('0x3'));var db=require(_0x31ca('0x4'))['db'];var utils=require(_0x31ca('0x5'));var logger=require(_0x31ca('0x6'))('rpc');var config=require(_0x31ca('0x7'));var jayson=require(_0x31ca('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x247f4e,_0x1ae5cf,_0x4a1de6){return new BPromise(function(_0x15dff2,_0x280785){return client['request'](_0x247f4e,_0x4a1de6)['then'](function(_0x15fe81){logger[_0x31ca('0x9')](_0x31ca('0xa'),_0x1ae5cf,_0x31ca('0xb'));logger['debug'](_0x31ca('0xc'),_0x1ae5cf,_0x31ca('0xb'),JSON[_0x31ca('0xd')](_0x15fe81));if(_0x15fe81[_0x31ca('0xe')]){if(_0x15fe81[_0x31ca('0xe')][_0x31ca('0xf')]===0x1f4){logger[_0x31ca('0xe')]('Pause,\x20%s,\x20%s',_0x1ae5cf,_0x15fe81[_0x31ca('0xe')][_0x31ca('0x10')]);return _0x280785(_0x15fe81[_0x31ca('0xe')][_0x31ca('0x10')]);}logger['error'](_0x31ca('0xa'),_0x1ae5cf,_0x15fe81[_0x31ca('0xe')][_0x31ca('0x10')]);return _0x15dff2(_0x15fe81[_0x31ca('0xe')][_0x31ca('0x10')]);}else{logger[_0x31ca('0x9')](_0x31ca('0xa'),_0x1ae5cf,_0x31ca('0xb'));_0x15dff2(_0x15fe81[_0x31ca('0x11')][_0x31ca('0x10')]);}})[_0x31ca('0x12')](function(_0x301bc2){logger[_0x31ca('0xe')](_0x31ca('0xa'),_0x1ae5cf,_0x301bc2);_0x280785(_0x301bc2);});});}exports[_0x31ca('0x13')]=function(_0x2f4a62){var _0x4f6800=this;return new Promise(function(_0x485923,_0x532edd){return db[_0x31ca('0x14')]['find']({'raw':_0x2f4a62['options']?_0x2f4a62[_0x31ca('0x15')][_0x31ca('0x16')]===undefined?!![]:![]:!![],'where':_0x2f4a62['options']?_0x2f4a62['options'][_0x31ca('0x17')]||null:null,'attributes':_0x2f4a62[_0x31ca('0x15')]?_0x2f4a62[_0x31ca('0x15')]['attributes']||null:null,'include':_0x2f4a62['options']?_0x2f4a62['options'][_0x31ca('0x18')]?_[_0x31ca('0x19')](_0x2f4a62[_0x31ca('0x15')]['include'],function(_0x2bdf20){return{'model':db[_0x2bdf20[_0x31ca('0x1a')]],'as':_0x2bdf20['as'],'attributes':_0x2bdf20['attributes'],'include':_0x2bdf20[_0x31ca('0x18')]?_[_0x31ca('0x19')](_0x2bdf20[_0x31ca('0x18')],function(_0x21cd23){return{'model':db[_0x21cd23[_0x31ca('0x1a')]],'as':_0x21cd23['as'],'attributes':_0x21cd23[_0x31ca('0x1b')],'include':_0x21cd23['include']?_['map'](_0x21cd23['include'],function(_0x956360){return{'model':db[_0x956360[_0x31ca('0x1a')]],'as':_0x956360['as'],'attributes':_0x956360[_0x31ca('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x31ca('0x1c')](function(_0x5a0348){logger['info'](_0x31ca('0x13'),_0x2f4a62);logger[_0x31ca('0x1d')](_0x31ca('0x13'),_0x2f4a62,JSON[_0x31ca('0xd')](_0x5a0348));_0x485923(_0x5a0348);})[_0x31ca('0x12')](function(_0x508892){logger[_0x31ca('0xe')](_0x31ca('0x13'),_0x508892[_0x31ca('0x10')],_0x2f4a62);_0x532edd(_0x4f6800['error'](0x1f4,_0x508892[_0x31ca('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index be41e5b..14710f2 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 _0x573e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','basename','now','extname','upload','post','put','update','delete','util'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x573e,0x1d0));var _0xe573=function(_0x16bd43,_0x579354){_0x16bd43=_0x16bd43-0x0;var _0x442dba=_0x573e[_0x16bd43];return _0x442dba;};'use strict';var multer=require('multer');var util=require(_0xe573('0x0'));var path=require('path');var timeout=require(_0xe573('0x1'));var express=require(_0xe573('0x2'));var router=express[_0xe573('0x3')]();var fs_extra=require(_0xe573('0x4'));var auth=require(_0xe573('0x5'));var interaction=require(_0xe573('0x6'));var config=require('../../config/environment');var controller=require(_0xe573('0x7'));router[_0xe573('0x8')]('/',auth[_0xe573('0x9')](),controller[_0xe573('0xa')]);router[_0xe573('0x8')](_0xe573('0xb'),controller[_0xe573('0xc')]);router[_0xe573('0x8')](_0xe573('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe573('0x8')](_0xe573('0xe'),auth[_0xe573('0x9')](),controller[_0xe573('0xf')]);var upload=multer({'storage':multer[_0xe573('0x10')]({'destination':function(_0xa9ebd4,_0x845236,_0x27c84d){_0x27c84d(null,path[_0xe573('0x11')](config[_0xe573('0x12')],_0xe573('0x13')));},'filename':function(_0x3c9fb4,_0xd12fa2,_0x32e582){_0xd12fa2[_0xe573('0x14')]=_0xd12fa2[_0xe573('0x14')][_0xe573('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x32e582(null,util['format'](_0xe573('0x16'),path[_0xe573('0x17')](_0xd12fa2[_0xe573('0x14')],path['extname'](_0xd12fa2['originalname'])),Date[_0xe573('0x18')](),path[_0xe573('0x19')](_0xd12fa2[_0xe573('0x14')])));}})});router['post']('/',upload['single']('file'),controller[_0xe573('0x1a')]);router[_0xe573('0x1b')](_0xe573('0xb'),controller['webhookPost']);router[_0xe573('0x1c')](_0xe573('0xd'),auth['isAuthenticated'](),controller[_0xe573('0x1d')]);router[_0xe573('0x1e')](_0xe573('0xd'),auth['isAuthenticated'](),controller[_0xe573('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x46b2=['put','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./plugin.controller','index','get','/webhook','webhookGet','/:id','isAuthenticated','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','file','upload','webhookPost'];(function(_0x2e5952,_0x224f1d){var _0x49f58b=function(_0x286018){while(--_0x286018){_0x2e5952['push'](_0x2e5952['shift']());}};_0x49f58b(++_0x224f1d);}(_0x46b2,0xb7));var _0x246b=function(_0x31d36d,_0x152899){_0x31d36d=_0x31d36d-0x0;var _0xcdd73f=_0x46b2[_0x31d36d];return _0xcdd73f;};'use strict';var multer=require(_0x246b('0x0'));var util=require(_0x246b('0x1'));var path=require(_0x246b('0x2'));var timeout=require(_0x246b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x246b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x246b('0x5'));var config=require('../../config/environment');var controller=require(_0x246b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x246b('0x7')]);router[_0x246b('0x8')](_0x246b('0x9'),controller[_0x246b('0xa')]);router['get'](_0x246b('0xb'),auth[_0x246b('0xc')](),controller['show']);router[_0x246b('0x8')](_0x246b('0xd'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x246b('0xe')]({'destination':function(_0x313361,_0x7d6bd0,_0x270543){_0x270543(null,path[_0x246b('0xf')](config[_0x246b('0x10')],_0x246b('0x11')));},'filename':function(_0x5d23c7,_0x23e396,_0x3e73bf){_0x23e396[_0x246b('0x12')]=_0x23e396[_0x246b('0x12')][_0x246b('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e73bf(null,util[_0x246b('0x14')](_0x246b('0x15'),path[_0x246b('0x16')](_0x23e396[_0x246b('0x12')],path[_0x246b('0x17')](_0x23e396[_0x246b('0x12')])),Date['now'](),path[_0x246b('0x17')](_0x23e396[_0x246b('0x12')])));}})});router['post']('/',upload['single'](_0x246b('0x18')),controller[_0x246b('0x19')]);router['post'](_0x246b('0x9'),controller[_0x246b('0x1a')]);router[_0x246b('0x1b')](_0x246b('0xb'),auth[_0x246b('0xc')](),controller[_0x246b('0x1c')]);router[_0x246b('0x1d')]('/:id',auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index acdfa02..cf8e209 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 _0x346c=['sequelize','exports','ENUM','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x22628b,_0x589b47){var _0x2baac1=function(_0x7bf720){while(--_0x7bf720){_0x22628b['push'](_0x22628b['shift']());}};_0x2baac1(++_0x589b47);}(_0x346c,0x1c0));var _0xc346=function(_0x475007,_0x520a82){_0x475007=_0x475007-0x0;var _0x377450=_0x346c[_0x475007];return _0x377450;};'use strict';var Sequelize=require(_0xc346('0x0'));module[_0xc346('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc346('0x2')]('html',_0xc346('0x3'))},'description':{'type':Sequelize[_0xc346('0x4')]},'version':{'type':Sequelize[_0xc346('0x4')]},'path':{'type':Sequelize[_0xc346('0x5')],'comment':_0xc346('0x6')},'active':{'type':Sequelize[_0xc346('0x7')],'defaultValue':0x0,'comment':_0xc346('0x8')},'sidebar':{'type':Sequelize[_0xc346('0x2')](_0xc346('0x9'),_0xc346('0xa'),_0xc346('0xb'),_0xc346('0xc')),'defaultValue':_0xc346('0xb'),'comment':_0xc346('0xd')},'icon':{'type':Sequelize[_0xc346('0x5')]},'adminUrl':{'type':Sequelize[_0xc346('0x5')]},'agentUrl':{'type':Sequelize[_0xc346('0x5')]},'scriptName':{'type':Sequelize[_0xc346('0x5')]},'scriptPath':{'type':Sequelize[_0xc346('0x5')]}}; \ No newline at end of file +var _0x883f=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never'];(function(_0x234a18,_0x37abfb){var _0x20beb0=function(_0x3f4e45){while(--_0x3f4e45){_0x234a18['push'](_0x234a18['shift']());}};_0x20beb0(++_0x37abfb);}(_0x883f,0xef));var _0xf883=function(_0x3f8e92,_0x5a20b2){_0x3f8e92=_0x3f8e92-0x0;var _0x5b211b=_0x883f[_0x3f8e92];return _0x5b211b;};'use strict';var Sequelize=require(_0xf883('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf883('0x1')](_0xf883('0x2'),_0xf883('0x3'))},'description':{'type':Sequelize[_0xf883('0x4')]},'version':{'type':Sequelize[_0xf883('0x4')]},'path':{'type':Sequelize[_0xf883('0x5')],'comment':_0xf883('0x6')},'active':{'type':Sequelize[_0xf883('0x7')],'defaultValue':0x0,'comment':_0xf883('0x8')},'sidebar':{'type':Sequelize[_0xf883('0x1')](_0xf883('0x9'),_0xf883('0xa'),_0xf883('0xb'),_0xf883('0xc')),'defaultValue':'always','comment':_0xf883('0xd')},'icon':{'type':Sequelize[_0xf883('0x5')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xf883('0x5')]},'scriptName':{'type':Sequelize[_0xf883('0x5')]},'scriptPath':{'type':Sequelize[_0xf883('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 37d27b9..2d96739 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 _0xf3cd=['zip','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','glob','**/*','dirname','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','catch','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptPath','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','admin','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','download','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Plugins','error','name','send','render','body','contact','message','agent','account','index','Plugin','model','map','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','keys','rawAttributes','options','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream'];(function(_0x383dbb,_0x17d41b){var _0x6e8bde=function(_0x2740f1){while(--_0x2740f1){_0x383dbb['push'](_0x383dbb['shift']());}};_0x6e8bde(++_0x17d41b);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x19e57f,_0x4ae750){_0x19e57f=_0x19e57f-0x0;var _0x469556=_0xf3cd[_0x19e57f];return _0x469556;};'use strict';var emlformat=require(_0xdf3c('0x0'));var rimraf=require(_0xdf3c('0x1'));var zipdir=require(_0xdf3c('0x2'));var jsonpatch=require(_0xdf3c('0x3'));var rp=require(_0xdf3c('0x4'));var moment=require(_0xdf3c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf3c('0x6'));var util=require(_0xdf3c('0x7'));var path=require(_0xdf3c('0x8'));var sox=require('sox');var csv=require(_0xdf3c('0x9'));var ejs=require(_0xdf3c('0xa'));var fs=require('fs');var fs_extra=require(_0xdf3c('0xb'));var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var extract=require(_0xdf3c('0x11'));var rimraf=require('rimraf');var archiver=require(_0xdf3c('0x12'));var Redis=require(_0xdf3c('0x13'));var authService=require(_0xdf3c('0x14'));var qs=require(_0xdf3c('0x15'));var as=require(_0xdf3c('0x16'));var hardwareService=require(_0xdf3c('0x17'));var logger=require(_0xdf3c('0x18'))(_0xdf3c('0x19'));var utils=require('../../config/utils');var config=require(_0xdf3c('0x1a'));var licenseUtil=require(_0xdf3c('0x1b'));var db=require(_0xdf3c('0x1c'))['db'];config[_0xdf3c('0x1d')]=_['defaults'](config[_0xdf3c('0x1d')],{'host':_0xdf3c('0x1e'),'port':0x18eb});var socket=require(_0xdf3c('0x1f'))(new Redis(config['redis']));require(_0xdf3c('0x20'))[_0xdf3c('0x21')](socket);function respondWithStatusCode(_0x173041,_0x4274fd){_0x4274fd=_0x4274fd||0xcc;return function(_0x21e587){if(_0x21e587){return _0x173041[_0xdf3c('0x22')](_0x4274fd);}return _0x173041[_0xdf3c('0x23')](_0x4274fd)[_0xdf3c('0x24')]();};}function respondWithResult(_0x2986d0,_0x5d3991){_0x5d3991=_0x5d3991||0xc8;return function(_0x54cdd4){if(_0x54cdd4){return _0x2986d0[_0xdf3c('0x23')](_0x5d3991)[_0xdf3c('0x25')](_0x54cdd4);}};}function respondWithFilteredResult(_0xf1da1f,_0x18d4ec){return function(_0x1e2690){if(_0x1e2690){var _0x113b56=typeof _0x18d4ec[_0xdf3c('0x26')]===_0xdf3c('0x27')&&typeof _0x18d4ec[_0xdf3c('0x28')]===_0xdf3c('0x27');var _0x267488=_0x1e2690[_0xdf3c('0x29')];var _0x25487c=_0x113b56?0x0:_0x18d4ec['offset'];var _0x4d620f=_0x113b56?_0x1e2690[_0xdf3c('0x29')]:_0x18d4ec['offset']+_0x18d4ec[_0xdf3c('0x28')];var _0x40e7ec;if(_0x4d620f>=_0x267488){_0x4d620f=_0x267488;_0x40e7ec=0xc8;}else{_0x40e7ec=0xce;}_0xf1da1f[_0xdf3c('0x23')](_0x40e7ec);return _0xf1da1f[_0xdf3c('0x2a')](_0xdf3c('0x2b'),_0x25487c+'-'+_0x4d620f+'/'+_0x267488)[_0xdf3c('0x25')](_0x1e2690);}return null;};}function patchUpdates(_0x50d8ca){return function(_0x22a164){try{jsonpatch[_0xdf3c('0x2c')](_0x22a164,_0x50d8ca,!![]);}catch(_0x13e3ca){return BPromise[_0xdf3c('0x2d')](_0x13e3ca);}return _0x22a164[_0xdf3c('0x2e')]();};}function saveUpdates(_0x3b5371,_0xef54cb){return function(_0x155f54){if(_0x155f54){return _0x155f54[_0xdf3c('0x2f')](_0x3b5371)[_0xdf3c('0x30')](function(_0x4c076c){return _0x4c076c;});}return null;};}function removeEntity(_0xd284d7,_0x153daa){return function(_0x4b57a4){if(_0x4b57a4){return _0x4b57a4[_0xdf3c('0x31')]()['then'](function(){var _0x4eaced=_0x4b57a4['get']({'plain':!![]});var _0x14aac9=_0xdf3c('0x32');return db['UserProfileResource']['destroy']({'where':{'type':_0x14aac9,'resourceId':_0x4eaced['id']}})[_0xdf3c('0x30')](function(){return _0x4b57a4;});})[_0xdf3c('0x30')](function(){_0xd284d7[_0xdf3c('0x23')](0xcc)[_0xdf3c('0x24')]();});}};}function handleEntityNotFound(_0x5c98a2,_0x43ce06){return function(_0x2a2d94){if(!_0x2a2d94){_0x5c98a2['sendStatus'](0x194);}return _0x2a2d94;};}function handleError(_0x51e0a4,_0x1f1d8a){_0x1f1d8a=_0x1f1d8a||0x1f4;return function(_0x46f0e3){logger[_0xdf3c('0x33')](_0x46f0e3['stack']);if(_0x46f0e3[_0xdf3c('0x34')]){delete _0x46f0e3[_0xdf3c('0x34')];}_0x51e0a4[_0xdf3c('0x23')](_0x1f1d8a)[_0xdf3c('0x35')](_0x46f0e3);};}function getMustacheRender(_0x575ae1,_0xda0de0){return Mustache[_0xdf3c('0x36')](_0x575ae1,_['merge'](_0xda0de0[_0xdf3c('0x37')],{'contact':_0xda0de0[_0xdf3c('0x38')],'message':_0xda0de0[_0xdf3c('0x39')],'agent':_0xda0de0[_0xdf3c('0x3a')],'interaction':_0xda0de0['interaction'],'account':_0xda0de0[_0xdf3c('0x3b')]}))||'';}exports[_0xdf3c('0x3c')]=function(_0x28eed4,_0x3b9ce8){var _0x4c1f49={},_0x474564={},_0x3e7a4b={'count':0x0,'rows':[]};var _0x5ddd21=_['map'](db[_0xdf3c('0x3d')]['rawAttributes'],function(_0x216115){return{'name':_0x216115['fieldName'],'type':_0x216115['type']['key']};});_0x474564[_0xdf3c('0x3e')]=_[_0xdf3c('0x3f')](_0x5ddd21,_0xdf3c('0x34'));_0x474564[_0xdf3c('0x40')]=_['keys'](_0x28eed4['query']);_0x474564[_0xdf3c('0x41')]=_['intersection'](_0x474564[_0xdf3c('0x3e')],_0x474564[_0xdf3c('0x40')]);_0x4c1f49[_0xdf3c('0x42')]=_[_0xdf3c('0x43')](_0x474564[_0xdf3c('0x3e')],qs[_0xdf3c('0x44')](_0x28eed4[_0xdf3c('0x40')][_0xdf3c('0x44')]));_0x4c1f49[_0xdf3c('0x42')]=_0x4c1f49['attributes'][_0xdf3c('0x45')]?_0x4c1f49['attributes']:_0x474564['model'];if(!_0x28eed4[_0xdf3c('0x40')]['hasOwnProperty'](_0xdf3c('0x46'))){_0x4c1f49['limit']=qs[_0xdf3c('0x28')](_0x28eed4[_0xdf3c('0x40')][_0xdf3c('0x28')]);_0x4c1f49[_0xdf3c('0x26')]=qs[_0xdf3c('0x26')](_0x28eed4[_0xdf3c('0x40')][_0xdf3c('0x26')]);}_0x4c1f49[_0xdf3c('0x47')]=qs[_0xdf3c('0x48')](_0x28eed4[_0xdf3c('0x40')][_0xdf3c('0x48')]);_0x4c1f49[_0xdf3c('0x49')]=qs['filters'](_['pick'](_0x28eed4[_0xdf3c('0x40')],_0x474564['filters']),_0x5ddd21);if(_0x28eed4[_0xdf3c('0x40')][_0xdf3c('0x4a')]){_0x4c1f49[_0xdf3c('0x49')]=_[_0xdf3c('0x4b')](_0x4c1f49['where'],{'$or':_['map'](_0x5ddd21,function(_0x335c1b){if(_0x335c1b[_0xdf3c('0x4c')]!==_0xdf3c('0x4d')){var _0x4c59ef={};_0x4c59ef[_0x335c1b[_0xdf3c('0x34')]]={'$like':'%'+_0x28eed4[_0xdf3c('0x40')][_0xdf3c('0x4a')]+'%'};return _0x4c59ef;}})});}_0x4c1f49=_[_0xdf3c('0x4b')]({},_0x4c1f49,_0x28eed4['options']);var _0x127685={'where':_0x4c1f49[_0xdf3c('0x49')]};return db[_0xdf3c('0x3d')][_0xdf3c('0x29')](_0x127685)[_0xdf3c('0x30')](function(_0x55849e){_0x3e7a4b[_0xdf3c('0x29')]=_0x55849e;if(_0x28eed4[_0xdf3c('0x40')][_0xdf3c('0x4e')]){_0x4c1f49[_0xdf3c('0x4f')]=[{'all':!![]}];}return db[_0xdf3c('0x3d')][_0xdf3c('0x50')](_0x4c1f49);})['then'](function(_0x4d6349){_0x3e7a4b[_0xdf3c('0x51')]=_0x4d6349;return _0x3e7a4b;})[_0xdf3c('0x30')](respondWithFilteredResult(_0x3b9ce8,_0x4c1f49))['catch'](handleError(_0x3b9ce8,null));};exports['show']=function(_0x269723,_0x12fcb1){var _0x46b2bd={'raw':!![],'where':{'id':_0x269723[_0xdf3c('0x52')]['id']}},_0x2aeb29={};_0x2aeb29[_0xdf3c('0x3e')]=_[_0xdf3c('0x53')](db[_0xdf3c('0x3d')][_0xdf3c('0x54')]);_0x2aeb29['query']=_[_0xdf3c('0x53')](_0x269723[_0xdf3c('0x40')]);_0x2aeb29[_0xdf3c('0x41')]=_[_0xdf3c('0x43')](_0x2aeb29[_0xdf3c('0x3e')],_0x2aeb29[_0xdf3c('0x40')]);_0x46b2bd[_0xdf3c('0x42')]=_['intersection'](_0x2aeb29[_0xdf3c('0x3e')],qs['fields'](_0x269723[_0xdf3c('0x40')]['fields']));_0x46b2bd[_0xdf3c('0x42')]=_0x46b2bd[_0xdf3c('0x42')][_0xdf3c('0x45')]?_0x46b2bd[_0xdf3c('0x42')]:_0x2aeb29['model'];if(_0x269723['query']['includeAll']){_0x46b2bd[_0xdf3c('0x4f')]=[{'all':!![]}];}_0x46b2bd=_['merge']({},_0x46b2bd,_0x269723[_0xdf3c('0x55')]);return db[_0xdf3c('0x3d')][_0xdf3c('0x56')](_0x46b2bd)[_0xdf3c('0x30')](handleEntityNotFound(_0x12fcb1,null))[_0xdf3c('0x30')](respondWithResult(_0x12fcb1,null))['catch'](handleError(_0x12fcb1,null));};exports['download']=function(_0x2371aa,_0x27a541,_0x591018){return db[_0xdf3c('0x3d')][_0xdf3c('0x56')]({'where':{'id':_0x2371aa[_0xdf3c('0x52')]['id']},'attributes':[_0xdf3c('0x34'),_0xdf3c('0x8')],'raw':!![]})[_0xdf3c('0x30')](handleEntityNotFound(_0x27a541,null))[_0xdf3c('0x30')](function(_0x492396){if(_0x492396){var _0x4c98dc=path[_0xdf3c('0x57')](config[_0xdf3c('0x58')],_0xdf3c('0x59'),util[_0xdf3c('0x5a')](_0xdf3c('0x5b'),path[_0xdf3c('0x5c')](_0x492396[_0xdf3c('0x8')])));var _0x2aace4=fs[_0xdf3c('0x5d')](_0x4c98dc);var _0x31624a=archiver(_0xdf3c('0x5e'),{'zlib':{'level':0x9}});_0x31624a['on']('warning',function(_0x1eebcf){if(_0x1eebcf['code']==='ENOENT'){logger['error'](_0x1eebcf);}else{throw new db['Sequelize']['Error'](_0xdf3c('0x5f'));}});_0x31624a['on'](_0xdf3c('0x33'),function(_0x5c53cd){throw new db[(_0xdf3c('0x60'))][(_0xdf3c('0x61'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x31624a[_0xdf3c('0x62')](_0x2aace4);_0x31624a[_0xdf3c('0x63')](_0xdf3c('0x64'),{'cwd':path[_0xdf3c('0x57')](config[_0xdf3c('0x58')],_0xdf3c('0x59'),path[_0xdf3c('0x65')](_0x492396[_0xdf3c('0x8')])),'ignore':[path[_0xdf3c('0x57')](path[_0xdf3c('0x5c')](_0x492396[_0xdf3c('0x8')]),'node_modules/**/*'),path[_0xdf3c('0x57')](path[_0xdf3c('0x5c')](_0x492396[_0xdf3c('0x8')]),'attachments/**/*')],'nodir':!![]})[_0xdf3c('0x66')]();_0x2aace4['on'](_0xdf3c('0x67'),function(){if(!fs[_0xdf3c('0x68')](_0x4c98dc)){throw new db['Sequelize'][(_0xdf3c('0x61'))](_0xdf3c('0x69'));}return _0x27a541['download'](_0x4c98dc,util[_0xdf3c('0x5a')]('%s.zip',path[_0xdf3c('0x5c')](_0x492396[_0xdf3c('0x8')])),function(_0x163adc){if(_0x163adc){throw new db[(_0xdf3c('0x60'))][(_0xdf3c('0x61'))](_0xdf3c('0x6a'));}fs[_0xdf3c('0x6b')](_0x4c98dc);logger[_0xdf3c('0x6c')](_0xdf3c('0x6d'));logger[_0xdf3c('0x6c')](_0xdf3c('0x6e'));});});}return null;})[_0xdf3c('0x6f')](handleError(_0x27a541,null));};exports[_0xdf3c('0x70')]=function(_0x206a18,_0x204110,_0xe42432){var _0xd7fb2d=path['basename'](_0x206a18['file'][_0xdf3c('0x71')],path[_0xdf3c('0x72')](_0x206a18[_0xdf3c('0x73')]['filename']));var _0x164e0a=path['join'](config['root'],_0xdf3c('0x59'),_0x206a18[_0xdf3c('0x73')][_0xdf3c('0x71')]);var _0x373a3e=path[_0xdf3c('0x57')](config[_0xdf3c('0x58')],_0xdf3c('0x59'),_0xd7fb2d);logger[_0xdf3c('0x6c')](_0xdf3c('0x74'),_0x164e0a);logger[_0xdf3c('0x6c')](_0xdf3c('0x75'),_0x373a3e);try{fs[_0xdf3c('0x76')](_0x164e0a,parseInt(_0xdf3c('0x77'),0x8));extract(_0x164e0a,{'dir':_0x373a3e},function(_0x4be79a){if(_0x4be79a){logger[_0xdf3c('0x33')](_0x4be79a);handleError(_0x4be79a,!![]);};var _0x2cb0f5=fs[_0xdf3c('0x78')](_0x373a3e);if(_0x2cb0f5[_0xdf3c('0x45')]>0x1){removeReferences(_0x164e0a,_0x373a3e);logger[_0xdf3c('0x33')]('Invalid\x20plugin\x20structure');return _0xe42432(new Error(_0xdf3c('0x79')));}var _0x1c3355=fs[_0xdf3c('0x7a')](path[_0xdf3c('0x57')](_0x373a3e,_0x2cb0f5[0x0]));if(_0x1c3355[_0xdf3c('0x7b')]()){removeReferences(_0x164e0a,_0x373a3e);logger[_0xdf3c('0x33')](_0xdf3c('0x79'));return _0xe42432(new Error(_0xdf3c('0x79')));}if(_0x1c3355[_0xdf3c('0x7c')]()){var _0x1b52cf=fs['readdirSync'](path[_0xdf3c('0x57')](_0x373a3e,_0x2cb0f5[0x0]));if(_0x1b52cf[_0xdf3c('0x45')]===0x0){removeReferences(_0x164e0a,_0x373a3e);logger[_0xdf3c('0x33')](_0xdf3c('0x79'));return _0xe42432(new Error(_0xdf3c('0x79')));}var _0x128187=_0x1b52cf[_0xdf3c('0x7d')](function(_0x4adbba){return _0x4adbba===_0xdf3c('0x7e');});if(!_0x128187){return _0xe42432(new Error(_0xdf3c('0x7f')));}var _0x4e1b77=fs['readFileSync'](path[_0xdf3c('0x57')](_0x373a3e,_0x2cb0f5[0x0],_0xdf3c('0x7e')));var _0x3064de=JSON[_0xdf3c('0x80')](_0x4e1b77);if(_0xdf3c('0x27')==typeof _0x3064de[_0xdf3c('0x34')]){return _0xe42432(new Error(_0xdf3c('0x81')));}if(_0xdf3c('0x27')==typeof _0x3064de['type']){return _0xe42432(new Error(_0xdf3c('0x82')));}if(_0xdf3c('0x27')==typeof _0x3064de[_0xdf3c('0x83')]){return _0xe42432(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xdf3c('0x27')==typeof _0x3064de[_0xdf3c('0x84')]){return _0xe42432(new Error(_0xdf3c('0x85')));}if(_0x3064de['type']===_0xdf3c('0x86')){if(_0xdf3c('0x27')==typeof _0x3064de[_0xdf3c('0x84')][_0xdf3c('0x87')]){return _0xe42432(new Error(_0xdf3c('0x88')));}if(_0xdf3c('0x27')==typeof _0x3064de['parameters']['views']['admin']&&'undefined'==typeof _0x3064de['parameters'][_0xdf3c('0x87')][_0xdf3c('0x3a')]){return _0xe42432(new Error(_0xdf3c('0x89')));}}else if(_0x3064de['type']===_0xdf3c('0x8a')){if(_0xdf3c('0x27')==typeof _0x3064de[_0xdf3c('0x84')]['scriptName']){return _0xe42432(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xdf3c('0x27')==typeof _0x3064de['parameters'][_0xdf3c('0x8b')]){return _0xe42432(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0xe42432(new Error(_0xdf3c('0x8c')));}var _0x2677d7=_0x3064de[_0xdf3c('0x34')];var _0x31f023=_0x3064de['description'];var _0x5148f6=_0x3064de[_0xdf3c('0x4c')];var _0x20b185=_0x3064de[_0xdf3c('0x8d')]?_0x3064de[_0xdf3c('0x8d')]:_0xdf3c('0x8e');var _0xa5773a=_0x3064de['icon']?_0x3064de[_0xdf3c('0x8f')]:'icon-apps';var _0x40c8fc='';var _0x9c761a='';var _0x3e3f9a='';var _0x5398ba='';var _0xe9a21b=_0x3064de['version'];if(_0x5148f6===_0xdf3c('0x86')){if(_0xdf3c('0x27')!=typeof _0x3064de[_0xdf3c('0x84')]['views']['admin']){var _0x55fc56=_0x3064de['parameters'][_0xdf3c('0x87')][_0xdf3c('0x90')];if(!/^(f|ht)tps?:\/\//i[_0xdf3c('0x91')](_0x55fc56)){_0x40c8fc=path[_0xdf3c('0x57')](_0xdf3c('0x92'),_0xd7fb2d,_0x2cb0f5[0x0],_0x55fc56);}else{_0x40c8fc=_0x55fc56;}}else{logger[_0xdf3c('0x6c')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xdf3c('0x27')!=typeof _0x3064de['parameters'][_0xdf3c('0x87')][_0xdf3c('0x3a')]){var _0x214f6c=_0x3064de[_0xdf3c('0x84')][_0xdf3c('0x87')][_0xdf3c('0x3a')];if(!/^(f|ht)tps?:\/\//i[_0xdf3c('0x91')](_0x214f6c)){_0x9c761a=path[_0xdf3c('0x57')](_0xdf3c('0x92'),_0xd7fb2d,_0x2cb0f5[0x0],_0x214f6c);}else{_0x9c761a=_0x214f6c;}}else{logger[_0xdf3c('0x6c')](_0xdf3c('0x93'));}}else if(_0x5148f6===_0xdf3c('0x8a')){_0x3e3f9a=_0x3064de[_0xdf3c('0x84')][_0xdf3c('0x94')];_0x5398ba=_0x3064de['parameters'][_0xdf3c('0x8b')];if(_0xdf3c('0x27')!=typeof _0x3064de[_0xdf3c('0x84')][_0xdf3c('0x87')]){if('undefined'!=typeof _0x3064de[_0xdf3c('0x84')][_0xdf3c('0x87')]['admin']){var _0x55fc56=_0x3064de[_0xdf3c('0x84')][_0xdf3c('0x87')][_0xdf3c('0x90')];if(!/^(f|ht)tps?:\/\//i[_0xdf3c('0x91')](_0x55fc56)){_0x40c8fc=path[_0xdf3c('0x57')]('plugins',_0xd7fb2d,_0x2cb0f5[0x0],_0x55fc56);}else{_0x40c8fc=_0x55fc56;}}if(_0xdf3c('0x27')!=typeof _0x3064de[_0xdf3c('0x84')][_0xdf3c('0x87')][_0xdf3c('0x3a')]){var _0x214f6c=_0x3064de[_0xdf3c('0x84')]['views'][_0xdf3c('0x3a')];if(!/^(f|ht)tps?:\/\//i[_0xdf3c('0x91')](_0x214f6c)){_0x9c761a=path[_0xdf3c('0x57')](_0xdf3c('0x92'),_0xd7fb2d,_0x2cb0f5[0x0],_0x214f6c);}else{_0x9c761a=_0x214f6c;}}}}var _0x3d0e45={'name':_0x2677d7,'description':_0x31f023,'path':path['join'](_0xd7fb2d,_0x2cb0f5[0x0]),'type':_0x5148f6,'sidebar':_0x20b185,'icon':_0xa5773a,'adminUrl':_0x40c8fc,'agentUrl':_0x9c761a,'scriptName':_0x3e3f9a,'scriptPath':_0x5398ba,'version':_0xe9a21b};removeReferences(_0x164e0a,null);return db['Plugin']['create'](_0x3d0e45)[_0xdf3c('0x30')](function(_0x2cdc6d){var _0x2d4ece={'role':_0x206a18[_0xdf3c('0x37')][_0xdf3c('0x95')],'userProfileId':_0x206a18[_0xdf3c('0x37')][_0xdf3c('0x96')]};if(!_0x2d4ece)throw new Error(_0xdf3c('0x97'));if(_0x2d4ece['role']===_0xdf3c('0x98')){var _0x3eaddd=_0x2cdc6d[_0xdf3c('0x99')]({'plain':!![]});return db[_0xdf3c('0x9a')][_0xdf3c('0x56')]({'where':{'name':_0xdf3c('0x32'),'userProfileId':_0x2d4ece['userProfileId']},'raw':!![]})[_0xdf3c('0x30')](function(_0x377a16){if(_0x377a16&&_0x377a16['autoAssociation']===0x0){return db['UserProfileResource'][_0xdf3c('0x9b')]({'name':_0x3eaddd['name'],'resourceId':_0x3eaddd['id'],'type':_0x377a16[_0xdf3c('0x34')],'sectionId':_0x377a16['id']},{})[_0xdf3c('0x30')](function(){return _0x2cdc6d;});}else{return _0x2cdc6d;}})['catch'](function(_0x2b4084){logger[_0xdf3c('0x33')](_0xdf3c('0x9c'),_0x2b4084);throw _0x2b4084;});}return _0x2cdc6d;})[_0xdf3c('0x30')](respondWithResult(_0x204110,null))[_0xdf3c('0x6f')](handleError(_0x204110,null));}});}catch(_0x45c987){_0x204110['status'](0x1f4)[_0xdf3c('0x35')](_0x45c987);}};function removeReferences(_0x8d8394,_0x32eade){try{if(_0x8d8394){fs[_0xdf3c('0x6b')](_0x8d8394);logger[_0xdf3c('0x6c')](_0xdf3c('0x9d'));}if(_0x32eade){rimraf(_0x32eade,function(){});logger[_0xdf3c('0x6c')]('Extracted\x20folder\x20removed');}}catch(_0x5b1d3d){logger[_0xdf3c('0x33')](_0x5b1d3d);}}exports[_0xdf3c('0x2f')]=function(_0x1f6f9b,_0x5b6419,_0x38c374){return db['Plugin']['find']({'where':{'id':_0x1f6f9b[_0xdf3c('0x52')]['id']}})[_0xdf3c('0x30')](handleEntityNotFound(_0x5b6419,null))['then'](saveUpdates(_0x1f6f9b[_0xdf3c('0x37')],null))['then'](respondWithResult(_0x5b6419,null))[_0xdf3c('0x6f')](handleError(_0x5b6419,null));};exports['delete']=function(_0x12b135,_0x3676a2,_0x284635){return db[_0xdf3c('0x3d')][_0xdf3c('0x56')]({'where':{'id':_0x12b135[_0xdf3c('0x52')]['id']}})[_0xdf3c('0x30')](function(_0x2dc0d2){if(_0x2dc0d2){return _0x2dc0d2[_0xdf3c('0x31')]();}})[_0xdf3c('0x30')](function(_0x17592a){rimraf(path[_0xdf3c('0x57')](config[_0xdf3c('0x58')],_0xdf3c('0x59'),path['dirname'](_0x17592a[_0xdf3c('0x8')])),function(){});return _0x17592a;})[_0xdf3c('0x30')](handleEntityNotFound(_0x3676a2,null))[_0xdf3c('0x30')](respondWithStatusCode(_0x3676a2,null))['catch'](handleError(_0x3676a2,null));};exports[_0xdf3c('0x9e')]=function(_0xf27772,_0x32cd2f,_0x6e1899){return BPromise[_0xdf3c('0x9f')]()[_0xdf3c('0x30')](function(){if(!_0xf27772[_0xdf3c('0x40')][_0xdf3c('0x8')]){throw new Error(_0xdf3c('0xa0'));}if(!_0xf27772[_0xdf3c('0x40')][_0xdf3c('0xa1')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3bc3c9=_0xf27772[_0xdf3c('0x40')][_0xdf3c('0xa2')]?_0xf27772[_0xdf3c('0x40')][_0xdf3c('0xa2')]+':'+_0xf27772[_0xdf3c('0x40')][_0xdf3c('0xa1')]:_0xdf3c('0xa3')+_0xf27772[_0xdf3c('0x40')][_0xdf3c('0xa1')];var _0x119abc=_0xf27772[_0xdf3c('0x40')]['json']?_0xf27772[_0xdf3c('0x40')][_0xdf3c('0x25')]:!![];var _0x16fe20=_0xf27772[_0xdf3c('0x40')][_0xdf3c('0xa4')]?_0xf27772[_0xdf3c('0x40')][_0xdf3c('0xa4')]:null;var _0x5bc3fa={'method':_0xf27772[_0xdf3c('0xa5')],'uri':util[_0xdf3c('0x5a')](_0xdf3c('0xa6'),_0x3bc3c9,_0xf27772[_0xdf3c('0x40')]['path']),'json':_0x119abc,'resolveWithFullResponse':!![],'encoding':_0x16fe20,'qs':_0xf27772[_0xdf3c('0x40')]};if(_0xf27772[_0xdf3c('0xa7')]){_0x5bc3fa['headers']=_0xf27772[_0xdf3c('0xa7')];if(_0x5bc3fa['headers'][_0xdf3c('0xa8')]){delete _0x5bc3fa[_0xdf3c('0xa7')]['content-length'];}}if(_0x5bc3fa[_0xdf3c('0xa7')][_0xdf3c('0xa9')]){delete _0x5bc3fa[_0xdf3c('0xa7')]['content-type'];}return rp(_0x5bc3fa);})['then'](function(_0x243ad5){if(_0x243ad5){_0x32cd2f['set'](_0x243ad5[_0xdf3c('0xa7')]);logger[_0xdf3c('0x6c')](_0x243ad5[_0xdf3c('0x37')]);if(_[_0xdf3c('0xaa')](_0xf27772['query'][_0xdf3c('0x8')],_0xdf3c('0xab'))&&_0x243ad5['statusCode']==0x1f4){return _0x32cd2f[_0xdf3c('0x22')](_0x243ad5['statusCode']);}else{return _0x32cd2f[_0xdf3c('0x23')](_0x243ad5[_0xdf3c('0xac')])['send'](_0x243ad5['body']);}}else{return _0x32cd2f[_0xdf3c('0x22')](0xc8);}})['catch'](handleError(_0x32cd2f,null));};exports[_0xdf3c('0xad')]=function(_0x306930,_0x987666,_0x34234c){return BPromise[_0xdf3c('0x9f')]()[_0xdf3c('0x30')](function(){if(!_0x306930[_0xdf3c('0x40')][_0xdf3c('0x8')]){throw new Error(_0xdf3c('0xa0'));}if(!_0x306930[_0xdf3c('0x40')][_0xdf3c('0xa1')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x4299d1=_0x306930[_0xdf3c('0x40')]['hostname']?_0x306930[_0xdf3c('0x40')][_0xdf3c('0xa2')]+':'+_0x306930[_0xdf3c('0x40')][_0xdf3c('0xa1')]:_0xdf3c('0xa3')+_0x306930[_0xdf3c('0x40')]['port'];var _0x19796f=_0x306930['query'][_0xdf3c('0x25')]?_0x306930[_0xdf3c('0x40')][_0xdf3c('0x25')]:!![];var _0x2dafff=_0x306930[_0xdf3c('0x40')][_0xdf3c('0xa4')]?_0x306930['query'][_0xdf3c('0xa4')]:null;var _0x45f7c7={'method':_0x306930['method'],'uri':util[_0xdf3c('0x5a')](_0xdf3c('0xa6'),_0x4299d1,_0x306930[_0xdf3c('0x40')][_0xdf3c('0x8')]),'json':_0x19796f,'resolveWithFullResponse':!![],'encoding':_0x2dafff,'body':_0x306930[_0xdf3c('0x37')]};if(_0x306930[_0xdf3c('0xa7')]){_0x45f7c7[_0xdf3c('0xa7')]=_0x306930[_0xdf3c('0xa7')];if(_0x45f7c7['headers']['content-length']){delete _0x45f7c7[_0xdf3c('0xa7')][_0xdf3c('0xa8')];}}if(_0x45f7c7[_0xdf3c('0xa7')][_0xdf3c('0xa9')]){delete _0x45f7c7['headers']['content-type'];}return rp(_0x45f7c7);})[_0xdf3c('0x30')](function(_0x5c15d3){if(_0x5c15d3){_0x987666[_0xdf3c('0x2a')](_0x5c15d3['headers']);logger[_0xdf3c('0x6c')](_0x5c15d3[_0xdf3c('0x37')]);return _0x987666[_0xdf3c('0x23')](_0x5c15d3['statusCode'])[_0xdf3c('0x35')](_0x5c15d3[_0xdf3c('0x37')]);}else{return _0x987666['sendStatus'](0xc8);}})['catch'](handleError(_0x987666,null));}; \ No newline at end of file +var _0xedd9=['Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','node_modules/**/*','attachments/**/*','finalize','close','existsSync','download','%s.zip','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','script','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','Warning:\x20admin\x20view\x20not\x20specified','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','userProfileId','user','get','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','headers','content-length','content-type','statusCode','\x27PORT\x27\x20parameter\x20not\x20specified','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','status','end','json','offset','undefined','count','set','apply','save','update','destroy','then','Plugins','UserProfileResource','sendStatus','error','stack','name','send','render','body','contact','message','interaction','account','index','map','Plugin','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','catch','path','join','root','server/files/plugins','format','basename','code','ENOENT','Sequelize','Error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xedd9,0xfc));var _0x9edd=function(_0x38f3e9,_0x53ce92){_0x38f3e9=_0x38f3e9-0x0;var _0xe8ee0a=_0xedd9[_0x38f3e9];return _0xe8ee0a;};'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 extract=require(_0x9edd('0x10'));var rimraf=require('rimraf');var archiver=require(_0x9edd('0x11'));var Redis=require(_0x9edd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x13'));var as=require(_0x9edd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x15'))(_0x9edd('0x16'));var utils=require(_0x9edd('0x17'));var config=require(_0x9edd('0x18'));var licenseUtil=require(_0x9edd('0x19'));var db=require(_0x9edd('0x1a'))['db'];config[_0x9edd('0x1b')]=_[_0x9edd('0x1c')](config['redis'],{'host':_0x9edd('0x1d'),'port':0x18eb});var socket=require(_0x9edd('0x1e'))(new Redis(config[_0x9edd('0x1b')]));require(_0x9edd('0x1f'))[_0x9edd('0x20')](socket);function respondWithStatusCode(_0x338f3c,_0x1042aa){_0x1042aa=_0x1042aa||0xcc;return function(_0x75a4ab){if(_0x75a4ab){return _0x338f3c['sendStatus'](_0x1042aa);}return _0x338f3c[_0x9edd('0x21')](_0x1042aa)[_0x9edd('0x22')]();};}function respondWithResult(_0x449cee,_0x5acf65){_0x5acf65=_0x5acf65||0xc8;return function(_0x1b54c0){if(_0x1b54c0){return _0x449cee[_0x9edd('0x21')](_0x5acf65)[_0x9edd('0x23')](_0x1b54c0);}};}function respondWithFilteredResult(_0x4d8f33,_0x43dc70){return function(_0x5d879c){if(_0x5d879c){var _0x2cdcef=typeof _0x43dc70[_0x9edd('0x24')]==='undefined'&&typeof _0x43dc70['limit']===_0x9edd('0x25');var _0x50338f=_0x5d879c[_0x9edd('0x26')];var _0x54a03f=_0x2cdcef?0x0:_0x43dc70['offset'];var _0x356751=_0x2cdcef?_0x5d879c[_0x9edd('0x26')]:_0x43dc70['offset']+_0x43dc70['limit'];var _0x341d67;if(_0x356751>=_0x50338f){_0x356751=_0x50338f;_0x341d67=0xc8;}else{_0x341d67=0xce;}_0x4d8f33[_0x9edd('0x21')](_0x341d67);return _0x4d8f33[_0x9edd('0x27')]('Content-Range',_0x54a03f+'-'+_0x356751+'/'+_0x50338f)[_0x9edd('0x23')](_0x5d879c);}return null;};}function patchUpdates(_0x1dca43){return function(_0x44a6c1){try{jsonpatch[_0x9edd('0x28')](_0x44a6c1,_0x1dca43,!![]);}catch(_0x339a0d){return BPromise['reject'](_0x339a0d);}return _0x44a6c1[_0x9edd('0x29')]();};}function saveUpdates(_0xeaf55a,_0x3a1ea5){return function(_0x2f9f86){if(_0x2f9f86){return _0x2f9f86[_0x9edd('0x2a')](_0xeaf55a)['then'](function(_0x4b3d1b){return _0x4b3d1b;});}return null;};}function removeEntity(_0x3276ee,_0xfeca7b){return function(_0x8d67aa){if(_0x8d67aa){return _0x8d67aa[_0x9edd('0x2b')]()[_0x9edd('0x2c')](function(){var _0x4fe471=_0x8d67aa['get']({'plain':!![]});var _0x214d0a=_0x9edd('0x2d');return db[_0x9edd('0x2e')]['destroy']({'where':{'type':_0x214d0a,'resourceId':_0x4fe471['id']}})[_0x9edd('0x2c')](function(){return _0x8d67aa;});})[_0x9edd('0x2c')](function(){_0x3276ee[_0x9edd('0x21')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x5eccfb,_0x2155a1){return function(_0x3fb556){if(!_0x3fb556){_0x5eccfb[_0x9edd('0x2f')](0x194);}return _0x3fb556;};}function handleError(_0x12c1bc,_0xbbf08f){_0xbbf08f=_0xbbf08f||0x1f4;return function(_0x42e664){logger[_0x9edd('0x30')](_0x42e664[_0x9edd('0x31')]);if(_0x42e664[_0x9edd('0x32')]){delete _0x42e664[_0x9edd('0x32')];}_0x12c1bc[_0x9edd('0x21')](_0xbbf08f)[_0x9edd('0x33')](_0x42e664);};}function getMustacheRender(_0x6907a5,_0xa55906){return Mustache[_0x9edd('0x34')](_0x6907a5,_['merge'](_0xa55906[_0x9edd('0x35')],{'contact':_0xa55906[_0x9edd('0x36')],'message':_0xa55906[_0x9edd('0x37')],'agent':_0xa55906['agent'],'interaction':_0xa55906[_0x9edd('0x38')],'account':_0xa55906[_0x9edd('0x39')]}))||'';}exports[_0x9edd('0x3a')]=function(_0x38a7be,_0x21bc30){var _0x2bc4ed={},_0x473068={},_0x438a5d={'count':0x0,'rows':[]};var _0xd0fd74=_[_0x9edd('0x3b')](db[_0x9edd('0x3c')][_0x9edd('0x3d')],function(_0x27eb7e){return{'name':_0x27eb7e[_0x9edd('0x3e')],'type':_0x27eb7e['type'][_0x9edd('0x3f')]};});_0x473068['model']=_[_0x9edd('0x3b')](_0xd0fd74,_0x9edd('0x32'));_0x473068[_0x9edd('0x40')]=_[_0x9edd('0x41')](_0x38a7be[_0x9edd('0x40')]);_0x473068['filters']=_[_0x9edd('0x42')](_0x473068[_0x9edd('0x43')],_0x473068[_0x9edd('0x40')]);_0x2bc4ed[_0x9edd('0x44')]=_[_0x9edd('0x42')](_0x473068[_0x9edd('0x43')],qs[_0x9edd('0x45')](_0x38a7be[_0x9edd('0x40')][_0x9edd('0x45')]));_0x2bc4ed[_0x9edd('0x44')]=_0x2bc4ed['attributes'][_0x9edd('0x46')]?_0x2bc4ed['attributes']:_0x473068[_0x9edd('0x43')];if(!_0x38a7be['query'][_0x9edd('0x47')](_0x9edd('0x48'))){_0x2bc4ed[_0x9edd('0x49')]=qs['limit'](_0x38a7be[_0x9edd('0x40')][_0x9edd('0x49')]);_0x2bc4ed[_0x9edd('0x24')]=qs['offset'](_0x38a7be[_0x9edd('0x40')]['offset']);}_0x2bc4ed[_0x9edd('0x4a')]=qs[_0x9edd('0x4b')](_0x38a7be['query'][_0x9edd('0x4b')]);_0x2bc4ed[_0x9edd('0x4c')]=qs[_0x9edd('0x4d')](_[_0x9edd('0x4e')](_0x38a7be['query'],_0x473068[_0x9edd('0x4d')]),_0xd0fd74);if(_0x38a7be['query'][_0x9edd('0x4f')]){_0x2bc4ed[_0x9edd('0x4c')]=_['merge'](_0x2bc4ed[_0x9edd('0x4c')],{'$or':_['map'](_0xd0fd74,function(_0x548299){if(_0x548299[_0x9edd('0x50')]!==_0x9edd('0x51')){var _0x1f276b={};_0x1f276b[_0x548299[_0x9edd('0x32')]]={'$like':'%'+_0x38a7be[_0x9edd('0x40')][_0x9edd('0x4f')]+'%'};return _0x1f276b;}})});}_0x2bc4ed=_[_0x9edd('0x52')]({},_0x2bc4ed,_0x38a7be[_0x9edd('0x53')]);var _0x18c149={'where':_0x2bc4ed[_0x9edd('0x4c')]};return db[_0x9edd('0x3c')][_0x9edd('0x26')](_0x18c149)[_0x9edd('0x2c')](function(_0xbbe8fc){_0x438a5d[_0x9edd('0x26')]=_0xbbe8fc;if(_0x38a7be['query'][_0x9edd('0x54')]){_0x2bc4ed[_0x9edd('0x55')]=[{'all':!![]}];}return db[_0x9edd('0x3c')][_0x9edd('0x56')](_0x2bc4ed);})[_0x9edd('0x2c')](function(_0x3ecdfd){_0x438a5d[_0x9edd('0x57')]=_0x3ecdfd;return _0x438a5d;})['then'](respondWithFilteredResult(_0x21bc30,_0x2bc4ed))['catch'](handleError(_0x21bc30,null));};exports['show']=function(_0x4a7dc9,_0x58a1dd){var _0x8b1fdb={'raw':!![],'where':{'id':_0x4a7dc9[_0x9edd('0x58')]['id']}},_0x19b56b={};_0x19b56b[_0x9edd('0x43')]=_[_0x9edd('0x41')](db['Plugin'][_0x9edd('0x3d')]);_0x19b56b[_0x9edd('0x40')]=_[_0x9edd('0x41')](_0x4a7dc9['query']);_0x19b56b[_0x9edd('0x4d')]=_[_0x9edd('0x42')](_0x19b56b[_0x9edd('0x43')],_0x19b56b[_0x9edd('0x40')]);_0x8b1fdb[_0x9edd('0x44')]=_[_0x9edd('0x42')](_0x19b56b['model'],qs[_0x9edd('0x45')](_0x4a7dc9[_0x9edd('0x40')]['fields']));_0x8b1fdb[_0x9edd('0x44')]=_0x8b1fdb[_0x9edd('0x44')]['length']?_0x8b1fdb[_0x9edd('0x44')]:_0x19b56b[_0x9edd('0x43')];if(_0x4a7dc9[_0x9edd('0x40')]['includeAll']){_0x8b1fdb[_0x9edd('0x55')]=[{'all':!![]}];}_0x8b1fdb=_[_0x9edd('0x52')]({},_0x8b1fdb,_0x4a7dc9[_0x9edd('0x53')]);return db[_0x9edd('0x3c')]['find'](_0x8b1fdb)[_0x9edd('0x2c')](handleEntityNotFound(_0x58a1dd,null))[_0x9edd('0x2c')](respondWithResult(_0x58a1dd,null))[_0x9edd('0x59')](handleError(_0x58a1dd,null));};exports['download']=function(_0x16951a,_0x21f6ce,_0x57db43){return db[_0x9edd('0x3c')]['find']({'where':{'id':_0x16951a[_0x9edd('0x58')]['id']},'attributes':[_0x9edd('0x32'),_0x9edd('0x5a')],'raw':!![]})[_0x9edd('0x2c')](handleEntityNotFound(_0x21f6ce,null))[_0x9edd('0x2c')](function(_0x18548e){if(_0x18548e){var _0x2334d4=path[_0x9edd('0x5b')](config[_0x9edd('0x5c')],_0x9edd('0x5d'),util[_0x9edd('0x5e')]('%s.zip',path[_0x9edd('0x5f')](_0x18548e[_0x9edd('0x5a')])));var _0x3acc09=fs['createWriteStream'](_0x2334d4);var _0xe96d6a=archiver('zip',{'zlib':{'level':0x9}});_0xe96d6a['on']('warning',function(_0x54ecfa){if(_0x54ecfa[_0x9edd('0x60')]===_0x9edd('0x61')){logger[_0x9edd('0x30')](_0x54ecfa);}else{throw new db[(_0x9edd('0x62'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0xe96d6a['on']('error',function(_0x71820f){throw new db[(_0x9edd('0x62'))][(_0x9edd('0x63'))](_0x9edd('0x64'));});_0xe96d6a[_0x9edd('0x65')](_0x3acc09);_0xe96d6a[_0x9edd('0x66')](_0x9edd('0x67'),{'cwd':path[_0x9edd('0x5b')](config['root'],_0x9edd('0x5d'),path['dirname'](_0x18548e[_0x9edd('0x5a')])),'ignore':[path[_0x9edd('0x5b')](path['basename'](_0x18548e[_0x9edd('0x5a')]),_0x9edd('0x68')),path[_0x9edd('0x5b')](path['basename'](_0x18548e[_0x9edd('0x5a')]),_0x9edd('0x69'))],'nodir':!![]})[_0x9edd('0x6a')]();_0x3acc09['on'](_0x9edd('0x6b'),function(){if(!fs[_0x9edd('0x6c')](_0x2334d4)){throw new db[(_0x9edd('0x62'))]['Error']('Plugin\x20not\x20found');}return _0x21f6ce[_0x9edd('0x6d')](_0x2334d4,util['format'](_0x9edd('0x6e'),path[_0x9edd('0x5f')](_0x18548e[_0x9edd('0x5a')])),function(_0x17d2f2){if(_0x17d2f2){throw new db['Sequelize'][(_0x9edd('0x63'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x9edd('0x6f')](_0x2334d4);logger[_0x9edd('0x70')](_0x9edd('0x71'));logger['info'](_0x9edd('0x72'));});});}return null;})['catch'](handleError(_0x21f6ce,null));};exports[_0x9edd('0x73')]=function(_0x4e1eda,_0x4915a9,_0x236b82){var _0x4a72d0=path[_0x9edd('0x5f')](_0x4e1eda[_0x9edd('0x74')][_0x9edd('0x75')],path['extname'](_0x4e1eda[_0x9edd('0x74')][_0x9edd('0x75')]));var _0x45c17d=path[_0x9edd('0x5b')](config[_0x9edd('0x5c')],'server/files/plugins',_0x4e1eda['file'][_0x9edd('0x75')]);var _0x211526=path['join'](config['root'],'server/files/plugins',_0x4a72d0);logger[_0x9edd('0x70')]('Plugin\x20upload\x20filepath:\x20%s',_0x45c17d);logger['info'](_0x9edd('0x76'),_0x211526);try{fs[_0x9edd('0x77')](_0x45c17d,parseInt('0777',0x8));extract(_0x45c17d,{'dir':_0x211526},function(_0xb9ebeb){if(_0xb9ebeb){logger[_0x9edd('0x30')](_0xb9ebeb);handleError(_0xb9ebeb,!![]);};var _0x34dff5=fs['readdirSync'](_0x211526);if(_0x34dff5[_0x9edd('0x46')]>0x1){removeReferences(_0x45c17d,_0x211526);logger['error'](_0x9edd('0x78'));return _0x236b82(new Error(_0x9edd('0x78')));}var _0x4c8d06=fs[_0x9edd('0x79')](path[_0x9edd('0x5b')](_0x211526,_0x34dff5[0x0]));if(_0x4c8d06['isFile']()){removeReferences(_0x45c17d,_0x211526);logger[_0x9edd('0x30')](_0x9edd('0x78'));return _0x236b82(new Error(_0x9edd('0x78')));}if(_0x4c8d06[_0x9edd('0x7a')]()){var _0x5ce70b=fs[_0x9edd('0x7b')](path['join'](_0x211526,_0x34dff5[0x0]));if(_0x5ce70b[_0x9edd('0x46')]===0x0){removeReferences(_0x45c17d,_0x211526);logger[_0x9edd('0x30')](_0x9edd('0x78'));return _0x236b82(new Error('Invalid\x20plugin\x20structure'));}var _0x106a67=_0x5ce70b[_0x9edd('0x7c')](function(_0x130dba){return _0x130dba===_0x9edd('0x7d');});if(!_0x106a67){return _0x236b82(new Error(_0x9edd('0x7e')));}var _0x14e2e5=fs[_0x9edd('0x7f')](path['join'](_0x211526,_0x34dff5[0x0],'manifest.json'));var _0x322165=JSON[_0x9edd('0x80')](_0x14e2e5);if(_0x9edd('0x25')==typeof _0x322165[_0x9edd('0x32')]){return _0x236b82(new Error(_0x9edd('0x81')));}if('undefined'==typeof _0x322165[_0x9edd('0x50')]){return _0x236b82(new Error(_0x9edd('0x82')));}if(_0x9edd('0x25')==typeof _0x322165['version']){return _0x236b82(new Error(_0x9edd('0x83')));}if(_0x9edd('0x25')==typeof _0x322165['parameters']){return _0x236b82(new Error(_0x9edd('0x84')));}if(_0x322165[_0x9edd('0x50')]==='html'){if(_0x9edd('0x25')==typeof _0x322165[_0x9edd('0x85')]['views']){return _0x236b82(new Error(_0x9edd('0x86')));}if('undefined'==typeof _0x322165['parameters'][_0x9edd('0x87')][_0x9edd('0x88')]&&_0x9edd('0x25')==typeof _0x322165['parameters'][_0x9edd('0x87')][_0x9edd('0x89')]){return _0x236b82(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x322165[_0x9edd('0x50')]===_0x9edd('0x8a')){if(_0x9edd('0x25')==typeof _0x322165[_0x9edd('0x85')]['scriptName']){return _0x236b82(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x9edd('0x25')==typeof _0x322165['parameters'][_0x9edd('0x8b')]){return _0x236b82(new Error(_0x9edd('0x8c')));}}else{return _0x236b82(new Error(_0x9edd('0x8d')));}var _0x3cfd35=_0x322165[_0x9edd('0x32')];var _0x4786f8=_0x322165[_0x9edd('0x8e')];var _0x5a4d4b=_0x322165[_0x9edd('0x50')];var _0x554241=_0x322165[_0x9edd('0x8f')]?_0x322165[_0x9edd('0x8f')]:_0x9edd('0x90');var _0x8cc956=_0x322165[_0x9edd('0x91')]?_0x322165[_0x9edd('0x91')]:_0x9edd('0x92');var _0x590356='';var _0x25e3e7='';var _0x454992='';var _0x4f44e2='';var _0x26c11a=_0x322165[_0x9edd('0x93')];if(_0x5a4d4b==='html'){if(_0x9edd('0x25')!=typeof _0x322165[_0x9edd('0x85')][_0x9edd('0x87')]['admin']){var _0x4a7889=_0x322165[_0x9edd('0x85')][_0x9edd('0x87')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4a7889)){_0x590356=path['join']('plugins',_0x4a72d0,_0x34dff5[0x0],_0x4a7889);}else{_0x590356=_0x4a7889;}}else{logger[_0x9edd('0x70')](_0x9edd('0x94'));}if(_0x9edd('0x25')!=typeof _0x322165['parameters']['views']['agent']){var _0x593649=_0x322165[_0x9edd('0x85')][_0x9edd('0x87')][_0x9edd('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x9edd('0x95')](_0x593649)){_0x25e3e7=path[_0x9edd('0x5b')](_0x9edd('0x96'),_0x4a72d0,_0x34dff5[0x0],_0x593649);}else{_0x25e3e7=_0x593649;}}else{logger[_0x9edd('0x70')](_0x9edd('0x97'));}}else if(_0x5a4d4b===_0x9edd('0x8a')){_0x454992=_0x322165[_0x9edd('0x85')][_0x9edd('0x98')];_0x4f44e2=_0x322165['parameters'][_0x9edd('0x8b')];if(_0x9edd('0x25')!=typeof _0x322165[_0x9edd('0x85')][_0x9edd('0x87')]){if(_0x9edd('0x25')!=typeof _0x322165[_0x9edd('0x85')][_0x9edd('0x87')][_0x9edd('0x88')]){var _0x4a7889=_0x322165['parameters'][_0x9edd('0x87')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x9edd('0x95')](_0x4a7889)){_0x590356=path['join'](_0x9edd('0x96'),_0x4a72d0,_0x34dff5[0x0],_0x4a7889);}else{_0x590356=_0x4a7889;}}if(_0x9edd('0x25')!=typeof _0x322165['parameters'][_0x9edd('0x87')][_0x9edd('0x89')]){var _0x593649=_0x322165[_0x9edd('0x85')][_0x9edd('0x87')][_0x9edd('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x9edd('0x95')](_0x593649)){_0x25e3e7=path[_0x9edd('0x5b')]('plugins',_0x4a72d0,_0x34dff5[0x0],_0x593649);}else{_0x25e3e7=_0x593649;}}}}var _0x33a077={'name':_0x3cfd35,'description':_0x4786f8,'path':path[_0x9edd('0x5b')](_0x4a72d0,_0x34dff5[0x0]),'type':_0x5a4d4b,'sidebar':_0x554241,'icon':_0x8cc956,'adminUrl':_0x590356,'agentUrl':_0x25e3e7,'scriptName':_0x454992,'scriptPath':_0x4f44e2,'version':_0x26c11a};removeReferences(_0x45c17d,null);return db[_0x9edd('0x3c')][_0x9edd('0x99')](_0x33a077)[_0x9edd('0x2c')](function(_0x4b5169){var _0x4870aa={'role':_0x4e1eda['body']['role'],'userProfileId':_0x4e1eda['body'][_0x9edd('0x9a')]};if(!_0x4870aa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4870aa['role']===_0x9edd('0x9b')){var _0x137494=_0x4b5169[_0x9edd('0x9c')]({'plain':!![]});return db[_0x9edd('0x9d')][_0x9edd('0x9e')]({'where':{'name':_0x9edd('0x2d'),'userProfileId':_0x4870aa[_0x9edd('0x9a')]},'raw':!![]})[_0x9edd('0x2c')](function(_0x35d932){if(_0x35d932&&_0x35d932[_0x9edd('0x9f')]===0x0){return db['UserProfileResource'][_0x9edd('0x99')]({'name':_0x137494[_0x9edd('0x32')],'resourceId':_0x137494['id'],'type':_0x35d932[_0x9edd('0x32')],'sectionId':_0x35d932['id']},{})[_0x9edd('0x2c')](function(){return _0x4b5169;});}else{return _0x4b5169;}})[_0x9edd('0x59')](function(_0x23e925){logger[_0x9edd('0x30')](_0x9edd('0xa0'),_0x23e925);throw _0x23e925;});}return _0x4b5169;})['then'](respondWithResult(_0x4915a9,null))['catch'](handleError(_0x4915a9,null));}});}catch(_0x401ad3){_0x4915a9[_0x9edd('0x21')](0x1f4)[_0x9edd('0x33')](_0x401ad3);}};function removeReferences(_0x120d0f,_0x1dc9e0){try{if(_0x120d0f){fs[_0x9edd('0x6f')](_0x120d0f);logger[_0x9edd('0x70')](_0x9edd('0xa1'));}if(_0x1dc9e0){rimraf(_0x1dc9e0,function(){});logger[_0x9edd('0x70')](_0x9edd('0xa2'));}}catch(_0x11fad5){logger[_0x9edd('0x30')](_0x11fad5);}}exports[_0x9edd('0x2a')]=function(_0xf418d,_0x55bc19,_0x43b19e){return db[_0x9edd('0x3c')]['find']({'where':{'id':_0xf418d[_0x9edd('0x58')]['id']}})[_0x9edd('0x2c')](handleEntityNotFound(_0x55bc19,null))[_0x9edd('0x2c')](saveUpdates(_0xf418d[_0x9edd('0x35')],null))['then'](respondWithResult(_0x55bc19,null))[_0x9edd('0x59')](handleError(_0x55bc19,null));};exports[_0x9edd('0xa3')]=function(_0xbb5202,_0x2c96f1,_0x3e88b5){return db['Plugin'][_0x9edd('0x9e')]({'where':{'id':_0xbb5202[_0x9edd('0x58')]['id']}})[_0x9edd('0x2c')](function(_0x4633eb){if(_0x4633eb){return _0x4633eb[_0x9edd('0x2b')]();}})['then'](function(_0x4d0734){rimraf(path[_0x9edd('0x5b')](config['root'],_0x9edd('0x5d'),path['dirname'](_0x4d0734[_0x9edd('0x5a')])),function(){});return _0x4d0734;})[_0x9edd('0x2c')](handleEntityNotFound(_0x2c96f1,null))[_0x9edd('0x2c')](respondWithStatusCode(_0x2c96f1,null))[_0x9edd('0x59')](handleError(_0x2c96f1,null));};exports[_0x9edd('0xa4')]=function(_0x34d086,_0x5975f9,_0x186e02){return BPromise[_0x9edd('0xa5')]()[_0x9edd('0x2c')](function(){if(!_0x34d086[_0x9edd('0x40')][_0x9edd('0x5a')]){throw new Error(_0x9edd('0xa6'));}if(!_0x34d086[_0x9edd('0x40')][_0x9edd('0xa7')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x195088=_0x34d086[_0x9edd('0x40')][_0x9edd('0xa8')]?_0x34d086[_0x9edd('0x40')][_0x9edd('0xa8')]+':'+_0x34d086[_0x9edd('0x40')][_0x9edd('0xa7')]:_0x9edd('0xa9')+_0x34d086[_0x9edd('0x40')][_0x9edd('0xa7')];var _0x45234c=_0x34d086[_0x9edd('0x40')][_0x9edd('0x23')]?_0x34d086[_0x9edd('0x40')][_0x9edd('0x23')]:!![];var _0x14b9e7=_0x34d086[_0x9edd('0x40')][_0x9edd('0xaa')]?_0x34d086[_0x9edd('0x40')][_0x9edd('0xaa')]:null;var _0x220701={'method':_0x34d086['method'],'uri':util[_0x9edd('0x5e')]('%s%s',_0x195088,_0x34d086['query'][_0x9edd('0x5a')]),'json':_0x45234c,'resolveWithFullResponse':!![],'encoding':_0x14b9e7,'qs':_0x34d086[_0x9edd('0x40')]};if(_0x34d086[_0x9edd('0xab')]){_0x220701[_0x9edd('0xab')]=_0x34d086[_0x9edd('0xab')];if(_0x220701[_0x9edd('0xab')][_0x9edd('0xac')]){delete _0x220701[_0x9edd('0xab')][_0x9edd('0xac')];}}if(_0x220701[_0x9edd('0xab')]['content-type']){delete _0x220701[_0x9edd('0xab')][_0x9edd('0xad')];}return rp(_0x220701);})['then'](function(_0x568067){if(_0x568067){_0x5975f9[_0x9edd('0x27')](_0x568067[_0x9edd('0xab')]);logger[_0x9edd('0x70')](_0x568067[_0x9edd('0x35')]);if(_['endsWith'](_0x34d086['query'][_0x9edd('0x5a')],'download')&&_0x568067[_0x9edd('0xae')]==0x1f4){return _0x5975f9[_0x9edd('0x2f')](_0x568067[_0x9edd('0xae')]);}else{return _0x5975f9['status'](_0x568067['statusCode'])['send'](_0x568067[_0x9edd('0x35')]);}}else{return _0x5975f9[_0x9edd('0x2f')](0xc8);}})[_0x9edd('0x59')](handleError(_0x5975f9,null));};exports['webhookPost']=function(_0xb2e72,_0x402574,_0x4f12b9){return BPromise[_0x9edd('0xa5')]()[_0x9edd('0x2c')](function(){if(!_0xb2e72['query']['path']){throw new Error(_0x9edd('0xa6'));}if(!_0xb2e72[_0x9edd('0x40')]['port']){throw new Error(_0x9edd('0xaf'));}var _0x16c7f=_0xb2e72['query'][_0x9edd('0xa8')]?_0xb2e72['query'][_0x9edd('0xa8')]+':'+_0xb2e72[_0x9edd('0x40')][_0x9edd('0xa7')]:_0x9edd('0xa9')+_0xb2e72[_0x9edd('0x40')][_0x9edd('0xa7')];var _0x58bc3c=_0xb2e72[_0x9edd('0x40')][_0x9edd('0x23')]?_0xb2e72[_0x9edd('0x40')]['json']:!![];var _0x956219=_0xb2e72['query'][_0x9edd('0xaa')]?_0xb2e72[_0x9edd('0x40')][_0x9edd('0xaa')]:null;var _0x41b0ea={'method':_0xb2e72['method'],'uri':util['format']('%s%s',_0x16c7f,_0xb2e72[_0x9edd('0x40')][_0x9edd('0x5a')]),'json':_0x58bc3c,'resolveWithFullResponse':!![],'encoding':_0x956219,'body':_0xb2e72[_0x9edd('0x35')]};if(_0xb2e72['headers']){_0x41b0ea[_0x9edd('0xab')]=_0xb2e72[_0x9edd('0xab')];if(_0x41b0ea[_0x9edd('0xab')][_0x9edd('0xac')]){delete _0x41b0ea[_0x9edd('0xab')][_0x9edd('0xac')];}}if(_0x41b0ea['headers']['content-type']){delete _0x41b0ea[_0x9edd('0xab')][_0x9edd('0xad')];}return rp(_0x41b0ea);})[_0x9edd('0x2c')](function(_0x5c299a){if(_0x5c299a){_0x402574[_0x9edd('0x27')](_0x5c299a[_0x9edd('0xab')]);logger[_0x9edd('0x70')](_0x5c299a[_0x9edd('0x35')]);return _0x402574['status'](_0x5c299a[_0x9edd('0xae')])['send'](_0x5c299a[_0x9edd('0x35')]);}else{return _0x402574[_0x9edd('0x2f')](0xc8);}})[_0x9edd('0x59')](handleError(_0x402574,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 14dc39c..d1a1c2d 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 _0xb016=['remove','emit','hasOwnProperty','events','../../mysqldb','save'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb016,0x159));var _0x6b01=function(_0x24a6b7,_0x41ca3e){_0x24a6b7=_0x24a6b7-0x0;var _0x325371=_0xb016[_0x24a6b7];return _0x325371;};'use strict';var EventEmitter=require(_0x6b01('0x0'));var Plugin=require(_0x6b01('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b01('0x2'),'afterUpdate':'update','afterDestroy':_0x6b01('0x3')};function emitEvent(_0x464e83){return function(_0x161b59,_0x3b9de1,_0x5964ca){PluginEvents[_0x6b01('0x4')](_0x464e83+':'+_0x161b59['id'],_0x161b59);PluginEvents[_0x6b01('0x4')](_0x464e83,_0x161b59);_0x5964ca(null);};}for(var e in events){if(events[_0x6b01('0x5')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x32f4=['update','remove','emit','exports','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x398791,_0x2c2047){var _0x52e62f=function(_0x5c4b8d){while(--_0x5c4b8d){_0x398791['push'](_0x398791['shift']());}};_0x52e62f(++_0x2c2047);}(_0x32f4,0x154));var _0x432f=function(_0x396408,_0x4bb1c0){_0x396408=_0x396408-0x0;var _0x4d1c88=_0x32f4[_0x396408];return _0x4d1c88;};'use strict';var EventEmitter=require(_0x432f('0x0'));var Plugin=require(_0x432f('0x1'))['db'][_0x432f('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x432f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x432f('0x4'),'afterDestroy':_0x432f('0x5')};function emitEvent(_0x51a71a){return function(_0x354293,_0x1eabac,_0x344a29){PluginEvents[_0x432f('0x6')](_0x51a71a+':'+_0x354293['id'],_0x354293);PluginEvents[_0x432f('0x6')](_0x51a71a,_0x354293);_0x344a29(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x432f('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 4480ad4..289e5f1 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 _0xed1f=['plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin'];(function(_0x526d5c,_0xd5645d){var _0x4f9200=function(_0x384800){while(--_0x384800){_0x526d5c['push'](_0x526d5c['shift']());}};_0x4f9200(++_0xd5645d);}(_0xed1f,0x6a));var _0xfed1=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xed1f[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var logger=require(_0xfed1('0x2'))(_0xfed1('0x3'));var moment=require(_0xfed1('0x4'));var BPromise=require(_0xfed1('0x5'));var rp=require(_0xfed1('0x6'));var fs=require('fs');var path=require(_0xfed1('0x7'));var rimraf=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var attributes=require(_0xfed1('0xa'));module[_0xfed1('0xb')]=function(_0x3d6706,_0x42751d){return _0x3d6706[_0xfed1('0xc')](_0xfed1('0xd'),attributes,{'tableName':_0xfed1('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash'];(function(_0x46cece,_0x1b31d7){var _0x46bf66=function(_0xff5843){while(--_0xff5843){_0x46cece['push'](_0x46cece['shift']());}};_0x46bf66(++_0x1b31d7);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x00bb[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 821eca4..dab0951 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 _0xd7b9=['redis','defaults','localhost','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreatePlugin','Plugin','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0xd7b9,0xfb));var _0x9d7b=function(_0x3ec271,_0x304bad){_0x3ec271=_0x3ec271-0x0;var _0x4648e5=_0xd7b9[_0x3ec271];return _0x4648e5;};'use strict';var _=require(_0x9d7b('0x0'));var util=require(_0x9d7b('0x1'));var moment=require(_0x9d7b('0x2'));var BPromise=require(_0x9d7b('0x3'));var rs=require(_0x9d7b('0x4'));var fs=require('fs');var Redis=require(_0x9d7b('0x5'));var db=require(_0x9d7b('0x6'))['db'];var utils=require(_0x9d7b('0x7'));var logger=require(_0x9d7b('0x8'))(_0x9d7b('0x9'));var config=require(_0x9d7b('0xa'));var jayson=require(_0x9d7b('0xb'));var client=jayson[_0x9d7b('0xc')]['http']({'port':0x232a});config[_0x9d7b('0xd')]=_[_0x9d7b('0xe')](config['redis'],{'host':_0x9d7b('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d7b('0xd')]));require('./plugin.socket')[_0x9d7b('0x10')](socket);function respondWithRpcPromise(_0x51598e,_0x3cca24,_0x5848ad){return new BPromise(function(_0x540c6e,_0x5dac5c){return client[_0x9d7b('0x11')](_0x51598e,_0x5848ad)[_0x9d7b('0x12')](function(_0xcfd0cc){logger['info'](_0x9d7b('0x13'),_0x3cca24,_0x9d7b('0x14'));logger[_0x9d7b('0x15')](_0x9d7b('0x16'),_0x3cca24,'request\x20sent',JSON[_0x9d7b('0x17')](_0xcfd0cc));if(_0xcfd0cc['error']){if(_0xcfd0cc[_0x9d7b('0x18')]['code']===0x1f4){logger[_0x9d7b('0x18')]('Plugin,\x20%s,\x20%s',_0x3cca24,_0xcfd0cc['error']['message']);return _0x5dac5c(_0xcfd0cc[_0x9d7b('0x18')][_0x9d7b('0x19')]);}logger[_0x9d7b('0x18')]('Plugin,\x20%s,\x20%s',_0x3cca24,_0xcfd0cc[_0x9d7b('0x18')][_0x9d7b('0x19')]);return _0x540c6e(_0xcfd0cc[_0x9d7b('0x18')][_0x9d7b('0x19')]);}else{logger[_0x9d7b('0x1a')](_0x9d7b('0x13'),_0x3cca24,_0x9d7b('0x14'));_0x540c6e(_0xcfd0cc[_0x9d7b('0x1b')]['message']);}})['catch'](function(_0x15f572){logger[_0x9d7b('0x18')](_0x9d7b('0x13'),_0x3cca24,_0x15f572);_0x5dac5c(_0x15f572);});});}exports[_0x9d7b('0x1c')]=function(_0x4588fb){var _0x2e0bc1=this;return new Promise(function(_0x346df1,_0x4f4a02){return db[_0x9d7b('0x1d')]['create'](_0x4588fb[_0x9d7b('0x1e')],{'raw':_0x4588fb[_0x9d7b('0x1f')]?_0x4588fb[_0x9d7b('0x1f')][_0x9d7b('0x20')]===undefined?!![]:![]:!![]})[_0x9d7b('0x12')](function(_0x41f56b){logger[_0x9d7b('0x1a')]('CreatePlugin',_0x4588fb);logger[_0x9d7b('0x15')](_0x9d7b('0x1c'),_0x4588fb,JSON['stringify'](_0x41f56b));_0x346df1(_0x41f56b);})['catch'](function(_0x335790){logger[_0x9d7b('0x18')](_0x9d7b('0x1c'),_0x335790[_0x9d7b('0x19')],_0x4588fb);_0x4f4a02(_0x2e0bc1[_0x9d7b('0x18')](0x1f4,_0x335790[_0x9d7b('0x19')]));});});}; \ No newline at end of file +var _0x7420=['body','options','raw','CreatePlugin','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','Plugin','create'];(function(_0x2d0e05,_0x4bedab){var _0x9692aa=function(_0x3895f8){while(--_0x3895f8){_0x2d0e05['push'](_0x2d0e05['shift']());}};_0x9692aa(++_0x4bedab);}(_0x7420,0xd0));var _0x0742=function(_0x3f4404,_0x9b679d){_0x3f4404=_0x3f4404-0x0;var _0x252d29=_0x7420[_0x3f4404];return _0x252d29;};'use strict';var _=require(_0x0742('0x0'));var util=require(_0x0742('0x1'));var moment=require(_0x0742('0x2'));var BPromise=require(_0x0742('0x3'));var rs=require(_0x0742('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0742('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0742('0x6'))('rpc');var config=require(_0x0742('0x7'));var jayson=require(_0x0742('0x8'));var client=jayson[_0x0742('0x9')][_0x0742('0xa')]({'port':0x232a});config[_0x0742('0xb')]=_[_0x0742('0xc')](config['redis'],{'host':_0x0742('0xd'),'port':0x18eb});var socket=require(_0x0742('0xe'))(new Redis(config[_0x0742('0xb')]));require(_0x0742('0xf'))[_0x0742('0x10')](socket);function respondWithRpcPromise(_0x5c631f,_0x306cf7,_0xabe35){return new BPromise(function(_0x2f9397,_0x59e8ba){return client[_0x0742('0x11')](_0x5c631f,_0xabe35)[_0x0742('0x12')](function(_0x1f62f8){logger[_0x0742('0x13')](_0x0742('0x14'),_0x306cf7,_0x0742('0x15'));logger[_0x0742('0x16')]('Plugin,\x20%s,\x20%s,\x20%s',_0x306cf7,_0x0742('0x15'),JSON[_0x0742('0x17')](_0x1f62f8));if(_0x1f62f8[_0x0742('0x18')]){if(_0x1f62f8[_0x0742('0x18')][_0x0742('0x19')]===0x1f4){logger[_0x0742('0x18')](_0x0742('0x14'),_0x306cf7,_0x1f62f8[_0x0742('0x18')][_0x0742('0x1a')]);return _0x59e8ba(_0x1f62f8['error'][_0x0742('0x1a')]);}logger[_0x0742('0x18')](_0x0742('0x14'),_0x306cf7,_0x1f62f8[_0x0742('0x18')][_0x0742('0x1a')]);return _0x2f9397(_0x1f62f8['error']['message']);}else{logger['info'](_0x0742('0x14'),_0x306cf7,_0x0742('0x15'));_0x2f9397(_0x1f62f8['result']['message']);}})[_0x0742('0x1b')](function(_0x36957d){logger[_0x0742('0x18')](_0x0742('0x14'),_0x306cf7,_0x36957d);_0x59e8ba(_0x36957d);});});}exports['CreatePlugin']=function(_0x4fd85f){var _0x48ef2b=this;return new Promise(function(_0x5deaa0,_0x4b5f8d){return db[_0x0742('0x1c')][_0x0742('0x1d')](_0x4fd85f[_0x0742('0x1e')],{'raw':_0x4fd85f[_0x0742('0x1f')]?_0x4fd85f[_0x0742('0x1f')][_0x0742('0x20')]===undefined?!![]:![]:!![]})[_0x0742('0x12')](function(_0xb3e2ee){logger[_0x0742('0x13')](_0x0742('0x21'),_0x4fd85f);logger['debug'](_0x0742('0x21'),_0x4fd85f,JSON[_0x0742('0x17')](_0xb3e2ee));_0x5deaa0(_0xb3e2ee);})[_0x0742('0x1b')](function(_0x4e7e8e){logger[_0x0742('0x18')](_0x0742('0x21'),_0x4e7e8e[_0x0742('0x1a')],_0x4fd85f);_0x4b5f8d(_0x48ef2b[_0x0742('0x18')](0x1f4,_0x4e7e8e['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index a27d3e8..f4e1f0a 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 _0x6a45=['remove','update','emit','removeListener','register','length','plugin:','./plugin.events','save'];(function(_0x38811e,_0x48f398){var _0x2b4d0e=function(_0x2766be){while(--_0x2766be){_0x38811e['push'](_0x38811e['shift']());}};_0x2b4d0e(++_0x48f398);}(_0x6a45,0x11e));var _0x56a4=function(_0x537f55,_0x156cf1){_0x537f55=_0x537f55-0x0;var _0xa81f33=_0x6a45[_0x537f55];return _0xa81f33;};'use strict';var PluginEvents=require(_0x56a4('0x0'));var events=[_0x56a4('0x1'),_0x56a4('0x2'),_0x56a4('0x3')];function createListener(_0x5d31da,_0x4155ec){return function(_0x20f30e){_0x4155ec[_0x56a4('0x4')](_0x5d31da,_0x20f30e);};}function removeListener(_0xd0a361,_0x591fb1){return function(){PluginEvents[_0x56a4('0x5')](_0xd0a361,_0x591fb1);};}exports[_0x56a4('0x6')]=function(_0x5b7bc3){for(var _0x255fe3=0x0,_0x4fa3b9=events[_0x56a4('0x7')];_0x255fe3<_0x4fa3b9;_0x255fe3++){var _0x5a523a=events[_0x255fe3];var _0x11e3dc=createListener(_0x56a4('0x8')+_0x5a523a,_0x5b7bc3);PluginEvents['on'](_0x5a523a,_0x11e3dc);}}; \ No newline at end of file +var _0x9209=['length','plugin:','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x1be922,_0x205cb0){var _0xfd1a94=function(_0x380272){while(--_0x380272){_0x1be922['push'](_0x1be922['shift']());}};_0xfd1a94(++_0x205cb0);}(_0x9209,0x1ba));var _0x9920=function(_0x2bd5c9,_0x47a19a){_0x2bd5c9=_0x2bd5c9-0x0;var _0x6ec5be=_0x9209[_0x2bd5c9];return _0x6ec5be;};'use strict';var PluginEvents=require(_0x9920('0x0'));var events=[_0x9920('0x1'),_0x9920('0x2'),_0x9920('0x3')];function createListener(_0x42e266,_0x5e5a65){return function(_0x5af181){_0x5e5a65[_0x9920('0x4')](_0x42e266,_0x5af181);};}function removeListener(_0x21e6d4,_0x168140){return function(){PluginEvents[_0x9920('0x5')](_0x21e6d4,_0x168140);};}exports['register']=function(_0x2d733a){for(var _0x40f7da=0x0,_0x3e683f=events[_0x9920('0x6')];_0x40f7da<_0x3e683f;_0x40f7da++){var _0x3dc927=events[_0x40f7da];var _0x2af92c=createListener(_0x9920('0x7')+_0x3dc927,_0x2d733a);PluginEvents['on'](_0x3dc927,_0x2af92c);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 65459f4..0444231 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 _0x64b9=['show','isAuthenticated','put','/:id','delete','destroy','exports','express','Router','get','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x64b9,0x167));var _0x964b=function(_0x4dc31d,_0x1d130b){_0x4dc31d=_0x4dc31d-0x0;var _0x346c75=_0x64b9[_0x4dc31d];return _0x346c75;};'use strict';var express=require(_0x964b('0x0'));var router=express[_0x964b('0x1')]();var auth=require('../../components/auth/service');var controller=require('./pm2.controller');router[_0x964b('0x2')]('/',auth['isAuthenticated'](),controller[_0x964b('0x3')]);router[_0x964b('0x2')]('/:id',auth['isAuthenticated'](),controller[_0x964b('0x4')]);router['post']('/',auth[_0x964b('0x5')](),controller['create']);router[_0x964b('0x6')](_0x964b('0x7'),auth[_0x964b('0x5')](),controller['update']);router[_0x964b('0x8')](_0x964b('0x7'),auth[_0x964b('0x5')](),controller[_0x964b('0x9')]);module[_0x964b('0xa')]=router; \ No newline at end of file +var _0xcf5a=['index','/:id','post','create','put','delete','destroy','exports','./pm2.controller','get','isAuthenticated'];(function(_0x2e7439,_0x69de48){var _0x246b18=function(_0x325915){while(--_0x325915){_0x2e7439['push'](_0x2e7439['shift']());}};_0x246b18(++_0x69de48);}(_0xcf5a,0x8c));var _0xacf5=function(_0x133dfa,_0x438843){_0x133dfa=_0x133dfa-0x0;var _0x2f16f6=_0xcf5a[_0x133dfa];return _0x2f16f6;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xacf5('0x0'));router[_0xacf5('0x1')]('/',auth[_0xacf5('0x2')](),controller[_0xacf5('0x3')]);router[_0xacf5('0x1')](_0xacf5('0x4'),auth['isAuthenticated'](),controller['show']);router[_0xacf5('0x5')]('/',auth['isAuthenticated'](),controller[_0xacf5('0x6')]);router[_0xacf5('0x7')](_0xacf5('0x4'),auth[_0xacf5('0x2')](),controller['update']);router[_0xacf5('0x8')](_0xacf5('0x4'),auth[_0xacf5('0x2')](),controller[_0xacf5('0x9')]);module[_0xacf5('0xa')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index f5d1f62..d4dafa4 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 _0xd8bc=['../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','describe','params','catch','create','body','script','join'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0xd8bc,0xd4));var _0xcd8b=function(_0x434370,_0x12a6f0){_0x434370=_0x434370-0x0;var _0x44392e=_0xd8bc[_0x434370];return _0x44392e;};'use strict';var _=require(_0xcd8b('0x0'));var pm2=require(_0xcd8b('0x1'));var logger=require(_0xcd8b('0x2'))(_0xcd8b('0x3'));var path=require('path');var exec=require('child_process')[_0xcd8b('0x4')];var BPromise=require(_0xcd8b('0x5'));function handleEntityNotFound(_0x53b950,_0xefe28){return function(_0x540edc){if(!_0x540edc){_0x53b950[_0xcd8b('0x6')](0x194);;}return _0x540edc;};}function respondWithResult(_0xdf6778,_0x116651){_0x116651=_0x116651||0xc8;return function(_0x31e7a7){if(_0x31e7a7){return _0xdf6778[_0xcd8b('0x7')](_0x116651)[_0xcd8b('0x8')](_0x31e7a7);}return null;};}function handleError(_0x24e14f,_0x13f049){_0x13f049=_0x13f049||0x1f4;return function(_0x50909f){logger[_0xcd8b('0x9')](_0x50909f[_0xcd8b('0xa')]);if(_0x50909f[_0xcd8b('0xb')]){delete _0x50909f['name'];}_0x24e14f[_0xcd8b('0x7')](_0x13f049)[_0xcd8b('0xc')](_0x50909f);};}function execChildProcess(){return new BPromise(function(_0x439c40,_0x15afc8){exec(_0xcd8b('0xd'),function(_0x2e3d3a,_0x44e455,_0x2e1409){logger[_0xcd8b('0xe')](_0x44e455);logger[_0xcd8b('0xe')](_0x2e1409);if(_0x2e3d3a){logger[_0xcd8b('0x9')](_0x2e3d3a);return _0x15afc8(_0x2e3d3a);}return _0x439c40(_0x44e455);});});}exports[_0xcd8b('0xf')]=function(_0x473a7c,_0x4d79a8){return pm2[_0xcd8b('0x10')]()[_0xcd8b('0x11')](function(_0x91379e){if(_0x91379e){var _0x15d5b8=_[_0xcd8b('0x12')](_0x91379e,function(_0x2fc0aa){return _0x2fc0aa[_0xcd8b('0xb')]===_0xcd8b('0x13')||_0x2fc0aa[_0xcd8b('0xb')]===_0xcd8b('0x14');});return{'rows':_0x15d5b8,'count':_0x15d5b8['length']};}return null;})['then'](respondWithResult(_0x4d79a8,null))['catch'](handleError(_0x4d79a8,null));};exports['show']=function(_0x290888,_0x412751){return pm2[_0xcd8b('0x15')](_0x290888[_0xcd8b('0x16')]['id'])[_0xcd8b('0x11')](respondWithResult(_0x412751,null))[_0xcd8b('0x11')](handleEntityNotFound(_0x412751,null))[_0xcd8b('0x17')](handleError(_0x412751,null));};exports[_0xcd8b('0x18')]=function(_0x3f2ac4,_0x12ace9){if(_0x3f2ac4['body']['name']&&_0x3f2ac4[_0xcd8b('0x19')][_0xcd8b('0x1a')]){var _0x19e1e2=path[_0xcd8b('0x1b')](__dirname,_0xcd8b('0x1c'),_0x3f2ac4['body'][_0xcd8b('0x1a')]);var _0x27ffcd=process[_0xcd8b('0x1d')]();process[_0xcd8b('0x1e')](path[_0xcd8b('0x1f')](_0x19e1e2));return execChildProcess()[_0xcd8b('0x11')](function(_0x398486){process[_0xcd8b('0x1e')](_0x27ffcd);return pm2['start']({'name':_0x3f2ac4[_0xcd8b('0x19')][_0xcd8b('0xb')],'script':_0x19e1e2});})[_0xcd8b('0x11')](function(_0xd73022){pm2[_0xcd8b('0x20')]();return _0xd73022[0x0];})[_0xcd8b('0x11')](respondWithResult(_0x12ace9,0xc9))[_0xcd8b('0x17')](handleError(_0x12ace9,null));}else{return _0x12ace9[_0xcd8b('0x7')](0x1f4)[_0xcd8b('0xc')]({'message':_0xcd8b('0x21')});}};exports[_0xcd8b('0x22')]=function(_0x10718b,_0x2c12ce){if(_0x10718b[_0xcd8b('0x19')]['id']){delete _0x10718b[_0xcd8b('0x19')]['id'];}var _0x50a023={'online':_0xcd8b('0x23'),'stopped':_0xcd8b('0x24')};if(_0x50a023[_0xcd8b('0x25')](_0x10718b[_0xcd8b('0x19')][_0xcd8b('0x7')])){return pm2[_0x50a023[_0x10718b['body'][_0xcd8b('0x7')]]](_0x10718b[_0xcd8b('0x16')]['id'])['then'](respondWithResult(_0x2c12ce,0xc8))[_0xcd8b('0x17')](handleError(_0x2c12ce,null));}else{return _0x2c12ce['status'](0x1f4)[_0xcd8b('0xc')]({'message':_0xcd8b('0x26')});}};exports['destroy']=function(_0x1ab0bb,_0xb65850){if(_0x1ab0bb[_0xcd8b('0x19')]['id']){delete _0x1ab0bb[_0xcd8b('0x19')]['id'];}if(_0x1ab0bb['params']['id']){return pm2['delete'](_0x1ab0bb['params']['id'])['then'](function(_0x25f6c6){pm2['dump']();return _0x25f6c6[0x0];})[_0xcd8b('0x11')](respondWithResult(_0xb65850,null))[_0xcd8b('0x17')](handleError(_0xb65850,null));}else{return _0xb65850[_0xcd8b('0x7')](0x1f4)[_0xcd8b('0xc')]({'message':_0xcd8b('0x27')});}}; \ No newline at end of file +var _0x2603=['cwd','dirname','chdir','start','body','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','child_process','exec','sendStatus','json','error','stack','name','status','send','npm\x20install','info','list','then','reject','motion2','length','catch','show','describe','script'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x2603,0x118));var _0x3260=function(_0x40634d,_0x2b64da){_0x40634d=_0x40634d-0x0;var _0x51f357=_0x2603[_0x40634d];return _0x51f357;};'use strict';var _=require(_0x3260('0x0'));var pm2=require(_0x3260('0x1'));var logger=require(_0x3260('0x2'))('api');var path=require(_0x3260('0x3'));var exec=require(_0x3260('0x4'))[_0x3260('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x39d001,_0x5e03af){return function(_0x3e4f8f){if(!_0x3e4f8f){_0x39d001[_0x3260('0x6')](0x194);;}return _0x3e4f8f;};}function respondWithResult(_0x54b25f,_0x32761d){_0x32761d=_0x32761d||0xc8;return function(_0x4f2cab){if(_0x4f2cab){return _0x54b25f['status'](_0x32761d)[_0x3260('0x7')](_0x4f2cab);}return null;};}function handleError(_0x13a699,_0x52e3ab){_0x52e3ab=_0x52e3ab||0x1f4;return function(_0x33c65b){logger[_0x3260('0x8')](_0x33c65b[_0x3260('0x9')]);if(_0x33c65b[_0x3260('0xa')]){delete _0x33c65b[_0x3260('0xa')];}_0x13a699[_0x3260('0xb')](_0x52e3ab)[_0x3260('0xc')](_0x33c65b);};}function execChildProcess(){return new BPromise(function(_0x79444f,_0x287e3f){exec(_0x3260('0xd'),function(_0x352113,_0x7f9600,_0x8e7abb){logger[_0x3260('0xe')](_0x7f9600);logger[_0x3260('0xe')](_0x8e7abb);if(_0x352113){logger['error'](_0x352113);return _0x287e3f(_0x352113);}return _0x79444f(_0x7f9600);});});}exports['index']=function(_0x38bcf1,_0x52f7fa){return pm2[_0x3260('0xf')]()[_0x3260('0x10')](function(_0x3561e4){if(_0x3561e4){var _0x3398db=_[_0x3260('0x11')](_0x3561e4,function(_0x3e34e2){return _0x3e34e2['name']==='express'||_0x3e34e2[_0x3260('0xa')]===_0x3260('0x12');});return{'rows':_0x3398db,'count':_0x3398db[_0x3260('0x13')]};}return null;})[_0x3260('0x10')](respondWithResult(_0x52f7fa,null))[_0x3260('0x14')](handleError(_0x52f7fa,null));};exports[_0x3260('0x15')]=function(_0x28ea3a,_0x44a3bc){return pm2[_0x3260('0x16')](_0x28ea3a['params']['id'])[_0x3260('0x10')](respondWithResult(_0x44a3bc,null))[_0x3260('0x10')](handleEntityNotFound(_0x44a3bc,null))[_0x3260('0x14')](handleError(_0x44a3bc,null));};exports['create']=function(_0x38bc85,_0x2e4dba){if(_0x38bc85['body'][_0x3260('0xa')]&&_0x38bc85['body'][_0x3260('0x17')]){var _0xfc032d=path['join'](__dirname,'../../files/plugins',_0x38bc85['body'][_0x3260('0x17')]);var _0x5e654a=process[_0x3260('0x18')]();process['chdir'](path[_0x3260('0x19')](_0xfc032d));return execChildProcess()['then'](function(_0x4d9dd2){process[_0x3260('0x1a')](_0x5e654a);return pm2[_0x3260('0x1b')]({'name':_0x38bc85[_0x3260('0x1c')]['name'],'script':_0xfc032d});})['then'](function(_0x2affcc){pm2['dump']();return _0x2affcc[0x0];})[_0x3260('0x10')](respondWithResult(_0x2e4dba,0xc9))[_0x3260('0x14')](handleError(_0x2e4dba,null));}else{return _0x2e4dba['status'](0x1f4)[_0x3260('0xc')]({'message':_0x3260('0x1d')});}};exports['update']=function(_0x570e8f,_0x12277b){if(_0x570e8f[_0x3260('0x1c')]['id']){delete _0x570e8f['body']['id'];}var _0x3499d2={'online':_0x3260('0x1e'),'stopped':_0x3260('0x1f')};if(_0x3499d2[_0x3260('0x20')](_0x570e8f['body'][_0x3260('0xb')])){return pm2[_0x3499d2[_0x570e8f[_0x3260('0x1c')][_0x3260('0xb')]]](_0x570e8f[_0x3260('0x21')]['id'])['then'](respondWithResult(_0x12277b,0xc8))['catch'](handleError(_0x12277b,null));}else{return _0x12277b['status'](0x1f4)['send']({'message':_0x3260('0x22')});}};exports[_0x3260('0x23')]=function(_0x2ffbe9,_0x231212){if(_0x2ffbe9[_0x3260('0x1c')]['id']){delete _0x2ffbe9['body']['id'];}if(_0x2ffbe9['params']['id']){return pm2['delete'](_0x2ffbe9[_0x3260('0x21')]['id'])[_0x3260('0x10')](function(_0x39c101){pm2[_0x3260('0x24')]();return _0x39c101[0x0];})[_0x3260('0x10')](respondWithResult(_0x231212,null))[_0x3260('0x14')](handleError(_0x231212,null));}else{return _0x231212[_0x3260('0xb')](0x1f4)[_0x3260('0xc')]({'message':_0x3260('0x25')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 92d074f..db05398 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 _0xfcbb=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path'];(function(_0x2ab5ac,_0x477880){var _0x10fd65=function(_0x226faf){while(--_0x226faf){_0x2ab5ac['push'](_0x2ab5ac['shift']());}};_0x10fd65(++_0x477880);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x4aeaa8,_0x1e48fb){_0x4aeaa8=_0x4aeaa8-0x0;var _0x38ce9d=_0xfcbb[_0x4aeaa8];return _0x38ce9d;};'use strict';var multer=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var path=require(_0xbfcb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbfcb('0x3')]();var fs_extra=require(_0xbfcb('0x4'));var auth=require(_0xbfcb('0x5'));var interaction=require(_0xbfcb('0x6'));var config=require(_0xbfcb('0x7'));module['exports']=router; \ No newline at end of file +var _0xfd07=['multer','util','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x562cd7,_0x5ae8e7){var _0x30f50d=function(_0x43b995){while(--_0x43b995){_0x562cd7['push'](_0x562cd7['shift']());}};_0x30f50d(++_0x5ae8e7);}(_0xfd07,0x104));var _0x7fd0=function(_0x371d15,_0xd98587){_0x371d15=_0x371d15-0x0;var _0x32afdf=_0xfd07[_0x371d15];return _0x32afdf;};'use strict';var multer=require(_0x7fd0('0x0'));var util=require(_0x7fd0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7fd0('0x2'));var auth=require(_0x7fd0('0x3'));var interaction=require(_0x7fd0('0x4'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 471df80..d04b587 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 _0xbd6c=['INTEGER','sequelize','exports','STRING','DATE'];(function(_0x3ab15e,_0x141d35){var _0x15b4b4=function(_0xa8fc02){while(--_0xa8fc02){_0x3ab15e['push'](_0x3ab15e['shift']());}};_0x15b4b4(++_0x141d35);}(_0xbd6c,0x92));var _0xcbd6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbd6c[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xcbd6('0x0'));module[_0xcbd6('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xcbd6('0x2')]},'scheduledat':{'type':Sequelize[_0xcbd6('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xcbd6('0x3')]},'responsetime':{'type':Sequelize[_0xcbd6('0x3')]},'ringtime':{'type':Sequelize[_0xcbd6('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xcbd6('0x2')]},'campaigntype':{'type':Sequelize[_0xcbd6('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdb31=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xdb31,0x166));var _0x1db3=function(_0x5a93f0,_0x172b1b){_0x5a93f0=_0x5a93f0-0x0;var _0x53844d=_0xdb31[_0x5a93f0];return _0x53844d;};'use strict';var Sequelize=require(_0x1db3('0x0'));module[_0x1db3('0x1')]={'state':{'type':Sequelize[_0x1db3('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x1db3('0x3')]},'scheduledat':{'type':Sequelize[_0x1db3('0x4')]},'uniqueid':{'type':Sequelize[_0x1db3('0x3')]},'starttime':{'type':Sequelize[_0x1db3('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x1db3('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1db3('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index d2dd7fb..d242179 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 _0x2fbb=['util','api','request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','lodash'];(function(_0x3eac8f,_0x215e30){var _0x433405=function(_0x16d71b){while(--_0x16d71b){_0x3eac8f['push'](_0x3eac8f['shift']());}};_0x433405(++_0x215e30);}(_0x2fbb,0x131));var _0xb2fb=function(_0x2c79f4,_0x5b9005){_0x2c79f4=_0x2c79f4-0x0;var _0x50e964=_0x2fbb[_0x2c79f4];return _0x50e964;};'use strict';var _=require(_0xb2fb('0x0'));var util=require(_0xb2fb('0x1'));var logger=require('../../config/logger')(_0xb2fb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb2fb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2fb('0x4'));var config=require(_0xb2fb('0x5'));var attributes=require(_0xb2fb('0x6'));module['exports']=function(_0x4a7595,_0x341a9b){return _0x4a7595[_0xb2fb('0x7')](_0xb2fb('0x8'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33dd=['./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x33dd,0xc6));var _0xd33d=function(_0xd1fe,_0x1325f3){_0xd1fe=_0xd1fe-0x0;var _0x3e94c5=_0x33dd[_0xd1fe];return _0x3e94c5;};'use strict';var _=require(_0xd33d('0x0'));var util=require(_0xd33d('0x1'));var logger=require(_0xd33d('0x2'))(_0xd33d('0x3'));var moment=require(_0xd33d('0x4'));var BPromise=require(_0xd33d('0x5'));var rp=require(_0xd33d('0x6'));var fs=require('fs');var path=require(_0xd33d('0x7'));var rimraf=require(_0xd33d('0x8'));var config=require(_0xd33d('0x9'));var attributes=require(_0xd33d('0xa'));module['exports']=function(_0x173065,_0x4e332c){return _0x173065['define'](_0xd33d('0xb'),attributes,{'tableName':_0xd33d('0xc'),'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 778416d..69189d5 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 _0xaaaa=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','create','body','options','CreateReportAgentPreview','lodash','randomstring','ioredis','../../config/utils'];(function(_0x3b0912,_0x39d739){var _0xa8f339=function(_0x6a31ab){while(--_0x6a31ab){_0x3b0912['push'](_0x3b0912['shift']());}};_0xa8f339(++_0x39d739);}(_0xaaaa,0xec));var _0xaaaa=function(_0x4abc7f,_0xee5492){_0x4abc7f=_0x4abc7f-0x0;var _0xed4218=_0xaaaa[_0x4abc7f];return _0xed4218;};'use strict';var _=require(_0xaaaa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaaaa('0x1'));var fs=require('fs');var Redis=require(_0xaaaa('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xaaaa('0x3'));var logger=require(_0xaaaa('0x4'))(_0xaaaa('0x5'));var config=require(_0xaaaa('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaaaa('0x7')][_0xaaaa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2df54a,_0x192fdd,_0x23180c){return new BPromise(function(_0x7765db,_0x27f7c0){return client[_0xaaaa('0x9')](_0x2df54a,_0x23180c)[_0xaaaa('0xa')](function(_0xd8dc52){logger[_0xaaaa('0xb')](_0xaaaa('0xc'),_0x192fdd,'request\x20sent');logger[_0xaaaa('0xd')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x192fdd,_0xaaaa('0xe'),JSON[_0xaaaa('0xf')](_0xd8dc52));if(_0xd8dc52[_0xaaaa('0x10')]){if(_0xd8dc52[_0xaaaa('0x10')][_0xaaaa('0x11')]===0x1f4){logger[_0xaaaa('0x10')](_0xaaaa('0xc'),_0x192fdd,_0xd8dc52[_0xaaaa('0x10')]['message']);return _0x27f7c0(_0xd8dc52[_0xaaaa('0x10')][_0xaaaa('0x12')]);}logger['error'](_0xaaaa('0xc'),_0x192fdd,_0xd8dc52[_0xaaaa('0x10')][_0xaaaa('0x12')]);return _0x7765db(_0xd8dc52['error'][_0xaaaa('0x12')]);}else{logger[_0xaaaa('0xb')](_0xaaaa('0xc'),_0x192fdd,_0xaaaa('0xe'));_0x7765db(_0xd8dc52['result'][_0xaaaa('0x12')]);}})[_0xaaaa('0x13')](function(_0x517311){logger[_0xaaaa('0x10')](_0xaaaa('0xc'),_0x192fdd,_0x517311);_0x27f7c0(_0x517311);});});}exports['CreateReportAgentPreview']=function(_0x55d163){var _0x1e181e=this;return new Promise(function(_0x23b126,_0x34b494){return db['ReportAgentPreview'][_0xaaaa('0x14')](_0x55d163[_0xaaaa('0x15')],{'raw':_0x55d163['options']?_0x55d163[_0xaaaa('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xaaaa('0xa')](function(_0x2c2b90){logger[_0xaaaa('0xb')](_0xaaaa('0x17'),_0x55d163);logger[_0xaaaa('0xd')](_0xaaaa('0x17'),_0x55d163,JSON[_0xaaaa('0xf')](_0x2c2b90));_0x23b126(_0x2c2b90);})[_0xaaaa('0x13')](function(_0x3eb890){logger['error'](_0xaaaa('0x17'),_0x3eb890[_0xaaaa('0x12')],_0x55d163);_0x34b494(_0x1e181e[_0xaaaa('0x10')](0x1f4,_0x3eb890[_0xaaaa('0x12')]));});});}; \ No newline at end of file +var _0xb61d=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','create','options','raw','CreateReportAgentPreview','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xb61d,0x194));var _0xdb61=function(_0x21dd11,_0xd75fe){_0x21dd11=_0x21dd11-0x0;var _0x3f6b76=_0xb61d[_0x21dd11];return _0x3f6b76;};'use strict';var _=require(_0xdb61('0x0'));var util=require(_0xdb61('0x1'));var moment=require('moment');var BPromise=require(_0xdb61('0x2'));var rs=require(_0xdb61('0x3'));var fs=require('fs');var Redis=require(_0xdb61('0x4'));var db=require(_0xdb61('0x5'))['db'];var utils=require(_0xdb61('0x6'));var logger=require(_0xdb61('0x7'))(_0xdb61('0x8'));var config=require(_0xdb61('0x9'));var jayson=require(_0xdb61('0xa'));var client=jayson[_0xdb61('0xb')][_0xdb61('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15c993,_0x4b047a,_0x57e202){return new BPromise(function(_0x22ee2c,_0x4ced0d){return client['request'](_0x15c993,_0x57e202)[_0xdb61('0xd')](function(_0x5ea832){logger[_0xdb61('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x4b047a,'request\x20sent');logger[_0xdb61('0xf')](_0xdb61('0x10'),_0x4b047a,_0xdb61('0x11'),JSON[_0xdb61('0x12')](_0x5ea832));if(_0x5ea832[_0xdb61('0x13')]){if(_0x5ea832[_0xdb61('0x13')]['code']===0x1f4){logger[_0xdb61('0x13')](_0xdb61('0x14'),_0x4b047a,_0x5ea832[_0xdb61('0x13')][_0xdb61('0x15')]);return _0x4ced0d(_0x5ea832['error'][_0xdb61('0x15')]);}logger[_0xdb61('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x4b047a,_0x5ea832[_0xdb61('0x13')]['message']);return _0x22ee2c(_0x5ea832[_0xdb61('0x13')][_0xdb61('0x15')]);}else{logger['info'](_0xdb61('0x14'),_0x4b047a,_0xdb61('0x11'));_0x22ee2c(_0x5ea832[_0xdb61('0x16')]['message']);}})[_0xdb61('0x17')](function(_0x41a0d2){logger[_0xdb61('0x13')](_0xdb61('0x14'),_0x4b047a,_0x41a0d2);_0x4ced0d(_0x41a0d2);});});}exports['CreateReportAgentPreview']=function(_0x4ab2a7){var _0x5703be=this;return new Promise(function(_0x108bef,_0x2af851){return db['ReportAgentPreview'][_0xdb61('0x18')](_0x4ab2a7['body'],{'raw':_0x4ab2a7[_0xdb61('0x19')]?_0x4ab2a7[_0xdb61('0x19')][_0xdb61('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5a28db){logger['info'](_0xdb61('0x1b'),_0x4ab2a7);logger[_0xdb61('0xf')](_0xdb61('0x1b'),_0x4ab2a7,JSON[_0xdb61('0x12')](_0x5a28db));_0x108bef(_0x5a28db);})['catch'](function(_0x13edb0){logger[_0xdb61('0x13')](_0xdb61('0x1b'),_0x13edb0[_0xdb61('0x15')],_0x4ab2a7);_0x2af851(_0x5703be['error'](0x1f4,_0x13edb0[_0xdb61('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index ed182c7..b057848 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 _0xfea2=['/agents/:id/notify','agentNotify','util','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showWhatsappQueues'];(function(_0x52bb6e,_0x4485fa){var _0x5ecd9=function(_0x5bf14c){while(--_0x5bf14c){_0x52bb6e['push'](_0x52bb6e['shift']());}};_0x5ecd9(++_0x4485fa);}(_0xfea2,0xa4));var _0x2fea=function(_0x577f24,_0x415e8c){_0x577f24=_0x577f24-0x0;var _0x4b82f7=_0xfea2[_0x577f24];return _0x4b82f7;};'use strict';var multer=require('multer');var util=require(_0x2fea('0x0'));var path=require('path');var express=require(_0x2fea('0x1'));var router=express[_0x2fea('0x2')]();var auth=require(_0x2fea('0x3'));var controller=require(_0x2fea('0x4'));router['get'](_0x2fea('0x5'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x7')]);router[_0x2fea('0x8')](_0x2fea('0x9'),auth[_0x2fea('0x6')](),controller[_0x2fea('0xa')]);router[_0x2fea('0x8')](_0x2fea('0xb'),auth['isAuthenticated'](),controller[_0x2fea('0xc')]);router[_0x2fea('0x8')](_0x2fea('0xd'),auth[_0x2fea('0x6')](),controller[_0x2fea('0xe')]);router['get'](_0x2fea('0xf'),auth[_0x2fea('0x6')](),controller['chatQueues']);router['get'](_0x2fea('0x10'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x11')]);router[_0x2fea('0x8')](_0x2fea('0x12'),auth[_0x2fea('0x6')](),controller['mailAccounts']);router[_0x2fea('0x8')]('/openchannel/queues',auth[_0x2fea('0x6')](),controller['openchannelQueues']);router[_0x2fea('0x8')](_0x2fea('0x13'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x14')]);router['get'](_0x2fea('0x15'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x16')]);router[_0x2fea('0x8')](_0x2fea('0x17'),auth['isAuthenticated'](),controller['faxQueues']);router['get'](_0x2fea('0x18'),auth['isAuthenticated'](),controller[_0x2fea('0x19')]);router[_0x2fea('0x8')]('/voice/queues/channels',auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0x2fea('0x8')](_0x2fea('0x1a'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x1b')]);router[_0x2fea('0x8')](_0x2fea('0x1c'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x1d')]);router[_0x2fea('0x8')](_0x2fea('0x1e'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x1f')]);router['get'](_0x2fea('0x20'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x21')]);router[_0x2fea('0x22')]('/voice/queues/:id',auth[_0x2fea('0x6')](),controller[_0x2fea('0x23')]);router[_0x2fea('0x8')]('/outbound',auth['isAuthenticated'](),controller['outbound']);router[_0x2fea('0x8')](_0x2fea('0x24'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x25')]);router[_0x2fea('0x8')](_0x2fea('0x26'),auth['isAuthenticated'](),controller[_0x2fea('0x27')]);router[_0x2fea('0x22')](_0x2fea('0x28'),auth['isAuthenticated'](),controller[_0x2fea('0x29')]);router['get']('/telephones',auth[_0x2fea('0x6')](),controller[_0x2fea('0x2a')]);router[_0x2fea('0x8')]('/trunks',auth['isAuthenticated'](),controller[_0x2fea('0x2b')]);router['get']('/campaigns',auth[_0x2fea('0x6')](),controller[_0x2fea('0x2c')]);router[_0x2fea('0x8')](_0x2fea('0x2d'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x2e')]);router['get'](_0x2fea('0x2f'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x30')]);router[_0x2fea('0x8')](_0x2fea('0x31'),auth[_0x2fea('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0x2fea('0x8')]('/openchannel/queues/waitinginteractions',auth[_0x2fea('0x6')](),controller[_0x2fea('0x32')]);router['get'](_0x2fea('0x33'),auth[_0x2fea('0x6')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x2fea('0x8')](_0x2fea('0x34'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x35')]);router[_0x2fea('0x8')](_0x2fea('0x36'),auth['isAuthenticated'](),controller[_0x2fea('0x37')]);router[_0x2fea('0x8')](_0x2fea('0x38'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x39')]);router[_0x2fea('0x3a')](_0x2fea('0x3b'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x3c')](_0x2fea('0x3d')));router['get'](_0x2fea('0x3e'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x3f')]);router[_0x2fea('0x3a')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0x2fea('0x3c')](_0x2fea('0x40')));router[_0x2fea('0x8')](_0x2fea('0x41'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x42')]);router[_0x2fea('0x3a')](_0x2fea('0x43'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x3c')](_0x2fea('0x44')));router[_0x2fea('0x8')](_0x2fea('0x45'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x46')]);router['post']('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x2fea('0x3c')](_0x2fea('0x47')));router['get']('/openchannel/queues/:id',auth[_0x2fea('0x6')](),controller[_0x2fea('0x48')]);router[_0x2fea('0x3a')](_0x2fea('0x49'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x3c')](_0x2fea('0x4a')));router[_0x2fea('0x3a')](_0x2fea('0x4b'),auth[_0x2fea('0x6')](),controller[_0x2fea('0x3c')](_0x2fea('0x4c')));router[_0x2fea('0x8')](_0x2fea('0x4d'),auth[_0x2fea('0x6')](),controller['showSmsQueues']);router['get']('/whatsapp/queues/:id',auth[_0x2fea('0x6')](),controller[_0x2fea('0x4e')]);router[_0x2fea('0x3a')](_0x2fea('0x4f'),auth['isAuthenticated'](),controller[_0x2fea('0x50')]);module['exports']=router; \ No newline at end of file +var _0x9993=['openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','agentNotify','exports','multer','express','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions'];(function(_0xa0e884,_0x5069df){var _0x5cd14c=function(_0x4c8bef){while(--_0x4c8bef){_0xa0e884['push'](_0xa0e884['shift']());}};_0x5cd14c(++_0x5069df);}(_0x9993,0x109));var _0x3999=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x9993[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x3999('0x0'));var util=require('util');var path=require('path');var express=require(_0x3999('0x1'));var router=express['Router']();var auth=require(_0x3999('0x2'));var controller=require(_0x3999('0x3'));router['get'](_0x3999('0x4'),auth[_0x3999('0x5')](),controller['voiceChannels']);router[_0x3999('0x6')](_0x3999('0x7'),auth['isAuthenticated'](),controller[_0x3999('0x8')]);router[_0x3999('0x6')](_0x3999('0x9'),auth[_0x3999('0x5')](),controller['voiceChannelStopMixMonitor']);router[_0x3999('0x6')](_0x3999('0xa'),auth[_0x3999('0x5')](),controller['voiceQueues']);router['get'](_0x3999('0xb'),auth[_0x3999('0x5')](),controller[_0x3999('0xc')]);router[_0x3999('0x6')](_0x3999('0xd'),auth[_0x3999('0x5')](),controller['mailQueues']);router[_0x3999('0x6')](_0x3999('0xe'),auth[_0x3999('0x5')](),controller[_0x3999('0xf')]);router['get'](_0x3999('0x10'),auth['isAuthenticated'](),controller[_0x3999('0x11')]);router[_0x3999('0x6')](_0x3999('0x12'),auth[_0x3999('0x5')](),controller[_0x3999('0x13')]);router[_0x3999('0x6')](_0x3999('0x14'),auth[_0x3999('0x5')](),controller[_0x3999('0x15')]);router['get'](_0x3999('0x16'),auth[_0x3999('0x5')](),controller['faxQueues']);router['get']('/voice/queues/preview/:id',auth[_0x3999('0x5')](),controller['voiceQueuesPreview']);router[_0x3999('0x6')](_0x3999('0x17'),auth[_0x3999('0x5')](),controller[_0x3999('0x18')]);router[_0x3999('0x6')](_0x3999('0x19'),auth[_0x3999('0x5')](),controller[_0x3999('0x1a')]);router[_0x3999('0x6')](_0x3999('0x1b'),auth[_0x3999('0x5')](),controller[_0x3999('0x1c')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router['get'](_0x3999('0x1d'),auth[_0x3999('0x5')](),controller[_0x3999('0x1e')]);router[_0x3999('0x1f')]('/voice/queues/:id',auth[_0x3999('0x5')](),controller['updateVoiceQueue']);router['get'](_0x3999('0x20'),auth[_0x3999('0x5')](),controller[_0x3999('0x21')]);router[_0x3999('0x6')](_0x3999('0x22'),auth[_0x3999('0x5')](),controller['outboundChannels']);router[_0x3999('0x6')](_0x3999('0x23'),auth[_0x3999('0x5')](),controller[_0x3999('0x24')]);router[_0x3999('0x1f')](_0x3999('0x25'),auth[_0x3999('0x5')](),controller['agentCapacity']);router['get'](_0x3999('0x26'),auth['isAuthenticated'](),controller[_0x3999('0x27')]);router[_0x3999('0x6')](_0x3999('0x28'),auth[_0x3999('0x5')](),controller[_0x3999('0x29')]);router[_0x3999('0x6')](_0x3999('0x2a'),auth[_0x3999('0x5')](),controller['campaigns']);router['get'](_0x3999('0x2b'),auth[_0x3999('0x5')](),controller[_0x3999('0x2c')]);router[_0x3999('0x6')](_0x3999('0x2d'),auth[_0x3999('0x5')](),controller['chatQueuesWaitingInteractions']);router[_0x3999('0x6')]('/mail/queues/waitinginteractions',auth[_0x3999('0x5')](),controller[_0x3999('0x2e')]);router[_0x3999('0x6')]('/openchannel/queues/waitinginteractions',auth[_0x3999('0x5')](),controller[_0x3999('0x2f')]);router[_0x3999('0x6')](_0x3999('0x30'),auth['isAuthenticated'](),controller[_0x3999('0x31')]);router[_0x3999('0x6')](_0x3999('0x32'),auth[_0x3999('0x5')](),controller[_0x3999('0x33')]);router[_0x3999('0x6')](_0x3999('0x34'),auth[_0x3999('0x5')](),controller[_0x3999('0x35')]);router[_0x3999('0x6')](_0x3999('0x36'),auth[_0x3999('0x5')](),controller['faxQueuesWaitingInteractions']);router[_0x3999('0x37')](_0x3999('0x38'),auth['isAuthenticated'](),controller[_0x3999('0x39')]('mail'));router[_0x3999('0x6')](_0x3999('0x3a'),auth['isAuthenticated'](),controller['showMailQueues']);router[_0x3999('0x37')](_0x3999('0x3b'),auth[_0x3999('0x5')](),controller['queueNotify'](_0x3999('0x3c')));router[_0x3999('0x6')](_0x3999('0x3d'),auth['isAuthenticated'](),controller[_0x3999('0x3e')]);router['post']('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x3999('0x39')](_0x3999('0x3f')));router[_0x3999('0x6')](_0x3999('0x40'),auth['isAuthenticated'](),controller[_0x3999('0x41')]);router[_0x3999('0x37')](_0x3999('0x42'),auth['isAuthenticated'](),controller[_0x3999('0x39')](_0x3999('0x43')));router[_0x3999('0x6')](_0x3999('0x44'),auth[_0x3999('0x5')](),controller[_0x3999('0x45')]);router['post'](_0x3999('0x46'),auth['isAuthenticated'](),controller[_0x3999('0x39')]('sms'));router[_0x3999('0x37')](_0x3999('0x47'),auth['isAuthenticated'](),controller[_0x3999('0x39')](_0x3999('0x48')));router[_0x3999('0x6')](_0x3999('0x49'),auth['isAuthenticated'](),controller[_0x3999('0x4a')]);router['get'](_0x3999('0x4b'),auth[_0x3999('0x5')](),controller['showWhatsappQueues']);router[_0x3999('0x37')]('/agents/:id/notify',auth[_0x3999('0x5')](),controller[_0x3999('0x4c')]);module[_0x3999('0x4d')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index db34f2e..b804faf 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 _0x2cf3=['showFaxQueues','FaxQueues','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','type','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Agent\x20not\x20found','Message','messageId','TransferReport','agentTransferTimeout','bluebird','moment','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','code','message','catch','status','sendStatus','stack','name','send','isNil','rows','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','interface','format','agent','internal','AgentCapacity','telephones','trunks','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','whatsappQueues','WhatsappQueues'];(function(_0x44650b,_0x5af069){var _0x13b205=function(_0x404cec){while(--_0x404cec){_0x44650b['push'](_0x44650b['shift']());}};_0x13b205(++_0x5af069);}(_0x2cf3,0x19a));var _0x32cf=function(_0x2d7bff,_0x530aca){_0x2d7bff=_0x2d7bff-0x0;var _0xa21316=_0x2cf3[_0x2d7bff];return _0xa21316;};'use strict';var BPromise=require(_0x32cf('0x0'));var moment=require(_0x32cf('0x1'));var _=require('lodash');var util=require(_0x32cf('0x2'));var db=require(_0x32cf('0x3'))['db'];var logger=require('../../config/logger')(_0x32cf('0x4'));var jayson=require(_0x32cf('0x5'));var amiClient=jayson[_0x32cf('0x6')][_0x32cf('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x32cf('0x6')][_0x32cf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x351389,_0x5252d4,_0x17c3a5){return new BPromise(function(_0x5b3087,_0x160938){var _0x5d1875=_0x17c3a5?_0x17c3a5:amiClient;return _0x5d1875[_0x32cf('0x8')](_0x351389,_0x5252d4)[_0x32cf('0x9')](function(_0x207163){if(_0x207163[_0x32cf('0xa')]){if(_0x207163[_0x32cf('0xa')][_0x32cf('0xb')]===0x1f4){return _0x160938(_0x207163['error']['message']);}return _0x5b3087(_0x207163[_0x32cf('0xa')][_0x32cf('0xc')]);}else{_0x5b3087(_0x207163['result']);}})[_0x32cf('0xd')](function(_0xdcee22){_0x160938(_0xdcee22);});});}function respondWithResult(_0x4a3507,_0x2a4098){_0x2a4098=_0x2a4098||0xc8;return function(_0x1b9f26){if(_0x1b9f26){return _0x4a3507[_0x32cf('0xe')](_0x2a4098)['json'](_0x1b9f26);}return _0x4a3507[_0x32cf('0xf')](0x194);};}function handleError(_0xdeaa7f,_0x3d818e){_0x3d818e=_0x3d818e||0x1f4;return function(_0x39d6a6){logger[_0x32cf('0xa')](_0x39d6a6[_0x32cf('0x10')]);if(_0x39d6a6[_0x32cf('0x11')]){delete _0x39d6a6[_0x32cf('0x11')];}_0xdeaa7f['status'](_0x3d818e)[_0x32cf('0x12')](_0x39d6a6);};}function findById(_0x3bf071){return function(_0x56362d){if(!_[_0x32cf('0x13')](_0x3bf071)&&!_[_0x32cf('0x13')](_0x56362d)&&!_['isNil'](_0x56362d[_0x32cf('0x14')])){return _['find'](_0x56362d[_0x32cf('0x14')],function(_0x34efd2){return _0x34efd2['id']==_0x3bf071;});}return null;};}exports[_0x32cf('0x15')]=function(_0x499b5f,_0x22c933){return respondWithRpcPromise(_0x32cf('0x16'),_0x499b5f[_0x32cf('0x17')])[_0x32cf('0x9')](respondWithResult(_0x22c933,null))[_0x32cf('0xd')](handleError(_0x22c933,null));};exports['voiceChannelMixMonitor']=function(_0x178806,_0x5b804a){return respondWithRpcPromise(_0x32cf('0x18'),_[_0x32cf('0x19')](_0x178806[_0x32cf('0x17')],_0x178806[_0x32cf('0x1a')]))['then'](respondWithResult(_0x5b804a,null))[_0x32cf('0xd')](handleError(_0x5b804a,null));};exports[_0x32cf('0x1b')]=function(_0x269bdb,_0x5a6457){return respondWithRpcPromise(_0x32cf('0x1c'),_[_0x32cf('0x19')](_0x269bdb[_0x32cf('0x17')],_0x269bdb[_0x32cf('0x1a')]))[_0x32cf('0x9')](respondWithResult(_0x5a6457,null))[_0x32cf('0xd')](handleError(_0x5a6457,null));};exports[_0x32cf('0x1d')]=function(_0x28006d,_0x472423){return respondWithRpcPromise(_0x32cf('0x1e'),_0x28006d[_0x32cf('0x17')])['then'](respondWithResult(_0x472423,null))[_0x32cf('0xd')](handleError(_0x472423,null));};exports['showVoiceQueues']=function(_0x5a2cde,_0x7eb9cd){return respondWithRpcPromise('VoiceQueues',_0x5a2cde[_0x32cf('0x17')])['then'](findById(_0x5a2cde['params']['id']))['then'](respondWithResult(_0x7eb9cd,null))[_0x32cf('0xd')](handleError(_0x7eb9cd,null));};exports['updateVoiceQueue']=function(_0x85249a,_0x57c966){return respondWithRpcPromise(_0x32cf('0x1f'),_[_0x32cf('0x19')](_0x85249a[_0x32cf('0x20')],_0x85249a[_0x32cf('0x1a')]))[_0x32cf('0x9')](respondWithResult(_0x57c966,null))['catch'](handleError(_0x57c966,null));};exports[_0x32cf('0x21')]=function(_0x29b14d,_0x5ae12f){return respondWithRpcPromise(_0x32cf('0x22'),_[_0x32cf('0x19')](_0x29b14d[_0x32cf('0x17')],_0x29b14d[_0x32cf('0x1a')]))[_0x32cf('0x9')](respondWithResult(_0x5ae12f,null))[_0x32cf('0xd')](handleError(_0x5ae12f,null));};exports[_0x32cf('0x23')]=function(_0x427f29,_0x236e47){return respondWithRpcPromise(_0x32cf('0x24'),_0x427f29[_0x32cf('0x17')])[_0x32cf('0x9')](respondWithResult(_0x236e47,null))[_0x32cf('0xd')](handleError(_0x236e47,null));};exports[_0x32cf('0x25')]=function(_0x52f735,_0x4bffd7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x32cf('0x19')](_0x52f735[_0x32cf('0x17')],_0x52f735[_0x32cf('0x1a')]))['then'](respondWithResult(_0x4bffd7,null))[_0x32cf('0xd')](handleError(_0x4bffd7,null));};exports[_0x32cf('0x26')]=function(_0x255609,_0x5441bc){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x32cf('0x19')](_0x255609[_0x32cf('0x17')],_0x255609['params']))[_0x32cf('0x9')](respondWithResult(_0x5441bc,null))[_0x32cf('0xd')](handleError(_0x5441bc,null));};exports[_0x32cf('0x27')]=function(_0x59ce6e,_0x134508){return respondWithRpcPromise(_0x32cf('0x28'),_[_0x32cf('0x19')](_0x59ce6e['query'],_0x59ce6e[_0x32cf('0x1a')]))[_0x32cf('0x9')](respondWithResult(_0x134508,null))[_0x32cf('0xd')](handleError(_0x134508,null));};exports['outbound']=function(_0x183def,_0x2b3e9f){return respondWithRpcPromise(_0x32cf('0x29'),_0x183def['query'])[_0x32cf('0x9')](respondWithResult(_0x2b3e9f,null))[_0x32cf('0xd')](handleError(_0x2b3e9f,null));};exports[_0x32cf('0x2a')]=function(_0x171ea2,_0x55db79){return respondWithRpcPromise(_0x32cf('0x2b'),_0x171ea2[_0x32cf('0x17')])[_0x32cf('0x9')](respondWithResult(_0x55db79,null))['catch'](handleError(_0x55db79,null));};exports['agents']=function(_0x27c438,_0xe3f6b5){var _0x421e33;return respondWithRpcPromise('Agents',_0x27c438[_0x32cf('0x17')])[_0x32cf('0x9')](function(_0x17e833){_0x421e33=_0x17e833;return respondWithRpcPromise(_0x32cf('0x2c'),_0x27c438[_0x32cf('0x17')],routingClient);})['then'](function(_0x383d1e){return _[_0x32cf('0x19')]({},_0x383d1e,_0x421e33);})[_0x32cf('0x9')](respondWithResult(_0xe3f6b5,null))[_0x32cf('0xd')](handleError(_0xe3f6b5,null));};exports['agentCapacity']=function(_0x361394,_0xb16921){if(_0x361394[_0x32cf('0x20')]&&_0x361394['body'][_0x32cf('0x2d')]&&_0x361394['user']&&_0x361394[_0x32cf('0x2e')]['name']){for(var _0x3c0458 in _0x361394[_0x32cf('0x20')][_0x32cf('0x2d')]){if(_0x361394[_0x32cf('0x20')][_0x32cf('0x2d')][_0x32cf('0x2f')](_0x3c0458)){db[_0x32cf('0x30')][_0x32cf('0x31')]({'where':{'channel':_0x3c0458,'membername':_0x361394['user'][_0x32cf('0x11')],'type':_0x32cf('0x32'),'exitAt':null,'uniqueid':_0x361394[_0x32cf('0x20')][_0x32cf('0x2d')][_0x3c0458]&&_0x361394[_0x32cf('0x20')][_0x32cf('0x2d')][_0x3c0458][_0x32cf('0x33')]?{'$notIn':_0x361394[_0x32cf('0x20')][_0x32cf('0x2d')][_0x3c0458]}:{'$ne':null}}})[_0x32cf('0x9')](function(_0x30bc77){var _0x39de9d=moment()['format'](_0x32cf('0x34'));for(var _0x1184e3=0x0,_0x214e9b=_0x30bc77[_0x32cf('0x33')];_0x1184e3<_0x214e9b;_0x1184e3+=0x1){_0x30bc77[_0x1184e3]['updateAttributes']({'exitAt':_0x39de9d});}});for(var _0x565655=0x0;_0x565655<_0x361394[_0x32cf('0x20')][_0x32cf('0x2d')][_0x3c0458][_0x32cf('0x33')];_0x565655+=0x1){db[_0x32cf('0x30')]['findOrCreate']({'where':{'channel':_0x3c0458,'membername':_0x361394[_0x32cf('0x2e')][_0x32cf('0x11')],'type':_0x32cf('0x32'),'uniqueid':_0x361394[_0x32cf('0x20')][_0x32cf('0x2d')][_0x3c0458][_0x565655],'exitAt':null},'defaults':{'channel':_0x3c0458,'membername':_0x361394[_0x32cf('0x2e')]['name'],'interface':_[_0x32cf('0x13')](_0x361394[_0x32cf('0x2e')][_0x32cf('0x35')])?util['format']('SIP/%s',_0x361394[_0x32cf('0x2e')][_0x32cf('0x11')]):_0x361394[_0x32cf('0x2e')][_0x32cf('0x35')],'type':'INTERACTION','enterAt':moment()[_0x32cf('0x36')](_0x32cf('0x34')),'role':_0x32cf('0x37'),'internal':_0x361394[_0x32cf('0x2e')][_0x32cf('0x38')],'uniqueid':_0x361394[_0x32cf('0x20')]['interaction'][_0x3c0458][_0x565655]}});}}}}return respondWithRpcPromise(_0x32cf('0x39'),{'id':_0x361394[_0x32cf('0x1a')]['id'],'capacity':_0x361394[_0x32cf('0x20')]['capacity']},routingClient)[_0x32cf('0x9')](respondWithResult(_0xb16921,null))['catch'](handleError(_0xb16921,null));};exports[_0x32cf('0x3a')]=function(_0x5af3f7,_0x30a672){return respondWithRpcPromise('Telephones',_0x5af3f7[_0x32cf('0x17')])[_0x32cf('0x9')](respondWithResult(_0x30a672,null))[_0x32cf('0xd')](handleError(_0x30a672,null));};exports[_0x32cf('0x3b')]=function(_0x2e7779,_0x4d7c86){return respondWithRpcPromise('Trunks',_0x2e7779[_0x32cf('0x17')])['then'](respondWithResult(_0x4d7c86,null))[_0x32cf('0xd')](handleError(_0x4d7c86,null));};exports['campaigns']=function(_0x3d51cc,_0x566da8){return respondWithRpcPromise(_0x32cf('0x3c'),_0x3d51cc[_0x32cf('0x17')])[_0x32cf('0x9')](respondWithResult(_0x566da8,null))[_0x32cf('0xd')](handleError(_0x566da8,null));};exports[_0x32cf('0x3d')]=function(_0x77aa6a,_0x3d2a78){return respondWithRpcPromise(_0x32cf('0x3e'),_0x77aa6a[_0x32cf('0x17')],routingClient)[_0x32cf('0x9')](respondWithResult(_0x3d2a78,null))[_0x32cf('0xd')](handleError(_0x3d2a78,null));};exports['showChatQueues']=function(_0x38759b,_0x18e924){return respondWithRpcPromise(_0x32cf('0x3e'),_0x38759b[_0x32cf('0x17')],routingClient)[_0x32cf('0x9')](findById(_0x38759b['params']['id']))[_0x32cf('0x9')](respondWithResult(_0x18e924,null))['catch'](handleError(_0x18e924,null));};exports[_0x32cf('0x3f')]=function(_0x3ebbec,_0x22942c){return respondWithRpcPromise(_0x32cf('0x40'),_0x3ebbec[_0x32cf('0x17')],routingClient)[_0x32cf('0x9')](respondWithResult(_0x22942c,null))[_0x32cf('0xd')](handleError(_0x22942c,null));};exports[_0x32cf('0x41')]=function(_0x3322a3,_0x2e3ff2){return respondWithRpcPromise('MailQueues',_0x3322a3[_0x32cf('0x17')],routingClient)[_0x32cf('0x9')](findById(_0x3322a3[_0x32cf('0x1a')]['id']))[_0x32cf('0x9')](respondWithResult(_0x2e3ff2,null))['catch'](handleError(_0x2e3ff2,null));};exports[_0x32cf('0x42')]=function(_0x39743f,_0x4559ed){return respondWithRpcPromise(_0x32cf('0x43'),_0x39743f[_0x32cf('0x17')],mailClient)['then'](respondWithResult(_0x4559ed,null))[_0x32cf('0xd')](handleError(_0x4559ed,null));};exports[_0x32cf('0x44')]=function(_0x27ad17,_0x2daf20){return respondWithRpcPromise(_0x32cf('0x45'),_0x27ad17['query'],routingClient)[_0x32cf('0x9')](respondWithResult(_0x2daf20,null))[_0x32cf('0xd')](handleError(_0x2daf20,null));};exports[_0x32cf('0x46')]=function(_0x5a09b9,_0x62fd85){return respondWithRpcPromise(_0x32cf('0x45'),_0x5a09b9[_0x32cf('0x17')],routingClient)[_0x32cf('0x9')](findById(_0x5a09b9[_0x32cf('0x1a')]['id']))[_0x32cf('0x9')](respondWithResult(_0x62fd85,null))[_0x32cf('0xd')](handleError(_0x62fd85,null));};exports[_0x32cf('0x47')]=function(_0x1d2b7d,_0x9c780b){return respondWithRpcPromise('SmsQueues',_0x1d2b7d[_0x32cf('0x17')],routingClient)[_0x32cf('0x9')](respondWithResult(_0x9c780b,null))[_0x32cf('0xd')](handleError(_0x9c780b,null));};exports['showSmsQueues']=function(_0x4c549c,_0xe38c83){return respondWithRpcPromise('SmsQueues',_0x4c549c['query'],routingClient)[_0x32cf('0x9')](findById(_0x4c549c['params']['id']))[_0x32cf('0x9')](respondWithResult(_0xe38c83,null))[_0x32cf('0xd')](handleError(_0xe38c83,null));};exports[_0x32cf('0x48')]=function(_0x2d6125,_0x4bb73d){return respondWithRpcPromise('WhatsappQueues',_0x2d6125['query'],routingClient)[_0x32cf('0x9')](respondWithResult(_0x4bb73d,null))[_0x32cf('0xd')](handleError(_0x4bb73d,null));};exports['showWhatsappQueues']=function(_0x1e7097,_0x1ea08b){return respondWithRpcPromise(_0x32cf('0x49'),_0x1e7097[_0x32cf('0x17')],routingClient)[_0x32cf('0x9')](findById(_0x1e7097[_0x32cf('0x1a')]['id']))[_0x32cf('0x9')](respondWithResult(_0x1ea08b,null))[_0x32cf('0xd')](handleError(_0x1ea08b,null));};exports['faxQueues']=function(_0x1031e8,_0x3175c8){return respondWithRpcPromise('FaxQueues',_0x1031e8['query'],routingClient)[_0x32cf('0x9')](respondWithResult(_0x3175c8,null))['catch'](handleError(_0x3175c8,null));};exports[_0x32cf('0x4a')]=function(_0x47e722,_0x142675){return respondWithRpcPromise(_0x32cf('0x4b'),_0x47e722[_0x32cf('0x17')],routingClient)[_0x32cf('0x9')](findById(_0x47e722['params']['id']))['then'](respondWithResult(_0x142675,null))['catch'](handleError(_0x142675,null));};exports['faxAccounts']=function(_0x15c9d3,_0x308ec6){return respondWithRpcPromise('FaxAccounts',_0x15c9d3[_0x32cf('0x17')])[_0x32cf('0x9')](respondWithResult(_0x308ec6,null))[_0x32cf('0xd')](handleError(_0x308ec6,null));};exports[_0x32cf('0x4c')]=function(_0x1b33ba,_0x49afc0){return respondWithRpcPromise(_0x32cf('0x4d'),_0x1b33ba[_0x32cf('0x17')],routingClient)[_0x32cf('0x9')](respondWithResult(_0x49afc0,null))[_0x32cf('0xd')](handleError(_0x49afc0,null));};exports[_0x32cf('0x4e')]=function(_0x50e117,_0xe682a9){return respondWithRpcPromise(_0x32cf('0x4f'),_0x50e117[_0x32cf('0x17')],routingClient)['then'](respondWithResult(_0xe682a9,null))['catch'](handleError(_0xe682a9,null));};exports[_0x32cf('0x50')]=function(_0x3fc6ca,_0x5080e3){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3fc6ca[_0x32cf('0x17')],routingClient)[_0x32cf('0x9')](respondWithResult(_0x5080e3,null))['catch'](handleError(_0x5080e3,null));};exports[_0x32cf('0x51')]=function(_0x2184f6,_0x1d37f0){return respondWithRpcPromise(_0x32cf('0x52'),_0x2184f6[_0x32cf('0x17')],routingClient)[_0x32cf('0x9')](function(_0x565cb5){if(_0x2184f6[_0x32cf('0x17')]['type']!==undefined){var _0x5d3084=_(_0x565cb5[_0x32cf('0x14')])[_0x32cf('0x53')]([_0x2184f6[_0x32cf('0x17')][_0x32cf('0x54')],_0x2184f6[_0x32cf('0x1a')]['id']])[_0x32cf('0x55')](_0x32cf('0x56'))[_0x32cf('0x57')]()[_0x32cf('0x58')]();return _0x565cb5['rows'][_0x32cf('0x53')](function(_0x459082){return _0x5d3084[_0x32cf('0x59')](_0x459082[_0x32cf('0x56')])>-0x1;});}else{return _0x565cb5[_0x32cf('0x14')][_0x32cf('0x53')](function(_0x1f92a5){return _0x1f92a5[_0x32cf('0x56')]===parseInt(_0x2184f6[_0x32cf('0x1a')]['id']);});}})[_0x32cf('0x9')](respondWithResult(_0x1d37f0,null))[_0x32cf('0xd')](handleError(_0x1d37f0,null));};exports[_0x32cf('0x5a')]=function(_0x12980b,_0x51cd6e){return respondWithRpcPromise(_0x32cf('0x5b'),_0x12980b[_0x32cf('0x17')],routingClient)[_0x32cf('0x9')](respondWithResult(_0x51cd6e,null))[_0x32cf('0xd')](handleError(_0x51cd6e,null));};exports[_0x32cf('0x5c')]=function(_0x40ce0e,_0x47bf61){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x40ce0e[_0x32cf('0x17')],routingClient)[_0x32cf('0x9')](respondWithResult(_0x47bf61,null))[_0x32cf('0xd')](handleError(_0x47bf61,null));};exports[_0x32cf('0x5d')]=function(_0x2051d0,_0x5329bc){return respondWithRpcPromise(_0x32cf('0x5e'),_0x2051d0[_0x32cf('0x17')],routingClient)[_0x32cf('0x9')](respondWithResult(_0x5329bc,null))[_0x32cf('0xd')](handleError(_0x5329bc,null));};exports[_0x32cf('0x5f')]=function(_0x50a5f1){return function(_0x251a23,_0x2215c0){var _0x3500dc,_0x2ad80e;var _0x54379d=_[_0x32cf('0x60')](_0x50a5f1);var _0x121850=_0x50a5f1===_0x32cf('0x61')?_0x32cf('0x62'):_0x32cf('0x63');return db[_0x54379d+_0x32cf('0x64')][_0x32cf('0x65')]({'raw':!![],'where':{'id':_0x251a23[_0x32cf('0x1a')]['id']}})[_0x32cf('0x9')](function(_0x16e14e){if(_[_0x32cf('0x13')](_0x16e14e)){throw new Error(_0x54379d+_0x32cf('0x66'));}_0x3500dc=_0x16e14e;return db[_0x54379d+'Message'][_0x32cf('0x65')]({'where':{'id':_0x251a23[_0x32cf('0x20')]['messageId']},'include':[{'model':db[_0x54379d+_0x32cf('0x67')],'as':'Interaction'},{'model':db[_0x54379d+_0x121850],'as':'Account'}]});})[_0x32cf('0x9')](function(_0x171124){if(_[_0x32cf('0x13')](_0x171124)){throw new Error(_0x54379d+_0x32cf('0x68'));}_0x2ad80e=_0x171124;return _0x171124[_0x32cf('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x32cf('0x9')](function(){var _0x4a534e={'uniqueid':_0x50a5f1+'.'+_0x2ad80e['id']+'.'+_0x2ad80e[_0x32cf('0x67')]['id'],'FromUserId':_0x251a23['user']['id'],'type':_0x32cf('0x6a')};_0x4a534e[_0x54379d+_0x32cf('0x6b')]=_0x2ad80e['id'];_0x4a534e[_0x54379d+_0x32cf('0x6c')]=_0x2ad80e[_0x32cf('0x67')]['id'];_0x4a534e[_0x32cf('0x6d')+_0x54379d+_0x121850+'Id']=_0x2ad80e[_0x32cf('0x63')]['id'];_0x4a534e['To'+_0x54379d+'QueueId']=_0x3500dc['id'];return db[_0x54379d+'TransferReport'][_0x32cf('0x6e')](_0x4a534e);})[_0x32cf('0x9')](function(){return respondWithRpcPromise(_0x32cf('0x6f'),{'channel':_0x50a5f1,'interaction':_0x2ad80e[_0x32cf('0x67')],'message':_0x2ad80e,'account':_0x2ad80e[_0x32cf('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x32cf('0x6a'),'appdata':_0x3500dc['name']+','+(_0x2ad80e[_0x32cf('0x63')][_0x32cf('0x70')]||0x12c),'interval':_0x32cf('0x71')}]},routingClient);})['then'](respondWithResult(_0x2215c0,null))['catch'](handleError(_0x2215c0,null));};};exports[_0x32cf('0x72')]=function(_0x44ce78,_0x160634){var _0x328cd3,_0x51035f;if(_[_0x32cf('0x13')](_0x44ce78[_0x32cf('0x20')][_0x32cf('0x73')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x1c521b=_0x44ce78['body'][_0x32cf('0x73')];var _0x5f3d12=_[_0x32cf('0x60')](_0x1c521b);var _0x53e3e0=_0x1c521b===_0x32cf('0x61')?_0x32cf('0x62'):_0x32cf('0x63');return db['User'][_0x32cf('0x65')]({'raw':!![],'where':{'id':_0x44ce78[_0x32cf('0x1a')]['id'],'role':_0x32cf('0x37')}})[_0x32cf('0x9')](function(_0x2b7636){if(_[_0x32cf('0x13')](_0x2b7636)){throw new Error(_0x32cf('0x74'));}_0x328cd3=_0x2b7636;return db[_0x5f3d12+_0x32cf('0x75')][_0x32cf('0x65')]({'where':{'id':_0x44ce78[_0x32cf('0x20')][_0x32cf('0x76')]},'include':[{'model':db[_0x5f3d12+_0x32cf('0x67')],'as':_0x32cf('0x67')},{'model':db[_0x5f3d12+_0x53e3e0],'as':_0x32cf('0x63')}]});})[_0x32cf('0x9')](function(_0x90d1b0){if(_[_0x32cf('0x13')](_0x90d1b0)){throw new Error(_0x5f3d12+'\x20Message\x20not\x20found');}_0x51035f=_0x90d1b0;return _0x90d1b0[_0x32cf('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x32cf('0x9')](function(){var _0xe33720={'uniqueid':_0x1c521b+'.'+_0x51035f['id']+'.'+_0x51035f[_0x32cf('0x67')]['id'],'FromUserId':_0x44ce78[_0x32cf('0x2e')]['id'],'type':_0x32cf('0x6a'),'ToUserId':_0x328cd3['id']};_0xe33720[_0x5f3d12+_0x32cf('0x6b')]=_0x51035f['id'];_0xe33720[_0x5f3d12+_0x32cf('0x6c')]=_0x51035f[_0x32cf('0x67')]['id'];_0xe33720[_0x32cf('0x6d')+_0x5f3d12+_0x53e3e0+'Id']=_0x51035f['Account']['id'];return db[_0x5f3d12+_0x32cf('0x77')][_0x32cf('0x6e')](_0xe33720);})[_0x32cf('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0x1c521b,'interaction':_0x51035f[_0x32cf('0x67')],'message':_0x51035f,'account':_0x51035f[_0x32cf('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x32cf('0x37'),'appdata':_0x328cd3[_0x32cf('0x11')]+','+(_0x51035f[_0x32cf('0x63')][_0x32cf('0x78')]||0x12c),'interval':_0x32cf('0x71')}]},routingClient);})[_0x32cf('0x9')](respondWithResult(_0x160634,null))[_0x32cf('0xd')](handleError(_0x160634,null));}; \ No newline at end of file +var _0xcc58=['interface','agent','AgentCapacity','capacity','telephones','Telephones','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','faxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','queue_id','uniq','value','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','Website','Account','Queue','findOne','Message','Interaction','\x20Message\x20not\x20found','update','MessageId','From','QueueId','TransferReport','create','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','messageId','InteractionId','Start','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','http','client','request','error','code','message','result','catch','json','sendStatus','name','status','send','isNil','rows','voiceChannels','VoiceChannels','then','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','query','params','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','MemberReport','INTERACTION'];(function(_0xc48f9b,_0x29c8e7){var _0x56fa15=function(_0x5d99bd){while(--_0x5d99bd){_0xc48f9b['push'](_0xc48f9b['shift']());}};_0x56fa15(++_0x29c8e7);}(_0xcc58,0x1b5));var _0x8cc5=function(_0x3f0985,_0x560eca){_0x3f0985=_0x3f0985-0x0;var _0x296d06=_0xcc58[_0x3f0985];return _0x296d06;};'use strict';var BPromise=require(_0x8cc5('0x0'));var moment=require(_0x8cc5('0x1'));var _=require(_0x8cc5('0x2'));var util=require(_0x8cc5('0x3'));var db=require(_0x8cc5('0x4'))['db'];var logger=require(_0x8cc5('0x5'))(_0x8cc5('0x6'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x8cc5('0x7')]({'port':0x232a});var mailClient=jayson[_0x8cc5('0x8')][_0x8cc5('0x7')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2835df,_0x496205,_0x1f3497){return new BPromise(function(_0x53819f,_0x4d043e){var _0x18d158=_0x1f3497?_0x1f3497:amiClient;return _0x18d158[_0x8cc5('0x9')](_0x2835df,_0x496205)['then'](function(_0x5ecfb3){if(_0x5ecfb3[_0x8cc5('0xa')]){if(_0x5ecfb3[_0x8cc5('0xa')][_0x8cc5('0xb')]===0x1f4){return _0x4d043e(_0x5ecfb3[_0x8cc5('0xa')][_0x8cc5('0xc')]);}return _0x53819f(_0x5ecfb3[_0x8cc5('0xa')][_0x8cc5('0xc')]);}else{_0x53819f(_0x5ecfb3[_0x8cc5('0xd')]);}})[_0x8cc5('0xe')](function(_0x499573){_0x4d043e(_0x499573);});});}function respondWithResult(_0x59871d,_0x545708){_0x545708=_0x545708||0xc8;return function(_0x20b8be){if(_0x20b8be){return _0x59871d['status'](_0x545708)[_0x8cc5('0xf')](_0x20b8be);}return _0x59871d[_0x8cc5('0x10')](0x194);};}function handleError(_0x49952c,_0x484ba6){_0x484ba6=_0x484ba6||0x1f4;return function(_0x145f12){logger[_0x8cc5('0xa')](_0x145f12['stack']);if(_0x145f12[_0x8cc5('0x11')]){delete _0x145f12[_0x8cc5('0x11')];}_0x49952c[_0x8cc5('0x12')](_0x484ba6)[_0x8cc5('0x13')](_0x145f12);};}function findById(_0x345740){return function(_0x322af7){if(!_[_0x8cc5('0x14')](_0x345740)&&!_[_0x8cc5('0x14')](_0x322af7)&&!_['isNil'](_0x322af7[_0x8cc5('0x15')])){return _['find'](_0x322af7[_0x8cc5('0x15')],function(_0x4d9038){return _0x4d9038['id']==_0x345740;});}return null;};}exports[_0x8cc5('0x16')]=function(_0x541cbb,_0x21e980){return respondWithRpcPromise(_0x8cc5('0x17'),_0x541cbb['query'])[_0x8cc5('0x18')](respondWithResult(_0x21e980,null))[_0x8cc5('0xe')](handleError(_0x21e980,null));};exports['voiceChannelMixMonitor']=function(_0x30c48f,_0x42b12a){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x8cc5('0x19')](_0x30c48f['query'],_0x30c48f['params']))[_0x8cc5('0x18')](respondWithResult(_0x42b12a,null))[_0x8cc5('0xe')](handleError(_0x42b12a,null));};exports[_0x8cc5('0x1a')]=function(_0x522b36,_0x569252){return respondWithRpcPromise(_0x8cc5('0x1b'),_[_0x8cc5('0x19')](_0x522b36[_0x8cc5('0x1c')],_0x522b36[_0x8cc5('0x1d')]))[_0x8cc5('0x18')](respondWithResult(_0x569252,null))[_0x8cc5('0xe')](handleError(_0x569252,null));};exports[_0x8cc5('0x1e')]=function(_0x22e4c9,_0x4a9c6b){return respondWithRpcPromise(_0x8cc5('0x1f'),_0x22e4c9[_0x8cc5('0x1c')])['then'](respondWithResult(_0x4a9c6b,null))[_0x8cc5('0xe')](handleError(_0x4a9c6b,null));};exports[_0x8cc5('0x20')]=function(_0x15c1fb,_0x9ba551){return respondWithRpcPromise('VoiceQueues',_0x15c1fb[_0x8cc5('0x1c')])[_0x8cc5('0x18')](findById(_0x15c1fb[_0x8cc5('0x1d')]['id']))[_0x8cc5('0x18')](respondWithResult(_0x9ba551,null))[_0x8cc5('0xe')](handleError(_0x9ba551,null));};exports[_0x8cc5('0x21')]=function(_0x4efb78,_0xfdcc07){return respondWithRpcPromise(_0x8cc5('0x22'),_['merge'](_0x4efb78['body'],_0x4efb78['params']))[_0x8cc5('0x18')](respondWithResult(_0xfdcc07,null))[_0x8cc5('0xe')](handleError(_0xfdcc07,null));};exports[_0x8cc5('0x23')]=function(_0x91d48b,_0x42ec87){return respondWithRpcPromise(_0x8cc5('0x24'),_[_0x8cc5('0x19')](_0x91d48b[_0x8cc5('0x1c')],_0x91d48b[_0x8cc5('0x1d')]))[_0x8cc5('0x18')](respondWithResult(_0x42ec87,null))[_0x8cc5('0xe')](handleError(_0x42ec87,null));};exports[_0x8cc5('0x25')]=function(_0x30c04d,_0x268aba){return respondWithRpcPromise(_0x8cc5('0x26'),_0x30c04d[_0x8cc5('0x1c')])[_0x8cc5('0x18')](respondWithResult(_0x268aba,null))[_0x8cc5('0xe')](handleError(_0x268aba,null));};exports['voiceQueuesChannel']=function(_0x33f498,_0x4b5610){return respondWithRpcPromise(_0x8cc5('0x27'),_[_0x8cc5('0x19')](_0x33f498[_0x8cc5('0x1c')],_0x33f498[_0x8cc5('0x1d')]))[_0x8cc5('0x18')](respondWithResult(_0x4b5610,null))[_0x8cc5('0xe')](handleError(_0x4b5610,null));};exports[_0x8cc5('0x28')]=function(_0x28c84b,_0x44efa1){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x8cc5('0x19')](_0x28c84b[_0x8cc5('0x1c')],_0x28c84b['params']))[_0x8cc5('0x18')](respondWithResult(_0x44efa1,null))[_0x8cc5('0xe')](handleError(_0x44efa1,null));};exports[_0x8cc5('0x29')]=function(_0x481acc,_0x10413e){return respondWithRpcPromise(_0x8cc5('0x2a'),_[_0x8cc5('0x19')](_0x481acc[_0x8cc5('0x1c')],_0x481acc[_0x8cc5('0x1d')]))[_0x8cc5('0x18')](respondWithResult(_0x10413e,null))['catch'](handleError(_0x10413e,null));};exports['outbound']=function(_0x2cfa95,_0x342152){return respondWithRpcPromise(_0x8cc5('0x2b'),_0x2cfa95['query'])[_0x8cc5('0x18')](respondWithResult(_0x342152,null))[_0x8cc5('0xe')](handleError(_0x342152,null));};exports[_0x8cc5('0x2c')]=function(_0x543b8e,_0x309869){return respondWithRpcPromise('OutboundChannels',_0x543b8e[_0x8cc5('0x1c')])[_0x8cc5('0x18')](respondWithResult(_0x309869,null))['catch'](handleError(_0x309869,null));};exports[_0x8cc5('0x2d')]=function(_0x2600e5,_0x4cfdec){var _0x16ecf8;return respondWithRpcPromise(_0x8cc5('0x2e'),_0x2600e5[_0x8cc5('0x1c')])['then'](function(_0x3e2054){_0x16ecf8=_0x3e2054;return respondWithRpcPromise(_0x8cc5('0x2e'),_0x2600e5[_0x8cc5('0x1c')],routingClient);})['then'](function(_0x2a8870){return _[_0x8cc5('0x19')]({},_0x2a8870,_0x16ecf8);})[_0x8cc5('0x18')](respondWithResult(_0x4cfdec,null))[_0x8cc5('0xe')](handleError(_0x4cfdec,null));};exports[_0x8cc5('0x2f')]=function(_0x4e5585,_0xfe712c){if(_0x4e5585[_0x8cc5('0x30')]&&_0x4e5585[_0x8cc5('0x30')]['interaction']&&_0x4e5585['user']&&_0x4e5585[_0x8cc5('0x31')][_0x8cc5('0x11')]){for(var _0x53b347 in _0x4e5585['body'][_0x8cc5('0x32')]){if(_0x4e5585['body'][_0x8cc5('0x32')][_0x8cc5('0x33')](_0x53b347)){db['MemberReport'][_0x8cc5('0x34')]({'where':{'channel':_0x53b347,'membername':_0x4e5585['user']['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4e5585[_0x8cc5('0x30')][_0x8cc5('0x32')][_0x53b347]&&_0x4e5585['body'][_0x8cc5('0x32')][_0x53b347][_0x8cc5('0x35')]?{'$notIn':_0x4e5585[_0x8cc5('0x30')][_0x8cc5('0x32')][_0x53b347]}:{'$ne':null}}})[_0x8cc5('0x18')](function(_0x287251){var _0x217e65=moment()[_0x8cc5('0x36')](_0x8cc5('0x37'));for(var _0x42edf3=0x0,_0x3467d8=_0x287251[_0x8cc5('0x35')];_0x42edf3<_0x3467d8;_0x42edf3+=0x1){_0x287251[_0x42edf3][_0x8cc5('0x38')]({'exitAt':_0x217e65});}});for(var _0x5a4683=0x0;_0x5a4683<_0x4e5585['body'][_0x8cc5('0x32')][_0x53b347]['length'];_0x5a4683+=0x1){db[_0x8cc5('0x39')]['findOrCreate']({'where':{'channel':_0x53b347,'membername':_0x4e5585[_0x8cc5('0x31')]['name'],'type':_0x8cc5('0x3a'),'uniqueid':_0x4e5585[_0x8cc5('0x30')][_0x8cc5('0x32')][_0x53b347][_0x5a4683],'exitAt':null},'defaults':{'channel':_0x53b347,'membername':_0x4e5585['user']['name'],'interface':_['isNil'](_0x4e5585[_0x8cc5('0x31')][_0x8cc5('0x3b')])?util[_0x8cc5('0x36')]('SIP/%s',_0x4e5585['user'][_0x8cc5('0x11')]):_0x4e5585[_0x8cc5('0x31')][_0x8cc5('0x3b')],'type':'INTERACTION','enterAt':moment()[_0x8cc5('0x36')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x8cc5('0x3c'),'internal':_0x4e5585[_0x8cc5('0x31')]['internal'],'uniqueid':_0x4e5585['body'][_0x8cc5('0x32')][_0x53b347][_0x5a4683]}});}}}}return respondWithRpcPromise(_0x8cc5('0x3d'),{'id':_0x4e5585[_0x8cc5('0x1d')]['id'],'capacity':_0x4e5585['body'][_0x8cc5('0x3e')]},routingClient)[_0x8cc5('0x18')](respondWithResult(_0xfe712c,null))[_0x8cc5('0xe')](handleError(_0xfe712c,null));};exports[_0x8cc5('0x3f')]=function(_0x3a1f32,_0x2194d7){return respondWithRpcPromise(_0x8cc5('0x40'),_0x3a1f32[_0x8cc5('0x1c')])[_0x8cc5('0x18')](respondWithResult(_0x2194d7,null))[_0x8cc5('0xe')](handleError(_0x2194d7,null));};exports['trunks']=function(_0x276b95,_0x3c4c72){return respondWithRpcPromise('Trunks',_0x276b95['query'])['then'](respondWithResult(_0x3c4c72,null))[_0x8cc5('0xe')](handleError(_0x3c4c72,null));};exports[_0x8cc5('0x41')]=function(_0x373e4e,_0x3948d5){return respondWithRpcPromise(_0x8cc5('0x42'),_0x373e4e['query'])[_0x8cc5('0x18')](respondWithResult(_0x3948d5,null))[_0x8cc5('0xe')](handleError(_0x3948d5,null));};exports[_0x8cc5('0x43')]=function(_0x58f44e,_0x57d972){return respondWithRpcPromise(_0x8cc5('0x44'),_0x58f44e['query'],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x57d972,null))['catch'](handleError(_0x57d972,null));};exports[_0x8cc5('0x45')]=function(_0x58f5ab,_0x56382b){return respondWithRpcPromise(_0x8cc5('0x44'),_0x58f5ab[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](findById(_0x58f5ab[_0x8cc5('0x1d')]['id']))[_0x8cc5('0x18')](respondWithResult(_0x56382b,null))[_0x8cc5('0xe')](handleError(_0x56382b,null));};exports['mailQueues']=function(_0x3145ea,_0x314bce){return respondWithRpcPromise(_0x8cc5('0x46'),_0x3145ea[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x314bce,null))[_0x8cc5('0xe')](handleError(_0x314bce,null));};exports['showMailQueues']=function(_0x4a8b7b,_0x280cb3){return respondWithRpcPromise(_0x8cc5('0x46'),_0x4a8b7b['query'],routingClient)['then'](findById(_0x4a8b7b[_0x8cc5('0x1d')]['id']))[_0x8cc5('0x18')](respondWithResult(_0x280cb3,null))['catch'](handleError(_0x280cb3,null));};exports['mailAccounts']=function(_0x4fbf42,_0x4f14da){return respondWithRpcPromise('MailAccounts',_0x4fbf42[_0x8cc5('0x1c')],mailClient)['then'](respondWithResult(_0x4f14da,null))['catch'](handleError(_0x4f14da,null));};exports[_0x8cc5('0x47')]=function(_0x27defd,_0x5bea4f){return respondWithRpcPromise(_0x8cc5('0x48'),_0x27defd[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x5bea4f,null))[_0x8cc5('0xe')](handleError(_0x5bea4f,null));};exports['showOpenchannelQueues']=function(_0x684555,_0x4303b0){return respondWithRpcPromise(_0x8cc5('0x48'),_0x684555[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](findById(_0x684555[_0x8cc5('0x1d')]['id']))['then'](respondWithResult(_0x4303b0,null))[_0x8cc5('0xe')](handleError(_0x4303b0,null));};exports[_0x8cc5('0x49')]=function(_0xb1c9a8,_0xd02f70){return respondWithRpcPromise(_0x8cc5('0x4a'),_0xb1c9a8[_0x8cc5('0x1c')],routingClient)['then'](respondWithResult(_0xd02f70,null))[_0x8cc5('0xe')](handleError(_0xd02f70,null));};exports[_0x8cc5('0x4b')]=function(_0x22e0aa,_0x58b189){return respondWithRpcPromise(_0x8cc5('0x4a'),_0x22e0aa[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](findById(_0x22e0aa[_0x8cc5('0x1d')]['id']))[_0x8cc5('0x18')](respondWithResult(_0x58b189,null))[_0x8cc5('0xe')](handleError(_0x58b189,null));};exports[_0x8cc5('0x4c')]=function(_0x5428aa,_0x457d90){return respondWithRpcPromise('WhatsappQueues',_0x5428aa[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x457d90,null))[_0x8cc5('0xe')](handleError(_0x457d90,null));};exports[_0x8cc5('0x4d')]=function(_0x49e08a,_0x3d51cb){return respondWithRpcPromise(_0x8cc5('0x4e'),_0x49e08a[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](findById(_0x49e08a['params']['id']))['then'](respondWithResult(_0x3d51cb,null))[_0x8cc5('0xe')](handleError(_0x3d51cb,null));};exports[_0x8cc5('0x4f')]=function(_0x350f93,_0x3d511a){return respondWithRpcPromise(_0x8cc5('0x50'),_0x350f93['query'],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x3d511a,null))['catch'](handleError(_0x3d511a,null));};exports['showFaxQueues']=function(_0x3fd097,_0x3d5dfa){return respondWithRpcPromise(_0x8cc5('0x50'),_0x3fd097['query'],routingClient)['then'](findById(_0x3fd097['params']['id']))[_0x8cc5('0x18')](respondWithResult(_0x3d5dfa,null))[_0x8cc5('0xe')](handleError(_0x3d5dfa,null));};exports[_0x8cc5('0x51')]=function(_0x3864c7,_0x414a7a){return respondWithRpcPromise('FaxAccounts',_0x3864c7[_0x8cc5('0x1c')])['then'](respondWithResult(_0x414a7a,null))[_0x8cc5('0xe')](handleError(_0x414a7a,null));};exports['chatQueuesWaitingInteractions']=function(_0x3b2707,_0x166c83){return respondWithRpcPromise(_0x8cc5('0x52'),_0x3b2707['query'],routingClient)['then'](respondWithResult(_0x166c83,null))[_0x8cc5('0xe')](handleError(_0x166c83,null));};exports['mailQueuesWaitingInteractions']=function(_0x53865a,_0x5304db){return respondWithRpcPromise(_0x8cc5('0x53'),_0x53865a[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x5304db,null))[_0x8cc5('0xe')](handleError(_0x5304db,null));};exports[_0x8cc5('0x54')]=function(_0x10581d,_0x384c4c){return respondWithRpcPromise(_0x8cc5('0x55'),_0x10581d[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x384c4c,null))['catch'](handleError(_0x384c4c,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0xd570ed,_0x2a1ada){return respondWithRpcPromise(_0x8cc5('0x55'),_0xd570ed[_0x8cc5('0x1c')],routingClient)['then'](function(_0x3844cb){if(_0xd570ed['query'][_0x8cc5('0x56')]!==undefined){var _0x5b10b9=_(_0x3844cb['rows'])['filter']([_0xd570ed[_0x8cc5('0x1c')][_0x8cc5('0x56')],_0xd570ed[_0x8cc5('0x1d')]['id']])[_0x8cc5('0x57')](_0x8cc5('0x58'))[_0x8cc5('0x59')]()[_0x8cc5('0x5a')]();return _0x3844cb[_0x8cc5('0x15')]['filter'](function(_0x499b46){return _0x5b10b9['indexOf'](_0x499b46[_0x8cc5('0x58')])>-0x1;});}else{return _0x3844cb[_0x8cc5('0x15')][_0x8cc5('0x5b')](function(_0x35bd69){return _0x35bd69['queue_id']===parseInt(_0xd570ed[_0x8cc5('0x1d')]['id']);});}})[_0x8cc5('0x18')](respondWithResult(_0x2a1ada,null))['catch'](handleError(_0x2a1ada,null));};exports[_0x8cc5('0x5c')]=function(_0x30e0c4,_0x41f400){return respondWithRpcPromise(_0x8cc5('0x5d'),_0x30e0c4[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x41f400,null))[_0x8cc5('0xe')](handleError(_0x41f400,null));};exports[_0x8cc5('0x5e')]=function(_0xa7d180,_0x2af043){return respondWithRpcPromise(_0x8cc5('0x5f'),_0xa7d180['query'],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x2af043,null))['catch'](handleError(_0x2af043,null));};exports[_0x8cc5('0x60')]=function(_0x3baa18,_0x241c5a){return respondWithRpcPromise(_0x8cc5('0x61'),_0x3baa18['query'],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x241c5a,null))[_0x8cc5('0xe')](handleError(_0x241c5a,null));};exports['queueNotify']=function(_0x2fd8e0){return function(_0xc9ffce,_0xaabdb6){var _0x113efb,_0x4777c6;var _0x12ca1e=_[_0x8cc5('0x62')](_0x2fd8e0);var _0xfc006d=_0x2fd8e0==='chat'?_0x8cc5('0x63'):_0x8cc5('0x64');return db[_0x12ca1e+_0x8cc5('0x65')][_0x8cc5('0x66')]({'raw':!![],'where':{'id':_0xc9ffce[_0x8cc5('0x1d')]['id']}})['then'](function(_0x51233a){if(_[_0x8cc5('0x14')](_0x51233a)){throw new Error(_0x12ca1e+'\x20Queue\x20not\x20found');}_0x113efb=_0x51233a;return db[_0x12ca1e+_0x8cc5('0x67')]['findOne']({'where':{'id':_0xc9ffce[_0x8cc5('0x30')]['messageId']},'include':[{'model':db[_0x12ca1e+_0x8cc5('0x68')],'as':_0x8cc5('0x68')},{'model':db[_0x12ca1e+_0xfc006d],'as':_0x8cc5('0x64')}]});})['then'](function(_0x3f65c0){if(_[_0x8cc5('0x14')](_0x3f65c0)){throw new Error(_0x12ca1e+_0x8cc5('0x69'));}_0x4777c6=_0x3f65c0;return _0x3f65c0[_0x8cc5('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x21df55={'uniqueid':_0x2fd8e0+'.'+_0x4777c6['id']+'.'+_0x4777c6[_0x8cc5('0x68')]['id'],'FromUserId':_0xc9ffce['user']['id'],'type':'queue'};_0x21df55[_0x12ca1e+_0x8cc5('0x6b')]=_0x4777c6['id'];_0x21df55[_0x12ca1e+'InteractionId']=_0x4777c6[_0x8cc5('0x68')]['id'];_0x21df55[_0x8cc5('0x6c')+_0x12ca1e+_0xfc006d+'Id']=_0x4777c6['Account']['id'];_0x21df55['To'+_0x12ca1e+_0x8cc5('0x6d')]=_0x113efb['id'];return db[_0x12ca1e+_0x8cc5('0x6e')][_0x8cc5('0x6f')](_0x21df55);})[_0x8cc5('0x18')](function(){return respondWithRpcPromise('Start',{'channel':_0x2fd8e0,'interaction':_0x4777c6[_0x8cc5('0x68')],'message':_0x4777c6,'account':_0x4777c6['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x8cc5('0x70'),'appdata':_0x113efb[_0x8cc5('0x11')]+','+(_0x4777c6['Account'][_0x8cc5('0x71')]||0x12c),'interval':_0x8cc5('0x72')}]},routingClient);})[_0x8cc5('0x18')](respondWithResult(_0xaabdb6,null))[_0x8cc5('0xe')](handleError(_0xaabdb6,null));};};exports[_0x8cc5('0x73')]=function(_0x338bd1,_0x4c2c01){var _0x8b9be1,_0xedc40b;if(_['isNil'](_0x338bd1[_0x8cc5('0x30')][_0x8cc5('0x74')])){throw new Error(_0x8cc5('0x75'));}var _0x24d458=_0x338bd1[_0x8cc5('0x30')][_0x8cc5('0x74')];var _0x29e035=_[_0x8cc5('0x62')](_0x24d458);var _0x165c08=_0x24d458==='chat'?'Website':'Account';return db[_0x8cc5('0x76')][_0x8cc5('0x66')]({'raw':!![],'where':{'id':_0x338bd1[_0x8cc5('0x1d')]['id'],'role':_0x8cc5('0x3c')}})[_0x8cc5('0x18')](function(_0x213189){if(_[_0x8cc5('0x14')](_0x213189)){throw new Error(_0x8cc5('0x77'));}_0x8b9be1=_0x213189;return db[_0x29e035+_0x8cc5('0x67')][_0x8cc5('0x66')]({'where':{'id':_0x338bd1[_0x8cc5('0x30')][_0x8cc5('0x78')]},'include':[{'model':db[_0x29e035+_0x8cc5('0x68')],'as':'Interaction'},{'model':db[_0x29e035+_0x165c08],'as':_0x8cc5('0x64')}]});})[_0x8cc5('0x18')](function(_0x2e3c69){if(_[_0x8cc5('0x14')](_0x2e3c69)){throw new Error(_0x29e035+_0x8cc5('0x69'));}_0xedc40b=_0x2e3c69;return _0x2e3c69[_0x8cc5('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8cc5('0x18')](function(){var _0x55dcda={'uniqueid':_0x24d458+'.'+_0xedc40b['id']+'.'+_0xedc40b['Interaction']['id'],'FromUserId':_0x338bd1[_0x8cc5('0x31')]['id'],'type':'queue','ToUserId':_0x8b9be1['id']};_0x55dcda[_0x29e035+_0x8cc5('0x6b')]=_0xedc40b['id'];_0x55dcda[_0x29e035+_0x8cc5('0x79')]=_0xedc40b[_0x8cc5('0x68')]['id'];_0x55dcda[_0x8cc5('0x6c')+_0x29e035+_0x165c08+'Id']=_0xedc40b[_0x8cc5('0x64')]['id'];return db[_0x29e035+_0x8cc5('0x6e')][_0x8cc5('0x6f')](_0x55dcda);})['then'](function(){return respondWithRpcPromise(_0x8cc5('0x7a'),{'channel':_0x24d458,'interaction':_0xedc40b[_0x8cc5('0x68')],'message':_0xedc40b,'account':_0xedc40b[_0x8cc5('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8cc5('0x3c'),'appdata':_0x8b9be1['name']+','+(_0xedc40b[_0x8cc5('0x64')][_0x8cc5('0x7b')]||0x12c),'interval':_0x8cc5('0x72')}]},routingClient);})[_0x8cc5('0x18')](respondWithResult(_0x4c2c01,null))['catch'](handleError(_0x4c2c01,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 630cb29..0497217 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 _0x6af5=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','show','/:id/run','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x6af5,0x1e3));var _0x56af=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x6af5[_0x3fba9f];return _0x192cf1;};'use strict';var multer=require(_0x56af('0x0'));var util=require('util');var path=require(_0x56af('0x1'));var timeout=require(_0x56af('0x2'));var express=require('express');var router=express[_0x56af('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x56af('0x4'));var interaction=require(_0x56af('0x5'));var config=require(_0x56af('0x6'));var controller=require(_0x56af('0x7'));router[_0x56af('0x8')]('/',auth['isAuthenticated'](),controller[_0x56af('0x9')]);router[_0x56af('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x56af('0xa')]);router[_0x56af('0x8')](_0x56af('0xb'),auth[_0x56af('0xc')](),controller['run']);router[_0x56af('0xd')]('/',auth['isAuthenticated'](),controller[_0x56af('0xe')]);router[_0x56af('0xf')](_0x56af('0x10'),auth[_0x56af('0xc')](),controller[_0x56af('0x11')]);router[_0x56af('0x12')](_0x56af('0x10'),auth[_0x56af('0xc')](),controller[_0x56af('0x13')]);module[_0x56af('0x14')]=router; \ No newline at end of file +var _0xf690=['get','isAuthenticated','index','show','/:id/run','put','update','delete','/:id','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller'];(function(_0x1c2fd7,_0x595cf1){var _0x369e9d=function(_0x12d274){while(--_0x12d274){_0x1c2fd7['push'](_0x1c2fd7['shift']());}};_0x369e9d(++_0x595cf1);}(_0xf690,0x129));var _0x0f69=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0xf690[_0x3c2b2e];return _0x27a338;};'use strict';var multer=require(_0x0f69('0x0'));var util=require('util');var path=require(_0x0f69('0x1'));var timeout=require('connect-timeout');var express=require(_0x0f69('0x2'));var router=express[_0x0f69('0x3')]();var fs_extra=require(_0x0f69('0x4'));var auth=require(_0x0f69('0x5'));var interaction=require(_0x0f69('0x6'));var config=require(_0x0f69('0x7'));var controller=require(_0x0f69('0x8'));router[_0x0f69('0x9')]('/',auth[_0x0f69('0xa')](),controller[_0x0f69('0xb')]);router[_0x0f69('0x9')]('/:id',auth[_0x0f69('0xa')](),controller[_0x0f69('0xc')]);router['get'](_0x0f69('0xd'),auth[_0x0f69('0xa')](),controller['run']);router['post']('/',auth[_0x0f69('0xa')](),controller['create']);router[_0x0f69('0xe')]('/:id',auth[_0x0f69('0xa')](),controller[_0x0f69('0xf')]);router[_0x0f69('0x10')](_0x0f69('0x11'),auth[_0x0f69('0xa')](),controller['destroy']);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 51a864b..c46c927 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 _0x5e0e=['BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','months','weeks','days','hours','ENUM','pdf','xlsx','csv','custom','default','TEXT','sequelize','exports','STRING'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x5e0e,0x89));var _0xe5e0=function(_0x153e7d,_0x10a35f){_0x153e7d=_0x153e7d-0x0;var _0x3c22dd=_0x5e0e[_0x153e7d];return _0x3c22dd;};'use strict';var Sequelize=require(_0xe5e0('0x0'));module[_0xe5e0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xe5e0('0x2')]},'active':{'type':Sequelize[_0xe5e0('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xe5e0('0x2')],'allowNull':![],'defaultValue':_0xe5e0('0x4')},'startAt':{'type':Sequelize[_0xe5e0('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xe5e0('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xe5e0('0x7'),_0xe5e0('0x8'),_0xe5e0('0x9'),_0xe5e0('0xa'),_0xe5e0('0xb'),_0xe5e0('0xc'),'minutes'),'allowNull':![],'defaultValue':_0xe5e0('0xb')},'output':{'type':Sequelize[_0xe5e0('0xd')]('csv',_0xe5e0('0xe'),_0xe5e0('0xf')),'allowNull':![],'defaultValue':_0xe5e0('0x10')},'type':{'type':Sequelize[_0xe5e0('0xd')](_0xe5e0('0x11'),_0xe5e0('0x12')),'allowNull':![],'defaultValue':_0xe5e0('0x11')},'sendMail':{'type':Sequelize[_0xe5e0('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xe5e0('0x2')]},'cc':{'type':Sequelize[_0xe5e0('0x13')]},'bcc':{'type':Sequelize[_0xe5e0('0x13')]},'sendIfEmpty':{'type':Sequelize[_0xe5e0('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2975=['quarters','months','weeks','days','hours','csv','pdf','xlsx','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','ENUM','years'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2975,0x1c5));var _0x5297=function(_0x4f0b73,_0x2253e4){_0x4f0b73=_0x4f0b73-0x0;var _0x3599a2=_0x2975[_0x4f0b73];return _0x3599a2;};'use strict';var Sequelize=require('sequelize');module[_0x5297('0x0')]={'name':{'type':Sequelize[_0x5297('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5297('0x1')]},'active':{'type':Sequelize[_0x5297('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x5297('0x1')],'allowNull':![],'defaultValue':_0x5297('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5297('0x4')](_0x5297('0x5'),_0x5297('0x6'),_0x5297('0x7'),_0x5297('0x8'),_0x5297('0x9'),_0x5297('0xa'),'minutes'),'allowNull':![],'defaultValue':_0x5297('0x9')},'output':{'type':Sequelize[_0x5297('0x4')](_0x5297('0xb'),_0x5297('0xc'),_0x5297('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x5297('0x4')](_0x5297('0xe'),_0x5297('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x5297('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x5297('0x1')]},'cc':{'type':Sequelize[_0x5297('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x5297('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 055bacf..49e30f3 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 _0x8f7e=['includeAll','include','rows','catch','show','params','keys','rawAttributes','intersection','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','update','run','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','json','apply','save','then','destroy','Scheduler','UserProfileResource','error','stack','name','merge','body','contact','agent','interaction','index','map','Schedule','type','key','query','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options'];(function(_0x3ead25,_0x456c38){var _0x45a399=function(_0x6b1524){while(--_0x6b1524){_0x3ead25['push'](_0x3ead25['shift']());}};_0x45a399(++_0x456c38);}(_0x8f7e,0xb6));var _0xe8f7=function(_0x50aa88,_0x1e691e){_0x50aa88=_0x50aa88-0x0;var _0x208803=_0x8f7e[_0x50aa88];return _0x208803;};'use strict';var emlformat=require(_0xe8f7('0x0'));var rimraf=require(_0xe8f7('0x1'));var zipdir=require(_0xe8f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe8f7('0x3'));var BPromise=require(_0xe8f7('0x4'));var Mustache=require(_0xe8f7('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe8f7('0x6'));var csv=require(_0xe8f7('0x7'));var ejs=require(_0xe8f7('0x8'));var fs=require('fs');var fs_extra=require(_0xe8f7('0x9'));var _=require(_0xe8f7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe8f7('0xb'));var deskjs=require(_0xe8f7('0xc'));var toCsv=require(_0xe8f7('0x7'));var querystring=require(_0xe8f7('0xd'));var Papa=require(_0xe8f7('0xe'));var Redis=require('ioredis');var authService=require(_0xe8f7('0xf'));var qs=require(_0xe8f7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe8f7('0x11'));var logger=require('../../config/logger')(_0xe8f7('0x12'));var utils=require(_0xe8f7('0x13'));var config=require(_0xe8f7('0x14'));var licenseUtil=require(_0xe8f7('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x293089,_0x59bef1){_0x59bef1=_0x59bef1||0xcc;return function(_0x1c3e47){if(_0x1c3e47){return _0x293089[_0xe8f7('0x16')](_0x59bef1);}return _0x293089[_0xe8f7('0x17')](_0x59bef1)[_0xe8f7('0x18')]();};}function respondWithResult(_0x1c8cbe,_0x13fea9){_0x13fea9=_0x13fea9||0xc8;return function(_0x34c658){if(_0x34c658){return _0x1c8cbe[_0xe8f7('0x17')](_0x13fea9)['json'](_0x34c658);}};}function respondWithFilteredResult(_0x28c5dc,_0x507fda){return function(_0x3709a7){if(_0x3709a7){var _0x45ec61=typeof _0x507fda[_0xe8f7('0x19')]===_0xe8f7('0x1a')&&typeof _0x507fda[_0xe8f7('0x1b')]===_0xe8f7('0x1a');var _0x3b4cff=_0x3709a7[_0xe8f7('0x1c')];var _0x11df0c=_0x45ec61?0x0:_0x507fda['offset'];var _0x2389b0=_0x45ec61?_0x3709a7[_0xe8f7('0x1c')]:_0x507fda[_0xe8f7('0x19')]+_0x507fda['limit'];var _0x3c2ac2;if(_0x2389b0>=_0x3b4cff){_0x2389b0=_0x3b4cff;_0x3c2ac2=0xc8;}else{_0x3c2ac2=0xce;}_0x28c5dc[_0xe8f7('0x17')](_0x3c2ac2);return _0x28c5dc['set']('Content-Range',_0x11df0c+'-'+_0x2389b0+'/'+_0x3b4cff)[_0xe8f7('0x1d')](_0x3709a7);}return null;};}function patchUpdates(_0x1af5e1){return function(_0x34e1ae){try{jsonpatch[_0xe8f7('0x1e')](_0x34e1ae,_0x1af5e1,!![]);}catch(_0x4072c6){return BPromise['reject'](_0x4072c6);}return _0x34e1ae[_0xe8f7('0x1f')]();};}function saveUpdates(_0x50744e,_0x1acdf7){return function(_0x3e1ae0){if(_0x3e1ae0){return _0x3e1ae0['update'](_0x50744e)[_0xe8f7('0x20')](function(_0x56c978){return _0x56c978;});}return null;};}function removeEntity(_0x59a04d,_0x444145){return function(_0x29d86b){if(_0x29d86b){return _0x29d86b[_0xe8f7('0x21')]()[_0xe8f7('0x20')](function(){var _0xfa541c=_0x29d86b['get']({'plain':!![]});var _0x582a9a=_0xe8f7('0x22');return db[_0xe8f7('0x23')][_0xe8f7('0x21')]({'where':{'type':_0x582a9a,'resourceId':_0xfa541c['id']}})['then'](function(){return _0x29d86b;});})[_0xe8f7('0x20')](function(){_0x59a04d['status'](0xcc)[_0xe8f7('0x18')]();});}};}function handleEntityNotFound(_0x16c0b8,_0xa79b4b){return function(_0x1075a8){if(!_0x1075a8){_0x16c0b8[_0xe8f7('0x16')](0x194);}return _0x1075a8;};}function handleError(_0x280015,_0x412441){_0x412441=_0x412441||0x1f4;return function(_0x5dc640){logger[_0xe8f7('0x24')](_0x5dc640[_0xe8f7('0x25')]);if(_0x5dc640['name']){delete _0x5dc640[_0xe8f7('0x26')];}_0x280015[_0xe8f7('0x17')](_0x412441)['send'](_0x5dc640);};}function getMustacheRender(_0x587fc6,_0x2135a9){return Mustache['render'](_0x587fc6,_[_0xe8f7('0x27')](_0x2135a9[_0xe8f7('0x28')],{'contact':_0x2135a9[_0xe8f7('0x29')],'message':_0x2135a9['message'],'agent':_0x2135a9[_0xe8f7('0x2a')],'interaction':_0x2135a9[_0xe8f7('0x2b')],'account':_0x2135a9['account']}))||'';}exports[_0xe8f7('0x2c')]=function(_0x28cbe8,_0x1704c9){var _0x1147c4={},_0x343f05={},_0x594a7d={'count':0x0,'rows':[]};var _0x21cb0f=_[_0xe8f7('0x2d')](db[_0xe8f7('0x2e')]['rawAttributes'],function(_0x599df0){return{'name':_0x599df0['fieldName'],'type':_0x599df0[_0xe8f7('0x2f')][_0xe8f7('0x30')]};});_0x343f05['model']=_['map'](_0x21cb0f,_0xe8f7('0x26'));_0x343f05[_0xe8f7('0x31')]=_['keys'](_0x28cbe8[_0xe8f7('0x31')]);_0x343f05['filters']=_['intersection'](_0x343f05[_0xe8f7('0x32')],_0x343f05[_0xe8f7('0x31')]);_0x1147c4[_0xe8f7('0x33')]=_['intersection'](_0x343f05['model'],qs['fields'](_0x28cbe8[_0xe8f7('0x31')][_0xe8f7('0x34')]));_0x1147c4[_0xe8f7('0x33')]=_0x1147c4[_0xe8f7('0x33')][_0xe8f7('0x35')]?_0x1147c4['attributes']:_0x343f05[_0xe8f7('0x32')];if(!_0x28cbe8[_0xe8f7('0x31')][_0xe8f7('0x36')](_0xe8f7('0x37'))){_0x1147c4[_0xe8f7('0x1b')]=qs[_0xe8f7('0x1b')](_0x28cbe8[_0xe8f7('0x31')][_0xe8f7('0x1b')]);_0x1147c4['offset']=qs[_0xe8f7('0x19')](_0x28cbe8[_0xe8f7('0x31')][_0xe8f7('0x19')]);}_0x1147c4[_0xe8f7('0x38')]=qs[_0xe8f7('0x39')](_0x28cbe8[_0xe8f7('0x31')]['sort']);_0x1147c4[_0xe8f7('0x3a')]=qs[_0xe8f7('0x3b')](_[_0xe8f7('0x3c')](_0x28cbe8[_0xe8f7('0x31')],_0x343f05[_0xe8f7('0x3b')]),_0x21cb0f);if(_0x28cbe8[_0xe8f7('0x31')][_0xe8f7('0x3d')]){_0x1147c4[_0xe8f7('0x3a')]=_[_0xe8f7('0x27')](_0x1147c4[_0xe8f7('0x3a')],{'$or':_[_0xe8f7('0x2d')](_0x21cb0f,function(_0x2aca98){if(_0x2aca98[_0xe8f7('0x2f')]!==_0xe8f7('0x3e')){var _0x5dff80={};_0x5dff80[_0x2aca98[_0xe8f7('0x26')]]={'$like':'%'+_0x28cbe8[_0xe8f7('0x31')][_0xe8f7('0x3d')]+'%'};return _0x5dff80;}})});}_0x1147c4=_[_0xe8f7('0x27')]({},_0x1147c4,_0x28cbe8[_0xe8f7('0x3f')]);var _0x2aa4ba={'where':_0x1147c4[_0xe8f7('0x3a')]};return db[_0xe8f7('0x2e')][_0xe8f7('0x1c')](_0x2aa4ba)[_0xe8f7('0x20')](function(_0x32d14d){_0x594a7d[_0xe8f7('0x1c')]=_0x32d14d;if(_0x28cbe8['query'][_0xe8f7('0x40')]){_0x1147c4[_0xe8f7('0x41')]=[{'all':!![]}];}return db[_0xe8f7('0x2e')]['findAll'](_0x1147c4);})['then'](function(_0x3fde1f){_0x594a7d[_0xe8f7('0x42')]=_0x3fde1f;return _0x594a7d;})[_0xe8f7('0x20')](respondWithFilteredResult(_0x1704c9,_0x1147c4))[_0xe8f7('0x43')](handleError(_0x1704c9,null));};exports[_0xe8f7('0x44')]=function(_0x3c04fe,_0x528059){var _0x3badca={'raw':![],'where':{'id':_0x3c04fe[_0xe8f7('0x45')]['id']}},_0x583073={};_0x583073['model']=_[_0xe8f7('0x46')](db[_0xe8f7('0x2e')][_0xe8f7('0x47')]);_0x583073[_0xe8f7('0x31')]=_[_0xe8f7('0x46')](_0x3c04fe['query']);_0x583073[_0xe8f7('0x3b')]=_['intersection'](_0x583073[_0xe8f7('0x32')],_0x583073[_0xe8f7('0x31')]);_0x3badca['attributes']=_[_0xe8f7('0x48')](_0x583073[_0xe8f7('0x32')],qs[_0xe8f7('0x34')](_0x3c04fe[_0xe8f7('0x31')][_0xe8f7('0x34')]));_0x3badca['attributes']=_0x3badca[_0xe8f7('0x33')]['length']?_0x3badca[_0xe8f7('0x33')]:_0x583073[_0xe8f7('0x32')];if(_0x3c04fe[_0xe8f7('0x31')][_0xe8f7('0x40')]){_0x3badca['include']=[{'all':!![]}];}_0x3badca=_[_0xe8f7('0x27')]({},_0x3badca,_0x3c04fe['options']);return db[_0xe8f7('0x2e')][_0xe8f7('0x49')](_0x3badca)[_0xe8f7('0x20')](handleEntityNotFound(_0x528059,null))['then'](respondWithResult(_0x528059,null))[_0xe8f7('0x43')](handleError(_0x528059,null));};exports[_0xe8f7('0x4a')]=function(_0x14e287,_0x153d66){return db['Schedule'][_0xe8f7('0x4a')](_0x14e287['body'],{})[_0xe8f7('0x20')](function(_0x1959c9){var _0x52c37b=_0x14e287['user'][_0xe8f7('0x4b')]({'plain':!![]});if(!_0x52c37b)throw new Error(_0xe8f7('0x4c'));if(_0x52c37b[_0xe8f7('0x4d')]===_0xe8f7('0x4e')){var _0x40cdb7=_0x1959c9[_0xe8f7('0x4b')]({'plain':!![]});var _0x2a2c3c='Scheduler';return db[_0xe8f7('0x4f')]['find']({'where':{'name':_0x2a2c3c,'userProfileId':_0x52c37b['userProfileId']},'raw':!![]})[_0xe8f7('0x20')](function(_0x41d48d){if(_0x41d48d&&_0x41d48d['autoAssociation']===0x0){return db[_0xe8f7('0x23')][_0xe8f7('0x4a')]({'name':_0x40cdb7[_0xe8f7('0x26')],'resourceId':_0x40cdb7['id'],'type':_0x41d48d['name'],'sectionId':_0x41d48d['id']},{})[_0xe8f7('0x20')](function(){return _0x1959c9;});}else{return _0x1959c9;}})[_0xe8f7('0x43')](function(_0x277b9e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x277b9e);throw _0x277b9e;});}return _0x1959c9;})[_0xe8f7('0x20')](respondWithResult(_0x153d66,0xc9))[_0xe8f7('0x43')](handleError(_0x153d66,null));};exports[_0xe8f7('0x50')]=function(_0x124a15,_0xe7e6a){if(_0x124a15[_0xe8f7('0x28')]['id']){delete _0x124a15['body']['id'];}return db[_0xe8f7('0x2e')][_0xe8f7('0x49')]({'where':{'id':_0x124a15[_0xe8f7('0x45')]['id']}})['then'](handleEntityNotFound(_0xe7e6a,null))[_0xe8f7('0x20')](saveUpdates(_0x124a15['body'],null))['then'](respondWithResult(_0xe7e6a,null))[_0xe8f7('0x43')](handleError(_0xe7e6a,null));};exports['destroy']=function(_0x4b0621,_0x56cb1f){return db[_0xe8f7('0x2e')][_0xe8f7('0x49')]({'where':{'id':_0x4b0621[_0xe8f7('0x45')]['id']}})[_0xe8f7('0x20')](handleEntityNotFound(_0x56cb1f,null))[_0xe8f7('0x20')](removeEntity(_0x56cb1f,null))[_0xe8f7('0x43')](handleError(_0x56cb1f,null));};exports[_0xe8f7('0x51')]=function(_0x5398fe,_0x35adb1,_0x5a9c25){var _0x44dcf5=require('../../config/schedule');return db[_0xe8f7('0x2e')]['find']({'where':{'id':_0x5398fe[_0xe8f7('0x45')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x35adb1,null))['then'](function(){_0x44dcf5[_0xe8f7('0x51')](_0x5398fe[_0xe8f7('0x45')]['id']);})[_0xe8f7('0x20')](respondWithStatusCode(_0x35adb1,null))['catch'](handleError(_0x35adb1,null));}; \ No newline at end of file +var _0x335c=['send','merge','body','contact','agent','interaction','map','Schedule','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','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','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','save','update','then','destroy','get','end','error','name'];(function(_0x18bfc3,_0x2c7923){var _0x2d28c2=function(_0x348788){while(--_0x348788){_0x18bfc3['push'](_0x18bfc3['shift']());}};_0x2d28c2(++_0x2c7923);}(_0x335c,0x1d3));var _0xc335=function(_0x2b26b1,_0x121949){_0x2b26b1=_0x2b26b1-0x0;var _0x19acbd=_0x335c[_0x2b26b1];return _0x19acbd;};'use strict';var emlformat=require(_0xc335('0x0'));var rimraf=require(_0xc335('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc335('0x2'));var rp=require(_0xc335('0x3'));var moment=require(_0xc335('0x4'));var BPromise=require(_0xc335('0x5'));var Mustache=require('mustache');var util=require(_0xc335('0x6'));var path=require(_0xc335('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc335('0x8'));var fs=require('fs');var fs_extra=require(_0xc335('0x9'));var _=require(_0xc335('0xa'));var squel=require(_0xc335('0xb'));var crypto=require('crypto');var jsforce=require(_0xc335('0xc'));var deskjs=require(_0xc335('0xd'));var toCsv=require(_0xc335('0xe'));var querystring=require(_0xc335('0xf'));var Papa=require(_0xc335('0x10'));var Redis=require(_0xc335('0x11'));var authService=require(_0xc335('0x12'));var qs=require(_0xc335('0x13'));var as=require(_0xc335('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc335('0x15'))(_0xc335('0x16'));var utils=require(_0xc335('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc335('0x18'));var db=require(_0xc335('0x19'))['db'];function respondWithStatusCode(_0x2c6037,_0x3c7f9d){_0x3c7f9d=_0x3c7f9d||0xcc;return function(_0x9e6e7a){if(_0x9e6e7a){return _0x2c6037[_0xc335('0x1a')](_0x3c7f9d);}return _0x2c6037[_0xc335('0x1b')](_0x3c7f9d)['end']();};}function respondWithResult(_0xeb107,_0x21989f){_0x21989f=_0x21989f||0xc8;return function(_0x1aaf0c){if(_0x1aaf0c){return _0xeb107[_0xc335('0x1b')](_0x21989f)[_0xc335('0x1c')](_0x1aaf0c);}};}function respondWithFilteredResult(_0x27381b,_0x3e896d){return function(_0x13763f){if(_0x13763f){var _0x225ae4=typeof _0x3e896d['offset']==='undefined'&&typeof _0x3e896d[_0xc335('0x1d')]===_0xc335('0x1e');var _0x3037d8=_0x13763f[_0xc335('0x1f')];var _0x580f04=_0x225ae4?0x0:_0x3e896d[_0xc335('0x20')];var _0x3f8741=_0x225ae4?_0x13763f[_0xc335('0x1f')]:_0x3e896d[_0xc335('0x20')]+_0x3e896d[_0xc335('0x1d')];var _0x36fe17;if(_0x3f8741>=_0x3037d8){_0x3f8741=_0x3037d8;_0x36fe17=0xc8;}else{_0x36fe17=0xce;}_0x27381b[_0xc335('0x1b')](_0x36fe17);return _0x27381b[_0xc335('0x21')](_0xc335('0x22'),_0x580f04+'-'+_0x3f8741+'/'+_0x3037d8)['json'](_0x13763f);}return null;};}function patchUpdates(_0xdf3f94){return function(_0xa43a56){try{jsonpatch['apply'](_0xa43a56,_0xdf3f94,!![]);}catch(_0x2b810e){return BPromise['reject'](_0x2b810e);}return _0xa43a56[_0xc335('0x23')]();};}function saveUpdates(_0xed8577,_0x3f83df){return function(_0x24be9f){if(_0x24be9f){return _0x24be9f[_0xc335('0x24')](_0xed8577)[_0xc335('0x25')](function(_0x581aa4){return _0x581aa4;});}return null;};}function removeEntity(_0x5c11cf,_0x54bee3){return function(_0x56acb5){if(_0x56acb5){return _0x56acb5[_0xc335('0x26')]()[_0xc335('0x25')](function(){var _0xbc1937=_0x56acb5[_0xc335('0x27')]({'plain':!![]});var _0x1f00b3='Scheduler';return db['UserProfileResource'][_0xc335('0x26')]({'where':{'type':_0x1f00b3,'resourceId':_0xbc1937['id']}})[_0xc335('0x25')](function(){return _0x56acb5;});})['then'](function(){_0x5c11cf[_0xc335('0x1b')](0xcc)[_0xc335('0x28')]();});}};}function handleEntityNotFound(_0xa963b0,_0x4494b1){return function(_0x302e21){if(!_0x302e21){_0xa963b0['sendStatus'](0x194);}return _0x302e21;};}function handleError(_0xc149d0,_0x16a699){_0x16a699=_0x16a699||0x1f4;return function(_0x316e91){logger[_0xc335('0x29')](_0x316e91['stack']);if(_0x316e91[_0xc335('0x2a')]){delete _0x316e91[_0xc335('0x2a')];}_0xc149d0['status'](_0x16a699)[_0xc335('0x2b')](_0x316e91);};}function getMustacheRender(_0x853cbb,_0x29f047){return Mustache['render'](_0x853cbb,_[_0xc335('0x2c')](_0x29f047[_0xc335('0x2d')],{'contact':_0x29f047[_0xc335('0x2e')],'message':_0x29f047['message'],'agent':_0x29f047[_0xc335('0x2f')],'interaction':_0x29f047[_0xc335('0x30')],'account':_0x29f047['account']}))||'';}exports['index']=function(_0x3929a4,_0x301b25){var _0x3631c5={},_0x57e20b={},_0x3019f2={'count':0x0,'rows':[]};var _0x16cf0b=_[_0xc335('0x31')](db[_0xc335('0x32')]['rawAttributes'],function(_0x3fb9a9){return{'name':_0x3fb9a9['fieldName'],'type':_0x3fb9a9[_0xc335('0x33')][_0xc335('0x34')]};});_0x57e20b[_0xc335('0x35')]=_[_0xc335('0x31')](_0x16cf0b,_0xc335('0x2a'));_0x57e20b[_0xc335('0x36')]=_['keys'](_0x3929a4['query']);_0x57e20b['filters']=_['intersection'](_0x57e20b[_0xc335('0x35')],_0x57e20b['query']);_0x3631c5['attributes']=_[_0xc335('0x37')](_0x57e20b[_0xc335('0x35')],qs[_0xc335('0x38')](_0x3929a4[_0xc335('0x36')][_0xc335('0x38')]));_0x3631c5[_0xc335('0x39')]=_0x3631c5[_0xc335('0x39')][_0xc335('0x3a')]?_0x3631c5[_0xc335('0x39')]:_0x57e20b[_0xc335('0x35')];if(!_0x3929a4['query']['hasOwnProperty'](_0xc335('0x3b'))){_0x3631c5[_0xc335('0x1d')]=qs[_0xc335('0x1d')](_0x3929a4[_0xc335('0x36')][_0xc335('0x1d')]);_0x3631c5['offset']=qs[_0xc335('0x20')](_0x3929a4['query'][_0xc335('0x20')]);}_0x3631c5[_0xc335('0x3c')]=qs[_0xc335('0x3d')](_0x3929a4['query'][_0xc335('0x3d')]);_0x3631c5[_0xc335('0x3e')]=qs['filters'](_[_0xc335('0x3f')](_0x3929a4[_0xc335('0x36')],_0x57e20b[_0xc335('0x40')]),_0x16cf0b);if(_0x3929a4[_0xc335('0x36')]['filter']){_0x3631c5[_0xc335('0x3e')]=_[_0xc335('0x2c')](_0x3631c5[_0xc335('0x3e')],{'$or':_[_0xc335('0x31')](_0x16cf0b,function(_0x4703d0){if(_0x4703d0['type']!==_0xc335('0x41')){var _0x4d7b92={};_0x4d7b92[_0x4703d0['name']]={'$like':'%'+_0x3929a4['query']['filter']+'%'};return _0x4d7b92;}})});}_0x3631c5=_['merge']({},_0x3631c5,_0x3929a4[_0xc335('0x42')]);var _0x5ccc2c={'where':_0x3631c5[_0xc335('0x3e')]};return db[_0xc335('0x32')][_0xc335('0x1f')](_0x5ccc2c)[_0xc335('0x25')](function(_0x425d8c){_0x3019f2[_0xc335('0x1f')]=_0x425d8c;if(_0x3929a4[_0xc335('0x36')][_0xc335('0x43')]){_0x3631c5[_0xc335('0x44')]=[{'all':!![]}];}return db[_0xc335('0x32')][_0xc335('0x45')](_0x3631c5);})[_0xc335('0x25')](function(_0x44573b){_0x3019f2[_0xc335('0x46')]=_0x44573b;return _0x3019f2;})[_0xc335('0x25')](respondWithFilteredResult(_0x301b25,_0x3631c5))[_0xc335('0x47')](handleError(_0x301b25,null));};exports[_0xc335('0x48')]=function(_0x4c107d,_0x15401a){var _0x15b350={'raw':![],'where':{'id':_0x4c107d['params']['id']}},_0x39872e={};_0x39872e['model']=_[_0xc335('0x49')](db[_0xc335('0x32')][_0xc335('0x4a')]);_0x39872e['query']=_['keys'](_0x4c107d[_0xc335('0x36')]);_0x39872e['filters']=_[_0xc335('0x37')](_0x39872e[_0xc335('0x35')],_0x39872e['query']);_0x15b350[_0xc335('0x39')]=_[_0xc335('0x37')](_0x39872e[_0xc335('0x35')],qs[_0xc335('0x38')](_0x4c107d[_0xc335('0x36')][_0xc335('0x38')]));_0x15b350[_0xc335('0x39')]=_0x15b350[_0xc335('0x39')][_0xc335('0x3a')]?_0x15b350[_0xc335('0x39')]:_0x39872e['model'];if(_0x4c107d[_0xc335('0x36')][_0xc335('0x43')]){_0x15b350[_0xc335('0x44')]=[{'all':!![]}];}_0x15b350=_[_0xc335('0x2c')]({},_0x15b350,_0x4c107d['options']);return db[_0xc335('0x32')][_0xc335('0x4b')](_0x15b350)[_0xc335('0x25')](handleEntityNotFound(_0x15401a,null))[_0xc335('0x25')](respondWithResult(_0x15401a,null))['catch'](handleError(_0x15401a,null));};exports['create']=function(_0x1962ad,_0x59200d){return db['Schedule'][_0xc335('0x4c')](_0x1962ad[_0xc335('0x2d')],{})[_0xc335('0x25')](function(_0x300d2b){var _0x4711ac=_0x1962ad['user'][_0xc335('0x27')]({'plain':!![]});if(!_0x4711ac)throw new Error(_0xc335('0x4d'));if(_0x4711ac[_0xc335('0x4e')]==='user'){var _0x545370=_0x300d2b['get']({'plain':!![]});var _0x29821f=_0xc335('0x4f');return db[_0xc335('0x50')][_0xc335('0x4b')]({'where':{'name':_0x29821f,'userProfileId':_0x4711ac[_0xc335('0x51')]},'raw':!![]})[_0xc335('0x25')](function(_0x2c7117){if(_0x2c7117&&_0x2c7117['autoAssociation']===0x0){return db[_0xc335('0x52')][_0xc335('0x4c')]({'name':_0x545370[_0xc335('0x2a')],'resourceId':_0x545370['id'],'type':_0x2c7117[_0xc335('0x2a')],'sectionId':_0x2c7117['id']},{})['then'](function(){return _0x300d2b;});}else{return _0x300d2b;}})[_0xc335('0x47')](function(_0x4aea1d){logger[_0xc335('0x29')](_0xc335('0x53'),_0x4aea1d);throw _0x4aea1d;});}return _0x300d2b;})[_0xc335('0x25')](respondWithResult(_0x59200d,0xc9))[_0xc335('0x47')](handleError(_0x59200d,null));};exports[_0xc335('0x24')]=function(_0x4137d2,_0x25fd47){if(_0x4137d2[_0xc335('0x2d')]['id']){delete _0x4137d2[_0xc335('0x2d')]['id'];}return db[_0xc335('0x32')]['find']({'where':{'id':_0x4137d2[_0xc335('0x54')]['id']}})['then'](handleEntityNotFound(_0x25fd47,null))[_0xc335('0x25')](saveUpdates(_0x4137d2[_0xc335('0x2d')],null))[_0xc335('0x25')](respondWithResult(_0x25fd47,null))[_0xc335('0x47')](handleError(_0x25fd47,null));};exports[_0xc335('0x26')]=function(_0x50c05d,_0x3a6251){return db[_0xc335('0x32')][_0xc335('0x4b')]({'where':{'id':_0x50c05d[_0xc335('0x54')]['id']}})[_0xc335('0x25')](handleEntityNotFound(_0x3a6251,null))['then'](removeEntity(_0x3a6251,null))[_0xc335('0x47')](handleError(_0x3a6251,null));};exports['run']=function(_0x5b6659,_0x2bed72,_0x417ba1){var _0x3d932e=require('../../config/schedule');return db['Schedule']['find']({'where':{'id':_0x5b6659[_0xc335('0x54')]['id']},'raw':!![]})[_0xc335('0x25')](handleEntityNotFound(_0x2bed72,null))[_0xc335('0x25')](function(){_0x3d932e['run'](_0x5b6659[_0xc335('0x54')]['id']);})['then'](respondWithStatusCode(_0x2bed72,null))[_0xc335('0x47')](handleError(_0x2bed72,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 35dfe57..324a950 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 _0xb742=['moment','bluebird','request-promise','path','rimraf','../../config/environment','lodash','util','../../config/logger'];(function(_0x595c1d,_0x48e097){var _0x4c65b9=function(_0x45db78){while(--_0x45db78){_0x595c1d['push'](_0x595c1d['shift']());}};_0x4c65b9(++_0x48e097);}(_0xb742,0xcc));var _0x2b74=function(_0x5ba549,_0x425afd){_0x5ba549=_0x5ba549-0x0;var _0x36e3a1=_0xb742[_0x5ba549];return _0x36e3a1;};'use strict';var _=require(_0x2b74('0x0'));var util=require(_0x2b74('0x1'));var logger=require(_0x2b74('0x2'))('api');var moment=require(_0x2b74('0x3'));var BPromise=require(_0x2b74('0x4'));var rp=require(_0x2b74('0x5'));var fs=require('fs');var path=require(_0x2b74('0x6'));var rimraf=require(_0x2b74('0x7'));var config=require(_0x2b74('0x8'));var attributes=require('./schedule.attributes');module['exports']=function(_0x1d571a,_0x40c438){return _0x1d571a['define']('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c81=['util','../../config/logger','api','path','../../config/environment','./schedule.attributes','define','tools_schedules','lodash'];(function(_0x53bcc3,_0x364374){var _0x47c959=function(_0x40ef7d){while(--_0x40ef7d){_0x53bcc3['push'](_0x53bcc3['shift']());}};_0x47c959(++_0x364374);}(_0x3c81,0x1ca));var _0x13c8=function(_0x7acab0,_0x3a2404){_0x7acab0=_0x7acab0-0x0;var _0x1989f9=_0x3c81[_0x7acab0];return _0x1989f9;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var logger=require(_0x13c8('0x2'))(_0x13c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x13c8('0x4'));var rimraf=require('rimraf');var config=require(_0x13c8('0x5'));var attributes=require(_0x13c8('0x6'));module['exports']=function(_0x40b4d1,_0x52b11b){return _0x40b4d1[_0x13c8('0x7')]('Schedule',attributes,{'tableName':_0x13c8('0x8'),'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 84ec4c3..ddd133b 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 _0x4229=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','error','code','message','Schedule,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x64aff8,_0x106082){var _0x5488a3=function(_0x36969c){while(--_0x36969c){_0x64aff8['push'](_0x64aff8['shift']());}};_0x5488a3(++_0x106082);}(_0x4229,0x117));var _0x9422=function(_0x47ac74,_0xaca32c){_0x47ac74=_0x47ac74-0x0;var _0x50280b=_0x4229[_0x47ac74];return _0x50280b;};'use strict';var _=require(_0x9422('0x0'));var util=require(_0x9422('0x1'));var moment=require(_0x9422('0x2'));var BPromise=require(_0x9422('0x3'));var rs=require(_0x9422('0x4'));var fs=require('fs');var Redis=require(_0x9422('0x5'));var db=require(_0x9422('0x6'))['db'];var utils=require(_0x9422('0x7'));var logger=require(_0x9422('0x8'))(_0x9422('0x9'));var config=require(_0x9422('0xa'));var jayson=require(_0x9422('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a152d,_0x87dd6d,_0x5d2f1a){return new BPromise(function(_0xada720,_0xc1daf0){return client[_0x9422('0xc')](_0x1a152d,_0x5d2f1a)[_0x9422('0xd')](function(_0x5750fa){logger[_0x9422('0xe')]('Schedule,\x20%s,\x20%s',_0x87dd6d,_0x9422('0xf'));logger[_0x9422('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0x87dd6d,_0x9422('0xf'),JSON['stringify'](_0x5750fa));if(_0x5750fa[_0x9422('0x11')]){if(_0x5750fa[_0x9422('0x11')][_0x9422('0x12')]===0x1f4){logger[_0x9422('0x11')]('Schedule,\x20%s,\x20%s',_0x87dd6d,_0x5750fa[_0x9422('0x11')][_0x9422('0x13')]);return _0xc1daf0(_0x5750fa[_0x9422('0x11')][_0x9422('0x13')]);}logger['error'](_0x9422('0x14'),_0x87dd6d,_0x5750fa[_0x9422('0x11')]['message']);return _0xada720(_0x5750fa[_0x9422('0x11')][_0x9422('0x13')]);}else{logger[_0x9422('0xe')](_0x9422('0x14'),_0x87dd6d,_0x9422('0xf'));_0xada720(_0x5750fa[_0x9422('0x15')]['message']);}})['catch'](function(_0x1c5210){logger[_0x9422('0x11')](_0x9422('0x14'),_0x87dd6d,_0x1c5210);_0xc1daf0(_0x1c5210);});});} \ No newline at end of file +var _0x9690=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x9690,0x16b));var _0x0969=function(_0xe8c84f,_0x16a059){_0xe8c84f=_0xe8c84f-0x0;var _0x250419=_0x9690[_0xe8c84f];return _0x250419;};'use strict';var _=require(_0x0969('0x0'));var util=require(_0x0969('0x1'));var moment=require(_0x0969('0x2'));var BPromise=require(_0x0969('0x3'));var rs=require(_0x0969('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0969('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0969('0x6'));var config=require('../../config/environment');var jayson=require(_0x0969('0x7'));var client=jayson[_0x0969('0x8')][_0x0969('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1014a0,_0x12d3ae,_0x56cadb){return new BPromise(function(_0x58dd62,_0x26e326){return client[_0x0969('0xa')](_0x1014a0,_0x56cadb)['then'](function(_0x260374){logger['info'](_0x0969('0xb'),_0x12d3ae,_0x0969('0xc'));logger[_0x0969('0xd')]('Schedule,\x20%s,\x20%s,\x20%s',_0x12d3ae,_0x0969('0xc'),JSON[_0x0969('0xe')](_0x260374));if(_0x260374[_0x0969('0xf')]){if(_0x260374['error']['code']===0x1f4){logger['error'](_0x0969('0xb'),_0x12d3ae,_0x260374[_0x0969('0xf')][_0x0969('0x10')]);return _0x26e326(_0x260374[_0x0969('0xf')][_0x0969('0x10')]);}logger[_0x0969('0xf')](_0x0969('0xb'),_0x12d3ae,_0x260374['error'][_0x0969('0x10')]);return _0x58dd62(_0x260374[_0x0969('0xf')][_0x0969('0x10')]);}else{logger[_0x0969('0x11')]('Schedule,\x20%s,\x20%s',_0x12d3ae,'request\x20sent');_0x58dd62(_0x260374[_0x0969('0x12')][_0x0969('0x10')]);}})[_0x0969('0x13')](function(_0x5d7366){logger[_0x0969('0xf')](_0x0969('0xb'),_0x12d3ae,_0x5d7366);_0x26e326(_0x5d7366);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 4f22b22..fc97183 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 _0x9d27=['/:id/download','download','post','put','delete','destroy','path','connect-timeout','express','../../components/auth/service','get','isAuthenticated','index','describe','/:id','show'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0x9d27,0xb6));var _0x79d2=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0x9d27[_0x2984d0];return _0x2885f2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x79d2('0x0'));var timeout=require(_0x79d2('0x1'));var express=require(_0x79d2('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x79d2('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0x79d2('0x4')]('/',auth[_0x79d2('0x5')](),controller[_0x79d2('0x6')]);router['get']('/describe',auth[_0x79d2('0x5')](),controller[_0x79d2('0x7')]);router[_0x79d2('0x4')](_0x79d2('0x8'),auth[_0x79d2('0x5')](),controller[_0x79d2('0x9')]);router['get'](_0x79d2('0xa'),auth[_0x79d2('0x5')](),controller[_0x79d2('0xb')]);router[_0x79d2('0xc')]('/',auth[_0x79d2('0x5')](),controller['create']);router[_0x79d2('0xd')](_0x79d2('0x8'),auth[_0x79d2('0x5')](),controller['update']);router[_0x79d2('0xe')](_0x79d2('0x8'),auth[_0x79d2('0x5')](),controller[_0x79d2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9f87=['get','index','isAuthenticated','describe','/:id','show','/:id/download','download','post','create','put','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller'];(function(_0x1c0505,_0x534a38){var _0x6fbc71=function(_0x21a13d){while(--_0x21a13d){_0x1c0505['push'](_0x1c0505['shift']());}};_0x6fbc71(++_0x534a38);}(_0x9f87,0x157));var _0x79f8=function(_0x235035,_0x5f06b5){_0x235035=_0x235035-0x0;var _0x318970=_0x9f87[_0x235035];return _0x318970;};'use strict';var multer=require(_0x79f8('0x0'));var util=require(_0x79f8('0x1'));var path=require('path');var timeout=require(_0x79f8('0x2'));var express=require(_0x79f8('0x3'));var router=express['Router']();var fs_extra=require(_0x79f8('0x4'));var auth=require(_0x79f8('0x5'));var interaction=require(_0x79f8('0x6'));var config=require(_0x79f8('0x7'));var controller=require(_0x79f8('0x8'));router[_0x79f8('0x9')]('/',auth['isAuthenticated'](),controller[_0x79f8('0xa')]);router[_0x79f8('0x9')]('/describe',auth[_0x79f8('0xb')](),controller[_0x79f8('0xc')]);router[_0x79f8('0x9')](_0x79f8('0xd'),auth[_0x79f8('0xb')](),controller[_0x79f8('0xe')]);router[_0x79f8('0x9')](_0x79f8('0xf'),auth[_0x79f8('0xb')](),controller[_0x79f8('0x10')]);router[_0x79f8('0x11')]('/',auth[_0x79f8('0xb')](),controller[_0x79f8('0x12')]);router[_0x79f8('0x13')](_0x79f8('0xd'),auth[_0x79f8('0xb')](),controller['update']);router['delete'](_0x79f8('0xd'),auth[_0x79f8('0xb')](),controller[_0x79f8('0x14')]);module[_0x79f8('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index c540f94..1b45928 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 _0xd6d6=['STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','../../config/environment','VIRTUAL','getDataValue','value','extname'];(function(_0x284ceb,_0x3b967a){var _0x569bbf=function(_0x1cd3bb){while(--_0x1cd3bb){_0x284ceb['push'](_0x284ceb['shift']());}};_0x569bbf(++_0x3b967a);}(_0xd6d6,0xbe));var _0x6d6d=function(_0xa78667,_0x21898b){_0xa78667=_0xa78667-0x0;var _0x16d815=_0xd6d6[_0xa78667];return _0x16d815;};'use strict';var Sequelize=require(_0x6d6d('0x0'));var moment=require(_0x6d6d('0x1'));var path=require(_0x6d6d('0x2'));var config=require(_0x6d6d('0x3'));module['exports']={'format':{'type':Sequelize[_0x6d6d('0x4')],'get':function(){return this[_0x6d6d('0x5')](_0x6d6d('0x6'))?path[_0x6d6d('0x7')](this[_0x6d6d('0x5')](_0x6d6d('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x6d6d('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x6d6d('0x8')],'set':function(_0x1bf731){var _0x44f83d=_0x1bf731[_0x6d6d('0x9')](/\\/g,'/');this[_0x6d6d('0xa')](_0x6d6d('0x6'),_0x44f83d);}},'rating':{'type':Sequelize[_0x6d6d('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x51dd38){this[_0x6d6d('0xa')](_0x6d6d('0xc'),moment()[_0x6d6d('0xd')](_0x51dd38,'ms'));this[_0x6d6d('0xa')](_0x6d6d('0xe'),moment());this['setDataValue'](_0x6d6d('0xf'),_0x51dd38);}},'startedAt':{'type':Sequelize[_0x6d6d('0x10')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0x6d6d('0x11')](_0x6d6d('0x12'))[_0x6d6d('0x13')]();}},'closedAt':{'type':Sequelize[_0x6d6d('0x10')],'get':function(){return moment(this[_0x6d6d('0x5')](_0x6d6d('0xe')))[_0x6d6d('0x11')](_0x6d6d('0x12'))['toString']();}},'createdAt':{'type':Sequelize[_0x6d6d('0x10')],'get':function(){return moment(this[_0x6d6d('0x5')](_0x6d6d('0x14')))[_0x6d6d('0x11')](_0x6d6d('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0x6d6d('0x10')],'get':function(){return moment(this['getDataValue'](_0x6d6d('0x15')))[_0x6d6d('0x11')](_0x6d6d('0x12'))['toString']();}}}; \ No newline at end of file +var _0x9a19=['VIRTUAL','getDataValue','value','extname','STRING','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports'];(function(_0x51f84a,_0x445f17){var _0x4ba63d=function(_0x5c8b6c){while(--_0x5c8b6c){_0x51f84a['push'](_0x51f84a['shift']());}};_0x4ba63d(++_0x445f17);}(_0x9a19,0x114));var _0x99a1=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9a19[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0x99a1('0x0'));var moment=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var config=require('../../config/environment');module[_0x99a1('0x3')]={'format':{'type':Sequelize[_0x99a1('0x4')],'get':function(){return this[_0x99a1('0x5')](_0x99a1('0x6'))?path[_0x99a1('0x7')](this[_0x99a1('0x5')](_0x99a1('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x99a1('0x8')]},'channel':{'type':Sequelize[_0x99a1('0x8')]},'value':{'type':Sequelize[_0x99a1('0x8')],'set':function(_0x65045d){var _0x523b9e=_0x65045d['replace'](/\\/g,'/');this['setDataValue'](_0x99a1('0x6'),_0x523b9e);}},'rating':{'type':Sequelize[_0x99a1('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x5874fc){this[_0x99a1('0xa')](_0x99a1('0xb'),moment()[_0x99a1('0xc')](_0x5874fc,'ms'));this[_0x99a1('0xa')](_0x99a1('0xd'),moment());this['setDataValue'](_0x99a1('0xe'),_0x5874fc);}},'startedAt':{'type':Sequelize[_0x99a1('0xf')],'get':function(){return moment(this[_0x99a1('0x5')](_0x99a1('0xb')))[_0x99a1('0x10')](_0x99a1('0x11'))[_0x99a1('0x12')]();}},'closedAt':{'type':Sequelize[_0x99a1('0xf')],'get':function(){return moment(this[_0x99a1('0x5')](_0x99a1('0xd')))[_0x99a1('0x10')](_0x99a1('0x11'))[_0x99a1('0x12')]();}},'createdAt':{'type':Sequelize[_0x99a1('0xf')],'get':function(){return moment(this[_0x99a1('0x5')]('createdAt'))[_0x99a1('0x10')](_0x99a1('0x11'))[_0x99a1('0x12')]();}},'updatedAt':{'type':Sequelize[_0x99a1('0xf')],'get':function(){return moment(this[_0x99a1('0x5')](_0x99a1('0x13')))[_0x99a1('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 8515d58..a5f78b9 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 _0x6e29=['destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','render','body','contact','message','agent','interaction','index','map','rawAttributes','type','key','differenceBy','format','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','catch','params','find','create','duration','createdAt','closedAt','value','describe','../../components/encryptor','join','%s.cypher','existsSync','decryptFile','secrets','recording','root','server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','download','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x111b0b,_0x428479){var _0x5606a2=function(_0xce4090){while(--_0xce4090){_0x111b0b['push'](_0x111b0b['shift']());}};_0x5606a2(++_0x428479);}(_0x6e29,0x1cd));var _0x96e2=function(_0x35c6c1,_0x19623e){_0x35c6c1=_0x35c6c1-0x0;var _0x312452=_0x6e29[_0x35c6c1];return _0x312452;};'use strict';var emlformat=require(_0x96e2('0x0'));var rimraf=require(_0x96e2('0x1'));var zipdir=require(_0x96e2('0x2'));var jsonpatch=require(_0x96e2('0x3'));var rp=require(_0x96e2('0x4'));var moment=require(_0x96e2('0x5'));var BPromise=require(_0x96e2('0x6'));var Mustache=require(_0x96e2('0x7'));var util=require('util');var path=require(_0x96e2('0x8'));var sox=require(_0x96e2('0x9'));var csv=require(_0x96e2('0xa'));var ejs=require(_0x96e2('0xb'));var fs=require('fs');var fs_extra=require(_0x96e2('0xc'));var _=require(_0x96e2('0xd'));var squel=require(_0x96e2('0xe'));var crypto=require(_0x96e2('0xf'));var jsforce=require(_0x96e2('0x10'));var deskjs=require(_0x96e2('0x11'));var toCsv=require(_0x96e2('0xa'));var querystring=require(_0x96e2('0x12'));var Papa=require(_0x96e2('0x13'));var Redis=require(_0x96e2('0x14'));var authService=require(_0x96e2('0x15'));var qs=require(_0x96e2('0x16'));var as=require(_0x96e2('0x17'));var hardwareService=require(_0x96e2('0x18'));var logger=require(_0x96e2('0x19'))(_0x96e2('0x1a'));var utils=require('../../config/utils');var config=require(_0x96e2('0x1b'));var licenseUtil=require(_0x96e2('0x1c'));var db=require(_0x96e2('0x1d'))['db'];function respondWithStatusCode(_0x4df6c6,_0x35f809){_0x35f809=_0x35f809||0xcc;return function(_0x251fa0){if(_0x251fa0){return _0x4df6c6[_0x96e2('0x1e')](_0x35f809);}return _0x4df6c6[_0x96e2('0x1f')](_0x35f809)[_0x96e2('0x20')]();};}function respondWithResult(_0x2aaea4,_0x38fe3b){_0x38fe3b=_0x38fe3b||0xc8;return function(_0x17a0c8){if(_0x17a0c8){return _0x2aaea4[_0x96e2('0x1f')](_0x38fe3b)[_0x96e2('0x21')](_0x17a0c8);}};}function respondWithFilteredResult(_0x2ffaf1,_0x3e9c7e){return function(_0x592e4c){if(_0x592e4c){var _0x535887=typeof _0x3e9c7e[_0x96e2('0x22')]==='undefined'&&typeof _0x3e9c7e[_0x96e2('0x23')]===_0x96e2('0x24');var _0x4efe72=_0x592e4c['count'];var _0x5c0ad0=_0x535887?0x0:_0x3e9c7e[_0x96e2('0x22')];var _0x5ab41e=_0x535887?_0x592e4c[_0x96e2('0x25')]:_0x3e9c7e[_0x96e2('0x22')]+_0x3e9c7e[_0x96e2('0x23')];var _0xb23d37;if(_0x5ab41e>=_0x4efe72){_0x5ab41e=_0x4efe72;_0xb23d37=0xc8;}else{_0xb23d37=0xce;}_0x2ffaf1[_0x96e2('0x1f')](_0xb23d37);return _0x2ffaf1[_0x96e2('0x26')](_0x96e2('0x27'),_0x5c0ad0+'-'+_0x5ab41e+'/'+_0x4efe72)[_0x96e2('0x21')](_0x592e4c);}return null;};}function patchUpdates(_0x46660b){return function(_0x54b62f){try{jsonpatch[_0x96e2('0x28')](_0x54b62f,_0x46660b,!![]);}catch(_0x1c5687){return BPromise[_0x96e2('0x29')](_0x1c5687);}return _0x54b62f['save']();};}function saveUpdates(_0x2a121f,_0x3e5e52){return function(_0x34b461){if(_0x34b461){return _0x34b461[_0x96e2('0x2a')](_0x2a121f)[_0x96e2('0x2b')](function(_0x10aebb){return _0x10aebb;});}return null;};}function removeEntity(_0x3e4cd1,_0x447f5e){return function(_0x435d44){if(_0x435d44){return _0x435d44['destroy']()['then'](function(){_0x3e4cd1['status'](0xcc)[_0x96e2('0x20')]();});}};}function handleEntityNotFound(_0x55b8d9,_0x546de6){return function(_0x4874ad){if(!_0x4874ad){_0x55b8d9[_0x96e2('0x1e')](0x194);}return _0x4874ad;};}function handleError(_0x5b07e0,_0x53b2eb){_0x53b2eb=_0x53b2eb||0x1f4;return function(_0x370e8d){logger[_0x96e2('0x2c')](_0x370e8d[_0x96e2('0x2d')]);if(_0x370e8d[_0x96e2('0x2e')]){delete _0x370e8d[_0x96e2('0x2e')];}_0x5b07e0[_0x96e2('0x1f')](_0x53b2eb)[_0x96e2('0x2f')](_0x370e8d);};}function getMustacheRender(_0x56f5ab,_0x72a052){return Mustache[_0x96e2('0x30')](_0x56f5ab,_['merge'](_0x72a052[_0x96e2('0x31')],{'contact':_0x72a052[_0x96e2('0x32')],'message':_0x72a052[_0x96e2('0x33')],'agent':_0x72a052[_0x96e2('0x34')],'interaction':_0x72a052[_0x96e2('0x35')],'account':_0x72a052['account']}))||'';}exports[_0x96e2('0x36')]=function(_0x840137,_0x1a44aa){var _0x36cd94={},_0x3fe040={},_0x4ab521={'count':0x0,'rows':[]};var _0x5a6697=_[_0x96e2('0x37')](db['ScreenRecording'][_0x96e2('0x38')],function(_0xc519bb){return{'name':_0xc519bb['fieldName'],'type':_0xc519bb[_0x96e2('0x39')][_0x96e2('0x3a')]};});_0x3fe040['model']=_[_0x96e2('0x3b')](_[_0x96e2('0x37')](_0x5a6697,'name'),[_0x96e2('0x3c')]);_0x3fe040[_0x96e2('0x3d')]=_[_0x96e2('0x3e')](_0x840137[_0x96e2('0x3d')]);_0x3fe040[_0x96e2('0x3f')]=_['intersection'](_0x3fe040['model'],_0x3fe040['query']);_0x36cd94[_0x96e2('0x40')]=_[_0x96e2('0x41')](_0x3fe040[_0x96e2('0x42')],qs[_0x96e2('0x43')](_0x840137[_0x96e2('0x3d')][_0x96e2('0x43')]));_0x36cd94[_0x96e2('0x40')]=_0x36cd94[_0x96e2('0x40')][_0x96e2('0x44')]?_0x36cd94[_0x96e2('0x40')]:_0x3fe040[_0x96e2('0x42')];if(!_0x840137[_0x96e2('0x3d')][_0x96e2('0x45')](_0x96e2('0x46'))){_0x36cd94['limit']=qs['limit'](_0x840137['query'][_0x96e2('0x23')]);_0x36cd94[_0x96e2('0x22')]=qs['offset'](_0x840137['query'][_0x96e2('0x22')]);}_0x36cd94[_0x96e2('0x47')]=qs['sort'](_0x840137[_0x96e2('0x3d')]['sort']);_0x36cd94[_0x96e2('0x48')]=qs[_0x96e2('0x3f')](_['pick'](_0x840137[_0x96e2('0x3d')],_0x3fe040['filters']),_0x5a6697);if(_0x840137[_0x96e2('0x3d')][_0x96e2('0x49')]){_0x36cd94['where']=_[_0x96e2('0x4a')](_0x36cd94[_0x96e2('0x48')],{'$or':_[_0x96e2('0x37')](_0x5a6697,function(_0x105dec){if(_0x105dec[_0x96e2('0x39')]!==_0x96e2('0x4b')){var _0x3d0ae0={};_0x3d0ae0[_0x105dec[_0x96e2('0x2e')]]={'$like':'%'+_0x840137[_0x96e2('0x3d')][_0x96e2('0x49')]+'%'};return _0x3d0ae0;}})});}_0x36cd94=_['merge']({},_0x36cd94,_0x840137[_0x96e2('0x4c')]);var _0x3f811b={'where':_0x36cd94['where']};return db[_0x96e2('0x4d')][_0x96e2('0x25')](_0x3f811b)['then'](function(_0x15c403){_0x4ab521[_0x96e2('0x25')]=_0x15c403;if(_0x840137[_0x96e2('0x3d')][_0x96e2('0x4e')]){_0x36cd94[_0x96e2('0x4f')]=[{'all':!![]}];}return db[_0x96e2('0x4d')][_0x96e2('0x50')](_0x36cd94);})['then'](function(_0x35a2ab){_0x4ab521[_0x96e2('0x51')]=_0x35a2ab;return _0x4ab521;})[_0x96e2('0x2b')](respondWithFilteredResult(_0x1a44aa,_0x36cd94))[_0x96e2('0x52')](handleError(_0x1a44aa,null));};exports['show']=function(_0x166f93,_0x1f727d){var _0xf5a9be={'raw':![],'where':{'id':_0x166f93[_0x96e2('0x53')]['id']}},_0x27c7c4={};_0x27c7c4[_0x96e2('0x42')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x27c7c4['query']=_[_0x96e2('0x3e')](_0x166f93[_0x96e2('0x3d')]);_0x27c7c4[_0x96e2('0x3f')]=_['intersection'](_0x27c7c4[_0x96e2('0x42')],_0x27c7c4['query']);_0xf5a9be[_0x96e2('0x40')]=_[_0x96e2('0x41')](_0x27c7c4[_0x96e2('0x42')],qs[_0x96e2('0x43')](_0x166f93[_0x96e2('0x3d')][_0x96e2('0x43')]));_0xf5a9be['attributes']=_0xf5a9be['attributes'][_0x96e2('0x44')]?_0xf5a9be[_0x96e2('0x40')]:_0x27c7c4['model'];if(_0x166f93[_0x96e2('0x3d')][_0x96e2('0x4e')]){_0xf5a9be[_0x96e2('0x4f')]=[{'all':!![]}];}_0xf5a9be=_[_0x96e2('0x4a')]({},_0xf5a9be,_0x166f93[_0x96e2('0x4c')]);return db['ScreenRecording'][_0x96e2('0x54')](_0xf5a9be)[_0x96e2('0x2b')](handleEntityNotFound(_0x1f727d,null))['then'](respondWithResult(_0x1f727d,null))['catch'](handleError(_0x1f727d,null));};exports[_0x96e2('0x55')]=function(_0x3c2461,_0x1a5906){return db[_0x96e2('0x4d')][_0x96e2('0x55')](_0x3c2461[_0x96e2('0x31')],{})[_0x96e2('0x2b')](respondWithResult(_0x1a5906,0xc9))[_0x96e2('0x52')](handleError(_0x1a5906,null));};exports[_0x96e2('0x2a')]=function(_0x5ef7c1,_0x1d7c26){if(_0x5ef7c1[_0x96e2('0x31')]['id']){delete _0x5ef7c1[_0x96e2('0x31')]['id'];}delete _0x5ef7c1[_0x96e2('0x31')][_0x96e2('0x56')];delete _0x5ef7c1['body'][_0x96e2('0x57')];delete _0x5ef7c1[_0x96e2('0x31')][_0x96e2('0x58')];delete _0x5ef7c1['body'][_0x96e2('0x59')];return db[_0x96e2('0x4d')][_0x96e2('0x54')]({'where':{'id':_0x5ef7c1[_0x96e2('0x53')]['id']}})[_0x96e2('0x2b')](handleEntityNotFound(_0x1d7c26,null))[_0x96e2('0x2b')](saveUpdates(_0x5ef7c1[_0x96e2('0x31')],null))[_0x96e2('0x2b')](respondWithResult(_0x1d7c26,null))[_0x96e2('0x52')](handleError(_0x1d7c26,null));};exports[_0x96e2('0x5a')]=function(_0x414d43,_0x5042d1){return db[_0x96e2('0x4d')][_0x96e2('0x5a')]()[_0x96e2('0x2b')](respondWithResult(_0x5042d1,null))[_0x96e2('0x52')](handleError(_0x5042d1,null));};exports['download']=function(_0x36c6d0,_0x480d60,_0x1495a7){var _0x2a1d40=require(_0x96e2('0x5b'));var _0x519d01=![];var _0x94d1e1={};if(_0x36c6d0['query']['type']&&_0x36c6d0['query'][_0x96e2('0x39')]==='uniqueid'){_0x94d1e1['uniqueid']=_0x36c6d0['params']['id'];}else{_0x94d1e1['id']=_0x36c6d0[_0x96e2('0x53')]['id'];}return db[_0x96e2('0x4d')][_0x96e2('0x54')]({'where':_0x94d1e1,'attributes':['id',_0x96e2('0x59')],'raw':!![]})['then'](handleEntityNotFound(_0x480d60,null))[_0x96e2('0x2b')](function(_0x290d83){if(_0x290d83){var _0x28f5ea=path[_0x96e2('0x5c')](config['root'],'server/files/screen_recordings',_0x290d83[_0x96e2('0x59')]);var _0x1c4b8d=util[_0x96e2('0x3c')](_0x96e2('0x5d'),_0x28f5ea);if(fs[_0x96e2('0x5e')](_0x1c4b8d)){_0x519d01=!![];return _0x2a1d40[_0x96e2('0x5f')](_0x1c4b8d,_0x28f5ea,config[_0x96e2('0x60')][_0x96e2('0x61')])[_0x96e2('0x2b')](function(){return _0x290d83;});}return _0x290d83;}})[_0x96e2('0x2b')](function(_0x3f2eac){if(_0x3f2eac){var _0x3913c9=path['join'](config[_0x96e2('0x62')],_0x96e2('0x63'),_0x3f2eac[_0x96e2('0x59')]);if(!fs['existsSync'](_0x3913c9)){throw new db[(_0x96e2('0x64'))]['ValidationError'](_0x96e2('0x65'));}if(_0x3f2eac[_0x96e2('0x66')]){return _0x480d60[_0x96e2('0x67')](_0x3913c9,_0x3f2eac[_0x96e2('0x66')]+path['extname'](_0x3913c9),function(){if(_0x519d01){fs[_0x96e2('0x68')](_0x3913c9);}});}else{return _0x480d60[_0x96e2('0x67')](_0x3913c9,function(_0x9c206){if(_0x519d01){fs[_0x96e2('0x68')](_0x3913c9);}});}}})[_0x96e2('0x52')](function(_0x3b217b){if(_0x3b217b[_0x96e2('0x33')]===_0x96e2('0x65')){_0x480d60['status'](0x194)[_0x96e2('0x2f')](_0x96e2('0x69'));}else{return handleError(_0x480d60,null);}});};exports['destroy']=function(_0x36d7b3,_0x4739c2){return db[_0x96e2('0x4d')][_0x96e2('0x54')]({'where':{'id':_0x36d7b3[_0x96e2('0x53')]['id']}})['then'](function(_0x54015a){if(_[_0x96e2('0x6a')](_0x54015a)){throw new ReferenceError(_0x96e2('0x6b'));}return _0x54015a;})[_0x96e2('0x2b')](function(_0x307f8e){var _0x4cc4fe=path[_0x96e2('0x5c')](config[_0x96e2('0x62')],_0x96e2('0x63'),_0x307f8e['value']);logger[_0x96e2('0x6c')](_0x96e2('0x6d'),_0x4cc4fe);if(!_['isNil'](_0x307f8e[_0x96e2('0x59')])&&fs[_0x96e2('0x5e')](_0x4cc4fe)){logger[_0x96e2('0x6c')](_0x96e2('0x6e')+_0x4cc4fe+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x96e2('0x6f')](_0x4cc4fe);}_0x4cc4fe=_0x4cc4fe+_0x96e2('0x70');if(!_['isNil'](_0x307f8e[_0x96e2('0x59')])&&fs[_0x96e2('0x5e')](_0x4cc4fe)){logger[_0x96e2('0x6c')](_0x96e2('0x6e')+_0x4cc4fe+_0x96e2('0x71'));fs[_0x96e2('0x6f')](_0x4cc4fe);}return _0x307f8e;})[_0x96e2('0x2b')](function(_0x22a4b1){if(!_0x22a4b1)throw new InternalError();return _0x22a4b1[_0x96e2('0x72')]();})[_0x96e2('0x2b')](function(){_0x4739c2['status'](0xcc)[_0x96e2('0x20')]();})['catch'](handleError(_0x4739c2,null));}; \ No newline at end of file +var _0x336f=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','includeAll','include','findAll','rows','show','options','find','catch','create','duration','createdAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','apply','update','then','destroy','sendStatus','stack','name','render','merge','body','contact','agent','interaction','account','index','map','ScreenRecording','rawAttributes','fieldName','model','differenceBy','format','query','keys','filters','intersection','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x336f,0x176));var _0xf336=function(_0x4ee80d,_0x28a619){_0x4ee80d=_0x4ee80d-0x0;var _0x183cda=_0x336f[_0x4ee80d];return _0x183cda;};'use strict';var emlformat=require(_0xf336('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf336('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf336('0x2'));var Mustache=require(_0xf336('0x3'));var util=require(_0xf336('0x4'));var path=require('path');var sox=require(_0xf336('0x5'));var csv=require('to-csv');var ejs=require(_0xf336('0x6'));var fs=require('fs');var fs_extra=require(_0xf336('0x7'));var _=require(_0xf336('0x8'));var squel=require(_0xf336('0x9'));var crypto=require('crypto');var jsforce=require(_0xf336('0xa'));var deskjs=require(_0xf336('0xb'));var toCsv=require(_0xf336('0xc'));var querystring=require(_0xf336('0xd'));var Papa=require('papaparse');var Redis=require(_0xf336('0xe'));var authService=require(_0xf336('0xf'));var qs=require(_0xf336('0x10'));var as=require(_0xf336('0x11'));var hardwareService=require(_0xf336('0x12'));var logger=require(_0xf336('0x13'))(_0xf336('0x14'));var utils=require(_0xf336('0x15'));var config=require(_0xf336('0x16'));var licenseUtil=require(_0xf336('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x259629,_0xbdee9c){_0xbdee9c=_0xbdee9c||0xcc;return function(_0x5bc89b){if(_0x5bc89b){return _0x259629['sendStatus'](_0xbdee9c);}return _0x259629[_0xf336('0x18')](_0xbdee9c)[_0xf336('0x19')]();};}function respondWithResult(_0xabaa74,_0x4dcac2){_0x4dcac2=_0x4dcac2||0xc8;return function(_0x1790f0){if(_0x1790f0){return _0xabaa74[_0xf336('0x18')](_0x4dcac2)[_0xf336('0x1a')](_0x1790f0);}};}function respondWithFilteredResult(_0x5b9223,_0x56b4a1){return function(_0x12d28e){if(_0x12d28e){var _0x446ff9=typeof _0x56b4a1[_0xf336('0x1b')]===_0xf336('0x1c')&&typeof _0x56b4a1[_0xf336('0x1d')]===_0xf336('0x1c');var _0x22a25e=_0x12d28e[_0xf336('0x1e')];var _0x258a0e=_0x446ff9?0x0:_0x56b4a1['offset'];var _0x5dee3e=_0x446ff9?_0x12d28e['count']:_0x56b4a1[_0xf336('0x1b')]+_0x56b4a1[_0xf336('0x1d')];var _0x120989;if(_0x5dee3e>=_0x22a25e){_0x5dee3e=_0x22a25e;_0x120989=0xc8;}else{_0x120989=0xce;}_0x5b9223['status'](_0x120989);return _0x5b9223['set']('Content-Range',_0x258a0e+'-'+_0x5dee3e+'/'+_0x22a25e)[_0xf336('0x1a')](_0x12d28e);}return null;};}function patchUpdates(_0x4e5ac0){return function(_0x353b8a){try{jsonpatch[_0xf336('0x1f')](_0x353b8a,_0x4e5ac0,!![]);}catch(_0x11e4ad){return BPromise['reject'](_0x11e4ad);}return _0x353b8a['save']();};}function saveUpdates(_0xfde7c5,_0x2c3a94){return function(_0x574fa7){if(_0x574fa7){return _0x574fa7[_0xf336('0x20')](_0xfde7c5)[_0xf336('0x21')](function(_0x719ebb){return _0x719ebb;});}return null;};}function removeEntity(_0x129d03,_0x14652a){return function(_0x308fb6){if(_0x308fb6){return _0x308fb6[_0xf336('0x22')]()['then'](function(){_0x129d03[_0xf336('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49329d,_0x217744){return function(_0x443bc8){if(!_0x443bc8){_0x49329d[_0xf336('0x23')](0x194);}return _0x443bc8;};}function handleError(_0x4b7d11,_0x1d1257){_0x1d1257=_0x1d1257||0x1f4;return function(_0x3a1119){logger['error'](_0x3a1119[_0xf336('0x24')]);if(_0x3a1119[_0xf336('0x25')]){delete _0x3a1119['name'];}_0x4b7d11[_0xf336('0x18')](_0x1d1257)['send'](_0x3a1119);};}function getMustacheRender(_0x22afc0,_0x488929){return Mustache[_0xf336('0x26')](_0x22afc0,_[_0xf336('0x27')](_0x488929[_0xf336('0x28')],{'contact':_0x488929[_0xf336('0x29')],'message':_0x488929['message'],'agent':_0x488929[_0xf336('0x2a')],'interaction':_0x488929[_0xf336('0x2b')],'account':_0x488929[_0xf336('0x2c')]}))||'';}exports[_0xf336('0x2d')]=function(_0x5496e1,_0x49b79f){var _0x1d78cb={},_0x5cda3c={},_0x4f2888={'count':0x0,'rows':[]};var _0x3ac9fb=_[_0xf336('0x2e')](db[_0xf336('0x2f')][_0xf336('0x30')],function(_0x5abd57){return{'name':_0x5abd57[_0xf336('0x31')],'type':_0x5abd57['type']['key']};});_0x5cda3c[_0xf336('0x32')]=_[_0xf336('0x33')](_[_0xf336('0x2e')](_0x3ac9fb,'name'),[_0xf336('0x34')]);_0x5cda3c[_0xf336('0x35')]=_[_0xf336('0x36')](_0x5496e1[_0xf336('0x35')]);_0x5cda3c[_0xf336('0x37')]=_[_0xf336('0x38')](_0x5cda3c[_0xf336('0x32')],_0x5cda3c[_0xf336('0x35')]);_0x1d78cb['attributes']=_['intersection'](_0x5cda3c[_0xf336('0x32')],qs['fields'](_0x5496e1['query'][_0xf336('0x39')]));_0x1d78cb[_0xf336('0x3a')]=_0x1d78cb[_0xf336('0x3a')][_0xf336('0x3b')]?_0x1d78cb['attributes']:_0x5cda3c[_0xf336('0x32')];if(!_0x5496e1['query'][_0xf336('0x3c')](_0xf336('0x3d'))){_0x1d78cb[_0xf336('0x1d')]=qs['limit'](_0x5496e1[_0xf336('0x35')]['limit']);_0x1d78cb[_0xf336('0x1b')]=qs[_0xf336('0x1b')](_0x5496e1[_0xf336('0x35')][_0xf336('0x1b')]);}_0x1d78cb[_0xf336('0x3e')]=qs[_0xf336('0x3f')](_0x5496e1[_0xf336('0x35')][_0xf336('0x3f')]);_0x1d78cb[_0xf336('0x40')]=qs[_0xf336('0x37')](_[_0xf336('0x41')](_0x5496e1[_0xf336('0x35')],_0x5cda3c['filters']),_0x3ac9fb);if(_0x5496e1['query'][_0xf336('0x42')]){_0x1d78cb['where']=_[_0xf336('0x27')](_0x1d78cb[_0xf336('0x40')],{'$or':_[_0xf336('0x2e')](_0x3ac9fb,function(_0x4db491){if(_0x4db491[_0xf336('0x43')]!==_0xf336('0x44')){var _0x3bca39={};_0x3bca39[_0x4db491['name']]={'$like':'%'+_0x5496e1[_0xf336('0x35')]['filter']+'%'};return _0x3bca39;}})});}_0x1d78cb=_[_0xf336('0x27')]({},_0x1d78cb,_0x5496e1['options']);var _0x547771={'where':_0x1d78cb[_0xf336('0x40')]};return db[_0xf336('0x2f')][_0xf336('0x1e')](_0x547771)[_0xf336('0x21')](function(_0x33ef66){_0x4f2888[_0xf336('0x1e')]=_0x33ef66;if(_0x5496e1[_0xf336('0x35')][_0xf336('0x45')]){_0x1d78cb[_0xf336('0x46')]=[{'all':!![]}];}return db['ScreenRecording'][_0xf336('0x47')](_0x1d78cb);})['then'](function(_0x59213e){_0x4f2888[_0xf336('0x48')]=_0x59213e;return _0x4f2888;})[_0xf336('0x21')](respondWithFilteredResult(_0x49b79f,_0x1d78cb))['catch'](handleError(_0x49b79f,null));};exports[_0xf336('0x49')]=function(_0x4ec45d,_0x5b9c9b){var _0x200877={'raw':![],'where':{'id':_0x4ec45d['params']['id']}},_0x50632c={};_0x50632c[_0xf336('0x32')]=_[_0xf336('0x36')](db[_0xf336('0x2f')][_0xf336('0x30')]);_0x50632c[_0xf336('0x35')]=_[_0xf336('0x36')](_0x4ec45d[_0xf336('0x35')]);_0x50632c[_0xf336('0x37')]=_['intersection'](_0x50632c[_0xf336('0x32')],_0x50632c[_0xf336('0x35')]);_0x200877[_0xf336('0x3a')]=_['intersection'](_0x50632c[_0xf336('0x32')],qs[_0xf336('0x39')](_0x4ec45d[_0xf336('0x35')]['fields']));_0x200877[_0xf336('0x3a')]=_0x200877[_0xf336('0x3a')]['length']?_0x200877[_0xf336('0x3a')]:_0x50632c[_0xf336('0x32')];if(_0x4ec45d[_0xf336('0x35')][_0xf336('0x45')]){_0x200877[_0xf336('0x46')]=[{'all':!![]}];}_0x200877=_[_0xf336('0x27')]({},_0x200877,_0x4ec45d[_0xf336('0x4a')]);return db[_0xf336('0x2f')][_0xf336('0x4b')](_0x200877)[_0xf336('0x21')](handleEntityNotFound(_0x5b9c9b,null))[_0xf336('0x21')](respondWithResult(_0x5b9c9b,null))[_0xf336('0x4c')](handleError(_0x5b9c9b,null));};exports[_0xf336('0x4d')]=function(_0x22fca4,_0x2d69b0){return db[_0xf336('0x2f')]['create'](_0x22fca4['body'],{})['then'](respondWithResult(_0x2d69b0,0xc9))['catch'](handleError(_0x2d69b0,null));};exports[_0xf336('0x20')]=function(_0x20c54e,_0x3f42bb){if(_0x20c54e[_0xf336('0x28')]['id']){delete _0x20c54e[_0xf336('0x28')]['id'];}delete _0x20c54e['body'][_0xf336('0x4e')];delete _0x20c54e[_0xf336('0x28')][_0xf336('0x4f')];delete _0x20c54e['body']['closedAt'];delete _0x20c54e['body'][_0xf336('0x50')];return db['ScreenRecording'][_0xf336('0x4b')]({'where':{'id':_0x20c54e[_0xf336('0x51')]['id']}})[_0xf336('0x21')](handleEntityNotFound(_0x3f42bb,null))[_0xf336('0x21')](saveUpdates(_0x20c54e['body'],null))[_0xf336('0x21')](respondWithResult(_0x3f42bb,null))[_0xf336('0x4c')](handleError(_0x3f42bb,null));};exports[_0xf336('0x52')]=function(_0xf0c435,_0x332a83){return db[_0xf336('0x2f')][_0xf336('0x52')]()[_0xf336('0x21')](respondWithResult(_0x332a83,null))['catch'](handleError(_0x332a83,null));};exports[_0xf336('0x53')]=function(_0x1f0682,_0x12de1a,_0x3c84df){var _0x31476b=require(_0xf336('0x54'));var _0x2dc4d0=![];var _0x8dd133={};if(_0x1f0682[_0xf336('0x35')][_0xf336('0x43')]&&_0x1f0682[_0xf336('0x35')][_0xf336('0x43')]===_0xf336('0x55')){_0x8dd133[_0xf336('0x55')]=_0x1f0682[_0xf336('0x51')]['id'];}else{_0x8dd133['id']=_0x1f0682[_0xf336('0x51')]['id'];}return db[_0xf336('0x2f')][_0xf336('0x4b')]({'where':_0x8dd133,'attributes':['id','value'],'raw':!![]})[_0xf336('0x21')](handleEntityNotFound(_0x12de1a,null))[_0xf336('0x21')](function(_0xb7af66){if(_0xb7af66){var _0x545ea4=path[_0xf336('0x56')](config[_0xf336('0x57')],'server/files/screen_recordings',_0xb7af66['value']);var _0x15c1e3=util[_0xf336('0x34')](_0xf336('0x58'),_0x545ea4);if(fs[_0xf336('0x59')](_0x15c1e3)){_0x2dc4d0=!![];return _0x31476b[_0xf336('0x5a')](_0x15c1e3,_0x545ea4,config[_0xf336('0x5b')][_0xf336('0x5c')])[_0xf336('0x21')](function(){return _0xb7af66;});}return _0xb7af66;}})[_0xf336('0x21')](function(_0x4711f8){if(_0x4711f8){var _0xa16722=path[_0xf336('0x56')](config[_0xf336('0x57')],'server/files/screen_recordings',_0x4711f8[_0xf336('0x50')]);if(!fs[_0xf336('0x59')](_0xa16722)){throw new db[(_0xf336('0x5d'))][(_0xf336('0x5e'))](_0xf336('0x5f'));}if(_0x4711f8[_0xf336('0x60')]){return _0x12de1a['download'](_0xa16722,_0x4711f8[_0xf336('0x60')]+path[_0xf336('0x61')](_0xa16722),function(){if(_0x2dc4d0){fs['unlink'](_0xa16722);}});}else{return _0x12de1a['download'](_0xa16722,function(_0x594041){if(_0x2dc4d0){fs[_0xf336('0x62')](_0xa16722);}});}}})[_0xf336('0x4c')](function(_0x546344){if(_0x546344[_0xf336('0x63')]===_0xf336('0x5f')){_0x12de1a[_0xf336('0x18')](0x194)[_0xf336('0x64')](_0xf336('0x65'));}else{return handleError(_0x12de1a,null);}});};exports[_0xf336('0x22')]=function(_0x20a776,_0x29cb1e){return db[_0xf336('0x2f')][_0xf336('0x4b')]({'where':{'id':_0x20a776['params']['id']}})[_0xf336('0x21')](function(_0x4d8a2b){if(_[_0xf336('0x66')](_0x4d8a2b)){throw new ReferenceError(_0xf336('0x67'));}return _0x4d8a2b;})['then'](function(_0x5369ae){var _0x56dcc5=path[_0xf336('0x56')](config['root'],'server/files/screen_recordings',_0x5369ae[_0xf336('0x50')]);logger[_0xf336('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x56dcc5);if(!_[_0xf336('0x66')](_0x5369ae[_0xf336('0x50')])&&fs[_0xf336('0x59')](_0x56dcc5)){logger[_0xf336('0x68')]('File:\x20\x22'+_0x56dcc5+_0xf336('0x69'));fs[_0xf336('0x6a')](_0x56dcc5);}_0x56dcc5=_0x56dcc5+_0xf336('0x6b');if(!_[_0xf336('0x66')](_0x5369ae[_0xf336('0x50')])&&fs[_0xf336('0x59')](_0x56dcc5)){logger[_0xf336('0x68')]('File:\x20\x22'+_0x56dcc5+_0xf336('0x69'));fs[_0xf336('0x6a')](_0x56dcc5);}return _0x5369ae;})[_0xf336('0x21')](function(_0x400f6d){if(!_0x400f6d)throw new InternalError();return _0x400f6d[_0xf336('0x22')]();})[_0xf336('0x21')](function(){_0x29cb1e['status'](0xcc)[_0xf336('0x19')]();})[_0xf336('0x4c')](handleError(_0x29cb1e,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index f88b839..130110b 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 _0xc28c=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xc28c,0x154));var _0xcc28=function(_0x260b48,_0x117977){_0x260b48=_0x260b48-0x0;var _0x3f730b=_0xc28c[_0x260b48];return _0x3f730b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcc28('0x0'))('api');var moment=require(_0xcc28('0x1'));var BPromise=require(_0xcc28('0x2'));var rp=require(_0xcc28('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcc28('0x4'));var attributes=require(_0xcc28('0x5'));module['exports']=function(_0x1f7125,_0x3e5258){return _0x1f7125[_0xcc28('0x6')](_0xcc28('0x7'),attributes,{'tableName':_0xcc28('0x8'),'paranoid':![],'indexes':[{'name':_0xcc28('0x9'),'fields':[_0xcc28('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe6ac=['bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','api','moment'];(function(_0x5710ee,_0x2aaffe){var _0x1912a3=function(_0x591f67){while(--_0x591f67){_0x5710ee['push'](_0x5710ee['shift']());}};_0x1912a3(++_0x2aaffe);}(_0xe6ac,0xec));var _0xce6a=function(_0x2389bc,_0x167cd2){_0x2389bc=_0x2389bc-0x0;var _0x170548=_0xe6ac[_0x2389bc];return _0x170548;};'use strict';var _=require(_0xce6a('0x0'));var util=require(_0xce6a('0x1'));var logger=require('../../config/logger')(_0xce6a('0x2'));var moment=require(_0xce6a('0x3'));var BPromise=require(_0xce6a('0x4'));var rp=require(_0xce6a('0x5'));var fs=require('fs');var path=require(_0xce6a('0x6'));var rimraf=require(_0xce6a('0x7'));var config=require(_0xce6a('0x8'));var attributes=require(_0xce6a('0x9'));module[_0xce6a('0xa')]=function(_0x219be6,_0x2d577e){return _0x219be6[_0xce6a('0xb')](_0xce6a('0xc'),attributes,{'tableName':_0xce6a('0xd'),'paranoid':![],'indexes':[{'name':_0xce6a('0xe'),'fields':[_0xce6a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 63d98bd..c646241 100644 --- a/server/api/screenRecording/screenRecording.rpc.js +++ b/server/api/screenRecording/screenRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1da9dc,_0x3986c3){var _0x5b4a4d=function(_0x58cacf){while(--_0x58cacf){_0x1da9dc['push'](_0x1da9dc['shift']());}};_0x5b4a4d(++_0x3986c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5d7e59,_0x6ea7fb){var _0x46f0bb=function(_0x563d89){while(--_0x563d89){_0x5d7e59['push'](_0x5d7e59['shift']());}};_0x46f0bb(++_0x6ea7fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index c1793d8..63e305a 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 _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0xa4ba02,_0x227f33){var _0x164a49=function(_0x21d485){while(--_0x21d485){_0xa4ba02['push'](_0xa4ba02['shift']());}};_0x164a49(++_0x227f33);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index c72f11d..968b52b 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 _0x7e5a=['sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','UNSIGNED'];(function(_0xc55d64,_0x133f2d){var _0x4194f6=function(_0x4a38c9){while(--_0x4a38c9){_0xc55d64['push'](_0xc55d64['shift']());}};_0x4194f6(++_0x133f2d);}(_0x7e5a,0x178));var _0xa7e5=function(_0x5b2165,_0x16d683){_0x5b2165=_0x5b2165-0x0;var _0x15a08e=_0x7e5a[_0x5b2165];return _0x15a08e;};'use strict';var Sequelize=require(_0xa7e5('0x0'));module[_0xa7e5('0x1')]={'min_internal':{'type':Sequelize[_0xa7e5('0x2')](0xb),'unique':_0xa7e5('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xa7e5('0x2')](0xb),'unique':_0xa7e5('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xa7e5('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xa7e5('0x5')]},'defaultLogo':{'type':Sequelize[_0xa7e5('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xa7e5('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xa7e5('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xa7e5('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xa7e5('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xa7e5('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xa7e5('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xa7e5('0x5')]},'turnaddr':{'type':Sequelize[_0xa7e5('0x5')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xa7e5('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xa7e5('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xa7e5('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xa7e5('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xa7e5('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xa7e5('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xa7e5('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xa7e5('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0xa7e5('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xa7e5('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xa7e5('0x5')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xa7e5('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xa7e5('0x5')]},'defaultFavicon':{'type':Sequelize[_0xa7e5('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xa7e5('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xa7e5('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xa7e5('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xa7e5('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xa7e5('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xa7e5('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa7e5('0x5')]},'bucket':{'type':Sequelize[_0xa7e5('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xa7e5('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xa7e5('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0xa7e5('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xa7e5('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xa7e5('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xa7e5('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xa7e5('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xa7e5('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xa7e5('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xa7e5('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x9ae3=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x23bf41,_0x37d6e9){var _0xa6fd23=function(_0x55cff6){while(--_0x55cff6){_0x23bf41['push'](_0x23bf41['shift']());}};_0xa6fd23(++_0x37d6e9);}(_0x9ae3,0xd4));var _0x39ae=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9ae3[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x39ae('0x0'));module[_0x39ae('0x1')]={'min_internal':{'type':Sequelize[_0x39ae('0x2')](0xb),'unique':_0x39ae('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x39ae('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x39ae('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x39ae('0x5')],'defaultValue':_0x39ae('0x6')},'logo':{'type':Sequelize[_0x39ae('0x5')]},'defaultLogo':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x39ae('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x39ae('0x5')]},'turnaddr':{'type':Sequelize[_0x39ae('0x5')]},'turnusername':{'type':Sequelize[_0x39ae('0x5')]},'turnpassword':{'type':Sequelize[_0x39ae('0x5')]},'pageTitle':{'type':Sequelize[_0x39ae('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x39ae('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x39ae('0x5')],'defaultValue':_0x39ae('0x8')},'enableEmailPreview':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x39ae('0x5')],'defaultValue':_0x39ae('0x9')},'chatTimeout':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x39ae('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x39ae('0x5')]},'defaultFavicon':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x39ae('0x2')]},'transcribeRegion':{'type':Sequelize[_0x39ae('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x39ae('0x2')]},'sentimentRegion':{'type':Sequelize[_0x39ae('0x5')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x39ae('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x39ae('0x2')](0x2)[_0x39ae('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x39ae('0x2')](0x2)[_0x39ae('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x39ae('0x2')](0x2)[_0x39ae('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x39ae('0x2')](0x2)[_0x39ae('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index b4c86d1..d610483 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 _0x4214=['fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','name','send','render','merge','body','contact','interaction','account','index','map','Setting','type','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','findAll','rows','show','rawAttributes','find','params','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','upperFirst','custom','Sequelize','ValidationError','download','../../config/license/util','getLogoLogin','preferred','defaultLoginLogo','default_loginLogo.svg','default','\x20not\x20found','gdpr','addPreferred','getPreferred','defaultLogo','default_preferred.png','addFavicon','default_favicon.ico','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir'];(function(_0x3d18c4,_0x5ccd3b){var _0x2be643=function(_0x1e7085){while(--_0x1e7085){_0x3d18c4['push'](_0x3d18c4['shift']());}};_0x2be643(++_0x5ccd3b);}(_0x4214,0x177));var _0x4421=function(_0x2e3650,_0x9d261){_0x2e3650=_0x2e3650-0x0;var _0x475a09=_0x4214[_0x2e3650];return _0x475a09;};'use strict';var emlformat=require(_0x4421('0x0'));var rimraf=require(_0x4421('0x1'));var zipdir=require(_0x4421('0x2'));var jsonpatch=require(_0x4421('0x3'));var rp=require(_0x4421('0x4'));var moment=require(_0x4421('0x5'));var BPromise=require(_0x4421('0x6'));var Mustache=require(_0x4421('0x7'));var util=require(_0x4421('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x4421('0x9'));var ejs=require(_0x4421('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4421('0xb'));var squel=require(_0x4421('0xc'));var crypto=require('crypto');var jsforce=require(_0x4421('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4421('0x9'));var querystring=require('querystring');var Papa=require(_0x4421('0xe'));var Redis=require(_0x4421('0xf'));var authService=require(_0x4421('0x10'));var qs=require(_0x4421('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4421('0x12'));var logger=require(_0x4421('0x13'))(_0x4421('0x14'));var utils=require(_0x4421('0x15'));var config=require(_0x4421('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4421('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4421('0x18')][_0x4421('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xca8e30,_0x1dec44,_0x4295ee,_0x14e868){return new BPromise(function(_0x38fffd,_0x461e6b){var _0x2b1462=_0x14e868||client;return _0x2b1462[_0x4421('0x1a')](_0xca8e30,_0x4295ee)[_0x4421('0x1b')](function(_0x559ed8){logger[_0x4421('0x1c')](_0x4421('0x1d'),_0x1dec44,'request\x20sent');logger[_0x4421('0x1e')](_0x4421('0x1f'),_0x1dec44,_0x4421('0x20'),JSON[_0x4421('0x21')](_0x559ed8));if(_0x559ed8[_0x4421('0x22')]){if(_0x559ed8[_0x4421('0x22')][_0x4421('0x23')]===0x1f4){logger[_0x4421('0x22')](_0x4421('0x1d'),_0x1dec44,_0x559ed8[_0x4421('0x22')][_0x4421('0x24')]);return _0x461e6b(_0x559ed8[_0x4421('0x22')][_0x4421('0x24')]);}logger['error'](_0x4421('0x1d'),_0x1dec44,_0x559ed8[_0x4421('0x22')][_0x4421('0x24')]);return _0x38fffd(_0x559ed8[_0x4421('0x22')][_0x4421('0x24')]);}else{logger[_0x4421('0x1c')](_0x4421('0x1d'),_0x1dec44,_0x4421('0x20'));_0x38fffd(_0x559ed8[_0x4421('0x25')]['message']);}})[_0x4421('0x26')](function(_0xf7be0b){logger[_0x4421('0x22')](_0x4421('0x1d'),_0x1dec44,_0xf7be0b);_0x461e6b(_0xf7be0b);});});}function respondWithStatusCode(_0xe62ea4,_0x173dad){_0x173dad=_0x173dad||0xcc;return function(_0x27a36b){if(_0x27a36b){return _0xe62ea4[_0x4421('0x27')](_0x173dad);}return _0xe62ea4[_0x4421('0x28')](_0x173dad)[_0x4421('0x29')]();};}function respondWithResult(_0x261c01,_0x433733){_0x433733=_0x433733||0xc8;return function(_0x34b0e7){if(_0x34b0e7){return _0x261c01[_0x4421('0x28')](_0x433733)[_0x4421('0x2a')](_0x34b0e7);}};}function respondWithFilteredResult(_0x371ba4,_0x1c4daa){return function(_0x5bd001){if(_0x5bd001){var _0x4786d3=typeof _0x1c4daa[_0x4421('0x2b')]===_0x4421('0x2c')&&typeof _0x1c4daa['limit']===_0x4421('0x2c');var _0x527e64=_0x5bd001['count'];var _0x234d3b=_0x4786d3?0x0:_0x1c4daa[_0x4421('0x2b')];var _0x597bcc=_0x4786d3?_0x5bd001[_0x4421('0x2d')]:_0x1c4daa[_0x4421('0x2b')]+_0x1c4daa[_0x4421('0x2e')];var _0x2326bc;if(_0x597bcc>=_0x527e64){_0x597bcc=_0x527e64;_0x2326bc=0xc8;}else{_0x2326bc=0xce;}_0x371ba4[_0x4421('0x28')](_0x2326bc);return _0x371ba4[_0x4421('0x2f')](_0x4421('0x30'),_0x234d3b+'-'+_0x597bcc+'/'+_0x527e64)[_0x4421('0x2a')](_0x5bd001);}return null;};}function patchUpdates(_0x4aa109){return function(_0x2963fc){try{jsonpatch[_0x4421('0x31')](_0x2963fc,_0x4aa109,!![]);}catch(_0x19c293){return BPromise[_0x4421('0x32')](_0x19c293);}return _0x2963fc['save']();};}function saveUpdates(_0x39b062,_0xf2a7ef){return function(_0x5e64e9){if(_0x5e64e9){return _0x5e64e9[_0x4421('0x33')](_0x39b062)[_0x4421('0x1b')](function(_0x341893){return _0x341893;});}return null;};}function removeEntity(_0x355687,_0xa73530){return function(_0x53f065){if(_0x53f065){return _0x53f065[_0x4421('0x34')]()[_0x4421('0x1b')](function(){_0x355687[_0x4421('0x28')](0xcc)[_0x4421('0x29')]();});}};}function handleEntityNotFound(_0x27a490,_0x3931b4){return function(_0x2fb9af){if(!_0x2fb9af){_0x27a490['sendStatus'](0x194);}return _0x2fb9af;};}function handleError(_0x2ac508,_0x1c0bb9){_0x1c0bb9=_0x1c0bb9||0x1f4;return function(_0x12253e){logger[_0x4421('0x22')](_0x12253e['stack']);if(_0x12253e[_0x4421('0x35')]){delete _0x12253e[_0x4421('0x35')];}_0x2ac508[_0x4421('0x28')](_0x1c0bb9)[_0x4421('0x36')](_0x12253e);};}function getMustacheRender(_0x12bdd4,_0x4a25b4){return Mustache[_0x4421('0x37')](_0x12bdd4,_[_0x4421('0x38')](_0x4a25b4[_0x4421('0x39')],{'contact':_0x4a25b4[_0x4421('0x3a')],'message':_0x4a25b4['message'],'agent':_0x4a25b4['agent'],'interaction':_0x4a25b4[_0x4421('0x3b')],'account':_0x4a25b4[_0x4421('0x3c')]}))||'';}exports[_0x4421('0x3d')]=function(_0x5d4238,_0x1d73f0){var _0x5d6bd4={},_0x5dbe77={},_0x34727c={'count':0x0,'rows':[]};var _0x52ac7e=_[_0x4421('0x3e')](db[_0x4421('0x3f')]['rawAttributes'],function(_0x3af424){return{'name':_0x3af424['fieldName'],'type':_0x3af424[_0x4421('0x40')]['key']};});_0x5dbe77['model']=_[_0x4421('0x3e')](_0x52ac7e,_0x4421('0x35'));_0x5dbe77[_0x4421('0x41')]=_[_0x4421('0x42')](_0x5d4238[_0x4421('0x41')]);_0x5dbe77['filters']=_['intersection'](_0x5dbe77['model'],_0x5dbe77['query']);_0x5d6bd4[_0x4421('0x43')]=_[_0x4421('0x44')](_0x5dbe77[_0x4421('0x45')],qs[_0x4421('0x46')](_0x5d4238[_0x4421('0x41')][_0x4421('0x46')]));_0x5d6bd4['attributes']=_0x5d6bd4[_0x4421('0x43')][_0x4421('0x47')]?_0x5d6bd4[_0x4421('0x43')]:_0x5dbe77['model'];if(!_0x5d4238[_0x4421('0x41')][_0x4421('0x48')](_0x4421('0x49'))){_0x5d6bd4['limit']=qs['limit'](_0x5d4238[_0x4421('0x41')][_0x4421('0x2e')]);_0x5d6bd4['offset']=qs[_0x4421('0x2b')](_0x5d4238[_0x4421('0x41')][_0x4421('0x2b')]);}_0x5d6bd4['order']=qs[_0x4421('0x4a')](_0x5d4238['query'][_0x4421('0x4a')]);_0x5d6bd4[_0x4421('0x4b')]=qs['filters'](_[_0x4421('0x4c')](_0x5d4238[_0x4421('0x41')],_0x5dbe77[_0x4421('0x4d')]),_0x52ac7e);if(_0x5d4238[_0x4421('0x41')][_0x4421('0x4e')]){_0x5d6bd4[_0x4421('0x4b')]=_[_0x4421('0x38')](_0x5d6bd4[_0x4421('0x4b')],{'$or':_[_0x4421('0x3e')](_0x52ac7e,function(_0x4e8590){if(_0x4e8590[_0x4421('0x40')]!==_0x4421('0x4f')){var _0x147397={};_0x147397[_0x4e8590[_0x4421('0x35')]]={'$like':'%'+_0x5d4238[_0x4421('0x41')][_0x4421('0x4e')]+'%'};return _0x147397;}})});}_0x5d6bd4=_[_0x4421('0x38')]({},_0x5d6bd4,_0x5d4238[_0x4421('0x50')]);var _0x5d2574={'where':_0x5d6bd4[_0x4421('0x4b')]};return db['Setting'][_0x4421('0x2d')](_0x5d2574)[_0x4421('0x1b')](function(_0x54ea88){_0x34727c[_0x4421('0x2d')]=_0x54ea88;if(_0x5d4238[_0x4421('0x41')][_0x4421('0x51')]){_0x5d6bd4['include']=[{'all':!![]}];}return db[_0x4421('0x3f')][_0x4421('0x52')](_0x5d6bd4);})[_0x4421('0x1b')](function(_0x174f1f){_0x34727c[_0x4421('0x53')]=_0x174f1f;return _0x34727c;})['then'](respondWithFilteredResult(_0x1d73f0,_0x5d6bd4))['catch'](handleError(_0x1d73f0,null));};exports[_0x4421('0x54')]=function(_0x2546df,_0x208098){var _0x526342={'raw':![],'where':{'id':_0x2546df['params']['id']}},_0xc61730={};_0xc61730['model']=_[_0x4421('0x42')](db[_0x4421('0x3f')][_0x4421('0x55')]);_0xc61730[_0x4421('0x41')]=_['keys'](_0x2546df[_0x4421('0x41')]);_0xc61730['filters']=_[_0x4421('0x44')](_0xc61730[_0x4421('0x45')],_0xc61730[_0x4421('0x41')]);_0x526342[_0x4421('0x43')]=_[_0x4421('0x44')](_0xc61730[_0x4421('0x45')],qs['fields'](_0x2546df[_0x4421('0x41')][_0x4421('0x46')]));_0x526342[_0x4421('0x43')]=_0x526342[_0x4421('0x43')][_0x4421('0x47')]?_0x526342[_0x4421('0x43')]:_0xc61730[_0x4421('0x45')];if(_0x2546df[_0x4421('0x41')]['includeAll']){_0x526342['include']=[{'all':!![]}];}_0x526342=_[_0x4421('0x38')]({},_0x526342,_0x2546df['options']);return db[_0x4421('0x3f')][_0x4421('0x56')](_0x526342)[_0x4421('0x1b')](handleEntityNotFound(_0x208098,null))['then'](respondWithResult(_0x208098,null))[_0x4421('0x26')](handleError(_0x208098,null));};exports[_0x4421('0x33')]=function(_0x12acbe,_0x207d4a){if(_0x12acbe[_0x4421('0x39')]['id']){delete _0x12acbe['body']['id'];}return db[_0x4421('0x3f')][_0x4421('0x56')]({'where':{'id':_0x12acbe[_0x4421('0x57')]['id']}})['then'](handleEntityNotFound(_0x207d4a,null))[_0x4421('0x1b')](saveUpdates(_0x12acbe[_0x4421('0x39')],null))[_0x4421('0x1b')](respondWithResult(_0x207d4a,null))[_0x4421('0x26')](handleError(_0x207d4a,null));};exports[_0x4421('0x58')]=function(_0x2bb4e6,_0x344fe4,_0x7ed024){if(_0x2bb4e6[_0x4421('0x59')]&&_0x2bb4e6['file'][_0x4421('0x5a')]){_0x2bb4e6[_0x4421('0x39')][_0x4421('0x5b')]=_0x2bb4e6[_0x4421('0x59')][_0x4421('0x5a')];}return db['Setting'][_0x4421('0x56')]({'where':{'id':_0x2bb4e6['params']['id']}})[_0x4421('0x1b')](handleEntityNotFound(_0x344fe4,null))['then'](saveUpdates(_0x2bb4e6[_0x4421('0x39')],null))[_0x4421('0x1b')](respondWithResult(_0x344fe4,null))['catch'](handleError(_0x344fe4,null));};exports['addLogoLogin']=function(_0x201e8b,_0x56f472,_0x3ce676){if(_0x201e8b['file']&&_0x201e8b['file']['filename']){_0x201e8b[_0x4421('0x39')][_0x4421('0x5c')]=_0x201e8b[_0x4421('0x59')][_0x4421('0x5a')];}return db['Setting'][_0x4421('0x56')]({'where':{'id':_0x201e8b[_0x4421('0x57')]['id']}})['then'](handleEntityNotFound(_0x56f472,null))['then'](saveUpdates(_0x201e8b[_0x4421('0x39')],null))['then'](respondWithResult(_0x56f472,null))[_0x4421('0x26')](handleError(_0x56f472,null));};var utilLicense=require('../../config/license/util');exports[_0x4421('0x5d')]=function(_0x389b33,_0x121bc8,_0x2c5cae){var _0x339de2=_0x4421('0x5e');var _0x99a955={'custom':![]};return utilLicense[_0x4421('0x5f')]()['then'](function(_0x48aaa4){if(_0x48aaa4){_0x99a955=_0x48aaa4;}return db[_0x4421('0x3f')]['find']({'where':{'id':_0x389b33[_0x4421('0x57')]['id']},'attributes':['logo',_0x4421('0x5c'),'preferred',_0x4421('0x60'),'defaultLogo','defaultLoginLogo',_0x4421('0x61'),_0x4421('0x62')],'raw':!![]});})[_0x4421('0x1b')](handleEntityNotFound(_0x121bc8,null))[_0x4421('0x1b')](function(_0x58749c){if(_0x58749c){var _0x4f3d91=_0x58749c['logo']&&fs[_0x4421('0x63')](path[_0x4421('0x64')](config[_0x4421('0x65')],_0x339de2,_[_0x4421('0x66')](_0x58749c[_0x4421('0x5b')])))?path[_0x4421('0x64')](config[_0x4421('0x65')],_0x339de2,_[_0x4421('0x66')](_0x58749c['logo'])):path[_0x4421('0x64')](config[_0x4421('0x65')],_0x339de2,_[_0x4421('0x66')]('default_logo.svg'));var _0x5e4bf3='default'+_[_0x4421('0x67')](_0x4421('0x5b'));if(_0x58749c[_0x5e4bf3]||!_0x99a955[_0x4421('0x68')]){_0x4f3d91=path['join'](config[_0x4421('0x65')],_0x339de2,_[_0x4421('0x66')]('default_logo.svg'));}if(!fs[_0x4421('0x63')](_0x4f3d91)){throw new db[(_0x4421('0x69'))][(_0x4421('0x6a'))](_[_0x4421('0x67')](_0x4421('0x5b'))+'\x20not\x20found');}return _0x121bc8[_0x4421('0x6b')](_0x4f3d91);}})[_0x4421('0x26')](handleError(_0x121bc8,null));};var utilLicense=require(_0x4421('0x6c'));exports[_0x4421('0x6d')]=function(_0x5429a2,_0x260866,_0x18b7ab){var _0x561c99=_0x4421('0x5e');var _0x1b1e48={'custom':![]};return utilLicense[_0x4421('0x5f')]()['then'](function(_0x15737c){if(_0x15737c){_0x1b1e48=_0x15737c;}return db['Setting'][_0x4421('0x56')]({'where':{'id':_0x5429a2[_0x4421('0x57')]['id']},'attributes':['logo',_0x4421('0x5c'),_0x4421('0x6e'),_0x4421('0x60'),'defaultLogo',_0x4421('0x6f'),_0x4421('0x61'),_0x4421('0x62')],'raw':!![]});})[_0x4421('0x1b')](handleEntityNotFound(_0x260866,null))[_0x4421('0x1b')](function(_0x5afc31){if(_0x5afc31){var _0x5846b8=_0x5afc31[_0x4421('0x5c')]&&fs[_0x4421('0x63')](path['join'](config['root'],_0x561c99,_[_0x4421('0x66')](_0x5afc31[_0x4421('0x5c')])))?path[_0x4421('0x64')](config[_0x4421('0x65')],_0x561c99,_[_0x4421('0x66')](_0x5afc31[_0x4421('0x5c')])):path[_0x4421('0x64')](config[_0x4421('0x65')],_0x561c99,_['toLower'](_0x4421('0x70')));var _0x252a2=_0x4421('0x71')+_['upperFirst'](_0x4421('0x5c'));if(_0x5afc31[_0x252a2]||!_0x1b1e48[_0x4421('0x68')]){_0x5846b8=path['join'](config[_0x4421('0x65')],_0x561c99,_[_0x4421('0x66')](_0x4421('0x70')));}if(!fs[_0x4421('0x63')](_0x5846b8)){throw new db[(_0x4421('0x69'))]['ValidationError'](_['upperFirst']('loginLogo')+_0x4421('0x72'));}return _0x260866[_0x4421('0x6b')](_0x5846b8);}})[_0x4421('0x26')](handleError(_0x260866,null));};exports[_0x4421('0x73')]=function(_0x365cb9,_0x322691){return db[_0x4421('0x3f')][_0x4421('0x56')]({'where':{'id':_0x365cb9['params']['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x322691,null))['catch'](handleError(_0x322691,null));};exports[_0x4421('0x74')]=function(_0x4d06c7,_0x1714bc,_0xb49591){if(_0x4d06c7[_0x4421('0x59')]&&_0x4d06c7[_0x4421('0x59')][_0x4421('0x5a')]){_0x4d06c7[_0x4421('0x39')][_0x4421('0x6e')]=_0x4d06c7['file']['filename'];}return db['Setting']['find']({'where':{'id':_0x4d06c7[_0x4421('0x57')]['id']}})[_0x4421('0x1b')](handleEntityNotFound(_0x1714bc,null))[_0x4421('0x1b')](saveUpdates(_0x4d06c7[_0x4421('0x39')],null))['then'](respondWithResult(_0x1714bc,null))[_0x4421('0x26')](handleError(_0x1714bc,null));};var utilLicense=require(_0x4421('0x6c'));exports[_0x4421('0x75')]=function(_0x1b1c13,_0x2f0996,_0x213f2a){var _0x4e98f0='server/files/images/logos';var _0xc49e78={'custom':![]};return utilLicense[_0x4421('0x5f')]()[_0x4421('0x1b')](function(_0x55bcb6){if(_0x55bcb6){_0xc49e78=_0x55bcb6;}return db['Setting'][_0x4421('0x56')]({'where':{'id':_0x1b1c13[_0x4421('0x57')]['id']},'attributes':[_0x4421('0x5b'),_0x4421('0x5c'),_0x4421('0x6e'),_0x4421('0x60'),_0x4421('0x76'),'defaultLoginLogo','defaultPreferred',_0x4421('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x2f0996,null))[_0x4421('0x1b')](function(_0xc07fe9){if(_0xc07fe9){var _0x324aa4=_0xc07fe9['preferred']&&fs['existsSync'](path[_0x4421('0x64')](config[_0x4421('0x65')],_0x4e98f0,_['toLower'](_0xc07fe9[_0x4421('0x6e')])))?path[_0x4421('0x64')](config['root'],_0x4e98f0,_[_0x4421('0x66')](_0xc07fe9[_0x4421('0x6e')])):path[_0x4421('0x64')](config[_0x4421('0x65')],_0x4e98f0,_[_0x4421('0x66')](_0x4421('0x77')));var _0x1bf656='default'+_['upperFirst']('preferred');if(_0xc07fe9[_0x1bf656]||!_0xc49e78['custom']||!_0xc49e78[_0x4421('0x6e')]){_0x324aa4=path[_0x4421('0x64')](config[_0x4421('0x65')],_0x4e98f0,_[_0x4421('0x66')](_0x4421('0x77')));}if(!fs[_0x4421('0x63')](_0x324aa4)){throw new db[(_0x4421('0x69'))][(_0x4421('0x6a'))](_[_0x4421('0x67')](_0x4421('0x6e'))+_0x4421('0x72'));}return _0x2f0996[_0x4421('0x6b')](_0x324aa4);}})[_0x4421('0x26')](handleError(_0x2f0996,null));};exports[_0x4421('0x78')]=function(_0x25e626,_0x4b8b12,_0x464ec8){if(_0x25e626['file']&&_0x25e626['file'][_0x4421('0x5a')]){_0x25e626[_0x4421('0x39')][_0x4421('0x60')]=_0x25e626[_0x4421('0x59')]['filename'];}return db['Setting'][_0x4421('0x56')]({'where':{'id':_0x25e626[_0x4421('0x57')]['id']}})[_0x4421('0x1b')](handleEntityNotFound(_0x4b8b12,null))['then'](saveUpdates(_0x25e626['body'],null))['then'](respondWithResult(_0x4b8b12,null))[_0x4421('0x26')](handleError(_0x4b8b12,null));};var utilLicense=require(_0x4421('0x6c'));exports['getFavicon']=function(_0x3ec55b,_0xe1f5a6,_0x5a99bc){var _0x230d40='server/files/images/logos';var _0x382293={'custom':![]};return utilLicense[_0x4421('0x5f')]()[_0x4421('0x1b')](function(_0x3467a6){if(_0x3467a6){_0x382293=_0x3467a6;}return db[_0x4421('0x3f')][_0x4421('0x56')]({'where':{'id':_0x3ec55b[_0x4421('0x57')]['id']},'attributes':[_0x4421('0x5b'),_0x4421('0x5c'),_0x4421('0x6e'),'favicon',_0x4421('0x76'),_0x4421('0x6f'),_0x4421('0x61'),_0x4421('0x62')],'raw':!![]});})[_0x4421('0x1b')](handleEntityNotFound(_0xe1f5a6,null))[_0x4421('0x1b')](function(_0x2aeeda){if(_0x2aeeda){var _0x2fa04f=_0x2aeeda[_0x4421('0x60')]&&fs[_0x4421('0x63')](path[_0x4421('0x64')](config[_0x4421('0x65')],_0x230d40,_[_0x4421('0x66')](_0x2aeeda[_0x4421('0x60')])))?path[_0x4421('0x64')](config[_0x4421('0x65')],_0x230d40,_[_0x4421('0x66')](_0x2aeeda[_0x4421('0x60')])):path[_0x4421('0x64')](config[_0x4421('0x65')],_0x230d40,_[_0x4421('0x66')](_0x4421('0x79')));var _0x4b1efd=_0x4421('0x71')+_['upperFirst'](_0x4421('0x60'));if(_0x2aeeda[_0x4b1efd]||!_0x382293[_0x4421('0x68')]){_0x2fa04f=path[_0x4421('0x64')](config[_0x4421('0x65')],_0x230d40,_[_0x4421('0x66')]('default_favicon.ico'));}if(!fs[_0x4421('0x63')](_0x2fa04f)){throw new db[(_0x4421('0x69'))]['ValidationError'](_[_0x4421('0x67')](_0x4421('0x60'))+_0x4421('0x72'));}return _0xe1f5a6['download'](_0x2fa04f);}})['catch'](handleError(_0xe1f5a6,null));};exports['getDate']=function(_0x2dac23,_0x38093b){var _0x1ec140={'offset':moment()['utcOffset']()};_0x1ec140[_0x4421('0x7a')]=moment()[_0x4421('0x7b')](_0x1ec140[_0x4421('0x2b')])[_0x4421('0x7c')](_0x4421('0x7d'));return _0x38093b[_0x4421('0x28')](0xc8)['send'](_0x1ec140);}; \ No newline at end of file +var _0x570a=['pick','filter','VIRTUAL','options','findAll','rows','params','rawAttributes','includeAll','find','addLogo','file','logo','filename','addLogoLogin','getLogo','server/files/images/logos','getLicense','loginLogo','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','custom','default_logo.svg','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','defaultLoginLogo','default_loginLogo.svg','gdpr','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','eml-format','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','destroy','name','send','render','merge','body','agent','account','index','map','Setting','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters'];(function(_0x4ef4c4,_0x3c5e0d){var _0x3321bd=function(_0x5abbc0){while(--_0x5abbc0){_0x4ef4c4['push'](_0x4ef4c4['shift']());}};_0x3321bd(++_0x3c5e0d);}(_0x570a,0x11e));var _0xa570=function(_0x10dbcd,_0x4b9171){_0x10dbcd=_0x10dbcd-0x0;var _0x3ee859=_0x570a[_0x10dbcd];return _0x3ee859;};'use strict';var emlformat=require(_0xa570('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa570('0x1'));var moment=require(_0xa570('0x2'));var BPromise=require(_0xa570('0x3'));var Mustache=require('mustache');var util=require(_0xa570('0x4'));var path=require('path');var sox=require(_0xa570('0x5'));var csv=require(_0xa570('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa570('0x7'));var _=require('lodash');var squel=require(_0xa570('0x8'));var crypto=require('crypto');var jsforce=require(_0xa570('0x9'));var deskjs=require(_0xa570('0xa'));var toCsv=require('to-csv');var querystring=require(_0xa570('0xb'));var Papa=require(_0xa570('0xc'));var Redis=require('ioredis');var authService=require(_0xa570('0xd'));var qs=require(_0xa570('0xe'));var as=require(_0xa570('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa570('0x10'));var utils=require('../../config/utils');var config=require(_0xa570('0x11'));var licenseUtil=require(_0xa570('0x12'));var db=require(_0xa570('0x13'))['db'];var jayson=require(_0xa570('0x14'));var client=jayson['client'][_0xa570('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x5f1ca9,_0x1639e4,_0x25bf61,_0x1dad20){return new BPromise(function(_0xaf3d01,_0x1219cd){var _0x522cea=_0x1dad20||client;return _0x522cea['request'](_0x5f1ca9,_0x25bf61)[_0xa570('0x16')](function(_0x307089){logger[_0xa570('0x17')](_0xa570('0x18'),_0x1639e4,_0xa570('0x19'));logger[_0xa570('0x1a')](_0xa570('0x1b'),_0x1639e4,_0xa570('0x19'),JSON[_0xa570('0x1c')](_0x307089));if(_0x307089['error']){if(_0x307089[_0xa570('0x1d')][_0xa570('0x1e')]===0x1f4){logger[_0xa570('0x1d')]('Setting,\x20%s,\x20%s',_0x1639e4,_0x307089[_0xa570('0x1d')][_0xa570('0x1f')]);return _0x1219cd(_0x307089[_0xa570('0x1d')][_0xa570('0x1f')]);}logger[_0xa570('0x1d')](_0xa570('0x18'),_0x1639e4,_0x307089[_0xa570('0x1d')][_0xa570('0x1f')]);return _0xaf3d01(_0x307089[_0xa570('0x1d')][_0xa570('0x1f')]);}else{logger['info'](_0xa570('0x18'),_0x1639e4,_0xa570('0x19'));_0xaf3d01(_0x307089[_0xa570('0x20')][_0xa570('0x1f')]);}})[_0xa570('0x21')](function(_0x1c3871){logger[_0xa570('0x1d')](_0xa570('0x18'),_0x1639e4,_0x1c3871);_0x1219cd(_0x1c3871);});});}function respondWithStatusCode(_0x4c3474,_0x27a5ac){_0x27a5ac=_0x27a5ac||0xcc;return function(_0x2c9e0f){if(_0x2c9e0f){return _0x4c3474[_0xa570('0x22')](_0x27a5ac);}return _0x4c3474[_0xa570('0x23')](_0x27a5ac)[_0xa570('0x24')]();};}function respondWithResult(_0x3f5267,_0x3a0048){_0x3a0048=_0x3a0048||0xc8;return function(_0x490a81){if(_0x490a81){return _0x3f5267[_0xa570('0x23')](_0x3a0048)['json'](_0x490a81);}};}function respondWithFilteredResult(_0x4773ab,_0x45155f){return function(_0x3440d2){if(_0x3440d2){var _0x8f2fe8=typeof _0x45155f[_0xa570('0x25')]===_0xa570('0x26')&&typeof _0x45155f[_0xa570('0x27')]==='undefined';var _0x31ac0c=_0x3440d2[_0xa570('0x28')];var _0x573fee=_0x8f2fe8?0x0:_0x45155f[_0xa570('0x25')];var _0x35372c=_0x8f2fe8?_0x3440d2[_0xa570('0x28')]:_0x45155f[_0xa570('0x25')]+_0x45155f[_0xa570('0x27')];var _0x27551b;if(_0x35372c>=_0x31ac0c){_0x35372c=_0x31ac0c;_0x27551b=0xc8;}else{_0x27551b=0xce;}_0x4773ab[_0xa570('0x23')](_0x27551b);return _0x4773ab['set']('Content-Range',_0x573fee+'-'+_0x35372c+'/'+_0x31ac0c)[_0xa570('0x29')](_0x3440d2);}return null;};}function patchUpdates(_0x27f9f2){return function(_0x19f48b){try{jsonpatch[_0xa570('0x2a')](_0x19f48b,_0x27f9f2,!![]);}catch(_0x34aaee){return BPromise[_0xa570('0x2b')](_0x34aaee);}return _0x19f48b[_0xa570('0x2c')]();};}function saveUpdates(_0x102a6d,_0x1f99dd){return function(_0x541c04){if(_0x541c04){return _0x541c04[_0xa570('0x2d')](_0x102a6d)[_0xa570('0x16')](function(_0x495ee7){return _0x495ee7;});}return null;};}function removeEntity(_0x42d2a8,_0x1f964d){return function(_0x2ec55e){if(_0x2ec55e){return _0x2ec55e[_0xa570('0x2e')]()[_0xa570('0x16')](function(){_0x42d2a8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aeec4,_0x129a7f){return function(_0x2e93b9){if(!_0x2e93b9){_0x1aeec4[_0xa570('0x22')](0x194);}return _0x2e93b9;};}function handleError(_0x2a0347,_0x2b2cd5){_0x2b2cd5=_0x2b2cd5||0x1f4;return function(_0x305000){logger[_0xa570('0x1d')](_0x305000['stack']);if(_0x305000[_0xa570('0x2f')]){delete _0x305000['name'];}_0x2a0347[_0xa570('0x23')](_0x2b2cd5)[_0xa570('0x30')](_0x305000);};}function getMustacheRender(_0x14fc4c,_0x4b63fe){return Mustache[_0xa570('0x31')](_0x14fc4c,_[_0xa570('0x32')](_0x4b63fe[_0xa570('0x33')],{'contact':_0x4b63fe['contact'],'message':_0x4b63fe[_0xa570('0x1f')],'agent':_0x4b63fe[_0xa570('0x34')],'interaction':_0x4b63fe['interaction'],'account':_0x4b63fe[_0xa570('0x35')]}))||'';}exports[_0xa570('0x36')]=function(_0x8eed3b,_0x32cca8){var _0x45a192={},_0x1588ae={},_0x39b19c={'count':0x0,'rows':[]};var _0x1be715=_[_0xa570('0x37')](db[_0xa570('0x38')]['rawAttributes'],function(_0x355110){return{'name':_0x355110[_0xa570('0x39')],'type':_0x355110[_0xa570('0x3a')]['key']};});_0x1588ae[_0xa570('0x3b')]=_[_0xa570('0x37')](_0x1be715,_0xa570('0x2f'));_0x1588ae[_0xa570('0x3c')]=_[_0xa570('0x3d')](_0x8eed3b['query']);_0x1588ae['filters']=_[_0xa570('0x3e')](_0x1588ae[_0xa570('0x3b')],_0x1588ae[_0xa570('0x3c')]);_0x45a192[_0xa570('0x3f')]=_['intersection'](_0x1588ae[_0xa570('0x3b')],qs['fields'](_0x8eed3b[_0xa570('0x3c')][_0xa570('0x40')]));_0x45a192[_0xa570('0x3f')]=_0x45a192[_0xa570('0x3f')][_0xa570('0x41')]?_0x45a192[_0xa570('0x3f')]:_0x1588ae[_0xa570('0x3b')];if(!_0x8eed3b['query']['hasOwnProperty'](_0xa570('0x42'))){_0x45a192[_0xa570('0x27')]=qs['limit'](_0x8eed3b[_0xa570('0x3c')]['limit']);_0x45a192[_0xa570('0x25')]=qs[_0xa570('0x25')](_0x8eed3b[_0xa570('0x3c')][_0xa570('0x25')]);}_0x45a192[_0xa570('0x43')]=qs[_0xa570('0x44')](_0x8eed3b[_0xa570('0x3c')][_0xa570('0x44')]);_0x45a192[_0xa570('0x45')]=qs[_0xa570('0x46')](_[_0xa570('0x47')](_0x8eed3b['query'],_0x1588ae['filters']),_0x1be715);if(_0x8eed3b['query'][_0xa570('0x48')]){_0x45a192['where']=_[_0xa570('0x32')](_0x45a192[_0xa570('0x45')],{'$or':_[_0xa570('0x37')](_0x1be715,function(_0x5c5a11){if(_0x5c5a11['type']!==_0xa570('0x49')){var _0x56c71a={};_0x56c71a[_0x5c5a11['name']]={'$like':'%'+_0x8eed3b[_0xa570('0x3c')]['filter']+'%'};return _0x56c71a;}})});}_0x45a192=_[_0xa570('0x32')]({},_0x45a192,_0x8eed3b[_0xa570('0x4a')]);var _0x395ebe={'where':_0x45a192[_0xa570('0x45')]};return db[_0xa570('0x38')]['count'](_0x395ebe)[_0xa570('0x16')](function(_0x493c49){_0x39b19c[_0xa570('0x28')]=_0x493c49;if(_0x8eed3b[_0xa570('0x3c')]['includeAll']){_0x45a192['include']=[{'all':!![]}];}return db[_0xa570('0x38')][_0xa570('0x4b')](_0x45a192);})['then'](function(_0x4730c1){_0x39b19c[_0xa570('0x4c')]=_0x4730c1;return _0x39b19c;})[_0xa570('0x16')](respondWithFilteredResult(_0x32cca8,_0x45a192))['catch'](handleError(_0x32cca8,null));};exports['show']=function(_0x59c3db,_0x3b3f7e){var _0x39cf7b={'raw':![],'where':{'id':_0x59c3db[_0xa570('0x4d')]['id']}},_0x39e1ae={};_0x39e1ae[_0xa570('0x3b')]=_['keys'](db['Setting'][_0xa570('0x4e')]);_0x39e1ae['query']=_['keys'](_0x59c3db[_0xa570('0x3c')]);_0x39e1ae[_0xa570('0x46')]=_[_0xa570('0x3e')](_0x39e1ae[_0xa570('0x3b')],_0x39e1ae[_0xa570('0x3c')]);_0x39cf7b[_0xa570('0x3f')]=_[_0xa570('0x3e')](_0x39e1ae['model'],qs['fields'](_0x59c3db['query'][_0xa570('0x40')]));_0x39cf7b[_0xa570('0x3f')]=_0x39cf7b[_0xa570('0x3f')]['length']?_0x39cf7b[_0xa570('0x3f')]:_0x39e1ae[_0xa570('0x3b')];if(_0x59c3db[_0xa570('0x3c')][_0xa570('0x4f')]){_0x39cf7b['include']=[{'all':!![]}];}_0x39cf7b=_[_0xa570('0x32')]({},_0x39cf7b,_0x59c3db[_0xa570('0x4a')]);return db['Setting'][_0xa570('0x50')](_0x39cf7b)[_0xa570('0x16')](handleEntityNotFound(_0x3b3f7e,null))['then'](respondWithResult(_0x3b3f7e,null))[_0xa570('0x21')](handleError(_0x3b3f7e,null));};exports['update']=function(_0x337748,_0x49a933){if(_0x337748[_0xa570('0x33')]['id']){delete _0x337748[_0xa570('0x33')]['id'];}return db[_0xa570('0x38')][_0xa570('0x50')]({'where':{'id':_0x337748[_0xa570('0x4d')]['id']}})[_0xa570('0x16')](handleEntityNotFound(_0x49a933,null))[_0xa570('0x16')](saveUpdates(_0x337748[_0xa570('0x33')],null))['then'](respondWithResult(_0x49a933,null))[_0xa570('0x21')](handleError(_0x49a933,null));};exports[_0xa570('0x51')]=function(_0x2f1c11,_0x59dfb3,_0x47763a){if(_0x2f1c11[_0xa570('0x52')]&&_0x2f1c11[_0xa570('0x52')]['filename']){_0x2f1c11[_0xa570('0x33')][_0xa570('0x53')]=_0x2f1c11[_0xa570('0x52')][_0xa570('0x54')];}return db[_0xa570('0x38')][_0xa570('0x50')]({'where':{'id':_0x2f1c11['params']['id']}})[_0xa570('0x16')](handleEntityNotFound(_0x59dfb3,null))[_0xa570('0x16')](saveUpdates(_0x2f1c11[_0xa570('0x33')],null))[_0xa570('0x16')](respondWithResult(_0x59dfb3,null))[_0xa570('0x21')](handleError(_0x59dfb3,null));};exports[_0xa570('0x55')]=function(_0x2d5b48,_0xc6570f,_0x4a3dc4){if(_0x2d5b48[_0xa570('0x52')]&&_0x2d5b48[_0xa570('0x52')][_0xa570('0x54')]){_0x2d5b48[_0xa570('0x33')]['loginLogo']=_0x2d5b48[_0xa570('0x52')][_0xa570('0x54')];}return db[_0xa570('0x38')]['find']({'where':{'id':_0x2d5b48['params']['id']}})[_0xa570('0x16')](handleEntityNotFound(_0xc6570f,null))[_0xa570('0x16')](saveUpdates(_0x2d5b48[_0xa570('0x33')],null))['then'](respondWithResult(_0xc6570f,null))['catch'](handleError(_0xc6570f,null));};var utilLicense=require(_0xa570('0x12'));exports[_0xa570('0x56')]=function(_0x270b5e,_0x5da677,_0x248d13){var _0x5419d6=_0xa570('0x57');var _0x1b57ba={'custom':![]};return utilLicense[_0xa570('0x58')]()[_0xa570('0x16')](function(_0x2b5138){if(_0x2b5138){_0x1b57ba=_0x2b5138;}return db['Setting'][_0xa570('0x50')]({'where':{'id':_0x270b5e[_0xa570('0x4d')]['id']},'attributes':[_0xa570('0x53'),_0xa570('0x59'),_0xa570('0x5a'),_0xa570('0x5b'),_0xa570('0x5c'),'defaultLoginLogo',_0xa570('0x5d'),_0xa570('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x5da677,null))['then'](function(_0x2d675c){if(_0x2d675c){var _0x5521e6=_0x2d675c[_0xa570('0x53')]&&fs[_0xa570('0x5f')](path[_0xa570('0x60')](config[_0xa570('0x61')],_0x5419d6,_[_0xa570('0x62')](_0x2d675c[_0xa570('0x53')])))?path[_0xa570('0x60')](config[_0xa570('0x61')],_0x5419d6,_[_0xa570('0x62')](_0x2d675c[_0xa570('0x53')])):path[_0xa570('0x60')](config[_0xa570('0x61')],_0x5419d6,_[_0xa570('0x62')]('default_logo.svg'));var _0xf7b3a8=_0xa570('0x63')+_['upperFirst'](_0xa570('0x53'));if(_0x2d675c[_0xf7b3a8]||!_0x1b57ba[_0xa570('0x64')]){_0x5521e6=path['join'](config[_0xa570('0x61')],_0x5419d6,_[_0xa570('0x62')](_0xa570('0x65')));}if(!fs[_0xa570('0x5f')](_0x5521e6)){throw new db[(_0xa570('0x66'))][(_0xa570('0x67'))](_[_0xa570('0x68')](_0xa570('0x53'))+_0xa570('0x69'));}return _0x5da677[_0xa570('0x6a')](_0x5521e6);}})[_0xa570('0x21')](handleError(_0x5da677,null));};var utilLicense=require(_0xa570('0x12'));exports[_0xa570('0x6b')]=function(_0x52f615,_0x5f16db,_0x162241){var _0x1e4e51=_0xa570('0x57');var _0x2dbca9={'custom':![]};return utilLicense[_0xa570('0x58')]()[_0xa570('0x16')](function(_0x3f3f2d){if(_0x3f3f2d){_0x2dbca9=_0x3f3f2d;}return db[_0xa570('0x38')][_0xa570('0x50')]({'where':{'id':_0x52f615[_0xa570('0x4d')]['id']},'attributes':[_0xa570('0x53'),_0xa570('0x59'),_0xa570('0x5a'),'favicon',_0xa570('0x5c'),_0xa570('0x6c'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xa570('0x16')](handleEntityNotFound(_0x5f16db,null))[_0xa570('0x16')](function(_0xd17394){if(_0xd17394){var _0x3f0f6c=_0xd17394['loginLogo']&&fs[_0xa570('0x5f')](path['join'](config[_0xa570('0x61')],_0x1e4e51,_['toLower'](_0xd17394[_0xa570('0x59')])))?path[_0xa570('0x60')](config['root'],_0x1e4e51,_[_0xa570('0x62')](_0xd17394[_0xa570('0x59')])):path[_0xa570('0x60')](config[_0xa570('0x61')],_0x1e4e51,_['toLower'](_0xa570('0x6d')));var _0x79c0bb=_0xa570('0x63')+_[_0xa570('0x68')](_0xa570('0x59'));if(_0xd17394[_0x79c0bb]||!_0x2dbca9[_0xa570('0x64')]){_0x3f0f6c=path[_0xa570('0x60')](config[_0xa570('0x61')],_0x1e4e51,_['toLower']('default_loginLogo.svg'));}if(!fs[_0xa570('0x5f')](_0x3f0f6c)){throw new db[(_0xa570('0x66'))][(_0xa570('0x67'))](_['upperFirst'](_0xa570('0x59'))+_0xa570('0x69'));}return _0x5f16db['download'](_0x3f0f6c);}})[_0xa570('0x21')](handleError(_0x5f16db,null));};exports[_0xa570('0x6e')]=function(_0x42ba5d,_0x11e53e){return db['Setting'][_0xa570('0x50')]({'where':{'id':_0x42ba5d[_0xa570('0x4d')]['id']},'attributes':['securePassword']})[_0xa570('0x16')](respondWithResult(_0x11e53e,null))[_0xa570('0x21')](handleError(_0x11e53e,null));};exports['addPreferred']=function(_0x530b65,_0x4007be,_0x58b17e){if(_0x530b65[_0xa570('0x52')]&&_0x530b65[_0xa570('0x52')][_0xa570('0x54')]){_0x530b65[_0xa570('0x33')][_0xa570('0x5a')]=_0x530b65[_0xa570('0x52')][_0xa570('0x54')];}return db[_0xa570('0x38')][_0xa570('0x50')]({'where':{'id':_0x530b65[_0xa570('0x4d')]['id']}})[_0xa570('0x16')](handleEntityNotFound(_0x4007be,null))[_0xa570('0x16')](saveUpdates(_0x530b65[_0xa570('0x33')],null))[_0xa570('0x16')](respondWithResult(_0x4007be,null))[_0xa570('0x21')](handleError(_0x4007be,null));};var utilLicense=require(_0xa570('0x12'));exports[_0xa570('0x6f')]=function(_0x268e52,_0x220c61,_0x519611){var _0x2f7890=_0xa570('0x57');var _0x4824b2={'custom':![]};return utilLicense[_0xa570('0x58')]()[_0xa570('0x16')](function(_0x2b87c6){if(_0x2b87c6){_0x4824b2=_0x2b87c6;}return db[_0xa570('0x38')][_0xa570('0x50')]({'where':{'id':_0x268e52[_0xa570('0x4d')]['id']},'attributes':[_0xa570('0x53'),_0xa570('0x59'),_0xa570('0x5a'),'favicon',_0xa570('0x5c'),_0xa570('0x6c'),_0xa570('0x5d'),'defaultFavicon'],'raw':!![]});})[_0xa570('0x16')](handleEntityNotFound(_0x220c61,null))[_0xa570('0x16')](function(_0x1c8413){if(_0x1c8413){var _0x1143e9=_0x1c8413['preferred']&&fs[_0xa570('0x5f')](path[_0xa570('0x60')](config[_0xa570('0x61')],_0x2f7890,_['toLower'](_0x1c8413[_0xa570('0x5a')])))?path[_0xa570('0x60')](config[_0xa570('0x61')],_0x2f7890,_[_0xa570('0x62')](_0x1c8413[_0xa570('0x5a')])):path[_0xa570('0x60')](config['root'],_0x2f7890,_[_0xa570('0x62')](_0xa570('0x70')));var _0x3aef50='default'+_[_0xa570('0x68')]('preferred');if(_0x1c8413[_0x3aef50]||!_0x4824b2[_0xa570('0x64')]||!_0x4824b2[_0xa570('0x5a')]){_0x1143e9=path[_0xa570('0x60')](config[_0xa570('0x61')],_0x2f7890,_['toLower'](_0xa570('0x70')));}if(!fs[_0xa570('0x5f')](_0x1143e9)){throw new db['Sequelize'][(_0xa570('0x67'))](_[_0xa570('0x68')]('preferred')+'\x20not\x20found');}return _0x220c61['download'](_0x1143e9);}})[_0xa570('0x21')](handleError(_0x220c61,null));};exports[_0xa570('0x71')]=function(_0x5f168b,_0x52782e,_0x3c5cb2){if(_0x5f168b[_0xa570('0x52')]&&_0x5f168b['file'][_0xa570('0x54')]){_0x5f168b['body'][_0xa570('0x5b')]=_0x5f168b[_0xa570('0x52')][_0xa570('0x54')];}return db[_0xa570('0x38')]['find']({'where':{'id':_0x5f168b[_0xa570('0x4d')]['id']}})['then'](handleEntityNotFound(_0x52782e,null))['then'](saveUpdates(_0x5f168b[_0xa570('0x33')],null))[_0xa570('0x16')](respondWithResult(_0x52782e,null))[_0xa570('0x21')](handleError(_0x52782e,null));};var utilLicense=require(_0xa570('0x12'));exports[_0xa570('0x72')]=function(_0x20d062,_0x204ff6,_0x1fcb18){var _0x357b7e='server/files/images/logos';var _0x3b3c61={'custom':![]};return utilLicense[_0xa570('0x58')]()[_0xa570('0x16')](function(_0x1e4024){if(_0x1e4024){_0x3b3c61=_0x1e4024;}return db[_0xa570('0x38')]['find']({'where':{'id':_0x20d062[_0xa570('0x4d')]['id']},'attributes':['logo',_0xa570('0x59'),_0xa570('0x5a'),'favicon','defaultLogo',_0xa570('0x6c'),_0xa570('0x5d'),'defaultFavicon'],'raw':!![]});})[_0xa570('0x16')](handleEntityNotFound(_0x204ff6,null))[_0xa570('0x16')](function(_0x29ebc9){if(_0x29ebc9){var _0x5a2453=_0x29ebc9[_0xa570('0x5b')]&&fs[_0xa570('0x5f')](path[_0xa570('0x60')](config[_0xa570('0x61')],_0x357b7e,_[_0xa570('0x62')](_0x29ebc9[_0xa570('0x5b')])))?path[_0xa570('0x60')](config['root'],_0x357b7e,_[_0xa570('0x62')](_0x29ebc9[_0xa570('0x5b')])):path[_0xa570('0x60')](config[_0xa570('0x61')],_0x357b7e,_['toLower'](_0xa570('0x73')));var _0x3fb7c4='default'+_[_0xa570('0x68')](_0xa570('0x5b'));if(_0x29ebc9[_0x3fb7c4]||!_0x3b3c61[_0xa570('0x64')]){_0x5a2453=path[_0xa570('0x60')](config[_0xa570('0x61')],_0x357b7e,_[_0xa570('0x62')]('default_favicon.ico'));}if(!fs[_0xa570('0x5f')](_0x5a2453)){throw new db['Sequelize'][(_0xa570('0x67'))](_[_0xa570('0x68')]('favicon')+'\x20not\x20found');}return _0x204ff6[_0xa570('0x6a')](_0x5a2453);}})['catch'](handleError(_0x204ff6,null));};exports[_0xa570('0x74')]=function(_0xdeaf2e,_0x55fd94){var _0x1a3d02={'offset':moment()[_0xa570('0x75')]()};_0x1a3d02[_0xa570('0x76')]=moment()['utcOffset'](_0x1a3d02['offset'])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x55fd94[_0xa570('0x23')](0xc8)['send'](_0x1a3d02);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index e0ed916..9aaea1a 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 _0x5cf7=['request-promise','path','exports','settings','lodash','util','../../config/logger','api','bluebird'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x5cf7,0x187));var _0x75cf=function(_0x468004,_0x58a23c){_0x468004=_0x468004-0x0;var _0x4b8cc0=_0x5cf7[_0x468004];return _0x4b8cc0;};'use strict';var _=require(_0x75cf('0x0'));var util=require(_0x75cf('0x1'));var logger=require(_0x75cf('0x2'))(_0x75cf('0x3'));var moment=require('moment');var BPromise=require(_0x75cf('0x4'));var rp=require(_0x75cf('0x5'));var fs=require('fs');var path=require(_0x75cf('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./setting.attributes');module[_0x75cf('0x7')]=function(_0x45192b,_0x7aa39b){return _0x45192b['define']('Setting',attributes,{'tableName':_0x75cf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x105a=['api','moment','request-promise','path','../../config/environment','exports','define','Setting','settings','lodash','util','../../config/logger'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x105a,0x1a1));var _0xa105=function(_0x1b6c89,_0x389b15){_0x1b6c89=_0x1b6c89-0x0;var _0x17a8d9=_0x105a[_0x1b6c89];return _0x17a8d9;};'use strict';var _=require(_0xa105('0x0'));var util=require(_0xa105('0x1'));var logger=require(_0xa105('0x2'))(_0xa105('0x3'));var moment=require(_0xa105('0x4'));var BPromise=require('bluebird');var rp=require(_0xa105('0x5'));var fs=require('fs');var path=require(_0xa105('0x6'));var rimraf=require('rimraf');var config=require(_0xa105('0x7'));var attributes=require('./setting.attributes');module[_0xa105('0x8')]=function(_0x2816a8,_0x3f5db5){return _0x2816a8[_0xa105('0x9')](_0xa105('0xa'),attributes,{'tableName':_0xa105('0xb'),'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 34417b9..b8e92c1 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 _0xc77a=['then','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSetting','find','options','raw','attributes','map','include','model'];(function(_0x26e084,_0x586895){var _0x3ce7f7=function(_0x5d4420){while(--_0x5d4420){_0x26e084['push'](_0x26e084['shift']());}};_0x3ce7f7(++_0x586895);}(_0xc77a,0xbb));var _0xac77=function(_0x56a020,_0x3065c6){_0x56a020=_0x56a020-0x0;var _0xc4220c=_0xc77a[_0x56a020];return _0xc4220c;};'use strict';var _=require(_0xac77('0x0'));var util=require('util');var moment=require(_0xac77('0x1'));var BPromise=require(_0xac77('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac77('0x3'));var db=require(_0xac77('0x4'))['db'];var utils=require(_0xac77('0x5'));var logger=require('../../config/logger')(_0xac77('0x6'));var config=require(_0xac77('0x7'));var jayson=require(_0xac77('0x8'));var client=jayson[_0xac77('0x9')][_0xac77('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25ef84,_0x4c7f3a,_0x46cc6c){return new BPromise(function(_0x28e961,_0x56b110){return client[_0xac77('0xb')](_0x25ef84,_0x46cc6c)['then'](function(_0x475928){logger[_0xac77('0xc')](_0xac77('0xd'),_0x4c7f3a,_0xac77('0xe'));logger[_0xac77('0xf')](_0xac77('0x10'),_0x4c7f3a,_0xac77('0xe'),JSON[_0xac77('0x11')](_0x475928));if(_0x475928[_0xac77('0x12')]){if(_0x475928['error'][_0xac77('0x13')]===0x1f4){logger['error'](_0xac77('0xd'),_0x4c7f3a,_0x475928[_0xac77('0x12')][_0xac77('0x14')]);return _0x56b110(_0x475928[_0xac77('0x12')]['message']);}logger[_0xac77('0x12')](_0xac77('0xd'),_0x4c7f3a,_0x475928['error']['message']);return _0x28e961(_0x475928[_0xac77('0x12')]['message']);}else{logger[_0xac77('0xc')](_0xac77('0xd'),_0x4c7f3a,_0xac77('0xe'));_0x28e961(_0x475928['result'][_0xac77('0x14')]);}})[_0xac77('0x15')](function(_0x33caec){logger[_0xac77('0x12')](_0xac77('0xd'),_0x4c7f3a,_0x33caec);_0x56b110(_0x33caec);});});}exports[_0xac77('0x16')]=function(_0x4a3b79){var _0x8a0254=this;return new Promise(function(_0xb0ac08,_0x5897a3){return db['Setting'][_0xac77('0x17')]({'raw':_0x4a3b79[_0xac77('0x18')]?_0x4a3b79[_0xac77('0x18')][_0xac77('0x19')]===undefined?!![]:![]:!![],'where':_0x4a3b79[_0xac77('0x18')]?_0x4a3b79[_0xac77('0x18')]['where']||null:null,'attributes':_0x4a3b79['options']?_0x4a3b79[_0xac77('0x18')][_0xac77('0x1a')]||null:null,'include':_0x4a3b79[_0xac77('0x18')]?_0x4a3b79['options']['include']?_[_0xac77('0x1b')](_0x4a3b79['options']['include'],function(_0x35e6d7){return{'model':db[_0x35e6d7['model']],'as':_0x35e6d7['as'],'attributes':_0x35e6d7[_0xac77('0x1a')],'include':_0x35e6d7[_0xac77('0x1c')]?_[_0xac77('0x1b')](_0x35e6d7[_0xac77('0x1c')],function(_0x34cbd5){return{'model':db[_0x34cbd5[_0xac77('0x1d')]],'as':_0x34cbd5['as'],'attributes':_0x34cbd5[_0xac77('0x1a')],'include':_0x34cbd5[_0xac77('0x1c')]?_[_0xac77('0x1b')](_0x34cbd5[_0xac77('0x1c')],function(_0x17db35){return{'model':db[_0x17db35['model']],'as':_0x17db35['as'],'attributes':_0x17db35[_0xac77('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xac77('0x1e')](function(_0x5d28fb){logger[_0xac77('0xc')](_0xac77('0x16'),_0x4a3b79);logger[_0xac77('0xf')](_0xac77('0x16'),_0x4a3b79,JSON[_0xac77('0x11')](_0x5d28fb));_0xb0ac08(_0x5d28fb);})[_0xac77('0x15')](function(_0x2fc2e7){logger[_0xac77('0x12')]('ShowSetting',_0x2fc2e7[_0xac77('0x14')],_0x4a3b79);_0x5897a3(_0x8a0254[_0xac77('0x12')](0x1f4,_0x2fc2e7[_0xac77('0x14')]));});});}; \ No newline at end of file +var _0x6181=['../../config/environment','jayson/promise','client','request','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','Setting','options','where','attributes','include','map','model','ShowSetting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x299309,_0x4067f1){var _0x247738=function(_0x108b6f){while(--_0x108b6f){_0x299309['push'](_0x299309['shift']());}};_0x247738(++_0x4067f1);}(_0x6181,0xd1));var _0x1618=function(_0x1aeb39,_0x2e8404){_0x1aeb39=_0x1aeb39-0x0;var _0x439790=_0x6181[_0x1aeb39];return _0x439790;};'use strict';var _=require(_0x1618('0x0'));var util=require(_0x1618('0x1'));var moment=require(_0x1618('0x2'));var BPromise=require(_0x1618('0x3'));var rs=require(_0x1618('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1618('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1618('0x6'))(_0x1618('0x7'));var config=require(_0x1618('0x8'));var jayson=require(_0x1618('0x9'));var client=jayson[_0x1618('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3126d3,_0x4a3725,_0x5ec522){return new BPromise(function(_0xde53cf,_0x2fc26c){return client[_0x1618('0xb')](_0x3126d3,_0x5ec522)['then'](function(_0x5ea66b){logger[_0x1618('0xc')]('Setting,\x20%s,\x20%s',_0x4a3725,'request\x20sent');logger[_0x1618('0xd')](_0x1618('0xe'),_0x4a3725,_0x1618('0xf'),JSON[_0x1618('0x10')](_0x5ea66b));if(_0x5ea66b[_0x1618('0x11')]){if(_0x5ea66b[_0x1618('0x11')][_0x1618('0x12')]===0x1f4){logger[_0x1618('0x11')](_0x1618('0x13'),_0x4a3725,_0x5ea66b[_0x1618('0x11')][_0x1618('0x14')]);return _0x2fc26c(_0x5ea66b[_0x1618('0x11')][_0x1618('0x14')]);}logger[_0x1618('0x11')](_0x1618('0x13'),_0x4a3725,_0x5ea66b[_0x1618('0x11')][_0x1618('0x14')]);return _0xde53cf(_0x5ea66b[_0x1618('0x11')][_0x1618('0x14')]);}else{logger['info'](_0x1618('0x13'),_0x4a3725,'request\x20sent');_0xde53cf(_0x5ea66b[_0x1618('0x15')][_0x1618('0x14')]);}})[_0x1618('0x16')](function(_0x3873bd){logger['error'](_0x1618('0x13'),_0x4a3725,_0x3873bd);_0x2fc26c(_0x3873bd);});});}exports['ShowSetting']=function(_0x161e80){var _0x524034=this;return new Promise(function(_0x5ca053,_0x56eced){return db[_0x1618('0x17')]['find']({'raw':_0x161e80[_0x1618('0x18')]?_0x161e80['options']['raw']===undefined?!![]:![]:!![],'where':_0x161e80[_0x1618('0x18')]?_0x161e80['options'][_0x1618('0x19')]||null:null,'attributes':_0x161e80[_0x1618('0x18')]?_0x161e80['options'][_0x1618('0x1a')]||null:null,'include':_0x161e80['options']?_0x161e80['options'][_0x1618('0x1b')]?_[_0x1618('0x1c')](_0x161e80[_0x1618('0x18')][_0x1618('0x1b')],function(_0x16701c){return{'model':db[_0x16701c[_0x1618('0x1d')]],'as':_0x16701c['as'],'attributes':_0x16701c[_0x1618('0x1a')],'include':_0x16701c['include']?_[_0x1618('0x1c')](_0x16701c[_0x1618('0x1b')],function(_0x45beb7){return{'model':db[_0x45beb7[_0x1618('0x1d')]],'as':_0x45beb7['as'],'attributes':_0x45beb7[_0x1618('0x1a')],'include':_0x45beb7[_0x1618('0x1b')]?_[_0x1618('0x1c')](_0x45beb7['include'],function(_0x1bfbfe){return{'model':db[_0x1bfbfe[_0x1618('0x1d')]],'as':_0x1bfbfe['as'],'attributes':_0x1bfbfe[_0x1618('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x257370){logger[_0x1618('0xc')](_0x1618('0x1e'),_0x161e80);logger[_0x1618('0xd')](_0x1618('0x1e'),_0x161e80,JSON['stringify'](_0x257370));_0x5ca053(_0x257370);})[_0x1618('0x16')](function(_0x725c83){logger[_0x1618('0x11')]('ShowSetting',_0x725c83[_0x1618('0x14')],_0x161e80);_0x56eced(_0x524034[_0x1618('0x11')](0x1f4,_0x725c83[_0x1618('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d9bb1b2..4fd3d76 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 _0x3e38=['show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/status','/:id/users','getAgents','post','create','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','status','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x5690a4,_0x572d64){var _0x170f91=function(_0x5458c1){while(--_0x5458c1){_0x5690a4['push'](_0x5690a4['shift']());}};_0x170f91(++_0x572d64);}(_0x3e38,0x1d3));var _0x83e3=function(_0x2dbd76,_0x1cfa67){_0x2dbd76=_0x2dbd76-0x0;var _0x1b0785=_0x3e38[_0x2dbd76];return _0x1b0785;};'use strict';var multer=require('multer');var util=require(_0x83e3('0x0'));var path=require(_0x83e3('0x1'));var timeout=require(_0x83e3('0x2'));var express=require('express');var router=express[_0x83e3('0x3')]();var fs_extra=require(_0x83e3('0x4'));var auth=require(_0x83e3('0x5'));var interaction=require(_0x83e3('0x6'));var config=require('../../config/environment');var controller=require('./smsAccount.controller');router['get']('/',auth[_0x83e3('0x7')](),controller[_0x83e3('0x8')]);router[_0x83e3('0x9')](_0x83e3('0xa'),auth[_0x83e3('0x7')](),controller[_0x83e3('0xb')]);router[_0x83e3('0x9')](_0x83e3('0xc'),auth['isAuthenticated'](),controller[_0x83e3('0xd')]);router['get'](_0x83e3('0xe'),auth['isAuthenticated'](),controller[_0x83e3('0xf')]);router[_0x83e3('0x9')]('/:id/canned_answers',auth[_0x83e3('0x7')](),controller[_0x83e3('0x10')]);router['get'](_0x83e3('0x11'),auth[_0x83e3('0x7')](),controller[_0x83e3('0x12')]);router['get']('/:id/interactions',auth[_0x83e3('0x7')](),controller['getInteractions']);router['get'](_0x83e3('0x13'),controller['statusGet']);router[_0x83e3('0x9')](_0x83e3('0x14'),auth[_0x83e3('0x7')](),controller[_0x83e3('0x15')]);router[_0x83e3('0x16')]('/',auth[_0x83e3('0x7')](),controller[_0x83e3('0x17')]);router[_0x83e3('0x16')](_0x83e3('0xe'),auth[_0x83e3('0x7')](),controller['addDisposition']);router['post'](_0x83e3('0x18'),auth[_0x83e3('0x7')](),controller[_0x83e3('0x19')]);router[_0x83e3('0x16')](_0x83e3('0x1a'),controller[_0x83e3('0x1b')]);router['post'](_0x83e3('0x11'),auth[_0x83e3('0x7')](),controller[_0x83e3('0x1c')]);router[_0x83e3('0x16')](_0x83e3('0x1d'),auth[_0x83e3('0x7')](),controller[_0x83e3('0x1e')]);router[_0x83e3('0x16')](_0x83e3('0x13'),controller[_0x83e3('0x1f')]);router[_0x83e3('0x16')]('/:id/users',auth[_0x83e3('0x7')](),controller[_0x83e3('0x20')]);router[_0x83e3('0x21')](_0x83e3('0xc'),auth[_0x83e3('0x7')](),controller['update']);router[_0x83e3('0x22')](_0x83e3('0xc'),auth[_0x83e3('0x7')](),controller[_0x83e3('0x23')]);router[_0x83e3('0x22')]('/:id/dispositions',auth[_0x83e3('0x7')](),controller[_0x83e3('0x24')]);router[_0x83e3('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x83e3('0x25')]);router[_0x83e3('0x22')](_0x83e3('0x14'),auth[_0x83e3('0x7')](),controller[_0x83e3('0x26')]);module[_0x83e3('0x27')]=router; \ No newline at end of file +var _0x97e1=['getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','addDisposition','addAnswer','addApplications','/:id/send','status','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0x97e1,0x1dd));var _0x197e=function(_0x489c95,_0x53159c){_0x489c95=_0x489c95-0x0;var _0x10e7a7=_0x97e1[_0x489c95];return _0x10e7a7;};'use strict';var multer=require(_0x197e('0x0'));var util=require('util');var path=require(_0x197e('0x1'));var timeout=require(_0x197e('0x2'));var express=require(_0x197e('0x3'));var router=express[_0x197e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x197e('0x5'));var interaction=require(_0x197e('0x6'));var config=require(_0x197e('0x7'));var controller=require(_0x197e('0x8'));router[_0x197e('0x9')]('/',auth[_0x197e('0xa')](),controller['index']);router['get'](_0x197e('0xb'),auth[_0x197e('0xa')](),controller['describe']);router[_0x197e('0x9')](_0x197e('0xc'),auth[_0x197e('0xa')](),controller[_0x197e('0xd')]);router[_0x197e('0x9')](_0x197e('0xe'),auth[_0x197e('0xa')](),controller[_0x197e('0xf')]);router[_0x197e('0x9')](_0x197e('0x10'),auth['isAuthenticated'](),controller[_0x197e('0x11')]);router[_0x197e('0x9')](_0x197e('0x12'),auth['isAuthenticated'](),controller[_0x197e('0x13')]);router[_0x197e('0x9')](_0x197e('0x14'),auth[_0x197e('0xa')](),controller[_0x197e('0x15')]);router[_0x197e('0x9')](_0x197e('0x16'),controller[_0x197e('0x17')]);router[_0x197e('0x9')](_0x197e('0x18'),auth[_0x197e('0xa')](),controller['getAgents']);router[_0x197e('0x19')]('/',auth[_0x197e('0xa')](),controller['create']);router[_0x197e('0x19')](_0x197e('0xe'),auth[_0x197e('0xa')](),controller[_0x197e('0x1a')]);router[_0x197e('0x19')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x197e('0x1b')]);router[_0x197e('0x19')]('/:id/notify',controller['notify']);router[_0x197e('0x19')](_0x197e('0x12'),auth['isAuthenticated'](),controller[_0x197e('0x1c')]);router[_0x197e('0x19')](_0x197e('0x1d'),auth[_0x197e('0xa')](),controller['send']);router[_0x197e('0x19')](_0x197e('0x16'),controller[_0x197e('0x1e')]);router[_0x197e('0x19')]('/:id/users',auth[_0x197e('0xa')](),controller[_0x197e('0x1f')]);router['put'](_0x197e('0xc'),auth[_0x197e('0xa')](),controller[_0x197e('0x20')]);router[_0x197e('0x21')](_0x197e('0xc'),auth['isAuthenticated'](),controller[_0x197e('0x22')]);router[_0x197e('0x21')](_0x197e('0xe'),auth[_0x197e('0xa')](),controller[_0x197e('0x23')]);router[_0x197e('0x21')](_0x197e('0x10'),auth[_0x197e('0xa')](),controller[_0x197e('0x24')]);router[_0x197e('0x21')](_0x197e('0x18'),auth[_0x197e('0xa')](),controller[_0x197e('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index d637718..31abee6 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 _0x184d=['STRING','generate','ENUM','twilio','plivo','clickatell','csc','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','randomstring'];(function(_0x1f32f5,_0x4334ce){var _0x274422=function(_0x1c9cf3){while(--_0x1c9cf3){_0x1f32f5['push'](_0x1f32f5['shift']());}};_0x274422(++_0x4334ce);}(_0x184d,0x1d0));var _0xd184=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x184d[_0x2f45ea];return _0x485a84;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xd184('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xd184('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xd184('0x1')],'defaultValue':function(){return rs[_0xd184('0x2')]();}},'phone':{'type':Sequelize[_0xd184('0x1')]},'type':{'type':Sequelize[_0xd184('0x3')](_0xd184('0x4'),'skebby','connectel','clicksend',_0xd184('0x5'),_0xd184('0x6'),'bandwidth',_0xd184('0x7'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0xd184('0x1')]},'authId':{'type':Sequelize[_0xd184('0x1')]},'authToken':{'type':Sequelize[_0xd184('0x1')]},'smsMethod':{'type':Sequelize[_0xd184('0x3')]('SI','TI','GP')},'username':{'type':Sequelize[_0xd184('0x1')]},'password':{'type':Sequelize[_0xd184('0x1')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xd184('0x1')]},'accountId':{'type':Sequelize[_0xd184('0x1')]},'senderString':{'type':Sequelize[_0xd184('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xd184('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd184('0x8');}},'notificationSound':{'type':Sequelize[_0xd184('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd184('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd184('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd184('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd184('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd184('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xd184('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd184('0xa')],'comment':_0xd184('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xd184('0x9')],'defaultValue':![],'comment':_0xd184('0xc'),'set':function(_0x3fe670){if(!_0x3fe670)this[_0xd184('0xd')](_0xd184('0xe'),null);this[_0xd184('0xd')]('mandatoryDisposition',_0x3fe670);}}}; \ No newline at end of file +var _0x9af1=['clicksend','plivo','bandwidth','csc','infobip','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','sequelize','randomstring','exports','name','STRING','twilio','skebby','connectel'];(function(_0x2e36a8,_0x4adb6e){var _0x74aaa2=function(_0x1e4278){while(--_0x1e4278){_0x2e36a8['push'](_0x2e36a8['shift']());}};_0x74aaa2(++_0x4adb6e);}(_0x9af1,0x68));var _0x19af=function(_0x1a3fd3,_0x460440){_0x1a3fd3=_0x1a3fd3-0x0;var _0x28f220=_0x9af1[_0x1a3fd3];return _0x28f220;};'use strict';var Sequelize=require(_0x19af('0x0'));var rs=require(_0x19af('0x1'));module[_0x19af('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x19af('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x19af('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x19af('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x19af('0x4')]},'type':{'type':Sequelize['ENUM'](_0x19af('0x5'),_0x19af('0x6'),_0x19af('0x7'),_0x19af('0x8'),_0x19af('0x9'),'clickatell',_0x19af('0xa'),_0x19af('0xb'),_0x19af('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0x19af('0x4')]},'authId':{'type':Sequelize[_0x19af('0x4')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x19af('0x4')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x19af('0x4')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x19af('0x4')]},'senderString':{'type':Sequelize[_0x19af('0x4')]},'deliveryReport':{'type':Sequelize[_0x19af('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x19af('0x4')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x19af('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x19af('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x19af('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x19af('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x19af('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x19af('0xe')},'mandatoryDisposition':{'type':Sequelize[_0x19af('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1c2ac2){if(!_0x1c2ac2)this[_0x19af('0xf')]('mandatoryDispositionPauseId',null);this[_0x19af('0xf')]('mandatoryDisposition',_0x1c2ac2);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index a72314a..50e79fa 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 _0x00bb=['status_code','DELIVERED','redif','error_code','groupName','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsAccount,\x20%s,\x20%s','result','sendStatus','status','json','offset','limit','undefined','count','set','apply','save','update','get','SmsAccounts','destroy','end','stack','name','send','render','merge','body','contact','agent','account','index','Pause','map','SmsAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','includeAll','include','findAll','rows','catch','params','mandatoryDispositionPause','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','order','filter','removeDispositions','ids','addAnswer','SmsAccountId','CannedAnswer','getAnswers','removeAnswers','notify','sms','Applications','applications','orderBy','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','mobile','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','message_id','plivo','Text','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','intelepeer','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','DESC','list','CmContact','SmsInteraction','spread','created','push','close','unmanaged','*,*,*,*','interaction','SmsMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','\x0a','addApplications','SmsApplication','bulkCreate','getApplications','Contact','Owner','fullname','internal','Tags','color','tag','isNil','to\x20is\x20mandatory','CmList','List','out','dataValues','Messages','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend'];(function(_0x2f8ccc,_0x175e03){var _0x312c41=function(_0x41577c){while(--_0x41577c){_0x2f8ccc['push'](_0x2f8ccc['shift']());}};_0x312c41(++_0x175e03);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x00bb[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];config[_0xb00b('0x15')]=_[_0xb00b('0x16')](config[_0xb00b('0x15')],{'host':_0xb00b('0x17'),'port':0x18eb});var socket=require(_0xb00b('0x18'))(new Redis(config['redis']));require(_0xb00b('0x19'))[_0xb00b('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb00b('0x1b')][_0xb00b('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x540b79,_0x5da36b,_0x9b471e,_0x4dcd45){return new BPromise(function(_0x51d136,_0x1f9c78){var _0x638443=_0x4dcd45||client;return _0x638443[_0xb00b('0x1d')](_0x540b79,_0x9b471e)[_0xb00b('0x1e')](function(_0x58d65f){logger[_0xb00b('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x5da36b,_0xb00b('0x20'));logger['debug'](_0xb00b('0x21'),_0x5da36b,'request\x20sent',JSON[_0xb00b('0x22')](_0x58d65f));if(_0x58d65f[_0xb00b('0x23')]){if(_0x58d65f['error']['code']===0x1f4){logger[_0xb00b('0x23')]('SmsAccount,\x20%s,\x20%s',_0x5da36b,_0x58d65f[_0xb00b('0x23')][_0xb00b('0x24')]);return _0x1f9c78(_0x58d65f[_0xb00b('0x23')][_0xb00b('0x24')]);}logger['error'](_0xb00b('0x25'),_0x5da36b,_0x58d65f['error'][_0xb00b('0x24')]);return _0x51d136(_0x58d65f[_0xb00b('0x23')]['message']);}else{logger[_0xb00b('0x1f')](_0xb00b('0x25'),_0x5da36b,'request\x20sent');_0x51d136(_0x58d65f[_0xb00b('0x26')][_0xb00b('0x24')]);}})['catch'](function(_0x44efe5){logger[_0xb00b('0x23')](_0xb00b('0x25'),_0x5da36b,_0x44efe5);_0x1f9c78(_0x44efe5);});});}function respondWithStatusCode(_0x8caadf,_0x520e55){_0x520e55=_0x520e55||0xcc;return function(_0x50be6c){if(_0x50be6c){return _0x8caadf[_0xb00b('0x27')](_0x520e55);}return _0x8caadf['status'](_0x520e55)['end']();};}function respondWithResult(_0x4a635e,_0x16ac55){_0x16ac55=_0x16ac55||0xc8;return function(_0x73b6b0){if(_0x73b6b0){return _0x4a635e[_0xb00b('0x28')](_0x16ac55)[_0xb00b('0x29')](_0x73b6b0);}};}function respondWithFilteredResult(_0x1f14fa,_0x197379){return function(_0x15d3b9){if(_0x15d3b9){var _0x4a8d2b=typeof _0x197379[_0xb00b('0x2a')]==='undefined'&&typeof _0x197379[_0xb00b('0x2b')]===_0xb00b('0x2c');var _0x5424ca=_0x15d3b9['count'];var _0x2fc11a=_0x4a8d2b?0x0:_0x197379[_0xb00b('0x2a')];var _0x16fbd5=_0x4a8d2b?_0x15d3b9[_0xb00b('0x2d')]:_0x197379[_0xb00b('0x2a')]+_0x197379[_0xb00b('0x2b')];var _0x2e160a;if(_0x16fbd5>=_0x5424ca){_0x16fbd5=_0x5424ca;_0x2e160a=0xc8;}else{_0x2e160a=0xce;}_0x1f14fa[_0xb00b('0x28')](_0x2e160a);return _0x1f14fa[_0xb00b('0x2e')]('Content-Range',_0x2fc11a+'-'+_0x16fbd5+'/'+_0x5424ca)[_0xb00b('0x29')](_0x15d3b9);}return null;};}function patchUpdates(_0x44918d){return function(_0x49078d){try{jsonpatch[_0xb00b('0x2f')](_0x49078d,_0x44918d,!![]);}catch(_0x2f3b37){return BPromise['reject'](_0x2f3b37);}return _0x49078d[_0xb00b('0x30')]();};}function saveUpdates(_0x4d2ee5,_0x20e1c9){return function(_0x4117f2){if(_0x4117f2){return _0x4117f2[_0xb00b('0x31')](_0x4d2ee5)[_0xb00b('0x1e')](function(_0x338864){return _0x338864;});}return null;};}function removeEntity(_0x1436ad,_0x17f613){return function(_0x594840){if(_0x594840){return _0x594840['destroy']()['then'](function(){var _0x347e73=_0x594840[_0xb00b('0x32')]({'plain':!![]});var _0x45dcda=_0xb00b('0x33');return db['UserProfileResource'][_0xb00b('0x34')]({'where':{'type':_0x45dcda,'resourceId':_0x347e73['id']}})[_0xb00b('0x1e')](function(){return _0x594840;});})[_0xb00b('0x1e')](function(){_0x1436ad[_0xb00b('0x28')](0xcc)[_0xb00b('0x35')]();});}};}function handleEntityNotFound(_0x39da49,_0x8785ec){return function(_0x3302ac){if(!_0x3302ac){_0x39da49['sendStatus'](0x194);}return _0x3302ac;};}function handleError(_0x55451e,_0x2ea41d){_0x2ea41d=_0x2ea41d||0x1f4;return function(_0x56022e){logger[_0xb00b('0x23')](_0x56022e[_0xb00b('0x36')]);if(_0x56022e[_0xb00b('0x37')]){delete _0x56022e[_0xb00b('0x37')];}_0x55451e[_0xb00b('0x28')](_0x2ea41d)[_0xb00b('0x38')](_0x56022e);};}function getMustacheRender(_0x391f1a,_0x54c2ee){return Mustache[_0xb00b('0x39')](_0x391f1a,_[_0xb00b('0x3a')](_0x54c2ee[_0xb00b('0x3b')],{'contact':_0x54c2ee[_0xb00b('0x3c')],'message':_0x54c2ee[_0xb00b('0x24')],'agent':_0x54c2ee[_0xb00b('0x3d')],'interaction':_0x54c2ee['interaction'],'account':_0x54c2ee[_0xb00b('0x3e')]}))||'';}exports[_0xb00b('0x3f')]=function(_0x4801e7,_0x17ff34){var _0x163d2e={'include':[{'model':db[_0xb00b('0x40')],'as':'mandatoryDispositionPause'}]},_0xa2ae04={},_0x2d8620={'count':0x0,'rows':[]};var _0x14ff6a=_[_0xb00b('0x41')](db[_0xb00b('0x42')][_0xb00b('0x43')],function(_0x5d2bbd){return{'name':_0x5d2bbd['fieldName'],'type':_0x5d2bbd[_0xb00b('0x44')][_0xb00b('0x45')]};});_0xa2ae04[_0xb00b('0x46')]=_[_0xb00b('0x41')](_0x14ff6a,_0xb00b('0x37'));_0xa2ae04[_0xb00b('0x47')]=_[_0xb00b('0x48')](_0x4801e7['query']);_0xa2ae04[_0xb00b('0x49')]=_[_0xb00b('0x4a')](_0xa2ae04[_0xb00b('0x46')],_0xa2ae04[_0xb00b('0x47')]);_0x163d2e[_0xb00b('0x4b')]=_[_0xb00b('0x4a')](_0xa2ae04[_0xb00b('0x46')],qs[_0xb00b('0x4c')](_0x4801e7[_0xb00b('0x47')][_0xb00b('0x4c')]));_0x163d2e[_0xb00b('0x4b')]=_0x163d2e[_0xb00b('0x4b')]['length']?_0x163d2e[_0xb00b('0x4b')]:_0xa2ae04[_0xb00b('0x46')];if(!_0x4801e7[_0xb00b('0x47')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x163d2e[_0xb00b('0x2b')]=qs[_0xb00b('0x2b')](_0x4801e7[_0xb00b('0x47')][_0xb00b('0x2b')]);_0x163d2e[_0xb00b('0x2a')]=qs[_0xb00b('0x2a')](_0x4801e7[_0xb00b('0x47')]['offset']);}_0x163d2e['order']=qs['sort'](_0x4801e7[_0xb00b('0x47')][_0xb00b('0x4f')]);_0x163d2e['where']=qs[_0xb00b('0x49')](_[_0xb00b('0x50')](_0x4801e7[_0xb00b('0x47')],_0xa2ae04[_0xb00b('0x49')]),_0x14ff6a);if(_0x4801e7['query']['filter']){_0x163d2e[_0xb00b('0x51')]=_[_0xb00b('0x3a')](_0x163d2e['where'],{'$or':_['map'](_0x14ff6a,function(_0x154759){if(_0x154759[_0xb00b('0x44')]!=='VIRTUAL'){var _0x2228e9={};_0x2228e9[_0x154759['name']]={'$like':'%'+_0x4801e7['query']['filter']+'%'};return _0x2228e9;}})});}_0x163d2e=_[_0xb00b('0x3a')]({},_0x163d2e,_0x4801e7['options']);var _0x1f7b86={'where':_0x163d2e[_0xb00b('0x51')]};return db[_0xb00b('0x42')][_0xb00b('0x2d')](_0x1f7b86)[_0xb00b('0x1e')](function(_0xda60ca){_0x2d8620['count']=_0xda60ca;if(_0x4801e7['query'][_0xb00b('0x52')]){_0x163d2e[_0xb00b('0x53')]=[{'all':!![]}];}return db['SmsAccount'][_0xb00b('0x54')](_0x163d2e);})[_0xb00b('0x1e')](function(_0x57f6ab){_0x2d8620[_0xb00b('0x55')]=_0x57f6ab;return _0x2d8620;})[_0xb00b('0x1e')](respondWithFilteredResult(_0x17ff34,_0x163d2e))[_0xb00b('0x56')](handleError(_0x17ff34,null));};exports['show']=function(_0x501cbe,_0x19f907){var _0x398deb={'raw':![],'where':{'id':_0x501cbe[_0xb00b('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xb00b('0x58')}]},_0x12737d={};_0x12737d[_0xb00b('0x46')]=_['keys'](db['SmsAccount'][_0xb00b('0x43')]);_0x12737d['query']=_[_0xb00b('0x48')](_0x501cbe[_0xb00b('0x47')]);_0x12737d[_0xb00b('0x49')]=_[_0xb00b('0x4a')](_0x12737d[_0xb00b('0x46')],_0x12737d[_0xb00b('0x47')]);_0x398deb['attributes']=_[_0xb00b('0x4a')](_0x12737d['model'],qs[_0xb00b('0x4c')](_0x501cbe[_0xb00b('0x47')][_0xb00b('0x4c')]));_0x398deb['attributes']=_0x398deb[_0xb00b('0x4b')][_0xb00b('0x59')]?_0x398deb[_0xb00b('0x4b')]:_0x12737d['model'];if(_0x501cbe[_0xb00b('0x47')][_0xb00b('0x52')]){_0x398deb[_0xb00b('0x53')]=[{'all':!![]}];}_0x398deb=_[_0xb00b('0x3a')]({},_0x398deb,_0x501cbe[_0xb00b('0x5a')]);return db[_0xb00b('0x42')][_0xb00b('0x5b')](_0x398deb)[_0xb00b('0x1e')](handleEntityNotFound(_0x19f907,null))['then'](respondWithResult(_0x19f907,null))[_0xb00b('0x56')](handleError(_0x19f907,null));};exports[_0xb00b('0x5c')]=function(_0x1b4860,_0x4a22dd){return db[_0xb00b('0x42')][_0xb00b('0x5c')](_0x1b4860[_0xb00b('0x3b')],{})[_0xb00b('0x1e')](function(_0x1ad387){var _0x4bfe0b=_0x1b4860[_0xb00b('0x5d')][_0xb00b('0x32')]({'plain':!![]});if(!_0x4bfe0b)throw new Error(_0xb00b('0x5e'));if(_0x4bfe0b[_0xb00b('0x5f')]==='user'){var _0x32b9fe=_0x1ad387[_0xb00b('0x32')]({'plain':!![]});var _0x2c93db=_0xb00b('0x33');return db[_0xb00b('0x60')][_0xb00b('0x5b')]({'where':{'name':_0x2c93db,'userProfileId':_0x4bfe0b[_0xb00b('0x61')]},'raw':!![]})['then'](function(_0x2b090a){if(_0x2b090a&&_0x2b090a['autoAssociation']===0x0){return db[_0xb00b('0x62')]['create']({'name':_0x32b9fe[_0xb00b('0x37')],'resourceId':_0x32b9fe['id'],'type':_0x2b090a['name'],'sectionId':_0x2b090a['id']},{})[_0xb00b('0x1e')](function(){return _0x1ad387;});}else{return _0x1ad387;}})['catch'](function(_0x3dffaf){logger[_0xb00b('0x23')](_0xb00b('0x63'),_0x3dffaf);throw _0x3dffaf;});}return _0x1ad387;})['then'](respondWithResult(_0x4a22dd,0xc9))['catch'](handleError(_0x4a22dd,null));};exports['update']=function(_0x21a53d,_0x3126be){if(_0x21a53d[_0xb00b('0x3b')]['id']){delete _0x21a53d['body']['id'];}return db[_0xb00b('0x42')][_0xb00b('0x5b')]({'where':{'id':_0x21a53d[_0xb00b('0x57')]['id']},'include':[{'model':db[_0xb00b('0x40')],'as':_0xb00b('0x58')}]})['then'](handleEntityNotFound(_0x3126be,null))[_0xb00b('0x1e')](saveUpdates(_0x21a53d[_0xb00b('0x3b')],null))['then'](respondWithResult(_0x3126be,null))[_0xb00b('0x56')](handleError(_0x3126be,null));};exports[_0xb00b('0x34')]=function(_0xa6951f,_0x55abaa){return db['SmsAccount'][_0xb00b('0x5b')]({'where':{'id':_0xa6951f[_0xb00b('0x57')]['id']}})[_0xb00b('0x1e')](handleEntityNotFound(_0x55abaa,null))['then'](removeEntity(_0x55abaa,null))['catch'](handleError(_0x55abaa,null));};exports['describe']=function(_0x5e9677,_0xc695f){return db['SmsAccount'][_0xb00b('0x64')]()[_0xb00b('0x1e')](respondWithResult(_0xc695f,null))['catch'](handleError(_0xc695f,null));};exports[_0xb00b('0x65')]=function(_0x1e7f3a,_0x2d21ec,_0x204f40){if(_0x1e7f3a[_0xb00b('0x3b')]['id']){delete _0x1e7f3a['body']['id'];}return db[_0xb00b('0x42')][_0xb00b('0x5b')]({'where':{'id':_0x1e7f3a[_0xb00b('0x57')]['id']}})[_0xb00b('0x1e')](handleEntityNotFound(_0x2d21ec,null))[_0xb00b('0x1e')](function(_0x404fbd){if(_0x404fbd){_0x1e7f3a[_0xb00b('0x3b')]['SmsAccountId']=_0x404fbd['id'];return db[_0xb00b('0x66')][_0xb00b('0x5c')](_0x1e7f3a[_0xb00b('0x3b')]);}})[_0xb00b('0x1e')](respondWithResult(_0x2d21ec,null))[_0xb00b('0x56')](handleError(_0x2d21ec,null));};exports[_0xb00b('0x67')]=function(_0x3f010a,_0x266294,_0x4d6f3a){var _0x292986={'raw':![],'where':{}};var _0x446e42={};var _0x1bf5ad={'count':0x0,'rows':[]};return db[_0xb00b('0x42')][_0xb00b('0x68')]({'where':{'id':_0x3f010a[_0xb00b('0x57')]['id']}})[_0xb00b('0x1e')](handleEntityNotFound(_0x266294,null))[_0xb00b('0x1e')](function(_0x5625a4){if(_0x5625a4){_0x446e42[_0xb00b('0x46')]=_[_0xb00b('0x48')](db[_0xb00b('0x66')][_0xb00b('0x43')]);_0x446e42[_0xb00b('0x47')]=_[_0xb00b('0x48')](_0x3f010a[_0xb00b('0x47')]);_0x446e42['filters']=_[_0xb00b('0x4a')](_0x446e42[_0xb00b('0x46')],_0x446e42[_0xb00b('0x47')]);_0x292986[_0xb00b('0x4b')]=_[_0xb00b('0x4a')](_0x446e42[_0xb00b('0x46')],qs['fields'](_0x3f010a[_0xb00b('0x47')]['fields']));_0x292986[_0xb00b('0x4b')]=_0x292986['attributes'][_0xb00b('0x59')]?_0x292986[_0xb00b('0x4b')]:_0x446e42[_0xb00b('0x46')];if(!_0x3f010a['query']['hasOwnProperty'](_0xb00b('0x4e'))){_0x292986[_0xb00b('0x2b')]=qs[_0xb00b('0x2b')](_0x3f010a[_0xb00b('0x47')][_0xb00b('0x2b')]);_0x292986[_0xb00b('0x2a')]=qs[_0xb00b('0x2a')](_0x3f010a[_0xb00b('0x47')][_0xb00b('0x2a')]);}_0x292986[_0xb00b('0x69')]=qs[_0xb00b('0x4f')](_0x3f010a[_0xb00b('0x47')][_0xb00b('0x4f')]);_0x292986[_0xb00b('0x51')]=qs['filters'](_['pick'](_0x3f010a[_0xb00b('0x47')],_0x446e42[_0xb00b('0x49')]));_0x292986['where']['SmsAccountId']=_0x5625a4['id'];if(_0x3f010a[_0xb00b('0x47')][_0xb00b('0x6a')]){_0x292986[_0xb00b('0x51')]=_['merge'](_0x292986[_0xb00b('0x51')],{'$or':_[_0xb00b('0x41')](_0x292986[_0xb00b('0x4b')],function(_0x45c9cd){var _0x42b904={};_0x42b904[_0x45c9cd]={'$like':'%'+_0x3f010a[_0xb00b('0x47')][_0xb00b('0x6a')]+'%'};return _0x42b904;})});}_0x292986=_['merge']({},_0x292986,_0x3f010a[_0xb00b('0x5a')]);return db['Disposition'][_0xb00b('0x2d')]({'where':_0x292986[_0xb00b('0x51')]})['then'](function(_0xcef063){_0x1bf5ad[_0xb00b('0x2d')]=_0xcef063;if(_0x3f010a[_0xb00b('0x47')][_0xb00b('0x52')]){_0x292986[_0xb00b('0x53')]=[{'all':!![]}];}return db[_0xb00b('0x66')][_0xb00b('0x54')](_0x292986);})[_0xb00b('0x1e')](function(_0x36ba5c){_0x1bf5ad[_0xb00b('0x55')]=_0x36ba5c;return _0x1bf5ad;});}})[_0xb00b('0x1e')](respondWithFilteredResult(_0x266294,_0x292986))[_0xb00b('0x56')](handleError(_0x266294,null));};exports['removeDispositions']=function(_0x31449c,_0x64d8ea,_0x3c9a34){return db[_0xb00b('0x42')]['find']({'where':{'id':_0x31449c[_0xb00b('0x57')]['id']}})[_0xb00b('0x1e')](handleEntityNotFound(_0x64d8ea,null))[_0xb00b('0x1e')](function(_0x109deb){if(_0x109deb){return _0x109deb[_0xb00b('0x6b')](_0x31449c['query'][_0xb00b('0x6c')]);}})[_0xb00b('0x1e')](respondWithStatusCode(_0x64d8ea,null))[_0xb00b('0x56')](handleError(_0x64d8ea,null));};exports[_0xb00b('0x6d')]=function(_0x4fb982,_0x34dcb0,_0x584f4b){if(_0x4fb982[_0xb00b('0x3b')]['id']){delete _0x4fb982[_0xb00b('0x3b')]['id'];}return db[_0xb00b('0x42')][_0xb00b('0x5b')]({'where':{'id':_0x4fb982[_0xb00b('0x57')]['id']}})[_0xb00b('0x1e')](handleEntityNotFound(_0x34dcb0,null))[_0xb00b('0x1e')](function(_0x319977){if(_0x319977){_0x4fb982[_0xb00b('0x3b')][_0xb00b('0x6e')]=_0x319977['id'];return db[_0xb00b('0x6f')]['create'](_0x4fb982[_0xb00b('0x3b')]);}})[_0xb00b('0x1e')](respondWithResult(_0x34dcb0,null))[_0xb00b('0x56')](handleError(_0x34dcb0,null));};exports[_0xb00b('0x70')]=function(_0x501438,_0x136ca4,_0xb27b8b){var _0x4b5508={'raw':![],'where':{}};var _0x5c1aaa={};var _0x4b0278={'count':0x0,'rows':[]};return db[_0xb00b('0x42')][_0xb00b('0x68')]({'where':{'id':_0x501438[_0xb00b('0x57')]['id']}})['then'](handleEntityNotFound(_0x136ca4,null))[_0xb00b('0x1e')](function(_0x296be0){if(_0x296be0){_0x5c1aaa[_0xb00b('0x46')]=_[_0xb00b('0x48')](db[_0xb00b('0x6f')][_0xb00b('0x43')]);_0x5c1aaa[_0xb00b('0x47')]=_[_0xb00b('0x48')](_0x501438[_0xb00b('0x47')]);_0x5c1aaa['filters']=_['intersection'](_0x5c1aaa[_0xb00b('0x46')],_0x5c1aaa[_0xb00b('0x47')]);_0x4b5508[_0xb00b('0x4b')]=_[_0xb00b('0x4a')](_0x5c1aaa['model'],qs[_0xb00b('0x4c')](_0x501438[_0xb00b('0x47')]['fields']));_0x4b5508[_0xb00b('0x4b')]=_0x4b5508[_0xb00b('0x4b')][_0xb00b('0x59')]?_0x4b5508['attributes']:_0x5c1aaa[_0xb00b('0x46')];if(!_0x501438[_0xb00b('0x47')]['hasOwnProperty'](_0xb00b('0x4e'))){_0x4b5508[_0xb00b('0x2b')]=qs[_0xb00b('0x2b')](_0x501438[_0xb00b('0x47')][_0xb00b('0x2b')]);_0x4b5508[_0xb00b('0x2a')]=qs[_0xb00b('0x2a')](_0x501438[_0xb00b('0x47')]['offset']);}_0x4b5508[_0xb00b('0x69')]=qs[_0xb00b('0x4f')](_0x501438[_0xb00b('0x47')][_0xb00b('0x4f')]);_0x4b5508['where']=qs[_0xb00b('0x49')](_['pick'](_0x501438[_0xb00b('0x47')],_0x5c1aaa['filters']));_0x4b5508[_0xb00b('0x51')][_0xb00b('0x6e')]=_0x296be0['id'];if(_0x501438[_0xb00b('0x47')][_0xb00b('0x6a')]){_0x4b5508[_0xb00b('0x51')]=_['merge'](_0x4b5508[_0xb00b('0x51')],{'$or':_[_0xb00b('0x41')](_0x4b5508['attributes'],function(_0x44c086){var _0x494728={};_0x494728[_0x44c086]={'$like':'%'+_0x501438[_0xb00b('0x47')][_0xb00b('0x6a')]+'%'};return _0x494728;})});}_0x4b5508=_[_0xb00b('0x3a')]({},_0x4b5508,_0x501438[_0xb00b('0x5a')]);return db['CannedAnswer'][_0xb00b('0x2d')]({'where':_0x4b5508[_0xb00b('0x51')]})[_0xb00b('0x1e')](function(_0x44ea58){_0x4b0278[_0xb00b('0x2d')]=_0x44ea58;if(_0x501438['query']['includeAll']){_0x4b5508[_0xb00b('0x53')]=[{'all':!![]}];}return db[_0xb00b('0x6f')][_0xb00b('0x54')](_0x4b5508);})[_0xb00b('0x1e')](function(_0x35ad28){_0x4b0278['rows']=_0x35ad28;return _0x4b0278;});}})['then'](respondWithFilteredResult(_0x136ca4,_0x4b5508))[_0xb00b('0x56')](handleError(_0x136ca4,null));};exports[_0xb00b('0x71')]=function(_0x20d610,_0x265817,_0x45b488){return db[_0xb00b('0x42')][_0xb00b('0x5b')]({'where':{'id':_0x20d610['params']['id']}})[_0xb00b('0x1e')](handleEntityNotFound(_0x265817,null))['then'](function(_0x128a41){if(_0x128a41){return _0x128a41['removeAnswers'](_0x20d610[_0xb00b('0x47')][_0xb00b('0x6c')]);}})[_0xb00b('0x1e')](respondWithStatusCode(_0x265817,null))[_0xb00b('0x56')](handleError(_0x265817,null));};exports[_0xb00b('0x72')]=function(_0x2c6471,_0x210fc6,_0x2dc670){var _0x2268d0={'channel':_0xb00b('0x73')};var _0x1d15dd=[];var _0x565667=[];var _0x456a2f={};return db[_0xb00b('0x42')][_0xb00b('0x5b')]({'where':{'id':_0x2c6471[_0xb00b('0x57')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xb00b('0x74')}]})[_0xb00b('0x1e')](handleEntityNotFound(_0x210fc6,null))['then'](function(_0x421725){_0x2268d0['account']=_0x421725;_0x2268d0[_0xb00b('0x75')]=_[_0xb00b('0x76')](_0x421725['Applications'],[_0xb00b('0x77')],[_0xb00b('0x78')]);if(_0x2268d0[_0xb00b('0x3e')][_0xb00b('0x74')]){delete _0x2268d0[_0xb00b('0x3e')][_0xb00b('0x74')];}return db['CmContact'][_0xb00b('0x64')]();})['then'](function(_0x346eec){if(!_0x346eec){throw new db[(_0xb00b('0x79'))][(_0xb00b('0x7a'))](_0xb00b('0x7b'));}_0x1d15dd=_['difference'](_[_0xb00b('0x48')](_0x346eec),[_0xb00b('0x7c'),_0xb00b('0x7d')]);_0x565667=_['difference'](_[_0xb00b('0x48')](_0x346eec),[_0xb00b('0x7c'),_0xb00b('0x7d'),_0xb00b('0x7e'),'ListId']);_0x2268d0[_0xb00b('0x3b')]={'mapKey':_0xb00b('0x7f')};if(_0x2268d0[_0xb00b('0x3e')][_0xb00b('0x44')]){switch(_0x2268d0[_0xb00b('0x3e')][_0xb00b('0x44')]){case'twilio':_0x2268d0['body'][_0xb00b('0x80')]=_0x2c6471[_0xb00b('0x3b')][_0xb00b('0x81')];_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x3b')]=_0x2c6471['body'][_0xb00b('0x82')];_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x83')]=_0x2c6471[_0xb00b('0x3b')][_0xb00b('0x84')];break;case _0xb00b('0x85'):_0x2268d0['body'][_0xb00b('0x80')]='+'+_0x2c6471[_0xb00b('0x3b')][_0xb00b('0x86')];_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x3b')]=_0x2c6471[_0xb00b('0x3b')][_0xb00b('0x87')];break;case _0xb00b('0x88'):_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x80')]=_0x2c6471['body']['from'];_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x3b')]=_0x2c6471[_0xb00b('0x3b')]['message'];break;case'clicksend':_0x2268d0['body'][_0xb00b('0x80')]=_0x2c6471[_0xb00b('0x3b')][_0xb00b('0x80')];_0x2268d0['body'][_0xb00b('0x3b')]=_0x2c6471[_0xb00b('0x3b')][_0xb00b('0x3b')];_0x2268d0[_0xb00b('0x3b')]['messageId']=_0x2c6471[_0xb00b('0x3b')][_0xb00b('0x89')];break;case _0xb00b('0x8a'):_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x80')]=_0x2c6471[_0xb00b('0x3b')][_0xb00b('0x81')];_0x2268d0[_0xb00b('0x3b')]['body']=_0x2c6471[_0xb00b('0x3b')][_0xb00b('0x8b')];_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x83')]=_0x2c6471[_0xb00b('0x3b')][_0xb00b('0x8c')];break;case _0xb00b('0x8d'):_0x2268d0[_0xb00b('0x3b')]['from']='+'+_0x2c6471[_0xb00b('0x3b')][_0xb00b('0x8e')][0x0][_0xb00b('0x80')];_0x2268d0[_0xb00b('0x3b')]['body']=_0x2c6471[_0xb00b('0x3b')][_0xb00b('0x8e')][0x0][_0xb00b('0x87')];_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x83')]=_0x2c6471[_0xb00b('0x3b')][_0xb00b('0x8e')][0x0][_0xb00b('0x83')];break;case'csc':_0x2268d0['body'][_0xb00b('0x80')]=_0x2c6471[_0xb00b('0x3b')][_0xb00b('0x8f')];_0x2268d0['body'][_0xb00b('0x3b')]=_0x2c6471[_0xb00b('0x3b')][_0xb00b('0x90')]['message'];break;case _0xb00b('0x91'):_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x80')]=_0x2c6471['body']['fromNumber'];_0x2268d0[_0xb00b('0x3b')]['body']=_0x2c6471[_0xb00b('0x3b')]['text'];_0x2268d0['body'][_0xb00b('0x83')]=_0x2c6471[_0xb00b('0x3b')][_0xb00b('0x92')];break;case _0xb00b('0x93'):_0x2268d0[_0xb00b('0x3b')]['messageId']=_0x2c6471[_0xb00b('0x3b')][0x0]['message']['id'];_0x2268d0['body'][_0xb00b('0x80')]=_0x2c6471[_0xb00b('0x3b')][0x0][_0xb00b('0x24')][_0xb00b('0x80')];_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x3b')]=_0x2c6471['body'][0x0][_0xb00b('0x24')]['text'];break;case _0xb00b('0x94'):_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x80')]=_0x2c6471['body'][_0xb00b('0x80')];_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x3b')]=_0x2c6471[_0xb00b('0x3b')]['message'];_0x2268d0['body'][_0xb00b('0x83')]=_0x2c6471['body']['refid'];break;}}if(_0x2268d0[_0xb00b('0x3b')]['id']){delete _0x2268d0['body']['id'];}if(_['isNil'](_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x80')])){throw new db[(_0xb00b('0x79'))][(_0xb00b('0x7a'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x3b')])||_0x2268d0[_0xb00b('0x3b')]['body']===''){throw new db['Sequelize'][(_0xb00b('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2268d0[_0xb00b('0x3b')]['mapKey'])){throw new db[(_0xb00b('0x79'))]['ValidationError'](_0xb00b('0x95')+_0x565667);}if(!_['includes'](_0x565667,_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x96')])){throw new db[(_0xb00b('0x79'))]['ValidationError'](_0xb00b('0x97')+_0x565667);}_0x456a2f[_0x2268d0['body'][_0xb00b('0x96')]]=_0x2268d0[_0xb00b('0x3b')]['from'];return db['CmList']['find']({'where':{'id':_0x2268d0['account'][_0xb00b('0x98')]},'include':[{'model':db['CmContact'],'as':_0xb00b('0x99'),'where':_0x456a2f,'limit':0x1,'order':[['updatedAt',_0xb00b('0x9a')]]}]});})[_0xb00b('0x1e')](handleEntityNotFound(_0x210fc6,null))[_0xb00b('0x1e')](function(_0x44b2f1){if(_0x44b2f1){_0x2268d0[_0xb00b('0x9b')]=_['omit'](_0x44b2f1,[_0xb00b('0x99')]);if(_0x44b2f1[_0xb00b('0x99')][_0xb00b('0x59')]){return _0x44b2f1[_0xb00b('0x99')][0x0];}var _0x515143=_['defaults'](_0x2268d0[_0xb00b('0x3b')],{'firstName':_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x80')],'ListId':_0x44b2f1['id']});_0x515143[_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x96')]]=_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x80')];return db[_0xb00b('0x9c')][_0xb00b('0x5c')](_0x515143,{'fields':_0x1d15dd,'raw':!![]});}})['then'](handleEntityNotFound(_0x210fc6,null))[_0xb00b('0x1e')](function(_0x2fd7f1){if(_0x2fd7f1){_0x2268d0['contact']=_0x2fd7f1;var _0x475ebb={'ContactId':_0x2fd7f1['id'],'phone':_0x2268d0['body'][_0xb00b('0x80')],'SmsAccountId':_0x2c6471[_0xb00b('0x57')]['id']};var _0x4b5cad={'ContactId':_0x2fd7f1['id'],'SmsAccountId':_0x2c6471['params']['id'],'closed':![]};return db[_0xb00b('0x9d')][_0xb00b('0x5b')]({'where':_0x4b5cad})[_0xb00b('0x1e')](function(_0x4a5a72){if(_0x4a5a72){return[_0x4a5a72,![]];}return db[_0xb00b('0x9d')][_0xb00b('0x5c')](_0x475ebb)[_0xb00b('0x1e')](function(_0x47a0b8){return[_0x47a0b8,!![]];});});}})[_0xb00b('0x9e')](function(_0x5130a4,_0x5bf454){_0x2268d0['interaction']=_0x5130a4[_0xb00b('0x32')]({'plain':!![]});_0x2268d0['interaction'][_0xb00b('0x9f')]=![];if(_0x5bf454){if(_0x2268d0[_0xb00b('0x3e')]['autoclose']){_0x2268d0['applications'][_0xb00b('0xa0')]({'id':0x0,'priority':_0x2268d0[_0xb00b('0x75')]['length']+0x1,'app':_0xb00b('0xa1'),'appdata':_0xb00b('0xa2'),'interval':_0xb00b('0xa3')});}_0x2268d0[_0xb00b('0xa4')][_0xb00b('0x9f')]=!![];}return db[_0xb00b('0xa5')]['create']({'phone':_0x2268d0[_0xb00b('0x3b')][_0xb00b('0x80')],'messageId':_0x2268d0['body'][_0xb00b('0x83')],'body':_0x2268d0['body']['body'],'SmsAccountId':_0x2c6471[_0xb00b('0x57')]['id'],'SmsInteractionId':_0x5130a4['id'],'direction':'in','ContactId':_0x5130a4['ContactId'],'AttachmentId':_0x2268d0[_0xb00b('0x3b')][_0xb00b('0xa6')]});})[_0xb00b('0x1e')](function(_0x4b7ccc){_0x2268d0['message']=_0x4b7ccc;if(_0x2268d0['interaction'][_0xb00b('0xa7')]){return db[_0xb00b('0xa8')]['find']({'attributes':['id',_0xb00b('0x37')],'where':{'id':_0x2268d0[_0xb00b('0xa4')][_0xb00b('0xa7')]}})[_0xb00b('0x1e')](function(_0xa39d1d){if(_0xa39d1d){_0x2268d0[_0xb00b('0x75')][_0xb00b('0xa9')]({'id':0x0,'priority':0x0,'app':_0xb00b('0x3d'),'appdata':_0xa39d1d['name']+','+(_0x2268d0[_0xb00b('0x3e')][_0xb00b('0xaa')]||0xa),'interval':_0xb00b('0xa3')});}return respondWithRpcPromise('Start','startRouting',_0x2268d0);});}return respondWithRpcPromise('Start',_0xb00b('0xab'),_0x2268d0);})[_0xb00b('0x1e')](function(_0x297b7d){if(_0x297b7d){var _0x4bc6df=0xc8;var _0x399902=_0xb00b('0xac');logger[_0xb00b('0x1f')](_0xb00b('0x21'),_0x399902,_0x4bc6df,_0xb00b('0xad'));logger['debug'](_0xb00b('0xae'),_0x399902,_0x4bc6df,'entity\x20found',JSON[_0xb00b('0x22')](_0x297b7d));if(_0x2268d0[_0xb00b('0x3e')][_0xb00b('0x44')]===_0xb00b('0xaf')){return _0x210fc6[_0xb00b('0x28')](_0x4bc6df)[_0xb00b('0x2e')]('Content-Type',_0xb00b('0xb0'))[_0xb00b('0x38')](_0xb00b('0xb1'));}else{return _0x210fc6[_0xb00b('0x28')](_0x4bc6df)[_0xb00b('0x29')](_0x297b7d);}}})[_0xb00b('0x56')](handleError(_0x210fc6,null));};exports[_0xb00b('0xb2')]=function(_0x3dd732,_0xd2f1ba,_0x22d4d2){return db['SmsAccount'][_0xb00b('0x68')]({'where':{'id':_0x3dd732[_0xb00b('0x57')]['id']}})['then'](handleEntityNotFound(_0xd2f1ba,null))[_0xb00b('0x1e')](function(_0x5175c6){if(_0x5175c6){return db['sequelize']['transaction'](function(_0x384a16){return db['SmsApplication'][_0xb00b('0x34')]({'where':{'SmsAccountId':_0x3dd732[_0xb00b('0x57')]['id']},'transaction':_0x384a16})[_0xb00b('0x1e')](function(_0x1f01a5){var _0x2da26f=_[_0xb00b('0x41')](_0x3dd732[_0xb00b('0x3b')],function(_0x1388b2){_0x1388b2[_0xb00b('0x6e')]=_0x3dd732[_0xb00b('0x57')]['id'];return _0x1388b2;});return db[_0xb00b('0xb3')][_0xb00b('0xb4')](_0x2da26f,{'transaction':_0x384a16});});})[_0xb00b('0x1e')](function(){return db[_0xb00b('0xb3')]['findAndCountAll']({'where':{'SmsAccountId':_0x3dd732[_0xb00b('0x57')]['id']},'order':_0xb00b('0x77')});});}})[_0xb00b('0x1e')](respondWithResult(_0xd2f1ba,null))[_0xb00b('0x56')](handleError(_0xd2f1ba,null));};exports[_0xb00b('0xb5')]=function(_0x57a101,_0xf32d4f,_0x387744){var _0x54f5a9={};var _0x5134dd={};var _0x3c9eeb;var _0x1c14ec;return db[_0xb00b('0x42')][_0xb00b('0x68')]({'where':{'id':_0x57a101[_0xb00b('0x57')]['id']}})[_0xb00b('0x1e')](handleEntityNotFound(_0xf32d4f,null))[_0xb00b('0x1e')](function(_0x13a7f1){if(_0x13a7f1){_0x3c9eeb=_0x13a7f1;_0x5134dd[_0xb00b('0x46')]=_[_0xb00b('0x48')](db[_0xb00b('0xb3')]['rawAttributes']);_0x5134dd[_0xb00b('0x47')]=_['keys'](_0x57a101[_0xb00b('0x47')]);_0x5134dd[_0xb00b('0x49')]=_[_0xb00b('0x4a')](_0x5134dd[_0xb00b('0x46')],_0x5134dd[_0xb00b('0x47')]);_0x54f5a9[_0xb00b('0x4b')]=_['intersection'](_0x5134dd[_0xb00b('0x46')],qs[_0xb00b('0x4c')](_0x57a101[_0xb00b('0x47')][_0xb00b('0x4c')]));_0x54f5a9['attributes']=_0x54f5a9[_0xb00b('0x4b')][_0xb00b('0x59')]?_0x54f5a9['attributes']:_0x5134dd[_0xb00b('0x46')];_0x54f5a9[_0xb00b('0x69')]=qs[_0xb00b('0x4f')](_0x57a101[_0xb00b('0x47')][_0xb00b('0x4f')]);_0x54f5a9[_0xb00b('0x51')]=qs[_0xb00b('0x49')](_[_0xb00b('0x50')](_0x57a101[_0xb00b('0x47')],_0x5134dd['filters']));if(_0x57a101[_0xb00b('0x47')][_0xb00b('0x6a')]){_0x54f5a9['where']=_[_0xb00b('0x3a')](_0x54f5a9[_0xb00b('0x51')],{'$or':_[_0xb00b('0x41')](_0x54f5a9[_0xb00b('0x4b')],function(_0x97a50e){var _0x3960be={};_0x3960be[_0x97a50e]={'$like':'%'+_0x57a101[_0xb00b('0x47')][_0xb00b('0x6a')]+'%'};return _0x3960be;})});}_0x54f5a9=_[_0xb00b('0x3a')]({},_0x54f5a9,_0x57a101[_0xb00b('0x5a')]);return _0x3c9eeb[_0xb00b('0xb5')](_0x54f5a9);}})['then'](function(_0x30d346){if(_0x30d346){_0x1c14ec=_0x30d346[_0xb00b('0x59')];if(!_0x57a101[_0xb00b('0x47')]['hasOwnProperty'](_0xb00b('0x4e'))){_0x54f5a9[_0xb00b('0x2b')]=qs[_0xb00b('0x2b')](_0x57a101[_0xb00b('0x47')]['limit']);_0x54f5a9[_0xb00b('0x2a')]=qs[_0xb00b('0x2a')](_0x57a101['query']['offset']);}return _0x3c9eeb[_0xb00b('0xb5')](_0x54f5a9);}})[_0xb00b('0x1e')](function(_0x482f60){if(_0x482f60){return _0x482f60?{'count':_0x1c14ec,'rows':_0x482f60}:null;}})[_0xb00b('0x1e')](respondWithResult(_0xf32d4f,null))['catch'](handleError(_0xf32d4f,null));};exports['getInteractions']=function(_0xa55706,_0x58507b,_0x4cea67){var _0x2dd3b3={'raw':![],'where':{}};var _0x1d9a10={};var _0x37d3d1={'count':0x0,'rows':[]};return db[_0xb00b('0x42')][_0xb00b('0x68')]({'where':{'id':_0xa55706[_0xb00b('0x57')]['id']}})[_0xb00b('0x1e')](handleEntityNotFound(_0x58507b,null))[_0xb00b('0x1e')](function(_0x28929f){if(_0x28929f){_0x1d9a10[_0xb00b('0x46')]=_[_0xb00b('0x48')](db[_0xb00b('0x9d')][_0xb00b('0x43')]);_0x1d9a10[_0xb00b('0x47')]=_['keys'](_0xa55706[_0xb00b('0x47')]);_0x1d9a10[_0xb00b('0x49')]=_['intersection'](_0x1d9a10[_0xb00b('0x46')],_0x1d9a10['query']);_0x2dd3b3[_0xb00b('0x4b')]=_[_0xb00b('0x4a')](_0x1d9a10[_0xb00b('0x46')],qs['fields'](_0xa55706[_0xb00b('0x47')][_0xb00b('0x4c')]));_0x2dd3b3['attributes']=_0x2dd3b3[_0xb00b('0x4b')][_0xb00b('0x59')]?_0x2dd3b3[_0xb00b('0x4b')]:_0x1d9a10[_0xb00b('0x46')];if(!_0xa55706['query'][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x2dd3b3[_0xb00b('0x2b')]=qs['limit'](_0xa55706['query']['limit']);_0x2dd3b3[_0xb00b('0x2a')]=qs[_0xb00b('0x2a')](_0xa55706[_0xb00b('0x47')][_0xb00b('0x2a')]);}_0x2dd3b3[_0xb00b('0x69')]=qs[_0xb00b('0x4f')](_0xa55706[_0xb00b('0x47')][_0xb00b('0x4f')]);_0x2dd3b3[_0xb00b('0x51')]=qs['filters'](_['pick'](_0xa55706[_0xb00b('0x47')],_0x1d9a10[_0xb00b('0x49')]));_0x2dd3b3['where'][_0xb00b('0x6e')]=_0x28929f['id'];if(_0xa55706['query'][_0xb00b('0x6a')]){_0x2dd3b3['where']=_[_0xb00b('0x3a')](_0x2dd3b3[_0xb00b('0x51')],{'$or':_['map'](_0x2dd3b3[_0xb00b('0x4b')],function(_0x4440e0){var _0x5573c9={};_0x5573c9[_0x4440e0]={'$like':'%'+_0xa55706[_0xb00b('0x47')]['filter']+'%'};return _0x5573c9;})});}_0x2dd3b3=_[_0xb00b('0x3a')]({},_0x2dd3b3,_0xa55706[_0xb00b('0x5a')]);return db[_0xb00b('0x9d')][_0xb00b('0x2d')]({'where':_0x2dd3b3[_0xb00b('0x51')]})[_0xb00b('0x1e')](function(_0x1627b8){_0x37d3d1[_0xb00b('0x2d')]=_0x1627b8;if(_0xa55706[_0xb00b('0x47')][_0xb00b('0x52')]){_0x2dd3b3['include']=[{'model':db['CmContact'],'as':_0xb00b('0xb6'),'required':![]},{'model':db['User'],'as':_0xb00b('0xb7'),'attributes':['name',_0xb00b('0xb8'),_0xb00b('0xb9')],'required':![]},{'model':db['Tag'],'as':_0xb00b('0xba'),'attributes':['id','name',_0xb00b('0xbb')],'where':_0xa55706[_0xb00b('0x47')]['tag']?{'id':_0xa55706[_0xb00b('0x47')][_0xb00b('0xbc')]}:undefined,'required':_0xa55706[_0xb00b('0x47')][_0xb00b('0xbc')]?!![]:![]}];}return db[_0xb00b('0x9d')]['findAll'](_0x2dd3b3);})[_0xb00b('0x1e')](function(_0x1d72ba){_0x37d3d1['rows']=_0x1d72ba;return _0x37d3d1;});}})['then'](respondWithFilteredResult(_0x58507b,_0x2dd3b3))[_0xb00b('0x56')](handleError(_0x58507b,null));};exports['send']=function(_0x4b7c30,_0x5025a5,_0x25a1c9){var _0x907f05,_0x39eb7a,_0x3bb29a;if(_['isNil'](_0x4b7c30[_0xb00b('0x3b')]['body'])||_0x4b7c30[_0xb00b('0x3b')][_0xb00b('0x3b')]===''){throw new db[(_0xb00b('0x79'))][(_0xb00b('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb00b('0xbd')](_0x4b7c30[_0xb00b('0x3b')]['to'])){throw new db['Sequelize'][(_0xb00b('0x7a'))](_0xb00b('0xbe'));}_0x907f05=_0x4b7c30[_0xb00b('0x3b')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x4b7c30[_0xb00b('0x57')]['id']},'include':[{'model':db[_0xb00b('0xbf')],'as':_0xb00b('0xc0'),'include':[{'model':db[_0xb00b('0x9c')],'as':_0xb00b('0x99'),'where':{'mobile':_0x907f05},'limit':0x1,'order':[[_0xb00b('0x7d'),_0xb00b('0x9a')]]}]}]})['then'](handleEntityNotFound(_0x5025a5,null))['then'](function(_0x3343ba){if(_0x3343ba&&_0x3343ba['List']){_0x39eb7a=_0x3343ba['get']({'plain':!![]});if(_0x39eb7a[_0xb00b('0xc0')]&&_0x39eb7a[_0xb00b('0xc0')]['Contacts'][_0xb00b('0x59')]){return _0x39eb7a[_0xb00b('0xc0')][_0xb00b('0x99')][0x0];}return db['CmContact'][_0xb00b('0x5c')](_[_0xb00b('0x16')](_0x4b7c30[_0xb00b('0x3b')],{'firstName':_0x907f05,'mobile':_0x907f05,'phone':_0x907f05,'ListId':_0x39eb7a[_0xb00b('0x98')]}));}})[_0xb00b('0x1e')](handleEntityNotFound(_0x5025a5,null))[_0xb00b('0x1e')](function(_0x108f2d){if(_0x108f2d){_0x3bb29a=_0x108f2d;return db['SmsInteraction'][_0xb00b('0x5b')]({'where':{'ContactId':_0x3bb29a['id'],'closed':![],'SmsAccountId':_0x39eb7a['id']}})[_0xb00b('0x1e')](function(_0x5252d3){if(_0x5252d3){return[_0x5252d3,![]];}return db['SmsInteraction']['create']({'UserId':_0x4b7c30[_0xb00b('0x5d')]['id'],'ContactId':_0x3bb29a['id'],'SmsAccountId':_0x39eb7a['id'],'phone':_0x907f05,'firstMsgDirection':_0xb00b('0xc1'),'Messages':[_[_0xb00b('0x3a')](_0x4b7c30[_0xb00b('0x3b')],{'read':![],'body':_0x4b7c30[_0xb00b('0x3b')][_0xb00b('0x3b')],'phone':_0x907f05,'SmsAccountId':_0x39eb7a['id'],'UserId':_0x4b7c30[_0xb00b('0x5d')]['id'],'ContactId':_0x3bb29a['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0xb00b('0x1e')](function(_0x19d624){return[_0x19d624,!![]];});});}})['spread'](function(_0x3517d6,_0x185fc5){if(_0x185fc5){return _0x3517d6;}return db['SmsMessage'][_0xb00b('0x5c')](_['merge'](_0x4b7c30[_0xb00b('0x3b')],{'read':![],'body':_0x4b7c30['body']['body'],'phone':_0x907f05,'SmsAccountId':_0x39eb7a['id'],'SmsInteractionId':_0x3517d6['id'],'UserId':_0x4b7c30['user']['id'],'ContactId':_0x3bb29a['id']}))[_0xb00b('0x1e')](function(_0x230223){_0x3517d6[_0xb00b('0xc2')][_0xb00b('0xc3')]=[];_0x3517d6['dataValues'][_0xb00b('0xc3')][_0xb00b('0xa0')](_0x230223[_0xb00b('0xc2')]);return _0x3517d6;});})[_0xb00b('0x1e')](respondWithResult(_0x5025a5,null))[_0xb00b('0x56')](handleError(_0x5025a5,null));};exports[_0xb00b('0x28')]=function(_0x1cc9fb,_0x259acf,_0x1ab6ae){if(_0x1cc9fb[_0xb00b('0x3b')]['id']){delete _0x1cc9fb['body']['id'];}var _0x5448bb,_0x3fe113,_0x177508;return db[_0xb00b('0x42')][_0xb00b('0x5b')]({'where':{'id':_0x1cc9fb[_0xb00b('0x57')]['id']}})[_0xb00b('0x1e')](handleEntityNotFound(_0x259acf,null))[_0xb00b('0x1e')](function(_0x3f2e40){if(_0x3f2e40){_0x177508=_0x3f2e40;logger[_0xb00b('0xc4')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb00b('0x28'),_0xb00b('0xc5'),_0x3f2e40[_0xb00b('0x44')],util[_0xb00b('0xc6')](_0x1cc9fb['body'],{'showHidden':![],'depth':null}));switch(_0x3f2e40[_0xb00b('0x44')]){case _0xb00b('0x85'):if(_0x1cc9fb[_0xb00b('0x3b')][_0xb00b('0xc7')]&&_0x1cc9fb[_0xb00b('0x3b')][_0xb00b('0x28')]){_0x3fe113=_0x1cc9fb[_0xb00b('0x3b')][_0xb00b('0x28')];return db[_0xb00b('0xa5')]['find']({'where':{'messageId':_0x1cc9fb['body'][_0xb00b('0xc7')]}});}break;case _0xb00b('0x88'):if(_0x1cc9fb[_0xb00b('0x3b')][_0xb00b('0xc8')]&&_0x1cc9fb[_0xb00b('0x3b')][_0xb00b('0xc9')]){_0x3fe113=_0x1cc9fb[_0xb00b('0x3b')]['statusInt'];return db[_0xb00b('0xa5')][_0xb00b('0x5b')]({'where':{'messageId':_0x1cc9fb[_0xb00b('0x3b')][_0xb00b('0xc8')]}});}break;case _0xb00b('0xca'):if(_0x1cc9fb[_0xb00b('0x3b')]['message_id']&&_0x1cc9fb[_0xb00b('0x3b')][_0xb00b('0xcb')]){_0x3fe113=_0x1cc9fb['body'][_0xb00b('0xcb')];return db[_0xb00b('0xa5')][_0xb00b('0x5b')]({'where':{'messageId':_0x1cc9fb[_0xb00b('0x3b')][_0xb00b('0x89')]}});}break;case _0xb00b('0x8d'):var _0x4a32d8=_0x1cc9fb['body'][_0xb00b('0x8e')][0x0];if(_0x4a32d8['messageId']&&_0x4a32d8['status']['groupName']===_0xb00b('0xcc')){_0x3fe113=_0x4a32d8[_0xb00b('0x28')]['groupName'];return db['SmsMessage'][_0xb00b('0x5b')]({'where':{'messageId':_0x4a32d8[_0xb00b('0x83')]}});}break;case _0xb00b('0x91'):if(_0x1cc9fb[_0xb00b('0x3b')][_0xb00b('0x83')]&&_0x1cc9fb[_0xb00b('0x3b')][_0xb00b('0x28')]){_0x3fe113=_0x1cc9fb[_0xb00b('0x3b')][_0xb00b('0x28')];return db[_0xb00b('0xa5')][_0xb00b('0x5b')]({'where':{'messageId':_0x1cc9fb['body'][_0xb00b('0x83')]}});}break;case _0xb00b('0x93'):if(_0x1cc9fb[_0xb00b('0x3b')][0x0][_0xb00b('0x24')]['id']){_0x3fe113=_0x1cc9fb[_0xb00b('0x3b')][0x0][_0xb00b('0x44')];return db['SmsMessage'][_0xb00b('0x5b')]({'where':{'messageId':_0x1cc9fb[_0xb00b('0x3b')][0x0][_0xb00b('0x24')]['id']}});}break;case _0xb00b('0x94'):if(_0x1cc9fb['body']['redif']&&_0x1cc9fb[_0xb00b('0x3b')][_0xb00b('0x28')]){_0x3fe113=_0x1cc9fb[_0xb00b('0x3b')][_0xb00b('0x28')];return db[_0xb00b('0xa5')][_0xb00b('0x5b')]({'where':{'messageId':_0x1cc9fb[_0xb00b('0x3b')][_0xb00b('0xcd')]}});}break;}}})[_0xb00b('0x1e')](handleEntityNotFound(_0x259acf,null))[_0xb00b('0x1e')](function(_0x41550f){if(_0x41550f){_0x5448bb=_0x41550f;switch(_0x177508['type']){case _0xb00b('0x85'):if(_0x3fe113===_0xb00b('0xcc')){return _0x5448bb[_0xb00b('0x31')]({'read':!![]});}else{logger[_0xb00b('0x23')](_0xb00b('0x21'),_0xb00b('0x28'),_0xb00b('0x85'),util[_0xb00b('0xc6')](_0x1cc9fb['body'],{'showHidden':![],'depth':null}));}break;case _0xb00b('0x88'):if(_0x3fe113==='1'){return _0x5448bb[_0xb00b('0x31')]({'read':!![]});}else{logger[_0xb00b('0x23')](_0xb00b('0x21'),'status','skebby',util['inspect'](_0x1cc9fb[_0xb00b('0x3b')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x1cc9fb[_0xb00b('0x3b')][_0xb00b('0xce')]&&_0x3fe113>=0xc8&&_0x3fe113<=0xce){return _0x5448bb[_0xb00b('0x31')]({'read':!![]});}else{logger[_0xb00b('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xb00b('0xca'),util['inspect'](_0x1cc9fb['body'],{'showHidden':![],'depth':null}));}break;case _0xb00b('0x8d'):var _0x4ad4d3=_0x1cc9fb[_0xb00b('0x3b')][_0xb00b('0x8e')][0x0];if(_0x4ad4d3[_0xb00b('0x28')][_0xb00b('0xcf')]==='DELIVERED'){return _0x5448bb[_0xb00b('0x31')]({'read':!![]});}else{logger[_0xb00b('0x23')](_0xb00b('0x21'),_0xb00b('0x28'),_0xb00b('0x8d'),util['inspect'](_0x1cc9fb['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x3fe113==_0xb00b('0xd0')||_0x3fe113==_0xb00b('0xd1')){return _0x5448bb['update']({'read':!![]});}else{logger[_0xb00b('0x23')](_0xb00b('0x21'),_0xb00b('0x28'),_0xb00b('0x91'),util['inspect'](_0x1cc9fb[_0xb00b('0x3b')],{'showHidden':![],'depth':null}));}break;case _0xb00b('0x93'):if(_0x3fe113==_0xb00b('0xd2')){return _0x5448bb[_0xb00b('0x31')]({'read':!![]});}else{logger['error'](_0xb00b('0x21'),'status',_0xb00b('0x93'),util[_0xb00b('0xc6')](_0x1cc9fb[_0xb00b('0x3b')],{'showHidden':![],'depth':null}));}break;case _0xb00b('0x94'):if(_0x3fe113===_0xb00b('0xd3')||_0x3fe113===_0xb00b('0xd4')){return _0x5448bb[_0xb00b('0x31')]({'read':!![]});}else{logger[_0xb00b('0x23')](_0xb00b('0x21'),_0xb00b('0x28'),_0xb00b('0x94'),util[_0xb00b('0xc6')](_0x1cc9fb[_0xb00b('0x3b')],{'showHidden':![],'depth':null}));}break;}return _0x5448bb;}})[_0xb00b('0x1e')](respondWithResult(_0x259acf,null))[_0xb00b('0x56')](handleError(_0x259acf,null));};exports[_0xb00b('0xd5')]=function(_0x4081d8,_0x4d847e,_0x241095){var _0xd37f4a,_0x6c05ec,_0x120540;return db[_0xb00b('0x42')]['find']({'where':{'id':_0x4081d8[_0xb00b('0x57')]['id']}})[_0xb00b('0x1e')](handleEntityNotFound(_0x4d847e,null))[_0xb00b('0x1e')](function(_0x2247a3){if(_0x2247a3){_0x120540=_0x2247a3;logger[_0xb00b('0xc4')](_0xb00b('0x21'),_0xb00b('0x28'),'received\x20delivery\x20report\x20from',_0x2247a3[_0xb00b('0x44')],util['inspect'](_0x4081d8[_0xb00b('0x47')],{'showHidden':![],'depth':null}));switch(_0x2247a3[_0xb00b('0x44')]){case _0xb00b('0xd6'):if(_0x4081d8['query'][_0xb00b('0xd7')]&&_0x4081d8[_0xb00b('0x47')][_0xb00b('0xd8')]){_0x6c05ec=_0x4081d8[_0xb00b('0x47')]['state'];return db['SmsMessage'][_0xb00b('0x5b')]({'where':{'messageId':_0x4081d8[_0xb00b('0x47')]['message-id']}});}break;}}})[_0xb00b('0x1e')](handleEntityNotFound(_0x4d847e,null))[_0xb00b('0x1e')](function(_0x228d38){if(_0x228d38){_0xd37f4a=_0x228d38;switch(_0x120540[_0xb00b('0x44')]){case'csc':if(_0x6c05ec==='2'||_0x6c05ec==='6'){return _0xd37f4a['update']({'read':!![]});}else{logger[_0xb00b('0x23')](_0xb00b('0x21'),_0xb00b('0x28'),_0xb00b('0xd6'),util[_0xb00b('0xc6')](_0x4081d8[_0xb00b('0x47')],{'showHidden':![],'depth':null}));};break;}return _0xd37f4a;}})[_0xb00b('0x1e')](respondWithResult(_0x4d847e,null))[_0xb00b('0x56')](handleError(_0x4d847e,null));};exports['addAgents']=function(_0x2e0efe,_0xa5b637,_0xc3f8a9){return db[_0xb00b('0x42')][_0xb00b('0x5b')]({'where':{'id':_0x2e0efe[_0xb00b('0x57')]['id']}})[_0xb00b('0x1e')](handleEntityNotFound(_0xa5b637,null))['then'](function(_0x39e6f8){if(_0x39e6f8){return _0x39e6f8[_0xb00b('0xd9')](_0x2e0efe[_0xb00b('0x3b')][_0xb00b('0x6c')],_[_0xb00b('0xda')](_0x2e0efe[_0xb00b('0x3b')],[_0xb00b('0x6c'),'id'])||{})[_0xb00b('0x9e')](function(_0xddea8c){for(var _0x395a98=0x0;_0x395a98<_0x2e0efe[_0xb00b('0x3b')]['ids'][_0xb00b('0x59')];_0x395a98+=0x1){socket[_0xb00b('0xdb')](_0xb00b('0xdc'),{'UserId':_0x2e0efe[_0xb00b('0x3b')][_0xb00b('0x6c')][_0x395a98],'SmsAccountId':_0x2e0efe[_0xb00b('0x57')]['id']});}return _0xddea8c;});}})['then'](respondWithResult(_0xa5b637,null))[_0xb00b('0x56')](handleError(_0xa5b637,null));};exports[_0xb00b('0xdd')]=function(_0x12d7c9,_0x4ffe41,_0x4d10fd){return db[_0xb00b('0x42')]['find']({'where':{'id':_0x12d7c9[_0xb00b('0x57')]['id']}})[_0xb00b('0x1e')](handleEntityNotFound(_0x4ffe41,null))['then'](function(_0x470b36){if(_0x470b36){return _0x470b36['removeAgents'](_0x12d7c9['query'][_0xb00b('0x6c')])['then'](function(){if(_[_0xb00b('0xde')](_0x12d7c9[_0xb00b('0x47')][_0xb00b('0x6c')])){for(var _0x564934=0x0;_0x564934<_0x12d7c9[_0xb00b('0x47')][_0xb00b('0x6c')][_0xb00b('0x59')];_0x564934+=0x1){socket[_0xb00b('0xdb')](_0xb00b('0xdf'),{'UserId':Number(_0x12d7c9[_0xb00b('0x47')][_0xb00b('0x6c')][_0x564934]),'SmsAccountId':Number(_0x12d7c9['params']['id'])});}}else{socket[_0xb00b('0xdb')]('userSmsAccount:remove',{'UserId':Number(_0x12d7c9[_0xb00b('0x47')][_0xb00b('0x6c')]),'SmsAccountId':Number(_0x12d7c9[_0xb00b('0x57')]['id'])});}});}})[_0xb00b('0x1e')](respondWithStatusCode(_0x4ffe41,null))['catch'](handleError(_0x4ffe41,null));};exports[_0xb00b('0xe0')]=function(_0x294c19,_0x23934c,_0x4689fd){var _0x7ba612={};var _0x278529={};var _0x5ed8a8;var _0xf12d43;return db[_0xb00b('0x42')]['findOne']({'where':{'id':_0x294c19[_0xb00b('0x57')]['id']}})[_0xb00b('0x1e')](handleEntityNotFound(_0x23934c,null))[_0xb00b('0x1e')](function(_0xc63482){if(_0xc63482){_0x5ed8a8=_0xc63482;_0x278529[_0xb00b('0x46')]=_[_0xb00b('0x48')](db[_0xb00b('0xa8')][_0xb00b('0x43')]);_0x278529[_0xb00b('0x47')]=_[_0xb00b('0x48')](_0x294c19[_0xb00b('0x47')]);_0x278529[_0xb00b('0x49')]=_[_0xb00b('0x4a')](_0x278529[_0xb00b('0x46')],_0x278529['query']);_0x7ba612['attributes']=_['intersection'](_0x278529[_0xb00b('0x46')],qs[_0xb00b('0x4c')](_0x294c19[_0xb00b('0x47')]['fields']));_0x7ba612[_0xb00b('0x4b')]=_0x7ba612[_0xb00b('0x4b')][_0xb00b('0x59')]?_0x7ba612[_0xb00b('0x4b')]:_0x278529[_0xb00b('0x46')];_0x7ba612['order']=qs[_0xb00b('0x4f')](_0x294c19['query']['sort']);_0x7ba612['where']=qs[_0xb00b('0x49')](_[_0xb00b('0x50')](_0x294c19['query'],_0x278529[_0xb00b('0x49')]));if(_0x294c19[_0xb00b('0x47')][_0xb00b('0x6a')]){_0x7ba612['where']=_[_0xb00b('0x3a')](_0x7ba612['where'],{'$or':_[_0xb00b('0x41')](_0x7ba612[_0xb00b('0x4b')],function(_0x2e3e5a){var _0x44d055={};_0x44d055[_0x2e3e5a]={'$like':'%'+_0x294c19['query']['filter']+'%'};return _0x44d055;})});}_0x7ba612=_[_0xb00b('0x3a')]({},_0x7ba612,_0x294c19[_0xb00b('0x5a')]);return _0x5ed8a8[_0xb00b('0xe0')](_0x7ba612);}})[_0xb00b('0x1e')](function(_0x3ec6c4){if(_0x3ec6c4){_0xf12d43=_0x3ec6c4[_0xb00b('0x59')];if(!_0x294c19['query'][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x7ba612[_0xb00b('0x2b')]=qs[_0xb00b('0x2b')](_0x294c19['query'][_0xb00b('0x2b')]);_0x7ba612[_0xb00b('0x2a')]=qs[_0xb00b('0x2a')](_0x294c19[_0xb00b('0x47')][_0xb00b('0x2a')]);}return _0x5ed8a8[_0xb00b('0xe0')](_0x7ba612);}})[_0xb00b('0x1e')](function(_0x333bee){if(_0x333bee){return _0x333bee?{'count':_0xf12d43,'rows':_0x333bee}:null;}})['then'](respondWithResult(_0x23934c,null))[_0xb00b('0x56')](handleError(_0x23934c,null));}; \ No newline at end of file +var _0xc6d8=['squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','then','info','debug','request\x20sent','stringify','error','code','message','result','SmsAccount,\x20%s,\x20%s','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','render','body','contact','agent','interaction','account','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','key','model','query','filters','intersection','attributes','length','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','keys','fields','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','applications','priority','asc','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','connectel','clicksend','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','bandwidth','intelepeer','refid','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','CmContact','Contacts','spread','created','autoclose','push','close','*,*,*,*','SmsMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','Start','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','SmsInteraction','Owner','fullname','internal','Tag','Tags','color','tag','DESC','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','infobip','groupName','redif','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','error_code','DELIVERED_TO_GATEWAY','ACCEPTD','statusGet','message-id','state','omit','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x206f4b,_0x346117){var _0x20599c=function(_0x2f15b3){while(--_0x2f15b3){_0x206f4b['push'](_0x206f4b['shift']());}};_0x20599c(++_0x346117);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x21bef5,_0x27b94a){_0x21bef5=_0x21bef5-0x0;var _0x524300=_0xc6d8[_0x21bef5];return _0x524300;};'use strict';var emlformat=require(_0x8c6d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c6d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c6d('0x2'));var moment=require('moment');var BPromise=require(_0x8c6d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8c6d('0x4'));var sox=require(_0x8c6d('0x5'));var csv=require(_0x8c6d('0x6'));var ejs=require(_0x8c6d('0x7'));var fs=require('fs');var fs_extra=require(_0x8c6d('0x8'));var _=require(_0x8c6d('0x9'));var squel=require(_0x8c6d('0xa'));var crypto=require('crypto');var jsforce=require(_0x8c6d('0xb'));var deskjs=require(_0x8c6d('0xc'));var toCsv=require(_0x8c6d('0x6'));var querystring=require('querystring');var Papa=require(_0x8c6d('0xd'));var Redis=require(_0x8c6d('0xe'));var authService=require(_0x8c6d('0xf'));var qs=require(_0x8c6d('0x10'));var as=require(_0x8c6d('0x11'));var hardwareService=require(_0x8c6d('0x12'));var logger=require(_0x8c6d('0x13'))(_0x8c6d('0x14'));var utils=require('../../config/utils');var config=require(_0x8c6d('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8c6d('0x16')]=_[_0x8c6d('0x17')](config[_0x8c6d('0x16')],{'host':_0x8c6d('0x18'),'port':0x18eb});var socket=require(_0x8c6d('0x19'))(new Redis(config[_0x8c6d('0x16')]));require(_0x8c6d('0x1a'))[_0x8c6d('0x1b')](socket);var jayson=require(_0x8c6d('0x1c'));var client=jayson[_0x8c6d('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x16c6b5,_0x4b2bb1,_0x16af06,_0x4dd4b6){return new BPromise(function(_0x150a16,_0x3d95a6){var _0x52ed7b=_0x4dd4b6||client;return _0x52ed7b[_0x8c6d('0x1e')](_0x16c6b5,_0x16af06)[_0x8c6d('0x1f')](function(_0x51a5fa){logger[_0x8c6d('0x20')]('SmsAccount,\x20%s,\x20%s',_0x4b2bb1,'request\x20sent');logger[_0x8c6d('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4b2bb1,_0x8c6d('0x22'),JSON[_0x8c6d('0x23')](_0x51a5fa));if(_0x51a5fa[_0x8c6d('0x24')]){if(_0x51a5fa[_0x8c6d('0x24')][_0x8c6d('0x25')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x4b2bb1,_0x51a5fa['error'][_0x8c6d('0x26')]);return _0x3d95a6(_0x51a5fa['error'][_0x8c6d('0x26')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x4b2bb1,_0x51a5fa[_0x8c6d('0x24')][_0x8c6d('0x26')]);return _0x150a16(_0x51a5fa['error']['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x4b2bb1,_0x8c6d('0x22'));_0x150a16(_0x51a5fa[_0x8c6d('0x27')][_0x8c6d('0x26')]);}})['catch'](function(_0x41c904){logger['error'](_0x8c6d('0x28'),_0x4b2bb1,_0x41c904);_0x3d95a6(_0x41c904);});});}function respondWithStatusCode(_0x490b46,_0x23c893){_0x23c893=_0x23c893||0xcc;return function(_0xba50cf){if(_0xba50cf){return _0x490b46[_0x8c6d('0x29')](_0x23c893);}return _0x490b46[_0x8c6d('0x2a')](_0x23c893)[_0x8c6d('0x2b')]();};}function respondWithResult(_0x3e3cd3,_0x9c269d){_0x9c269d=_0x9c269d||0xc8;return function(_0x41957d){if(_0x41957d){return _0x3e3cd3[_0x8c6d('0x2a')](_0x9c269d)['json'](_0x41957d);}};}function respondWithFilteredResult(_0x544143,_0x342d8e){return function(_0x93a094){if(_0x93a094){var _0xfc6000=typeof _0x342d8e[_0x8c6d('0x2c')]===_0x8c6d('0x2d')&&typeof _0x342d8e[_0x8c6d('0x2e')]===_0x8c6d('0x2d');var _0x2d028f=_0x93a094[_0x8c6d('0x2f')];var _0x43d70c=_0xfc6000?0x0:_0x342d8e[_0x8c6d('0x2c')];var _0x15a508=_0xfc6000?_0x93a094['count']:_0x342d8e[_0x8c6d('0x2c')]+_0x342d8e[_0x8c6d('0x2e')];var _0x373839;if(_0x15a508>=_0x2d028f){_0x15a508=_0x2d028f;_0x373839=0xc8;}else{_0x373839=0xce;}_0x544143[_0x8c6d('0x2a')](_0x373839);return _0x544143[_0x8c6d('0x30')](_0x8c6d('0x31'),_0x43d70c+'-'+_0x15a508+'/'+_0x2d028f)[_0x8c6d('0x32')](_0x93a094);}return null;};}function patchUpdates(_0x1857f9){return function(_0x247448){try{jsonpatch['apply'](_0x247448,_0x1857f9,!![]);}catch(_0x46d443){return BPromise['reject'](_0x46d443);}return _0x247448[_0x8c6d('0x33')]();};}function saveUpdates(_0x71f0ed,_0xa81460){return function(_0x331573){if(_0x331573){return _0x331573[_0x8c6d('0x34')](_0x71f0ed)[_0x8c6d('0x1f')](function(_0x57d419){return _0x57d419;});}return null;};}function removeEntity(_0x5ae56b,_0x3731ab){return function(_0x2b7ca7){if(_0x2b7ca7){return _0x2b7ca7[_0x8c6d('0x35')]()[_0x8c6d('0x1f')](function(){var _0x5638f4=_0x2b7ca7[_0x8c6d('0x36')]({'plain':!![]});var _0x466f37=_0x8c6d('0x37');return db[_0x8c6d('0x38')][_0x8c6d('0x35')]({'where':{'type':_0x466f37,'resourceId':_0x5638f4['id']}})[_0x8c6d('0x1f')](function(){return _0x2b7ca7;});})['then'](function(){_0x5ae56b[_0x8c6d('0x2a')](0xcc)[_0x8c6d('0x2b')]();});}};}function handleEntityNotFound(_0x1349be,_0x2ef932){return function(_0xff4b5b){if(!_0xff4b5b){_0x1349be[_0x8c6d('0x29')](0x194);}return _0xff4b5b;};}function handleError(_0x40f3a5,_0x301332){_0x301332=_0x301332||0x1f4;return function(_0x24200c){logger[_0x8c6d('0x24')](_0x24200c[_0x8c6d('0x39')]);if(_0x24200c[_0x8c6d('0x3a')]){delete _0x24200c['name'];}_0x40f3a5[_0x8c6d('0x2a')](_0x301332)[_0x8c6d('0x3b')](_0x24200c);};}function getMustacheRender(_0x812b7d,_0x454e96){return Mustache[_0x8c6d('0x3c')](_0x812b7d,_['merge'](_0x454e96[_0x8c6d('0x3d')],{'contact':_0x454e96[_0x8c6d('0x3e')],'message':_0x454e96['message'],'agent':_0x454e96[_0x8c6d('0x3f')],'interaction':_0x454e96[_0x8c6d('0x40')],'account':_0x454e96[_0x8c6d('0x41')]}))||'';}exports['index']=function(_0x954bac,_0xb7293d){var _0x27d6f5={'include':[{'model':db[_0x8c6d('0x42')],'as':_0x8c6d('0x43')}]},_0xdfb751={},_0x2f54a2={'count':0x0,'rows':[]};var _0x2bbf60=_[_0x8c6d('0x44')](db[_0x8c6d('0x45')][_0x8c6d('0x46')],function(_0x4e5c39){return{'name':_0x4e5c39['fieldName'],'type':_0x4e5c39['type'][_0x8c6d('0x47')]};});_0xdfb751[_0x8c6d('0x48')]=_[_0x8c6d('0x44')](_0x2bbf60,_0x8c6d('0x3a'));_0xdfb751[_0x8c6d('0x49')]=_['keys'](_0x954bac[_0x8c6d('0x49')]);_0xdfb751[_0x8c6d('0x4a')]=_[_0x8c6d('0x4b')](_0xdfb751['model'],_0xdfb751[_0x8c6d('0x49')]);_0x27d6f5[_0x8c6d('0x4c')]=_['intersection'](_0xdfb751['model'],qs['fields'](_0x954bac['query']['fields']));_0x27d6f5[_0x8c6d('0x4c')]=_0x27d6f5[_0x8c6d('0x4c')][_0x8c6d('0x4d')]?_0x27d6f5[_0x8c6d('0x4c')]:_0xdfb751[_0x8c6d('0x48')];if(!_0x954bac['query']['hasOwnProperty']('nolimit')){_0x27d6f5['limit']=qs[_0x8c6d('0x2e')](_0x954bac['query'][_0x8c6d('0x2e')]);_0x27d6f5[_0x8c6d('0x2c')]=qs[_0x8c6d('0x2c')](_0x954bac[_0x8c6d('0x49')][_0x8c6d('0x2c')]);}_0x27d6f5[_0x8c6d('0x4e')]=qs['sort'](_0x954bac[_0x8c6d('0x49')][_0x8c6d('0x4f')]);_0x27d6f5['where']=qs[_0x8c6d('0x4a')](_[_0x8c6d('0x50')](_0x954bac['query'],_0xdfb751[_0x8c6d('0x4a')]),_0x2bbf60);if(_0x954bac[_0x8c6d('0x49')][_0x8c6d('0x51')]){_0x27d6f5[_0x8c6d('0x52')]=_[_0x8c6d('0x53')](_0x27d6f5[_0x8c6d('0x52')],{'$or':_[_0x8c6d('0x44')](_0x2bbf60,function(_0x17eb0f){if(_0x17eb0f[_0x8c6d('0x54')]!==_0x8c6d('0x55')){var _0x361956={};_0x361956[_0x17eb0f[_0x8c6d('0x3a')]]={'$like':'%'+_0x954bac[_0x8c6d('0x49')][_0x8c6d('0x51')]+'%'};return _0x361956;}})});}_0x27d6f5=_[_0x8c6d('0x53')]({},_0x27d6f5,_0x954bac[_0x8c6d('0x56')]);var _0x48ceb8={'where':_0x27d6f5['where']};return db['SmsAccount'][_0x8c6d('0x2f')](_0x48ceb8)[_0x8c6d('0x1f')](function(_0x4919b8){_0x2f54a2[_0x8c6d('0x2f')]=_0x4919b8;if(_0x954bac['query'][_0x8c6d('0x57')]){_0x27d6f5['include']=[{'all':!![]}];}return db[_0x8c6d('0x45')][_0x8c6d('0x58')](_0x27d6f5);})[_0x8c6d('0x1f')](function(_0x5e2dbb){_0x2f54a2[_0x8c6d('0x59')]=_0x5e2dbb;return _0x2f54a2;})['then'](respondWithFilteredResult(_0xb7293d,_0x27d6f5))[_0x8c6d('0x5a')](handleError(_0xb7293d,null));};exports['show']=function(_0xcbcc60,_0x21597a){var _0x2e22cc={'raw':![],'where':{'id':_0xcbcc60['params']['id']},'include':[{'model':db[_0x8c6d('0x42')],'as':_0x8c6d('0x43')}]},_0x334a29={};_0x334a29[_0x8c6d('0x48')]=_[_0x8c6d('0x5b')](db[_0x8c6d('0x45')][_0x8c6d('0x46')]);_0x334a29[_0x8c6d('0x49')]=_[_0x8c6d('0x5b')](_0xcbcc60['query']);_0x334a29[_0x8c6d('0x4a')]=_[_0x8c6d('0x4b')](_0x334a29[_0x8c6d('0x48')],_0x334a29[_0x8c6d('0x49')]);_0x2e22cc['attributes']=_[_0x8c6d('0x4b')](_0x334a29['model'],qs['fields'](_0xcbcc60[_0x8c6d('0x49')][_0x8c6d('0x5c')]));_0x2e22cc[_0x8c6d('0x4c')]=_0x2e22cc[_0x8c6d('0x4c')][_0x8c6d('0x4d')]?_0x2e22cc[_0x8c6d('0x4c')]:_0x334a29[_0x8c6d('0x48')];if(_0xcbcc60['query'][_0x8c6d('0x57')]){_0x2e22cc[_0x8c6d('0x5d')]=[{'all':!![]}];}_0x2e22cc=_[_0x8c6d('0x53')]({},_0x2e22cc,_0xcbcc60['options']);return db[_0x8c6d('0x45')][_0x8c6d('0x5e')](_0x2e22cc)[_0x8c6d('0x1f')](handleEntityNotFound(_0x21597a,null))[_0x8c6d('0x1f')](respondWithResult(_0x21597a,null))[_0x8c6d('0x5a')](handleError(_0x21597a,null));};exports['create']=function(_0x2da745,_0x3ad843){return db['SmsAccount'][_0x8c6d('0x5f')](_0x2da745['body'],{})[_0x8c6d('0x1f')](function(_0x4c4b61){var _0x5b6e78=_0x2da745[_0x8c6d('0x60')][_0x8c6d('0x36')]({'plain':!![]});if(!_0x5b6e78)throw new Error(_0x8c6d('0x61'));if(_0x5b6e78[_0x8c6d('0x62')]===_0x8c6d('0x60')){var _0x3090a9=_0x4c4b61[_0x8c6d('0x36')]({'plain':!![]});var _0x1c37ac=_0x8c6d('0x37');return db[_0x8c6d('0x63')][_0x8c6d('0x5e')]({'where':{'name':_0x1c37ac,'userProfileId':_0x5b6e78['userProfileId']},'raw':!![]})[_0x8c6d('0x1f')](function(_0x3d5523){if(_0x3d5523&&_0x3d5523[_0x8c6d('0x64')]===0x0){return db['UserProfileResource'][_0x8c6d('0x5f')]({'name':_0x3090a9[_0x8c6d('0x3a')],'resourceId':_0x3090a9['id'],'type':_0x3d5523[_0x8c6d('0x3a')],'sectionId':_0x3d5523['id']},{})['then'](function(){return _0x4c4b61;});}else{return _0x4c4b61;}})[_0x8c6d('0x5a')](function(_0x55d88b){logger[_0x8c6d('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55d88b);throw _0x55d88b;});}return _0x4c4b61;})['then'](respondWithResult(_0x3ad843,0xc9))[_0x8c6d('0x5a')](handleError(_0x3ad843,null));};exports[_0x8c6d('0x34')]=function(_0x56f801,_0x59d43d){if(_0x56f801['body']['id']){delete _0x56f801[_0x8c6d('0x3d')]['id'];}return db[_0x8c6d('0x45')][_0x8c6d('0x5e')]({'where':{'id':_0x56f801[_0x8c6d('0x65')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x8c6d('0x1f')](handleEntityNotFound(_0x59d43d,null))[_0x8c6d('0x1f')](saveUpdates(_0x56f801[_0x8c6d('0x3d')],null))[_0x8c6d('0x1f')](respondWithResult(_0x59d43d,null))[_0x8c6d('0x5a')](handleError(_0x59d43d,null));};exports[_0x8c6d('0x35')]=function(_0x2d3dd3,_0x3c6a3c){return db['SmsAccount'][_0x8c6d('0x5e')]({'where':{'id':_0x2d3dd3[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x3c6a3c,null))[_0x8c6d('0x1f')](removeEntity(_0x3c6a3c,null))['catch'](handleError(_0x3c6a3c,null));};exports[_0x8c6d('0x66')]=function(_0x55f8c4,_0x48b59e){return db[_0x8c6d('0x45')][_0x8c6d('0x66')]()[_0x8c6d('0x1f')](respondWithResult(_0x48b59e,null))['catch'](handleError(_0x48b59e,null));};exports[_0x8c6d('0x67')]=function(_0x51fc61,_0x4861ec,_0x2b3b5c){if(_0x51fc61[_0x8c6d('0x3d')]['id']){delete _0x51fc61[_0x8c6d('0x3d')]['id'];}return db[_0x8c6d('0x45')][_0x8c6d('0x5e')]({'where':{'id':_0x51fc61['params']['id']}})['then'](handleEntityNotFound(_0x4861ec,null))[_0x8c6d('0x1f')](function(_0x2fedab){if(_0x2fedab){_0x51fc61[_0x8c6d('0x3d')][_0x8c6d('0x68')]=_0x2fedab['id'];return db[_0x8c6d('0x69')][_0x8c6d('0x5f')](_0x51fc61[_0x8c6d('0x3d')]);}})['then'](respondWithResult(_0x4861ec,null))[_0x8c6d('0x5a')](handleError(_0x4861ec,null));};exports[_0x8c6d('0x6a')]=function(_0x1e33f7,_0x19f19d,_0x94b152){var _0x471ca0={'raw':![],'where':{}};var _0x1df6e0={};var _0x535f19={'count':0x0,'rows':[]};return db[_0x8c6d('0x45')][_0x8c6d('0x6b')]({'where':{'id':_0x1e33f7[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x19f19d,null))['then'](function(_0x92732){if(_0x92732){_0x1df6e0[_0x8c6d('0x48')]=_[_0x8c6d('0x5b')](db[_0x8c6d('0x69')]['rawAttributes']);_0x1df6e0[_0x8c6d('0x49')]=_[_0x8c6d('0x5b')](_0x1e33f7['query']);_0x1df6e0[_0x8c6d('0x4a')]=_[_0x8c6d('0x4b')](_0x1df6e0['model'],_0x1df6e0[_0x8c6d('0x49')]);_0x471ca0[_0x8c6d('0x4c')]=_[_0x8c6d('0x4b')](_0x1df6e0[_0x8c6d('0x48')],qs[_0x8c6d('0x5c')](_0x1e33f7[_0x8c6d('0x49')][_0x8c6d('0x5c')]));_0x471ca0[_0x8c6d('0x4c')]=_0x471ca0[_0x8c6d('0x4c')][_0x8c6d('0x4d')]?_0x471ca0[_0x8c6d('0x4c')]:_0x1df6e0[_0x8c6d('0x48')];if(!_0x1e33f7[_0x8c6d('0x49')][_0x8c6d('0x6c')](_0x8c6d('0x6d'))){_0x471ca0[_0x8c6d('0x2e')]=qs[_0x8c6d('0x2e')](_0x1e33f7['query'][_0x8c6d('0x2e')]);_0x471ca0[_0x8c6d('0x2c')]=qs[_0x8c6d('0x2c')](_0x1e33f7[_0x8c6d('0x49')][_0x8c6d('0x2c')]);}_0x471ca0[_0x8c6d('0x4e')]=qs[_0x8c6d('0x4f')](_0x1e33f7[_0x8c6d('0x49')][_0x8c6d('0x4f')]);_0x471ca0[_0x8c6d('0x52')]=qs[_0x8c6d('0x4a')](_[_0x8c6d('0x50')](_0x1e33f7[_0x8c6d('0x49')],_0x1df6e0['filters']));_0x471ca0[_0x8c6d('0x52')][_0x8c6d('0x68')]=_0x92732['id'];if(_0x1e33f7[_0x8c6d('0x49')][_0x8c6d('0x51')]){_0x471ca0['where']=_[_0x8c6d('0x53')](_0x471ca0[_0x8c6d('0x52')],{'$or':_[_0x8c6d('0x44')](_0x471ca0[_0x8c6d('0x4c')],function(_0x133f41){var _0x4db68b={};_0x4db68b[_0x133f41]={'$like':'%'+_0x1e33f7[_0x8c6d('0x49')][_0x8c6d('0x51')]+'%'};return _0x4db68b;})});}_0x471ca0=_['merge']({},_0x471ca0,_0x1e33f7['options']);return db[_0x8c6d('0x69')][_0x8c6d('0x2f')]({'where':_0x471ca0[_0x8c6d('0x52')]})[_0x8c6d('0x1f')](function(_0x11ae05){_0x535f19[_0x8c6d('0x2f')]=_0x11ae05;if(_0x1e33f7[_0x8c6d('0x49')][_0x8c6d('0x57')]){_0x471ca0[_0x8c6d('0x5d')]=[{'all':!![]}];}return db[_0x8c6d('0x69')][_0x8c6d('0x58')](_0x471ca0);})['then'](function(_0x5589ff){_0x535f19['rows']=_0x5589ff;return _0x535f19;});}})[_0x8c6d('0x1f')](respondWithFilteredResult(_0x19f19d,_0x471ca0))[_0x8c6d('0x5a')](handleError(_0x19f19d,null));};exports['removeDispositions']=function(_0x284fa0,_0x55e00e,_0x31d9b7){return db[_0x8c6d('0x45')][_0x8c6d('0x5e')]({'where':{'id':_0x284fa0[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x55e00e,null))[_0x8c6d('0x1f')](function(_0xc233cb){if(_0xc233cb){return _0xc233cb['removeDispositions'](_0x284fa0['query'][_0x8c6d('0x6e')]);}})[_0x8c6d('0x1f')](respondWithStatusCode(_0x55e00e,null))[_0x8c6d('0x5a')](handleError(_0x55e00e,null));};exports[_0x8c6d('0x6f')]=function(_0x299507,_0x2b9d6b,_0x2929b5){if(_0x299507[_0x8c6d('0x3d')]['id']){delete _0x299507[_0x8c6d('0x3d')]['id'];}return db[_0x8c6d('0x45')]['find']({'where':{'id':_0x299507[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x2b9d6b,null))[_0x8c6d('0x1f')](function(_0xed9664){if(_0xed9664){_0x299507[_0x8c6d('0x3d')]['SmsAccountId']=_0xed9664['id'];return db['CannedAnswer'][_0x8c6d('0x5f')](_0x299507['body']);}})['then'](respondWithResult(_0x2b9d6b,null))[_0x8c6d('0x5a')](handleError(_0x2b9d6b,null));};exports[_0x8c6d('0x70')]=function(_0x10ed6b,_0x7712b8,_0x49a4ab){var _0x5a00ce={'raw':![],'where':{}};var _0x46854f={};var _0xa67c13={'count':0x0,'rows':[]};return db[_0x8c6d('0x45')]['findOne']({'where':{'id':_0x10ed6b[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x7712b8,null))['then'](function(_0x8df7a0){if(_0x8df7a0){_0x46854f[_0x8c6d('0x48')]=_[_0x8c6d('0x5b')](db[_0x8c6d('0x71')][_0x8c6d('0x46')]);_0x46854f[_0x8c6d('0x49')]=_[_0x8c6d('0x5b')](_0x10ed6b['query']);_0x46854f[_0x8c6d('0x4a')]=_[_0x8c6d('0x4b')](_0x46854f[_0x8c6d('0x48')],_0x46854f[_0x8c6d('0x49')]);_0x5a00ce[_0x8c6d('0x4c')]=_[_0x8c6d('0x4b')](_0x46854f[_0x8c6d('0x48')],qs[_0x8c6d('0x5c')](_0x10ed6b['query'][_0x8c6d('0x5c')]));_0x5a00ce[_0x8c6d('0x4c')]=_0x5a00ce[_0x8c6d('0x4c')][_0x8c6d('0x4d')]?_0x5a00ce[_0x8c6d('0x4c')]:_0x46854f['model'];if(!_0x10ed6b[_0x8c6d('0x49')][_0x8c6d('0x6c')](_0x8c6d('0x6d'))){_0x5a00ce[_0x8c6d('0x2e')]=qs[_0x8c6d('0x2e')](_0x10ed6b[_0x8c6d('0x49')]['limit']);_0x5a00ce['offset']=qs[_0x8c6d('0x2c')](_0x10ed6b[_0x8c6d('0x49')][_0x8c6d('0x2c')]);}_0x5a00ce[_0x8c6d('0x4e')]=qs[_0x8c6d('0x4f')](_0x10ed6b[_0x8c6d('0x49')]['sort']);_0x5a00ce[_0x8c6d('0x52')]=qs['filters'](_[_0x8c6d('0x50')](_0x10ed6b[_0x8c6d('0x49')],_0x46854f['filters']));_0x5a00ce[_0x8c6d('0x52')][_0x8c6d('0x68')]=_0x8df7a0['id'];if(_0x10ed6b[_0x8c6d('0x49')][_0x8c6d('0x51')]){_0x5a00ce[_0x8c6d('0x52')]=_[_0x8c6d('0x53')](_0x5a00ce['where'],{'$or':_['map'](_0x5a00ce['attributes'],function(_0x2d8514){var _0x5b5bd6={};_0x5b5bd6[_0x2d8514]={'$like':'%'+_0x10ed6b[_0x8c6d('0x49')][_0x8c6d('0x51')]+'%'};return _0x5b5bd6;})});}_0x5a00ce=_[_0x8c6d('0x53')]({},_0x5a00ce,_0x10ed6b[_0x8c6d('0x56')]);return db[_0x8c6d('0x71')]['count']({'where':_0x5a00ce[_0x8c6d('0x52')]})['then'](function(_0x418b1a){_0xa67c13[_0x8c6d('0x2f')]=_0x418b1a;if(_0x10ed6b['query']['includeAll']){_0x5a00ce[_0x8c6d('0x5d')]=[{'all':!![]}];}return db[_0x8c6d('0x71')][_0x8c6d('0x58')](_0x5a00ce);})[_0x8c6d('0x1f')](function(_0x20de29){_0xa67c13['rows']=_0x20de29;return _0xa67c13;});}})[_0x8c6d('0x1f')](respondWithFilteredResult(_0x7712b8,_0x5a00ce))[_0x8c6d('0x5a')](handleError(_0x7712b8,null));};exports[_0x8c6d('0x72')]=function(_0x45ca53,_0x3cb539,_0x8b9035){return db[_0x8c6d('0x45')][_0x8c6d('0x5e')]({'where':{'id':_0x45ca53['params']['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x3cb539,null))[_0x8c6d('0x1f')](function(_0x530d72){if(_0x530d72){return _0x530d72['removeAnswers'](_0x45ca53[_0x8c6d('0x49')]['ids']);}})[_0x8c6d('0x1f')](respondWithStatusCode(_0x3cb539,null))['catch'](handleError(_0x3cb539,null));};exports[_0x8c6d('0x73')]=function(_0x37d704,_0x412501,_0x81fbfd){var _0x4d8096={'channel':_0x8c6d('0x74')};var _0x2bfee6=[];var _0x511fd7=[];var _0x537463={};return db[_0x8c6d('0x45')][_0x8c6d('0x5e')]({'where':{'id':_0x37d704[_0x8c6d('0x65')]['id']},'include':[{'model':db[_0x8c6d('0x75')],'as':_0x8c6d('0x76')}]})[_0x8c6d('0x1f')](handleEntityNotFound(_0x412501,null))[_0x8c6d('0x1f')](function(_0xebd9ac){_0x4d8096[_0x8c6d('0x41')]=_0xebd9ac;_0x4d8096[_0x8c6d('0x77')]=_['orderBy'](_0xebd9ac[_0x8c6d('0x76')],[_0x8c6d('0x78')],[_0x8c6d('0x79')]);if(_0x4d8096[_0x8c6d('0x41')][_0x8c6d('0x76')]){delete _0x4d8096['account'][_0x8c6d('0x76')];}return db['CmContact'][_0x8c6d('0x66')]();})[_0x8c6d('0x1f')](function(_0x49b80a){if(!_0x49b80a){throw new db[(_0x8c6d('0x7a'))]['ValidationError'](_0x8c6d('0x7b'));}_0x2bfee6=_['difference'](_[_0x8c6d('0x5b')](_0x49b80a),[_0x8c6d('0x7c'),_0x8c6d('0x7d')]);_0x511fd7=_[_0x8c6d('0x7e')](_['keys'](_0x49b80a),[_0x8c6d('0x7c'),_0x8c6d('0x7d'),_0x8c6d('0x7f'),'ListId']);_0x4d8096[_0x8c6d('0x3d')]={'mapKey':_0x8c6d('0x80')};if(_0x4d8096[_0x8c6d('0x41')][_0x8c6d('0x54')]){switch(_0x4d8096[_0x8c6d('0x41')][_0x8c6d('0x54')]){case _0x8c6d('0x81'):_0x4d8096['body'][_0x8c6d('0x82')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x83')];_0x4d8096[_0x8c6d('0x3d')]['body']=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x84')];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x85')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x86')];break;case _0x8c6d('0x87'):_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')]='+'+_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x88')];_0x4d8096[_0x8c6d('0x3d')]['body']=_0x37d704['body']['text'];break;case _0x8c6d('0x89'):_0x4d8096['body'][_0x8c6d('0x82')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x82')];_0x4d8096[_0x8c6d('0x3d')]['body']=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x26')];break;case _0x8c6d('0x8a'):_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x82')];_0x4d8096[_0x8c6d('0x3d')]['body']=_0x37d704[_0x8c6d('0x3d')]['body'];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x85')]=_0x37d704[_0x8c6d('0x3d')]['message_id'];break;case'plivo':_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x83')];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x3d')]=_0x37d704['body'][_0x8c6d('0x8b')];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x85')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x8c')];break;case'infobip':_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')]='+'+_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x8d')][0x0][_0x8c6d('0x82')];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x3d')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x8d')][0x0]['text'];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x85')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x8d')][0x0][_0x8c6d('0x85')];break;case _0x8c6d('0x8e'):_0x4d8096['body'][_0x8c6d('0x82')]=_0x37d704['body'][_0x8c6d('0x8f')];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x3d')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x90')]['message'];break;case _0x8c6d('0x91'):_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')]=_0x37d704['body'][_0x8c6d('0x92')];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x3d')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x93')];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x85')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x94')];break;case _0x8c6d('0x95'):_0x4d8096[_0x8c6d('0x3d')]['messageId']=_0x37d704['body'][0x0][_0x8c6d('0x26')]['id'];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')]=_0x37d704[_0x8c6d('0x3d')][0x0]['message'][_0x8c6d('0x82')];_0x4d8096['body'][_0x8c6d('0x3d')]=_0x37d704['body'][0x0][_0x8c6d('0x26')][_0x8c6d('0x93')];break;case _0x8c6d('0x96'):_0x4d8096[_0x8c6d('0x3d')]['from']=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x82')];_0x4d8096[_0x8c6d('0x3d')]['body']=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x26')];_0x4d8096['body'][_0x8c6d('0x85')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x97')];break;}}if(_0x4d8096[_0x8c6d('0x3d')]['id']){delete _0x4d8096['body']['id'];}if(_['isNil'](_0x4d8096['body'][_0x8c6d('0x82')])){throw new db['Sequelize'][(_0x8c6d('0x98'))](_0x8c6d('0x99'));}if(_[_0x8c6d('0x9a')](_0x4d8096[_0x8c6d('0x3d')]['body'])||_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x3d')]===''){throw new db[(_0x8c6d('0x7a'))]['ValidationError'](_0x8c6d('0x9b'));}if(_['isNil'](_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x9c')])){throw new db[(_0x8c6d('0x7a'))][(_0x8c6d('0x98'))](_0x8c6d('0x9d')+_0x511fd7);}if(!_[_0x8c6d('0x9e')](_0x511fd7,_0x4d8096['body']['mapKey'])){throw new db[(_0x8c6d('0x7a'))][(_0x8c6d('0x98'))](_0x8c6d('0x9f')+_0x511fd7);}_0x537463[_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x9c')]]=_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')];return db[_0x8c6d('0xa0')][_0x8c6d('0x5e')]({'where':{'id':_0x4d8096[_0x8c6d('0x41')][_0x8c6d('0xa1')]},'include':[{'model':db[_0x8c6d('0xa2')],'as':_0x8c6d('0xa3'),'where':_0x537463,'limit':0x1,'order':[[_0x8c6d('0x7d'),'DESC']]}]});})['then'](handleEntityNotFound(_0x412501,null))[_0x8c6d('0x1f')](function(_0x311a5a){if(_0x311a5a){_0x4d8096['list']=_['omit'](_0x311a5a,[_0x8c6d('0xa3')]);if(_0x311a5a[_0x8c6d('0xa3')][_0x8c6d('0x4d')]){return _0x311a5a[_0x8c6d('0xa3')][0x0];}var _0x329957=_[_0x8c6d('0x17')](_0x4d8096[_0x8c6d('0x3d')],{'firstName':_0x4d8096[_0x8c6d('0x3d')]['from'],'ListId':_0x311a5a['id']});_0x329957[_0x4d8096[_0x8c6d('0x3d')]['mapKey']]=_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')];return db[_0x8c6d('0xa2')][_0x8c6d('0x5f')](_0x329957,{'fields':_0x2bfee6,'raw':!![]});}})['then'](handleEntityNotFound(_0x412501,null))['then'](function(_0x43fb1a){if(_0x43fb1a){_0x4d8096[_0x8c6d('0x3e')]=_0x43fb1a;var _0x53ed49={'ContactId':_0x43fb1a['id'],'phone':_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')],'SmsAccountId':_0x37d704[_0x8c6d('0x65')]['id']};var _0x80e26={'ContactId':_0x43fb1a['id'],'SmsAccountId':_0x37d704[_0x8c6d('0x65')]['id'],'closed':![]};return db['SmsInteraction'][_0x8c6d('0x5e')]({'where':_0x80e26})[_0x8c6d('0x1f')](function(_0x7fe74f){if(_0x7fe74f){return[_0x7fe74f,![]];}return db['SmsInteraction'][_0x8c6d('0x5f')](_0x53ed49)['then'](function(_0x4c1d3c){return[_0x4c1d3c,!![]];});});}})[_0x8c6d('0xa4')](function(_0x52cb7c,_0x496869){_0x4d8096[_0x8c6d('0x40')]=_0x52cb7c[_0x8c6d('0x36')]({'plain':!![]});_0x4d8096[_0x8c6d('0x40')][_0x8c6d('0xa5')]=![];if(_0x496869){if(_0x4d8096[_0x8c6d('0x41')][_0x8c6d('0xa6')]){_0x4d8096['applications'][_0x8c6d('0xa7')]({'id':0x0,'priority':_0x4d8096[_0x8c6d('0x77')][_0x8c6d('0x4d')]+0x1,'app':_0x8c6d('0xa8'),'appdata':'unmanaged','interval':_0x8c6d('0xa9')});}_0x4d8096[_0x8c6d('0x40')][_0x8c6d('0xa5')]=!![];}return db[_0x8c6d('0xaa')]['create']({'phone':_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')],'messageId':_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x85')],'body':_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x3d')],'SmsAccountId':_0x37d704[_0x8c6d('0x65')]['id'],'SmsInteractionId':_0x52cb7c['id'],'direction':'in','ContactId':_0x52cb7c['ContactId'],'AttachmentId':_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0xab')]});})[_0x8c6d('0x1f')](function(_0xcec53d){_0x4d8096[_0x8c6d('0x26')]=_0xcec53d;if(_0x4d8096['interaction'][_0x8c6d('0xac')]){return db[_0x8c6d('0xad')][_0x8c6d('0x5e')]({'attributes':['id',_0x8c6d('0x3a')],'where':{'id':_0x4d8096['interaction'][_0x8c6d('0xac')]}})[_0x8c6d('0x1f')](function(_0x40538e){if(_0x40538e){_0x4d8096[_0x8c6d('0x77')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8c6d('0x3f'),'appdata':_0x40538e[_0x8c6d('0x3a')]+','+(_0x4d8096[_0x8c6d('0x41')][_0x8c6d('0xae')]||0xa),'interval':_0x8c6d('0xa9')});}return respondWithRpcPromise('Start','startRouting',_0x4d8096);});}return respondWithRpcPromise(_0x8c6d('0xaf'),'startRouting',_0x4d8096);})['then'](function(_0x1c9d1d){if(_0x1c9d1d){var _0x1d682e=0xc8;var _0x1f5833='receiveMessage';logger[_0x8c6d('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1f5833,_0x1d682e,_0x8c6d('0xb0'));logger['debug'](_0x8c6d('0xb1'),_0x1f5833,_0x1d682e,_0x8c6d('0xb0'),JSON['stringify'](_0x1c9d1d));if(_0x4d8096[_0x8c6d('0x41')][_0x8c6d('0x54')]==='twilio'){return _0x412501[_0x8c6d('0x2a')](_0x1d682e)[_0x8c6d('0x30')](_0x8c6d('0xb2'),'text/xml')[_0x8c6d('0x3b')](_0x8c6d('0xb3'));}else{return _0x412501[_0x8c6d('0x2a')](_0x1d682e)['json'](_0x1c9d1d);}}})['catch'](handleError(_0x412501,null));};exports[_0x8c6d('0xb4')]=function(_0x5e784b,_0x442810,_0x3a6b34){return db[_0x8c6d('0x45')][_0x8c6d('0x6b')]({'where':{'id':_0x5e784b['params']['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x442810,null))[_0x8c6d('0x1f')](function(_0x58ffd2){if(_0x58ffd2){return db[_0x8c6d('0xb5')][_0x8c6d('0xb6')](function(_0x17eafa){return db[_0x8c6d('0x75')][_0x8c6d('0x35')]({'where':{'SmsAccountId':_0x5e784b[_0x8c6d('0x65')]['id']},'transaction':_0x17eafa})[_0x8c6d('0x1f')](function(_0xc5ab6e){var _0x109f5c=_['map'](_0x5e784b[_0x8c6d('0x3d')],function(_0x4d644b){_0x4d644b[_0x8c6d('0x68')]=_0x5e784b[_0x8c6d('0x65')]['id'];return _0x4d644b;});return db[_0x8c6d('0x75')][_0x8c6d('0xb7')](_0x109f5c,{'transaction':_0x17eafa});});})[_0x8c6d('0x1f')](function(){return db[_0x8c6d('0x75')][_0x8c6d('0xb8')]({'where':{'SmsAccountId':_0x5e784b['params']['id']},'order':_0x8c6d('0x78')});});}})[_0x8c6d('0x1f')](respondWithResult(_0x442810,null))[_0x8c6d('0x5a')](handleError(_0x442810,null));};exports[_0x8c6d('0xb9')]=function(_0xb753ab,_0x3e2f2d,_0x3fab0a){var _0x393b53={};var _0x5799b9={};var _0x42078b;var _0x1e141a;return db['SmsAccount'][_0x8c6d('0x6b')]({'where':{'id':_0xb753ab[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x3e2f2d,null))[_0x8c6d('0x1f')](function(_0x54f967){if(_0x54f967){_0x42078b=_0x54f967;_0x5799b9[_0x8c6d('0x48')]=_[_0x8c6d('0x5b')](db[_0x8c6d('0x75')]['rawAttributes']);_0x5799b9[_0x8c6d('0x49')]=_[_0x8c6d('0x5b')](_0xb753ab[_0x8c6d('0x49')]);_0x5799b9[_0x8c6d('0x4a')]=_[_0x8c6d('0x4b')](_0x5799b9[_0x8c6d('0x48')],_0x5799b9[_0x8c6d('0x49')]);_0x393b53[_0x8c6d('0x4c')]=_[_0x8c6d('0x4b')](_0x5799b9[_0x8c6d('0x48')],qs[_0x8c6d('0x5c')](_0xb753ab[_0x8c6d('0x49')]['fields']));_0x393b53[_0x8c6d('0x4c')]=_0x393b53['attributes'][_0x8c6d('0x4d')]?_0x393b53['attributes']:_0x5799b9[_0x8c6d('0x48')];_0x393b53[_0x8c6d('0x4e')]=qs[_0x8c6d('0x4f')](_0xb753ab[_0x8c6d('0x49')]['sort']);_0x393b53[_0x8c6d('0x52')]=qs[_0x8c6d('0x4a')](_[_0x8c6d('0x50')](_0xb753ab['query'],_0x5799b9[_0x8c6d('0x4a')]));if(_0xb753ab['query']['filter']){_0x393b53[_0x8c6d('0x52')]=_[_0x8c6d('0x53')](_0x393b53[_0x8c6d('0x52')],{'$or':_['map'](_0x393b53[_0x8c6d('0x4c')],function(_0x53db17){var _0x46bb14={};_0x46bb14[_0x53db17]={'$like':'%'+_0xb753ab[_0x8c6d('0x49')]['filter']+'%'};return _0x46bb14;})});}_0x393b53=_[_0x8c6d('0x53')]({},_0x393b53,_0xb753ab[_0x8c6d('0x56')]);return _0x42078b[_0x8c6d('0xb9')](_0x393b53);}})[_0x8c6d('0x1f')](function(_0x4b30a8){if(_0x4b30a8){_0x1e141a=_0x4b30a8[_0x8c6d('0x4d')];if(!_0xb753ab[_0x8c6d('0x49')]['hasOwnProperty'](_0x8c6d('0x6d'))){_0x393b53['limit']=qs['limit'](_0xb753ab[_0x8c6d('0x49')][_0x8c6d('0x2e')]);_0x393b53[_0x8c6d('0x2c')]=qs[_0x8c6d('0x2c')](_0xb753ab[_0x8c6d('0x49')][_0x8c6d('0x2c')]);}return _0x42078b[_0x8c6d('0xb9')](_0x393b53);}})[_0x8c6d('0x1f')](function(_0x44d8f2){if(_0x44d8f2){return _0x44d8f2?{'count':_0x1e141a,'rows':_0x44d8f2}:null;}})[_0x8c6d('0x1f')](respondWithResult(_0x3e2f2d,null))['catch'](handleError(_0x3e2f2d,null));};exports[_0x8c6d('0xba')]=function(_0x407140,_0x495653,_0x4df5b1){var _0x1c2c7f={'raw':![],'where':{}};var _0x3f5388={};var _0x297531={'count':0x0,'rows':[]};return db[_0x8c6d('0x45')][_0x8c6d('0x6b')]({'where':{'id':_0x407140['params']['id']}})['then'](handleEntityNotFound(_0x495653,null))['then'](function(_0x13c2f2){if(_0x13c2f2){_0x3f5388[_0x8c6d('0x48')]=_[_0x8c6d('0x5b')](db[_0x8c6d('0xbb')]['rawAttributes']);_0x3f5388[_0x8c6d('0x49')]=_['keys'](_0x407140['query']);_0x3f5388['filters']=_[_0x8c6d('0x4b')](_0x3f5388[_0x8c6d('0x48')],_0x3f5388[_0x8c6d('0x49')]);_0x1c2c7f[_0x8c6d('0x4c')]=_['intersection'](_0x3f5388[_0x8c6d('0x48')],qs[_0x8c6d('0x5c')](_0x407140['query']['fields']));_0x1c2c7f[_0x8c6d('0x4c')]=_0x1c2c7f['attributes']['length']?_0x1c2c7f[_0x8c6d('0x4c')]:_0x3f5388[_0x8c6d('0x48')];if(!_0x407140[_0x8c6d('0x49')][_0x8c6d('0x6c')](_0x8c6d('0x6d'))){_0x1c2c7f[_0x8c6d('0x2e')]=qs[_0x8c6d('0x2e')](_0x407140['query']['limit']);_0x1c2c7f['offset']=qs[_0x8c6d('0x2c')](_0x407140[_0x8c6d('0x49')][_0x8c6d('0x2c')]);}_0x1c2c7f[_0x8c6d('0x4e')]=qs[_0x8c6d('0x4f')](_0x407140[_0x8c6d('0x49')][_0x8c6d('0x4f')]);_0x1c2c7f[_0x8c6d('0x52')]=qs['filters'](_[_0x8c6d('0x50')](_0x407140[_0x8c6d('0x49')],_0x3f5388[_0x8c6d('0x4a')]));_0x1c2c7f[_0x8c6d('0x52')][_0x8c6d('0x68')]=_0x13c2f2['id'];if(_0x407140[_0x8c6d('0x49')]['filter']){_0x1c2c7f['where']=_[_0x8c6d('0x53')](_0x1c2c7f[_0x8c6d('0x52')],{'$or':_[_0x8c6d('0x44')](_0x1c2c7f['attributes'],function(_0x339288){var _0x842e26={};_0x842e26[_0x339288]={'$like':'%'+_0x407140['query'][_0x8c6d('0x51')]+'%'};return _0x842e26;})});}_0x1c2c7f=_[_0x8c6d('0x53')]({},_0x1c2c7f,_0x407140[_0x8c6d('0x56')]);return db['SmsInteraction']['count']({'where':_0x1c2c7f[_0x8c6d('0x52')]})[_0x8c6d('0x1f')](function(_0x53d7c1){_0x297531['count']=_0x53d7c1;if(_0x407140[_0x8c6d('0x49')][_0x8c6d('0x57')]){_0x1c2c7f[_0x8c6d('0x5d')]=[{'model':db[_0x8c6d('0xa2')],'as':'Contact','required':![]},{'model':db[_0x8c6d('0xad')],'as':_0x8c6d('0xbc'),'attributes':['name',_0x8c6d('0xbd'),_0x8c6d('0xbe')],'required':![]},{'model':db[_0x8c6d('0xbf')],'as':_0x8c6d('0xc0'),'attributes':['id',_0x8c6d('0x3a'),_0x8c6d('0xc1')],'where':_0x407140['query'][_0x8c6d('0xc2')]?{'id':_0x407140[_0x8c6d('0x49')][_0x8c6d('0xc2')]}:undefined,'required':_0x407140[_0x8c6d('0x49')][_0x8c6d('0xc2')]?!![]:![]}];}return db['SmsInteraction'][_0x8c6d('0x58')](_0x1c2c7f);})[_0x8c6d('0x1f')](function(_0x2f6692){_0x297531[_0x8c6d('0x59')]=_0x2f6692;return _0x297531;});}})[_0x8c6d('0x1f')](respondWithFilteredResult(_0x495653,_0x1c2c7f))[_0x8c6d('0x5a')](handleError(_0x495653,null));};exports[_0x8c6d('0x3b')]=function(_0x33f8f6,_0xeca072,_0x3f8b12){var _0x3c8cc2,_0x168b66,_0x3ca251;if(_['isNil'](_0x33f8f6[_0x8c6d('0x3d')][_0x8c6d('0x3d')])||_0x33f8f6[_0x8c6d('0x3d')]['body']===''){throw new db[(_0x8c6d('0x7a'))][(_0x8c6d('0x98'))](_0x8c6d('0x9b'));}if(_[_0x8c6d('0x9a')](_0x33f8f6[_0x8c6d('0x3d')]['to'])){throw new db[(_0x8c6d('0x7a'))][(_0x8c6d('0x98'))]('to\x20is\x20mandatory');}_0x3c8cc2=_0x33f8f6[_0x8c6d('0x3d')]['to'];return db[_0x8c6d('0x45')]['find']({'where':{'id':_0x33f8f6[_0x8c6d('0x65')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x8c6d('0xa2')],'as':_0x8c6d('0xa3'),'where':{'mobile':_0x3c8cc2},'limit':0x1,'order':[[_0x8c6d('0x7d'),_0x8c6d('0xc3')]]}]}]})['then'](handleEntityNotFound(_0xeca072,null))[_0x8c6d('0x1f')](function(_0x4336f2){if(_0x4336f2&&_0x4336f2[_0x8c6d('0xc4')]){_0x168b66=_0x4336f2['get']({'plain':!![]});if(_0x168b66['List']&&_0x168b66[_0x8c6d('0xc4')][_0x8c6d('0xa3')][_0x8c6d('0x4d')]){return _0x168b66[_0x8c6d('0xc4')]['Contacts'][0x0];}return db['CmContact'][_0x8c6d('0x5f')](_[_0x8c6d('0x17')](_0x33f8f6[_0x8c6d('0x3d')],{'firstName':_0x3c8cc2,'mobile':_0x3c8cc2,'phone':_0x3c8cc2,'ListId':_0x168b66[_0x8c6d('0xa1')]}));}})[_0x8c6d('0x1f')](handleEntityNotFound(_0xeca072,null))[_0x8c6d('0x1f')](function(_0x3c3c92){if(_0x3c3c92){_0x3ca251=_0x3c3c92;return db[_0x8c6d('0xbb')][_0x8c6d('0x5e')]({'where':{'ContactId':_0x3ca251['id'],'closed':![],'SmsAccountId':_0x168b66['id']}})['then'](function(_0x53fccc){if(_0x53fccc){return[_0x53fccc,![]];}return db[_0x8c6d('0xbb')]['create']({'UserId':_0x33f8f6['user']['id'],'ContactId':_0x3ca251['id'],'SmsAccountId':_0x168b66['id'],'phone':_0x3c8cc2,'firstMsgDirection':_0x8c6d('0xc5'),'Messages':[_['merge'](_0x33f8f6['body'],{'read':![],'body':_0x33f8f6[_0x8c6d('0x3d')][_0x8c6d('0x3d')],'phone':_0x3c8cc2,'SmsAccountId':_0x168b66['id'],'UserId':_0x33f8f6[_0x8c6d('0x60')]['id'],'ContactId':_0x3ca251['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x8c6d('0xc6')}]})[_0x8c6d('0x1f')](function(_0xb1580e){return[_0xb1580e,!![]];});});}})['spread'](function(_0x83597b,_0x27bd2d){if(_0x27bd2d){return _0x83597b;}return db[_0x8c6d('0xaa')][_0x8c6d('0x5f')](_[_0x8c6d('0x53')](_0x33f8f6[_0x8c6d('0x3d')],{'read':![],'body':_0x33f8f6[_0x8c6d('0x3d')]['body'],'phone':_0x3c8cc2,'SmsAccountId':_0x168b66['id'],'SmsInteractionId':_0x83597b['id'],'UserId':_0x33f8f6[_0x8c6d('0x60')]['id'],'ContactId':_0x3ca251['id']}))['then'](function(_0x160ef7){_0x83597b['dataValues'][_0x8c6d('0xc6')]=[];_0x83597b[_0x8c6d('0xc7')][_0x8c6d('0xc6')][_0x8c6d('0xa7')](_0x160ef7['dataValues']);return _0x83597b;});})[_0x8c6d('0x1f')](respondWithResult(_0xeca072,null))[_0x8c6d('0x5a')](handleError(_0xeca072,null));};exports['status']=function(_0xdad331,_0x3b2357,_0x48ff5e){if(_0xdad331[_0x8c6d('0x3d')]['id']){delete _0xdad331[_0x8c6d('0x3d')]['id'];}var _0x4a0e28,_0x4924e8,_0x5b19ad;return db['SmsAccount']['find']({'where':{'id':_0xdad331['params']['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x3b2357,null))[_0x8c6d('0x1f')](function(_0x8ee2da){if(_0x8ee2da){_0x5b19ad=_0x8ee2da;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8c6d('0x2a'),_0x8c6d('0xc8'),_0x8ee2da[_0x8c6d('0x54')],util[_0x8c6d('0xc9')](_0xdad331[_0x8c6d('0x3d')],{'showHidden':![],'depth':null}));switch(_0x8ee2da['type']){case _0x8c6d('0x87'):if(_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xca')]&&_0xdad331[_0x8c6d('0x3d')]['status']){_0x4924e8=_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0x2a')];return db[_0x8c6d('0xaa')][_0x8c6d('0x5e')]({'where':{'messageId':_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xca')]}});}break;case _0x8c6d('0x89'):if(_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xcb')]&&_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xcc')]){_0x4924e8=_0xdad331['body'][_0x8c6d('0xcc')];return db['SmsMessage'][_0x8c6d('0x5e')]({'where':{'messageId':_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xcb')]}});}break;case'clicksend':if(_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xcd')]&&_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xce')]){_0x4924e8=_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xce')];return db[_0x8c6d('0xaa')][_0x8c6d('0x5e')]({'where':{'messageId':_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xcd')]}});}break;case _0x8c6d('0xcf'):var _0x2149e0=_0xdad331['body'][_0x8c6d('0x8d')][0x0];if(_0x2149e0[_0x8c6d('0x85')]&&_0x2149e0['status'][_0x8c6d('0xd0')]==='DELIVERED'){_0x4924e8=_0x2149e0[_0x8c6d('0x2a')][_0x8c6d('0xd0')];return db['SmsMessage'][_0x8c6d('0x5e')]({'where':{'messageId':_0x2149e0[_0x8c6d('0x85')]}});}break;case _0x8c6d('0x91'):if(_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0x85')]&&_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0x2a')]){_0x4924e8=_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0x2a')];return db['SmsMessage'][_0x8c6d('0x5e')]({'where':{'messageId':_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0x85')]}});}break;case _0x8c6d('0x95'):if(_0xdad331[_0x8c6d('0x3d')][0x0][_0x8c6d('0x26')]['id']){_0x4924e8=_0xdad331[_0x8c6d('0x3d')][0x0]['type'];return db['SmsMessage'][_0x8c6d('0x5e')]({'where':{'messageId':_0xdad331['body'][0x0][_0x8c6d('0x26')]['id']}});}break;case'intelepeer':if(_0xdad331[_0x8c6d('0x3d')]['redif']&&_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0x2a')]){_0x4924e8=_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0x2a')];return db[_0x8c6d('0xaa')]['find']({'where':{'messageId':_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xd1')]}});}break;}}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x3b2357,null))['then'](function(_0xf6b567){if(_0xf6b567){_0x4a0e28=_0xf6b567;switch(_0x5b19ad[_0x8c6d('0x54')]){case _0x8c6d('0x87'):if(_0x4924e8===_0x8c6d('0xd2')){return _0x4a0e28[_0x8c6d('0x34')]({'read':!![]});}else{logger[_0x8c6d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8c6d('0x2a'),_0x8c6d('0x87'),util['inspect'](_0xdad331[_0x8c6d('0x3d')],{'showHidden':![],'depth':null}));}break;case _0x8c6d('0x89'):if(_0x4924e8==='1'){return _0x4a0e28[_0x8c6d('0x34')]({'read':!![]});}else{logger['error'](_0x8c6d('0xd3'),'status',_0x8c6d('0x87'),util['inspect'](_0xdad331[_0x8c6d('0x3d')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xd4')]&&_0x4924e8>=0xc8&&_0x4924e8<=0xce){return _0x4a0e28[_0x8c6d('0x34')]({'read':!![]});}else{logger[_0x8c6d('0x24')](_0x8c6d('0xd3'),'status','clicksend',util[_0x8c6d('0xc9')](_0xdad331[_0x8c6d('0x3d')],{'showHidden':![],'depth':null}));}break;case _0x8c6d('0xcf'):var _0x39839b=_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0x8d')][0x0];if(_0x39839b[_0x8c6d('0x2a')]['groupName']===_0x8c6d('0xd2')){return _0x4a0e28['update']({'read':!![]});}else{logger[_0x8c6d('0x24')](_0x8c6d('0xd3'),_0x8c6d('0x2a'),_0x8c6d('0xcf'),util['inspect'](_0xdad331[_0x8c6d('0x3d')],{'showHidden':![],'depth':null}));}break;case _0x8c6d('0x91'):if(_0x4924e8==_0x8c6d('0xd5')||_0x4924e8=='RECEIVED_BY_RECIPIENT'){return _0x4a0e28['update']({'read':!![]});}else{logger[_0x8c6d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8c6d('0x2a'),'clickatell',util[_0x8c6d('0xc9')](_0xdad331[_0x8c6d('0x3d')],{'showHidden':![],'depth':null}));}break;case _0x8c6d('0x95'):if(_0x4924e8=='message-delivered'){return _0x4a0e28[_0x8c6d('0x34')]({'read':!![]});}else{logger[_0x8c6d('0x24')](_0x8c6d('0xd3'),'status',_0x8c6d('0x95'),util[_0x8c6d('0xc9')](_0xdad331[_0x8c6d('0x3d')],{'showHidden':![],'depth':null}));}break;case _0x8c6d('0x96'):if(_0x4924e8==='DELIVRD'||_0x4924e8===_0x8c6d('0xd6')){return _0x4a0e28[_0x8c6d('0x34')]({'read':!![]});}else{logger[_0x8c6d('0x24')](_0x8c6d('0xd3'),'status',_0x8c6d('0x96'),util['inspect'](_0xdad331[_0x8c6d('0x3d')],{'showHidden':![],'depth':null}));}break;}return _0x4a0e28;}})['then'](respondWithResult(_0x3b2357,null))[_0x8c6d('0x5a')](handleError(_0x3b2357,null));};exports[_0x8c6d('0xd7')]=function(_0x3451dc,_0x1932ce,_0x4c4b73){var _0x187b08,_0x3537ea,_0x5bac4c;return db[_0x8c6d('0x45')][_0x8c6d('0x5e')]({'where':{'id':_0x3451dc['params']['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x1932ce,null))[_0x8c6d('0x1f')](function(_0x2362ce){if(_0x2362ce){_0x5bac4c=_0x2362ce;logger[_0x8c6d('0x21')](_0x8c6d('0xd3'),_0x8c6d('0x2a'),_0x8c6d('0xc8'),_0x2362ce[_0x8c6d('0x54')],util[_0x8c6d('0xc9')](_0x3451dc[_0x8c6d('0x49')],{'showHidden':![],'depth':null}));switch(_0x2362ce[_0x8c6d('0x54')]){case'csc':if(_0x3451dc[_0x8c6d('0x49')][_0x8c6d('0xd8')]&&_0x3451dc[_0x8c6d('0x49')][_0x8c6d('0xd9')]){_0x3537ea=_0x3451dc[_0x8c6d('0x49')]['state'];return db[_0x8c6d('0xaa')]['find']({'where':{'messageId':_0x3451dc['query']['message-id']}});}break;}}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x1932ce,null))[_0x8c6d('0x1f')](function(_0x36968e){if(_0x36968e){_0x187b08=_0x36968e;switch(_0x5bac4c[_0x8c6d('0x54')]){case _0x8c6d('0x8e'):if(_0x3537ea==='2'||_0x3537ea==='6'){return _0x187b08[_0x8c6d('0x34')]({'read':!![]});}else{logger[_0x8c6d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8c6d('0x2a'),_0x8c6d('0x8e'),util['inspect'](_0x3451dc['query'],{'showHidden':![],'depth':null}));};break;}return _0x187b08;}})['then'](respondWithResult(_0x1932ce,null))[_0x8c6d('0x5a')](handleError(_0x1932ce,null));};exports['addAgents']=function(_0x571200,_0x29b31e,_0x565ceb){return db[_0x8c6d('0x45')][_0x8c6d('0x5e')]({'where':{'id':_0x571200[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x29b31e,null))[_0x8c6d('0x1f')](function(_0x2ba3eb){if(_0x2ba3eb){return _0x2ba3eb['addAgents'](_0x571200[_0x8c6d('0x3d')][_0x8c6d('0x6e')],_[_0x8c6d('0xda')](_0x571200[_0x8c6d('0x3d')],['ids','id'])||{})['spread'](function(_0x48e7ff){for(var _0x5634ca=0x0;_0x5634ca<_0x571200['body'][_0x8c6d('0x6e')][_0x8c6d('0x4d')];_0x5634ca+=0x1){socket['emit'](_0x8c6d('0xdb'),{'UserId':_0x571200['body']['ids'][_0x5634ca],'SmsAccountId':_0x571200[_0x8c6d('0x65')]['id']});}return _0x48e7ff;});}})[_0x8c6d('0x1f')](respondWithResult(_0x29b31e,null))['catch'](handleError(_0x29b31e,null));};exports[_0x8c6d('0xdc')]=function(_0x409d0f,_0x44b3e2,_0x5455bd){return db[_0x8c6d('0x45')]['find']({'where':{'id':_0x409d0f[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x44b3e2,null))['then'](function(_0x291732){if(_0x291732){return _0x291732[_0x8c6d('0xdc')](_0x409d0f[_0x8c6d('0x49')][_0x8c6d('0x6e')])[_0x8c6d('0x1f')](function(){if(_[_0x8c6d('0xdd')](_0x409d0f[_0x8c6d('0x49')][_0x8c6d('0x6e')])){for(var _0x949535=0x0;_0x949535<_0x409d0f[_0x8c6d('0x49')][_0x8c6d('0x6e')][_0x8c6d('0x4d')];_0x949535+=0x1){socket[_0x8c6d('0xde')](_0x8c6d('0xdf'),{'UserId':Number(_0x409d0f[_0x8c6d('0x49')][_0x8c6d('0x6e')][_0x949535]),'SmsAccountId':Number(_0x409d0f[_0x8c6d('0x65')]['id'])});}}else{socket[_0x8c6d('0xde')](_0x8c6d('0xdf'),{'UserId':Number(_0x409d0f[_0x8c6d('0x49')][_0x8c6d('0x6e')]),'SmsAccountId':Number(_0x409d0f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x44b3e2,null))[_0x8c6d('0x5a')](handleError(_0x44b3e2,null));};exports['getAgents']=function(_0x373333,_0x34e0da,_0x4ad47a){var _0x41e84c={};var _0x5c68fd={};var _0x38a00f;var _0x3d9a68;return db[_0x8c6d('0x45')][_0x8c6d('0x6b')]({'where':{'id':_0x373333[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x34e0da,null))[_0x8c6d('0x1f')](function(_0x3ff220){if(_0x3ff220){_0x38a00f=_0x3ff220;_0x5c68fd['model']=_[_0x8c6d('0x5b')](db[_0x8c6d('0xad')][_0x8c6d('0x46')]);_0x5c68fd[_0x8c6d('0x49')]=_[_0x8c6d('0x5b')](_0x373333[_0x8c6d('0x49')]);_0x5c68fd[_0x8c6d('0x4a')]=_[_0x8c6d('0x4b')](_0x5c68fd[_0x8c6d('0x48')],_0x5c68fd[_0x8c6d('0x49')]);_0x41e84c[_0x8c6d('0x4c')]=_['intersection'](_0x5c68fd[_0x8c6d('0x48')],qs[_0x8c6d('0x5c')](_0x373333[_0x8c6d('0x49')][_0x8c6d('0x5c')]));_0x41e84c[_0x8c6d('0x4c')]=_0x41e84c[_0x8c6d('0x4c')][_0x8c6d('0x4d')]?_0x41e84c[_0x8c6d('0x4c')]:_0x5c68fd[_0x8c6d('0x48')];_0x41e84c[_0x8c6d('0x4e')]=qs[_0x8c6d('0x4f')](_0x373333[_0x8c6d('0x49')]['sort']);_0x41e84c[_0x8c6d('0x52')]=qs[_0x8c6d('0x4a')](_[_0x8c6d('0x50')](_0x373333[_0x8c6d('0x49')],_0x5c68fd['filters']));if(_0x373333[_0x8c6d('0x49')]['filter']){_0x41e84c[_0x8c6d('0x52')]=_[_0x8c6d('0x53')](_0x41e84c[_0x8c6d('0x52')],{'$or':_[_0x8c6d('0x44')](_0x41e84c['attributes'],function(_0x228a38){var _0x4e41ee={};_0x4e41ee[_0x228a38]={'$like':'%'+_0x373333['query'][_0x8c6d('0x51')]+'%'};return _0x4e41ee;})});}_0x41e84c=_['merge']({},_0x41e84c,_0x373333[_0x8c6d('0x56')]);return _0x38a00f[_0x8c6d('0xe0')](_0x41e84c);}})[_0x8c6d('0x1f')](function(_0x3a32ad){if(_0x3a32ad){_0x3d9a68=_0x3a32ad[_0x8c6d('0x4d')];if(!_0x373333[_0x8c6d('0x49')][_0x8c6d('0x6c')](_0x8c6d('0x6d'))){_0x41e84c['limit']=qs['limit'](_0x373333[_0x8c6d('0x49')]['limit']);_0x41e84c['offset']=qs[_0x8c6d('0x2c')](_0x373333[_0x8c6d('0x49')][_0x8c6d('0x2c')]);}return _0x38a00f[_0x8c6d('0xe0')](_0x41e84c);}})[_0x8c6d('0x1f')](function(_0x291832){if(_0x291832){return _0x291832?{'count':_0x3d9a68,'rows':_0x291832}:null;}})[_0x8c6d('0x1f')](respondWithResult(_0x34e0da,null))[_0x8c6d('0x5a')](handleError(_0x34e0da,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 56dcfd9..79088e7 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 _0xa224=['../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x59d369,_0x56a533){var _0x58c3eb=function(_0x2acb03){while(--_0x2acb03){_0x59d369['push'](_0x59d369['shift']());}};_0x58c3eb(++_0x56a533);}(_0xa224,0x81));var _0x4a22=function(_0x4a1514,_0x4d2171){_0x4a1514=_0x4a1514-0x0;var _0x9479d5=_0xa224[_0x4a1514];return _0x9479d5;};'use strict';var EventEmitter=require(_0x4a22('0x0'));var SmsAccount=require(_0x4a22('0x1'))['db'][_0x4a22('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4a22('0x3')](0x0);var events={'afterCreate':_0x4a22('0x4'),'afterUpdate':_0x4a22('0x5'),'afterDestroy':_0x4a22('0x6')};function emitEvent(_0x16dea4){return function(_0x5395f8,_0x4134af,_0x6fefff){SmsAccountEvents[_0x4a22('0x7')](_0x16dea4+':'+_0x5395f8['id'],_0x5395f8);SmsAccountEvents['emit'](_0x16dea4,_0x5395f8);_0x6fefff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x4a22('0x8')](e,emitEvent(event));}}module[_0x4a22('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xb962=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb962,0x1ee));var _0x2b96=function(_0x3853d7,_0x33ff22){_0x3853d7=_0x3853d7-0x0;var _0x15451f=_0xb962[_0x3853d7];return _0x15451f;};'use strict';var EventEmitter=require(_0x2b96('0x0'));var SmsAccount=require(_0x2b96('0x1'))['db'][_0x2b96('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x2b96('0x3')](0x0);var events={'afterCreate':_0x2b96('0x4'),'afterUpdate':'update','afterDestroy':_0x2b96('0x5')};function emitEvent(_0x48ecc7){return function(_0x604d4c,_0x12d7cd,_0x3b27db){SmsAccountEvents[_0x2b96('0x6')](_0x48ecc7+':'+_0x604d4c['id'],_0x604d4c);SmsAccountEvents['emit'](_0x48ecc7,_0x604d4c);_0x3b27db(null);};}for(var e in events){if(events[_0x2b96('0x7')](e)){var event=events[e];SmsAccount[_0x2b96('0x8')](e,emitEvent(event));}}module[_0x2b96('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index d609acf..b5fddc2 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 _0x329f=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash'];(function(_0x3b1b94,_0x1377bd){var _0x5506c6=function(_0x9f0e66){while(--_0x9f0e66){_0x3b1b94['push'](_0x3b1b94['shift']());}};_0x5506c6(++_0x1377bd);}(_0x329f,0x15d));var _0xf329=function(_0x4ebcdd,_0xc23961){_0x4ebcdd=_0x4ebcdd-0x0;var _0x3de4d7=_0x329f[_0x4ebcdd];return _0x3de4d7;};'use strict';var _=require(_0xf329('0x0'));var util=require('util');var logger=require(_0xf329('0x1'))(_0xf329('0x2'));var moment=require(_0xf329('0x3'));var BPromise=require(_0xf329('0x4'));var rp=require(_0xf329('0x5'));var fs=require('fs');var path=require(_0xf329('0x6'));var rimraf=require(_0xf329('0x7'));var config=require(_0xf329('0x8'));var attributes=require(_0xf329('0x9'));module[_0xf329('0xa')]=function(_0x3e41d4,_0x413a8d){return _0x3e41d4[_0xf329('0xb')](_0xf329('0xc'),attributes,{'tableName':_0xf329('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb946=['../../config/logger','api','moment','bluebird','request-promise','./smsAccount.attributes','exports','define','lodash','util'];(function(_0x1e3fad,_0x2c942c){var _0x36bdb3=function(_0x292a58){while(--_0x292a58){_0x1e3fad['push'](_0x1e3fad['shift']());}};_0x36bdb3(++_0x2c942c);}(_0xb946,0x1ca));var _0x6b94=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xb946[_0x45bf86];return _0x1f02b7;};'use strict';var _=require(_0x6b94('0x0'));var util=require(_0x6b94('0x1'));var logger=require(_0x6b94('0x2'))(_0x6b94('0x3'));var moment=require(_0x6b94('0x4'));var BPromise=require(_0x6b94('0x5'));var rp=require(_0x6b94('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6b94('0x7'));module[_0x6b94('0x8')]=function(_0x4545f7,_0x236483){return _0x4545f7[_0x6b94('0x9')]('SmsAccount',attributes,{'tableName':'sms_accounts','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 2df2e33..0c0b291 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 _0x58f5=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','ShowSmsAccount','SmsAccount','find','options','raw','where','map','include','model','attributes','catch','lodash'];(function(_0x2e7985,_0x176f1b){var _0x1eaa79=function(_0x442ac5){while(--_0x442ac5){_0x2e7985['push'](_0x2e7985['shift']());}};_0x1eaa79(++_0x176f1b);}(_0x58f5,0x6e));var _0x558f=function(_0xf2f34d,_0x4d27ed){_0xf2f34d=_0xf2f34d-0x0;var _0x404890=_0x58f5[_0xf2f34d];return _0x404890;};'use strict';var _=require(_0x558f('0x0'));var util=require(_0x558f('0x1'));var moment=require(_0x558f('0x2'));var BPromise=require(_0x558f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x558f('0x4'));var db=require(_0x558f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x558f('0x6'))(_0x558f('0x7'));var config=require('../../config/environment');var jayson=require(_0x558f('0x8'));var client=jayson[_0x558f('0x9')][_0x558f('0xa')]({'port':0x232a});config[_0x558f('0xb')]=_[_0x558f('0xc')](config[_0x558f('0xb')],{'host':_0x558f('0xd'),'port':0x18eb});var socket=require(_0x558f('0xe'))(new Redis(config[_0x558f('0xb')]));require('./smsAccount.socket')[_0x558f('0xf')](socket);function respondWithRpcPromise(_0x486b1f,_0x2bc798,_0x2f34ce){return new BPromise(function(_0x30e77d,_0x3054f9){return client[_0x558f('0x10')](_0x486b1f,_0x2f34ce)['then'](function(_0x2b902a){logger[_0x558f('0x11')]('SmsAccount,\x20%s,\x20%s',_0x2bc798,_0x558f('0x12'));logger[_0x558f('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2bc798,_0x558f('0x12'),JSON[_0x558f('0x14')](_0x2b902a));if(_0x2b902a['error']){if(_0x2b902a[_0x558f('0x15')][_0x558f('0x16')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x2bc798,_0x2b902a[_0x558f('0x15')]['message']);return _0x3054f9(_0x2b902a[_0x558f('0x15')]['message']);}logger[_0x558f('0x15')](_0x558f('0x17'),_0x2bc798,_0x2b902a[_0x558f('0x15')][_0x558f('0x18')]);return _0x30e77d(_0x2b902a[_0x558f('0x15')][_0x558f('0x18')]);}else{logger[_0x558f('0x11')](_0x558f('0x17'),_0x2bc798,_0x558f('0x12'));_0x30e77d(_0x2b902a[_0x558f('0x19')][_0x558f('0x18')]);}})['catch'](function(_0x4e8e22){logger[_0x558f('0x15')](_0x558f('0x17'),_0x2bc798,_0x4e8e22);_0x3054f9(_0x4e8e22);});});}exports[_0x558f('0x1a')]=function(_0xd016de){var _0x507d2d=this;return new Promise(function(_0x487a0d,_0x50635a){return db[_0x558f('0x1b')][_0x558f('0x1c')]({'raw':_0xd016de[_0x558f('0x1d')]?_0xd016de[_0x558f('0x1d')][_0x558f('0x1e')]===undefined?!![]:![]:!![],'where':_0xd016de['options']?_0xd016de[_0x558f('0x1d')][_0x558f('0x1f')]||null:null,'attributes':_0xd016de[_0x558f('0x1d')]?_0xd016de[_0x558f('0x1d')]['attributes']||null:null,'include':_0xd016de[_0x558f('0x1d')]?_0xd016de[_0x558f('0x1d')]['include']?_[_0x558f('0x20')](_0xd016de[_0x558f('0x1d')][_0x558f('0x21')],function(_0x5cbf9a){return{'model':db[_0x5cbf9a[_0x558f('0x22')]],'as':_0x5cbf9a['as'],'attributes':_0x5cbf9a[_0x558f('0x23')],'include':_0x5cbf9a[_0x558f('0x21')]?_[_0x558f('0x20')](_0x5cbf9a['include'],function(_0x32ad62){return{'model':db[_0x32ad62[_0x558f('0x22')]],'as':_0x32ad62['as'],'attributes':_0x32ad62['attributes'],'include':_0x32ad62[_0x558f('0x21')]?_[_0x558f('0x20')](_0x32ad62[_0x558f('0x21')],function(_0x291c96){return{'model':db[_0x291c96[_0x558f('0x22')]],'as':_0x291c96['as'],'attributes':_0x291c96[_0x558f('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4eb3be){logger[_0x558f('0x11')]('ShowSmsAccount',_0xd016de);logger[_0x558f('0x13')](_0x558f('0x1a'),_0xd016de,JSON[_0x558f('0x14')](_0x4eb3be));_0x487a0d(_0x4eb3be);})[_0x558f('0x24')](function(_0x58904c){logger[_0x558f('0x15')](_0x558f('0x1a'),_0x58904c[_0x558f('0x18')],_0xd016de);_0x50635a(_0x507d2d[_0x558f('0x15')](0x1f4,_0x58904c[_0x558f('0x18')]));});});}; \ No newline at end of file +var _0xa8d0=['socket.io-emitter','register','request','then','info','request\x20sent','debug','error','SmsAccount,\x20%s,\x20%s','message','result','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','map','model','stringify','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x1ad2f1,_0x1ffb58){var _0x4cb82d=function(_0x2d3214){while(--_0x2d3214){_0x1ad2f1['push'](_0x1ad2f1['shift']());}};_0x4cb82d(++_0x1ffb58);}(_0xa8d0,0x1dd));var _0x0a8d=function(_0x38d5a6,_0x2f8923){_0x38d5a6=_0x38d5a6-0x0;var _0x4aa530=_0xa8d0[_0x38d5a6];return _0x4aa530;};'use strict';var _=require('lodash');var util=require(_0x0a8d('0x0'));var moment=require('moment');var BPromise=require(_0x0a8d('0x1'));var rs=require(_0x0a8d('0x2'));var fs=require('fs');var Redis=require(_0x0a8d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a8d('0x4'));var logger=require(_0x0a8d('0x5'))(_0x0a8d('0x6'));var config=require(_0x0a8d('0x7'));var jayson=require(_0x0a8d('0x8'));var client=jayson[_0x0a8d('0x9')][_0x0a8d('0xa')]({'port':0x232a});config['redis']=_[_0x0a8d('0xb')](config[_0x0a8d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a8d('0xd'))(new Redis(config[_0x0a8d('0xc')]));require('./smsAccount.socket')[_0x0a8d('0xe')](socket);function respondWithRpcPromise(_0x805f09,_0x5eef5f,_0x5d88e7){return new BPromise(function(_0xf6533c,_0x57dcd2){return client[_0x0a8d('0xf')](_0x805f09,_0x5d88e7)[_0x0a8d('0x10')](function(_0x1e62c4){logger[_0x0a8d('0x11')]('SmsAccount,\x20%s,\x20%s',_0x5eef5f,_0x0a8d('0x12'));logger[_0x0a8d('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5eef5f,_0x0a8d('0x12'),JSON['stringify'](_0x1e62c4));if(_0x1e62c4['error']){if(_0x1e62c4[_0x0a8d('0x14')]['code']===0x1f4){logger[_0x0a8d('0x14')](_0x0a8d('0x15'),_0x5eef5f,_0x1e62c4[_0x0a8d('0x14')]['message']);return _0x57dcd2(_0x1e62c4[_0x0a8d('0x14')][_0x0a8d('0x16')]);}logger[_0x0a8d('0x14')](_0x0a8d('0x15'),_0x5eef5f,_0x1e62c4[_0x0a8d('0x14')][_0x0a8d('0x16')]);return _0xf6533c(_0x1e62c4['error'][_0x0a8d('0x16')]);}else{logger[_0x0a8d('0x11')](_0x0a8d('0x15'),_0x5eef5f,_0x0a8d('0x12'));_0xf6533c(_0x1e62c4[_0x0a8d('0x17')]['message']);}})['catch'](function(_0x3e21a8){logger[_0x0a8d('0x14')]('SmsAccount,\x20%s,\x20%s',_0x5eef5f,_0x3e21a8);_0x57dcd2(_0x3e21a8);});});}exports[_0x0a8d('0x18')]=function(_0x55ca1c){var _0x56caed=this;return new Promise(function(_0x11dcf8,_0x144ec0){return db[_0x0a8d('0x19')][_0x0a8d('0x1a')]({'raw':_0x55ca1c[_0x0a8d('0x1b')]?_0x55ca1c[_0x0a8d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x55ca1c['options']?_0x55ca1c[_0x0a8d('0x1b')][_0x0a8d('0x1c')]||null:null,'attributes':_0x55ca1c[_0x0a8d('0x1b')]?_0x55ca1c[_0x0a8d('0x1b')][_0x0a8d('0x1d')]||null:null,'include':_0x55ca1c[_0x0a8d('0x1b')]?_0x55ca1c[_0x0a8d('0x1b')][_0x0a8d('0x1e')]?_[_0x0a8d('0x1f')](_0x55ca1c['options'][_0x0a8d('0x1e')],function(_0xabcbb7){return{'model':db[_0xabcbb7[_0x0a8d('0x20')]],'as':_0xabcbb7['as'],'attributes':_0xabcbb7[_0x0a8d('0x1d')],'include':_0xabcbb7[_0x0a8d('0x1e')]?_[_0x0a8d('0x1f')](_0xabcbb7[_0x0a8d('0x1e')],function(_0x5c99f2){return{'model':db[_0x5c99f2[_0x0a8d('0x20')]],'as':_0x5c99f2['as'],'attributes':_0x5c99f2['attributes'],'include':_0x5c99f2[_0x0a8d('0x1e')]?_[_0x0a8d('0x1f')](_0x5c99f2['include'],function(_0x50ccdf){return{'model':db[_0x50ccdf[_0x0a8d('0x20')]],'as':_0x50ccdf['as'],'attributes':_0x50ccdf[_0x0a8d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0a8d('0x10')](function(_0x55404b){logger[_0x0a8d('0x11')]('ShowSmsAccount',_0x55ca1c);logger[_0x0a8d('0x13')](_0x0a8d('0x18'),_0x55ca1c,JSON[_0x0a8d('0x21')](_0x55404b));_0x11dcf8(_0x55404b);})[_0x0a8d('0x22')](function(_0x1f4bea){logger[_0x0a8d('0x14')](_0x0a8d('0x18'),_0x1f4bea['message'],_0x55ca1c);_0x144ec0(_0x56caed[_0x0a8d('0x14')](0x1f4,_0x1f4bea[_0x0a8d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 7969e17..9224f2b 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 _0x2431=['smsAccount:','./smsAccount.events','save','update','emit','removeListener','register','length'];(function(_0x389213,_0x14a50d){var _0x4ad6ca=function(_0x45203b){while(--_0x45203b){_0x389213['push'](_0x389213['shift']());}};_0x4ad6ca(++_0x14a50d);}(_0x2431,0xc9));var _0x1243=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2431[_0x59ee6f];return _0x4c0979;};'use strict';var SmsAccountEvents=require(_0x1243('0x0'));var events=[_0x1243('0x1'),'remove',_0x1243('0x2')];function createListener(_0x15ef6b,_0x5b1d7e){return function(_0xe258d5){_0x5b1d7e[_0x1243('0x3')](_0x15ef6b,_0xe258d5);};}function removeListener(_0x3d5f6b,_0x1ce471){return function(){SmsAccountEvents[_0x1243('0x4')](_0x3d5f6b,_0x1ce471);};}exports[_0x1243('0x5')]=function(_0x1a2686){for(var _0x268a4c=0x0,_0x1fe0b4=events[_0x1243('0x6')];_0x268a4c<_0x1fe0b4;_0x268a4c++){var _0x4c806a=events[_0x268a4c];var _0x2ae8a9=createListener(_0x1243('0x7')+_0x4c806a,_0x1a2686);SmsAccountEvents['on'](_0x4c806a,_0x2ae8a9);}}; \ No newline at end of file +var _0x0a9c=['./smsAccount.events','save','remove','emit','removeListener','register','length'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0x0a9c,0x181));var _0xc0a9=function(_0x491e57,_0x226252){_0x491e57=_0x491e57-0x0;var _0x597593=_0x0a9c[_0x491e57];return _0x597593;};'use strict';var SmsAccountEvents=require(_0xc0a9('0x0'));var events=[_0xc0a9('0x1'),_0xc0a9('0x2'),'update'];function createListener(_0x478560,_0x134b51){return function(_0x1d87de){_0x134b51[_0xc0a9('0x3')](_0x478560,_0x1d87de);};}function removeListener(_0x5aaa2c,_0x5bd751){return function(){SmsAccountEvents[_0xc0a9('0x4')](_0x5aaa2c,_0x5bd751);};}exports[_0xc0a9('0x5')]=function(_0x571df1){for(var _0x388618=0x0,_0x30145d=events[_0xc0a9('0x6')];_0x388618<_0x30145d;_0x388618++){var _0x327130=events[_0x388618];var _0x2cf80d=createListener('smsAccount:'+_0x327130,_0x571df1);SmsAccountEvents['on'](_0x327130,_0x2cf80d);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 614ff34..ce22e3b 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 _0xd406=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x11df59,_0x24915f){var _0x2eff55=function(_0x23ac42){while(--_0x23ac42){_0x11df59['push'](_0x11df59['shift']());}};_0x2eff55(++_0x24915f);}(_0xd406,0x18f));var _0x6d40=function(_0x4a668d,_0x14c9cf){_0x4a668d=_0x4a668d-0x0;var _0x430b49=_0xd406[_0x4a668d];return _0x430b49;};'use strict';var multer=require(_0x6d40('0x0'));var util=require('util');var path=require(_0x6d40('0x1'));var timeout=require(_0x6d40('0x2'));var express=require(_0x6d40('0x3'));var router=express[_0x6d40('0x4')]();var fs_extra=require(_0x6d40('0x5'));var auth=require(_0x6d40('0x6'));var interaction=require(_0x6d40('0x7'));var config=require(_0x6d40('0x8'));var controller=require('./smsApplication.controller');router[_0x6d40('0x9')]('/',auth[_0x6d40('0xa')](),controller['index']);router['get']('/:id',auth[_0x6d40('0xa')](),controller[_0x6d40('0xb')]);router[_0x6d40('0xc')]('/',auth[_0x6d40('0xa')](),controller[_0x6d40('0xd')]);router[_0x6d40('0xe')](_0x6d40('0xf'),auth['isAuthenticated'](),controller[_0x6d40('0x10')]);router[_0x6d40('0x11')](_0x6d40('0xf'),auth['isAuthenticated'](),controller[_0x6d40('0x12')]);module[_0x6d40('0x13')]=router; \ No newline at end of file +var _0x9d9c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','post','create','update','destroy','exports','multer','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d9c,0xb2));var _0xc9d9=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x9d9c[_0x5834bc];return _0x3e183a;};'use strict';var multer=require(_0xc9d9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc9d9('0x1'));var express=require(_0xc9d9('0x2'));var router=express[_0xc9d9('0x3')]();var fs_extra=require(_0xc9d9('0x4'));var auth=require(_0xc9d9('0x5'));var interaction=require(_0xc9d9('0x6'));var config=require(_0xc9d9('0x7'));var controller=require(_0xc9d9('0x8'));router[_0xc9d9('0x9')]('/',auth['isAuthenticated'](),controller[_0xc9d9('0xa')]);router[_0xc9d9('0x9')](_0xc9d9('0xb'),auth[_0xc9d9('0xc')](),controller['show']);router[_0xc9d9('0xd')]('/',auth[_0xc9d9('0xc')](),controller[_0xc9d9('0xe')]);router['put']('/:id',auth[_0xc9d9('0xc')](),controller[_0xc9d9('0xf')]);router['delete'](_0xc9d9('0xb'),auth['isAuthenticated'](),controller[_0xc9d9('0x10')]);module[_0xc9d9('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 492df81..8008d58 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 _0x6b1f=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x6b1f,0xbd));var _0xf6b1=function(_0x48de21,_0x560efa){_0x48de21=_0x48de21-0x0;var _0x3bd588=_0x6b1f[_0x48de21];return _0x3bd588;};'use strict';var Sequelize=require(_0xf6b1('0x0'));module[_0xf6b1('0x1')]={'priority':{'type':Sequelize[_0xf6b1('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf6b1('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf6b1('0x4')]()},'description':{'type':Sequelize[_0xf6b1('0x3')]},'interval':{'type':Sequelize[_0xf6b1('0x3')],'defaultValue':_0xf6b1('0x5')}}; \ No newline at end of file +var _0xdc66=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0xdc66,0x111));var _0x6dc6=function(_0x159424,_0x401a52){_0x159424=_0x159424-0x0;var _0x1eabe4=_0xdc66[_0x159424];return _0x1eabe4;};'use strict';var Sequelize=require(_0x6dc6('0x0'));module[_0x6dc6('0x1')]={'priority':{'type':Sequelize[_0x6dc6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6dc6('0x3')],'allowNull':![],'defaultValue':_0x6dc6('0x4')},'appdata':{'type':Sequelize[_0x6dc6('0x5')]()},'description':{'type':Sequelize[_0x6dc6('0x3')]},'interval':{'type':Sequelize[_0x6dc6('0x3')],'defaultValue':_0x6dc6('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index ce93eb3..8884401 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 _0x92bf=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','end','error','stack','name','send','render','body','contact','agent','interaction','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','params','destroy','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0x92bf,0x1b3));var _0xf92b=function(_0x5080a7,_0x15c8af){_0x5080a7=_0x5080a7-0x0;var _0x247d5c=_0x92bf[_0x5080a7];return _0x247d5c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf92b('0x0'));var jsonpatch=require(_0xf92b('0x1'));var rp=require('request-promise');var moment=require(_0xf92b('0x2'));var BPromise=require(_0xf92b('0x3'));var Mustache=require(_0xf92b('0x4'));var util=require(_0xf92b('0x5'));var path=require('path');var sox=require(_0xf92b('0x6'));var csv=require(_0xf92b('0x7'));var ejs=require(_0xf92b('0x8'));var fs=require('fs');var fs_extra=require(_0xf92b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf92b('0xa'));var jsforce=require(_0xf92b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf92b('0x7'));var querystring=require(_0xf92b('0xc'));var Papa=require(_0xf92b('0xd'));var Redis=require('ioredis');var authService=require(_0xf92b('0xe'));var qs=require(_0xf92b('0xf'));var as=require(_0xf92b('0x10'));var hardwareService=require(_0xf92b('0x11'));var logger=require(_0xf92b('0x12'))('api');var utils=require(_0xf92b('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf92b('0x14'))['db'];function respondWithStatusCode(_0x1254b5,_0x1b33b9){_0x1b33b9=_0x1b33b9||0xcc;return function(_0x4a59e2){if(_0x4a59e2){return _0x1254b5[_0xf92b('0x15')](_0x1b33b9);}return _0x1254b5['status'](_0x1b33b9)['end']();};}function respondWithResult(_0x5044dc,_0x23b777){_0x23b777=_0x23b777||0xc8;return function(_0x463c4b){if(_0x463c4b){return _0x5044dc[_0xf92b('0x16')](_0x23b777)[_0xf92b('0x17')](_0x463c4b);}};}function respondWithFilteredResult(_0x8d9dd0,_0xcf7daf){return function(_0x2b9d96){if(_0x2b9d96){var _0x12a123=typeof _0xcf7daf[_0xf92b('0x18')]===_0xf92b('0x19')&&typeof _0xcf7daf[_0xf92b('0x1a')]===_0xf92b('0x19');var _0x2a4eb9=_0x2b9d96[_0xf92b('0x1b')];var _0x39a310=_0x12a123?0x0:_0xcf7daf['offset'];var _0x5296e9=_0x12a123?_0x2b9d96[_0xf92b('0x1b')]:_0xcf7daf[_0xf92b('0x18')]+_0xcf7daf[_0xf92b('0x1a')];var _0x56dd50;if(_0x5296e9>=_0x2a4eb9){_0x5296e9=_0x2a4eb9;_0x56dd50=0xc8;}else{_0x56dd50=0xce;}_0x8d9dd0['status'](_0x56dd50);return _0x8d9dd0['set'](_0xf92b('0x1c'),_0x39a310+'-'+_0x5296e9+'/'+_0x2a4eb9)['json'](_0x2b9d96);}return null;};}function patchUpdates(_0x42a889){return function(_0xd80f7b){try{jsonpatch['apply'](_0xd80f7b,_0x42a889,!![]);}catch(_0x1993e2){return BPromise[_0xf92b('0x1d')](_0x1993e2);}return _0xd80f7b[_0xf92b('0x1e')]();};}function saveUpdates(_0x5f1d36,_0x936c6a){return function(_0x3a733c){if(_0x3a733c){return _0x3a733c['update'](_0x5f1d36)[_0xf92b('0x1f')](function(_0x1bb1bd){return _0x1bb1bd;});}return null;};}function removeEntity(_0xecdcbc,_0xffd3c7){return function(_0x4a1171){if(_0x4a1171){return _0x4a1171['destroy']()['then'](function(){_0xecdcbc[_0xf92b('0x16')](0xcc)[_0xf92b('0x20')]();});}};}function handleEntityNotFound(_0x2a4bd4,_0x4192f7){return function(_0xc70857){if(!_0xc70857){_0x2a4bd4['sendStatus'](0x194);}return _0xc70857;};}function handleError(_0x2417c9,_0xcfacc5){_0xcfacc5=_0xcfacc5||0x1f4;return function(_0xf87c93){logger[_0xf92b('0x21')](_0xf87c93[_0xf92b('0x22')]);if(_0xf87c93[_0xf92b('0x23')]){delete _0xf87c93[_0xf92b('0x23')];}_0x2417c9[_0xf92b('0x16')](_0xcfacc5)[_0xf92b('0x24')](_0xf87c93);};}function getMustacheRender(_0x99ba2e,_0x5552a8){return Mustache[_0xf92b('0x25')](_0x99ba2e,_['merge'](_0x5552a8[_0xf92b('0x26')],{'contact':_0x5552a8[_0xf92b('0x27')],'message':_0x5552a8['message'],'agent':_0x5552a8[_0xf92b('0x28')],'interaction':_0x5552a8[_0xf92b('0x29')],'account':_0x5552a8['account']}))||'';}exports['index']=function(_0xb747dc,_0x2e04b1){var _0x586c6a={},_0x5ce38d={},_0x205329={'count':0x0,'rows':[]};var _0x5f1444=_[_0xf92b('0x2a')](db[_0xf92b('0x2b')][_0xf92b('0x2c')],function(_0x33ef6f){return{'name':_0x33ef6f[_0xf92b('0x2d')],'type':_0x33ef6f[_0xf92b('0x2e')][_0xf92b('0x2f')]};});_0x5ce38d[_0xf92b('0x30')]=_[_0xf92b('0x2a')](_0x5f1444,'name');_0x5ce38d[_0xf92b('0x31')]=_[_0xf92b('0x32')](_0xb747dc[_0xf92b('0x31')]);_0x5ce38d['filters']=_[_0xf92b('0x33')](_0x5ce38d['model'],_0x5ce38d[_0xf92b('0x31')]);_0x586c6a[_0xf92b('0x34')]=_[_0xf92b('0x33')](_0x5ce38d[_0xf92b('0x30')],qs[_0xf92b('0x35')](_0xb747dc[_0xf92b('0x31')][_0xf92b('0x35')]));_0x586c6a[_0xf92b('0x34')]=_0x586c6a['attributes'][_0xf92b('0x36')]?_0x586c6a[_0xf92b('0x34')]:_0x5ce38d[_0xf92b('0x30')];if(!_0xb747dc[_0xf92b('0x31')]['hasOwnProperty'](_0xf92b('0x37'))){_0x586c6a['limit']=qs['limit'](_0xb747dc[_0xf92b('0x31')][_0xf92b('0x1a')]);_0x586c6a['offset']=qs['offset'](_0xb747dc[_0xf92b('0x31')][_0xf92b('0x18')]);}_0x586c6a[_0xf92b('0x38')]=qs[_0xf92b('0x39')](_0xb747dc[_0xf92b('0x31')][_0xf92b('0x39')]);_0x586c6a[_0xf92b('0x3a')]=qs[_0xf92b('0x3b')](_[_0xf92b('0x3c')](_0xb747dc[_0xf92b('0x31')],_0x5ce38d[_0xf92b('0x3b')]),_0x5f1444);if(_0xb747dc[_0xf92b('0x31')][_0xf92b('0x3d')]){_0x586c6a[_0xf92b('0x3a')]=_[_0xf92b('0x3e')](_0x586c6a['where'],{'$or':_['map'](_0x5f1444,function(_0x50a34b){if(_0x50a34b['type']!==_0xf92b('0x3f')){var _0x5266e0={};_0x5266e0[_0x50a34b['name']]={'$like':'%'+_0xb747dc['query'][_0xf92b('0x3d')]+'%'};return _0x5266e0;}})});}_0x586c6a=_[_0xf92b('0x3e')]({},_0x586c6a,_0xb747dc['options']);var _0x205bc8={'where':_0x586c6a[_0xf92b('0x3a')]};return db['SmsApplication'][_0xf92b('0x1b')](_0x205bc8)['then'](function(_0x4d270d){_0x205329[_0xf92b('0x1b')]=_0x4d270d;if(_0xb747dc['query'][_0xf92b('0x40')]){_0x586c6a[_0xf92b('0x41')]=[{'all':!![]}];}return db[_0xf92b('0x2b')][_0xf92b('0x42')](_0x586c6a);})[_0xf92b('0x1f')](function(_0x442155){_0x205329[_0xf92b('0x43')]=_0x442155;return _0x205329;})[_0xf92b('0x1f')](respondWithFilteredResult(_0x2e04b1,_0x586c6a))[_0xf92b('0x44')](handleError(_0x2e04b1,null));};exports[_0xf92b('0x45')]=function(_0x3ae904,_0x5c7f94){var _0x4a40b7={'raw':!![],'where':{'id':_0x3ae904['params']['id']}},_0x17d01c={};_0x17d01c[_0xf92b('0x30')]=_['keys'](db[_0xf92b('0x2b')][_0xf92b('0x2c')]);_0x17d01c[_0xf92b('0x31')]=_[_0xf92b('0x32')](_0x3ae904[_0xf92b('0x31')]);_0x17d01c[_0xf92b('0x3b')]=_[_0xf92b('0x33')](_0x17d01c['model'],_0x17d01c[_0xf92b('0x31')]);_0x4a40b7[_0xf92b('0x34')]=_[_0xf92b('0x33')](_0x17d01c[_0xf92b('0x30')],qs[_0xf92b('0x35')](_0x3ae904[_0xf92b('0x31')]['fields']));_0x4a40b7[_0xf92b('0x34')]=_0x4a40b7['attributes'][_0xf92b('0x36')]?_0x4a40b7[_0xf92b('0x34')]:_0x17d01c[_0xf92b('0x30')];if(_0x3ae904['query'][_0xf92b('0x40')]){_0x4a40b7[_0xf92b('0x41')]=[{'all':!![]}];}_0x4a40b7=_['merge']({},_0x4a40b7,_0x3ae904[_0xf92b('0x46')]);return db[_0xf92b('0x2b')][_0xf92b('0x47')](_0x4a40b7)[_0xf92b('0x1f')](handleEntityNotFound(_0x5c7f94,null))[_0xf92b('0x1f')](respondWithResult(_0x5c7f94,null))[_0xf92b('0x44')](handleError(_0x5c7f94,null));};exports[_0xf92b('0x48')]=function(_0x31b996,_0x58b0cf){return db['SmsApplication']['create'](_0x31b996['body'],{})[_0xf92b('0x1f')](respondWithResult(_0x58b0cf,0xc9))[_0xf92b('0x44')](handleError(_0x58b0cf,null));};exports['update']=function(_0x46ee46,_0x7cfbe2){if(_0x46ee46['body']['id']){delete _0x46ee46['body']['id'];}return db['SmsApplication'][_0xf92b('0x47')]({'where':{'id':_0x46ee46[_0xf92b('0x49')]['id']}})['then'](handleEntityNotFound(_0x7cfbe2,null))[_0xf92b('0x1f')](saveUpdates(_0x46ee46[_0xf92b('0x26')],null))['then'](respondWithResult(_0x7cfbe2,null))['catch'](handleError(_0x7cfbe2,null));};exports[_0xf92b('0x4a')]=function(_0xfde914,_0x426a55){return db[_0xf92b('0x2b')][_0xf92b('0x47')]({'where':{'id':_0xfde914[_0xf92b('0x49')]['id']}})['then'](handleEntityNotFound(_0x426a55,null))[_0xf92b('0x1f')](removeEntity(_0x426a55,null))[_0xf92b('0x44')](handleError(_0x426a55,null));}; \ No newline at end of file +var _0x30e4=['fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../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','apply','reject','save','update','then','destroy','stack','name','merge','body','agent','interaction','account','index','SmsApplication','rawAttributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x30e4,0x1a1));var _0x430e=function(_0x573ab1,_0x8adff){_0x573ab1=_0x573ab1-0x0;var _0x580a1b=_0x30e4[_0x573ab1];return _0x580a1b;};'use strict';var emlformat=require(_0x430e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x430e('0x1'));var jsonpatch=require(_0x430e('0x2'));var rp=require(_0x430e('0x3'));var moment=require(_0x430e('0x4'));var BPromise=require(_0x430e('0x5'));var Mustache=require(_0x430e('0x6'));var util=require('util');var path=require(_0x430e('0x7'));var sox=require(_0x430e('0x8'));var csv=require('to-csv');var ejs=require(_0x430e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x430e('0xa'));var crypto=require(_0x430e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x430e('0xc'));var toCsv=require(_0x430e('0xd'));var querystring=require(_0x430e('0xe'));var Papa=require(_0x430e('0xf'));var Redis=require(_0x430e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x430e('0x11'));var hardwareService=require(_0x430e('0x12'));var logger=require(_0x430e('0x13'))(_0x430e('0x14'));var utils=require(_0x430e('0x15'));var config=require(_0x430e('0x16'));var licenseUtil=require(_0x430e('0x17'));var db=require(_0x430e('0x18'))['db'];function respondWithStatusCode(_0x4705ba,_0x556962){_0x556962=_0x556962||0xcc;return function(_0x1b08b6){if(_0x1b08b6){return _0x4705ba[_0x430e('0x19')](_0x556962);}return _0x4705ba['status'](_0x556962)[_0x430e('0x1a')]();};}function respondWithResult(_0x5a250d,_0x5dce01){_0x5dce01=_0x5dce01||0xc8;return function(_0x9f76ea){if(_0x9f76ea){return _0x5a250d['status'](_0x5dce01)[_0x430e('0x1b')](_0x9f76ea);}};}function respondWithFilteredResult(_0x323888,_0x5e3187){return function(_0x1f7c2d){if(_0x1f7c2d){var _0x158eb3=typeof _0x5e3187[_0x430e('0x1c')]===_0x430e('0x1d')&&typeof _0x5e3187['limit']===_0x430e('0x1d');var _0x4d40d6=_0x1f7c2d[_0x430e('0x1e')];var _0x589d76=_0x158eb3?0x0:_0x5e3187[_0x430e('0x1c')];var _0x53be03=_0x158eb3?_0x1f7c2d[_0x430e('0x1e')]:_0x5e3187['offset']+_0x5e3187[_0x430e('0x1f')];var _0x3da31f;if(_0x53be03>=_0x4d40d6){_0x53be03=_0x4d40d6;_0x3da31f=0xc8;}else{_0x3da31f=0xce;}_0x323888[_0x430e('0x20')](_0x3da31f);return _0x323888[_0x430e('0x21')](_0x430e('0x22'),_0x589d76+'-'+_0x53be03+'/'+_0x4d40d6)[_0x430e('0x1b')](_0x1f7c2d);}return null;};}function patchUpdates(_0x2604a4){return function(_0x26f4de){try{jsonpatch[_0x430e('0x23')](_0x26f4de,_0x2604a4,!![]);}catch(_0x165e3d){return BPromise[_0x430e('0x24')](_0x165e3d);}return _0x26f4de[_0x430e('0x25')]();};}function saveUpdates(_0x1bacf9,_0x4b4a57){return function(_0x2e8653){if(_0x2e8653){return _0x2e8653[_0x430e('0x26')](_0x1bacf9)[_0x430e('0x27')](function(_0x126993){return _0x126993;});}return null;};}function removeEntity(_0x446702,_0x450c3e){return function(_0x3c20ff){if(_0x3c20ff){return _0x3c20ff[_0x430e('0x28')]()['then'](function(){_0x446702[_0x430e('0x20')](0xcc)[_0x430e('0x1a')]();});}};}function handleEntityNotFound(_0x4697ce,_0x4bbadb){return function(_0x4ee466){if(!_0x4ee466){_0x4697ce[_0x430e('0x19')](0x194);}return _0x4ee466;};}function handleError(_0x1af40a,_0x140369){_0x140369=_0x140369||0x1f4;return function(_0x389362){logger['error'](_0x389362[_0x430e('0x29')]);if(_0x389362[_0x430e('0x2a')]){delete _0x389362[_0x430e('0x2a')];}_0x1af40a[_0x430e('0x20')](_0x140369)['send'](_0x389362);};}function getMustacheRender(_0x360f69,_0x4803fd){return Mustache['render'](_0x360f69,_[_0x430e('0x2b')](_0x4803fd[_0x430e('0x2c')],{'contact':_0x4803fd['contact'],'message':_0x4803fd['message'],'agent':_0x4803fd[_0x430e('0x2d')],'interaction':_0x4803fd[_0x430e('0x2e')],'account':_0x4803fd[_0x430e('0x2f')]}))||'';}exports[_0x430e('0x30')]=function(_0x34dc76,_0x3611d9){var _0x281c4e={},_0x5511e3={},_0x330e11={'count':0x0,'rows':[]};var _0xff5175=_['map'](db[_0x430e('0x31')][_0x430e('0x32')],function(_0x53e092){return{'name':_0x53e092[_0x430e('0x33')],'type':_0x53e092[_0x430e('0x34')][_0x430e('0x35')]};});_0x5511e3[_0x430e('0x36')]=_[_0x430e('0x37')](_0xff5175,_0x430e('0x2a'));_0x5511e3['query']=_[_0x430e('0x38')](_0x34dc76[_0x430e('0x39')]);_0x5511e3[_0x430e('0x3a')]=_['intersection'](_0x5511e3[_0x430e('0x36')],_0x5511e3[_0x430e('0x39')]);_0x281c4e[_0x430e('0x3b')]=_[_0x430e('0x3c')](_0x5511e3['model'],qs[_0x430e('0x3d')](_0x34dc76[_0x430e('0x39')][_0x430e('0x3d')]));_0x281c4e[_0x430e('0x3b')]=_0x281c4e[_0x430e('0x3b')]['length']?_0x281c4e[_0x430e('0x3b')]:_0x5511e3[_0x430e('0x36')];if(!_0x34dc76['query'][_0x430e('0x3e')]('nolimit')){_0x281c4e[_0x430e('0x1f')]=qs['limit'](_0x34dc76[_0x430e('0x39')][_0x430e('0x1f')]);_0x281c4e['offset']=qs[_0x430e('0x1c')](_0x34dc76[_0x430e('0x39')]['offset']);}_0x281c4e[_0x430e('0x3f')]=qs['sort'](_0x34dc76['query'][_0x430e('0x40')]);_0x281c4e[_0x430e('0x41')]=qs[_0x430e('0x3a')](_[_0x430e('0x42')](_0x34dc76[_0x430e('0x39')],_0x5511e3[_0x430e('0x3a')]),_0xff5175);if(_0x34dc76['query'][_0x430e('0x43')]){_0x281c4e[_0x430e('0x41')]=_['merge'](_0x281c4e['where'],{'$or':_[_0x430e('0x37')](_0xff5175,function(_0x38e4de){if(_0x38e4de[_0x430e('0x34')]!==_0x430e('0x44')){var _0x2af3a7={};_0x2af3a7[_0x38e4de[_0x430e('0x2a')]]={'$like':'%'+_0x34dc76[_0x430e('0x39')][_0x430e('0x43')]+'%'};return _0x2af3a7;}})});}_0x281c4e=_[_0x430e('0x2b')]({},_0x281c4e,_0x34dc76['options']);var _0x12067c={'where':_0x281c4e['where']};return db[_0x430e('0x31')][_0x430e('0x1e')](_0x12067c)[_0x430e('0x27')](function(_0x58e0c7){_0x330e11[_0x430e('0x1e')]=_0x58e0c7;if(_0x34dc76[_0x430e('0x39')][_0x430e('0x45')]){_0x281c4e[_0x430e('0x46')]=[{'all':!![]}];}return db[_0x430e('0x31')][_0x430e('0x47')](_0x281c4e);})[_0x430e('0x27')](function(_0x4ad7ba){_0x330e11[_0x430e('0x48')]=_0x4ad7ba;return _0x330e11;})[_0x430e('0x27')](respondWithFilteredResult(_0x3611d9,_0x281c4e))[_0x430e('0x49')](handleError(_0x3611d9,null));};exports[_0x430e('0x4a')]=function(_0x3eabfb,_0x24a0f5){var _0x22bbaf={'raw':!![],'where':{'id':_0x3eabfb[_0x430e('0x4b')]['id']}},_0x2a3699={};_0x2a3699['model']=_[_0x430e('0x38')](db[_0x430e('0x31')]['rawAttributes']);_0x2a3699['query']=_['keys'](_0x3eabfb[_0x430e('0x39')]);_0x2a3699['filters']=_[_0x430e('0x3c')](_0x2a3699['model'],_0x2a3699[_0x430e('0x39')]);_0x22bbaf[_0x430e('0x3b')]=_[_0x430e('0x3c')](_0x2a3699[_0x430e('0x36')],qs['fields'](_0x3eabfb['query']['fields']));_0x22bbaf[_0x430e('0x3b')]=_0x22bbaf[_0x430e('0x3b')][_0x430e('0x4c')]?_0x22bbaf['attributes']:_0x2a3699[_0x430e('0x36')];if(_0x3eabfb[_0x430e('0x39')]['includeAll']){_0x22bbaf[_0x430e('0x46')]=[{'all':!![]}];}_0x22bbaf=_[_0x430e('0x2b')]({},_0x22bbaf,_0x3eabfb['options']);return db['SmsApplication'][_0x430e('0x4d')](_0x22bbaf)[_0x430e('0x27')](handleEntityNotFound(_0x24a0f5,null))['then'](respondWithResult(_0x24a0f5,null))[_0x430e('0x49')](handleError(_0x24a0f5,null));};exports['create']=function(_0x3c50a2,_0x51ae6d){return db['SmsApplication']['create'](_0x3c50a2[_0x430e('0x2c')],{})[_0x430e('0x27')](respondWithResult(_0x51ae6d,0xc9))['catch'](handleError(_0x51ae6d,null));};exports[_0x430e('0x26')]=function(_0xa3ee04,_0x332fdc){if(_0xa3ee04['body']['id']){delete _0xa3ee04[_0x430e('0x2c')]['id'];}return db[_0x430e('0x31')][_0x430e('0x4d')]({'where':{'id':_0xa3ee04[_0x430e('0x4b')]['id']}})[_0x430e('0x27')](handleEntityNotFound(_0x332fdc,null))[_0x430e('0x27')](saveUpdates(_0xa3ee04[_0x430e('0x2c')],null))['then'](respondWithResult(_0x332fdc,null))[_0x430e('0x49')](handleError(_0x332fdc,null));};exports['destroy']=function(_0x2cc586,_0xdfcac5){return db[_0x430e('0x31')][_0x430e('0x4d')]({'where':{'id':_0x2cc586[_0x430e('0x4b')]['id']}})[_0x430e('0x27')](handleEntityNotFound(_0xdfcac5,null))[_0x430e('0x27')](removeEntity(_0xdfcac5,null))[_0x430e('0x49')](handleError(_0xdfcac5,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 61cc47c..bb972fd 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 _0x6d53=['path','rimraf','../../config/environment','./smsApplication.attributes','exports','sms_applications','utf8mb4','../../config/logger','api','moment','bluebird'];(function(_0x206ec3,_0x18cda4){var _0x1c57fa=function(_0xf653a0){while(--_0xf653a0){_0x206ec3['push'](_0x206ec3['shift']());}};_0x1c57fa(++_0x18cda4);}(_0x6d53,0x1b4));var _0x36d5=function(_0x21474f,_0x3038e9){_0x21474f=_0x21474f-0x0;var _0x4bddc1=_0x6d53[_0x21474f];return _0x4bddc1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x36d5('0x0'))(_0x36d5('0x1'));var moment=require(_0x36d5('0x2'));var BPromise=require(_0x36d5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x36d5('0x4'));var rimraf=require(_0x36d5('0x5'));var config=require(_0x36d5('0x6'));var attributes=require(_0x36d5('0x7'));module[_0x36d5('0x8')]=function(_0x321c65,_0x46f56e){return _0x321c65['define']('SmsApplication',attributes,{'tableName':_0x36d5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x36d5('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7cd9=['path','../../config/environment','SmsApplication','sms_applications','utf8mb4','lodash','util','api'];(function(_0xf469aa,_0x50ae18){var _0x264ef4=function(_0x73521a){while(--_0x73521a){_0xf469aa['push'](_0xf469aa['shift']());}};_0x264ef4(++_0x50ae18);}(_0x7cd9,0xcd));var _0x97cd=function(_0x6dabf3,_0x562fb0){_0x6dabf3=_0x6dabf3-0x0;var _0x314c56=_0x7cd9[_0x6dabf3];return _0x314c56;};'use strict';var _=require(_0x97cd('0x0'));var util=require(_0x97cd('0x1'));var logger=require('../../config/logger')(_0x97cd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x97cd('0x3'));var rimraf=require('rimraf');var config=require(_0x97cd('0x4'));var attributes=require('./smsApplication.attributes');module['exports']=function(_0x5e8639,_0x62c38f){return _0x5e8639['define'](_0x97cd('0x5'),attributes,{'tableName':_0x97cd('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x97cd('0x7'),'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 045c456..c659f69 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 _0x2975=['http','request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','SmsApplication,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x5d5f77,_0x5174cc){var _0x38a048=function(_0x30598b){while(--_0x30598b){_0x5d5f77['push'](_0x5d5f77['shift']());}};_0x38a048(++_0x5174cc);}(_0x2975,0x1c5));var _0x5297=function(_0x10230f,_0x510da4){_0x10230f=_0x10230f-0x0;var _0x2a4118=_0x2975[_0x10230f];return _0x2a4118;};'use strict';var _=require('lodash');var util=require(_0x5297('0x0'));var moment=require(_0x5297('0x1'));var BPromise=require(_0x5297('0x2'));var rs=require(_0x5297('0x3'));var fs=require('fs');var Redis=require(_0x5297('0x4'));var db=require(_0x5297('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5297('0x6'));var jayson=require(_0x5297('0x7'));var client=jayson[_0x5297('0x8')][_0x5297('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d1d2c,_0x1f6762,_0x1b72a7){return new BPromise(function(_0x4f12b0,_0x2c015c){return client[_0x5297('0xa')](_0x4d1d2c,_0x1b72a7)[_0x5297('0xb')](function(_0x2f3b24){logger[_0x5297('0xc')]('SmsApplication,\x20%s,\x20%s',_0x1f6762,_0x5297('0xd'));logger[_0x5297('0xe')](_0x5297('0xf'),_0x1f6762,'request\x20sent',JSON[_0x5297('0x10')](_0x2f3b24));if(_0x2f3b24[_0x5297('0x11')]){if(_0x2f3b24[_0x5297('0x11')]['code']===0x1f4){logger[_0x5297('0x11')](_0x5297('0x12'),_0x1f6762,_0x2f3b24['error']['message']);return _0x2c015c(_0x2f3b24[_0x5297('0x11')][_0x5297('0x13')]);}logger['error'](_0x5297('0x12'),_0x1f6762,_0x2f3b24['error'][_0x5297('0x13')]);return _0x4f12b0(_0x2f3b24[_0x5297('0x11')]['message']);}else{logger[_0x5297('0xc')](_0x5297('0x12'),_0x1f6762,_0x5297('0xd'));_0x4f12b0(_0x2f3b24[_0x5297('0x14')][_0x5297('0x13')]);}})[_0x5297('0x15')](function(_0x1fb138){logger[_0x5297('0x11')]('SmsApplication,\x20%s,\x20%s',_0x1f6762,_0x1fb138);_0x2c015c(_0x1fb138);});});} \ No newline at end of file +var _0x814b=['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','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x814b,0x1a2));var _0xb814=function(_0x589eb4,_0xaa2019){_0x589eb4=_0x589eb4-0x0;var _0xf50816=_0x814b[_0x589eb4];return _0xf50816;};'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')]('SmsApplication,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 0d39450..777a575 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 _0x5496=['isAuthenticated','describe','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update','delete','/:id','smsinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','index','get'];(function(_0x166f17,_0x555bdc){var _0x17bab6=function(_0x45f231){while(--_0x45f231){_0x166f17['push'](_0x166f17['shift']());}};_0x17bab6(++_0x555bdc);}(_0x5496,0x175));var _0x6549=function(_0x9e7b24,_0x5ac379){_0x9e7b24=_0x9e7b24-0x0;var _0x3c4291=_0x5496[_0x9e7b24];return _0x3c4291;};'use strict';var multer=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var path=require(_0x6549('0x2'));var timeout=require(_0x6549('0x3'));var express=require(_0x6549('0x4'));var router=express['Router']();var fs_extra=require(_0x6549('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var controller=require(_0x6549('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6549('0x9')]);router[_0x6549('0xa')]('/describe',auth[_0x6549('0xb')](),controller[_0x6549('0xc')]);router[_0x6549('0xa')]('/:id',auth[_0x6549('0xb')](),controller[_0x6549('0xd')]);router[_0x6549('0xa')](_0x6549('0xe'),auth[_0x6549('0xb')](),controller[_0x6549('0xf')]);router['get']('/:id/download',auth[_0x6549('0xb')](),controller[_0x6549('0x10')]);router[_0x6549('0x11')]('/',auth[_0x6549('0xb')](),controller[_0x6549('0x12')]);router['post']('/:id/messages',auth[_0x6549('0xb')](),controller[_0x6549('0x13')]);router['post'](_0x6549('0x14'),auth[_0x6549('0xb')](),interaction[_0x6549('0x15')](_0x6549('0x16'),_0x6549('0x17')),controller[_0x6549('0x18')]);router['put']('/:id',auth[_0x6549('0xb')](),interaction[_0x6549('0x15')]('sms',_0x6549('0x19')),controller[_0x6549('0x1a')]);router[_0x6549('0x1b')](_0x6549('0x1c'),auth[_0x6549('0xb')](),interaction['tracked']('sms',_0x6549('0x1d')),controller['destroy']);router['delete'](_0x6549('0x14'),auth[_0x6549('0xb')](),controller[_0x6549('0x1e')]);module[_0x6549('0x1f')]=router; \ No newline at end of file +var _0x41d0=['isAuthenticated','index','/describe','describe','/:id','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update','smsinteraction:destroy','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x41d0,0x1c6));var _0x041d=function(_0x126d27,_0x5d5d0e){_0x126d27=_0x126d27-0x0;var _0x18f24c=_0x41d0[_0x126d27];return _0x18f24c;};'use strict';var multer=require(_0x041d('0x0'));var util=require(_0x041d('0x1'));var path=require(_0x041d('0x2'));var timeout=require(_0x041d('0x3'));var express=require('express');var router=express[_0x041d('0x4')]();var fs_extra=require(_0x041d('0x5'));var auth=require(_0x041d('0x6'));var interaction=require(_0x041d('0x7'));var config=require(_0x041d('0x8'));var controller=require(_0x041d('0x9'));router[_0x041d('0xa')]('/',auth[_0x041d('0xb')](),controller[_0x041d('0xc')]);router['get'](_0x041d('0xd'),auth['isAuthenticated'](),controller[_0x041d('0xe')]);router['get'](_0x041d('0xf'),auth[_0x041d('0xb')](),controller['show']);router['get']('/:id/messages',auth[_0x041d('0xb')](),controller['getMessages']);router[_0x041d('0xa')]('/:id/download',auth[_0x041d('0xb')](),controller[_0x041d('0x10')]);router[_0x041d('0x11')]('/',auth[_0x041d('0xb')](),controller[_0x041d('0x12')]);router[_0x041d('0x11')](_0x041d('0x13'),auth[_0x041d('0xb')](),controller[_0x041d('0x14')]);router['post'](_0x041d('0x15'),auth[_0x041d('0xb')](),interaction[_0x041d('0x16')](_0x041d('0x17'),_0x041d('0x18')),controller[_0x041d('0x19')]);router['put'](_0x041d('0xf'),auth[_0x041d('0xb')](),interaction[_0x041d('0x16')](_0x041d('0x17'),_0x041d('0x1a')),controller[_0x041d('0x1b')]);router['delete']('/:id',auth[_0x041d('0xb')](),interaction[_0x041d('0x16')]('sms',_0x041d('0x1c')),controller['destroy']);router[_0x041d('0x1d')](_0x041d('0x15'),auth[_0x041d('0xb')](),controller['removeTags']);module[_0x041d('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index d2b2b63..f887b75 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 _0x7db3=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x7db3,0x1b7));var _0x37db=function(_0x35d2a2,_0x1b6646){_0x35d2a2=_0x35d2a2-0x0;var _0x284a77=_0x7db3[_0x35d2a2];return _0x284a77;};'use strict';var Sequelize=require(_0x37db('0x0'));var moment=require(_0x37db('0x1'));module[_0x37db('0x2')]={'closed':{'type':Sequelize[_0x37db('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x37db('0x4')]},'disposition':{'type':Sequelize[_0x37db('0x5')]},'secondDisposition':{'type':Sequelize[_0x37db('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x37db('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x37db('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x37db('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x37db('0x6')]('in',_0x37db('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x9a96=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x9a96,0x129));var _0x69a9=function(_0x14eb8c,_0x28f957){_0x14eb8c=_0x14eb8c-0x0;var _0x41a8d1=_0x9a96[_0x14eb8c];return _0x41a8d1;};'use strict';var Sequelize=require(_0x69a9('0x0'));var moment=require(_0x69a9('0x1'));module[_0x69a9('0x2')]={'closed':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x69a9('0x4')]},'disposition':{'type':Sequelize[_0x69a9('0x5')]},'secondDisposition':{'type':Sequelize[_0x69a9('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x69a9('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x69a9('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x69a9('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x69a9('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x69a9('0x6')]('in',_0x69a9('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index b885e40..7a51099 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 _0x4ec9=['ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','UserId','type','text','isEmpty','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','forEach','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','SmsInteraction','fields','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','TagIds','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','rows','show','params','include','options','create','describe','addMessage','SmsMessage','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','omit','emit','smsInteractionTags:save','download','unix','join','root','files','server','attachments','transcript-%d-%s.zip','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closed','closedAt','disposition','out','System','renderFile','views','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','sendStatus','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','render','merge','body','contact','message','Users','map','fullname','Tags','split','push','catch','index','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.SmsInteractionId','left_join','users','u.id\x20=\x20ui.UserId','from','cm_contacts','a.id\x20=\x20i.SmsAccountId','it.SmsInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','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?'];(function(_0x96362,_0x5b3c96){var _0x5dce21=function(_0x3757b7){while(--_0x3757b7){_0x96362['push'](_0x96362['shift']());}};_0x5dce21(++_0x5b3c96);}(_0x4ec9,0x7d));var _0x94ec=function(_0x39914e,_0x1ec745){_0x39914e=_0x39914e-0x0;var _0x56350b=_0x4ec9[_0x39914e];return _0x56350b;};'use strict';var emlformat=require(_0x94ec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x94ec('0x1'));var jsonpatch=require(_0x94ec('0x2'));var rp=require(_0x94ec('0x3'));var moment=require(_0x94ec('0x4'));var BPromise=require(_0x94ec('0x5'));var Mustache=require(_0x94ec('0x6'));var util=require('util');var path=require(_0x94ec('0x7'));var sox=require(_0x94ec('0x8'));var csv=require(_0x94ec('0x9'));var ejs=require(_0x94ec('0xa'));var fs=require('fs');var fs_extra=require(_0x94ec('0xb'));var _=require('lodash');var squel=require(_0x94ec('0xc'));var crypto=require(_0x94ec('0xd'));var jsforce=require(_0x94ec('0xe'));var deskjs=require(_0x94ec('0xf'));var toCsv=require(_0x94ec('0x9'));var querystring=require(_0x94ec('0x10'));var Papa=require(_0x94ec('0x11'));var Redis=require(_0x94ec('0x12'));var authService=require(_0x94ec('0x13'));var qs=require(_0x94ec('0x14'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x94ec('0x15'));var hardwareService=require(_0x94ec('0x16'));var logger=require(_0x94ec('0x17'))(_0x94ec('0x18'));var utils=require(_0x94ec('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x94ec('0x1a'));var db=require('../../mysqldb')['db'];config[_0x94ec('0x1b')]=_[_0x94ec('0x1c')](config[_0x94ec('0x1b')],{'host':_0x94ec('0x1d'),'port':0x18eb});var socket=require(_0x94ec('0x1e'))(new Redis(config[_0x94ec('0x1b')]));require(_0x94ec('0x1f'))[_0x94ec('0x20')](socket);function respondWithStatusCode(_0x5f474b,_0x2aa3){_0x2aa3=_0x2aa3||0xcc;return function(_0x67f827){if(_0x67f827){return _0x5f474b['sendStatus'](_0x2aa3);}return _0x5f474b[_0x94ec('0x21')](_0x2aa3)[_0x94ec('0x22')]();};}function respondWithResult(_0x4aa542,_0xf9cc53){_0xf9cc53=_0xf9cc53||0xc8;return function(_0x40ec1b){if(_0x40ec1b){return _0x4aa542[_0x94ec('0x21')](_0xf9cc53)[_0x94ec('0x23')](_0x40ec1b);}};}function respondWithFilteredResult(_0xf2087b,_0x264d34){return function(_0x2ea05b){if(_0x2ea05b){var _0x52248=typeof _0x264d34['offset']===_0x94ec('0x24')&&typeof _0x264d34[_0x94ec('0x25')]===_0x94ec('0x24');var _0x369cda=_0x2ea05b['count'];var _0x5bdcc9=_0x52248?0x0:_0x264d34['offset'];var _0x136454=_0x52248?_0x2ea05b[_0x94ec('0x26')]:_0x264d34[_0x94ec('0x27')]+_0x264d34[_0x94ec('0x25')];var _0x5864b7;if(_0x136454>=_0x369cda){_0x136454=_0x369cda;_0x5864b7=0xc8;}else{_0x5864b7=0xce;}_0xf2087b[_0x94ec('0x21')](_0x5864b7);return _0xf2087b[_0x94ec('0x28')](_0x94ec('0x29'),_0x5bdcc9+'-'+_0x136454+'/'+_0x369cda)[_0x94ec('0x23')](_0x2ea05b);}return null;};}function patchUpdates(_0x56fbd9){return function(_0x3629a7){try{jsonpatch[_0x94ec('0x2a')](_0x3629a7,_0x56fbd9,!![]);}catch(_0x4f0c9f){return BPromise[_0x94ec('0x2b')](_0x4f0c9f);}return _0x3629a7[_0x94ec('0x2c')]();};}function saveUpdates(_0x415c53,_0x341ada){return function(_0x1b1dc9){if(_0x1b1dc9){return _0x1b1dc9[_0x94ec('0x2d')](_0x415c53)['then'](function(_0x2577e5){return _0x2577e5;});}return null;};}function removeEntity(_0x3a9a1f,_0x10f88a){return function(_0x1318b9){if(_0x1318b9){return _0x1318b9[_0x94ec('0x2e')]()[_0x94ec('0x2f')](function(){_0x3a9a1f[_0x94ec('0x21')](0xcc)[_0x94ec('0x22')]();});}};}function handleEntityNotFound(_0x266097,_0x227e95){return function(_0x4237d3){if(!_0x4237d3){_0x266097['sendStatus'](0x194);}return _0x4237d3;};}function handleError(_0x59013f,_0x400f7e){_0x400f7e=_0x400f7e||0x1f4;return function(_0x4ff80a){logger[_0x94ec('0x30')](_0x4ff80a[_0x94ec('0x31')]);if(_0x4ff80a[_0x94ec('0x32')]){delete _0x4ff80a[_0x94ec('0x32')];}_0x59013f[_0x94ec('0x21')](_0x400f7e)[_0x94ec('0x33')](_0x4ff80a);};}function getMustacheRender(_0x2b43f8,_0x39156a){return Mustache[_0x94ec('0x34')](_0x2b43f8,_[_0x94ec('0x35')](_0x39156a[_0x94ec('0x36')],{'contact':_0x39156a[_0x94ec('0x37')],'message':_0x39156a[_0x94ec('0x38')],'agent':_0x39156a['agent'],'interaction':_0x39156a['interaction'],'account':_0x39156a['account']}))||'';}function getInteractionUsers(_0x11c328,_0x21c4db){return new BPromise(function(_0x154307,_0x3caa75){try{if(_0x21c4db[_0x11c328['id']]){_0x11c328[_0x94ec('0x39')]=_[_0x94ec('0x3a')](_0x21c4db[_0x11c328['id']],function(_0x5ab90d){return{'id':_0x5ab90d['id'],'fullname':_0x5ab90d[_0x94ec('0x3b')]};});}}catch(_0x394c08){_0x3caa75(_0x394c08);}_0x154307(_0x11c328);});}function getInteractionTags(_0x2437ef,_0x2910f8){return new BPromise(function(_0xca56b6,_0x53e744){try{if(_0x2437ef['TagIds']){_0x2437ef[_0x94ec('0x3c')]=[];_0x2437ef['TagIds'][_0x94ec('0x3d')](',')['forEach'](function(_0x177894){_0x2437ef[_0x94ec('0x3c')][_0x94ec('0x3e')](_0x2910f8[_0x177894]);});}delete _0x2437ef['TagIds'];}catch(_0x5a99ae){_0x53e744(_0x5a99ae);}_0xca56b6(_0x2437ef);});}function updateSmsInteraction(_0x22b179,_0x4425b5,_0x3836d0){return new BPromise(function(_0x581ec6,_0x129132){return getInteractionUsers(_0x22b179,_0x3836d0)[_0x94ec('0x2f')](function(_0x26653c){return getInteractionTags(_0x26653c,_0x4425b5);})[_0x94ec('0x2f')](function(_0xfa0e26){_0x581ec6(_0xfa0e26);})[_0x94ec('0x3f')](function(_0x5b8293){_0x129132(_0x5b8293);});});}exports[_0x94ec('0x40')]=function(_0x28411a,_0x4e274a){var _0xb669b0={},_0x373686={},_0x6b51f1={'count':0x0,'rows':[]};var _0x146089=_[_0x94ec('0x3a')](db['SmsInteraction'][_0x94ec('0x41')],function(_0x2ee62d){return{'name':_0x2ee62d[_0x94ec('0x42')],'type':_0x2ee62d['type'][_0x94ec('0x43')]};});_0x373686[_0x94ec('0x44')]=_[_0x94ec('0x3a')](_0x146089,_0x94ec('0x32'));_0x373686['query']=_[_0x94ec('0x45')](_0x28411a['query']);_0x373686[_0x94ec('0x46')]=_[_0x94ec('0x47')](_0x373686[_0x94ec('0x44')],_0x373686[_0x94ec('0x48')]);_0xb669b0[_0x94ec('0x49')]=_[_0x94ec('0x47')](_0x373686[_0x94ec('0x44')],qs['fields'](_0x28411a['query']['fields']));_0xb669b0[_0x94ec('0x49')]=_0xb669b0['attributes'][_0x94ec('0x4a')]?_0xb669b0[_0x94ec('0x49')]:_0x373686[_0x94ec('0x44')];if(!_0x28411a['query'][_0x94ec('0x4b')](_0x94ec('0x4c'))){_0xb669b0[_0x94ec('0x25')]=qs[_0x94ec('0x25')](_0x28411a[_0x94ec('0x48')]['limit']);_0xb669b0[_0x94ec('0x27')]=qs[_0x94ec('0x27')](_0x28411a[_0x94ec('0x48')][_0x94ec('0x27')]);}_0xb669b0['order']=qs['sort'](_0x28411a[_0x94ec('0x48')][_0x94ec('0x4d')]);_0xb669b0[_0x94ec('0x4e')]=qs['filters'](_[_0x94ec('0x4f')](_0x28411a[_0x94ec('0x48')],_0x373686[_0x94ec('0x46')]),_0x146089);var _0x343572=[];var _0x387f64=squel[_0x94ec('0x50')]()['field']('id')[_0x94ec('0x51')](_0x94ec('0x32'))[_0x94ec('0x51')](_0x94ec('0x52'))['from'](_0x94ec('0x53'));var _0x29e565=squel[_0x94ec('0x50')]()[_0x94ec('0x51')](_0x94ec('0x54'))[_0x94ec('0x51')](_0x94ec('0x55'))[_0x94ec('0x51')](_0x94ec('0x56'))['from']('user_has_sms_interactions','ui')[_0x94ec('0x57')](_0x94ec('0x58'),'u',_0x94ec('0x59'));var _0x48bdfd=squel['select']()[_0x94ec('0x5a')]('sms_interactions','i')[_0x94ec('0x57')](_0x94ec('0x5b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x94ec('0x57')](_0x94ec('0x58'),'o','o.id\x20=\x20i.UserId')[_0x94ec('0x57')]('sms_accounts','a',_0x94ec('0x5c'))[_0x94ec('0x57')]('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')[_0x94ec('0x57')]('sms_interaction_has_tags','it',_0x94ec('0x5d'))[_0x94ec('0x57')](_0x94ec('0x53'),'t','t.id\x20=\x20it.TagId');var _0x344351=squel[_0x94ec('0x5e')]();var _0xdd8f5b=[];var _0x3ec87f=squel[_0x94ec('0x5e')]();var _0x9f2c4c;if(_0x28411a[_0x94ec('0x48')]['search']){_0x9f2c4c=as['parseSearch'](_0x28411a[_0x94ec('0x48')][_0x94ec('0x5f')]);var _0x21c366=_0x9f2c4c[_0x94ec('0x60')];for(var _0x4a1ec6=0x0;_0x4a1ec6<_0x9f2c4c[_0x94ec('0x61')][_0x94ec('0x4a')];_0x4a1ec6++){var _0x58e12f=_0x9f2c4c[_0x94ec('0x61')][_0x4a1ec6];var _0x2b466f='i';var _0x23e346=_[_0x94ec('0x62')](_0x146089,['name',_0x58e12f[_0x94ec('0x51')]]);if(!_0x23e346){switch(_0x58e12f[_0x94ec('0x51')]){case _0x94ec('0x63'):if(_0x58e12f[_0x94ec('0x64')]==0x1){_0x48bdfd['having']('`'+_0x58e12f[_0x94ec('0x51')]+_0x94ec('0x65'));}else{_0x48bdfd[_0x94ec('0x66')]('`'+_0x58e12f[_0x94ec('0x51')]+'`\x20>\x200');}break;case _0x94ec('0x67'):if(_0x58e12f['operator']===_0x94ec('0x68')){if(_0x58e12f[_0x94ec('0x64')][_0x94ec('0x3d')]('\x20')[_0x94ec('0x4a')]>0x1){_0x344351[_0x21c366](_0x94ec('0x69'),qs['getFullTextValue'](_0x58e12f['value']),null);}else{var _0x1ed6dd='%'+_0x58e12f[_0x94ec('0x64')]+'%';_0x344351[_0x21c366](_0x94ec('0x6a'),_0x1ed6dd,_0x1ed6dd,_0x1ed6dd);}}else{_0x23e346=_[_0x94ec('0x62')](_0x146089,[_0x94ec('0x32'),_0x94ec('0x6b')]);_0x58e12f[_0x94ec('0x51')]=_0x94ec('0x6b');_0x541b5c=as[_0x94ec('0x6c')](_0x2b466f,_0x23e346['type'],_0x58e12f);_0x344351[_0x21c366](_0x541b5c['text'],_0x541b5c['value'][_0x94ec('0x6d')],_0x541b5c[_0x94ec('0x64')]['end']);}break;case _0x94ec('0x6e'):var _0x1d3fbb=_0x58e12f[_0x94ec('0x64')]['split'](',')['map'](function(_0x1b768b){return Number(_0x1b768b);});_0x1d3fbb['forEach'](function(_0x4658e9){_0x3ec87f['or'](_0x94ec('0x6f'),'%,'+_0x4658e9+',%');});_0xdd8f5b=_['union'](_0xdd8f5b,_0x1d3fbb);break;case _0x94ec('0x70'):if(_0x58e12f['operator']===_0x94ec('0x68')){_0x344351[_0x21c366]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x58e12f[_0x94ec('0x64')]+'%',null);}else{_0x23e346=_[_0x94ec('0x62')](_0x146089,[_0x94ec('0x32'),_0x94ec('0x71')]);_0x58e12f[_0x94ec('0x51')]=_0x94ec('0x71');_0x541b5c=as[_0x94ec('0x6c')](_0x2b466f,_0x23e346[_0x94ec('0x72')],_0x58e12f);_0x344351[_0x21c366](_0x541b5c[_0x94ec('0x73')],_0x541b5c[_0x94ec('0x64')][_0x94ec('0x6d')],_0x541b5c[_0x94ec('0x64')][_0x94ec('0x22')]);}break;case'body':_0x541b5c=as[_0x94ec('0x6c')]('me',null,_0x58e12f);_0x344351[_0x21c366](_0x541b5c[_0x94ec('0x73')],_0x541b5c[_0x94ec('0x64')][_0x94ec('0x6d')],_0x541b5c['value']['end']);break;}}else{var _0x541b5c=as[_0x94ec('0x6c')](_0x2b466f,_0x23e346[_0x94ec('0x72')],_0x58e12f);_0x344351[_0x21c366](_0x541b5c[_0x94ec('0x73')],_0x541b5c['value'][_0x94ec('0x6d')],_0x541b5c['value']['end']);}}}else{var _0x5bceaf=_(_0x28411a[_0x94ec('0x48')])[_0x94ec('0x45')]()[_0x94ec('0x3a')](function(_0x4c507){return _['some'](_0x146089,[_0x94ec('0x32'),_0x4c507])?_0x4c507:undefined;})['compact']()[_0x94ec('0x64')]();if(!_[_0x94ec('0x74')](_0x5bceaf)){_0x5bceaf['forEach'](function(_0xce3500){if(_0xce3500==='SmsAccountId'){_0x48bdfd[_0x94ec('0x4e')](_0x94ec('0x75'),[]['concat'](_0x28411a[_0x94ec('0x48')][_0xce3500]));}else if(_0xce3500===_0x94ec('0x76')){var _0x53102a=JSON[_0x94ec('0x77')](_0x28411a[_0x94ec('0x48')][_0xce3500])[_0x94ec('0x78')];var _0x80f95c=JSON[_0x94ec('0x77')](_0x28411a[_0x94ec('0x48')][_0xce3500])[_0x94ec('0x79')];_0x48bdfd['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x53102a,_0x80f95c);}else{if(_0x28411a[_0x94ec('0x48')][_0xce3500]===_0x94ec('0x7a')){_0x48bdfd[_0x94ec('0x4e')]('i.'+_0xce3500+_0x94ec('0x7b'));}else{_0x48bdfd[_0x94ec('0x4e')]('i.'+_0xce3500+_0x94ec('0x7c'),_0x28411a[_0x94ec('0x48')][_0xce3500]);}}});}if(_0x28411a[_0x94ec('0x48')][_0x94ec('0x7d')]){if(_0x28411a[_0x94ec('0x48')][_0x94ec('0x7d')]==0x1){_0x48bdfd[_0x94ec('0x66')](_0x94ec('0x7e'));}else{_0x48bdfd[_0x94ec('0x66')](_0x94ec('0x7f'));}}if(_0x28411a[_0x94ec('0x48')]['tag']){_0xdd8f5b=_[_0x94ec('0x80')](_0x28411a[_0x94ec('0x48')]['tag'])?_0x28411a[_0x94ec('0x48')][_0x94ec('0x81')]:new Array(_0x28411a[_0x94ec('0x48')][_0x94ec('0x81')]);_0xdd8f5b[_0x94ec('0x82')](function(_0x3d6414){_0x3ec87f['or'](_0x94ec('0x6f'),'%,'+_0x3d6414+',%');});}if(_0x28411a['query']['filter']){var _0x4d1f39=_0x28411a['query'][_0x94ec('0x83')]['replace']('\x5c','\x5c\x5c')[_0x94ec('0x84')](/'/g,'\x27\x27');if(qs[_0x94ec('0x85')](_0x4d1f39)){_0x344351['or']('i.id\x20LIKE\x20?',_0x4d1f39+'%')['or'](_0x94ec('0x86'),_0x4d1f39+'%');}else{_0x344351['or'](_0x94ec('0x87'),qs[_0x94ec('0x88')](_0x4d1f39))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4d1f39+'%');}}}_0x48bdfd['where'](_0x344351);_0x48bdfd['group'](_0x94ec('0x89'));var _0x35d076={'type':db['Sequelize'][_0x94ec('0x8a')]['SELECT'],'raw':!![]};var _0x2cac65=_0x48bdfd[_0x94ec('0x8b')]();_0x2cac65['field'](_0x94ec('0x89'));_0x2cac65[_0x94ec('0x51')](_0x94ec('0x8c'),'unreadMessages');if(_0xb669b0[_0x94ec('0x8d')]){_0xb669b0[_0x94ec('0x8d')]['forEach'](function(_0x5349ef){var _0x10cece=_0x5349ef[0x0]==='contactName'?_0x5349ef[0x0]:'i.'+_0x5349ef[0x0];_0x48bdfd[_0x94ec('0x8d')](_0x10cece,_0x5349ef[0x1]===_0x94ec('0x8e')?![]:!![]);});}if(!_[_0x94ec('0x74')](_0xdd8f5b)){_0x48bdfd[_0x94ec('0x66')](_0x3ec87f);_0x2cac65[_0x94ec('0x4e')](_0x94ec('0x8f'),_0xdd8f5b);}BPromise[_0x94ec('0x90')]()['then'](function(){if(!_0x9f2c4c){if(_0x28411a['query'][_0x94ec('0x91')])return;_0x2cac65[_0x94ec('0x4e')](_0x94ec('0x92'));_0x48bdfd[_0x94ec('0x4e')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x28411a[_0x94ec('0x93')][_0x94ec('0x94')]!==_0x94ec('0x95'))return;return _0x28411a['user'][_0x94ec('0x96')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5075ed){if(_['isEmpty'](_0x5075ed)){_0x2cac65[_0x94ec('0x4e')](_0x94ec('0x97'));_0x48bdfd[_0x94ec('0x4e')](_0x94ec('0x97'));}else{_0x2cac65['where'](_0x94ec('0x75'),_['map'](_0x5075ed,'id'));_0x48bdfd[_0x94ec('0x4e')](_0x94ec('0x75'),_[_0x94ec('0x3a')](_0x5075ed,'id'));}});})[_0x94ec('0x2f')](function(){if(_0x28411a[_0x94ec('0x93')]['role']===_0x94ec('0x95')&&!_0x9f2c4c&&!_0x28411a[_0x94ec('0x48')][_0x94ec('0x91')])return[];return db[_0x94ec('0x98')]['query'](_0x2cac65[_0x94ec('0x99')](),_0x35d076);})[_0x94ec('0x2f')](function(_0x184c75){_0x6b51f1['count']=_0x184c75[_0x94ec('0x4a')];if(_0x6b51f1[_0x94ec('0x26')]===0x0)return[];return db[_0x94ec('0x98')]['query'](_0x387f64['toString'](),_0x35d076)[_0x94ec('0x2f')](function(_0x4f7f53){_0x343572=_[_0x94ec('0x9a')](_0x4f7f53,'id');_0x35d076=_[_0x94ec('0x35')](_0x35d076,{'model':db[_0x94ec('0x9b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x28411a[_0x94ec('0x48')][_0x94ec('0x9c')]){_0xb669b0['attributes'][_0x94ec('0x82')](function(_0x1aeb05){_0x48bdfd[_0x94ec('0x51')]('i.'+_0x1aeb05);});}else{_0x48bdfd['field'](_0x94ec('0x8c'),_0x94ec('0x63'));_0x48bdfd[_0x94ec('0x51')](_0x94ec('0x9d'),'Account.key');_0x48bdfd[_0x94ec('0x51')]('a.mandatoryDisposition',_0x94ec('0x9e'));_0x48bdfd[_0x94ec('0x51')](_0x94ec('0x9f'),_0x94ec('0xa0'));_0x48bdfd['field'](_0x94ec('0xa1'));_0x48bdfd[_0x94ec('0x51')](_0x94ec('0xa2'),_0x94ec('0xa3'));_0x48bdfd['field'](_0x94ec('0xa4'),_0x94ec('0xa5'));_0x48bdfd[_0x94ec('0x51')](_0x94ec('0xa6'),'Contact.email');_0x48bdfd[_0x94ec('0x51')]('c.phone','Contact.phone');_0x48bdfd['field']('c.mobile',_0x94ec('0xa7'));_0x48bdfd['field'](_0x94ec('0xa8'),_0x94ec('0xa9'));_0x48bdfd[_0x94ec('0x51')]('o.fullname',_0x94ec('0xaa'));_0x48bdfd[_0x94ec('0x51')](_0x94ec('0xab'),_0x94ec('0xac'));_0x48bdfd[_0x94ec('0x51')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x94ec('0xad'));}if(_0xb669b0[_0x94ec('0x25')])_0x48bdfd[_0x94ec('0x25')](_0xb669b0[_0x94ec('0x25')]);if(_0xb669b0[_0x94ec('0x27')])_0x48bdfd['offset'](_0xb669b0[_0x94ec('0x27')]);return db[_0x94ec('0x98')][_0x94ec('0x48')](_0x48bdfd[_0x94ec('0x99')](),_0x35d076);})['then'](function(_0x352391){if(_0x352391['length']>0x0)_0x29e565['where'](_0x94ec('0xae'),_['map'](_0x352391,'id'));return db[_0x94ec('0x98')]['query'](_0x29e565[_0x94ec('0x99')](),_0x35d076)[_0x94ec('0x2f')](function(_0x172466){var _0x4a9e89=_[_0x94ec('0xaf')](_0x172466,_0x94ec('0xb0'));var _0x11d759=[];_0x352391[_0x94ec('0x82')](function(_0x44085a){_0x11d759[_0x94ec('0x3e')](updateSmsInteraction(_0x44085a,_0x343572,_0x4a9e89));});return BPromise['all'](_0x11d759);});});})['then'](function(_0x46da4e){_0x6b51f1[_0x94ec('0xb1')]=_0x46da4e;return _0x6b51f1;})[_0x94ec('0x2f')](respondWithFilteredResult(_0x4e274a,_0xb669b0))['catch'](handleError(_0x4e274a,null));};exports[_0x94ec('0xb2')]=function(_0x59e5df,_0xc4d80d){var _0x3756e5={'raw':![],'where':{'id':_0x59e5df[_0x94ec('0xb3')]['id']}},_0x19275b={};_0x19275b[_0x94ec('0x44')]=_['keys'](db[_0x94ec('0x9b')][_0x94ec('0x41')]);_0x19275b['query']=_[_0x94ec('0x45')](_0x59e5df[_0x94ec('0x48')]);_0x19275b[_0x94ec('0x46')]=_[_0x94ec('0x47')](_0x19275b[_0x94ec('0x44')],_0x19275b[_0x94ec('0x48')]);_0x3756e5[_0x94ec('0x49')]=_[_0x94ec('0x47')](_0x19275b[_0x94ec('0x44')],qs[_0x94ec('0x9c')](_0x59e5df[_0x94ec('0x48')][_0x94ec('0x9c')]));_0x3756e5[_0x94ec('0x49')]=_0x3756e5['attributes'][_0x94ec('0x4a')]?_0x3756e5[_0x94ec('0x49')]:_0x19275b[_0x94ec('0x44')];if(_0x59e5df[_0x94ec('0x48')]['includeAll']){_0x3756e5[_0x94ec('0xb4')]=[{'all':!![]}];}_0x3756e5=_[_0x94ec('0x35')]({},_0x3756e5,_0x59e5df[_0x94ec('0xb5')]);return db['SmsInteraction'][_0x94ec('0x62')](_0x3756e5)[_0x94ec('0x2f')](handleEntityNotFound(_0xc4d80d,null))[_0x94ec('0x2f')](respondWithResult(_0xc4d80d,null))['catch'](handleError(_0xc4d80d,null));};exports[_0x94ec('0xb6')]=function(_0x43104e,_0x488f04){return db[_0x94ec('0x9b')][_0x94ec('0xb6')](_0x43104e['body'],{})['then'](respondWithResult(_0x488f04,0xc9))[_0x94ec('0x3f')](handleError(_0x488f04,null));};exports['update']=function(_0x114db1,_0xaa4a15){if(_0x114db1[_0x94ec('0x36')]['id']){delete _0x114db1[_0x94ec('0x36')]['id'];}return db[_0x94ec('0x9b')][_0x94ec('0x62')]({'where':{'id':_0x114db1[_0x94ec('0xb3')]['id']}})['then'](handleEntityNotFound(_0xaa4a15,null))['then'](saveUpdates(_0x114db1['body'],null))[_0x94ec('0x2f')](respondWithResult(_0xaa4a15,null))[_0x94ec('0x3f')](handleError(_0xaa4a15,null));};exports[_0x94ec('0x2e')]=function(_0xa40e6e,_0x5dbc3f){return db[_0x94ec('0x9b')][_0x94ec('0x62')]({'where':{'id':_0xa40e6e[_0x94ec('0xb3')]['id']}})['then'](handleEntityNotFound(_0x5dbc3f,null))[_0x94ec('0x2f')](removeEntity(_0x5dbc3f,null))[_0x94ec('0x3f')](handleError(_0x5dbc3f,null));};exports[_0x94ec('0xb7')]=function(_0x5ba20e,_0x568db6){return db[_0x94ec('0x9b')][_0x94ec('0xb7')]()[_0x94ec('0x2f')](respondWithResult(_0x568db6,null))[_0x94ec('0x3f')](handleError(_0x568db6,null));};exports[_0x94ec('0xb8')]=function(_0x1b3a10,_0x434dee,_0x26d9fb){return db[_0x94ec('0xb9')][_0x94ec('0x62')]({'where':{'id':_0x1b3a10[_0x94ec('0xb3')]['id']}})['then'](handleEntityNotFound(_0x434dee,null))[_0x94ec('0x2f')](function(_0xa682db){if(_0xa682db){return _0xa682db['addMessage'](_0x1b3a10[_0x94ec('0x36')][_0x94ec('0xba')],_['omit'](_0x1b3a10[_0x94ec('0x36')],[_0x94ec('0xba'),'id'])||{});}})[_0x94ec('0x2f')](respondWithResult(_0x434dee,null))[_0x94ec('0x3f')](handleError(_0x434dee,null));};exports[_0x94ec('0xbb')]=function(_0x30e587,_0x37847c,_0x24c482){var _0x5e6c39={'raw':![],'where':{}};var _0xba0185={};var _0x507fcf={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x94ec('0xbc')]({'where':{'id':_0x30e587[_0x94ec('0xb3')]['id']}})[_0x94ec('0x2f')](handleEntityNotFound(_0x37847c,null))['then'](function(_0x2e8dee){if(_0x2e8dee){_0xba0185['model']=_['keys'](db[_0x94ec('0xb9')][_0x94ec('0x41')]);_0xba0185['query']=_['keys'](_0x30e587[_0x94ec('0x48')]);_0xba0185['filters']=_[_0x94ec('0x47')](_0xba0185[_0x94ec('0x44')],_0xba0185[_0x94ec('0x48')]);_0x5e6c39[_0x94ec('0x49')]=_[_0x94ec('0x47')](_0xba0185['model'],qs['fields'](_0x30e587[_0x94ec('0x48')][_0x94ec('0x9c')]));_0x5e6c39[_0x94ec('0x49')]=_0x5e6c39[_0x94ec('0x49')][_0x94ec('0x4a')]?_0x5e6c39[_0x94ec('0x49')]:_0xba0185['model'];if(!_0x30e587[_0x94ec('0x48')][_0x94ec('0x4b')](_0x94ec('0x4c'))){_0x5e6c39['limit']=qs[_0x94ec('0x25')](_0x30e587[_0x94ec('0x48')]['limit']);_0x5e6c39['offset']=qs[_0x94ec('0x27')](_0x30e587[_0x94ec('0x48')][_0x94ec('0x27')]);}_0x5e6c39[_0x94ec('0x8d')]=qs[_0x94ec('0x4d')](_0x30e587[_0x94ec('0x48')][_0x94ec('0x4d')]);_0x5e6c39['where']=qs[_0x94ec('0x46')](_[_0x94ec('0x4f')](_0x30e587[_0x94ec('0x48')],_0xba0185[_0x94ec('0x46')]));_0x5e6c39[_0x94ec('0x4e')][_0x94ec('0xb0')]=_0x2e8dee['id'];if(_0x30e587[_0x94ec('0x48')][_0x94ec('0x83')]){_0x5e6c39[_0x94ec('0x4e')]=_[_0x94ec('0x35')](_0x5e6c39[_0x94ec('0x4e')],{'$or':_[_0x94ec('0x3a')](_0x5e6c39[_0x94ec('0x49')],function(_0x112378){var _0x542af8={};_0x542af8[_0x112378]={'$like':'%'+_0x30e587['query'][_0x94ec('0x83')]+'%'};return _0x542af8;})});}if(_0x30e587['query'][_0x94ec('0x78')]){var _0x296300=_0x30e587[_0x94ec('0x48')][_0x94ec('0x78')][_0x94ec('0x3d')](',');var _0x34b715={};_0x34b715[_0x296300[0x0]]={'$gte':moment(_0x296300[0x1])[_0x94ec('0xbd')](_0x94ec('0xbe'))};_0x5e6c39['where']=_['merge'](_0x5e6c39['where'],_0x34b715);}_0x5e6c39=_[_0x94ec('0x35')]({},_0x5e6c39,_0x30e587[_0x94ec('0xb5')]);return db[_0x94ec('0xb9')][_0x94ec('0x26')]({'where':_0x5e6c39[_0x94ec('0x4e')]})[_0x94ec('0x2f')](function(_0x488f55){_0x507fcf[_0x94ec('0x26')]=_0x488f55;if(_0x30e587[_0x94ec('0x48')][_0x94ec('0xbf')]){_0x5e6c39[_0x94ec('0xb4')]=[{'all':!![]}];}return db[_0x94ec('0xb9')][_0x94ec('0xc0')](_0x5e6c39);})[_0x94ec('0x2f')](function(_0x55ef48){_0x507fcf[_0x94ec('0xb1')]=_0x55ef48;return _0x507fcf;});}})[_0x94ec('0x2f')](respondWithFilteredResult(_0x37847c,_0x5e6c39))[_0x94ec('0x3f')](handleError(_0x37847c,null));};exports[_0x94ec('0xc1')]=function(_0x2f8da7,_0x3ba1c,_0x5c13d3){return db['SmsInteraction']['find']({'where':{'id':_0x2f8da7['params']['id']}})[_0x94ec('0x2f')](handleEntityNotFound(_0x3ba1c,null))['then'](function(_0x3a8a3e){if(_0x3a8a3e){return _0x3a8a3e[_0x94ec('0xc2')](_0x2f8da7[_0x94ec('0x36')][_0x94ec('0xba')],_[_0x94ec('0xc3')](_0x2f8da7['body'],[_0x94ec('0xba'),'id'])||{})['spread'](function(){return db[_0x94ec('0x6e')][_0x94ec('0xc0')]({'attributes':['id',_0x94ec('0x32'),'color'],'where':{'id':_0x2f8da7[_0x94ec('0x36')]['ids']}});})[_0x94ec('0x2f')](function(_0x3678fa){socket[_0x94ec('0xc4')](_0x94ec('0xc5'),{'id':Number(_0x2f8da7[_0x94ec('0xb3')]['id']),'tags':_0x3678fa||[]});return{'id':Number(_0x2f8da7['params']['id']),'tags':_0x3678fa||[]};});}})['then'](respondWithResult(_0x3ba1c,null))[_0x94ec('0x3f')](handleError(_0x3ba1c,null));};exports['removeTags']=function(_0x5509fe,_0x5b7f56,_0x23d38c){return db[_0x94ec('0x9b')][_0x94ec('0x62')]({'where':{'id':_0x5509fe[_0x94ec('0xb3')]['id']}})[_0x94ec('0x2f')](handleEntityNotFound(_0x5b7f56,null))['then'](function(_0xf73b26){if(_0xf73b26){return _0xf73b26['removeTags'](_0x5509fe['query'][_0x94ec('0xba')]);}})['then'](respondWithStatusCode(_0x5b7f56,null))[_0x94ec('0x3f')](handleError(_0x5b7f56,null));};exports[_0x94ec('0xc6')]=function(_0x56a9df,_0x5dde3e){var _0x5b2997=moment()[_0x94ec('0xc7')]()[_0x94ec('0x99')]();var _0x40b14d=path[_0x94ec('0xc8')](config[_0x94ec('0xc9')],'server',_0x94ec('0xca'),'tmp');var _0x8d1159=path[_0x94ec('0xc8')](config[_0x94ec('0xc9')],_0x94ec('0xcb'),_0x94ec('0xca'),_0x94ec('0xcc'));var _0x49bc9f=path[_0x94ec('0xc8')](_0x40b14d,_0x5b2997);var _0x510d9d=util['format'](_0x94ec('0xcd'),_0x56a9df['params']['id'],_0x5b2997);var _0x2049dc=path[_0x94ec('0xc8')](_0x40b14d,_0x510d9d);var _0x326ae0=[];_0x326ae0['push']({'model':db['User'],'as':_0x94ec('0x70'),'attributes':['id','fullname'],'raw':!![]});_0x326ae0['push']({'model':db['CmContact'],'as':_0x94ec('0x67'),'attributes':['id',_0x94ec('0xce'),_0x94ec('0xcf')],'raw':!![]});var _0x2390f2=[{'model':db[_0x94ec('0xb9')],'as':_0x94ec('0xd0'),'attributes':['id',_0x94ec('0x36'),_0x94ec('0x76'),_0x94ec('0xd1'),_0x94ec('0xd2'),_0x94ec('0x7d')],'include':_0x326ae0}];_0x2390f2[_0x94ec('0x3e')]({'model':db[_0x94ec('0xd3')],'as':_0x94ec('0xd4'),'attributes':['id',_0x94ec('0x32')]});_0x2390f2['push']({'model':db[_0x94ec('0x70')],'as':_0x94ec('0xd5'),'attributes':['id',_0x94ec('0x3b')]});return db[_0x94ec('0x9b')][_0x94ec('0x62')]({'where':{'id':_0x56a9df[_0x94ec('0xb3')]['id']},'include':_0x2390f2})['then'](handleEntityNotFound(_0x5dde3e,null))[_0x94ec('0x2f')](function(_0x243e8f){if(_0x243e8f){var _0x8ba00f=_0x243e8f[_0x94ec('0xd6')]({'plain':!![]});fs[_0x94ec('0xd7')](_0x49bc9f);var _0x172bd7={'channel':_0x94ec('0xd8'),'account':_0x8ba00f['Account'][_0x94ec('0x32')],'agent':_0x8ba00f[_0x94ec('0xd5')]?_0x8ba00f['Owner'][_0x94ec('0x3b')]:_0x94ec('0xd9'),'createdAt':moment(_0x8ba00f[_0x94ec('0x76')])['format'](_0x94ec('0xbe'))[_0x94ec('0x99')](),'closedAt':_0x8ba00f[_0x94ec('0xda')]?moment(_0x8ba00f[_0x94ec('0xdb')])[_0x94ec('0xbd')](_0x94ec('0xbe'))[_0x94ec('0x99')]():'','disposition':_0x8ba00f[_0x94ec('0xdc')],'messages':_(_0x8ba00f[_0x94ec('0xd0')])[_0x94ec('0x83')]({'secret':![]})[_0x94ec('0x3a')](function(_0x449027){return{'date':moment(_0x449027[_0x94ec('0x76')])[_0x94ec('0xbd')](_0x94ec('0xbe'))[_0x94ec('0x99')](),'sender':_0x449027[_0x94ec('0xd1')]===_0x94ec('0xdd')?_0x449027[_0x94ec('0x70')]?_0x449027[_0x94ec('0x70')][_0x94ec('0x3b')]:_0x94ec('0xde'):_0x449027['Contact']['firstName']+(_0x449027[_0x94ec('0x67')][_0x94ec('0xcf')]?'\x20'+_0x449027[_0x94ec('0x67')][_0x94ec('0xcf')]:''),'body':_0x449027['body'],'direction':_0x449027[_0x94ec('0xd1')]===_0x94ec('0xdd')?'A':'C','secret':_0x449027[_0x94ec('0xd2')],'read':_0x449027[_0x94ec('0x7d')]};})[_0x94ec('0x64')]()};return ejs[_0x94ec('0xdf')](path[_0x94ec('0xc8')](config[_0x94ec('0xc9')],_0x94ec('0xcb'),_0x94ec('0xe0'),_0x94ec('0xe1')),{'interaction':_0x172bd7})[_0x94ec('0x2f')](function(_0x3857d1){var _0xff8c10=path[_0x94ec('0xc8')](_0x49bc9f,_0x94ec('0xe2')+_0x8ba00f['id']+'-'+_0x5b2997+_0x94ec('0xe3'));var _0x2c6f04={'path':_0xff8c10,'channel':_0x94ec('0xd8'),'interactionId':_0x8ba00f['id']};return pdf[_0x94ec('0xe4')](_0x3857d1,_0x2c6f04);})[_0x94ec('0x2f')](function(){return new BPromise(function(_0x5acde8,_0x13b105){zipdir(_0x49bc9f,{'saveTo':_0x2049dc},function(_0x571c95,_0x3b5bf8){if(_0x571c95)return _0x13b105(_0x571c95);return _0x5acde8(_0x3b5bf8);});})[_0x94ec('0x2f')](function(){return new BPromise(function(_0x5f18d6,_0x23b824){rimraf(_0x49bc9f,function(_0x2c5986){if(_0x2c5986)_0x23b824(_0x2c5986);return _0x5f18d6();});});})[_0x94ec('0x2f')](function(){return _0x5dde3e['download'](_0x2049dc,_0x510d9d,function(_0x59d82d){if(_0x59d82d){console[_0x94ec('0xe5')]('err',_0x59d82d);}else{fs[_0x94ec('0xe6')](_0x2049dc);}});});});}else{return _0x5dde3e[_0x94ec('0xe7')](0xc8);}})[_0x94ec('0x3f')](handleError(_0x5dde3e,null));}; \ No newline at end of file +var _0xa1ec=['`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','isEmpty','i.SmsAccountId\x20IS\x20NULL','sequelize','keyBy','SmsInteraction','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.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.SmsInteractionId\x20IN\x20?','groupBy','all','rows','params','includeAll','include','options','create','update','destroy','describe','addMessage','SmsMessage','getMessages','findOne','pick','merge','format','addTags','setTags','ids','omit','spread','findAll','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','User','fullname','firstName','Messages','direction','SmsAccount','Owner','mkdirSync','Sms','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','System','lastName','secret','renderFile','views','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../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','defaults','redis','socket.io-emitter','./smsInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','body','contact','message','agent','interaction','account','Users','map','TagIds','Tags','split','forEach','push','catch','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','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','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read'];(function(_0x2aeb4b,_0x26574a){var _0x37a31b=function(_0x52e49b){while(--_0x52e49b){_0x2aeb4b['push'](_0x2aeb4b['shift']());}};_0x37a31b(++_0x26574a);}(_0xa1ec,0x15f));var _0xca1e=function(_0x4dd063,_0x386d0c){_0x4dd063=_0x4dd063-0x0;var _0x2b8747=_0xa1ec[_0x4dd063];return _0x2b8747;};'use strict';var emlformat=require(_0xca1e('0x0'));var rimraf=require(_0xca1e('0x1'));var zipdir=require(_0xca1e('0x2'));var jsonpatch=require(_0xca1e('0x3'));var rp=require(_0xca1e('0x4'));var moment=require(_0xca1e('0x5'));var BPromise=require(_0xca1e('0x6'));var Mustache=require(_0xca1e('0x7'));var util=require(_0xca1e('0x8'));var path=require('path');var sox=require(_0xca1e('0x9'));var csv=require('to-csv');var ejs=require(_0xca1e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca1e('0xb'));var squel=require(_0xca1e('0xc'));var crypto=require(_0xca1e('0xd'));var jsforce=require(_0xca1e('0xe'));var deskjs=require(_0xca1e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xca1e('0x10'));var Papa=require(_0xca1e('0x11'));var Redis=require('ioredis');var authService=require(_0xca1e('0x12'));var qs=require(_0xca1e('0x13'));var as=require(_0xca1e('0x14'));var pdf=require(_0xca1e('0x15'));var hardwareService=require(_0xca1e('0x16'));var logger=require(_0xca1e('0x17'))(_0xca1e('0x18'));var utils=require(_0xca1e('0x19'));var config=require(_0xca1e('0x1a'));var licenseUtil=require(_0xca1e('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xca1e('0x1c')](config[_0xca1e('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xca1e('0x1e'))(new Redis(config[_0xca1e('0x1d')]));require(_0xca1e('0x1f'))[_0xca1e('0x20')](socket);function respondWithStatusCode(_0x17f3b3,_0x17d07b){_0x17d07b=_0x17d07b||0xcc;return function(_0x50e61d){if(_0x50e61d){return _0x17f3b3['sendStatus'](_0x17d07b);}return _0x17f3b3[_0xca1e('0x21')](_0x17d07b)[_0xca1e('0x22')]();};}function respondWithResult(_0x37f0e9,_0x57c039){_0x57c039=_0x57c039||0xc8;return function(_0x564422){if(_0x564422){return _0x37f0e9[_0xca1e('0x21')](_0x57c039)[_0xca1e('0x23')](_0x564422);}};}function respondWithFilteredResult(_0x508f6c,_0x5c16f0){return function(_0x16ea2f){if(_0x16ea2f){var _0xb0bf78=typeof _0x5c16f0[_0xca1e('0x24')]===_0xca1e('0x25')&&typeof _0x5c16f0[_0xca1e('0x26')]===_0xca1e('0x25');var _0x28ec44=_0x16ea2f[_0xca1e('0x27')];var _0x2c63ef=_0xb0bf78?0x0:_0x5c16f0[_0xca1e('0x24')];var _0x2f97d0=_0xb0bf78?_0x16ea2f[_0xca1e('0x27')]:_0x5c16f0['offset']+_0x5c16f0[_0xca1e('0x26')];var _0x4df04b;if(_0x2f97d0>=_0x28ec44){_0x2f97d0=_0x28ec44;_0x4df04b=0xc8;}else{_0x4df04b=0xce;}_0x508f6c[_0xca1e('0x21')](_0x4df04b);return _0x508f6c[_0xca1e('0x28')](_0xca1e('0x29'),_0x2c63ef+'-'+_0x2f97d0+'/'+_0x28ec44)['json'](_0x16ea2f);}return null;};}function patchUpdates(_0x5aa50a){return function(_0x563977){try{jsonpatch[_0xca1e('0x2a')](_0x563977,_0x5aa50a,!![]);}catch(_0x3189bb){return BPromise[_0xca1e('0x2b')](_0x3189bb);}return _0x563977[_0xca1e('0x2c')]();};}function saveUpdates(_0x23bc2c,_0x1ea040){return function(_0x39a695){if(_0x39a695){return _0x39a695['update'](_0x23bc2c)[_0xca1e('0x2d')](function(_0x2b5c2e){return _0x2b5c2e;});}return null;};}function removeEntity(_0x401a1b,_0xf59b81){return function(_0x22e0aa){if(_0x22e0aa){return _0x22e0aa['destroy']()[_0xca1e('0x2d')](function(){_0x401a1b[_0xca1e('0x21')](0xcc)[_0xca1e('0x22')]();});}};}function handleEntityNotFound(_0x31f68d,_0x445561){return function(_0x3612ac){if(!_0x3612ac){_0x31f68d[_0xca1e('0x2e')](0x194);}return _0x3612ac;};}function handleError(_0x1baa9a,_0x218557){_0x218557=_0x218557||0x1f4;return function(_0x4bc769){logger[_0xca1e('0x2f')](_0x4bc769[_0xca1e('0x30')]);if(_0x4bc769[_0xca1e('0x31')]){delete _0x4bc769['name'];}_0x1baa9a['status'](_0x218557)[_0xca1e('0x32')](_0x4bc769);};}function getMustacheRender(_0xd94e77,_0x484649){return Mustache['render'](_0xd94e77,_['merge'](_0x484649[_0xca1e('0x33')],{'contact':_0x484649[_0xca1e('0x34')],'message':_0x484649[_0xca1e('0x35')],'agent':_0x484649[_0xca1e('0x36')],'interaction':_0x484649[_0xca1e('0x37')],'account':_0x484649[_0xca1e('0x38')]}))||'';}function getInteractionUsers(_0xdf27f,_0x1bbe3f){return new BPromise(function(_0x5159a2,_0x53dc15){try{if(_0x1bbe3f[_0xdf27f['id']]){_0xdf27f[_0xca1e('0x39')]=_[_0xca1e('0x3a')](_0x1bbe3f[_0xdf27f['id']],function(_0x1905f8){return{'id':_0x1905f8['id'],'fullname':_0x1905f8['fullname']};});}}catch(_0xbd2ef6){_0x53dc15(_0xbd2ef6);}_0x5159a2(_0xdf27f);});}function getInteractionTags(_0x193396,_0x64e1fe){return new BPromise(function(_0x249aab,_0x35faf6){try{if(_0x193396[_0xca1e('0x3b')]){_0x193396[_0xca1e('0x3c')]=[];_0x193396[_0xca1e('0x3b')][_0xca1e('0x3d')](',')[_0xca1e('0x3e')](function(_0x5b0441){_0x193396[_0xca1e('0x3c')][_0xca1e('0x3f')](_0x64e1fe[_0x5b0441]);});}delete _0x193396[_0xca1e('0x3b')];}catch(_0x49e43a){_0x35faf6(_0x49e43a);}_0x249aab(_0x193396);});}function updateSmsInteraction(_0x481685,_0x201bdf,_0x8a7b69){return new BPromise(function(_0x2a585e,_0x233fb9){return getInteractionUsers(_0x481685,_0x8a7b69)[_0xca1e('0x2d')](function(_0x308726){return getInteractionTags(_0x308726,_0x201bdf);})[_0xca1e('0x2d')](function(_0x313c22){_0x2a585e(_0x313c22);})[_0xca1e('0x40')](function(_0x25c5b3){_0x233fb9(_0x25c5b3);});});}exports['index']=function(_0x3fcd26,_0x4ba4a3){var _0x34670d={},_0x13145c={},_0x54ac4f={'count':0x0,'rows':[]};var _0xa717a8=_[_0xca1e('0x3a')](db['SmsInteraction'][_0xca1e('0x41')],function(_0x93c160){return{'name':_0x93c160['fieldName'],'type':_0x93c160[_0xca1e('0x42')][_0xca1e('0x43')]};});_0x13145c[_0xca1e('0x44')]=_[_0xca1e('0x3a')](_0xa717a8,_0xca1e('0x31'));_0x13145c[_0xca1e('0x45')]=_[_0xca1e('0x46')](_0x3fcd26[_0xca1e('0x45')]);_0x13145c[_0xca1e('0x47')]=_[_0xca1e('0x48')](_0x13145c[_0xca1e('0x44')],_0x13145c['query']);_0x34670d['attributes']=_['intersection'](_0x13145c[_0xca1e('0x44')],qs[_0xca1e('0x49')](_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x49')]));_0x34670d[_0xca1e('0x4a')]=_0x34670d['attributes'][_0xca1e('0x4b')]?_0x34670d[_0xca1e('0x4a')]:_0x13145c[_0xca1e('0x44')];if(!_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x4c')](_0xca1e('0x4d'))){_0x34670d[_0xca1e('0x26')]=qs['limit'](_0x3fcd26['query'][_0xca1e('0x26')]);_0x34670d[_0xca1e('0x24')]=qs['offset'](_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x24')]);}_0x34670d['order']=qs[_0xca1e('0x4e')](_0x3fcd26['query'][_0xca1e('0x4e')]);_0x34670d[_0xca1e('0x4f')]=qs[_0xca1e('0x47')](_['pick'](_0x3fcd26[_0xca1e('0x45')],_0x13145c['filters']),_0xa717a8);var _0x7856e5=[];var _0x21e2a5=squel[_0xca1e('0x50')]()[_0xca1e('0x51')]('id')[_0xca1e('0x51')](_0xca1e('0x31'))[_0xca1e('0x51')](_0xca1e('0x52'))[_0xca1e('0x53')](_0xca1e('0x54'));var _0x421e29=squel[_0xca1e('0x50')]()['field'](_0xca1e('0x55'))[_0xca1e('0x51')](_0xca1e('0x56'))[_0xca1e('0x51')]('ui.SmsInteractionId')[_0xca1e('0x53')](_0xca1e('0x57'),'ui')['left_join'](_0xca1e('0x58'),'u','u.id\x20=\x20ui.UserId');var _0x73f9e1=squel[_0xca1e('0x50')]()[_0xca1e('0x53')](_0xca1e('0x59'),'i')['left_join'](_0xca1e('0x5a'),'c',_0xca1e('0x5b'))[_0xca1e('0x5c')](_0xca1e('0x58'),'o',_0xca1e('0x5d'))[_0xca1e('0x5c')](_0xca1e('0x5e'),'a',_0xca1e('0x5f'))[_0xca1e('0x5c')]('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')[_0xca1e('0x5c')](_0xca1e('0x60'),'it',_0xca1e('0x61'))[_0xca1e('0x5c')](_0xca1e('0x54'),'t',_0xca1e('0x62'));var _0x240b08=squel[_0xca1e('0x63')]();var _0x418be8=[];var _0x3e4cae=squel[_0xca1e('0x63')]();var _0x15e1e2;if(_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x64')]){_0x15e1e2=as[_0xca1e('0x65')](_0x3fcd26['query'][_0xca1e('0x64')]);var _0x5eb5d8=_0x15e1e2[_0xca1e('0x66')];for(var _0x4ae1c7=0x0;_0x4ae1c7<_0x15e1e2['conditions'][_0xca1e('0x4b')];_0x4ae1c7++){var _0x4ae723=_0x15e1e2['conditions'][_0x4ae1c7];var _0x2b9692='i';var _0x425d9f=_[_0xca1e('0x67')](_0xa717a8,[_0xca1e('0x31'),_0x4ae723['field']]);if(!_0x425d9f){switch(_0x4ae723[_0xca1e('0x51')]){case _0xca1e('0x68'):if(_0x4ae723[_0xca1e('0x69')]==0x1){_0x73f9e1[_0xca1e('0x6a')]('`'+_0x4ae723[_0xca1e('0x51')]+_0xca1e('0x6b'));}else{_0x73f9e1[_0xca1e('0x6a')]('`'+_0x4ae723[_0xca1e('0x51')]+'`\x20>\x200');}break;case _0xca1e('0x6c'):if(_0x4ae723[_0xca1e('0x6d')]===_0xca1e('0x6e')){if(_0x4ae723[_0xca1e('0x69')][_0xca1e('0x3d')]('\x20')[_0xca1e('0x4b')]>0x1){_0x240b08[_0x5eb5d8](_0xca1e('0x6f'),qs[_0xca1e('0x70')](_0x4ae723[_0xca1e('0x69')]),null);}else{var _0x34706a='%'+_0x4ae723[_0xca1e('0x69')]+'%';_0x240b08[_0x5eb5d8](_0xca1e('0x71'),_0x34706a,_0x34706a,_0x34706a);}}else{_0x425d9f=_[_0xca1e('0x67')](_0xa717a8,[_0xca1e('0x31'),_0xca1e('0x72')]);_0x4ae723[_0xca1e('0x51')]='ContactId';_0x26808e=as[_0xca1e('0x73')](_0x2b9692,_0x425d9f[_0xca1e('0x42')],_0x4ae723);_0x240b08[_0x5eb5d8](_0x26808e[_0xca1e('0x74')],_0x26808e['value'][_0xca1e('0x75')],_0x26808e[_0xca1e('0x69')]['end']);}break;case _0xca1e('0x76'):var _0x5b9ed0=_0x4ae723[_0xca1e('0x69')][_0xca1e('0x3d')](',')[_0xca1e('0x3a')](function(_0x43016a){return Number(_0x43016a);});_0x5b9ed0[_0xca1e('0x3e')](function(_0x2ba8da){_0x3e4cae['or'](_0xca1e('0x77'),'%,'+_0x2ba8da+',%');});_0x418be8=_[_0xca1e('0x78')](_0x418be8,_0x5b9ed0);break;case'User':if(_0x4ae723['operator']===_0xca1e('0x6e')){_0x240b08[_0x5eb5d8](_0xca1e('0x79'),'%'+_0x4ae723[_0xca1e('0x69')]+'%',null);}else{_0x425d9f=_[_0xca1e('0x67')](_0xa717a8,[_0xca1e('0x31'),_0xca1e('0x7a')]);_0x4ae723[_0xca1e('0x51')]=_0xca1e('0x7a');_0x26808e=as[_0xca1e('0x73')](_0x2b9692,_0x425d9f[_0xca1e('0x42')],_0x4ae723);_0x240b08[_0x5eb5d8](_0x26808e['text'],_0x26808e[_0xca1e('0x69')][_0xca1e('0x75')],_0x26808e[_0xca1e('0x69')][_0xca1e('0x22')]);}break;case _0xca1e('0x33'):_0x26808e=as['buildExpression']('me',null,_0x4ae723);_0x240b08[_0x5eb5d8](_0x26808e[_0xca1e('0x74')],_0x26808e[_0xca1e('0x69')][_0xca1e('0x75')],_0x26808e[_0xca1e('0x69')]['end']);break;}}else{var _0x26808e=as[_0xca1e('0x73')](_0x2b9692,_0x425d9f[_0xca1e('0x42')],_0x4ae723);_0x240b08[_0x5eb5d8](_0x26808e[_0xca1e('0x74')],_0x26808e[_0xca1e('0x69')]['start'],_0x26808e[_0xca1e('0x69')][_0xca1e('0x22')]);}}}else{var _0x15ba42=_(_0x3fcd26[_0xca1e('0x45')])[_0xca1e('0x46')]()[_0xca1e('0x3a')](function(_0x5f11ab){return _[_0xca1e('0x7b')](_0xa717a8,[_0xca1e('0x31'),_0x5f11ab])?_0x5f11ab:undefined;})[_0xca1e('0x7c')]()['value']();if(!_['isEmpty'](_0x15ba42)){_0x15ba42[_0xca1e('0x3e')](function(_0x4e15b1){if(_0x4e15b1==='SmsAccountId'){_0x73f9e1[_0xca1e('0x4f')](_0xca1e('0x7d'),[][_0xca1e('0x7e')](_0x3fcd26[_0xca1e('0x45')][_0x4e15b1]));}else if(_0x4e15b1===_0xca1e('0x7f')){var _0x4e87d1=JSON[_0xca1e('0x80')](_0x3fcd26[_0xca1e('0x45')][_0x4e15b1])[_0xca1e('0x81')];var _0x3a8899=JSON[_0xca1e('0x80')](_0x3fcd26[_0xca1e('0x45')][_0x4e15b1])[_0xca1e('0x82')];_0x73f9e1[_0xca1e('0x4f')](_0xca1e('0x83'),_0x4e87d1,_0x3a8899);}else{if(_0x3fcd26[_0xca1e('0x45')][_0x4e15b1]===_0xca1e('0x84')){_0x73f9e1[_0xca1e('0x4f')]('i.'+_0x4e15b1+_0xca1e('0x85'));}else{_0x73f9e1[_0xca1e('0x4f')]('i.'+_0x4e15b1+'\x20=\x20?',_0x3fcd26[_0xca1e('0x45')][_0x4e15b1]);}}});}if(_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x86')]){if(_0x3fcd26['query'][_0xca1e('0x86')]==0x1){_0x73f9e1[_0xca1e('0x6a')](_0xca1e('0x87'));}else{_0x73f9e1['having'](_0xca1e('0x88'));}}if(_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x89')]){_0x418be8=_[_0xca1e('0x8a')](_0x3fcd26['query'][_0xca1e('0x89')])?_0x3fcd26['query'][_0xca1e('0x89')]:new Array(_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x89')]);_0x418be8['forEach'](function(_0x46b21d){_0x3e4cae['or'](_0xca1e('0x77'),'%,'+_0x46b21d+',%');});}if(_0x3fcd26[_0xca1e('0x45')]['filter']){var _0xf92222=_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x8b')][_0xca1e('0x8c')]('\x5c','\x5c\x5c')[_0xca1e('0x8c')](/'/g,'\x27\x27');if(qs['isNumeric'](_0xf92222)){_0x240b08['or'](_0xca1e('0x8d'),_0xf92222+'%')['or'](_0xca1e('0x8e'),_0xf92222+'%');}else{_0x240b08['or'](_0xca1e('0x8f'),qs[_0xca1e('0x70')](_0xf92222))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xf92222+'%');}}}_0x73f9e1[_0xca1e('0x4f')](_0x240b08);_0x73f9e1[_0xca1e('0x90')](_0xca1e('0x91'));var _0x34872f={'type':db[_0xca1e('0x92')][_0xca1e('0x93')][_0xca1e('0x94')],'raw':!![]};var _0x23ba7f=_0x73f9e1[_0xca1e('0x95')]();_0x23ba7f[_0xca1e('0x51')](_0xca1e('0x91'));_0x23ba7f['field'](_0xca1e('0x96'),_0xca1e('0x68'));if(_0x34670d['order']){_0x34670d[_0xca1e('0x97')][_0xca1e('0x3e')](function(_0x2851e5){var _0x3a0a2a=_0x2851e5[0x0]===_0xca1e('0x98')?_0x2851e5[0x0]:'i.'+_0x2851e5[0x0];_0x73f9e1[_0xca1e('0x97')](_0x3a0a2a,_0x2851e5[0x1]===_0xca1e('0x99')?![]:!![]);});}if(!_['isEmpty'](_0x418be8)){_0x73f9e1['having'](_0x3e4cae);_0x23ba7f['where'](_0xca1e('0x9a'),_0x418be8);}BPromise['resolve']()[_0xca1e('0x2d')](function(){if(!_0x15e1e2){if(_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x9b')])return;_0x23ba7f[_0xca1e('0x4f')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x73f9e1[_0xca1e('0x4f')](_0xca1e('0x9c'));return;}if(_0x3fcd26[_0xca1e('0x9d')][_0xca1e('0x9e')]!==_0xca1e('0x36'))return;return _0x3fcd26['user'][_0xca1e('0x9f')]({'attributes':['id'],'raw':!![]})[_0xca1e('0x2d')](function(_0x5b0953){if(_[_0xca1e('0xa0')](_0x5b0953)){_0x23ba7f[_0xca1e('0x4f')](_0xca1e('0xa1'));_0x73f9e1[_0xca1e('0x4f')](_0xca1e('0xa1'));}else{_0x23ba7f[_0xca1e('0x4f')](_0xca1e('0x7d'),_[_0xca1e('0x3a')](_0x5b0953,'id'));_0x73f9e1[_0xca1e('0x4f')]('i.SmsAccountId\x20IN\x20?',_['map'](_0x5b0953,'id'));}});})[_0xca1e('0x2d')](function(){if(_0x3fcd26[_0xca1e('0x9d')][_0xca1e('0x9e')]===_0xca1e('0x36')&&!_0x15e1e2&&!_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x9b')])return[];return db['sequelize']['query'](_0x23ba7f['toString'](),_0x34872f);})[_0xca1e('0x2d')](function(_0x411094){_0x54ac4f[_0xca1e('0x27')]=_0x411094['length'];if(_0x54ac4f[_0xca1e('0x27')]===0x0)return[];return db[_0xca1e('0xa2')]['query'](_0x21e2a5['toString'](),_0x34872f)['then'](function(_0x5214c7){_0x7856e5=_[_0xca1e('0xa3')](_0x5214c7,'id');_0x34872f=_['merge'](_0x34872f,{'model':db[_0xca1e('0xa4')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3fcd26[_0xca1e('0x45')]['fields']){_0x34670d[_0xca1e('0x4a')][_0xca1e('0x3e')](function(_0x489415){_0x73f9e1[_0xca1e('0x51')]('i.'+_0x489415);});}else{_0x73f9e1[_0xca1e('0x51')](_0xca1e('0x96'),'unreadMessages');_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xa5'),_0xca1e('0xa6'));_0x73f9e1['field'](_0xca1e('0xa7'),_0xca1e('0xa8'));_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xa9'),_0xca1e('0x98'));_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xaa'));_0x73f9e1['field']('c.firstName','Contact.firstName');_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xab'),_0xca1e('0xac'));_0x73f9e1['field']('c.email','Contact.email');_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xad'),_0xca1e('0xae'));_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xaf'),_0xca1e('0xb0'));_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xb1'),'Contact.fax');_0x73f9e1['field']('o.fullname',_0xca1e('0xb2'));_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xb3'),_0xca1e('0xb4'));_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xb5'),'TagIds');}if(_0x34670d['limit'])_0x73f9e1['limit'](_0x34670d[_0xca1e('0x26')]);if(_0x34670d[_0xca1e('0x24')])_0x73f9e1['offset'](_0x34670d[_0xca1e('0x24')]);return db['sequelize'][_0xca1e('0x45')](_0x73f9e1[_0xca1e('0xb6')](),_0x34872f);})['then'](function(_0x33c86d){if(_0x33c86d[_0xca1e('0x4b')]>0x0)_0x421e29[_0xca1e('0x4f')](_0xca1e('0xb7'),_['map'](_0x33c86d,'id'));return db['sequelize'][_0xca1e('0x45')](_0x421e29[_0xca1e('0xb6')](),_0x34872f)[_0xca1e('0x2d')](function(_0x487c2e){var _0x1b334e=_[_0xca1e('0xb8')](_0x487c2e,'SmsInteractionId');var _0xc6313d=[];_0x33c86d['forEach'](function(_0x4674f8){_0xc6313d['push'](updateSmsInteraction(_0x4674f8,_0x7856e5,_0x1b334e));});return BPromise[_0xca1e('0xb9')](_0xc6313d);});});})['then'](function(_0x5f3bdc){_0x54ac4f[_0xca1e('0xba')]=_0x5f3bdc;return _0x54ac4f;})[_0xca1e('0x2d')](respondWithFilteredResult(_0x4ba4a3,_0x34670d))[_0xca1e('0x40')](handleError(_0x4ba4a3,null));};exports['show']=function(_0x36e7cb,_0x310023){var _0x359b16={'raw':![],'where':{'id':_0x36e7cb[_0xca1e('0xbb')]['id']}},_0xa46dd8={};_0xa46dd8[_0xca1e('0x44')]=_[_0xca1e('0x46')](db[_0xca1e('0xa4')]['rawAttributes']);_0xa46dd8[_0xca1e('0x45')]=_['keys'](_0x36e7cb[_0xca1e('0x45')]);_0xa46dd8[_0xca1e('0x47')]=_['intersection'](_0xa46dd8[_0xca1e('0x44')],_0xa46dd8[_0xca1e('0x45')]);_0x359b16['attributes']=_[_0xca1e('0x48')](_0xa46dd8['model'],qs[_0xca1e('0x49')](_0x36e7cb['query'][_0xca1e('0x49')]));_0x359b16[_0xca1e('0x4a')]=_0x359b16[_0xca1e('0x4a')][_0xca1e('0x4b')]?_0x359b16[_0xca1e('0x4a')]:_0xa46dd8[_0xca1e('0x44')];if(_0x36e7cb[_0xca1e('0x45')][_0xca1e('0xbc')]){_0x359b16[_0xca1e('0xbd')]=[{'all':!![]}];}_0x359b16=_['merge']({},_0x359b16,_0x36e7cb[_0xca1e('0xbe')]);return db[_0xca1e('0xa4')]['find'](_0x359b16)[_0xca1e('0x2d')](handleEntityNotFound(_0x310023,null))[_0xca1e('0x2d')](respondWithResult(_0x310023,null))['catch'](handleError(_0x310023,null));};exports[_0xca1e('0xbf')]=function(_0xf7b9c8,_0x2872b3){return db['SmsInteraction']['create'](_0xf7b9c8[_0xca1e('0x33')],{})['then'](respondWithResult(_0x2872b3,0xc9))[_0xca1e('0x40')](handleError(_0x2872b3,null));};exports[_0xca1e('0xc0')]=function(_0x5b297f,_0x3e086f){if(_0x5b297f[_0xca1e('0x33')]['id']){delete _0x5b297f[_0xca1e('0x33')]['id'];}return db[_0xca1e('0xa4')][_0xca1e('0x67')]({'where':{'id':_0x5b297f[_0xca1e('0xbb')]['id']}})['then'](handleEntityNotFound(_0x3e086f,null))[_0xca1e('0x2d')](saveUpdates(_0x5b297f[_0xca1e('0x33')],null))[_0xca1e('0x2d')](respondWithResult(_0x3e086f,null))[_0xca1e('0x40')](handleError(_0x3e086f,null));};exports[_0xca1e('0xc1')]=function(_0x29a47e,_0x437149){return db[_0xca1e('0xa4')][_0xca1e('0x67')]({'where':{'id':_0x29a47e[_0xca1e('0xbb')]['id']}})[_0xca1e('0x2d')](handleEntityNotFound(_0x437149,null))[_0xca1e('0x2d')](removeEntity(_0x437149,null))[_0xca1e('0x40')](handleError(_0x437149,null));};exports[_0xca1e('0xc2')]=function(_0x459168,_0x32de69){return db[_0xca1e('0xa4')][_0xca1e('0xc2')]()[_0xca1e('0x2d')](respondWithResult(_0x32de69,null))[_0xca1e('0x40')](handleError(_0x32de69,null));};exports[_0xca1e('0xc3')]=function(_0x5468d5,_0x37bc71,_0x15d029){return db[_0xca1e('0xc4')][_0xca1e('0x67')]({'where':{'id':_0x5468d5['params']['id']}})[_0xca1e('0x2d')](handleEntityNotFound(_0x37bc71,null))['then'](function(_0x5cbb11){if(_0x5cbb11){return _0x5cbb11[_0xca1e('0xc3')](_0x5468d5[_0xca1e('0x33')]['ids'],_['omit'](_0x5468d5[_0xca1e('0x33')],['ids','id'])||{});}})[_0xca1e('0x2d')](respondWithResult(_0x37bc71,null))['catch'](handleError(_0x37bc71,null));};exports[_0xca1e('0xc5')]=function(_0x3e0718,_0x4f1d8e,_0x152425){var _0x23d726={'raw':![],'where':{}};var _0x32d86f={};var _0x801bc7={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xca1e('0xc6')]({'where':{'id':_0x3e0718[_0xca1e('0xbb')]['id']}})[_0xca1e('0x2d')](handleEntityNotFound(_0x4f1d8e,null))[_0xca1e('0x2d')](function(_0x2fe489){if(_0x2fe489){_0x32d86f['model']=_['keys'](db[_0xca1e('0xc4')][_0xca1e('0x41')]);_0x32d86f['query']=_[_0xca1e('0x46')](_0x3e0718['query']);_0x32d86f[_0xca1e('0x47')]=_[_0xca1e('0x48')](_0x32d86f[_0xca1e('0x44')],_0x32d86f[_0xca1e('0x45')]);_0x23d726[_0xca1e('0x4a')]=_['intersection'](_0x32d86f[_0xca1e('0x44')],qs[_0xca1e('0x49')](_0x3e0718['query'][_0xca1e('0x49')]));_0x23d726[_0xca1e('0x4a')]=_0x23d726[_0xca1e('0x4a')][_0xca1e('0x4b')]?_0x23d726[_0xca1e('0x4a')]:_0x32d86f[_0xca1e('0x44')];if(!_0x3e0718[_0xca1e('0x45')][_0xca1e('0x4c')](_0xca1e('0x4d'))){_0x23d726['limit']=qs['limit'](_0x3e0718[_0xca1e('0x45')][_0xca1e('0x26')]);_0x23d726['offset']=qs[_0xca1e('0x24')](_0x3e0718[_0xca1e('0x45')][_0xca1e('0x24')]);}_0x23d726[_0xca1e('0x97')]=qs[_0xca1e('0x4e')](_0x3e0718['query']['sort']);_0x23d726[_0xca1e('0x4f')]=qs[_0xca1e('0x47')](_[_0xca1e('0xc7')](_0x3e0718[_0xca1e('0x45')],_0x32d86f[_0xca1e('0x47')]));_0x23d726[_0xca1e('0x4f')]['SmsInteractionId']=_0x2fe489['id'];if(_0x3e0718[_0xca1e('0x45')]['filter']){_0x23d726['where']=_[_0xca1e('0xc8')](_0x23d726['where'],{'$or':_[_0xca1e('0x3a')](_0x23d726[_0xca1e('0x4a')],function(_0x3ff2cf){var _0x4deb07={};_0x4deb07[_0x3ff2cf]={'$like':'%'+_0x3e0718[_0xca1e('0x45')][_0xca1e('0x8b')]+'%'};return _0x4deb07;})});}if(_0x3e0718[_0xca1e('0x45')][_0xca1e('0x81')]){var _0x4598ed=_0x3e0718['query']['$gte'][_0xca1e('0x3d')](',');var _0x1435b0={};_0x1435b0[_0x4598ed[0x0]]={'$gte':moment(_0x4598ed[0x1])[_0xca1e('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x23d726['where']=_[_0xca1e('0xc8')](_0x23d726[_0xca1e('0x4f')],_0x1435b0);}_0x23d726=_['merge']({},_0x23d726,_0x3e0718[_0xca1e('0xbe')]);return db['SmsMessage']['count']({'where':_0x23d726[_0xca1e('0x4f')]})['then'](function(_0x16df73){_0x801bc7[_0xca1e('0x27')]=_0x16df73;if(_0x3e0718['query'][_0xca1e('0xbc')]){_0x23d726[_0xca1e('0xbd')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x23d726);})[_0xca1e('0x2d')](function(_0x20c87f){_0x801bc7[_0xca1e('0xba')]=_0x20c87f;return _0x801bc7;});}})[_0xca1e('0x2d')](respondWithFilteredResult(_0x4f1d8e,_0x23d726))[_0xca1e('0x40')](handleError(_0x4f1d8e,null));};exports[_0xca1e('0xca')]=function(_0x3f90e4,_0x219958,_0x355833){return db['SmsInteraction'][_0xca1e('0x67')]({'where':{'id':_0x3f90e4[_0xca1e('0xbb')]['id']}})['then'](handleEntityNotFound(_0x219958,null))[_0xca1e('0x2d')](function(_0x36bfa0){if(_0x36bfa0){return _0x36bfa0[_0xca1e('0xcb')](_0x3f90e4[_0xca1e('0x33')][_0xca1e('0xcc')],_[_0xca1e('0xcd')](_0x3f90e4[_0xca1e('0x33')],[_0xca1e('0xcc'),'id'])||{})[_0xca1e('0xce')](function(){return db[_0xca1e('0x76')][_0xca1e('0xcf')]({'attributes':['id',_0xca1e('0x31'),_0xca1e('0x52')],'where':{'id':_0x3f90e4[_0xca1e('0x33')][_0xca1e('0xcc')]}});})[_0xca1e('0x2d')](function(_0x2036df){socket[_0xca1e('0xd0')]('smsInteractionTags:save',{'id':Number(_0x3f90e4[_0xca1e('0xbb')]['id']),'tags':_0x2036df||[]});return{'id':Number(_0x3f90e4[_0xca1e('0xbb')]['id']),'tags':_0x2036df||[]};});}})[_0xca1e('0x2d')](respondWithResult(_0x219958,null))['catch'](handleError(_0x219958,null));};exports[_0xca1e('0xd1')]=function(_0x3941b1,_0x39ea95,_0x47d597){return db[_0xca1e('0xa4')][_0xca1e('0x67')]({'where':{'id':_0x3941b1[_0xca1e('0xbb')]['id']}})[_0xca1e('0x2d')](handleEntityNotFound(_0x39ea95,null))[_0xca1e('0x2d')](function(_0x146075){if(_0x146075){return _0x146075[_0xca1e('0xd1')](_0x3941b1['query'][_0xca1e('0xcc')]);}})[_0xca1e('0x2d')](respondWithStatusCode(_0x39ea95,null))[_0xca1e('0x40')](handleError(_0x39ea95,null));};exports[_0xca1e('0xd2')]=function(_0x362dc5,_0x30fb6a){var _0x3311bc=moment()[_0xca1e('0xd3')]()[_0xca1e('0xb6')]();var _0x71b276=path[_0xca1e('0xd4')](config[_0xca1e('0xd5')],_0xca1e('0xd6'),_0xca1e('0xd7'),_0xca1e('0xd8'));var _0x39f743=path[_0xca1e('0xd4')](config[_0xca1e('0xd5')],_0xca1e('0xd6'),'files',_0xca1e('0xd9'));var _0x211d93=path[_0xca1e('0xd4')](_0x71b276,_0x3311bc);var _0x38c6a9=util['format']('transcript-%d-%s.zip',_0x362dc5[_0xca1e('0xbb')]['id'],_0x3311bc);var _0x42ea21=path[_0xca1e('0xd4')](_0x71b276,_0x38c6a9);var _0x4f7487=[];_0x4f7487['push']({'model':db[_0xca1e('0xda')],'as':'User','attributes':['id',_0xca1e('0xdb')],'raw':!![]});_0x4f7487['push']({'model':db['CmContact'],'as':_0xca1e('0x6c'),'attributes':['id',_0xca1e('0xdc'),'lastName'],'raw':!![]});var _0x13702a=[{'model':db[_0xca1e('0xc4')],'as':_0xca1e('0xdd'),'attributes':['id','body','createdAt',_0xca1e('0xde'),'secret',_0xca1e('0x86')],'include':_0x4f7487}];_0x13702a[_0xca1e('0x3f')]({'model':db[_0xca1e('0xdf')],'as':'Account','attributes':['id',_0xca1e('0x31')]});_0x13702a['push']({'model':db['User'],'as':_0xca1e('0xe0'),'attributes':['id',_0xca1e('0xdb')]});return db['SmsInteraction']['find']({'where':{'id':_0x362dc5['params']['id']},'include':_0x13702a})[_0xca1e('0x2d')](handleEntityNotFound(_0x30fb6a,null))[_0xca1e('0x2d')](function(_0x251d1f){if(_0x251d1f){var _0x3dcd45=_0x251d1f['get']({'plain':!![]});fs[_0xca1e('0xe1')](_0x211d93);var _0x18170b={'channel':_0xca1e('0xe2'),'account':_0x3dcd45[_0xca1e('0xe3')]['name'],'agent':_0x3dcd45[_0xca1e('0xe0')]?_0x3dcd45[_0xca1e('0xe0')][_0xca1e('0xdb')]:_0xca1e('0xe4'),'createdAt':moment(_0x3dcd45[_0xca1e('0x7f')])['format'](_0xca1e('0xe5'))[_0xca1e('0xb6')](),'closedAt':_0x3dcd45[_0xca1e('0xe6')]?moment(_0x3dcd45[_0xca1e('0xe7')])[_0xca1e('0xc9')](_0xca1e('0xe5'))['toString']():'','disposition':_0x3dcd45[_0xca1e('0xe8')],'messages':_(_0x3dcd45[_0xca1e('0xdd')])[_0xca1e('0x8b')]({'secret':![]})[_0xca1e('0x3a')](function(_0x296738){return{'date':moment(_0x296738['createdAt'])['format'](_0xca1e('0xe5'))[_0xca1e('0xb6')](),'sender':_0x296738['direction']==='out'?_0x296738[_0xca1e('0xda')]?_0x296738[_0xca1e('0xda')][_0xca1e('0xdb')]:_0xca1e('0xe9'):_0x296738['Contact'][_0xca1e('0xdc')]+(_0x296738[_0xca1e('0x6c')][_0xca1e('0xea')]?'\x20'+_0x296738['Contact'][_0xca1e('0xea')]:''),'body':_0x296738[_0xca1e('0x33')],'direction':_0x296738['direction']==='out'?'A':'C','secret':_0x296738[_0xca1e('0xeb')],'read':_0x296738[_0xca1e('0x86')]};})['value']()};return ejs[_0xca1e('0xec')](path[_0xca1e('0xd4')](config[_0xca1e('0xd5')],_0xca1e('0xd6'),_0xca1e('0xed'),_0xca1e('0xee')),{'interaction':_0x18170b})['then'](function(_0x2334f3){var _0xb564a7=path[_0xca1e('0xd4')](_0x211d93,_0xca1e('0xef')+_0x3dcd45['id']+'-'+_0x3311bc+_0xca1e('0xf0'));var _0x360351={'path':_0xb564a7,'channel':_0xca1e('0xe2'),'interactionId':_0x3dcd45['id']};return pdf[_0xca1e('0xf1')](_0x2334f3,_0x360351);})[_0xca1e('0x2d')](function(){return new BPromise(function(_0x579307,_0xf0c7b0){zipdir(_0x211d93,{'saveTo':_0x42ea21},function(_0x4d34b9,_0x4b5cf7){if(_0x4d34b9)return _0xf0c7b0(_0x4d34b9);return _0x579307(_0x4b5cf7);});})[_0xca1e('0x2d')](function(){return new BPromise(function(_0x4c6e58,_0x57cf42){rimraf(_0x211d93,function(_0x43aee2){if(_0x43aee2)_0x57cf42(_0x43aee2);return _0x4c6e58();});});})[_0xca1e('0x2d')](function(){return _0x30fb6a[_0xca1e('0xd2')](_0x42ea21,_0x38c6a9,function(_0x4ff266){if(_0x4ff266){console[_0xca1e('0xf2')]('err',_0x4ff266);}else{fs['unlinkSync'](_0x42ea21);}});});});}else{return _0x30fb6a['sendStatus'](0xc8);}})[_0xca1e('0x40')](handleError(_0x30fb6a,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index dd630e1..f3af469 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 _0x61a5=['hook','exports','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty'];(function(_0x372acf,_0x3135c6){var _0x2970a7=function(_0x20ca75){while(--_0x20ca75){_0x372acf['push'](_0x372acf['shift']());}};_0x2970a7(++_0x3135c6);}(_0x61a5,0xf0));var _0x561a=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x61a5[_0x469a3c];return _0x968f4;};'use strict';var EventEmitter=require(_0x561a('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x561a('0x1')];var SmsMessage=require(_0x561a('0x2'))['db'][_0x561a('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x561a('0x4')](0x0);var events={'afterCreate':_0x561a('0x5'),'afterUpdate':'update','afterDestroy':_0x561a('0x6')};function emitEvent(_0x33c0f5){return function(_0x5b9ca9,_0x18902a,_0x31f762){_0x5b9ca9[_0x561a('0x7')]({'attributes':['id'],'raw':!![]})[_0x561a('0x8')](function(_0x3d55f8){_0x5b9ca9[_0x561a('0x9')](_0x561a('0xa'),_0x3d55f8['map'](function(_0x3db11c){return{'id':_0x3db11c['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x5b9ca9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x561a('0x8')](function(_0x5288b4){_0x5b9ca9['setDataValue'](_0x561a('0xb'),_0x5288b4[_0x561a('0xc')]);SmsInteractionEvents['emit'](_0x33c0f5+':'+_0x5b9ca9['id'],_0x5b9ca9);SmsInteractionEvents[_0x561a('0xd')](_0x33c0f5,_0x5b9ca9);_0x31f762(null);})['catch'](_0x31f762(null));};}for(var e in events){if(events[_0x561a('0xe')](e)){var event=events[e];SmsInteraction[_0x561a('0xf')](e,emitEvent(event));}}module[_0x561a('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0x9b67=['findAll','unreadMessages','length','emit','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','getUsers','then','setDataValue','map'];(function(_0x1d9fbc,_0x6a62f3){var _0x50e7e0=function(_0x4e0c6c){while(--_0x4e0c6c){_0x1d9fbc['push'](_0x1d9fbc['shift']());}};_0x50e7e0(++_0x6a62f3);}(_0x9b67,0xf6));var _0x79b6=function(_0x4d1cc9,_0x1237b3){_0x4d1cc9=_0x4d1cc9-0x0;var _0x34a20f=_0x9b67[_0x4d1cc9];return _0x34a20f;};'use strict';var EventEmitter=require(_0x79b6('0x0'));var SmsInteraction=require(_0x79b6('0x1'))['db'][_0x79b6('0x2')];var SmsMessage=require(_0x79b6('0x1'))['db'][_0x79b6('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x79b6('0x4'),'afterUpdate':_0x79b6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4e8794){return function(_0x38479d,_0x174768,_0x258103){_0x38479d[_0x79b6('0x6')]({'attributes':['id'],'raw':!![]})[_0x79b6('0x7')](function(_0x128543){_0x38479d[_0x79b6('0x8')]('Users',_0x128543[_0x79b6('0x9')](function(_0x107e4b){return{'id':_0x107e4b['id']};}));return SmsMessage[_0x79b6('0xa')]({'where':{'SmsInteractionId':_0x38479d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x79b6('0x7')](function(_0x1222a0){_0x38479d['setDataValue'](_0x79b6('0xb'),_0x1222a0[_0x79b6('0xc')]);SmsInteractionEvents[_0x79b6('0xd')](_0x4e8794+':'+_0x38479d['id'],_0x38479d);SmsInteractionEvents[_0x79b6('0xd')](_0x4e8794,_0x38479d);_0x258103(null);})['catch'](_0x258103(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x79b6('0xe')](e,emitEvent(event));}}module[_0x79b6('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 9c418d6..3401e6d 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 _0x8daa=['lodash','../../config/logger','moment','request-promise','path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closedAt','format'];(function(_0x297dcf,_0x448cf5){var _0xe1699b=function(_0x8b1e0f){while(--_0x8b1e0f){_0x297dcf['push'](_0x297dcf['shift']());}};_0xe1699b(++_0x448cf5);}(_0x8daa,0x188));var _0xa8da=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0x8daa[_0x25e109];return _0xc0f7d6;};'use strict';var _=require(_0xa8da('0x0'));var util=require('util');var logger=require(_0xa8da('0x1'))('api');var moment=require(_0xa8da('0x2'));var BPromise=require('bluebird');var rp=require(_0xa8da('0x3'));var fs=require('fs');var path=require(_0xa8da('0x4'));var rimraf=require(_0xa8da('0x5'));var config=require('../../config/environment');var attributes=require(_0xa8da('0x6'));module[_0xa8da('0x7')]=function(_0x440d1c,_0x3b3abc){return _0x440d1c[_0xa8da('0x8')](_0xa8da('0x9'),attributes,{'tableName':_0xa8da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47867f,_0x3c2582,_0x54e817){if(_0x47867f[_0xa8da('0xb')]('closed')){_0x47867f[_0xa8da('0xc')]=moment()[_0xa8da('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x54e817(null,_0x47867f);}}});}; \ No newline at end of file +var _0x6b02=['../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x18baf4,_0x33086b){var _0x278ed1=function(_0x3ea0a2){while(--_0x3ea0a2){_0x18baf4['push'](_0x18baf4['shift']());}};_0x278ed1(++_0x33086b);}(_0x6b02,0x1ba));var _0x26b0=function(_0x3cffd3,_0x653937){_0x3cffd3=_0x3cffd3-0x0;var _0x58d92e=_0x6b02[_0x3cffd3];return _0x58d92e;};'use strict';var _=require(_0x26b0('0x0'));var util=require(_0x26b0('0x1'));var logger=require(_0x26b0('0x2'))(_0x26b0('0x3'));var moment=require(_0x26b0('0x4'));var BPromise=require(_0x26b0('0x5'));var rp=require(_0x26b0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x26b0('0x7'));var config=require(_0x26b0('0x8'));var attributes=require(_0x26b0('0x9'));module[_0x26b0('0xa')]=function(_0x2538ec,_0x3698aa){return _0x2538ec[_0x26b0('0xb')](_0x26b0('0xc'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x139e13,_0x3cad97,_0x557c4e){if(_0x139e13[_0x26b0('0xd')](_0x26b0('0xe'))){_0x139e13[_0x26b0('0xf')]=moment()[_0x26b0('0x10')](_0x26b0('0x11'));}_0x557c4e(null,_0x139e13);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index b6fcfc5..0ebf52c 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 _0xc232=['ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','update','options','raw','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','SmsInteraction','addTags'];(function(_0x4d40dd,_0x39592b){var _0x1c51f2=function(_0x53e502){while(--_0x53e502){_0x4d40dd['push'](_0x4d40dd['shift']());}};_0x1c51f2(++_0x39592b);}(_0xc232,0xa8));var _0x2c23=function(_0xf4d5b1,_0x2d5c2e){_0xf4d5b1=_0xf4d5b1-0x0;var _0x4263fa=_0xc232[_0xf4d5b1];return _0x4263fa;};'use strict';var _=require(_0x2c23('0x0'));var util=require('util');var moment=require(_0x2c23('0x1'));var BPromise=require(_0x2c23('0x2'));var rs=require(_0x2c23('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2c23('0x4'))(_0x2c23('0x5'));var config=require(_0x2c23('0x6'));var jayson=require(_0x2c23('0x7'));var client=jayson[_0x2c23('0x8')][_0x2c23('0x9')]({'port':0x232a});config[_0x2c23('0xa')]=_[_0x2c23('0xb')](config[_0x2c23('0xa')],{'host':_0x2c23('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2c23('0xa')]));require(_0x2c23('0xd'))[_0x2c23('0xe')](socket);function respondWithRpcPromise(_0x38cbfb,_0x4ffdaa,_0x1aebee){return new BPromise(function(_0x17e0f5,_0x177843){return client[_0x2c23('0xf')](_0x38cbfb,_0x1aebee)[_0x2c23('0x10')](function(_0x2f8d2a){logger[_0x2c23('0x11')](_0x2c23('0x12'),_0x4ffdaa,'request\x20sent');logger['debug'](_0x2c23('0x13'),_0x4ffdaa,_0x2c23('0x14'),JSON[_0x2c23('0x15')](_0x2f8d2a));if(_0x2f8d2a[_0x2c23('0x16')]){if(_0x2f8d2a[_0x2c23('0x16')][_0x2c23('0x17')]===0x1f4){logger[_0x2c23('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x4ffdaa,_0x2f8d2a[_0x2c23('0x16')][_0x2c23('0x18')]);return _0x177843(_0x2f8d2a[_0x2c23('0x16')][_0x2c23('0x18')]);}logger[_0x2c23('0x16')](_0x2c23('0x12'),_0x4ffdaa,_0x2f8d2a[_0x2c23('0x16')][_0x2c23('0x18')]);return _0x17e0f5(_0x2f8d2a[_0x2c23('0x16')][_0x2c23('0x18')]);}else{logger['info'](_0x2c23('0x12'),_0x4ffdaa,_0x2c23('0x14'));_0x17e0f5(_0x2f8d2a[_0x2c23('0x19')][_0x2c23('0x18')]);}})[_0x2c23('0x1a')](function(_0x540b5f){logger[_0x2c23('0x16')](_0x2c23('0x12'),_0x4ffdaa,_0x540b5f);_0x177843(_0x540b5f);});});}exports['UpdateSmsInteraction']=function(_0x65fc12){var _0x49557b=this;return new Promise(function(_0x22f646,_0xe22489){return db['SmsInteraction'][_0x2c23('0x1b')](_0x65fc12['body'],{'raw':_0x65fc12['options']?_0x65fc12[_0x2c23('0x1c')][_0x2c23('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x65fc12[_0x2c23('0x1c')]?_0x65fc12['options'][_0x2c23('0x1e')]||null:null,'attributes':_0x65fc12[_0x2c23('0x1c')]?_0x65fc12[_0x2c23('0x1c')][_0x2c23('0x1f')]||null:null,'limit':_0x65fc12['options']?_0x65fc12[_0x2c23('0x1c')][_0x2c23('0x20')]||null:null})[_0x2c23('0x10')](function(_0xf887ff){logger[_0x2c23('0x11')](_0x2c23('0x21'),_0x65fc12);logger['debug']('UpdateSmsInteraction',_0x65fc12,JSON[_0x2c23('0x15')](_0xf887ff));_0x22f646(_0xf887ff);})[_0x2c23('0x1a')](function(_0x57b90d){logger[_0x2c23('0x16')]('UpdateSmsInteraction',_0x57b90d[_0x2c23('0x18')],_0x65fc12);_0xe22489(_0x49557b[_0x2c23('0x16')](0x1f4,_0x57b90d[_0x2c23('0x18')]));});});};exports[_0x2c23('0x22')]=function(_0x789472){return new Promise(function(_0x5a8caf,_0x7cec85){return db[_0x2c23('0x23')]['find']({'where':_0x789472[_0x2c23('0x1c')]?_0x789472['options'][_0x2c23('0x1e')]||null:null})[_0x2c23('0x10')](function(_0x42164b){if(_0x42164b){return _0x42164b[_0x2c23('0x24')](_0x789472['body'][_0x2c23('0x25')],_[_0x2c23('0x26')](_0x789472['body'],[_0x2c23('0x25'),'id'])||{});}})[_0x2c23('0x27')](function(_0x5b2398){logger['info']('AddTags',_0x789472);logger['debug'](_0x2c23('0x28'),_0x789472,JSON[_0x2c23('0x15')](_0x5b2398));_0x5a8caf(_0x5b2398);})['catch'](function(_0x2b3be7){logger[_0x2c23('0x16')]('AddTags',_0x2b3be7['message'],_0x789472);_0x7cec85(_this[_0x2c23('0x16')](0x1f4,_0x2b3be7[_0x2c23('0x18')]));});});}; \ No newline at end of file +var _0x395f=['limit','AddTagsToSmsInteraction','SmsInteraction','find','where','addTags','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','info','UpdateSmsInteraction','update','body','options','raw','attributes'];(function(_0x5880b9,_0x36851f){var _0x1ac51c=function(_0x1b9c05){while(--_0x1b9c05){_0x5880b9['push'](_0x5880b9['shift']());}};_0x1ac51c(++_0x36851f);}(_0x395f,0x84));var _0xf395=function(_0x337233,_0xf33f60){_0x337233=_0x337233-0x0;var _0x47b3a2=_0x395f[_0x337233];return _0x47b3a2;};'use strict';var _=require('lodash');var util=require(_0xf395('0x0'));var moment=require('moment');var BPromise=require(_0xf395('0x1'));var rs=require(_0xf395('0x2'));var fs=require('fs');var Redis=require(_0xf395('0x3'));var db=require(_0xf395('0x4'))['db'];var utils=require(_0xf395('0x5'));var logger=require(_0xf395('0x6'))(_0xf395('0x7'));var config=require('../../config/environment');var jayson=require(_0xf395('0x8'));var client=jayson['client'][_0xf395('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf395('0xa')],{'host':_0xf395('0xb'),'port':0x18eb});var socket=require(_0xf395('0xc'))(new Redis(config[_0xf395('0xa')]));require(_0xf395('0xd'))[_0xf395('0xe')](socket);function respondWithRpcPromise(_0x51aefc,_0x499648,_0x67831c){return new BPromise(function(_0x219f2e,_0x47134c){return client[_0xf395('0xf')](_0x51aefc,_0x67831c)[_0xf395('0x10')](function(_0xf9969d){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x499648,_0xf395('0x11'));logger[_0xf395('0x12')](_0xf395('0x13'),_0x499648,_0xf395('0x11'),JSON[_0xf395('0x14')](_0xf9969d));if(_0xf9969d['error']){if(_0xf9969d[_0xf395('0x15')][_0xf395('0x16')]===0x1f4){logger[_0xf395('0x15')](_0xf395('0x17'),_0x499648,_0xf9969d[_0xf395('0x15')][_0xf395('0x18')]);return _0x47134c(_0xf9969d[_0xf395('0x15')][_0xf395('0x18')]);}logger[_0xf395('0x15')](_0xf395('0x17'),_0x499648,_0xf9969d[_0xf395('0x15')][_0xf395('0x18')]);return _0x219f2e(_0xf9969d[_0xf395('0x15')]['message']);}else{logger[_0xf395('0x19')]('SmsInteraction,\x20%s,\x20%s',_0x499648,_0xf395('0x11'));_0x219f2e(_0xf9969d['result'][_0xf395('0x18')]);}})['catch'](function(_0x5d2689){logger[_0xf395('0x15')](_0xf395('0x17'),_0x499648,_0x5d2689);_0x47134c(_0x5d2689);});});}exports[_0xf395('0x1a')]=function(_0x15f84c){var _0x30f0e4=this;return new Promise(function(_0x3a3f62,_0x5193ab){return db['SmsInteraction'][_0xf395('0x1b')](_0x15f84c[_0xf395('0x1c')],{'raw':_0x15f84c['options']?_0x15f84c[_0xf395('0x1d')][_0xf395('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15f84c[_0xf395('0x1d')]?_0x15f84c[_0xf395('0x1d')]['where']||null:null,'attributes':_0x15f84c[_0xf395('0x1d')]?_0x15f84c[_0xf395('0x1d')][_0xf395('0x1f')]||null:null,'limit':_0x15f84c[_0xf395('0x1d')]?_0x15f84c['options'][_0xf395('0x20')]||null:null})[_0xf395('0x10')](function(_0x3b7f4d){logger['info']('UpdateSmsInteraction',_0x15f84c);logger['debug'](_0xf395('0x1a'),_0x15f84c,JSON[_0xf395('0x14')](_0x3b7f4d));_0x3a3f62(_0x3b7f4d);})['catch'](function(_0x2dd24a){logger[_0xf395('0x15')](_0xf395('0x1a'),_0x2dd24a[_0xf395('0x18')],_0x15f84c);_0x5193ab(_0x30f0e4[_0xf395('0x15')](0x1f4,_0x2dd24a['message']));});});};exports[_0xf395('0x21')]=function(_0x3c9420){return new Promise(function(_0x1586af,_0x5ce316){return db[_0xf395('0x22')][_0xf395('0x23')]({'where':_0x3c9420[_0xf395('0x1d')]?_0x3c9420[_0xf395('0x1d')][_0xf395('0x24')]||null:null})[_0xf395('0x10')](function(_0xd017d8){if(_0xd017d8){return _0xd017d8[_0xf395('0x25')](_0x3c9420['body'][_0xf395('0x26')],_['omit'](_0x3c9420[_0xf395('0x1c')],[_0xf395('0x26'),'id'])||{});}})[_0xf395('0x27')](function(_0x31f758){logger[_0xf395('0x19')](_0xf395('0x28'),_0x3c9420);logger['debug'](_0xf395('0x28'),_0x3c9420,JSON['stringify'](_0x31f758));_0x1586af(_0x31f758);})['catch'](function(_0xf2fa93){logger[_0xf395('0x15')](_0xf395('0x28'),_0xf2fa93[_0xf395('0x18')],_0x3c9420);_0x5ce316(_this[_0xf395('0x15')](0x1f4,_0xf2fa93[_0xf395('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 4e28fa2..5a89c8c 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 _0xb10b=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x2e9b5b,_0x3e1332){var _0x734c46=function(_0x260a7b){while(--_0x260a7b){_0x2e9b5b['push'](_0x2e9b5b['shift']());}};_0x734c46(++_0x3e1332);}(_0xb10b,0x12a));var _0xbb10=function(_0x180c9b,_0x13d173){_0x180c9b=_0x180c9b-0x0;var _0x3ff116=_0xb10b[_0x180c9b];return _0x3ff116;};'use strict';var SmsInteractionEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){SmsInteractionEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);SmsInteractionEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x0b0e=['smsInteraction:','./smsInteraction.events','remove','emit','removeListener','register'];(function(_0x104fd5,_0x4a06f0){var _0x5f071d=function(_0x2f0533){while(--_0x2f0533){_0x104fd5['push'](_0x104fd5['shift']());}};_0x5f071d(++_0x4a06f0);}(_0x0b0e,0x187));var _0xe0b0=function(_0xcf581b,_0x4359dd){_0xcf581b=_0xcf581b-0x0;var _0x4f454d=_0x0b0e[_0xcf581b];return _0x4f454d;};'use strict';var SmsInteractionEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){SmsInteractionEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);SmsInteractionEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 5da8446..23cfb2e 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 _0x7955=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','sms','smsmessage:create','create','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy'];(function(_0x5d4d72,_0x4a79b0){var _0x16968d=function(_0x3c197a){while(--_0x3c197a){_0x5d4d72['push'](_0x5d4d72['shift']());}};_0x16968d(++_0x4a79b0);}(_0x7955,0x169));var _0x5795=function(_0x15cf93,_0x5b1029){_0x15cf93=_0x15cf93-0x0;var _0x2afb0a=_0x7955[_0x15cf93];return _0x2afb0a;};'use strict';var multer=require(_0x5795('0x0'));var util=require(_0x5795('0x1'));var path=require(_0x5795('0x2'));var timeout=require(_0x5795('0x3'));var express=require(_0x5795('0x4'));var router=express[_0x5795('0x5')]();var fs_extra=require(_0x5795('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5795('0x7'));var config=require('../../config/environment');var controller=require(_0x5795('0x8'));router[_0x5795('0x9')]('/',auth[_0x5795('0xa')](),controller[_0x5795('0xb')]);router[_0x5795('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x5795('0xc')]);router[_0x5795('0x9')](_0x5795('0xd'),auth[_0x5795('0xa')](),controller[_0x5795('0xe')]);router[_0x5795('0xf')]('/',auth[_0x5795('0xa')](),interaction[_0x5795('0x10')](_0x5795('0x11'),_0x5795('0x12')),controller[_0x5795('0x13')]);router[_0x5795('0xf')]('/:id/status',controller[_0x5795('0x14')]);router[_0x5795('0x15')](_0x5795('0xd'),auth[_0x5795('0xa')](),controller[_0x5795('0x16')]);router['put'](_0x5795('0x17'),auth[_0x5795('0xa')](),controller[_0x5795('0x18')]);router[_0x5795('0x15')](_0x5795('0x19'),auth['isAuthenticated'](),controller[_0x5795('0x1a')]);router[_0x5795('0x1b')](_0x5795('0xd'),auth[_0x5795('0xa')](),controller[_0x5795('0x1c')]);module[_0x5795('0x1d')]=router; \ No newline at end of file +var _0x30d5=['smsmessage:create','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','connect-timeout','express','Router','fs-extra','get','isAuthenticated','describe','show','post'];(function(_0x2468a2,_0x1eec24){var _0x1d7dc7=function(_0x50d966){while(--_0x50d966){_0x2468a2['push'](_0x2468a2['shift']());}};_0x1d7dc7(++_0x1eec24);}(_0x30d5,0x8a));var _0x530d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x30d5[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x530d('0x0'));var express=require(_0x530d('0x1'));var router=express[_0x530d('0x2')]();var fs_extra=require(_0x530d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x530d('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x530d('0x4')]('/describe',auth[_0x530d('0x5')](),controller[_0x530d('0x6')]);router['get']('/:id',auth[_0x530d('0x5')](),controller[_0x530d('0x7')]);router[_0x530d('0x8')]('/',auth['isAuthenticated'](),interaction['tracked']('sms',_0x530d('0x9')),controller['create']);router['post']('/:id/status',controller[_0x530d('0xa')]);router[_0x530d('0xb')](_0x530d('0xc'),auth[_0x530d('0x5')](),controller[_0x530d('0xd')]);router[_0x530d('0xb')](_0x530d('0xe'),auth['isAuthenticated'](),controller[_0x530d('0xf')]);router[_0x530d('0xb')](_0x530d('0x10'),auth[_0x530d('0x5')](),controller[_0x530d('0x11')]);router[_0x530d('0x12')](_0x530d('0xc'),auth[_0x530d('0x5')](),controller[_0x530d('0x13')]);module[_0x530d('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index f2e99f3..927b0e6 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 _0x1f21=['BOOLEAN','sequelize','exports','TEXT','ENUM','out','STRING'];(function(_0x50da6f,_0xfeb8d1){var _0xaff1c5=function(_0x41f703){while(--_0x41f703){_0x50da6f['push'](_0x50da6f['shift']());}};_0xaff1c5(++_0xfeb8d1);}(_0x1f21,0x86));var _0x11f2=function(_0x131c7e,_0x23f22b){_0x131c7e=_0x131c7e-0x0;var _0x5a2a1a=_0x1f21[_0x131c7e];return _0x5a2a1a;};'use strict';var Sequelize=require(_0x11f2('0x0'));module[_0x11f2('0x1')]={'body':{'type':Sequelize[_0x11f2('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x11f2('0x3')]('in','out'),'defaultValue':_0x11f2('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x11f2('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x11f2('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x11f2('0x2')]}}; \ No newline at end of file +var _0x39b7=['out','STRING','DATE','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0xc82e7,_0x3f884b){var _0x4912c4=function(_0x2e3276){while(--_0x2e3276){_0xc82e7['push'](_0xc82e7['shift']());}};_0x4912c4(++_0x3f884b);}(_0x39b7,0xc3));var _0x739b=function(_0x578e61,_0x3f010f){_0x578e61=_0x578e61-0x0;var _0x42f374=_0x39b7[_0x578e61];return _0x42f374;};'use strict';var Sequelize=require(_0x739b('0x0'));module[_0x739b('0x1')]={'body':{'type':Sequelize['TEXT'](_0x739b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x739b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x739b('0x4')]('in',_0x739b('0x5')),'defaultValue':_0x739b('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x739b('0x6')](0xbe)},'phone':{'type':Sequelize[_0x739b('0x6')]},'readAt':{'type':Sequelize[_0x739b('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x739b('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index a21fdcd..7b14363 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 _0x1c41=['Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','name','send','render','body','contact','agent','interaction','account','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','destroy','describe','sms-interactions','sms','read','format','UserId','user','CmContact','Contact','get','SmsInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','manual','channel','accept','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','twilio','MessageSid','inspect','plivo','MessageUUID','messageId','sent','delivered'];(function(_0x2edb51,_0x2bcbc6){var _0x3f29b4=function(_0x5149f4){while(--_0x5149f4){_0x2edb51['push'](_0x2edb51['shift']());}};_0x3f29b4(++_0x2bcbc6);}(_0x1c41,0x11d));var _0x11c4=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x1c41[_0xa9a245];return _0x2d0eaa;};'use strict';var emlformat=require(_0x11c4('0x0'));var rimraf=require(_0x11c4('0x1'));var zipdir=require(_0x11c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11c4('0x3'));var moment=require(_0x11c4('0x4'));var BPromise=require(_0x11c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x11c4('0x6'));var sox=require('sox');var csv=require(_0x11c4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x11c4('0x8'));var _=require(_0x11c4('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x11c4('0xa'));var deskjs=require(_0x11c4('0xb'));var toCsv=require(_0x11c4('0x7'));var querystring=require('querystring');var Papa=require(_0x11c4('0xc'));var Redis=require(_0x11c4('0xd'));var authService=require(_0x11c4('0xe'));var qs=require(_0x11c4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x11c4('0x10'));var logger=require(_0x11c4('0x11'))(_0x11c4('0x12'));var utils=require('../../config/utils');var config=require(_0x11c4('0x13'));var licenseUtil=require(_0x11c4('0x14'));var db=require(_0x11c4('0x15'))['db'];config[_0x11c4('0x16')]=_[_0x11c4('0x17')](config[_0x11c4('0x16')],{'host':_0x11c4('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x11c4('0x16')]));require(_0x11c4('0x19'))[_0x11c4('0x1a')](socket);var jayson=require(_0x11c4('0x1b'));var client=jayson[_0x11c4('0x1c')][_0x11c4('0x1d')]({'port':0x232c});var client9002=jayson[_0x11c4('0x1c')][_0x11c4('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5dacbf,_0x5b4ad1,_0x108335,_0xbde398){return new BPromise(function(_0x3c698e,_0x4b914a){var _0x3dc35f=_0xbde398||client;return _0x3dc35f[_0x11c4('0x1e')](_0x5dacbf,_0x108335)[_0x11c4('0x1f')](function(_0x35cf72){logger[_0x11c4('0x20')](_0x11c4('0x21'),_0x5b4ad1,_0x11c4('0x22'));logger['debug'](_0x11c4('0x23'),_0x5b4ad1,_0x11c4('0x22'),JSON[_0x11c4('0x24')](_0x35cf72));if(_0x35cf72[_0x11c4('0x25')]){if(_0x35cf72[_0x11c4('0x25')][_0x11c4('0x26')]===0x1f4){logger[_0x11c4('0x25')](_0x11c4('0x21'),_0x5b4ad1,_0x35cf72[_0x11c4('0x25')][_0x11c4('0x27')]);return _0x4b914a(_0x35cf72[_0x11c4('0x25')][_0x11c4('0x27')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x5b4ad1,_0x35cf72['error'][_0x11c4('0x27')]);return _0x3c698e(_0x35cf72[_0x11c4('0x25')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x5b4ad1,_0x11c4('0x22'));_0x3c698e(_0x35cf72[_0x11c4('0x28')][_0x11c4('0x27')]);}})[_0x11c4('0x29')](function(_0x4c7307){logger[_0x11c4('0x25')](_0x11c4('0x21'),_0x5b4ad1,_0x4c7307);_0x4b914a(_0x4c7307);});});}function respondWithStatusCode(_0x549545,_0x39f191){_0x39f191=_0x39f191||0xcc;return function(_0x426ee1){if(_0x426ee1){return _0x549545[_0x11c4('0x2a')](_0x39f191);}return _0x549545['status'](_0x39f191)[_0x11c4('0x2b')]();};}function respondWithResult(_0x3a5b56,_0x2160b4){_0x2160b4=_0x2160b4||0xc8;return function(_0x584e7d){if(_0x584e7d){return _0x3a5b56['status'](_0x2160b4)[_0x11c4('0x2c')](_0x584e7d);}};}function respondWithFilteredResult(_0x58b175,_0x256ab9){return function(_0x3efc64){if(_0x3efc64){var _0x544a77=typeof _0x256ab9[_0x11c4('0x2d')]===_0x11c4('0x2e')&&typeof _0x256ab9[_0x11c4('0x2f')]==='undefined';var _0x5eeb51=_0x3efc64[_0x11c4('0x30')];var _0xcac18=_0x544a77?0x0:_0x256ab9[_0x11c4('0x2d')];var _0x5204fb=_0x544a77?_0x3efc64[_0x11c4('0x30')]:_0x256ab9['offset']+_0x256ab9['limit'];var _0x146fe6;if(_0x5204fb>=_0x5eeb51){_0x5204fb=_0x5eeb51;_0x146fe6=0xc8;}else{_0x146fe6=0xce;}_0x58b175[_0x11c4('0x31')](_0x146fe6);return _0x58b175[_0x11c4('0x32')]('Content-Range',_0xcac18+'-'+_0x5204fb+'/'+_0x5eeb51)['json'](_0x3efc64);}return null;};}function patchUpdates(_0x41c980){return function(_0x23c993){try{jsonpatch[_0x11c4('0x33')](_0x23c993,_0x41c980,!![]);}catch(_0x271116){return BPromise[_0x11c4('0x34')](_0x271116);}return _0x23c993[_0x11c4('0x35')]();};}function saveUpdates(_0x27a399,_0x15aa8c){return function(_0x179384){if(_0x179384){return _0x179384[_0x11c4('0x36')](_0x27a399)['then'](function(_0x20a22a){return _0x20a22a;});}return null;};}function removeEntity(_0xc526ad,_0x2b5bbd){return function(_0x44bd6b){if(_0x44bd6b){return _0x44bd6b['destroy']()[_0x11c4('0x1f')](function(){_0xc526ad['status'](0xcc)[_0x11c4('0x2b')]();});}};}function handleEntityNotFound(_0xc66552,_0x15f842){return function(_0x1e8e09){if(!_0x1e8e09){_0xc66552[_0x11c4('0x2a')](0x194);}return _0x1e8e09;};}function handleError(_0x13c136,_0x1ab338){_0x1ab338=_0x1ab338||0x1f4;return function(_0x9f8037){logger[_0x11c4('0x25')](_0x9f8037['stack']);if(_0x9f8037[_0x11c4('0x37')]){delete _0x9f8037['name'];}_0x13c136[_0x11c4('0x31')](_0x1ab338)[_0x11c4('0x38')](_0x9f8037);};}function getMustacheRender(_0xc9b096,_0x63a91b){return Mustache[_0x11c4('0x39')](_0xc9b096,_['merge'](_0x63a91b[_0x11c4('0x3a')],{'contact':_0x63a91b[_0x11c4('0x3b')],'message':_0x63a91b[_0x11c4('0x27')],'agent':_0x63a91b[_0x11c4('0x3c')],'interaction':_0x63a91b[_0x11c4('0x3d')],'account':_0x63a91b[_0x11c4('0x3e')]}))||'';}exports['index']=function(_0x5b6aaf,_0x8b7cfa){var _0x785c2d={},_0x109ae6={},_0x5c6acc={'count':0x0,'rows':[]};var _0x33158e=_[_0x11c4('0x3f')](db[_0x11c4('0x40')][_0x11c4('0x41')],function(_0x519716){return{'name':_0x519716[_0x11c4('0x42')],'type':_0x519716[_0x11c4('0x43')][_0x11c4('0x44')]};});_0x109ae6[_0x11c4('0x45')]=_['map'](_0x33158e,_0x11c4('0x37'));_0x109ae6[_0x11c4('0x46')]=_[_0x11c4('0x47')](_0x5b6aaf['query']);_0x109ae6[_0x11c4('0x48')]=_[_0x11c4('0x49')](_0x109ae6[_0x11c4('0x45')],_0x109ae6[_0x11c4('0x46')]);_0x785c2d[_0x11c4('0x4a')]=_[_0x11c4('0x49')](_0x109ae6[_0x11c4('0x45')],qs[_0x11c4('0x4b')](_0x5b6aaf[_0x11c4('0x46')][_0x11c4('0x4b')]));_0x785c2d[_0x11c4('0x4a')]=_0x785c2d['attributes'][_0x11c4('0x4c')]?_0x785c2d['attributes']:_0x109ae6[_0x11c4('0x45')];if(!_0x5b6aaf[_0x11c4('0x46')][_0x11c4('0x4d')]('nolimit')){_0x785c2d[_0x11c4('0x2f')]=qs['limit'](_0x5b6aaf['query'][_0x11c4('0x2f')]);_0x785c2d[_0x11c4('0x2d')]=qs[_0x11c4('0x2d')](_0x5b6aaf[_0x11c4('0x46')][_0x11c4('0x2d')]);}_0x785c2d['order']=qs[_0x11c4('0x4e')](_0x5b6aaf['query'][_0x11c4('0x4e')]);_0x785c2d[_0x11c4('0x4f')]=qs[_0x11c4('0x48')](_[_0x11c4('0x50')](_0x5b6aaf['query'],_0x109ae6['filters']),_0x33158e);if(_0x5b6aaf[_0x11c4('0x46')][_0x11c4('0x51')]){_0x785c2d[_0x11c4('0x4f')]=_[_0x11c4('0x52')](_0x785c2d[_0x11c4('0x4f')],{'$or':_['map'](_0x33158e,function(_0x42fda1){if(_0x42fda1[_0x11c4('0x43')]!==_0x11c4('0x53')){var _0x3cb5e9={};_0x3cb5e9[_0x42fda1['name']]={'$like':'%'+_0x5b6aaf[_0x11c4('0x46')][_0x11c4('0x51')]+'%'};return _0x3cb5e9;}})});}_0x785c2d=_[_0x11c4('0x52')]({},_0x785c2d,_0x5b6aaf[_0x11c4('0x54')]);var _0x28efcb={'where':_0x785c2d[_0x11c4('0x4f')]};return db['SmsMessage'][_0x11c4('0x30')](_0x28efcb)[_0x11c4('0x1f')](function(_0x18beb2){_0x5c6acc[_0x11c4('0x30')]=_0x18beb2;if(_0x5b6aaf[_0x11c4('0x46')][_0x11c4('0x55')]){_0x785c2d[_0x11c4('0x56')]=[{'all':!![]}];}return db[_0x11c4('0x40')][_0x11c4('0x57')](_0x785c2d);})[_0x11c4('0x1f')](function(_0x55a888){_0x5c6acc[_0x11c4('0x58')]=_0x55a888;return _0x5c6acc;})['then'](respondWithFilteredResult(_0x8b7cfa,_0x785c2d))[_0x11c4('0x29')](handleError(_0x8b7cfa,null));};exports['show']=function(_0x5c9b41,_0x60549b){var _0xc9f369={'raw':!![],'where':{'id':_0x5c9b41[_0x11c4('0x59')]['id']}},_0x4b81c2={};_0x4b81c2[_0x11c4('0x45')]=_['keys'](db[_0x11c4('0x40')][_0x11c4('0x41')]);_0x4b81c2[_0x11c4('0x46')]=_[_0x11c4('0x47')](_0x5c9b41[_0x11c4('0x46')]);_0x4b81c2[_0x11c4('0x48')]=_[_0x11c4('0x49')](_0x4b81c2[_0x11c4('0x45')],_0x4b81c2[_0x11c4('0x46')]);_0xc9f369['attributes']=_['intersection'](_0x4b81c2[_0x11c4('0x45')],qs[_0x11c4('0x4b')](_0x5c9b41[_0x11c4('0x46')][_0x11c4('0x4b')]));_0xc9f369[_0x11c4('0x4a')]=_0xc9f369[_0x11c4('0x4a')][_0x11c4('0x4c')]?_0xc9f369[_0x11c4('0x4a')]:_0x4b81c2[_0x11c4('0x45')];if(_0x5c9b41[_0x11c4('0x46')]['includeAll']){_0xc9f369['include']=[{'all':!![]}];}_0xc9f369=_[_0x11c4('0x52')]({},_0xc9f369,_0x5c9b41[_0x11c4('0x54')]);return db[_0x11c4('0x40')][_0x11c4('0x5a')](_0xc9f369)[_0x11c4('0x1f')](handleEntityNotFound(_0x60549b,null))[_0x11c4('0x1f')](respondWithResult(_0x60549b,null))[_0x11c4('0x29')](handleError(_0x60549b,null));};exports[_0x11c4('0x5b')]=function(_0x10ae9a,_0x4ad209){return db[_0x11c4('0x40')][_0x11c4('0x5b')](_0x10ae9a['body'],{})[_0x11c4('0x1f')](respondWithResult(_0x4ad209,0xc9))[_0x11c4('0x29')](handleError(_0x4ad209,null));};exports[_0x11c4('0x36')]=function(_0x4ebe3f,_0x359e24){if(_0x4ebe3f[_0x11c4('0x3a')]['id']){delete _0x4ebe3f['body']['id'];}return db[_0x11c4('0x40')][_0x11c4('0x5a')]({'where':{'id':_0x4ebe3f[_0x11c4('0x59')]['id']}})[_0x11c4('0x1f')](handleEntityNotFound(_0x359e24,null))['then'](saveUpdates(_0x4ebe3f[_0x11c4('0x3a')],null))['then'](respondWithResult(_0x359e24,null))['catch'](handleError(_0x359e24,null));};exports[_0x11c4('0x5c')]=function(_0xa59738,_0x1de3fd){return db[_0x11c4('0x40')][_0x11c4('0x5a')]({'where':{'id':_0xa59738['params']['id']}})['then'](handleEntityNotFound(_0x1de3fd,null))[_0x11c4('0x1f')](removeEntity(_0x1de3fd,null))[_0x11c4('0x29')](handleError(_0x1de3fd,null));};exports[_0x11c4('0x5d')]=function(_0x525ac8,_0x1e0634){return db[_0x11c4('0x40')]['describe']()[_0x11c4('0x1f')](respondWithResult(_0x1e0634,null))['catch'](handleError(_0x1e0634,null));};var interaction_log=require(_0x11c4('0x11'))(_0x11c4('0x5e'));exports['accept']=function(_0x3bfaa9,_0x484929,_0x56fbcd){var _0x5c75ba={'agent':{},'channel':_0x11c4('0x5f')};if(_0x3bfaa9['body']['id']){delete _0x3bfaa9[_0x11c4('0x3a')]['id'];}_0x3bfaa9['body'][_0x11c4('0x60')]=!![];_0x3bfaa9[_0x11c4('0x3a')]['readAt']=moment()[_0x11c4('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bfaa9[_0x11c4('0x3a')][_0x11c4('0x62')]=_0x3bfaa9[_0x11c4('0x3a')][_0x11c4('0x62')]||_0x3bfaa9[_0x11c4('0x63')]['id'];_0x5c75ba[_0x11c4('0x3c')]['id']=_0x3bfaa9[_0x11c4('0x3a')][_0x11c4('0x62')];return db[_0x11c4('0x40')][_0x11c4('0x5a')]({'where':{'id':_0x3bfaa9[_0x11c4('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x11c4('0x64')],'as':_0x11c4('0x65')}]})[_0x11c4('0x1f')](handleEntityNotFound(_0x484929,null))[_0x11c4('0x1f')](saveUpdates(_0x3bfaa9[_0x11c4('0x3a')],null))['then'](function(_0x15b3f6){if(_0x15b3f6){_0x5c75ba[_0x11c4('0x27')]=_0x15b3f6[_0x11c4('0x66')]({'plain':!![]});return db['SmsInteraction'][_0x11c4('0x5a')]({'where':{'id':_0x15b3f6[_0x11c4('0x67')]}});}return null;})[_0x11c4('0x1f')](handleEntityNotFound(_0x484929,null))[_0x11c4('0x1f')](function(_0x1d1bb4){if(_0x1d1bb4){return _0x1d1bb4[_0x11c4('0x36')]({'UserId':_0x3bfaa9[_0x11c4('0x3a')]['UserId'],'read1stAt':_['isNil'](_0x1d1bb4[_0x11c4('0x68')])?moment()[_0x11c4('0x61')](_0x11c4('0x69')):undefined});}return null;})[_0x11c4('0x1f')](function(_0x2f13d8){if(_0x2f13d8){_0x5c75ba[_0x11c4('0x3d')]=_0x2f13d8[_0x11c4('0x66')]({'plain':!![]});interaction_log[_0x11c4('0x20')](_0x11c4('0x6a'),_0x3bfaa9[_0x11c4('0x63')]['id'],_0x3bfaa9['user'][_0x11c4('0x37')],_0x3bfaa9['user'][_0x11c4('0x6b')],_0x5c75ba[_0x11c4('0x3d')]['id'],_0x3bfaa9[_0x11c4('0x3a')]?JSON[_0x11c4('0x24')](_0x3bfaa9[_0x11c4('0x3a')]):'null');return respondWithRpcPromise('AcceptMessage',_0x11c4('0x6c'),_0x5c75ba);}return null;})['then'](function(_0x4e0a05){if(_0x4e0a05){if(_0x3bfaa9['body'][_0x11c4('0x6d')]){_0x5c75ba[_0x11c4('0x27')]['interface']=util[_0x11c4('0x61')]('SIP/%s',_0x3bfaa9[_0x11c4('0x63')]['name']);_0x5c75ba[_0x11c4('0x27')]['channel']=_0x5c75ba[_0x11c4('0x6e')];_0x5c75ba[_0x11c4('0x27')]['event']=_0x11c4('0x6f');return respondWithRpcPromise(_0x11c4('0x70'),_0x11c4('0x70'),{'event':_0x11c4('0x71'),'message':_0x5c75ba[_0x11c4('0x27')]},client9002)[_0x11c4('0x1f')](function(){return _0x5c75ba;});}return _0x5c75ba;}return null;})[_0x11c4('0x1f')](respondWithResult(_0x484929,null))[_0x11c4('0x29')](handleError(_0x484929,null));};var interaction_log=require(_0x11c4('0x11'))('sms-interactions');exports['reject']=function(_0x468ff5,_0x195140,_0x27db1a){var _0x223baa={'agent':{},'channel':_0x11c4('0x5f')};if(_0x468ff5[_0x11c4('0x3a')]['id']){delete _0x468ff5['body']['id'];}_0x468ff5[_0x11c4('0x3a')]['UserId']=_0x468ff5[_0x11c4('0x3a')][_0x11c4('0x62')]||_0x468ff5['user']['id'];_0x223baa[_0x11c4('0x3c')]['id']=_0x468ff5[_0x11c4('0x3a')][_0x11c4('0x62')];return db[_0x11c4('0x40')][_0x11c4('0x5a')]({'where':{'id':_0x468ff5['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x195140,null))[_0x11c4('0x1f')](function(_0x4be243){if(_0x4be243){_0x223baa[_0x11c4('0x27')]=_0x4be243[_0x11c4('0x66')]({'plain':!![]});return db[_0x11c4('0x72')][_0x11c4('0x5a')]({'where':{'id':_0x4be243[_0x11c4('0x67')]}});}return null;})[_0x11c4('0x1f')](handleEntityNotFound(_0x195140,null))[_0x11c4('0x1f')](function(_0x2b521f){if(_0x2b521f){_0x223baa[_0x11c4('0x3d')]=_0x2b521f[_0x11c4('0x66')]({'plain':!![]});interaction_log['info'](_0x11c4('0x73'),_0x468ff5['user']['id'],_0x468ff5[_0x11c4('0x63')][_0x11c4('0x37')],_0x468ff5['user'][_0x11c4('0x6b')],_0x223baa['interaction']['id'],_0x468ff5[_0x11c4('0x3a')]?JSON[_0x11c4('0x24')](_0x468ff5[_0x11c4('0x3a')]):_0x11c4('0x74'));return respondWithRpcPromise(_0x11c4('0x75'),_0x11c4('0x76'),_0x223baa);}return null;})['then'](function(_0x55b699){if(_0x55b699){_0x55b699[_0x11c4('0x27')]['interface']=util[_0x11c4('0x61')]('SIP/%s',_0x468ff5[_0x11c4('0x63')][_0x11c4('0x37')]);_0x55b699[_0x11c4('0x27')][_0x11c4('0x6e')]=_0x223baa['channel'];_0x55b699[_0x11c4('0x27')]['event']=_0x11c4('0x34');respondWithRpcPromise(_0x11c4('0x70'),'EventManager',{'event':_0x11c4('0x77'),'message':_0x55b699[_0x11c4('0x27')]},client9002);return _0x223baa;}return null;})['then'](respondWithResult(_0x195140,null))[_0x11c4('0x29')](handleError(_0x195140,null));};exports[_0x11c4('0x31')]=function(_0x15a83b,_0x3c9f95,_0x3484c8){if(_0x15a83b[_0x11c4('0x3a')]['id']){delete _0x15a83b[_0x11c4('0x3a')]['id'];}var _0x55b686;return db[_0x11c4('0x40')][_0x11c4('0x5a')]({'where':{'id':_0x15a83b[_0x11c4('0x59')]['id']}})[_0x11c4('0x1f')](handleEntityNotFound(_0x3c9f95,null))[_0x11c4('0x1f')](function(_0xec83a5){if(_0xec83a5){_0x55b686=_0xec83a5;return db[_0x11c4('0x78')][_0x11c4('0x5a')]({'where':{'id':_0xec83a5[_0x11c4('0x79')]}});}})['then'](handleEntityNotFound(_0x3c9f95,null))[_0x11c4('0x1f')](function(_0x3638c4){if(_0x3638c4){logger[_0x11c4('0x7a')](_0x11c4('0x23'),_0x11c4('0x31'),_0x11c4('0x7b'),_0x3638c4[_0x11c4('0x43')],util['inspect'](_0x15a83b[_0x11c4('0x3a')],{'showHidden':![],'depth':null}));switch(_0x3638c4[_0x11c4('0x43')]){case _0x11c4('0x7c'):if(_0x15a83b[_0x11c4('0x3a')][_0x11c4('0x7d')]&&_0x15a83b[_0x11c4('0x3a')][_0x11c4('0x7d')]===_0x55b686['messageId']){return _0x55b686['update']({'read':!![]});}else{logger[_0x11c4('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x11c4('0x7c'),util[_0x11c4('0x7e')](_0x15a83b['body'],{'showHidden':![],'depth':null}));}break;case _0x11c4('0x7f'):if(_0x15a83b[_0x11c4('0x3a')][_0x11c4('0x80')]&&_0x15a83b[_0x11c4('0x3a')]['MessageUUID']===_0x55b686[_0x11c4('0x81')]&&_['indexOf']([_0x11c4('0x82'),_0x11c4('0x83')],_0x15a83b[_0x11c4('0x3a')][_0x11c4('0x84')])>=0x0){return _0x55b686[_0x11c4('0x36')]({'read':!![]});}else{logger[_0x11c4('0x25')](_0x11c4('0x85'),_0x11c4('0x31'),_0x11c4('0x86'),util[_0x11c4('0x7e')](_0x15a83b[_0x11c4('0x3a')],{'showHidden':![],'depth':null}));}break;case _0x11c4('0x87'):var _0x2358b2=_0x15a83b[_0x11c4('0x3a')][_0x11c4('0x88')][0x0];if(_0x2358b2[_0x11c4('0x31')][_0x11c4('0x89')]===_0x11c4('0x8a')){return _0x55b686[_0x11c4('0x36')]({'read':!![]});}else{logger[_0x11c4('0x25')](_0x11c4('0x85'),_0x11c4('0x31'),_0x11c4('0x87'),util[_0x11c4('0x7e')](_0x15a83b[_0x11c4('0x3a')],{'showHidden':![],'depth':null}));}break;}return _0x55b686;}})[_0x11c4('0x1f')](respondWithResult(_0x3c9f95,null))[_0x11c4('0x29')](handleError(_0x3c9f95,null));}; \ No newline at end of file +var _0x4efc=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','http','client','request','then','request\x20sent','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','destroy','stack','merge','body','contact','agent','interaction','account','index','map','SmsMessage','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','name','options','include','findAll','show','params','includeAll','find','create','describe','accept','sms','readAt','format','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','reject','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','groupName','DELIVERED','rimraf','zip-dir','fast-json-patch','moment','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis'];(function(_0x299d0b,_0x4903d0){var _0x1cf053=function(_0x2777d6){while(--_0x2777d6){_0x299d0b['push'](_0x299d0b['shift']());}};_0x1cf053(++_0x4903d0);}(_0x4efc,0x10b));var _0xc4ef=function(_0x3a678e,_0x4d297c){_0x3a678e=_0x3a678e-0x0;var _0x2e62e7=_0x4efc[_0x3a678e];return _0x2e62e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4ef('0x0'));var zipdir=require(_0xc4ef('0x1'));var jsonpatch=require(_0xc4ef('0x2'));var rp=require('request-promise');var moment=require(_0xc4ef('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc4ef('0x4'));var sox=require(_0xc4ef('0x5'));var csv=require('to-csv');var ejs=require(_0xc4ef('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4ef('0x7'));var squel=require(_0xc4ef('0x8'));var crypto=require(_0xc4ef('0x9'));var jsforce=require(_0xc4ef('0xa'));var deskjs=require(_0xc4ef('0xb'));var toCsv=require(_0xc4ef('0xc'));var querystring=require('querystring');var Papa=require(_0xc4ef('0xd'));var Redis=require(_0xc4ef('0xe'));var authService=require(_0xc4ef('0xf'));var qs=require(_0xc4ef('0x10'));var as=require(_0xc4ef('0x11'));var hardwareService=require(_0xc4ef('0x12'));var logger=require(_0xc4ef('0x13'))(_0xc4ef('0x14'));var utils=require(_0xc4ef('0x15'));var config=require(_0xc4ef('0x16'));var licenseUtil=require(_0xc4ef('0x17'));var db=require(_0xc4ef('0x18'))['db'];config['redis']=_['defaults'](config[_0xc4ef('0x19')],{'host':_0xc4ef('0x1a'),'port':0x18eb});var socket=require(_0xc4ef('0x1b'))(new Redis(config[_0xc4ef('0x19')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0xc4ef('0x1c'));var client=jayson['client'][_0xc4ef('0x1d')]({'port':0x232c});var client9002=jayson[_0xc4ef('0x1e')][_0xc4ef('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x54eae4,_0x302781,_0x161c0f,_0x5b577c){return new BPromise(function(_0x1ca0be,_0x176e0a){var _0x3d7e43=_0x5b577c||client;return _0x3d7e43[_0xc4ef('0x1f')](_0x54eae4,_0x161c0f)[_0xc4ef('0x20')](function(_0x45fc35){logger['info']('SmsMessage,\x20%s,\x20%s',_0x302781,_0xc4ef('0x21'));logger[_0xc4ef('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x302781,_0xc4ef('0x21'),JSON[_0xc4ef('0x23')](_0x45fc35));if(_0x45fc35[_0xc4ef('0x24')]){if(_0x45fc35[_0xc4ef('0x24')][_0xc4ef('0x25')]===0x1f4){logger[_0xc4ef('0x24')](_0xc4ef('0x26'),_0x302781,_0x45fc35[_0xc4ef('0x24')]['message']);return _0x176e0a(_0x45fc35[_0xc4ef('0x24')][_0xc4ef('0x27')]);}logger[_0xc4ef('0x24')](_0xc4ef('0x26'),_0x302781,_0x45fc35[_0xc4ef('0x24')]['message']);return _0x1ca0be(_0x45fc35[_0xc4ef('0x24')][_0xc4ef('0x27')]);}else{logger[_0xc4ef('0x28')]('SmsMessage,\x20%s,\x20%s',_0x302781,_0xc4ef('0x21'));_0x1ca0be(_0x45fc35[_0xc4ef('0x29')]['message']);}})[_0xc4ef('0x2a')](function(_0x5c19c4){logger[_0xc4ef('0x24')](_0xc4ef('0x26'),_0x302781,_0x5c19c4);_0x176e0a(_0x5c19c4);});});}function respondWithStatusCode(_0x23dcd9,_0x165f09){_0x165f09=_0x165f09||0xcc;return function(_0x323e63){if(_0x323e63){return _0x23dcd9[_0xc4ef('0x2b')](_0x165f09);}return _0x23dcd9[_0xc4ef('0x2c')](_0x165f09)[_0xc4ef('0x2d')]();};}function respondWithResult(_0x3bf652,_0x1a42b8){_0x1a42b8=_0x1a42b8||0xc8;return function(_0x251b54){if(_0x251b54){return _0x3bf652[_0xc4ef('0x2c')](_0x1a42b8)[_0xc4ef('0x2e')](_0x251b54);}};}function respondWithFilteredResult(_0x3b899b,_0x4296d9){return function(_0x5c0826){if(_0x5c0826){var _0x1cca65=typeof _0x4296d9[_0xc4ef('0x2f')]==='undefined'&&typeof _0x4296d9[_0xc4ef('0x30')]===_0xc4ef('0x31');var _0xb4274f=_0x5c0826[_0xc4ef('0x32')];var _0x29b6ea=_0x1cca65?0x0:_0x4296d9['offset'];var _0x4803ed=_0x1cca65?_0x5c0826[_0xc4ef('0x32')]:_0x4296d9['offset']+_0x4296d9[_0xc4ef('0x30')];var _0x38d708;if(_0x4803ed>=_0xb4274f){_0x4803ed=_0xb4274f;_0x38d708=0xc8;}else{_0x38d708=0xce;}_0x3b899b[_0xc4ef('0x2c')](_0x38d708);return _0x3b899b['set'](_0xc4ef('0x33'),_0x29b6ea+'-'+_0x4803ed+'/'+_0xb4274f)[_0xc4ef('0x2e')](_0x5c0826);}return null;};}function patchUpdates(_0xf45951){return function(_0x58b8bc){try{jsonpatch[_0xc4ef('0x34')](_0x58b8bc,_0xf45951,!![]);}catch(_0x4267e2){return BPromise['reject'](_0x4267e2);}return _0x58b8bc[_0xc4ef('0x35')]();};}function saveUpdates(_0x114477,_0x264438){return function(_0x10db79){if(_0x10db79){return _0x10db79['update'](_0x114477)[_0xc4ef('0x20')](function(_0x465b45){return _0x465b45;});}return null;};}function removeEntity(_0x94516f,_0x5bce05){return function(_0x4cb883){if(_0x4cb883){return _0x4cb883[_0xc4ef('0x36')]()[_0xc4ef('0x20')](function(){_0x94516f[_0xc4ef('0x2c')](0xcc)[_0xc4ef('0x2d')]();});}};}function handleEntityNotFound(_0x2b3b97,_0x127227){return function(_0x384a8e){if(!_0x384a8e){_0x2b3b97[_0xc4ef('0x2b')](0x194);}return _0x384a8e;};}function handleError(_0x23d61f,_0x3d063a){_0x3d063a=_0x3d063a||0x1f4;return function(_0xf74bfc){logger[_0xc4ef('0x24')](_0xf74bfc[_0xc4ef('0x37')]);if(_0xf74bfc['name']){delete _0xf74bfc['name'];}_0x23d61f[_0xc4ef('0x2c')](_0x3d063a)['send'](_0xf74bfc);};}function getMustacheRender(_0x167886,_0x4e6b90){return Mustache['render'](_0x167886,_[_0xc4ef('0x38')](_0x4e6b90[_0xc4ef('0x39')],{'contact':_0x4e6b90[_0xc4ef('0x3a')],'message':_0x4e6b90[_0xc4ef('0x27')],'agent':_0x4e6b90[_0xc4ef('0x3b')],'interaction':_0x4e6b90[_0xc4ef('0x3c')],'account':_0x4e6b90[_0xc4ef('0x3d')]}))||'';}exports[_0xc4ef('0x3e')]=function(_0x1ff9e3,_0x31874f){var _0x2661bc={},_0xbc8ef6={},_0x504a7e={'count':0x0,'rows':[]};var _0x42cd6=_[_0xc4ef('0x3f')](db[_0xc4ef('0x40')][_0xc4ef('0x41')],function(_0x5e93f3){return{'name':_0x5e93f3[_0xc4ef('0x42')],'type':_0x5e93f3[_0xc4ef('0x43')][_0xc4ef('0x44')]};});_0xbc8ef6['model']=_[_0xc4ef('0x3f')](_0x42cd6,'name');_0xbc8ef6['query']=_[_0xc4ef('0x45')](_0x1ff9e3[_0xc4ef('0x46')]);_0xbc8ef6[_0xc4ef('0x47')]=_[_0xc4ef('0x48')](_0xbc8ef6[_0xc4ef('0x49')],_0xbc8ef6['query']);_0x2661bc['attributes']=_[_0xc4ef('0x48')](_0xbc8ef6[_0xc4ef('0x49')],qs['fields'](_0x1ff9e3[_0xc4ef('0x46')][_0xc4ef('0x4a')]));_0x2661bc['attributes']=_0x2661bc[_0xc4ef('0x4b')][_0xc4ef('0x4c')]?_0x2661bc[_0xc4ef('0x4b')]:_0xbc8ef6[_0xc4ef('0x49')];if(!_0x1ff9e3[_0xc4ef('0x46')][_0xc4ef('0x4d')]('nolimit')){_0x2661bc[_0xc4ef('0x30')]=qs['limit'](_0x1ff9e3[_0xc4ef('0x46')]['limit']);_0x2661bc['offset']=qs['offset'](_0x1ff9e3[_0xc4ef('0x46')][_0xc4ef('0x2f')]);}_0x2661bc[_0xc4ef('0x4e')]=qs[_0xc4ef('0x4f')](_0x1ff9e3[_0xc4ef('0x46')][_0xc4ef('0x4f')]);_0x2661bc['where']=qs[_0xc4ef('0x47')](_[_0xc4ef('0x50')](_0x1ff9e3['query'],_0xbc8ef6['filters']),_0x42cd6);if(_0x1ff9e3[_0xc4ef('0x46')][_0xc4ef('0x51')]){_0x2661bc['where']=_[_0xc4ef('0x38')](_0x2661bc[_0xc4ef('0x52')],{'$or':_['map'](_0x42cd6,function(_0x4522e4){if(_0x4522e4[_0xc4ef('0x43')]!==_0xc4ef('0x53')){var _0x231e16={};_0x231e16[_0x4522e4[_0xc4ef('0x54')]]={'$like':'%'+_0x1ff9e3[_0xc4ef('0x46')][_0xc4ef('0x51')]+'%'};return _0x231e16;}})});}_0x2661bc=_[_0xc4ef('0x38')]({},_0x2661bc,_0x1ff9e3[_0xc4ef('0x55')]);var _0x1e732d={'where':_0x2661bc[_0xc4ef('0x52')]};return db['SmsMessage'][_0xc4ef('0x32')](_0x1e732d)[_0xc4ef('0x20')](function(_0x16e7d1){_0x504a7e[_0xc4ef('0x32')]=_0x16e7d1;if(_0x1ff9e3['query']['includeAll']){_0x2661bc[_0xc4ef('0x56')]=[{'all':!![]}];}return db[_0xc4ef('0x40')][_0xc4ef('0x57')](_0x2661bc);})['then'](function(_0x272e29){_0x504a7e['rows']=_0x272e29;return _0x504a7e;})['then'](respondWithFilteredResult(_0x31874f,_0x2661bc))[_0xc4ef('0x2a')](handleError(_0x31874f,null));};exports[_0xc4ef('0x58')]=function(_0x35493b,_0x31c7b5){var _0x369f35={'raw':!![],'where':{'id':_0x35493b[_0xc4ef('0x59')]['id']}},_0x2ae624={};_0x2ae624[_0xc4ef('0x49')]=_[_0xc4ef('0x45')](db[_0xc4ef('0x40')][_0xc4ef('0x41')]);_0x2ae624[_0xc4ef('0x46')]=_[_0xc4ef('0x45')](_0x35493b[_0xc4ef('0x46')]);_0x2ae624[_0xc4ef('0x47')]=_[_0xc4ef('0x48')](_0x2ae624[_0xc4ef('0x49')],_0x2ae624[_0xc4ef('0x46')]);_0x369f35[_0xc4ef('0x4b')]=_[_0xc4ef('0x48')](_0x2ae624['model'],qs[_0xc4ef('0x4a')](_0x35493b[_0xc4ef('0x46')][_0xc4ef('0x4a')]));_0x369f35[_0xc4ef('0x4b')]=_0x369f35['attributes'][_0xc4ef('0x4c')]?_0x369f35[_0xc4ef('0x4b')]:_0x2ae624['model'];if(_0x35493b['query'][_0xc4ef('0x5a')]){_0x369f35[_0xc4ef('0x56')]=[{'all':!![]}];}_0x369f35=_['merge']({},_0x369f35,_0x35493b[_0xc4ef('0x55')]);return db[_0xc4ef('0x40')][_0xc4ef('0x5b')](_0x369f35)['then'](handleEntityNotFound(_0x31c7b5,null))[_0xc4ef('0x20')](respondWithResult(_0x31c7b5,null))[_0xc4ef('0x2a')](handleError(_0x31c7b5,null));};exports['create']=function(_0x5aaf52,_0x41809c){return db[_0xc4ef('0x40')][_0xc4ef('0x5c')](_0x5aaf52[_0xc4ef('0x39')],{})[_0xc4ef('0x20')](respondWithResult(_0x41809c,0xc9))[_0xc4ef('0x2a')](handleError(_0x41809c,null));};exports['update']=function(_0x368a67,_0x5e84d8){if(_0x368a67['body']['id']){delete _0x368a67['body']['id'];}return db[_0xc4ef('0x40')]['find']({'where':{'id':_0x368a67[_0xc4ef('0x59')]['id']}})['then'](handleEntityNotFound(_0x5e84d8,null))[_0xc4ef('0x20')](saveUpdates(_0x368a67[_0xc4ef('0x39')],null))[_0xc4ef('0x20')](respondWithResult(_0x5e84d8,null))[_0xc4ef('0x2a')](handleError(_0x5e84d8,null));};exports[_0xc4ef('0x36')]=function(_0x48f3e6,_0x524dd8){return db[_0xc4ef('0x40')]['find']({'where':{'id':_0x48f3e6[_0xc4ef('0x59')]['id']}})[_0xc4ef('0x20')](handleEntityNotFound(_0x524dd8,null))[_0xc4ef('0x20')](removeEntity(_0x524dd8,null))[_0xc4ef('0x2a')](handleError(_0x524dd8,null));};exports[_0xc4ef('0x5d')]=function(_0x3d9c37,_0xde1ee6){return db[_0xc4ef('0x40')][_0xc4ef('0x5d')]()[_0xc4ef('0x20')](respondWithResult(_0xde1ee6,null))[_0xc4ef('0x2a')](handleError(_0xde1ee6,null));};var interaction_log=require(_0xc4ef('0x13'))('sms-interactions');exports[_0xc4ef('0x5e')]=function(_0x32a18e,_0x4d02ed,_0x501978){var _0x42c7f4={'agent':{},'channel':_0xc4ef('0x5f')};if(_0x32a18e[_0xc4ef('0x39')]['id']){delete _0x32a18e[_0xc4ef('0x39')]['id'];}_0x32a18e[_0xc4ef('0x39')]['read']=!![];_0x32a18e['body'][_0xc4ef('0x60')]=moment()[_0xc4ef('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x32a18e[_0xc4ef('0x39')][_0xc4ef('0x62')]=_0x32a18e[_0xc4ef('0x39')][_0xc4ef('0x62')]||_0x32a18e[_0xc4ef('0x63')]['id'];_0x42c7f4['agent']['id']=_0x32a18e['body'][_0xc4ef('0x62')];return db[_0xc4ef('0x40')][_0xc4ef('0x5b')]({'where':{'id':_0x32a18e['params']['id'],'UserId':null},'include':[{'model':db[_0xc4ef('0x64')],'as':_0xc4ef('0x65')}]})[_0xc4ef('0x20')](handleEntityNotFound(_0x4d02ed,null))[_0xc4ef('0x20')](saveUpdates(_0x32a18e[_0xc4ef('0x39')],null))['then'](function(_0x5b694a){if(_0x5b694a){_0x42c7f4[_0xc4ef('0x27')]=_0x5b694a[_0xc4ef('0x66')]({'plain':!![]});return db[_0xc4ef('0x67')][_0xc4ef('0x5b')]({'where':{'id':_0x5b694a[_0xc4ef('0x68')]}});}return null;})[_0xc4ef('0x20')](handleEntityNotFound(_0x4d02ed,null))[_0xc4ef('0x20')](function(_0x385d13){if(_0x385d13){return _0x385d13[_0xc4ef('0x69')]({'UserId':_0x32a18e[_0xc4ef('0x39')][_0xc4ef('0x62')],'read1stAt':_[_0xc4ef('0x6a')](_0x385d13[_0xc4ef('0x6b')])?moment()['format'](_0xc4ef('0x6c')):undefined});}return null;})[_0xc4ef('0x20')](function(_0x44a2e6){if(_0x44a2e6){_0x42c7f4[_0xc4ef('0x3c')]=_0x44a2e6['get']({'plain':!![]});interaction_log[_0xc4ef('0x28')](_0xc4ef('0x6d'),_0x32a18e[_0xc4ef('0x63')]['id'],_0x32a18e['user'][_0xc4ef('0x54')],_0x32a18e[_0xc4ef('0x63')][_0xc4ef('0x6e')],_0x42c7f4[_0xc4ef('0x3c')]['id'],_0x32a18e[_0xc4ef('0x39')]?JSON[_0xc4ef('0x23')](_0x32a18e[_0xc4ef('0x39')]):_0xc4ef('0x6f'));return respondWithRpcPromise(_0xc4ef('0x70'),_0xc4ef('0x71'),_0x42c7f4);}return null;})[_0xc4ef('0x20')](function(_0x837d0a){if(_0x837d0a){if(_0x32a18e[_0xc4ef('0x39')][_0xc4ef('0x72')]){_0x42c7f4[_0xc4ef('0x27')]['interface']=util[_0xc4ef('0x61')](_0xc4ef('0x73'),_0x32a18e['user'][_0xc4ef('0x54')]);_0x42c7f4['message']['channel']=_0x42c7f4[_0xc4ef('0x74')];_0x42c7f4[_0xc4ef('0x27')][_0xc4ef('0x75')]=_0xc4ef('0x5e');return respondWithRpcPromise(_0xc4ef('0x76'),'EventManager',{'event':_0xc4ef('0x77'),'message':_0x42c7f4[_0xc4ef('0x27')]},client9002)[_0xc4ef('0x20')](function(){return _0x42c7f4;});}return _0x42c7f4;}return null;})[_0xc4ef('0x20')](respondWithResult(_0x4d02ed,null))['catch'](handleError(_0x4d02ed,null));};var interaction_log=require(_0xc4ef('0x13'))(_0xc4ef('0x78'));exports['reject']=function(_0x57abcd,_0x2f580e,_0x288949){var _0x4b7a09={'agent':{},'channel':_0xc4ef('0x5f')};if(_0x57abcd[_0xc4ef('0x39')]['id']){delete _0x57abcd[_0xc4ef('0x39')]['id'];}_0x57abcd['body'][_0xc4ef('0x62')]=_0x57abcd['body'][_0xc4ef('0x62')]||_0x57abcd['user']['id'];_0x4b7a09[_0xc4ef('0x3b')]['id']=_0x57abcd[_0xc4ef('0x39')]['UserId'];return db[_0xc4ef('0x40')][_0xc4ef('0x5b')]({'where':{'id':_0x57abcd[_0xc4ef('0x59')]['id'],'UserId':null}})[_0xc4ef('0x20')](handleEntityNotFound(_0x2f580e,null))[_0xc4ef('0x20')](function(_0x58a12e){if(_0x58a12e){_0x4b7a09[_0xc4ef('0x27')]=_0x58a12e[_0xc4ef('0x66')]({'plain':!![]});return db['SmsInteraction'][_0xc4ef('0x5b')]({'where':{'id':_0x58a12e['SmsInteractionId']}});}return null;})[_0xc4ef('0x20')](handleEntityNotFound(_0x2f580e,null))[_0xc4ef('0x20')](function(_0x389f50){if(_0x389f50){_0x4b7a09[_0xc4ef('0x3c')]=_0x389f50['get']({'plain':!![]});interaction_log['info'](_0xc4ef('0x79'),_0x57abcd['user']['id'],_0x57abcd[_0xc4ef('0x63')][_0xc4ef('0x54')],_0x57abcd[_0xc4ef('0x63')][_0xc4ef('0x6e')],_0x4b7a09[_0xc4ef('0x3c')]['id'],_0x57abcd['body']?JSON[_0xc4ef('0x23')](_0x57abcd['body']):_0xc4ef('0x6f'));return respondWithRpcPromise(_0xc4ef('0x7a'),_0xc4ef('0x7b'),_0x4b7a09);}return null;})[_0xc4ef('0x20')](function(_0x2c4e73){if(_0x2c4e73){_0x2c4e73[_0xc4ef('0x27')]['interface']=util[_0xc4ef('0x61')](_0xc4ef('0x73'),_0x57abcd[_0xc4ef('0x63')]['name']);_0x2c4e73[_0xc4ef('0x27')][_0xc4ef('0x74')]=_0x4b7a09['channel'];_0x2c4e73[_0xc4ef('0x27')]['event']=_0xc4ef('0x7c');respondWithRpcPromise(_0xc4ef('0x76'),'EventManager',{'event':_0xc4ef('0x7d'),'message':_0x2c4e73[_0xc4ef('0x27')]},client9002);return _0x4b7a09;}return null;})[_0xc4ef('0x20')](respondWithResult(_0x2f580e,null))[_0xc4ef('0x2a')](handleError(_0x2f580e,null));};exports[_0xc4ef('0x2c')]=function(_0x3bfd9f,_0x3b135d,_0x9adfb5){if(_0x3bfd9f[_0xc4ef('0x39')]['id']){delete _0x3bfd9f[_0xc4ef('0x39')]['id'];}var _0x288493;return db['SmsMessage'][_0xc4ef('0x5b')]({'where':{'id':_0x3bfd9f[_0xc4ef('0x59')]['id']}})[_0xc4ef('0x20')](handleEntityNotFound(_0x3b135d,null))[_0xc4ef('0x20')](function(_0x1f5fec){if(_0x1f5fec){_0x288493=_0x1f5fec;return db[_0xc4ef('0x7e')][_0xc4ef('0x5b')]({'where':{'id':_0x1f5fec[_0xc4ef('0x7f')]}});}})[_0xc4ef('0x20')](handleEntityNotFound(_0x3b135d,null))['then'](function(_0x12a92b){if(_0x12a92b){logger[_0xc4ef('0x22')](_0xc4ef('0x80'),'status',_0xc4ef('0x81'),_0x12a92b[_0xc4ef('0x43')],util[_0xc4ef('0x82')](_0x3bfd9f[_0xc4ef('0x39')],{'showHidden':![],'depth':null}));switch(_0x12a92b['type']){case _0xc4ef('0x83'):if(_0x3bfd9f['body']['MessageSid']&&_0x3bfd9f[_0xc4ef('0x39')][_0xc4ef('0x84')]===_0x288493[_0xc4ef('0x85')]){return _0x288493['update']({'read':!![]});}else{logger[_0xc4ef('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc4ef('0x2c'),_0xc4ef('0x83'),util[_0xc4ef('0x82')](_0x3bfd9f[_0xc4ef('0x39')],{'showHidden':![],'depth':null}));}break;case _0xc4ef('0x86'):if(_0x3bfd9f['body'][_0xc4ef('0x87')]&&_0x3bfd9f[_0xc4ef('0x39')][_0xc4ef('0x87')]===_0x288493['messageId']&&_[_0xc4ef('0x88')](['sent','delivered'],_0x3bfd9f[_0xc4ef('0x39')]['Status'])>=0x0){return _0x288493[_0xc4ef('0x69')]({'read':!![]});}else{logger[_0xc4ef('0x24')](_0xc4ef('0x89'),_0xc4ef('0x2c'),_0xc4ef('0x8a'),util[_0xc4ef('0x82')](_0x3bfd9f[_0xc4ef('0x39')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x53b037=_0x3bfd9f[_0xc4ef('0x39')]['results'][0x0];if(_0x53b037[_0xc4ef('0x2c')][_0xc4ef('0x8b')]===_0xc4ef('0x8c')){return _0x288493[_0xc4ef('0x69')]({'read':!![]});}else{logger['error'](_0xc4ef('0x89'),_0xc4ef('0x2c'),'infobip',util[_0xc4ef('0x82')](_0x3bfd9f[_0xc4ef('0x39')],{'showHidden':![],'depth':null}));}break;}return _0x288493;}})[_0xc4ef('0x20')](respondWithResult(_0x3b135d,null))[_0xc4ef('0x2a')](handleError(_0x3b135d,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 4361552..e8e746e 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 _0x6794=['hasOwnProperty','hook','../../mysqldb','SmsMessage','setMaxListeners','save','remove','emit'];(function(_0x461945,_0x1ed923){var _0x259df0=function(_0x109a2d){while(--_0x109a2d){_0x461945['push'](_0x461945['shift']());}};_0x259df0(++_0x1ed923);}(_0x6794,0x1f2));var _0x4679=function(_0x3b7921,_0x2d2c0a){_0x3b7921=_0x3b7921-0x0;var _0x16b744=_0x6794[_0x3b7921];return _0x16b744;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x4679('0x0'))['db'][_0x4679('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4679('0x2')](0x0);var events={'afterCreate':_0x4679('0x3'),'afterUpdate':'update','afterDestroy':_0x4679('0x4')};function emitEvent(_0x48e065){return function(_0x3e6424,_0x5d1ab8,_0x4b2380){SmsMessageEvents[_0x4679('0x5')](_0x48e065+':'+_0x3e6424['id'],_0x3e6424);SmsMessageEvents['emit'](_0x48e065,_0x3e6424);_0x4b2380(null);};}for(var e in events){if(events[_0x4679('0x6')](e)){var event=events[e];SmsMessage[_0x4679('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xf4a3=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb','SmsMessage'];(function(_0x2d5dcf,_0xf71498){var _0x42a3e8=function(_0xaa41d8){while(--_0xaa41d8){_0x2d5dcf['push'](_0x2d5dcf['shift']());}};_0x42a3e8(++_0xf71498);}(_0xf4a3,0xf0));var _0x3f4a=function(_0x4ae345,_0x479da5){_0x4ae345=_0x4ae345-0x0;var _0x3b2917=_0xf4a3[_0x4ae345];return _0x3b2917;};'use strict';var EventEmitter=require(_0x3f4a('0x0'));var SmsMessage=require(_0x3f4a('0x1'))['db'][_0x3f4a('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x3f4a('0x3')](0x0);var events={'afterCreate':_0x3f4a('0x4'),'afterUpdate':_0x3f4a('0x5'),'afterDestroy':_0x3f4a('0x6')};function emitEvent(_0x1a5c7){return function(_0x417d70,_0x546c49,_0x46f6d6){SmsMessageEvents['emit'](_0x1a5c7+':'+_0x417d70['id'],_0x417d70);SmsMessageEvents[_0x3f4a('0x7')](_0x1a5c7,_0x417d70);_0x46f6d6(null);};}for(var e in events){if(events[_0x3f4a('0x8')](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 bbbf0ad..804693a 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 _0x5377=['https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','application/json','code','message','Bearer\x20','status','refid','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','messageId','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','catch','error','out','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','GET','split','sms','POST','user_key','session_key','total_sent','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth'];(function(_0x374ff6,_0x30546f){var _0x58203b=function(_0x4adb9a){while(--_0x4adb9a){_0x374ff6['push'](_0x374ff6['shift']());}};_0x58203b(++_0x30546f);}(_0x5377,0x102));var _0x7537=function(_0x250519,_0xa499ab){_0x250519=_0x250519-0x0;var _0x37b370=_0x5377[_0x250519];return _0x37b370;};'use strict';var _=require(_0x7537('0x0'));var util=require(_0x7537('0x1'));var logger=require('../../config/logger')(_0x7537('0x2'));var moment=require('moment');var BPromise=require(_0x7537('0x3'));var rp=require(_0x7537('0x4'));var fs=require('fs');var path=require(_0x7537('0x5'));var rimraf=require(_0x7537('0x6'));var config=require(_0x7537('0x7'));var attributes=require('./smsMessage.attributes');module[_0x7537('0x8')]=function(_0x2aedfb,_0x4878dc){return _0x2aedfb[_0x7537('0x9')](_0x7537('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x7537('0xb'),'fields':[_0x7537('0xb')]},{'name':'fti_sms_messages','fields':[_0x7537('0xc')],'type':_0x7537('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x29c8d7,_0x2f2b54,_0x22fe5c){var _0x86190b=_0x2aedfb[_0x7537('0xe')];var _0x228113=_0x29c8d7[_0x7537('0xf')]({'plain':!![]});if(_0x228113[_0x7537('0x10')][_0x7537('0x11')]()==='in'||_0x228113['direction'][_0x7537('0x11')]()==='out'&&!_0x228113[_0x7537('0x12')]&&!_[_0x7537('0x13')](_0x228113[_0x7537('0x14')])){_0x86190b[_0x7537('0x15')][_0x7537('0x16')]({'where':{'id':_0x228113[_0x7537('0x17')]}})[_0x7537('0x18')](function(_0x5c32f7){if(_0x5c32f7){_0x5c32f7[_0x7537('0x19')]({'lastMsgAt':_0x228113['createdAt'],'lastMsgDirection':_0x228113[_0x7537('0x10')]['toLowerCase']()});}})[_0x7537('0x1a')](function(_0x33653e){console[_0x7537('0x1b')](_0x33653e);});}if(_0x228113[_0x7537('0x10')]===_0x7537('0x1c')&&!_0x228113['secret']){var _0x1d64c2;_0x86190b[_0x7537('0x1d')]['find']({'where':{'id':_0x228113[_0x7537('0x1e')]},'raw':!![]})[_0x7537('0x18')](function(_0x1c40d6){_0x1d64c2=_0x1c40d6;if(_0x1d64c2&&_0x1d64c2[_0x7537('0x1f')]){switch(_0x1d64c2[_0x7537('0x1f')]){case _0x7537('0x20'):var _0x4b3f4f=require(_0x7537('0x20'));if(_0x1d64c2[_0x7537('0x21')]&&_0x1d64c2[_0x7537('0x22')]&&_0x1d64c2[_0x7537('0x23')]){var _0x3bc559=new _0x4b3f4f(_0x1d64c2[_0x7537('0x21')],_0x1d64c2[_0x7537('0x22')]);_0x3bc559['messages']['create']({'body':_0x228113[_0x7537('0xc')],'to':_0x228113['phone'],'from':_0x1d64c2['phone'],'statusCallback':_0x1d64c2[_0x7537('0x24')]+_0x7537('0x25')+_0x228113['id']+_0x7537('0x26')+_0x1d64c2[_0x7537('0x27')]})['then'](function(_0x3eca69){if(_0x3eca69[_0x7537('0x28')]){return _0x29c8d7['update']({'messageId':_0x3eca69[_0x7537('0x28')]});}})[_0x7537('0x1a')](function(_0x28a6cd){logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x20'),util[_0x7537('0x2b')](_0x28a6cd,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7537('0x2a'),_0x7537('0x20'),_0x7537('0x2c'));}break;case _0x7537('0x2d'):var _0xabe1bf=_0x7537('0x2e');if(_0x1d64c2[_0x7537('0x2f')]&&_0x1d64c2[_0x7537('0x30')]){var _0x441c60={'recipient':[_0x228113['phone']],'message':_0x228113[_0x7537('0xc')],'message_type':_0x1d64c2[_0x7537('0x31')]};if(_0x1d64c2[_0x7537('0x31')]&&_0x1d64c2[_0x7537('0x31')]!=='SI'){_0x441c60[_0x7537('0x32')]=_0x1d64c2[_0x7537('0x23')];}var _0x5ed385={'url':_0xabe1bf+'login?username='+_0x1d64c2['username']+'&password='+_0x1d64c2[_0x7537('0x30')],'method':_0x7537('0x33')};rp(_0x5ed385)[_0x7537('0x18')](function(_0x4a7d38){var _0x3a6b21=_0x4a7d38[_0x7537('0x34')](';');var _0x35cde2={'user_key':_0x3a6b21[0x0],'session_key':_0x3a6b21[0x1]};_0x5ed385={'url':_0xabe1bf+_0x7537('0x35'),'method':_0x7537('0x36'),'headers':{'user_key':_0x35cde2[_0x7537('0x37')],'Session_key':_0x35cde2[_0x7537('0x38')]},'json':!![],'body':_0x441c60};return rp(_0x5ed385);})['then'](function(_0x2d1b45){if(_0x2d1b45[_0x7537('0x39')]>=0x1){var _0x433352={'messageId':_0x2d1b45['internal_order_id']};if(_0x1d64c2[_0x7537('0x31')]!=='GP'||!_0x1d64c2[_0x7537('0x3a')]){_0x433352[_0x7537('0x3b')]=!![];}return _0x29c8d7[_0x7537('0x19')](_0x433352);}else{return logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),'skebby',util[_0x7537('0x2b')](_0x2d1b45,{'showHidden':![],'depth':null}));}})[_0x7537('0x1a')](function(_0x1522b8){return logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x2d'),util['inspect'](_0x1522b8,{'showHidden':![],'depth':null}));});}else{logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x2d'),_0x7537('0x3c'));}break;case _0x7537('0x3d'):if(_0x1d64c2[_0x7537('0x22')]){var _0x2090e1={'recipient':_0x228113[_0x7537('0x23')],'message':_0x228113[_0x7537('0xc')],'sender':_0x1d64c2[_0x7537('0x3e')]||_0x1d64c2[_0x7537('0x23')],'authorization':_0x1d64c2[_0x7537('0x22')]};var _0x2f2b54={'method':_0x7537('0x36'),'uri':_0x7537('0x3f'),'body':_0x2090e1,'json':!![]};rp(_0x2f2b54)[_0x7537('0x18')](function(_0x2f023e){var _0x962435={'messageId':_0x2f023e['requestid']};if(!_0x1d64c2[_0x7537('0x3a')]){_0x962435[_0x7537('0x3b')]=!![];}return _0x29c8d7[_0x7537('0x19')](_0x962435);})[_0x7537('0x1a')](function(_0x41e019){logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x3d'),util['inspect'](_0x41e019,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7537('0x29'),'afterCreate',_0x7537('0x3d'),_0x7537('0x40'));}break;case _0x7537('0x41'):if(_0x1d64c2['username']&&_0x1d64c2[_0x7537('0x30')]){var _0x2090e1={'messages':[{'source':'xCALLY\x20Motion','to':_0x228113[_0x7537('0x23')],'body':_0x228113[_0x7537('0xc')],'from':_0x1d64c2[_0x7537('0x3e')]||_0x1d64c2[_0x7537('0x23')]}]};var _0x52c26f=util[_0x7537('0x42')](_0x7537('0x43'),_0x1d64c2[_0x7537('0x2f')],_0x1d64c2['password']);var _0x2f2b54={'method':_0x7537('0x36'),'uri':_0x7537('0x44'),'body':_0x2090e1,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x52c26f)['toString'](_0x7537('0x45')))},'json':!![]};rp(_0x2f2b54)['then'](function(_0x4a2599){if(_0x4a2599[_0x7537('0x46')]>=0xc8&&_0x4a2599[_0x7537('0x46')]<=0xce){if(_0x4a2599[_0x7537('0x47')]&&_0x4a2599['data'][_0x7537('0x48')]>0x0){var _0xb702f0=_[_0x7537('0x49')](_0x4a2599['data'][_0x7537('0x4a')]);var _0x24d8bf={'messageId':_0xb702f0[_0x7537('0x4b')]};if(!_0x1d64c2[_0x7537('0x3a')]){_0x24d8bf['read']=!![];}return _0x29c8d7['update'](_0x24d8bf);}else{logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x4c'),util['inspect'](_0x4a2599,{'showHidden':![],'depth':null}));}}else{logger[_0x7537('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7537('0x2a'),_0x7537('0x4c'),util[_0x7537('0x2b')](_0x4a2599,{'showHidden':![],'depth':null}));}})['catch'](function(_0x30065e){logger[_0x7537('0x1b')](_0x7537('0x29'),'afterCreate','clickSend',util[_0x7537('0x2b')](_0x30065e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7537('0x29'),'afterCreate','clickSend',_0x7537('0x3c'));}break;case _0x7537('0x4d'):if(_0x1d64c2['authId']&&_0x1d64c2[_0x7537('0x22')]){var _0x2090e1={'dst':_0x228113[_0x7537('0x23')],'text':_0x228113[_0x7537('0xc')],'src':_0x1d64c2[_0x7537('0x3e')]||_0x1d64c2['phone'],'url':_0x1d64c2[_0x7537('0x24')]+_0x7537('0x25')+_0x228113['id']+_0x7537('0x26')+_0x1d64c2[_0x7537('0x27')]};var _0x52c26f=util[_0x7537('0x42')](_0x7537('0x43'),_0x1d64c2[_0x7537('0x4e')],_0x1d64c2[_0x7537('0x22')]);var _0x2f2b54={'method':_0x7537('0x36'),'uri':util[_0x7537('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0x1d64c2[_0x7537('0x4e')]),'body':_0x2090e1,'headers':{'Authorization':util[_0x7537('0x42')](_0x7537('0x4f'),new Buffer(_0x52c26f)['toString'](_0x7537('0x45')))},'json':!![]};rp(_0x2f2b54)[_0x7537('0x18')](function(_0x5ce053){var _0x1a9f04={'messageId':_0x5ce053[_0x7537('0x50')][0x0]};return _0x29c8d7[_0x7537('0x19')](_0x1a9f04);})[_0x7537('0x1a')](function(_0x17375c){logger['error'](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x4d'),util[_0x7537('0x2b')](_0x17375c,{'showHidden':![],'depth':null}));});}else{logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),'plivo',_0x7537('0x51'));}break;case _0x7537('0x52'):if(_0x1d64c2['username']&&_0x1d64c2[_0x7537('0x30')]){if(_0x1d64c2[_0x7537('0x53')]){var _0x221188={'method':'POST','uri':_0x1d64c2[_0x7537('0x53')]+'/auth/1/session','body':{'username':_0x1d64c2[_0x7537('0x2f')],'password':_0x1d64c2[_0x7537('0x30')]},'json':!![]};return rp(_0x221188)[_0x7537('0x18')](function(_0x439d5e){var _0x1095ce={'method':_0x7537('0x36'),'uri':_0x1d64c2[_0x7537('0x53')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x1d64c2['phone'],'destinations':[{'to':_0x228113[_0x7537('0x23')]}],'text':_0x228113['body'],'notifyUrl':_0x1d64c2['remote']+_0x7537('0x25')+_0x228113['id']+_0x7537('0x26')+_0x1d64c2[_0x7537('0x27')],'notifyContentType':'application/json','callbackData':_0x1d64c2[_0x7537('0x23')]+';'+_0x228113['body']}]},'headers':{'Authorization':_0x7537('0x54')+_0x439d5e['token']},'json':!![]};return rp(_0x1095ce)[_0x7537('0x18')](function(_0x5a8f36){if(_0x5a8f36['messages']){var _0x552cc1={'messageId':_0x5a8f36[_0x7537('0x4a')][0x0]['messageId']};if(!_0x1d64c2[_0x7537('0x3a')]){_0x552cc1[_0x7537('0x3b')]=!![];}return _0x29c8d7['update'](_0x552cc1);}else{return logger[_0x7537('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7537('0x52'),util[_0x7537('0x2b')](_0x5a8f36,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x1f18ff){return logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x52'),util['inspect'](_0x1f18ff,{'showHidden':![],'depth':null}));});}else{logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x52'),_0x7537('0x55'));}}else{logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x2c5090=require(_0x7537('0x56'));if(_0x1d64c2[_0x7537('0x57')]){var _0x257962={};_0x257962[_0x7537('0x58')]=_0x1d64c2[_0x7537('0x2f')];_0x257962[_0x7537('0x23')]=_0x228113[_0x7537('0x23')];_0x257962[_0x7537('0x32')]=_0x1d64c2['phone'];_0x257962[_0x7537('0x59')]=_0x228113[_0x7537('0xc')];_0x257962[_0x7537('0x5a')]=+new Date();var _0x403221='';var _0x2db4a6='';var _0x2bf71b=Object[_0x7537('0x5b')](_0x257962);_0x2bf71b[_0x7537('0x5c')]();for(var _0x14c197=0x0;_0x14c197<_0x2bf71b[_0x7537('0x5d')];_0x14c197++){if(_0x403221!=''){_0x403221+='&';}_0x403221+=_0x2bf71b[_0x14c197]+'='+encodeURIComponent(_0x257962[_0x2bf71b[_0x14c197]]);_0x2db4a6+=_0x257962[_0x2bf71b[_0x14c197]];}_0x2db4a6+=_0x1d64c2[_0x7537('0x57')];_0x2db4a6=_0x2c5090[_0x7537('0x5e')](_0x7537('0x5f'))[_0x7537('0x19')](_0x2db4a6)[_0x7537('0x60')](_0x7537('0x61'));if(_0x403221!==''){_0x403221+='&';}_0x403221+=_0x7537('0x62')+_0x2db4a6;var _0x5ed385={'method':_0x7537('0x33'),'uri':_0x1d64c2[_0x7537('0x53')]+_0x7537('0x63')+_0x403221,'json':!![]};return rp(_0x5ed385)[_0x7537('0x18')](function(_0x1e9511){var _0x1b8006=Object[_0x7537('0x5b')](_0x1e9511);if(_0x1e9511[_0x1b8006[0x0]][_0x7537('0x1b')]&&parseInt(_0x1e9511[_0x1b8006[0x0]]['error'])===0x0){var _0x5dcd5f={'messageId':_0x1e9511[_0x1b8006[0x0]][_0x7537('0x64')]};if(!_0x1d64c2[_0x7537('0x3a')]){_0x5dcd5f[_0x7537('0x3b')]=!![];}return _0x29c8d7['update'](_0x5dcd5f);}else{return logger['error'](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x65'),util[_0x7537('0x2b')](_0x1e9511[_0x7537('0x1b')],{'showHidden':![],'depth':null}));}})[_0x7537('0x1a')](function(_0x232c13){return logger[_0x7537('0x1b')](_0x7537('0x29'),'afterCreate','csc',util[_0x7537('0x2b')](_0x232c13,{'showHidden':![],'depth':null}));});}else{logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x65'),_0x7537('0x66'));}break;case _0x7537('0x67'):if(_0x1d64c2[_0x7537('0x57')]){var _0x5a37ea={'method':_0x7537('0x36'),'uri':_0x7537('0x68'),'headers':{'Authorization':_0x1d64c2[_0x7537('0x57')]},'body':{'content':_0x228113[_0x7537('0xc')],'to':[_0x228113[_0x7537('0x23')]],'from':_0x1d64c2[_0x7537('0x23')],'binary':![],'clientMessageId':_0x7537('0x69'),'charset':_0x7537('0x6a')},'json':!![]};rp(_0x5a37ea)['then'](function(_0x1192ef){if(!_0x1192ef[_0x7537('0x1b')]){var _0x4f9e34={'messageId':_0x1192ef['messages'][0x0]['apiMessageId']};if(!_0x1d64c2[_0x7537('0x3a')]){_0x4f9e34[_0x7537('0x3b')]=!![];}return _0x29c8d7[_0x7537('0x19')](_0x4f9e34);}else{return logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x67'),util[_0x7537('0x2b')](_0x1192ef[_0x7537('0x1b')],{'showHidden':![],'depth':null}));}})[_0x7537('0x1a')](function(_0x6ca15e){return logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x67'),util[_0x7537('0x2b')](_0x6ca15e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x67'),_0x7537('0x66'));}break;case _0x7537('0x6b'):if(_0x1d64c2[_0x7537('0x2f')]&&_0x1d64c2[_0x7537('0x30')]){var _0x52c26f=util[_0x7537('0x42')]('%s:%s',_0x1d64c2['username'],_0x1d64c2['password']);var _0x2f2b54={'method':_0x7537('0x36'),'uri':_0x7537('0x6c')+_0x1d64c2[_0x7537('0x6d')]+_0x7537('0x6e'),'body':{'to':[_0x228113[_0x7537('0x23')]],'text':_0x228113['body'],'from':_0x1d64c2[_0x7537('0x23')],'applicationId':_0x1d64c2[_0x7537('0x6f')]},'headers':{'Authorization':util[_0x7537('0x42')]('Basic\x20%s',new Buffer(_0x52c26f)['toString'](_0x7537('0x45')))},'json':!![]};rp(_0x2f2b54)[_0x7537('0x18')](function(_0x5cc229){if(_0x5cc229['id']){var _0x499b7e={'messageId':_0x5cc229['id']};return _0x29c8d7[_0x7537('0x19')](_0x499b7e);}else{logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x6b'),util[_0x7537('0x2b')](_0x5cc229,{'showHidden':![],'depth':null}));}})[_0x7537('0x1a')](function(_0x5f43fc){logger[_0x7537('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',util[_0x7537('0x2b')](_0x5f43fc,{'showHidden':![],'depth':null}));});}else{logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x6b'),_0x7537('0x3c'));}break;case _0x7537('0x70'):if(_0x1d64c2[_0x7537('0x57')]){var _0xf0e0e4={};var _0x5ed385={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x1d64c2[_0x7537('0x57')],'Content-Type':_0x7537('0x71')},'body':{'from':_0x1d64c2[_0x7537('0x23')],'to':_0x228113[_0x7537('0x23')],'text':_0x228113[_0x7537('0xc')]},'json':!![]};return rp(_0x5ed385)[_0x7537('0x18')](function(_0x487add){if(_0x487add[_0x7537('0x72')]==0xca){_0xf0e0e4[_0x7537('0x73')]=_0x487add;var _0x281133={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x7537('0x74')+_0x1d64c2[_0x7537('0x57')],'Content-Type':_0x7537('0x71')},'body':{'refid':_0xf0e0e4['message']['refid']},'json':!![]};return rp(_0x281133)['then'](function(_0x115d69){_0xf0e0e4[_0x7537('0x75')]=_0x115d69;var _0x31f498={'messageId':_0xf0e0e4[_0x7537('0x73')][_0x7537('0x76')],'read':!![]};return _0x29c8d7[_0x7537('0x19')](_0x31f498);});}else{return logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x70'),util[_0x7537('0x2b')](_0x487add,{'showHidden':![],'depth':null}));}})[_0x7537('0x1a')](function(_0x162371){return logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x70'),util[_0x7537('0x2b')](_0x162371,{'showHidden':![],'depth':null}));});}else{return logger[_0x7537('0x1b')](_0x7537('0x29'),_0x7537('0x2a'),_0x7537('0x70'),'Token\x20not\x20received');}break;}}})[_0x7537('0x77')](function(){_0x22fe5c();});}else{_0x22fe5c();}}},'charset':_0x7537('0x78'),'collate':_0x7537('0x79')});}; \ No newline at end of file +var _0x2671=['utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','./smsMessage.attributes','exports','define','sms_messages','messageId','body','get','direction','secret','isNil','then','update','createdAt','toLowerCase','catch','error','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','POST','user_key','internal_order_id','deliveryReport','skebby','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','clickSend','plivo','authId','/api/sms/messages/','token','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','read','infobip','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','sort','createHash','md5','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','intelepeer','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','finally'];(function(_0xea98ab,_0x297344){var _0x39058e=function(_0x27524a){while(--_0x27524a){_0xea98ab['push'](_0xea98ab['shift']());}};_0x39058e(++_0x297344);}(_0x2671,0x14c));var _0x1267=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0x2671[_0x83af7f];return _0x32d85c;};'use strict';var _=require(_0x1267('0x0'));var util=require(_0x1267('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1267('0x2'));var BPromise=require('bluebird');var rp=require(_0x1267('0x3'));var fs=require('fs');var path=require(_0x1267('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1267('0x5'));module[_0x1267('0x6')]=function(_0x37b0f7,_0x58a69a){return _0x37b0f7[_0x1267('0x7')]('SmsMessage',attributes,{'tableName':_0x1267('0x8'),'paranoid':![],'indexes':[{'name':_0x1267('0x9'),'fields':[_0x1267('0x9')]},{'name':'fti_sms_messages','fields':[_0x1267('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e58c0,_0x546f06,_0x4685ee){var _0x5b2b94=_0x37b0f7['models'];var _0x433649=_0x3e58c0[_0x1267('0xb')]({'plain':!![]});if(_0x433649['direction']['toLowerCase']()==='in'||_0x433649[_0x1267('0xc')]['toLowerCase']()==='out'&&!_0x433649[_0x1267('0xd')]&&!_[_0x1267('0xe')](_0x433649['UserId'])){_0x5b2b94['SmsInteraction']['findOne']({'where':{'id':_0x433649['SmsInteractionId']}})[_0x1267('0xf')](function(_0x5ac6f7){if(_0x5ac6f7){_0x5ac6f7[_0x1267('0x10')]({'lastMsgAt':_0x433649[_0x1267('0x11')],'lastMsgDirection':_0x433649['direction'][_0x1267('0x12')]()});}})[_0x1267('0x13')](function(_0x3eaeb1){console[_0x1267('0x14')](_0x3eaeb1);});}if(_0x433649[_0x1267('0xc')]==='out'&&!_0x433649[_0x1267('0xd')]){var _0x37b938;_0x5b2b94['SmsAccount'][_0x1267('0x15')]({'where':{'id':_0x433649[_0x1267('0x16')]},'raw':!![]})['then'](function(_0xd10b82){_0x37b938=_0xd10b82;if(_0x37b938&&_0x37b938[_0x1267('0x17')]){switch(_0x37b938['type']){case _0x1267('0x18'):var _0x109649=require(_0x1267('0x18'));if(_0x37b938[_0x1267('0x19')]&&_0x37b938['authToken']&&_0x37b938[_0x1267('0x1a')]){var _0x5720ad=new _0x109649(_0x37b938['accountSid'],_0x37b938[_0x1267('0x1b')]);_0x5720ad[_0x1267('0x1c')][_0x1267('0x1d')]({'body':_0x433649[_0x1267('0xa')],'to':_0x433649[_0x1267('0x1a')],'from':_0x37b938[_0x1267('0x1a')],'statusCallback':_0x37b938[_0x1267('0x1e')]+'/api/sms/messages/'+_0x433649['id']+_0x1267('0x1f')+_0x37b938['token']})['then'](function(_0x55829f){if(_0x55829f['sid']){return _0x3e58c0[_0x1267('0x10')]({'messageId':_0x55829f[_0x1267('0x20')]});}})['catch'](function(_0x586caf){logger[_0x1267('0x14')](_0x1267('0x21'),'afterCreate',_0x1267('0x18'),util['inspect'](_0x586caf,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x18'),_0x1267('0x23'));}break;case'skebby':var _0x49fd2d=_0x1267('0x24');if(_0x37b938[_0x1267('0x25')]&&_0x37b938[_0x1267('0x26')]){var _0x1c2407={'recipient':[_0x433649[_0x1267('0x1a')]],'message':_0x433649[_0x1267('0xa')],'message_type':_0x37b938[_0x1267('0x27')]};if(_0x37b938[_0x1267('0x27')]&&_0x37b938['smsMethod']!=='SI'){_0x1c2407[_0x1267('0x28')]=_0x37b938[_0x1267('0x1a')];}var _0x2ca12c={'url':_0x49fd2d+_0x1267('0x29')+_0x37b938['username']+_0x1267('0x2a')+_0x37b938['password'],'method':'GET'};rp(_0x2ca12c)[_0x1267('0xf')](function(_0x5b9ce9){var _0x1414e3=_0x5b9ce9['split'](';');var _0xf9cbe5={'user_key':_0x1414e3[0x0],'session_key':_0x1414e3[0x1]};_0x2ca12c={'url':_0x49fd2d+'sms','method':_0x1267('0x2b'),'headers':{'user_key':_0xf9cbe5[_0x1267('0x2c')],'Session_key':_0xf9cbe5['session_key']},'json':!![],'body':_0x1c2407};return rp(_0x2ca12c);})[_0x1267('0xf')](function(_0x2873ec){if(_0x2873ec['total_sent']>=0x1){var _0x4335bd={'messageId':_0x2873ec[_0x1267('0x2d')]};if(_0x37b938[_0x1267('0x27')]!=='GP'||!_0x37b938[_0x1267('0x2e')]){_0x4335bd['read']=!![];}return _0x3e58c0[_0x1267('0x10')](_0x4335bd);}else{return logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x2f'),util[_0x1267('0x30')](_0x2873ec,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1726c2){return logger['error'](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x2f'),util[_0x1267('0x30')](_0x1726c2,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1267('0x2f'),_0x1267('0x31'));}break;case _0x1267('0x32'):if(_0x37b938['authToken']){var _0x37e8c6={'recipient':_0x433649['phone'],'message':_0x433649['body'],'sender':_0x37b938[_0x1267('0x33')]||_0x37b938[_0x1267('0x1a')],'authorization':_0x37b938[_0x1267('0x1b')]};var _0x546f06={'method':_0x1267('0x2b'),'uri':_0x1267('0x34'),'body':_0x37e8c6,'json':!![]};rp(_0x546f06)['then'](function(_0x1a1b6f){var _0xd672df={'messageId':_0x1a1b6f[_0x1267('0x35')]};if(!_0x37b938[_0x1267('0x2e')]){_0xd672df['read']=!![];}return _0x3e58c0[_0x1267('0x10')](_0xd672df);})[_0x1267('0x13')](function(_0x35b593){logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x32'),util['inspect'](_0x35b593,{'showHidden':![],'depth':null}));});}else{logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x32'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x37b938[_0x1267('0x25')]&&_0x37b938[_0x1267('0x26')]){var _0x37e8c6={'messages':[{'source':_0x1267('0x36'),'to':_0x433649['phone'],'body':_0x433649[_0x1267('0xa')],'from':_0x37b938['senderString']||_0x37b938[_0x1267('0x1a')]}]};var _0x534219=util[_0x1267('0x37')](_0x1267('0x38'),_0x37b938[_0x1267('0x25')],_0x37b938['password']);var _0x546f06={'method':_0x1267('0x2b'),'uri':_0x1267('0x39'),'body':_0x37e8c6,'headers':{'Authorization':util[_0x1267('0x37')](_0x1267('0x3a'),new Buffer(_0x534219)[_0x1267('0x3b')](_0x1267('0x3c')))},'json':!![]};rp(_0x546f06)[_0x1267('0xf')](function(_0x37d9a4){if(_0x37d9a4[_0x1267('0x3d')]>=0xc8&&_0x37d9a4['http_code']<=0xce){if(_0x37d9a4[_0x1267('0x3e')]&&_0x37d9a4[_0x1267('0x3e')][_0x1267('0x3f')]>0x0){var _0x3714e2=_[_0x1267('0x40')](_0x37d9a4[_0x1267('0x3e')][_0x1267('0x1c')]);var _0x98ffee={'messageId':_0x3714e2['message_id']};if(!_0x37b938['deliveryReport']){_0x98ffee['read']=!![];}return _0x3e58c0['update'](_0x98ffee);}else{logger[_0x1267('0x14')](_0x1267('0x21'),'afterCreate',_0x1267('0x41'),util[_0x1267('0x30')](_0x37d9a4,{'showHidden':![],'depth':null}));}}else{logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x41'),util[_0x1267('0x30')](_0x37d9a4,{'showHidden':![],'depth':null}));}})[_0x1267('0x13')](function(_0x41a680){logger[_0x1267('0x14')](_0x1267('0x21'),'afterCreate',_0x1267('0x41'),util['inspect'](_0x41a680,{'showHidden':![],'depth':null}));});}else{logger[_0x1267('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1267('0x22'),'clickSend',_0x1267('0x31'));}break;case _0x1267('0x42'):if(_0x37b938[_0x1267('0x43')]&&_0x37b938[_0x1267('0x1b')]){var _0x37e8c6={'dst':_0x433649[_0x1267('0x1a')],'text':_0x433649[_0x1267('0xa')],'src':_0x37b938[_0x1267('0x33')]||_0x37b938[_0x1267('0x1a')],'url':_0x37b938[_0x1267('0x1e')]+_0x1267('0x44')+_0x433649['id']+'/status?token='+_0x37b938[_0x1267('0x45')]};var _0x534219=util['format'](_0x1267('0x38'),_0x37b938[_0x1267('0x43')],_0x37b938[_0x1267('0x1b')]);var _0x546f06={'method':_0x1267('0x2b'),'uri':util[_0x1267('0x37')]('https://api.plivo.com/v1/Account/%s/Message/',_0x37b938['authId']),'body':_0x37e8c6,'headers':{'Authorization':util[_0x1267('0x37')](_0x1267('0x3a'),new Buffer(_0x534219)[_0x1267('0x3b')](_0x1267('0x3c')))},'json':!![]};rp(_0x546f06)[_0x1267('0xf')](function(_0x366b82){var _0x160730={'messageId':_0x366b82['message_uuid'][0x0]};return _0x3e58c0[_0x1267('0x10')](_0x160730);})[_0x1267('0x13')](function(_0x55548d){logger[_0x1267('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1267('0x22'),_0x1267('0x42'),util[_0x1267('0x30')](_0x55548d,{'showHidden':![],'depth':null}));});}else{logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),'plivo',_0x1267('0x46'));}break;case'infobip':if(_0x37b938[_0x1267('0x25')]&&_0x37b938[_0x1267('0x26')]){if(_0x37b938[_0x1267('0x47')]){var _0x5d6b66={'method':'POST','uri':_0x37b938[_0x1267('0x47')]+'/auth/1/session','body':{'username':_0x37b938['username'],'password':_0x37b938[_0x1267('0x26')]},'json':!![]};return rp(_0x5d6b66)['then'](function(_0x58a102){var _0x53953a={'method':_0x1267('0x2b'),'uri':_0x37b938[_0x1267('0x47')]+_0x1267('0x48'),'body':{'messages':[{'from':_0x37b938['phone'],'destinations':[{'to':_0x433649[_0x1267('0x1a')]}],'text':_0x433649[_0x1267('0xa')],'notifyUrl':_0x37b938[_0x1267('0x1e')]+_0x1267('0x44')+_0x433649['id']+_0x1267('0x1f')+_0x37b938[_0x1267('0x45')],'notifyContentType':_0x1267('0x49'),'callbackData':_0x37b938[_0x1267('0x1a')]+';'+_0x433649[_0x1267('0xa')]}]},'headers':{'Authorization':_0x1267('0x4a')+_0x58a102[_0x1267('0x45')]},'json':!![]};return rp(_0x53953a)[_0x1267('0xf')](function(_0xba14f5){if(_0xba14f5[_0x1267('0x1c')]){var _0x21e7f2={'messageId':_0xba14f5[_0x1267('0x1c')][0x0][_0x1267('0x9')]};if(!_0x37b938[_0x1267('0x2e')]){_0x21e7f2[_0x1267('0x4b')]=!![];}return _0x3e58c0[_0x1267('0x10')](_0x21e7f2);}else{return logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x4c'),util['inspect'](_0xba14f5,{'showHidden':![],'depth':null}));}});})[_0x1267('0x13')](function(_0x1da7ed){return logger[_0x1267('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1267('0x4c'),util[_0x1267('0x30')](_0x1da7ed,{'showHidden':![],'depth':null}));});}else{logger[_0x1267('0x14')](_0x1267('0x21'),'afterCreate','infobip',_0x1267('0x4d'));}}else{logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x4c'),_0x1267('0x31'));}break;case _0x1267('0x4e'):var _0x1fad04=require('crypto');if(_0x37b938[_0x1267('0x4f')]){var _0x41db43={};_0x41db43[_0x1267('0x50')]=_0x37b938[_0x1267('0x25')];_0x41db43[_0x1267('0x1a')]=_0x433649[_0x1267('0x1a')];_0x41db43[_0x1267('0x28')]=_0x37b938[_0x1267('0x1a')];_0x41db43[_0x1267('0x51')]=_0x433649[_0x1267('0xa')];_0x41db43[_0x1267('0x52')]=+new Date();var _0xb5eb00='';var _0xd88b5='';var _0xb113e9=Object['keys'](_0x41db43);_0xb113e9[_0x1267('0x53')]();for(var _0x5d21ad=0x0;_0x5d21ad<_0xb113e9['length'];_0x5d21ad++){if(_0xb5eb00!=''){_0xb5eb00+='&';}_0xb5eb00+=_0xb113e9[_0x5d21ad]+'='+encodeURIComponent(_0x41db43[_0xb113e9[_0x5d21ad]]);_0xd88b5+=_0x41db43[_0xb113e9[_0x5d21ad]];}_0xd88b5+=_0x37b938[_0x1267('0x4f')];_0xd88b5=_0x1fad04[_0x1267('0x54')](_0x1267('0x55'))['update'](_0xd88b5)['digest'](_0x1267('0x56'));if(_0xb5eb00!==''){_0xb5eb00+='&';}_0xb5eb00+=_0x1267('0x57')+_0xd88b5;var _0x2ca12c={'method':_0x1267('0x58'),'uri':_0x37b938['baseUrl']+_0x1267('0x59')+_0xb5eb00,'json':!![]};return rp(_0x2ca12c)[_0x1267('0xf')](function(_0x446cd1){var _0x5b67d9=Object['keys'](_0x446cd1);if(_0x446cd1[_0x5b67d9[0x0]][_0x1267('0x14')]&&parseInt(_0x446cd1[_0x5b67d9[0x0]][_0x1267('0x14')])===0x0){var _0x5040fe={'messageId':_0x446cd1[_0x5b67d9[0x0]][_0x1267('0x5a')]};if(!_0x37b938[_0x1267('0x2e')]){_0x5040fe['read']=!![];}return _0x3e58c0[_0x1267('0x10')](_0x5040fe);}else{return logger[_0x1267('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1267('0x22'),_0x1267('0x4e'),util['inspect'](_0x446cd1[_0x1267('0x14')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x564e6c){return logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x4e'),util[_0x1267('0x30')](_0x564e6c,{'showHidden':![],'depth':null}));});}else{logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x4e'),_0x1267('0x5b'));}break;case _0x1267('0x5c'):if(_0x37b938[_0x1267('0x4f')]){var _0x282fb2={'method':_0x1267('0x2b'),'uri':_0x1267('0x5d'),'headers':{'Authorization':_0x37b938[_0x1267('0x4f')]},'body':{'content':_0x433649[_0x1267('0xa')],'to':[_0x433649[_0x1267('0x1a')]],'from':_0x37b938['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x1267('0x5e')},'json':!![]};rp(_0x282fb2)[_0x1267('0xf')](function(_0x18296d){if(!_0x18296d[_0x1267('0x14')]){var _0x1999f9={'messageId':_0x18296d[_0x1267('0x1c')][0x0][_0x1267('0x5f')]};if(!_0x37b938[_0x1267('0x2e')]){_0x1999f9['read']=!![];}return _0x3e58c0[_0x1267('0x10')](_0x1999f9);}else{return logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x5c'),util[_0x1267('0x30')](_0x18296d['error'],{'showHidden':![],'depth':null}));}})[_0x1267('0x13')](function(_0x38ae07){return logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x5c'),util['inspect'](_0x38ae07,{'showHidden':![],'depth':null}));});}else{logger[_0x1267('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1267('0x22'),_0x1267('0x5c'),_0x1267('0x5b'));}break;case _0x1267('0x60'):if(_0x37b938[_0x1267('0x25')]&&_0x37b938[_0x1267('0x26')]){var _0x534219=util['format']('%s:%s',_0x37b938[_0x1267('0x25')],_0x37b938[_0x1267('0x26')]);var _0x546f06={'method':_0x1267('0x2b'),'uri':_0x1267('0x61')+_0x37b938['accountId']+_0x1267('0x62'),'body':{'to':[_0x433649['phone']],'text':_0x433649[_0x1267('0xa')],'from':_0x37b938[_0x1267('0x1a')],'applicationId':_0x37b938[_0x1267('0x63')]},'headers':{'Authorization':util[_0x1267('0x37')](_0x1267('0x3a'),new Buffer(_0x534219)['toString'](_0x1267('0x3c')))},'json':!![]};rp(_0x546f06)[_0x1267('0xf')](function(_0x9bb7ab){if(_0x9bb7ab['id']){var _0x277627={'messageId':_0x9bb7ab['id']};return _0x3e58c0[_0x1267('0x10')](_0x277627);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1267('0x22'),_0x1267('0x60'),util[_0x1267('0x30')](_0x9bb7ab,{'showHidden':![],'depth':null}));}})[_0x1267('0x13')](function(_0x1db6bd){logger['error'](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x60'),util[_0x1267('0x30')](_0x1db6bd,{'showHidden':![],'depth':null}));});}else{logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x60'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x1267('0x64'):if(_0x37b938[_0x1267('0x4f')]){var _0x334623={};var _0x2ca12c={'method':_0x1267('0x2b'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x37b938[_0x1267('0x4f')],'Content-Type':_0x1267('0x49')},'body':{'from':_0x37b938['phone'],'to':_0x433649[_0x1267('0x1a')],'text':_0x433649['body']},'json':!![]};return rp(_0x2ca12c)[_0x1267('0xf')](function(_0x59022e){if(_0x59022e[_0x1267('0x65')]==0xca){_0x334623[_0x1267('0x66')]=_0x59022e;var _0x21f6b6={'method':_0x1267('0x2b'),'uri':_0x1267('0x67'),'headers':{'Authorization':_0x1267('0x68')+_0x37b938[_0x1267('0x4f')],'Content-Type':_0x1267('0x49')},'body':{'refid':_0x334623['message'][_0x1267('0x69')]},'json':!![]};return rp(_0x21f6b6)['then'](function(_0x4c72cf){_0x334623[_0x1267('0x6a')]=_0x4c72cf;var _0x342b70={'messageId':_0x334623[_0x1267('0x66')][_0x1267('0x69')],'read':!![]};return _0x3e58c0[_0x1267('0x10')](_0x342b70);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1267('0x64'),util[_0x1267('0x30')](_0x59022e,{'showHidden':![],'depth':null}));}})[_0x1267('0x13')](function(_0xd156b4){return logger[_0x1267('0x14')](_0x1267('0x21'),'afterCreate',_0x1267('0x64'),util['inspect'](_0xd156b4,{'showHidden':![],'depth':null}));});}else{return logger[_0x1267('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1267('0x22'),_0x1267('0x64'),'Token\x20not\x20received');}break;}}})[_0x1267('0x6b')](function(){_0x4685ee();});}else{_0x4685ee();}}},'charset':_0x1267('0x6c'),'collate':_0x1267('0x6d')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index c8d108f..2cd5763 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 _0x9a09=['catch','CreateSmsMessage','create','options','raw','then','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x5235dd,_0x3f91cf){var _0x13059d=function(_0x355a98){while(--_0x355a98){_0x5235dd['push'](_0x5235dd['shift']());}};_0x13059d(++_0x3f91cf);}(_0x9a09,0x132));var _0x99a0=function(_0x3174d2,_0xf31515){_0x3174d2=_0x3174d2-0x0;var _0x4814d0=_0x9a09[_0x3174d2];return _0x4814d0;};'use strict';var _=require(_0x99a0('0x0'));var util=require('util');var moment=require(_0x99a0('0x1'));var BPromise=require('bluebird');var rs=require(_0x99a0('0x2'));var fs=require('fs');var Redis=require(_0x99a0('0x3'));var db=require(_0x99a0('0x4'))['db'];var utils=require(_0x99a0('0x5'));var logger=require(_0x99a0('0x6'))('rpc');var config=require(_0x99a0('0x7'));var jayson=require(_0x99a0('0x8'));var client=jayson[_0x99a0('0x9')][_0x99a0('0xa')]({'port':0x232a});config[_0x99a0('0xb')]=_['defaults'](config[_0x99a0('0xb')],{'host':_0x99a0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x99a0('0xb')]));require('./smsMessage.socket')[_0x99a0('0xd')](socket);function respondWithRpcPromise(_0x23534e,_0x4f59e9,_0x1f20e9){return new BPromise(function(_0x46a96c,_0x65307a){return client[_0x99a0('0xe')](_0x23534e,_0x1f20e9)['then'](function(_0x4e96e6){logger[_0x99a0('0xf')](_0x99a0('0x10'),_0x4f59e9,'request\x20sent');logger[_0x99a0('0x11')](_0x99a0('0x12'),_0x4f59e9,_0x99a0('0x13'),JSON[_0x99a0('0x14')](_0x4e96e6));if(_0x4e96e6['error']){if(_0x4e96e6[_0x99a0('0x15')]['code']===0x1f4){logger[_0x99a0('0x15')](_0x99a0('0x10'),_0x4f59e9,_0x4e96e6[_0x99a0('0x15')][_0x99a0('0x16')]);return _0x65307a(_0x4e96e6['error'][_0x99a0('0x16')]);}logger[_0x99a0('0x15')](_0x99a0('0x10'),_0x4f59e9,_0x4e96e6['error'][_0x99a0('0x16')]);return _0x46a96c(_0x4e96e6['error'][_0x99a0('0x16')]);}else{logger[_0x99a0('0xf')]('SmsMessage,\x20%s,\x20%s',_0x4f59e9,_0x99a0('0x13'));_0x46a96c(_0x4e96e6[_0x99a0('0x17')][_0x99a0('0x16')]);}})[_0x99a0('0x18')](function(_0x7b731a){logger[_0x99a0('0x15')](_0x99a0('0x10'),_0x4f59e9,_0x7b731a);_0x65307a(_0x7b731a);});});}exports[_0x99a0('0x19')]=function(_0x1ac1a9){var _0x230862=this;return new Promise(function(_0x287507,_0x2a17d4){return db['SmsMessage'][_0x99a0('0x1a')](_0x1ac1a9['body'],{'raw':_0x1ac1a9[_0x99a0('0x1b')]?_0x1ac1a9['options'][_0x99a0('0x1c')]===undefined?!![]:![]:!![]})[_0x99a0('0x1d')](function(_0x5a8d6f){logger[_0x99a0('0xf')](_0x99a0('0x19'),_0x1ac1a9);logger[_0x99a0('0x11')]('CreateSmsMessage',_0x1ac1a9,JSON['stringify'](_0x5a8d6f));_0x287507(_0x5a8d6f);})[_0x99a0('0x18')](function(_0x2fc4c0){logger['error'](_0x99a0('0x19'),_0x2fc4c0[_0x99a0('0x16')],_0x1ac1a9);_0x2a17d4(_0x230862[_0x99a0('0x15')](0x1f4,_0x2fc4c0[_0x99a0('0x16')]));});});}; \ No newline at end of file +var _0x64bc=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','util'];(function(_0x51f4fc,_0x1fe3ef){var _0x4d96fc=function(_0xddc9){while(--_0xddc9){_0x51f4fc['push'](_0x51f4fc['shift']());}};_0x4d96fc(++_0x1fe3ef);}(_0x64bc,0x128));var _0xc64b=function(_0x3f1478,_0xb54c58){_0x3f1478=_0x3f1478-0x0;var _0x5b84f2=_0x64bc[_0x3f1478];return _0x5b84f2;};'use strict';var _=require('lodash');var util=require(_0xc64b('0x0'));var moment=require(_0xc64b('0x1'));var BPromise=require(_0xc64b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc64b('0x3'));var db=require(_0xc64b('0x4'))['db'];var utils=require(_0xc64b('0x5'));var logger=require(_0xc64b('0x6'))(_0xc64b('0x7'));var config=require(_0xc64b('0x8'));var jayson=require(_0xc64b('0x9'));var client=jayson[_0xc64b('0xa')]['http']({'port':0x232a});config[_0xc64b('0xb')]=_[_0xc64b('0xc')](config[_0xc64b('0xb')],{'host':_0xc64b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc64b('0xe'))[_0xc64b('0xf')](socket);function respondWithRpcPromise(_0xc4f60,_0x4a8e79,_0x2fd8c0){return new BPromise(function(_0x121b75,_0xabb5aa){return client[_0xc64b('0x10')](_0xc4f60,_0x2fd8c0)[_0xc64b('0x11')](function(_0x1aa99a){logger[_0xc64b('0x12')](_0xc64b('0x13'),_0x4a8e79,_0xc64b('0x14'));logger['debug'](_0xc64b('0x15'),_0x4a8e79,_0xc64b('0x14'),JSON['stringify'](_0x1aa99a));if(_0x1aa99a['error']){if(_0x1aa99a[_0xc64b('0x16')][_0xc64b('0x17')]===0x1f4){logger[_0xc64b('0x16')]('SmsMessage,\x20%s,\x20%s',_0x4a8e79,_0x1aa99a[_0xc64b('0x16')][_0xc64b('0x18')]);return _0xabb5aa(_0x1aa99a[_0xc64b('0x16')]['message']);}logger[_0xc64b('0x16')]('SmsMessage,\x20%s,\x20%s',_0x4a8e79,_0x1aa99a['error'][_0xc64b('0x18')]);return _0x121b75(_0x1aa99a[_0xc64b('0x16')][_0xc64b('0x18')]);}else{logger[_0xc64b('0x12')]('SmsMessage,\x20%s,\x20%s',_0x4a8e79,'request\x20sent');_0x121b75(_0x1aa99a[_0xc64b('0x19')]['message']);}})[_0xc64b('0x1a')](function(_0x46e189){logger['error'](_0xc64b('0x13'),_0x4a8e79,_0x46e189);_0xabb5aa(_0x46e189);});});}exports['CreateSmsMessage']=function(_0x5189c1){var _0x2550dd=this;return new Promise(function(_0x1bbd86,_0xb10efd){return db[_0xc64b('0x1b')][_0xc64b('0x1c')](_0x5189c1[_0xc64b('0x1d')],{'raw':_0x5189c1[_0xc64b('0x1e')]?_0x5189c1[_0xc64b('0x1e')][_0xc64b('0x1f')]===undefined?!![]:![]:!![]})[_0xc64b('0x11')](function(_0x2bcb47){logger[_0xc64b('0x12')]('CreateSmsMessage',_0x5189c1);logger['debug']('CreateSmsMessage',_0x5189c1,JSON['stringify'](_0x2bcb47));_0x1bbd86(_0x2bcb47);})[_0xc64b('0x1a')](function(_0x28c17f){logger[_0xc64b('0x16')](_0xc64b('0x20'),_0x28c17f[_0xc64b('0x18')],_0x5189c1);_0xb10efd(_0x2550dd['error'](0x1f4,_0x28c17f[_0xc64b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 17985ff..a0a3335 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 _0xe631=['remove','emit','removeListener','register','length','save'];(function(_0x3f465d,_0xbd2037){var _0x121ad1=function(_0x5b13d6){while(--_0x5b13d6){_0x3f465d['push'](_0x3f465d['shift']());}};_0x121ad1(++_0xbd2037);}(_0xe631,0x1a9));var _0x1e63=function(_0x1a87b3,_0x45ba68){_0x1a87b3=_0x1a87b3-0x0;var _0x37e84d=_0xe631[_0x1a87b3];return _0x37e84d;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x1e63('0x0'),_0x1e63('0x1'),'update'];function createListener(_0x325a0b,_0x464458){return function(_0x5012d3){_0x464458[_0x1e63('0x2')](_0x325a0b,_0x5012d3);};}function removeListener(_0x55b6e2,_0x38503d){return function(){SmsMessageEvents[_0x1e63('0x3')](_0x55b6e2,_0x38503d);};}exports[_0x1e63('0x4')]=function(_0x231ce0){for(var _0x11c92c=0x0,_0x4c1fdd=events[_0x1e63('0x5')];_0x11c92c<_0x4c1fdd;_0x11c92c++){var _0x2f2ba5=events[_0x11c92c];var _0x50e559=createListener('smsMessage:'+_0x2f2ba5,_0x231ce0);SmsMessageEvents['on'](_0x2f2ba5,_0x50e559);}}; \ No newline at end of file +var _0xf543=['smsMessage:','save','emit','removeListener','register'];(function(_0x233f9d,_0x12d794){var _0x511bf5=function(_0x1a4ad0){while(--_0x1a4ad0){_0x233f9d['push'](_0x233f9d['shift']());}};_0x511bf5(++_0x12d794);}(_0xf543,0xba));var _0x3f54=function(_0x1da3c5,_0x555675){_0x1da3c5=_0x1da3c5-0x0;var _0x200fc4=_0xf543[_0x1da3c5];return _0x200fc4;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x3f54('0x0'),'remove','update'];function createListener(_0x12a9a9,_0x3d6bf3){return function(_0x4087af){_0x3d6bf3[_0x3f54('0x1')](_0x12a9a9,_0x4087af);};}function removeListener(_0xe5af91,_0x2d83c9){return function(){SmsMessageEvents[_0x3f54('0x2')](_0xe5af91,_0x2d83c9);};}exports[_0x3f54('0x3')]=function(_0x109d0f){for(var _0x1a0800=0x0,_0x57779c=events['length'];_0x1a0800<_0x57779c;_0x1a0800++){var _0x9add35=events[_0x1a0800];var _0x45debb=createListener(_0x3f54('0x4')+_0x9add35,_0x109d0f);SmsMessageEvents['on'](_0x9add35,_0x45debb);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 6315197..aacf304 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 _0xe978=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','put','update','destroy','delete','removeTeams','exports','multer','util','path','Router'];(function(_0x47e161,_0x496d35){var _0x10fa14=function(_0x17b099){while(--_0x17b099){_0x47e161['push'](_0x47e161['shift']());}};_0x10fa14(++_0x496d35);}(_0xe978,0x70));var _0x8e97=function(_0x581f33,_0x1baf24){_0x581f33=_0x581f33-0x0;var _0xf6adcd=_0xe978[_0x581f33];return _0xf6adcd;};'use strict';var multer=require(_0x8e97('0x0'));var util=require(_0x8e97('0x1'));var path=require(_0x8e97('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8e97('0x3')]();var fs_extra=require(_0x8e97('0x4'));var auth=require(_0x8e97('0x5'));var interaction=require(_0x8e97('0x6'));var config=require(_0x8e97('0x7'));var controller=require('./smsQueue.controller');router[_0x8e97('0x8')]('/',auth[_0x8e97('0x9')](),controller[_0x8e97('0xa')]);router[_0x8e97('0x8')](_0x8e97('0xb'),auth['isAuthenticated'](),controller[_0x8e97('0xc')]);router['get'](_0x8e97('0xd'),auth[_0x8e97('0x9')](),controller[_0x8e97('0xe')]);router['get'](_0x8e97('0xf'),auth[_0x8e97('0x9')](),controller[_0x8e97('0x10')]);router[_0x8e97('0x8')](_0x8e97('0x11'),auth[_0x8e97('0x9')](),controller[_0x8e97('0x12')]);router[_0x8e97('0x8')](_0x8e97('0x13'),auth[_0x8e97('0x9')](),controller[_0x8e97('0x14')]);router['post']('/',auth[_0x8e97('0x9')](),controller[_0x8e97('0x15')]);router[_0x8e97('0x16')](_0x8e97('0x11'),auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x8e97('0x17')]('/:id',auth[_0x8e97('0x9')](),controller[_0x8e97('0x18')]);router['delete']('/:id',auth[_0x8e97('0x9')](),controller[_0x8e97('0x19')]);router[_0x8e97('0x1a')](_0x8e97('0x11'),auth[_0x8e97('0x9')](),controller[_0x8e97('0x1b')]);router[_0x8e97('0x1a')](_0x8e97('0x13'),auth[_0x8e97('0x9')](),controller['removeAgents']);module[_0x8e97('0x1c')]=router; \ No newline at end of file +var _0xd9de=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x1f00a1,_0x36824f){var _0x4cb8ba=function(_0x45770d){while(--_0x45770d){_0x1f00a1['push'](_0x1f00a1['shift']());}};_0x4cb8ba(++_0x36824f);}(_0xd9de,0x108));var _0xed9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd9de[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xed9d('0x0'));var util=require('util');var path=require(_0xed9d('0x1'));var timeout=require(_0xed9d('0x2'));var express=require(_0xed9d('0x3'));var router=express[_0xed9d('0x4')]();var fs_extra=require(_0xed9d('0x5'));var auth=require(_0xed9d('0x6'));var interaction=require(_0xed9d('0x7'));var config=require(_0xed9d('0x8'));var controller=require(_0xed9d('0x9'));router[_0xed9d('0xa')]('/',auth['isAuthenticated'](),controller[_0xed9d('0xb')]);router[_0xed9d('0xa')](_0xed9d('0xc'),auth[_0xed9d('0xd')](),controller[_0xed9d('0xe')]);router[_0xed9d('0xa')](_0xed9d('0xf'),auth[_0xed9d('0xd')](),controller[_0xed9d('0x10')]);router[_0xed9d('0xa')](_0xed9d('0x11'),auth['isAuthenticated'](),controller[_0xed9d('0x12')]);router[_0xed9d('0xa')](_0xed9d('0x13'),auth[_0xed9d('0xd')](),controller[_0xed9d('0x14')]);router[_0xed9d('0xa')]('/:id/users',auth[_0xed9d('0xd')](),controller[_0xed9d('0x15')]);router[_0xed9d('0x16')]('/',auth[_0xed9d('0xd')](),controller['create']);router[_0xed9d('0x16')](_0xed9d('0x13'),auth[_0xed9d('0xd')](),controller['addTeams']);router['post'](_0xed9d('0x17'),auth[_0xed9d('0xd')](),controller[_0xed9d('0x18')]);router[_0xed9d('0x19')](_0xed9d('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xed9d('0x1a')](_0xed9d('0xf'),auth[_0xed9d('0xd')](),controller[_0xed9d('0x1b')]);router[_0xed9d('0x1a')](_0xed9d('0x13'),auth[_0xed9d('0xd')](),controller[_0xed9d('0x1c')]);router[_0xed9d('0x1a')](_0xed9d('0x17'),auth[_0xed9d('0xd')](),controller[_0xed9d('0x1d')]);module[_0xed9d('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index ab9f24d..a2ce192 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 _0x55d2=['INTEGER','ENUM','beepall','roundrobin','STRING'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x55d2,0x149));var _0x255d=function(_0x2f1753,_0x458f6d){_0x2f1753=_0x2f1753-0x0;var _0x56a164=_0x55d2[_0x2f1753];return _0x56a164;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x255d('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x255d('0x0')]},'timeout':{'type':Sequelize[_0x255d('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x255d('0x2')]('rrmemory',_0x255d('0x3'),_0x255d('0x4'))}}; \ No newline at end of file +var _0xa59d=['STRING','name','beepall','sequelize','exports'];(function(_0x1e48d3,_0x5d8c43){var _0x2852b1=function(_0x11d7b3){while(--_0x11d7b3){_0x1e48d3['push'](_0x1e48d3['shift']());}};_0x2852b1(++_0x5d8c43);}(_0xa59d,0x166));var _0xda59=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa59d[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xda59('0x0'));module[_0xda59('0x1')]={'name':{'type':Sequelize[_0xda59('0x2')],'unique':_0xda59('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xda59('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xda59('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 33aff3f..4954f51 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 _0xe9af=['name','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','includeAll','rows','catch','params','fields','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','describe','getMembers','UserSmsQueue','nolimit','findAll','User','findAndCountAll','UserId','smsPause','updatedAt','createdAt','format','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','isArray','userSmsQueue:remove','getAgents','findOne','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','save','then','SmsQueues','UserProfileResource','destroy','error','send','render','merge','body','contact','message','agent','interaction','index','map','SmsQueue','rawAttributes','type','key'];(function(_0x533e02,_0x338d6f){var _0x1b37bc=function(_0x61a3cc){while(--_0x61a3cc){_0x533e02['push'](_0x533e02['shift']());}};_0x1b37bc(++_0x338d6f);}(_0xe9af,0x164));var _0xfe9a=function(_0x2de023,_0x9e0807){_0x2de023=_0x2de023-0x0;var _0x2c304b=_0xe9af[_0x2de023];return _0x2c304b;};'use strict';var emlformat=require(_0xfe9a('0x0'));var rimraf=require(_0xfe9a('0x1'));var zipdir=require(_0xfe9a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe9a('0x3'));var moment=require('moment');var BPromise=require(_0xfe9a('0x4'));var Mustache=require('mustache');var util=require(_0xfe9a('0x5'));var path=require('path');var sox=require(_0xfe9a('0x6'));var csv=require(_0xfe9a('0x7'));var ejs=require(_0xfe9a('0x8'));var fs=require('fs');var fs_extra=require(_0xfe9a('0x9'));var _=require(_0xfe9a('0xa'));var squel=require('squel');var crypto=require(_0xfe9a('0xb'));var jsforce=require(_0xfe9a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfe9a('0xd'));var Papa=require(_0xfe9a('0xe'));var Redis=require('ioredis');var authService=require(_0xfe9a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfe9a('0x10'));var hardwareService=require(_0xfe9a('0x11'));var logger=require('../../config/logger')(_0xfe9a('0x12'));var utils=require('../../config/utils');var config=require(_0xfe9a('0x13'));var licenseUtil=require(_0xfe9a('0x14'));var db=require(_0xfe9a('0x15'))['db'];config[_0xfe9a('0x16')]=_['defaults'](config[_0xfe9a('0x16')],{'host':_0xfe9a('0x17'),'port':0x18eb});var socket=require(_0xfe9a('0x18'))(new Redis(config[_0xfe9a('0x16')]));require('./smsQueue.socket')[_0xfe9a('0x19')](socket);function respondWithStatusCode(_0xcf678f,_0x588c56){_0x588c56=_0x588c56||0xcc;return function(_0x3449da){if(_0x3449da){return _0xcf678f[_0xfe9a('0x1a')](_0x588c56);}return _0xcf678f[_0xfe9a('0x1b')](_0x588c56)['end']();};}function respondWithResult(_0xefab26,_0x38b9bb){_0x38b9bb=_0x38b9bb||0xc8;return function(_0x5792c2){if(_0x5792c2){return _0xefab26[_0xfe9a('0x1b')](_0x38b9bb)[_0xfe9a('0x1c')](_0x5792c2);}};}function respondWithFilteredResult(_0x4a4c13,_0x30c17b){return function(_0x1b1a1c){if(_0x1b1a1c){var _0x20030b=typeof _0x30c17b[_0xfe9a('0x1d')]==='undefined'&&typeof _0x30c17b[_0xfe9a('0x1e')]===_0xfe9a('0x1f');var _0x3ac6f8=_0x1b1a1c[_0xfe9a('0x20')];var _0x400304=_0x20030b?0x0:_0x30c17b[_0xfe9a('0x1d')];var _0x95d244=_0x20030b?_0x1b1a1c[_0xfe9a('0x20')]:_0x30c17b[_0xfe9a('0x1d')]+_0x30c17b[_0xfe9a('0x1e')];var _0x53706e;if(_0x95d244>=_0x3ac6f8){_0x95d244=_0x3ac6f8;_0x53706e=0xc8;}else{_0x53706e=0xce;}_0x4a4c13[_0xfe9a('0x1b')](_0x53706e);return _0x4a4c13['set'](_0xfe9a('0x21'),_0x400304+'-'+_0x95d244+'/'+_0x3ac6f8)[_0xfe9a('0x1c')](_0x1b1a1c);}return null;};}function patchUpdates(_0xce1202){return function(_0x56df70){try{jsonpatch['apply'](_0x56df70,_0xce1202,!![]);}catch(_0x20e546){return BPromise[_0xfe9a('0x22')](_0x20e546);}return _0x56df70[_0xfe9a('0x23')]();};}function saveUpdates(_0x75f776,_0x82f237){return function(_0x48723b){if(_0x48723b){return _0x48723b['update'](_0x75f776)[_0xfe9a('0x24')](function(_0x222ecd){return _0x222ecd;});}return null;};}function removeEntity(_0x14da26,_0xa18f58){return function(_0x1d4faa){if(_0x1d4faa){return _0x1d4faa['destroy']()['then'](function(){var _0x379323=_0x1d4faa['get']({'plain':!![]});var _0x4412c2=_0xfe9a('0x25');return db[_0xfe9a('0x26')][_0xfe9a('0x27')]({'where':{'type':_0x4412c2,'resourceId':_0x379323['id']}})[_0xfe9a('0x24')](function(){return _0x1d4faa;});})[_0xfe9a('0x24')](function(){_0x14da26[_0xfe9a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aa210,_0x3b8271){return function(_0x24f84f){if(!_0x24f84f){_0x2aa210['sendStatus'](0x194);}return _0x24f84f;};}function handleError(_0x16f664,_0x542b80){_0x542b80=_0x542b80||0x1f4;return function(_0x4855a0){logger[_0xfe9a('0x28')](_0x4855a0['stack']);if(_0x4855a0['name']){delete _0x4855a0['name'];}_0x16f664[_0xfe9a('0x1b')](_0x542b80)[_0xfe9a('0x29')](_0x4855a0);};}function getMustacheRender(_0x598c66,_0x55814e){return Mustache[_0xfe9a('0x2a')](_0x598c66,_[_0xfe9a('0x2b')](_0x55814e[_0xfe9a('0x2c')],{'contact':_0x55814e[_0xfe9a('0x2d')],'message':_0x55814e[_0xfe9a('0x2e')],'agent':_0x55814e[_0xfe9a('0x2f')],'interaction':_0x55814e[_0xfe9a('0x30')],'account':_0x55814e['account']}))||'';}exports[_0xfe9a('0x31')]=function(_0x454a8a,_0x4f974c){var _0x1052c9={},_0xfbf82d={},_0x255efc={'count':0x0,'rows':[]};var _0x18b922=_[_0xfe9a('0x32')](db[_0xfe9a('0x33')][_0xfe9a('0x34')],function(_0x16991a){return{'name':_0x16991a['fieldName'],'type':_0x16991a[_0xfe9a('0x35')][_0xfe9a('0x36')]};});_0xfbf82d['model']=_[_0xfe9a('0x32')](_0x18b922,_0xfe9a('0x37'));_0xfbf82d[_0xfe9a('0x38')]=_[_0xfe9a('0x39')](_0x454a8a['query']);_0xfbf82d[_0xfe9a('0x3a')]=_[_0xfe9a('0x3b')](_0xfbf82d[_0xfe9a('0x3c')],_0xfbf82d[_0xfe9a('0x38')]);_0x1052c9['attributes']=_[_0xfe9a('0x3b')](_0xfbf82d[_0xfe9a('0x3c')],qs['fields'](_0x454a8a[_0xfe9a('0x38')]['fields']));_0x1052c9[_0xfe9a('0x3d')]=_0x1052c9[_0xfe9a('0x3d')][_0xfe9a('0x3e')]?_0x1052c9[_0xfe9a('0x3d')]:_0xfbf82d[_0xfe9a('0x3c')];if(!_0x454a8a['query'][_0xfe9a('0x3f')]('nolimit')){_0x1052c9[_0xfe9a('0x1e')]=qs[_0xfe9a('0x1e')](_0x454a8a[_0xfe9a('0x38')][_0xfe9a('0x1e')]);_0x1052c9[_0xfe9a('0x1d')]=qs[_0xfe9a('0x1d')](_0x454a8a[_0xfe9a('0x38')]['offset']);}_0x1052c9[_0xfe9a('0x40')]=qs['sort'](_0x454a8a[_0xfe9a('0x38')][_0xfe9a('0x41')]);_0x1052c9[_0xfe9a('0x42')]=qs[_0xfe9a('0x3a')](_[_0xfe9a('0x43')](_0x454a8a[_0xfe9a('0x38')],_0xfbf82d['filters']),_0x18b922);if(_0x454a8a[_0xfe9a('0x38')][_0xfe9a('0x44')]){_0x1052c9['where']=_[_0xfe9a('0x2b')](_0x1052c9['where'],{'$or':_[_0xfe9a('0x32')](_0x18b922,function(_0x13c99d){if(_0x13c99d['type']!==_0xfe9a('0x45')){var _0x33976c={};_0x33976c[_0x13c99d[_0xfe9a('0x37')]]={'$like':'%'+_0x454a8a['query'][_0xfe9a('0x44')]+'%'};return _0x33976c;}})});}_0x1052c9=_[_0xfe9a('0x2b')]({},_0x1052c9,_0x454a8a['options']);var _0x3d8213={'where':_0x1052c9[_0xfe9a('0x42')]};return db[_0xfe9a('0x33')]['count'](_0x3d8213)[_0xfe9a('0x24')](function(_0x599584){_0x255efc['count']=_0x599584;if(_0x454a8a[_0xfe9a('0x38')][_0xfe9a('0x46')]){_0x1052c9['include']=[{'all':!![]}];}return db[_0xfe9a('0x33')]['findAll'](_0x1052c9);})['then'](function(_0x3e2637){_0x255efc[_0xfe9a('0x47')]=_0x3e2637;return _0x255efc;})[_0xfe9a('0x24')](respondWithFilteredResult(_0x4f974c,_0x1052c9))[_0xfe9a('0x48')](handleError(_0x4f974c,null));};exports['show']=function(_0xc09c38,_0x61bd57){var _0x4dc119={'raw':!![],'where':{'id':_0xc09c38[_0xfe9a('0x49')]['id']}},_0x37e067={};_0x37e067[_0xfe9a('0x3c')]=_[_0xfe9a('0x39')](db[_0xfe9a('0x33')][_0xfe9a('0x34')]);_0x37e067[_0xfe9a('0x38')]=_[_0xfe9a('0x39')](_0xc09c38['query']);_0x37e067['filters']=_['intersection'](_0x37e067['model'],_0x37e067[_0xfe9a('0x38')]);_0x4dc119['attributes']=_[_0xfe9a('0x3b')](_0x37e067[_0xfe9a('0x3c')],qs[_0xfe9a('0x4a')](_0xc09c38[_0xfe9a('0x38')]['fields']));_0x4dc119[_0xfe9a('0x3d')]=_0x4dc119[_0xfe9a('0x3d')][_0xfe9a('0x3e')]?_0x4dc119[_0xfe9a('0x3d')]:_0x37e067[_0xfe9a('0x3c')];if(_0xc09c38[_0xfe9a('0x38')][_0xfe9a('0x46')]){_0x4dc119['include']=[{'all':!![]}];}_0x4dc119=_[_0xfe9a('0x2b')]({},_0x4dc119,_0xc09c38[_0xfe9a('0x4b')]);return db[_0xfe9a('0x33')][_0xfe9a('0x4c')](_0x4dc119)[_0xfe9a('0x24')](handleEntityNotFound(_0x61bd57,null))[_0xfe9a('0x24')](respondWithResult(_0x61bd57,null))[_0xfe9a('0x48')](handleError(_0x61bd57,null));};exports['create']=function(_0x4ac5aa,_0x3a05bb){return db[_0xfe9a('0x33')][_0xfe9a('0x4d')](_0x4ac5aa[_0xfe9a('0x2c')],{})['then'](function(_0x2c86b6){var _0x216ee5=_0x4ac5aa[_0xfe9a('0x4e')][_0xfe9a('0x4f')]({'plain':!![]});if(!_0x216ee5)throw new Error(_0xfe9a('0x50'));if(_0x216ee5['role']==='user'){var _0x180911=_0x2c86b6['get']({'plain':!![]});var _0x1998a5='SmsQueues';return db['UserProfileSection'][_0xfe9a('0x4c')]({'where':{'name':_0x1998a5,'userProfileId':_0x216ee5['userProfileId']},'raw':!![]})[_0xfe9a('0x24')](function(_0x403dc5){if(_0x403dc5&&_0x403dc5['autoAssociation']===0x0){return db['UserProfileResource'][_0xfe9a('0x4d')]({'name':_0x180911['name'],'resourceId':_0x180911['id'],'type':_0x403dc5[_0xfe9a('0x37')],'sectionId':_0x403dc5['id']},{})[_0xfe9a('0x24')](function(){return _0x2c86b6;});}else{return _0x2c86b6;}})[_0xfe9a('0x48')](function(_0x34f328){logger[_0xfe9a('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34f328);throw _0x34f328;});}return _0x2c86b6;})[_0xfe9a('0x24')](respondWithResult(_0x3a05bb,0xc9))[_0xfe9a('0x48')](handleError(_0x3a05bb,null));};exports[_0xfe9a('0x51')]=function(_0x1721da,_0x44b677){if(_0x1721da[_0xfe9a('0x2c')]['id']){delete _0x1721da[_0xfe9a('0x2c')]['id'];}return db['SmsQueue'][_0xfe9a('0x4c')]({'where':{'id':_0x1721da[_0xfe9a('0x49')]['id']}})[_0xfe9a('0x24')](handleEntityNotFound(_0x44b677,null))[_0xfe9a('0x24')](saveUpdates(_0x1721da[_0xfe9a('0x2c')],null))[_0xfe9a('0x24')](respondWithResult(_0x44b677,null))[_0xfe9a('0x48')](handleError(_0x44b677,null));};exports[_0xfe9a('0x27')]=function(_0x40c0e6,_0x20c917){return db['SmsQueue'][_0xfe9a('0x4c')]({'where':{'id':_0x40c0e6[_0xfe9a('0x49')]['id']}})[_0xfe9a('0x24')](handleEntityNotFound(_0x20c917,null))['then'](removeEntity(_0x20c917,null))[_0xfe9a('0x48')](handleError(_0x20c917,null));};exports[_0xfe9a('0x52')]=function(_0x411eb0,_0x265476){return db[_0xfe9a('0x33')][_0xfe9a('0x52')]()['then'](respondWithResult(_0x265476,null))[_0xfe9a('0x48')](handleError(_0x265476,null));};exports[_0xfe9a('0x53')]=function(_0x56debd,_0x532e67,_0x5557f5){var _0x4519a1={'raw':!![],'where':{}},_0x17eddc={},_0x7bdceb;return db[_0xfe9a('0x33')]['findOne']({'where':{'id':_0x56debd[_0xfe9a('0x49')]['id']}})[_0xfe9a('0x24')](handleEntityNotFound(_0x532e67,null))[_0xfe9a('0x24')](function(_0xb54dec){if(_0xb54dec){_0x7bdceb=_0xb54dec[_0xfe9a('0x4f')]({'plain':!![]});_0x17eddc[_0xfe9a('0x3c')]=_[_0xfe9a('0x39')](db[_0xfe9a('0x54')]['rawAttributes']);_0x17eddc[_0xfe9a('0x38')]=_[_0xfe9a('0x39')](_0x56debd[_0xfe9a('0x38')]);_0x17eddc[_0xfe9a('0x3a')]=_[_0xfe9a('0x3b')](_0x17eddc['model'],_0x17eddc[_0xfe9a('0x38')]);_0x4519a1[_0xfe9a('0x3d')]=_[_0xfe9a('0x3b')](_0x17eddc[_0xfe9a('0x3c')],qs[_0xfe9a('0x4a')](_0x56debd[_0xfe9a('0x38')][_0xfe9a('0x4a')]));_0x4519a1[_0xfe9a('0x3d')]=_0x4519a1[_0xfe9a('0x3d')][_0xfe9a('0x3e')]?_0x4519a1[_0xfe9a('0x3d')]:_0x17eddc['model'];if(!_0x56debd[_0xfe9a('0x38')][_0xfe9a('0x3f')](_0xfe9a('0x55'))){_0x4519a1[_0xfe9a('0x1e')]=qs[_0xfe9a('0x1e')](_0x56debd[_0xfe9a('0x38')]['limit']);_0x4519a1[_0xfe9a('0x1d')]=qs[_0xfe9a('0x1d')](_0x56debd[_0xfe9a('0x38')][_0xfe9a('0x1d')]);}_0x4519a1[_0xfe9a('0x40')]=qs['sort'](_0x56debd[_0xfe9a('0x38')]['sort']);_0x4519a1[_0xfe9a('0x42')]=qs[_0xfe9a('0x3a')](_[_0xfe9a('0x43')](_0x56debd[_0xfe9a('0x38')],_0x17eddc[_0xfe9a('0x3a')]));_0x4519a1['where']['SmsQueueId']=_0xb54dec['id'];if(_0x56debd[_0xfe9a('0x38')]['filter']){_0x4519a1[_0xfe9a('0x42')]=_[_0xfe9a('0x2b')](_0x4519a1[_0xfe9a('0x42')],{'$or':_['map'](_0x4519a1[_0xfe9a('0x3d')],function(_0x338e42){var _0x5008a6={};_0x5008a6[_0x338e42]={'$like':'%'+_0x56debd['query']['filter']+'%'};return _0x5008a6;})});}_0x4519a1=_[_0xfe9a('0x2b')]({},_0x4519a1,_0x56debd['options']);return db['UserSmsQueue'][_0xfe9a('0x56')](_0x4519a1);}})['then'](function(_0x10dd0f){if(_0x10dd0f){return db[_0xfe9a('0x57')][_0xfe9a('0x58')]({'where':{'id':_[_0xfe9a('0x32')](_0x10dd0f,_0xfe9a('0x59')),'role':'agent'},'attributes':['id','name',_0xfe9a('0x5a'),_0xfe9a('0x5b'),_0xfe9a('0x5c')]});}})[_0xfe9a('0x24')](function(_0x381326){if(_0x381326){return{'count':_0x381326['count'],'rows':_[_0xfe9a('0x32')](_0x381326[_0xfe9a('0x47')],function(_0x16b810){return{'membername':_0x16b810[_0xfe9a('0x37')],'UserId':_0x16b810['id'],'queue_name':_0x7bdceb[_0xfe9a('0x37')],'SmsQueueId':_0x7bdceb['id'],'interface':util[_0xfe9a('0x5d')]('%s/%s',_0xfe9a('0x5e'),_0x16b810[_0xfe9a('0x37')]),'penalty':0x0,'paused':_0x16b810[_0xfe9a('0x5a')],'createdAt':_0x16b810[_0xfe9a('0x5c')],'updatedAt':_0x16b810[_0xfe9a('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x532e67,_0x4519a1))[_0xfe9a('0x48')](handleError(_0x532e67,null));};exports[_0xfe9a('0x5f')]=function(_0xe1abcb,_0x5cc411,_0x4c2dc6){var _0x4f049c={};var _0x25484d={};var _0x1ff7bf;var _0x584006;return db[_0xfe9a('0x33')]['findOne']({'where':{'id':_0xe1abcb[_0xfe9a('0x49')]['id']}})[_0xfe9a('0x24')](handleEntityNotFound(_0x5cc411,null))[_0xfe9a('0x24')](function(_0x3a11b5){if(_0x3a11b5){_0x1ff7bf=_0x3a11b5;_0x25484d[_0xfe9a('0x3c')]=_[_0xfe9a('0x39')](db['Team'][_0xfe9a('0x34')]);_0x25484d[_0xfe9a('0x38')]=_[_0xfe9a('0x39')](_0xe1abcb[_0xfe9a('0x38')]);_0x25484d[_0xfe9a('0x3a')]=_[_0xfe9a('0x3b')](_0x25484d[_0xfe9a('0x3c')],_0x25484d['query']);_0x4f049c[_0xfe9a('0x3d')]=_[_0xfe9a('0x3b')](_0x25484d[_0xfe9a('0x3c')],qs[_0xfe9a('0x4a')](_0xe1abcb[_0xfe9a('0x38')][_0xfe9a('0x4a')]));_0x4f049c[_0xfe9a('0x3d')]=_0x4f049c[_0xfe9a('0x3d')][_0xfe9a('0x3e')]?_0x4f049c[_0xfe9a('0x3d')]:_0x25484d['model'];_0x4f049c['order']=qs['sort'](_0xe1abcb[_0xfe9a('0x38')][_0xfe9a('0x41')]);_0x4f049c[_0xfe9a('0x42')]=qs[_0xfe9a('0x3a')](_['pick'](_0xe1abcb[_0xfe9a('0x38')],_0x25484d[_0xfe9a('0x3a')]));if(_0xe1abcb[_0xfe9a('0x38')][_0xfe9a('0x44')]){_0x4f049c[_0xfe9a('0x42')]=_[_0xfe9a('0x2b')](_0x4f049c[_0xfe9a('0x42')],{'$or':_[_0xfe9a('0x32')](_0x4f049c['attributes'],function(_0x3ecd15){var _0x126fd9={};_0x126fd9[_0x3ecd15]={'$like':'%'+_0xe1abcb[_0xfe9a('0x38')][_0xfe9a('0x44')]+'%'};return _0x126fd9;})});}_0x4f049c=_[_0xfe9a('0x2b')]({},_0x4f049c,_0xe1abcb['options']);return _0x1ff7bf[_0xfe9a('0x5f')](_0x4f049c);}})['then'](function(_0x6d8445){if(_0x6d8445){_0x584006=_0x6d8445[_0xfe9a('0x3e')];if(!_0xe1abcb['query'][_0xfe9a('0x3f')]('nolimit')){_0x4f049c[_0xfe9a('0x1e')]=qs[_0xfe9a('0x1e')](_0xe1abcb[_0xfe9a('0x38')][_0xfe9a('0x1e')]);_0x4f049c['offset']=qs[_0xfe9a('0x1d')](_0xe1abcb[_0xfe9a('0x38')][_0xfe9a('0x1d')]);}return _0x1ff7bf[_0xfe9a('0x5f')](_0x4f049c);}})['then'](function(_0xf71e90){if(_0xf71e90){return _0xf71e90?{'count':_0x584006,'rows':_0xf71e90}:null;}})[_0xfe9a('0x24')](respondWithResult(_0x5cc411,null))[_0xfe9a('0x48')](handleError(_0x5cc411,null));};exports[_0xfe9a('0x60')]=function(_0x171d25,_0x503bbd,_0x1f221d){var _0x38706c=_0x171d25[_0xfe9a('0x2c')][_0xfe9a('0x61')];return db[_0xfe9a('0x62')][_0xfe9a('0x56')]({'where':{'id':_0x38706c},'attributes':['id'],'include':[{'model':db[_0xfe9a('0x57')],'as':_0xfe9a('0x63'),'attributes':['id',_0xfe9a('0x37'),_0xfe9a('0x64'),_0xfe9a('0x65'),_0xfe9a('0x66')],'raw':!![]}]})['then'](function(_0xd65cf){if(_0xd65cf){var _0x210ca3=_[_0xfe9a('0x67')](_0xd65cf,function(_0x4cb046){var _0x41c05d=_0x4cb046['get']({'plain':!![]});return _0x41c05d[_0xfe9a('0x63')];});return db[_0xfe9a('0x33')][_0xfe9a('0x4c')]({'where':{'id':_0x171d25[_0xfe9a('0x49')]['id']}})['then'](function(_0x587391){return db[_0xfe9a('0x68')]['transaction'](function(_0x2c29e0){return _0x587391['addTeams'](_0x38706c,{'transaction':_0x2c29e0})[_0xfe9a('0x24')](function(){return BPromise['each'](_0x210ca3,function(_0x3f8844){return db[_0xfe9a('0x54')][_0xfe9a('0x69')]({'where':{'UserId':_0x3f8844['id'],'SmsQueueId':_0x171d25['params']['id']},'transaction':_0x2c29e0});});})['then'](function(){_0x210ca3[_0xfe9a('0x6a')](function(_0x3fe530){socket[_0xfe9a('0x6b')](_0xfe9a('0x6c'),{'UserId':_0x3fe530['id'],'SmsQueueId':_0x587391['id']});});});});});}})[_0xfe9a('0x24')](respondWithStatusCode(_0x503bbd,null))[_0xfe9a('0x48')](handleError(_0x503bbd,null));};exports[_0xfe9a('0x6d')]=function(_0x32f6ee,_0x488f90,_0x5c3a85){return db[_0xfe9a('0x62')]['findAll']({'where':{'id':_0x32f6ee['query'][_0xfe9a('0x61')]},'attributes':['id'],'include':[{'model':db[_0xfe9a('0x57')],'as':_0xfe9a('0x63'),'attributes':['id'],'raw':!![]}]})[_0xfe9a('0x24')](handleEntityNotFound(_0x488f90,null))['then'](function(_0x41d654){var _0x1ba0c9=_[_0xfe9a('0x32')](_0x41d654,'id');var _0x492861=[];var _0x1b5a69=[];var _0x384f70=squel[_0xfe9a('0x6e')]();_0x384f70[_0xfe9a('0x6f')](_0xfe9a('0x70'))[_0xfe9a('0x71')](_0xfe9a('0x72'),'tq')[_0xfe9a('0x73')](_0xfe9a('0x74'),'ut',_0xfe9a('0x75'))[_0xfe9a('0x42')](_0xfe9a('0x76'),_0x32f6ee[_0xfe9a('0x49')]['id']);for(var _0x5470da=0x0;_0x5470da<_0x41d654[_0xfe9a('0x3e')];_0x5470da+=0x1){let _0x357964=_0x41d654[_0x5470da];for(var _0x32de1d=0x0;_0x32de1d<_0x357964[_0xfe9a('0x63')]['length'];_0x32de1d+=0x1){let _0xbd093c=_0x357964[_0xfe9a('0x63')][_0x32de1d];var _0x20854f=_0x384f70[_0xfe9a('0x77')]();_0x20854f[_0xfe9a('0x42')](_0xfe9a('0x78'),_0xbd093c['id']);_0x1b5a69[_0xfe9a('0x79')](db[_0xfe9a('0x68')][_0xfe9a('0x38')](_0x20854f['toString'](),{'type':db[_0xfe9a('0x68')][_0xfe9a('0x7a')]['SELECT']})[_0xfe9a('0x24')](function(_0x145c88){if(_0x145c88[_0xfe9a('0x3e')]===0x1){return _0xbd093c['id'];}else{var _0x78a13b=_[_0xfe9a('0x7b')](_['map'](_0x145c88,_0xfe9a('0x7c')),function(_0x719e57){return _['includes'](_0x1ba0c9,_0x719e57);});if(_0x78a13b){return _0xbd093c['id'];}}}));}}return BPromise[_0xfe9a('0x7d')](_0x1b5a69)[_0xfe9a('0x24')](function(_0x2098a2){_0x492861=_(_0x492861)[_0xfe9a('0x7e')](_0x2098a2)[_0xfe9a('0x7f')]()[_0xfe9a('0x80')]();return db['SmsQueue'][_0xfe9a('0x4c')]({'where':{'id':_0x32f6ee['params']['id']}})[_0xfe9a('0x24')](function(_0x1d56a9){return db[_0xfe9a('0x68')][_0xfe9a('0x81')](function(_0x2bc4a1){return _0x1d56a9['removeTeams'](_0x32f6ee[_0xfe9a('0x38')][_0xfe9a('0x61')],{'transaction':_0x2bc4a1})[_0xfe9a('0x24')](function(){if(!_[_0xfe9a('0x82')](_0x492861)){return _0x1d56a9[_0xfe9a('0x83')](_0x492861,{'transaction':_0x2bc4a1});}})[_0xfe9a('0x24')](function(){_0x492861[_0xfe9a('0x6a')](function(_0x18c3ae){socket['emit']('userSmsQueue:remove',{'UserId':_0x18c3ae,'SmsQueueId':_0x1d56a9['id']});});});});});});})[_0xfe9a('0x24')](respondWithStatusCode(_0x488f90,null))[_0xfe9a('0x48')](handleError(_0x488f90,null));};exports[_0xfe9a('0x84')]=function(_0x3ba605,_0x395fb6,_0x4e27fc){return db['SmsQueue'][_0xfe9a('0x4c')]({'where':{'id':_0x3ba605[_0xfe9a('0x49')]['id']}})['then'](handleEntityNotFound(_0x395fb6,null))[_0xfe9a('0x24')](function(_0x2772ab){if(_0x2772ab){return _0x2772ab[_0xfe9a('0x84')](_0x3ba605[_0xfe9a('0x2c')]['ids'],_['omit'](_0x3ba605['body'],[_0xfe9a('0x61'),'id'])||{})['spread'](function(_0x1d7c99){for(var _0x164e89=0x0;_0x164e89<_0x3ba605[_0xfe9a('0x2c')][_0xfe9a('0x61')][_0xfe9a('0x3e')];_0x164e89+=0x1){socket['emit'](_0xfe9a('0x6c'),{'UserId':_0x3ba605[_0xfe9a('0x2c')][_0xfe9a('0x61')][_0x164e89],'SmsQueueId':_0x3ba605[_0xfe9a('0x49')]['id']});}return _0x1d7c99;});}})['then'](respondWithResult(_0x395fb6,null))[_0xfe9a('0x48')](handleError(_0x395fb6,null));};exports[_0xfe9a('0x83')]=function(_0x1c7318,_0xd8a0e3,_0x3df6b4){return db[_0xfe9a('0x33')][_0xfe9a('0x4c')]({'where':{'id':_0x1c7318[_0xfe9a('0x49')]['id']}})[_0xfe9a('0x24')](handleEntityNotFound(_0xd8a0e3,null))[_0xfe9a('0x24')](function(_0x42e93b){if(_0x42e93b){return _0x42e93b[_0xfe9a('0x83')](_0x1c7318[_0xfe9a('0x38')]['ids'])[_0xfe9a('0x24')](function(){if(_[_0xfe9a('0x85')](_0x1c7318['query'][_0xfe9a('0x61')])){for(var _0x3e9485=0x0;_0x3e9485<_0x1c7318[_0xfe9a('0x38')]['ids'][_0xfe9a('0x3e')];_0x3e9485+=0x1){socket[_0xfe9a('0x6b')](_0xfe9a('0x86'),{'UserId':Number(_0x1c7318[_0xfe9a('0x38')]['ids'][_0x3e9485]),'SmsQueueId':Number(_0x1c7318[_0xfe9a('0x49')]['id'])});}}else{socket[_0xfe9a('0x6b')](_0xfe9a('0x86'),{'UserId':Number(_0x1c7318['query']['ids']),'SmsQueueId':Number(_0x1c7318[_0xfe9a('0x49')]['id'])});}});}})[_0xfe9a('0x24')](respondWithStatusCode(_0xd8a0e3,null))[_0xfe9a('0x48')](handleError(_0xd8a0e3,null));};exports[_0xfe9a('0x87')]=function(_0x26f6b8,_0x4856d1,_0x29fab8){var _0x156dae={};var _0x2acf72={};var _0x31531d;var _0x354847;return db['SmsQueue'][_0xfe9a('0x88')]({'where':{'id':_0x26f6b8['params']['id']}})[_0xfe9a('0x24')](handleEntityNotFound(_0x4856d1,null))['then'](function(_0x504a8d){if(_0x504a8d){_0x31531d=_0x504a8d;_0x2acf72[_0xfe9a('0x3c')]=_[_0xfe9a('0x39')](db[_0xfe9a('0x57')]['rawAttributes']);_0x2acf72[_0xfe9a('0x38')]=_[_0xfe9a('0x39')](_0x26f6b8[_0xfe9a('0x38')]);_0x2acf72[_0xfe9a('0x3a')]=_[_0xfe9a('0x3b')](_0x2acf72['model'],_0x2acf72['query']);_0x156dae[_0xfe9a('0x3d')]=_[_0xfe9a('0x3b')](_0x2acf72[_0xfe9a('0x3c')],qs[_0xfe9a('0x4a')](_0x26f6b8[_0xfe9a('0x38')][_0xfe9a('0x4a')]));_0x156dae[_0xfe9a('0x3d')]=_0x156dae[_0xfe9a('0x3d')][_0xfe9a('0x3e')]?_0x156dae['attributes']:_0x2acf72[_0xfe9a('0x3c')];_0x156dae[_0xfe9a('0x40')]=qs[_0xfe9a('0x41')](_0x26f6b8[_0xfe9a('0x38')]['sort']);_0x156dae[_0xfe9a('0x42')]=qs[_0xfe9a('0x3a')](_[_0xfe9a('0x43')](_0x26f6b8[_0xfe9a('0x38')],_0x2acf72[_0xfe9a('0x3a')]));if(_0x26f6b8[_0xfe9a('0x38')][_0xfe9a('0x44')]){_0x156dae[_0xfe9a('0x42')]=_['merge'](_0x156dae[_0xfe9a('0x42')],{'$or':_[_0xfe9a('0x32')](_0x156dae[_0xfe9a('0x3d')],function(_0xce57dc){var _0x3ac96b={};_0x3ac96b[_0xce57dc]={'$like':'%'+_0x26f6b8[_0xfe9a('0x38')][_0xfe9a('0x44')]+'%'};return _0x3ac96b;})});}_0x156dae=_['merge']({},_0x156dae,_0x26f6b8[_0xfe9a('0x4b')]);return _0x31531d['getAgents'](_0x156dae);}})['then'](function(_0x55a7a2){if(_0x55a7a2){_0x354847=_0x55a7a2[_0xfe9a('0x3e')];if(!_0x26f6b8['query'][_0xfe9a('0x3f')](_0xfe9a('0x55'))){_0x156dae[_0xfe9a('0x1e')]=qs[_0xfe9a('0x1e')](_0x26f6b8[_0xfe9a('0x38')][_0xfe9a('0x1e')]);_0x156dae[_0xfe9a('0x1d')]=qs['offset'](_0x26f6b8[_0xfe9a('0x38')]['offset']);}return _0x31531d[_0xfe9a('0x87')](_0x156dae);}})['then'](function(_0x4ba79e){if(_0x4ba79e){return _0x4ba79e?{'count':_0x354847,'rows':_0x4ba79e}:null;}})['then'](respondWithResult(_0x4856d1,null))[_0xfe9a('0x48')](handleError(_0x4856d1,null));}; \ No newline at end of file +var _0x6ce7=['../../mysqldb','redis','localhost','./smsQueue.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','render','contact','agent','interaction','account','SmsQueue','rawAttributes','key','model','map','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','length','body','user','get','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','Agents','online','interface','flatMap','sequelize','addTeams','each','forEach','emit','userSmsQueue:save','ids','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','union','value','transaction','removeTeams','removeAgents','userSmsQueue:remove','addAgents','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6ce7,0x18c));var _0x76ce=function(_0x250c06,_0x22cabf){_0x250c06=_0x250c06-0x0;var _0x476a03=_0x6ce7[_0x250c06];return _0x476a03;};'use strict';var emlformat=require(_0x76ce('0x0'));var rimraf=require(_0x76ce('0x1'));var zipdir=require(_0x76ce('0x2'));var jsonpatch=require(_0x76ce('0x3'));var rp=require(_0x76ce('0x4'));var moment=require('moment');var BPromise=require(_0x76ce('0x5'));var Mustache=require(_0x76ce('0x6'));var util=require(_0x76ce('0x7'));var path=require(_0x76ce('0x8'));var sox=require('sox');var csv=require(_0x76ce('0x9'));var ejs=require(_0x76ce('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76ce('0xb'));var squel=require(_0x76ce('0xc'));var crypto=require(_0x76ce('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x76ce('0xe'));var toCsv=require(_0x76ce('0x9'));var querystring=require(_0x76ce('0xf'));var Papa=require(_0x76ce('0x10'));var Redis=require(_0x76ce('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76ce('0x12'));var logger=require(_0x76ce('0x13'))(_0x76ce('0x14'));var utils=require(_0x76ce('0x15'));var config=require(_0x76ce('0x16'));var licenseUtil=require(_0x76ce('0x17'));var db=require(_0x76ce('0x18'))['db'];config[_0x76ce('0x19')]=_['defaults'](config['redis'],{'host':_0x76ce('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x76ce('0x1b'))['register'](socket);function respondWithStatusCode(_0x44a533,_0x17964d){_0x17964d=_0x17964d||0xcc;return function(_0x59adf4){if(_0x59adf4){return _0x44a533[_0x76ce('0x1c')](_0x17964d);}return _0x44a533[_0x76ce('0x1d')](_0x17964d)['end']();};}function respondWithResult(_0x52622b,_0x44a5a9){_0x44a5a9=_0x44a5a9||0xc8;return function(_0x1566f3){if(_0x1566f3){return _0x52622b[_0x76ce('0x1d')](_0x44a5a9)[_0x76ce('0x1e')](_0x1566f3);}};}function respondWithFilteredResult(_0x3f8b9a,_0x1bc90b){return function(_0x533520){if(_0x533520){var _0x2c3fc2=typeof _0x1bc90b[_0x76ce('0x1f')]===_0x76ce('0x20')&&typeof _0x1bc90b[_0x76ce('0x21')]===_0x76ce('0x20');var _0x58158b=_0x533520[_0x76ce('0x22')];var _0x37a5a9=_0x2c3fc2?0x0:_0x1bc90b[_0x76ce('0x1f')];var _0x521ef0=_0x2c3fc2?_0x533520[_0x76ce('0x22')]:_0x1bc90b['offset']+_0x1bc90b[_0x76ce('0x21')];var _0x40b26f;if(_0x521ef0>=_0x58158b){_0x521ef0=_0x58158b;_0x40b26f=0xc8;}else{_0x40b26f=0xce;}_0x3f8b9a[_0x76ce('0x1d')](_0x40b26f);return _0x3f8b9a[_0x76ce('0x23')](_0x76ce('0x24'),_0x37a5a9+'-'+_0x521ef0+'/'+_0x58158b)[_0x76ce('0x1e')](_0x533520);}return null;};}function patchUpdates(_0x43713a){return function(_0x52fbc9){try{jsonpatch[_0x76ce('0x25')](_0x52fbc9,_0x43713a,!![]);}catch(_0x3df652){return BPromise[_0x76ce('0x26')](_0x3df652);}return _0x52fbc9[_0x76ce('0x27')]();};}function saveUpdates(_0x2fb321,_0x43f3b8){return function(_0x5a1fdd){if(_0x5a1fdd){return _0x5a1fdd[_0x76ce('0x28')](_0x2fb321)[_0x76ce('0x29')](function(_0xd29ffe){return _0xd29ffe;});}return null;};}function removeEntity(_0x20ecbc,_0x1f1164){return function(_0x3a3982){if(_0x3a3982){return _0x3a3982[_0x76ce('0x2a')]()[_0x76ce('0x29')](function(){var _0x59f28c=_0x3a3982['get']({'plain':!![]});var _0xa02e8f=_0x76ce('0x2b');return db[_0x76ce('0x2c')][_0x76ce('0x2a')]({'where':{'type':_0xa02e8f,'resourceId':_0x59f28c['id']}})[_0x76ce('0x29')](function(){return _0x3a3982;});})[_0x76ce('0x29')](function(){_0x20ecbc[_0x76ce('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a7d04,_0x1ac47c){return function(_0x9bfb83){if(!_0x9bfb83){_0x1a7d04['sendStatus'](0x194);}return _0x9bfb83;};}function handleError(_0x2ba916,_0x5b9ac1){_0x5b9ac1=_0x5b9ac1||0x1f4;return function(_0x58fe6f){logger[_0x76ce('0x2d')](_0x58fe6f[_0x76ce('0x2e')]);if(_0x58fe6f[_0x76ce('0x2f')]){delete _0x58fe6f[_0x76ce('0x2f')];}_0x2ba916[_0x76ce('0x1d')](_0x5b9ac1)[_0x76ce('0x30')](_0x58fe6f);};}function getMustacheRender(_0x215710,_0x47c194){return Mustache[_0x76ce('0x31')](_0x215710,_['merge'](_0x47c194['body'],{'contact':_0x47c194[_0x76ce('0x32')],'message':_0x47c194['message'],'agent':_0x47c194[_0x76ce('0x33')],'interaction':_0x47c194[_0x76ce('0x34')],'account':_0x47c194[_0x76ce('0x35')]}))||'';}exports['index']=function(_0x1364e4,_0xfa84a8){var _0x2fe72d={},_0x559c84={},_0x1e3355={'count':0x0,'rows':[]};var _0x21623f=_['map'](db[_0x76ce('0x36')][_0x76ce('0x37')],function(_0x8e6db0){return{'name':_0x8e6db0['fieldName'],'type':_0x8e6db0['type'][_0x76ce('0x38')]};});_0x559c84[_0x76ce('0x39')]=_[_0x76ce('0x3a')](_0x21623f,_0x76ce('0x2f'));_0x559c84[_0x76ce('0x3b')]=_['keys'](_0x1364e4[_0x76ce('0x3b')]);_0x559c84[_0x76ce('0x3c')]=_['intersection'](_0x559c84['model'],_0x559c84[_0x76ce('0x3b')]);_0x2fe72d['attributes']=_[_0x76ce('0x3d')](_0x559c84['model'],qs['fields'](_0x1364e4[_0x76ce('0x3b')]['fields']));_0x2fe72d[_0x76ce('0x3e')]=_0x2fe72d[_0x76ce('0x3e')]['length']?_0x2fe72d[_0x76ce('0x3e')]:_0x559c84['model'];if(!_0x1364e4[_0x76ce('0x3b')][_0x76ce('0x3f')](_0x76ce('0x40'))){_0x2fe72d[_0x76ce('0x21')]=qs[_0x76ce('0x21')](_0x1364e4[_0x76ce('0x3b')][_0x76ce('0x21')]);_0x2fe72d[_0x76ce('0x1f')]=qs[_0x76ce('0x1f')](_0x1364e4[_0x76ce('0x3b')][_0x76ce('0x1f')]);}_0x2fe72d[_0x76ce('0x41')]=qs[_0x76ce('0x42')](_0x1364e4[_0x76ce('0x3b')]['sort']);_0x2fe72d[_0x76ce('0x43')]=qs[_0x76ce('0x3c')](_[_0x76ce('0x44')](_0x1364e4[_0x76ce('0x3b')],_0x559c84[_0x76ce('0x3c')]),_0x21623f);if(_0x1364e4[_0x76ce('0x3b')]['filter']){_0x2fe72d[_0x76ce('0x43')]=_[_0x76ce('0x45')](_0x2fe72d['where'],{'$or':_[_0x76ce('0x3a')](_0x21623f,function(_0x1a0539){if(_0x1a0539[_0x76ce('0x46')]!=='VIRTUAL'){var _0x2705df={};_0x2705df[_0x1a0539[_0x76ce('0x2f')]]={'$like':'%'+_0x1364e4[_0x76ce('0x3b')][_0x76ce('0x47')]+'%'};return _0x2705df;}})});}_0x2fe72d=_[_0x76ce('0x45')]({},_0x2fe72d,_0x1364e4[_0x76ce('0x48')]);var _0x3ab641={'where':_0x2fe72d[_0x76ce('0x43')]};return db[_0x76ce('0x36')][_0x76ce('0x22')](_0x3ab641)[_0x76ce('0x29')](function(_0x15b661){_0x1e3355[_0x76ce('0x22')]=_0x15b661;if(_0x1364e4['query'][_0x76ce('0x49')]){_0x2fe72d[_0x76ce('0x4a')]=[{'all':!![]}];}return db[_0x76ce('0x36')][_0x76ce('0x4b')](_0x2fe72d);})[_0x76ce('0x29')](function(_0x5ea062){_0x1e3355[_0x76ce('0x4c')]=_0x5ea062;return _0x1e3355;})['then'](respondWithFilteredResult(_0xfa84a8,_0x2fe72d))[_0x76ce('0x4d')](handleError(_0xfa84a8,null));};exports[_0x76ce('0x4e')]=function(_0x10a40c,_0x219eed){var _0x52a9c7={'raw':!![],'where':{'id':_0x10a40c[_0x76ce('0x4f')]['id']}},_0x4e3a6e={};_0x4e3a6e[_0x76ce('0x39')]=_[_0x76ce('0x50')](db[_0x76ce('0x36')][_0x76ce('0x37')]);_0x4e3a6e[_0x76ce('0x3b')]=_['keys'](_0x10a40c[_0x76ce('0x3b')]);_0x4e3a6e['filters']=_['intersection'](_0x4e3a6e[_0x76ce('0x39')],_0x4e3a6e['query']);_0x52a9c7['attributes']=_[_0x76ce('0x3d')](_0x4e3a6e[_0x76ce('0x39')],qs[_0x76ce('0x51')](_0x10a40c['query'][_0x76ce('0x51')]));_0x52a9c7[_0x76ce('0x3e')]=_0x52a9c7['attributes'][_0x76ce('0x52')]?_0x52a9c7[_0x76ce('0x3e')]:_0x4e3a6e[_0x76ce('0x39')];if(_0x10a40c['query'][_0x76ce('0x49')]){_0x52a9c7[_0x76ce('0x4a')]=[{'all':!![]}];}_0x52a9c7=_[_0x76ce('0x45')]({},_0x52a9c7,_0x10a40c[_0x76ce('0x48')]);return db['SmsQueue']['find'](_0x52a9c7)[_0x76ce('0x29')](handleEntityNotFound(_0x219eed,null))['then'](respondWithResult(_0x219eed,null))[_0x76ce('0x4d')](handleError(_0x219eed,null));};exports['create']=function(_0x25d8df,_0x458974){return db[_0x76ce('0x36')]['create'](_0x25d8df[_0x76ce('0x53')],{})[_0x76ce('0x29')](function(_0x5c9bac){var _0x4f431e=_0x25d8df[_0x76ce('0x54')][_0x76ce('0x55')]({'plain':!![]});if(!_0x4f431e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f431e[_0x76ce('0x56')]==='user'){var _0x21c1fc=_0x5c9bac[_0x76ce('0x55')]({'plain':!![]});var _0x1f32c3='SmsQueues';return db[_0x76ce('0x57')][_0x76ce('0x58')]({'where':{'name':_0x1f32c3,'userProfileId':_0x4f431e[_0x76ce('0x59')]},'raw':!![]})[_0x76ce('0x29')](function(_0x37865f){if(_0x37865f&&_0x37865f['autoAssociation']===0x0){return db[_0x76ce('0x2c')][_0x76ce('0x5a')]({'name':_0x21c1fc[_0x76ce('0x2f')],'resourceId':_0x21c1fc['id'],'type':_0x37865f[_0x76ce('0x2f')],'sectionId':_0x37865f['id']},{})[_0x76ce('0x29')](function(){return _0x5c9bac;});}else{return _0x5c9bac;}})[_0x76ce('0x4d')](function(_0x5eef93){logger['error'](_0x76ce('0x5b'),_0x5eef93);throw _0x5eef93;});}return _0x5c9bac;})[_0x76ce('0x29')](respondWithResult(_0x458974,0xc9))['catch'](handleError(_0x458974,null));};exports[_0x76ce('0x28')]=function(_0x1ca37f,_0x3522ef){if(_0x1ca37f[_0x76ce('0x53')]['id']){delete _0x1ca37f[_0x76ce('0x53')]['id'];}return db[_0x76ce('0x36')][_0x76ce('0x58')]({'where':{'id':_0x1ca37f[_0x76ce('0x4f')]['id']}})[_0x76ce('0x29')](handleEntityNotFound(_0x3522ef,null))[_0x76ce('0x29')](saveUpdates(_0x1ca37f[_0x76ce('0x53')],null))[_0x76ce('0x29')](respondWithResult(_0x3522ef,null))[_0x76ce('0x4d')](handleError(_0x3522ef,null));};exports[_0x76ce('0x2a')]=function(_0xaead14,_0x371f5f){return db[_0x76ce('0x36')][_0x76ce('0x58')]({'where':{'id':_0xaead14[_0x76ce('0x4f')]['id']}})[_0x76ce('0x29')](handleEntityNotFound(_0x371f5f,null))[_0x76ce('0x29')](removeEntity(_0x371f5f,null))['catch'](handleError(_0x371f5f,null));};exports['describe']=function(_0x671ac1,_0x37099a){return db[_0x76ce('0x36')][_0x76ce('0x5c')]()[_0x76ce('0x29')](respondWithResult(_0x37099a,null))['catch'](handleError(_0x37099a,null));};exports['getMembers']=function(_0x2ddbed,_0x4466b3,_0x3fb805){var _0x29ebf1={'raw':!![],'where':{}},_0x36b3b2={},_0x35c9a7;return db[_0x76ce('0x36')][_0x76ce('0x5d')]({'where':{'id':_0x2ddbed[_0x76ce('0x4f')]['id']}})[_0x76ce('0x29')](handleEntityNotFound(_0x4466b3,null))[_0x76ce('0x29')](function(_0xbde5ee){if(_0xbde5ee){_0x35c9a7=_0xbde5ee[_0x76ce('0x55')]({'plain':!![]});_0x36b3b2['model']=_['keys'](db[_0x76ce('0x5e')][_0x76ce('0x37')]);_0x36b3b2[_0x76ce('0x3b')]=_[_0x76ce('0x50')](_0x2ddbed['query']);_0x36b3b2[_0x76ce('0x3c')]=_[_0x76ce('0x3d')](_0x36b3b2[_0x76ce('0x39')],_0x36b3b2[_0x76ce('0x3b')]);_0x29ebf1[_0x76ce('0x3e')]=_[_0x76ce('0x3d')](_0x36b3b2['model'],qs[_0x76ce('0x51')](_0x2ddbed['query'][_0x76ce('0x51')]));_0x29ebf1['attributes']=_0x29ebf1[_0x76ce('0x3e')][_0x76ce('0x52')]?_0x29ebf1[_0x76ce('0x3e')]:_0x36b3b2[_0x76ce('0x39')];if(!_0x2ddbed['query'][_0x76ce('0x3f')](_0x76ce('0x40'))){_0x29ebf1[_0x76ce('0x21')]=qs[_0x76ce('0x21')](_0x2ddbed['query'][_0x76ce('0x21')]);_0x29ebf1['offset']=qs[_0x76ce('0x1f')](_0x2ddbed['query'][_0x76ce('0x1f')]);}_0x29ebf1[_0x76ce('0x41')]=qs[_0x76ce('0x42')](_0x2ddbed[_0x76ce('0x3b')][_0x76ce('0x42')]);_0x29ebf1[_0x76ce('0x43')]=qs[_0x76ce('0x3c')](_[_0x76ce('0x44')](_0x2ddbed[_0x76ce('0x3b')],_0x36b3b2[_0x76ce('0x3c')]));_0x29ebf1[_0x76ce('0x43')]['SmsQueueId']=_0xbde5ee['id'];if(_0x2ddbed['query'][_0x76ce('0x47')]){_0x29ebf1[_0x76ce('0x43')]=_[_0x76ce('0x45')](_0x29ebf1[_0x76ce('0x43')],{'$or':_['map'](_0x29ebf1['attributes'],function(_0x22747b){var _0x531c68={};_0x531c68[_0x22747b]={'$like':'%'+_0x2ddbed[_0x76ce('0x3b')][_0x76ce('0x47')]+'%'};return _0x531c68;})});}_0x29ebf1=_['merge']({},_0x29ebf1,_0x2ddbed[_0x76ce('0x48')]);return db['UserSmsQueue'][_0x76ce('0x4b')](_0x29ebf1);}})[_0x76ce('0x29')](function(_0x4b3925){if(_0x4b3925){return db[_0x76ce('0x5f')][_0x76ce('0x60')]({'where':{'id':_[_0x76ce('0x3a')](_0x4b3925,_0x76ce('0x61')),'role':_0x76ce('0x33')},'attributes':['id','name','smsPause',_0x76ce('0x62'),_0x76ce('0x63')]});}})[_0x76ce('0x29')](function(_0x51efdb){if(_0x51efdb){return{'count':_0x51efdb[_0x76ce('0x22')],'rows':_[_0x76ce('0x3a')](_0x51efdb[_0x76ce('0x4c')],function(_0x48a942){return{'membername':_0x48a942[_0x76ce('0x2f')],'UserId':_0x48a942['id'],'queue_name':_0x35c9a7[_0x76ce('0x2f')],'SmsQueueId':_0x35c9a7['id'],'interface':util[_0x76ce('0x64')](_0x76ce('0x65'),_0x76ce('0x66'),_0x48a942[_0x76ce('0x2f')]),'penalty':0x0,'paused':_0x48a942['smsPause'],'createdAt':_0x48a942[_0x76ce('0x63')],'updatedAt':_0x48a942[_0x76ce('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4466b3,_0x29ebf1))[_0x76ce('0x4d')](handleError(_0x4466b3,null));};exports[_0x76ce('0x67')]=function(_0x5b0cab,_0x5e6117,_0x3641df){var _0x1733ce={};var _0x2e9018={};var _0x2aa224;var _0x8fe5be;return db['SmsQueue'][_0x76ce('0x5d')]({'where':{'id':_0x5b0cab['params']['id']}})[_0x76ce('0x29')](handleEntityNotFound(_0x5e6117,null))[_0x76ce('0x29')](function(_0x16f080){if(_0x16f080){_0x2aa224=_0x16f080;_0x2e9018[_0x76ce('0x39')]=_[_0x76ce('0x50')](db[_0x76ce('0x68')]['rawAttributes']);_0x2e9018[_0x76ce('0x3b')]=_[_0x76ce('0x50')](_0x5b0cab['query']);_0x2e9018[_0x76ce('0x3c')]=_['intersection'](_0x2e9018[_0x76ce('0x39')],_0x2e9018[_0x76ce('0x3b')]);_0x1733ce[_0x76ce('0x3e')]=_['intersection'](_0x2e9018[_0x76ce('0x39')],qs[_0x76ce('0x51')](_0x5b0cab[_0x76ce('0x3b')][_0x76ce('0x51')]));_0x1733ce[_0x76ce('0x3e')]=_0x1733ce[_0x76ce('0x3e')][_0x76ce('0x52')]?_0x1733ce['attributes']:_0x2e9018['model'];_0x1733ce['order']=qs[_0x76ce('0x42')](_0x5b0cab[_0x76ce('0x3b')]['sort']);_0x1733ce[_0x76ce('0x43')]=qs['filters'](_['pick'](_0x5b0cab[_0x76ce('0x3b')],_0x2e9018[_0x76ce('0x3c')]));if(_0x5b0cab[_0x76ce('0x3b')][_0x76ce('0x47')]){_0x1733ce[_0x76ce('0x43')]=_[_0x76ce('0x45')](_0x1733ce['where'],{'$or':_[_0x76ce('0x3a')](_0x1733ce[_0x76ce('0x3e')],function(_0x163405){var _0x3f549a={};_0x3f549a[_0x163405]={'$like':'%'+_0x5b0cab[_0x76ce('0x3b')]['filter']+'%'};return _0x3f549a;})});}_0x1733ce=_[_0x76ce('0x45')]({},_0x1733ce,_0x5b0cab['options']);return _0x2aa224[_0x76ce('0x67')](_0x1733ce);}})[_0x76ce('0x29')](function(_0x4c557f){if(_0x4c557f){_0x8fe5be=_0x4c557f['length'];if(!_0x5b0cab['query'][_0x76ce('0x3f')](_0x76ce('0x40'))){_0x1733ce[_0x76ce('0x21')]=qs[_0x76ce('0x21')](_0x5b0cab[_0x76ce('0x3b')]['limit']);_0x1733ce[_0x76ce('0x1f')]=qs['offset'](_0x5b0cab[_0x76ce('0x3b')][_0x76ce('0x1f')]);}return _0x2aa224['getTeams'](_0x1733ce);}})[_0x76ce('0x29')](function(_0x4faac9){if(_0x4faac9){return _0x4faac9?{'count':_0x8fe5be,'rows':_0x4faac9}:null;}})[_0x76ce('0x29')](respondWithResult(_0x5e6117,null))[_0x76ce('0x4d')](handleError(_0x5e6117,null));};exports['addTeams']=function(_0x578d5b,_0x1d20c6,_0x77f9cf){var _0x3f2ae2=_0x578d5b[_0x76ce('0x53')]['ids'];return db[_0x76ce('0x68')][_0x76ce('0x4b')]({'where':{'id':_0x3f2ae2},'attributes':['id'],'include':[{'model':db[_0x76ce('0x5f')],'as':_0x76ce('0x69'),'attributes':['id',_0x76ce('0x2f'),_0x76ce('0x6a'),'voicePause',_0x76ce('0x6b')],'raw':!![]}]})['then'](function(_0x320549){if(_0x320549){var _0x4b7dc1=_[_0x76ce('0x6c')](_0x320549,function(_0x4c8e74){var _0x1d0c17=_0x4c8e74[_0x76ce('0x55')]({'plain':!![]});return _0x1d0c17[_0x76ce('0x69')];});return db[_0x76ce('0x36')][_0x76ce('0x58')]({'where':{'id':_0x578d5b['params']['id']}})[_0x76ce('0x29')](function(_0x280faa){return db[_0x76ce('0x6d')]['transaction'](function(_0x53209b){return _0x280faa[_0x76ce('0x6e')](_0x3f2ae2,{'transaction':_0x53209b})[_0x76ce('0x29')](function(){return BPromise[_0x76ce('0x6f')](_0x4b7dc1,function(_0x548540){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x548540['id'],'SmsQueueId':_0x578d5b[_0x76ce('0x4f')]['id']},'transaction':_0x53209b});});})[_0x76ce('0x29')](function(){_0x4b7dc1[_0x76ce('0x70')](function(_0x5983bb){socket[_0x76ce('0x71')](_0x76ce('0x72'),{'UserId':_0x5983bb['id'],'SmsQueueId':_0x280faa['id']});});});});});}})[_0x76ce('0x29')](respondWithStatusCode(_0x1d20c6,null))[_0x76ce('0x4d')](handleError(_0x1d20c6,null));};exports['removeTeams']=function(_0x471f6f,_0x3a8781,_0x2aa781){return db[_0x76ce('0x68')][_0x76ce('0x4b')]({'where':{'id':_0x471f6f['query'][_0x76ce('0x73')]},'attributes':['id'],'include':[{'model':db[_0x76ce('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x76ce('0x29')](handleEntityNotFound(_0x3a8781,null))[_0x76ce('0x29')](function(_0x48fc9d){var _0x3f9fe0=_[_0x76ce('0x3a')](_0x48fc9d,'id');var _0x4cc0a9=[];var _0x36fe15=[];var _0x1563bf=squel['select']();_0x1563bf[_0x76ce('0x74')](_0x76ce('0x75'))[_0x76ce('0x76')](_0x76ce('0x77'),'tq')[_0x76ce('0x78')](_0x76ce('0x79'),'ut',_0x76ce('0x7a'))[_0x76ce('0x43')](_0x76ce('0x7b'),_0x471f6f[_0x76ce('0x4f')]['id']);for(var _0x114707=0x0;_0x114707<_0x48fc9d['length'];_0x114707+=0x1){let _0x3be598=_0x48fc9d[_0x114707];for(var _0x26107b=0x0;_0x26107b<_0x3be598['Agents'][_0x76ce('0x52')];_0x26107b+=0x1){let _0x4431ad=_0x3be598[_0x76ce('0x69')][_0x26107b];var _0x84da84=_0x1563bf[_0x76ce('0x7c')]();_0x84da84[_0x76ce('0x43')]('ut.UserId\x20=\x20?',_0x4431ad['id']);_0x36fe15[_0x76ce('0x7d')](db[_0x76ce('0x6d')]['query'](_0x84da84[_0x76ce('0x7e')](),{'type':db['sequelize'][_0x76ce('0x7f')][_0x76ce('0x80')]})[_0x76ce('0x29')](function(_0xc57f92){if(_0xc57f92['length']===0x1){return _0x4431ad['id'];}else{var _0x18f112=_[_0x76ce('0x81')](_[_0x76ce('0x3a')](_0xc57f92,_0x76ce('0x82')),function(_0x8122f4){return _['includes'](_0x3f9fe0,_0x8122f4);});if(_0x18f112){return _0x4431ad['id'];}}}));}}return BPromise['all'](_0x36fe15)[_0x76ce('0x29')](function(_0x4bebc0){_0x4cc0a9=_(_0x4cc0a9)[_0x76ce('0x83')](_0x4bebc0)['compact']()[_0x76ce('0x84')]();return db[_0x76ce('0x36')][_0x76ce('0x58')]({'where':{'id':_0x471f6f[_0x76ce('0x4f')]['id']}})[_0x76ce('0x29')](function(_0x1e28b4){return db['sequelize'][_0x76ce('0x85')](function(_0x173c01){return _0x1e28b4[_0x76ce('0x86')](_0x471f6f['query']['ids'],{'transaction':_0x173c01})[_0x76ce('0x29')](function(){if(!_['isEmpty'](_0x4cc0a9)){return _0x1e28b4[_0x76ce('0x87')](_0x4cc0a9,{'transaction':_0x173c01});}})[_0x76ce('0x29')](function(){_0x4cc0a9[_0x76ce('0x70')](function(_0x20b762){socket[_0x76ce('0x71')](_0x76ce('0x88'),{'UserId':_0x20b762,'SmsQueueId':_0x1e28b4['id']});});});});});});})['then'](respondWithStatusCode(_0x3a8781,null))[_0x76ce('0x4d')](handleError(_0x3a8781,null));};exports[_0x76ce('0x89')]=function(_0x2c74df,_0xeb833d,_0x17fae8){return db[_0x76ce('0x36')]['find']({'where':{'id':_0x2c74df[_0x76ce('0x4f')]['id']}})[_0x76ce('0x29')](handleEntityNotFound(_0xeb833d,null))[_0x76ce('0x29')](function(_0x2cfd0a){if(_0x2cfd0a){return _0x2cfd0a[_0x76ce('0x89')](_0x2c74df[_0x76ce('0x53')][_0x76ce('0x73')],_['omit'](_0x2c74df[_0x76ce('0x53')],[_0x76ce('0x73'),'id'])||{})[_0x76ce('0x8a')](function(_0x49e88b){for(var _0x3e2ff6=0x0;_0x3e2ff6<_0x2c74df[_0x76ce('0x53')][_0x76ce('0x73')][_0x76ce('0x52')];_0x3e2ff6+=0x1){socket[_0x76ce('0x71')]('userSmsQueue:save',{'UserId':_0x2c74df['body'][_0x76ce('0x73')][_0x3e2ff6],'SmsQueueId':_0x2c74df['params']['id']});}return _0x49e88b;});}})[_0x76ce('0x29')](respondWithResult(_0xeb833d,null))[_0x76ce('0x4d')](handleError(_0xeb833d,null));};exports['removeAgents']=function(_0x517114,_0x38e882,_0x5e5c6c){return db[_0x76ce('0x36')][_0x76ce('0x58')]({'where':{'id':_0x517114['params']['id']}})[_0x76ce('0x29')](handleEntityNotFound(_0x38e882,null))[_0x76ce('0x29')](function(_0x12182f){if(_0x12182f){return _0x12182f[_0x76ce('0x87')](_0x517114[_0x76ce('0x3b')]['ids'])[_0x76ce('0x29')](function(){if(_['isArray'](_0x517114['query'][_0x76ce('0x73')])){for(var _0x37a5ca=0x0;_0x37a5ca<_0x517114[_0x76ce('0x3b')]['ids'][_0x76ce('0x52')];_0x37a5ca+=0x1){socket[_0x76ce('0x71')](_0x76ce('0x88'),{'UserId':Number(_0x517114[_0x76ce('0x3b')]['ids'][_0x37a5ca]),'SmsQueueId':Number(_0x517114['params']['id'])});}}else{socket[_0x76ce('0x71')](_0x76ce('0x88'),{'UserId':Number(_0x517114['query'][_0x76ce('0x73')]),'SmsQueueId':Number(_0x517114[_0x76ce('0x4f')]['id'])});}});}})[_0x76ce('0x29')](respondWithStatusCode(_0x38e882,null))['catch'](handleError(_0x38e882,null));};exports['getAgents']=function(_0x333659,_0x16b24f,_0x5d80e4){var _0x5d7dab={};var _0x592421={};var _0x413998;var _0x12ba87;return db['SmsQueue']['findOne']({'where':{'id':_0x333659[_0x76ce('0x4f')]['id']}})[_0x76ce('0x29')](handleEntityNotFound(_0x16b24f,null))['then'](function(_0x4102a5){if(_0x4102a5){_0x413998=_0x4102a5;_0x592421[_0x76ce('0x39')]=_[_0x76ce('0x50')](db[_0x76ce('0x5f')]['rawAttributes']);_0x592421[_0x76ce('0x3b')]=_[_0x76ce('0x50')](_0x333659['query']);_0x592421[_0x76ce('0x3c')]=_[_0x76ce('0x3d')](_0x592421[_0x76ce('0x39')],_0x592421[_0x76ce('0x3b')]);_0x5d7dab[_0x76ce('0x3e')]=_[_0x76ce('0x3d')](_0x592421[_0x76ce('0x39')],qs['fields'](_0x333659[_0x76ce('0x3b')][_0x76ce('0x51')]));_0x5d7dab[_0x76ce('0x3e')]=_0x5d7dab[_0x76ce('0x3e')]['length']?_0x5d7dab[_0x76ce('0x3e')]:_0x592421[_0x76ce('0x39')];_0x5d7dab[_0x76ce('0x41')]=qs[_0x76ce('0x42')](_0x333659[_0x76ce('0x3b')][_0x76ce('0x42')]);_0x5d7dab[_0x76ce('0x43')]=qs[_0x76ce('0x3c')](_[_0x76ce('0x44')](_0x333659[_0x76ce('0x3b')],_0x592421[_0x76ce('0x3c')]));if(_0x333659[_0x76ce('0x3b')][_0x76ce('0x47')]){_0x5d7dab[_0x76ce('0x43')]=_[_0x76ce('0x45')](_0x5d7dab['where'],{'$or':_['map'](_0x5d7dab[_0x76ce('0x3e')],function(_0x9965be){var _0x341e85={};_0x341e85[_0x9965be]={'$like':'%'+_0x333659['query'][_0x76ce('0x47')]+'%'};return _0x341e85;})});}_0x5d7dab=_[_0x76ce('0x45')]({},_0x5d7dab,_0x333659['options']);return _0x413998[_0x76ce('0x8b')](_0x5d7dab);}})['then'](function(_0x3a3892){if(_0x3a3892){_0x12ba87=_0x3a3892[_0x76ce('0x52')];if(!_0x333659[_0x76ce('0x3b')]['hasOwnProperty'](_0x76ce('0x40'))){_0x5d7dab[_0x76ce('0x21')]=qs['limit'](_0x333659[_0x76ce('0x3b')]['limit']);_0x5d7dab[_0x76ce('0x1f')]=qs[_0x76ce('0x1f')](_0x333659[_0x76ce('0x3b')][_0x76ce('0x1f')]);}return _0x413998[_0x76ce('0x8b')](_0x5d7dab);}})[_0x76ce('0x29')](function(_0x1e9dbf){if(_0x1e9dbf){return _0x1e9dbf?{'count':_0x12ba87,'rows':_0x1e9dbf}:null;}})[_0x76ce('0x29')](respondWithResult(_0x16b24f,null))[_0x76ce('0x4d')](handleError(_0x16b24f,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index ae0a066..df3697d 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 _0x950a=['exports','events','../../mysqldb','SmsQueue','save','emit','hasOwnProperty'];(function(_0x4286f7,_0x1d28da){var _0x43d10e=function(_0xe9c47a){while(--_0xe9c47a){_0x4286f7['push'](_0x4286f7['shift']());}};_0x43d10e(++_0x1d28da);}(_0x950a,0x174));var _0xa950=function(_0x43028e,_0x33a648){_0x43028e=_0x43028e-0x0;var _0x2fed6d=_0x950a[_0x43028e];return _0x2fed6d;};'use strict';var EventEmitter=require(_0xa950('0x0'));var SmsQueue=require(_0xa950('0x1'))['db'][_0xa950('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa950('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x161a3e){return function(_0x335705,_0x35f833,_0x2997f4){SmsQueueEvents[_0xa950('0x4')](_0x161a3e+':'+_0x335705['id'],_0x335705);SmsQueueEvents[_0xa950('0x4')](_0x161a3e,_0x335705);_0x2997f4(null);};}for(var e in events){if(events[_0xa950('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xa950('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0xbb25=['remove','emit','hook','exports','../../mysqldb','SmsQueue','save','update'];(function(_0x163267,_0x516a95){var _0x4e15f8=function(_0x352266){while(--_0x352266){_0x163267['push'](_0x163267['shift']());}};_0x4e15f8(++_0x516a95);}(_0xbb25,0xec));var _0x5bb2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbb25[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x5bb2('0x0'))['db'][_0x5bb2('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5bb2('0x2'),'afterUpdate':_0x5bb2('0x3'),'afterDestroy':_0x5bb2('0x4')};function emitEvent(_0x45a798){return function(_0x3179e9,_0x34cb59,_0x479c00){SmsQueueEvents[_0x5bb2('0x5')](_0x45a798+':'+_0x3179e9['id'],_0x3179e9);SmsQueueEvents[_0x5bb2('0x5')](_0x45a798,_0x3179e9);_0x479c00(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x5bb2('0x6')](e,emitEvent(event));}}module[_0x5bb2('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index b1c57d4..a30eef5 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 _0xec03=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','SmsQueue'];(function(_0x1f206b,_0x1ce82c){var _0x440e6a=function(_0x1b247e){while(--_0x1b247e){_0x1f206b['push'](_0x1f206b['shift']());}};_0x440e6a(++_0x1ce82c);}(_0xec03,0x96));var _0x3ec0=function(_0x5f22b4,_0x8b550e){_0x5f22b4=_0x5f22b4-0x0;var _0x3c0cc4=_0xec03[_0x5f22b4];return _0x3c0cc4;};'use strict';var _=require('lodash');var util=require(_0x3ec0('0x0'));var logger=require(_0x3ec0('0x1'))(_0x3ec0('0x2'));var moment=require(_0x3ec0('0x3'));var BPromise=require(_0x3ec0('0x4'));var rp=require(_0x3ec0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3ec0('0x6'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x3ec0('0x7')]=function(_0x48802b,_0x9a73eb){return _0x48802b[_0x3ec0('0x8')](_0x3ec0('0x9'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a13=['bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api'];(function(_0x4d7f3f,_0x4d2803){var _0x5d67cc=function(_0x2c37f4){while(--_0x2c37f4){_0x4d7f3f['push'](_0x4d7f3f['shift']());}};_0x5d67cc(++_0x4d2803);}(_0x6a13,0x6c));var _0x36a1=function(_0x3e1045,_0x20d7d6){_0x3e1045=_0x3e1045-0x0;var _0x29836f=_0x6a13[_0x3e1045];return _0x29836f;};'use strict';var _=require(_0x36a1('0x0'));var util=require(_0x36a1('0x1'));var logger=require(_0x36a1('0x2'))(_0x36a1('0x3'));var moment=require('moment');var BPromise=require(_0x36a1('0x4'));var rp=require(_0x36a1('0x5'));var fs=require('fs');var path=require(_0x36a1('0x6'));var rimraf=require(_0x36a1('0x7'));var config=require(_0x36a1('0x8'));var attributes=require(_0x36a1('0x9'));module[_0x36a1('0xa')]=function(_0x1eff4e,_0xd476e){return _0x1eff4e[_0x36a1('0xb')](_0x36a1('0xc'),attributes,{'tableName':_0x36a1('0xd'),'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 041746c..91072c3 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 _0x5284=['stringify','error','message','catch','GetSmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','SmsQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x16d2f9,_0x3acdcd){var _0x4d19d7=function(_0x248b02){while(--_0x248b02){_0x16d2f9['push'](_0x16d2f9['shift']());}};_0x4d19d7(++_0x3acdcd);}(_0x5284,0xd4));var _0x4528=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5284[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x4528('0x0'));var moment=require(_0x4528('0x1'));var BPromise=require(_0x4528('0x2'));var rs=require(_0x4528('0x3'));var fs=require('fs');var Redis=require(_0x4528('0x4'));var db=require(_0x4528('0x5'))['db'];var utils=require(_0x4528('0x6'));var logger=require('../../config/logger')(_0x4528('0x7'));var config=require('../../config/environment');var jayson=require(_0x4528('0x8'));var client=jayson[_0x4528('0x9')][_0x4528('0xa')]({'port':0x232a});config[_0x4528('0xb')]=_[_0x4528('0xc')](config['redis'],{'host':_0x4528('0xd'),'port':0x18eb});var socket=require(_0x4528('0xe'))(new Redis(config[_0x4528('0xb')]));require(_0x4528('0xf'))[_0x4528('0x10')](socket);function respondWithRpcPromise(_0x472104,_0x1ce701,_0x307852){return new BPromise(function(_0x3dc618,_0xc15958){return client['request'](_0x472104,_0x307852)[_0x4528('0x11')](function(_0x268cd9){logger[_0x4528('0x12')](_0x4528('0x13'),_0x1ce701,_0x4528('0x14'));logger[_0x4528('0x15')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x1ce701,_0x4528('0x14'),JSON[_0x4528('0x16')](_0x268cd9));if(_0x268cd9['error']){if(_0x268cd9['error']['code']===0x1f4){logger[_0x4528('0x17')](_0x4528('0x13'),_0x1ce701,_0x268cd9[_0x4528('0x17')][_0x4528('0x18')]);return _0xc15958(_0x268cd9['error'][_0x4528('0x18')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x1ce701,_0x268cd9[_0x4528('0x17')][_0x4528('0x18')]);return _0x3dc618(_0x268cd9[_0x4528('0x17')]['message']);}else{logger[_0x4528('0x12')](_0x4528('0x13'),_0x1ce701,'request\x20sent');_0x3dc618(_0x268cd9['result'][_0x4528('0x18')]);}})[_0x4528('0x19')](function(_0x263310){logger['error']('SmsQueue,\x20%s,\x20%s',_0x1ce701,_0x263310);_0xc15958(_0x263310);});});}exports[_0x4528('0x1a')]=function(_0x2ea30d){var _0x52c795=this;return new Promise(function(_0x4dee69,_0x4e8099){return db['SmsQueue'][_0x4528('0x1b')]({'raw':_0x2ea30d[_0x4528('0x1c')]?_0x2ea30d[_0x4528('0x1c')][_0x4528('0x1d')]===undefined?!![]:![]:!![],'where':_0x2ea30d[_0x4528('0x1c')]?_0x2ea30d[_0x4528('0x1c')][_0x4528('0x1e')]||null:null,'attributes':_0x2ea30d[_0x4528('0x1c')]?_0x2ea30d[_0x4528('0x1c')][_0x4528('0x1f')]||null:null,'limit':_0x2ea30d['options']?_0x2ea30d[_0x4528('0x1c')][_0x4528('0x20')]||null:null,'include':_0x2ea30d[_0x4528('0x1c')]?_0x2ea30d[_0x4528('0x1c')][_0x4528('0x21')]?_[_0x4528('0x22')](_0x2ea30d[_0x4528('0x1c')]['include'],function(_0x56ff42){return{'model':db[_0x56ff42[_0x4528('0x23')]],'as':_0x56ff42['as'],'attributes':_0x56ff42[_0x4528('0x1f')],'include':_0x56ff42[_0x4528('0x21')]?_['map'](_0x56ff42[_0x4528('0x21')],function(_0xd18bf8){return{'model':db[_0xd18bf8[_0x4528('0x23')]],'as':_0xd18bf8['as'],'attributes':_0xd18bf8['attributes'],'include':_0xd18bf8[_0x4528('0x21')]?_[_0x4528('0x22')](_0xd18bf8[_0x4528('0x21')],function(_0x23df2b){return{'model':db[_0x23df2b[_0x4528('0x23')]],'as':_0x23df2b['as'],'attributes':_0x23df2b[_0x4528('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x593964){logger[_0x4528('0x12')](_0x4528('0x1a'),_0x2ea30d);logger[_0x4528('0x15')]('GetSmsQueue',_0x2ea30d,JSON[_0x4528('0x16')](_0x593964));_0x4dee69(_0x593964);})[_0x4528('0x19')](function(_0x32ed68){logger['error'](_0x4528('0x1a'),_0x32ed68[_0x4528('0x18')],_0x2ea30d);_0x4e8099(_0x52c795[_0x4528('0x17')](0x1f4,_0x32ed68[_0x4528('0x18')]));});});};exports[_0x4528('0x24')]=function(_0x46b79d){var _0x1c6913=this;return new Promise(function(_0x2475f9,_0x6ed383){return db[_0x4528('0x25')][_0x4528('0x26')]({'raw':_0x46b79d['options']?_0x46b79d[_0x4528('0x1c')][_0x4528('0x1d')]===undefined?!![]:![]:!![],'where':_0x46b79d[_0x4528('0x1c')]?_0x46b79d['options'][_0x4528('0x1e')]||null:null,'attributes':_0x46b79d[_0x4528('0x1c')]?_0x46b79d[_0x4528('0x1c')][_0x4528('0x1f')]||null:null,'include':_0x46b79d['options']?_0x46b79d[_0x4528('0x1c')][_0x4528('0x21')]?_[_0x4528('0x22')](_0x46b79d[_0x4528('0x1c')][_0x4528('0x21')],function(_0xae0cde){return{'model':db[_0xae0cde['model']],'as':_0xae0cde['as'],'attributes':_0xae0cde[_0x4528('0x1f')],'include':_0xae0cde[_0x4528('0x21')]?_[_0x4528('0x22')](_0xae0cde['include'],function(_0x5557e8){return{'model':db[_0x5557e8[_0x4528('0x23')]],'as':_0x5557e8['as'],'attributes':_0x5557e8[_0x4528('0x1f')],'include':_0x5557e8[_0x4528('0x21')]?_['map'](_0x5557e8[_0x4528('0x21')],function(_0x5ed164){return{'model':db[_0x5ed164[_0x4528('0x23')]],'as':_0x5ed164['as'],'attributes':_0x5ed164[_0x4528('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4528('0x11')](function(_0x2bb49a){logger['info'](_0x4528('0x24'),_0x46b79d);logger[_0x4528('0x15')](_0x4528('0x24'),_0x46b79d,JSON[_0x4528('0x16')](_0x2bb49a));_0x2475f9(_0x2bb49a);})[_0x4528('0x19')](function(_0x587e5c){logger['error'](_0x4528('0x24'),_0x587e5c[_0x4528('0x18')],_0x46b79d);_0x6ed383(_0x1c6913[_0x4528('0x17')](0x1f4,_0x587e5c['message']));});});}; \ No newline at end of file +var _0x4b31=['include','map','model','debug','ShowSmsQueue','lodash','moment','randomstring','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit'];(function(_0x400635,_0x49a764){var _0x5b0c61=function(_0x2cb18a){while(--_0x2cb18a){_0x400635['push'](_0x400635['shift']());}};_0x5b0c61(++_0x49a764);}(_0x4b31,0x1cc));var _0x14b3=function(_0x30f395,_0x3629b5){_0x30f395=_0x30f395-0x0;var _0x2ea0ee=_0x4b31[_0x30f395];return _0x2ea0ee;};'use strict';var _=require(_0x14b3('0x0'));var util=require('util');var moment=require(_0x14b3('0x1'));var BPromise=require('bluebird');var rs=require(_0x14b3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x14b3('0x3'))('rpc');var config=require(_0x14b3('0x4'));var jayson=require(_0x14b3('0x5'));var client=jayson[_0x14b3('0x6')]['http']({'port':0x232a});config[_0x14b3('0x7')]=_[_0x14b3('0x8')](config[_0x14b3('0x7')],{'host':_0x14b3('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x14b3('0xa'))[_0x14b3('0xb')](socket);function respondWithRpcPromise(_0x2b54da,_0x29524f,_0xe9c9c2){return new BPromise(function(_0x3ec4fe,_0x3f7994){return client[_0x14b3('0xc')](_0x2b54da,_0xe9c9c2)[_0x14b3('0xd')](function(_0xd77592){logger[_0x14b3('0xe')](_0x14b3('0xf'),_0x29524f,_0x14b3('0x10'));logger['debug'](_0x14b3('0x11'),_0x29524f,_0x14b3('0x10'),JSON[_0x14b3('0x12')](_0xd77592));if(_0xd77592[_0x14b3('0x13')]){if(_0xd77592[_0x14b3('0x13')]['code']===0x1f4){logger[_0x14b3('0x13')](_0x14b3('0xf'),_0x29524f,_0xd77592[_0x14b3('0x13')][_0x14b3('0x14')]);return _0x3f7994(_0xd77592[_0x14b3('0x13')]['message']);}logger[_0x14b3('0x13')](_0x14b3('0xf'),_0x29524f,_0xd77592[_0x14b3('0x13')][_0x14b3('0x14')]);return _0x3ec4fe(_0xd77592[_0x14b3('0x13')][_0x14b3('0x14')]);}else{logger[_0x14b3('0xe')](_0x14b3('0xf'),_0x29524f,_0x14b3('0x10'));_0x3ec4fe(_0xd77592[_0x14b3('0x15')][_0x14b3('0x14')]);}})[_0x14b3('0x16')](function(_0x109f84){logger[_0x14b3('0x13')](_0x14b3('0xf'),_0x29524f,_0x109f84);_0x3f7994(_0x109f84);});});}exports[_0x14b3('0x17')]=function(_0x2556a5){var _0x270631=this;return new Promise(function(_0x3d8176,_0x18fbeb){return db[_0x14b3('0x18')]['findAll']({'raw':_0x2556a5[_0x14b3('0x19')]?_0x2556a5['options'][_0x14b3('0x1a')]===undefined?!![]:![]:!![],'where':_0x2556a5['options']?_0x2556a5[_0x14b3('0x19')][_0x14b3('0x1b')]||null:null,'attributes':_0x2556a5['options']?_0x2556a5['options'][_0x14b3('0x1c')]||null:null,'limit':_0x2556a5[_0x14b3('0x19')]?_0x2556a5['options'][_0x14b3('0x1d')]||null:null,'include':_0x2556a5['options']?_0x2556a5['options'][_0x14b3('0x1e')]?_[_0x14b3('0x1f')](_0x2556a5['options']['include'],function(_0x53539b){return{'model':db[_0x53539b[_0x14b3('0x20')]],'as':_0x53539b['as'],'attributes':_0x53539b[_0x14b3('0x1c')],'include':_0x53539b[_0x14b3('0x1e')]?_[_0x14b3('0x1f')](_0x53539b[_0x14b3('0x1e')],function(_0x188d93){return{'model':db[_0x188d93[_0x14b3('0x20')]],'as':_0x188d93['as'],'attributes':_0x188d93[_0x14b3('0x1c')],'include':_0x188d93[_0x14b3('0x1e')]?_[_0x14b3('0x1f')](_0x188d93[_0x14b3('0x1e')],function(_0x3580d5){return{'model':db[_0x3580d5[_0x14b3('0x20')]],'as':_0x3580d5['as'],'attributes':_0x3580d5[_0x14b3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x14b3('0xd')](function(_0x411229){logger[_0x14b3('0xe')](_0x14b3('0x17'),_0x2556a5);logger[_0x14b3('0x21')](_0x14b3('0x17'),_0x2556a5,JSON[_0x14b3('0x12')](_0x411229));_0x3d8176(_0x411229);})['catch'](function(_0x2691b8){logger[_0x14b3('0x13')](_0x14b3('0x17'),_0x2691b8[_0x14b3('0x14')],_0x2556a5);_0x18fbeb(_0x270631[_0x14b3('0x13')](0x1f4,_0x2691b8[_0x14b3('0x14')]));});});};exports['ShowSmsQueue']=function(_0xad7496){var _0x37936d=this;return new Promise(function(_0x394a98,_0x4704ef){return db[_0x14b3('0x18')]['find']({'raw':_0xad7496[_0x14b3('0x19')]?_0xad7496[_0x14b3('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xad7496[_0x14b3('0x19')]?_0xad7496['options'][_0x14b3('0x1b')]||null:null,'attributes':_0xad7496[_0x14b3('0x19')]?_0xad7496[_0x14b3('0x19')]['attributes']||null:null,'include':_0xad7496[_0x14b3('0x19')]?_0xad7496[_0x14b3('0x19')][_0x14b3('0x1e')]?_[_0x14b3('0x1f')](_0xad7496[_0x14b3('0x19')][_0x14b3('0x1e')],function(_0x43cfe3){return{'model':db[_0x43cfe3[_0x14b3('0x20')]],'as':_0x43cfe3['as'],'attributes':_0x43cfe3['attributes'],'include':_0x43cfe3[_0x14b3('0x1e')]?_['map'](_0x43cfe3['include'],function(_0x4c392e){return{'model':db[_0x4c392e[_0x14b3('0x20')]],'as':_0x4c392e['as'],'attributes':_0x4c392e['attributes'],'include':_0x4c392e[_0x14b3('0x1e')]?_[_0x14b3('0x1f')](_0x4c392e[_0x14b3('0x1e')],function(_0x5baf70){return{'model':db[_0x5baf70[_0x14b3('0x20')]],'as':_0x5baf70['as'],'attributes':_0x5baf70['attributes']};}):[]};}):[]};}):[]:[]})[_0x14b3('0xd')](function(_0x44fe1c){logger[_0x14b3('0xe')]('ShowSmsQueue',_0xad7496);logger['debug'](_0x14b3('0x22'),_0xad7496,JSON[_0x14b3('0x12')](_0x44fe1c));_0x394a98(_0x44fe1c);})[_0x14b3('0x16')](function(_0x21e3c1){logger[_0x14b3('0x13')](_0x14b3('0x22'),_0x21e3c1[_0x14b3('0x14')],_0xad7496);_0x4704ef(_0x37936d[_0x14b3('0x13')](0x1f4,_0x21e3c1[_0x14b3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index f090ef1..53e7c7d 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 _0x9db9=['remove','emit','removeListener','length','smsQueue:','save'];(function(_0x3a08e3,_0x6812cb){var _0xb2d69e=function(_0x3a5902){while(--_0x3a5902){_0x3a08e3['push'](_0x3a08e3['shift']());}};_0xb2d69e(++_0x6812cb);}(_0x9db9,0xb9));var _0x99db=function(_0x2d21b9,_0x36534f){_0x2d21b9=_0x2d21b9-0x0;var _0x28e1cc=_0x9db9[_0x2d21b9];return _0x28e1cc;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x99db('0x0'),_0x99db('0x1'),'update'];function createListener(_0x4d1a38,_0x1200dd){return function(_0x5f0fa9){_0x1200dd[_0x99db('0x2')](_0x4d1a38,_0x5f0fa9);};}function removeListener(_0x150785,_0x2cf53c){return function(){SmsQueueEvents[_0x99db('0x3')](_0x150785,_0x2cf53c);};}exports['register']=function(_0x4b45cd){for(var _0x37ff82=0x0,_0x209516=events[_0x99db('0x4')];_0x37ff82<_0x209516;_0x37ff82++){var _0x73e8a5=events[_0x37ff82];var _0x2d1a00=createListener(_0x99db('0x5')+_0x73e8a5,_0x4b45cd);SmsQueueEvents['on'](_0x73e8a5,_0x2d1a00);}}; \ No newline at end of file +var _0x2b34=['save','remove','emit','register','smsQueue:'];(function(_0x2f4d7f,_0x62f4b7){var _0x147ba1=function(_0x14ef36){while(--_0x14ef36){_0x2f4d7f['push'](_0x2f4d7f['shift']());}};_0x147ba1(++_0x62f4b7);}(_0x2b34,0x19f));var _0x42b3=function(_0x3046da,_0x599123){_0x3046da=_0x3046da-0x0;var _0x467db2=_0x2b34[_0x3046da];return _0x467db2;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x42b3('0x0'),_0x42b3('0x1'),'update'];function createListener(_0x2514d3,_0x565709){return function(_0x4e65fb){_0x565709[_0x42b3('0x2')](_0x2514d3,_0x4e65fb);};}function removeListener(_0x4c7e3b,_0x6a31b){return function(){SmsQueueEvents['removeListener'](_0x4c7e3b,_0x6a31b);};}exports[_0x42b3('0x3')]=function(_0x34c1d2){for(var _0x3ced43=0x0,_0x461393=events['length'];_0x3ced43<_0x461393;_0x3ced43++){var _0x1fcbee=events[_0x3ced43];var _0x23e46b=createListener(_0x42b3('0x4')+_0x1fcbee,_0x34c1d2);SmsQueueEvents['on'](_0x1fcbee,_0x23e46b);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index d137b3b..6544555 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 _0xf3be=['destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x25050d,_0x97fe3){var _0x34dfd2=function(_0x58821e){while(--_0x58821e){_0x25050d['push'](_0x25050d['shift']());}};_0x34dfd2(++_0x97fe3);}(_0xf3be,0x191));var _0xef3b=function(_0x38c14f,_0x535115){_0x38c14f=_0x38c14f-0x0;var _0x954007=_0xf3be[_0x38c14f];return _0x954007;};'use strict';var multer=require(_0xef3b('0x0'));var util=require(_0xef3b('0x1'));var path=require('path');var timeout=require(_0xef3b('0x2'));var express=require(_0xef3b('0x3'));var router=express[_0xef3b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xef3b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xef3b('0x6'));var controller=require(_0xef3b('0x7'));router[_0xef3b('0x8')]('/',auth[_0xef3b('0x9')](),controller[_0xef3b('0xa')]);router[_0xef3b('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xef3b('0xb')]);router[_0xef3b('0x8')](_0xef3b('0xc'),auth[_0xef3b('0x9')](),controller[_0xef3b('0xd')]);router[_0xef3b('0xe')]('/',auth[_0xef3b('0x9')](),controller[_0xef3b('0xf')]);router[_0xef3b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xef3b('0x11')]);router[_0xef3b('0x12')](_0xef3b('0xc'),auth['isAuthenticated'](),controller[_0xef3b('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe643=['get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x150469,_0x5ec8a2){var _0x110773=function(_0x3c8448){while(--_0x3c8448){_0x150469['push'](_0x150469['shift']());}};_0x110773(++_0x5ec8a2);}(_0xe643,0x84));var _0x3e64=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe643[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x3e64('0x0'));var util=require(_0x3e64('0x1'));var path=require('path');var timeout=require(_0x3e64('0x2'));var express=require('express');var router=express[_0x3e64('0x3')]();var fs_extra=require(_0x3e64('0x4'));var auth=require(_0x3e64('0x5'));var interaction=require(_0x3e64('0x6'));var config=require(_0x3e64('0x7'));var controller=require('./smsQueueReport.controller');router[_0x3e64('0x8')]('/',auth[_0x3e64('0x9')](),controller[_0x3e64('0xa')]);router[_0x3e64('0x8')](_0x3e64('0xb'),auth[_0x3e64('0x9')](),controller['describe']);router[_0x3e64('0x8')](_0x3e64('0xc'),auth[_0x3e64('0x9')](),controller[_0x3e64('0xd')]);router[_0x3e64('0xe')]('/',auth[_0x3e64('0x9')](),controller[_0x3e64('0xf')]);router[_0x3e64('0x10')](_0x3e64('0xc'),auth[_0x3e64('0x9')](),controller['update']);router[_0x3e64('0x11')](_0x3e64('0xc'),auth[_0x3e64('0x9')](),controller[_0x3e64('0x12')]);module[_0x3e64('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 419ffd7..14ade00 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 _0x11f4=['DATE','moment','sequelize','exports','STRING'];(function(_0x4edb2c,_0x15d29d){var _0xdc6421=function(_0x4d812a){while(--_0x4d812a){_0x4edb2c['push'](_0x4edb2c['shift']());}};_0xdc6421(++_0x15d29d);}(_0x11f4,0xc9));var _0x411f=function(_0x1c384f,_0x5c4bbe){_0x1c384f=_0x1c384f-0x0;var _0x4976f1=_0x11f4[_0x1c384f];return _0x4976f1;};'use strict';var moment=require(_0x411f('0x0'));var Sequelize=require(_0x411f('0x1'));module[_0x411f('0x2')]={'uniqueid':{'type':Sequelize[_0x411f('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x411f('0x3')]},'joinAt':{'type':Sequelize[_0x411f('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x411f('0x4')]},'exitAt':{'type':Sequelize[_0x411f('0x4')]},'reason':{'type':Sequelize[_0x411f('0x3')]}}; \ No newline at end of file +var _0x9e92=['DATE','moment','sequelize','exports','STRING'];(function(_0x2b0020,_0x1f6934){var _0x45894a=function(_0x457a83){while(--_0x457a83){_0x2b0020['push'](_0x2b0020['shift']());}};_0x45894a(++_0x1f6934);}(_0x9e92,0xd3));var _0x29e9=function(_0x42b8d4,_0x419917){_0x42b8d4=_0x42b8d4-0x0;var _0x5593d2=_0x9e92[_0x42b8d4];return _0x5593d2;};'use strict';var moment=require(_0x29e9('0x0'));var Sequelize=require(_0x29e9('0x1'));module[_0x29e9('0x2')]={'uniqueid':{'type':Sequelize[_0x29e9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x29e9('0x3')]},'joinAt':{'type':Sequelize[_0x29e9('0x4')]},'leaveAt':{'type':Sequelize[_0x29e9('0x4')]},'acceptAt':{'type':Sequelize[_0x29e9('0x4')]},'exitAt':{'type':Sequelize[_0x29e9('0x4')]},'reason':{'type':Sequelize[_0x29e9('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 2d888b1..72708be 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 _0x38b8=['contact','message','agent','interaction','account','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','create','catch','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','save','update','then','sendStatus','error','send','render','merge','body'];(function(_0x1ca122,_0x5cab7c){var _0x50d1ba=function(_0x562ae9){while(--_0x562ae9){_0x1ca122['push'](_0x1ca122['shift']());}};_0x50d1ba(++_0x5cab7c);}(_0x38b8,0x7b));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x838b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x838b('0x1'));var moment=require(_0x838b('0x2'));var BPromise=require(_0x838b('0x3'));var Mustache=require(_0x838b('0x4'));var util=require(_0x838b('0x5'));var path=require(_0x838b('0x6'));var sox=require('sox');var csv=require(_0x838b('0x7'));var ejs=require(_0x838b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x838b('0x9'));var squel=require(_0x838b('0xa'));var crypto=require(_0x838b('0xb'));var jsforce=require(_0x838b('0xc'));var deskjs=require(_0x838b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x838b('0xe'));var Papa=require(_0x838b('0xf'));var Redis=require(_0x838b('0x10'));var authService=require(_0x838b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x838b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x838b('0x13'))(_0x838b('0x14'));var utils=require(_0x838b('0x15'));var config=require(_0x838b('0x16'));var licenseUtil=require(_0x838b('0x17'));var db=require(_0x838b('0x18'))['db'];function respondWithStatusCode(_0x53b59d,_0x3fbff9){_0x3fbff9=_0x3fbff9||0xcc;return function(_0x38f4e4){if(_0x38f4e4){return _0x53b59d['sendStatus'](_0x3fbff9);}return _0x53b59d[_0x838b('0x19')](_0x3fbff9)[_0x838b('0x1a')]();};}function respondWithResult(_0x311b2f,_0x211dc4){_0x211dc4=_0x211dc4||0xc8;return function(_0x5aed4a){if(_0x5aed4a){return _0x311b2f[_0x838b('0x19')](_0x211dc4)[_0x838b('0x1b')](_0x5aed4a);}};}function respondWithFilteredResult(_0x124bcd,_0x42fe22){return function(_0x4bb68d){if(_0x4bb68d){var _0xd8cba8=typeof _0x42fe22['offset']===_0x838b('0x1c')&&typeof _0x42fe22['limit']===_0x838b('0x1c');var _0x5d6760=_0x4bb68d[_0x838b('0x1d')];var _0x404894=_0xd8cba8?0x0:_0x42fe22[_0x838b('0x1e')];var _0x30038d=_0xd8cba8?_0x4bb68d['count']:_0x42fe22[_0x838b('0x1e')]+_0x42fe22[_0x838b('0x1f')];var _0x286747;if(_0x30038d>=_0x5d6760){_0x30038d=_0x5d6760;_0x286747=0xc8;}else{_0x286747=0xce;}_0x124bcd[_0x838b('0x19')](_0x286747);return _0x124bcd[_0x838b('0x20')](_0x838b('0x21'),_0x404894+'-'+_0x30038d+'/'+_0x5d6760)[_0x838b('0x1b')](_0x4bb68d);}return null;};}function patchUpdates(_0x5a2605){return function(_0xefc14f){try{jsonpatch['apply'](_0xefc14f,_0x5a2605,!![]);}catch(_0x5b0239){return BPromise['reject'](_0x5b0239);}return _0xefc14f[_0x838b('0x22')]();};}function saveUpdates(_0x256de0,_0x4b439b){return function(_0x5cccdb){if(_0x5cccdb){return _0x5cccdb[_0x838b('0x23')](_0x256de0)[_0x838b('0x24')](function(_0x53365a){return _0x53365a;});}return null;};}function removeEntity(_0x5c081f,_0xd1208b){return function(_0xe97ddf){if(_0xe97ddf){return _0xe97ddf['destroy']()[_0x838b('0x24')](function(){_0x5c081f[_0x838b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f6e46,_0x5a8ad2){return function(_0x4e5421){if(!_0x4e5421){_0x3f6e46[_0x838b('0x25')](0x194);}return _0x4e5421;};}function handleError(_0x50ab88,_0x3d9754){_0x3d9754=_0x3d9754||0x1f4;return function(_0x287f4a){logger[_0x838b('0x26')](_0x287f4a['stack']);if(_0x287f4a['name']){delete _0x287f4a['name'];}_0x50ab88[_0x838b('0x19')](_0x3d9754)[_0x838b('0x27')](_0x287f4a);};}function getMustacheRender(_0x2b57dc,_0x3c2978){return Mustache[_0x838b('0x28')](_0x2b57dc,_[_0x838b('0x29')](_0x3c2978[_0x838b('0x2a')],{'contact':_0x3c2978[_0x838b('0x2b')],'message':_0x3c2978[_0x838b('0x2c')],'agent':_0x3c2978[_0x838b('0x2d')],'interaction':_0x3c2978[_0x838b('0x2e')],'account':_0x3c2978[_0x838b('0x2f')]}))||'';}exports[_0x838b('0x30')]=function(_0x48fb92,_0x312252){var _0x41b4ee={},_0x380f60={},_0x1392c9={'count':0x0,'rows':[]};var _0x2329ff=_[_0x838b('0x31')](db[_0x838b('0x32')][_0x838b('0x33')],function(_0x5324d2){return{'name':_0x5324d2[_0x838b('0x34')],'type':_0x5324d2[_0x838b('0x35')][_0x838b('0x36')]};});_0x380f60[_0x838b('0x37')]=_['map'](_0x2329ff,_0x838b('0x38'));_0x380f60['query']=_['keys'](_0x48fb92[_0x838b('0x39')]);_0x380f60[_0x838b('0x3a')]=_['intersection'](_0x380f60[_0x838b('0x37')],_0x380f60[_0x838b('0x39')]);_0x41b4ee[_0x838b('0x3b')]=_[_0x838b('0x3c')](_0x380f60[_0x838b('0x37')],qs[_0x838b('0x3d')](_0x48fb92[_0x838b('0x39')]['fields']));_0x41b4ee[_0x838b('0x3b')]=_0x41b4ee[_0x838b('0x3b')][_0x838b('0x3e')]?_0x41b4ee[_0x838b('0x3b')]:_0x380f60[_0x838b('0x37')];if(!_0x48fb92['query'][_0x838b('0x3f')](_0x838b('0x40'))){_0x41b4ee[_0x838b('0x1f')]=qs['limit'](_0x48fb92[_0x838b('0x39')][_0x838b('0x1f')]);_0x41b4ee[_0x838b('0x1e')]=qs[_0x838b('0x1e')](_0x48fb92[_0x838b('0x39')]['offset']);}_0x41b4ee[_0x838b('0x41')]=qs[_0x838b('0x42')](_0x48fb92[_0x838b('0x39')][_0x838b('0x42')]);_0x41b4ee[_0x838b('0x43')]=qs[_0x838b('0x3a')](_[_0x838b('0x44')](_0x48fb92['query'],_0x380f60['filters']),_0x2329ff);if(_0x48fb92[_0x838b('0x39')]['filter']){_0x41b4ee['where']=_[_0x838b('0x29')](_0x41b4ee[_0x838b('0x43')],{'$or':_['map'](_0x2329ff,function(_0x297def){if(_0x297def[_0x838b('0x35')]!==_0x838b('0x45')){var _0x5c738e={};_0x5c738e[_0x297def[_0x838b('0x38')]]={'$like':'%'+_0x48fb92[_0x838b('0x39')][_0x838b('0x46')]+'%'};return _0x5c738e;}})});}_0x41b4ee=_[_0x838b('0x29')]({},_0x41b4ee,_0x48fb92[_0x838b('0x47')]);var _0x2378b6={'where':_0x41b4ee['where']};return db['SmsQueueReport'][_0x838b('0x1d')](_0x2378b6)[_0x838b('0x24')](function(_0x4628fd){_0x1392c9[_0x838b('0x1d')]=_0x4628fd;if(_0x48fb92[_0x838b('0x39')][_0x838b('0x48')]){_0x41b4ee[_0x838b('0x49')]=[{'all':!![]}];}return db[_0x838b('0x32')][_0x838b('0x4a')](_0x41b4ee);})['then'](function(_0x40c7c3){_0x1392c9[_0x838b('0x4b')]=_0x40c7c3;return _0x1392c9;})[_0x838b('0x24')](respondWithFilteredResult(_0x312252,_0x41b4ee))['catch'](handleError(_0x312252,null));};exports[_0x838b('0x4c')]=function(_0x52c30a,_0x295d87){var _0x299a58={'raw':!![],'where':{'id':_0x52c30a[_0x838b('0x4d')]['id']}},_0x27efac={};_0x27efac[_0x838b('0x37')]=_['keys'](db[_0x838b('0x32')][_0x838b('0x33')]);_0x27efac['query']=_[_0x838b('0x4e')](_0x52c30a['query']);_0x27efac['filters']=_[_0x838b('0x3c')](_0x27efac[_0x838b('0x37')],_0x27efac['query']);_0x299a58[_0x838b('0x3b')]=_[_0x838b('0x3c')](_0x27efac['model'],qs[_0x838b('0x3d')](_0x52c30a[_0x838b('0x39')][_0x838b('0x3d')]));_0x299a58[_0x838b('0x3b')]=_0x299a58[_0x838b('0x3b')][_0x838b('0x3e')]?_0x299a58[_0x838b('0x3b')]:_0x27efac[_0x838b('0x37')];if(_0x52c30a[_0x838b('0x39')][_0x838b('0x48')]){_0x299a58[_0x838b('0x49')]=[{'all':!![]}];}_0x299a58=_['merge']({},_0x299a58,_0x52c30a[_0x838b('0x47')]);return db[_0x838b('0x32')][_0x838b('0x4f')](_0x299a58)[_0x838b('0x24')](handleEntityNotFound(_0x295d87,null))[_0x838b('0x24')](respondWithResult(_0x295d87,null))['catch'](handleError(_0x295d87,null));};exports[_0x838b('0x50')]=function(_0x312f45,_0x3f293b){return db[_0x838b('0x32')][_0x838b('0x50')](_0x312f45[_0x838b('0x2a')],{})['then'](respondWithResult(_0x3f293b,0xc9))['catch'](handleError(_0x3f293b,null));};exports[_0x838b('0x23')]=function(_0x56247d,_0x51fabe){if(_0x56247d[_0x838b('0x2a')]['id']){delete _0x56247d[_0x838b('0x2a')]['id'];}return db[_0x838b('0x32')][_0x838b('0x4f')]({'where':{'id':_0x56247d[_0x838b('0x4d')]['id']}})[_0x838b('0x24')](handleEntityNotFound(_0x51fabe,null))['then'](saveUpdates(_0x56247d[_0x838b('0x2a')],null))['then'](respondWithResult(_0x51fabe,null))[_0x838b('0x51')](handleError(_0x51fabe,null));};exports['destroy']=function(_0x3a855b,_0x3a829c){return db[_0x838b('0x32')][_0x838b('0x4f')]({'where':{'id':_0x3a855b[_0x838b('0x4d')]['id']}})[_0x838b('0x24')](handleEntityNotFound(_0x3a829c,null))['then'](removeEntity(_0x3a829c,null))[_0x838b('0x51')](handleError(_0x3a829c,null));};exports[_0x838b('0x52')]=function(_0x10c828,_0x323d4a){return db[_0x838b('0x32')]['describe']()[_0x838b('0x24')](respondWithResult(_0x323d4a,null))['catch'](handleError(_0x323d4a,null));}; \ No newline at end of file +var _0xe432=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','then','destroy','status','error','stack','name','merge','body','contact','message','agent','interaction','account','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','options','SmsQueueReport','includeAll','findAll','rows','show','rawAttributes','find','catch','create','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x4144ef,_0x3ed22b){var _0x3691ba=function(_0x33b2df){while(--_0x33b2df){_0x4144ef['push'](_0x4144ef['shift']());}};_0x3691ba(++_0x3ed22b);}(_0xe432,0x91));var _0x2e43=function(_0x99f838,_0xe376e2){_0x99f838=_0x99f838-0x0;var _0x432cd7=_0xe432[_0x99f838];return _0x432cd7;};'use strict';var emlformat=require(_0x2e43('0x0'));var rimraf=require(_0x2e43('0x1'));var zipdir=require(_0x2e43('0x2'));var jsonpatch=require(_0x2e43('0x3'));var rp=require(_0x2e43('0x4'));var moment=require(_0x2e43('0x5'));var BPromise=require(_0x2e43('0x6'));var Mustache=require(_0x2e43('0x7'));var util=require(_0x2e43('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x2e43('0x9'));var ejs=require(_0x2e43('0xa'));var fs=require('fs');var fs_extra=require(_0x2e43('0xb'));var _=require(_0x2e43('0xc'));var squel=require(_0x2e43('0xd'));var crypto=require(_0x2e43('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2e43('0xf'));var toCsv=require(_0x2e43('0x9'));var querystring=require(_0x2e43('0x10'));var Papa=require(_0x2e43('0x11'));var Redis=require(_0x2e43('0x12'));var authService=require(_0x2e43('0x13'));var qs=require(_0x2e43('0x14'));var as=require(_0x2e43('0x15'));var hardwareService=require(_0x2e43('0x16'));var logger=require(_0x2e43('0x17'))(_0x2e43('0x18'));var utils=require(_0x2e43('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2e43('0x1a'))['db'];function respondWithStatusCode(_0x1788e9,_0x1a4f8f){_0x1a4f8f=_0x1a4f8f||0xcc;return function(_0x57077e){if(_0x57077e){return _0x1788e9[_0x2e43('0x1b')](_0x1a4f8f);}return _0x1788e9['status'](_0x1a4f8f)[_0x2e43('0x1c')]();};}function respondWithResult(_0x4c1560,_0x181d83){_0x181d83=_0x181d83||0xc8;return function(_0x91e89f){if(_0x91e89f){return _0x4c1560['status'](_0x181d83)[_0x2e43('0x1d')](_0x91e89f);}};}function respondWithFilteredResult(_0x516362,_0x16b30e){return function(_0x48a6ca){if(_0x48a6ca){var _0x4d0b1d=typeof _0x16b30e['offset']===_0x2e43('0x1e')&&typeof _0x16b30e['limit']==='undefined';var _0x402265=_0x48a6ca[_0x2e43('0x1f')];var _0x4704c9=_0x4d0b1d?0x0:_0x16b30e['offset'];var _0x3e7c2f=_0x4d0b1d?_0x48a6ca[_0x2e43('0x1f')]:_0x16b30e[_0x2e43('0x20')]+_0x16b30e[_0x2e43('0x21')];var _0x3148fe;if(_0x3e7c2f>=_0x402265){_0x3e7c2f=_0x402265;_0x3148fe=0xc8;}else{_0x3148fe=0xce;}_0x516362['status'](_0x3148fe);return _0x516362[_0x2e43('0x22')](_0x2e43('0x23'),_0x4704c9+'-'+_0x3e7c2f+'/'+_0x402265)[_0x2e43('0x1d')](_0x48a6ca);}return null;};}function patchUpdates(_0x5d2d69){return function(_0x105d05){try{jsonpatch[_0x2e43('0x24')](_0x105d05,_0x5d2d69,!![]);}catch(_0x51c8a5){return BPromise['reject'](_0x51c8a5);}return _0x105d05[_0x2e43('0x25')]();};}function saveUpdates(_0x19e41c,_0x4a1ab8){return function(_0x1d91a4){if(_0x1d91a4){return _0x1d91a4['update'](_0x19e41c)[_0x2e43('0x26')](function(_0x1b0c8d){return _0x1b0c8d;});}return null;};}function removeEntity(_0x302989,_0x526df4){return function(_0x34674a){if(_0x34674a){return _0x34674a[_0x2e43('0x27')]()[_0x2e43('0x26')](function(){_0x302989[_0x2e43('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x447d59,_0x8c5ad){return function(_0x3c41cd){if(!_0x3c41cd){_0x447d59[_0x2e43('0x1b')](0x194);}return _0x3c41cd;};}function handleError(_0xaf0ec6,_0x1aa658){_0x1aa658=_0x1aa658||0x1f4;return function(_0x90d9fd){logger[_0x2e43('0x29')](_0x90d9fd[_0x2e43('0x2a')]);if(_0x90d9fd['name']){delete _0x90d9fd[_0x2e43('0x2b')];}_0xaf0ec6[_0x2e43('0x28')](_0x1aa658)['send'](_0x90d9fd);};}function getMustacheRender(_0x2a5eac,_0x53fd79){return Mustache['render'](_0x2a5eac,_[_0x2e43('0x2c')](_0x53fd79[_0x2e43('0x2d')],{'contact':_0x53fd79[_0x2e43('0x2e')],'message':_0x53fd79[_0x2e43('0x2f')],'agent':_0x53fd79[_0x2e43('0x30')],'interaction':_0x53fd79[_0x2e43('0x31')],'account':_0x53fd79[_0x2e43('0x32')]}))||'';}exports['index']=function(_0x253fa5,_0x3867c9){var _0x4d2306={},_0x4d7f4c={},_0x46b6aa={'count':0x0,'rows':[]};var _0x5569a1=_['map'](db['SmsQueueReport']['rawAttributes'],function(_0x4f4b0c){return{'name':_0x4f4b0c[_0x2e43('0x33')],'type':_0x4f4b0c['type'][_0x2e43('0x34')]};});_0x4d7f4c[_0x2e43('0x35')]=_['map'](_0x5569a1,_0x2e43('0x2b'));_0x4d7f4c['query']=_[_0x2e43('0x36')](_0x253fa5[_0x2e43('0x37')]);_0x4d7f4c[_0x2e43('0x38')]=_[_0x2e43('0x39')](_0x4d7f4c[_0x2e43('0x35')],_0x4d7f4c['query']);_0x4d2306[_0x2e43('0x3a')]=_[_0x2e43('0x39')](_0x4d7f4c['model'],qs[_0x2e43('0x3b')](_0x253fa5['query'][_0x2e43('0x3b')]));_0x4d2306[_0x2e43('0x3a')]=_0x4d2306[_0x2e43('0x3a')]['length']?_0x4d2306[_0x2e43('0x3a')]:_0x4d7f4c[_0x2e43('0x35')];if(!_0x253fa5[_0x2e43('0x37')][_0x2e43('0x3c')](_0x2e43('0x3d'))){_0x4d2306[_0x2e43('0x21')]=qs[_0x2e43('0x21')](_0x253fa5[_0x2e43('0x37')][_0x2e43('0x21')]);_0x4d2306['offset']=qs['offset'](_0x253fa5[_0x2e43('0x37')][_0x2e43('0x20')]);}_0x4d2306[_0x2e43('0x3e')]=qs[_0x2e43('0x3f')](_0x253fa5['query'][_0x2e43('0x3f')]);_0x4d2306[_0x2e43('0x40')]=qs[_0x2e43('0x38')](_[_0x2e43('0x41')](_0x253fa5['query'],_0x4d7f4c['filters']),_0x5569a1);if(_0x253fa5[_0x2e43('0x37')]['filter']){_0x4d2306[_0x2e43('0x40')]=_[_0x2e43('0x2c')](_0x4d2306[_0x2e43('0x40')],{'$or':_[_0x2e43('0x42')](_0x5569a1,function(_0x748496){if(_0x748496['type']!==_0x2e43('0x43')){var _0x213f0f={};_0x213f0f[_0x748496[_0x2e43('0x2b')]]={'$like':'%'+_0x253fa5[_0x2e43('0x37')][_0x2e43('0x44')]+'%'};return _0x213f0f;}})});}_0x4d2306=_[_0x2e43('0x2c')]({},_0x4d2306,_0x253fa5[_0x2e43('0x45')]);var _0x58a50e={'where':_0x4d2306[_0x2e43('0x40')]};return db[_0x2e43('0x46')][_0x2e43('0x1f')](_0x58a50e)[_0x2e43('0x26')](function(_0x2ae8aa){_0x46b6aa[_0x2e43('0x1f')]=_0x2ae8aa;if(_0x253fa5[_0x2e43('0x37')][_0x2e43('0x47')]){_0x4d2306['include']=[{'all':!![]}];}return db[_0x2e43('0x46')][_0x2e43('0x48')](_0x4d2306);})['then'](function(_0x517bf9){_0x46b6aa[_0x2e43('0x49')]=_0x517bf9;return _0x46b6aa;})['then'](respondWithFilteredResult(_0x3867c9,_0x4d2306))['catch'](handleError(_0x3867c9,null));};exports[_0x2e43('0x4a')]=function(_0xbb0875,_0x3179c8){var _0x29817a={'raw':!![],'where':{'id':_0xbb0875['params']['id']}},_0xba1bf3={};_0xba1bf3[_0x2e43('0x35')]=_['keys'](db['SmsQueueReport'][_0x2e43('0x4b')]);_0xba1bf3[_0x2e43('0x37')]=_[_0x2e43('0x36')](_0xbb0875['query']);_0xba1bf3[_0x2e43('0x38')]=_['intersection'](_0xba1bf3[_0x2e43('0x35')],_0xba1bf3['query']);_0x29817a[_0x2e43('0x3a')]=_[_0x2e43('0x39')](_0xba1bf3[_0x2e43('0x35')],qs[_0x2e43('0x3b')](_0xbb0875[_0x2e43('0x37')]['fields']));_0x29817a[_0x2e43('0x3a')]=_0x29817a['attributes']['length']?_0x29817a[_0x2e43('0x3a')]:_0xba1bf3[_0x2e43('0x35')];if(_0xbb0875['query'][_0x2e43('0x47')]){_0x29817a['include']=[{'all':!![]}];}_0x29817a=_[_0x2e43('0x2c')]({},_0x29817a,_0xbb0875[_0x2e43('0x45')]);return db[_0x2e43('0x46')][_0x2e43('0x4c')](_0x29817a)[_0x2e43('0x26')](handleEntityNotFound(_0x3179c8,null))['then'](respondWithResult(_0x3179c8,null))[_0x2e43('0x4d')](handleError(_0x3179c8,null));};exports[_0x2e43('0x4e')]=function(_0x467cdb,_0x29edd3){return db[_0x2e43('0x46')]['create'](_0x467cdb[_0x2e43('0x2d')],{})[_0x2e43('0x26')](respondWithResult(_0x29edd3,0xc9))[_0x2e43('0x4d')](handleError(_0x29edd3,null));};exports[_0x2e43('0x4f')]=function(_0x10597b,_0x17c3be){if(_0x10597b[_0x2e43('0x2d')]['id']){delete _0x10597b[_0x2e43('0x2d')]['id'];}return db[_0x2e43('0x46')]['find']({'where':{'id':_0x10597b[_0x2e43('0x50')]['id']}})[_0x2e43('0x26')](handleEntityNotFound(_0x17c3be,null))[_0x2e43('0x26')](saveUpdates(_0x10597b[_0x2e43('0x2d')],null))[_0x2e43('0x26')](respondWithResult(_0x17c3be,null))['catch'](handleError(_0x17c3be,null));};exports[_0x2e43('0x27')]=function(_0x199d23,_0x5be201){return db[_0x2e43('0x46')][_0x2e43('0x4c')]({'where':{'id':_0x199d23[_0x2e43('0x50')]['id']}})[_0x2e43('0x26')](handleEntityNotFound(_0x5be201,null))[_0x2e43('0x26')](removeEntity(_0x5be201,null))[_0x2e43('0x4d')](handleError(_0x5be201,null));};exports[_0x2e43('0x51')]=function(_0x5428c6,_0x42c9c7){return db['SmsQueueReport'][_0x2e43('0x51')]()['then'](respondWithResult(_0x42c9c7,null))[_0x2e43('0x4d')](handleError(_0x42c9c7,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index b1af3ab..ebbcbc7 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 _0xbefe=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','define','report_sms_queue','uniqueid'];(function(_0x4e026b,_0x475256){var _0x21b4f8=function(_0x481fcf){while(--_0x481fcf){_0x4e026b['push'](_0x4e026b['shift']());}};_0x21b4f8(++_0x475256);}(_0xbefe,0x168));var _0xebef=function(_0xef9f7f,_0x259a17){_0xef9f7f=_0xef9f7f-0x0;var _0x6ca606=_0xbefe[_0xef9f7f];return _0x6ca606;};'use strict';var _=require('lodash');var util=require(_0xebef('0x0'));var logger=require('../../config/logger')(_0xebef('0x1'));var moment=require(_0xebef('0x2'));var BPromise=require(_0xebef('0x3'));var rp=require(_0xebef('0x4'));var fs=require('fs');var path=require(_0xebef('0x5'));var rimraf=require(_0xebef('0x6'));var config=require(_0xebef('0x7'));var attributes=require(_0xebef('0x8'));module['exports']=function(_0x3fe404,_0x39de80){return _0x3fe404[_0xebef('0x9')]('SmsQueueReport',attributes,{'tableName':_0xebef('0xa'),'paranoid':![],'indexes':[{'name':_0xebef('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x92ba=['define','SmsQueueReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x25415d,_0x4e9bc9){var _0x1e3eb0=function(_0xb5971f){while(--_0xb5971f){_0x25415d['push'](_0x25415d['shift']());}};_0x1e3eb0(++_0x4e9bc9);}(_0x92ba,0x17c));var _0xa92b=function(_0x4f8688,_0x2cb391){_0x4f8688=_0x4f8688-0x0;var _0x4fb8d1=_0x92ba[_0x4f8688];return _0x4fb8d1;};'use strict';var _=require(_0xa92b('0x0'));var util=require(_0xa92b('0x1'));var logger=require('../../config/logger')(_0xa92b('0x2'));var moment=require(_0xa92b('0x3'));var BPromise=require(_0xa92b('0x4'));var rp=require(_0xa92b('0x5'));var fs=require('fs');var path=require(_0xa92b('0x6'));var rimraf=require('rimraf');var config=require(_0xa92b('0x7'));var attributes=require(_0xa92b('0x8'));module[_0xa92b('0x9')]=function(_0x3cf929,_0x56fb01){return _0x3cf929[_0xa92b('0xa')](_0xa92b('0xb'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0xa92b('0xc'),'fields':[_0xa92b('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 a4fd24a..f132b3d 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 _0x7ec4=['code','message','request\x20sent','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','update','where','attributes','limit','UpdateSmsQueueReport','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3e9249,_0x269d74){var _0x334d4c=function(_0x3b4042){while(--_0x3b4042){_0x3e9249['push'](_0x3e9249['shift']());}};_0x334d4c(++_0x269d74);}(_0x7ec4,0xf6));var _0x47ec=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7ec4[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x47ec('0x0'));var moment=require(_0x47ec('0x1'));var BPromise=require(_0x47ec('0x2'));var rs=require(_0x47ec('0x3'));var fs=require('fs');var Redis=require(_0x47ec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47ec('0x5'));var logger=require('../../config/logger')(_0x47ec('0x6'));var config=require(_0x47ec('0x7'));var jayson=require(_0x47ec('0x8'));var client=jayson[_0x47ec('0x9')][_0x47ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d37c5,_0x145670,_0x26623a){return new BPromise(function(_0x12d1e4,_0x51c870){return client['request'](_0x3d37c5,_0x26623a)[_0x47ec('0xb')](function(_0x5c06bc){logger[_0x47ec('0xc')](_0x47ec('0xd'),_0x145670,'request\x20sent');logger[_0x47ec('0xe')](_0x47ec('0xf'),_0x145670,'request\x20sent',JSON[_0x47ec('0x10')](_0x5c06bc));if(_0x5c06bc[_0x47ec('0x11')]){if(_0x5c06bc[_0x47ec('0x11')][_0x47ec('0x12')]===0x1f4){logger[_0x47ec('0x11')](_0x47ec('0xd'),_0x145670,_0x5c06bc['error'][_0x47ec('0x13')]);return _0x51c870(_0x5c06bc[_0x47ec('0x11')][_0x47ec('0x13')]);}logger['error'](_0x47ec('0xd'),_0x145670,_0x5c06bc[_0x47ec('0x11')][_0x47ec('0x13')]);return _0x12d1e4(_0x5c06bc['error'][_0x47ec('0x13')]);}else{logger[_0x47ec('0xc')](_0x47ec('0xd'),_0x145670,_0x47ec('0x14'));_0x12d1e4(_0x5c06bc[_0x47ec('0x15')]['message']);}})[_0x47ec('0x16')](function(_0x4741f7){logger[_0x47ec('0x11')](_0x47ec('0xd'),_0x145670,_0x4741f7);_0x51c870(_0x4741f7);});});}exports[_0x47ec('0x17')]=function(_0x3e86bb){var _0x1f9717=this;return new Promise(function(_0x2ff0c5,_0xb8de47){return db[_0x47ec('0x18')]['create'](_0x3e86bb[_0x47ec('0x19')],{'raw':_0x3e86bb['options']?_0x3e86bb[_0x47ec('0x1a')][_0x47ec('0x1b')]===undefined?!![]:![]:!![]})[_0x47ec('0xb')](function(_0x486964){logger[_0x47ec('0xc')]('CreateSmsQueueReport',_0x3e86bb);logger[_0x47ec('0xe')](_0x47ec('0x17'),_0x3e86bb,JSON[_0x47ec('0x10')](_0x486964));_0x2ff0c5(_0x486964);})[_0x47ec('0x16')](function(_0x2c08ca){logger[_0x47ec('0x11')](_0x47ec('0x17'),_0x2c08ca[_0x47ec('0x13')],_0x3e86bb);_0xb8de47(_0x1f9717[_0x47ec('0x11')](0x1f4,_0x2c08ca[_0x47ec('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0x2437a3){var _0x2d417d=this;return new Promise(function(_0x501f00,_0x42b7fb){return db[_0x47ec('0x18')][_0x47ec('0x1c')](_0x2437a3[_0x47ec('0x19')],{'raw':_0x2437a3[_0x47ec('0x1a')]?_0x2437a3[_0x47ec('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2437a3['options']?_0x2437a3['options'][_0x47ec('0x1d')]||null:null,'attributes':_0x2437a3[_0x47ec('0x1a')]?_0x2437a3['options'][_0x47ec('0x1e')]||null:null,'limit':_0x2437a3[_0x47ec('0x1a')]?_0x2437a3[_0x47ec('0x1a')][_0x47ec('0x1f')]||null:null})[_0x47ec('0xb')](function(_0x37e8f0){logger[_0x47ec('0xc')](_0x47ec('0x20'),_0x2437a3);logger[_0x47ec('0xe')](_0x47ec('0x20'),_0x2437a3,JSON[_0x47ec('0x10')](_0x37e8f0));_0x501f00(_0x37e8f0);})[_0x47ec('0x16')](function(_0x57d52a){logger[_0x47ec('0x11')]('UpdateSmsQueueReport',_0x57d52a[_0x47ec('0x13')],_0x2437a3);_0x42b7fb(_0x2d417d[_0x47ec('0x11')](0x1f4,_0x57d52a['message']));});});}; \ No newline at end of file +var _0x2809=['client','http','request','info','request\x20sent','debug','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','options','then','UpdateSmsQueueReport','SmsQueueReport','update','body','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xb2815f,_0x253f58){var _0x3ec930=function(_0x56b1ba){while(--_0x56b1ba){_0xb2815f['push'](_0xb2815f['shift']());}};_0x3ec930(++_0x253f58);}(_0x2809,0x1ec));var _0x9280=function(_0x23c2c3,_0x27ecc8){_0x23c2c3=_0x23c2c3-0x0;var _0x41e09f=_0x2809[_0x23c2c3];return _0x41e09f;};'use strict';var _=require(_0x9280('0x0'));var util=require(_0x9280('0x1'));var moment=require(_0x9280('0x2'));var BPromise=require(_0x9280('0x3'));var rs=require(_0x9280('0x4'));var fs=require('fs');var Redis=require(_0x9280('0x5'));var db=require(_0x9280('0x6'))['db'];var utils=require(_0x9280('0x7'));var logger=require(_0x9280('0x8'))(_0x9280('0x9'));var config=require(_0x9280('0xa'));var jayson=require(_0x9280('0xb'));var client=jayson[_0x9280('0xc')][_0x9280('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x141844,_0x23c832,_0x5d393d){return new BPromise(function(_0xd7b986,_0x1b448e){return client[_0x9280('0xe')](_0x141844,_0x5d393d)['then'](function(_0x42946b){logger[_0x9280('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x23c832,_0x9280('0x10'));logger[_0x9280('0x11')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x23c832,_0x9280('0x10'),JSON[_0x9280('0x12')](_0x42946b));if(_0x42946b['error']){if(_0x42946b[_0x9280('0x13')][_0x9280('0x14')]===0x1f4){logger['error'](_0x9280('0x15'),_0x23c832,_0x42946b['error']['message']);return _0x1b448e(_0x42946b['error'][_0x9280('0x16')]);}logger['error'](_0x9280('0x15'),_0x23c832,_0x42946b[_0x9280('0x13')][_0x9280('0x16')]);return _0xd7b986(_0x42946b[_0x9280('0x13')]['message']);}else{logger[_0x9280('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x23c832,'request\x20sent');_0xd7b986(_0x42946b[_0x9280('0x17')]['message']);}})[_0x9280('0x18')](function(_0x3b0f71){logger['error'](_0x9280('0x15'),_0x23c832,_0x3b0f71);_0x1b448e(_0x3b0f71);});});}exports[_0x9280('0x19')]=function(_0x614cab){var _0x2742c9=this;return new Promise(function(_0x10d724,_0x463bb5){return db['SmsQueueReport']['create'](_0x614cab['body'],{'raw':_0x614cab[_0x9280('0x1a')]?_0x614cab[_0x9280('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x9280('0x1b')](function(_0x34118a){logger[_0x9280('0xf')](_0x9280('0x19'),_0x614cab);logger[_0x9280('0x11')](_0x9280('0x19'),_0x614cab,JSON[_0x9280('0x12')](_0x34118a));_0x10d724(_0x34118a);})[_0x9280('0x18')](function(_0xea6510){logger[_0x9280('0x13')]('CreateSmsQueueReport',_0xea6510['message'],_0x614cab);_0x463bb5(_0x2742c9['error'](0x1f4,_0xea6510[_0x9280('0x16')]));});});};exports[_0x9280('0x1c')]=function(_0x2dd6ac){var _0x5a087d=this;return new Promise(function(_0x1efe71,_0x5d5592){return db[_0x9280('0x1d')][_0x9280('0x1e')](_0x2dd6ac[_0x9280('0x1f')],{'raw':_0x2dd6ac[_0x9280('0x1a')]?_0x2dd6ac['options'][_0x9280('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dd6ac[_0x9280('0x1a')]?_0x2dd6ac[_0x9280('0x1a')][_0x9280('0x21')]||null:null,'attributes':_0x2dd6ac['options']?_0x2dd6ac[_0x9280('0x1a')][_0x9280('0x22')]||null:null,'limit':_0x2dd6ac['options']?_0x2dd6ac['options'][_0x9280('0x23')]||null:null})['then'](function(_0x1d0384){logger[_0x9280('0xf')](_0x9280('0x1c'),_0x2dd6ac);logger[_0x9280('0x11')]('UpdateSmsQueueReport',_0x2dd6ac,JSON[_0x9280('0x12')](_0x1d0384));_0x1efe71(_0x1d0384);})[_0x9280('0x18')](function(_0x460e8d){logger[_0x9280('0x13')](_0x9280('0x1c'),_0x460e8d['message'],_0x2dd6ac);_0x5d5592(_0x5a087d[_0x9280('0x13')](0x1f4,_0x460e8d[_0x9280('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 00fcc1a..d5e47b6 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 _0xe439=['get','/describe','describe','show','create','put','/:id','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index'];(function(_0xce692e,_0x4b153d){var _0x2077b4=function(_0x431030){while(--_0x431030){_0xce692e['push'](_0xce692e['shift']());}};_0x2077b4(++_0x4b153d);}(_0xe439,0x1d5));var _0x9e43=function(_0x7c9bcc,_0x14eca7){_0x7c9bcc=_0x7c9bcc-0x0;var _0x50d871=_0xe439[_0x7c9bcc];return _0x50d871;};'use strict';var multer=require(_0x9e43('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9e43('0x1'));var express=require(_0x9e43('0x2'));var router=express[_0x9e43('0x3')]();var fs_extra=require(_0x9e43('0x4'));var auth=require(_0x9e43('0x5'));var interaction=require(_0x9e43('0x6'));var config=require(_0x9e43('0x7'));var controller=require(_0x9e43('0x8'));router['get']('/',auth[_0x9e43('0x9')](),controller[_0x9e43('0xa')]);router[_0x9e43('0xb')](_0x9e43('0xc'),auth[_0x9e43('0x9')](),controller[_0x9e43('0xd')]);router[_0x9e43('0xb')]('/:id',auth[_0x9e43('0x9')](),controller[_0x9e43('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9e43('0xf')]);router[_0x9e43('0x10')](_0x9e43('0x11'),auth[_0x9e43('0x9')](),controller[_0x9e43('0x12')]);router['delete'](_0x9e43('0x11'),auth[_0x9e43('0x9')](),controller['destroy']);module[_0x9e43('0x13')]=router; \ No newline at end of file +var _0x175a=['./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x7e3bb8,_0x27c048){var _0x44c887=function(_0x55d7c6){while(--_0x55d7c6){_0x7e3bb8['push'](_0x7e3bb8['shift']());}};_0x44c887(++_0x27c048);}(_0x175a,0x108));var _0xa175=function(_0x317f3d,_0x4dd81e){_0x317f3d=_0x317f3d-0x0;var _0x2478e8=_0x175a[_0x317f3d];return _0x2478e8;};'use strict';var multer=require(_0xa175('0x0'));var util=require(_0xa175('0x1'));var path=require(_0xa175('0x2'));var timeout=require(_0xa175('0x3'));var express=require('express');var router=express[_0xa175('0x4')]();var fs_extra=require(_0xa175('0x5'));var auth=require(_0xa175('0x6'));var interaction=require(_0xa175('0x7'));var config=require(_0xa175('0x8'));var controller=require(_0xa175('0x9'));router[_0xa175('0xa')]('/',auth[_0xa175('0xb')](),controller[_0xa175('0xc')]);router['get'](_0xa175('0xd'),auth[_0xa175('0xb')](),controller[_0xa175('0xe')]);router[_0xa175('0xa')]('/:id',auth[_0xa175('0xb')](),controller[_0xa175('0xf')]);router['post']('/',auth[_0xa175('0xb')](),controller[_0xa175('0x10')]);router[_0xa175('0x11')](_0xa175('0x12'),auth[_0xa175('0xb')](),controller[_0xa175('0x13')]);router['delete'](_0xa175('0x12'),auth[_0xa175('0xb')](),controller['destroy']);module[_0xa175('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 5804621..2f5f798 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 _0x93a5=['moment','sequelize','ENUM','account','queue','DATE'];(function(_0xaf9efa,_0x1d1e95){var _0x132a2c=function(_0x9cb3c5){while(--_0x9cb3c5){_0xaf9efa['push'](_0xaf9efa['shift']());}};_0x132a2c(++_0x1d1e95);}(_0x93a5,0x132));var _0x593a=function(_0x51d71a,_0x596fda){_0x51d71a=_0x51d71a-0x0;var _0xff01f1=_0x93a5[_0x51d71a];return _0xff01f1;};'use strict';var moment=require(_0x593a('0x0'));var Sequelize=require(_0x593a('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x593a('0x2')](_0x593a('0x3'),'agent',_0x593a('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x593a('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xcfd1=['moment','sequelize','exports','ENUM','account','agent','queue','DATE','NOW'];(function(_0x5224d9,_0x3431c6){var _0x421ea3=function(_0x18a5d2){while(--_0x18a5d2){_0x5224d9['push'](_0x5224d9['shift']());}};_0x421ea3(++_0x3431c6);}(_0xcfd1,0x87));var _0x1cfd=function(_0x2165a0,_0x32a4e3){_0x2165a0=_0x2165a0-0x0;var _0x5443d6=_0xcfd1[_0x2165a0];return _0x5443d6;};'use strict';var moment=require(_0x1cfd('0x0'));var Sequelize=require(_0x1cfd('0x1'));module[_0x1cfd('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1cfd('0x3')](_0x1cfd('0x4'),_0x1cfd('0x5'),'queue'),'allowNull':![],'defaultValue':_0x1cfd('0x6')},'transferredAt':{'type':Sequelize[_0x1cfd('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x1cfd('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 78ceab1..a73b3a2 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 _0x3185=['zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','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','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','render','merge','contact','message','agent','interaction','account','index','map','SmsTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0x3185,0x14e));var _0x5318=function(_0xc7756f,_0x3a42c4){_0xc7756f=_0xc7756f-0x0;var _0x5dc6a1=_0x3185[_0xc7756f];return _0x5dc6a1;};'use strict';var emlformat=require(_0x5318('0x0'));var rimraf=require(_0x5318('0x1'));var zipdir=require(_0x5318('0x2'));var jsonpatch=require(_0x5318('0x3'));var rp=require(_0x5318('0x4'));var moment=require('moment');var BPromise=require(_0x5318('0x5'));var Mustache=require('mustache');var util=require(_0x5318('0x6'));var path=require(_0x5318('0x7'));var sox=require(_0x5318('0x8'));var csv=require(_0x5318('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5318('0xa'));var _=require('lodash');var squel=require(_0x5318('0xb'));var crypto=require(_0x5318('0xc'));var jsforce=require(_0x5318('0xd'));var deskjs=require(_0x5318('0xe'));var toCsv=require(_0x5318('0x9'));var querystring=require(_0x5318('0xf'));var Papa=require('papaparse');var Redis=require(_0x5318('0x10'));var authService=require(_0x5318('0x11'));var qs=require(_0x5318('0x12'));var as=require(_0x5318('0x13'));var hardwareService=require(_0x5318('0x14'));var logger=require(_0x5318('0x15'))('api');var utils=require(_0x5318('0x16'));var config=require(_0x5318('0x17'));var licenseUtil=require(_0x5318('0x18'));var db=require(_0x5318('0x19'))['db'];function respondWithStatusCode(_0x217cd9,_0xf796dd){_0xf796dd=_0xf796dd||0xcc;return function(_0x35621f){if(_0x35621f){return _0x217cd9[_0x5318('0x1a')](_0xf796dd);}return _0x217cd9['status'](_0xf796dd)[_0x5318('0x1b')]();};}function respondWithResult(_0x5721a1,_0x234505){_0x234505=_0x234505||0xc8;return function(_0x1a8832){if(_0x1a8832){return _0x5721a1[_0x5318('0x1c')](_0x234505)[_0x5318('0x1d')](_0x1a8832);}};}function respondWithFilteredResult(_0xa0d626,_0x4944a9){return function(_0x272b46){if(_0x272b46){var _0x21376b=typeof _0x4944a9['offset']===_0x5318('0x1e')&&typeof _0x4944a9[_0x5318('0x1f')]===_0x5318('0x1e');var _0x18ea41=_0x272b46[_0x5318('0x20')];var _0x2afd03=_0x21376b?0x0:_0x4944a9[_0x5318('0x21')];var _0x5b82b6=_0x21376b?_0x272b46[_0x5318('0x20')]:_0x4944a9[_0x5318('0x21')]+_0x4944a9['limit'];var _0x30f503;if(_0x5b82b6>=_0x18ea41){_0x5b82b6=_0x18ea41;_0x30f503=0xc8;}else{_0x30f503=0xce;}_0xa0d626[_0x5318('0x1c')](_0x30f503);return _0xa0d626[_0x5318('0x22')](_0x5318('0x23'),_0x2afd03+'-'+_0x5b82b6+'/'+_0x18ea41)[_0x5318('0x1d')](_0x272b46);}return null;};}function patchUpdates(_0x1ead2f){return function(_0x3b5534){try{jsonpatch[_0x5318('0x24')](_0x3b5534,_0x1ead2f,!![]);}catch(_0x901278){return BPromise[_0x5318('0x25')](_0x901278);}return _0x3b5534['save']();};}function saveUpdates(_0x12bce8,_0x1e81a2){return function(_0x248a73){if(_0x248a73){return _0x248a73[_0x5318('0x26')](_0x12bce8)[_0x5318('0x27')](function(_0x447926){return _0x447926;});}return null;};}function removeEntity(_0x1c7e86,_0x12f53c){return function(_0x27c792){if(_0x27c792){return _0x27c792[_0x5318('0x28')]()[_0x5318('0x27')](function(){_0x1c7e86[_0x5318('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b6cd6,_0x160ebe){return function(_0x100487){if(!_0x100487){_0x2b6cd6[_0x5318('0x1a')](0x194);}return _0x100487;};}function handleError(_0x316f86,_0x105b56){_0x105b56=_0x105b56||0x1f4;return function(_0x1f8091){logger[_0x5318('0x29')](_0x1f8091['stack']);if(_0x1f8091[_0x5318('0x2a')]){delete _0x1f8091[_0x5318('0x2a')];}_0x316f86[_0x5318('0x1c')](_0x105b56)[_0x5318('0x2b')](_0x1f8091);};}function getMustacheRender(_0x194091,_0x4ae863){return Mustache[_0x5318('0x2c')](_0x194091,_[_0x5318('0x2d')](_0x4ae863['body'],{'contact':_0x4ae863[_0x5318('0x2e')],'message':_0x4ae863[_0x5318('0x2f')],'agent':_0x4ae863[_0x5318('0x30')],'interaction':_0x4ae863[_0x5318('0x31')],'account':_0x4ae863[_0x5318('0x32')]}))||'';}exports[_0x5318('0x33')]=function(_0x3fa838,_0x411c24){var _0x559ff7={},_0x1f7d53={},_0x53a53e={'count':0x0,'rows':[]};var _0x518320=_[_0x5318('0x34')](db[_0x5318('0x35')][_0x5318('0x36')],function(_0x32bf82){return{'name':_0x32bf82[_0x5318('0x37')],'type':_0x32bf82[_0x5318('0x38')]['key']};});_0x1f7d53[_0x5318('0x39')]=_['map'](_0x518320,_0x5318('0x2a'));_0x1f7d53[_0x5318('0x3a')]=_[_0x5318('0x3b')](_0x3fa838[_0x5318('0x3a')]);_0x1f7d53[_0x5318('0x3c')]=_[_0x5318('0x3d')](_0x1f7d53[_0x5318('0x39')],_0x1f7d53[_0x5318('0x3a')]);_0x559ff7['attributes']=_[_0x5318('0x3d')](_0x1f7d53[_0x5318('0x39')],qs[_0x5318('0x3e')](_0x3fa838[_0x5318('0x3a')][_0x5318('0x3e')]));_0x559ff7[_0x5318('0x3f')]=_0x559ff7[_0x5318('0x3f')][_0x5318('0x40')]?_0x559ff7[_0x5318('0x3f')]:_0x1f7d53[_0x5318('0x39')];if(!_0x3fa838['query'][_0x5318('0x41')](_0x5318('0x42'))){_0x559ff7['limit']=qs['limit'](_0x3fa838[_0x5318('0x3a')][_0x5318('0x1f')]);_0x559ff7[_0x5318('0x21')]=qs[_0x5318('0x21')](_0x3fa838['query'][_0x5318('0x21')]);}_0x559ff7['order']=qs[_0x5318('0x43')](_0x3fa838[_0x5318('0x3a')][_0x5318('0x43')]);_0x559ff7[_0x5318('0x44')]=qs[_0x5318('0x3c')](_[_0x5318('0x45')](_0x3fa838[_0x5318('0x3a')],_0x1f7d53[_0x5318('0x3c')]),_0x518320);if(_0x3fa838[_0x5318('0x3a')][_0x5318('0x46')]){_0x559ff7['where']=_[_0x5318('0x2d')](_0x559ff7['where'],{'$or':_['map'](_0x518320,function(_0x333978){if(_0x333978[_0x5318('0x38')]!==_0x5318('0x47')){var _0x346f88={};_0x346f88[_0x333978[_0x5318('0x2a')]]={'$like':'%'+_0x3fa838[_0x5318('0x3a')][_0x5318('0x46')]+'%'};return _0x346f88;}})});}_0x559ff7=_[_0x5318('0x2d')]({},_0x559ff7,_0x3fa838['options']);var _0x485c08={'where':_0x559ff7[_0x5318('0x44')]};return db[_0x5318('0x35')][_0x5318('0x20')](_0x485c08)[_0x5318('0x27')](function(_0x35a51c){_0x53a53e[_0x5318('0x20')]=_0x35a51c;if(_0x3fa838[_0x5318('0x3a')][_0x5318('0x48')]){_0x559ff7[_0x5318('0x49')]=[{'all':!![]}];}return db[_0x5318('0x35')][_0x5318('0x4a')](_0x559ff7);})[_0x5318('0x27')](function(_0x580dfe){_0x53a53e[_0x5318('0x4b')]=_0x580dfe;return _0x53a53e;})['then'](respondWithFilteredResult(_0x411c24,_0x559ff7))[_0x5318('0x4c')](handleError(_0x411c24,null));};exports[_0x5318('0x4d')]=function(_0x135796,_0x245fdc){var _0x329b1d={'raw':!![],'where':{'id':_0x135796[_0x5318('0x4e')]['id']}},_0x1a742b={};_0x1a742b[_0x5318('0x39')]=_[_0x5318('0x3b')](db[_0x5318('0x35')][_0x5318('0x36')]);_0x1a742b[_0x5318('0x3a')]=_[_0x5318('0x3b')](_0x135796[_0x5318('0x3a')]);_0x1a742b[_0x5318('0x3c')]=_[_0x5318('0x3d')](_0x1a742b[_0x5318('0x39')],_0x1a742b[_0x5318('0x3a')]);_0x329b1d[_0x5318('0x3f')]=_['intersection'](_0x1a742b[_0x5318('0x39')],qs[_0x5318('0x3e')](_0x135796['query'][_0x5318('0x3e')]));_0x329b1d['attributes']=_0x329b1d[_0x5318('0x3f')][_0x5318('0x40')]?_0x329b1d[_0x5318('0x3f')]:_0x1a742b['model'];if(_0x135796[_0x5318('0x3a')][_0x5318('0x48')]){_0x329b1d['include']=[{'all':!![]}];}_0x329b1d=_['merge']({},_0x329b1d,_0x135796[_0x5318('0x4f')]);return db[_0x5318('0x35')][_0x5318('0x50')](_0x329b1d)[_0x5318('0x27')](handleEntityNotFound(_0x245fdc,null))[_0x5318('0x27')](respondWithResult(_0x245fdc,null))['catch'](handleError(_0x245fdc,null));};exports[_0x5318('0x51')]=function(_0x5dd23f,_0x1bf848){return db[_0x5318('0x35')][_0x5318('0x51')](_0x5dd23f[_0x5318('0x52')],{})['then'](respondWithResult(_0x1bf848,0xc9))['catch'](handleError(_0x1bf848,null));};exports[_0x5318('0x26')]=function(_0x51472c,_0x7f31d2){if(_0x51472c[_0x5318('0x52')]['id']){delete _0x51472c['body']['id'];}return db[_0x5318('0x35')]['find']({'where':{'id':_0x51472c[_0x5318('0x4e')]['id']}})[_0x5318('0x27')](handleEntityNotFound(_0x7f31d2,null))[_0x5318('0x27')](saveUpdates(_0x51472c[_0x5318('0x52')],null))[_0x5318('0x27')](respondWithResult(_0x7f31d2,null))[_0x5318('0x4c')](handleError(_0x7f31d2,null));};exports[_0x5318('0x28')]=function(_0x3c3858,_0x43b5d9){return db[_0x5318('0x35')]['find']({'where':{'id':_0x3c3858[_0x5318('0x4e')]['id']}})[_0x5318('0x27')](handleEntityNotFound(_0x43b5d9,null))['then'](removeEntity(_0x43b5d9,null))['catch'](handleError(_0x43b5d9,null));};exports[_0x5318('0x53')]=function(_0x32b6fa,_0x32ab41){return db['SmsTransferReport'][_0x5318('0x53')]()['then'](respondWithResult(_0x32ab41,null))[_0x5318('0x4c')](handleError(_0x32ab41,null));}; \ No newline at end of file +var _0xd97d=['show','params','intersection','options','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','index','SmsTransferReport','rawAttributes','fieldName','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch'];(function(_0x27fbdc,_0x5895a8){var _0xfce606=function(_0x2a75db){while(--_0x2a75db){_0x27fbdc['push'](_0x27fbdc['shift']());}};_0xfce606(++_0x5895a8);}(_0xd97d,0xab));var _0xdd97=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xd97d[_0x243217];return _0x478029;};'use strict';var emlformat=require(_0xdd97('0x0'));var rimraf=require(_0xdd97('0x1'));var zipdir=require(_0xdd97('0x2'));var jsonpatch=require(_0xdd97('0x3'));var rp=require(_0xdd97('0x4'));var moment=require(_0xdd97('0x5'));var BPromise=require(_0xdd97('0x6'));var Mustache=require(_0xdd97('0x7'));var util=require(_0xdd97('0x8'));var path=require(_0xdd97('0x9'));var sox=require(_0xdd97('0xa'));var csv=require(_0xdd97('0xb'));var ejs=require(_0xdd97('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdd97('0xd'));var crypto=require(_0xdd97('0xe'));var jsforce=require(_0xdd97('0xf'));var deskjs=require(_0xdd97('0x10'));var toCsv=require(_0xdd97('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdd97('0x11'));var authService=require(_0xdd97('0x12'));var qs=require(_0xdd97('0x13'));var as=require(_0xdd97('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd97('0x15'))('api');var utils=require(_0xdd97('0x16'));var config=require(_0xdd97('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd97('0x18'))['db'];function respondWithStatusCode(_0xb43486,_0x2e3616){_0x2e3616=_0x2e3616||0xcc;return function(_0x5119b2){if(_0x5119b2){return _0xb43486[_0xdd97('0x19')](_0x2e3616);}return _0xb43486['status'](_0x2e3616)[_0xdd97('0x1a')]();};}function respondWithResult(_0x4e93dc,_0x4c3e0e){_0x4c3e0e=_0x4c3e0e||0xc8;return function(_0x250762){if(_0x250762){return _0x4e93dc['status'](_0x4c3e0e)[_0xdd97('0x1b')](_0x250762);}};}function respondWithFilteredResult(_0xc0de7e,_0x519560){return function(_0x31f665){if(_0x31f665){var _0x30d51c=typeof _0x519560[_0xdd97('0x1c')]==='undefined'&&typeof _0x519560['limit']===_0xdd97('0x1d');var _0x3dd35d=_0x31f665[_0xdd97('0x1e')];var _0x35266f=_0x30d51c?0x0:_0x519560[_0xdd97('0x1c')];var _0x266c89=_0x30d51c?_0x31f665[_0xdd97('0x1e')]:_0x519560[_0xdd97('0x1c')]+_0x519560['limit'];var _0x254fd2;if(_0x266c89>=_0x3dd35d){_0x266c89=_0x3dd35d;_0x254fd2=0xc8;}else{_0x254fd2=0xce;}_0xc0de7e[_0xdd97('0x1f')](_0x254fd2);return _0xc0de7e['set'](_0xdd97('0x20'),_0x35266f+'-'+_0x266c89+'/'+_0x3dd35d)[_0xdd97('0x1b')](_0x31f665);}return null;};}function patchUpdates(_0x26266f){return function(_0x50aa87){try{jsonpatch[_0xdd97('0x21')](_0x50aa87,_0x26266f,!![]);}catch(_0x3132c7){return BPromise[_0xdd97('0x22')](_0x3132c7);}return _0x50aa87[_0xdd97('0x23')]();};}function saveUpdates(_0x334d0c,_0x589058){return function(_0x3c8e11){if(_0x3c8e11){return _0x3c8e11[_0xdd97('0x24')](_0x334d0c)[_0xdd97('0x25')](function(_0x45ce1b){return _0x45ce1b;});}return null;};}function removeEntity(_0x224be9,_0x2c1b8f){return function(_0x3d48b9){if(_0x3d48b9){return _0x3d48b9[_0xdd97('0x26')]()[_0xdd97('0x25')](function(){_0x224be9[_0xdd97('0x1f')](0xcc)[_0xdd97('0x1a')]();});}};}function handleEntityNotFound(_0x56bb16,_0x47aaa7){return function(_0x1132c9){if(!_0x1132c9){_0x56bb16['sendStatus'](0x194);}return _0x1132c9;};}function handleError(_0x301633,_0x377e0e){_0x377e0e=_0x377e0e||0x1f4;return function(_0xe291cc){logger['error'](_0xe291cc[_0xdd97('0x27')]);if(_0xe291cc['name']){delete _0xe291cc[_0xdd97('0x28')];}_0x301633[_0xdd97('0x1f')](_0x377e0e)[_0xdd97('0x29')](_0xe291cc);};}function getMustacheRender(_0x15b508,_0x1baa48){return Mustache[_0xdd97('0x2a')](_0x15b508,_[_0xdd97('0x2b')](_0x1baa48[_0xdd97('0x2c')],{'contact':_0x1baa48[_0xdd97('0x2d')],'message':_0x1baa48['message'],'agent':_0x1baa48[_0xdd97('0x2e')],'interaction':_0x1baa48[_0xdd97('0x2f')],'account':_0x1baa48[_0xdd97('0x30')]}))||'';}exports[_0xdd97('0x31')]=function(_0x3e37d1,_0xa1e696){var _0x454787={},_0x104693={},_0x3dde09={'count':0x0,'rows':[]};var _0x434416=_['map'](db[_0xdd97('0x32')][_0xdd97('0x33')],function(_0x429724){return{'name':_0x429724[_0xdd97('0x34')],'type':_0x429724['type'][_0xdd97('0x35')]};});_0x104693[_0xdd97('0x36')]=_[_0xdd97('0x37')](_0x434416,'name');_0x104693[_0xdd97('0x38')]=_[_0xdd97('0x39')](_0x3e37d1[_0xdd97('0x38')]);_0x104693['filters']=_['intersection'](_0x104693['model'],_0x104693[_0xdd97('0x38')]);_0x454787[_0xdd97('0x3a')]=_['intersection'](_0x104693[_0xdd97('0x36')],qs['fields'](_0x3e37d1[_0xdd97('0x38')][_0xdd97('0x3b')]));_0x454787[_0xdd97('0x3a')]=_0x454787[_0xdd97('0x3a')][_0xdd97('0x3c')]?_0x454787['attributes']:_0x104693['model'];if(!_0x3e37d1['query'][_0xdd97('0x3d')]('nolimit')){_0x454787[_0xdd97('0x3e')]=qs[_0xdd97('0x3e')](_0x3e37d1[_0xdd97('0x38')][_0xdd97('0x3e')]);_0x454787['offset']=qs[_0xdd97('0x1c')](_0x3e37d1[_0xdd97('0x38')][_0xdd97('0x1c')]);}_0x454787[_0xdd97('0x3f')]=qs[_0xdd97('0x40')](_0x3e37d1[_0xdd97('0x38')][_0xdd97('0x40')]);_0x454787[_0xdd97('0x41')]=qs[_0xdd97('0x42')](_[_0xdd97('0x43')](_0x3e37d1[_0xdd97('0x38')],_0x104693['filters']),_0x434416);if(_0x3e37d1[_0xdd97('0x38')][_0xdd97('0x44')]){_0x454787['where']=_['merge'](_0x454787[_0xdd97('0x41')],{'$or':_[_0xdd97('0x37')](_0x434416,function(_0x29a95f){if(_0x29a95f['type']!==_0xdd97('0x45')){var _0x2bd91d={};_0x2bd91d[_0x29a95f[_0xdd97('0x28')]]={'$like':'%'+_0x3e37d1[_0xdd97('0x38')][_0xdd97('0x44')]+'%'};return _0x2bd91d;}})});}_0x454787=_['merge']({},_0x454787,_0x3e37d1['options']);var _0x3d8e63={'where':_0x454787[_0xdd97('0x41')]};return db[_0xdd97('0x32')][_0xdd97('0x1e')](_0x3d8e63)[_0xdd97('0x25')](function(_0x1eaa88){_0x3dde09[_0xdd97('0x1e')]=_0x1eaa88;if(_0x3e37d1['query'][_0xdd97('0x46')]){_0x454787[_0xdd97('0x47')]=[{'all':!![]}];}return db[_0xdd97('0x32')][_0xdd97('0x48')](_0x454787);})['then'](function(_0x67d37c){_0x3dde09[_0xdd97('0x49')]=_0x67d37c;return _0x3dde09;})[_0xdd97('0x25')](respondWithFilteredResult(_0xa1e696,_0x454787))[_0xdd97('0x4a')](handleError(_0xa1e696,null));};exports[_0xdd97('0x4b')]=function(_0x58f2d0,_0x5e3a0f){var _0x1bcd34={'raw':!![],'where':{'id':_0x58f2d0[_0xdd97('0x4c')]['id']}},_0x5b83e6={};_0x5b83e6['model']=_['keys'](db['SmsTransferReport'][_0xdd97('0x33')]);_0x5b83e6[_0xdd97('0x38')]=_[_0xdd97('0x39')](_0x58f2d0[_0xdd97('0x38')]);_0x5b83e6[_0xdd97('0x42')]=_[_0xdd97('0x4d')](_0x5b83e6[_0xdd97('0x36')],_0x5b83e6[_0xdd97('0x38')]);_0x1bcd34[_0xdd97('0x3a')]=_[_0xdd97('0x4d')](_0x5b83e6[_0xdd97('0x36')],qs[_0xdd97('0x3b')](_0x58f2d0[_0xdd97('0x38')][_0xdd97('0x3b')]));_0x1bcd34[_0xdd97('0x3a')]=_0x1bcd34[_0xdd97('0x3a')]['length']?_0x1bcd34[_0xdd97('0x3a')]:_0x5b83e6[_0xdd97('0x36')];if(_0x58f2d0['query'][_0xdd97('0x46')]){_0x1bcd34['include']=[{'all':!![]}];}_0x1bcd34=_['merge']({},_0x1bcd34,_0x58f2d0[_0xdd97('0x4e')]);return db[_0xdd97('0x32')][_0xdd97('0x4f')](_0x1bcd34)[_0xdd97('0x25')](handleEntityNotFound(_0x5e3a0f,null))[_0xdd97('0x25')](respondWithResult(_0x5e3a0f,null))[_0xdd97('0x4a')](handleError(_0x5e3a0f,null));};exports[_0xdd97('0x50')]=function(_0x49ee66,_0x5df528){return db['SmsTransferReport']['create'](_0x49ee66[_0xdd97('0x2c')],{})[_0xdd97('0x25')](respondWithResult(_0x5df528,0xc9))[_0xdd97('0x4a')](handleError(_0x5df528,null));};exports['update']=function(_0x36d805,_0x490486){if(_0x36d805[_0xdd97('0x2c')]['id']){delete _0x36d805[_0xdd97('0x2c')]['id'];}return db[_0xdd97('0x32')][_0xdd97('0x4f')]({'where':{'id':_0x36d805[_0xdd97('0x4c')]['id']}})[_0xdd97('0x25')](handleEntityNotFound(_0x490486,null))['then'](saveUpdates(_0x36d805[_0xdd97('0x2c')],null))[_0xdd97('0x25')](respondWithResult(_0x490486,null))[_0xdd97('0x4a')](handleError(_0x490486,null));};exports[_0xdd97('0x26')]=function(_0x537494,_0x47fe38){return db[_0xdd97('0x32')][_0xdd97('0x4f')]({'where':{'id':_0x537494[_0xdd97('0x4c')]['id']}})[_0xdd97('0x25')](handleEntityNotFound(_0x47fe38,null))[_0xdd97('0x25')](removeEntity(_0x47fe38,null))[_0xdd97('0x4a')](handleError(_0x47fe38,null));};exports[_0xdd97('0x51')]=function(_0xe9eba6,_0x4c590f){return db[_0xdd97('0x32')][_0xdd97('0x51')]()['then'](respondWithResult(_0x4c590f,null))['catch'](handleError(_0x4c590f,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 06f21ea..342da0d 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 _0x7a54=['report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport'];(function(_0x346fa4,_0x721607){var _0x1743e7=function(_0x597469){while(--_0x597469){_0x346fa4['push'](_0x346fa4['shift']());}};_0x1743e7(++_0x721607);}(_0x7a54,0x106));var _0x47a5=function(_0x559394,_0x189d4b){_0x559394=_0x559394-0x0;var _0x5c52dd=_0x7a54[_0x559394];return _0x5c52dd;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4bd3=['SmsTransferReport','uniqueid','lodash','../../config/logger','api','path','rimraf','../../config/environment','exports','define'];(function(_0xa05f32,_0x42b27e){var _0x2d6d36=function(_0x34510d){while(--_0x34510d){_0xa05f32['push'](_0xa05f32['shift']());}};_0x2d6d36(++_0x42b27e);}(_0x4bd3,0x174));var _0x34bd=function(_0x58a4e5,_0xba23ee){_0x58a4e5=_0x58a4e5-0x0;var _0xba509d=_0x4bd3[_0x58a4e5];return _0xba509d;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./smsTransferReport.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x34bd('0x9'),'fields':[_0x34bd('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 b8dc637..3b23f2a 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 _0x2e75=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash'];(function(_0x3887ed,_0x2afab6){var _0x33ebf5=function(_0xd1f105){while(--_0xd1f105){_0x3887ed['push'](_0x3887ed['shift']());}};_0x33ebf5(++_0x2afab6);}(_0x2e75,0x14f));var _0x52e7=function(_0x1a5bb7,_0x6ae2f1){_0x1a5bb7=_0x1a5bb7-0x0;var _0x505202=_0x2e75[_0x1a5bb7];return _0x505202;};'use strict';var _=require(_0x52e7('0x0'));var util=require(_0x52e7('0x1'));var moment=require(_0x52e7('0x2'));var BPromise=require(_0x52e7('0x3'));var rs=require(_0x52e7('0x4'));var fs=require('fs');var Redis=require(_0x52e7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x52e7('0x6'));var logger=require('../../config/logger')(_0x52e7('0x7'));var config=require(_0x52e7('0x8'));var jayson=require(_0x52e7('0x9'));var client=jayson['client'][_0x52e7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ab1f4,_0x14357a,_0x227026){return new BPromise(function(_0x67cbbd,_0x10b937){return client['request'](_0x3ab1f4,_0x227026)[_0x52e7('0xb')](function(_0x4bb465){logger['info'](_0x52e7('0xc'),_0x14357a,_0x52e7('0xd'));logger['debug'](_0x52e7('0xe'),_0x14357a,_0x52e7('0xd'),JSON[_0x52e7('0xf')](_0x4bb465));if(_0x4bb465['error']){if(_0x4bb465[_0x52e7('0x10')][_0x52e7('0x11')]===0x1f4){logger[_0x52e7('0x10')](_0x52e7('0xc'),_0x14357a,_0x4bb465['error']['message']);return _0x10b937(_0x4bb465[_0x52e7('0x10')][_0x52e7('0x12')]);}logger[_0x52e7('0x10')](_0x52e7('0xc'),_0x14357a,_0x4bb465['error'][_0x52e7('0x12')]);return _0x67cbbd(_0x4bb465[_0x52e7('0x10')][_0x52e7('0x12')]);}else{logger[_0x52e7('0x13')](_0x52e7('0xc'),_0x14357a,_0x52e7('0xd'));_0x67cbbd(_0x4bb465[_0x52e7('0x14')][_0x52e7('0x12')]);}})['catch'](function(_0x4d0470){logger[_0x52e7('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x14357a,_0x4d0470);_0x10b937(_0x4d0470);});});} \ No newline at end of file +var _0x00f6=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result'];(function(_0x4d482e,_0x7b328b){var _0x5a380f=function(_0x458330){while(--_0x458330){_0x4d482e['push'](_0x4d482e['shift']());}};_0x5a380f(++_0x7b328b);}(_0x00f6,0x64));var _0x600f=function(_0x438883,_0x2ae235){_0x438883=_0x438883-0x0;var _0xfcf86e=_0x00f6[_0x438883];return _0xfcf86e;};'use strict';var _=require(_0x600f('0x0'));var util=require(_0x600f('0x1'));var moment=require(_0x600f('0x2'));var BPromise=require(_0x600f('0x3'));var rs=require(_0x600f('0x4'));var fs=require('fs');var Redis=require(_0x600f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x600f('0x6'));var logger=require(_0x600f('0x7'))('rpc');var config=require(_0x600f('0x8'));var jayson=require(_0x600f('0x9'));var client=jayson[_0x600f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c1dc1,_0x2a4335,_0x58d3a7){return new BPromise(function(_0x3257f9,_0x1364fa){return client['request'](_0x4c1dc1,_0x58d3a7)[_0x600f('0xb')](function(_0x2659c8){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x2a4335,'request\x20sent');logger[_0x600f('0xc')](_0x600f('0xd'),_0x2a4335,'request\x20sent',JSON[_0x600f('0xe')](_0x2659c8));if(_0x2659c8[_0x600f('0xf')]){if(_0x2659c8[_0x600f('0xf')][_0x600f('0x10')]===0x1f4){logger[_0x600f('0xf')](_0x600f('0x11'),_0x2a4335,_0x2659c8['error'][_0x600f('0x12')]);return _0x1364fa(_0x2659c8[_0x600f('0xf')]['message']);}logger[_0x600f('0xf')](_0x600f('0x11'),_0x2a4335,_0x2659c8[_0x600f('0xf')][_0x600f('0x12')]);return _0x3257f9(_0x2659c8[_0x600f('0xf')][_0x600f('0x12')]);}else{logger['info'](_0x600f('0x11'),_0x2a4335,'request\x20sent');_0x3257f9(_0x2659c8[_0x600f('0x13')][_0x600f('0x12')]);}})['catch'](function(_0x548b5f){logger[_0x600f('0xf')](_0x600f('0x11'),_0x2a4335,_0x548b5f);_0x1364fa(_0x548b5f);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 32a8443..53a5cb2 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 _0x40ea=['/:id','show','/:id/download','download','diskStorage','server/files/sounds/original/','originalname','format','extname','now','post','single','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index'];(function(_0x4607f7,_0x372102){var _0x19e995=function(_0x144d15){while(--_0x144d15){_0x4607f7['push'](_0x4607f7['shift']());}};_0x19e995(++_0x372102);}(_0x40ea,0x91));var _0xa40e=function(_0x39bc1e,_0x37e9f3){_0x39bc1e=_0x39bc1e-0x0;var _0x3540d7=_0x40ea[_0x39bc1e];return _0x3540d7;};'use strict';var multer=require(_0xa40e('0x0'));var util=require('util');var path=require(_0xa40e('0x1'));var timeout=require('connect-timeout');var express=require(_0xa40e('0x2'));var router=express[_0xa40e('0x3')]();var fs_extra=require(_0xa40e('0x4'));var auth=require(_0xa40e('0x5'));var interaction=require(_0xa40e('0x6'));var config=require('../../config/environment');var controller=require(_0xa40e('0x7'));router[_0xa40e('0x8')]('/',auth[_0xa40e('0x9')](),controller[_0xa40e('0xa')]);router[_0xa40e('0x8')](_0xa40e('0xb'),auth[_0xa40e('0x9')](),controller[_0xa40e('0xc')]);router['get'](_0xa40e('0xd'),auth[_0xa40e('0x9')](),controller[_0xa40e('0xe')]);var upload=multer({'storage':multer[_0xa40e('0xf')]({'destination':function(_0x2355ce,_0x487281,_0x57bbba){_0x57bbba(null,path['join'](config['root'],_0xa40e('0x10')));},'filename':function(_0xbd8937,_0xe5a362,_0x497a9c){_0xe5a362[_0xa40e('0x11')]=_0xe5a362[_0xa40e('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x497a9c(null,util[_0xa40e('0x12')]('%s-%s%s',path['basename'](_0xe5a362[_0xa40e('0x11')],path[_0xa40e('0x13')](_0xe5a362[_0xa40e('0x11')])),Date[_0xa40e('0x14')](),path[_0xa40e('0x13')](_0xe5a362[_0xa40e('0x11')])));}})});router[_0xa40e('0x15')]('/',upload[_0xa40e('0x16')]('file'),controller['create']);router['put']('/:id',auth[_0xa40e('0x9')](),controller[_0xa40e('0x17')]);router[_0xa40e('0x18')](_0xa40e('0xb'),auth[_0xa40e('0x9')](),controller[_0xa40e('0x18')]);module[_0xa40e('0x19')]=router; \ No newline at end of file +var _0xc82e=['diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put','delete','/:id','exports','util','path','express','Router','fs-extra','./sound.controller','get','isAuthenticated','index'];(function(_0x16a637,_0x5eb627){var _0x25126d=function(_0x54e016){while(--_0x54e016){_0x16a637['push'](_0x16a637['shift']());}};_0x25126d(++_0x5eb627);}(_0xc82e,0x163));var _0xec82=function(_0x16db4b,_0xbf4524){_0x16db4b=_0x16db4b-0x0;var _0x15ab28=_0xc82e[_0x16db4b];return _0x15ab28;};'use strict';var multer=require('multer');var util=require(_0xec82('0x0'));var path=require(_0xec82('0x1'));var timeout=require('connect-timeout');var express=require(_0xec82('0x2'));var router=express[_0xec82('0x3')]();var fs_extra=require(_0xec82('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xec82('0x5'));router[_0xec82('0x6')]('/',auth[_0xec82('0x7')](),controller[_0xec82('0x8')]);router[_0xec82('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xec82('0x6')]('/:id/download',auth[_0xec82('0x7')](),controller['download']);var upload=multer({'storage':multer[_0xec82('0x9')]({'destination':function(_0x145711,_0x26c5a4,_0xcb769){_0xcb769(null,path[_0xec82('0xa')](config[_0xec82('0xb')],_0xec82('0xc')));},'filename':function(_0x1d2ed8,_0x39dd86,_0x38c236){_0x39dd86[_0xec82('0xd')]=_0x39dd86[_0xec82('0xd')][_0xec82('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x38c236(null,util[_0xec82('0xf')](_0xec82('0x10'),path[_0xec82('0x11')](_0x39dd86['originalname'],path[_0xec82('0x12')](_0x39dd86[_0xec82('0xd')])),Date[_0xec82('0x13')](),path[_0xec82('0x12')](_0x39dd86[_0xec82('0xd')])));}})});router[_0xec82('0x14')]('/',upload[_0xec82('0x15')](_0xec82('0x16')),controller[_0xec82('0x17')]);router[_0xec82('0x18')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xec82('0x19')](_0xec82('0x1a'),auth[_0xec82('0x7')](),controller[_0xec82('0x19')]);module[_0xec82('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 69f5dd6..c069ef0 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 _0x42ed=['BIGINT','INTEGER','FLOAT','sequelize','exports','name','STRING'];(function(_0x39f3ef,_0x20008f){var _0x5f1541=function(_0x5a38a8){while(--_0x5a38a8){_0x39f3ef['push'](_0x39f3ef['shift']());}};_0x5f1541(++_0x20008f);}(_0x42ed,0xdc));var _0xd42e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x42ed[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd42e('0x0'));module[_0xd42e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd42e('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xd42e('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0xd42e('0x3')]},'original_format':{'type':Sequelize[_0xd42e('0x3')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xd42e('0x4')]},'original_channelCount':{'type':Sequelize[_0xd42e('0x5')]},'original_bitRate':{'type':Sequelize[_0xd42e('0x4')]},'original_sampleRate':{'type':Sequelize[_0xd42e('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xd42e('0x6')]},'converted_sampleCount':{'type':Sequelize[_0xd42e('0x4')]},'converted_channelCount':{'type':Sequelize[_0xd42e('0x5')]},'converted_bitRate':{'type':Sequelize[_0xd42e('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa49f=['sequelize','exports','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x2ed474,_0x685826){var _0x4be574=function(_0x51d21f){while(--_0x51d21f){_0x2ed474['push'](_0x2ed474['shift']());}};_0x4be574(++_0x685826);}(_0xa49f,0x180));var _0xfa49=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xa49f[_0x45d55e];return _0x29812a;};'use strict';var Sequelize=require(_0xfa49('0x0'));module[_0xfa49('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xfa49('0x2')]},'display_name':{'type':Sequelize[_0xfa49('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xfa49('0x3')]},'original_sampleCount':{'type':Sequelize[_0xfa49('0x4')]},'original_channelCount':{'type':Sequelize[_0xfa49('0x5')]},'original_bitRate':{'type':Sequelize[_0xfa49('0x4')]},'original_sampleRate':{'type':Sequelize[_0xfa49('0x5')]},'converted_format':{'type':Sequelize[_0xfa49('0x2')]},'converted_duration':{'type':Sequelize[_0xfa49('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xfa49('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xfa49('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 7097bef..e1b3919 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 _0xbe37=['query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','Sound','findAll','catch','show','rawAttributes','include','options','find','download','params','save_name','existsSync','join','root','converted_format','Sequelize','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','send','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleRate','body','userProfileId','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','server/files/sounds/converted','unlinkSync','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','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','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','render','merge','contact','agent','account','index','map','fieldName','type','model'];(function(_0x3a0ca5,_0x1bf4b0){var _0xe9a7ae=function(_0x2476d0){while(--_0x2476d0){_0x3a0ca5['push'](_0x3a0ca5['shift']());}};_0xe9a7ae(++_0x1bf4b0);}(_0xbe37,0xc7));var _0x7be3=function(_0x1c20c7,_0x5ed85a){_0x1c20c7=_0x1c20c7-0x0;var _0x12a7f5=_0xbe37[_0x1c20c7];return _0x12a7f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7be3('0x0'));var zipdir=require(_0x7be3('0x1'));var jsonpatch=require(_0x7be3('0x2'));var rp=require('request-promise');var moment=require(_0x7be3('0x3'));var BPromise=require(_0x7be3('0x4'));var Mustache=require(_0x7be3('0x5'));var util=require(_0x7be3('0x6'));var path=require(_0x7be3('0x7'));var sox=require(_0x7be3('0x8'));var csv=require('to-csv');var ejs=require(_0x7be3('0x9'));var fs=require('fs');var fs_extra=require(_0x7be3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7be3('0xb'));var deskjs=require(_0x7be3('0xc'));var toCsv=require(_0x7be3('0xd'));var querystring=require(_0x7be3('0xe'));var Papa=require(_0x7be3('0xf'));var Redis=require('ioredis');var authService=require(_0x7be3('0x10'));var qs=require(_0x7be3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7be3('0x12'));var logger=require(_0x7be3('0x13'))(_0x7be3('0x14'));var utils=require(_0x7be3('0x15'));var config=require(_0x7be3('0x16'));var licenseUtil=require(_0x7be3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x208fa3,_0x4e1b1d){_0x4e1b1d=_0x4e1b1d||0xcc;return function(_0x2453f6){if(_0x2453f6){return _0x208fa3['sendStatus'](_0x4e1b1d);}return _0x208fa3[_0x7be3('0x18')](_0x4e1b1d)[_0x7be3('0x19')]();};}function respondWithResult(_0x3233ec,_0x243e78){_0x243e78=_0x243e78||0xc8;return function(_0x217ef1){if(_0x217ef1){return _0x3233ec[_0x7be3('0x18')](_0x243e78)[_0x7be3('0x1a')](_0x217ef1);}};}function respondWithFilteredResult(_0x2561a0,_0x53ec76){return function(_0x3f23e6){if(_0x3f23e6){var _0x141031=typeof _0x53ec76[_0x7be3('0x1b')]===_0x7be3('0x1c')&&typeof _0x53ec76[_0x7be3('0x1d')]===_0x7be3('0x1c');var _0x38e290=_0x3f23e6[_0x7be3('0x1e')];var _0x297232=_0x141031?0x0:_0x53ec76['offset'];var _0x526859=_0x141031?_0x3f23e6['count']:_0x53ec76[_0x7be3('0x1b')]+_0x53ec76[_0x7be3('0x1d')];var _0x1b8e78;if(_0x526859>=_0x38e290){_0x526859=_0x38e290;_0x1b8e78=0xc8;}else{_0x1b8e78=0xce;}_0x2561a0[_0x7be3('0x18')](_0x1b8e78);return _0x2561a0['set'](_0x7be3('0x1f'),_0x297232+'-'+_0x526859+'/'+_0x38e290)[_0x7be3('0x1a')](_0x3f23e6);}return null;};}function patchUpdates(_0x35b1ff){return function(_0xe5b5e1){try{jsonpatch[_0x7be3('0x20')](_0xe5b5e1,_0x35b1ff,!![]);}catch(_0x1df46d){return BPromise['reject'](_0x1df46d);}return _0xe5b5e1['save']();};}function saveUpdates(_0x44c99d,_0x712365){return function(_0x36354f){if(_0x36354f){return _0x36354f[_0x7be3('0x21')](_0x44c99d)[_0x7be3('0x22')](function(_0x3a2b4e){return _0x3a2b4e;});}return null;};}function removeEntity(_0x45ebbc,_0x1d49da){return function(_0x484075){if(_0x484075){return _0x484075[_0x7be3('0x23')]()['then'](function(){var _0x99434=_0x484075[_0x7be3('0x24')]({'plain':!![]});var _0x2b8cf6='Sounds';return db[_0x7be3('0x25')][_0x7be3('0x23')]({'where':{'type':_0x2b8cf6,'resourceId':_0x99434['id']}})[_0x7be3('0x22')](function(){return _0x484075;});})['then'](function(){_0x45ebbc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e3dae,_0x30e61d){return function(_0x472407){if(!_0x472407){_0x5e3dae[_0x7be3('0x26')](0x194);}return _0x472407;};}function handleError(_0x73be83,_0xefdaa3){_0xefdaa3=_0xefdaa3||0x1f4;return function(_0x297dff){logger['error'](_0x297dff[_0x7be3('0x27')]);if(_0x297dff['name']){delete _0x297dff[_0x7be3('0x28')];}_0x73be83[_0x7be3('0x18')](_0xefdaa3)['send'](_0x297dff);};}function getMustacheRender(_0x15be26,_0x470f0e){return Mustache[_0x7be3('0x29')](_0x15be26,_[_0x7be3('0x2a')](_0x470f0e['body'],{'contact':_0x470f0e[_0x7be3('0x2b')],'message':_0x470f0e['message'],'agent':_0x470f0e[_0x7be3('0x2c')],'interaction':_0x470f0e['interaction'],'account':_0x470f0e[_0x7be3('0x2d')]}))||'';}exports[_0x7be3('0x2e')]=function(_0x92ce45,_0x26a6d3){var _0x1a581a={},_0x110dbd={},_0x34149d={'count':0x0,'rows':[]};var _0x59d51e=_[_0x7be3('0x2f')](db['Sound']['rawAttributes'],function(_0x22b97b){return{'name':_0x22b97b[_0x7be3('0x30')],'type':_0x22b97b[_0x7be3('0x31')]['key']};});_0x110dbd[_0x7be3('0x32')]=_[_0x7be3('0x2f')](_0x59d51e,_0x7be3('0x28'));_0x110dbd[_0x7be3('0x33')]=_[_0x7be3('0x34')](_0x92ce45['query']);_0x110dbd['filters']=_[_0x7be3('0x35')](_0x110dbd[_0x7be3('0x32')],_0x110dbd[_0x7be3('0x33')]);_0x1a581a['attributes']=_[_0x7be3('0x35')](_0x110dbd[_0x7be3('0x32')],qs[_0x7be3('0x36')](_0x92ce45[_0x7be3('0x33')][_0x7be3('0x36')]));_0x1a581a['attributes']=_0x1a581a[_0x7be3('0x37')][_0x7be3('0x38')]?_0x1a581a[_0x7be3('0x37')]:_0x110dbd[_0x7be3('0x32')];if(!_0x92ce45[_0x7be3('0x33')][_0x7be3('0x39')](_0x7be3('0x3a'))){_0x1a581a[_0x7be3('0x1d')]=qs['limit'](_0x92ce45[_0x7be3('0x33')]['limit']);_0x1a581a[_0x7be3('0x1b')]=qs[_0x7be3('0x1b')](_0x92ce45[_0x7be3('0x33')][_0x7be3('0x1b')]);}_0x1a581a[_0x7be3('0x3b')]=qs[_0x7be3('0x3c')](_0x92ce45['query'][_0x7be3('0x3c')]);_0x1a581a[_0x7be3('0x3d')]=qs[_0x7be3('0x3e')](_[_0x7be3('0x3f')](_0x92ce45[_0x7be3('0x33')],_0x110dbd[_0x7be3('0x3e')]),_0x59d51e);if(_0x92ce45[_0x7be3('0x33')][_0x7be3('0x40')]){_0x1a581a[_0x7be3('0x3d')]=_[_0x7be3('0x2a')](_0x1a581a[_0x7be3('0x3d')],{'$or':_[_0x7be3('0x2f')](_0x59d51e,function(_0x5028a9){if(_0x5028a9[_0x7be3('0x31')]!==_0x7be3('0x41')){var _0x219ebd={};_0x219ebd[_0x5028a9[_0x7be3('0x28')]]={'$like':'%'+_0x92ce45['query']['filter']+'%'};return _0x219ebd;}})});}_0x1a581a=_[_0x7be3('0x2a')]({},_0x1a581a,_0x92ce45['options']);var _0x4f79bb={'where':_0x1a581a['where']};return db['Sound'][_0x7be3('0x1e')](_0x4f79bb)[_0x7be3('0x22')](function(_0x5ac5ce){_0x34149d[_0x7be3('0x1e')]=_0x5ac5ce;if(_0x92ce45[_0x7be3('0x33')][_0x7be3('0x42')]){_0x1a581a['include']=[{'all':!![]}];}return db[_0x7be3('0x43')][_0x7be3('0x44')](_0x1a581a);})[_0x7be3('0x22')](function(_0x4dae12){_0x34149d['rows']=_0x4dae12;return _0x34149d;})[_0x7be3('0x22')](respondWithFilteredResult(_0x26a6d3,_0x1a581a))[_0x7be3('0x45')](handleError(_0x26a6d3,null));};exports[_0x7be3('0x46')]=function(_0x493e71,_0x482d66){var _0x424bf4={'raw':!![],'where':{'id':_0x493e71['params']['id']}},_0x3cf628={};_0x3cf628[_0x7be3('0x32')]=_[_0x7be3('0x34')](db['Sound'][_0x7be3('0x47')]);_0x3cf628[_0x7be3('0x33')]=_[_0x7be3('0x34')](_0x493e71[_0x7be3('0x33')]);_0x3cf628[_0x7be3('0x3e')]=_[_0x7be3('0x35')](_0x3cf628[_0x7be3('0x32')],_0x3cf628[_0x7be3('0x33')]);_0x424bf4[_0x7be3('0x37')]=_[_0x7be3('0x35')](_0x3cf628['model'],qs[_0x7be3('0x36')](_0x493e71[_0x7be3('0x33')][_0x7be3('0x36')]));_0x424bf4[_0x7be3('0x37')]=_0x424bf4[_0x7be3('0x37')][_0x7be3('0x38')]?_0x424bf4[_0x7be3('0x37')]:_0x3cf628[_0x7be3('0x32')];if(_0x493e71[_0x7be3('0x33')][_0x7be3('0x42')]){_0x424bf4[_0x7be3('0x48')]=[{'all':!![]}];}_0x424bf4=_[_0x7be3('0x2a')]({},_0x424bf4,_0x493e71[_0x7be3('0x49')]);return db[_0x7be3('0x43')][_0x7be3('0x4a')](_0x424bf4)[_0x7be3('0x22')](handleEntityNotFound(_0x482d66,null))[_0x7be3('0x22')](respondWithResult(_0x482d66,null))[_0x7be3('0x45')](handleError(_0x482d66,null));};exports[_0x7be3('0x4b')]=function(_0x90b523,_0x1769fe,_0x201a75){return db[_0x7be3('0x43')][_0x7be3('0x4a')]({'where':{'id':_0x90b523[_0x7be3('0x4c')]['id']},'attributes':[_0x7be3('0x28'),_0x7be3('0x4d'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x1769fe,null))['then'](function(_0x4836cd){if(_0x4836cd){if(!fs[_0x7be3('0x4e')](path[_0x7be3('0x4f')](config[_0x7be3('0x50')],'server/files/sounds/converted',_0x4836cd['save_name']+'.'+_0x4836cd[_0x7be3('0x51')]))){throw new db[(_0x7be3('0x52'))]['ValidationError'](_0x7be3('0x53'));}return _0x1769fe['download'](path['join'](config[_0x7be3('0x50')],'server/files/sounds/converted',util[_0x7be3('0x54')](_0x7be3('0x55'),_0x4836cd[_0x7be3('0x4d')],_0x4836cd['converted_format'])),util[_0x7be3('0x54')](_0x7be3('0x55'),_0x4836cd[_0x7be3('0x28')],_0x4836cd[_0x7be3('0x51')]));}return null;})[_0x7be3('0x45')](handleError(_0x1769fe,null));};exports[_0x7be3('0x56')]=function(_0x1538c8,_0x39a106,_0x1537c6){var _0x481c68={'name':path[_0x7be3('0x57')](_0x1538c8[_0x7be3('0x58')][_0x7be3('0x59')],path[_0x7be3('0x5a')](_0x1538c8[_0x7be3('0x58')]['originalname'])),'save_name':path[_0x7be3('0x57')](_0x1538c8[_0x7be3('0x58')][_0x7be3('0x5b')],path['extname'](_0x1538c8[_0x7be3('0x58')]['filename'])),'original_format':path[_0x7be3('0x5a')](_0x1538c8[_0x7be3('0x58')][_0x7be3('0x59')])[_0x7be3('0x5c')](0x1),'converted_format':_0x7be3('0x5d')};var _0x43d978=path[_0x7be3('0x4f')](config[_0x7be3('0x50')],_0x7be3('0x5e'),_0x1538c8[_0x7be3('0x58')][_0x7be3('0x5b')]);var _0x215b5c=path[_0x7be3('0x4f')](config[_0x7be3('0x50')],'server/files/sounds/converted',util[_0x7be3('0x54')]('%s.%s',path[_0x7be3('0x57')](_0x1538c8['file']['filename'],path[_0x7be3('0x5a')](_0x1538c8[_0x7be3('0x58')][_0x7be3('0x5b')])),_0x481c68[_0x7be3('0x51')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x43d978);logger['info'](_0x7be3('0x5f'),_0x215b5c);try{fs[_0x7be3('0x60')](_0x43d978,parseInt(_0x7be3('0x61'),0x8));var _0x170bd6=sox[_0x7be3('0x62')](_0x43d978,_0x215b5c,{'sampleRate':0x1f40,'format':_0x7be3('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x170bd6['on'](_0x7be3('0x63'),function(_0x1b97b4){fs['unlinkSync'](_0x43d978);_0x39a106['status'](0x1f4)[_0x7be3('0x64')](_0x1b97b4);});_0x170bd6['on']('src',function(_0x47b02f){_0x481c68[_0x7be3('0x65')]=isNaN(_0x47b02f['duration'])?null:_0x47b02f[_0x7be3('0x66')]*0x3e8;_0x481c68[_0x7be3('0x67')]=isNaN(_0x47b02f['sampleCount'])?null:_0x47b02f[_0x7be3('0x68')];_0x481c68['original_channelCount']=isNaN(_0x47b02f[_0x7be3('0x69')])?null:_0x47b02f[_0x7be3('0x69')];_0x481c68[_0x7be3('0x6a')]=isNaN(_0x47b02f['bitRate'])?null:_0x47b02f[_0x7be3('0x6b')];_0x481c68[_0x7be3('0x6c')]=isNaN(_0x47b02f[_0x7be3('0x6d')])?null:_0x47b02f['sampleRate'];});_0x170bd6['on'](_0x7be3('0x6e'),function(_0x5309d0){_0x481c68[_0x7be3('0x6f')]=isNaN(_0x5309d0[_0x7be3('0x66')])?null:_0x5309d0['duration']*0x3e8;_0x481c68['converted_sampleCount']=isNaN(_0x5309d0[_0x7be3('0x68')])?null:_0x5309d0[_0x7be3('0x68')];_0x481c68['converted_channelCount']=isNaN(_0x5309d0['channelCount'])?null:_0x5309d0['channelCount'];_0x481c68['converted_bitRate']=isNaN(_0x5309d0[_0x7be3('0x6b')])?null:_0x5309d0[_0x7be3('0x6b')];_0x481c68[_0x7be3('0x70')]=isNaN(_0x5309d0[_0x7be3('0x6d')])?null:_0x5309d0[_0x7be3('0x6d')];});_0x170bd6['on']('end',function(){fs[_0x7be3('0x60')](_0x215b5c,parseInt('0777',0x8));return db[_0x7be3('0x43')][_0x7be3('0x56')](_0x481c68)[_0x7be3('0x22')](function(_0x4bf5d9){var _0x1f361a={'role':_0x1538c8[_0x7be3('0x71')]['role'],'userProfileId':_0x1538c8[_0x7be3('0x71')][_0x7be3('0x72')]};if(!_0x1f361a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f361a[_0x7be3('0x73')]===_0x7be3('0x74')){var _0x5de2ed=_0x4bf5d9['get']({'plain':!![]});return db['UserProfileSection'][_0x7be3('0x4a')]({'where':{'name':'Sounds','userProfileId':_0x1f361a[_0x7be3('0x72')]},'raw':!![]})[_0x7be3('0x22')](function(_0x3f0489){if(_0x3f0489&&_0x3f0489[_0x7be3('0x75')]===0x0){return db[_0x7be3('0x25')]['create']({'name':_0x5de2ed[_0x7be3('0x28')],'resourceId':_0x5de2ed['id'],'type':_0x3f0489[_0x7be3('0x28')],'sectionId':_0x3f0489['id']},{})[_0x7be3('0x22')](function(){return _0x4bf5d9;});}else{return _0x4bf5d9;}})['catch'](function(_0x4fcbc1){logger[_0x7be3('0x63')](_0x7be3('0x76'),_0x4fcbc1);throw _0x4fcbc1;});}return _0x4bf5d9;})['then'](respondWithResult(_0x39a106,null))[_0x7be3('0x45')](handleError(_0x39a106,null));});_0x170bd6[_0x7be3('0x77')]();}catch(_0x27c8ba){_0x39a106[_0x7be3('0x18')](0x1f4)[_0x7be3('0x64')](_0x27c8ba);}};exports[_0x7be3('0x21')]=function(_0x14a642,_0x4d701a,_0x1ea65a){return db[_0x7be3('0x43')][_0x7be3('0x4a')]({'where':{'id':_0x14a642[_0x7be3('0x4c')]['id']}})[_0x7be3('0x22')](handleEntityNotFound(_0x4d701a,null))[_0x7be3('0x22')](saveUpdates(_[_0x7be3('0x3f')](_0x14a642['body'],[_0x7be3('0x28'),_0x7be3('0x78')]),null))[_0x7be3('0x22')](respondWithResult(_0x4d701a,null))[_0x7be3('0x45')](handleError(_0x4d701a,null));};exports[_0x7be3('0x79')]=function(_0x564f43,_0x4db494,_0x357870){return db[_0x7be3('0x43')]['find']({'where':{'id':_0x564f43[_0x7be3('0x4c')]['id']}})['then'](function(_0x21fdd5){if(_0x21fdd5){return _0x21fdd5[_0x7be3('0x23')]();}})[_0x7be3('0x22')](function(_0x3597d3){var _0x59b081=path[_0x7be3('0x4f')](config['root'],_0x7be3('0x5e'),util[_0x7be3('0x54')](_0x7be3('0x55'),_0x3597d3[_0x7be3('0x4d')],_0x3597d3[_0x7be3('0x7a')]));var _0x34f9bc=path['join'](config[_0x7be3('0x50')],_0x7be3('0x7b'),util[_0x7be3('0x54')](_0x7be3('0x55'),_0x3597d3[_0x7be3('0x4d')],_0x3597d3[_0x7be3('0x51')]));fs[_0x7be3('0x7c')](_0x59b081);fs[_0x7be3('0x7c')](_0x34f9bc);return _0x3597d3;})[_0x7be3('0x22')](function(_0x36f4a9){if(_0x36f4a9){return _0x4db494[_0x7be3('0x18')](0xcc)[_0x7be3('0x19')]();}})[_0x7be3('0x22')](handleEntityNotFound(_0x4db494,null))[_0x7be3('0x45')](handleError(_0x4db494,null));}; \ No newline at end of file +var _0x82e6=['catch','show','fields','find','download','params','save_name','existsSync','join','root','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','%s.%s','converted_format','create','basename','extname','file','originalname','filename','substring','wav','server/files/sounds/original','format','Sound\x20upload\x20destination:\x20%s','chmodSync','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_bitRate','0777','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','render','merge','contact','message','agent','account','index','Sound','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x5ef5e6,_0xf13cc5){var _0x57e434=function(_0x321c8c){while(--_0x321c8c){_0x5ef5e6['push'](_0x5ef5e6['shift']());}};_0x57e434(++_0xf13cc5);}(_0x82e6,0x1b4));var _0x682e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x82e6[_0x5037ab];return _0x512adb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x682e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x682e('0x1'));var rp=require(_0x682e('0x2'));var moment=require('moment');var BPromise=require(_0x682e('0x3'));var Mustache=require(_0x682e('0x4'));var util=require(_0x682e('0x5'));var path=require(_0x682e('0x6'));var sox=require('sox');var csv=require(_0x682e('0x7'));var ejs=require(_0x682e('0x8'));var fs=require('fs');var fs_extra=require(_0x682e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x682e('0xa'));var jsforce=require(_0x682e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x682e('0x7'));var querystring=require(_0x682e('0xc'));var Papa=require('papaparse');var Redis=require(_0x682e('0xd'));var authService=require(_0x682e('0xe'));var qs=require(_0x682e('0xf'));var as=require(_0x682e('0x10'));var hardwareService=require(_0x682e('0x11'));var logger=require(_0x682e('0x12'))(_0x682e('0x13'));var utils=require('../../config/utils');var config=require(_0x682e('0x14'));var licenseUtil=require(_0x682e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b7bef,_0x12eb3b){_0x12eb3b=_0x12eb3b||0xcc;return function(_0x24ef4f){if(_0x24ef4f){return _0x4b7bef['sendStatus'](_0x12eb3b);}return _0x4b7bef[_0x682e('0x16')](_0x12eb3b)[_0x682e('0x17')]();};}function respondWithResult(_0x42ad8f,_0x39d83f){_0x39d83f=_0x39d83f||0xc8;return function(_0x5f02e7){if(_0x5f02e7){return _0x42ad8f[_0x682e('0x16')](_0x39d83f)[_0x682e('0x18')](_0x5f02e7);}};}function respondWithFilteredResult(_0xdba21b,_0x49356a){return function(_0x201a0e){if(_0x201a0e){var _0x5c8c5e=typeof _0x49356a['offset']===_0x682e('0x19')&&typeof _0x49356a[_0x682e('0x1a')]==='undefined';var _0xdeb030=_0x201a0e['count'];var _0x1c21ab=_0x5c8c5e?0x0:_0x49356a[_0x682e('0x1b')];var _0x144e2b=_0x5c8c5e?_0x201a0e[_0x682e('0x1c')]:_0x49356a[_0x682e('0x1b')]+_0x49356a['limit'];var _0x1f6ed4;if(_0x144e2b>=_0xdeb030){_0x144e2b=_0xdeb030;_0x1f6ed4=0xc8;}else{_0x1f6ed4=0xce;}_0xdba21b[_0x682e('0x16')](_0x1f6ed4);return _0xdba21b[_0x682e('0x1d')](_0x682e('0x1e'),_0x1c21ab+'-'+_0x144e2b+'/'+_0xdeb030)['json'](_0x201a0e);}return null;};}function patchUpdates(_0x2a2c5c){return function(_0x6be410){try{jsonpatch[_0x682e('0x1f')](_0x6be410,_0x2a2c5c,!![]);}catch(_0x277ac4){return BPromise[_0x682e('0x20')](_0x277ac4);}return _0x6be410[_0x682e('0x21')]();};}function saveUpdates(_0x53993e,_0x5f7a0f){return function(_0x30b209){if(_0x30b209){return _0x30b209[_0x682e('0x22')](_0x53993e)['then'](function(_0x2aecc4){return _0x2aecc4;});}return null;};}function removeEntity(_0x1efcf6,_0x5bcc9d){return function(_0x571bd9){if(_0x571bd9){return _0x571bd9[_0x682e('0x23')]()[_0x682e('0x24')](function(){var _0x8c73d1=_0x571bd9[_0x682e('0x25')]({'plain':!![]});var _0x11a882='Sounds';return db[_0x682e('0x26')][_0x682e('0x23')]({'where':{'type':_0x11a882,'resourceId':_0x8c73d1['id']}})['then'](function(){return _0x571bd9;});})['then'](function(){_0x1efcf6[_0x682e('0x16')](0xcc)[_0x682e('0x17')]();});}};}function handleEntityNotFound(_0x13ad01,_0x485b4c){return function(_0x51ebbf){if(!_0x51ebbf){_0x13ad01[_0x682e('0x27')](0x194);}return _0x51ebbf;};}function handleError(_0x1a4b1a,_0x545a91){_0x545a91=_0x545a91||0x1f4;return function(_0x2cedbb){logger[_0x682e('0x28')](_0x2cedbb[_0x682e('0x29')]);if(_0x2cedbb['name']){delete _0x2cedbb[_0x682e('0x2a')];}_0x1a4b1a['status'](_0x545a91)[_0x682e('0x2b')](_0x2cedbb);};}function getMustacheRender(_0xa96940,_0x178ecc){return Mustache[_0x682e('0x2c')](_0xa96940,_[_0x682e('0x2d')](_0x178ecc['body'],{'contact':_0x178ecc[_0x682e('0x2e')],'message':_0x178ecc[_0x682e('0x2f')],'agent':_0x178ecc[_0x682e('0x30')],'interaction':_0x178ecc['interaction'],'account':_0x178ecc[_0x682e('0x31')]}))||'';}exports[_0x682e('0x32')]=function(_0x5f31c9,_0x4c608c){var _0x32f2d6={},_0x5312c4={},_0x28cac9={'count':0x0,'rows':[]};var _0x297fbd=_['map'](db[_0x682e('0x33')][_0x682e('0x34')],function(_0x49357e){return{'name':_0x49357e['fieldName'],'type':_0x49357e[_0x682e('0x35')][_0x682e('0x36')]};});_0x5312c4[_0x682e('0x37')]=_[_0x682e('0x38')](_0x297fbd,_0x682e('0x2a'));_0x5312c4[_0x682e('0x39')]=_[_0x682e('0x3a')](_0x5f31c9[_0x682e('0x39')]);_0x5312c4[_0x682e('0x3b')]=_[_0x682e('0x3c')](_0x5312c4['model'],_0x5312c4[_0x682e('0x39')]);_0x32f2d6[_0x682e('0x3d')]=_[_0x682e('0x3c')](_0x5312c4[_0x682e('0x37')],qs['fields'](_0x5f31c9[_0x682e('0x39')]['fields']));_0x32f2d6['attributes']=_0x32f2d6[_0x682e('0x3d')][_0x682e('0x3e')]?_0x32f2d6[_0x682e('0x3d')]:_0x5312c4[_0x682e('0x37')];if(!_0x5f31c9[_0x682e('0x39')][_0x682e('0x3f')](_0x682e('0x40'))){_0x32f2d6['limit']=qs['limit'](_0x5f31c9['query'][_0x682e('0x1a')]);_0x32f2d6[_0x682e('0x1b')]=qs[_0x682e('0x1b')](_0x5f31c9['query'][_0x682e('0x1b')]);}_0x32f2d6[_0x682e('0x41')]=qs[_0x682e('0x42')](_0x5f31c9[_0x682e('0x39')][_0x682e('0x42')]);_0x32f2d6['where']=qs[_0x682e('0x3b')](_[_0x682e('0x43')](_0x5f31c9[_0x682e('0x39')],_0x5312c4[_0x682e('0x3b')]),_0x297fbd);if(_0x5f31c9['query'][_0x682e('0x44')]){_0x32f2d6[_0x682e('0x45')]=_[_0x682e('0x2d')](_0x32f2d6['where'],{'$or':_['map'](_0x297fbd,function(_0x4dc455){if(_0x4dc455[_0x682e('0x35')]!==_0x682e('0x46')){var _0x59694b={};_0x59694b[_0x4dc455['name']]={'$like':'%'+_0x5f31c9['query'][_0x682e('0x44')]+'%'};return _0x59694b;}})});}_0x32f2d6=_[_0x682e('0x2d')]({},_0x32f2d6,_0x5f31c9[_0x682e('0x47')]);var _0x837eaf={'where':_0x32f2d6[_0x682e('0x45')]};return db[_0x682e('0x33')]['count'](_0x837eaf)[_0x682e('0x24')](function(_0x389c78){_0x28cac9['count']=_0x389c78;if(_0x5f31c9[_0x682e('0x39')][_0x682e('0x48')]){_0x32f2d6[_0x682e('0x49')]=[{'all':!![]}];}return db[_0x682e('0x33')][_0x682e('0x4a')](_0x32f2d6);})[_0x682e('0x24')](function(_0x47cc7a){_0x28cac9[_0x682e('0x4b')]=_0x47cc7a;return _0x28cac9;})[_0x682e('0x24')](respondWithFilteredResult(_0x4c608c,_0x32f2d6))[_0x682e('0x4c')](handleError(_0x4c608c,null));};exports[_0x682e('0x4d')]=function(_0x373e8c,_0x546931){var _0x4bcd33={'raw':!![],'where':{'id':_0x373e8c['params']['id']}},_0x18add2={};_0x18add2[_0x682e('0x37')]=_[_0x682e('0x3a')](db['Sound'][_0x682e('0x34')]);_0x18add2['query']=_[_0x682e('0x3a')](_0x373e8c[_0x682e('0x39')]);_0x18add2[_0x682e('0x3b')]=_[_0x682e('0x3c')](_0x18add2[_0x682e('0x37')],_0x18add2[_0x682e('0x39')]);_0x4bcd33[_0x682e('0x3d')]=_['intersection'](_0x18add2['model'],qs[_0x682e('0x4e')](_0x373e8c[_0x682e('0x39')][_0x682e('0x4e')]));_0x4bcd33[_0x682e('0x3d')]=_0x4bcd33['attributes'][_0x682e('0x3e')]?_0x4bcd33[_0x682e('0x3d')]:_0x18add2[_0x682e('0x37')];if(_0x373e8c[_0x682e('0x39')][_0x682e('0x48')]){_0x4bcd33[_0x682e('0x49')]=[{'all':!![]}];}_0x4bcd33=_['merge']({},_0x4bcd33,_0x373e8c[_0x682e('0x47')]);return db[_0x682e('0x33')][_0x682e('0x4f')](_0x4bcd33)['then'](handleEntityNotFound(_0x546931,null))[_0x682e('0x24')](respondWithResult(_0x546931,null))[_0x682e('0x4c')](handleError(_0x546931,null));};exports[_0x682e('0x50')]=function(_0x22371a,_0x148e90,_0xa1b351){return db['Sound'][_0x682e('0x4f')]({'where':{'id':_0x22371a[_0x682e('0x51')]['id']},'attributes':[_0x682e('0x2a'),_0x682e('0x52'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x148e90,null))[_0x682e('0x24')](function(_0x528b6e){if(_0x528b6e){if(!fs[_0x682e('0x53')](path[_0x682e('0x54')](config[_0x682e('0x55')],'server/files/sounds/converted',_0x528b6e['save_name']+'.'+_0x528b6e['converted_format']))){throw new db['Sequelize'][(_0x682e('0x56'))](_0x682e('0x57'));}return _0x148e90[_0x682e('0x50')](path[_0x682e('0x54')](config['root'],_0x682e('0x58'),util['format'](_0x682e('0x59'),_0x528b6e[_0x682e('0x52')],_0x528b6e[_0x682e('0x5a')])),util['format'](_0x682e('0x59'),_0x528b6e[_0x682e('0x2a')],_0x528b6e[_0x682e('0x5a')]));}return null;})[_0x682e('0x4c')](handleError(_0x148e90,null));};exports[_0x682e('0x5b')]=function(_0x2ba241,_0x134abe,_0x11c0cd){var _0x3287eb={'name':path[_0x682e('0x5c')](_0x2ba241['file']['originalname'],path[_0x682e('0x5d')](_0x2ba241[_0x682e('0x5e')][_0x682e('0x5f')])),'save_name':path[_0x682e('0x5c')](_0x2ba241[_0x682e('0x5e')][_0x682e('0x60')],path[_0x682e('0x5d')](_0x2ba241[_0x682e('0x5e')][_0x682e('0x60')])),'original_format':path[_0x682e('0x5d')](_0x2ba241[_0x682e('0x5e')][_0x682e('0x5f')])[_0x682e('0x61')](0x1),'converted_format':_0x682e('0x62')};var _0x535fc5=path[_0x682e('0x54')](config[_0x682e('0x55')],_0x682e('0x63'),_0x2ba241[_0x682e('0x5e')][_0x682e('0x60')]);var _0x399404=path['join'](config[_0x682e('0x55')],_0x682e('0x58'),util[_0x682e('0x64')]('%s.%s',path['basename'](_0x2ba241[_0x682e('0x5e')]['filename'],path[_0x682e('0x5d')](_0x2ba241[_0x682e('0x5e')][_0x682e('0x60')])),_0x3287eb[_0x682e('0x5a')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x535fc5);logger['info'](_0x682e('0x65'),_0x399404);try{fs[_0x682e('0x66')](_0x535fc5,parseInt('0777',0x8));var _0x47a785=sox['transcode'](_0x535fc5,_0x399404,{'sampleRate':0x1f40,'format':_0x682e('0x62'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x47a785['on'](_0x682e('0x28'),function(_0x2edbaa){fs[_0x682e('0x67')](_0x535fc5);_0x134abe['status'](0x1f4)[_0x682e('0x2b')](_0x2edbaa);});_0x47a785['on']('src',function(_0x531f61){_0x3287eb[_0x682e('0x68')]=isNaN(_0x531f61[_0x682e('0x69')])?null:_0x531f61['duration']*0x3e8;_0x3287eb[_0x682e('0x6a')]=isNaN(_0x531f61[_0x682e('0x6b')])?null:_0x531f61[_0x682e('0x6b')];_0x3287eb[_0x682e('0x6c')]=isNaN(_0x531f61[_0x682e('0x6d')])?null:_0x531f61[_0x682e('0x6d')];_0x3287eb['original_bitRate']=isNaN(_0x531f61['bitRate'])?null:_0x531f61[_0x682e('0x6e')];_0x3287eb[_0x682e('0x6f')]=isNaN(_0x531f61[_0x682e('0x70')])?null:_0x531f61['sampleRate'];});_0x47a785['on'](_0x682e('0x71'),function(_0x24fdf6){_0x3287eb['converted_duration']=isNaN(_0x24fdf6[_0x682e('0x69')])?null:_0x24fdf6[_0x682e('0x69')]*0x3e8;_0x3287eb[_0x682e('0x72')]=isNaN(_0x24fdf6['sampleCount'])?null:_0x24fdf6[_0x682e('0x6b')];_0x3287eb['converted_channelCount']=isNaN(_0x24fdf6['channelCount'])?null:_0x24fdf6[_0x682e('0x6d')];_0x3287eb[_0x682e('0x73')]=isNaN(_0x24fdf6[_0x682e('0x6e')])?null:_0x24fdf6[_0x682e('0x6e')];_0x3287eb['converted_sampleRate']=isNaN(_0x24fdf6[_0x682e('0x70')])?null:_0x24fdf6[_0x682e('0x70')];});_0x47a785['on'](_0x682e('0x17'),function(){fs[_0x682e('0x66')](_0x399404,parseInt(_0x682e('0x74'),0x8));return db[_0x682e('0x33')]['create'](_0x3287eb)[_0x682e('0x24')](function(_0x3750a5){var _0x146b66={'role':_0x2ba241['body'][_0x682e('0x75')],'userProfileId':_0x2ba241[_0x682e('0x76')]['userProfileId']};if(!_0x146b66)throw new Error(_0x682e('0x77'));if(_0x146b66['role']===_0x682e('0x78')){var _0x4647b4=_0x3750a5['get']({'plain':!![]});return db[_0x682e('0x79')][_0x682e('0x4f')]({'where':{'name':'Sounds','userProfileId':_0x146b66[_0x682e('0x7a')]},'raw':!![]})[_0x682e('0x24')](function(_0x5bff9f){if(_0x5bff9f&&_0x5bff9f['autoAssociation']===0x0){return db[_0x682e('0x26')][_0x682e('0x5b')]({'name':_0x4647b4['name'],'resourceId':_0x4647b4['id'],'type':_0x5bff9f['name'],'sectionId':_0x5bff9f['id']},{})[_0x682e('0x24')](function(){return _0x3750a5;});}else{return _0x3750a5;}})[_0x682e('0x4c')](function(_0x441e8a){logger[_0x682e('0x28')](_0x682e('0x7b'),_0x441e8a);throw _0x441e8a;});}return _0x3750a5;})['then'](respondWithResult(_0x134abe,null))['catch'](handleError(_0x134abe,null));});_0x47a785[_0x682e('0x7c')]();}catch(_0x3ecc02){_0x134abe['status'](0x1f4)['send'](_0x3ecc02);}};exports[_0x682e('0x22')]=function(_0x7244d6,_0x1d3c2b,_0x120ea4){return db[_0x682e('0x33')]['find']({'where':{'id':_0x7244d6[_0x682e('0x51')]['id']}})[_0x682e('0x24')](handleEntityNotFound(_0x1d3c2b,null))[_0x682e('0x24')](saveUpdates(_[_0x682e('0x43')](_0x7244d6[_0x682e('0x76')],['name',_0x682e('0x7d')]),null))[_0x682e('0x24')](respondWithResult(_0x1d3c2b,null))[_0x682e('0x4c')](handleError(_0x1d3c2b,null));};exports[_0x682e('0x7e')]=function(_0x25c49e,_0x45e6de,_0x276f56){return db[_0x682e('0x33')][_0x682e('0x4f')]({'where':{'id':_0x25c49e['params']['id']}})[_0x682e('0x24')](function(_0x31d67f){if(_0x31d67f){return _0x31d67f['destroy']();}})[_0x682e('0x24')](function(_0x323363){var _0x3df458=path[_0x682e('0x54')](config[_0x682e('0x55')],_0x682e('0x63'),util['format'](_0x682e('0x59'),_0x323363[_0x682e('0x52')],_0x323363[_0x682e('0x7f')]));var _0x17228b=path[_0x682e('0x54')](config[_0x682e('0x55')],_0x682e('0x58'),util[_0x682e('0x64')](_0x682e('0x59'),_0x323363[_0x682e('0x52')],_0x323363[_0x682e('0x5a')]));fs[_0x682e('0x67')](_0x3df458);fs[_0x682e('0x67')](_0x17228b);return _0x323363;})[_0x682e('0x24')](function(_0x396490){if(_0x396490){return _0x45e6de[_0x682e('0x16')](0xcc)[_0x682e('0x17')]();}})['then'](handleEntityNotFound(_0x45e6de,null))['catch'](handleError(_0x45e6de,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index c51c702..a4de203 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 _0xede6=['tools_sounds','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./sound.attributes','Sound'];(function(_0x1d0c7e,_0x40b36c){var _0x30cf02=function(_0x2c8b55){while(--_0x2c8b55){_0x1d0c7e['push'](_0x1d0c7e['shift']());}};_0x30cf02(++_0x40b36c);}(_0xede6,0x6f));var _0x6ede=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xede6[_0x47e7cb];return _0x2a8874;};'use strict';var _=require('lodash');var util=require(_0x6ede('0x0'));var logger=require(_0x6ede('0x1'))(_0x6ede('0x2'));var moment=require('moment');var BPromise=require(_0x6ede('0x3'));var rp=require(_0x6ede('0x4'));var fs=require('fs');var path=require(_0x6ede('0x5'));var rimraf=require(_0x6ede('0x6'));var config=require('../../config/environment');var attributes=require(_0x6ede('0x7'));module['exports']=function(_0x24000d,_0x4c6e2d){return _0x24000d['define'](_0x6ede('0x8'),attributes,{'tableName':_0x6ede('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc38c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api'];(function(_0x13634e,_0x5de6a9){var _0x4b27c0=function(_0xf703a1){while(--_0xf703a1){_0x13634e['push'](_0x13634e['shift']());}};_0x4b27c0(++_0x5de6a9);}(_0xc38c,0x10a));var _0xcc38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc38c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcc38('0x0'));var util=require(_0xcc38('0x1'));var logger=require(_0xcc38('0x2'))(_0xcc38('0x3'));var moment=require(_0xcc38('0x4'));var BPromise=require(_0xcc38('0x5'));var rp=require(_0xcc38('0x6'));var fs=require('fs');var path=require(_0xcc38('0x7'));var rimraf=require(_0xcc38('0x8'));var config=require(_0xcc38('0x9'));var attributes=require(_0xcc38('0xa'));module[_0xcc38('0xb')]=function(_0x52f31c,_0x23e9a9){return _0x52f31c[_0xcc38('0xc')](_0xcc38('0xd'),attributes,{'tableName':_0xcc38('0xe'),'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 8ed5f01..fef1261 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 _0x03d9=['Sound','find','options','raw','where','attributes','include','map','model','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Sound,\x20%s,\x20%s','message','result','ShowSound'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x03d9,0x197));var _0x903d=function(_0x3bff7b,_0x5ca740){_0x3bff7b=_0x3bff7b-0x0;var _0x3c55aa=_0x03d9[_0x3bff7b];return _0x3c55aa;};'use strict';var _=require(_0x903d('0x0'));var util=require(_0x903d('0x1'));var moment=require(_0x903d('0x2'));var BPromise=require(_0x903d('0x3'));var rs=require(_0x903d('0x4'));var fs=require('fs');var Redis=require(_0x903d('0x5'));var db=require(_0x903d('0x6'))['db'];var utils=require(_0x903d('0x7'));var logger=require(_0x903d('0x8'))(_0x903d('0x9'));var config=require(_0x903d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x903d('0xb')][_0x903d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x27da84,_0x322619,_0x42b07b){return new BPromise(function(_0x3ebbf9,_0x28fb33){return client[_0x903d('0xd')](_0x27da84,_0x42b07b)[_0x903d('0xe')](function(_0x1f8781){logger['info']('Sound,\x20%s,\x20%s',_0x322619,'request\x20sent');logger[_0x903d('0xf')](_0x903d('0x10'),_0x322619,_0x903d('0x11'),JSON[_0x903d('0x12')](_0x1f8781));if(_0x1f8781[_0x903d('0x13')]){if(_0x1f8781[_0x903d('0x13')][_0x903d('0x14')]===0x1f4){logger[_0x903d('0x13')](_0x903d('0x15'),_0x322619,_0x1f8781[_0x903d('0x13')][_0x903d('0x16')]);return _0x28fb33(_0x1f8781[_0x903d('0x13')]['message']);}logger[_0x903d('0x13')](_0x903d('0x15'),_0x322619,_0x1f8781[_0x903d('0x13')][_0x903d('0x16')]);return _0x3ebbf9(_0x1f8781['error'][_0x903d('0x16')]);}else{logger['info'](_0x903d('0x15'),_0x322619,_0x903d('0x11'));_0x3ebbf9(_0x1f8781[_0x903d('0x17')][_0x903d('0x16')]);}})['catch'](function(_0x5ad29b){logger[_0x903d('0x13')]('Sound,\x20%s,\x20%s',_0x322619,_0x5ad29b);_0x28fb33(_0x5ad29b);});});}exports[_0x903d('0x18')]=function(_0x5e283c){var _0xa88522=this;return new Promise(function(_0x5decc3,_0x26e9d8){return db[_0x903d('0x19')][_0x903d('0x1a')]({'raw':_0x5e283c[_0x903d('0x1b')]?_0x5e283c[_0x903d('0x1b')][_0x903d('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e283c['options']?_0x5e283c[_0x903d('0x1b')][_0x903d('0x1d')]||null:null,'attributes':_0x5e283c[_0x903d('0x1b')]?_0x5e283c[_0x903d('0x1b')][_0x903d('0x1e')]||null:null,'include':_0x5e283c[_0x903d('0x1b')]?_0x5e283c[_0x903d('0x1b')][_0x903d('0x1f')]?_[_0x903d('0x20')](_0x5e283c[_0x903d('0x1b')]['include'],function(_0x5caf66){return{'model':db[_0x5caf66[_0x903d('0x21')]],'as':_0x5caf66['as'],'attributes':_0x5caf66[_0x903d('0x1e')],'include':_0x5caf66[_0x903d('0x1f')]?_[_0x903d('0x20')](_0x5caf66[_0x903d('0x1f')],function(_0x20ab3a){return{'model':db[_0x20ab3a[_0x903d('0x21')]],'as':_0x20ab3a['as'],'attributes':_0x20ab3a[_0x903d('0x1e')],'include':_0x20ab3a['include']?_[_0x903d('0x20')](_0x20ab3a[_0x903d('0x1f')],function(_0x5aa910){return{'model':db[_0x5aa910[_0x903d('0x21')]],'as':_0x5aa910['as'],'attributes':_0x5aa910[_0x903d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7e3d10){logger[_0x903d('0x22')]('ShowSound',_0x5e283c);logger['debug'](_0x903d('0x18'),_0x5e283c,JSON[_0x903d('0x12')](_0x7e3d10));_0x5decc3(_0x7e3d10);})[_0x903d('0x23')](function(_0x444dfd){logger[_0x903d('0x13')]('ShowSound',_0x444dfd['message'],_0x5e283c);_0x26e9d8(_0xa88522[_0x903d('0x13')](0x1f4,_0x444dfd[_0x903d('0x16')]));});});}; \ No newline at end of file +var _0x1b07=['Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','then','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code'];(function(_0x2d9e90,_0x5dcc72){var _0x54695f=function(_0xc3b3){while(--_0xc3b3){_0x2d9e90['push'](_0x2d9e90['shift']());}};_0x54695f(++_0x5dcc72);}(_0x1b07,0x142));var _0x71b0=function(_0x15f3c0,_0x165a64){_0x15f3c0=_0x15f3c0-0x0;var _0x1adfe0=_0x1b07[_0x15f3c0];return _0x1adfe0;};'use strict';var _=require(_0x71b0('0x0'));var util=require(_0x71b0('0x1'));var moment=require(_0x71b0('0x2'));var BPromise=require('bluebird');var rs=require(_0x71b0('0x3'));var fs=require('fs');var Redis=require(_0x71b0('0x4'));var db=require(_0x71b0('0x5'))['db'];var utils=require(_0x71b0('0x6'));var logger=require(_0x71b0('0x7'))(_0x71b0('0x8'));var config=require('../../config/environment');var jayson=require(_0x71b0('0x9'));var client=jayson[_0x71b0('0xa')][_0x71b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x283be1,_0x424430,_0x993225){return new BPromise(function(_0x1b06e6,_0x1d6419){return client[_0x71b0('0xc')](_0x283be1,_0x993225)['then'](function(_0x1a677c){logger[_0x71b0('0xd')]('Sound,\x20%s,\x20%s',_0x424430,_0x71b0('0xe'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x424430,_0x71b0('0xe'),JSON[_0x71b0('0xf')](_0x1a677c));if(_0x1a677c[_0x71b0('0x10')]){if(_0x1a677c[_0x71b0('0x10')][_0x71b0('0x11')]===0x1f4){logger[_0x71b0('0x10')](_0x71b0('0x12'),_0x424430,_0x1a677c[_0x71b0('0x10')][_0x71b0('0x13')]);return _0x1d6419(_0x1a677c[_0x71b0('0x10')][_0x71b0('0x13')]);}logger[_0x71b0('0x10')](_0x71b0('0x12'),_0x424430,_0x1a677c[_0x71b0('0x10')][_0x71b0('0x13')]);return _0x1b06e6(_0x1a677c[_0x71b0('0x10')][_0x71b0('0x13')]);}else{logger[_0x71b0('0xd')](_0x71b0('0x12'),_0x424430,_0x71b0('0xe'));_0x1b06e6(_0x1a677c[_0x71b0('0x14')][_0x71b0('0x13')]);}})[_0x71b0('0x15')](function(_0x48e91b){logger[_0x71b0('0x10')](_0x71b0('0x12'),_0x424430,_0x48e91b);_0x1d6419(_0x48e91b);});});}exports[_0x71b0('0x16')]=function(_0x1c5b11){var _0x2e4c88=this;return new Promise(function(_0x535e9a,_0x1d7436){return db[_0x71b0('0x17')][_0x71b0('0x18')]({'raw':_0x1c5b11[_0x71b0('0x19')]?_0x1c5b11[_0x71b0('0x19')][_0x71b0('0x1a')]===undefined?!![]:![]:!![],'where':_0x1c5b11['options']?_0x1c5b11[_0x71b0('0x19')][_0x71b0('0x1b')]||null:null,'attributes':_0x1c5b11[_0x71b0('0x19')]?_0x1c5b11['options'][_0x71b0('0x1c')]||null:null,'include':_0x1c5b11[_0x71b0('0x19')]?_0x1c5b11[_0x71b0('0x19')][_0x71b0('0x1d')]?_[_0x71b0('0x1e')](_0x1c5b11[_0x71b0('0x19')][_0x71b0('0x1d')],function(_0x110c0b){return{'model':db[_0x110c0b[_0x71b0('0x1f')]],'as':_0x110c0b['as'],'attributes':_0x110c0b[_0x71b0('0x1c')],'include':_0x110c0b[_0x71b0('0x1d')]?_['map'](_0x110c0b[_0x71b0('0x1d')],function(_0x4076af){return{'model':db[_0x4076af[_0x71b0('0x1f')]],'as':_0x4076af['as'],'attributes':_0x4076af['attributes'],'include':_0x4076af[_0x71b0('0x1d')]?_[_0x71b0('0x1e')](_0x4076af['include'],function(_0x2b4ce7){return{'model':db[_0x2b4ce7[_0x71b0('0x1f')]],'as':_0x2b4ce7['as'],'attributes':_0x2b4ce7[_0x71b0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x71b0('0x20')](function(_0xdff3ee){logger[_0x71b0('0xd')](_0x71b0('0x16'),_0x1c5b11);logger[_0x71b0('0x21')](_0x71b0('0x16'),_0x1c5b11,JSON[_0x71b0('0xf')](_0xdff3ee));_0x535e9a(_0xdff3ee);})[_0x71b0('0x15')](function(_0x185bfc){logger[_0x71b0('0x10')](_0x71b0('0x16'),_0x185bfc['message'],_0x1c5b11);_0x1d7436(_0x2e4c88[_0x71b0('0x10')](0x1f4,_0x185bfc[_0x71b0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 9801028..51eeb7a 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 _0xae03=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','show','post','create','/:id','update'];(function(_0x3ef065,_0x16cd7f){var _0x394b5d=function(_0x2e4a88){while(--_0x2e4a88){_0x3ef065['push'](_0x3ef065['shift']());}};_0x394b5d(++_0x16cd7f);}(_0xae03,0xf2));var _0x3ae0=function(_0x11e718,_0x1eb69b){_0x11e718=_0x11e718-0x0;var _0x4522a2=_0xae03[_0x11e718];return _0x4522a2;};'use strict';var multer=require(_0x3ae0('0x0'));var util=require(_0x3ae0('0x1'));var path=require(_0x3ae0('0x2'));var timeout=require(_0x3ae0('0x3'));var express=require(_0x3ae0('0x4'));var router=express[_0x3ae0('0x5')]();var fs_extra=require(_0x3ae0('0x6'));var auth=require(_0x3ae0('0x7'));var interaction=require(_0x3ae0('0x8'));var config=require(_0x3ae0('0x9'));var controller=require(_0x3ae0('0xa'));router[_0x3ae0('0xb')]('/',auth[_0x3ae0('0xc')](),controller['index']);router[_0x3ae0('0xb')]('/:id',auth[_0x3ae0('0xc')](),controller[_0x3ae0('0xd')]);router[_0x3ae0('0xe')]('/',auth[_0x3ae0('0xc')](),controller[_0x3ae0('0xf')]);router['put'](_0x3ae0('0x10'),auth[_0x3ae0('0xc')](),controller[_0x3ae0('0x11')]);router[_0x3ae0('0x12')](_0x3ae0('0x10'),auth['isAuthenticated'](),controller[_0x3ae0('0x13')]);module['exports']=router; \ No newline at end of file +var _0xafc8=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','post','create','put','delete','destroy','multer','path','express','fs-extra'];(function(_0xb2e01d,_0x28c6a0){var _0x595ae0=function(_0x3ec1c4){while(--_0x3ec1c4){_0xb2e01d['push'](_0xb2e01d['shift']());}};_0x595ae0(++_0x28c6a0);}(_0xafc8,0x7a));var _0x8afc=function(_0x5ca53c,_0x2f831d){_0x5ca53c=_0x5ca53c-0x0;var _0xde810b=_0xafc8[_0x5ca53c];return _0xde810b;};'use strict';var multer=require(_0x8afc('0x0'));var util=require('util');var path=require(_0x8afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x8afc('0x2'));var router=express['Router']();var fs_extra=require(_0x8afc('0x3'));var auth=require(_0x8afc('0x4'));var interaction=require(_0x8afc('0x5'));var config=require('../../config/environment');var controller=require('./squareMessage.controller');router[_0x8afc('0x6')]('/',auth[_0x8afc('0x7')](),controller['index']);router[_0x8afc('0x6')](_0x8afc('0x8'),auth[_0x8afc('0x7')](),controller['show']);router[_0x8afc('0x9')]('/',auth[_0x8afc('0x7')](),controller[_0x8afc('0xa')]);router[_0x8afc('0xb')](_0x8afc('0x8'),auth[_0x8afc('0x7')](),controller['update']);router[_0x8afc('0xc')](_0x8afc('0x8'),auth[_0x8afc('0x7')](),controller[_0x8afc('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index d98b476..b5d6c93 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 _0xa41a=['out','STRING','sequelize','exports','TEXT','medium','ENUM'];(function(_0x3dde80,_0x1224ee){var _0x310234=function(_0x307889){while(--_0x307889){_0x3dde80['push'](_0x3dde80['shift']());}};_0x310234(++_0x1224ee);}(_0xa41a,0x6b));var _0xaa41=function(_0x436d02,_0x129be){_0x436d02=_0x436d02-0x0;var _0x518b27=_0xa41a[_0x436d02];return _0x518b27;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xaa41('0x2')](_0xaa41('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xaa41('0x4')]('in',_0xaa41('0x5')),'defaultValue':_0xaa41('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xaa41('0x6')]},'providerResponse':{'type':Sequelize[_0xaa41('0x2')]}}; \ No newline at end of file +var _0x6b8f=['exports','TEXT','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0xc997c3,_0x436bc2){_0xc997c3=_0xc997c3-0x0;var _0x178b81=_0x6b8f[_0xc997c3];return _0x178b81;};'use strict';var Sequelize=require('sequelize');module[_0xf6b8('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xf6b8('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf6b8('0x2')),'defaultValue':_0xf6b8('0x2'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf6b8('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 57f5d49..5c387d9 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 _0x9197=['destroy','sendStatus','error','stack','name','send','merge','body','contact','message','agent','interaction','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','SquareMessage','findAll','rows','then','catch','show','params','model','length','find','create','update','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','reject','save'];(function(_0x470355,_0x1ac646){var _0xcf3b7c=function(_0x36d662){while(--_0x36d662){_0x470355['push'](_0x470355['shift']());}};_0xcf3b7c(++_0x1ac646);}(_0x9197,0xc5));var _0x7919=function(_0x1f041b,_0x51e9c2){_0x1f041b=_0x1f041b-0x0;var _0x4ea92c=_0x9197[_0x1f041b];return _0x4ea92c;};'use strict';var emlformat=require(_0x7919('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7919('0x1'));var rp=require('request-promise');var moment=require(_0x7919('0x2'));var BPromise=require(_0x7919('0x3'));var Mustache=require(_0x7919('0x4'));var util=require(_0x7919('0x5'));var path=require(_0x7919('0x6'));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(_0x7919('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7919('0x8'));var deskjs=require(_0x7919('0x9'));var toCsv=require(_0x7919('0xa'));var querystring=require(_0x7919('0xb'));var Papa=require(_0x7919('0xc'));var Redis=require(_0x7919('0xd'));var authService=require(_0x7919('0xe'));var qs=require(_0x7919('0xf'));var as=require(_0x7919('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7919('0x11'));var utils=require(_0x7919('0x12'));var config=require(_0x7919('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7919('0x14'))['db'];function respondWithStatusCode(_0x2f19c3,_0x237551){_0x237551=_0x237551||0xcc;return function(_0x4c1c51){if(_0x4c1c51){return _0x2f19c3['sendStatus'](_0x237551);}return _0x2f19c3[_0x7919('0x15')](_0x237551)[_0x7919('0x16')]();};}function respondWithResult(_0x26661b,_0x223c86){_0x223c86=_0x223c86||0xc8;return function(_0x516fde){if(_0x516fde){return _0x26661b['status'](_0x223c86)['json'](_0x516fde);}};}function respondWithFilteredResult(_0x34ee18,_0x27fe15){return function(_0x3d78de){if(_0x3d78de){var _0x501544=typeof _0x27fe15[_0x7919('0x17')]===_0x7919('0x18')&&typeof _0x27fe15['limit']===_0x7919('0x18');var _0x3428b1=_0x3d78de['count'];var _0x29eea3=_0x501544?0x0:_0x27fe15['offset'];var _0xce9312=_0x501544?_0x3d78de[_0x7919('0x19')]:_0x27fe15['offset']+_0x27fe15['limit'];var _0x3c615b;if(_0xce9312>=_0x3428b1){_0xce9312=_0x3428b1;_0x3c615b=0xc8;}else{_0x3c615b=0xce;}_0x34ee18[_0x7919('0x15')](_0x3c615b);return _0x34ee18['set']('Content-Range',_0x29eea3+'-'+_0xce9312+'/'+_0x3428b1)['json'](_0x3d78de);}return null;};}function patchUpdates(_0x4998ca){return function(_0x4ad651){try{jsonpatch['apply'](_0x4ad651,_0x4998ca,!![]);}catch(_0x3fcd97){return BPromise[_0x7919('0x1a')](_0x3fcd97);}return _0x4ad651[_0x7919('0x1b')]();};}function saveUpdates(_0x5280db,_0xaca0ab){return function(_0x307869){if(_0x307869){return _0x307869['update'](_0x5280db)['then'](function(_0x9d5f64){return _0x9d5f64;});}return null;};}function removeEntity(_0x12fafc,_0x3b39c6){return function(_0x1fa473){if(_0x1fa473){return _0x1fa473[_0x7919('0x1c')]()['then'](function(){_0x12fafc['status'](0xcc)[_0x7919('0x16')]();});}};}function handleEntityNotFound(_0x1ecc90,_0x1c1c85){return function(_0x4abd0c){if(!_0x4abd0c){_0x1ecc90[_0x7919('0x1d')](0x194);}return _0x4abd0c;};}function handleError(_0x6cfd23,_0x1b32a7){_0x1b32a7=_0x1b32a7||0x1f4;return function(_0x53e582){logger[_0x7919('0x1e')](_0x53e582[_0x7919('0x1f')]);if(_0x53e582[_0x7919('0x20')]){delete _0x53e582['name'];}_0x6cfd23[_0x7919('0x15')](_0x1b32a7)[_0x7919('0x21')](_0x53e582);};}function getMustacheRender(_0x4cf998,_0x558487){return Mustache['render'](_0x4cf998,_[_0x7919('0x22')](_0x558487[_0x7919('0x23')],{'contact':_0x558487[_0x7919('0x24')],'message':_0x558487[_0x7919('0x25')],'agent':_0x558487[_0x7919('0x26')],'interaction':_0x558487[_0x7919('0x27')],'account':_0x558487['account']}))||'';}exports[_0x7919('0x28')]=function(_0x205179,_0x33d98c){var _0x38415b={},_0x32ba98={},_0x3077aa={'count':0x0,'rows':[]};var _0x51b149=_[_0x7919('0x29')](db['SquareMessage'][_0x7919('0x2a')],function(_0x5db431){return{'name':_0x5db431[_0x7919('0x2b')],'type':_0x5db431['type'][_0x7919('0x2c')]};});_0x32ba98['model']=_[_0x7919('0x29')](_0x51b149,_0x7919('0x20'));_0x32ba98[_0x7919('0x2d')]=_[_0x7919('0x2e')](_0x205179[_0x7919('0x2d')]);_0x32ba98[_0x7919('0x2f')]=_[_0x7919('0x30')](_0x32ba98['model'],_0x32ba98[_0x7919('0x2d')]);_0x38415b['attributes']=_['intersection'](_0x32ba98['model'],qs['fields'](_0x205179[_0x7919('0x2d')][_0x7919('0x31')]));_0x38415b[_0x7919('0x32')]=_0x38415b[_0x7919('0x32')]['length']?_0x38415b['attributes']:_0x32ba98['model'];if(!_0x205179[_0x7919('0x2d')][_0x7919('0x33')](_0x7919('0x34'))){_0x38415b['limit']=qs['limit'](_0x205179['query'][_0x7919('0x35')]);_0x38415b[_0x7919('0x17')]=qs[_0x7919('0x17')](_0x205179[_0x7919('0x2d')]['offset']);}_0x38415b[_0x7919('0x36')]=qs['sort'](_0x205179[_0x7919('0x2d')][_0x7919('0x37')]);_0x38415b[_0x7919('0x38')]=qs[_0x7919('0x2f')](_[_0x7919('0x39')](_0x205179[_0x7919('0x2d')],_0x32ba98[_0x7919('0x2f')]),_0x51b149);if(_0x205179[_0x7919('0x2d')][_0x7919('0x3a')]){_0x38415b[_0x7919('0x38')]=_['merge'](_0x38415b['where'],{'$or':_[_0x7919('0x29')](_0x51b149,function(_0x504164){if(_0x504164['type']!==_0x7919('0x3b')){var _0x44ff3d={};_0x44ff3d[_0x504164[_0x7919('0x20')]]={'$like':'%'+_0x205179[_0x7919('0x2d')][_0x7919('0x3a')]+'%'};return _0x44ff3d;}})});}_0x38415b=_[_0x7919('0x22')]({},_0x38415b,_0x205179[_0x7919('0x3c')]);var _0x38169d={'where':_0x38415b[_0x7919('0x38')]};return db['SquareMessage']['count'](_0x38169d)['then'](function(_0x5aaa90){_0x3077aa[_0x7919('0x19')]=_0x5aaa90;if(_0x205179[_0x7919('0x2d')][_0x7919('0x3d')]){_0x38415b[_0x7919('0x3e')]=[{'all':!![]}];}return db[_0x7919('0x3f')][_0x7919('0x40')](_0x38415b);})['then'](function(_0x4b077c){_0x3077aa[_0x7919('0x41')]=_0x4b077c;return _0x3077aa;})[_0x7919('0x42')](respondWithFilteredResult(_0x33d98c,_0x38415b))[_0x7919('0x43')](handleError(_0x33d98c,null));};exports[_0x7919('0x44')]=function(_0xb74397,_0x183396){var _0x1428f0={'raw':!![],'where':{'id':_0xb74397[_0x7919('0x45')]['id']}},_0x9e691b={};_0x9e691b['model']=_[_0x7919('0x2e')](db[_0x7919('0x3f')][_0x7919('0x2a')]);_0x9e691b[_0x7919('0x2d')]=_[_0x7919('0x2e')](_0xb74397[_0x7919('0x2d')]);_0x9e691b['filters']=_[_0x7919('0x30')](_0x9e691b[_0x7919('0x46')],_0x9e691b[_0x7919('0x2d')]);_0x1428f0[_0x7919('0x32')]=_[_0x7919('0x30')](_0x9e691b['model'],qs[_0x7919('0x31')](_0xb74397[_0x7919('0x2d')][_0x7919('0x31')]));_0x1428f0[_0x7919('0x32')]=_0x1428f0[_0x7919('0x32')][_0x7919('0x47')]?_0x1428f0[_0x7919('0x32')]:_0x9e691b[_0x7919('0x46')];if(_0xb74397[_0x7919('0x2d')][_0x7919('0x3d')]){_0x1428f0[_0x7919('0x3e')]=[{'all':!![]}];}_0x1428f0=_[_0x7919('0x22')]({},_0x1428f0,_0xb74397[_0x7919('0x3c')]);return db[_0x7919('0x3f')][_0x7919('0x48')](_0x1428f0)[_0x7919('0x42')](handleEntityNotFound(_0x183396,null))['then'](respondWithResult(_0x183396,null))[_0x7919('0x43')](handleError(_0x183396,null));};exports[_0x7919('0x49')]=function(_0x610e34,_0x4cf942){return db[_0x7919('0x3f')]['create'](_0x610e34[_0x7919('0x23')],{})['then'](respondWithResult(_0x4cf942,0xc9))[_0x7919('0x43')](handleError(_0x4cf942,null));};exports[_0x7919('0x4a')]=function(_0x28c6ad,_0x272582){if(_0x28c6ad[_0x7919('0x23')]['id']){delete _0x28c6ad[_0x7919('0x23')]['id'];}return db['SquareMessage'][_0x7919('0x48')]({'where':{'id':_0x28c6ad[_0x7919('0x45')]['id']}})['then'](handleEntityNotFound(_0x272582,null))[_0x7919('0x42')](saveUpdates(_0x28c6ad[_0x7919('0x23')],null))['then'](respondWithResult(_0x272582,null))['catch'](handleError(_0x272582,null));};exports['destroy']=function(_0xb8311a,_0xaa7e9){return db[_0x7919('0x3f')][_0x7919('0x48')]({'where':{'id':_0xb8311a[_0x7919('0x45')]['id']}})[_0x7919('0x42')](handleEntityNotFound(_0xaa7e9,null))[_0x7919('0x42')](removeEntity(_0xaa7e9,null))['catch'](handleError(_0xaa7e9,null));}; \ No newline at end of file +var _0x525e=['then','rows','catch','include','create','params','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','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','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','error','merge','body','message','interaction','index','map','SquareMessage','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','name','options','includeAll','findAll'];(function(_0x9af7ad,_0x326b02){var _0x14e368=function(_0x55d28d){while(--_0x55d28d){_0x9af7ad['push'](_0x9af7ad['shift']());}};_0x14e368(++_0x326b02);}(_0x525e,0x1bd));var _0xe525=function(_0x367f90,_0x390d3){_0x367f90=_0x367f90-0x0;var _0xfb9cfe=_0x525e[_0x367f90];return _0xfb9cfe;};'use strict';var emlformat=require(_0xe525('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe525('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe525('0x2'));var moment=require(_0xe525('0x3'));var BPromise=require(_0xe525('0x4'));var Mustache=require(_0xe525('0x5'));var util=require(_0xe525('0x6'));var path=require(_0xe525('0x7'));var sox=require('sox');var csv=require(_0xe525('0x8'));var ejs=require(_0xe525('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe525('0xa'));var squel=require(_0xe525('0xb'));var crypto=require('crypto');var jsforce=require(_0xe525('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe525('0x8'));var querystring=require('querystring');var Papa=require(_0xe525('0xd'));var Redis=require('ioredis');var authService=require(_0xe525('0xe'));var qs=require(_0xe525('0xf'));var as=require(_0xe525('0x10'));var hardwareService=require(_0xe525('0x11'));var logger=require(_0xe525('0x12'))(_0xe525('0x13'));var utils=require(_0xe525('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe525('0x15'));var db=require(_0xe525('0x16'))['db'];function respondWithStatusCode(_0x3eb026,_0x5793ef){_0x5793ef=_0x5793ef||0xcc;return function(_0xdcce26){if(_0xdcce26){return _0x3eb026[_0xe525('0x17')](_0x5793ef);}return _0x3eb026[_0xe525('0x18')](_0x5793ef)[_0xe525('0x19')]();};}function respondWithResult(_0x3b2485,_0x4ed119){_0x4ed119=_0x4ed119||0xc8;return function(_0x5a8676){if(_0x5a8676){return _0x3b2485[_0xe525('0x18')](_0x4ed119)[_0xe525('0x1a')](_0x5a8676);}};}function respondWithFilteredResult(_0x32349c,_0x56532b){return function(_0x3cfc62){if(_0x3cfc62){var _0x1bec94=typeof _0x56532b['offset']===_0xe525('0x1b')&&typeof _0x56532b[_0xe525('0x1c')]===_0xe525('0x1b');var _0x3e064a=_0x3cfc62['count'];var _0x47b0eb=_0x1bec94?0x0:_0x56532b['offset'];var _0x38c605=_0x1bec94?_0x3cfc62[_0xe525('0x1d')]:_0x56532b[_0xe525('0x1e')]+_0x56532b[_0xe525('0x1c')];var _0x377abe;if(_0x38c605>=_0x3e064a){_0x38c605=_0x3e064a;_0x377abe=0xc8;}else{_0x377abe=0xce;}_0x32349c['status'](_0x377abe);return _0x32349c[_0xe525('0x1f')](_0xe525('0x20'),_0x47b0eb+'-'+_0x38c605+'/'+_0x3e064a)['json'](_0x3cfc62);}return null;};}function patchUpdates(_0x310350){return function(_0x42f922){try{jsonpatch[_0xe525('0x21')](_0x42f922,_0x310350,!![]);}catch(_0x5bc8ca){return BPromise[_0xe525('0x22')](_0x5bc8ca);}return _0x42f922[_0xe525('0x23')]();};}function saveUpdates(_0x571926,_0x381f70){return function(_0x5d09a){if(_0x5d09a){return _0x5d09a[_0xe525('0x24')](_0x571926)['then'](function(_0x5682a0){return _0x5682a0;});}return null;};}function removeEntity(_0x4aa66f,_0x296bdf){return function(_0x34f7a5){if(_0x34f7a5){return _0x34f7a5[_0xe525('0x25')]()['then'](function(){_0x4aa66f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x390a8c,_0x151fc3){return function(_0x1363ea){if(!_0x1363ea){_0x390a8c[_0xe525('0x17')](0x194);}return _0x1363ea;};}function handleError(_0x3e4002,_0x2f7f7a){_0x2f7f7a=_0x2f7f7a||0x1f4;return function(_0x4c998b){logger[_0xe525('0x26')](_0x4c998b['stack']);if(_0x4c998b['name']){delete _0x4c998b['name'];}_0x3e4002['status'](_0x2f7f7a)['send'](_0x4c998b);};}function getMustacheRender(_0x469ce4,_0x299504){return Mustache['render'](_0x469ce4,_[_0xe525('0x27')](_0x299504[_0xe525('0x28')],{'contact':_0x299504['contact'],'message':_0x299504[_0xe525('0x29')],'agent':_0x299504['agent'],'interaction':_0x299504[_0xe525('0x2a')],'account':_0x299504['account']}))||'';}exports[_0xe525('0x2b')]=function(_0x14d0a9,_0x22b99f){var _0x396f4b={},_0x47d55f={},_0x2f18aa={'count':0x0,'rows':[]};var _0x45acb8=_[_0xe525('0x2c')](db[_0xe525('0x2d')][_0xe525('0x2e')],function(_0x182080){return{'name':_0x182080['fieldName'],'type':_0x182080[_0xe525('0x2f')][_0xe525('0x30')]};});_0x47d55f['model']=_['map'](_0x45acb8,'name');_0x47d55f[_0xe525('0x31')]=_[_0xe525('0x32')](_0x14d0a9[_0xe525('0x31')]);_0x47d55f[_0xe525('0x33')]=_[_0xe525('0x34')](_0x47d55f['model'],_0x47d55f[_0xe525('0x31')]);_0x396f4b[_0xe525('0x35')]=_[_0xe525('0x34')](_0x47d55f[_0xe525('0x36')],qs['fields'](_0x14d0a9[_0xe525('0x31')][_0xe525('0x37')]));_0x396f4b[_0xe525('0x35')]=_0x396f4b[_0xe525('0x35')][_0xe525('0x38')]?_0x396f4b[_0xe525('0x35')]:_0x47d55f[_0xe525('0x36')];if(!_0x14d0a9['query'][_0xe525('0x39')]('nolimit')){_0x396f4b[_0xe525('0x1c')]=qs[_0xe525('0x1c')](_0x14d0a9[_0xe525('0x31')][_0xe525('0x1c')]);_0x396f4b[_0xe525('0x1e')]=qs['offset'](_0x14d0a9[_0xe525('0x31')][_0xe525('0x1e')]);}_0x396f4b[_0xe525('0x3a')]=qs[_0xe525('0x3b')](_0x14d0a9[_0xe525('0x31')][_0xe525('0x3b')]);_0x396f4b['where']=qs[_0xe525('0x33')](_['pick'](_0x14d0a9[_0xe525('0x31')],_0x47d55f[_0xe525('0x33')]),_0x45acb8);if(_0x14d0a9['query']['filter']){_0x396f4b[_0xe525('0x3c')]=_[_0xe525('0x27')](_0x396f4b[_0xe525('0x3c')],{'$or':_['map'](_0x45acb8,function(_0x1f2c5c){if(_0x1f2c5c[_0xe525('0x2f')]!==_0xe525('0x3d')){var _0x22efb1={};_0x22efb1[_0x1f2c5c[_0xe525('0x3e')]]={'$like':'%'+_0x14d0a9['query']['filter']+'%'};return _0x22efb1;}})});}_0x396f4b=_['merge']({},_0x396f4b,_0x14d0a9[_0xe525('0x3f')]);var _0x14ca75={'where':_0x396f4b[_0xe525('0x3c')]};return db[_0xe525('0x2d')][_0xe525('0x1d')](_0x14ca75)['then'](function(_0x245d26){_0x2f18aa['count']=_0x245d26;if(_0x14d0a9[_0xe525('0x31')][_0xe525('0x40')]){_0x396f4b['include']=[{'all':!![]}];}return db[_0xe525('0x2d')][_0xe525('0x41')](_0x396f4b);})[_0xe525('0x42')](function(_0x5a0e99){_0x2f18aa[_0xe525('0x43')]=_0x5a0e99;return _0x2f18aa;})['then'](respondWithFilteredResult(_0x22b99f,_0x396f4b))[_0xe525('0x44')](handleError(_0x22b99f,null));};exports['show']=function(_0x4cad69,_0x2d9755){var _0x465478={'raw':!![],'where':{'id':_0x4cad69['params']['id']}},_0xf2c043={};_0xf2c043[_0xe525('0x36')]=_[_0xe525('0x32')](db[_0xe525('0x2d')]['rawAttributes']);_0xf2c043[_0xe525('0x31')]=_[_0xe525('0x32')](_0x4cad69[_0xe525('0x31')]);_0xf2c043[_0xe525('0x33')]=_[_0xe525('0x34')](_0xf2c043[_0xe525('0x36')],_0xf2c043[_0xe525('0x31')]);_0x465478[_0xe525('0x35')]=_[_0xe525('0x34')](_0xf2c043[_0xe525('0x36')],qs[_0xe525('0x37')](_0x4cad69[_0xe525('0x31')][_0xe525('0x37')]));_0x465478[_0xe525('0x35')]=_0x465478[_0xe525('0x35')][_0xe525('0x38')]?_0x465478[_0xe525('0x35')]:_0xf2c043[_0xe525('0x36')];if(_0x4cad69['query'][_0xe525('0x40')]){_0x465478[_0xe525('0x45')]=[{'all':!![]}];}_0x465478=_[_0xe525('0x27')]({},_0x465478,_0x4cad69[_0xe525('0x3f')]);return db[_0xe525('0x2d')]['find'](_0x465478)[_0xe525('0x42')](handleEntityNotFound(_0x2d9755,null))[_0xe525('0x42')](respondWithResult(_0x2d9755,null))[_0xe525('0x44')](handleError(_0x2d9755,null));};exports[_0xe525('0x46')]=function(_0x3e6d79,_0x550a8d){return db[_0xe525('0x2d')][_0xe525('0x46')](_0x3e6d79[_0xe525('0x28')],{})['then'](respondWithResult(_0x550a8d,0xc9))['catch'](handleError(_0x550a8d,null));};exports[_0xe525('0x24')]=function(_0x538d42,_0x288849){if(_0x538d42['body']['id']){delete _0x538d42[_0xe525('0x28')]['id'];}return db[_0xe525('0x2d')]['find']({'where':{'id':_0x538d42[_0xe525('0x47')]['id']}})['then'](handleEntityNotFound(_0x288849,null))[_0xe525('0x42')](saveUpdates(_0x538d42[_0xe525('0x28')],null))[_0xe525('0x42')](respondWithResult(_0x288849,null))[_0xe525('0x44')](handleError(_0x288849,null));};exports['destroy']=function(_0x5b8c48,_0x24d43c){return db[_0xe525('0x2d')][_0xe525('0x48')]({'where':{'id':_0x5b8c48[_0xe525('0x47')]['id']}})['then'](handleEntityNotFound(_0x24d43c,null))[_0xe525('0x42')](removeEntity(_0x24d43c,null))[_0xe525('0x44')](handleError(_0x24d43c,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index e0f392f..f8be848 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 _0x3e76=['api','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','square_messages','util','../../config/logger'];(function(_0x14b891,_0x349501){var _0x98437f=function(_0x59f8fb){while(--_0x59f8fb){_0x14b891['push'](_0x14b891['shift']());}};_0x98437f(++_0x349501);}(_0x3e76,0xd0));var _0x63e7=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x3e76[_0x5447fd];return _0x15b28a;};'use strict';var _=require('lodash');var util=require(_0x63e7('0x0'));var logger=require(_0x63e7('0x1'))(_0x63e7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x63e7('0x3'));var rimraf=require(_0x63e7('0x4'));var config=require(_0x63e7('0x5'));var attributes=require(_0x63e7('0x6'));module[_0x63e7('0x7')]=function(_0x2e5200,_0xf77e6e){return _0x2e5200[_0x63e7('0x8')]('SquareMessage',attributes,{'tableName':_0x63e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa381=['moment','request-promise','path','exports','square_messages','lodash','util'];(function(_0x3d9470,_0xa1df9f){var _0x125997=function(_0x24dd5a){while(--_0x24dd5a){_0x3d9470['push'](_0x3d9470['shift']());}};_0x125997(++_0xa1df9f);}(_0xa381,0xde));var _0x1a38=function(_0x7ec229,_0x45291f){_0x7ec229=_0x7ec229-0x0;var _0x332ac1=_0xa381[_0x7ec229];return _0x332ac1;};'use strict';var _=require(_0x1a38('0x0'));var util=require(_0x1a38('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1a38('0x2'));var BPromise=require('bluebird');var rp=require(_0x1a38('0x3'));var fs=require('fs');var path=require(_0x1a38('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0x1a38('0x5')]=function(_0x3da959,_0x13050f){return _0x3da959['define']('SquareMessage',attributes,{'tableName':_0x1a38('0x6'),'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 3bf56e1..8acfa09 100644 --- a/server/api/squareMessage/squareMessage.rpc.js +++ b/server/api/squareMessage/squareMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x50dda2,_0x1e9f07){var _0x56a726=function(_0xec0b19){while(--_0xec0b19){_0x50dda2['push'](_0x50dda2['shift']());}};_0x56a726(++_0x1e9f07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x169f86,_0x37fabc){var _0x3e5025=function(_0x55fd45){while(--_0x55fd45){_0x169f86['push'](_0x169f86['shift']());}};_0x3e5025(++_0x37fabc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 6cc023c..a464a87 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 _0x889d=['get','isAuthenticated','index','/:id','show','/:id/test','post','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x889d,0x102));var _0xd889=function(_0x2d1b2e,_0x2577bb){_0x2d1b2e=_0x2d1b2e-0x0;var _0x5560ae=_0x889d[_0x2d1b2e];return _0x5560ae;};'use strict';var multer=require(_0xd889('0x0'));var util=require(_0xd889('0x1'));var path=require('path');var timeout=require(_0xd889('0x2'));var express=require('express');var router=express[_0xd889('0x3')]();var fs_extra=require(_0xd889('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd889('0x5'));var config=require(_0xd889('0x6'));var controller=require(_0xd889('0x7'));router[_0xd889('0x8')]('/',auth[_0xd889('0x9')](),controller[_0xd889('0xa')]);router[_0xd889('0x8')](_0xd889('0xb'),auth[_0xd889('0x9')](),controller[_0xd889('0xc')]);router[_0xd889('0x8')](_0xd889('0xd'),auth['isAuthenticated'](),timeout('15s'),controller['test']);router[_0xd889('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd889('0xf')](_0xd889('0xb'),auth[_0xd889('0x9')](),controller['update']);router[_0xd889('0x10')](_0xd889('0xb'),auth[_0xd889('0x9')](),controller[_0xd889('0x11')]);module[_0xd889('0x12')]=router; \ No newline at end of file +var _0xd2b3=['isAuthenticated','index','/:id','show','/:id/test','15s','test','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get'];(function(_0x476559,_0x546831){var _0x37376f=function(_0x129628){while(--_0x129628){_0x476559['push'](_0x476559['shift']());}};_0x37376f(++_0x546831);}(_0xd2b3,0xfb));var _0x3d2b=function(_0x4cb086,_0x4cc048){_0x4cb086=_0x4cb086-0x0;var _0x10d1af=_0xd2b3[_0x4cb086];return _0x10d1af;};'use strict';var multer=require(_0x3d2b('0x0'));var util=require(_0x3d2b('0x1'));var path=require(_0x3d2b('0x2'));var timeout=require(_0x3d2b('0x3'));var express=require(_0x3d2b('0x4'));var router=express[_0x3d2b('0x5')]();var fs_extra=require(_0x3d2b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3d2b('0x7'));var controller=require('./squareOdbc.controller');router[_0x3d2b('0x8')]('/',auth[_0x3d2b('0x9')](),controller[_0x3d2b('0xa')]);router['get'](_0x3d2b('0xb'),auth[_0x3d2b('0x9')](),controller[_0x3d2b('0xc')]);router[_0x3d2b('0x8')](_0x3d2b('0xd'),auth[_0x3d2b('0x9')](),timeout(_0x3d2b('0xe')),controller[_0x3d2b('0xf')]);router[_0x3d2b('0x10')]('/',auth[_0x3d2b('0x9')](),controller['create']);router['put'](_0x3d2b('0xb'),auth['isAuthenticated'](),controller[_0x3d2b('0x11')]);router['delete']('/:id',auth[_0x3d2b('0x9')](),controller[_0x3d2b('0x12')]);module[_0x3d2b('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index b4ad400..4ee14d8 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 _0x0c96=['STRING','exports'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x0c96,0x93));var _0x60c9=function(_0xd6448,_0x16033b){_0xd6448=_0xd6448-0x0;var _0x5c0d29=_0x0c96[_0xd6448];return _0x5c0d29;};'use strict';var Sequelize=require('sequelize');module[_0x60c9('0x0')]={'name':{'type':Sequelize[_0x60c9('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x60c9('0x1')]},'description':{'type':Sequelize[_0x60c9('0x1')]}}; \ No newline at end of file +var _0x4e78=['sequelize','name','STRING'];(function(_0x4f3614,_0x28bc98){var _0x1219aa=function(_0x185faf){while(--_0x185faf){_0x4f3614['push'](_0x4f3614['shift']());}};_0x1219aa(++_0x28bc98);}(_0x4e78,0x6c));var _0x84e7=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0x4e78[_0x4b12ae];return _0x16957b;};'use strict';var Sequelize=require(_0x84e7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x84e7('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x84e7('0x2')]},'description':{'type':Sequelize[_0x84e7('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 33cbf3f..16104d4 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 _0xa6bb=['account','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','include','SquareOdbc','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','apply','reject','update','then','get','ODBC','UserProfileResource','destroy','error','stack','name','render','body','message','agent','interaction'];(function(_0x12313d,_0x425737){var _0x4c6d28=function(_0x859e2f){while(--_0x859e2f){_0x12313d['push'](_0x12313d['shift']());}};_0x4c6d28(++_0x425737);}(_0xa6bb,0x12c));var _0xba6b=function(_0x1ca105,_0x537e4d){_0x1ca105=_0x1ca105-0x0;var _0x47b978=_0xa6bb[_0x1ca105];return _0x47b978;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba6b('0x0'));var zipdir=require(_0xba6b('0x1'));var jsonpatch=require(_0xba6b('0x2'));var rp=require(_0xba6b('0x3'));var moment=require(_0xba6b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xba6b('0x5'));var path=require(_0xba6b('0x6'));var sox=require(_0xba6b('0x7'));var csv=require(_0xba6b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba6b('0x9'));var squel=require(_0xba6b('0xa'));var crypto=require(_0xba6b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xba6b('0x8'));var querystring=require(_0xba6b('0xc'));var Papa=require(_0xba6b('0xd'));var Redis=require(_0xba6b('0xe'));var authService=require(_0xba6b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xba6b('0x10'));var hardwareService=require(_0xba6b('0x11'));var logger=require(_0xba6b('0x12'))('api');var utils=require(_0xba6b('0x13'));var config=require(_0xba6b('0x14'));var licenseUtil=require(_0xba6b('0x15'));var db=require(_0xba6b('0x16'))['db'];function respondWithStatusCode(_0x55b6ab,_0x1e8473){_0x1e8473=_0x1e8473||0xcc;return function(_0x5b1d28){if(_0x5b1d28){return _0x55b6ab[_0xba6b('0x17')](_0x1e8473);}return _0x55b6ab[_0xba6b('0x18')](_0x1e8473)[_0xba6b('0x19')]();};}function respondWithResult(_0x15d4e2,_0x32144e){_0x32144e=_0x32144e||0xc8;return function(_0x53ec00){if(_0x53ec00){return _0x15d4e2[_0xba6b('0x18')](_0x32144e)[_0xba6b('0x1a')](_0x53ec00);}};}function respondWithFilteredResult(_0x50b58a,_0x16c3d0){return function(_0x1d280e){if(_0x1d280e){var _0x52b2ff=typeof _0x16c3d0['offset']===_0xba6b('0x1b')&&typeof _0x16c3d0['limit']==='undefined';var _0x5a553c=_0x1d280e['count'];var _0x4be059=_0x52b2ff?0x0:_0x16c3d0[_0xba6b('0x1c')];var _0x34aa97=_0x52b2ff?_0x1d280e[_0xba6b('0x1d')]:_0x16c3d0[_0xba6b('0x1c')]+_0x16c3d0[_0xba6b('0x1e')];var _0x15d1d2;if(_0x34aa97>=_0x5a553c){_0x34aa97=_0x5a553c;_0x15d1d2=0xc8;}else{_0x15d1d2=0xce;}_0x50b58a[_0xba6b('0x18')](_0x15d1d2);return _0x50b58a['set'](_0xba6b('0x1f'),_0x4be059+'-'+_0x34aa97+'/'+_0x5a553c)['json'](_0x1d280e);}return null;};}function patchUpdates(_0x54a392){return function(_0x13beca){try{jsonpatch[_0xba6b('0x20')](_0x13beca,_0x54a392,!![]);}catch(_0x3905ae){return BPromise[_0xba6b('0x21')](_0x3905ae);}return _0x13beca['save']();};}function saveUpdates(_0xa632cb,_0x436623){return function(_0x548c1b){if(_0x548c1b){return _0x548c1b[_0xba6b('0x22')](_0xa632cb)[_0xba6b('0x23')](function(_0x82b68f){return _0x82b68f;});}return null;};}function removeEntity(_0x12e4e6,_0x426641){return function(_0x5c2845){if(_0x5c2845){return _0x5c2845['destroy']()['then'](function(){var _0x5d9163=_0x5c2845[_0xba6b('0x24')]({'plain':!![]});var _0x2525f8=_0xba6b('0x25');return db[_0xba6b('0x26')][_0xba6b('0x27')]({'where':{'type':_0x2525f8,'resourceId':_0x5d9163['id']}})[_0xba6b('0x23')](function(){return _0x5c2845;});})['then'](function(){_0x12e4e6[_0xba6b('0x18')](0xcc)[_0xba6b('0x19')]();});}};}function handleEntityNotFound(_0x11785e,_0x4d7db9){return function(_0x47574c){if(!_0x47574c){_0x11785e[_0xba6b('0x17')](0x194);}return _0x47574c;};}function handleError(_0x57493a,_0x127f99){_0x127f99=_0x127f99||0x1f4;return function(_0x25d5e6){logger[_0xba6b('0x28')](_0x25d5e6[_0xba6b('0x29')]);if(_0x25d5e6[_0xba6b('0x2a')]){delete _0x25d5e6['name'];}_0x57493a[_0xba6b('0x18')](_0x127f99)['send'](_0x25d5e6);};}function getMustacheRender(_0x2d7908,_0x5286a9){return Mustache[_0xba6b('0x2b')](_0x2d7908,_['merge'](_0x5286a9[_0xba6b('0x2c')],{'contact':_0x5286a9['contact'],'message':_0x5286a9[_0xba6b('0x2d')],'agent':_0x5286a9[_0xba6b('0x2e')],'interaction':_0x5286a9[_0xba6b('0x2f')],'account':_0x5286a9[_0xba6b('0x30')]}))||'';}exports['index']=function(_0x2e9bda,_0x563d5a){var _0x58bf66={},_0x1b7468={},_0x2de7cd={'count':0x0,'rows':[]};var _0x569439=_[_0xba6b('0x31')](db['SquareOdbc']['rawAttributes'],function(_0x2531b3){return{'name':_0x2531b3[_0xba6b('0x32')],'type':_0x2531b3[_0xba6b('0x33')][_0xba6b('0x34')]};});_0x1b7468[_0xba6b('0x35')]=_['map'](_0x569439,_0xba6b('0x2a'));_0x1b7468[_0xba6b('0x36')]=_[_0xba6b('0x37')](_0x2e9bda[_0xba6b('0x36')]);_0x1b7468[_0xba6b('0x38')]=_[_0xba6b('0x39')](_0x1b7468[_0xba6b('0x35')],_0x1b7468[_0xba6b('0x36')]);_0x58bf66[_0xba6b('0x3a')]=_['intersection'](_0x1b7468[_0xba6b('0x35')],qs[_0xba6b('0x3b')](_0x2e9bda[_0xba6b('0x36')][_0xba6b('0x3b')]));_0x58bf66['attributes']=_0x58bf66['attributes'][_0xba6b('0x3c')]?_0x58bf66[_0xba6b('0x3a')]:_0x1b7468[_0xba6b('0x35')];if(!_0x2e9bda[_0xba6b('0x36')]['hasOwnProperty'](_0xba6b('0x3d'))){_0x58bf66[_0xba6b('0x1e')]=qs['limit'](_0x2e9bda[_0xba6b('0x36')]['limit']);_0x58bf66[_0xba6b('0x1c')]=qs[_0xba6b('0x1c')](_0x2e9bda[_0xba6b('0x36')]['offset']);}_0x58bf66[_0xba6b('0x3e')]=qs[_0xba6b('0x3f')](_0x2e9bda['query'][_0xba6b('0x3f')]);_0x58bf66['where']=qs[_0xba6b('0x38')](_['pick'](_0x2e9bda[_0xba6b('0x36')],_0x1b7468['filters']),_0x569439);if(_0x2e9bda[_0xba6b('0x36')]['filter']){_0x58bf66[_0xba6b('0x40')]=_[_0xba6b('0x41')](_0x58bf66[_0xba6b('0x40')],{'$or':_[_0xba6b('0x31')](_0x569439,function(_0x4834c6){if(_0x4834c6[_0xba6b('0x33')]!==_0xba6b('0x42')){var _0x4358c3={};_0x4358c3[_0x4834c6[_0xba6b('0x2a')]]={'$like':'%'+_0x2e9bda[_0xba6b('0x36')]['filter']+'%'};return _0x4358c3;}})});}_0x58bf66=_[_0xba6b('0x41')]({},_0x58bf66,_0x2e9bda['options']);var _0x1f229b={'where':_0x58bf66[_0xba6b('0x40')]};return db['SquareOdbc']['count'](_0x1f229b)[_0xba6b('0x23')](function(_0x234932){_0x2de7cd[_0xba6b('0x1d')]=_0x234932;if(_0x2e9bda[_0xba6b('0x36')]['includeAll']){_0x58bf66[_0xba6b('0x43')]=[{'all':!![]}];}return db[_0xba6b('0x44')][_0xba6b('0x45')](_0x58bf66);})[_0xba6b('0x23')](function(_0x52f204){_0x2de7cd[_0xba6b('0x46')]=_0x52f204;return _0x2de7cd;})[_0xba6b('0x23')](respondWithFilteredResult(_0x563d5a,_0x58bf66))[_0xba6b('0x47')](handleError(_0x563d5a,null));};exports[_0xba6b('0x48')]=function(_0x219c92,_0x1e1f88){var _0x59f03d={'raw':!![],'where':{'id':_0x219c92[_0xba6b('0x49')]['id']}},_0x1d4b21={};_0x1d4b21[_0xba6b('0x35')]=_['keys'](db[_0xba6b('0x44')][_0xba6b('0x4a')]);_0x1d4b21[_0xba6b('0x36')]=_[_0xba6b('0x37')](_0x219c92[_0xba6b('0x36')]);_0x1d4b21[_0xba6b('0x38')]=_[_0xba6b('0x39')](_0x1d4b21[_0xba6b('0x35')],_0x1d4b21['query']);_0x59f03d[_0xba6b('0x3a')]=_[_0xba6b('0x39')](_0x1d4b21[_0xba6b('0x35')],qs['fields'](_0x219c92[_0xba6b('0x36')][_0xba6b('0x3b')]));_0x59f03d[_0xba6b('0x3a')]=_0x59f03d[_0xba6b('0x3a')][_0xba6b('0x3c')]?_0x59f03d[_0xba6b('0x3a')]:_0x1d4b21[_0xba6b('0x35')];if(_0x219c92[_0xba6b('0x36')][_0xba6b('0x4b')]){_0x59f03d['include']=[{'all':!![]}];}_0x59f03d=_[_0xba6b('0x41')]({},_0x59f03d,_0x219c92[_0xba6b('0x4c')]);return db[_0xba6b('0x44')][_0xba6b('0x4d')](_0x59f03d)[_0xba6b('0x23')](handleEntityNotFound(_0x1e1f88,null))[_0xba6b('0x23')](respondWithResult(_0x1e1f88,null))[_0xba6b('0x47')](handleError(_0x1e1f88,null));};exports[_0xba6b('0x4e')]=function(_0x229a7a,_0x457e54){return db['SquareOdbc'][_0xba6b('0x4e')](_0x229a7a[_0xba6b('0x2c')],{})['then'](function(_0x9ffc90){var _0x28ee3c=_0x229a7a[_0xba6b('0x4f')]['get']({'plain':!![]});if(!_0x28ee3c)throw new Error(_0xba6b('0x50'));if(_0x28ee3c[_0xba6b('0x51')]===_0xba6b('0x4f')){var _0x586255=_0x9ffc90[_0xba6b('0x24')]({'plain':!![]});var _0x47ddc5='ODBC';return db['UserProfileSection']['find']({'where':{'name':_0x47ddc5,'userProfileId':_0x28ee3c[_0xba6b('0x52')]},'raw':!![]})[_0xba6b('0x23')](function(_0x3f7539){if(_0x3f7539&&_0x3f7539['autoAssociation']===0x0){return db[_0xba6b('0x26')]['create']({'name':_0x586255['name'],'resourceId':_0x586255['id'],'type':_0x3f7539[_0xba6b('0x2a')],'sectionId':_0x3f7539['id']},{})[_0xba6b('0x23')](function(){return _0x9ffc90;});}else{return _0x9ffc90;}})[_0xba6b('0x47')](function(_0x1eacb4){logger[_0xba6b('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1eacb4);throw _0x1eacb4;});}return _0x9ffc90;})['then'](respondWithResult(_0x457e54,0xc9))[_0xba6b('0x47')](handleError(_0x457e54,null));};exports[_0xba6b('0x22')]=function(_0x523e37,_0x11c9be){if(_0x523e37['body']['id']){delete _0x523e37[_0xba6b('0x2c')]['id'];}return db[_0xba6b('0x44')][_0xba6b('0x4d')]({'where':{'id':_0x523e37[_0xba6b('0x49')]['id']}})['then'](handleEntityNotFound(_0x11c9be,null))[_0xba6b('0x23')](saveUpdates(_0x523e37[_0xba6b('0x2c')],null))['then'](respondWithResult(_0x11c9be,null))[_0xba6b('0x47')](handleError(_0x11c9be,null));};exports[_0xba6b('0x27')]=function(_0x2ab437,_0x5e1352){return db[_0xba6b('0x44')]['find']({'where':{'id':_0x2ab437['params']['id']}})['then'](handleEntityNotFound(_0x5e1352,null))[_0xba6b('0x23')](removeEntity(_0x5e1352,null))[_0xba6b('0x47')](handleError(_0x5e1352,null));};exports['test']=function(_0xdd7a79,_0x3a24ca,_0x5cad76){var _0x117bb7;return db['SquareOdbc'][_0xba6b('0x4d')]({'where':{'id':_0xdd7a79[_0xba6b('0x49')]['id']},'attributes':['id',_0xba6b('0x53')]})['then'](handleEntityNotFound(_0x3a24ca,null))[_0xba6b('0x23')](function(_0x5b4c1b){if(_0x5b4c1b){var _0x34c960=require(_0xba6b('0x54'))();_0x34c960[_0xba6b('0x55')](_0x5b4c1b[_0xba6b('0x53')]);_0x34c960[_0xba6b('0x56')]();return _0x5b4c1b;}})[_0xba6b('0x23')](respondWithResult(_0x3a24ca,null))[_0xba6b('0x47')](handleError(_0x3a24ca,null));}; \ No newline at end of file +var _0x4aa3=['order','sort','where','filter','type','VIRTUAL','options','includeAll','include','show','params','keys','length','find','catch','create','user','role','UserProfileSection','userProfileId','update','openSync','dsn','closeSync','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','render','merge','body','contact','message','agent','account','index','SquareOdbc','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','nolimit'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x4aa3,0x174));var _0x34aa=function(_0x51c8f3,_0x1d8eef){_0x51c8f3=_0x51c8f3-0x0;var _0x2b3176=_0x4aa3[_0x51c8f3];return _0x2b3176;};'use strict';var emlformat=require(_0x34aa('0x0'));var rimraf=require(_0x34aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x34aa('0x2'));var rp=require(_0x34aa('0x3'));var moment=require('moment');var BPromise=require(_0x34aa('0x4'));var Mustache=require(_0x34aa('0x5'));var util=require('util');var path=require(_0x34aa('0x6'));var sox=require(_0x34aa('0x7'));var csv=require(_0x34aa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x34aa('0x9'));var _=require(_0x34aa('0xa'));var squel=require('squel');var crypto=require(_0x34aa('0xb'));var jsforce=require(_0x34aa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x34aa('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x34aa('0xd'));var authService=require(_0x34aa('0xe'));var qs=require(_0x34aa('0xf'));var as=require(_0x34aa('0x10'));var hardwareService=require(_0x34aa('0x11'));var logger=require(_0x34aa('0x12'))('api');var utils=require(_0x34aa('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x34aa('0x14'))['db'];function respondWithStatusCode(_0x1803a6,_0x35b673){_0x35b673=_0x35b673||0xcc;return function(_0x4818bd){if(_0x4818bd){return _0x1803a6[_0x34aa('0x15')](_0x35b673);}return _0x1803a6['status'](_0x35b673)[_0x34aa('0x16')]();};}function respondWithResult(_0x109378,_0x228433){_0x228433=_0x228433||0xc8;return function(_0x3a6819){if(_0x3a6819){return _0x109378[_0x34aa('0x17')](_0x228433)['json'](_0x3a6819);}};}function respondWithFilteredResult(_0x3dc282,_0xa25b37){return function(_0x353a02){if(_0x353a02){var _0x1ab220=typeof _0xa25b37[_0x34aa('0x18')]===_0x34aa('0x19')&&typeof _0xa25b37[_0x34aa('0x1a')]===_0x34aa('0x19');var _0x2663ea=_0x353a02[_0x34aa('0x1b')];var _0x317054=_0x1ab220?0x0:_0xa25b37[_0x34aa('0x18')];var _0xd0bf04=_0x1ab220?_0x353a02[_0x34aa('0x1b')]:_0xa25b37[_0x34aa('0x18')]+_0xa25b37[_0x34aa('0x1a')];var _0x4416e1;if(_0xd0bf04>=_0x2663ea){_0xd0bf04=_0x2663ea;_0x4416e1=0xc8;}else{_0x4416e1=0xce;}_0x3dc282[_0x34aa('0x17')](_0x4416e1);return _0x3dc282[_0x34aa('0x1c')](_0x34aa('0x1d'),_0x317054+'-'+_0xd0bf04+'/'+_0x2663ea)[_0x34aa('0x1e')](_0x353a02);}return null;};}function patchUpdates(_0x17a10d){return function(_0x329a6b){try{jsonpatch[_0x34aa('0x1f')](_0x329a6b,_0x17a10d,!![]);}catch(_0x100310){return BPromise[_0x34aa('0x20')](_0x100310);}return _0x329a6b[_0x34aa('0x21')]();};}function saveUpdates(_0x5deb88,_0x37a332){return function(_0x3e78b9){if(_0x3e78b9){return _0x3e78b9['update'](_0x5deb88)[_0x34aa('0x22')](function(_0x812884){return _0x812884;});}return null;};}function removeEntity(_0x1e2b40,_0x32643b){return function(_0x1ff3c3){if(_0x1ff3c3){return _0x1ff3c3[_0x34aa('0x23')]()['then'](function(){var _0x12a468=_0x1ff3c3[_0x34aa('0x24')]({'plain':!![]});var _0x48bb85=_0x34aa('0x25');return db[_0x34aa('0x26')][_0x34aa('0x23')]({'where':{'type':_0x48bb85,'resourceId':_0x12a468['id']}})[_0x34aa('0x22')](function(){return _0x1ff3c3;});})[_0x34aa('0x22')](function(){_0x1e2b40[_0x34aa('0x17')](0xcc)[_0x34aa('0x16')]();});}};}function handleEntityNotFound(_0x15e1f8,_0x58d40c){return function(_0x3e8f8e){if(!_0x3e8f8e){_0x15e1f8[_0x34aa('0x15')](0x194);}return _0x3e8f8e;};}function handleError(_0xc920c7,_0x55351d){_0x55351d=_0x55351d||0x1f4;return function(_0x2c4b82){logger[_0x34aa('0x27')](_0x2c4b82[_0x34aa('0x28')]);if(_0x2c4b82[_0x34aa('0x29')]){delete _0x2c4b82[_0x34aa('0x29')];}_0xc920c7[_0x34aa('0x17')](_0x55351d)[_0x34aa('0x2a')](_0x2c4b82);};}function getMustacheRender(_0x43faaa,_0x2fdd7e){return Mustache[_0x34aa('0x2b')](_0x43faaa,_[_0x34aa('0x2c')](_0x2fdd7e[_0x34aa('0x2d')],{'contact':_0x2fdd7e[_0x34aa('0x2e')],'message':_0x2fdd7e[_0x34aa('0x2f')],'agent':_0x2fdd7e[_0x34aa('0x30')],'interaction':_0x2fdd7e['interaction'],'account':_0x2fdd7e[_0x34aa('0x31')]}))||'';}exports[_0x34aa('0x32')]=function(_0x3ce8ae,_0x3f96a2){var _0x261711={},_0x324e6c={},_0x2b116e={'count':0x0,'rows':[]};var _0x4f1354=_['map'](db[_0x34aa('0x33')][_0x34aa('0x34')],function(_0x3cb4cd){return{'name':_0x3cb4cd[_0x34aa('0x35')],'type':_0x3cb4cd['type'][_0x34aa('0x36')]};});_0x324e6c[_0x34aa('0x37')]=_[_0x34aa('0x38')](_0x4f1354,_0x34aa('0x29'));_0x324e6c[_0x34aa('0x39')]=_['keys'](_0x3ce8ae[_0x34aa('0x39')]);_0x324e6c[_0x34aa('0x3a')]=_[_0x34aa('0x3b')](_0x324e6c[_0x34aa('0x37')],_0x324e6c[_0x34aa('0x39')]);_0x261711[_0x34aa('0x3c')]=_[_0x34aa('0x3b')](_0x324e6c[_0x34aa('0x37')],qs['fields'](_0x3ce8ae[_0x34aa('0x39')][_0x34aa('0x3d')]));_0x261711[_0x34aa('0x3c')]=_0x261711['attributes']['length']?_0x261711['attributes']:_0x324e6c[_0x34aa('0x37')];if(!_0x3ce8ae[_0x34aa('0x39')]['hasOwnProperty'](_0x34aa('0x3e'))){_0x261711[_0x34aa('0x1a')]=qs['limit'](_0x3ce8ae[_0x34aa('0x39')]['limit']);_0x261711[_0x34aa('0x18')]=qs[_0x34aa('0x18')](_0x3ce8ae[_0x34aa('0x39')][_0x34aa('0x18')]);}_0x261711[_0x34aa('0x3f')]=qs[_0x34aa('0x40')](_0x3ce8ae[_0x34aa('0x39')][_0x34aa('0x40')]);_0x261711[_0x34aa('0x41')]=qs[_0x34aa('0x3a')](_['pick'](_0x3ce8ae[_0x34aa('0x39')],_0x324e6c[_0x34aa('0x3a')]),_0x4f1354);if(_0x3ce8ae['query'][_0x34aa('0x42')]){_0x261711['where']=_[_0x34aa('0x2c')](_0x261711['where'],{'$or':_[_0x34aa('0x38')](_0x4f1354,function(_0xef225d){if(_0xef225d[_0x34aa('0x43')]!==_0x34aa('0x44')){var _0x173805={};_0x173805[_0xef225d[_0x34aa('0x29')]]={'$like':'%'+_0x3ce8ae[_0x34aa('0x39')][_0x34aa('0x42')]+'%'};return _0x173805;}})});}_0x261711=_[_0x34aa('0x2c')]({},_0x261711,_0x3ce8ae[_0x34aa('0x45')]);var _0x2b431f={'where':_0x261711['where']};return db[_0x34aa('0x33')][_0x34aa('0x1b')](_0x2b431f)['then'](function(_0x13a112){_0x2b116e[_0x34aa('0x1b')]=_0x13a112;if(_0x3ce8ae[_0x34aa('0x39')][_0x34aa('0x46')]){_0x261711[_0x34aa('0x47')]=[{'all':!![]}];}return db[_0x34aa('0x33')]['findAll'](_0x261711);})[_0x34aa('0x22')](function(_0x3d176e){_0x2b116e['rows']=_0x3d176e;return _0x2b116e;})['then'](respondWithFilteredResult(_0x3f96a2,_0x261711))['catch'](handleError(_0x3f96a2,null));};exports[_0x34aa('0x48')]=function(_0x3fcf87,_0x37b21f){var _0x450381={'raw':!![],'where':{'id':_0x3fcf87[_0x34aa('0x49')]['id']}},_0x38273a={};_0x38273a['model']=_[_0x34aa('0x4a')](db[_0x34aa('0x33')][_0x34aa('0x34')]);_0x38273a['query']=_[_0x34aa('0x4a')](_0x3fcf87['query']);_0x38273a['filters']=_[_0x34aa('0x3b')](_0x38273a[_0x34aa('0x37')],_0x38273a[_0x34aa('0x39')]);_0x450381[_0x34aa('0x3c')]=_[_0x34aa('0x3b')](_0x38273a[_0x34aa('0x37')],qs[_0x34aa('0x3d')](_0x3fcf87['query'][_0x34aa('0x3d')]));_0x450381[_0x34aa('0x3c')]=_0x450381[_0x34aa('0x3c')][_0x34aa('0x4b')]?_0x450381[_0x34aa('0x3c')]:_0x38273a[_0x34aa('0x37')];if(_0x3fcf87[_0x34aa('0x39')][_0x34aa('0x46')]){_0x450381[_0x34aa('0x47')]=[{'all':!![]}];}_0x450381=_[_0x34aa('0x2c')]({},_0x450381,_0x3fcf87[_0x34aa('0x45')]);return db['SquareOdbc'][_0x34aa('0x4c')](_0x450381)['then'](handleEntityNotFound(_0x37b21f,null))['then'](respondWithResult(_0x37b21f,null))[_0x34aa('0x4d')](handleError(_0x37b21f,null));};exports['create']=function(_0x150249,_0x16ba7d){return db[_0x34aa('0x33')][_0x34aa('0x4e')](_0x150249['body'],{})['then'](function(_0x3ac9ff){var _0x2dcfb2=_0x150249[_0x34aa('0x4f')][_0x34aa('0x24')]({'plain':!![]});if(!_0x2dcfb2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2dcfb2[_0x34aa('0x50')]===_0x34aa('0x4f')){var _0x563170=_0x3ac9ff[_0x34aa('0x24')]({'plain':!![]});var _0x57350c=_0x34aa('0x25');return db[_0x34aa('0x51')][_0x34aa('0x4c')]({'where':{'name':_0x57350c,'userProfileId':_0x2dcfb2[_0x34aa('0x52')]},'raw':!![]})['then'](function(_0x27d6db){if(_0x27d6db&&_0x27d6db['autoAssociation']===0x0){return db[_0x34aa('0x26')][_0x34aa('0x4e')]({'name':_0x563170[_0x34aa('0x29')],'resourceId':_0x563170['id'],'type':_0x27d6db['name'],'sectionId':_0x27d6db['id']},{})[_0x34aa('0x22')](function(){return _0x3ac9ff;});}else{return _0x3ac9ff;}})['catch'](function(_0x48db37){logger[_0x34aa('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48db37);throw _0x48db37;});}return _0x3ac9ff;})[_0x34aa('0x22')](respondWithResult(_0x16ba7d,0xc9))[_0x34aa('0x4d')](handleError(_0x16ba7d,null));};exports[_0x34aa('0x53')]=function(_0x24f5f6,_0x3a9097){if(_0x24f5f6[_0x34aa('0x2d')]['id']){delete _0x24f5f6['body']['id'];}return db[_0x34aa('0x33')][_0x34aa('0x4c')]({'where':{'id':_0x24f5f6['params']['id']}})[_0x34aa('0x22')](handleEntityNotFound(_0x3a9097,null))[_0x34aa('0x22')](saveUpdates(_0x24f5f6[_0x34aa('0x2d')],null))[_0x34aa('0x22')](respondWithResult(_0x3a9097,null))[_0x34aa('0x4d')](handleError(_0x3a9097,null));};exports[_0x34aa('0x23')]=function(_0x549216,_0x276de3){return db[_0x34aa('0x33')][_0x34aa('0x4c')]({'where':{'id':_0x549216[_0x34aa('0x49')]['id']}})['then'](handleEntityNotFound(_0x276de3,null))[_0x34aa('0x22')](removeEntity(_0x276de3,null))[_0x34aa('0x4d')](handleError(_0x276de3,null));};exports['test']=function(_0xf6af27,_0x7a9a27,_0x2c180b){var _0x134bef;return db[_0x34aa('0x33')][_0x34aa('0x4c')]({'where':{'id':_0xf6af27[_0x34aa('0x49')]['id']},'attributes':['id','dsn']})[_0x34aa('0x22')](handleEntityNotFound(_0x7a9a27,null))[_0x34aa('0x22')](function(_0xc69dbc){if(_0xc69dbc){var _0x15e1d9=require('odbc')();_0x15e1d9[_0x34aa('0x54')](_0xc69dbc[_0x34aa('0x55')]);_0x15e1d9[_0x34aa('0x56')]();return _0xc69dbc;}})['then'](respondWithResult(_0x7a9a27,null))[_0x34aa('0x4d')](handleError(_0x7a9a27,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 7df2f1a..6a71434 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 _0xdae4=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','SquareOdbc','lodash'];(function(_0x4c9316,_0x5c7f6f){var _0x146aad=function(_0x4fa179){while(--_0x4fa179){_0x4c9316['push'](_0x4c9316['shift']());}};_0x146aad(++_0x5c7f6f);}(_0xdae4,0xdb));var _0x4dae=function(_0x15def3,_0x2be343){_0x15def3=_0x15def3-0x0;var _0x1678e9=_0xdae4[_0x15def3];return _0x1678e9;};'use strict';var _=require(_0x4dae('0x0'));var util=require('util');var logger=require(_0x4dae('0x1'))(_0x4dae('0x2'));var moment=require(_0x4dae('0x3'));var BPromise=require(_0x4dae('0x4'));var rp=require(_0x4dae('0x5'));var fs=require('fs');var path=require(_0x4dae('0x6'));var rimraf=require('rimraf');var config=require(_0x4dae('0x7'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x20abe1,_0x543718){return _0x20abe1[_0x4dae('0x8')](_0x4dae('0x9'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x546b=['../../config/environment','./squareOdbc.attributes','exports','define','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0x546b,0x17a));var _0xb546=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x546b[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0xb546('0x0'));var util=require('util');var logger=require(_0xb546('0x1'))(_0xb546('0x2'));var moment=require(_0xb546('0x3'));var BPromise=require('bluebird');var rp=require(_0xb546('0x4'));var fs=require('fs');var path=require(_0xb546('0x5'));var rimraf=require(_0xb546('0x6'));var config=require(_0xb546('0x7'));var attributes=require(_0xb546('0x8'));module[_0xb546('0x9')]=function(_0x4175eb,_0x1121a7){return _0x4175eb[_0xb546('0xa')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 9220efc..01434da 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x35e083,_0x2a67b7){var _0x4c1d88=function(_0xa75e0){while(--_0xa75e0){_0x35e083['push'](_0x35e083['shift']());}};_0x4c1d88(++_0x2a67b7);}(_0xe14b,0x93));var _0xbe14=function(_0x54cd9d,_0x3a68e6){_0x54cd9d=_0x54cd9d-0x0;var _0xd98acd=_0xe14b[_0x54cd9d];return _0xd98acd;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc','options','where','include','map','attributes'];(function(_0x4b6348,_0xf76f68){var _0x1c5aee=function(_0x38c26d){while(--_0x38c26d){_0x4b6348['push'](_0x4b6348['shift']());}};_0x1c5aee(++_0xf76f68);}(_0x814b,0x1a2));var _0xb814=function(_0x1221e8,_0x2e7229){_0x1221e8=_0x1221e8-0x0;var _0x3f3041=_0x814b[_0x1221e8];return _0x3f3041;};'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')]('SquareOdbc,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['SquareOdbc']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowSquareOdbc',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index f0bd0e2..65a7f06 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 _0xa988=['addUsers','put','/:id','delete','destroy','removeUsers','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id/users','isAuthenticated','getUsers','create','post'];(function(_0x55a101,_0x3df81b){var _0x43466b=function(_0x5d1e83){while(--_0x5d1e83){_0x55a101['push'](_0x55a101['shift']());}};_0x43466b(++_0x3df81b);}(_0xa988,0x1a9));var _0x8a98=function(_0x1a1062,_0x58c79d){_0x1a1062=_0x1a1062-0x0;var _0x3e21d8=_0xa988[_0x1a1062];return _0x3e21d8;};'use strict';var multer=require(_0x8a98('0x0'));var util=require('util');var path=require(_0x8a98('0x1'));var timeout=require(_0x8a98('0x2'));var express=require(_0x8a98('0x3'));var router=express[_0x8a98('0x4')]();var fs_extra=require(_0x8a98('0x5'));var auth=require(_0x8a98('0x6'));var interaction=require(_0x8a98('0x7'));var config=require(_0x8a98('0x8'));var controller=require('./squareProject.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8a98('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8a98('0x9')](_0x8a98('0xa'),auth[_0x8a98('0xb')](),controller[_0x8a98('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8a98('0xd')]);router[_0x8a98('0xe')](_0x8a98('0xa'),auth['isAuthenticated'](),controller[_0x8a98('0xf')]);router[_0x8a98('0x10')](_0x8a98('0x11'),auth[_0x8a98('0xb')](),controller['update']);router[_0x8a98('0x12')](_0x8a98('0x11'),auth[_0x8a98('0xb')](),controller[_0x8a98('0x13')]);router[_0x8a98('0x12')](_0x8a98('0xa'),auth[_0x8a98('0xb')](),controller[_0x8a98('0x14')]);module[_0x8a98('0x15')]=router; \ No newline at end of file +var _0x5e40=['isAuthenticated','show','/:id/users','getUsers','create','addUsers','put','update','delete','removeUsers','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','/:id'];(function(_0x2c022e,_0x38c898){var _0x14c157=function(_0x26d96a){while(--_0x26d96a){_0x2c022e['push'](_0x2c022e['shift']());}};_0x14c157(++_0x38c898);}(_0x5e40,0x1d3));var _0x05e4=function(_0x5a9b6c,_0x30ccd0){_0x5a9b6c=_0x5a9b6c-0x0;var _0x72bed=_0x5e40[_0x5a9b6c];return _0x72bed;};'use strict';var multer=require(_0x05e4('0x0'));var util=require('util');var path=require(_0x05e4('0x1'));var timeout=require(_0x05e4('0x2'));var express=require(_0x05e4('0x3'));var router=express[_0x05e4('0x4')]();var fs_extra=require(_0x05e4('0x5'));var auth=require(_0x05e4('0x6'));var interaction=require(_0x05e4('0x7'));var config=require(_0x05e4('0x8'));var controller=require(_0x05e4('0x9'));router[_0x05e4('0xa')]('/',auth['isAuthenticated'](),controller[_0x05e4('0xb')]);router[_0x05e4('0xa')](_0x05e4('0xc'),auth[_0x05e4('0xd')](),controller[_0x05e4('0xe')]);router[_0x05e4('0xa')](_0x05e4('0xf'),auth[_0x05e4('0xd')](),controller[_0x05e4('0x10')]);router['post']('/',auth[_0x05e4('0xd')](),controller[_0x05e4('0x11')]);router['post'](_0x05e4('0xf'),auth['isAuthenticated'](),controller[_0x05e4('0x12')]);router[_0x05e4('0x13')]('/:id',auth[_0x05e4('0xd')](),controller[_0x05e4('0x14')]);router[_0x05e4('0x15')]('/:id',auth[_0x05e4('0xd')](),controller['destroy']);router[_0x05e4('0x15')](_0x05e4('0xf'),auth['isAuthenticated'](),controller[_0x05e4('0x16')]);module[_0x05e4('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index af471e6..82b918f 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 _0xbff3=['sequelize','STRING','name','TEXT','BLOB','getDataValue','utf8','long','production','toString'];(function(_0x11b58d,_0x555c55){var _0xc2811b=function(_0x396d22){while(--_0x396d22){_0x11b58d['push'](_0x11b58d['shift']());}};_0xc2811b(++_0x555c55);}(_0xbff3,0xdc));var _0x3bff=function(_0x247015,_0x4b19df){_0x247015=_0x247015-0x0;var _0x4cc4f7=_0xbff3[_0x247015];return _0x4cc4f7;};'use strict';var Sequelize=require(_0x3bff('0x0'));module['exports']={'name':{'type':Sequelize[_0x3bff('0x1')],'unique':_0x3bff('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x3bff('0x1')]},'notes':{'type':Sequelize[_0x3bff('0x3')]},'preproduction':{'type':Sequelize[_0x3bff('0x4')]('long'),'get':function(){if(this[_0x3bff('0x5')]('preproduction')){return this[_0x3bff('0x5')]('preproduction')['toString'](_0x3bff('0x6'));}}},'production':{'type':Sequelize[_0x3bff('0x4')](_0x3bff('0x7')),'get':function(){if(this['getDataValue'](_0x3bff('0x8'))){return this[_0x3bff('0x5')](_0x3bff('0x8'))[_0x3bff('0x9')](_0x3bff('0x6'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x674d=['DATE','sequelize','exports','STRING','name','long','getDataValue','preproduction','utf8','BLOB','production'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x674d,0xfe));var _0xd674=function(_0x2a59af,_0x18d558){_0x2a59af=_0x2a59af-0x0;var _0x3af243=_0x674d[_0x2a59af];return _0x3af243;};'use strict';var Sequelize=require(_0xd674('0x0'));module[_0xd674('0x1')]={'name':{'type':Sequelize[_0xd674('0x2')],'unique':_0xd674('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xd674('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0xd674('0x4')),'get':function(){if(this[_0xd674('0x5')](_0xd674('0x6'))){return this[_0xd674('0x5')](_0xd674('0x6'))['toString'](_0xd674('0x7'));}}},'production':{'type':Sequelize[_0xd674('0x8')](_0xd674('0x4')),'get':function(){if(this[_0xd674('0x5')](_0xd674('0x9'))){return this[_0xd674('0x5')](_0xd674('0x9'))['toString'](_0xd674('0x7'));}}},'savedAt':{'type':Sequelize[_0xd674('0xa')]},'publishedAt':{'type':Sequelize[_0xd674('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 84659a7..2a060f5 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 _0x814b=['omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','SquareProjects','UserProfileResource','stack','render','contact','message','interaction','account','index','map','SquareProject','rawAttributes','type','model','name','keys','query','intersection','attributes','length','order','sort','where','filters','pick','filter','options','includeAll','include','findAll','catch','show','params','fields','merge','body','user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addUsers','ids'];(function(_0x21cda3,_0x17b90a){var _0x558dc3=function(_0x3dc416){while(--_0x3dc416){_0x21cda3['push'](_0x21cda3['shift']());}};_0x558dc3(++_0x17b90a);}(_0x814b,0x1a2));var _0xb814=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0x814b[_0x55677b];return _0x104b88;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];config[_0xb814('0x1b')]=_[_0xb814('0x1c')](config[_0xb814('0x1b')],{'host':_0xb814('0x1d'),'port':0x18eb});var socket=require(_0xb814('0x1e'))(new Redis(config[_0xb814('0x1b')]));require(_0xb814('0x1f'))[_0xb814('0x20')](socket);function respondWithStatusCode(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xcc;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x21')](_0x44fb96);}return _0x3f4881[_0xb814('0x22')](_0x44fb96)[_0xb814('0x23')]();};}function respondWithResult(_0x45e0d0,_0x265a83){_0x265a83=_0x265a83||0xc8;return function(_0x125ce2){if(_0x125ce2){return _0x45e0d0[_0xb814('0x22')](_0x265a83)[_0xb814('0x24')](_0x125ce2);}};}function respondWithFilteredResult(_0x48c9df,_0x168a48){return function(_0x55ba16){if(_0x55ba16){var _0x270598=typeof _0x168a48[_0xb814('0x25')]==='undefined'&&typeof _0x168a48['limit']==='undefined';var _0x399b43=_0x55ba16['count'];var _0x57c128=_0x270598?0x0:_0x168a48[_0xb814('0x25')];var _0x24211d=_0x270598?_0x55ba16[_0xb814('0x26')]:_0x168a48['offset']+_0x168a48[_0xb814('0x27')];var _0x531032;if(_0x24211d>=_0x399b43){_0x24211d=_0x399b43;_0x531032=0xc8;}else{_0x531032=0xce;}_0x48c9df[_0xb814('0x22')](_0x531032);return _0x48c9df[_0xb814('0x28')](_0xb814('0x29'),_0x57c128+'-'+_0x24211d+'/'+_0x399b43)[_0xb814('0x24')](_0x55ba16);}return null;};}function patchUpdates(_0x27352e){return function(_0x2bd039){try{jsonpatch[_0xb814('0x2a')](_0x2bd039,_0x27352e,!![]);}catch(_0x594470){return BPromise[_0xb814('0x2b')](_0x594470);}return _0x2bd039['save']();};}function saveUpdates(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x2c')](_0x3f81d0)[_0xb814('0x2d')](function(_0xb9e57d){return _0xb9e57d;});}return null;};}function removeEntity(_0x3d836c,_0x5755ea){return function(_0x392222){if(_0x392222){return _0x392222[_0xb814('0x2e')]()[_0xb814('0x2d')](function(){var _0x349394=_0x392222[_0xb814('0x2f')]({'plain':!![]});var _0x1d5965=_0xb814('0x30');return db[_0xb814('0x31')]['destroy']({'where':{'type':_0x1d5965,'resourceId':_0x349394['id']}})[_0xb814('0x2d')](function(){return _0x392222;});})[_0xb814('0x2d')](function(){_0x3d836c['status'](0xcc)[_0xb814('0x23')]();});}};}function handleEntityNotFound(_0x37d24d,_0x530744){return function(_0x499f22){if(!_0x499f22){_0x37d24d[_0xb814('0x21')](0x194);}return _0x499f22;};}function handleError(_0x2051d0,_0x58c3ca){_0x58c3ca=_0x58c3ca||0x1f4;return function(_0x338a28){logger['error'](_0x338a28[_0xb814('0x32')]);if(_0x338a28['name']){delete _0x338a28['name'];}_0x2051d0[_0xb814('0x22')](_0x58c3ca)['send'](_0x338a28);};}function getMustacheRender(_0x2431e2,_0x19469b){return Mustache[_0xb814('0x33')](_0x2431e2,_['merge'](_0x19469b['body'],{'contact':_0x19469b[_0xb814('0x34')],'message':_0x19469b[_0xb814('0x35')],'agent':_0x19469b['agent'],'interaction':_0x19469b[_0xb814('0x36')],'account':_0x19469b[_0xb814('0x37')]}))||'';}exports[_0xb814('0x38')]=function(_0x217b7e,_0x1b78de){var _0x60024d={},_0x3672f3={},_0x4df4e6={'count':0x0,'rows':[]};var _0x3207ec=_[_0xb814('0x39')](db[_0xb814('0x3a')][_0xb814('0x3b')],function(_0x14100d){return{'name':_0x14100d['fieldName'],'type':_0x14100d[_0xb814('0x3c')]['key']};});_0x3672f3[_0xb814('0x3d')]=_[_0xb814('0x39')](_0x3207ec,_0xb814('0x3e'));_0x3672f3['query']=_[_0xb814('0x3f')](_0x217b7e[_0xb814('0x40')]);_0x3672f3['filters']=_[_0xb814('0x41')](_0x3672f3[_0xb814('0x3d')],_0x3672f3[_0xb814('0x40')]);_0x60024d[_0xb814('0x42')]=_[_0xb814('0x41')](_0x3672f3[_0xb814('0x3d')],qs['fields'](_0x217b7e[_0xb814('0x40')]['fields']));_0x60024d[_0xb814('0x42')]=_0x60024d['attributes'][_0xb814('0x43')]?_0x60024d['attributes']:_0x3672f3[_0xb814('0x3d')];if(!_0x217b7e[_0xb814('0x40')]['hasOwnProperty']('nolimit')){_0x60024d['limit']=qs['limit'](_0x217b7e[_0xb814('0x40')][_0xb814('0x27')]);_0x60024d[_0xb814('0x25')]=qs[_0xb814('0x25')](_0x217b7e['query']['offset']);}_0x60024d[_0xb814('0x44')]=qs['sort'](_0x217b7e[_0xb814('0x40')][_0xb814('0x45')]);_0x60024d[_0xb814('0x46')]=qs[_0xb814('0x47')](_[_0xb814('0x48')](_0x217b7e[_0xb814('0x40')],_0x3672f3[_0xb814('0x47')]),_0x3207ec);if(_0x217b7e[_0xb814('0x40')][_0xb814('0x49')]){_0x60024d['where']=_['merge'](_0x60024d['where'],{'$or':_[_0xb814('0x39')](_0x3207ec,function(_0x5ba0bc){if(_0x5ba0bc[_0xb814('0x3c')]!=='VIRTUAL'){var _0x411723={};_0x411723[_0x5ba0bc[_0xb814('0x3e')]]={'$like':'%'+_0x217b7e[_0xb814('0x40')][_0xb814('0x49')]+'%'};return _0x411723;}})});}_0x60024d=_['merge']({},_0x60024d,_0x217b7e[_0xb814('0x4a')]);var _0x15f01a={'where':_0x60024d[_0xb814('0x46')]};return db[_0xb814('0x3a')][_0xb814('0x26')](_0x15f01a)[_0xb814('0x2d')](function(_0x534eb8){_0x4df4e6[_0xb814('0x26')]=_0x534eb8;if(_0x217b7e[_0xb814('0x40')][_0xb814('0x4b')]){_0x60024d[_0xb814('0x4c')]=[{'all':!![]}];}return db[_0xb814('0x3a')][_0xb814('0x4d')](_0x60024d);})[_0xb814('0x2d')](function(_0x519545){_0x4df4e6['rows']=_0x519545;return _0x4df4e6;})[_0xb814('0x2d')](respondWithFilteredResult(_0x1b78de,_0x60024d))[_0xb814('0x4e')](handleError(_0x1b78de,null));};exports[_0xb814('0x4f')]=function(_0x2bf906,_0x43f1b){var _0x40e627={'raw':![],'where':{'id':_0x2bf906[_0xb814('0x50')]['id']}},_0x24b697={};_0x24b697[_0xb814('0x3d')]=_[_0xb814('0x3f')](db[_0xb814('0x3a')]['rawAttributes']);_0x24b697[_0xb814('0x40')]=_[_0xb814('0x3f')](_0x2bf906['query']);_0x24b697[_0xb814('0x47')]=_['intersection'](_0x24b697[_0xb814('0x3d')],_0x24b697[_0xb814('0x40')]);_0x40e627[_0xb814('0x42')]=_[_0xb814('0x41')](_0x24b697[_0xb814('0x3d')],qs[_0xb814('0x51')](_0x2bf906[_0xb814('0x40')][_0xb814('0x51')]));_0x40e627[_0xb814('0x42')]=_0x40e627[_0xb814('0x42')]['length']?_0x40e627['attributes']:_0x24b697[_0xb814('0x3d')];if(_0x2bf906[_0xb814('0x40')][_0xb814('0x4b')]){_0x40e627[_0xb814('0x4c')]=[{'all':!![]}];}_0x40e627=_[_0xb814('0x52')]({},_0x40e627,_0x2bf906[_0xb814('0x4a')]);return db[_0xb814('0x3a')]['find'](_0x40e627)[_0xb814('0x2d')](handleEntityNotFound(_0x43f1b,null))[_0xb814('0x2d')](respondWithResult(_0x43f1b,null))[_0xb814('0x4e')](handleError(_0x43f1b,null));};exports['create']=function(_0x3a5556,_0x4e6f3c){return db[_0xb814('0x3a')]['create'](_0x3a5556[_0xb814('0x53')],{})[_0xb814('0x2d')](function(_0x590c4b){var _0x793ea1=_0x3a5556[_0xb814('0x54')][_0xb814('0x2f')]({'plain':!![]});if(!_0x793ea1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x793ea1[_0xb814('0x55')]==='user'){var _0x13bdcf=_0x590c4b[_0xb814('0x2f')]({'plain':!![]});var _0x4aed78=_0xb814('0x30');return db['UserProfileSection']['find']({'where':{'name':_0x4aed78,'userProfileId':_0x793ea1[_0xb814('0x56')]},'raw':!![]})[_0xb814('0x2d')](function(_0x34935b){if(_0x34935b&&_0x34935b['autoAssociation']===0x0){return db[_0xb814('0x31')]['create']({'name':_0x13bdcf[_0xb814('0x3e')],'resourceId':_0x13bdcf['id'],'type':_0x34935b[_0xb814('0x3e')],'sectionId':_0x34935b['id']},{})['then'](function(){return _0x590c4b;});}else{return _0x590c4b;}})[_0xb814('0x4e')](function(_0x5c32c2){logger[_0xb814('0x57')](_0xb814('0x58'),_0x5c32c2);throw _0x5c32c2;});}return _0x590c4b;})[_0xb814('0x2d')](respondWithResult(_0x4e6f3c,0xc9))[_0xb814('0x4e')](handleError(_0x4e6f3c,null));};exports[_0xb814('0x2c')]=function(_0x34acca,_0x21d3e9){if(_0x34acca[_0xb814('0x53')]['id']){delete _0x34acca['body']['id'];}return db[_0xb814('0x3a')][_0xb814('0x59')]({'where':{'id':_0x34acca['params']['id']}})[_0xb814('0x2d')](handleEntityNotFound(_0x21d3e9,null))[_0xb814('0x2d')](saveUpdates(_0x34acca['body'],null))[_0xb814('0x2d')](respondWithResult(_0x21d3e9,null))['catch'](handleError(_0x21d3e9,null));};exports['destroy']=function(_0x2114ca,_0x5257be){return db[_0xb814('0x3a')][_0xb814('0x59')]({'where':{'id':_0x2114ca[_0xb814('0x50')]['id']}})['then'](handleEntityNotFound(_0x5257be,null))[_0xb814('0x2d')](removeEntity(_0x5257be,null))['catch'](handleError(_0x5257be,null));};exports[_0xb814('0x5a')]=function(_0x1e9196,_0x1236d4,_0x176585){return db[_0xb814('0x3a')][_0xb814('0x59')]({'where':{'id':_0x1e9196[_0xb814('0x50')]['id']}})[_0xb814('0x2d')](handleEntityNotFound(_0x1236d4,null))[_0xb814('0x2d')](function(_0x4d611d){if(_0x4d611d){return _0x4d611d[_0xb814('0x5a')](_0x1e9196[_0xb814('0x53')][_0xb814('0x5b')],_[_0xb814('0x5c')](_0x1e9196[_0xb814('0x53')],[_0xb814('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x1236d4,null))[_0xb814('0x4e')](handleError(_0x1236d4,null));};exports['removeUsers']=function(_0x3cd4f7,_0x39b754,_0xac95cf){return db['SquareProject'][_0xb814('0x59')]({'where':{'id':_0x3cd4f7['params']['id']}})[_0xb814('0x2d')](handleEntityNotFound(_0x39b754,null))['then'](function(_0x2f0c94){if(_0x2f0c94){return _0x2f0c94[_0xb814('0x5d')](_0x3cd4f7[_0xb814('0x40')][_0xb814('0x5b')])[_0xb814('0x2d')](function(){if(_[_0xb814('0x5e')](_0x3cd4f7[_0xb814('0x40')]['ids'])){for(var _0x44088d=0x0;_0x44088d<_0x3cd4f7['query'][_0xb814('0x5b')][_0xb814('0x43')];_0x44088d+=0x1){socket[_0xb814('0x5f')](_0xb814('0x60'),{'UserId':Number(_0x3cd4f7[_0xb814('0x40')][_0xb814('0x5b')][_0x44088d]),'SquareProjectId':Number(_0x3cd4f7['params']['id'])});}}else{socket[_0xb814('0x5f')](_0xb814('0x60'),{'UserId':Number(_0x3cd4f7['query'][_0xb814('0x5b')]),'SquareProjectId':Number(_0x3cd4f7[_0xb814('0x50')]['id'])});}});}})[_0xb814('0x2d')](respondWithStatusCode(_0x39b754,null))[_0xb814('0x4e')](handleError(_0x39b754,null));};exports[_0xb814('0x61')]=function(_0x51d834,_0x3a4d4b,_0x5e8e8e){var _0x24594a={};var _0x16f8f2={};var _0x2645f6;var _0x45dc85;return db[_0xb814('0x3a')][_0xb814('0x62')]({'where':{'id':_0x51d834['params']['id']}})['then'](handleEntityNotFound(_0x3a4d4b,null))['then'](function(_0x25c776){if(_0x25c776){_0x2645f6=_0x25c776;_0x16f8f2['model']=_[_0xb814('0x3f')](db[_0xb814('0x63')][_0xb814('0x3b')]);_0x16f8f2['query']=_[_0xb814('0x3f')](_0x51d834[_0xb814('0x40')]);_0x16f8f2[_0xb814('0x47')]=_['intersection'](_0x16f8f2[_0xb814('0x3d')],_0x16f8f2[_0xb814('0x40')]);_0x24594a[_0xb814('0x42')]=_[_0xb814('0x41')](_0x16f8f2['model'],qs['fields'](_0x51d834[_0xb814('0x40')][_0xb814('0x51')]));_0x24594a[_0xb814('0x42')]=_0x24594a[_0xb814('0x42')][_0xb814('0x43')]?_0x24594a[_0xb814('0x42')]:_0x16f8f2[_0xb814('0x3d')];_0x24594a[_0xb814('0x44')]=qs[_0xb814('0x45')](_0x51d834[_0xb814('0x40')][_0xb814('0x45')]);_0x24594a[_0xb814('0x46')]=qs[_0xb814('0x47')](_[_0xb814('0x48')](_0x51d834[_0xb814('0x40')],_0x16f8f2['filters']));if(_0x51d834[_0xb814('0x40')][_0xb814('0x49')]){_0x24594a[_0xb814('0x46')]=_[_0xb814('0x52')](_0x24594a[_0xb814('0x46')],{'$or':_[_0xb814('0x39')](_0x24594a['attributes'],function(_0xff4dc2){var _0x52e1fc={};_0x52e1fc[_0xff4dc2]={'$like':'%'+_0x51d834[_0xb814('0x40')][_0xb814('0x49')]+'%'};return _0x52e1fc;})});}_0x24594a=_[_0xb814('0x52')]({},_0x24594a,_0x51d834[_0xb814('0x4a')]);return _0x2645f6[_0xb814('0x61')](_0x24594a);}})['then'](function(_0x4c44ee){if(_0x4c44ee){_0x45dc85=_0x4c44ee[_0xb814('0x43')];if(!_0x51d834[_0xb814('0x40')][_0xb814('0x64')](_0xb814('0x65'))){_0x24594a['limit']=qs[_0xb814('0x27')](_0x51d834['query'][_0xb814('0x27')]);_0x24594a[_0xb814('0x25')]=qs['offset'](_0x51d834['query'][_0xb814('0x25')]);}return _0x2645f6['getUsers'](_0x24594a);}})[_0xb814('0x2d')](function(_0x163c2b){if(_0x163c2b){return _0x163c2b?{'count':_0x45dc85,'rows':_0x163c2b}:null;}})[_0xb814('0x2d')](respondWithResult(_0x3a4d4b,null))[_0xb814('0x4e')](handleError(_0x3a4d4b,null));}; \ No newline at end of file +var _0x814b=['omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','SquareProjects','UserProfileResource','stack','render','contact','message','interaction','account','index','map','SquareProject','rawAttributes','type','model','name','keys','query','intersection','attributes','length','order','sort','where','filters','pick','filter','options','includeAll','include','findAll','catch','show','params','fields','merge','body','user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addUsers','ids'];(function(_0x373afd,_0x4afa02){var _0x48a7a9=function(_0x5787ce){while(--_0x5787ce){_0x373afd['push'](_0x373afd['shift']());}};_0x48a7a9(++_0x4afa02);}(_0x814b,0x1a2));var _0xb814=function(_0x5a488c,_0x4cc470){_0x5a488c=_0x5a488c-0x0;var _0x53a7d6=_0x814b[_0x5a488c];return _0x53a7d6;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];config[_0xb814('0x1b')]=_[_0xb814('0x1c')](config[_0xb814('0x1b')],{'host':_0xb814('0x1d'),'port':0x18eb});var socket=require(_0xb814('0x1e'))(new Redis(config[_0xb814('0x1b')]));require(_0xb814('0x1f'))[_0xb814('0x20')](socket);function respondWithStatusCode(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xcc;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x21')](_0x44fb96);}return _0x3f4881[_0xb814('0x22')](_0x44fb96)[_0xb814('0x23')]();};}function respondWithResult(_0x45e0d0,_0x265a83){_0x265a83=_0x265a83||0xc8;return function(_0x125ce2){if(_0x125ce2){return _0x45e0d0[_0xb814('0x22')](_0x265a83)[_0xb814('0x24')](_0x125ce2);}};}function respondWithFilteredResult(_0x48c9df,_0x168a48){return function(_0x55ba16){if(_0x55ba16){var _0x270598=typeof _0x168a48[_0xb814('0x25')]==='undefined'&&typeof _0x168a48['limit']==='undefined';var _0x399b43=_0x55ba16['count'];var _0x57c128=_0x270598?0x0:_0x168a48[_0xb814('0x25')];var _0x24211d=_0x270598?_0x55ba16[_0xb814('0x26')]:_0x168a48['offset']+_0x168a48[_0xb814('0x27')];var _0x531032;if(_0x24211d>=_0x399b43){_0x24211d=_0x399b43;_0x531032=0xc8;}else{_0x531032=0xce;}_0x48c9df[_0xb814('0x22')](_0x531032);return _0x48c9df[_0xb814('0x28')](_0xb814('0x29'),_0x57c128+'-'+_0x24211d+'/'+_0x399b43)[_0xb814('0x24')](_0x55ba16);}return null;};}function patchUpdates(_0x27352e){return function(_0x2bd039){try{jsonpatch[_0xb814('0x2a')](_0x2bd039,_0x27352e,!![]);}catch(_0x594470){return BPromise[_0xb814('0x2b')](_0x594470);}return _0x2bd039['save']();};}function saveUpdates(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x2c')](_0x3f81d0)[_0xb814('0x2d')](function(_0xb9e57d){return _0xb9e57d;});}return null;};}function removeEntity(_0x3d836c,_0x5755ea){return function(_0x392222){if(_0x392222){return _0x392222[_0xb814('0x2e')]()[_0xb814('0x2d')](function(){var _0x349394=_0x392222[_0xb814('0x2f')]({'plain':!![]});var _0x1d5965=_0xb814('0x30');return db[_0xb814('0x31')]['destroy']({'where':{'type':_0x1d5965,'resourceId':_0x349394['id']}})[_0xb814('0x2d')](function(){return _0x392222;});})[_0xb814('0x2d')](function(){_0x3d836c['status'](0xcc)[_0xb814('0x23')]();});}};}function handleEntityNotFound(_0x37d24d,_0x530744){return function(_0x499f22){if(!_0x499f22){_0x37d24d[_0xb814('0x21')](0x194);}return _0x499f22;};}function handleError(_0x2051d0,_0x58c3ca){_0x58c3ca=_0x58c3ca||0x1f4;return function(_0x338a28){logger['error'](_0x338a28[_0xb814('0x32')]);if(_0x338a28['name']){delete _0x338a28['name'];}_0x2051d0[_0xb814('0x22')](_0x58c3ca)['send'](_0x338a28);};}function getMustacheRender(_0x2431e2,_0x19469b){return Mustache[_0xb814('0x33')](_0x2431e2,_['merge'](_0x19469b['body'],{'contact':_0x19469b[_0xb814('0x34')],'message':_0x19469b[_0xb814('0x35')],'agent':_0x19469b['agent'],'interaction':_0x19469b[_0xb814('0x36')],'account':_0x19469b[_0xb814('0x37')]}))||'';}exports[_0xb814('0x38')]=function(_0x217b7e,_0x1b78de){var _0x60024d={},_0x3672f3={},_0x4df4e6={'count':0x0,'rows':[]};var _0x3207ec=_[_0xb814('0x39')](db[_0xb814('0x3a')][_0xb814('0x3b')],function(_0x14100d){return{'name':_0x14100d['fieldName'],'type':_0x14100d[_0xb814('0x3c')]['key']};});_0x3672f3[_0xb814('0x3d')]=_[_0xb814('0x39')](_0x3207ec,_0xb814('0x3e'));_0x3672f3['query']=_[_0xb814('0x3f')](_0x217b7e[_0xb814('0x40')]);_0x3672f3['filters']=_[_0xb814('0x41')](_0x3672f3[_0xb814('0x3d')],_0x3672f3[_0xb814('0x40')]);_0x60024d[_0xb814('0x42')]=_[_0xb814('0x41')](_0x3672f3[_0xb814('0x3d')],qs['fields'](_0x217b7e[_0xb814('0x40')]['fields']));_0x60024d[_0xb814('0x42')]=_0x60024d['attributes'][_0xb814('0x43')]?_0x60024d['attributes']:_0x3672f3[_0xb814('0x3d')];if(!_0x217b7e[_0xb814('0x40')]['hasOwnProperty']('nolimit')){_0x60024d['limit']=qs['limit'](_0x217b7e[_0xb814('0x40')][_0xb814('0x27')]);_0x60024d[_0xb814('0x25')]=qs[_0xb814('0x25')](_0x217b7e['query']['offset']);}_0x60024d[_0xb814('0x44')]=qs['sort'](_0x217b7e[_0xb814('0x40')][_0xb814('0x45')]);_0x60024d[_0xb814('0x46')]=qs[_0xb814('0x47')](_[_0xb814('0x48')](_0x217b7e[_0xb814('0x40')],_0x3672f3[_0xb814('0x47')]),_0x3207ec);if(_0x217b7e[_0xb814('0x40')][_0xb814('0x49')]){_0x60024d['where']=_['merge'](_0x60024d['where'],{'$or':_[_0xb814('0x39')](_0x3207ec,function(_0x5ba0bc){if(_0x5ba0bc[_0xb814('0x3c')]!=='VIRTUAL'){var _0x411723={};_0x411723[_0x5ba0bc[_0xb814('0x3e')]]={'$like':'%'+_0x217b7e[_0xb814('0x40')][_0xb814('0x49')]+'%'};return _0x411723;}})});}_0x60024d=_['merge']({},_0x60024d,_0x217b7e[_0xb814('0x4a')]);var _0x15f01a={'where':_0x60024d[_0xb814('0x46')]};return db[_0xb814('0x3a')][_0xb814('0x26')](_0x15f01a)[_0xb814('0x2d')](function(_0x534eb8){_0x4df4e6[_0xb814('0x26')]=_0x534eb8;if(_0x217b7e[_0xb814('0x40')][_0xb814('0x4b')]){_0x60024d[_0xb814('0x4c')]=[{'all':!![]}];}return db[_0xb814('0x3a')][_0xb814('0x4d')](_0x60024d);})[_0xb814('0x2d')](function(_0x519545){_0x4df4e6['rows']=_0x519545;return _0x4df4e6;})[_0xb814('0x2d')](respondWithFilteredResult(_0x1b78de,_0x60024d))[_0xb814('0x4e')](handleError(_0x1b78de,null));};exports[_0xb814('0x4f')]=function(_0x2bf906,_0x43f1b){var _0x40e627={'raw':![],'where':{'id':_0x2bf906[_0xb814('0x50')]['id']}},_0x24b697={};_0x24b697[_0xb814('0x3d')]=_[_0xb814('0x3f')](db[_0xb814('0x3a')]['rawAttributes']);_0x24b697[_0xb814('0x40')]=_[_0xb814('0x3f')](_0x2bf906['query']);_0x24b697[_0xb814('0x47')]=_['intersection'](_0x24b697[_0xb814('0x3d')],_0x24b697[_0xb814('0x40')]);_0x40e627[_0xb814('0x42')]=_[_0xb814('0x41')](_0x24b697[_0xb814('0x3d')],qs[_0xb814('0x51')](_0x2bf906[_0xb814('0x40')][_0xb814('0x51')]));_0x40e627[_0xb814('0x42')]=_0x40e627[_0xb814('0x42')]['length']?_0x40e627['attributes']:_0x24b697[_0xb814('0x3d')];if(_0x2bf906[_0xb814('0x40')][_0xb814('0x4b')]){_0x40e627[_0xb814('0x4c')]=[{'all':!![]}];}_0x40e627=_[_0xb814('0x52')]({},_0x40e627,_0x2bf906[_0xb814('0x4a')]);return db[_0xb814('0x3a')]['find'](_0x40e627)[_0xb814('0x2d')](handleEntityNotFound(_0x43f1b,null))[_0xb814('0x2d')](respondWithResult(_0x43f1b,null))[_0xb814('0x4e')](handleError(_0x43f1b,null));};exports['create']=function(_0x3a5556,_0x4e6f3c){return db[_0xb814('0x3a')]['create'](_0x3a5556[_0xb814('0x53')],{})[_0xb814('0x2d')](function(_0x590c4b){var _0x793ea1=_0x3a5556[_0xb814('0x54')][_0xb814('0x2f')]({'plain':!![]});if(!_0x793ea1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x793ea1[_0xb814('0x55')]==='user'){var _0x13bdcf=_0x590c4b[_0xb814('0x2f')]({'plain':!![]});var _0x4aed78=_0xb814('0x30');return db['UserProfileSection']['find']({'where':{'name':_0x4aed78,'userProfileId':_0x793ea1[_0xb814('0x56')]},'raw':!![]})[_0xb814('0x2d')](function(_0x34935b){if(_0x34935b&&_0x34935b['autoAssociation']===0x0){return db[_0xb814('0x31')]['create']({'name':_0x13bdcf[_0xb814('0x3e')],'resourceId':_0x13bdcf['id'],'type':_0x34935b[_0xb814('0x3e')],'sectionId':_0x34935b['id']},{})['then'](function(){return _0x590c4b;});}else{return _0x590c4b;}})[_0xb814('0x4e')](function(_0x5c32c2){logger[_0xb814('0x57')](_0xb814('0x58'),_0x5c32c2);throw _0x5c32c2;});}return _0x590c4b;})[_0xb814('0x2d')](respondWithResult(_0x4e6f3c,0xc9))[_0xb814('0x4e')](handleError(_0x4e6f3c,null));};exports[_0xb814('0x2c')]=function(_0x34acca,_0x21d3e9){if(_0x34acca[_0xb814('0x53')]['id']){delete _0x34acca['body']['id'];}return db[_0xb814('0x3a')][_0xb814('0x59')]({'where':{'id':_0x34acca['params']['id']}})[_0xb814('0x2d')](handleEntityNotFound(_0x21d3e9,null))[_0xb814('0x2d')](saveUpdates(_0x34acca['body'],null))[_0xb814('0x2d')](respondWithResult(_0x21d3e9,null))['catch'](handleError(_0x21d3e9,null));};exports['destroy']=function(_0x2114ca,_0x5257be){return db[_0xb814('0x3a')][_0xb814('0x59')]({'where':{'id':_0x2114ca[_0xb814('0x50')]['id']}})['then'](handleEntityNotFound(_0x5257be,null))[_0xb814('0x2d')](removeEntity(_0x5257be,null))['catch'](handleError(_0x5257be,null));};exports[_0xb814('0x5a')]=function(_0x1e9196,_0x1236d4,_0x176585){return db[_0xb814('0x3a')][_0xb814('0x59')]({'where':{'id':_0x1e9196[_0xb814('0x50')]['id']}})[_0xb814('0x2d')](handleEntityNotFound(_0x1236d4,null))[_0xb814('0x2d')](function(_0x4d611d){if(_0x4d611d){return _0x4d611d[_0xb814('0x5a')](_0x1e9196[_0xb814('0x53')][_0xb814('0x5b')],_[_0xb814('0x5c')](_0x1e9196[_0xb814('0x53')],[_0xb814('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x1236d4,null))[_0xb814('0x4e')](handleError(_0x1236d4,null));};exports['removeUsers']=function(_0x3cd4f7,_0x39b754,_0xac95cf){return db['SquareProject'][_0xb814('0x59')]({'where':{'id':_0x3cd4f7['params']['id']}})[_0xb814('0x2d')](handleEntityNotFound(_0x39b754,null))['then'](function(_0x2f0c94){if(_0x2f0c94){return _0x2f0c94[_0xb814('0x5d')](_0x3cd4f7[_0xb814('0x40')][_0xb814('0x5b')])[_0xb814('0x2d')](function(){if(_[_0xb814('0x5e')](_0x3cd4f7[_0xb814('0x40')]['ids'])){for(var _0x44088d=0x0;_0x44088d<_0x3cd4f7['query'][_0xb814('0x5b')][_0xb814('0x43')];_0x44088d+=0x1){socket[_0xb814('0x5f')](_0xb814('0x60'),{'UserId':Number(_0x3cd4f7[_0xb814('0x40')][_0xb814('0x5b')][_0x44088d]),'SquareProjectId':Number(_0x3cd4f7['params']['id'])});}}else{socket[_0xb814('0x5f')](_0xb814('0x60'),{'UserId':Number(_0x3cd4f7['query'][_0xb814('0x5b')]),'SquareProjectId':Number(_0x3cd4f7[_0xb814('0x50')]['id'])});}});}})[_0xb814('0x2d')](respondWithStatusCode(_0x39b754,null))[_0xb814('0x4e')](handleError(_0x39b754,null));};exports[_0xb814('0x61')]=function(_0x51d834,_0x3a4d4b,_0x5e8e8e){var _0x24594a={};var _0x16f8f2={};var _0x2645f6;var _0x45dc85;return db[_0xb814('0x3a')][_0xb814('0x62')]({'where':{'id':_0x51d834['params']['id']}})['then'](handleEntityNotFound(_0x3a4d4b,null))['then'](function(_0x25c776){if(_0x25c776){_0x2645f6=_0x25c776;_0x16f8f2['model']=_[_0xb814('0x3f')](db[_0xb814('0x63')][_0xb814('0x3b')]);_0x16f8f2['query']=_[_0xb814('0x3f')](_0x51d834[_0xb814('0x40')]);_0x16f8f2[_0xb814('0x47')]=_['intersection'](_0x16f8f2[_0xb814('0x3d')],_0x16f8f2[_0xb814('0x40')]);_0x24594a[_0xb814('0x42')]=_[_0xb814('0x41')](_0x16f8f2['model'],qs['fields'](_0x51d834[_0xb814('0x40')][_0xb814('0x51')]));_0x24594a[_0xb814('0x42')]=_0x24594a[_0xb814('0x42')][_0xb814('0x43')]?_0x24594a[_0xb814('0x42')]:_0x16f8f2[_0xb814('0x3d')];_0x24594a[_0xb814('0x44')]=qs[_0xb814('0x45')](_0x51d834[_0xb814('0x40')][_0xb814('0x45')]);_0x24594a[_0xb814('0x46')]=qs[_0xb814('0x47')](_[_0xb814('0x48')](_0x51d834[_0xb814('0x40')],_0x16f8f2['filters']));if(_0x51d834[_0xb814('0x40')][_0xb814('0x49')]){_0x24594a[_0xb814('0x46')]=_[_0xb814('0x52')](_0x24594a[_0xb814('0x46')],{'$or':_[_0xb814('0x39')](_0x24594a['attributes'],function(_0xff4dc2){var _0x52e1fc={};_0x52e1fc[_0xff4dc2]={'$like':'%'+_0x51d834[_0xb814('0x40')][_0xb814('0x49')]+'%'};return _0x52e1fc;})});}_0x24594a=_[_0xb814('0x52')]({},_0x24594a,_0x51d834[_0xb814('0x4a')]);return _0x2645f6[_0xb814('0x61')](_0x24594a);}})['then'](function(_0x4c44ee){if(_0x4c44ee){_0x45dc85=_0x4c44ee[_0xb814('0x43')];if(!_0x51d834[_0xb814('0x40')][_0xb814('0x64')](_0xb814('0x65'))){_0x24594a['limit']=qs[_0xb814('0x27')](_0x51d834['query'][_0xb814('0x27')]);_0x24594a[_0xb814('0x25')]=qs['offset'](_0x51d834['query'][_0xb814('0x25')]);}return _0x2645f6['getUsers'](_0x24594a);}})[_0xb814('0x2d')](function(_0x163c2b){if(_0x163c2b){return _0x163c2b?{'count':_0x45dc85,'rows':_0x163c2b}:null;}})[_0xb814('0x2d')](respondWithResult(_0x3a4d4b,null))[_0xb814('0x4e')](handleError(_0x3a4d4b,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 085af0c..924adc3 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 _0x6556=['events','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2553ff,_0x1fde7e){var _0x58c1a6=function(_0x4347b8){while(--_0x4347b8){_0x2553ff['push'](_0x2553ff['shift']());}};_0x58c1a6(++_0x1fde7e);}(_0x6556,0x15e));var _0x6655=function(_0x3d1306,_0x32320a){_0x3d1306=_0x3d1306-0x0;var _0x67b4a6=_0x6556[_0x3d1306];return _0x67b4a6;};'use strict';var EventEmitter=require(_0x6655('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x6655('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x6655('0x2')](0x0);var events={'afterCreate':_0x6655('0x3'),'afterUpdate':_0x6655('0x4'),'afterDestroy':_0x6655('0x5')};function emitEvent(_0x41666d){return function(_0x495cf0,_0x40dc9c,_0x5134c0){SquareProjectEvents[_0x6655('0x6')](_0x41666d+':'+_0x495cf0['id'],_0x495cf0);SquareProjectEvents['emit'](_0x41666d,_0x495cf0);_0x5134c0(null);};}for(var e in events){if(events[_0x6655('0x7')](e)){var event=events[e];SquareProject[_0x6655('0x8')](e,emitEvent(event));}}module[_0x6655('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xe0e8=['update','remove','emit','hasOwnProperty','hook','exports','events','SquareProject','setMaxListeners','save'];(function(_0x1f356c,_0x313364){var _0x2674dc=function(_0x427c11){while(--_0x427c11){_0x1f356c['push'](_0x1f356c['shift']());}};_0x2674dc(++_0x313364);}(_0xe0e8,0x1c8));var _0x8e0e=function(_0xd501,_0x435fbf){_0xd501=_0xd501-0x0;var _0x4b6c4e=_0xe0e8[_0xd501];return _0x4b6c4e;};'use strict';var EventEmitter=require(_0x8e0e('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x8e0e('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8e0e('0x2')](0x0);var events={'afterCreate':_0x8e0e('0x3'),'afterUpdate':_0x8e0e('0x4'),'afterDestroy':_0x8e0e('0x5')};function emitEvent(_0x7f2e63){return function(_0x4a04c2,_0x3f09fd,_0x156a69){SquareProjectEvents['emit'](_0x7f2e63+':'+_0x4a04c2['id'],_0x4a04c2);SquareProjectEvents[_0x8e0e('0x6')](_0x7f2e63,_0x4a04c2);_0x156a69(null);};}for(var e in events){if(events[_0x8e0e('0x7')](e)){var event=events[e];SquareProject[_0x8e0e('0x8')](e,emitEvent(event));}}module[_0x8e0e('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 33a24eb..771de69 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 _0x8664=['api','moment','bluebird','request-promise','path','rimraf','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','format','production','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x2dae12,_0x1e571b){var _0x19d22e=function(_0x2fcd4c){while(--_0x2fcd4c){_0x2dae12['push'](_0x2dae12['shift']());}};_0x19d22e(++_0x1e571b);}(_0x8664,0x11a));var _0x4866=function(_0x42cba6,_0x3829e7){_0x42cba6=_0x42cba6-0x0;var _0xbf6388=_0x8664[_0x42cba6];return _0xbf6388;};'use strict';var _=require(_0x4866('0x0'));var util=require(_0x4866('0x1'));var logger=require(_0x4866('0x2'))(_0x4866('0x3'));var moment=require(_0x4866('0x4'));var BPromise=require(_0x4866('0x5'));var rp=require(_0x4866('0x6'));var fs=require('fs');var path=require(_0x4866('0x7'));var rimraf=require(_0x4866('0x8'));var config=require('../../config/environment');var attributes=require(_0x4866('0x9'));module['exports']=function(_0x66b444,_0x3eb6f9){return _0x66b444[_0x4866('0xa')](_0x4866('0xb'),attributes,{'tableName':_0x4866('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x142f18,_0x4e07e3,_0x4185f2){if(_0x142f18[_0x4866('0xd')](_0x4866('0xe'))){_0x142f18[_0x4866('0xf')]=moment()[_0x4866('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x142f18[_0x4866('0xd')](_0x4866('0x11'))){_0x142f18['publishedAt']=moment()[_0x4866('0x10')](_0x4866('0x12'));}_0x4185f2(null,_0x142f18);}}});}; \ No newline at end of file +var _0x212b=['exports','SquareProject','square_projects','changed','savedAt','format','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x212b,0x148));var _0xb212=function(_0x5670c8,_0x5d5326){_0x5670c8=_0x5670c8-0x0;var _0x40f669=_0x212b[_0x5670c8];return _0x40f669;};'use strict';var _=require(_0xb212('0x0'));var util=require('util');var logger=require(_0xb212('0x1'))(_0xb212('0x2'));var moment=require(_0xb212('0x3'));var BPromise=require(_0xb212('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb212('0x5'));var rimraf=require(_0xb212('0x6'));var config=require(_0xb212('0x7'));var attributes=require('./squareProject.attributes');module[_0xb212('0x8')]=function(_0x49a13c,_0x21825a){return _0x49a13c['define'](_0xb212('0x9'),attributes,{'tableName':_0xb212('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c1000,_0x4cf8f7,_0x1fff1b){if(_0x5c1000[_0xb212('0xb')]('preproduction')){_0x5c1000[_0xb212('0xc')]=moment()[_0xb212('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5c1000['changed']('production')){_0x5c1000[_0xb212('0xe')]=moment()['format'](_0xb212('0xf'));}_0x1fff1b(null,_0x5c1000);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index d1da9cf..e882ed6 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 _0x367d=['redis','socket.io-emitter','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','find','raw','options','where','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../config/utils','jayson/promise','defaults'];(function(_0x65eae,_0x32dc5f){var _0x18e82b=function(_0x2b3bed){while(--_0x2b3bed){_0x65eae['push'](_0x65eae['shift']());}};_0x18e82b(++_0x32dc5f);}(_0x367d,0xbe));var _0xd367=function(_0xa2da60,_0x192058){_0xa2da60=_0xa2da60-0x0;var _0x126b73=_0x367d[_0xa2da60];return _0x126b73;};'use strict';var _=require(_0xd367('0x0'));var util=require(_0xd367('0x1'));var moment=require(_0xd367('0x2'));var BPromise=require('bluebird');var rs=require(_0xd367('0x3'));var fs=require('fs');var Redis=require(_0xd367('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd367('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd367('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xd367('0x7')](config[_0xd367('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xd367('0x9'))(new Redis(config['redis']));require(_0xd367('0xa'))[_0xd367('0xb')](socket);function respondWithRpcPromise(_0x2b9865,_0xfab881,_0x3d9e55){return new BPromise(function(_0x12158b,_0x19385d){return client['request'](_0x2b9865,_0x3d9e55)[_0xd367('0xc')](function(_0x886c4c){logger[_0xd367('0xd')](_0xd367('0xe'),_0xfab881,_0xd367('0xf'));logger[_0xd367('0x10')](_0xd367('0x11'),_0xfab881,'request\x20sent',JSON[_0xd367('0x12')](_0x886c4c));if(_0x886c4c[_0xd367('0x13')]){if(_0x886c4c[_0xd367('0x13')][_0xd367('0x14')]===0x1f4){logger['error'](_0xd367('0xe'),_0xfab881,_0x886c4c['error'][_0xd367('0x15')]);return _0x19385d(_0x886c4c[_0xd367('0x13')]['message']);}logger[_0xd367('0x13')](_0xd367('0xe'),_0xfab881,_0x886c4c[_0xd367('0x13')]['message']);return _0x12158b(_0x886c4c['error'][_0xd367('0x15')]);}else{logger[_0xd367('0xd')]('SquareProject,\x20%s,\x20%s',_0xfab881,_0xd367('0xf'));_0x12158b(_0x886c4c[_0xd367('0x16')]['message']);}})[_0xd367('0x17')](function(_0x21b420){logger['error']('SquareProject,\x20%s,\x20%s',_0xfab881,_0x21b420);_0x19385d(_0x21b420);});});}exports[_0xd367('0x18')]=function(_0x3e84ad){var _0x416fe5=this;return new Promise(function(_0x578fb7,_0x3ad149){return db['SquareProject'][_0xd367('0x19')]({'raw':_0x3e84ad['options']?_0x3e84ad['options'][_0xd367('0x1a')]===undefined?!![]:![]:!![],'where':_0x3e84ad[_0xd367('0x1b')]?_0x3e84ad[_0xd367('0x1b')][_0xd367('0x1c')]||null:null,'attributes':_0x3e84ad[_0xd367('0x1b')]?_0x3e84ad[_0xd367('0x1b')][_0xd367('0x1d')]||null:null,'include':_0x3e84ad[_0xd367('0x1b')]?_0x3e84ad[_0xd367('0x1b')][_0xd367('0x1e')]?_[_0xd367('0x1f')](_0x3e84ad['options']['include'],function(_0x277085){return{'model':db[_0x277085['model']],'as':_0x277085['as'],'attributes':_0x277085[_0xd367('0x1d')],'include':_0x277085[_0xd367('0x1e')]?_[_0xd367('0x1f')](_0x277085['include'],function(_0x27508f){return{'model':db[_0x27508f[_0xd367('0x20')]],'as':_0x27508f['as'],'attributes':_0x27508f[_0xd367('0x1d')],'include':_0x27508f[_0xd367('0x1e')]?_[_0xd367('0x1f')](_0x27508f[_0xd367('0x1e')],function(_0x105045){return{'model':db[_0x105045[_0xd367('0x20')]],'as':_0x105045['as'],'attributes':_0x105045['attributes']};}):[]};}):[]};}):[]:[]})[_0xd367('0xc')](function(_0x55ae9e){logger[_0xd367('0xd')]('ShowSquareProject',_0x3e84ad);logger[_0xd367('0x10')](_0xd367('0x18'),_0x3e84ad,JSON[_0xd367('0x12')](_0x55ae9e));_0x578fb7(_0x55ae9e);})[_0xd367('0x17')](function(_0x34a47e){logger[_0xd367('0x13')](_0xd367('0x18'),_0x34a47e['message'],_0x3e84ad);_0x3ad149(_0x416fe5['error'](0x1f4,_0x34a47e[_0xd367('0x15')]));});});}; \ No newline at end of file +var _0x8de4=['request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','where','attributes','include','map','model','debug','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s'];(function(_0xc47d44,_0x23c072){var _0x5b79a6=function(_0x4954e6){while(--_0x4954e6){_0xc47d44['push'](_0xc47d44['shift']());}};_0x5b79a6(++_0x23c072);}(_0x8de4,0xea));var _0x48de=function(_0x261a68,_0x5648c5){_0x261a68=_0x261a68-0x0;var _0x31090d=_0x8de4[_0x261a68];return _0x31090d;};'use strict';var _=require('lodash');var util=require(_0x48de('0x0'));var moment=require(_0x48de('0x1'));var BPromise=require('bluebird');var rs=require(_0x48de('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48de('0x3'))['db'];var utils=require(_0x48de('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x48de('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x48de('0x6')][_0x48de('0x7')]({'port':0x232a});config['redis']=_[_0x48de('0x8')](config[_0x48de('0x9')],{'host':_0x48de('0xa'),'port':0x18eb});var socket=require(_0x48de('0xb'))(new Redis(config[_0x48de('0x9')]));require(_0x48de('0xc'))[_0x48de('0xd')](socket);function respondWithRpcPromise(_0x15d038,_0x4ec7d1,_0x5caa45){return new BPromise(function(_0x814b0c,_0x239d09){return client[_0x48de('0xe')](_0x15d038,_0x5caa45)[_0x48de('0xf')](function(_0x17b946){logger[_0x48de('0x10')](_0x48de('0x11'),_0x4ec7d1,_0x48de('0x12'));logger['debug'](_0x48de('0x13'),_0x4ec7d1,_0x48de('0x12'),JSON[_0x48de('0x14')](_0x17b946));if(_0x17b946[_0x48de('0x15')]){if(_0x17b946[_0x48de('0x15')][_0x48de('0x16')]===0x1f4){logger[_0x48de('0x15')]('SquareProject,\x20%s,\x20%s',_0x4ec7d1,_0x17b946['error'][_0x48de('0x17')]);return _0x239d09(_0x17b946[_0x48de('0x15')][_0x48de('0x17')]);}logger['error'](_0x48de('0x11'),_0x4ec7d1,_0x17b946[_0x48de('0x15')][_0x48de('0x17')]);return _0x814b0c(_0x17b946[_0x48de('0x15')]['message']);}else{logger['info'](_0x48de('0x11'),_0x4ec7d1,_0x48de('0x12'));_0x814b0c(_0x17b946[_0x48de('0x18')][_0x48de('0x17')]);}})[_0x48de('0x19')](function(_0x391713){logger['error']('SquareProject,\x20%s,\x20%s',_0x4ec7d1,_0x391713);_0x239d09(_0x391713);});});}exports[_0x48de('0x1a')]=function(_0x447b37){var _0x386201=this;return new Promise(function(_0x51aedf,_0x470e09){return db[_0x48de('0x1b')][_0x48de('0x1c')]({'raw':_0x447b37['options']?_0x447b37['options']['raw']===undefined?!![]:![]:!![],'where':_0x447b37[_0x48de('0x1d')]?_0x447b37[_0x48de('0x1d')][_0x48de('0x1e')]||null:null,'attributes':_0x447b37['options']?_0x447b37[_0x48de('0x1d')][_0x48de('0x1f')]||null:null,'include':_0x447b37[_0x48de('0x1d')]?_0x447b37[_0x48de('0x1d')][_0x48de('0x20')]?_[_0x48de('0x21')](_0x447b37[_0x48de('0x1d')]['include'],function(_0x15283d){return{'model':db[_0x15283d[_0x48de('0x22')]],'as':_0x15283d['as'],'attributes':_0x15283d['attributes'],'include':_0x15283d[_0x48de('0x20')]?_[_0x48de('0x21')](_0x15283d[_0x48de('0x20')],function(_0x598a07){return{'model':db[_0x598a07[_0x48de('0x22')]],'as':_0x598a07['as'],'attributes':_0x598a07['attributes'],'include':_0x598a07['include']?_['map'](_0x598a07[_0x48de('0x20')],function(_0xcc35b0){return{'model':db[_0xcc35b0['model']],'as':_0xcc35b0['as'],'attributes':_0xcc35b0[_0x48de('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x479eb0){logger[_0x48de('0x10')](_0x48de('0x1a'),_0x447b37);logger[_0x48de('0x23')]('ShowSquareProject',_0x447b37,JSON[_0x48de('0x14')](_0x479eb0));_0x51aedf(_0x479eb0);})['catch'](function(_0x5365db){logger[_0x48de('0x15')](_0x48de('0x1a'),_0x5365db[_0x48de('0x17')],_0x447b37);_0x470e09(_0x386201[_0x48de('0x15')](0x1f4,_0x5365db['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index c16db74..c29ede3 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 _0x3f8a=['squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register','length'];(function(_0x427f38,_0x34f332){var _0x2f39d7=function(_0x593940){while(--_0x593940){_0x427f38['push'](_0x427f38['shift']());}};_0x2f39d7(++_0x34f332);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x53814e,_0x5eaf21){_0x53814e=_0x53814e-0x0;var _0x206d91=_0x3f8a[_0x53814e];return _0x206d91;};'use strict';var SquareProjectEvents=require(_0xa3f8('0x0'));var events=[_0xa3f8('0x1'),_0xa3f8('0x2'),_0xa3f8('0x3')];function createListener(_0x512b4c,_0x467a6c){return function(_0x143375){_0x467a6c[_0xa3f8('0x4')](_0x512b4c,_0x143375);};}function removeListener(_0x15b6aa,_0x2553fd){return function(){SquareProjectEvents[_0xa3f8('0x5')](_0x15b6aa,_0x2553fd);};}exports[_0xa3f8('0x6')]=function(_0x471464){for(var _0x1f160a=0x0,_0xf895d9=events[_0xa3f8('0x7')];_0x1f160a<_0xf895d9;_0x1f160a++){var _0x268332=events[_0x1f160a];var _0x2faf2e=createListener(_0xa3f8('0x8')+_0x268332,_0x471464);SquareProjectEvents['on'](_0x268332,_0x2faf2e);}}; \ No newline at end of file +var _0x1967=['remove','update','emit','removeListener','length','save'];(function(_0x1a68db,_0x5e50f1){var _0x4fadc6=function(_0x2869a7){while(--_0x2869a7){_0x1a68db['push'](_0x1a68db['shift']());}};_0x4fadc6(++_0x5e50f1);}(_0x1967,0x173));var _0x7196=function(_0x98c809,_0x2280dd){_0x98c809=_0x98c809-0x0;var _0x349dbe=_0x1967[_0x98c809];return _0x349dbe;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2')];function createListener(_0x35803d,_0x3319fa){return function(_0xa80a3f){_0x3319fa[_0x7196('0x3')](_0x35803d,_0xa80a3f);};}function removeListener(_0x1aaddd,_0x458ae8){return function(){SquareProjectEvents[_0x7196('0x4')](_0x1aaddd,_0x458ae8);};}exports['register']=function(_0x36b01e){for(var _0x186175=0x0,_0x194746=events[_0x7196('0x5')];_0x186175<_0x194746;_0x186175++){var _0x266a6e=events[_0x186175];var _0xad78a=createListener('squareProject:'+_0x266a6e,_0x36b01e);SquareProjectEvents['on'](_0x266a6e,_0xad78a);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 2cf29cb..016c38f 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 _0x9c9b=['/:id','show','/:id/download','download','post','create','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get'];(function(_0x1c90f5,_0x1a7790){var _0x595d03=function(_0x30e3c2){while(--_0x30e3c2){_0x1c90f5['push'](_0x1c90f5['shift']());}};_0x595d03(++_0x1a7790);}(_0x9c9b,0x194));var _0xb9c9=function(_0x573979,_0xf51e63){_0x573979=_0x573979-0x0;var _0x319d39=_0x9c9b[_0x573979];return _0x319d39;};'use strict';var multer=require('multer');var util=require(_0xb9c9('0x0'));var path=require(_0xb9c9('0x1'));var timeout=require(_0xb9c9('0x2'));var express=require(_0xb9c9('0x3'));var router=express[_0xb9c9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb9c9('0x5'));var interaction=require(_0xb9c9('0x6'));var config=require('../../config/environment');var controller=require('./squareRecording.controller');router['get']('/',auth[_0xb9c9('0x7')](),controller[_0xb9c9('0x8')]);router[_0xb9c9('0x9')](_0xb9c9('0xa'),auth[_0xb9c9('0x7')](),controller[_0xb9c9('0xb')]);router[_0xb9c9('0x9')](_0xb9c9('0xc'),auth[_0xb9c9('0x7')](),controller[_0xb9c9('0xd')]);router[_0xb9c9('0xe')]('/',auth[_0xb9c9('0x7')](),controller[_0xb9c9('0xf')]);router['put']('/:id',auth[_0xb9c9('0x7')](),controller[_0xb9c9('0x10')]);router[_0xb9c9('0x11')](_0xb9c9('0xa'),auth[_0xb9c9('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x28f2=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','post','put','/:id','update'];(function(_0x45ccbd,_0x97b4cb){var _0x31832b=function(_0x1bebe4){while(--_0x1bebe4){_0x45ccbd['push'](_0x45ccbd['shift']());}};_0x31832b(++_0x97b4cb);}(_0x28f2,0x193));var _0x228f=function(_0x3995cc,_0x3ed0d5){_0x3995cc=_0x3995cc-0x0;var _0x3afdb4=_0x28f2[_0x3995cc];return _0x3afdb4;};'use strict';var multer=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var path=require(_0x228f('0x2'));var timeout=require(_0x228f('0x3'));var express=require(_0x228f('0x4'));var router=express['Router']();var fs_extra=require(_0x228f('0x5'));var auth=require(_0x228f('0x6'));var interaction=require(_0x228f('0x7'));var config=require(_0x228f('0x8'));var controller=require(_0x228f('0x9'));router[_0x228f('0xa')]('/',auth[_0x228f('0xb')](),controller['index']);router[_0x228f('0xa')]('/:id',auth[_0x228f('0xb')](),controller[_0x228f('0xc')]);router[_0x228f('0xa')]('/:id/download',auth[_0x228f('0xb')](),controller['download']);router[_0x228f('0xd')]('/',auth[_0x228f('0xb')](),controller['create']);router[_0x228f('0xe')](_0x228f('0xf'),auth[_0x228f('0xb')](),controller[_0x228f('0x10')]);router[_0x228f('0x11')]('/:id',auth[_0x228f('0xb')](),controller[_0x228f('0x12')]);module[_0x228f('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 9f2cb79..1aed130 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 _0x9172=['substring','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x2f1ad5,_0x2c6c88){var _0x81ede=function(_0xeb4d3d){while(--_0xeb4d3d){_0x2f1ad5['push'](_0x2f1ad5['shift']());}};_0x81ede(++_0x2c6c88);}(_0x9172,0x1a5));var _0x2917=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x9172[_0x1ae5ab];return _0x1ce001;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2917('0x0')]},'calleridname':{'type':Sequelize[_0x2917('0x0')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x2917('0x0')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2917('0x0')]},'dnid':{'type':Sequelize[_0x2917('0x0')]},'projectName':{'type':Sequelize[_0x2917('0x0')]},'saveName':{'type':Sequelize[_0x2917('0x0')]},'filename':{'type':Sequelize[_0x2917('0x0')]},'savePath':{'type':Sequelize[_0x2917('0x0')]},'format':{'type':Sequelize[_0x2917('0x1')],'get':function(){var _0x27a6b6='';var _0x33b9f1=this[_0x2917('0x2')](_0x2917('0x3'));if(_0x33b9f1){_0x27a6b6=_0x33b9f1[_0x2917('0x4')](_0x33b9f1['lastIndexOf']('.'));}return _0x27a6b6;}}}; \ No newline at end of file +var _0x8292=['savePath','substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue'];(function(_0x3d1fd1,_0x546622){var _0x544edc=function(_0x44c916){while(--_0x44c916){_0x3d1fd1['push'](_0x3d1fd1['shift']());}};_0x544edc(++_0x546622);}(_0x8292,0x14c));var _0x2829=function(_0x5358cd,_0x293fd6){_0x5358cd=_0x5358cd-0x0;var _0xc144e2=_0x8292[_0x5358cd];return _0xc144e2;};'use strict';var Sequelize=require('sequelize');module[_0x2829('0x0')]={'uniqueid':{'type':Sequelize[_0x2829('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2829('0x1')]},'context':{'type':Sequelize[_0x2829('0x1')]},'extension':{'type':Sequelize[_0x2829('0x1')]},'priority':{'type':Sequelize[_0x2829('0x1')]},'accountcode':{'type':Sequelize[_0x2829('0x1')]},'dnid':{'type':Sequelize[_0x2829('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x2829('0x1')]},'filename':{'type':Sequelize[_0x2829('0x1')]},'savePath':{'type':Sequelize[_0x2829('0x1')]},'format':{'type':Sequelize[_0x2829('0x2')],'get':function(){var _0x20de64='';var _0x50de53=this[_0x2829('0x3')](_0x2829('0x4'));if(_0x50de53){_0x20de64=_0x50de53[_0x2829('0x5')](_0x50de53[_0x2829('0x6')]('.'));}return _0x20de64;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index b390191..a43ec3e 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 _0xf3e2=['model','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','length','find','catch','create','body','download','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','merge','message','agent','account','index','SquareRecording','rawAttributes','fieldName','type','map','query','keys','filters'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xf3e2,0x168));var _0x2f3e=function(_0x65f505,_0xaad51d){_0x65f505=_0x65f505-0x0;var _0x33cee5=_0xf3e2[_0x65f505];return _0x33cee5;};'use strict';var emlformat=require(_0x2f3e('0x0'));var rimraf=require(_0x2f3e('0x1'));var zipdir=require(_0x2f3e('0x2'));var jsonpatch=require(_0x2f3e('0x3'));var rp=require(_0x2f3e('0x4'));var moment=require(_0x2f3e('0x5'));var BPromise=require(_0x2f3e('0x6'));var Mustache=require(_0x2f3e('0x7'));var util=require('util');var path=require(_0x2f3e('0x8'));var sox=require('sox');var csv=require(_0x2f3e('0x9'));var ejs=require(_0x2f3e('0xa'));var fs=require('fs');var fs_extra=require(_0x2f3e('0xb'));var _=require(_0x2f3e('0xc'));var squel=require(_0x2f3e('0xd'));var crypto=require(_0x2f3e('0xe'));var jsforce=require(_0x2f3e('0xf'));var deskjs=require(_0x2f3e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2f3e('0x11'));var Papa=require('papaparse');var Redis=require(_0x2f3e('0x12'));var authService=require(_0x2f3e('0x13'));var qs=require(_0x2f3e('0x14'));var as=require(_0x2f3e('0x15'));var hardwareService=require(_0x2f3e('0x16'));var logger=require(_0x2f3e('0x17'))(_0x2f3e('0x18'));var utils=require(_0x2f3e('0x19'));var config=require(_0x2f3e('0x1a'));var licenseUtil=require(_0x2f3e('0x1b'));var db=require(_0x2f3e('0x1c'))['db'];function respondWithStatusCode(_0x105ea6,_0x507078){_0x507078=_0x507078||0xcc;return function(_0x25b913){if(_0x25b913){return _0x105ea6['sendStatus'](_0x507078);}return _0x105ea6[_0x2f3e('0x1d')](_0x507078)[_0x2f3e('0x1e')]();};}function respondWithResult(_0x5f3734,_0x536f5e){_0x536f5e=_0x536f5e||0xc8;return function(_0x1ad130){if(_0x1ad130){return _0x5f3734[_0x2f3e('0x1d')](_0x536f5e)[_0x2f3e('0x1f')](_0x1ad130);}};}function respondWithFilteredResult(_0x14a2a1,_0x38ac85){return function(_0xd6710){if(_0xd6710){var _0x4ecd41=typeof _0x38ac85[_0x2f3e('0x20')]===_0x2f3e('0x21')&&typeof _0x38ac85[_0x2f3e('0x22')]===_0x2f3e('0x21');var _0x52ab9c=_0xd6710[_0x2f3e('0x23')];var _0x480aa4=_0x4ecd41?0x0:_0x38ac85[_0x2f3e('0x20')];var _0x452bd8=_0x4ecd41?_0xd6710[_0x2f3e('0x23')]:_0x38ac85[_0x2f3e('0x20')]+_0x38ac85[_0x2f3e('0x22')];var _0x3f0cd1;if(_0x452bd8>=_0x52ab9c){_0x452bd8=_0x52ab9c;_0x3f0cd1=0xc8;}else{_0x3f0cd1=0xce;}_0x14a2a1[_0x2f3e('0x1d')](_0x3f0cd1);return _0x14a2a1[_0x2f3e('0x24')](_0x2f3e('0x25'),_0x480aa4+'-'+_0x452bd8+'/'+_0x52ab9c)[_0x2f3e('0x1f')](_0xd6710);}return null;};}function patchUpdates(_0x2ef1eb){return function(_0x14113e){try{jsonpatch[_0x2f3e('0x26')](_0x14113e,_0x2ef1eb,!![]);}catch(_0x44404a){return BPromise[_0x2f3e('0x27')](_0x44404a);}return _0x14113e[_0x2f3e('0x28')]();};}function saveUpdates(_0x37a48a,_0x2c4db5){return function(_0x22dd45){if(_0x22dd45){return _0x22dd45[_0x2f3e('0x29')](_0x37a48a)[_0x2f3e('0x2a')](function(_0x3bd446){return _0x3bd446;});}return null;};}function removeEntity(_0x16c8fc,_0x1217b9){return function(_0x5b4d8d){if(_0x5b4d8d){return _0x5b4d8d[_0x2f3e('0x2b')]()[_0x2f3e('0x2a')](function(){_0x16c8fc['status'](0xcc)[_0x2f3e('0x1e')]();});}};}function handleEntityNotFound(_0x43a4c8,_0x146cf0){return function(_0x6a2c1f){if(!_0x6a2c1f){_0x43a4c8['sendStatus'](0x194);}return _0x6a2c1f;};}function handleError(_0x5e8389,_0x427e06){_0x427e06=_0x427e06||0x1f4;return function(_0x32135f){logger[_0x2f3e('0x2c')](_0x32135f[_0x2f3e('0x2d')]);if(_0x32135f[_0x2f3e('0x2e')]){delete _0x32135f['name'];}_0x5e8389[_0x2f3e('0x1d')](_0x427e06)['send'](_0x32135f);};}function getMustacheRender(_0x593181,_0x13d8a7){return Mustache['render'](_0x593181,_[_0x2f3e('0x2f')](_0x13d8a7['body'],{'contact':_0x13d8a7['contact'],'message':_0x13d8a7[_0x2f3e('0x30')],'agent':_0x13d8a7[_0x2f3e('0x31')],'interaction':_0x13d8a7['interaction'],'account':_0x13d8a7[_0x2f3e('0x32')]}))||'';}exports[_0x2f3e('0x33')]=function(_0x2e9e39,_0x3760c4){var _0x3ab758={},_0x52f2f1={},_0xe6aa7d={'count':0x0,'rows':[]};var _0x2c0143=_['map'](db[_0x2f3e('0x34')][_0x2f3e('0x35')],function(_0x1a272f){return{'name':_0x1a272f[_0x2f3e('0x36')],'type':_0x1a272f[_0x2f3e('0x37')]['key']};});_0x52f2f1['model']=_[_0x2f3e('0x38')](_0x2c0143,_0x2f3e('0x2e'));_0x52f2f1[_0x2f3e('0x39')]=_[_0x2f3e('0x3a')](_0x2e9e39[_0x2f3e('0x39')]);_0x52f2f1[_0x2f3e('0x3b')]=_['intersection'](_0x52f2f1[_0x2f3e('0x3c')],_0x52f2f1['query']);_0x3ab758[_0x2f3e('0x3d')]=_[_0x2f3e('0x3e')](_0x52f2f1[_0x2f3e('0x3c')],qs[_0x2f3e('0x3f')](_0x2e9e39[_0x2f3e('0x39')][_0x2f3e('0x3f')]));_0x3ab758[_0x2f3e('0x3d')]=_0x3ab758[_0x2f3e('0x3d')]['length']?_0x3ab758[_0x2f3e('0x3d')]:_0x52f2f1[_0x2f3e('0x3c')];if(!_0x2e9e39['query'][_0x2f3e('0x40')]('nolimit')){_0x3ab758['limit']=qs[_0x2f3e('0x22')](_0x2e9e39[_0x2f3e('0x39')]['limit']);_0x3ab758[_0x2f3e('0x20')]=qs[_0x2f3e('0x20')](_0x2e9e39['query']['offset']);}_0x3ab758[_0x2f3e('0x41')]=qs[_0x2f3e('0x42')](_0x2e9e39[_0x2f3e('0x39')][_0x2f3e('0x42')]);_0x3ab758[_0x2f3e('0x43')]=qs[_0x2f3e('0x3b')](_[_0x2f3e('0x44')](_0x2e9e39[_0x2f3e('0x39')],_0x52f2f1[_0x2f3e('0x3b')]),_0x2c0143);if(_0x2e9e39[_0x2f3e('0x39')][_0x2f3e('0x45')]){_0x3ab758[_0x2f3e('0x43')]=_[_0x2f3e('0x2f')](_0x3ab758[_0x2f3e('0x43')],{'$or':_[_0x2f3e('0x38')](_0x2c0143,function(_0x50ba25){if(_0x50ba25[_0x2f3e('0x37')]!==_0x2f3e('0x46')){var _0x4320b9={};_0x4320b9[_0x50ba25['name']]={'$like':'%'+_0x2e9e39[_0x2f3e('0x39')][_0x2f3e('0x45')]+'%'};return _0x4320b9;}})});}_0x3ab758=_[_0x2f3e('0x2f')]({},_0x3ab758,_0x2e9e39[_0x2f3e('0x47')]);var _0x20a113={'where':_0x3ab758[_0x2f3e('0x43')]};return db[_0x2f3e('0x34')][_0x2f3e('0x23')](_0x20a113)[_0x2f3e('0x2a')](function(_0x1b819e){_0xe6aa7d['count']=_0x1b819e;if(_0x2e9e39[_0x2f3e('0x39')][_0x2f3e('0x48')]){_0x3ab758['include']=[{'all':!![]}];}return db[_0x2f3e('0x34')][_0x2f3e('0x49')](_0x3ab758);})['then'](function(_0x37be14){_0xe6aa7d[_0x2f3e('0x4a')]=_0x37be14;return _0xe6aa7d;})[_0x2f3e('0x2a')](respondWithFilteredResult(_0x3760c4,_0x3ab758))['catch'](handleError(_0x3760c4,null));};exports[_0x2f3e('0x4b')]=function(_0x14f230,_0x3d878c){var _0x142eb3={'raw':!![],'where':{'id':_0x14f230[_0x2f3e('0x4c')]['id']}},_0x52fad4={};_0x52fad4[_0x2f3e('0x3c')]=_['keys'](db[_0x2f3e('0x34')]['rawAttributes']);_0x52fad4[_0x2f3e('0x39')]=_[_0x2f3e('0x3a')](_0x14f230[_0x2f3e('0x39')]);_0x52fad4[_0x2f3e('0x3b')]=_[_0x2f3e('0x3e')](_0x52fad4[_0x2f3e('0x3c')],_0x52fad4[_0x2f3e('0x39')]);_0x142eb3[_0x2f3e('0x3d')]=_['intersection'](_0x52fad4['model'],qs['fields'](_0x14f230['query'][_0x2f3e('0x3f')]));_0x142eb3[_0x2f3e('0x3d')]=_0x142eb3[_0x2f3e('0x3d')][_0x2f3e('0x4d')]?_0x142eb3['attributes']:_0x52fad4[_0x2f3e('0x3c')];if(_0x14f230[_0x2f3e('0x39')]['includeAll']){_0x142eb3['include']=[{'all':!![]}];}_0x142eb3=_[_0x2f3e('0x2f')]({},_0x142eb3,_0x14f230[_0x2f3e('0x47')]);return db[_0x2f3e('0x34')][_0x2f3e('0x4e')](_0x142eb3)[_0x2f3e('0x2a')](handleEntityNotFound(_0x3d878c,null))[_0x2f3e('0x2a')](respondWithResult(_0x3d878c,null))[_0x2f3e('0x4f')](handleError(_0x3d878c,null));};exports[_0x2f3e('0x50')]=function(_0x5cc1aa,_0x40148c){return db[_0x2f3e('0x34')][_0x2f3e('0x50')](_0x5cc1aa[_0x2f3e('0x51')],{})[_0x2f3e('0x2a')](respondWithResult(_0x40148c,0xc9))[_0x2f3e('0x4f')](handleError(_0x40148c,null));};exports[_0x2f3e('0x29')]=function(_0x4bcfc0,_0xb79a26){if(_0x4bcfc0[_0x2f3e('0x51')]['id']){delete _0x4bcfc0['body']['id'];}return db[_0x2f3e('0x34')][_0x2f3e('0x4e')]({'where':{'id':_0x4bcfc0[_0x2f3e('0x4c')]['id']}})[_0x2f3e('0x2a')](handleEntityNotFound(_0xb79a26,null))[_0x2f3e('0x2a')](saveUpdates(_0x4bcfc0[_0x2f3e('0x51')],null))['then'](respondWithResult(_0xb79a26,null))['catch'](handleError(_0xb79a26,null));};exports[_0x2f3e('0x52')]=function(_0x123068,_0xd578c7,_0xdcb4ce){var _0x4314ba=require('../../components/encryptor');var _0x4e2252=![];var _0x19376a={};if(_0x123068[_0x2f3e('0x39')][_0x2f3e('0x37')]&&_0x123068[_0x2f3e('0x39')]['type']==='uniqueid'){_0x19376a['uniqueid']=_0x123068['params']['id'];}else{_0x19376a['id']=_0x123068['params']['id'];}return db[_0x2f3e('0x34')][_0x2f3e('0x4e')]({'where':_0x19376a,'attributes':['id',_0x2f3e('0x53'),'filename'],'raw':!![]})[_0x2f3e('0x2a')](handleEntityNotFound(_0xd578c7,null))[_0x2f3e('0x2a')](function(_0x44a92e){if(_0x44a92e){var _0x513072=_0x44a92e[_0x2f3e('0x53')];var _0x42a118=util[_0x2f3e('0x54')](_0x2f3e('0x55'),_0x513072);if(fs['existsSync'](_0x42a118)){_0x4e2252=!![];return _0x4314ba[_0x2f3e('0x56')](_0x42a118,_0x513072,config[_0x2f3e('0x57')][_0x2f3e('0x58')])[_0x2f3e('0x2a')](function(){return _0x44a92e;});}return _0x44a92e;}})['then'](function(_0x4d7cf4){if(_0x4d7cf4){var _0x3c9dfc=_0x4d7cf4[_0x2f3e('0x53')];if(!fs[_0x2f3e('0x59')](_0x3c9dfc)){throw new db[(_0x2f3e('0x5a'))][(_0x2f3e('0x5b'))](_0x2f3e('0x5c'));}if(_0x4d7cf4['filename']){return _0xd578c7[_0x2f3e('0x52')](_0x3c9dfc,_0x4d7cf4[_0x2f3e('0x5d')]+path[_0x2f3e('0x5e')](_0x3c9dfc),function(){if(_0x4e2252){fs['unlink'](_0x3c9dfc);}});}else{return _0xd578c7[_0x2f3e('0x52')](_0x3c9dfc,function(_0x2ccd3e){if(_0x4e2252){fs['unlink'](_0x3c9dfc);}});}}})['catch'](function(_0x35c193){if(_0x35c193['message']==='SquareRecording\x20not\x20found'){_0xd578c7[_0x2f3e('0x1d')](0x194)[_0x2f3e('0x5f')](_0x2f3e('0x60'));}else{return handleError(_0xd578c7,null);}});};exports[_0x2f3e('0x2b')]=function(_0x5ef17d,_0x372474){return db[_0x2f3e('0x34')]['find']({'where':{'id':_0x5ef17d['params']['id']}})[_0x2f3e('0x2a')](function(_0x4a1c76){if(_[_0x2f3e('0x61')](_0x4a1c76)){throw new ReferenceError(_0x2f3e('0x62'));}return _0x4a1c76;})['then'](function(_0x361cda){var _0x10016c=_0x361cda[_0x2f3e('0x53')];logger[_0x2f3e('0x63')](_0x2f3e('0x64'),_0x10016c);if(!_[_0x2f3e('0x61')](_0x361cda[_0x2f3e('0x53')])&&fs[_0x2f3e('0x59')](_0x10016c)){logger[_0x2f3e('0x63')](_0x2f3e('0x65')+_0x10016c+_0x2f3e('0x66'));fs[_0x2f3e('0x67')](_0x10016c);}_0x10016c=_0x10016c+_0x2f3e('0x68');if(!_['isNil'](_0x361cda[_0x2f3e('0x53')])&&fs[_0x2f3e('0x59')](_0x10016c)){logger[_0x2f3e('0x63')]('File:\x20\x22'+_0x10016c+_0x2f3e('0x66'));fs[_0x2f3e('0x67')](_0x10016c);}return _0x361cda;})[_0x2f3e('0x2a')](function(_0x456100){if(!_0x456100)throw new InternalError();return _0x456100[_0x2f3e('0x2b')]();})[_0x2f3e('0x2a')](function(){_0x372474[_0x2f3e('0x1d')](0xcc)[_0x2f3e('0x1e')]();})[_0x2f3e('0x4f')](handleError(_0x372474,null));}; \ No newline at end of file +var _0x57c3=['fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','set','reject','update','then','destroy','stack','name','send','render','merge','body','contact','message','interaction','account','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','include','catch','show','params','includeAll','create','download','uniqueid','find','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','to-csv'];(function(_0x1f3001,_0x1a0c65){var _0x43dc1d=function(_0x503e79){while(--_0x503e79){_0x1f3001['push'](_0x1f3001['shift']());}};_0x43dc1d(++_0x1a0c65);}(_0x57c3,0xc2));var _0x357c=function(_0x191050,_0x23cfd3){_0x191050=_0x191050-0x0;var _0xcfd2aa=_0x57c3[_0x191050];return _0xcfd2aa;};'use strict';var emlformat=require(_0x357c('0x0'));var rimraf=require(_0x357c('0x1'));var zipdir=require(_0x357c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x357c('0x3'));var Mustache=require(_0x357c('0x4'));var util=require(_0x357c('0x5'));var path=require(_0x357c('0x6'));var sox=require('sox');var csv=require(_0x357c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x357c('0x8'));var _=require(_0x357c('0x9'));var squel=require(_0x357c('0xa'));var crypto=require(_0x357c('0xb'));var jsforce=require(_0x357c('0xc'));var deskjs=require(_0x357c('0xd'));var toCsv=require(_0x357c('0x7'));var querystring=require('querystring');var Papa=require(_0x357c('0xe'));var Redis=require(_0x357c('0xf'));var authService=require(_0x357c('0x10'));var qs=require(_0x357c('0x11'));var as=require(_0x357c('0x12'));var hardwareService=require(_0x357c('0x13'));var logger=require(_0x357c('0x14'))(_0x357c('0x15'));var utils=require(_0x357c('0x16'));var config=require(_0x357c('0x17'));var licenseUtil=require(_0x357c('0x18'));var db=require(_0x357c('0x19'))['db'];function respondWithStatusCode(_0x4e4741,_0x3a0a83){_0x3a0a83=_0x3a0a83||0xcc;return function(_0x2f6c24){if(_0x2f6c24){return _0x4e4741[_0x357c('0x1a')](_0x3a0a83);}return _0x4e4741['status'](_0x3a0a83)['end']();};}function respondWithResult(_0x45244b,_0x128da8){_0x128da8=_0x128da8||0xc8;return function(_0x1465ee){if(_0x1465ee){return _0x45244b[_0x357c('0x1b')](_0x128da8)[_0x357c('0x1c')](_0x1465ee);}};}function respondWithFilteredResult(_0xf2ccec,_0x53ef53){return function(_0x25de41){if(_0x25de41){var _0x288ed7=typeof _0x53ef53['offset']==='undefined'&&typeof _0x53ef53[_0x357c('0x1d')]===_0x357c('0x1e');var _0xfeb048=_0x25de41['count'];var _0x21d0f9=_0x288ed7?0x0:_0x53ef53[_0x357c('0x1f')];var _0x1ddb95=_0x288ed7?_0x25de41[_0x357c('0x20')]:_0x53ef53[_0x357c('0x1f')]+_0x53ef53[_0x357c('0x1d')];var _0xb60cf9;if(_0x1ddb95>=_0xfeb048){_0x1ddb95=_0xfeb048;_0xb60cf9=0xc8;}else{_0xb60cf9=0xce;}_0xf2ccec[_0x357c('0x1b')](_0xb60cf9);return _0xf2ccec[_0x357c('0x21')]('Content-Range',_0x21d0f9+'-'+_0x1ddb95+'/'+_0xfeb048)[_0x357c('0x1c')](_0x25de41);}return null;};}function patchUpdates(_0xe3956){return function(_0x496938){try{jsonpatch['apply'](_0x496938,_0xe3956,!![]);}catch(_0x12879b){return BPromise[_0x357c('0x22')](_0x12879b);}return _0x496938['save']();};}function saveUpdates(_0x437762,_0x1e6c7f){return function(_0x5e7f32){if(_0x5e7f32){return _0x5e7f32[_0x357c('0x23')](_0x437762)[_0x357c('0x24')](function(_0x39ffda){return _0x39ffda;});}return null;};}function removeEntity(_0x17da84,_0x324bff){return function(_0x1cbd6c){if(_0x1cbd6c){return _0x1cbd6c[_0x357c('0x25')]()[_0x357c('0x24')](function(){_0x17da84['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37c9e1,_0xe1604d){return function(_0x134274){if(!_0x134274){_0x37c9e1[_0x357c('0x1a')](0x194);}return _0x134274;};}function handleError(_0x22fbff,_0x5287e4){_0x5287e4=_0x5287e4||0x1f4;return function(_0x40983e){logger['error'](_0x40983e[_0x357c('0x26')]);if(_0x40983e[_0x357c('0x27')]){delete _0x40983e[_0x357c('0x27')];}_0x22fbff['status'](_0x5287e4)[_0x357c('0x28')](_0x40983e);};}function getMustacheRender(_0x34d0a9,_0x34984f){return Mustache[_0x357c('0x29')](_0x34d0a9,_[_0x357c('0x2a')](_0x34984f[_0x357c('0x2b')],{'contact':_0x34984f[_0x357c('0x2c')],'message':_0x34984f[_0x357c('0x2d')],'agent':_0x34984f['agent'],'interaction':_0x34984f[_0x357c('0x2e')],'account':_0x34984f[_0x357c('0x2f')]}))||'';}exports[_0x357c('0x30')]=function(_0x4e9ea0,_0x288957){var _0x51b7f4={},_0x396740={},_0x859a04={'count':0x0,'rows':[]};var _0x2f52c3=_[_0x357c('0x31')](db[_0x357c('0x32')][_0x357c('0x33')],function(_0x3122b1){return{'name':_0x3122b1[_0x357c('0x34')],'type':_0x3122b1[_0x357c('0x35')][_0x357c('0x36')]};});_0x396740[_0x357c('0x37')]=_[_0x357c('0x31')](_0x2f52c3,_0x357c('0x27'));_0x396740['query']=_[_0x357c('0x38')](_0x4e9ea0[_0x357c('0x39')]);_0x396740['filters']=_[_0x357c('0x3a')](_0x396740[_0x357c('0x37')],_0x396740[_0x357c('0x39')]);_0x51b7f4[_0x357c('0x3b')]=_[_0x357c('0x3a')](_0x396740[_0x357c('0x37')],qs['fields'](_0x4e9ea0[_0x357c('0x39')][_0x357c('0x3c')]));_0x51b7f4[_0x357c('0x3b')]=_0x51b7f4['attributes'][_0x357c('0x3d')]?_0x51b7f4[_0x357c('0x3b')]:_0x396740[_0x357c('0x37')];if(!_0x4e9ea0['query']['hasOwnProperty'](_0x357c('0x3e'))){_0x51b7f4[_0x357c('0x1d')]=qs[_0x357c('0x1d')](_0x4e9ea0['query'][_0x357c('0x1d')]);_0x51b7f4['offset']=qs[_0x357c('0x1f')](_0x4e9ea0[_0x357c('0x39')][_0x357c('0x1f')]);}_0x51b7f4[_0x357c('0x3f')]=qs[_0x357c('0x40')](_0x4e9ea0['query'][_0x357c('0x40')]);_0x51b7f4[_0x357c('0x41')]=qs[_0x357c('0x42')](_[_0x357c('0x43')](_0x4e9ea0[_0x357c('0x39')],_0x396740[_0x357c('0x42')]),_0x2f52c3);if(_0x4e9ea0[_0x357c('0x39')][_0x357c('0x44')]){_0x51b7f4[_0x357c('0x41')]=_['merge'](_0x51b7f4[_0x357c('0x41')],{'$or':_[_0x357c('0x31')](_0x2f52c3,function(_0x4b2544){if(_0x4b2544[_0x357c('0x35')]!==_0x357c('0x45')){var _0x462d9f={};_0x462d9f[_0x4b2544[_0x357c('0x27')]]={'$like':'%'+_0x4e9ea0['query']['filter']+'%'};return _0x462d9f;}})});}_0x51b7f4=_[_0x357c('0x2a')]({},_0x51b7f4,_0x4e9ea0[_0x357c('0x46')]);var _0xee2bd4={'where':_0x51b7f4[_0x357c('0x41')]};return db[_0x357c('0x32')][_0x357c('0x20')](_0xee2bd4)[_0x357c('0x24')](function(_0x56f410){_0x859a04[_0x357c('0x20')]=_0x56f410;if(_0x4e9ea0[_0x357c('0x39')]['includeAll']){_0x51b7f4[_0x357c('0x47')]=[{'all':!![]}];}return db[_0x357c('0x32')]['findAll'](_0x51b7f4);})[_0x357c('0x24')](function(_0xaab73f){_0x859a04['rows']=_0xaab73f;return _0x859a04;})[_0x357c('0x24')](respondWithFilteredResult(_0x288957,_0x51b7f4))[_0x357c('0x48')](handleError(_0x288957,null));};exports[_0x357c('0x49')]=function(_0x32311a,_0x51b128){var _0x1e8424={'raw':!![],'where':{'id':_0x32311a[_0x357c('0x4a')]['id']}},_0x29114d={};_0x29114d[_0x357c('0x37')]=_[_0x357c('0x38')](db[_0x357c('0x32')][_0x357c('0x33')]);_0x29114d['query']=_[_0x357c('0x38')](_0x32311a['query']);_0x29114d[_0x357c('0x42')]=_['intersection'](_0x29114d[_0x357c('0x37')],_0x29114d[_0x357c('0x39')]);_0x1e8424[_0x357c('0x3b')]=_[_0x357c('0x3a')](_0x29114d['model'],qs['fields'](_0x32311a[_0x357c('0x39')]['fields']));_0x1e8424[_0x357c('0x3b')]=_0x1e8424['attributes']['length']?_0x1e8424[_0x357c('0x3b')]:_0x29114d[_0x357c('0x37')];if(_0x32311a[_0x357c('0x39')][_0x357c('0x4b')]){_0x1e8424[_0x357c('0x47')]=[{'all':!![]}];}_0x1e8424=_[_0x357c('0x2a')]({},_0x1e8424,_0x32311a['options']);return db[_0x357c('0x32')]['find'](_0x1e8424)[_0x357c('0x24')](handleEntityNotFound(_0x51b128,null))[_0x357c('0x24')](respondWithResult(_0x51b128,null))[_0x357c('0x48')](handleError(_0x51b128,null));};exports[_0x357c('0x4c')]=function(_0x44d8e6,_0x30387a){return db[_0x357c('0x32')][_0x357c('0x4c')](_0x44d8e6['body'],{})[_0x357c('0x24')](respondWithResult(_0x30387a,0xc9))[_0x357c('0x48')](handleError(_0x30387a,null));};exports[_0x357c('0x23')]=function(_0x15a9a1,_0x2ad2bb){if(_0x15a9a1['body']['id']){delete _0x15a9a1[_0x357c('0x2b')]['id'];}return db[_0x357c('0x32')]['find']({'where':{'id':_0x15a9a1[_0x357c('0x4a')]['id']}})[_0x357c('0x24')](handleEntityNotFound(_0x2ad2bb,null))[_0x357c('0x24')](saveUpdates(_0x15a9a1[_0x357c('0x2b')],null))[_0x357c('0x24')](respondWithResult(_0x2ad2bb,null))[_0x357c('0x48')](handleError(_0x2ad2bb,null));};exports[_0x357c('0x4d')]=function(_0x4b097b,_0x44420c,_0xd87912){var _0x53c8e7=require('../../components/encryptor');var _0x31a741=![];var _0x1282b2={};if(_0x4b097b[_0x357c('0x39')][_0x357c('0x35')]&&_0x4b097b[_0x357c('0x39')]['type']===_0x357c('0x4e')){_0x1282b2[_0x357c('0x4e')]=_0x4b097b['params']['id'];}else{_0x1282b2['id']=_0x4b097b[_0x357c('0x4a')]['id'];}return db[_0x357c('0x32')][_0x357c('0x4f')]({'where':_0x1282b2,'attributes':['id',_0x357c('0x50'),_0x357c('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x44420c,null))[_0x357c('0x24')](function(_0x4097aa){if(_0x4097aa){var _0x589ced=_0x4097aa[_0x357c('0x50')];var _0x2d0d50=util['format'](_0x357c('0x52'),_0x589ced);if(fs[_0x357c('0x53')](_0x2d0d50)){_0x31a741=!![];return _0x53c8e7[_0x357c('0x54')](_0x2d0d50,_0x589ced,config[_0x357c('0x55')][_0x357c('0x56')])[_0x357c('0x24')](function(){return _0x4097aa;});}return _0x4097aa;}})['then'](function(_0x55d89e){if(_0x55d89e){var _0xcb1afe=_0x55d89e[_0x357c('0x50')];if(!fs[_0x357c('0x53')](_0xcb1afe)){throw new db[(_0x357c('0x57'))][(_0x357c('0x58'))](_0x357c('0x59'));}if(_0x55d89e['filename']){return _0x44420c[_0x357c('0x4d')](_0xcb1afe,_0x55d89e[_0x357c('0x51')]+path[_0x357c('0x5a')](_0xcb1afe),function(){if(_0x31a741){fs[_0x357c('0x5b')](_0xcb1afe);}});}else{return _0x44420c[_0x357c('0x4d')](_0xcb1afe,function(_0x32363){if(_0x31a741){fs[_0x357c('0x5b')](_0xcb1afe);}});}}})[_0x357c('0x48')](function(_0x44cb19){if(_0x44cb19[_0x357c('0x2d')]===_0x357c('0x59')){_0x44420c[_0x357c('0x1b')](0x194)[_0x357c('0x28')](_0x357c('0x5c'));}else{return handleError(_0x44420c,null);}});};exports[_0x357c('0x25')]=function(_0x5b209d,_0x4f1e70){return db[_0x357c('0x32')][_0x357c('0x4f')]({'where':{'id':_0x5b209d['params']['id']}})[_0x357c('0x24')](function(_0xd99695){if(_[_0x357c('0x5d')](_0xd99695)){throw new ReferenceError(_0x357c('0x5e'));}return _0xd99695;})[_0x357c('0x24')](function(_0x233e64){var _0x40e0d0=_0x233e64[_0x357c('0x50')];logger[_0x357c('0x5f')](_0x357c('0x60'),_0x40e0d0);if(!_['isNil'](_0x233e64[_0x357c('0x50')])&&fs[_0x357c('0x53')](_0x40e0d0)){logger[_0x357c('0x5f')](_0x357c('0x61')+_0x40e0d0+_0x357c('0x62'));fs['unlinkSync'](_0x40e0d0);}_0x40e0d0=_0x40e0d0+_0x357c('0x63');if(!_[_0x357c('0x5d')](_0x233e64[_0x357c('0x50')])&&fs[_0x357c('0x53')](_0x40e0d0)){logger['info'](_0x357c('0x61')+_0x40e0d0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x357c('0x64')](_0x40e0d0);}return _0x233e64;})['then'](function(_0x394ecb){if(!_0x394ecb)throw new InternalError();return _0x394ecb[_0x357c('0x25')]();})[_0x357c('0x24')](function(){_0x4f1e70['status'](0xcc)['end']();})[_0x357c('0x48')](handleError(_0x4f1e70,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index c078218..a75db8a 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 _0xf7b4=['path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','api','moment'];(function(_0x58b742,_0x4b5ba1){var _0x3e8a60=function(_0x222dc2){while(--_0x222dc2){_0x58b742['push'](_0x58b742['shift']());}};_0x3e8a60(++_0x4b5ba1);}(_0xf7b4,0x152));var _0x4f7b=function(_0x239d81,_0x3ee621){_0x239d81=_0x239d81-0x0;var _0x214841=_0xf7b4[_0x239d81];return _0x214841;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4f7b('0x1'));var moment=require(_0x4f7b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f7b('0x3'));var rimraf=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var attributes=require(_0x4f7b('0x6'));module[_0x4f7b('0x7')]=function(_0x2637f0,_0x427f8b){return _0x2637f0[_0x4f7b('0x8')](_0x4f7b('0x9'),attributes,{'tableName':_0x4f7b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7269=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util'];(function(_0x594bf8,_0x54a6f9){var _0x55a979=function(_0x4cbf45){while(--_0x4cbf45){_0x594bf8['push'](_0x594bf8['shift']());}};_0x55a979(++_0x54a6f9);}(_0x7269,0x76));var _0x9726=function(_0x579e0c,_0x1f2132){_0x579e0c=_0x579e0c-0x0;var _0x4e3f99=_0x7269[_0x579e0c];return _0x4e3f99;};'use strict';var _=require(_0x9726('0x0'));var util=require(_0x9726('0x1'));var logger=require(_0x9726('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9726('0x3'));var rp=require(_0x9726('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9726('0x5'));var config=require(_0x9726('0x6'));var attributes=require(_0x9726('0x7'));module[_0x9726('0x8')]=function(_0x795889,_0x832cb){return _0x795889[_0x9726('0x9')](_0x9726('0xa'),attributes,{'tableName':_0x9726('0xb'),'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 e3a7e3c..f4e1432 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 _0x4b57=['then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateSquareRecording','SquareRecording','create','options','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b57,0xb6));var _0x74b5=function(_0x272d97,_0x3cb745){_0x272d97=_0x272d97-0x0;var _0x40fc01=_0x4b57[_0x272d97];return _0x40fc01;};'use strict';var _=require(_0x74b5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x74b5('0x1'));var rs=require(_0x74b5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x74b5('0x3'));var logger=require(_0x74b5('0x4'))(_0x74b5('0x5'));var config=require('../../config/environment');var jayson=require(_0x74b5('0x6'));var client=jayson[_0x74b5('0x7')][_0x74b5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15a81a,_0x57cf95,_0x4dda17){return new BPromise(function(_0x274822,_0x2ef9d1){return client[_0x74b5('0x9')](_0x15a81a,_0x4dda17)[_0x74b5('0xa')](function(_0x38881e){logger[_0x74b5('0xb')](_0x74b5('0xc'),_0x57cf95,_0x74b5('0xd'));logger[_0x74b5('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x57cf95,_0x74b5('0xd'),JSON[_0x74b5('0xf')](_0x38881e));if(_0x38881e[_0x74b5('0x10')]){if(_0x38881e[_0x74b5('0x10')]['code']===0x1f4){logger[_0x74b5('0x10')](_0x74b5('0xc'),_0x57cf95,_0x38881e['error'][_0x74b5('0x11')]);return _0x2ef9d1(_0x38881e[_0x74b5('0x10')]['message']);}logger[_0x74b5('0x10')]('SquareRecording,\x20%s,\x20%s',_0x57cf95,_0x38881e['error'][_0x74b5('0x11')]);return _0x274822(_0x38881e['error']['message']);}else{logger[_0x74b5('0xb')](_0x74b5('0xc'),_0x57cf95,_0x74b5('0xd'));_0x274822(_0x38881e[_0x74b5('0x12')][_0x74b5('0x11')]);}})[_0x74b5('0x13')](function(_0x4dcf4b){logger[_0x74b5('0x10')](_0x74b5('0xc'),_0x57cf95,_0x4dcf4b);_0x2ef9d1(_0x4dcf4b);});});}exports[_0x74b5('0x14')]=function(_0x48d8c9){var _0x1b5e3f=this;return new Promise(function(_0x31bb13,_0x570369){return db[_0x74b5('0x15')][_0x74b5('0x16')](_0x48d8c9['body'],{'raw':_0x48d8c9[_0x74b5('0x17')]?_0x48d8c9[_0x74b5('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x74b5('0xa')](function(_0x251ec4){logger[_0x74b5('0xb')](_0x74b5('0x14'),_0x48d8c9);logger[_0x74b5('0xe')](_0x74b5('0x14'),_0x48d8c9,JSON['stringify'](_0x251ec4));_0x31bb13(_0x251ec4);})[_0x74b5('0x13')](function(_0x484803){logger[_0x74b5('0x10')](_0x74b5('0x14'),_0x484803[_0x74b5('0x11')],_0x48d8c9);_0x570369(_0x1b5e3f[_0x74b5('0x10')](0x1f4,_0x484803[_0x74b5('0x11')]));});});}; \ No newline at end of file +var _0x1809=['create','body','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','CreateSquareRecording','SquareRecording'];(function(_0x754ef9,_0x5b8b47){var _0x510562=function(_0x3b8107){while(--_0x3b8107){_0x754ef9['push'](_0x754ef9['shift']());}};_0x510562(++_0x5b8b47);}(_0x1809,0x183));var _0x9180=function(_0x8ec298,_0x42003f){_0x8ec298=_0x8ec298-0x0;var _0x1e86ef=_0x1809[_0x8ec298];return _0x1e86ef;};'use strict';var _=require(_0x9180('0x0'));var util=require('util');var moment=require(_0x9180('0x1'));var BPromise=require('bluebird');var rs=require(_0x9180('0x2'));var fs=require('fs');var Redis=require(_0x9180('0x3'));var db=require(_0x9180('0x4'))['db'];var utils=require(_0x9180('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9180('0x6'));var jayson=require(_0x9180('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2093e3,_0x4e7e07,_0xa6dee3){return new BPromise(function(_0xeed5fb,_0x37434e){return client[_0x9180('0x8')](_0x2093e3,_0xa6dee3)[_0x9180('0x9')](function(_0x49467d){logger['info'](_0x9180('0xa'),_0x4e7e07,_0x9180('0xb'));logger[_0x9180('0xc')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x4e7e07,'request\x20sent',JSON[_0x9180('0xd')](_0x49467d));if(_0x49467d['error']){if(_0x49467d[_0x9180('0xe')][_0x9180('0xf')]===0x1f4){logger[_0x9180('0xe')](_0x9180('0xa'),_0x4e7e07,_0x49467d[_0x9180('0xe')][_0x9180('0x10')]);return _0x37434e(_0x49467d['error']['message']);}logger[_0x9180('0xe')](_0x9180('0xa'),_0x4e7e07,_0x49467d[_0x9180('0xe')][_0x9180('0x10')]);return _0xeed5fb(_0x49467d[_0x9180('0xe')]['message']);}else{logger[_0x9180('0x11')](_0x9180('0xa'),_0x4e7e07,'request\x20sent');_0xeed5fb(_0x49467d[_0x9180('0x12')][_0x9180('0x10')]);}})['catch'](function(_0x4517e6){logger['error'](_0x9180('0xa'),_0x4e7e07,_0x4517e6);_0x37434e(_0x4517e6);});});}exports[_0x9180('0x13')]=function(_0x2839b0){var _0x54e4c1=this;return new Promise(function(_0x22df9f,_0x3de2b0){return db[_0x9180('0x14')][_0x9180('0x15')](_0x2839b0[_0x9180('0x16')],{'raw':_0x2839b0['options']?_0x2839b0['options'][_0x9180('0x17')]===undefined?!![]:![]:!![]})[_0x9180('0x9')](function(_0x8c015c){logger['info']('CreateSquareRecording',_0x2839b0);logger[_0x9180('0xc')]('CreateSquareRecording',_0x2839b0,JSON[_0x9180('0xd')](_0x8c015c));_0x22df9f(_0x8c015c);})['catch'](function(_0x37577d){logger[_0x9180('0xe')](_0x9180('0x13'),_0x37577d[_0x9180('0x10')],_0x2839b0);_0x3de2b0(_0x54e4c1[_0x9180('0xe')](0x1f4,_0x37577d[_0x9180('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index c3dd12b..d5cd867 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 _0x16cf=['util','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','post','put','update','delete','/:id','exports','multer'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x16cf,0x98));var _0xf16c=function(_0xaa2142,_0x14f51d){_0xaa2142=_0xaa2142-0x0;var _0x5316f9=_0x16cf[_0xaa2142];return _0x5316f9;};'use strict';var multer=require(_0xf16c('0x0'));var util=require(_0xf16c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf16c('0x2'));var router=express['Router']();var fs_extra=require(_0xf16c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf16c('0x4'));var config=require('../../config/environment');var controller=require('./squareReport.controller');router[_0xf16c('0x5')]('/',auth[_0xf16c('0x6')](),controller[_0xf16c('0x7')]);router[_0xf16c('0x5')](_0xf16c('0x8'),auth['isAuthenticated'](),controller[_0xf16c('0x9')]);router[_0xf16c('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xf16c('0xa')]);router[_0xf16c('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf16c('0xc')]('/:id',auth[_0xf16c('0x6')](),controller[_0xf16c('0xd')]);router[_0xf16c('0xe')](_0xf16c('0xf'),auth[_0xf16c('0x6')](),controller['destroy']);module[_0xf16c('0x10')]=router; \ No newline at end of file +var _0xe260=['/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','/describe'];(function(_0x27293d,_0x2f0d91){var _0x247ddd=function(_0x8414eb){while(--_0x8414eb){_0x27293d['push'](_0x27293d['shift']());}};_0x247ddd(++_0x2f0d91);}(_0xe260,0xb0));var _0x0e26=function(_0x2cdb1c,_0x2bb39c){_0x2cdb1c=_0x2cdb1c-0x0;var _0x4e5b7a=_0xe260[_0x2cdb1c];return _0x4e5b7a;};'use strict';var multer=require(_0x0e26('0x0'));var util=require(_0x0e26('0x1'));var path=require(_0x0e26('0x2'));var timeout=require(_0x0e26('0x3'));var express=require('express');var router=express[_0x0e26('0x4')]();var fs_extra=require(_0x0e26('0x5'));var auth=require(_0x0e26('0x6'));var interaction=require(_0x0e26('0x7'));var config=require(_0x0e26('0x8'));var controller=require(_0x0e26('0x9'));router[_0x0e26('0xa')]('/',auth[_0x0e26('0xb')](),controller['index']);router[_0x0e26('0xa')](_0x0e26('0xc'),auth[_0x0e26('0xb')](),controller['describe']);router['get'](_0x0e26('0xd'),auth[_0x0e26('0xb')](),controller[_0x0e26('0xe')]);router[_0x0e26('0xf')]('/',auth[_0x0e26('0xb')](),controller[_0x0e26('0x10')]);router[_0x0e26('0x11')](_0x0e26('0xd'),auth[_0x0e26('0xb')](),controller['update']);router[_0x0e26('0x12')](_0x0e26('0xd'),auth[_0x0e26('0xb')](),controller[_0x0e26('0x13')]);module[_0x0e26('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 a90978c..da6e2cc 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 _0x992d=['STRING','DATE','BOOLEAN','exports'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x992d,0x8f));var _0xd992=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x992d[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0xd992('0x0')]={'network':{'type':Sequelize[_0xd992('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xd992('0x1')]},'channel':{'type':Sequelize[_0xd992('0x1')]},'language':{'type':Sequelize[_0xd992('0x1')]},'type':{'type':Sequelize[_0xd992('0x1')]},'uniqueid':{'type':Sequelize[_0xd992('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd992('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xd992('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xd992('0x1')]},'priority':{'type':Sequelize[_0xd992('0x1')]},'enhanced':{'type':Sequelize[_0xd992('0x1')]},'accountcode':{'type':Sequelize[_0xd992('0x1')]},'threadid':{'type':Sequelize[_0xd992('0x1')]},'project_name':{'type':Sequelize[_0xd992('0x1')]},'joinAt':{'type':Sequelize[_0xd992('0x2')]},'leaveAt':{'type':Sequelize[_0xd992('0x2')]},'bot':{'type':Sequelize[_0xd992('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd8cd=['exports','STRING','DATE','sequelize'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xd8cd,0x1ab));var _0xdd8c=function(_0x4f1571,_0x3b315a){_0x4f1571=_0x4f1571-0x0;var _0x29e0a8=_0xd8cd[_0x4f1571];return _0x29e0a8;};'use strict';var Sequelize=require(_0xdd8c('0x0'));module[_0xdd8c('0x1')]={'network':{'type':Sequelize[_0xdd8c('0x2')]},'network_script':{'type':Sequelize[_0xdd8c('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xdd8c('0x2')]},'language':{'type':Sequelize[_0xdd8c('0x2')]},'type':{'type':Sequelize[_0xdd8c('0x2')]},'uniqueid':{'type':Sequelize[_0xdd8c('0x2')]},'version':{'type':Sequelize[_0xdd8c('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdd8c('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xdd8c('0x2')]},'callington':{'type':Sequelize[_0xdd8c('0x2')]},'callingtns':{'type':Sequelize[_0xdd8c('0x2')]},'dnid':{'type':Sequelize[_0xdd8c('0x2')]},'rdnis':{'type':Sequelize[_0xdd8c('0x2')]},'context':{'type':Sequelize[_0xdd8c('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xdd8c('0x2')]},'enhanced':{'type':Sequelize[_0xdd8c('0x2')]},'accountcode':{'type':Sequelize[_0xdd8c('0x2')]},'threadid':{'type':Sequelize[_0xdd8c('0x2')]},'project_name':{'type':Sequelize[_0xdd8c('0x2')]},'joinAt':{'type':Sequelize[_0xdd8c('0x3')]},'leaveAt':{'type':Sequelize[_0xdd8c('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 3b5b198..d69c3d0 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 _0xa571=['map','SquareReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','save','update','then','destroy','end','error','name','render','merge','contact','message','agent','interaction','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa571,0x107));var _0x1a57=function(_0x442f02,_0x47d845){_0x442f02=_0x442f02-0x0;var _0xab6ef1=_0xa571[_0x442f02];return _0xab6ef1;};'use strict';var emlformat=require(_0x1a57('0x0'));var rimraf=require(_0x1a57('0x1'));var zipdir=require(_0x1a57('0x2'));var jsonpatch=require(_0x1a57('0x3'));var rp=require('request-promise');var moment=require(_0x1a57('0x4'));var BPromise=require(_0x1a57('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a57('0x6'));var sox=require('sox');var csv=require(_0x1a57('0x7'));var ejs=require(_0x1a57('0x8'));var fs=require('fs');var fs_extra=require(_0x1a57('0x9'));var _=require(_0x1a57('0xa'));var squel=require(_0x1a57('0xb'));var crypto=require(_0x1a57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a57('0xd'));var toCsv=require(_0x1a57('0x7'));var querystring=require(_0x1a57('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a57('0xf'));var authService=require(_0x1a57('0x10'));var qs=require(_0x1a57('0x11'));var as=require(_0x1a57('0x12'));var hardwareService=require(_0x1a57('0x13'));var logger=require(_0x1a57('0x14'))(_0x1a57('0x15'));var utils=require(_0x1a57('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a57('0x17'))['db'];function respondWithStatusCode(_0x1911b2,_0x202d9a){_0x202d9a=_0x202d9a||0xcc;return function(_0x5ae643){if(_0x5ae643){return _0x1911b2[_0x1a57('0x18')](_0x202d9a);}return _0x1911b2[_0x1a57('0x19')](_0x202d9a)['end']();};}function respondWithResult(_0x503278,_0x587422){_0x587422=_0x587422||0xc8;return function(_0xd08107){if(_0xd08107){return _0x503278[_0x1a57('0x19')](_0x587422)[_0x1a57('0x1a')](_0xd08107);}};}function respondWithFilteredResult(_0x153d01,_0x5802d6){return function(_0x20f7ad){if(_0x20f7ad){var _0x53c61f=typeof _0x5802d6['offset']===_0x1a57('0x1b')&&typeof _0x5802d6[_0x1a57('0x1c')]===_0x1a57('0x1b');var _0x51b4c2=_0x20f7ad[_0x1a57('0x1d')];var _0x1662a3=_0x53c61f?0x0:_0x5802d6[_0x1a57('0x1e')];var _0x53bb20=_0x53c61f?_0x20f7ad[_0x1a57('0x1d')]:_0x5802d6[_0x1a57('0x1e')]+_0x5802d6[_0x1a57('0x1c')];var _0xcba6b7;if(_0x53bb20>=_0x51b4c2){_0x53bb20=_0x51b4c2;_0xcba6b7=0xc8;}else{_0xcba6b7=0xce;}_0x153d01[_0x1a57('0x19')](_0xcba6b7);return _0x153d01['set']('Content-Range',_0x1662a3+'-'+_0x53bb20+'/'+_0x51b4c2)[_0x1a57('0x1a')](_0x20f7ad);}return null;};}function patchUpdates(_0x21e811){return function(_0x211c63){try{jsonpatch['apply'](_0x211c63,_0x21e811,!![]);}catch(_0x5c200e){return BPromise['reject'](_0x5c200e);}return _0x211c63[_0x1a57('0x1f')]();};}function saveUpdates(_0x113ad4,_0x3f52b9){return function(_0xee133b){if(_0xee133b){return _0xee133b[_0x1a57('0x20')](_0x113ad4)[_0x1a57('0x21')](function(_0x2efa49){return _0x2efa49;});}return null;};}function removeEntity(_0x2f8b00,_0x183ca3){return function(_0x35d5dc){if(_0x35d5dc){return _0x35d5dc[_0x1a57('0x22')]()[_0x1a57('0x21')](function(){_0x2f8b00[_0x1a57('0x19')](0xcc)[_0x1a57('0x23')]();});}};}function handleEntityNotFound(_0x2f9454,_0x182649){return function(_0x25c1e9){if(!_0x25c1e9){_0x2f9454[_0x1a57('0x18')](0x194);}return _0x25c1e9;};}function handleError(_0x27cfe1,_0xf6ffef){_0xf6ffef=_0xf6ffef||0x1f4;return function(_0x26584b){logger[_0x1a57('0x24')](_0x26584b['stack']);if(_0x26584b['name']){delete _0x26584b[_0x1a57('0x25')];}_0x27cfe1[_0x1a57('0x19')](_0xf6ffef)['send'](_0x26584b);};}function getMustacheRender(_0x46dac6,_0x54f6a5){return Mustache[_0x1a57('0x26')](_0x46dac6,_[_0x1a57('0x27')](_0x54f6a5['body'],{'contact':_0x54f6a5[_0x1a57('0x28')],'message':_0x54f6a5[_0x1a57('0x29')],'agent':_0x54f6a5[_0x1a57('0x2a')],'interaction':_0x54f6a5[_0x1a57('0x2b')],'account':_0x54f6a5['account']}))||'';}exports[_0x1a57('0x2c')]=function(_0x396832,_0x4374f0){var _0x160536={},_0x5763ba={},_0xa42d2b={'count':0x0,'rows':[]};var _0x251a54=_[_0x1a57('0x2d')](db[_0x1a57('0x2e')][_0x1a57('0x2f')],function(_0x335c14){return{'name':_0x335c14[_0x1a57('0x30')],'type':_0x335c14[_0x1a57('0x31')][_0x1a57('0x32')]};});_0x5763ba['model']=_[_0x1a57('0x2d')](_0x251a54,_0x1a57('0x25'));_0x5763ba['query']=_['keys'](_0x396832[_0x1a57('0x33')]);_0x5763ba[_0x1a57('0x34')]=_[_0x1a57('0x35')](_0x5763ba[_0x1a57('0x36')],_0x5763ba[_0x1a57('0x33')]);_0x160536[_0x1a57('0x37')]=_[_0x1a57('0x35')](_0x5763ba[_0x1a57('0x36')],qs[_0x1a57('0x38')](_0x396832[_0x1a57('0x33')][_0x1a57('0x38')]));_0x160536[_0x1a57('0x37')]=_0x160536[_0x1a57('0x37')][_0x1a57('0x39')]?_0x160536[_0x1a57('0x37')]:_0x5763ba[_0x1a57('0x36')];if(!_0x396832[_0x1a57('0x33')][_0x1a57('0x3a')]('nolimit')){_0x160536[_0x1a57('0x1c')]=qs[_0x1a57('0x1c')](_0x396832[_0x1a57('0x33')][_0x1a57('0x1c')]);_0x160536[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x396832[_0x1a57('0x33')][_0x1a57('0x1e')]);}_0x160536[_0x1a57('0x3b')]=qs['sort'](_0x396832['query']['sort']);_0x160536['where']=qs[_0x1a57('0x34')](_[_0x1a57('0x3c')](_0x396832[_0x1a57('0x33')],_0x5763ba['filters']),_0x251a54);if(_0x396832[_0x1a57('0x33')][_0x1a57('0x3d')]){_0x160536[_0x1a57('0x3e')]=_[_0x1a57('0x27')](_0x160536['where'],{'$or':_[_0x1a57('0x2d')](_0x251a54,function(_0x5e79f0){if(_0x5e79f0[_0x1a57('0x31')]!==_0x1a57('0x3f')){var _0x33b1f3={};_0x33b1f3[_0x5e79f0['name']]={'$like':'%'+_0x396832[_0x1a57('0x33')][_0x1a57('0x3d')]+'%'};return _0x33b1f3;}})});}_0x160536=_[_0x1a57('0x27')]({},_0x160536,_0x396832[_0x1a57('0x40')]);var _0x1ce499={'where':_0x160536['where']};return db[_0x1a57('0x2e')]['count'](_0x1ce499)['then'](function(_0x135e81){_0xa42d2b['count']=_0x135e81;if(_0x396832[_0x1a57('0x33')][_0x1a57('0x41')]){_0x160536[_0x1a57('0x42')]=[{'all':!![]}];}return db['SquareReport'][_0x1a57('0x43')](_0x160536);})[_0x1a57('0x21')](function(_0xde13d3){_0xa42d2b[_0x1a57('0x44')]=_0xde13d3;return _0xa42d2b;})['then'](respondWithFilteredResult(_0x4374f0,_0x160536))[_0x1a57('0x45')](handleError(_0x4374f0,null));};exports[_0x1a57('0x46')]=function(_0x4fdd29,_0x32d05b){var _0x4c0759={'raw':!![],'where':{'id':_0x4fdd29[_0x1a57('0x47')]['id']}},_0x4d723f={};_0x4d723f[_0x1a57('0x36')]=_[_0x1a57('0x48')](db[_0x1a57('0x2e')]['rawAttributes']);_0x4d723f[_0x1a57('0x33')]=_[_0x1a57('0x48')](_0x4fdd29[_0x1a57('0x33')]);_0x4d723f[_0x1a57('0x34')]=_[_0x1a57('0x35')](_0x4d723f['model'],_0x4d723f[_0x1a57('0x33')]);_0x4c0759[_0x1a57('0x37')]=_[_0x1a57('0x35')](_0x4d723f[_0x1a57('0x36')],qs['fields'](_0x4fdd29[_0x1a57('0x33')]['fields']));_0x4c0759[_0x1a57('0x37')]=_0x4c0759[_0x1a57('0x37')][_0x1a57('0x39')]?_0x4c0759[_0x1a57('0x37')]:_0x4d723f[_0x1a57('0x36')];if(_0x4fdd29[_0x1a57('0x33')][_0x1a57('0x41')]){_0x4c0759[_0x1a57('0x42')]=[{'all':!![]}];}_0x4c0759=_[_0x1a57('0x27')]({},_0x4c0759,_0x4fdd29[_0x1a57('0x40')]);return db[_0x1a57('0x2e')][_0x1a57('0x49')](_0x4c0759)[_0x1a57('0x21')](handleEntityNotFound(_0x32d05b,null))['then'](respondWithResult(_0x32d05b,null))[_0x1a57('0x45')](handleError(_0x32d05b,null));};exports[_0x1a57('0x4a')]=function(_0x3bf103,_0x3b3f1f){return db[_0x1a57('0x2e')][_0x1a57('0x4a')](_0x3bf103[_0x1a57('0x4b')],{})[_0x1a57('0x21')](respondWithResult(_0x3b3f1f,0xc9))[_0x1a57('0x45')](handleError(_0x3b3f1f,null));};exports[_0x1a57('0x20')]=function(_0xe82028,_0x5920b4){if(_0xe82028[_0x1a57('0x4b')]['id']){delete _0xe82028[_0x1a57('0x4b')]['id'];}return db['SquareReport'][_0x1a57('0x49')]({'where':{'id':_0xe82028[_0x1a57('0x47')]['id']}})['then'](handleEntityNotFound(_0x5920b4,null))[_0x1a57('0x21')](saveUpdates(_0xe82028[_0x1a57('0x4b')],null))['then'](respondWithResult(_0x5920b4,null))['catch'](handleError(_0x5920b4,null));};exports['destroy']=function(_0x2c1bac,_0x41465b){return db['SquareReport'][_0x1a57('0x49')]({'where':{'id':_0x2c1bac[_0x1a57('0x47')]['id']}})['then'](handleEntityNotFound(_0x41465b,null))['then'](removeEntity(_0x41465b,null))['catch'](handleError(_0x41465b,null));};exports[_0x1a57('0x4c')]=function(_0x23d1c3,_0x431cf5){return db[_0x1a57('0x2e')][_0x1a57('0x4c')]()[_0x1a57('0x21')](respondWithResult(_0x431cf5,null))[_0x1a57('0x45')](handleError(_0x431cf5,null));}; \ No newline at end of file +var _0xc698=['../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','update','then','error','stack','name','send','render','body','contact','message','agent','account','index','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','SquareReport','findAll','show','params','includeAll','include','find','catch','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x19eb0c,_0x3b185d){var _0x5273b6=function(_0x428521){while(--_0x428521){_0x19eb0c['push'](_0x19eb0c['shift']());}};_0x5273b6(++_0x3b185d);}(_0xc698,0x85));var _0x8c69=function(_0xae01dd,_0xbd8a3c){_0xae01dd=_0xae01dd-0x0;var _0x8c26df=_0xc698[_0xae01dd];return _0x8c26df;};'use strict';var emlformat=require(_0x8c69('0x0'));var rimraf=require(_0x8c69('0x1'));var zipdir=require(_0x8c69('0x2'));var jsonpatch=require(_0x8c69('0x3'));var rp=require(_0x8c69('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8c69('0x5'));var util=require('util');var path=require(_0x8c69('0x6'));var sox=require('sox');var csv=require(_0x8c69('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c69('0x8'));var squel=require(_0x8c69('0x9'));var crypto=require(_0x8c69('0xa'));var jsforce=require(_0x8c69('0xb'));var deskjs=require(_0x8c69('0xc'));var toCsv=require(_0x8c69('0x7'));var querystring=require(_0x8c69('0xd'));var Papa=require(_0x8c69('0xe'));var Redis=require(_0x8c69('0xf'));var authService=require(_0x8c69('0x10'));var qs=require(_0x8c69('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c69('0x12'));var logger=require(_0x8c69('0x13'))(_0x8c69('0x14'));var utils=require('../../config/utils');var config=require(_0x8c69('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c69('0x16'))['db'];function respondWithStatusCode(_0x5886d3,_0x33e020){_0x33e020=_0x33e020||0xcc;return function(_0x5bbd63){if(_0x5bbd63){return _0x5886d3[_0x8c69('0x17')](_0x33e020);}return _0x5886d3['status'](_0x33e020)[_0x8c69('0x18')]();};}function respondWithResult(_0x44fd99,_0x5e8143){_0x5e8143=_0x5e8143||0xc8;return function(_0x1147cb){if(_0x1147cb){return _0x44fd99['status'](_0x5e8143)[_0x8c69('0x19')](_0x1147cb);}};}function respondWithFilteredResult(_0x30254b,_0x11f45f){return function(_0x3a765c){if(_0x3a765c){var _0x557918=typeof _0x11f45f[_0x8c69('0x1a')]===_0x8c69('0x1b')&&typeof _0x11f45f[_0x8c69('0x1c')]==='undefined';var _0x3cde3f=_0x3a765c[_0x8c69('0x1d')];var _0xfc7224=_0x557918?0x0:_0x11f45f[_0x8c69('0x1a')];var _0x5a816c=_0x557918?_0x3a765c[_0x8c69('0x1d')]:_0x11f45f[_0x8c69('0x1a')]+_0x11f45f[_0x8c69('0x1c')];var _0x32b90d;if(_0x5a816c>=_0x3cde3f){_0x5a816c=_0x3cde3f;_0x32b90d=0xc8;}else{_0x32b90d=0xce;}_0x30254b[_0x8c69('0x1e')](_0x32b90d);return _0x30254b['set'](_0x8c69('0x1f'),_0xfc7224+'-'+_0x5a816c+'/'+_0x3cde3f)['json'](_0x3a765c);}return null;};}function patchUpdates(_0x5bd3bf){return function(_0x2b2bbe){try{jsonpatch[_0x8c69('0x20')](_0x2b2bbe,_0x5bd3bf,!![]);}catch(_0x34229b){return BPromise[_0x8c69('0x21')](_0x34229b);}return _0x2b2bbe['save']();};}function saveUpdates(_0x327ce4,_0x34d2fd){return function(_0x9718bf){if(_0x9718bf){return _0x9718bf[_0x8c69('0x22')](_0x327ce4)[_0x8c69('0x23')](function(_0x160810){return _0x160810;});}return null;};}function removeEntity(_0x47c56c,_0x3fdadd){return function(_0x2590d6){if(_0x2590d6){return _0x2590d6['destroy']()[_0x8c69('0x23')](function(){_0x47c56c[_0x8c69('0x1e')](0xcc)[_0x8c69('0x18')]();});}};}function handleEntityNotFound(_0x5373b7,_0x4c6ed4){return function(_0x3d2a42){if(!_0x3d2a42){_0x5373b7['sendStatus'](0x194);}return _0x3d2a42;};}function handleError(_0x578197,_0x4cf682){_0x4cf682=_0x4cf682||0x1f4;return function(_0x37ba0e){logger[_0x8c69('0x24')](_0x37ba0e[_0x8c69('0x25')]);if(_0x37ba0e[_0x8c69('0x26')]){delete _0x37ba0e[_0x8c69('0x26')];}_0x578197[_0x8c69('0x1e')](_0x4cf682)[_0x8c69('0x27')](_0x37ba0e);};}function getMustacheRender(_0x30d2ef,_0x41e7b5){return Mustache[_0x8c69('0x28')](_0x30d2ef,_['merge'](_0x41e7b5[_0x8c69('0x29')],{'contact':_0x41e7b5[_0x8c69('0x2a')],'message':_0x41e7b5[_0x8c69('0x2b')],'agent':_0x41e7b5[_0x8c69('0x2c')],'interaction':_0x41e7b5['interaction'],'account':_0x41e7b5[_0x8c69('0x2d')]}))||'';}exports[_0x8c69('0x2e')]=function(_0x51d0dd,_0x3aad39){var _0x4e4e6a={},_0x2e0c47={},_0x557791={'count':0x0,'rows':[]};var _0x3fdee9=_['map'](db['SquareReport'][_0x8c69('0x2f')],function(_0x5b2f50){return{'name':_0x5b2f50[_0x8c69('0x30')],'type':_0x5b2f50[_0x8c69('0x31')]['key']};});_0x2e0c47[_0x8c69('0x32')]=_[_0x8c69('0x33')](_0x3fdee9,_0x8c69('0x26'));_0x2e0c47[_0x8c69('0x34')]=_[_0x8c69('0x35')](_0x51d0dd[_0x8c69('0x34')]);_0x2e0c47['filters']=_[_0x8c69('0x36')](_0x2e0c47[_0x8c69('0x32')],_0x2e0c47[_0x8c69('0x34')]);_0x4e4e6a[_0x8c69('0x37')]=_['intersection'](_0x2e0c47[_0x8c69('0x32')],qs[_0x8c69('0x38')](_0x51d0dd['query']['fields']));_0x4e4e6a['attributes']=_0x4e4e6a['attributes'][_0x8c69('0x39')]?_0x4e4e6a[_0x8c69('0x37')]:_0x2e0c47['model'];if(!_0x51d0dd['query']['hasOwnProperty'](_0x8c69('0x3a'))){_0x4e4e6a[_0x8c69('0x1c')]=qs['limit'](_0x51d0dd['query'][_0x8c69('0x1c')]);_0x4e4e6a[_0x8c69('0x1a')]=qs[_0x8c69('0x1a')](_0x51d0dd['query'][_0x8c69('0x1a')]);}_0x4e4e6a[_0x8c69('0x3b')]=qs[_0x8c69('0x3c')](_0x51d0dd[_0x8c69('0x34')][_0x8c69('0x3c')]);_0x4e4e6a[_0x8c69('0x3d')]=qs[_0x8c69('0x3e')](_['pick'](_0x51d0dd[_0x8c69('0x34')],_0x2e0c47[_0x8c69('0x3e')]),_0x3fdee9);if(_0x51d0dd['query'][_0x8c69('0x3f')]){_0x4e4e6a[_0x8c69('0x3d')]=_[_0x8c69('0x40')](_0x4e4e6a[_0x8c69('0x3d')],{'$or':_['map'](_0x3fdee9,function(_0x1cdb1d){if(_0x1cdb1d[_0x8c69('0x31')]!==_0x8c69('0x41')){var _0xab3cba={};_0xab3cba[_0x1cdb1d['name']]={'$like':'%'+_0x51d0dd[_0x8c69('0x34')][_0x8c69('0x3f')]+'%'};return _0xab3cba;}})});}_0x4e4e6a=_[_0x8c69('0x40')]({},_0x4e4e6a,_0x51d0dd[_0x8c69('0x42')]);var _0x2b6655={'where':_0x4e4e6a[_0x8c69('0x3d')]};return db[_0x8c69('0x43')]['count'](_0x2b6655)[_0x8c69('0x23')](function(_0x4c6cfa){_0x557791['count']=_0x4c6cfa;if(_0x51d0dd[_0x8c69('0x34')]['includeAll']){_0x4e4e6a['include']=[{'all':!![]}];}return db['SquareReport'][_0x8c69('0x44')](_0x4e4e6a);})[_0x8c69('0x23')](function(_0x3b50c7){_0x557791['rows']=_0x3b50c7;return _0x557791;})['then'](respondWithFilteredResult(_0x3aad39,_0x4e4e6a))['catch'](handleError(_0x3aad39,null));};exports[_0x8c69('0x45')]=function(_0x4848ce,_0x575a09){var _0x523519={'raw':!![],'where':{'id':_0x4848ce[_0x8c69('0x46')]['id']}},_0x45be52={};_0x45be52[_0x8c69('0x32')]=_[_0x8c69('0x35')](db[_0x8c69('0x43')]['rawAttributes']);_0x45be52['query']=_[_0x8c69('0x35')](_0x4848ce[_0x8c69('0x34')]);_0x45be52[_0x8c69('0x3e')]=_[_0x8c69('0x36')](_0x45be52[_0x8c69('0x32')],_0x45be52['query']);_0x523519[_0x8c69('0x37')]=_['intersection'](_0x45be52[_0x8c69('0x32')],qs[_0x8c69('0x38')](_0x4848ce['query'][_0x8c69('0x38')]));_0x523519[_0x8c69('0x37')]=_0x523519[_0x8c69('0x37')][_0x8c69('0x39')]?_0x523519['attributes']:_0x45be52[_0x8c69('0x32')];if(_0x4848ce[_0x8c69('0x34')][_0x8c69('0x47')]){_0x523519[_0x8c69('0x48')]=[{'all':!![]}];}_0x523519=_[_0x8c69('0x40')]({},_0x523519,_0x4848ce[_0x8c69('0x42')]);return db[_0x8c69('0x43')][_0x8c69('0x49')](_0x523519)[_0x8c69('0x23')](handleEntityNotFound(_0x575a09,null))[_0x8c69('0x23')](respondWithResult(_0x575a09,null))[_0x8c69('0x4a')](handleError(_0x575a09,null));};exports[_0x8c69('0x4b')]=function(_0x515f27,_0x3fbd61){return db[_0x8c69('0x43')]['create'](_0x515f27['body'],{})[_0x8c69('0x23')](respondWithResult(_0x3fbd61,0xc9))['catch'](handleError(_0x3fbd61,null));};exports[_0x8c69('0x22')]=function(_0x4a9ad1,_0x4f28a9){if(_0x4a9ad1['body']['id']){delete _0x4a9ad1['body']['id'];}return db[_0x8c69('0x43')][_0x8c69('0x49')]({'where':{'id':_0x4a9ad1['params']['id']}})['then'](handleEntityNotFound(_0x4f28a9,null))[_0x8c69('0x23')](saveUpdates(_0x4a9ad1[_0x8c69('0x29')],null))['then'](respondWithResult(_0x4f28a9,null))[_0x8c69('0x4a')](handleError(_0x4f28a9,null));};exports['destroy']=function(_0xe205dd,_0x3f04e9){return db['SquareReport'][_0x8c69('0x49')]({'where':{'id':_0xe205dd[_0x8c69('0x46')]['id']}})[_0x8c69('0x23')](handleEntityNotFound(_0x3f04e9,null))[_0x8c69('0x23')](removeEntity(_0x3f04e9,null))[_0x8c69('0x4a')](handleError(_0x3f04e9,null));};exports['describe']=function(_0x390d04,_0x57fc7b){return db[_0x8c69('0x43')][_0x8c69('0x4c')]()[_0x8c69('0x23')](respondWithResult(_0x57fc7b,null))['catch'](handleError(_0x57fc7b,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index e38b2e6..32ac01c 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 _0xe12f=['leaveAt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareReport','report_square','uniqueid'];(function(_0x49603a,_0x405a47){var _0x5829fe=function(_0x2b8a16){while(--_0x2b8a16){_0x49603a['push'](_0x49603a['shift']());}};_0x5829fe(++_0x405a47);}(_0xe12f,0x11e));var _0xfe12=function(_0x125109,_0x51f47a){_0x125109=_0x125109-0x0;var _0x1d6e18=_0xe12f[_0x125109];return _0x1d6e18;};'use strict';var _=require(_0xfe12('0x0'));var util=require(_0xfe12('0x1'));var logger=require(_0xfe12('0x2'))('api');var moment=require(_0xfe12('0x3'));var BPromise=require(_0xfe12('0x4'));var rp=require(_0xfe12('0x5'));var fs=require('fs');var path=require(_0xfe12('0x6'));var rimraf=require(_0xfe12('0x7'));var config=require(_0xfe12('0x8'));var attributes=require('./squareReport.attributes');module[_0xfe12('0x9')]=function(_0x36e15d,_0x1be313){return _0x36e15d[_0xfe12('0xa')](_0xfe12('0xb'),attributes,{'tableName':_0xfe12('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xfe12('0xd'),'project_name']},{'name':_0xfe12('0xe'),'fields':[_0xfe12('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8963=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash'];(function(_0x54b9c6,_0x2c697e){var _0x251824=function(_0x269f7c){while(--_0x269f7c){_0x54b9c6['push'](_0x54b9c6['shift']());}};_0x251824(++_0x2c697e);}(_0x8963,0x11f));var _0x3896=function(_0x11efb3,_0x8071ba){_0x11efb3=_0x11efb3-0x0;var _0x5b9261=_0x8963[_0x11efb3];return _0x5b9261;};'use strict';var _=require(_0x3896('0x0'));var util=require(_0x3896('0x1'));var logger=require(_0x3896('0x2'))(_0x3896('0x3'));var moment=require(_0x3896('0x4'));var BPromise=require(_0x3896('0x5'));var rp=require(_0x3896('0x6'));var fs=require('fs');var path=require(_0x3896('0x7'));var rimraf=require('rimraf');var config=require(_0x3896('0x8'));var attributes=require('./squareReport.attributes');module[_0x3896('0x9')]=function(_0x19464f,_0x48d01a){return _0x19464f[_0x3896('0xa')](_0x3896('0xb'),attributes,{'tableName':_0x3896('0xc'),'paranoid':![],'indexes':[{'name':_0x3896('0xd'),'fields':['uniqueid',_0x3896('0xe')]},{'name':_0x3896('0xf'),'fields':[_0x3896('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 2e6a406..f899feb 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 _0x7fbe=['stringify','error','code','message','result','catch','SquareReport','create','options','raw','CreateSquareReport','update','where','limit','info','UpdateSquareReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4b70a2,_0x5d0fbd){_0x4b70a2=_0x4b70a2-0x0;var _0x2170fa=_0x7fbe[_0x4b70a2];return _0x2170fa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['CreateSquareReport']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')](_0x293a47['body'],{'raw':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x15f7a4){logger['info'](_0xe7fb('0x1c'),_0x293a47);logger[_0xe7fb('0x10')]('CreateSquareReport',_0x293a47,JSON[_0xe7fb('0x12')](_0x15f7a4));_0x1e77fd(_0x15f7a4);})[_0xe7fb('0x17')](function(_0x3ae8f1){logger['error'](_0xe7fb('0x1c'),_0x3ae8f1[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463['error'](0x1f4,_0x3ae8f1['message']));});});};exports['UpdateSquareReport']=function(_0x35e4db){var _0x53c43a=this;return new Promise(function(_0x49b219,_0x4026b1){return db[_0xe7fb('0x18')][_0xe7fb('0x1d')](_0x35e4db['body'],{'raw':_0x35e4db[_0xe7fb('0x1a')]?_0x35e4db[_0xe7fb('0x1a')][_0xe7fb('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35e4db[_0xe7fb('0x1a')]?_0x35e4db[_0xe7fb('0x1a')][_0xe7fb('0x1e')]||null:null,'attributes':_0x35e4db[_0xe7fb('0x1a')]?_0x35e4db['options']['attributes']||null:null,'limit':_0x35e4db[_0xe7fb('0x1a')]?_0x35e4db[_0xe7fb('0x1a')][_0xe7fb('0x1f')]||null:null})['then'](function(_0xb1f2f4){logger[_0xe7fb('0x20')](_0xe7fb('0x21'),_0x35e4db);logger[_0xe7fb('0x10')](_0xe7fb('0x21'),_0x35e4db,JSON[_0xe7fb('0x12')](_0xb1f2f4));_0x49b219(_0xb1f2f4);})[_0xe7fb('0x17')](function(_0x3dd0be){logger['error'](_0xe7fb('0x21'),_0x3dd0be[_0xe7fb('0x15')],_0x35e4db);_0x4026b1(_0x53c43a[_0xe7fb('0x13')](0x1f4,_0x3dd0be['message']));});});}; \ No newline at end of file +var _0xdc97=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','create','body','options','raw','CreateSquareReport','UpdateSquareReport','SquareReport','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x4210d7,_0x1db32c){var _0x299785=function(_0x33d959){while(--_0x33d959){_0x4210d7['push'](_0x4210d7['shift']());}};_0x299785(++_0x1db32c);}(_0xdc97,0x13b));var _0x7dc9=function(_0x153906,_0x483056){_0x153906=_0x153906-0x0;var _0x45779e=_0xdc97[_0x153906];return _0x45779e;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var moment=require(_0x7dc9('0x2'));var BPromise=require('bluebird');var rs=require(_0x7dc9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dc9('0x4'))['db'];var utils=require(_0x7dc9('0x5'));var logger=require('../../config/logger')(_0x7dc9('0x6'));var config=require(_0x7dc9('0x7'));var jayson=require(_0x7dc9('0x8'));var client=jayson[_0x7dc9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2636ef,_0x4f91c7,_0x4b3229){return new BPromise(function(_0x2ff923,_0x23737d){return client[_0x7dc9('0xa')](_0x2636ef,_0x4b3229)[_0x7dc9('0xb')](function(_0x3dd07e){logger['info'](_0x7dc9('0xc'),_0x4f91c7,_0x7dc9('0xd'));logger[_0x7dc9('0xe')](_0x7dc9('0xf'),_0x4f91c7,_0x7dc9('0xd'),JSON[_0x7dc9('0x10')](_0x3dd07e));if(_0x3dd07e[_0x7dc9('0x11')]){if(_0x3dd07e['error']['code']===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x4f91c7,_0x3dd07e[_0x7dc9('0x11')][_0x7dc9('0x12')]);return _0x23737d(_0x3dd07e['error'][_0x7dc9('0x12')]);}logger[_0x7dc9('0x11')](_0x7dc9('0xc'),_0x4f91c7,_0x3dd07e[_0x7dc9('0x11')][_0x7dc9('0x12')]);return _0x2ff923(_0x3dd07e[_0x7dc9('0x11')]['message']);}else{logger[_0x7dc9('0x13')](_0x7dc9('0xc'),_0x4f91c7,_0x7dc9('0xd'));_0x2ff923(_0x3dd07e[_0x7dc9('0x14')][_0x7dc9('0x12')]);}})[_0x7dc9('0x15')](function(_0x45698c){logger[_0x7dc9('0x11')](_0x7dc9('0xc'),_0x4f91c7,_0x45698c);_0x23737d(_0x45698c);});});}exports['CreateSquareReport']=function(_0x22577e){var _0x4afb47=this;return new Promise(function(_0x1f5906,_0x1cc237){return db['SquareReport'][_0x7dc9('0x16')](_0x22577e[_0x7dc9('0x17')],{'raw':_0x22577e[_0x7dc9('0x18')]?_0x22577e[_0x7dc9('0x18')][_0x7dc9('0x19')]===undefined?!![]:![]:!![]})[_0x7dc9('0xb')](function(_0x2dad65){logger[_0x7dc9('0x13')](_0x7dc9('0x1a'),_0x22577e);logger[_0x7dc9('0xe')]('CreateSquareReport',_0x22577e,JSON['stringify'](_0x2dad65));_0x1f5906(_0x2dad65);})[_0x7dc9('0x15')](function(_0x5981e2){logger['error'](_0x7dc9('0x1a'),_0x5981e2[_0x7dc9('0x12')],_0x22577e);_0x1cc237(_0x4afb47['error'](0x1f4,_0x5981e2[_0x7dc9('0x12')]));});});};exports[_0x7dc9('0x1b')]=function(_0x41110a){var _0x4906b1=this;return new Promise(function(_0x424763,_0x1e3a8d){return db[_0x7dc9('0x1c')]['update'](_0x41110a['body'],{'raw':_0x41110a['options']?_0x41110a[_0x7dc9('0x18')][_0x7dc9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41110a['options']?_0x41110a['options'][_0x7dc9('0x1d')]||null:null,'attributes':_0x41110a['options']?_0x41110a[_0x7dc9('0x18')][_0x7dc9('0x1e')]||null:null,'limit':_0x41110a[_0x7dc9('0x18')]?_0x41110a[_0x7dc9('0x18')][_0x7dc9('0x1f')]||null:null})[_0x7dc9('0xb')](function(_0x236d42){logger[_0x7dc9('0x13')](_0x7dc9('0x1b'),_0x41110a);logger[_0x7dc9('0xe')](_0x7dc9('0x1b'),_0x41110a,JSON[_0x7dc9('0x10')](_0x236d42));_0x424763(_0x236d42);})['catch'](function(_0x4e929c){logger['error']('UpdateSquareReport',_0x4e929c['message'],_0x41110a);_0x1e3a8d(_0x4906b1['error'](0x1f4,_0x4e929c['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 5abd5c2..8789843 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 _0x71cc=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','delete','destroy','multer','util','connect-timeout','express','fs-extra'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x71cc,0x127));var _0xc71c=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x71cc[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0xc71c('0x0'));var util=require(_0xc71c('0x1'));var path=require('path');var timeout=require(_0xc71c('0x2'));var express=require(_0xc71c('0x3'));var router=express['Router']();var fs_extra=require(_0xc71c('0x4'));var auth=require(_0xc71c('0x5'));var interaction=require(_0xc71c('0x6'));var config=require(_0xc71c('0x7'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0xc71c('0x8')](),controller[_0xc71c('0x9')]);router[_0xc71c('0xa')](_0xc71c('0xb'),auth[_0xc71c('0x8')](),controller[_0xc71c('0xc')]);router[_0xc71c('0xa')]('/:id',auth[_0xc71c('0x8')](),controller[_0xc71c('0xd')]);router[_0xc71c('0xe')]('/',auth[_0xc71c('0x8')](),controller[_0xc71c('0xf')]);router[_0xc71c('0x10')](_0xc71c('0x11'),auth[_0xc71c('0x8')](),controller['update']);router[_0xc71c('0x12')]('/:id',auth[_0xc71c('0x8')](),controller[_0xc71c('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0801=['isAuthenticated','index','get','/describe','describe','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller'];(function(_0x4a8191,_0x4f56d9){var _0x312ed9=function(_0x390652){while(--_0x390652){_0x4a8191['push'](_0x4a8191['shift']());}};_0x312ed9(++_0x4f56d9);}(_0x0801,0x79));var _0x1080=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x0801[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require(_0x1080('0x0'));var util=require(_0x1080('0x1'));var path=require(_0x1080('0x2'));var timeout=require(_0x1080('0x3'));var express=require(_0x1080('0x4'));var router=express[_0x1080('0x5')]();var fs_extra=require(_0x1080('0x6'));var auth=require(_0x1080('0x7'));var interaction=require(_0x1080('0x8'));var config=require(_0x1080('0x9'));var controller=require(_0x1080('0xa'));router['get']('/',auth[_0x1080('0xb')](),controller[_0x1080('0xc')]);router[_0x1080('0xd')](_0x1080('0xe'),auth['isAuthenticated'](),controller[_0x1080('0xf')]);router['get'](_0x1080('0x10'),auth[_0x1080('0xb')](),controller[_0x1080('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1080('0x12')]('/:id',auth[_0x1080('0xb')](),controller['update']);router[_0x1080('0x13')](_0x1080('0x10'),auth[_0x1080('0xb')](),controller[_0x1080('0x14')]);module[_0x1080('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 19dbcc0..95b247b 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 _0x8f85=['sequelize','STRING','TEXT'];(function(_0x59af5b,_0x1c35e3){var _0xaa62cb=function(_0x1aea59){while(--_0x1aea59){_0x59af5b['push'](_0x59af5b['shift']());}};_0xaa62cb(++_0x1c35e3);}(_0x8f85,0x14d));var _0x58f8=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x8f85[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require(_0x58f8('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x58f8('0x1')]},'node':{'type':Sequelize[_0x58f8('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x58f8('0x2')]},'project_name':{'type':Sequelize[_0x58f8('0x1')]},'callerid':{'type':Sequelize[_0x58f8('0x1')]}}; \ No newline at end of file +var _0x6f41=['sequelize','exports','STRING','TEXT'];(function(_0x3d59d8,_0x4ebb33){var _0x5907aa=function(_0x27a1b6){while(--_0x27a1b6){_0x3d59d8['push'](_0x3d59d8['shift']());}};_0x5907aa(++_0x4ebb33);}(_0x6f41,0x74));var _0x16f4=function(_0x1a2325,_0x2334ec){_0x1a2325=_0x1a2325-0x0;var _0xe80f95=_0x6f41[_0x1a2325];return _0xe80f95;};'use strict';var Sequelize=require(_0x16f4('0x0'));module[_0x16f4('0x1')]={'uniqueid':{'type':Sequelize[_0x16f4('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x16f4('0x2')]},'data':{'type':Sequelize[_0x16f4('0x3')]},'project_name':{'type':Sequelize[_0x16f4('0x2')]},'callerid':{'type':Sequelize[_0x16f4('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 337bb52..dc6c9c6 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 _0x7dd5=['findAll','show','params','include','catch','create','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','stack','send','render','body','contact','message','interaction','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x7dd5,0x185));var _0x57dd=function(_0x2b1fea,_0x31ba14){_0x2b1fea=_0x2b1fea-0x0;var _0x3ffd81=_0x7dd5[_0x2b1fea];return _0x3ffd81;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57dd('0x0'));var zipdir=require(_0x57dd('0x1'));var jsonpatch=require(_0x57dd('0x2'));var rp=require(_0x57dd('0x3'));var moment=require(_0x57dd('0x4'));var BPromise=require(_0x57dd('0x5'));var Mustache=require(_0x57dd('0x6'));var util=require(_0x57dd('0x7'));var path=require(_0x57dd('0x8'));var sox=require('sox');var csv=require(_0x57dd('0x9'));var ejs=require(_0x57dd('0xa'));var fs=require('fs');var fs_extra=require(_0x57dd('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x57dd('0xc'));var jsforce=require(_0x57dd('0xd'));var deskjs=require(_0x57dd('0xe'));var toCsv=require(_0x57dd('0x9'));var querystring=require(_0x57dd('0xf'));var Papa=require('papaparse');var Redis=require(_0x57dd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x57dd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x57dd('0x12'))('api');var utils=require(_0x57dd('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ee449,_0x231295){_0x231295=_0x231295||0xcc;return function(_0x4ba846){if(_0x4ba846){return _0x1ee449[_0x57dd('0x14')](_0x231295);}return _0x1ee449['status'](_0x231295)['end']();};}function respondWithResult(_0x3ab0ec,_0x250972){_0x250972=_0x250972||0xc8;return function(_0x6c89ad){if(_0x6c89ad){return _0x3ab0ec[_0x57dd('0x15')](_0x250972)[_0x57dd('0x16')](_0x6c89ad);}};}function respondWithFilteredResult(_0xf89471,_0x4bf8df){return function(_0x15bfab){if(_0x15bfab){var _0x57e8b9=typeof _0x4bf8df[_0x57dd('0x17')]===_0x57dd('0x18')&&typeof _0x4bf8df[_0x57dd('0x19')]===_0x57dd('0x18');var _0x3b2e2a=_0x15bfab[_0x57dd('0x1a')];var _0x4f4b52=_0x57e8b9?0x0:_0x4bf8df[_0x57dd('0x17')];var _0x12ca9a=_0x57e8b9?_0x15bfab[_0x57dd('0x1a')]:_0x4bf8df[_0x57dd('0x17')]+_0x4bf8df['limit'];var _0x501327;if(_0x12ca9a>=_0x3b2e2a){_0x12ca9a=_0x3b2e2a;_0x501327=0xc8;}else{_0x501327=0xce;}_0xf89471['status'](_0x501327);return _0xf89471[_0x57dd('0x1b')](_0x57dd('0x1c'),_0x4f4b52+'-'+_0x12ca9a+'/'+_0x3b2e2a)[_0x57dd('0x16')](_0x15bfab);}return null;};}function patchUpdates(_0xc6ded8){return function(_0x3ecc6f){try{jsonpatch[_0x57dd('0x1d')](_0x3ecc6f,_0xc6ded8,!![]);}catch(_0x586a16){return BPromise['reject'](_0x586a16);}return _0x3ecc6f[_0x57dd('0x1e')]();};}function saveUpdates(_0x26d2fa,_0x1172fd){return function(_0x31c915){if(_0x31c915){return _0x31c915[_0x57dd('0x1f')](_0x26d2fa)[_0x57dd('0x20')](function(_0x5f47cd){return _0x5f47cd;});}return null;};}function removeEntity(_0x5a6ff2,_0x5a1364){return function(_0x323019){if(_0x323019){return _0x323019['destroy']()['then'](function(){_0x5a6ff2[_0x57dd('0x15')](0xcc)[_0x57dd('0x21')]();});}};}function handleEntityNotFound(_0x86386e,_0x5a35fb){return function(_0x58624d){if(!_0x58624d){_0x86386e['sendStatus'](0x194);}return _0x58624d;};}function handleError(_0x213d7e,_0x1ef5c2){_0x1ef5c2=_0x1ef5c2||0x1f4;return function(_0x1a8e50){logger['error'](_0x1a8e50[_0x57dd('0x22')]);if(_0x1a8e50['name']){delete _0x1a8e50['name'];}_0x213d7e[_0x57dd('0x15')](_0x1ef5c2)[_0x57dd('0x23')](_0x1a8e50);};}function getMustacheRender(_0x575560,_0x4f41ed){return Mustache[_0x57dd('0x24')](_0x575560,_['merge'](_0x4f41ed[_0x57dd('0x25')],{'contact':_0x4f41ed[_0x57dd('0x26')],'message':_0x4f41ed[_0x57dd('0x27')],'agent':_0x4f41ed['agent'],'interaction':_0x4f41ed[_0x57dd('0x28')],'account':_0x4f41ed['account']}))||'';}exports['index']=function(_0x428033,_0x14d491){var _0x586704={},_0xbd8101={},_0x556280={'count':0x0,'rows':[]};var _0x17621a=_[_0x57dd('0x29')](db[_0x57dd('0x2a')][_0x57dd('0x2b')],function(_0x54e3b8){return{'name':_0x54e3b8[_0x57dd('0x2c')],'type':_0x54e3b8[_0x57dd('0x2d')][_0x57dd('0x2e')]};});_0xbd8101[_0x57dd('0x2f')]=_[_0x57dd('0x29')](_0x17621a,_0x57dd('0x30'));_0xbd8101[_0x57dd('0x31')]=_[_0x57dd('0x32')](_0x428033[_0x57dd('0x31')]);_0xbd8101['filters']=_[_0x57dd('0x33')](_0xbd8101[_0x57dd('0x2f')],_0xbd8101[_0x57dd('0x31')]);_0x586704[_0x57dd('0x34')]=_['intersection'](_0xbd8101[_0x57dd('0x2f')],qs[_0x57dd('0x35')](_0x428033[_0x57dd('0x31')]['fields']));_0x586704['attributes']=_0x586704[_0x57dd('0x34')][_0x57dd('0x36')]?_0x586704['attributes']:_0xbd8101['model'];if(!_0x428033[_0x57dd('0x31')][_0x57dd('0x37')](_0x57dd('0x38'))){_0x586704[_0x57dd('0x19')]=qs['limit'](_0x428033[_0x57dd('0x31')][_0x57dd('0x19')]);_0x586704[_0x57dd('0x17')]=qs[_0x57dd('0x17')](_0x428033[_0x57dd('0x31')][_0x57dd('0x17')]);}_0x586704[_0x57dd('0x39')]=qs[_0x57dd('0x3a')](_0x428033[_0x57dd('0x31')][_0x57dd('0x3a')]);_0x586704[_0x57dd('0x3b')]=qs[_0x57dd('0x3c')](_[_0x57dd('0x3d')](_0x428033[_0x57dd('0x31')],_0xbd8101[_0x57dd('0x3c')]),_0x17621a);if(_0x428033['query']['filter']){_0x586704['where']=_['merge'](_0x586704['where'],{'$or':_[_0x57dd('0x29')](_0x17621a,function(_0x2507b4){if(_0x2507b4[_0x57dd('0x2d')]!==_0x57dd('0x3e')){var _0x2577d7={};_0x2577d7[_0x2507b4[_0x57dd('0x30')]]={'$like':'%'+_0x428033[_0x57dd('0x31')][_0x57dd('0x3f')]+'%'};return _0x2577d7;}})});}_0x586704=_[_0x57dd('0x40')]({},_0x586704,_0x428033[_0x57dd('0x41')]);var _0x10cfb8={'where':_0x586704[_0x57dd('0x3b')]};return db[_0x57dd('0x2a')][_0x57dd('0x1a')](_0x10cfb8)[_0x57dd('0x20')](function(_0x2fdb22){_0x556280[_0x57dd('0x1a')]=_0x2fdb22;if(_0x428033[_0x57dd('0x31')][_0x57dd('0x42')]){_0x586704['include']=[{'all':!![]}];}return db[_0x57dd('0x2a')][_0x57dd('0x43')](_0x586704);})[_0x57dd('0x20')](function(_0x7b44e3){_0x556280['rows']=_0x7b44e3;return _0x556280;})[_0x57dd('0x20')](respondWithFilteredResult(_0x14d491,_0x586704))['catch'](handleError(_0x14d491,null));};exports[_0x57dd('0x44')]=function(_0x5df597,_0x14fd79){var _0x423ae0={'raw':!![],'where':{'id':_0x5df597[_0x57dd('0x45')]['id']}},_0x31193d={};_0x31193d[_0x57dd('0x2f')]=_['keys'](db[_0x57dd('0x2a')][_0x57dd('0x2b')]);_0x31193d[_0x57dd('0x31')]=_['keys'](_0x5df597[_0x57dd('0x31')]);_0x31193d[_0x57dd('0x3c')]=_[_0x57dd('0x33')](_0x31193d[_0x57dd('0x2f')],_0x31193d['query']);_0x423ae0[_0x57dd('0x34')]=_[_0x57dd('0x33')](_0x31193d[_0x57dd('0x2f')],qs['fields'](_0x5df597[_0x57dd('0x31')]['fields']));_0x423ae0['attributes']=_0x423ae0[_0x57dd('0x34')][_0x57dd('0x36')]?_0x423ae0[_0x57dd('0x34')]:_0x31193d['model'];if(_0x5df597[_0x57dd('0x31')][_0x57dd('0x42')]){_0x423ae0[_0x57dd('0x46')]=[{'all':!![]}];}_0x423ae0=_[_0x57dd('0x40')]({},_0x423ae0,_0x5df597[_0x57dd('0x41')]);return db[_0x57dd('0x2a')]['find'](_0x423ae0)[_0x57dd('0x20')](handleEntityNotFound(_0x14fd79,null))[_0x57dd('0x20')](respondWithResult(_0x14fd79,null))[_0x57dd('0x47')](handleError(_0x14fd79,null));};exports[_0x57dd('0x48')]=function(_0x23433b,_0x5cade9){return db['SquareDetailsReport']['create'](_0x23433b[_0x57dd('0x25')],{})[_0x57dd('0x20')](respondWithResult(_0x5cade9,0xc9))[_0x57dd('0x47')](handleError(_0x5cade9,null));};exports[_0x57dd('0x1f')]=function(_0x30a2de,_0xa6af6e){if(_0x30a2de[_0x57dd('0x25')]['id']){delete _0x30a2de[_0x57dd('0x25')]['id'];}return db[_0x57dd('0x2a')][_0x57dd('0x49')]({'where':{'id':_0x30a2de[_0x57dd('0x45')]['id']}})[_0x57dd('0x20')](handleEntityNotFound(_0xa6af6e,null))[_0x57dd('0x20')](saveUpdates(_0x30a2de[_0x57dd('0x25')],null))[_0x57dd('0x20')](respondWithResult(_0xa6af6e,null))[_0x57dd('0x47')](handleError(_0xa6af6e,null));};exports[_0x57dd('0x4a')]=function(_0x2e2c6b,_0x4089b4){return db[_0x57dd('0x2a')][_0x57dd('0x49')]({'where':{'id':_0x2e2c6b[_0x57dd('0x45')]['id']}})[_0x57dd('0x20')](handleEntityNotFound(_0x4089b4,null))[_0x57dd('0x20')](removeEntity(_0x4089b4,null))['catch'](handleError(_0x4089b4,null));};exports[_0x57dd('0x4b')]=function(_0xd80bf4,_0x199cf1){return db['SquareDetailsReport'][_0x57dd('0x4b')]()[_0x57dd('0x20')](respondWithResult(_0x199cf1,null))[_0x57dd('0x47')](handleError(_0x199cf1,null));}; \ No newline at end of file +var _0x7fdb=['count','set','Content-Range','reject','save','update','then','stack','name','send','merge','body','message','agent','account','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','type','SquareDetailsReport','include','findAll','catch','show','params','includeAll','find','create','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined'];(function(_0x151ecd,_0x18ecb1){var _0x4c2325=function(_0x3c654c){while(--_0x3c654c){_0x151ecd['push'](_0x151ecd['shift']());}};_0x4c2325(++_0x18ecb1);}(_0x7fdb,0xc6));var _0xb7fd=function(_0x340aa5,_0x2d5553){_0x340aa5=_0x340aa5-0x0;var _0x3a5b7f=_0x7fdb[_0x340aa5];return _0x3a5b7f;};'use strict';var emlformat=require(_0xb7fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb7fd('0x1'));var jsonpatch=require(_0xb7fd('0x2'));var rp=require(_0xb7fd('0x3'));var moment=require(_0xb7fd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb7fd('0x5'));var util=require(_0xb7fd('0x6'));var path=require(_0xb7fd('0x7'));var sox=require('sox');var csv=require(_0xb7fd('0x8'));var ejs=require(_0xb7fd('0x9'));var fs=require('fs');var fs_extra=require(_0xb7fd('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb7fd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb7fd('0xc'));var toCsv=require(_0xb7fd('0x8'));var querystring=require(_0xb7fd('0xd'));var Papa=require(_0xb7fd('0xe'));var Redis=require(_0xb7fd('0xf'));var authService=require(_0xb7fd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb7fd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb7fd('0x12'))(_0xb7fd('0x13'));var utils=require(_0xb7fd('0x14'));var config=require(_0xb7fd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb7fd('0x16'))['db'];function respondWithStatusCode(_0x10a893,_0x398890){_0x398890=_0x398890||0xcc;return function(_0x211ef1){if(_0x211ef1){return _0x10a893[_0xb7fd('0x17')](_0x398890);}return _0x10a893['status'](_0x398890)[_0xb7fd('0x18')]();};}function respondWithResult(_0x2879b0,_0x516f12){_0x516f12=_0x516f12||0xc8;return function(_0x4c0369){if(_0x4c0369){return _0x2879b0[_0xb7fd('0x19')](_0x516f12)[_0xb7fd('0x1a')](_0x4c0369);}};}function respondWithFilteredResult(_0xbb93f3,_0xf20519){return function(_0x4c6176){if(_0x4c6176){var _0xcf20fa=typeof _0xf20519[_0xb7fd('0x1b')]==='undefined'&&typeof _0xf20519[_0xb7fd('0x1c')]===_0xb7fd('0x1d');var _0x597a45=_0x4c6176[_0xb7fd('0x1e')];var _0x138884=_0xcf20fa?0x0:_0xf20519[_0xb7fd('0x1b')];var _0x5a576e=_0xcf20fa?_0x4c6176[_0xb7fd('0x1e')]:_0xf20519['offset']+_0xf20519['limit'];var _0xe0629;if(_0x5a576e>=_0x597a45){_0x5a576e=_0x597a45;_0xe0629=0xc8;}else{_0xe0629=0xce;}_0xbb93f3['status'](_0xe0629);return _0xbb93f3[_0xb7fd('0x1f')](_0xb7fd('0x20'),_0x138884+'-'+_0x5a576e+'/'+_0x597a45)[_0xb7fd('0x1a')](_0x4c6176);}return null;};}function patchUpdates(_0x28d82e){return function(_0x2bdcc2){try{jsonpatch['apply'](_0x2bdcc2,_0x28d82e,!![]);}catch(_0x100d9f){return BPromise[_0xb7fd('0x21')](_0x100d9f);}return _0x2bdcc2[_0xb7fd('0x22')]();};}function saveUpdates(_0x215551,_0x1c67d3){return function(_0x243a1f){if(_0x243a1f){return _0x243a1f[_0xb7fd('0x23')](_0x215551)[_0xb7fd('0x24')](function(_0x4574df){return _0x4574df;});}return null;};}function removeEntity(_0x3f6b95,_0x1721c9){return function(_0x1b8378){if(_0x1b8378){return _0x1b8378['destroy']()[_0xb7fd('0x24')](function(){_0x3f6b95[_0xb7fd('0x19')](0xcc)[_0xb7fd('0x18')]();});}};}function handleEntityNotFound(_0x550e2b,_0x3e9871){return function(_0x4ca5e5){if(!_0x4ca5e5){_0x550e2b['sendStatus'](0x194);}return _0x4ca5e5;};}function handleError(_0x52fc0f,_0x3da6e2){_0x3da6e2=_0x3da6e2||0x1f4;return function(_0x668fb9){logger['error'](_0x668fb9[_0xb7fd('0x25')]);if(_0x668fb9[_0xb7fd('0x26')]){delete _0x668fb9[_0xb7fd('0x26')];}_0x52fc0f[_0xb7fd('0x19')](_0x3da6e2)[_0xb7fd('0x27')](_0x668fb9);};}function getMustacheRender(_0x478660,_0x4ffcac){return Mustache['render'](_0x478660,_[_0xb7fd('0x28')](_0x4ffcac[_0xb7fd('0x29')],{'contact':_0x4ffcac['contact'],'message':_0x4ffcac[_0xb7fd('0x2a')],'agent':_0x4ffcac[_0xb7fd('0x2b')],'interaction':_0x4ffcac['interaction'],'account':_0x4ffcac[_0xb7fd('0x2c')]}))||'';}exports[_0xb7fd('0x2d')]=function(_0x4e9f57,_0x1c1869){var _0x2cd5f1={},_0x5c2e85={},_0x21aaad={'count':0x0,'rows':[]};var _0x3ababc=_[_0xb7fd('0x2e')](db['SquareDetailsReport'][_0xb7fd('0x2f')],function(_0x567557){return{'name':_0x567557[_0xb7fd('0x30')],'type':_0x567557['type'][_0xb7fd('0x31')]};});_0x5c2e85['model']=_[_0xb7fd('0x2e')](_0x3ababc,_0xb7fd('0x26'));_0x5c2e85[_0xb7fd('0x32')]=_[_0xb7fd('0x33')](_0x4e9f57[_0xb7fd('0x32')]);_0x5c2e85['filters']=_[_0xb7fd('0x34')](_0x5c2e85[_0xb7fd('0x35')],_0x5c2e85[_0xb7fd('0x32')]);_0x2cd5f1[_0xb7fd('0x36')]=_[_0xb7fd('0x34')](_0x5c2e85[_0xb7fd('0x35')],qs['fields'](_0x4e9f57['query'][_0xb7fd('0x37')]));_0x2cd5f1[_0xb7fd('0x36')]=_0x2cd5f1[_0xb7fd('0x36')][_0xb7fd('0x38')]?_0x2cd5f1[_0xb7fd('0x36')]:_0x5c2e85['model'];if(!_0x4e9f57[_0xb7fd('0x32')][_0xb7fd('0x39')](_0xb7fd('0x3a'))){_0x2cd5f1[_0xb7fd('0x1c')]=qs[_0xb7fd('0x1c')](_0x4e9f57[_0xb7fd('0x32')]['limit']);_0x2cd5f1[_0xb7fd('0x1b')]=qs['offset'](_0x4e9f57[_0xb7fd('0x32')][_0xb7fd('0x1b')]);}_0x2cd5f1[_0xb7fd('0x3b')]=qs['sort'](_0x4e9f57[_0xb7fd('0x32')]['sort']);_0x2cd5f1['where']=qs[_0xb7fd('0x3c')](_[_0xb7fd('0x3d')](_0x4e9f57[_0xb7fd('0x32')],_0x5c2e85['filters']),_0x3ababc);if(_0x4e9f57['query'][_0xb7fd('0x3e')]){_0x2cd5f1[_0xb7fd('0x3f')]=_[_0xb7fd('0x28')](_0x2cd5f1[_0xb7fd('0x3f')],{'$or':_['map'](_0x3ababc,function(_0x1eff61){if(_0x1eff61[_0xb7fd('0x40')]!=='VIRTUAL'){var _0x4878b3={};_0x4878b3[_0x1eff61['name']]={'$like':'%'+_0x4e9f57[_0xb7fd('0x32')][_0xb7fd('0x3e')]+'%'};return _0x4878b3;}})});}_0x2cd5f1=_['merge']({},_0x2cd5f1,_0x4e9f57['options']);var _0x16b3c7={'where':_0x2cd5f1[_0xb7fd('0x3f')]};return db[_0xb7fd('0x41')][_0xb7fd('0x1e')](_0x16b3c7)[_0xb7fd('0x24')](function(_0x1a1f58){_0x21aaad[_0xb7fd('0x1e')]=_0x1a1f58;if(_0x4e9f57[_0xb7fd('0x32')]['includeAll']){_0x2cd5f1[_0xb7fd('0x42')]=[{'all':!![]}];}return db[_0xb7fd('0x41')][_0xb7fd('0x43')](_0x2cd5f1);})[_0xb7fd('0x24')](function(_0x216b20){_0x21aaad['rows']=_0x216b20;return _0x21aaad;})['then'](respondWithFilteredResult(_0x1c1869,_0x2cd5f1))[_0xb7fd('0x44')](handleError(_0x1c1869,null));};exports[_0xb7fd('0x45')]=function(_0x1b9f2b,_0x33b236){var _0x57905d={'raw':!![],'where':{'id':_0x1b9f2b[_0xb7fd('0x46')]['id']}},_0x15bc15={};_0x15bc15[_0xb7fd('0x35')]=_[_0xb7fd('0x33')](db[_0xb7fd('0x41')][_0xb7fd('0x2f')]);_0x15bc15[_0xb7fd('0x32')]=_[_0xb7fd('0x33')](_0x1b9f2b[_0xb7fd('0x32')]);_0x15bc15[_0xb7fd('0x3c')]=_[_0xb7fd('0x34')](_0x15bc15['model'],_0x15bc15[_0xb7fd('0x32')]);_0x57905d['attributes']=_[_0xb7fd('0x34')](_0x15bc15[_0xb7fd('0x35')],qs[_0xb7fd('0x37')](_0x1b9f2b[_0xb7fd('0x32')][_0xb7fd('0x37')]));_0x57905d['attributes']=_0x57905d[_0xb7fd('0x36')][_0xb7fd('0x38')]?_0x57905d[_0xb7fd('0x36')]:_0x15bc15[_0xb7fd('0x35')];if(_0x1b9f2b['query'][_0xb7fd('0x47')]){_0x57905d[_0xb7fd('0x42')]=[{'all':!![]}];}_0x57905d=_[_0xb7fd('0x28')]({},_0x57905d,_0x1b9f2b['options']);return db[_0xb7fd('0x41')][_0xb7fd('0x48')](_0x57905d)[_0xb7fd('0x24')](handleEntityNotFound(_0x33b236,null))['then'](respondWithResult(_0x33b236,null))[_0xb7fd('0x44')](handleError(_0x33b236,null));};exports[_0xb7fd('0x49')]=function(_0x2dc079,_0xbcde56){return db[_0xb7fd('0x41')][_0xb7fd('0x49')](_0x2dc079[_0xb7fd('0x29')],{})[_0xb7fd('0x24')](respondWithResult(_0xbcde56,0xc9))[_0xb7fd('0x44')](handleError(_0xbcde56,null));};exports[_0xb7fd('0x23')]=function(_0x58864e,_0x244919){if(_0x58864e[_0xb7fd('0x29')]['id']){delete _0x58864e[_0xb7fd('0x29')]['id'];}return db['SquareDetailsReport'][_0xb7fd('0x48')]({'where':{'id':_0x58864e[_0xb7fd('0x46')]['id']}})['then'](handleEntityNotFound(_0x244919,null))[_0xb7fd('0x24')](saveUpdates(_0x58864e[_0xb7fd('0x29')],null))[_0xb7fd('0x24')](respondWithResult(_0x244919,null))['catch'](handleError(_0x244919,null));};exports[_0xb7fd('0x4a')]=function(_0x4e76c4,_0x32fc3f){return db[_0xb7fd('0x41')]['find']({'where':{'id':_0x4e76c4['params']['id']}})[_0xb7fd('0x24')](handleEntityNotFound(_0x32fc3f,null))[_0xb7fd('0x24')](removeEntity(_0x32fc3f,null))[_0xb7fd('0x44')](handleError(_0x32fc3f,null));};exports[_0xb7fd('0x4b')]=function(_0x4757d0,_0x536a7f){return db[_0xb7fd('0x41')]['describe']()[_0xb7fd('0x24')](respondWithResult(_0x536a7f,null))[_0xb7fd('0x44')](handleError(_0x536a7f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 27a1814..c9928b9 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 _0xbe2f=['../../config/logger','api','moment','bluebird','request-promise','path','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x586e65,_0x588e04){var _0x34f584=function(_0x463eb0){while(--_0x463eb0){_0x586e65['push'](_0x586e65['shift']());}};_0x34f584(++_0x588e04);}(_0xbe2f,0x1ab));var _0xfbe2=function(_0x1eeff9,_0x3e9fbf){_0x1eeff9=_0x1eeff9-0x0;var _0x5b15ca=_0xbe2f[_0x1eeff9];return _0x5b15ca;};'use strict';var _=require(_0xfbe2('0x0'));var util=require(_0xfbe2('0x1'));var logger=require(_0xfbe2('0x2'))(_0xfbe2('0x3'));var moment=require(_0xfbe2('0x4'));var BPromise=require(_0xfbe2('0x5'));var rp=require(_0xfbe2('0x6'));var fs=require('fs');var path=require(_0xfbe2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfbe2('0x8'));module[_0xfbe2('0x9')]=function(_0x13e037,_0xb119ae){return _0x13e037[_0xfbe2('0xa')](_0xfbe2('0xb'),attributes,{'tableName':_0xfbe2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7af=['exports','SquareDetailsReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./squareReportDetail.attributes'];(function(_0x4045ff,_0x46cbcd){var _0x5797ac=function(_0x32003f){while(--_0x32003f){_0x4045ff['push'](_0x4045ff['shift']());}};_0x5797ac(++_0x46cbcd);}(_0xa7af,0x1a6));var _0xfa7a=function(_0x4d5ecb,_0x1b554d){_0x4d5ecb=_0x4d5ecb-0x0;var _0x172a53=_0xa7af[_0x4d5ecb];return _0x172a53;};'use strict';var _=require(_0xfa7a('0x0'));var util=require(_0xfa7a('0x1'));var logger=require(_0xfa7a('0x2'))(_0xfa7a('0x3'));var moment=require(_0xfa7a('0x4'));var BPromise=require(_0xfa7a('0x5'));var rp=require(_0xfa7a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa7a('0x7'));module[_0xfa7a('0x8')]=function(_0x14b20f,_0x159a3b){return _0x14b20f['define'](_0xfa7a('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index ad6fc57..2ef6af9 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 _0x76e3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','util','moment'];(function(_0x4f6d08,_0x1b3dd0){var _0x53a9c6=function(_0x2e0e0f){while(--_0x2e0e0f){_0x4f6d08['push'](_0x4f6d08['shift']());}};_0x53a9c6(++_0x1b3dd0);}(_0x76e3,0x1b1));var _0x376e=function(_0x165f46,_0x184bb4){_0x165f46=_0x165f46-0x0;var _0x5a4361=_0x76e3[_0x165f46];return _0x5a4361;};'use strict';var _=require('lodash');var util=require(_0x376e('0x0'));var moment=require(_0x376e('0x1'));var BPromise=require(_0x376e('0x2'));var rs=require(_0x376e('0x3'));var fs=require('fs');var Redis=require(_0x376e('0x4'));var db=require(_0x376e('0x5'))['db'];var utils=require(_0x376e('0x6'));var logger=require(_0x376e('0x7'))(_0x376e('0x8'));var config=require(_0x376e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x376e('0xa')][_0x376e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43dc31,_0x536702,_0xa5c6df){return new BPromise(function(_0x30699f,_0xe57996){return client[_0x376e('0xc')](_0x43dc31,_0xa5c6df)[_0x376e('0xd')](function(_0x5f17ac){logger[_0x376e('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x536702,_0x376e('0xf'));logger[_0x376e('0x10')](_0x376e('0x11'),_0x536702,'request\x20sent',JSON[_0x376e('0x12')](_0x5f17ac));if(_0x5f17ac[_0x376e('0x13')]){if(_0x5f17ac[_0x376e('0x13')][_0x376e('0x14')]===0x1f4){logger[_0x376e('0x13')](_0x376e('0x15'),_0x536702,_0x5f17ac[_0x376e('0x13')][_0x376e('0x16')]);return _0xe57996(_0x5f17ac[_0x376e('0x13')]['message']);}logger[_0x376e('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x536702,_0x5f17ac[_0x376e('0x13')][_0x376e('0x16')]);return _0x30699f(_0x5f17ac[_0x376e('0x13')]['message']);}else{logger[_0x376e('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x536702,_0x376e('0xf'));_0x30699f(_0x5f17ac['result'][_0x376e('0x16')]);}})[_0x376e('0x17')](function(_0x35cd31){logger[_0x376e('0x13')](_0x376e('0x15'),_0x536702,_0x35cd31);_0xe57996(_0x35cd31);});});}exports[_0x376e('0x18')]=function(_0x4478b1){var _0x293b44=this;return new Promise(function(_0x2114c3,_0x416b27){return db[_0x376e('0x19')]['create'](_0x4478b1[_0x376e('0x1a')],{'raw':_0x4478b1[_0x376e('0x1b')]?_0x4478b1['options'][_0x376e('0x1c')]===undefined?!![]:![]:!![]})[_0x376e('0xd')](function(_0x1f1ebc){logger[_0x376e('0xe')](_0x376e('0x18'),_0x4478b1);logger[_0x376e('0x10')]('CreateSquareDetailsReport',_0x4478b1,JSON[_0x376e('0x12')](_0x1f1ebc));_0x2114c3(_0x1f1ebc);})[_0x376e('0x17')](function(_0x4ef3e5){logger[_0x376e('0x13')](_0x376e('0x18'),_0x4ef3e5[_0x376e('0x16')],_0x4478b1);_0x416b27(_0x293b44[_0x376e('0x13')](0x1f4,_0x4ef3e5['message']));});});}; \ No newline at end of file +var _0x92f7=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','create','body','options','raw','CreateSquareDetailsReport'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0x92f7,0x122));var _0x792f=function(_0x40da26,_0x23369c){_0x40da26=_0x40da26-0x0;var _0x2a49a7=_0x92f7[_0x40da26];return _0x2a49a7;};'use strict';var _=require(_0x792f('0x0'));var util=require(_0x792f('0x1'));var moment=require('moment');var BPromise=require(_0x792f('0x2'));var rs=require(_0x792f('0x3'));var fs=require('fs');var Redis=require(_0x792f('0x4'));var db=require(_0x792f('0x5'))['db'];var utils=require(_0x792f('0x6'));var logger=require('../../config/logger')(_0x792f('0x7'));var config=require(_0x792f('0x8'));var jayson=require(_0x792f('0x9'));var client=jayson[_0x792f('0xa')][_0x792f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26a5bb,_0x43c188,_0x4fb791){return new BPromise(function(_0x565eb2,_0x59bf57){return client[_0x792f('0xc')](_0x26a5bb,_0x4fb791)[_0x792f('0xd')](function(_0x3b324d){logger[_0x792f('0xe')](_0x792f('0xf'),_0x43c188,'request\x20sent');logger[_0x792f('0x10')](_0x792f('0x11'),_0x43c188,'request\x20sent',JSON[_0x792f('0x12')](_0x3b324d));if(_0x3b324d[_0x792f('0x13')]){if(_0x3b324d[_0x792f('0x13')][_0x792f('0x14')]===0x1f4){logger[_0x792f('0x13')](_0x792f('0xf'),_0x43c188,_0x3b324d[_0x792f('0x13')][_0x792f('0x15')]);return _0x59bf57(_0x3b324d[_0x792f('0x13')][_0x792f('0x15')]);}logger[_0x792f('0x13')](_0x792f('0xf'),_0x43c188,_0x3b324d[_0x792f('0x13')]['message']);return _0x565eb2(_0x3b324d[_0x792f('0x13')][_0x792f('0x15')]);}else{logger[_0x792f('0xe')](_0x792f('0xf'),_0x43c188,_0x792f('0x16'));_0x565eb2(_0x3b324d[_0x792f('0x17')]['message']);}})['catch'](function(_0x80b293){logger[_0x792f('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x43c188,_0x80b293);_0x59bf57(_0x80b293);});});}exports['CreateSquareDetailsReport']=function(_0x29b040){var _0x4f479a=this;return new Promise(function(_0x3e1327,_0x5ef88c){return db['SquareDetailsReport'][_0x792f('0x18')](_0x29b040[_0x792f('0x19')],{'raw':_0x29b040[_0x792f('0x1a')]?_0x29b040[_0x792f('0x1a')][_0x792f('0x1b')]===undefined?!![]:![]:!![]})[_0x792f('0xd')](function(_0x5401f4){logger[_0x792f('0xe')](_0x792f('0x1c'),_0x29b040);logger['debug'](_0x792f('0x1c'),_0x29b040,JSON[_0x792f('0x12')](_0x5401f4));_0x3e1327(_0x5401f4);})['catch'](function(_0xd9f57a){logger[_0x792f('0x13')](_0x792f('0x1c'),_0xd9f57a[_0x792f('0x15')],_0x29b040);_0x5ef88c(_0x4f479a[_0x792f('0x13')](0x1f4,_0xd9f57a[_0x792f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 7706a36..c7273db 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 _0x8e0c=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','killProcess','exports','express'];(function(_0x4366e3,_0x53f422){var _0x189d11=function(_0x5d8110){while(--_0x5d8110){_0x4366e3['push'](_0x4366e3['shift']());}};_0x189d11(++_0x53f422);}(_0x8e0c,0x167));var _0xc8e0=function(_0x3bd31a,_0x42bd31){_0x3bd31a=_0x3bd31a-0x0;var _0x43dc73=_0x8e0c[_0x3bd31a];return _0x43dc73;};'use strict';var express=require(_0xc8e0('0x0'));var router=express[_0xc8e0('0x1')]();var auth=require(_0xc8e0('0x2'));var controller=require(_0xc8e0('0x3'));router[_0xc8e0('0x4')]('/',auth[_0xc8e0('0x5')](),controller[_0xc8e0('0x6')]);router[_0xc8e0('0x4')]('/process/:pid/kill',auth[_0xc8e0('0x5')](),controller[_0xc8e0('0x7')]);module[_0xc8e0('0x8')]=router; \ No newline at end of file +var _0x1a54=['./system.controller','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1a54,0x1d6));var _0x41a5=function(_0x384d54,_0x2daebf){_0x384d54=_0x384d54-0x0;var _0x3357d7=_0x1a54[_0x384d54];return _0x3357d7;};'use strict';var express=require(_0x41a5('0x0'));var router=express[_0x41a5('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x41a5('0x2'));router['get']('/',auth[_0x41a5('0x3')](),controller[_0x41a5('0x4')]);router['get'](_0x41a5('0x5'),auth[_0x41a5('0x3')](),controller[_0x41a5('0x6')]);module[_0x41a5('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 a22c25f..effcb9e 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 _0x909f=['format','pid','then','length','indexOf','params','SIGINT','killProcess','systeminformation','exec','../../config/logger','api','bluebird','lodash','error','inspect','send','index','getAllData','status','json','catch','components/import/cm'];(function(_0x3357b1,_0x382094){var _0x1ba859=function(_0x3e8b38){while(--_0x3e8b38){_0x3357b1['push'](_0x3357b1['shift']());}};_0x1ba859(++_0x382094);}(_0x909f,0x1eb));var _0xf909=function(_0x3ea20c,_0x4d39e8){_0x3ea20c=_0x3ea20c-0x0;var _0x1d39b5=_0x909f[_0x3ea20c];return _0x1d39b5;};'use strict';var info=require(_0xf909('0x0'));var exec=require('child_process')[_0xf909('0x1')];var logger=require(_0xf909('0x2'))(_0xf909('0x3'));var util=require('util');var BPromise=require(_0xf909('0x4'));var _=require(_0xf909('0x5'));function handleError(_0x48fc74,_0xb79fb6,_0x43623d){_0xb79fb6=_0xb79fb6||0x1f4;return function(_0x16a484){logger[_0xf909('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x43623d,_0xb79fb6,util[_0xf909('0x7')](_0x16a484,{'showHidden':![],'depth':null}));delete _0x16a484['name'];_0x48fc74['status'](_0xb79fb6)[_0xf909('0x8')](_0x16a484);};}exports[_0xf909('0x9')]=function(_0x1eafd0,_0xb35584){return info[_0xf909('0xa')]()['then'](function(_0x3ee2e4){return _0xb35584[_0xf909('0xb')](0xc8)[_0xf909('0xc')](_0x3ee2e4);})[_0xf909('0xd')](function(_0x20ba4a){return _0xb35584[_0xf909('0xb')](0x1f4)[_0xf909('0xc')](_0x20ba4a);});};exports['killProcess']=function(_0x1e9270,_0x3dbdd4){var _0x221c70=[_0xf909('0xe')];return new BPromise(function(_0x4dfc15,_0x4234c1){return exec(util[_0xf909('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1e9270['params'][_0xf909('0x10')]),function(_0x6a140d,_0x2abbff,_0x7597bd){if(_0x6a140d){return _0x4234c1(_0x6a140d);}return _0x4dfc15(_0x2abbff);});})[_0xf909('0x11')](function(_0x35f410){var _0x12f096=![];var _0x588500=_0x35f410['split'](/\n/);for(var _0x5435f5=0x0,_0x5d8d40=_0x221c70[_0xf909('0x12')];_0x5435f5<_0x5d8d40,_0x12f096===![];_0x5435f5+=0x1){if(_0x35f410[_0xf909('0x13')](_0x221c70[_0x5435f5])>=0x0){_0x12f096=!![];}}if(!_0x12f096){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x1e9270[_0xf909('0x14')][_0xf909('0x10')]));}process['kill'](_0x1e9270['params'][_0xf909('0x10')],_0xf909('0x15'));return _0x3dbdd4['status'](0xc8)[_0xf909('0xc')]({'message':util[_0xf909('0xf')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x1e9270['params']['pid'])});})['catch'](handleError(_0x3dbdd4,null,_0xf909('0x16')));}; \ No newline at end of file +var _0x439c=['status','send','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name'];(function(_0x25754e,_0xe3a078){var _0x4918ca=function(_0x3a4845){while(--_0x3a4845){_0x25754e['push'](_0x25754e['shift']());}};_0x4918ca(++_0xe3a078);}(_0x439c,0x86));var _0xc439=function(_0x2d1898,_0x433d66){_0x2d1898=_0x2d1898-0x0;var _0x21f268=_0x439c[_0x2d1898];return _0x21f268;};'use strict';var info=require(_0xc439('0x0'));var exec=require(_0xc439('0x1'))['exec'];var logger=require(_0xc439('0x2'))(_0xc439('0x3'));var util=require(_0xc439('0x4'));var BPromise=require(_0xc439('0x5'));var _=require(_0xc439('0x6'));function handleError(_0x26b55c,_0x124748,_0x116f4d){_0x124748=_0x124748||0x1f4;return function(_0x3c9ede){logger[_0xc439('0x7')](_0xc439('0x8'),_0x116f4d,_0x124748,util[_0xc439('0x9')](_0x3c9ede,{'showHidden':![],'depth':null}));delete _0x3c9ede[_0xc439('0xa')];_0x26b55c[_0xc439('0xb')](_0x124748)[_0xc439('0xc')](_0x3c9ede);};}exports['index']=function(_0x3a2338,_0x52c57c){return info[_0xc439('0xd')]()[_0xc439('0xe')](function(_0x1ccfdf){return _0x52c57c[_0xc439('0xb')](0xc8)[_0xc439('0xf')](_0x1ccfdf);})[_0xc439('0x10')](function(_0x17c4a5){return _0x52c57c[_0xc439('0xb')](0x1f4)[_0xc439('0xf')](_0x17c4a5);});};exports[_0xc439('0x11')]=function(_0x53cd43,_0x35b5fa){var _0x1e30b4=[_0xc439('0x12')];return new BPromise(function(_0x557159,_0x5252b5){return exec(util[_0xc439('0x13')](_0xc439('0x14'),_0x53cd43[_0xc439('0x15')]['pid']),function(_0x154cca,_0x3baac2,_0x4d850e){if(_0x154cca){return _0x5252b5(_0x154cca);}return _0x557159(_0x3baac2);});})[_0xc439('0xe')](function(_0x16d63d){var _0x5b013f=![];var _0x1b130d=_0x16d63d[_0xc439('0x16')](/\n/);for(var _0xa2f917=0x0,_0x10f058=_0x1e30b4[_0xc439('0x17')];_0xa2f917<_0x10f058,_0x5b013f===![];_0xa2f917+=0x1){if(_0x16d63d[_0xc439('0x18')](_0x1e30b4[_0xa2f917])>=0x0){_0x5b013f=!![];}}if(!_0x5b013f){throw new Error(util[_0xc439('0x13')](_0xc439('0x19'),_0x53cd43[_0xc439('0x15')][_0xc439('0x1a')]));}process[_0xc439('0x1b')](_0x53cd43[_0xc439('0x15')][_0xc439('0x1a')],'SIGINT');return _0x35b5fa['status'](0xc8)[_0xc439('0xf')]({'message':util[_0xc439('0x13')](_0xc439('0x1c'),_0x53cd43[_0xc439('0x15')][_0xc439('0x1a')])});})[_0xc439('0x10')](handleError(_0x35b5fa,null,_0xc439('0x11')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 7cda9f4..c56a2e6 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 _0xd20f=['isAuthenticated','index','get','/:id','show','post','update','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x4eb9ad,_0x51f391){var _0x4a9e3f=function(_0x1708bc){while(--_0x1708bc){_0x4eb9ad['push'](_0x4eb9ad['shift']());}};_0x4a9e3f(++_0x51f391);}(_0xd20f,0xbf));var _0xfd20=function(_0x2068d1,_0x479ec1){_0x2068d1=_0x2068d1-0x0;var _0x3c06be=_0xd20f[_0x2068d1];return _0x3c06be;};'use strict';var multer=require(_0xfd20('0x0'));var util=require(_0xfd20('0x1'));var path=require('path');var timeout=require(_0xfd20('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfd20('0x3'));var auth=require(_0xfd20('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./tag.controller');router['get']('/',auth[_0xfd20('0x5')](),controller[_0xfd20('0x6')]);router[_0xfd20('0x7')](_0xfd20('0x8'),auth[_0xfd20('0x5')](),controller[_0xfd20('0x9')]);router[_0xfd20('0xa')]('/',auth[_0xfd20('0x5')](),controller['create']);router['put'](_0xfd20('0x8'),auth[_0xfd20('0x5')](),controller[_0xfd20('0xb')]);router[_0xfd20('0xc')](_0xfd20('0x8'),auth[_0xfd20('0x5')](),controller['destroy']);module[_0xfd20('0xd')]=router; \ No newline at end of file +var _0x3d42=['../../components/auth/service','../../components/interaction/service','./tag.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x4e4bc5,_0x5c2c2d){var _0x2e6a35=function(_0x5e3744){while(--_0x5e3744){_0x4e4bc5['push'](_0x4e4bc5['shift']());}};_0x2e6a35(++_0x5c2c2d);}(_0x3d42,0xb8));var _0x23d4=function(_0xab3958,_0x433493){_0xab3958=_0xab3958-0x0;var _0x45fc46=_0x3d42[_0xab3958];return _0x45fc46;};'use strict';var multer=require(_0x23d4('0x0'));var util=require(_0x23d4('0x1'));var path=require('path');var timeout=require(_0x23d4('0x2'));var express=require(_0x23d4('0x3'));var router=express[_0x23d4('0x4')]();var fs_extra=require(_0x23d4('0x5'));var auth=require(_0x23d4('0x6'));var interaction=require(_0x23d4('0x7'));var config=require('../../config/environment');var controller=require(_0x23d4('0x8'));router[_0x23d4('0x9')]('/',auth['isAuthenticated'](),controller[_0x23d4('0xa')]);router['get']('/:id',auth[_0x23d4('0xb')](),controller[_0x23d4('0xc')]);router[_0x23d4('0xd')]('/',auth['isAuthenticated'](),controller[_0x23d4('0xe')]);router['put'](_0x23d4('0xf'),auth[_0x23d4('0xb')](),controller[_0x23d4('0x10')]);router[_0x23d4('0x11')](_0x23d4('0xf'),auth['isAuthenticated'](),controller[_0x23d4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 6bb85e5..3e7b3ba 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 _0x0713=['#0091EA','STRING','name'];(function(_0x20c304,_0x35f872){var _0x4114b6=function(_0x2de687){while(--_0x2de687){_0x20c304['push'](_0x20c304['shift']());}};_0x4114b6(++_0x35f872);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'unique':_0x3071('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x2')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xbdb7=['name','#0091EA','sequelize','exports','STRING'];(function(_0x376866,_0x58b7f7){var _0x201d5b=function(_0x4bcc89){while(--_0x4bcc89){_0x376866['push'](_0x376866['shift']());}};_0x201d5b(++_0x58b7f7);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0xbdb7[_0x190ff6];return _0x5356d2;};'use strict';var Sequelize=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]={'name':{'type':Sequelize[_0x7bdb('0x2')],'unique':_0x7bdb('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7bdb('0x2')],'defaultValue':_0x7bdb('0x4')},'description':{'type':Sequelize[_0x7bdb('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index ba48cf7..45a220f 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 _0x860e=['body','user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','bluebird','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','status','set','json','apply','update','then','destroy','get','Tags','stack','name','send','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','limit','sort','pick','filter','merge','where','VIRTUAL','Tag','includeAll','include','findAll','rows','catch','params','keys','length','options','find','create'];(function(_0x10ac3f,_0x4901e0){var _0x176904=function(_0x42d447){while(--_0x42d447){_0x10ac3f['push'](_0x10ac3f['shift']());}};_0x176904(++_0x4901e0);}(_0x860e,0x153));var _0xe860=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x860e[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require(_0xe860('0x0'));var rimraf=require(_0xe860('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe860('0x2'));var moment=require('moment');var BPromise=require(_0xe860('0x3'));var Mustache=require('mustache');var util=require(_0xe860('0x4'));var path=require('path');var sox=require(_0xe860('0x5'));var csv=require(_0xe860('0x6'));var ejs=require(_0xe860('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe860('0x8'));var crypto=require(_0xe860('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe860('0xa'));var toCsv=require(_0xe860('0x6'));var querystring=require(_0xe860('0xb'));var Papa=require(_0xe860('0xc'));var Redis=require(_0xe860('0xd'));var authService=require(_0xe860('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xe860('0xf'));var hardwareService=require(_0xe860('0x10'));var logger=require(_0xe860('0x11'))(_0xe860('0x12'));var utils=require(_0xe860('0x13'));var config=require(_0xe860('0x14'));var licenseUtil=require(_0xe860('0x15'));var db=require(_0xe860('0x16'))['db'];function respondWithStatusCode(_0x167a1d,_0x3f1fc3){_0x3f1fc3=_0x3f1fc3||0xcc;return function(_0x5b66ef){if(_0x5b66ef){return _0x167a1d[_0xe860('0x17')](_0x3f1fc3);}return _0x167a1d['status'](_0x3f1fc3)[_0xe860('0x18')]();};}function respondWithResult(_0x2ede66,_0x19c54a){_0x19c54a=_0x19c54a||0xc8;return function(_0x41e639){if(_0x41e639){return _0x2ede66['status'](_0x19c54a)['json'](_0x41e639);}};}function respondWithFilteredResult(_0x3bac59,_0x231d80){return function(_0x1e3f4c){if(_0x1e3f4c){var _0x4627d5=typeof _0x231d80[_0xe860('0x19')]===_0xe860('0x1a')&&typeof _0x231d80['limit']==='undefined';var _0x584c31=_0x1e3f4c[_0xe860('0x1b')];var _0x437f5d=_0x4627d5?0x0:_0x231d80[_0xe860('0x19')];var _0x4bfe4c=_0x4627d5?_0x1e3f4c[_0xe860('0x1b')]:_0x231d80[_0xe860('0x19')]+_0x231d80['limit'];var _0x261b78;if(_0x4bfe4c>=_0x584c31){_0x4bfe4c=_0x584c31;_0x261b78=0xc8;}else{_0x261b78=0xce;}_0x3bac59[_0xe860('0x1c')](_0x261b78);return _0x3bac59[_0xe860('0x1d')]('Content-Range',_0x437f5d+'-'+_0x4bfe4c+'/'+_0x584c31)[_0xe860('0x1e')](_0x1e3f4c);}return null;};}function patchUpdates(_0x158139){return function(_0x40b3c6){try{jsonpatch[_0xe860('0x1f')](_0x40b3c6,_0x158139,!![]);}catch(_0xf6005e){return BPromise['reject'](_0xf6005e);}return _0x40b3c6['save']();};}function saveUpdates(_0x19ede5,_0x508f08){return function(_0x404ba3){if(_0x404ba3){return _0x404ba3[_0xe860('0x20')](_0x19ede5)[_0xe860('0x21')](function(_0x7c6b22){return _0x7c6b22;});}return null;};}function removeEntity(_0x10648c,_0x2eff25){return function(_0x6e7f91){if(_0x6e7f91){return _0x6e7f91[_0xe860('0x22')]()['then'](function(){var _0x5c2b81=_0x6e7f91[_0xe860('0x23')]({'plain':!![]});var _0x214160=_0xe860('0x24');return db['UserProfileResource'][_0xe860('0x22')]({'where':{'type':_0x214160,'resourceId':_0x5c2b81['id']}})['then'](function(){return _0x6e7f91;});})[_0xe860('0x21')](function(){_0x10648c[_0xe860('0x1c')](0xcc)[_0xe860('0x18')]();});}};}function handleEntityNotFound(_0xea78a7,_0x254ef4){return function(_0xda899c){if(!_0xda899c){_0xea78a7[_0xe860('0x17')](0x194);}return _0xda899c;};}function handleError(_0xd4112e,_0x4c95d4){_0x4c95d4=_0x4c95d4||0x1f4;return function(_0x32768a){logger['error'](_0x32768a[_0xe860('0x25')]);if(_0x32768a[_0xe860('0x26')]){delete _0x32768a[_0xe860('0x26')];}_0xd4112e[_0xe860('0x1c')](_0x4c95d4)[_0xe860('0x27')](_0x32768a);};}function getMustacheRender(_0x52e24e,_0x48e9df){return Mustache['render'](_0x52e24e,_['merge'](_0x48e9df['body'],{'contact':_0x48e9df[_0xe860('0x28')],'message':_0x48e9df['message'],'agent':_0x48e9df[_0xe860('0x29')],'interaction':_0x48e9df[_0xe860('0x2a')],'account':_0x48e9df[_0xe860('0x2b')]}))||'';}exports[_0xe860('0x2c')]=function(_0x3ae6ea,_0x1a8a11){var _0x4f9a68={},_0x4d5afe={},_0x5b8338={'count':0x0,'rows':[]};var _0x209da4=_[_0xe860('0x2d')](db['Tag'][_0xe860('0x2e')],function(_0x512382){return{'name':_0x512382[_0xe860('0x2f')],'type':_0x512382[_0xe860('0x30')][_0xe860('0x31')]};});_0x4d5afe[_0xe860('0x32')]=_[_0xe860('0x2d')](_0x209da4,_0xe860('0x26'));_0x4d5afe[_0xe860('0x33')]=_['keys'](_0x3ae6ea[_0xe860('0x33')]);_0x4d5afe[_0xe860('0x34')]=_['intersection'](_0x4d5afe[_0xe860('0x32')],_0x4d5afe[_0xe860('0x33')]);_0x4f9a68[_0xe860('0x35')]=_[_0xe860('0x36')](_0x4d5afe['model'],qs[_0xe860('0x37')](_0x3ae6ea[_0xe860('0x33')][_0xe860('0x37')]));_0x4f9a68[_0xe860('0x35')]=_0x4f9a68[_0xe860('0x35')]['length']?_0x4f9a68['attributes']:_0x4d5afe[_0xe860('0x32')];if(!_0x3ae6ea['query'][_0xe860('0x38')]('nolimit')){_0x4f9a68[_0xe860('0x39')]=qs[_0xe860('0x39')](_0x3ae6ea[_0xe860('0x33')][_0xe860('0x39')]);_0x4f9a68[_0xe860('0x19')]=qs[_0xe860('0x19')](_0x3ae6ea[_0xe860('0x33')][_0xe860('0x19')]);}_0x4f9a68['order']=qs['sort'](_0x3ae6ea[_0xe860('0x33')][_0xe860('0x3a')]);_0x4f9a68['where']=qs['filters'](_[_0xe860('0x3b')](_0x3ae6ea[_0xe860('0x33')],_0x4d5afe['filters']),_0x209da4);if(_0x3ae6ea[_0xe860('0x33')][_0xe860('0x3c')]){_0x4f9a68['where']=_[_0xe860('0x3d')](_0x4f9a68[_0xe860('0x3e')],{'$or':_[_0xe860('0x2d')](_0x209da4,function(_0x2b11e2){if(_0x2b11e2[_0xe860('0x30')]!==_0xe860('0x3f')){var _0x7df5a1={};_0x7df5a1[_0x2b11e2['name']]={'$like':'%'+_0x3ae6ea[_0xe860('0x33')][_0xe860('0x3c')]+'%'};return _0x7df5a1;}})});}_0x4f9a68=_[_0xe860('0x3d')]({},_0x4f9a68,_0x3ae6ea['options']);var _0x25a49d={'where':_0x4f9a68[_0xe860('0x3e')]};return db[_0xe860('0x40')]['count'](_0x25a49d)[_0xe860('0x21')](function(_0x251f73){_0x5b8338[_0xe860('0x1b')]=_0x251f73;if(_0x3ae6ea[_0xe860('0x33')][_0xe860('0x41')]){_0x4f9a68[_0xe860('0x42')]=[{'all':!![]}];}return db[_0xe860('0x40')][_0xe860('0x43')](_0x4f9a68);})[_0xe860('0x21')](function(_0x2a2465){_0x5b8338[_0xe860('0x44')]=_0x2a2465;return _0x5b8338;})[_0xe860('0x21')](respondWithFilteredResult(_0x1a8a11,_0x4f9a68))[_0xe860('0x45')](handleError(_0x1a8a11,null));};exports['show']=function(_0x3666e8,_0x149511){var _0x221e6e={'raw':!![],'where':{'id':_0x3666e8[_0xe860('0x46')]['id']}},_0x2b31b1={};_0x2b31b1[_0xe860('0x32')]=_[_0xe860('0x47')](db[_0xe860('0x40')][_0xe860('0x2e')]);_0x2b31b1[_0xe860('0x33')]=_[_0xe860('0x47')](_0x3666e8['query']);_0x2b31b1[_0xe860('0x34')]=_['intersection'](_0x2b31b1[_0xe860('0x32')],_0x2b31b1[_0xe860('0x33')]);_0x221e6e[_0xe860('0x35')]=_[_0xe860('0x36')](_0x2b31b1['model'],qs['fields'](_0x3666e8[_0xe860('0x33')][_0xe860('0x37')]));_0x221e6e[_0xe860('0x35')]=_0x221e6e['attributes'][_0xe860('0x48')]?_0x221e6e['attributes']:_0x2b31b1[_0xe860('0x32')];if(_0x3666e8[_0xe860('0x33')]['includeAll']){_0x221e6e['include']=[{'all':!![]}];}_0x221e6e=_[_0xe860('0x3d')]({},_0x221e6e,_0x3666e8[_0xe860('0x49')]);return db[_0xe860('0x40')][_0xe860('0x4a')](_0x221e6e)['then'](handleEntityNotFound(_0x149511,null))[_0xe860('0x21')](respondWithResult(_0x149511,null))[_0xe860('0x45')](handleError(_0x149511,null));};exports[_0xe860('0x4b')]=function(_0x1fea00,_0x11bf0d){return db[_0xe860('0x40')][_0xe860('0x4b')](_0x1fea00[_0xe860('0x4c')],{})[_0xe860('0x21')](function(_0x4abe79){var _0xf9fe99=_0x1fea00[_0xe860('0x4d')][_0xe860('0x23')]({'plain':!![]});if(!_0xf9fe99)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf9fe99[_0xe860('0x4e')]===_0xe860('0x4d')){var _0x3dc338=_0x4abe79[_0xe860('0x23')]({'plain':!![]});var _0x3711b3=_0xe860('0x24');return db[_0xe860('0x4f')][_0xe860('0x4a')]({'where':{'name':_0x3711b3,'userProfileId':_0xf9fe99['userProfileId']},'raw':!![]})[_0xe860('0x21')](function(_0x313915){if(_0x313915&&_0x313915[_0xe860('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x3dc338[_0xe860('0x26')],'resourceId':_0x3dc338['id'],'type':_0x313915[_0xe860('0x26')],'sectionId':_0x313915['id']},{})['then'](function(){return _0x4abe79;});}else{return _0x4abe79;}})['catch'](function(_0x4269eb){logger[_0xe860('0x51')](_0xe860('0x52'),_0x4269eb);throw _0x4269eb;});}return _0x4abe79;})['then'](respondWithResult(_0x11bf0d,0xc9))[_0xe860('0x45')](handleError(_0x11bf0d,null));};exports[_0xe860('0x20')]=function(_0x1a5236,_0x14039a){if(_0x1a5236[_0xe860('0x4c')]['id']){delete _0x1a5236[_0xe860('0x4c')]['id'];}return db[_0xe860('0x40')][_0xe860('0x4a')]({'where':{'id':_0x1a5236[_0xe860('0x46')]['id']}})[_0xe860('0x21')](handleEntityNotFound(_0x14039a,null))[_0xe860('0x21')](saveUpdates(_0x1a5236['body'],null))['then'](respondWithResult(_0x14039a,null))[_0xe860('0x45')](handleError(_0x14039a,null));};exports[_0xe860('0x22')]=function(_0x4b7618,_0x2ff14e){return db[_0xe860('0x40')][_0xe860('0x4a')]({'where':{'id':_0x4b7618['params']['id']}})[_0xe860('0x21')](handleEntityNotFound(_0x2ff14e,null))[_0xe860('0x21')](removeEntity(_0x2ff14e,null))[_0xe860('0x45')](handleError(_0x2ff14e,null));}; \ No newline at end of file +var _0xdfa4=['undefined','limit','apply','reject','save','then','get','Tags','destroy','error','stack','name','merge','contact','message','interaction','account','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','Tag','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','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','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset'];(function(_0x137a23,_0x15f665){var _0x595695=function(_0x5f0836){while(--_0x5f0836){_0x137a23['push'](_0x137a23['shift']());}};_0x595695(++_0x15f665);}(_0xdfa4,0x89));var _0x4dfa=function(_0x29dd31,_0x4c08f6){_0x29dd31=_0x29dd31-0x0;var _0x26e842=_0xdfa4[_0x29dd31];return _0x26e842;};'use strict';var emlformat=require(_0x4dfa('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4dfa('0x1'));var util=require(_0x4dfa('0x2'));var path=require('path');var sox=require(_0x4dfa('0x3'));var csv=require(_0x4dfa('0x4'));var ejs=require(_0x4dfa('0x5'));var fs=require('fs');var fs_extra=require(_0x4dfa('0x6'));var _=require(_0x4dfa('0x7'));var squel=require(_0x4dfa('0x8'));var crypto=require(_0x4dfa('0x9'));var jsforce=require(_0x4dfa('0xa'));var deskjs=require(_0x4dfa('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4dfa('0xc'));var Papa=require(_0x4dfa('0xd'));var Redis=require('ioredis');var authService=require(_0x4dfa('0xe'));var qs=require(_0x4dfa('0xf'));var as=require(_0x4dfa('0x10'));var hardwareService=require(_0x4dfa('0x11'));var logger=require(_0x4dfa('0x12'))(_0x4dfa('0x13'));var utils=require(_0x4dfa('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4dfa('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x570183,_0xba1742){_0xba1742=_0xba1742||0xcc;return function(_0x548a4f){if(_0x548a4f){return _0x570183[_0x4dfa('0x16')](_0xba1742);}return _0x570183['status'](_0xba1742)[_0x4dfa('0x17')]();};}function respondWithResult(_0x53b838,_0x2d1c24){_0x2d1c24=_0x2d1c24||0xc8;return function(_0x4bb550){if(_0x4bb550){return _0x53b838[_0x4dfa('0x18')](_0x2d1c24)[_0x4dfa('0x19')](_0x4bb550);}};}function respondWithFilteredResult(_0x700e32,_0x308beb){return function(_0x24c7fe){if(_0x24c7fe){var _0x3bffd1=typeof _0x308beb[_0x4dfa('0x1a')]===_0x4dfa('0x1b')&&typeof _0x308beb[_0x4dfa('0x1c')]===_0x4dfa('0x1b');var _0x216043=_0x24c7fe['count'];var _0x25bd87=_0x3bffd1?0x0:_0x308beb[_0x4dfa('0x1a')];var _0x3f5664=_0x3bffd1?_0x24c7fe['count']:_0x308beb[_0x4dfa('0x1a')]+_0x308beb[_0x4dfa('0x1c')];var _0x154541;if(_0x3f5664>=_0x216043){_0x3f5664=_0x216043;_0x154541=0xc8;}else{_0x154541=0xce;}_0x700e32[_0x4dfa('0x18')](_0x154541);return _0x700e32['set']('Content-Range',_0x25bd87+'-'+_0x3f5664+'/'+_0x216043)[_0x4dfa('0x19')](_0x24c7fe);}return null;};}function patchUpdates(_0xb2f6ed){return function(_0x295d6c){try{jsonpatch[_0x4dfa('0x1d')](_0x295d6c,_0xb2f6ed,!![]);}catch(_0x41d522){return BPromise[_0x4dfa('0x1e')](_0x41d522);}return _0x295d6c[_0x4dfa('0x1f')]();};}function saveUpdates(_0x4ab11b,_0x294905){return function(_0x496a8b){if(_0x496a8b){return _0x496a8b['update'](_0x4ab11b)[_0x4dfa('0x20')](function(_0xc6bf48){return _0xc6bf48;});}return null;};}function removeEntity(_0x5d94fb,_0xdb908f){return function(_0x1cb389){if(_0x1cb389){return _0x1cb389['destroy']()[_0x4dfa('0x20')](function(){var _0x35cc0b=_0x1cb389[_0x4dfa('0x21')]({'plain':!![]});var _0x51f86d=_0x4dfa('0x22');return db['UserProfileResource'][_0x4dfa('0x23')]({'where':{'type':_0x51f86d,'resourceId':_0x35cc0b['id']}})[_0x4dfa('0x20')](function(){return _0x1cb389;});})['then'](function(){_0x5d94fb[_0x4dfa('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c40d0,_0x2af126){return function(_0x2606fa){if(!_0x2606fa){_0x3c40d0[_0x4dfa('0x16')](0x194);}return _0x2606fa;};}function handleError(_0x7b1fa4,_0x1d5385){_0x1d5385=_0x1d5385||0x1f4;return function(_0x18106d){logger[_0x4dfa('0x24')](_0x18106d[_0x4dfa('0x25')]);if(_0x18106d[_0x4dfa('0x26')]){delete _0x18106d[_0x4dfa('0x26')];}_0x7b1fa4[_0x4dfa('0x18')](_0x1d5385)['send'](_0x18106d);};}function getMustacheRender(_0x482910,_0x9d7d6f){return Mustache['render'](_0x482910,_[_0x4dfa('0x27')](_0x9d7d6f['body'],{'contact':_0x9d7d6f[_0x4dfa('0x28')],'message':_0x9d7d6f[_0x4dfa('0x29')],'agent':_0x9d7d6f['agent'],'interaction':_0x9d7d6f[_0x4dfa('0x2a')],'account':_0x9d7d6f[_0x4dfa('0x2b')]}))||'';}exports[_0x4dfa('0x2c')]=function(_0xccf576,_0x227d63){var _0x6969de={},_0x431cdd={},_0x5735ed={'count':0x0,'rows':[]};var _0x51d0a5=_[_0x4dfa('0x2d')](db['Tag'][_0x4dfa('0x2e')],function(_0xfcd942){return{'name':_0xfcd942[_0x4dfa('0x2f')],'type':_0xfcd942[_0x4dfa('0x30')]['key']};});_0x431cdd['model']=_[_0x4dfa('0x2d')](_0x51d0a5,_0x4dfa('0x26'));_0x431cdd[_0x4dfa('0x31')]=_[_0x4dfa('0x32')](_0xccf576[_0x4dfa('0x31')]);_0x431cdd[_0x4dfa('0x33')]=_[_0x4dfa('0x34')](_0x431cdd[_0x4dfa('0x35')],_0x431cdd[_0x4dfa('0x31')]);_0x6969de[_0x4dfa('0x36')]=_[_0x4dfa('0x34')](_0x431cdd[_0x4dfa('0x35')],qs[_0x4dfa('0x37')](_0xccf576['query'][_0x4dfa('0x37')]));_0x6969de[_0x4dfa('0x36')]=_0x6969de[_0x4dfa('0x36')][_0x4dfa('0x38')]?_0x6969de[_0x4dfa('0x36')]:_0x431cdd[_0x4dfa('0x35')];if(!_0xccf576[_0x4dfa('0x31')][_0x4dfa('0x39')](_0x4dfa('0x3a'))){_0x6969de[_0x4dfa('0x1c')]=qs[_0x4dfa('0x1c')](_0xccf576['query'][_0x4dfa('0x1c')]);_0x6969de[_0x4dfa('0x1a')]=qs[_0x4dfa('0x1a')](_0xccf576[_0x4dfa('0x31')][_0x4dfa('0x1a')]);}_0x6969de['order']=qs[_0x4dfa('0x3b')](_0xccf576['query'][_0x4dfa('0x3b')]);_0x6969de[_0x4dfa('0x3c')]=qs[_0x4dfa('0x33')](_['pick'](_0xccf576[_0x4dfa('0x31')],_0x431cdd[_0x4dfa('0x33')]),_0x51d0a5);if(_0xccf576['query'][_0x4dfa('0x3d')]){_0x6969de[_0x4dfa('0x3c')]=_[_0x4dfa('0x27')](_0x6969de[_0x4dfa('0x3c')],{'$or':_['map'](_0x51d0a5,function(_0x525cae){if(_0x525cae['type']!==_0x4dfa('0x3e')){var _0x382aab={};_0x382aab[_0x525cae['name']]={'$like':'%'+_0xccf576['query'][_0x4dfa('0x3d')]+'%'};return _0x382aab;}})});}_0x6969de=_['merge']({},_0x6969de,_0xccf576['options']);var _0x549bd6={'where':_0x6969de['where']};return db['Tag'][_0x4dfa('0x3f')](_0x549bd6)[_0x4dfa('0x20')](function(_0x54119d){_0x5735ed[_0x4dfa('0x3f')]=_0x54119d;if(_0xccf576[_0x4dfa('0x31')][_0x4dfa('0x40')]){_0x6969de[_0x4dfa('0x41')]=[{'all':!![]}];}return db['Tag'][_0x4dfa('0x42')](_0x6969de);})[_0x4dfa('0x20')](function(_0x18d15a){_0x5735ed[_0x4dfa('0x43')]=_0x18d15a;return _0x5735ed;})[_0x4dfa('0x20')](respondWithFilteredResult(_0x227d63,_0x6969de))[_0x4dfa('0x44')](handleError(_0x227d63,null));};exports['show']=function(_0x3c639b,_0x5e09f7){var _0xe2a00f={'raw':!![],'where':{'id':_0x3c639b[_0x4dfa('0x45')]['id']}},_0x458eff={};_0x458eff[_0x4dfa('0x35')]=_[_0x4dfa('0x32')](db[_0x4dfa('0x46')][_0x4dfa('0x2e')]);_0x458eff[_0x4dfa('0x31')]=_[_0x4dfa('0x32')](_0x3c639b['query']);_0x458eff[_0x4dfa('0x33')]=_['intersection'](_0x458eff['model'],_0x458eff[_0x4dfa('0x31')]);_0xe2a00f['attributes']=_[_0x4dfa('0x34')](_0x458eff[_0x4dfa('0x35')],qs[_0x4dfa('0x37')](_0x3c639b[_0x4dfa('0x31')][_0x4dfa('0x37')]));_0xe2a00f['attributes']=_0xe2a00f[_0x4dfa('0x36')][_0x4dfa('0x38')]?_0xe2a00f['attributes']:_0x458eff[_0x4dfa('0x35')];if(_0x3c639b[_0x4dfa('0x31')][_0x4dfa('0x40')]){_0xe2a00f[_0x4dfa('0x41')]=[{'all':!![]}];}_0xe2a00f=_['merge']({},_0xe2a00f,_0x3c639b['options']);return db[_0x4dfa('0x46')]['find'](_0xe2a00f)[_0x4dfa('0x20')](handleEntityNotFound(_0x5e09f7,null))[_0x4dfa('0x20')](respondWithResult(_0x5e09f7,null))['catch'](handleError(_0x5e09f7,null));};exports[_0x4dfa('0x47')]=function(_0x5adf7c,_0x57de4e){return db[_0x4dfa('0x46')][_0x4dfa('0x47')](_0x5adf7c[_0x4dfa('0x48')],{})[_0x4dfa('0x20')](function(_0x2832a1){var _0x203d2c=_0x5adf7c[_0x4dfa('0x49')][_0x4dfa('0x21')]({'plain':!![]});if(!_0x203d2c)throw new Error(_0x4dfa('0x4a'));if(_0x203d2c[_0x4dfa('0x4b')]===_0x4dfa('0x49')){var _0x4a6434=_0x2832a1[_0x4dfa('0x21')]({'plain':!![]});var _0x40839c=_0x4dfa('0x22');return db['UserProfileSection'][_0x4dfa('0x4c')]({'where':{'name':_0x40839c,'userProfileId':_0x203d2c[_0x4dfa('0x4d')]},'raw':!![]})[_0x4dfa('0x20')](function(_0x16e86e){if(_0x16e86e&&_0x16e86e[_0x4dfa('0x4e')]===0x0){return db[_0x4dfa('0x4f')]['create']({'name':_0x4a6434[_0x4dfa('0x26')],'resourceId':_0x4a6434['id'],'type':_0x16e86e['name'],'sectionId':_0x16e86e['id']},{})[_0x4dfa('0x20')](function(){return _0x2832a1;});}else{return _0x2832a1;}})[_0x4dfa('0x44')](function(_0x4fbe12){logger[_0x4dfa('0x24')](_0x4dfa('0x50'),_0x4fbe12);throw _0x4fbe12;});}return _0x2832a1;})[_0x4dfa('0x20')](respondWithResult(_0x57de4e,0xc9))[_0x4dfa('0x44')](handleError(_0x57de4e,null));};exports[_0x4dfa('0x51')]=function(_0x9bce50,_0x30357d){if(_0x9bce50['body']['id']){delete _0x9bce50['body']['id'];}return db[_0x4dfa('0x46')][_0x4dfa('0x4c')]({'where':{'id':_0x9bce50[_0x4dfa('0x45')]['id']}})[_0x4dfa('0x20')](handleEntityNotFound(_0x30357d,null))[_0x4dfa('0x20')](saveUpdates(_0x9bce50[_0x4dfa('0x48')],null))[_0x4dfa('0x20')](respondWithResult(_0x30357d,null))[_0x4dfa('0x44')](handleError(_0x30357d,null));};exports['destroy']=function(_0x48914d,_0x1c54f3){return db[_0x4dfa('0x46')][_0x4dfa('0x4c')]({'where':{'id':_0x48914d['params']['id']}})[_0x4dfa('0x20')](handleEntityNotFound(_0x1c54f3,null))[_0x4dfa('0x20')](removeEntity(_0x1c54f3,null))['catch'](handleError(_0x1c54f3,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index e4f50b3..e7f508f 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 _0x40cb=['api','moment','rimraf','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x40cb,0x105));var _0xb40c=function(_0x30e667,_0x4e4702){_0x30e667=_0x30e667-0x0;var _0x3b4b40=_0x40cb[_0x30e667];return _0x3b4b40;};'use strict';var _=require(_0xb40c('0x0'));var util=require(_0xb40c('0x1'));var logger=require(_0xb40c('0x2'))(_0xb40c('0x3'));var moment=require(_0xb40c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb40c('0x5'));var config=require('../../config/environment');var attributes=require(_0xb40c('0x6'));module[_0xb40c('0x7')]=function(_0xf28b4f,_0xfe8ac0){return _0xf28b4f[_0xb40c('0x8')](_0xb40c('0x9'),attributes,{'tableName':_0xb40c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb30e=['path','rimraf','../../config/environment','./tag.attributes','exports','define','tools_tags','util','../../config/logger','api','bluebird'];(function(_0x5e6935,_0x23d0a4){var _0x5498f9=function(_0x592401){while(--_0x592401){_0x5e6935['push'](_0x5e6935['shift']());}};_0x5498f9(++_0x23d0a4);}(_0xb30e,0x17d));var _0xeb30=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb30e[_0x4ea69d];return _0x5318e0;};'use strict';var _=require('lodash');var util=require(_0xeb30('0x0'));var logger=require(_0xeb30('0x1'))(_0xeb30('0x2'));var moment=require('moment');var BPromise=require(_0xeb30('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb30('0x4'));var rimraf=require(_0xeb30('0x5'));var config=require(_0xeb30('0x6'));var attributes=require(_0xeb30('0x7'));module[_0xeb30('0x8')]=function(_0x41c661,_0x2616d0){return _0x41c661[_0xeb30('0x9')]('Tag',attributes,{'tableName':_0xeb30('0xa'),'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 0e42c52..afae309 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 _0x2547=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0x2547,0x1cd));var _0x7254=function(_0x4d49b4,_0x26f988){_0x4d49b4=_0x4d49b4-0x0;var _0x361c36=_0x2547[_0x4d49b4];return _0x361c36;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var moment=require(_0x7254('0x1'));var BPromise=require(_0x7254('0x2'));var rs=require(_0x7254('0x3'));var fs=require('fs');var Redis=require(_0x7254('0x4'));var db=require(_0x7254('0x5'))['db'];var utils=require(_0x7254('0x6'));var logger=require(_0x7254('0x7'))('rpc');var config=require(_0x7254('0x8'));var jayson=require(_0x7254('0x9'));var client=jayson[_0x7254('0xa')][_0x7254('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b845f,_0x253b1e,_0x6e3d84){return new BPromise(function(_0x395913,_0x5da1ec){return client[_0x7254('0xc')](_0x4b845f,_0x6e3d84)['then'](function(_0x50925f){logger['info'](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));logger[_0x7254('0xf')](_0x7254('0x10'),_0x253b1e,_0x7254('0xe'),JSON[_0x7254('0x11')](_0x50925f));if(_0x50925f['error']){if(_0x50925f[_0x7254('0x12')]['code']===0x1f4){logger[_0x7254('0x12')]('Tag,\x20%s,\x20%s',_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x5da1ec(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x395913(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}else{logger[_0x7254('0x14')](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));_0x395913(_0x50925f['result'][_0x7254('0x13')]);}})[_0x7254('0x15')](function(_0xf47255){logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0xf47255);_0x5da1ec(_0xf47255);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xda3f,0xec));var _0xfda3=function(_0x33de24,_0x120bbc){_0x33de24=_0x33de24-0x0;var _0x1980c4=_0xda3f[_0x33de24];return _0x1980c4;};'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')]('Tag,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('Tag,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('Tag,\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 diff --git a/server/api/team/index.js b/server/api/team/index.js index fa82fe9..b2634fe 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 _0x1fce=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','show','isAuthenticated','getAgents','post','create','addQueues','/:id/users','addAgents','put','update','delete','destroy','removeQueues','removeAgents','exports','multer'];(function(_0x44ab8c,_0x185623){var _0x360567=function(_0x751c63){while(--_0x751c63){_0x44ab8c['push'](_0x44ab8c['shift']());}};_0x360567(++_0x185623);}(_0x1fce,0xcf));var _0xe1fc=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x1fce[_0xf51c06];return _0x1d5420;};'use strict';var multer=require(_0xe1fc('0x0'));var util=require(_0xe1fc('0x1'));var path=require(_0xe1fc('0x2'));var timeout=require(_0xe1fc('0x3'));var express=require(_0xe1fc('0x4'));var router=express[_0xe1fc('0x5')]();var fs_extra=require(_0xe1fc('0x6'));var auth=require(_0xe1fc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe1fc('0x8'));var controller=require('./team.controller');router[_0xe1fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe1fc('0x9')](_0xe1fc('0xa'),auth['isAuthenticated'](),controller[_0xe1fc('0xb')]);router[_0xe1fc('0x9')]('/:id/queues',auth[_0xe1fc('0xc')](),controller['getQueues']);router['get']('/:id/users',auth[_0xe1fc('0xc')](),controller[_0xe1fc('0xd')]);router[_0xe1fc('0xe')]('/',auth[_0xe1fc('0xc')](),controller[_0xe1fc('0xf')]);router[_0xe1fc('0xe')]('/:id/queues',auth[_0xe1fc('0xc')](),controller[_0xe1fc('0x10')]);router['post'](_0xe1fc('0x11'),auth[_0xe1fc('0xc')](),controller[_0xe1fc('0x12')]);router[_0xe1fc('0x13')](_0xe1fc('0xa'),auth[_0xe1fc('0xc')](),controller[_0xe1fc('0x14')]);router[_0xe1fc('0x15')](_0xe1fc('0xa'),auth[_0xe1fc('0xc')](),controller[_0xe1fc('0x16')]);router[_0xe1fc('0x15')]('/:id/queues',auth['isAuthenticated'](),controller[_0xe1fc('0x17')]);router[_0xe1fc('0x15')](_0xe1fc('0x11'),auth[_0xe1fc('0xc')](),controller[_0xe1fc('0x18')]);module[_0xe1fc('0x19')]=router; \ No newline at end of file +var _0x0ab8=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/users','getAgents','create','addQueues','post','addAgents','put','update','destroy','removeQueues','delete','removeAgents','exports','multer','util'];(function(_0x136a01,_0x3e0f10){var _0x39ccee=function(_0x1fa530){while(--_0x1fa530){_0x136a01['push'](_0x136a01['shift']());}};_0x39ccee(++_0x3e0f10);}(_0x0ab8,0x19e));var _0x80ab=function(_0x22da8f,_0x28c918){_0x22da8f=_0x22da8f-0x0;var _0x3506b8=_0x0ab8[_0x22da8f];return _0x3506b8;};'use strict';var multer=require(_0x80ab('0x0'));var util=require(_0x80ab('0x1'));var path=require(_0x80ab('0x2'));var timeout=require('connect-timeout');var express=require(_0x80ab('0x3'));var router=express[_0x80ab('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x80ab('0x5'));var interaction=require(_0x80ab('0x6'));var config=require(_0x80ab('0x7'));var controller=require('./team.controller');router[_0x80ab('0x8')]('/',auth[_0x80ab('0x9')](),controller[_0x80ab('0xa')]);router[_0x80ab('0x8')](_0x80ab('0xb'),auth[_0x80ab('0x9')](),controller[_0x80ab('0xc')]);router[_0x80ab('0x8')]('/:id/queues',auth[_0x80ab('0x9')](),controller['getQueues']);router[_0x80ab('0x8')](_0x80ab('0xd'),auth[_0x80ab('0x9')](),controller[_0x80ab('0xe')]);router['post']('/',auth[_0x80ab('0x9')](),controller[_0x80ab('0xf')]);router['post']('/:id/queues',auth[_0x80ab('0x9')](),controller[_0x80ab('0x10')]);router[_0x80ab('0x11')](_0x80ab('0xd'),auth[_0x80ab('0x9')](),controller[_0x80ab('0x12')]);router[_0x80ab('0x13')](_0x80ab('0xb'),auth[_0x80ab('0x9')](),controller[_0x80ab('0x14')]);router['delete'](_0x80ab('0xb'),auth[_0x80ab('0x9')](),controller[_0x80ab('0x15')]);router['delete']('/:id/queues',auth[_0x80ab('0x9')](),controller[_0x80ab('0x16')]);router[_0x80ab('0x17')](_0x80ab('0xd'),auth[_0x80ab('0x9')](),controller[_0x80ab('0x18')]);module[_0x80ab('0x19')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index f2427dd..0207f26 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 _0x05e5=['name','STRING'];(function(_0x355e8e,_0x4313f0){var _0x52cb43=function(_0x2feb45){while(--_0x2feb45){_0x355e8e['push'](_0x355e8e['shift']());}};_0x52cb43(++_0x4313f0);}(_0x05e5,0x6e));var _0x505e=function(_0xac7e76,_0x1fa476){_0xac7e76=_0xac7e76-0x0;var _0x51bf57=_0x05e5[_0xac7e76];return _0x51bf57;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x505e('0x0')},'description':{'type':Sequelize[_0x505e('0x1')]}}; \ No newline at end of file +var _0x3d67=['STRING','sequelize'];(function(_0x2ec7e1,_0x339623){var _0x5dc254=function(_0x4a6394){while(--_0x4a6394){_0x2ec7e1['push'](_0x2ec7e1['shift']());}};_0x5dc254(++_0x339623);}(_0x3d67,0x13f));var _0x73d6=function(_0x5d984e,_0x40be4c){_0x5d984e=_0x5d984e-0x0;var _0x77fe9a=_0x3d67[_0x5d984e];return _0x77fe9a;};'use strict';var Sequelize=require(_0x73d6('0x0'));module['exports']={'name':{'type':Sequelize[_0x73d6('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 926e648..fbd0a64 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 _0x7024=['Mail','Sms','Fax','Whatsapp','transaction','Voice','through','QueueId','defaults','TeamVoiceQueue','penalty','User','findOrCreate','emit','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','all','spread','Openchannel','sequelize','removeAgents','parse','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','localhost','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Teams','UserProfileResource','error','stack','name','send','render','merge','body','agent','interaction','account','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','getQueues','findOne','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','isValidChannel','add','Queues','ids','removeQueues','remove','addAgents','Chat'];(function(_0x14f5c3,_0x1e3047){var _0x2ea070=function(_0x1c8cd4){while(--_0x1c8cd4){_0x14f5c3['push'](_0x14f5c3['shift']());}};_0x2ea070(++_0x1e3047);}(_0x7024,0xa1));var _0x4702=function(_0xb6efef,_0xbcb462){_0xb6efef=_0xb6efef-0x0;var _0x4825b7=_0x7024[_0xb6efef];return _0x4825b7;};'use strict';var emlformat=require(_0x4702('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4702('0x1'));var jsonpatch=require(_0x4702('0x2'));var rp=require(_0x4702('0x3'));var moment=require(_0x4702('0x4'));var BPromise=require(_0x4702('0x5'));var Mustache=require('mustache');var util=require(_0x4702('0x6'));var path=require('path');var sox=require(_0x4702('0x7'));var csv=require(_0x4702('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4702('0x9'));var _=require(_0x4702('0xa'));var squel=require(_0x4702('0xb'));var crypto=require(_0x4702('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4702('0xd'));var Papa=require(_0x4702('0xe'));var Redis=require(_0x4702('0xf'));var authService=require(_0x4702('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4702('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4702('0x12'))(_0x4702('0x13'));var utils=require('../../config/utils');var config=require(_0x4702('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4702('0x15')]=_['defaults'](config[_0x4702('0x15')],{'host':_0x4702('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4702('0x15')]));require('./team.socket')[_0x4702('0x17')](socket);function respondWithStatusCode(_0x4099b0,_0xdcb574){_0xdcb574=_0xdcb574||0xcc;return function(_0x163f37){if(_0x163f37){return _0x4099b0[_0x4702('0x18')](_0xdcb574);}return _0x4099b0[_0x4702('0x19')](_0xdcb574)[_0x4702('0x1a')]();};}function respondWithResult(_0x3b679b,_0x3e5f32){_0x3e5f32=_0x3e5f32||0xc8;return function(_0x28f50b){if(_0x28f50b){return _0x3b679b[_0x4702('0x19')](_0x3e5f32)['json'](_0x28f50b);}};}function respondWithFilteredResult(_0x5a94ea,_0x462fe1){return function(_0x5e0bf7){if(_0x5e0bf7){var _0x5d7c34=typeof _0x462fe1['offset']===_0x4702('0x1b')&&typeof _0x462fe1[_0x4702('0x1c')]===_0x4702('0x1b');var _0x3bbe65=_0x5e0bf7[_0x4702('0x1d')];var _0x586db9=_0x5d7c34?0x0:_0x462fe1['offset'];var _0x261ca1=_0x5d7c34?_0x5e0bf7[_0x4702('0x1d')]:_0x462fe1[_0x4702('0x1e')]+_0x462fe1['limit'];var _0xf30254;if(_0x261ca1>=_0x3bbe65){_0x261ca1=_0x3bbe65;_0xf30254=0xc8;}else{_0xf30254=0xce;}_0x5a94ea[_0x4702('0x19')](_0xf30254);return _0x5a94ea[_0x4702('0x1f')](_0x4702('0x20'),_0x586db9+'-'+_0x261ca1+'/'+_0x3bbe65)[_0x4702('0x21')](_0x5e0bf7);}return null;};}function patchUpdates(_0x22b2ee){return function(_0x1818e0){try{jsonpatch[_0x4702('0x22')](_0x1818e0,_0x22b2ee,!![]);}catch(_0x11ecf9){return BPromise[_0x4702('0x23')](_0x11ecf9);}return _0x1818e0[_0x4702('0x24')]();};}function saveUpdates(_0x2fff0b,_0x180f36){return function(_0x36f5d4){if(_0x36f5d4){return _0x36f5d4[_0x4702('0x25')](_0x2fff0b)['then'](function(_0x5401b8){return _0x5401b8;});}return null;};}function removeEntity(_0x3ddf64,_0x59be2d){return function(_0x32d0e9){if(_0x32d0e9){return _0x32d0e9[_0x4702('0x26')]()[_0x4702('0x27')](function(){var _0xaa8067=_0x32d0e9[_0x4702('0x28')]({'plain':!![]});var _0x470ded=_0x4702('0x29');return db[_0x4702('0x2a')][_0x4702('0x26')]({'where':{'type':_0x470ded,'resourceId':_0xaa8067['id']}})['then'](function(){return _0x32d0e9;});})[_0x4702('0x27')](function(){_0x3ddf64[_0x4702('0x19')](0xcc)[_0x4702('0x1a')]();});}};}function handleEntityNotFound(_0x44e08d,_0xb8e9a6){return function(_0xcaf663){if(!_0xcaf663){_0x44e08d[_0x4702('0x18')](0x194);}return _0xcaf663;};}function handleError(_0x184303,_0x86cde3){_0x86cde3=_0x86cde3||0x1f4;return function(_0x72cc33){logger[_0x4702('0x2b')](_0x72cc33[_0x4702('0x2c')]);if(_0x72cc33['name']){delete _0x72cc33[_0x4702('0x2d')];}_0x184303[_0x4702('0x19')](_0x86cde3)[_0x4702('0x2e')](_0x72cc33);};}function getMustacheRender(_0x2cf80e,_0x138e05){return Mustache[_0x4702('0x2f')](_0x2cf80e,_[_0x4702('0x30')](_0x138e05[_0x4702('0x31')],{'contact':_0x138e05['contact'],'message':_0x138e05['message'],'agent':_0x138e05[_0x4702('0x32')],'interaction':_0x138e05[_0x4702('0x33')],'account':_0x138e05[_0x4702('0x34')]}))||'';}exports[_0x4702('0x35')]=function(_0x4b69f9,_0x1b11b8){var _0x5ca009={},_0x2159d9={},_0x401405={'count':0x0,'rows':[]};var _0x4c69aa=_[_0x4702('0x36')](db[_0x4702('0x37')][_0x4702('0x38')],function(_0xfd5819){return{'name':_0xfd5819[_0x4702('0x39')],'type':_0xfd5819[_0x4702('0x3a')][_0x4702('0x3b')]};});_0x2159d9[_0x4702('0x3c')]=_['map'](_0x4c69aa,'name');_0x2159d9[_0x4702('0x3d')]=_[_0x4702('0x3e')](_0x4b69f9['query']);_0x2159d9[_0x4702('0x3f')]=_[_0x4702('0x40')](_0x2159d9['model'],_0x2159d9['query']);_0x5ca009[_0x4702('0x41')]=_['intersection'](_0x2159d9['model'],qs[_0x4702('0x42')](_0x4b69f9[_0x4702('0x3d')]['fields']));_0x5ca009[_0x4702('0x41')]=_0x5ca009[_0x4702('0x41')][_0x4702('0x43')]?_0x5ca009[_0x4702('0x41')]:_0x2159d9['model'];if(!_0x4b69f9['query'][_0x4702('0x44')]('nolimit')){_0x5ca009['limit']=qs['limit'](_0x4b69f9[_0x4702('0x3d')][_0x4702('0x1c')]);_0x5ca009[_0x4702('0x1e')]=qs[_0x4702('0x1e')](_0x4b69f9['query'][_0x4702('0x1e')]);}_0x5ca009[_0x4702('0x45')]=qs[_0x4702('0x46')](_0x4b69f9['query'][_0x4702('0x46')]);_0x5ca009[_0x4702('0x47')]=qs[_0x4702('0x3f')](_[_0x4702('0x48')](_0x4b69f9['query'],_0x2159d9[_0x4702('0x3f')]),_0x4c69aa);if(_0x4b69f9[_0x4702('0x3d')][_0x4702('0x49')]){_0x5ca009['where']=_[_0x4702('0x30')](_0x5ca009[_0x4702('0x47')],{'$or':_[_0x4702('0x36')](_0x4c69aa,function(_0x13ea5a){if(_0x13ea5a[_0x4702('0x3a')]!==_0x4702('0x4a')){var _0x1775a0={};_0x1775a0[_0x13ea5a['name']]={'$like':'%'+_0x4b69f9[_0x4702('0x3d')]['filter']+'%'};return _0x1775a0;}})});}_0x5ca009=_['merge']({},_0x5ca009,_0x4b69f9[_0x4702('0x4b')]);var _0x1aed8a={'where':_0x5ca009[_0x4702('0x47')]};return db['Team'][_0x4702('0x1d')](_0x1aed8a)[_0x4702('0x27')](function(_0x3ed891){_0x401405[_0x4702('0x1d')]=_0x3ed891;if(_0x4b69f9['query'][_0x4702('0x4c')]){_0x5ca009['include']=[{'all':!![]}];}return db['Team'][_0x4702('0x4d')](_0x5ca009);})[_0x4702('0x27')](function(_0x3f7d0a){_0x401405[_0x4702('0x4e')]=_0x3f7d0a;return _0x401405;})[_0x4702('0x27')](respondWithFilteredResult(_0x1b11b8,_0x5ca009))[_0x4702('0x4f')](handleError(_0x1b11b8,null));};exports[_0x4702('0x50')]=function(_0x23270e,_0x5b0085){var _0x1b7c2f={'raw':![],'where':{'id':_0x23270e[_0x4702('0x51')]['id']}},_0x5730c4={};_0x5730c4[_0x4702('0x3c')]=_[_0x4702('0x3e')](db[_0x4702('0x37')][_0x4702('0x38')]);_0x5730c4[_0x4702('0x3d')]=_[_0x4702('0x3e')](_0x23270e[_0x4702('0x3d')]);_0x5730c4[_0x4702('0x3f')]=_[_0x4702('0x40')](_0x5730c4[_0x4702('0x3c')],_0x5730c4[_0x4702('0x3d')]);_0x1b7c2f['attributes']=_[_0x4702('0x40')](_0x5730c4[_0x4702('0x3c')],qs[_0x4702('0x42')](_0x23270e[_0x4702('0x3d')][_0x4702('0x42')]));_0x1b7c2f[_0x4702('0x41')]=_0x1b7c2f['attributes'][_0x4702('0x43')]?_0x1b7c2f[_0x4702('0x41')]:_0x5730c4['model'];if(_0x23270e['query'][_0x4702('0x4c')]){_0x1b7c2f[_0x4702('0x52')]=[{'all':!![]}];}_0x1b7c2f=_[_0x4702('0x30')]({},_0x1b7c2f,_0x23270e['options']);return db[_0x4702('0x37')]['find'](_0x1b7c2f)[_0x4702('0x27')](handleEntityNotFound(_0x5b0085,null))[_0x4702('0x27')](respondWithResult(_0x5b0085,null))['catch'](handleError(_0x5b0085,null));};exports[_0x4702('0x53')]=function(_0x3aff2d,_0x14fec1){return db[_0x4702('0x37')][_0x4702('0x53')](_0x3aff2d[_0x4702('0x31')],{})['then'](function(_0x4f73d5){var _0x753ba7=_0x3aff2d[_0x4702('0x54')][_0x4702('0x28')]({'plain':!![]});if(!_0x753ba7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x753ba7[_0x4702('0x55')]===_0x4702('0x54')){var _0x27a051=_0x4f73d5[_0x4702('0x28')]({'plain':!![]});var _0x4c7f38='Teams';return db['UserProfileSection']['find']({'where':{'name':_0x4c7f38,'userProfileId':_0x753ba7['userProfileId']},'raw':!![]})[_0x4702('0x27')](function(_0x598e68){if(_0x598e68&&_0x598e68[_0x4702('0x56')]===0x0){return db[_0x4702('0x2a')][_0x4702('0x53')]({'name':_0x27a051[_0x4702('0x2d')],'resourceId':_0x27a051['id'],'type':_0x598e68['name'],'sectionId':_0x598e68['id']},{})['then'](function(){return _0x4f73d5;});}else{return _0x4f73d5;}})[_0x4702('0x4f')](function(_0x3f2fca){logger[_0x4702('0x2b')](_0x4702('0x57'),_0x3f2fca);throw _0x3f2fca;});}return _0x4f73d5;})[_0x4702('0x27')](respondWithResult(_0x14fec1,0xc9))[_0x4702('0x4f')](handleError(_0x14fec1,null));};exports['update']=function(_0x95500f,_0x5c71d3){if(_0x95500f['body']['id']){delete _0x95500f['body']['id'];}return db['Team'][_0x4702('0x58')]({'where':{'id':_0x95500f[_0x4702('0x51')]['id']}})['then'](handleEntityNotFound(_0x5c71d3,null))['then'](saveUpdates(_0x95500f[_0x4702('0x31')],null))['then'](respondWithResult(_0x5c71d3,null))['catch'](handleError(_0x5c71d3,null));};exports[_0x4702('0x26')]=function(_0x583220,_0x496da2){return db[_0x4702('0x37')][_0x4702('0x58')]({'where':{'id':_0x583220[_0x4702('0x51')]['id']}})[_0x4702('0x27')](handleEntityNotFound(_0x496da2,null))['then'](removeEntity(_0x496da2,null))[_0x4702('0x4f')](handleError(_0x496da2,null));};exports[_0x4702('0x59')]=function(_0x372403,_0x1bae59,_0x13fdf2){return db[_0x4702('0x37')][_0x4702('0x5a')]({'where':{'id':_0x372403[_0x4702('0x51')]['id']}})['then'](handleEntityNotFound(_0x1bae59,null))[_0x4702('0x27')](function(_0x425a85){if(!_0x372403[_0x4702('0x3d')][_0x4702('0x5b')]||!utils['isValidChannel'](_0x372403[_0x4702('0x3d')][_0x4702('0x5b')])){throw new db[(_0x4702('0x5c'))][(_0x4702('0x5d'))](_0x4702('0x5e'));}var _0x718a3b={};var _0x1662dc={};_0x1662dc[_0x4702('0x3c')]=_['keys'](db[_[_0x4702('0x5f')](_0x372403[_0x4702('0x3d')][_0x4702('0x5b')][_0x4702('0x60')]())+_0x4702('0x61')][_0x4702('0x38')]);_0x1662dc['query']=_['keys'](_0x372403[_0x4702('0x3d')]);_0x1662dc[_0x4702('0x3f')]=_[_0x4702('0x40')](_0x1662dc[_0x4702('0x3c')],_0x1662dc[_0x4702('0x3d')]);_0x718a3b['attributes']=_['intersection'](_0x1662dc[_0x4702('0x3c')],qs[_0x4702('0x42')](_0x372403[_0x4702('0x3d')]['fields']));_0x718a3b[_0x4702('0x41')]=_0x718a3b[_0x4702('0x41')][_0x4702('0x43')]?_0x718a3b[_0x4702('0x41')]:_0x1662dc[_0x4702('0x3c')];_0x718a3b[_0x4702('0x1c')]=qs[_0x4702('0x1c')](_0x372403[_0x4702('0x3d')][_0x4702('0x1c')]);_0x718a3b[_0x4702('0x1e')]=qs['offset'](_0x372403[_0x4702('0x3d')][_0x4702('0x1e')]);_0x718a3b[_0x4702('0x45')]=qs[_0x4702('0x46')](_0x372403[_0x4702('0x3d')][_0x4702('0x46')]);_0x718a3b[_0x4702('0x47')]=qs[_0x4702('0x3f')](_['pick'](_0x372403[_0x4702('0x3d')],_0x1662dc[_0x4702('0x3f')]));_0x718a3b=_[_0x4702('0x30')]({},_0x718a3b,_0x372403['options']);return _0x425a85['get'+_['capitalize'](_0x372403[_0x4702('0x3d')][_0x4702('0x5b')][_0x4702('0x60')]())+'Queues'](_0x718a3b);})[_0x4702('0x27')](respondWithResult(_0x1bae59,null))['catch'](handleError(_0x1bae59,null));};exports[_0x4702('0x62')]=function(_0xf29cad,_0x5dee86,_0x2e3085){return db[_0x4702('0x37')][_0x4702('0x5a')]({'where':{'id':_0xf29cad['params']['id']}})['then'](function(_0xb5d29b){if(_0xb5d29b){if(!_0xf29cad[_0x4702('0x31')]['channel']||!utils[_0x4702('0x63')](_0xf29cad[_0x4702('0x31')][_0x4702('0x5b')])){throw new db[(_0x4702('0x5c'))]['ValidationError'](_0x4702('0x5e'));}return _0xb5d29b[_0x4702('0x64')+_['capitalize'](_0xf29cad[_0x4702('0x31')][_0x4702('0x5b')]['toLowerCase']())+_0x4702('0x65')](_0xf29cad['body'][_0x4702('0x66')]);}return null;})[_0x4702('0x27')](handleEntityNotFound(_0x5dee86,null))[_0x4702('0x27')](respondWithStatusCode(_0x5dee86,null))[_0x4702('0x4f')](handleError(_0x5dee86,null));};exports[_0x4702('0x67')]=function(_0x361c33,_0x2cd6ca,_0x188f95){return db['Team'][_0x4702('0x5a')]({'where':{'id':_0x361c33[_0x4702('0x51')]['id']}})[_0x4702('0x27')](function(_0x584069){if(_0x584069){if(!_0x361c33[_0x4702('0x3d')][_0x4702('0x5b')]||!utils[_0x4702('0x63')](_0x361c33[_0x4702('0x3d')][_0x4702('0x5b')])){throw new db[(_0x4702('0x5c'))][(_0x4702('0x5d'))]('Unknown\x20channel');}return _0x584069[_0x4702('0x68')+_[_0x4702('0x5f')](_0x361c33[_0x4702('0x3d')][_0x4702('0x5b')]['toLowerCase']())+_0x4702('0x65')](_0x361c33[_0x4702('0x3d')][_0x4702('0x66')]);}return null;})['then'](handleEntityNotFound(_0x2cd6ca,null))[_0x4702('0x27')](respondWithStatusCode(_0x2cd6ca,null))['catch'](handleError(_0x2cd6ca,null));};exports[_0x4702('0x69')]=function(_0x2ecc47,_0x1d3a60){return db[_0x4702('0x37')]['find']({'where':{'id':_0x2ecc47[_0x4702('0x51')]['id']}})[_0x4702('0x27')](handleEntityNotFound(_0x1d3a60,null))[_0x4702('0x27')](function(_0x227980){if(_0x227980){var _0x8d6f89=['Voice',_0x4702('0x6a'),_0x4702('0x6b'),_0x4702('0x6c'),_0x4702('0x6d'),'Openchannel',_0x4702('0x6e')];return db['sequelize'][_0x4702('0x6f')](function(_0xaf543f){var _0x503340=_['map'](_0x8d6f89,function(_0x40a1d5){var _0x406a9b={'attributes':['id',_0x4702('0x2d')]};if(_0x40a1d5===_0x4702('0x70')){_0x406a9b[_0x4702('0x71')]={'attributes':['penalty']};}return _0x227980[_0x4702('0x28')+_0x40a1d5+_0x4702('0x65')](_0x406a9b)[_0x4702('0x27')](function(_0x116413){var _0xc47a95=_['map'](_0x116413,function(_0x3551ba){var _0x21ef73=_[_0x4702('0x36')](_0x2ecc47[_0x4702('0x31')][_0x4702('0x66')],function(_0x592e12){var _0x43708c={'where':{'UserId':_0x592e12,[_0x40a1d5+_0x4702('0x72')]:_0x3551ba['id']},'transaction':_0xaf543f};if(_0x40a1d5===_0x4702('0x70')){_0x43708c[_0x4702('0x73')]={'penalty':_0x3551ba[_0x4702('0x74')][_0x4702('0x75')]};}return db[_0x4702('0x76')+_0x40a1d5+_0x4702('0x61')][_0x4702('0x77')](_0x43708c)['then'](function(){socket[_0x4702('0x78')](_0x4702('0x54')+_0x40a1d5+'Queue:save',{'UserId':_0x592e12,[_0x40a1d5+_0x4702('0x72')]:_0x3551ba['id']});if(_0x40a1d5!=='Voice')return;return db['User'][_0x4702('0x4d')]({'where':{'id':_0x2ecc47['body'][_0x4702('0x66')],'online':0x1},'attributes':['id',_0x4702('0x2d'),'online',_0x4702('0x79'),_0x4702('0x7a')],'raw':!![]})[_0x4702('0x27')](function(_0x3f5a72){var _0x209e7c=_[_0x4702('0x36')](_0x3f5a72,function(_0x205de8){return db[_0x4702('0x7b')][_0x4702('0x7c')]({'membername':_0x205de8[_0x4702('0x2d')],'UserId':_0x205de8['id'],'queue_name':_0x3551ba[_0x4702('0x2d')],'VoiceQueueId':_0x3551ba['id'],'interface':_[_0x4702('0x7d')](_0x205de8[_0x4702('0x7a')])?util[_0x4702('0x7e')]('SIP/%s',_0x205de8['name']):_0x205de8['interface'],'paused':_0x205de8[_0x4702('0x79')]||![],'penalty':_0x3551ba[_0x4702('0x74')][_0x4702('0x75')]},{'transaction':_0xaf543f});});return Promise[_0x4702('0x7f')](_0x209e7c);});});});return Promise[_0x4702('0x7f')](_0x21ef73);});return Promise[_0x4702('0x7f')](_0xc47a95);});});return Promise[_0x4702('0x7f')](_0x503340)[_0x4702('0x27')](function(){return _0x227980[_0x4702('0x69')](_0x2ecc47[_0x4702('0x31')]['ids'],{'transaction':_0xaf543f})[_0x4702('0x80')](function(_0x58e64e){return _0x58e64e;});});});}})[_0x4702('0x27')](respondWithResult(_0x1d3a60,null))[_0x4702('0x4f')](handleError(_0x1d3a60,null));};exports['removeAgents']=function(_0x5555f1,_0x5ce321){return db[_0x4702('0x37')][_0x4702('0x58')]({'where':{'id':_0x5555f1[_0x4702('0x51')]['id']}})[_0x4702('0x27')](handleEntityNotFound(_0x5ce321,null))[_0x4702('0x27')](function(_0x3c358d){if(_0x3c358d){var _0x339746=[_0x4702('0x70'),_0x4702('0x6a'),'Mail',_0x4702('0x6c'),_0x4702('0x6d'),_0x4702('0x81'),_0x4702('0x6e')];return db[_0x4702('0x82')][_0x4702('0x6f')](function(_0x30b837){var _0x2df0aa=_[_0x4702('0x36')](_0x339746,function(_0x3fd126){var _0x295d42={'attributes':['id',_0x4702('0x2d')]};return _0x3c358d['get'+_0x3fd126+_0x4702('0x65')](_0x295d42)[_0x4702('0x27')](function(_0x34cff7){var _0x39ce72=_[_0x4702('0x36')](_0x34cff7,function(_0x342714){return _0x342714[_0x4702('0x83')](_0x5555f1['query']['ids'],{'transaction':_0x30b837})[_0x4702('0x27')](function(){var _0x4db4f0=JSON[_0x4702('0x84')]('['+_0x5555f1['query'][_0x4702('0x66')]+']');var _0x34911b=_[_0x4702('0x36')](_0x4db4f0,function(_0x467054){socket['emit'](_0x4702('0x54')+_0x3fd126+'Queue:remove',{'UserId':Number(_0x467054),[_0x3fd126+'QueueId']:_0x342714['id']});if(_0x3fd126!=='Voice')return;return db[_0x4702('0x7b')]['destroy']({'where':{'VoiceQueueId':_0x342714['id'],'UserId':_0x467054},'transaction':_0x30b837});});return Promise[_0x4702('0x7f')](_0x34911b);});});return Promise[_0x4702('0x7f')](_0x39ce72);});});return Promise[_0x4702('0x7f')](_0x2df0aa)[_0x4702('0x27')](function(){return _0x3c358d['removeAgents'](_0x5555f1[_0x4702('0x3d')][_0x4702('0x66')],{'transaction':_0x30b837});});});}})[_0x4702('0x27')](respondWithStatusCode(_0x5ce321,null))['catch'](handleError(_0x5ce321,null));};exports['getAgents']=function(_0x17f213,_0x556bbc,_0x56bdb0){var _0x52fe99={};var _0xb42210={};var _0x228d62;var _0x2fc9f4;return db[_0x4702('0x37')]['findOne']({'where':{'id':_0x17f213[_0x4702('0x51')]['id']}})[_0x4702('0x27')](handleEntityNotFound(_0x556bbc,null))['then'](function(_0x53c508){if(_0x53c508){_0x228d62=_0x53c508;_0xb42210[_0x4702('0x3c')]=_[_0x4702('0x3e')](db[_0x4702('0x76')][_0x4702('0x38')]);_0xb42210[_0x4702('0x3d')]=_['keys'](_0x17f213['query']);_0xb42210[_0x4702('0x3f')]=_[_0x4702('0x40')](_0xb42210[_0x4702('0x3c')],_0xb42210[_0x4702('0x3d')]);_0x52fe99[_0x4702('0x41')]=_[_0x4702('0x40')](_0xb42210[_0x4702('0x3c')],qs[_0x4702('0x42')](_0x17f213['query']['fields']));_0x52fe99[_0x4702('0x41')]=_0x52fe99[_0x4702('0x41')]['length']?_0x52fe99[_0x4702('0x41')]:_0xb42210[_0x4702('0x3c')];_0x52fe99[_0x4702('0x45')]=qs[_0x4702('0x46')](_0x17f213[_0x4702('0x3d')]['sort']);_0x52fe99[_0x4702('0x47')]=qs[_0x4702('0x3f')](_[_0x4702('0x48')](_0x17f213[_0x4702('0x3d')],_0xb42210['filters']));if(_0x17f213[_0x4702('0x3d')]['filter']){_0x52fe99[_0x4702('0x47')]=_[_0x4702('0x30')](_0x52fe99[_0x4702('0x47')],{'$or':_[_0x4702('0x36')](_0x52fe99['attributes'],function(_0xb8b341){var _0x6b48f9={};_0x6b48f9[_0xb8b341]={'$like':'%'+_0x17f213[_0x4702('0x3d')][_0x4702('0x49')]+'%'};return _0x6b48f9;})});}_0x52fe99=_[_0x4702('0x30')]({},_0x52fe99,_0x17f213[_0x4702('0x4b')]);return _0x228d62[_0x4702('0x85')](_0x52fe99);}})[_0x4702('0x27')](function(_0x425080){if(_0x425080){_0x2fc9f4=_0x425080[_0x4702('0x43')];if(!_0x17f213[_0x4702('0x3d')][_0x4702('0x44')]('nolimit')){_0x52fe99['limit']=qs[_0x4702('0x1c')](_0x17f213[_0x4702('0x3d')][_0x4702('0x1c')]);_0x52fe99['offset']=qs[_0x4702('0x1e')](_0x17f213[_0x4702('0x3d')][_0x4702('0x1e')]);}return _0x228d62[_0x4702('0x85')](_0x52fe99);}})[_0x4702('0x27')](function(_0x1c6fd2){if(_0x1c6fd2){return _0x1c6fd2?{'count':_0x2fc9f4,'rows':_0x1c6fd2}:null;}})['then'](respondWithResult(_0x556bbc,null))['catch'](handleError(_0x556bbc,null));}; \ No newline at end of file +var _0x26cf=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','Queue','toLowerCase','Queues','addQueues','add','removeQueues','Sequelize','remove','ids','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','transaction','through','penalty','TeamVoiceQueue','findOrCreate','emit','QueueId','User','online','interface','UserVoiceQueueRt','upsert','format','voicePause','all','spread','removeAgents','parse','Queue:remove','getAgents','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','register','sendStatus','status','json','undefined','limit','count','reject','update','destroy','then','get','end','error','stack','name','send','merge','body','message','agent','interaction','account','index','Team','rawAttributes','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','include','findAll','rows','show','params','length','includeAll','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x5ebaf0,_0x4c7823){var _0xf4c876=function(_0x43d47d){while(--_0x43d47d){_0x5ebaf0['push'](_0x5ebaf0['shift']());}};_0xf4c876(++_0x4c7823);}(_0x26cf,0x135));var _0xf26c=function(_0x2f461f,_0x1177d7){_0x2f461f=_0x2f461f-0x0;var _0x5a5bf7=_0x26cf[_0x2f461f];return _0x5a5bf7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf26c('0x0'));var zipdir=require(_0xf26c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf26c('0x2'));var moment=require('moment');var BPromise=require(_0xf26c('0x3'));var Mustache=require('mustache');var util=require(_0xf26c('0x4'));var path=require(_0xf26c('0x5'));var sox=require('sox');var csv=require(_0xf26c('0x6'));var ejs=require(_0xf26c('0x7'));var fs=require('fs');var fs_extra=require(_0xf26c('0x8'));var _=require(_0xf26c('0x9'));var squel=require(_0xf26c('0xa'));var crypto=require(_0xf26c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf26c('0x6'));var querystring=require(_0xf26c('0xc'));var Papa=require(_0xf26c('0xd'));var Redis=require(_0xf26c('0xe'));var authService=require(_0xf26c('0xf'));var qs=require(_0xf26c('0x10'));var as=require(_0xf26c('0x11'));var hardwareService=require(_0xf26c('0x12'));var logger=require('../../config/logger')(_0xf26c('0x13'));var utils=require(_0xf26c('0x14'));var config=require(_0xf26c('0x15'));var licenseUtil=require(_0xf26c('0x16'));var db=require(_0xf26c('0x17'))['db'];config['redis']=_[_0xf26c('0x18')](config['redis'],{'host':_0xf26c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf26c('0x1a')]));require('./team.socket')[_0xf26c('0x1b')](socket);function respondWithStatusCode(_0x58669e,_0x4246d9){_0x4246d9=_0x4246d9||0xcc;return function(_0x2cdf68){if(_0x2cdf68){return _0x58669e[_0xf26c('0x1c')](_0x4246d9);}return _0x58669e[_0xf26c('0x1d')](_0x4246d9)['end']();};}function respondWithResult(_0x4c3d77,_0x181db8){_0x181db8=_0x181db8||0xc8;return function(_0x392896){if(_0x392896){return _0x4c3d77['status'](_0x181db8)[_0xf26c('0x1e')](_0x392896);}};}function respondWithFilteredResult(_0x7cb19e,_0x454f32){return function(_0x375009){if(_0x375009){var _0x2ea1ac=typeof _0x454f32['offset']===_0xf26c('0x1f')&&typeof _0x454f32[_0xf26c('0x20')]===_0xf26c('0x1f');var _0x36e59d=_0x375009[_0xf26c('0x21')];var _0x1d8577=_0x2ea1ac?0x0:_0x454f32['offset'];var _0x25a06a=_0x2ea1ac?_0x375009[_0xf26c('0x21')]:_0x454f32['offset']+_0x454f32['limit'];var _0x15b059;if(_0x25a06a>=_0x36e59d){_0x25a06a=_0x36e59d;_0x15b059=0xc8;}else{_0x15b059=0xce;}_0x7cb19e[_0xf26c('0x1d')](_0x15b059);return _0x7cb19e['set']('Content-Range',_0x1d8577+'-'+_0x25a06a+'/'+_0x36e59d)[_0xf26c('0x1e')](_0x375009);}return null;};}function patchUpdates(_0x265cc3){return function(_0x2cfe2d){try{jsonpatch['apply'](_0x2cfe2d,_0x265cc3,!![]);}catch(_0x37d8fb){return BPromise[_0xf26c('0x22')](_0x37d8fb);}return _0x2cfe2d['save']();};}function saveUpdates(_0x2be84b,_0x4e2366){return function(_0x220892){if(_0x220892){return _0x220892[_0xf26c('0x23')](_0x2be84b)['then'](function(_0x1014b4){return _0x1014b4;});}return null;};}function removeEntity(_0x5cd420,_0x5e3a87){return function(_0xc8ec10){if(_0xc8ec10){return _0xc8ec10[_0xf26c('0x24')]()[_0xf26c('0x25')](function(){var _0x373d15=_0xc8ec10[_0xf26c('0x26')]({'plain':!![]});var _0x373742='Teams';return db['UserProfileResource'][_0xf26c('0x24')]({'where':{'type':_0x373742,'resourceId':_0x373d15['id']}})[_0xf26c('0x25')](function(){return _0xc8ec10;});})[_0xf26c('0x25')](function(){_0x5cd420[_0xf26c('0x1d')](0xcc)[_0xf26c('0x27')]();});}};}function handleEntityNotFound(_0x4ce010,_0x56a524){return function(_0x43f5a4){if(!_0x43f5a4){_0x4ce010['sendStatus'](0x194);}return _0x43f5a4;};}function handleError(_0x53c943,_0x2cbca2){_0x2cbca2=_0x2cbca2||0x1f4;return function(_0x6cd75e){logger[_0xf26c('0x28')](_0x6cd75e[_0xf26c('0x29')]);if(_0x6cd75e['name']){delete _0x6cd75e[_0xf26c('0x2a')];}_0x53c943[_0xf26c('0x1d')](_0x2cbca2)[_0xf26c('0x2b')](_0x6cd75e);};}function getMustacheRender(_0x4f455d,_0x495a81){return Mustache['render'](_0x4f455d,_[_0xf26c('0x2c')](_0x495a81[_0xf26c('0x2d')],{'contact':_0x495a81['contact'],'message':_0x495a81[_0xf26c('0x2e')],'agent':_0x495a81[_0xf26c('0x2f')],'interaction':_0x495a81[_0xf26c('0x30')],'account':_0x495a81[_0xf26c('0x31')]}))||'';}exports[_0xf26c('0x32')]=function(_0x2609a7,_0x38a89f){var _0x41b5ee={},_0x379bac={},_0x7d7054={'count':0x0,'rows':[]};var _0x3b0d79=_['map'](db[_0xf26c('0x33')][_0xf26c('0x34')],function(_0x516c74){return{'name':_0x516c74['fieldName'],'type':_0x516c74['type']['key']};});_0x379bac[_0xf26c('0x35')]=_[_0xf26c('0x36')](_0x3b0d79,_0xf26c('0x2a'));_0x379bac[_0xf26c('0x37')]=_[_0xf26c('0x38')](_0x2609a7['query']);_0x379bac[_0xf26c('0x39')]=_[_0xf26c('0x3a')](_0x379bac[_0xf26c('0x35')],_0x379bac[_0xf26c('0x37')]);_0x41b5ee['attributes']=_['intersection'](_0x379bac[_0xf26c('0x35')],qs[_0xf26c('0x3b')](_0x2609a7[_0xf26c('0x37')]['fields']));_0x41b5ee[_0xf26c('0x3c')]=_0x41b5ee[_0xf26c('0x3c')]['length']?_0x41b5ee['attributes']:_0x379bac[_0xf26c('0x35')];if(!_0x2609a7[_0xf26c('0x37')][_0xf26c('0x3d')](_0xf26c('0x3e'))){_0x41b5ee['limit']=qs['limit'](_0x2609a7[_0xf26c('0x37')]['limit']);_0x41b5ee['offset']=qs[_0xf26c('0x3f')](_0x2609a7['query'][_0xf26c('0x3f')]);}_0x41b5ee[_0xf26c('0x40')]=qs[_0xf26c('0x41')](_0x2609a7[_0xf26c('0x37')][_0xf26c('0x41')]);_0x41b5ee[_0xf26c('0x42')]=qs['filters'](_[_0xf26c('0x43')](_0x2609a7[_0xf26c('0x37')],_0x379bac['filters']),_0x3b0d79);if(_0x2609a7[_0xf26c('0x37')][_0xf26c('0x44')]){_0x41b5ee[_0xf26c('0x42')]=_[_0xf26c('0x2c')](_0x41b5ee[_0xf26c('0x42')],{'$or':_['map'](_0x3b0d79,function(_0xe425be){if(_0xe425be['type']!=='VIRTUAL'){var _0x5bbdaf={};_0x5bbdaf[_0xe425be[_0xf26c('0x2a')]]={'$like':'%'+_0x2609a7[_0xf26c('0x37')][_0xf26c('0x44')]+'%'};return _0x5bbdaf;}})});}_0x41b5ee=_['merge']({},_0x41b5ee,_0x2609a7['options']);var _0x330303={'where':_0x41b5ee[_0xf26c('0x42')]};return db[_0xf26c('0x33')][_0xf26c('0x21')](_0x330303)[_0xf26c('0x25')](function(_0x2f1bed){_0x7d7054['count']=_0x2f1bed;if(_0x2609a7[_0xf26c('0x37')]['includeAll']){_0x41b5ee[_0xf26c('0x45')]=[{'all':!![]}];}return db[_0xf26c('0x33')][_0xf26c('0x46')](_0x41b5ee);})[_0xf26c('0x25')](function(_0x4788a1){_0x7d7054[_0xf26c('0x47')]=_0x4788a1;return _0x7d7054;})['then'](respondWithFilteredResult(_0x38a89f,_0x41b5ee))['catch'](handleError(_0x38a89f,null));};exports[_0xf26c('0x48')]=function(_0x5a0b74,_0xaf318a){var _0x393349={'raw':![],'where':{'id':_0x5a0b74[_0xf26c('0x49')]['id']}},_0x537278={};_0x537278[_0xf26c('0x35')]=_[_0xf26c('0x38')](db[_0xf26c('0x33')]['rawAttributes']);_0x537278[_0xf26c('0x37')]=_[_0xf26c('0x38')](_0x5a0b74['query']);_0x537278[_0xf26c('0x39')]=_[_0xf26c('0x3a')](_0x537278[_0xf26c('0x35')],_0x537278[_0xf26c('0x37')]);_0x393349[_0xf26c('0x3c')]=_['intersection'](_0x537278['model'],qs['fields'](_0x5a0b74[_0xf26c('0x37')][_0xf26c('0x3b')]));_0x393349['attributes']=_0x393349[_0xf26c('0x3c')][_0xf26c('0x4a')]?_0x393349[_0xf26c('0x3c')]:_0x537278['model'];if(_0x5a0b74['query'][_0xf26c('0x4b')]){_0x393349[_0xf26c('0x45')]=[{'all':!![]}];}_0x393349=_[_0xf26c('0x2c')]({},_0x393349,_0x5a0b74[_0xf26c('0x4c')]);return db[_0xf26c('0x33')][_0xf26c('0x4d')](_0x393349)[_0xf26c('0x25')](handleEntityNotFound(_0xaf318a,null))[_0xf26c('0x25')](respondWithResult(_0xaf318a,null))[_0xf26c('0x4e')](handleError(_0xaf318a,null));};exports[_0xf26c('0x4f')]=function(_0x3816c1,_0x4a0995){return db['Team'][_0xf26c('0x4f')](_0x3816c1[_0xf26c('0x2d')],{})[_0xf26c('0x25')](function(_0x411100){var _0x26c59e=_0x3816c1[_0xf26c('0x50')][_0xf26c('0x26')]({'plain':!![]});if(!_0x26c59e)throw new Error(_0xf26c('0x51'));if(_0x26c59e[_0xf26c('0x52')]===_0xf26c('0x50')){var _0x255818=_0x411100[_0xf26c('0x26')]({'plain':!![]});var _0x1313b5='Teams';return db[_0xf26c('0x53')][_0xf26c('0x4d')]({'where':{'name':_0x1313b5,'userProfileId':_0x26c59e[_0xf26c('0x54')]},'raw':!![]})['then'](function(_0x58ead3){if(_0x58ead3&&_0x58ead3[_0xf26c('0x55')]===0x0){return db['UserProfileResource'][_0xf26c('0x4f')]({'name':_0x255818[_0xf26c('0x2a')],'resourceId':_0x255818['id'],'type':_0x58ead3[_0xf26c('0x2a')],'sectionId':_0x58ead3['id']},{})[_0xf26c('0x25')](function(){return _0x411100;});}else{return _0x411100;}})[_0xf26c('0x4e')](function(_0x5dbe75){logger[_0xf26c('0x28')](_0xf26c('0x56'),_0x5dbe75);throw _0x5dbe75;});}return _0x411100;})['then'](respondWithResult(_0x4a0995,0xc9))[_0xf26c('0x4e')](handleError(_0x4a0995,null));};exports[_0xf26c('0x23')]=function(_0x35f82a,_0xfa7e6d){if(_0x35f82a['body']['id']){delete _0x35f82a[_0xf26c('0x2d')]['id'];}return db[_0xf26c('0x33')]['find']({'where':{'id':_0x35f82a[_0xf26c('0x49')]['id']}})[_0xf26c('0x25')](handleEntityNotFound(_0xfa7e6d,null))['then'](saveUpdates(_0x35f82a['body'],null))['then'](respondWithResult(_0xfa7e6d,null))[_0xf26c('0x4e')](handleError(_0xfa7e6d,null));};exports[_0xf26c('0x24')]=function(_0x55dd4f,_0x1a8ff6){return db[_0xf26c('0x33')][_0xf26c('0x4d')]({'where':{'id':_0x55dd4f[_0xf26c('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a8ff6,null))['then'](removeEntity(_0x1a8ff6,null))[_0xf26c('0x4e')](handleError(_0x1a8ff6,null));};exports['getQueues']=function(_0xd88677,_0xaa34cb,_0x335863){return db['Team'][_0xf26c('0x57')]({'where':{'id':_0xd88677[_0xf26c('0x49')]['id']}})[_0xf26c('0x25')](handleEntityNotFound(_0xaa34cb,null))[_0xf26c('0x25')](function(_0x9ee99c){if(!_0xd88677['query'][_0xf26c('0x58')]||!utils[_0xf26c('0x59')](_0xd88677[_0xf26c('0x37')][_0xf26c('0x58')])){throw new db['Sequelize'][(_0xf26c('0x5a'))](_0xf26c('0x5b'));}var _0x5d3e80={};var _0x3a44a9={};_0x3a44a9[_0xf26c('0x35')]=_[_0xf26c('0x38')](db[_[_0xf26c('0x5c')](_0xd88677['query'][_0xf26c('0x58')]['toLowerCase']())+_0xf26c('0x5d')][_0xf26c('0x34')]);_0x3a44a9[_0xf26c('0x37')]=_[_0xf26c('0x38')](_0xd88677[_0xf26c('0x37')]);_0x3a44a9[_0xf26c('0x39')]=_[_0xf26c('0x3a')](_0x3a44a9[_0xf26c('0x35')],_0x3a44a9[_0xf26c('0x37')]);_0x5d3e80[_0xf26c('0x3c')]=_[_0xf26c('0x3a')](_0x3a44a9[_0xf26c('0x35')],qs['fields'](_0xd88677[_0xf26c('0x37')][_0xf26c('0x3b')]));_0x5d3e80[_0xf26c('0x3c')]=_0x5d3e80[_0xf26c('0x3c')]['length']?_0x5d3e80[_0xf26c('0x3c')]:_0x3a44a9[_0xf26c('0x35')];_0x5d3e80[_0xf26c('0x20')]=qs[_0xf26c('0x20')](_0xd88677[_0xf26c('0x37')][_0xf26c('0x20')]);_0x5d3e80['offset']=qs['offset'](_0xd88677[_0xf26c('0x37')][_0xf26c('0x3f')]);_0x5d3e80[_0xf26c('0x40')]=qs[_0xf26c('0x41')](_0xd88677['query']['sort']);_0x5d3e80['where']=qs[_0xf26c('0x39')](_['pick'](_0xd88677[_0xf26c('0x37')],_0x3a44a9[_0xf26c('0x39')]));_0x5d3e80=_[_0xf26c('0x2c')]({},_0x5d3e80,_0xd88677[_0xf26c('0x4c')]);return _0x9ee99c[_0xf26c('0x26')+_[_0xf26c('0x5c')](_0xd88677[_0xf26c('0x37')][_0xf26c('0x58')][_0xf26c('0x5e')]())+_0xf26c('0x5f')](_0x5d3e80);})['then'](respondWithResult(_0xaa34cb,null))[_0xf26c('0x4e')](handleError(_0xaa34cb,null));};exports[_0xf26c('0x60')]=function(_0x1f3a5f,_0x269e00,_0x1e738b){return db[_0xf26c('0x33')][_0xf26c('0x57')]({'where':{'id':_0x1f3a5f['params']['id']}})['then'](function(_0x34e16a){if(_0x34e16a){if(!_0x1f3a5f[_0xf26c('0x2d')][_0xf26c('0x58')]||!utils[_0xf26c('0x59')](_0x1f3a5f[_0xf26c('0x2d')]['channel'])){throw new db['Sequelize'][(_0xf26c('0x5a'))](_0xf26c('0x5b'));}return _0x34e16a[_0xf26c('0x61')+_[_0xf26c('0x5c')](_0x1f3a5f['body'][_0xf26c('0x58')][_0xf26c('0x5e')]())+'Queues'](_0x1f3a5f['body']['ids']);}return null;})[_0xf26c('0x25')](handleEntityNotFound(_0x269e00,null))[_0xf26c('0x25')](respondWithStatusCode(_0x269e00,null))['catch'](handleError(_0x269e00,null));};exports[_0xf26c('0x62')]=function(_0x4efc80,_0x24b206,_0x59ef64){return db[_0xf26c('0x33')][_0xf26c('0x57')]({'where':{'id':_0x4efc80[_0xf26c('0x49')]['id']}})[_0xf26c('0x25')](function(_0x459bec){if(_0x459bec){if(!_0x4efc80['query']['channel']||!utils[_0xf26c('0x59')](_0x4efc80[_0xf26c('0x37')][_0xf26c('0x58')])){throw new db[(_0xf26c('0x63'))]['ValidationError'](_0xf26c('0x5b'));}return _0x459bec[_0xf26c('0x64')+_[_0xf26c('0x5c')](_0x4efc80[_0xf26c('0x37')][_0xf26c('0x58')][_0xf26c('0x5e')]())+_0xf26c('0x5f')](_0x4efc80['query'][_0xf26c('0x65')]);}return null;})[_0xf26c('0x25')](handleEntityNotFound(_0x24b206,null))[_0xf26c('0x25')](respondWithStatusCode(_0x24b206,null))[_0xf26c('0x4e')](handleError(_0x24b206,null));};exports[_0xf26c('0x66')]=function(_0x36976f,_0x255e6f){return db[_0xf26c('0x33')][_0xf26c('0x4d')]({'where':{'id':_0x36976f[_0xf26c('0x49')]['id']}})['then'](handleEntityNotFound(_0x255e6f,null))[_0xf26c('0x25')](function(_0x2d1f8d){if(_0x2d1f8d){var _0x2253df=[_0xf26c('0x67'),_0xf26c('0x68'),_0xf26c('0x69'),_0xf26c('0x6a'),_0xf26c('0x6b'),_0xf26c('0x6c'),_0xf26c('0x6d')];return db[_0xf26c('0x6e')][_0xf26c('0x6f')](function(_0x224164){var _0x395ee3=_[_0xf26c('0x36')](_0x2253df,function(_0x56c52a){var _0x3d9af2={'attributes':['id',_0xf26c('0x2a')]};if(_0x56c52a===_0xf26c('0x67')){_0x3d9af2[_0xf26c('0x70')]={'attributes':[_0xf26c('0x71')]};}return _0x2d1f8d[_0xf26c('0x26')+_0x56c52a+_0xf26c('0x5f')](_0x3d9af2)[_0xf26c('0x25')](function(_0x499985){var _0x471341=_[_0xf26c('0x36')](_0x499985,function(_0x5663ce){var _0x4d93e3=_[_0xf26c('0x36')](_0x36976f[_0xf26c('0x2d')]['ids'],function(_0x12b21b){var _0x572f75={'where':{'UserId':_0x12b21b,[_0x56c52a+'QueueId']:_0x5663ce['id']},'transaction':_0x224164};if(_0x56c52a==='Voice'){_0x572f75[_0xf26c('0x18')]={'penalty':_0x5663ce[_0xf26c('0x72')][_0xf26c('0x71')]};}return db['User'+_0x56c52a+_0xf26c('0x5d')][_0xf26c('0x73')](_0x572f75)[_0xf26c('0x25')](function(){socket[_0xf26c('0x74')](_0xf26c('0x50')+_0x56c52a+'Queue:save',{'UserId':_0x12b21b,[_0x56c52a+_0xf26c('0x75')]:_0x5663ce['id']});if(_0x56c52a!==_0xf26c('0x67'))return;return db[_0xf26c('0x76')]['findAll']({'where':{'id':_0x36976f['body'][_0xf26c('0x65')],'online':0x1},'attributes':['id',_0xf26c('0x2a'),_0xf26c('0x77'),'voicePause',_0xf26c('0x78')],'raw':!![]})[_0xf26c('0x25')](function(_0x22f444){var _0x5818ec=_[_0xf26c('0x36')](_0x22f444,function(_0x25148d){return db[_0xf26c('0x79')][_0xf26c('0x7a')]({'membername':_0x25148d[_0xf26c('0x2a')],'UserId':_0x25148d['id'],'queue_name':_0x5663ce[_0xf26c('0x2a')],'VoiceQueueId':_0x5663ce['id'],'interface':_['isNil'](_0x25148d[_0xf26c('0x78')])?util[_0xf26c('0x7b')]('SIP/%s',_0x25148d[_0xf26c('0x2a')]):_0x25148d[_0xf26c('0x78')],'paused':_0x25148d[_0xf26c('0x7c')]||![],'penalty':_0x5663ce[_0xf26c('0x72')][_0xf26c('0x71')]},{'transaction':_0x224164});});return Promise[_0xf26c('0x7d')](_0x5818ec);});});});return Promise['all'](_0x4d93e3);});return Promise['all'](_0x471341);});});return Promise[_0xf26c('0x7d')](_0x395ee3)[_0xf26c('0x25')](function(){return _0x2d1f8d[_0xf26c('0x66')](_0x36976f[_0xf26c('0x2d')][_0xf26c('0x65')],{'transaction':_0x224164})[_0xf26c('0x7e')](function(_0x12c779){return _0x12c779;});});});}})[_0xf26c('0x25')](respondWithResult(_0x255e6f,null))[_0xf26c('0x4e')](handleError(_0x255e6f,null));};exports[_0xf26c('0x7f')]=function(_0x5e732d,_0x4a4e9a){return db[_0xf26c('0x33')][_0xf26c('0x4d')]({'where':{'id':_0x5e732d[_0xf26c('0x49')]['id']}})[_0xf26c('0x25')](handleEntityNotFound(_0x4a4e9a,null))[_0xf26c('0x25')](function(_0x5b0b9e){if(_0x5b0b9e){var _0x33a6c6=[_0xf26c('0x67'),_0xf26c('0x68'),_0xf26c('0x69'),_0xf26c('0x6a'),_0xf26c('0x6b'),'Openchannel',_0xf26c('0x6d')];return db[_0xf26c('0x6e')][_0xf26c('0x6f')](function(_0x582c01){var _0x4c2dcf=_[_0xf26c('0x36')](_0x33a6c6,function(_0xd7f068){var _0xb6ce25={'attributes':['id','name']};return _0x5b0b9e[_0xf26c('0x26')+_0xd7f068+_0xf26c('0x5f')](_0xb6ce25)['then'](function(_0x4c17b0){var _0xd9da59=_[_0xf26c('0x36')](_0x4c17b0,function(_0x4c1543){return _0x4c1543[_0xf26c('0x7f')](_0x5e732d['query']['ids'],{'transaction':_0x582c01})[_0xf26c('0x25')](function(){var _0x21d48f=JSON[_0xf26c('0x80')]('['+_0x5e732d['query'][_0xf26c('0x65')]+']');var _0x35ae8c=_['map'](_0x21d48f,function(_0x216b86){socket[_0xf26c('0x74')]('user'+_0xd7f068+_0xf26c('0x81'),{'UserId':Number(_0x216b86),[_0xd7f068+_0xf26c('0x75')]:_0x4c1543['id']});if(_0xd7f068!==_0xf26c('0x67'))return;return db['UserVoiceQueueRt'][_0xf26c('0x24')]({'where':{'VoiceQueueId':_0x4c1543['id'],'UserId':_0x216b86},'transaction':_0x582c01});});return Promise['all'](_0x35ae8c);});});return Promise[_0xf26c('0x7d')](_0xd9da59);});});return Promise[_0xf26c('0x7d')](_0x4c2dcf)['then'](function(){return _0x5b0b9e['removeAgents'](_0x5e732d['query'][_0xf26c('0x65')],{'transaction':_0x582c01});});});}})['then'](respondWithStatusCode(_0x4a4e9a,null))[_0xf26c('0x4e')](handleError(_0x4a4e9a,null));};exports[_0xf26c('0x82')]=function(_0x51120a,_0x387f54,_0x96e7e8){var _0x22fc04={};var _0x5b4c0a={};var _0x1e3964;var _0x716622;return db[_0xf26c('0x33')][_0xf26c('0x57')]({'where':{'id':_0x51120a[_0xf26c('0x49')]['id']}})[_0xf26c('0x25')](handleEntityNotFound(_0x387f54,null))[_0xf26c('0x25')](function(_0x49427d){if(_0x49427d){_0x1e3964=_0x49427d;_0x5b4c0a[_0xf26c('0x35')]=_[_0xf26c('0x38')](db['User'][_0xf26c('0x34')]);_0x5b4c0a[_0xf26c('0x37')]=_[_0xf26c('0x38')](_0x51120a[_0xf26c('0x37')]);_0x5b4c0a[_0xf26c('0x39')]=_[_0xf26c('0x3a')](_0x5b4c0a[_0xf26c('0x35')],_0x5b4c0a[_0xf26c('0x37')]);_0x22fc04[_0xf26c('0x3c')]=_[_0xf26c('0x3a')](_0x5b4c0a[_0xf26c('0x35')],qs[_0xf26c('0x3b')](_0x51120a[_0xf26c('0x37')][_0xf26c('0x3b')]));_0x22fc04['attributes']=_0x22fc04['attributes'][_0xf26c('0x4a')]?_0x22fc04['attributes']:_0x5b4c0a['model'];_0x22fc04[_0xf26c('0x40')]=qs[_0xf26c('0x41')](_0x51120a['query'][_0xf26c('0x41')]);_0x22fc04[_0xf26c('0x42')]=qs[_0xf26c('0x39')](_[_0xf26c('0x43')](_0x51120a[_0xf26c('0x37')],_0x5b4c0a[_0xf26c('0x39')]));if(_0x51120a[_0xf26c('0x37')][_0xf26c('0x44')]){_0x22fc04['where']=_[_0xf26c('0x2c')](_0x22fc04['where'],{'$or':_[_0xf26c('0x36')](_0x22fc04[_0xf26c('0x3c')],function(_0x3098da){var _0x14e3b2={};_0x14e3b2[_0x3098da]={'$like':'%'+_0x51120a['query'][_0xf26c('0x44')]+'%'};return _0x14e3b2;})});}_0x22fc04=_[_0xf26c('0x2c')]({},_0x22fc04,_0x51120a[_0xf26c('0x4c')]);return _0x1e3964['getAgents'](_0x22fc04);}})['then'](function(_0x493260){if(_0x493260){_0x716622=_0x493260['length'];if(!_0x51120a['query'][_0xf26c('0x3d')]('nolimit')){_0x22fc04[_0xf26c('0x20')]=qs[_0xf26c('0x20')](_0x51120a[_0xf26c('0x37')]['limit']);_0x22fc04['offset']=qs[_0xf26c('0x3f')](_0x51120a[_0xf26c('0x37')][_0xf26c('0x3f')]);}return _0x1e3964['getAgents'](_0x22fc04);}})[_0xf26c('0x25')](function(_0x1a6874){if(_0x1a6874){return _0x1a6874?{'count':_0x716622,'rows':_0x1a6874}:null;}})[_0xf26c('0x25')](respondWithResult(_0x387f54,null))[_0xf26c('0x4e')](handleError(_0x387f54,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index b808df9..b86a8f9 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 _0x9246=['hasOwnProperty','exports','events','save','update','remove'];(function(_0x12e286,_0xe7ba2a){var _0x47852e=function(_0x52154b){while(--_0x52154b){_0x12e286['push'](_0x12e286['shift']());}};_0x47852e(++_0xe7ba2a);}(_0x9246,0x9e));var _0x6924=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x9246[_0x819464];return _0x49dcc0;};'use strict';var EventEmitter=require(_0x6924('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6924('0x1'),'afterUpdate':_0x6924('0x2'),'afterDestroy':_0x6924('0x3')};function emitEvent(_0x16a45f){return function(_0x473c03,_0x50a954,_0x1a588b){TeamEvents['emit'](_0x16a45f+':'+_0x473c03['id'],_0x473c03);TeamEvents['emit'](_0x16a45f,_0x473c03);_0x1a588b(null);};}for(var e in events){if(events[_0x6924('0x4')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x6924('0x5')]=TeamEvents; \ No newline at end of file +var _0x8d6b=['exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hook'];(function(_0x18f8ff,_0x257e95){var _0x18de97=function(_0xc8eb68){while(--_0xc8eb68){_0x18f8ff['push'](_0x18f8ff['shift']());}};_0x18de97(++_0x257e95);}(_0x8d6b,0x79));var _0xb8d6=function(_0x36e637,_0x308719){_0x36e637=_0x36e637-0x0;var _0x59e4f0=_0x8d6b[_0x36e637];return _0x59e4f0;};'use strict';var EventEmitter=require(_0xb8d6('0x0'));var Team=require(_0xb8d6('0x1'))['db'][_0xb8d6('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xb8d6('0x3')](0x0);var events={'afterCreate':_0xb8d6('0x4'),'afterUpdate':_0xb8d6('0x5'),'afterDestroy':_0xb8d6('0x6')};function emitEvent(_0x13b4b4){return function(_0xd48662,_0x1783cf,_0x3a301c){TeamEvents[_0xb8d6('0x7')](_0x13b4b4+':'+_0xd48662['id'],_0xd48662);TeamEvents[_0xb8d6('0x7')](_0x13b4b4,_0xd48662);_0x3a301c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xb8d6('0x8')](e,emitEvent(event));}}module[_0xb8d6('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index d59e3ed..127613b 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 _0x415c=['bluebird','rimraf','../../config/environment','exports','define','Team','teams','lodash','util','api'];(function(_0x43c863,_0x598340){var _0x23d7b4=function(_0x9c56cf){while(--_0x9c56cf){_0x43c863['push'](_0x43c863['shift']());}};_0x23d7b4(++_0x598340);}(_0x415c,0xbb));var _0xc415=function(_0x35f840,_0x3a88dc){_0x35f840=_0x35f840-0x0;var _0x1e3168=_0x415c[_0x35f840];return _0x1e3168;};'use strict';var _=require(_0xc415('0x0'));var util=require(_0xc415('0x1'));var logger=require('../../config/logger')(_0xc415('0x2'));var moment=require('moment');var BPromise=require(_0xc415('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc415('0x4'));var config=require(_0xc415('0x5'));var attributes=require('./team.attributes');module[_0xc415('0x6')]=function(_0x7bc6d7,_0x13ff78){return _0x7bc6d7[_0xc415('0x7')](_0xc415('0x8'),attributes,{'tableName':_0xc415('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29e5=['rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x53aed1,_0x5c69dd){var _0x28c4ef=function(_0x25458b){while(--_0x25458b){_0x53aed1['push'](_0x53aed1['shift']());}};_0x28c4ef(++_0x5c69dd);}(_0x29e5,0x180));var _0x529e=function(_0x21667e,_0x43b956){_0x21667e=_0x21667e-0x0;var _0x36511a=_0x29e5[_0x21667e];return _0x36511a;};'use strict';var _=require(_0x529e('0x0'));var util=require(_0x529e('0x1'));var logger=require(_0x529e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x529e('0x3'));var rp=require(_0x529e('0x4'));var fs=require('fs');var path=require(_0x529e('0x5'));var rimraf=require(_0x529e('0x6'));var config=require(_0x529e('0x7'));var attributes=require(_0x529e('0x8'));module[_0x529e('0x9')]=function(_0x5b0cea,_0x22182b){return _0x5b0cea[_0x529e('0xa')](_0x529e('0xb'),attributes,{'tableName':_0x529e('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 443461d..c39545a 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 _0x5f1b=['socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5f1b,0x14f));var _0xb5f1=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x5f1b[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0xb5f1('0x0'));var util=require(_0xb5f1('0x1'));var moment=require(_0xb5f1('0x2'));var BPromise=require('bluebird');var rs=require(_0xb5f1('0x3'));var fs=require('fs');var Redis=require(_0xb5f1('0x4'));var db=require(_0xb5f1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb5f1('0x6'))(_0xb5f1('0x7'));var config=require(_0xb5f1('0x8'));var jayson=require(_0xb5f1('0x9'));var client=jayson['client'][_0xb5f1('0xa')]({'port':0x232a});config[_0xb5f1('0xb')]=_['defaults'](config[_0xb5f1('0xb')],{'host':_0xb5f1('0xc'),'port':0x18eb});var socket=require(_0xb5f1('0xd'))(new Redis(config[_0xb5f1('0xb')]));require(_0xb5f1('0xe'))[_0xb5f1('0xf')](socket);function respondWithRpcPromise(_0x3ad7b5,_0xe783b2,_0x31f3fb){return new BPromise(function(_0x14b7df,_0x4a60e3){return client[_0xb5f1('0x10')](_0x3ad7b5,_0x31f3fb)[_0xb5f1('0x11')](function(_0x4dba12){logger[_0xb5f1('0x12')](_0xb5f1('0x13'),_0xe783b2,'request\x20sent');logger[_0xb5f1('0x14')](_0xb5f1('0x15'),_0xe783b2,_0xb5f1('0x16'),JSON[_0xb5f1('0x17')](_0x4dba12));if(_0x4dba12[_0xb5f1('0x18')]){if(_0x4dba12[_0xb5f1('0x18')][_0xb5f1('0x19')]===0x1f4){logger[_0xb5f1('0x18')](_0xb5f1('0x13'),_0xe783b2,_0x4dba12[_0xb5f1('0x18')][_0xb5f1('0x1a')]);return _0x4a60e3(_0x4dba12[_0xb5f1('0x18')][_0xb5f1('0x1a')]);}logger['error'](_0xb5f1('0x13'),_0xe783b2,_0x4dba12[_0xb5f1('0x18')][_0xb5f1('0x1a')]);return _0x14b7df(_0x4dba12[_0xb5f1('0x18')][_0xb5f1('0x1a')]);}else{logger[_0xb5f1('0x12')](_0xb5f1('0x13'),_0xe783b2,_0xb5f1('0x16'));_0x14b7df(_0x4dba12[_0xb5f1('0x1b')][_0xb5f1('0x1a')]);}})[_0xb5f1('0x1c')](function(_0x161571){logger['error'](_0xb5f1('0x13'),_0xe783b2,_0x161571);_0x4a60e3(_0x161571);});});} \ No newline at end of file +var _0x8fc1=['error','code','Team,\x20%s,\x20%s','message','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s'];(function(_0x12a06b,_0x417b51){var _0x5d0bb8=function(_0x41d3d0){while(--_0x41d3d0){_0x12a06b['push'](_0x12a06b['shift']());}};_0x5d0bb8(++_0x417b51);}(_0x8fc1,0x14a));var _0x18fc=function(_0x58e207,_0x56ce67){_0x58e207=_0x58e207-0x0;var _0x5d43eb=_0x8fc1[_0x58e207];return _0x5d43eb;};'use strict';var _=require(_0x18fc('0x0'));var util=require('util');var moment=require(_0x18fc('0x1'));var BPromise=require(_0x18fc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18fc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x18fc('0x4'));var logger=require(_0x18fc('0x5'))(_0x18fc('0x6'));var config=require(_0x18fc('0x7'));var jayson=require(_0x18fc('0x8'));var client=jayson[_0x18fc('0x9')]['http']({'port':0x232a});config[_0x18fc('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x18fc('0xb'))(new Redis(config[_0x18fc('0xa')]));require(_0x18fc('0xc'))[_0x18fc('0xd')](socket);function respondWithRpcPromise(_0x2a6396,_0x20aac9,_0x11325f){return new BPromise(function(_0x5dc9d7,_0x4b9c47){return client[_0x18fc('0xe')](_0x2a6396,_0x11325f)[_0x18fc('0xf')](function(_0x11ba5a){logger[_0x18fc('0x10')]('Team,\x20%s,\x20%s',_0x20aac9,_0x18fc('0x11'));logger[_0x18fc('0x12')](_0x18fc('0x13'),_0x20aac9,_0x18fc('0x11'),JSON['stringify'](_0x11ba5a));if(_0x11ba5a['error']){if(_0x11ba5a[_0x18fc('0x14')][_0x18fc('0x15')]===0x1f4){logger[_0x18fc('0x14')](_0x18fc('0x16'),_0x20aac9,_0x11ba5a[_0x18fc('0x14')]['message']);return _0x4b9c47(_0x11ba5a[_0x18fc('0x14')][_0x18fc('0x17')]);}logger[_0x18fc('0x14')](_0x18fc('0x16'),_0x20aac9,_0x11ba5a['error'][_0x18fc('0x17')]);return _0x5dc9d7(_0x11ba5a[_0x18fc('0x14')][_0x18fc('0x17')]);}else{logger['info'](_0x18fc('0x16'),_0x20aac9,_0x18fc('0x11'));_0x5dc9d7(_0x11ba5a[_0x18fc('0x18')][_0x18fc('0x17')]);}})['catch'](function(_0x8e36f8){logger[_0x18fc('0x14')](_0x18fc('0x16'),_0x20aac9,_0x8e36f8);_0x4b9c47(_0x8e36f8);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index bba3a7c..1ac372f 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 _0xd634=['remove','removeListener','register','length','save'];(function(_0x1d67d5,_0x398b4b){var _0x3bb288=function(_0x352962){while(--_0x352962){_0x1d67d5['push'](_0x1d67d5['shift']());}};_0x3bb288(++_0x398b4b);}(_0xd634,0xf4));var _0x4d63=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xd634[_0x13b02f];return _0x12e9a6;};'use strict';var TeamEvents=require('./team.events');var events=[_0x4d63('0x0'),_0x4d63('0x1'),'update'];function createListener(_0x4b0edc,_0x2034ac){return function(_0x42e27c){_0x2034ac['emit'](_0x4b0edc,_0x42e27c);};}function removeListener(_0x4f99ac,_0x2b8d62){return function(){TeamEvents[_0x4d63('0x2')](_0x4f99ac,_0x2b8d62);};}exports[_0x4d63('0x3')]=function(_0x3b573c){for(var _0x3f188d=0x0,_0x381601=events[_0x4d63('0x4')];_0x3f188d<_0x381601;_0x3f188d++){var _0x6a60f4=events[_0x3f188d];var _0x49c1da=createListener('team:'+_0x6a60f4,_0x3b573c);TeamEvents['on'](_0x6a60f4,_0x49c1da);}}; \ No newline at end of file +var _0xf61e=['team:','./team.events','save','remove','update','emit','removeListener','register'];(function(_0x3e436c,_0xebf949){var _0x3e4924=function(_0xab2179){while(--_0xab2179){_0x3e436c['push'](_0x3e436c['shift']());}};_0x3e4924(++_0xebf949);}(_0xf61e,0x191));var _0xef61=function(_0x1bcf26,_0x30d715){_0x1bcf26=_0x1bcf26-0x0;var _0x3e5a58=_0xf61e[_0x1bcf26];return _0x3e5a58;};'use strict';var TeamEvents=require(_0xef61('0x0'));var events=[_0xef61('0x1'),_0xef61('0x2'),_0xef61('0x3')];function createListener(_0x205269,_0xeccd26){return function(_0x3613e6){_0xeccd26[_0xef61('0x4')](_0x205269,_0x3613e6);};}function removeListener(_0x2bd1d0,_0x14122a){return function(){TeamEvents[_0xef61('0x5')](_0x2bd1d0,_0x14122a);};}exports[_0xef61('0x6')]=function(_0x5b00b2){for(var _0x9e17f4=0x0,_0x3e2f79=events['length'];_0x9e17f4<_0x3e2f79;_0x9e17f4++){var _0x2242a7=events[_0x9e17f4];var _0x277fa1=createListener(_0xef61('0x7')+_0x2242a7,_0x5b00b2);TeamEvents['on'](_0x2242a7,_0x277fa1);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 8829fe1..5173f8b 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 _0xabad=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','exports'];(function(_0x1bb6e7,_0x1fa463){var _0x4fbc86=function(_0x1a0e8c){while(--_0x1a0e8c){_0x1bb6e7['push'](_0x1bb6e7['shift']());}};_0x4fbc86(++_0x1fa463);}(_0xabad,0x150));var _0xdaba=function(_0x3253f3,_0x1c57d8){_0x3253f3=_0x3253f3-0x0;var _0x598c26=_0xabad[_0x3253f3];return _0x598c26;};'use strict';var multer=require(_0xdaba('0x0'));var util=require('util');var path=require(_0xdaba('0x1'));var timeout=require(_0xdaba('0x2'));var express=require(_0xdaba('0x3'));var router=express['Router']();var fs_extra=require(_0xdaba('0x4'));var auth=require(_0xdaba('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdaba('0x6'));module[_0xdaba('0x7')]=router; \ No newline at end of file +var _0x570f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','Router'];(function(_0x485f95,_0x174b92){var _0x4254f0=function(_0x5bee28){while(--_0x5bee28){_0x485f95['push'](_0x485f95['shift']());}};_0x4254f0(++_0x174b92);}(_0x570f,0x152));var _0xf570=function(_0x113bef,_0x82b4a5){_0x113bef=_0x113bef-0x0;var _0x3b6d82=_0x570f[_0x113bef];return _0x3b6d82;};'use strict';var multer=require(_0xf570('0x0'));var util=require(_0xf570('0x1'));var path=require(_0xf570('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf570('0x3')]();var fs_extra=require(_0xf570('0x4'));var auth=require(_0xf570('0x5'));var interaction=require(_0xf570('0x6'));var config=require(_0xf570('0x7'));module[_0xf570('0x8')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index bd5d483..3b3933a 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x52eddc,_0x54d001){var _0x2dbabf=function(_0x60f89c){while(--_0x60f89c){_0x52eddc['push'](_0x52eddc['shift']());}};_0x2dbabf(++_0x54d001);}(_0xe706,0xa3));var _0x6e70=function(_0xbc25e1,_0x27007d){_0xbc25e1=_0xbc25e1-0x0;var _0xaf0a85=_0xe706[_0xbc25e1];return _0xaf0a85;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x3d9cfa,_0x596edc){var _0x21d89d=function(_0x5668c2){while(--_0x5668c2){_0x3d9cfa['push'](_0x3d9cfa['shift']());}};_0x21d89d(++_0x596edc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 26779e8..27f5e7b 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 _0x2d95=['lodash','util','api','moment','request-promise','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x2d95,0x1f4));var _0x52d9=function(_0x567f20,_0x2d59e1){_0x567f20=_0x567f20-0x0;var _0xb32575=_0x2d95[_0x567f20];return _0xb32575;};'use strict';var _=require(_0x52d9('0x0'));var util=require(_0x52d9('0x1'));var logger=require('../../config/logger')(_0x52d9('0x2'));var moment=require(_0x52d9('0x3'));var BPromise=require('bluebird');var rp=require(_0x52d9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x52d9('0x5'));module[_0x52d9('0x6')]=function(_0x555230,_0x2f752a){return _0x555230[_0x52d9('0x7')](_0x52d9('0x8'),attributes,{'tableName':_0x52d9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa97b=['../../config/logger','bluebird','request-promise','path','../../config/environment','TeamVoiceQueue'];(function(_0x43508e,_0x152447){var _0x451e35=function(_0x582e67){while(--_0x582e67){_0x43508e['push'](_0x43508e['shift']());}};_0x451e35(++_0x152447);}(_0xa97b,0x1c2));var _0xba97=function(_0x353c78,_0x575846){_0x353c78=_0x353c78-0x0;var _0x2a13d4=_0xa97b[_0x353c78];return _0x2a13d4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xba97('0x0'))('api');var moment=require('moment');var BPromise=require(_0xba97('0x1'));var rp=require(_0xba97('0x2'));var fs=require('fs');var path=require(_0xba97('0x3'));var rimraf=require('rimraf');var config=require(_0xba97('0x4'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x8941ab,_0x7e7c5f){return _0x8941ab['define'](_0xba97('0x5'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 80e75fd..7129fac 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 _0x3b37=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x3b37,0x15c));var _0x73b3=function(_0x43f269,_0x17b400){_0x43f269=_0x43f269-0x0;var _0x34f9cc=_0x3b37[_0x43f269];return _0x34f9cc;};'use strict';var _=require(_0x73b3('0x0'));var util=require(_0x73b3('0x1'));var moment=require(_0x73b3('0x2'));var BPromise=require(_0x73b3('0x3'));var rs=require(_0x73b3('0x4'));var fs=require('fs');var Redis=require(_0x73b3('0x5'));var db=require(_0x73b3('0x6'))['db'];var utils=require(_0x73b3('0x7'));var logger=require(_0x73b3('0x8'))(_0x73b3('0x9'));var config=require('../../config/environment');var jayson=require(_0x73b3('0xa'));var client=jayson[_0x73b3('0xb')][_0x73b3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f0f90,_0x560f2a,_0x41be50){return new BPromise(function(_0x179a7b,_0x523c7b){return client['request'](_0x2f0f90,_0x41be50)[_0x73b3('0xd')](function(_0x174647){logger[_0x73b3('0xe')](_0x73b3('0xf'),_0x560f2a,_0x73b3('0x10'));logger[_0x73b3('0x11')](_0x73b3('0x12'),_0x560f2a,_0x73b3('0x10'),JSON[_0x73b3('0x13')](_0x174647));if(_0x174647[_0x73b3('0x14')]){if(_0x174647[_0x73b3('0x14')][_0x73b3('0x15')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x560f2a,_0x174647[_0x73b3('0x14')][_0x73b3('0x16')]);return _0x523c7b(_0x174647[_0x73b3('0x14')][_0x73b3('0x16')]);}logger[_0x73b3('0x14')](_0x73b3('0xf'),_0x560f2a,_0x174647['error'][_0x73b3('0x16')]);return _0x179a7b(_0x174647[_0x73b3('0x14')][_0x73b3('0x16')]);}else{logger[_0x73b3('0xe')](_0x73b3('0xf'),_0x560f2a,_0x73b3('0x10'));_0x179a7b(_0x174647[_0x73b3('0x17')]['message']);}})[_0x73b3('0x18')](function(_0x137eeb){logger[_0x73b3('0x14')](_0x73b3('0xf'),_0x560f2a,_0x137eeb);_0x523c7b(_0x137eeb);});});} \ No newline at end of file +var _0xa9fc=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2a696c,_0x16ad22){var _0x44f2e6=function(_0x25d867){while(--_0x25d867){_0x2a696c['push'](_0x2a696c['shift']());}};_0x44f2e6(++_0x16ad22);}(_0xa9fc,0x1f3));var _0xca9f=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0xa9fc[_0xac0de1];return _0x1c1995;};'use strict';var _=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var moment=require(_0xca9f('0x2'));var BPromise=require(_0xca9f('0x3'));var rs=require(_0xca9f('0x4'));var fs=require('fs');var Redis=require(_0xca9f('0x5'));var db=require(_0xca9f('0x6'))['db'];var utils=require(_0xca9f('0x7'));var logger=require(_0xca9f('0x8'))(_0xca9f('0x9'));var config=require(_0xca9f('0xa'));var jayson=require(_0xca9f('0xb'));var client=jayson['client'][_0xca9f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x391c6e,_0x1cf84a,_0x3ee126){return new BPromise(function(_0xd1131e,_0x3b7113){return client[_0xca9f('0xd')](_0x391c6e,_0x3ee126)[_0xca9f('0xe')](function(_0x33d589){logger[_0xca9f('0xf')](_0xca9f('0x10'),_0x1cf84a,_0xca9f('0x11'));logger['debug'](_0xca9f('0x12'),_0x1cf84a,_0xca9f('0x11'),JSON[_0xca9f('0x13')](_0x33d589));if(_0x33d589[_0xca9f('0x14')]){if(_0x33d589[_0xca9f('0x14')][_0xca9f('0x15')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x1cf84a,_0x33d589[_0xca9f('0x14')][_0xca9f('0x16')]);return _0x3b7113(_0x33d589['error'][_0xca9f('0x16')]);}logger[_0xca9f('0x14')](_0xca9f('0x10'),_0x1cf84a,_0x33d589[_0xca9f('0x14')][_0xca9f('0x16')]);return _0xd1131e(_0x33d589[_0xca9f('0x14')][_0xca9f('0x16')]);}else{logger[_0xca9f('0xf')](_0xca9f('0x10'),_0x1cf84a,_0xca9f('0x11'));_0xd1131e(_0x33d589['result'][_0xca9f('0x16')]);}})['catch'](function(_0x23be53){logger[_0xca9f('0x14')](_0xca9f('0x10'),_0x1cf84a,_0x23be53);_0x3b7113(_0x23be53);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 3af8393..327ae2d 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 _0x8ef6=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','/:id','isAuthenticated','post','create','put','update','delete'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3f6e13,_0x4b749d){_0x3f6e13=_0x3f6e13-0x0;var _0x794149=_0x8ef6[_0x3f6e13];return _0x794149;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['show']);router[_0x68ef('0xd')]('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xf')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);module[_0x68ef('0x13')]=router; \ No newline at end of file +var _0xd8fb=['get','index','/:id','show','post','put','isAuthenticated','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./template.controller'];(function(_0x229d7c,_0x2e8fd1){var _0x35c63b=function(_0x2f6d3e){while(--_0x2f6d3e){_0x229d7c['push'](_0x229d7c['shift']());}};_0x35c63b(++_0x2e8fd1);}(_0xd8fb,0x99));var _0xbd8f=function(_0x2703ca,_0x84072a){_0x2703ca=_0x2703ca-0x0;var _0x10fd38=_0xd8fb[_0x2703ca];return _0x10fd38;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0x8')]);router['get'](_0xbd8f('0x9'),auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbd8f('0xc')](_0xbd8f('0x9'),auth[_0xbd8f('0xd')](),controller['update']);router[_0xbd8f('0xe')](_0xbd8f('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xbd8f('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index c9eefb4..a460bc7 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 _0xbaca=['sequelize','exports','STRING','TEXT'];(function(_0x43357a,_0x3f010b){var _0x358737=function(_0x51d6ed){while(--_0x51d6ed){_0x43357a['push'](_0x43357a['shift']());}};_0x358737(++_0x3f010b);}(_0xbaca,0xfc));var _0xabac=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xbaca[_0x1eda20];return _0x31b953;};'use strict';var Sequelize=require(_0xabac('0x0'));module[_0xabac('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xabac('0x2')]},'html':{'type':Sequelize[_0xabac('0x3')]}}; \ No newline at end of file +var _0x1b0e=['STRING','TEXT','sequelize','exports'];(function(_0x358206,_0x36283c){var _0x78feb8=function(_0x83c6e){while(--_0x83c6e){_0x358206['push'](_0x358206['shift']());}};_0x78feb8(++_0x36283c);}(_0x1b0e,0x132));var _0xe1b0=function(_0x3f907c,_0x9895a8){_0x3f907c=_0x3f907c-0x0;var _0x2f298a=_0x1b0e[_0x3f907c];return _0x2f298a;};'use strict';var Sequelize=require(_0xe1b0('0x0'));module[_0xe1b0('0x1')]={'name':{'type':Sequelize[_0xe1b0('0x2')]},'description':{'type':Sequelize[_0xe1b0('0x2')]},'html':{'type':Sequelize[_0xe1b0('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 7f873d1..0f51fd9 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 _0x0d28=['json','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','render','body','contact','interaction','index','map','Template','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','fields','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','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','end','undefined','count','offset','limit','Content-Range'];(function(_0x51d098,_0x317d8e){var _0x1aaf97=function(_0x34cde4){while(--_0x34cde4){_0x51d098['push'](_0x51d098['shift']());}};_0x1aaf97(++_0x317d8e);}(_0x0d28,0xf1));var _0x80d2=function(_0x2b6124,_0x4d25f2){_0x2b6124=_0x2b6124-0x0;var _0x44c3f4=_0x0d28[_0x2b6124];return _0x44c3f4;};'use strict';var emlformat=require(_0x80d2('0x0'));var rimraf=require(_0x80d2('0x1'));var zipdir=require(_0x80d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x80d2('0x3'));var moment=require(_0x80d2('0x4'));var BPromise=require(_0x80d2('0x5'));var Mustache=require(_0x80d2('0x6'));var util=require(_0x80d2('0x7'));var path=require(_0x80d2('0x8'));var sox=require('sox');var csv=require(_0x80d2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x80d2('0xa'));var _=require(_0x80d2('0xb'));var squel=require(_0x80d2('0xc'));var crypto=require(_0x80d2('0xd'));var jsforce=require(_0x80d2('0xe'));var deskjs=require(_0x80d2('0xf'));var toCsv=require(_0x80d2('0x9'));var querystring=require('querystring');var Papa=require(_0x80d2('0x10'));var Redis=require(_0x80d2('0x11'));var authService=require(_0x80d2('0x12'));var qs=require(_0x80d2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x80d2('0x14'));var logger=require(_0x80d2('0x15'))(_0x80d2('0x16'));var utils=require(_0x80d2('0x17'));var config=require(_0x80d2('0x18'));var licenseUtil=require(_0x80d2('0x19'));var db=require(_0x80d2('0x1a'))['db'];function respondWithStatusCode(_0x4b4a24,_0x4c52fb){_0x4c52fb=_0x4c52fb||0xcc;return function(_0x16a894){if(_0x16a894){return _0x4b4a24[_0x80d2('0x1b')](_0x4c52fb);}return _0x4b4a24[_0x80d2('0x1c')](_0x4c52fb)[_0x80d2('0x1d')]();};}function respondWithResult(_0x5d7c7d,_0x2dcf0c){_0x2dcf0c=_0x2dcf0c||0xc8;return function(_0x4b4300){if(_0x4b4300){return _0x5d7c7d['status'](_0x2dcf0c)['json'](_0x4b4300);}};}function respondWithFilteredResult(_0x499a41,_0x36c4ca){return function(_0x2c19c0){if(_0x2c19c0){var _0x516f15=typeof _0x36c4ca['offset']===_0x80d2('0x1e')&&typeof _0x36c4ca['limit']==='undefined';var _0x2f70c8=_0x2c19c0[_0x80d2('0x1f')];var _0x2347e5=_0x516f15?0x0:_0x36c4ca[_0x80d2('0x20')];var _0x1eed1f=_0x516f15?_0x2c19c0[_0x80d2('0x1f')]:_0x36c4ca['offset']+_0x36c4ca[_0x80d2('0x21')];var _0x2030a8;if(_0x1eed1f>=_0x2f70c8){_0x1eed1f=_0x2f70c8;_0x2030a8=0xc8;}else{_0x2030a8=0xce;}_0x499a41[_0x80d2('0x1c')](_0x2030a8);return _0x499a41['set'](_0x80d2('0x22'),_0x2347e5+'-'+_0x1eed1f+'/'+_0x2f70c8)[_0x80d2('0x23')](_0x2c19c0);}return null;};}function patchUpdates(_0x2cf5a1){return function(_0x56ae93){try{jsonpatch[_0x80d2('0x24')](_0x56ae93,_0x2cf5a1,!![]);}catch(_0x1e4edd){return BPromise[_0x80d2('0x25')](_0x1e4edd);}return _0x56ae93[_0x80d2('0x26')]();};}function saveUpdates(_0x4c6f81,_0x5d07d4){return function(_0xe6b640){if(_0xe6b640){return _0xe6b640[_0x80d2('0x27')](_0x4c6f81)[_0x80d2('0x28')](function(_0x3d5456){return _0x3d5456;});}return null;};}function removeEntity(_0x568e17,_0x550b32){return function(_0x29577c){if(_0x29577c){return _0x29577c[_0x80d2('0x29')]()['then'](function(){var _0x2bdd3d=_0x29577c[_0x80d2('0x2a')]({'plain':!![]});var _0x5945b3=_0x80d2('0x2b');return db[_0x80d2('0x2c')][_0x80d2('0x29')]({'where':{'type':_0x5945b3,'resourceId':_0x2bdd3d['id']}})[_0x80d2('0x28')](function(){return _0x29577c;});})['then'](function(){_0x568e17[_0x80d2('0x1c')](0xcc)[_0x80d2('0x1d')]();});}};}function handleEntityNotFound(_0x29b08a,_0xd53bcf){return function(_0x1937b7){if(!_0x1937b7){_0x29b08a[_0x80d2('0x1b')](0x194);}return _0x1937b7;};}function handleError(_0x4a3214,_0x1c10b9){_0x1c10b9=_0x1c10b9||0x1f4;return function(_0x5efba5){logger[_0x80d2('0x2d')](_0x5efba5[_0x80d2('0x2e')]);if(_0x5efba5[_0x80d2('0x2f')]){delete _0x5efba5[_0x80d2('0x2f')];}_0x4a3214[_0x80d2('0x1c')](_0x1c10b9)[_0x80d2('0x30')](_0x5efba5);};}function getMustacheRender(_0x200056,_0x59d44f){return Mustache[_0x80d2('0x31')](_0x200056,_['merge'](_0x59d44f[_0x80d2('0x32')],{'contact':_0x59d44f[_0x80d2('0x33')],'message':_0x59d44f['message'],'agent':_0x59d44f['agent'],'interaction':_0x59d44f[_0x80d2('0x34')],'account':_0x59d44f['account']}))||'';}exports[_0x80d2('0x35')]=function(_0x1bc5f5,_0x3e3739){var _0x559ed8={},_0x1cc473={},_0x396d55={'count':0x0,'rows':[]};var _0x13b117=_[_0x80d2('0x36')](db[_0x80d2('0x37')][_0x80d2('0x38')],function(_0x2d53fb){return{'name':_0x2d53fb[_0x80d2('0x39')],'type':_0x2d53fb[_0x80d2('0x3a')][_0x80d2('0x3b')]};});_0x1cc473[_0x80d2('0x3c')]=_[_0x80d2('0x36')](_0x13b117,_0x80d2('0x2f'));_0x1cc473['query']=_['keys'](_0x1bc5f5[_0x80d2('0x3d')]);_0x1cc473[_0x80d2('0x3e')]=_[_0x80d2('0x3f')](_0x1cc473[_0x80d2('0x3c')],_0x1cc473[_0x80d2('0x3d')]);_0x559ed8[_0x80d2('0x40')]=_['intersection'](_0x1cc473[_0x80d2('0x3c')],qs['fields'](_0x1bc5f5[_0x80d2('0x3d')]['fields']));_0x559ed8[_0x80d2('0x40')]=_0x559ed8[_0x80d2('0x40')][_0x80d2('0x41')]?_0x559ed8[_0x80d2('0x40')]:_0x1cc473['model'];if(!_0x1bc5f5[_0x80d2('0x3d')][_0x80d2('0x42')](_0x80d2('0x43'))){_0x559ed8['limit']=qs[_0x80d2('0x21')](_0x1bc5f5[_0x80d2('0x3d')]['limit']);_0x559ed8[_0x80d2('0x20')]=qs[_0x80d2('0x20')](_0x1bc5f5['query']['offset']);}_0x559ed8['order']=qs[_0x80d2('0x44')](_0x1bc5f5[_0x80d2('0x3d')][_0x80d2('0x44')]);_0x559ed8[_0x80d2('0x45')]=qs[_0x80d2('0x3e')](_[_0x80d2('0x46')](_0x1bc5f5['query'],_0x1cc473[_0x80d2('0x3e')]),_0x13b117);if(_0x1bc5f5[_0x80d2('0x3d')][_0x80d2('0x47')]){_0x559ed8[_0x80d2('0x45')]=_[_0x80d2('0x48')](_0x559ed8[_0x80d2('0x45')],{'$or':_['map'](_0x13b117,function(_0x1794b4){if(_0x1794b4[_0x80d2('0x3a')]!==_0x80d2('0x49')){var _0x3ccc5b={};_0x3ccc5b[_0x1794b4[_0x80d2('0x2f')]]={'$like':'%'+_0x1bc5f5[_0x80d2('0x3d')][_0x80d2('0x47')]+'%'};return _0x3ccc5b;}})});}_0x559ed8=_[_0x80d2('0x48')]({},_0x559ed8,_0x1bc5f5['options']);var _0x2d32b3={'where':_0x559ed8[_0x80d2('0x45')]};return db['Template'][_0x80d2('0x1f')](_0x2d32b3)[_0x80d2('0x28')](function(_0x1ffa10){_0x396d55[_0x80d2('0x1f')]=_0x1ffa10;if(_0x1bc5f5[_0x80d2('0x3d')]['includeAll']){_0x559ed8[_0x80d2('0x4a')]=[{'all':!![]}];}return db[_0x80d2('0x37')][_0x80d2('0x4b')](_0x559ed8);})[_0x80d2('0x28')](function(_0x2c19bf){_0x396d55[_0x80d2('0x4c')]=_0x2c19bf;return _0x396d55;})[_0x80d2('0x28')](respondWithFilteredResult(_0x3e3739,_0x559ed8))[_0x80d2('0x4d')](handleError(_0x3e3739,null));};exports[_0x80d2('0x4e')]=function(_0x6440cf,_0x200fae){var _0xe2e326={'raw':!![],'where':{'id':_0x6440cf[_0x80d2('0x4f')]['id']}},_0x414da3={};_0x414da3[_0x80d2('0x3c')]=_[_0x80d2('0x50')](db[_0x80d2('0x37')][_0x80d2('0x38')]);_0x414da3[_0x80d2('0x3d')]=_['keys'](_0x6440cf['query']);_0x414da3[_0x80d2('0x3e')]=_[_0x80d2('0x3f')](_0x414da3[_0x80d2('0x3c')],_0x414da3[_0x80d2('0x3d')]);_0xe2e326[_0x80d2('0x40')]=_[_0x80d2('0x3f')](_0x414da3[_0x80d2('0x3c')],qs[_0x80d2('0x51')](_0x6440cf[_0x80d2('0x3d')]['fields']));_0xe2e326[_0x80d2('0x40')]=_0xe2e326['attributes'][_0x80d2('0x41')]?_0xe2e326[_0x80d2('0x40')]:_0x414da3[_0x80d2('0x3c')];if(_0x6440cf['query'][_0x80d2('0x52')]){_0xe2e326['include']=[{'all':!![]}];}_0xe2e326=_['merge']({},_0xe2e326,_0x6440cf['options']);return db[_0x80d2('0x37')]['find'](_0xe2e326)['then'](handleEntityNotFound(_0x200fae,null))[_0x80d2('0x28')](respondWithResult(_0x200fae,null))[_0x80d2('0x4d')](handleError(_0x200fae,null));};exports[_0x80d2('0x53')]=function(_0x477add,_0x1fac4a){return db[_0x80d2('0x37')][_0x80d2('0x53')](_0x477add['body'],{})[_0x80d2('0x28')](function(_0x65447d){var _0x4d9f71=_0x477add['user'][_0x80d2('0x2a')]({'plain':!![]});if(!_0x4d9f71)throw new Error(_0x80d2('0x54'));if(_0x4d9f71[_0x80d2('0x55')]===_0x80d2('0x56')){var _0x1ba6c1=_0x65447d[_0x80d2('0x2a')]({'plain':!![]});var _0x4a64b7='Templates';return db[_0x80d2('0x57')][_0x80d2('0x58')]({'where':{'name':_0x4a64b7,'userProfileId':_0x4d9f71[_0x80d2('0x59')]},'raw':!![]})[_0x80d2('0x28')](function(_0x220356){if(_0x220356&&_0x220356[_0x80d2('0x5a')]===0x0){return db[_0x80d2('0x2c')]['create']({'name':_0x1ba6c1[_0x80d2('0x2f')],'resourceId':_0x1ba6c1['id'],'type':_0x220356[_0x80d2('0x2f')],'sectionId':_0x220356['id']},{})[_0x80d2('0x28')](function(){return _0x65447d;});}else{return _0x65447d;}})['catch'](function(_0x6240ec){logger[_0x80d2('0x2d')](_0x80d2('0x5b'),_0x6240ec);throw _0x6240ec;});}return _0x65447d;})[_0x80d2('0x28')](respondWithResult(_0x1fac4a,0xc9))['catch'](handleError(_0x1fac4a,null));};exports[_0x80d2('0x27')]=function(_0x218bf9,_0x4120a2){if(_0x218bf9[_0x80d2('0x32')]['id']){delete _0x218bf9['body']['id'];}return db[_0x80d2('0x37')][_0x80d2('0x58')]({'where':{'id':_0x218bf9['params']['id']}})[_0x80d2('0x28')](handleEntityNotFound(_0x4120a2,null))['then'](saveUpdates(_0x218bf9[_0x80d2('0x32')],null))[_0x80d2('0x28')](respondWithResult(_0x4120a2,null))[_0x80d2('0x4d')](handleError(_0x4120a2,null));};exports[_0x80d2('0x29')]=function(_0x147a19,_0x3e43b5){return db[_0x80d2('0x37')]['find']({'where':{'id':_0x147a19[_0x80d2('0x4f')]['id']}})[_0x80d2('0x28')](handleEntityNotFound(_0x3e43b5,null))[_0x80d2('0x28')](removeEntity(_0x3e43b5,null))[_0x80d2('0x4d')](handleError(_0x3e43b5,null));}; \ No newline at end of file +var _0x437f=['jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','end','error','stack','name','merge','contact','message','agent','index','Template','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','rows','catch','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0xc43047,_0x5a8843){var _0x391ffb=function(_0x4baef5){while(--_0x4baef5){_0xc43047['push'](_0xc43047['shift']());}};_0x391ffb(++_0x5a8843);}(_0x437f,0x14c));var _0xf437=function(_0x32497d,_0x2d305a){_0x32497d=_0x32497d-0x0;var _0x5e05aa=_0x437f[_0x32497d];return _0x5e05aa;};'use strict';var emlformat=require(_0xf437('0x0'));var rimraf=require(_0xf437('0x1'));var zipdir=require(_0xf437('0x2'));var jsonpatch=require(_0xf437('0x3'));var rp=require(_0xf437('0x4'));var moment=require(_0xf437('0x5'));var BPromise=require(_0xf437('0x6'));var Mustache=require(_0xf437('0x7'));var util=require(_0xf437('0x8'));var path=require(_0xf437('0x9'));var sox=require(_0xf437('0xa'));var csv=require(_0xf437('0xb'));var ejs=require(_0xf437('0xc'));var fs=require('fs');var fs_extra=require(_0xf437('0xd'));var _=require(_0xf437('0xe'));var squel=require(_0xf437('0xf'));var crypto=require('crypto');var jsforce=require(_0xf437('0x10'));var deskjs=require(_0xf437('0x11'));var toCsv=require(_0xf437('0xb'));var querystring=require(_0xf437('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf437('0x13'));var qs=require(_0xf437('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf437('0x15'));var logger=require(_0xf437('0x16'))(_0xf437('0x17'));var utils=require('../../config/utils');var config=require(_0xf437('0x18'));var licenseUtil=require(_0xf437('0x19'));var db=require(_0xf437('0x1a'))['db'];function respondWithStatusCode(_0x3837fa,_0x59c576){_0x59c576=_0x59c576||0xcc;return function(_0xa84e96){if(_0xa84e96){return _0x3837fa[_0xf437('0x1b')](_0x59c576);}return _0x3837fa[_0xf437('0x1c')](_0x59c576)['end']();};}function respondWithResult(_0x2dc963,_0x37fff4){_0x37fff4=_0x37fff4||0xc8;return function(_0x4e6447){if(_0x4e6447){return _0x2dc963[_0xf437('0x1c')](_0x37fff4)[_0xf437('0x1d')](_0x4e6447);}};}function respondWithFilteredResult(_0x6a794d,_0x17e1c1){return function(_0x3a3668){if(_0x3a3668){var _0x1b79f6=typeof _0x17e1c1[_0xf437('0x1e')]===_0xf437('0x1f')&&typeof _0x17e1c1[_0xf437('0x20')]==='undefined';var _0x5cce2c=_0x3a3668['count'];var _0x2570b4=_0x1b79f6?0x0:_0x17e1c1['offset'];var _0x2c2bf3=_0x1b79f6?_0x3a3668[_0xf437('0x21')]:_0x17e1c1[_0xf437('0x1e')]+_0x17e1c1[_0xf437('0x20')];var _0x4f97f3;if(_0x2c2bf3>=_0x5cce2c){_0x2c2bf3=_0x5cce2c;_0x4f97f3=0xc8;}else{_0x4f97f3=0xce;}_0x6a794d[_0xf437('0x1c')](_0x4f97f3);return _0x6a794d['set'](_0xf437('0x22'),_0x2570b4+'-'+_0x2c2bf3+'/'+_0x5cce2c)[_0xf437('0x1d')](_0x3a3668);}return null;};}function patchUpdates(_0x24f5af){return function(_0x3b7064){try{jsonpatch[_0xf437('0x23')](_0x3b7064,_0x24f5af,!![]);}catch(_0x165554){return BPromise[_0xf437('0x24')](_0x165554);}return _0x3b7064[_0xf437('0x25')]();};}function saveUpdates(_0x377eed,_0xe4323c){return function(_0x38f93f){if(_0x38f93f){return _0x38f93f[_0xf437('0x26')](_0x377eed)[_0xf437('0x27')](function(_0x2e67c2){return _0x2e67c2;});}return null;};}function removeEntity(_0x1d191d,_0x5d67c0){return function(_0x4716bb){if(_0x4716bb){return _0x4716bb[_0xf437('0x28')]()['then'](function(){var _0x556a68=_0x4716bb[_0xf437('0x29')]({'plain':!![]});var _0x402ef5=_0xf437('0x2a');return db[_0xf437('0x2b')][_0xf437('0x28')]({'where':{'type':_0x402ef5,'resourceId':_0x556a68['id']}})[_0xf437('0x27')](function(){return _0x4716bb;});})['then'](function(){_0x1d191d['status'](0xcc)[_0xf437('0x2c')]();});}};}function handleEntityNotFound(_0x7b69eb,_0x191786){return function(_0x38bf53){if(!_0x38bf53){_0x7b69eb[_0xf437('0x1b')](0x194);}return _0x38bf53;};}function handleError(_0x79b299,_0x41df27){_0x41df27=_0x41df27||0x1f4;return function(_0x147851){logger[_0xf437('0x2d')](_0x147851[_0xf437('0x2e')]);if(_0x147851['name']){delete _0x147851[_0xf437('0x2f')];}_0x79b299[_0xf437('0x1c')](_0x41df27)['send'](_0x147851);};}function getMustacheRender(_0x230f2a,_0x3ffcc1){return Mustache['render'](_0x230f2a,_[_0xf437('0x30')](_0x3ffcc1['body'],{'contact':_0x3ffcc1[_0xf437('0x31')],'message':_0x3ffcc1[_0xf437('0x32')],'agent':_0x3ffcc1[_0xf437('0x33')],'interaction':_0x3ffcc1['interaction'],'account':_0x3ffcc1['account']}))||'';}exports[_0xf437('0x34')]=function(_0x2f7592,_0x13962e){var _0x44510c={},_0x5060aa={},_0x40803a={'count':0x0,'rows':[]};var _0x565c54=_['map'](db[_0xf437('0x35')]['rawAttributes'],function(_0x4e488b){return{'name':_0x4e488b[_0xf437('0x36')],'type':_0x4e488b[_0xf437('0x37')]['key']};});_0x5060aa[_0xf437('0x38')]=_[_0xf437('0x39')](_0x565c54,_0xf437('0x2f'));_0x5060aa[_0xf437('0x3a')]=_[_0xf437('0x3b')](_0x2f7592['query']);_0x5060aa[_0xf437('0x3c')]=_[_0xf437('0x3d')](_0x5060aa[_0xf437('0x38')],_0x5060aa['query']);_0x44510c[_0xf437('0x3e')]=_[_0xf437('0x3d')](_0x5060aa[_0xf437('0x38')],qs[_0xf437('0x3f')](_0x2f7592['query'][_0xf437('0x3f')]));_0x44510c[_0xf437('0x3e')]=_0x44510c[_0xf437('0x3e')][_0xf437('0x40')]?_0x44510c[_0xf437('0x3e')]:_0x5060aa['model'];if(!_0x2f7592[_0xf437('0x3a')][_0xf437('0x41')](_0xf437('0x42'))){_0x44510c[_0xf437('0x20')]=qs[_0xf437('0x20')](_0x2f7592[_0xf437('0x3a')][_0xf437('0x20')]);_0x44510c[_0xf437('0x1e')]=qs[_0xf437('0x1e')](_0x2f7592['query'][_0xf437('0x1e')]);}_0x44510c[_0xf437('0x43')]=qs[_0xf437('0x44')](_0x2f7592[_0xf437('0x3a')][_0xf437('0x44')]);_0x44510c[_0xf437('0x45')]=qs[_0xf437('0x3c')](_['pick'](_0x2f7592[_0xf437('0x3a')],_0x5060aa[_0xf437('0x3c')]),_0x565c54);if(_0x2f7592['query'][_0xf437('0x46')]){_0x44510c['where']=_[_0xf437('0x30')](_0x44510c[_0xf437('0x45')],{'$or':_[_0xf437('0x39')](_0x565c54,function(_0x3c9675){if(_0x3c9675['type']!=='VIRTUAL'){var _0x59bc24={};_0x59bc24[_0x3c9675[_0xf437('0x2f')]]={'$like':'%'+_0x2f7592[_0xf437('0x3a')][_0xf437('0x46')]+'%'};return _0x59bc24;}})});}_0x44510c=_[_0xf437('0x30')]({},_0x44510c,_0x2f7592[_0xf437('0x47')]);var _0x41d864={'where':_0x44510c['where']};return db['Template'][_0xf437('0x21')](_0x41d864)[_0xf437('0x27')](function(_0x3506cd){_0x40803a['count']=_0x3506cd;if(_0x2f7592[_0xf437('0x3a')][_0xf437('0x48')]){_0x44510c[_0xf437('0x49')]=[{'all':!![]}];}return db[_0xf437('0x35')]['findAll'](_0x44510c);})['then'](function(_0x160f65){_0x40803a[_0xf437('0x4a')]=_0x160f65;return _0x40803a;})[_0xf437('0x27')](respondWithFilteredResult(_0x13962e,_0x44510c))[_0xf437('0x4b')](handleError(_0x13962e,null));};exports['show']=function(_0x5d29dd,_0x265220){var _0x24e396={'raw':!![],'where':{'id':_0x5d29dd[_0xf437('0x4c')]['id']}},_0x6cd718={};_0x6cd718[_0xf437('0x38')]=_[_0xf437('0x3b')](db[_0xf437('0x35')][_0xf437('0x4d')]);_0x6cd718[_0xf437('0x3a')]=_[_0xf437('0x3b')](_0x5d29dd[_0xf437('0x3a')]);_0x6cd718[_0xf437('0x3c')]=_[_0xf437('0x3d')](_0x6cd718[_0xf437('0x38')],_0x6cd718[_0xf437('0x3a')]);_0x24e396[_0xf437('0x3e')]=_['intersection'](_0x6cd718[_0xf437('0x38')],qs['fields'](_0x5d29dd[_0xf437('0x3a')][_0xf437('0x3f')]));_0x24e396[_0xf437('0x3e')]=_0x24e396[_0xf437('0x3e')][_0xf437('0x40')]?_0x24e396[_0xf437('0x3e')]:_0x6cd718['model'];if(_0x5d29dd[_0xf437('0x3a')]['includeAll']){_0x24e396[_0xf437('0x49')]=[{'all':!![]}];}_0x24e396=_[_0xf437('0x30')]({},_0x24e396,_0x5d29dd[_0xf437('0x47')]);return db[_0xf437('0x35')]['find'](_0x24e396)['then'](handleEntityNotFound(_0x265220,null))[_0xf437('0x27')](respondWithResult(_0x265220,null))[_0xf437('0x4b')](handleError(_0x265220,null));};exports[_0xf437('0x4e')]=function(_0x404bad,_0x4fe33c){return db['Template'][_0xf437('0x4e')](_0x404bad[_0xf437('0x4f')],{})['then'](function(_0x5ba710){var _0x144c3c=_0x404bad[_0xf437('0x50')][_0xf437('0x29')]({'plain':!![]});if(!_0x144c3c)throw new Error(_0xf437('0x51'));if(_0x144c3c[_0xf437('0x52')]===_0xf437('0x50')){var _0x5d1d95=_0x5ba710['get']({'plain':!![]});var _0x251774=_0xf437('0x2a');return db['UserProfileSection'][_0xf437('0x53')]({'where':{'name':_0x251774,'userProfileId':_0x144c3c[_0xf437('0x54')]},'raw':!![]})[_0xf437('0x27')](function(_0xc16f1a){if(_0xc16f1a&&_0xc16f1a[_0xf437('0x55')]===0x0){return db[_0xf437('0x2b')][_0xf437('0x4e')]({'name':_0x5d1d95[_0xf437('0x2f')],'resourceId':_0x5d1d95['id'],'type':_0xc16f1a[_0xf437('0x2f')],'sectionId':_0xc16f1a['id']},{})[_0xf437('0x27')](function(){return _0x5ba710;});}else{return _0x5ba710;}})[_0xf437('0x4b')](function(_0x30da1c){logger[_0xf437('0x2d')](_0xf437('0x56'),_0x30da1c);throw _0x30da1c;});}return _0x5ba710;})[_0xf437('0x27')](respondWithResult(_0x4fe33c,0xc9))['catch'](handleError(_0x4fe33c,null));};exports[_0xf437('0x26')]=function(_0x4638c4,_0x5a1f1b){if(_0x4638c4[_0xf437('0x4f')]['id']){delete _0x4638c4[_0xf437('0x4f')]['id'];}return db[_0xf437('0x35')][_0xf437('0x53')]({'where':{'id':_0x4638c4[_0xf437('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5a1f1b,null))[_0xf437('0x27')](saveUpdates(_0x4638c4['body'],null))[_0xf437('0x27')](respondWithResult(_0x5a1f1b,null))[_0xf437('0x4b')](handleError(_0x5a1f1b,null));};exports['destroy']=function(_0x4056e4,_0x20e19b){return db['Template']['find']({'where':{'id':_0x4056e4[_0xf437('0x4c')]['id']}})['then'](handleEntityNotFound(_0x20e19b,null))[_0xf437('0x27')](removeEntity(_0x20e19b,null))[_0xf437('0x4b')](handleError(_0x20e19b,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 733e243..cc982d8 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 _0x9dab=['exports','define','Template','tools_templates','lodash','util','api','moment','bluebird','path','rimraf','./template.attributes'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9dab,0x10c));var _0xb9da=function(_0x538536,_0x586688){_0x538536=_0x538536-0x0;var _0x225fd5=_0x9dab[_0x538536];return _0x225fd5;};'use strict';var _=require(_0xb9da('0x0'));var util=require(_0xb9da('0x1'));var logger=require('../../config/logger')(_0xb9da('0x2'));var moment=require(_0xb9da('0x3'));var BPromise=require(_0xb9da('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9da('0x5'));var rimraf=require(_0xb9da('0x6'));var config=require('../../config/environment');var attributes=require(_0xb9da('0x7'));module[_0xb9da('0x8')]=function(_0x21a59d,_0x3c22e2){return _0x21a59d[_0xb9da('0x9')](_0xb9da('0xa'),attributes,{'tableName':_0xb9da('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5807=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','define','tools_templates','lodash','util'];(function(_0x250bf4,_0x52ee71){var _0x10410a=function(_0x561f7f){while(--_0x561f7f){_0x250bf4['push'](_0x250bf4['shift']());}};_0x10410a(++_0x52ee71);}(_0x5807,0x102));var _0x7580=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5807[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7580('0x0'));var util=require(_0x7580('0x1'));var logger=require(_0x7580('0x2'))(_0x7580('0x3'));var moment=require('moment');var BPromise=require(_0x7580('0x4'));var rp=require(_0x7580('0x5'));var fs=require('fs');var path=require(_0x7580('0x6'));var rimraf=require('rimraf');var config=require(_0x7580('0x7'));var attributes=require('./template.attributes');module['exports']=function(_0x10e2a4,_0x169448){return _0x10e2a4[_0x7580('0x8')]('Template',attributes,{'tableName':_0x7580('0x9'),'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 ec0eb34..974afbd 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 _0xfd48=['limit','include','model','map','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Template,\x20%s,\x20%s','result','catch','GetTemplate','Template','findAll','options','raw','attributes'];(function(_0x1a114e,_0x16d073){var _0x3fa1b4=function(_0x37df75){while(--_0x37df75){_0x1a114e['push'](_0x1a114e['shift']());}};_0x3fa1b4(++_0x16d073);}(_0xfd48,0x1d2));var _0x8fd4=function(_0x71d53c,_0x392b9b){_0x71d53c=_0x71d53c-0x0;var _0x41a88f=_0xfd48[_0x71d53c];return _0x41a88f;};'use strict';var _=require(_0x8fd4('0x0'));var util=require(_0x8fd4('0x1'));var moment=require(_0x8fd4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8fd4('0x3'));var db=require(_0x8fd4('0x4'))['db'];var utils=require(_0x8fd4('0x5'));var logger=require(_0x8fd4('0x6'))(_0x8fd4('0x7'));var config=require(_0x8fd4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8fd4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27c345,_0x907f03,_0x5a369c){return new BPromise(function(_0x2ec664,_0x5c7cbd){return client[_0x8fd4('0xa')](_0x27c345,_0x5a369c)[_0x8fd4('0xb')](function(_0x450aa2){logger[_0x8fd4('0xc')]('Template,\x20%s,\x20%s',_0x907f03,_0x8fd4('0xd'));logger[_0x8fd4('0xe')](_0x8fd4('0xf'),_0x907f03,_0x8fd4('0xd'),JSON[_0x8fd4('0x10')](_0x450aa2));if(_0x450aa2[_0x8fd4('0x11')]){if(_0x450aa2['error'][_0x8fd4('0x12')]===0x1f4){logger[_0x8fd4('0x11')]('Template,\x20%s,\x20%s',_0x907f03,_0x450aa2['error']['message']);return _0x5c7cbd(_0x450aa2[_0x8fd4('0x11')][_0x8fd4('0x13')]);}logger[_0x8fd4('0x11')]('Template,\x20%s,\x20%s',_0x907f03,_0x450aa2[_0x8fd4('0x11')]['message']);return _0x2ec664(_0x450aa2['error'][_0x8fd4('0x13')]);}else{logger[_0x8fd4('0xc')](_0x8fd4('0x14'),_0x907f03,_0x8fd4('0xd'));_0x2ec664(_0x450aa2[_0x8fd4('0x15')][_0x8fd4('0x13')]);}})[_0x8fd4('0x16')](function(_0x574989){logger[_0x8fd4('0x11')](_0x8fd4('0x14'),_0x907f03,_0x574989);_0x5c7cbd(_0x574989);});});}exports[_0x8fd4('0x17')]=function(_0x50e41b){var _0x1b56c2=this;return new Promise(function(_0x143497,_0x3c5e7a){return db[_0x8fd4('0x18')][_0x8fd4('0x19')]({'raw':_0x50e41b[_0x8fd4('0x1a')]?_0x50e41b[_0x8fd4('0x1a')][_0x8fd4('0x1b')]===undefined?!![]:![]:!![],'where':_0x50e41b[_0x8fd4('0x1a')]?_0x50e41b['options']['where']||null:null,'attributes':_0x50e41b[_0x8fd4('0x1a')]?_0x50e41b[_0x8fd4('0x1a')][_0x8fd4('0x1c')]||null:null,'limit':_0x50e41b[_0x8fd4('0x1a')]?_0x50e41b[_0x8fd4('0x1a')][_0x8fd4('0x1d')]||null:null,'include':_0x50e41b[_0x8fd4('0x1a')]?_0x50e41b[_0x8fd4('0x1a')][_0x8fd4('0x1e')]?_['map'](_0x50e41b[_0x8fd4('0x1a')]['include'],function(_0x388c43){return{'model':db[_0x388c43[_0x8fd4('0x1f')]],'as':_0x388c43['as'],'attributes':_0x388c43[_0x8fd4('0x1c')],'include':_0x388c43[_0x8fd4('0x1e')]?_[_0x8fd4('0x20')](_0x388c43[_0x8fd4('0x1e')],function(_0x58551d){return{'model':db[_0x58551d[_0x8fd4('0x1f')]],'as':_0x58551d['as'],'attributes':_0x58551d[_0x8fd4('0x1c')],'include':_0x58551d['include']?_[_0x8fd4('0x20')](_0x58551d[_0x8fd4('0x1e')],function(_0x1f45c1){return{'model':db[_0x1f45c1['model']],'as':_0x1f45c1['as'],'attributes':_0x1f45c1[_0x8fd4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8fd4('0xb')](function(_0x15304f){logger[_0x8fd4('0xc')]('GetTemplate',_0x50e41b);logger[_0x8fd4('0xe')](_0x8fd4('0x17'),_0x50e41b,JSON['stringify'](_0x15304f));_0x143497(_0x15304f);})[_0x8fd4('0x16')](function(_0x3dc1fa){logger['error'](_0x8fd4('0x17'),_0x3dc1fa['message'],_0x50e41b);_0x3c5e7a(_0x1b56c2[_0x8fd4('0x11')](0x1f4,_0x3dc1fa[_0x8fd4('0x13')]));});});}; \ No newline at end of file +var _0x29bb=['client','http','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','catch','Template','findAll','options','raw','where','include','map','model','attributes','GetTemplate','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x36bdfc,_0x3c67f1){var _0x22a5be=function(_0x81f4b2){while(--_0x81f4b2){_0x36bdfc['push'](_0x36bdfc['shift']());}};_0x22a5be(++_0x3c67f1);}(_0x29bb,0x1d2));var _0xb29b=function(_0x3d3179,_0x5e3c51){_0x3d3179=_0x3d3179-0x0;var _0x5bde8e=_0x29bb[_0x3d3179];return _0x5bde8e;};'use strict';var _=require(_0xb29b('0x0'));var util=require(_0xb29b('0x1'));var moment=require('moment');var BPromise=require(_0xb29b('0x2'));var rs=require(_0xb29b('0x3'));var fs=require('fs');var Redis=require(_0xb29b('0x4'));var db=require(_0xb29b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb29b('0x6'))(_0xb29b('0x7'));var config=require(_0xb29b('0x8'));var jayson=require(_0xb29b('0x9'));var client=jayson[_0xb29b('0xa')][_0xb29b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb56cdc,_0x381fd2,_0x25cc43){return new BPromise(function(_0x814c9e,_0x5f40d4){return client[_0xb29b('0xc')](_0xb56cdc,_0x25cc43)[_0xb29b('0xd')](function(_0x1b65c5){logger[_0xb29b('0xe')]('Template,\x20%s,\x20%s',_0x381fd2,_0xb29b('0xf'));logger[_0xb29b('0x10')](_0xb29b('0x11'),_0x381fd2,_0xb29b('0xf'),JSON[_0xb29b('0x12')](_0x1b65c5));if(_0x1b65c5[_0xb29b('0x13')]){if(_0x1b65c5[_0xb29b('0x13')][_0xb29b('0x14')]===0x1f4){logger[_0xb29b('0x13')](_0xb29b('0x15'),_0x381fd2,_0x1b65c5[_0xb29b('0x13')][_0xb29b('0x16')]);return _0x5f40d4(_0x1b65c5[_0xb29b('0x13')][_0xb29b('0x16')]);}logger['error'](_0xb29b('0x15'),_0x381fd2,_0x1b65c5[_0xb29b('0x13')][_0xb29b('0x16')]);return _0x814c9e(_0x1b65c5[_0xb29b('0x13')][_0xb29b('0x16')]);}else{logger[_0xb29b('0xe')](_0xb29b('0x15'),_0x381fd2,_0xb29b('0xf'));_0x814c9e(_0x1b65c5['result'][_0xb29b('0x16')]);}})[_0xb29b('0x17')](function(_0x3bed28){logger['error'](_0xb29b('0x15'),_0x381fd2,_0x3bed28);_0x5f40d4(_0x3bed28);});});}exports['GetTemplate']=function(_0x43d197){var _0x4eeb36=this;return new Promise(function(_0x449e69,_0x5e6041){return db[_0xb29b('0x18')][_0xb29b('0x19')]({'raw':_0x43d197[_0xb29b('0x1a')]?_0x43d197['options'][_0xb29b('0x1b')]===undefined?!![]:![]:!![],'where':_0x43d197['options']?_0x43d197[_0xb29b('0x1a')][_0xb29b('0x1c')]||null:null,'attributes':_0x43d197[_0xb29b('0x1a')]?_0x43d197[_0xb29b('0x1a')]['attributes']||null:null,'limit':_0x43d197[_0xb29b('0x1a')]?_0x43d197[_0xb29b('0x1a')]['limit']||null:null,'include':_0x43d197[_0xb29b('0x1a')]?_0x43d197['options'][_0xb29b('0x1d')]?_[_0xb29b('0x1e')](_0x43d197['options']['include'],function(_0x1f4345){return{'model':db[_0x1f4345[_0xb29b('0x1f')]],'as':_0x1f4345['as'],'attributes':_0x1f4345[_0xb29b('0x20')],'include':_0x1f4345[_0xb29b('0x1d')]?_[_0xb29b('0x1e')](_0x1f4345[_0xb29b('0x1d')],function(_0xe855af){return{'model':db[_0xe855af[_0xb29b('0x1f')]],'as':_0xe855af['as'],'attributes':_0xe855af[_0xb29b('0x20')],'include':_0xe855af['include']?_[_0xb29b('0x1e')](_0xe855af['include'],function(_0x257328){return{'model':db[_0x257328[_0xb29b('0x1f')]],'as':_0x257328['as'],'attributes':_0x257328[_0xb29b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb29b('0xd')](function(_0xa7a12e){logger[_0xb29b('0xe')](_0xb29b('0x21'),_0x43d197);logger['debug']('GetTemplate',_0x43d197,JSON['stringify'](_0xa7a12e));_0x449e69(_0xa7a12e);})[_0xb29b('0x17')](function(_0x268848){logger['error'](_0xb29b('0x21'),_0x268848[_0xb29b('0x16')],_0x43d197);_0x5e6041(_0x4eeb36[_0xb29b('0x13')](0x1f4,_0x268848['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 394d89f..a475203 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 _0x974b=['../../components/auth/service','../../config/environment','./trigger.controller','index','get','/:id','isAuthenticated','show','/:id/all_conditions','/:id/any_conditions','/:id/actions','getActions','create','addAllCondition','post','addAction','put','update','exports','multer','util','connect-timeout'];(function(_0x40db12,_0x99b025){var _0x9a3366=function(_0x394214){while(--_0x394214){_0x40db12['push'](_0x40db12['shift']());}};_0x9a3366(++_0x99b025);}(_0x974b,0x1cb));var _0xb974=function(_0xfdbc0,_0x3d360d){_0xfdbc0=_0xfdbc0-0x0;var _0x2e8d80=_0x974b[_0xfdbc0];return _0x2e8d80;};'use strict';var multer=require(_0xb974('0x0'));var util=require(_0xb974('0x1'));var path=require('path');var timeout=require(_0xb974('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb974('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb974('0x4'));var controller=require(_0xb974('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xb974('0x6')]);router[_0xb974('0x7')](_0xb974('0x8'),auth[_0xb974('0x9')](),controller[_0xb974('0xa')]);router[_0xb974('0x7')](_0xb974('0xb'),auth[_0xb974('0x9')](),controller['getAllConditions']);router['get'](_0xb974('0xc'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0xb974('0x7')](_0xb974('0xd'),auth[_0xb974('0x9')](),controller[_0xb974('0xe')]);router['post']('/',auth[_0xb974('0x9')](),controller[_0xb974('0xf')]);router['post'](_0xb974('0xb'),auth['isAuthenticated'](),controller[_0xb974('0x10')]);router[_0xb974('0x11')](_0xb974('0xc'),auth['isAuthenticated'](),controller['addAnyCondition']);router['post'](_0xb974('0xd'),auth[_0xb974('0x9')](),controller[_0xb974('0x12')]);router[_0xb974('0x13')]('/:id',auth[_0xb974('0x9')](),controller[_0xb974('0x14')]);router['delete'](_0xb974('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xb974('0x15')]=router; \ No newline at end of file +var _0x20dd=['addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','post'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x20dd,0x64));var _0xd20d=function(_0x323968,_0x52db1c){_0x323968=_0x323968-0x0;var _0x39d420=_0x20dd[_0x323968];return _0x39d420;};'use strict';var multer=require('multer');var util=require(_0xd20d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd20d('0x1'));var router=express['Router']();var fs_extra=require(_0xd20d('0x2'));var auth=require(_0xd20d('0x3'));var interaction=require(_0xd20d('0x4'));var config=require('../../config/environment');var controller=require('./trigger.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd20d('0x5')]);router[_0xd20d('0x6')](_0xd20d('0x7'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x9')]);router[_0xd20d('0x6')](_0xd20d('0xa'),auth[_0xd20d('0x8')](),controller[_0xd20d('0xb')]);router[_0xd20d('0x6')](_0xd20d('0xc'),auth[_0xd20d('0x8')](),controller['getAnyConditions']);router[_0xd20d('0x6')](_0xd20d('0xd'),auth[_0xd20d('0x8')](),controller['getActions']);router[_0xd20d('0xe')]('/',auth[_0xd20d('0x8')](),controller['create']);router[_0xd20d('0xe')](_0xd20d('0xa'),auth[_0xd20d('0x8')](),controller[_0xd20d('0xf')]);router[_0xd20d('0xe')](_0xd20d('0xc'),auth['isAuthenticated'](),controller[_0xd20d('0x10')]);router[_0xd20d('0xe')](_0xd20d('0xd'),auth['isAuthenticated'](),controller[_0xd20d('0x11')]);router[_0xd20d('0x12')]('/:id',auth[_0xd20d('0x8')](),controller[_0xd20d('0x13')]);router[_0xd20d('0x14')](_0xd20d('0x7'),auth['isAuthenticated'](),controller[_0xd20d('0x15')]);module[_0xd20d('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 144733b..99d3fc8 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 _0xd0a8=['exports','STRING','sequelize'];(function(_0x34c027,_0x123688){var _0x47bff0=function(_0x19c4a9){while(--_0x19c4a9){_0x34c027['push'](_0x34c027['shift']());}};_0x47bff0(++_0x123688);}(_0xd0a8,0x1a9));var _0x8d0a=function(_0x5840f4,_0x1e0e30){_0x5840f4=_0x5840f4-0x0;var _0x42a99c=_0xd0a8[_0x5840f4];return _0x42a99c;};'use strict';var Sequelize=require(_0x8d0a('0x0'));module[_0x8d0a('0x1')]={'name':{'type':Sequelize[_0x8d0a('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xea9a=['sequelize','STRING'];(function(_0x1d2db7,_0x50c9db){var _0x4d907a=function(_0x2d5562){while(--_0x2d5562){_0x1d2db7['push'](_0x1d2db7['shift']());}};_0x4d907a(++_0x50c9db);}(_0xea9a,0xfa));var _0xaea9=function(_0x1f78f8,_0x2f72c5){_0x1f78f8=_0x1f78f8-0x0;var _0x121a3b=_0xea9a[_0x1f78f8];return _0x121a3b;};'use strict';var Sequelize=require(_0xaea9('0x0'));module['exports']={'name':{'type':Sequelize[_0xaea9('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaea9('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 53608b6..6258f14 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 _0x28ea=['limit','count','set','Content-Range','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','render','merge','body','message','agent','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','find','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','getAllConditions','length','getAnyConditions','addAction','Action','getActions','eml-format','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined'];(function(_0x2096b2,_0x45db36){var _0x1f5763=function(_0x339df3){while(--_0x339df3){_0x2096b2['push'](_0x2096b2['shift']());}};_0x1f5763(++_0x45db36);}(_0x28ea,0xa4));var _0xa28e=function(_0xbee8d1,_0x476fb4){_0xbee8d1=_0xbee8d1-0x0;var _0x5e8ef3=_0x28ea[_0xbee8d1];return _0x5e8ef3;};'use strict';var emlformat=require(_0xa28e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa28e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa28e('0x2'));var BPromise=require(_0xa28e('0x3'));var Mustache=require(_0xa28e('0x4'));var util=require(_0xa28e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa28e('0x6'));var ejs=require(_0xa28e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa28e('0x8'));var crypto=require(_0xa28e('0x9'));var jsforce=require(_0xa28e('0xa'));var deskjs=require(_0xa28e('0xb'));var toCsv=require(_0xa28e('0x6'));var querystring=require(_0xa28e('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa28e('0xd'));var as=require(_0xa28e('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa28e('0xf'))('api');var utils=require(_0xa28e('0x10'));var config=require(_0xa28e('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x213894,_0x2301cf){_0x2301cf=_0x2301cf||0xcc;return function(_0x1ffa31){if(_0x1ffa31){return _0x213894[_0xa28e('0x12')](_0x2301cf);}return _0x213894[_0xa28e('0x13')](_0x2301cf)[_0xa28e('0x14')]();};}function respondWithResult(_0x21de94,_0x4afa7a){_0x4afa7a=_0x4afa7a||0xc8;return function(_0x30659a){if(_0x30659a){return _0x21de94[_0xa28e('0x13')](_0x4afa7a)[_0xa28e('0x15')](_0x30659a);}};}function respondWithFilteredResult(_0x524519,_0x38c8fc){return function(_0x347f5a){if(_0x347f5a){var _0x2e7394=typeof _0x38c8fc[_0xa28e('0x16')]===_0xa28e('0x17')&&typeof _0x38c8fc[_0xa28e('0x18')]===_0xa28e('0x17');var _0x269539=_0x347f5a[_0xa28e('0x19')];var _0x5383d3=_0x2e7394?0x0:_0x38c8fc['offset'];var _0x1ec7fc=_0x2e7394?_0x347f5a['count']:_0x38c8fc[_0xa28e('0x16')]+_0x38c8fc['limit'];var _0x294483;if(_0x1ec7fc>=_0x269539){_0x1ec7fc=_0x269539;_0x294483=0xc8;}else{_0x294483=0xce;}_0x524519['status'](_0x294483);return _0x524519[_0xa28e('0x1a')](_0xa28e('0x1b'),_0x5383d3+'-'+_0x1ec7fc+'/'+_0x269539)[_0xa28e('0x15')](_0x347f5a);}return null;};}function patchUpdates(_0x2a13b7){return function(_0x2f3d82){try{jsonpatch['apply'](_0x2f3d82,_0x2a13b7,!![]);}catch(_0x2bdc50){return BPromise[_0xa28e('0x1c')](_0x2bdc50);}return _0x2f3d82[_0xa28e('0x1d')]();};}function saveUpdates(_0x4f3be0,_0x22d064){return function(_0x949f7b){if(_0x949f7b){return _0x949f7b[_0xa28e('0x1e')](_0x4f3be0)[_0xa28e('0x1f')](function(_0x312c31){return _0x312c31;});}return null;};}function removeEntity(_0x23724d,_0x3e0b36){return function(_0x4b276d){if(_0x4b276d){return _0x4b276d[_0xa28e('0x20')]()[_0xa28e('0x1f')](function(){var _0x12fea4=_0x4b276d[_0xa28e('0x21')]({'plain':!![]});var _0x10e0a4=_0xa28e('0x22');return db[_0xa28e('0x23')][_0xa28e('0x20')]({'where':{'type':_0x10e0a4,'resourceId':_0x12fea4['id']}})['then'](function(){return _0x4b276d;});})[_0xa28e('0x1f')](function(){_0x23724d[_0xa28e('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33f7c8,_0x349444){return function(_0x34abb4){if(!_0x34abb4){_0x33f7c8[_0xa28e('0x12')](0x194);}return _0x34abb4;};}function handleError(_0x39ca1a,_0x38a922){_0x38a922=_0x38a922||0x1f4;return function(_0x307e0c){logger[_0xa28e('0x24')](_0x307e0c[_0xa28e('0x25')]);if(_0x307e0c['name']){delete _0x307e0c[_0xa28e('0x26')];}_0x39ca1a[_0xa28e('0x13')](_0x38a922)[_0xa28e('0x27')](_0x307e0c);};}function getMustacheRender(_0x24a04f,_0x278282){return Mustache[_0xa28e('0x28')](_0x24a04f,_[_0xa28e('0x29')](_0x278282[_0xa28e('0x2a')],{'contact':_0x278282['contact'],'message':_0x278282[_0xa28e('0x2b')],'agent':_0x278282[_0xa28e('0x2c')],'interaction':_0x278282['interaction'],'account':_0x278282['account']}))||'';}exports[_0xa28e('0x2d')]=function(_0x21ca9c,_0x5ce0fe){var _0x2fa23b={},_0x92ba86={},_0x4482d4={'count':0x0,'rows':[]};var _0x51b5ae=_[_0xa28e('0x2e')](db[_0xa28e('0x2f')][_0xa28e('0x30')],function(_0x46f326){return{'name':_0x46f326[_0xa28e('0x31')],'type':_0x46f326[_0xa28e('0x32')][_0xa28e('0x33')]};});_0x92ba86[_0xa28e('0x34')]=_['map'](_0x51b5ae,'name');_0x92ba86[_0xa28e('0x35')]=_['keys'](_0x21ca9c[_0xa28e('0x35')]);_0x92ba86[_0xa28e('0x36')]=_[_0xa28e('0x37')](_0x92ba86['model'],_0x92ba86[_0xa28e('0x35')]);_0x2fa23b[_0xa28e('0x38')]=_[_0xa28e('0x37')](_0x92ba86['model'],qs[_0xa28e('0x39')](_0x21ca9c[_0xa28e('0x35')][_0xa28e('0x39')]));_0x2fa23b[_0xa28e('0x38')]=_0x2fa23b[_0xa28e('0x38')]['length']?_0x2fa23b['attributes']:_0x92ba86[_0xa28e('0x34')];if(!_0x21ca9c[_0xa28e('0x35')][_0xa28e('0x3a')](_0xa28e('0x3b'))){_0x2fa23b[_0xa28e('0x18')]=qs['limit'](_0x21ca9c[_0xa28e('0x35')][_0xa28e('0x18')]);_0x2fa23b['offset']=qs[_0xa28e('0x16')](_0x21ca9c[_0xa28e('0x35')][_0xa28e('0x16')]);}_0x2fa23b[_0xa28e('0x3c')]=qs['sort'](_0x21ca9c['query'][_0xa28e('0x3d')]);_0x2fa23b['where']=qs[_0xa28e('0x36')](_[_0xa28e('0x3e')](_0x21ca9c[_0xa28e('0x35')],_0x92ba86['filters']),_0x51b5ae);if(_0x21ca9c[_0xa28e('0x35')][_0xa28e('0x3f')]){_0x2fa23b['where']=_['merge'](_0x2fa23b[_0xa28e('0x40')],{'$or':_[_0xa28e('0x2e')](_0x51b5ae,function(_0x42baf4){if(_0x42baf4['type']!==_0xa28e('0x41')){var _0x3d3bb7={};_0x3d3bb7[_0x42baf4[_0xa28e('0x26')]]={'$like':'%'+_0x21ca9c[_0xa28e('0x35')]['filter']+'%'};return _0x3d3bb7;}})});}_0x2fa23b=_['merge']({},_0x2fa23b,_0x21ca9c['options']);var _0x3d161a={'where':_0x2fa23b[_0xa28e('0x40')]};return db[_0xa28e('0x2f')]['count'](_0x3d161a)['then'](function(_0xbc4507){_0x4482d4[_0xa28e('0x19')]=_0xbc4507;if(_0x21ca9c[_0xa28e('0x35')]['includeAll']){_0x2fa23b[_0xa28e('0x42')]=[{'all':!![]}];}return db[_0xa28e('0x2f')][_0xa28e('0x43')](_0x2fa23b);})[_0xa28e('0x1f')](function(_0xc7dfab){_0x4482d4[_0xa28e('0x44')]=_0xc7dfab;return _0x4482d4;})['then'](respondWithFilteredResult(_0x5ce0fe,_0x2fa23b))[_0xa28e('0x45')](handleError(_0x5ce0fe,null));};exports[_0xa28e('0x46')]=function(_0x20440a,_0x4e889d){var _0x361b5f={'raw':![],'where':{'id':_0x20440a[_0xa28e('0x47')]['id']}},_0x2c4129={};_0x2c4129['model']=_['keys'](db[_0xa28e('0x2f')][_0xa28e('0x30')]);_0x2c4129['query']=_[_0xa28e('0x48')](_0x20440a['query']);_0x2c4129['filters']=_[_0xa28e('0x37')](_0x2c4129[_0xa28e('0x34')],_0x2c4129['query']);_0x361b5f['attributes']=_[_0xa28e('0x37')](_0x2c4129['model'],qs['fields'](_0x20440a[_0xa28e('0x35')][_0xa28e('0x39')]));_0x361b5f[_0xa28e('0x38')]=_0x361b5f[_0xa28e('0x38')]['length']?_0x361b5f[_0xa28e('0x38')]:_0x2c4129[_0xa28e('0x34')];if(_0x20440a[_0xa28e('0x35')][_0xa28e('0x49')]){_0x361b5f[_0xa28e('0x42')]=[{'all':!![]}];}_0x361b5f=_[_0xa28e('0x29')]({},_0x361b5f,_0x20440a[_0xa28e('0x4a')]);return db[_0xa28e('0x2f')]['find'](_0x361b5f)['then'](handleEntityNotFound(_0x4e889d,null))[_0xa28e('0x1f')](respondWithResult(_0x4e889d,null))[_0xa28e('0x45')](handleError(_0x4e889d,null));};exports[_0xa28e('0x4b')]=function(_0xcea81c,_0x5d8dc4){return db[_0xa28e('0x2f')][_0xa28e('0x4b')](_0xcea81c[_0xa28e('0x2a')],{})['then'](function(_0x43e857){var _0x3470f7=_0xcea81c['user'][_0xa28e('0x21')]({'plain':!![]});if(!_0x3470f7)throw new Error(_0xa28e('0x4c'));if(_0x3470f7[_0xa28e('0x4d')]===_0xa28e('0x4e')){var _0xd6d808=_0x43e857['get']({'plain':!![]});var _0x4baa02=_0xa28e('0x22');return db[_0xa28e('0x4f')]['find']({'where':{'name':_0x4baa02,'userProfileId':_0x3470f7[_0xa28e('0x50')]},'raw':!![]})['then'](function(_0x3586ed){if(_0x3586ed&&_0x3586ed['autoAssociation']===0x0){return db['UserProfileResource'][_0xa28e('0x4b')]({'name':_0xd6d808['name'],'resourceId':_0xd6d808['id'],'type':_0x3586ed[_0xa28e('0x26')],'sectionId':_0x3586ed['id']},{})[_0xa28e('0x1f')](function(){return _0x43e857;});}else{return _0x43e857;}})['catch'](function(_0x2cf09c){logger[_0xa28e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cf09c);throw _0x2cf09c;});}return _0x43e857;})[_0xa28e('0x1f')](respondWithResult(_0x5d8dc4,0xc9))[_0xa28e('0x45')](handleError(_0x5d8dc4,null));};exports['update']=function(_0x515174,_0x1f97ff){if(_0x515174[_0xa28e('0x2a')]['id']){delete _0x515174['body']['id'];}return db[_0xa28e('0x2f')][_0xa28e('0x51')]({'where':{'id':_0x515174['params']['id']}})[_0xa28e('0x1f')](handleEntityNotFound(_0x1f97ff,null))[_0xa28e('0x1f')](saveUpdates(_0x515174[_0xa28e('0x2a')],null))[_0xa28e('0x1f')](respondWithResult(_0x1f97ff,null))[_0xa28e('0x45')](handleError(_0x1f97ff,null));};exports[_0xa28e('0x20')]=function(_0x4476d5,_0x162bd4){return db[_0xa28e('0x2f')][_0xa28e('0x51')]({'where':{'id':_0x4476d5['params']['id']}})[_0xa28e('0x1f')](handleEntityNotFound(_0x162bd4,null))['then'](removeEntity(_0x162bd4,null))[_0xa28e('0x45')](handleError(_0x162bd4,null));};exports[_0xa28e('0x52')]=function(_0x53763f,_0x1eabf7,_0x4ddb06){if(_0x53763f[_0xa28e('0x2a')]['id']){delete _0x53763f['body']['id'];}return db[_0xa28e('0x2f')][_0xa28e('0x51')]({'where':{'id':_0x53763f[_0xa28e('0x47')]['id']}})[_0xa28e('0x1f')](handleEntityNotFound(_0x1eabf7,null))[_0xa28e('0x1f')](function(_0x4db092){if(_0x4db092){_0x53763f[_0xa28e('0x2a')][_0xa28e('0x53')]=_0x4db092['id'];return db[_0xa28e('0x54')][_0xa28e('0x4b')](_0x53763f['body']);}})['then'](respondWithResult(_0x1eabf7,null))[_0xa28e('0x45')](handleError(_0x1eabf7,null));};exports[_0xa28e('0x55')]=function(_0x214b7b,_0x45a4c5,_0x108369){if(_0x214b7b['body']['id']){delete _0x214b7b[_0xa28e('0x2a')]['id'];}return db[_0xa28e('0x2f')][_0xa28e('0x51')]({'where':{'id':_0x214b7b['params']['id']}})[_0xa28e('0x1f')](handleEntityNotFound(_0x45a4c5,null))[_0xa28e('0x1f')](function(_0xc7d705){if(_0xc7d705){_0x214b7b['body'][_0xa28e('0x56')]=_0xc7d705['id'];return db[_0xa28e('0x54')][_0xa28e('0x4b')](_0x214b7b[_0xa28e('0x2a')]);}})[_0xa28e('0x1f')](respondWithResult(_0x45a4c5,null))[_0xa28e('0x45')](handleError(_0x45a4c5,null));};exports['getAllConditions']=function(_0x5a96ab,_0x39f6f2,_0x298ddc){var _0x15e9b5={};var _0x8f86ef={};var _0x2bfd55;var _0x148265;return db['Trigger'][_0xa28e('0x57')]({'where':{'id':_0x5a96ab[_0xa28e('0x47')]['id']}})[_0xa28e('0x1f')](handleEntityNotFound(_0x39f6f2,null))[_0xa28e('0x1f')](function(_0x1f383d){if(_0x1f383d){_0x2bfd55=_0x1f383d;_0x8f86ef[_0xa28e('0x34')]=_[_0xa28e('0x48')](db[_0xa28e('0x54')]['rawAttributes']);_0x8f86ef['query']=_['keys'](_0x5a96ab['query']);_0x8f86ef[_0xa28e('0x36')]=_[_0xa28e('0x37')](_0x8f86ef[_0xa28e('0x34')],_0x8f86ef['query']);_0x15e9b5[_0xa28e('0x38')]=_[_0xa28e('0x37')](_0x8f86ef[_0xa28e('0x34')],qs[_0xa28e('0x39')](_0x5a96ab[_0xa28e('0x35')][_0xa28e('0x39')]));_0x15e9b5[_0xa28e('0x38')]=_0x15e9b5['attributes']['length']?_0x15e9b5[_0xa28e('0x38')]:_0x8f86ef[_0xa28e('0x34')];_0x15e9b5[_0xa28e('0x3c')]=qs[_0xa28e('0x3d')](_0x5a96ab[_0xa28e('0x35')][_0xa28e('0x3d')]);_0x15e9b5[_0xa28e('0x40')]=qs[_0xa28e('0x36')](_['pick'](_0x5a96ab['query'],_0x8f86ef[_0xa28e('0x36')]));if(_0x5a96ab['query'][_0xa28e('0x3f')]){_0x15e9b5[_0xa28e('0x40')]=_[_0xa28e('0x29')](_0x15e9b5[_0xa28e('0x40')],{'$or':_[_0xa28e('0x2e')](_0x15e9b5[_0xa28e('0x38')],function(_0x33a884){var _0x3297e3={};_0x3297e3[_0x33a884]={'$like':'%'+_0x5a96ab['query'][_0xa28e('0x3f')]+'%'};return _0x3297e3;})});}_0x15e9b5=_[_0xa28e('0x29')]({},_0x15e9b5,_0x5a96ab[_0xa28e('0x4a')]);return _0x2bfd55[_0xa28e('0x58')](_0x15e9b5);}})[_0xa28e('0x1f')](function(_0x948b1d){if(_0x948b1d){_0x148265=_0x948b1d[_0xa28e('0x59')];if(!_0x5a96ab[_0xa28e('0x35')]['hasOwnProperty'](_0xa28e('0x3b'))){_0x15e9b5[_0xa28e('0x18')]=qs['limit'](_0x5a96ab[_0xa28e('0x35')][_0xa28e('0x18')]);_0x15e9b5['offset']=qs[_0xa28e('0x16')](_0x5a96ab[_0xa28e('0x35')][_0xa28e('0x16')]);}return _0x2bfd55[_0xa28e('0x58')](_0x15e9b5);}})['then'](function(_0x135f36){if(_0x135f36){return _0x135f36?{'count':_0x148265,'rows':_0x135f36}:null;}})[_0xa28e('0x1f')](respondWithResult(_0x39f6f2,null))[_0xa28e('0x45')](handleError(_0x39f6f2,null));};exports[_0xa28e('0x5a')]=function(_0x222d9d,_0xe51b17,_0x273def){var _0x5dd09c={};var _0x3033f0={};var _0x120b0b;var _0x330936;return db[_0xa28e('0x2f')][_0xa28e('0x57')]({'where':{'id':_0x222d9d[_0xa28e('0x47')]['id']}})[_0xa28e('0x1f')](handleEntityNotFound(_0xe51b17,null))[_0xa28e('0x1f')](function(_0x39de3b){if(_0x39de3b){_0x120b0b=_0x39de3b;_0x3033f0[_0xa28e('0x34')]=_['keys'](db[_0xa28e('0x54')][_0xa28e('0x30')]);_0x3033f0[_0xa28e('0x35')]=_['keys'](_0x222d9d[_0xa28e('0x35')]);_0x3033f0['filters']=_[_0xa28e('0x37')](_0x3033f0[_0xa28e('0x34')],_0x3033f0[_0xa28e('0x35')]);_0x5dd09c[_0xa28e('0x38')]=_[_0xa28e('0x37')](_0x3033f0[_0xa28e('0x34')],qs[_0xa28e('0x39')](_0x222d9d[_0xa28e('0x35')][_0xa28e('0x39')]));_0x5dd09c[_0xa28e('0x38')]=_0x5dd09c['attributes'][_0xa28e('0x59')]?_0x5dd09c['attributes']:_0x3033f0[_0xa28e('0x34')];_0x5dd09c[_0xa28e('0x3c')]=qs[_0xa28e('0x3d')](_0x222d9d[_0xa28e('0x35')][_0xa28e('0x3d')]);_0x5dd09c[_0xa28e('0x40')]=qs[_0xa28e('0x36')](_['pick'](_0x222d9d[_0xa28e('0x35')],_0x3033f0[_0xa28e('0x36')]));if(_0x222d9d[_0xa28e('0x35')][_0xa28e('0x3f')]){_0x5dd09c['where']=_['merge'](_0x5dd09c['where'],{'$or':_[_0xa28e('0x2e')](_0x5dd09c[_0xa28e('0x38')],function(_0x24d126){var _0x1b68b2={};_0x1b68b2[_0x24d126]={'$like':'%'+_0x222d9d['query'][_0xa28e('0x3f')]+'%'};return _0x1b68b2;})});}_0x5dd09c=_[_0xa28e('0x29')]({},_0x5dd09c,_0x222d9d[_0xa28e('0x4a')]);return _0x120b0b['getAnyConditions'](_0x5dd09c);}})[_0xa28e('0x1f')](function(_0xaa2d06){if(_0xaa2d06){_0x330936=_0xaa2d06[_0xa28e('0x59')];if(!_0x222d9d[_0xa28e('0x35')][_0xa28e('0x3a')](_0xa28e('0x3b'))){_0x5dd09c[_0xa28e('0x18')]=qs[_0xa28e('0x18')](_0x222d9d[_0xa28e('0x35')][_0xa28e('0x18')]);_0x5dd09c[_0xa28e('0x16')]=qs[_0xa28e('0x16')](_0x222d9d[_0xa28e('0x35')][_0xa28e('0x16')]);}return _0x120b0b['getAnyConditions'](_0x5dd09c);}})[_0xa28e('0x1f')](function(_0x38b985){if(_0x38b985){return _0x38b985?{'count':_0x330936,'rows':_0x38b985}:null;}})[_0xa28e('0x1f')](respondWithResult(_0xe51b17,null))[_0xa28e('0x45')](handleError(_0xe51b17,null));};exports[_0xa28e('0x5b')]=function(_0x28ed3b,_0x5e6717,_0x5b989c){if(_0x28ed3b[_0xa28e('0x2a')]['id']){delete _0x28ed3b[_0xa28e('0x2a')]['id'];}return db['Trigger'][_0xa28e('0x51')]({'where':{'id':_0x28ed3b[_0xa28e('0x47')]['id']}})[_0xa28e('0x1f')](handleEntityNotFound(_0x5e6717,null))[_0xa28e('0x1f')](function(_0x10d0d8){if(_0x10d0d8){_0x28ed3b[_0xa28e('0x2a')]['TriggerId']=_0x10d0d8['id'];return db[_0xa28e('0x5c')][_0xa28e('0x4b')](_0x28ed3b[_0xa28e('0x2a')]);}})[_0xa28e('0x1f')](respondWithResult(_0x5e6717,null))[_0xa28e('0x45')](handleError(_0x5e6717,null));};exports[_0xa28e('0x5d')]=function(_0x2f58d2,_0x492e00,_0x1a4bd6){var _0xbd5a9b={};var _0xd731e7={};var _0x4de1d9;var _0x1aaeef;return db[_0xa28e('0x2f')][_0xa28e('0x57')]({'where':{'id':_0x2f58d2[_0xa28e('0x47')]['id']}})[_0xa28e('0x1f')](handleEntityNotFound(_0x492e00,null))[_0xa28e('0x1f')](function(_0x5e6862){if(_0x5e6862){_0x4de1d9=_0x5e6862;_0xd731e7[_0xa28e('0x34')]=_[_0xa28e('0x48')](db['Action']['rawAttributes']);_0xd731e7[_0xa28e('0x35')]=_['keys'](_0x2f58d2[_0xa28e('0x35')]);_0xd731e7[_0xa28e('0x36')]=_[_0xa28e('0x37')](_0xd731e7[_0xa28e('0x34')],_0xd731e7[_0xa28e('0x35')]);_0xbd5a9b['attributes']=_[_0xa28e('0x37')](_0xd731e7[_0xa28e('0x34')],qs[_0xa28e('0x39')](_0x2f58d2[_0xa28e('0x35')][_0xa28e('0x39')]));_0xbd5a9b['attributes']=_0xbd5a9b[_0xa28e('0x38')][_0xa28e('0x59')]?_0xbd5a9b[_0xa28e('0x38')]:_0xd731e7[_0xa28e('0x34')];_0xbd5a9b['order']=qs['sort'](_0x2f58d2[_0xa28e('0x35')][_0xa28e('0x3d')]);_0xbd5a9b[_0xa28e('0x40')]=qs[_0xa28e('0x36')](_[_0xa28e('0x3e')](_0x2f58d2[_0xa28e('0x35')],_0xd731e7[_0xa28e('0x36')]));if(_0x2f58d2[_0xa28e('0x35')][_0xa28e('0x3f')]){_0xbd5a9b['where']=_['merge'](_0xbd5a9b[_0xa28e('0x40')],{'$or':_[_0xa28e('0x2e')](_0xbd5a9b[_0xa28e('0x38')],function(_0x350665){var _0x4052a6={};_0x4052a6[_0x350665]={'$like':'%'+_0x2f58d2['query'][_0xa28e('0x3f')]+'%'};return _0x4052a6;})});}_0xbd5a9b=_['merge']({},_0xbd5a9b,_0x2f58d2[_0xa28e('0x4a')]);return _0x4de1d9['getActions'](_0xbd5a9b);}})[_0xa28e('0x1f')](function(_0x1dba38){if(_0x1dba38){_0x1aaeef=_0x1dba38[_0xa28e('0x59')];if(!_0x2f58d2['query'][_0xa28e('0x3a')]('nolimit')){_0xbd5a9b[_0xa28e('0x18')]=qs['limit'](_0x2f58d2[_0xa28e('0x35')][_0xa28e('0x18')]);_0xbd5a9b[_0xa28e('0x16')]=qs['offset'](_0x2f58d2[_0xa28e('0x35')]['offset']);}return _0x4de1d9[_0xa28e('0x5d')](_0xbd5a9b);}})[_0xa28e('0x1f')](function(_0x31ec80){if(_0x31ec80){return _0x31ec80?{'count':_0x1aaeef,'rows':_0x31ec80}:null;}})[_0xa28e('0x1f')](respondWithResult(_0x492e00,null))['catch'](handleError(_0x492e00,null));}; \ No newline at end of file +var _0xa864=['length','hasOwnProperty','order','sort','where','filters','pick','filter','options','Trigger','includeAll','include','findAll','rows','show','params','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','keys','nolimit','getAnyConditions','addAction','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','get','Triggers','UserProfileResource','error','stack','name','render','merge','body','account','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes'];(function(_0x1fe672,_0x3aa7f8){var _0x4b2b4f=function(_0x417284){while(--_0x417284){_0x1fe672['push'](_0x1fe672['shift']());}};_0x4b2b4f(++_0x3aa7f8);}(_0xa864,0x141));var _0x4a86=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xa864[_0x550d12];return _0x12103d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a86('0x0'));var zipdir=require(_0x4a86('0x1'));var jsonpatch=require(_0x4a86('0x2'));var rp=require(_0x4a86('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4a86('0x4'));var path=require(_0x4a86('0x5'));var sox=require(_0x4a86('0x6'));var csv=require(_0x4a86('0x7'));var ejs=require(_0x4a86('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4a86('0x9'));var crypto=require('crypto');var jsforce=require(_0x4a86('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4a86('0x7'));var querystring=require(_0x4a86('0xb'));var Papa=require(_0x4a86('0xc'));var Redis=require('ioredis');var authService=require(_0x4a86('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x4a86('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a86('0xf'))(_0x4a86('0x10'));var utils=require(_0x4a86('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x4a86('0x12'));var db=require(_0x4a86('0x13'))['db'];function respondWithStatusCode(_0x3e7da1,_0x53188e){_0x53188e=_0x53188e||0xcc;return function(_0x135548){if(_0x135548){return _0x3e7da1[_0x4a86('0x14')](_0x53188e);}return _0x3e7da1[_0x4a86('0x15')](_0x53188e)[_0x4a86('0x16')]();};}function respondWithResult(_0x3ea2df,_0x39b5d9){_0x39b5d9=_0x39b5d9||0xc8;return function(_0x2bac3a){if(_0x2bac3a){return _0x3ea2df[_0x4a86('0x15')](_0x39b5d9)[_0x4a86('0x17')](_0x2bac3a);}};}function respondWithFilteredResult(_0xa261ac,_0x5a69fb){return function(_0x3c6fd4){if(_0x3c6fd4){var _0x2f92cc=typeof _0x5a69fb[_0x4a86('0x18')]==='undefined'&&typeof _0x5a69fb[_0x4a86('0x19')]===_0x4a86('0x1a');var _0x1d1afd=_0x3c6fd4[_0x4a86('0x1b')];var _0x3123d1=_0x2f92cc?0x0:_0x5a69fb[_0x4a86('0x18')];var _0x680c9f=_0x2f92cc?_0x3c6fd4[_0x4a86('0x1b')]:_0x5a69fb[_0x4a86('0x18')]+_0x5a69fb['limit'];var _0x32a8cf;if(_0x680c9f>=_0x1d1afd){_0x680c9f=_0x1d1afd;_0x32a8cf=0xc8;}else{_0x32a8cf=0xce;}_0xa261ac[_0x4a86('0x15')](_0x32a8cf);return _0xa261ac['set'](_0x4a86('0x1c'),_0x3123d1+'-'+_0x680c9f+'/'+_0x1d1afd)[_0x4a86('0x17')](_0x3c6fd4);}return null;};}function patchUpdates(_0x2e74c0){return function(_0x19d7fc){try{jsonpatch[_0x4a86('0x1d')](_0x19d7fc,_0x2e74c0,!![]);}catch(_0x123e35){return BPromise[_0x4a86('0x1e')](_0x123e35);}return _0x19d7fc[_0x4a86('0x1f')]();};}function saveUpdates(_0xa4df66,_0x29f637){return function(_0x361d1f){if(_0x361d1f){return _0x361d1f[_0x4a86('0x20')](_0xa4df66)['then'](function(_0x5ba482){return _0x5ba482;});}return null;};}function removeEntity(_0x224353,_0x199420){return function(_0x1876d1){if(_0x1876d1){return _0x1876d1[_0x4a86('0x21')]()[_0x4a86('0x22')](function(){var _0x494570=_0x1876d1[_0x4a86('0x23')]({'plain':!![]});var _0x18d15f=_0x4a86('0x24');return db[_0x4a86('0x25')][_0x4a86('0x21')]({'where':{'type':_0x18d15f,'resourceId':_0x494570['id']}})[_0x4a86('0x22')](function(){return _0x1876d1;});})[_0x4a86('0x22')](function(){_0x224353[_0x4a86('0x15')](0xcc)[_0x4a86('0x16')]();});}};}function handleEntityNotFound(_0x1d0b73,_0x36c8ee){return function(_0x827508){if(!_0x827508){_0x1d0b73[_0x4a86('0x14')](0x194);}return _0x827508;};}function handleError(_0x5b6447,_0x491996){_0x491996=_0x491996||0x1f4;return function(_0x3dc539){logger[_0x4a86('0x26')](_0x3dc539[_0x4a86('0x27')]);if(_0x3dc539[_0x4a86('0x28')]){delete _0x3dc539[_0x4a86('0x28')];}_0x5b6447[_0x4a86('0x15')](_0x491996)['send'](_0x3dc539);};}function getMustacheRender(_0x174075,_0x4761a2){return Mustache[_0x4a86('0x29')](_0x174075,_[_0x4a86('0x2a')](_0x4761a2[_0x4a86('0x2b')],{'contact':_0x4761a2['contact'],'message':_0x4761a2['message'],'agent':_0x4761a2['agent'],'interaction':_0x4761a2['interaction'],'account':_0x4761a2[_0x4a86('0x2c')]}))||'';}exports['index']=function(_0x4bada2,_0x384cd0){var _0x357510={},_0xa2a78d={},_0xbe22d0={'count':0x0,'rows':[]};var _0x19e534=_['map'](db['Trigger'][_0x4a86('0x2d')],function(_0x1c3ed9){return{'name':_0x1c3ed9[_0x4a86('0x2e')],'type':_0x1c3ed9[_0x4a86('0x2f')][_0x4a86('0x30')]};});_0xa2a78d[_0x4a86('0x31')]=_[_0x4a86('0x32')](_0x19e534,_0x4a86('0x28'));_0xa2a78d[_0x4a86('0x33')]=_['keys'](_0x4bada2['query']);_0xa2a78d['filters']=_['intersection'](_0xa2a78d[_0x4a86('0x31')],_0xa2a78d[_0x4a86('0x33')]);_0x357510['attributes']=_[_0x4a86('0x34')](_0xa2a78d[_0x4a86('0x31')],qs[_0x4a86('0x35')](_0x4bada2[_0x4a86('0x33')][_0x4a86('0x35')]));_0x357510['attributes']=_0x357510[_0x4a86('0x36')][_0x4a86('0x37')]?_0x357510[_0x4a86('0x36')]:_0xa2a78d[_0x4a86('0x31')];if(!_0x4bada2[_0x4a86('0x33')][_0x4a86('0x38')]('nolimit')){_0x357510[_0x4a86('0x19')]=qs[_0x4a86('0x19')](_0x4bada2[_0x4a86('0x33')]['limit']);_0x357510[_0x4a86('0x18')]=qs[_0x4a86('0x18')](_0x4bada2[_0x4a86('0x33')][_0x4a86('0x18')]);}_0x357510[_0x4a86('0x39')]=qs['sort'](_0x4bada2[_0x4a86('0x33')][_0x4a86('0x3a')]);_0x357510[_0x4a86('0x3b')]=qs[_0x4a86('0x3c')](_[_0x4a86('0x3d')](_0x4bada2[_0x4a86('0x33')],_0xa2a78d['filters']),_0x19e534);if(_0x4bada2[_0x4a86('0x33')][_0x4a86('0x3e')]){_0x357510[_0x4a86('0x3b')]=_[_0x4a86('0x2a')](_0x357510[_0x4a86('0x3b')],{'$or':_[_0x4a86('0x32')](_0x19e534,function(_0xa0f951){if(_0xa0f951[_0x4a86('0x2f')]!=='VIRTUAL'){var _0x144485={};_0x144485[_0xa0f951[_0x4a86('0x28')]]={'$like':'%'+_0x4bada2[_0x4a86('0x33')]['filter']+'%'};return _0x144485;}})});}_0x357510=_[_0x4a86('0x2a')]({},_0x357510,_0x4bada2[_0x4a86('0x3f')]);var _0x16349d={'where':_0x357510[_0x4a86('0x3b')]};return db[_0x4a86('0x40')][_0x4a86('0x1b')](_0x16349d)[_0x4a86('0x22')](function(_0x579f3f){_0xbe22d0['count']=_0x579f3f;if(_0x4bada2[_0x4a86('0x33')][_0x4a86('0x41')]){_0x357510[_0x4a86('0x42')]=[{'all':!![]}];}return db[_0x4a86('0x40')][_0x4a86('0x43')](_0x357510);})['then'](function(_0x185303){_0xbe22d0[_0x4a86('0x44')]=_0x185303;return _0xbe22d0;})[_0x4a86('0x22')](respondWithFilteredResult(_0x384cd0,_0x357510))['catch'](handleError(_0x384cd0,null));};exports[_0x4a86('0x45')]=function(_0x320a5a,_0x30816d){var _0x1b666a={'raw':![],'where':{'id':_0x320a5a[_0x4a86('0x46')]['id']}},_0x1b03cf={};_0x1b03cf[_0x4a86('0x31')]=_['keys'](db[_0x4a86('0x40')][_0x4a86('0x2d')]);_0x1b03cf[_0x4a86('0x33')]=_['keys'](_0x320a5a['query']);_0x1b03cf[_0x4a86('0x3c')]=_['intersection'](_0x1b03cf[_0x4a86('0x31')],_0x1b03cf[_0x4a86('0x33')]);_0x1b666a[_0x4a86('0x36')]=_[_0x4a86('0x34')](_0x1b03cf[_0x4a86('0x31')],qs[_0x4a86('0x35')](_0x320a5a['query'][_0x4a86('0x35')]));_0x1b666a[_0x4a86('0x36')]=_0x1b666a[_0x4a86('0x36')][_0x4a86('0x37')]?_0x1b666a[_0x4a86('0x36')]:_0x1b03cf['model'];if(_0x320a5a['query'][_0x4a86('0x41')]){_0x1b666a[_0x4a86('0x42')]=[{'all':!![]}];}_0x1b666a=_[_0x4a86('0x2a')]({},_0x1b666a,_0x320a5a[_0x4a86('0x3f')]);return db[_0x4a86('0x40')]['find'](_0x1b666a)[_0x4a86('0x22')](handleEntityNotFound(_0x30816d,null))[_0x4a86('0x22')](respondWithResult(_0x30816d,null))[_0x4a86('0x47')](handleError(_0x30816d,null));};exports[_0x4a86('0x48')]=function(_0x31c9ce,_0x31515e){return db[_0x4a86('0x40')]['create'](_0x31c9ce[_0x4a86('0x2b')],{})['then'](function(_0x7266e){var _0x259e44=_0x31c9ce[_0x4a86('0x49')]['get']({'plain':!![]});if(!_0x259e44)throw new Error(_0x4a86('0x4a'));if(_0x259e44[_0x4a86('0x4b')]===_0x4a86('0x49')){var _0x4d2c62=_0x7266e[_0x4a86('0x23')]({'plain':!![]});var _0x1ef3c8=_0x4a86('0x24');return db[_0x4a86('0x4c')][_0x4a86('0x4d')]({'where':{'name':_0x1ef3c8,'userProfileId':_0x259e44[_0x4a86('0x4e')]},'raw':!![]})['then'](function(_0xe294b0){if(_0xe294b0&&_0xe294b0[_0x4a86('0x4f')]===0x0){return db[_0x4a86('0x25')][_0x4a86('0x48')]({'name':_0x4d2c62[_0x4a86('0x28')],'resourceId':_0x4d2c62['id'],'type':_0xe294b0[_0x4a86('0x28')],'sectionId':_0xe294b0['id']},{})[_0x4a86('0x22')](function(){return _0x7266e;});}else{return _0x7266e;}})['catch'](function(_0x1bc9df){logger[_0x4a86('0x26')](_0x4a86('0x50'),_0x1bc9df);throw _0x1bc9df;});}return _0x7266e;})['then'](respondWithResult(_0x31515e,0xc9))[_0x4a86('0x47')](handleError(_0x31515e,null));};exports['update']=function(_0x4cee6b,_0x9aac70){if(_0x4cee6b[_0x4a86('0x2b')]['id']){delete _0x4cee6b[_0x4a86('0x2b')]['id'];}return db['Trigger'][_0x4a86('0x4d')]({'where':{'id':_0x4cee6b[_0x4a86('0x46')]['id']}})[_0x4a86('0x22')](handleEntityNotFound(_0x9aac70,null))[_0x4a86('0x22')](saveUpdates(_0x4cee6b[_0x4a86('0x2b')],null))[_0x4a86('0x22')](respondWithResult(_0x9aac70,null))['catch'](handleError(_0x9aac70,null));};exports[_0x4a86('0x21')]=function(_0x4b78a2,_0x1aa58f){return db['Trigger'][_0x4a86('0x4d')]({'where':{'id':_0x4b78a2[_0x4a86('0x46')]['id']}})['then'](handleEntityNotFound(_0x1aa58f,null))[_0x4a86('0x22')](removeEntity(_0x1aa58f,null))['catch'](handleError(_0x1aa58f,null));};exports[_0x4a86('0x51')]=function(_0x599a8e,_0x239457,_0x1619ca){if(_0x599a8e['body']['id']){delete _0x599a8e[_0x4a86('0x2b')]['id'];}return db[_0x4a86('0x40')][_0x4a86('0x4d')]({'where':{'id':_0x599a8e['params']['id']}})['then'](handleEntityNotFound(_0x239457,null))['then'](function(_0x177076){if(_0x177076){_0x599a8e[_0x4a86('0x2b')][_0x4a86('0x52')]=_0x177076['id'];return db[_0x4a86('0x53')][_0x4a86('0x48')](_0x599a8e[_0x4a86('0x2b')]);}})[_0x4a86('0x22')](respondWithResult(_0x239457,null))[_0x4a86('0x47')](handleError(_0x239457,null));};exports[_0x4a86('0x54')]=function(_0x462a55,_0x15862f,_0x3dcb9b){if(_0x462a55[_0x4a86('0x2b')]['id']){delete _0x462a55[_0x4a86('0x2b')]['id'];}return db[_0x4a86('0x40')][_0x4a86('0x4d')]({'where':{'id':_0x462a55[_0x4a86('0x46')]['id']}})[_0x4a86('0x22')](handleEntityNotFound(_0x15862f,null))[_0x4a86('0x22')](function(_0x6071bb){if(_0x6071bb){_0x462a55[_0x4a86('0x2b')][_0x4a86('0x55')]=_0x6071bb['id'];return db[_0x4a86('0x53')]['create'](_0x462a55[_0x4a86('0x2b')]);}})[_0x4a86('0x22')](respondWithResult(_0x15862f,null))[_0x4a86('0x47')](handleError(_0x15862f,null));};exports[_0x4a86('0x56')]=function(_0x4d41ad,_0x41a94d,_0x59d3b7){var _0x251172={};var _0x1da8b0={};var _0x1b685a;var _0x4cee8d;return db[_0x4a86('0x40')][_0x4a86('0x57')]({'where':{'id':_0x4d41ad[_0x4a86('0x46')]['id']}})['then'](handleEntityNotFound(_0x41a94d,null))[_0x4a86('0x22')](function(_0x54aca8){if(_0x54aca8){_0x1b685a=_0x54aca8;_0x1da8b0['model']=_[_0x4a86('0x58')](db[_0x4a86('0x53')][_0x4a86('0x2d')]);_0x1da8b0['query']=_[_0x4a86('0x58')](_0x4d41ad[_0x4a86('0x33')]);_0x1da8b0[_0x4a86('0x3c')]=_[_0x4a86('0x34')](_0x1da8b0[_0x4a86('0x31')],_0x1da8b0[_0x4a86('0x33')]);_0x251172[_0x4a86('0x36')]=_['intersection'](_0x1da8b0[_0x4a86('0x31')],qs['fields'](_0x4d41ad[_0x4a86('0x33')]['fields']));_0x251172['attributes']=_0x251172[_0x4a86('0x36')][_0x4a86('0x37')]?_0x251172[_0x4a86('0x36')]:_0x1da8b0['model'];_0x251172[_0x4a86('0x39')]=qs['sort'](_0x4d41ad['query'][_0x4a86('0x3a')]);_0x251172['where']=qs['filters'](_[_0x4a86('0x3d')](_0x4d41ad['query'],_0x1da8b0[_0x4a86('0x3c')]));if(_0x4d41ad[_0x4a86('0x33')]['filter']){_0x251172['where']=_[_0x4a86('0x2a')](_0x251172[_0x4a86('0x3b')],{'$or':_['map'](_0x251172[_0x4a86('0x36')],function(_0x132e3b){var _0x330227={};_0x330227[_0x132e3b]={'$like':'%'+_0x4d41ad[_0x4a86('0x33')]['filter']+'%'};return _0x330227;})});}_0x251172=_[_0x4a86('0x2a')]({},_0x251172,_0x4d41ad[_0x4a86('0x3f')]);return _0x1b685a[_0x4a86('0x56')](_0x251172);}})[_0x4a86('0x22')](function(_0x5eda11){if(_0x5eda11){_0x4cee8d=_0x5eda11[_0x4a86('0x37')];if(!_0x4d41ad['query'][_0x4a86('0x38')](_0x4a86('0x59'))){_0x251172[_0x4a86('0x19')]=qs[_0x4a86('0x19')](_0x4d41ad[_0x4a86('0x33')][_0x4a86('0x19')]);_0x251172['offset']=qs[_0x4a86('0x18')](_0x4d41ad[_0x4a86('0x33')]['offset']);}return _0x1b685a[_0x4a86('0x56')](_0x251172);}})[_0x4a86('0x22')](function(_0x468154){if(_0x468154){return _0x468154?{'count':_0x4cee8d,'rows':_0x468154}:null;}})['then'](respondWithResult(_0x41a94d,null))['catch'](handleError(_0x41a94d,null));};exports[_0x4a86('0x5a')]=function(_0x5ae53c,_0x2cf50e,_0x4281ee){var _0x1b4c11={};var _0xe7b87b={};var _0x348c49;var _0x5b98f7;return db[_0x4a86('0x40')][_0x4a86('0x57')]({'where':{'id':_0x5ae53c['params']['id']}})['then'](handleEntityNotFound(_0x2cf50e,null))[_0x4a86('0x22')](function(_0x217594){if(_0x217594){_0x348c49=_0x217594;_0xe7b87b[_0x4a86('0x31')]=_['keys'](db['Condition'][_0x4a86('0x2d')]);_0xe7b87b['query']=_[_0x4a86('0x58')](_0x5ae53c[_0x4a86('0x33')]);_0xe7b87b[_0x4a86('0x3c')]=_[_0x4a86('0x34')](_0xe7b87b[_0x4a86('0x31')],_0xe7b87b['query']);_0x1b4c11[_0x4a86('0x36')]=_[_0x4a86('0x34')](_0xe7b87b['model'],qs[_0x4a86('0x35')](_0x5ae53c['query'][_0x4a86('0x35')]));_0x1b4c11[_0x4a86('0x36')]=_0x1b4c11['attributes'][_0x4a86('0x37')]?_0x1b4c11['attributes']:_0xe7b87b[_0x4a86('0x31')];_0x1b4c11[_0x4a86('0x39')]=qs[_0x4a86('0x3a')](_0x5ae53c[_0x4a86('0x33')][_0x4a86('0x3a')]);_0x1b4c11[_0x4a86('0x3b')]=qs['filters'](_[_0x4a86('0x3d')](_0x5ae53c['query'],_0xe7b87b['filters']));if(_0x5ae53c[_0x4a86('0x33')][_0x4a86('0x3e')]){_0x1b4c11[_0x4a86('0x3b')]=_[_0x4a86('0x2a')](_0x1b4c11[_0x4a86('0x3b')],{'$or':_[_0x4a86('0x32')](_0x1b4c11['attributes'],function(_0x865437){var _0x4e603f={};_0x4e603f[_0x865437]={'$like':'%'+_0x5ae53c[_0x4a86('0x33')][_0x4a86('0x3e')]+'%'};return _0x4e603f;})});}_0x1b4c11=_['merge']({},_0x1b4c11,_0x5ae53c[_0x4a86('0x3f')]);return _0x348c49['getAnyConditions'](_0x1b4c11);}})['then'](function(_0x12cc46){if(_0x12cc46){_0x5b98f7=_0x12cc46[_0x4a86('0x37')];if(!_0x5ae53c[_0x4a86('0x33')]['hasOwnProperty'](_0x4a86('0x59'))){_0x1b4c11[_0x4a86('0x19')]=qs[_0x4a86('0x19')](_0x5ae53c[_0x4a86('0x33')]['limit']);_0x1b4c11[_0x4a86('0x18')]=qs[_0x4a86('0x18')](_0x5ae53c[_0x4a86('0x33')]['offset']);}return _0x348c49[_0x4a86('0x5a')](_0x1b4c11);}})[_0x4a86('0x22')](function(_0x39d121){if(_0x39d121){return _0x39d121?{'count':_0x5b98f7,'rows':_0x39d121}:null;}})['then'](respondWithResult(_0x2cf50e,null))[_0x4a86('0x47')](handleError(_0x2cf50e,null));};exports[_0x4a86('0x5b')]=function(_0x4f3164,_0xee6521,_0x559e98){if(_0x4f3164[_0x4a86('0x2b')]['id']){delete _0x4f3164['body']['id'];}return db[_0x4a86('0x40')][_0x4a86('0x4d')]({'where':{'id':_0x4f3164[_0x4a86('0x46')]['id']}})['then'](handleEntityNotFound(_0xee6521,null))['then'](function(_0xc49cd8){if(_0xc49cd8){_0x4f3164[_0x4a86('0x2b')]['TriggerId']=_0xc49cd8['id'];return db[_0x4a86('0x5c')][_0x4a86('0x48')](_0x4f3164[_0x4a86('0x2b')]);}})['then'](respondWithResult(_0xee6521,null))[_0x4a86('0x47')](handleError(_0xee6521,null));};exports[_0x4a86('0x5d')]=function(_0x335935,_0x43b897,_0x1000a3){var _0x22a1a4={};var _0x355d6e={};var _0x3d4566;var _0x2d453a;return db['Trigger'][_0x4a86('0x57')]({'where':{'id':_0x335935[_0x4a86('0x46')]['id']}})[_0x4a86('0x22')](handleEntityNotFound(_0x43b897,null))[_0x4a86('0x22')](function(_0x2dc106){if(_0x2dc106){_0x3d4566=_0x2dc106;_0x355d6e['model']=_[_0x4a86('0x58')](db[_0x4a86('0x5c')][_0x4a86('0x2d')]);_0x355d6e[_0x4a86('0x33')]=_[_0x4a86('0x58')](_0x335935[_0x4a86('0x33')]);_0x355d6e['filters']=_[_0x4a86('0x34')](_0x355d6e[_0x4a86('0x31')],_0x355d6e[_0x4a86('0x33')]);_0x22a1a4[_0x4a86('0x36')]=_['intersection'](_0x355d6e['model'],qs['fields'](_0x335935[_0x4a86('0x33')][_0x4a86('0x35')]));_0x22a1a4[_0x4a86('0x36')]=_0x22a1a4[_0x4a86('0x36')][_0x4a86('0x37')]?_0x22a1a4[_0x4a86('0x36')]:_0x355d6e['model'];_0x22a1a4['order']=qs[_0x4a86('0x3a')](_0x335935[_0x4a86('0x33')]['sort']);_0x22a1a4[_0x4a86('0x3b')]=qs[_0x4a86('0x3c')](_[_0x4a86('0x3d')](_0x335935[_0x4a86('0x33')],_0x355d6e['filters']));if(_0x335935['query'][_0x4a86('0x3e')]){_0x22a1a4['where']=_[_0x4a86('0x2a')](_0x22a1a4['where'],{'$or':_[_0x4a86('0x32')](_0x22a1a4[_0x4a86('0x36')],function(_0x23eca0){var _0x1b540a={};_0x1b540a[_0x23eca0]={'$like':'%'+_0x335935[_0x4a86('0x33')][_0x4a86('0x3e')]+'%'};return _0x1b540a;})});}_0x22a1a4=_[_0x4a86('0x2a')]({},_0x22a1a4,_0x335935[_0x4a86('0x3f')]);return _0x3d4566['getActions'](_0x22a1a4);}})[_0x4a86('0x22')](function(_0x41cfc6){if(_0x41cfc6){_0x2d453a=_0x41cfc6['length'];if(!_0x335935['query']['hasOwnProperty'](_0x4a86('0x59'))){_0x22a1a4[_0x4a86('0x19')]=qs[_0x4a86('0x19')](_0x335935[_0x4a86('0x33')][_0x4a86('0x19')]);_0x22a1a4[_0x4a86('0x18')]=qs['offset'](_0x335935[_0x4a86('0x33')][_0x4a86('0x18')]);}return _0x3d4566['getActions'](_0x22a1a4);}})[_0x4a86('0x22')](function(_0x78e45a){if(_0x78e45a){return _0x78e45a?{'count':_0x2d453a,'rows':_0x78e45a}:null;}})[_0x4a86('0x22')](respondWithResult(_0x43b897,null))[_0x4a86('0x47')](handleError(_0x43b897,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 1c534a3..bbbb5da 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 _0xed4f=['tools_triggers','lodash','util','../../config/logger','moment','bluebird','./trigger.attributes','define'];(function(_0x2ec512,_0x439cfb){var _0xe83d38=function(_0x33669d){while(--_0x33669d){_0x2ec512['push'](_0x2ec512['shift']());}};_0xe83d38(++_0x439cfb);}(_0xed4f,0x111));var _0xfed4=function(_0x108995,_0x5da69e){_0x108995=_0x108995-0x0;var _0xcde1b4=_0xed4f[_0x108995];return _0xcde1b4;};'use strict';var _=require(_0xfed4('0x0'));var util=require(_0xfed4('0x1'));var logger=require(_0xfed4('0x2'))('api');var moment=require(_0xfed4('0x3'));var BPromise=require(_0xfed4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfed4('0x5'));module['exports']=function(_0x3dbcdd,_0x4f82d1){return _0x3dbcdd[_0xfed4('0x6')]('Trigger',attributes,{'tableName':_0xfed4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa88c=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./trigger.attributes','exports','define','Trigger','tools_triggers'];(function(_0x4df28a,_0x406fdc){var _0x15503a=function(_0x2e7478){while(--_0x2e7478){_0x4df28a['push'](_0x4df28a['shift']());}};_0x15503a(++_0x406fdc);}(_0xa88c,0xc3));var _0xca88=function(_0x306be6,_0x1b6114){_0x306be6=_0x306be6-0x0;var _0x1490fb=_0xa88c[_0x306be6];return _0x1490fb;};'use strict';var _=require(_0xca88('0x0'));var util=require(_0xca88('0x1'));var logger=require(_0xca88('0x2'))(_0xca88('0x3'));var moment=require('moment');var BPromise=require(_0xca88('0x4'));var rp=require(_0xca88('0x5'));var fs=require('fs');var path=require(_0xca88('0x6'));var rimraf=require(_0xca88('0x7'));var config=require('../../config/environment');var attributes=require(_0xca88('0x8'));module[_0xca88('0x9')]=function(_0x11ba19,_0x54b073){return _0x11ba19[_0xca88('0xa')](_0xca88('0xb'),attributes,{'tableName':_0xca88('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 b73f2bb..c06be10 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 _0x5c00=['where','limit','include','map','model','attributes','ShowTrigger','Trigger','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetTrigger','findAll','options','raw'];(function(_0x3cd066,_0x54a0c2){var _0x9fdfb4=function(_0x36cbe5){while(--_0x36cbe5){_0x3cd066['push'](_0x3cd066['shift']());}};_0x9fdfb4(++_0x54a0c2);}(_0x5c00,0x17e));var _0x05c0=function(_0x24dc31,_0x268d9e){_0x24dc31=_0x24dc31-0x0;var _0x17ecd5=_0x5c00[_0x24dc31];return _0x17ecd5;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var moment=require(_0x05c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x05c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05c0('0x4'))['db'];var utils=require(_0x05c0('0x5'));var logger=require(_0x05c0('0x6'))(_0x05c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x05c0('0x8'));var client=jayson[_0x05c0('0x9')][_0x05c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27dc10,_0x5b9f09,_0x3a3b1b){return new BPromise(function(_0x34eb5f,_0x3ad5b7){return client['request'](_0x27dc10,_0x3a3b1b)[_0x05c0('0xb')](function(_0x32cdfa){logger[_0x05c0('0xc')](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));logger[_0x05c0('0xf')]('Trigger,\x20%s,\x20%s,\x20%s',_0x5b9f09,'request\x20sent',JSON[_0x05c0('0x10')](_0x32cdfa));if(_0x32cdfa['error']){if(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x12')]===0x1f4){logger[_0x05c0('0x11')]('Trigger,\x20%s,\x20%s',_0x5b9f09,_0x32cdfa[_0x05c0('0x11')]['message']);return _0x3ad5b7(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);return _0x34eb5f(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}else{logger['info'](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));_0x34eb5f(_0x32cdfa[_0x05c0('0x14')][_0x05c0('0x13')]);}})[_0x05c0('0x15')](function(_0x40153e){logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x40153e);_0x3ad5b7(_0x40153e);});});}exports[_0x05c0('0x16')]=function(_0x521cbd){var _0x422401=this;return new Promise(function(_0x1230e5,_0x4613c0){return db['Trigger'][_0x05c0('0x17')]({'raw':_0x521cbd[_0x05c0('0x18')]?_0x521cbd[_0x05c0('0x18')][_0x05c0('0x19')]===undefined?!![]:![]:!![],'where':_0x521cbd[_0x05c0('0x18')]?_0x521cbd['options'][_0x05c0('0x1a')]||null:null,'attributes':_0x521cbd[_0x05c0('0x18')]?_0x521cbd['options']['attributes']||null:null,'limit':_0x521cbd['options']?_0x521cbd[_0x05c0('0x18')][_0x05c0('0x1b')]||null:null,'include':_0x521cbd[_0x05c0('0x18')]?_0x521cbd[_0x05c0('0x18')][_0x05c0('0x1c')]?_[_0x05c0('0x1d')](_0x521cbd[_0x05c0('0x18')]['include'],function(_0x9b4930){return{'model':db[_0x9b4930[_0x05c0('0x1e')]],'as':_0x9b4930['as'],'attributes':_0x9b4930['attributes'],'include':_0x9b4930['include']?_['map'](_0x9b4930['include'],function(_0x56aa78){return{'model':db[_0x56aa78[_0x05c0('0x1e')]],'as':_0x56aa78['as'],'attributes':_0x56aa78[_0x05c0('0x1f')],'include':_0x56aa78['include']?_[_0x05c0('0x1d')](_0x56aa78[_0x05c0('0x1c')],function(_0x3617dc){return{'model':db[_0x3617dc[_0x05c0('0x1e')]],'as':_0x3617dc['as'],'attributes':_0x3617dc['attributes']};}):[]};}):[]};}):[]:[]})[_0x05c0('0xb')](function(_0x1c14b1){logger[_0x05c0('0xc')](_0x05c0('0x16'),_0x521cbd);logger[_0x05c0('0xf')](_0x05c0('0x16'),_0x521cbd,JSON['stringify'](_0x1c14b1));_0x1230e5(_0x1c14b1);})['catch'](function(_0x2df109){logger[_0x05c0('0x11')](_0x05c0('0x16'),_0x2df109[_0x05c0('0x13')],_0x521cbd);_0x4613c0(_0x422401[_0x05c0('0x11')](0x1f4,_0x2df109[_0x05c0('0x13')]));});});};exports[_0x05c0('0x20')]=function(_0x3c9eb1){var _0x33eff3=this;return new Promise(function(_0x87b07c,_0x3e38f0){return db[_0x05c0('0x21')]['find']({'raw':_0x3c9eb1['options']?_0x3c9eb1[_0x05c0('0x18')][_0x05c0('0x19')]===undefined?!![]:![]:!![],'where':_0x3c9eb1[_0x05c0('0x18')]?_0x3c9eb1['options'][_0x05c0('0x1a')]||null:null,'attributes':_0x3c9eb1[_0x05c0('0x18')]?_0x3c9eb1['options'][_0x05c0('0x1f')]||null:null,'include':_0x3c9eb1['options']?_0x3c9eb1[_0x05c0('0x18')][_0x05c0('0x1c')]?_[_0x05c0('0x1d')](_0x3c9eb1[_0x05c0('0x18')][_0x05c0('0x1c')],function(_0x2a9e82){return{'model':db[_0x2a9e82[_0x05c0('0x1e')]],'as':_0x2a9e82['as'],'attributes':_0x2a9e82[_0x05c0('0x1f')],'include':_0x2a9e82[_0x05c0('0x1c')]?_[_0x05c0('0x1d')](_0x2a9e82[_0x05c0('0x1c')],function(_0x3a9c63){return{'model':db[_0x3a9c63[_0x05c0('0x1e')]],'as':_0x3a9c63['as'],'attributes':_0x3a9c63[_0x05c0('0x1f')],'include':_0x3a9c63[_0x05c0('0x1c')]?_[_0x05c0('0x1d')](_0x3a9c63[_0x05c0('0x1c')],function(_0x21c22){return{'model':db[_0x21c22[_0x05c0('0x1e')]],'as':_0x21c22['as'],'attributes':_0x21c22[_0x05c0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x05c0('0xb')](function(_0x337847){logger[_0x05c0('0xc')](_0x05c0('0x20'),_0x3c9eb1);logger[_0x05c0('0xf')](_0x05c0('0x20'),_0x3c9eb1,JSON[_0x05c0('0x10')](_0x337847));_0x87b07c(_0x337847);})[_0x05c0('0x15')](function(_0x40d4db){logger[_0x05c0('0x11')](_0x05c0('0x20'),_0x40d4db[_0x05c0('0x13')],_0x3c9eb1);_0x3e38f0(_0x33eff3[_0x05c0('0x11')](0x1f4,_0x40d4db['message']));});});}; \ No newline at end of file +var _0xab40=['Trigger,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Trigger','findAll','options','limit','include','model','map','attributes','GetTrigger','ShowTrigger','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','Trigger,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x40cc92,_0x4114ad){var _0x5c68e5=function(_0x2b7b46){while(--_0x2b7b46){_0x40cc92['push'](_0x40cc92['shift']());}};_0x5c68e5(++_0x4114ad);}(_0xab40,0xcd));var _0x0ab4=function(_0x132e1c,_0x9ef7da){_0x132e1c=_0x132e1c-0x0;var _0x4147c1=_0xab40[_0x132e1c];return _0x4147c1;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ab4('0x2'));var db=require(_0x0ab4('0x3'))['db'];var utils=require(_0x0ab4('0x4'));var logger=require(_0x0ab4('0x5'))(_0x0ab4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ab4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10d92b,_0x46d16a,_0x11e99f){return new BPromise(function(_0x6d135d,_0x4cf8de){return client['request'](_0x10d92b,_0x11e99f)['then'](function(_0x24271e){logger[_0x0ab4('0x8')](_0x0ab4('0x9'),_0x46d16a,_0x0ab4('0xa'));logger[_0x0ab4('0xb')](_0x0ab4('0xc'),_0x46d16a,_0x0ab4('0xa'),JSON[_0x0ab4('0xd')](_0x24271e));if(_0x24271e['error']){if(_0x24271e['error'][_0x0ab4('0xe')]===0x1f4){logger['error'](_0x0ab4('0x9'),_0x46d16a,_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);return _0x4cf8de(_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);}logger[_0x0ab4('0xf')](_0x0ab4('0x9'),_0x46d16a,_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);return _0x6d135d(_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);}else{logger[_0x0ab4('0x8')](_0x0ab4('0x9'),_0x46d16a,_0x0ab4('0xa'));_0x6d135d(_0x24271e[_0x0ab4('0x11')][_0x0ab4('0x10')]);}})[_0x0ab4('0x12')](function(_0x2bdda7){logger['error']('Trigger,\x20%s,\x20%s',_0x46d16a,_0x2bdda7);_0x4cf8de(_0x2bdda7);});});}exports['GetTrigger']=function(_0x17422f){var _0x30d5df=this;return new Promise(function(_0x2f50d2,_0x53723c){return db[_0x0ab4('0x13')][_0x0ab4('0x14')]({'raw':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x17422f['options']?_0x17422f[_0x0ab4('0x15')]['where']||null:null,'attributes':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['attributes']||null:null,'limit':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')][_0x0ab4('0x16')]||null:null,'include':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['include']?_['map'](_0x17422f[_0x0ab4('0x15')][_0x0ab4('0x17')],function(_0x392afe){return{'model':db[_0x392afe[_0x0ab4('0x18')]],'as':_0x392afe['as'],'attributes':_0x392afe['attributes'],'include':_0x392afe[_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x392afe[_0x0ab4('0x17')],function(_0x4ea9aa){return{'model':db[_0x4ea9aa['model']],'as':_0x4ea9aa['as'],'attributes':_0x4ea9aa[_0x0ab4('0x1a')],'include':_0x4ea9aa[_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x4ea9aa['include'],function(_0x519b23){return{'model':db[_0x519b23['model']],'as':_0x519b23['as'],'attributes':_0x519b23[_0x0ab4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bf844){logger[_0x0ab4('0x8')]('GetTrigger',_0x17422f);logger['debug']('GetTrigger',_0x17422f,JSON[_0x0ab4('0xd')](_0x3bf844));_0x2f50d2(_0x3bf844);})[_0x0ab4('0x12')](function(_0x1cfdad){logger[_0x0ab4('0xf')](_0x0ab4('0x1b'),_0x1cfdad['message'],_0x17422f);_0x53723c(_0x30d5df['error'](0x1f4,_0x1cfdad['message']));});});};exports[_0x0ab4('0x1c')]=function(_0x2b66d5){var _0x155d96=this;return new Promise(function(_0x182bbe,_0x46eda7){return db['Trigger']['find']({'raw':_0x2b66d5[_0x0ab4('0x15')]?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b66d5['options']?_0x2b66d5['options'][_0x0ab4('0x1e')]||null:null,'attributes':_0x2b66d5['options']?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x1a')]||null:null,'include':_0x2b66d5[_0x0ab4('0x15')]?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x2b66d5['options'][_0x0ab4('0x17')],function(_0x4696fc){return{'model':db[_0x4696fc[_0x0ab4('0x18')]],'as':_0x4696fc['as'],'attributes':_0x4696fc[_0x0ab4('0x1a')],'include':_0x4696fc['include']?_['map'](_0x4696fc[_0x0ab4('0x17')],function(_0x3e65a1){return{'model':db[_0x3e65a1[_0x0ab4('0x18')]],'as':_0x3e65a1['as'],'attributes':_0x3e65a1['attributes'],'include':_0x3e65a1['include']?_['map'](_0x3e65a1[_0x0ab4('0x17')],function(_0x35eab3){return{'model':db[_0x35eab3[_0x0ab4('0x18')]],'as':_0x35eab3['as'],'attributes':_0x35eab3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x492943){logger[_0x0ab4('0x8')](_0x0ab4('0x1c'),_0x2b66d5);logger[_0x0ab4('0xb')](_0x0ab4('0x1c'),_0x2b66d5,JSON[_0x0ab4('0xd')](_0x492943));_0x182bbe(_0x492943);})[_0x0ab4('0x12')](function(_0x52d9bf){logger[_0x0ab4('0xf')](_0x0ab4('0x1c'),_0x52d9bf[_0x0ab4('0x10')],_0x2b66d5);_0x46eda7(_0x155d96['error'](0x1f4,_0x52d9bf[_0x0ab4('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index dbd7588..8523407 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 _0xe193=['put','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','clone','create'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xe193,0x158));var _0x3e19=function(_0x53d9f5,_0x1b9cc6){_0x53d9f5=_0x53d9f5-0x0;var _0x242d96=_0xe193[_0x53d9f5];return _0x242d96;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3e19('0x0'));var timeout=require(_0x3e19('0x1'));var express=require(_0x3e19('0x2'));var router=express[_0x3e19('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3e19('0x4'));var interaction=require(_0x3e19('0x5'));var config=require(_0x3e19('0x6'));var controller=require(_0x3e19('0x7'));router[_0x3e19('0x8')]('/',auth[_0x3e19('0x9')](),controller[_0x3e19('0xa')]);router[_0x3e19('0x8')](_0x3e19('0xb'),auth['isAuthenticated'](),controller[_0x3e19('0xc')]);router[_0x3e19('0xd')]('/:id/clone',auth[_0x3e19('0x9')](),controller[_0x3e19('0xe')]);router[_0x3e19('0xd')]('/',auth[_0x3e19('0x9')](),controller[_0x3e19('0xf')]);router[_0x3e19('0x10')](_0x3e19('0xb'),auth[_0x3e19('0x9')](),controller['update']);router['delete'](_0x3e19('0xb'),auth[_0x3e19('0x9')](),controller[_0x3e19('0x11')]);module['exports']=router; \ No newline at end of file +var _0xedeb=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','index','/:id','show','post','/:id/clone','isAuthenticated','clone','create','put','update','delete','destroy','exports','multer','path'];(function(_0xfdc26,_0x139e49){var _0xa3a052=function(_0x1cfa5b){while(--_0x1cfa5b){_0xfdc26['push'](_0xfdc26['shift']());}};_0xa3a052(++_0x139e49);}(_0xedeb,0x19c));var _0xbede=function(_0x29ecbc,_0x2929d9){_0x29ecbc=_0x29ecbc-0x0;var _0x5709b0=_0xedeb[_0x29ecbc];return _0x5709b0;};'use strict';var multer=require(_0xbede('0x0'));var util=require('util');var path=require(_0xbede('0x1'));var timeout=require(_0xbede('0x2'));var express=require(_0xbede('0x3'));var router=express[_0xbede('0x4')]();var fs_extra=require(_0xbede('0x5'));var auth=require(_0xbede('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbede('0x7'));var controller=require(_0xbede('0x8'));router[_0xbede('0x9')]('/',auth['isAuthenticated'](),controller[_0xbede('0xa')]);router[_0xbede('0x9')](_0xbede('0xb'),auth['isAuthenticated'](),controller[_0xbede('0xc')]);router[_0xbede('0xd')](_0xbede('0xe'),auth[_0xbede('0xf')](),controller[_0xbede('0x10')]);router[_0xbede('0xd')]('/',auth[_0xbede('0xf')](),controller[_0xbede('0x11')]);router[_0xbede('0x12')](_0xbede('0xb'),auth[_0xbede('0xf')](),controller[_0xbede('0x13')]);router[_0xbede('0x14')](_0xbede('0xb'),auth[_0xbede('0xf')](),controller[_0xbede('0x15')]);module[_0xbede('0x16')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index bbd96a8..8bb2035 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 _0xdde4=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always','accept','refuse','originate','uac','uas','fingerprint','certificate','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','user','friend','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','setDataValue','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\x22alaw\x22]','insecure'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xdde4,0xc6));var _0x4dde=function(_0x2cfb09,_0x12a67d){_0x2cfb09=_0x2cfb09-0x0;var _0x28dd46=_0xdde4[_0x2cfb09];return _0x28dd46;};'use strict';var Sequelize=require(_0x4dde('0x0'));module[_0x4dde('0x1')]={'name':{'type':Sequelize[_0x4dde('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4dde('0x3')]('friend',_0x4dde('0x4'),'peer'),'allowNull':![],'defaultValue':_0x4dde('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x4dde('0x3')]('ALLOWED_NOT_SCREENED',_0x4dde('0x6'),_0x4dde('0x7'),_0x4dde('0x8'),_0x4dde('0x9'),'PROHIB_PASSED_SCREEN',_0x4dde('0xa'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x4dde('0x2')]},'secret':{'type':Sequelize[_0x4dde('0x2')]},'md5secret':{'type':Sequelize[_0x4dde('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x4dde('0x2')],'defaultValue':'udp','set':function(_0x353499){this['setDataValue'](_0x4dde('0xb'),_0x353499?_0x353499[_0x4dde('0xc')](','):null);},'get':function(){return this[_0x4dde('0xd')]('transport')?this[_0x4dde('0xd')]('transport')[_0x4dde('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x4dde('0xf'),_0x4dde('0x10'),_0x4dde('0x11'),_0x4dde('0x12'),_0x4dde('0x13')),'defaultValue':_0x4dde('0xf')},'directmedia':{'type':Sequelize[_0x4dde('0x3')](_0x4dde('0x14'),'no',_0x4dde('0x15'),_0x4dde('0x16'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4dde('0x3')](_0x4dde('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x4dde('0x2')]},'nat':{'type':Sequelize[_0x4dde('0x2')],'defaultValue':_0x4dde('0x17'),'set':function(_0x23da34){this[_0x4dde('0x18')]('nat',_0x23da34?_0x23da34[_0x4dde('0xc')](','):null);},'get':function(){return this[_0x4dde('0xd')](_0x4dde('0x19'))?this['getDataValue'](_0x4dde('0x19'))[_0x4dde('0xe')](','):null;},'comment':_0x4dde('0x1a')},'callgroup':{'type':Sequelize[_0x4dde('0x2')]},'namedcallgroup':{'type':Sequelize[_0x4dde('0x2')]},'pickupgroup':{'type':Sequelize[_0x4dde('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x4dde('0x2')]},'language':{'type':Sequelize[_0x4dde('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x4dde('0x1b')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x1fdb67){this['setDataValue'](_0x4dde('0x1c'),_0x1fdb67?_0x1fdb67[_0x4dde('0xc')](';'):_0x4dde('0x1d'));},'get':function(){return this[_0x4dde('0xd')](_0x4dde('0x1c'))?this[_0x4dde('0xd')](_0x4dde('0x1c'))[_0x4dde('0xe')](';'):null;},'comment':_0x4dde('0x1e')},'autoframing':{'type':Sequelize['ENUM'](_0x4dde('0x14'),'no')},'insecure':{'type':Sequelize[_0x4dde('0x2')],'defaultValue':'port,invite','set':function(_0x2e885b){this['setDataValue'](_0x4dde('0x1f'),_0x2e885b?_0x2e885b[_0x4dde('0xc')](','):null);},'get':function(){return this[_0x4dde('0xd')](_0x4dde('0x1f'))?this['getDataValue']('insecure')[_0x4dde('0xe')](','):null;},'comment':_0x4dde('0x20')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4dde('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4dde('0x3')](_0x4dde('0x14'),'no','never')},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0x4dde('0x3')](_0x4dde('0x14'),'no')},'accountcode':{'type':Sequelize[_0x4dde('0x21')](0xb)},'setvar':{'type':Sequelize[_0x4dde('0x2')]},'callerid':{'type':Sequelize[_0x4dde('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x4dde('0x2')]},'callcounter':{'type':Sequelize[_0x4dde('0x3')](_0x4dde('0x14'),'no'),'defaultValue':_0x4dde('0x14')},'busylevel':{'type':Sequelize[_0x4dde('0x21')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x4dde('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0x4dde('0x3')](_0x4dde('0x14'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x4dde('0x14'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0x4dde('0x2')]},'template':{'type':Sequelize[_0x4dde('0x2')]},'videosupport':{'type':Sequelize[_0x4dde('0x3')](_0x4dde('0x14'),'no',_0x4dde('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x4dde('0x3')](_0x4dde('0x14'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0x4dde('0x23'),_0x4dde('0x24'),_0x4dde('0x25'))},'session_expires':{'type':Sequelize[_0x4dde('0x21')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x4dde('0x26'),_0x4dde('0x27')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x4dde('0x2')]},'regexten':{'type':Sequelize[_0x4dde('0x2')]},'fromdomain':{'type':Sequelize[_0x4dde('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4dde('0x21')](0x5)},'qualify':{'type':Sequelize[_0x4dde('0x3')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x4dde('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x4dde('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x4dde('0x21')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4dde('0x2')]},'callbackextension':{'type':Sequelize[_0x4dde('0x2')]},'timert1':{'type':Sequelize[_0x4dde('0x21')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x4dde('0x2')]},'contactdeny':{'type':Sequelize[_0x4dde('0x2')]},'contactacl':{'type':Sequelize[_0x4dde('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x4dde('0x2')]},'use_q850_reason':{'type':Sequelize[_0x4dde('0x2')]},'maxforwards':{'type':Sequelize[_0x4dde('0x21')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x4dde('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4dde('0x3')](_0x4dde('0x14'),'no')},'force_avp':{'type':Sequelize[_0x4dde('0x3')](_0x4dde('0x14'),'no')},'icesupport':{'type':Sequelize[_0x4dde('0x3')](_0x4dde('0x14'),'no')},'dtlsenable':{'type':Sequelize[_0x4dde('0x3')](_0x4dde('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0x4dde('0x3')]('yes','no',_0x4dde('0x28'),_0x4dde('0x29'))},'dtlsrekey':{'type':Sequelize[_0x4dde('0x21')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x4dde('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x4dde('0x2')]},'dtlscapath':{'type':Sequelize[_0x4dde('0x2')]},'dtlssetup':{'type':Sequelize[_0x4dde('0x3')]('active','passive',_0x4dde('0x2a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4dde('0x2')]},'usereqphone':{'type':Sequelize[_0x4dde('0x3')](_0x4dde('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4dde('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x4dde('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x4dde('0x3')](_0x4dde('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0x4dde('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0x4dde('0x2')]},'mohinterpret':{'type':Sequelize[_0x4dde('0x2')]},'mohsuggest':{'type':Sequelize[_0x4dde('0x2')]},'parkinglot':{'type':Sequelize[_0x4dde('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4dde('0x2')],'defaultValue':_0x4dde('0x2b')},'canreinvite':{'type':Sequelize[_0x4dde('0x3')](_0x4dde('0x14'),'no',_0x4dde('0x15'),_0x4dde('0x16'),_0x4dde('0x2c')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x4dde('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x4dde('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xfe4c=['transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','all','ulaw;alaw;gsm','join','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','INTEGER','accept','originate','uac','uas','pai','fingerprint','certificate','active','passive','dynamic','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','user','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','udp'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xfe4c,0x1bd));var _0xcfe4=function(_0x70075a,_0x33562d){_0x70075a=_0x70075a-0x0;var _0x85bc93=_0xfe4c[_0x70075a];return _0x85bc93;};'use strict';var Sequelize=require(_0xcfe4('0x0'));module[_0xcfe4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcfe4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x4'),_0xcfe4('0x5'),'peer'),'allowNull':![],'defaultValue':_0xcfe4('0x4')},'context':{'type':Sequelize[_0xcfe4('0x6')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x7'),_0xcfe4('0x8'),_0xcfe4('0x9'),_0xcfe4('0xa'),_0xcfe4('0xb'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0xcfe4('0xc'))},'deny':{'type':Sequelize[_0xcfe4('0x6')]},'permit':{'type':Sequelize[_0xcfe4('0x6')]},'secret':{'type':Sequelize[_0xcfe4('0x6')]},'md5secret':{'type':Sequelize[_0xcfe4('0x6')]},'remotesecret':{'type':Sequelize[_0xcfe4('0x6')]},'transport':{'type':Sequelize[_0xcfe4('0x6')],'defaultValue':_0xcfe4('0xd'),'set':function(_0x559338){this['setDataValue'](_0xcfe4('0xe'),_0x559338?_0x559338['join'](','):null);},'get':function(){return this[_0xcfe4('0xf')](_0xcfe4('0xe'))?this[_0xcfe4('0xf')]('transport')[_0xcfe4('0x10')](','):null;},'comment':_0xcfe4('0x11')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xcfe4('0x12'),_0xcfe4('0x13'),_0xcfe4('0x14'),_0xcfe4('0x15')),'defaultValue':_0xcfe4('0x16')},'directmedia':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no',_0xcfe4('0x18'),_0xcfe4('0x19'),_0xcfe4('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xcfe4('0x6')]},'directmediadeny':{'type':Sequelize[_0xcfe4('0x6')]},'nat':{'type':Sequelize[_0xcfe4('0x6')],'defaultValue':_0xcfe4('0x1b'),'set':function(_0x433696){this[_0xcfe4('0x1c')]('nat',_0x433696?_0x433696['join'](','):null);},'get':function(){return this['getDataValue'](_0xcfe4('0x1d'))?this['getDataValue']('nat')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xcfe4('0x6')]},'namedcallgroup':{'type':Sequelize[_0xcfe4('0x6')]},'pickupgroup':{'type':Sequelize[_0xcfe4('0x6')]},'namedpickupgroup':{'type':Sequelize[_0xcfe4('0x6')]},'language':{'type':Sequelize[_0xcfe4('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xcfe4('0x6')],'defaultValue':_0xcfe4('0x1e')},'allow':{'type':Sequelize[_0xcfe4('0x6')],'allowNull':![],'defaultValue':_0xcfe4('0x1f'),'set':function(_0x157210){this[_0xcfe4('0x1c')]('allow',_0x157210?_0x157210[_0xcfe4('0x20')](';'):_0xcfe4('0x1f'));},'get':function(){return this['getDataValue'](_0xcfe4('0x21'))?this[_0xcfe4('0xf')](_0xcfe4('0x21'))[_0xcfe4('0x10')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xcfe4('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0xcfe4('0x6')],'defaultValue':_0xcfe4('0x22'),'set':function(_0x2c8add){this['setDataValue'](_0xcfe4('0x23'),_0x2c8add?_0x2c8add['join'](','):null);},'get':function(){return this[_0xcfe4('0xf')]('insecure')?this['getDataValue']('insecure')[_0xcfe4('0x10')](','):null;},'comment':_0xcfe4('0x24')},'trustrpid':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xcfe4('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no','never')},'promiscredir':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no')},'useclientcode':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xcfe4('0x6')],'defaultValue':_0xcfe4('0x25')},'amaflags':{'type':Sequelize[_0xcfe4('0x6')]},'callcounter':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0xcfe4('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0xcfe4('0x6')]},'template':{'type':Sequelize[_0xcfe4('0x6')]},'videosupport':{'type':Sequelize[_0xcfe4('0x3')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no')},'mailbox':{'type':Sequelize[_0xcfe4('0x6')]},'session_timers':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x27'),'refuse',_0xcfe4('0x28'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xcfe4('0x29'),_0xcfe4('0x2a')),'defaultValue':_0xcfe4('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xcfe4('0x6')]},'regexten':{'type':Sequelize[_0xcfe4('0x6')]},'fromdomain':{'type':Sequelize[_0xcfe4('0x6')]},'fromuser':{'type':Sequelize[_0xcfe4('0x6')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no'),'defaultValue':_0xcfe4('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xcfe4('0x6')]},'rtptimeout':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xcfe4('0x17'),'no',_0xcfe4('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcfe4('0x6')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'timerb':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xcfe4('0x6')]},'contactdeny':{'type':Sequelize[_0xcfe4('0x6')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xcfe4('0x6')]},'use_q850_reason':{'type':Sequelize[_0xcfe4('0x6')]},'maxforwards':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'encryption':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcfe4('0x3')]('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0xcfe4('0x17'),'no')},'icesupport':{'type':Sequelize[_0xcfe4('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xcfe4('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no',_0xcfe4('0x2c'),_0xcfe4('0x2d'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xcfe4('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0xcfe4('0x6')]},'dtlscipher':{'type':Sequelize[_0xcfe4('0x6')]},'dtlscafile':{'type':Sequelize[_0xcfe4('0x6')]},'dtlscapath':{'type':Sequelize[_0xcfe4('0x6')]},'dtlssetup':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x2e'),_0xcfe4('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xcfe4('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xcfe4('0x6')]},'recordofffeature':{'type':Sequelize[_0xcfe4('0x6')]},'call_limit':{'type':Sequelize[_0xcfe4('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no')},'vmexten':{'type':Sequelize[_0xcfe4('0x6')]},'mohinterpret':{'type':Sequelize[_0xcfe4('0x6')]},'mohsuggest':{'type':Sequelize[_0xcfe4('0x6')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xcfe4('0x6')],'defaultValue':_0xcfe4('0x30')},'canreinvite':{'type':Sequelize['ENUM'](_0xcfe4('0x17'),'no',_0xcfe4('0x18'),_0xcfe4('0x19'),_0xcfe4('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xcfe4('0x6')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xcfe4('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index c06ee7e..8783e87 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 _0x757a=['/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','server/files/templates/trunk.ejs','/etc/asterisk/sip_xcally_registers.conf','server/files/templates/registry.ejs','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','render','merge','body','contact','agent','interaction','index','map','Trunk','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','clone','options','omit','createdAt','updatedAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','utf8','writeFileSync'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x757a,0xde));var _0xa757=function(_0x403a7b,_0x22fb16){_0x403a7b=_0x403a7b-0x0;var _0x2871bf=_0x757a[_0x403a7b];return _0x2871bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xa757('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x564187,_0x2ed0d2,_0x513b1f,_0x481508){return new BPromise(function(_0x32112b,_0x1b670e){var _0x355f0a=_0x481508||client;return _0x355f0a[_0xa757('0x16')](_0x564187,_0x513b1f)[_0xa757('0x17')](function(_0x31cfd2){logger[_0xa757('0x18')](_0xa757('0x19'),_0x2ed0d2,_0xa757('0x1a'));logger[_0xa757('0x1b')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2ed0d2,_0xa757('0x1a'),JSON[_0xa757('0x1c')](_0x31cfd2));if(_0x31cfd2[_0xa757('0x1d')]){if(_0x31cfd2['error']['code']===0x1f4){logger[_0xa757('0x1d')](_0xa757('0x19'),_0x2ed0d2,_0x31cfd2[_0xa757('0x1d')][_0xa757('0x1e')]);return _0x1b670e(_0x31cfd2[_0xa757('0x1d')][_0xa757('0x1e')]);}logger['error'](_0xa757('0x19'),_0x2ed0d2,_0x31cfd2['error'][_0xa757('0x1e')]);return _0x32112b(_0x31cfd2[_0xa757('0x1d')][_0xa757('0x1e')]);}else{logger[_0xa757('0x18')]('Trunk,\x20%s,\x20%s',_0x2ed0d2,'request\x20sent');_0x32112b(_0x31cfd2[_0xa757('0x1f')][_0xa757('0x1e')]);}})[_0xa757('0x20')](function(_0x8d121f){logger[_0xa757('0x1d')](_0xa757('0x19'),_0x2ed0d2,_0x8d121f);_0x1b670e(_0x8d121f);});});}function respondWithStatusCode(_0x2ca10d,_0x21f1af){_0x21f1af=_0x21f1af||0xcc;return function(_0x2bf276){if(_0x2bf276){return _0x2ca10d['sendStatus'](_0x21f1af);}return _0x2ca10d[_0xa757('0x21')](_0x21f1af)['end']();};}function respondWithResult(_0x422e9e,_0x47903b){_0x47903b=_0x47903b||0xc8;return function(_0x40551d){if(_0x40551d){return _0x422e9e[_0xa757('0x21')](_0x47903b)[_0xa757('0x22')](_0x40551d);}};}function respondWithFilteredResult(_0x4d58a4,_0x2b19d5){return function(_0xcd98bd){if(_0xcd98bd){var _0x471e84=typeof _0x2b19d5[_0xa757('0x23')]==='undefined'&&typeof _0x2b19d5[_0xa757('0x24')]==='undefined';var _0x5a5664=_0xcd98bd['count'];var _0x4f8de2=_0x471e84?0x0:_0x2b19d5[_0xa757('0x23')];var _0x596ae2=_0x471e84?_0xcd98bd[_0xa757('0x25')]:_0x2b19d5[_0xa757('0x23')]+_0x2b19d5['limit'];var _0x2a0c9a;if(_0x596ae2>=_0x5a5664){_0x596ae2=_0x5a5664;_0x2a0c9a=0xc8;}else{_0x2a0c9a=0xce;}_0x4d58a4['status'](_0x2a0c9a);return _0x4d58a4[_0xa757('0x26')](_0xa757('0x27'),_0x4f8de2+'-'+_0x596ae2+'/'+_0x5a5664)['json'](_0xcd98bd);}return null;};}function patchUpdates(_0x235e54){return function(_0x5ade7b){try{jsonpatch[_0xa757('0x28')](_0x5ade7b,_0x235e54,!![]);}catch(_0x27b3e2){return BPromise[_0xa757('0x29')](_0x27b3e2);}return _0x5ade7b[_0xa757('0x2a')]();};}function saveUpdates(_0xcc87c0,_0x2c1885){return function(_0x1a44a9){if(_0x1a44a9){return _0x1a44a9[_0xa757('0x2b')](_0xcc87c0)[_0xa757('0x17')](function(_0x384424){return _0x384424;});}return null;};}function removeEntity(_0x1f5d5a,_0x20735f){return function(_0x25dfbb){if(_0x25dfbb){return _0x25dfbb[_0xa757('0x2c')]()[_0xa757('0x17')](function(){var _0xc1cc20=_0x25dfbb[_0xa757('0x2d')]({'plain':!![]});var _0x1ad384=_0xa757('0x2e');return db[_0xa757('0x2f')][_0xa757('0x2c')]({'where':{'type':_0x1ad384,'resourceId':_0xc1cc20['id']}})[_0xa757('0x17')](function(){return _0x25dfbb;});})[_0xa757('0x17')](function(){_0x1f5d5a[_0xa757('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2adf93,_0x21d6b3){return function(_0x1e9d63){if(!_0x1e9d63){_0x2adf93[_0xa757('0x30')](0x194);}return _0x1e9d63;};}function handleError(_0x1c4c40,_0x51e2aa){_0x51e2aa=_0x51e2aa||0x1f4;return function(_0x1d4414){logger[_0xa757('0x1d')](_0x1d4414[_0xa757('0x31')]);if(_0x1d4414[_0xa757('0x32')]){delete _0x1d4414[_0xa757('0x32')];}_0x1c4c40[_0xa757('0x21')](_0x51e2aa)['send'](_0x1d4414);};}function getMustacheRender(_0x1346c2,_0x444639){return Mustache[_0xa757('0x33')](_0x1346c2,_[_0xa757('0x34')](_0x444639[_0xa757('0x35')],{'contact':_0x444639[_0xa757('0x36')],'message':_0x444639[_0xa757('0x1e')],'agent':_0x444639[_0xa757('0x37')],'interaction':_0x444639[_0xa757('0x38')],'account':_0x444639['account']}))||'';}exports[_0xa757('0x39')]=function(_0x34fba8,_0x9f73c6){var _0x35c15a={},_0x2531be={},_0x2fd99e={'count':0x0,'rows':[]};var _0x501e26=_[_0xa757('0x3a')](db[_0xa757('0x3b')]['rawAttributes'],function(_0x5eae0b){return{'name':_0x5eae0b[_0xa757('0x3c')],'type':_0x5eae0b[_0xa757('0x3d')]['key']};});_0x2531be['model']=_[_0xa757('0x3a')](_0x501e26,_0xa757('0x32'));_0x2531be[_0xa757('0x3e')]=_['keys'](_0x34fba8[_0xa757('0x3e')]);_0x2531be[_0xa757('0x3f')]=_[_0xa757('0x40')](_0x2531be[_0xa757('0x41')],_0x2531be[_0xa757('0x3e')]);_0x35c15a['attributes']=_[_0xa757('0x40')](_0x2531be['model'],qs['fields'](_0x34fba8[_0xa757('0x3e')][_0xa757('0x42')]));_0x35c15a[_0xa757('0x43')]=_0x35c15a[_0xa757('0x43')][_0xa757('0x44')]?_0x35c15a['attributes']:_0x2531be['model'];if(!_0x34fba8[_0xa757('0x3e')][_0xa757('0x45')](_0xa757('0x46'))){_0x35c15a[_0xa757('0x24')]=qs[_0xa757('0x24')](_0x34fba8[_0xa757('0x3e')]['limit']);_0x35c15a[_0xa757('0x23')]=qs[_0xa757('0x23')](_0x34fba8['query'][_0xa757('0x23')]);}_0x35c15a['order']=qs[_0xa757('0x47')](_0x34fba8[_0xa757('0x3e')]['sort']);_0x35c15a[_0xa757('0x48')]=qs[_0xa757('0x3f')](_['pick'](_0x34fba8[_0xa757('0x3e')],_0x2531be[_0xa757('0x3f')]),_0x501e26);if(_0x34fba8[_0xa757('0x3e')][_0xa757('0x49')]){_0x35c15a['where']=_[_0xa757('0x34')](_0x35c15a[_0xa757('0x48')],{'$or':_[_0xa757('0x3a')](_0x501e26,function(_0xec4610){if(_0xec4610['type']!==_0xa757('0x4a')){var _0x5b6017={};_0x5b6017[_0xec4610['name']]={'$like':'%'+_0x34fba8[_0xa757('0x3e')][_0xa757('0x49')]+'%'};return _0x5b6017;}})});}_0x35c15a=_[_0xa757('0x34')]({},_0x35c15a,_0x34fba8['options']);var _0x421c65={'where':_0x35c15a['where']};return db[_0xa757('0x3b')][_0xa757('0x25')](_0x421c65)[_0xa757('0x17')](function(_0xbef575){_0x2fd99e[_0xa757('0x25')]=_0xbef575;if(_0x34fba8[_0xa757('0x3e')][_0xa757('0x4b')]){_0x35c15a[_0xa757('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0xa757('0x4d')](_0x35c15a);})[_0xa757('0x17')](function(_0x33347a){_0x2fd99e[_0xa757('0x4e')]=_0x33347a;return _0x2fd99e;})[_0xa757('0x17')](respondWithFilteredResult(_0x9f73c6,_0x35c15a))[_0xa757('0x20')](handleError(_0x9f73c6,null));};exports[_0xa757('0x4f')]=function(_0x2c5b3c,_0x405397){var _0x1d05d7={'raw':![],'where':{'id':_0x2c5b3c[_0xa757('0x50')]['id']}},_0x16644b={};_0x16644b[_0xa757('0x41')]=_[_0xa757('0x51')](db[_0xa757('0x3b')][_0xa757('0x52')]);_0x16644b['query']=_[_0xa757('0x51')](_0x2c5b3c['query']);_0x16644b[_0xa757('0x3f')]=_[_0xa757('0x40')](_0x16644b[_0xa757('0x41')],_0x16644b[_0xa757('0x3e')]);_0x1d05d7['attributes']=_[_0xa757('0x40')](_0x16644b[_0xa757('0x41')],qs[_0xa757('0x42')](_0x2c5b3c[_0xa757('0x3e')]['fields']));_0x1d05d7[_0xa757('0x43')]=_0x1d05d7[_0xa757('0x43')][_0xa757('0x44')]?_0x1d05d7[_0xa757('0x43')]:_0x16644b[_0xa757('0x41')];if(_0x2c5b3c[_0xa757('0x3e')]['includeAll']){_0x1d05d7['include']=[{'all':!![]}];}_0x1d05d7=_['merge']({},_0x1d05d7,_0x2c5b3c['options']);return db[_0xa757('0x3b')][_0xa757('0x53')](_0x1d05d7)[_0xa757('0x17')](handleEntityNotFound(_0x405397,null))[_0xa757('0x17')](respondWithResult(_0x405397,null))[_0xa757('0x20')](handleError(_0x405397,null));};exports[_0xa757('0x54')]=function(_0x5efb32,_0xe31752){var _0x163d99={'where':{'id':_0x5efb32[_0xa757('0x50')]['id']}},_0x34e03f={};_0x34e03f['model']=_[_0xa757('0x51')](db[_0xa757('0x3b')]['rawAttributes']);_0x163d99[_0xa757('0x43')]=_['intersection'](_0x34e03f[_0xa757('0x41')],qs['fields'](_0x5efb32[_0xa757('0x3e')]['fields']));_0x163d99['attributes']=_0x163d99[_0xa757('0x43')][_0xa757('0x44')]?_0x163d99[_0xa757('0x43')]:_0x34e03f[_0xa757('0x41')];if(_0x5efb32[_0xa757('0x3e')][_0xa757('0x4b')]){_0x163d99['include']=[{'all':!![]}];}_0x163d99=_['merge']({},_0x163d99,_0x5efb32[_0xa757('0x55')]);return db[_0xa757('0x3b')][_0xa757('0x53')](_0x163d99)['then'](handleEntityNotFound(_0xe31752,null))['then'](function(_0x18dff7){if(_0x18dff7){var _0x31c4cd=_0x18dff7[_0xa757('0x2d')]({'plain':!![]});_0x31c4cd=qs[_0xa757('0x56')](_0x31c4cd,['id',_0xa757('0x57'),_0xa757('0x58')]);_0x5efb32['body']=_[_0xa757('0x56')](_0x5efb32[_0xa757('0x35')],['id',_0xa757('0x57'),_0xa757('0x58')]);return db[_0xa757('0x3b')][_0xa757('0x59')](_[_0xa757('0x34')](_0x31c4cd,_0x5efb32[_0xa757('0x35')]),{'include':_0x5efb32[_0xa757('0x3e')][_0xa757('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x9e96e6){var _0x5c803a=_0x5efb32['user'][_0xa757('0x2d')]({'plain':!![]});if(!_0x5c803a)throw new Error(_0xa757('0x5a'));if(_0x5c803a[_0xa757('0x5b')]===_0xa757('0x5c')){var _0x3c3ff1=_0x9e96e6[_0xa757('0x2d')]({'plain':!![]});var _0x1b34ad=_0xa757('0x2e');return db[_0xa757('0x5d')][_0xa757('0x53')]({'where':{'name':_0x1b34ad,'userProfileId':_0x5c803a[_0xa757('0x5e')]},'raw':!![]})['then'](function(_0x3f8c5c){if(_0x3f8c5c&&_0x3f8c5c[_0xa757('0x5f')]===0x0){return db['UserProfileResource'][_0xa757('0x59')]({'name':_0x3c3ff1[_0xa757('0x32')],'resourceId':_0x3c3ff1['id'],'type':_0x3f8c5c[_0xa757('0x32')],'sectionId':_0x3f8c5c['id']},{})[_0xa757('0x17')](function(){return _0x9e96e6;});}else{return _0x9e96e6;}})[_0xa757('0x20')](function(_0x113a33){logger['error'](_0xa757('0x60'),_0x113a33);throw _0x113a33;});}return _0x9e96e6;});}})['then'](respondWithResult(_0xe31752,0xc9))[_0xa757('0x20')](handleError(_0xe31752,null));};exports[_0xa757('0x59')]=function(_0x2d9d97,_0x3c87c0,_0x39ca41){var _0x5c0870;return db['Trunk'][_0xa757('0x59')](_0x2d9d97[_0xa757('0x35')],{'raw':!![]})[_0xa757('0x17')](function(_0x5f450f){_0x5c0870=_0x5f450f;return db[_0xa757('0x3b')]['findAll']({'raw':!![]});})[_0xa757('0x17')](function(_0x294165){var _0x2b0ad4=fs[_0xa757('0x61')](path[_0xa757('0x62')](config[_0xa757('0x63')],'server/files/templates/trunk.ejs'),_0xa757('0x64'));var _0x193233=fs[_0xa757('0x61')](path[_0xa757('0x62')](config[_0xa757('0x63')],'server/files/templates/registry.ejs'),_0xa757('0x64'));var _0x423f3a=ejs[_0xa757('0x33')](_0x2b0ad4,{'trunks':_0x294165||[]});fs[_0xa757('0x65')](_0xa757('0x66'),_0x423f3a);if(_0x5c0870['registry']){var _0x3f1327=ejs[_0xa757('0x33')](_0x193233,{'trunks':_0x294165||[]});fs[_0xa757('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3f1327);}})[_0xa757('0x17')](function(){return respondWithRpcPromise(_0xa757('0x67'),_0xa757('0x59'),{'module':_0xa757('0x68')});})[_0xa757('0x17')](function(){var _0x4695ef=_0x2d9d97[_0xa757('0x5c')][_0xa757('0x2d')]({'plain':!![]});if(!_0x4695ef)throw new Error(_0xa757('0x5a'));if(_0x4695ef[_0xa757('0x5b')]===_0xa757('0x5c')){var _0x404afb=_0x5c0870[_0xa757('0x2d')]({'plain':!![]});return db[_0xa757('0x5d')]['find']({'where':{'name':_0xa757('0x2e'),'userProfileId':_0x4695ef[_0xa757('0x5e')]},'raw':!![]})['then'](function(_0x11f2b3){if(_0x11f2b3&&_0x11f2b3[_0xa757('0x5f')]===0x0){return db['UserProfileResource'][_0xa757('0x59')]({'name':_0x404afb[_0xa757('0x32')],'resourceId':_0x404afb['id'],'type':_0x11f2b3[_0xa757('0x32')],'sectionId':_0x11f2b3['id']},{})[_0xa757('0x17')](function(){return _0x5c0870;});}else{return _0x5c0870;}})[_0xa757('0x20')](function(_0x312542){logger[_0xa757('0x1d')](_0xa757('0x60'),_0x312542);throw _0x312542;});}return _0x5c0870;})[_0xa757('0x17')](respondWithResult(_0x3c87c0,0xc9))[_0xa757('0x20')](handleError(_0x3c87c0,null));};exports[_0xa757('0x2b')]=function(_0x189195,_0x2c2b40,_0x46bc34){var _0x27604c;return db[_0xa757('0x3b')]['find']({'where':{'id':_0x189195[_0xa757('0x50')]['id']}})['then'](handleEntityNotFound(_0x2c2b40,null))[_0xa757('0x17')](saveUpdates(_0x189195[_0xa757('0x35')],null))[_0xa757('0x17')](function(_0x3d92ca){if(_0x3d92ca){_0x27604c=_0x3d92ca;return db[_0xa757('0x3b')]['findAll']({'raw':!![]});}})[_0xa757('0x17')](function(_0x67a58b){if(_0x67a58b){var _0x3a8dce=fs['readFileSync'](path[_0xa757('0x62')](config[_0xa757('0x63')],_0xa757('0x69')),'utf8');var _0x501134=fs[_0xa757('0x61')](path[_0xa757('0x62')](config[_0xa757('0x63')],'server/files/templates/registry.ejs'),_0xa757('0x64'));var _0x4cc1ad=ejs['render'](_0x3a8dce,{'trunks':_0x67a58b||[]});fs[_0xa757('0x65')](_0xa757('0x66'),_0x4cc1ad);var _0x476297=ejs['render'](_0x501134,{'trunks':_0x67a58b||[]});fs[_0xa757('0x65')](_0xa757('0x6a'),_0x476297);return respondWithRpcPromise(_0xa757('0x67'),_0xa757('0x2b'),{'module':_0xa757('0x68')});}return null;})[_0xa757('0x17')](function(_0x26dcec){if(_0x26dcec){return _0x27604c;}})[_0xa757('0x17')](respondWithResult(_0x2c2b40,null))[_0xa757('0x20')](handleError(_0x2c2b40,null));};exports[_0xa757('0x2c')]=function(_0x180fee,_0xafcf19,_0x5a7042){var _0x3aca47;return db[_0xa757('0x3b')][_0xa757('0x53')]({'where':{'id':_0x180fee[_0xa757('0x50')]['id']}})[_0xa757('0x17')](handleEntityNotFound(_0xafcf19,null))[_0xa757('0x17')](removeEntity(_0xafcf19,null))[_0xa757('0x17')](function(){return db[_0xa757('0x3b')][_0xa757('0x4d')]({'raw':!![]});})[_0xa757('0x17')](function(_0x3997f8){var _0x2f5a0f=fs[_0xa757('0x61')](path[_0xa757('0x62')](config[_0xa757('0x63')],_0xa757('0x69')),_0xa757('0x64'));var _0x3c4e41=fs[_0xa757('0x61')](path[_0xa757('0x62')](config[_0xa757('0x63')],_0xa757('0x6b')),'utf8');var _0x768a79=ejs[_0xa757('0x33')](_0x2f5a0f,{'trunks':_0x3997f8});var _0x5b91de=ejs[_0xa757('0x33')](_0x3c4e41,{'trunks':_0x3997f8});fs['writeFileSync'](_0xa757('0x66'),_0x768a79);fs[_0xa757('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x5b91de);return respondWithRpcPromise(_0xa757('0x67'),_0xa757('0x2c'),{'module':_0xa757('0x68')});})[_0xa757('0x20')](handleError(_0xafcf19,null));}; \ No newline at end of file +var _0x2032=['moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','Trunks','UserProfileResource','destroy','stack','name','render','body','agent','interaction','account','index','map','Trunk','rawAttributes','type','key','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','rows','include','find','get','omit','createdAt','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','update','params','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Reload','rimraf','zip-dir','fast-json-patch'];(function(_0x2ea754,_0xf70140){var _0x32c0e8=function(_0x532475){while(--_0x532475){_0x2ea754['push'](_0x2ea754['shift']());}};_0x32c0e8(++_0xf70140);}(_0x2032,0xd9));var _0x2203=function(_0x5d4c7f,_0xc44c9f){_0x5d4c7f=_0x5d4c7f-0x0;var _0xcfb220=_0x2032[_0x5d4c7f];return _0xcfb220;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5f56ff,_0x4bad7c,_0x238772,_0x538b30){return new BPromise(function(_0x592e47,_0x21a3af){var _0x472265=_0x538b30||client;return _0x472265[_0x2203('0x18')](_0x5f56ff,_0x238772)[_0x2203('0x19')](function(_0x226209){logger[_0x2203('0x1a')](_0x2203('0x1b'),_0x4bad7c,_0x2203('0x1c'));logger[_0x2203('0x1d')](_0x2203('0x1e'),_0x4bad7c,'request\x20sent',JSON[_0x2203('0x1f')](_0x226209));if(_0x226209[_0x2203('0x20')]){if(_0x226209['error'][_0x2203('0x21')]===0x1f4){logger[_0x2203('0x20')]('Trunk,\x20%s,\x20%s',_0x4bad7c,_0x226209[_0x2203('0x20')]['message']);return _0x21a3af(_0x226209[_0x2203('0x20')][_0x2203('0x22')]);}logger[_0x2203('0x20')](_0x2203('0x1b'),_0x4bad7c,_0x226209[_0x2203('0x20')][_0x2203('0x22')]);return _0x592e47(_0x226209['error'][_0x2203('0x22')]);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x4bad7c,_0x2203('0x1c'));_0x592e47(_0x226209['result'][_0x2203('0x22')]);}})[_0x2203('0x23')](function(_0x5d4c4e){logger[_0x2203('0x20')]('Trunk,\x20%s,\x20%s',_0x4bad7c,_0x5d4c4e);_0x21a3af(_0x5d4c4e);});});}function respondWithStatusCode(_0x5c8da9,_0x226374){_0x226374=_0x226374||0xcc;return function(_0x2718f5){if(_0x2718f5){return _0x5c8da9[_0x2203('0x24')](_0x226374);}return _0x5c8da9[_0x2203('0x25')](_0x226374)[_0x2203('0x26')]();};}function respondWithResult(_0x3114ef,_0x49c12){_0x49c12=_0x49c12||0xc8;return function(_0x250349){if(_0x250349){return _0x3114ef['status'](_0x49c12)[_0x2203('0x27')](_0x250349);}};}function respondWithFilteredResult(_0x36b958,_0x39a11a){return function(_0x5f11bf){if(_0x5f11bf){var _0xb2071b=typeof _0x39a11a[_0x2203('0x28')]==='undefined'&&typeof _0x39a11a[_0x2203('0x29')]===_0x2203('0x2a');var _0x1c6a77=_0x5f11bf[_0x2203('0x2b')];var _0x28ae02=_0xb2071b?0x0:_0x39a11a[_0x2203('0x28')];var _0x9c53f=_0xb2071b?_0x5f11bf['count']:_0x39a11a[_0x2203('0x28')]+_0x39a11a[_0x2203('0x29')];var _0x406ce9;if(_0x9c53f>=_0x1c6a77){_0x9c53f=_0x1c6a77;_0x406ce9=0xc8;}else{_0x406ce9=0xce;}_0x36b958[_0x2203('0x25')](_0x406ce9);return _0x36b958['set'](_0x2203('0x2c'),_0x28ae02+'-'+_0x9c53f+'/'+_0x1c6a77)[_0x2203('0x27')](_0x5f11bf);}return null;};}function patchUpdates(_0x287c95){return function(_0xf59954){try{jsonpatch['apply'](_0xf59954,_0x287c95,!![]);}catch(_0xea1637){return BPromise[_0x2203('0x2d')](_0xea1637);}return _0xf59954['save']();};}function saveUpdates(_0x5c0157,_0x1d5f74){return function(_0x52fafc){if(_0x52fafc){return _0x52fafc['update'](_0x5c0157)[_0x2203('0x19')](function(_0x464c88){return _0x464c88;});}return null;};}function removeEntity(_0x191894,_0x1e0aa9){return function(_0xf2801d){if(_0xf2801d){return _0xf2801d['destroy']()[_0x2203('0x19')](function(){var _0x2324c0=_0xf2801d['get']({'plain':!![]});var _0x2a2ee7=_0x2203('0x2e');return db[_0x2203('0x2f')][_0x2203('0x30')]({'where':{'type':_0x2a2ee7,'resourceId':_0x2324c0['id']}})[_0x2203('0x19')](function(){return _0xf2801d;});})[_0x2203('0x19')](function(){_0x191894[_0x2203('0x25')](0xcc)[_0x2203('0x26')]();});}};}function handleEntityNotFound(_0x708faa,_0x522a69){return function(_0x15c0ad){if(!_0x15c0ad){_0x708faa[_0x2203('0x24')](0x194);}return _0x15c0ad;};}function handleError(_0x56f9b2,_0x54b90b){_0x54b90b=_0x54b90b||0x1f4;return function(_0x2c58b1){logger['error'](_0x2c58b1[_0x2203('0x31')]);if(_0x2c58b1[_0x2203('0x32')]){delete _0x2c58b1[_0x2203('0x32')];}_0x56f9b2['status'](_0x54b90b)['send'](_0x2c58b1);};}function getMustacheRender(_0x34cdeb,_0x47c93a){return Mustache[_0x2203('0x33')](_0x34cdeb,_['merge'](_0x47c93a[_0x2203('0x34')],{'contact':_0x47c93a['contact'],'message':_0x47c93a[_0x2203('0x22')],'agent':_0x47c93a[_0x2203('0x35')],'interaction':_0x47c93a[_0x2203('0x36')],'account':_0x47c93a[_0x2203('0x37')]}))||'';}exports[_0x2203('0x38')]=function(_0x5436d2,_0x5f1561){var _0x4c0e9e={},_0x7ea79b={},_0x25a2dc={'count':0x0,'rows':[]};var _0x323798=_[_0x2203('0x39')](db[_0x2203('0x3a')][_0x2203('0x3b')],function(_0x1c7e3d){return{'name':_0x1c7e3d['fieldName'],'type':_0x1c7e3d[_0x2203('0x3c')][_0x2203('0x3d')]};});_0x7ea79b[_0x2203('0x3e')]=_[_0x2203('0x39')](_0x323798,'name');_0x7ea79b['query']=_[_0x2203('0x3f')](_0x5436d2['query']);_0x7ea79b[_0x2203('0x40')]=_[_0x2203('0x41')](_0x7ea79b[_0x2203('0x3e')],_0x7ea79b['query']);_0x4c0e9e['attributes']=_[_0x2203('0x41')](_0x7ea79b[_0x2203('0x3e')],qs[_0x2203('0x42')](_0x5436d2[_0x2203('0x43')][_0x2203('0x42')]));_0x4c0e9e[_0x2203('0x44')]=_0x4c0e9e['attributes'][_0x2203('0x45')]?_0x4c0e9e[_0x2203('0x44')]:_0x7ea79b[_0x2203('0x3e')];if(!_0x5436d2[_0x2203('0x43')][_0x2203('0x46')](_0x2203('0x47'))){_0x4c0e9e[_0x2203('0x29')]=qs[_0x2203('0x29')](_0x5436d2[_0x2203('0x43')][_0x2203('0x29')]);_0x4c0e9e['offset']=qs[_0x2203('0x28')](_0x5436d2[_0x2203('0x43')][_0x2203('0x28')]);}_0x4c0e9e[_0x2203('0x48')]=qs['sort'](_0x5436d2['query'][_0x2203('0x49')]);_0x4c0e9e['where']=qs[_0x2203('0x40')](_[_0x2203('0x4a')](_0x5436d2[_0x2203('0x43')],_0x7ea79b[_0x2203('0x40')]),_0x323798);if(_0x5436d2['query'][_0x2203('0x4b')]){_0x4c0e9e[_0x2203('0x4c')]=_['merge'](_0x4c0e9e[_0x2203('0x4c')],{'$or':_[_0x2203('0x39')](_0x323798,function(_0x35b2e9){if(_0x35b2e9[_0x2203('0x3c')]!=='VIRTUAL'){var _0x4c1a29={};_0x4c1a29[_0x35b2e9[_0x2203('0x32')]]={'$like':'%'+_0x5436d2['query']['filter']+'%'};return _0x4c1a29;}})});}_0x4c0e9e=_[_0x2203('0x4d')]({},_0x4c0e9e,_0x5436d2[_0x2203('0x4e')]);var _0x1a2665={'where':_0x4c0e9e['where']};return db['Trunk'][_0x2203('0x2b')](_0x1a2665)[_0x2203('0x19')](function(_0x12d7fa){_0x25a2dc[_0x2203('0x2b')]=_0x12d7fa;if(_0x5436d2[_0x2203('0x43')][_0x2203('0x4f')]){_0x4c0e9e['include']=[{'all':!![]}];}return db[_0x2203('0x3a')]['findAll'](_0x4c0e9e);})[_0x2203('0x19')](function(_0x39ff6f){_0x25a2dc[_0x2203('0x50')]=_0x39ff6f;return _0x25a2dc;})[_0x2203('0x19')](respondWithFilteredResult(_0x5f1561,_0x4c0e9e))['catch'](handleError(_0x5f1561,null));};exports['show']=function(_0x30d503,_0x1f772d){var _0x126aad={'raw':![],'where':{'id':_0x30d503['params']['id']}},_0x1a1c00={};_0x1a1c00['model']=_['keys'](db[_0x2203('0x3a')][_0x2203('0x3b')]);_0x1a1c00['query']=_[_0x2203('0x3f')](_0x30d503[_0x2203('0x43')]);_0x1a1c00['filters']=_[_0x2203('0x41')](_0x1a1c00[_0x2203('0x3e')],_0x1a1c00[_0x2203('0x43')]);_0x126aad[_0x2203('0x44')]=_['intersection'](_0x1a1c00[_0x2203('0x3e')],qs['fields'](_0x30d503[_0x2203('0x43')][_0x2203('0x42')]));_0x126aad['attributes']=_0x126aad[_0x2203('0x44')][_0x2203('0x45')]?_0x126aad[_0x2203('0x44')]:_0x1a1c00[_0x2203('0x3e')];if(_0x30d503[_0x2203('0x43')][_0x2203('0x4f')]){_0x126aad['include']=[{'all':!![]}];}_0x126aad=_['merge']({},_0x126aad,_0x30d503[_0x2203('0x4e')]);return db['Trunk']['find'](_0x126aad)[_0x2203('0x19')](handleEntityNotFound(_0x1f772d,null))[_0x2203('0x19')](respondWithResult(_0x1f772d,null))[_0x2203('0x23')](handleError(_0x1f772d,null));};exports['clone']=function(_0x213c24,_0x4b2788){var _0x5ddf9e={'where':{'id':_0x213c24['params']['id']}},_0xeb6b44={};_0xeb6b44['model']=_['keys'](db[_0x2203('0x3a')][_0x2203('0x3b')]);_0x5ddf9e[_0x2203('0x44')]=_[_0x2203('0x41')](_0xeb6b44[_0x2203('0x3e')],qs[_0x2203('0x42')](_0x213c24[_0x2203('0x43')][_0x2203('0x42')]));_0x5ddf9e[_0x2203('0x44')]=_0x5ddf9e[_0x2203('0x44')][_0x2203('0x45')]?_0x5ddf9e[_0x2203('0x44')]:_0xeb6b44['model'];if(_0x213c24['query'][_0x2203('0x4f')]){_0x5ddf9e[_0x2203('0x51')]=[{'all':!![]}];}_0x5ddf9e=_[_0x2203('0x4d')]({},_0x5ddf9e,_0x213c24[_0x2203('0x4e')]);return db[_0x2203('0x3a')][_0x2203('0x52')](_0x5ddf9e)['then'](handleEntityNotFound(_0x4b2788,null))['then'](function(_0xb49120){if(_0xb49120){var _0x34358e=_0xb49120[_0x2203('0x53')]({'plain':!![]});_0x34358e=qs[_0x2203('0x54')](_0x34358e,['id',_0x2203('0x55'),_0x2203('0x56')]);_0x213c24[_0x2203('0x34')]=_[_0x2203('0x54')](_0x213c24[_0x2203('0x34')],['id',_0x2203('0x55'),_0x2203('0x56')]);return db['Trunk'][_0x2203('0x57')](_[_0x2203('0x4d')](_0x34358e,_0x213c24[_0x2203('0x34')]),{'include':_0x213c24[_0x2203('0x43')][_0x2203('0x4f')]?[{'all':!![]}]:undefined})[_0x2203('0x19')](function(_0x52c159){var _0x544756=_0x213c24[_0x2203('0x58')][_0x2203('0x53')]({'plain':!![]});if(!_0x544756)throw new Error(_0x2203('0x59'));if(_0x544756[_0x2203('0x5a')]===_0x2203('0x58')){var _0x24179a=_0x52c159[_0x2203('0x53')]({'plain':!![]});var _0x34e820=_0x2203('0x2e');return db[_0x2203('0x5b')][_0x2203('0x52')]({'where':{'name':_0x34e820,'userProfileId':_0x544756[_0x2203('0x5c')]},'raw':!![]})['then'](function(_0x468619){if(_0x468619&&_0x468619[_0x2203('0x5d')]===0x0){return db[_0x2203('0x2f')]['create']({'name':_0x24179a[_0x2203('0x32')],'resourceId':_0x24179a['id'],'type':_0x468619[_0x2203('0x32')],'sectionId':_0x468619['id']},{})[_0x2203('0x19')](function(){return _0x52c159;});}else{return _0x52c159;}})[_0x2203('0x23')](function(_0x403b89){logger['error'](_0x2203('0x5e'),_0x403b89);throw _0x403b89;});}return _0x52c159;});}})[_0x2203('0x19')](respondWithResult(_0x4b2788,0xc9))[_0x2203('0x23')](handleError(_0x4b2788,null));};exports['create']=function(_0x5507b6,_0x5d9ae2,_0x485e5b){var _0x595814;return db[_0x2203('0x3a')][_0x2203('0x57')](_0x5507b6[_0x2203('0x34')],{'raw':!![]})[_0x2203('0x19')](function(_0x4287f4){_0x595814=_0x4287f4;return db[_0x2203('0x3a')][_0x2203('0x5f')]({'raw':!![]});})[_0x2203('0x19')](function(_0x56dcbe){var _0x500860=fs[_0x2203('0x60')](path[_0x2203('0x61')](config[_0x2203('0x62')],_0x2203('0x63')),_0x2203('0x64'));var _0x32a348=fs[_0x2203('0x60')](path[_0x2203('0x61')](config[_0x2203('0x62')],_0x2203('0x65')),_0x2203('0x64'));var _0xf16e1d=ejs[_0x2203('0x33')](_0x500860,{'trunks':_0x56dcbe||[]});fs[_0x2203('0x66')](_0x2203('0x67'),_0xf16e1d);if(_0x595814[_0x2203('0x68')]){var _0x3fe739=ejs[_0x2203('0x33')](_0x32a348,{'trunks':_0x56dcbe||[]});fs[_0x2203('0x66')]('/etc/asterisk/sip_xcally_registers.conf',_0x3fe739);}})[_0x2203('0x19')](function(){return respondWithRpcPromise('Reload',_0x2203('0x57'),{'module':'chan_sip.so'});})[_0x2203('0x19')](function(){var _0xf71e7e=_0x5507b6[_0x2203('0x58')][_0x2203('0x53')]({'plain':!![]});if(!_0xf71e7e)throw new Error(_0x2203('0x59'));if(_0xf71e7e[_0x2203('0x5a')]===_0x2203('0x58')){var _0x2eab08=_0x595814['get']({'plain':!![]});return db['UserProfileSection'][_0x2203('0x52')]({'where':{'name':_0x2203('0x2e'),'userProfileId':_0xf71e7e[_0x2203('0x5c')]},'raw':!![]})['then'](function(_0x48c6c9){if(_0x48c6c9&&_0x48c6c9['autoAssociation']===0x0){return db[_0x2203('0x2f')][_0x2203('0x57')]({'name':_0x2eab08[_0x2203('0x32')],'resourceId':_0x2eab08['id'],'type':_0x48c6c9[_0x2203('0x32')],'sectionId':_0x48c6c9['id']},{})['then'](function(){return _0x595814;});}else{return _0x595814;}})[_0x2203('0x23')](function(_0x47a2c7){logger[_0x2203('0x20')](_0x2203('0x5e'),_0x47a2c7);throw _0x47a2c7;});}return _0x595814;})[_0x2203('0x19')](respondWithResult(_0x5d9ae2,0xc9))[_0x2203('0x23')](handleError(_0x5d9ae2,null));};exports[_0x2203('0x69')]=function(_0x56c79a,_0x4592fa,_0x247f26){var _0x18663f;return db['Trunk'][_0x2203('0x52')]({'where':{'id':_0x56c79a[_0x2203('0x6a')]['id']}})[_0x2203('0x19')](handleEntityNotFound(_0x4592fa,null))[_0x2203('0x19')](saveUpdates(_0x56c79a[_0x2203('0x34')],null))[_0x2203('0x19')](function(_0x1a2b7c){if(_0x1a2b7c){_0x18663f=_0x1a2b7c;return db[_0x2203('0x3a')][_0x2203('0x5f')]({'raw':!![]});}})[_0x2203('0x19')](function(_0x112385){if(_0x112385){var _0x5db33f=fs[_0x2203('0x60')](path[_0x2203('0x61')](config[_0x2203('0x62')],_0x2203('0x63')),_0x2203('0x64'));var _0x52c35e=fs[_0x2203('0x60')](path[_0x2203('0x61')](config[_0x2203('0x62')],_0x2203('0x65')),_0x2203('0x64'));var _0x1cc668=ejs['render'](_0x5db33f,{'trunks':_0x112385||[]});fs['writeFileSync'](_0x2203('0x67'),_0x1cc668);var _0x3a1c63=ejs[_0x2203('0x33')](_0x52c35e,{'trunks':_0x112385||[]});fs[_0x2203('0x66')](_0x2203('0x6b'),_0x3a1c63);return respondWithRpcPromise('Reload',_0x2203('0x69'),{'module':_0x2203('0x6c')});}return null;})['then'](function(_0x511689){if(_0x511689){return _0x18663f;}})['then'](respondWithResult(_0x4592fa,null))['catch'](handleError(_0x4592fa,null));};exports['destroy']=function(_0x2952fc,_0x6319a3,_0x437095){var _0x49fd02;return db['Trunk']['find']({'where':{'id':_0x2952fc[_0x2203('0x6a')]['id']}})[_0x2203('0x19')](handleEntityNotFound(_0x6319a3,null))[_0x2203('0x19')](removeEntity(_0x6319a3,null))[_0x2203('0x19')](function(){return db[_0x2203('0x3a')][_0x2203('0x5f')]({'raw':!![]});})[_0x2203('0x19')](function(_0x52f25e){var _0x3bf2c9=fs[_0x2203('0x60')](path[_0x2203('0x61')](config[_0x2203('0x62')],_0x2203('0x63')),_0x2203('0x64'));var _0x13e11f=fs['readFileSync'](path[_0x2203('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x2203('0x64'));var _0x5cd030=ejs[_0x2203('0x33')](_0x3bf2c9,{'trunks':_0x52f25e});var _0x39e7b9=ejs['render'](_0x13e11f,{'trunks':_0x52f25e});fs[_0x2203('0x66')](_0x2203('0x67'),_0x5cd030);fs[_0x2203('0x66')](_0x2203('0x6b'),_0x39e7b9);return respondWithRpcPromise(_0x2203('0x6d'),_0x2203('0x30'),{'module':'chan_sip.so'});})[_0x2203('0x23')](handleError(_0x6319a3,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index fefc7b1..36756a9 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 _0xa7bd=['exports','define','util','api','moment','rimraf','./trunk.attributes'];(function(_0x45f0b2,_0x2106bc){var _0x30b2d9=function(_0x277f81){while(--_0x277f81){_0x45f0b2['push'](_0x45f0b2['shift']());}};_0x30b2d9(++_0x2106bc);}(_0xa7bd,0x1f3));var _0xda7b=function(_0x21f9c2,_0x2b3d2a){_0x21f9c2=_0x21f9c2-0x0;var _0x3da17f=_0xa7bd[_0x21f9c2];return _0x3da17f;};'use strict';var _=require('lodash');var util=require(_0xda7b('0x0'));var logger=require('../../config/logger')(_0xda7b('0x1'));var moment=require(_0xda7b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xda7b('0x3'));var config=require('../../config/environment');var attributes=require(_0xda7b('0x4'));module[_0xda7b('0x5')]=function(_0x553c6,_0x549d5a){return _0x553c6[_0xda7b('0x6')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed8a=['request-promise','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed8a,0x8b));var _0xaed8=function(_0xc45be6,_0x253576){_0xc45be6=_0xc45be6-0x0;var _0x209816=_0xed8a[_0xc45be6];return _0x209816;};'use strict';var _=require(_0xaed8('0x0'));var util=require(_0xaed8('0x1'));var logger=require(_0xaed8('0x2'))('api');var moment=require('moment');var BPromise=require(_0xaed8('0x3'));var rp=require(_0xaed8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaed8('0x5'));var attributes=require(_0xaed8('0x6'));module[_0xaed8('0x7')]=function(_0x908964,_0x179e7f){return _0x908964[_0xaed8('0x8')](_0xaed8('0x9'),attributes,{'tableName':_0xaed8('0xa'),'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 b823dd4..3559f89 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 _0xda2d=['../../config/environment','jayson/promise','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetTrunk','Trunk','findAll','options','raw','attributes','include','map','model','catch','find','where','ShowTrunk','util','moment','bluebird','randomstring','ioredis','rpc'];(function(_0x9f48e6,_0x8f87aa){var _0x45fc5c=function(_0xab1f4e){while(--_0xab1f4e){_0x9f48e6['push'](_0x9f48e6['shift']());}};_0x45fc5c(++_0x8f87aa);}(_0xda2d,0x102));var _0xdda2=function(_0x1faaa4,_0x229396){_0x1faaa4=_0x1faaa4-0x0;var _0x49989d=_0xda2d[_0x1faaa4];return _0x49989d;};'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']('Trunk,\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')]('Trunk,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});}exports[_0xdda2('0x14')]=function(_0x1a3b35){var _0x335fb5=this;return new Promise(function(_0x2b6ee8,_0x8d44b7){return db[_0xdda2('0x15')][_0xdda2('0x16')]({'raw':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')][_0xdda2('0x18')]===undefined?!![]:![]:!![],'where':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['where']||null:null,'attributes':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x19')]||null:null,'limit':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['limit']||null:null,'include':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x1a3b35['options'][_0xdda2('0x1a')],function(_0xfda248){return{'model':db[_0xfda248[_0xdda2('0x1c')]],'as':_0xfda248['as'],'attributes':_0xfda248[_0xdda2('0x19')],'include':_0xfda248[_0xdda2('0x1a')]?_['map'](_0xfda248[_0xdda2('0x1a')],function(_0x4be5ea){return{'model':db[_0x4be5ea[_0xdda2('0x1c')]],'as':_0x4be5ea['as'],'attributes':_0x4be5ea[_0xdda2('0x19')],'include':_0x4be5ea['include']?_['map'](_0x4be5ea[_0xdda2('0x1a')],function(_0x4567e7){return{'model':db[_0x4567e7[_0xdda2('0x1c')]],'as':_0x4567e7['as'],'attributes':_0x4567e7['attributes']};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x5d26ae){logger[_0xdda2('0x12')](_0xdda2('0x14'),_0x1a3b35);logger[_0xdda2('0xd')](_0xdda2('0x14'),_0x1a3b35,JSON['stringify'](_0x5d26ae));_0x2b6ee8(_0x5d26ae);})[_0xdda2('0x1d')](function(_0x255bbc){logger['error'](_0xdda2('0x14'),_0x255bbc[_0xdda2('0x11')],_0x1a3b35);_0x8d44b7(_0x335fb5[_0xdda2('0x10')](0x1f4,_0x255bbc[_0xdda2('0x11')]));});});};exports['ShowTrunk']=function(_0x129eba){var _0x5e107f=this;return new Promise(function(_0x4b19b7,_0x1ca9f3){return db['Trunk'][_0xdda2('0x1e')]({'raw':_0x129eba['options']?_0x129eba['options']['raw']===undefined?!![]:![]:!![],'where':_0x129eba[_0xdda2('0x17')]?_0x129eba['options'][_0xdda2('0x1f')]||null:null,'attributes':_0x129eba['options']?_0x129eba['options']['attributes']||null:null,'include':_0x129eba[_0xdda2('0x17')]?_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')],function(_0x2bcfba){return{'model':db[_0x2bcfba[_0xdda2('0x1c')]],'as':_0x2bcfba['as'],'attributes':_0x2bcfba[_0xdda2('0x19')],'include':_0x2bcfba[_0xdda2('0x1a')]?_['map'](_0x2bcfba[_0xdda2('0x1a')],function(_0x4212da){return{'model':db[_0x4212da[_0xdda2('0x1c')]],'as':_0x4212da['as'],'attributes':_0x4212da[_0xdda2('0x19')],'include':_0x4212da[_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x4212da[_0xdda2('0x1a')],function(_0x5835cd){return{'model':db[_0x5835cd['model']],'as':_0x5835cd['as'],'attributes':_0x5835cd[_0xdda2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x40eb19){logger['info']('ShowTrunk',_0x129eba);logger[_0xdda2('0xd')](_0xdda2('0x20'),_0x129eba,JSON[_0xdda2('0xf')](_0x40eb19));_0x4b19b7(_0x40eb19);})[_0xdda2('0x1d')](function(_0x246001){logger['error'](_0xdda2('0x20'),_0x246001[_0xdda2('0x11')],_0x129eba);_0x1ca9f3(_0x5e107f['error'](0x1f4,_0x246001['message']));});});}; \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trunk,\x20%s,\x20%s','message','catch','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','GetTrunk','debug','stringify','ShowTrunk','find','lodash'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x66fa,0x117));var _0xa66f=function(_0x316299,_0x966935){_0x316299=_0x316299-0x0;var _0x357872=_0x66fa[_0x316299];return _0x357872;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Trunk,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Trunk,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});}exports['GetTrunk']=function(_0x1cbe64){var _0x55b59d=this;return new Promise(function(_0x4a28d4,_0x2f9da2){return db[_0xa66f('0x14')][_0xa66f('0x15')]({'raw':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x17')]===undefined?!![]:![]:!![],'where':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x18')]||null:null,'attributes':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x19')]||null:null,'limit':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x1a')]||null:null,'include':_0x1cbe64['options']?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0x1cbe64[_0xa66f('0x16')]['include'],function(_0x337602){return{'model':db[_0x337602[_0xa66f('0x1d')]],'as':_0x337602['as'],'attributes':_0x337602[_0xa66f('0x19')],'include':_0x337602[_0xa66f('0x1b')]?_['map'](_0x337602['include'],function(_0xed98b9){return{'model':db[_0xed98b9['model']],'as':_0xed98b9['as'],'attributes':_0xed98b9[_0xa66f('0x19')],'include':_0xed98b9[_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0xed98b9['include'],function(_0x4683c7){return{'model':db[_0x4683c7[_0xa66f('0x1d')]],'as':_0x4683c7['as'],'attributes':_0x4683c7[_0xa66f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa66f('0xb')](function(_0x17c103){logger[_0xa66f('0xc')](_0xa66f('0x1e'),_0x1cbe64);logger[_0xa66f('0x1f')](_0xa66f('0x1e'),_0x1cbe64,JSON[_0xa66f('0x20')](_0x17c103));_0x4a28d4(_0x17c103);})[_0xa66f('0x13')](function(_0x63650b){logger[_0xa66f('0xf')](_0xa66f('0x1e'),_0x63650b['message'],_0x1cbe64);_0x2f9da2(_0x55b59d['error'](0x1f4,_0x63650b[_0xa66f('0x12')]));});});};exports[_0xa66f('0x21')]=function(_0x55f309){var _0x44c79a=this;return new Promise(function(_0x2de5f3,_0x4cd7f2){return db[_0xa66f('0x14')][_0xa66f('0x22')]({'raw':_0x55f309[_0xa66f('0x16')]?_0x55f309[_0xa66f('0x16')][_0xa66f('0x17')]===undefined?!![]:![]:!![],'where':_0x55f309['options']?_0x55f309[_0xa66f('0x16')]['where']||null:null,'attributes':_0x55f309[_0xa66f('0x16')]?_0x55f309[_0xa66f('0x16')][_0xa66f('0x19')]||null:null,'include':_0x55f309['options']?_0x55f309[_0xa66f('0x16')][_0xa66f('0x1b')]?_['map'](_0x55f309[_0xa66f('0x16')][_0xa66f('0x1b')],function(_0xba9457){return{'model':db[_0xba9457[_0xa66f('0x1d')]],'as':_0xba9457['as'],'attributes':_0xba9457[_0xa66f('0x19')],'include':_0xba9457[_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0xba9457[_0xa66f('0x1b')],function(_0x35ef27){return{'model':db[_0x35ef27[_0xa66f('0x1d')]],'as':_0x35ef27['as'],'attributes':_0x35ef27['attributes'],'include':_0x35ef27[_0xa66f('0x1b')]?_['map'](_0x35ef27[_0xa66f('0x1b')],function(_0x46f6cc){return{'model':db[_0x46f6cc[_0xa66f('0x1d')]],'as':_0x46f6cc['as'],'attributes':_0x46f6cc[_0xa66f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa66f('0xb')](function(_0x201432){logger[_0xa66f('0xc')](_0xa66f('0x21'),_0x55f309);logger['debug'](_0xa66f('0x21'),_0x55f309,JSON['stringify'](_0x201432));_0x2de5f3(_0x201432);})[_0xa66f('0x13')](function(_0x45eeb8){logger[_0xa66f('0xf')]('ShowTrunk',_0x45eeb8['message'],_0x55f309);_0x4cd7f2(_0x44c79a[_0xa66f('0xf')](0x1f4,_0x45eeb8[_0xa66f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 752bd0e..58f369d 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 _0xc569=['removeSmsInteractions','removeOpenchannelInteractions','/:id/fax_accounts','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeApiKey','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','getApiKey','addContacts','post','create','/create_many','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','update','/:id/password','changePassword','delete','/:id/queues','removeTeams','destroy','removeChatInteractions','/:id/fax_interactions','removeFaxInteractions'];(function(_0x18ecae,_0x2bf366){var _0x2fe95b=function(_0x5143a5){while(--_0x5143a5){_0x18ecae['push'](_0x18ecae['shift']());}};_0x2fe95b(++_0x2bf366);}(_0xc569,0x159));var _0x9c56=function(_0xff7940,_0x16038b){_0xff7940=_0xff7940-0x0;var _0x15ecf2=_0xc569[_0xff7940];return _0x15ecf2;};'use strict';var multer=require(_0x9c56('0x0'));var util=require(_0x9c56('0x1'));var path=require(_0x9c56('0x2'));var timeout=require('connect-timeout');var express=require(_0x9c56('0x3'));var router=express[_0x9c56('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c56('0x5'));var interaction=require(_0x9c56('0x6'));var config=require(_0x9c56('0x7'));var controller=require('./user.controller');router[_0x9c56('0x8')]('/',auth[_0x9c56('0x9')](),controller[_0x9c56('0xa')]);router[_0x9c56('0x8')]('/describe',auth[_0x9c56('0x9')](),controller[_0x9c56('0xb')]);router[_0x9c56('0x8')](_0x9c56('0xc'),auth[_0x9c56('0x9')](),controller['whoami']);router['get']('/presence',auth[_0x9c56('0x9')](),controller[_0x9c56('0xd')]);router['get'](_0x9c56('0xe'),auth['isAuthenticated'](),controller[_0x9c56('0xf')]);router[_0x9c56('0x8')](_0x9c56('0x10'),controller[_0x9c56('0x11')]);router[_0x9c56('0x8')](_0x9c56('0x12'),auth[_0x9c56('0x9')](),controller['getOpenTabs']);router[_0x9c56('0x8')](_0x9c56('0x13'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x14')]);router[_0x9c56('0x8')]('/:id/queues',auth[_0x9c56('0x9')](),controller['getQueues']);router[_0x9c56('0x8')](_0x9c56('0x15'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x16')]);router[_0x9c56('0x8')](_0x9c56('0x17'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x18')]);router[_0x9c56('0x8')](_0x9c56('0x19'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x1a')]);router[_0x9c56('0x8')](_0x9c56('0x1b'),auth[_0x9c56('0x9')](),controller['getScreenRecordings']);router[_0x9c56('0x8')](_0x9c56('0x1c'),auth[_0x9c56('0x9')](),controller['getChatInteractions']);router[_0x9c56('0x8')](_0x9c56('0x1d'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x1e')]);router[_0x9c56('0x8')](_0x9c56('0x1f'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x20')]);router[_0x9c56('0x8')]('/:id/sms/interactions',auth[_0x9c56('0x9')](),controller[_0x9c56('0x21')]);router['get'](_0x9c56('0x22'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x23')]);router[_0x9c56('0x8')](_0x9c56('0x24'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0x9c56('0x8')](_0x9c56('0x25'),auth['isAuthenticated'](),controller[_0x9c56('0x26')]);router['get']('/:id/lists',auth[_0x9c56('0x9')](),controller[_0x9c56('0x27')]);router[_0x9c56('0x8')](_0x9c56('0x28'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x29')]);router['get'](_0x9c56('0x2a'),auth[_0x9c56('0x9')](),controller['getVoicePrefixes']);router['get']('/:id/fax_accounts',auth[_0x9c56('0x9')](),controller['getFaxAccounts']);router[_0x9c56('0x8')](_0x9c56('0x2b'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x2c')]);router[_0x9c56('0x8')](_0x9c56('0x2d'),auth['isAuthenticated'](),controller[_0x9c56('0x2e')]);router['get']('/:id/sms_accounts',auth[_0x9c56('0x9')](),controller[_0x9c56('0x2f')]);router[_0x9c56('0x8')](_0x9c56('0x30'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x31')]);router[_0x9c56('0x8')](_0x9c56('0x32'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x33')]);router['get'](_0x9c56('0x34'),auth[_0x9c56('0x9')](),controller['getSquareProjects']);router[_0x9c56('0x8')](_0x9c56('0x35'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x36')]);router[_0x9c56('0x8')]('/:id/api_key',auth[_0x9c56('0x9')](),controller[_0x9c56('0x37')]);router['post']('/:id/contacts',auth[_0x9c56('0x9')](),controller[_0x9c56('0x38')]);router[_0x9c56('0x39')]('/',auth['isAuthenticated'](),controller[_0x9c56('0x3a')]);router[_0x9c56('0x39')](_0x9c56('0x3b'),auth[_0x9c56('0x9')](),controller['bulkCreate']);router[_0x9c56('0x39')]('/:id/queues',auth['isAuthenticated'](),controller[_0x9c56('0x3c')]);var upload=multer({'storage':multer[_0x9c56('0x3d')]({'destination':function(_0x437928,_0x25602a,_0x76b71b){_0x76b71b(null,path[_0x9c56('0x3e')](config[_0x9c56('0x3f')],_0x9c56('0x40')));},'filename':function(_0x1e25b3,_0x158754,_0x542805){_0x542805(null,util['format'](_0x9c56('0x41'),Date[_0x9c56('0x42')](),_0x158754['originalname']));}})});router[_0x9c56('0x39')](_0x9c56('0x10'),upload[_0x9c56('0x43')](_0x9c56('0x44')),controller[_0x9c56('0x45')]);router[_0x9c56('0x39')](_0x9c56('0x46'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x47')]);router[_0x9c56('0x39')](_0x9c56('0x48'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x49')]);router[_0x9c56('0x39')](_0x9c56('0x4a'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x4b')]);router[_0x9c56('0x39')](_0x9c56('0x4c'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x4d')]);router[_0x9c56('0x39')](_0x9c56('0x25'),auth[_0x9c56('0x9')](),controller['addTeams']);router['post'](_0x9c56('0x4e'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x4f')]);router[_0x9c56('0x39')](_0x9c56('0x50'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x51')]);router[_0x9c56('0x39')]('/:id/fax_interactions',auth[_0x9c56('0x9')](),controller[_0x9c56('0x52')]);router[_0x9c56('0x39')](_0x9c56('0x53'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0x9c56('0x39')](_0x9c56('0x54'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x55')]);router[_0x9c56('0x39')](_0x9c56('0x56'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x57')]);router[_0x9c56('0x39')]('/:id/fax_accounts',auth[_0x9c56('0x9')](),controller[_0x9c56('0x58')]);router['post'](_0x9c56('0x2b'),auth[_0x9c56('0x9')](),controller['addMailAccounts']);router[_0x9c56('0x39')](_0x9c56('0x2d'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router['post']('/:id/sms_accounts',auth[_0x9c56('0x9')](),controller[_0x9c56('0x59')]);router[_0x9c56('0x39')](_0x9c56('0x30'),auth['isAuthenticated'](),controller[_0x9c56('0x5a')]);router['post']('/:id/whatsapp_accounts',auth[_0x9c56('0x9')](),controller[_0x9c56('0x5b')]);router['post']('/:id/square_projects',auth['isAuthenticated'](),controller['addSquareProjects']);router[_0x9c56('0x39')](_0x9c56('0x5c'),auth[_0x9c56('0x9')](),controller['createApiKey']);router['put'](_0x9c56('0xe'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x5d')]);router['put'](_0x9c56('0x5e'),auth['isAuthenticated'](),controller[_0x9c56('0x5f')]);router[_0x9c56('0x60')](_0x9c56('0x61'),auth['isAuthenticated'](),controller['removeQueues']);router[_0x9c56('0x60')](_0x9c56('0x25'),auth['isAuthenticated'](),controller[_0x9c56('0x62')]);router[_0x9c56('0x60')](_0x9c56('0xe'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x63')]);router[_0x9c56('0x60')]('/:id/chat_interactions',auth[_0x9c56('0x9')](),controller[_0x9c56('0x64')]);router[_0x9c56('0x60')](_0x9c56('0x50'),auth[_0x9c56('0x9')](),controller['removeMailInteractions']);router[_0x9c56('0x60')](_0x9c56('0x65'),auth['isAuthenticated'](),controller[_0x9c56('0x66')]);router[_0x9c56('0x60')](_0x9c56('0x53'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x67')]);router['delete'](_0x9c56('0x54'),auth['isAuthenticated'](),controller[_0x9c56('0x68')]);router[_0x9c56('0x60')]('/:id/whatsapp_interactions',auth[_0x9c56('0x9')](),controller['removeWhatsappInteractions']);router[_0x9c56('0x60')](_0x9c56('0x69'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x6a')]);router[_0x9c56('0x60')](_0x9c56('0x2b'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x6b')]);router[_0x9c56('0x60')](_0x9c56('0x2d'),auth[_0x9c56('0x9')](),controller[_0x9c56('0x6c')]);router[_0x9c56('0x60')](_0x9c56('0x6d'),auth[_0x9c56('0x9')](),controller['removeSmsAccounts']);router[_0x9c56('0x60')](_0x9c56('0x30'),auth[_0x9c56('0x9')](),controller['removeChatWebsites']);router[_0x9c56('0x60')]('/:id/whatsapp_accounts',auth[_0x9c56('0x9')](),controller['removeWhatsappAccounts']);router[_0x9c56('0x60')]('/:id/square_projects',auth['isAuthenticated'](),controller['removeSquareProjects']);router[_0x9c56('0x60')](_0x9c56('0x5c'),auth['isAuthenticated'](),controller[_0x9c56('0x6e')]);module[_0x9c56('0x6f')]=router; \ No newline at end of file +var _0x1e69=['update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','/:id/sms_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','/presence','getPresence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','addContacts','bulkCreate','post','join','server/files/images/','format','%s-%s','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','/:id/square_projects','/:id/api_key','createApiKey','put'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1e69,0x85));var _0x91e6=function(_0x845eb1,_0x2368a7){_0x845eb1=_0x845eb1-0x0;var _0x64aba4=_0x1e69[_0x845eb1];return _0x64aba4;};'use strict';var multer=require('multer');var util=require(_0x91e6('0x0'));var path=require(_0x91e6('0x1'));var timeout=require(_0x91e6('0x2'));var express=require(_0x91e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x91e6('0x4'));var interaction=require(_0x91e6('0x5'));var config=require(_0x91e6('0x6'));var controller=require(_0x91e6('0x7'));router[_0x91e6('0x8')]('/',auth[_0x91e6('0x9')](),controller[_0x91e6('0xa')]);router[_0x91e6('0x8')](_0x91e6('0xb'),auth[_0x91e6('0x9')](),controller[_0x91e6('0xc')]);router[_0x91e6('0x8')](_0x91e6('0xd'),auth['isAuthenticated'](),controller['whoami']);router[_0x91e6('0x8')](_0x91e6('0xe'),auth[_0x91e6('0x9')](),controller[_0x91e6('0xf')]);router['get'](_0x91e6('0x10'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x11')]);router[_0x91e6('0x8')]('/:id/avatar',controller[_0x91e6('0x12')]);router[_0x91e6('0x8')](_0x91e6('0x13'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x14')]);router[_0x91e6('0x8')](_0x91e6('0x15'),auth['isAuthenticated'](),controller[_0x91e6('0x16')]);router[_0x91e6('0x8')](_0x91e6('0x17'),auth[_0x91e6('0x9')](),controller['getQueues']);router[_0x91e6('0x8')](_0x91e6('0x18'),auth['isAuthenticated'](),controller[_0x91e6('0x19')]);router['get']('/:id/groups',auth['isAuthenticated'](),controller['getGroups']);router[_0x91e6('0x8')](_0x91e6('0x1a'),auth['isAuthenticated'](),controller['getRecordings']);router[_0x91e6('0x8')](_0x91e6('0x1b'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x1c')]);router[_0x91e6('0x8')](_0x91e6('0x1d'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x1e')]);router[_0x91e6('0x8')](_0x91e6('0x1f'),auth['isAuthenticated'](),controller[_0x91e6('0x20')]);router[_0x91e6('0x8')](_0x91e6('0x21'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x22')]);router[_0x91e6('0x8')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x91e6('0x23')]);router[_0x91e6('0x8')](_0x91e6('0x24'),auth[_0x91e6('0x9')](),controller['getFaxInteractions']);router[_0x91e6('0x8')](_0x91e6('0x25'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x26')]);router[_0x91e6('0x8')](_0x91e6('0x27'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x28')]);router[_0x91e6('0x8')](_0x91e6('0x29'),auth[_0x91e6('0x9')](),controller['getLists']);router[_0x91e6('0x8')](_0x91e6('0x2a'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x2b')]);router[_0x91e6('0x8')]('/:id/prefixes',auth[_0x91e6('0x9')](),controller[_0x91e6('0x2c')]);router['get'](_0x91e6('0x2d'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x2e')]);router['get'](_0x91e6('0x2f'),auth[_0x91e6('0x9')](),controller['getMailAccounts']);router[_0x91e6('0x8')](_0x91e6('0x30'),auth['isAuthenticated'](),controller[_0x91e6('0x31')]);router['get'](_0x91e6('0x32'),auth[_0x91e6('0x9')](),controller['getSmsAccounts']);router[_0x91e6('0x8')]('/:id/chat_websites',auth[_0x91e6('0x9')](),controller[_0x91e6('0x33')]);router[_0x91e6('0x8')](_0x91e6('0x34'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x35')]);router[_0x91e6('0x8')]('/:id/square_projects',auth[_0x91e6('0x9')](),controller['getSquareProjects']);router[_0x91e6('0x8')](_0x91e6('0x36'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x37')]);router[_0x91e6('0x8')]('/:id/api_key',auth[_0x91e6('0x9')](),controller[_0x91e6('0x38')]);router['post'](_0x91e6('0x15'),auth['isAuthenticated'](),controller[_0x91e6('0x39')]);router['post']('/',auth[_0x91e6('0x9')](),controller['create']);router['post']('/create_many',auth[_0x91e6('0x9')](),controller[_0x91e6('0x3a')]);router[_0x91e6('0x3b')](_0x91e6('0x17'),auth[_0x91e6('0x9')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ccf6e,_0x10babf,_0x238a17){_0x238a17(null,path[_0x91e6('0x3c')](config['root'],_0x91e6('0x3d')));},'filename':function(_0x17aeb9,_0x4df33b,_0x5d3c18){_0x5d3c18(null,util[_0x91e6('0x3e')](_0x91e6('0x3f'),Date['now'](),_0x4df33b[_0x91e6('0x40')]));}})});router[_0x91e6('0x3b')](_0x91e6('0x41'),upload[_0x91e6('0x42')](_0x91e6('0x43')),controller[_0x91e6('0x44')]);router[_0x91e6('0x3b')](_0x91e6('0x45'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x46')]);router['post'](_0x91e6('0x47'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x48')]);router[_0x91e6('0x3b')](_0x91e6('0x49'),auth[_0x91e6('0x9')](),controller['pause']);router[_0x91e6('0x3b')](_0x91e6('0x4a'),auth['isAuthenticated'](),controller[_0x91e6('0x4b')]);router['post'](_0x91e6('0x27'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x4c')]);router[_0x91e6('0x3b')](_0x91e6('0x4d'),auth['isAuthenticated'](),controller[_0x91e6('0x4e')]);router['post'](_0x91e6('0x4f'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x50')]);router[_0x91e6('0x3b')](_0x91e6('0x51'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x52')]);router[_0x91e6('0x3b')]('/:id/sms_interactions',auth[_0x91e6('0x9')](),controller[_0x91e6('0x53')]);router[_0x91e6('0x3b')](_0x91e6('0x54'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x55')]);router[_0x91e6('0x3b')](_0x91e6('0x56'),auth['isAuthenticated'](),controller[_0x91e6('0x57')]);router[_0x91e6('0x3b')](_0x91e6('0x2d'),auth['isAuthenticated'](),controller['addFaxAccounts']);router['post']('/:id/mail_accounts',auth[_0x91e6('0x9')](),controller[_0x91e6('0x58')]);router[_0x91e6('0x3b')](_0x91e6('0x30'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x59')]);router[_0x91e6('0x3b')](_0x91e6('0x32'),auth['isAuthenticated'](),controller[_0x91e6('0x5a')]);router[_0x91e6('0x3b')](_0x91e6('0x5b'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x5c')]);router[_0x91e6('0x3b')](_0x91e6('0x34'),auth[_0x91e6('0x9')](),controller['addWhatsappAccounts']);router['post'](_0x91e6('0x5d'),auth[_0x91e6('0x9')](),controller['addSquareProjects']);router[_0x91e6('0x3b')](_0x91e6('0x5e'),auth['isAuthenticated'](),controller[_0x91e6('0x5f')]);router[_0x91e6('0x60')](_0x91e6('0x10'),auth['isAuthenticated'](),controller[_0x91e6('0x61')]);router['put'](_0x91e6('0x62'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x63')]);router[_0x91e6('0x64')](_0x91e6('0x17'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x65')]);router[_0x91e6('0x64')](_0x91e6('0x27'),auth['isAuthenticated'](),controller[_0x91e6('0x66')]);router['delete'](_0x91e6('0x10'),auth[_0x91e6('0x9')](),controller['destroy']);router['delete'](_0x91e6('0x4d'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x67')]);router[_0x91e6('0x64')](_0x91e6('0x4f'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x68')]);router[_0x91e6('0x64')](_0x91e6('0x51'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0x91e6('0x64')](_0x91e6('0x69'),auth[_0x91e6('0x9')](),controller['removeSmsInteractions']);router[_0x91e6('0x64')](_0x91e6('0x54'),auth['isAuthenticated'](),controller[_0x91e6('0x6a')]);router[_0x91e6('0x64')]('/:id/whatsapp_interactions',auth[_0x91e6('0x9')](),controller[_0x91e6('0x6b')]);router['delete'](_0x91e6('0x2d'),auth['isAuthenticated'](),controller[_0x91e6('0x6c')]);router['delete'](_0x91e6('0x2f'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x6d')]);router['delete'](_0x91e6('0x30'),auth[_0x91e6('0x9')](),controller['removeOpenchannelAccounts']);router[_0x91e6('0x64')](_0x91e6('0x32'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x6e')]);router[_0x91e6('0x64')](_0x91e6('0x5b'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x6f')]);router[_0x91e6('0x64')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0x91e6('0x64')](_0x91e6('0x5d'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x70')]);router[_0x91e6('0x64')](_0x91e6('0x5e'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x71')]);module[_0x91e6('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index faa73d2..d4e8f46 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 _0x0183=['fullname','callerid','format','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update','update,nonat','showWebBar','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','string','true','false','screenrecording','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user'];(function(_0x3162b1,_0x14bf24){var _0x54ae57=function(_0x12bc9c){while(--_0x12bc9c){_0x3162b1['push'](_0x3162b1['shift']());}};_0x54ae57(++_0x14bf24);}(_0x0183,0x1e1));var _0x3018=function(_0x2a83dd,_0x424028){_0x2a83dd=_0x2a83dd-0x0;var _0x133800=_0x0183[_0x2a83dd];return _0x133800;};'use strict';var Sequelize=require(_0x3018('0x0'));var moment=require(_0x3018('0x1'));var util=require(_0x3018('0x2'));var _=require(_0x3018('0x3'));module[_0x3018('0x4')]={'name':{'type':Sequelize[_0x3018('0x5')],'allowNull':![],'unique':_0x3018('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x301c3c){this[_0x3018('0x7')](_0x3018('0x6'),_0x301c3c);this[_0x3018('0x7')]('defaultuser',_0x301c3c);},'comment':_0x3018('0x8')},'fullname':{'type':Sequelize[_0x3018('0x5')],'allowNull':![],'set':function(_0x4cbd88){this[_0x3018('0x7')](_0x3018('0x9'),_0x4cbd88);this['setDataValue'](_0x3018('0xa'),util[_0x3018('0xb')]('\x22%s\x22\x20<%s>',_0x4cbd88,this[_0x3018('0xc')](_0x3018('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3018('0x5')],'allowNull':![],'unique':_0x3018('0xe'),'validate':{'isEmail':!![]},'set':function(_0x3a78fb){if(_0x3a78fb){this[_0x3018('0x7')]('email',_0x3a78fb[_0x3018('0xf')]());}}},'role':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x11'),_0x3018('0x12'),_0x3018('0x13'),_0x3018('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x3018('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x3018('0x15')},'internal':{'type':Sequelize[_0x3018('0x16')](0xb),'allowNull':![],'unique':_0x3018('0xd'),'set':function(_0x150dbd){this['setDataValue']('internal',_0x150dbd);this[_0x3018('0x7')](_0x3018('0x17'),_0x150dbd);this['setDataValue'](_0x3018('0xa'),util[_0x3018('0xb')](_0x3018('0x18'),this['getDataValue'](_0x3018('0x9')),_0x150dbd));}},'salt':{'type':Sequelize[_0x3018('0x5')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x3018('0x5')]},'address':{'type':Sequelize[_0x3018('0x5')]},'zipcode':{'type':Sequelize[_0x3018('0x5')]},'userpic':{'type':Sequelize[_0x3018('0x5')]},'city':{'type':Sequelize[_0x3018('0x5')]},'country':{'type':Sequelize[_0x3018('0x5')]},'online':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x3018('0x1a')]},'voicePause':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x3018('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x3018('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x3018('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x3018('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x3018('0x19')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x3018('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x3018('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x3018('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![]},'description':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![],'defaultValue':_0x3018('0x1b')},'ipaddr':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x3018('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x3018('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x1c'),'user',_0x3018('0x1d')),'allowNull':!![],'defaultValue':_0x3018('0x1c')},'context':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![],'defaultValue':_0x3018('0x1e')},'callingpres':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x1f'),_0x3018('0x20'),_0x3018('0x21'),_0x3018('0x22'),_0x3018('0x23'),_0x3018('0x24'),_0x3018('0x25'),_0x3018('0x26')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![],'defaultValue':_0x3018('0x27'),'set':function(_0x2a1a14){this[_0x3018('0x7')](_0x3018('0x28'),_0x2a1a14?_0x2a1a14[_0x3018('0x29')](','):null);},'get':function(){return this[_0x3018('0xc')](_0x3018('0x28'))?this[_0x3018('0xc')]('transport')[_0x3018('0x2a')](','):null;},'comment':_0x3018('0x2b')},'dtmfmode':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x2c'),_0x3018('0x2d'),_0x3018('0x2e'),_0x3018('0x2f'),'auto'),'allowNull':!![],'defaultValue':_0x3018('0x2c')},'directmedia':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x30'),'no',_0x3018('0x31'),'update',_0x3018('0x32')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3018('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![],'defaultValue':_0x3018('0x33'),'set':function(_0xdc13b7){this[_0x3018('0x7')](_0x3018('0x34'),_0xdc13b7?_0xdc13b7['join'](','):null);},'get':function(){return this[_0x3018('0xc')](_0x3018('0x34'))?this['getDataValue'](_0x3018('0x34'))['split'](','):null;},'comment':_0x3018('0x35')},'callgroup':{'type':Sequelize[_0x3018('0x5')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x3018('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x3018('0x5')]},'language':{'type':Sequelize[_0x3018('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3018('0x5')]},'disallow':{'type':Sequelize[_0x3018('0x5')],'allowNull':![],'defaultValue':_0x3018('0x36')},'allow':{'type':Sequelize[_0x3018('0x5')],'allowNull':![],'defaultValue':_0x3018('0x37'),'set':function(_0x446168){this[_0x3018('0x7')](_0x3018('0x38'),_0x446168?_0x446168[_0x3018('0x29')](';'):_0x3018('0x37'));},'get':function(){return this['getDataValue'](_0x3018('0x38'))?this[_0x3018('0xc')](_0x3018('0x38'))[_0x3018('0x2a')](';'):null;},'comment':_0x3018('0x39')},'autoframing':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x30'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![],'set':function(_0x181c0e){this['setDataValue'](_0x3018('0x3a'),_0x181c0e?_0x181c0e[_0x3018('0x29')](','):null);},'get':function(){return this[_0x3018('0xc')](_0x3018('0x3a'))?this[_0x3018('0xc')](_0x3018('0x3a'))[_0x3018('0x2a')](','):null;},'comment':_0x3018('0x3b')},'trustrpid':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3018('0x10')]('yes','no',_0x3018('0x3c')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x30'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x30'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x3018('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3018('0x3d')},'amaflags':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x3018('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x3018('0x10')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x30'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x3018('0x10')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x3018('0x30'),'no',_0x3018('0x3e')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3018('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x30'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x3018('0x10')]('accept',_0x3018('0x3f'),_0x3018('0x40')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x3018('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x3018('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x41'),'uas'),'allowNull':!![],'defaultValue':_0x3018('0x42')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x3018('0x30'),'no'),'allowNull':!![],'defaultValue':_0x3018('0x30')},'keepalive':{'type':Sequelize[_0x3018('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x3018('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x3018('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x3018('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x3018('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x3018('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x3018('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x30'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x30'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x3018('0x30'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x30'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x3018('0x10')]('yes','no',_0x3018('0x43'),_0x3018('0x44')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x3018('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x45'),_0x3018('0x46'),_0x3018('0x47')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x3018('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x3018('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x3018('0x30'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x30'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x30'),'no',_0x3018('0x31'),_0x3018('0x48'),_0x3018('0x49')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x3018('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x3018('0x1a')]},'passwordResetAt':{'type':Sequelize[_0x3018('0x1a')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x43c395){this[_0x3018('0x7')](_0x3018('0x4a'),_0x43c395);var _0x54a5a2=this['get']({'plain':!![]});switch(_0x43c395){case 0x0:case 0x1:var _0x1d0e42=_0x54a5a2[_0x3018('0x28')]?_[_0x3018('0x4b')](_0x54a5a2['transport'])?_0x54a5a2['transport'][_0x3018('0x29')]():_0x54a5a2[_0x3018('0x28')]:'udp';if(_0x1d0e42===_0x3018('0x4c')){_0x1d0e42=_0x3018('0x27');}this['setDataValue'](_0x3018('0x28'),_0x1d0e42);this[_0x3018('0x7')](_0x3018('0x4d'),'no');this['setDataValue'](_0x3018('0x4e'),null);this[_0x3018('0x7')](_0x3018('0x4f'),null);this[_0x3018('0x7')](_0x3018('0x50'),null);this[_0x3018('0x7')](_0x3018('0x51'),null);this[_0x3018('0x7')]('dtlsverify',null);this['setDataValue'](_0x3018('0x52'),null);this[_0x3018('0x7')](_0x3018('0x53'),null);this[_0x3018('0x7')](_0x3018('0x54'),null);this[_0x3018('0x7')](_0x3018('0x55'),'no');break;case 0x2:this['setDataValue'](_0x3018('0x28'),_0x3018('0x4c'));this[_0x3018('0x7')](_0x3018('0x4d'),_0x3018('0x30'));this['setDataValue'](_0x3018('0x4e'),'yes');this['setDataValue'](_0x3018('0x4f'),_0x3018('0x30'));this[_0x3018('0x7')](_0x3018('0x50'),'yes');this['setDataValue']('dtlsenable',_0x3018('0x30'));this[_0x3018('0x7')]('dtlsverify','no');this[_0x3018('0x7')](_0x3018('0x52'),_0x3018('0x47'));this[_0x3018('0x7')](_0x3018('0x53'),_0x54a5a2['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0x3018('0x7')](_0x3018('0x54'),_0x54a5a2['dtlsprivatekey']||_0x3018('0x56'));this[_0x3018('0x7')](_0x3018('0x55'),_0x3018('0x30'));break;default:}}},'permissions':{'type':Sequelize[_0x3018('0x57')],'set':function(_0x1eb52a){this[_0x3018('0x7')](_0x3018('0x58'),_0x1eb52a?_0x1eb52a[_0x3018('0x29')](','):[]);},'get':function(){return this[_0x3018('0xc')](_0x3018('0x58'))?_[_0x3018('0x59')](this[_0x3018('0xc')](_0x3018('0x58'))[_0x3018('0x2a')](','),function(_0x43e790){return parseInt(_0x43e790,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x3018('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x3018('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x3018('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x3018('0x19')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x3018('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x3018('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x3018('0x10')](_0x3018('0x30'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x3018('0x19')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x3018('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x3018('0x5a')],'get':function(){return this[_0x3018('0xc')]('phoneBarEnableScreenRecordingByAgent')?this[_0x3018('0xc')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x3018('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x3018('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![],'set':function(_0x35633f){if(typeof _0x35633f===_0x3018('0x5b')){var _0x84a86c=_0x35633f==='1'?!![]:_0x35633f==='0'?![]:_0x35633f===_0x3018('0x5c')?!![]:_0x35633f===_0x3018('0x5d')?![]:![];this[_0x3018('0x7')](_0x3018('0x5e'),_0x84a86c);}else{this[_0x3018('0x7')]('screenrecording',_0x35633f);}}},'blocked':{'type':Sequelize[_0x3018('0x19')],'defaultValue':![],'set':function(_0x43bff8){this[_0x3018('0x7')]('blocked',_0x43bff8);if(_0x43bff8===!![]){this[_0x3018('0x7')]('blockedAt',moment());this[_0x3018('0x7')](_0x3018('0x5f'),0x0);}else{this[_0x3018('0x7')](_0x3018('0x60'),null);}}},'blockedAt':{'type':Sequelize[_0x3018('0x1a')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x3018('0x61')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x3018('0x19')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x3018('0x19')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x89db=['ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat','update','nat','all','allow','ulaw;alaw;gsm','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','always','accept','refuse','originate','uas','fingerprint','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsprivatekey','dtlsverify','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','moment','exports','name','setDataValue','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','agent','telephone','local','accountcode','format','DATE','BOOLEAN','DEFAULT\x20PAUSE','INTEGER','friend','from-sip'];(function(_0x33adf0,_0x197fd3){var _0x422e69=function(_0xbce4dd){while(--_0xbce4dd){_0x33adf0['push'](_0x33adf0['shift']());}};_0x422e69(++_0x197fd3);}(_0x89db,0xdf));var _0xb89d=function(_0x433c29,_0x5ec3f7){_0x433c29=_0x433c29-0x0;var _0x27621c=_0x89db[_0x433c29];return _0x27621c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb89d('0x0'));var util=require('util');var _=require('lodash');module[_0xb89d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb89d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2f1bd6){this[_0xb89d('0x3')]('name',_0x2f1bd6);this[_0xb89d('0x3')]('defaultuser',_0x2f1bd6);},'comment':_0xb89d('0x4')},'fullname':{'type':Sequelize[_0xb89d('0x5')],'allowNull':![],'set':function(_0x5e2784){this[_0xb89d('0x3')](_0xb89d('0x6'),_0x5e2784);this[_0xb89d('0x3')](_0xb89d('0x7'),util['format'](_0xb89d('0x8'),_0x5e2784,this[_0xb89d('0x9')](_0xb89d('0xa'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb89d('0xb'),'validate':{'isEmail':!![]},'set':function(_0x63d03f){if(_0x63d03f){this[_0xb89d('0x3')](_0xb89d('0xb'),_0x63d03f['toLowerCase']());}}},'role':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0xd'),_0xb89d('0xe'),_0xb89d('0xf'),_0xb89d('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xb89d('0x5')],'defaultValue':_0xb89d('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x1d2b08){this[_0xb89d('0x3')](_0xb89d('0xa'),_0x1d2b08);this[_0xb89d('0x3')](_0xb89d('0x12'),_0x1d2b08);this['setDataValue'](_0xb89d('0x7'),util[_0xb89d('0x13')]('\x22%s\x22\x20<%s>',this[_0xb89d('0x9')](_0xb89d('0x6')),_0x1d2b08));}},'salt':{'type':Sequelize[_0xb89d('0x5')]},'phone':{'type':Sequelize[_0xb89d('0x5')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xb89d('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xb89d('0x5')]},'city':{'type':Sequelize[_0xb89d('0x5')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xb89d('0x14')]},'voicePause':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xb89d('0x5')],'defaultValue':_0xb89d('0x16')},'lastPauseAt':{'type':Sequelize[_0xb89d('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xb89d('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xb89d('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xb89d('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xb89d('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x18'),_0xb89d('0xe'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![],'defaultValue':_0xb89d('0x19')},'callingpres':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x1a'),'ALLOWED_PASSED_SCREEN',_0xb89d('0x1b'),'ALLOWED','PROHIB_NOT_SCREENED',_0xb89d('0x1c'),_0xb89d('0x1d'),_0xb89d('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![],'defaultValue':_0xb89d('0x1f'),'set':function(_0x3e00bf){this['setDataValue']('transport',_0x3e00bf?_0x3e00bf[_0xb89d('0x20')](','):null);},'get':function(){return this[_0xb89d('0x9')](_0xb89d('0x21'))?this[_0xb89d('0x9')]('transport')[_0xb89d('0x22')](','):null;},'comment':_0xb89d('0x23')},'dtmfmode':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x24'),'info',_0xb89d('0x25'),_0xb89d('0x26'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no',_0xb89d('0x28'),_0xb89d('0x29'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x176e99){this[_0xb89d('0x3')](_0xb89d('0x2a'),_0x176e99?_0x176e99['join'](','):null);},'get':function(){return this[_0xb89d('0x9')]('nat')?this[_0xb89d('0x9')]('nat')[_0xb89d('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xb89d('0x5')]},'namedcallgroup':{'type':Sequelize[_0xb89d('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xb89d('0x5')]},'language':{'type':Sequelize[_0xb89d('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xb89d('0x5')],'allowNull':![],'defaultValue':_0xb89d('0x2b')},'allow':{'type':Sequelize[_0xb89d('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xc66383){this[_0xb89d('0x3')](_0xb89d('0x2c'),_0xc66383?_0xc66383[_0xb89d('0x20')](';'):_0xb89d('0x2d'));},'get':function(){return this['getDataValue']('allow')?this[_0xb89d('0x9')](_0xb89d('0x2c'))[_0xb89d('0x22')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![],'set':function(_0x3e7e2f){this['setDataValue'](_0xb89d('0x2e'),_0x3e7e2f?_0x3e7e2f['join'](','):null);},'get':function(){return this[_0xb89d('0x9')](_0xb89d('0x2e'))?this[_0xb89d('0x9')](_0xb89d('0x2e'))['split'](','):null;},'comment':_0xb89d('0x2f')},'trustrpid':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![],'defaultValue':_0xb89d('0x27')},'busylevel':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xb89d('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xb89d('0xc')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no',_0xb89d('0x30')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xb89d('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x31'),_0xb89d('0x32'),_0xb89d('0x33')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xb89d('0x34')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![],'defaultValue':_0xb89d('0x27')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xb89d('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xb89d('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xb89d('0xc')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xb89d('0xc')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no',_0xb89d('0x35'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xb89d('0x36'),_0xb89d('0x37')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xb89d('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xb89d('0x27'),'no',_0xb89d('0x28'),_0xb89d('0x29'),_0xb89d('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xb89d('0x5')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xb89d('0x39')]},'showWebBar':{'type':Sequelize[_0xb89d('0x17')],'defaultValue':0x0,'set':function(_0x87d781){this['setDataValue'](_0xb89d('0x3a'),_0x87d781);var _0x5c28d6=this[_0xb89d('0x3b')]({'plain':!![]});switch(_0x87d781){case 0x0:case 0x1:var _0x239c4c=_0x5c28d6[_0xb89d('0x21')]?_[_0xb89d('0x3c')](_0x5c28d6['transport'])?_0x5c28d6[_0xb89d('0x21')][_0xb89d('0x20')]():_0x5c28d6[_0xb89d('0x21')]:'udp';if(_0x239c4c===_0xb89d('0x3d')){_0x239c4c='udp';}this['setDataValue']('transport',_0x239c4c);this['setDataValue'](_0xb89d('0x3e'),'no');this[_0xb89d('0x3')](_0xb89d('0x3f'),null);this[_0xb89d('0x3')](_0xb89d('0x40'),null);this[_0xb89d('0x3')](_0xb89d('0x41'),null);this['setDataValue'](_0xb89d('0x42'),null);this[_0xb89d('0x3')]('dtlsverify',null);this[_0xb89d('0x3')]('dtlssetup',null);this[_0xb89d('0x3')]('dtlscertfile',null);this['setDataValue'](_0xb89d('0x43'),null);this[_0xb89d('0x3')]('rtcp_mux','no');break;case 0x2:this['setDataValue']('transport',_0xb89d('0x3d'));this[_0xb89d('0x3')](_0xb89d('0x3e'),'yes');this[_0xb89d('0x3')](_0xb89d('0x3f'),_0xb89d('0x27'));this['setDataValue'](_0xb89d('0x40'),_0xb89d('0x27'));this[_0xb89d('0x3')](_0xb89d('0x41'),_0xb89d('0x27'));this['setDataValue']('dtlsenable','yes');this['setDataValue'](_0xb89d('0x44'),'no');this[_0xb89d('0x3')](_0xb89d('0x45'),'actpass');this[_0xb89d('0x3')]('dtlscertfile',_0x5c28d6[_0xb89d('0x46')]||_0xb89d('0x47'));this['setDataValue']('dtlsprivatekey',_0x5c28d6[_0xb89d('0x43')]||'/etc/pki/tls/private/motion.key');this[_0xb89d('0x3')]('rtcp_mux',_0xb89d('0x27'));break;default:}}},'permissions':{'type':Sequelize[_0xb89d('0x39')],'set':function(_0xe3e7f7){this[_0xb89d('0x3')](_0xb89d('0x48'),_0xe3e7f7?_0xe3e7f7[_0xb89d('0x20')](','):[]);},'get':function(){return this[_0xb89d('0x9')]('permissions')?_[_0xb89d('0x49')](this[_0xb89d('0x9')]('permissions')[_0xb89d('0x22')](','),function(_0x286550){return parseInt(_0x286550,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xb89d('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xb89d('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xb89d('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xb89d('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xb89d('0xc')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xb89d('0x4a')],'get':function(){return this[_0xb89d('0x9')]('phoneBarEnableScreenRecordingByAgent')?this[_0xb89d('0x9')](_0xb89d('0x4b')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xb89d('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![],'set':function(_0x5ed535){if(typeof _0x5ed535==='string'){var _0x2b92b7=_0x5ed535==='1'?!![]:_0x5ed535==='0'?![]:_0x5ed535===_0xb89d('0x4c')?!![]:_0x5ed535===_0xb89d('0x4d')?![]:![];this[_0xb89d('0x3')]('screenrecording',_0x2b92b7);}else{this[_0xb89d('0x3')](_0xb89d('0x4e'),_0x5ed535);}}},'blocked':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![],'set':function(_0x2ec583){this[_0xb89d('0x3')](_0xb89d('0x4f'),_0x2ec583);if(_0x2ec583===!![]){this['setDataValue'](_0xb89d('0x50'),moment());this[_0xb89d('0x3')](_0xb89d('0x51'),0x0);}else{this[_0xb89d('0x3')](_0xb89d('0x50'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xb89d('0x17')](0x5)[_0xb89d('0x52')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 04e41d8..09923cb 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 _0x44c2=['oldPassword','newPassword','Sequelize','ValidationError','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','voice','get','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','remove','Queue:remove','addAvatar','userpic','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','download','existsSync','join','server/files/images/','ChatOpenTabs','CHAT','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','CmContact','pick','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getContacts','getQueues','Queue','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','bulkCreate','concat','LOGININPAUSE','isMiddleware','resolve','logout','QueuePause','updateAttributes','PAUSE','DEFAULT\x20PAUSE','unpause','mailPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','%s%s','getTeams','Team','addTeams','Voice','getChatQueues','setDataValue','Chat','getMailQueues','Sms','Whatsapp','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','removeTeams','getSmsQueues','removeAgent','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','getSquareProjects','SquareProject','removeSquareProjects','getScheduledCalls','$and','$or','$gt','$gte','$lt','$lte','$eq','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$contains','$any','lastName','Contact','dialActive','VoiceQueue','CmHopper','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','inbound','toString','asc','substring','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','offline','pause','idle','unavailable','ringing','voiceStatus','busy','slice','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./user.socket','register','jayson/promise','http','request','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','role','admin','Users','user','Agents','agent','Telephones','telephone','ignore','map','value','includes','find','name','UserProfileResource','destroy','stack','send','merge','contact','interaction','account','index','User','rawAttributes','fieldName','type','key','model','differenceBy','password','salt','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','sequelize','lower','options','includeAll','push','findAll','openTabs','rows','chat','sms','fax','dataValues','mail','whatsapp','all','show','params','include','true','openchannel','body','describe','ids','omit','Setting','findById','securePassword','validatePasswordPattern','internal','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','VoiceMail','fullname','email','permissions','102','103','113','110','107','108','109','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','autoAssociation','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','UserProfileSection','isEmpty','compact'];(function(_0x2c902f,_0x315d9e){var _0xa8a2aa=function(_0x1bd068){while(--_0x1bd068){_0x2c902f['push'](_0x2c902f['shift']());}};_0xa8a2aa(++_0x315d9e);}(_0x44c2,0x100));var _0x244c=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0x44c2[_0x3ceb54];return _0x26d8a6;};'use strict';var emlformat=require(_0x244c('0x0'));var rimraf=require(_0x244c('0x1'));var zipdir=require(_0x244c('0x2'));var jsonpatch=require(_0x244c('0x3'));var rp=require('request-promise');var moment=require(_0x244c('0x4'));var BPromise=require(_0x244c('0x5'));var Mustache=require(_0x244c('0x6'));var util=require(_0x244c('0x7'));var path=require(_0x244c('0x8'));var sox=require(_0x244c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x244c('0xa'));var _=require('lodash');var squel=require(_0x244c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x244c('0xc'));var toCsv=require(_0x244c('0xd'));var querystring=require('querystring');var Papa=require(_0x244c('0xe'));var Redis=require('ioredis');var values;var authService=require('../../components/auth/service');var qs=require(_0x244c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x244c('0x10'));var logger=require('../../config/logger')(_0x244c('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x244c('0x12'));var db=require(_0x244c('0x13'))['db'];config[_0x244c('0x14')]=_['defaults'](config[_0x244c('0x14')],{'host':_0x244c('0x15'),'port':0x18eb});var socket=require(_0x244c('0x16'))(new Redis(config[_0x244c('0x14')]));require(_0x244c('0x17'))[_0x244c('0x18')](socket);var jayson=require(_0x244c('0x19'));var client=jayson['client'][_0x244c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4c4001,_0x50538b,_0x151f1f,_0x94e7a4){return new BPromise(function(_0x2773e7,_0x31beaa){var _0x5f2a11=_0x94e7a4||client;return _0x5f2a11[_0x244c('0x1b')](_0x4c4001,_0x151f1f)[_0x244c('0x1c')](function(_0x1aaec4){logger[_0x244c('0x1d')](_0x244c('0x1e'),_0x50538b,'request\x20sent');logger[_0x244c('0x1f')](_0x244c('0x20'),_0x50538b,_0x244c('0x21'),JSON['stringify'](_0x1aaec4));if(_0x1aaec4['error']){if(_0x1aaec4['error'][_0x244c('0x22')]===0x1f4){logger[_0x244c('0x23')](_0x244c('0x1e'),_0x50538b,_0x1aaec4[_0x244c('0x23')][_0x244c('0x24')]);return _0x31beaa(_0x1aaec4[_0x244c('0x23')]['message']);}logger[_0x244c('0x23')](_0x244c('0x1e'),_0x50538b,_0x1aaec4[_0x244c('0x23')]['message']);return _0x2773e7(_0x1aaec4[_0x244c('0x23')]['message']);}else{logger['info'](_0x244c('0x1e'),_0x50538b,_0x244c('0x21'));_0x2773e7(_0x1aaec4['result'][_0x244c('0x24')]);}})[_0x244c('0x25')](function(_0x2147bf){logger[_0x244c('0x23')]('User,\x20%s,\x20%s',_0x50538b,_0x2147bf);_0x31beaa(_0x2147bf);});});}function respondWithStatusCode(_0x1f07bc,_0x264ba2){_0x264ba2=_0x264ba2||0xcc;return function(_0x227c53){if(_0x227c53){return _0x1f07bc[_0x244c('0x26')](_0x264ba2);}return _0x1f07bc[_0x244c('0x27')](_0x264ba2)['end']();};}function respondWithResult(_0x5269cd,_0x19c4fc){_0x19c4fc=_0x19c4fc||0xc8;return function(_0x2f35a5){if(_0x2f35a5){return _0x5269cd[_0x244c('0x27')](_0x19c4fc)[_0x244c('0x28')](_0x2f35a5);}};}function respondWithFilteredResult(_0x1edb58,_0x3fbf1e){return function(_0x301111){if(_0x301111){var _0x3f9b84=typeof _0x3fbf1e[_0x244c('0x29')]===_0x244c('0x2a')&&typeof _0x3fbf1e['limit']==='undefined';var _0x3bb018=_0x301111[_0x244c('0x2b')];var _0x41352b=_0x3f9b84?0x0:_0x3fbf1e[_0x244c('0x29')];var _0xf82c11=_0x3f9b84?_0x301111[_0x244c('0x2b')]:_0x3fbf1e['offset']+_0x3fbf1e[_0x244c('0x2c')];var _0x1ca99b;if(_0xf82c11>=_0x3bb018){_0xf82c11=_0x3bb018;_0x1ca99b=0xc8;}else{_0x1ca99b=0xce;}_0x1edb58[_0x244c('0x27')](_0x1ca99b);return _0x1edb58[_0x244c('0x2d')](_0x244c('0x2e'),_0x41352b+'-'+_0xf82c11+'/'+_0x3bb018)[_0x244c('0x28')](_0x301111);}return null;};}function patchUpdates(_0x427f26){return function(_0xdc72b7){try{jsonpatch[_0x244c('0x2f')](_0xdc72b7,_0x427f26,!![]);}catch(_0x349152){return BPromise[_0x244c('0x30')](_0x349152);}return _0xdc72b7[_0x244c('0x31')]();};}function saveUpdates(_0x5ab647,_0x3c526e){return function(_0x413d04){if(_0x413d04){return _0x413d04[_0x244c('0x32')](_0x5ab647)[_0x244c('0x1c')](function(_0x17112c){return _0x17112c;});}return null;};}function removeEntity(_0x442ab8,_0x63e0a3){return function(_0x18e3a6){if(_0x18e3a6){return _0x18e3a6['destroy']()[_0x244c('0x1c')](function(){var _0x14c830=_0x18e3a6['get']({'plain':!![]});if(_0x14c830[_0x244c('0x33')]===_0x244c('0x34'))return;var _0x253d0b=[{'name':_0x244c('0x35'),'value':_0x244c('0x36'),'ignore':!![]},{'name':_0x244c('0x37'),'value':_0x244c('0x38'),'ignore':![]},{'name':_0x244c('0x39'),'value':_0x244c('0x3a'),'ignore':![]}];var _0xb7dacb=_(_0x253d0b)['filter'](_0x244c('0x3b'))[_0x244c('0x3c')](_0x244c('0x3d'))[_0x244c('0x3d')]();if(_[_0x244c('0x3e')](_0xb7dacb,_0x14c830['role'])){return;}var _0x5e1596=_[_0x244c('0x3f')](_0x253d0b,['value',_0x14c830[_0x244c('0x33')]])[_0x244c('0x40')];return db[_0x244c('0x41')][_0x244c('0x42')]({'where':{'type':_0x5e1596,'resourceId':_0x14c830['id']}})[_0x244c('0x1c')](function(){return _0x18e3a6;});})[_0x244c('0x1c')](function(){_0x442ab8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x320272,_0x28f93a){return function(_0x3fe303){if(!_0x3fe303){_0x320272[_0x244c('0x26')](0x194);}return _0x3fe303;};}function handleError(_0x4dd137,_0x402d82){_0x402d82=_0x402d82||0x1f4;return function(_0x472662){logger['error'](_0x472662[_0x244c('0x43')]);if(_0x472662['name']){delete _0x472662[_0x244c('0x40')];}_0x4dd137[_0x244c('0x27')](_0x402d82)[_0x244c('0x44')](_0x472662);};}function getMustacheRender(_0x2fd637,_0x58e829){return Mustache['render'](_0x2fd637,_[_0x244c('0x45')](_0x58e829['body'],{'contact':_0x58e829[_0x244c('0x46')],'message':_0x58e829[_0x244c('0x24')],'agent':_0x58e829[_0x244c('0x38')],'interaction':_0x58e829[_0x244c('0x47')],'account':_0x58e829[_0x244c('0x48')]}))||'';}exports[_0x244c('0x49')]=function(_0x291c90,_0x4c8b83){var _0x2125b4={},_0x43c3ab={},_0x190142={'count':0x0,'rows':[]};var _0x39c97c=_[_0x244c('0x3c')](db[_0x244c('0x4a')][_0x244c('0x4b')],function(_0x138e5e){return{'name':_0x138e5e[_0x244c('0x4c')],'type':_0x138e5e[_0x244c('0x4d')][_0x244c('0x4e')]};});_0x43c3ab[_0x244c('0x4f')]=_[_0x244c('0x50')](_[_0x244c('0x3c')](_0x39c97c,_0x244c('0x40')),[_0x244c('0x51'),_0x244c('0x52')]);_0x43c3ab[_0x244c('0x53')]=_[_0x244c('0x54')](_0x291c90['query']);_0x43c3ab['filters']=_[_0x244c('0x55')](_0x43c3ab[_0x244c('0x4f')],_0x43c3ab[_0x244c('0x53')]);_0x2125b4[_0x244c('0x56')]=_['intersection'](_0x43c3ab[_0x244c('0x4f')],qs[_0x244c('0x57')](_0x291c90[_0x244c('0x53')][_0x244c('0x57')]));_0x2125b4[_0x244c('0x56')]=_0x2125b4[_0x244c('0x56')][_0x244c('0x58')]?_0x2125b4[_0x244c('0x56')]:_0x43c3ab['model'];if(!_0x291c90[_0x244c('0x53')]['hasOwnProperty'](_0x244c('0x59'))){_0x2125b4[_0x244c('0x2c')]=qs['limit'](_0x291c90[_0x244c('0x53')][_0x244c('0x2c')]);_0x2125b4[_0x244c('0x29')]=qs[_0x244c('0x29')](_0x291c90['query'][_0x244c('0x29')]);}_0x2125b4[_0x244c('0x5a')]=qs[_0x244c('0x5b')](_0x291c90[_0x244c('0x53')][_0x244c('0x5b')]);_0x2125b4[_0x244c('0x5c')]=qs['filters'](_['pick'](_0x291c90[_0x244c('0x53')],_0x43c3ab[_0x244c('0x5d')]),_0x39c97c);if(_0x291c90[_0x244c('0x53')][_0x244c('0x5e')]){_0x2125b4[_0x244c('0x5c')]=_[_0x244c('0x45')](_0x2125b4[_0x244c('0x5c')],{'$or':_[_0x244c('0x3c')](_0x39c97c,function(_0x13e864){if(_0x13e864[_0x244c('0x4d')]!==_0x244c('0x5f')){return db[_0x244c('0x60')][_0x244c('0x5c')](db['sequelize']['fn'](_0x244c('0x61'),db[_0x244c('0x60')]['col'](_0x13e864['name'])),{'$like':db['sequelize']['fn'](_0x244c('0x61'),'%'+_0x291c90['query'][_0x244c('0x5e')]+'%')});}})});}_0x2125b4=_[_0x244c('0x45')]({},_0x2125b4,_0x291c90[_0x244c('0x62')]);var _0x1e3742={'where':_0x2125b4['where']};return db[_0x244c('0x4a')][_0x244c('0x2b')](_0x1e3742)[_0x244c('0x1c')](function(_0x284733){_0x190142[_0x244c('0x2b')]=_0x284733;if(_0x291c90[_0x244c('0x53')][_0x244c('0x63')]){_0x2125b4['include']=[{'all':!![]}];}if(!_[_0x244c('0x3e')](_0x2125b4[_0x244c('0x56')],'id')){_0x2125b4[_0x244c('0x56')][_0x244c('0x64')]('id');}return db[_0x244c('0x4a')][_0x244c('0x65')](_0x2125b4);})[_0x244c('0x1c')](function(_0x1f8881){_0x190142['rows']=_0x1f8881;if(_0x291c90[_0x244c('0x53')][_0x244c('0x66')]==='true'){var _0x577765=[];for(var _0x26999b=0x0;_0x26999b<_0x190142[_0x244c('0x67')][_0x244c('0x58')];_0x26999b++){_0x577765[_0x244c('0x64')](get_open_tabs(_0x244c('0x68'),_0x190142[_0x244c('0x67')][_0x26999b]['dataValues']));_0x577765[_0x244c('0x64')](get_open_tabs(_0x244c('0x69'),_0x190142[_0x244c('0x67')][_0x26999b]['dataValues']));_0x577765['push'](get_open_tabs(_0x244c('0x6a'),_0x190142['rows'][_0x26999b][_0x244c('0x6b')]));_0x577765[_0x244c('0x64')](get_open_tabs(_0x244c('0x6c'),_0x190142[_0x244c('0x67')][_0x26999b][_0x244c('0x6b')]));_0x577765[_0x244c('0x64')](get_open_tabs('openchannel',_0x190142[_0x244c('0x67')][_0x26999b][_0x244c('0x6b')]));_0x577765[_0x244c('0x64')](get_open_tabs(_0x244c('0x6d'),_0x190142[_0x244c('0x67')][_0x26999b]['dataValues']));}return BPromise[_0x244c('0x6e')](_0x577765)[_0x244c('0x1c')](function(_0x53001f){return _0x190142;});}else{return _0x190142;}})['then'](respondWithFilteredResult(_0x4c8b83,_0x2125b4))[_0x244c('0x25')](handleError(_0x4c8b83,null));};exports[_0x244c('0x6f')]=function(_0x13b0b3,_0x3d0148){var _0x45d1d6={'raw':![],'where':{'id':_0x13b0b3[_0x244c('0x70')]['id']}},_0x432133={};_0x432133[_0x244c('0x4f')]=_[_0x244c('0x50')](_[_0x244c('0x54')](db[_0x244c('0x4a')]['rawAttributes']),[_0x244c('0x51'),_0x244c('0x52')]);_0x432133['query']=_['keys'](_0x13b0b3[_0x244c('0x53')]);_0x432133[_0x244c('0x5d')]=_[_0x244c('0x55')](_0x432133['model'],_0x432133[_0x244c('0x53')]);_0x45d1d6['attributes']=_[_0x244c('0x55')](_0x432133[_0x244c('0x4f')],qs[_0x244c('0x57')](_0x13b0b3[_0x244c('0x53')][_0x244c('0x57')]));_0x45d1d6[_0x244c('0x56')]=_0x45d1d6[_0x244c('0x56')][_0x244c('0x58')]?_0x45d1d6['attributes']:_0x432133[_0x244c('0x4f')];if(_0x13b0b3['query'][_0x244c('0x63')]){_0x45d1d6[_0x244c('0x71')]=[{'all':!![]}];}_0x45d1d6=_[_0x244c('0x45')]({},_0x45d1d6,_0x13b0b3[_0x244c('0x62')]);if(!_[_0x244c('0x3e')](_0x45d1d6[_0x244c('0x56')],'id')){_0x45d1d6['attributes'][_0x244c('0x64')]('id');}return db['User'][_0x244c('0x3f')](_0x45d1d6)[_0x244c('0x1c')](handleEntityNotFound(_0x3d0148,null))['then'](function(_0x58cd2d){var _0x4e1bf2=[];values=_0x58cd2d;if(_0x13b0b3[_0x244c('0x53')][_0x244c('0x66')]===_0x244c('0x72')){_0x4e1bf2[_0x244c('0x64')](get_open_tabs('chat',_0x58cd2d[_0x244c('0x6b')]));_0x4e1bf2[_0x244c('0x64')](get_open_tabs('sms',_0x58cd2d[_0x244c('0x6b')]));_0x4e1bf2['push'](get_open_tabs(_0x244c('0x73'),_0x58cd2d[_0x244c('0x6b')]));_0x4e1bf2[_0x244c('0x64')](get_open_tabs(_0x244c('0x6d'),_0x58cd2d[_0x244c('0x6b')]));_0x4e1bf2['push'](get_open_tabs('fax',_0x58cd2d[_0x244c('0x6b')]));_0x4e1bf2[_0x244c('0x64')](get_open_tabs('mail',_0x58cd2d['dataValues']));return BPromise[_0x244c('0x6e')](_0x4e1bf2);}else{return values;}})[_0x244c('0x1c')](function(_0x2a274a){return values;})['then'](respondWithResult(_0x3d0148,null))['catch'](handleError(_0x3d0148,null));};exports[_0x244c('0x32')]=function(_0x34725e,_0x302779){if(_0x34725e[_0x244c('0x74')]['id']){delete _0x34725e[_0x244c('0x74')]['id'];}delete _0x34725e[_0x244c('0x74')]['role'];return db[_0x244c('0x4a')][_0x244c('0x3f')]({'where':{'id':_0x34725e[_0x244c('0x70')]['id']}})[_0x244c('0x1c')](handleEntityNotFound(_0x302779,null))['then'](saveUpdates(_0x34725e['body'],null))[_0x244c('0x1c')](respondWithResult(_0x302779,null))[_0x244c('0x25')](handleError(_0x302779,null));};exports[_0x244c('0x75')]=function(_0x29df78,_0x33e7f0){return db[_0x244c('0x4a')][_0x244c('0x75')]()[_0x244c('0x1c')](respondWithResult(_0x33e7f0,null))[_0x244c('0x25')](handleError(_0x33e7f0,null));};exports['addContacts']=function(_0x4e1cc8,_0x24472d,_0x27620f){return db[_0x244c('0x4a')][_0x244c('0x3f')]({'where':{'id':_0x4e1cc8[_0x244c('0x70')]['id']}})[_0x244c('0x1c')](handleEntityNotFound(_0x24472d,null))[_0x244c('0x1c')](function(_0x570ea2){if(_0x570ea2){return _0x570ea2['addContacts'](_0x4e1cc8['body'][_0x244c('0x76')],_[_0x244c('0x77')](_0x4e1cc8[_0x244c('0x74')],['ids','id'])||{});}})[_0x244c('0x1c')](respondWithResult(_0x24472d,null))[_0x244c('0x25')](handleError(_0x24472d,null));};function validateUser(_0x146c3e){return new BPromise(function(_0xa80983,_0x5ba938){if(_0x146c3e['internal'])return _0xa80983(_0x146c3e);return db[_0x244c('0x78')][_0x244c('0x79')](0x1)[_0x244c('0x1c')](function(_0x683e36){if(_0x683e36[_0x244c('0x7a')])authService[_0x244c('0x7b')](_0x146c3e[_0x244c('0x51')]);db[_0x244c('0x4a')]['max'](_0x244c('0x7c'))[_0x244c('0x1c')](function(_0x4f4824){if(_[_0x244c('0x7d')](_0x4f4824)){_0x146c3e[_0x244c('0x7c')]=_0x683e36['min_internal']||0x1;return;}if(_[_0x244c('0x7d')](_0x683e36[_0x244c('0x7e')])||_0x683e36[_0x244c('0x7e')]===_0x4f4824){_0x146c3e[_0x244c('0x7c')]=_0x4f4824+0x1;return;}if(_0x683e36[_0x244c('0x7e')]>_0x4f4824){_0x146c3e['internal']=_0x683e36['min_internal'];return;}return db[_0x244c('0x60')][_0x244c('0x53')](_0x244c('0x7f'),{'type':db[_0x244c('0x60')][_0x244c('0x80')][_0x244c('0x81')]})[_0x244c('0x1c')](function(_0x490f1a){if(_0x490f1a&&_0x490f1a[_0x244c('0x58')]){for(var _0x367594=0x0,_0x3cc515=_0x490f1a['length'];_0x367594<_0x3cc515&&_[_0x244c('0x7d')](_0x146c3e[_0x244c('0x7c')]);_0x367594++){if(_0x683e36[_0x244c('0x7e')]<=_0x490f1a[_0x367594][_0x244c('0x82')]){_0x146c3e[_0x244c('0x7c')]=_0x490f1a[_0x367594][_0x244c('0x82')];}else if(_0x683e36[_0x244c('0x7e')]>_0x490f1a[_0x367594][_0x244c('0x82')]&&_0x683e36[_0x244c('0x7e')]<=_0x490f1a[_0x367594]['to']){_0x146c3e[_0x244c('0x7c')]=_0x683e36[_0x244c('0x7e')];}}}if(_[_0x244c('0x7d')](_0x146c3e[_0x244c('0x7c')])){_0x146c3e[_0x244c('0x7c')]=_0x4f4824+0x1;}return _0xa80983(_0x146c3e);});});})[_0x244c('0x25')](function(_0x45be37){_0x5ba938(_0x45be37);});});}function updateUser(_0x45d8e5){return new BPromise(function(_0x5b648d,_0x1dd25f){try{if(_0x45d8e5[_0x244c('0x83')]){_0x45d8e5['mailbox']=_0x45d8e5[_0x244c('0x7c')];_0x45d8e5[_0x244c('0x84')]={'mailbox':_0x45d8e5[_0x244c('0x7c')],'password':_0x45d8e5['password'],'fullname':_0x45d8e5[_0x244c('0x85')],'email':_0x45d8e5[_0x244c('0x86')]};}if(_0x45d8e5[_0x244c('0x33')]===_0x244c('0x38')){if(!_0x45d8e5[_0x244c('0x87')])_0x45d8e5[_0x244c('0x87')]=['101',_0x244c('0x88'),_0x244c('0x89'),_0x244c('0x8a'),_0x244c('0x8b'),'104','105','106',_0x244c('0x8c'),_0x244c('0x8d'),_0x244c('0x8e'),'100','111',_0x244c('0x8f'),_0x244c('0x90')];}_0x5b648d(_0x45d8e5);}catch(_0x1c8291){_0x1dd25f(_0x1c8291);}});}exports[_0x244c('0x91')]=function(_0x2a60c0,_0x7de5d0){if(_0x2a60c0[_0x244c('0x36')]['role']==='agent')throw new Error(_0x244c('0x92'));if(_0x2a60c0[_0x244c('0x74')][_0x244c('0x33')]==='user'&&_0x2a60c0[_0x244c('0x36')][_0x244c('0x33')]!=='admin'){throw new Error(_0x244c('0x93'));}if(_0x2a60c0['body']['role']===_0x244c('0x34')&&_0x2a60c0['user'][_0x244c('0x33')]!==_0x244c('0x34')){throw new Error(_0x244c('0x94'));}return licenseUtil[_0x244c('0x95')]([_0x2a60c0[_0x244c('0x74')]])[_0x244c('0x1c')](function(){return validateUser(_0x2a60c0[_0x244c('0x74')]);})[_0x244c('0x1c')](function(_0x306383){return updateUser(_0x306383)[_0x244c('0x1c')](function(_0x38fd0c){if(_0x38fd0c['role']===_0x244c('0x34')){_0x38fd0c[_0x244c('0x96')]=_0x2a60c0[_0x244c('0x36')][_0x244c('0x96')];delete _0x38fd0c[_0x244c('0x97')];}return _0x38fd0c;});})[_0x244c('0x1c')](function(_0x38308f){return db['User']['create'](_0x38308f,{'include':[{'model':db[_0x244c('0x84')],'as':'VoiceMail'}]});})[_0x244c('0x1c')](function(_0x8c223a){if(_0x2a60c0[_0x244c('0x74')][_0x244c('0x33')]===_0x244c('0x36'))return _0x8c223a;if(_0x2a60c0[_0x244c('0x36')][_0x244c('0x33')]!=='user')return _0x8c223a;return db['UserProfileSection'][_0x244c('0x3f')]({'where':{'name':_0x8c223a[_0x244c('0x33')]===_0x244c('0x38')?_0x244c('0x37'):_0x244c('0x39'),'userProfileId':_0x2a60c0[_0x244c('0x36')][_0x244c('0x97')]},'raw':!![]})[_0x244c('0x1c')](function(_0x516167){if(!_0x516167||_0x516167[_0x244c('0x98')]!=0x0)return _0x8c223a;return db[_0x244c('0x41')]['create']({'name':_0x8c223a[_0x244c('0x40')],'resourceId':_0x8c223a['id'],'type':_0x516167['name'],'sectionId':_0x516167['id']},{})[_0x244c('0x1c')](function(){return _0x8c223a;});})[_0x244c('0x25')](function(_0x8ceee1){logger[_0x244c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8ceee1);throw _0x8ceee1;});})[_0x244c('0x1c')](respondWithResult(_0x7de5d0,0xc9))[_0x244c('0x25')](handleError(_0x7de5d0,null));};exports['bulkCreate']=function(_0x16b752,_0x54b2e3){var _0x5da9f9=_0x16b752[_0x244c('0x74')];var _0x25912b=[];if(_0x16b752[_0x244c('0x36')]['role']===_0x244c('0x38'))throw new Error(_0x244c('0x92'));if(_['some'](_0x5da9f9,[_0x244c('0x33'),_0x244c('0x36')])&&_0x16b752[_0x244c('0x36')][_0x244c('0x33')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x244c('0x99')](_0x5da9f9,[_0x244c('0x33'),_0x244c('0x34')])&&_0x16b752['user'][_0x244c('0x33')]!==_0x244c('0x34')){throw new Error(_0x244c('0x9a'));}return licenseUtil[_0x244c('0x95')](_0x5da9f9)[_0x244c('0x1c')](function(){return validateUser(_0x5da9f9[0x0]);})['then'](function(){for(var _0x1d24ae=0x1;_0x1d24ae<_0x5da9f9[_0x244c('0x58')];_0x1d24ae++){var _0x45eab9=_0x5da9f9[_0x1d24ae-0x1]['internal'];if(!_0x5da9f9[_0x1d24ae][_0x244c('0x7c')])_0x5da9f9[_0x1d24ae][_0x244c('0x7c')]=_0x45eab9+0x1;_0x25912b[_0x244c('0x64')](validateUser(_0x5da9f9[_0x1d24ae]));}return BPromise[_0x244c('0x6e')](_0x25912b);})[_0x244c('0x1c')](function(){_0x25912b=[];for(var _0x3d193d=0x0;_0x3d193d<_0x5da9f9[_0x244c('0x58')];_0x3d193d++){_0x25912b['push'](updateUser(_0x5da9f9[_0x3d193d]));}return BPromise['all'](_0x25912b);})['then'](function(){return BPromise[_0x244c('0x9b')](_0x5da9f9,function(_0x9f810b){return db[_0x244c('0x4a')][_0x244c('0x91')](_0x9f810b,{'include':[{'model':db['VoiceMail'],'as':_0x244c('0x84')}]})[_0x244c('0x1c')](function(_0xcbef0b){_0x9f810b['id']=_0xcbef0b['id'];return _0x9f810b;});});})['then'](function(_0x11e795){if(_0x16b752['body'][_0x244c('0x33')]===_0x244c('0x36'))return _0x11e795;if(_0x16b752['user'][_0x244c('0x33')]!=='user')return _0x11e795;var _0x45b450=_[_0x244c('0x99')](_0x11e795,function(_0x321ab4){return _0x321ab4[_0x244c('0x33')]===_0x244c('0x38')||_0x321ab4[_0x244c('0x33')]==='telephone';});if(!_0x45b450)return _0x11e795;return db[_0x244c('0x9c')][_0x244c('0x65')]({'where':{'name':{'$or':['Agents',_0x244c('0x39')]},'userProfileId':_0x16b752[_0x244c('0x36')][_0x244c('0x97')]},'raw':!![]})[_0x244c('0x1c')](function(_0x40200f){if(_[_0x244c('0x9d')](_0x40200f)||!_[_0x244c('0x99')](_0x40200f,['autoAssociation',0x0]))return _0x11e795;_0x25912b=[];var _0x1487dd=_(_0x40200f)[_0x244c('0x3c')](function(_0x564c1f){if(_0x564c1f['autoAssociation']===0x1)return;return _0x564c1f[_0x244c('0x40')]===_0x244c('0x37')?_0x244c('0x38'):'telephone';})[_0x244c('0x9e')]()['value']();for(var _0x8de45a=0x0;_0x8de45a<_0x11e795[_0x244c('0x58')];_0x8de45a++){if(!_['includes'](_0x1487dd,_0x11e795[_0x8de45a][_0x244c('0x33')]))return;var _0x4bc4fa=_0x11e795[_0x8de45a]['role']===_0x244c('0x38')?_0x244c('0x37'):_0x244c('0x39');_0x25912b['push'](db['UserProfileResource'][_0x244c('0x91')]({'name':_0x11e795[_0x8de45a]['name'],'resourceId':_0x11e795[_0x8de45a]['id'],'type':_0x4bc4fa,'sectionId':_[_0x244c('0x3f')](_0x40200f,[_0x244c('0x40'),_0x4bc4fa])['id']},{}));}return BPromise['all'](_0x25912b);});})[_0x244c('0x1c')](respondWithResult(_0x54b2e3,0xc9))[_0x244c('0x25')](handleError(_0x54b2e3,null));};exports['changePassword']=function(_0x7f1b9b,_0x4bae91,_0x4ce3ce){if(_0x7f1b9b[_0x244c('0x74')]['id']){delete _0x7f1b9b['body']['id'];}return db['User']['find']({'where':{'id':_0x7f1b9b['params']['id']}})['then'](function(_0x3f84c5){if(!_0x3f84c5)return null;if(_0x3f84c5['id']===_0x7f1b9b['user']['id']){if(!_0x7f1b9b['body'][_0x244c('0x9f')]||!_0x7f1b9b[_0x244c('0x74')][_0x244c('0xa0')]){throw new db[(_0x244c('0xa1'))][(_0x244c('0xa2'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3f84c5['authenticate'](_0x7f1b9b[_0x244c('0x74')]['oldPassword'])){throw new db[(_0x244c('0xa1'))][(_0x244c('0xa2'))]('Wrong\x20credentials');}if(_0x7f1b9b[_0x244c('0x74')]['oldPassword']===_0x7f1b9b[_0x244c('0x74')][_0x244c('0xa0')]){throw new db[(_0x244c('0xa1'))]['ValidationError'](_0x244c('0xa3'));}}else if(_0x7f1b9b['user'][_0x244c('0x33')]===_0x244c('0x34')){if(!_0x7f1b9b[_0x244c('0x74')][_0x244c('0xa0')]){throw new db[(_0x244c('0xa1'))][(_0x244c('0xa2'))](_0x244c('0xa4'));}}else if(_0x7f1b9b[_0x244c('0x36')][_0x244c('0x33')]===_0x244c('0x36')){if(!_0x7f1b9b['body']['newPassword']){throw new db[(_0x244c('0xa1'))][(_0x244c('0xa2'))](_0x244c('0xa4'));}if(_0x3f84c5['role']!==_0x244c('0x38')){throw new db['Sequelize'][(_0x244c('0xa2'))](_0x244c('0x92'));}}else{throw new db['Sequelize']['ValidationError'](_0x244c('0x92'));}return _0x3f84c5;})[_0x244c('0x1c')](handleEntityNotFound(_0x4bae91,null))[_0x244c('0x1c')](function(_0x20ab11){return db['Setting'][_0x244c('0xa5')]({'attributes':['id',_0x244c('0x7a'),_0x244c('0xa6'),_0x244c('0xa7')]})[_0x244c('0x1c')](function(_0x3ae23e){if(_0x3ae23e[_0x244c('0x7a')])authService[_0x244c('0x7b')](_0x7f1b9b[_0x244c('0x74')]['newPassword']);if(!_0x3ae23e[_0x244c('0xa6')]||!_0x20ab11[_0x244c('0xa8')])return _0x20ab11;authService['validatePasswordHistory'](_0x7f1b9b[_0x244c('0x74')][_0x244c('0xa0')],_0x20ab11[_0x244c('0xa8')],_0x3ae23e[_0x244c('0xa7')]);return _0x20ab11;})[_0x244c('0x1c')](saveUpdates({'password':_0x7f1b9b[_0x244c('0x74')][_0x244c('0xa0')],'passwordResetAt':_0x7f1b9b[_0x244c('0x36')]['id']==_0x7f1b9b['params']['id']?moment():null,'previousPasswords':authService[_0x244c('0xa9')](_0x7f1b9b[_0x244c('0x74')][_0x244c('0xa0')],_0x20ab11[_0x244c('0xa8')])},null));})['then'](respondWithResult(_0x4bae91,null))[_0x244c('0x25')](handleError(_0x4bae91,null));};exports[_0x244c('0xaa')]=function(_0x322bfb,_0x7afbb9,_0x14d317){var _0x2bc5c7=_0x322bfb[_0x244c('0x74')][_0x244c('0xab')];return db[_0x244c('0x4a')][_0x244c('0x3f')]({'where':{'id':_0x322bfb[_0x244c('0x70')]['id']},'attributes':['id',_0x244c('0x40'),_0x244c('0x33'),_0x244c('0xac'),_0x244c('0xad'),_0x244c('0xae'),_0x244c('0xaf')]})[_0x244c('0x1c')](handleEntityNotFound(_0x7afbb9,null))[_0x244c('0x1c')](function(_0x4deb01){if(_0x4deb01){if(!utils['isValidChannel'](_0x2bc5c7)){throw new db['Sequelize'][(_0x244c('0xa2'))](_0x244c('0xb0'));}return _0x4deb01[_0x244c('0xb1')+_[_0x244c('0xb2')](_0x2bc5c7[_0x244c('0xb3')]())+_0x244c('0xb4')](_0x322bfb[_0x244c('0x74')][_0x244c('0x76')],{'penalty':_0x322bfb[_0x244c('0x74')][_0x244c('0xb5')]||0x0})[_0x244c('0xb6')](function(_0x5a4a28){for(var _0x27a799=0x0;_0x27a799<_0x322bfb[_0x244c('0x74')][_0x244c('0x76')][_0x244c('0x58')];_0x27a799+=0x1){var _0x4650a6={'UserId':_0x322bfb[_0x244c('0x70')]['id']};_0x4650a6[_[_0x244c('0xb2')](_0x2bc5c7[_0x244c('0xb3')]())+_0x244c('0xb7')]=_0x322bfb[_0x244c('0x74')]['ids'][_0x27a799];socket[_0x244c('0xb8')](_0x244c('0x36')+_[_0x244c('0xb2')](_0x2bc5c7[_0x244c('0xb3')]())+_0x244c('0xb9'),_0x4650a6);}return _0x5a4a28;})[_0x244c('0x1c')](function(){if(_0x2bc5c7===_0x244c('0xba')){return db['VoiceQueue'][_0x244c('0x65')]({'where':{'id':_0x322bfb['body']['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0x244c('0x1c')](function(_0x5c5ae6){var _0x22a5d6=_0x4deb01[_0x244c('0xbb')]({'plain':!![]});var _0x5917d0=[];if(_0x2bc5c7==='voice'&&_0x22a5d6[_0x244c('0x33')]===_0x244c('0x38')&&_0x22a5d6[_0x244c('0xac')]){for(var _0x20e102=0x0;_0x20e102<_0x5c5ae6[_0x244c('0x58')];_0x20e102+=0x1){_0x5917d0['push']({'membername':_0x22a5d6[_0x244c('0x40')],'UserId':_0x22a5d6['id'],'queue_name':_0x5c5ae6[_0x20e102][_0x244c('0x40')],'VoiceQueueId':_0x5c5ae6[_0x20e102]['id'],'interface':_[_0x244c('0x7d')](_0x22a5d6['interface'])?util[_0x244c('0xbc')](_0x244c('0xbd'),_0x22a5d6['name']):_0x22a5d6[_0x244c('0xaf')],'paused':_0x22a5d6[_0x244c('0xae')]||![],'penalty':_0x322bfb[_0x244c('0x74')][_0x244c('0xb5')]||0x0});}return BPromise[_0x244c('0x9b')](_0x5917d0,function(_0x17a20c){return db[_0x244c('0xbe')][_0x244c('0xbf')](_0x17a20c);});}return _0x4deb01;});}})[_0x244c('0x1c')](respondWithStatusCode(_0x7afbb9,null))[_0x244c('0x25')](handleError(_0x7afbb9,null));};exports[_0x244c('0xc0')]=function(_0x522605,_0x581447,_0x2d9c4a){var _0x24c41f;return db[_0x244c('0x4a')]['find']({'where':{'id':_0x522605[_0x244c('0x70')]['id']},'attributes':['id',_0x244c('0x40'),_0x244c('0x33')]})[_0x244c('0x1c')](handleEntityNotFound(_0x581447,null))['then'](function(_0x57b0c5){if(_0x57b0c5){_0x24c41f=_0x57b0c5;if(!_0x522605[_0x244c('0x53')]['channel']||!utils[_0x244c('0xc1')](_0x522605[_0x244c('0x53')]['channel'])){throw new db['Sequelize'][(_0x244c('0xa2'))](_0x244c('0xb0'));}return _0x57b0c5[_0x244c('0xc2')+_[_0x244c('0xb2')](_0x522605[_0x244c('0x53')][_0x244c('0xab')][_0x244c('0xb3')]())+_0x244c('0xb4')](_0x522605[_0x244c('0x53')]['ids']);}})['then'](function(_0x1ed7b9){for(var _0x16f05e=0x0;_0x16f05e<_0x522605[_0x244c('0x53')][_0x244c('0x76')][_0x244c('0x58')];_0x16f05e+=0x1){var _0x44ae19={'UserId':_0x522605[_0x244c('0x70')]['id']};_0x44ae19[_[_0x244c('0xb2')](_0x522605['query']['channel']['toLowerCase']())+'QueueId']=_0x522605[_0x244c('0x53')][_0x244c('0x76')][_0x16f05e];socket[_0x244c('0xb8')](_0x244c('0x36')+_[_0x244c('0xb2')](_0x522605[_0x244c('0x53')][_0x244c('0xab')][_0x244c('0xb3')]())+_0x244c('0xc3'),_0x44ae19);}return _0x1ed7b9;})[_0x244c('0x1c')](function(){if(_0x522605['query'][_0x244c('0xab')]==='voice'){return db[_0x244c('0xbe')]['destroy']({'where':{'UserId':_0x522605[_0x244c('0x70')]['id'],'VoiceQueueId':_0x522605[_0x244c('0x53')][_0x244c('0x76')]},'individualHooks':!![]})[_0x244c('0x1c')](function(){return _0x24c41f;});}return _0x24c41f;})[_0x244c('0x1c')](respondWithStatusCode(_0x581447,null))['catch'](handleError(_0x581447,null));};exports[_0x244c('0xc4')]=function(_0x357ee8,_0x30d97d,_0x518d4f){_0x357ee8['body'][_0x244c('0xc5')]=_0x357ee8[_0x244c('0xc6')][_0x244c('0xc7')];return db['User']['find']({'where':{'id':_0x357ee8[_0x244c('0x70')]['id']}})[_0x244c('0x1c')](handleEntityNotFound(_0x30d97d,null))[_0x244c('0x1c')](saveUpdates(_0x357ee8['body'],null))[_0x244c('0x1c')](respondWithResult(_0x30d97d,null))[_0x244c('0x25')](handleError(_0x30d97d,null));};exports[_0x244c('0xc8')]=function(_0x34e939,_0x145a72,_0x9018c1){var _0x15cb60=path['join'](config[_0x244c('0xc9')],_0x244c('0xca'));return db[_0x244c('0x4a')][_0x244c('0x3f')]({'where':{'id':_0x34e939[_0x244c('0x70')]['id']},'attributes':['id',_0x244c('0xc5')],'raw':!![]})[_0x244c('0x1c')](handleEntityNotFound(_0x145a72,null))[_0x244c('0x1c')](function(_0x20e666){if(_0x20e666){if(_[_0x244c('0x7d')](_0x20e666[_0x244c('0xc5')])){return _0x145a72[_0x244c('0xcb')](_0x15cb60);}else{if(!fs[_0x244c('0xcc')](path['join'](config['root'],'server/files/images/',_0x20e666[_0x244c('0xc5')]))){return _0x145a72['download'](_0x15cb60);}return _0x145a72['download'](path[_0x244c('0xcd')](config['root'],_0x244c('0xce'),_0x20e666['userpic']));}}})['catch'](handleError(_0x145a72,null));};exports['getOpenTabs']=function(_0x492534,_0x79b88d,_0x2530b4){return db[_0x244c('0x4a')][_0x244c('0x3f')]({'where':{'id':_0x492534[_0x244c('0x70')]['id']},'attributes':['id']})[_0x244c('0x1c')](handleEntityNotFound(_0x79b88d,null))[_0x244c('0x1c')](function(_0x37bc47){var _0x46fecf=[];values=_0x37bc47[_0x244c('0x6b')];_0x46fecf[_0x244c('0x64')](get_open_tabs('chat',_0x37bc47[_0x244c('0x6b')]));_0x46fecf[_0x244c('0x64')](get_open_tabs(_0x244c('0x69'),_0x37bc47[_0x244c('0x6b')]));_0x46fecf['push'](get_open_tabs(_0x244c('0x73'),_0x37bc47[_0x244c('0x6b')]));_0x46fecf[_0x244c('0x64')](get_open_tabs('whatsapp',_0x37bc47[_0x244c('0x6b')]));_0x46fecf[_0x244c('0x64')](get_open_tabs('fax',_0x37bc47[_0x244c('0x6b')]));_0x46fecf[_0x244c('0x64')](get_open_tabs('mail',_0x37bc47[_0x244c('0x6b')]));return BPromise[_0x244c('0x6e')](_0x46fecf);})[_0x244c('0x1c')](function(_0x244066){var _0x48677c=[];if(_0x244066){for(var _0x59c9cb=0x0;_0x59c9cb=_0x211ca3){_0x34550c=_0x211ca3;_0x2d352b=0xc8;}else{_0x2d352b=0xce;}_0x27e94b['status'](_0x2d352b);return _0x27e94b[_0x89ab('0x2f')](_0x89ab('0x30'),_0x645894+'-'+_0x34550c+'/'+_0x211ca3)['json'](_0x1919ee);}return null;};}function patchUpdates(_0x567f99){return function(_0x531bb7){try{jsonpatch[_0x89ab('0x31')](_0x531bb7,_0x567f99,!![]);}catch(_0x59df12){return BPromise[_0x89ab('0x32')](_0x59df12);}return _0x531bb7[_0x89ab('0x33')]();};}function saveUpdates(_0x15d32c,_0x373ba5){return function(_0x48c28b){if(_0x48c28b){return _0x48c28b[_0x89ab('0x34')](_0x15d32c)[_0x89ab('0x1e')](function(_0x5478fa){return _0x5478fa;});}return null;};}function removeEntity(_0x3f4a38,_0x16ce79){return function(_0x5624cb){if(_0x5624cb){return _0x5624cb[_0x89ab('0x35')]()[_0x89ab('0x1e')](function(){var _0x30ad35=_0x5624cb[_0x89ab('0x36')]({'plain':!![]});if(_0x30ad35['role']==='admin')return;var _0x3e3f65=[{'name':_0x89ab('0x37'),'value':_0x89ab('0x38'),'ignore':!![]},{'name':'Agents','value':_0x89ab('0x39'),'ignore':![]},{'name':'Telephones','value':_0x89ab('0x3a'),'ignore':![]}];var _0xfe089d=_(_0x3e3f65)[_0x89ab('0x3b')]('ignore')[_0x89ab('0x3c')](_0x89ab('0x3d'))[_0x89ab('0x3d')]();if(_[_0x89ab('0x3e')](_0xfe089d,_0x30ad35['role'])){return;}var _0x32ff16=_[_0x89ab('0x3f')](_0x3e3f65,[_0x89ab('0x3d'),_0x30ad35['role']])['name'];return db[_0x89ab('0x40')]['destroy']({'where':{'type':_0x32ff16,'resourceId':_0x30ad35['id']}})[_0x89ab('0x1e')](function(){return _0x5624cb;});})[_0x89ab('0x1e')](function(){_0x3f4a38[_0x89ab('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fc98d,_0x4c0498){return function(_0x5d7adf){if(!_0x5d7adf){_0x2fc98d[_0x89ab('0x29')](0x194);}return _0x5d7adf;};}function handleError(_0xadfb9f,_0x863031){_0x863031=_0x863031||0x1f4;return function(_0x3ee5c8){logger[_0x89ab('0x25')](_0x3ee5c8[_0x89ab('0x41')]);if(_0x3ee5c8[_0x89ab('0x42')]){delete _0x3ee5c8[_0x89ab('0x42')];}_0xadfb9f['status'](_0x863031)['send'](_0x3ee5c8);};}function getMustacheRender(_0x17c4d1,_0x387102){return Mustache[_0x89ab('0x43')](_0x17c4d1,_[_0x89ab('0x44')](_0x387102[_0x89ab('0x45')],{'contact':_0x387102['contact'],'message':_0x387102[_0x89ab('0x26')],'agent':_0x387102[_0x89ab('0x39')],'interaction':_0x387102['interaction'],'account':_0x387102[_0x89ab('0x46')]}))||'';}exports[_0x89ab('0x47')]=function(_0x15b0c2,_0x45fac9){var _0x1ea611={},_0x51be1a={},_0x1fe126={'count':0x0,'rows':[]};var _0x479998=_[_0x89ab('0x3c')](db[_0x89ab('0x48')][_0x89ab('0x49')],function(_0x7bdf0b){return{'name':_0x7bdf0b[_0x89ab('0x4a')],'type':_0x7bdf0b[_0x89ab('0x4b')][_0x89ab('0x4c')]};});_0x51be1a[_0x89ab('0x4d')]=_[_0x89ab('0x4e')](_[_0x89ab('0x3c')](_0x479998,_0x89ab('0x42')),[_0x89ab('0x4f'),_0x89ab('0x50')]);_0x51be1a[_0x89ab('0x51')]=_[_0x89ab('0x52')](_0x15b0c2[_0x89ab('0x51')]);_0x51be1a[_0x89ab('0x53')]=_[_0x89ab('0x54')](_0x51be1a[_0x89ab('0x4d')],_0x51be1a['query']);_0x1ea611[_0x89ab('0x55')]=_[_0x89ab('0x54')](_0x51be1a[_0x89ab('0x4d')],qs[_0x89ab('0x56')](_0x15b0c2[_0x89ab('0x51')][_0x89ab('0x56')]));_0x1ea611[_0x89ab('0x55')]=_0x1ea611[_0x89ab('0x55')]['length']?_0x1ea611[_0x89ab('0x55')]:_0x51be1a[_0x89ab('0x4d')];if(!_0x15b0c2['query'][_0x89ab('0x57')](_0x89ab('0x58'))){_0x1ea611[_0x89ab('0x2c')]=qs[_0x89ab('0x2c')](_0x15b0c2['query']['limit']);_0x1ea611[_0x89ab('0x2e')]=qs[_0x89ab('0x2e')](_0x15b0c2[_0x89ab('0x51')][_0x89ab('0x2e')]);}_0x1ea611['order']=qs[_0x89ab('0x59')](_0x15b0c2[_0x89ab('0x51')][_0x89ab('0x59')]);_0x1ea611[_0x89ab('0x5a')]=qs['filters'](_['pick'](_0x15b0c2[_0x89ab('0x51')],_0x51be1a[_0x89ab('0x53')]),_0x479998);if(_0x15b0c2[_0x89ab('0x51')][_0x89ab('0x3b')]){_0x1ea611[_0x89ab('0x5a')]=_['merge'](_0x1ea611[_0x89ab('0x5a')],{'$or':_[_0x89ab('0x3c')](_0x479998,function(_0x5cd49a){if(_0x5cd49a[_0x89ab('0x4b')]!==_0x89ab('0x5b')){return db[_0x89ab('0x5c')][_0x89ab('0x5a')](db[_0x89ab('0x5c')]['fn']('lower',db[_0x89ab('0x5c')][_0x89ab('0x5d')](_0x5cd49a[_0x89ab('0x42')])),{'$like':db['sequelize']['fn'](_0x89ab('0x5e'),'%'+_0x15b0c2['query'][_0x89ab('0x3b')]+'%')});}})});}_0x1ea611=_[_0x89ab('0x44')]({},_0x1ea611,_0x15b0c2[_0x89ab('0x5f')]);var _0x4116d8={'where':_0x1ea611[_0x89ab('0x5a')]};return db[_0x89ab('0x48')]['count'](_0x4116d8)[_0x89ab('0x1e')](function(_0x9ae000){_0x1fe126['count']=_0x9ae000;if(_0x15b0c2[_0x89ab('0x51')]['includeAll']){_0x1ea611[_0x89ab('0x60')]=[{'all':!![]}];}if(!_[_0x89ab('0x3e')](_0x1ea611[_0x89ab('0x55')],'id')){_0x1ea611[_0x89ab('0x55')][_0x89ab('0x61')]('id');}return db[_0x89ab('0x48')][_0x89ab('0x62')](_0x1ea611);})['then'](function(_0x4e6573){_0x1fe126['rows']=_0x4e6573;if(_0x15b0c2[_0x89ab('0x51')]['openTabs']===_0x89ab('0x63')){var _0x33ce21=[];for(var _0x4b0e48=0x0;_0x4b0e48<_0x1fe126['rows'][_0x89ab('0x64')];_0x4b0e48++){_0x33ce21['push'](get_open_tabs(_0x89ab('0x65'),_0x1fe126[_0x89ab('0x66')][_0x4b0e48]['dataValues']));_0x33ce21[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x67'),_0x1fe126[_0x89ab('0x66')][_0x4b0e48][_0x89ab('0x68')]));_0x33ce21['push'](get_open_tabs(_0x89ab('0x69'),_0x1fe126[_0x89ab('0x66')][_0x4b0e48][_0x89ab('0x68')]));_0x33ce21[_0x89ab('0x61')](get_open_tabs('mail',_0x1fe126['rows'][_0x4b0e48][_0x89ab('0x68')]));_0x33ce21['push'](get_open_tabs(_0x89ab('0x6a'),_0x1fe126[_0x89ab('0x66')][_0x4b0e48][_0x89ab('0x68')]));_0x33ce21[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x6b'),_0x1fe126[_0x89ab('0x66')][_0x4b0e48]['dataValues']));}return BPromise['all'](_0x33ce21)['then'](function(_0x3b0baa){return _0x1fe126;});}else{return _0x1fe126;}})[_0x89ab('0x1e')](respondWithFilteredResult(_0x45fac9,_0x1ea611))[_0x89ab('0x28')](handleError(_0x45fac9,null));};exports[_0x89ab('0x6c')]=function(_0x152cb6,_0x1199bb){var _0x4c7719={'raw':![],'where':{'id':_0x152cb6[_0x89ab('0x6d')]['id']}},_0x4697c3={};_0x4697c3[_0x89ab('0x4d')]=_['differenceBy'](_['keys'](db[_0x89ab('0x48')][_0x89ab('0x49')]),[_0x89ab('0x4f'),_0x89ab('0x50')]);_0x4697c3[_0x89ab('0x51')]=_[_0x89ab('0x52')](_0x152cb6[_0x89ab('0x51')]);_0x4697c3[_0x89ab('0x53')]=_[_0x89ab('0x54')](_0x4697c3[_0x89ab('0x4d')],_0x4697c3['query']);_0x4c7719[_0x89ab('0x55')]=_[_0x89ab('0x54')](_0x4697c3[_0x89ab('0x4d')],qs['fields'](_0x152cb6[_0x89ab('0x51')]['fields']));_0x4c7719[_0x89ab('0x55')]=_0x4c7719[_0x89ab('0x55')][_0x89ab('0x64')]?_0x4c7719['attributes']:_0x4697c3[_0x89ab('0x4d')];if(_0x152cb6[_0x89ab('0x51')][_0x89ab('0x6e')]){_0x4c7719[_0x89ab('0x60')]=[{'all':!![]}];}_0x4c7719=_[_0x89ab('0x44')]({},_0x4c7719,_0x152cb6[_0x89ab('0x5f')]);if(!_[_0x89ab('0x3e')](_0x4c7719[_0x89ab('0x55')],'id')){_0x4c7719[_0x89ab('0x55')]['push']('id');}return db[_0x89ab('0x48')]['find'](_0x4c7719)[_0x89ab('0x1e')](handleEntityNotFound(_0x1199bb,null))[_0x89ab('0x1e')](function(_0x537f34){var _0x277b57=[];values=_0x537f34;if(_0x152cb6[_0x89ab('0x51')][_0x89ab('0x6f')]===_0x89ab('0x63')){_0x277b57['push'](get_open_tabs('chat',_0x537f34[_0x89ab('0x68')]));_0x277b57[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x67'),_0x537f34[_0x89ab('0x68')]));_0x277b57['push'](get_open_tabs(_0x89ab('0x6a'),_0x537f34[_0x89ab('0x68')]));_0x277b57['push'](get_open_tabs(_0x89ab('0x6b'),_0x537f34[_0x89ab('0x68')]));_0x277b57['push'](get_open_tabs(_0x89ab('0x69'),_0x537f34[_0x89ab('0x68')]));_0x277b57[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x70'),_0x537f34[_0x89ab('0x68')]));return BPromise['all'](_0x277b57);}else{return values;}})[_0x89ab('0x1e')](function(_0x621cdb){return values;})[_0x89ab('0x1e')](respondWithResult(_0x1199bb,null))['catch'](handleError(_0x1199bb,null));};exports[_0x89ab('0x34')]=function(_0x158b87,_0x12f0d0){if(_0x158b87[_0x89ab('0x45')]['id']){delete _0x158b87[_0x89ab('0x45')]['id'];}delete _0x158b87[_0x89ab('0x45')][_0x89ab('0x71')];return db['User'][_0x89ab('0x3f')]({'where':{'id':_0x158b87[_0x89ab('0x6d')]['id']}})[_0x89ab('0x1e')](handleEntityNotFound(_0x12f0d0,null))['then'](saveUpdates(_0x158b87[_0x89ab('0x45')],null))['then'](respondWithResult(_0x12f0d0,null))[_0x89ab('0x28')](handleError(_0x12f0d0,null));};exports[_0x89ab('0x72')]=function(_0x427c55,_0x5ec81a){return db['User'][_0x89ab('0x72')]()[_0x89ab('0x1e')](respondWithResult(_0x5ec81a,null))[_0x89ab('0x28')](handleError(_0x5ec81a,null));};exports[_0x89ab('0x73')]=function(_0x6f92b7,_0x184a85,_0x401fc5){return db['User'][_0x89ab('0x3f')]({'where':{'id':_0x6f92b7[_0x89ab('0x6d')]['id']}})[_0x89ab('0x1e')](handleEntityNotFound(_0x184a85,null))[_0x89ab('0x1e')](function(_0x40ce15){if(_0x40ce15){return _0x40ce15[_0x89ab('0x73')](_0x6f92b7['body'][_0x89ab('0x74')],_[_0x89ab('0x75')](_0x6f92b7[_0x89ab('0x45')],[_0x89ab('0x74'),'id'])||{});}})[_0x89ab('0x1e')](respondWithResult(_0x184a85,null))['catch'](handleError(_0x184a85,null));};function validateUser(_0x5e4c36){return new BPromise(function(_0x253c6e,_0x495845){if(_0x5e4c36[_0x89ab('0x76')])return _0x253c6e(_0x5e4c36);return db[_0x89ab('0x77')]['findById'](0x1)[_0x89ab('0x1e')](function(_0x75e0de){if(_0x75e0de[_0x89ab('0x78')])authService['validatePasswordPattern'](_0x5e4c36[_0x89ab('0x4f')]);db[_0x89ab('0x48')][_0x89ab('0x79')](_0x89ab('0x76'))[_0x89ab('0x1e')](function(_0x46e1c9){if(_[_0x89ab('0x7a')](_0x46e1c9)){_0x5e4c36[_0x89ab('0x76')]=_0x75e0de[_0x89ab('0x7b')]||0x1;return;}if(_[_0x89ab('0x7a')](_0x75e0de[_0x89ab('0x7b')])||_0x75e0de[_0x89ab('0x7b')]===_0x46e1c9){_0x5e4c36[_0x89ab('0x76')]=_0x46e1c9+0x1;return;}if(_0x75e0de[_0x89ab('0x7b')]>_0x46e1c9){_0x5e4c36[_0x89ab('0x76')]=_0x75e0de[_0x89ab('0x7b')];return;}return db['sequelize'][_0x89ab('0x51')](_0x89ab('0x7c'),{'type':db['sequelize']['QueryTypes'][_0x89ab('0x7d')]})[_0x89ab('0x1e')](function(_0x42ca46){if(_0x42ca46&&_0x42ca46[_0x89ab('0x64')]){for(var _0x21d855=0x0,_0x37e7cb=_0x42ca46[_0x89ab('0x64')];_0x21d855<_0x37e7cb&&_[_0x89ab('0x7a')](_0x5e4c36[_0x89ab('0x76')]);_0x21d855++){if(_0x75e0de['min_internal']<=_0x42ca46[_0x21d855][_0x89ab('0x7e')]){_0x5e4c36[_0x89ab('0x76')]=_0x42ca46[_0x21d855][_0x89ab('0x7e')];}else if(_0x75e0de[_0x89ab('0x7b')]>_0x42ca46[_0x21d855][_0x89ab('0x7e')]&&_0x75e0de['min_internal']<=_0x42ca46[_0x21d855]['to']){_0x5e4c36[_0x89ab('0x76')]=_0x75e0de[_0x89ab('0x7b')];}}}if(_[_0x89ab('0x7a')](_0x5e4c36['internal'])){_0x5e4c36[_0x89ab('0x76')]=_0x46e1c9+0x1;}return _0x253c6e(_0x5e4c36);});});})[_0x89ab('0x28')](function(_0x62c920){_0x495845(_0x62c920);});});}function updateUser(_0x948e19){return new BPromise(function(_0x3b7b12,_0x1ebb2f){try{if(_0x948e19[_0x89ab('0x7f')]){_0x948e19['mailbox']=_0x948e19[_0x89ab('0x76')];_0x948e19[_0x89ab('0x80')]={'mailbox':_0x948e19[_0x89ab('0x76')],'password':_0x948e19[_0x89ab('0x4f')],'fullname':_0x948e19['fullname'],'email':_0x948e19[_0x89ab('0x81')]};}if(_0x948e19[_0x89ab('0x71')]===_0x89ab('0x39')){if(!_0x948e19[_0x89ab('0x82')])_0x948e19[_0x89ab('0x82')]=[_0x89ab('0x83'),_0x89ab('0x84'),_0x89ab('0x85'),_0x89ab('0x86'),_0x89ab('0x87'),_0x89ab('0x88'),_0x89ab('0x89'),_0x89ab('0x8a'),_0x89ab('0x8b'),'108',_0x89ab('0x8c'),_0x89ab('0x8d'),_0x89ab('0x8e'),_0x89ab('0x8f'),'115'];}_0x3b7b12(_0x948e19);}catch(_0x5a70e6){_0x1ebb2f(_0x5a70e6);}});}exports[_0x89ab('0x90')]=function(_0x314303,_0x3973ad){if(_0x314303[_0x89ab('0x38')][_0x89ab('0x71')]===_0x89ab('0x39'))throw new Error(_0x89ab('0x91'));if(_0x314303['body'][_0x89ab('0x71')]===_0x89ab('0x38')&&_0x314303[_0x89ab('0x38')][_0x89ab('0x71')]!=='admin'){throw new Error(_0x89ab('0x92'));}if(_0x314303[_0x89ab('0x45')]['role']==='admin'&&_0x314303[_0x89ab('0x38')]['role']!==_0x89ab('0x93')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x89ab('0x94')]([_0x314303['body']])[_0x89ab('0x1e')](function(){return validateUser(_0x314303[_0x89ab('0x45')]);})[_0x89ab('0x1e')](function(_0x520ae5){return updateUser(_0x520ae5)['then'](function(_0x4e6aff){if(_0x4e6aff['role']===_0x89ab('0x93')){_0x4e6aff[_0x89ab('0x95')]=_0x314303[_0x89ab('0x38')]['settingsEnabled'];delete _0x4e6aff['userProfileId'];}return _0x4e6aff;});})[_0x89ab('0x1e')](function(_0x210c17){return db['User'][_0x89ab('0x90')](_0x210c17,{'include':[{'model':db[_0x89ab('0x80')],'as':_0x89ab('0x80')}]});})[_0x89ab('0x1e')](function(_0x19cf77){if(_0x314303[_0x89ab('0x45')][_0x89ab('0x71')]===_0x89ab('0x38'))return _0x19cf77;if(_0x314303['user'][_0x89ab('0x71')]!=='user')return _0x19cf77;return db[_0x89ab('0x96')]['find']({'where':{'name':_0x19cf77[_0x89ab('0x71')]===_0x89ab('0x39')?'Agents':_0x89ab('0x97'),'userProfileId':_0x314303[_0x89ab('0x38')]['userProfileId']},'raw':!![]})[_0x89ab('0x1e')](function(_0xa0553d){if(!_0xa0553d||_0xa0553d[_0x89ab('0x98')]!=0x0)return _0x19cf77;return db['UserProfileResource'][_0x89ab('0x90')]({'name':_0x19cf77['name'],'resourceId':_0x19cf77['id'],'type':_0xa0553d['name'],'sectionId':_0xa0553d['id']},{})[_0x89ab('0x1e')](function(){return _0x19cf77;});})['catch'](function(_0x4be14f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4be14f);throw _0x4be14f;});})[_0x89ab('0x1e')](respondWithResult(_0x3973ad,0xc9))[_0x89ab('0x28')](handleError(_0x3973ad,null));};exports[_0x89ab('0x99')]=function(_0x429143,_0x3e42da){var _0x3d6aba=_0x429143[_0x89ab('0x45')];var _0x6cb263=[];if(_0x429143['user'][_0x89ab('0x71')]===_0x89ab('0x39'))throw new Error(_0x89ab('0x91'));if(_[_0x89ab('0x9a')](_0x3d6aba,[_0x89ab('0x71'),_0x89ab('0x38')])&&_0x429143[_0x89ab('0x38')][_0x89ab('0x71')]!==_0x89ab('0x93')){throw new Error(_0x89ab('0x92'));}if(_['some'](_0x3d6aba,['role','admin'])&&_0x429143['user']['role']!=='admin'){throw new Error(_0x89ab('0x9b'));}return licenseUtil['checkUserLimits'](_0x3d6aba)[_0x89ab('0x1e')](function(){return validateUser(_0x3d6aba[0x0]);})[_0x89ab('0x1e')](function(){for(var _0x2e983b=0x1;_0x2e983b<_0x3d6aba[_0x89ab('0x64')];_0x2e983b++){var _0x176f8e=_0x3d6aba[_0x2e983b-0x1]['internal'];if(!_0x3d6aba[_0x2e983b][_0x89ab('0x76')])_0x3d6aba[_0x2e983b][_0x89ab('0x76')]=_0x176f8e+0x1;_0x6cb263['push'](validateUser(_0x3d6aba[_0x2e983b]));}return BPromise['all'](_0x6cb263);})['then'](function(){_0x6cb263=[];for(var _0x49969c=0x0;_0x49969c<_0x3d6aba[_0x89ab('0x64')];_0x49969c++){_0x6cb263[_0x89ab('0x61')](updateUser(_0x3d6aba[_0x49969c]));}return BPromise[_0x89ab('0x9c')](_0x6cb263);})[_0x89ab('0x1e')](function(){return BPromise['each'](_0x3d6aba,function(_0x525d50){return db['User']['create'](_0x525d50,{'include':[{'model':db[_0x89ab('0x80')],'as':_0x89ab('0x80')}]})['then'](function(_0x406a4e){_0x525d50['id']=_0x406a4e['id'];return _0x525d50;});});})[_0x89ab('0x1e')](function(_0x35afcb){if(_0x429143[_0x89ab('0x45')][_0x89ab('0x71')]===_0x89ab('0x38'))return _0x35afcb;if(_0x429143[_0x89ab('0x38')][_0x89ab('0x71')]!==_0x89ab('0x38'))return _0x35afcb;var _0x57a6d0=_[_0x89ab('0x9a')](_0x35afcb,function(_0x1307ec){return _0x1307ec['role']==='agent'||_0x1307ec[_0x89ab('0x71')]===_0x89ab('0x3a');});if(!_0x57a6d0)return _0x35afcb;return db[_0x89ab('0x96')]['findAll']({'where':{'name':{'$or':[_0x89ab('0x9d'),_0x89ab('0x97')]},'userProfileId':_0x429143[_0x89ab('0x38')][_0x89ab('0x9e')]},'raw':!![]})[_0x89ab('0x1e')](function(_0x14d593){if(_[_0x89ab('0x9f')](_0x14d593)||!_[_0x89ab('0x9a')](_0x14d593,[_0x89ab('0x98'),0x0]))return _0x35afcb;_0x6cb263=[];var _0x442564=_(_0x14d593)[_0x89ab('0x3c')](function(_0x239a7c){if(_0x239a7c[_0x89ab('0x98')]===0x1)return;return _0x239a7c[_0x89ab('0x42')]==='Agents'?'agent':_0x89ab('0x3a');})[_0x89ab('0xa0')]()['value']();for(var _0x3ac20b=0x0;_0x3ac20b<_0x35afcb['length'];_0x3ac20b++){if(!_[_0x89ab('0x3e')](_0x442564,_0x35afcb[_0x3ac20b][_0x89ab('0x71')]))return;var _0x495798=_0x35afcb[_0x3ac20b][_0x89ab('0x71')]===_0x89ab('0x39')?'Agents':_0x89ab('0x97');_0x6cb263[_0x89ab('0x61')](db['UserProfileResource'][_0x89ab('0x90')]({'name':_0x35afcb[_0x3ac20b][_0x89ab('0x42')],'resourceId':_0x35afcb[_0x3ac20b]['id'],'type':_0x495798,'sectionId':_[_0x89ab('0x3f')](_0x14d593,[_0x89ab('0x42'),_0x495798])['id']},{}));}return BPromise[_0x89ab('0x9c')](_0x6cb263);});})[_0x89ab('0x1e')](respondWithResult(_0x3e42da,0xc9))[_0x89ab('0x28')](handleError(_0x3e42da,null));};exports[_0x89ab('0xa1')]=function(_0x3a7379,_0x4fa4ed,_0xfff03f){if(_0x3a7379[_0x89ab('0x45')]['id']){delete _0x3a7379['body']['id'];}return db[_0x89ab('0x48')][_0x89ab('0x3f')]({'where':{'id':_0x3a7379[_0x89ab('0x6d')]['id']}})[_0x89ab('0x1e')](function(_0x23afd0){if(!_0x23afd0)return null;if(_0x23afd0['id']===_0x3a7379[_0x89ab('0x38')]['id']){if(!_0x3a7379[_0x89ab('0x45')][_0x89ab('0xa2')]||!_0x3a7379['body'][_0x89ab('0xa3')]){throw new db[(_0x89ab('0xa4'))][(_0x89ab('0xa5'))](_0x89ab('0xa6'));}if(!_0x23afd0[_0x89ab('0xa7')](_0x3a7379['body'][_0x89ab('0xa2')])){throw new db['Sequelize'][(_0x89ab('0xa5'))](_0x89ab('0xa8'));}if(_0x3a7379[_0x89ab('0x45')][_0x89ab('0xa2')]===_0x3a7379[_0x89ab('0x45')][_0x89ab('0xa3')]){throw new db['Sequelize'][(_0x89ab('0xa5'))](_0x89ab('0xa9'));}}else if(_0x3a7379[_0x89ab('0x38')][_0x89ab('0x71')]==='admin'){if(!_0x3a7379['body'][_0x89ab('0xa3')]){throw new db[(_0x89ab('0xa4'))][(_0x89ab('0xa5'))](_0x89ab('0xaa'));}}else if(_0x3a7379['user'][_0x89ab('0x71')]===_0x89ab('0x38')){if(!_0x3a7379[_0x89ab('0x45')]['newPassword']){throw new db['Sequelize'][(_0x89ab('0xa5'))](_0x89ab('0xaa'));}if(_0x23afd0[_0x89ab('0x71')]!=='agent'){throw new db['Sequelize'][(_0x89ab('0xa5'))]('Unauthorized');}}else{throw new db[(_0x89ab('0xa4'))][(_0x89ab('0xa5'))](_0x89ab('0x91'));}return _0x23afd0;})[_0x89ab('0x1e')](handleEntityNotFound(_0x4fa4ed,null))[_0x89ab('0x1e')](function(_0x5bc383){return db[_0x89ab('0x77')]['findOne']({'attributes':['id',_0x89ab('0x78'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x89ab('0x1e')](function(_0x2b6eca){if(_0x2b6eca[_0x89ab('0x78')])authService[_0x89ab('0xab')](_0x3a7379[_0x89ab('0x45')][_0x89ab('0xa3')]);if(!_0x2b6eca[_0x89ab('0xac')]||!_0x5bc383[_0x89ab('0xad')])return _0x5bc383;authService['validatePasswordHistory'](_0x3a7379['body'][_0x89ab('0xa3')],_0x5bc383['previousPasswords'],_0x2b6eca[_0x89ab('0xae')]);return _0x5bc383;})[_0x89ab('0x1e')](saveUpdates({'password':_0x3a7379[_0x89ab('0x45')]['newPassword'],'passwordResetAt':_0x3a7379[_0x89ab('0x38')]['id']==_0x3a7379[_0x89ab('0x6d')]['id']?moment():null,'previousPasswords':authService[_0x89ab('0xaf')](_0x3a7379[_0x89ab('0x45')][_0x89ab('0xa3')],_0x5bc383[_0x89ab('0xad')])},null));})['then'](respondWithResult(_0x4fa4ed,null))[_0x89ab('0x28')](handleError(_0x4fa4ed,null));};exports[_0x89ab('0xb0')]=function(_0x4307e1,_0x496272,_0x64b258){var _0x4e518e=_0x4307e1[_0x89ab('0x45')][_0x89ab('0xb1')];return db[_0x89ab('0x48')][_0x89ab('0x3f')]({'where':{'id':_0x4307e1[_0x89ab('0x6d')]['id']},'attributes':['id',_0x89ab('0x42'),'role',_0x89ab('0xb2'),_0x89ab('0xb3'),_0x89ab('0xb4'),_0x89ab('0xb5')]})[_0x89ab('0x1e')](handleEntityNotFound(_0x496272,null))[_0x89ab('0x1e')](function(_0x25cab6){if(_0x25cab6){if(!utils['isValidChannel'](_0x4e518e)){throw new db[(_0x89ab('0xa4'))][(_0x89ab('0xa5'))](_0x89ab('0xb6'));}return _0x25cab6[_0x89ab('0xb7')+_[_0x89ab('0xb8')](_0x4e518e[_0x89ab('0xb9')]())+_0x89ab('0xba')](_0x4307e1[_0x89ab('0x45')]['ids'],{'penalty':_0x4307e1['body'][_0x89ab('0xbb')]||0x0})[_0x89ab('0xbc')](function(_0x194fc5){for(var _0x3a22bb=0x0;_0x3a22bb<_0x4307e1[_0x89ab('0x45')][_0x89ab('0x74')]['length'];_0x3a22bb+=0x1){var _0x1a8ac5={'UserId':_0x4307e1['params']['id']};_0x1a8ac5[_[_0x89ab('0xb8')](_0x4e518e[_0x89ab('0xb9')]())+_0x89ab('0xbd')]=_0x4307e1[_0x89ab('0x45')]['ids'][_0x3a22bb];socket[_0x89ab('0xbe')]('user'+_['capitalize'](_0x4e518e[_0x89ab('0xb9')]())+_0x89ab('0xbf'),_0x1a8ac5);}return _0x194fc5;})[_0x89ab('0x1e')](function(){if(_0x4e518e===_0x89ab('0xc0')){return db[_0x89ab('0xc1')][_0x89ab('0x62')]({'where':{'id':_0x4307e1[_0x89ab('0x45')][_0x89ab('0x74')]||[]},'raw':!![],'attributes':['id',_0x89ab('0x42')]});}})[_0x89ab('0x1e')](function(_0x735cfe){var _0x27f4cb=_0x25cab6[_0x89ab('0x36')]({'plain':!![]});var _0x1fb591=[];if(_0x4e518e===_0x89ab('0xc0')&&_0x27f4cb[_0x89ab('0x71')]==='agent'&&_0x27f4cb[_0x89ab('0xb2')]){for(var _0x143ae2=0x0;_0x143ae2<_0x735cfe['length'];_0x143ae2+=0x1){_0x1fb591['push']({'membername':_0x27f4cb[_0x89ab('0x42')],'UserId':_0x27f4cb['id'],'queue_name':_0x735cfe[_0x143ae2][_0x89ab('0x42')],'VoiceQueueId':_0x735cfe[_0x143ae2]['id'],'interface':_[_0x89ab('0x7a')](_0x27f4cb['interface'])?util[_0x89ab('0xc2')](_0x89ab('0xc3'),_0x27f4cb[_0x89ab('0x42')]):_0x27f4cb[_0x89ab('0xb5')],'paused':_0x27f4cb[_0x89ab('0xb4')]||![],'penalty':_0x4307e1['body'][_0x89ab('0xbb')]||0x0});}return BPromise[_0x89ab('0xc4')](_0x1fb591,function(_0x43b37f){return db[_0x89ab('0xc5')][_0x89ab('0xc6')](_0x43b37f);});}return _0x25cab6;});}})[_0x89ab('0x1e')](respondWithStatusCode(_0x496272,null))[_0x89ab('0x28')](handleError(_0x496272,null));};exports[_0x89ab('0xc7')]=function(_0x16b270,_0x4f6d3f,_0x28fe22){var _0x568fe9;return db[_0x89ab('0x48')][_0x89ab('0x3f')]({'where':{'id':_0x16b270[_0x89ab('0x6d')]['id']},'attributes':['id',_0x89ab('0x42'),_0x89ab('0x71')]})['then'](handleEntityNotFound(_0x4f6d3f,null))['then'](function(_0xd5e65f){if(_0xd5e65f){_0x568fe9=_0xd5e65f;if(!_0x16b270[_0x89ab('0x51')]['channel']||!utils[_0x89ab('0xc8')](_0x16b270[_0x89ab('0x51')][_0x89ab('0xb1')])){throw new db['Sequelize'][(_0x89ab('0xa5'))](_0x89ab('0xb6'));}return _0xd5e65f['remove'+_[_0x89ab('0xb8')](_0x16b270[_0x89ab('0x51')][_0x89ab('0xb1')][_0x89ab('0xb9')]())+_0x89ab('0xba')](_0x16b270[_0x89ab('0x51')]['ids']);}})[_0x89ab('0x1e')](function(_0x4f7496){for(var _0x2472fd=0x0;_0x2472fd<_0x16b270[_0x89ab('0x51')][_0x89ab('0x74')][_0x89ab('0x64')];_0x2472fd+=0x1){var _0xbd676c={'UserId':_0x16b270[_0x89ab('0x6d')]['id']};_0xbd676c[_[_0x89ab('0xb8')](_0x16b270[_0x89ab('0x51')]['channel'][_0x89ab('0xb9')]())+_0x89ab('0xbd')]=_0x16b270[_0x89ab('0x51')][_0x89ab('0x74')][_0x2472fd];socket[_0x89ab('0xbe')]('user'+_[_0x89ab('0xb8')](_0x16b270[_0x89ab('0x51')][_0x89ab('0xb1')][_0x89ab('0xb9')]())+_0x89ab('0xc9'),_0xbd676c);}return _0x4f7496;})[_0x89ab('0x1e')](function(){if(_0x16b270[_0x89ab('0x51')][_0x89ab('0xb1')]===_0x89ab('0xc0')){return db['UserVoiceQueueRt'][_0x89ab('0x35')]({'where':{'UserId':_0x16b270[_0x89ab('0x6d')]['id'],'VoiceQueueId':_0x16b270[_0x89ab('0x51')][_0x89ab('0x74')]},'individualHooks':!![]})[_0x89ab('0x1e')](function(){return _0x568fe9;});}return _0x568fe9;})[_0x89ab('0x1e')](respondWithStatusCode(_0x4f6d3f,null))[_0x89ab('0x28')](handleError(_0x4f6d3f,null));};exports[_0x89ab('0xca')]=function(_0x132e69,_0x1efd2d,_0x51dd8a){_0x132e69[_0x89ab('0x45')][_0x89ab('0xcb')]=_0x132e69[_0x89ab('0xcc')][_0x89ab('0xcd')];return db['User'][_0x89ab('0x3f')]({'where':{'id':_0x132e69['params']['id']}})[_0x89ab('0x1e')](handleEntityNotFound(_0x1efd2d,null))[_0x89ab('0x1e')](saveUpdates(_0x132e69[_0x89ab('0x45')],null))[_0x89ab('0x1e')](respondWithResult(_0x1efd2d,null))[_0x89ab('0x28')](handleError(_0x1efd2d,null));};exports[_0x89ab('0xce')]=function(_0x2dd7d9,_0x3831d5,_0x7056e){var _0x31ce30=path['join'](config[_0x89ab('0xcf')],_0x89ab('0xd0'));return db['User'][_0x89ab('0x3f')]({'where':{'id':_0x2dd7d9[_0x89ab('0x6d')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x89ab('0x1e')](handleEntityNotFound(_0x3831d5,null))[_0x89ab('0x1e')](function(_0x5d027a){if(_0x5d027a){if(_[_0x89ab('0x7a')](_0x5d027a[_0x89ab('0xcb')])){return _0x3831d5['download'](_0x31ce30);}else{if(!fs[_0x89ab('0xd1')](path['join'](config['root'],'server/files/images/',_0x5d027a[_0x89ab('0xcb')]))){return _0x3831d5[_0x89ab('0xd2')](_0x31ce30);}return _0x3831d5['download'](path[_0x89ab('0xd3')](config['root'],'server/files/images/',_0x5d027a['userpic']));}}})[_0x89ab('0x28')](handleError(_0x3831d5,null));};exports[_0x89ab('0xd4')]=function(_0x266a57,_0x33b246,_0x394b95){return db[_0x89ab('0x48')]['find']({'where':{'id':_0x266a57[_0x89ab('0x6d')]['id']},'attributes':['id']})[_0x89ab('0x1e')](handleEntityNotFound(_0x33b246,null))['then'](function(_0xc6409b){var _0x1017d5=[];values=_0xc6409b[_0x89ab('0x68')];_0x1017d5[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x65'),_0xc6409b[_0x89ab('0x68')]));_0x1017d5[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x67'),_0xc6409b[_0x89ab('0x68')]));_0x1017d5[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x6a'),_0xc6409b['dataValues']));_0x1017d5[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x6b'),_0xc6409b['dataValues']));_0x1017d5[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x69'),_0xc6409b['dataValues']));_0x1017d5['push'](get_open_tabs(_0x89ab('0x70'),_0xc6409b[_0x89ab('0x68')]));return BPromise[_0x89ab('0x9c')](_0x1017d5);})[_0x89ab('0x1e')](function(_0x410633){var _0x376866=[];if(_0x410633){for(var _0x1a4b69=0x0;_0x1a4b69=_0x5b978c['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x41aa('0x11')](function(){if(_0x2996bb){return db[_0x41aa('0x2d')][_0x41aa('0x4c')]({'where':{'membername':_0x2996bb['name']},'individualHooks':!![]});}})[_0x41aa('0x11')](function(){if(_0x2996bb){return _0x2996bb[_0x41aa('0x56')]({'raw':!![]});}})[_0x41aa('0x11')](function(_0x7e4317){if(_0x2996bb){if(_0x7e4317){var _0xd437d0=[];_0x567de5=_0x7e4317;if(_0x567de5[_0x41aa('0x31')]){for(var _0x1f57bc=0x0;_0x1f57bc<_0x567de5[_0x41aa('0x31')];_0x1f57bc++){_0xd437d0[_0x41aa('0x49')](db[_0x41aa('0x2d')][_0x41aa('0x57')]({'membername':_0x2996bb['name'],'UserId':_0x2996bb['id'],'queue_name':_0x567de5[_0x1f57bc][_0x41aa('0x2a')],'VoiceQueueId':_0x567de5[_0x1f57bc]['id'],'interface':_0x24d87a,'paused':_0x2996bb[_0x41aa('0x58')]||![],'penalty':_0x567de5[_0x1f57bc]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x41aa('0x4a')](_0xd437d0);}}}})[_0x41aa('0x11')](function(){if(_0x2996bb){return db[_0x41aa('0x3a')][_0x41aa('0x1d')]({'where':{'membername':_0x2996bb['name'],'exitAt':null}});}})[_0x41aa('0x11')](function(_0x20c87e){if(_0x2996bb){if(_0x20c87e&&_0x20c87e['length']){var _0x395e62=[];_0x20c87e[_0x41aa('0x4d')](function(_0x424f21){_0x395e62['push'](_0x424f21[_0x41aa('0x2e')]({'exitAt':moment()['format'](_0x41aa('0x35'))}));});return BPromise[_0x41aa('0x4a')](_0x395e62);}}})[_0x41aa('0x11')](function(_0x503196){if(_0x2996bb){var _0x40dcad=[];var _0x2c98e0=[];var _0x364d8a=utils[_0x41aa('0x33')]();var _0x19e83a={'membername':_0x2996bb[_0x41aa('0x2a')],'interface':_0x24d87a,'enterAt':moment()['format'](_0x41aa('0x35')),'role':_0x2996bb[_0x41aa('0x2b')],'internal':_0x2996bb[_0x41aa('0x39')]};_0x364d8a[_0x41aa('0x4d')](function(_0x4ebb27){_0x40dcad['push'](_[_0x41aa('0x59')]({'channel':_0x4ebb27,'type':_0x41aa('0x5a'),'data1':_0x41aa('0x5b'),'data2':_0x24d87a},_0x19e83a));if(_0x2996bb[_0x41aa('0x58')]){_0x2c98e0[_0x41aa('0x49')](_['merge']({'channel':_0x4ebb27,'type':'PAUSE','data1':_0x41aa('0x5c')},_0x19e83a));}});return db[_0x41aa('0x3a')]['bulkCreate'](_0x40dcad[_0x41aa('0x5d')](_0x2c98e0),{'individualHooks':!![]});}})[_0x41aa('0x11')](function(){if(_0x2996bb){return _0x2996bb[_0x41aa('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x41aa('0x30')](_0x41aa('0x35')),'voicePause':_0x2996bb[_0x41aa('0x58')]||![],'mailPause':_0x2996bb['loginInPause']||![],'chatPause':_0x2996bb['loginInPause']||![],'faxPause':_0x2996bb[_0x41aa('0x58')]||![],'smsPause':_0x2996bb['loginInPause']||![],'openchannelPause':_0x2996bb[_0x41aa('0x58')]||![],'pauseType':_0x2996bb[_0x41aa('0x58')]?_0x41aa('0x5c'):null,'lastPauseAt':moment()[_0x41aa('0x30')](_0x41aa('0x35')),'interface':_0x24d87a});}})[_0x41aa('0x11')](function(_0xafaae5){_0x57b875(_0xafaae5);})['catch'](function(_0x3cd42f){_0x56eab3(_0x4ec7b0[_0x41aa('0x16')](0x1f4,_0x3cd42f[_0x41aa('0x18')]));});});}; \ No newline at end of file +var _0xc1da=['updateAttributes','getChannels','push','isNil','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','update','UnpauseUser','findOne','body','channel','isValidChannel','Unknown\x20channel','UserVoiceQueueRt','system','mail','fax','openchannel','whatsapp','set','%s%s','Pause','forEach','all','LogoutUser','phone','count','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','upsert','loginInPause','UserVoiceQueue.penalty','callysquare','merge','LOGININPAUSE','concat','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./user.socket','request','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','code','error','User,\x20%s,\x20%s','message','result','catch','GetUser','User','options','where','attributes','limit','include','model','map','find','ShowUser','PauseUser','name','role','internal','interface','MemberReport','findAll','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5705bc,_0x8063c2){var _0x3c785d=function(_0x3537d0){while(--_0x3537d0){_0x5705bc['push'](_0x5705bc['shift']());}};_0x3c785d(++_0x8063c2);}(_0xc1da,0xdf));var _0xac1d=function(_0x262a4a,_0x60f91){_0x262a4a=_0x262a4a-0x0;var _0x590ff0=_0xc1da[_0x262a4a];return _0x590ff0;};'use strict';var _=require('lodash');var util=require(_0xac1d('0x0'));var moment=require(_0xac1d('0x1'));var BPromise=require(_0xac1d('0x2'));var rs=require(_0xac1d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac1d('0x4'))['db'];var utils=require(_0xac1d('0x5'));var logger=require(_0xac1d('0x6'))(_0xac1d('0x7'));var config=require(_0xac1d('0x8'));var jayson=require(_0xac1d('0x9'));var client=jayson['client'][_0xac1d('0xa')]({'port':0x232a});config[_0xac1d('0xb')]=_['defaults'](config[_0xac1d('0xb')],{'host':_0xac1d('0xc'),'port':0x18eb});var socket=require(_0xac1d('0xd'))(new Redis(config[_0xac1d('0xb')]));require(_0xac1d('0xe'))['register'](socket);function respondWithRpcPromise(_0x3221cc,_0x4af65e,_0x531815){return new BPromise(function(_0x1792fd,_0xbc48a){return client[_0xac1d('0xf')](_0x3221cc,_0x531815)[_0xac1d('0x10')](function(_0x4b160c){logger[_0xac1d('0x11')]('User,\x20%s,\x20%s',_0x4af65e,_0xac1d('0x12'));logger[_0xac1d('0x13')](_0xac1d('0x14'),_0x4af65e,_0xac1d('0x12'),JSON[_0xac1d('0x15')](_0x4b160c));if(_0x4b160c['error']){if(_0x4b160c['error'][_0xac1d('0x16')]===0x1f4){logger[_0xac1d('0x17')](_0xac1d('0x18'),_0x4af65e,_0x4b160c[_0xac1d('0x17')][_0xac1d('0x19')]);return _0xbc48a(_0x4b160c['error'][_0xac1d('0x19')]);}logger[_0xac1d('0x17')](_0xac1d('0x18'),_0x4af65e,_0x4b160c[_0xac1d('0x17')][_0xac1d('0x19')]);return _0x1792fd(_0x4b160c[_0xac1d('0x17')][_0xac1d('0x19')]);}else{logger[_0xac1d('0x11')]('User,\x20%s,\x20%s',_0x4af65e,_0xac1d('0x12'));_0x1792fd(_0x4b160c[_0xac1d('0x1a')][_0xac1d('0x19')]);}})[_0xac1d('0x1b')](function(_0x37bbdc){logger[_0xac1d('0x17')](_0xac1d('0x18'),_0x4af65e,_0x37bbdc);_0xbc48a(_0x37bbdc);});});}exports[_0xac1d('0x1c')]=function(_0x344791){var _0x200760=this;return new Promise(function(_0x4294e7,_0x278ed8){return db[_0xac1d('0x1d')]['findAll']({'raw':_0x344791[_0xac1d('0x1e')]?_0x344791['options']['raw']===undefined?!![]:![]:!![],'where':_0x344791['options']?_0x344791['options'][_0xac1d('0x1f')]||null:null,'attributes':_0x344791[_0xac1d('0x1e')]?_0x344791[_0xac1d('0x1e')][_0xac1d('0x20')]||null:null,'limit':_0x344791[_0xac1d('0x1e')]?_0x344791[_0xac1d('0x1e')][_0xac1d('0x21')]||null:null,'include':_0x344791[_0xac1d('0x1e')]?_0x344791[_0xac1d('0x1e')][_0xac1d('0x22')]?_['map'](_0x344791[_0xac1d('0x1e')][_0xac1d('0x22')],function(_0x440eb1){return{'model':db[_0x440eb1[_0xac1d('0x23')]],'as':_0x440eb1['as'],'attributes':_0x440eb1[_0xac1d('0x20')],'include':_0x440eb1[_0xac1d('0x22')]?_[_0xac1d('0x24')](_0x440eb1['include'],function(_0x435cf2){return{'model':db[_0x435cf2[_0xac1d('0x23')]],'as':_0x435cf2['as'],'attributes':_0x435cf2[_0xac1d('0x20')],'include':_0x435cf2['include']?_['map'](_0x435cf2[_0xac1d('0x22')],function(_0x1d2768){return{'model':db[_0x1d2768[_0xac1d('0x23')]],'as':_0x1d2768['as'],'attributes':_0x1d2768[_0xac1d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xac1d('0x10')](function(_0x3c1829){logger['info'](_0xac1d('0x1c'),_0x344791);logger[_0xac1d('0x13')]('GetUser',_0x344791,JSON[_0xac1d('0x15')](_0x3c1829));_0x4294e7(_0x3c1829);})[_0xac1d('0x1b')](function(_0x44f6f6){logger[_0xac1d('0x17')](_0xac1d('0x1c'),_0x44f6f6[_0xac1d('0x19')],_0x344791);_0x278ed8(_0x200760[_0xac1d('0x17')](0x1f4,_0x44f6f6['message']));});});};exports['ShowUser']=function(_0x1ffde8){var _0x50edd3=this;return new Promise(function(_0x2e1e92,_0x80fe3d){return db[_0xac1d('0x1d')][_0xac1d('0x25')]({'raw':_0x1ffde8[_0xac1d('0x1e')]?_0x1ffde8['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ffde8[_0xac1d('0x1e')]?_0x1ffde8[_0xac1d('0x1e')]['where']||null:null,'attributes':_0x1ffde8[_0xac1d('0x1e')]?_0x1ffde8[_0xac1d('0x1e')][_0xac1d('0x20')]||null:null,'include':_0x1ffde8[_0xac1d('0x1e')]?_0x1ffde8['options'][_0xac1d('0x22')]?_[_0xac1d('0x24')](_0x1ffde8['options'][_0xac1d('0x22')],function(_0x5522d1){return{'model':db[_0x5522d1['model']],'as':_0x5522d1['as'],'attributes':_0x5522d1[_0xac1d('0x20')],'include':_0x5522d1[_0xac1d('0x22')]?_[_0xac1d('0x24')](_0x5522d1['include'],function(_0x53f526){return{'model':db[_0x53f526[_0xac1d('0x23')]],'as':_0x53f526['as'],'attributes':_0x53f526[_0xac1d('0x20')],'include':_0x53f526['include']?_[_0xac1d('0x24')](_0x53f526['include'],function(_0x17e428){return{'model':db[_0x17e428[_0xac1d('0x23')]],'as':_0x17e428['as'],'attributes':_0x17e428[_0xac1d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xac1d('0x10')](function(_0x283e2b){logger[_0xac1d('0x11')]('ShowUser',_0x1ffde8);logger[_0xac1d('0x13')](_0xac1d('0x26'),_0x1ffde8,JSON[_0xac1d('0x15')](_0x283e2b));_0x2e1e92(_0x283e2b);})['catch'](function(_0x4b0a0c){logger[_0xac1d('0x17')](_0xac1d('0x26'),_0x4b0a0c[_0xac1d('0x19')],_0x1ffde8);_0x80fe3d(_0x50edd3[_0xac1d('0x17')](0x1f4,_0x4b0a0c[_0xac1d('0x19')]));});});};exports[_0xac1d('0x27')]=function(_0x22fa59){var _0x4b2ce3=this;return new Promise(function(_0x310d10,_0x4290b6){var _0x4b7528;return db[_0xac1d('0x1d')][_0xac1d('0x25')]({'where':_0x22fa59['options'][_0xac1d('0x1f')]||{},'attributes':['id',_0xac1d('0x28'),_0xac1d('0x29'),_0xac1d('0x2a'),_0xac1d('0x2b')]})[_0xac1d('0x10')](function(_0x38bf4d){if(_0x38bf4d){_0x4b7528=_0x38bf4d;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x4b7528['id']},'individualHooks':!![]});}})['then'](function(){if(_0x4b7528){return db[_0xac1d('0x2c')][_0xac1d('0x2d')]({'where':{'membername':_0x4b7528[_0xac1d('0x28')],'type':_0xac1d('0x2e'),'exitAt':null}});}})['then'](function(_0x3d9213){if(_0x4b7528){if(_0x3d9213&&_0x3d9213[_0xac1d('0x2f')]){var _0x294c18=moment()[_0xac1d('0x30')](_0xac1d('0x31'));for(var _0x413977=0x0,_0x1e6097=_0x3d9213[_0xac1d('0x2f')];_0x413977<_0x1e6097;_0x413977++){_0x3d9213[_0x413977][_0xac1d('0x32')]({'exitAt':_0x294c18});}}}})[_0xac1d('0x10')](function(){if(_0x4b7528){var _0x20fc59=[];var _0x313b43=utils[_0xac1d('0x33')]();_0x313b43['forEach'](function(_0x1c47d9){_0x20fc59[_0xac1d('0x34')]({'channel':_0x1c47d9,'membername':_0x4b7528[_0xac1d('0x28')],'interface':_[_0xac1d('0x35')](_0x4b7528[_0xac1d('0x2b')])?util[_0xac1d('0x30')]('SIP/%s',_0x4b7528[_0xac1d('0x28')]):_0x4b7528[_0xac1d('0x2b')],'type':_0xac1d('0x2e'),'enterAt':moment()[_0xac1d('0x30')](_0xac1d('0x31')),'data1':_0x22fa59['body'][_0xac1d('0x36')]||_0xac1d('0x37'),'role':_0x4b7528[_0xac1d('0x29')],'internal':_0x4b7528[_0xac1d('0x2a')],'uniqueid':_0x22fa59['body'][_0xac1d('0x38')]||null});});return db['MemberReport'][_0xac1d('0x39')](_0x20fc59,{'individualHooks':!![]});}})['then'](function(){if(_0x4b7528){return _0x4b7528[_0xac1d('0x3a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x22fa59['body'][_0xac1d('0x36')]||_0xac1d('0x37'),'lastPauseAt':moment()[_0xac1d('0x30')](_0xac1d('0x31'))});}})[_0xac1d('0x10')](function(_0x36be66){_0x310d10(_0x36be66);})[_0xac1d('0x1b')](function(_0x180d71){_0x4290b6(_0x4b2ce3[_0xac1d('0x17')](0x1f4,_0x180d71['message']));});});};exports[_0xac1d('0x3b')]=function(_0x55627d){var _0xf90f9d=this;return new Promise(function(_0x5d33ac,_0x102cd4){var _0x304d65;return db[_0xac1d('0x1d')][_0xac1d('0x3c')]({'where':_0x55627d[_0xac1d('0x1e')][_0xac1d('0x1f')]||{},'attributes':['id',_0xac1d('0x28')]})[_0xac1d('0x10')](function(_0x204c75){if(_0x204c75){_0x304d65=_0x204c75;if(_0x55627d[_0xac1d('0x3d')][_0xac1d('0x3e')]&&!utils[_0xac1d('0x3f')](_0x55627d[_0xac1d('0x3d')][_0xac1d('0x3e')])){throw new Error(_0xac1d('0x40'));}switch(_0x55627d[_0xac1d('0x3d')]['channel']){case'voice':return db[_0xac1d('0x41')]['update']({'paused':0x0},{'where':{'UserId':_0x304d65['id']}})['then'](function(){return db[_0xac1d('0x2c')][_0xac1d('0x25')]({'where':{'channel':_0x55627d[_0xac1d('0x3d')][_0xac1d('0x3e')],'membername':_0x304d65[_0xac1d('0x28')],'type':_0xac1d('0x2e'),'exitAt':null}});})[_0xac1d('0x10')](function(_0x48e9cf){if(_0x48e9cf){return _0x48e9cf[_0xac1d('0x3a')]({'exitAt':moment()[_0xac1d('0x30')](_0xac1d('0x31')),'data2':_0xac1d('0x42')},{'individualHooks':!![]});}return null;})[_0xac1d('0x10')](function(){return _0x304d65['update']({'voicePause':![]});});case _0xac1d('0x43'):case'chat':case _0xac1d('0x44'):case'sms':case _0xac1d('0x45'):case _0xac1d('0x46'):return db[_0xac1d('0x2c')][_0xac1d('0x25')]({'where':{'channel':_0x55627d['body']['channel'],'membername':_0x304d65[_0xac1d('0x28')],'type':_0xac1d('0x2e'),'exitAt':null}})[_0xac1d('0x10')](function(_0x29d5a2){return _0x29d5a2[_0xac1d('0x3a')]({'exitAt':moment()[_0xac1d('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});})[_0xac1d('0x10')](function(){var _0x57c03e={};_[_0xac1d('0x47')](_0x57c03e,util[_0xac1d('0x30')](_0xac1d('0x48'),_0x55627d[_0xac1d('0x3d')][_0xac1d('0x3e')],_0xac1d('0x49')),![]);return _0x304d65[_0xac1d('0x3a')](_0x57c03e);});default:return db['UserVoiceQueueRt'][_0xac1d('0x3a')]({'paused':0x0},{'where':{'UserId':_0x304d65['id']}})['then'](function(){return db[_0xac1d('0x2c')]['findAll']({'where':{'membername':_0x304d65[_0xac1d('0x28')],'type':'PAUSE','exitAt':null}});})[_0xac1d('0x10')](function(_0x34da8d){var _0x153d08=[];_0x34da8d[_0xac1d('0x4a')](function(_0x2afd7c){_0x153d08[_0xac1d('0x34')](_0x2afd7c[_0xac1d('0x3a')]({'exitAt':moment()['format'](_0xac1d('0x31')),'data2':_0xac1d('0x42')}));});return BPromise[_0xac1d('0x4b')](_0x153d08);})[_0xac1d('0x10')](function(){return _0x304d65[_0xac1d('0x3a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xac1d('0x10')](function(_0x45bee8){_0x5d33ac(_0x45bee8);})[_0xac1d('0x1b')](function(_0x1a77dc){_0x102cd4(_0xf90f9d[_0xac1d('0x17')](0x1f4,_0x1a77dc[_0xac1d('0x19')]));});});};exports[_0xac1d('0x4c')]=function(_0x1cd848){var _0xa850=this;return new Promise(function(_0x4d5b03,_0x315f11){var _0x4132a3;return db[_0xac1d('0x1d')]['findOne']({'where':_0x1cd848[_0xac1d('0x1e')][_0xac1d('0x1f')]||{},'attributes':['id',_0xac1d('0x28')]})[_0xac1d('0x10')](function(_0x4dbdf1){if(_0x4dbdf1){_0x4132a3=_0x4dbdf1;return db[_0xac1d('0x41')]['destroy']({'where':{'membername':_0x4132a3['name']},'individualHooks':!![]});}})[_0xac1d('0x10')](function(){if(_0x4132a3){return db[_0xac1d('0x2c')][_0xac1d('0x2d')]({'where':{'membername':_0x4132a3[_0xac1d('0x28')],'exitAt':null}});}})[_0xac1d('0x10')](function(_0x1ea5a5){if(_0x4132a3){if(_0x1ea5a5&&_0x1ea5a5[_0xac1d('0x2f')]){var _0x157ffe=[];_0x1ea5a5[_0xac1d('0x4a')](function(_0x33ee1a){_0x157ffe[_0xac1d('0x34')](_0x33ee1a[_0xac1d('0x3a')]({'exitAt':moment()[_0xac1d('0x30')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xac1d('0x4b')](_0x157ffe);}}})[_0xac1d('0x10')](function(){if(_0x4132a3){return _0x4132a3['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xac1d('0x10')](function(_0x3304c4){_0x4d5b03(_0x3304c4);})[_0xac1d('0x1b')](function(_0x219aa2){_0x315f11(_0xa850[_0xac1d('0x17')](0x1f4,_0x219aa2[_0xac1d('0x19')]));});});};exports['LoginUser']=function(_0x33cfb4){var _0x3f08de=this;return new Promise(function(_0x1d9659,_0x326fc5){var _0x29fd0d;var _0x62d69a;var _0x535bcb;var _0x137f31;return db[_0xac1d('0x1d')][_0xac1d('0x3c')]({'where':_0x33cfb4[_0xac1d('0x1e')][_0xac1d('0x1f')]||{},'attributes':['id',_0xac1d('0x28'),_0xac1d('0x29'),'mobile',_0xac1d('0x4d'),_0xac1d('0x2a'),'loginInPause',_0xac1d('0x2b')]})[_0xac1d('0x10')](function(_0x5374c9){if(_0x5374c9){_0x29fd0d=_0x5374c9;_0x137f31=_0x33cfb4[_0xac1d('0x3d')]['interface']?_0x33cfb4['body'][_0xac1d('0x2b')]:util[_0xac1d('0x30')]('SIP/%s',_0x29fd0d[_0xac1d('0x28')]);return db['User'][_0xac1d('0x4e')]({'where':{'role':_0xac1d('0x4f'),'online':!![],'id':{'$ne':_0x29fd0d['id']}}});}})['then'](function(_0x3ab47f){if(_0x3ab47f){_0x535bcb=_0x3ab47f;return require(_0xac1d('0x50'))['getLicense']();}})['then'](function(_0x39ac23){if(_0x39ac23&&_0x39ac23[_0xac1d('0x51')]&&_0x535bcb>=_0x39ac23[_0xac1d('0x51')]){throw new Error(_0xac1d('0x52'));}})[_0xac1d('0x10')](function(){if(_0x29fd0d){return db[_0xac1d('0x41')][_0xac1d('0x53')]({'where':{'membername':_0x29fd0d[_0xac1d('0x28')]},'individualHooks':!![]});}})['then'](function(){if(_0x29fd0d){return _0x29fd0d['getVoiceQueues']({'raw':!![]});}})[_0xac1d('0x10')](function(_0x51dc95){if(_0x29fd0d){if(_0x51dc95){var _0x629bfd=[];_0x62d69a=_0x51dc95;if(_0x62d69a['length']){for(var _0x3e066d=0x0;_0x3e066d<_0x62d69a['length'];_0x3e066d++){_0x629bfd[_0xac1d('0x34')](db[_0xac1d('0x41')][_0xac1d('0x54')]({'membername':_0x29fd0d[_0xac1d('0x28')],'UserId':_0x29fd0d['id'],'queue_name':_0x62d69a[_0x3e066d][_0xac1d('0x28')],'VoiceQueueId':_0x62d69a[_0x3e066d]['id'],'interface':_0x137f31,'paused':_0x29fd0d[_0xac1d('0x55')]||![],'penalty':_0x62d69a[_0x3e066d][_0xac1d('0x56')]||0x0}));}return BPromise[_0xac1d('0x4b')](_0x629bfd);}}}})[_0xac1d('0x10')](function(){if(_0x29fd0d){return db[_0xac1d('0x2c')][_0xac1d('0x2d')]({'where':{'membername':_0x29fd0d[_0xac1d('0x28')],'exitAt':null}});}})[_0xac1d('0x10')](function(_0x6d0bc5){if(_0x29fd0d){if(_0x6d0bc5&&_0x6d0bc5[_0xac1d('0x2f')]){var _0x34b8e8=[];_0x6d0bc5[_0xac1d('0x4a')](function(_0x517057){_0x34b8e8[_0xac1d('0x34')](_0x517057[_0xac1d('0x3a')]({'exitAt':moment()[_0xac1d('0x30')](_0xac1d('0x31'))}));});return BPromise[_0xac1d('0x4b')](_0x34b8e8);}}})[_0xac1d('0x10')](function(_0x5dea60){if(_0x29fd0d){var _0x4d5ca4=[];var _0x47defb=[];var _0x4f9061=utils['getChannels']();var _0x5bfa57={'membername':_0x29fd0d[_0xac1d('0x28')],'interface':_0x137f31,'enterAt':moment()[_0xac1d('0x30')](_0xac1d('0x31')),'role':_0x29fd0d['role'],'internal':_0x29fd0d[_0xac1d('0x2a')]};_0x4f9061['forEach'](function(_0x50ba9c){_0x4d5ca4[_0xac1d('0x34')](_['merge']({'channel':_0x50ba9c,'type':'LOGIN','data1':_0xac1d('0x57'),'data2':_0x137f31},_0x5bfa57));if(_0x29fd0d[_0xac1d('0x55')]){_0x47defb[_0xac1d('0x34')](_[_0xac1d('0x58')]({'channel':_0x50ba9c,'type':_0xac1d('0x2e'),'data1':_0xac1d('0x59')},_0x5bfa57));}});return db[_0xac1d('0x2c')][_0xac1d('0x39')](_0x4d5ca4[_0xac1d('0x5a')](_0x47defb),{'individualHooks':!![]});}})[_0xac1d('0x10')](function(){if(_0x29fd0d){return _0x29fd0d['update']({'online':!![],'lastLoginAt':moment()[_0xac1d('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x29fd0d[_0xac1d('0x55')]||![],'mailPause':_0x29fd0d[_0xac1d('0x55')]||![],'chatPause':_0x29fd0d[_0xac1d('0x55')]||![],'faxPause':_0x29fd0d[_0xac1d('0x55')]||![],'smsPause':_0x29fd0d[_0xac1d('0x55')]||![],'openchannelPause':_0x29fd0d[_0xac1d('0x55')]||![],'pauseType':_0x29fd0d[_0xac1d('0x55')]?_0xac1d('0x59'):null,'lastPauseAt':moment()[_0xac1d('0x30')](_0xac1d('0x31')),'interface':_0x137f31});}})[_0xac1d('0x10')](function(_0x5818d7){_0x1d9659(_0x5818d7);})[_0xac1d('0x1b')](function(_0x5eec56){_0x326fc5(_0x3f08de[_0xac1d('0x17')](0x1f4,_0x5eec56[_0xac1d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 2c6270a..7be531d 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 _0x7c5e=['./user.events','remove','removeListener','user:'];(function(_0x3abb58,_0x55302c){var _0x630c14=function(_0x193faf){while(--_0x193faf){_0x3abb58['push'](_0x3abb58['shift']());}};_0x630c14(++_0x55302c);}(_0x7c5e,0x84));var _0xe7c5=function(_0x41361f,_0x5af42f){_0x41361f=_0x41361f-0x0;var _0x5d853b=_0x7c5e[_0x41361f];return _0x5d853b;};'use strict';var UserEvents=require(_0xe7c5('0x0'));var events=['save',_0xe7c5('0x1'),'update'];function createListener(_0x5110fa,_0x2f3c80){return function(_0xdada7a){_0x2f3c80['emit'](_0x5110fa,_0xdada7a);};}function removeListener(_0x1a0cea,_0x1cdf59){return function(){UserEvents[_0xe7c5('0x2')](_0x1a0cea,_0x1cdf59);};}exports['register']=function(_0xd68916){for(var _0x9d0fd6=0x0,_0x50d8bb=events['length'];_0x9d0fd6<_0x50d8bb;_0x9d0fd6++){var _0xcb4f1e=events[_0x9d0fd6];var _0x33eca8=createListener(_0xe7c5('0x3')+_0xcb4f1e,_0xd68916);UserEvents['on'](_0xcb4f1e,_0x33eca8);}}; \ No newline at end of file +var _0x8000=['emit','length','./user.events','save','update'];(function(_0x35fac6,_0x10b30e){var _0x117c82=function(_0x4770c3){while(--_0x4770c3){_0x35fac6['push'](_0x35fac6['shift']());}};_0x117c82(++_0x10b30e);}(_0x8000,0xca));var _0x0800=function(_0x3df0fa,_0x5418e8){_0x3df0fa=_0x3df0fa-0x0;var _0x1c1bbf=_0x8000[_0x3df0fa];return _0x1c1bbf;};'use strict';var UserEvents=require(_0x0800('0x0'));var events=[_0x0800('0x1'),'remove',_0x0800('0x2')];function createListener(_0x2f495e,_0x2ab220){return function(_0x2e68ec){_0x2ab220[_0x0800('0x3')](_0x2f495e,_0x2e68ec);};}function removeListener(_0x26fa51,_0xe543f3){return function(){UserEvents['removeListener'](_0x26fa51,_0xe543f3);};}exports['register']=function(_0x40e069){for(var _0x3ae58b=0x0,_0x1a4873=events[_0x0800('0x4')];_0x3ae58b<_0x1a4873;_0x3ae58b++){var _0x3ec335=events[_0x3ae58b];var _0x1744c9=createListener('user:'+_0x3ec335,_0x40e069);UserEvents['on'](_0x3ec335,_0x1744c9);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 746cb6a..5ba8f94 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 _0xbee0=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','util'];(function(_0x174e25,_0x1fd087){var _0x3ea357=function(_0x1e804b){while(--_0x1e804b){_0x174e25['push'](_0x174e25['shift']());}};_0x3ea357(++_0x1fd087);}(_0xbee0,0x147));var _0x0bee=function(_0x2900b7,_0x36c2f8){_0x2900b7=_0x2900b7-0x0;var _0x3951ff=_0xbee0[_0x2900b7];return _0x3951ff;};'use strict';var multer=require('multer');var util=require(_0x0bee('0x0'));var path=require(_0x0bee('0x1'));var timeout=require(_0x0bee('0x2'));var express=require(_0x0bee('0x3'));var router=express[_0x0bee('0x4')]();var fs_extra=require(_0x0bee('0x5'));var auth=require(_0x0bee('0x6'));var interaction=require(_0x0bee('0x7'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x693f=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x4637a9,_0x36ccdb){var _0x2b5179=function(_0x1df93a){while(--_0x1df93a){_0x4637a9['push'](_0x4637a9['shift']());}};_0x2b5179(++_0x36ccdb);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xf693('0x0'));var util=require(_0xf693('0x1'));var path=require(_0xf693('0x2'));var timeout=require(_0xf693('0x3'));var express=require('express');var router=express[_0xf693('0x4')]();var fs_extra=require(_0xf693('0x5'));var auth=require(_0xf693('0x6'));var interaction=require(_0xf693('0x7'));var config=require(_0xf693('0x8'));module[_0xf693('0x9')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index dfc2f88..fbfc736 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x5ec365,_0x49930c){var _0xab187d=function(_0x4d4bbd){while(--_0x4d4bbd){_0x5ec365['push'](_0x5ec365['shift']());}};_0xab187d(++_0x49930c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x479ea9,_0x426cea){var _0x26ffa4=function(_0x30cc38){while(--_0x30cc38){_0x479ea9['push'](_0x479ea9['shift']());}};_0x26ffa4(++_0x426cea);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d2f15,_0x1107c6){_0x1d2f15=_0x1d2f15-0x0;var _0x19efd2=_0xb10b[_0x1d2f15];return _0x19efd2;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 1418cf2..736a4ac 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 _0x745c=['path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0x745c,0xa2));var _0xc745=function(_0x4d3a2b,_0x32a224){_0x4d3a2b=_0x4d3a2b-0x0;var _0xdd32c8=_0x745c[_0x4d3a2b];return _0xdd32c8;};'use strict';var _=require(_0xc745('0x0'));var util=require(_0xc745('0x1'));var logger=require(_0xc745('0x2'))(_0xc745('0x3'));var moment=require('moment');var BPromise=require(_0xc745('0x4'));var rp=require(_0xc745('0x5'));var fs=require('fs');var path=require(_0xc745('0x6'));var rimraf=require(_0xc745('0x7'));var config=require(_0xc745('0x8'));var attributes=require(_0xc745('0x9'));module[_0xc745('0xa')]=function(_0x4785ec,_0x15b8f7){return _0x4785ec[_0xc745('0xb')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11d5=['../../config/environment','./userChatQueue.attributes','define','UserChatQueue','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x4a5c16,_0x2eb3c4){var _0x4c9004=function(_0x207a76){while(--_0x207a76){_0x4a5c16['push'](_0x4a5c16['shift']());}};_0x4c9004(++_0x2eb3c4);}(_0x11d5,0x130));var _0x511d=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x11d5[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x511d('0x0'));var util=require(_0x511d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x511d('0x2'));var BPromise=require(_0x511d('0x3'));var rp=require(_0x511d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x511d('0x5'));var config=require(_0x511d('0x6'));var attributes=require(_0x511d('0x7'));module['exports']=function(_0x1c1bb6,_0x1dc190){return _0x1c1bb6[_0x511d('0x8')](_0x511d('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 38fc15d..c3b7e18 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 _0x106d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserChatQueue,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x42c021,_0x121942){var _0x1cfc4d=function(_0x37ef71){while(--_0x37ef71){_0x42c021['push'](_0x42c021['shift']());}};_0x1cfc4d(++_0x121942);}(_0x106d,0xf6));var _0xd106=function(_0x53558a,_0x4255e7){_0x53558a=_0x53558a-0x0;var _0x3d13b5=_0x106d[_0x53558a];return _0x3d13b5;};'use strict';var _=require(_0xd106('0x0'));var util=require('util');var moment=require(_0xd106('0x1'));var BPromise=require(_0xd106('0x2'));var rs=require(_0xd106('0x3'));var fs=require('fs');var Redis=require(_0xd106('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd106('0x5'));var logger=require(_0xd106('0x6'))(_0xd106('0x7'));var config=require(_0xd106('0x8'));var jayson=require(_0xd106('0x9'));var client=jayson[_0xd106('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd95a9a,_0x12b88c,_0x2ef24a){return new BPromise(function(_0x4385eb,_0x3de872){return client['request'](_0xd95a9a,_0x2ef24a)[_0xd106('0xb')](function(_0xf030bb){logger[_0xd106('0xc')](_0xd106('0xd'),_0x12b88c,'request\x20sent');logger[_0xd106('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x12b88c,'request\x20sent',JSON[_0xd106('0xf')](_0xf030bb));if(_0xf030bb[_0xd106('0x10')]){if(_0xf030bb[_0xd106('0x10')][_0xd106('0x11')]===0x1f4){logger[_0xd106('0x10')](_0xd106('0xd'),_0x12b88c,_0xf030bb['error']['message']);return _0x3de872(_0xf030bb[_0xd106('0x10')][_0xd106('0x12')]);}logger['error'](_0xd106('0xd'),_0x12b88c,_0xf030bb[_0xd106('0x10')][_0xd106('0x12')]);return _0x4385eb(_0xf030bb[_0xd106('0x10')][_0xd106('0x12')]);}else{logger[_0xd106('0xc')](_0xd106('0xd'),_0x12b88c,_0xd106('0x13'));_0x4385eb(_0xf030bb['result'][_0xd106('0x12')]);}})[_0xd106('0x14')](function(_0x47dc1b){logger[_0xd106('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x12b88c,_0x47dc1b);_0x3de872(_0x47dc1b);});});} \ No newline at end of file +var _0x0068=['UserChatQueue,\x20%s,\x20%s,\x20%s','error','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x586af3,_0x225c2){var _0x25e557=function(_0x43be17){while(--_0x43be17){_0x586af3['push'](_0x586af3['shift']());}};_0x25e557(++_0x225c2);}(_0x0068,0x15a));var _0x8006=function(_0x28d434,_0x2d2610){_0x28d434=_0x28d434-0x0;var _0x1109c6=_0x0068[_0x28d434];return _0x1109c6;};'use strict';var _=require(_0x8006('0x0'));var util=require(_0x8006('0x1'));var moment=require(_0x8006('0x2'));var BPromise=require('bluebird');var rs=require(_0x8006('0x3'));var fs=require('fs');var Redis=require(_0x8006('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8006('0x5'))(_0x8006('0x6'));var config=require(_0x8006('0x7'));var jayson=require(_0x8006('0x8'));var client=jayson[_0x8006('0x9')][_0x8006('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7caef2,_0x29297f,_0x13f5bb){return new BPromise(function(_0x29a520,_0x1c2a28){return client['request'](_0x7caef2,_0x13f5bb)[_0x8006('0xb')](function(_0x415a12){logger[_0x8006('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x29297f,_0x8006('0xd'));logger['debug'](_0x8006('0xe'),_0x29297f,_0x8006('0xd'),JSON['stringify'](_0x415a12));if(_0x415a12[_0x8006('0xf')]){if(_0x415a12['error']['code']===0x1f4){logger[_0x8006('0xf')](_0x8006('0x10'),_0x29297f,_0x415a12[_0x8006('0xf')][_0x8006('0x11')]);return _0x1c2a28(_0x415a12[_0x8006('0xf')][_0x8006('0x11')]);}logger['error'](_0x8006('0x10'),_0x29297f,_0x415a12[_0x8006('0xf')][_0x8006('0x11')]);return _0x29a520(_0x415a12[_0x8006('0xf')][_0x8006('0x11')]);}else{logger['info'](_0x8006('0x10'),_0x29297f,_0x8006('0xd'));_0x29a520(_0x415a12[_0x8006('0x12')][_0x8006('0x11')]);}})[_0x8006('0x13')](function(_0x4d8d5c){logger[_0x8006('0xf')](_0x8006('0x10'),_0x29297f,_0x4d8d5c);_0x1c2a28(_0x4d8d5c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index cb58335..c63584d 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 _0x6b72=['multer','path','connect-timeout','Router','fs-extra','../../config/environment','exports'];(function(_0x450a41,_0x2fe2aa){var _0xdd6047=function(_0x2e2992){while(--_0x2e2992){_0x450a41['push'](_0x450a41['shift']());}};_0xdd6047(++_0x2fe2aa);}(_0x6b72,0x19d));var _0x26b7=function(_0x353ad3,_0xe26fb){_0x353ad3=_0x353ad3-0x0;var _0x1ca3d3=_0x6b72[_0x353ad3];return _0x1ca3d3;};'use strict';var multer=require(_0x26b7('0x0'));var util=require('util');var path=require(_0x26b7('0x1'));var timeout=require(_0x26b7('0x2'));var express=require('express');var router=express[_0x26b7('0x3')]();var fs_extra=require(_0x26b7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x26b7('0x5'));module[_0x26b7('0x6')]=router; \ No newline at end of file +var _0xda3f=['../../config/environment','util','path','fs-extra','../../components/interaction/service'];(function(_0x302b5e,_0x564a8e){var _0x523ab7=function(_0x6aec8f){while(--_0x6aec8f){_0x302b5e['push'](_0x302b5e['shift']());}};_0x523ab7(++_0x564a8e);}(_0xda3f,0xec));var _0xfda3=function(_0x319a34,_0x4db06){_0x319a34=_0x319a34-0x0;var _0x23234c=_0xda3f[_0x319a34];return _0x23234c;};'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'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 27ca0d4..ccc701e 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 _0x6cb4=['exports','INTEGER','STRING','sequelize'];(function(_0x227420,_0x1c2319){var _0x54dbc4=function(_0x37d3b0){while(--_0x37d3b0){_0x227420['push'](_0x227420['shift']());}};_0x54dbc4(++_0x1c2319);}(_0x6cb4,0xff));var _0x46cb=function(_0x1b4aaf,_0x1a21b6){_0x1b4aaf=_0x1b4aaf-0x0;var _0xedd43e=_0x6cb4[_0x1b4aaf];return _0xedd43e;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'penalty':{'type':Sequelize[_0x46cb('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x46cb('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x46cb('0x3')]}}; \ No newline at end of file +var _0x9ffd=['INTEGER','STRING','sequelize','exports'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x3544a2,_0xe1a949){_0x3544a2=_0x3544a2-0x0;var _0x3e2cad=_0x9ffd[_0x3544a2];return _0x3e2cad;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'penalty':{'type':Sequelize[_0xd9ff('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xd9ff('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 40afc5d..f42fdf3 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 _0xcd5e=['exports','UserFaxQueue','user_has_fax_queues','moment','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x394e42,_0x2bd028){var _0x316f17=function(_0x260cbc){while(--_0x260cbc){_0x394e42['push'](_0x394e42['shift']());}};_0x316f17(++_0x2bd028);}(_0xcd5e,0xb3));var _0xecd5=function(_0x43637d,_0x553e14){_0x43637d=_0x43637d-0x0;var _0x2d7ab3=_0xcd5e[_0x43637d];return _0x2d7ab3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xecd5('0x0'));var BPromise=require('bluebird');var rp=require(_0xecd5('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xecd5('0x2'));var config=require(_0xecd5('0x3'));var attributes=require(_0xecd5('0x4'));module[_0xecd5('0x5')]=function(_0x53a12b,_0x3002a2){return _0x53a12b['define'](_0xecd5('0x6'),attributes,{'tableName':_0xecd5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3da5=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','api'];(function(_0x5ed21f,_0x24e6c6){var _0x18a335=function(_0x29dd35){while(--_0x29dd35){_0x5ed21f['push'](_0x5ed21f['shift']());}};_0x18a335(++_0x24e6c6);}(_0x3da5,0x131));var _0x53da=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x3da5[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x53da('0x0'));var util=require(_0x53da('0x1'));var logger=require('../../config/logger')(_0x53da('0x2'));var moment=require(_0x53da('0x3'));var BPromise=require(_0x53da('0x4'));var rp=require(_0x53da('0x5'));var fs=require('fs');var path=require(_0x53da('0x6'));var rimraf=require(_0x53da('0x7'));var config=require(_0x53da('0x8'));var attributes=require('./userFaxQueue.attributes');module[_0x53da('0x9')]=function(_0x264b50,_0x1a6f40){return _0x264b50[_0x53da('0xa')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 83e7ab9..b9edbe0 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 _0x0e1d=['code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x139e38,_0x272286){var _0x3413f1=function(_0x318bb7){while(--_0x318bb7){_0x139e38['push'](_0x139e38['shift']());}};_0x3413f1(++_0x272286);}(_0x0e1d,0xb9));var _0xd0e1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0e1d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd0e1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd0e1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd0e1('0x2'));var db=require(_0xd0e1('0x3'))['db'];var utils=require(_0xd0e1('0x4'));var logger=require('../../config/logger')(_0xd0e1('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd0e1('0x6')][_0xd0e1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x36fcbe,_0x993630,_0x43d8bd){return new BPromise(function(_0x47f0e7,_0x16a3c0){return client[_0xd0e1('0x8')](_0x36fcbe,_0x43d8bd)[_0xd0e1('0x9')](function(_0x5bc0db){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x993630,'request\x20sent');logger[_0xd0e1('0xa')](_0xd0e1('0xb'),_0x993630,_0xd0e1('0xc'),JSON[_0xd0e1('0xd')](_0x5bc0db));if(_0x5bc0db[_0xd0e1('0xe')]){if(_0x5bc0db[_0xd0e1('0xe')][_0xd0e1('0xf')]===0x1f4){logger[_0xd0e1('0xe')](_0xd0e1('0x10'),_0x993630,_0x5bc0db[_0xd0e1('0xe')][_0xd0e1('0x11')]);return _0x16a3c0(_0x5bc0db[_0xd0e1('0xe')][_0xd0e1('0x11')]);}logger[_0xd0e1('0xe')](_0xd0e1('0x10'),_0x993630,_0x5bc0db[_0xd0e1('0xe')]['message']);return _0x47f0e7(_0x5bc0db[_0xd0e1('0xe')][_0xd0e1('0x11')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x993630,_0xd0e1('0xc'));_0x47f0e7(_0x5bc0db[_0xd0e1('0x12')][_0xd0e1('0x11')]);}})[_0xd0e1('0x13')](function(_0x2f6e35){logger[_0xd0e1('0xe')](_0xd0e1('0x10'),_0x993630,_0x2f6e35);_0x16a3c0(_0x2f6e35);});});} \ No newline at end of file +var _0x1cbc=['../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x248c00,_0x4f5e0f){var _0x716e84=function(_0x223f63){while(--_0x223f63){_0x248c00['push'](_0x248c00['shift']());}};_0x716e84(++_0x4f5e0f);}(_0x1cbc,0xf4));var _0xc1cb=function(_0x2a6fd5,_0x3d6deb){_0x2a6fd5=_0x2a6fd5-0x0;var _0x43c6a4=_0x1cbc[_0x2a6fd5];return _0x43c6a4;};'use strict';var _=require(_0xc1cb('0x0'));var util=require('util');var moment=require(_0xc1cb('0x1'));var BPromise=require(_0xc1cb('0x2'));var rs=require(_0xc1cb('0x3'));var fs=require('fs');var Redis=require(_0xc1cb('0x4'));var db=require(_0xc1cb('0x5'))['db'];var utils=require(_0xc1cb('0x6'));var logger=require(_0xc1cb('0x7'))(_0xc1cb('0x8'));var config=require(_0xc1cb('0x9'));var jayson=require(_0xc1cb('0xa'));var client=jayson[_0xc1cb('0xb')][_0xc1cb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56f1c8,_0x1735ab,_0x54cd03){return new BPromise(function(_0xe5da07,_0x271f7d){return client['request'](_0x56f1c8,_0x54cd03)[_0xc1cb('0xd')](function(_0xb3fff7){logger[_0xc1cb('0xe')](_0xc1cb('0xf'),_0x1735ab,_0xc1cb('0x10'));logger[_0xc1cb('0x11')](_0xc1cb('0x12'),_0x1735ab,_0xc1cb('0x10'),JSON['stringify'](_0xb3fff7));if(_0xb3fff7[_0xc1cb('0x13')]){if(_0xb3fff7['error'][_0xc1cb('0x14')]===0x1f4){logger[_0xc1cb('0x13')](_0xc1cb('0xf'),_0x1735ab,_0xb3fff7[_0xc1cb('0x13')][_0xc1cb('0x15')]);return _0x271f7d(_0xb3fff7[_0xc1cb('0x13')][_0xc1cb('0x15')]);}logger['error'](_0xc1cb('0xf'),_0x1735ab,_0xb3fff7[_0xc1cb('0x13')][_0xc1cb('0x15')]);return _0xe5da07(_0xb3fff7[_0xc1cb('0x13')]['message']);}else{logger[_0xc1cb('0xe')](_0xc1cb('0xf'),_0x1735ab,'request\x20sent');_0xe5da07(_0xb3fff7['result'][_0xc1cb('0x15')]);}})[_0xc1cb('0x16')](function(_0xc10170){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x1735ab,_0xc10170);_0x271f7d(_0xc10170);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 6126a3b..5d6711b 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 _0x887b=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports','multer'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x887b,0x185));var _0xb887=function(_0x25b6cd,_0x3a3ac5){_0x25b6cd=_0x25b6cd-0x0;var _0x5d2864=_0x887b[_0x25b6cd];return _0x5d2864;};'use strict';var multer=require(_0xb887('0x0'));var util=require(_0xb887('0x1'));var path=require(_0xb887('0x2'));var timeout=require(_0xb887('0x3'));var express=require(_0xb887('0x4'));var router=express[_0xb887('0x5')]();var fs_extra=require(_0xb887('0x6'));var auth=require(_0xb887('0x7'));var interaction=require(_0xb887('0x8'));var config=require('../../config/environment');module[_0xb887('0x9')]=router; \ No newline at end of file +var _0xf6ed=['multer','path','connect-timeout','express','../../components/auth/service','exports'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x3cd7fb,_0x4a14da){_0x3cd7fb=_0x3cd7fb-0x0;var _0x3cfd4b=_0xf6ed[_0x3cd7fb];return _0x3cfd4b;};'use strict';var multer=require(_0xdf6e('0x0'));var util=require('util');var path=require(_0xdf6e('0x1'));var timeout=require(_0xdf6e('0x2'));var express=require(_0xdf6e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdf6e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xdf6e('0x5')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index e5c0f81..065527b 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 _0xd8b0=['exports','sequelize'];(function(_0x28d71d,_0x3f8321){var _0x4c5c0e=function(_0x1be7a1){while(--_0x1be7a1){_0x28d71d['push'](_0x28d71d['shift']());}};_0x4c5c0e(++_0x3f8321);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x1a3c7d,_0x1d871d){var _0x2134ed=function(_0x2b99dc){while(--_0x2b99dc){_0x1a3c7d['push'](_0x1a3c7d['shift']());}};_0x2134ed(++_0x1d871d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index ba81fe2..22e03a3 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 _0xe706=['request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x18e4bd,_0x2d79fe){var _0x46fa7d=function(_0x3a15a6){while(--_0x3a15a6){_0x18e4bd['push'](_0x18e4bd['shift']());}};_0x46fa7d(++_0x2d79fe);}(_0xe706,0xa3));var _0x6e70=function(_0x23f8c8,_0xb536b9){_0x23f8c8=_0x23f8c8-0x0;var _0x3dc718=_0xe706[_0x23f8c8];return _0x3dc718;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['UserMailQueue','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','define'];(function(_0x3ff703,_0x56f6cb){var _0x500d02=function(_0xf852f4){while(--_0xf852f4){_0x3ff703['push'](_0x3ff703['shift']());}};_0x500d02(++_0x56f6cb);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xb7e7[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 722fb4a..e8da556 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 _0x2f3d=['message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x4c9730,_0x412b10){var _0x16a1ef=function(_0x3deef2){while(--_0x3deef2){_0x4c9730['push'](_0x4c9730['shift']());}};_0x16a1ef(++_0x412b10);}(_0x2f3d,0x1a8));var _0xd2f3=function(_0x202a13,_0x3551f6){_0x202a13=_0x202a13-0x0;var _0x58769a=_0x2f3d[_0x202a13];return _0x58769a;};'use strict';var _=require('lodash');var util=require(_0xd2f3('0x0'));var moment=require(_0xd2f3('0x1'));var BPromise=require(_0xd2f3('0x2'));var rs=require(_0xd2f3('0x3'));var fs=require('fs');var Redis=require(_0xd2f3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd2f3('0x5'))(_0xd2f3('0x6'));var config=require(_0xd2f3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd2f3('0x8')][_0xd2f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ce833,_0x246206,_0x373abb){return new BPromise(function(_0x1baa40,_0x1275d7){return client['request'](_0x2ce833,_0x373abb)[_0xd2f3('0xa')](function(_0x3a5fba){logger['info'](_0xd2f3('0xb'),_0x246206,_0xd2f3('0xc'));logger[_0xd2f3('0xd')](_0xd2f3('0xe'),_0x246206,_0xd2f3('0xc'),JSON['stringify'](_0x3a5fba));if(_0x3a5fba['error']){if(_0x3a5fba['error'][_0xd2f3('0xf')]===0x1f4){logger[_0xd2f3('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x246206,_0x3a5fba[_0xd2f3('0x10')]['message']);return _0x1275d7(_0x3a5fba['error'][_0xd2f3('0x11')]);}logger[_0xd2f3('0x10')](_0xd2f3('0xb'),_0x246206,_0x3a5fba[_0xd2f3('0x10')][_0xd2f3('0x11')]);return _0x1baa40(_0x3a5fba[_0xd2f3('0x10')][_0xd2f3('0x11')]);}else{logger[_0xd2f3('0x12')](_0xd2f3('0xb'),_0x246206,_0xd2f3('0xc'));_0x1baa40(_0x3a5fba[_0xd2f3('0x13')]['message']);}})[_0xd2f3('0x14')](function(_0x406272){logger[_0xd2f3('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x246206,_0x406272);_0x1275d7(_0x406272);});});} \ No newline at end of file +var _0x2b0a=['util','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash'];(function(_0x66da2e,_0x286aaf){var _0x1f232d=function(_0x250db3){while(--_0x250db3){_0x66da2e['push'](_0x66da2e['shift']());}};_0x1f232d(++_0x286aaf);}(_0x2b0a,0x84));var _0xa2b0=function(_0x4b2b2d,_0x55f1e5){_0x4b2b2d=_0x4b2b2d-0x0;var _0xf90dcb=_0x2b0a[_0x4b2b2d];return _0xf90dcb;};'use strict';var _=require(_0xa2b0('0x0'));var util=require(_0xa2b0('0x1'));var moment=require('moment');var BPromise=require(_0xa2b0('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(_0xa2b0('0x3'))(_0xa2b0('0x4'));var config=require(_0xa2b0('0x5'));var jayson=require(_0xa2b0('0x6'));var client=jayson[_0xa2b0('0x7')][_0xa2b0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ea48a,_0x5dd8e5,_0x2e1c2a){return new BPromise(function(_0x5e5b24,_0x53be2f){return client[_0xa2b0('0x9')](_0x5ea48a,_0x2e1c2a)[_0xa2b0('0xa')](function(_0x336127){logger[_0xa2b0('0xb')](_0xa2b0('0xc'),_0x5dd8e5,_0xa2b0('0xd'));logger['debug'](_0xa2b0('0xe'),_0x5dd8e5,_0xa2b0('0xd'),JSON[_0xa2b0('0xf')](_0x336127));if(_0x336127['error']){if(_0x336127[_0xa2b0('0x10')][_0xa2b0('0x11')]===0x1f4){logger['error'](_0xa2b0('0xc'),_0x5dd8e5,_0x336127['error'][_0xa2b0('0x12')]);return _0x53be2f(_0x336127[_0xa2b0('0x10')][_0xa2b0('0x12')]);}logger[_0xa2b0('0x10')](_0xa2b0('0xc'),_0x5dd8e5,_0x336127[_0xa2b0('0x10')][_0xa2b0('0x12')]);return _0x5e5b24(_0x336127[_0xa2b0('0x10')][_0xa2b0('0x12')]);}else{logger[_0xa2b0('0xb')](_0xa2b0('0xc'),_0x5dd8e5,_0xa2b0('0xd'));_0x5e5b24(_0x336127['result']['message']);}})['catch'](function(_0xe2ed83){logger['error'](_0xa2b0('0xc'),_0x5dd8e5,_0xe2ed83);_0x53be2f(_0xe2ed83);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 57ef0a1..a4481a7 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 _0x2a74=['sendUserNotification','exports','multer','path','express','../../components/auth/service','../../config/environment','./userNotification.controller','post','isAuthenticated'];(function(_0x1e9518,_0x1c74d0){var _0x291910=function(_0x41009e){while(--_0x41009e){_0x1e9518['push'](_0x1e9518['shift']());}};_0x291910(++_0x1c74d0);}(_0x2a74,0xe8));var _0x42a7=function(_0x5756c6,_0x58290a){_0x5756c6=_0x5756c6-0x0;var _0x4b5806=_0x2a74[_0x5756c6];return _0x4b5806;};'use strict';var multer=require(_0x42a7('0x0'));var util=require('util');var path=require(_0x42a7('0x1'));var timeout=require('connect-timeout');var express=require(_0x42a7('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x42a7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x42a7('0x4'));var controller=require(_0x42a7('0x5'));router[_0x42a7('0x6')]('/',auth[_0x42a7('0x7')](),controller[_0x42a7('0x8')]);module[_0x42a7('0x9')]=router; \ No newline at end of file +var _0x34ff=['sendUserNotification','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post'];(function(_0x9fe970,_0x2e9f2e){var _0x2256d0=function(_0x50f677){while(--_0x50f677){_0x9fe970['push'](_0x9fe970['shift']());}};_0x2256d0(++_0x2e9f2e);}(_0x34ff,0x91));var _0xf34f=function(_0x50c21b,_0x4532d0){_0x50c21b=_0x50c21b-0x0;var _0x20efc2=_0x34ff[_0x50c21b];return _0x20efc2;};'use strict';var multer=require(_0xf34f('0x0'));var util=require('util');var path=require(_0xf34f('0x1'));var timeout=require('connect-timeout');var express=require(_0xf34f('0x2'));var router=express[_0xf34f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf34f('0x4'));var interaction=require(_0xf34f('0x5'));var config=require('../../config/environment');var controller=require(_0xf34f('0x6'));router[_0xf34f('0x7')]('/',auth['isAuthenticated'](),controller[_0xf34f('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index f0ecb54..6524a7b 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 _0xbbde=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x49052b,_0x1612f7){var _0x2f40cf=function(_0x3357a2){while(--_0x3357a2){_0x49052b['push'](_0x49052b['shift']());}};_0x2f40cf(++_0x1612f7);}(_0xbbde,0x180));var _0xebbd=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0xbbde[_0x23c73d];return _0x36ba47;};'use strict';var Sequelize=require(_0xebbd('0x0'));module[_0xebbd('0x1')]={'body':{'type':Sequelize[_0xebbd('0x2')]},'senderName':{'type':Sequelize[_0xebbd('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xebbd('0x3')]},'beep':{'type':Sequelize[_0xebbd('0x4')]}}; \ No newline at end of file +var _0x2926=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x5303cf,_0x44450c){var _0xfa81a8=function(_0x439417){while(--_0x439417){_0x5303cf['push'](_0x5303cf['shift']());}};_0xfa81a8(++_0x44450c);}(_0x2926,0xd4));var _0x6292=function(_0x24697b,_0x2eb072){_0x24697b=_0x24697b-0x0;var _0x585b99=_0x2926[_0x24697b];return _0x585b99;};'use strict';var Sequelize=require(_0x6292('0x0'));module[_0x6292('0x1')]={'body':{'type':Sequelize[_0x6292('0x2')]},'senderName':{'type':Sequelize[_0x6292('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x6292('0x3')]},'beep':{'type':Sequelize[_0x6292('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 02fe068..9e7054b 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 _0x57ca=['join','sequelize','transaction','UserNotification','create','forEach','emit','Template','Invalid\x20\x27TemplateId\x27\x20parameter','html','startCase','model','User','union','ids','queue','replace','Queue','push','flatten','catch','findOne','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','stack','name','send','render','merge','body','contact','message','agent','interaction','account','sendUserNotification','hasOwnProperty','text','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy'];(function(_0x8d40f3,_0x354ea8){var _0x2be1cf=function(_0x4da71e){while(--_0x4da71e){_0x8d40f3['push'](_0x8d40f3['shift']());}};_0x2be1cf(++_0x354ea8);}(_0x57ca,0x86));var _0xa57c=function(_0x4f7963,_0x4ed848){_0x4f7963=_0x4f7963-0x0;var _0xb9e6ef=_0x57ca[_0x4f7963];return _0xb9e6ef;};'use strict';var emlformat=require(_0xa57c('0x0'));var rimraf=require(_0xa57c('0x1'));var zipdir=require(_0xa57c('0x2'));var jsonpatch=require(_0xa57c('0x3'));var rp=require('request-promise');var moment=require(_0xa57c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa57c('0xa'));var squel=require(_0xa57c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa57c('0xc'));var toCsv=require(_0xa57c('0x8'));var querystring=require(_0xa57c('0xd'));var Papa=require(_0xa57c('0xe'));var Redis=require(_0xa57c('0xf'));var authService=require(_0xa57c('0x10'));var qs=require(_0xa57c('0x11'));var as=require(_0xa57c('0x12'));var hardwareService=require(_0xa57c('0x13'));var logger=require(_0xa57c('0x14'))('api');var utils=require(_0xa57c('0x15'));var config=require(_0xa57c('0x16'));var licenseUtil=require(_0xa57c('0x17'));var db=require(_0xa57c('0x18'))['db'];config['redis']=_[_0xa57c('0x19')](config['redis'],{'host':_0xa57c('0x1a'),'port':0x18eb});var socket=require(_0xa57c('0x1b'))(new Redis(config['redis']));require(_0xa57c('0x1c'))[_0xa57c('0x1d')](socket);function respondWithStatusCode(_0x5082f5,_0x27489b){_0x27489b=_0x27489b||0xcc;return function(_0x1157ff){if(_0x1157ff){return _0x5082f5[_0xa57c('0x1e')](_0x27489b);}return _0x5082f5[_0xa57c('0x1f')](_0x27489b)[_0xa57c('0x20')]();};}function respondWithResult(_0x37fd21,_0x398808){_0x398808=_0x398808||0xc8;return function(_0x5c539f){if(_0x5c539f){return _0x37fd21[_0xa57c('0x1f')](_0x398808)[_0xa57c('0x21')](_0x5c539f);}};}function respondWithFilteredResult(_0x211ef7,_0x1397d0){return function(_0x35edcc){if(_0x35edcc){var _0x533c50=typeof _0x1397d0[_0xa57c('0x22')]===_0xa57c('0x23')&&typeof _0x1397d0[_0xa57c('0x24')]===_0xa57c('0x23');var _0x2f5fc2=_0x35edcc[_0xa57c('0x25')];var _0x29a90b=_0x533c50?0x0:_0x1397d0['offset'];var _0x54947b=_0x533c50?_0x35edcc[_0xa57c('0x25')]:_0x1397d0[_0xa57c('0x22')]+_0x1397d0[_0xa57c('0x24')];var _0x573f0f;if(_0x54947b>=_0x2f5fc2){_0x54947b=_0x2f5fc2;_0x573f0f=0xc8;}else{_0x573f0f=0xce;}_0x211ef7['status'](_0x573f0f);return _0x211ef7[_0xa57c('0x26')](_0xa57c('0x27'),_0x29a90b+'-'+_0x54947b+'/'+_0x2f5fc2)[_0xa57c('0x21')](_0x35edcc);}return null;};}function patchUpdates(_0x4980ab){return function(_0x332173){try{jsonpatch[_0xa57c('0x28')](_0x332173,_0x4980ab,!![]);}catch(_0x4cd436){return BPromise['reject'](_0x4cd436);}return _0x332173[_0xa57c('0x29')]();};}function saveUpdates(_0x589df3,_0x147b14){return function(_0x32e696){if(_0x32e696){return _0x32e696['update'](_0x589df3)['then'](function(_0x3f14bc){return _0x3f14bc;});}return null;};}function removeEntity(_0x116ce2,_0x1f21f9){return function(_0x297521){if(_0x297521){return _0x297521[_0xa57c('0x2a')]()[_0xa57c('0x2b')](function(){_0x116ce2[_0xa57c('0x1f')](0xcc)[_0xa57c('0x20')]();});}};}function handleEntityNotFound(_0x3af169,_0x92feaa){return function(_0x1bdce0){if(!_0x1bdce0){_0x3af169[_0xa57c('0x1e')](0x194);}return _0x1bdce0;};}function handleError(_0x4fbc2c,_0x51a51b){_0x51a51b=_0x51a51b||0x1f4;return function(_0xc1bea6){logger['error'](_0xc1bea6[_0xa57c('0x2c')]);if(_0xc1bea6[_0xa57c('0x2d')]){delete _0xc1bea6[_0xa57c('0x2d')];}_0x4fbc2c[_0xa57c('0x1f')](_0x51a51b)[_0xa57c('0x2e')](_0xc1bea6);};}function getMustacheRender(_0xecc836,_0x24507c){return Mustache[_0xa57c('0x2f')](_0xecc836,_[_0xa57c('0x30')](_0x24507c[_0xa57c('0x31')],{'contact':_0x24507c[_0xa57c('0x32')],'message':_0x24507c[_0xa57c('0x33')],'agent':_0x24507c[_0xa57c('0x34')],'interaction':_0x24507c[_0xa57c('0x35')],'account':_0x24507c[_0xa57c('0x36')]}))||'';}exports[_0xa57c('0x37')]=function(_0x1e3d67,_0x43a7c3,_0x558ab0){if(!_0x1e3d67[_0xa57c('0x31')][_0xa57c('0x38')](_0xa57c('0x39'))&&!_0x1e3d67[_0xa57c('0x31')][_0xa57c('0x38')]('TemplateId')){throw new db[(_0xa57c('0x3a'))]['ValidationError'](_0xa57c('0x3b'));}else{if(_0x1e3d67[_0xa57c('0x31')][_0xa57c('0x38')](_0xa57c('0x3c'))&&!_0x1e3d67[_0xa57c('0x31')][_0xa57c('0x38')](_0xa57c('0x3d'))){throw new db[(_0xa57c('0x3a'))][(_0xa57c('0x3e'))](_0xa57c('0x3f'));}if(!_0x1e3d67[_0xa57c('0x31')]['hasOwnProperty'](_0xa57c('0x40'))){throw new db[(_0xa57c('0x3a'))][(_0xa57c('0x3e'))](_0xa57c('0x41'));}else{try{var _0x2c4889=JSON[_0xa57c('0x42')](_0x1e3d67[_0xa57c('0x31')][_0xa57c('0x40')]);}catch(_0x462a7b){logger[_0xa57c('0x43')](_0x462a7b);throw new db[(_0xa57c('0x3a'))]['ValidationError'](_0xa57c('0x44'));}var _0x5a86f7=[_0xa57c('0x45'),_0xa57c('0x46'),'mailqueue',_0xa57c('0x47'),_0xa57c('0x48'),'voicequeue',_0xa57c('0x49'),_0xa57c('0x4a'),_0xa57c('0x4b')];if(_[_0xa57c('0x4c')](_0x2c4889,function(_0x64b6eb){return!_[_0xa57c('0x4d')](_0x5a86f7,_0x64b6eb['model'][_0xa57c('0x4e')]());})){throw new db[(_0xa57c('0x3a'))]['ValidationError'](_0xa57c('0x4f'));}}}var _0x2f3765={};_0x2f3765[_0xa57c('0x50')]=_0x1e3d67[_0xa57c('0x31')]['hasOwnProperty']('senderName')?_0x1e3d67[_0xa57c('0x31')][_0xa57c('0x50')]:_0x1e3d67['user'][_0xa57c('0x51')];_0x2f3765[_0xa57c('0x52')]=_[_0xa57c('0x53')](_0x1e3d67[_0xa57c('0x31')]['recipientsDescription'])?null:_0x1e3d67[_0xa57c('0x31')][_0xa57c('0x52')];_0x2f3765[_0xa57c('0x54')]=_0x1e3d67[_0xa57c('0x31')][_0xa57c('0x54')]||![];_0x2f3765[_0xa57c('0x55')]=_0x1e3d67['user']['id'];return getContent(_0x1e3d67['body'])['then'](function(_0x297d58){_0x2f3765[_0xa57c('0x31')]=_0x297d58;return getRecipients(_0x2c4889);})[_0xa57c('0x2b')](function(_0x51caa){_0x2f3765[_0xa57c('0x56')]=_[_0xa57c('0x57')](_0x51caa)[_0xa57c('0x58')](',');return db[_0xa57c('0x59')][_0xa57c('0x5a')](function(_0x5d1d98){return db[_0xa57c('0x5b')][_0xa57c('0x5c')](_0x2f3765,{'raw':!![],'transaction':_0x5d1d98})[_0xa57c('0x2b')](function(_0x391db0){var _0x496805={'sender':_0x2f3765[_0xa57c('0x50')],'description':_0x2f3765['recipientsDescription'],'content':_0x2f3765[_0xa57c('0x31')],'beep':_0x2f3765[_0xa57c('0x54')]};_0x51caa[_0xa57c('0x5d')](function(_0x22780e){_0x496805['recipient']=_0x22780e;socket[_0xa57c('0x5e')]('userNotification:send',_0x496805);});return _0x391db0;});});})[_0xa57c('0x2b')](respondWithResult(_0x43a7c3,0xc9))['catch'](handleError(_0x43a7c3,null));};function getContent(_0x3f9c12){return new BPromise(function(_0x452bac,_0x52507c){if(_0x3f9c12[_0xa57c('0x39')]){_0x452bac(_0x3f9c12[_0xa57c('0x39')]);return;}return db[_0xa57c('0x5f')]['findOne']({'attributes':['html'],'where':{'id':_0x3f9c12['TemplateId']},'raw':!![]})[_0xa57c('0x2b')](function(_0x198e00){if(!_0x198e00)throw new db[(_0xa57c('0x3a'))][(_0xa57c('0x3e'))](_0xa57c('0x60'));var _0xb290b6=Mustache[_0xa57c('0x2f')](_0x198e00[_0xa57c('0x61')],_0x3f9c12[_0xa57c('0x3d')]);_0x452bac(_0xb290b6);})['catch'](function(_0x354894){_0x52507c(_0x354894);});});}function getRecipients(_0x2ee103){return new BPromise(function(_0x381e1e,_0x31403f){var _0x331663=[];var _0x409f28=[];_0x2ee103[_0xa57c('0x5d')](function(_0x11d68b){var _0x30f7d6=_[_0xa57c('0x62')](_0x11d68b[_0xa57c('0x63')][_0xa57c('0x4e')]());if(_0x30f7d6===_0xa57c('0x64')){_0x331663=_[_0xa57c('0x65')](_0x331663,_0x11d68b[_0xa57c('0x66')]);}else{if(_[_0xa57c('0x4d')](_0x30f7d6,_0xa57c('0x67')))_0x30f7d6=_0x30f7d6[_0xa57c('0x68')](_0xa57c('0x67'),_0xa57c('0x69'));_0x11d68b['ids']['forEach'](function(_0x41fcc0){_0x409f28[_0xa57c('0x6a')](getAgents(_0x30f7d6,_0x41fcc0));});}});return BPromise['all'](_0x409f28)['then'](function(_0x4023ae){_0x331663=_[_0xa57c('0x65')](_0x331663,_[_0xa57c('0x6b')](_0x4023ae));_0x381e1e(_0x331663);})[_0xa57c('0x6c')](function(_0x3aa3dd){_0x31403f(_0x3aa3dd);});});}function getAgents(_0x52fb88,_0x2da2eb){return new BPromise(function(_0x1e6819,_0x5b32bf){return db[_0x52fb88][_0xa57c('0x6d')]({'where':{'id':_0x2da2eb}})['then'](function(_0x2ff88e){return _0x2ff88e[_0xa57c('0x6e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x634bf5){var _0x30335e=_['map'](_0x634bf5,'id');_0x1e6819(_0x30335e);});})[_0xa57c('0x6c')](function(_0x495cd9){_0x5b32bf(_0x495cd9);});});} \ No newline at end of file +var _0x3996=['User','union','ids','queue','replace','Queue','push','flatten','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','name','render','merge','body','contact','message','agent','account','sendUserNotification','hasOwnProperty','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','some','includes','model','toLowerCase','senderName','user','fullname','isEmpty','recipientsDescription','beep','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','userNotification:send','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','catch','startCase'];(function(_0x1abbd1,_0x26581f){var _0x41a7f2=function(_0x3e8820){while(--_0x3e8820){_0x1abbd1['push'](_0x1abbd1['shift']());}};_0x41a7f2(++_0x26581f);}(_0x3996,0x144));var _0x6399=function(_0x3bd466,_0x4e3d68){_0x3bd466=_0x3bd466-0x0;var _0x3778c0=_0x3996[_0x3bd466];return _0x3778c0;};'use strict';var emlformat=require(_0x6399('0x0'));var rimraf=require(_0x6399('0x1'));var zipdir=require(_0x6399('0x2'));var jsonpatch=require(_0x6399('0x3'));var rp=require(_0x6399('0x4'));var moment=require(_0x6399('0x5'));var BPromise=require(_0x6399('0x6'));var Mustache=require(_0x6399('0x7'));var util=require(_0x6399('0x8'));var path=require(_0x6399('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6399('0xa'));var _=require(_0x6399('0xb'));var squel=require(_0x6399('0xc'));var crypto=require(_0x6399('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6399('0xe'));var toCsv=require(_0x6399('0xf'));var querystring=require(_0x6399('0x10'));var Papa=require('papaparse');var Redis=require(_0x6399('0x11'));var authService=require(_0x6399('0x12'));var qs=require(_0x6399('0x13'));var as=require(_0x6399('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6399('0x15'));var utils=require('../../config/utils');var config=require(_0x6399('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6399('0x17'))['db'];config[_0x6399('0x18')]=_[_0x6399('0x19')](config[_0x6399('0x18')],{'host':_0x6399('0x1a'),'port':0x18eb});var socket=require(_0x6399('0x1b'))(new Redis(config[_0x6399('0x18')]));require('./userNotification.socket')[_0x6399('0x1c')](socket);function respondWithStatusCode(_0x1a6950,_0x653ecd){_0x653ecd=_0x653ecd||0xcc;return function(_0x288d0b){if(_0x288d0b){return _0x1a6950[_0x6399('0x1d')](_0x653ecd);}return _0x1a6950[_0x6399('0x1e')](_0x653ecd)[_0x6399('0x1f')]();};}function respondWithResult(_0x32e57b,_0x4f8db1){_0x4f8db1=_0x4f8db1||0xc8;return function(_0x3c5688){if(_0x3c5688){return _0x32e57b[_0x6399('0x1e')](_0x4f8db1)['json'](_0x3c5688);}};}function respondWithFilteredResult(_0x4b9ea8,_0x2ddd7a){return function(_0x585610){if(_0x585610){var _0x47382f=typeof _0x2ddd7a['offset']===_0x6399('0x20')&&typeof _0x2ddd7a[_0x6399('0x21')]==='undefined';var _0x13a01e=_0x585610[_0x6399('0x22')];var _0x5bdec1=_0x47382f?0x0:_0x2ddd7a[_0x6399('0x23')];var _0x51f1a7=_0x47382f?_0x585610[_0x6399('0x22')]:_0x2ddd7a[_0x6399('0x23')]+_0x2ddd7a[_0x6399('0x21')];var _0x14832b;if(_0x51f1a7>=_0x13a01e){_0x51f1a7=_0x13a01e;_0x14832b=0xc8;}else{_0x14832b=0xce;}_0x4b9ea8['status'](_0x14832b);return _0x4b9ea8[_0x6399('0x24')](_0x6399('0x25'),_0x5bdec1+'-'+_0x51f1a7+'/'+_0x13a01e)[_0x6399('0x26')](_0x585610);}return null;};}function patchUpdates(_0x42dcb9){return function(_0xf2c0c0){try{jsonpatch[_0x6399('0x27')](_0xf2c0c0,_0x42dcb9,!![]);}catch(_0x875370){return BPromise[_0x6399('0x28')](_0x875370);}return _0xf2c0c0[_0x6399('0x29')]();};}function saveUpdates(_0x4c8d42,_0x1abbd8){return function(_0x49d82c){if(_0x49d82c){return _0x49d82c[_0x6399('0x2a')](_0x4c8d42)[_0x6399('0x2b')](function(_0x552efa){return _0x552efa;});}return null;};}function removeEntity(_0x25bf2b,_0x38c7ab){return function(_0x296903){if(_0x296903){return _0x296903['destroy']()[_0x6399('0x2b')](function(){_0x25bf2b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x529ba4,_0xe7910d){return function(_0x1da98f){if(!_0x1da98f){_0x529ba4[_0x6399('0x1d')](0x194);}return _0x1da98f;};}function handleError(_0x33734d,_0x1a1bd8){_0x1a1bd8=_0x1a1bd8||0x1f4;return function(_0x42f6e9){logger['error'](_0x42f6e9['stack']);if(_0x42f6e9[_0x6399('0x2c')]){delete _0x42f6e9[_0x6399('0x2c')];}_0x33734d['status'](_0x1a1bd8)['send'](_0x42f6e9);};}function getMustacheRender(_0x3efff7,_0x196475){return Mustache[_0x6399('0x2d')](_0x3efff7,_[_0x6399('0x2e')](_0x196475[_0x6399('0x2f')],{'contact':_0x196475[_0x6399('0x30')],'message':_0x196475[_0x6399('0x31')],'agent':_0x196475[_0x6399('0x32')],'interaction':_0x196475['interaction'],'account':_0x196475[_0x6399('0x33')]}))||'';}exports[_0x6399('0x34')]=function(_0x25ce35,_0x6d8e85,_0x5f2b7f){if(!_0x25ce35['body'][_0x6399('0x35')]('text')&&!_0x25ce35['body']['hasOwnProperty'](_0x6399('0x36'))){throw new db['Sequelize']['ValidationError'](_0x6399('0x37'));}else{if(_0x25ce35[_0x6399('0x2f')][_0x6399('0x35')]('TemplateId')&&!_0x25ce35[_0x6399('0x2f')]['hasOwnProperty'](_0x6399('0x38'))){throw new db[(_0x6399('0x39'))][(_0x6399('0x3a'))](_0x6399('0x3b'));}if(!_0x25ce35[_0x6399('0x2f')][_0x6399('0x35')](_0x6399('0x3c'))){throw new db['Sequelize']['ValidationError'](_0x6399('0x3d'));}else{try{var _0x523488=JSON[_0x6399('0x3e')](_0x25ce35[_0x6399('0x2f')][_0x6399('0x3c')]);}catch(_0x57dc58){logger[_0x6399('0x3f')](_0x57dc58);throw new db[(_0x6399('0x39'))][(_0x6399('0x3a'))](_0x6399('0x40'));}var _0x4abf46=['chatqueue',_0x6399('0x41'),_0x6399('0x42'),_0x6399('0x43'),_0x6399('0x44'),'voicequeue',_0x6399('0x45'),'team','user'];if(_[_0x6399('0x46')](_0x523488,function(_0x153131){return!_[_0x6399('0x47')](_0x4abf46,_0x153131[_0x6399('0x48')][_0x6399('0x49')]());})){throw new db[(_0x6399('0x39'))][(_0x6399('0x3a'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x122aef={};_0x122aef[_0x6399('0x4a')]=_0x25ce35['body'][_0x6399('0x35')](_0x6399('0x4a'))?_0x25ce35[_0x6399('0x2f')][_0x6399('0x4a')]:_0x25ce35[_0x6399('0x4b')][_0x6399('0x4c')];_0x122aef['recipientsDescription']=_[_0x6399('0x4d')](_0x25ce35['body']['recipientsDescription'])?null:_0x25ce35['body'][_0x6399('0x4e')];_0x122aef[_0x6399('0x4f')]=_0x25ce35['body'][_0x6399('0x4f')]||![];_0x122aef['SenderId']=_0x25ce35[_0x6399('0x4b')]['id'];return getContent(_0x25ce35[_0x6399('0x2f')])[_0x6399('0x2b')](function(_0x56cb83){_0x122aef[_0x6399('0x2f')]=_0x56cb83;return getRecipients(_0x523488);})['then'](function(_0x3342dd){_0x122aef['recipientsId']=_[_0x6399('0x50')](_0x3342dd)[_0x6399('0x51')](',');return db[_0x6399('0x52')][_0x6399('0x53')](function(_0x4b624f){return db['UserNotification'][_0x6399('0x54')](_0x122aef,{'raw':!![],'transaction':_0x4b624f})[_0x6399('0x2b')](function(_0x521343){var _0x3113e8={'sender':_0x122aef['senderName'],'description':_0x122aef[_0x6399('0x4e')],'content':_0x122aef[_0x6399('0x2f')],'beep':_0x122aef['beep']};_0x3342dd[_0x6399('0x55')](function(_0x207783){_0x3113e8[_0x6399('0x56')]=_0x207783;socket[_0x6399('0x57')](_0x6399('0x58'),_0x3113e8);});return _0x521343;});});})['then'](respondWithResult(_0x6d8e85,0xc9))['catch'](handleError(_0x6d8e85,null));};function getContent(_0x177036){return new BPromise(function(_0x539185,_0x4bf457){if(_0x177036['text']){_0x539185(_0x177036[_0x6399('0x59')]);return;}return db[_0x6399('0x5a')][_0x6399('0x5b')]({'attributes':[_0x6399('0x5c')],'where':{'id':_0x177036[_0x6399('0x36')]},'raw':!![]})[_0x6399('0x2b')](function(_0x5c48e2){if(!_0x5c48e2)throw new db[(_0x6399('0x39'))][(_0x6399('0x3a'))](_0x6399('0x5d'));var _0x1d0667=Mustache['render'](_0x5c48e2[_0x6399('0x5c')],_0x177036[_0x6399('0x38')]);_0x539185(_0x1d0667);})[_0x6399('0x5e')](function(_0x51f53e){_0x4bf457(_0x51f53e);});});}function getRecipients(_0x5bddcb){return new BPromise(function(_0x58ffef,_0x5a417e){var _0x4798e5=[];var _0x443d8c=[];_0x5bddcb[_0x6399('0x55')](function(_0x3f884d){var _0x16814d=_[_0x6399('0x5f')](_0x3f884d[_0x6399('0x48')]['toLowerCase']());if(_0x16814d===_0x6399('0x60')){_0x4798e5=_[_0x6399('0x61')](_0x4798e5,_0x3f884d[_0x6399('0x62')]);}else{if(_[_0x6399('0x47')](_0x16814d,_0x6399('0x63')))_0x16814d=_0x16814d[_0x6399('0x64')](_0x6399('0x63'),_0x6399('0x65'));_0x3f884d['ids'][_0x6399('0x55')](function(_0x27a378){_0x443d8c[_0x6399('0x66')](getAgents(_0x16814d,_0x27a378));});}});return BPromise['all'](_0x443d8c)[_0x6399('0x2b')](function(_0x2c4e3f){_0x4798e5=_['union'](_0x4798e5,_[_0x6399('0x67')](_0x2c4e3f));_0x58ffef(_0x4798e5);})[_0x6399('0x5e')](function(_0x5614fe){_0x5a417e(_0x5614fe);});});}function getAgents(_0x28967d,_0xe46cc6){return new BPromise(function(_0x1b09ca,_0x34a87b){return db[_0x28967d]['findOne']({'where':{'id':_0xe46cc6}})[_0x6399('0x2b')](function(_0xff0255){return _0xff0255[_0x6399('0x68')]({'attributes':['id'],'raw':!![]})[_0x6399('0x2b')](function(_0xf05311){var _0x23a24b=_['map'](_0xf05311,'id');_0x1b09ca(_0x23a24b);});})[_0x6399('0x5e')](function(_0x35aded){_0x34a87b(_0x35aded);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 0d3aae6..9a3f0f0 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 _0xf3cd=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update'];(function(_0x4eab11,_0x420bfb){var _0x417a63=function(_0x35f378){while(--_0x35f378){_0x4eab11['push'](_0x4eab11['shift']());}};_0x417a63(++_0x420bfb);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x32b122,_0x1ad490){_0x32b122=_0x32b122-0x0;var _0x4ad25a=_0xf3cd[_0x32b122];return _0x4ad25a;};'use strict';var EventEmitter=require(_0xdf3c('0x0'));var UserNotification=require(_0xdf3c('0x1'))['db'][_0xdf3c('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xdf3c('0x3')](0x0);var events={'afterCreate':_0xdf3c('0x4'),'afterUpdate':_0xdf3c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x401518){return function(_0x71b446,_0x9f71cb,_0x573076){UserNotificationEvents[_0xdf3c('0x6')](_0x401518+':'+_0x71b446['id'],_0x71b446);UserNotificationEvents[_0xdf3c('0x6')](_0x401518,_0x71b446);_0x573076(null);};}for(var e in events){if(events[_0xdf3c('0x7')](e)){var event=events[e];UserNotification[_0xdf3c('0x8')](e,emitEvent(event));}}module[_0xdf3c('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0x24ca=['hasOwnProperty','hook','exports','events','UserNotification','setMaxListeners','save','remove','emit'];(function(_0x57a48f,_0x77ce62){var _0x46490e=function(_0x1c9e61){while(--_0x1c9e61){_0x57a48f['push'](_0x57a48f['shift']());}};_0x46490e(++_0x77ce62);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0x24ca[_0x2df724];return _0x1b2504;};'use strict';var EventEmitter=require(_0xa24c('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xa24c('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xa24c('0x2')](0x0);var events={'afterCreate':_0xa24c('0x3'),'afterUpdate':'update','afterDestroy':_0xa24c('0x4')};function emitEvent(_0x8a54a0){return function(_0x195e60,_0x28aa2f,_0xe76a30){UserNotificationEvents[_0xa24c('0x5')](_0x8a54a0+':'+_0x195e60['id'],_0x195e60);UserNotificationEvents[_0xa24c('0x5')](_0x8a54a0,_0x195e60);_0xe76a30(null);};}for(var e in events){if(events[_0xa24c('0x6')](e)){var event=events[e];UserNotification[_0xa24c('0x7')](e,emitEvent(event));}}module[_0xa24c('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 76533e1..2ac0aba 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 _0x7916=['request-promise','path','rimraf','./userNotification.attributes','UserNotification','utf8mb4','lodash','../../config/logger','api','bluebird'];(function(_0x111ccc,_0x4f5094){var _0x5bd2a5=function(_0x3a31dd){while(--_0x3a31dd){_0x111ccc['push'](_0x111ccc['shift']());}};_0x5bd2a5(++_0x4f5094);}(_0x7916,0x128));var _0x6791=function(_0x76c4f2,_0x7bcba){_0x76c4f2=_0x76c4f2-0x0;var _0x18547=_0x7916[_0x76c4f2];return _0x18547;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var logger=require(_0x6791('0x1'))(_0x6791('0x2'));var moment=require('moment');var BPromise=require(_0x6791('0x3'));var rp=require(_0x6791('0x4'));var fs=require('fs');var path=require(_0x6791('0x5'));var rimraf=require(_0x6791('0x6'));var config=require('../../config/environment');var attributes=require(_0x6791('0x7'));module['exports']=function(_0x3ca328,_0x3277a8){return _0x3ca328['define'](_0x6791('0x8'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6791('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7fee=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','UserNotification','userNotifications'];(function(_0xf7d93d,_0x3cdeee){var _0x18fbaf=function(_0xab7b77){while(--_0xab7b77){_0xf7d93d['push'](_0xf7d93d['shift']());}};_0x18fbaf(++_0x3cdeee);}(_0x7fee,0x1a6));var _0xe7fe=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x7fee[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xe7fe('0x0'));var util=require(_0xe7fe('0x1'));var logger=require(_0xe7fe('0x2'))(_0xe7fe('0x3'));var moment=require(_0xe7fe('0x4'));var BPromise=require(_0xe7fe('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7fe('0x6'));var rimraf=require(_0xe7fe('0x7'));var config=require(_0xe7fe('0x8'));var attributes=require('./userNotification.attributes');module[_0xe7fe('0x9')]=function(_0x5b6d58,_0x183b0b){return _0x5b6d58[_0xe7fe('0xa')](_0xe7fe('0xb'),attributes,{'tableName':_0xe7fe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe7fe('0xd'),'collate':_0xe7fe('0xe')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 17c4616..cb3d8cc 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 _0xdd91=['socket.io-emitter','./userNotification.socket','register','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','code','error','message','UserNotification,\x20%s,\x20%s','result','bluebird','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x5a037a,_0x44a3fc){var _0x28ff57=function(_0x13d49f){while(--_0x13d49f){_0x5a037a['push'](_0x5a037a['shift']());}};_0x28ff57(++_0x44a3fc);}(_0xdd91,0xdd));var _0x1dd9=function(_0x57c229,_0x28c7ce){_0x57c229=_0x57c229-0x0;var _0x454767=_0xdd91[_0x57c229];return _0x454767;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1dd9('0x0'));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(_0x1dd9('0x1'))(_0x1dd9('0x2'));var config=require('../../config/environment');var jayson=require(_0x1dd9('0x3'));var client=jayson[_0x1dd9('0x4')][_0x1dd9('0x5')]({'port':0x232a});config['redis']=_[_0x1dd9('0x6')](config[_0x1dd9('0x7')],{'host':_0x1dd9('0x8'),'port':0x18eb});var socket=require(_0x1dd9('0x9'))(new Redis(config[_0x1dd9('0x7')]));require(_0x1dd9('0xa'))[_0x1dd9('0xb')](socket);function respondWithRpcPromise(_0x1b0108,_0x47dd37,_0x314d10){return new BPromise(function(_0x50d1e1,_0x42a31d){return client['request'](_0x1b0108,_0x314d10)[_0x1dd9('0xc')](function(_0x27c3f1){logger[_0x1dd9('0xd')]('UserNotification,\x20%s,\x20%s',_0x47dd37,_0x1dd9('0xe'));logger[_0x1dd9('0xf')](_0x1dd9('0x10'),_0x47dd37,'request\x20sent',JSON[_0x1dd9('0x11')](_0x27c3f1));if(_0x27c3f1['error']){if(_0x27c3f1['error'][_0x1dd9('0x12')]===0x1f4){logger[_0x1dd9('0x13')]('UserNotification,\x20%s,\x20%s',_0x47dd37,_0x27c3f1[_0x1dd9('0x13')]['message']);return _0x42a31d(_0x27c3f1[_0x1dd9('0x13')][_0x1dd9('0x14')]);}logger[_0x1dd9('0x13')](_0x1dd9('0x15'),_0x47dd37,_0x27c3f1['error']['message']);return _0x50d1e1(_0x27c3f1[_0x1dd9('0x13')][_0x1dd9('0x14')]);}else{logger[_0x1dd9('0xd')](_0x1dd9('0x15'),_0x47dd37,'request\x20sent');_0x50d1e1(_0x27c3f1[_0x1dd9('0x16')][_0x1dd9('0x14')]);}})['catch'](function(_0x8bd650){logger[_0x1dd9('0x13')](_0x1dd9('0x15'),_0x47dd37,_0x8bd650);_0x42a31d(_0x8bd650);});});} \ No newline at end of file +var _0x0e17=['message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','debug','request\x20sent','stringify','error','code','UserNotification,\x20%s,\x20%s'];(function(_0x4b3e49,_0x9e566c){var _0x57e339=function(_0x1430e9){while(--_0x1430e9){_0x4b3e49['push'](_0x4b3e49['shift']());}};_0x57e339(++_0x9e566c);}(_0x0e17,0x111));var _0x70e1=function(_0x57f8dc,_0x2a39ad){_0x57f8dc=_0x57f8dc-0x0;var _0x467d59=_0x0e17[_0x57f8dc];return _0x467d59;};'use strict';var _=require('lodash');var util=require(_0x70e1('0x0'));var moment=require(_0x70e1('0x1'));var BPromise=require(_0x70e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70e1('0x3'));var db=require(_0x70e1('0x4'))['db'];var utils=require(_0x70e1('0x5'));var logger=require(_0x70e1('0x6'))(_0x70e1('0x7'));var config=require(_0x70e1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x70e1('0x9')][_0x70e1('0xa')]({'port':0x232a});config['redis']=_[_0x70e1('0xb')](config[_0x70e1('0xc')],{'host':_0x70e1('0xd'),'port':0x18eb});var socket=require(_0x70e1('0xe'))(new Redis(config['redis']));require('./userNotification.socket')[_0x70e1('0xf')](socket);function respondWithRpcPromise(_0x42d8c2,_0x5e44bd,_0x1ceeaa){return new BPromise(function(_0x598ef8,_0x1eb33a){return client[_0x70e1('0x10')](_0x42d8c2,_0x1ceeaa)['then'](function(_0x33bf6e){logger[_0x70e1('0x11')]('UserNotification,\x20%s,\x20%s',_0x5e44bd,'request\x20sent');logger[_0x70e1('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x5e44bd,_0x70e1('0x13'),JSON[_0x70e1('0x14')](_0x33bf6e));if(_0x33bf6e['error']){if(_0x33bf6e[_0x70e1('0x15')][_0x70e1('0x16')]===0x1f4){logger[_0x70e1('0x15')](_0x70e1('0x17'),_0x5e44bd,_0x33bf6e[_0x70e1('0x15')][_0x70e1('0x18')]);return _0x1eb33a(_0x33bf6e[_0x70e1('0x15')][_0x70e1('0x18')]);}logger[_0x70e1('0x15')](_0x70e1('0x17'),_0x5e44bd,_0x33bf6e['error']['message']);return _0x598ef8(_0x33bf6e[_0x70e1('0x15')][_0x70e1('0x18')]);}else{logger[_0x70e1('0x11')](_0x70e1('0x17'),_0x5e44bd,_0x70e1('0x13'));_0x598ef8(_0x33bf6e[_0x70e1('0x19')][_0x70e1('0x18')]);}})[_0x70e1('0x1a')](function(_0xb3cbbe){logger[_0x70e1('0x15')](_0x70e1('0x17'),_0x5e44bd,_0xb3cbbe);_0x1eb33a(_0xb3cbbe);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index bd135a5..3b67345 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 _0x5fab=['emit','removeListener','register','length','./userNotification.events','save','update'];(function(_0x3e4d85,_0x216dde){var _0x2e8e37=function(_0x15dc30){while(--_0x15dc30){_0x3e4d85['push'](_0x3e4d85['shift']());}};_0x2e8e37(++_0x216dde);}(_0x5fab,0x177));var _0xb5fa=function(_0x4fb955,_0x481977){_0x4fb955=_0x4fb955-0x0;var _0x4f9797=_0x5fab[_0x4fb955];return _0x4f9797;};'use strict';var UserNotificationEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){UserNotificationEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('userNotification:'+_0x1aec3e,_0x44df89);UserNotificationEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file +var _0x5031=['./userNotification.events','save','remove','update','emit','removeListener','register','length','userNotification:'];(function(_0x4f5965,_0x6f48ba){var _0x843d4f=function(_0x2f650b){while(--_0x2f650b){_0x4f5965['push'](_0x4f5965['shift']());}};_0x843d4f(++_0x6f48ba);}(_0x5031,0x144));var _0x1503=function(_0x87c2fc,_0x4fe84a){_0x87c2fc=_0x87c2fc-0x0;var _0x36b6e2=_0x5031[_0x87c2fc];return _0x36b6e2;};'use strict';var UserNotificationEvents=require(_0x1503('0x0'));var events=[_0x1503('0x1'),_0x1503('0x2'),_0x1503('0x3')];function createListener(_0x12aead,_0x5d2d67){return function(_0x58700c){_0x5d2d67[_0x1503('0x4')](_0x12aead,_0x58700c);};}function removeListener(_0x29353e,_0x175a7e){return function(){UserNotificationEvents[_0x1503('0x5')](_0x29353e,_0x175a7e);};}exports[_0x1503('0x6')]=function(_0x3b44d1){for(var _0xaeae3=0x0,_0x114bec=events[_0x1503('0x7')];_0xaeae3<_0x114bec;_0xaeae3++){var _0x4c93e7=events[_0xaeae3];var _0x2007d0=createListener(_0x1503('0x8')+_0x4c93e7,_0x3b44d1);UserNotificationEvents['on'](_0x4c93e7,_0x2007d0);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 81f6ed7..6db1798 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 _0x2e16=['exports','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0x2e16,0x8d));var _0x62e1=function(_0x2e514c,_0x21b1ac){_0x2e514c=_0x2e514c-0x0;var _0x3c1371=_0x2e16[_0x2e514c];return _0x3c1371;};'use strict';var multer=require(_0x62e1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x62e1('0x1'));var router=express[_0x62e1('0x2')]();var fs_extra=require(_0x62e1('0x3'));var auth=require(_0x62e1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x62e1('0x5'));module[_0x62e1('0x6')]=router; \ No newline at end of file +var _0xfef3=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x137bf4,_0x320371){var _0x401654=function(_0x49084d){while(--_0x49084d){_0x137bf4['push'](_0x137bf4['shift']());}};_0x401654(++_0x320371);}(_0xfef3,0x118));var _0x3fef=function(_0x7430b6,_0x4fe9f4){_0x7430b6=_0x7430b6-0x0;var _0x3cd462=_0xfef3[_0x7430b6];return _0x3cd462;};'use strict';var multer=require(_0x3fef('0x0'));var util=require('util');var path=require(_0x3fef('0x1'));var timeout=require('connect-timeout');var express=require(_0x3fef('0x2'));var router=express[_0x3fef('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3fef('0x4'));var interaction=require(_0x3fef('0x5'));var config=require('../../config/environment');module[_0x3fef('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index cd8f25e..bfc5d5e 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 _0xbaf0=['exports','INTEGER'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x409315,_0x123e35){var _0x283290=function(_0x1277eb){while(--_0x1277eb){_0x409315['push'](_0x409315['shift']());}};_0x283290(++_0x123e35);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 57aad43..357d897 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 _0x3318=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x565316,_0x272e95){var _0x4ca46d=function(_0xb9bec4){while(--_0xb9bec4){_0x565316['push'](_0x565316['shift']());}};_0x4ca46d(++_0x272e95);}(_0x3318,0x124));var _0x8331=function(_0x56846d,_0x33e88f){_0x56846d=_0x56846d-0x0;var _0x3d680e=_0x3318[_0x56846d];return _0x3d680e;};'use strict';var _=require(_0x8331('0x0'));var util=require(_0x8331('0x1'));var logger=require('../../config/logger')(_0x8331('0x2'));var moment=require(_0x8331('0x3'));var BPromise=require(_0x8331('0x4'));var rp=require(_0x8331('0x5'));var fs=require('fs');var path=require(_0x8331('0x6'));var rimraf=require(_0x8331('0x7'));var config=require(_0x8331('0x8'));var attributes=require(_0x8331('0x9'));module[_0x8331('0xa')]=function(_0x32ffe8,_0x11702c){return _0x32ffe8['define'](_0x8331('0xb'),attributes,{'tableName':_0x8331('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa68a=['api','moment','bluebird','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash'];(function(_0x5382f0,_0x585ba7){var _0x2437b3=function(_0x21d3dc){while(--_0x21d3dc){_0x5382f0['push'](_0x5382f0['shift']());}};_0x2437b3(++_0x585ba7);}(_0xa68a,0x9f));var _0xaa68=function(_0x57b743,_0x1576ea){_0x57b743=_0x57b743-0x0;var _0xf6c89b=_0xa68a[_0x57b743];return _0xf6c89b;};'use strict';var _=require(_0xaa68('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa68('0x1'));var moment=require(_0xaa68('0x2'));var BPromise=require(_0xaa68('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa68('0x4'));var attributes=require(_0xaa68('0x5'));module[_0xaa68('0x6')]=function(_0x2a2dd0,_0x5a3ac6){return _0x2a2dd0[_0xaa68('0x7')](_0xaa68('0x8'),attributes,{'tableName':_0xaa68('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 42a3e78..3d9f322 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 _0xa3fa=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash'];(function(_0x3f4018,_0x1a98f0){var _0x3a7324=function(_0x370d02){while(--_0x370d02){_0x3f4018['push'](_0x3f4018['shift']());}};_0x3a7324(++_0x1a98f0);}(_0xa3fa,0x175));var _0xaa3f=function(_0x738f1c,_0xb9b4ac){_0x738f1c=_0x738f1c-0x0;var _0x369c9b=_0xa3fa[_0x738f1c];return _0x369c9b;};'use strict';var _=require(_0xaa3f('0x0'));var util=require(_0xaa3f('0x1'));var moment=require(_0xaa3f('0x2'));var BPromise=require(_0xaa3f('0x3'));var rs=require(_0xaa3f('0x4'));var fs=require('fs');var Redis=require(_0xaa3f('0x5'));var db=require(_0xaa3f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa3f('0x7'))(_0xaa3f('0x8'));var config=require(_0xaa3f('0x9'));var jayson=require(_0xaa3f('0xa'));var client=jayson['client'][_0xaa3f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10931c,_0x30c0ce,_0x588f9a){return new BPromise(function(_0x140443,_0x90d898){return client[_0xaa3f('0xc')](_0x10931c,_0x588f9a)['then'](function(_0x4c01f9){logger[_0xaa3f('0xd')](_0xaa3f('0xe'),_0x30c0ce,_0xaa3f('0xf'));logger[_0xaa3f('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x30c0ce,_0xaa3f('0xf'),JSON[_0xaa3f('0x11')](_0x4c01f9));if(_0x4c01f9[_0xaa3f('0x12')]){if(_0x4c01f9['error'][_0xaa3f('0x13')]===0x1f4){logger[_0xaa3f('0x12')](_0xaa3f('0xe'),_0x30c0ce,_0x4c01f9[_0xaa3f('0x12')][_0xaa3f('0x14')]);return _0x90d898(_0x4c01f9[_0xaa3f('0x12')][_0xaa3f('0x14')]);}logger['error'](_0xaa3f('0xe'),_0x30c0ce,_0x4c01f9[_0xaa3f('0x12')][_0xaa3f('0x14')]);return _0x140443(_0x4c01f9[_0xaa3f('0x12')][_0xaa3f('0x14')]);}else{logger[_0xaa3f('0xd')](_0xaa3f('0xe'),_0x30c0ce,_0xaa3f('0xf'));_0x140443(_0x4c01f9[_0xaa3f('0x15')][_0xaa3f('0x14')]);}})['catch'](function(_0x5c62cf){logger[_0xaa3f('0x12')](_0xaa3f('0xe'),_0x30c0ce,_0x5c62cf);_0x90d898(_0x5c62cf);});});} \ No newline at end of file +var _0x6b7f=['request','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3a8b9b,_0x4b1728){var _0x1a3bba=function(_0x37a74e){while(--_0x37a74e){_0x3a8b9b['push'](_0x3a8b9b['shift']());}};_0x1a3bba(++_0x4b1728);}(_0x6b7f,0x119));var _0xf6b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b7f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6b7('0x0'));var util=require(_0xf6b7('0x1'));var moment=require(_0xf6b7('0x2'));var BPromise=require(_0xf6b7('0x3'));var rs=require(_0xf6b7('0x4'));var fs=require('fs');var Redis=require(_0xf6b7('0x5'));var db=require(_0xf6b7('0x6'))['db'];var utils=require(_0xf6b7('0x7'));var logger=require(_0xf6b7('0x8'))(_0xf6b7('0x9'));var config=require('../../config/environment');var jayson=require(_0xf6b7('0xa'));var client=jayson[_0xf6b7('0xb')][_0xf6b7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e2d9f,_0x68adda,_0x43cbe4){return new BPromise(function(_0x880f35,_0x4acbb0){return client[_0xf6b7('0xd')](_0x4e2d9f,_0x43cbe4)['then'](function(_0x498add){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x68adda,_0xf6b7('0xe'));logger[_0xf6b7('0xf')](_0xf6b7('0x10'),_0x68adda,_0xf6b7('0xe'),JSON['stringify'](_0x498add));if(_0x498add[_0xf6b7('0x11')]){if(_0x498add[_0xf6b7('0x11')][_0xf6b7('0x12')]===0x1f4){logger[_0xf6b7('0x11')](_0xf6b7('0x13'),_0x68adda,_0x498add[_0xf6b7('0x11')][_0xf6b7('0x14')]);return _0x4acbb0(_0x498add[_0xf6b7('0x11')]['message']);}logger[_0xf6b7('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x68adda,_0x498add[_0xf6b7('0x11')][_0xf6b7('0x14')]);return _0x880f35(_0x498add[_0xf6b7('0x11')][_0xf6b7('0x14')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x68adda,_0xf6b7('0xe'));_0x880f35(_0x498add['result']['message']);}})['catch'](function(_0x1f8a01){logger[_0xf6b7('0x11')](_0xf6b7('0x13'),_0x68adda,_0x1f8a01);_0x4acbb0(_0x1f8a01);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index d36346c..b5e9813 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 _0x5294=['/:id/sections','/:id/resources','getResources','post','/:id/clone','addSections','addResources','put','/:id','update','delete','removeSections','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x140ad7,_0x2fd768){var _0x2dfc64=function(_0x1daaff){while(--_0x1daaff){_0x140ad7['push'](_0x140ad7['shift']());}};_0x2dfc64(++_0x2fd768);}(_0x5294,0x111));var _0x4529=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x5294[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x4529('0x0'));var util=require(_0x4529('0x1'));var path=require(_0x4529('0x2'));var timeout=require(_0x4529('0x3'));var express=require(_0x4529('0x4'));var router=express[_0x4529('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4529('0x6'));var interaction=require(_0x4529('0x7'));var config=require(_0x4529('0x8'));var controller=require('./userProfile.controller');router[_0x4529('0x9')]('/',auth[_0x4529('0xa')](),controller[_0x4529('0xb')]);router[_0x4529('0x9')]('/describe',auth[_0x4529('0xa')](),controller[_0x4529('0xc')]);router[_0x4529('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4529('0x9')](_0x4529('0xd'),auth[_0x4529('0xa')](),controller['getSections']);router[_0x4529('0x9')](_0x4529('0xe'),auth[_0x4529('0xa')](),controller[_0x4529('0xf')]);router[_0x4529('0x10')]('/',auth[_0x4529('0xa')](),controller['create']);router['post'](_0x4529('0x11'),auth[_0x4529('0xa')](),controller['clone']);router[_0x4529('0x10')]('/:id/sections',auth[_0x4529('0xa')](),controller[_0x4529('0x12')]);router[_0x4529('0x10')](_0x4529('0xe'),auth['isAuthenticated'](),controller[_0x4529('0x13')]);router[_0x4529('0x14')](_0x4529('0x15'),auth['isAuthenticated'](),controller[_0x4529('0x16')]);router[_0x4529('0x17')](_0x4529('0x15'),auth[_0x4529('0xa')](),controller['destroy']);router[_0x4529('0x17')](_0x4529('0xd'),auth['isAuthenticated'](),controller[_0x4529('0x18')]);router[_0x4529('0x17')](_0x4529('0xe'),auth['isAuthenticated'](),controller['removeResources']);module[_0x4529('0x19')]=router; \ No newline at end of file +var _0xc090=['fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','describe','show','/:id/sections','getSections','/:id/resources','create','post','addSections','addResources','put','/:id','update','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x56b3cb,_0x3fe0a7){var _0x29a7de=function(_0xe862b5){while(--_0xe862b5){_0x56b3cb['push'](_0x56b3cb['shift']());}};_0x29a7de(++_0x3fe0a7);}(_0xc090,0x112));var _0x0c09=function(_0x5d9a40,_0x18a0e7){_0x5d9a40=_0x5d9a40-0x0;var _0x376f63=_0xc090[_0x5d9a40];return _0x376f63;};'use strict';var multer=require(_0x0c09('0x0'));var util=require(_0x0c09('0x1'));var path=require(_0x0c09('0x2'));var timeout=require(_0x0c09('0x3'));var express=require(_0x0c09('0x4'));var router=express[_0x0c09('0x5')]();var fs_extra=require(_0x0c09('0x6'));var auth=require(_0x0c09('0x7'));var interaction=require(_0x0c09('0x8'));var config=require('../../config/environment');var controller=require(_0x0c09('0x9'));router[_0x0c09('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0c09('0xa')]('/describe',auth[_0x0c09('0xb')](),controller[_0x0c09('0xc')]);router[_0x0c09('0xa')]('/:id',auth[_0x0c09('0xb')](),controller[_0x0c09('0xd')]);router['get'](_0x0c09('0xe'),auth['isAuthenticated'](),controller[_0x0c09('0xf')]);router[_0x0c09('0xa')](_0x0c09('0x10'),auth[_0x0c09('0xb')](),controller['getResources']);router['post']('/',auth['isAuthenticated'](),controller[_0x0c09('0x11')]);router['post']('/:id/clone',auth[_0x0c09('0xb')](),controller['clone']);router[_0x0c09('0x12')](_0x0c09('0xe'),auth[_0x0c09('0xb')](),controller[_0x0c09('0x13')]);router[_0x0c09('0x12')](_0x0c09('0x10'),auth[_0x0c09('0xb')](),controller[_0x0c09('0x14')]);router[_0x0c09('0x15')](_0x0c09('0x16'),auth['isAuthenticated'](),controller[_0x0c09('0x17')]);router[_0x0c09('0x18')](_0x0c09('0x16'),auth[_0x0c09('0xb')](),controller[_0x0c09('0x19')]);router[_0x0c09('0x18')](_0x0c09('0xe'),auth[_0x0c09('0xb')](),controller[_0x0c09('0x1a')]);router[_0x0c09('0x18')](_0x0c09('0x10'),auth[_0x0c09('0xb')](),controller['removeResources']);module[_0x0c09('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 24255fd..71cd179 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 _0xcb91=['crudPermissions','join','getDataValue','split','BOOLEAN','STRING','name'];(function(_0x47e0bc,_0x4dd6d0){var _0x25a6e3=function(_0x433e30){while(--_0x433e30){_0x47e0bc['push'](_0x47e0bc['shift']());}};_0x25a6e3(++_0x4dd6d0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x80f51a,_0x32e95e){_0x80f51a=_0x80f51a-0x0;var _0x327148=_0xcb91[_0x80f51a];return _0x327148;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![],'unique':_0x1cb9('0x1')},'crudPermissions':{'type':Sequelize[_0x1cb9('0x0')],'set':function(_0x22c4b8){this['setDataValue'](_0x1cb9('0x2'),_0x22c4b8?_0x22c4b8[_0x1cb9('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0x1cb9('0x2'))?this[_0x1cb9('0x4')]('crudPermissions')[_0x1cb9('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x1cb9('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x1cb9('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x1cb9('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cb9('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x261b=['STRING','BOOLEAN','sequelize','exports','setDataValue','join','crudPermissions','split'];(function(_0x47df1d,_0x53ab52){var _0x140f36=function(_0x51411f){while(--_0x51411f){_0x47df1d['push'](_0x47df1d['shift']());}};_0x140f36(++_0x53ab52);}(_0x261b,0x15a));var _0xb261=function(_0x1f7986,_0x598e97){_0x1f7986=_0x1f7986-0x0;var _0x2f3475=_0x261b[_0x1f7986];return _0x2f3475;};'use strict';var Sequelize=require(_0xb261('0x0'));module[_0xb261('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x48c7f0){this[_0xb261('0x2')]('crudPermissions',_0x48c7f0?_0x48c7f0[_0xb261('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0xb261('0x4'))?this['getDataValue'](_0xb261('0x4'))[_0xb261('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb261('0x6')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb261('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb261('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xb261('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb261('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb261('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb261('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 79f0524..fa51c6a 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 _0x1ca2=['ZohoAccount','cannedanswers','CannedAnswer','dispositions','customdashboards','Interval','pauses','Pause','scheduler','Schedule','Sound','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','extractedreports','Reports','metrics','AnalyticMetric','whatsappaccounts','WhatsappAccount','ScreenRecording','UserId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','render','merge','contact','interaction','account','index','map','UserProfile','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','filter','where','type','VIRTUAL','options','includeAll','rows','catch','show','rawAttributes','include','find','create','fields','length','get','omit','createdAt','crudPermissions','body','updatedAt','sequelize','transaction','UserProfileSection','findAll','each','UserProfileResource','userProfileId','Resources','update','params','describe','addSections','sectionId','removeSections','ids','enabled','isEmpty','subsections','includes','push','autoAssociation','findOne','forEach','Plugin','addResources','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','parentSections','all','ignore','union','pick','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','DefaultReports','reportId','Tags','color','tag','Tag','ThroughTags','Agents','openTabs','true','dataValues','sms','fax','mail','openchannel','whatsapp','charAt','toUpperCase','slice','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','toString','value','resourceId','squareprojects','odbc','SquareOdbc','squarerecordings','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','VoiceContext','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','telephone','queue','VoiceQueue','QueueCampaigns','musiconholds','VoiceMusicOnHold','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','voicequeues','queuecampaigns','VoiceQueues','users','telephones','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','zohoaccounts'];(function(_0x54026f,_0x59b72c){var _0x27b936=function(_0x85ba1f){while(--_0x85ba1f){_0x54026f['push'](_0x54026f['shift']());}};_0x27b936(++_0x59b72c);}(_0x1ca2,0x11d));var _0x21ca=function(_0x457d51,_0x259c93){_0x457d51=_0x457d51-0x0;var _0x266b92=_0x1ca2[_0x457d51];return _0x266b92;};'use strict';var emlformat=require(_0x21ca('0x0'));var rimraf=require(_0x21ca('0x1'));var zipdir=require(_0x21ca('0x2'));var jsonpatch=require(_0x21ca('0x3'));var rp=require(_0x21ca('0x4'));var moment=require(_0x21ca('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x21ca('0x6'));var util=require(_0x21ca('0x7'));var path=require(_0x21ca('0x8'));var sox=require('sox');var csv=require(_0x21ca('0x9'));var ejs=require(_0x21ca('0xa'));var fs=require('fs');var fs_extra=require(_0x21ca('0xb'));var _=require(_0x21ca('0xc'));var squel=require('squel');var crypto=require(_0x21ca('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x21ca('0xe'));var toCsv=require(_0x21ca('0x9'));var querystring=require(_0x21ca('0xf'));var Papa=require(_0x21ca('0x10'));var Redis=require(_0x21ca('0x11'));var authService=require(_0x21ca('0x12'));var qs=require(_0x21ca('0x13'));var as=require(_0x21ca('0x14'));var hardwareService=require(_0x21ca('0x15'));var logger=require(_0x21ca('0x16'))(_0x21ca('0x17'));var utils=require('../../config/utils');var config=require(_0x21ca('0x18'));var licenseUtil=require(_0x21ca('0x19'));var db=require(_0x21ca('0x1a'))['db'];config[_0x21ca('0x1b')]=_[_0x21ca('0x1c')](config[_0x21ca('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x21ca('0x1d'))(new Redis(config[_0x21ca('0x1b')]));require(_0x21ca('0x1e'))['register'](socket);function respondWithStatusCode(_0x3a2d94,_0x160898){_0x160898=_0x160898||0xcc;return function(_0x6c8c00){if(_0x6c8c00){return _0x3a2d94[_0x21ca('0x1f')](_0x160898);}return _0x3a2d94[_0x21ca('0x20')](_0x160898)[_0x21ca('0x21')]();};}function respondWithResult(_0x5a2483,_0x3641f8){_0x3641f8=_0x3641f8||0xc8;return function(_0x590837){if(_0x590837){return _0x5a2483[_0x21ca('0x20')](_0x3641f8)[_0x21ca('0x22')](_0x590837);}};}function respondWithFilteredResult(_0x4a8d38,_0x1932a0){return function(_0x5e55a7){if(_0x5e55a7){var _0x66fade=typeof _0x1932a0[_0x21ca('0x23')]===_0x21ca('0x24')&&typeof _0x1932a0[_0x21ca('0x25')]===_0x21ca('0x24');var _0xbfa6b2=_0x5e55a7['count'];var _0x5a31c0=_0x66fade?0x0:_0x1932a0[_0x21ca('0x23')];var _0x336b69=_0x66fade?_0x5e55a7[_0x21ca('0x26')]:_0x1932a0[_0x21ca('0x23')]+_0x1932a0[_0x21ca('0x25')];var _0x3489e8;if(_0x336b69>=_0xbfa6b2){_0x336b69=_0xbfa6b2;_0x3489e8=0xc8;}else{_0x3489e8=0xce;}_0x4a8d38[_0x21ca('0x20')](_0x3489e8);return _0x4a8d38[_0x21ca('0x27')](_0x21ca('0x28'),_0x5a31c0+'-'+_0x336b69+'/'+_0xbfa6b2)[_0x21ca('0x22')](_0x5e55a7);}return null;};}function patchUpdates(_0x305853){return function(_0x8cc7a1){try{jsonpatch[_0x21ca('0x29')](_0x8cc7a1,_0x305853,!![]);}catch(_0x38bdf9){return BPromise[_0x21ca('0x2a')](_0x38bdf9);}return _0x8cc7a1['save']();};}function saveUpdates(_0xb09e6f,_0x59c48e){return function(_0x2cfdb1){if(_0x2cfdb1){return _0x2cfdb1['update'](_0xb09e6f)[_0x21ca('0x2b')](function(_0x207608){return _0x207608;});}return null;};}function removeEntity(_0x4f9e86,_0x340d8d){return function(_0x567f61){if(_0x567f61){return _0x567f61[_0x21ca('0x2c')]()[_0x21ca('0x2b')](function(){_0x4f9e86[_0x21ca('0x20')](0xcc)[_0x21ca('0x21')]();});}};}function handleEntityNotFound(_0x1922ea,_0x5792fc){return function(_0x10c13c){if(!_0x10c13c){_0x1922ea[_0x21ca('0x1f')](0x194);}return _0x10c13c;};}function handleError(_0xcc22d2,_0x3f66c7){_0x3f66c7=_0x3f66c7||0x1f4;return function(_0x25cb97){logger[_0x21ca('0x2d')](_0x25cb97[_0x21ca('0x2e')]);if(_0x25cb97[_0x21ca('0x2f')]){delete _0x25cb97[_0x21ca('0x2f')];}_0xcc22d2[_0x21ca('0x20')](_0x3f66c7)[_0x21ca('0x30')](_0x25cb97);};}function getMustacheRender(_0x20135f,_0x7c8a29){return Mustache[_0x21ca('0x31')](_0x20135f,_[_0x21ca('0x32')](_0x7c8a29['body'],{'contact':_0x7c8a29[_0x21ca('0x33')],'message':_0x7c8a29['message'],'agent':_0x7c8a29['agent'],'interaction':_0x7c8a29[_0x21ca('0x34')],'account':_0x7c8a29[_0x21ca('0x35')]}))||'';}exports[_0x21ca('0x36')]=function(_0x4f7fff,_0x219e09){var _0xc2eaea={},_0x105d5e={},_0x2900b7={'count':0x0,'rows':[]};var _0x5308f3=_[_0x21ca('0x37')](db[_0x21ca('0x38')]['rawAttributes'],function(_0x4d3df1){return{'name':_0x4d3df1[_0x21ca('0x39')],'type':_0x4d3df1['type'][_0x21ca('0x3a')]};});_0x105d5e[_0x21ca('0x3b')]=_[_0x21ca('0x37')](_0x5308f3,_0x21ca('0x2f'));_0x105d5e[_0x21ca('0x3c')]=_[_0x21ca('0x3d')](_0x4f7fff['query']);_0x105d5e[_0x21ca('0x3e')]=_[_0x21ca('0x3f')](_0x105d5e[_0x21ca('0x3b')],_0x105d5e[_0x21ca('0x3c')]);_0xc2eaea[_0x21ca('0x40')]=_[_0x21ca('0x3f')](_0x105d5e['model'],qs['fields'](_0x4f7fff[_0x21ca('0x3c')]['fields']));_0xc2eaea['attributes']=_0xc2eaea[_0x21ca('0x40')]['length']?_0xc2eaea[_0x21ca('0x40')]:_0x105d5e[_0x21ca('0x3b')];if(!_0x4f7fff[_0x21ca('0x3c')][_0x21ca('0x41')]('nolimit')){_0xc2eaea[_0x21ca('0x25')]=qs['limit'](_0x4f7fff[_0x21ca('0x3c')][_0x21ca('0x25')]);_0xc2eaea['offset']=qs[_0x21ca('0x23')](_0x4f7fff[_0x21ca('0x3c')][_0x21ca('0x23')]);}_0xc2eaea[_0x21ca('0x42')]=qs[_0x21ca('0x43')](_0x4f7fff[_0x21ca('0x3c')][_0x21ca('0x43')]);_0xc2eaea['where']=qs[_0x21ca('0x3e')](_['pick'](_0x4f7fff[_0x21ca('0x3c')],_0x105d5e[_0x21ca('0x3e')]),_0x5308f3);if(_0x4f7fff[_0x21ca('0x3c')][_0x21ca('0x44')]){_0xc2eaea[_0x21ca('0x45')]=_[_0x21ca('0x32')](_0xc2eaea['where'],{'$or':_[_0x21ca('0x37')](_0x5308f3,function(_0x16b917){if(_0x16b917[_0x21ca('0x46')]!==_0x21ca('0x47')){var _0x595ddd={};_0x595ddd[_0x16b917[_0x21ca('0x2f')]]={'$like':'%'+_0x4f7fff['query']['filter']+'%'};return _0x595ddd;}})});}_0xc2eaea=_[_0x21ca('0x32')]({},_0xc2eaea,_0x4f7fff[_0x21ca('0x48')]);var _0x311638={'where':_0xc2eaea[_0x21ca('0x45')]};return db['UserProfile'][_0x21ca('0x26')](_0x311638)[_0x21ca('0x2b')](function(_0x35a235){_0x2900b7[_0x21ca('0x26')]=_0x35a235;if(_0x4f7fff[_0x21ca('0x3c')][_0x21ca('0x49')]){_0xc2eaea['include']=[{'all':!![]}];}return db['UserProfile']['findAll'](_0xc2eaea);})['then'](function(_0x5b4693){_0x2900b7[_0x21ca('0x4a')]=_0x5b4693;return _0x2900b7;})[_0x21ca('0x2b')](respondWithFilteredResult(_0x219e09,_0xc2eaea))[_0x21ca('0x4b')](handleError(_0x219e09,null));};exports[_0x21ca('0x4c')]=function(_0x426329,_0x275372){var _0x155597={'raw':![],'where':{'id':_0x426329['params']['id']}},_0xcf7b18={};_0xcf7b18[_0x21ca('0x3b')]=_[_0x21ca('0x3d')](db[_0x21ca('0x38')][_0x21ca('0x4d')]);_0xcf7b18['query']=_[_0x21ca('0x3d')](_0x426329[_0x21ca('0x3c')]);_0xcf7b18['filters']=_[_0x21ca('0x3f')](_0xcf7b18[_0x21ca('0x3b')],_0xcf7b18[_0x21ca('0x3c')]);_0x155597[_0x21ca('0x40')]=_['intersection'](_0xcf7b18[_0x21ca('0x3b')],qs['fields'](_0x426329[_0x21ca('0x3c')]['fields']));_0x155597[_0x21ca('0x40')]=_0x155597[_0x21ca('0x40')]['length']?_0x155597[_0x21ca('0x40')]:_0xcf7b18['model'];if(_0x426329['query'][_0x21ca('0x49')]){_0x155597[_0x21ca('0x4e')]=[{'all':!![]}];}_0x155597=_[_0x21ca('0x32')]({},_0x155597,_0x426329[_0x21ca('0x48')]);return db[_0x21ca('0x38')][_0x21ca('0x4f')](_0x155597)[_0x21ca('0x2b')](handleEntityNotFound(_0x275372,null))[_0x21ca('0x2b')](respondWithResult(_0x275372,null))['catch'](handleError(_0x275372,null));};exports[_0x21ca('0x50')]=function(_0x5e1b4e,_0x812d4c){return db['UserProfile']['create'](_0x5e1b4e['body'],{})[_0x21ca('0x2b')](respondWithResult(_0x812d4c,0xc9))[_0x21ca('0x4b')](handleError(_0x812d4c,null));};exports['clone']=function(_0x3e7c40,_0x3b8e44){var _0x2e66a5={'where':{'id':_0x3e7c40['params']['id']}},_0x36f3c3={};_0x36f3c3[_0x21ca('0x3b')]=_['keys'](db['UserProfile']['rawAttributes']);_0x2e66a5[_0x21ca('0x40')]=_['intersection'](_0x36f3c3[_0x21ca('0x3b')],qs[_0x21ca('0x51')](_0x3e7c40['query'][_0x21ca('0x51')]));_0x2e66a5[_0x21ca('0x40')]=_0x2e66a5[_0x21ca('0x40')][_0x21ca('0x52')]?_0x2e66a5[_0x21ca('0x40')]:_0x36f3c3[_0x21ca('0x3b')];if(_0x3e7c40[_0x21ca('0x3c')][_0x21ca('0x49')]){_0x2e66a5[_0x21ca('0x4e')]=[{'all':!![]}];}_0x2e66a5=_[_0x21ca('0x32')]({},_0x2e66a5,_0x3e7c40[_0x21ca('0x48')]);return db[_0x21ca('0x38')]['find'](_0x2e66a5)[_0x21ca('0x2b')](handleEntityNotFound(_0x3b8e44,null))[_0x21ca('0x2b')](function(_0x138c6a){if(_0x138c6a){var _0x158182=_0x138c6a[_0x21ca('0x53')]({'plain':!![]});_0x158182=qs[_0x21ca('0x54')](_0x158182,['id',_0x21ca('0x55'),'updatedAt',_0x21ca('0x56')]);_0x3e7c40[_0x21ca('0x57')]=_[_0x21ca('0x54')](_0x3e7c40[_0x21ca('0x57')],['id','createdAt',_0x21ca('0x58')]);return db[_0x21ca('0x59')][_0x21ca('0x5a')](function(_0x19b1a2){return db['UserProfile'][_0x21ca('0x50')](_[_0x21ca('0x32')](_0x158182,_0x3e7c40['body']),{'include':_0x3e7c40['query'][_0x21ca('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x19b1a2})[_0x21ca('0x2b')](function(_0x56337c){var _0x1c9ff2=_0x56337c['get']({'plain':!![]});return db[_0x21ca('0x5b')][_0x21ca('0x5c')]({'where':{'userProfileId':_0x3e7c40['params']['id']},'raw':!![]})[_0x21ca('0x2b')](function(_0x33678b){if(_0x33678b){return BPromise[_0x21ca('0x5d')](_0x33678b,function(_0x506d35){return new BPromise(function(_0x44b575,_0x4c1358){if(_0x506d35['autoAssociation']===null||_0x506d35['autoAssociation']===0x1)_0x44b575(null);return db[_0x21ca('0x5e')][_0x21ca('0x5c')]({'where':{'sectionId':_0x506d35['id']},'raw':!![]})[_0x21ca('0x2b')](function(_0x3d6786){var _0x11d21=_[_0x21ca('0x37')](_0x3d6786,function(_0x4adac5){return qs['omit'](_0x4adac5,['id',_0x21ca('0x55'),_0x21ca('0x58'),'sectionId']);});_0x44b575(_0x11d21);})[_0x21ca('0x4b')](function(_0x50eb8a){_0x4c1358(_0x50eb8a);});})['then'](function(_0x3bc6f1){var _0x86c57d=qs[_0x21ca('0x54')](_0x506d35,['id',_0x21ca('0x55'),_0x21ca('0x58')]);_0x86c57d[_0x21ca('0x5f')]=_0x1c9ff2['id'];if(_0x3bc6f1)_0x86c57d[_0x21ca('0x60')]=_0x3bc6f1;return _0x86c57d;})[_0x21ca('0x2b')](function(_0x57898d){return db[_0x21ca('0x5b')]['create'](_0x57898d,{'include':[{'model':db[_0x21ca('0x5e')],'as':_0x21ca('0x60')}],'raw':!![],'transaction':_0x19b1a2});});})[_0x21ca('0x2b')](function(){return _0x1c9ff2;});}});});});}})[_0x21ca('0x2b')](respondWithResult(_0x3b8e44,0xc9))[_0x21ca('0x4b')](handleError(_0x3b8e44,null));};exports[_0x21ca('0x61')]=function(_0x3eed52,_0x572451){if(_0x3eed52[_0x21ca('0x57')]['id']){delete _0x3eed52[_0x21ca('0x57')]['id'];}return db[_0x21ca('0x38')]['find']({'where':{'id':_0x3eed52[_0x21ca('0x62')]['id']}})[_0x21ca('0x2b')](handleEntityNotFound(_0x572451,null))[_0x21ca('0x2b')](saveUpdates(_0x3eed52[_0x21ca('0x57')],null))['then'](respondWithResult(_0x572451,null))[_0x21ca('0x4b')](handleError(_0x572451,null));};exports['destroy']=function(_0x3c2f7f,_0x583198){return db[_0x21ca('0x38')]['find']({'where':{'id':_0x3c2f7f[_0x21ca('0x62')]['id']}})[_0x21ca('0x2b')](handleEntityNotFound(_0x583198,null))[_0x21ca('0x2b')](removeEntity(_0x583198,null))[_0x21ca('0x4b')](handleError(_0x583198,null));};exports['describe']=function(_0x1b797d,_0x56c973){return db[_0x21ca('0x38')][_0x21ca('0x63')]()['then'](respondWithResult(_0x56c973,null))['catch'](handleError(_0x56c973,null));};exports[_0x21ca('0x64')]=function(_0x44d094,_0x4382ef){var _0x45b85f=_0x44d094[_0x21ca('0x57')];return db['UserProfile'][_0x21ca('0x4f')]({'where':{'id':_0x44d094[_0x21ca('0x62')]['id']}})[_0x21ca('0x2b')](handleEntityNotFound(_0x4382ef,null))[_0x21ca('0x2b')](function(_0x34794e){if(_0x34794e){return db[_0x21ca('0x59')][_0x21ca('0x5a')](function(_0x813961){return db[_0x21ca('0x5b')][_0x21ca('0x2c')]({'where':{'userProfileId':_0x44d094[_0x21ca('0x62')]['id'],'sectionId':_['map'](_0x45b85f,function(_0x54b159){return _0x54b159[_0x21ca('0x65')];})},'transaction':_0x813961})[_0x21ca('0x2b')](function(){var _0x12d6b5=_[_0x21ca('0x37')](_0x45b85f,function(_0x16f540){_0x16f540['userProfileId']=_0x44d094[_0x21ca('0x62')]['id'];return _0x16f540;});var _0x3dea44=[];return BPromise[_0x21ca('0x5d')](_0x12d6b5,function(_0x1d6efb){return db['UserProfileSection'][_0x21ca('0x50')](_0x1d6efb,{'include':[{'model':db['UserProfileResource'],'as':_0x21ca('0x60')}],'raw':!![],'transaction':_0x813961})['then'](function(_0x222f8b){_0x3dea44['push'](_0x222f8b[_0x21ca('0x53')]({'plain':!![]}));});})['then'](function(){return _0x3dea44;});});});}})[_0x21ca('0x2b')](function(_0x33a11c){return _0x33a11c;})[_0x21ca('0x2b')](respondWithResult(_0x4382ef,null))[_0x21ca('0x4b')](handleError(_0x4382ef,null));};exports[_0x21ca('0x66')]=function(_0x343c7a,_0xd923bc){var _0x2b94d0;return db[_0x21ca('0x38')][_0x21ca('0x4f')]({'where':{'id':_0x343c7a[_0x21ca('0x62')]['id']},'attributes':['id',_0x21ca('0x2f')]})[_0x21ca('0x2b')](handleEntityNotFound(_0xd923bc,null))['then'](function(_0x3a1eca){if(_0x3a1eca){_0x2b94d0=_0x3a1eca;return db[_0x21ca('0x5b')][_0x21ca('0x2c')]({'where':{'userProfileId':_0x343c7a[_0x21ca('0x62')]['id'],'sectionId':_0x343c7a['query'][_0x21ca('0x67')]}});}})[_0x21ca('0x2b')](function(){return _0x2b94d0;})[_0x21ca('0x2b')](respondWithStatusCode(_0xd923bc,null))[_0x21ca('0x4b')](handleError(_0xd923bc,null));};exports['getSections']=function(_0x39d1f0,_0x279b85){var _0x39819c=[];var _0x1a744c=[];return db[_0x21ca('0x5b')][_0x21ca('0x5c')]({'where':{'userProfileId':_0x39d1f0[_0x21ca('0x62')]['id']},'raw':!![]})[_0x21ca('0x2b')](function(_0x694fc0){_0x39819c=_[_0x21ca('0x44')](_0x694fc0,function(_0x3d5a2d){return _0x3d5a2d[_0x21ca('0x68')]===0x1||_['includes']([0x3eb,0x709],_0x3d5a2d[_0x21ca('0x65')]);});if(!_[_0x21ca('0x69')](_0x39819c)){return _[_0x21ca('0x37')](_0x39819c,function(_0x5e5972){return _0x5e5972[_0x21ca('0x65')];});}else{return;}})[_0x21ca('0x2b')](function(_0x4452e9){if(_0x4452e9)_0x1a744c=_0x4452e9;if(_['includes'](_0x1a744c,0x64)){var _0x180fe0=_[_0x21ca('0x4f')](_0x39819c,{'sectionId':0x64});return hasDefaultDashboard(_0x180fe0)[_0x21ca('0x2b')](function(_0x139195){return _[_0x21ca('0x37')](_0x39819c,function(_0x41df84){if(_0x41df84['sectionId']===0x64){_0x41df84[_0x21ca('0x6a')]=_0x139195;}return _0x41df84;});});}else{return;}})[_0x21ca('0x2b')](function(_0x3b26f8){if(_0x3b26f8)_0x39819c=_0x3b26f8;if(_['includes'](_0x1a744c,0x3eb)){var _0x2f407b=_[_0x21ca('0x4f')](_0x39819c,{'sectionId':0x3eb});return getCustomDashboards(_0x2f407b)[_0x21ca('0x2b')](function(_0xc7430c){return _[_0x21ca('0x37')](_0x39819c,function(_0x6c5f78){if(_0x2f407b[_0x21ca('0x68')]){if(_0x6c5f78[_0x21ca('0x65')]===0x3eb){_0x6c5f78[_0x21ca('0x6a')]=_0xc7430c;}}else{if(_0x6c5f78['sectionId']===0x64){_0x6c5f78[_0x21ca('0x6a')]=_0xc7430c;}}return _0x6c5f78;});});}else{return;}})['then'](function(_0x28890d){if(_0x28890d)_0x39819c=_0x28890d;if(_[_0x21ca('0x6b')](_0x1a744c,0x709)){var _0x375a9c=_[_0x21ca('0x4f')](_0x39819c,{'sectionId':0x709});return getPlugins(_0x375a9c)['then'](function(_0x516168){if(_0x375a9c[_0x21ca('0x68')]){return _[_0x21ca('0x37')](_0x39819c,function(_0x34c8a7){if(_0x34c8a7[_0x21ca('0x65')]===0x709){_0x34c8a7[_0x21ca('0x6a')]=_0x516168;}return _0x34c8a7;});}else{var _0x41b4e1={'sectionId':0x76c,'enabled':0x1,'subsections':_0x516168};var _0x320ce7=_[_0x21ca('0x37')](_0x39819c);_0x320ce7[_0x21ca('0x6c')](_0x41b4e1);return _0x320ce7;}});}else{return;}})['then'](function(_0x584ac5){if(_0x584ac5)_0x39819c=_0x584ac5;return _[_0x21ca('0x44')](_0x39819c,[_0x21ca('0x68'),0x1]);})[_0x21ca('0x2b')](respondWithResult(_0x279b85,null))['catch'](handleError(_0x279b85,null));};function hasDefaultDashboard(_0x5d8c49){var _0x3d55b2=[0x65];return new BPromise(function(_0x58fbe0,_0x30d8a5){try{if(_0x5d8c49[_0x21ca('0x6d')]){_0x58fbe0(_0x3d55b2);}else{return db[_0x21ca('0x5e')][_0x21ca('0x6e')]({'where':{'sectionId':_0x5d8c49['id']},'raw':!![]})['then'](function(_0x350316){_0x350316?_0x58fbe0(_0x3d55b2):_0x58fbe0();});}}catch(_0x4eeaff){_0x30d8a5(_0x4eeaff);}});}function getCustomDashboards(_0x4df4d7){var _0x55f8ba=[];return new BPromise(function(_0x3d2bbf,_0x1b012f){try{if(_0x4df4d7[_0x21ca('0x6d')]){return db['Dashboard'][_0x21ca('0x5c')]({'raw':!![]})[_0x21ca('0x2b')](function(_0x2b6f16){_0x2b6f16[_0x21ca('0x6f')](function(_0x4fe446){_0x55f8ba['push'](_0x4fe446['id']+0x1869f);});_0x3d2bbf(_0x55f8ba);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x4df4d7['id']},'raw':!![]})['then'](function(_0x662026){_0x662026[_0x21ca('0x6f')](function(_0x304826){_0x55f8ba['push'](_0x304826['resourceId']+0x1869f);});_0x3d2bbf(_0x55f8ba);});}}catch(_0x1a7413){_0x1b012f(_0x1a7413);}});}function getPlugins(_0x45f1c1){var _0x232f37=[];return new BPromise(function(_0x20fc86,_0x572a76){try{if(_0x45f1c1[_0x21ca('0x6d')]){return db[_0x21ca('0x70')][_0x21ca('0x5c')]({'raw':!![]})[_0x21ca('0x2b')](function(_0x13228a){_0x13228a[_0x21ca('0x6f')](function(_0x162b79){_0x232f37[_0x21ca('0x6c')](_0x162b79['id']+0x15b38);});_0x20fc86(_0x232f37);});}else{return db[_0x21ca('0x5e')][_0x21ca('0x5c')]({'where':{'sectionId':_0x45f1c1['id']},'raw':!![]})['then'](function(_0x4b21f5){_0x4b21f5['forEach'](function(_0x38ef74){_0x232f37[_0x21ca('0x6c')](_0x38ef74['resourceId']+0x15b38);});_0x20fc86(_0x232f37);});}}catch(_0x3272c6){_0x572a76(_0x3272c6);}});}exports[_0x21ca('0x71')]=function(_0x2629c5,_0xb173ec){return db[_0x21ca('0x38')][_0x21ca('0x4f')]({'where':{'id':_0x2629c5[_0x21ca('0x62')]['id']}})[_0x21ca('0x2b')](handleEntityNotFound(_0xb173ec,null))['then'](function(_0x1b999f){if(_0x1b999f){return db[_0x21ca('0x59')][_0x21ca('0x5a')](function(_0x53e8f6){return db[_0x21ca('0x5b')][_0x21ca('0x5c')]({'where':{'userProfileId':_0x2629c5[_0x21ca('0x62')]['id']},'attributes':['id'],'raw':!![]})[_0x21ca('0x2b')](function(_0xcfa0b9){if(_0xcfa0b9){return db[_0x21ca('0x5b')][_0x21ca('0x2c')]({'where':{'userProfileId':_0x2629c5[_0x21ca('0x62')]['id'],'id':_[_0x21ca('0x37')](_0xcfa0b9,function(_0x4127c2){return _0x4127c2['id'];})},'transaction':_0x53e8f6});}})['then'](function(_0x56b1d6){var _0x5a205b=_[_0x21ca('0x37')](_0x2629c5[_0x21ca('0x57')],function(_0x257d3e){_0x257d3e['userProfileId']=_0x2629c5[_0x21ca('0x62')]['id'];return _0x257d3e;});return db[_0x21ca('0x5b')][_0x21ca('0x72')](_0x5a205b,{'raw':!![],'transaction':_0x53e8f6});})['then'](function(_0x4ff4e5){var _0x4e3432=_[_0x21ca('0x44')](_[_0x21ca('0x37')](_0x4ff4e5,function(_0x560865){return _0x560865['get']({'plain':!![]});}),{'includeAll':![]});if(_0x4e3432){return db[_0x21ca('0x5b')][_0x21ca('0x5c')]({'where':{'userProfileId':_0x2629c5[_0x21ca('0x62')]['id'],'sectionId':_['map'](_0x4e3432,function(_0x178ce6){return _0x178ce6['sectionId'];})},'attributes':['id',_0x21ca('0x65')],'raw':!![]})[_0x21ca('0x2b')](function(_0x343d93){var _0x30ecb8=_[_0x21ca('0x37')](_0x2629c5[_0x21ca('0x57')],function(_0xa0acb){_0xa0acb['userProfileId']=_0x2629c5[_0x21ca('0x62')]['id'];return _0xa0acb;});return db[_0x21ca('0x5e')][_0x21ca('0x72')](_0x30ecb8,{'raw':!![],'transaction':_0x53e8f6});});}})[_0x21ca('0x4b')](handleError(_0xb173ec,null));});}})[_0x21ca('0x2b')](function(_0x35594e){var _0x5f01f7=_[_0x21ca('0x37')](_0x35594e,function(_0x4c965b){return _0x4c965b[_0x21ca('0x53')]({'plain':!![]});});})[_0x21ca('0x2b')](respondWithResult(_0xb173ec,null))[_0x21ca('0x4b')](handleError(_0xb173ec,null));};exports[_0x21ca('0x73')]=function(_0x29e831,_0x12878e,_0x3afa1e){return db[_0x21ca('0x38')][_0x21ca('0x4f')]({'where':{'id':_0x29e831[_0x21ca('0x62')]['id']}})['then'](handleEntityNotFound(_0x12878e,null))[_0x21ca('0x2b')](function(_0x56ccd9){if(_0x56ccd9){return _0x56ccd9[_0x21ca('0x73')](_0x29e831[_0x21ca('0x3c')][_0x21ca('0x67')]);}})[_0x21ca('0x2b')](respondWithStatusCode(_0x12878e,null))[_0x21ca('0x4b')](handleError(_0x12878e,null));};exports[_0x21ca('0x74')]=function(_0x66a59c,_0x3bc8fb){var _0x9d7b={'raw':![],'where':{}};var _0x230581={};var _0x310c40={'count':0x0,'rows':[]};var _0x3b6003=_0x66a59c[_0x21ca('0x3c')][_0x21ca('0x75')];if(typeof _0x3b6003===_0x21ca('0x24')){throw new db[(_0x21ca('0x76'))][(_0x21ca('0x77'))](_0x21ca('0x78'));}var _0x484c5e=_0x66a59c[_0x21ca('0x3c')][_0x21ca('0x79')]||![];var _0xc81a12=getQueryModels(_0x3b6003,_0x484c5e);if(typeof _0xc81a12[_0x21ca('0x7a')]===_0x21ca('0x24')){throw new db[(_0x21ca('0x76'))]['ValidationError']('Invalid\x20section\x20\x27'+_0x3b6003+'\x27');}var _0x59b412=[];if(!_[_0x21ca('0x69')](_0xc81a12[_0x21ca('0x7b')])){_0x59b412=_0xc81a12[_0x21ca('0x7b')];}else{_0x59b412=[{'name':_0x3b6003}];}return db['UserProfile'][_0x21ca('0x6e')]({'where':{'id':_0x66a59c[_0x21ca('0x62')]['id']}})['then'](handleEntityNotFound(_0x3bc8fb,null))[_0x21ca('0x2b')](function(_0x499a77){if(_0x499a77){var _0x31b53c=[];for(var _0x4246f0=0x0;_0x4246f0<_0x59b412[_0x21ca('0x52')];_0x4246f0++){_0x31b53c[_0x21ca('0x6c')](db[_0x21ca('0x5b')]['findOne']({'where':{'userProfileId':_0x499a77['id'],'name':_0x59b412[_0x4246f0][_0x21ca('0x2f')]},'raw':!![]}));}return BPromise[_0x21ca('0x7c')](_0x31b53c);}})[_0x21ca('0x2b')](function(_0x551b5c){var _0x234e3a=_['filter'](_0x551b5c,function(_0x62bad0){return _0x62bad0?_0x62bad0:undefined;});var _0x2c573c=_[_0x21ca('0x44')](_0x59b412,[_0x21ca('0x7d'),!![]]);var _0x556ffc=_['isEmpty'](_0x234e3a)&&_[_0x21ca('0x69')](_0x2c573c)?null:_[_0x21ca('0x7e')](_0x2c573c,_0x234e3a);if(_0x556ffc){var _0x15ee48=[];for(var _0x3791ef=0x0;_0x3791ef<_0x556ffc['length'];_0x3791ef++){var _0x34db8f=_[_0x21ca('0x4f')](_0x59b412,function(_0xe59646){return _0x556ffc[_0x3791ef]?_0xe59646[_0x21ca('0x2f')]===_0x556ffc[_0x3791ef][_0x21ca('0x2f')]:null;});if(_0x34db8f){if(_0x556ffc[_0x3791ef]['ignore']){_0x15ee48[_0x21ca('0x6c')](getAllResources(_0xc81a12[_0x21ca('0x7a')],_0x556ffc[_0x3791ef]));}else{if(!_0x556ffc[_0x3791ef][_0x21ca('0x6d')]){_0x15ee48[_0x21ca('0x6c')](getAllowedResources(_0x34db8f,_0x556ffc[_0x3791ef],_0xc81a12[_0x21ca('0x7a')]));}else{if(_0x34db8f[_0x21ca('0x3b')]){_0x15ee48[_0x21ca('0x6c')](getAllFilteredResources(_0x34db8f,_0x556ffc[_0x3791ef]));}}}}}return BPromise[_0x21ca('0x7c')](_0x15ee48);}else{return null;}})[_0x21ca('0x2b')](function(_0x159b25){var _0x38a7d7=_0x159b25;var _0x4ec67a=null;if(_0x38a7d7){_0x4ec67a=_0x38a7d7[_0x21ca('0x52')]===0x1?_0x38a7d7[0x0]:null;}if(_0x4ec67a||_0x38a7d7){var _0x2755eb=db[_0xc81a12['childModel']][_0x21ca('0x4d')];_0x230581[_0x21ca('0x3b')]=_[_0x21ca('0x3d')](_0x2755eb);_0x230581[_0x21ca('0x3c')]=_[_0x21ca('0x3d')](_0x66a59c[_0x21ca('0x3c')]);_0x230581['filters']=_[_0x21ca('0x3f')](_0x230581[_0x21ca('0x3b')],_0x230581[_0x21ca('0x3c')]);_0x9d7b[_0x21ca('0x40')]=_['intersection'](_0x230581[_0x21ca('0x3b')],qs['fields'](_0x66a59c[_0x21ca('0x3c')][_0x21ca('0x51')]));_0x9d7b[_0x21ca('0x40')]=_0x9d7b['attributes'][_0x21ca('0x52')]?_0x9d7b['attributes']:_0x230581[_0x21ca('0x3b')];if(!_0x66a59c['query'][_0x21ca('0x41')]('nolimit')){_0x9d7b['limit']=qs[_0x21ca('0x25')](_0x66a59c[_0x21ca('0x3c')][_0x21ca('0x25')]);_0x9d7b[_0x21ca('0x23')]=qs['offset'](_0x66a59c[_0x21ca('0x3c')][_0x21ca('0x23')]);}_0x9d7b['order']=qs[_0x21ca('0x43')](_0x66a59c[_0x21ca('0x3c')][_0x21ca('0x43')]);_0x9d7b['where']=qs[_0x21ca('0x3e')](_[_0x21ca('0x7f')](_0x66a59c['query'],_0x230581[_0x21ca('0x3e')]));if(_0x66a59c[_0x21ca('0x3c')]['filter']){_0x9d7b[_0x21ca('0x45')]=_['merge'](_0x9d7b[_0x21ca('0x45')],{'$or':_[_0x21ca('0x37')](_0x2755eb,function(_0x7ef598){if(_0x7ef598[_0x21ca('0x46')][_0x21ca('0x3a')]!==_0x21ca('0x47')){var _0x86a532={};_0x86a532[_0x7ef598[_0x21ca('0x80')]]={'$like':'%'+_0x66a59c[_0x21ca('0x3c')][_0x21ca('0x44')]+'%'};return _0x86a532;}})});}var _0x4aca5b=[];if(_0x4ec67a){var _0x89915=_[_0x21ca('0x4f')](_0x59b412,[_0x21ca('0x2f'),_0x4ec67a[_0x21ca('0x2f')]]);if(_0x89915['field']){var _0x3ac968={};if(_0xc81a12['childModel']===_0x21ca('0x81')){_0x3ac968[_0x89915[_0x21ca('0x82')]]=_[_0x21ca('0x37')](_0x4ec67a[_0x21ca('0x83')],'id');}else{_0x3ac968[_0x89915['foreignKey']]=_0x4ec67a[_0x21ca('0x83')];}_0x4aca5b['push'](_0x3ac968);}else{_0x9d7b['where']['id']=_0x4ec67a[_0x21ca('0x83')];}}else{for(var _0x566e1f=0x0;_0x566e1f<_0x38a7d7['length'];_0x566e1f++){var _0x89915=_[_0x21ca('0x4f')](_0x59b412,[_0x21ca('0x2f'),_0x38a7d7[_0x566e1f][_0x21ca('0x2f')]]);if(_0x89915[_0x21ca('0x80')]){var _0x3ac968={};_0x3ac968[_0x89915[_0x21ca('0x82')]]=_0x38a7d7[_0x566e1f][_0x21ca('0x83')];_0x4aca5b['push'](_0x3ac968);}else{if(!_0x9d7b[_0x21ca('0x45')]['id'])_0x9d7b['where']['id']=[];_0x38a7d7[_0x566e1f][_0x21ca('0x83')][_0x21ca('0x6f')](function(_0x4c83a2){_0x9d7b[_0x21ca('0x45')]['id'][_0x21ca('0x6c')](_0x4c83a2);});}}}if(!_[_0x21ca('0x69')](_0x4aca5b)){_0x9d7b[_0x21ca('0x45')]=_[_0x21ca('0x32')](_0x9d7b[_0x21ca('0x45')],{'$and':{'$or':_0x4aca5b}});}_0x9d7b=_[_0x21ca('0x32')]({},_0x9d7b,_0x66a59c[_0x21ca('0x48')]);if(_0x4ec67a&&!_0x4ec67a['autoAssociation']&&_0xc81a12[_0x21ca('0x7a')]===_0x21ca('0x81')){if(_0x66a59c[_0x21ca('0x3c')]['includeAll']){_0x9d7b[_0x21ca('0x4e')]=[{'all':!![]}];}return db[_0xc81a12[_0x21ca('0x7a')]][_0x21ca('0x5c')](_0x9d7b)[_0x21ca('0x2b')](function(_0x28bb38){var _0x36c6a4=[];_0x28bb38[_0x21ca('0x6f')](function(_0x51149a){var _0x4879b9;switch(_0x51149a[_0x21ca('0x84')]){case _0x21ca('0x85'):_0x4879b9=_[_0x21ca('0x4f')](_0x4ec67a[_0x21ca('0x83')],function(_0x2c5687){return _0x2c5687['id']===_0x51149a['reportId']&&_0x2c5687[_0x21ca('0x46')]===_0x21ca('0x86');});break;case'custom':_0x4879b9=_[_0x21ca('0x4f')](_0x4ec67a['associatedResources'],function(_0x17069e){return _0x17069e['id']===_0x51149a[_0x21ca('0x87')]&&_0x17069e[_0x21ca('0x46')]==='CustomReports';});break;}if(_0x4879b9)_0x36c6a4[_0x21ca('0x6c')](_0x51149a);});_0x310c40[_0x21ca('0x26')]=_0x36c6a4[_0x21ca('0x52')];_0x310c40[_0x21ca('0x4a')]=_0x36c6a4;return _0x310c40;});}else{return db[_0xc81a12[_0x21ca('0x7a')]][_0x21ca('0x26')]({'where':_0x9d7b[_0x21ca('0x45')]})[_0x21ca('0x2b')](function(_0x54e325){_0x310c40[_0x21ca('0x26')]=_0x54e325;if(_0x66a59c[_0x21ca('0x3c')][_0x21ca('0x49')]){if(_0xc81a12[_0x21ca('0x7a')]==='CmContact'){_0x9d7b[_0x21ca('0x4e')]=[{'model':db['Tag'],'as':_0x21ca('0x88'),'attributes':['id','name',_0x21ca('0x89')],'required':_0x66a59c[_0x21ca('0x3c')][_0x21ca('0x8a')]?!![]:![]},{'model':db[_0x21ca('0x8b')],'as':_0x21ca('0x8c'),'attributes':['id',_0x21ca('0x2f'),'color'],'through':_0x66a59c[_0x21ca('0x3c')][_0x21ca('0x8a')]?{'attributes':[],'where':{'TagId':_0x66a59c[_0x21ca('0x3c')]['tag']||undefined}}:{},'required':_0x66a59c[_0x21ca('0x3c')][_0x21ca('0x8a')]?!![]:![]}];}else{_0x9d7b[_0x21ca('0x4e')]=[{'all':!![]}];}}return db[_0xc81a12[_0x21ca('0x7a')]][_0x21ca('0x5c')](_0x9d7b);})[_0x21ca('0x2b')](function(_0x25d694){_0x310c40['rows']=_0x25d694;if(_0x3b6003===_0x21ca('0x8d')&&_0x66a59c[_0x21ca('0x3c')][_0x21ca('0x8e')]===_0x21ca('0x8f')){var _0x5ae36e=[];for(var _0x14cace=0x0;_0x14cace<_0x310c40[_0x21ca('0x4a')][_0x21ca('0x52')];_0x14cace++){_0x5ae36e['push'](getOpenTabs('chat',_0x310c40[_0x21ca('0x4a')][_0x14cace][_0x21ca('0x90')]));_0x5ae36e[_0x21ca('0x6c')](getOpenTabs(_0x21ca('0x91'),_0x310c40[_0x21ca('0x4a')][_0x14cace][_0x21ca('0x90')]));_0x5ae36e[_0x21ca('0x6c')](getOpenTabs(_0x21ca('0x92'),_0x310c40[_0x21ca('0x4a')][_0x14cace][_0x21ca('0x90')]));_0x5ae36e[_0x21ca('0x6c')](getOpenTabs(_0x21ca('0x93'),_0x310c40['rows'][_0x14cace][_0x21ca('0x90')]));_0x5ae36e[_0x21ca('0x6c')](getOpenTabs(_0x21ca('0x94'),_0x310c40['rows'][_0x14cace][_0x21ca('0x90')]));_0x5ae36e[_0x21ca('0x6c')](getOpenTabs(_0x21ca('0x95'),_0x310c40['rows'][_0x14cace]['dataValues']));}return Promise[_0x21ca('0x7c')](_0x5ae36e)[_0x21ca('0x2b')](function(){return _0x310c40;});}return _0x310c40;});}}else{return _0x310c40;}})['then'](respondWithFilteredResult(_0x3bc8fb,_0x9d7b))['catch'](handleError(_0x3bc8fb,null));};function getOpenTabs(_0x3b5933,_0x44e814){var _0x4ec00a=_0x3b5933[_0x21ca('0x96')](0x0)[_0x21ca('0x97')]()+_0x3b5933[_0x21ca('0x98')](0x1);var _0xcf56d5={'type':db[_0x21ca('0x76')]['QueryTypes'][_0x21ca('0x99')],'raw':!![]};return new BPromise(function(_0x558e4d,_0x280a80){var _0x21015=squel['select']()[_0x21ca('0x80')](_0x21ca('0x9a')+_0x4ec00a+_0x21ca('0x9b'),'id')[_0x21ca('0x80')](_0x21ca('0x9c'))[_0x21ca('0x9d')](_0x21ca('0x9e')+_0x3b5933+_0x21ca('0x9f'),'ui')['where'](_0x21ca('0xa0'),_0x44e814['id']);return db['sequelize'][_0x21ca('0x3c')](_0x21015[_0x21ca('0xa1')](),_0xcf56d5)[_0x21ca('0x2b')](function(_0x32622e){_0x44e814[_0x4ec00a+'OpenTabs']=_0x32622e;_0x558e4d(_0x32622e);})[_0x21ca('0x4b')](function(_0x5e7435){_0x280a80(_0x5e7435);});});}function getAllResources(_0x3daaa7,_0x5681b8){return new BPromise(function(_0x57ad48,_0x33f715){if(_0x5681b8){var _0x179ebf=_0x5681b8[_0x21ca('0x44')]?{[_0x5681b8[_0x21ca('0x44')]['field']]:_0x5681b8['filter'][_0x21ca('0xa2')]}:undefined;return db[_0x3daaa7][_0x21ca('0x5c')]({'where':_0x179ebf,'raw':!![]})[_0x21ca('0x2b')](function(_0x557250){_0x5681b8[_0x21ca('0x83')]=_[_0x21ca('0x37')](_0x557250,'id');_0x57ad48(_0x5681b8);})['catch'](function(_0x4fbc37){_0x33f715(_0x4fbc37);});}else{_0x57ad48(null);}});}function getAllFilteredResources(_0x185156,_0x4193b4){return new BPromise(function(_0x4002e4,_0x5f4b61){var _0xfba275=_0x185156[_0x21ca('0x44')]?{[_0x185156['filter']['field']]:_0x185156['filter'][_0x21ca('0xa2')]}:undefined;return db[_0x185156[_0x21ca('0x3b')]][_0x21ca('0x5c')]({'where':_0xfba275,'raw':!![]})[_0x21ca('0x2b')](function(_0x5da8a9){_0x4193b4[_0x21ca('0x83')]=_['map'](_0x5da8a9,function(_0x5c6a3b){return _0x185156[_0x21ca('0x80')]?_0x5c6a3b[_0x185156[_0x21ca('0x80')]]:_0x5c6a3b[_0x21ca('0x2f')];});_0x4002e4(_0x4193b4);})[_0x21ca('0x4b')](function(_0x40a804){_0x5f4b61(_0x40a804);});});}function getAllowedResources(_0x59c6ad,_0x4f28c0,_0x44188d){return new BPromise(function(_0x5b6ae8,_0x50e6b8){if(_0x4f28c0){return db[_0x21ca('0x5e')]['findAll']({'where':{'sectionId':_0x4f28c0['id']},'raw':!![]})['then'](function(_0x179b06){if(_0x59c6ad[_0x21ca('0x80')]&&_0x59c6ad[_0x21ca('0x80')]!=='id'){_0x4f28c0['associatedResources']=_['map'](_0x179b06,function(_0x33b136){return _0x33b136[_0x59c6ad[_0x21ca('0x80')]];});}else{if(_0x44188d==='AnalyticExtractedReport'){_0x4f28c0[_0x21ca('0x83')]=_[_0x21ca('0x37')](_0x179b06,function(_0x14dd9e){return{'id':_0x14dd9e[_0x21ca('0xa3')],'type':_0x14dd9e['type']};});}else{_0x4f28c0[_0x21ca('0x83')]=_[_0x21ca('0x37')](_0x179b06,function(_0x3b10dd){return _0x3b10dd[_0x21ca('0xa3')];});}}_0x5b6ae8(_0x4f28c0);})[_0x21ca('0x4b')](function(_0x3fac40){_0x50e6b8(_0x3fac40);});}else{_0x5b6ae8(null);}});}function getQueryModels(_0x26fe7d,_0x3d73ea){var _0x295f78=_0x26fe7d['toLowerCase']();var _0x1ea952={'childModel':undefined,'parentSections':[]};switch(_0x295f78){case _0x21ca('0xa4'):_0x1ea952['childModel']='SquareProject';break;case _0x21ca('0xa5'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xa6');break;case _0x21ca('0xa7'):_0x1ea952['childModel']='SquareRecording';_0x1ea952[_0x21ca('0x7b')]=[{'name':_0x21ca('0xa8'),'field':'name','foreignKey':_0x21ca('0xa9')}];break;case _0x21ca('0xaa'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xab');break;case _0x21ca('0xac'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xad');_0x1ea952['parentSections']=[{'name':_0x21ca('0xae'),'field':'id','foreignKey':_0x21ca('0xaf')}];break;case _0x21ca('0xb0'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xb1');break;case _0x21ca('0xb2'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xb3');break;case _0x21ca('0xb4'):_0x1ea952[_0x21ca('0x7a')]='CmCustomField';break;case _0x21ca('0xb5'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xb6');break;case'chatwebsites':_0x1ea952[_0x21ca('0x7a')]='ChatWebsite';break;case'faxqueues':_0x1ea952[_0x21ca('0x7a')]='FaxQueue';break;case'faxaccounts':_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xb7');break;case _0x21ca('0xb8'):case'internalroutes':case _0x21ca('0xb9'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xba');break;case'contexts':_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xbb');break;case'voicemails':_0x1ea952[_0x21ca('0x7a')]='VoiceMail';break;case _0x21ca('0xbc'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xbd');_0x1ea952[_0x21ca('0x7b')]=[{'name':_0x21ca('0x8d'),'field':_0x21ca('0x2f'),'foreignKey':_0x21ca('0xbe'),'model':_0x21ca('0xbf'),'filter':{'field':_0x21ca('0xc0'),'value':[_0x21ca('0xc1')]}},{'name':_0x21ca('0xc2'),'field':_0x21ca('0x2f'),'foreignKey':_0x21ca('0xbe'),'model':'User','filter':{'field':_0x21ca('0xc0'),'value':[_0x21ca('0xc3')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x21ca('0xc4'),'model':_0x21ca('0xc5'),'filter':{'field':_0x21ca('0x46'),'value':['inbound']}},{'name':_0x21ca('0xc6'),'field':'name','foreignKey':_0x21ca('0xc4'),'model':_0x21ca('0xc5'),'filter':{'field':_0x21ca('0x46'),'value':['outbound']}}];break;case _0x21ca('0xc7'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xc8');break;case'chanspies':_0x1ea952[_0x21ca('0x7a')]='VoiceChanSpy';break;case _0x21ca('0xc9'):_0x1ea952[_0x21ca('0x7a')]='VoicePrefix';break;case _0x21ca('0xca'):_0x1ea952[_0x21ca('0x7a')]='Campaign';break;case _0x21ca('0xcb'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xcc');break;case _0x21ca('0xcd'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xce');break;case _0x21ca('0xcf'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xd0');break;case'openchannelqueues':_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xd1');break;case'openchannelaccounts':_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xd2');break;case _0x21ca('0xd3'):_0x1ea952['childModel']=_0x21ca('0xd4');break;case _0x21ca('0xd5'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xd6');break;case _0x21ca('0xd7'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xd8');break;case'teams':_0x1ea952['childModel']='Team';break;case _0x21ca('0xd9'):case _0x21ca('0xda'):_0x1ea952[_0x21ca('0x7a')]='VoiceQueue';if(_0x3d73ea){_0x1ea952[_0x21ca('0x7b')]=[{'name':_0x21ca('0xdb')},{'name':_0x21ca('0xc6')}];}break;case _0x21ca('0xdc'):case'agents':case _0x21ca('0xdd'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xbf');if(_0x3d73ea){_0x1ea952[_0x21ca('0x7b')]=[{'name':'Users','filter':{'field':'role','value':['admin',_0x21ca('0xde')]},'ignore':!![]},{'name':_0x21ca('0x8d')},{'name':_0x21ca('0xc2')}];}break;case _0x21ca('0xdf'):_0x1ea952[_0x21ca('0x7a')]='ZendeskAccount';break;case _0x21ca('0xe0'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xe1');break;case _0x21ca('0xe2'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xe3');break;case _0x21ca('0xe4'):_0x1ea952['childModel']='SugarcrmAccount';break;case _0x21ca('0xe5'):_0x1ea952['childModel']='DeskAccount';break;case _0x21ca('0xe6'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xe7');break;case'vtigeraccounts':_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xbf');break;case _0x21ca('0xe8'):_0x1ea952['childModel']=_0x21ca('0xe9');break;case _0x21ca('0xea'):_0x1ea952[_0x21ca('0x7a')]='Disposition';break;case _0x21ca('0xeb'):_0x1ea952['childModel']='Dashboard';break;case'intervals':_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xec');break;case _0x21ca('0xed'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xee');break;case _0x21ca('0xef'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xf0');break;case'sounds':_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xf1');break;case'tags':_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0x8b');break;case _0x21ca('0xf2'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xf3');break;case _0x21ca('0xf4'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xf5');break;case _0x21ca('0xf6'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xf7');break;case _0x21ca('0xf8'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xf9');break;case'plugins':_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0x70');break;case _0x21ca('0xfa'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0x81');_0x1ea952[_0x21ca('0x7b')]=[{'name':_0x21ca('0xfb'),'field':'id','foreignKey':_0x21ca('0x87')}];break;case _0x21ca('0xfc'):_0x1ea952[_0x21ca('0x7a')]=_0x21ca('0xfd');break;case _0x21ca('0xfe'):_0x1ea952['childModel']=_0x21ca('0xff');break;case'screenrecordings':_0x1ea952['childModel']=_0x21ca('0x100');_0x1ea952['parentSections']=[{'name':_0x21ca('0x8d'),'field':'id','foreignKey':_0x21ca('0x101'),'model':_0x21ca('0xbf'),'filter':{'field':_0x21ca('0xc0'),'value':['agent']}},{'name':_0x21ca('0xc2'),'field':'id','foreignKey':_0x21ca('0x101'),'model':_0x21ca('0xbf'),'filter':{'field':'role','value':[_0x21ca('0xc3')]}}];break;default:return _0x1ea952;}return _0x1ea952;} \ No newline at end of file +var _0x4af6=['color','ThroughTags','tag','Agents','openTabs','true','chat','dataValues','sms','openchannel','whatsapp','charAt','toUpperCase','slice','select','ui.','ui.createdAt','user_has_','ui.UserId\x20=\x20?','OpenTabs','value','toLowerCase','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','membername','User','role','Telephones','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','teams','Team','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Template','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','metrics','AnalyticMetric','WhatsappAccount','screenrecordings','ScreenRecording','UserId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','sendStatus','stack','name','render','merge','body','contact','interaction','account','index','UserProfile','rawAttributes','type','key','model','map','query','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','intersection','options','create','clone','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','autoAssociation','sectionId','userProfileId','Resources','UserProfileSection','destroy','describe','addSections','UserProfileResource','push','removeSections','ids','getSections','enabled','includes','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','section','Sequelize','Unknown\x20section','mergeResources','ValidationError','Invalid\x20section\x20\x27','parentSections','all','ignore','isEmpty','childModel','nolimit','pick','field','foreignKey','associatedResources','default','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags'];(function(_0x5f4b90,_0x135c3f){var _0x5de28e=function(_0x43ee8c){while(--_0x43ee8c){_0x5f4b90['push'](_0x5f4b90['shift']());}};_0x5de28e(++_0x135c3f);}(_0x4af6,0x7d));var _0x64af=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x4af6[_0x49b207];return _0x2dc8fa;};'use strict';var emlformat=require(_0x64af('0x0'));var rimraf=require(_0x64af('0x1'));var zipdir=require(_0x64af('0x2'));var jsonpatch=require(_0x64af('0x3'));var rp=require(_0x64af('0x4'));var moment=require(_0x64af('0x5'));var BPromise=require(_0x64af('0x6'));var Mustache=require('mustache');var util=require(_0x64af('0x7'));var path=require('path');var sox=require(_0x64af('0x8'));var csv=require('to-csv');var ejs=require(_0x64af('0x9'));var fs=require('fs');var fs_extra=require(_0x64af('0xa'));var _=require(_0x64af('0xb'));var squel=require(_0x64af('0xc'));var crypto=require(_0x64af('0xd'));var jsforce=require(_0x64af('0xe'));var deskjs=require(_0x64af('0xf'));var toCsv=require(_0x64af('0x10'));var querystring=require('querystring');var Papa=require(_0x64af('0x11'));var Redis=require(_0x64af('0x12'));var authService=require(_0x64af('0x13'));var qs=require(_0x64af('0x14'));var as=require(_0x64af('0x15'));var hardwareService=require(_0x64af('0x16'));var logger=require(_0x64af('0x17'))(_0x64af('0x18'));var utils=require(_0x64af('0x19'));var config=require(_0x64af('0x1a'));var licenseUtil=require(_0x64af('0x1b'));var db=require(_0x64af('0x1c'))['db'];config[_0x64af('0x1d')]=_[_0x64af('0x1e')](config['redis'],{'host':_0x64af('0x1f'),'port':0x18eb});var socket=require(_0x64af('0x20'))(new Redis(config['redis']));require(_0x64af('0x21'))['register'](socket);function respondWithStatusCode(_0x20c769,_0x359ea1){_0x359ea1=_0x359ea1||0xcc;return function(_0x1e2cf1){if(_0x1e2cf1){return _0x20c769['sendStatus'](_0x359ea1);}return _0x20c769['status'](_0x359ea1)[_0x64af('0x22')]();};}function respondWithResult(_0x4f533f,_0xbac223){_0xbac223=_0xbac223||0xc8;return function(_0x28e326){if(_0x28e326){return _0x4f533f['status'](_0xbac223)[_0x64af('0x23')](_0x28e326);}};}function respondWithFilteredResult(_0x413c89,_0x397a22){return function(_0x5ef459){if(_0x5ef459){var _0x103f95=typeof _0x397a22[_0x64af('0x24')]===_0x64af('0x25')&&typeof _0x397a22[_0x64af('0x26')]===_0x64af('0x25');var _0x27dd77=_0x5ef459[_0x64af('0x27')];var _0x4abf84=_0x103f95?0x0:_0x397a22[_0x64af('0x24')];var _0x354c0f=_0x103f95?_0x5ef459[_0x64af('0x27')]:_0x397a22[_0x64af('0x24')]+_0x397a22[_0x64af('0x26')];var _0xa18d1d;if(_0x354c0f>=_0x27dd77){_0x354c0f=_0x27dd77;_0xa18d1d=0xc8;}else{_0xa18d1d=0xce;}_0x413c89[_0x64af('0x28')](_0xa18d1d);return _0x413c89[_0x64af('0x29')](_0x64af('0x2a'),_0x4abf84+'-'+_0x354c0f+'/'+_0x27dd77)[_0x64af('0x23')](_0x5ef459);}return null;};}function patchUpdates(_0x512c97){return function(_0x25cd18){try{jsonpatch[_0x64af('0x2b')](_0x25cd18,_0x512c97,!![]);}catch(_0xa714e7){return BPromise['reject'](_0xa714e7);}return _0x25cd18[_0x64af('0x2c')]();};}function saveUpdates(_0x676bcf,_0x40a2e3){return function(_0x3ed3ad){if(_0x3ed3ad){return _0x3ed3ad[_0x64af('0x2d')](_0x676bcf)[_0x64af('0x2e')](function(_0x234d05){return _0x234d05;});}return null;};}function removeEntity(_0x319e13,_0x35fd32){return function(_0x31cb93){if(_0x31cb93){return _0x31cb93['destroy']()[_0x64af('0x2e')](function(){_0x319e13['status'](0xcc)[_0x64af('0x22')]();});}};}function handleEntityNotFound(_0xfeb355,_0x2fe7a5){return function(_0xe37e35){if(!_0xe37e35){_0xfeb355[_0x64af('0x2f')](0x194);}return _0xe37e35;};}function handleError(_0x94cf63,_0x5c4aff){_0x5c4aff=_0x5c4aff||0x1f4;return function(_0x4758a4){logger['error'](_0x4758a4[_0x64af('0x30')]);if(_0x4758a4['name']){delete _0x4758a4[_0x64af('0x31')];}_0x94cf63['status'](_0x5c4aff)['send'](_0x4758a4);};}function getMustacheRender(_0x25be09,_0x45330b){return Mustache[_0x64af('0x32')](_0x25be09,_[_0x64af('0x33')](_0x45330b[_0x64af('0x34')],{'contact':_0x45330b[_0x64af('0x35')],'message':_0x45330b['message'],'agent':_0x45330b['agent'],'interaction':_0x45330b[_0x64af('0x36')],'account':_0x45330b[_0x64af('0x37')]}))||'';}exports[_0x64af('0x38')]=function(_0x137627,_0x5ea67d){var _0x297596={},_0x44685f={},_0x5eb410={'count':0x0,'rows':[]};var _0x46adbe=_['map'](db[_0x64af('0x39')][_0x64af('0x3a')],function(_0x587f54){return{'name':_0x587f54['fieldName'],'type':_0x587f54[_0x64af('0x3b')][_0x64af('0x3c')]};});_0x44685f[_0x64af('0x3d')]=_[_0x64af('0x3e')](_0x46adbe,'name');_0x44685f[_0x64af('0x3f')]=_['keys'](_0x137627[_0x64af('0x3f')]);_0x44685f['filters']=_['intersection'](_0x44685f[_0x64af('0x3d')],_0x44685f['query']);_0x297596['attributes']=_['intersection'](_0x44685f[_0x64af('0x3d')],qs[_0x64af('0x40')](_0x137627['query'][_0x64af('0x40')]));_0x297596[_0x64af('0x41')]=_0x297596[_0x64af('0x41')][_0x64af('0x42')]?_0x297596[_0x64af('0x41')]:_0x44685f[_0x64af('0x3d')];if(!_0x137627[_0x64af('0x3f')][_0x64af('0x43')]('nolimit')){_0x297596['limit']=qs[_0x64af('0x26')](_0x137627[_0x64af('0x3f')][_0x64af('0x26')]);_0x297596[_0x64af('0x24')]=qs['offset'](_0x137627[_0x64af('0x3f')][_0x64af('0x24')]);}_0x297596[_0x64af('0x44')]=qs['sort'](_0x137627[_0x64af('0x3f')][_0x64af('0x45')]);_0x297596[_0x64af('0x46')]=qs[_0x64af('0x47')](_['pick'](_0x137627[_0x64af('0x3f')],_0x44685f[_0x64af('0x47')]),_0x46adbe);if(_0x137627[_0x64af('0x3f')][_0x64af('0x48')]){_0x297596[_0x64af('0x46')]=_[_0x64af('0x33')](_0x297596[_0x64af('0x46')],{'$or':_['map'](_0x46adbe,function(_0x484093){if(_0x484093[_0x64af('0x3b')]!==_0x64af('0x49')){var _0x431afa={};_0x431afa[_0x484093[_0x64af('0x31')]]={'$like':'%'+_0x137627['query'][_0x64af('0x48')]+'%'};return _0x431afa;}})});}_0x297596=_['merge']({},_0x297596,_0x137627['options']);var _0x365a47={'where':_0x297596[_0x64af('0x46')]};return db[_0x64af('0x39')][_0x64af('0x27')](_0x365a47)[_0x64af('0x2e')](function(_0x3b89e2){_0x5eb410['count']=_0x3b89e2;if(_0x137627[_0x64af('0x3f')][_0x64af('0x4a')]){_0x297596[_0x64af('0x4b')]=[{'all':!![]}];}return db['UserProfile'][_0x64af('0x4c')](_0x297596);})[_0x64af('0x2e')](function(_0x22d46c){_0x5eb410[_0x64af('0x4d')]=_0x22d46c;return _0x5eb410;})[_0x64af('0x2e')](respondWithFilteredResult(_0x5ea67d,_0x297596))[_0x64af('0x4e')](handleError(_0x5ea67d,null));};exports[_0x64af('0x4f')]=function(_0x3fb176,_0x409dea){var _0x518d78={'raw':![],'where':{'id':_0x3fb176[_0x64af('0x50')]['id']}},_0x59a7f9={};_0x59a7f9[_0x64af('0x3d')]=_[_0x64af('0x51')](db[_0x64af('0x39')][_0x64af('0x3a')]);_0x59a7f9[_0x64af('0x3f')]=_[_0x64af('0x51')](_0x3fb176[_0x64af('0x3f')]);_0x59a7f9[_0x64af('0x47')]=_[_0x64af('0x52')](_0x59a7f9[_0x64af('0x3d')],_0x59a7f9['query']);_0x518d78['attributes']=_[_0x64af('0x52')](_0x59a7f9[_0x64af('0x3d')],qs['fields'](_0x3fb176['query'][_0x64af('0x40')]));_0x518d78[_0x64af('0x41')]=_0x518d78['attributes'][_0x64af('0x42')]?_0x518d78['attributes']:_0x59a7f9[_0x64af('0x3d')];if(_0x3fb176[_0x64af('0x3f')][_0x64af('0x4a')]){_0x518d78[_0x64af('0x4b')]=[{'all':!![]}];}_0x518d78=_['merge']({},_0x518d78,_0x3fb176[_0x64af('0x53')]);return db[_0x64af('0x39')]['find'](_0x518d78)[_0x64af('0x2e')](handleEntityNotFound(_0x409dea,null))[_0x64af('0x2e')](respondWithResult(_0x409dea,null))[_0x64af('0x4e')](handleError(_0x409dea,null));};exports['create']=function(_0x311342,_0xa55e54){return db['UserProfile'][_0x64af('0x54')](_0x311342[_0x64af('0x34')],{})['then'](respondWithResult(_0xa55e54,0xc9))[_0x64af('0x4e')](handleError(_0xa55e54,null));};exports[_0x64af('0x55')]=function(_0x3153c3,_0x365090){var _0x4796c4={'where':{'id':_0x3153c3[_0x64af('0x50')]['id']}},_0xd58c05={};_0xd58c05['model']=_[_0x64af('0x51')](db[_0x64af('0x39')]['rawAttributes']);_0x4796c4[_0x64af('0x41')]=_[_0x64af('0x52')](_0xd58c05['model'],qs[_0x64af('0x40')](_0x3153c3['query'][_0x64af('0x40')]));_0x4796c4[_0x64af('0x41')]=_0x4796c4[_0x64af('0x41')][_0x64af('0x42')]?_0x4796c4[_0x64af('0x41')]:_0xd58c05[_0x64af('0x3d')];if(_0x3153c3['query'][_0x64af('0x4a')]){_0x4796c4[_0x64af('0x4b')]=[{'all':!![]}];}_0x4796c4=_[_0x64af('0x33')]({},_0x4796c4,_0x3153c3[_0x64af('0x53')]);return db[_0x64af('0x39')][_0x64af('0x56')](_0x4796c4)['then'](handleEntityNotFound(_0x365090,null))[_0x64af('0x2e')](function(_0x519c18){if(_0x519c18){var _0x11e8b6=_0x519c18[_0x64af('0x57')]({'plain':!![]});_0x11e8b6=qs[_0x64af('0x58')](_0x11e8b6,['id',_0x64af('0x59'),_0x64af('0x5a'),_0x64af('0x5b')]);_0x3153c3[_0x64af('0x34')]=_[_0x64af('0x58')](_0x3153c3['body'],['id','createdAt',_0x64af('0x5a')]);return db[_0x64af('0x5c')][_0x64af('0x5d')](function(_0x1e1239){return db[_0x64af('0x39')]['create'](_[_0x64af('0x33')](_0x11e8b6,_0x3153c3[_0x64af('0x34')]),{'include':_0x3153c3[_0x64af('0x3f')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x1e1239})[_0x64af('0x2e')](function(_0x511014){var _0x5629b4=_0x511014[_0x64af('0x57')]({'plain':!![]});return db['UserProfileSection'][_0x64af('0x4c')]({'where':{'userProfileId':_0x3153c3[_0x64af('0x50')]['id']},'raw':!![]})[_0x64af('0x2e')](function(_0x10446a){if(_0x10446a){return BPromise['each'](_0x10446a,function(_0x304ebe){return new BPromise(function(_0x167d66,_0x45d492){if(_0x304ebe[_0x64af('0x5e')]===null||_0x304ebe[_0x64af('0x5e')]===0x1)_0x167d66(null);return db['UserProfileResource'][_0x64af('0x4c')]({'where':{'sectionId':_0x304ebe['id']},'raw':!![]})[_0x64af('0x2e')](function(_0x591fb1){var _0x4667b2=_[_0x64af('0x3e')](_0x591fb1,function(_0x1996ec){return qs['omit'](_0x1996ec,['id',_0x64af('0x59'),_0x64af('0x5a'),_0x64af('0x5f')]);});_0x167d66(_0x4667b2);})[_0x64af('0x4e')](function(_0x26f654){_0x45d492(_0x26f654);});})[_0x64af('0x2e')](function(_0x32431b){var _0x1e452f=qs[_0x64af('0x58')](_0x304ebe,['id','createdAt',_0x64af('0x5a')]);_0x1e452f[_0x64af('0x60')]=_0x5629b4['id'];if(_0x32431b)_0x1e452f[_0x64af('0x61')]=_0x32431b;return _0x1e452f;})[_0x64af('0x2e')](function(_0x462fce){return db[_0x64af('0x62')][_0x64af('0x54')](_0x462fce,{'include':[{'model':db['UserProfileResource'],'as':_0x64af('0x61')}],'raw':!![],'transaction':_0x1e1239});});})[_0x64af('0x2e')](function(){return _0x5629b4;});}});});});}})[_0x64af('0x2e')](respondWithResult(_0x365090,0xc9))[_0x64af('0x4e')](handleError(_0x365090,null));};exports[_0x64af('0x2d')]=function(_0x47ff7d,_0x50d2e3){if(_0x47ff7d['body']['id']){delete _0x47ff7d[_0x64af('0x34')]['id'];}return db[_0x64af('0x39')][_0x64af('0x56')]({'where':{'id':_0x47ff7d[_0x64af('0x50')]['id']}})[_0x64af('0x2e')](handleEntityNotFound(_0x50d2e3,null))[_0x64af('0x2e')](saveUpdates(_0x47ff7d[_0x64af('0x34')],null))[_0x64af('0x2e')](respondWithResult(_0x50d2e3,null))[_0x64af('0x4e')](handleError(_0x50d2e3,null));};exports[_0x64af('0x63')]=function(_0x56e881,_0x440a98){return db[_0x64af('0x39')]['find']({'where':{'id':_0x56e881[_0x64af('0x50')]['id']}})[_0x64af('0x2e')](handleEntityNotFound(_0x440a98,null))[_0x64af('0x2e')](removeEntity(_0x440a98,null))[_0x64af('0x4e')](handleError(_0x440a98,null));};exports['describe']=function(_0x37e252,_0x239dad){return db[_0x64af('0x39')][_0x64af('0x64')]()[_0x64af('0x2e')](respondWithResult(_0x239dad,null))[_0x64af('0x4e')](handleError(_0x239dad,null));};exports[_0x64af('0x65')]=function(_0x2d3204,_0x3a08f9){var _0x27ae57=_0x2d3204[_0x64af('0x34')];return db[_0x64af('0x39')][_0x64af('0x56')]({'where':{'id':_0x2d3204['params']['id']}})[_0x64af('0x2e')](handleEntityNotFound(_0x3a08f9,null))[_0x64af('0x2e')](function(_0x3adb56){if(_0x3adb56){return db[_0x64af('0x5c')][_0x64af('0x5d')](function(_0x4d4741){return db[_0x64af('0x62')][_0x64af('0x63')]({'where':{'userProfileId':_0x2d3204[_0x64af('0x50')]['id'],'sectionId':_[_0x64af('0x3e')](_0x27ae57,function(_0x27115a){return _0x27115a[_0x64af('0x5f')];})},'transaction':_0x4d4741})[_0x64af('0x2e')](function(){var _0x971ac1=_[_0x64af('0x3e')](_0x27ae57,function(_0x59902b){_0x59902b[_0x64af('0x60')]=_0x2d3204['params']['id'];return _0x59902b;});var _0x47984d=[];return BPromise['each'](_0x971ac1,function(_0x236946){return db[_0x64af('0x62')][_0x64af('0x54')](_0x236946,{'include':[{'model':db[_0x64af('0x66')],'as':_0x64af('0x61')}],'raw':!![],'transaction':_0x4d4741})[_0x64af('0x2e')](function(_0x26d272){_0x47984d[_0x64af('0x67')](_0x26d272['get']({'plain':!![]}));});})[_0x64af('0x2e')](function(){return _0x47984d;});});});}})[_0x64af('0x2e')](function(_0x4de5fc){return _0x4de5fc;})[_0x64af('0x2e')](respondWithResult(_0x3a08f9,null))[_0x64af('0x4e')](handleError(_0x3a08f9,null));};exports[_0x64af('0x68')]=function(_0x45c4a9,_0x2aa790){var _0x1b4568;return db[_0x64af('0x39')][_0x64af('0x56')]({'where':{'id':_0x45c4a9[_0x64af('0x50')]['id']},'attributes':['id',_0x64af('0x31')]})['then'](handleEntityNotFound(_0x2aa790,null))['then'](function(_0x22876b){if(_0x22876b){_0x1b4568=_0x22876b;return db[_0x64af('0x62')][_0x64af('0x63')]({'where':{'userProfileId':_0x45c4a9[_0x64af('0x50')]['id'],'sectionId':_0x45c4a9['query'][_0x64af('0x69')]}});}})[_0x64af('0x2e')](function(){return _0x1b4568;})['then'](respondWithStatusCode(_0x2aa790,null))[_0x64af('0x4e')](handleError(_0x2aa790,null));};exports[_0x64af('0x6a')]=function(_0x223852,_0x462ee3){var _0x534ecf=[];var _0x281b3c=[];return db[_0x64af('0x62')][_0x64af('0x4c')]({'where':{'userProfileId':_0x223852['params']['id']},'raw':!![]})[_0x64af('0x2e')](function(_0x1d1615){_0x534ecf=_[_0x64af('0x48')](_0x1d1615,function(_0x107fe7){return _0x107fe7[_0x64af('0x6b')]===0x1||_[_0x64af('0x6c')]([0x3eb,0x709],_0x107fe7[_0x64af('0x5f')]);});if(!_['isEmpty'](_0x534ecf)){return _[_0x64af('0x3e')](_0x534ecf,function(_0x1a5d9d){return _0x1a5d9d[_0x64af('0x5f')];});}else{return;}})[_0x64af('0x2e')](function(_0x525819){if(_0x525819)_0x281b3c=_0x525819;if(_[_0x64af('0x6c')](_0x281b3c,0x64)){var _0x18de0a=_['find'](_0x534ecf,{'sectionId':0x64});return hasDefaultDashboard(_0x18de0a)[_0x64af('0x2e')](function(_0x3fc2df){return _[_0x64af('0x3e')](_0x534ecf,function(_0x34a9e5){if(_0x34a9e5[_0x64af('0x5f')]===0x64){_0x34a9e5['subsections']=_0x3fc2df;}return _0x34a9e5;});});}else{return;}})['then'](function(_0x3c86ed){if(_0x3c86ed)_0x534ecf=_0x3c86ed;if(_[_0x64af('0x6c')](_0x281b3c,0x3eb)){var _0x23a58b=_[_0x64af('0x56')](_0x534ecf,{'sectionId':0x3eb});return getCustomDashboards(_0x23a58b)[_0x64af('0x2e')](function(_0x4902b8){return _[_0x64af('0x3e')](_0x534ecf,function(_0x1512df){if(_0x23a58b['enabled']){if(_0x1512df[_0x64af('0x5f')]===0x3eb){_0x1512df['subsections']=_0x4902b8;}}else{if(_0x1512df[_0x64af('0x5f')]===0x64){_0x1512df['subsections']=_0x4902b8;}}return _0x1512df;});});}else{return;}})[_0x64af('0x2e')](function(_0xb10de7){if(_0xb10de7)_0x534ecf=_0xb10de7;if(_[_0x64af('0x6c')](_0x281b3c,0x709)){var _0x402b18=_['find'](_0x534ecf,{'sectionId':0x709});return getPlugins(_0x402b18)['then'](function(_0x2a8ca3){if(_0x402b18[_0x64af('0x6b')]){return _[_0x64af('0x3e')](_0x534ecf,function(_0x3cfd38){if(_0x3cfd38[_0x64af('0x5f')]===0x709){_0x3cfd38['subsections']=_0x2a8ca3;}return _0x3cfd38;});}else{var _0x357828={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2a8ca3};var _0x3450bd=_['map'](_0x534ecf);_0x3450bd[_0x64af('0x67')](_0x357828);return _0x3450bd;}});}else{return;}})[_0x64af('0x2e')](function(_0x47ebcf){if(_0x47ebcf)_0x534ecf=_0x47ebcf;return _[_0x64af('0x48')](_0x534ecf,['enabled',0x1]);})['then'](respondWithResult(_0x462ee3,null))[_0x64af('0x4e')](handleError(_0x462ee3,null));};function hasDefaultDashboard(_0x41879a){var _0x1b5160=[0x65];return new BPromise(function(_0x109a5f,_0x212536){try{if(_0x41879a[_0x64af('0x5e')]){_0x109a5f(_0x1b5160);}else{return db[_0x64af('0x66')][_0x64af('0x6d')]({'where':{'sectionId':_0x41879a['id']},'raw':!![]})[_0x64af('0x2e')](function(_0x24e6a8){_0x24e6a8?_0x109a5f(_0x1b5160):_0x109a5f();});}}catch(_0x11304a){_0x212536(_0x11304a);}});}function getCustomDashboards(_0x3fc4ec){var _0x24605d=[];return new BPromise(function(_0x2ad828,_0x2a3707){try{if(_0x3fc4ec[_0x64af('0x5e')]){return db[_0x64af('0x6e')][_0x64af('0x4c')]({'raw':!![]})[_0x64af('0x2e')](function(_0x286d6b){_0x286d6b['forEach'](function(_0x425cad){_0x24605d[_0x64af('0x67')](_0x425cad['id']+0x1869f);});_0x2ad828(_0x24605d);});}else{return db[_0x64af('0x66')][_0x64af('0x4c')]({'where':{'sectionId':_0x3fc4ec['id']},'raw':!![]})[_0x64af('0x2e')](function(_0x157248){_0x157248[_0x64af('0x6f')](function(_0x1685fa){_0x24605d[_0x64af('0x67')](_0x1685fa[_0x64af('0x70')]+0x1869f);});_0x2ad828(_0x24605d);});}}catch(_0xeff211){_0x2a3707(_0xeff211);}});}function getPlugins(_0x1467b2){var _0x5b82a9=[];return new BPromise(function(_0x20067e,_0x321a26){try{if(_0x1467b2['autoAssociation']){return db['Plugin'][_0x64af('0x4c')]({'raw':!![]})[_0x64af('0x2e')](function(_0x14a7e1){_0x14a7e1[_0x64af('0x6f')](function(_0x1e59d5){_0x5b82a9[_0x64af('0x67')](_0x1e59d5['id']+0x15b38);});_0x20067e(_0x5b82a9);});}else{return db['UserProfileResource'][_0x64af('0x4c')]({'where':{'sectionId':_0x1467b2['id']},'raw':!![]})['then'](function(_0xdb2a1a){_0xdb2a1a[_0x64af('0x6f')](function(_0x29656e){_0x5b82a9[_0x64af('0x67')](_0x29656e[_0x64af('0x70')]+0x15b38);});_0x20067e(_0x5b82a9);});}}catch(_0x91efba){_0x321a26(_0x91efba);}});}exports[_0x64af('0x71')]=function(_0x4c4034,_0x2c8af3){return db[_0x64af('0x39')][_0x64af('0x56')]({'where':{'id':_0x4c4034[_0x64af('0x50')]['id']}})['then'](handleEntityNotFound(_0x2c8af3,null))[_0x64af('0x2e')](function(_0x8e6327){if(_0x8e6327){return db[_0x64af('0x5c')][_0x64af('0x5d')](function(_0x110f0c){return db[_0x64af('0x62')]['findAll']({'where':{'userProfileId':_0x4c4034['params']['id']},'attributes':['id'],'raw':!![]})[_0x64af('0x2e')](function(_0x576e00){if(_0x576e00){return db[_0x64af('0x62')][_0x64af('0x63')]({'where':{'userProfileId':_0x4c4034[_0x64af('0x50')]['id'],'id':_[_0x64af('0x3e')](_0x576e00,function(_0x4af8a8){return _0x4af8a8['id'];})},'transaction':_0x110f0c});}})[_0x64af('0x2e')](function(_0x41747e){var _0x377015=_[_0x64af('0x3e')](_0x4c4034[_0x64af('0x34')],function(_0x34063f){_0x34063f[_0x64af('0x60')]=_0x4c4034[_0x64af('0x50')]['id'];return _0x34063f;});return db[_0x64af('0x62')][_0x64af('0x72')](_0x377015,{'raw':!![],'transaction':_0x110f0c});})[_0x64af('0x2e')](function(_0x4d82dd){var _0x3d0814=_[_0x64af('0x48')](_[_0x64af('0x3e')](_0x4d82dd,function(_0x39e9b8){return _0x39e9b8[_0x64af('0x57')]({'plain':!![]});}),{'includeAll':![]});if(_0x3d0814){return db[_0x64af('0x62')][_0x64af('0x4c')]({'where':{'userProfileId':_0x4c4034[_0x64af('0x50')]['id'],'sectionId':_[_0x64af('0x3e')](_0x3d0814,function(_0x1ac242){return _0x1ac242[_0x64af('0x5f')];})},'attributes':['id',_0x64af('0x5f')],'raw':!![]})['then'](function(_0x571a36){var _0x574707=_[_0x64af('0x3e')](_0x4c4034[_0x64af('0x34')],function(_0x587364){_0x587364[_0x64af('0x60')]=_0x4c4034['params']['id'];return _0x587364;});return db[_0x64af('0x66')][_0x64af('0x72')](_0x574707,{'raw':!![],'transaction':_0x110f0c});});}})[_0x64af('0x4e')](handleError(_0x2c8af3,null));});}})[_0x64af('0x2e')](function(_0x46eb44){var _0xf0d5e2=_[_0x64af('0x3e')](_0x46eb44,function(_0x37a2b3){return _0x37a2b3['get']({'plain':!![]});});})[_0x64af('0x2e')](respondWithResult(_0x2c8af3,null))[_0x64af('0x4e')](handleError(_0x2c8af3,null));};exports['removeResources']=function(_0x4bca64,_0x24b7ba,_0x393ab8){return db[_0x64af('0x39')][_0x64af('0x56')]({'where':{'id':_0x4bca64[_0x64af('0x50')]['id']}})[_0x64af('0x2e')](handleEntityNotFound(_0x24b7ba,null))['then'](function(_0x4f02b7){if(_0x4f02b7){return _0x4f02b7[_0x64af('0x73')](_0x4bca64[_0x64af('0x3f')][_0x64af('0x69')]);}})[_0x64af('0x2e')](respondWithStatusCode(_0x24b7ba,null))[_0x64af('0x4e')](handleError(_0x24b7ba,null));};exports['getResources']=function(_0x2458f5,_0x23faeb){var _0xf86961={'raw':![],'where':{}};var _0x2d2114={};var _0x21bfd9={'count':0x0,'rows':[]};var _0x583f0f=_0x2458f5[_0x64af('0x3f')][_0x64af('0x74')];if(typeof _0x583f0f==='undefined'){throw new db[(_0x64af('0x75'))]['ValidationError'](_0x64af('0x76'));}var _0x5e1f82=_0x2458f5['query'][_0x64af('0x77')]||![];var _0x1648ea=getQueryModels(_0x583f0f,_0x5e1f82);if(typeof _0x1648ea['childModel']===_0x64af('0x25')){throw new db[(_0x64af('0x75'))][(_0x64af('0x78'))](_0x64af('0x79')+_0x583f0f+'\x27');}var _0x5b4171=[];if(!_['isEmpty'](_0x1648ea[_0x64af('0x7a')])){_0x5b4171=_0x1648ea[_0x64af('0x7a')];}else{_0x5b4171=[{'name':_0x583f0f}];}return db[_0x64af('0x39')][_0x64af('0x6d')]({'where':{'id':_0x2458f5[_0x64af('0x50')]['id']}})[_0x64af('0x2e')](handleEntityNotFound(_0x23faeb,null))[_0x64af('0x2e')](function(_0x214c25){if(_0x214c25){var _0x49d125=[];for(var _0x2b07e9=0x0;_0x2b07e9<_0x5b4171[_0x64af('0x42')];_0x2b07e9++){_0x49d125[_0x64af('0x67')](db[_0x64af('0x62')]['findOne']({'where':{'userProfileId':_0x214c25['id'],'name':_0x5b4171[_0x2b07e9][_0x64af('0x31')]},'raw':!![]}));}return BPromise[_0x64af('0x7b')](_0x49d125);}})['then'](function(_0x57a459){var _0x516975=_[_0x64af('0x48')](_0x57a459,function(_0x550d6c){return _0x550d6c?_0x550d6c:undefined;});var _0x55fcbf=_['filter'](_0x5b4171,[_0x64af('0x7c'),!![]]);var _0x21d637=_[_0x64af('0x7d')](_0x516975)&&_[_0x64af('0x7d')](_0x55fcbf)?null:_['union'](_0x55fcbf,_0x516975);if(_0x21d637){var _0x581d5f=[];for(var _0x34c92c=0x0;_0x34c92c<_0x21d637['length'];_0x34c92c++){var _0xa9aca0=_[_0x64af('0x56')](_0x5b4171,function(_0x518359){return _0x21d637[_0x34c92c]?_0x518359[_0x64af('0x31')]===_0x21d637[_0x34c92c][_0x64af('0x31')]:null;});if(_0xa9aca0){if(_0x21d637[_0x34c92c][_0x64af('0x7c')]){_0x581d5f[_0x64af('0x67')](getAllResources(_0x1648ea[_0x64af('0x7e')],_0x21d637[_0x34c92c]));}else{if(!_0x21d637[_0x34c92c][_0x64af('0x5e')]){_0x581d5f[_0x64af('0x67')](getAllowedResources(_0xa9aca0,_0x21d637[_0x34c92c],_0x1648ea[_0x64af('0x7e')]));}else{if(_0xa9aca0['model']){_0x581d5f[_0x64af('0x67')](getAllFilteredResources(_0xa9aca0,_0x21d637[_0x34c92c]));}}}}}return BPromise['all'](_0x581d5f);}else{return null;}})['then'](function(_0x7f2187){var _0x25c242=_0x7f2187;var _0xcd04d8=null;if(_0x25c242){_0xcd04d8=_0x25c242[_0x64af('0x42')]===0x1?_0x25c242[0x0]:null;}if(_0xcd04d8||_0x25c242){var _0x51c54a=db[_0x1648ea[_0x64af('0x7e')]]['rawAttributes'];_0x2d2114['model']=_[_0x64af('0x51')](_0x51c54a);_0x2d2114[_0x64af('0x3f')]=_[_0x64af('0x51')](_0x2458f5['query']);_0x2d2114[_0x64af('0x47')]=_[_0x64af('0x52')](_0x2d2114['model'],_0x2d2114[_0x64af('0x3f')]);_0xf86961['attributes']=_[_0x64af('0x52')](_0x2d2114[_0x64af('0x3d')],qs[_0x64af('0x40')](_0x2458f5[_0x64af('0x3f')][_0x64af('0x40')]));_0xf86961[_0x64af('0x41')]=_0xf86961[_0x64af('0x41')][_0x64af('0x42')]?_0xf86961[_0x64af('0x41')]:_0x2d2114[_0x64af('0x3d')];if(!_0x2458f5[_0x64af('0x3f')][_0x64af('0x43')](_0x64af('0x7f'))){_0xf86961[_0x64af('0x26')]=qs['limit'](_0x2458f5[_0x64af('0x3f')][_0x64af('0x26')]);_0xf86961[_0x64af('0x24')]=qs['offset'](_0x2458f5['query'][_0x64af('0x24')]);}_0xf86961[_0x64af('0x44')]=qs[_0x64af('0x45')](_0x2458f5[_0x64af('0x3f')][_0x64af('0x45')]);_0xf86961['where']=qs[_0x64af('0x47')](_[_0x64af('0x80')](_0x2458f5[_0x64af('0x3f')],_0x2d2114[_0x64af('0x47')]));if(_0x2458f5[_0x64af('0x3f')][_0x64af('0x48')]){_0xf86961[_0x64af('0x46')]=_[_0x64af('0x33')](_0xf86961['where'],{'$or':_[_0x64af('0x3e')](_0x51c54a,function(_0x13ee5b){if(_0x13ee5b[_0x64af('0x3b')]['key']!==_0x64af('0x49')){var _0x7970d8={};_0x7970d8[_0x13ee5b[_0x64af('0x81')]]={'$like':'%'+_0x2458f5['query'][_0x64af('0x48')]+'%'};return _0x7970d8;}})});}var _0x443703=[];if(_0xcd04d8){var _0x2ad3f1=_[_0x64af('0x56')](_0x5b4171,['name',_0xcd04d8[_0x64af('0x31')]]);if(_0x2ad3f1[_0x64af('0x81')]){var _0x248715={};if(_0x1648ea[_0x64af('0x7e')]==='AnalyticExtractedReport'){_0x248715[_0x2ad3f1[_0x64af('0x82')]]=_[_0x64af('0x3e')](_0xcd04d8[_0x64af('0x83')],'id');}else{_0x248715[_0x2ad3f1[_0x64af('0x82')]]=_0xcd04d8['associatedResources'];}_0x443703[_0x64af('0x67')](_0x248715);}else{_0xf86961[_0x64af('0x46')]['id']=_0xcd04d8[_0x64af('0x83')];}}else{for(var _0x398fc9=0x0;_0x398fc9<_0x25c242['length'];_0x398fc9++){var _0x2ad3f1=_[_0x64af('0x56')](_0x5b4171,[_0x64af('0x31'),_0x25c242[_0x398fc9][_0x64af('0x31')]]);if(_0x2ad3f1[_0x64af('0x81')]){var _0x248715={};_0x248715[_0x2ad3f1[_0x64af('0x82')]]=_0x25c242[_0x398fc9][_0x64af('0x83')];_0x443703[_0x64af('0x67')](_0x248715);}else{if(!_0xf86961[_0x64af('0x46')]['id'])_0xf86961[_0x64af('0x46')]['id']=[];_0x25c242[_0x398fc9][_0x64af('0x83')][_0x64af('0x6f')](function(_0x129c91){_0xf86961[_0x64af('0x46')]['id']['push'](_0x129c91);});}}}if(!_[_0x64af('0x7d')](_0x443703)){_0xf86961[_0x64af('0x46')]=_[_0x64af('0x33')](_0xf86961[_0x64af('0x46')],{'$and':{'$or':_0x443703}});}_0xf86961=_[_0x64af('0x33')]({},_0xf86961,_0x2458f5['options']);if(_0xcd04d8&&!_0xcd04d8['autoAssociation']&&_0x1648ea['childModel']==='AnalyticExtractedReport'){if(_0x2458f5['query']['includeAll']){_0xf86961['include']=[{'all':!![]}];}return db[_0x1648ea['childModel']][_0x64af('0x4c')](_0xf86961)[_0x64af('0x2e')](function(_0x2b0435){var _0x180975=[];_0x2b0435[_0x64af('0x6f')](function(_0x58d6bc){var _0xc0e99f;switch(_0x58d6bc['reportType']){case _0x64af('0x84'):_0xc0e99f=_[_0x64af('0x56')](_0xcd04d8[_0x64af('0x83')],function(_0x2888c7){return _0x2888c7['id']===_0x58d6bc[_0x64af('0x85')]&&_0x2888c7['type']===_0x64af('0x86');});break;case _0x64af('0x87'):_0xc0e99f=_[_0x64af('0x56')](_0xcd04d8['associatedResources'],function(_0x1c348c){return _0x1c348c['id']===_0x58d6bc[_0x64af('0x85')]&&_0x1c348c[_0x64af('0x3b')]===_0x64af('0x88');});break;}if(_0xc0e99f)_0x180975[_0x64af('0x67')](_0x58d6bc);});_0x21bfd9[_0x64af('0x27')]=_0x180975[_0x64af('0x42')];_0x21bfd9[_0x64af('0x4d')]=_0x180975;return _0x21bfd9;});}else{return db[_0x1648ea[_0x64af('0x7e')]][_0x64af('0x27')]({'where':_0xf86961[_0x64af('0x46')]})[_0x64af('0x2e')](function(_0x1a7741){_0x21bfd9[_0x64af('0x27')]=_0x1a7741;if(_0x2458f5[_0x64af('0x3f')][_0x64af('0x4a')]){if(_0x1648ea[_0x64af('0x7e')]===_0x64af('0x89')){_0xf86961[_0x64af('0x4b')]=[{'model':db[_0x64af('0x8a')],'as':_0x64af('0x8b'),'attributes':['id',_0x64af('0x31'),_0x64af('0x8c')],'required':_0x2458f5[_0x64af('0x3f')]['tag']?!![]:![]},{'model':db[_0x64af('0x8a')],'as':_0x64af('0x8d'),'attributes':['id',_0x64af('0x31'),_0x64af('0x8c')],'through':_0x2458f5[_0x64af('0x3f')][_0x64af('0x8e')]?{'attributes':[],'where':{'TagId':_0x2458f5[_0x64af('0x3f')][_0x64af('0x8e')]||undefined}}:{},'required':_0x2458f5[_0x64af('0x3f')][_0x64af('0x8e')]?!![]:![]}];}else{_0xf86961[_0x64af('0x4b')]=[{'all':!![]}];}}return db[_0x1648ea[_0x64af('0x7e')]][_0x64af('0x4c')](_0xf86961);})[_0x64af('0x2e')](function(_0x3127f1){_0x21bfd9[_0x64af('0x4d')]=_0x3127f1;if(_0x583f0f===_0x64af('0x8f')&&_0x2458f5[_0x64af('0x3f')][_0x64af('0x90')]===_0x64af('0x91')){var _0x5c3422=[];for(var _0x5edfb6=0x0;_0x5edfb6<_0x21bfd9['rows']['length'];_0x5edfb6++){_0x5c3422[_0x64af('0x67')](getOpenTabs(_0x64af('0x92'),_0x21bfd9[_0x64af('0x4d')][_0x5edfb6][_0x64af('0x93')]));_0x5c3422[_0x64af('0x67')](getOpenTabs(_0x64af('0x94'),_0x21bfd9[_0x64af('0x4d')][_0x5edfb6][_0x64af('0x93')]));_0x5c3422[_0x64af('0x67')](getOpenTabs('fax',_0x21bfd9[_0x64af('0x4d')][_0x5edfb6][_0x64af('0x93')]));_0x5c3422[_0x64af('0x67')](getOpenTabs('mail',_0x21bfd9[_0x64af('0x4d')][_0x5edfb6][_0x64af('0x93')]));_0x5c3422['push'](getOpenTabs(_0x64af('0x95'),_0x21bfd9[_0x64af('0x4d')][_0x5edfb6]['dataValues']));_0x5c3422[_0x64af('0x67')](getOpenTabs(_0x64af('0x96'),_0x21bfd9['rows'][_0x5edfb6][_0x64af('0x93')]));}return Promise[_0x64af('0x7b')](_0x5c3422)['then'](function(){return _0x21bfd9;});}return _0x21bfd9;});}}else{return _0x21bfd9;}})['then'](respondWithFilteredResult(_0x23faeb,_0xf86961))[_0x64af('0x4e')](handleError(_0x23faeb,null));};function getOpenTabs(_0x50fe1d,_0x8ba50){var _0x22424a=_0x50fe1d[_0x64af('0x97')](0x0)[_0x64af('0x98')]()+_0x50fe1d[_0x64af('0x99')](0x1);var _0x7a0a98={'type':db[_0x64af('0x75')]['QueryTypes']['SELECT'],'raw':!![]};return new BPromise(function(_0x3fd685,_0x5da6ba){var _0x45c434=squel[_0x64af('0x9a')]()[_0x64af('0x81')](_0x64af('0x9b')+_0x22424a+'InteractionId','id')[_0x64af('0x81')](_0x64af('0x9c'))['from'](_0x64af('0x9d')+_0x50fe1d+'_interactions','ui')[_0x64af('0x46')](_0x64af('0x9e'),_0x8ba50['id']);return db[_0x64af('0x5c')][_0x64af('0x3f')](_0x45c434['toString'](),_0x7a0a98)['then'](function(_0x7b6d6e){_0x8ba50[_0x22424a+_0x64af('0x9f')]=_0x7b6d6e;_0x3fd685(_0x7b6d6e);})[_0x64af('0x4e')](function(_0x45be94){_0x5da6ba(_0x45be94);});});}function getAllResources(_0x29d231,_0x543fb5){return new BPromise(function(_0x22477a,_0x248e09){if(_0x543fb5){var _0x5245b=_0x543fb5[_0x64af('0x48')]?{[_0x543fb5[_0x64af('0x48')][_0x64af('0x81')]]:_0x543fb5[_0x64af('0x48')][_0x64af('0xa0')]}:undefined;return db[_0x29d231][_0x64af('0x4c')]({'where':_0x5245b,'raw':!![]})[_0x64af('0x2e')](function(_0x317cd3){_0x543fb5['associatedResources']=_[_0x64af('0x3e')](_0x317cd3,'id');_0x22477a(_0x543fb5);})[_0x64af('0x4e')](function(_0x2063c1){_0x248e09(_0x2063c1);});}else{_0x22477a(null);}});}function getAllFilteredResources(_0x2c8ecb,_0x55ade3){return new BPromise(function(_0x38ec67,_0x40bd1a){var _0x47d8ea=_0x2c8ecb[_0x64af('0x48')]?{[_0x2c8ecb[_0x64af('0x48')][_0x64af('0x81')]]:_0x2c8ecb[_0x64af('0x48')][_0x64af('0xa0')]}:undefined;return db[_0x2c8ecb[_0x64af('0x3d')]][_0x64af('0x4c')]({'where':_0x47d8ea,'raw':!![]})[_0x64af('0x2e')](function(_0x58ad6e){_0x55ade3[_0x64af('0x83')]=_[_0x64af('0x3e')](_0x58ad6e,function(_0xd0dc76){return _0x2c8ecb['field']?_0xd0dc76[_0x2c8ecb[_0x64af('0x81')]]:_0xd0dc76[_0x64af('0x31')];});_0x38ec67(_0x55ade3);})[_0x64af('0x4e')](function(_0x3a222d){_0x40bd1a(_0x3a222d);});});}function getAllowedResources(_0x25a09e,_0x4097f3,_0x29340f){return new BPromise(function(_0x3583f2,_0xadb860){if(_0x4097f3){return db[_0x64af('0x66')][_0x64af('0x4c')]({'where':{'sectionId':_0x4097f3['id']},'raw':!![]})[_0x64af('0x2e')](function(_0x2e91df){if(_0x25a09e[_0x64af('0x81')]&&_0x25a09e['field']!=='id'){_0x4097f3[_0x64af('0x83')]=_[_0x64af('0x3e')](_0x2e91df,function(_0x48284e){return _0x48284e[_0x25a09e[_0x64af('0x81')]];});}else{if(_0x29340f==='AnalyticExtractedReport'){_0x4097f3[_0x64af('0x83')]=_[_0x64af('0x3e')](_0x2e91df,function(_0x51dffa){return{'id':_0x51dffa[_0x64af('0x70')],'type':_0x51dffa[_0x64af('0x3b')]};});}else{_0x4097f3[_0x64af('0x83')]=_[_0x64af('0x3e')](_0x2e91df,function(_0x55d0bc){return _0x55d0bc[_0x64af('0x70')];});}}_0x3583f2(_0x4097f3);})[_0x64af('0x4e')](function(_0x583c1b){_0xadb860(_0x583c1b);});}else{_0x3583f2(null);}});}function getQueryModels(_0x205e43,_0x265ee7){var _0x9a2a08=_0x205e43[_0x64af('0xa1')]();var _0x5f82a3={'childModel':undefined,'parentSections':[]};switch(_0x9a2a08){case'squareprojects':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xa2');break;case _0x64af('0xa3'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xa4');break;case _0x64af('0xa5'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xa6');_0x5f82a3[_0x64af('0x7a')]=[{'name':_0x64af('0xa7'),'field':_0x64af('0x31'),'foreignKey':_0x64af('0xa8')}];break;case _0x64af('0xa9'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xaa');break;case _0x64af('0xab'):_0x5f82a3['childModel']=_0x64af('0x89');_0x5f82a3['parentSections']=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x64af('0xac'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xad');break;case _0x64af('0xae'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xaf');break;case'globalcustomfields':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xb0');break;case _0x64af('0xb1'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xb2');break;case _0x64af('0xb3'):_0x5f82a3[_0x64af('0x7e')]='ChatWebsite';break;case _0x64af('0xb4'):_0x5f82a3[_0x64af('0x7e')]='FaxQueue';break;case _0x64af('0xb5'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xb6');break;case _0x64af('0xb7'):case _0x64af('0xb8'):case _0x64af('0xb9'):_0x5f82a3['childModel']=_0x64af('0xba');break;case'contexts':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xbb');break;case _0x64af('0xbc'):_0x5f82a3['childModel']=_0x64af('0xbd');break;case _0x64af('0xbe'):_0x5f82a3[_0x64af('0x7e')]='VoiceRecording';_0x5f82a3[_0x64af('0x7a')]=[{'name':_0x64af('0x8f'),'field':'name','foreignKey':_0x64af('0xbf'),'model':_0x64af('0xc0'),'filter':{'field':_0x64af('0xc1'),'value':['agent']}},{'name':_0x64af('0xc2'),'field':'name','foreignKey':_0x64af('0xbf'),'model':_0x64af('0xc0'),'filter':{'field':_0x64af('0xc1'),'value':[_0x64af('0xc3')]}},{'name':_0x64af('0xc4'),'field':_0x64af('0x31'),'foreignKey':_0x64af('0xc5'),'model':_0x64af('0xc6'),'filter':{'field':_0x64af('0x3b'),'value':['inbound']}},{'name':_0x64af('0xc7'),'field':_0x64af('0x31'),'foreignKey':'queue','model':_0x64af('0xc6'),'filter':{'field':_0x64af('0x3b'),'value':[_0x64af('0xc8')]}}];break;case'musiconholds':_0x5f82a3['childModel']='VoiceMusicOnHold';break;case _0x64af('0xc9'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xca');break;case _0x64af('0xcb'):_0x5f82a3['childModel']=_0x64af('0xcc');break;case'ivrcampaigns':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xcd');break;case _0x64af('0xce'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xcf');break;case _0x64af('0xd0'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xd1');break;case _0x64af('0xd2'):_0x5f82a3[_0x64af('0x7e')]='MailSubstatus';break;case _0x64af('0xd3'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xd4');break;case _0x64af('0xd5'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xd6');break;case _0x64af('0xd7'):_0x5f82a3['childModel']=_0x64af('0xd8');break;case'smsaccounts':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xd9');break;case'whatsappqueues':_0x5f82a3['childModel']='WhatsappQueue';break;case _0x64af('0xda'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xdb');break;case'voicequeues':case'queuecampaigns':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xc6');if(_0x265ee7){_0x5f82a3[_0x64af('0x7a')]=[{'name':_0x64af('0xc4')},{'name':_0x64af('0xc7')}];}break;case'users':case _0x64af('0xdc'):case _0x64af('0xdd'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xc0');if(_0x265ee7){_0x5f82a3[_0x64af('0x7a')]=[{'name':_0x64af('0xde'),'filter':{'field':_0x64af('0xc1'),'value':[_0x64af('0xdf'),_0x64af('0xe0')]},'ignore':!![]},{'name':_0x64af('0x8f')},{'name':_0x64af('0xc2')}];}break;case _0x64af('0xe1'):_0x5f82a3['childModel']=_0x64af('0xe2');break;case _0x64af('0xe3'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xe4');break;case _0x64af('0xe5'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xe6');break;case'sugarcrmaccounts':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xe7');break;case _0x64af('0xe8'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xe9');break;case _0x64af('0xea'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xeb');break;case _0x64af('0xec'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xc0');break;case _0x64af('0xed'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xee');break;case _0x64af('0xef'):_0x5f82a3['childModel']=_0x64af('0xf0');break;case _0x64af('0xf1'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0x6e');break;case'intervals':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xf2');break;case _0x64af('0xf3'):_0x5f82a3['childModel']=_0x64af('0xf4');break;case _0x64af('0xf5'):_0x5f82a3['childModel']=_0x64af('0xf6');break;case _0x64af('0xf7'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xf8');break;case _0x64af('0xf9'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0x8a');break;case'templates':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xfa');break;case _0x64af('0xfb'):_0x5f82a3[_0x64af('0x7e')]='Trigger';break;case _0x64af('0xfc'):_0x5f82a3['childModel']=_0x64af('0xfd');break;case _0x64af('0xfe'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xff');break;case _0x64af('0x100'):_0x5f82a3['childModel']=_0x64af('0x101');break;case'extractedreports':_0x5f82a3[_0x64af('0x7e')]='AnalyticExtractedReport';_0x5f82a3[_0x64af('0x7a')]=[{'name':_0x64af('0x102'),'field':'id','foreignKey':_0x64af('0x85')}];break;case _0x64af('0x103'):_0x5f82a3['childModel']=_0x64af('0x104');break;case'whatsappaccounts':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0x105');break;case _0x64af('0x106'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0x107');_0x5f82a3[_0x64af('0x7a')]=[{'name':_0x64af('0x8f'),'field':'id','foreignKey':_0x64af('0x108'),'model':_0x64af('0xc0'),'filter':{'field':_0x64af('0xc1'),'value':['agent']}},{'name':'Telephones','field':'id','foreignKey':_0x64af('0x108'),'model':_0x64af('0xc0'),'filter':{'field':_0x64af('0xc1'),'value':[_0x64af('0xc3')]}}];break;default:return _0x5f82a3;}return _0x5f82a3;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index ecb8916..e5272b4 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 _0x969f=['events','UserProfile','setMaxListeners','save','emit','exports'];(function(_0x32ff1d,_0x3e29bb){var _0x50489e=function(_0x588ff3){while(--_0x588ff3){_0x32ff1d['push'](_0x32ff1d['shift']());}};_0x50489e(++_0x3e29bb);}(_0x969f,0x174));var _0xf969=function(_0xeb67d8,_0x14a337){_0xeb67d8=_0xeb67d8-0x0;var _0x4138f9=_0x969f[_0xeb67d8];return _0x4138f9;};'use strict';var EventEmitter=require(_0xf969('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xf969('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf969('0x2')](0x0);var events={'afterCreate':_0xf969('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1de37e){return function(_0x530642,_0x20f29a,_0x58b798){UserProfileEvents[_0xf969('0x4')](_0x1de37e+':'+_0x530642['id'],_0x530642);UserProfileEvents[_0xf969('0x4')](_0x1de37e,_0x530642);_0x58b798(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xf969('0x5')]=UserProfileEvents; \ No newline at end of file +var _0x2649=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x2c2e26,_0x44119c){var _0xe089fd=function(_0x29d518){while(--_0x29d518){_0x2c2e26['push'](_0x2c2e26['shift']());}};_0xe089fd(++_0x44119c);}(_0x2649,0x8d));var _0x9264=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x2649[_0x263a74];return _0x2aa86c;};'use strict';var EventEmitter=require(_0x9264('0x0'));var UserProfile=require(_0x9264('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x9264('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9264('0x3')};function emitEvent(_0x8f778){return function(_0xb68c0e,_0x2198fc,_0x55b31b){UserProfileEvents[_0x9264('0x4')](_0x8f778+':'+_0xb68c0e['id'],_0xb68c0e);UserProfileEvents['emit'](_0x8f778,_0xb68c0e);_0x55b31b(null);};}for(var e in events){if(events[_0x9264('0x5')](e)){var event=events[e];UserProfile[_0x9264('0x6')](e,emitEvent(event));}}module[_0x9264('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index f460e92..0bbe359 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 _0x8e44=['request-promise','path','rimraf','./userProfile.attributes','exports','UserProfile','user_profiles','models','User','update','then','catch','lodash','util','../../config/logger','bluebird'];(function(_0x272d0c,_0x3234a1){var _0x3627d3=function(_0x9753af){while(--_0x9753af){_0x272d0c['push'](_0x272d0c['shift']());}};_0x3627d3(++_0x3234a1);}(_0x8e44,0x1ac));var _0x48e4=function(_0x23ee4f,_0x173100){_0x23ee4f=_0x23ee4f-0x0;var _0x4fb419=_0x8e44[_0x23ee4f];return _0x4fb419;};'use strict';var _=require(_0x48e4('0x0'));var util=require(_0x48e4('0x1'));var logger=require(_0x48e4('0x2'))('api');var moment=require('moment');var BPromise=require(_0x48e4('0x3'));var rp=require(_0x48e4('0x4'));var fs=require('fs');var path=require(_0x48e4('0x5'));var rimraf=require(_0x48e4('0x6'));var config=require('../../config/environment');var attributes=require(_0x48e4('0x7'));module[_0x48e4('0x8')]=function(_0x27d37f,_0x4dffab){return _0x27d37f['define'](_0x48e4('0x9'),attributes,{'tableName':_0x48e4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x552cb1,_0x1ae7a7,_0x1727fc){var _0x8849db=_0x27d37f[_0x48e4('0xb')];_0x8849db[_0x48e4('0xc')][_0x48e4('0xd')]({'privacyEnabled':_0x552cb1['privacyEnabled']},{'where':{'UserProfileId':_0x552cb1['id']}})[_0x48e4('0xe')](function(){_0x1727fc();})[_0x48e4('0xf')](function(_0x3cb6ef){_0x1727fc(_0x3cb6ef);});}}});}; \ No newline at end of file +var _0xc224=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfile.attributes','exports','UserProfile','user_profiles','models','update','privacyEnabled','lodash'];(function(_0xd46333,_0x1b05c1){var _0x336108=function(_0x4a39ad){while(--_0x4a39ad){_0xd46333['push'](_0xd46333['shift']());}};_0x336108(++_0x1b05c1);}(_0xc224,0x1af));var _0x4c22=function(_0x3c35d0,_0x20aac1){_0x3c35d0=_0x3c35d0-0x0;var _0x39c194=_0xc224[_0x3c35d0];return _0x39c194;};'use strict';var _=require(_0x4c22('0x0'));var util=require(_0x4c22('0x1'));var logger=require(_0x4c22('0x2'))('api');var moment=require(_0x4c22('0x3'));var BPromise=require(_0x4c22('0x4'));var rp=require(_0x4c22('0x5'));var fs=require('fs');var path=require(_0x4c22('0x6'));var rimraf=require(_0x4c22('0x7'));var config=require(_0x4c22('0x8'));var attributes=require(_0x4c22('0x9'));module[_0x4c22('0xa')]=function(_0x576de1,_0x5d036f){return _0x576de1['define'](_0x4c22('0xb'),attributes,{'tableName':_0x4c22('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x45397c,_0x309dad,_0x2d1508){var _0x3f0626=_0x576de1[_0x4c22('0xd')];_0x3f0626['User'][_0x4c22('0xe')]({'privacyEnabled':_0x45397c[_0x4c22('0xf')]},{'where':{'UserProfileId':_0x45397c['id']}})['then'](function(){_0x2d1508();})['catch'](function(_0x2e1c02){_0x2d1508(_0x2e1c02);});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 89fcfdf..ec8169b 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 _0xf494=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','request\x20sent','debug','stringify','error','code','UserProfile,\x20%s,\x20%s','message','info','lodash','util','moment','randomstring','ioredis'];(function(_0x4018d0,_0x10df66){var _0x229c58=function(_0x35a8de){while(--_0x35a8de){_0x4018d0['push'](_0x4018d0['shift']());}};_0x229c58(++_0x10df66);}(_0xf494,0x1c6));var _0x4f49=function(_0x25e603,_0x56f117){_0x25e603=_0x25e603-0x0;var _0x301b74=_0xf494[_0x25e603];return _0x301b74;};'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});config[_0x4f49('0xd')]=_['defaults'](config['redis'],{'host':_0x4f49('0xe'),'port':0x18eb});var socket=require(_0x4f49('0xf'))(new Redis(config[_0x4f49('0xd')]));require(_0x4f49('0x10'))[_0x4f49('0x11')](socket);function respondWithRpcPromise(_0x174d0d,_0x151d8c,_0x410884){return new BPromise(function(_0x53ee74,_0x3e464f){return client[_0x4f49('0x12')](_0x174d0d,_0x410884)['then'](function(_0x15e7a1){logger['info']('UserProfile,\x20%s,\x20%s',_0x151d8c,_0x4f49('0x13'));logger[_0x4f49('0x14')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x151d8c,_0x4f49('0x13'),JSON[_0x4f49('0x15')](_0x15e7a1));if(_0x15e7a1[_0x4f49('0x16')]){if(_0x15e7a1[_0x4f49('0x16')][_0x4f49('0x17')]===0x1f4){logger[_0x4f49('0x16')](_0x4f49('0x18'),_0x151d8c,_0x15e7a1['error'][_0x4f49('0x19')]);return _0x3e464f(_0x15e7a1[_0x4f49('0x16')][_0x4f49('0x19')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x151d8c,_0x15e7a1[_0x4f49('0x16')][_0x4f49('0x19')]);return _0x53ee74(_0x15e7a1[_0x4f49('0x16')]['message']);}else{logger[_0x4f49('0x1a')](_0x4f49('0x18'),_0x151d8c,_0x4f49('0x13'));_0x53ee74(_0x15e7a1['result']['message']);}})['catch'](function(_0x47f1e8){logger[_0x4f49('0x16')](_0x4f49('0x18'),_0x151d8c,_0x47f1e8);_0x3e464f(_0x47f1e8);});});} \ No newline at end of file +var _0xd8fb=['http','defaults','localhost','socket.io-emitter','register','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5b4a83,_0x4da2e2){var _0x55c65d=function(_0x462815){while(--_0x462815){_0x5b4a83['push'](_0x5b4a83['shift']());}};_0x55c65d(++_0x4da2e2);}(_0xd8fb,0x99));var _0xbd8f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd8fb[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require(_0xbd8f('0x2'));var BPromise=require(_0xbd8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd8f('0x4'));var logger=require(_0xbd8f('0x5'))('rpc');var config=require(_0xbd8f('0x6'));var jayson=require(_0xbd8f('0x7'));var client=jayson['client'][_0xbd8f('0x8')]({'port':0x232a});config['redis']=_[_0xbd8f('0x9')](config['redis'],{'host':_0xbd8f('0xa'),'port':0x18eb});var socket=require(_0xbd8f('0xb'))(new Redis(config['redis']));require('./userProfile.socket')[_0xbd8f('0xc')](socket);function respondWithRpcPromise(_0x2393a9,_0x2a55b5,_0x53a2c6){return new BPromise(function(_0x255af3,_0x42ae20){return client['request'](_0x2393a9,_0x53a2c6)['then'](function(_0x342bcb){logger[_0xbd8f('0xd')](_0xbd8f('0xe'),_0x2a55b5,'request\x20sent');logger[_0xbd8f('0xf')](_0xbd8f('0x10'),_0x2a55b5,_0xbd8f('0x11'),JSON[_0xbd8f('0x12')](_0x342bcb));if(_0x342bcb[_0xbd8f('0x13')]){if(_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x14')]===0x1f4){logger[_0xbd8f('0x13')](_0xbd8f('0xe'),_0x2a55b5,_0x342bcb['error'][_0xbd8f('0x15')]);return _0x42ae20(_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x15')]);}logger[_0xbd8f('0x13')]('UserProfile,\x20%s,\x20%s',_0x2a55b5,_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x15')]);return _0x255af3(_0x342bcb['error'][_0xbd8f('0x15')]);}else{logger[_0xbd8f('0xd')]('UserProfile,\x20%s,\x20%s',_0x2a55b5,_0xbd8f('0x11'));_0x255af3(_0x342bcb[_0xbd8f('0x16')]['message']);}})['catch'](function(_0x33f77c){logger['error']('UserProfile,\x20%s,\x20%s',_0x2a55b5,_0x33f77c);_0x42ae20(_0x33f77c);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 50d9609..3ef4680 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 _0x1840=['length','./userProfile.events','update','emit','removeListener','register'];(function(_0x60b3b8,_0x523d07){var _0x497cf1=function(_0x44ce46){while(--_0x44ce46){_0x60b3b8['push'](_0x60b3b8['shift']());}};_0x497cf1(++_0x523d07);}(_0x1840,0x14b));var _0x0184=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x1840[_0x209941];return _0x1e8729;};'use strict';var UserProfileEvents=require(_0x0184('0x0'));var events=['save','remove',_0x0184('0x1')];function createListener(_0x5a88d7,_0x56561f){return function(_0x2f1e17){_0x56561f[_0x0184('0x2')](_0x5a88d7,_0x2f1e17);};}function removeListener(_0x3b36ea,_0x38ab73){return function(){UserProfileEvents[_0x0184('0x3')](_0x3b36ea,_0x38ab73);};}exports[_0x0184('0x4')]=function(_0x1ef8f1){for(var _0x5d12bc=0x0,_0x3076ac=events[_0x0184('0x5')];_0x5d12bc<_0x3076ac;_0x5d12bc++){var _0x257d18=events[_0x5d12bc];var _0x29fa42=createListener('userProfile:'+_0x257d18,_0x1ef8f1);UserProfileEvents['on'](_0x257d18,_0x29fa42);}}; \ No newline at end of file +var _0xa124=['save','emit','removeListener','register','length','userProfile:'];(function(_0x5ac19e,_0x34493f){var _0x1d22c2=function(_0x2ce94a){while(--_0x2ce94a){_0x5ac19e['push'](_0x5ac19e['shift']());}};_0x1d22c2(++_0x34493f);}(_0xa124,0xfc));var _0x4a12=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xa124[_0x487b0c];return _0x1adbdc;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x4a12('0x0'),'remove','update'];function createListener(_0x4991db,_0x415518){return function(_0xe81c7f){_0x415518[_0x4a12('0x1')](_0x4991db,_0xe81c7f);};}function removeListener(_0x340354,_0x439c28){return function(){UserProfileEvents[_0x4a12('0x2')](_0x340354,_0x439c28);};}exports[_0x4a12('0x3')]=function(_0x5a3624){for(var _0xf09595=0x0,_0x52bc51=events[_0x4a12('0x4')];_0xf09595<_0x52bc51;_0xf09595++){var _0x36b63a=events[_0xf09595];var _0x4a9857=createListener(_0x4a12('0x5')+_0x36b63a,_0x5a3624);UserProfileEvents['on'](_0x36b63a,_0x4a9857);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 7599e53..33dae03 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 _0xb9af=['put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x582322,_0x5b0e5d){var _0x49404b=function(_0x26922f){while(--_0x26922f){_0x582322['push'](_0x582322['shift']());}};_0x49404b(++_0x5b0e5d);}(_0xb9af,0x1b8));var _0xfb9a=function(_0x24244b,_0x15bf86){_0x24244b=_0x24244b-0x0;var _0x44073f=_0xb9af[_0x24244b];return _0x44073f;};'use strict';var multer=require(_0xfb9a('0x0'));var util=require(_0xfb9a('0x1'));var path=require(_0xfb9a('0x2'));var timeout=require(_0xfb9a('0x3'));var express=require(_0xfb9a('0x4'));var router=express[_0xfb9a('0x5')]();var fs_extra=require(_0xfb9a('0x6'));var auth=require(_0xfb9a('0x7'));var interaction=require(_0xfb9a('0x8'));var config=require(_0xfb9a('0x9'));var controller=require(_0xfb9a('0xa'));router[_0xfb9a('0xb')]('/',auth[_0xfb9a('0xc')](),controller['index']);router[_0xfb9a('0xb')](_0xfb9a('0xd'),auth[_0xfb9a('0xc')](),controller[_0xfb9a('0xe')]);router[_0xfb9a('0xb')](_0xfb9a('0xf'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xfb9a('0x10')](_0xfb9a('0xf'),auth[_0xfb9a('0xc')](),controller['update']);router['delete'](_0xfb9a('0xf'),auth[_0xfb9a('0xc')](),controller[_0xfb9a('0x11')]);module[_0xfb9a('0x12')]=router; \ No newline at end of file +var _0x656a=['exports','multer','util','path','connect-timeout','express','Router','../../config/environment','isAuthenticated','index','/describe','describe','get','show','put','/:id','update','delete','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x656a,0x1b6));var _0xa656=function(_0x1937c8,_0x5a1f28){_0x1937c8=_0x1937c8-0x0;var _0x48bedf=_0x656a[_0x1937c8];return _0x48bedf;};'use strict';var multer=require(_0xa656('0x0'));var util=require(_0xa656('0x1'));var path=require(_0xa656('0x2'));var timeout=require(_0xa656('0x3'));var express=require(_0xa656('0x4'));var router=express[_0xa656('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa656('0x6'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0xa656('0x7')](),controller[_0xa656('0x8')]);router['get'](_0xa656('0x9'),auth[_0xa656('0x7')](),controller[_0xa656('0xa')]);router[_0xa656('0xb')]('/:id',auth[_0xa656('0x7')](),controller[_0xa656('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa656('0xd')](_0xa656('0xe'),auth[_0xa656('0x7')](),controller[_0xa656('0xf')]);router[_0xa656('0x10')](_0xa656('0xe'),auth[_0xa656('0x7')](),controller[_0xa656('0x11')]);module[_0xa656('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 100e826..dd17db5 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 _0xf2db=['INTEGER','sequelize'];(function(_0x5164d1,_0xd7e34f){var _0x3ca1e0=function(_0x273023){while(--_0x273023){_0x5164d1['push'](_0x5164d1['shift']());}};_0x3ca1e0(++_0xd7e34f);}(_0xf2db,0x9f));var _0xbf2d=function(_0x1be0b9,_0x5af100){_0x1be0b9=_0x1be0b9-0x0;var _0x50af2f=_0xf2db[_0x1be0b9];return _0x50af2f;};'use strict';var Sequelize=require(_0xbf2d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xbf2d('0x1')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x0647=['sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0647,0x198));var _0x7064=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x0647[_0x246148];return _0x453d94;};'use strict';var Sequelize=require(_0x7064('0x0'));module[_0x7064('0x1')]={'name':{'type':Sequelize[_0x7064('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x7064('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index f241b30..ab0f4fb 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 _0xbb6d=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','render','body','contact','agent','index','map','UserProfileResource','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','keys','options','find','create','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse'];(function(_0x3239f5,_0x50e77c){var _0x3559c8=function(_0x4f9f83){while(--_0x4f9f83){_0x3239f5['push'](_0x3239f5['shift']());}};_0x3559c8(++_0x50e77c);}(_0xbb6d,0x168));var _0xdbb6=function(_0x1052d7,_0x3aceb7){_0x1052d7=_0x1052d7-0x0;var _0x17fe91=_0xbb6d[_0x1052d7];return _0x17fe91;};'use strict';var emlformat=require(_0xdbb6('0x0'));var rimraf=require(_0xdbb6('0x1'));var zipdir=require(_0xdbb6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbb6('0x3'));var moment=require(_0xdbb6('0x4'));var BPromise=require(_0xdbb6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdbb6('0x6'));var sox=require('sox');var csv=require(_0xdbb6('0x7'));var ejs=require(_0xdbb6('0x8'));var fs=require('fs');var fs_extra=require(_0xdbb6('0x9'));var _=require(_0xdbb6('0xa'));var squel=require(_0xdbb6('0xb'));var crypto=require('crypto');var jsforce=require(_0xdbb6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdbb6('0x7'));var querystring=require(_0xdbb6('0xd'));var Papa=require(_0xdbb6('0xe'));var Redis=require(_0xdbb6('0xf'));var authService=require(_0xdbb6('0x10'));var qs=require(_0xdbb6('0x11'));var as=require(_0xdbb6('0x12'));var hardwareService=require(_0xdbb6('0x13'));var logger=require(_0xdbb6('0x14'))(_0xdbb6('0x15'));var utils=require('../../config/utils');var config=require(_0xdbb6('0x16'));var licenseUtil=require(_0xdbb6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22e8d0,_0x3927f6){_0x3927f6=_0x3927f6||0xcc;return function(_0x1ad2d9){if(_0x1ad2d9){return _0x22e8d0[_0xdbb6('0x18')](_0x3927f6);}return _0x22e8d0[_0xdbb6('0x19')](_0x3927f6)[_0xdbb6('0x1a')]();};}function respondWithResult(_0x3b5167,_0x1dd2e5){_0x1dd2e5=_0x1dd2e5||0xc8;return function(_0x295b97){if(_0x295b97){return _0x3b5167[_0xdbb6('0x19')](_0x1dd2e5)['json'](_0x295b97);}};}function respondWithFilteredResult(_0x56d2ba,_0x4d4cde){return function(_0x18f504){if(_0x18f504){var _0x25c0b8=typeof _0x4d4cde[_0xdbb6('0x1b')]===_0xdbb6('0x1c')&&typeof _0x4d4cde[_0xdbb6('0x1d')]===_0xdbb6('0x1c');var _0x25e97d=_0x18f504[_0xdbb6('0x1e')];var _0xc051af=_0x25c0b8?0x0:_0x4d4cde[_0xdbb6('0x1b')];var _0x46f319=_0x25c0b8?_0x18f504[_0xdbb6('0x1e')]:_0x4d4cde[_0xdbb6('0x1b')]+_0x4d4cde[_0xdbb6('0x1d')];var _0x42626f;if(_0x46f319>=_0x25e97d){_0x46f319=_0x25e97d;_0x42626f=0xc8;}else{_0x42626f=0xce;}_0x56d2ba[_0xdbb6('0x19')](_0x42626f);return _0x56d2ba[_0xdbb6('0x1f')](_0xdbb6('0x20'),_0xc051af+'-'+_0x46f319+'/'+_0x25e97d)['json'](_0x18f504);}return null;};}function patchUpdates(_0x157aee){return function(_0x51f73b){try{jsonpatch['apply'](_0x51f73b,_0x157aee,!![]);}catch(_0x2518f8){return BPromise[_0xdbb6('0x21')](_0x2518f8);}return _0x51f73b['save']();};}function saveUpdates(_0x26aaf5,_0x4fa6dc){return function(_0x6dbf3e){if(_0x6dbf3e){return _0x6dbf3e[_0xdbb6('0x22')](_0x26aaf5)[_0xdbb6('0x23')](function(_0x1439fa){return _0x1439fa;});}return null;};}function removeEntity(_0x8521ce,_0xc91582){return function(_0x38d396){if(_0x38d396){return _0x38d396[_0xdbb6('0x24')]()[_0xdbb6('0x23')](function(){_0x8521ce[_0xdbb6('0x19')](0xcc)[_0xdbb6('0x1a')]();});}};}function handleEntityNotFound(_0x3bd55c,_0x4ab4d8){return function(_0x3c5a5e){if(!_0x3c5a5e){_0x3bd55c[_0xdbb6('0x18')](0x194);}return _0x3c5a5e;};}function handleError(_0x29f727,_0x514140){_0x514140=_0x514140||0x1f4;return function(_0x3e0cbb){logger[_0xdbb6('0x25')](_0x3e0cbb[_0xdbb6('0x26')]);if(_0x3e0cbb[_0xdbb6('0x27')]){delete _0x3e0cbb[_0xdbb6('0x27')];}_0x29f727[_0xdbb6('0x19')](_0x514140)['send'](_0x3e0cbb);};}function getMustacheRender(_0x2c7dd8,_0x195152){return Mustache[_0xdbb6('0x28')](_0x2c7dd8,_['merge'](_0x195152[_0xdbb6('0x29')],{'contact':_0x195152[_0xdbb6('0x2a')],'message':_0x195152['message'],'agent':_0x195152[_0xdbb6('0x2b')],'interaction':_0x195152['interaction'],'account':_0x195152['account']}))||'';}exports[_0xdbb6('0x2c')]=function(_0x461097,_0x1acf4b){var _0x4b4d41={},_0x109dd2={},_0x267994={'count':0x0,'rows':[]};var _0x3c97c2=_[_0xdbb6('0x2d')](db[_0xdbb6('0x2e')][_0xdbb6('0x2f')],function(_0x18e6f2){return{'name':_0x18e6f2['fieldName'],'type':_0x18e6f2[_0xdbb6('0x30')][_0xdbb6('0x31')]};});_0x109dd2[_0xdbb6('0x32')]=_[_0xdbb6('0x2d')](_0x3c97c2,_0xdbb6('0x27'));_0x109dd2['query']=_['keys'](_0x461097[_0xdbb6('0x33')]);_0x109dd2[_0xdbb6('0x34')]=_['intersection'](_0x109dd2['model'],_0x109dd2[_0xdbb6('0x33')]);_0x4b4d41[_0xdbb6('0x35')]=_[_0xdbb6('0x36')](_0x109dd2[_0xdbb6('0x32')],qs[_0xdbb6('0x37')](_0x461097[_0xdbb6('0x33')][_0xdbb6('0x37')]));_0x4b4d41['attributes']=_0x4b4d41[_0xdbb6('0x35')][_0xdbb6('0x38')]?_0x4b4d41['attributes']:_0x109dd2['model'];if(!_0x461097['query'][_0xdbb6('0x39')]('nolimit')){_0x4b4d41[_0xdbb6('0x1d')]=qs['limit'](_0x461097[_0xdbb6('0x33')][_0xdbb6('0x1d')]);_0x4b4d41[_0xdbb6('0x1b')]=qs[_0xdbb6('0x1b')](_0x461097[_0xdbb6('0x33')][_0xdbb6('0x1b')]);}_0x4b4d41['order']=qs[_0xdbb6('0x3a')](_0x461097[_0xdbb6('0x33')]['sort']);_0x4b4d41[_0xdbb6('0x3b')]=qs['filters'](_[_0xdbb6('0x3c')](_0x461097['query'],_0x109dd2[_0xdbb6('0x34')]),_0x3c97c2);if(_0x461097[_0xdbb6('0x33')]['filter']){_0x4b4d41[_0xdbb6('0x3b')]=_[_0xdbb6('0x3d')](_0x4b4d41[_0xdbb6('0x3b')],{'$or':_['map'](_0x3c97c2,function(_0x389b59){if(_0x389b59[_0xdbb6('0x30')]!==_0xdbb6('0x3e')){var _0x298cdf={};_0x298cdf[_0x389b59['name']]={'$like':'%'+_0x461097[_0xdbb6('0x33')][_0xdbb6('0x3f')]+'%'};return _0x298cdf;}})});}_0x4b4d41=_['merge']({},_0x4b4d41,_0x461097['options']);var _0x94fcd4={'where':_0x4b4d41[_0xdbb6('0x3b')]};return db[_0xdbb6('0x2e')][_0xdbb6('0x1e')](_0x94fcd4)[_0xdbb6('0x23')](function(_0x84d2b0){_0x267994[_0xdbb6('0x1e')]=_0x84d2b0;if(_0x461097[_0xdbb6('0x33')][_0xdbb6('0x40')]){_0x4b4d41['include']=[{'all':!![]}];}return db[_0xdbb6('0x2e')][_0xdbb6('0x41')](_0x4b4d41);})[_0xdbb6('0x23')](function(_0xb4831d){_0x267994[_0xdbb6('0x42')]=_0xb4831d;return _0x267994;})[_0xdbb6('0x23')](respondWithFilteredResult(_0x1acf4b,_0x4b4d41))[_0xdbb6('0x43')](handleError(_0x1acf4b,null));};exports[_0xdbb6('0x44')]=function(_0x1d7351,_0x3008c4){var _0x5654a8={'raw':![],'where':{'id':_0x1d7351[_0xdbb6('0x45')]['id']}},_0x1081f6={};_0x1081f6[_0xdbb6('0x32')]=_['keys'](db[_0xdbb6('0x2e')][_0xdbb6('0x2f')]);_0x1081f6[_0xdbb6('0x33')]=_[_0xdbb6('0x46')](_0x1d7351['query']);_0x1081f6[_0xdbb6('0x34')]=_['intersection'](_0x1081f6['model'],_0x1081f6['query']);_0x5654a8[_0xdbb6('0x35')]=_['intersection'](_0x1081f6[_0xdbb6('0x32')],qs[_0xdbb6('0x37')](_0x1d7351[_0xdbb6('0x33')][_0xdbb6('0x37')]));_0x5654a8['attributes']=_0x5654a8['attributes'][_0xdbb6('0x38')]?_0x5654a8[_0xdbb6('0x35')]:_0x1081f6['model'];if(_0x1d7351['query']['includeAll']){_0x5654a8['include']=[{'all':!![]}];}_0x5654a8=_[_0xdbb6('0x3d')]({},_0x5654a8,_0x1d7351[_0xdbb6('0x47')]);return db[_0xdbb6('0x2e')][_0xdbb6('0x48')](_0x5654a8)['then'](handleEntityNotFound(_0x3008c4,null))[_0xdbb6('0x23')](respondWithResult(_0x3008c4,null))[_0xdbb6('0x43')](handleError(_0x3008c4,null));};exports[_0xdbb6('0x49')]=function(_0x294ccd,_0x491a30){return db['UserProfileResource'][_0xdbb6('0x49')](_0x294ccd['body'],{})['then'](respondWithResult(_0x491a30,0xc9))[_0xdbb6('0x43')](handleError(_0x491a30,null));};exports[_0xdbb6('0x22')]=function(_0x37b9b6,_0x45606d){if(_0x37b9b6[_0xdbb6('0x29')]['id']){delete _0x37b9b6[_0xdbb6('0x29')]['id'];}return db[_0xdbb6('0x2e')][_0xdbb6('0x48')]({'where':{'id':_0x37b9b6['params']['id']}})[_0xdbb6('0x23')](handleEntityNotFound(_0x45606d,null))[_0xdbb6('0x23')](saveUpdates(_0x37b9b6[_0xdbb6('0x29')],null))[_0xdbb6('0x23')](respondWithResult(_0x45606d,null))['catch'](handleError(_0x45606d,null));};exports[_0xdbb6('0x24')]=function(_0x17afea,_0x286a63){return db[_0xdbb6('0x2e')][_0xdbb6('0x48')]({'where':{'id':_0x17afea[_0xdbb6('0x45')]['id']}})[_0xdbb6('0x23')](handleEntityNotFound(_0x286a63,null))['then'](removeEntity(_0x286a63,null))[_0xdbb6('0x43')](handleError(_0x286a63,null));};exports[_0xdbb6('0x4a')]=function(_0x2a1ab3,_0x4dc7d8){return db['UserProfileResource'][_0xdbb6('0x4a')]()[_0xdbb6('0x23')](respondWithResult(_0x4dc7d8,null))[_0xdbb6('0x43')](handleError(_0x4dc7d8,null));}; \ No newline at end of file +var _0xe485=['error','stack','name','render','merge','message','interaction','account','index','map','UserProfileResource','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','catch','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x159152,_0x174251){var _0x50a4aa=function(_0x1a46f7){while(--_0x1a46f7){_0x159152['push'](_0x159152['shift']());}};_0x50a4aa(++_0x174251);}(_0xe485,0x114));var _0x5e48=function(_0x5a2e8f,_0x516577){_0x5a2e8f=_0x5a2e8f-0x0;var _0x3075ef=_0xe485[_0x5a2e8f];return _0x3075ef;};'use strict';var emlformat=require(_0x5e48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5e48('0x1'));var jsonpatch=require(_0x5e48('0x2'));var rp=require(_0x5e48('0x3'));var moment=require('moment');var BPromise=require(_0x5e48('0x4'));var Mustache=require(_0x5e48('0x5'));var util=require('util');var path=require(_0x5e48('0x6'));var sox=require(_0x5e48('0x7'));var csv=require(_0x5e48('0x8'));var ejs=require(_0x5e48('0x9'));var fs=require('fs');var fs_extra=require(_0x5e48('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e48('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5e48('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5e48('0xd'));var Papa=require(_0x5e48('0xe'));var Redis=require('ioredis');var authService=require(_0x5e48('0xf'));var qs=require(_0x5e48('0x10'));var as=require(_0x5e48('0x11'));var hardwareService=require(_0x5e48('0x12'));var logger=require(_0x5e48('0x13'))(_0x5e48('0x14'));var utils=require(_0x5e48('0x15'));var config=require(_0x5e48('0x16'));var licenseUtil=require(_0x5e48('0x17'));var db=require(_0x5e48('0x18'))['db'];function respondWithStatusCode(_0x5026b1,_0x3226f7){_0x3226f7=_0x3226f7||0xcc;return function(_0x4bf743){if(_0x4bf743){return _0x5026b1[_0x5e48('0x19')](_0x3226f7);}return _0x5026b1[_0x5e48('0x1a')](_0x3226f7)[_0x5e48('0x1b')]();};}function respondWithResult(_0x2b6f32,_0x4a61ae){_0x4a61ae=_0x4a61ae||0xc8;return function(_0x18176b){if(_0x18176b){return _0x2b6f32['status'](_0x4a61ae)[_0x5e48('0x1c')](_0x18176b);}};}function respondWithFilteredResult(_0x8b2e45,_0x15ba1f){return function(_0x17a9e1){if(_0x17a9e1){var _0x3173c7=typeof _0x15ba1f[_0x5e48('0x1d')]==='undefined'&&typeof _0x15ba1f[_0x5e48('0x1e')]==='undefined';var _0x4db5d0=_0x17a9e1['count'];var _0x627d9=_0x3173c7?0x0:_0x15ba1f[_0x5e48('0x1d')];var _0x32995a=_0x3173c7?_0x17a9e1[_0x5e48('0x1f')]:_0x15ba1f['offset']+_0x15ba1f[_0x5e48('0x1e')];var _0x1c2363;if(_0x32995a>=_0x4db5d0){_0x32995a=_0x4db5d0;_0x1c2363=0xc8;}else{_0x1c2363=0xce;}_0x8b2e45[_0x5e48('0x1a')](_0x1c2363);return _0x8b2e45[_0x5e48('0x20')](_0x5e48('0x21'),_0x627d9+'-'+_0x32995a+'/'+_0x4db5d0)['json'](_0x17a9e1);}return null;};}function patchUpdates(_0x412089){return function(_0x56bdc9){try{jsonpatch[_0x5e48('0x22')](_0x56bdc9,_0x412089,!![]);}catch(_0x1fe41e){return BPromise[_0x5e48('0x23')](_0x1fe41e);}return _0x56bdc9[_0x5e48('0x24')]();};}function saveUpdates(_0xf858fe,_0x4f46b1){return function(_0x4e8080){if(_0x4e8080){return _0x4e8080[_0x5e48('0x25')](_0xf858fe)[_0x5e48('0x26')](function(_0x1ac943){return _0x1ac943;});}return null;};}function removeEntity(_0xa32c13,_0x2c15d4){return function(_0x584204){if(_0x584204){return _0x584204[_0x5e48('0x27')]()[_0x5e48('0x26')](function(){_0xa32c13[_0x5e48('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a7eb4,_0x350816){return function(_0x46040f){if(!_0x46040f){_0x5a7eb4[_0x5e48('0x19')](0x194);}return _0x46040f;};}function handleError(_0x46ca21,_0x4d0f06){_0x4d0f06=_0x4d0f06||0x1f4;return function(_0x4f574a){logger[_0x5e48('0x28')](_0x4f574a[_0x5e48('0x29')]);if(_0x4f574a['name']){delete _0x4f574a[_0x5e48('0x2a')];}_0x46ca21['status'](_0x4d0f06)['send'](_0x4f574a);};}function getMustacheRender(_0x4f395f,_0xfd072d){return Mustache[_0x5e48('0x2b')](_0x4f395f,_[_0x5e48('0x2c')](_0xfd072d['body'],{'contact':_0xfd072d['contact'],'message':_0xfd072d[_0x5e48('0x2d')],'agent':_0xfd072d['agent'],'interaction':_0xfd072d[_0x5e48('0x2e')],'account':_0xfd072d[_0x5e48('0x2f')]}))||'';}exports[_0x5e48('0x30')]=function(_0x4ecbd9,_0x4c4c8d){var _0x29b7cf={},_0x40db41={},_0x18f1c0={'count':0x0,'rows':[]};var _0x2bd6d2=_[_0x5e48('0x31')](db[_0x5e48('0x32')][_0x5e48('0x33')],function(_0xaeeb04){return{'name':_0xaeeb04['fieldName'],'type':_0xaeeb04[_0x5e48('0x34')][_0x5e48('0x35')]};});_0x40db41[_0x5e48('0x36')]=_[_0x5e48('0x31')](_0x2bd6d2,'name');_0x40db41[_0x5e48('0x37')]=_[_0x5e48('0x38')](_0x4ecbd9[_0x5e48('0x37')]);_0x40db41[_0x5e48('0x39')]=_['intersection'](_0x40db41[_0x5e48('0x36')],_0x40db41['query']);_0x29b7cf[_0x5e48('0x3a')]=_[_0x5e48('0x3b')](_0x40db41[_0x5e48('0x36')],qs[_0x5e48('0x3c')](_0x4ecbd9[_0x5e48('0x37')][_0x5e48('0x3c')]));_0x29b7cf[_0x5e48('0x3a')]=_0x29b7cf['attributes'][_0x5e48('0x3d')]?_0x29b7cf[_0x5e48('0x3a')]:_0x40db41[_0x5e48('0x36')];if(!_0x4ecbd9[_0x5e48('0x37')][_0x5e48('0x3e')](_0x5e48('0x3f'))){_0x29b7cf[_0x5e48('0x1e')]=qs[_0x5e48('0x1e')](_0x4ecbd9['query'][_0x5e48('0x1e')]);_0x29b7cf['offset']=qs[_0x5e48('0x1d')](_0x4ecbd9[_0x5e48('0x37')][_0x5e48('0x1d')]);}_0x29b7cf['order']=qs[_0x5e48('0x40')](_0x4ecbd9[_0x5e48('0x37')][_0x5e48('0x40')]);_0x29b7cf[_0x5e48('0x41')]=qs[_0x5e48('0x39')](_[_0x5e48('0x42')](_0x4ecbd9['query'],_0x40db41[_0x5e48('0x39')]),_0x2bd6d2);if(_0x4ecbd9[_0x5e48('0x37')][_0x5e48('0x43')]){_0x29b7cf[_0x5e48('0x41')]=_[_0x5e48('0x2c')](_0x29b7cf[_0x5e48('0x41')],{'$or':_['map'](_0x2bd6d2,function(_0x374c35){if(_0x374c35[_0x5e48('0x34')]!=='VIRTUAL'){var _0x5f3854={};_0x5f3854[_0x374c35['name']]={'$like':'%'+_0x4ecbd9[_0x5e48('0x37')][_0x5e48('0x43')]+'%'};return _0x5f3854;}})});}_0x29b7cf=_[_0x5e48('0x2c')]({},_0x29b7cf,_0x4ecbd9[_0x5e48('0x44')]);var _0x39f484={'where':_0x29b7cf[_0x5e48('0x41')]};return db[_0x5e48('0x32')]['count'](_0x39f484)[_0x5e48('0x26')](function(_0x36df6b){_0x18f1c0[_0x5e48('0x1f')]=_0x36df6b;if(_0x4ecbd9[_0x5e48('0x37')][_0x5e48('0x45')]){_0x29b7cf[_0x5e48('0x46')]=[{'all':!![]}];}return db[_0x5e48('0x32')][_0x5e48('0x47')](_0x29b7cf);})['then'](function(_0x5829d9){_0x18f1c0[_0x5e48('0x48')]=_0x5829d9;return _0x18f1c0;})[_0x5e48('0x26')](respondWithFilteredResult(_0x4c4c8d,_0x29b7cf))['catch'](handleError(_0x4c4c8d,null));};exports[_0x5e48('0x49')]=function(_0x317aa3,_0x1b66b1){var _0x44991b={'raw':![],'where':{'id':_0x317aa3[_0x5e48('0x4a')]['id']}},_0x5337d0={};_0x5337d0[_0x5e48('0x36')]=_[_0x5e48('0x38')](db[_0x5e48('0x32')][_0x5e48('0x33')]);_0x5337d0[_0x5e48('0x37')]=_[_0x5e48('0x38')](_0x317aa3[_0x5e48('0x37')]);_0x5337d0[_0x5e48('0x39')]=_[_0x5e48('0x3b')](_0x5337d0[_0x5e48('0x36')],_0x5337d0[_0x5e48('0x37')]);_0x44991b[_0x5e48('0x3a')]=_[_0x5e48('0x3b')](_0x5337d0[_0x5e48('0x36')],qs[_0x5e48('0x3c')](_0x317aa3[_0x5e48('0x37')]['fields']));_0x44991b['attributes']=_0x44991b[_0x5e48('0x3a')]['length']?_0x44991b['attributes']:_0x5337d0[_0x5e48('0x36')];if(_0x317aa3[_0x5e48('0x37')][_0x5e48('0x45')]){_0x44991b['include']=[{'all':!![]}];}_0x44991b=_[_0x5e48('0x2c')]({},_0x44991b,_0x317aa3[_0x5e48('0x44')]);return db[_0x5e48('0x32')]['find'](_0x44991b)[_0x5e48('0x26')](handleEntityNotFound(_0x1b66b1,null))[_0x5e48('0x26')](respondWithResult(_0x1b66b1,null))[_0x5e48('0x4b')](handleError(_0x1b66b1,null));};exports['create']=function(_0x22fdcc,_0x5a9c7d){return db[_0x5e48('0x32')]['create'](_0x22fdcc[_0x5e48('0x4c')],{})[_0x5e48('0x26')](respondWithResult(_0x5a9c7d,0xc9))['catch'](handleError(_0x5a9c7d,null));};exports[_0x5e48('0x25')]=function(_0x328c78,_0x4b5db2){if(_0x328c78[_0x5e48('0x4c')]['id']){delete _0x328c78[_0x5e48('0x4c')]['id'];}return db[_0x5e48('0x32')][_0x5e48('0x4d')]({'where':{'id':_0x328c78[_0x5e48('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4b5db2,null))['then'](saveUpdates(_0x328c78['body'],null))[_0x5e48('0x26')](respondWithResult(_0x4b5db2,null))[_0x5e48('0x4b')](handleError(_0x4b5db2,null));};exports['destroy']=function(_0x191a11,_0x4cd89b){return db[_0x5e48('0x32')][_0x5e48('0x4d')]({'where':{'id':_0x191a11[_0x5e48('0x4a')]['id']}})[_0x5e48('0x26')](handleEntityNotFound(_0x4cd89b,null))[_0x5e48('0x26')](removeEntity(_0x4cd89b,null))[_0x5e48('0x4b')](handleError(_0x4cd89b,null));};exports[_0x5e48('0x4e')]=function(_0xd70b16,_0x46e530){return db[_0x5e48('0x32')][_0x5e48('0x4e')]()[_0x5e48('0x26')](respondWithResult(_0x46e530,null))[_0x5e48('0x4b')](handleError(_0x46e530,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index ff06573..4949adc 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 _0x3ddd=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','compositeIndex','resourceId','lodash'];(function(_0x21c48c,_0x14daf6){var _0x2aa82e=function(_0x530476){while(--_0x530476){_0x21c48c['push'](_0x21c48c['shift']());}};_0x2aa82e(++_0x14daf6);}(_0x3ddd,0x74));var _0xd3dd=function(_0x78db6e,_0x4c003f){_0x78db6e=_0x78db6e-0x0;var _0x2b953e=_0x3ddd[_0x78db6e];return _0x2b953e;};'use strict';var _=require(_0xd3dd('0x0'));var util=require('util');var logger=require(_0xd3dd('0x1'))(_0xd3dd('0x2'));var moment=require(_0xd3dd('0x3'));var BPromise=require('bluebird');var rp=require(_0xd3dd('0x4'));var fs=require('fs');var path=require(_0xd3dd('0x5'));var rimraf=require(_0xd3dd('0x6'));var config=require(_0xd3dd('0x7'));var attributes=require(_0xd3dd('0x8'));module[_0xd3dd('0x9')]=function(_0x32c572,_0x23483d){return _0x32c572[_0xd3dd('0xa')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xd3dd('0xb'),'fields':[_0xd3dd('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x144e=['resourceId','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','UserProfileResource','user_profile_has_resources','compositeIndex'];(function(_0x46bc86,_0x15dbe1){var _0x2d1b56=function(_0x572f21){while(--_0x572f21){_0x46bc86['push'](_0x46bc86['shift']());}};_0x2d1b56(++_0x15dbe1);}(_0x144e,0x181));var _0xe144=function(_0x3bdaf3,_0x2ed581){_0x3bdaf3=_0x3bdaf3-0x0;var _0x49830b=_0x144e[_0x3bdaf3];return _0x49830b;};'use strict';var _=require(_0xe144('0x0'));var util=require(_0xe144('0x1'));var logger=require(_0xe144('0x2'))('api');var moment=require(_0xe144('0x3'));var BPromise=require('bluebird');var rp=require(_0xe144('0x4'));var fs=require('fs');var path=require(_0xe144('0x5'));var rimraf=require(_0xe144('0x6'));var config=require(_0xe144('0x7'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x6b0102,_0x27fb98){return _0x6b0102['define'](_0xe144('0x8'),attributes,{'tableName':_0xe144('0x9'),'paranoid':![],'indexes':[{'name':_0xe144('0xa'),'fields':[_0xe144('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 13b6f13..7bbd3bd 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 _0x52c0=['UserProfileResource,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/environment','client','http','request','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x32fad2,_0x554b53){var _0x23e9cf=function(_0x4f24a9){while(--_0x4f24a9){_0x32fad2['push'](_0x32fad2['shift']());}};_0x23e9cf(++_0x554b53);}(_0x52c0,0x16c));var _0x052c=function(_0x82ea1e,_0x3ff2d3){_0x82ea1e=_0x82ea1e-0x0;var _0x5b0c37=_0x52c0[_0x82ea1e];return _0x5b0c37;};'use strict';var _=require('lodash');var util=require(_0x052c('0x0'));var moment=require('moment');var BPromise=require(_0x052c('0x1'));var rs=require(_0x052c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x052c('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x052c('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x052c('0x5')][_0x052c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x109d3f,_0x2e0ce5,_0x3bdf61){return new BPromise(function(_0xfbcc88,_0x42742b){return client[_0x052c('0x7')](_0x109d3f,_0x3bdf61)[_0x052c('0x8')](function(_0x1928bd){logger[_0x052c('0x9')]('UserProfileResource,\x20%s,\x20%s',_0x2e0ce5,_0x052c('0xa'));logger[_0x052c('0xb')](_0x052c('0xc'),_0x2e0ce5,_0x052c('0xa'),JSON[_0x052c('0xd')](_0x1928bd));if(_0x1928bd[_0x052c('0xe')]){if(_0x1928bd['error'][_0x052c('0xf')]===0x1f4){logger[_0x052c('0xe')](_0x052c('0x10'),_0x2e0ce5,_0x1928bd['error']['message']);return _0x42742b(_0x1928bd[_0x052c('0xe')]['message']);}logger[_0x052c('0xe')](_0x052c('0x10'),_0x2e0ce5,_0x1928bd[_0x052c('0xe')][_0x052c('0x11')]);return _0xfbcc88(_0x1928bd[_0x052c('0xe')][_0x052c('0x11')]);}else{logger[_0x052c('0x9')](_0x052c('0x10'),_0x2e0ce5,_0x052c('0xa'));_0xfbcc88(_0x1928bd[_0x052c('0x12')][_0x052c('0x11')]);}})[_0x052c('0x13')](function(_0x58d7df){logger[_0x052c('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x2e0ce5,_0x58d7df);_0x42742b(_0x58d7df);});});} \ No newline at end of file +var _0xb9d5=['../../config/environment','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x262f67,_0x46dfc3){var _0x35ed8a=function(_0x381220){while(--_0x381220){_0x262f67['push'](_0x262f67['shift']());}};_0x35ed8a(++_0x46dfc3);}(_0xb9d5,0xb6));var _0x5b9d=function(_0x5d5d54,_0x167ce9){_0x5d5d54=_0x5d5d54-0x0;var _0x3184a1=_0xb9d5[_0x5d5d54];return _0x3184a1;};'use strict';var _=require('lodash');var util=require(_0x5b9d('0x0'));var moment=require(_0x5b9d('0x1'));var BPromise=require(_0x5b9d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b9d('0x3'))['db'];var utils=require(_0x5b9d('0x4'));var logger=require(_0x5b9d('0x5'))(_0x5b9d('0x6'));var config=require(_0x5b9d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5b9d('0x8')][_0x5b9d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9c89ce,_0x35bde3,_0x300797){return new BPromise(function(_0x546207,_0x2fb79c){return client['request'](_0x9c89ce,_0x300797)[_0x5b9d('0xa')](function(_0x35c60b){logger[_0x5b9d('0xb')](_0x5b9d('0xc'),_0x35bde3,_0x5b9d('0xd'));logger['debug'](_0x5b9d('0xe'),_0x35bde3,_0x5b9d('0xd'),JSON[_0x5b9d('0xf')](_0x35c60b));if(_0x35c60b['error']){if(_0x35c60b['error'][_0x5b9d('0x10')]===0x1f4){logger[_0x5b9d('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x35bde3,_0x35c60b[_0x5b9d('0x11')][_0x5b9d('0x12')]);return _0x2fb79c(_0x35c60b[_0x5b9d('0x11')][_0x5b9d('0x12')]);}logger[_0x5b9d('0x11')](_0x5b9d('0xc'),_0x35bde3,_0x35c60b[_0x5b9d('0x11')]['message']);return _0x546207(_0x35c60b[_0x5b9d('0x11')][_0x5b9d('0x12')]);}else{logger[_0x5b9d('0xb')](_0x5b9d('0xc'),_0x35bde3,_0x5b9d('0xd'));_0x546207(_0x35c60b[_0x5b9d('0x13')][_0x5b9d('0x12')]);}})[_0x5b9d('0x14')](function(_0xea2730){logger['error'](_0x5b9d('0xc'),_0x35bde3,_0xea2730);_0x2fb79c(_0xea2730);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 74e504e..8e13254 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 _0x33c3=['isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get'];(function(_0x465cb5,_0x45ca12){var _0x2e7374=function(_0x320084){while(--_0x320084){_0x465cb5['push'](_0x465cb5['shift']());}};_0x2e7374(++_0x45ca12);}(_0x33c3,0x15b));var _0x333c=function(_0x5853af,_0x55f444){_0x5853af=_0x5853af-0x0;var _0x194943=_0x33c3[_0x5853af];return _0x194943;};'use strict';var multer=require(_0x333c('0x0'));var util=require(_0x333c('0x1'));var path=require('path');var timeout=require(_0x333c('0x2'));var express=require(_0x333c('0x3'));var router=express[_0x333c('0x4')]();var fs_extra=require(_0x333c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x333c('0x6'));var config=require(_0x333c('0x7'));var controller=require(_0x333c('0x8'));router[_0x333c('0x9')]('/',auth[_0x333c('0xa')](),controller[_0x333c('0xb')]);router[_0x333c('0x9')](_0x333c('0xc'),auth[_0x333c('0xa')](),controller[_0x333c('0xd')]);router[_0x333c('0x9')](_0x333c('0xe'),auth['isAuthenticated'](),controller[_0x333c('0xf')]);router[_0x333c('0x10')]('/',auth[_0x333c('0xa')](),controller['create']);router[_0x333c('0x11')](_0x333c('0xe'),auth[_0x333c('0xa')](),controller['update']);router[_0x333c('0x12')]('/:id',auth[_0x333c('0xa')](),controller[_0x333c('0x13')]);module[_0x333c('0x14')]=router; \ No newline at end of file +var _0x5a06=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','describe','/:id','create','update','delete','destroy','exports'];(function(_0x4f3bdd,_0x527557){var _0x1b6af5=function(_0x4c868d){while(--_0x4c868d){_0x4f3bdd['push'](_0x4f3bdd['shift']());}};_0x1b6af5(++_0x527557);}(_0x5a06,0x130));var _0x65a0=function(_0x4adbb0,_0x5f5a74){_0x4adbb0=_0x4adbb0-0x0;var _0x5e235c=_0x5a06[_0x4adbb0];return _0x5e235c;};'use strict';var multer=require(_0x65a0('0x0'));var util=require('util');var path=require(_0x65a0('0x1'));var timeout=require(_0x65a0('0x2'));var express=require('express');var router=express[_0x65a0('0x3')]();var fs_extra=require(_0x65a0('0x4'));var auth=require(_0x65a0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x65a0('0x6')]('/',auth[_0x65a0('0x7')](),controller[_0x65a0('0x8')]);router[_0x65a0('0x6')]('/describe',auth[_0x65a0('0x7')](),controller[_0x65a0('0x9')]);router[_0x65a0('0x6')](_0x65a0('0xa'),auth[_0x65a0('0x7')](),controller['show']);router['post']('/',auth[_0x65a0('0x7')](),controller[_0x65a0('0xb')]);router['put'](_0x65a0('0xa'),auth[_0x65a0('0x7')](),controller[_0x65a0('0xc')]);router[_0x65a0('0xd')](_0x65a0('0xa'),auth['isAuthenticated'](),controller[_0x65a0('0xe')]);module[_0x65a0('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 cd85b1e..76c00fb 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 _0x4849=['join','getDataValue','crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x56127d,_0x373bdf){var _0x2c6f75=function(_0x99c604){while(--_0x99c604){_0x56127d['push'](_0x56127d['shift']());}};_0x2c6f75(++_0x373bdf);}(_0x4849,0x86));var _0x9484=function(_0x5498b2,_0x5d2453){_0x5498b2=_0x5498b2-0x0;var _0x1ec5ed=_0x4849[_0x5498b2];return _0x1ec5ed;};'use strict';var Sequelize=require(_0x9484('0x0'));module[_0x9484('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x9484('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x9484('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x9484('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x9484('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x9484('0x2')],'set':function(_0x3f3057){this[_0x9484('0x5')]('crudPermissions',_0x3f3057?_0x3f3057[_0x9484('0x6')](''):[]);},'get':function(){return this[_0x9484('0x7')]('crudPermissions')?this[_0x9484('0x7')](_0x9484('0x8'))[_0x9484('0x9')](''):[];}}}; \ No newline at end of file +var _0xc7b4=['BOOLEAN','setDataValue','join','getDataValue','crudPermissions','split','sequelize','STRING'];(function(_0x4c9345,_0xe6b30c){var _0x1738cb=function(_0x467f6e){while(--_0x467f6e){_0x4c9345['push'](_0x4c9345['shift']());}};_0x1738cb(++_0xe6b30c);}(_0xc7b4,0x15e));var _0x4c7b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc7b4[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x4c7b('0x0'));module['exports']={'name':{'type':Sequelize[_0x4c7b('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x4c7b('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x4c7b('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4c7b('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4c7b('0x1')],'set':function(_0x2a8b1d){this[_0x4c7b('0x3')]('crudPermissions',_0x2a8b1d?_0x2a8b1d[_0x4c7b('0x4')](''):[]);},'get':function(){return this[_0x4c7b('0x5')](_0x4c7b('0x6'))?this[_0x4c7b('0x5')](_0x4c7b('0x6'))[_0x4c7b('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 25ac542..7d5b5fc 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 _0xd726=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','render','merge','contact','message','interaction','account','index','map','UserProfileSection','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','type','VIRTUAL','options','includeAll','include','rows','show','params','create','body','catch','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xa1be4f,_0x10a675){var _0x25bcce=function(_0x2523da){while(--_0x2523da){_0xa1be4f['push'](_0xa1be4f['shift']());}};_0x25bcce(++_0x10a675);}(_0xd726,0x167));var _0x6d72=function(_0x1f7edc,_0x2fb7e1){_0x1f7edc=_0x1f7edc-0x0;var _0x344f10=_0xd726[_0x1f7edc];return _0x344f10;};'use strict';var emlformat=require(_0x6d72('0x0'));var rimraf=require(_0x6d72('0x1'));var zipdir=require(_0x6d72('0x2'));var jsonpatch=require(_0x6d72('0x3'));var rp=require(_0x6d72('0x4'));var moment=require(_0x6d72('0x5'));var BPromise=require(_0x6d72('0x6'));var Mustache=require(_0x6d72('0x7'));var util=require('util');var path=require(_0x6d72('0x8'));var sox=require('sox');var csv=require(_0x6d72('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d72('0xa'));var _=require(_0x6d72('0xb'));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(_0x6d72('0xc'));var Redis=require(_0x6d72('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x6d72('0xe'));var as=require(_0x6d72('0xf'));var hardwareService=require(_0x6d72('0x10'));var logger=require(_0x6d72('0x11'))('api');var utils=require(_0x6d72('0x12'));var config=require(_0x6d72('0x13'));var licenseUtil=require(_0x6d72('0x14'));var db=require(_0x6d72('0x15'))['db'];function respondWithStatusCode(_0x51c18a,_0x115650){_0x115650=_0x115650||0xcc;return function(_0xef48bd){if(_0xef48bd){return _0x51c18a['sendStatus'](_0x115650);}return _0x51c18a[_0x6d72('0x16')](_0x115650)['end']();};}function respondWithResult(_0x2e943c,_0x3c9282){_0x3c9282=_0x3c9282||0xc8;return function(_0x520c6b){if(_0x520c6b){return _0x2e943c[_0x6d72('0x16')](_0x3c9282)[_0x6d72('0x17')](_0x520c6b);}};}function respondWithFilteredResult(_0x28543a,_0x438a61){return function(_0x50fba1){if(_0x50fba1){var _0x6420bf=typeof _0x438a61[_0x6d72('0x18')]==='undefined'&&typeof _0x438a61[_0x6d72('0x19')]==='undefined';var _0x5f0ca0=_0x50fba1[_0x6d72('0x1a')];var _0x28280=_0x6420bf?0x0:_0x438a61[_0x6d72('0x18')];var _0x395c09=_0x6420bf?_0x50fba1[_0x6d72('0x1a')]:_0x438a61[_0x6d72('0x18')]+_0x438a61[_0x6d72('0x19')];var _0x3ce97c;if(_0x395c09>=_0x5f0ca0){_0x395c09=_0x5f0ca0;_0x3ce97c=0xc8;}else{_0x3ce97c=0xce;}_0x28543a[_0x6d72('0x16')](_0x3ce97c);return _0x28543a[_0x6d72('0x1b')]('Content-Range',_0x28280+'-'+_0x395c09+'/'+_0x5f0ca0)[_0x6d72('0x17')](_0x50fba1);}return null;};}function patchUpdates(_0x1f02f9){return function(_0x46768d){try{jsonpatch[_0x6d72('0x1c')](_0x46768d,_0x1f02f9,!![]);}catch(_0x76e87a){return BPromise[_0x6d72('0x1d')](_0x76e87a);}return _0x46768d[_0x6d72('0x1e')]();};}function saveUpdates(_0x3f8921,_0x4d5422){return function(_0x30b71c){if(_0x30b71c){return _0x30b71c[_0x6d72('0x1f')](_0x3f8921)[_0x6d72('0x20')](function(_0x203441){return _0x203441;});}return null;};}function removeEntity(_0x326672,_0x3ae778){return function(_0x5ad086){if(_0x5ad086){return _0x5ad086[_0x6d72('0x21')]()[_0x6d72('0x20')](function(){_0x326672['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a5f6c,_0x25186d){return function(_0x295e8c){if(!_0x295e8c){_0x3a5f6c[_0x6d72('0x22')](0x194);}return _0x295e8c;};}function handleError(_0x579dec,_0x39758a){_0x39758a=_0x39758a||0x1f4;return function(_0x397426){logger[_0x6d72('0x23')](_0x397426[_0x6d72('0x24')]);if(_0x397426[_0x6d72('0x25')]){delete _0x397426['name'];}_0x579dec[_0x6d72('0x16')](_0x39758a)[_0x6d72('0x26')](_0x397426);};}function getMustacheRender(_0x2a6f58,_0x22de54){return Mustache[_0x6d72('0x27')](_0x2a6f58,_[_0x6d72('0x28')](_0x22de54['body'],{'contact':_0x22de54[_0x6d72('0x29')],'message':_0x22de54[_0x6d72('0x2a')],'agent':_0x22de54['agent'],'interaction':_0x22de54[_0x6d72('0x2b')],'account':_0x22de54[_0x6d72('0x2c')]}))||'';}exports[_0x6d72('0x2d')]=function(_0x11d635,_0x455b7a){var _0xdea13c={},_0x3ba56b={},_0x44fc56={'count':0x0,'rows':[]};var _0x12fb13=_[_0x6d72('0x2e')](db[_0x6d72('0x2f')][_0x6d72('0x30')],function(_0x5b8933){return{'name':_0x5b8933[_0x6d72('0x31')],'type':_0x5b8933['type'][_0x6d72('0x32')]};});_0x3ba56b[_0x6d72('0x33')]=_[_0x6d72('0x2e')](_0x12fb13,'name');_0x3ba56b['query']=_[_0x6d72('0x34')](_0x11d635[_0x6d72('0x35')]);_0x3ba56b['filters']=_[_0x6d72('0x36')](_0x3ba56b[_0x6d72('0x33')],_0x3ba56b[_0x6d72('0x35')]);_0xdea13c[_0x6d72('0x37')]=_[_0x6d72('0x36')](_0x3ba56b[_0x6d72('0x33')],qs[_0x6d72('0x38')](_0x11d635['query'][_0x6d72('0x38')]));_0xdea13c[_0x6d72('0x37')]=_0xdea13c[_0x6d72('0x37')]['length']?_0xdea13c[_0x6d72('0x37')]:_0x3ba56b['model'];if(!_0x11d635[_0x6d72('0x35')][_0x6d72('0x39')]('nolimit')){_0xdea13c[_0x6d72('0x19')]=qs[_0x6d72('0x19')](_0x11d635['query']['limit']);_0xdea13c[_0x6d72('0x18')]=qs[_0x6d72('0x18')](_0x11d635['query'][_0x6d72('0x18')]);}_0xdea13c['order']=qs[_0x6d72('0x3a')](_0x11d635[_0x6d72('0x35')]['sort']);_0xdea13c[_0x6d72('0x3b')]=qs[_0x6d72('0x3c')](_[_0x6d72('0x3d')](_0x11d635[_0x6d72('0x35')],_0x3ba56b[_0x6d72('0x3c')]),_0x12fb13);if(_0x11d635['query']['filter']){_0xdea13c[_0x6d72('0x3b')]=_[_0x6d72('0x28')](_0xdea13c['where'],{'$or':_['map'](_0x12fb13,function(_0x5a04ad){if(_0x5a04ad[_0x6d72('0x3e')]!==_0x6d72('0x3f')){var _0x31c002={};_0x31c002[_0x5a04ad['name']]={'$like':'%'+_0x11d635[_0x6d72('0x35')]['filter']+'%'};return _0x31c002;}})});}_0xdea13c=_[_0x6d72('0x28')]({},_0xdea13c,_0x11d635[_0x6d72('0x40')]);var _0x5762d8={'where':_0xdea13c[_0x6d72('0x3b')]};return db[_0x6d72('0x2f')][_0x6d72('0x1a')](_0x5762d8)[_0x6d72('0x20')](function(_0x15f9b0){_0x44fc56[_0x6d72('0x1a')]=_0x15f9b0;if(_0x11d635['query'][_0x6d72('0x41')]){_0xdea13c[_0x6d72('0x42')]=[{'all':!![]}];}return db[_0x6d72('0x2f')]['findAll'](_0xdea13c);})[_0x6d72('0x20')](function(_0x516597){_0x44fc56[_0x6d72('0x43')]=_0x516597;return _0x44fc56;})[_0x6d72('0x20')](respondWithFilteredResult(_0x455b7a,_0xdea13c))['catch'](handleError(_0x455b7a,null));};exports[_0x6d72('0x44')]=function(_0x18a2d7,_0x5314c1){var _0x53716d={'raw':![],'where':{'id':_0x18a2d7[_0x6d72('0x45')]['id']}},_0x54f884={};_0x54f884[_0x6d72('0x33')]=_['keys'](db[_0x6d72('0x2f')][_0x6d72('0x30')]);_0x54f884['query']=_['keys'](_0x18a2d7[_0x6d72('0x35')]);_0x54f884[_0x6d72('0x3c')]=_[_0x6d72('0x36')](_0x54f884[_0x6d72('0x33')],_0x54f884[_0x6d72('0x35')]);_0x53716d[_0x6d72('0x37')]=_[_0x6d72('0x36')](_0x54f884[_0x6d72('0x33')],qs[_0x6d72('0x38')](_0x18a2d7[_0x6d72('0x35')][_0x6d72('0x38')]));_0x53716d[_0x6d72('0x37')]=_0x53716d[_0x6d72('0x37')]['length']?_0x53716d[_0x6d72('0x37')]:_0x54f884['model'];if(_0x18a2d7[_0x6d72('0x35')][_0x6d72('0x41')]){_0x53716d[_0x6d72('0x42')]=[{'all':!![]}];}_0x53716d=_[_0x6d72('0x28')]({},_0x53716d,_0x18a2d7[_0x6d72('0x40')]);return db[_0x6d72('0x2f')]['find'](_0x53716d)[_0x6d72('0x20')](handleEntityNotFound(_0x5314c1,null))[_0x6d72('0x20')](respondWithResult(_0x5314c1,null))['catch'](handleError(_0x5314c1,null));};exports[_0x6d72('0x46')]=function(_0x2b567f,_0xccf915){return db[_0x6d72('0x2f')][_0x6d72('0x46')](_0x2b567f[_0x6d72('0x47')],{})[_0x6d72('0x20')](respondWithResult(_0xccf915,0xc9))[_0x6d72('0x48')](handleError(_0xccf915,null));};exports[_0x6d72('0x1f')]=function(_0x3dbe44,_0x27ec6f){if(_0x3dbe44[_0x6d72('0x47')]['id']){delete _0x3dbe44['body']['id'];}return db[_0x6d72('0x2f')]['find']({'where':{'id':_0x3dbe44[_0x6d72('0x45')]['id']}})[_0x6d72('0x20')](handleEntityNotFound(_0x27ec6f,null))[_0x6d72('0x20')](saveUpdates(_0x3dbe44[_0x6d72('0x47')],null))[_0x6d72('0x20')](respondWithResult(_0x27ec6f,null))[_0x6d72('0x48')](handleError(_0x27ec6f,null));};exports[_0x6d72('0x21')]=function(_0x122903,_0x33de5a){return db[_0x6d72('0x2f')][_0x6d72('0x49')]({'where':{'id':_0x122903[_0x6d72('0x45')]['id']}})[_0x6d72('0x20')](handleEntityNotFound(_0x33de5a,null))[_0x6d72('0x20')](removeEntity(_0x33de5a,null))[_0x6d72('0x48')](handleError(_0x33de5a,null));};exports['describe']=function(_0x3206a1,_0x5234d9){return db[_0x6d72('0x2f')][_0x6d72('0x4a')]()[_0x6d72('0x20')](respondWithResult(_0x5234d9,null))[_0x6d72('0x48')](handleError(_0x5234d9,null));}; \ No newline at end of file +var _0xa464=['merge','body','contact','message','agent','interaction','index','map','rawAttributes','type','key','model','name','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','UserProfileSection','findAll','rows','catch','params','keys','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','then','destroy','stack','send','render'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xa464,0x115));var _0x4a46=function(_0xaacb57,_0x1befa9){_0xaacb57=_0xaacb57-0x0;var _0x13f10c=_0xa464[_0xaacb57];return _0x13f10c;};'use strict';var emlformat=require(_0x4a46('0x0'));var rimraf=require(_0x4a46('0x1'));var zipdir=require(_0x4a46('0x2'));var jsonpatch=require(_0x4a46('0x3'));var rp=require(_0x4a46('0x4'));var moment=require(_0x4a46('0x5'));var BPromise=require(_0x4a46('0x6'));var Mustache=require('mustache');var util=require(_0x4a46('0x7'));var path=require(_0x4a46('0x8'));var sox=require(_0x4a46('0x9'));var csv=require(_0x4a46('0xa'));var ejs=require(_0x4a46('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a46('0xc'));var squel=require(_0x4a46('0xd'));var crypto=require('crypto');var jsforce=require(_0x4a46('0xe'));var deskjs=require(_0x4a46('0xf'));var toCsv=require(_0x4a46('0xa'));var querystring=require(_0x4a46('0x10'));var Papa=require(_0x4a46('0x11'));var Redis=require('ioredis');var authService=require(_0x4a46('0x12'));var qs=require(_0x4a46('0x13'));var as=require(_0x4a46('0x14'));var hardwareService=require(_0x4a46('0x15'));var logger=require(_0x4a46('0x16'))(_0x4a46('0x17'));var utils=require(_0x4a46('0x18'));var config=require(_0x4a46('0x19'));var licenseUtil=require(_0x4a46('0x1a'));var db=require(_0x4a46('0x1b'))['db'];function respondWithStatusCode(_0x352b5f,_0x1a72c1){_0x1a72c1=_0x1a72c1||0xcc;return function(_0x14da1f){if(_0x14da1f){return _0x352b5f[_0x4a46('0x1c')](_0x1a72c1);}return _0x352b5f[_0x4a46('0x1d')](_0x1a72c1)[_0x4a46('0x1e')]();};}function respondWithResult(_0x2cbc93,_0x129cf4){_0x129cf4=_0x129cf4||0xc8;return function(_0x273ce3){if(_0x273ce3){return _0x2cbc93[_0x4a46('0x1d')](_0x129cf4)[_0x4a46('0x1f')](_0x273ce3);}};}function respondWithFilteredResult(_0x435673,_0x30eb54){return function(_0x10e12f){if(_0x10e12f){var _0x432b8b=typeof _0x30eb54[_0x4a46('0x20')]===_0x4a46('0x21')&&typeof _0x30eb54['limit']===_0x4a46('0x21');var _0xea41e=_0x10e12f[_0x4a46('0x22')];var _0x14c5e1=_0x432b8b?0x0:_0x30eb54[_0x4a46('0x20')];var _0x155ea8=_0x432b8b?_0x10e12f['count']:_0x30eb54[_0x4a46('0x20')]+_0x30eb54[_0x4a46('0x23')];var _0x413170;if(_0x155ea8>=_0xea41e){_0x155ea8=_0xea41e;_0x413170=0xc8;}else{_0x413170=0xce;}_0x435673[_0x4a46('0x1d')](_0x413170);return _0x435673['set'](_0x4a46('0x24'),_0x14c5e1+'-'+_0x155ea8+'/'+_0xea41e)[_0x4a46('0x1f')](_0x10e12f);}return null;};}function patchUpdates(_0x39d17a){return function(_0x229aa9){try{jsonpatch['apply'](_0x229aa9,_0x39d17a,!![]);}catch(_0x926973){return BPromise[_0x4a46('0x25')](_0x926973);}return _0x229aa9['save']();};}function saveUpdates(_0x83ca77,_0x1c8149){return function(_0x3c3f70){if(_0x3c3f70){return _0x3c3f70['update'](_0x83ca77)[_0x4a46('0x26')](function(_0x3d62ba){return _0x3d62ba;});}return null;};}function removeEntity(_0x102c6d,_0x22e3c8){return function(_0xd4212b){if(_0xd4212b){return _0xd4212b[_0x4a46('0x27')]()[_0x4a46('0x26')](function(){_0x102c6d['status'](0xcc)[_0x4a46('0x1e')]();});}};}function handleEntityNotFound(_0x32597e,_0x576bd8){return function(_0x2a0582){if(!_0x2a0582){_0x32597e['sendStatus'](0x194);}return _0x2a0582;};}function handleError(_0x475f76,_0xfc2214){_0xfc2214=_0xfc2214||0x1f4;return function(_0x3991e9){logger['error'](_0x3991e9[_0x4a46('0x28')]);if(_0x3991e9['name']){delete _0x3991e9['name'];}_0x475f76['status'](_0xfc2214)[_0x4a46('0x29')](_0x3991e9);};}function getMustacheRender(_0x4a29b8,_0x4c6f52){return Mustache[_0x4a46('0x2a')](_0x4a29b8,_[_0x4a46('0x2b')](_0x4c6f52[_0x4a46('0x2c')],{'contact':_0x4c6f52[_0x4a46('0x2d')],'message':_0x4c6f52[_0x4a46('0x2e')],'agent':_0x4c6f52[_0x4a46('0x2f')],'interaction':_0x4c6f52[_0x4a46('0x30')],'account':_0x4c6f52['account']}))||'';}exports[_0x4a46('0x31')]=function(_0x3b183e,_0x59bf2e){var _0x27d423={},_0xa941={},_0x3d9edd={'count':0x0,'rows':[]};var _0x276a3b=_[_0x4a46('0x32')](db['UserProfileSection'][_0x4a46('0x33')],function(_0x4aef89){return{'name':_0x4aef89['fieldName'],'type':_0x4aef89[_0x4a46('0x34')][_0x4a46('0x35')]};});_0xa941[_0x4a46('0x36')]=_[_0x4a46('0x32')](_0x276a3b,_0x4a46('0x37'));_0xa941[_0x4a46('0x38')]=_['keys'](_0x3b183e[_0x4a46('0x38')]);_0xa941[_0x4a46('0x39')]=_[_0x4a46('0x3a')](_0xa941['model'],_0xa941[_0x4a46('0x38')]);_0x27d423['attributes']=_[_0x4a46('0x3a')](_0xa941['model'],qs[_0x4a46('0x3b')](_0x3b183e[_0x4a46('0x38')][_0x4a46('0x3b')]));_0x27d423[_0x4a46('0x3c')]=_0x27d423[_0x4a46('0x3c')][_0x4a46('0x3d')]?_0x27d423[_0x4a46('0x3c')]:_0xa941[_0x4a46('0x36')];if(!_0x3b183e[_0x4a46('0x38')]['hasOwnProperty'](_0x4a46('0x3e'))){_0x27d423[_0x4a46('0x23')]=qs[_0x4a46('0x23')](_0x3b183e['query'][_0x4a46('0x23')]);_0x27d423[_0x4a46('0x20')]=qs[_0x4a46('0x20')](_0x3b183e[_0x4a46('0x38')][_0x4a46('0x20')]);}_0x27d423[_0x4a46('0x3f')]=qs[_0x4a46('0x40')](_0x3b183e['query'][_0x4a46('0x40')]);_0x27d423[_0x4a46('0x41')]=qs[_0x4a46('0x39')](_['pick'](_0x3b183e['query'],_0xa941[_0x4a46('0x39')]),_0x276a3b);if(_0x3b183e[_0x4a46('0x38')][_0x4a46('0x42')]){_0x27d423['where']=_[_0x4a46('0x2b')](_0x27d423[_0x4a46('0x41')],{'$or':_[_0x4a46('0x32')](_0x276a3b,function(_0x2bb941){if(_0x2bb941[_0x4a46('0x34')]!==_0x4a46('0x43')){var _0x19401c={};_0x19401c[_0x2bb941['name']]={'$like':'%'+_0x3b183e['query']['filter']+'%'};return _0x19401c;}})});}_0x27d423=_[_0x4a46('0x2b')]({},_0x27d423,_0x3b183e[_0x4a46('0x44')]);var _0x4bd529={'where':_0x27d423[_0x4a46('0x41')]};return db['UserProfileSection']['count'](_0x4bd529)[_0x4a46('0x26')](function(_0x4aea16){_0x3d9edd[_0x4a46('0x22')]=_0x4aea16;if(_0x3b183e['query'][_0x4a46('0x45')]){_0x27d423[_0x4a46('0x46')]=[{'all':!![]}];}return db[_0x4a46('0x47')][_0x4a46('0x48')](_0x27d423);})[_0x4a46('0x26')](function(_0x5bb424){_0x3d9edd[_0x4a46('0x49')]=_0x5bb424;return _0x3d9edd;})[_0x4a46('0x26')](respondWithFilteredResult(_0x59bf2e,_0x27d423))[_0x4a46('0x4a')](handleError(_0x59bf2e,null));};exports['show']=function(_0x2ebba8,_0x4511fb){var _0x1833aa={'raw':![],'where':{'id':_0x2ebba8[_0x4a46('0x4b')]['id']}},_0x1a35d3={};_0x1a35d3[_0x4a46('0x36')]=_[_0x4a46('0x4c')](db['UserProfileSection'][_0x4a46('0x33')]);_0x1a35d3[_0x4a46('0x38')]=_[_0x4a46('0x4c')](_0x2ebba8[_0x4a46('0x38')]);_0x1a35d3[_0x4a46('0x39')]=_[_0x4a46('0x3a')](_0x1a35d3[_0x4a46('0x36')],_0x1a35d3[_0x4a46('0x38')]);_0x1833aa['attributes']=_[_0x4a46('0x3a')](_0x1a35d3[_0x4a46('0x36')],qs[_0x4a46('0x3b')](_0x2ebba8[_0x4a46('0x38')][_0x4a46('0x3b')]));_0x1833aa[_0x4a46('0x3c')]=_0x1833aa['attributes']['length']?_0x1833aa[_0x4a46('0x3c')]:_0x1a35d3[_0x4a46('0x36')];if(_0x2ebba8[_0x4a46('0x38')][_0x4a46('0x45')]){_0x1833aa[_0x4a46('0x46')]=[{'all':!![]}];}_0x1833aa=_['merge']({},_0x1833aa,_0x2ebba8[_0x4a46('0x44')]);return db[_0x4a46('0x47')][_0x4a46('0x4d')](_0x1833aa)[_0x4a46('0x26')](handleEntityNotFound(_0x4511fb,null))[_0x4a46('0x26')](respondWithResult(_0x4511fb,null))[_0x4a46('0x4a')](handleError(_0x4511fb,null));};exports[_0x4a46('0x4e')]=function(_0x4e9e87,_0x556342){return db[_0x4a46('0x47')][_0x4a46('0x4e')](_0x4e9e87[_0x4a46('0x2c')],{})[_0x4a46('0x26')](respondWithResult(_0x556342,0xc9))[_0x4a46('0x4a')](handleError(_0x556342,null));};exports['update']=function(_0x57b466,_0x4d02ff){if(_0x57b466[_0x4a46('0x2c')]['id']){delete _0x57b466[_0x4a46('0x2c')]['id'];}return db[_0x4a46('0x47')]['find']({'where':{'id':_0x57b466['params']['id']}})['then'](handleEntityNotFound(_0x4d02ff,null))['then'](saveUpdates(_0x57b466[_0x4a46('0x2c')],null))[_0x4a46('0x26')](respondWithResult(_0x4d02ff,null))[_0x4a46('0x4a')](handleError(_0x4d02ff,null));};exports[_0x4a46('0x27')]=function(_0x2d784c,_0x4857b7){return db[_0x4a46('0x47')]['find']({'where':{'id':_0x2d784c[_0x4a46('0x4b')]['id']}})[_0x4a46('0x26')](handleEntityNotFound(_0x4857b7,null))[_0x4a46('0x26')](removeEntity(_0x4857b7,null))[_0x4a46('0x4a')](handleError(_0x4857b7,null));};exports[_0x4a46('0x4f')]=function(_0x398a3a,_0x357f09){return db[_0x4a46('0x47')][_0x4a46('0x4f')]()[_0x4a46('0x26')](respondWithResult(_0x357f09,null))[_0x4a46('0x4a')](handleError(_0x357f09,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 279cb3f..4cc330d 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 _0x53d1=['compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileSection'];(function(_0x33b6cc,_0x481aa5){var _0x21a721=function(_0x37fbb1){while(--_0x37fbb1){_0x33b6cc['push'](_0x33b6cc['shift']());}};_0x21a721(++_0x481aa5);}(_0x53d1,0xc6));var _0x153d=function(_0x2783d2,_0x5c0947){_0x2783d2=_0x2783d2-0x0;var _0x4077eb=_0x53d1[_0x2783d2];return _0x4077eb;};'use strict';var _=require(_0x153d('0x0'));var util=require(_0x153d('0x1'));var logger=require(_0x153d('0x2'))(_0x153d('0x3'));var moment=require(_0x153d('0x4'));var BPromise=require('bluebird');var rp=require(_0x153d('0x5'));var fs=require('fs');var path=require(_0x153d('0x6'));var rimraf=require(_0x153d('0x7'));var config=require(_0x153d('0x8'));var attributes=require('./userProfileSection.attributes');module[_0x153d('0x9')]=function(_0x5056d1,_0xd02876){return _0x5056d1[_0x153d('0xa')](_0x153d('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x153d('0xc'),'fields':[_0x153d('0xd'),_0x153d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe5b5=['path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xe1b5f6,_0x210c09){var _0x44636e=function(_0x3a3212){while(--_0x3a3212){_0xe1b5f6['push'](_0xe1b5f6['shift']());}};_0x44636e(++_0x210c09);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0xe5b5[_0x7d62cb];return _0x3a6266;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var logger=require(_0x5e5b('0x2'))(_0x5e5b('0x3'));var moment=require(_0x5e5b('0x4'));var BPromise=require(_0x5e5b('0x5'));var rp=require(_0x5e5b('0x6'));var fs=require('fs');var path=require(_0x5e5b('0x7'));var rimraf=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var attributes=require(_0x5e5b('0xa'));module[_0x5e5b('0xb')]=function(_0xf1fbe2,_0x11e0e0){return _0xf1fbe2[_0x5e5b('0xc')](_0x5e5b('0xd'),attributes,{'tableName':_0x5e5b('0xe'),'paranoid':![],'indexes':[{'name':_0x5e5b('0xf'),'fields':[_0x5e5b('0x10'),_0x5e5b('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index efee537..e0db765 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 _0xf324=['error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xf324,0xa6));var _0x4f32=function(_0x3677b3,_0x462bc9){_0x3677b3=_0x3677b3-0x0;var _0x394a1b=_0xf324[_0x3677b3];return _0x394a1b;};'use strict';var _=require(_0x4f32('0x0'));var util=require(_0x4f32('0x1'));var moment=require(_0x4f32('0x2'));var BPromise=require(_0x4f32('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f32('0x4'));var db=require(_0x4f32('0x5'))['db'];var utils=require(_0x4f32('0x6'));var logger=require(_0x4f32('0x7'))(_0x4f32('0x8'));var config=require(_0x4f32('0x9'));var jayson=require(_0x4f32('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x238d8a,_0x21aae7,_0x13db17){return new BPromise(function(_0x282908,_0x59315b){return client[_0x4f32('0xb')](_0x238d8a,_0x13db17)[_0x4f32('0xc')](function(_0x35c85c){logger[_0x4f32('0xd')](_0x4f32('0xe'),_0x21aae7,_0x4f32('0xf'));logger[_0x4f32('0x10')](_0x4f32('0x11'),_0x21aae7,_0x4f32('0xf'),JSON['stringify'](_0x35c85c));if(_0x35c85c['error']){if(_0x35c85c[_0x4f32('0x12')][_0x4f32('0x13')]===0x1f4){logger['error'](_0x4f32('0xe'),_0x21aae7,_0x35c85c[_0x4f32('0x12')][_0x4f32('0x14')]);return _0x59315b(_0x35c85c[_0x4f32('0x12')][_0x4f32('0x14')]);}logger[_0x4f32('0x12')](_0x4f32('0xe'),_0x21aae7,_0x35c85c[_0x4f32('0x12')][_0x4f32('0x14')]);return _0x282908(_0x35c85c['error'][_0x4f32('0x14')]);}else{logger[_0x4f32('0xd')](_0x4f32('0xe'),_0x21aae7,'request\x20sent');_0x282908(_0x35c85c[_0x4f32('0x15')]['message']);}})[_0x4f32('0x16')](function(_0x2edd50){logger[_0x4f32('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x21aae7,_0x2edd50);_0x59315b(_0x2edd50);});});} \ No newline at end of file +var _0x2ee9=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','message','UserProfileSection,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x2f7c40,_0xb36203){var _0x57a4a5=function(_0x47db35){while(--_0x47db35){_0x2f7c40['push'](_0x2f7c40['shift']());}};_0x57a4a5(++_0xb36203);}(_0x2ee9,0x78));var _0x92ee=function(_0x183e16,_0x20e28e){_0x183e16=_0x183e16-0x0;var _0x497e20=_0x2ee9[_0x183e16];return _0x497e20;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x92ee('0x0'));var BPromise=require(_0x92ee('0x1'));var rs=require(_0x92ee('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x92ee('0x4'))(_0x92ee('0x5'));var config=require(_0x92ee('0x6'));var jayson=require(_0x92ee('0x7'));var client=jayson[_0x92ee('0x8')][_0x92ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x161437,_0x33c246,_0x9b0f3){return new BPromise(function(_0x51e44f,_0x1a442d){return client[_0x92ee('0xa')](_0x161437,_0x9b0f3)[_0x92ee('0xb')](function(_0xf7ca9a){logger[_0x92ee('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x33c246,'request\x20sent');logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x33c246,_0x92ee('0xd'),JSON[_0x92ee('0xe')](_0xf7ca9a));if(_0xf7ca9a[_0x92ee('0xf')]){if(_0xf7ca9a[_0x92ee('0xf')][_0x92ee('0x10')]===0x1f4){logger[_0x92ee('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x33c246,_0xf7ca9a['error'][_0x92ee('0x11')]);return _0x1a442d(_0xf7ca9a[_0x92ee('0xf')][_0x92ee('0x11')]);}logger[_0x92ee('0xf')](_0x92ee('0x12'),_0x33c246,_0xf7ca9a[_0x92ee('0xf')][_0x92ee('0x11')]);return _0x51e44f(_0xf7ca9a[_0x92ee('0xf')]['message']);}else{logger[_0x92ee('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x33c246,_0x92ee('0xd'));_0x51e44f(_0xf7ca9a[_0x92ee('0x13')]['message']);}})[_0x92ee('0x14')](function(_0x77ab09){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x33c246,_0x77ab09);_0x1a442d(_0x77ab09);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 596cc17..2c58fad 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 _0x065e=['fs-extra','../../config/environment','exports','multer','express','Router'];(function(_0x12b10e,_0x171796){var _0x31d073=function(_0x180585){while(--_0x180585){_0x12b10e['push'](_0x12b10e['shift']());}};_0x31d073(++_0x171796);}(_0x065e,0x1a7));var _0xe065=function(_0x479127,_0x43686d){_0x479127=_0x479127-0x0;var _0x16eb43=_0x065e[_0x479127];return _0x16eb43;};'use strict';var multer=require(_0xe065('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe065('0x1'));var router=express[_0xe065('0x2')]();var fs_extra=require(_0xe065('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe065('0x4'));module[_0xe065('0x5')]=router; \ No newline at end of file +var _0xefe3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','multer'];(function(_0x2a8c9d,_0x2193da){var _0x29fbc0=function(_0x4b410f){while(--_0x4b410f){_0x2a8c9d['push'](_0x2a8c9d['shift']());}};_0x29fbc0(++_0x2193da);}(_0xefe3,0xf5));var _0x3efe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xefe3[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x3efe('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3efe('0x1'));var router=express[_0x3efe('0x2')]();var fs_extra=require(_0x3efe('0x3'));var auth=require(_0x3efe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3efe('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 6bb60e0..a2c128e 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 _0xd8b0=['exports','sequelize'];(function(_0x2f4de8,_0x313395){var _0x4569cb=function(_0x17572f){while(--_0x17572f){_0x2f4de8['push'](_0x2f4de8['shift']());}};_0x4569cb(++_0x313395);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x4ae459,_0x3bf329){var _0x51d0c9=function(_0x1ce66b){while(--_0x1ce66b){_0x4ae459['push'](_0x4ae459['shift']());}};_0x51d0c9(++_0x3bf329);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index fcbc3a3..b99871f 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 _0xe6f2=['rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','../../config/logger','api','bluebird','request-promise'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xe6f2,0x1dc));var _0x2e6f=function(_0x1b59e6,_0x14fb03){_0x1b59e6=_0x1b59e6-0x0;var _0x3f1673=_0xe6f2[_0x1b59e6];return _0x3f1673;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2e6f('0x0'))(_0x2e6f('0x1'));var moment=require('moment');var BPromise=require(_0x2e6f('0x2'));var rp=require(_0x2e6f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e6f('0x4'));var config=require(_0x2e6f('0x5'));var attributes=require(_0x2e6f('0x6'));module[_0x2e6f('0x7')]=function(_0x47ec14,_0x2bdcff){return _0x47ec14[_0x2e6f('0x8')](_0x2e6f('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d88=['define','user_has_sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x590f85,_0x75df3d){var _0x407f13=function(_0x205100){while(--_0x205100){_0x590f85['push'](_0x590f85['shift']());}};_0x407f13(++_0x75df3d);}(_0x2d88,0x116));var _0x82d8=function(_0x5ddda9,_0x43e558){_0x5ddda9=_0x5ddda9-0x0;var _0x53a004=_0x2d88[_0x5ddda9];return _0x53a004;};'use strict';var _=require(_0x82d8('0x0'));var util=require('util');var logger=require(_0x82d8('0x1'))(_0x82d8('0x2'));var moment=require(_0x82d8('0x3'));var BPromise=require(_0x82d8('0x4'));var rp=require(_0x82d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82d8('0x6'));var config=require(_0x82d8('0x7'));var attributes=require(_0x82d8('0x8'));module[_0x82d8('0x9')]=function(_0x151c24,_0x395d85){return _0x151c24[_0x82d8('0xa')]('UserSmsQueue',attributes,{'tableName':_0x82d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index b10f13a..27b82c1 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 _0x94d5=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../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','code','message','result','catch','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x94d5,0xe5));var _0x594d=function(_0xae460b,_0x390965){_0xae460b=_0xae460b-0x0;var _0x251c19=_0x94d5[_0xae460b];return _0x251c19;};'use strict';var _=require(_0x594d('0x0'));var util=require('util');var moment=require(_0x594d('0x1'));var BPromise=require(_0x594d('0x2'));var rs=require(_0x594d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x594d('0x4'))['db'];var utils=require(_0x594d('0x5'));var logger=require('../../config/logger')(_0x594d('0x6'));var config=require(_0x594d('0x7'));var jayson=require(_0x594d('0x8'));var client=jayson[_0x594d('0x9')][_0x594d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37d52b,_0x211b07,_0x441973){return new BPromise(function(_0x5e985d,_0x1e391e){return client[_0x594d('0xb')](_0x37d52b,_0x441973)[_0x594d('0xc')](function(_0x57e728){logger[_0x594d('0xd')](_0x594d('0xe'),_0x211b07,_0x594d('0xf'));logger[_0x594d('0x10')](_0x594d('0x11'),_0x211b07,_0x594d('0xf'),JSON['stringify'](_0x57e728));if(_0x57e728[_0x594d('0x12')]){if(_0x57e728[_0x594d('0x12')][_0x594d('0x13')]===0x1f4){logger[_0x594d('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x211b07,_0x57e728[_0x594d('0x12')][_0x594d('0x14')]);return _0x1e391e(_0x57e728['error'][_0x594d('0x14')]);}logger[_0x594d('0x12')](_0x594d('0xe'),_0x211b07,_0x57e728['error'][_0x594d('0x14')]);return _0x5e985d(_0x57e728[_0x594d('0x12')][_0x594d('0x14')]);}else{logger[_0x594d('0xd')](_0x594d('0xe'),_0x211b07,_0x594d('0xf'));_0x5e985d(_0x57e728[_0x594d('0x15')][_0x594d('0x14')]);}})[_0x594d('0x16')](function(_0x275a84){logger['error'](_0x594d('0xe'),_0x211b07,_0x275a84);_0x1e391e(_0x275a84);});});} \ No newline at end of file +var _0x4e12=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment'];(function(_0x62507b,_0x49420b){var _0x3c5574=function(_0x43780f){while(--_0x43780f){_0x62507b['push'](_0x62507b['shift']());}};_0x3c5574(++_0x49420b);}(_0x4e12,0x129));var _0x24e1=function(_0x48caf5,_0x56b3b9){_0x48caf5=_0x48caf5-0x0;var _0x4169a5=_0x4e12[_0x48caf5];return _0x4169a5;};'use strict';var _=require('lodash');var util=require(_0x24e1('0x0'));var moment=require(_0x24e1('0x1'));var BPromise=require(_0x24e1('0x2'));var rs=require(_0x24e1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24e1('0x4'))['db'];var utils=require(_0x24e1('0x5'));var logger=require(_0x24e1('0x6'))(_0x24e1('0x7'));var config=require(_0x24e1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24e1('0x9')][_0x24e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35e339,_0x30eb69,_0x28ae35){return new BPromise(function(_0x271301,_0x29ec73){return client[_0x24e1('0xb')](_0x35e339,_0x28ae35)[_0x24e1('0xc')](function(_0x4f18ae){logger[_0x24e1('0xd')](_0x24e1('0xe'),_0x30eb69,_0x24e1('0xf'));logger[_0x24e1('0x10')](_0x24e1('0x11'),_0x30eb69,'request\x20sent',JSON[_0x24e1('0x12')](_0x4f18ae));if(_0x4f18ae[_0x24e1('0x13')]){if(_0x4f18ae[_0x24e1('0x13')][_0x24e1('0x14')]===0x1f4){logger[_0x24e1('0x13')](_0x24e1('0xe'),_0x30eb69,_0x4f18ae['error']['message']);return _0x29ec73(_0x4f18ae['error'][_0x24e1('0x15')]);}logger[_0x24e1('0x13')](_0x24e1('0xe'),_0x30eb69,_0x4f18ae[_0x24e1('0x13')][_0x24e1('0x15')]);return _0x271301(_0x4f18ae['error'][_0x24e1('0x15')]);}else{logger[_0x24e1('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x30eb69,_0x24e1('0xf'));_0x271301(_0x4f18ae['result']['message']);}})[_0x24e1('0x16')](function(_0x490f78){logger[_0x24e1('0x13')](_0x24e1('0xe'),_0x30eb69,_0x490f78);_0x29ec73(_0x490f78);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 0b20801..bcde1b4 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 _0x3423=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','path','connect-timeout','express','Router'];(function(_0xe1063b,_0x49f6a5){var _0x3f79b1=function(_0x1c0f8e){while(--_0x1c0f8e){_0xe1063b['push'](_0xe1063b['shift']());}};_0x3f79b1(++_0x49f6a5);}(_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'));module[_0x3342('0x8')]=router; \ No newline at end of file +var _0x1399=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x169be2,_0x478d76){var _0x12e475=function(_0x2de996){while(--_0x2de996){_0x169be2['push'](_0x169be2['shift']());}};_0x12e475(++_0x478d76);}(_0x1399,0x16c));var _0x9139=function(_0x1f43f4,_0x16d500){_0x1f43f4=_0x1f43f4-0x0;var _0x5435b7=_0x1399[_0x1f43f4];return _0x5435b7;};'use strict';var multer=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var path=require('path');var timeout=require(_0x9139('0x2'));var express=require('express');var router=express[_0x9139('0x3')]();var fs_extra=require(_0x9139('0x4'));var auth=require(_0x9139('0x5'));var interaction=require(_0x9139('0x6'));var config=require(_0x9139('0x7'));module[_0x9139('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 1092bce..207b08a 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 _0xbaf0=['exports','INTEGER'];(function(_0x4fbaf9,_0x3b8190){var _0x1d89a0=function(_0x3b650b){while(--_0x3b650b){_0x4fbaf9['push'](_0x4fbaf9['shift']());}};_0x1d89a0(++_0x3b8190);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0xb7386a,_0x29c5ad){var _0x3344e4=function(_0x391d2d){while(--_0x391d2d){_0xb7386a['push'](_0xb7386a['shift']());}};_0x3344e4(++_0x29c5ad);}(_0xe706,0xa3));var _0x6e70=function(_0x1704d5,_0x1f1740){_0x1704d5=_0x1704d5-0x0;var _0x58b71d=_0xe706[_0x1704d5];return _0x58b71d;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index c1b0ba1..b95c455 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 _0x4bc3=['./userVoiceQueue.attributes','exports','define','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x51b185,_0x4844a2){var _0x927be9=function(_0x3e9cc7){while(--_0x3e9cc7){_0x51b185['push'](_0x51b185['shift']());}};_0x927be9(++_0x4844a2);}(_0x4bc3,0x16e));var _0x34bc=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x4bc3[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var logger=require('../../config/logger')(_0x34bc('0x2'));var moment=require(_0x34bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x34bc('0x4'));var fs=require('fs');var path=require(_0x34bc('0x5'));var rimraf=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var attributes=require(_0x34bc('0x8'));module[_0x34bc('0x9')]=function(_0x2cc9c2,_0x4c63a1){return _0x2cc9c2[_0x34bc('0xa')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf006=['bluebird','path','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','../../config/logger','api'];(function(_0x7f6cdf,_0x715e63){var _0x2ddd9c=function(_0x35c901){while(--_0x35c901){_0x7f6cdf['push'](_0x7f6cdf['shift']());}};_0x2ddd9c(++_0x715e63);}(_0xf006,0x146));var _0x6f00=function(_0x2d3420,_0x11202b){_0x2d3420=_0x2d3420-0x0;var _0x2a5377=_0xf006[_0x2d3420];return _0x2a5377;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f00('0x0'))(_0x6f00('0x1'));var moment=require('moment');var BPromise=require(_0x6f00('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f00('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6f00('0x4'));module[_0x6f00('0x5')]=function(_0x141e71,_0x52c9a2){return _0x141e71[_0x6f00('0x6')]('UserVoiceQueue',attributes,{'tableName':_0x6f00('0x7'),'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 a3642eb..05adb02 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 _0xcb0a=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message','UserVoiceQueue,\x20%s,\x20%s','catch','moment','bluebird','randomstring','ioredis'];(function(_0x37f541,_0x383ef3){var _0x1f4c18=function(_0x2f165f){while(--_0x2f165f){_0x37f541['push'](_0x37f541['shift']());}};_0x1f4c18(++_0x383ef3);}(_0xcb0a,0x1df));var _0xacb0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xcb0a[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xacb0('0x0'));var BPromise=require(_0xacb0('0x1'));var rs=require(_0xacb0('0x2'));var fs=require('fs');var Redis=require(_0xacb0('0x3'));var db=require(_0xacb0('0x4'))['db'];var utils=require(_0xacb0('0x5'));var logger=require('../../config/logger')(_0xacb0('0x6'));var config=require(_0xacb0('0x7'));var jayson=require(_0xacb0('0x8'));var client=jayson[_0xacb0('0x9')][_0xacb0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x452f7a,_0x490c5b,_0x198200){return new BPromise(function(_0x455229,_0x29d6b7){return client['request'](_0x452f7a,_0x198200)[_0xacb0('0xb')](function(_0x4bcfa0){logger[_0xacb0('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x490c5b,_0xacb0('0xd'));logger[_0xacb0('0xe')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x490c5b,_0xacb0('0xd'),JSON[_0xacb0('0xf')](_0x4bcfa0));if(_0x4bcfa0[_0xacb0('0x10')]){if(_0x4bcfa0['error'][_0xacb0('0x11')]===0x1f4){logger[_0xacb0('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x490c5b,_0x4bcfa0['error'][_0xacb0('0x12')]);return _0x29d6b7(_0x4bcfa0[_0xacb0('0x10')][_0xacb0('0x12')]);}logger[_0xacb0('0x10')](_0xacb0('0x13'),_0x490c5b,_0x4bcfa0['error']['message']);return _0x455229(_0x4bcfa0[_0xacb0('0x10')]['message']);}else{logger['info'](_0xacb0('0x13'),_0x490c5b,_0xacb0('0xd'));_0x455229(_0x4bcfa0['result']['message']);}})[_0xacb0('0x14')](function(_0x3ab714){logger[_0xacb0('0x10')](_0xacb0('0x13'),_0x490c5b,_0x3ab714);_0x29d6b7(_0x3ab714);});});} \ No newline at end of file +var _0x54e2=['debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0xc397d5,_0x166972){var _0x258729=function(_0x211494){while(--_0x211494){_0xc397d5['push'](_0xc397d5['shift']());}};_0x258729(++_0x166972);}(_0x54e2,0x192));var _0x254e=function(_0x5e8455,_0x41b383){_0x5e8455=_0x5e8455-0x0;var _0x2f8957=_0x54e2[_0x5e8455];return _0x2f8957;};'use strict';var _=require(_0x254e('0x0'));var util=require(_0x254e('0x1'));var moment=require(_0x254e('0x2'));var BPromise=require(_0x254e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x254e('0x4'));var db=require(_0x254e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x254e('0x6'))(_0x254e('0x7'));var config=require(_0x254e('0x8'));var jayson=require(_0x254e('0x9'));var client=jayson[_0x254e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x361dcb,_0x3e44b5,_0x340cf2){return new BPromise(function(_0x32e44e,_0x4e1900){return client[_0x254e('0xb')](_0x361dcb,_0x340cf2)[_0x254e('0xc')](function(_0x1d9624){logger[_0x254e('0xd')](_0x254e('0xe'),_0x3e44b5,_0x254e('0xf'));logger[_0x254e('0x10')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3e44b5,_0x254e('0xf'),JSON[_0x254e('0x11')](_0x1d9624));if(_0x1d9624['error']){if(_0x1d9624[_0x254e('0x12')][_0x254e('0x13')]===0x1f4){logger[_0x254e('0x12')](_0x254e('0xe'),_0x3e44b5,_0x1d9624[_0x254e('0x12')][_0x254e('0x14')]);return _0x4e1900(_0x1d9624[_0x254e('0x12')][_0x254e('0x14')]);}logger[_0x254e('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x3e44b5,_0x1d9624[_0x254e('0x12')]['message']);return _0x32e44e(_0x1d9624[_0x254e('0x12')][_0x254e('0x14')]);}else{logger[_0x254e('0xd')](_0x254e('0xe'),_0x3e44b5,_0x254e('0xf'));_0x32e44e(_0x1d9624[_0x254e('0x15')][_0x254e('0x14')]);}})['catch'](function(_0x216210){logger[_0x254e('0x12')](_0x254e('0xe'),_0x3e44b5,_0x216210);_0x4e1900(_0x216210);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 44fce5b..a26898b 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 _0x7033=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x27f154,_0x2c11d4){var _0x2b3005=function(_0x4c9fda){while(--_0x4c9fda){_0x27f154['push'](_0x27f154['shift']());}};_0x2b3005(++_0x2c11d4);}(_0x7033,0x19e));var _0x3703=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7033[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x3703('0x0'));var util=require(_0x3703('0x1'));var path=require(_0x3703('0x2'));var timeout=require(_0x3703('0x3'));var express=require('express');var router=express[_0x3703('0x4')]();var fs_extra=require(_0x3703('0x5'));var auth=require(_0x3703('0x6'));var interaction=require(_0x3703('0x7'));var config=require(_0x3703('0x8'));module[_0x3703('0x9')]=router; \ No newline at end of file +var _0xd61e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x158b55,_0x516baf){var _0x1cee23=function(_0xb7240){while(--_0xb7240){_0x158b55['push'](_0x158b55['shift']());}};_0x1cee23(++_0x516baf);}(_0xd61e,0x13d));var _0xed61=function(_0x2d8907,_0x507fe8){_0x2d8907=_0x2d8907-0x0;var _0x5f5587=_0xd61e[_0x2d8907];return _0x5f5587;};'use strict';var multer=require(_0xed61('0x0'));var util=require(_0xed61('0x1'));var path=require(_0xed61('0x2'));var timeout=require(_0xed61('0x3'));var express=require(_0xed61('0x4'));var router=express[_0xed61('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xed61('0x6'));var interaction=require(_0xed61('0x7'));var config=require(_0xed61('0x8'));module[_0xed61('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 cdd7889..8e12fa0 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 _0x5d48=['INTEGER','queue_interface','sequelize','exports','Required\x20by\x20Asterisk','STRING'];(function(_0x2280c3,_0x1771f6){var _0x1850ee=function(_0x32fbbd){while(--_0x32fbbd){_0x2280c3['push'](_0x2280c3['shift']());}};_0x1850ee(++_0x1771f6);}(_0x5d48,0x176));var _0x85d4=function(_0x3fe66b,_0x119bf3){_0x3fe66b=_0x3fe66b-0x0;var _0x5232e5=_0x5d48[_0x3fe66b];return _0x5232e5;};'use strict';var Sequelize=require(_0x85d4('0x0'));module[_0x85d4('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x85d4('0x2')},'membername':{'type':Sequelize[_0x85d4('0x3')],'allowNull':![],'comment':_0x85d4('0x2')},'UserId':{'type':Sequelize[_0x85d4('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x85d4('0x3')],'allowNull':![],'unique':_0x85d4('0x5'),'comment':_0x85d4('0x2')},'VoiceQueueId':{'type':Sequelize[_0x85d4('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0x85d4('0x3')],'allowNull':![],'unique':_0x85d4('0x5'),'comment':_0x85d4('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x85d4('0x2')},'paused':{'type':Sequelize[_0x85d4('0x4')](0xb),'defaultValue':0x0,'comment':_0x85d4('0x2')}}; \ No newline at end of file +var _0x96bf=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x2d8864,_0x34171a){var _0x435a6a=function(_0x3deecd){while(--_0x3deecd){_0x2d8864['push'](_0x2d8864['shift']());}};_0x435a6a(++_0x34171a);}(_0x96bf,0x74));var _0xf96b=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x96bf[_0x4dcc2d];return _0x1bbd79;};'use strict';var Sequelize=require(_0xf96b('0x0'));module[_0xf96b('0x1')]={'uniqueid':{'type':Sequelize[_0xf96b('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xf96b('0x3')},'membername':{'type':Sequelize[_0xf96b('0x4')],'allowNull':![],'comment':_0xf96b('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf96b('0x4')],'allowNull':![],'unique':_0xf96b('0x5'),'comment':_0xf96b('0x3')},'VoiceQueueId':{'type':Sequelize[_0xf96b('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xf96b('0x4')],'allowNull':![],'unique':_0xf96b('0x5'),'comment':_0xf96b('0x3')},'penalty':{'type':Sequelize[_0xf96b('0x2')](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 8b422b9..3c9841a 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 _0xae0f=['update','remove','emit','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x13661b,_0x5b9930){var _0x208ea2=function(_0x5d35ae){while(--_0x5d35ae){_0x13661b['push'](_0x13661b['shift']());}};_0x208ea2(++_0x5b9930);}(_0xae0f,0xb8));var _0xfae0=function(_0xf386e4,_0x84f7de){_0xf386e4=_0xf386e4-0x0;var _0x2651f3=_0xae0f[_0xf386e4];return _0x2651f3;};'use strict';var EventEmitter=require(_0xfae0('0x0'));var UserVoiceQueueRt=require(_0xfae0('0x1'))['db'][_0xfae0('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xfae0('0x3')](0x0);var events={'afterCreate':_0xfae0('0x4'),'afterUpdate':_0xfae0('0x5'),'afterDestroy':_0xfae0('0x6')};function emitEvent(_0x2c0f02){return function(_0xe5c10c,_0x242551,_0x2eec9e){UserVoiceQueueRtEvents['emit'](_0x2c0f02+':'+_0xe5c10c['id'],_0xe5c10c);UserVoiceQueueRtEvents[_0xfae0('0x7')](_0x2c0f02,_0xe5c10c);_0x2eec9e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xfae0('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x606e=['save','update','remove','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0xc95c08,_0x5ed3e3){var _0xac63e9=function(_0x3289ef){while(--_0x3289ef){_0xc95c08['push'](_0xc95c08['shift']());}};_0xac63e9(++_0x5ed3e3);}(_0x606e,0x75));var _0xe606=function(_0x5b8310,_0x77ea6f){_0x5b8310=_0x5b8310-0x0;var _0xd3ebc1=_0x606e[_0x5b8310];return _0xd3ebc1;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xe606('0x0'))['db'][_0xe606('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xe606('0x2')](0x0);var events={'afterCreate':_0xe606('0x3'),'afterUpdate':_0xe606('0x4'),'afterDestroy':_0xe606('0x5')};function emitEvent(_0x37886e){return function(_0x1faf2f,_0x5b7ef2,_0x147f36){UserVoiceQueueRtEvents['emit'](_0x37886e+':'+_0x1faf2f['id'],_0x1faf2f);UserVoiceQueueRtEvents['emit'](_0x37886e,_0x1faf2f);_0x147f36(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xe606('0x6')](e,emitEvent(event));}}module[_0xe606('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index d7edadf..cdf43c7 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 _0x6e10=['UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x2e038a,_0x9d0199){var _0x512cc1=function(_0x341d82){while(--_0x341d82){_0x2e038a['push'](_0x2e038a['shift']());}};_0x512cc1(++_0x9d0199);}(_0x6e10,0xa7));var _0x06e1=function(_0xb6cb8d,_0x50f15c){_0xb6cb8d=_0xb6cb8d-0x0;var _0x2e5cd3=_0x6e10[_0xb6cb8d];return _0x2e5cd3;};'use strict';var _=require(_0x06e1('0x0'));var util=require(_0x06e1('0x1'));var logger=require('../../config/logger')(_0x06e1('0x2'));var moment=require('moment');var BPromise=require(_0x06e1('0x3'));var rp=require(_0x06e1('0x4'));var fs=require('fs');var path=require(_0x06e1('0x5'));var rimraf=require('rimraf');var config=require(_0x06e1('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x06e1('0x7')]=function(_0x271eca,_0x52e922){return _0x271eca[_0x06e1('0x8')](_0x06e1('0x9'),attributes,{'tableName':_0x06e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc88c=['../../config/logger','api','path','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash'];(function(_0xa08526,_0xd2a376){var _0x2684eb=function(_0x2bfe3a){while(--_0x2bfe3a){_0xa08526['push'](_0xa08526['shift']());}};_0x2684eb(++_0xd2a376);}(_0xc88c,0x187));var _0xcc88=function(_0x5de446,_0x2c10ee){_0x5de446=_0x5de446-0x0;var _0x3b23fd=_0xc88c[_0x5de446];return _0x3b23fd;};'use strict';var _=require(_0xcc88('0x0'));var util=require('util');var logger=require(_0xcc88('0x1'))(_0xcc88('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc88('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0xcc88('0x4')]=function(_0x433714,_0x7aa967){return _0x433714[_0xcc88('0x5')](_0xcc88('0x6'),attributes,{'tableName':_0xcc88('0x7'),'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 5f6f2a5..cb4267d 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 _0x000d=['sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','message','catch','GetVoiceQueueRtPauses','options','raw','where'];(function(_0x37edae,_0x3dee50){var _0x1a0975=function(_0x4ca0de){while(--_0x4ca0de){_0x37edae['push'](_0x37edae['shift']());}};_0x1a0975(++_0x3dee50);}(_0x000d,0x191));var _0xd000=function(_0x232b2f,_0x155e32){_0x232b2f=_0x232b2f-0x0;var _0x4a9b16=_0x000d[_0x232b2f];return _0x4a9b16;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd000('0x0'));var BPromise=require(_0xd000('0x1'));var rs=require(_0xd000('0x2'));var fs=require('fs');var Redis=require(_0xd000('0x3'));var db=require(_0xd000('0x4'))['db'];var utils=require(_0xd000('0x5'));var logger=require(_0xd000('0x6'))(_0xd000('0x7'));var config=require(_0xd000('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd000('0x9')][_0xd000('0xa')]({'port':0x232a});config[_0xd000('0xb')]=_['defaults'](config[_0xd000('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd000('0xc'))(new Redis(config[_0xd000('0xb')]));require('./userVoiceQueueRt.socket')[_0xd000('0xd')](socket);function respondWithRpcPromise(_0x568996,_0x3f699a,_0x2699f8){return new BPromise(function(_0x1523ef,_0x436f62){return client[_0xd000('0xe')](_0x568996,_0x2699f8)[_0xd000('0xf')](function(_0x21e038){logger[_0xd000('0x10')](_0xd000('0x11'),_0x3f699a,_0xd000('0x12'));logger[_0xd000('0x13')](_0xd000('0x14'),_0x3f699a,'request\x20sent',JSON['stringify'](_0x21e038));if(_0x21e038[_0xd000('0x15')]){if(_0x21e038[_0xd000('0x15')]['code']===0x1f4){logger[_0xd000('0x15')](_0xd000('0x11'),_0x3f699a,_0x21e038[_0xd000('0x15')][_0xd000('0x16')]);return _0x436f62(_0x21e038[_0xd000('0x15')][_0xd000('0x16')]);}logger[_0xd000('0x15')](_0xd000('0x11'),_0x3f699a,_0x21e038['error'][_0xd000('0x16')]);return _0x1523ef(_0x21e038['error'][_0xd000('0x16')]);}else{logger['info'](_0xd000('0x11'),_0x3f699a,_0xd000('0x12'));_0x1523ef(_0x21e038['result'][_0xd000('0x16')]);}})[_0xd000('0x17')](function(_0x139c33){logger[_0xd000('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3f699a,_0x139c33);_0x436f62(_0x139c33);});});}exports[_0xd000('0x18')]=function(_0x57d538){var _0x4f3b73=this;return new Promise(function(_0x4db0a8,_0x4ee0f6){return db['UserVoiceQueueRt']['findAll']({'raw':_0x57d538[_0xd000('0x19')]?_0x57d538['options'][_0xd000('0x1a')]===undefined?!![]:![]:!![],'where':_0x57d538[_0xd000('0x19')]?_0x57d538[_0xd000('0x19')][_0xd000('0x1b')]||null:null,'attributes':[[db[_0xd000('0x1c')]['fn']('COUNT',db[_0xd000('0x1c')]['fn']('IF',db[_0xd000('0x1c')][_0xd000('0x1d')](_0xd000('0x1e')))),_0xd000('0x1f')]]})[_0xd000('0xf')](function(_0x1278a9){logger[_0xd000('0x10')](_0xd000('0x18'),_0x57d538);logger['debug'](_0xd000('0x18'),_0x57d538,JSON[_0xd000('0x20')](_0x1278a9));_0x4db0a8(_0x1278a9);})['catch'](function(_0x19653d){logger[_0xd000('0x15')](_0xd000('0x18'),_0x19653d[_0xd000('0x16')],_0x57d538);_0x4ee0f6(_0x4f3b73[_0xd000('0x15')](0x1f4,_0x19653d[_0xd000('0x16')]));});});}; \ No newline at end of file +var _0x0d28=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x347471,_0x1c9a02){var _0x422b6a=function(_0x2b6f88){while(--_0x2b6f88){_0x347471['push'](_0x347471['shift']());}};_0x422b6a(++_0x1c9a02);}(_0x0d28,0xf1));var _0x80d2=function(_0x2bf5d1,_0x14e28f){_0x2bf5d1=_0x2bf5d1-0x0;var _0x3472c6=_0x0d28[_0x2bf5d1];return _0x3472c6;};'use strict';var _=require(_0x80d2('0x0'));var util=require(_0x80d2('0x1'));var moment=require(_0x80d2('0x2'));var BPromise=require('bluebird');var rs=require(_0x80d2('0x3'));var fs=require('fs');var Redis=require(_0x80d2('0x4'));var db=require(_0x80d2('0x5'))['db'];var utils=require(_0x80d2('0x6'));var logger=require(_0x80d2('0x7'))(_0x80d2('0x8'));var config=require('../../config/environment');var jayson=require(_0x80d2('0x9'));var client=jayson['client'][_0x80d2('0xa')]({'port':0x232a});config[_0x80d2('0xb')]=_[_0x80d2('0xc')](config[_0x80d2('0xb')],{'host':_0x80d2('0xd'),'port':0x18eb});var socket=require(_0x80d2('0xe'))(new Redis(config[_0x80d2('0xb')]));require('./userVoiceQueueRt.socket')[_0x80d2('0xf')](socket);function respondWithRpcPromise(_0x3b7f12,_0x2ff025,_0x34ab28){return new BPromise(function(_0x5dbd8e,_0xac95b5){return client[_0x80d2('0x10')](_0x3b7f12,_0x34ab28)[_0x80d2('0x11')](function(_0x35fbe1){logger[_0x80d2('0x12')](_0x80d2('0x13'),_0x2ff025,_0x80d2('0x14'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x2ff025,_0x80d2('0x14'),JSON[_0x80d2('0x15')](_0x35fbe1));if(_0x35fbe1[_0x80d2('0x16')]){if(_0x35fbe1[_0x80d2('0x16')]['code']===0x1f4){logger[_0x80d2('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2ff025,_0x35fbe1['error']['message']);return _0xac95b5(_0x35fbe1['error'][_0x80d2('0x17')]);}logger[_0x80d2('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2ff025,_0x35fbe1['error'][_0x80d2('0x17')]);return _0x5dbd8e(_0x35fbe1['error']['message']);}else{logger[_0x80d2('0x12')](_0x80d2('0x13'),_0x2ff025,_0x80d2('0x14'));_0x5dbd8e(_0x35fbe1[_0x80d2('0x18')][_0x80d2('0x17')]);}})[_0x80d2('0x19')](function(_0x5f52b3){logger[_0x80d2('0x16')](_0x80d2('0x13'),_0x2ff025,_0x5f52b3);_0xac95b5(_0x5f52b3);});});}exports[_0x80d2('0x1a')]=function(_0x5dafd0){var _0xfe7718=this;return new Promise(function(_0x352356,_0x2cf5a1){return db['UserVoiceQueueRt'][_0x80d2('0x1b')]({'raw':_0x5dafd0[_0x80d2('0x1c')]?_0x5dafd0[_0x80d2('0x1c')][_0x80d2('0x1d')]===undefined?!![]:![]:!![],'where':_0x5dafd0['options']?_0x5dafd0['options'][_0x80d2('0x1e')]||null:null,'attributes':[[db[_0x80d2('0x1f')]['fn'](_0x80d2('0x20'),db[_0x80d2('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x80d2('0x21')))),_0x80d2('0x22')]]})['then'](function(_0x2bdd3d){logger[_0x80d2('0x12')]('GetVoiceQueueRtPauses',_0x5dafd0);logger[_0x80d2('0x23')](_0x80d2('0x1a'),_0x5dafd0,JSON[_0x80d2('0x15')](_0x2bdd3d));_0x352356(_0x2bdd3d);})[_0x80d2('0x19')](function(_0x53e934){logger[_0x80d2('0x16')](_0x80d2('0x1a'),_0x53e934[_0x80d2('0x17')],_0x5dafd0);_0x2cf5a1(_0xfe7718[_0x80d2('0x16')](0x1f4,_0x53e934[_0x80d2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 97104b7..d38c1f0 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 _0x21fa=['save','update','emit','removeListener','register','length','./userVoiceQueueRt.events'];(function(_0x525b28,_0x5cf5a0){var _0x180178=function(_0x43e066){while(--_0x43e066){_0x525b28['push'](_0x525b28['shift']());}};_0x180178(++_0x5cf5a0);}(_0x21fa,0x16b));var _0xa21f=function(_0x229663,_0x514228){_0x229663=_0x229663-0x0;var _0x2e0624=_0x21fa[_0x229663];return _0x2e0624;};'use strict';var UserVoiceQueueRtEvents=require(_0xa21f('0x0'));var events=[_0xa21f('0x1'),'remove',_0xa21f('0x2')];function createListener(_0x19fc74,_0x4bb70d){return function(_0x3bfbac){_0x4bb70d[_0xa21f('0x3')](_0x19fc74,_0x3bfbac);};}function removeListener(_0x314dab,_0x4e2355){return function(){UserVoiceQueueRtEvents[_0xa21f('0x4')](_0x314dab,_0x4e2355);};}exports[_0xa21f('0x5')]=function(_0xbfa4f6){for(var _0x1cdca8=0x0,_0x168543=events[_0xa21f('0x6')];_0x1cdca8<_0x168543;_0x1cdca8++){var _0x199816=events[_0x1cdca8];var _0x51c137=createListener('userVoiceQueueRt:'+_0x199816,_0xbfa4f6);UserVoiceQueueRtEvents['on'](_0x199816,_0x51c137);}}; \ No newline at end of file +var _0xd3d9=['update','emit','removeListener','register','length','userVoiceQueueRt:','save','remove'];(function(_0x33bf06,_0x129f28){var _0x2c6e64=function(_0x432950){while(--_0x432950){_0x33bf06['push'](_0x33bf06['shift']());}};_0x2c6e64(++_0x129f28);}(_0xd3d9,0x126));var _0x9d3d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd3d9[_0x19950b];return _0x3c6b41;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x9d3d('0x0'),_0x9d3d('0x1'),_0x9d3d('0x2')];function createListener(_0x44c9af,_0x1968a7){return function(_0x3345ae){_0x1968a7[_0x9d3d('0x3')](_0x44c9af,_0x3345ae);};}function removeListener(_0x34e0ca,_0x517d40){return function(){UserVoiceQueueRtEvents[_0x9d3d('0x4')](_0x34e0ca,_0x517d40);};}exports[_0x9d3d('0x5')]=function(_0x3d5bd4){for(var _0x38702c=0x0,_0x23dc44=events[_0x9d3d('0x6')];_0x38702c<_0x23dc44;_0x38702c++){var _0x5bc3ad=events[_0x38702c];var _0x3c3f0b=createListener(_0x9d3d('0x7')+_0x5bc3ad,_0x3d5bd4);UserVoiceQueueRtEvents['on'](_0x5bc3ad,_0x3c3f0b);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 279a540..7e71bdb 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 _0xb58b=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','exports'];(function(_0x6814d4,_0x27a5ed){var _0x15d0ed=function(_0x1a44bd){while(--_0x1a44bd){_0x6814d4['push'](_0x6814d4['shift']());}};_0x15d0ed(++_0x27a5ed);}(_0xb58b,0x1f1));var _0xbb58=function(_0x44315d,_0x26dd3a){_0x44315d=_0x44315d-0x0;var _0x418726=_0xb58b[_0x44315d];return _0x418726;};'use strict';var multer=require('multer');var util=require(_0xbb58('0x0'));var path=require(_0xbb58('0x1'));var timeout=require(_0xbb58('0x2'));var express=require('express');var router=express[_0xbb58('0x3')]();var fs_extra=require(_0xbb58('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbb58('0x5'));var config=require('../../config/environment');module[_0xbb58('0x6')]=router; \ No newline at end of file +var _0x4d5a=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports','util','path'];(function(_0x2c158b,_0x5b825d){var _0x397f2b=function(_0x363c7b){while(--_0x363c7b){_0x2c158b['push'](_0x2c158b['shift']());}};_0x397f2b(++_0x5b825d);}(_0x4d5a,0x15e));var _0xa4d5=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x4d5a[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require('multer');var util=require(_0xa4d5('0x0'));var path=require(_0xa4d5('0x1'));var timeout=require(_0xa4d5('0x2'));var express=require('express');var router=express[_0xa4d5('0x3')]();var fs_extra=require(_0xa4d5('0x4'));var auth=require(_0xa4d5('0x5'));var interaction=require(_0xa4d5('0x6'));var config=require('../../config/environment');module[_0xa4d5('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 74a1bc0..84eac78 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 _0xbaf0=['exports','INTEGER'];(function(_0x7b341f,_0x11e481){var _0x46d0a1=function(_0x6f779d){while(--_0x6f779d){_0x7b341f['push'](_0x7b341f['shift']());}};_0x46d0a1(++_0x11e481);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x5e58b2,_0x1b7ed4){var _0x4facd0=function(_0x58d136){while(--_0x58d136){_0x5e58b2['push'](_0x5e58b2['shift']());}};_0x4facd0(++_0x1b7ed4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 155631c..45477c5 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 _0x7d25=['api','moment','bluebird','request-promise','path','define','UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger'];(function(_0x4db40c,_0x5aebda){var _0x572a4b=function(_0x4cb854){while(--_0x4cb854){_0x4db40c['push'](_0x4db40c['shift']());}};_0x572a4b(++_0x5aebda);}(_0x7d25,0x8a));var _0x57d2=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x7d25[_0x2dadb9];return _0x2f0097;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var logger=require(_0x57d2('0x1'))(_0x57d2('0x2'));var moment=require(_0x57d2('0x3'));var BPromise=require(_0x57d2('0x4'));var rp=require(_0x57d2('0x5'));var fs=require('fs');var path=require(_0x57d2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x3c5511,_0x49cc5f){return _0x3c5511[_0x57d2('0x7')](_0x57d2('0x8'),attributes,{'tableName':_0x57d2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d25=['api','moment','bluebird','request-promise','path','define','UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger'];(function(_0x3cd283,_0x2b8542){var _0x5ea1f0=function(_0x5d7e1c){while(--_0x5d7e1c){_0x3cd283['push'](_0x3cd283['shift']());}};_0x5ea1f0(++_0x2b8542);}(_0x7d25,0x8a));var _0x57d2=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7d25[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var logger=require(_0x57d2('0x1'))(_0x57d2('0x2'));var moment=require(_0x57d2('0x3'));var BPromise=require(_0x57d2('0x4'));var rp=require(_0x57d2('0x5'));var fs=require('fs');var path=require(_0x57d2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x3c5511,_0x49cc5f){return _0x3c5511[_0x57d2('0x7')](_0x57d2('0x8'),attributes,{'tableName':_0x57d2('0x9'),'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 f87b35d..c1eb22c 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x11c1f8,_0x4bdba6){var _0x5179d9=function(_0x3197b9){while(--_0x3197b9){_0x11c1f8['push'](_0x11c1f8['shift']());}};_0x5179d9(++_0x4bdba6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xec8ac1,_0x42a5c2){var _0x12661c=function(_0x2e4bc2){while(--_0x2e4bc2){_0xec8ac1['push'](_0xec8ac1['shift']());}};_0x12661c(++_0x42a5c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 0d74723..d8db101 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 _0x98a1=['show','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id'];(function(_0x284caf,_0x1be85a){var _0x2c6b29=function(_0x415c15){while(--_0x415c15){_0x284caf['push'](_0x284caf['shift']());}};_0x2c6b29(++_0x1be85a);}(_0x98a1,0x182));var _0x198a=function(_0x4aa69b,_0x11cf49){_0x4aa69b=_0x4aa69b-0x0;var _0x462c92=_0x98a1[_0x4aa69b];return _0x462c92;};'use strict';var multer=require(_0x198a('0x0'));var util=require(_0x198a('0x1'));var path=require(_0x198a('0x2'));var timeout=require('connect-timeout');var express=require(_0x198a('0x3'));var router=express[_0x198a('0x4')]();var fs_extra=require(_0x198a('0x5'));var auth=require(_0x198a('0x6'));var interaction=require(_0x198a('0x7'));var config=require(_0x198a('0x8'));var controller=require(_0x198a('0x9'));router[_0x198a('0xa')]('/',auth[_0x198a('0xb')](),controller[_0x198a('0xc')]);router[_0x198a('0xa')](_0x198a('0xd'),auth['isAuthenticated'](),controller[_0x198a('0xe')]);router['post']('/',auth[_0x198a('0xb')](),controller[_0x198a('0xf')]);router[_0x198a('0x10')](_0x198a('0xd'),auth[_0x198a('0xb')](),controller['update']);router[_0x198a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x198a('0x12')]);module[_0x198a('0x13')]=router; \ No newline at end of file +var _0x9e6a=['index','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./variable.controller','isAuthenticated'];(function(_0x5ec95a,_0x3db81c){var _0x1e1b6a=function(_0x39f4db){while(--_0x39f4db){_0x5ec95a['push'](_0x5ec95a['shift']());}};_0x1e1b6a(++_0x3db81c);}(_0x9e6a,0x86));var _0xa9e6=function(_0x1806d4,_0x47cc68){_0x1806d4=_0x1806d4-0x0;var _0x392c2c=_0x9e6a[_0x1806d4];return _0x392c2c;};'use strict';var multer=require(_0xa9e6('0x0'));var util=require(_0xa9e6('0x1'));var path=require(_0xa9e6('0x2'));var timeout=require(_0xa9e6('0x3'));var express=require(_0xa9e6('0x4'));var router=express[_0xa9e6('0x5')]();var fs_extra=require(_0xa9e6('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa9e6('0x7'));var controller=require(_0xa9e6('0x8'));router['get']('/',auth[_0xa9e6('0x9')](),controller[_0xa9e6('0xa')]);router['get'](_0xa9e6('0xb'),auth[_0xa9e6('0x9')](),controller[_0xa9e6('0xc')]);router['post']('/',auth[_0xa9e6('0x9')](),controller[_0xa9e6('0xd')]);router[_0xa9e6('0xe')](_0xa9e6('0xb'),auth['isAuthenticated'](),controller[_0xa9e6('0xf')]);router[_0xa9e6('0x10')](_0xa9e6('0xb'),auth[_0xa9e6('0x9')](),controller[_0xa9e6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 9b85139..d05eabf 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 _0xd745=['name','STRING','exports'];(function(_0x4c2131,_0x4da9b8){var _0x1522cd=function(_0x2471e3){while(--_0x2471e3){_0x4c2131['push'](_0x4c2131['shift']());}};_0x1522cd(++_0x4da9b8);}(_0xd745,0x170));var _0x5d74=function(_0x1c5cb8,_0x1b5f44){_0x1c5cb8=_0x1c5cb8-0x0;var _0x36c880=_0xd745[_0x1c5cb8];return _0x36c880;};'use strict';var Sequelize=require('sequelize');module[_0x5d74('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5d74('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5d74('0x2')]}}; \ No newline at end of file +var _0xb81b=['sequelize','exports','STRING','name'];(function(_0x3777ef,_0x20db8a){var _0x4e7452=function(_0x454667){while(--_0x454667){_0x3777ef['push'](_0x3777ef['shift']());}};_0x4e7452(++_0x20db8a);}(_0xb81b,0x16c));var _0xbb81=function(_0x4269e7,_0xf2408d){_0x4269e7=_0x4269e7-0x0;var _0x5291ea=_0xb81b[_0x4269e7];return _0x5291ea;};'use strict';var Sequelize=require(_0xbb81('0x0'));module[_0xbb81('0x1')]={'name':{'type':Sequelize[_0xbb81('0x2')],'unique':_0xbb81('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 3dfa296..b13b394 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 _0x5549=['ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','render','merge','body','agent','interaction','account','index','map','Variable','fieldName','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','options','includeAll','include','catch','params','rawAttributes','length','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x3e7f9f,_0x5ae894){var _0x28440f=function(_0x1efd45){while(--_0x1efd45){_0x3e7f9f['push'](_0x3e7f9f['shift']());}};_0x28440f(++_0x5ae894);}(_0x5549,0x1f4));var _0x9554=function(_0x4c4bb2,_0x3480a0){_0x4c4bb2=_0x4c4bb2-0x0;var _0x5cc228=_0x5549[_0x4c4bb2];return _0x5cc228;};'use strict';var emlformat=require(_0x9554('0x0'));var rimraf=require(_0x9554('0x1'));var zipdir=require(_0x9554('0x2'));var jsonpatch=require(_0x9554('0x3'));var rp=require(_0x9554('0x4'));var moment=require('moment');var BPromise=require(_0x9554('0x5'));var Mustache=require(_0x9554('0x6'));var util=require(_0x9554('0x7'));var path=require(_0x9554('0x8'));var sox=require(_0x9554('0x9'));var csv=require('to-csv');var ejs=require(_0x9554('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9554('0xb'));var squel=require(_0x9554('0xc'));var crypto=require(_0x9554('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9554('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9554('0xf'));var Redis=require('ioredis');var authService=require(_0x9554('0x10'));var qs=require(_0x9554('0x11'));var as=require(_0x9554('0x12'));var hardwareService=require(_0x9554('0x13'));var logger=require(_0x9554('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9554('0x15'));var licenseUtil=require(_0x9554('0x16'));var db=require(_0x9554('0x17'))['db'];function respondWithStatusCode(_0x582d34,_0x2ba34a){_0x2ba34a=_0x2ba34a||0xcc;return function(_0x34b0f5){if(_0x34b0f5){return _0x582d34[_0x9554('0x18')](_0x2ba34a);}return _0x582d34['status'](_0x2ba34a)[_0x9554('0x19')]();};}function respondWithResult(_0x2228ae,_0x50d879){_0x50d879=_0x50d879||0xc8;return function(_0x2b9f7c){if(_0x2b9f7c){return _0x2228ae[_0x9554('0x1a')](_0x50d879)[_0x9554('0x1b')](_0x2b9f7c);}};}function respondWithFilteredResult(_0x849437,_0x4a1a20){return function(_0x1a2694){if(_0x1a2694){var _0x37003a=typeof _0x4a1a20[_0x9554('0x1c')]==='undefined'&&typeof _0x4a1a20[_0x9554('0x1d')]==='undefined';var _0x18811c=_0x1a2694[_0x9554('0x1e')];var _0x5de328=_0x37003a?0x0:_0x4a1a20[_0x9554('0x1c')];var _0x107584=_0x37003a?_0x1a2694[_0x9554('0x1e')]:_0x4a1a20[_0x9554('0x1c')]+_0x4a1a20[_0x9554('0x1d')];var _0x43e013;if(_0x107584>=_0x18811c){_0x107584=_0x18811c;_0x43e013=0xc8;}else{_0x43e013=0xce;}_0x849437[_0x9554('0x1a')](_0x43e013);return _0x849437['set'](_0x9554('0x1f'),_0x5de328+'-'+_0x107584+'/'+_0x18811c)[_0x9554('0x1b')](_0x1a2694);}return null;};}function patchUpdates(_0x938c91){return function(_0x3909a9){try{jsonpatch[_0x9554('0x20')](_0x3909a9,_0x938c91,!![]);}catch(_0x1efa6c){return BPromise[_0x9554('0x21')](_0x1efa6c);}return _0x3909a9[_0x9554('0x22')]();};}function saveUpdates(_0x85e5a5,_0x49d8e0){return function(_0x7abc7e){if(_0x7abc7e){return _0x7abc7e['update'](_0x85e5a5)[_0x9554('0x23')](function(_0x1755d3){return _0x1755d3;});}return null;};}function removeEntity(_0x4c08f9,_0x48576d){return function(_0x3fb762){if(_0x3fb762){return _0x3fb762[_0x9554('0x24')]()[_0x9554('0x23')](function(){var _0x394350=_0x3fb762[_0x9554('0x25')]({'plain':!![]});var _0x4356b9=_0x9554('0x26');return db[_0x9554('0x27')][_0x9554('0x24')]({'where':{'type':_0x4356b9,'resourceId':_0x394350['id']}})[_0x9554('0x23')](function(){return _0x3fb762;});})['then'](function(){_0x4c08f9[_0x9554('0x1a')](0xcc)[_0x9554('0x19')]();});}};}function handleEntityNotFound(_0x17afca,_0x54e73c){return function(_0x5abb7c){if(!_0x5abb7c){_0x17afca['sendStatus'](0x194);}return _0x5abb7c;};}function handleError(_0x4be9fd,_0x14ba0b){_0x14ba0b=_0x14ba0b||0x1f4;return function(_0x497c13){logger[_0x9554('0x28')](_0x497c13[_0x9554('0x29')]);if(_0x497c13[_0x9554('0x2a')]){delete _0x497c13[_0x9554('0x2a')];}_0x4be9fd['status'](_0x14ba0b)[_0x9554('0x2b')](_0x497c13);};}function getMustacheRender(_0x2acbaf,_0x37af8d){return Mustache[_0x9554('0x2c')](_0x2acbaf,_[_0x9554('0x2d')](_0x37af8d[_0x9554('0x2e')],{'contact':_0x37af8d['contact'],'message':_0x37af8d['message'],'agent':_0x37af8d[_0x9554('0x2f')],'interaction':_0x37af8d[_0x9554('0x30')],'account':_0x37af8d[_0x9554('0x31')]}))||'';}exports[_0x9554('0x32')]=function(_0x34b341,_0x454897){var _0xac2809={},_0x1bb110={},_0x4abc7b={'count':0x0,'rows':[]};var _0x2ecab3=_[_0x9554('0x33')](db[_0x9554('0x34')]['rawAttributes'],function(_0x2bb7ff){return{'name':_0x2bb7ff[_0x9554('0x35')],'type':_0x2bb7ff['type'][_0x9554('0x36')]};});_0x1bb110[_0x9554('0x37')]=_['map'](_0x2ecab3,_0x9554('0x2a'));_0x1bb110['query']=_[_0x9554('0x38')](_0x34b341[_0x9554('0x39')]);_0x1bb110['filters']=_[_0x9554('0x3a')](_0x1bb110['model'],_0x1bb110['query']);_0xac2809['attributes']=_['intersection'](_0x1bb110[_0x9554('0x37')],qs['fields'](_0x34b341[_0x9554('0x39')][_0x9554('0x3b')]));_0xac2809[_0x9554('0x3c')]=_0xac2809[_0x9554('0x3c')]['length']?_0xac2809['attributes']:_0x1bb110['model'];if(!_0x34b341['query'][_0x9554('0x3d')](_0x9554('0x3e'))){_0xac2809[_0x9554('0x1d')]=qs[_0x9554('0x1d')](_0x34b341['query'][_0x9554('0x1d')]);_0xac2809[_0x9554('0x1c')]=qs[_0x9554('0x1c')](_0x34b341[_0x9554('0x39')][_0x9554('0x1c')]);}_0xac2809[_0x9554('0x3f')]=qs['sort'](_0x34b341['query'][_0x9554('0x40')]);_0xac2809[_0x9554('0x41')]=qs[_0x9554('0x42')](_['pick'](_0x34b341[_0x9554('0x39')],_0x1bb110[_0x9554('0x42')]),_0x2ecab3);if(_0x34b341[_0x9554('0x39')][_0x9554('0x43')]){_0xac2809[_0x9554('0x41')]=_[_0x9554('0x2d')](_0xac2809[_0x9554('0x41')],{'$or':_['map'](_0x2ecab3,function(_0x2e9ca3){if(_0x2e9ca3[_0x9554('0x44')]!=='VIRTUAL'){var _0x29961f={};_0x29961f[_0x2e9ca3[_0x9554('0x2a')]]={'$like':'%'+_0x34b341[_0x9554('0x39')][_0x9554('0x43')]+'%'};return _0x29961f;}})});}_0xac2809=_['merge']({},_0xac2809,_0x34b341[_0x9554('0x45')]);var _0x3db4db={'where':_0xac2809[_0x9554('0x41')]};return db[_0x9554('0x34')][_0x9554('0x1e')](_0x3db4db)[_0x9554('0x23')](function(_0x3c5d3f){_0x4abc7b[_0x9554('0x1e')]=_0x3c5d3f;if(_0x34b341[_0x9554('0x39')][_0x9554('0x46')]){_0xac2809[_0x9554('0x47')]=[{'all':!![]}];}return db['Variable']['findAll'](_0xac2809);})['then'](function(_0x451a75){_0x4abc7b['rows']=_0x451a75;return _0x4abc7b;})[_0x9554('0x23')](respondWithFilteredResult(_0x454897,_0xac2809))[_0x9554('0x48')](handleError(_0x454897,null));};exports['show']=function(_0x3d2f43,_0x1741d8){var _0x45717e={'raw':!![],'where':{'id':_0x3d2f43[_0x9554('0x49')]['id']}},_0x5283d2={};_0x5283d2[_0x9554('0x37')]=_[_0x9554('0x38')](db[_0x9554('0x34')][_0x9554('0x4a')]);_0x5283d2[_0x9554('0x39')]=_[_0x9554('0x38')](_0x3d2f43[_0x9554('0x39')]);_0x5283d2[_0x9554('0x42')]=_[_0x9554('0x3a')](_0x5283d2['model'],_0x5283d2[_0x9554('0x39')]);_0x45717e[_0x9554('0x3c')]=_['intersection'](_0x5283d2[_0x9554('0x37')],qs[_0x9554('0x3b')](_0x3d2f43[_0x9554('0x39')][_0x9554('0x3b')]));_0x45717e[_0x9554('0x3c')]=_0x45717e[_0x9554('0x3c')][_0x9554('0x4b')]?_0x45717e[_0x9554('0x3c')]:_0x5283d2[_0x9554('0x37')];if(_0x3d2f43[_0x9554('0x39')][_0x9554('0x46')]){_0x45717e['include']=[{'all':!![]}];}_0x45717e=_['merge']({},_0x45717e,_0x3d2f43[_0x9554('0x45')]);return db[_0x9554('0x34')]['find'](_0x45717e)[_0x9554('0x23')](handleEntityNotFound(_0x1741d8,null))['then'](respondWithResult(_0x1741d8,null))[_0x9554('0x48')](handleError(_0x1741d8,null));};exports[_0x9554('0x4c')]=function(_0x58845f,_0x53ef4f){return db['Variable'][_0x9554('0x4c')](_0x58845f[_0x9554('0x2e')],{})[_0x9554('0x23')](function(_0x49265b){var _0x1a303e=_0x58845f[_0x9554('0x4d')][_0x9554('0x25')]({'plain':!![]});if(!_0x1a303e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a303e[_0x9554('0x4e')]===_0x9554('0x4d')){var _0x1fbd29=_0x49265b[_0x9554('0x25')]({'plain':!![]});var _0x2704bb='Variables';return db[_0x9554('0x4f')][_0x9554('0x50')]({'where':{'name':_0x2704bb,'userProfileId':_0x1a303e[_0x9554('0x51')]},'raw':!![]})[_0x9554('0x23')](function(_0x11ceba){if(_0x11ceba&&_0x11ceba[_0x9554('0x52')]===0x0){return db[_0x9554('0x27')][_0x9554('0x4c')]({'name':_0x1fbd29[_0x9554('0x2a')],'resourceId':_0x1fbd29['id'],'type':_0x11ceba[_0x9554('0x2a')],'sectionId':_0x11ceba['id']},{})[_0x9554('0x23')](function(){return _0x49265b;});}else{return _0x49265b;}})[_0x9554('0x48')](function(_0x16b32c){logger[_0x9554('0x28')](_0x9554('0x53'),_0x16b32c);throw _0x16b32c;});}return _0x49265b;})[_0x9554('0x23')](respondWithResult(_0x53ef4f,0xc9))['catch'](handleError(_0x53ef4f,null));};exports[_0x9554('0x54')]=function(_0x2b04fa,_0x3154a2){if(_0x2b04fa[_0x9554('0x2e')]['id']){delete _0x2b04fa[_0x9554('0x2e')]['id'];}return db[_0x9554('0x34')][_0x9554('0x50')]({'where':{'id':_0x2b04fa[_0x9554('0x49')]['id']}})[_0x9554('0x23')](handleEntityNotFound(_0x3154a2,null))[_0x9554('0x23')](saveUpdates(_0x2b04fa[_0x9554('0x2e')],null))[_0x9554('0x23')](respondWithResult(_0x3154a2,null))[_0x9554('0x48')](handleError(_0x3154a2,null));};exports[_0x9554('0x24')]=function(_0x324017,_0x138c82){return db[_0x9554('0x34')][_0x9554('0x50')]({'where':{'id':_0x324017[_0x9554('0x49')]['id']}})[_0x9554('0x23')](handleEntityNotFound(_0x138c82,null))[_0x9554('0x23')](removeEntity(_0x138c82,null))[_0x9554('0x48')](handleError(_0x138c82,null));}; \ No newline at end of file +var _0xf981=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','then','Variables','destroy','error','stack','name','send','render','body','message','account','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','params','fields','find','catch','create','user','get','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf981,0xe6));var _0x1f98=function(_0x111475,_0x4314a5){_0x111475=_0x111475-0x0;var _0x4a273b=_0xf981[_0x111475];return _0x4a273b;};'use strict';var emlformat=require(_0x1f98('0x0'));var rimraf=require(_0x1f98('0x1'));var zipdir=require(_0x1f98('0x2'));var jsonpatch=require(_0x1f98('0x3'));var rp=require(_0x1f98('0x4'));var moment=require(_0x1f98('0x5'));var BPromise=require(_0x1f98('0x6'));var Mustache=require(_0x1f98('0x7'));var util=require('util');var path=require(_0x1f98('0x8'));var sox=require(_0x1f98('0x9'));var csv=require(_0x1f98('0xa'));var ejs=require(_0x1f98('0xb'));var fs=require('fs');var fs_extra=require(_0x1f98('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1f98('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1f98('0xe'));var toCsv=require(_0x1f98('0xa'));var querystring=require(_0x1f98('0xf'));var Papa=require(_0x1f98('0x10'));var Redis=require(_0x1f98('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1f98('0x12'));var as=require(_0x1f98('0x13'));var hardwareService=require(_0x1f98('0x14'));var logger=require(_0x1f98('0x15'))('api');var utils=require(_0x1f98('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1f98('0x17'));var db=require(_0x1f98('0x18'))['db'];function respondWithStatusCode(_0x47322b,_0x4d14ae){_0x4d14ae=_0x4d14ae||0xcc;return function(_0x5e34f9){if(_0x5e34f9){return _0x47322b['sendStatus'](_0x4d14ae);}return _0x47322b[_0x1f98('0x19')](_0x4d14ae)[_0x1f98('0x1a')]();};}function respondWithResult(_0x2e599d,_0x2d9c83){_0x2d9c83=_0x2d9c83||0xc8;return function(_0x87ffbd){if(_0x87ffbd){return _0x2e599d[_0x1f98('0x19')](_0x2d9c83)[_0x1f98('0x1b')](_0x87ffbd);}};}function respondWithFilteredResult(_0x5d38ba,_0x1a21cd){return function(_0x547b5c){if(_0x547b5c){var _0x2fc335=typeof _0x1a21cd['offset']===_0x1f98('0x1c')&&typeof _0x1a21cd[_0x1f98('0x1d')]===_0x1f98('0x1c');var _0x466bbd=_0x547b5c[_0x1f98('0x1e')];var _0x414268=_0x2fc335?0x0:_0x1a21cd[_0x1f98('0x1f')];var _0x52966d=_0x2fc335?_0x547b5c[_0x1f98('0x1e')]:_0x1a21cd['offset']+_0x1a21cd[_0x1f98('0x1d')];var _0x23221d;if(_0x52966d>=_0x466bbd){_0x52966d=_0x466bbd;_0x23221d=0xc8;}else{_0x23221d=0xce;}_0x5d38ba[_0x1f98('0x19')](_0x23221d);return _0x5d38ba[_0x1f98('0x20')](_0x1f98('0x21'),_0x414268+'-'+_0x52966d+'/'+_0x466bbd)[_0x1f98('0x1b')](_0x547b5c);}return null;};}function patchUpdates(_0x21e416){return function(_0x3b9e54){try{jsonpatch[_0x1f98('0x22')](_0x3b9e54,_0x21e416,!![]);}catch(_0x56f46c){return BPromise['reject'](_0x56f46c);}return _0x3b9e54['save']();};}function saveUpdates(_0xa07804,_0x431958){return function(_0x46582d){if(_0x46582d){return _0x46582d['update'](_0xa07804)[_0x1f98('0x23')](function(_0x1b48d1){return _0x1b48d1;});}return null;};}function removeEntity(_0x5049d9,_0x55d29e){return function(_0x1de1cd){if(_0x1de1cd){return _0x1de1cd['destroy']()[_0x1f98('0x23')](function(){var _0x5a6f37=_0x1de1cd['get']({'plain':!![]});var _0x48a5dc=_0x1f98('0x24');return db['UserProfileResource'][_0x1f98('0x25')]({'where':{'type':_0x48a5dc,'resourceId':_0x5a6f37['id']}})[_0x1f98('0x23')](function(){return _0x1de1cd;});})[_0x1f98('0x23')](function(){_0x5049d9[_0x1f98('0x19')](0xcc)[_0x1f98('0x1a')]();});}};}function handleEntityNotFound(_0x3e1c19,_0x401606){return function(_0x1721fc){if(!_0x1721fc){_0x3e1c19['sendStatus'](0x194);}return _0x1721fc;};}function handleError(_0x10069b,_0x4aef13){_0x4aef13=_0x4aef13||0x1f4;return function(_0x18d13b){logger[_0x1f98('0x26')](_0x18d13b[_0x1f98('0x27')]);if(_0x18d13b[_0x1f98('0x28')]){delete _0x18d13b['name'];}_0x10069b['status'](_0x4aef13)[_0x1f98('0x29')](_0x18d13b);};}function getMustacheRender(_0x23ad11,_0x2df3fb){return Mustache[_0x1f98('0x2a')](_0x23ad11,_['merge'](_0x2df3fb[_0x1f98('0x2b')],{'contact':_0x2df3fb['contact'],'message':_0x2df3fb[_0x1f98('0x2c')],'agent':_0x2df3fb['agent'],'interaction':_0x2df3fb['interaction'],'account':_0x2df3fb[_0x1f98('0x2d')]}))||'';}exports[_0x1f98('0x2e')]=function(_0x474e74,_0x269aba){var _0x3e621c={},_0xb24ee6={},_0x52fae2={'count':0x0,'rows':[]};var _0x36f2fe=_[_0x1f98('0x2f')](db[_0x1f98('0x30')][_0x1f98('0x31')],function(_0x1f157f){return{'name':_0x1f157f[_0x1f98('0x32')],'type':_0x1f157f[_0x1f98('0x33')][_0x1f98('0x34')]};});_0xb24ee6[_0x1f98('0x35')]=_[_0x1f98('0x2f')](_0x36f2fe,_0x1f98('0x28'));_0xb24ee6[_0x1f98('0x36')]=_[_0x1f98('0x37')](_0x474e74[_0x1f98('0x36')]);_0xb24ee6[_0x1f98('0x38')]=_[_0x1f98('0x39')](_0xb24ee6[_0x1f98('0x35')],_0xb24ee6[_0x1f98('0x36')]);_0x3e621c['attributes']=_['intersection'](_0xb24ee6[_0x1f98('0x35')],qs['fields'](_0x474e74[_0x1f98('0x36')]['fields']));_0x3e621c[_0x1f98('0x3a')]=_0x3e621c[_0x1f98('0x3a')][_0x1f98('0x3b')]?_0x3e621c[_0x1f98('0x3a')]:_0xb24ee6[_0x1f98('0x35')];if(!_0x474e74[_0x1f98('0x36')]['hasOwnProperty'](_0x1f98('0x3c'))){_0x3e621c['limit']=qs['limit'](_0x474e74[_0x1f98('0x36')][_0x1f98('0x1d')]);_0x3e621c[_0x1f98('0x1f')]=qs[_0x1f98('0x1f')](_0x474e74[_0x1f98('0x36')]['offset']);}_0x3e621c[_0x1f98('0x3d')]=qs[_0x1f98('0x3e')](_0x474e74[_0x1f98('0x36')][_0x1f98('0x3e')]);_0x3e621c[_0x1f98('0x3f')]=qs[_0x1f98('0x38')](_[_0x1f98('0x40')](_0x474e74[_0x1f98('0x36')],_0xb24ee6['filters']),_0x36f2fe);if(_0x474e74[_0x1f98('0x36')][_0x1f98('0x41')]){_0x3e621c[_0x1f98('0x3f')]=_[_0x1f98('0x42')](_0x3e621c['where'],{'$or':_['map'](_0x36f2fe,function(_0x26683c){if(_0x26683c['type']!==_0x1f98('0x43')){var _0x9db84={};_0x9db84[_0x26683c[_0x1f98('0x28')]]={'$like':'%'+_0x474e74[_0x1f98('0x36')]['filter']+'%'};return _0x9db84;}})});}_0x3e621c=_['merge']({},_0x3e621c,_0x474e74['options']);var _0x1598c3={'where':_0x3e621c[_0x1f98('0x3f')]};return db[_0x1f98('0x30')][_0x1f98('0x1e')](_0x1598c3)[_0x1f98('0x23')](function(_0x4f9a42){_0x52fae2[_0x1f98('0x1e')]=_0x4f9a42;if(_0x474e74[_0x1f98('0x36')][_0x1f98('0x44')]){_0x3e621c[_0x1f98('0x45')]=[{'all':!![]}];}return db[_0x1f98('0x30')]['findAll'](_0x3e621c);})[_0x1f98('0x23')](function(_0x2ffc47){_0x52fae2[_0x1f98('0x46')]=_0x2ffc47;return _0x52fae2;})[_0x1f98('0x23')](respondWithFilteredResult(_0x269aba,_0x3e621c))['catch'](handleError(_0x269aba,null));};exports['show']=function(_0x160e06,_0x3e7fc0){var _0x19936a={'raw':!![],'where':{'id':_0x160e06[_0x1f98('0x47')]['id']}},_0x408a51={};_0x408a51[_0x1f98('0x35')]=_['keys'](db[_0x1f98('0x30')][_0x1f98('0x31')]);_0x408a51[_0x1f98('0x36')]=_[_0x1f98('0x37')](_0x160e06['query']);_0x408a51[_0x1f98('0x38')]=_[_0x1f98('0x39')](_0x408a51[_0x1f98('0x35')],_0x408a51['query']);_0x19936a[_0x1f98('0x3a')]=_[_0x1f98('0x39')](_0x408a51[_0x1f98('0x35')],qs[_0x1f98('0x48')](_0x160e06[_0x1f98('0x36')][_0x1f98('0x48')]));_0x19936a['attributes']=_0x19936a[_0x1f98('0x3a')][_0x1f98('0x3b')]?_0x19936a['attributes']:_0x408a51[_0x1f98('0x35')];if(_0x160e06[_0x1f98('0x36')][_0x1f98('0x44')]){_0x19936a[_0x1f98('0x45')]=[{'all':!![]}];}_0x19936a=_['merge']({},_0x19936a,_0x160e06['options']);return db[_0x1f98('0x30')][_0x1f98('0x49')](_0x19936a)[_0x1f98('0x23')](handleEntityNotFound(_0x3e7fc0,null))[_0x1f98('0x23')](respondWithResult(_0x3e7fc0,null))[_0x1f98('0x4a')](handleError(_0x3e7fc0,null));};exports[_0x1f98('0x4b')]=function(_0x4af13c,_0x5ec2d4){return db[_0x1f98('0x30')]['create'](_0x4af13c[_0x1f98('0x2b')],{})[_0x1f98('0x23')](function(_0x5dbc76){var _0x320ad6=_0x4af13c[_0x1f98('0x4c')][_0x1f98('0x4d')]({'plain':!![]});if(!_0x320ad6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x320ad6[_0x1f98('0x4e')]===_0x1f98('0x4c')){var _0x3bc5ad=_0x5dbc76[_0x1f98('0x4d')]({'plain':!![]});var _0x5de9dc=_0x1f98('0x24');return db['UserProfileSection'][_0x1f98('0x49')]({'where':{'name':_0x5de9dc,'userProfileId':_0x320ad6['userProfileId']},'raw':!![]})[_0x1f98('0x23')](function(_0x82183a){if(_0x82183a&&_0x82183a[_0x1f98('0x4f')]===0x0){return db[_0x1f98('0x50')][_0x1f98('0x4b')]({'name':_0x3bc5ad['name'],'resourceId':_0x3bc5ad['id'],'type':_0x82183a['name'],'sectionId':_0x82183a['id']},{})[_0x1f98('0x23')](function(){return _0x5dbc76;});}else{return _0x5dbc76;}})['catch'](function(_0xb1d0e){logger['error'](_0x1f98('0x51'),_0xb1d0e);throw _0xb1d0e;});}return _0x5dbc76;})[_0x1f98('0x23')](respondWithResult(_0x5ec2d4,0xc9))[_0x1f98('0x4a')](handleError(_0x5ec2d4,null));};exports[_0x1f98('0x52')]=function(_0x1fc4d6,_0xcdb24e){if(_0x1fc4d6[_0x1f98('0x2b')]['id']){delete _0x1fc4d6[_0x1f98('0x2b')]['id'];}return db[_0x1f98('0x30')][_0x1f98('0x49')]({'where':{'id':_0x1fc4d6[_0x1f98('0x47')]['id']}})[_0x1f98('0x23')](handleEntityNotFound(_0xcdb24e,null))['then'](saveUpdates(_0x1fc4d6['body'],null))[_0x1f98('0x23')](respondWithResult(_0xcdb24e,null))['catch'](handleError(_0xcdb24e,null));};exports[_0x1f98('0x25')]=function(_0x356148,_0x533c06){return db['Variable'][_0x1f98('0x49')]({'where':{'id':_0x356148[_0x1f98('0x47')]['id']}})['then'](handleEntityNotFound(_0x533c06,null))['then'](removeEntity(_0x533c06,null))[_0x1f98('0x4a')](handleError(_0x533c06,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 2d0d9c4..3a5892f 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 _0xe130=['api','moment','bluebird','request-promise','path','../../config/environment','./variable.attributes','exports','define','lodash','util'];(function(_0x38f06a,_0x4487f1){var _0x425dd0=function(_0x5ac219){while(--_0x5ac219){_0x38f06a['push'](_0x38f06a['shift']());}};_0x425dd0(++_0x4487f1);}(_0xe130,0x127));var _0x0e13=function(_0x4966f1,_0xc6ae1e){_0x4966f1=_0x4966f1-0x0;var _0x54fb41=_0xe130[_0x4966f1];return _0x54fb41;};'use strict';var _=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var logger=require('../../config/logger')(_0x0e13('0x2'));var moment=require(_0x0e13('0x3'));var BPromise=require(_0x0e13('0x4'));var rp=require(_0x0e13('0x5'));var fs=require('fs');var path=require(_0x0e13('0x6'));var rimraf=require('rimraf');var config=require(_0x0e13('0x7'));var attributes=require(_0x0e13('0x8'));module[_0x0e13('0x9')]=function(_0xcd92e,_0x50a80e){return _0xcd92e[_0x0e13('0xa')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x928c=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','../../config/logger'];(function(_0x4fcb7c,_0x5c951d){var _0x23f187=function(_0x4be661){while(--_0x4be661){_0x4fcb7c['push'](_0x4fcb7c['shift']());}};_0x23f187(++_0x5c951d);}(_0x928c,0x17f));var _0xc928=function(_0x2b4085,_0x4e21fe){_0x2b4085=_0x2b4085-0x0;var _0x5cc0c5=_0x928c[_0x2b4085];return _0x5cc0c5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc928('0x0'))(_0xc928('0x1'));var moment=require('moment');var BPromise=require(_0xc928('0x2'));var rp=require(_0xc928('0x3'));var fs=require('fs');var path=require(_0xc928('0x4'));var rimraf=require(_0xc928('0x5'));var config=require(_0xc928('0x6'));var attributes=require('./variable.attributes');module[_0xc928('0x7')]=function(_0x4704bc,_0x8c0fa5){return _0x4704bc['define']('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 72aad31..dc08987 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 _0x61b0=['rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error','code','Variable,\x20%s,\x20%s','message','info','result','ShowVariable','Variable','find','options','where','attributes','map','include','model','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x14ed4e,_0x3dcf54){var _0x5c3d8a=function(_0x284a91){while(--_0x284a91){_0x14ed4e['push'](_0x14ed4e['shift']());}};_0x5c3d8a(++_0x3dcf54);}(_0x61b0,0xd9));var _0x061b=function(_0x80973,_0x4548c8){_0x80973=_0x80973-0x0;var _0x3ee8e1=_0x61b0[_0x80973];return _0x3ee8e1;};'use strict';var _=require(_0x061b('0x0'));var util=require('util');var moment=require(_0x061b('0x1'));var BPromise=require(_0x061b('0x2'));var rs=require(_0x061b('0x3'));var fs=require('fs');var Redis=require(_0x061b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x061b('0x5'));var logger=require(_0x061b('0x6'))(_0x061b('0x7'));var config=require(_0x061b('0x8'));var jayson=require(_0x061b('0x9'));var client=jayson[_0x061b('0xa')][_0x061b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x554b32,_0x245a40,_0x2004c8){return new BPromise(function(_0x553352,_0x29db0d){return client[_0x061b('0xc')](_0x554b32,_0x2004c8)[_0x061b('0xd')](function(_0x12e592){logger['info']('Variable,\x20%s,\x20%s',_0x245a40,_0x061b('0xe'));logger[_0x061b('0xf')]('Variable,\x20%s,\x20%s,\x20%s',_0x245a40,_0x061b('0xe'),JSON['stringify'](_0x12e592));if(_0x12e592[_0x061b('0x10')]){if(_0x12e592[_0x061b('0x10')][_0x061b('0x11')]===0x1f4){logger[_0x061b('0x10')](_0x061b('0x12'),_0x245a40,_0x12e592[_0x061b('0x10')][_0x061b('0x13')]);return _0x29db0d(_0x12e592[_0x061b('0x10')][_0x061b('0x13')]);}logger[_0x061b('0x10')]('Variable,\x20%s,\x20%s',_0x245a40,_0x12e592[_0x061b('0x10')]['message']);return _0x553352(_0x12e592[_0x061b('0x10')][_0x061b('0x13')]);}else{logger[_0x061b('0x14')](_0x061b('0x12'),_0x245a40,_0x061b('0xe'));_0x553352(_0x12e592[_0x061b('0x15')][_0x061b('0x13')]);}})['catch'](function(_0x372f0f){logger[_0x061b('0x10')]('Variable,\x20%s,\x20%s',_0x245a40,_0x372f0f);_0x29db0d(_0x372f0f);});});}exports[_0x061b('0x16')]=function(_0xdb1d82){var _0x184aa3=this;return new Promise(function(_0x39170b,_0x4306e8){return db[_0x061b('0x17')][_0x061b('0x18')]({'raw':_0xdb1d82[_0x061b('0x19')]?_0xdb1d82[_0x061b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xdb1d82['options']?_0xdb1d82[_0x061b('0x19')][_0x061b('0x1a')]||null:null,'attributes':_0xdb1d82[_0x061b('0x19')]?_0xdb1d82[_0x061b('0x19')][_0x061b('0x1b')]||null:null,'include':_0xdb1d82['options']?_0xdb1d82[_0x061b('0x19')]['include']?_[_0x061b('0x1c')](_0xdb1d82['options'][_0x061b('0x1d')],function(_0x5c948c){return{'model':db[_0x5c948c['model']],'as':_0x5c948c['as'],'attributes':_0x5c948c[_0x061b('0x1b')],'include':_0x5c948c[_0x061b('0x1d')]?_[_0x061b('0x1c')](_0x5c948c[_0x061b('0x1d')],function(_0x57e424){return{'model':db[_0x57e424[_0x061b('0x1e')]],'as':_0x57e424['as'],'attributes':_0x57e424[_0x061b('0x1b')],'include':_0x57e424['include']?_[_0x061b('0x1c')](_0x57e424['include'],function(_0x20fc49){return{'model':db[_0x20fc49['model']],'as':_0x20fc49['as'],'attributes':_0x20fc49['attributes']};}):[]};}):[]};}):[]:[]})[_0x061b('0xd')](function(_0x214781){logger['info'](_0x061b('0x16'),_0xdb1d82);logger[_0x061b('0xf')]('ShowVariable',_0xdb1d82,JSON['stringify'](_0x214781));_0x39170b(_0x214781);})[_0x061b('0x1f')](function(_0x32c886){logger[_0x061b('0x10')](_0x061b('0x16'),_0x32c886['message'],_0xdb1d82);_0x4306e8(_0x184aa3[_0x061b('0x10')](0x1f4,_0x32c886[_0x061b('0x13')]));});});}; \ No newline at end of file +var _0x83ec=['ShowVariable','Variable','find','raw','options','where','include','map','model','then','lodash','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x10b15d,_0x3cc5b5){var _0x44dd13=function(_0x438278){while(--_0x438278){_0x10b15d['push'](_0x10b15d['shift']());}};_0x44dd13(++_0x3cc5b5);}(_0x83ec,0xbe));var _0xc83e=function(_0x202176,_0x521bde){_0x202176=_0x202176-0x0;var _0x247f0f=_0x83ec[_0x202176];return _0x247f0f;};'use strict';var _=require(_0xc83e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc83e('0x1'));var fs=require('fs');var Redis=require(_0xc83e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc83e('0x3'));var logger=require(_0xc83e('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc83e('0x5'));var client=jayson[_0xc83e('0x6')][_0xc83e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3b4ca4,_0x38ba3a,_0x562c02){return new BPromise(function(_0x32b36a,_0xaf57d4){return client[_0xc83e('0x8')](_0x3b4ca4,_0x562c02)['then'](function(_0x94b25c){logger[_0xc83e('0x9')](_0xc83e('0xa'),_0x38ba3a,_0xc83e('0xb'));logger[_0xc83e('0xc')](_0xc83e('0xd'),_0x38ba3a,_0xc83e('0xb'),JSON[_0xc83e('0xe')](_0x94b25c));if(_0x94b25c[_0xc83e('0xf')]){if(_0x94b25c['error'][_0xc83e('0x10')]===0x1f4){logger[_0xc83e('0xf')]('Variable,\x20%s,\x20%s',_0x38ba3a,_0x94b25c[_0xc83e('0xf')][_0xc83e('0x11')]);return _0xaf57d4(_0x94b25c['error'][_0xc83e('0x11')]);}logger[_0xc83e('0xf')](_0xc83e('0xa'),_0x38ba3a,_0x94b25c[_0xc83e('0xf')][_0xc83e('0x11')]);return _0x32b36a(_0x94b25c['error'][_0xc83e('0x11')]);}else{logger[_0xc83e('0x9')](_0xc83e('0xa'),_0x38ba3a,_0xc83e('0xb'));_0x32b36a(_0x94b25c[_0xc83e('0x12')]['message']);}})[_0xc83e('0x13')](function(_0x5bd3f5){logger[_0xc83e('0xf')](_0xc83e('0xa'),_0x38ba3a,_0x5bd3f5);_0xaf57d4(_0x5bd3f5);});});}exports[_0xc83e('0x14')]=function(_0x547a34){var _0x8fb638=this;return new Promise(function(_0x488fb3,_0x1e5c8b){return db[_0xc83e('0x15')][_0xc83e('0x16')]({'raw':_0x547a34['options']?_0x547a34['options'][_0xc83e('0x17')]===undefined?!![]:![]:!![],'where':_0x547a34[_0xc83e('0x18')]?_0x547a34[_0xc83e('0x18')][_0xc83e('0x19')]||null:null,'attributes':_0x547a34[_0xc83e('0x18')]?_0x547a34[_0xc83e('0x18')]['attributes']||null:null,'include':_0x547a34[_0xc83e('0x18')]?_0x547a34[_0xc83e('0x18')][_0xc83e('0x1a')]?_[_0xc83e('0x1b')](_0x547a34['options']['include'],function(_0x14e6a8){return{'model':db[_0x14e6a8[_0xc83e('0x1c')]],'as':_0x14e6a8['as'],'attributes':_0x14e6a8['attributes'],'include':_0x14e6a8[_0xc83e('0x1a')]?_[_0xc83e('0x1b')](_0x14e6a8[_0xc83e('0x1a')],function(_0x5c7f56){return{'model':db[_0x5c7f56[_0xc83e('0x1c')]],'as':_0x5c7f56['as'],'attributes':_0x5c7f56['attributes'],'include':_0x5c7f56[_0xc83e('0x1a')]?_[_0xc83e('0x1b')](_0x5c7f56[_0xc83e('0x1a')],function(_0x3a9bda){return{'model':db[_0x3a9bda[_0xc83e('0x1c')]],'as':_0x3a9bda['as'],'attributes':_0x3a9bda['attributes']};}):[]};}):[]};}):[]:[]})[_0xc83e('0x1d')](function(_0xf01f84){logger[_0xc83e('0x9')](_0xc83e('0x14'),_0x547a34);logger[_0xc83e('0xc')](_0xc83e('0x14'),_0x547a34,JSON[_0xc83e('0xe')](_0xf01f84));_0x488fb3(_0xf01f84);})[_0xc83e('0x13')](function(_0x1a5482){logger[_0xc83e('0xf')](_0xc83e('0x14'),_0x1a5482['message'],_0x547a34);_0x1e5c8b(_0x8fb638[_0xc83e('0xf')](0x1f4,_0x1a5482[_0xc83e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 9af3995..55ae230 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 _0x3056=['exports','get','/fetch','isAuthenticated','fetch','canUpdate','reset','/pull','pull','/restart','restart','/migrations','migrations'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3056,0x153));var _0x6305=function(_0x3a64b0,_0x57abe6){_0x3a64b0=_0x3a64b0-0x0;var _0x2858a1=_0x3056[_0x3a64b0];return _0x2858a1;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x6305('0x0')]('/',controller['index']);router[_0x6305('0x0')](_0x6305('0x1'),auth[_0x6305('0x2')](),auth['canUpdate'](),controller[_0x6305('0x3')]);router[_0x6305('0x0')]('/reset',auth['isAuthenticated'](),auth[_0x6305('0x4')](),controller[_0x6305('0x5')]);router[_0x6305('0x0')](_0x6305('0x6'),auth['isAuthenticated'](),auth[_0x6305('0x4')](),controller[_0x6305('0x7')]);router[_0x6305('0x0')](_0x6305('0x8'),auth[_0x6305('0x2')](),controller[_0x6305('0x9')]);router[_0x6305('0x0')](_0x6305('0xa'),controller[_0x6305('0xb')]);module[_0x6305('0xc')]=router; \ No newline at end of file +var _0x78ac=['migrations','exports','Router','../../components/auth/service','./version.controller','index','get','/fetch','canUpdate','fetch','/reset','isAuthenticated','/pull','pull','/restart','restart','/migrations'];(function(_0x1007cf,_0x566564){var _0x3d96ec=function(_0x364e12){while(--_0x364e12){_0x1007cf['push'](_0x1007cf['shift']());}};_0x3d96ec(++_0x566564);}(_0x78ac,0xbd));var _0xc78a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x78ac[_0x2e4aa2];return _0x5e6092;};'use strict';var express=require('express');var router=express[_0xc78a('0x0')]();var auth=require(_0xc78a('0x1'));var controller=require(_0xc78a('0x2'));router['get']('/',controller[_0xc78a('0x3')]);router[_0xc78a('0x4')](_0xc78a('0x5'),auth['isAuthenticated'](),auth[_0xc78a('0x6')](),controller[_0xc78a('0x7')]);router[_0xc78a('0x4')](_0xc78a('0x8'),auth[_0xc78a('0x9')](),auth[_0xc78a('0x6')](),controller['reset']);router[_0xc78a('0x4')](_0xc78a('0xa'),auth[_0xc78a('0x9')](),auth[_0xc78a('0x6')](),controller[_0xc78a('0xb')]);router[_0xc78a('0x4')](_0xc78a('0xc'),auth[_0xc78a('0x9')](),controller[_0xc78a('0xd')]);router[_0xc78a('0x4')](_0xc78a('0xe'),controller[_0xc78a('0xf')]);module[_0xc78a('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 19e13c1..16423a5 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 _0xa5c1=['--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','version','query','latest','tags','exports','2.0.0','status','json','fetch','master','error','info','git\x20fetch\x20origin\x20master','reset'];(function(_0x2c12f8,_0x3ac911){var _0x462968=function(_0x68f49){while(--_0x68f49){_0x2c12f8['push'](_0x2c12f8['shift']());}};_0x462968(++_0x3ac911);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x3572f7,_0x2d0a35){_0x3572f7=_0x3572f7-0x0;var _0xaaf04b=_0xa5c1[_0x3572f7];return _0xaaf04b;};'use strict';var Umzug=require(_0x1a5c('0x0'));var path=require(_0x1a5c('0x1'));var fs=require('fs');var _=require(_0x1a5c('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x1a5c('0x3'));var exec=require('child_process')[_0x1a5c('0x4')];var db=require(_0x1a5c('0x5'))['db'];var config=require(_0x1a5c('0x6'));var pm2=require(_0x1a5c('0x7'));var logger=require(_0x1a5c('0x8'))(_0x1a5c('0x9'));var git=require('simple-git')(config[_0x1a5c('0xa')]);exports['index']=function(_0x438f8f,_0x43a2ed){var _0x1702ce={'current':module['exports'][_0x1a5c('0xb')],'phonebar':0x2};if(_0x438f8f['query']&&_0x438f8f[_0x1a5c('0xc')][_0x1a5c('0xd')]){return git['fetch']()[_0x1a5c('0xe')](function(_0x1ac373,_0x5b3de2){_0x1702ce[_0x1a5c('0xd')]=(_0x1ac373?module[_0x1a5c('0xf')][_0x1a5c('0xb')]:_0x5b3de2[_0x1a5c('0xd')])||_0x1a5c('0x10');return _0x43a2ed[_0x1a5c('0x11')](0xc8)[_0x1a5c('0x12')](_0x1702ce);});}else{return _0x43a2ed['status'](0xc8)[_0x1a5c('0x12')](_0x1702ce);}};exports[_0x1a5c('0x13')]=function(_0x4b240a,_0x157ebb){return git[_0x1a5c('0x13')](['origin',_0x1a5c('0x14')],function(_0x115aa6){if(_0x115aa6){logger[_0x1a5c('0x15')](_0x115aa6);return _0x157ebb[_0x1a5c('0x11')](0x1f4)['json'](_0x115aa6);}logger[_0x1a5c('0x16')]('git\x20fetch');return _0x157ebb[_0x1a5c('0x11')](0xc8)[_0x1a5c('0x12')]({'output':_0x1a5c('0x17')});});};exports['reset']=function(_0x5bafba,_0x32e177){return git[_0x1a5c('0x18')]([_0x1a5c('0x19'),_0x1a5c('0x1a')],function(_0x232798){if(_0x232798){logger['error'](_0x232798);return _0x32e177[_0x1a5c('0x11')](0x1f4)['json'](_0x232798);}logger[_0x1a5c('0x16')](_0x1a5c('0x1b'));return _0x32e177[_0x1a5c('0x11')](0xc8)['json']({'output':_0x1a5c('0x1c')});});};exports[_0x1a5c('0x1d')]=function(_0x3e1487,_0x3502cb){exec(_0x1a5c('0x1e'),function(_0x4d04d0,_0x11964c,_0xbd916e){logger[_0x1a5c('0x16')](_0x11964c);logger[_0x1a5c('0x16')](_0xbd916e);if(_0x4d04d0){logger[_0x1a5c('0x15')](_0x4d04d0);return _0x3502cb[_0x1a5c('0x11')](0x1f4)[_0x1a5c('0x12')](_0x4d04d0);}return _0x3502cb[_0x1a5c('0x11')](0xc8)[_0x1a5c('0x12')]({'output':_0x11964c});});};exports[_0x1a5c('0x1f')]=function(_0x38244c,_0x323272){return pm2['restart'](_0x1a5c('0x20'))['then'](function(_0x3d7168){logger['info'](_0x1a5c('0x21'),_0x3d7168);return _0x323272[_0x1a5c('0x11')](0xc8)[_0x1a5c('0x12')]({'output':_0x1a5c('0x22')});})[_0x1a5c('0x23')](function(_0x1e5e87){logger[_0x1a5c('0x15')](_0x1e5e87);return _0x323272[_0x1a5c('0x11')](0x1f4)[_0x1a5c('0x12')](_0x1e5e87);});};exports[_0x1a5c('0x24')]=function(_0x444f1c,_0x4e2fe3){var _0x25950b=fs[_0x1a5c('0x25')](path[_0x1a5c('0x26')](config[_0x1a5c('0xa')],_0x1a5c('0x27'),_0x1a5c('0x24')));var _0x406470=[];for(var _0x1a2bec=0x0;_0x1a2bec<_0x25950b[_0x1a5c('0x28')];_0x1a2bec++){var _0x523dfb=_0x25950b[_0x1a2bec][_0x1a5c('0x29')](_0x1a5c('0x2a'),'');if(compareVersions(module[_0x1a5c('0xf')][_0x1a5c('0xb')],_0x523dfb)===-0x1){_0x406470['push'](_0x523dfb);}}if(_0x406470[_0x1a5c('0x28')]){var _0x1de419=_0x406470[_0x1a5c('0x2b')](compareVersions);var _0x21ce1b=new Umzug({'storage':_0x1a5c('0x2c'),'storageOptions':{'model':db[_0x1a5c('0x2d')],'modelName':_0x1a5c('0x2d'),'columnName':'version'},'migrations':{'params':[db[_0x1a5c('0x2c')][_0x1a5c('0x2e')](),db['sequelize'][_0x1a5c('0x2f')],function(){throw new Error(_0x1a5c('0x30'));}],'path':path[_0x1a5c('0x26')](config[_0x1a5c('0xa')],'server',_0x1a5c('0x24')),'pattern':/\.js$/}});_0x21ce1b['up']({'migrations':_[_0x1a5c('0x31')](_0x1de419,function(_0x5b0811){return _0x5b0811+_0x1a5c('0x2a');})})[_0x1a5c('0x32')](function(){return _0x4e2fe3[_0x1a5c('0x11')](0xc8)[_0x1a5c('0x12')]({'output':_0x1a5c('0x33')+module[_0x1a5c('0xf')][_0x1a5c('0xb')]+_0x1a5c('0x34')+_[_0x1a5c('0x35')](_0x1de419),'migrations':_[_0x1a5c('0x26')](_0x1de419)});})['catch'](function(_0x3ebf42){if(_0x3ebf42 instanceof db[_0x1a5c('0x2c')]['UniqueConstraintError']){return _0x4e2fe3[_0x1a5c('0x11')](0xc8)[_0x1a5c('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x4e2fe3['status'](0x1f4)[_0x1a5c('0x12')](_0x3ebf42);}});}else{return _0x4e2fe3[_0x1a5c('0x11')](0xc8)[_0x1a5c('0x12')]({'output':_0x1a5c('0x36')});}}; \ No newline at end of file +var _0x649f=['../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','query','latest','fetch','version','status','json','origin','master','git\x20fetch','reset','--hard','FETCH_HEAD','error','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','migrations','readdirSync','join','length','.js','push','sequelize','Migration','getQueryInterface','constructor','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','exec','../../mysqldb'];(function(_0x2d4bf3,_0x216403){var _0x46565f=function(_0x47dfae){while(--_0x47dfae){_0x2d4bf3['push'](_0x2d4bf3['shift']());}};_0x46565f(++_0x216403);}(_0x649f,0x93));var _0xf649=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x649f[_0x5cb1af];return _0x8d7940;};'use strict';var Umzug=require(_0xf649('0x0'));var path=require(_0xf649('0x1'));var fs=require('fs');var _=require(_0xf649('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0xf649('0x3'));var exec=require('child_process')[_0xf649('0x4')];var db=require(_0xf649('0x5'))['db'];var config=require(_0xf649('0x6'));var pm2=require(_0xf649('0x7'));var logger=require(_0xf649('0x8'))(_0xf649('0x9'));var git=require(_0xf649('0xa'))(config[_0xf649('0xb')]);exports['index']=function(_0x53e568,_0x144078){var _0x14cd22={'current':module[_0xf649('0xc')]['version'],'phonebar':0x2};if(_0x53e568[_0xf649('0xd')]&&_0x53e568[_0xf649('0xd')][_0xf649('0xe')]){return git[_0xf649('0xf')]()['tags'](function(_0x7f5eda,_0x3ae675){_0x14cd22[_0xf649('0xe')]=(_0x7f5eda?module[_0xf649('0xc')][_0xf649('0x10')]:_0x3ae675[_0xf649('0xe')])||'2.0.0';return _0x144078[_0xf649('0x11')](0xc8)['json'](_0x14cd22);});}else{return _0x144078['status'](0xc8)[_0xf649('0x12')](_0x14cd22);}};exports[_0xf649('0xf')]=function(_0x5a23d0,_0xcf02d8){return git[_0xf649('0xf')]([_0xf649('0x13'),_0xf649('0x14')],function(_0x2bd72c){if(_0x2bd72c){logger['error'](_0x2bd72c);return _0xcf02d8[_0xf649('0x11')](0x1f4)[_0xf649('0x12')](_0x2bd72c);}logger['info'](_0xf649('0x15'));return _0xcf02d8[_0xf649('0x11')](0xc8)[_0xf649('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x25a7c1,_0x1e1740){return git[_0xf649('0x16')]([_0xf649('0x17'),_0xf649('0x18')],function(_0x2d956d){if(_0x2d956d){logger[_0xf649('0x19')](_0x2d956d);return _0x1e1740[_0xf649('0x11')](0x1f4)[_0xf649('0x12')](_0x2d956d);}logger[_0xf649('0x1a')](_0xf649('0x1b'));return _0x1e1740[_0xf649('0x11')](0xc8)[_0xf649('0x12')]({'output':_0xf649('0x1c')});});};exports[_0xf649('0x1d')]=function(_0x6cfc72,_0x344224){exec(_0xf649('0x1e'),function(_0x28e98e,_0x51be40,_0x472598){logger['info'](_0x51be40);logger[_0xf649('0x1a')](_0x472598);if(_0x28e98e){logger[_0xf649('0x19')](_0x28e98e);return _0x344224[_0xf649('0x11')](0x1f4)[_0xf649('0x12')](_0x28e98e);}return _0x344224[_0xf649('0x11')](0xc8)[_0xf649('0x12')]({'output':_0x51be40});});};exports[_0xf649('0x1f')]=function(_0x44fddb,_0xcc440a){return pm2[_0xf649('0x1f')]('motion2')[_0xf649('0x20')](function(_0x55247a){logger['info'](_0xf649('0x21'),_0x55247a);return _0xcc440a[_0xf649('0x11')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0xc66995){logger[_0xf649('0x19')](_0xc66995);return _0xcc440a[_0xf649('0x11')](0x1f4)[_0xf649('0x12')](_0xc66995);});};exports[_0xf649('0x22')]=function(_0x42e8cd,_0xef0b39){var _0x283147=fs[_0xf649('0x23')](path[_0xf649('0x24')](config[_0xf649('0xb')],'server',_0xf649('0x22')));var _0x39c4da=[];for(var _0x4a99ee=0x0;_0x4a99ee<_0x283147[_0xf649('0x25')];_0x4a99ee++){var _0x554fa9=_0x283147[_0x4a99ee]['replace'](_0xf649('0x26'),'');if(compareVersions(module[_0xf649('0xc')][_0xf649('0x10')],_0x554fa9)===-0x1){_0x39c4da[_0xf649('0x27')](_0x554fa9);}}if(_0x39c4da[_0xf649('0x25')]){var _0x5fff1c=_0x39c4da['sort'](compareVersions);var _0x3e07ca=new Umzug({'storage':_0xf649('0x28'),'storageOptions':{'model':db[_0xf649('0x29')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0xf649('0x28')][_0xf649('0x2a')](),db[_0xf649('0x28')][_0xf649('0x2b')],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[_0xf649('0x24')](config[_0xf649('0xb')],_0xf649('0x2c'),_0xf649('0x22')),'pattern':/\.js$/}});_0x3e07ca['up']({'migrations':_[_0xf649('0x2d')](_0x5fff1c,function(_0x4638b4){return _0x4638b4+_0xf649('0x26');})})[_0xf649('0x20')](function(){return _0xef0b39[_0xf649('0x11')](0xc8)[_0xf649('0x12')]({'output':_0xf649('0x2e')+module['exports'][_0xf649('0x10')]+'\x20to\x20'+_[_0xf649('0x2f')](_0x5fff1c),'migrations':_[_0xf649('0x24')](_0x5fff1c)});})[_0xf649('0x30')](function(_0xaac553){if(_0xaac553 instanceof db[_0xf649('0x28')][_0xf649('0x31')]){return _0xef0b39[_0xf649('0x11')](0xc8)[_0xf649('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0xef0b39[_0xf649('0x11')](0x1f4)[_0xf649('0x12')](_0xaac553);}});}else{return _0xef0b39['status'](0xc8)[_0xf649('0x12')]({'output':_0xf649('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index ece65d7..7516b31 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 _0x757a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','isAuthenticated','describe','/:id','post','create','put','update','util','path'];(function(_0x107486,_0x1efaad){var _0x53422e=function(_0x4f4609){while(--_0x4f4609){_0x107486['push'](_0x107486['shift']());}};_0x53422e(++_0x1efaad);}(_0x757a,0xde));var _0xa757=function(_0x4b34c4,_0x9a6cb8){_0x4b34c4=_0x4b34c4-0x0;var _0x16c1d4=_0x757a[_0x4b34c4];return _0x16c1d4;};'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')]('/describe',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['show']);router[_0xa757('0xc')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0xe')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller[_0xa757('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb7e7=['/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','index','get','/describe','describe'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xb7e7,0x121));var _0x7b7e=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xb7e7[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')]('/',auth[_0x7b7e('0xc')](),controller['create']);router[_0x7b7e('0xf')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);router[_0x7b7e('0x11')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x12')]);module[_0x7b7e('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index e5f1523..d0b1244 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 _0x46ed=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0x46ed,0x168));var _0xd46e=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x46ed[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd46e('0x2')]},'calleridnum':{'type':Sequelize[_0xd46e('0x2')]},'calleridname':{'type':Sequelize[_0xd46e('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xd46e('0x2')]},'membername':{'type':Sequelize[_0xd46e('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xd46e('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xd46e('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xd46e('0x3')]},'agentdumpAt':{'type':Sequelize[_0xd46e('0x3')]},'holdtime':{'type':Sequelize[_0xd46e('0x4')]},'agentcomplete':{'type':Sequelize[_0xd46e('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd46e('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd46e('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd46e('0x4')]},'agentacw':{'type':Sequelize[_0xd46e('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd46e('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xd46e('0x2')]},'channel':{'type':Sequelize[_0xd46e('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd46e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd46e('0x2')]},'connectedlinename':{'type':Sequelize[_0xd46e('0x2')]},'language':{'type':Sequelize[_0xd46e('0x2')]},'accountcode':{'type':Sequelize[_0xd46e('0x2')]},'context':{'type':Sequelize[_0xd46e('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd46e('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd46e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd46e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xd46e('0x2')]},'destlanguage':{'type':Sequelize[_0xd46e('0x2')]},'destaccountcode':{'type':Sequelize[_0xd46e('0x2')]},'destcontext':{'type':Sequelize[_0xd46e('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xd46e('0x2')]},'destuniqueid':{'type':Sequelize[_0xd46e('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd46e('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xd46e('0x2')]},'transfer':{'type':Sequelize[_0xd46e('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xd46e('0x6')},'transferexten':{'type':Sequelize[_0xd46e('0x2')]},'transferuniqueid':{'type':Sequelize[_0xd46e('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa630=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0xa630,0xbe));var _0x0a63=function(_0x5d77bf,_0x1a1808){_0x5d77bf=_0x5d77bf-0x0;var _0x591804=_0xa630[_0x5d77bf];return _0x591804;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0a63('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0a63('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0a63('0x2')]},'agentcalledAt':{'type':Sequelize[_0x0a63('0x3')]},'agentconnectAt':{'type':Sequelize[_0x0a63('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x0a63('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x0a63('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x0a63('0x4')]},'agentcomplete':{'type':Sequelize[_0x0a63('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x0a63('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x0a63('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x0a63('0x4')]},'agentacw':{'type':Sequelize[_0x0a63('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x0a63('0x2')]},'lastevent':{'type':Sequelize[_0x0a63('0x2')]},'channel':{'type':Sequelize[_0x0a63('0x2')]},'channelstate':{'type':Sequelize[_0x0a63('0x4')]},'channelstatedesc':{'type':Sequelize[_0x0a63('0x2')]},'connectedlinenum':{'type':Sequelize[_0x0a63('0x2')]},'connectedlinename':{'type':Sequelize[_0x0a63('0x2')]},'language':{'type':Sequelize[_0x0a63('0x2')]},'accountcode':{'type':Sequelize[_0x0a63('0x2')]},'context':{'type':Sequelize[_0x0a63('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x0a63('0x2')]},'destchannel':{'type':Sequelize[_0x0a63('0x2')]},'destchannelstate':{'type':Sequelize[_0x0a63('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x0a63('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x0a63('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x0a63('0x2')]},'destlanguage':{'type':Sequelize[_0x0a63('0x2')]},'destaccountcode':{'type':Sequelize[_0x0a63('0x2')]},'destcontext':{'type':Sequelize[_0x0a63('0x2')]},'destexten':{'type':Sequelize[_0x0a63('0x2')]},'destpriority':{'type':Sequelize[_0x0a63('0x2')]},'destuniqueid':{'type':Sequelize[_0x0a63('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x0a63('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x0a63('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x0a63('0x6')},'transferexten':{'type':Sequelize[_0x0a63('0x2')]},'transferuniqueid':{'type':Sequelize[_0x0a63('0x2')]},'agententerreason':{'type':Sequelize[_0x0a63('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 afdb1ce..99fab19 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 _0x9ff9=['send','render','merge','body','contact','message','agent','interaction','index','VoiceAgentReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','findAll','rows','catch','show','params','include','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','sendStatus','error','name'];(function(_0x27d138,_0x244e35){var _0x1900e9=function(_0x195273){while(--_0x195273){_0x27d138['push'](_0x27d138['shift']());}};_0x1900e9(++_0x244e35);}(_0x9ff9,0x114));var _0x99ff=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9ff9[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require(_0x99ff('0x0'));var rimraf=require(_0x99ff('0x1'));var zipdir=require(_0x99ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99ff('0x3'));var moment=require(_0x99ff('0x4'));var BPromise=require(_0x99ff('0x5'));var Mustache=require(_0x99ff('0x6'));var util=require('util');var path=require(_0x99ff('0x7'));var sox=require(_0x99ff('0x8'));var csv=require(_0x99ff('0x9'));var ejs=require(_0x99ff('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x99ff('0xb'));var squel=require(_0x99ff('0xc'));var crypto=require(_0x99ff('0xd'));var jsforce=require(_0x99ff('0xe'));var deskjs=require(_0x99ff('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x99ff('0x10'));var Redis=require(_0x99ff('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x99ff('0x12'));var hardwareService=require(_0x99ff('0x13'));var logger=require(_0x99ff('0x14'))('api');var utils=require(_0x99ff('0x15'));var config=require(_0x99ff('0x16'));var licenseUtil=require(_0x99ff('0x17'));var db=require(_0x99ff('0x18'))['db'];function respondWithStatusCode(_0x2262c2,_0x1324bc){_0x1324bc=_0x1324bc||0xcc;return function(_0x1a8a83){if(_0x1a8a83){return _0x2262c2['sendStatus'](_0x1324bc);}return _0x2262c2[_0x99ff('0x19')](_0x1324bc)[_0x99ff('0x1a')]();};}function respondWithResult(_0x674f6,_0x27c2e2){_0x27c2e2=_0x27c2e2||0xc8;return function(_0xcc373){if(_0xcc373){return _0x674f6['status'](_0x27c2e2)[_0x99ff('0x1b')](_0xcc373);}};}function respondWithFilteredResult(_0x156b2d,_0x44409f){return function(_0x267a24){if(_0x267a24){var _0x29e36e=typeof _0x44409f[_0x99ff('0x1c')]===_0x99ff('0x1d')&&typeof _0x44409f[_0x99ff('0x1e')]==='undefined';var _0x317e49=_0x267a24[_0x99ff('0x1f')];var _0x3db2aa=_0x29e36e?0x0:_0x44409f[_0x99ff('0x1c')];var _0xbbec57=_0x29e36e?_0x267a24[_0x99ff('0x1f')]:_0x44409f['offset']+_0x44409f['limit'];var _0x65a56;if(_0xbbec57>=_0x317e49){_0xbbec57=_0x317e49;_0x65a56=0xc8;}else{_0x65a56=0xce;}_0x156b2d['status'](_0x65a56);return _0x156b2d['set'](_0x99ff('0x20'),_0x3db2aa+'-'+_0xbbec57+'/'+_0x317e49)[_0x99ff('0x1b')](_0x267a24);}return null;};}function patchUpdates(_0x4d98c5){return function(_0x38c51e){try{jsonpatch[_0x99ff('0x21')](_0x38c51e,_0x4d98c5,!![]);}catch(_0x50ade3){return BPromise['reject'](_0x50ade3);}return _0x38c51e['save']();};}function saveUpdates(_0x4e99c1,_0x488a2c){return function(_0x1f1584){if(_0x1f1584){return _0x1f1584[_0x99ff('0x22')](_0x4e99c1)[_0x99ff('0x23')](function(_0x93e26d){return _0x93e26d;});}return null;};}function removeEntity(_0x1a0f18,_0x4e1081){return function(_0x25e093){if(_0x25e093){return _0x25e093[_0x99ff('0x24')]()[_0x99ff('0x23')](function(){_0x1a0f18['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aeaa1,_0x255852){return function(_0x253de0){if(!_0x253de0){_0x1aeaa1[_0x99ff('0x25')](0x194);}return _0x253de0;};}function handleError(_0x20c4ed,_0x5a2689){_0x5a2689=_0x5a2689||0x1f4;return function(_0x1d7f60){logger[_0x99ff('0x26')](_0x1d7f60['stack']);if(_0x1d7f60['name']){delete _0x1d7f60[_0x99ff('0x27')];}_0x20c4ed[_0x99ff('0x19')](_0x5a2689)[_0x99ff('0x28')](_0x1d7f60);};}function getMustacheRender(_0x427fd9,_0x693b0f){return Mustache[_0x99ff('0x29')](_0x427fd9,_[_0x99ff('0x2a')](_0x693b0f[_0x99ff('0x2b')],{'contact':_0x693b0f[_0x99ff('0x2c')],'message':_0x693b0f[_0x99ff('0x2d')],'agent':_0x693b0f[_0x99ff('0x2e')],'interaction':_0x693b0f[_0x99ff('0x2f')],'account':_0x693b0f['account']}))||'';}exports[_0x99ff('0x30')]=function(_0x12c4ff,_0x2c9cfc){var _0x1111da={},_0x2102b3={},_0x3713b7={'count':0x0,'rows':[]};var _0x3fae8c=_['map'](db[_0x99ff('0x31')][_0x99ff('0x32')],function(_0x1f3651){return{'name':_0x1f3651[_0x99ff('0x33')],'type':_0x1f3651[_0x99ff('0x34')][_0x99ff('0x35')]};});_0x2102b3[_0x99ff('0x36')]=_[_0x99ff('0x37')](_0x3fae8c,'name');_0x2102b3['query']=_[_0x99ff('0x38')](_0x12c4ff[_0x99ff('0x39')]);_0x2102b3[_0x99ff('0x3a')]=_['intersection'](_0x2102b3[_0x99ff('0x36')],_0x2102b3['query']);_0x1111da[_0x99ff('0x3b')]=_[_0x99ff('0x3c')](_0x2102b3[_0x99ff('0x36')],qs[_0x99ff('0x3d')](_0x12c4ff[_0x99ff('0x39')]['fields']));_0x1111da[_0x99ff('0x3b')]=_0x1111da[_0x99ff('0x3b')][_0x99ff('0x3e')]?_0x1111da[_0x99ff('0x3b')]:_0x2102b3[_0x99ff('0x36')];if(!_0x12c4ff['query'][_0x99ff('0x3f')]('nolimit')){_0x1111da[_0x99ff('0x1e')]=qs[_0x99ff('0x1e')](_0x12c4ff[_0x99ff('0x39')][_0x99ff('0x1e')]);_0x1111da[_0x99ff('0x1c')]=qs[_0x99ff('0x1c')](_0x12c4ff[_0x99ff('0x39')][_0x99ff('0x1c')]);}_0x1111da[_0x99ff('0x40')]=qs[_0x99ff('0x41')](_0x12c4ff[_0x99ff('0x39')][_0x99ff('0x41')]);_0x1111da[_0x99ff('0x42')]=qs[_0x99ff('0x3a')](_[_0x99ff('0x43')](_0x12c4ff[_0x99ff('0x39')],_0x2102b3[_0x99ff('0x3a')]),_0x3fae8c);if(_0x12c4ff['query'][_0x99ff('0x44')]){_0x1111da[_0x99ff('0x42')]=_[_0x99ff('0x2a')](_0x1111da[_0x99ff('0x42')],{'$or':_[_0x99ff('0x37')](_0x3fae8c,function(_0x5b80f5){if(_0x5b80f5[_0x99ff('0x34')]!=='VIRTUAL'){var _0x177893={};_0x177893[_0x5b80f5['name']]={'$like':'%'+_0x12c4ff['query'][_0x99ff('0x44')]+'%'};return _0x177893;}})});}_0x1111da=_['merge']({},_0x1111da,_0x12c4ff[_0x99ff('0x45')]);var _0x34a69f={'where':_0x1111da['where']};return db['VoiceAgentReport'][_0x99ff('0x1f')](_0x34a69f)[_0x99ff('0x23')](function(_0x4695cf){_0x3713b7[_0x99ff('0x1f')]=_0x4695cf;if(_0x12c4ff[_0x99ff('0x39')][_0x99ff('0x46')]){_0x1111da['include']=[{'all':!![]}];}return db[_0x99ff('0x31')][_0x99ff('0x47')](_0x1111da);})[_0x99ff('0x23')](function(_0x1dcaff){_0x3713b7[_0x99ff('0x48')]=_0x1dcaff;return _0x3713b7;})[_0x99ff('0x23')](respondWithFilteredResult(_0x2c9cfc,_0x1111da))[_0x99ff('0x49')](handleError(_0x2c9cfc,null));};exports[_0x99ff('0x4a')]=function(_0x27f558,_0x277116){var _0x119179={'raw':![],'where':{'id':_0x27f558[_0x99ff('0x4b')]['id']}},_0x1ba904={};_0x1ba904[_0x99ff('0x36')]=_[_0x99ff('0x38')](db[_0x99ff('0x31')][_0x99ff('0x32')]);_0x1ba904[_0x99ff('0x39')]=_[_0x99ff('0x38')](_0x27f558[_0x99ff('0x39')]);_0x1ba904['filters']=_['intersection'](_0x1ba904['model'],_0x1ba904[_0x99ff('0x39')]);_0x119179[_0x99ff('0x3b')]=_['intersection'](_0x1ba904[_0x99ff('0x36')],qs[_0x99ff('0x3d')](_0x27f558[_0x99ff('0x39')][_0x99ff('0x3d')]));_0x119179[_0x99ff('0x3b')]=_0x119179['attributes']['length']?_0x119179[_0x99ff('0x3b')]:_0x1ba904[_0x99ff('0x36')];if(_0x27f558[_0x99ff('0x39')][_0x99ff('0x46')]){_0x119179[_0x99ff('0x4c')]=[{'all':!![]}];}_0x119179=_['merge']({},_0x119179,_0x27f558[_0x99ff('0x45')]);return db[_0x99ff('0x31')][_0x99ff('0x4d')](_0x119179)[_0x99ff('0x23')](handleEntityNotFound(_0x277116,null))[_0x99ff('0x23')](respondWithResult(_0x277116,null))['catch'](handleError(_0x277116,null));};exports['create']=function(_0x173488,_0x460115){return db['VoiceAgentReport']['create'](_0x173488['body'],{})[_0x99ff('0x23')](respondWithResult(_0x460115,0xc9))[_0x99ff('0x49')](handleError(_0x460115,null));};exports[_0x99ff('0x22')]=function(_0x4c5021,_0x5a4a60){if(_0x4c5021['body']['id']){delete _0x4c5021[_0x99ff('0x2b')]['id'];}return db[_0x99ff('0x31')][_0x99ff('0x4d')]({'where':{'id':_0x4c5021['params']['id']}})['then'](handleEntityNotFound(_0x5a4a60,null))[_0x99ff('0x23')](saveUpdates(_0x4c5021['body'],null))[_0x99ff('0x23')](respondWithResult(_0x5a4a60,null))[_0x99ff('0x49')](handleError(_0x5a4a60,null));};exports[_0x99ff('0x24')]=function(_0x379aa5,_0xa60787){return db[_0x99ff('0x31')][_0x99ff('0x4d')]({'where':{'id':_0x379aa5[_0x99ff('0x4b')]['id']}})[_0x99ff('0x23')](handleEntityNotFound(_0xa60787,null))[_0x99ff('0x23')](removeEntity(_0xa60787,null))[_0x99ff('0x49')](handleError(_0xa60787,null));};exports[_0x99ff('0x4e')]=function(_0xe0d521,_0x57d655){return db['VoiceAgentReport'][_0x99ff('0x4e')]()[_0x99ff('0x23')](respondWithResult(_0x57d655,null))['catch'](handleError(_0x57d655,null));}; \ No newline at end of file +var _0x52aa=['query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','length','includeAll','find','catch','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','reject','update','then','destroy','end','error','name','send','render','merge','body','contact','agent','interaction','index','VoiceAgentReport','fieldName','type','key','model','map','keys'];(function(_0x20473a,_0x38b93f){var _0x5b11ff=function(_0xddd1d2){while(--_0xddd1d2){_0x20473a['push'](_0x20473a['shift']());}};_0x5b11ff(++_0x38b93f);}(_0x52aa,0x102));var _0xa52a=function(_0x411f64,_0x6d0133){_0x411f64=_0x411f64-0x0;var _0x5ed013=_0x52aa[_0x411f64];return _0x5ed013;};'use strict';var emlformat=require(_0xa52a('0x0'));var rimraf=require(_0xa52a('0x1'));var zipdir=require(_0xa52a('0x2'));var jsonpatch=require(_0xa52a('0x3'));var rp=require('request-promise');var moment=require(_0xa52a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa52a('0x5'));var util=require(_0xa52a('0x6'));var path=require(_0xa52a('0x7'));var sox=require('sox');var csv=require(_0xa52a('0x8'));var ejs=require(_0xa52a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa52a('0xa'));var squel=require(_0xa52a('0xb'));var crypto=require(_0xa52a('0xc'));var jsforce=require(_0xa52a('0xd'));var deskjs=require(_0xa52a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa52a('0xf'));var Papa=require('papaparse');var Redis=require(_0xa52a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa52a('0x11'));var as=require(_0xa52a('0x12'));var hardwareService=require(_0xa52a('0x13'));var logger=require(_0xa52a('0x14'))(_0xa52a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa52a('0x16'));var db=require(_0xa52a('0x17'))['db'];function respondWithStatusCode(_0x382292,_0x28b8be){_0x28b8be=_0x28b8be||0xcc;return function(_0x24034f){if(_0x24034f){return _0x382292[_0xa52a('0x18')](_0x28b8be);}return _0x382292[_0xa52a('0x19')](_0x28b8be)['end']();};}function respondWithResult(_0x14a0df,_0x3b02e1){_0x3b02e1=_0x3b02e1||0xc8;return function(_0xc7a661){if(_0xc7a661){return _0x14a0df[_0xa52a('0x19')](_0x3b02e1)[_0xa52a('0x1a')](_0xc7a661);}};}function respondWithFilteredResult(_0x2ea4a8,_0x2ab2c7){return function(_0x3b139c){if(_0x3b139c){var _0x7402f8=typeof _0x2ab2c7['offset']===_0xa52a('0x1b')&&typeof _0x2ab2c7[_0xa52a('0x1c')]==='undefined';var _0x443f78=_0x3b139c[_0xa52a('0x1d')];var _0x4999db=_0x7402f8?0x0:_0x2ab2c7[_0xa52a('0x1e')];var _0x97fc57=_0x7402f8?_0x3b139c[_0xa52a('0x1d')]:_0x2ab2c7['offset']+_0x2ab2c7[_0xa52a('0x1c')];var _0x341702;if(_0x97fc57>=_0x443f78){_0x97fc57=_0x443f78;_0x341702=0xc8;}else{_0x341702=0xce;}_0x2ea4a8['status'](_0x341702);return _0x2ea4a8['set'](_0xa52a('0x1f'),_0x4999db+'-'+_0x97fc57+'/'+_0x443f78)[_0xa52a('0x1a')](_0x3b139c);}return null;};}function patchUpdates(_0x1423a0){return function(_0x5332a1){try{jsonpatch['apply'](_0x5332a1,_0x1423a0,!![]);}catch(_0x2ab546){return BPromise[_0xa52a('0x20')](_0x2ab546);}return _0x5332a1['save']();};}function saveUpdates(_0x4f7138,_0x28ca31){return function(_0x4385a6){if(_0x4385a6){return _0x4385a6[_0xa52a('0x21')](_0x4f7138)[_0xa52a('0x22')](function(_0x446a7a){return _0x446a7a;});}return null;};}function removeEntity(_0x45300a,_0x22f845){return function(_0x58b7f8){if(_0x58b7f8){return _0x58b7f8[_0xa52a('0x23')]()[_0xa52a('0x22')](function(){_0x45300a[_0xa52a('0x19')](0xcc)[_0xa52a('0x24')]();});}};}function handleEntityNotFound(_0x7c0a85,_0x567235){return function(_0x527381){if(!_0x527381){_0x7c0a85['sendStatus'](0x194);}return _0x527381;};}function handleError(_0x2c638c,_0x53ee75){_0x53ee75=_0x53ee75||0x1f4;return function(_0x227633){logger[_0xa52a('0x25')](_0x227633['stack']);if(_0x227633[_0xa52a('0x26')]){delete _0x227633[_0xa52a('0x26')];}_0x2c638c[_0xa52a('0x19')](_0x53ee75)[_0xa52a('0x27')](_0x227633);};}function getMustacheRender(_0x576335,_0x20c3df){return Mustache[_0xa52a('0x28')](_0x576335,_[_0xa52a('0x29')](_0x20c3df[_0xa52a('0x2a')],{'contact':_0x20c3df[_0xa52a('0x2b')],'message':_0x20c3df['message'],'agent':_0x20c3df[_0xa52a('0x2c')],'interaction':_0x20c3df[_0xa52a('0x2d')],'account':_0x20c3df['account']}))||'';}exports[_0xa52a('0x2e')]=function(_0x3788fb,_0x4dd0d1){var _0x3570e9={},_0x4b3023={},_0x800b1a={'count':0x0,'rows':[]};var _0x23327a=_['map'](db[_0xa52a('0x2f')]['rawAttributes'],function(_0x4f60d8){return{'name':_0x4f60d8[_0xa52a('0x30')],'type':_0x4f60d8[_0xa52a('0x31')][_0xa52a('0x32')]};});_0x4b3023[_0xa52a('0x33')]=_[_0xa52a('0x34')](_0x23327a,_0xa52a('0x26'));_0x4b3023['query']=_[_0xa52a('0x35')](_0x3788fb[_0xa52a('0x36')]);_0x4b3023[_0xa52a('0x37')]=_[_0xa52a('0x38')](_0x4b3023['model'],_0x4b3023[_0xa52a('0x36')]);_0x3570e9[_0xa52a('0x39')]=_[_0xa52a('0x38')](_0x4b3023[_0xa52a('0x33')],qs[_0xa52a('0x3a')](_0x3788fb['query'][_0xa52a('0x3a')]));_0x3570e9['attributes']=_0x3570e9[_0xa52a('0x39')]['length']?_0x3570e9[_0xa52a('0x39')]:_0x4b3023[_0xa52a('0x33')];if(!_0x3788fb['query'][_0xa52a('0x3b')]('nolimit')){_0x3570e9[_0xa52a('0x1c')]=qs[_0xa52a('0x1c')](_0x3788fb[_0xa52a('0x36')][_0xa52a('0x1c')]);_0x3570e9[_0xa52a('0x1e')]=qs['offset'](_0x3788fb['query'][_0xa52a('0x1e')]);}_0x3570e9['order']=qs[_0xa52a('0x3c')](_0x3788fb['query'][_0xa52a('0x3c')]);_0x3570e9[_0xa52a('0x3d')]=qs[_0xa52a('0x37')](_[_0xa52a('0x3e')](_0x3788fb['query'],_0x4b3023[_0xa52a('0x37')]),_0x23327a);if(_0x3788fb[_0xa52a('0x36')][_0xa52a('0x3f')]){_0x3570e9['where']=_[_0xa52a('0x29')](_0x3570e9[_0xa52a('0x3d')],{'$or':_[_0xa52a('0x34')](_0x23327a,function(_0x5ad81f){if(_0x5ad81f[_0xa52a('0x31')]!==_0xa52a('0x40')){var _0x5246f8={};_0x5246f8[_0x5ad81f['name']]={'$like':'%'+_0x3788fb['query'][_0xa52a('0x3f')]+'%'};return _0x5246f8;}})});}_0x3570e9=_['merge']({},_0x3570e9,_0x3788fb[_0xa52a('0x41')]);var _0x219fb5={'where':_0x3570e9[_0xa52a('0x3d')]};return db['VoiceAgentReport'][_0xa52a('0x1d')](_0x219fb5)[_0xa52a('0x22')](function(_0x82f5f5){_0x800b1a[_0xa52a('0x1d')]=_0x82f5f5;if(_0x3788fb[_0xa52a('0x36')]['includeAll']){_0x3570e9[_0xa52a('0x42')]=[{'all':!![]}];}return db[_0xa52a('0x2f')][_0xa52a('0x43')](_0x3570e9);})['then'](function(_0x294926){_0x800b1a[_0xa52a('0x44')]=_0x294926;return _0x800b1a;})[_0xa52a('0x22')](respondWithFilteredResult(_0x4dd0d1,_0x3570e9))['catch'](handleError(_0x4dd0d1,null));};exports[_0xa52a('0x45')]=function(_0xb542b7,_0x413de1){var _0x19b656={'raw':![],'where':{'id':_0xb542b7[_0xa52a('0x46')]['id']}},_0x3b5ef7={};_0x3b5ef7[_0xa52a('0x33')]=_[_0xa52a('0x35')](db[_0xa52a('0x2f')][_0xa52a('0x47')]);_0x3b5ef7[_0xa52a('0x36')]=_['keys'](_0xb542b7[_0xa52a('0x36')]);_0x3b5ef7[_0xa52a('0x37')]=_['intersection'](_0x3b5ef7['model'],_0x3b5ef7[_0xa52a('0x36')]);_0x19b656['attributes']=_[_0xa52a('0x38')](_0x3b5ef7[_0xa52a('0x33')],qs[_0xa52a('0x3a')](_0xb542b7[_0xa52a('0x36')][_0xa52a('0x3a')]));_0x19b656['attributes']=_0x19b656[_0xa52a('0x39')][_0xa52a('0x48')]?_0x19b656[_0xa52a('0x39')]:_0x3b5ef7[_0xa52a('0x33')];if(_0xb542b7['query'][_0xa52a('0x49')]){_0x19b656['include']=[{'all':!![]}];}_0x19b656=_['merge']({},_0x19b656,_0xb542b7[_0xa52a('0x41')]);return db[_0xa52a('0x2f')][_0xa52a('0x4a')](_0x19b656)[_0xa52a('0x22')](handleEntityNotFound(_0x413de1,null))[_0xa52a('0x22')](respondWithResult(_0x413de1,null))[_0xa52a('0x4b')](handleError(_0x413de1,null));};exports['create']=function(_0x42e814,_0xd62be2){return db[_0xa52a('0x2f')][_0xa52a('0x4c')](_0x42e814['body'],{})[_0xa52a('0x22')](respondWithResult(_0xd62be2,0xc9))[_0xa52a('0x4b')](handleError(_0xd62be2,null));};exports[_0xa52a('0x21')]=function(_0x368e66,_0x40f7d4){if(_0x368e66[_0xa52a('0x2a')]['id']){delete _0x368e66['body']['id'];}return db[_0xa52a('0x2f')][_0xa52a('0x4a')]({'where':{'id':_0x368e66['params']['id']}})[_0xa52a('0x22')](handleEntityNotFound(_0x40f7d4,null))[_0xa52a('0x22')](saveUpdates(_0x368e66[_0xa52a('0x2a')],null))['then'](respondWithResult(_0x40f7d4,null))[_0xa52a('0x4b')](handleError(_0x40f7d4,null));};exports['destroy']=function(_0x3aa8b8,_0x4f33c2){return db[_0xa52a('0x2f')][_0xa52a('0x4a')]({'where':{'id':_0x3aa8b8[_0xa52a('0x46')]['id']}})[_0xa52a('0x22')](handleEntityNotFound(_0x4f33c2,null))[_0xa52a('0x22')](removeEntity(_0x4f33c2,null))[_0xa52a('0x4b')](handleError(_0x4f33c2,null));};exports[_0xa52a('0x4d')]=function(_0x372036,_0x3839e6){return db[_0xa52a('0x2f')][_0xa52a('0x4d')]()[_0xa52a('0x22')](respondWithResult(_0x3839e6,null))[_0xa52a('0x4b')](handleError(_0x3839e6,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 1be992c..71e64ae 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 _0xf3d0=['exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2fd387,_0x3d3402){var _0xf7ddb6=function(_0x3fdd56){while(--_0x3fdd56){_0x2fd387['push'](_0x2fd387['shift']());}};_0xf7ddb6(++_0x3d3402);}(_0xf3d0,0x18e));var _0x0f3d=function(_0x210c6c,_0x5da53a){_0x210c6c=_0x210c6c-0x0;var _0x387f3b=_0xf3d0[_0x210c6c];return _0x387f3b;};'use strict';var _=require(_0x0f3d('0x0'));var util=require(_0x0f3d('0x1'));var logger=require('../../config/logger')(_0x0f3d('0x2'));var moment=require(_0x0f3d('0x3'));var BPromise=require(_0x0f3d('0x4'));var rp=require(_0x0f3d('0x5'));var fs=require('fs');var path=require(_0x0f3d('0x6'));var rimraf=require(_0x0f3d('0x7'));var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module[_0x0f3d('0x8')]=function(_0x20a1a9,_0x32fa4d){return _0x20a1a9[_0x0f3d('0x9')](_0x0f3d('0xa'),attributes,{'tableName':_0x0f3d('0xb'),'paranoid':![],'indexes':[{'fields':[_0x0f3d('0xc'),_0x0f3d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x88a5=['destuniqueid','util','../../config/logger','api','moment','bluebird','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x2f3637,_0x26f649){var _0x208720=function(_0x4bb5e5){while(--_0x4bb5e5){_0x2f3637['push'](_0x2f3637['shift']());}};_0x208720(++_0x26f649);}(_0x88a5,0x90));var _0x588a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x88a5[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x588a('0x0'));var logger=require(_0x588a('0x1'))(_0x588a('0x2'));var moment=require(_0x588a('0x3'));var BPromise=require(_0x588a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x588a('0x5'));var attributes=require(_0x588a('0x6'));module[_0x588a('0x7')]=function(_0x514650,_0x3dd769){return _0x514650[_0x588a('0x8')](_0x588a('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0x588a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 42a1a01..fa5f153 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 _0xbb29=['error','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','stringify','update','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','debug'];(function(_0x34db98,_0x28a2b0){var _0x4fb10c=function(_0x1506bf){while(--_0x1506bf){_0x34db98['push'](_0x34db98['shift']());}};_0x4fb10c(++_0x28a2b0);}(_0xbb29,0xe3));var _0x9bb2=function(_0x168932,_0x1e760){_0x168932=_0x168932-0x0;var _0x2a5b46=_0xbb29[_0x168932];return _0x2a5b46;};'use strict';var _=require(_0x9bb2('0x0'));var util=require(_0x9bb2('0x1'));var moment=require(_0x9bb2('0x2'));var BPromise=require(_0x9bb2('0x3'));var rs=require(_0x9bb2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9bb2('0x5'))(_0x9bb2('0x6'));var config=require('../../config/environment');var jayson=require(_0x9bb2('0x7'));var client=jayson['client'][_0x9bb2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4aab63,_0x22b0cd,_0x512d4e){return new BPromise(function(_0x34e4de,_0x5e5446){return client['request'](_0x4aab63,_0x512d4e)[_0x9bb2('0x9')](function(_0x48bfcd){logger[_0x9bb2('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x22b0cd,_0x9bb2('0xb'));logger[_0x9bb2('0xc')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x22b0cd,'request\x20sent',JSON['stringify'](_0x48bfcd));if(_0x48bfcd['error']){if(_0x48bfcd[_0x9bb2('0xd')]['code']===0x1f4){logger[_0x9bb2('0xd')](_0x9bb2('0xe'),_0x22b0cd,_0x48bfcd['error'][_0x9bb2('0xf')]);return _0x5e5446(_0x48bfcd[_0x9bb2('0xd')][_0x9bb2('0xf')]);}logger[_0x9bb2('0xd')](_0x9bb2('0xe'),_0x22b0cd,_0x48bfcd[_0x9bb2('0xd')][_0x9bb2('0xf')]);return _0x34e4de(_0x48bfcd['error']['message']);}else{logger[_0x9bb2('0xa')](_0x9bb2('0xe'),_0x22b0cd,'request\x20sent');_0x34e4de(_0x48bfcd[_0x9bb2('0x10')][_0x9bb2('0xf')]);}})[_0x9bb2('0x11')](function(_0x455b57){logger[_0x9bb2('0xd')](_0x9bb2('0xe'),_0x22b0cd,_0x455b57);_0x5e5446(_0x455b57);});});}exports['CreateVoiceAgentReport']=function(_0x3349a0){var _0x2fdabc=this;return new Promise(function(_0x5ab5c0,_0x247ddf){return db[_0x9bb2('0x12')][_0x9bb2('0x13')](_0x3349a0[_0x9bb2('0x14')],{'raw':_0x3349a0['options']?_0x3349a0[_0x9bb2('0x15')][_0x9bb2('0x16')]===undefined?!![]:![]:!![]})[_0x9bb2('0x9')](function(_0x35fa2f){logger[_0x9bb2('0xa')](_0x9bb2('0x17'),_0x3349a0);logger[_0x9bb2('0xc')](_0x9bb2('0x17'),_0x3349a0,JSON[_0x9bb2('0x18')](_0x35fa2f));_0x5ab5c0(_0x35fa2f);})['catch'](function(_0x294dea){logger[_0x9bb2('0xd')](_0x9bb2('0x17'),_0x294dea[_0x9bb2('0xf')],_0x3349a0);_0x247ddf(_0x2fdabc[_0x9bb2('0xd')](0x1f4,_0x294dea['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x25bf4e){var _0xd0b33c=this;return new Promise(function(_0x4d592a,_0x521730){return db[_0x9bb2('0x12')][_0x9bb2('0x19')](_0x25bf4e[_0x9bb2('0x14')],{'raw':_0x25bf4e[_0x9bb2('0x15')]?_0x25bf4e[_0x9bb2('0x15')][_0x9bb2('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25bf4e[_0x9bb2('0x15')]?_0x25bf4e['options'][_0x9bb2('0x1a')]||null:null,'attributes':_0x25bf4e[_0x9bb2('0x15')]?_0x25bf4e[_0x9bb2('0x15')][_0x9bb2('0x1b')]||null:null,'limit':_0x25bf4e[_0x9bb2('0x15')]?_0x25bf4e[_0x9bb2('0x15')][_0x9bb2('0x1c')]||null:null})['then'](function(_0x231976){logger[_0x9bb2('0xa')](_0x9bb2('0x1d'),_0x25bf4e);logger[_0x9bb2('0xc')](_0x9bb2('0x1d'),_0x25bf4e,JSON[_0x9bb2('0x18')](_0x231976));_0x4d592a(_0x231976);})[_0x9bb2('0x11')](function(_0x1f1d7c){logger[_0x9bb2('0xd')](_0x9bb2('0x1d'),_0x1f1d7c[_0x9bb2('0xf')],_0x25bf4e);_0x521730(_0xd0b33c[_0x9bb2('0xd')](0x1f4,_0x1f1d7c[_0x9bb2('0xf')]));});});}; \ No newline at end of file +var _0xaabf=['rpc','client','info','VoiceAgentReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','UpdateVoiceAgentReport','update','where','attributes','limit','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xaabf,0x11c));var _0xfaab=function(_0x2e963d,_0x15e940){_0x2e963d=_0x2e963d-0x0;var _0x256157=_0xaabf[_0x2e963d];return _0x256157;};'use strict';var _=require('lodash');var util=require(_0xfaab('0x0'));var moment=require('moment');var BPromise=require(_0xfaab('0x1'));var rs=require(_0xfaab('0x2'));var fs=require('fs');var Redis=require(_0xfaab('0x3'));var db=require(_0xfaab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfaab('0x5'))(_0xfaab('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfaab('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21a54b,_0x3b7c58,_0x17ca87){return new BPromise(function(_0x56493f,_0x209544){return client['request'](_0x21a54b,_0x17ca87)['then'](function(_0x333430){logger[_0xfaab('0x8')](_0xfaab('0x9'),_0x3b7c58,'request\x20sent');logger[_0xfaab('0xa')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x3b7c58,_0xfaab('0xb'),JSON[_0xfaab('0xc')](_0x333430));if(_0x333430[_0xfaab('0xd')]){if(_0x333430['error'][_0xfaab('0xe')]===0x1f4){logger[_0xfaab('0xd')](_0xfaab('0x9'),_0x3b7c58,_0x333430[_0xfaab('0xd')][_0xfaab('0xf')]);return _0x209544(_0x333430['error']['message']);}logger[_0xfaab('0xd')](_0xfaab('0x9'),_0x3b7c58,_0x333430[_0xfaab('0xd')][_0xfaab('0xf')]);return _0x56493f(_0x333430[_0xfaab('0xd')][_0xfaab('0xf')]);}else{logger[_0xfaab('0x8')]('VoiceAgentReport,\x20%s,\x20%s',_0x3b7c58,_0xfaab('0xb'));_0x56493f(_0x333430[_0xfaab('0x10')][_0xfaab('0xf')]);}})[_0xfaab('0x11')](function(_0x19fcd1){logger[_0xfaab('0xd')](_0xfaab('0x9'),_0x3b7c58,_0x19fcd1);_0x209544(_0x19fcd1);});});}exports[_0xfaab('0x12')]=function(_0x2008f2){var _0x8fe170=this;return new Promise(function(_0x1efc71,_0xc7a460){return db[_0xfaab('0x13')][_0xfaab('0x14')](_0x2008f2[_0xfaab('0x15')],{'raw':_0x2008f2[_0xfaab('0x16')]?_0x2008f2[_0xfaab('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x159d7e){logger['info']('CreateVoiceAgentReport',_0x2008f2);logger['debug'](_0xfaab('0x12'),_0x2008f2,JSON[_0xfaab('0xc')](_0x159d7e));_0x1efc71(_0x159d7e);})[_0xfaab('0x11')](function(_0x3e5e87){logger[_0xfaab('0xd')]('CreateVoiceAgentReport',_0x3e5e87[_0xfaab('0xf')],_0x2008f2);_0xc7a460(_0x8fe170['error'](0x1f4,_0x3e5e87['message']));});});};exports[_0xfaab('0x17')]=function(_0x1c5286){var _0xa9b61=this;return new Promise(function(_0x44be01,_0x398302){return db[_0xfaab('0x13')][_0xfaab('0x18')](_0x1c5286['body'],{'raw':_0x1c5286[_0xfaab('0x16')]?_0x1c5286['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c5286[_0xfaab('0x16')]?_0x1c5286[_0xfaab('0x16')][_0xfaab('0x19')]||null:null,'attributes':_0x1c5286['options']?_0x1c5286[_0xfaab('0x16')][_0xfaab('0x1a')]||null:null,'limit':_0x1c5286[_0xfaab('0x16')]?_0x1c5286[_0xfaab('0x16')][_0xfaab('0x1b')]||null:null})[_0xfaab('0x1c')](function(_0x3da98d){logger[_0xfaab('0x8')](_0xfaab('0x17'),_0x1c5286);logger[_0xfaab('0xa')](_0xfaab('0x17'),_0x1c5286,JSON[_0xfaab('0xc')](_0x3da98d));_0x44be01(_0x3da98d);})[_0xfaab('0x11')](function(_0x542c3f){logger[_0xfaab('0xd')](_0xfaab('0x17'),_0x542c3f[_0xfaab('0xf')],_0x1c5286);_0x398302(_0xa9b61[_0xfaab('0xd')](0x1f4,_0x542c3f[_0xfaab('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index e4441de..3c8fb35 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','show','post'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','show','post'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 7cff1b4..1a65460 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 _0x53ec=['internal','inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound'];(function(_0x165da7,_0x3d18ef){var _0xcd7f87=function(_0x94ae62){while(--_0x94ae62){_0x165da7['push'](_0x165da7['shift']());}};_0xcd7f87(++_0x3d18ef);}(_0x53ec,0x192));var _0xc53e=function(_0x30bef2,_0x3d4186){_0x30bef2=_0x30bef2-0x0;var _0x567d67=_0x53ec[_0x30bef2];return _0x567d67;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'uniqueid':{'type':Sequelize[_0xc53e('0x2')]},'type':{'type':Sequelize[_0xc53e('0x3')](_0xc53e('0x4'),_0xc53e('0x5'),'outbound',_0xc53e('0x6'),'outbound-fax',_0xc53e('0x7'))},'tag':{'type':Sequelize[_0xc53e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xc53e('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xc53e('0x2')]},'callerid':{'type':Sequelize[_0xc53e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xc53e('0x2')]},'lastapplication':{'type':Sequelize[_0xc53e('0x2')]},'lastdata':{'type':Sequelize[_0xc53e('0x8')]},'starttime':{'type':Sequelize[_0xc53e('0x9')]},'systemanswertime':{'type':Sequelize[_0xc53e('0x9')]},'answertime':{'type':Sequelize[_0xc53e('0x9')]},'endtime':{'type':Sequelize[_0xc53e('0x9')]},'duration':{'type':Sequelize[_0xc53e('0xa')]},'billableseconds':{'type':Sequelize[_0xc53e('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xc53e('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xc53e('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xc53e('0x2')]},'note':{'type':Sequelize[_0xc53e('0x2')]},'prefix':{'type':Sequelize[_0xc53e('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2123=['ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x55b7a4,_0x32f472){var _0x1fe954=function(_0x2019e3){while(--_0x2019e3){_0x55b7a4['push'](_0x55b7a4['shift']());}};_0x1fe954(++_0x32f472);}(_0x2123,0x190));var _0x3212=function(_0x30c19a,_0x31e308){_0x30c19a=_0x30c19a-0x0;var _0xbe7598=_0x2123[_0x30c19a];return _0xbe7598;};'use strict';var Sequelize=require(_0x3212('0x0'));module[_0x3212('0x1')]={'uniqueid':{'type':Sequelize[_0x3212('0x2')]},'type':{'type':Sequelize[_0x3212('0x3')](_0x3212('0x4'),_0x3212('0x5'),_0x3212('0x6'),_0x3212('0x7'),_0x3212('0x8'),_0x3212('0x9'))},'tag':{'type':Sequelize[_0x3212('0x2')]},'accountcode':{'type':Sequelize[_0x3212('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x3212('0x2')]},'destinationcontext':{'type':Sequelize[_0x3212('0x2')]},'callerid':{'type':Sequelize[_0x3212('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x3212('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x3212('0xa')]},'starttime':{'type':Sequelize[_0x3212('0xb')]},'systemanswertime':{'type':Sequelize[_0x3212('0xb')]},'answertime':{'type':Sequelize[_0x3212('0xb')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x3212('0xc')]},'mohtime':{'type':Sequelize[_0x3212('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3212('0x2')]},'amaflags':{'type':Sequelize[_0x3212('0x2')]},'userfield':{'type':Sequelize[_0x3212('0x2')]},'userDisposition':{'type':Sequelize[_0x3212('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x3212('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x3212('0x2')]},'note':{'type':Sequelize[_0x3212('0x2')]},'prefix':{'type':Sequelize[_0x3212('0x2')]},'routeid':{'type':Sequelize[_0x3212('0xc')]},'sipcallid':{'type':Sequelize[_0x3212('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index baf54ee..48a893e 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 _0x483e=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','end','sendStatus','error','stack','name','send','render','merge','body','contact','message','agent','interaction','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','User','then','catch','show','params','includeAll','include','options','find','create','describe','user','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel'];(function(_0x1d04b7,_0x7afaac){var _0xe39a02=function(_0x1466e5){while(--_0x1466e5){_0x1d04b7['push'](_0x1d04b7['shift']());}};_0xe39a02(++_0x7afaac);}(_0x483e,0x9b));var _0xe483=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x483e[_0xdd2bfa];return _0x55397e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe483('0x0'));var zipdir=require(_0xe483('0x1'));var jsonpatch=require(_0xe483('0x2'));var rp=require(_0xe483('0x3'));var moment=require(_0xe483('0x4'));var BPromise=require(_0xe483('0x5'));var Mustache=require(_0xe483('0x6'));var util=require(_0xe483('0x7'));var path=require('path');var sox=require(_0xe483('0x8'));var csv=require(_0xe483('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe483('0xa'));var _=require(_0xe483('0xb'));var squel=require(_0xe483('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe483('0xd'));var toCsv=require(_0xe483('0x9'));var querystring=require(_0xe483('0xe'));var Papa=require(_0xe483('0xf'));var Redis=require(_0xe483('0x10'));var authService=require(_0xe483('0x11'));var qs=require(_0xe483('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe483('0x13'));var logger=require(_0xe483('0x14'))('api');var utils=require(_0xe483('0x15'));var config=require(_0xe483('0x16'));var licenseUtil=require(_0xe483('0x17'));var db=require(_0xe483('0x18'))['db'];function respondWithStatusCode(_0x151a02,_0x546122){_0x546122=_0x546122||0xcc;return function(_0x3fa396){if(_0x3fa396){return _0x151a02['sendStatus'](_0x546122);}return _0x151a02['status'](_0x546122)['end']();};}function respondWithResult(_0x2e63d0,_0x4fcda0){_0x4fcda0=_0x4fcda0||0xc8;return function(_0xba80a9){if(_0xba80a9){return _0x2e63d0[_0xe483('0x19')](_0x4fcda0)[_0xe483('0x1a')](_0xba80a9);}};}function respondWithFilteredResult(_0x13fa87,_0x3d9e2e){return function(_0x6c0756){if(_0x6c0756){var _0x58051f=typeof _0x3d9e2e[_0xe483('0x1b')]===_0xe483('0x1c')&&typeof _0x3d9e2e[_0xe483('0x1d')]===_0xe483('0x1c');var _0x3b88db=_0x6c0756[_0xe483('0x1e')];var _0x428509=_0x58051f?0x0:_0x3d9e2e[_0xe483('0x1b')];var _0x3da713=_0x58051f?_0x6c0756[_0xe483('0x1e')]:_0x3d9e2e[_0xe483('0x1b')]+_0x3d9e2e[_0xe483('0x1d')];var _0x18bbf8;if(_0x3da713>=_0x3b88db){_0x3da713=_0x3b88db;_0x18bbf8=0xc8;}else{_0x18bbf8=0xce;}_0x13fa87[_0xe483('0x19')](_0x18bbf8);return _0x13fa87[_0xe483('0x1f')]('Content-Range',_0x428509+'-'+_0x3da713+'/'+_0x3b88db)[_0xe483('0x1a')](_0x6c0756);}return null;};}function patchUpdates(_0x35ede6){return function(_0x4195a1){try{jsonpatch[_0xe483('0x20')](_0x4195a1,_0x35ede6,!![]);}catch(_0x4e18a9){return BPromise[_0xe483('0x21')](_0x4e18a9);}return _0x4195a1[_0xe483('0x22')]();};}function saveUpdates(_0x735028,_0x50aad2){return function(_0x335fd4){if(_0x335fd4){return _0x335fd4[_0xe483('0x23')](_0x735028)['then'](function(_0x55bc7f){return _0x55bc7f;});}return null;};}function removeEntity(_0x85c25a,_0x267bb5){return function(_0x487484){if(_0x487484){return _0x487484[_0xe483('0x24')]()['then'](function(){_0x85c25a['status'](0xcc)[_0xe483('0x25')]();});}};}function handleEntityNotFound(_0x3b5bdc,_0x1289c0){return function(_0x18de16){if(!_0x18de16){_0x3b5bdc[_0xe483('0x26')](0x194);}return _0x18de16;};}function handleError(_0x5dd68a,_0x16a45d){_0x16a45d=_0x16a45d||0x1f4;return function(_0x24cd53){logger[_0xe483('0x27')](_0x24cd53[_0xe483('0x28')]);if(_0x24cd53[_0xe483('0x29')]){delete _0x24cd53['name'];}_0x5dd68a[_0xe483('0x19')](_0x16a45d)[_0xe483('0x2a')](_0x24cd53);};}function getMustacheRender(_0x4d9982,_0x256afe){return Mustache[_0xe483('0x2b')](_0x4d9982,_[_0xe483('0x2c')](_0x256afe[_0xe483('0x2d')],{'contact':_0x256afe[_0xe483('0x2e')],'message':_0x256afe[_0xe483('0x2f')],'agent':_0x256afe[_0xe483('0x30')],'interaction':_0x256afe[_0xe483('0x31')],'account':_0x256afe['account']}))||'';}exports[_0xe483('0x32')]=function(_0x2043d3,_0x411370){var _0x4c4782={},_0x553ab7={},_0x144c15={'count':0x0,'rows':[]};var _0x4e2606=_[_0xe483('0x33')](db[_0xe483('0x34')][_0xe483('0x35')],function(_0x5180e9){return{'name':_0x5180e9[_0xe483('0x36')],'type':_0x5180e9[_0xe483('0x37')][_0xe483('0x38')]};});_0x553ab7[_0xe483('0x39')]=_['map'](_0x4e2606,'name');_0x553ab7[_0xe483('0x3a')]=_[_0xe483('0x3b')](_0x2043d3[_0xe483('0x3a')]);_0x553ab7[_0xe483('0x3c')]=_[_0xe483('0x3d')](_0x553ab7[_0xe483('0x39')],_0x553ab7[_0xe483('0x3a')]);_0x4c4782[_0xe483('0x3e')]=_[_0xe483('0x3d')](_0x553ab7['model'],qs[_0xe483('0x3f')](_0x2043d3['query'][_0xe483('0x3f')]));_0x4c4782[_0xe483('0x3e')]=_0x4c4782['attributes'][_0xe483('0x40')]?_0x4c4782[_0xe483('0x3e')]:_0x553ab7[_0xe483('0x39')];if(!_0x2043d3[_0xe483('0x3a')][_0xe483('0x41')]('nolimit')){_0x4c4782['limit']=qs[_0xe483('0x1d')](_0x2043d3[_0xe483('0x3a')][_0xe483('0x1d')]);_0x4c4782[_0xe483('0x1b')]=qs[_0xe483('0x1b')](_0x2043d3[_0xe483('0x3a')][_0xe483('0x1b')]);}_0x4c4782[_0xe483('0x42')]=qs[_0xe483('0x43')](_0x2043d3[_0xe483('0x3a')][_0xe483('0x43')]);_0x4c4782[_0xe483('0x44')]=qs[_0xe483('0x3c')](_[_0xe483('0x45')](_0x2043d3[_0xe483('0x3a')],_0x553ab7[_0xe483('0x3c')]),_0x4e2606);if(_0x2043d3[_0xe483('0x3a')][_0xe483('0x46')]){_0x4c4782[_0xe483('0x44')]=_[_0xe483('0x2c')](_0x4c4782[_0xe483('0x44')],{'$or':_['map'](_0x4e2606,function(_0x1b91a8){if(_0x1b91a8[_0xe483('0x37')]!==_0xe483('0x47')){var _0x532c74={};_0x532c74[_0x1b91a8[_0xe483('0x29')]]={'$like':'%'+_0x2043d3['query'][_0xe483('0x46')]+'%'};return _0x532c74;}})});}_0x4c4782=_[_0xe483('0x2c')]({},_0x4c4782,_0x2043d3['options']);var _0x84dea={'where':_0x4c4782['where']};return db['VoiceCallReport'][_0xe483('0x1e')](_0x84dea)['then'](function(_0x40a545){_0x144c15[_0xe483('0x1e')]=_0x40a545;if(_0x2043d3['query']['includeAll']){_0x4c4782['include']=[{'attributes':['id',_0xe483('0x29'),'fullname','alias'],'model':db[_0xe483('0x48')],'as':_0xe483('0x48')}];}return db[_0xe483('0x34')]['findAll'](_0x4c4782);})[_0xe483('0x49')](function(_0x30e118){_0x144c15['rows']=_0x30e118;return _0x144c15;})['then'](respondWithFilteredResult(_0x411370,_0x4c4782))[_0xe483('0x4a')](handleError(_0x411370,null));};exports[_0xe483('0x4b')]=function(_0x11f693,_0x28a30e){var _0x5d79e9={'raw':!![],'where':{'id':_0x11f693[_0xe483('0x4c')]['id']}},_0x30ff82={};_0x30ff82[_0xe483('0x39')]=_[_0xe483('0x3b')](db['VoiceCallReport'][_0xe483('0x35')]);_0x30ff82[_0xe483('0x3a')]=_[_0xe483('0x3b')](_0x11f693['query']);_0x30ff82['filters']=_[_0xe483('0x3d')](_0x30ff82['model'],_0x30ff82['query']);_0x5d79e9['attributes']=_[_0xe483('0x3d')](_0x30ff82[_0xe483('0x39')],qs[_0xe483('0x3f')](_0x11f693[_0xe483('0x3a')][_0xe483('0x3f')]));_0x5d79e9[_0xe483('0x3e')]=_0x5d79e9['attributes'][_0xe483('0x40')]?_0x5d79e9['attributes']:_0x30ff82['model'];if(_0x11f693[_0xe483('0x3a')][_0xe483('0x4d')]){_0x5d79e9[_0xe483('0x4e')]=[{'all':!![]}];}_0x5d79e9=_[_0xe483('0x2c')]({},_0x5d79e9,_0x11f693[_0xe483('0x4f')]);return db[_0xe483('0x34')][_0xe483('0x50')](_0x5d79e9)[_0xe483('0x49')](handleEntityNotFound(_0x28a30e,null))[_0xe483('0x49')](respondWithResult(_0x28a30e,null))[_0xe483('0x4a')](handleError(_0x28a30e,null));};exports[_0xe483('0x51')]=function(_0x51edf6,_0x4bda09){return db[_0xe483('0x34')][_0xe483('0x51')](_0x51edf6[_0xe483('0x2d')],{})['then'](respondWithResult(_0x4bda09,0xc9))[_0xe483('0x4a')](handleError(_0x4bda09,null));};exports['destroy']=function(_0x39cf1f,_0x350094){return db['VoiceCallReport'][_0xe483('0x50')]({'where':{'id':_0x39cf1f[_0xe483('0x4c')]['id']}})['then'](handleEntityNotFound(_0x350094,null))['then'](removeEntity(_0x350094,null))['catch'](handleError(_0x350094,null));};exports['describe']=function(_0x2008a2,_0x3e2088){return db['VoiceCallReport'][_0xe483('0x52')]()[_0xe483('0x49')](respondWithResult(_0x3e2088,null))[_0xe483('0x4a')](handleError(_0x3e2088,null));};exports[_0xe483('0x23')]=function(_0x3aa4d0,_0x33a267){if(_0x3aa4d0['body']['uniqueid']){delete _0x3aa4d0[_0xe483('0x2d')]['uniqueid'];}return db['VoiceCallReport'][_0xe483('0x50')]({'where':{'uniqueid':_0x3aa4d0[_0xe483('0x4c')]['id'],'UserId':{'$or':[null,_0x3aa4d0[_0xe483('0x53')]['id']]}}})[_0xe483('0x49')](handleEntityNotFound(_0x33a267,null))[_0xe483('0x49')](saveUpdates(_0x3aa4d0[_0xe483('0x2d')],null))[_0xe483('0x49')](respondWithResult(_0x33a267,null))[_0xe483('0x4a')](handleError(_0x33a267,null));}; \ No newline at end of file +var _0xe9b6=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','limit','count','offset','status','set','Content-Range','reject','update','then','sendStatus','error','stack','name','send','render','merge','body','contact','message','index','map','VoiceCallReport','fieldName','type','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','fullname','User','catch','show','params','rawAttributes','filters','includeAll','create','destroy','find','describe','uniqueid','user','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe9b6,0x12c));var _0x6e9b=function(_0x188e64,_0x316e7e){_0x188e64=_0x188e64-0x0;var _0x5d2b36=_0xe9b6[_0x188e64];return _0x5d2b36;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e9b('0x0'));var zipdir=require(_0x6e9b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e9b('0x2'));var moment=require(_0x6e9b('0x3'));var BPromise=require(_0x6e9b('0x4'));var Mustache=require('mustache');var util=require(_0x6e9b('0x5'));var path=require(_0x6e9b('0x6'));var sox=require('sox');var csv=require(_0x6e9b('0x7'));var ejs=require(_0x6e9b('0x8'));var fs=require('fs');var fs_extra=require(_0x6e9b('0x9'));var _=require('lodash');var squel=require(_0x6e9b('0xa'));var crypto=require('crypto');var jsforce=require(_0x6e9b('0xb'));var deskjs=require(_0x6e9b('0xc'));var toCsv=require(_0x6e9b('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6e9b('0xd'));var authService=require(_0x6e9b('0xe'));var qs=require(_0x6e9b('0xf'));var as=require(_0x6e9b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e9b('0x11'))(_0x6e9b('0x12'));var utils=require('../../config/utils');var config=require(_0x6e9b('0x13'));var licenseUtil=require(_0x6e9b('0x14'));var db=require(_0x6e9b('0x15'))['db'];function respondWithStatusCode(_0x35e3f4,_0x17b46c){_0x17b46c=_0x17b46c||0xcc;return function(_0x28bb33){if(_0x28bb33){return _0x35e3f4['sendStatus'](_0x17b46c);}return _0x35e3f4['status'](_0x17b46c)[_0x6e9b('0x16')]();};}function respondWithResult(_0x761465,_0xa84807){_0xa84807=_0xa84807||0xc8;return function(_0x216d16){if(_0x216d16){return _0x761465['status'](_0xa84807)[_0x6e9b('0x17')](_0x216d16);}};}function respondWithFilteredResult(_0x4e1703,_0x30d7fa){return function(_0x104c5b){if(_0x104c5b){var _0x1dbf2f=typeof _0x30d7fa['offset']===_0x6e9b('0x18')&&typeof _0x30d7fa[_0x6e9b('0x19')]===_0x6e9b('0x18');var _0x552214=_0x104c5b[_0x6e9b('0x1a')];var _0x2ee97f=_0x1dbf2f?0x0:_0x30d7fa['offset'];var _0x161a53=_0x1dbf2f?_0x104c5b[_0x6e9b('0x1a')]:_0x30d7fa[_0x6e9b('0x1b')]+_0x30d7fa[_0x6e9b('0x19')];var _0x4f4784;if(_0x161a53>=_0x552214){_0x161a53=_0x552214;_0x4f4784=0xc8;}else{_0x4f4784=0xce;}_0x4e1703[_0x6e9b('0x1c')](_0x4f4784);return _0x4e1703[_0x6e9b('0x1d')](_0x6e9b('0x1e'),_0x2ee97f+'-'+_0x161a53+'/'+_0x552214)['json'](_0x104c5b);}return null;};}function patchUpdates(_0x27184b){return function(_0x320e49){try{jsonpatch['apply'](_0x320e49,_0x27184b,!![]);}catch(_0x377059){return BPromise[_0x6e9b('0x1f')](_0x377059);}return _0x320e49['save']();};}function saveUpdates(_0x53b4fe,_0x5bda18){return function(_0x1c1ddf){if(_0x1c1ddf){return _0x1c1ddf[_0x6e9b('0x20')](_0x53b4fe)[_0x6e9b('0x21')](function(_0x5e448d){return _0x5e448d;});}return null;};}function removeEntity(_0x23b4df,_0x3fd04c){return function(_0x2722f7){if(_0x2722f7){return _0x2722f7['destroy']()[_0x6e9b('0x21')](function(){_0x23b4df[_0x6e9b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44e5f3,_0x92e838){return function(_0x409373){if(!_0x409373){_0x44e5f3[_0x6e9b('0x22')](0x194);}return _0x409373;};}function handleError(_0x3924c0,_0xb882ae){_0xb882ae=_0xb882ae||0x1f4;return function(_0x5bece7){logger[_0x6e9b('0x23')](_0x5bece7[_0x6e9b('0x24')]);if(_0x5bece7['name']){delete _0x5bece7[_0x6e9b('0x25')];}_0x3924c0['status'](_0xb882ae)[_0x6e9b('0x26')](_0x5bece7);};}function getMustacheRender(_0x5ac174,_0x489065){return Mustache[_0x6e9b('0x27')](_0x5ac174,_[_0x6e9b('0x28')](_0x489065[_0x6e9b('0x29')],{'contact':_0x489065[_0x6e9b('0x2a')],'message':_0x489065[_0x6e9b('0x2b')],'agent':_0x489065['agent'],'interaction':_0x489065['interaction'],'account':_0x489065['account']}))||'';}exports[_0x6e9b('0x2c')]=function(_0x6b1df,_0x1dd732){var _0x4830a2={},_0x264ba2={},_0x5c07e8={'count':0x0,'rows':[]};var _0x3fc16d=_[_0x6e9b('0x2d')](db[_0x6e9b('0x2e')]['rawAttributes'],function(_0x414c49){return{'name':_0x414c49[_0x6e9b('0x2f')],'type':_0x414c49[_0x6e9b('0x30')]['key']};});_0x264ba2['model']=_['map'](_0x3fc16d,_0x6e9b('0x25'));_0x264ba2[_0x6e9b('0x31')]=_[_0x6e9b('0x32')](_0x6b1df[_0x6e9b('0x31')]);_0x264ba2['filters']=_[_0x6e9b('0x33')](_0x264ba2[_0x6e9b('0x34')],_0x264ba2[_0x6e9b('0x31')]);_0x4830a2[_0x6e9b('0x35')]=_[_0x6e9b('0x33')](_0x264ba2[_0x6e9b('0x34')],qs[_0x6e9b('0x36')](_0x6b1df['query'][_0x6e9b('0x36')]));_0x4830a2[_0x6e9b('0x35')]=_0x4830a2['attributes'][_0x6e9b('0x37')]?_0x4830a2[_0x6e9b('0x35')]:_0x264ba2[_0x6e9b('0x34')];if(!_0x6b1df[_0x6e9b('0x31')]['hasOwnProperty'](_0x6e9b('0x38'))){_0x4830a2['limit']=qs[_0x6e9b('0x19')](_0x6b1df[_0x6e9b('0x31')]['limit']);_0x4830a2[_0x6e9b('0x1b')]=qs[_0x6e9b('0x1b')](_0x6b1df[_0x6e9b('0x31')][_0x6e9b('0x1b')]);}_0x4830a2[_0x6e9b('0x39')]=qs[_0x6e9b('0x3a')](_0x6b1df['query']['sort']);_0x4830a2[_0x6e9b('0x3b')]=qs['filters'](_[_0x6e9b('0x3c')](_0x6b1df[_0x6e9b('0x31')],_0x264ba2['filters']),_0x3fc16d);if(_0x6b1df[_0x6e9b('0x31')][_0x6e9b('0x3d')]){_0x4830a2['where']=_[_0x6e9b('0x28')](_0x4830a2[_0x6e9b('0x3b')],{'$or':_[_0x6e9b('0x2d')](_0x3fc16d,function(_0x116dd1){if(_0x116dd1[_0x6e9b('0x30')]!==_0x6e9b('0x3e')){var _0x230da0={};_0x230da0[_0x116dd1[_0x6e9b('0x25')]]={'$like':'%'+_0x6b1df[_0x6e9b('0x31')][_0x6e9b('0x3d')]+'%'};return _0x230da0;}})});}_0x4830a2=_[_0x6e9b('0x28')]({},_0x4830a2,_0x6b1df[_0x6e9b('0x3f')]);var _0x1724d5={'where':_0x4830a2['where']};return db[_0x6e9b('0x2e')][_0x6e9b('0x1a')](_0x1724d5)[_0x6e9b('0x21')](function(_0x54ddf5){_0x5c07e8['count']=_0x54ddf5;if(_0x6b1df[_0x6e9b('0x31')]['includeAll']){_0x4830a2[_0x6e9b('0x40')]=[{'attributes':['id',_0x6e9b('0x25'),_0x6e9b('0x41'),'alias'],'model':db[_0x6e9b('0x42')],'as':_0x6e9b('0x42')}];}return db[_0x6e9b('0x2e')]['findAll'](_0x4830a2);})[_0x6e9b('0x21')](function(_0x2ab96e){_0x5c07e8['rows']=_0x2ab96e;return _0x5c07e8;})[_0x6e9b('0x21')](respondWithFilteredResult(_0x1dd732,_0x4830a2))[_0x6e9b('0x43')](handleError(_0x1dd732,null));};exports[_0x6e9b('0x44')]=function(_0x570c45,_0x15b3ce){var _0x3a596f={'raw':!![],'where':{'id':_0x570c45[_0x6e9b('0x45')]['id']}},_0x4f4804={};_0x4f4804['model']=_[_0x6e9b('0x32')](db[_0x6e9b('0x2e')][_0x6e9b('0x46')]);_0x4f4804[_0x6e9b('0x31')]=_[_0x6e9b('0x32')](_0x570c45['query']);_0x4f4804[_0x6e9b('0x47')]=_[_0x6e9b('0x33')](_0x4f4804[_0x6e9b('0x34')],_0x4f4804[_0x6e9b('0x31')]);_0x3a596f['attributes']=_['intersection'](_0x4f4804[_0x6e9b('0x34')],qs[_0x6e9b('0x36')](_0x570c45['query']['fields']));_0x3a596f['attributes']=_0x3a596f[_0x6e9b('0x35')][_0x6e9b('0x37')]?_0x3a596f['attributes']:_0x4f4804['model'];if(_0x570c45[_0x6e9b('0x31')][_0x6e9b('0x48')]){_0x3a596f[_0x6e9b('0x40')]=[{'all':!![]}];}_0x3a596f=_[_0x6e9b('0x28')]({},_0x3a596f,_0x570c45[_0x6e9b('0x3f')]);return db[_0x6e9b('0x2e')]['find'](_0x3a596f)[_0x6e9b('0x21')](handleEntityNotFound(_0x15b3ce,null))[_0x6e9b('0x21')](respondWithResult(_0x15b3ce,null))[_0x6e9b('0x43')](handleError(_0x15b3ce,null));};exports['create']=function(_0x45d955,_0x3d93fe){return db[_0x6e9b('0x2e')][_0x6e9b('0x49')](_0x45d955[_0x6e9b('0x29')],{})['then'](respondWithResult(_0x3d93fe,0xc9))[_0x6e9b('0x43')](handleError(_0x3d93fe,null));};exports[_0x6e9b('0x4a')]=function(_0x22f920,_0x3723cc){return db[_0x6e9b('0x2e')][_0x6e9b('0x4b')]({'where':{'id':_0x22f920[_0x6e9b('0x45')]['id']}})[_0x6e9b('0x21')](handleEntityNotFound(_0x3723cc,null))[_0x6e9b('0x21')](removeEntity(_0x3723cc,null))['catch'](handleError(_0x3723cc,null));};exports[_0x6e9b('0x4c')]=function(_0x510ca4,_0x573d1d){return db[_0x6e9b('0x2e')][_0x6e9b('0x4c')]()['then'](respondWithResult(_0x573d1d,null))[_0x6e9b('0x43')](handleError(_0x573d1d,null));};exports[_0x6e9b('0x20')]=function(_0x4499da,_0x562a02){if(_0x4499da[_0x6e9b('0x29')]['uniqueid']){delete _0x4499da[_0x6e9b('0x29')][_0x6e9b('0x4d')];}return db[_0x6e9b('0x2e')][_0x6e9b('0x4b')]({'where':{'uniqueid':_0x4499da['params']['id'],'UserId':{'$or':[null,_0x4499da[_0x6e9b('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x562a02,null))[_0x6e9b('0x21')](saveUpdates(_0x4499da[_0x6e9b('0x29')],null))['then'](respondWithResult(_0x562a02,null))[_0x6e9b('0x43')](handleError(_0x562a02,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 1a7f39b..b7e619c 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 _0x13a7=['moment','bluebird','path','rimraf','exports','uniqueid','lodash','util','../../config/logger','api'];(function(_0x3ad5fe,_0x4b57bc){var _0x186865=function(_0x1faddc){while(--_0x1faddc){_0x3ad5fe['push'](_0x3ad5fe['shift']());}};_0x186865(++_0x4b57bc);}(_0x13a7,0x1be));var _0x713a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x13a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x713a('0x0'));var util=require(_0x713a('0x1'));var logger=require(_0x713a('0x2'))(_0x713a('0x3'));var moment=require(_0x713a('0x4'));var BPromise=require(_0x713a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x713a('0x6'));var rimraf=require(_0x713a('0x7'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x713a('0x8')]=function(_0x17f4ff,_0x18eb1c){return _0x17f4ff['define']('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x713a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c09=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceCallReport','util'];(function(_0x404e21,_0x2c3195){var _0x3ccd0c=function(_0x1f634e){while(--_0x1f634e){_0x404e21['push'](_0x404e21['shift']());}};_0x3ccd0c(++_0x2c3195);}(_0x8c09,0x10d));var _0x98c0=function(_0x4be2ad,_0x2134b){_0x4be2ad=_0x4be2ad-0x0;var _0x1904b5=_0x8c09[_0x4be2ad];return _0x1904b5;};'use strict';var _=require('lodash');var util=require(_0x98c0('0x0'));var logger=require('../../config/logger')(_0x98c0('0x1'));var moment=require('moment');var BPromise=require(_0x98c0('0x2'));var rp=require(_0x98c0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x98c0('0x4'));var config=require(_0x98c0('0x5'));var attributes=require('./voiceCallReport.attributes');module[_0x98c0('0x6')]=function(_0x53aaf8,_0x589a49){return _0x53aaf8[_0x98c0('0x7')](_0x98c0('0x8'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 3e31247..649c2f4 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 _0xd7ba=['info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','attributes','include','map','model','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','where','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then'];(function(_0x46d934,_0x9dc43c){var _0x6a86b5=function(_0x520f4d){while(--_0x520f4d){_0x46d934['push'](_0x46d934['shift']());}};_0x6a86b5(++_0x9dc43c);}(_0xd7ba,0x8d));var _0xad7b=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd7ba[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xad7b('0x0'));var util=require('util');var moment=require(_0xad7b('0x1'));var BPromise=require(_0xad7b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad7b('0x3'));var db=require(_0xad7b('0x4'))['db'];var utils=require(_0xad7b('0x5'));var logger=require(_0xad7b('0x6'))(_0xad7b('0x7'));var config=require(_0xad7b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xad7b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44a655,_0x2aacb3,_0x3416a2){return new BPromise(function(_0x7afd46,_0x8dd53e){return client['request'](_0x44a655,_0x3416a2)[_0xad7b('0xa')](function(_0x409b88){logger[_0xad7b('0xb')](_0xad7b('0xc'),_0x2aacb3,_0xad7b('0xd'));logger[_0xad7b('0xe')](_0xad7b('0xf'),_0x2aacb3,_0xad7b('0xd'),JSON[_0xad7b('0x10')](_0x409b88));if(_0x409b88['error']){if(_0x409b88[_0xad7b('0x11')][_0xad7b('0x12')]===0x1f4){logger['error'](_0xad7b('0xc'),_0x2aacb3,_0x409b88[_0xad7b('0x11')][_0xad7b('0x13')]);return _0x8dd53e(_0x409b88[_0xad7b('0x11')][_0xad7b('0x13')]);}logger[_0xad7b('0x11')](_0xad7b('0xc'),_0x2aacb3,_0x409b88[_0xad7b('0x11')][_0xad7b('0x13')]);return _0x7afd46(_0x409b88[_0xad7b('0x11')]['message']);}else{logger[_0xad7b('0xb')](_0xad7b('0xc'),_0x2aacb3,_0xad7b('0xd'));_0x7afd46(_0x409b88[_0xad7b('0x14')]['message']);}})[_0xad7b('0x15')](function(_0x2970a8){logger[_0xad7b('0x11')](_0xad7b('0xc'),_0x2aacb3,_0x2970a8);_0x8dd53e(_0x2970a8);});});}exports[_0xad7b('0x16')]=function(_0x57f082){var _0x3c0225=this;return new Promise(function(_0x3c9e57,_0x171838){return db[_0xad7b('0x17')][_0xad7b('0x18')]({'raw':_0x57f082[_0xad7b('0x19')]?_0x57f082[_0xad7b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x57f082[_0xad7b('0x19')]?_0x57f082[_0xad7b('0x19')]['where']||null:null,'attributes':_0x57f082[_0xad7b('0x19')]?_0x57f082[_0xad7b('0x19')][_0xad7b('0x1a')]||null:null,'limit':_0x57f082[_0xad7b('0x19')]?_0x57f082[_0xad7b('0x19')]['limit']||null:null,'include':_0x57f082[_0xad7b('0x19')]?_0x57f082[_0xad7b('0x19')][_0xad7b('0x1b')]?_[_0xad7b('0x1c')](_0x57f082[_0xad7b('0x19')][_0xad7b('0x1b')],function(_0x1e88b1){return{'model':db[_0x1e88b1['model']],'as':_0x1e88b1['as'],'attributes':_0x1e88b1['attributes'],'include':_0x1e88b1['include']?_[_0xad7b('0x1c')](_0x1e88b1[_0xad7b('0x1b')],function(_0x1901ab){return{'model':db[_0x1901ab[_0xad7b('0x1d')]],'as':_0x1901ab['as'],'attributes':_0x1901ab[_0xad7b('0x1a')],'include':_0x1901ab[_0xad7b('0x1b')]?_[_0xad7b('0x1c')](_0x1901ab['include'],function(_0x42a761){return{'model':db[_0x42a761['model']],'as':_0x42a761['as'],'attributes':_0x42a761[_0xad7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xad7b('0xa')](function(_0x5464cc){logger[_0xad7b('0xb')](_0xad7b('0x16'),_0x57f082);logger[_0xad7b('0xe')]('GetVoiceCallReport',_0x57f082,JSON['stringify'](_0x5464cc));_0x3c9e57(_0x5464cc);})[_0xad7b('0x15')](function(_0x51b8cb){logger[_0xad7b('0x11')](_0xad7b('0x16'),_0x51b8cb[_0xad7b('0x13')],_0x57f082);_0x171838(_0x3c0225[_0xad7b('0x11')](0x1f4,_0x51b8cb['message']));});});};exports[_0xad7b('0x1e')]=function(_0x30e1a4){var _0x40b413=this;return new Promise(function(_0x355635,_0x3db212){return db[_0xad7b('0x17')][_0xad7b('0x1f')](_0x30e1a4[_0xad7b('0x20')],{'raw':_0x30e1a4[_0xad7b('0x19')]?_0x30e1a4[_0xad7b('0x19')][_0xad7b('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x4274d8){logger['info']('CreateVoiceCallReport',_0x30e1a4);logger[_0xad7b('0xe')](_0xad7b('0x1e'),_0x30e1a4,JSON[_0xad7b('0x10')](_0x4274d8));_0x355635(_0x4274d8);})[_0xad7b('0x15')](function(_0x1be2a8){logger[_0xad7b('0x11')](_0xad7b('0x1e'),_0x1be2a8[_0xad7b('0x13')],_0x30e1a4);_0x3db212(_0x40b413[_0xad7b('0x11')](0x1f4,_0x1be2a8[_0xad7b('0x13')]));});});};exports[_0xad7b('0x22')]=function(_0x447eb3){var _0xa517a2=this;return new Promise(function(_0x367044,_0x3de055){return db[_0xad7b('0x17')][_0xad7b('0x23')](_0x447eb3[_0xad7b('0x20')],{'raw':_0x447eb3[_0xad7b('0x19')]?_0x447eb3[_0xad7b('0x19')][_0xad7b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x447eb3[_0xad7b('0x19')]?_0x447eb3[_0xad7b('0x19')][_0xad7b('0x24')]||null:null,'attributes':_0x447eb3['options']?_0x447eb3[_0xad7b('0x19')]['attributes']||null:null,'limit':_0x447eb3['options']?_0x447eb3[_0xad7b('0x19')][_0xad7b('0x25')]||null:null})[_0xad7b('0xa')](function(_0x3a5760){logger[_0xad7b('0xb')](_0xad7b('0x22'),_0x447eb3);logger[_0xad7b('0xe')](_0xad7b('0x22'),_0x447eb3,JSON[_0xad7b('0x10')](_0x3a5760));_0x367044(_0x3a5760);})[_0xad7b('0x15')](function(_0x453134){logger['error'](_0xad7b('0x22'),_0x453134[_0xad7b('0x13')],_0x447eb3);_0x3de055(_0xa517a2[_0xad7b('0x11')](0x1f4,_0x453134['message']));});});}; \ No newline at end of file +var _0x6474=['jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x566168,_0x4c39af){var _0x4e1f7a=function(_0x5ec3ee){while(--_0x5ec3ee){_0x566168['push'](_0x566168['shift']());}};_0x4e1f7a(++_0x4c39af);}(_0x6474,0x1e7));var _0x4647=function(_0x3ea60e,_0x5140ed){_0x3ea60e=_0x3ea60e-0x0;var _0x1962b9=_0x6474[_0x3ea60e];return _0x1962b9;};'use strict';var _=require(_0x4647('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4647('0x1'));var db=require(_0x4647('0x2'))['db'];var utils=require(_0x4647('0x3'));var logger=require(_0x4647('0x4'))(_0x4647('0x5'));var config=require(_0x4647('0x6'));var jayson=require(_0x4647('0x7'));var client=jayson[_0x4647('0x8')][_0x4647('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xafa0e8,_0x5811c4,_0x5b95e7){return new BPromise(function(_0x2667ea,_0x270d8b){return client[_0x4647('0xa')](_0xafa0e8,_0x5b95e7)[_0x4647('0xb')](function(_0x2b051c){logger[_0x4647('0xc')](_0x4647('0xd'),_0x5811c4,_0x4647('0xe'));logger[_0x4647('0xf')](_0x4647('0x10'),_0x5811c4,_0x4647('0xe'),JSON[_0x4647('0x11')](_0x2b051c));if(_0x2b051c['error']){if(_0x2b051c[_0x4647('0x12')][_0x4647('0x13')]===0x1f4){logger[_0x4647('0x12')](_0x4647('0xd'),_0x5811c4,_0x2b051c[_0x4647('0x12')]['message']);return _0x270d8b(_0x2b051c['error']['message']);}logger[_0x4647('0x12')](_0x4647('0xd'),_0x5811c4,_0x2b051c[_0x4647('0x12')][_0x4647('0x14')]);return _0x2667ea(_0x2b051c[_0x4647('0x12')][_0x4647('0x14')]);}else{logger[_0x4647('0xc')](_0x4647('0xd'),_0x5811c4,_0x4647('0xe'));_0x2667ea(_0x2b051c['result'][_0x4647('0x14')]);}})[_0x4647('0x15')](function(_0x15d9bb){logger['error'](_0x4647('0xd'),_0x5811c4,_0x15d9bb);_0x270d8b(_0x15d9bb);});});}exports[_0x4647('0x16')]=function(_0x4b1d6a){var _0x1f8cc1=this;return new Promise(function(_0x278a61,_0x14ed1b){return db[_0x4647('0x17')][_0x4647('0x18')]({'raw':_0x4b1d6a[_0x4647('0x19')]?_0x4b1d6a[_0x4647('0x19')][_0x4647('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b1d6a['options']?_0x4b1d6a[_0x4647('0x19')][_0x4647('0x1b')]||null:null,'attributes':_0x4b1d6a[_0x4647('0x19')]?_0x4b1d6a['options'][_0x4647('0x1c')]||null:null,'limit':_0x4b1d6a[_0x4647('0x19')]?_0x4b1d6a[_0x4647('0x19')][_0x4647('0x1d')]||null:null,'include':_0x4b1d6a[_0x4647('0x19')]?_0x4b1d6a[_0x4647('0x19')][_0x4647('0x1e')]?_[_0x4647('0x1f')](_0x4b1d6a[_0x4647('0x19')][_0x4647('0x1e')],function(_0x4794f0){return{'model':db[_0x4794f0[_0x4647('0x20')]],'as':_0x4794f0['as'],'attributes':_0x4794f0['attributes'],'include':_0x4794f0[_0x4647('0x1e')]?_[_0x4647('0x1f')](_0x4794f0[_0x4647('0x1e')],function(_0x22c2e0){return{'model':db[_0x22c2e0[_0x4647('0x20')]],'as':_0x22c2e0['as'],'attributes':_0x22c2e0[_0x4647('0x1c')],'include':_0x22c2e0[_0x4647('0x1e')]?_[_0x4647('0x1f')](_0x22c2e0['include'],function(_0x431e0f){return{'model':db[_0x431e0f[_0x4647('0x20')]],'as':_0x431e0f['as'],'attributes':_0x431e0f['attributes']};}):[]};}):[]};}):[]:[]})[_0x4647('0xb')](function(_0xd37879){logger[_0x4647('0xc')](_0x4647('0x16'),_0x4b1d6a);logger['debug'](_0x4647('0x16'),_0x4b1d6a,JSON[_0x4647('0x11')](_0xd37879));_0x278a61(_0xd37879);})[_0x4647('0x15')](function(_0x47077d){logger['error'](_0x4647('0x16'),_0x47077d['message'],_0x4b1d6a);_0x14ed1b(_0x1f8cc1[_0x4647('0x12')](0x1f4,_0x47077d['message']));});});};exports[_0x4647('0x21')]=function(_0x33d422){var _0x129a82=this;return new Promise(function(_0x5296e7,_0x20cb6f){return db[_0x4647('0x17')][_0x4647('0x22')](_0x33d422[_0x4647('0x23')],{'raw':_0x33d422[_0x4647('0x19')]?_0x33d422[_0x4647('0x19')][_0x4647('0x1a')]===undefined?!![]:![]:!![]})[_0x4647('0xb')](function(_0x52d2b1){logger[_0x4647('0xc')]('CreateVoiceCallReport',_0x33d422);logger[_0x4647('0xf')](_0x4647('0x21'),_0x33d422,JSON['stringify'](_0x52d2b1));_0x5296e7(_0x52d2b1);})[_0x4647('0x15')](function(_0x5989e8){logger['error']('CreateVoiceCallReport',_0x5989e8[_0x4647('0x14')],_0x33d422);_0x20cb6f(_0x129a82[_0x4647('0x12')](0x1f4,_0x5989e8['message']));});});};exports[_0x4647('0x24')]=function(_0x101854){var _0xd73aa=this;return new Promise(function(_0x51a065,_0xd733f0){return db['VoiceCallReport'][_0x4647('0x25')](_0x101854[_0x4647('0x23')],{'raw':_0x101854[_0x4647('0x19')]?_0x101854['options'][_0x4647('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x101854[_0x4647('0x19')]?_0x101854[_0x4647('0x19')][_0x4647('0x1b')]||null:null,'attributes':_0x101854[_0x4647('0x19')]?_0x101854[_0x4647('0x19')][_0x4647('0x1c')]||null:null,'limit':_0x101854[_0x4647('0x19')]?_0x101854[_0x4647('0x19')][_0x4647('0x1d')]||null:null})[_0x4647('0xb')](function(_0x46309a){logger[_0x4647('0xc')](_0x4647('0x24'),_0x101854);logger[_0x4647('0xf')](_0x4647('0x24'),_0x101854,JSON[_0x4647('0x11')](_0x46309a));_0x51a065(_0x46309a);})[_0x4647('0x15')](function(_0x5de8e3){logger[_0x4647('0x12')](_0x4647('0x24'),_0x5de8e3['message'],_0x101854);_0xd733f0(_0xd73aa[_0x4647('0x12')](0x1f4,_0x5de8e3[_0x4647('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 07c852a..c5b4007 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 _0xbd15=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xbd15,0x102));var _0x5bd1=function(_0x35f901,_0x4dd58a){_0x35f901=_0x35f901-0x0;var _0x497a0a=_0xbd15[_0x35f901];return _0x497a0a;};'use strict';var multer=require(_0x5bd1('0x0'));var util=require(_0x5bd1('0x1'));var path=require(_0x5bd1('0x2'));var timeout=require(_0x5bd1('0x3'));var express=require(_0x5bd1('0x4'));var router=express[_0x5bd1('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5bd1('0x6'));var config=require(_0x5bd1('0x7'));var controller=require(_0x5bd1('0x8'));router[_0x5bd1('0x9')]('/',auth[_0x5bd1('0xa')](),controller[_0x5bd1('0xb')]);router[_0x5bd1('0x9')](_0x5bd1('0xc'),auth[_0x5bd1('0xa')](),controller[_0x5bd1('0xd')]);router[_0x5bd1('0xe')]('/',auth[_0x5bd1('0xa')](),controller[_0x5bd1('0xf')]);router[_0x5bd1('0x10')](_0x5bd1('0xc'),auth['isAuthenticated'](),controller[_0x5bd1('0x11')]);router[_0x5bd1('0x12')](_0x5bd1('0xc'),auth[_0x5bd1('0xa')](),controller[_0x5bd1('0x13')]);module[_0x5bd1('0x14')]=router; \ No newline at end of file +var _0x091f=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x1dca9b,_0x3ceaba){var _0x1e8e0a=function(_0x5b8bfc){while(--_0x5b8bfc){_0x1dca9b['push'](_0x1dca9b['shift']());}};_0x1e8e0a(++_0x3ceaba);}(_0x091f,0x72));var _0xf091=function(_0x5b6fd3,_0x4af8d4){_0x5b6fd3=_0x5b6fd3-0x0;var _0x75ef1e=_0x091f[_0x5b6fd3];return _0x75ef1e;};'use strict';var multer=require(_0xf091('0x0'));var util=require(_0xf091('0x1'));var path=require(_0xf091('0x2'));var timeout=require(_0xf091('0x3'));var express=require('express');var router=express[_0xf091('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf091('0x5'));var interaction=require(_0xf091('0x6'));var config=require(_0xf091('0x7'));var controller=require('./voiceChanSpy.controller');router[_0xf091('0x8')]('/',auth[_0xf091('0x9')](),controller[_0xf091('0xa')]);router[_0xf091('0x8')](_0xf091('0xb'),auth[_0xf091('0x9')](),controller[_0xf091('0xc')]);router[_0xf091('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf091('0xe')](_0xf091('0xb'),auth[_0xf091('0x9')](),controller[_0xf091('0xf')]);router[_0xf091('0x10')]('/:id',auth[_0xf091('0x9')](),controller[_0xf091('0x11')]);module[_0xf091('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 9735fe8..e406a35 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 _0x0d3e=['name','setDataValue','join','options','getDataValue','split','BOOLEAN','STRING'];(function(_0x5955e3,_0x14797c){var _0x2f89d0=function(_0x1ff31a){while(--_0x1ff31a){_0x5955e3['push'](_0x5955e3['shift']());}};_0x2f89d0(++_0x14797c);}(_0x0d3e,0x77));var _0xe0d3=function(_0x273517,_0x50b234){_0x273517=_0x273517-0x0;var _0x2c6334=_0x0d3e[_0x273517];return _0x2c6334;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe0d3('0x0')]},'prefix':{'type':Sequelize[_0xe0d3('0x0')],'unique':_0xe0d3('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0xe0d3('0x0')],'set':function(_0x4d5e48){this[_0xe0d3('0x2')]('options',_0x4d5e48?_0x4d5e48[_0xe0d3('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0xe0d3('0x4'))?this[_0xe0d3('0x5')](_0xe0d3('0x4'))[_0xe0d3('0x6')](''):[];}},'auth':{'type':Sequelize[_0xe0d3('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe0d3('0x0')]}}; \ No newline at end of file +var _0xf5d5=['sequelize','STRING','options','getDataValue','split'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xf5d5,0x186));var _0x5f5d=function(_0x190945,_0x8f08e5){_0x190945=_0x190945-0x0;var _0x110f8d=_0xf5d5[_0x190945];return _0x110f8d;};'use strict';var Sequelize=require(_0x5f5d('0x0'));module['exports']={'name':{'type':Sequelize[_0x5f5d('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x1b9d2c){this['setDataValue'](_0x5f5d('0x2'),_0x1b9d2c?_0x1b9d2c['join'](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0x5f5d('0x3')]('options')[_0x5f5d('0x4')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x5f5d('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x5f5d('0x1')]},'description':{'type':Sequelize[_0x5f5d('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index bd7891b..d484b94 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 _0xbc55=['end','error','stack','name','render','merge','contact','message','agent','interaction','account','index','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','where','filter','map','VIRTUAL','VoiceChanSpy','include','findAll','catch','params','intersection','includeAll','options','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','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','reject','update','then','get','ChanSpies','UserProfileResource','destroy'];(function(_0x4c70c4,_0x963969){var _0x437865=function(_0x54e323){while(--_0x54e323){_0x4c70c4['push'](_0x4c70c4['shift']());}};_0x437865(++_0x963969);}(_0xbc55,0x89));var _0x5bc5=function(_0x114fcb,_0x28b9e6){_0x114fcb=_0x114fcb-0x0;var _0x5962d5=_0xbc55[_0x114fcb];return _0x5962d5;};'use strict';var emlformat=require(_0x5bc5('0x0'));var rimraf=require(_0x5bc5('0x1'));var zipdir=require(_0x5bc5('0x2'));var jsonpatch=require(_0x5bc5('0x3'));var rp=require(_0x5bc5('0x4'));var moment=require(_0x5bc5('0x5'));var BPromise=require(_0x5bc5('0x6'));var Mustache=require(_0x5bc5('0x7'));var util=require('util');var path=require(_0x5bc5('0x8'));var sox=require(_0x5bc5('0x9'));var csv=require('to-csv');var ejs=require(_0x5bc5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5bc5('0xb'));var squel=require(_0x5bc5('0xc'));var crypto=require(_0x5bc5('0xd'));var jsforce=require(_0x5bc5('0xe'));var deskjs=require(_0x5bc5('0xf'));var toCsv=require(_0x5bc5('0x10'));var querystring=require(_0x5bc5('0x11'));var Papa=require(_0x5bc5('0x12'));var Redis=require('ioredis');var authService=require(_0x5bc5('0x13'));var qs=require(_0x5bc5('0x14'));var as=require(_0x5bc5('0x15'));var hardwareService=require(_0x5bc5('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x5bc5('0x17'));var config=require(_0x5bc5('0x18'));var licenseUtil=require(_0x5bc5('0x19'));var db=require(_0x5bc5('0x1a'))['db'];function respondWithStatusCode(_0x1a5377,_0x6e3680){_0x6e3680=_0x6e3680||0xcc;return function(_0x15e4ee){if(_0x15e4ee){return _0x1a5377[_0x5bc5('0x1b')](_0x6e3680);}return _0x1a5377['status'](_0x6e3680)['end']();};}function respondWithResult(_0x8adb80,_0x230b56){_0x230b56=_0x230b56||0xc8;return function(_0x270693){if(_0x270693){return _0x8adb80[_0x5bc5('0x1c')](_0x230b56)[_0x5bc5('0x1d')](_0x270693);}};}function respondWithFilteredResult(_0x179b1d,_0x52860f){return function(_0x13a18a){if(_0x13a18a){var _0x255be8=typeof _0x52860f['offset']===_0x5bc5('0x1e')&&typeof _0x52860f['limit']===_0x5bc5('0x1e');var _0x292d9a=_0x13a18a['count'];var _0x133e47=_0x255be8?0x0:_0x52860f[_0x5bc5('0x1f')];var _0x1aeda0=_0x255be8?_0x13a18a[_0x5bc5('0x20')]:_0x52860f[_0x5bc5('0x1f')]+_0x52860f[_0x5bc5('0x21')];var _0x329c55;if(_0x1aeda0>=_0x292d9a){_0x1aeda0=_0x292d9a;_0x329c55=0xc8;}else{_0x329c55=0xce;}_0x179b1d[_0x5bc5('0x1c')](_0x329c55);return _0x179b1d[_0x5bc5('0x22')](_0x5bc5('0x23'),_0x133e47+'-'+_0x1aeda0+'/'+_0x292d9a)['json'](_0x13a18a);}return null;};}function patchUpdates(_0x161078){return function(_0x32a9f2){try{jsonpatch['apply'](_0x32a9f2,_0x161078,!![]);}catch(_0x520d97){return BPromise[_0x5bc5('0x24')](_0x520d97);}return _0x32a9f2['save']();};}function saveUpdates(_0x39a78b,_0x5b4094){return function(_0x2f599e){if(_0x2f599e){return _0x2f599e[_0x5bc5('0x25')](_0x39a78b)[_0x5bc5('0x26')](function(_0x1a3507){return _0x1a3507;});}return null;};}function removeEntity(_0x3baa15,_0x4da99b){return function(_0x46f2f1){if(_0x46f2f1){return _0x46f2f1['destroy']()['then'](function(){var _0x415973=_0x46f2f1[_0x5bc5('0x27')]({'plain':!![]});var _0x43c1c5=_0x5bc5('0x28');return db[_0x5bc5('0x29')][_0x5bc5('0x2a')]({'where':{'type':_0x43c1c5,'resourceId':_0x415973['id']}})[_0x5bc5('0x26')](function(){return _0x46f2f1;});})[_0x5bc5('0x26')](function(){_0x3baa15[_0x5bc5('0x1c')](0xcc)[_0x5bc5('0x2b')]();});}};}function handleEntityNotFound(_0x2e0c77,_0x428436){return function(_0x27e11c){if(!_0x27e11c){_0x2e0c77[_0x5bc5('0x1b')](0x194);}return _0x27e11c;};}function handleError(_0x465ff5,_0x5018ae){_0x5018ae=_0x5018ae||0x1f4;return function(_0x317b64){logger[_0x5bc5('0x2c')](_0x317b64[_0x5bc5('0x2d')]);if(_0x317b64[_0x5bc5('0x2e')]){delete _0x317b64['name'];}_0x465ff5[_0x5bc5('0x1c')](_0x5018ae)['send'](_0x317b64);};}function getMustacheRender(_0x12688f,_0x21c154){return Mustache[_0x5bc5('0x2f')](_0x12688f,_[_0x5bc5('0x30')](_0x21c154['body'],{'contact':_0x21c154[_0x5bc5('0x31')],'message':_0x21c154[_0x5bc5('0x32')],'agent':_0x21c154[_0x5bc5('0x33')],'interaction':_0x21c154[_0x5bc5('0x34')],'account':_0x21c154[_0x5bc5('0x35')]}))||'';}exports[_0x5bc5('0x36')]=function(_0x4c54a3,_0x4dd49e){var _0x2c8a0b={},_0x489c0e={},_0x36572e={'count':0x0,'rows':[]};var _0x4c771c=_['map'](db['VoiceChanSpy'][_0x5bc5('0x37')],function(_0x390aaf){return{'name':_0x390aaf[_0x5bc5('0x38')],'type':_0x390aaf[_0x5bc5('0x39')][_0x5bc5('0x3a')]};});_0x489c0e[_0x5bc5('0x3b')]=_['map'](_0x4c771c,_0x5bc5('0x2e'));_0x489c0e[_0x5bc5('0x3c')]=_[_0x5bc5('0x3d')](_0x4c54a3[_0x5bc5('0x3c')]);_0x489c0e[_0x5bc5('0x3e')]=_['intersection'](_0x489c0e[_0x5bc5('0x3b')],_0x489c0e[_0x5bc5('0x3c')]);_0x2c8a0b['attributes']=_['intersection'](_0x489c0e[_0x5bc5('0x3b')],qs[_0x5bc5('0x3f')](_0x4c54a3[_0x5bc5('0x3c')][_0x5bc5('0x3f')]));_0x2c8a0b[_0x5bc5('0x40')]=_0x2c8a0b[_0x5bc5('0x40')][_0x5bc5('0x41')]?_0x2c8a0b[_0x5bc5('0x40')]:_0x489c0e[_0x5bc5('0x3b')];if(!_0x4c54a3[_0x5bc5('0x3c')][_0x5bc5('0x42')](_0x5bc5('0x43'))){_0x2c8a0b['limit']=qs[_0x5bc5('0x21')](_0x4c54a3[_0x5bc5('0x3c')][_0x5bc5('0x21')]);_0x2c8a0b['offset']=qs[_0x5bc5('0x1f')](_0x4c54a3[_0x5bc5('0x3c')]['offset']);}_0x2c8a0b['order']=qs['sort'](_0x4c54a3[_0x5bc5('0x3c')]['sort']);_0x2c8a0b[_0x5bc5('0x44')]=qs[_0x5bc5('0x3e')](_['pick'](_0x4c54a3[_0x5bc5('0x3c')],_0x489c0e[_0x5bc5('0x3e')]),_0x4c771c);if(_0x4c54a3[_0x5bc5('0x3c')][_0x5bc5('0x45')]){_0x2c8a0b['where']=_[_0x5bc5('0x30')](_0x2c8a0b[_0x5bc5('0x44')],{'$or':_[_0x5bc5('0x46')](_0x4c771c,function(_0x1065b2){if(_0x1065b2[_0x5bc5('0x39')]!==_0x5bc5('0x47')){var _0x29d13f={};_0x29d13f[_0x1065b2[_0x5bc5('0x2e')]]={'$like':'%'+_0x4c54a3[_0x5bc5('0x3c')]['filter']+'%'};return _0x29d13f;}})});}_0x2c8a0b=_['merge']({},_0x2c8a0b,_0x4c54a3['options']);var _0x4bcd1d={'where':_0x2c8a0b[_0x5bc5('0x44')]};return db[_0x5bc5('0x48')][_0x5bc5('0x20')](_0x4bcd1d)[_0x5bc5('0x26')](function(_0x410adf){_0x36572e[_0x5bc5('0x20')]=_0x410adf;if(_0x4c54a3[_0x5bc5('0x3c')]['includeAll']){_0x2c8a0b[_0x5bc5('0x49')]=[{'all':!![]}];}return db[_0x5bc5('0x48')][_0x5bc5('0x4a')](_0x2c8a0b);})['then'](function(_0x2a1d27){_0x36572e['rows']=_0x2a1d27;return _0x36572e;})[_0x5bc5('0x26')](respondWithFilteredResult(_0x4dd49e,_0x2c8a0b))[_0x5bc5('0x4b')](handleError(_0x4dd49e,null));};exports['show']=function(_0x552a8b,_0x37819f){var _0x4d0b43={'raw':![],'where':{'id':_0x552a8b[_0x5bc5('0x4c')]['id']}},_0x5dc91a={};_0x5dc91a[_0x5bc5('0x3b')]=_['keys'](db[_0x5bc5('0x48')][_0x5bc5('0x37')]);_0x5dc91a['query']=_['keys'](_0x552a8b['query']);_0x5dc91a['filters']=_['intersection'](_0x5dc91a['model'],_0x5dc91a[_0x5bc5('0x3c')]);_0x4d0b43[_0x5bc5('0x40')]=_[_0x5bc5('0x4d')](_0x5dc91a[_0x5bc5('0x3b')],qs[_0x5bc5('0x3f')](_0x552a8b[_0x5bc5('0x3c')][_0x5bc5('0x3f')]));_0x4d0b43[_0x5bc5('0x40')]=_0x4d0b43[_0x5bc5('0x40')]['length']?_0x4d0b43[_0x5bc5('0x40')]:_0x5dc91a[_0x5bc5('0x3b')];if(_0x552a8b[_0x5bc5('0x3c')][_0x5bc5('0x4e')]){_0x4d0b43[_0x5bc5('0x49')]=[{'all':!![]}];}_0x4d0b43=_['merge']({},_0x4d0b43,_0x552a8b[_0x5bc5('0x4f')]);return db['VoiceChanSpy'][_0x5bc5('0x50')](_0x4d0b43)[_0x5bc5('0x26')](handleEntityNotFound(_0x37819f,null))[_0x5bc5('0x26')](respondWithResult(_0x37819f,null))['catch'](handleError(_0x37819f,null));};exports[_0x5bc5('0x51')]=function(_0xb4c37e,_0x340f9d){return db[_0x5bc5('0x48')][_0x5bc5('0x51')](_0xb4c37e[_0x5bc5('0x52')],{})[_0x5bc5('0x26')](function(_0x4c1020){var _0x43ec3f=_0xb4c37e['user']['get']({'plain':!![]});if(!_0x43ec3f)throw new Error(_0x5bc5('0x53'));if(_0x43ec3f[_0x5bc5('0x54')]===_0x5bc5('0x55')){var _0x383349=_0x4c1020['get']({'plain':!![]});var _0x363a1e=_0x5bc5('0x28');return db[_0x5bc5('0x56')][_0x5bc5('0x50')]({'where':{'name':_0x363a1e,'userProfileId':_0x43ec3f[_0x5bc5('0x57')]},'raw':!![]})['then'](function(_0x402fcb){if(_0x402fcb&&_0x402fcb[_0x5bc5('0x58')]===0x0){return db[_0x5bc5('0x29')][_0x5bc5('0x51')]({'name':_0x383349[_0x5bc5('0x2e')],'resourceId':_0x383349['id'],'type':_0x402fcb[_0x5bc5('0x2e')],'sectionId':_0x402fcb['id']},{})[_0x5bc5('0x26')](function(){return _0x4c1020;});}else{return _0x4c1020;}})[_0x5bc5('0x4b')](function(_0x2a5ad7){logger['error'](_0x5bc5('0x59'),_0x2a5ad7);throw _0x2a5ad7;});}return _0x4c1020;})[_0x5bc5('0x26')](respondWithResult(_0x340f9d,0xc9))[_0x5bc5('0x4b')](handleError(_0x340f9d,null));};exports[_0x5bc5('0x25')]=function(_0x2ffbf6,_0x417b8e){if(_0x2ffbf6['body']['id']){delete _0x2ffbf6['body']['id'];}return db[_0x5bc5('0x48')][_0x5bc5('0x50')]({'where':{'id':_0x2ffbf6['params']['id']}})[_0x5bc5('0x26')](handleEntityNotFound(_0x417b8e,null))[_0x5bc5('0x26')](saveUpdates(_0x2ffbf6[_0x5bc5('0x52')],null))['then'](respondWithResult(_0x417b8e,null))[_0x5bc5('0x4b')](handleError(_0x417b8e,null));};exports[_0x5bc5('0x2a')]=function(_0xcdcf20,_0x47ab10){return db[_0x5bc5('0x48')][_0x5bc5('0x50')]({'where':{'id':_0xcdcf20[_0x5bc5('0x4c')]['id']}})[_0x5bc5('0x26')](handleEntityNotFound(_0x47ab10,null))['then'](removeEntity(_0x47ab10,null))[_0x5bc5('0x4b')](handleError(_0x47ab10,null));}; \ No newline at end of file +var _0x17db=['show','keys','includeAll','include','options','find','catch','create','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','ChanSpies','error','stack','name','send','merge','body','contact','agent','interaction','account','map','VoiceChanSpy','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x214993,_0x5e8817){var _0x457aeb=function(_0x5b9c07){while(--_0x5b9c07){_0x214993['push'](_0x214993['shift']());}};_0x457aeb(++_0x5e8817);}(_0x17db,0xb2));var _0xb17d=function(_0xdb7e5b,_0x382b2c){_0xdb7e5b=_0xdb7e5b-0x0;var _0x2f11cc=_0x17db[_0xdb7e5b];return _0x2f11cc;};'use strict';var emlformat=require(_0xb17d('0x0'));var rimraf=require(_0xb17d('0x1'));var zipdir=require(_0xb17d('0x2'));var jsonpatch=require(_0xb17d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb17d('0x4'));var Mustache=require('mustache');var util=require(_0xb17d('0x5'));var path=require(_0xb17d('0x6'));var sox=require(_0xb17d('0x7'));var csv=require(_0xb17d('0x8'));var ejs=require(_0xb17d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb17d('0xa'));var crypto=require(_0xb17d('0xb'));var jsforce=require(_0xb17d('0xc'));var deskjs=require(_0xb17d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb17d('0xe'));var Redis=require(_0xb17d('0xf'));var authService=require(_0xb17d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb17d('0x11'));var logger=require(_0xb17d('0x12'))(_0xb17d('0x13'));var utils=require('../../config/utils');var config=require(_0xb17d('0x14'));var licenseUtil=require(_0xb17d('0x15'));var db=require(_0xb17d('0x16'))['db'];function respondWithStatusCode(_0x10bc4e,_0x4a1bda){_0x4a1bda=_0x4a1bda||0xcc;return function(_0x219ace){if(_0x219ace){return _0x10bc4e[_0xb17d('0x17')](_0x4a1bda);}return _0x10bc4e[_0xb17d('0x18')](_0x4a1bda)[_0xb17d('0x19')]();};}function respondWithResult(_0x478e7e,_0x251f5c){_0x251f5c=_0x251f5c||0xc8;return function(_0xf396ba){if(_0xf396ba){return _0x478e7e[_0xb17d('0x18')](_0x251f5c)[_0xb17d('0x1a')](_0xf396ba);}};}function respondWithFilteredResult(_0x384a8b,_0x1674a7){return function(_0x192580){if(_0x192580){var _0x2b9f5b=typeof _0x1674a7[_0xb17d('0x1b')]===_0xb17d('0x1c')&&typeof _0x1674a7[_0xb17d('0x1d')]===_0xb17d('0x1c');var _0x550db2=_0x192580[_0xb17d('0x1e')];var _0x331e19=_0x2b9f5b?0x0:_0x1674a7['offset'];var _0x827ff8=_0x2b9f5b?_0x192580[_0xb17d('0x1e')]:_0x1674a7['offset']+_0x1674a7[_0xb17d('0x1d')];var _0x2e678c;if(_0x827ff8>=_0x550db2){_0x827ff8=_0x550db2;_0x2e678c=0xc8;}else{_0x2e678c=0xce;}_0x384a8b[_0xb17d('0x18')](_0x2e678c);return _0x384a8b[_0xb17d('0x1f')](_0xb17d('0x20'),_0x331e19+'-'+_0x827ff8+'/'+_0x550db2)[_0xb17d('0x1a')](_0x192580);}return null;};}function patchUpdates(_0x1dcbbb){return function(_0x552b89){try{jsonpatch['apply'](_0x552b89,_0x1dcbbb,!![]);}catch(_0x32b17a){return BPromise[_0xb17d('0x21')](_0x32b17a);}return _0x552b89[_0xb17d('0x22')]();};}function saveUpdates(_0xf4f890,_0x4ced93){return function(_0x353a97){if(_0x353a97){return _0x353a97[_0xb17d('0x23')](_0xf4f890)[_0xb17d('0x24')](function(_0x58cd28){return _0x58cd28;});}return null;};}function removeEntity(_0x575adb,_0x16f7c3){return function(_0x473a33){if(_0x473a33){return _0x473a33[_0xb17d('0x25')]()['then'](function(){var _0x14a1ae=_0x473a33[_0xb17d('0x26')]({'plain':!![]});var _0x35921f=_0xb17d('0x27');return db['UserProfileResource'][_0xb17d('0x25')]({'where':{'type':_0x35921f,'resourceId':_0x14a1ae['id']}})[_0xb17d('0x24')](function(){return _0x473a33;});})[_0xb17d('0x24')](function(){_0x575adb[_0xb17d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14a414,_0x3b2285){return function(_0x2a76b4){if(!_0x2a76b4){_0x14a414[_0xb17d('0x17')](0x194);}return _0x2a76b4;};}function handleError(_0xd97c8b,_0x4d5efc){_0x4d5efc=_0x4d5efc||0x1f4;return function(_0x3ee6bd){logger[_0xb17d('0x28')](_0x3ee6bd[_0xb17d('0x29')]);if(_0x3ee6bd[_0xb17d('0x2a')]){delete _0x3ee6bd[_0xb17d('0x2a')];}_0xd97c8b[_0xb17d('0x18')](_0x4d5efc)[_0xb17d('0x2b')](_0x3ee6bd);};}function getMustacheRender(_0x329978,_0x24f607){return Mustache['render'](_0x329978,_[_0xb17d('0x2c')](_0x24f607[_0xb17d('0x2d')],{'contact':_0x24f607[_0xb17d('0x2e')],'message':_0x24f607['message'],'agent':_0x24f607[_0xb17d('0x2f')],'interaction':_0x24f607[_0xb17d('0x30')],'account':_0x24f607[_0xb17d('0x31')]}))||'';}exports['index']=function(_0x524c1f,_0x5defe9){var _0x4f22a3={},_0x26ff29={},_0x1f2a76={'count':0x0,'rows':[]};var _0x514de0=_[_0xb17d('0x32')](db[_0xb17d('0x33')][_0xb17d('0x34')],function(_0x522099){return{'name':_0x522099[_0xb17d('0x35')],'type':_0x522099[_0xb17d('0x36')]['key']};});_0x26ff29[_0xb17d('0x37')]=_[_0xb17d('0x32')](_0x514de0,_0xb17d('0x2a'));_0x26ff29[_0xb17d('0x38')]=_['keys'](_0x524c1f[_0xb17d('0x38')]);_0x26ff29[_0xb17d('0x39')]=_['intersection'](_0x26ff29[_0xb17d('0x37')],_0x26ff29[_0xb17d('0x38')]);_0x4f22a3[_0xb17d('0x3a')]=_[_0xb17d('0x3b')](_0x26ff29[_0xb17d('0x37')],qs['fields'](_0x524c1f[_0xb17d('0x38')][_0xb17d('0x3c')]));_0x4f22a3[_0xb17d('0x3a')]=_0x4f22a3[_0xb17d('0x3a')][_0xb17d('0x3d')]?_0x4f22a3['attributes']:_0x26ff29['model'];if(!_0x524c1f['query'][_0xb17d('0x3e')](_0xb17d('0x3f'))){_0x4f22a3['limit']=qs[_0xb17d('0x1d')](_0x524c1f[_0xb17d('0x38')][_0xb17d('0x1d')]);_0x4f22a3[_0xb17d('0x1b')]=qs['offset'](_0x524c1f['query'][_0xb17d('0x1b')]);}_0x4f22a3[_0xb17d('0x40')]=qs[_0xb17d('0x41')](_0x524c1f['query'][_0xb17d('0x41')]);_0x4f22a3[_0xb17d('0x42')]=qs[_0xb17d('0x39')](_['pick'](_0x524c1f[_0xb17d('0x38')],_0x26ff29['filters']),_0x514de0);if(_0x524c1f['query'][_0xb17d('0x43')]){_0x4f22a3['where']=_[_0xb17d('0x2c')](_0x4f22a3[_0xb17d('0x42')],{'$or':_[_0xb17d('0x32')](_0x514de0,function(_0x2e8b2a){if(_0x2e8b2a[_0xb17d('0x36')]!=='VIRTUAL'){var _0x4bf801={};_0x4bf801[_0x2e8b2a[_0xb17d('0x2a')]]={'$like':'%'+_0x524c1f[_0xb17d('0x38')][_0xb17d('0x43')]+'%'};return _0x4bf801;}})});}_0x4f22a3=_[_0xb17d('0x2c')]({},_0x4f22a3,_0x524c1f['options']);var _0x3da60a={'where':_0x4f22a3[_0xb17d('0x42')]};return db['VoiceChanSpy'][_0xb17d('0x1e')](_0x3da60a)[_0xb17d('0x24')](function(_0x9b84a9){_0x1f2a76['count']=_0x9b84a9;if(_0x524c1f['query']['includeAll']){_0x4f22a3['include']=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x4f22a3);})[_0xb17d('0x24')](function(_0x5de122){_0x1f2a76['rows']=_0x5de122;return _0x1f2a76;})[_0xb17d('0x24')](respondWithFilteredResult(_0x5defe9,_0x4f22a3))['catch'](handleError(_0x5defe9,null));};exports[_0xb17d('0x44')]=function(_0x88c898,_0x2d3419){var _0x52b482={'raw':![],'where':{'id':_0x88c898['params']['id']}},_0x11773c={};_0x11773c['model']=_[_0xb17d('0x45')](db[_0xb17d('0x33')]['rawAttributes']);_0x11773c[_0xb17d('0x38')]=_[_0xb17d('0x45')](_0x88c898[_0xb17d('0x38')]);_0x11773c[_0xb17d('0x39')]=_[_0xb17d('0x3b')](_0x11773c[_0xb17d('0x37')],_0x11773c[_0xb17d('0x38')]);_0x52b482[_0xb17d('0x3a')]=_[_0xb17d('0x3b')](_0x11773c['model'],qs[_0xb17d('0x3c')](_0x88c898[_0xb17d('0x38')]['fields']));_0x52b482[_0xb17d('0x3a')]=_0x52b482[_0xb17d('0x3a')][_0xb17d('0x3d')]?_0x52b482['attributes']:_0x11773c[_0xb17d('0x37')];if(_0x88c898[_0xb17d('0x38')][_0xb17d('0x46')]){_0x52b482[_0xb17d('0x47')]=[{'all':!![]}];}_0x52b482=_['merge']({},_0x52b482,_0x88c898[_0xb17d('0x48')]);return db[_0xb17d('0x33')][_0xb17d('0x49')](_0x52b482)[_0xb17d('0x24')](handleEntityNotFound(_0x2d3419,null))[_0xb17d('0x24')](respondWithResult(_0x2d3419,null))[_0xb17d('0x4a')](handleError(_0x2d3419,null));};exports[_0xb17d('0x4b')]=function(_0x169446,_0x37aad2){return db[_0xb17d('0x33')][_0xb17d('0x4b')](_0x169446[_0xb17d('0x2d')],{})['then'](function(_0x4ad8fc){var _0x5d5963=_0x169446[_0xb17d('0x4c')][_0xb17d('0x26')]({'plain':!![]});if(!_0x5d5963)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d5963['role']==='user'){var _0x1d0c19=_0x4ad8fc['get']({'plain':!![]});var _0x1d244a='ChanSpies';return db[_0xb17d('0x4d')][_0xb17d('0x49')]({'where':{'name':_0x1d244a,'userProfileId':_0x5d5963[_0xb17d('0x4e')]},'raw':!![]})['then'](function(_0x3992ef){if(_0x3992ef&&_0x3992ef[_0xb17d('0x4f')]===0x0){return db[_0xb17d('0x50')][_0xb17d('0x4b')]({'name':_0x1d0c19['name'],'resourceId':_0x1d0c19['id'],'type':_0x3992ef[_0xb17d('0x2a')],'sectionId':_0x3992ef['id']},{})['then'](function(){return _0x4ad8fc;});}else{return _0x4ad8fc;}})[_0xb17d('0x4a')](function(_0x45248){logger[_0xb17d('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45248);throw _0x45248;});}return _0x4ad8fc;})[_0xb17d('0x24')](respondWithResult(_0x37aad2,0xc9))[_0xb17d('0x4a')](handleError(_0x37aad2,null));};exports[_0xb17d('0x23')]=function(_0x5c0feb,_0x52e75e){if(_0x5c0feb[_0xb17d('0x2d')]['id']){delete _0x5c0feb['body']['id'];}return db[_0xb17d('0x33')][_0xb17d('0x49')]({'where':{'id':_0x5c0feb[_0xb17d('0x51')]['id']}})[_0xb17d('0x24')](handleEntityNotFound(_0x52e75e,null))[_0xb17d('0x24')](saveUpdates(_0x5c0feb['body'],null))[_0xb17d('0x24')](respondWithResult(_0x52e75e,null))['catch'](handleError(_0x52e75e,null));};exports[_0xb17d('0x25')]=function(_0x317801,_0x1c13f8){return db['VoiceChanSpy'][_0xb17d('0x49')]({'where':{'id':_0x317801[_0xb17d('0x51')]['id']}})[_0xb17d('0x24')](handleEntityNotFound(_0x1c13f8,null))['then'](removeEntity(_0x1c13f8,null))[_0xb17d('0x4a')](handleError(_0x1c13f8,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index f5750b0..9b796d9 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 _0x151b=['record','internal','concat','User','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','./voiceChanSpy.attributes','context','from-sip','%s%s','system','push','merge','CDR(type)=%s','chanspy','MixMonitor','format','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','SIP/%s,%s','name','options','join'];(function(_0x3497b5,_0x5775b8){var _0x9c5460=function(_0x29d1e2){while(--_0x29d1e2){_0x3497b5['push'](_0x3497b5['shift']());}};_0x9c5460(++_0x5775b8);}(_0x151b,0x153));var _0xb151=function(_0x351172,_0x5d5712){_0x351172=_0x351172-0x0;var _0x3e86e9=_0x151b[_0x351172];return _0x3e86e9;};'use strict';var _=require(_0xb151('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0xb151('0x1'));var getUserApplications=function(_0x53e601,_0x463ad0,_0x2098a4){var _0x377d3d=0x1;var _0x486d88=[];var _0x4a9d3f={'context':_0x463ad0[_0xb151('0x2')]||_0xb151('0x3'),'exten':util['format'](_0xb151('0x4'),_0x53e601['prefix'],_0x2098a4),'type':_0xb151('0x5'),'isApp':![],'ChanSpyId':_0x53e601['id'],'UserId':_0x463ad0['id']};_0x486d88[_0xb151('0x6')](_[_0xb151('0x7')]({'app':'Set','appdata':util['format'](_0xb151('0x8'),_0xb151('0x9')),'priority':_0x377d3d++},_0x4a9d3f));if(_0x53e601['record']){_0x486d88['push'](_[_0xb151('0x7')]({'app':_0xb151('0xa'),'appdata':util[_0xb151('0xb')](_0xb151('0xc'),_0x53e601[_0xb151('0xd')]),'priority':_0x377d3d++},_0x4a9d3f));}if(_0x53e601[_0xb151('0xe')]){_0x486d88[_0xb151('0x6')](_[_0xb151('0x7')]({'app':_0xb151('0xf'),'appdata':_0x53e601[_0xb151('0x10')],'priority':_0x377d3d++},_0x4a9d3f));}_0x486d88['push'](_[_0xb151('0x7')]({'app':'ChanSpy','appdata':util[_0xb151('0xb')](_0xb151('0x11'),_0x463ad0[_0xb151('0x12')],_0x53e601[_0xb151('0x13')]?_0x53e601['options'][_0xb151('0x14')](''):''),'priority':_0x377d3d++},_0x4a9d3f));if(_0x53e601[_0xb151('0x15')]){_0x486d88[_0xb151('0x6')](_['merge']({'app':'StopMixMonitor','priority':_0x377d3d++},_0x4a9d3f));}return _0x486d88;};var getChanSpyApplications=function(_0x5b2faa,_0x4af1c2){var _0x3ff606=[];for(var _0x4ca435=0x0,_0x251c8d=0x1;_0x4ca435<_0x4af1c2['length'];_0x4ca435++,_0x251c8d=0x1){_0x3ff606=_0x3ff606['concat'](getUserApplications(_0x5b2faa,_0x4af1c2[_0x4ca435],_0x4af1c2[_0x4ca435][_0xb151('0x16')]));if(_0x4af1c2[_0x4ca435][_0xb151('0x16')]!=_0x4af1c2[_0x4ca435][_0xb151('0x12')]){_0x3ff606=_0x3ff606[_0xb151('0x17')](getUserApplications(_0x5b2faa,_0x4af1c2[_0x4ca435],_0x4af1c2[_0x4ca435][_0xb151('0x12')]));}}return _0x3ff606;};var getChanSpyPromise=function(_0xf8a2fe,_0x1e2b38){return new BPromise(function(_0x5525fd,_0xd0fe9a){return _0xf8a2fe[_0xb151('0x18')]['findAll']({'attributes':['id',_0xb151('0x12'),_0xb151('0x16')],'where':{'role':_0xb151('0x19'),'chanspy':!![]},'raw':!![]})[_0xb151('0x1a')](function(_0x2a06c7){if(_0x2a06c7){return _0x5525fd(getChanSpyApplications(_0x1e2b38,_0x2a06c7));}return _0x5525fd([]);})[_0xb151('0x1b')](function(_0x3f375d){_0xd0fe9a(_0x3f375d);});});};module[_0xb151('0x1c')]=function(_0x49c2e,_0x370110){var _0x56a73f=_0x49c2e[_0xb151('0x1d')];return _0x49c2e[_0xb151('0x1e')](_0xb151('0x1f'),attributes,{'tableName':_0xb151('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x724bd7,_0x29652a,_0xd22ee1){return getChanSpyPromise(_0x56a73f,_0x724bd7)[_0xb151('0x1a')](function(_0x31f1a7){if(_0x31f1a7&&_0x31f1a7['length']){return _0x56a73f[_0xb151('0x21')][_0xb151('0x22')](_0x31f1a7);}})[_0xb151('0x1a')](function(){_0xd22ee1();})[_0xb151('0x1b')](function(_0x2d65f8){_0xd22ee1(_0x2d65f8);});},'afterUpdate':function(_0x1c0b04,_0x46f28c,_0x2dc1b4){return _0x56a73f['VoiceExtension'][_0xb151('0x23')]({'where':{'ChanSpyId':_0x1c0b04['id']}})['then'](function(){return getChanSpyPromise(_0x56a73f,_0x1c0b04);})[_0xb151('0x1a')](function(_0x32c933){if(_0x32c933&&_0x32c933['length']){return _0x56a73f[_0xb151('0x21')]['bulkCreate'](_0x32c933);}})[_0xb151('0x1a')](function(){_0x2dc1b4();})[_0xb151('0x1b')](function(_0x4215b7){_0x2dc1b4(_0x4215b7);});},'afterDestroy':function(_0x2f5127,_0x3ed573,_0x444af1){return _0x56a73f[_0xb151('0x21')][_0xb151('0x23')]({'where':{'ChanSpyId':_0x2f5127['id']}})['then'](function(){_0x444af1();})[_0xb151('0x1b')](function(_0x2c920e){_0x444af1(_0x2c920e);});}}});}; \ No newline at end of file +var _0xb315=['catch','destroy','bulkCreate','lodash','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','merge','format','CDR(type)=%s','chanspy','record','push','MixMonitor','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','concat','internal','name','User','agent','then','exports','models','define','VoiceChanSpy','length','VoiceExtension'];(function(_0xd5518b,_0x6bbeb2){var _0xc32ace=function(_0x55e41e){while(--_0x55e41e){_0xd5518b['push'](_0xd5518b['shift']());}};_0xc32ace(++_0x6bbeb2);}(_0xb315,0x6f));var _0x5b31=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xb315[_0x4dcc2d];return _0x1bbd79;};'use strict';var _=require(_0x5b31('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x5b31('0x1'));var getUserApplications=function(_0x4a79eb,_0x9bf5dd,_0x3c04c6){var _0x4f1704=0x1;var _0xa46410=[];var _0x1cac89={'context':_0x9bf5dd[_0x5b31('0x2')]||_0x5b31('0x3'),'exten':util['format'](_0x5b31('0x4'),_0x4a79eb[_0x5b31('0x5')],_0x3c04c6),'type':_0x5b31('0x6'),'isApp':![],'ChanSpyId':_0x4a79eb['id'],'UserId':_0x9bf5dd['id']};_0xa46410['push'](_[_0x5b31('0x7')]({'app':'Set','appdata':util[_0x5b31('0x8')](_0x5b31('0x9'),_0x5b31('0xa')),'priority':_0x4f1704++},_0x1cac89));if(_0x4a79eb[_0x5b31('0xb')]){_0xa46410[_0x5b31('0xc')](_[_0x5b31('0x7')]({'app':_0x5b31('0xd'),'appdata':util[_0x5b31('0x8')]('${UNIQUEID}.%s,a',_0x4a79eb['recordingFormat']),'priority':_0x4f1704++},_0x1cac89));}if(_0x4a79eb['auth']){_0xa46410[_0x5b31('0xc')](_['merge']({'app':_0x5b31('0xe'),'appdata':_0x4a79eb[_0x5b31('0xf')],'priority':_0x4f1704++},_0x1cac89));}_0xa46410[_0x5b31('0xc')](_[_0x5b31('0x7')]({'app':_0x5b31('0x10'),'appdata':util[_0x5b31('0x8')](_0x5b31('0x11'),_0x9bf5dd['name'],_0x4a79eb[_0x5b31('0x12')]?_0x4a79eb[_0x5b31('0x12')][_0x5b31('0x13')](''):''),'priority':_0x4f1704++},_0x1cac89));if(_0x4a79eb[_0x5b31('0xb')]){_0xa46410[_0x5b31('0xc')](_[_0x5b31('0x7')]({'app':_0x5b31('0x14'),'priority':_0x4f1704++},_0x1cac89));}return _0xa46410;};var getChanSpyApplications=function(_0x160842,_0x2010d3){var _0x404916=[];for(var _0x2e07cc=0x0,_0x5abf37=0x1;_0x2e07cc<_0x2010d3['length'];_0x2e07cc++,_0x5abf37=0x1){_0x404916=_0x404916[_0x5b31('0x15')](getUserApplications(_0x160842,_0x2010d3[_0x2e07cc],_0x2010d3[_0x2e07cc][_0x5b31('0x16')]));if(_0x2010d3[_0x2e07cc][_0x5b31('0x16')]!=_0x2010d3[_0x2e07cc][_0x5b31('0x17')]){_0x404916=_0x404916[_0x5b31('0x15')](getUserApplications(_0x160842,_0x2010d3[_0x2e07cc],_0x2010d3[_0x2e07cc]['name']));}}return _0x404916;};var getChanSpyPromise=function(_0x4d9d4f,_0x579e66){return new BPromise(function(_0x45ac12,_0x1370bd){return _0x4d9d4f[_0x5b31('0x18')]['findAll']({'attributes':['id','name',_0x5b31('0x16')],'where':{'role':_0x5b31('0x19'),'chanspy':!![]},'raw':!![]})[_0x5b31('0x1a')](function(_0x87da5b){if(_0x87da5b){return _0x45ac12(getChanSpyApplications(_0x579e66,_0x87da5b));}return _0x45ac12([]);})['catch'](function(_0x5daa7d){_0x1370bd(_0x5daa7d);});});};module[_0x5b31('0x1b')]=function(_0x2992b2,_0x5bea9e){var _0x3bae51=_0x2992b2[_0x5b31('0x1c')];return _0x2992b2[_0x5b31('0x1d')](_0x5b31('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2893d9,_0xc8b353,_0x36e27d){return getChanSpyPromise(_0x3bae51,_0x2893d9)[_0x5b31('0x1a')](function(_0x20d4c9){if(_0x20d4c9&&_0x20d4c9[_0x5b31('0x1f')]){return _0x3bae51[_0x5b31('0x20')]['bulkCreate'](_0x20d4c9);}})[_0x5b31('0x1a')](function(){_0x36e27d();})[_0x5b31('0x21')](function(_0x1304ab){_0x36e27d(_0x1304ab);});},'afterUpdate':function(_0xf5792b,_0x207ef7,_0x5627a9){return _0x3bae51['VoiceExtension'][_0x5b31('0x22')]({'where':{'ChanSpyId':_0xf5792b['id']}})[_0x5b31('0x1a')](function(){return getChanSpyPromise(_0x3bae51,_0xf5792b);})[_0x5b31('0x1a')](function(_0x479276){if(_0x479276&&_0x479276['length']){return _0x3bae51[_0x5b31('0x20')][_0x5b31('0x23')](_0x479276);}})['then'](function(){_0x5627a9();})[_0x5b31('0x21')](function(_0x1611ca){_0x5627a9(_0x1611ca);});},'afterDestroy':function(_0x18c414,_0x5c88ef,_0x405137){return _0x3bae51[_0x5b31('0x20')][_0x5b31('0x22')]({'where':{'ChanSpyId':_0x18c414['id']}})[_0x5b31('0x1a')](function(){_0x405137();})[_0x5b31('0x21')](function(_0x490728){_0x405137(_0x490728);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 8b397f1..34f388d 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 _0x8ccf=['request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x4988e7,_0x17214d){var _0x30d8ef=function(_0x1ee71f){while(--_0x1ee71f){_0x4988e7['push'](_0x4988e7['shift']());}};_0x30d8ef(++_0x17214d);}(_0x8ccf,0x1eb));var _0xf8cc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8ccf[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0xf8cc('0x0'));var moment=require(_0xf8cc('0x1'));var BPromise=require(_0xf8cc('0x2'));var rs=require(_0xf8cc('0x3'));var fs=require('fs');var Redis=require(_0xf8cc('0x4'));var db=require(_0xf8cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8cc('0x6'))(_0xf8cc('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8cc('0x8'));var client=jayson[_0xf8cc('0x9')][_0xf8cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb0fac6,_0x302cf4,_0x38ef5d){return new BPromise(function(_0x538f21,_0x1022ee){return client[_0xf8cc('0xb')](_0xb0fac6,_0x38ef5d)[_0xf8cc('0xc')](function(_0x19dfb6){logger[_0xf8cc('0xd')](_0xf8cc('0xe'),_0x302cf4,_0xf8cc('0xf'));logger[_0xf8cc('0x10')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x302cf4,_0xf8cc('0xf'),JSON[_0xf8cc('0x11')](_0x19dfb6));if(_0x19dfb6[_0xf8cc('0x12')]){if(_0x19dfb6[_0xf8cc('0x12')][_0xf8cc('0x13')]===0x1f4){logger[_0xf8cc('0x12')](_0xf8cc('0xe'),_0x302cf4,_0x19dfb6[_0xf8cc('0x12')]['message']);return _0x1022ee(_0x19dfb6[_0xf8cc('0x12')]['message']);}logger[_0xf8cc('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x302cf4,_0x19dfb6['error'][_0xf8cc('0x14')]);return _0x538f21(_0x19dfb6[_0xf8cc('0x12')][_0xf8cc('0x14')]);}else{logger[_0xf8cc('0xd')](_0xf8cc('0xe'),_0x302cf4,_0xf8cc('0xf'));_0x538f21(_0x19dfb6[_0xf8cc('0x15')]['message']);}})[_0xf8cc('0x16')](function(_0xa049cd){logger['error'](_0xf8cc('0xe'),_0x302cf4,_0xa049cd);_0x1022ee(_0xa049cd);});});} \ No newline at end of file +var _0x45b2=['code','message','info','request\x20sent','result','catch','lodash','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x29b4d5,_0x5b94c7){var _0x241d61=function(_0x127991){while(--_0x127991){_0x29b4d5['push'](_0x29b4d5['shift']());}};_0x241d61(++_0x5b94c7);}(_0x45b2,0xe2));var _0x245b=function(_0x4a2b0a,_0x1ff15a){_0x4a2b0a=_0x4a2b0a-0x0;var _0x56579a=_0x45b2[_0x4a2b0a];return _0x56579a;};'use strict';var _=require(_0x245b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x245b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x245b('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x245b('0x3'));var config=require(_0x245b('0x4'));var jayson=require(_0x245b('0x5'));var client=jayson[_0x245b('0x6')][_0x245b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ac740,_0x4ff3df,_0x4873b7){return new BPromise(function(_0x3133cc,_0x42d223){return client['request'](_0x1ac740,_0x4873b7)[_0x245b('0x8')](function(_0x5c4c88){logger['info'](_0x245b('0x9'),_0x4ff3df,'request\x20sent');logger[_0x245b('0xa')](_0x245b('0xb'),_0x4ff3df,'request\x20sent',JSON[_0x245b('0xc')](_0x5c4c88));if(_0x5c4c88[_0x245b('0xd')]){if(_0x5c4c88[_0x245b('0xd')][_0x245b('0xe')]===0x1f4){logger[_0x245b('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x4ff3df,_0x5c4c88[_0x245b('0xd')]['message']);return _0x42d223(_0x5c4c88[_0x245b('0xd')][_0x245b('0xf')]);}logger[_0x245b('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x4ff3df,_0x5c4c88[_0x245b('0xd')][_0x245b('0xf')]);return _0x3133cc(_0x5c4c88[_0x245b('0xd')][_0x245b('0xf')]);}else{logger[_0x245b('0x10')](_0x245b('0x9'),_0x4ff3df,_0x245b('0x11'));_0x3133cc(_0x5c4c88[_0x245b('0x12')][_0x245b('0xf')]);}})[_0x245b('0x13')](function(_0x3e2b8a){logger['error'](_0x245b('0x9'),_0x4ff3df,_0x3e2b8a);_0x42d223(_0x3e2b8a);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index e57aabe..aee266e 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 _0x0ba7=['create','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0x0ba7,0x16d));var _0x70ba=function(_0x2ee7d4,_0x36c124){_0x2ee7d4=_0x2ee7d4-0x0;var _0x411bd2=_0x0ba7[_0x2ee7d4];return _0x411bd2;};'use strict';var multer=require(_0x70ba('0x0'));var util=require('util');var path=require(_0x70ba('0x1'));var timeout=require(_0x70ba('0x2'));var express=require(_0x70ba('0x3'));var router=express[_0x70ba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x70ba('0x5'));var interaction=require(_0x70ba('0x6'));var config=require(_0x70ba('0x7'));var controller=require(_0x70ba('0x8'));router[_0x70ba('0x9')]('/',auth[_0x70ba('0xa')](),controller[_0x70ba('0xb')]);router[_0x70ba('0x9')](_0x70ba('0xc'),auth[_0x70ba('0xa')](),controller[_0x70ba('0xd')]);router[_0x70ba('0xe')]('/',auth[_0x70ba('0xa')](),controller[_0x70ba('0xf')]);router[_0x70ba('0x10')]('/:id',auth[_0x70ba('0xa')](),controller['update']);router[_0x70ba('0x11')](_0x70ba('0xc'),auth[_0x70ba('0xa')](),controller[_0x70ba('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb32d=['../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x4e3c02,_0x734e35){var _0x5a1912=function(_0x49c24b){while(--_0x49c24b){_0x4e3c02['push'](_0x4e3c02['shift']());}};_0x5a1912(++_0x734e35);}(_0xb32d,0x1da));var _0xdb32=function(_0xd8a959,_0x169203){_0xd8a959=_0xd8a959-0x0;var _0x536e01=_0xb32d[_0xd8a959];return _0x536e01;};'use strict';var multer=require(_0xdb32('0x0'));var util=require(_0xdb32('0x1'));var path=require(_0xdb32('0x2'));var timeout=require(_0xdb32('0x3'));var express=require(_0xdb32('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdb32('0x5'));var interaction=require(_0xdb32('0x6'));var config=require('../../config/environment');var controller=require(_0xdb32('0x7'));router[_0xdb32('0x8')]('/',auth[_0xdb32('0x9')](),controller[_0xdb32('0xa')]);router[_0xdb32('0x8')](_0xdb32('0xb'),auth['isAuthenticated'](),controller[_0xdb32('0xc')]);router[_0xdb32('0xd')]('/',auth[_0xdb32('0x9')](),controller[_0xdb32('0xe')]);router[_0xdb32('0xf')](_0xdb32('0xb'),auth[_0xdb32('0x9')](),controller[_0xdb32('0x10')]);router[_0xdb32('0x11')](_0xdb32('0xb'),auth[_0xdb32('0x9')](),controller[_0xdb32('0x12')]);module[_0xdb32('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index cdf132d..9c8d384 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 _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x18edea,_0x10e024){var _0x51db47=function(_0x3140ad){while(--_0x3140ad){_0x18edea['push'](_0x18edea['shift']());}};_0x51db47(++_0x10e024);}(_0x34e8,0x12c));var _0x834e=function(_0x2140df,_0x36a3dd){_0x2140df=_0x2140df-0x0;var _0x290add=_0x34e8[_0x2140df];return _0x290add;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x4be02c,_0x41dee4){var _0xde6630=function(_0x15bc92){while(--_0x15bc92){_0x4be02c['push'](_0x4be02c['shift']());}};_0xde6630(++_0x41dee4);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 75c524a..479616b 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 _0x52ec=['body','contact','agent','interaction','account','map','VoiceContext','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','rows','rawAttributes','fields','find','catch','create','findAll','readFileSync','join','root','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','Contexts','userProfileId','autoAssociation','params','server/files/templates/context.ejs','writeFileSync','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','lodash','squel','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','request','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','merge'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x52ec,0x162));var _0xc52e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x52ec[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc52e('0x0'));var zipdir=require(_0xc52e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc52e('0x2'));var BPromise=require(_0xc52e('0x3'));var Mustache=require('mustache');var util=require(_0xc52e('0x4'));var path=require(_0xc52e('0x5'));var sox=require(_0xc52e('0x6'));var csv=require(_0xc52e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc52e('0x8'));var squel=require(_0xc52e('0x9'));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(_0xc52e('0xa'));var Redis=require('ioredis');var authService=require(_0xc52e('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0xc52e('0xc'));var hardwareService=require(_0xc52e('0xd'));var logger=require(_0xc52e('0xe'))('api');var utils=require(_0xc52e('0xf'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc52e('0x10'))['db'];var jayson=require(_0xc52e('0x11'));var client=jayson[_0xc52e('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49016c,_0x12af9d,_0x468cab,_0x27704b){return new BPromise(function(_0xa0f3ab,_0x3b9af8){var _0x1c5805=_0x27704b||client;return _0x1c5805[_0xc52e('0x13')](_0x49016c,_0x468cab)[_0xc52e('0x14')](function(_0xb8f28d){logger[_0xc52e('0x15')]('VoiceContext,\x20%s,\x20%s',_0x12af9d,'request\x20sent');logger[_0xc52e('0x16')](_0xc52e('0x17'),_0x12af9d,_0xc52e('0x18'),JSON[_0xc52e('0x19')](_0xb8f28d));if(_0xb8f28d[_0xc52e('0x1a')]){if(_0xb8f28d[_0xc52e('0x1a')]['code']===0x1f4){logger[_0xc52e('0x1a')](_0xc52e('0x1b'),_0x12af9d,_0xb8f28d[_0xc52e('0x1a')][_0xc52e('0x1c')]);return _0x3b9af8(_0xb8f28d[_0xc52e('0x1a')][_0xc52e('0x1c')]);}logger[_0xc52e('0x1a')]('VoiceContext,\x20%s,\x20%s',_0x12af9d,_0xb8f28d[_0xc52e('0x1a')][_0xc52e('0x1c')]);return _0xa0f3ab(_0xb8f28d['error'][_0xc52e('0x1c')]);}else{logger['info'](_0xc52e('0x1b'),_0x12af9d,_0xc52e('0x18'));_0xa0f3ab(_0xb8f28d[_0xc52e('0x1d')]['message']);}})['catch'](function(_0x31b813){logger[_0xc52e('0x1a')](_0xc52e('0x1b'),_0x12af9d,_0x31b813);_0x3b9af8(_0x31b813);});});}function respondWithStatusCode(_0x2357ca,_0x255f1f){_0x255f1f=_0x255f1f||0xcc;return function(_0x4b7a4f){if(_0x4b7a4f){return _0x2357ca[_0xc52e('0x1e')](_0x255f1f);}return _0x2357ca[_0xc52e('0x1f')](_0x255f1f)[_0xc52e('0x20')]();};}function respondWithResult(_0x3972b9,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x410c0b){if(_0x410c0b){return _0x3972b9[_0xc52e('0x1f')](_0x1bb7be)[_0xc52e('0x21')](_0x410c0b);}};}function respondWithFilteredResult(_0x1e257a,_0xd9ad60){return function(_0x55cfd2){if(_0x55cfd2){var _0x133253=typeof _0xd9ad60[_0xc52e('0x22')]==='undefined'&&typeof _0xd9ad60['limit']===_0xc52e('0x23');var _0x3cb3cc=_0x55cfd2[_0xc52e('0x24')];var _0x22348e=_0x133253?0x0:_0xd9ad60[_0xc52e('0x22')];var _0x4e5bcd=_0x133253?_0x55cfd2['count']:_0xd9ad60[_0xc52e('0x22')]+_0xd9ad60[_0xc52e('0x25')];var _0x2eebb3;if(_0x4e5bcd>=_0x3cb3cc){_0x4e5bcd=_0x3cb3cc;_0x2eebb3=0xc8;}else{_0x2eebb3=0xce;}_0x1e257a[_0xc52e('0x1f')](_0x2eebb3);return _0x1e257a[_0xc52e('0x26')]('Content-Range',_0x22348e+'-'+_0x4e5bcd+'/'+_0x3cb3cc)[_0xc52e('0x21')](_0x55cfd2);}return null;};}function patchUpdates(_0x415dbb){return function(_0x306699){try{jsonpatch[_0xc52e('0x27')](_0x306699,_0x415dbb,!![]);}catch(_0xa6fa2c){return BPromise[_0xc52e('0x28')](_0xa6fa2c);}return _0x306699[_0xc52e('0x29')]();};}function saveUpdates(_0x3b6730,_0x390b5e){return function(_0x1d39f7){if(_0x1d39f7){return _0x1d39f7[_0xc52e('0x2a')](_0x3b6730)[_0xc52e('0x14')](function(_0x215c6a){return _0x215c6a;});}return null;};}function removeEntity(_0x418d51,_0x12b775){return function(_0x5e3362){if(_0x5e3362){return _0x5e3362[_0xc52e('0x2b')]()[_0xc52e('0x14')](function(){var _0x5ea465=_0x5e3362[_0xc52e('0x2c')]({'plain':!![]});var _0x5213d1='Contexts';return db[_0xc52e('0x2d')][_0xc52e('0x2b')]({'where':{'type':_0x5213d1,'resourceId':_0x5ea465['id']}})[_0xc52e('0x14')](function(){return _0x5e3362;});})[_0xc52e('0x14')](function(){_0x418d51['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48c73b,_0x13efaf){return function(_0x55246e){if(!_0x55246e){_0x48c73b[_0xc52e('0x1e')](0x194);}return _0x55246e;};}function handleError(_0x431476,_0x56c73c){_0x56c73c=_0x56c73c||0x1f4;return function(_0x2c01b9){logger[_0xc52e('0x1a')](_0x2c01b9[_0xc52e('0x2e')]);if(_0x2c01b9[_0xc52e('0x2f')]){delete _0x2c01b9[_0xc52e('0x2f')];}_0x431476[_0xc52e('0x1f')](_0x56c73c)[_0xc52e('0x30')](_0x2c01b9);};}function getMustacheRender(_0x5d31bf,_0x19cee9){return Mustache['render'](_0x5d31bf,_[_0xc52e('0x31')](_0x19cee9[_0xc52e('0x32')],{'contact':_0x19cee9[_0xc52e('0x33')],'message':_0x19cee9[_0xc52e('0x1c')],'agent':_0x19cee9[_0xc52e('0x34')],'interaction':_0x19cee9[_0xc52e('0x35')],'account':_0x19cee9[_0xc52e('0x36')]}))||'';}exports['index']=function(_0x283b4c,_0x50921a){var _0x872e25={},_0x22657c={},_0x1482cc={'count':0x0,'rows':[]};var _0xc01370=_[_0xc52e('0x37')](db[_0xc52e('0x38')]['rawAttributes'],function(_0x4cb529){return{'name':_0x4cb529[_0xc52e('0x39')],'type':_0x4cb529[_0xc52e('0x3a')][_0xc52e('0x3b')]};});_0x22657c['model']=_[_0xc52e('0x37')](_0xc01370,_0xc52e('0x2f'));_0x22657c[_0xc52e('0x3c')]=_[_0xc52e('0x3d')](_0x283b4c[_0xc52e('0x3c')]);_0x22657c[_0xc52e('0x3e')]=_[_0xc52e('0x3f')](_0x22657c['model'],_0x22657c['query']);_0x872e25['attributes']=_[_0xc52e('0x3f')](_0x22657c[_0xc52e('0x40')],qs['fields'](_0x283b4c[_0xc52e('0x3c')]['fields']));_0x872e25[_0xc52e('0x41')]=_0x872e25['attributes'][_0xc52e('0x42')]?_0x872e25[_0xc52e('0x41')]:_0x22657c['model'];if(!_0x283b4c['query'][_0xc52e('0x43')](_0xc52e('0x44'))){_0x872e25[_0xc52e('0x25')]=qs[_0xc52e('0x25')](_0x283b4c[_0xc52e('0x3c')][_0xc52e('0x25')]);_0x872e25[_0xc52e('0x22')]=qs[_0xc52e('0x22')](_0x283b4c[_0xc52e('0x3c')][_0xc52e('0x22')]);}_0x872e25[_0xc52e('0x45')]=qs[_0xc52e('0x46')](_0x283b4c[_0xc52e('0x3c')][_0xc52e('0x46')]);_0x872e25[_0xc52e('0x47')]=qs[_0xc52e('0x3e')](_['pick'](_0x283b4c['query'],_0x22657c[_0xc52e('0x3e')]),_0xc01370);if(_0x283b4c[_0xc52e('0x3c')][_0xc52e('0x48')]){_0x872e25[_0xc52e('0x47')]=_[_0xc52e('0x31')](_0x872e25[_0xc52e('0x47')],{'$or':_[_0xc52e('0x37')](_0xc01370,function(_0xb9bbd2){if(_0xb9bbd2[_0xc52e('0x3a')]!==_0xc52e('0x49')){var _0x3159c8={};_0x3159c8[_0xb9bbd2['name']]={'$like':'%'+_0x283b4c[_0xc52e('0x3c')][_0xc52e('0x48')]+'%'};return _0x3159c8;}})});}_0x872e25=_[_0xc52e('0x31')]({},_0x872e25,_0x283b4c[_0xc52e('0x4a')]);var _0x55789e={'where':_0x872e25['where']};return db[_0xc52e('0x38')][_0xc52e('0x24')](_0x55789e)[_0xc52e('0x14')](function(_0xf2db5){_0x1482cc[_0xc52e('0x24')]=_0xf2db5;if(_0x283b4c[_0xc52e('0x3c')][_0xc52e('0x4b')]){_0x872e25[_0xc52e('0x4c')]=[{'all':!![]}];}return db[_0xc52e('0x38')]['findAll'](_0x872e25);})[_0xc52e('0x14')](function(_0x556a1b){_0x1482cc[_0xc52e('0x4d')]=_0x556a1b;return _0x1482cc;})[_0xc52e('0x14')](respondWithFilteredResult(_0x50921a,_0x872e25))['catch'](handleError(_0x50921a,null));};exports['show']=function(_0x2f0cf5,_0x192e14){var _0x15b239={'raw':![],'where':{'id':_0x2f0cf5['params']['id']}},_0x5f2eb1={};_0x5f2eb1['model']=_['keys'](db[_0xc52e('0x38')][_0xc52e('0x4e')]);_0x5f2eb1['query']=_[_0xc52e('0x3d')](_0x2f0cf5['query']);_0x5f2eb1[_0xc52e('0x3e')]=_[_0xc52e('0x3f')](_0x5f2eb1[_0xc52e('0x40')],_0x5f2eb1['query']);_0x15b239[_0xc52e('0x41')]=_[_0xc52e('0x3f')](_0x5f2eb1[_0xc52e('0x40')],qs[_0xc52e('0x4f')](_0x2f0cf5[_0xc52e('0x3c')][_0xc52e('0x4f')]));_0x15b239['attributes']=_0x15b239[_0xc52e('0x41')][_0xc52e('0x42')]?_0x15b239[_0xc52e('0x41')]:_0x5f2eb1['model'];if(_0x2f0cf5['query'][_0xc52e('0x4b')]){_0x15b239[_0xc52e('0x4c')]=[{'all':!![]}];}_0x15b239=_[_0xc52e('0x31')]({},_0x15b239,_0x2f0cf5['options']);return db[_0xc52e('0x38')][_0xc52e('0x50')](_0x15b239)['then'](handleEntityNotFound(_0x192e14,null))[_0xc52e('0x14')](respondWithResult(_0x192e14,null))[_0xc52e('0x51')](handleError(_0x192e14,null));};exports['create']=function(_0x1d663e,_0x523224,_0x52fae2){var _0x15e9a2;return db[_0xc52e('0x38')][_0xc52e('0x52')](_0x1d663e[_0xc52e('0x32')],{'raw':!![]})['then'](function(_0x2e2637){_0x15e9a2=_0x2e2637;return db[_0xc52e('0x38')][_0xc52e('0x53')]({'raw':!![]});})['then'](function(_0x172817){var _0x170e08=fs[_0xc52e('0x54')](path[_0xc52e('0x55')](config[_0xc52e('0x56')],'server/files/templates/context.ejs'),_0xc52e('0x57'));var _0x3b60d7=ejs[_0xc52e('0x58')](_0x170e08,{'contexts':_0x172817||[]});fs['writeFileSync'](_0xc52e('0x59'),_0x3b60d7);})[_0xc52e('0x14')](function(){return respondWithRpcPromise(_0xc52e('0x5a'),'create',{'module':_0xc52e('0x5b')});})['then'](function(){var _0x5e0625=_0x1d663e[_0xc52e('0x5c')][_0xc52e('0x2c')]({'plain':!![]});if(!_0x5e0625)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e0625[_0xc52e('0x5d')]===_0xc52e('0x5c')){var _0x53f9ef=_0x15e9a2[_0xc52e('0x2c')]({'plain':!![]});return db[_0xc52e('0x5e')][_0xc52e('0x50')]({'where':{'name':_0xc52e('0x5f'),'userProfileId':_0x5e0625[_0xc52e('0x60')]},'raw':!![]})['then'](function(_0x670805){if(_0x670805&&_0x670805[_0xc52e('0x61')]===0x0){return db[_0xc52e('0x2d')][_0xc52e('0x52')]({'name':_0x53f9ef['name'],'resourceId':_0x53f9ef['id'],'type':_0x670805[_0xc52e('0x2f')],'sectionId':_0x670805['id']},{})[_0xc52e('0x14')](function(){return _0x15e9a2;});}else{return _0x15e9a2;}})[_0xc52e('0x51')](function(_0x364982){logger[_0xc52e('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x364982);throw _0x364982;});}return _0x15e9a2;})[_0xc52e('0x14')](respondWithResult(_0x523224,0xc9))[_0xc52e('0x51')](handleError(_0x523224,null));};exports[_0xc52e('0x2a')]=function(_0x15c2a8,_0x14d8b9,_0x37b095){var _0x305905;return db['VoiceContext']['find']({'where':{'id':_0x15c2a8[_0xc52e('0x62')]['id']}})['then'](handleEntityNotFound(_0x14d8b9,null))['then'](saveUpdates(_0x15c2a8[_0xc52e('0x32')],null))[_0xc52e('0x14')](function(_0x2bedae){if(_0x2bedae){_0x305905=_0x2bedae;return db['VoiceContext'][_0xc52e('0x53')]({'raw':!![]});}})['then'](function(_0x63fc10){var _0x14f99c=fs[_0xc52e('0x54')](path[_0xc52e('0x55')](config[_0xc52e('0x56')],_0xc52e('0x63')),_0xc52e('0x57'));var _0x3edc22=ejs[_0xc52e('0x58')](_0x14f99c,{'contexts':_0x63fc10||[]});fs['writeFileSync'](_0xc52e('0x59'),_0x3edc22);})[_0xc52e('0x14')](function(){return respondWithRpcPromise(_0xc52e('0x5a'),'update',{'module':_0xc52e('0x5b')});})['then'](function(){return _0x305905;})['then'](respondWithResult(_0x14d8b9,null))[_0xc52e('0x51')](handleError(_0x14d8b9,null));};exports['destroy']=function(_0x3a9a42,_0x5ad64e,_0x56cd07){var _0x1ed746;return db['VoiceContext']['find']({'where':{'id':_0x3a9a42[_0xc52e('0x62')]['id']}})[_0xc52e('0x14')](handleEntityNotFound(_0x5ad64e,null))[_0xc52e('0x14')](removeEntity(_0x5ad64e,null))[_0xc52e('0x14')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0xc52e('0x14')](function(_0xf73e5b){var _0x2f9750=fs[_0xc52e('0x54')](path[_0xc52e('0x55')](config['root'],_0xc52e('0x63')),_0xc52e('0x57'));var _0x41c05b=ejs[_0xc52e('0x58')](_0x2f9750,{'contexts':_0xf73e5b});fs[_0xc52e('0x64')](_0xc52e('0x59'),_0x41c05b);return respondWithRpcPromise(_0xc52e('0x5a'),_0xc52e('0x2b'),{'module':_0xc52e('0x5b')});})[_0xc52e('0x51')](handleError(_0x5ad64e,null));}; \ No newline at end of file +var _0x4d1f=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','VoiceContext','includeAll','include','findAll','rows','show','params','create','join','root','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','readFileSync','server/files/templates/context.ejs','Reload','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','then','get','UserProfileResource','destroy','name','send','render','body','contact','agent','interaction','account','map','rawAttributes','fieldName'];(function(_0x308374,_0x550e85){var _0x1f71e0=function(_0x18377d){while(--_0x18377d){_0x308374['push'](_0x308374['shift']());}};_0x1f71e0(++_0x550e85);}(_0x4d1f,0x16b));var _0xf4d1=function(_0x3a46be,_0x2c0e3e){_0x3a46be=_0x3a46be-0x0;var _0x401e3e=_0x4d1f[_0x3a46be];return _0x401e3e;};'use strict';var emlformat=require(_0xf4d1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf4d1('0x1'));var jsonpatch=require(_0xf4d1('0x2'));var rp=require('request-promise');var moment=require(_0xf4d1('0x3'));var BPromise=require(_0xf4d1('0x4'));var Mustache=require(_0xf4d1('0x5'));var util=require(_0xf4d1('0x6'));var path=require(_0xf4d1('0x7'));var sox=require(_0xf4d1('0x8'));var csv=require(_0xf4d1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf4d1('0xa'));var _=require(_0xf4d1('0xb'));var squel=require(_0xf4d1('0xc'));var crypto=require(_0xf4d1('0xd'));var jsforce=require(_0xf4d1('0xe'));var deskjs=require(_0xf4d1('0xf'));var toCsv=require(_0xf4d1('0x9'));var querystring=require(_0xf4d1('0x10'));var Papa=require(_0xf4d1('0x11'));var Redis=require(_0xf4d1('0x12'));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('../../config/logger')(_0xf4d1('0x13'));var utils=require(_0xf4d1('0x14'));var config=require(_0xf4d1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf4d1('0x16'))['db'];var jayson=require(_0xf4d1('0x17'));var client=jayson[_0xf4d1('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16db18,_0x33a7e2,_0x129114,_0x343c6e){return new BPromise(function(_0x2bcc53,_0x3cf337){var _0x21582a=_0x343c6e||client;return _0x21582a[_0xf4d1('0x19')](_0x16db18,_0x129114)['then'](function(_0x2aa0b7){logger[_0xf4d1('0x1a')](_0xf4d1('0x1b'),_0x33a7e2,_0xf4d1('0x1c'));logger['debug'](_0xf4d1('0x1d'),_0x33a7e2,_0xf4d1('0x1c'),JSON[_0xf4d1('0x1e')](_0x2aa0b7));if(_0x2aa0b7[_0xf4d1('0x1f')]){if(_0x2aa0b7[_0xf4d1('0x1f')][_0xf4d1('0x20')]===0x1f4){logger[_0xf4d1('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x33a7e2,_0x2aa0b7[_0xf4d1('0x1f')][_0xf4d1('0x21')]);return _0x3cf337(_0x2aa0b7[_0xf4d1('0x1f')][_0xf4d1('0x21')]);}logger[_0xf4d1('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x33a7e2,_0x2aa0b7[_0xf4d1('0x1f')][_0xf4d1('0x21')]);return _0x2bcc53(_0x2aa0b7[_0xf4d1('0x1f')][_0xf4d1('0x21')]);}else{logger[_0xf4d1('0x1a')](_0xf4d1('0x1b'),_0x33a7e2,_0xf4d1('0x1c'));_0x2bcc53(_0x2aa0b7[_0xf4d1('0x22')][_0xf4d1('0x21')]);}})[_0xf4d1('0x23')](function(_0x489b55){logger[_0xf4d1('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x33a7e2,_0x489b55);_0x3cf337(_0x489b55);});});}function respondWithStatusCode(_0x3802e0,_0x3c60a0){_0x3c60a0=_0x3c60a0||0xcc;return function(_0x194dc4){if(_0x194dc4){return _0x3802e0[_0xf4d1('0x24')](_0x3c60a0);}return _0x3802e0[_0xf4d1('0x25')](_0x3c60a0)[_0xf4d1('0x26')]();};}function respondWithResult(_0x1d776b,_0x5eb36b){_0x5eb36b=_0x5eb36b||0xc8;return function(_0x4ea82f){if(_0x4ea82f){return _0x1d776b[_0xf4d1('0x25')](_0x5eb36b)['json'](_0x4ea82f);}};}function respondWithFilteredResult(_0x2fe994,_0x2ce8e8){return function(_0x4e01db){if(_0x4e01db){var _0x345393=typeof _0x2ce8e8[_0xf4d1('0x27')]===_0xf4d1('0x28')&&typeof _0x2ce8e8[_0xf4d1('0x29')]===_0xf4d1('0x28');var _0x82ffff=_0x4e01db['count'];var _0x1f341d=_0x345393?0x0:_0x2ce8e8[_0xf4d1('0x27')];var _0x1816b7=_0x345393?_0x4e01db[_0xf4d1('0x2a')]:_0x2ce8e8[_0xf4d1('0x27')]+_0x2ce8e8[_0xf4d1('0x29')];var _0x228921;if(_0x1816b7>=_0x82ffff){_0x1816b7=_0x82ffff;_0x228921=0xc8;}else{_0x228921=0xce;}_0x2fe994[_0xf4d1('0x25')](_0x228921);return _0x2fe994[_0xf4d1('0x2b')](_0xf4d1('0x2c'),_0x1f341d+'-'+_0x1816b7+'/'+_0x82ffff)['json'](_0x4e01db);}return null;};}function patchUpdates(_0x2802ba){return function(_0x1663e7){try{jsonpatch['apply'](_0x1663e7,_0x2802ba,!![]);}catch(_0x5e7e94){return BPromise[_0xf4d1('0x2d')](_0x5e7e94);}return _0x1663e7['save']();};}function saveUpdates(_0x125514,_0x46291d){return function(_0x455cf6){if(_0x455cf6){return _0x455cf6['update'](_0x125514)[_0xf4d1('0x2e')](function(_0x34c5f4){return _0x34c5f4;});}return null;};}function removeEntity(_0x27a357,_0x59cc7a){return function(_0x3c8a3d){if(_0x3c8a3d){return _0x3c8a3d['destroy']()['then'](function(){var _0x304d5e=_0x3c8a3d[_0xf4d1('0x2f')]({'plain':!![]});var _0x1366ab='Contexts';return db[_0xf4d1('0x30')][_0xf4d1('0x31')]({'where':{'type':_0x1366ab,'resourceId':_0x304d5e['id']}})[_0xf4d1('0x2e')](function(){return _0x3c8a3d;});})[_0xf4d1('0x2e')](function(){_0x27a357[_0xf4d1('0x25')](0xcc)[_0xf4d1('0x26')]();});}};}function handleEntityNotFound(_0x1bb0a8,_0x3fc081){return function(_0x1ca678){if(!_0x1ca678){_0x1bb0a8[_0xf4d1('0x24')](0x194);}return _0x1ca678;};}function handleError(_0x13fb7b,_0x5ba7e6){_0x5ba7e6=_0x5ba7e6||0x1f4;return function(_0xe34e65){logger[_0xf4d1('0x1f')](_0xe34e65['stack']);if(_0xe34e65[_0xf4d1('0x32')]){delete _0xe34e65[_0xf4d1('0x32')];}_0x13fb7b[_0xf4d1('0x25')](_0x5ba7e6)[_0xf4d1('0x33')](_0xe34e65);};}function getMustacheRender(_0x363e4b,_0x12c9d1){return Mustache[_0xf4d1('0x34')](_0x363e4b,_['merge'](_0x12c9d1[_0xf4d1('0x35')],{'contact':_0x12c9d1[_0xf4d1('0x36')],'message':_0x12c9d1[_0xf4d1('0x21')],'agent':_0x12c9d1[_0xf4d1('0x37')],'interaction':_0x12c9d1[_0xf4d1('0x38')],'account':_0x12c9d1[_0xf4d1('0x39')]}))||'';}exports['index']=function(_0x5472e9,_0x1cdbac){var _0x4f3c92={},_0x16804b={},_0x26c264={'count':0x0,'rows':[]};var _0x1ef646=_[_0xf4d1('0x3a')](db['VoiceContext'][_0xf4d1('0x3b')],function(_0x41965e){return{'name':_0x41965e[_0xf4d1('0x3c')],'type':_0x41965e[_0xf4d1('0x3d')][_0xf4d1('0x3e')]};});_0x16804b[_0xf4d1('0x3f')]=_[_0xf4d1('0x3a')](_0x1ef646,_0xf4d1('0x32'));_0x16804b[_0xf4d1('0x40')]=_[_0xf4d1('0x41')](_0x5472e9[_0xf4d1('0x40')]);_0x16804b[_0xf4d1('0x42')]=_[_0xf4d1('0x43')](_0x16804b[_0xf4d1('0x3f')],_0x16804b[_0xf4d1('0x40')]);_0x4f3c92[_0xf4d1('0x44')]=_[_0xf4d1('0x43')](_0x16804b[_0xf4d1('0x3f')],qs[_0xf4d1('0x45')](_0x5472e9[_0xf4d1('0x40')][_0xf4d1('0x45')]));_0x4f3c92[_0xf4d1('0x44')]=_0x4f3c92[_0xf4d1('0x44')][_0xf4d1('0x46')]?_0x4f3c92['attributes']:_0x16804b[_0xf4d1('0x3f')];if(!_0x5472e9[_0xf4d1('0x40')][_0xf4d1('0x47')]('nolimit')){_0x4f3c92[_0xf4d1('0x29')]=qs['limit'](_0x5472e9[_0xf4d1('0x40')][_0xf4d1('0x29')]);_0x4f3c92[_0xf4d1('0x27')]=qs['offset'](_0x5472e9[_0xf4d1('0x40')][_0xf4d1('0x27')]);}_0x4f3c92['order']=qs[_0xf4d1('0x48')](_0x5472e9[_0xf4d1('0x40')][_0xf4d1('0x48')]);_0x4f3c92[_0xf4d1('0x49')]=qs[_0xf4d1('0x42')](_[_0xf4d1('0x4a')](_0x5472e9['query'],_0x16804b['filters']),_0x1ef646);if(_0x5472e9['query'][_0xf4d1('0x4b')]){_0x4f3c92[_0xf4d1('0x49')]=_[_0xf4d1('0x4c')](_0x4f3c92[_0xf4d1('0x49')],{'$or':_['map'](_0x1ef646,function(_0x5ace78){if(_0x5ace78[_0xf4d1('0x3d')]!==_0xf4d1('0x4d')){var _0x5e04a9={};_0x5e04a9[_0x5ace78['name']]={'$like':'%'+_0x5472e9[_0xf4d1('0x40')][_0xf4d1('0x4b')]+'%'};return _0x5e04a9;}})});}_0x4f3c92=_['merge']({},_0x4f3c92,_0x5472e9[_0xf4d1('0x4e')]);var _0x39d8fc={'where':_0x4f3c92[_0xf4d1('0x49')]};return db[_0xf4d1('0x4f')]['count'](_0x39d8fc)[_0xf4d1('0x2e')](function(_0x5c75df){_0x26c264[_0xf4d1('0x2a')]=_0x5c75df;if(_0x5472e9[_0xf4d1('0x40')][_0xf4d1('0x50')]){_0x4f3c92[_0xf4d1('0x51')]=[{'all':!![]}];}return db[_0xf4d1('0x4f')][_0xf4d1('0x52')](_0x4f3c92);})[_0xf4d1('0x2e')](function(_0x1b7f73){_0x26c264[_0xf4d1('0x53')]=_0x1b7f73;return _0x26c264;})[_0xf4d1('0x2e')](respondWithFilteredResult(_0x1cdbac,_0x4f3c92))[_0xf4d1('0x23')](handleError(_0x1cdbac,null));};exports[_0xf4d1('0x54')]=function(_0x3c0c24,_0x2563d6){var _0x1ada29={'raw':![],'where':{'id':_0x3c0c24[_0xf4d1('0x55')]['id']}},_0x5cac66={};_0x5cac66[_0xf4d1('0x3f')]=_[_0xf4d1('0x41')](db[_0xf4d1('0x4f')][_0xf4d1('0x3b')]);_0x5cac66[_0xf4d1('0x40')]=_[_0xf4d1('0x41')](_0x3c0c24['query']);_0x5cac66[_0xf4d1('0x42')]=_[_0xf4d1('0x43')](_0x5cac66['model'],_0x5cac66[_0xf4d1('0x40')]);_0x1ada29[_0xf4d1('0x44')]=_['intersection'](_0x5cac66[_0xf4d1('0x3f')],qs[_0xf4d1('0x45')](_0x3c0c24['query']['fields']));_0x1ada29['attributes']=_0x1ada29[_0xf4d1('0x44')][_0xf4d1('0x46')]?_0x1ada29['attributes']:_0x5cac66['model'];if(_0x3c0c24['query'][_0xf4d1('0x50')]){_0x1ada29[_0xf4d1('0x51')]=[{'all':!![]}];}_0x1ada29=_[_0xf4d1('0x4c')]({},_0x1ada29,_0x3c0c24[_0xf4d1('0x4e')]);return db[_0xf4d1('0x4f')]['find'](_0x1ada29)[_0xf4d1('0x2e')](handleEntityNotFound(_0x2563d6,null))[_0xf4d1('0x2e')](respondWithResult(_0x2563d6,null))[_0xf4d1('0x23')](handleError(_0x2563d6,null));};exports[_0xf4d1('0x56')]=function(_0x2b4bb8,_0x5bda57,_0x196064){var _0x259c97;return db[_0xf4d1('0x4f')][_0xf4d1('0x56')](_0x2b4bb8[_0xf4d1('0x35')],{'raw':!![]})[_0xf4d1('0x2e')](function(_0x36ed2e){_0x259c97=_0x36ed2e;return db[_0xf4d1('0x4f')][_0xf4d1('0x52')]({'raw':!![]});})[_0xf4d1('0x2e')](function(_0xc7bb88){var _0x331452=fs['readFileSync'](path[_0xf4d1('0x57')](config[_0xf4d1('0x58')],'server/files/templates/context.ejs'),_0xf4d1('0x59'));var _0x5d7539=ejs['render'](_0x331452,{'contexts':_0xc7bb88||[]});fs[_0xf4d1('0x5a')](_0xf4d1('0x5b'),_0x5d7539);})[_0xf4d1('0x2e')](function(){return respondWithRpcPromise('Reload',_0xf4d1('0x56'),{'module':_0xf4d1('0x5c')});})[_0xf4d1('0x2e')](function(){var _0x2d65a7=_0x2b4bb8['user'][_0xf4d1('0x2f')]({'plain':!![]});if(!_0x2d65a7)throw new Error(_0xf4d1('0x5d'));if(_0x2d65a7[_0xf4d1('0x5e')]===_0xf4d1('0x5f')){var _0x15877c=_0x259c97[_0xf4d1('0x2f')]({'plain':!![]});return db[_0xf4d1('0x60')]['find']({'where':{'name':_0xf4d1('0x61'),'userProfileId':_0x2d65a7[_0xf4d1('0x62')]},'raw':!![]})['then'](function(_0x4cb1af){if(_0x4cb1af&&_0x4cb1af[_0xf4d1('0x63')]===0x0){return db[_0xf4d1('0x30')]['create']({'name':_0x15877c['name'],'resourceId':_0x15877c['id'],'type':_0x4cb1af[_0xf4d1('0x32')],'sectionId':_0x4cb1af['id']},{})[_0xf4d1('0x2e')](function(){return _0x259c97;});}else{return _0x259c97;}})['catch'](function(_0x23fe37){logger[_0xf4d1('0x1f')](_0xf4d1('0x64'),_0x23fe37);throw _0x23fe37;});}return _0x259c97;})[_0xf4d1('0x2e')](respondWithResult(_0x5bda57,0xc9))[_0xf4d1('0x23')](handleError(_0x5bda57,null));};exports[_0xf4d1('0x65')]=function(_0x1dbdea,_0x749ad2,_0x4f2098){var _0x42b404;return db[_0xf4d1('0x4f')][_0xf4d1('0x66')]({'where':{'id':_0x1dbdea[_0xf4d1('0x55')]['id']}})['then'](handleEntityNotFound(_0x749ad2,null))[_0xf4d1('0x2e')](saveUpdates(_0x1dbdea[_0xf4d1('0x35')],null))[_0xf4d1('0x2e')](function(_0x5658ef){if(_0x5658ef){_0x42b404=_0x5658ef;return db[_0xf4d1('0x4f')][_0xf4d1('0x52')]({'raw':!![]});}})[_0xf4d1('0x2e')](function(_0x36a88b){var _0x46fe9a=fs[_0xf4d1('0x67')](path[_0xf4d1('0x57')](config[_0xf4d1('0x58')],_0xf4d1('0x68')),_0xf4d1('0x59'));var _0x2eeae6=ejs[_0xf4d1('0x34')](_0x46fe9a,{'contexts':_0x36a88b||[]});fs['writeFileSync'](_0xf4d1('0x5b'),_0x2eeae6);})[_0xf4d1('0x2e')](function(){return respondWithRpcPromise(_0xf4d1('0x69'),_0xf4d1('0x65'),{'module':_0xf4d1('0x5c')});})[_0xf4d1('0x2e')](function(){return _0x42b404;})[_0xf4d1('0x2e')](respondWithResult(_0x749ad2,null))[_0xf4d1('0x23')](handleError(_0x749ad2,null));};exports[_0xf4d1('0x31')]=function(_0xe8148e,_0x4990d4,_0x20bbd0){var _0x6aff00;return db[_0xf4d1('0x4f')][_0xf4d1('0x66')]({'where':{'id':_0xe8148e[_0xf4d1('0x55')]['id']}})[_0xf4d1('0x2e')](handleEntityNotFound(_0x4990d4,null))[_0xf4d1('0x2e')](removeEntity(_0x4990d4,null))[_0xf4d1('0x2e')](function(){return db[_0xf4d1('0x4f')][_0xf4d1('0x52')]({'raw':!![]});})[_0xf4d1('0x2e')](function(_0xe8ec90){var _0xb8a694=fs[_0xf4d1('0x67')](path[_0xf4d1('0x57')](config[_0xf4d1('0x58')],_0xf4d1('0x68')),_0xf4d1('0x59'));var _0x5dfe29=ejs[_0xf4d1('0x34')](_0xb8a694,{'contexts':_0xe8ec90});fs[_0xf4d1('0x5a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5dfe29);return respondWithRpcPromise(_0xf4d1('0x69'),_0xf4d1('0x31'),{'module':_0xf4d1('0x5c')});})[_0xf4d1('0x23')](handleError(_0x4990d4,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index a85454e..d299cc1 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 _0x5cc4=['../../config/environment','exports','voice_contexts','lodash','util','moment','bluebird','rimraf'];(function(_0x597b7a,_0x207cd7){var _0x24cedd=function(_0x1a0149){while(--_0x1a0149){_0x597b7a['push'](_0x597b7a['shift']());}};_0x24cedd(++_0x207cd7);}(_0x5cc4,0x173));var _0x45cc=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0x5cc4[_0x10dbf6];return _0x452147;};'use strict';var _=require(_0x45cc('0x0'));var util=require(_0x45cc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x45cc('0x2'));var BPromise=require(_0x45cc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x45cc('0x4'));var config=require(_0x45cc('0x5'));var attributes=require('./voiceContext.attributes');module[_0x45cc('0x6')]=function(_0x3ffab0,_0x503926){return _0x3ffab0['define']('VoiceContext',attributes,{'tableName':_0x45cc('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fb=['voice_contexts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceContext.attributes','exports','VoiceContext'];(function(_0x31df18,_0xd1f6c5){var _0x527798=function(_0x18adb7){while(--_0x18adb7){_0x31df18['push'](_0x31df18['shift']());}};_0x527798(++_0xd1f6c5);}(_0xd8fb,0x121));var _0xbd8f=function(_0x5aa72a,_0x48c3bf){_0x5aa72a=_0x5aa72a-0x0;var _0x15663f=_0xd8fb[_0x5aa72a];return _0x15663f;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))('api');var moment=require(_0xbd8f('0x3'));var BPromise=require(_0xbd8f('0x4'));var rp=require(_0xbd8f('0x5'));var fs=require('fs');var path=require(_0xbd8f('0x6'));var rimraf=require('rimraf');var config=require(_0xbd8f('0x7'));var attributes=require(_0xbd8f('0x8'));module[_0xbd8f('0x9')]=function(_0x2f4fe0,_0x588b11){return _0x2f4fe0['define'](_0xbd8f('0xa'),attributes,{'tableName':_0xbd8f('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 3bc4e0c..fee2f75 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 _0xccec=['request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','VoiceContext,\x20%s,\x20%s'];(function(_0x178724,_0x572cf9){var _0x17ac1b=function(_0x79c876){while(--_0x79c876){_0x178724['push'](_0x178724['shift']());}};_0x17ac1b(++_0x572cf9);}(_0xccec,0x1d5));var _0xccce=function(_0xf13ca6,_0x5735ea){_0xf13ca6=_0xf13ca6-0x0;var _0x4a4387=_0xccec[_0xf13ca6];return _0x4a4387;};'use strict';var _=require(_0xccce('0x0'));var util=require(_0xccce('0x1'));var moment=require(_0xccce('0x2'));var BPromise=require('bluebird');var rs=require(_0xccce('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xccce('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xccce('0x5'))('rpc');var config=require(_0xccce('0x6'));var jayson=require(_0xccce('0x7'));var client=jayson['client'][_0xccce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e7e5d,_0x480d40,_0x483215){return new BPromise(function(_0xfef614,_0x297430){return client['request'](_0x5e7e5d,_0x483215)[_0xccce('0x9')](function(_0x4f8a5e){logger['info'](_0xccce('0xa'),_0x480d40,_0xccce('0xb'));logger[_0xccce('0xc')](_0xccce('0xd'),_0x480d40,'request\x20sent',JSON[_0xccce('0xe')](_0x4f8a5e));if(_0x4f8a5e[_0xccce('0xf')]){if(_0x4f8a5e[_0xccce('0xf')][_0xccce('0x10')]===0x1f4){logger[_0xccce('0xf')]('VoiceContext,\x20%s,\x20%s',_0x480d40,_0x4f8a5e[_0xccce('0xf')]['message']);return _0x297430(_0x4f8a5e[_0xccce('0xf')][_0xccce('0x11')]);}logger[_0xccce('0xf')](_0xccce('0xa'),_0x480d40,_0x4f8a5e[_0xccce('0xf')][_0xccce('0x11')]);return _0xfef614(_0x4f8a5e[_0xccce('0xf')][_0xccce('0x11')]);}else{logger['info'](_0xccce('0xa'),_0x480d40,_0xccce('0xb'));_0xfef614(_0x4f8a5e[_0xccce('0x12')][_0xccce('0x11')]);}})[_0xccce('0x13')](function(_0x10d1eb){logger['error'](_0xccce('0xa'),_0x480d40,_0x10d1eb);_0x297430(_0x10d1eb);});});} \ No newline at end of file +var _0x9f7e=['client','http','then','info','request\x20sent','debug','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xf7c208,_0x5cbc84){var _0x16992d=function(_0x2fe157){while(--_0x2fe157){_0xf7c208['push'](_0xf7c208['shift']());}};_0x16992d(++_0x5cbc84);}(_0x9f7e,0x156));var _0xe9f7=function(_0x493af3,_0x1c8111){_0x493af3=_0x493af3-0x0;var _0x408c30=_0x9f7e[_0x493af3];return _0x408c30;};'use strict';var _=require('lodash');var util=require(_0xe9f7('0x0'));var moment=require(_0xe9f7('0x1'));var BPromise=require('bluebird');var rs=require(_0xe9f7('0x2'));var fs=require('fs');var Redis=require(_0xe9f7('0x3'));var db=require(_0xe9f7('0x4'))['db'];var utils=require(_0xe9f7('0x5'));var logger=require(_0xe9f7('0x6'))(_0xe9f7('0x7'));var config=require(_0xe9f7('0x8'));var jayson=require(_0xe9f7('0x9'));var client=jayson[_0xe9f7('0xa')][_0xe9f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x233a6f,_0x4370c0,_0x324d73){return new BPromise(function(_0x3e18fa,_0x1a8782){return client['request'](_0x233a6f,_0x324d73)[_0xe9f7('0xc')](function(_0x3cb027){logger[_0xe9f7('0xd')]('VoiceContext,\x20%s,\x20%s',_0x4370c0,_0xe9f7('0xe'));logger[_0xe9f7('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4370c0,_0xe9f7('0xe'),JSON[_0xe9f7('0x10')](_0x3cb027));if(_0x3cb027[_0xe9f7('0x11')]){if(_0x3cb027[_0xe9f7('0x11')][_0xe9f7('0x12')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x4370c0,_0x3cb027[_0xe9f7('0x11')][_0xe9f7('0x13')]);return _0x1a8782(_0x3cb027['error'][_0xe9f7('0x13')]);}logger[_0xe9f7('0x11')]('VoiceContext,\x20%s,\x20%s',_0x4370c0,_0x3cb027[_0xe9f7('0x11')][_0xe9f7('0x13')]);return _0x3e18fa(_0x3cb027[_0xe9f7('0x11')]['message']);}else{logger[_0xe9f7('0xd')](_0xe9f7('0x14'),_0x4370c0,_0xe9f7('0xe'));_0x3e18fa(_0x3cb027['result']['message']);}})[_0xe9f7('0x15')](function(_0xa55902){logger[_0xe9f7('0x11')](_0xe9f7('0x14'),_0x4370c0,_0xa55902);_0x1a8782(_0xa55902);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 2e8f45a..e9cc20a 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 _0x984b=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','get','show','post','create','put','/:id','update','delete','exports'];(function(_0x5ca2be,_0xbb27e8){var _0x612eea=function(_0x2fbdda){while(--_0x2fbdda){_0x5ca2be['push'](_0x5ca2be['shift']());}};_0x612eea(++_0xbb27e8);}(_0x984b,0xee));var _0xb984=function(_0x3227f4,_0x58e9dd){_0x3227f4=_0x3227f4-0x0;var _0x42dba6=_0x984b[_0x3227f4];return _0x42dba6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb984('0x0'));var express=require(_0xb984('0x1'));var router=express[_0xb984('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb984('0x3'));var config=require(_0xb984('0x4'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0xb984('0x5')](),controller[_0xb984('0x6')]);router['get'](_0xb984('0x7'),auth[_0xb984('0x5')](),controller['describe']);router[_0xb984('0x8')]('/:id',auth[_0xb984('0x5')](),controller[_0xb984('0x9')]);router[_0xb984('0xa')]('/',auth[_0xb984('0x5')](),controller[_0xb984('0xb')]);router[_0xb984('0xc')](_0xb984('0xd'),auth[_0xb984('0x5')](),controller[_0xb984('0xe')]);router[_0xb984('0xf')](_0xb984('0xd'),auth[_0xb984('0x5')](),controller['destroy']);module[_0xb984('0x10')]=router; \ No newline at end of file +var _0x22fb=['./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1e3d0d,_0x1d38ec){var _0x289bc6=function(_0x31cecd){while(--_0x31cecd){_0x1e3d0d['push'](_0x1e3d0d['shift']());}};_0x289bc6(++_0x1d38ec);}(_0x22fb,0x192));var _0xb22f=function(_0x52acf5,_0x37ef26){_0x52acf5=_0x52acf5-0x0;var _0x3f619b=_0x22fb[_0x52acf5];return _0x3f619b;};'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 diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 9bc2426..219c166 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 _0xf817=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x1c9a9a,_0x30a12f){var _0xca3172=function(_0x1d005d){while(--_0x1d005d){_0x1c9a9a['push'](_0x1c9a9a['shift']());}};_0xca3172(++_0x30a12f);}(_0xf817,0x198));var _0x7f81=function(_0x36294c,_0x57eb3d){_0x36294c=_0x36294c-0x0;var _0x3f9b20=_0xf817[_0x36294c];return _0x3f9b20;};'use strict';var Sequelize=require(_0x7f81('0x0'));module[_0x7f81('0x1')]={'privilege':{'type':Sequelize[_0x7f81('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x7f81('0x3')]},'channelstatedesc':{'type':Sequelize[_0x7f81('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x7f81('0x2')]},'connectedlinename':{'type':Sequelize[_0x7f81('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7f81('0x2')]},'context':{'type':Sequelize[_0x7f81('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7f81('0x3')]},'uniqueid':{'type':Sequelize[_0x7f81('0x2')]},'linkedid':{'type':Sequelize[_0x7f81('0x2')]},'destchannel':{'type':Sequelize[_0x7f81('0x2')]},'destchannelstate':{'type':Sequelize[_0x7f81('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x7f81('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7f81('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x7f81('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x7f81('0x2')]},'destexten':{'type':Sequelize[_0x7f81('0x2')]},'destpriority':{'type':Sequelize[_0x7f81('0x3')]},'destuniqueid':{'type':Sequelize[_0x7f81('0x2')]},'destlinkedid':{'type':Sequelize[_0x7f81('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x7f81('0x2')]},'starttime':{'type':Sequelize[_0x7f81('0x4')]},'answertime':{'type':Sequelize[_0x7f81('0x4')]},'endtime':{'type':Sequelize[_0x7f81('0x4')]},'lastevent':{'type':Sequelize[_0x7f81('0x2')],'comment':_0x7f81('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x7f81('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x7f81('0x3')]}}; \ No newline at end of file +var _0xcf6b=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x30bbb3,_0x2826a1){var _0x507d27=function(_0x2a5b50){while(--_0x2a5b50){_0x30bbb3['push'](_0x30bbb3['shift']());}};_0x507d27(++_0x2826a1);}(_0xcf6b,0x1d5));var _0xbcf6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcf6b[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xbcf6('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xbcf6('0x1')]},'channel':{'type':Sequelize[_0xbcf6('0x1')]},'channelstate':{'type':Sequelize[_0xbcf6('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xbcf6('0x1')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xbcf6('0x1')]},'connectedlinename':{'type':Sequelize[_0xbcf6('0x1')]},'language':{'type':Sequelize[_0xbcf6('0x1')]},'accountcode':{'type':Sequelize[_0xbcf6('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xbcf6('0x1')]},'priority':{'type':Sequelize[_0xbcf6('0x2')]},'uniqueid':{'type':Sequelize[_0xbcf6('0x1')]},'linkedid':{'type':Sequelize[_0xbcf6('0x1')]},'destchannel':{'type':Sequelize[_0xbcf6('0x1')]},'destchannelstate':{'type':Sequelize[_0xbcf6('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xbcf6('0x1')]},'destcalleridnum':{'type':Sequelize[_0xbcf6('0x1')]},'destcalleridname':{'type':Sequelize[_0xbcf6('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xbcf6('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xbcf6('0x1')]},'destexten':{'type':Sequelize[_0xbcf6('0x1')]},'destpriority':{'type':Sequelize[_0xbcf6('0x2')]},'destuniqueid':{'type':Sequelize[_0xbcf6('0x1')]},'destlinkedid':{'type':Sequelize[_0xbcf6('0x1')]},'dialstring':{'type':Sequelize[_0xbcf6('0x1')]},'dialstatus':{'type':Sequelize[_0xbcf6('0x1')]},'starttime':{'type':Sequelize[_0xbcf6('0x3')]},'answertime':{'type':Sequelize[_0xbcf6('0x3')]},'endtime':{'type':Sequelize[_0xbcf6('0x3')]},'lastevent':{'type':Sequelize[_0xbcf6('0x1')],'comment':_0xbcf6('0x4')},'routeId':{'type':Sequelize[_0xbcf6('0x2')]},'duration':{'type':Sequelize[_0xbcf6('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xbcf6('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 3fd1da8..7b1ea70 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 _0x92d3=['hasOwnProperty','nolimit','order','pick','filters','filter','where','type','VIRTUAL','options','VoiceDialReport','includeAll','findAll','rows','catch','params','intersection','include','find','create','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','fieldName','model','map','query','keys','attributes','fields','length'];(function(_0x4ca7a0,_0xfae7c3){var _0x3a67a6=function(_0x3eda62){while(--_0x3eda62){_0x4ca7a0['push'](_0x4ca7a0['shift']());}};_0x3a67a6(++_0xfae7c3);}(_0x92d3,0x109));var _0x392d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x92d3[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x392d('0x0'));var rimraf=require(_0x392d('0x1'));var zipdir=require(_0x392d('0x2'));var jsonpatch=require(_0x392d('0x3'));var rp=require(_0x392d('0x4'));var moment=require(_0x392d('0x5'));var BPromise=require(_0x392d('0x6'));var Mustache=require(_0x392d('0x7'));var util=require('util');var path=require(_0x392d('0x8'));var sox=require(_0x392d('0x9'));var csv=require(_0x392d('0xa'));var ejs=require(_0x392d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x392d('0xc'));var crypto=require(_0x392d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x392d('0xe'));var toCsv=require(_0x392d('0xa'));var querystring=require('querystring');var Papa=require(_0x392d('0xf'));var Redis=require(_0x392d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x392d('0x11'));var hardwareService=require(_0x392d('0x12'));var logger=require(_0x392d('0x13'))(_0x392d('0x14'));var utils=require(_0x392d('0x15'));var config=require(_0x392d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x392d('0x17'))['db'];function respondWithStatusCode(_0x3c6900,_0x1f2b59){_0x1f2b59=_0x1f2b59||0xcc;return function(_0x1fba4d){if(_0x1fba4d){return _0x3c6900[_0x392d('0x18')](_0x1f2b59);}return _0x3c6900[_0x392d('0x19')](_0x1f2b59)[_0x392d('0x1a')]();};}function respondWithResult(_0x4f4244,_0x3525b1){_0x3525b1=_0x3525b1||0xc8;return function(_0x350840){if(_0x350840){return _0x4f4244[_0x392d('0x19')](_0x3525b1)['json'](_0x350840);}};}function respondWithFilteredResult(_0x250eb0,_0x38a8cc){return function(_0x45cfdd){if(_0x45cfdd){var _0x50bc31=typeof _0x38a8cc['offset']===_0x392d('0x1b')&&typeof _0x38a8cc[_0x392d('0x1c')]===_0x392d('0x1b');var _0x31d005=_0x45cfdd[_0x392d('0x1d')];var _0xaffe70=_0x50bc31?0x0:_0x38a8cc[_0x392d('0x1e')];var _0xd1cedb=_0x50bc31?_0x45cfdd['count']:_0x38a8cc[_0x392d('0x1e')]+_0x38a8cc[_0x392d('0x1c')];var _0x3ee14a;if(_0xd1cedb>=_0x31d005){_0xd1cedb=_0x31d005;_0x3ee14a=0xc8;}else{_0x3ee14a=0xce;}_0x250eb0[_0x392d('0x19')](_0x3ee14a);return _0x250eb0[_0x392d('0x1f')](_0x392d('0x20'),_0xaffe70+'-'+_0xd1cedb+'/'+_0x31d005)[_0x392d('0x21')](_0x45cfdd);}return null;};}function patchUpdates(_0x24caba){return function(_0x59a145){try{jsonpatch[_0x392d('0x22')](_0x59a145,_0x24caba,!![]);}catch(_0x4d7594){return BPromise[_0x392d('0x23')](_0x4d7594);}return _0x59a145[_0x392d('0x24')]();};}function saveUpdates(_0x36175e,_0x3ef9ff){return function(_0x733fcc){if(_0x733fcc){return _0x733fcc['update'](_0x36175e)[_0x392d('0x25')](function(_0xd22434){return _0xd22434;});}return null;};}function removeEntity(_0x29223f,_0x2b3aa4){return function(_0x1c50c6){if(_0x1c50c6){return _0x1c50c6[_0x392d('0x26')]()['then'](function(){_0x29223f[_0x392d('0x19')](0xcc)[_0x392d('0x1a')]();});}};}function handleEntityNotFound(_0x3b8369,_0x354747){return function(_0x37511e){if(!_0x37511e){_0x3b8369[_0x392d('0x18')](0x194);}return _0x37511e;};}function handleError(_0x27f614,_0xda10b1){_0xda10b1=_0xda10b1||0x1f4;return function(_0x41cd95){logger[_0x392d('0x27')](_0x41cd95[_0x392d('0x28')]);if(_0x41cd95[_0x392d('0x29')]){delete _0x41cd95[_0x392d('0x29')];}_0x27f614['status'](_0xda10b1)[_0x392d('0x2a')](_0x41cd95);};}function getMustacheRender(_0xfd062f,_0x11e3b8){return Mustache[_0x392d('0x2b')](_0xfd062f,_[_0x392d('0x2c')](_0x11e3b8[_0x392d('0x2d')],{'contact':_0x11e3b8[_0x392d('0x2e')],'message':_0x11e3b8[_0x392d('0x2f')],'agent':_0x11e3b8[_0x392d('0x30')],'interaction':_0x11e3b8[_0x392d('0x31')],'account':_0x11e3b8[_0x392d('0x32')]}))||'';}exports['index']=function(_0x466d3e,_0x332545){var _0x2168c3={},_0xbc6b41={},_0x17cf14={'count':0x0,'rows':[]};var _0x149874=_['map'](db['VoiceDialReport']['rawAttributes'],function(_0x223305){return{'name':_0x223305[_0x392d('0x33')],'type':_0x223305['type']['key']};});_0xbc6b41[_0x392d('0x34')]=_[_0x392d('0x35')](_0x149874,_0x392d('0x29'));_0xbc6b41[_0x392d('0x36')]=_[_0x392d('0x37')](_0x466d3e[_0x392d('0x36')]);_0xbc6b41['filters']=_['intersection'](_0xbc6b41['model'],_0xbc6b41[_0x392d('0x36')]);_0x2168c3[_0x392d('0x38')]=_['intersection'](_0xbc6b41[_0x392d('0x34')],qs[_0x392d('0x39')](_0x466d3e['query'][_0x392d('0x39')]));_0x2168c3['attributes']=_0x2168c3[_0x392d('0x38')][_0x392d('0x3a')]?_0x2168c3[_0x392d('0x38')]:_0xbc6b41[_0x392d('0x34')];if(!_0x466d3e[_0x392d('0x36')][_0x392d('0x3b')](_0x392d('0x3c'))){_0x2168c3[_0x392d('0x1c')]=qs[_0x392d('0x1c')](_0x466d3e['query'][_0x392d('0x1c')]);_0x2168c3['offset']=qs[_0x392d('0x1e')](_0x466d3e['query'][_0x392d('0x1e')]);}_0x2168c3[_0x392d('0x3d')]=qs['sort'](_0x466d3e[_0x392d('0x36')]['sort']);_0x2168c3['where']=qs['filters'](_[_0x392d('0x3e')](_0x466d3e[_0x392d('0x36')],_0xbc6b41[_0x392d('0x3f')]),_0x149874);if(_0x466d3e[_0x392d('0x36')][_0x392d('0x40')]){_0x2168c3['where']=_[_0x392d('0x2c')](_0x2168c3[_0x392d('0x41')],{'$or':_[_0x392d('0x35')](_0x149874,function(_0x1e9e7d){if(_0x1e9e7d[_0x392d('0x42')]!==_0x392d('0x43')){var _0x414b4a={};_0x414b4a[_0x1e9e7d[_0x392d('0x29')]]={'$like':'%'+_0x466d3e[_0x392d('0x36')]['filter']+'%'};return _0x414b4a;}})});}_0x2168c3=_[_0x392d('0x2c')]({},_0x2168c3,_0x466d3e[_0x392d('0x44')]);var _0x2e5cfa={'where':_0x2168c3[_0x392d('0x41')]};return db[_0x392d('0x45')][_0x392d('0x1d')](_0x2e5cfa)[_0x392d('0x25')](function(_0x33a8fb){_0x17cf14[_0x392d('0x1d')]=_0x33a8fb;if(_0x466d3e[_0x392d('0x36')][_0x392d('0x46')]){_0x2168c3['include']=[{'all':!![]}];}return db[_0x392d('0x45')][_0x392d('0x47')](_0x2168c3);})[_0x392d('0x25')](function(_0x37cab1){_0x17cf14[_0x392d('0x48')]=_0x37cab1;return _0x17cf14;})['then'](respondWithFilteredResult(_0x332545,_0x2168c3))[_0x392d('0x49')](handleError(_0x332545,null));};exports['show']=function(_0x373cf6,_0x38bc97){var _0xcf2504={'raw':!![],'where':{'id':_0x373cf6[_0x392d('0x4a')]['id']}},_0x33b63c={};_0x33b63c['model']=_[_0x392d('0x37')](db['VoiceDialReport']['rawAttributes']);_0x33b63c['query']=_[_0x392d('0x37')](_0x373cf6['query']);_0x33b63c['filters']=_['intersection'](_0x33b63c[_0x392d('0x34')],_0x33b63c['query']);_0xcf2504[_0x392d('0x38')]=_[_0x392d('0x4b')](_0x33b63c[_0x392d('0x34')],qs[_0x392d('0x39')](_0x373cf6['query'][_0x392d('0x39')]));_0xcf2504['attributes']=_0xcf2504[_0x392d('0x38')]['length']?_0xcf2504['attributes']:_0x33b63c[_0x392d('0x34')];if(_0x373cf6[_0x392d('0x36')][_0x392d('0x46')]){_0xcf2504[_0x392d('0x4c')]=[{'all':!![]}];}_0xcf2504=_['merge']({},_0xcf2504,_0x373cf6[_0x392d('0x44')]);return db[_0x392d('0x45')][_0x392d('0x4d')](_0xcf2504)[_0x392d('0x25')](handleEntityNotFound(_0x38bc97,null))[_0x392d('0x25')](respondWithResult(_0x38bc97,null))[_0x392d('0x49')](handleError(_0x38bc97,null));};exports['create']=function(_0x58b3e8,_0x19003b){return db[_0x392d('0x45')][_0x392d('0x4e')](_0x58b3e8[_0x392d('0x2d')],{})[_0x392d('0x25')](respondWithResult(_0x19003b,0xc9))['catch'](handleError(_0x19003b,null));};exports[_0x392d('0x4f')]=function(_0x5deb48,_0x40cc44){if(_0x5deb48[_0x392d('0x2d')]['id']){delete _0x5deb48['body']['id'];}return db[_0x392d('0x45')][_0x392d('0x4d')]({'where':{'id':_0x5deb48[_0x392d('0x4a')]['id']}})[_0x392d('0x25')](handleEntityNotFound(_0x40cc44,null))[_0x392d('0x25')](saveUpdates(_0x5deb48[_0x392d('0x2d')],null))[_0x392d('0x25')](respondWithResult(_0x40cc44,null))[_0x392d('0x49')](handleError(_0x40cc44,null));};exports['destroy']=function(_0x28c462,_0x3c338c){return db[_0x392d('0x45')][_0x392d('0x4d')]({'where':{'id':_0x28c462['params']['id']}})['then'](handleEntityNotFound(_0x3c338c,null))[_0x392d('0x25')](removeEntity(_0x3c338c,null))['catch'](handleError(_0x3c338c,null));};exports['describe']=function(_0x42e32e,_0x2c590f){return db[_0x392d('0x45')][_0x392d('0x50')]()[_0x392d('0x25')](respondWithResult(_0x2c590f,null))['catch'](handleError(_0x2c590f,null));}; \ No newline at end of file +var _0x2f49=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','sendStatus','error','stack','name','render','merge','contact','message','agent','interaction','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','type','VIRTUAL','VoiceDialReport','then','includeAll','include','rows','catch','show','params','options','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','status'];(function(_0x3fd4c7,_0x2256fa){var _0x38905e=function(_0x208c78){while(--_0x208c78){_0x3fd4c7['push'](_0x3fd4c7['shift']());}};_0x38905e(++_0x2256fa);}(_0x2f49,0x7e));var _0x92f4=function(_0x2eb3d0,_0x57ae7f){_0x2eb3d0=_0x2eb3d0-0x0;var _0x492b0c=_0x2f49[_0x2eb3d0];return _0x492b0c;};'use strict';var emlformat=require(_0x92f4('0x0'));var rimraf=require(_0x92f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x92f4('0x2'));var rp=require(_0x92f4('0x3'));var moment=require(_0x92f4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x92f4('0x5'));var sox=require(_0x92f4('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92f4('0x7'));var _=require('lodash');var squel=require(_0x92f4('0x8'));var crypto=require(_0x92f4('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x92f4('0xa'));var querystring=require(_0x92f4('0xb'));var Papa=require(_0x92f4('0xc'));var Redis=require(_0x92f4('0xd'));var authService=require(_0x92f4('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x92f4('0xf'));var utils=require(_0x92f4('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x92f4('0x11'));var db=require(_0x92f4('0x12'))['db'];function respondWithStatusCode(_0xbbed7a,_0x5c2448){_0x5c2448=_0x5c2448||0xcc;return function(_0x45431e){if(_0x45431e){return _0xbbed7a['sendStatus'](_0x5c2448);}return _0xbbed7a[_0x92f4('0x13')](_0x5c2448)[_0x92f4('0x14')]();};}function respondWithResult(_0x1434a4,_0x1ed751){_0x1ed751=_0x1ed751||0xc8;return function(_0x25c19a){if(_0x25c19a){return _0x1434a4['status'](_0x1ed751)[_0x92f4('0x15')](_0x25c19a);}};}function respondWithFilteredResult(_0x1a68b0,_0x2f0450){return function(_0x2948f4){if(_0x2948f4){var _0x2fdbdf=typeof _0x2f0450[_0x92f4('0x16')]===_0x92f4('0x17')&&typeof _0x2f0450[_0x92f4('0x18')]==='undefined';var _0x6b15fa=_0x2948f4[_0x92f4('0x19')];var _0x459c94=_0x2fdbdf?0x0:_0x2f0450[_0x92f4('0x16')];var _0x193f52=_0x2fdbdf?_0x2948f4[_0x92f4('0x19')]:_0x2f0450[_0x92f4('0x16')]+_0x2f0450['limit'];var _0x5487ff;if(_0x193f52>=_0x6b15fa){_0x193f52=_0x6b15fa;_0x5487ff=0xc8;}else{_0x5487ff=0xce;}_0x1a68b0['status'](_0x5487ff);return _0x1a68b0[_0x92f4('0x1a')](_0x92f4('0x1b'),_0x459c94+'-'+_0x193f52+'/'+_0x6b15fa)[_0x92f4('0x15')](_0x2948f4);}return null;};}function patchUpdates(_0x40d882){return function(_0x43ddc7){try{jsonpatch[_0x92f4('0x1c')](_0x43ddc7,_0x40d882,!![]);}catch(_0x1bb08c){return BPromise[_0x92f4('0x1d')](_0x1bb08c);}return _0x43ddc7[_0x92f4('0x1e')]();};}function saveUpdates(_0x2fd7df,_0x3705f8){return function(_0x496d67){if(_0x496d67){return _0x496d67['update'](_0x2fd7df)['then'](function(_0x3597ae){return _0x3597ae;});}return null;};}function removeEntity(_0x2f2f05,_0x2d8bcf){return function(_0xde8367){if(_0xde8367){return _0xde8367['destroy']()['then'](function(){_0x2f2f05[_0x92f4('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd74b83,_0x7b5c00){return function(_0x240e63){if(!_0x240e63){_0xd74b83[_0x92f4('0x1f')](0x194);}return _0x240e63;};}function handleError(_0x41ed4b,_0xe807c3){_0xe807c3=_0xe807c3||0x1f4;return function(_0x25fe55){logger[_0x92f4('0x20')](_0x25fe55[_0x92f4('0x21')]);if(_0x25fe55[_0x92f4('0x22')]){delete _0x25fe55[_0x92f4('0x22')];}_0x41ed4b[_0x92f4('0x13')](_0xe807c3)['send'](_0x25fe55);};}function getMustacheRender(_0x227dd2,_0x244ca2){return Mustache[_0x92f4('0x23')](_0x227dd2,_[_0x92f4('0x24')](_0x244ca2['body'],{'contact':_0x244ca2[_0x92f4('0x25')],'message':_0x244ca2[_0x92f4('0x26')],'agent':_0x244ca2[_0x92f4('0x27')],'interaction':_0x244ca2[_0x92f4('0x28')],'account':_0x244ca2['account']}))||'';}exports[_0x92f4('0x29')]=function(_0x52e22f,_0x383799){var _0x8d9e19={},_0x5a3fc3={},_0x125f79={'count':0x0,'rows':[]};var _0x4ccfcc=_['map'](db['VoiceDialReport'][_0x92f4('0x2a')],function(_0x4afef8){return{'name':_0x4afef8[_0x92f4('0x2b')],'type':_0x4afef8['type'][_0x92f4('0x2c')]};});_0x5a3fc3[_0x92f4('0x2d')]=_['map'](_0x4ccfcc,_0x92f4('0x22'));_0x5a3fc3[_0x92f4('0x2e')]=_[_0x92f4('0x2f')](_0x52e22f[_0x92f4('0x2e')]);_0x5a3fc3[_0x92f4('0x30')]=_[_0x92f4('0x31')](_0x5a3fc3[_0x92f4('0x2d')],_0x5a3fc3[_0x92f4('0x2e')]);_0x8d9e19['attributes']=_[_0x92f4('0x31')](_0x5a3fc3[_0x92f4('0x2d')],qs[_0x92f4('0x32')](_0x52e22f[_0x92f4('0x2e')][_0x92f4('0x32')]));_0x8d9e19['attributes']=_0x8d9e19[_0x92f4('0x33')][_0x92f4('0x34')]?_0x8d9e19[_0x92f4('0x33')]:_0x5a3fc3[_0x92f4('0x2d')];if(!_0x52e22f[_0x92f4('0x2e')]['hasOwnProperty'](_0x92f4('0x35'))){_0x8d9e19[_0x92f4('0x18')]=qs[_0x92f4('0x18')](_0x52e22f[_0x92f4('0x2e')][_0x92f4('0x18')]);_0x8d9e19[_0x92f4('0x16')]=qs[_0x92f4('0x16')](_0x52e22f['query']['offset']);}_0x8d9e19['order']=qs[_0x92f4('0x36')](_0x52e22f[_0x92f4('0x2e')][_0x92f4('0x36')]);_0x8d9e19[_0x92f4('0x37')]=qs[_0x92f4('0x30')](_[_0x92f4('0x38')](_0x52e22f[_0x92f4('0x2e')],_0x5a3fc3['filters']),_0x4ccfcc);if(_0x52e22f[_0x92f4('0x2e')]['filter']){_0x8d9e19['where']=_['merge'](_0x8d9e19['where'],{'$or':_['map'](_0x4ccfcc,function(_0x837e03){if(_0x837e03[_0x92f4('0x39')]!==_0x92f4('0x3a')){var _0x4f0dd9={};_0x4f0dd9[_0x837e03[_0x92f4('0x22')]]={'$like':'%'+_0x52e22f[_0x92f4('0x2e')]['filter']+'%'};return _0x4f0dd9;}})});}_0x8d9e19=_['merge']({},_0x8d9e19,_0x52e22f['options']);var _0x446ee7={'where':_0x8d9e19[_0x92f4('0x37')]};return db[_0x92f4('0x3b')]['count'](_0x446ee7)[_0x92f4('0x3c')](function(_0x2edde2){_0x125f79[_0x92f4('0x19')]=_0x2edde2;if(_0x52e22f['query'][_0x92f4('0x3d')]){_0x8d9e19[_0x92f4('0x3e')]=[{'all':!![]}];}return db[_0x92f4('0x3b')]['findAll'](_0x8d9e19);})[_0x92f4('0x3c')](function(_0x4d877d){_0x125f79[_0x92f4('0x3f')]=_0x4d877d;return _0x125f79;})[_0x92f4('0x3c')](respondWithFilteredResult(_0x383799,_0x8d9e19))[_0x92f4('0x40')](handleError(_0x383799,null));};exports[_0x92f4('0x41')]=function(_0x551eac,_0x16ceb4){var _0x1f517f={'raw':!![],'where':{'id':_0x551eac[_0x92f4('0x42')]['id']}},_0x1c7e17={};_0x1c7e17[_0x92f4('0x2d')]=_[_0x92f4('0x2f')](db[_0x92f4('0x3b')]['rawAttributes']);_0x1c7e17[_0x92f4('0x2e')]=_[_0x92f4('0x2f')](_0x551eac['query']);_0x1c7e17[_0x92f4('0x30')]=_[_0x92f4('0x31')](_0x1c7e17[_0x92f4('0x2d')],_0x1c7e17[_0x92f4('0x2e')]);_0x1f517f[_0x92f4('0x33')]=_[_0x92f4('0x31')](_0x1c7e17[_0x92f4('0x2d')],qs['fields'](_0x551eac[_0x92f4('0x2e')][_0x92f4('0x32')]));_0x1f517f[_0x92f4('0x33')]=_0x1f517f['attributes'][_0x92f4('0x34')]?_0x1f517f['attributes']:_0x1c7e17['model'];if(_0x551eac['query'][_0x92f4('0x3d')]){_0x1f517f[_0x92f4('0x3e')]=[{'all':!![]}];}_0x1f517f=_['merge']({},_0x1f517f,_0x551eac[_0x92f4('0x43')]);return db['VoiceDialReport'][_0x92f4('0x44')](_0x1f517f)[_0x92f4('0x3c')](handleEntityNotFound(_0x16ceb4,null))['then'](respondWithResult(_0x16ceb4,null))[_0x92f4('0x40')](handleError(_0x16ceb4,null));};exports['create']=function(_0x14056f,_0x3fd5a3){return db[_0x92f4('0x3b')][_0x92f4('0x45')](_0x14056f[_0x92f4('0x46')],{})['then'](respondWithResult(_0x3fd5a3,0xc9))['catch'](handleError(_0x3fd5a3,null));};exports['update']=function(_0x4c870d,_0x57cf7a){if(_0x4c870d[_0x92f4('0x46')]['id']){delete _0x4c870d[_0x92f4('0x46')]['id'];}return db[_0x92f4('0x3b')]['find']({'where':{'id':_0x4c870d[_0x92f4('0x42')]['id']}})['then'](handleEntityNotFound(_0x57cf7a,null))[_0x92f4('0x3c')](saveUpdates(_0x4c870d[_0x92f4('0x46')],null))['then'](respondWithResult(_0x57cf7a,null))[_0x92f4('0x40')](handleError(_0x57cf7a,null));};exports[_0x92f4('0x47')]=function(_0x32d1ad,_0x541692){return db[_0x92f4('0x3b')][_0x92f4('0x44')]({'where':{'id':_0x32d1ad[_0x92f4('0x42')]['id']}})[_0x92f4('0x3c')](handleEntityNotFound(_0x541692,null))[_0x92f4('0x3c')](removeEntity(_0x541692,null))['catch'](handleError(_0x541692,null));};exports[_0x92f4('0x48')]=function(_0x1ab5d0,_0x577546){return db['VoiceDialReport']['describe']()[_0x92f4('0x3c')](respondWithResult(_0x577546,null))['catch'](handleError(_0x577546,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index c41b8b4..b24469a 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 _0x5f35=['bluebird','request-promise','path','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5f35,0xcd));var _0x55f3=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x5f35[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require(_0x55f3('0x0'));var util=require(_0x55f3('0x1'));var logger=require(_0x55f3('0x2'))(_0x55f3('0x3'));var moment=require(_0x55f3('0x4'));var BPromise=require(_0x55f3('0x5'));var rp=require(_0x55f3('0x6'));var fs=require('fs');var path=require(_0x55f3('0x7'));var rimraf=require('rimraf');var config=require(_0x55f3('0x8'));var attributes=require(_0x55f3('0x9'));module[_0x55f3('0xa')]=function(_0x7683d1,_0x4399cf){return _0x7683d1[_0x55f3('0xb')](_0x55f3('0xc'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x55f3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60e0=['rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x60e0,0x1ce));var _0x060e=function(_0x4e65de,_0x56931a){_0x4e65de=_0x4e65de-0x0;var _0x8308dd=_0x60e0[_0x4e65de];return _0x8308dd;};'use strict';var _=require(_0x060e('0x0'));var util=require(_0x060e('0x1'));var logger=require(_0x060e('0x2'))(_0x060e('0x3'));var moment=require('moment');var BPromise=require(_0x060e('0x4'));var rp=require(_0x060e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x060e('0x6'));var config=require(_0x060e('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0x060e('0x8')]=function(_0xf496c0,_0x4fb88d){return _0xf496c0[_0x060e('0x9')](_0x060e('0xa'),attributes,{'tableName':_0x060e('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 0821afb..6dd07a2 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 _0x529e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','UpdateVoiceDialReport','update','where','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x22050b,_0x1cddc1){var _0x2dac9e=function(_0x3f5dd2){while(--_0x3f5dd2){_0x22050b['push'](_0x22050b['shift']());}};_0x2dac9e(++_0x1cddc1);}(_0x529e,0x7b));var _0xe529=function(_0x36313f,_0x97e3f2){_0x36313f=_0x36313f-0x0;var _0x13d575=_0x529e[_0x36313f];return _0x13d575;};'use strict';var _=require(_0xe529('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe529('0x1'));var rs=require(_0xe529('0x2'));var fs=require('fs');var Redis=require(_0xe529('0x3'));var db=require(_0xe529('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe529('0x5'))(_0xe529('0x6'));var config=require(_0xe529('0x7'));var jayson=require(_0xe529('0x8'));var client=jayson[_0xe529('0x9')][_0xe529('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d6363,_0x1d7a95,_0x5c1151){return new BPromise(function(_0x4f6c3b,_0x455ffa){return client['request'](_0x4d6363,_0x5c1151)[_0xe529('0xb')](function(_0x1366e9){logger[_0xe529('0xc')](_0xe529('0xd'),_0x1d7a95,'request\x20sent');logger[_0xe529('0xe')](_0xe529('0xf'),_0x1d7a95,_0xe529('0x10'),JSON[_0xe529('0x11')](_0x1366e9));if(_0x1366e9[_0xe529('0x12')]){if(_0x1366e9[_0xe529('0x12')][_0xe529('0x13')]===0x1f4){logger['error'](_0xe529('0xd'),_0x1d7a95,_0x1366e9[_0xe529('0x12')][_0xe529('0x14')]);return _0x455ffa(_0x1366e9['error'][_0xe529('0x14')]);}logger[_0xe529('0x12')](_0xe529('0xd'),_0x1d7a95,_0x1366e9['error'][_0xe529('0x14')]);return _0x4f6c3b(_0x1366e9[_0xe529('0x12')][_0xe529('0x14')]);}else{logger[_0xe529('0xc')](_0xe529('0xd'),_0x1d7a95,'request\x20sent');_0x4f6c3b(_0x1366e9[_0xe529('0x15')]['message']);}})[_0xe529('0x16')](function(_0x7e4ae3){logger[_0xe529('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x1d7a95,_0x7e4ae3);_0x455ffa(_0x7e4ae3);});});}exports[_0xe529('0x17')]=function(_0x33e8fa){var _0x3b1d4d=this;return new Promise(function(_0x582acf,_0x31aeaa){return db[_0xe529('0x18')][_0xe529('0x19')](_0x33e8fa['body'],{'raw':_0x33e8fa[_0xe529('0x1a')]?_0x33e8fa[_0xe529('0x1a')][_0xe529('0x1b')]===undefined?!![]:![]:!![]})[_0xe529('0xb')](function(_0xc0a81d){logger[_0xe529('0xc')](_0xe529('0x17'),_0x33e8fa);logger['debug'](_0xe529('0x17'),_0x33e8fa,JSON[_0xe529('0x11')](_0xc0a81d));_0x582acf(_0xc0a81d);})[_0xe529('0x16')](function(_0x286041){logger[_0xe529('0x12')](_0xe529('0x17'),_0x286041['message'],_0x33e8fa);_0x31aeaa(_0x3b1d4d[_0xe529('0x12')](0x1f4,_0x286041['message']));});});};exports[_0xe529('0x1c')]=function(_0x486ea1){var _0x3c64f3=this;return new Promise(function(_0x2d00ab,_0xf10d77){return db[_0xe529('0x18')][_0xe529('0x1d')](_0x486ea1['body'],{'raw':_0x486ea1[_0xe529('0x1a')]?_0x486ea1[_0xe529('0x1a')][_0xe529('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x486ea1[_0xe529('0x1a')]?_0x486ea1['options'][_0xe529('0x1e')]||null:null,'attributes':_0x486ea1[_0xe529('0x1a')]?_0x486ea1[_0xe529('0x1a')][_0xe529('0x1f')]||null:null,'limit':_0x486ea1['options']?_0x486ea1[_0xe529('0x1a')]['limit']||null:null})[_0xe529('0xb')](function(_0x7cb63b){logger[_0xe529('0xc')](_0xe529('0x1c'),_0x486ea1);logger[_0xe529('0xe')]('UpdateVoiceDialReport',_0x486ea1,JSON[_0xe529('0x11')](_0x7cb63b));_0x2d00ab(_0x7cb63b);})['catch'](function(_0x286671){logger['error']('UpdateVoiceDialReport',_0x286671[_0xe529('0x14')],_0x486ea1);_0xf10d77(_0x3c64f3['error'](0x1f4,_0x286671[_0xe529('0x14')]));});});}; \ No newline at end of file +var _0x9b40=['result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','catch','UpdateVoiceDialReport','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x5311e8,_0x57c5bb){var _0x582ad8=function(_0x1909af){while(--_0x1909af){_0x5311e8['push'](_0x5311e8['shift']());}};_0x582ad8(++_0x57c5bb);}(_0x9b40,0x122));var _0x09b4=function(_0x23bf11,_0x3c3292){_0x23bf11=_0x23bf11-0x0;var _0x3ff5c3=_0x9b40[_0x23bf11];return _0x3ff5c3;};'use strict';var _=require('lodash');var util=require(_0x09b4('0x0'));var moment=require('moment');var BPromise=require(_0x09b4('0x1'));var rs=require(_0x09b4('0x2'));var fs=require('fs');var Redis=require(_0x09b4('0x3'));var db=require(_0x09b4('0x4'))['db'];var utils=require(_0x09b4('0x5'));var logger=require(_0x09b4('0x6'))('rpc');var config=require(_0x09b4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x09b4('0x8')][_0x09b4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x490f4d,_0x118b58,_0x5ad3f8){return new BPromise(function(_0x596e1e,_0x4bec40){return client[_0x09b4('0xa')](_0x490f4d,_0x5ad3f8)[_0x09b4('0xb')](function(_0x578eea){logger['info'](_0x09b4('0xc'),_0x118b58,_0x09b4('0xd'));logger[_0x09b4('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x118b58,_0x09b4('0xd'),JSON[_0x09b4('0xf')](_0x578eea));if(_0x578eea[_0x09b4('0x10')]){if(_0x578eea[_0x09b4('0x10')][_0x09b4('0x11')]===0x1f4){logger[_0x09b4('0x10')](_0x09b4('0xc'),_0x118b58,_0x578eea[_0x09b4('0x10')]['message']);return _0x4bec40(_0x578eea[_0x09b4('0x10')][_0x09b4('0x12')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x118b58,_0x578eea[_0x09b4('0x10')][_0x09b4('0x12')]);return _0x596e1e(_0x578eea[_0x09b4('0x10')][_0x09b4('0x12')]);}else{logger[_0x09b4('0x13')](_0x09b4('0xc'),_0x118b58,'request\x20sent');_0x596e1e(_0x578eea[_0x09b4('0x14')][_0x09b4('0x12')]);}})['catch'](function(_0x53e0fb){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x118b58,_0x53e0fb);_0x4bec40(_0x53e0fb);});});}exports[_0x09b4('0x15')]=function(_0x20fe40){var _0x14be54=this;return new Promise(function(_0x520b0a,_0x13e282){return db[_0x09b4('0x16')][_0x09b4('0x17')](_0x20fe40[_0x09b4('0x18')],{'raw':_0x20fe40[_0x09b4('0x19')]?_0x20fe40[_0x09b4('0x19')][_0x09b4('0x1a')]===undefined?!![]:![]:!![]})[_0x09b4('0xb')](function(_0x569823){logger['info']('CreateVoiceDialReport',_0x20fe40);logger[_0x09b4('0xe')](_0x09b4('0x15'),_0x20fe40,JSON[_0x09b4('0xf')](_0x569823));_0x520b0a(_0x569823);})[_0x09b4('0x1b')](function(_0x330ede){logger[_0x09b4('0x10')]('CreateVoiceDialReport',_0x330ede['message'],_0x20fe40);_0x13e282(_0x14be54[_0x09b4('0x10')](0x1f4,_0x330ede[_0x09b4('0x12')]));});});};exports[_0x09b4('0x1c')]=function(_0x46a328){var _0x2d064a=this;return new Promise(function(_0x2d100d,_0x356997){return db[_0x09b4('0x16')]['update'](_0x46a328[_0x09b4('0x18')],{'raw':_0x46a328['options']?_0x46a328['options'][_0x09b4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46a328[_0x09b4('0x19')]?_0x46a328['options']['where']||null:null,'attributes':_0x46a328[_0x09b4('0x19')]?_0x46a328[_0x09b4('0x19')][_0x09b4('0x1d')]||null:null,'limit':_0x46a328[_0x09b4('0x19')]?_0x46a328['options'][_0x09b4('0x1e')]||null:null})[_0x09b4('0xb')](function(_0x450e76){logger[_0x09b4('0x13')](_0x09b4('0x1c'),_0x46a328);logger['debug'](_0x09b4('0x1c'),_0x46a328,JSON[_0x09b4('0xf')](_0x450e76));_0x2d100d(_0x450e76);})[_0x09b4('0x1b')](function(_0x4cd4ba){logger['error']('UpdateVoiceDialReport',_0x4cd4ba[_0x09b4('0x12')],_0x46a328);_0x356997(_0x2d064a[_0x09b4('0x10')](0x1f4,_0x4cd4ba[_0x09b4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index bdd8581..e6876f8 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 _0xf4b8=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','show','create','post','/:id/applications','addApplications','put','/:id','delete','multer','util','path','express'];(function(_0x460f6a,_0x12dcde){var _0x3ede0a=function(_0x5c9d72){while(--_0x5c9d72){_0x460f6a['push'](_0x460f6a['shift']());}};_0x3ede0a(++_0x12dcde);}(_0xf4b8,0x114));var _0x8f4b=function(_0x59e631,_0x39150b){_0x59e631=_0x59e631-0x0;var _0x3b3d05=_0xf4b8[_0x59e631];return _0x3b3d05;};'use strict';var multer=require(_0x8f4b('0x0'));var util=require(_0x8f4b('0x1'));var path=require(_0x8f4b('0x2'));var timeout=require('connect-timeout');var express=require(_0x8f4b('0x3'));var router=express[_0x8f4b('0x4')]();var fs_extra=require(_0x8f4b('0x5'));var auth=require(_0x8f4b('0x6'));var interaction=require(_0x8f4b('0x7'));var config=require('../../config/environment');var controller=require(_0x8f4b('0x8'));router[_0x8f4b('0x9')]('/',auth[_0x8f4b('0xa')](),controller[_0x8f4b('0xb')]);router[_0x8f4b('0x9')]('/:id',auth[_0x8f4b('0xa')](),controller[_0x8f4b('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8f4b('0xd')]);router[_0x8f4b('0xe')](_0x8f4b('0xf'),auth['isAuthenticated'](),controller[_0x8f4b('0x10')]);router[_0x8f4b('0x11')](_0x8f4b('0x12'),auth[_0x8f4b('0xa')](),controller['update']);router[_0x8f4b('0x13')](_0x8f4b('0x12'),auth[_0x8f4b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1e86=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','/:id/applications','addApplications','put','update','delete'];(function(_0x5c5fbd,_0x43ff30){var _0x59f2e2=function(_0x420dfb){while(--_0x420dfb){_0x5c5fbd['push'](_0x5c5fbd['shift']());}};_0x59f2e2(++_0x43ff30);}(_0x1e86,0xf8));var _0x61e8=function(_0x424c00,_0x46c7b9){_0x424c00=_0x424c00-0x0;var _0x5e29d2=_0x1e86[_0x424c00];return _0x5e29d2;};'use strict';var multer=require(_0x61e8('0x0'));var util=require(_0x61e8('0x1'));var path=require(_0x61e8('0x2'));var timeout=require('connect-timeout');var express=require(_0x61e8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x61e8('0x4'));var interaction=require(_0x61e8('0x5'));var config=require('../../config/environment');var controller=require(_0x61e8('0x6'));router[_0x61e8('0x7')]('/',auth[_0x61e8('0x8')](),controller['index']);router['get'](_0x61e8('0x9'),auth['isAuthenticated'](),controller[_0x61e8('0xa')]);router[_0x61e8('0xb')]('/',auth[_0x61e8('0x8')](),controller[_0x61e8('0xc')]);router['post'](_0x61e8('0xd'),auth['isAuthenticated'](),controller[_0x61e8('0xe')]);router[_0x61e8('0xf')](_0x61e8('0x9'),auth[_0x61e8('0x8')](),controller[_0x61e8('0x10')]);router[_0x61e8('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x61e8('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 04e875f..b539ec6 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x2e8909,_0x337d51){var _0x31992c=function(_0x1a1df7){while(--_0x1a1df7){_0x2e8909['push'](_0x2e8909['shift']());}};_0x31992c(++_0x337d51);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x109462,_0x1e3e8a){var _0x25ca96=function(_0x27e4ab){while(--_0x27e4ab){_0x109462['push'](_0x109462['shift']());}};_0x25ca96(++_0x1e3e8a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index c6af014..f1c2a80 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 _0x2432=['request-promise','moment','util','path','ejs','fs-extra','lodash','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./voiceExtension.socket','register','status','end','offset','undefined','limit','count','Content-Range','apply','reject','then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','find','type','name','UserProfileResource','error','send','render','merge','contact','agent','index','VoiceExtension','rawAttributes','fieldName','key','query','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','destroy','body','outbound','startsWith','concat','exten','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','mandatoryDisposition','context','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','rimraf','zip-dir','fast-json-patch'];(function(_0x3b26d7,_0x5dc79e){var _0x2620c0=function(_0x5a7ed0){while(--_0x5a7ed0){_0x3b26d7['push'](_0x3b26d7['shift']());}};_0x2620c0(++_0x5dc79e);}(_0x2432,0xd9));var _0x2243=function(_0xddd141,_0x62533c){_0xddd141=_0xddd141-0x0;var _0x29e8b5=_0x2432[_0xddd141];return _0x29e8b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2243('0x0'));var zipdir=require(_0x2243('0x1'));var jsonpatch=require(_0x2243('0x2'));var rp=require(_0x2243('0x3'));var moment=require(_0x2243('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2243('0x5'));var path=require(_0x2243('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2243('0x7'));var fs=require('fs');var fs_extra=require(_0x2243('0x8'));var _=require(_0x2243('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2243('0xa'));var querystring=require(_0x2243('0xb'));var Papa=require(_0x2243('0xc'));var Redis=require(_0x2243('0xd'));var authService=require(_0x2243('0xe'));var qs=require(_0x2243('0xf'));var as=require(_0x2243('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2243('0x11'));var utils=require(_0x2243('0x12'));var config=require(_0x2243('0x13'));var licenseUtil=require(_0x2243('0x14'));var db=require(_0x2243('0x15'))['db'];config['redis']=_[_0x2243('0x16')](config['redis'],{'host':_0x2243('0x17'),'port':0x18eb});var socket=require(_0x2243('0x18'))(new Redis(config[_0x2243('0x19')]));require(_0x2243('0x1a'))[_0x2243('0x1b')](socket);function respondWithStatusCode(_0x2ec6c5,_0x322a7f){_0x322a7f=_0x322a7f||0xcc;return function(_0x3ff3be){if(_0x3ff3be){return _0x2ec6c5['sendStatus'](_0x322a7f);}return _0x2ec6c5[_0x2243('0x1c')](_0x322a7f)[_0x2243('0x1d')]();};}function respondWithResult(_0x1b3a0b,_0x4aa34d){_0x4aa34d=_0x4aa34d||0xc8;return function(_0x11a228){if(_0x11a228){return _0x1b3a0b[_0x2243('0x1c')](_0x4aa34d)['json'](_0x11a228);}};}function respondWithFilteredResult(_0x282af9,_0x14ed83){return function(_0x41d18d){if(_0x41d18d){var _0x40269c=typeof _0x14ed83[_0x2243('0x1e')]===_0x2243('0x1f')&&typeof _0x14ed83[_0x2243('0x20')]===_0x2243('0x1f');var _0x1d3c69=_0x41d18d[_0x2243('0x21')];var _0x243744=_0x40269c?0x0:_0x14ed83[_0x2243('0x1e')];var _0x460891=_0x40269c?_0x41d18d[_0x2243('0x21')]:_0x14ed83[_0x2243('0x1e')]+_0x14ed83[_0x2243('0x20')];var _0x1e8283;if(_0x460891>=_0x1d3c69){_0x460891=_0x1d3c69;_0x1e8283=0xc8;}else{_0x1e8283=0xce;}_0x282af9[_0x2243('0x1c')](_0x1e8283);return _0x282af9['set'](_0x2243('0x22'),_0x243744+'-'+_0x460891+'/'+_0x1d3c69)['json'](_0x41d18d);}return null;};}function patchUpdates(_0x3d58d3){return function(_0x29e503){try{jsonpatch[_0x2243('0x23')](_0x29e503,_0x3d58d3,!![]);}catch(_0x416532){return BPromise[_0x2243('0x24')](_0x416532);}return _0x29e503['save']();};}function saveUpdates(_0x3b3a0e,_0x5d922e){return function(_0x11b8f3){if(_0x11b8f3){return _0x11b8f3['update'](_0x3b3a0e)['then'](function(_0xe4fe3d){return _0xe4fe3d;});}return null;};}function removeEntity(_0x241df7,_0x199fea){return function(_0x32e088){if(_0x32e088){return _0x32e088['destroy']()[_0x2243('0x25')](function(){var _0x157b3d=_0x32e088[_0x2243('0x26')]({'plain':!![]});var _0x22f7b9=[{'name':_0x2243('0x27'),'value':_0x2243('0x28'),'ignore':![]},{'name':_0x2243('0x29'),'value':'outbound','ignore':![]},{'name':_0x2243('0x2a'),'value':_0x2243('0x2b'),'ignore':![]}];var _0x3b942a=_(_0x22f7b9)[_0x2243('0x2c')](_0x2243('0x2d'))[_0x2243('0x2e')](_0x2243('0x2f'))[_0x2243('0x2f')]();if(_[_0x2243('0x30')](_0x3b942a,_0x157b3d['type'])){return;}var _0x97b715=_[_0x2243('0x31')](_0x22f7b9,['value',_0x157b3d[_0x2243('0x32')]])[_0x2243('0x33')];return db[_0x2243('0x34')]['destroy']({'where':{'type':_0x97b715,'resourceId':_0x157b3d['id']}})[_0x2243('0x25')](function(){return _0x32e088;});})['then'](function(){_0x241df7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x374a49,_0x2361d9){return function(_0x3cbc13){if(!_0x3cbc13){_0x374a49['sendStatus'](0x194);}return _0x3cbc13;};}function handleError(_0x198a9e,_0x2fc008){_0x2fc008=_0x2fc008||0x1f4;return function(_0x6a1316){logger[_0x2243('0x35')](_0x6a1316['stack']);if(_0x6a1316[_0x2243('0x33')]){delete _0x6a1316['name'];}_0x198a9e[_0x2243('0x1c')](_0x2fc008)[_0x2243('0x36')](_0x6a1316);};}function getMustacheRender(_0x33dd29,_0x3bb05c){return Mustache[_0x2243('0x37')](_0x33dd29,_[_0x2243('0x38')](_0x3bb05c['body'],{'contact':_0x3bb05c[_0x2243('0x39')],'message':_0x3bb05c['message'],'agent':_0x3bb05c[_0x2243('0x3a')],'interaction':_0x3bb05c['interaction'],'account':_0x3bb05c['account']}))||'';}exports[_0x2243('0x3b')]=function(_0x1350f0,_0x15cab4){var _0x45e292={},_0x3577de={},_0x206751={'count':0x0,'rows':[]};var _0x35eb02=_[_0x2243('0x2e')](db[_0x2243('0x3c')][_0x2243('0x3d')],function(_0x2f72a8){return{'name':_0x2f72a8[_0x2243('0x3e')],'type':_0x2f72a8['type'][_0x2243('0x3f')]};});_0x3577de['model']=_['map'](_0x35eb02,_0x2243('0x33'));_0x3577de[_0x2243('0x40')]=_['keys'](_0x1350f0[_0x2243('0x40')]);_0x3577de['filters']=_[_0x2243('0x41')](_0x3577de['model'],_0x3577de[_0x2243('0x40')]);_0x45e292[_0x2243('0x42')]=_[_0x2243('0x41')](_0x3577de['model'],qs[_0x2243('0x43')](_0x1350f0[_0x2243('0x40')][_0x2243('0x43')]));_0x45e292[_0x2243('0x42')]=_0x45e292[_0x2243('0x42')][_0x2243('0x44')]?_0x45e292[_0x2243('0x42')]:_0x3577de[_0x2243('0x45')];if(!_0x1350f0[_0x2243('0x40')][_0x2243('0x46')](_0x2243('0x47'))){_0x45e292[_0x2243('0x20')]=qs['limit'](_0x1350f0[_0x2243('0x40')]['limit']);_0x45e292[_0x2243('0x1e')]=qs[_0x2243('0x1e')](_0x1350f0['query'][_0x2243('0x1e')]);}_0x45e292[_0x2243('0x48')]=qs[_0x2243('0x49')](_0x1350f0[_0x2243('0x40')][_0x2243('0x49')]);_0x45e292[_0x2243('0x4a')]=qs[_0x2243('0x4b')](_[_0x2243('0x4c')](_0x1350f0[_0x2243('0x40')],_0x3577de[_0x2243('0x4b')]),_0x35eb02);if(_0x1350f0[_0x2243('0x40')][_0x2243('0x2c')]){_0x45e292[_0x2243('0x4a')]=_[_0x2243('0x38')](_0x45e292[_0x2243('0x4a')],{'$or':_[_0x2243('0x2e')](_0x35eb02,function(_0x53ba1b){if(_0x53ba1b['type']!==_0x2243('0x4d')){var _0x2b6b81={};_0x2b6b81[_0x53ba1b[_0x2243('0x33')]]={'$like':'%'+_0x1350f0[_0x2243('0x40')][_0x2243('0x2c')]+'%'};return _0x2b6b81;}})});}_0x45e292=_[_0x2243('0x38')]({},_0x45e292,_0x1350f0[_0x2243('0x4e')]);var _0x226b86={'where':_0x45e292[_0x2243('0x4a')]};return db[_0x2243('0x3c')][_0x2243('0x21')](_0x226b86)['then'](function(_0x4b06ea){_0x206751[_0x2243('0x21')]=_0x4b06ea;if(_0x1350f0[_0x2243('0x40')][_0x2243('0x4f')]){_0x45e292[_0x2243('0x50')]=[{'all':!![]}];}return db[_0x2243('0x3c')][_0x2243('0x51')](_0x45e292);})['then'](function(_0x2b1ad7){_0x206751[_0x2243('0x52')]=_0x2b1ad7;return _0x206751;})['then'](respondWithFilteredResult(_0x15cab4,_0x45e292))[_0x2243('0x53')](handleError(_0x15cab4,null));};exports[_0x2243('0x54')]=function(_0x1bfae8,_0x2bcf04){var _0x11bf67={'raw':![],'where':{'id':_0x1bfae8[_0x2243('0x55')]['id']}},_0x250bd0={};_0x250bd0[_0x2243('0x45')]=_[_0x2243('0x56')](db[_0x2243('0x3c')][_0x2243('0x3d')]);_0x250bd0[_0x2243('0x40')]=_[_0x2243('0x56')](_0x1bfae8[_0x2243('0x40')]);_0x250bd0[_0x2243('0x4b')]=_[_0x2243('0x41')](_0x250bd0[_0x2243('0x45')],_0x250bd0[_0x2243('0x40')]);_0x11bf67['attributes']=_[_0x2243('0x41')](_0x250bd0[_0x2243('0x45')],qs[_0x2243('0x43')](_0x1bfae8[_0x2243('0x40')]['fields']));_0x11bf67['attributes']=_0x11bf67[_0x2243('0x42')][_0x2243('0x44')]?_0x11bf67[_0x2243('0x42')]:_0x250bd0[_0x2243('0x45')];if(_0x1bfae8['query'][_0x2243('0x4f')]){_0x11bf67[_0x2243('0x50')]=[{'all':!![]}];}_0x11bf67=_[_0x2243('0x38')]({},_0x11bf67,_0x1bfae8['options']);return db[_0x2243('0x3c')][_0x2243('0x31')](_0x11bf67)[_0x2243('0x25')](handleEntityNotFound(_0x2bcf04,null))['then'](respondWithResult(_0x2bcf04,null))['catch'](handleError(_0x2bcf04,null));};exports[_0x2243('0x57')]=function(_0x5ca622,_0x5a77fb){return db[_0x2243('0x3c')][_0x2243('0x31')]({'where':{'id':_0x5ca622[_0x2243('0x55')]['id']}})[_0x2243('0x25')](handleEntityNotFound(_0x5a77fb,null))[_0x2243('0x25')](removeEntity(_0x5a77fb,null))['catch'](handleError(_0x5a77fb,null));};exports['create']=function(_0x520103,_0x9c4b36){if(_0x520103[_0x2243('0x58')][_0x2243('0x32')]===_0x2243('0x59')&&!_[_0x2243('0x5a')](_0x520103[_0x2243('0x58')]['exten'],'_')){_0x520103['body']['exten']='_'[_0x2243('0x5b')](_0x520103[_0x2243('0x58')][_0x2243('0x5c')]);}return db[_0x2243('0x3c')][_0x2243('0x5d')](_0x520103['body'],{'raw':![]})[_0x2243('0x25')](function(_0x16de1e){var _0x56be05=_0x520103[_0x2243('0x5e')][_0x2243('0x26')]({'plain':!![]});if(!_0x56be05)throw new Error(_0x2243('0x5f'));if(_0x56be05[_0x2243('0x60')]===_0x2243('0x5e')){var _0x5f05b5=_0x16de1e[_0x2243('0x26')]({'plain':!![]});var _0x15745e=[{'name':_0x2243('0x27'),'value':'inbound'},{'name':'OutboundRoutes','value':_0x2243('0x59')},{'name':_0x2243('0x2a'),'value':_0x2243('0x2b')}];var _0x41fbc0=_[_0x2243('0x31')](_0x15745e,[_0x2243('0x2f'),_0x5f05b5[_0x2243('0x32')]])['name'];return db[_0x2243('0x61')]['find']({'where':{'name':_0x41fbc0,'userProfileId':_0x56be05['userProfileId']},'raw':!![]})[_0x2243('0x25')](function(_0xb950c2){if(_0xb950c2&&_0xb950c2[_0x2243('0x62')]===0x0){return db[_0x2243('0x34')]['create']({'name':_0x5f05b5[_0x2243('0x33')],'resourceId':_0x5f05b5['id'],'type':_0xb950c2[_0x2243('0x33')],'sectionId':_0xb950c2['id']},{})[_0x2243('0x25')](function(){return _0x16de1e;});}else{return _0x16de1e;}})['catch'](function(_0x35508b){logger['error'](_0x2243('0x63'),_0x35508b);throw _0x35508b;});}return _0x16de1e;})[_0x2243('0x25')](respondWithResult(_0x9c4b36,0xc9))['catch'](handleError(_0x9c4b36,null));};exports[_0x2243('0x64')]=function(_0x4e2c1b,_0x39ad66){if(_0x4e2c1b[_0x2243('0x58')]['id']){delete _0x4e2c1b[_0x2243('0x58')]['id'];}return db[_0x2243('0x3c')][_0x2243('0x31')]({'where':{'id':_0x4e2c1b[_0x2243('0x55')]['id']}})['then'](handleEntityNotFound(_0x39ad66,null))[_0x2243('0x25')](function(_0x2b5250){if(_0x2b5250){return db[_0x2243('0x3c')][_0x2243('0x64')](_['pick'](_0x4e2c1b[_0x2243('0x58')],['exten','context',_0x2243('0x65'),_0x2243('0x66'),'cutdigits',_0x2243('0x67')]),{'where':{'context':_0x2b5250[_0x2243('0x68')],'exten':_0x2b5250[_0x2243('0x5c')]},'individualHooks':!![]})[_0x2243('0x25')](function(_0x2c2d40){return _0x2c2d40;});}return null;})['then'](respondWithStatusCode(_0x39ad66,null))[_0x2243('0x53')](handleError(_0x39ad66,null));};exports['addApplications']=function(_0x14baa0,_0x536b19,_0x2cce28){return db[_0x2243('0x3c')][_0x2243('0x69')]({'where':{'id':_0x14baa0['params']['id']}})[_0x2243('0x25')](handleEntityNotFound(_0x536b19,null))[_0x2243('0x25')](function(_0x2b8f87){if(_0x2b8f87){return db[_0x2243('0x6a')][_0x2243('0x6b')](function(_0x3ea46e){return db[_0x2243('0x3c')][_0x2243('0x57')]({'where':{'VoiceExtensionId':_0x14baa0['params']['id']},'transaction':_0x3ea46e})[_0x2243('0x25')](function(_0x245aed){var _0x52fe4e=_[_0x2243('0x2e')](_0x14baa0['body'],function(_0x2e7c55){_0x2e7c55[_0x2243('0x6c')]=_0x14baa0[_0x2243('0x55')]['id'];return _0x2e7c55;});return db[_0x2243('0x3c')]['bulkCreate'](_0x52fe4e,{'transaction':_0x3ea46e});});})[_0x2243('0x25')](function(){return db[_0x2243('0x3c')][_0x2243('0x6d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x14baa0[_0x2243('0x55')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x2243('0x25')](respondWithResult(_0x536b19,null))[_0x2243('0x53')](handleError(_0x536b19,null));}; \ No newline at end of file +var _0x19dc=['filter','map','value','includes','type','find','name','UserProfileResource','then','end','error','send','render','merge','body','contact','message','agent','index','VoiceExtension','fieldName','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','include','rows','catch','show','rawAttributes','intersection','length','includeAll','options','params','create','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','limit','count','offset','apply','reject','save','update','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19dc,0x11e));var _0xc19d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x19dc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc19d('0x0'));var rimraf=require(_0xc19d('0x1'));var zipdir=require(_0xc19d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc19d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc19d('0x4'));var path=require(_0xc19d('0x5'));var sox=require(_0xc19d('0x6'));var csv=require(_0xc19d('0x7'));var ejs=require(_0xc19d('0x8'));var fs=require('fs');var fs_extra=require(_0xc19d('0x9'));var _=require(_0xc19d('0xa'));var squel=require(_0xc19d('0xb'));var crypto=require(_0xc19d('0xc'));var jsforce=require(_0xc19d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc19d('0xe'));var Redis=require(_0xc19d('0xf'));var authService=require(_0xc19d('0x10'));var qs=require(_0xc19d('0x11'));var as=require(_0xc19d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc19d('0x13'));var config=require(_0xc19d('0x14'));var licenseUtil=require(_0xc19d('0x15'));var db=require(_0xc19d('0x16'))['db'];config[_0xc19d('0x17')]=_[_0xc19d('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc19d('0x19'))(new Redis(config[_0xc19d('0x17')]));require('./voiceExtension.socket')[_0xc19d('0x1a')](socket);function respondWithStatusCode(_0x3d1c35,_0x5bfc9d){_0x5bfc9d=_0x5bfc9d||0xcc;return function(_0x41d49e){if(_0x41d49e){return _0x3d1c35[_0xc19d('0x1b')](_0x5bfc9d);}return _0x3d1c35[_0xc19d('0x1c')](_0x5bfc9d)['end']();};}function respondWithResult(_0x4422ee,_0x1cfb72){_0x1cfb72=_0x1cfb72||0xc8;return function(_0x26da6d){if(_0x26da6d){return _0x4422ee['status'](_0x1cfb72)[_0xc19d('0x1d')](_0x26da6d);}};}function respondWithFilteredResult(_0x555ead,_0x166c85){return function(_0x168d24){if(_0x168d24){var _0x5b7dbc=typeof _0x166c85['offset']==='undefined'&&typeof _0x166c85[_0xc19d('0x1e')]==='undefined';var _0x255c37=_0x168d24[_0xc19d('0x1f')];var _0x11c2bc=_0x5b7dbc?0x0:_0x166c85[_0xc19d('0x20')];var _0x779d46=_0x5b7dbc?_0x168d24[_0xc19d('0x1f')]:_0x166c85[_0xc19d('0x20')]+_0x166c85[_0xc19d('0x1e')];var _0x842eb7;if(_0x779d46>=_0x255c37){_0x779d46=_0x255c37;_0x842eb7=0xc8;}else{_0x842eb7=0xce;}_0x555ead[_0xc19d('0x1c')](_0x842eb7);return _0x555ead['set']('Content-Range',_0x11c2bc+'-'+_0x779d46+'/'+_0x255c37)[_0xc19d('0x1d')](_0x168d24);}return null;};}function patchUpdates(_0x5a7bcc){return function(_0x52a11a){try{jsonpatch[_0xc19d('0x21')](_0x52a11a,_0x5a7bcc,!![]);}catch(_0x1013b3){return BPromise[_0xc19d('0x22')](_0x1013b3);}return _0x52a11a[_0xc19d('0x23')]();};}function saveUpdates(_0x5b4266,_0x5d0581){return function(_0x7ecc28){if(_0x7ecc28){return _0x7ecc28[_0xc19d('0x24')](_0x5b4266)['then'](function(_0x135153){return _0x135153;});}return null;};}function removeEntity(_0x48432f,_0xc1b9e1){return function(_0x146dcb){if(_0x146dcb){return _0x146dcb[_0xc19d('0x25')]()['then'](function(){var _0x1bc38a=_0x146dcb[_0xc19d('0x26')]({'plain':!![]});var _0x4201ec=[{'name':_0xc19d('0x27'),'value':_0xc19d('0x28'),'ignore':![]},{'name':_0xc19d('0x29'),'value':_0xc19d('0x2a'),'ignore':![]},{'name':_0xc19d('0x2b'),'value':'internal','ignore':![]}];var _0x1dfc0e=_(_0x4201ec)[_0xc19d('0x2c')]('ignore')[_0xc19d('0x2d')](_0xc19d('0x2e'))[_0xc19d('0x2e')]();if(_[_0xc19d('0x2f')](_0x1dfc0e,_0x1bc38a[_0xc19d('0x30')])){return;}var _0x153dba=_[_0xc19d('0x31')](_0x4201ec,[_0xc19d('0x2e'),_0x1bc38a[_0xc19d('0x30')]])[_0xc19d('0x32')];return db[_0xc19d('0x33')][_0xc19d('0x25')]({'where':{'type':_0x153dba,'resourceId':_0x1bc38a['id']}})[_0xc19d('0x34')](function(){return _0x146dcb;});})['then'](function(){_0x48432f[_0xc19d('0x1c')](0xcc)[_0xc19d('0x35')]();});}};}function handleEntityNotFound(_0xe36f69,_0x531147){return function(_0x179d39){if(!_0x179d39){_0xe36f69['sendStatus'](0x194);}return _0x179d39;};}function handleError(_0x400c5c,_0x3b3cc9){_0x3b3cc9=_0x3b3cc9||0x1f4;return function(_0x154db2){logger[_0xc19d('0x36')](_0x154db2['stack']);if(_0x154db2[_0xc19d('0x32')]){delete _0x154db2['name'];}_0x400c5c[_0xc19d('0x1c')](_0x3b3cc9)[_0xc19d('0x37')](_0x154db2);};}function getMustacheRender(_0x31740f,_0x41c71b){return Mustache[_0xc19d('0x38')](_0x31740f,_[_0xc19d('0x39')](_0x41c71b[_0xc19d('0x3a')],{'contact':_0x41c71b[_0xc19d('0x3b')],'message':_0x41c71b[_0xc19d('0x3c')],'agent':_0x41c71b[_0xc19d('0x3d')],'interaction':_0x41c71b['interaction'],'account':_0x41c71b['account']}))||'';}exports[_0xc19d('0x3e')]=function(_0x544000,_0x217728){var _0x35217d={},_0x26cdf0={},_0x297263={'count':0x0,'rows':[]};var _0x407668=_[_0xc19d('0x2d')](db[_0xc19d('0x3f')]['rawAttributes'],function(_0x52190b){return{'name':_0x52190b[_0xc19d('0x40')],'type':_0x52190b[_0xc19d('0x30')][_0xc19d('0x41')]};});_0x26cdf0[_0xc19d('0x42')]=_[_0xc19d('0x2d')](_0x407668,'name');_0x26cdf0[_0xc19d('0x43')]=_[_0xc19d('0x44')](_0x544000['query']);_0x26cdf0[_0xc19d('0x45')]=_['intersection'](_0x26cdf0['model'],_0x26cdf0['query']);_0x35217d['attributes']=_['intersection'](_0x26cdf0['model'],qs[_0xc19d('0x46')](_0x544000[_0xc19d('0x43')]['fields']));_0x35217d[_0xc19d('0x47')]=_0x35217d['attributes']['length']?_0x35217d[_0xc19d('0x47')]:_0x26cdf0[_0xc19d('0x42')];if(!_0x544000[_0xc19d('0x43')][_0xc19d('0x48')](_0xc19d('0x49'))){_0x35217d[_0xc19d('0x1e')]=qs[_0xc19d('0x1e')](_0x544000[_0xc19d('0x43')][_0xc19d('0x1e')]);_0x35217d[_0xc19d('0x20')]=qs[_0xc19d('0x20')](_0x544000[_0xc19d('0x43')][_0xc19d('0x20')]);}_0x35217d['order']=qs[_0xc19d('0x4a')](_0x544000[_0xc19d('0x43')][_0xc19d('0x4a')]);_0x35217d[_0xc19d('0x4b')]=qs[_0xc19d('0x45')](_[_0xc19d('0x4c')](_0x544000[_0xc19d('0x43')],_0x26cdf0['filters']),_0x407668);if(_0x544000[_0xc19d('0x43')][_0xc19d('0x2c')]){_0x35217d[_0xc19d('0x4b')]=_[_0xc19d('0x39')](_0x35217d[_0xc19d('0x4b')],{'$or':_[_0xc19d('0x2d')](_0x407668,function(_0x4bb0a3){if(_0x4bb0a3[_0xc19d('0x30')]!==_0xc19d('0x4d')){var _0x671eb={};_0x671eb[_0x4bb0a3[_0xc19d('0x32')]]={'$like':'%'+_0x544000['query'][_0xc19d('0x2c')]+'%'};return _0x671eb;}})});}_0x35217d=_[_0xc19d('0x39')]({},_0x35217d,_0x544000['options']);var _0x4cf5d3={'where':_0x35217d[_0xc19d('0x4b')]};return db[_0xc19d('0x3f')]['count'](_0x4cf5d3)[_0xc19d('0x34')](function(_0x1f1f33){_0x297263[_0xc19d('0x1f')]=_0x1f1f33;if(_0x544000[_0xc19d('0x43')]['includeAll']){_0x35217d[_0xc19d('0x4e')]=[{'all':!![]}];}return db[_0xc19d('0x3f')]['findAll'](_0x35217d);})[_0xc19d('0x34')](function(_0x3c37b7){_0x297263[_0xc19d('0x4f')]=_0x3c37b7;return _0x297263;})['then'](respondWithFilteredResult(_0x217728,_0x35217d))[_0xc19d('0x50')](handleError(_0x217728,null));};exports[_0xc19d('0x51')]=function(_0x399f6a,_0x30ef28){var _0x5e47e1={'raw':![],'where':{'id':_0x399f6a['params']['id']}},_0x39ae36={};_0x39ae36['model']=_[_0xc19d('0x44')](db[_0xc19d('0x3f')][_0xc19d('0x52')]);_0x39ae36[_0xc19d('0x43')]=_['keys'](_0x399f6a[_0xc19d('0x43')]);_0x39ae36[_0xc19d('0x45')]=_[_0xc19d('0x53')](_0x39ae36[_0xc19d('0x42')],_0x39ae36['query']);_0x5e47e1[_0xc19d('0x47')]=_[_0xc19d('0x53')](_0x39ae36[_0xc19d('0x42')],qs[_0xc19d('0x46')](_0x399f6a[_0xc19d('0x43')][_0xc19d('0x46')]));_0x5e47e1[_0xc19d('0x47')]=_0x5e47e1[_0xc19d('0x47')][_0xc19d('0x54')]?_0x5e47e1['attributes']:_0x39ae36[_0xc19d('0x42')];if(_0x399f6a[_0xc19d('0x43')][_0xc19d('0x55')]){_0x5e47e1['include']=[{'all':!![]}];}_0x5e47e1=_[_0xc19d('0x39')]({},_0x5e47e1,_0x399f6a[_0xc19d('0x56')]);return db[_0xc19d('0x3f')]['find'](_0x5e47e1)[_0xc19d('0x34')](handleEntityNotFound(_0x30ef28,null))[_0xc19d('0x34')](respondWithResult(_0x30ef28,null))[_0xc19d('0x50')](handleError(_0x30ef28,null));};exports['destroy']=function(_0x180e02,_0x3ac1c1){return db[_0xc19d('0x3f')][_0xc19d('0x31')]({'where':{'id':_0x180e02[_0xc19d('0x57')]['id']}})[_0xc19d('0x34')](handleEntityNotFound(_0x3ac1c1,null))[_0xc19d('0x34')](removeEntity(_0x3ac1c1,null))[_0xc19d('0x50')](handleError(_0x3ac1c1,null));};exports[_0xc19d('0x58')]=function(_0x43ebef,_0x44f368){if(_0x43ebef['body']['type']==='outbound'&&!_[_0xc19d('0x59')](_0x43ebef[_0xc19d('0x3a')][_0xc19d('0x5a')],'_')){_0x43ebef[_0xc19d('0x3a')]['exten']='_'['concat'](_0x43ebef['body']['exten']);}return db[_0xc19d('0x3f')][_0xc19d('0x58')](_0x43ebef[_0xc19d('0x3a')],{'raw':![]})[_0xc19d('0x34')](function(_0x539037){var _0x299df3=_0x43ebef['user'][_0xc19d('0x26')]({'plain':!![]});if(!_0x299df3)throw new Error(_0xc19d('0x5b'));if(_0x299df3['role']==='user'){var _0x2ad2cd=_0x539037['get']({'plain':!![]});var _0x4f9756=[{'name':_0xc19d('0x27'),'value':_0xc19d('0x28')},{'name':_0xc19d('0x29'),'value':'outbound'},{'name':'InternalRoutes','value':_0xc19d('0x5c')}];var _0xb706f2=_[_0xc19d('0x31')](_0x4f9756,['value',_0x2ad2cd[_0xc19d('0x30')]])['name'];return db[_0xc19d('0x5d')][_0xc19d('0x31')]({'where':{'name':_0xb706f2,'userProfileId':_0x299df3[_0xc19d('0x5e')]},'raw':!![]})[_0xc19d('0x34')](function(_0x584e9d){if(_0x584e9d&&_0x584e9d[_0xc19d('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0x2ad2cd[_0xc19d('0x32')],'resourceId':_0x2ad2cd['id'],'type':_0x584e9d[_0xc19d('0x32')],'sectionId':_0x584e9d['id']},{})[_0xc19d('0x34')](function(){return _0x539037;});}else{return _0x539037;}})['catch'](function(_0x38c4da){logger[_0xc19d('0x36')](_0xc19d('0x60'),_0x38c4da);throw _0x38c4da;});}return _0x539037;})[_0xc19d('0x34')](respondWithResult(_0x44f368,0xc9))[_0xc19d('0x50')](handleError(_0x44f368,null));};exports[_0xc19d('0x24')]=function(_0x3bc959,_0x425e98){if(_0x3bc959[_0xc19d('0x3a')]['id']){delete _0x3bc959[_0xc19d('0x3a')]['id'];}return db[_0xc19d('0x3f')][_0xc19d('0x31')]({'where':{'id':_0x3bc959[_0xc19d('0x57')]['id']}})['then'](handleEntityNotFound(_0x425e98,null))[_0xc19d('0x34')](function(_0x114092){if(_0x114092){return db[_0xc19d('0x3f')]['update'](_[_0xc19d('0x4c')](_0x3bc959[_0xc19d('0x3a')],[_0xc19d('0x5a'),_0xc19d('0x61'),_0xc19d('0x62'),_0xc19d('0x63'),_0xc19d('0x64'),_0xc19d('0x65')]),{'where':{'context':_0x114092[_0xc19d('0x61')],'exten':_0x114092[_0xc19d('0x5a')]},'individualHooks':!![]})['then'](function(_0xc60675){return _0xc60675;});}return null;})[_0xc19d('0x34')](respondWithStatusCode(_0x425e98,null))[_0xc19d('0x50')](handleError(_0x425e98,null));};exports[_0xc19d('0x66')]=function(_0x4573d3,_0xfc5fba,_0x2518e8){return db[_0xc19d('0x3f')][_0xc19d('0x67')]({'where':{'id':_0x4573d3['params']['id']}})[_0xc19d('0x34')](handleEntityNotFound(_0xfc5fba,null))[_0xc19d('0x34')](function(_0x10ed3b){if(_0x10ed3b){return db[_0xc19d('0x68')][_0xc19d('0x69')](function(_0x53a84f){return db['VoiceExtension'][_0xc19d('0x25')]({'where':{'VoiceExtensionId':_0x4573d3[_0xc19d('0x57')]['id']},'transaction':_0x53a84f})[_0xc19d('0x34')](function(_0x27eee4){var _0x5c171d=_[_0xc19d('0x2d')](_0x4573d3['body'],function(_0x2f43a5){_0x2f43a5[_0xc19d('0x6a')]=_0x4573d3[_0xc19d('0x57')]['id'];return _0x2f43a5;});return db['VoiceExtension'][_0xc19d('0x6b')](_0x5c171d,{'transaction':_0x53a84f});});})[_0xc19d('0x34')](function(){return db['VoiceExtension'][_0xc19d('0x6c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4573d3['params']['id']},'order':_0xc19d('0x6d')});});}})[_0xc19d('0x34')](respondWithResult(_0xfc5fba,null))[_0xc19d('0x50')](handleError(_0xfc5fba,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 94ac88d..29d16e5 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 _0x939a=['setMaxListeners','save','update','emit','exports','events','../../mysqldb','VoiceExtension'];(function(_0x1b43ce,_0x5fd476){var _0x2f4900=function(_0x49dfd6){while(--_0x49dfd6){_0x1b43ce['push'](_0x1b43ce['shift']());}};_0x2f4900(++_0x5fd476);}(_0x939a,0x12d));var _0xa939=function(_0x38be77,_0x41f5d0){_0x38be77=_0x38be77-0x0;var _0x33c634=_0x939a[_0x38be77];return _0x33c634;};'use strict';var EventEmitter=require(_0xa939('0x0'));var VoiceExtension=require(_0xa939('0x1'))['db'][_0xa939('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xa939('0x3')](0x0);var events={'afterCreate':_0xa939('0x4'),'afterUpdate':_0xa939('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3c3045){return function(_0x564b5c,_0x1bc30a,_0x376fa6){VoiceExtensionEvents[_0xa939('0x6')](_0x3c3045+':'+_0x564b5c['id'],_0x564b5c);VoiceExtensionEvents[_0xa939('0x6')](_0x3c3045,_0x564b5c);_0x376fa6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xa939('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x8ac5=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension'];(function(_0x349481,_0x1f4059){var _0x3cc046=function(_0xb2acaf){while(--_0xb2acaf){_0x349481['push'](_0x349481['shift']());}};_0x3cc046(++_0x1f4059);}(_0x8ac5,0x105));var _0x58ac=function(_0x49c6cc,_0x308bdb){_0x49c6cc=_0x49c6cc-0x0;var _0x22e239=_0x8ac5[_0x49c6cc];return _0x22e239;};'use strict';var EventEmitter=require(_0x58ac('0x0'));var VoiceExtension=require(_0x58ac('0x1'))['db'][_0x58ac('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x58ac('0x3')](0x0);var events={'afterCreate':_0x58ac('0x4'),'afterUpdate':_0x58ac('0x5'),'afterDestroy':_0x58ac('0x6')};function emitEvent(_0x276bc0){return function(_0x474fa3,_0x27aae0,_0x4d6dfb){VoiceExtensionEvents[_0x58ac('0x7')](_0x276bc0+':'+_0x474fa3['id'],_0x474fa3);VoiceExtensionEvents[_0x58ac('0x7')](_0x276bc0,_0x474fa3);_0x4d6dfb(null);};}for(var e in events){if(events[_0x58ac('0x8')](e)){var event=events[e];VoiceExtension[_0x58ac('0x9')](e,emitEvent(event));}}module[_0x58ac('0xa')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index e30c998..8a2b825 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 _0xbb27=['./voiceExtension.attributes','exports','voice_extensions','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x41d2d4,_0x12bcf4){var _0x225e0f=function(_0x8464f5){while(--_0x8464f5){_0x41d2d4['push'](_0x41d2d4['shift']());}};_0x225e0f(++_0x12bcf4);}(_0xbb27,0xcf));var _0x7bb2=function(_0x4f749a,_0x541f4f){_0x4f749a=_0x4f749a-0x0;var _0x1152b7=_0xbb27[_0x4f749a];return _0x1152b7;};'use strict';var _=require(_0x7bb2('0x0'));var util=require(_0x7bb2('0x1'));var logger=require(_0x7bb2('0x2'))(_0x7bb2('0x3'));var moment=require('moment');var BPromise=require(_0x7bb2('0x4'));var rp=require(_0x7bb2('0x5'));var fs=require('fs');var path=require(_0x7bb2('0x6'));var rimraf=require(_0x7bb2('0x7'));var config=require(_0x7bb2('0x8'));var attributes=require(_0x7bb2('0x9'));module[_0x7bb2('0xa')]=function(_0x5170fe,_0x1349e0){return _0x5170fe['define']('VoiceExtension',attributes,{'tableName':_0x7bb2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcad8=['bluebird','path','rimraf','../../config/environment','exports','define','voice_extensions','lodash','util','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcad8,0xac));var _0x8cad=function(_0x25e8bf,_0x24205c){_0x25e8bf=_0x25e8bf-0x0;var _0x163352=_0xcad8[_0x25e8bf];return _0x163352;};'use strict';var _=require(_0x8cad('0x0'));var util=require(_0x8cad('0x1'));var logger=require('../../config/logger')(_0x8cad('0x2'));var moment=require(_0x8cad('0x3'));var BPromise=require(_0x8cad('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8cad('0x5'));var rimraf=require(_0x8cad('0x6'));var config=require(_0x8cad('0x7'));var attributes=require('./voiceExtension.attributes');module[_0x8cad('0x8')]=function(_0x289796,_0x24c256){return _0x289796[_0x8cad('0x9')]('VoiceExtension',attributes,{'tableName':_0x8cad('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index f0e1136..d8f7ee0 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 _0xeb80=['include','map','model','GetVoiceExtension','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceExtension','findAll','options','raw','where','attributes','limit'];(function(_0x45cbcf,_0xfbdbc2){var _0x52ece8=function(_0x498579){while(--_0x498579){_0x45cbcf['push'](_0x45cbcf['shift']());}};_0x52ece8(++_0xfbdbc2);}(_0xeb80,0xcc));var _0x0eb8=function(_0x28e56f,_0x4e1678){_0x28e56f=_0x28e56f-0x0;var _0xc3ac33=_0xeb80[_0x28e56f];return _0xc3ac33;};'use strict';var _=require(_0x0eb8('0x0'));var util=require('util');var moment=require(_0x0eb8('0x1'));var BPromise=require(_0x0eb8('0x2'));var rs=require(_0x0eb8('0x3'));var fs=require('fs');var Redis=require(_0x0eb8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0eb8('0x5'));var logger=require(_0x0eb8('0x6'))('rpc');var config=require(_0x0eb8('0x7'));var jayson=require(_0x0eb8('0x8'));var client=jayson[_0x0eb8('0x9')][_0x0eb8('0xa')]({'port':0x232a});config[_0x0eb8('0xb')]=_[_0x0eb8('0xc')](config['redis'],{'host':_0x0eb8('0xd'),'port':0x18eb});var socket=require(_0x0eb8('0xe'))(new Redis(config[_0x0eb8('0xb')]));require(_0x0eb8('0xf'))['register'](socket);function respondWithRpcPromise(_0x309c47,_0x5333d0,_0x1342ad){return new BPromise(function(_0x501e7d,_0x48bb70){return client[_0x0eb8('0x10')](_0x309c47,_0x1342ad)[_0x0eb8('0x11')](function(_0x4c46f8){logger[_0x0eb8('0x12')](_0x0eb8('0x13'),_0x5333d0,'request\x20sent');logger[_0x0eb8('0x14')](_0x0eb8('0x15'),_0x5333d0,_0x0eb8('0x16'),JSON[_0x0eb8('0x17')](_0x4c46f8));if(_0x4c46f8[_0x0eb8('0x18')]){if(_0x4c46f8[_0x0eb8('0x18')][_0x0eb8('0x19')]===0x1f4){logger[_0x0eb8('0x18')](_0x0eb8('0x13'),_0x5333d0,_0x4c46f8[_0x0eb8('0x18')][_0x0eb8('0x1a')]);return _0x48bb70(_0x4c46f8['error'][_0x0eb8('0x1a')]);}logger[_0x0eb8('0x18')](_0x0eb8('0x13'),_0x5333d0,_0x4c46f8['error'][_0x0eb8('0x1a')]);return _0x501e7d(_0x4c46f8[_0x0eb8('0x18')]['message']);}else{logger[_0x0eb8('0x12')](_0x0eb8('0x13'),_0x5333d0,_0x0eb8('0x16'));_0x501e7d(_0x4c46f8[_0x0eb8('0x1b')][_0x0eb8('0x1a')]);}})[_0x0eb8('0x1c')](function(_0xf22423){logger[_0x0eb8('0x18')](_0x0eb8('0x13'),_0x5333d0,_0xf22423);_0x48bb70(_0xf22423);});});}exports['GetVoiceExtension']=function(_0x40d9ca){var _0x1e908a=this;return new Promise(function(_0x59fc39,_0x3c32fd){return db[_0x0eb8('0x1d')][_0x0eb8('0x1e')]({'raw':_0x40d9ca['options']?_0x40d9ca[_0x0eb8('0x1f')][_0x0eb8('0x20')]===undefined?!![]:![]:!![],'where':_0x40d9ca[_0x0eb8('0x1f')]?_0x40d9ca['options'][_0x0eb8('0x21')]||null:null,'attributes':_0x40d9ca[_0x0eb8('0x1f')]?_0x40d9ca['options'][_0x0eb8('0x22')]||null:null,'limit':_0x40d9ca[_0x0eb8('0x1f')]?_0x40d9ca[_0x0eb8('0x1f')][_0x0eb8('0x23')]||null:null,'include':_0x40d9ca['options']?_0x40d9ca[_0x0eb8('0x1f')][_0x0eb8('0x24')]?_[_0x0eb8('0x25')](_0x40d9ca[_0x0eb8('0x1f')]['include'],function(_0x38c2ba){return{'model':db[_0x38c2ba[_0x0eb8('0x26')]],'as':_0x38c2ba['as'],'attributes':_0x38c2ba[_0x0eb8('0x22')],'include':_0x38c2ba[_0x0eb8('0x24')]?_[_0x0eb8('0x25')](_0x38c2ba[_0x0eb8('0x24')],function(_0x457c3b){return{'model':db[_0x457c3b[_0x0eb8('0x26')]],'as':_0x457c3b['as'],'attributes':_0x457c3b[_0x0eb8('0x22')],'include':_0x457c3b[_0x0eb8('0x24')]?_[_0x0eb8('0x25')](_0x457c3b['include'],function(_0x5ae1bf){return{'model':db[_0x5ae1bf[_0x0eb8('0x26')]],'as':_0x5ae1bf['as'],'attributes':_0x5ae1bf[_0x0eb8('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0eb8('0x11')](function(_0xb59f){logger[_0x0eb8('0x12')]('GetVoiceExtension',_0x40d9ca);logger[_0x0eb8('0x14')](_0x0eb8('0x27'),_0x40d9ca,JSON['stringify'](_0xb59f));_0x59fc39(_0xb59f);})[_0x0eb8('0x1c')](function(_0x3a8d46){logger[_0x0eb8('0x18')](_0x0eb8('0x27'),_0x3a8d46[_0x0eb8('0x1a')],_0x40d9ca);_0x3c32fd(_0x1e908a[_0x0eb8('0x18')](0x1f4,_0x3a8d46[_0x0eb8('0x1a')]));});});}; \ No newline at end of file +var _0xa8a5=['client','http','defaults','localhost','socket.io-emitter','redis','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','raw','options','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','ioredis','jayson/promise'];(function(_0x5c7939,_0x22f61e){var _0x5bcfbc=function(_0x80c86){while(--_0x80c86){_0x5c7939['push'](_0x5c7939['shift']());}};_0x5bcfbc(++_0x22f61e);}(_0xa8a5,0x13e));var _0x5a8a=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0xa8a5[_0x99868f];return _0x27a71b;};'use strict';var _=require(_0x5a8a('0x0'));var util=require(_0x5a8a('0x1'));var moment=require(_0x5a8a('0x2'));var BPromise=require('bluebird');var rs=require(_0x5a8a('0x3'));var fs=require('fs');var Redis=require(_0x5a8a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5a8a('0x5'));var client=jayson[_0x5a8a('0x6')][_0x5a8a('0x7')]({'port':0x232a});config['redis']=_[_0x5a8a('0x8')](config['redis'],{'host':_0x5a8a('0x9'),'port':0x18eb});var socket=require(_0x5a8a('0xa'))(new Redis(config[_0x5a8a('0xb')]));require(_0x5a8a('0xc'))[_0x5a8a('0xd')](socket);function respondWithRpcPromise(_0xe08dac,_0x292533,_0x2ed186){return new BPromise(function(_0x13a158,_0x51db9b){return client['request'](_0xe08dac,_0x2ed186)[_0x5a8a('0xe')](function(_0x4d33d1){logger[_0x5a8a('0xf')](_0x5a8a('0x10'),_0x292533,'request\x20sent');logger[_0x5a8a('0x11')](_0x5a8a('0x12'),_0x292533,_0x5a8a('0x13'),JSON[_0x5a8a('0x14')](_0x4d33d1));if(_0x4d33d1[_0x5a8a('0x15')]){if(_0x4d33d1[_0x5a8a('0x15')]['code']===0x1f4){logger[_0x5a8a('0x15')](_0x5a8a('0x10'),_0x292533,_0x4d33d1['error'][_0x5a8a('0x16')]);return _0x51db9b(_0x4d33d1[_0x5a8a('0x15')]['message']);}logger['error'](_0x5a8a('0x10'),_0x292533,_0x4d33d1['error'][_0x5a8a('0x16')]);return _0x13a158(_0x4d33d1[_0x5a8a('0x15')]['message']);}else{logger[_0x5a8a('0xf')](_0x5a8a('0x10'),_0x292533,_0x5a8a('0x13'));_0x13a158(_0x4d33d1[_0x5a8a('0x17')][_0x5a8a('0x16')]);}})[_0x5a8a('0x18')](function(_0x113788){logger[_0x5a8a('0x15')](_0x5a8a('0x10'),_0x292533,_0x113788);_0x51db9b(_0x113788);});});}exports[_0x5a8a('0x19')]=function(_0x1f7729){var _0x4e9ef2=this;return new Promise(function(_0x398128,_0x6c48f4){return db[_0x5a8a('0x1a')][_0x5a8a('0x1b')]({'raw':_0x1f7729['options']?_0x1f7729['options'][_0x5a8a('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f7729['options']?_0x1f7729[_0x5a8a('0x1d')][_0x5a8a('0x1e')]||null:null,'attributes':_0x1f7729['options']?_0x1f7729[_0x5a8a('0x1d')][_0x5a8a('0x1f')]||null:null,'limit':_0x1f7729[_0x5a8a('0x1d')]?_0x1f7729['options'][_0x5a8a('0x20')]||null:null,'include':_0x1f7729[_0x5a8a('0x1d')]?_0x1f7729[_0x5a8a('0x1d')][_0x5a8a('0x21')]?_[_0x5a8a('0x22')](_0x1f7729['options'][_0x5a8a('0x21')],function(_0x4e7d33){return{'model':db[_0x4e7d33[_0x5a8a('0x23')]],'as':_0x4e7d33['as'],'attributes':_0x4e7d33['attributes'],'include':_0x4e7d33[_0x5a8a('0x21')]?_[_0x5a8a('0x22')](_0x4e7d33[_0x5a8a('0x21')],function(_0x504435){return{'model':db[_0x504435['model']],'as':_0x504435['as'],'attributes':_0x504435[_0x5a8a('0x1f')],'include':_0x504435[_0x5a8a('0x21')]?_[_0x5a8a('0x22')](_0x504435[_0x5a8a('0x21')],function(_0x206089){return{'model':db[_0x206089[_0x5a8a('0x23')]],'as':_0x206089['as'],'attributes':_0x206089['attributes']};}):[]};}):[]};}):[]:[]})[_0x5a8a('0xe')](function(_0xf3eb38){logger['info'](_0x5a8a('0x19'),_0x1f7729);logger['debug'](_0x5a8a('0x19'),_0x1f7729,JSON[_0x5a8a('0x14')](_0xf3eb38));_0x398128(_0xf3eb38);})[_0x5a8a('0x18')](function(_0x17edcd){logger[_0x5a8a('0x15')](_0x5a8a('0x19'),_0x17edcd[_0x5a8a('0x16')],_0x1f7729);_0x6c48f4(_0x4e9ef2[_0x5a8a('0x15')](0x1f4,_0x17edcd[_0x5a8a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index df40713..0afd092 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 _0x8f5f=['voiceExtension:','./voiceExtension.events','save','remove','update','removeListener','register'];(function(_0x59ffac,_0x2abbb2){var _0x22a20b=function(_0x122cff){while(--_0x122cff){_0x59ffac['push'](_0x59ffac['shift']());}};_0x22a20b(++_0x2abbb2);}(_0x8f5f,0xe1));var _0xf8f5=function(_0x1dbaf7,_0x3d05b3){_0x1dbaf7=_0x1dbaf7-0x0;var _0x593f05=_0x8f5f[_0x1dbaf7];return _0x593f05;};'use strict';var VoiceExtensionEvents=require(_0xf8f5('0x0'));var events=[_0xf8f5('0x1'),_0xf8f5('0x2'),_0xf8f5('0x3')];function createListener(_0x39d4f2,_0x5dc84d){return function(_0x3459e0){_0x5dc84d['emit'](_0x39d4f2,_0x3459e0);};}function removeListener(_0x1ef89c,_0x2e2131){return function(){VoiceExtensionEvents[_0xf8f5('0x4')](_0x1ef89c,_0x2e2131);};}exports[_0xf8f5('0x5')]=function(_0x484870){for(var _0x334d46=0x0,_0x483aff=events['length'];_0x334d46<_0x483aff;_0x334d46++){var _0x2ae391=events[_0x334d46];var _0x15c6ca=createListener(_0xf8f5('0x6')+_0x2ae391,_0x484870);VoiceExtensionEvents['on'](_0x2ae391,_0x15c6ca);}}; \ No newline at end of file +var _0xf76a=['remove','update','emit','register','length','./voiceExtension.events','save'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xf76a,0x147));var _0xaf76=function(_0x4363b8,_0xf6c1f2){_0x4363b8=_0x4363b8-0x0;var _0x2d9a66=_0xf76a[_0x4363b8];return _0x2d9a66;};'use strict';var VoiceExtensionEvents=require(_0xaf76('0x0'));var events=[_0xaf76('0x1'),_0xaf76('0x2'),_0xaf76('0x3')];function createListener(_0x267962,_0x54e272){return function(_0x1c3b9a){_0x54e272[_0xaf76('0x4')](_0x267962,_0x1c3b9a);};}function removeListener(_0xe5efc4,_0x1730ae){return function(){VoiceExtensionEvents['removeListener'](_0xe5efc4,_0x1730ae);};}exports[_0xaf76('0x5')]=function(_0x3baf71){for(var _0x66a0c2=0x0,_0x2e8319=events[_0xaf76('0x6')];_0x66a0c2<_0x2e8319;_0x66a0c2++){var _0x10b79b=events[_0x66a0c2];var _0x5afee8=createListener('voiceExtension:'+_0x10b79b,_0x3baf71);VoiceExtensionEvents['on'](_0x10b79b,_0x5afee8);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 917f2a7..698d0d1 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 _0xf6e8=['fs-extra','../../components/interaction/service','./voiceMail.controller','get','index','/:id','isAuthenticated','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xf6e8,0xc1));var _0x8f6e=function(_0x12ff59,_0x14b00c){_0x12ff59=_0x12ff59-0x0;var _0x48aaf8=_0xf6e8[_0x12ff59];return _0x48aaf8;};'use strict';var multer=require('multer');var util=require(_0x8f6e('0x0'));var path=require(_0x8f6e('0x1'));var timeout=require(_0x8f6e('0x2'));var express=require(_0x8f6e('0x3'));var router=express[_0x8f6e('0x4')]();var fs_extra=require(_0x8f6e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8f6e('0x6'));var config=require('../../config/environment');var controller=require(_0x8f6e('0x7'));router[_0x8f6e('0x8')]('/',auth['isAuthenticated'](),controller[_0x8f6e('0x9')]);router[_0x8f6e('0x8')](_0x8f6e('0xa'),auth[_0x8f6e('0xb')](),controller[_0x8f6e('0xc')]);router[_0x8f6e('0x8')](_0x8f6e('0xd'),auth[_0x8f6e('0xb')](),controller[_0x8f6e('0xe')]);router[_0x8f6e('0xf')]('/',auth['isAuthenticated'](),controller[_0x8f6e('0x10')]);router[_0x8f6e('0x11')]('/:id',auth[_0x8f6e('0xb')](),controller[_0x8f6e('0x12')]);router[_0x8f6e('0x13')](_0x8f6e('0xa'),auth[_0x8f6e('0xb')](),controller[_0x8f6e('0x14')]);module[_0x8f6e('0x15')]=router; \ No newline at end of file +var _0x4b0f=['show','/:id/messages','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id'];(function(_0x741b9a,_0x44c670){var _0x4bf212=function(_0x55e5b6){while(--_0x55e5b6){_0x741b9a['push'](_0x741b9a['shift']());}};_0x4bf212(++_0x44c670);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x1947c7,_0x524b2c){_0x1947c7=_0x1947c7-0x0;var _0xbbca75=_0x4b0f[_0x1947c7];return _0xbbca75;};'use strict';var multer=require('multer');var util=require(_0xf4b0('0x0'));var path=require(_0xf4b0('0x1'));var timeout=require(_0xf4b0('0x2'));var express=require('express');var router=express[_0xf4b0('0x3')]();var fs_extra=require(_0xf4b0('0x4'));var auth=require(_0xf4b0('0x5'));var interaction=require(_0xf4b0('0x6'));var config=require(_0xf4b0('0x7'));var controller=require(_0xf4b0('0x8'));router[_0xf4b0('0x9')]('/',auth[_0xf4b0('0xa')](),controller[_0xf4b0('0xb')]);router[_0xf4b0('0x9')](_0xf4b0('0xc'),auth[_0xf4b0('0xa')](),controller[_0xf4b0('0xd')]);router[_0xf4b0('0x9')](_0xf4b0('0xe'),auth[_0xf4b0('0xa')](),controller['getMessages']);router[_0xf4b0('0xf')]('/',auth[_0xf4b0('0xa')](),controller[_0xf4b0('0x10')]);router[_0xf4b0('0x11')](_0xf4b0('0xc'),auth[_0xf4b0('0xa')](),controller[_0xf4b0('0x12')]);router[_0xf4b0('0x13')](_0xf4b0('0xc'),auth[_0xf4b0('0xa')](),controller[_0xf4b0('0x14')]);module[_0xf4b0('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index d47b69a..09f8db8 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 _0x5eb8=['email','trim','central','yes','ENUM','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0x36fc5d,_0x3380a1){var _0x386a98=function(_0x2a7fb0){while(--_0x2a7fb0){_0x36fc5d['push'](_0x36fc5d['shift']());}};_0x386a98(++_0x3380a1);}(_0x5eb8,0xb0));var _0x85eb=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0x5eb8[_0x328534];return _0x2796c0;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x85eb('0x0')]},'context':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':_0x85eb('0x1'),'unique':_0x85eb('0x2')},'mailbox':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':'','allowNull':![],'unique':_0x85eb('0x2')},'password':{'type':Sequelize[_0x85eb('0x0')]},'fullname':{'type':Sequelize[_0x85eb('0x0')]},'email':{'type':Sequelize[_0x85eb('0x0')],'validate':{'isEmail':!![]},'set':function(_0x1fde1a){this[_0x85eb('0x3')](_0x85eb('0x4'),typeof _0x1fde1a==='string'&&_0x1fde1a[_0x85eb('0x5')]()?_0x1fde1a[_0x85eb('0x5')]():null);}},'pager':{'type':Sequelize[_0x85eb('0x0')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x85eb('0x6')},'attach':{'type':Sequelize['ENUM'](_0x85eb('0x7'),'no'),'defaultValue':_0x85eb('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x85eb('0x8')](_0x85eb('0x7'),'no'),'defaultValue':_0x85eb('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x85eb('0x0')]},'callback':{'type':Sequelize[_0x85eb('0x0')]},'review':{'type':Sequelize['ENUM'](_0x85eb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x85eb('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x85eb('0x8')](_0x85eb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x85eb('0x8')](_0x85eb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x85eb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x85eb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x85eb('0x8')](_0x85eb('0x7'),'no'),'defaultValue':_0x85eb('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x85eb('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x85eb('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x85eb('0x8')](_0x85eb('0x7'),'no'),'defaultValue':_0x85eb('0x7'),'allowNull':![]},'stamp':{'type':_0x85eb('0x9')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x85eb('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x85eb('0xb')],'get':function(){return this[_0x85eb('0xc')](_0x85eb('0xd'))+_0x85eb('0xe')+this[_0x85eb('0xc')]('mailbox');}}}; \ No newline at end of file +var _0xb688=['STRING','from-voicemail','contest_mailbox','email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','exports'];(function(_0x44dba1,_0x270ad5){var _0x2fbd3f=function(_0x5e0865){while(--_0x5e0865){_0x44dba1['push'](_0x44dba1['shift']());}};_0x2fbd3f(++_0x270ad5);}(_0xb688,0xcf));var _0x8b68=function(_0x5c4abf,_0x4cbf66){_0x5c4abf=_0x5c4abf-0x0;var _0x14a441=_0xb688[_0x5c4abf];return _0x14a441;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'customer_id':{'type':Sequelize[_0x8b68('0x1')]},'context':{'type':Sequelize[_0x8b68('0x1')],'defaultValue':_0x8b68('0x2'),'unique':_0x8b68('0x3')},'mailbox':{'type':Sequelize[_0x8b68('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x8b68('0x1')]},'fullname':{'type':Sequelize[_0x8b68('0x1')]},'email':{'type':Sequelize[_0x8b68('0x1')],'validate':{'isEmail':!![]},'set':function(_0x12d40e){this['setDataValue'](_0x8b68('0x4'),typeof _0x12d40e==='string'&&_0x12d40e[_0x8b68('0x5')]()?_0x12d40e[_0x8b68('0x5')]():null);}},'pager':{'type':Sequelize[_0x8b68('0x1')]},'tz':{'type':Sequelize[_0x8b68('0x1')],'defaultValue':_0x8b68('0x6')},'attach':{'type':Sequelize[_0x8b68('0x7')](_0x8b68('0x8'),'no'),'defaultValue':_0x8b68('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x8b68('0x7')](_0x8b68('0x8'),'no'),'defaultValue':_0x8b68('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x8b68('0x1')]},'callback':{'type':Sequelize[_0x8b68('0x1')]},'review':{'type':Sequelize['ENUM'](_0x8b68('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8b68('0x7')](_0x8b68('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8b68('0x7')](_0x8b68('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8b68('0x7')](_0x8b68('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8b68('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8b68('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8b68('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x8b68('0x8'),'no'),'defaultValue':_0x8b68('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8b68('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x8b68('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x8b68('0x8'),'no'),'defaultValue':_0x8b68('0x8'),'allowNull':![]},'stamp':{'type':_0x8b68('0xa')},'emailsubject':{'type':Sequelize[_0x8b68('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x8b68('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x8b68('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8b68('0xc')](_0x8b68('0xd'))+_0x8b68('0xe')+this[_0x8b68('0xc')](_0x8b68('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index a3e6e03..2995a1c 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 _0x4ef5=['sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','Voicemails','destroy','end','sendStatus','error','stack','name','send','render','merge','body','message','account','index','map','VoiceMail','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','options','findAll','rows','catch','params','keys','includeAll','include','find','create','user','get','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','nolimit','VoiceMailMessage','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x4e3d48,_0x2c2719){var _0x48f446=function(_0x48d158){while(--_0x48d158){_0x4e3d48['push'](_0x4e3d48['shift']());}};_0x48f446(++_0x2c2719);}(_0x4ef5,0x1af));var _0x54ef=function(_0x4d09b6,_0x633483){_0x4d09b6=_0x4d09b6-0x0;var _0x2e9899=_0x4ef5[_0x4d09b6];return _0x2e9899;};'use strict';var emlformat=require(_0x54ef('0x0'));var rimraf=require(_0x54ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x54ef('0x2'));var rp=require(_0x54ef('0x3'));var moment=require(_0x54ef('0x4'));var BPromise=require(_0x54ef('0x5'));var Mustache=require(_0x54ef('0x6'));var util=require(_0x54ef('0x7'));var path=require(_0x54ef('0x8'));var sox=require(_0x54ef('0x9'));var csv=require(_0x54ef('0xa'));var ejs=require(_0x54ef('0xb'));var fs=require('fs');var fs_extra=require(_0x54ef('0xc'));var _=require(_0x54ef('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x54ef('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x54ef('0xf'));var Redis=require('ioredis');var authService=require(_0x54ef('0x10'));var qs=require(_0x54ef('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x54ef('0x12'));var utils=require(_0x54ef('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x54ef('0x14'));var db=require(_0x54ef('0x15'))['db'];function respondWithStatusCode(_0x1d4d10,_0x216ce8){_0x216ce8=_0x216ce8||0xcc;return function(_0x3a575b){if(_0x3a575b){return _0x1d4d10['sendStatus'](_0x216ce8);}return _0x1d4d10[_0x54ef('0x16')](_0x216ce8)['end']();};}function respondWithResult(_0x2cd59e,_0x476477){_0x476477=_0x476477||0xc8;return function(_0x93c844){if(_0x93c844){return _0x2cd59e[_0x54ef('0x16')](_0x476477)[_0x54ef('0x17')](_0x93c844);}};}function respondWithFilteredResult(_0x4d3356,_0x39e2cb){return function(_0x2c6235){if(_0x2c6235){var _0x25febd=typeof _0x39e2cb[_0x54ef('0x18')]===_0x54ef('0x19')&&typeof _0x39e2cb['limit']===_0x54ef('0x19');var _0x4296b0=_0x2c6235[_0x54ef('0x1a')];var _0x3ab87d=_0x25febd?0x0:_0x39e2cb[_0x54ef('0x18')];var _0x1700cf=_0x25febd?_0x2c6235[_0x54ef('0x1a')]:_0x39e2cb[_0x54ef('0x18')]+_0x39e2cb[_0x54ef('0x1b')];var _0x455acc;if(_0x1700cf>=_0x4296b0){_0x1700cf=_0x4296b0;_0x455acc=0xc8;}else{_0x455acc=0xce;}_0x4d3356[_0x54ef('0x16')](_0x455acc);return _0x4d3356[_0x54ef('0x1c')](_0x54ef('0x1d'),_0x3ab87d+'-'+_0x1700cf+'/'+_0x4296b0)[_0x54ef('0x17')](_0x2c6235);}return null;};}function patchUpdates(_0xabf729){return function(_0x43dcad){try{jsonpatch['apply'](_0x43dcad,_0xabf729,!![]);}catch(_0x410031){return BPromise[_0x54ef('0x1e')](_0x410031);}return _0x43dcad[_0x54ef('0x1f')]();};}function saveUpdates(_0x540bc1,_0x34b1c8){return function(_0x8d3c98){if(_0x8d3c98){return _0x8d3c98[_0x54ef('0x20')](_0x540bc1)[_0x54ef('0x21')](function(_0x58a6c2){return _0x58a6c2;});}return null;};}function removeEntity(_0xcfd0b0,_0x27dfe4){return function(_0x160e78){if(_0x160e78){return _0x160e78['destroy']()['then'](function(){var _0x46a18f=_0x160e78['get']({'plain':!![]});var _0x236189=_0x54ef('0x22');return db['UserProfileResource'][_0x54ef('0x23')]({'where':{'type':_0x236189,'resourceId':_0x46a18f['id']}})[_0x54ef('0x21')](function(){return _0x160e78;});})['then'](function(){_0xcfd0b0[_0x54ef('0x16')](0xcc)[_0x54ef('0x24')]();});}};}function handleEntityNotFound(_0x4d10b8,_0x39ec24){return function(_0x5884ef){if(!_0x5884ef){_0x4d10b8[_0x54ef('0x25')](0x194);}return _0x5884ef;};}function handleError(_0x76708f,_0x5c64bc){_0x5c64bc=_0x5c64bc||0x1f4;return function(_0x3d6b0d){logger[_0x54ef('0x26')](_0x3d6b0d[_0x54ef('0x27')]);if(_0x3d6b0d['name']){delete _0x3d6b0d[_0x54ef('0x28')];}_0x76708f[_0x54ef('0x16')](_0x5c64bc)[_0x54ef('0x29')](_0x3d6b0d);};}function getMustacheRender(_0x2902c0,_0x29fef2){return Mustache[_0x54ef('0x2a')](_0x2902c0,_[_0x54ef('0x2b')](_0x29fef2[_0x54ef('0x2c')],{'contact':_0x29fef2['contact'],'message':_0x29fef2[_0x54ef('0x2d')],'agent':_0x29fef2['agent'],'interaction':_0x29fef2['interaction'],'account':_0x29fef2[_0x54ef('0x2e')]}))||'';}exports[_0x54ef('0x2f')]=function(_0xea3bf8,_0x5a312c){var _0x332f52={},_0x34c447={},_0x128af4={'count':0x0,'rows':[]};var _0x2d4977=_[_0x54ef('0x30')](db[_0x54ef('0x31')][_0x54ef('0x32')],function(_0x4da383){return{'name':_0x4da383['fieldName'],'type':_0x4da383[_0x54ef('0x33')][_0x54ef('0x34')]};});_0x34c447['model']=_[_0x54ef('0x30')](_0x2d4977,_0x54ef('0x28'));_0x34c447[_0x54ef('0x35')]=_['keys'](_0xea3bf8['query']);_0x34c447[_0x54ef('0x36')]=_[_0x54ef('0x37')](_0x34c447['model'],_0x34c447[_0x54ef('0x35')]);_0x332f52['attributes']=_[_0x54ef('0x37')](_0x34c447[_0x54ef('0x38')],qs[_0x54ef('0x39')](_0xea3bf8[_0x54ef('0x35')][_0x54ef('0x39')]));_0x332f52[_0x54ef('0x3a')]=_0x332f52[_0x54ef('0x3a')][_0x54ef('0x3b')]?_0x332f52[_0x54ef('0x3a')]:_0x34c447[_0x54ef('0x38')];if(!_0xea3bf8[_0x54ef('0x35')][_0x54ef('0x3c')]('nolimit')){_0x332f52[_0x54ef('0x1b')]=qs['limit'](_0xea3bf8[_0x54ef('0x35')][_0x54ef('0x1b')]);_0x332f52[_0x54ef('0x18')]=qs[_0x54ef('0x18')](_0xea3bf8[_0x54ef('0x35')]['offset']);}_0x332f52[_0x54ef('0x3d')]=qs['sort'](_0xea3bf8[_0x54ef('0x35')][_0x54ef('0x3e')]);_0x332f52['where']=qs[_0x54ef('0x36')](_[_0x54ef('0x3f')](_0xea3bf8['query'],_0x34c447[_0x54ef('0x36')]),_0x2d4977);if(_0xea3bf8[_0x54ef('0x35')]['filter']){_0x332f52['where']=_[_0x54ef('0x2b')](_0x332f52[_0x54ef('0x40')],{'$or':_[_0x54ef('0x30')](_0x2d4977,function(_0x370f92){if(_0x370f92[_0x54ef('0x33')]!==_0x54ef('0x41')){var _0xef0135={};_0xef0135[_0x370f92[_0x54ef('0x28')]]={'$like':'%'+_0xea3bf8[_0x54ef('0x35')][_0x54ef('0x42')]+'%'};return _0xef0135;}})});}_0x332f52=_[_0x54ef('0x2b')]({},_0x332f52,_0xea3bf8[_0x54ef('0x43')]);var _0x5b1c3e={'where':_0x332f52[_0x54ef('0x40')]};return db[_0x54ef('0x31')][_0x54ef('0x1a')](_0x5b1c3e)[_0x54ef('0x21')](function(_0x46bb4c){_0x128af4[_0x54ef('0x1a')]=_0x46bb4c;if(_0xea3bf8['query']['includeAll']){_0x332f52['include']=[{'all':!![]}];}return db[_0x54ef('0x31')][_0x54ef('0x44')](_0x332f52);})[_0x54ef('0x21')](function(_0x53b821){_0x128af4[_0x54ef('0x45')]=_0x53b821;return _0x128af4;})[_0x54ef('0x21')](respondWithFilteredResult(_0x5a312c,_0x332f52))[_0x54ef('0x46')](handleError(_0x5a312c,null));};exports['show']=function(_0x595343,_0x96b7a9){var _0x537c20={'raw':!![],'where':{'id':_0x595343[_0x54ef('0x47')]['id']}},_0x55dee1={};_0x55dee1['model']=_[_0x54ef('0x48')](db[_0x54ef('0x31')][_0x54ef('0x32')]);_0x55dee1[_0x54ef('0x35')]=_['keys'](_0x595343[_0x54ef('0x35')]);_0x55dee1[_0x54ef('0x36')]=_['intersection'](_0x55dee1[_0x54ef('0x38')],_0x55dee1[_0x54ef('0x35')]);_0x537c20[_0x54ef('0x3a')]=_['intersection'](_0x55dee1[_0x54ef('0x38')],qs[_0x54ef('0x39')](_0x595343[_0x54ef('0x35')][_0x54ef('0x39')]));_0x537c20[_0x54ef('0x3a')]=_0x537c20['attributes'][_0x54ef('0x3b')]?_0x537c20[_0x54ef('0x3a')]:_0x55dee1[_0x54ef('0x38')];if(_0x595343[_0x54ef('0x35')][_0x54ef('0x49')]){_0x537c20[_0x54ef('0x4a')]=[{'all':!![]}];}_0x537c20=_[_0x54ef('0x2b')]({},_0x537c20,_0x595343[_0x54ef('0x43')]);return db[_0x54ef('0x31')][_0x54ef('0x4b')](_0x537c20)['then'](handleEntityNotFound(_0x96b7a9,null))[_0x54ef('0x21')](respondWithResult(_0x96b7a9,null))[_0x54ef('0x46')](handleError(_0x96b7a9,null));};exports['create']=function(_0x34c49c,_0x2bbb68){return db[_0x54ef('0x31')][_0x54ef('0x4c')](_0x34c49c[_0x54ef('0x2c')],{})['then'](function(_0x313cad){var _0x1ea44b=_0x34c49c[_0x54ef('0x4d')][_0x54ef('0x4e')]({'plain':!![]});if(!_0x1ea44b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ea44b[_0x54ef('0x4f')]===_0x54ef('0x4d')){var _0x4534c9=_0x313cad[_0x54ef('0x4e')]({'plain':!![]});var _0x330266='Voicemails';return db['UserProfileSection'][_0x54ef('0x4b')]({'where':{'name':_0x330266,'userProfileId':_0x1ea44b[_0x54ef('0x50')]},'raw':!![]})[_0x54ef('0x21')](function(_0x52d664){if(_0x52d664&&_0x52d664[_0x54ef('0x51')]===0x0){return db[_0x54ef('0x52')]['create']({'name':_0x4534c9[_0x54ef('0x28')],'resourceId':_0x4534c9['id'],'type':_0x52d664[_0x54ef('0x28')],'sectionId':_0x52d664['id']},{})['then'](function(){return _0x313cad;});}else{return _0x313cad;}})[_0x54ef('0x46')](function(_0x46875f){logger[_0x54ef('0x26')](_0x54ef('0x53'),_0x46875f);throw _0x46875f;});}return _0x313cad;})[_0x54ef('0x21')](respondWithResult(_0x2bbb68,0xc9))[_0x54ef('0x46')](handleError(_0x2bbb68,null));};exports[_0x54ef('0x20')]=function(_0x4942c9,_0x4794de){if(_0x4942c9[_0x54ef('0x2c')]['id']){delete _0x4942c9[_0x54ef('0x2c')]['id'];}return db[_0x54ef('0x31')][_0x54ef('0x4b')]({'where':{'id':_0x4942c9[_0x54ef('0x47')]['id']}})[_0x54ef('0x21')](handleEntityNotFound(_0x4794de,null))['then'](saveUpdates(_0x4942c9['body'],null))[_0x54ef('0x21')](respondWithResult(_0x4794de,null))[_0x54ef('0x46')](handleError(_0x4794de,null));};exports['destroy']=function(_0x1c00f2,_0x311001){return db['VoiceMail'][_0x54ef('0x4b')]({'where':{'id':_0x1c00f2['params']['id']}})[_0x54ef('0x21')](handleEntityNotFound(_0x311001,null))['then'](removeEntity(_0x311001,null))[_0x54ef('0x46')](handleError(_0x311001,null));};exports[_0x54ef('0x54')]=function(_0x16e767,_0x94d9ec,_0x3d612c){return db['VoiceMail']['findOne']({'where':{'id':_0x16e767['params']['id']}})[_0x54ef('0x21')](handleEntityNotFound(_0x94d9ec,null))[_0x54ef('0x21')](function(_0x57c821){var _0x405a1a;var _0x4fefd5={},_0x41b746={};_0x41b746['model']=_[_0x54ef('0x48')](db['VoiceMailMessage'][_0x54ef('0x32')]);_0x41b746['query']=_[_0x54ef('0x48')](_0x16e767[_0x54ef('0x35')]);_0x41b746[_0x54ef('0x36')]=_[_0x54ef('0x37')](_0x41b746['model'],_0x41b746['query']);_0x4fefd5[_0x54ef('0x3a')]=_['intersection'](_0x41b746[_0x54ef('0x38')],qs[_0x54ef('0x39')](_0x16e767['query']['fields']));_0x4fefd5[_0x54ef('0x3a')]=_0x4fefd5[_0x54ef('0x3a')][_0x54ef('0x3b')]?_0x4fefd5[_0x54ef('0x3a')]:_0x41b746[_0x54ef('0x38')];if(!_0x16e767[_0x54ef('0x35')][_0x54ef('0x3c')](_0x54ef('0x55'))){_0x4fefd5[_0x54ef('0x1b')]=qs['limit'](_0x16e767[_0x54ef('0x35')][_0x54ef('0x1b')]);_0x4fefd5[_0x54ef('0x18')]=qs[_0x54ef('0x18')](_0x16e767[_0x54ef('0x35')][_0x54ef('0x18')]);}_0x4fefd5[_0x54ef('0x3d')]=qs[_0x54ef('0x3e')](_0x16e767['query'][_0x54ef('0x3e')]);_0x4fefd5[_0x54ef('0x40')]=qs['filters'](_[_0x54ef('0x3f')](_0x16e767[_0x54ef('0x35')],_0x41b746[_0x54ef('0x36')]));if(_0x16e767[_0x54ef('0x35')]['filter']){_0x4fefd5['where']=_[_0x54ef('0x2b')](_0x4fefd5[_0x54ef('0x40')],{'$or':_['map'](_0x4fefd5[_0x54ef('0x3a')],function(_0x4678f9){var _0x238c9e={};_0x238c9e[_0x4678f9]={'$like':'%'+_0x16e767[_0x54ef('0x35')]['filter']+'%'};return _0x238c9e;})});}_0x4fefd5[_0x54ef('0x40')]=_[_0x54ef('0x2b')](_0x4fefd5['where'],{'mailboxuser':_0x57c821['mailbox']});_0x4fefd5=_[_0x54ef('0x2b')]({},_0x4fefd5,_0x16e767[_0x54ef('0x43')]);return db[_0x54ef('0x56')][_0x54ef('0x57')](_0x4fefd5)['then'](respondWithFilteredResult(_0x94d9ec,_0x4fefd5));})[_0x54ef('0x46')](handleError(_0x94d9ec,null));}; \ No newline at end of file +var _0x72bf=['query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','VoiceMail','includeAll','findAll','rows','catch','show','params','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','getMessages','nolimit','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','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','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Voicemails','sendStatus','error','stack','name','send','render','merge','contact','message','agent','map','type','model'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x72bf,0x199));var _0xf72b=function(_0x1767dc,_0x4d27c8){_0x1767dc=_0x1767dc-0x0;var _0x2f0f7a=_0x72bf[_0x1767dc];return _0x2f0f7a;};'use strict';var emlformat=require(_0xf72b('0x0'));var rimraf=require(_0xf72b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf72b('0x2'));var rp=require(_0xf72b('0x3'));var moment=require('moment');var BPromise=require(_0xf72b('0x4'));var Mustache=require(_0xf72b('0x5'));var util=require(_0xf72b('0x6'));var path=require(_0xf72b('0x7'));var sox=require(_0xf72b('0x8'));var csv=require(_0xf72b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf72b('0xa'));var _=require(_0xf72b('0xb'));var squel=require('squel');var crypto=require(_0xf72b('0xc'));var jsforce=require(_0xf72b('0xd'));var deskjs=require(_0xf72b('0xe'));var toCsv=require(_0xf72b('0x9'));var querystring=require(_0xf72b('0xf'));var Papa=require(_0xf72b('0x10'));var Redis=require(_0xf72b('0x11'));var authService=require(_0xf72b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf72b('0x13'));var hardwareService=require(_0xf72b('0x14'));var logger=require(_0xf72b('0x15'))(_0xf72b('0x16'));var utils=require(_0xf72b('0x17'));var config=require(_0xf72b('0x18'));var licenseUtil=require(_0xf72b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8e9e00,_0x14867b){_0x14867b=_0x14867b||0xcc;return function(_0x130869){if(_0x130869){return _0x8e9e00['sendStatus'](_0x14867b);}return _0x8e9e00[_0xf72b('0x1a')](_0x14867b)[_0xf72b('0x1b')]();};}function respondWithResult(_0x5e2911,_0x4573e1){_0x4573e1=_0x4573e1||0xc8;return function(_0x2b6e1f){if(_0x2b6e1f){return _0x5e2911[_0xf72b('0x1a')](_0x4573e1)['json'](_0x2b6e1f);}};}function respondWithFilteredResult(_0x58b1e6,_0x5237f7){return function(_0x4b00df){if(_0x4b00df){var _0x13d717=typeof _0x5237f7[_0xf72b('0x1c')]===_0xf72b('0x1d')&&typeof _0x5237f7[_0xf72b('0x1e')]==='undefined';var _0x2e0e9e=_0x4b00df['count'];var _0x11d80e=_0x13d717?0x0:_0x5237f7['offset'];var _0x22ee12=_0x13d717?_0x4b00df[_0xf72b('0x1f')]:_0x5237f7[_0xf72b('0x1c')]+_0x5237f7[_0xf72b('0x1e')];var _0x3a6ed2;if(_0x22ee12>=_0x2e0e9e){_0x22ee12=_0x2e0e9e;_0x3a6ed2=0xc8;}else{_0x3a6ed2=0xce;}_0x58b1e6[_0xf72b('0x1a')](_0x3a6ed2);return _0x58b1e6[_0xf72b('0x20')](_0xf72b('0x21'),_0x11d80e+'-'+_0x22ee12+'/'+_0x2e0e9e)[_0xf72b('0x22')](_0x4b00df);}return null;};}function patchUpdates(_0x21019f){return function(_0x337af2){try{jsonpatch[_0xf72b('0x23')](_0x337af2,_0x21019f,!![]);}catch(_0x48cfb6){return BPromise[_0xf72b('0x24')](_0x48cfb6);}return _0x337af2[_0xf72b('0x25')]();};}function saveUpdates(_0x5d0494,_0x5df8ac){return function(_0x104229){if(_0x104229){return _0x104229[_0xf72b('0x26')](_0x5d0494)['then'](function(_0x3fdfea){return _0x3fdfea;});}return null;};}function removeEntity(_0x518cf1,_0xb3f82c){return function(_0x947e30){if(_0x947e30){return _0x947e30[_0xf72b('0x27')]()[_0xf72b('0x28')](function(){var _0x5f17f3=_0x947e30[_0xf72b('0x29')]({'plain':!![]});var _0x3bb8e3=_0xf72b('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x3bb8e3,'resourceId':_0x5f17f3['id']}})[_0xf72b('0x28')](function(){return _0x947e30;});})[_0xf72b('0x28')](function(){_0x518cf1[_0xf72b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1937e8,_0x1873a3){return function(_0xd0edda){if(!_0xd0edda){_0x1937e8[_0xf72b('0x2b')](0x194);}return _0xd0edda;};}function handleError(_0x2cf3d4,_0x4d037f){_0x4d037f=_0x4d037f||0x1f4;return function(_0x2ce1ac){logger[_0xf72b('0x2c')](_0x2ce1ac[_0xf72b('0x2d')]);if(_0x2ce1ac['name']){delete _0x2ce1ac[_0xf72b('0x2e')];}_0x2cf3d4[_0xf72b('0x1a')](_0x4d037f)[_0xf72b('0x2f')](_0x2ce1ac);};}function getMustacheRender(_0x4ae727,_0x4cad11){return Mustache[_0xf72b('0x30')](_0x4ae727,_[_0xf72b('0x31')](_0x4cad11['body'],{'contact':_0x4cad11[_0xf72b('0x32')],'message':_0x4cad11[_0xf72b('0x33')],'agent':_0x4cad11[_0xf72b('0x34')],'interaction':_0x4cad11['interaction'],'account':_0x4cad11['account']}))||'';}exports['index']=function(_0x2bea5b,_0x45797c){var _0x193f71={},_0x3155fc={},_0x2dd3e1={'count':0x0,'rows':[]};var _0x343835=_[_0xf72b('0x35')](db['VoiceMail']['rawAttributes'],function(_0x4bc66d){return{'name':_0x4bc66d['fieldName'],'type':_0x4bc66d[_0xf72b('0x36')]['key']};});_0x3155fc[_0xf72b('0x37')]=_[_0xf72b('0x35')](_0x343835,'name');_0x3155fc[_0xf72b('0x38')]=_[_0xf72b('0x39')](_0x2bea5b['query']);_0x3155fc[_0xf72b('0x3a')]=_[_0xf72b('0x3b')](_0x3155fc['model'],_0x3155fc[_0xf72b('0x38')]);_0x193f71['attributes']=_['intersection'](_0x3155fc[_0xf72b('0x37')],qs[_0xf72b('0x3c')](_0x2bea5b[_0xf72b('0x38')][_0xf72b('0x3c')]));_0x193f71[_0xf72b('0x3d')]=_0x193f71['attributes']['length']?_0x193f71[_0xf72b('0x3d')]:_0x3155fc[_0xf72b('0x37')];if(!_0x2bea5b[_0xf72b('0x38')][_0xf72b('0x3e')]('nolimit')){_0x193f71[_0xf72b('0x1e')]=qs[_0xf72b('0x1e')](_0x2bea5b[_0xf72b('0x38')][_0xf72b('0x1e')]);_0x193f71[_0xf72b('0x1c')]=qs[_0xf72b('0x1c')](_0x2bea5b['query'][_0xf72b('0x1c')]);}_0x193f71[_0xf72b('0x3f')]=qs[_0xf72b('0x40')](_0x2bea5b[_0xf72b('0x38')][_0xf72b('0x40')]);_0x193f71[_0xf72b('0x41')]=qs['filters'](_[_0xf72b('0x42')](_0x2bea5b[_0xf72b('0x38')],_0x3155fc['filters']),_0x343835);if(_0x2bea5b[_0xf72b('0x38')]['filter']){_0x193f71[_0xf72b('0x41')]=_[_0xf72b('0x31')](_0x193f71[_0xf72b('0x41')],{'$or':_[_0xf72b('0x35')](_0x343835,function(_0x5c13b5){if(_0x5c13b5[_0xf72b('0x36')]!==_0xf72b('0x43')){var _0x1b4273={};_0x1b4273[_0x5c13b5['name']]={'$like':'%'+_0x2bea5b[_0xf72b('0x38')][_0xf72b('0x44')]+'%'};return _0x1b4273;}})});}_0x193f71=_[_0xf72b('0x31')]({},_0x193f71,_0x2bea5b[_0xf72b('0x45')]);var _0x4521de={'where':_0x193f71[_0xf72b('0x41')]};return db[_0xf72b('0x46')][_0xf72b('0x1f')](_0x4521de)[_0xf72b('0x28')](function(_0x4568d1){_0x2dd3e1['count']=_0x4568d1;if(_0x2bea5b[_0xf72b('0x38')][_0xf72b('0x47')]){_0x193f71['include']=[{'all':!![]}];}return db['VoiceMail'][_0xf72b('0x48')](_0x193f71);})[_0xf72b('0x28')](function(_0xdc8f31){_0x2dd3e1[_0xf72b('0x49')]=_0xdc8f31;return _0x2dd3e1;})[_0xf72b('0x28')](respondWithFilteredResult(_0x45797c,_0x193f71))[_0xf72b('0x4a')](handleError(_0x45797c,null));};exports[_0xf72b('0x4b')]=function(_0x30f135,_0x546c7d){var _0x1ac848={'raw':!![],'where':{'id':_0x30f135[_0xf72b('0x4c')]['id']}},_0x109d03={};_0x109d03['model']=_['keys'](db[_0xf72b('0x46')]['rawAttributes']);_0x109d03['query']=_[_0xf72b('0x39')](_0x30f135[_0xf72b('0x38')]);_0x109d03['filters']=_[_0xf72b('0x3b')](_0x109d03[_0xf72b('0x37')],_0x109d03[_0xf72b('0x38')]);_0x1ac848[_0xf72b('0x3d')]=_[_0xf72b('0x3b')](_0x109d03[_0xf72b('0x37')],qs[_0xf72b('0x3c')](_0x30f135[_0xf72b('0x38')][_0xf72b('0x3c')]));_0x1ac848[_0xf72b('0x3d')]=_0x1ac848[_0xf72b('0x3d')][_0xf72b('0x4d')]?_0x1ac848[_0xf72b('0x3d')]:_0x109d03['model'];if(_0x30f135[_0xf72b('0x38')][_0xf72b('0x47')]){_0x1ac848[_0xf72b('0x4e')]=[{'all':!![]}];}_0x1ac848=_[_0xf72b('0x31')]({},_0x1ac848,_0x30f135['options']);return db[_0xf72b('0x46')]['find'](_0x1ac848)[_0xf72b('0x28')](handleEntityNotFound(_0x546c7d,null))[_0xf72b('0x28')](respondWithResult(_0x546c7d,null))[_0xf72b('0x4a')](handleError(_0x546c7d,null));};exports[_0xf72b('0x4f')]=function(_0x44fa05,_0x39732f){return db[_0xf72b('0x46')][_0xf72b('0x4f')](_0x44fa05[_0xf72b('0x50')],{})['then'](function(_0x46b14a){var _0x467748=_0x44fa05[_0xf72b('0x51')]['get']({'plain':!![]});if(!_0x467748)throw new Error(_0xf72b('0x52'));if(_0x467748[_0xf72b('0x53')]===_0xf72b('0x51')){var _0x15cfbe=_0x46b14a[_0xf72b('0x29')]({'plain':!![]});var _0x36689c=_0xf72b('0x2a');return db[_0xf72b('0x54')][_0xf72b('0x55')]({'where':{'name':_0x36689c,'userProfileId':_0x467748[_0xf72b('0x56')]},'raw':!![]})['then'](function(_0x34f140){if(_0x34f140&&_0x34f140['autoAssociation']===0x0){return db[_0xf72b('0x57')]['create']({'name':_0x15cfbe[_0xf72b('0x2e')],'resourceId':_0x15cfbe['id'],'type':_0x34f140[_0xf72b('0x2e')],'sectionId':_0x34f140['id']},{})[_0xf72b('0x28')](function(){return _0x46b14a;});}else{return _0x46b14a;}})[_0xf72b('0x4a')](function(_0x3c6f57){logger[_0xf72b('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c6f57);throw _0x3c6f57;});}return _0x46b14a;})[_0xf72b('0x28')](respondWithResult(_0x39732f,0xc9))[_0xf72b('0x4a')](handleError(_0x39732f,null));};exports[_0xf72b('0x26')]=function(_0x9a35a,_0x2bf891){if(_0x9a35a['body']['id']){delete _0x9a35a[_0xf72b('0x50')]['id'];}return db[_0xf72b('0x46')][_0xf72b('0x55')]({'where':{'id':_0x9a35a[_0xf72b('0x4c')]['id']}})[_0xf72b('0x28')](handleEntityNotFound(_0x2bf891,null))[_0xf72b('0x28')](saveUpdates(_0x9a35a[_0xf72b('0x50')],null))[_0xf72b('0x28')](respondWithResult(_0x2bf891,null))['catch'](handleError(_0x2bf891,null));};exports['destroy']=function(_0x8b4f3e,_0x5dfdcf){return db[_0xf72b('0x46')][_0xf72b('0x55')]({'where':{'id':_0x8b4f3e[_0xf72b('0x4c')]['id']}})[_0xf72b('0x28')](handleEntityNotFound(_0x5dfdcf,null))['then'](removeEntity(_0x5dfdcf,null))[_0xf72b('0x4a')](handleError(_0x5dfdcf,null));};exports[_0xf72b('0x58')]=function(_0x142694,_0x2d7bff,_0x56312b){return db[_0xf72b('0x46')]['findOne']({'where':{'id':_0x142694[_0xf72b('0x4c')]['id']}})[_0xf72b('0x28')](handleEntityNotFound(_0x2d7bff,null))[_0xf72b('0x28')](function(_0x3294c4){var _0x108f9a;var _0x3bc03e={},_0x45557b={};_0x45557b[_0xf72b('0x37')]=_[_0xf72b('0x39')](db['VoiceMailMessage']['rawAttributes']);_0x45557b[_0xf72b('0x38')]=_[_0xf72b('0x39')](_0x142694['query']);_0x45557b[_0xf72b('0x3a')]=_['intersection'](_0x45557b['model'],_0x45557b[_0xf72b('0x38')]);_0x3bc03e[_0xf72b('0x3d')]=_[_0xf72b('0x3b')](_0x45557b['model'],qs[_0xf72b('0x3c')](_0x142694[_0xf72b('0x38')][_0xf72b('0x3c')]));_0x3bc03e['attributes']=_0x3bc03e[_0xf72b('0x3d')][_0xf72b('0x4d')]?_0x3bc03e[_0xf72b('0x3d')]:_0x45557b[_0xf72b('0x37')];if(!_0x142694[_0xf72b('0x38')][_0xf72b('0x3e')](_0xf72b('0x59'))){_0x3bc03e[_0xf72b('0x1e')]=qs[_0xf72b('0x1e')](_0x142694[_0xf72b('0x38')]['limit']);_0x3bc03e[_0xf72b('0x1c')]=qs[_0xf72b('0x1c')](_0x142694['query'][_0xf72b('0x1c')]);}_0x3bc03e[_0xf72b('0x3f')]=qs[_0xf72b('0x40')](_0x142694[_0xf72b('0x38')][_0xf72b('0x40')]);_0x3bc03e[_0xf72b('0x41')]=qs['filters'](_[_0xf72b('0x42')](_0x142694[_0xf72b('0x38')],_0x45557b[_0xf72b('0x3a')]));if(_0x142694['query'][_0xf72b('0x44')]){_0x3bc03e[_0xf72b('0x41')]=_[_0xf72b('0x31')](_0x3bc03e[_0xf72b('0x41')],{'$or':_['map'](_0x3bc03e[_0xf72b('0x3d')],function(_0x5e7078){var _0x535fe8={};_0x535fe8[_0x5e7078]={'$like':'%'+_0x142694[_0xf72b('0x38')][_0xf72b('0x44')]+'%'};return _0x535fe8;})});}_0x3bc03e[_0xf72b('0x41')]=_['merge'](_0x3bc03e[_0xf72b('0x41')],{'mailboxuser':_0x3294c4[_0xf72b('0x5a')]});_0x3bc03e=_['merge']({},_0x3bc03e,_0x142694[_0xf72b('0x45')]);return db[_0xf72b('0x5b')][_0xf72b('0x5c')](_0x3bc03e)[_0xf72b('0x28')](respondWithFilteredResult(_0x2d7bff,_0x3bc03e));})[_0xf72b('0x4a')](handleError(_0x2d7bff,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 6b0b062..d7b752d 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 _0x0442=['bluebird','rimraf','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','util','api','moment'];(function(_0x5bef03,_0x915047){var _0x340de9=function(_0x48648b){while(--_0x48648b){_0x5bef03['push'](_0x5bef03['shift']());}};_0x340de9(++_0x915047);}(_0x0442,0x1a0));var _0x2044=function(_0x3ee55a,_0x19aeea){_0x3ee55a=_0x3ee55a-0x0;var _0x581800=_0x0442[_0x3ee55a];return _0x581800;};'use strict';var _=require(_0x2044('0x0'));var util=require(_0x2044('0x1'));var logger=require('../../config/logger')(_0x2044('0x2'));var moment=require(_0x2044('0x3'));var BPromise=require(_0x2044('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2044('0x5'));var config=require('../../config/environment');var attributes=require(_0x2044('0x6'));module['exports']=function(_0x2a4ed8,_0x48c6e1){return _0x2a4ed8[_0x2044('0x7')](_0x2044('0x8'),attributes,{'tableName':_0x2044('0x9'),'paranoid':![],'indexes':[{'name':_0x2044('0xa'),'fields':['mailbox',_0x2044('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd250=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context'];(function(_0x43d69d,_0x5b4551){var _0x237952=function(_0x89bea){while(--_0x89bea){_0x43d69d['push'](_0x43d69d['shift']());}};_0x237952(++_0x5b4551);}(_0xd250,0x70));var _0x0d25=function(_0x1795df,_0xcb261e){_0x1795df=_0x1795df-0x0;var _0x3f13c0=_0xd250[_0x1795df];return _0x3f13c0;};'use strict';var _=require(_0x0d25('0x0'));var util=require(_0x0d25('0x1'));var logger=require(_0x0d25('0x2'))(_0x0d25('0x3'));var moment=require(_0x0d25('0x4'));var BPromise=require(_0x0d25('0x5'));var rp=require(_0x0d25('0x6'));var fs=require('fs');var path=require(_0x0d25('0x7'));var rimraf=require(_0x0d25('0x8'));var config=require(_0x0d25('0x9'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x43a28d,_0x2bcbe8){return _0x43a28d[_0x0d25('0xa')](_0x0d25('0xb'),attributes,{'tableName':_0x0d25('0xc'),'paranoid':![],'indexes':[{'name':_0x0d25('0xd'),'fields':[_0x0d25('0xe'),_0x0d25('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 0a113b9..1567243 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 _0x7ac5=['message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceMail,\x20%s,\x20%s'];(function(_0x3b6648,_0x2d723a){var _0x5a0a0d=function(_0x133dea){while(--_0x133dea){_0x3b6648['push'](_0x3b6648['shift']());}};_0x5a0a0d(++_0x2d723a);}(_0x7ac5,0x17f));var _0x57ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ac5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x57ac('0x0'));var util=require('util');var moment=require(_0x57ac('0x1'));var BPromise=require('bluebird');var rs=require(_0x57ac('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x57ac('0x3'));var logger=require(_0x57ac('0x4'))('rpc');var config=require(_0x57ac('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x57ac('0x6')][_0x57ac('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x501d55,_0x4ad753,_0x1e75c6){return new BPromise(function(_0x583633,_0x284d0e){return client[_0x57ac('0x8')](_0x501d55,_0x1e75c6)['then'](function(_0xfa61e6){logger[_0x57ac('0x9')]('VoiceMail,\x20%s,\x20%s',_0x4ad753,'request\x20sent');logger[_0x57ac('0xa')](_0x57ac('0xb'),_0x4ad753,_0x57ac('0xc'),JSON['stringify'](_0xfa61e6));if(_0xfa61e6[_0x57ac('0xd')]){if(_0xfa61e6[_0x57ac('0xd')][_0x57ac('0xe')]===0x1f4){logger[_0x57ac('0xd')](_0x57ac('0xf'),_0x4ad753,_0xfa61e6[_0x57ac('0xd')][_0x57ac('0x10')]);return _0x284d0e(_0xfa61e6[_0x57ac('0xd')][_0x57ac('0x10')]);}logger[_0x57ac('0xd')](_0x57ac('0xf'),_0x4ad753,_0xfa61e6[_0x57ac('0xd')][_0x57ac('0x10')]);return _0x583633(_0xfa61e6[_0x57ac('0xd')][_0x57ac('0x10')]);}else{logger[_0x57ac('0x9')](_0x57ac('0xf'),_0x4ad753,_0x57ac('0xc'));_0x583633(_0xfa61e6[_0x57ac('0x11')][_0x57ac('0x10')]);}})[_0x57ac('0x12')](function(_0x5a2757){logger[_0x57ac('0xd')](_0x57ac('0xf'),_0x4ad753,_0x5a2757);_0x284d0e(_0x5a2757);});});} \ No newline at end of file +var _0xf68b=['VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x39d3a7,_0x17127e){var _0x2203bd=function(_0x294502){while(--_0x294502){_0x39d3a7['push'](_0x39d3a7['shift']());}};_0x2203bd(++_0x17127e);}(_0xf68b,0xd1));var _0xbf68=function(_0x5e1378,_0x12f94e){_0x5e1378=_0x5e1378-0x0;var _0x1a4b11=_0xf68b[_0x5e1378];return _0x1a4b11;};'use strict';var _=require(_0xbf68('0x0'));var util=require(_0xbf68('0x1'));var moment=require(_0xbf68('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf68('0x3'));var fs=require('fs');var Redis=require(_0xbf68('0x4'));var db=require(_0xbf68('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbf68('0x6'));var config=require(_0xbf68('0x7'));var jayson=require(_0xbf68('0x8'));var client=jayson[_0xbf68('0x9')][_0xbf68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bdbad,_0x63cd7c,_0x433e75){return new BPromise(function(_0x4efa92,_0x222cb4){return client['request'](_0x2bdbad,_0x433e75)['then'](function(_0x4c935d){logger['info'](_0xbf68('0xb'),_0x63cd7c,_0xbf68('0xc'));logger[_0xbf68('0xd')](_0xbf68('0xe'),_0x63cd7c,_0xbf68('0xc'),JSON[_0xbf68('0xf')](_0x4c935d));if(_0x4c935d[_0xbf68('0x10')]){if(_0x4c935d[_0xbf68('0x10')][_0xbf68('0x11')]===0x1f4){logger[_0xbf68('0x10')]('VoiceMail,\x20%s,\x20%s',_0x63cd7c,_0x4c935d[_0xbf68('0x10')]['message']);return _0x222cb4(_0x4c935d[_0xbf68('0x10')][_0xbf68('0x12')]);}logger[_0xbf68('0x10')]('VoiceMail,\x20%s,\x20%s',_0x63cd7c,_0x4c935d[_0xbf68('0x10')][_0xbf68('0x12')]);return _0x4efa92(_0x4c935d[_0xbf68('0x10')]['message']);}else{logger[_0xbf68('0x13')](_0xbf68('0xb'),_0x63cd7c,'request\x20sent');_0x4efa92(_0x4c935d[_0xbf68('0x14')][_0xbf68('0x12')]);}})[_0xbf68('0x15')](function(_0x304879){logger['error'](_0xbf68('0xb'),_0x63cd7c,_0x304879);_0x222cb4(_0x304879);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 78f0a5e..b50c73a 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 _0xac7d=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','create','put','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x5b7993,_0x5b3eec){var _0x37481b=function(_0x46c2ab){while(--_0x46c2ab){_0x5b7993['push'](_0x5b7993['shift']());}};_0x37481b(++_0x5b3eec);}(_0xac7d,0x1bc));var _0xdac7=function(_0x53b3be,_0x54c7e0){_0x53b3be=_0x53b3be-0x0;var _0x873e57=_0xac7d[_0x53b3be];return _0x873e57;};'use strict';var multer=require(_0xdac7('0x0'));var util=require(_0xdac7('0x1'));var path=require(_0xdac7('0x2'));var timeout=require('connect-timeout');var express=require(_0xdac7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdac7('0x4'));var interaction=require(_0xdac7('0x5'));var config=require('../../config/environment');var controller=require(_0xdac7('0x6'));router[_0xdac7('0x7')]('/',auth[_0xdac7('0x8')](),controller[_0xdac7('0x9')]);router[_0xdac7('0x7')](_0xdac7('0xa'),auth[_0xdac7('0x8')](),controller[_0xdac7('0xb')]);router['get'](_0xdac7('0xc'),auth['isAuthenticated'](),controller['download']);router[_0xdac7('0xd')]('/',auth[_0xdac7('0x8')](),controller[_0xdac7('0xe')]);router[_0xdac7('0xf')](_0xdac7('0xa'),auth[_0xdac7('0x8')](),controller['update']);router[_0xdac7('0x10')]('/:id',auth[_0xdac7('0x8')](),controller['destroy']);module[_0xdac7('0x11')]=router; \ No newline at end of file +var _0x2e60=['get','index','isAuthenticated','show','/:id/download','download','post','create','put','/:id','delete','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4ee89a,_0x56d642){var _0x42aca9=function(_0xa1f425){while(--_0xa1f425){_0x4ee89a['push'](_0x4ee89a['shift']());}};_0x42aca9(++_0x56d642);}(_0x2e60,0x10a));var _0x02e6=function(_0x3df600,_0x3350eb){_0x3df600=_0x3df600-0x0;var _0x59ed94=_0x2e60[_0x3df600];return _0x59ed94;};'use strict';var multer=require('multer');var util=require(_0x02e6('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x02e6('0x1'));var router=express['Router']();var fs_extra=require(_0x02e6('0x2'));var auth=require(_0x02e6('0x3'));var interaction=require(_0x02e6('0x4'));var config=require(_0x02e6('0x5'));var controller=require('./voiceMailMessage.controller');router[_0x02e6('0x6')]('/',auth['isAuthenticated'](),controller[_0x02e6('0x7')]);router[_0x02e6('0x6')]('/:id',auth[_0x02e6('0x8')](),controller[_0x02e6('0x9')]);router[_0x02e6('0x6')](_0x02e6('0xa'),auth[_0x02e6('0x8')](),controller[_0x02e6('0xb')]);router[_0x02e6('0xc')]('/',auth[_0x02e6('0x8')](),controller[_0x02e6('0xd')]);router[_0x02e6('0xe')](_0x02e6('0xf'),auth[_0x02e6('0x8')](),controller['update']);router[_0x02e6('0x10')]('/:id',auth[_0x02e6('0x8')](),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 22fef5a..8028a72 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 _0x0b49=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING','long','TIMESTAMP','literal'];(function(_0x38eacd,_0x54c602){var _0x5decdb=function(_0x324770){while(--_0x324770){_0x38eacd['push'](_0x38eacd['shift']());}};_0x5decdb(++_0x54c602);}(_0x0b49,0x17b));var _0x90b4=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0b49[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x90b4('0x0'));module[_0x90b4('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5f253b){return this[_0x90b4('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x90b4('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x90b4('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x90b4('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x90b4('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x90b4('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x90b4('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x90b4('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x90b4('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x90b4('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x90b4('0x4')],'defaultValue':''},'stamp':{'type':_0x90b4('0x6'),'defaultValue':Sequelize[_0x90b4('0x7')](_0x90b4('0x8'))}}; \ No newline at end of file +var _0x5aae=['STRING','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER'];(function(_0x424daf,_0x3e0500){var _0x191079=function(_0x4b0cc5){while(--_0x4b0cc5){_0x424daf['push'](_0x424daf['shift']());}};_0x191079(++_0x3e0500);}(_0x5aae,0xdc));var _0xe5aa=function(_0xdc5664,_0x4eef5a){_0xdc5664=_0xdc5664-0x0;var _0xd65a92=_0x5aae[_0xdc5664];return _0xd65a92;};'use strict';var Sequelize=require(_0xe5aa('0x0'));module['exports']={'name':{'type':Sequelize[_0xe5aa('0x1')],'get':function(_0xe818ab){return this[_0xe5aa('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xe5aa('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xe5aa('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xe5aa('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe5aa('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xe5aa('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xe5aa('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xe5aa('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xe5aa('0x6')](_0xe5aa('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 995768e..3803867 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 _0xcb07=['status','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','render','merge','body','contact','message','agent','interaction','account','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','includeAll','catch','show','params','keys','include','options','create','find','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0xcb07,0x98));var _0x7cb0=function(_0x79ebc5,_0x2df5d1){_0x79ebc5=_0x79ebc5-0x0;var _0x3813b6=_0xcb07[_0x79ebc5];return _0x3813b6;};'use strict';var emlformat=require(_0x7cb0('0x0'));var rimraf=require(_0x7cb0('0x1'));var zipdir=require(_0x7cb0('0x2'));var jsonpatch=require(_0x7cb0('0x3'));var rp=require(_0x7cb0('0x4'));var moment=require('moment');var BPromise=require(_0x7cb0('0x5'));var Mustache=require(_0x7cb0('0x6'));var util=require(_0x7cb0('0x7'));var path=require('path');var sox=require(_0x7cb0('0x8'));var csv=require('to-csv');var ejs=require(_0x7cb0('0x9'));var fs=require('fs');var fs_extra=require(_0x7cb0('0xa'));var _=require('lodash');var squel=require(_0x7cb0('0xb'));var crypto=require(_0x7cb0('0xc'));var jsforce=require(_0x7cb0('0xd'));var deskjs=require(_0x7cb0('0xe'));var toCsv=require(_0x7cb0('0xf'));var querystring=require(_0x7cb0('0x10'));var Papa=require(_0x7cb0('0x11'));var Redis=require('ioredis');var authService=require(_0x7cb0('0x12'));var qs=require(_0x7cb0('0x13'));var as=require(_0x7cb0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7cb0('0x15'));var utils=require(_0x7cb0('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x354344,_0x55b8bf){_0x55b8bf=_0x55b8bf||0xcc;return function(_0x2176de){if(_0x2176de){return _0x354344[_0x7cb0('0x17')](_0x55b8bf);}return _0x354344[_0x7cb0('0x18')](_0x55b8bf)['end']();};}function respondWithResult(_0x5abaee,_0x27d184){_0x27d184=_0x27d184||0xc8;return function(_0x1c7a66){if(_0x1c7a66){return _0x5abaee[_0x7cb0('0x18')](_0x27d184)['json'](_0x1c7a66);}};}function respondWithFilteredResult(_0xea1b72,_0x4e1e08){return function(_0x58aec0){if(_0x58aec0){var _0x3c7578=typeof _0x4e1e08['offset']===_0x7cb0('0x19')&&typeof _0x4e1e08[_0x7cb0('0x1a')]===_0x7cb0('0x19');var _0x34f163=_0x58aec0['count'];var _0xa77ddd=_0x3c7578?0x0:_0x4e1e08[_0x7cb0('0x1b')];var _0x2b6982=_0x3c7578?_0x58aec0[_0x7cb0('0x1c')]:_0x4e1e08[_0x7cb0('0x1b')]+_0x4e1e08[_0x7cb0('0x1a')];var _0x4cfbc8;if(_0x2b6982>=_0x34f163){_0x2b6982=_0x34f163;_0x4cfbc8=0xc8;}else{_0x4cfbc8=0xce;}_0xea1b72[_0x7cb0('0x18')](_0x4cfbc8);return _0xea1b72[_0x7cb0('0x1d')](_0x7cb0('0x1e'),_0xa77ddd+'-'+_0x2b6982+'/'+_0x34f163)['json'](_0x58aec0);}return null;};}function patchUpdates(_0x356937){return function(_0x54605e){try{jsonpatch[_0x7cb0('0x1f')](_0x54605e,_0x356937,!![]);}catch(_0x8d7d87){return BPromise[_0x7cb0('0x20')](_0x8d7d87);}return _0x54605e[_0x7cb0('0x21')]();};}function saveUpdates(_0x16ef84,_0x371503){return function(_0x1c84c7){if(_0x1c84c7){return _0x1c84c7[_0x7cb0('0x22')](_0x16ef84)[_0x7cb0('0x23')](function(_0x232754){return _0x232754;});}return null;};}function removeEntity(_0x4b164d,_0x180039){return function(_0x248085){if(_0x248085){return _0x248085[_0x7cb0('0x24')]()[_0x7cb0('0x23')](function(){_0x4b164d[_0x7cb0('0x18')](0xcc)[_0x7cb0('0x25')]();});}};}function handleEntityNotFound(_0x2a3c2c,_0x5c31fb){return function(_0x21d1c8){if(!_0x21d1c8){_0x2a3c2c[_0x7cb0('0x17')](0x194);}return _0x21d1c8;};}function handleError(_0x27d3e1,_0x355c1f){_0x355c1f=_0x355c1f||0x1f4;return function(_0x195254){logger['error'](_0x195254[_0x7cb0('0x26')]);if(_0x195254[_0x7cb0('0x27')]){delete _0x195254[_0x7cb0('0x27')];}_0x27d3e1['status'](_0x355c1f)[_0x7cb0('0x28')](_0x195254);};}function getMustacheRender(_0x87798d,_0x14a645){return Mustache[_0x7cb0('0x29')](_0x87798d,_[_0x7cb0('0x2a')](_0x14a645[_0x7cb0('0x2b')],{'contact':_0x14a645[_0x7cb0('0x2c')],'message':_0x14a645[_0x7cb0('0x2d')],'agent':_0x14a645[_0x7cb0('0x2e')],'interaction':_0x14a645[_0x7cb0('0x2f')],'account':_0x14a645[_0x7cb0('0x30')]}))||'';}exports['index']=function(_0x54ba78,_0x2a1263){var _0x744377={},_0x569574={},_0x4ca05d={'count':0x0,'rows':[]};var _0x245731=_[_0x7cb0('0x31')](db[_0x7cb0('0x32')][_0x7cb0('0x33')],function(_0x527116){return{'name':_0x527116[_0x7cb0('0x34')],'type':_0x527116[_0x7cb0('0x35')][_0x7cb0('0x36')]};});_0x569574[_0x7cb0('0x37')]=_[_0x7cb0('0x38')](_[_0x7cb0('0x31')](_0x245731,'name'),[_0x7cb0('0x27')]);_0x569574[_0x7cb0('0x39')]=_['keys'](_0x54ba78[_0x7cb0('0x39')]);_0x569574['filters']=_[_0x7cb0('0x3a')](_0x569574[_0x7cb0('0x37')],_0x569574['query']);_0x744377[_0x7cb0('0x3b')]=_['intersection'](_0x569574[_0x7cb0('0x37')],qs[_0x7cb0('0x3c')](_0x54ba78['query'][_0x7cb0('0x3c')]));_0x744377[_0x7cb0('0x3b')]=_0x744377[_0x7cb0('0x3b')][_0x7cb0('0x3d')]?_0x744377['attributes']:_0x569574[_0x7cb0('0x37')];if(!_0x54ba78[_0x7cb0('0x39')]['hasOwnProperty'](_0x7cb0('0x3e'))){_0x744377['limit']=qs['limit'](_0x54ba78[_0x7cb0('0x39')][_0x7cb0('0x1a')]);_0x744377[_0x7cb0('0x1b')]=qs[_0x7cb0('0x1b')](_0x54ba78['query'][_0x7cb0('0x1b')]);}_0x744377[_0x7cb0('0x3f')]=qs['sort'](_0x54ba78[_0x7cb0('0x39')][_0x7cb0('0x40')]);_0x744377[_0x7cb0('0x41')]=qs['filters'](_[_0x7cb0('0x42')](_0x54ba78[_0x7cb0('0x39')],_0x569574[_0x7cb0('0x43')]),_0x245731);if(_0x54ba78['query']['filter']){_0x744377[_0x7cb0('0x41')]=_[_0x7cb0('0x2a')](_0x744377[_0x7cb0('0x41')],{'$or':_[_0x7cb0('0x31')](_0x245731,function(_0x2de26b){if(_0x2de26b[_0x7cb0('0x35')]!==_0x7cb0('0x44')){var _0x5d177b={};_0x5d177b[_0x2de26b[_0x7cb0('0x27')]]={'$like':'%'+_0x54ba78[_0x7cb0('0x39')][_0x7cb0('0x45')]+'%'};return _0x5d177b;}})});}_0x744377=_[_0x7cb0('0x2a')]({},_0x744377,_0x54ba78['options']);var _0x4f9b06={'where':_0x744377[_0x7cb0('0x41')]};return db[_0x7cb0('0x32')]['count'](_0x4f9b06)['then'](function(_0x4d5c8d){_0x4ca05d['count']=_0x4d5c8d;if(_0x54ba78[_0x7cb0('0x39')][_0x7cb0('0x46')]){_0x744377['include']=[{'all':!![]}];}return db[_0x7cb0('0x32')]['findAll'](_0x744377);})['then'](function(_0x480af6){_0x4ca05d['rows']=_0x480af6;return _0x4ca05d;})['then'](respondWithFilteredResult(_0x2a1263,_0x744377))[_0x7cb0('0x47')](handleError(_0x2a1263,null));};exports[_0x7cb0('0x48')]=function(_0xca975c,_0x57a19b){var _0x4bfea5={'raw':!![],'where':{'id':_0xca975c[_0x7cb0('0x49')]['id']}},_0x442d8a={};_0x442d8a['model']=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x442d8a[_0x7cb0('0x39')]=_[_0x7cb0('0x4a')](_0xca975c[_0x7cb0('0x39')]);_0x442d8a[_0x7cb0('0x43')]=_[_0x7cb0('0x3a')](_0x442d8a['model'],_0x442d8a[_0x7cb0('0x39')]);_0x4bfea5[_0x7cb0('0x3b')]=_['intersection'](_0x442d8a[_0x7cb0('0x37')],qs[_0x7cb0('0x3c')](_0xca975c[_0x7cb0('0x39')]['fields']));_0x4bfea5['attributes']=_0x4bfea5[_0x7cb0('0x3b')][_0x7cb0('0x3d')]?_0x4bfea5[_0x7cb0('0x3b')]:_0x442d8a[_0x7cb0('0x37')];if(_0xca975c[_0x7cb0('0x39')][_0x7cb0('0x46')]){_0x4bfea5[_0x7cb0('0x4b')]=[{'all':!![]}];}_0x4bfea5=_[_0x7cb0('0x2a')]({},_0x4bfea5,_0xca975c[_0x7cb0('0x4c')]);return db[_0x7cb0('0x32')]['find'](_0x4bfea5)['then'](handleEntityNotFound(_0x57a19b,null))[_0x7cb0('0x23')](respondWithResult(_0x57a19b,null))[_0x7cb0('0x47')](handleError(_0x57a19b,null));};exports[_0x7cb0('0x4d')]=function(_0x3dbdd5,_0x32b35b){return db[_0x7cb0('0x32')]['create'](_0x3dbdd5[_0x7cb0('0x2b')],{})['then'](respondWithResult(_0x32b35b,0xc9))[_0x7cb0('0x47')](handleError(_0x32b35b,null));};exports[_0x7cb0('0x22')]=function(_0x3d9b8d,_0x1decd1){if(_0x3d9b8d['body']['id']){delete _0x3d9b8d[_0x7cb0('0x2b')]['id'];}return db[_0x7cb0('0x32')][_0x7cb0('0x4e')]({'where':{'id':_0x3d9b8d[_0x7cb0('0x49')]['id']}})[_0x7cb0('0x23')](handleEntityNotFound(_0x1decd1,null))[_0x7cb0('0x23')](saveUpdates(_0x3d9b8d[_0x7cb0('0x2b')],null))[_0x7cb0('0x23')](respondWithResult(_0x1decd1,null))[_0x7cb0('0x47')](handleError(_0x1decd1,null));};exports[_0x7cb0('0x24')]=function(_0x443706,_0x1edbc8){return db[_0x7cb0('0x32')][_0x7cb0('0x4e')]({'where':{'id':_0x443706['params']['id']}})['then'](handleEntityNotFound(_0x1edbc8,null))['then'](removeEntity(_0x1edbc8,null))[_0x7cb0('0x47')](handleError(_0x1edbc8,null));};exports[_0x7cb0('0x4f')]=function(_0x4582a9,_0x489d32,_0x1c2185){return db[_0x7cb0('0x32')]['find']({'where':{'id':_0x4582a9['params']['id']},'attributes':['id','recording',_0x7cb0('0x50')]})[_0x7cb0('0x23')](handleEntityNotFound(_0x489d32,null))[_0x7cb0('0x23')](function(_0x3c97a1){if(_0x3c97a1){if(!_0x3c97a1[_0x7cb0('0x51')]){throw new db[(_0x7cb0('0x52'))][(_0x7cb0('0x53'))](_0x7cb0('0x54'));}var _0x2bf295={'Content-Type':_0x7cb0('0x55'),'Content-Disposition':_0x7cb0('0x56')};if(_0x3c97a1[_0x7cb0('0x50')]){_0x2bf295[_0x7cb0('0x57')]='attachment;\x20filename=\x22'+_0x3c97a1[_0x7cb0('0x50')]+'.wav\x22';}_0x489d32['set'](_0x2bf295);return _0x489d32[_0x7cb0('0x28')](new Buffer(_0x3c97a1['recording']));}})[_0x7cb0('0x47')](handleError(_0x489d32,null));}; \ No newline at end of file +var _0x8c03=['hasOwnProperty','nolimit','order','sort','where','pick','filter','then','includeAll','rows','catch','params','keys','include','options','find','create','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','error','name','send','merge','body','contact','message','agent','interaction','account','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','query','filters','intersection','attributes','fields','length'];(function(_0x506d2b,_0x51eba7){var _0x1198da=function(_0xa1c688){while(--_0xa1c688){_0x506d2b['push'](_0x506d2b['shift']());}};_0x1198da(++_0x51eba7);}(_0x8c03,0x6f));var _0x38c0=function(_0x409380,_0x46d2c4){_0x409380=_0x409380-0x0;var _0x4400dd=_0x8c03[_0x409380];return _0x4400dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38c0('0x0'));var zipdir=require(_0x38c0('0x1'));var jsonpatch=require(_0x38c0('0x2'));var rp=require(_0x38c0('0x3'));var moment=require(_0x38c0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x38c0('0x5'));var path=require(_0x38c0('0x6'));var sox=require('sox');var csv=require(_0x38c0('0x7'));var ejs=require(_0x38c0('0x8'));var fs=require('fs');var fs_extra=require(_0x38c0('0x9'));var _=require(_0x38c0('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x38c0('0xb'));var deskjs=require(_0x38c0('0xc'));var toCsv=require(_0x38c0('0x7'));var querystring=require('querystring');var Papa=require(_0x38c0('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x38c0('0xe'));var as=require(_0x38c0('0xf'));var hardwareService=require(_0x38c0('0x10'));var logger=require(_0x38c0('0x11'))(_0x38c0('0x12'));var utils=require('../../config/utils');var config=require(_0x38c0('0x13'));var licenseUtil=require(_0x38c0('0x14'));var db=require(_0x38c0('0x15'))['db'];function respondWithStatusCode(_0x11a884,_0x10dab7){_0x10dab7=_0x10dab7||0xcc;return function(_0x34881c){if(_0x34881c){return _0x11a884[_0x38c0('0x16')](_0x10dab7);}return _0x11a884[_0x38c0('0x17')](_0x10dab7)[_0x38c0('0x18')]();};}function respondWithResult(_0x2e288c,_0x11efa2){_0x11efa2=_0x11efa2||0xc8;return function(_0x219175){if(_0x219175){return _0x2e288c[_0x38c0('0x17')](_0x11efa2)[_0x38c0('0x19')](_0x219175);}};}function respondWithFilteredResult(_0x2ff3fd,_0x32f5ae){return function(_0x4d316d){if(_0x4d316d){var _0x5ac99f=typeof _0x32f5ae[_0x38c0('0x1a')]==='undefined'&&typeof _0x32f5ae[_0x38c0('0x1b')]===_0x38c0('0x1c');var _0x38af09=_0x4d316d[_0x38c0('0x1d')];var _0x86fe8b=_0x5ac99f?0x0:_0x32f5ae[_0x38c0('0x1a')];var _0x2a5bcf=_0x5ac99f?_0x4d316d[_0x38c0('0x1d')]:_0x32f5ae[_0x38c0('0x1a')]+_0x32f5ae['limit'];var _0x190bed;if(_0x2a5bcf>=_0x38af09){_0x2a5bcf=_0x38af09;_0x190bed=0xc8;}else{_0x190bed=0xce;}_0x2ff3fd[_0x38c0('0x17')](_0x190bed);return _0x2ff3fd[_0x38c0('0x1e')](_0x38c0('0x1f'),_0x86fe8b+'-'+_0x2a5bcf+'/'+_0x38af09)[_0x38c0('0x19')](_0x4d316d);}return null;};}function patchUpdates(_0x287133){return function(_0x2c0d1e){try{jsonpatch['apply'](_0x2c0d1e,_0x287133,!![]);}catch(_0x8cba1d){return BPromise[_0x38c0('0x20')](_0x8cba1d);}return _0x2c0d1e[_0x38c0('0x21')]();};}function saveUpdates(_0x3cf0b0,_0x33ff72){return function(_0x580567){if(_0x580567){return _0x580567[_0x38c0('0x22')](_0x3cf0b0)['then'](function(_0x315b94){return _0x315b94;});}return null;};}function removeEntity(_0x43fc9b,_0x4d54aa){return function(_0x1161af){if(_0x1161af){return _0x1161af[_0x38c0('0x23')]()['then'](function(){_0x43fc9b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54ac5c,_0x2361d1){return function(_0x4c3ce1){if(!_0x4c3ce1){_0x54ac5c[_0x38c0('0x16')](0x194);}return _0x4c3ce1;};}function handleError(_0x57d2c4,_0x7184dd){_0x7184dd=_0x7184dd||0x1f4;return function(_0x535c4a){logger[_0x38c0('0x24')](_0x535c4a['stack']);if(_0x535c4a[_0x38c0('0x25')]){delete _0x535c4a['name'];}_0x57d2c4[_0x38c0('0x17')](_0x7184dd)[_0x38c0('0x26')](_0x535c4a);};}function getMustacheRender(_0x515521,_0x43f5be){return Mustache['render'](_0x515521,_[_0x38c0('0x27')](_0x43f5be[_0x38c0('0x28')],{'contact':_0x43f5be[_0x38c0('0x29')],'message':_0x43f5be[_0x38c0('0x2a')],'agent':_0x43f5be[_0x38c0('0x2b')],'interaction':_0x43f5be[_0x38c0('0x2c')],'account':_0x43f5be[_0x38c0('0x2d')]}))||'';}exports['index']=function(_0x1f9b6f,_0x3e8aa6){var _0x1ab26a={},_0x3cfcd9={},_0x5ca005={'count':0x0,'rows':[]};var _0x21265b=_[_0x38c0('0x2e')](db[_0x38c0('0x2f')][_0x38c0('0x30')],function(_0x1c1ff4){return{'name':_0x1c1ff4[_0x38c0('0x31')],'type':_0x1c1ff4[_0x38c0('0x32')]['key']};});_0x3cfcd9[_0x38c0('0x33')]=_[_0x38c0('0x34')](_[_0x38c0('0x2e')](_0x21265b,_0x38c0('0x25')),[_0x38c0('0x25')]);_0x3cfcd9[_0x38c0('0x35')]=_['keys'](_0x1f9b6f[_0x38c0('0x35')]);_0x3cfcd9[_0x38c0('0x36')]=_[_0x38c0('0x37')](_0x3cfcd9['model'],_0x3cfcd9[_0x38c0('0x35')]);_0x1ab26a[_0x38c0('0x38')]=_[_0x38c0('0x37')](_0x3cfcd9[_0x38c0('0x33')],qs['fields'](_0x1f9b6f[_0x38c0('0x35')][_0x38c0('0x39')]));_0x1ab26a[_0x38c0('0x38')]=_0x1ab26a['attributes'][_0x38c0('0x3a')]?_0x1ab26a['attributes']:_0x3cfcd9['model'];if(!_0x1f9b6f['query'][_0x38c0('0x3b')](_0x38c0('0x3c'))){_0x1ab26a[_0x38c0('0x1b')]=qs[_0x38c0('0x1b')](_0x1f9b6f[_0x38c0('0x35')][_0x38c0('0x1b')]);_0x1ab26a[_0x38c0('0x1a')]=qs[_0x38c0('0x1a')](_0x1f9b6f[_0x38c0('0x35')]['offset']);}_0x1ab26a[_0x38c0('0x3d')]=qs[_0x38c0('0x3e')](_0x1f9b6f[_0x38c0('0x35')][_0x38c0('0x3e')]);_0x1ab26a[_0x38c0('0x3f')]=qs[_0x38c0('0x36')](_[_0x38c0('0x40')](_0x1f9b6f[_0x38c0('0x35')],_0x3cfcd9['filters']),_0x21265b);if(_0x1f9b6f[_0x38c0('0x35')]['filter']){_0x1ab26a['where']=_[_0x38c0('0x27')](_0x1ab26a[_0x38c0('0x3f')],{'$or':_[_0x38c0('0x2e')](_0x21265b,function(_0x19ba6c){if(_0x19ba6c[_0x38c0('0x32')]!=='VIRTUAL'){var _0x2d0fd4={};_0x2d0fd4[_0x19ba6c[_0x38c0('0x25')]]={'$like':'%'+_0x1f9b6f[_0x38c0('0x35')][_0x38c0('0x41')]+'%'};return _0x2d0fd4;}})});}_0x1ab26a=_[_0x38c0('0x27')]({},_0x1ab26a,_0x1f9b6f['options']);var _0x29d313={'where':_0x1ab26a['where']};return db[_0x38c0('0x2f')]['count'](_0x29d313)[_0x38c0('0x42')](function(_0x533c91){_0x5ca005[_0x38c0('0x1d')]=_0x533c91;if(_0x1f9b6f['query'][_0x38c0('0x43')]){_0x1ab26a['include']=[{'all':!![]}];}return db[_0x38c0('0x2f')]['findAll'](_0x1ab26a);})[_0x38c0('0x42')](function(_0x4412c4){_0x5ca005[_0x38c0('0x44')]=_0x4412c4;return _0x5ca005;})[_0x38c0('0x42')](respondWithFilteredResult(_0x3e8aa6,_0x1ab26a))[_0x38c0('0x45')](handleError(_0x3e8aa6,null));};exports['show']=function(_0x11c248,_0x318c3e){var _0xbc5600={'raw':!![],'where':{'id':_0x11c248[_0x38c0('0x46')]['id']}},_0xc55416={};_0xc55416['model']=_[_0x38c0('0x47')](db[_0x38c0('0x2f')][_0x38c0('0x30')]);_0xc55416[_0x38c0('0x35')]=_['keys'](_0x11c248[_0x38c0('0x35')]);_0xc55416[_0x38c0('0x36')]=_[_0x38c0('0x37')](_0xc55416['model'],_0xc55416[_0x38c0('0x35')]);_0xbc5600[_0x38c0('0x38')]=_['intersection'](_0xc55416[_0x38c0('0x33')],qs[_0x38c0('0x39')](_0x11c248[_0x38c0('0x35')][_0x38c0('0x39')]));_0xbc5600['attributes']=_0xbc5600[_0x38c0('0x38')][_0x38c0('0x3a')]?_0xbc5600[_0x38c0('0x38')]:_0xc55416['model'];if(_0x11c248[_0x38c0('0x35')]['includeAll']){_0xbc5600[_0x38c0('0x48')]=[{'all':!![]}];}_0xbc5600=_[_0x38c0('0x27')]({},_0xbc5600,_0x11c248[_0x38c0('0x49')]);return db[_0x38c0('0x2f')][_0x38c0('0x4a')](_0xbc5600)['then'](handleEntityNotFound(_0x318c3e,null))[_0x38c0('0x42')](respondWithResult(_0x318c3e,null))[_0x38c0('0x45')](handleError(_0x318c3e,null));};exports[_0x38c0('0x4b')]=function(_0x31d1b8,_0x5a24d6){return db['VoiceMailMessage'][_0x38c0('0x4b')](_0x31d1b8['body'],{})[_0x38c0('0x42')](respondWithResult(_0x5a24d6,0xc9))[_0x38c0('0x45')](handleError(_0x5a24d6,null));};exports[_0x38c0('0x22')]=function(_0x595d1d,_0x43013b){if(_0x595d1d[_0x38c0('0x28')]['id']){delete _0x595d1d['body']['id'];}return db[_0x38c0('0x2f')]['find']({'where':{'id':_0x595d1d[_0x38c0('0x46')]['id']}})[_0x38c0('0x42')](handleEntityNotFound(_0x43013b,null))[_0x38c0('0x42')](saveUpdates(_0x595d1d[_0x38c0('0x28')],null))[_0x38c0('0x42')](respondWithResult(_0x43013b,null))['catch'](handleError(_0x43013b,null));};exports[_0x38c0('0x23')]=function(_0x43135d,_0x4120e6){return db[_0x38c0('0x2f')]['find']({'where':{'id':_0x43135d[_0x38c0('0x46')]['id']}})['then'](handleEntityNotFound(_0x4120e6,null))['then'](removeEntity(_0x4120e6,null))['catch'](handleError(_0x4120e6,null));};exports[_0x38c0('0x4c')]=function(_0x193829,_0x5e0ab8,_0x5c4fee){return db[_0x38c0('0x2f')]['find']({'where':{'id':_0x193829[_0x38c0('0x46')]['id']},'attributes':['id',_0x38c0('0x4d'),_0x38c0('0x4e')]})['then'](handleEntityNotFound(_0x5e0ab8,null))[_0x38c0('0x42')](function(_0x5353b8){if(_0x5353b8){if(!_0x5353b8[_0x38c0('0x4d')]){throw new db[(_0x38c0('0x4f'))][(_0x38c0('0x50'))](_0x38c0('0x51'));}var _0x33a875={'Content-Type':_0x38c0('0x52'),'Content-Disposition':'attachment'};if(_0x5353b8[_0x38c0('0x4e')]){_0x33a875['Content-Disposition']=_0x38c0('0x53')+_0x5353b8[_0x38c0('0x4e')]+_0x38c0('0x54');}_0x5e0ab8[_0x38c0('0x1e')](_0x33a875);return _0x5e0ab8['send'](new Buffer(_0x5353b8[_0x38c0('0x4d')]));}})['catch'](handleError(_0x5e0ab8,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 5aa76f9..0e9e9f0 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 _0x252c=['dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage'];(function(_0x2623ba,_0x334373){var _0x348005=function(_0x54a90b){while(--_0x54a90b){_0x2623ba['push'](_0x2623ba['shift']());}};_0x348005(++_0x334373);}(_0x252c,0x196));var _0xc252=function(_0x5ccf96,_0x452b8b){_0x5ccf96=_0x5ccf96-0x0;var _0x2d0357=_0x252c[_0x5ccf96];return _0x2d0357;};'use strict';var _=require(_0xc252('0x0'));var util=require(_0xc252('0x1'));var logger=require(_0xc252('0x2'))(_0xc252('0x3'));var moment=require(_0xc252('0x4'));var BPromise=require(_0xc252('0x5'));var rp=require(_0xc252('0x6'));var fs=require('fs');var path=require(_0xc252('0x7'));var rimraf=require(_0xc252('0x8'));var config=require(_0xc252('0x9'));var attributes=require(_0xc252('0xa'));module[_0xc252('0xb')]=function(_0x508cea,_0x767f0e){return _0x508cea[_0xc252('0xc')](_0xc252('0xd'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0xc252('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x03db=['define','voice_voicemail_messages','lodash','../../config/logger','api','bluebird','path','../../config/environment','./voiceMailMessage.attributes'];(function(_0x39fd75,_0x41892e){var _0x16e820=function(_0x4c5df7){while(--_0x4c5df7){_0x39fd75['push'](_0x39fd75['shift']());}};_0x16e820(++_0x41892e);}(_0x03db,0x1a9));var _0xb03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb03d('0x0'));var util=require('util');var logger=require(_0xb03d('0x1'))(_0xb03d('0x2'));var moment=require('moment');var BPromise=require(_0xb03d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb03d('0x4'));var rimraf=require('rimraf');var config=require(_0xb03d('0x5'));var attributes=require(_0xb03d('0x6'));module['exports']=function(_0x3229c0,_0x27978d){return _0x3229c0[_0xb03d('0x7')]('VoiceMailMessage',attributes,{'tableName':_0xb03d('0x8'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 25de11b..1be8259 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 _0x0b0e=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5c956b,_0xa87d11){_0x5c956b=_0x5c956b-0x0;var _0xaff46a=_0x0b0e[_0x5c956b];return _0xaff46a;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x219c32,_0x2e5c63){var _0x442f4e=function(_0x52ba14){while(--_0x52ba14){_0x219c32['push'](_0x219c32['shift']());}};_0x442f4e(++_0x2e5c63);}(_0x14a0,0x8e));var _0x014a=function(_0x49d58f,_0x322374){_0x49d58f=_0x49d58f-0x0;var _0x6d011f=_0x14a0[_0x49d58f];return _0x6d011f;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index d197f33..adb39ce 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 _0x0d78=['post','addSound','/:id','update','delete','destroy','removeSound','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','getSounds','create'];(function(_0x2accad,_0x1eb64d){var _0xab222b=function(_0x2d4180){while(--_0x2d4180){_0x2accad['push'](_0x2accad['shift']());}};_0xab222b(++_0x1eb64d);}(_0x0d78,0x1bc));var _0x80d7=function(_0x25a86b,_0x269489){_0x25a86b=_0x25a86b-0x0;var _0x584cac=_0x0d78[_0x25a86b];return _0x584cac;};'use strict';var multer=require(_0x80d7('0x0'));var util=require(_0x80d7('0x1'));var path=require(_0x80d7('0x2'));var timeout=require(_0x80d7('0x3'));var express=require(_0x80d7('0x4'));var router=express[_0x80d7('0x5')]();var fs_extra=require(_0x80d7('0x6'));var auth=require(_0x80d7('0x7'));var interaction=require(_0x80d7('0x8'));var config=require(_0x80d7('0x9'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0x80d7('0xa')](),controller[_0x80d7('0xb')]);router[_0x80d7('0xc')]('/:id',auth[_0x80d7('0xa')](),controller[_0x80d7('0xd')]);router[_0x80d7('0xc')]('/:id/sounds',auth[_0x80d7('0xa')](),controller[_0x80d7('0xe')]);router['post']('/',auth[_0x80d7('0xa')](),controller[_0x80d7('0xf')]);router[_0x80d7('0x10')]('/:id/sounds',auth[_0x80d7('0xa')](),controller[_0x80d7('0x11')]);router['put'](_0x80d7('0x12'),auth[_0x80d7('0xa')](),controller[_0x80d7('0x13')]);router[_0x80d7('0x14')](_0x80d7('0x12'),auth['isAuthenticated'](),controller[_0x80d7('0x15')]);router['delete']('/:id/sounds/:id2',auth[_0x80d7('0xa')](),controller[_0x80d7('0x16')]);module['exports']=router; \ No newline at end of file +var _0x95e0=['update','delete','destroy','/:id/sounds/:id2','removeSound','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/sounds','isAuthenticated','getSounds','post','create','put'];(function(_0x411868,_0x1c9172){var _0x1b4f53=function(_0x52b4a2){while(--_0x52b4a2){_0x411868['push'](_0x411868['shift']());}};_0x1b4f53(++_0x1c9172);}(_0x95e0,0xf5));var _0x095e=function(_0x506506,_0x361f2b){_0x506506=_0x506506-0x0;var _0xeb789=_0x95e0[_0x506506];return _0xeb789;};'use strict';var multer=require('multer');var util=require(_0x095e('0x0'));var path=require(_0x095e('0x1'));var timeout=require(_0x095e('0x2'));var express=require(_0x095e('0x3'));var router=express[_0x095e('0x4')]();var fs_extra=require(_0x095e('0x5'));var auth=require(_0x095e('0x6'));var interaction=require(_0x095e('0x7'));var config=require(_0x095e('0x8'));var controller=require('./voiceMusicOnHold.controller');router[_0x095e('0x9')]('/',auth['isAuthenticated'](),controller[_0x095e('0xa')]);router[_0x095e('0x9')](_0x095e('0xb'),auth['isAuthenticated'](),controller[_0x095e('0xc')]);router[_0x095e('0x9')](_0x095e('0xd'),auth[_0x095e('0xe')](),controller[_0x095e('0xf')]);router[_0x095e('0x10')]('/',auth['isAuthenticated'](),controller[_0x095e('0x11')]);router['post'](_0x095e('0xd'),auth[_0x095e('0xe')](),controller['addSound']);router[_0x095e('0x12')](_0x095e('0xb'),auth['isAuthenticated'](),controller[_0x095e('0x13')]);router[_0x095e('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x095e('0x15')]);router['delete'](_0x095e('0x16'),auth[_0x095e('0xe')](),controller[_0x095e('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 90130d8..165b70c 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 _0x717e=['custom','files','quietmp3','STRING','TIMESTAMP','sequelize','exports','name'];(function(_0x11ee6c,_0x1b97ca){var _0x2054f0=function(_0x27b338){while(--_0x27b338){_0x11ee6c['push'](_0x11ee6c['shift']());}};_0x2054f0(++_0x1b97ca);}(_0x717e,0x135));var _0xe717=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0x717e[_0x5a60ce];return _0x393e5e;};'use strict';var Sequelize=require(_0xe717('0x0'));module[_0xe717('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe717('0x2')},'mode':{'type':Sequelize['ENUM'](_0xe717('0x3'),_0xe717('0x4'),'mp3nb','quietmp3nb',_0xe717('0x5'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xe717('0x6')],'allowNull':!![]},'application':{'type':Sequelize[_0xe717('0x6')],'allowNull':!![]},'digit':{'type':Sequelize[_0xe717('0x6')],'allowNull':!![]},'sort':{'type':Sequelize[_0xe717('0x6')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xe717('0x6')],'allowNull':!![]},'stamp':{'type':_0xe717('0x7')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3af2=['custom','quietmp3','mp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3af2,0xf7));var _0x23af=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0x3af2[_0x27d8bc];return _0x4b04cb;};'use strict';var Sequelize=require(_0x23af('0x0'));module[_0x23af('0x1')]={'name':{'type':Sequelize[_0x23af('0x2')],'allowNull':![],'unique':_0x23af('0x3')},'mode':{'type':Sequelize[_0x23af('0x4')](_0x23af('0x5'),'files','mp3nb','quietmp3nb',_0x23af('0x6'),_0x23af('0x7')),'allowNull':!![],'defaultValue':_0x23af('0x8')},'directory':{'type':Sequelize[_0x23af('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x23af('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x23af('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x23af('0x2')],'allowNull':!![],'defaultValue':_0x23af('0x9')},'format':{'type':Sequelize[_0x23af('0x2')],'allowNull':!![]},'stamp':{'type':_0x23af('0xa')},'defaultEntry':{'type':Sequelize[_0x23af('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index b16f9e0..00b8baf 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 _0xedaf=['root','create','files','0777','user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','forEach','unlinkSync','rmdirSync','ValidationError','message','addSound','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','save_name','symlinkSync','Sequelize','removeSound','findOne','id2','Sound','pick','getSounds','hasOwnProperty','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','sendStatus','error','stack','name','render','merge','body','contact','agent','account','index','rawAttributes','type','key','map','filters','intersection','model','query','fields','attributes','length','limit','order','sort','where','filter','options','VoiceMusicOnHold','include','findAll','rows','catch','show','params','keys','includeAll','find','sequelize','transaction','mode','directory','join'];(function(_0x291aaf,_0x4c6d8d){var _0x5571e6=function(_0x1b4fec){while(--_0x1b4fec){_0x291aaf['push'](_0x291aaf['shift']());}};_0x5571e6(++_0x4c6d8d);}(_0xedaf,0x105));var _0xfeda=function(_0xb29298,_0x2b626f){_0xb29298=_0xb29298-0x0;var _0x4c2b7d=_0xedaf[_0xb29298];return _0x4c2b7d;};'use strict';var emlformat=require(_0xfeda('0x0'));var rimraf=require(_0xfeda('0x1'));var zipdir=require(_0xfeda('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfeda('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfeda('0x4'));var util=require(_0xfeda('0x5'));var path=require(_0xfeda('0x6'));var sox=require(_0xfeda('0x7'));var csv=require(_0xfeda('0x8'));var ejs=require(_0xfeda('0x9'));var fs=require('fs');var fs_extra=require(_0xfeda('0xa'));var _=require(_0xfeda('0xb'));var squel=require(_0xfeda('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfeda('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfeda('0xe'));var Papa=require(_0xfeda('0xf'));var Redis=require(_0xfeda('0x10'));var authService=require(_0xfeda('0x11'));var qs=require(_0xfeda('0x12'));var as=require(_0xfeda('0x13'));var hardwareService=require(_0xfeda('0x14'));var logger=require('../../config/logger')(_0xfeda('0x15'));var utils=require(_0xfeda('0x16'));var config=require(_0xfeda('0x17'));var licenseUtil=require(_0xfeda('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b344c,_0x56ebfa){_0x56ebfa=_0x56ebfa||0xcc;return function(_0x398d3d){if(_0x398d3d){return _0x4b344c['sendStatus'](_0x56ebfa);}return _0x4b344c[_0xfeda('0x19')](_0x56ebfa)[_0xfeda('0x1a')]();};}function respondWithResult(_0x59ea86,_0x2784f3){_0x2784f3=_0x2784f3||0xc8;return function(_0x3e8398){if(_0x3e8398){return _0x59ea86[_0xfeda('0x19')](_0x2784f3)[_0xfeda('0x1b')](_0x3e8398);}};}function respondWithFilteredResult(_0x2555a0,_0x2dac91){return function(_0x4bbe89){if(_0x4bbe89){var _0x5ec098=typeof _0x2dac91[_0xfeda('0x1c')]===_0xfeda('0x1d')&&typeof _0x2dac91['limit']===_0xfeda('0x1d');var _0x3fe133=_0x4bbe89[_0xfeda('0x1e')];var _0x91f839=_0x5ec098?0x0:_0x2dac91[_0xfeda('0x1c')];var _0x4c39f3=_0x5ec098?_0x4bbe89[_0xfeda('0x1e')]:_0x2dac91[_0xfeda('0x1c')]+_0x2dac91['limit'];var _0x56b557;if(_0x4c39f3>=_0x3fe133){_0x4c39f3=_0x3fe133;_0x56b557=0xc8;}else{_0x56b557=0xce;}_0x2555a0[_0xfeda('0x19')](_0x56b557);return _0x2555a0[_0xfeda('0x1f')](_0xfeda('0x20'),_0x91f839+'-'+_0x4c39f3+'/'+_0x3fe133)[_0xfeda('0x1b')](_0x4bbe89);}return null;};}function patchUpdates(_0x5f0c74){return function(_0x2eefcd){try{jsonpatch[_0xfeda('0x21')](_0x2eefcd,_0x5f0c74,!![]);}catch(_0x7be1e2){return BPromise[_0xfeda('0x22')](_0x7be1e2);}return _0x2eefcd[_0xfeda('0x23')]();};}function saveUpdates(_0x223bf9,_0x304981){return function(_0x3ff302){if(_0x3ff302){return _0x3ff302[_0xfeda('0x24')](_0x223bf9)['then'](function(_0xcd063c){return _0xcd063c;});}return null;};}function removeEntity(_0x2e085a,_0x1f81a0){return function(_0xf170dd){if(_0xf170dd){return _0xf170dd[_0xfeda('0x25')]()['then'](function(){var _0x274de7=_0xf170dd[_0xfeda('0x26')]({'plain':!![]});var _0x465d52='MusicOnHolds';return db[_0xfeda('0x27')][_0xfeda('0x25')]({'where':{'type':_0x465d52,'resourceId':_0x274de7['id']}})[_0xfeda('0x28')](function(){return _0xf170dd;});})[_0xfeda('0x28')](function(){_0x2e085a[_0xfeda('0x19')](0xcc)[_0xfeda('0x1a')]();});}};}function handleEntityNotFound(_0x270177,_0x58a9aa){return function(_0x29964d){if(!_0x29964d){_0x270177[_0xfeda('0x29')](0x194);}return _0x29964d;};}function handleError(_0x4c69f2,_0x5cf962){_0x5cf962=_0x5cf962||0x1f4;return function(_0x161baa){logger[_0xfeda('0x2a')](_0x161baa[_0xfeda('0x2b')]);if(_0x161baa['name']){delete _0x161baa[_0xfeda('0x2c')];}_0x4c69f2['status'](_0x5cf962)['send'](_0x161baa);};}function getMustacheRender(_0x4c8e3f,_0x2cccb3){return Mustache[_0xfeda('0x2d')](_0x4c8e3f,_[_0xfeda('0x2e')](_0x2cccb3[_0xfeda('0x2f')],{'contact':_0x2cccb3[_0xfeda('0x30')],'message':_0x2cccb3['message'],'agent':_0x2cccb3[_0xfeda('0x31')],'interaction':_0x2cccb3['interaction'],'account':_0x2cccb3[_0xfeda('0x32')]}))||'';}exports[_0xfeda('0x33')]=function(_0x51de87,_0x3b87ca){var _0x3a8a42={},_0xe0798b={},_0x45433c={'count':0x0,'rows':[]};var _0x519086=_['map'](db['VoiceMusicOnHold'][_0xfeda('0x34')],function(_0x16032b){return{'name':_0x16032b['fieldName'],'type':_0x16032b[_0xfeda('0x35')][_0xfeda('0x36')]};});_0xe0798b['model']=_[_0xfeda('0x37')](_0x519086,_0xfeda('0x2c'));_0xe0798b['query']=_['keys'](_0x51de87['query']);_0xe0798b[_0xfeda('0x38')]=_[_0xfeda('0x39')](_0xe0798b[_0xfeda('0x3a')],_0xe0798b[_0xfeda('0x3b')]);_0x3a8a42['attributes']=_['intersection'](_0xe0798b[_0xfeda('0x3a')],qs[_0xfeda('0x3c')](_0x51de87[_0xfeda('0x3b')]['fields']));_0x3a8a42['attributes']=_0x3a8a42[_0xfeda('0x3d')][_0xfeda('0x3e')]?_0x3a8a42[_0xfeda('0x3d')]:_0xe0798b[_0xfeda('0x3a')];if(!_0x51de87[_0xfeda('0x3b')]['hasOwnProperty']('nolimit')){_0x3a8a42[_0xfeda('0x3f')]=qs['limit'](_0x51de87[_0xfeda('0x3b')][_0xfeda('0x3f')]);_0x3a8a42[_0xfeda('0x1c')]=qs['offset'](_0x51de87[_0xfeda('0x3b')]['offset']);}_0x3a8a42[_0xfeda('0x40')]=qs[_0xfeda('0x41')](_0x51de87[_0xfeda('0x3b')][_0xfeda('0x41')]);delete _0x51de87[_0xfeda('0x3b')][_0xfeda('0x41')];_0x3a8a42[_0xfeda('0x42')]=qs[_0xfeda('0x38')](_['pick'](_0x51de87[_0xfeda('0x3b')],_0xe0798b[_0xfeda('0x38')]),_0x519086);if(_0x51de87[_0xfeda('0x3b')][_0xfeda('0x43')]){_0x3a8a42['where']=_[_0xfeda('0x2e')](_0x3a8a42['where'],{'$or':_['map'](_0x519086,function(_0x4a2c58){if(_0x4a2c58[_0xfeda('0x35')]!=='VIRTUAL'){var _0xddae76={};_0xddae76[_0x4a2c58['name']]={'$like':'%'+_0x51de87[_0xfeda('0x3b')][_0xfeda('0x43')]+'%'};return _0xddae76;}})});}_0x3a8a42=_[_0xfeda('0x2e')]({},_0x3a8a42,_0x51de87[_0xfeda('0x44')]);var _0x5059c0={'where':_0x3a8a42[_0xfeda('0x42')]};return db[_0xfeda('0x45')][_0xfeda('0x1e')](_0x5059c0)[_0xfeda('0x28')](function(_0x43710f){_0x45433c[_0xfeda('0x1e')]=_0x43710f;if(_0x51de87['query']['includeAll']){_0x3a8a42[_0xfeda('0x46')]=[{'all':!![]}];}return db[_0xfeda('0x45')][_0xfeda('0x47')](_0x3a8a42);})[_0xfeda('0x28')](function(_0xe1cf39){_0x45433c[_0xfeda('0x48')]=_0xe1cf39;return _0x45433c;})[_0xfeda('0x28')](respondWithFilteredResult(_0x3b87ca,_0x3a8a42))[_0xfeda('0x49')](handleError(_0x3b87ca,null));};exports[_0xfeda('0x4a')]=function(_0x15cc45,_0x2c009e){var _0x1b1cba={'raw':![],'where':{'id':_0x15cc45[_0xfeda('0x4b')]['id']}},_0x229467={};_0x229467[_0xfeda('0x3a')]=_[_0xfeda('0x4c')](db['VoiceMusicOnHold'][_0xfeda('0x34')]);_0x229467[_0xfeda('0x3b')]=_[_0xfeda('0x4c')](_0x15cc45[_0xfeda('0x3b')]);_0x229467[_0xfeda('0x38')]=_[_0xfeda('0x39')](_0x229467[_0xfeda('0x3a')],_0x229467[_0xfeda('0x3b')]);_0x1b1cba['attributes']=_[_0xfeda('0x39')](_0x229467[_0xfeda('0x3a')],qs[_0xfeda('0x3c')](_0x15cc45['query'][_0xfeda('0x3c')]));_0x1b1cba[_0xfeda('0x3d')]=_0x1b1cba['attributes'][_0xfeda('0x3e')]?_0x1b1cba['attributes']:_0x229467[_0xfeda('0x3a')];if(_0x15cc45[_0xfeda('0x3b')][_0xfeda('0x4d')]){_0x1b1cba[_0xfeda('0x46')]=[{'all':!![]}];}_0x1b1cba=_['merge']({},_0x1b1cba,_0x15cc45[_0xfeda('0x44')]);return db[_0xfeda('0x45')][_0xfeda('0x4e')](_0x1b1cba)['then'](handleEntityNotFound(_0x2c009e,null))[_0xfeda('0x28')](respondWithResult(_0x2c009e,null))[_0xfeda('0x49')](handleError(_0x2c009e,null));};exports[_0xfeda('0x24')]=function(_0x34f037,_0x2fa494){if(_0x34f037[_0xfeda('0x2f')]['id']){delete _0x34f037[_0xfeda('0x2f')]['id'];}return db[_0xfeda('0x45')][_0xfeda('0x4e')]({'where':{'id':_0x34f037[_0xfeda('0x4b')]['id']}})[_0xfeda('0x28')](handleEntityNotFound(_0x2fa494,null))['then'](saveUpdates(_0x34f037['body'],null))['then'](respondWithResult(_0x2fa494,null))[_0xfeda('0x49')](handleError(_0x2fa494,null));};exports['create']=function(_0x1cda7e,_0x4b5e68,_0x4cedab){return db[_0xfeda('0x4f')][_0xfeda('0x50')](function(_0xfb104){if(_0x1cda7e[_0xfeda('0x2f')][_0xfeda('0x51')]==='files'){_0x1cda7e[_0xfeda('0x2f')][_0xfeda('0x52')]=path[_0xfeda('0x53')](config[_0xfeda('0x54')],'server/files/moh',_0x1cda7e[_0xfeda('0x2f')][_0xfeda('0x2c')]);}return db[_0xfeda('0x45')][_0xfeda('0x55')](_0x1cda7e[_0xfeda('0x2f')],{'transaction':_0xfb104})['then'](function(_0x1ac4a6){if(_0x1cda7e[_0xfeda('0x2f')][_0xfeda('0x51')]===_0xfeda('0x56')){fs['mkdirSync'](_0x1ac4a6[_0xfeda('0x52')],parseInt(_0xfeda('0x57'),0x8));}var _0x425da4=_0x1cda7e[_0xfeda('0x58')][_0xfeda('0x26')]({'plain':!![]});if(!_0x425da4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x425da4[_0xfeda('0x59')]==='user'){var _0x22c2a1=_0x1ac4a6[_0xfeda('0x26')]({'plain':!![]});return db[_0xfeda('0x5a')][_0xfeda('0x4e')]({'where':{'name':_0xfeda('0x5b'),'userProfileId':_0x425da4[_0xfeda('0x5c')]},'raw':!![]})['then'](function(_0x318ee7){if(_0x318ee7&&_0x318ee7[_0xfeda('0x5d')]===0x0){return db[_0xfeda('0x27')][_0xfeda('0x55')]({'name':_0x22c2a1[_0xfeda('0x2c')],'resourceId':_0x22c2a1['id'],'type':_0x318ee7[_0xfeda('0x2c')],'sectionId':_0x318ee7['id']},{})['then'](function(){return _0x1ac4a6;});}else{return _0x1ac4a6;}})[_0xfeda('0x49')](function(_0x5957e1){logger[_0xfeda('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5957e1);});}return _0x1ac4a6;});})[_0xfeda('0x28')](respondWithResult(_0x4b5e68,0xc9))['catch'](handleError(_0x4b5e68,null));};exports[_0xfeda('0x25')]=function(_0x45dc52,_0x3316df,_0x259de3){var _0xf4db28;return db['VoiceMusicOnHold'][_0xfeda('0x4e')]({'where':{'id':_0x45dc52[_0xfeda('0x4b')]['id']}})[_0xfeda('0x28')](function(_0x3988f8){if(_0x3988f8){return db['sequelize']['transaction'](function(_0x51af20){return _0x3988f8[_0xfeda('0x25')]({'transaction':_0x51af20,'raw':!![]})[_0xfeda('0x28')](function(_0x3831f4){if(_0x3831f4[_0xfeda('0x52')]){fs['readdirSync'](_0x3831f4[_0xfeda('0x52')])[_0xfeda('0x5e')](function(_0x160474){fs[_0xfeda('0x5f')](path[_0xfeda('0x53')](_0x3831f4['directory'],_0x160474));});fs[_0xfeda('0x60')](_0x3831f4['directory']);}return _0x3831f4;});})['catch'](function(_0x426830){throw new db['Sequelize'][(_0xfeda('0x61'))](_0x426830[_0xfeda('0x62')]);});}})['then'](handleEntityNotFound(_0x3316df,null))['then'](removeEntity(_0x3316df,null))[_0xfeda('0x49')](handleError(_0x3316df,null));};exports[_0xfeda('0x63')]=function(_0x196af1,_0x359b73,_0x5dc57c){return db[_0xfeda('0x4f')][_0xfeda('0x50')](function(_0x196b11){var _0x24163d;return db['VoiceMusicOnHold'][_0xfeda('0x4e')]({'where':{'id':_0x196af1[_0xfeda('0x4b')]['id']}})[_0xfeda('0x28')](function(_0x4ec4a2){if(_0x4ec4a2){_0x24163d=_0x4ec4a2;return _0x4ec4a2[_0xfeda('0x63')](_0x196af1[_0xfeda('0x2f')]['id'],{'transaction':_0x196b11});}})[_0xfeda('0x28')](function(_0x5861a5){if(_0x5861a5){return db['Sound']['findOne']({'where':{'id':_0x196af1[_0xfeda('0x2f')]['id']},'attributes':['id',_0xfeda('0x2c'),'save_name',_0xfeda('0x64'),_0xfeda('0x65')],'raw':!![]});}})[_0xfeda('0x28')](function(_0x593d49){if(_0x593d49){var _0x318aaa=path['join'](config[_0xfeda('0x54')],_0xfeda('0x66'),util[_0xfeda('0x67')](_0xfeda('0x68'),path['basename'](_0x593d49[_0xfeda('0x69')],path['extname'](_0x593d49[_0xfeda('0x69')])),_0x593d49[_0xfeda('0x64')]));var _0x55e384=path[_0xfeda('0x53')](config[_0xfeda('0x54')],'server/files/moh',_0x24163d['name'],util[_0xfeda('0x67')]('%s.%s',_0x593d49[_0xfeda('0x2c')],_0x593d49['converted_format']));fs[_0xfeda('0x6a')](_0x318aaa,_0x55e384);return _0x593d49;}})[_0xfeda('0x49')](function(_0x35f9e0){throw new db[(_0xfeda('0x6b'))][(_0xfeda('0x61'))](_0x35f9e0[_0xfeda('0x62')]);});})[_0xfeda('0x28')](handleEntityNotFound(_0x359b73,null))['then'](respondWithResult(_0x359b73,0xc9))[_0xfeda('0x49')](handleError(_0x359b73,null));};exports[_0xfeda('0x6c')]=function(_0x46da3f,_0x38bc51,_0x2ed4f0){return db[_0xfeda('0x4f')][_0xfeda('0x50')](function(_0x4e6e74){var _0x16130c;return db[_0xfeda('0x45')][_0xfeda('0x6d')]({'where':{'id':_0x46da3f[_0xfeda('0x4b')]['id']}})['then'](handleEntityNotFound(_0x38bc51,null))[_0xfeda('0x28')](function(_0x775ff9){if(_0x775ff9){_0x16130c=_0x775ff9;return _0x775ff9[_0xfeda('0x6c')](_0x46da3f[_0xfeda('0x4b')][_0xfeda('0x6e')]);}})[_0xfeda('0x28')](function(_0x156a78){if(_0x156a78){return db[_0xfeda('0x6f')]['findOne']({'where':{'id':_0x46da3f[_0xfeda('0x4b')][_0xfeda('0x6e')]},'attributes':['id',_0xfeda('0x2c'),_0xfeda('0x69'),_0xfeda('0x64'),'createdAt'],'raw':!![]});}})['then'](function(_0x388053){if(_0x388053){fs[_0xfeda('0x5f')](path[_0xfeda('0x53')](_0x16130c[_0xfeda('0x52')],util[_0xfeda('0x67')](_0xfeda('0x68'),_0x388053[_0xfeda('0x2c')],_0x388053[_0xfeda('0x64')])));return _0x388053;}})[_0xfeda('0x49')](function(_0x19ddb7){throw new db[(_0xfeda('0x6b'))][(_0xfeda('0x61'))](_0x19ddb7[_0xfeda('0x62')]);});})[_0xfeda('0x28')](handleEntityNotFound(_0x38bc51,null))[_0xfeda('0x28')](respondWithStatusCode(_0x38bc51,0xcc))[_0xfeda('0x49')](handleError(_0x38bc51,null));};exports['getSounds']=function(_0x217a57,_0x5991ce,_0x318c6){var _0x98e3db={};var _0x46191a={};var _0x255c0d;var _0x146391;return db[_0xfeda('0x45')][_0xfeda('0x6d')]({'where':{'id':_0x217a57[_0xfeda('0x4b')]['id']}})[_0xfeda('0x28')](handleEntityNotFound(_0x5991ce,null))[_0xfeda('0x28')](function(_0x1f433){if(_0x1f433){_0x255c0d=_0x1f433;_0x46191a[_0xfeda('0x3a')]=_[_0xfeda('0x4c')](db[_0xfeda('0x6f')][_0xfeda('0x34')]);_0x46191a[_0xfeda('0x3b')]=_[_0xfeda('0x4c')](_0x217a57['query']);_0x46191a[_0xfeda('0x38')]=_[_0xfeda('0x39')](_0x46191a['model'],_0x46191a[_0xfeda('0x3b')]);_0x98e3db[_0xfeda('0x3d')]=_[_0xfeda('0x39')](_0x46191a[_0xfeda('0x3a')],qs[_0xfeda('0x3c')](_0x217a57[_0xfeda('0x3b')][_0xfeda('0x3c')]));_0x98e3db['attributes']=_0x98e3db['attributes'][_0xfeda('0x3e')]?_0x98e3db[_0xfeda('0x3d')]:_0x46191a[_0xfeda('0x3a')];_0x98e3db[_0xfeda('0x40')]=qs[_0xfeda('0x41')](_0x217a57[_0xfeda('0x3b')][_0xfeda('0x41')]);_0x98e3db['where']=qs['filters'](_[_0xfeda('0x70')](_0x217a57['query'],_0x46191a[_0xfeda('0x38')]));if(_0x217a57[_0xfeda('0x3b')][_0xfeda('0x43')]){_0x98e3db[_0xfeda('0x42')]=_[_0xfeda('0x2e')](_0x98e3db[_0xfeda('0x42')],{'$or':_[_0xfeda('0x37')](_0x98e3db['attributes'],function(_0x35daad){var _0x3ffb5a={};_0x3ffb5a[_0x35daad]={'$like':'%'+_0x217a57[_0xfeda('0x3b')][_0xfeda('0x43')]+'%'};return _0x3ffb5a;})});}_0x98e3db=_[_0xfeda('0x2e')]({},_0x98e3db,_0x217a57['options']);return _0x255c0d[_0xfeda('0x71')](_0x98e3db);}})[_0xfeda('0x28')](function(_0x3f6b6d){if(_0x3f6b6d){_0x146391=_0x3f6b6d[_0xfeda('0x3e')];if(!_0x217a57[_0xfeda('0x3b')][_0xfeda('0x72')]('nolimit')){_0x98e3db[_0xfeda('0x3f')]=qs[_0xfeda('0x3f')](_0x217a57[_0xfeda('0x3b')][_0xfeda('0x3f')]);_0x98e3db[_0xfeda('0x1c')]=qs['offset'](_0x217a57[_0xfeda('0x3b')][_0xfeda('0x1c')]);}return _0x255c0d[_0xfeda('0x71')](_0x98e3db);}})[_0xfeda('0x28')](function(_0x18cb27){if(_0x18cb27){return _0x18cb27?{'count':_0x146391,'rows':_0x18cb27}:null;}})[_0xfeda('0x28')](respondWithResult(_0x5991ce,null))[_0xfeda('0x49')](handleError(_0x5991ce,null));}; \ No newline at end of file +var _0xa74a=['model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','filter','merge','type','VIRTUAL','findAll','rows','catch','show','params','includeAll','include','options','find','create','sequelize','transaction','mode','directory','join','root','server/files/moh','files','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','destroy','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','removeSound','id2','getSounds','pick','eml-format','fast-json-patch','moment','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','get','MusicOnHolds','UserProfileResource','error','stack','name','send','body','contact','agent','account','index','map','VoiceMusicOnHold','fieldName','key'];(function(_0x107de1,_0x21dbe4){var _0x23dc6b=function(_0x19bf3b){while(--_0x19bf3b){_0x107de1['push'](_0x107de1['shift']());}};_0x23dc6b(++_0x21dbe4);}(_0xa74a,0x1e0));var _0xaa74=function(_0x26dae8,_0xfe1df0){_0x26dae8=_0x26dae8-0x0;var _0x25b42a=_0xa74a[_0x26dae8];return _0x25b42a;};'use strict';var emlformat=require(_0xaa74('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaa74('0x1'));var rp=require('request-promise');var moment=require(_0xaa74('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xaa74('0x3'));var csv=require('to-csv');var ejs=require(_0xaa74('0x4'));var fs=require('fs');var fs_extra=require(_0xaa74('0x5'));var _=require(_0xaa74('0x6'));var squel=require(_0xaa74('0x7'));var crypto=require('crypto');var jsforce=require(_0xaa74('0x8'));var deskjs=require(_0xaa74('0x9'));var toCsv=require(_0xaa74('0xa'));var querystring=require(_0xaa74('0xb'));var Papa=require('papaparse');var Redis=require(_0xaa74('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xaa74('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa74('0xe'))('api');var utils=require(_0xaa74('0xf'));var config=require(_0xaa74('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa74('0x11'))['db'];function respondWithStatusCode(_0xeb62ff,_0x6e3904){_0x6e3904=_0x6e3904||0xcc;return function(_0x5401d1){if(_0x5401d1){return _0xeb62ff[_0xaa74('0x12')](_0x6e3904);}return _0xeb62ff[_0xaa74('0x13')](_0x6e3904)[_0xaa74('0x14')]();};}function respondWithResult(_0x42f5d6,_0x16aeab){_0x16aeab=_0x16aeab||0xc8;return function(_0xa9232c){if(_0xa9232c){return _0x42f5d6[_0xaa74('0x13')](_0x16aeab)[_0xaa74('0x15')](_0xa9232c);}};}function respondWithFilteredResult(_0x1a7aaf,_0x272a14){return function(_0x3dbf78){if(_0x3dbf78){var _0x20b963=typeof _0x272a14[_0xaa74('0x16')]===_0xaa74('0x17')&&typeof _0x272a14[_0xaa74('0x18')]===_0xaa74('0x17');var _0x1bc70f=_0x3dbf78['count'];var _0x390cec=_0x20b963?0x0:_0x272a14[_0xaa74('0x16')];var _0x543745=_0x20b963?_0x3dbf78[_0xaa74('0x19')]:_0x272a14[_0xaa74('0x16')]+_0x272a14[_0xaa74('0x18')];var _0x3968c3;if(_0x543745>=_0x1bc70f){_0x543745=_0x1bc70f;_0x3968c3=0xc8;}else{_0x3968c3=0xce;}_0x1a7aaf[_0xaa74('0x13')](_0x3968c3);return _0x1a7aaf[_0xaa74('0x1a')]('Content-Range',_0x390cec+'-'+_0x543745+'/'+_0x1bc70f)[_0xaa74('0x15')](_0x3dbf78);}return null;};}function patchUpdates(_0x1c0a7f){return function(_0x271d65){try{jsonpatch['apply'](_0x271d65,_0x1c0a7f,!![]);}catch(_0x39ddd9){return BPromise['reject'](_0x39ddd9);}return _0x271d65['save']();};}function saveUpdates(_0x27e0d1,_0x2b46a2){return function(_0x54ef41){if(_0x54ef41){return _0x54ef41[_0xaa74('0x1b')](_0x27e0d1)[_0xaa74('0x1c')](function(_0x4df816){return _0x4df816;});}return null;};}function removeEntity(_0xc144c4,_0x5525d7){return function(_0x15925c){if(_0x15925c){return _0x15925c['destroy']()[_0xaa74('0x1c')](function(){var _0x41914b=_0x15925c[_0xaa74('0x1d')]({'plain':!![]});var _0x145a56=_0xaa74('0x1e');return db[_0xaa74('0x1f')]['destroy']({'where':{'type':_0x145a56,'resourceId':_0x41914b['id']}})[_0xaa74('0x1c')](function(){return _0x15925c;});})['then'](function(){_0xc144c4[_0xaa74('0x13')](0xcc)[_0xaa74('0x14')]();});}};}function handleEntityNotFound(_0x4cca27,_0x79c3b){return function(_0x5a5f9e){if(!_0x5a5f9e){_0x4cca27[_0xaa74('0x12')](0x194);}return _0x5a5f9e;};}function handleError(_0x3f6c7e,_0x4fa677){_0x4fa677=_0x4fa677||0x1f4;return function(_0x50161a){logger[_0xaa74('0x20')](_0x50161a[_0xaa74('0x21')]);if(_0x50161a[_0xaa74('0x22')]){delete _0x50161a['name'];}_0x3f6c7e['status'](_0x4fa677)[_0xaa74('0x23')](_0x50161a);};}function getMustacheRender(_0x51a799,_0x4472be){return Mustache['render'](_0x51a799,_['merge'](_0x4472be[_0xaa74('0x24')],{'contact':_0x4472be[_0xaa74('0x25')],'message':_0x4472be['message'],'agent':_0x4472be[_0xaa74('0x26')],'interaction':_0x4472be['interaction'],'account':_0x4472be[_0xaa74('0x27')]}))||'';}exports[_0xaa74('0x28')]=function(_0x49d654,_0x414e69){var _0x39e2e3={},_0x3660ac={},_0x9d4ad7={'count':0x0,'rows':[]};var _0x3c7045=_[_0xaa74('0x29')](db[_0xaa74('0x2a')]['rawAttributes'],function(_0x1b73e3){return{'name':_0x1b73e3[_0xaa74('0x2b')],'type':_0x1b73e3['type'][_0xaa74('0x2c')]};});_0x3660ac[_0xaa74('0x2d')]=_[_0xaa74('0x29')](_0x3c7045,_0xaa74('0x22'));_0x3660ac[_0xaa74('0x2e')]=_[_0xaa74('0x2f')](_0x49d654[_0xaa74('0x2e')]);_0x3660ac['filters']=_[_0xaa74('0x30')](_0x3660ac['model'],_0x3660ac['query']);_0x39e2e3['attributes']=_[_0xaa74('0x30')](_0x3660ac[_0xaa74('0x2d')],qs['fields'](_0x49d654[_0xaa74('0x2e')][_0xaa74('0x31')]));_0x39e2e3[_0xaa74('0x32')]=_0x39e2e3[_0xaa74('0x32')][_0xaa74('0x33')]?_0x39e2e3[_0xaa74('0x32')]:_0x3660ac['model'];if(!_0x49d654[_0xaa74('0x2e')][_0xaa74('0x34')]('nolimit')){_0x39e2e3[_0xaa74('0x18')]=qs[_0xaa74('0x18')](_0x49d654[_0xaa74('0x2e')][_0xaa74('0x18')]);_0x39e2e3[_0xaa74('0x16')]=qs[_0xaa74('0x16')](_0x49d654[_0xaa74('0x2e')][_0xaa74('0x16')]);}_0x39e2e3['order']=qs[_0xaa74('0x35')](_0x49d654['query'][_0xaa74('0x35')]);delete _0x49d654[_0xaa74('0x2e')][_0xaa74('0x35')];_0x39e2e3[_0xaa74('0x36')]=qs[_0xaa74('0x37')](_['pick'](_0x49d654[_0xaa74('0x2e')],_0x3660ac[_0xaa74('0x37')]),_0x3c7045);if(_0x49d654[_0xaa74('0x2e')][_0xaa74('0x38')]){_0x39e2e3[_0xaa74('0x36')]=_[_0xaa74('0x39')](_0x39e2e3[_0xaa74('0x36')],{'$or':_[_0xaa74('0x29')](_0x3c7045,function(_0x333a6b){if(_0x333a6b[_0xaa74('0x3a')]!==_0xaa74('0x3b')){var _0x3beef2={};_0x3beef2[_0x333a6b[_0xaa74('0x22')]]={'$like':'%'+_0x49d654[_0xaa74('0x2e')][_0xaa74('0x38')]+'%'};return _0x3beef2;}})});}_0x39e2e3=_[_0xaa74('0x39')]({},_0x39e2e3,_0x49d654['options']);var _0x271c3b={'where':_0x39e2e3[_0xaa74('0x36')]};return db[_0xaa74('0x2a')][_0xaa74('0x19')](_0x271c3b)['then'](function(_0xcd4c9a){_0x9d4ad7['count']=_0xcd4c9a;if(_0x49d654[_0xaa74('0x2e')]['includeAll']){_0x39e2e3['include']=[{'all':!![]}];}return db[_0xaa74('0x2a')][_0xaa74('0x3c')](_0x39e2e3);})[_0xaa74('0x1c')](function(_0x48172a){_0x9d4ad7[_0xaa74('0x3d')]=_0x48172a;return _0x9d4ad7;})[_0xaa74('0x1c')](respondWithFilteredResult(_0x414e69,_0x39e2e3))[_0xaa74('0x3e')](handleError(_0x414e69,null));};exports[_0xaa74('0x3f')]=function(_0x175655,_0x511d1e){var _0x30caac={'raw':![],'where':{'id':_0x175655[_0xaa74('0x40')]['id']}},_0x30c8bf={};_0x30c8bf[_0xaa74('0x2d')]=_[_0xaa74('0x2f')](db[_0xaa74('0x2a')]['rawAttributes']);_0x30c8bf['query']=_[_0xaa74('0x2f')](_0x175655[_0xaa74('0x2e')]);_0x30c8bf[_0xaa74('0x37')]=_[_0xaa74('0x30')](_0x30c8bf[_0xaa74('0x2d')],_0x30c8bf[_0xaa74('0x2e')]);_0x30caac['attributes']=_[_0xaa74('0x30')](_0x30c8bf[_0xaa74('0x2d')],qs[_0xaa74('0x31')](_0x175655[_0xaa74('0x2e')][_0xaa74('0x31')]));_0x30caac['attributes']=_0x30caac[_0xaa74('0x32')][_0xaa74('0x33')]?_0x30caac[_0xaa74('0x32')]:_0x30c8bf[_0xaa74('0x2d')];if(_0x175655[_0xaa74('0x2e')][_0xaa74('0x41')]){_0x30caac[_0xaa74('0x42')]=[{'all':!![]}];}_0x30caac=_['merge']({},_0x30caac,_0x175655[_0xaa74('0x43')]);return db['VoiceMusicOnHold'][_0xaa74('0x44')](_0x30caac)[_0xaa74('0x1c')](handleEntityNotFound(_0x511d1e,null))['then'](respondWithResult(_0x511d1e,null))['catch'](handleError(_0x511d1e,null));};exports['update']=function(_0x543706,_0x16134d){if(_0x543706[_0xaa74('0x24')]['id']){delete _0x543706['body']['id'];}return db['VoiceMusicOnHold'][_0xaa74('0x44')]({'where':{'id':_0x543706[_0xaa74('0x40')]['id']}})[_0xaa74('0x1c')](handleEntityNotFound(_0x16134d,null))[_0xaa74('0x1c')](saveUpdates(_0x543706[_0xaa74('0x24')],null))[_0xaa74('0x1c')](respondWithResult(_0x16134d,null))['catch'](handleError(_0x16134d,null));};exports[_0xaa74('0x45')]=function(_0x8a7d42,_0x3d9129,_0x2abf37){return db[_0xaa74('0x46')][_0xaa74('0x47')](function(_0x221ef6){if(_0x8a7d42[_0xaa74('0x24')][_0xaa74('0x48')]==='files'){_0x8a7d42[_0xaa74('0x24')][_0xaa74('0x49')]=path[_0xaa74('0x4a')](config[_0xaa74('0x4b')],_0xaa74('0x4c'),_0x8a7d42[_0xaa74('0x24')][_0xaa74('0x22')]);}return db['VoiceMusicOnHold'][_0xaa74('0x45')](_0x8a7d42['body'],{'transaction':_0x221ef6})[_0xaa74('0x1c')](function(_0x49af9d){if(_0x8a7d42[_0xaa74('0x24')]['mode']===_0xaa74('0x4d')){fs[_0xaa74('0x4e')](_0x49af9d[_0xaa74('0x49')],parseInt(_0xaa74('0x4f'),0x8));}var _0x100508=_0x8a7d42['user'][_0xaa74('0x1d')]({'plain':!![]});if(!_0x100508)throw new Error(_0xaa74('0x50'));if(_0x100508['role']===_0xaa74('0x51')){var _0x142598=_0x49af9d['get']({'plain':!![]});return db['UserProfileSection'][_0xaa74('0x44')]({'where':{'name':_0xaa74('0x1e'),'userProfileId':_0x100508[_0xaa74('0x52')]},'raw':!![]})[_0xaa74('0x1c')](function(_0x629f57){if(_0x629f57&&_0x629f57[_0xaa74('0x53')]===0x0){return db[_0xaa74('0x1f')][_0xaa74('0x45')]({'name':_0x142598[_0xaa74('0x22')],'resourceId':_0x142598['id'],'type':_0x629f57[_0xaa74('0x22')],'sectionId':_0x629f57['id']},{})[_0xaa74('0x1c')](function(){return _0x49af9d;});}else{return _0x49af9d;}})[_0xaa74('0x3e')](function(_0x17d58c){logger[_0xaa74('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17d58c);});}return _0x49af9d;});})[_0xaa74('0x1c')](respondWithResult(_0x3d9129,0xc9))[_0xaa74('0x3e')](handleError(_0x3d9129,null));};exports[_0xaa74('0x54')]=function(_0x5b5349,_0x19b924,_0x8170b9){var _0x91c6b8;return db[_0xaa74('0x2a')][_0xaa74('0x44')]({'where':{'id':_0x5b5349['params']['id']}})['then'](function(_0x5f41a9){if(_0x5f41a9){return db[_0xaa74('0x46')][_0xaa74('0x47')](function(_0x4b65a0){return _0x5f41a9[_0xaa74('0x54')]({'transaction':_0x4b65a0,'raw':!![]})[_0xaa74('0x1c')](function(_0x3cf041){if(_0x3cf041[_0xaa74('0x49')]){fs['readdirSync'](_0x3cf041[_0xaa74('0x49')])['forEach'](function(_0x4805f2){fs[_0xaa74('0x55')](path['join'](_0x3cf041['directory'],_0x4805f2));});fs[_0xaa74('0x56')](_0x3cf041[_0xaa74('0x49')]);}return _0x3cf041;});})[_0xaa74('0x3e')](function(_0x647f09){throw new db[(_0xaa74('0x57'))][(_0xaa74('0x58'))](_0x647f09[_0xaa74('0x59')]);});}})[_0xaa74('0x1c')](handleEntityNotFound(_0x19b924,null))[_0xaa74('0x1c')](removeEntity(_0x19b924,null))[_0xaa74('0x3e')](handleError(_0x19b924,null));};exports[_0xaa74('0x5a')]=function(_0x58f60e,_0x247ba1,_0x3def4a){return db[_0xaa74('0x46')][_0xaa74('0x47')](function(_0x4cdd0f){var _0x43ffde;return db[_0xaa74('0x2a')][_0xaa74('0x44')]({'where':{'id':_0x58f60e[_0xaa74('0x40')]['id']}})[_0xaa74('0x1c')](function(_0x19a8d0){if(_0x19a8d0){_0x43ffde=_0x19a8d0;return _0x19a8d0[_0xaa74('0x5a')](_0x58f60e[_0xaa74('0x24')]['id'],{'transaction':_0x4cdd0f});}})[_0xaa74('0x1c')](function(_0x4210b9){if(_0x4210b9){return db[_0xaa74('0x5b')][_0xaa74('0x5c')]({'where':{'id':_0x58f60e[_0xaa74('0x24')]['id']},'attributes':['id','name',_0xaa74('0x5d'),_0xaa74('0x5e'),_0xaa74('0x5f')],'raw':!![]});}})[_0xaa74('0x1c')](function(_0x3f4233){if(_0x3f4233){var _0x5b1edf=path['join'](config['root'],_0xaa74('0x60'),util[_0xaa74('0x61')](_0xaa74('0x62'),path[_0xaa74('0x63')](_0x3f4233['save_name'],path[_0xaa74('0x64')](_0x3f4233[_0xaa74('0x5d')])),_0x3f4233[_0xaa74('0x5e')]));var _0x189a8d=path[_0xaa74('0x4a')](config[_0xaa74('0x4b')],_0xaa74('0x4c'),_0x43ffde[_0xaa74('0x22')],util[_0xaa74('0x61')]('%s.%s',_0x3f4233[_0xaa74('0x22')],_0x3f4233['converted_format']));fs['symlinkSync'](_0x5b1edf,_0x189a8d);return _0x3f4233;}})[_0xaa74('0x3e')](function(_0x1d4eeb){throw new db[(_0xaa74('0x57'))]['ValidationError'](_0x1d4eeb[_0xaa74('0x59')]);});})[_0xaa74('0x1c')](handleEntityNotFound(_0x247ba1,null))['then'](respondWithResult(_0x247ba1,0xc9))[_0xaa74('0x3e')](handleError(_0x247ba1,null));};exports[_0xaa74('0x65')]=function(_0x5a2ec3,_0xeb1799,_0x1f7e2c){return db['sequelize']['transaction'](function(_0x1e47a2){var _0x4072d5;return db[_0xaa74('0x2a')][_0xaa74('0x5c')]({'where':{'id':_0x5a2ec3[_0xaa74('0x40')]['id']}})[_0xaa74('0x1c')](handleEntityNotFound(_0xeb1799,null))[_0xaa74('0x1c')](function(_0x348885){if(_0x348885){_0x4072d5=_0x348885;return _0x348885['removeSound'](_0x5a2ec3[_0xaa74('0x40')][_0xaa74('0x66')]);}})['then'](function(_0x248d69){if(_0x248d69){return db[_0xaa74('0x5b')][_0xaa74('0x5c')]({'where':{'id':_0x5a2ec3[_0xaa74('0x40')]['id2']},'attributes':['id',_0xaa74('0x22'),_0xaa74('0x5d'),_0xaa74('0x5e'),_0xaa74('0x5f')],'raw':!![]});}})['then'](function(_0x2759b8){if(_0x2759b8){fs['unlinkSync'](path[_0xaa74('0x4a')](_0x4072d5['directory'],util['format'](_0xaa74('0x62'),_0x2759b8['name'],_0x2759b8[_0xaa74('0x5e')])));return _0x2759b8;}})[_0xaa74('0x3e')](function(_0x3151dd){throw new db['Sequelize'][(_0xaa74('0x58'))](_0x3151dd[_0xaa74('0x59')]);});})[_0xaa74('0x1c')](handleEntityNotFound(_0xeb1799,null))['then'](respondWithStatusCode(_0xeb1799,0xcc))['catch'](handleError(_0xeb1799,null));};exports[_0xaa74('0x67')]=function(_0x1dcdfc,_0x2b778a,_0x290bba){var _0x5f0c87={};var _0x23cd67={};var _0x1af371;var _0x351163;return db[_0xaa74('0x2a')][_0xaa74('0x5c')]({'where':{'id':_0x1dcdfc[_0xaa74('0x40')]['id']}})[_0xaa74('0x1c')](handleEntityNotFound(_0x2b778a,null))['then'](function(_0x3176ce){if(_0x3176ce){_0x1af371=_0x3176ce;_0x23cd67[_0xaa74('0x2d')]=_[_0xaa74('0x2f')](db['Sound']['rawAttributes']);_0x23cd67[_0xaa74('0x2e')]=_[_0xaa74('0x2f')](_0x1dcdfc[_0xaa74('0x2e')]);_0x23cd67[_0xaa74('0x37')]=_['intersection'](_0x23cd67['model'],_0x23cd67[_0xaa74('0x2e')]);_0x5f0c87['attributes']=_[_0xaa74('0x30')](_0x23cd67[_0xaa74('0x2d')],qs['fields'](_0x1dcdfc[_0xaa74('0x2e')][_0xaa74('0x31')]));_0x5f0c87[_0xaa74('0x32')]=_0x5f0c87['attributes'][_0xaa74('0x33')]?_0x5f0c87[_0xaa74('0x32')]:_0x23cd67['model'];_0x5f0c87['order']=qs[_0xaa74('0x35')](_0x1dcdfc[_0xaa74('0x2e')][_0xaa74('0x35')]);_0x5f0c87[_0xaa74('0x36')]=qs['filters'](_[_0xaa74('0x68')](_0x1dcdfc[_0xaa74('0x2e')],_0x23cd67[_0xaa74('0x37')]));if(_0x1dcdfc[_0xaa74('0x2e')][_0xaa74('0x38')]){_0x5f0c87['where']=_[_0xaa74('0x39')](_0x5f0c87[_0xaa74('0x36')],{'$or':_['map'](_0x5f0c87[_0xaa74('0x32')],function(_0x4d4b74){var _0x181e10={};_0x181e10[_0x4d4b74]={'$like':'%'+_0x1dcdfc[_0xaa74('0x2e')][_0xaa74('0x38')]+'%'};return _0x181e10;})});}_0x5f0c87=_[_0xaa74('0x39')]({},_0x5f0c87,_0x1dcdfc[_0xaa74('0x43')]);return _0x1af371['getSounds'](_0x5f0c87);}})['then'](function(_0x1dfd09){if(_0x1dfd09){_0x351163=_0x1dfd09[_0xaa74('0x33')];if(!_0x1dcdfc[_0xaa74('0x2e')][_0xaa74('0x34')]('nolimit')){_0x5f0c87[_0xaa74('0x18')]=qs['limit'](_0x1dcdfc[_0xaa74('0x2e')][_0xaa74('0x18')]);_0x5f0c87[_0xaa74('0x16')]=qs[_0xaa74('0x16')](_0x1dcdfc[_0xaa74('0x2e')]['offset']);}return _0x1af371[_0xaa74('0x67')](_0x5f0c87);}})[_0xaa74('0x1c')](function(_0x25df6e){if(_0x25df6e){return _0x25df6e?{'count':_0x351163,'rows':_0x25df6e}:null;}})[_0xaa74('0x1c')](respondWithResult(_0x2b778a,null))[_0xaa74('0x3e')](handleError(_0x2b778a,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 2a76c4e..c0ac627 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 _0x73bf=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash'];(function(_0x32c86c,_0x29d5e6){var _0x1359c3=function(_0x583beb){while(--_0x583beb){_0x32c86c['push'](_0x32c86c['shift']());}};_0x1359c3(++_0x29d5e6);}(_0x73bf,0x81));var _0xf73b=function(_0x4591c2,_0x190654){_0x4591c2=_0x4591c2-0x0;var _0x30241b=_0x73bf[_0x4591c2];return _0x30241b;};'use strict';var _=require(_0xf73b('0x0'));var util=require(_0xf73b('0x1'));var logger=require(_0xf73b('0x2'))(_0xf73b('0x3'));var moment=require(_0xf73b('0x4'));var BPromise=require(_0xf73b('0x5'));var rp=require(_0xf73b('0x6'));var fs=require('fs');var path=require(_0xf73b('0x7'));var rimraf=require(_0xf73b('0x8'));var config=require('../../config/environment');var attributes=require(_0xf73b('0x9'));module['exports']=function(_0x3603d6,_0x51bbda){return _0x3603d6[_0xf73b('0xa')](_0xf73b('0xb'),attributes,{'tableName':_0xf73b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb19b=['define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./voiceMusicOnHold.attributes','exports'];(function(_0x2b2c7f,_0x4c987){var _0x5aa2c2=function(_0x5080b1){while(--_0x5080b1){_0x2b2c7f['push'](_0x2b2c7f['shift']());}};_0x5aa2c2(++_0x4c987);}(_0xb19b,0x117));var _0xbb19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb19b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbb19('0x0'));var util=require(_0xbb19('0x1'));var logger=require(_0xbb19('0x2'))('api');var moment=require(_0xbb19('0x3'));var BPromise=require(_0xbb19('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb19('0x5'));var rimraf=require('rimraf');var config=require(_0xbb19('0x6'));var attributes=require(_0xbb19('0x7'));module[_0xbb19('0x8')]=function(_0xb224bb,_0x246bac){return _0xb224bb[_0xbb19('0x9')](_0xbb19('0xa'),attributes,{'tableName':_0xbb19('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index e63b690..70e66ce 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 _0x4c82=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3057ed,_0x4e7ad0){var _0x41d3b4=function(_0x14a687){while(--_0x14a687){_0x3057ed['push'](_0x3057ed['shift']());}};_0x41d3b4(++_0x4e7ad0);}(_0x4c82,0x1bc));var _0x24c8=function(_0x265c81,_0x4d539a){_0x265c81=_0x265c81-0x0;var _0x3e63d1=_0x4c82[_0x265c81];return _0x3e63d1;};'use strict';var _=require(_0x24c8('0x0'));var util=require('util');var moment=require(_0x24c8('0x1'));var BPromise=require(_0x24c8('0x2'));var rs=require(_0x24c8('0x3'));var fs=require('fs');var Redis=require(_0x24c8('0x4'));var db=require(_0x24c8('0x5'))['db'];var utils=require(_0x24c8('0x6'));var logger=require(_0x24c8('0x7'))(_0x24c8('0x8'));var config=require(_0x24c8('0x9'));var jayson=require(_0x24c8('0xa'));var client=jayson[_0x24c8('0xb')][_0x24c8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ed579,_0x1d075e,_0x20b490){return new BPromise(function(_0x7b8992,_0x47082f){return client[_0x24c8('0xd')](_0x2ed579,_0x20b490)[_0x24c8('0xe')](function(_0x3f5c94){logger[_0x24c8('0xf')](_0x24c8('0x10'),_0x1d075e,_0x24c8('0x11'));logger['debug'](_0x24c8('0x12'),_0x1d075e,_0x24c8('0x11'),JSON[_0x24c8('0x13')](_0x3f5c94));if(_0x3f5c94[_0x24c8('0x14')]){if(_0x3f5c94['error'][_0x24c8('0x15')]===0x1f4){logger[_0x24c8('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x1d075e,_0x3f5c94[_0x24c8('0x14')][_0x24c8('0x16')]);return _0x47082f(_0x3f5c94[_0x24c8('0x14')]['message']);}logger[_0x24c8('0x14')](_0x24c8('0x10'),_0x1d075e,_0x3f5c94[_0x24c8('0x14')][_0x24c8('0x16')]);return _0x7b8992(_0x3f5c94[_0x24c8('0x14')]['message']);}else{logger[_0x24c8('0xf')](_0x24c8('0x10'),_0x1d075e,_0x24c8('0x11'));_0x7b8992(_0x3f5c94['result'][_0x24c8('0x16')]);}})[_0x24c8('0x17')](function(_0x44d145){logger[_0x24c8('0x14')](_0x24c8('0x10'),_0x1d075e,_0x44d145);_0x47082f(_0x44d145);});});} \ No newline at end of file +var _0x4501=['error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x52fdf4,_0x5d5597){var _0x3d4db7=function(_0x3a7426){while(--_0x3a7426){_0x52fdf4['push'](_0x52fdf4['shift']());}};_0x3d4db7(++_0x5d5597);}(_0x4501,0x1d9));var _0x1450=function(_0xf4dd47,_0x4aff75){_0xf4dd47=_0xf4dd47-0x0;var _0x3745ae=_0x4501[_0xf4dd47];return _0x3745ae;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1450('0x0'));var fs=require('fs');var Redis=require(_0x1450('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x1450('0x2'));var logger=require('../../config/logger')(_0x1450('0x3'));var config=require(_0x1450('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x1450('0x5')][_0x1450('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1bad99,_0x152141,_0x4287b6){return new BPromise(function(_0x2cc5f3,_0x36ddda){return client[_0x1450('0x7')](_0x1bad99,_0x4287b6)['then'](function(_0x2fe4ae){logger[_0x1450('0x8')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x152141,_0x1450('0x9'));logger[_0x1450('0xa')](_0x1450('0xb'),_0x152141,_0x1450('0x9'),JSON[_0x1450('0xc')](_0x2fe4ae));if(_0x2fe4ae[_0x1450('0xd')]){if(_0x2fe4ae[_0x1450('0xd')][_0x1450('0xe')]===0x1f4){logger['error'](_0x1450('0xf'),_0x152141,_0x2fe4ae[_0x1450('0xd')]['message']);return _0x36ddda(_0x2fe4ae['error'][_0x1450('0x10')]);}logger[_0x1450('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x152141,_0x2fe4ae[_0x1450('0xd')][_0x1450('0x10')]);return _0x2cc5f3(_0x2fe4ae[_0x1450('0xd')][_0x1450('0x10')]);}else{logger[_0x1450('0x8')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x152141,_0x1450('0x9'));_0x2cc5f3(_0x2fe4ae['result']['message']);}})[_0x1450('0x11')](function(_0x4a8879){logger[_0x1450('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x152141,_0x4a8879);_0x36ddda(_0x4a8879);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 22b78c0..920db53 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 _0x5fc3=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','describe','/:id','show','getAgents','create','/:id/users','update','delete','destroy','exports'];(function(_0x8d5844,_0x48eb67){var _0x56726c=function(_0x4cfc1c){while(--_0x4cfc1c){_0x8d5844['push'](_0x8d5844['shift']());}};_0x56726c(++_0x48eb67);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0x5fc3[_0x3e0b8f];return _0x22f742;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['post']('/',auth[_0x35fc('0xa')](),controller[_0x35fc('0xf')]);router['post'](_0x35fc('0x10'),auth[_0x35fc('0xa')](),controller['addAgents']);router['put'](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x11')]);router[_0x35fc('0x12')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x35fc('0x14')]=router; \ No newline at end of file +var _0xfdbd=['put','/:id','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','index','describe','get','show','/:id/users','getAgents','post','create','addAgents'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x2fa457,_0x7021df){_0x2fa457=_0x2fa457-0x0;var _0x4f250a=_0xfdbd[_0x2fa457];return _0x4f250a;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get']('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xd')](_0xdfdb('0xf'),auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x10')]);router[_0xdfdb('0x11')]('/',auth['isAuthenticated'](),controller[_0xdfdb('0x12')]);router[_0xdfdb('0x11')]('/:id/users',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x13')]);router[_0xdfdb('0x14')](_0xdfdb('0x15'),auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x16')]);router[_0xdfdb('0x17')](_0xdfdb('0x15'),auth['isAuthenticated'](),controller['destroy']);router[_0xdfdb('0x17')]('/:id/users',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x18')]);module[_0xdfdb('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 68f71e1..1681dd5 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 _0xa902=['INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x3b18e6,_0x35e310){var _0xaf05b7=function(_0x5f0cc8){while(--_0x5f0cc8){_0x3b18e6['push'](_0x3b18e6['shift']());}};_0xaf05b7(++_0x35e310);}(_0xa902,0x8d));var _0x2a90=function(_0x40a247,_0x1cfaa6){_0x40a247=_0x40a247-0x0;var _0x4d15ea=_0xa902[_0x40a247];return _0x4d15ea;};'use strict';var Sequelize=require(_0x2a90('0x0'));module[_0x2a90('0x1')]={'name':{'type':Sequelize[_0x2a90('0x2')],'allowNull':![],'unique':_0x2a90('0x3')},'prefix':{'type':Sequelize[_0x2a90('0x4')],'get':function(_0x4983a4){return _0x2a90('0x5')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0x2a90('0x2')]},'callerIdAll':{'type':Sequelize[_0x2a90('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x2a90('0x6')]}}; \ No newline at end of file +var _0xa45d=['VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports','name'];(function(_0x55d60c,_0x414b89){var _0x20624b=function(_0x190508){while(--_0x190508){_0x55d60c['push'](_0x55d60c['shift']());}};_0x20624b(++_0x414b89);}(_0xa45d,0x19a));var _0xda45=function(_0x2a3258,_0x47504d){_0x2a3258=_0x2a3258-0x0;var _0x225758=_0xa45d[_0x2a3258];return _0x225758;};'use strict';var Sequelize=require(_0xda45('0x0'));module[_0xda45('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xda45('0x2')},'prefix':{'type':Sequelize[_0xda45('0x3')],'get':function(_0xaef1e6){return _0xda45('0x4')+this[_0xda45('0x5')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xda45('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index ae3bd25..ccb4d3f 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 _0xba48=['limit','Content-Range','reject','update','then','get','VoicePrefixes','UserProfileResource','error','stack','name','send','merge','body','contact','message','agent','interaction','account','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','length','find','destroy','describe','catch','create','sequelize','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','VoicePrefixId','bulkCreate','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','NoOp','goto','${EXTEN:','charAt','system-','transaction','findById','addAgents','ids','omit','spread','emit','removeAgents','userVoicePrefix:remove','User','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','undefined','count','offset'];(function(_0x1f3f59,_0x56484b){var _0xc7c3a0=function(_0x540aa2){while(--_0x540aa2){_0x1f3f59['push'](_0x1f3f59['shift']());}};_0xc7c3a0(++_0x56484b);}(_0xba48,0x1cf));var _0x8ba4=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xba48[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require(_0x8ba4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ba4('0x1'));var jsonpatch=require(_0x8ba4('0x2'));var rp=require(_0x8ba4('0x3'));var moment=require(_0x8ba4('0x4'));var BPromise=require(_0x8ba4('0x5'));var Mustache=require(_0x8ba4('0x6'));var util=require('util');var path=require(_0x8ba4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8ba4('0x8'));var fs=require('fs');var fs_extra=require(_0x8ba4('0x9'));var _=require('lodash');var squel=require(_0x8ba4('0xa'));var crypto=require('crypto');var jsforce=require(_0x8ba4('0xb'));var deskjs=require(_0x8ba4('0xc'));var toCsv=require(_0x8ba4('0xd'));var querystring=require(_0x8ba4('0xe'));var Papa=require(_0x8ba4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8ba4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ba4('0x11'))(_0x8ba4('0x12'));var utils=require(_0x8ba4('0x13'));var config=require(_0x8ba4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ba4('0x15'))['db'];config[_0x8ba4('0x16')]=_['defaults'](config[_0x8ba4('0x16')],{'host':_0x8ba4('0x17'),'port':0x18eb});var socket=require(_0x8ba4('0x18'))(new Redis(config[_0x8ba4('0x16')]));require(_0x8ba4('0x19'))['register'](socket);function respondWithStatusCode(_0xd56a94,_0x20a36c){_0x20a36c=_0x20a36c||0xcc;return function(_0x5b06ec){if(_0x5b06ec){return _0xd56a94[_0x8ba4('0x1a')](_0x20a36c);}return _0xd56a94[_0x8ba4('0x1b')](_0x20a36c)[_0x8ba4('0x1c')]();};}function respondWithResult(_0x4c69b8,_0x2b599c){_0x2b599c=_0x2b599c||0xc8;return function(_0x23976d){if(_0x23976d){return _0x4c69b8[_0x8ba4('0x1b')](_0x2b599c)[_0x8ba4('0x1d')](_0x23976d);}};}function respondWithFilteredResult(_0x49d361,_0x22a947){return function(_0x1f65bf){if(_0x1f65bf){var _0x3f14d3=typeof _0x22a947['offset']===_0x8ba4('0x1e')&&typeof _0x22a947['limit']==='undefined';var _0x12f3bf=_0x1f65bf[_0x8ba4('0x1f')];var _0x5ac34a=_0x3f14d3?0x0:_0x22a947[_0x8ba4('0x20')];var _0x37ada5=_0x3f14d3?_0x1f65bf[_0x8ba4('0x1f')]:_0x22a947[_0x8ba4('0x20')]+_0x22a947[_0x8ba4('0x21')];var _0xda38a9;if(_0x37ada5>=_0x12f3bf){_0x37ada5=_0x12f3bf;_0xda38a9=0xc8;}else{_0xda38a9=0xce;}_0x49d361[_0x8ba4('0x1b')](_0xda38a9);return _0x49d361['set'](_0x8ba4('0x22'),_0x5ac34a+'-'+_0x37ada5+'/'+_0x12f3bf)[_0x8ba4('0x1d')](_0x1f65bf);}return null;};}function patchUpdates(_0x283488){return function(_0x5af497){try{jsonpatch['apply'](_0x5af497,_0x283488,!![]);}catch(_0x34cfbd){return BPromise[_0x8ba4('0x23')](_0x34cfbd);}return _0x5af497['save']();};}function saveUpdates(_0x3d686f,_0x2d3c35){return function(_0x34b95e){if(_0x34b95e){return _0x34b95e[_0x8ba4('0x24')](_0x3d686f)[_0x8ba4('0x25')](function(_0x445a90){return _0x445a90;});}return null;};}function removeEntity(_0x1e723d,_0x46fe70){return function(_0x54c794){if(_0x54c794){return _0x54c794['destroy']()[_0x8ba4('0x25')](function(){var _0x1fb920=_0x54c794[_0x8ba4('0x26')]({'plain':!![]});var _0xc7d267=_0x8ba4('0x27');return db[_0x8ba4('0x28')]['destroy']({'where':{'type':_0xc7d267,'resourceId':_0x1fb920['id']}})[_0x8ba4('0x25')](function(){return _0x54c794;});})[_0x8ba4('0x25')](function(){_0x1e723d[_0x8ba4('0x1b')](0xcc)[_0x8ba4('0x1c')]();});}};}function handleEntityNotFound(_0x6cd65e,_0x7be719){return function(_0x37b8ee){if(!_0x37b8ee){_0x6cd65e[_0x8ba4('0x1a')](0x194);}return _0x37b8ee;};}function handleError(_0x3e12fb,_0x33fcf0){_0x33fcf0=_0x33fcf0||0x1f4;return function(_0x43ee55){logger[_0x8ba4('0x29')](_0x43ee55[_0x8ba4('0x2a')]);if(_0x43ee55[_0x8ba4('0x2b')]){delete _0x43ee55[_0x8ba4('0x2b')];}_0x3e12fb[_0x8ba4('0x1b')](_0x33fcf0)[_0x8ba4('0x2c')](_0x43ee55);};}function getMustacheRender(_0x148414,_0x4af9fb){return Mustache['render'](_0x148414,_[_0x8ba4('0x2d')](_0x4af9fb[_0x8ba4('0x2e')],{'contact':_0x4af9fb[_0x8ba4('0x2f')],'message':_0x4af9fb[_0x8ba4('0x30')],'agent':_0x4af9fb[_0x8ba4('0x31')],'interaction':_0x4af9fb[_0x8ba4('0x32')],'account':_0x4af9fb[_0x8ba4('0x33')]}))||'';}exports['index']=function(_0x5d702a,_0x251326){var _0x42149a={},_0x46e7cb={},_0x3d3d8d={'count':0x0,'rows':[]};var _0x4edf53=_[_0x8ba4('0x34')](db[_0x8ba4('0x35')][_0x8ba4('0x36')],function(_0x31adc4){return{'name':_0x31adc4[_0x8ba4('0x37')],'type':_0x31adc4[_0x8ba4('0x38')][_0x8ba4('0x39')]};});_0x46e7cb[_0x8ba4('0x3a')]=_[_0x8ba4('0x34')](_0x4edf53,_0x8ba4('0x2b'));_0x46e7cb[_0x8ba4('0x3b')]=_[_0x8ba4('0x3c')](_0x5d702a[_0x8ba4('0x3b')]);_0x46e7cb[_0x8ba4('0x3d')]=_[_0x8ba4('0x3e')](_0x46e7cb['model'],_0x46e7cb[_0x8ba4('0x3b')]);_0x42149a[_0x8ba4('0x3f')]=_[_0x8ba4('0x3e')](_0x46e7cb['model'],qs[_0x8ba4('0x40')](_0x5d702a[_0x8ba4('0x3b')]['fields']));_0x42149a[_0x8ba4('0x3f')]=_0x42149a[_0x8ba4('0x3f')]['length']?_0x42149a[_0x8ba4('0x3f')]:_0x46e7cb[_0x8ba4('0x3a')];if(!_0x5d702a['query'][_0x8ba4('0x41')](_0x8ba4('0x42'))){_0x42149a['limit']=qs[_0x8ba4('0x21')](_0x5d702a[_0x8ba4('0x3b')][_0x8ba4('0x21')]);_0x42149a[_0x8ba4('0x20')]=qs[_0x8ba4('0x20')](_0x5d702a[_0x8ba4('0x3b')][_0x8ba4('0x20')]);}_0x42149a[_0x8ba4('0x43')]=qs[_0x8ba4('0x44')](_0x5d702a['query'][_0x8ba4('0x44')]);_0x42149a[_0x8ba4('0x45')]=qs[_0x8ba4('0x3d')](_[_0x8ba4('0x46')](_0x5d702a[_0x8ba4('0x3b')],_0x46e7cb[_0x8ba4('0x3d')]),_0x4edf53);if(_0x5d702a['query'][_0x8ba4('0x47')]){_0x42149a[_0x8ba4('0x45')]=_[_0x8ba4('0x2d')](_0x42149a[_0x8ba4('0x45')],{'$or':_[_0x8ba4('0x34')](_0x4edf53,function(_0x2f41e2){if(_0x2f41e2[_0x8ba4('0x38')]!=='VIRTUAL'){var _0x44a029={};_0x44a029[_0x2f41e2[_0x8ba4('0x2b')]]={'$like':'%'+_0x5d702a['query'][_0x8ba4('0x47')]+'%'};return _0x44a029;}})});}_0x42149a=_[_0x8ba4('0x2d')]({},_0x42149a,_0x5d702a[_0x8ba4('0x48')]);var _0xbd4b8e={'where':_0x42149a[_0x8ba4('0x45')]};return db[_0x8ba4('0x35')][_0x8ba4('0x1f')](_0xbd4b8e)[_0x8ba4('0x25')](function(_0x855dba){_0x3d3d8d[_0x8ba4('0x1f')]=_0x855dba;if(_0x5d702a[_0x8ba4('0x3b')][_0x8ba4('0x49')]){_0x42149a[_0x8ba4('0x4a')]=[{'all':!![]}];}return db['VoicePrefix'][_0x8ba4('0x4b')](_0x42149a);})['then'](function(_0x14955d){_0x3d3d8d[_0x8ba4('0x4c')]=_0x14955d;return _0x3d3d8d;})[_0x8ba4('0x25')](respondWithFilteredResult(_0x251326,_0x42149a))['catch'](handleError(_0x251326,null));};exports[_0x8ba4('0x4d')]=function(_0x12a82c,_0x62746f){var _0x5cd6e5={'raw':![],'where':{'id':_0x12a82c[_0x8ba4('0x4e')]['id']}},_0xa38551={};_0xa38551[_0x8ba4('0x3a')]=_[_0x8ba4('0x3c')](db[_0x8ba4('0x35')]['rawAttributes']);_0xa38551[_0x8ba4('0x3b')]=_[_0x8ba4('0x3c')](_0x12a82c[_0x8ba4('0x3b')]);_0xa38551[_0x8ba4('0x3d')]=_[_0x8ba4('0x3e')](_0xa38551[_0x8ba4('0x3a')],_0xa38551['query']);_0x5cd6e5[_0x8ba4('0x3f')]=_[_0x8ba4('0x3e')](_0xa38551[_0x8ba4('0x3a')],qs[_0x8ba4('0x40')](_0x12a82c[_0x8ba4('0x3b')]['fields']));_0x5cd6e5[_0x8ba4('0x3f')]=_0x5cd6e5[_0x8ba4('0x3f')][_0x8ba4('0x4f')]?_0x5cd6e5[_0x8ba4('0x3f')]:_0xa38551[_0x8ba4('0x3a')];if(_0x12a82c[_0x8ba4('0x3b')][_0x8ba4('0x49')]){_0x5cd6e5[_0x8ba4('0x4a')]=[{'all':!![]}];}_0x5cd6e5=_[_0x8ba4('0x2d')]({},_0x5cd6e5,_0x12a82c[_0x8ba4('0x48')]);return db[_0x8ba4('0x35')][_0x8ba4('0x50')](_0x5cd6e5)[_0x8ba4('0x25')](handleEntityNotFound(_0x62746f,null))[_0x8ba4('0x25')](respondWithResult(_0x62746f,null))['catch'](handleError(_0x62746f,null));};exports[_0x8ba4('0x51')]=function(_0x4910da,_0x5a0376){return db['VoicePrefix'][_0x8ba4('0x50')]({'where':{'id':_0x4910da['params']['id']}})['then'](handleEntityNotFound(_0x5a0376,null))[_0x8ba4('0x25')](removeEntity(_0x5a0376,null))['catch'](handleError(_0x5a0376,null));};exports[_0x8ba4('0x52')]=function(_0xfed84,_0x4da543){return db[_0x8ba4('0x35')]['describe']()[_0x8ba4('0x25')](respondWithResult(_0x4da543,null))[_0x8ba4('0x53')](handleError(_0x4da543,null));};exports[_0x8ba4('0x54')]=function(_0x1f9540,_0x646e13){var _0x705c47;return db[_0x8ba4('0x55')]['transaction'](function(_0x2e628d){return db['VoicePrefix'][_0x8ba4('0x54')](_0x1f9540[_0x8ba4('0x2e')],{'transaction':_0x2e628d})[_0x8ba4('0x25')](function(_0x192d02){_0x705c47=_0x192d02['get']({'plain':!![]});return db[_0x8ba4('0x56')][_0x8ba4('0x50')]({'where':{'id':_0x705c47[_0x8ba4('0x57')]},'raw':!![]})[_0x8ba4('0x25')](function(_0x53134d){return createVoicePrefixExtensions(_0x705c47,_0x53134d,_0x2e628d);});});})[_0x8ba4('0x25')](function(){var _0x2c58dc=_0x1f9540[_0x8ba4('0x58')]['get']({'plain':!![]});if(!_0x2c58dc)throw new Error(_0x8ba4('0x59'));if(_0x2c58dc['role']===_0x8ba4('0x58')){var _0xedf0c1=_0x705c47;return db[_0x8ba4('0x5a')][_0x8ba4('0x50')]({'where':{'name':'VoicePrefixes','userProfileId':_0x2c58dc[_0x8ba4('0x5b')]},'raw':!![]})['then'](function(_0x387f4e){if(_0x387f4e&&_0x387f4e[_0x8ba4('0x5c')]===0x0){return db[_0x8ba4('0x28')][_0x8ba4('0x54')]({'name':_0xedf0c1[_0x8ba4('0x2b')],'resourceId':_0xedf0c1['id'],'type':_0x387f4e[_0x8ba4('0x2b')],'sectionId':_0x387f4e['id']},{})[_0x8ba4('0x25')](function(){return _0x705c47;});}else{return _0x705c47;}})[_0x8ba4('0x53')](function(_0x40a283){logger[_0x8ba4('0x29')](_0x8ba4('0x5d'),_0x40a283);throw _0x40a283;});}return _0x705c47;})[_0x8ba4('0x25')](respondWithResult(_0x646e13,null))[_0x8ba4('0x53')](handleError(_0x646e13,null));};function Extension(_0x11884c,_0x57bbda,_0x29e123,_0x1ebd41){this[_0x8ba4('0x5e')]='from-sip';this['exten']=_0x11884c;this[_0x8ba4('0x5f')]=_0x29e123;this[_0x8ba4('0x38')]=_0x8ba4('0x60');this[_0x8ba4('0x61')]=_0x8ba4('0x62');this['priority']=_0x57bbda;this[_0x8ba4('0x63')]=_0x1ebd41;}function createVoicePrefixExtensions(_0x51b0c4,_0x1870d6,_0x35832a){return new BPromise(function(_0x12f6dc,_0x59f07e){var _0x3015d1=new Extension(formatPrefixName(_0x51b0c4[_0x8ba4('0x64')]),0x1,'NoOp','Voice\x20Prefix');_0x3015d1[_0x8ba4('0x65')]=_0x51b0c4['id'];return db[_0x8ba4('0x56')][_0x8ba4('0x54')](_0x3015d1,{'transaction':_0x35832a})[_0x8ba4('0x25')](function(_0x17cd65){var _0x21b2fe=_0x17cd65['get']({'plain':!![]});var _0x4994c1=_[_0x8ba4('0x34')](addVoicePrefixExtensions(_0x51b0c4,_0x1870d6),function(_0x28fbed){_0x28fbed[_0x8ba4('0x57')]=_0x21b2fe['id'];_0x28fbed[_0x8ba4('0x65')]=_0x51b0c4['id'];return _0x28fbed;});return db[_0x8ba4('0x56')][_0x8ba4('0x66')](_0x4994c1,{'transaction':_0x35832a})[_0x8ba4('0x25')](function(_0x24343c){if(!_0x24343c){return _0x59f07e('Extensions\x20creation\x20failed');}else{return _0x12f6dc(_0x24343c);}})[_0x8ba4('0x53')](function(_0x542699){return _0x59f07e(_0x542699);});});;});};function addVoicePrefixExtensions(_0x2cc318,_0x3da74a){var _0x5e8caa=[];var _0x11cd89=formatPrefixName(_0x2cc318[_0x8ba4('0x64')]);_0x5e8caa['push'](new Extension(_0x11cd89,0x2,_0x8ba4('0x67'),_0x8ba4('0x68')+_0x2cc318[_0x8ba4('0x2b')]));if(_0x2cc318[_0x8ba4('0x69')]){_0x5e8caa[_0x8ba4('0x6a')](new Extension(_0x11cd89,0x3,_0x8ba4('0x67'),_0x8ba4('0x6b')+_0x2cc318[_0x8ba4('0x69')]));}else{_0x5e8caa['push'](new Extension(_0x11cd89,0x3,_0x8ba4('0x6c'),'No\x20callerid\x20available'));}_0x5e8caa[_0x8ba4('0x6a')](new Extension(_0x11cd89,0x4,_0x8ba4('0x6d'),_0x3da74a[_0x8ba4('0x5e')]+','+_0x8ba4('0x6e')+(0x8+_0x2cc318[_0x8ba4('0x2b')]['length'])+'}'+','+0x1));return _0x5e8caa;}function formatPrefixName(_0x5ab152){var _0x47d4ec='_';for(var _0x278293=0x0;_0x278293<_0x5ab152['length'];_0x278293++){if(_0x5ab152[_0x8ba4('0x6f')](_0x278293)=='-'){_0x47d4ec+=_0x5ab152[_0x8ba4('0x6f')](_0x278293);}else{_0x47d4ec+='['+_0x5ab152[_0x8ba4('0x6f')](_0x278293)+']';}}_0x47d4ec+='.';return _0x47d4ec;}exports[_0x8ba4('0x24')]=function(_0x570f83,_0x98ab03,_0x3809d1){var _0x57f894=_0x570f83[_0x8ba4('0x2e')];_0x57f894[_0x8ba4('0x64')]=_0x8ba4('0x70')+_0x57f894['name']+'-';return db[_0x8ba4('0x55')][_0x8ba4('0x71')](function(_0xfe7a5d){return db[_0x8ba4('0x35')]['update'](_0x57f894,{'where':{'id':_0x57f894['id']},'transaction':_0xfe7a5d})[_0x8ba4('0x25')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x57f894['id']},'transaction':_0xfe7a5d})['then'](function(){return db[_0x8ba4('0x56')][_0x8ba4('0x50')]({'where':{'id':_0x57f894['VoiceExtensionId']},'raw':!![]})[_0x8ba4('0x25')](function(_0x38e87f){return createVoicePrefixExtensions(_0x57f894,_0x38e87f,_0xfe7a5d);});});});})['then'](function(){return db[_0x8ba4('0x35')][_0x8ba4('0x72')](_0x57f894['id']);})[_0x8ba4('0x25')](respondWithResult(_0x98ab03,null))[_0x8ba4('0x53')](handleError(_0x98ab03,null));};exports[_0x8ba4('0x73')]=function(_0x53caf2,_0x37af08,_0x1de013){return db['VoicePrefix']['find']({'where':{'id':_0x53caf2[_0x8ba4('0x4e')]['id']}})[_0x8ba4('0x25')](handleEntityNotFound(_0x37af08,null))[_0x8ba4('0x25')](function(_0x8db071){if(_0x8db071){return _0x8db071['addAgents'](_0x53caf2[_0x8ba4('0x2e')][_0x8ba4('0x74')],_[_0x8ba4('0x75')](_0x53caf2[_0x8ba4('0x2e')],[_0x8ba4('0x74'),'id'])||{})[_0x8ba4('0x76')](function(_0x584966){for(var _0x1473f4=0x0;_0x1473f4<_0x53caf2[_0x8ba4('0x2e')][_0x8ba4('0x74')]['length'];_0x1473f4+=0x1){socket[_0x8ba4('0x77')]('userVoicePrefix:save',{'UserId':_0x53caf2['body'][_0x8ba4('0x74')][_0x1473f4],'VoicePrefixId':_0x53caf2['params']['id']});}return _0x584966;});}})['then'](respondWithResult(_0x37af08,null))[_0x8ba4('0x53')](handleError(_0x37af08,null));};exports[_0x8ba4('0x78')]=function(_0x220a73,_0x106623,_0x2c17fc){return db[_0x8ba4('0x35')][_0x8ba4('0x50')]({'where':{'id':_0x220a73[_0x8ba4('0x4e')]['id']}})[_0x8ba4('0x25')](handleEntityNotFound(_0x106623,null))[_0x8ba4('0x25')](function(_0x350362){if(_0x350362){return _0x350362[_0x8ba4('0x78')](_0x220a73[_0x8ba4('0x3b')][_0x8ba4('0x74')])[_0x8ba4('0x25')](function(){if(_['isArray'](_0x220a73['query'][_0x8ba4('0x74')])){for(var _0x1dbad5=0x0;_0x1dbad5<_0x220a73[_0x8ba4('0x3b')][_0x8ba4('0x74')]['length'];_0x1dbad5+=0x1){socket[_0x8ba4('0x77')](_0x8ba4('0x79'),{'UserId':Number(_0x220a73['query']['ids'][_0x1dbad5]),'VoicePrefixId':Number(_0x220a73['params']['id'])});}}else{socket[_0x8ba4('0x77')](_0x8ba4('0x79'),{'UserId':Number(_0x220a73['query'][_0x8ba4('0x74')]),'VoicePrefixId':Number(_0x220a73[_0x8ba4('0x4e')]['id'])});}});}})[_0x8ba4('0x25')](respondWithStatusCode(_0x106623,null))[_0x8ba4('0x53')](handleError(_0x106623,null));};exports['getAgents']=function(_0x4ff0b9,_0x5cd14d,_0x2fb85c){var _0x12fbd7={};var _0x758d5b={};var _0x7a1795;var _0x53ca65;return db[_0x8ba4('0x35')]['findOne']({'where':{'id':_0x4ff0b9[_0x8ba4('0x4e')]['id']}})[_0x8ba4('0x25')](handleEntityNotFound(_0x5cd14d,null))['then'](function(_0x470b5d){if(_0x470b5d){_0x7a1795=_0x470b5d;_0x758d5b[_0x8ba4('0x3a')]=_['keys'](db[_0x8ba4('0x7a')][_0x8ba4('0x36')]);_0x758d5b[_0x8ba4('0x3b')]=_[_0x8ba4('0x3c')](_0x4ff0b9['query']);_0x758d5b['filters']=_[_0x8ba4('0x3e')](_0x758d5b[_0x8ba4('0x3a')],_0x758d5b[_0x8ba4('0x3b')]);_0x12fbd7[_0x8ba4('0x3f')]=_[_0x8ba4('0x3e')](_0x758d5b[_0x8ba4('0x3a')],qs[_0x8ba4('0x40')](_0x4ff0b9[_0x8ba4('0x3b')][_0x8ba4('0x40')]));_0x12fbd7[_0x8ba4('0x3f')]=_0x12fbd7[_0x8ba4('0x3f')][_0x8ba4('0x4f')]?_0x12fbd7[_0x8ba4('0x3f')]:_0x758d5b[_0x8ba4('0x3a')];_0x12fbd7[_0x8ba4('0x43')]=qs[_0x8ba4('0x44')](_0x4ff0b9[_0x8ba4('0x3b')][_0x8ba4('0x44')]);_0x12fbd7[_0x8ba4('0x45')]=qs['filters'](_['pick'](_0x4ff0b9[_0x8ba4('0x3b')],_0x758d5b[_0x8ba4('0x3d')]));if(_0x4ff0b9[_0x8ba4('0x3b')][_0x8ba4('0x47')]){_0x12fbd7[_0x8ba4('0x45')]=_['merge'](_0x12fbd7[_0x8ba4('0x45')],{'$or':_[_0x8ba4('0x34')](_0x12fbd7['attributes'],function(_0xd030d9){var _0x5b5d29={};_0x5b5d29[_0xd030d9]={'$like':'%'+_0x4ff0b9[_0x8ba4('0x3b')][_0x8ba4('0x47')]+'%'};return _0x5b5d29;})});}_0x12fbd7=_['merge']({},_0x12fbd7,_0x4ff0b9['options']);return _0x7a1795[_0x8ba4('0x7b')](_0x12fbd7);}})[_0x8ba4('0x25')](function(_0x568ded){if(_0x568ded){_0x53ca65=_0x568ded[_0x8ba4('0x4f')];if(!_0x4ff0b9[_0x8ba4('0x3b')][_0x8ba4('0x41')]('nolimit')){_0x12fbd7[_0x8ba4('0x21')]=qs['limit'](_0x4ff0b9['query'][_0x8ba4('0x21')]);_0x12fbd7[_0x8ba4('0x20')]=qs[_0x8ba4('0x20')](_0x4ff0b9['query']['offset']);}return _0x7a1795['getAgents'](_0x12fbd7);}})[_0x8ba4('0x25')](function(_0xf85e18){if(_0xf85e18){return _0xf85e18?{'count':_0x53ca65,'rows':_0xf85e18}:null;}})[_0x8ba4('0x25')](respondWithResult(_0x5cd14d,null))[_0x8ba4('0x53')](handleError(_0x5cd14d,null));}; \ No newline at end of file +var _0x475b=['bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','VoicePrefixes','UserProfileResource','end','error','name','send','render','merge','body','contact','message','agent','interaction','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','options','VoicePrefix','include','findAll','rows','catch','show','params','find','create','sequelize','VoiceExtension','VoiceExtensionId','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0x475b,0x1a2));var _0xb475=function(_0x30f730,_0x5a1aad){_0x30f730=_0x30f730-0x0;var _0x4b3c3d=_0x475b[_0x30f730];return _0x4b3c3d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb475('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb475('0x1'));var rp=require(_0xb475('0x2'));var moment=require(_0xb475('0x3'));var BPromise=require(_0xb475('0x4'));var Mustache=require(_0xb475('0x5'));var util=require(_0xb475('0x6'));var path=require(_0xb475('0x7'));var sox=require('sox');var csv=require(_0xb475('0x8'));var ejs=require(_0xb475('0x9'));var fs=require('fs');var fs_extra=require(_0xb475('0xa'));var _=require(_0xb475('0xb'));var squel=require(_0xb475('0xc'));var crypto=require(_0xb475('0xd'));var jsforce=require(_0xb475('0xe'));var deskjs=require(_0xb475('0xf'));var toCsv=require(_0xb475('0x8'));var querystring=require(_0xb475('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb475('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb475('0x12'));var hardwareService=require(_0xb475('0x13'));var logger=require('../../config/logger')(_0xb475('0x14'));var utils=require('../../config/utils');var config=require(_0xb475('0x15'));var licenseUtil=require(_0xb475('0x16'));var db=require('../../mysqldb')['db'];config[_0xb475('0x17')]=_[_0xb475('0x18')](config[_0xb475('0x17')],{'host':_0xb475('0x19'),'port':0x18eb});var socket=require(_0xb475('0x1a'))(new Redis(config[_0xb475('0x17')]));require(_0xb475('0x1b'))[_0xb475('0x1c')](socket);function respondWithStatusCode(_0x39db37,_0x211f4a){_0x211f4a=_0x211f4a||0xcc;return function(_0x11c88f){if(_0x11c88f){return _0x39db37[_0xb475('0x1d')](_0x211f4a);}return _0x39db37[_0xb475('0x1e')](_0x211f4a)['end']();};}function respondWithResult(_0x3a6a44,_0x3b2a58){_0x3b2a58=_0x3b2a58||0xc8;return function(_0x3e00fa){if(_0x3e00fa){return _0x3a6a44[_0xb475('0x1e')](_0x3b2a58)[_0xb475('0x1f')](_0x3e00fa);}};}function respondWithFilteredResult(_0x76ff77,_0x408fc8){return function(_0x489f8c){if(_0x489f8c){var _0x31c505=typeof _0x408fc8[_0xb475('0x20')]===_0xb475('0x21')&&typeof _0x408fc8['limit']===_0xb475('0x21');var _0x703023=_0x489f8c[_0xb475('0x22')];var _0x55f7ce=_0x31c505?0x0:_0x408fc8[_0xb475('0x20')];var _0x1a6fb3=_0x31c505?_0x489f8c[_0xb475('0x22')]:_0x408fc8[_0xb475('0x20')]+_0x408fc8['limit'];var _0x53b596;if(_0x1a6fb3>=_0x703023){_0x1a6fb3=_0x703023;_0x53b596=0xc8;}else{_0x53b596=0xce;}_0x76ff77[_0xb475('0x1e')](_0x53b596);return _0x76ff77[_0xb475('0x23')](_0xb475('0x24'),_0x55f7ce+'-'+_0x1a6fb3+'/'+_0x703023)[_0xb475('0x1f')](_0x489f8c);}return null;};}function patchUpdates(_0x481e57){return function(_0x151748){try{jsonpatch[_0xb475('0x25')](_0x151748,_0x481e57,!![]);}catch(_0x1e3540){return BPromise[_0xb475('0x26')](_0x1e3540);}return _0x151748['save']();};}function saveUpdates(_0x5852d2,_0x4e63bc){return function(_0x4a70aa){if(_0x4a70aa){return _0x4a70aa[_0xb475('0x27')](_0x5852d2)[_0xb475('0x28')](function(_0x26f527){return _0x26f527;});}return null;};}function removeEntity(_0x2a8f17,_0x5bf5dd){return function(_0x5e73c0){if(_0x5e73c0){return _0x5e73c0[_0xb475('0x29')]()['then'](function(){var _0xb8f9d=_0x5e73c0['get']({'plain':!![]});var _0x45fb5b=_0xb475('0x2a');return db[_0xb475('0x2b')][_0xb475('0x29')]({'where':{'type':_0x45fb5b,'resourceId':_0xb8f9d['id']}})['then'](function(){return _0x5e73c0;});})[_0xb475('0x28')](function(){_0x2a8f17[_0xb475('0x1e')](0xcc)[_0xb475('0x2c')]();});}};}function handleEntityNotFound(_0x6da704,_0x993adb){return function(_0x240c73){if(!_0x240c73){_0x6da704['sendStatus'](0x194);}return _0x240c73;};}function handleError(_0x1fdd9a,_0x14597d){_0x14597d=_0x14597d||0x1f4;return function(_0x58a621){logger[_0xb475('0x2d')](_0x58a621['stack']);if(_0x58a621[_0xb475('0x2e')]){delete _0x58a621[_0xb475('0x2e')];}_0x1fdd9a[_0xb475('0x1e')](_0x14597d)[_0xb475('0x2f')](_0x58a621);};}function getMustacheRender(_0x1efef6,_0x5e3210){return Mustache[_0xb475('0x30')](_0x1efef6,_[_0xb475('0x31')](_0x5e3210[_0xb475('0x32')],{'contact':_0x5e3210[_0xb475('0x33')],'message':_0x5e3210[_0xb475('0x34')],'agent':_0x5e3210[_0xb475('0x35')],'interaction':_0x5e3210[_0xb475('0x36')],'account':_0x5e3210['account']}))||'';}exports['index']=function(_0x9fb3a4,_0x2adabd){var _0x3726d6={},_0x1385f6={},_0x59f9f8={'count':0x0,'rows':[]};var _0xe2dde3=_['map'](db['VoicePrefix'][_0xb475('0x37')],function(_0x4afff4){return{'name':_0x4afff4['fieldName'],'type':_0x4afff4[_0xb475('0x38')]['key']};});_0x1385f6[_0xb475('0x39')]=_[_0xb475('0x3a')](_0xe2dde3,_0xb475('0x2e'));_0x1385f6[_0xb475('0x3b')]=_[_0xb475('0x3c')](_0x9fb3a4[_0xb475('0x3b')]);_0x1385f6[_0xb475('0x3d')]=_[_0xb475('0x3e')](_0x1385f6[_0xb475('0x39')],_0x1385f6[_0xb475('0x3b')]);_0x3726d6[_0xb475('0x3f')]=_[_0xb475('0x3e')](_0x1385f6[_0xb475('0x39')],qs['fields'](_0x9fb3a4[_0xb475('0x3b')][_0xb475('0x40')]));_0x3726d6[_0xb475('0x3f')]=_0x3726d6[_0xb475('0x3f')][_0xb475('0x41')]?_0x3726d6[_0xb475('0x3f')]:_0x1385f6[_0xb475('0x39')];if(!_0x9fb3a4[_0xb475('0x3b')][_0xb475('0x42')](_0xb475('0x43'))){_0x3726d6[_0xb475('0x44')]=qs[_0xb475('0x44')](_0x9fb3a4[_0xb475('0x3b')][_0xb475('0x44')]);_0x3726d6['offset']=qs[_0xb475('0x20')](_0x9fb3a4[_0xb475('0x3b')][_0xb475('0x20')]);}_0x3726d6[_0xb475('0x45')]=qs[_0xb475('0x46')](_0x9fb3a4['query']['sort']);_0x3726d6['where']=qs[_0xb475('0x3d')](_[_0xb475('0x47')](_0x9fb3a4[_0xb475('0x3b')],_0x1385f6['filters']),_0xe2dde3);if(_0x9fb3a4[_0xb475('0x3b')][_0xb475('0x48')]){_0x3726d6[_0xb475('0x49')]=_['merge'](_0x3726d6[_0xb475('0x49')],{'$or':_['map'](_0xe2dde3,function(_0x3ca350){if(_0x3ca350[_0xb475('0x38')]!==_0xb475('0x4a')){var _0x2ce946={};_0x2ce946[_0x3ca350[_0xb475('0x2e')]]={'$like':'%'+_0x9fb3a4[_0xb475('0x3b')][_0xb475('0x48')]+'%'};return _0x2ce946;}})});}_0x3726d6=_[_0xb475('0x31')]({},_0x3726d6,_0x9fb3a4[_0xb475('0x4b')]);var _0xab9c54={'where':_0x3726d6[_0xb475('0x49')]};return db[_0xb475('0x4c')][_0xb475('0x22')](_0xab9c54)['then'](function(_0x221825){_0x59f9f8[_0xb475('0x22')]=_0x221825;if(_0x9fb3a4[_0xb475('0x3b')]['includeAll']){_0x3726d6[_0xb475('0x4d')]=[{'all':!![]}];}return db[_0xb475('0x4c')][_0xb475('0x4e')](_0x3726d6);})[_0xb475('0x28')](function(_0x1f3de6){_0x59f9f8[_0xb475('0x4f')]=_0x1f3de6;return _0x59f9f8;})[_0xb475('0x28')](respondWithFilteredResult(_0x2adabd,_0x3726d6))[_0xb475('0x50')](handleError(_0x2adabd,null));};exports[_0xb475('0x51')]=function(_0x3ae756,_0x395284){var _0x29a489={'raw':![],'where':{'id':_0x3ae756[_0xb475('0x52')]['id']}},_0x3c292c={};_0x3c292c['model']=_[_0xb475('0x3c')](db[_0xb475('0x4c')][_0xb475('0x37')]);_0x3c292c[_0xb475('0x3b')]=_[_0xb475('0x3c')](_0x3ae756[_0xb475('0x3b')]);_0x3c292c[_0xb475('0x3d')]=_[_0xb475('0x3e')](_0x3c292c[_0xb475('0x39')],_0x3c292c['query']);_0x29a489[_0xb475('0x3f')]=_[_0xb475('0x3e')](_0x3c292c[_0xb475('0x39')],qs[_0xb475('0x40')](_0x3ae756['query'][_0xb475('0x40')]));_0x29a489[_0xb475('0x3f')]=_0x29a489[_0xb475('0x3f')]['length']?_0x29a489['attributes']:_0x3c292c[_0xb475('0x39')];if(_0x3ae756[_0xb475('0x3b')]['includeAll']){_0x29a489[_0xb475('0x4d')]=[{'all':!![]}];}_0x29a489=_[_0xb475('0x31')]({},_0x29a489,_0x3ae756[_0xb475('0x4b')]);return db['VoicePrefix'][_0xb475('0x53')](_0x29a489)[_0xb475('0x28')](handleEntityNotFound(_0x395284,null))['then'](respondWithResult(_0x395284,null))[_0xb475('0x50')](handleError(_0x395284,null));};exports[_0xb475('0x29')]=function(_0xd8e393,_0x2a436a){return db['VoicePrefix'][_0xb475('0x53')]({'where':{'id':_0xd8e393[_0xb475('0x52')]['id']}})[_0xb475('0x28')](handleEntityNotFound(_0x2a436a,null))[_0xb475('0x28')](removeEntity(_0x2a436a,null))[_0xb475('0x50')](handleError(_0x2a436a,null));};exports['describe']=function(_0xf08fc6,_0xa82afa){return db[_0xb475('0x4c')]['describe']()['then'](respondWithResult(_0xa82afa,null))[_0xb475('0x50')](handleError(_0xa82afa,null));};exports[_0xb475('0x54')]=function(_0x30d696,_0x3b4377){var _0x32ed03;return db[_0xb475('0x55')]['transaction'](function(_0x400621){return db[_0xb475('0x4c')][_0xb475('0x54')](_0x30d696[_0xb475('0x32')],{'transaction':_0x400621})['then'](function(_0x9f4c69){_0x32ed03=_0x9f4c69['get']({'plain':!![]});return db[_0xb475('0x56')][_0xb475('0x53')]({'where':{'id':_0x32ed03[_0xb475('0x57')]},'raw':!![]})['then'](function(_0x2f21a4){return createVoicePrefixExtensions(_0x32ed03,_0x2f21a4,_0x400621);});});})[_0xb475('0x28')](function(){var _0x5788db=_0x30d696[_0xb475('0x58')][_0xb475('0x59')]({'plain':!![]});if(!_0x5788db)throw new Error(_0xb475('0x5a'));if(_0x5788db[_0xb475('0x5b')]==='user'){var _0x155f07=_0x32ed03;return db[_0xb475('0x5c')][_0xb475('0x53')]({'where':{'name':_0xb475('0x2a'),'userProfileId':_0x5788db[_0xb475('0x5d')]},'raw':!![]})[_0xb475('0x28')](function(_0x42ca26){if(_0x42ca26&&_0x42ca26['autoAssociation']===0x0){return db[_0xb475('0x2b')][_0xb475('0x54')]({'name':_0x155f07['name'],'resourceId':_0x155f07['id'],'type':_0x42ca26[_0xb475('0x2e')],'sectionId':_0x42ca26['id']},{})[_0xb475('0x28')](function(){return _0x32ed03;});}else{return _0x32ed03;}})[_0xb475('0x50')](function(_0x47d706){logger[_0xb475('0x2d')](_0xb475('0x5e'),_0x47d706);throw _0x47d706;});}return _0x32ed03;})['then'](respondWithResult(_0x3b4377,null))[_0xb475('0x50')](handleError(_0x3b4377,null));};function Extension(_0x5039ed,_0x18c5ca,_0x39e566,_0x342b56){this[_0xb475('0x5f')]='from-sip';this[_0xb475('0x60')]=_0x5039ed;this[_0xb475('0x61')]=_0x39e566;this[_0xb475('0x38')]=_0xb475('0x62');this[_0xb475('0x63')]='Voice\x20Prefix\x20Extension';this[_0xb475('0x64')]=_0x18c5ca;this[_0xb475('0x65')]=_0x342b56;}function createVoicePrefixExtensions(_0x124081,_0x4fbe70,_0x8481a4){return new BPromise(function(_0x42e513,_0x2de7d5){var _0x32408b=new Extension(formatPrefixName(_0x124081[_0xb475('0x66')]),0x1,_0xb475('0x67'),_0xb475('0x68'));_0x32408b[_0xb475('0x69')]=_0x124081['id'];return db[_0xb475('0x56')][_0xb475('0x54')](_0x32408b,{'transaction':_0x8481a4})['then'](function(_0x3facd6){var _0x2ac2af=_0x3facd6[_0xb475('0x59')]({'plain':!![]});var _0x14de11=_[_0xb475('0x3a')](addVoicePrefixExtensions(_0x124081,_0x4fbe70),function(_0x23be0f){_0x23be0f['VoiceExtensionId']=_0x2ac2af['id'];_0x23be0f['VoicePrefixId']=_0x124081['id'];return _0x23be0f;});return db['VoiceExtension'][_0xb475('0x6a')](_0x14de11,{'transaction':_0x8481a4})['then'](function(_0x49fde2){if(!_0x49fde2){return _0x2de7d5(_0xb475('0x6b'));}else{return _0x42e513(_0x49fde2);}})[_0xb475('0x50')](function(_0x2a3821){return _0x2de7d5(_0x2a3821);});});;});};function addVoicePrefixExtensions(_0x5299dd,_0x27fbc9){var _0x14d856=[];var _0x24c911=formatPrefixName(_0x5299dd['prefix']);_0x14d856[_0xb475('0x6c')](new Extension(_0x24c911,0x2,_0xb475('0x6d'),_0xb475('0x6e')+_0x5299dd['name']));if(_0x5299dd[_0xb475('0x6f')]){_0x14d856[_0xb475('0x6c')](new Extension(_0x24c911,0x3,'Set',_0xb475('0x70')+_0x5299dd[_0xb475('0x6f')]));}else{_0x14d856[_0xb475('0x6c')](new Extension(_0x24c911,0x3,_0xb475('0x67'),_0xb475('0x71')));}_0x14d856[_0xb475('0x6c')](new Extension(_0x24c911,0x4,_0xb475('0x72'),_0x27fbc9['context']+','+_0xb475('0x73')+(0x8+_0x5299dd[_0xb475('0x2e')][_0xb475('0x41')])+'}'+','+0x1));return _0x14d856;}function formatPrefixName(_0x353a16){var _0x4d295e='_';for(var _0x404848=0x0;_0x404848<_0x353a16['length'];_0x404848++){if(_0x353a16[_0xb475('0x74')](_0x404848)=='-'){_0x4d295e+=_0x353a16[_0xb475('0x74')](_0x404848);}else{_0x4d295e+='['+_0x353a16[_0xb475('0x74')](_0x404848)+']';}}_0x4d295e+='.';return _0x4d295e;}exports['update']=function(_0x4f9305,_0x359ffe,_0x3e6d48){var _0x389879=_0x4f9305[_0xb475('0x32')];_0x389879[_0xb475('0x66')]=_0xb475('0x75')+_0x389879[_0xb475('0x2e')]+'-';return db[_0xb475('0x55')][_0xb475('0x76')](function(_0x3bd343){return db[_0xb475('0x4c')][_0xb475('0x27')](_0x389879,{'where':{'id':_0x389879['id']},'transaction':_0x3bd343})[_0xb475('0x28')](function(){return db[_0xb475('0x56')][_0xb475('0x29')]({'where':{'VoicePrefixId':_0x389879['id']},'transaction':_0x3bd343})['then'](function(){return db['VoiceExtension']['find']({'where':{'id':_0x389879['VoiceExtensionId']},'raw':!![]})['then'](function(_0x3132ef){return createVoicePrefixExtensions(_0x389879,_0x3132ef,_0x3bd343);});});});})[_0xb475('0x28')](function(){return db[_0xb475('0x4c')][_0xb475('0x77')](_0x389879['id']);})[_0xb475('0x28')](respondWithResult(_0x359ffe,null))[_0xb475('0x50')](handleError(_0x359ffe,null));};exports[_0xb475('0x78')]=function(_0x335565,_0x2671ab,_0x4514b9){return db[_0xb475('0x4c')][_0xb475('0x53')]({'where':{'id':_0x335565['params']['id']}})[_0xb475('0x28')](handleEntityNotFound(_0x2671ab,null))[_0xb475('0x28')](function(_0x4be2a4){if(_0x4be2a4){return _0x4be2a4[_0xb475('0x78')](_0x335565[_0xb475('0x32')][_0xb475('0x79')],_[_0xb475('0x7a')](_0x335565[_0xb475('0x32')],[_0xb475('0x79'),'id'])||{})[_0xb475('0x7b')](function(_0x2121f0){for(var _0x235985=0x0;_0x235985<_0x335565['body'][_0xb475('0x79')][_0xb475('0x41')];_0x235985+=0x1){socket[_0xb475('0x7c')](_0xb475('0x7d'),{'UserId':_0x335565['body'][_0xb475('0x79')][_0x235985],'VoicePrefixId':_0x335565['params']['id']});}return _0x2121f0;});}})[_0xb475('0x28')](respondWithResult(_0x2671ab,null))[_0xb475('0x50')](handleError(_0x2671ab,null));};exports[_0xb475('0x7e')]=function(_0x24cf8b,_0x5a5583,_0x5057aa){return db['VoicePrefix'][_0xb475('0x53')]({'where':{'id':_0x24cf8b[_0xb475('0x52')]['id']}})[_0xb475('0x28')](handleEntityNotFound(_0x5a5583,null))[_0xb475('0x28')](function(_0x453b62){if(_0x453b62){return _0x453b62[_0xb475('0x7e')](_0x24cf8b[_0xb475('0x3b')][_0xb475('0x79')])[_0xb475('0x28')](function(){if(_[_0xb475('0x7f')](_0x24cf8b['query'][_0xb475('0x79')])){for(var _0x27daa5=0x0;_0x27daa5<_0x24cf8b[_0xb475('0x3b')]['ids'][_0xb475('0x41')];_0x27daa5+=0x1){socket[_0xb475('0x7c')](_0xb475('0x80'),{'UserId':Number(_0x24cf8b[_0xb475('0x3b')]['ids'][_0x27daa5]),'VoicePrefixId':Number(_0x24cf8b[_0xb475('0x52')]['id'])});}}else{socket[_0xb475('0x7c')](_0xb475('0x80'),{'UserId':Number(_0x24cf8b[_0xb475('0x3b')][_0xb475('0x79')]),'VoicePrefixId':Number(_0x24cf8b[_0xb475('0x52')]['id'])});}});}})[_0xb475('0x28')](respondWithStatusCode(_0x5a5583,null))[_0xb475('0x50')](handleError(_0x5a5583,null));};exports[_0xb475('0x81')]=function(_0x50edfc,_0x40d08d,_0x7002e8){var _0x499814={};var _0x37b60a={};var _0x317bd7;var _0x1543d3;return db['VoicePrefix']['findOne']({'where':{'id':_0x50edfc['params']['id']}})[_0xb475('0x28')](handleEntityNotFound(_0x40d08d,null))['then'](function(_0x792648){if(_0x792648){_0x317bd7=_0x792648;_0x37b60a['model']=_[_0xb475('0x3c')](db[_0xb475('0x82')][_0xb475('0x37')]);_0x37b60a['query']=_[_0xb475('0x3c')](_0x50edfc[_0xb475('0x3b')]);_0x37b60a[_0xb475('0x3d')]=_[_0xb475('0x3e')](_0x37b60a[_0xb475('0x39')],_0x37b60a['query']);_0x499814[_0xb475('0x3f')]=_['intersection'](_0x37b60a[_0xb475('0x39')],qs['fields'](_0x50edfc[_0xb475('0x3b')][_0xb475('0x40')]));_0x499814['attributes']=_0x499814[_0xb475('0x3f')]['length']?_0x499814[_0xb475('0x3f')]:_0x37b60a[_0xb475('0x39')];_0x499814[_0xb475('0x45')]=qs[_0xb475('0x46')](_0x50edfc[_0xb475('0x3b')]['sort']);_0x499814['where']=qs['filters'](_[_0xb475('0x47')](_0x50edfc['query'],_0x37b60a[_0xb475('0x3d')]));if(_0x50edfc[_0xb475('0x3b')][_0xb475('0x48')]){_0x499814[_0xb475('0x49')]=_[_0xb475('0x31')](_0x499814[_0xb475('0x49')],{'$or':_['map'](_0x499814[_0xb475('0x3f')],function(_0x250703){var _0x419367={};_0x419367[_0x250703]={'$like':'%'+_0x50edfc['query']['filter']+'%'};return _0x419367;})});}_0x499814=_[_0xb475('0x31')]({},_0x499814,_0x50edfc[_0xb475('0x4b')]);return _0x317bd7['getAgents'](_0x499814);}})['then'](function(_0x522b8d){if(_0x522b8d){_0x1543d3=_0x522b8d[_0xb475('0x41')];if(!_0x50edfc[_0xb475('0x3b')]['hasOwnProperty']('nolimit')){_0x499814[_0xb475('0x44')]=qs['limit'](_0x50edfc[_0xb475('0x3b')][_0xb475('0x44')]);_0x499814[_0xb475('0x20')]=qs['offset'](_0x50edfc[_0xb475('0x3b')]['offset']);}return _0x317bd7[_0xb475('0x81')](_0x499814);}})[_0xb475('0x28')](function(_0x483498){if(_0x483498){return _0x483498?{'count':_0x1543d3,'rows':_0x483498}:null;}})[_0xb475('0x28')](respondWithResult(_0x40d08d,null))[_0xb475('0x50')](handleError(_0x40d08d,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 99c579d..00b7bbd 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 _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','update','emit'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var VoicePrefix=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){VoicePrefixEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);VoicePrefixEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];VoicePrefix[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xedd9,0xfc));var _0x9edd=function(_0x23ec15,_0x55b24a){_0x23ec15=_0x23ec15-0x0;var _0x317b5b=_0xedd9[_0x23ec15];return _0x317b5b;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9edd('0x0'))['db'][_0x9edd('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9edd('0x2')](0x0);var events={'afterCreate':_0x9edd('0x3'),'afterUpdate':_0x9edd('0x4'),'afterDestroy':_0x9edd('0x5')};function emitEvent(_0x3e6d3a){return function(_0x36b53f,_0x5943b3,_0x33679f){VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a+':'+_0x36b53f['id'],_0x36b53f);VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a,_0x36b53f);_0x33679f(null);};}for(var e in events){if(events[_0x9edd('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x9edd('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index a69d3ed..def38dd 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 _0xb713=['rimraf','../../config/environment','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x12a890,_0x4f3cb5){var _0x1a79ef=function(_0x5723f4){while(--_0x5723f4){_0x12a890['push'](_0x12a890['shift']());}};_0x1a79ef(++_0x4f3cb5);}(_0xb713,0xfd));var _0x3b71=function(_0x200827,_0x4af951){_0x200827=_0x200827-0x0;var _0x120047=_0xb713[_0x200827];return _0x120047;};'use strict';var _=require(_0x3b71('0x0'));var util=require(_0x3b71('0x1'));var logger=require(_0x3b71('0x2'))(_0x3b71('0x3'));var moment=require(_0x3b71('0x4'));var BPromise=require(_0x3b71('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b71('0x6'));var rimraf=require(_0x3b71('0x7'));var config=require(_0x3b71('0x8'));var attributes=require('./voicePrefix.attributes');module[_0x3b71('0x9')]=function(_0x2aa21e,_0x19fdf1){return _0x2aa21e[_0x3b71('0xa')](_0x3b71('0xb'),attributes,{'tableName':_0x3b71('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5375=['bluebird','request-promise','path','rimraf','./voicePrefix.attributes','define','voice_prefixes','lodash','api','moment'];(function(_0x1c6944,_0x5e6485){var _0x5f0239=function(_0x306d36){while(--_0x306d36){_0x1c6944['push'](_0x1c6944['shift']());}};_0x5f0239(++_0x5e6485);}(_0x5375,0x1c9));var _0x5537=function(_0x8d14f2,_0x2219de){_0x8d14f2=_0x8d14f2-0x0;var _0x34437b=_0x5375[_0x8d14f2];return _0x34437b;};'use strict';var _=require(_0x5537('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5537('0x1'));var moment=require(_0x5537('0x2'));var BPromise=require(_0x5537('0x3'));var rp=require(_0x5537('0x4'));var fs=require('fs');var path=require(_0x5537('0x5'));var rimraf=require(_0x5537('0x6'));var config=require('../../config/environment');var attributes=require(_0x5537('0x7'));module['exports']=function(_0x2a72dd,_0x27b092){return _0x2a72dd[_0x5537('0x8')]('VoicePrefix',attributes,{'tableName':_0x5537('0x9'),'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 e03d500..d84a372 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 _0xc1d0=['jayson/promise','client','defaults','redis','socket.io-emitter','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x2d5f67,_0x125f70){var _0x4c0890=function(_0x4f1586){while(--_0x4f1586){_0x2d5f67['push'](_0x2d5f67['shift']());}};_0x4c0890(++_0x125f70);}(_0xc1d0,0x1a1));var _0x0c1d=function(_0x1d116e,_0x54956c){_0x1d116e=_0x1d116e-0x0;var _0x3f4710=_0xc1d0[_0x1d116e];return _0x3f4710;};'use strict';var _=require(_0x0c1d('0x0'));var util=require(_0x0c1d('0x1'));var moment=require(_0x0c1d('0x2'));var BPromise=require(_0x0c1d('0x3'));var rs=require(_0x0c1d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0c1d('0x5'));var logger=require(_0x0c1d('0x6'))(_0x0c1d('0x7'));var config=require('../../config/environment');var jayson=require(_0x0c1d('0x8'));var client=jayson[_0x0c1d('0x9')]['http']({'port':0x232a});config['redis']=_[_0x0c1d('0xa')](config[_0x0c1d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0c1d('0xc'))(new Redis(config[_0x0c1d('0xb')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x44cb30,_0x23d6ab,_0x759a5a){return new BPromise(function(_0xf85a56,_0x1740bf){return client[_0x0c1d('0xd')](_0x44cb30,_0x759a5a)[_0x0c1d('0xe')](function(_0x13fce9){logger[_0x0c1d('0xf')](_0x0c1d('0x10'),_0x23d6ab,_0x0c1d('0x11'));logger[_0x0c1d('0x12')](_0x0c1d('0x13'),_0x23d6ab,'request\x20sent',JSON[_0x0c1d('0x14')](_0x13fce9));if(_0x13fce9[_0x0c1d('0x15')]){if(_0x13fce9[_0x0c1d('0x15')][_0x0c1d('0x16')]===0x1f4){logger[_0x0c1d('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x23d6ab,_0x13fce9[_0x0c1d('0x15')][_0x0c1d('0x17')]);return _0x1740bf(_0x13fce9['error'][_0x0c1d('0x17')]);}logger[_0x0c1d('0x15')](_0x0c1d('0x10'),_0x23d6ab,_0x13fce9[_0x0c1d('0x15')][_0x0c1d('0x17')]);return _0xf85a56(_0x13fce9[_0x0c1d('0x15')][_0x0c1d('0x17')]);}else{logger['info'](_0x0c1d('0x10'),_0x23d6ab,_0x0c1d('0x11'));_0xf85a56(_0x13fce9[_0x0c1d('0x18')][_0x0c1d('0x17')]);}})['catch'](function(_0x1e4505){logger[_0x0c1d('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x23d6ab,_0x1e4505);_0x1740bf(_0x1e4505);});});} \ No newline at end of file +var _0x3116=['VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3116,0x17e));var _0x6311=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x3116[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x6311('0x0'));var util=require(_0x6311('0x1'));var moment=require(_0x6311('0x2'));var BPromise=require(_0x6311('0x3'));var rs=require(_0x6311('0x4'));var fs=require('fs');var Redis=require(_0x6311('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6311('0x6'));var logger=require(_0x6311('0x7'))(_0x6311('0x8'));var config=require(_0x6311('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6311('0xa')][_0x6311('0xb')]({'port':0x232a});config[_0x6311('0xc')]=_[_0x6311('0xd')](config[_0x6311('0xc')],{'host':_0x6311('0xe'),'port':0x18eb});var socket=require(_0x6311('0xf'))(new Redis(config[_0x6311('0xc')]));require(_0x6311('0x10'))[_0x6311('0x11')](socket);function respondWithRpcPromise(_0x47fc42,_0x36ba58,_0x26b08f){return new BPromise(function(_0x18567d,_0xd1cb7d){return client['request'](_0x47fc42,_0x26b08f)['then'](function(_0x40b103){logger['info'](_0x6311('0x12'),_0x36ba58,_0x6311('0x13'));logger[_0x6311('0x14')](_0x6311('0x15'),_0x36ba58,_0x6311('0x13'),JSON['stringify'](_0x40b103));if(_0x40b103[_0x6311('0x16')]){if(_0x40b103[_0x6311('0x16')]['code']===0x1f4){logger[_0x6311('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x36ba58,_0x40b103[_0x6311('0x16')][_0x6311('0x17')]);return _0xd1cb7d(_0x40b103[_0x6311('0x16')]['message']);}logger[_0x6311('0x16')](_0x6311('0x12'),_0x36ba58,_0x40b103[_0x6311('0x16')][_0x6311('0x17')]);return _0x18567d(_0x40b103[_0x6311('0x16')]['message']);}else{logger[_0x6311('0x18')](_0x6311('0x12'),_0x36ba58,_0x6311('0x13'));_0x18567d(_0x40b103['result'][_0x6311('0x17')]);}})['catch'](function(_0x50add5){logger[_0x6311('0x16')](_0x6311('0x12'),_0x36ba58,_0x50add5);_0xd1cb7d(_0x50add5);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 91d4944..cb2ecea 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 _0xeddb=['length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','register'];(function(_0x4d19b0,_0x37eb76){var _0x3e896b=function(_0x3f1a6f){while(--_0x3f1a6f){_0x4d19b0['push'](_0x4d19b0['shift']());}};_0x3e896b(++_0x37eb76);}(_0xeddb,0x82));var _0xbedd=function(_0x57b38f,_0xc26f33){_0x57b38f=_0x57b38f-0x0;var _0x6aa12c=_0xeddb[_0x57b38f];return _0x6aa12c;};'use strict';var VoicePrefixEvents=require(_0xbedd('0x0'));var events=[_0xbedd('0x1'),_0xbedd('0x2'),_0xbedd('0x3')];function createListener(_0x37164d,_0x278514){return function(_0x4dc1fc){_0x278514[_0xbedd('0x4')](_0x37164d,_0x4dc1fc);};}function removeListener(_0x4165e7,_0x143776){return function(){VoicePrefixEvents['removeListener'](_0x4165e7,_0x143776);};}exports[_0xbedd('0x5')]=function(_0x4b508c){for(var _0x4b20ec=0x0,_0x4b8d42=events[_0xbedd('0x6')];_0x4b20ec<_0x4b8d42;_0x4b20ec++){var _0xddd6a8=events[_0x4b20ec];var _0x272205=createListener(_0xbedd('0x7')+_0xddd6a8,_0x4b508c);VoicePrefixEvents['on'](_0xddd6a8,_0x272205);}}; \ No newline at end of file +var _0xace7=['emit','removeListener','register','length','voicePrefix:','save','remove','update'];(function(_0x3d6752,_0x2e2616){var _0x5ad76d=function(_0x4e4652){while(--_0x4e4652){_0x3d6752['push'](_0x3d6752['shift']());}};_0x5ad76d(++_0x2e2616);}(_0xace7,0x19d));var _0x7ace=function(_0x18d29b,_0x3034d2){_0x18d29b=_0x18d29b-0x0;var _0x3c354f=_0xace7[_0x18d29b];return _0x3c354f;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x7ace('0x0'),_0x7ace('0x1'),_0x7ace('0x2')];function createListener(_0x4c83e1,_0x250512){return function(_0x126c4e){_0x250512[_0x7ace('0x3')](_0x4c83e1,_0x126c4e);};}function removeListener(_0x13fa41,_0x116428){return function(){VoicePrefixEvents[_0x7ace('0x4')](_0x13fa41,_0x116428);};}exports[_0x7ace('0x5')]=function(_0x37dd30){for(var _0x387185=0x0,_0x2714ce=events[_0x7ace('0x6')];_0x387185<_0x2714ce;_0x387185++){var _0x1be55c=events[_0x387185];var _0x11cdf1=createListener(_0x7ace('0x7')+_0x1be55c,_0x37dd30);VoicePrefixEvents['on'](_0x1be55c,_0x11cdf1);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index f6ba7e5..a2e8b5c 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 _0x4658=['/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','update','delete','/:id','destroy','removeTeams','removeLists','removeBlackLists','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','/:id/members','/:id/lists','/:id/blacklists','getBlackLists','post'];(function(_0x42f265,_0xa8b9b){var _0x1eb6ce=function(_0x3c5f74){while(--_0x3c5f74){_0x42f265['push'](_0x42f265['shift']());}};_0x1eb6ce(++_0xa8b9b);}(_0x4658,0x145));var _0x8465=function(_0x20677d,_0x40f43e){_0x20677d=_0x20677d-0x0;var _0x579640=_0x4658[_0x20677d];return _0x579640;};'use strict';var multer=require(_0x8465('0x0'));var util=require(_0x8465('0x1'));var path=require(_0x8465('0x2'));var timeout=require('connect-timeout');var express=require(_0x8465('0x3'));var router=express['Router']();var fs_extra=require(_0x8465('0x4'));var auth=require(_0x8465('0x5'));var interaction=require(_0x8465('0x6'));var config=require(_0x8465('0x7'));var controller=require(_0x8465('0x8'));router[_0x8465('0x9')]('/',auth['isAuthenticated'](),controller[_0x8465('0xa')]);router[_0x8465('0x9')]('/:id',auth[_0x8465('0xb')](),controller[_0x8465('0xc')]);router['get'](_0x8465('0xd'),auth['isAuthenticated'](),controller['getHoppers']);router['get'](_0x8465('0xe'),auth[_0x8465('0xb')](),controller[_0x8465('0xf')]);router['get'](_0x8465('0x10'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x8465('0x9')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x8465('0x11')]);router[_0x8465('0x9')](_0x8465('0x12'),auth[_0x8465('0xb')](),controller[_0x8465('0x13')]);router[_0x8465('0x9')](_0x8465('0x14'),auth[_0x8465('0xb')](),controller['getAgents']);router[_0x8465('0x9')](_0x8465('0x15'),auth[_0x8465('0xb')](),controller['getMembers']);router[_0x8465('0x9')](_0x8465('0x16'),auth[_0x8465('0xb')](),controller['getLists']);router['get'](_0x8465('0x17'),auth[_0x8465('0xb')](),controller[_0x8465('0x18')]);router[_0x8465('0x19')]('/',auth[_0x8465('0xb')](),controller['create']);router[_0x8465('0x19')](_0x8465('0x1a'),auth[_0x8465('0xb')](),controller['clone']);router[_0x8465('0x19')](_0x8465('0x12'),auth[_0x8465('0xb')](),controller[_0x8465('0x1b')]);router[_0x8465('0x19')](_0x8465('0x14'),auth['isAuthenticated'](),controller[_0x8465('0x1c')]);router[_0x8465('0x19')]('/:id/lists',auth[_0x8465('0xb')](),controller[_0x8465('0x1d')]);router['post'](_0x8465('0x17'),auth[_0x8465('0xb')](),controller[_0x8465('0x1e')]);router[_0x8465('0x1f')]('/:id',auth[_0x8465('0xb')](),controller[_0x8465('0x20')]);router[_0x8465('0x21')](_0x8465('0x22'),auth[_0x8465('0xb')](),controller[_0x8465('0x23')]);router[_0x8465('0x21')](_0x8465('0x12'),auth[_0x8465('0xb')](),controller[_0x8465('0x24')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);router['delete'](_0x8465('0x16'),auth[_0x8465('0xb')](),controller[_0x8465('0x25')]);router['delete'](_0x8465('0x17'),auth[_0x8465('0xb')](),controller[_0x8465('0x26')]);module['exports']=router; \ No newline at end of file +var _0x5e38=['removeBlackLists','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','/:id','/:id/hoppers','isAuthenticated','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addAgents','/:id/lists','addLists','addBlackLists','put','destroy','delete','removeAgents','removeLists'];(function(_0x3c1636,_0x3fdf33){var _0x14bd48=function(_0x289647){while(--_0x289647){_0x3c1636['push'](_0x3c1636['shift']());}};_0x14bd48(++_0x3fdf33);}(_0x5e38,0x1b0));var _0x85e3=function(_0x4a0677,_0x14e2c1){_0x4a0677=_0x4a0677-0x0;var _0x49ca78=_0x5e38[_0x4a0677];return _0x49ca78;};'use strict';var multer=require(_0x85e3('0x0'));var util=require(_0x85e3('0x1'));var path=require(_0x85e3('0x2'));var timeout=require('connect-timeout');var express=require(_0x85e3('0x3'));var router=express[_0x85e3('0x4')]();var fs_extra=require(_0x85e3('0x5'));var auth=require(_0x85e3('0x6'));var interaction=require(_0x85e3('0x7'));var config=require(_0x85e3('0x8'));var controller=require(_0x85e3('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x85e3('0xa')](_0x85e3('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x85e3('0xa')](_0x85e3('0xc'),auth[_0x85e3('0xd')](),controller['getHoppers']);router[_0x85e3('0xa')](_0x85e3('0xe'),auth[_0x85e3('0xd')](),controller[_0x85e3('0xf')]);router[_0x85e3('0xa')](_0x85e3('0x10'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x11')]);router['get'](_0x85e3('0x12'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x13')]);router[_0x85e3('0xa')](_0x85e3('0x14'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x15')]);router[_0x85e3('0xa')](_0x85e3('0x16'),auth['isAuthenticated'](),controller[_0x85e3('0x17')]);router['get'](_0x85e3('0x18'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x19')]);router[_0x85e3('0xa')]('/:id/lists',auth[_0x85e3('0xd')](),controller['getLists']);router[_0x85e3('0xa')](_0x85e3('0x1a'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x1b')]);router['post']('/',auth[_0x85e3('0xd')](),controller[_0x85e3('0x1c')]);router[_0x85e3('0x1d')](_0x85e3('0x1e'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x1f')]);router[_0x85e3('0x1d')](_0x85e3('0x14'),auth[_0x85e3('0xd')](),controller['addTeams']);router['post'](_0x85e3('0x16'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x20')]);router[_0x85e3('0x1d')](_0x85e3('0x21'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x22')]);router['post']('/:id/blacklists',auth[_0x85e3('0xd')](),controller[_0x85e3('0x23')]);router[_0x85e3('0x24')](_0x85e3('0xb'),auth[_0x85e3('0xd')](),controller['update']);router['delete'](_0x85e3('0xb'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x25')]);router[_0x85e3('0x26')](_0x85e3('0x14'),auth[_0x85e3('0xd')](),controller['removeTeams']);router['delete'](_0x85e3('0x16'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x27')]);router[_0x85e3('0x26')](_0x85e3('0x21'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x28')]);router['delete'](_0x85e3('0x1a'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x29')]);module[_0x85e3('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 1405f4d..89e7311 100644 --- a/server/api/voiceQueue/voiceQueue.attributes.js +++ b/server/api/voiceQueue/voiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x5c9760,_0x3c6cbb){var _0x1ea4a2=function(_0x55c6da){while(--_0x55c6da){_0x5c9760['push'](_0x5c9760['shift']());}};_0x1ea4a2(++_0x3c6cbb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x113bef,_0x82b4a5){var _0x3b6d82=function(_0xc0df02){while(--_0xc0df02){_0x113bef['push'](_0x113bef['shift']());}};_0x3b6d82(++_0x82b4a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index f660c82..e05c66d 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 _0x9417=['addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','NOW()','ContactId','CmListId','createdAt','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','into','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','then','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','stack','render','merge','contact','message','interaction','account','index','VoiceQueue','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','inbound','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','omit','VoiceQueues','userProfileId','error','update','getHoppers','CmHopper','length','pick','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','order','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','teams','Team','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','field','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','union','compact','removeAgents','destroy','userVoiceQueue:remove','addAgents','isEmpty','getAgents','User','getMembers','getLists'];(function(_0x169aaa,_0x5b2c5c){var _0x58619a=function(_0x39256b){while(--_0x39256b){_0x169aaa['push'](_0x169aaa['shift']());}};_0x58619a(++_0x5b2c5c);}(_0x9417,0xd9));var _0x7941=function(_0x1fb038,_0xc3f69b){_0x1fb038=_0x1fb038-0x0;var _0x1600dc=_0x9417[_0x1fb038];return _0x1600dc;};'use strict';var emlformat=require(_0x7941('0x0'));var rimraf=require(_0x7941('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7941('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7941('0x3'));var Mustache=require(_0x7941('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7941('0x5'));var csv=require('to-csv');var ejs=require(_0x7941('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7941('0x7'));var squel=require(_0x7941('0x8'));var crypto=require('crypto');var jsforce=require(_0x7941('0x9'));var deskjs=require(_0x7941('0xa'));var toCsv=require(_0x7941('0xb'));var querystring=require(_0x7941('0xc'));var Papa=require(_0x7941('0xd'));var Redis=require(_0x7941('0xe'));var authService=require(_0x7941('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7941('0x10'));var logger=require(_0x7941('0x11'))('api');var utils=require(_0x7941('0x12'));var config=require(_0x7941('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7941('0x14')]=_[_0x7941('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7941('0x16'))(new Redis(config[_0x7941('0x14')]));require(_0x7941('0x17'))[_0x7941('0x18')](socket);function respondWithStatusCode(_0x3766a0,_0x270a23){_0x270a23=_0x270a23||0xcc;return function(_0x449c98){if(_0x449c98){return _0x3766a0[_0x7941('0x19')](_0x270a23);}return _0x3766a0[_0x7941('0x1a')](_0x270a23)[_0x7941('0x1b')]();};}function respondWithResult(_0x4259ea,_0x16d4d2){_0x16d4d2=_0x16d4d2||0xc8;return function(_0x5534c5){if(_0x5534c5){return _0x4259ea[_0x7941('0x1a')](_0x16d4d2)[_0x7941('0x1c')](_0x5534c5);}};}function respondWithFilteredResult(_0x23384d,_0x47617d){return function(_0x58b2fa){if(_0x58b2fa){var _0x41b7ab=typeof _0x47617d[_0x7941('0x1d')]===_0x7941('0x1e')&&typeof _0x47617d['limit']===_0x7941('0x1e');var _0x5ee125=_0x58b2fa['count'];var _0x50b781=_0x41b7ab?0x0:_0x47617d[_0x7941('0x1d')];var _0x3218b8=_0x41b7ab?_0x58b2fa[_0x7941('0x1f')]:_0x47617d[_0x7941('0x1d')]+_0x47617d[_0x7941('0x20')];var _0xc46210;if(_0x3218b8>=_0x5ee125){_0x3218b8=_0x5ee125;_0xc46210=0xc8;}else{_0xc46210=0xce;}_0x23384d[_0x7941('0x1a')](_0xc46210);return _0x23384d[_0x7941('0x21')]('Content-Range',_0x50b781+'-'+_0x3218b8+'/'+_0x5ee125)[_0x7941('0x1c')](_0x58b2fa);}return null;};}function patchUpdates(_0x92885c){return function(_0x46b72d){try{jsonpatch[_0x7941('0x22')](_0x46b72d,_0x92885c,!![]);}catch(_0x583c77){return BPromise[_0x7941('0x23')](_0x583c77);}return _0x46b72d['save']();};}function saveUpdates(_0x2f8ba6,_0x238e78){return function(_0x5cce21){if(_0x5cce21){return _0x5cce21['update'](_0x2f8ba6)[_0x7941('0x24')](function(_0x221a48){return _0x221a48;});}return null;};}function removeEntity(_0x1d98b7,_0x2fd168){return function(_0x4fdee6){if(_0x4fdee6){return _0x4fdee6['destroy']()[_0x7941('0x24')](function(){var _0x2d71f1=_0x4fdee6['get']({'plain':!![]});var _0x34bfc2=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':_0x7941('0x25'),'value':_0x7941('0x26'),'ignore':![]}];var _0x2c6141=_(_0x34bfc2)[_0x7941('0x27')](_0x7941('0x28'))[_0x7941('0x29')](_0x7941('0x2a'))['value']();if(_[_0x7941('0x2b')](_0x2c6141,_0x2d71f1[_0x7941('0x2c')])){return;}var _0xcd3c9c=_[_0x7941('0x2d')](_0x34bfc2,[_0x7941('0x2a'),_0x2d71f1['type']])[_0x7941('0x2e')];return db['UserProfileResource']['destroy']({'where':{'type':_0xcd3c9c,'resourceId':_0x2d71f1['id']}})[_0x7941('0x24')](function(){return _0x4fdee6;});})[_0x7941('0x24')](function(){_0x1d98b7[_0x7941('0x1a')](0xcc)[_0x7941('0x1b')]();});}};}function handleEntityNotFound(_0x499c81,_0xc9c1eb){return function(_0x34fedb){if(!_0x34fedb){_0x499c81[_0x7941('0x19')](0x194);}return _0x34fedb;};}function handleError(_0xa94d5a,_0x5e0321){_0x5e0321=_0x5e0321||0x1f4;return function(_0x3e4f26){logger['error'](_0x3e4f26[_0x7941('0x2f')]);if(_0x3e4f26[_0x7941('0x2e')]){delete _0x3e4f26[_0x7941('0x2e')];}_0xa94d5a[_0x7941('0x1a')](_0x5e0321)['send'](_0x3e4f26);};}function getMustacheRender(_0x447aa0,_0x273943){return Mustache[_0x7941('0x30')](_0x447aa0,_[_0x7941('0x31')](_0x273943['body'],{'contact':_0x273943[_0x7941('0x32')],'message':_0x273943[_0x7941('0x33')],'agent':_0x273943['agent'],'interaction':_0x273943[_0x7941('0x34')],'account':_0x273943[_0x7941('0x35')]}))||'';}exports[_0x7941('0x36')]=function(_0x2e3182,_0x58393f){var _0x122799={},_0x358c2c={},_0x2a1f5e={'count':0x0,'rows':[]};var _0x146c9e=_[_0x7941('0x29')](db[_0x7941('0x37')][_0x7941('0x38')],function(_0x3e7c1c){return{'name':_0x3e7c1c[_0x7941('0x39')],'type':_0x3e7c1c[_0x7941('0x2c')]['key']};});_0x358c2c[_0x7941('0x3a')]=_[_0x7941('0x29')](_0x146c9e,_0x7941('0x2e'));_0x358c2c[_0x7941('0x3b')]=_[_0x7941('0x3c')](_0x2e3182[_0x7941('0x3b')]);_0x358c2c[_0x7941('0x3d')]=_['intersection'](_0x358c2c[_0x7941('0x3a')],_0x358c2c[_0x7941('0x3b')]);_0x122799[_0x7941('0x3e')]=_[_0x7941('0x3f')](_0x358c2c[_0x7941('0x3a')],qs[_0x7941('0x40')](_0x2e3182[_0x7941('0x3b')][_0x7941('0x40')]));_0x122799[_0x7941('0x3e')]=_0x122799[_0x7941('0x3e')]['length']?_0x122799['attributes']:_0x358c2c['model'];if(!_0x2e3182[_0x7941('0x3b')][_0x7941('0x41')](_0x7941('0x42'))){_0x122799[_0x7941('0x20')]=qs['limit'](_0x2e3182[_0x7941('0x3b')]['limit']);_0x122799[_0x7941('0x1d')]=qs[_0x7941('0x1d')](_0x2e3182[_0x7941('0x3b')][_0x7941('0x1d')]);}_0x122799['order']=qs[_0x7941('0x43')](_0x2e3182[_0x7941('0x3b')][_0x7941('0x43')]);_0x122799[_0x7941('0x44')]=qs['filters'](_['pick'](_0x2e3182[_0x7941('0x3b')],_0x358c2c['filters']),_0x146c9e);if(_0x2e3182[_0x7941('0x3b')]['filter']){_0x122799[_0x7941('0x44')]=_['merge'](_0x122799[_0x7941('0x44')],{'$or':_[_0x7941('0x29')](_0x146c9e,function(_0x331a35){if(_0x331a35[_0x7941('0x2c')]!==_0x7941('0x45')){var _0x1af348={};_0x1af348[_0x331a35[_0x7941('0x2e')]]={'$like':'%'+_0x2e3182[_0x7941('0x3b')][_0x7941('0x27')]+'%'};return _0x1af348;}})});}_0x122799=_[_0x7941('0x31')]({},_0x122799,_0x2e3182['options']);var _0x4b935a={'where':_0x122799[_0x7941('0x44')]};return db[_0x7941('0x37')][_0x7941('0x1f')](_0x4b935a)['then'](function(_0x4aa46c){_0x2a1f5e[_0x7941('0x1f')]=_0x4aa46c;if(_0x2e3182[_0x7941('0x3b')][_0x7941('0x46')]){_0x122799[_0x7941('0x47')]=[{'all':!![]}];}return db['VoiceQueue'][_0x7941('0x48')](_0x122799);})[_0x7941('0x24')](function(_0x12f009){_0x2a1f5e[_0x7941('0x49')]=_0x12f009;return _0x2a1f5e;})[_0x7941('0x24')](respondWithFilteredResult(_0x58393f,_0x122799))[_0x7941('0x4a')](handleError(_0x58393f,null));};exports['show']=function(_0x441530,_0x4ddf4a){var _0x97faca={'raw':![],'where':{'id':_0x441530[_0x7941('0x4b')]['id']}},_0x36448a={};_0x36448a['model']=_['keys'](db['VoiceQueue'][_0x7941('0x38')]);_0x36448a[_0x7941('0x3b')]=_[_0x7941('0x3c')](_0x441530[_0x7941('0x3b')]);_0x36448a[_0x7941('0x3d')]=_[_0x7941('0x3f')](_0x36448a[_0x7941('0x3a')],_0x36448a[_0x7941('0x3b')]);_0x97faca[_0x7941('0x3e')]=_[_0x7941('0x3f')](_0x36448a[_0x7941('0x3a')],qs['fields'](_0x441530[_0x7941('0x3b')]['fields']));_0x97faca['attributes']=_0x97faca['attributes']['length']?_0x97faca[_0x7941('0x3e')]:_0x36448a['model'];if(_0x441530[_0x7941('0x3b')][_0x7941('0x46')]){_0x97faca[_0x7941('0x47')]=[{'all':!![]}];}_0x97faca=_['merge']({},_0x97faca,_0x441530[_0x7941('0x4c')]);return db['VoiceQueue'][_0x7941('0x2d')](_0x97faca)[_0x7941('0x24')](handleEntityNotFound(_0x4ddf4a,null))[_0x7941('0x24')](respondWithResult(_0x4ddf4a,null))[_0x7941('0x4a')](handleError(_0x4ddf4a,null));};exports[_0x7941('0x4d')]=function(_0x201d6c,_0x33329d){return db['VoiceQueue'][_0x7941('0x4d')](_0x201d6c[_0x7941('0x4e')],{})[_0x7941('0x24')](function(_0x4eee81){var _0x3f5861=_0x201d6c[_0x7941('0x4f')]['get']({'plain':!![]});if(!_0x3f5861)throw new Error(_0x7941('0x50'));if(_0x3f5861[_0x7941('0x51')]===_0x7941('0x4f')){var _0x28b71f=_0x4eee81[_0x7941('0x52')]({'plain':!![]});var _0x3409be=[{'name':'VoiceQueues','value':_0x7941('0x53')},{'name':'QueueCampaigns','value':'outbound'}];var _0x10aed8=_[_0x7941('0x2d')](_0x3409be,['value',_0x28b71f[_0x7941('0x2c')]])['name'];return db[_0x7941('0x54')][_0x7941('0x2d')]({'where':{'name':_0x10aed8,'userProfileId':_0x3f5861['userProfileId']},'raw':!![]})['then'](function(_0x47a5de){if(_0x47a5de&&_0x47a5de[_0x7941('0x55')]===0x0){return db[_0x7941('0x56')]['create']({'name':_0x28b71f[_0x7941('0x2e')],'resourceId':_0x28b71f['id'],'type':_0x47a5de[_0x7941('0x2e')],'sectionId':_0x47a5de['id']},{})[_0x7941('0x24')](function(){return _0x4eee81;});}else{return _0x4eee81;}})['catch'](function(_0x5ead35){logger['error'](_0x7941('0x57'),_0x5ead35);throw _0x5ead35;});}return _0x4eee81;})[_0x7941('0x24')](respondWithResult(_0x33329d,0xc9))['catch'](handleError(_0x33329d,null));};exports[_0x7941('0x58')]=function(_0x60f3fd,_0x3ccd3f){var _0x438da3={'where':{'id':_0x60f3fd[_0x7941('0x4b')]['id']}},_0x4f6d5d={};_0x4f6d5d[_0x7941('0x3a')]=_[_0x7941('0x3c')](db['VoiceQueue'][_0x7941('0x38')]);_0x438da3[_0x7941('0x3e')]=_[_0x7941('0x3f')](_0x4f6d5d[_0x7941('0x3a')],qs[_0x7941('0x40')](_0x60f3fd[_0x7941('0x3b')][_0x7941('0x40')]));_0x438da3[_0x7941('0x3e')]=_0x438da3[_0x7941('0x3e')]['length']?_0x438da3['attributes']:_0x4f6d5d[_0x7941('0x3a')];if(_0x60f3fd[_0x7941('0x3b')][_0x7941('0x46')]){_0x438da3[_0x7941('0x47')]=[{'all':!![]}];}_0x438da3=_[_0x7941('0x31')]({},_0x438da3,_0x60f3fd[_0x7941('0x4c')]);return db['VoiceQueue'][_0x7941('0x2d')](_0x438da3)['then'](handleEntityNotFound(_0x3ccd3f,null))[_0x7941('0x24')](function(_0xf18fb9){if(_0xf18fb9){var _0x473ab9=_0xf18fb9[_0x7941('0x52')]({'plain':!![]});_0x473ab9=qs['omit'](_0x473ab9,['id','createdAt',_0x7941('0x59')]);_0x60f3fd[_0x7941('0x4e')]=_[_0x7941('0x5a')](_0x60f3fd[_0x7941('0x4e')],['id','createdAt','updatedAt']);return db[_0x7941('0x37')][_0x7941('0x4d')](_[_0x7941('0x31')](_0x473ab9,_0x60f3fd[_0x7941('0x4e')]),{'include':_0x60f3fd['query'][_0x7941('0x46')]?[{'all':!![]}]:undefined})[_0x7941('0x24')](function(_0x5a396d){var _0x387d91=_0x60f3fd['user'][_0x7941('0x52')]({'plain':!![]});if(!_0x387d91)throw new Error(_0x7941('0x50'));if(_0x387d91[_0x7941('0x51')]===_0x7941('0x4f')){var _0x25e89f=_0x5a396d[_0x7941('0x52')]({'plain':!![]});var _0x1d0ed7=[{'name':_0x7941('0x5b'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x7941('0x26')}];var _0x29dab6=_[_0x7941('0x2d')](_0x1d0ed7,[_0x7941('0x2a'),_0x25e89f['type']])[_0x7941('0x2e')];return db[_0x7941('0x54')][_0x7941('0x2d')]({'where':{'name':_0x29dab6,'userProfileId':_0x387d91[_0x7941('0x5c')]},'raw':!![]})['then'](function(_0x3ec9d6){if(_0x3ec9d6&&_0x3ec9d6[_0x7941('0x55')]===0x0){return db[_0x7941('0x56')][_0x7941('0x4d')]({'name':_0x25e89f[_0x7941('0x2e')],'resourceId':_0x25e89f['id'],'type':_0x3ec9d6[_0x7941('0x2e')],'sectionId':_0x3ec9d6['id']},{})['then'](function(){return _0x5a396d;});}else{return _0x5a396d;}})[_0x7941('0x4a')](function(_0x287f62){logger[_0x7941('0x5d')](_0x7941('0x57'),_0x287f62);throw _0x287f62;});}return _0x5a396d;});}})['then'](respondWithResult(_0x3ccd3f,0xc9))['catch'](handleError(_0x3ccd3f,null));};exports[_0x7941('0x5e')]=function(_0x5c2e02,_0x52f17c){if(_0x5c2e02[_0x7941('0x4e')]['id']){delete _0x5c2e02[_0x7941('0x4e')]['id'];}return db[_0x7941('0x37')]['find']({'where':{'id':_0x5c2e02[_0x7941('0x4b')]['id']}})[_0x7941('0x24')](handleEntityNotFound(_0x52f17c,null))[_0x7941('0x24')](saveUpdates(_0x5c2e02[_0x7941('0x4e')],null))[_0x7941('0x24')](respondWithResult(_0x52f17c,null))['catch'](handleError(_0x52f17c,null));};exports['destroy']=function(_0xd52a52,_0x5c682c){return db['VoiceQueue'][_0x7941('0x2d')]({'where':{'id':_0xd52a52['params']['id']}})[_0x7941('0x24')](handleEntityNotFound(_0x5c682c,null))[_0x7941('0x24')](removeEntity(_0x5c682c,null))[_0x7941('0x4a')](handleError(_0x5c682c,null));};exports[_0x7941('0x5f')]=function(_0x2e399e,_0xf32d2a,_0x2fa9c4){var _0x504db5={'raw':![],'where':{}};var _0x7d4559={};var _0x3fcde9={'count':0x0,'rows':[]};return db[_0x7941('0x37')]['findOne']({'where':{'id':_0x2e399e['params']['id']}})[_0x7941('0x24')](handleEntityNotFound(_0xf32d2a,null))['then'](function(_0x27d8fa){if(_0x27d8fa){_0x7d4559[_0x7941('0x3a')]=_[_0x7941('0x3c')](db[_0x7941('0x60')][_0x7941('0x38')]);_0x7d4559['query']=_[_0x7941('0x3c')](_0x2e399e[_0x7941('0x3b')]);_0x7d4559['filters']=_[_0x7941('0x3f')](_0x7d4559[_0x7941('0x3a')],_0x7d4559[_0x7941('0x3b')]);_0x504db5['attributes']=_[_0x7941('0x3f')](_0x7d4559['model'],qs['fields'](_0x2e399e[_0x7941('0x3b')]['fields']));_0x504db5[_0x7941('0x3e')]=_0x504db5[_0x7941('0x3e')][_0x7941('0x61')]?_0x504db5[_0x7941('0x3e')]:_0x7d4559[_0x7941('0x3a')];if(!_0x2e399e[_0x7941('0x3b')][_0x7941('0x41')](_0x7941('0x42'))){_0x504db5[_0x7941('0x20')]=qs[_0x7941('0x20')](_0x2e399e[_0x7941('0x3b')][_0x7941('0x20')]);_0x504db5[_0x7941('0x1d')]=qs['offset'](_0x2e399e['query']['offset']);}_0x504db5['order']=qs[_0x7941('0x43')](_0x2e399e['query'][_0x7941('0x43')]);_0x504db5[_0x7941('0x44')]=qs[_0x7941('0x3d')](_[_0x7941('0x62')](_0x2e399e[_0x7941('0x3b')],_0x7d4559[_0x7941('0x3d')]));_0x504db5[_0x7941('0x44')][_0x7941('0x63')]=_0x27d8fa['id'];if(_0x2e399e[_0x7941('0x3b')]['filter']){_0x504db5[_0x7941('0x44')]=_['merge'](_0x504db5[_0x7941('0x44')],{'$or':_[_0x7941('0x29')](_0x504db5[_0x7941('0x3e')],function(_0x5cb790){var _0x276b3f={};_0x276b3f[_0x5cb790]={'$like':'%'+_0x2e399e['query'][_0x7941('0x27')]+'%'};return _0x276b3f;})});}_0x504db5=_[_0x7941('0x31')]({},_0x504db5,_0x2e399e[_0x7941('0x4c')]);return db[_0x7941('0x60')][_0x7941('0x1f')]({'where':_0x504db5[_0x7941('0x44')]})[_0x7941('0x24')](function(_0x5ff0ac){_0x3fcde9[_0x7941('0x1f')]=_0x5ff0ac;if(_0x2e399e[_0x7941('0x3b')][_0x7941('0x46')]){_0x504db5[_0x7941('0x47')]=[{'all':!![]}];}return db['CmHopper'][_0x7941('0x48')](_0x504db5);})[_0x7941('0x24')](function(_0x15fc29){_0x3fcde9[_0x7941('0x49')]=_0x15fc29;return _0x3fcde9;});}})[_0x7941('0x24')](respondWithFilteredResult(_0xf32d2a,_0x504db5))[_0x7941('0x4a')](handleError(_0xf32d2a,null));};exports[_0x7941('0x64')]=function(_0x3dbd21,_0x454ea6,_0x28f9fa){var _0x3ce0f3={'raw':!![],'where':{}};var _0x23fd36={};var _0x549e0c={'count':0x0,'rows':[]};return db[_0x7941('0x37')][_0x7941('0x65')]({'where':{'id':_0x3dbd21['params']['id']}})[_0x7941('0x24')](handleEntityNotFound(_0x454ea6,null))['then'](function(_0x119d76){if(_0x119d76){_0x23fd36[_0x7941('0x3a')]=_['keys'](db[_0x7941('0x66')][_0x7941('0x38')]);_0x23fd36['query']=_[_0x7941('0x3c')](_0x3dbd21[_0x7941('0x3b')]);_0x23fd36['filters']=_['intersection'](_0x23fd36[_0x7941('0x3a')],_0x23fd36[_0x7941('0x3b')]);_0x3ce0f3[_0x7941('0x3e')]=_[_0x7941('0x3f')](_0x23fd36[_0x7941('0x3a')],qs[_0x7941('0x40')](_0x3dbd21[_0x7941('0x3b')][_0x7941('0x40')]));_0x3ce0f3[_0x7941('0x3e')]=_0x3ce0f3['attributes'][_0x7941('0x61')]?_0x3ce0f3['attributes']:_0x23fd36[_0x7941('0x3a')];if(!_0x3dbd21[_0x7941('0x3b')][_0x7941('0x41')](_0x7941('0x42'))){_0x3ce0f3['limit']=qs['limit'](_0x3dbd21[_0x7941('0x3b')][_0x7941('0x20')]);_0x3ce0f3['offset']=qs[_0x7941('0x1d')](_0x3dbd21[_0x7941('0x3b')][_0x7941('0x1d')]);}_0x3ce0f3[_0x7941('0x67')]=qs[_0x7941('0x43')](_0x3dbd21[_0x7941('0x3b')][_0x7941('0x43')]);_0x3ce0f3[_0x7941('0x44')]=qs[_0x7941('0x3d')](_[_0x7941('0x62')](_0x3dbd21[_0x7941('0x3b')],_0x23fd36[_0x7941('0x3d')]));_0x3ce0f3[_0x7941('0x44')][_0x7941('0x63')]=_0x119d76['id'];if(_0x3dbd21['query'][_0x7941('0x27')]){_0x3ce0f3[_0x7941('0x44')]=_[_0x7941('0x31')](_0x3ce0f3[_0x7941('0x44')],{'$or':_[_0x7941('0x29')](_0x3ce0f3[_0x7941('0x3e')],function(_0x4c6c5f){var _0x553a43={};_0x553a43[_0x4c6c5f]={'$like':'%'+_0x3dbd21[_0x7941('0x3b')][_0x7941('0x27')]+'%'};return _0x553a43;})});}_0x3ce0f3=_[_0x7941('0x31')]({},_0x3ce0f3,_0x3dbd21[_0x7941('0x4c')]);return db[_0x7941('0x66')][_0x7941('0x1f')]({'where':_0x3ce0f3[_0x7941('0x44')]})[_0x7941('0x24')](function(_0x288f5e){_0x549e0c[_0x7941('0x1f')]=_0x288f5e;if(_0x3dbd21[_0x7941('0x3b')][_0x7941('0x46')]){_0x3ce0f3[_0x7941('0x47')]=[{'all':!![]}];}return db[_0x7941('0x66')]['findAll'](_0x3ce0f3);})[_0x7941('0x24')](function(_0x149ba9){_0x549e0c[_0x7941('0x49')]=_0x149ba9;return _0x549e0c;});}})['then'](respondWithFilteredResult(_0x454ea6,_0x3ce0f3))[_0x7941('0x4a')](handleError(_0x454ea6,null));};exports[_0x7941('0x68')]=function(_0x34c109,_0x19564a,_0x255f84){var _0x124dfe={'raw':!![],'where':{}};var _0x44989a={};var _0x298e35={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x7941('0x65')]({'where':{'id':_0x34c109[_0x7941('0x4b')]['id']}})[_0x7941('0x24')](handleEntityNotFound(_0x19564a,null))[_0x7941('0x24')](function(_0x1e2b52){if(_0x1e2b52){_0x44989a[_0x7941('0x3a')]=_['keys'](db[_0x7941('0x69')][_0x7941('0x38')]);_0x44989a['query']=_[_0x7941('0x3c')](_0x34c109[_0x7941('0x3b')]);_0x44989a[_0x7941('0x3d')]=_[_0x7941('0x3f')](_0x44989a[_0x7941('0x3a')],_0x44989a[_0x7941('0x3b')]);_0x124dfe[_0x7941('0x3e')]=_[_0x7941('0x3f')](_0x44989a[_0x7941('0x3a')],qs[_0x7941('0x40')](_0x34c109[_0x7941('0x3b')][_0x7941('0x40')]));_0x124dfe['attributes']=_0x124dfe[_0x7941('0x3e')][_0x7941('0x61')]?_0x124dfe[_0x7941('0x3e')]:_0x44989a['model'];if(!_0x34c109[_0x7941('0x3b')][_0x7941('0x41')](_0x7941('0x42'))){_0x124dfe['limit']=qs[_0x7941('0x20')](_0x34c109['query']['limit']);_0x124dfe[_0x7941('0x1d')]=qs[_0x7941('0x1d')](_0x34c109[_0x7941('0x3b')][_0x7941('0x1d')]);}_0x124dfe[_0x7941('0x67')]=qs[_0x7941('0x43')](_0x34c109['query'][_0x7941('0x43')]);_0x124dfe['where']=qs['filters'](_[_0x7941('0x62')](_0x34c109[_0x7941('0x3b')],_0x44989a['filters']));_0x124dfe[_0x7941('0x44')]['VoiceQueueId']=_0x1e2b52['id'];if(_0x34c109['query'][_0x7941('0x27')]){_0x124dfe['where']=_[_0x7941('0x31')](_0x124dfe[_0x7941('0x44')],{'$or':_[_0x7941('0x29')](_0x124dfe[_0x7941('0x3e')],function(_0x494701){var _0x321272={};_0x321272[_0x494701]={'$like':'%'+_0x34c109[_0x7941('0x3b')][_0x7941('0x27')]+'%'};return _0x321272;})});}_0x124dfe=_['merge']({},_0x124dfe,_0x34c109[_0x7941('0x4c')]);return db[_0x7941('0x69')]['count']({'where':_0x124dfe['where']})[_0x7941('0x24')](function(_0x24754f){_0x298e35[_0x7941('0x1f')]=_0x24754f;if(_0x34c109[_0x7941('0x3b')][_0x7941('0x46')]){_0x124dfe[_0x7941('0x47')]=[{'all':!![]}];}return db[_0x7941('0x69')][_0x7941('0x48')](_0x124dfe);})[_0x7941('0x24')](function(_0x11073a){_0x298e35['rows']=_0x11073a;return _0x298e35;});}})[_0x7941('0x24')](respondWithFilteredResult(_0x19564a,_0x124dfe))[_0x7941('0x4a')](handleError(_0x19564a,null));};exports[_0x7941('0x6a')]=function(_0x3a1e2c,_0x3023c0,_0x38f847){var _0x14e670={'raw':!![],'where':{}};var _0x13316e={};var _0x7d4643={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x7941('0x65')]({'where':{'id':_0x3a1e2c[_0x7941('0x4b')]['id']}})[_0x7941('0x24')](handleEntityNotFound(_0x3023c0,null))[_0x7941('0x24')](function(_0x29f502){if(_0x29f502){_0x13316e['model']=_[_0x7941('0x3c')](db['CmHopperBlack']['rawAttributes']);_0x13316e['query']=_[_0x7941('0x3c')](_0x3a1e2c[_0x7941('0x3b')]);_0x13316e[_0x7941('0x3d')]=_[_0x7941('0x3f')](_0x13316e[_0x7941('0x3a')],_0x13316e[_0x7941('0x3b')]);_0x14e670[_0x7941('0x3e')]=_['intersection'](_0x13316e[_0x7941('0x3a')],qs[_0x7941('0x40')](_0x3a1e2c[_0x7941('0x3b')][_0x7941('0x40')]));_0x14e670[_0x7941('0x3e')]=_0x14e670[_0x7941('0x3e')][_0x7941('0x61')]?_0x14e670[_0x7941('0x3e')]:_0x13316e[_0x7941('0x3a')];if(!_0x3a1e2c[_0x7941('0x3b')][_0x7941('0x41')](_0x7941('0x42'))){_0x14e670[_0x7941('0x20')]=qs['limit'](_0x3a1e2c[_0x7941('0x3b')]['limit']);_0x14e670[_0x7941('0x1d')]=qs[_0x7941('0x1d')](_0x3a1e2c[_0x7941('0x3b')][_0x7941('0x1d')]);}_0x14e670['order']=qs[_0x7941('0x43')](_0x3a1e2c[_0x7941('0x3b')]['sort']);_0x14e670[_0x7941('0x44')]=qs[_0x7941('0x3d')](_[_0x7941('0x62')](_0x3a1e2c[_0x7941('0x3b')],_0x13316e[_0x7941('0x3d')]));_0x14e670['where']['VoiceQueueId']=_0x29f502['id'];if(_0x3a1e2c['query'][_0x7941('0x27')]){_0x14e670['where']=_[_0x7941('0x31')](_0x14e670[_0x7941('0x44')],{'$or':_[_0x7941('0x29')](_0x14e670[_0x7941('0x3e')],function(_0x4df6db){var _0x36a613={};_0x36a613[_0x4df6db]={'$like':'%'+_0x3a1e2c[_0x7941('0x3b')]['filter']+'%'};return _0x36a613;})});}_0x14e670=_[_0x7941('0x31')]({},_0x14e670,_0x3a1e2c[_0x7941('0x4c')]);return db[_0x7941('0x6b')][_0x7941('0x1f')]({'where':_0x14e670[_0x7941('0x44')]})[_0x7941('0x24')](function(_0x29d36a){_0x7d4643['count']=_0x29d36a;if(_0x3a1e2c[_0x7941('0x3b')]['includeAll']){_0x14e670[_0x7941('0x47')]=[{'all':!![]}];}return db[_0x7941('0x6b')][_0x7941('0x48')](_0x14e670);})[_0x7941('0x24')](function(_0x2e07c1){_0x7d4643[_0x7941('0x49')]=_0x2e07c1;return _0x7d4643;});}})[_0x7941('0x24')](respondWithFilteredResult(_0x3023c0,_0x14e670))[_0x7941('0x4a')](handleError(_0x3023c0,null));};exports[_0x7941('0x6c')]=function(_0x2eb4e8,_0x5ad21c,_0x45092a){var _0x2a0a66={};var _0x256cbb={};var _0x476fbf;var _0x5e33c1;return db['VoiceQueue'][_0x7941('0x65')]({'where':{'id':_0x2eb4e8[_0x7941('0x4b')]['id']}})[_0x7941('0x24')](handleEntityNotFound(_0x5ad21c,null))['then'](function(_0x5b4547){if(_0x5b4547){_0x476fbf=_0x5b4547;_0x256cbb[_0x7941('0x3a')]=_[_0x7941('0x3c')](db['Team'][_0x7941('0x38')]);_0x256cbb['query']=_[_0x7941('0x3c')](_0x2eb4e8[_0x7941('0x3b')]);_0x256cbb['filters']=_[_0x7941('0x3f')](_0x256cbb['model'],_0x256cbb[_0x7941('0x3b')]);_0x2a0a66['attributes']=_[_0x7941('0x3f')](_0x256cbb['model'],qs[_0x7941('0x40')](_0x2eb4e8[_0x7941('0x3b')][_0x7941('0x40')]));_0x2a0a66[_0x7941('0x3e')]=_0x2a0a66[_0x7941('0x3e')][_0x7941('0x61')]?_0x2a0a66[_0x7941('0x3e')]:_0x256cbb[_0x7941('0x3a')];_0x2a0a66['order']=qs['sort'](_0x2eb4e8[_0x7941('0x3b')][_0x7941('0x43')]);_0x2a0a66[_0x7941('0x44')]=qs[_0x7941('0x3d')](_[_0x7941('0x62')](_0x2eb4e8['query'],_0x256cbb['filters']));if(_0x2eb4e8['query'][_0x7941('0x27')]){_0x2a0a66[_0x7941('0x44')]=_[_0x7941('0x31')](_0x2a0a66[_0x7941('0x44')],{'$or':_[_0x7941('0x29')](_0x2a0a66['attributes'],function(_0x33b387){var _0x4766d1={};_0x4766d1[_0x33b387]={'$like':'%'+_0x2eb4e8[_0x7941('0x3b')][_0x7941('0x27')]+'%'};return _0x4766d1;})});}_0x2a0a66=_[_0x7941('0x31')]({},_0x2a0a66,_0x2eb4e8[_0x7941('0x4c')]);return _0x476fbf[_0x7941('0x6c')](_0x2a0a66);}})['then'](function(_0x2a52b5){if(_0x2a52b5){_0x5e33c1=_0x2a52b5['length'];if(!_0x2eb4e8['query']['hasOwnProperty']('nolimit')){_0x2a0a66[_0x7941('0x20')]=qs[_0x7941('0x20')](_0x2eb4e8[_0x7941('0x3b')]['limit']);_0x2a0a66[_0x7941('0x1d')]=qs[_0x7941('0x1d')](_0x2eb4e8[_0x7941('0x3b')]['offset']);}return _0x476fbf['getTeams'](_0x2a0a66);}})[_0x7941('0x24')](function(_0x388796){if(_0x388796){return _0x388796?{'count':_0x5e33c1,'rows':_0x388796}:null;}})[_0x7941('0x24')](respondWithResult(_0x5ad21c,null))[_0x7941('0x4a')](handleError(_0x5ad21c,null));};exports['addTeams']=function(_0x59d50f,_0x1fe03,_0x5d3920){var _0x28a5c1=_0x59d50f[_0x7941('0x4e')][_0x7941('0x6d')];var _0x4504c5=_['map'](_0x28a5c1,'id');return db[_0x7941('0x6e')][_0x7941('0x48')]({'where':{'id':_0x4504c5},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7941('0x6f'),'attributes':['id',_0x7941('0x2e'),_0x7941('0x70'),_0x7941('0x71'),_0x7941('0x72')],'raw':!![]}]})[_0x7941('0x24')](function(_0x1d1ab1){if(_0x1d1ab1){var _0x10db6e=_[_0x7941('0x73')](_0x1d1ab1,function(_0x52ed8d){var _0x4c8938=_0x52ed8d[_0x7941('0x52')]({'plain':!![]});_0x4c8938[_0x7941('0x6f')][_0x7941('0x74')](function(_0x149c9c){_0x149c9c[_0x7941('0x75')]=_['find'](_0x28a5c1,{'id':_0x4c8938['id']})[_0x7941('0x75')];});return _0x4c8938[_0x7941('0x6f')];});return db['VoiceQueue']['find']({'where':{'id':_0x59d50f[_0x7941('0x4b')]['id']}})[_0x7941('0x24')](function(_0x409c22){return db[_0x7941('0x76')][_0x7941('0x77')](function(_0x52b8b0){return _0x409c22['addTeams'](_0x4504c5,{'transaction':_0x52b8b0})['then'](function(){return BPromise[_0x7941('0x78')](_0x28a5c1,function(_0x113aa5){return db[_0x7941('0x79')]['upsert']({'TeamId':_0x113aa5['id'],'VoiceQueueId':_0x59d50f['params']['id'],'penalty':_0x113aa5[_0x7941('0x75')]},{'transaction':_0x52b8b0});});})['then'](function(){return BPromise['each'](_0x10db6e,function(_0x41a79d){return db[_0x7941('0x7a')][_0x7941('0x7b')]({'where':{'UserId':_0x41a79d['id'],'VoiceQueueId':_0x59d50f[_0x7941('0x4b')]['id']},'defaults':{'penalty':_0x41a79d[_0x7941('0x75')]},'transaction':_0x52b8b0});});})[_0x7941('0x24')](function(){return BPromise[_0x7941('0x78')](_[_0x7941('0x27')](_0x10db6e,{'online':!![]}),function(_0x4c0592){return db[_0x7941('0x7c')][_0x7941('0x7d')]({'membername':_0x4c0592['name'],'UserId':_0x4c0592['id'],'queue_name':_0x409c22[_0x7941('0x2e')],'VoiceQueueId':_0x409c22['id'],'interface':_[_0x7941('0x7e')](_0x4c0592[_0x7941('0x72')])?util[_0x7941('0x7f')](_0x7941('0x80'),_0x4c0592['name']):_0x4c0592[_0x7941('0x72')],'paused':_0x4c0592['voicePause']||![],'penalty':_0x4c0592[_0x7941('0x75')]},{'transaction':_0x52b8b0});});})[_0x7941('0x24')](function(){_0x10db6e[_0x7941('0x74')](function(_0x2ed08e){socket[_0x7941('0x81')](_0x7941('0x82'),{'UserId':_0x2ed08e['id'],'VoiceQueueId':_0x409c22['id']});});});});});}})['then'](respondWithStatusCode(_0x1fe03,null))[_0x7941('0x4a')](handleError(_0x1fe03,null));};exports[_0x7941('0x83')]=function(_0x33325f,_0x48380f,_0xcf8d73){return db[_0x7941('0x6e')][_0x7941('0x48')]({'where':{'id':_0x33325f[_0x7941('0x3b')][_0x7941('0x84')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x48380f,null))[_0x7941('0x24')](function(_0x4eeb90){var _0xac48e4=_[_0x7941('0x29')](_0x4eeb90,'id');var _0x4e9b65=[];var _0x94524e=[];var _0x23f151=squel['select']();_0x23f151[_0x7941('0x85')]('tq.TeamId')['from'](_0x7941('0x86'),'tq')['join'](_0x7941('0x87'),'ut',_0x7941('0x88'))[_0x7941('0x44')](_0x7941('0x89'),_0x33325f['params']['id']);for(var _0x2c3b22=0x0;_0x2c3b22<_0x4eeb90[_0x7941('0x61')];_0x2c3b22+=0x1){let _0x31d33c=_0x4eeb90[_0x2c3b22];for(var _0x39708e=0x0;_0x39708e<_0x31d33c['Agents'][_0x7941('0x61')];_0x39708e+=0x1){let _0x1e65f2=_0x31d33c[_0x7941('0x6f')][_0x39708e];var _0x5c984f=_0x23f151[_0x7941('0x58')]();_0x5c984f[_0x7941('0x44')](_0x7941('0x8a'),_0x1e65f2['id']);_0x94524e[_0x7941('0x8b')](db['sequelize']['query'](_0x5c984f[_0x7941('0x8c')](),{'type':db[_0x7941('0x76')][_0x7941('0x8d')][_0x7941('0x8e')]})['then'](function(_0x42b17d){if(_0x42b17d[_0x7941('0x61')]===0x1){return _0x1e65f2['id'];}else{var _0x44f7bf=_['every'](_[_0x7941('0x29')](_0x42b17d,_0x7941('0x8f')),function(_0xa650f8){return _[_0x7941('0x2b')](_0xac48e4,_0xa650f8);});if(_0x44f7bf){return _0x1e65f2['id'];}}}));}}return BPromise['all'](_0x94524e)[_0x7941('0x24')](function(_0x35ff43){_0x4e9b65=_(_0x4e9b65)[_0x7941('0x90')](_0x35ff43)[_0x7941('0x91')]()[_0x7941('0x2a')]();return db[_0x7941('0x37')][_0x7941('0x2d')]({'where':{'id':_0x33325f[_0x7941('0x4b')]['id']}})['then'](function(_0x54e5ee){return db[_0x7941('0x76')][_0x7941('0x77')](function(_0x453a45){return _0x54e5ee[_0x7941('0x83')](_0x33325f[_0x7941('0x3b')][_0x7941('0x84')],{'transaction':_0x453a45})[_0x7941('0x24')](function(){if(!_['isEmpty'](_0x4e9b65)){return _0x54e5ee[_0x7941('0x92')](_0x4e9b65,{'transaction':_0x453a45})['then'](function(){return db[_0x7941('0x7c')][_0x7941('0x93')]({'where':{'VoiceQueueId':_0x33325f['params']['id'],'UserId':_0x4e9b65},'transaction':_0x453a45});});}})[_0x7941('0x24')](function(){_0x4e9b65[_0x7941('0x74')](function(_0x230483){socket[_0x7941('0x81')](_0x7941('0x94'),{'UserId':_0x230483,'VoiceQueueId':_0x54e5ee['id']});});});});});});})[_0x7941('0x24')](respondWithStatusCode(_0x48380f,null))[_0x7941('0x4a')](handleError(_0x48380f,null));};exports[_0x7941('0x95')]=function(_0x31afcb,_0x931cf,_0x344018){var _0x13026c,_0x4628b3;return db['VoiceQueue']['find']({'where':{'id':_0x31afcb['params']['id']}})['then'](handleEntityNotFound(_0x931cf,null))[_0x7941('0x24')](function(_0x446955){if(_0x446955){_0x4628b3=_0x446955;return _0x446955[_0x7941('0x95')](_0x31afcb[_0x7941('0x4e')]['ids'],_[_0x7941('0x5a')](_0x31afcb[_0x7941('0x4e')],[_0x7941('0x84'),'id'])||{})['spread'](function(_0x58b991){for(var _0x137df1=0x0;_0x137df1<_0x31afcb['body']['ids'][_0x7941('0x61')];_0x137df1+=0x1){socket['emit'](_0x7941('0x82'),{'UserId':_0x31afcb[_0x7941('0x4e')][_0x7941('0x84')][_0x137df1],'VoiceQueueId':_0x31afcb[_0x7941('0x4b')]['id']});}return _0x58b991;});}})[_0x7941('0x24')](function(_0x268590){_0x13026c=_0x268590||[];if(_0x4628b3){return db['User'][_0x7941('0x48')]({'where':{'id':_0x31afcb['body'][_0x7941('0x84')]},'attributes':['id','name',_0x7941('0x70'),_0x7941('0x71'),_0x7941('0x72')],'raw':!![]});}})['then'](function(_0x81800d){if(!_[_0x7941('0x96')](_0x81800d)){var _0x246379=[];for(var _0x4a4d7e=0x0;_0x4a4d7e<_0x81800d[_0x7941('0x61')];_0x4a4d7e++){if(_0x81800d[_0x4a4d7e]['online']){_0x246379['push'](db[_0x7941('0x7c')][_0x7941('0x7d')]({'membername':_0x81800d[_0x4a4d7e][_0x7941('0x2e')],'UserId':_0x81800d[_0x4a4d7e]['id'],'queue_name':_0x4628b3[_0x7941('0x2e')],'VoiceQueueId':_0x4628b3['id'],'interface':_['isNil'](_0x81800d[_0x4a4d7e][_0x7941('0x72')])?util[_0x7941('0x7f')](_0x7941('0x80'),_0x81800d[_0x4a4d7e][_0x7941('0x2e')]):_0x81800d[_0x4a4d7e][_0x7941('0x72')],'paused':_0x81800d[_0x4a4d7e][_0x7941('0x71')]||![],'penalty':_0x31afcb['body'][_0x7941('0x75')]||0x0}));}}return BPromise['all'](_0x246379);}})[_0x7941('0x24')](function(){return _0x13026c;})[_0x7941('0x24')](respondWithResult(_0x931cf,null))[_0x7941('0x4a')](handleError(_0x931cf,null));};exports[_0x7941('0x92')]=function(_0x570a17,_0x3d8bc1,_0x207d4a){return db[_0x7941('0x37')][_0x7941('0x2d')]({'where':{'id':_0x570a17[_0x7941('0x4b')]['id']}})[_0x7941('0x24')](handleEntityNotFound(_0x3d8bc1,null))[_0x7941('0x24')](function(_0x1091c8){if(_0x1091c8){return _0x1091c8[_0x7941('0x92')](_0x570a17['query']['ids'])[_0x7941('0x24')](function(){if(_['isArray'](_0x570a17[_0x7941('0x3b')][_0x7941('0x84')])){for(var _0x694e2=0x0;_0x694e2<_0x570a17['query'][_0x7941('0x84')][_0x7941('0x61')];_0x694e2+=0x1){socket[_0x7941('0x81')](_0x7941('0x94'),{'UserId':Number(_0x570a17[_0x7941('0x3b')][_0x7941('0x84')][_0x694e2]),'VoiceQueueId':Number(_0x570a17['params']['id'])});}}else{socket[_0x7941('0x81')]('userVoiceQueue:remove',{'UserId':Number(_0x570a17['query'][_0x7941('0x84')]),'VoiceQueueId':Number(_0x570a17['params']['id'])});}});}})[_0x7941('0x24')](function(_0x5e5a3f){return db[_0x7941('0x7c')][_0x7941('0x93')]({'where':{'VoiceQueueId':_0x570a17[_0x7941('0x4b')]['id'],'UserId':_0x570a17[_0x7941('0x3b')][_0x7941('0x84')]}})[_0x7941('0x24')](function(){return _0x5e5a3f;});})[_0x7941('0x24')](respondWithStatusCode(_0x3d8bc1,null))['catch'](handleError(_0x3d8bc1,null));};exports[_0x7941('0x97')]=function(_0x2656f6,_0x53d7b2,_0x6083cf){var _0x3c4e2c={};var _0x4fe901={};var _0x52b86a;var _0x2ac0e0;return db[_0x7941('0x37')]['findOne']({'where':{'id':_0x2656f6[_0x7941('0x4b')]['id']}})[_0x7941('0x24')](handleEntityNotFound(_0x53d7b2,null))[_0x7941('0x24')](function(_0xf8311){if(_0xf8311){_0x52b86a=_0xf8311;_0x4fe901[_0x7941('0x3a')]=_['keys'](db[_0x7941('0x98')]['rawAttributes']);_0x4fe901[_0x7941('0x3b')]=_[_0x7941('0x3c')](_0x2656f6[_0x7941('0x3b')]);_0x4fe901[_0x7941('0x3d')]=_[_0x7941('0x3f')](_0x4fe901['model'],_0x4fe901[_0x7941('0x3b')]);_0x3c4e2c[_0x7941('0x3e')]=_[_0x7941('0x3f')](_0x4fe901[_0x7941('0x3a')],qs[_0x7941('0x40')](_0x2656f6[_0x7941('0x3b')][_0x7941('0x40')]));_0x3c4e2c[_0x7941('0x3e')]=_0x3c4e2c['attributes'][_0x7941('0x61')]?_0x3c4e2c[_0x7941('0x3e')]:_0x4fe901[_0x7941('0x3a')];_0x3c4e2c['order']=qs[_0x7941('0x43')](_0x2656f6[_0x7941('0x3b')]['sort']);_0x3c4e2c['where']=qs[_0x7941('0x3d')](_[_0x7941('0x62')](_0x2656f6['query'],_0x4fe901[_0x7941('0x3d')]));if(_0x2656f6['query'][_0x7941('0x27')]){_0x3c4e2c['where']=_[_0x7941('0x31')](_0x3c4e2c[_0x7941('0x44')],{'$or':_[_0x7941('0x29')](_0x3c4e2c[_0x7941('0x3e')],function(_0xbb34b5){var _0x2aad1c={};_0x2aad1c[_0xbb34b5]={'$like':'%'+_0x2656f6[_0x7941('0x3b')]['filter']+'%'};return _0x2aad1c;})});}_0x3c4e2c=_['merge']({},_0x3c4e2c,_0x2656f6[_0x7941('0x4c')]);return _0x52b86a[_0x7941('0x97')](_0x3c4e2c);}})['then'](function(_0x1a745b){if(_0x1a745b){_0x2ac0e0=_0x1a745b[_0x7941('0x61')];if(!_0x2656f6[_0x7941('0x3b')]['hasOwnProperty'](_0x7941('0x42'))){_0x3c4e2c['limit']=qs[_0x7941('0x20')](_0x2656f6[_0x7941('0x3b')][_0x7941('0x20')]);_0x3c4e2c[_0x7941('0x1d')]=qs[_0x7941('0x1d')](_0x2656f6[_0x7941('0x3b')]['offset']);}return _0x52b86a[_0x7941('0x97')](_0x3c4e2c);}})[_0x7941('0x24')](function(_0x3b3e63){if(_0x3b3e63){return _0x3b3e63?{'count':_0x2ac0e0,'rows':_0x3b3e63}:null;}})['then'](respondWithResult(_0x53d7b2,null))[_0x7941('0x4a')](handleError(_0x53d7b2,null));};exports['getMembers']=function(_0x5485df,_0x4e1157,_0x4f1ec5){var _0x214486={};var _0xfcd670={};var _0x55d04f;var _0x3b7412;return db[_0x7941('0x37')][_0x7941('0x65')]({'where':{'id':_0x5485df[_0x7941('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4e1157,null))[_0x7941('0x24')](function(_0x47b776){if(_0x47b776){_0x55d04f=_0x47b776;_0xfcd670[_0x7941('0x3a')]=_[_0x7941('0x3c')](db[_0x7941('0x7c')][_0x7941('0x38')]);_0xfcd670['query']=_[_0x7941('0x3c')](_0x5485df[_0x7941('0x3b')]);_0xfcd670['filters']=_[_0x7941('0x3f')](_0xfcd670[_0x7941('0x3a')],_0xfcd670['query']);_0x214486[_0x7941('0x3e')]=_['intersection'](_0xfcd670[_0x7941('0x3a')],qs['fields'](_0x5485df[_0x7941('0x3b')][_0x7941('0x40')]));_0x214486[_0x7941('0x3e')]=_0x214486[_0x7941('0x3e')][_0x7941('0x61')]?_0x214486[_0x7941('0x3e')]:_0xfcd670['model'];_0x214486[_0x7941('0x67')]=qs['sort'](_0x5485df[_0x7941('0x3b')][_0x7941('0x43')]);_0x214486['where']=qs[_0x7941('0x3d')](_[_0x7941('0x62')](_0x5485df[_0x7941('0x3b')],_0xfcd670[_0x7941('0x3d')]));if(_0x5485df[_0x7941('0x3b')]['filter']){_0x214486[_0x7941('0x44')]=_['merge'](_0x214486[_0x7941('0x44')],{'$or':_[_0x7941('0x29')](_0x214486[_0x7941('0x3e')],function(_0x1456e6){var _0x40be38={};_0x40be38[_0x1456e6]={'$like':'%'+_0x5485df[_0x7941('0x3b')][_0x7941('0x27')]+'%'};return _0x40be38;})});}_0x214486=_['merge']({},_0x214486,_0x5485df[_0x7941('0x4c')]);return _0x55d04f[_0x7941('0x99')](_0x214486);}})[_0x7941('0x24')](function(_0x3e7302){if(_0x3e7302){_0x3b7412=_0x3e7302[_0x7941('0x61')];if(!_0x5485df[_0x7941('0x3b')][_0x7941('0x41')](_0x7941('0x42'))){_0x214486[_0x7941('0x20')]=qs[_0x7941('0x20')](_0x5485df[_0x7941('0x3b')][_0x7941('0x20')]);_0x214486['offset']=qs['offset'](_0x5485df[_0x7941('0x3b')][_0x7941('0x1d')]);}return _0x55d04f[_0x7941('0x99')](_0x214486);}})[_0x7941('0x24')](function(_0x5f35e3){return _0x5f35e3?{'count':_0x3b7412,'rows':_0x5f35e3}:null;})[_0x7941('0x24')](respondWithResult(_0x4e1157,null))['catch'](handleError(_0x4e1157,null));};exports[_0x7941('0x9a')]=function(_0x3ea8ef,_0x407ef2,_0x45f234){var _0x3903ac={};var _0x2da219={};var _0x279d84;var _0x4ac028;return db[_0x7941('0x37')]['findOne']({'where':{'id':_0x3ea8ef['params']['id']}})[_0x7941('0x24')](handleEntityNotFound(_0x407ef2,null))['then'](function(_0xe76727){if(_0xe76727){_0x279d84=_0xe76727;_0x2da219[_0x7941('0x3a')]=_[_0x7941('0x3c')](db['CmList'][_0x7941('0x38')]);_0x2da219[_0x7941('0x3b')]=_[_0x7941('0x3c')](_0x3ea8ef[_0x7941('0x3b')]);_0x2da219[_0x7941('0x3d')]=_[_0x7941('0x3f')](_0x2da219['model'],_0x2da219[_0x7941('0x3b')]);_0x3903ac[_0x7941('0x3e')]=_[_0x7941('0x3f')](_0x2da219['model'],qs[_0x7941('0x40')](_0x3ea8ef['query']['fields']));_0x3903ac[_0x7941('0x3e')]=_0x3903ac['attributes']['length']?_0x3903ac[_0x7941('0x3e')]:_0x2da219[_0x7941('0x3a')];_0x3903ac[_0x7941('0x67')]=qs[_0x7941('0x43')](_0x3ea8ef[_0x7941('0x3b')][_0x7941('0x43')]);_0x3903ac['where']=qs[_0x7941('0x3d')](_['pick'](_0x3ea8ef[_0x7941('0x3b')],_0x2da219[_0x7941('0x3d')]));if(_0x3ea8ef['query'][_0x7941('0x27')]){_0x3903ac['where']=_[_0x7941('0x31')](_0x3903ac['where'],{'$or':_[_0x7941('0x29')](_0x3903ac[_0x7941('0x3e')],function(_0x12726a){var _0x4f0872={};_0x4f0872[_0x12726a]={'$like':'%'+_0x3ea8ef[_0x7941('0x3b')]['filter']+'%'};return _0x4f0872;})});}_0x3903ac=_['merge']({},_0x3903ac,_0x3ea8ef[_0x7941('0x4c')]);return _0x279d84['getLists'](_0x3903ac);}})[_0x7941('0x24')](function(_0x635d0c){if(_0x635d0c){_0x4ac028=_0x635d0c[_0x7941('0x61')];if(!_0x3ea8ef['query'][_0x7941('0x41')](_0x7941('0x42'))){_0x3903ac[_0x7941('0x20')]=qs[_0x7941('0x20')](_0x3ea8ef[_0x7941('0x3b')][_0x7941('0x20')]);_0x3903ac[_0x7941('0x1d')]=qs[_0x7941('0x1d')](_0x3ea8ef['query'][_0x7941('0x1d')]);}return _0x279d84['getLists'](_0x3903ac);}})[_0x7941('0x24')](function(_0x3d3dca){if(_0x3d3dca){return _0x3d3dca?{'count':_0x4ac028,'rows':_0x3d3dca}:null;}})[_0x7941('0x24')](respondWithResult(_0x407ef2,null))[_0x7941('0x4a')](handleError(_0x407ef2,null));};exports[_0x7941('0x9b')]=function(_0x1f008d,_0xbd28e7,_0x1d3d3c){var _0x72a63c,_0x51e23b;return db[_0x7941('0x37')][_0x7941('0x2d')]({'where':{'id':_0x1f008d[_0x7941('0x4b')]['id']}})[_0x7941('0x24')](handleEntityNotFound(_0xbd28e7,null))[_0x7941('0x24')](function(_0x480f7e){if(_0x480f7e){_0x51e23b=_0x480f7e;return _0x480f7e['addLists'](_0x1f008d[_0x7941('0x4e')][_0x7941('0x84')],_[_0x7941('0x5a')](_0x1f008d['body'],['ids','id'])||{});}return null;})['spread'](function(_0x9c13d8){var _0x1400cd;_0x72a63c=_0x9c13d8||[];var _0x15f6d8=[];if(_0x9c13d8){for(var _0x53d794=0x0;_0x53d794<_0x9c13d8[_0x7941('0x61')];_0x53d794+=0x1){var _0x32ffa1=_0x9c13d8[_0x53d794][_0x7941('0x52')]({'plain':!![]});_0x51e23b[_0x7941('0x9c')]=_0x1f008d[_0x7941('0x4e')][_0x7941('0x9c')]?_0x1f008d[_0x7941('0x4e')][_0x7941('0x9c')]:_0x51e23b[_0x7941('0x9c')];switch(_0x51e23b[_0x7941('0x9c')]){case _0x7941('0x9d'):_0x1400cd=squel[_0x7941('0x9e')]()['into'](_0x7941('0x9f'))[_0x7941('0xa0')]([_0x7941('0xa1'),_0x7941('0xa2'),'ContactId',_0x7941('0xa3'),_0x7941('0x63'),'createdAt',_0x7941('0x59')],squel[_0x7941('0xa4')]()[_0x7941('0x85')]('phone',_0x7941('0xa1'))['field'](_0x7941('0xa5'),_0x7941('0xa2'))[_0x7941('0x85')]('id',_0x7941('0xa6'))['field'](_0x32ffa1[_0x7941('0xa7')]['toString'](),_0x7941('0xa3'))['field'](_0x1f008d[_0x7941('0x4b')]['id']['toString'](),_0x7941('0x63'))[_0x7941('0x85')](_0x7941('0xa5'),_0x7941('0xa8'))[_0x7941('0x85')](_0x7941('0xa5'),_0x7941('0x59'))[_0x7941('0xa9')](_0x7941('0xaa'))[_0x7941('0x44')](_0x7941('0xab'))[_0x7941('0x44')](_0x7941('0xac'),_0x32ffa1[_0x7941('0xa7')][_0x7941('0x8c')]())[_0x7941('0x44')](_0x7941('0xad'))[_0x7941('0x44')](_0x7941('0xae'),squel[_0x7941('0xa4')]()[_0x7941('0x85')](_0x7941('0xaf'))['from'](_0x7941('0xb0'))['where'](_0x7941('0x89'),_0x1f008d['params']['id'][_0x7941('0x8c')]()))['where'](_0x7941('0xae'),squel[_0x7941('0xa4')]()[_0x7941('0x85')](_0x7941('0xb1'))['from'](_0x7941('0x9f'))[_0x7941('0x44')](_0x7941('0x89'),_0x1f008d[_0x7941('0x4b')]['id'][_0x7941('0x8c')]())))[_0x7941('0x8c')]();break;case'onlyIfOpen':_0x1400cd=squel[_0x7941('0x9e')]()[_0x7941('0xb2')](_0x7941('0x9f'))[_0x7941('0xa0')]([_0x7941('0xa1'),_0x7941('0xa2'),_0x7941('0xa6'),_0x7941('0xa3'),_0x7941('0x63'),_0x7941('0xa8'),_0x7941('0x59')],squel[_0x7941('0xa4')]()[_0x7941('0x85')](_0x7941('0xa1'),_0x7941('0xa1'))[_0x7941('0x85')](_0x7941('0xa5'),_0x7941('0xa2'))[_0x7941('0x85')]('id',_0x7941('0xa6'))[_0x7941('0x85')](_0x32ffa1[_0x7941('0xa7')]['toString'](),_0x7941('0xa3'))[_0x7941('0x85')](_0x1f008d['params']['id'][_0x7941('0x8c')](),'VoiceQueueId')[_0x7941('0x85')](_0x7941('0xa5'),_0x7941('0xa8'))[_0x7941('0x85')]('NOW()',_0x7941('0x59'))[_0x7941('0xa9')](_0x7941('0xaa'))[_0x7941('0x44')]('deletedAt\x20IS\x20NULL')[_0x7941('0x44')]('ListId\x20=\x20?',_0x32ffa1[_0x7941('0xa7')][_0x7941('0x8c')]())[_0x7941('0x44')](_0x7941('0xad'))[_0x7941('0x44')](_0x7941('0xae'),squel[_0x7941('0xa4')]()[_0x7941('0x85')]('COALESCE(phone,\x27\x27)')[_0x7941('0xa9')](_0x7941('0x9f'))['where'](_0x7941('0x89'),_0x1f008d[_0x7941('0x4b')]['id']['toString']())))[_0x7941('0x8c')]();break;default:_0x1400cd=squel[_0x7941('0x9e')]()['into'](_0x7941('0x9f'))[_0x7941('0xa0')]([_0x7941('0xa1'),_0x7941('0xa2'),'ContactId',_0x7941('0xa3'),_0x7941('0x63'),'createdAt',_0x7941('0x59')],squel[_0x7941('0xa4')]()['field'](_0x7941('0xa1'),_0x7941('0xa1'))[_0x7941('0x85')](_0x7941('0xa5'),'scheduledAt')[_0x7941('0x85')]('id',_0x7941('0xa6'))[_0x7941('0x85')](_0x32ffa1[_0x7941('0xa7')]['toString'](),_0x7941('0xa3'))[_0x7941('0x85')](_0x1f008d[_0x7941('0x4b')]['id'][_0x7941('0x8c')](),_0x7941('0x63'))[_0x7941('0x85')](_0x7941('0xa5'),_0x7941('0xa8'))[_0x7941('0x85')](_0x7941('0xa5'),_0x7941('0x59'))[_0x7941('0xa9')](_0x7941('0xaa'))['where'](_0x7941('0xab'))['where'](_0x7941('0xac'),_0x32ffa1[_0x7941('0xa7')][_0x7941('0x8c')]())['where'](_0x7941('0xad')))[_0x7941('0x8c')]();}_0x15f6d8[_0x7941('0x8b')](db[_0x7941('0x76')][_0x7941('0x3b')](_0x1400cd));}return BPromise[_0x7941('0xb3')](_0x15f6d8);}})[_0x7941('0x24')](function(){return _0x72a63c;})[_0x7941('0x24')](respondWithResult(_0xbd28e7,null))['catch'](handleError(_0xbd28e7,null));};exports[_0x7941('0xb4')]=function(_0x401efc,_0x316f40,_0x28f522){return db['VoiceQueue'][_0x7941('0x2d')]({'where':{'id':_0x401efc[_0x7941('0x4b')]['id']}})['then'](handleEntityNotFound(_0x316f40,null))[_0x7941('0x24')](function(_0x1f6308){if(_0x1f6308){return _0x1f6308[_0x7941('0xb4')](_0x401efc[_0x7941('0x3b')][_0x7941('0x84')]);}})[_0x7941('0x24')](function(_0x4b688d){if(_0x4b688d){return db[_0x7941('0x60')]['destroy']({'where':{'ListId':_0x401efc[_0x7941('0x3b')][_0x7941('0x84')],'VoiceQueueId':_0x401efc[_0x7941('0x4b')]['id']}})['then'](function(){return _0x4b688d;});}})[_0x7941('0x24')](respondWithStatusCode(_0x316f40,null))[_0x7941('0x4a')](handleError(_0x316f40,null));};exports[_0x7941('0xb5')]=function(_0x5d070f,_0x33b591,_0x1eda09){var _0x50aef2={};var _0x4dc342={};var _0x4c2658;var _0x2d0ca2;return db['VoiceQueue'][_0x7941('0x65')]({'where':{'id':_0x5d070f['params']['id']}})[_0x7941('0x24')](handleEntityNotFound(_0x33b591,null))[_0x7941('0x24')](function(_0x433ba1){if(_0x433ba1){_0x4c2658=_0x433ba1;_0x4dc342[_0x7941('0x3a')]=_[_0x7941('0x3c')](db[_0x7941('0xb6')][_0x7941('0x38')]);_0x4dc342[_0x7941('0x3b')]=_[_0x7941('0x3c')](_0x5d070f[_0x7941('0x3b')]);_0x4dc342['filters']=_['intersection'](_0x4dc342['model'],_0x4dc342[_0x7941('0x3b')]);_0x50aef2[_0x7941('0x3e')]=_[_0x7941('0x3f')](_0x4dc342[_0x7941('0x3a')],qs[_0x7941('0x40')](_0x5d070f[_0x7941('0x3b')]['fields']));_0x50aef2['attributes']=_0x50aef2[_0x7941('0x3e')][_0x7941('0x61')]?_0x50aef2[_0x7941('0x3e')]:_0x4dc342[_0x7941('0x3a')];_0x50aef2[_0x7941('0x67')]=qs[_0x7941('0x43')](_0x5d070f[_0x7941('0x3b')][_0x7941('0x43')]);_0x50aef2[_0x7941('0x44')]=qs[_0x7941('0x3d')](_[_0x7941('0x62')](_0x5d070f['query'],_0x4dc342[_0x7941('0x3d')]));if(_0x5d070f['query'][_0x7941('0x27')]){_0x50aef2[_0x7941('0x44')]=_['merge'](_0x50aef2[_0x7941('0x44')],{'$or':_[_0x7941('0x29')](_0x50aef2[_0x7941('0x3e')],function(_0x197731){var _0x3ba7d2={};_0x3ba7d2[_0x197731]={'$like':'%'+_0x5d070f[_0x7941('0x3b')][_0x7941('0x27')]+'%'};return _0x3ba7d2;})});}_0x50aef2=_[_0x7941('0x31')]({},_0x50aef2,_0x5d070f['options']);return _0x4c2658[_0x7941('0xb5')](_0x50aef2);}})[_0x7941('0x24')](function(_0x3fe170){if(_0x3fe170){_0x2d0ca2=_0x3fe170[_0x7941('0x61')];if(!_0x5d070f['query'][_0x7941('0x41')](_0x7941('0x42'))){_0x50aef2[_0x7941('0x20')]=qs[_0x7941('0x20')](_0x5d070f[_0x7941('0x3b')][_0x7941('0x20')]);_0x50aef2[_0x7941('0x1d')]=qs[_0x7941('0x1d')](_0x5d070f[_0x7941('0x3b')][_0x7941('0x1d')]);}return _0x4c2658[_0x7941('0xb5')](_0x50aef2);}})['then'](function(_0x437cae){if(_0x437cae){return _0x437cae?{'count':_0x2d0ca2,'rows':_0x437cae}:null;}})[_0x7941('0x24')](respondWithResult(_0x33b591,null))['catch'](handleError(_0x33b591,null));};exports[_0x7941('0xb7')]=function(_0x21881c,_0x1f9eb8,_0x56ed3b){var _0x4995e0,_0x174dcb;return db[_0x7941('0x37')]['find']({'where':{'id':_0x21881c[_0x7941('0x4b')]['id']}})[_0x7941('0x24')](handleEntityNotFound(_0x1f9eb8,null))[_0x7941('0x24')](function(_0x31210e){if(_0x31210e){_0x174dcb=_0x31210e;return _0x31210e[_0x7941('0xb7')](_0x21881c[_0x7941('0x4e')][_0x7941('0x84')],_['omit'](_0x21881c['body'],['ids','id'])||{});}return null;})['spread'](function(_0x16ef4f){var _0x2f27e4;_0x4995e0=_0x16ef4f||[];var _0xfa2caa=[];if(_0x16ef4f){for(var _0x3d82e8=0x0;_0x3d82e8<_0x16ef4f['length'];_0x3d82e8+=0x1){var _0x29db5b=_0x16ef4f[_0x3d82e8][_0x7941('0x52')]({'plain':!![]});_0x2f27e4=squel[_0x7941('0x9e')]()[_0x7941('0xb2')](_0x7941('0xb8'))[_0x7941('0xa0')]([_0x7941('0xa1'),_0x7941('0xa6'),_0x7941('0xa3'),_0x7941('0x63'),_0x7941('0xa8'),_0x7941('0x59')],squel[_0x7941('0xa4')]()[_0x7941('0x85')](_0x7941('0xa1'),_0x7941('0xa1'))[_0x7941('0x85')]('id','ContactId')[_0x7941('0x85')](_0x29db5b[_0x7941('0xa7')][_0x7941('0x8c')](),_0x7941('0xa3'))[_0x7941('0x85')](_0x21881c[_0x7941('0x4b')]['id']['toString'](),'VoiceQueueId')[_0x7941('0x85')]('NOW()',_0x7941('0xa8'))[_0x7941('0x85')](_0x7941('0xa5'),_0x7941('0x59'))[_0x7941('0xa9')](_0x7941('0xaa'))['where'](_0x7941('0xab'))[_0x7941('0x44')]('ListId\x20=\x20?',_0x29db5b['CmListId']['toString']())[_0x7941('0x44')](_0x7941('0xad')))[_0x7941('0x8c')]();_0xfa2caa[_0x7941('0x8b')](db[_0x7941('0x76')][_0x7941('0x3b')](_0x2f27e4));}return BPromise[_0x7941('0xb3')](_0xfa2caa);}})['then'](function(){return _0x4995e0;})['then'](respondWithResult(_0x1f9eb8,null))['catch'](handleError(_0x1f9eb8,null));};exports[_0x7941('0xb9')]=function(_0x3808b7,_0x4b44ab,_0x336000){return db[_0x7941('0x37')][_0x7941('0x2d')]({'where':{'id':_0x3808b7[_0x7941('0x4b')]['id']}})[_0x7941('0x24')](handleEntityNotFound(_0x4b44ab,null))['then'](function(_0x2e07d8){if(_0x2e07d8){return _0x2e07d8[_0x7941('0xb9')](_0x3808b7['query']['ids']);}})[_0x7941('0x24')](function(_0xb11269){if(_0xb11269){return db['CmHopperBlack'][_0x7941('0x93')]({'where':{'ListId':_0x3808b7[_0x7941('0x3b')]['ids'],'VoiceQueueId':_0x3808b7[_0x7941('0x4b')]['id']}})['then'](function(){return _0xb11269;});}})['then'](respondWithStatusCode(_0x4b44ab,null))[_0x7941('0x4a')](handleError(_0x4b44ab,null));}; \ No newline at end of file +var _0xd210=['hasOwnProperty','nolimit','order','sort','where','pick','includeAll','findAll','show','params','include','options','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','VoiceQueues','outbound','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','getHoppers','findOne','CmHopper','rows','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','union','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','push','all','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','phone\x20IS\x20NOT\x20NULL','into','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','./voiceQueue.socket','register','status','end','json','offset','limit','undefined','count','apply','save','update','then','destroy','get','inbound','QueueCampaigns','filter','ignore','map','value','includes','type','find','name','sendStatus','error','send','render','merge','body','contact','message','agent','interaction','account','index','VoiceQueue','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x26e206,_0x5e90cf){var _0x1b7024=function(_0x25b8bd){while(--_0x25b8bd){_0x26e206['push'](_0x26e206['shift']());}};_0x1b7024(++_0x5e90cf);}(_0xd210,0x125));var _0x0d21=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xd210[_0x1deb03];return _0x189fe7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d21('0x0'));var zipdir=require(_0x0d21('0x1'));var jsonpatch=require(_0x0d21('0x2'));var rp=require(_0x0d21('0x3'));var moment=require(_0x0d21('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0d21('0x5'));var util=require(_0x0d21('0x6'));var path=require('path');var sox=require(_0x0d21('0x7'));var csv=require(_0x0d21('0x8'));var ejs=require(_0x0d21('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0d21('0xa'));var deskjs=require(_0x0d21('0xb'));var toCsv=require(_0x0d21('0x8'));var querystring=require(_0x0d21('0xc'));var Papa=require(_0x0d21('0xd'));var Redis=require(_0x0d21('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0d21('0xf'));var as=require(_0x0d21('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d21('0x11'))(_0x0d21('0x12'));var utils=require('../../config/utils');var config=require(_0x0d21('0x13'));var licenseUtil=require(_0x0d21('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0d21('0x15')](config[_0x0d21('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d21('0x16')]));require(_0x0d21('0x17'))[_0x0d21('0x18')](socket);function respondWithStatusCode(_0x5bb9ee,_0x3e6b99){_0x3e6b99=_0x3e6b99||0xcc;return function(_0xb7e11b){if(_0xb7e11b){return _0x5bb9ee['sendStatus'](_0x3e6b99);}return _0x5bb9ee[_0x0d21('0x19')](_0x3e6b99)[_0x0d21('0x1a')]();};}function respondWithResult(_0x353a7e,_0x429ba8){_0x429ba8=_0x429ba8||0xc8;return function(_0x398770){if(_0x398770){return _0x353a7e[_0x0d21('0x19')](_0x429ba8)[_0x0d21('0x1b')](_0x398770);}};}function respondWithFilteredResult(_0x1f5506,_0x2e7c31){return function(_0x9dfe35){if(_0x9dfe35){var _0x440860=typeof _0x2e7c31[_0x0d21('0x1c')]==='undefined'&&typeof _0x2e7c31[_0x0d21('0x1d')]===_0x0d21('0x1e');var _0x255bef=_0x9dfe35['count'];var _0x20af42=_0x440860?0x0:_0x2e7c31[_0x0d21('0x1c')];var _0xaf1952=_0x440860?_0x9dfe35[_0x0d21('0x1f')]:_0x2e7c31['offset']+_0x2e7c31[_0x0d21('0x1d')];var _0x421eb4;if(_0xaf1952>=_0x255bef){_0xaf1952=_0x255bef;_0x421eb4=0xc8;}else{_0x421eb4=0xce;}_0x1f5506['status'](_0x421eb4);return _0x1f5506['set']('Content-Range',_0x20af42+'-'+_0xaf1952+'/'+_0x255bef)[_0x0d21('0x1b')](_0x9dfe35);}return null;};}function patchUpdates(_0x2cff66){return function(_0x2da3ac){try{jsonpatch[_0x0d21('0x20')](_0x2da3ac,_0x2cff66,!![]);}catch(_0x2e3420){return BPromise['reject'](_0x2e3420);}return _0x2da3ac[_0x0d21('0x21')]();};}function saveUpdates(_0xa3811,_0x21b725){return function(_0xde0569){if(_0xde0569){return _0xde0569[_0x0d21('0x22')](_0xa3811)[_0x0d21('0x23')](function(_0x5be243){return _0x5be243;});}return null;};}function removeEntity(_0x5a504d,_0x39d1c7){return function(_0x4934c4){if(_0x4934c4){return _0x4934c4[_0x0d21('0x24')]()[_0x0d21('0x23')](function(){var _0x2408d8=_0x4934c4[_0x0d21('0x25')]({'plain':!![]});var _0x47235a=[{'name':'VoiceQueues','value':_0x0d21('0x26'),'ignore':![]},{'name':_0x0d21('0x27'),'value':'outbound','ignore':![]}];var _0xf31718=_(_0x47235a)[_0x0d21('0x28')](_0x0d21('0x29'))[_0x0d21('0x2a')]('value')[_0x0d21('0x2b')]();if(_[_0x0d21('0x2c')](_0xf31718,_0x2408d8[_0x0d21('0x2d')])){return;}var _0x145cb4=_[_0x0d21('0x2e')](_0x47235a,[_0x0d21('0x2b'),_0x2408d8[_0x0d21('0x2d')]])[_0x0d21('0x2f')];return db['UserProfileResource'][_0x0d21('0x24')]({'where':{'type':_0x145cb4,'resourceId':_0x2408d8['id']}})[_0x0d21('0x23')](function(){return _0x4934c4;});})[_0x0d21('0x23')](function(){_0x5a504d[_0x0d21('0x19')](0xcc)[_0x0d21('0x1a')]();});}};}function handleEntityNotFound(_0x4f5cf7,_0x5d0bbc){return function(_0x30c371){if(!_0x30c371){_0x4f5cf7[_0x0d21('0x30')](0x194);}return _0x30c371;};}function handleError(_0x10beb6,_0x2157bd){_0x2157bd=_0x2157bd||0x1f4;return function(_0x28c5d2){logger[_0x0d21('0x31')](_0x28c5d2['stack']);if(_0x28c5d2[_0x0d21('0x2f')]){delete _0x28c5d2[_0x0d21('0x2f')];}_0x10beb6[_0x0d21('0x19')](_0x2157bd)[_0x0d21('0x32')](_0x28c5d2);};}function getMustacheRender(_0x95a0c5,_0x330ac4){return Mustache[_0x0d21('0x33')](_0x95a0c5,_[_0x0d21('0x34')](_0x330ac4[_0x0d21('0x35')],{'contact':_0x330ac4[_0x0d21('0x36')],'message':_0x330ac4[_0x0d21('0x37')],'agent':_0x330ac4[_0x0d21('0x38')],'interaction':_0x330ac4[_0x0d21('0x39')],'account':_0x330ac4[_0x0d21('0x3a')]}))||'';}exports[_0x0d21('0x3b')]=function(_0x234f49,_0x747dc4){var _0x5a0cae={},_0x1c59db={},_0x2642b8={'count':0x0,'rows':[]};var _0x4e401c=_[_0x0d21('0x2a')](db[_0x0d21('0x3c')][_0x0d21('0x3d')],function(_0x356f2a){return{'name':_0x356f2a['fieldName'],'type':_0x356f2a[_0x0d21('0x2d')][_0x0d21('0x3e')]};});_0x1c59db[_0x0d21('0x3f')]=_[_0x0d21('0x2a')](_0x4e401c,_0x0d21('0x2f'));_0x1c59db['query']=_[_0x0d21('0x40')](_0x234f49[_0x0d21('0x41')]);_0x1c59db[_0x0d21('0x42')]=_[_0x0d21('0x43')](_0x1c59db[_0x0d21('0x3f')],_0x1c59db[_0x0d21('0x41')]);_0x5a0cae[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x1c59db['model'],qs['fields'](_0x234f49[_0x0d21('0x41')][_0x0d21('0x45')]));_0x5a0cae['attributes']=_0x5a0cae[_0x0d21('0x44')][_0x0d21('0x46')]?_0x5a0cae[_0x0d21('0x44')]:_0x1c59db[_0x0d21('0x3f')];if(!_0x234f49['query'][_0x0d21('0x47')](_0x0d21('0x48'))){_0x5a0cae[_0x0d21('0x1d')]=qs[_0x0d21('0x1d')](_0x234f49[_0x0d21('0x41')]['limit']);_0x5a0cae[_0x0d21('0x1c')]=qs[_0x0d21('0x1c')](_0x234f49[_0x0d21('0x41')][_0x0d21('0x1c')]);}_0x5a0cae[_0x0d21('0x49')]=qs[_0x0d21('0x4a')](_0x234f49[_0x0d21('0x41')][_0x0d21('0x4a')]);_0x5a0cae[_0x0d21('0x4b')]=qs[_0x0d21('0x42')](_[_0x0d21('0x4c')](_0x234f49[_0x0d21('0x41')],_0x1c59db[_0x0d21('0x42')]),_0x4e401c);if(_0x234f49['query'][_0x0d21('0x28')]){_0x5a0cae[_0x0d21('0x4b')]=_[_0x0d21('0x34')](_0x5a0cae[_0x0d21('0x4b')],{'$or':_[_0x0d21('0x2a')](_0x4e401c,function(_0x103d0e){if(_0x103d0e[_0x0d21('0x2d')]!=='VIRTUAL'){var _0x2c78f5={};_0x2c78f5[_0x103d0e[_0x0d21('0x2f')]]={'$like':'%'+_0x234f49[_0x0d21('0x41')][_0x0d21('0x28')]+'%'};return _0x2c78f5;}})});}_0x5a0cae=_['merge']({},_0x5a0cae,_0x234f49['options']);var _0x2e894e={'where':_0x5a0cae['where']};return db[_0x0d21('0x3c')][_0x0d21('0x1f')](_0x2e894e)[_0x0d21('0x23')](function(_0x51d6a9){_0x2642b8['count']=_0x51d6a9;if(_0x234f49[_0x0d21('0x41')][_0x0d21('0x4d')]){_0x5a0cae['include']=[{'all':!![]}];}return db['VoiceQueue'][_0x0d21('0x4e')](_0x5a0cae);})[_0x0d21('0x23')](function(_0x4be18a){_0x2642b8['rows']=_0x4be18a;return _0x2642b8;})['then'](respondWithFilteredResult(_0x747dc4,_0x5a0cae))['catch'](handleError(_0x747dc4,null));};exports[_0x0d21('0x4f')]=function(_0x380077,_0x383ea0){var _0x49141e={'raw':![],'where':{'id':_0x380077[_0x0d21('0x50')]['id']}},_0x580a28={};_0x580a28[_0x0d21('0x3f')]=_[_0x0d21('0x40')](db[_0x0d21('0x3c')][_0x0d21('0x3d')]);_0x580a28[_0x0d21('0x41')]=_[_0x0d21('0x40')](_0x380077[_0x0d21('0x41')]);_0x580a28[_0x0d21('0x42')]=_[_0x0d21('0x43')](_0x580a28['model'],_0x580a28['query']);_0x49141e['attributes']=_[_0x0d21('0x43')](_0x580a28['model'],qs[_0x0d21('0x45')](_0x380077[_0x0d21('0x41')][_0x0d21('0x45')]));_0x49141e[_0x0d21('0x44')]=_0x49141e[_0x0d21('0x44')]['length']?_0x49141e[_0x0d21('0x44')]:_0x580a28['model'];if(_0x380077[_0x0d21('0x41')][_0x0d21('0x4d')]){_0x49141e[_0x0d21('0x51')]=[{'all':!![]}];}_0x49141e=_[_0x0d21('0x34')]({},_0x49141e,_0x380077[_0x0d21('0x52')]);return db[_0x0d21('0x3c')][_0x0d21('0x2e')](_0x49141e)['then'](handleEntityNotFound(_0x383ea0,null))['then'](respondWithResult(_0x383ea0,null))[_0x0d21('0x53')](handleError(_0x383ea0,null));};exports[_0x0d21('0x54')]=function(_0x1bae1d,_0x5d6a6a){return db[_0x0d21('0x3c')]['create'](_0x1bae1d[_0x0d21('0x35')],{})[_0x0d21('0x23')](function(_0x4898d0){var _0x250a30=_0x1bae1d['user'][_0x0d21('0x25')]({'plain':!![]});if(!_0x250a30)throw new Error(_0x0d21('0x55'));if(_0x250a30[_0x0d21('0x56')]===_0x0d21('0x57')){var _0x5bcb0f=_0x4898d0[_0x0d21('0x25')]({'plain':!![]});var _0x1701a8=[{'name':_0x0d21('0x58'),'value':_0x0d21('0x26')},{'name':_0x0d21('0x27'),'value':_0x0d21('0x59')}];var _0x63af99=_['find'](_0x1701a8,[_0x0d21('0x2b'),_0x5bcb0f[_0x0d21('0x2d')]])[_0x0d21('0x2f')];return db[_0x0d21('0x5a')][_0x0d21('0x2e')]({'where':{'name':_0x63af99,'userProfileId':_0x250a30['userProfileId']},'raw':!![]})['then'](function(_0x19a14a){if(_0x19a14a&&_0x19a14a[_0x0d21('0x5b')]===0x0){return db[_0x0d21('0x5c')][_0x0d21('0x54')]({'name':_0x5bcb0f['name'],'resourceId':_0x5bcb0f['id'],'type':_0x19a14a['name'],'sectionId':_0x19a14a['id']},{})[_0x0d21('0x23')](function(){return _0x4898d0;});}else{return _0x4898d0;}})[_0x0d21('0x53')](function(_0x41f37e){logger[_0x0d21('0x31')](_0x0d21('0x5d'),_0x41f37e);throw _0x41f37e;});}return _0x4898d0;})[_0x0d21('0x23')](respondWithResult(_0x5d6a6a,0xc9))[_0x0d21('0x53')](handleError(_0x5d6a6a,null));};exports[_0x0d21('0x5e')]=function(_0x27d25a,_0x4b533e){var _0x112c49={'where':{'id':_0x27d25a['params']['id']}},_0x44039b={};_0x44039b[_0x0d21('0x3f')]=_[_0x0d21('0x40')](db[_0x0d21('0x3c')][_0x0d21('0x3d')]);_0x112c49[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x44039b['model'],qs[_0x0d21('0x45')](_0x27d25a['query'][_0x0d21('0x45')]));_0x112c49['attributes']=_0x112c49[_0x0d21('0x44')][_0x0d21('0x46')]?_0x112c49[_0x0d21('0x44')]:_0x44039b[_0x0d21('0x3f')];if(_0x27d25a[_0x0d21('0x41')]['includeAll']){_0x112c49[_0x0d21('0x51')]=[{'all':!![]}];}_0x112c49=_['merge']({},_0x112c49,_0x27d25a['options']);return db[_0x0d21('0x3c')][_0x0d21('0x2e')](_0x112c49)[_0x0d21('0x23')](handleEntityNotFound(_0x4b533e,null))[_0x0d21('0x23')](function(_0x47b53c){if(_0x47b53c){var _0x36d309=_0x47b53c['get']({'plain':!![]});_0x36d309=qs['omit'](_0x36d309,['id',_0x0d21('0x5f'),_0x0d21('0x60')]);_0x27d25a['body']=_[_0x0d21('0x61')](_0x27d25a[_0x0d21('0x35')],['id','createdAt',_0x0d21('0x60')]);return db[_0x0d21('0x3c')][_0x0d21('0x54')](_['merge'](_0x36d309,_0x27d25a[_0x0d21('0x35')]),{'include':_0x27d25a[_0x0d21('0x41')][_0x0d21('0x4d')]?[{'all':!![]}]:undefined})[_0x0d21('0x23')](function(_0x2a703d){var _0x25fee7=_0x27d25a[_0x0d21('0x57')][_0x0d21('0x25')]({'plain':!![]});if(!_0x25fee7)throw new Error(_0x0d21('0x55'));if(_0x25fee7[_0x0d21('0x56')]===_0x0d21('0x57')){var _0x1b0cd0=_0x2a703d[_0x0d21('0x25')]({'plain':!![]});var _0x508bfc=[{'name':_0x0d21('0x58'),'value':_0x0d21('0x26')},{'name':'QueueCampaigns','value':_0x0d21('0x59')}];var _0x1ffc68=_[_0x0d21('0x2e')](_0x508bfc,[_0x0d21('0x2b'),_0x1b0cd0['type']])['name'];return db[_0x0d21('0x5a')][_0x0d21('0x2e')]({'where':{'name':_0x1ffc68,'userProfileId':_0x25fee7['userProfileId']},'raw':!![]})['then'](function(_0x4696df){if(_0x4696df&&_0x4696df[_0x0d21('0x5b')]===0x0){return db[_0x0d21('0x5c')][_0x0d21('0x54')]({'name':_0x1b0cd0[_0x0d21('0x2f')],'resourceId':_0x1b0cd0['id'],'type':_0x4696df[_0x0d21('0x2f')],'sectionId':_0x4696df['id']},{})['then'](function(){return _0x2a703d;});}else{return _0x2a703d;}})[_0x0d21('0x53')](function(_0x54fef8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54fef8);throw _0x54fef8;});}return _0x2a703d;});}})[_0x0d21('0x23')](respondWithResult(_0x4b533e,0xc9))['catch'](handleError(_0x4b533e,null));};exports[_0x0d21('0x22')]=function(_0x5b9ac3,_0x12a355){if(_0x5b9ac3[_0x0d21('0x35')]['id']){delete _0x5b9ac3[_0x0d21('0x35')]['id'];}return db[_0x0d21('0x3c')]['find']({'where':{'id':_0x5b9ac3['params']['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x12a355,null))[_0x0d21('0x23')](saveUpdates(_0x5b9ac3[_0x0d21('0x35')],null))[_0x0d21('0x23')](respondWithResult(_0x12a355,null))[_0x0d21('0x53')](handleError(_0x12a355,null));};exports[_0x0d21('0x24')]=function(_0x552855,_0x58d85c){return db[_0x0d21('0x3c')][_0x0d21('0x2e')]({'where':{'id':_0x552855['params']['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x58d85c,null))['then'](removeEntity(_0x58d85c,null))['catch'](handleError(_0x58d85c,null));};exports[_0x0d21('0x62')]=function(_0x526b09,_0x1b86a4,_0x2440c9){var _0xbcb6b5={'raw':![],'where':{}};var _0x3ec84b={};var _0xa0aaad={'count':0x0,'rows':[]};return db[_0x0d21('0x3c')][_0x0d21('0x63')]({'where':{'id':_0x526b09[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x1b86a4,null))[_0x0d21('0x23')](function(_0x483b27){if(_0x483b27){_0x3ec84b[_0x0d21('0x3f')]=_[_0x0d21('0x40')](db['CmHopper'][_0x0d21('0x3d')]);_0x3ec84b['query']=_[_0x0d21('0x40')](_0x526b09[_0x0d21('0x41')]);_0x3ec84b['filters']=_[_0x0d21('0x43')](_0x3ec84b[_0x0d21('0x3f')],_0x3ec84b[_0x0d21('0x41')]);_0xbcb6b5[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x3ec84b['model'],qs[_0x0d21('0x45')](_0x526b09[_0x0d21('0x41')][_0x0d21('0x45')]));_0xbcb6b5[_0x0d21('0x44')]=_0xbcb6b5[_0x0d21('0x44')][_0x0d21('0x46')]?_0xbcb6b5[_0x0d21('0x44')]:_0x3ec84b[_0x0d21('0x3f')];if(!_0x526b09[_0x0d21('0x41')][_0x0d21('0x47')]('nolimit')){_0xbcb6b5['limit']=qs[_0x0d21('0x1d')](_0x526b09[_0x0d21('0x41')][_0x0d21('0x1d')]);_0xbcb6b5[_0x0d21('0x1c')]=qs[_0x0d21('0x1c')](_0x526b09['query'][_0x0d21('0x1c')]);}_0xbcb6b5[_0x0d21('0x49')]=qs[_0x0d21('0x4a')](_0x526b09[_0x0d21('0x41')][_0x0d21('0x4a')]);_0xbcb6b5[_0x0d21('0x4b')]=qs[_0x0d21('0x42')](_[_0x0d21('0x4c')](_0x526b09[_0x0d21('0x41')],_0x3ec84b[_0x0d21('0x42')]));_0xbcb6b5['where']['VoiceQueueId']=_0x483b27['id'];if(_0x526b09[_0x0d21('0x41')][_0x0d21('0x28')]){_0xbcb6b5[_0x0d21('0x4b')]=_[_0x0d21('0x34')](_0xbcb6b5[_0x0d21('0x4b')],{'$or':_['map'](_0xbcb6b5[_0x0d21('0x44')],function(_0x4220da){var _0x35a1e7={};_0x35a1e7[_0x4220da]={'$like':'%'+_0x526b09[_0x0d21('0x41')][_0x0d21('0x28')]+'%'};return _0x35a1e7;})});}_0xbcb6b5=_[_0x0d21('0x34')]({},_0xbcb6b5,_0x526b09[_0x0d21('0x52')]);return db[_0x0d21('0x64')][_0x0d21('0x1f')]({'where':_0xbcb6b5[_0x0d21('0x4b')]})[_0x0d21('0x23')](function(_0x11958c){_0xa0aaad['count']=_0x11958c;if(_0x526b09['query'][_0x0d21('0x4d')]){_0xbcb6b5[_0x0d21('0x51')]=[{'all':!![]}];}return db['CmHopper'][_0x0d21('0x4e')](_0xbcb6b5);})[_0x0d21('0x23')](function(_0x24d8c2){_0xa0aaad[_0x0d21('0x65')]=_0x24d8c2;return _0xa0aaad;});}})[_0x0d21('0x23')](respondWithFilteredResult(_0x1b86a4,_0xbcb6b5))[_0x0d21('0x53')](handleError(_0x1b86a4,null));};exports[_0x0d21('0x66')]=function(_0x1780f8,_0x388723,_0xc34da7){var _0x1096ea={'raw':!![],'where':{}};var _0x1e9765={};var _0x4732a0={'count':0x0,'rows':[]};return db[_0x0d21('0x3c')]['findOne']({'where':{'id':_0x1780f8[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x388723,null))[_0x0d21('0x23')](function(_0xce0eae){if(_0xce0eae){_0x1e9765['model']=_[_0x0d21('0x40')](db[_0x0d21('0x67')][_0x0d21('0x3d')]);_0x1e9765[_0x0d21('0x41')]=_['keys'](_0x1780f8[_0x0d21('0x41')]);_0x1e9765[_0x0d21('0x42')]=_[_0x0d21('0x43')](_0x1e9765['model'],_0x1e9765[_0x0d21('0x41')]);_0x1096ea[_0x0d21('0x44')]=_['intersection'](_0x1e9765[_0x0d21('0x3f')],qs['fields'](_0x1780f8[_0x0d21('0x41')][_0x0d21('0x45')]));_0x1096ea['attributes']=_0x1096ea[_0x0d21('0x44')]['length']?_0x1096ea['attributes']:_0x1e9765['model'];if(!_0x1780f8[_0x0d21('0x41')][_0x0d21('0x47')](_0x0d21('0x48'))){_0x1096ea[_0x0d21('0x1d')]=qs[_0x0d21('0x1d')](_0x1780f8[_0x0d21('0x41')][_0x0d21('0x1d')]);_0x1096ea[_0x0d21('0x1c')]=qs[_0x0d21('0x1c')](_0x1780f8['query'][_0x0d21('0x1c')]);}_0x1096ea[_0x0d21('0x49')]=qs[_0x0d21('0x4a')](_0x1780f8[_0x0d21('0x41')][_0x0d21('0x4a')]);_0x1096ea[_0x0d21('0x4b')]=qs['filters'](_[_0x0d21('0x4c')](_0x1780f8[_0x0d21('0x41')],_0x1e9765[_0x0d21('0x42')]));_0x1096ea[_0x0d21('0x4b')][_0x0d21('0x68')]=_0xce0eae['id'];if(_0x1780f8[_0x0d21('0x41')]['filter']){_0x1096ea[_0x0d21('0x4b')]=_['merge'](_0x1096ea['where'],{'$or':_[_0x0d21('0x2a')](_0x1096ea[_0x0d21('0x44')],function(_0x311772){var _0x109192={};_0x109192[_0x311772]={'$like':'%'+_0x1780f8[_0x0d21('0x41')][_0x0d21('0x28')]+'%'};return _0x109192;})});}_0x1096ea=_[_0x0d21('0x34')]({},_0x1096ea,_0x1780f8['options']);return db['CmHopperHistory'][_0x0d21('0x1f')]({'where':_0x1096ea[_0x0d21('0x4b')]})[_0x0d21('0x23')](function(_0x516e15){_0x4732a0[_0x0d21('0x1f')]=_0x516e15;if(_0x1780f8[_0x0d21('0x41')][_0x0d21('0x4d')]){_0x1096ea['include']=[{'all':!![]}];}return db[_0x0d21('0x67')][_0x0d21('0x4e')](_0x1096ea);})[_0x0d21('0x23')](function(_0x5448ff){_0x4732a0[_0x0d21('0x65')]=_0x5448ff;return _0x4732a0;});}})[_0x0d21('0x23')](respondWithFilteredResult(_0x388723,_0x1096ea))['catch'](handleError(_0x388723,null));};exports[_0x0d21('0x69')]=function(_0x3b0bf6,_0x567abc,_0x226fff){var _0x1dba0f={'raw':!![],'where':{}};var _0x3c4330={};var _0x2e8c50={'count':0x0,'rows':[]};return db[_0x0d21('0x3c')][_0x0d21('0x63')]({'where':{'id':_0x3b0bf6[_0x0d21('0x50')]['id']}})['then'](handleEntityNotFound(_0x567abc,null))[_0x0d21('0x23')](function(_0x478b05){if(_0x478b05){_0x3c4330[_0x0d21('0x3f')]=_[_0x0d21('0x40')](db[_0x0d21('0x6a')][_0x0d21('0x3d')]);_0x3c4330['query']=_[_0x0d21('0x40')](_0x3b0bf6['query']);_0x3c4330[_0x0d21('0x42')]=_['intersection'](_0x3c4330[_0x0d21('0x3f')],_0x3c4330['query']);_0x1dba0f[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x3c4330[_0x0d21('0x3f')],qs[_0x0d21('0x45')](_0x3b0bf6['query'][_0x0d21('0x45')]));_0x1dba0f['attributes']=_0x1dba0f['attributes'][_0x0d21('0x46')]?_0x1dba0f[_0x0d21('0x44')]:_0x3c4330['model'];if(!_0x3b0bf6['query'][_0x0d21('0x47')]('nolimit')){_0x1dba0f[_0x0d21('0x1d')]=qs[_0x0d21('0x1d')](_0x3b0bf6[_0x0d21('0x41')]['limit']);_0x1dba0f['offset']=qs[_0x0d21('0x1c')](_0x3b0bf6[_0x0d21('0x41')][_0x0d21('0x1c')]);}_0x1dba0f[_0x0d21('0x49')]=qs['sort'](_0x3b0bf6['query'][_0x0d21('0x4a')]);_0x1dba0f[_0x0d21('0x4b')]=qs[_0x0d21('0x42')](_[_0x0d21('0x4c')](_0x3b0bf6[_0x0d21('0x41')],_0x3c4330[_0x0d21('0x42')]));_0x1dba0f['where'][_0x0d21('0x68')]=_0x478b05['id'];if(_0x3b0bf6[_0x0d21('0x41')]['filter']){_0x1dba0f[_0x0d21('0x4b')]=_[_0x0d21('0x34')](_0x1dba0f['where'],{'$or':_['map'](_0x1dba0f['attributes'],function(_0x441866){var _0x5d8a95={};_0x5d8a95[_0x441866]={'$like':'%'+_0x3b0bf6[_0x0d21('0x41')][_0x0d21('0x28')]+'%'};return _0x5d8a95;})});}_0x1dba0f=_[_0x0d21('0x34')]({},_0x1dba0f,_0x3b0bf6[_0x0d21('0x52')]);return db[_0x0d21('0x6a')]['count']({'where':_0x1dba0f[_0x0d21('0x4b')]})[_0x0d21('0x23')](function(_0x1338be){_0x2e8c50[_0x0d21('0x1f')]=_0x1338be;if(_0x3b0bf6[_0x0d21('0x41')][_0x0d21('0x4d')]){_0x1dba0f[_0x0d21('0x51')]=[{'all':!![]}];}return db[_0x0d21('0x6a')]['findAll'](_0x1dba0f);})[_0x0d21('0x23')](function(_0x293f34){_0x2e8c50[_0x0d21('0x65')]=_0x293f34;return _0x2e8c50;});}})['then'](respondWithFilteredResult(_0x567abc,_0x1dba0f))[_0x0d21('0x53')](handleError(_0x567abc,null));};exports['getHopperBlacks']=function(_0x2ab9c0,_0x240837,_0x514465){var _0x33a785={'raw':!![],'where':{}};var _0x548ac2={};var _0xed1802={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x0d21('0x63')]({'where':{'id':_0x2ab9c0[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x240837,null))['then'](function(_0x8ad815){if(_0x8ad815){_0x548ac2[_0x0d21('0x3f')]=_[_0x0d21('0x40')](db[_0x0d21('0x6b')][_0x0d21('0x3d')]);_0x548ac2['query']=_[_0x0d21('0x40')](_0x2ab9c0[_0x0d21('0x41')]);_0x548ac2[_0x0d21('0x42')]=_[_0x0d21('0x43')](_0x548ac2[_0x0d21('0x3f')],_0x548ac2[_0x0d21('0x41')]);_0x33a785[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x548ac2['model'],qs[_0x0d21('0x45')](_0x2ab9c0[_0x0d21('0x41')][_0x0d21('0x45')]));_0x33a785[_0x0d21('0x44')]=_0x33a785[_0x0d21('0x44')][_0x0d21('0x46')]?_0x33a785[_0x0d21('0x44')]:_0x548ac2[_0x0d21('0x3f')];if(!_0x2ab9c0[_0x0d21('0x41')][_0x0d21('0x47')]('nolimit')){_0x33a785[_0x0d21('0x1d')]=qs[_0x0d21('0x1d')](_0x2ab9c0[_0x0d21('0x41')][_0x0d21('0x1d')]);_0x33a785['offset']=qs[_0x0d21('0x1c')](_0x2ab9c0[_0x0d21('0x41')][_0x0d21('0x1c')]);}_0x33a785[_0x0d21('0x49')]=qs[_0x0d21('0x4a')](_0x2ab9c0[_0x0d21('0x41')]['sort']);_0x33a785[_0x0d21('0x4b')]=qs[_0x0d21('0x42')](_[_0x0d21('0x4c')](_0x2ab9c0[_0x0d21('0x41')],_0x548ac2['filters']));_0x33a785[_0x0d21('0x4b')][_0x0d21('0x68')]=_0x8ad815['id'];if(_0x2ab9c0[_0x0d21('0x41')]['filter']){_0x33a785['where']=_['merge'](_0x33a785[_0x0d21('0x4b')],{'$or':_[_0x0d21('0x2a')](_0x33a785[_0x0d21('0x44')],function(_0xc659be){var _0x558033={};_0x558033[_0xc659be]={'$like':'%'+_0x2ab9c0['query'][_0x0d21('0x28')]+'%'};return _0x558033;})});}_0x33a785=_[_0x0d21('0x34')]({},_0x33a785,_0x2ab9c0[_0x0d21('0x52')]);return db[_0x0d21('0x6b')]['count']({'where':_0x33a785['where']})[_0x0d21('0x23')](function(_0x148307){_0xed1802['count']=_0x148307;if(_0x2ab9c0[_0x0d21('0x41')][_0x0d21('0x4d')]){_0x33a785[_0x0d21('0x51')]=[{'all':!![]}];}return db[_0x0d21('0x6b')][_0x0d21('0x4e')](_0x33a785);})[_0x0d21('0x23')](function(_0x5544d5){_0xed1802[_0x0d21('0x65')]=_0x5544d5;return _0xed1802;});}})[_0x0d21('0x23')](respondWithFilteredResult(_0x240837,_0x33a785))['catch'](handleError(_0x240837,null));};exports[_0x0d21('0x6c')]=function(_0x110ee2,_0x4fb39d,_0x27ebd5){var _0x352b53={};var _0x5f5b77={};var _0x44d007;var _0x43e5ba;return db['VoiceQueue'][_0x0d21('0x63')]({'where':{'id':_0x110ee2[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x4fb39d,null))[_0x0d21('0x23')](function(_0x263824){if(_0x263824){_0x44d007=_0x263824;_0x5f5b77['model']=_['keys'](db['Team'][_0x0d21('0x3d')]);_0x5f5b77['query']=_[_0x0d21('0x40')](_0x110ee2[_0x0d21('0x41')]);_0x5f5b77[_0x0d21('0x42')]=_['intersection'](_0x5f5b77[_0x0d21('0x3f')],_0x5f5b77[_0x0d21('0x41')]);_0x352b53[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x5f5b77[_0x0d21('0x3f')],qs[_0x0d21('0x45')](_0x110ee2[_0x0d21('0x41')][_0x0d21('0x45')]));_0x352b53['attributes']=_0x352b53[_0x0d21('0x44')]['length']?_0x352b53[_0x0d21('0x44')]:_0x5f5b77[_0x0d21('0x3f')];_0x352b53[_0x0d21('0x49')]=qs['sort'](_0x110ee2[_0x0d21('0x41')][_0x0d21('0x4a')]);_0x352b53[_0x0d21('0x4b')]=qs[_0x0d21('0x42')](_['pick'](_0x110ee2[_0x0d21('0x41')],_0x5f5b77[_0x0d21('0x42')]));if(_0x110ee2[_0x0d21('0x41')][_0x0d21('0x28')]){_0x352b53[_0x0d21('0x4b')]=_[_0x0d21('0x34')](_0x352b53[_0x0d21('0x4b')],{'$or':_[_0x0d21('0x2a')](_0x352b53[_0x0d21('0x44')],function(_0x342b6b){var _0x52584b={};_0x52584b[_0x342b6b]={'$like':'%'+_0x110ee2[_0x0d21('0x41')][_0x0d21('0x28')]+'%'};return _0x52584b;})});}_0x352b53=_[_0x0d21('0x34')]({},_0x352b53,_0x110ee2[_0x0d21('0x52')]);return _0x44d007['getTeams'](_0x352b53);}})[_0x0d21('0x23')](function(_0x9a7005){if(_0x9a7005){_0x43e5ba=_0x9a7005['length'];if(!_0x110ee2[_0x0d21('0x41')][_0x0d21('0x47')](_0x0d21('0x48'))){_0x352b53[_0x0d21('0x1d')]=qs[_0x0d21('0x1d')](_0x110ee2[_0x0d21('0x41')]['limit']);_0x352b53['offset']=qs[_0x0d21('0x1c')](_0x110ee2[_0x0d21('0x41')][_0x0d21('0x1c')]);}return _0x44d007[_0x0d21('0x6c')](_0x352b53);}})[_0x0d21('0x23')](function(_0x204ab0){if(_0x204ab0){return _0x204ab0?{'count':_0x43e5ba,'rows':_0x204ab0}:null;}})['then'](respondWithResult(_0x4fb39d,null))['catch'](handleError(_0x4fb39d,null));};exports[_0x0d21('0x6d')]=function(_0x2b771c,_0x5ae937,_0x3f1479){var _0x3a5214=_0x2b771c[_0x0d21('0x35')][_0x0d21('0x6e')];var _0x220920=_['map'](_0x3a5214,'id');return db['Team'][_0x0d21('0x4e')]({'where':{'id':_0x220920},'attributes':['id'],'include':[{'model':db[_0x0d21('0x6f')],'as':_0x0d21('0x70'),'attributes':['id',_0x0d21('0x2f'),_0x0d21('0x71'),_0x0d21('0x72'),_0x0d21('0x73')],'raw':!![]}]})[_0x0d21('0x23')](function(_0x408ce1){if(_0x408ce1){var _0x26210b=_['flatMap'](_0x408ce1,function(_0x4e14c7){var _0x337f0a=_0x4e14c7[_0x0d21('0x25')]({'plain':!![]});_0x337f0a[_0x0d21('0x70')][_0x0d21('0x74')](function(_0x214ef9){_0x214ef9[_0x0d21('0x75')]=_[_0x0d21('0x2e')](_0x3a5214,{'id':_0x337f0a['id']})[_0x0d21('0x75')];});return _0x337f0a[_0x0d21('0x70')];});return db[_0x0d21('0x3c')]['find']({'where':{'id':_0x2b771c[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](function(_0x3ef7c8){return db[_0x0d21('0x76')][_0x0d21('0x77')](function(_0x49cba5){return _0x3ef7c8[_0x0d21('0x6d')](_0x220920,{'transaction':_0x49cba5})[_0x0d21('0x23')](function(){return BPromise[_0x0d21('0x78')](_0x3a5214,function(_0x43f03c){return db[_0x0d21('0x79')][_0x0d21('0x7a')]({'TeamId':_0x43f03c['id'],'VoiceQueueId':_0x2b771c[_0x0d21('0x50')]['id'],'penalty':_0x43f03c[_0x0d21('0x75')]},{'transaction':_0x49cba5});});})[_0x0d21('0x23')](function(){return BPromise[_0x0d21('0x78')](_0x26210b,function(_0x416206){return db[_0x0d21('0x7b')][_0x0d21('0x7c')]({'where':{'UserId':_0x416206['id'],'VoiceQueueId':_0x2b771c[_0x0d21('0x50')]['id']},'defaults':{'penalty':_0x416206[_0x0d21('0x75')]},'transaction':_0x49cba5});});})[_0x0d21('0x23')](function(){return BPromise[_0x0d21('0x78')](_[_0x0d21('0x28')](_0x26210b,{'online':!![]}),function(_0x1881ad){return db[_0x0d21('0x7d')][_0x0d21('0x7a')]({'membername':_0x1881ad[_0x0d21('0x2f')],'UserId':_0x1881ad['id'],'queue_name':_0x3ef7c8[_0x0d21('0x2f')],'VoiceQueueId':_0x3ef7c8['id'],'interface':_[_0x0d21('0x7e')](_0x1881ad[_0x0d21('0x73')])?util[_0x0d21('0x7f')](_0x0d21('0x80'),_0x1881ad[_0x0d21('0x2f')]):_0x1881ad[_0x0d21('0x73')],'paused':_0x1881ad[_0x0d21('0x72')]||![],'penalty':_0x1881ad[_0x0d21('0x75')]},{'transaction':_0x49cba5});});})[_0x0d21('0x23')](function(){_0x26210b[_0x0d21('0x74')](function(_0x435447){socket[_0x0d21('0x81')](_0x0d21('0x82'),{'UserId':_0x435447['id'],'VoiceQueueId':_0x3ef7c8['id']});});});});});}})[_0x0d21('0x23')](respondWithStatusCode(_0x5ae937,null))[_0x0d21('0x53')](handleError(_0x5ae937,null));};exports[_0x0d21('0x83')]=function(_0x44fe49,_0x3bfd23,_0x337964){return db['Team'][_0x0d21('0x4e')]({'where':{'id':_0x44fe49[_0x0d21('0x41')][_0x0d21('0x84')]},'attributes':['id'],'include':[{'model':db[_0x0d21('0x6f')],'as':_0x0d21('0x70'),'attributes':['id'],'raw':!![]}]})[_0x0d21('0x23')](handleEntityNotFound(_0x3bfd23,null))['then'](function(_0x5cd5fb){var _0x215b9f=_[_0x0d21('0x2a')](_0x5cd5fb,'id');var _0x31a429=[];var _0x159e9e=[];var _0x2b055d=squel[_0x0d21('0x85')]();_0x2b055d[_0x0d21('0x86')](_0x0d21('0x87'))['from'](_0x0d21('0x88'),'tq')[_0x0d21('0x89')]('user_has_teams','ut',_0x0d21('0x8a'))[_0x0d21('0x4b')](_0x0d21('0x8b'),_0x44fe49[_0x0d21('0x50')]['id']);for(var _0x404fca=0x0;_0x404fca<_0x5cd5fb['length'];_0x404fca+=0x1){let _0x288d57=_0x5cd5fb[_0x404fca];for(var _0x52cceb=0x0;_0x52cceb<_0x288d57['Agents'][_0x0d21('0x46')];_0x52cceb+=0x1){let _0x472937=_0x288d57[_0x0d21('0x70')][_0x52cceb];var _0x387a72=_0x2b055d[_0x0d21('0x5e')]();_0x387a72[_0x0d21('0x4b')](_0x0d21('0x8c'),_0x472937['id']);_0x159e9e['push'](db[_0x0d21('0x76')][_0x0d21('0x41')](_0x387a72['toString'](),{'type':db[_0x0d21('0x76')][_0x0d21('0x8d')][_0x0d21('0x8e')]})[_0x0d21('0x23')](function(_0x5ac5f3){if(_0x5ac5f3[_0x0d21('0x46')]===0x1){return _0x472937['id'];}else{var _0x45f01a=_[_0x0d21('0x8f')](_['map'](_0x5ac5f3,_0x0d21('0x90')),function(_0x29f9bc){return _['includes'](_0x215b9f,_0x29f9bc);});if(_0x45f01a){return _0x472937['id'];}}}));}}return BPromise['all'](_0x159e9e)[_0x0d21('0x23')](function(_0x21cfd7){_0x31a429=_(_0x31a429)[_0x0d21('0x91')](_0x21cfd7)['compact']()[_0x0d21('0x2b')]();return db[_0x0d21('0x3c')]['find']({'where':{'id':_0x44fe49['params']['id']}})[_0x0d21('0x23')](function(_0x37a9ab){return db[_0x0d21('0x76')][_0x0d21('0x77')](function(_0x153516){return _0x37a9ab[_0x0d21('0x83')](_0x44fe49['query']['ids'],{'transaction':_0x153516})[_0x0d21('0x23')](function(){if(!_[_0x0d21('0x92')](_0x31a429)){return _0x37a9ab[_0x0d21('0x93')](_0x31a429,{'transaction':_0x153516})['then'](function(){return db[_0x0d21('0x7d')][_0x0d21('0x24')]({'where':{'VoiceQueueId':_0x44fe49[_0x0d21('0x50')]['id'],'UserId':_0x31a429},'transaction':_0x153516});});}})[_0x0d21('0x23')](function(){_0x31a429[_0x0d21('0x74')](function(_0x3e1931){socket[_0x0d21('0x81')](_0x0d21('0x94'),{'UserId':_0x3e1931,'VoiceQueueId':_0x37a9ab['id']});});});});});});})[_0x0d21('0x23')](respondWithStatusCode(_0x3bfd23,null))[_0x0d21('0x53')](handleError(_0x3bfd23,null));};exports['addAgents']=function(_0x1a2d62,_0x49e358,_0x33a61e){var _0x38808e,_0x5a9958;return db[_0x0d21('0x3c')][_0x0d21('0x2e')]({'where':{'id':_0x1a2d62[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x49e358,null))[_0x0d21('0x23')](function(_0x4b500e){if(_0x4b500e){_0x5a9958=_0x4b500e;return _0x4b500e[_0x0d21('0x95')](_0x1a2d62[_0x0d21('0x35')]['ids'],_[_0x0d21('0x61')](_0x1a2d62[_0x0d21('0x35')],[_0x0d21('0x84'),'id'])||{})['spread'](function(_0x2d9501){for(var _0x245c76=0x0;_0x245c76<_0x1a2d62[_0x0d21('0x35')][_0x0d21('0x84')][_0x0d21('0x46')];_0x245c76+=0x1){socket[_0x0d21('0x81')]('userVoiceQueue:save',{'UserId':_0x1a2d62[_0x0d21('0x35')]['ids'][_0x245c76],'VoiceQueueId':_0x1a2d62[_0x0d21('0x50')]['id']});}return _0x2d9501;});}})[_0x0d21('0x23')](function(_0x18a4e6){_0x38808e=_0x18a4e6||[];if(_0x5a9958){return db[_0x0d21('0x6f')][_0x0d21('0x4e')]({'where':{'id':_0x1a2d62['body']['ids']},'attributes':['id',_0x0d21('0x2f'),'online','voicePause','interface'],'raw':!![]});}})[_0x0d21('0x23')](function(_0xd76f0){if(!_[_0x0d21('0x92')](_0xd76f0)){var _0x1b12b2=[];for(var _0x4f522a=0x0;_0x4f522a<_0xd76f0['length'];_0x4f522a++){if(_0xd76f0[_0x4f522a][_0x0d21('0x71')]){_0x1b12b2[_0x0d21('0x96')](db[_0x0d21('0x7d')][_0x0d21('0x7a')]({'membername':_0xd76f0[_0x4f522a]['name'],'UserId':_0xd76f0[_0x4f522a]['id'],'queue_name':_0x5a9958[_0x0d21('0x2f')],'VoiceQueueId':_0x5a9958['id'],'interface':_[_0x0d21('0x7e')](_0xd76f0[_0x4f522a]['interface'])?util[_0x0d21('0x7f')](_0x0d21('0x80'),_0xd76f0[_0x4f522a]['name']):_0xd76f0[_0x4f522a][_0x0d21('0x73')],'paused':_0xd76f0[_0x4f522a]['voicePause']||![],'penalty':_0x1a2d62['body']['penalty']||0x0}));}}return BPromise[_0x0d21('0x97')](_0x1b12b2);}})[_0x0d21('0x23')](function(){return _0x38808e;})[_0x0d21('0x23')](respondWithResult(_0x49e358,null))[_0x0d21('0x53')](handleError(_0x49e358,null));};exports[_0x0d21('0x93')]=function(_0x5cc3b0,_0x23a315,_0x350a6b){return db[_0x0d21('0x3c')][_0x0d21('0x2e')]({'where':{'id':_0x5cc3b0['params']['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x23a315,null))['then'](function(_0x22eead){if(_0x22eead){return _0x22eead['removeAgents'](_0x5cc3b0['query'][_0x0d21('0x84')])[_0x0d21('0x23')](function(){if(_[_0x0d21('0x98')](_0x5cc3b0[_0x0d21('0x41')][_0x0d21('0x84')])){for(var _0x34fe2f=0x0;_0x34fe2f<_0x5cc3b0[_0x0d21('0x41')][_0x0d21('0x84')]['length'];_0x34fe2f+=0x1){socket[_0x0d21('0x81')](_0x0d21('0x94'),{'UserId':Number(_0x5cc3b0[_0x0d21('0x41')][_0x0d21('0x84')][_0x34fe2f]),'VoiceQueueId':Number(_0x5cc3b0[_0x0d21('0x50')]['id'])});}}else{socket[_0x0d21('0x81')]('userVoiceQueue:remove',{'UserId':Number(_0x5cc3b0[_0x0d21('0x41')][_0x0d21('0x84')]),'VoiceQueueId':Number(_0x5cc3b0[_0x0d21('0x50')]['id'])});}});}})[_0x0d21('0x23')](function(_0x579d88){return db[_0x0d21('0x7d')][_0x0d21('0x24')]({'where':{'VoiceQueueId':_0x5cc3b0['params']['id'],'UserId':_0x5cc3b0[_0x0d21('0x41')][_0x0d21('0x84')]}})[_0x0d21('0x23')](function(){return _0x579d88;});})[_0x0d21('0x23')](respondWithStatusCode(_0x23a315,null))[_0x0d21('0x53')](handleError(_0x23a315,null));};exports[_0x0d21('0x99')]=function(_0x4e34ce,_0x422414,_0x2bf441){var _0x5b23b5={};var _0x4b5dd6={};var _0x12e811;var _0x593391;return db[_0x0d21('0x3c')][_0x0d21('0x63')]({'where':{'id':_0x4e34ce[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x422414,null))[_0x0d21('0x23')](function(_0xd9b731){if(_0xd9b731){_0x12e811=_0xd9b731;_0x4b5dd6['model']=_[_0x0d21('0x40')](db[_0x0d21('0x6f')]['rawAttributes']);_0x4b5dd6['query']=_[_0x0d21('0x40')](_0x4e34ce[_0x0d21('0x41')]);_0x4b5dd6['filters']=_[_0x0d21('0x43')](_0x4b5dd6[_0x0d21('0x3f')],_0x4b5dd6['query']);_0x5b23b5[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x4b5dd6[_0x0d21('0x3f')],qs[_0x0d21('0x45')](_0x4e34ce[_0x0d21('0x41')][_0x0d21('0x45')]));_0x5b23b5[_0x0d21('0x44')]=_0x5b23b5[_0x0d21('0x44')][_0x0d21('0x46')]?_0x5b23b5[_0x0d21('0x44')]:_0x4b5dd6[_0x0d21('0x3f')];_0x5b23b5['order']=qs[_0x0d21('0x4a')](_0x4e34ce[_0x0d21('0x41')]['sort']);_0x5b23b5['where']=qs[_0x0d21('0x42')](_[_0x0d21('0x4c')](_0x4e34ce['query'],_0x4b5dd6[_0x0d21('0x42')]));if(_0x4e34ce[_0x0d21('0x41')][_0x0d21('0x28')]){_0x5b23b5[_0x0d21('0x4b')]=_[_0x0d21('0x34')](_0x5b23b5['where'],{'$or':_[_0x0d21('0x2a')](_0x5b23b5[_0x0d21('0x44')],function(_0xa63fcb){var _0x251225={};_0x251225[_0xa63fcb]={'$like':'%'+_0x4e34ce[_0x0d21('0x41')][_0x0d21('0x28')]+'%'};return _0x251225;})});}_0x5b23b5=_[_0x0d21('0x34')]({},_0x5b23b5,_0x4e34ce[_0x0d21('0x52')]);return _0x12e811[_0x0d21('0x99')](_0x5b23b5);}})[_0x0d21('0x23')](function(_0x4c15a3){if(_0x4c15a3){_0x593391=_0x4c15a3[_0x0d21('0x46')];if(!_0x4e34ce['query'][_0x0d21('0x47')](_0x0d21('0x48'))){_0x5b23b5['limit']=qs['limit'](_0x4e34ce[_0x0d21('0x41')][_0x0d21('0x1d')]);_0x5b23b5['offset']=qs[_0x0d21('0x1c')](_0x4e34ce['query']['offset']);}return _0x12e811[_0x0d21('0x99')](_0x5b23b5);}})[_0x0d21('0x23')](function(_0x5c9145){if(_0x5c9145){return _0x5c9145?{'count':_0x593391,'rows':_0x5c9145}:null;}})[_0x0d21('0x23')](respondWithResult(_0x422414,null))[_0x0d21('0x53')](handleError(_0x422414,null));};exports[_0x0d21('0x9a')]=function(_0x3d756a,_0xdeac9d,_0x143997){var _0x5cfbef={};var _0x13d97c={};var _0x22c008;var _0x1a6cfc;return db[_0x0d21('0x3c')][_0x0d21('0x63')]({'where':{'id':_0x3d756a['params']['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0xdeac9d,null))[_0x0d21('0x23')](function(_0x1e1ddf){if(_0x1e1ddf){_0x22c008=_0x1e1ddf;_0x13d97c[_0x0d21('0x3f')]=_['keys'](db['UserVoiceQueueRt']['rawAttributes']);_0x13d97c['query']=_[_0x0d21('0x40')](_0x3d756a[_0x0d21('0x41')]);_0x13d97c['filters']=_[_0x0d21('0x43')](_0x13d97c['model'],_0x13d97c['query']);_0x5cfbef[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x13d97c['model'],qs[_0x0d21('0x45')](_0x3d756a[_0x0d21('0x41')]['fields']));_0x5cfbef[_0x0d21('0x44')]=_0x5cfbef['attributes']['length']?_0x5cfbef[_0x0d21('0x44')]:_0x13d97c[_0x0d21('0x3f')];_0x5cfbef['order']=qs[_0x0d21('0x4a')](_0x3d756a[_0x0d21('0x41')][_0x0d21('0x4a')]);_0x5cfbef[_0x0d21('0x4b')]=qs[_0x0d21('0x42')](_[_0x0d21('0x4c')](_0x3d756a[_0x0d21('0x41')],_0x13d97c[_0x0d21('0x42')]));if(_0x3d756a[_0x0d21('0x41')][_0x0d21('0x28')]){_0x5cfbef[_0x0d21('0x4b')]=_[_0x0d21('0x34')](_0x5cfbef[_0x0d21('0x4b')],{'$or':_[_0x0d21('0x2a')](_0x5cfbef[_0x0d21('0x44')],function(_0x89f5b4){var _0xdae26b={};_0xdae26b[_0x89f5b4]={'$like':'%'+_0x3d756a[_0x0d21('0x41')]['filter']+'%'};return _0xdae26b;})});}_0x5cfbef=_['merge']({},_0x5cfbef,_0x3d756a[_0x0d21('0x52')]);return _0x22c008[_0x0d21('0x9a')](_0x5cfbef);}})[_0x0d21('0x23')](function(_0x19eb76){if(_0x19eb76){_0x1a6cfc=_0x19eb76['length'];if(!_0x3d756a[_0x0d21('0x41')][_0x0d21('0x47')]('nolimit')){_0x5cfbef['limit']=qs[_0x0d21('0x1d')](_0x3d756a[_0x0d21('0x41')][_0x0d21('0x1d')]);_0x5cfbef[_0x0d21('0x1c')]=qs[_0x0d21('0x1c')](_0x3d756a[_0x0d21('0x41')][_0x0d21('0x1c')]);}return _0x22c008[_0x0d21('0x9a')](_0x5cfbef);}})[_0x0d21('0x23')](function(_0x42a51b){return _0x42a51b?{'count':_0x1a6cfc,'rows':_0x42a51b}:null;})[_0x0d21('0x23')](respondWithResult(_0xdeac9d,null))[_0x0d21('0x53')](handleError(_0xdeac9d,null));};exports[_0x0d21('0x9b')]=function(_0x26b294,_0x57b292,_0x26115d){var _0x849a0d={};var _0x34a628={};var _0x5cd930;var _0x1a4de5;return db[_0x0d21('0x3c')]['findOne']({'where':{'id':_0x26b294[_0x0d21('0x50')]['id']}})['then'](handleEntityNotFound(_0x57b292,null))['then'](function(_0x580aa5){if(_0x580aa5){_0x5cd930=_0x580aa5;_0x34a628['model']=_[_0x0d21('0x40')](db['CmList'][_0x0d21('0x3d')]);_0x34a628[_0x0d21('0x41')]=_[_0x0d21('0x40')](_0x26b294[_0x0d21('0x41')]);_0x34a628[_0x0d21('0x42')]=_[_0x0d21('0x43')](_0x34a628['model'],_0x34a628['query']);_0x849a0d[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x34a628['model'],qs['fields'](_0x26b294[_0x0d21('0x41')][_0x0d21('0x45')]));_0x849a0d[_0x0d21('0x44')]=_0x849a0d[_0x0d21('0x44')][_0x0d21('0x46')]?_0x849a0d[_0x0d21('0x44')]:_0x34a628[_0x0d21('0x3f')];_0x849a0d['order']=qs[_0x0d21('0x4a')](_0x26b294['query'][_0x0d21('0x4a')]);_0x849a0d['where']=qs['filters'](_[_0x0d21('0x4c')](_0x26b294['query'],_0x34a628[_0x0d21('0x42')]));if(_0x26b294['query'][_0x0d21('0x28')]){_0x849a0d[_0x0d21('0x4b')]=_['merge'](_0x849a0d[_0x0d21('0x4b')],{'$or':_[_0x0d21('0x2a')](_0x849a0d['attributes'],function(_0x11d716){var _0x1c939b={};_0x1c939b[_0x11d716]={'$like':'%'+_0x26b294[_0x0d21('0x41')]['filter']+'%'};return _0x1c939b;})});}_0x849a0d=_['merge']({},_0x849a0d,_0x26b294[_0x0d21('0x52')]);return _0x5cd930[_0x0d21('0x9b')](_0x849a0d);}})[_0x0d21('0x23')](function(_0xc49fff){if(_0xc49fff){_0x1a4de5=_0xc49fff['length'];if(!_0x26b294['query'][_0x0d21('0x47')](_0x0d21('0x48'))){_0x849a0d['limit']=qs[_0x0d21('0x1d')](_0x26b294['query'][_0x0d21('0x1d')]);_0x849a0d[_0x0d21('0x1c')]=qs[_0x0d21('0x1c')](_0x26b294[_0x0d21('0x41')][_0x0d21('0x1c')]);}return _0x5cd930[_0x0d21('0x9b')](_0x849a0d);}})['then'](function(_0x1da19d){if(_0x1da19d){return _0x1da19d?{'count':_0x1a4de5,'rows':_0x1da19d}:null;}})['then'](respondWithResult(_0x57b292,null))[_0x0d21('0x53')](handleError(_0x57b292,null));};exports[_0x0d21('0x9c')]=function(_0x4a8d23,_0x545fcb,_0x20f3e0){var _0x37716f,_0x312080;return db[_0x0d21('0x3c')][_0x0d21('0x2e')]({'where':{'id':_0x4a8d23[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x545fcb,null))['then'](function(_0x49f181){if(_0x49f181){_0x312080=_0x49f181;return _0x49f181[_0x0d21('0x9c')](_0x4a8d23['body'][_0x0d21('0x84')],_[_0x0d21('0x61')](_0x4a8d23[_0x0d21('0x35')],[_0x0d21('0x84'),'id'])||{});}return null;})['spread'](function(_0x50a1bc){var _0x10c182;_0x37716f=_0x50a1bc||[];var _0x23ff11=[];if(_0x50a1bc){for(var _0x47a2f4=0x0;_0x47a2f4<_0x50a1bc[_0x0d21('0x46')];_0x47a2f4+=0x1){var _0x487a1d=_0x50a1bc[_0x47a2f4][_0x0d21('0x25')]({'plain':!![]});_0x312080[_0x0d21('0x9d')]=_0x4a8d23[_0x0d21('0x35')][_0x0d21('0x9d')]?_0x4a8d23[_0x0d21('0x35')][_0x0d21('0x9d')]:_0x312080[_0x0d21('0x9d')];switch(_0x312080[_0x0d21('0x9d')]){case'always':_0x10c182=squel[_0x0d21('0x9e')]()['into'](_0x0d21('0x9f'))[_0x0d21('0xa0')]([_0x0d21('0xa1'),_0x0d21('0xa2'),_0x0d21('0xa3'),_0x0d21('0xa4'),_0x0d21('0x68'),_0x0d21('0x5f'),_0x0d21('0x60')],squel['select']()['field'](_0x0d21('0xa1'),_0x0d21('0xa1'))[_0x0d21('0x86')](_0x0d21('0xa5'),_0x0d21('0xa2'))[_0x0d21('0x86')]('id',_0x0d21('0xa3'))['field'](_0x487a1d[_0x0d21('0xa6')]['toString'](),_0x0d21('0xa4'))[_0x0d21('0x86')](_0x4a8d23[_0x0d21('0x50')]['id'][_0x0d21('0xa7')](),_0x0d21('0x68'))['field'](_0x0d21('0xa5'),_0x0d21('0x5f'))[_0x0d21('0x86')](_0x0d21('0xa5'),_0x0d21('0x60'))[_0x0d21('0xa8')](_0x0d21('0xa9'))[_0x0d21('0x4b')](_0x0d21('0xaa'))[_0x0d21('0x4b')](_0x0d21('0xab'),_0x487a1d[_0x0d21('0xa6')][_0x0d21('0xa7')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x0d21('0x4b')](_0x0d21('0xac'),squel[_0x0d21('0x85')]()[_0x0d21('0x86')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x0d21('0xad'))[_0x0d21('0x4b')]('VoiceQueueId\x20=\x20?',_0x4a8d23[_0x0d21('0x50')]['id'][_0x0d21('0xa7')]()))[_0x0d21('0x4b')](_0x0d21('0xac'),squel[_0x0d21('0x85')]()['field'](_0x0d21('0xae'))[_0x0d21('0xa8')](_0x0d21('0x9f'))[_0x0d21('0x4b')]('VoiceQueueId\x20=\x20?',_0x4a8d23[_0x0d21('0x50')]['id']['toString']())))[_0x0d21('0xa7')]();break;case'onlyIfOpen':_0x10c182=squel[_0x0d21('0x9e')]()['into']('cm_hopper')['fromQuery']([_0x0d21('0xa1'),_0x0d21('0xa2'),_0x0d21('0xa3'),_0x0d21('0xa4'),_0x0d21('0x68'),_0x0d21('0x5f'),_0x0d21('0x60')],squel[_0x0d21('0x85')]()[_0x0d21('0x86')](_0x0d21('0xa1'),'phone')[_0x0d21('0x86')](_0x0d21('0xa5'),_0x0d21('0xa2'))['field']('id',_0x0d21('0xa3'))[_0x0d21('0x86')](_0x487a1d[_0x0d21('0xa6')][_0x0d21('0xa7')](),_0x0d21('0xa4'))[_0x0d21('0x86')](_0x4a8d23['params']['id']['toString'](),_0x0d21('0x68'))[_0x0d21('0x86')]('NOW()','createdAt')[_0x0d21('0x86')](_0x0d21('0xa5'),'updatedAt')[_0x0d21('0xa8')](_0x0d21('0xa9'))[_0x0d21('0x4b')](_0x0d21('0xaa'))[_0x0d21('0x4b')](_0x0d21('0xab'),_0x487a1d[_0x0d21('0xa6')][_0x0d21('0xa7')]())['where'](_0x0d21('0xaf'))[_0x0d21('0x4b')](_0x0d21('0xac'),squel[_0x0d21('0x85')]()['field'](_0x0d21('0xae'))[_0x0d21('0xa8')](_0x0d21('0x9f'))[_0x0d21('0x4b')](_0x0d21('0x8b'),_0x4a8d23['params']['id'][_0x0d21('0xa7')]())))[_0x0d21('0xa7')]();break;default:_0x10c182=squel[_0x0d21('0x9e')]()[_0x0d21('0xb0')](_0x0d21('0x9f'))['fromQuery']([_0x0d21('0xa1'),'scheduledAt','ContactId','ListId','VoiceQueueId',_0x0d21('0x5f'),_0x0d21('0x60')],squel[_0x0d21('0x85')]()['field'](_0x0d21('0xa1'),'phone')[_0x0d21('0x86')](_0x0d21('0xa5'),_0x0d21('0xa2'))['field']('id',_0x0d21('0xa3'))[_0x0d21('0x86')](_0x487a1d['CmListId'][_0x0d21('0xa7')](),'ListId')[_0x0d21('0x86')](_0x4a8d23[_0x0d21('0x50')]['id'][_0x0d21('0xa7')](),_0x0d21('0x68'))[_0x0d21('0x86')](_0x0d21('0xa5'),_0x0d21('0x5f'))[_0x0d21('0x86')]('NOW()','updatedAt')[_0x0d21('0xa8')](_0x0d21('0xa9'))[_0x0d21('0x4b')](_0x0d21('0xaa'))[_0x0d21('0x4b')]('ListId\x20=\x20?',_0x487a1d[_0x0d21('0xa6')]['toString']())['where'](_0x0d21('0xaf')))[_0x0d21('0xa7')]();}_0x23ff11[_0x0d21('0x96')](db[_0x0d21('0x76')][_0x0d21('0x41')](_0x10c182));}return BPromise[_0x0d21('0x97')](_0x23ff11);}})[_0x0d21('0x23')](function(){return _0x37716f;})[_0x0d21('0x23')](respondWithResult(_0x545fcb,null))[_0x0d21('0x53')](handleError(_0x545fcb,null));};exports['removeLists']=function(_0x43c080,_0x2831e7,_0x494daf){return db[_0x0d21('0x3c')][_0x0d21('0x2e')]({'where':{'id':_0x43c080[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x2831e7,null))['then'](function(_0x11943a){if(_0x11943a){return _0x11943a['removeLists'](_0x43c080['query'][_0x0d21('0x84')]);}})['then'](function(_0x238a00){if(_0x238a00){return db['CmHopper'][_0x0d21('0x24')]({'where':{'ListId':_0x43c080[_0x0d21('0x41')][_0x0d21('0x84')],'VoiceQueueId':_0x43c080[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](function(){return _0x238a00;});}})[_0x0d21('0x23')](respondWithStatusCode(_0x2831e7,null))[_0x0d21('0x53')](handleError(_0x2831e7,null));};exports[_0x0d21('0xb1')]=function(_0x1417b2,_0x36aaaf,_0x478d4c){var _0x43ba5b={};var _0x43e37d={};var _0x6af4c4;var _0x10e56c;return db[_0x0d21('0x3c')][_0x0d21('0x63')]({'where':{'id':_0x1417b2['params']['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x36aaaf,null))['then'](function(_0x5392a6){if(_0x5392a6){_0x6af4c4=_0x5392a6;_0x43e37d['model']=_[_0x0d21('0x40')](db[_0x0d21('0xb2')][_0x0d21('0x3d')]);_0x43e37d[_0x0d21('0x41')]=_[_0x0d21('0x40')](_0x1417b2[_0x0d21('0x41')]);_0x43e37d['filters']=_[_0x0d21('0x43')](_0x43e37d['model'],_0x43e37d[_0x0d21('0x41')]);_0x43ba5b['attributes']=_[_0x0d21('0x43')](_0x43e37d[_0x0d21('0x3f')],qs[_0x0d21('0x45')](_0x1417b2[_0x0d21('0x41')][_0x0d21('0x45')]));_0x43ba5b[_0x0d21('0x44')]=_0x43ba5b[_0x0d21('0x44')][_0x0d21('0x46')]?_0x43ba5b[_0x0d21('0x44')]:_0x43e37d[_0x0d21('0x3f')];_0x43ba5b[_0x0d21('0x49')]=qs[_0x0d21('0x4a')](_0x1417b2[_0x0d21('0x41')][_0x0d21('0x4a')]);_0x43ba5b[_0x0d21('0x4b')]=qs[_0x0d21('0x42')](_['pick'](_0x1417b2['query'],_0x43e37d['filters']));if(_0x1417b2['query'][_0x0d21('0x28')]){_0x43ba5b[_0x0d21('0x4b')]=_[_0x0d21('0x34')](_0x43ba5b['where'],{'$or':_[_0x0d21('0x2a')](_0x43ba5b['attributes'],function(_0x28f396){var _0x5966f9={};_0x5966f9[_0x28f396]={'$like':'%'+_0x1417b2['query']['filter']+'%'};return _0x5966f9;})});}_0x43ba5b=_[_0x0d21('0x34')]({},_0x43ba5b,_0x1417b2[_0x0d21('0x52')]);return _0x6af4c4[_0x0d21('0xb1')](_0x43ba5b);}})['then'](function(_0x380088){if(_0x380088){_0x10e56c=_0x380088[_0x0d21('0x46')];if(!_0x1417b2[_0x0d21('0x41')]['hasOwnProperty']('nolimit')){_0x43ba5b[_0x0d21('0x1d')]=qs[_0x0d21('0x1d')](_0x1417b2[_0x0d21('0x41')][_0x0d21('0x1d')]);_0x43ba5b[_0x0d21('0x1c')]=qs[_0x0d21('0x1c')](_0x1417b2[_0x0d21('0x41')][_0x0d21('0x1c')]);}return _0x6af4c4[_0x0d21('0xb1')](_0x43ba5b);}})[_0x0d21('0x23')](function(_0x34bfd7){if(_0x34bfd7){return _0x34bfd7?{'count':_0x10e56c,'rows':_0x34bfd7}:null;}})[_0x0d21('0x23')](respondWithResult(_0x36aaaf,null))[_0x0d21('0x53')](handleError(_0x36aaaf,null));};exports[_0x0d21('0xb3')]=function(_0xcf410d,_0x4edb94,_0x11af9c){var _0x1dd1ac,_0x46ccbe;return db[_0x0d21('0x3c')][_0x0d21('0x2e')]({'where':{'id':_0xcf410d['params']['id']}})['then'](handleEntityNotFound(_0x4edb94,null))['then'](function(_0x22819c){if(_0x22819c){_0x46ccbe=_0x22819c;return _0x22819c[_0x0d21('0xb3')](_0xcf410d[_0x0d21('0x35')][_0x0d21('0x84')],_['omit'](_0xcf410d[_0x0d21('0x35')],[_0x0d21('0x84'),'id'])||{});}return null;})['spread'](function(_0x103a85){var _0x5de67a;_0x1dd1ac=_0x103a85||[];var _0x3d18d3=[];if(_0x103a85){for(var _0x125a0c=0x0;_0x125a0c<_0x103a85[_0x0d21('0x46')];_0x125a0c+=0x1){var _0x2c520a=_0x103a85[_0x125a0c]['get']({'plain':!![]});_0x5de67a=squel[_0x0d21('0x9e')]()[_0x0d21('0xb0')](_0x0d21('0xb4'))[_0x0d21('0xa0')](['phone',_0x0d21('0xa3'),_0x0d21('0xa4'),_0x0d21('0x68'),'createdAt',_0x0d21('0x60')],squel[_0x0d21('0x85')]()['field'](_0x0d21('0xa1'),'phone')[_0x0d21('0x86')]('id','ContactId')[_0x0d21('0x86')](_0x2c520a[_0x0d21('0xa6')]['toString'](),'ListId')[_0x0d21('0x86')](_0xcf410d['params']['id'][_0x0d21('0xa7')](),'VoiceQueueId')[_0x0d21('0x86')]('NOW()','createdAt')['field'](_0x0d21('0xa5'),'updatedAt')[_0x0d21('0xa8')](_0x0d21('0xa9'))['where']('deletedAt\x20IS\x20NULL')[_0x0d21('0x4b')](_0x0d21('0xab'),_0x2c520a[_0x0d21('0xa6')][_0x0d21('0xa7')]())['where'](_0x0d21('0xaf')))[_0x0d21('0xa7')]();_0x3d18d3[_0x0d21('0x96')](db[_0x0d21('0x76')][_0x0d21('0x41')](_0x5de67a));}return BPromise[_0x0d21('0x97')](_0x3d18d3);}})[_0x0d21('0x23')](function(){return _0x1dd1ac;})['then'](respondWithResult(_0x4edb94,null))[_0x0d21('0x53')](handleError(_0x4edb94,null));};exports['removeBlackLists']=function(_0x3aa422,_0x672015,_0x99d727){return db[_0x0d21('0x3c')][_0x0d21('0x2e')]({'where':{'id':_0x3aa422['params']['id']}})['then'](handleEntityNotFound(_0x672015,null))[_0x0d21('0x23')](function(_0x1b9adc){if(_0x1b9adc){return _0x1b9adc[_0x0d21('0xb5')](_0x3aa422[_0x0d21('0x41')]['ids']);}})['then'](function(_0x118c7f){if(_0x118c7f){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x3aa422['query'][_0x0d21('0x84')],'VoiceQueueId':_0x3aa422[_0x0d21('0x50')]['id']}})['then'](function(){return _0x118c7f;});}})[_0x0d21('0x23')](respondWithStatusCode(_0x672015,null))[_0x0d21('0x53')](handleError(_0x672015,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1086e3a..9373a12 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 _0xd943=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x53eda4,_0x167229){var _0x5dbc8d=function(_0x120b8d){while(--_0x120b8d){_0x53eda4['push'](_0x53eda4['shift']());}};_0x5dbc8d(++_0x167229);}(_0xd943,0x137));var _0x3d94=function(_0x35fa1a,_0x18f9ac){_0x35fa1a=_0x35fa1a-0x0;var _0x9d2d9=_0xd943[_0x35fa1a];return _0x9d2d9;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x3d94('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x3d94('0x1')](0x0);var events={'afterCreate':_0x3d94('0x2'),'afterUpdate':_0x3d94('0x3'),'afterDestroy':_0x3d94('0x4')};function emitEvent(_0x2ce21e){return function(_0x273353,_0x501175,_0x4eac54){VoiceQueueEvents[_0x3d94('0x5')](_0x2ce21e+':'+_0x273353['id'],_0x273353);VoiceQueueEvents[_0x3d94('0x5')](_0x2ce21e,_0x273353);_0x4eac54(null);};}for(var e in events){if(events[_0x3d94('0x6')](e)){var event=events[e];VoiceQueue[_0x3d94('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x1ae0=['emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue','setMaxListeners','save','update'];(function(_0x5edf3a,_0x27276c){var _0x3236f9=function(_0x447956){while(--_0x447956){_0x5edf3a['push'](_0x5edf3a['shift']());}};_0x3236f9(++_0x27276c);}(_0x1ae0,0xb8));var _0x01ae=function(_0x4fa738,_0x2a491c){_0x4fa738=_0x4fa738-0x0;var _0x55bf55=_0x1ae0[_0x4fa738];return _0x55bf55;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x01ae('0x0'))['db'][_0x01ae('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x01ae('0x2')](0x0);var events={'afterCreate':_0x01ae('0x3'),'afterUpdate':_0x01ae('0x4'),'afterDestroy':'remove'};function emitEvent(_0x45598b){return function(_0x45ede9,_0x3d8540,_0x2d6369){VoiceQueueEvents[_0x01ae('0x5')](_0x45598b+':'+_0x45ede9['id'],_0x45ede9);VoiceQueueEvents[_0x01ae('0x5')](_0x45598b,_0x45ede9);_0x2d6369(null);};}for(var e in events){if(events[_0x01ae('0x6')](e)){var event=events[e];VoiceQueue[_0x01ae('0x7')](e,emitEvent(event));}}module[_0x01ae('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 0599a7e..e2df2bf 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 _0x1a69=['voice_queues','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceQueue.attributes','define','VoiceQueue'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1a69,0xe5));var _0x91a6=function(_0x5759fb,_0x2ec538){_0x5759fb=_0x5759fb-0x0;var _0x4f03a9=_0x1a69[_0x5759fb];return _0x4f03a9;};'use strict';var _=require(_0x91a6('0x0'));var util=require(_0x91a6('0x1'));var logger=require(_0x91a6('0x2'))(_0x91a6('0x3'));var moment=require(_0x91a6('0x4'));var BPromise=require(_0x91a6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x91a6('0x6'));var config=require(_0x91a6('0x7'));var attributes=require(_0x91a6('0x8'));module['exports']=function(_0x45220a,_0x11d50e){return _0x45220a[_0x91a6('0x9')](_0x91a6('0xa'),attributes,{'tableName':_0x91a6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9302=['util','api','bluebird','request-promise','rimraf','../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues'];(function(_0x36358f,_0x41bf85){var _0x5ce44e=function(_0x193322){while(--_0x193322){_0x36358f['push'](_0x36358f['shift']());}};_0x5ce44e(++_0x41bf85);}(_0x9302,0xdc));var _0x2930=function(_0x7390d4,_0x398159){_0x7390d4=_0x7390d4-0x0;var _0x1554a9=_0x9302[_0x7390d4];return _0x1554a9;};'use strict';var _=require('lodash');var util=require(_0x2930('0x0'));var logger=require('../../config/logger')(_0x2930('0x1'));var moment=require('moment');var BPromise=require(_0x2930('0x2'));var rp=require(_0x2930('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2930('0x4'));var config=require(_0x2930('0x5'));var attributes=require(_0x2930('0x6'));module[_0x2930('0x7')]=function(_0x54cf71,_0xfc6d9e){return _0x54cf71[_0x2930('0x8')](_0x2930('0x9'),attributes,{'tableName':_0x2930('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 056f3ae..722c3db 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 _0xfc25=['options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xfc25,0x130));var _0x5fc2=function(_0x3460a6,_0x512b33){_0x3460a6=_0x3460a6-0x0;var _0x1a63d6=_0xfc25[_0x3460a6];return _0x1a63d6;};'use strict';var _=require(_0x5fc2('0x0'));var util=require('util');var moment=require(_0x5fc2('0x1'));var BPromise=require(_0x5fc2('0x2'));var rs=require(_0x5fc2('0x3'));var fs=require('fs');var Redis=require(_0x5fc2('0x4'));var db=require(_0x5fc2('0x5'))['db'];var utils=require(_0x5fc2('0x6'));var logger=require(_0x5fc2('0x7'))(_0x5fc2('0x8'));var config=require(_0x5fc2('0x9'));var jayson=require(_0x5fc2('0xa'));var client=jayson[_0x5fc2('0xb')]['http']({'port':0x232a});config[_0x5fc2('0xc')]=_[_0x5fc2('0xd')](config[_0x5fc2('0xc')],{'host':_0x5fc2('0xe'),'port':0x18eb});var socket=require(_0x5fc2('0xf'))(new Redis(config['redis']));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3091e6,_0x10b1fb,_0x58a962){return new BPromise(function(_0x35b9b4,_0x3cb17b){return client[_0x5fc2('0x10')](_0x3091e6,_0x58a962)[_0x5fc2('0x11')](function(_0x4d9e0b){logger['info'](_0x5fc2('0x12'),_0x10b1fb,'request\x20sent');logger[_0x5fc2('0x13')](_0x5fc2('0x14'),_0x10b1fb,_0x5fc2('0x15'),JSON[_0x5fc2('0x16')](_0x4d9e0b));if(_0x4d9e0b['error']){if(_0x4d9e0b[_0x5fc2('0x17')][_0x5fc2('0x18')]===0x1f4){logger['error'](_0x5fc2('0x12'),_0x10b1fb,_0x4d9e0b[_0x5fc2('0x17')]['message']);return _0x3cb17b(_0x4d9e0b[_0x5fc2('0x17')]['message']);}logger['error'](_0x5fc2('0x12'),_0x10b1fb,_0x4d9e0b[_0x5fc2('0x17')][_0x5fc2('0x19')]);return _0x35b9b4(_0x4d9e0b[_0x5fc2('0x17')]['message']);}else{logger[_0x5fc2('0x1a')](_0x5fc2('0x12'),_0x10b1fb,_0x5fc2('0x15'));_0x35b9b4(_0x4d9e0b[_0x5fc2('0x1b')]['message']);}})[_0x5fc2('0x1c')](function(_0x44ec26){logger[_0x5fc2('0x17')](_0x5fc2('0x12'),_0x10b1fb,_0x44ec26);_0x3cb17b(_0x44ec26);});});}exports[_0x5fc2('0x1d')]=function(_0xe9aad0){var _0x1eb154=this;return new Promise(function(_0x1c9c51,_0x4a25af){return db[_0x5fc2('0x1e')][_0x5fc2('0x1f')]({'raw':_0xe9aad0[_0x5fc2('0x20')]?_0xe9aad0['options'][_0x5fc2('0x21')]===undefined?!![]:![]:!![],'where':_0xe9aad0[_0x5fc2('0x20')]?_0xe9aad0[_0x5fc2('0x20')][_0x5fc2('0x22')]||null:null,'attributes':_0xe9aad0[_0x5fc2('0x20')]?_0xe9aad0[_0x5fc2('0x20')][_0x5fc2('0x23')]||null:null,'limit':_0xe9aad0[_0x5fc2('0x20')]?_0xe9aad0[_0x5fc2('0x20')][_0x5fc2('0x24')]||null:null,'include':_0xe9aad0[_0x5fc2('0x20')]?_0xe9aad0[_0x5fc2('0x20')][_0x5fc2('0x25')]?_[_0x5fc2('0x26')](_0xe9aad0[_0x5fc2('0x20')][_0x5fc2('0x25')],function(_0x2d9530){return{'model':db[_0x2d9530[_0x5fc2('0x27')]],'as':_0x2d9530['as'],'attributes':_0x2d9530[_0x5fc2('0x23')],'include':_0x2d9530['include']?_[_0x5fc2('0x26')](_0x2d9530[_0x5fc2('0x25')],function(_0x2f35d9){return{'model':db[_0x2f35d9[_0x5fc2('0x27')]],'as':_0x2f35d9['as'],'attributes':_0x2f35d9[_0x5fc2('0x23')],'include':_0x2f35d9[_0x5fc2('0x25')]?_['map'](_0x2f35d9['include'],function(_0x1c6fd6){return{'model':db[_0x1c6fd6[_0x5fc2('0x27')]],'as':_0x1c6fd6['as'],'attributes':_0x1c6fd6[_0x5fc2('0x23')]};}):[]};}):[]};}):[]:[]})[_0x5fc2('0x11')](function(_0x104cdd){logger[_0x5fc2('0x1a')](_0x5fc2('0x1d'),_0xe9aad0);logger[_0x5fc2('0x13')](_0x5fc2('0x1d'),_0xe9aad0,JSON['stringify'](_0x104cdd));_0x1c9c51(_0x104cdd);})['catch'](function(_0x545620){logger['error'](_0x5fc2('0x1d'),_0x545620[_0x5fc2('0x19')],_0xe9aad0);_0x4a25af(_0x1eb154['error'](0x1f4,_0x545620[_0x5fc2('0x19')]));});});};exports[_0x5fc2('0x28')]=function(_0x43332e){var _0x22a3dd=this;return new Promise(function(_0x476939,_0x3bea6b){return db['VoiceQueue'][_0x5fc2('0x29')]({'raw':_0x43332e[_0x5fc2('0x20')]?_0x43332e[_0x5fc2('0x20')][_0x5fc2('0x21')]===undefined?!![]:![]:!![],'where':_0x43332e[_0x5fc2('0x20')]?_0x43332e[_0x5fc2('0x20')][_0x5fc2('0x22')]||null:null,'attributes':_0x43332e[_0x5fc2('0x20')]?_0x43332e[_0x5fc2('0x20')]['attributes']||null:null,'include':_0x43332e['options']?_0x43332e[_0x5fc2('0x20')][_0x5fc2('0x25')]?_[_0x5fc2('0x26')](_0x43332e['options']['include'],function(_0x563bdf){return{'model':db[_0x563bdf[_0x5fc2('0x27')]],'as':_0x563bdf['as'],'attributes':_0x563bdf['attributes'],'include':_0x563bdf[_0x5fc2('0x25')]?_[_0x5fc2('0x26')](_0x563bdf[_0x5fc2('0x25')],function(_0x527c7e){return{'model':db[_0x527c7e[_0x5fc2('0x27')]],'as':_0x527c7e['as'],'attributes':_0x527c7e[_0x5fc2('0x23')],'include':_0x527c7e[_0x5fc2('0x25')]?_['map'](_0x527c7e[_0x5fc2('0x25')],function(_0x4e18a7){return{'model':db[_0x4e18a7[_0x5fc2('0x27')]],'as':_0x4e18a7['as'],'attributes':_0x4e18a7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4508d4){logger[_0x5fc2('0x1a')](_0x5fc2('0x28'),_0x43332e);logger[_0x5fc2('0x13')](_0x5fc2('0x28'),_0x43332e,JSON[_0x5fc2('0x16')](_0x4508d4));_0x476939(_0x4508d4);})[_0x5fc2('0x1c')](function(_0x42f8f7){logger['error']('ShowVoiceQueue',_0x42f8f7[_0x5fc2('0x19')],_0x43332e);_0x3bea6b(_0x22a3dd[_0x5fc2('0x17')](0x1f4,_0x42f8f7['message']));});});}; \ No newline at end of file +var _0x3a02=['code','message','result','VoiceQueue','options','raw','attributes','include','model','map','GetVoiceQueue','debug','ShowVoiceQueue','find','where','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./voiceQueue.socket','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3851be,_0x523903){var _0xdf3491=function(_0x9c1e27){while(--_0x9c1e27){_0x3851be['push'](_0x3851be['shift']());}};_0xdf3491(++_0x523903);}(_0x3a02,0x196));var _0x23a0=function(_0x2e8327,_0x1342f9){_0x2e8327=_0x2e8327-0x0;var _0x1100da=_0x3a02[_0x2e8327];return _0x1100da;};'use strict';var _=require(_0x23a0('0x0'));var util=require(_0x23a0('0x1'));var moment=require(_0x23a0('0x2'));var BPromise=require(_0x23a0('0x3'));var rs=require(_0x23a0('0x4'));var fs=require('fs');var Redis=require(_0x23a0('0x5'));var db=require(_0x23a0('0x6'))['db'];var utils=require(_0x23a0('0x7'));var logger=require(_0x23a0('0x8'))(_0x23a0('0x9'));var config=require('../../config/environment');var jayson=require(_0x23a0('0xa'));var client=jayson[_0x23a0('0xb')][_0x23a0('0xc')]({'port':0x232a});config[_0x23a0('0xd')]=_[_0x23a0('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x23a0('0xd')]));require(_0x23a0('0xf'))['register'](socket);function respondWithRpcPromise(_0x186e36,_0xe203a3,_0x1a3a49){return new BPromise(function(_0x3a8c69,_0x538b57){return client['request'](_0x186e36,_0x1a3a49)[_0x23a0('0x10')](function(_0x4966c6){logger[_0x23a0('0x11')](_0x23a0('0x12'),_0xe203a3,_0x23a0('0x13'));logger['debug'](_0x23a0('0x14'),_0xe203a3,_0x23a0('0x13'),JSON[_0x23a0('0x15')](_0x4966c6));if(_0x4966c6[_0x23a0('0x16')]){if(_0x4966c6[_0x23a0('0x16')][_0x23a0('0x17')]===0x1f4){logger[_0x23a0('0x16')](_0x23a0('0x12'),_0xe203a3,_0x4966c6[_0x23a0('0x16')][_0x23a0('0x18')]);return _0x538b57(_0x4966c6[_0x23a0('0x16')][_0x23a0('0x18')]);}logger['error'](_0x23a0('0x12'),_0xe203a3,_0x4966c6[_0x23a0('0x16')][_0x23a0('0x18')]);return _0x3a8c69(_0x4966c6[_0x23a0('0x16')][_0x23a0('0x18')]);}else{logger[_0x23a0('0x11')]('VoiceQueue,\x20%s,\x20%s',_0xe203a3,_0x23a0('0x13'));_0x3a8c69(_0x4966c6[_0x23a0('0x19')][_0x23a0('0x18')]);}})['catch'](function(_0x1fb43c){logger[_0x23a0('0x16')](_0x23a0('0x12'),_0xe203a3,_0x1fb43c);_0x538b57(_0x1fb43c);});});}exports['GetVoiceQueue']=function(_0x1f48b1){var _0x23cfda=this;return new Promise(function(_0x7cb97d,_0x36c4d4){return db[_0x23a0('0x1a')]['findAll']({'raw':_0x1f48b1[_0x23a0('0x1b')]?_0x1f48b1[_0x23a0('0x1b')][_0x23a0('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f48b1[_0x23a0('0x1b')]?_0x1f48b1[_0x23a0('0x1b')]['where']||null:null,'attributes':_0x1f48b1['options']?_0x1f48b1[_0x23a0('0x1b')][_0x23a0('0x1d')]||null:null,'limit':_0x1f48b1['options']?_0x1f48b1[_0x23a0('0x1b')]['limit']||null:null,'include':_0x1f48b1['options']?_0x1f48b1[_0x23a0('0x1b')][_0x23a0('0x1e')]?_['map'](_0x1f48b1[_0x23a0('0x1b')][_0x23a0('0x1e')],function(_0x5b63b0){return{'model':db[_0x5b63b0[_0x23a0('0x1f')]],'as':_0x5b63b0['as'],'attributes':_0x5b63b0[_0x23a0('0x1d')],'include':_0x5b63b0[_0x23a0('0x1e')]?_['map'](_0x5b63b0['include'],function(_0x1e5518){return{'model':db[_0x1e5518[_0x23a0('0x1f')]],'as':_0x1e5518['as'],'attributes':_0x1e5518[_0x23a0('0x1d')],'include':_0x1e5518['include']?_[_0x23a0('0x20')](_0x1e5518[_0x23a0('0x1e')],function(_0x359b23){return{'model':db[_0x359b23[_0x23a0('0x1f')]],'as':_0x359b23['as'],'attributes':_0x359b23[_0x23a0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x23a0('0x10')](function(_0x5ea973){logger[_0x23a0('0x11')](_0x23a0('0x21'),_0x1f48b1);logger[_0x23a0('0x22')](_0x23a0('0x21'),_0x1f48b1,JSON[_0x23a0('0x15')](_0x5ea973));_0x7cb97d(_0x5ea973);})['catch'](function(_0x5ee017){logger[_0x23a0('0x16')](_0x23a0('0x21'),_0x5ee017[_0x23a0('0x18')],_0x1f48b1);_0x36c4d4(_0x23cfda[_0x23a0('0x16')](0x1f4,_0x5ee017['message']));});});};exports[_0x23a0('0x23')]=function(_0x577c61){var _0x6adeeb=this;return new Promise(function(_0x77b6c9,_0x2f4eb1){return db['VoiceQueue'][_0x23a0('0x24')]({'raw':_0x577c61[_0x23a0('0x1b')]?_0x577c61[_0x23a0('0x1b')][_0x23a0('0x1c')]===undefined?!![]:![]:!![],'where':_0x577c61[_0x23a0('0x1b')]?_0x577c61[_0x23a0('0x1b')][_0x23a0('0x25')]||null:null,'attributes':_0x577c61[_0x23a0('0x1b')]?_0x577c61['options'][_0x23a0('0x1d')]||null:null,'include':_0x577c61['options']?_0x577c61[_0x23a0('0x1b')][_0x23a0('0x1e')]?_[_0x23a0('0x20')](_0x577c61[_0x23a0('0x1b')][_0x23a0('0x1e')],function(_0x5912ac){return{'model':db[_0x5912ac['model']],'as':_0x5912ac['as'],'attributes':_0x5912ac['attributes'],'include':_0x5912ac['include']?_[_0x23a0('0x20')](_0x5912ac['include'],function(_0xff91bf){return{'model':db[_0xff91bf[_0x23a0('0x1f')]],'as':_0xff91bf['as'],'attributes':_0xff91bf[_0x23a0('0x1d')],'include':_0xff91bf[_0x23a0('0x1e')]?_[_0x23a0('0x20')](_0xff91bf['include'],function(_0xe43fda){return{'model':db[_0xe43fda[_0x23a0('0x1f')]],'as':_0xe43fda['as'],'attributes':_0xe43fda[_0x23a0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x23a0('0x10')](function(_0x686944){logger[_0x23a0('0x11')](_0x23a0('0x23'),_0x577c61);logger['debug'](_0x23a0('0x23'),_0x577c61,JSON[_0x23a0('0x15')](_0x686944));_0x77b6c9(_0x686944);})[_0x23a0('0x26')](function(_0x305b4a){logger[_0x23a0('0x16')]('ShowVoiceQueue',_0x305b4a['message'],_0x577c61);_0x2f4eb1(_0x6adeeb[_0x23a0('0x16')](0x1f4,_0x305b4a['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index adac66f..b411a4a 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 _0x196d=['voiceQueue:','./voiceQueue.events','save','remove','emit','register','length'];(function(_0x216855,_0x223341){var _0x365c34=function(_0x323762){while(--_0x323762){_0x216855['push'](_0x216855['shift']());}};_0x365c34(++_0x223341);}(_0x196d,0x112));var _0xd196=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x196d[_0x4a9fb1];return _0x348672;};'use strict';var VoiceQueueEvents=require(_0xd196('0x0'));var events=[_0xd196('0x1'),_0xd196('0x2'),'update'];function createListener(_0x28b6c6,_0x5886b3){return function(_0x2ab991){_0x5886b3[_0xd196('0x3')](_0x28b6c6,_0x2ab991);};}function removeListener(_0x58da56,_0x167cdd){return function(){VoiceQueueEvents['removeListener'](_0x58da56,_0x167cdd);};}exports[_0xd196('0x4')]=function(_0x4918d9){for(var _0x268927=0x0,_0x3beaa7=events[_0xd196('0x5')];_0x268927<_0x3beaa7;_0x268927++){var _0x3da05c=events[_0x268927];var _0x50e975=createListener(_0xd196('0x6')+_0x3da05c,_0x4918d9);VoiceQueueEvents['on'](_0x3da05c,_0x50e975);}}; \ No newline at end of file +var _0xf29f=['voiceQueue:','save','remove','update','register','length'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xf29f,0x18d));var _0xff29=function(_0x52648f,_0x5d1c83){_0x52648f=_0x52648f-0x0;var _0x3eeff9=_0xf29f[_0x52648f];return _0x3eeff9;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xff29('0x0'),_0xff29('0x1'),_0xff29('0x2')];function createListener(_0x541750,_0x9b4a8c){return function(_0x30b850){_0x9b4a8c['emit'](_0x541750,_0x30b850);};}function removeListener(_0xeb0c24,_0x2c0125){return function(){VoiceQueueEvents['removeListener'](_0xeb0c24,_0x2c0125);};}exports[_0xff29('0x3')]=function(_0xbbe36b){for(var _0x4c814b=0x0,_0x566021=events[_0xff29('0x4')];_0x4c814b<_0x566021;_0x4c814b++){var _0x4faeb5=events[_0x4c814b];var _0x27df58=createListener(_0xff29('0x5')+_0x4faeb5,_0xbbe36b);VoiceQueueEvents['on'](_0x4faeb5,_0x27df58);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 5a0c7e3..50619b1 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 _0x8bd7=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','delete','destroy'];(function(_0x413cf7,_0x306286){var _0x5beb59=function(_0x4fb1f9){while(--_0x4fb1f9){_0x413cf7['push'](_0x413cf7['shift']());}};_0x5beb59(++_0x306286);}(_0x8bd7,0xdc));var _0x78bd=function(_0x161abe,_0x35bb58){_0x161abe=_0x161abe-0x0;var _0x1a76f6=_0x8bd7[_0x161abe];return _0x1a76f6;};'use strict';var multer=require(_0x78bd('0x0'));var util=require(_0x78bd('0x1'));var path=require(_0x78bd('0x2'));var timeout=require(_0x78bd('0x3'));var express=require(_0x78bd('0x4'));var router=express[_0x78bd('0x5')]();var fs_extra=require(_0x78bd('0x6'));var auth=require(_0x78bd('0x7'));var interaction=require(_0x78bd('0x8'));var config=require(_0x78bd('0x9'));var controller=require(_0x78bd('0xa'));router[_0x78bd('0xb')]('/',auth[_0x78bd('0xc')](),controller[_0x78bd('0xd')]);router[_0x78bd('0xb')](_0x78bd('0xe'),auth[_0x78bd('0xc')](),controller[_0x78bd('0xf')]);router[_0x78bd('0xb')](_0x78bd('0x10'),auth['isAuthenticated'](),controller[_0x78bd('0x11')]);router[_0x78bd('0xb')](_0x78bd('0x12'),auth[_0x78bd('0xc')](),controller[_0x78bd('0x13')]);router['post']('/',auth[_0x78bd('0xc')](),controller['create']);router['put']('/:id',auth[_0x78bd('0xc')](),controller['update']);router[_0x78bd('0x14')](_0x78bd('0x12'),auth['isAuthenticated'](),controller[_0x78bd('0x15')]);module['exports']=router; \ No newline at end of file +var _0x8334=['fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','post','create','put','/:id','delete','destroy','exports','multer','util','express','Router'];(function(_0x5592ac,_0x53136c){var _0x456dd2=function(_0x3df19b){while(--_0x3df19b){_0x5592ac['push'](_0x5592ac['shift']());}};_0x456dd2(++_0x53136c);}(_0x8334,0x96));var _0x4833=function(_0x404c67,_0x342af1){_0x404c67=_0x404c67-0x0;var _0x3e20bc=_0x8334[_0x404c67];return _0x3e20bc;};'use strict';var multer=require(_0x4833('0x0'));var util=require(_0x4833('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4833('0x2'));var router=express[_0x4833('0x3')]();var fs_extra=require(_0x4833('0x4'));var auth=require(_0x4833('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4833('0x6'));var controller=require(_0x4833('0x7'));router[_0x4833('0x8')]('/',auth[_0x4833('0x9')](),controller[_0x4833('0xa')]);router[_0x4833('0x8')](_0x4833('0xb'),auth[_0x4833('0x9')](),controller[_0x4833('0xc')]);router[_0x4833('0x8')](_0x4833('0xd'),auth[_0x4833('0x9')](),controller[_0x4833('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4833('0xf')]('/',auth[_0x4833('0x9')](),controller[_0x4833('0x10')]);router[_0x4833('0x11')](_0x4833('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x4833('0x13')]('/:id',auth[_0x4833('0x9')](),controller[_0x4833('0x14')]);module[_0x4833('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 de6e83e..37403a5 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 _0x70e0=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x5dcf44,_0x57b9d1){var _0x28ad23=function(_0x2702f2){while(--_0x2702f2){_0x5dcf44['push'](_0x5dcf44['shift']());}};_0x28ad23(++_0x57b9d1);}(_0x70e0,0x17b));var _0x070e=function(_0x41eb32,_0x6d9f60){_0x41eb32=_0x41eb32-0x0;var _0x4c46c6=_0x70e0[_0x41eb32];return _0x4c46c6;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));module[_0x070e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x070e('0x3')]},'calleridname':{'type':Sequelize[_0x070e('0x3')]},'queue':{'type':Sequelize[_0x070e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x7bce9b){var _0x579a6b=moment(_0x7bce9b);var _0x46fe68=moment(this['getDataValue']('queuecallerjoinAt'))['format'](_0x070e('0x5'));var _0x1e11f0=_0x579a6b[_0x070e('0x6')](_0x46fe68,_0x070e('0x7'));this[_0x070e('0x8')](_0x070e('0x9'),_0x7bce9b);this[_0x070e('0x8')]('holdtime',_0x1e11f0||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x070e('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerexit':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x070e('0x3')],'comment':_0x070e('0xc')},'originalposition':{'type':Sequelize[_0x070e('0xa')]},'channel':{'type':Sequelize[_0x070e('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x070e('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x070e('0xa')]},'mohtime':{'type':Sequelize[_0x070e('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x070e('0x3')],'comment':_0x070e('0xd')},'transferexten':{'type':Sequelize[_0x070e('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x070e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x070e('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x070e('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcb91=['setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0xcb91[_0x39872b];return _0x55fa18;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1cb9('0x0')]={'type':{'type':Sequelize[_0x1cb9('0x1')]},'uniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'calleridnum':{'type':Sequelize[_0x1cb9('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x13d5fd){var _0x1b26cd=moment(_0x13d5fd);var _0x53ffbd=moment(this[_0x1cb9('0x3')](_0x1cb9('0x4')))['format'](_0x1cb9('0x5'));var _0x12567c=_0x1b26cd['diff'](_0x53ffbd,_0x1cb9('0x6'));this['setDataValue']('queuecallerleaveAt',_0x13d5fd);this[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x12567c||null);}},'position':{'type':Sequelize[_0x1cb9('0x9')]},'count':{'type':Sequelize[_0x1cb9('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexit':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x1cb9('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1cb9('0x1')]},'connectedlinename':{'type':Sequelize[_0x1cb9('0x1')]},'accountcode':{'type':Sequelize[_0x1cb9('0x1')]},'context':{'type':Sequelize[_0x1cb9('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1cb9('0x1')]},'holdtime':{'type':Sequelize[_0x1cb9('0x9')]},'mohtime':{'type':Sequelize[_0x1cb9('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1cb9('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x1cb9('0xb')},'transferexten':{'type':Sequelize[_0x1cb9('0x1')]},'transferuniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'disposition':{'type':Sequelize[_0x1cb9('0x1')]},'secondDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'thirdDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x1cb9('0x9')],'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 8dccaca..f0965bf 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 _0x5a93=['crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','stack','name','body','message','agent','interaction','map','VoiceQueueReport','rawAttributes','fieldName','type','key','query','keys','model','intersection','fields','length','attributes','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','destroy','describe','getVoiceQueuesReport','hasOwnProperty','pick','findAll','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a93,0xe7));var _0x35a9=function(_0x399b8c,_0x2f28c2){_0x399b8c=_0x399b8c-0x0;var _0x431d05=_0x5a93[_0x399b8c];return _0x431d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35a9('0x0'));var zipdir=require(_0x35a9('0x1'));var jsonpatch=require(_0x35a9('0x2'));var rp=require('request-promise');var moment=require(_0x35a9('0x3'));var BPromise=require(_0x35a9('0x4'));var Mustache=require(_0x35a9('0x5'));var util=require('util');var path=require(_0x35a9('0x6'));var sox=require(_0x35a9('0x7'));var csv=require(_0x35a9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x35a9('0x9'));var _=require(_0x35a9('0xa'));var squel=require(_0x35a9('0xb'));var crypto=require(_0x35a9('0xc'));var jsforce=require(_0x35a9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x35a9('0x8'));var querystring=require(_0x35a9('0xe'));var Papa=require('papaparse');var Redis=require(_0x35a9('0xf'));var authService=require(_0x35a9('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35a9('0x11'));var logger=require(_0x35a9('0x12'))(_0x35a9('0x13'));var utils=require('../../config/utils');var config=require(_0x35a9('0x14'));var licenseUtil=require(_0x35a9('0x15'));var db=require('../../mysqldb')['db'];config[_0x35a9('0x16')]=_[_0x35a9('0x17')](config[_0x35a9('0x16')],{'host':_0x35a9('0x18'),'port':0x18eb});var socket=require(_0x35a9('0x19'))(new Redis(config[_0x35a9('0x16')]));require(_0x35a9('0x1a'))['register'](socket);function respondWithStatusCode(_0x3459d2,_0x1f83ac){_0x1f83ac=_0x1f83ac||0xcc;return function(_0x1f2584){if(_0x1f2584){return _0x3459d2[_0x35a9('0x1b')](_0x1f83ac);}return _0x3459d2[_0x35a9('0x1c')](_0x1f83ac)[_0x35a9('0x1d')]();};}function respondWithResult(_0x21e3eb,_0x28a7f6){_0x28a7f6=_0x28a7f6||0xc8;return function(_0x30daa2){if(_0x30daa2){return _0x21e3eb[_0x35a9('0x1c')](_0x28a7f6)[_0x35a9('0x1e')](_0x30daa2);}};}function respondWithFilteredResult(_0x86df43,_0x1b976b){return function(_0x2a6423){if(_0x2a6423){var _0x427fe4=typeof _0x1b976b[_0x35a9('0x1f')]===_0x35a9('0x20')&&typeof _0x1b976b[_0x35a9('0x21')]===_0x35a9('0x20');var _0x51ca24=_0x2a6423[_0x35a9('0x22')];var _0x4fd38b=_0x427fe4?0x0:_0x1b976b[_0x35a9('0x1f')];var _0x36be28=_0x427fe4?_0x2a6423['count']:_0x1b976b['offset']+_0x1b976b[_0x35a9('0x21')];var _0x123b12;if(_0x36be28>=_0x51ca24){_0x36be28=_0x51ca24;_0x123b12=0xc8;}else{_0x123b12=0xce;}_0x86df43[_0x35a9('0x1c')](_0x123b12);return _0x86df43[_0x35a9('0x23')](_0x35a9('0x24'),_0x4fd38b+'-'+_0x36be28+'/'+_0x51ca24)[_0x35a9('0x1e')](_0x2a6423);}return null;};}function patchUpdates(_0x45ba3e){return function(_0xed3e3d){try{jsonpatch[_0x35a9('0x25')](_0xed3e3d,_0x45ba3e,!![]);}catch(_0x2d80d8){return BPromise['reject'](_0x2d80d8);}return _0xed3e3d['save']();};}function saveUpdates(_0x1d67bd,_0x369ec1){return function(_0x1e7bef){if(_0x1e7bef){return _0x1e7bef[_0x35a9('0x26')](_0x1d67bd)['then'](function(_0x5360dd){return _0x5360dd;});}return null;};}function removeEntity(_0x1c2cc0,_0x382a88){return function(_0x148036){if(_0x148036){return _0x148036['destroy']()[_0x35a9('0x27')](function(){_0x1c2cc0[_0x35a9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b16ae,_0x14a040){return function(_0x4cb7ac){if(!_0x4cb7ac){_0x1b16ae[_0x35a9('0x1b')](0x194);}return _0x4cb7ac;};}function handleError(_0x458760,_0x4a4f88){_0x4a4f88=_0x4a4f88||0x1f4;return function(_0x5d0c5){logger['error'](_0x5d0c5[_0x35a9('0x28')]);if(_0x5d0c5[_0x35a9('0x29')]){delete _0x5d0c5[_0x35a9('0x29')];}_0x458760['status'](_0x4a4f88)['send'](_0x5d0c5);};}function getMustacheRender(_0x117cdc,_0x2c3449){return Mustache['render'](_0x117cdc,_['merge'](_0x2c3449[_0x35a9('0x2a')],{'contact':_0x2c3449['contact'],'message':_0x2c3449[_0x35a9('0x2b')],'agent':_0x2c3449[_0x35a9('0x2c')],'interaction':_0x2c3449[_0x35a9('0x2d')],'account':_0x2c3449['account']}))||'';}exports['index']=function(_0xc69d90,_0x445bcb){var _0x2fefc7={},_0x32bbd3={},_0x274d8b={'count':0x0,'rows':[]};var _0x1eca35=_[_0x35a9('0x2e')](db[_0x35a9('0x2f')][_0x35a9('0x30')],function(_0x302244){return{'name':_0x302244[_0x35a9('0x31')],'type':_0x302244[_0x35a9('0x32')][_0x35a9('0x33')]};});_0x32bbd3['model']=_['map'](_0x1eca35,_0x35a9('0x29'));_0x32bbd3[_0x35a9('0x34')]=_[_0x35a9('0x35')](_0xc69d90[_0x35a9('0x34')]);_0x32bbd3['filters']=_['intersection'](_0x32bbd3[_0x35a9('0x36')],_0x32bbd3[_0x35a9('0x34')]);_0x2fefc7['attributes']=_[_0x35a9('0x37')](_0x32bbd3[_0x35a9('0x36')],qs[_0x35a9('0x38')](_0xc69d90[_0x35a9('0x34')][_0x35a9('0x38')]));_0x2fefc7['attributes']=_0x2fefc7['attributes'][_0x35a9('0x39')]?_0x2fefc7[_0x35a9('0x3a')]:_0x32bbd3[_0x35a9('0x36')];if(!_0xc69d90[_0x35a9('0x34')]['hasOwnProperty'](_0x35a9('0x3b'))){_0x2fefc7['limit']=qs['limit'](_0xc69d90[_0x35a9('0x34')]['limit']);_0x2fefc7['offset']=qs[_0x35a9('0x1f')](_0xc69d90[_0x35a9('0x34')][_0x35a9('0x1f')]);}_0x2fefc7[_0x35a9('0x3c')]=qs[_0x35a9('0x3d')](_0xc69d90[_0x35a9('0x34')][_0x35a9('0x3d')]);_0x2fefc7[_0x35a9('0x3e')]=qs[_0x35a9('0x3f')](_['pick'](_0xc69d90['query'],_0x32bbd3[_0x35a9('0x3f')]),_0x1eca35);if(_0xc69d90['query'][_0x35a9('0x40')]){_0x2fefc7[_0x35a9('0x3e')]=_[_0x35a9('0x41')](_0x2fefc7[_0x35a9('0x3e')],{'$or':_['map'](_0x1eca35,function(_0x38256){if(_0x38256[_0x35a9('0x32')]!==_0x35a9('0x42')){var _0x979a69={};_0x979a69[_0x38256[_0x35a9('0x29')]]={'$like':'%'+_0xc69d90[_0x35a9('0x34')][_0x35a9('0x40')]+'%'};return _0x979a69;}})});}_0x2fefc7=_[_0x35a9('0x41')]({},_0x2fefc7,_0xc69d90['options']);var _0x39deac={'where':_0x2fefc7['where']};return db[_0x35a9('0x2f')]['count'](_0x39deac)['then'](function(_0x5aeffd){_0x274d8b[_0x35a9('0x22')]=_0x5aeffd;if(_0xc69d90['query'][_0x35a9('0x43')]){_0x2fefc7[_0x35a9('0x44')]=[{'all':!![]}];}return db[_0x35a9('0x2f')]['findAll'](_0x2fefc7);})[_0x35a9('0x27')](function(_0x1500ce){_0x274d8b[_0x35a9('0x45')]=_0x1500ce;return _0x274d8b;})[_0x35a9('0x27')](respondWithFilteredResult(_0x445bcb,_0x2fefc7))[_0x35a9('0x46')](handleError(_0x445bcb,null));};exports[_0x35a9('0x47')]=function(_0x33d94c,_0x3b7fd2){var _0x561ec3={'raw':![],'where':{'id':_0x33d94c[_0x35a9('0x48')]['id']}},_0x51cf2c={};_0x51cf2c[_0x35a9('0x36')]=_[_0x35a9('0x35')](db['VoiceQueueReport'][_0x35a9('0x30')]);_0x51cf2c[_0x35a9('0x34')]=_[_0x35a9('0x35')](_0x33d94c['query']);_0x51cf2c['filters']=_['intersection'](_0x51cf2c[_0x35a9('0x36')],_0x51cf2c[_0x35a9('0x34')]);_0x561ec3[_0x35a9('0x3a')]=_[_0x35a9('0x37')](_0x51cf2c[_0x35a9('0x36')],qs[_0x35a9('0x38')](_0x33d94c['query'][_0x35a9('0x38')]));_0x561ec3[_0x35a9('0x3a')]=_0x561ec3[_0x35a9('0x3a')][_0x35a9('0x39')]?_0x561ec3['attributes']:_0x51cf2c[_0x35a9('0x36')];if(_0x33d94c[_0x35a9('0x34')]['includeAll']){_0x561ec3[_0x35a9('0x44')]=[{'all':!![]}];}_0x561ec3=_['merge']({},_0x561ec3,_0x33d94c[_0x35a9('0x49')]);return db['VoiceQueueReport'][_0x35a9('0x4a')](_0x561ec3)['then'](handleEntityNotFound(_0x3b7fd2,null))[_0x35a9('0x27')](respondWithResult(_0x3b7fd2,null))[_0x35a9('0x46')](handleError(_0x3b7fd2,null));};exports['create']=function(_0x451c1c,_0x305ab2){return db[_0x35a9('0x2f')]['create'](_0x451c1c[_0x35a9('0x2a')],{})[_0x35a9('0x27')](respondWithResult(_0x305ab2,0xc9))[_0x35a9('0x46')](handleError(_0x305ab2,null));};exports[_0x35a9('0x26')]=function(_0x1bb0d2,_0x3bf3ae){if(_0x1bb0d2[_0x35a9('0x2a')]['id']){delete _0x1bb0d2[_0x35a9('0x2a')]['id'];}return db['VoiceQueueReport'][_0x35a9('0x4a')]({'where':{'id':_0x1bb0d2['params']['id']}})[_0x35a9('0x27')](handleEntityNotFound(_0x3bf3ae,null))[_0x35a9('0x27')](saveUpdates(_0x1bb0d2['body'],null))[_0x35a9('0x27')](respondWithResult(_0x3bf3ae,null))['catch'](handleError(_0x3bf3ae,null));};exports[_0x35a9('0x4b')]=function(_0x52776e,_0x27b035){return db[_0x35a9('0x2f')][_0x35a9('0x4a')]({'where':{'id':_0x52776e[_0x35a9('0x48')]['id']}})[_0x35a9('0x27')](handleEntityNotFound(_0x27b035,null))[_0x35a9('0x27')](removeEntity(_0x27b035,null))['catch'](handleError(_0x27b035,null));};exports['describe']=function(_0x5da8a5,_0x28128c){return db['VoiceQueueReport'][_0x35a9('0x4c')]()[_0x35a9('0x27')](respondWithResult(_0x28128c,null))['catch'](handleError(_0x28128c,null));};exports[_0x35a9('0x4d')]=function(_0x1dc3f2,_0x2679fb){var _0x461740={},_0x4e9125={},_0x24b7b0={'count':0x0,'rows':[]};_0x4e9125[_0x35a9('0x36')]=_['keys'](db[_0x35a9('0x2f')][_0x35a9('0x30')]);_0x4e9125[_0x35a9('0x34')]=_['keys'](_0x1dc3f2[_0x35a9('0x34')]);_0x4e9125[_0x35a9('0x3f')]=_[_0x35a9('0x37')](_0x4e9125['model'],_0x4e9125['query']);_0x461740['attributes']=_[_0x35a9('0x37')](_0x4e9125[_0x35a9('0x36')],qs[_0x35a9('0x38')](_0x1dc3f2['query'][_0x35a9('0x38')]));_0x461740[_0x35a9('0x3a')]=_0x461740[_0x35a9('0x3a')][_0x35a9('0x39')]?_0x461740[_0x35a9('0x3a')]:_0x4e9125[_0x35a9('0x36')];if(!_0x1dc3f2[_0x35a9('0x34')][_0x35a9('0x4e')](_0x35a9('0x3b'))){_0x461740['limit']=qs['limit'](_0x1dc3f2[_0x35a9('0x34')][_0x35a9('0x21')]);_0x461740['offset']=qs['offset'](_0x1dc3f2[_0x35a9('0x34')][_0x35a9('0x1f')]);}_0x461740[_0x35a9('0x3c')]=qs[_0x35a9('0x3d')](_0x1dc3f2[_0x35a9('0x34')][_0x35a9('0x3d')]);_0x461740[_0x35a9('0x3e')]=qs[_0x35a9('0x3f')](_[_0x35a9('0x4f')](_0x1dc3f2[_0x35a9('0x34')],_0x4e9125['filters']));if(_0x1dc3f2['query']['filter']){_0x461740['where']=_['merge'](_0x461740[_0x35a9('0x3e')],{'$or':_[_0x35a9('0x2e')](_0x461740[_0x35a9('0x3a')],function(_0x58db21){var _0xc98a34={};_0xc98a34[_0x58db21]={'$like':'%'+_0x1dc3f2[_0x35a9('0x34')][_0x35a9('0x40')]+'%'};return _0xc98a34;})});}_0x461740=_[_0x35a9('0x41')]({},_0x461740,_0x1dc3f2[_0x35a9('0x49')]);var _0xe893a5={'where':_0x461740['where']};return db[_0x35a9('0x2f')]['count'](_0xe893a5)[_0x35a9('0x27')](function(_0x3ad407){_0x24b7b0[_0x35a9('0x22')]=_0x3ad407;if(_0x1dc3f2[_0x35a9('0x34')][_0x35a9('0x43')]){_0x461740[_0x35a9('0x44')]=[{'all':!![]}];}return db[_0x35a9('0x2f')][_0x35a9('0x50')](_0x461740);})[_0x35a9('0x27')](function(_0x4f7f50){_0x24b7b0[_0x35a9('0x45')]=_0x4f7f50;return _0x24b7b0;})[_0x35a9('0x27')](respondWithFilteredResult(_0x2679fb,_0x461740,_0x35a9('0x4d')))['catch'](handleError(_0x2679fb,null,_0x35a9('0x4d')));}; \ No newline at end of file +var _0x3797=['includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','describe','getVoiceQueuesReport','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','render','merge','body','contact','message','interaction','account','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','options','VoiceQueueReport'];(function(_0x37ae26,_0x2ecd70){var _0x1b1902=function(_0x5a6ae0){while(--_0x5a6ae0){_0x37ae26['push'](_0x37ae26['shift']());}};_0x1b1902(++_0x2ecd70);}(_0x3797,0x10a));var _0x7379=function(_0x8806f5,_0x259bc6){_0x8806f5=_0x8806f5-0x0;var _0x39a9a8=_0x3797[_0x8806f5];return _0x39a9a8;};'use strict';var emlformat=require(_0x7379('0x0'));var rimraf=require(_0x7379('0x1'));var zipdir=require(_0x7379('0x2'));var jsonpatch=require(_0x7379('0x3'));var rp=require(_0x7379('0x4'));var moment=require('moment');var BPromise=require(_0x7379('0x5'));var Mustache=require(_0x7379('0x6'));var util=require(_0x7379('0x7'));var path=require(_0x7379('0x8'));var sox=require(_0x7379('0x9'));var csv=require(_0x7379('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7379('0xb'));var _=require(_0x7379('0xc'));var squel=require(_0x7379('0xd'));var crypto=require(_0x7379('0xe'));var jsforce=require(_0x7379('0xf'));var deskjs=require(_0x7379('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7379('0x11'));var Papa=require(_0x7379('0x12'));var Redis=require(_0x7379('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7379('0x14'));var hardwareService=require(_0x7379('0x15'));var logger=require(_0x7379('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7379('0x17')]=_[_0x7379('0x18')](config[_0x7379('0x17')],{'host':_0x7379('0x19'),'port':0x18eb});var socket=require(_0x7379('0x1a'))(new Redis(config[_0x7379('0x17')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x144c4e,_0x102829){_0x102829=_0x102829||0xcc;return function(_0x179a82){if(_0x179a82){return _0x144c4e[_0x7379('0x1b')](_0x102829);}return _0x144c4e['status'](_0x102829)[_0x7379('0x1c')]();};}function respondWithResult(_0x1b0378,_0x45761f){_0x45761f=_0x45761f||0xc8;return function(_0xb0f5ff){if(_0xb0f5ff){return _0x1b0378[_0x7379('0x1d')](_0x45761f)[_0x7379('0x1e')](_0xb0f5ff);}};}function respondWithFilteredResult(_0xec6e86,_0x2c74ec){return function(_0xcddb6f){if(_0xcddb6f){var _0x1c5019=typeof _0x2c74ec[_0x7379('0x1f')]===_0x7379('0x20')&&typeof _0x2c74ec[_0x7379('0x21')]===_0x7379('0x20');var _0x583ee7=_0xcddb6f[_0x7379('0x22')];var _0x38fa48=_0x1c5019?0x0:_0x2c74ec['offset'];var _0x318bc2=_0x1c5019?_0xcddb6f[_0x7379('0x22')]:_0x2c74ec[_0x7379('0x1f')]+_0x2c74ec[_0x7379('0x21')];var _0x3ea7ee;if(_0x318bc2>=_0x583ee7){_0x318bc2=_0x583ee7;_0x3ea7ee=0xc8;}else{_0x3ea7ee=0xce;}_0xec6e86['status'](_0x3ea7ee);return _0xec6e86['set']('Content-Range',_0x38fa48+'-'+_0x318bc2+'/'+_0x583ee7)[_0x7379('0x1e')](_0xcddb6f);}return null;};}function patchUpdates(_0x350802){return function(_0x275e69){try{jsonpatch[_0x7379('0x23')](_0x275e69,_0x350802,!![]);}catch(_0x16157c){return BPromise['reject'](_0x16157c);}return _0x275e69[_0x7379('0x24')]();};}function saveUpdates(_0xf71eaf,_0x196888){return function(_0x4bc8b4){if(_0x4bc8b4){return _0x4bc8b4[_0x7379('0x25')](_0xf71eaf)[_0x7379('0x26')](function(_0x66ad7b){return _0x66ad7b;});}return null;};}function removeEntity(_0x45cf58,_0x52fd4b){return function(_0x224e01){if(_0x224e01){return _0x224e01[_0x7379('0x27')]()[_0x7379('0x26')](function(){_0x45cf58[_0x7379('0x1d')](0xcc)[_0x7379('0x1c')]();});}};}function handleEntityNotFound(_0x5c9065,_0x4c5330){return function(_0x5bf7d0){if(!_0x5bf7d0){_0x5c9065['sendStatus'](0x194);}return _0x5bf7d0;};}function handleError(_0x45e3fa,_0x58ef93){_0x58ef93=_0x58ef93||0x1f4;return function(_0x3a7ac2){logger[_0x7379('0x28')](_0x3a7ac2[_0x7379('0x29')]);if(_0x3a7ac2[_0x7379('0x2a')]){delete _0x3a7ac2[_0x7379('0x2a')];}_0x45e3fa[_0x7379('0x1d')](_0x58ef93)[_0x7379('0x2b')](_0x3a7ac2);};}function getMustacheRender(_0x4fef55,_0x47f6a0){return Mustache[_0x7379('0x2c')](_0x4fef55,_[_0x7379('0x2d')](_0x47f6a0[_0x7379('0x2e')],{'contact':_0x47f6a0[_0x7379('0x2f')],'message':_0x47f6a0[_0x7379('0x30')],'agent':_0x47f6a0['agent'],'interaction':_0x47f6a0[_0x7379('0x31')],'account':_0x47f6a0[_0x7379('0x32')]}))||'';}exports['index']=function(_0x1e794e,_0x46dedc){var _0x2fa024={},_0x5dbb78={},_0x69c6f5={'count':0x0,'rows':[]};var _0x2d6e0e=_[_0x7379('0x33')](db['VoiceQueueReport'][_0x7379('0x34')],function(_0x4359a1){return{'name':_0x4359a1[_0x7379('0x35')],'type':_0x4359a1[_0x7379('0x36')][_0x7379('0x37')]};});_0x5dbb78[_0x7379('0x38')]=_['map'](_0x2d6e0e,'name');_0x5dbb78[_0x7379('0x39')]=_['keys'](_0x1e794e[_0x7379('0x39')]);_0x5dbb78[_0x7379('0x3a')]=_['intersection'](_0x5dbb78[_0x7379('0x38')],_0x5dbb78[_0x7379('0x39')]);_0x2fa024[_0x7379('0x3b')]=_[_0x7379('0x3c')](_0x5dbb78[_0x7379('0x38')],qs[_0x7379('0x3d')](_0x1e794e['query'][_0x7379('0x3d')]));_0x2fa024['attributes']=_0x2fa024[_0x7379('0x3b')]['length']?_0x2fa024[_0x7379('0x3b')]:_0x5dbb78[_0x7379('0x38')];if(!_0x1e794e[_0x7379('0x39')][_0x7379('0x3e')]('nolimit')){_0x2fa024[_0x7379('0x21')]=qs[_0x7379('0x21')](_0x1e794e[_0x7379('0x39')][_0x7379('0x21')]);_0x2fa024['offset']=qs[_0x7379('0x1f')](_0x1e794e[_0x7379('0x39')][_0x7379('0x1f')]);}_0x2fa024[_0x7379('0x3f')]=qs[_0x7379('0x40')](_0x1e794e['query']['sort']);_0x2fa024[_0x7379('0x41')]=qs['filters'](_['pick'](_0x1e794e[_0x7379('0x39')],_0x5dbb78[_0x7379('0x3a')]),_0x2d6e0e);if(_0x1e794e['query'][_0x7379('0x42')]){_0x2fa024['where']=_[_0x7379('0x2d')](_0x2fa024[_0x7379('0x41')],{'$or':_[_0x7379('0x33')](_0x2d6e0e,function(_0x39753e){if(_0x39753e[_0x7379('0x36')]!==_0x7379('0x43')){var _0x2092a8={};_0x2092a8[_0x39753e[_0x7379('0x2a')]]={'$like':'%'+_0x1e794e[_0x7379('0x39')][_0x7379('0x42')]+'%'};return _0x2092a8;}})});}_0x2fa024=_[_0x7379('0x2d')]({},_0x2fa024,_0x1e794e[_0x7379('0x44')]);var _0x270275={'where':_0x2fa024[_0x7379('0x41')]};return db[_0x7379('0x45')]['count'](_0x270275)[_0x7379('0x26')](function(_0x2509ef){_0x69c6f5[_0x7379('0x22')]=_0x2509ef;if(_0x1e794e[_0x7379('0x39')][_0x7379('0x46')]){_0x2fa024[_0x7379('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x7379('0x48')](_0x2fa024);})['then'](function(_0x29f5e7){_0x69c6f5[_0x7379('0x49')]=_0x29f5e7;return _0x69c6f5;})['then'](respondWithFilteredResult(_0x46dedc,_0x2fa024))[_0x7379('0x4a')](handleError(_0x46dedc,null));};exports[_0x7379('0x4b')]=function(_0x55b1d7,_0x1e29a4){var _0x445003={'raw':![],'where':{'id':_0x55b1d7[_0x7379('0x4c')]['id']}},_0x205892={};_0x205892[_0x7379('0x38')]=_[_0x7379('0x4d')](db['VoiceQueueReport'][_0x7379('0x34')]);_0x205892[_0x7379('0x39')]=_[_0x7379('0x4d')](_0x55b1d7['query']);_0x205892[_0x7379('0x3a')]=_[_0x7379('0x3c')](_0x205892[_0x7379('0x38')],_0x205892[_0x7379('0x39')]);_0x445003[_0x7379('0x3b')]=_[_0x7379('0x3c')](_0x205892[_0x7379('0x38')],qs[_0x7379('0x3d')](_0x55b1d7['query'][_0x7379('0x3d')]));_0x445003[_0x7379('0x3b')]=_0x445003['attributes'][_0x7379('0x4e')]?_0x445003[_0x7379('0x3b')]:_0x205892[_0x7379('0x38')];if(_0x55b1d7[_0x7379('0x39')][_0x7379('0x46')]){_0x445003['include']=[{'all':!![]}];}_0x445003=_[_0x7379('0x2d')]({},_0x445003,_0x55b1d7[_0x7379('0x44')]);return db['VoiceQueueReport'][_0x7379('0x4f')](_0x445003)['then'](handleEntityNotFound(_0x1e29a4,null))['then'](respondWithResult(_0x1e29a4,null))[_0x7379('0x4a')](handleError(_0x1e29a4,null));};exports[_0x7379('0x50')]=function(_0x393f79,_0x22d6ec){return db[_0x7379('0x45')][_0x7379('0x50')](_0x393f79[_0x7379('0x2e')],{})[_0x7379('0x26')](respondWithResult(_0x22d6ec,0xc9))[_0x7379('0x4a')](handleError(_0x22d6ec,null));};exports['update']=function(_0x484c8a,_0x4577ea){if(_0x484c8a[_0x7379('0x2e')]['id']){delete _0x484c8a[_0x7379('0x2e')]['id'];}return db[_0x7379('0x45')][_0x7379('0x4f')]({'where':{'id':_0x484c8a['params']['id']}})['then'](handleEntityNotFound(_0x4577ea,null))[_0x7379('0x26')](saveUpdates(_0x484c8a['body'],null))[_0x7379('0x26')](respondWithResult(_0x4577ea,null))['catch'](handleError(_0x4577ea,null));};exports[_0x7379('0x27')]=function(_0x4123da,_0x3cc28f){return db[_0x7379('0x45')][_0x7379('0x4f')]({'where':{'id':_0x4123da[_0x7379('0x4c')]['id']}})[_0x7379('0x26')](handleEntityNotFound(_0x3cc28f,null))[_0x7379('0x26')](removeEntity(_0x3cc28f,null))[_0x7379('0x4a')](handleError(_0x3cc28f,null));};exports['describe']=function(_0x4b7643,_0x9e7b81){return db['VoiceQueueReport'][_0x7379('0x51')]()['then'](respondWithResult(_0x9e7b81,null))[_0x7379('0x4a')](handleError(_0x9e7b81,null));};exports[_0x7379('0x52')]=function(_0x3d7b6f,_0x23555a){var _0x3f222d={},_0x19c928={},_0x57c2fd={'count':0x0,'rows':[]};_0x19c928[_0x7379('0x38')]=_[_0x7379('0x4d')](db[_0x7379('0x45')][_0x7379('0x34')]);_0x19c928[_0x7379('0x39')]=_['keys'](_0x3d7b6f['query']);_0x19c928[_0x7379('0x3a')]=_['intersection'](_0x19c928[_0x7379('0x38')],_0x19c928[_0x7379('0x39')]);_0x3f222d[_0x7379('0x3b')]=_['intersection'](_0x19c928['model'],qs['fields'](_0x3d7b6f[_0x7379('0x39')][_0x7379('0x3d')]));_0x3f222d[_0x7379('0x3b')]=_0x3f222d['attributes']['length']?_0x3f222d['attributes']:_0x19c928['model'];if(!_0x3d7b6f[_0x7379('0x39')][_0x7379('0x3e')]('nolimit')){_0x3f222d[_0x7379('0x21')]=qs[_0x7379('0x21')](_0x3d7b6f['query'][_0x7379('0x21')]);_0x3f222d['offset']=qs[_0x7379('0x1f')](_0x3d7b6f[_0x7379('0x39')][_0x7379('0x1f')]);}_0x3f222d['order']=qs[_0x7379('0x40')](_0x3d7b6f[_0x7379('0x39')][_0x7379('0x40')]);_0x3f222d['where']=qs[_0x7379('0x3a')](_[_0x7379('0x53')](_0x3d7b6f[_0x7379('0x39')],_0x19c928['filters']));if(_0x3d7b6f['query'][_0x7379('0x42')]){_0x3f222d[_0x7379('0x41')]=_[_0x7379('0x2d')](_0x3f222d[_0x7379('0x41')],{'$or':_[_0x7379('0x33')](_0x3f222d[_0x7379('0x3b')],function(_0x14ded0){var _0x39ca7c={};_0x39ca7c[_0x14ded0]={'$like':'%'+_0x3d7b6f[_0x7379('0x39')][_0x7379('0x42')]+'%'};return _0x39ca7c;})});}_0x3f222d=_['merge']({},_0x3f222d,_0x3d7b6f[_0x7379('0x44')]);var _0x18698a={'where':_0x3f222d[_0x7379('0x41')]};return db['VoiceQueueReport']['count'](_0x18698a)['then'](function(_0x341770){_0x57c2fd[_0x7379('0x22')]=_0x341770;if(_0x3d7b6f['query'][_0x7379('0x46')]){_0x3f222d[_0x7379('0x47')]=[{'all':!![]}];}return db[_0x7379('0x45')][_0x7379('0x48')](_0x3f222d);})[_0x7379('0x26')](function(_0x4ef5a9){_0x57c2fd[_0x7379('0x49')]=_0x4ef5a9;return _0x57c2fd;})['then'](respondWithFilteredResult(_0x23555a,_0x3f222d,_0x7379('0x52')))[_0x7379('0x4a')](handleError(_0x23555a,null,_0x7379('0x52')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 190bbb8..5173538 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 _0x02bc=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5dc03e,_0x54e60c){var _0x466a07=function(_0x2ce0cd){while(--_0x2ce0cd){_0x5dc03e['push'](_0x5dc03e['shift']());}};_0x466a07(++_0x54e60c);}(_0x02bc,0x1ba));var _0xc02b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x02bc[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xc02b('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc02b('0x1')](0x0);var events={'afterCreate':_0xc02b('0x2'),'afterUpdate':_0xc02b('0x3'),'afterDestroy':_0xc02b('0x4')};function emitEvent(_0x1ff93e){return function(_0x2fe4fb,_0x343286,_0x1c56d6){VoiceQueueReportEvents[_0xc02b('0x5')](_0x1ff93e+':'+_0x2fe4fb['id'],_0x2fe4fb);VoiceQueueReportEvents['emit'](_0x1ff93e,_0x2fe4fb);_0x1c56d6(null);};}for(var e in events){if(events[_0xc02b('0x6')](e)){var event=events[e];VoiceQueueReport[_0xc02b('0x7')](e,emitEvent(event));}}module[_0xc02b('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xafdb=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb'];(function(_0x5323dc,_0x79eb95){var _0x398901=function(_0xada06a){while(--_0xada06a){_0x5323dc['push'](_0x5323dc['shift']());}};_0x398901(++_0x79eb95);}(_0xafdb,0x177));var _0xbafd=function(_0x4d7116,_0xdb8175){_0x4d7116=_0x4d7116-0x0;var _0x4593dc=_0xafdb[_0x4d7116];return _0x4593dc;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xbafd('0x0'))['db'][_0xbafd('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xbafd('0x2')](0x0);var events={'afterCreate':_0xbafd('0x3'),'afterUpdate':_0xbafd('0x4'),'afterDestroy':_0xbafd('0x5')};function emitEvent(_0xd08bcd){return function(_0x278fc0,_0xbec3e9,_0x10c35d){VoiceQueueReportEvents['emit'](_0xd08bcd+':'+_0x278fc0['id'],_0x278fc0);VoiceQueueReportEvents[_0xbafd('0x6')](_0xd08bcd,_0x278fc0);_0x10c35d(null);};}for(var e in events){if(events[_0xbafd('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index a4ea716..8f842d4 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.model.js +++ b/server/api/voiceQueueReport/voiceQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['request-promise','path','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','bluebird'];(function(_0xacd5c1,_0x39e3ce){var _0x63b40b=function(_0x524c5c){while(--_0x524c5c){_0xacd5c1['push'](_0xacd5c1['shift']());}};_0x63b40b(++_0x39e3ce);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[{'fields':[_0x65f6('0xa')]},{'fields':[_0x65f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f2f=['VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define'];(function(_0x8ec916,_0x39b8b1){var _0x18097a=function(_0x443c0a){while(--_0x443c0a){_0x8ec916['push'](_0x8ec916['shift']());}};_0x18097a(++_0x39b8b1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x291d48,_0x447456){_0x291d48=_0x291d48-0x0;var _0x4ea2fb=_0x5f2f[_0x291d48];return _0x4ea2fb;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xf5f2('0xc')]},{'fields':[_0xf5f2('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 6ce098b..7c38246 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 _0x1843=['redis','defaults','localhost','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','limit','include','map','attributes','model','stringify','create','body','CreateVoiceQueueReport','debug','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x4d61d2,_0x2fb772){var _0xb9578c=function(_0x27b562){while(--_0x27b562){_0x4d61d2['push'](_0x4d61d2['shift']());}};_0xb9578c(++_0x2fb772);}(_0x1843,0x9c));var _0x3184=function(_0x41b501,_0x1fbf5f){_0x41b501=_0x41b501-0x0;var _0x1a1bf0=_0x1843[_0x41b501];return _0x1a1bf0;};'use strict';var _=require(_0x3184('0x0'));var util=require(_0x3184('0x1'));var moment=require(_0x3184('0x2'));var BPromise=require(_0x3184('0x3'));var rs=require(_0x3184('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3184('0x5'))['db'];var utils=require(_0x3184('0x6'));var logger=require(_0x3184('0x7'))(_0x3184('0x8'));var config=require(_0x3184('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3184('0xa')][_0x3184('0xb')]({'port':0x232a});config[_0x3184('0xc')]=_[_0x3184('0xd')](config[_0x3184('0xc')],{'host':_0x3184('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3184('0xc')]));require(_0x3184('0xf'))[_0x3184('0x10')](socket);function respondWithRpcPromise(_0x1a9d5d,_0x516b2f,_0x95028f){return new BPromise(function(_0x2bca82,_0x59f77d){return client['request'](_0x1a9d5d,_0x95028f)[_0x3184('0x11')](function(_0x52a020){logger[_0x3184('0x12')](_0x3184('0x13'),_0x516b2f,_0x3184('0x14'));logger['debug'](_0x3184('0x15'),_0x516b2f,_0x3184('0x14'),JSON['stringify'](_0x52a020));if(_0x52a020[_0x3184('0x16')]){if(_0x52a020[_0x3184('0x16')]['code']===0x1f4){logger[_0x3184('0x16')](_0x3184('0x13'),_0x516b2f,_0x52a020[_0x3184('0x16')]['message']);return _0x59f77d(_0x52a020[_0x3184('0x16')][_0x3184('0x17')]);}logger[_0x3184('0x16')](_0x3184('0x13'),_0x516b2f,_0x52a020[_0x3184('0x16')][_0x3184('0x17')]);return _0x2bca82(_0x52a020[_0x3184('0x16')]['message']);}else{logger[_0x3184('0x12')](_0x3184('0x13'),_0x516b2f,_0x3184('0x14'));_0x2bca82(_0x52a020[_0x3184('0x18')]['message']);}})[_0x3184('0x19')](function(_0xaedf45){logger[_0x3184('0x16')](_0x3184('0x13'),_0x516b2f,_0xaedf45);_0x59f77d(_0xaedf45);});});}exports[_0x3184('0x1a')]=function(_0x524826){var _0x2d44ec=this;return new Promise(function(_0x6b6d6b,_0x141516){return db[_0x3184('0x1b')]['findAll']({'raw':_0x524826[_0x3184('0x1c')]?_0x524826['options'][_0x3184('0x1d')]===undefined?!![]:![]:!![],'where':_0x524826[_0x3184('0x1c')]?_0x524826[_0x3184('0x1c')]['where']||null:null,'attributes':_0x524826[_0x3184('0x1c')]?_0x524826[_0x3184('0x1c')]['attributes']||null:null,'limit':_0x524826[_0x3184('0x1c')]?_0x524826[_0x3184('0x1c')][_0x3184('0x1e')]||null:null,'include':_0x524826[_0x3184('0x1c')]?_0x524826[_0x3184('0x1c')][_0x3184('0x1f')]?_[_0x3184('0x20')](_0x524826[_0x3184('0x1c')][_0x3184('0x1f')],function(_0x1a511e){return{'model':db[_0x1a511e['model']],'as':_0x1a511e['as'],'attributes':_0x1a511e[_0x3184('0x21')],'include':_0x1a511e[_0x3184('0x1f')]?_['map'](_0x1a511e[_0x3184('0x1f')],function(_0x377965){return{'model':db[_0x377965[_0x3184('0x22')]],'as':_0x377965['as'],'attributes':_0x377965[_0x3184('0x21')],'include':_0x377965[_0x3184('0x1f')]?_[_0x3184('0x20')](_0x377965[_0x3184('0x1f')],function(_0x26b3ca){return{'model':db[_0x26b3ca[_0x3184('0x22')]],'as':_0x26b3ca['as'],'attributes':_0x26b3ca['attributes']};}):[]};}):[]};}):[]:[]})[_0x3184('0x11')](function(_0x5dd0ac){logger[_0x3184('0x12')](_0x3184('0x1a'),_0x524826);logger['debug'](_0x3184('0x1a'),_0x524826,JSON[_0x3184('0x23')](_0x5dd0ac));_0x6b6d6b(_0x5dd0ac);})[_0x3184('0x19')](function(_0x3cf4bb){logger[_0x3184('0x16')](_0x3184('0x1a'),_0x3cf4bb[_0x3184('0x17')],_0x524826);_0x141516(_0x2d44ec[_0x3184('0x16')](0x1f4,_0x3cf4bb['message']));});});};exports['CreateVoiceQueueReport']=function(_0x2d816c){var _0x132999=this;return new Promise(function(_0x284fc3,_0x333e32){return db[_0x3184('0x1b')][_0x3184('0x24')](_0x2d816c[_0x3184('0x25')],{'raw':_0x2d816c[_0x3184('0x1c')]?_0x2d816c[_0x3184('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x3184('0x11')](function(_0x3dbd82){logger[_0x3184('0x12')](_0x3184('0x26'),_0x2d816c);logger[_0x3184('0x27')](_0x3184('0x26'),_0x2d816c,JSON['stringify'](_0x3dbd82));_0x284fc3(_0x3dbd82);})[_0x3184('0x19')](function(_0x1c217c){logger[_0x3184('0x16')](_0x3184('0x26'),_0x1c217c[_0x3184('0x17')],_0x2d816c);_0x333e32(_0x132999['error'](0x1f4,_0x1c217c['message']));});});};exports[_0x3184('0x28')]=function(_0x22356c){var _0xaf8c53=this;return new Promise(function(_0xb974e4,_0x1567ab){return db['VoiceQueueReport'][_0x3184('0x29')](_0x22356c[_0x3184('0x25')],{'raw':_0x22356c['options']?_0x22356c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22356c[_0x3184('0x1c')]?_0x22356c[_0x3184('0x1c')]['where']||null:null,'attributes':_0x22356c['options']?_0x22356c[_0x3184('0x1c')][_0x3184('0x21')]||null:null,'limit':_0x22356c['options']?_0x22356c[_0x3184('0x1c')][_0x3184('0x1e')]||null:null})['then'](function(_0x48fa92){logger[_0x3184('0x12')](_0x3184('0x28'),_0x22356c);logger[_0x3184('0x27')]('UpdateVoiceQueueReport',_0x22356c,JSON[_0x3184('0x23')](_0x48fa92));_0xb974e4(_0x48fa92);})[_0x3184('0x19')](function(_0x1b54f2){logger['error'](_0x3184('0x28'),_0x1b54f2['message'],_0x22356c);_0x1567ab(_0xaf8c53['error'](0x1f4,_0x1b54f2['message']));});});}; \ No newline at end of file +var _0xd2dc=['socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','include','model','catch','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x3e3ea1,_0xd9b9e9){var _0x295c32=function(_0xe2fd98){while(--_0xe2fd98){_0x3e3ea1['push'](_0x3e3ea1['shift']());}};_0x295c32(++_0xd9b9e9);}(_0xd2dc,0x175));var _0xcd2d=function(_0x14f7d2,_0x19d283){_0x14f7d2=_0x14f7d2-0x0;var _0x212d40=_0xd2dc[_0x14f7d2];return _0x212d40;};'use strict';var _=require(_0xcd2d('0x0'));var util=require(_0xcd2d('0x1'));var moment=require(_0xcd2d('0x2'));var BPromise=require(_0xcd2d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd2d('0x4'));var db=require(_0xcd2d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd2d('0x6'))('rpc');var config=require(_0xcd2d('0x7'));var jayson=require(_0xcd2d('0x8'));var client=jayson[_0xcd2d('0x9')][_0xcd2d('0xa')]({'port':0x232a});config['redis']=_[_0xcd2d('0xb')](config[_0xcd2d('0xc')],{'host':_0xcd2d('0xd'),'port':0x18eb});var socket=require(_0xcd2d('0xe'))(new Redis(config[_0xcd2d('0xc')]));require(_0xcd2d('0xf'))[_0xcd2d('0x10')](socket);function respondWithRpcPromise(_0x49e4a4,_0x343fcc,_0x3cd3fa){return new BPromise(function(_0x51ebc9,_0x402588){return client['request'](_0x49e4a4,_0x3cd3fa)[_0xcd2d('0x11')](function(_0x4625b5){logger[_0xcd2d('0x12')](_0xcd2d('0x13'),_0x343fcc,_0xcd2d('0x14'));logger[_0xcd2d('0x15')](_0xcd2d('0x16'),_0x343fcc,'request\x20sent',JSON[_0xcd2d('0x17')](_0x4625b5));if(_0x4625b5[_0xcd2d('0x18')]){if(_0x4625b5['error'][_0xcd2d('0x19')]===0x1f4){logger[_0xcd2d('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x343fcc,_0x4625b5[_0xcd2d('0x18')]['message']);return _0x402588(_0x4625b5[_0xcd2d('0x18')]['message']);}logger[_0xcd2d('0x18')](_0xcd2d('0x13'),_0x343fcc,_0x4625b5[_0xcd2d('0x18')][_0xcd2d('0x1a')]);return _0x51ebc9(_0x4625b5[_0xcd2d('0x18')][_0xcd2d('0x1a')]);}else{logger['info'](_0xcd2d('0x13'),_0x343fcc,_0xcd2d('0x14'));_0x51ebc9(_0x4625b5[_0xcd2d('0x1b')]['message']);}})['catch'](function(_0x344e60){logger[_0xcd2d('0x18')](_0xcd2d('0x13'),_0x343fcc,_0x344e60);_0x402588(_0x344e60);});});}exports[_0xcd2d('0x1c')]=function(_0x5a3c2c){var _0x5c2dfa=this;return new Promise(function(_0x5cc00d,_0x5d2a6f){return db[_0xcd2d('0x1d')]['findAll']({'raw':_0x5a3c2c[_0xcd2d('0x1e')]?_0x5a3c2c[_0xcd2d('0x1e')][_0xcd2d('0x1f')]===undefined?!![]:![]:!![],'where':_0x5a3c2c[_0xcd2d('0x1e')]?_0x5a3c2c[_0xcd2d('0x1e')][_0xcd2d('0x20')]||null:null,'attributes':_0x5a3c2c['options']?_0x5a3c2c[_0xcd2d('0x1e')][_0xcd2d('0x21')]||null:null,'limit':_0x5a3c2c[_0xcd2d('0x1e')]?_0x5a3c2c['options'][_0xcd2d('0x22')]||null:null,'include':_0x5a3c2c[_0xcd2d('0x1e')]?_0x5a3c2c['options'][_0xcd2d('0x23')]?_['map'](_0x5a3c2c[_0xcd2d('0x1e')][_0xcd2d('0x23')],function(_0x3fe2ad){return{'model':db[_0x3fe2ad[_0xcd2d('0x24')]],'as':_0x3fe2ad['as'],'attributes':_0x3fe2ad[_0xcd2d('0x21')],'include':_0x3fe2ad[_0xcd2d('0x23')]?_['map'](_0x3fe2ad[_0xcd2d('0x23')],function(_0x4ce5b2){return{'model':db[_0x4ce5b2[_0xcd2d('0x24')]],'as':_0x4ce5b2['as'],'attributes':_0x4ce5b2['attributes'],'include':_0x4ce5b2[_0xcd2d('0x23')]?_['map'](_0x4ce5b2[_0xcd2d('0x23')],function(_0x1bb61a){return{'model':db[_0x1bb61a[_0xcd2d('0x24')]],'as':_0x1bb61a['as'],'attributes':_0x1bb61a[_0xcd2d('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcd2d('0x11')](function(_0x3b8ef1){logger[_0xcd2d('0x12')]('GetVoiceQueueReport',_0x5a3c2c);logger[_0xcd2d('0x15')]('GetVoiceQueueReport',_0x5a3c2c,JSON['stringify'](_0x3b8ef1));_0x5cc00d(_0x3b8ef1);})[_0xcd2d('0x25')](function(_0x312e36){logger[_0xcd2d('0x18')]('GetVoiceQueueReport',_0x312e36[_0xcd2d('0x1a')],_0x5a3c2c);_0x5d2a6f(_0x5c2dfa[_0xcd2d('0x18')](0x1f4,_0x312e36[_0xcd2d('0x1a')]));});});};exports['CreateVoiceQueueReport']=function(_0x55be1a){var _0x100313=this;return new Promise(function(_0x3a20ee,_0x5519a6){return db[_0xcd2d('0x1d')][_0xcd2d('0x26')](_0x55be1a[_0xcd2d('0x27')],{'raw':_0x55be1a[_0xcd2d('0x1e')]?_0x55be1a['options'][_0xcd2d('0x1f')]===undefined?!![]:![]:!![]})[_0xcd2d('0x11')](function(_0x3a9e39){logger[_0xcd2d('0x12')]('CreateVoiceQueueReport',_0x55be1a);logger[_0xcd2d('0x15')](_0xcd2d('0x28'),_0x55be1a,JSON['stringify'](_0x3a9e39));_0x3a20ee(_0x3a9e39);})[_0xcd2d('0x25')](function(_0x4f9b4b){logger[_0xcd2d('0x18')](_0xcd2d('0x28'),_0x4f9b4b['message'],_0x55be1a);_0x5519a6(_0x100313['error'](0x1f4,_0x4f9b4b['message']));});});};exports[_0xcd2d('0x29')]=function(_0x5a2bf9){var _0x38ba97=this;return new Promise(function(_0x53619e,_0x404152){return db[_0xcd2d('0x1d')][_0xcd2d('0x2a')](_0x5a2bf9[_0xcd2d('0x27')],{'raw':_0x5a2bf9[_0xcd2d('0x1e')]?_0x5a2bf9['options'][_0xcd2d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a2bf9['options']?_0x5a2bf9[_0xcd2d('0x1e')][_0xcd2d('0x20')]||null:null,'attributes':_0x5a2bf9[_0xcd2d('0x1e')]?_0x5a2bf9[_0xcd2d('0x1e')][_0xcd2d('0x21')]||null:null,'limit':_0x5a2bf9[_0xcd2d('0x1e')]?_0x5a2bf9['options'][_0xcd2d('0x22')]||null:null})['then'](function(_0x37d7ea){logger[_0xcd2d('0x12')](_0xcd2d('0x29'),_0x5a2bf9);logger[_0xcd2d('0x15')](_0xcd2d('0x29'),_0x5a2bf9,JSON[_0xcd2d('0x17')](_0x37d7ea));_0x53619e(_0x37d7ea);})[_0xcd2d('0x25')](function(_0x3530be){logger[_0xcd2d('0x18')]('UpdateVoiceQueueReport',_0x3530be[_0xcd2d('0x1a')],_0x5a2bf9);_0x404152(_0x38ba97[_0xcd2d('0x18')](0x1f4,_0x3530be['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 52f3c88..38b0c2d 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 _0x25a2=['remove','emit','removeListener','register','length','./voiceQueueReport.events','save'];(function(_0x21c525,_0x3986d6){var _0xae7b0e=function(_0x31a6a3){while(--_0x31a6a3){_0x21c525['push'](_0x21c525['shift']());}};_0xae7b0e(++_0x3986d6);}(_0x25a2,0x91));var _0x225a=function(_0x4734f1,_0x39cd1f){_0x4734f1=_0x4734f1-0x0;var _0x117028=_0x25a2[_0x4734f1];return _0x117028;};'use strict';var VoiceQueueReportEvents=require(_0x225a('0x0'));var events=[_0x225a('0x1'),_0x225a('0x2'),'update'];function createListener(_0x368f0f,_0x36b741){return function(_0x5ecbce){_0x36b741[_0x225a('0x3')](_0x368f0f,_0x5ecbce);};}function removeListener(_0x2f8cfc,_0x42c3f6){return function(){VoiceQueueReportEvents[_0x225a('0x4')](_0x2f8cfc,_0x42c3f6);};}exports[_0x225a('0x5')]=function(_0x4aaabc){for(var _0x306dc7=0x0,_0x5badc8=events[_0x225a('0x6')];_0x306dc7<_0x5badc8;_0x306dc7++){var _0x29df38=events[_0x306dc7];var _0x3171ba=createListener('voiceQueueReport:'+_0x29df38,_0x4aaabc);VoiceQueueReportEvents['on'](_0x29df38,_0x3171ba);}}; \ No newline at end of file +var _0xbbe7=['voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener','register','length'];(function(_0x4ed88a,_0x2f95cc){var _0x330771=function(_0x3475dd){while(--_0x3475dd){_0x4ed88a['push'](_0x4ed88a['shift']());}};_0x330771(++_0x2f95cc);}(_0xbbe7,0xe2));var _0x7bbe=function(_0x55f6dd,_0x237a55){_0x55f6dd=_0x55f6dd-0x0;var _0xca16f7=_0xbbe7[_0x55f6dd];return _0xca16f7;};'use strict';var VoiceQueueReportEvents=require(_0x7bbe('0x0'));var events=[_0x7bbe('0x1'),_0x7bbe('0x2'),_0x7bbe('0x3')];function createListener(_0x44c304,_0x359b99){return function(_0x461eb6){_0x359b99[_0x7bbe('0x4')](_0x44c304,_0x461eb6);};}function removeListener(_0x294820,_0xfb9177){return function(){VoiceQueueReportEvents[_0x7bbe('0x5')](_0x294820,_0xfb9177);};}exports[_0x7bbe('0x6')]=function(_0x54a7fc){for(var _0x40cdef=0x0,_0x4c01db=events[_0x7bbe('0x7')];_0x40cdef<_0x4c01db;_0x40cdef++){var _0x21809a=events[_0x40cdef];var _0x47ccdc=createListener(_0x7bbe('0x8')+_0x21809a,_0x54a7fc);VoiceQueueReportEvents['on'](_0x21809a,_0x47ccdc);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index fde3bb8..531c633 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 _0x600f=['isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x14c7b9,_0x5e904b){var _0x179174=function(_0x245646){while(--_0x245646){_0x14c7b9['push'](_0x14c7b9['shift']());}};_0x179174(++_0x5e904b);}(_0x600f,0xb4));var _0xf600=function(_0x282a1f,_0x49a6ef){_0x282a1f=_0x282a1f-0x0;var _0x296ea7=_0x600f[_0x282a1f];return _0x296ea7;};'use strict';var multer=require(_0xf600('0x0'));var util=require(_0xf600('0x1'));var path=require(_0xf600('0x2'));var timeout=require('connect-timeout');var express=require(_0xf600('0x3'));var router=express['Router']();var fs_extra=require(_0xf600('0x4'));var auth=require(_0xf600('0x5'));var interaction=require(_0xf600('0x6'));var config=require(_0xf600('0x7'));var controller=require(_0xf600('0x8'));router[_0xf600('0x9')]('/',auth[_0xf600('0xa')](),controller[_0xf600('0xb')]);router['get'](_0xf600('0xc'),auth['isAuthenticated'](),controller[_0xf600('0xd')]);router['post']('/',auth[_0xf600('0xa')](),controller[_0xf600('0xe')]);router[_0xf600('0xf')](_0xf600('0xc'),auth['isAuthenticated'](),controller[_0xf600('0x10')]);router[_0xf600('0x11')](_0xf600('0xc'),auth[_0xf600('0xa')](),controller['destroy']);module[_0xf600('0x12')]=router; \ No newline at end of file +var _0x4cfd=['/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index'];(function(_0x350ce5,_0x164c03){var _0x3f9ddb=function(_0x1b0ebd){while(--_0x1b0ebd){_0x350ce5['push'](_0x350ce5['shift']());}};_0x3f9ddb(++_0x164c03);}(_0x4cfd,0x170));var _0xd4cf=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0x4cfd[_0x1627ae];return _0x34b38f;};'use strict';var multer=require(_0xd4cf('0x0'));var util=require(_0xd4cf('0x1'));var path=require('path');var timeout=require(_0xd4cf('0x2'));var express=require(_0xd4cf('0x3'));var router=express[_0xd4cf('0x4')]();var fs_extra=require(_0xd4cf('0x5'));var auth=require(_0xd4cf('0x6'));var interaction=require(_0xd4cf('0x7'));var config=require('../../config/environment');var controller=require(_0xd4cf('0x8'));router[_0xd4cf('0x9')]('/',auth[_0xd4cf('0xa')](),controller[_0xd4cf('0xb')]);router[_0xd4cf('0x9')](_0xd4cf('0xc'),auth['isAuthenticated'](),controller[_0xd4cf('0xd')]);router[_0xd4cf('0xe')]('/',auth[_0xd4cf('0xa')](),controller[_0xd4cf('0xf')]);router[_0xd4cf('0x10')](_0xd4cf('0xc'),auth[_0xd4cf('0xa')](),controller['update']);router[_0xd4cf('0x11')](_0xd4cf('0xc'),auth[_0xd4cf('0xa')](),controller[_0xd4cf('0x12')]);module[_0xd4cf('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 97551d0..c2db01a 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 _0x6845=['sequelize','moment','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x6845,0x1c2));var _0x5684=function(_0x1f3fe8,_0x51025e){_0x1f3fe8=_0x1f3fe8-0x0;var _0x2e3bd2=_0x6845[_0x1f3fe8];return _0x2e3bd2;};'use strict';var Sequelize=require(_0x5684('0x0'));var moment=require(_0x5684('0x1'));module[_0x5684('0x2')]={'time':{'type':Sequelize[_0x5684('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x5684('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5684('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x5684('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x5684('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x5684('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x5684('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x5684('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x5684('0x4')](_0x5684('0x5'))}}; \ No newline at end of file +var _0x65ba=['YYYY-MM-DD\x20HH:mm:ss','exports','STRING','DATE','format'];(function(_0x524b8c,_0x1b4576){var _0x398fad=function(_0x405cb5){while(--_0x405cb5){_0x524b8c['push'](_0x524b8c['shift']());}};_0x398fad(++_0x1b4576);}(_0x65ba,0x1af));var _0xa65b=function(_0x13b796,_0x19507b){_0x13b796=_0x13b796-0x0;var _0x54757d=_0x65ba[_0x13b796];return _0x54757d;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xa65b('0x0')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xa65b('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa65b('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa65b('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa65b('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa65b('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa65b('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa65b('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa65b('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa65b('0x2')],'allowNull':![],'defaultValue':moment()[_0xa65b('0x3')](_0xa65b('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index bfcc9db..c35a5f9 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 _0xb10b=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','render','merge','body','contact','message','agent','account','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','where','VIRTUAL','filter','options','includeAll','include','catch','params','keys','find','create','eml-format','zip-dir'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0xb10b,0x12a));var _0xbb10=function(_0x345c86,_0x2b12e0){_0x345c86=_0x345c86-0x0;var _0x41e895=_0xb10b[_0x345c86];return _0x41e895;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}function getMustacheRender(_0x2a0e8b,_0x4aabb9){return Mustache[_0xbb10('0x2a')](_0x2a0e8b,_[_0xbb10('0x2b')](_0x4aabb9[_0xbb10('0x2c')],{'contact':_0x4aabb9[_0xbb10('0x2d')],'message':_0x4aabb9[_0xbb10('0x2e')],'agent':_0x4aabb9[_0xbb10('0x2f')],'interaction':_0x4aabb9['interaction'],'account':_0x4aabb9[_0xbb10('0x30')]}))||'';}exports['index']=function(_0x448d5c,_0x56f2da){var _0x16ad2a={},_0x1dcc9c={},_0x1b59f9={'count':0x0,'rows':[]};var _0x491db4=_['map'](db[_0xbb10('0x31')][_0xbb10('0x32')],function(_0x4f590d){return{'name':_0x4f590d[_0xbb10('0x33')],'type':_0x4f590d[_0xbb10('0x34')][_0xbb10('0x35')]};});_0x1dcc9c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x491db4,_0xbb10('0x28'));_0x1dcc9c[_0xbb10('0x38')]=_['keys'](_0x448d5c[_0xbb10('0x38')]);_0x1dcc9c[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x1dcc9c[_0xbb10('0x36')],_0x1dcc9c[_0xbb10('0x38')]);_0x16ad2a[_0xbb10('0x3b')]=_[_0xbb10('0x3a')](_0x1dcc9c[_0xbb10('0x36')],qs[_0xbb10('0x3c')](_0x448d5c['query'][_0xbb10('0x3c')]));_0x16ad2a[_0xbb10('0x3b')]=_0x16ad2a[_0xbb10('0x3b')][_0xbb10('0x3d')]?_0x16ad2a['attributes']:_0x1dcc9c[_0xbb10('0x36')];if(!_0x448d5c['query']['hasOwnProperty'](_0xbb10('0x3e'))){_0x16ad2a[_0xbb10('0x1c')]=qs[_0xbb10('0x1c')](_0x448d5c[_0xbb10('0x38')][_0xbb10('0x1c')]);_0x16ad2a[_0xbb10('0x1b')]=qs['offset'](_0x448d5c[_0xbb10('0x38')][_0xbb10('0x1b')]);}_0x16ad2a['order']=qs['sort'](_0x448d5c['query'][_0xbb10('0x3f')]);_0x16ad2a[_0xbb10('0x40')]=qs[_0xbb10('0x39')](_['pick'](_0x448d5c[_0xbb10('0x38')],_0x1dcc9c[_0xbb10('0x39')]),_0x491db4);if(_0x448d5c[_0xbb10('0x38')]['filter']){_0x16ad2a[_0xbb10('0x40')]=_[_0xbb10('0x2b')](_0x16ad2a[_0xbb10('0x40')],{'$or':_[_0xbb10('0x37')](_0x491db4,function(_0x4f1cdd){if(_0x4f1cdd[_0xbb10('0x34')]!==_0xbb10('0x41')){var _0x5835fd={};_0x5835fd[_0x4f1cdd[_0xbb10('0x28')]]={'$like':'%'+_0x448d5c[_0xbb10('0x38')][_0xbb10('0x42')]+'%'};return _0x5835fd;}})});}_0x16ad2a=_[_0xbb10('0x2b')]({},_0x16ad2a,_0x448d5c[_0xbb10('0x43')]);var _0x185a52={'where':_0x16ad2a['where']};return db[_0xbb10('0x31')][_0xbb10('0x1e')](_0x185a52)[_0xbb10('0x23')](function(_0x3d3c41){_0x1b59f9['count']=_0x3d3c41;if(_0x448d5c[_0xbb10('0x38')][_0xbb10('0x44')]){_0x16ad2a[_0xbb10('0x45')]=[{'all':!![]}];}return db[_0xbb10('0x31')]['findAll'](_0x16ad2a);})[_0xbb10('0x23')](function(_0x202c60){_0x1b59f9['rows']=_0x202c60;return _0x1b59f9;})['then'](respondWithFilteredResult(_0x56f2da,_0x16ad2a))[_0xbb10('0x46')](handleError(_0x56f2da,null));};exports['show']=function(_0x318984,_0x180933){var _0x4c66d8={'raw':!![],'where':{'id':_0x318984[_0xbb10('0x47')]['id']}},_0x366608={};_0x366608[_0xbb10('0x36')]=_['keys'](db[_0xbb10('0x31')][_0xbb10('0x32')]);_0x366608[_0xbb10('0x38')]=_[_0xbb10('0x48')](_0x318984[_0xbb10('0x38')]);_0x366608[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x366608[_0xbb10('0x36')],_0x366608[_0xbb10('0x38')]);_0x4c66d8[_0xbb10('0x3b')]=_[_0xbb10('0x3a')](_0x366608[_0xbb10('0x36')],qs['fields'](_0x318984[_0xbb10('0x38')][_0xbb10('0x3c')]));_0x4c66d8['attributes']=_0x4c66d8[_0xbb10('0x3b')][_0xbb10('0x3d')]?_0x4c66d8[_0xbb10('0x3b')]:_0x366608[_0xbb10('0x36')];if(_0x318984[_0xbb10('0x38')][_0xbb10('0x44')]){_0x4c66d8[_0xbb10('0x45')]=[{'all':!![]}];}_0x4c66d8=_['merge']({},_0x4c66d8,_0x318984['options']);return db[_0xbb10('0x31')][_0xbb10('0x49')](_0x4c66d8)[_0xbb10('0x23')](handleEntityNotFound(_0x180933,null))['then'](respondWithResult(_0x180933,null))['catch'](handleError(_0x180933,null));};exports[_0xbb10('0x4a')]=function(_0x34cf4e,_0x1bd054){return db[_0xbb10('0x31')][_0xbb10('0x4a')](_0x34cf4e[_0xbb10('0x2c')],{})[_0xbb10('0x23')](respondWithResult(_0x1bd054,0xc9))[_0xbb10('0x46')](handleError(_0x1bd054,null));};exports[_0xbb10('0x22')]=function(_0x3d7e7e,_0x550111){if(_0x3d7e7e['body']['id']){delete _0x3d7e7e[_0xbb10('0x2c')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x49')]({'where':{'id':_0x3d7e7e[_0xbb10('0x47')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x550111,null))[_0xbb10('0x23')](saveUpdates(_0x3d7e7e[_0xbb10('0x2c')],null))[_0xbb10('0x23')](respondWithResult(_0x550111,null))[_0xbb10('0x46')](handleError(_0x550111,null));};exports[_0xbb10('0x24')]=function(_0x19ca3e,_0x20e18a){return db[_0xbb10('0x31')][_0xbb10('0x49')]({'where':{'id':_0x19ca3e[_0xbb10('0x47')]['id']}})['then'](handleEntityNotFound(_0x20e18a,null))[_0xbb10('0x23')](removeEntity(_0x20e18a,null))['catch'](handleError(_0x20e18a,null));}; \ No newline at end of file +var _0xcb91=['Content-Range','reject','update','then','destroy','error','stack','name','send','render','merge','contact','agent','account','index','map','VoiceQueuesLog','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','include','options','create','body','find','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x179170,_0x414a7a){var _0x2e0aac=function(_0x32ca3f){while(--_0x32ca3f){_0x179170['push'](_0x179170['shift']());}};_0x2e0aac(++_0x414a7a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4de1b1,_0x18c64c){_0x4de1b1=_0x4de1b1-0x0;var _0x639f27=_0xcb91[_0x4de1b1];return _0x639f27;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}function getMustacheRender(_0x2e28fe,_0xb644b3){return Mustache[_0x1cb9('0x28')](_0x2e28fe,_[_0x1cb9('0x29')](_0xb644b3['body'],{'contact':_0xb644b3[_0x1cb9('0x2a')],'message':_0xb644b3['message'],'agent':_0xb644b3[_0x1cb9('0x2b')],'interaction':_0xb644b3['interaction'],'account':_0xb644b3[_0x1cb9('0x2c')]}))||'';}exports[_0x1cb9('0x2d')]=function(_0x3cd7f5,_0x2038aa){var _0x561d89={},_0x1c701f={},_0x4eba82={'count':0x0,'rows':[]};var _0xe0a0e2=_[_0x1cb9('0x2e')](db[_0x1cb9('0x2f')]['rawAttributes'],function(_0xae4c7a){return{'name':_0xae4c7a['fieldName'],'type':_0xae4c7a[_0x1cb9('0x30')]['key']};});_0x1c701f[_0x1cb9('0x31')]=_[_0x1cb9('0x2e')](_0xe0a0e2,_0x1cb9('0x26'));_0x1c701f[_0x1cb9('0x32')]=_['keys'](_0x3cd7f5[_0x1cb9('0x32')]);_0x1c701f[_0x1cb9('0x33')]=_[_0x1cb9('0x34')](_0x1c701f[_0x1cb9('0x31')],_0x1c701f[_0x1cb9('0x32')]);_0x561d89[_0x1cb9('0x35')]=_[_0x1cb9('0x34')](_0x1c701f[_0x1cb9('0x31')],qs[_0x1cb9('0x36')](_0x3cd7f5[_0x1cb9('0x32')][_0x1cb9('0x36')]));_0x561d89[_0x1cb9('0x35')]=_0x561d89[_0x1cb9('0x35')]['length']?_0x561d89['attributes']:_0x1c701f[_0x1cb9('0x31')];if(!_0x3cd7f5[_0x1cb9('0x32')][_0x1cb9('0x37')](_0x1cb9('0x38'))){_0x561d89[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x3cd7f5[_0x1cb9('0x32')][_0x1cb9('0x1c')]);_0x561d89['offset']=qs[_0x1cb9('0x1a')](_0x3cd7f5[_0x1cb9('0x32')][_0x1cb9('0x1a')]);}_0x561d89['order']=qs[_0x1cb9('0x39')](_0x3cd7f5['query'][_0x1cb9('0x39')]);_0x561d89['where']=qs[_0x1cb9('0x33')](_[_0x1cb9('0x3a')](_0x3cd7f5[_0x1cb9('0x32')],_0x1c701f[_0x1cb9('0x33')]),_0xe0a0e2);if(_0x3cd7f5[_0x1cb9('0x32')][_0x1cb9('0x3b')]){_0x561d89[_0x1cb9('0x3c')]=_['merge'](_0x561d89['where'],{'$or':_[_0x1cb9('0x2e')](_0xe0a0e2,function(_0x1d2723){if(_0x1d2723[_0x1cb9('0x30')]!==_0x1cb9('0x3d')){var _0x109483={};_0x109483[_0x1d2723[_0x1cb9('0x26')]]={'$like':'%'+_0x3cd7f5[_0x1cb9('0x32')]['filter']+'%'};return _0x109483;}})});}_0x561d89=_[_0x1cb9('0x29')]({},_0x561d89,_0x3cd7f5['options']);var _0x576ef2={'where':_0x561d89['where']};return db[_0x1cb9('0x2f')][_0x1cb9('0x1d')](_0x576ef2)[_0x1cb9('0x22')](function(_0x2e3cf3){_0x4eba82[_0x1cb9('0x1d')]=_0x2e3cf3;if(_0x3cd7f5['query'][_0x1cb9('0x3e')]){_0x561d89['include']=[{'all':!![]}];}return db[_0x1cb9('0x2f')][_0x1cb9('0x3f')](_0x561d89);})[_0x1cb9('0x22')](function(_0x5efd83){_0x4eba82[_0x1cb9('0x40')]=_0x5efd83;return _0x4eba82;})['then'](respondWithFilteredResult(_0x2038aa,_0x561d89))[_0x1cb9('0x41')](handleError(_0x2038aa,null));};exports[_0x1cb9('0x42')]=function(_0x51a898,_0x5839aa){var _0x24c643={'raw':!![],'where':{'id':_0x51a898[_0x1cb9('0x43')]['id']}},_0x339829={};_0x339829[_0x1cb9('0x31')]=_[_0x1cb9('0x44')](db['VoiceQueuesLog'][_0x1cb9('0x45')]);_0x339829['query']=_['keys'](_0x51a898['query']);_0x339829[_0x1cb9('0x33')]=_[_0x1cb9('0x34')](_0x339829[_0x1cb9('0x31')],_0x339829[_0x1cb9('0x32')]);_0x24c643[_0x1cb9('0x35')]=_[_0x1cb9('0x34')](_0x339829[_0x1cb9('0x31')],qs[_0x1cb9('0x36')](_0x51a898[_0x1cb9('0x32')][_0x1cb9('0x36')]));_0x24c643[_0x1cb9('0x35')]=_0x24c643['attributes'][_0x1cb9('0x46')]?_0x24c643[_0x1cb9('0x35')]:_0x339829[_0x1cb9('0x31')];if(_0x51a898['query'][_0x1cb9('0x3e')]){_0x24c643[_0x1cb9('0x47')]=[{'all':!![]}];}_0x24c643=_[_0x1cb9('0x29')]({},_0x24c643,_0x51a898[_0x1cb9('0x48')]);return db[_0x1cb9('0x2f')]['find'](_0x24c643)[_0x1cb9('0x22')](handleEntityNotFound(_0x5839aa,null))['then'](respondWithResult(_0x5839aa,null))[_0x1cb9('0x41')](handleError(_0x5839aa,null));};exports['create']=function(_0x1cf2ee,_0x3aed49){return db[_0x1cb9('0x2f')][_0x1cb9('0x49')](_0x1cf2ee['body'],{})[_0x1cb9('0x22')](respondWithResult(_0x3aed49,0xc9))[_0x1cb9('0x41')](handleError(_0x3aed49,null));};exports[_0x1cb9('0x21')]=function(_0x3561a5,_0x21072f){if(_0x3561a5[_0x1cb9('0x4a')]['id']){delete _0x3561a5[_0x1cb9('0x4a')]['id'];}return db[_0x1cb9('0x2f')][_0x1cb9('0x4b')]({'where':{'id':_0x3561a5[_0x1cb9('0x43')]['id']}})['then'](handleEntityNotFound(_0x21072f,null))['then'](saveUpdates(_0x3561a5[_0x1cb9('0x4a')],null))[_0x1cb9('0x22')](respondWithResult(_0x21072f,null))[_0x1cb9('0x41')](handleError(_0x21072f,null));};exports[_0x1cb9('0x23')]=function(_0x20b253,_0x2d076b){return db[_0x1cb9('0x2f')][_0x1cb9('0x4b')]({'where':{'id':_0x20b253[_0x1cb9('0x43')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2d076b,null))['then'](removeEntity(_0x2d076b,null))[_0x1cb9('0x41')](handleError(_0x2d076b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index a1dc296..f94a44f 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 _0x52db=['exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x549092,_0x4ab847){var _0x4a7e04=function(_0x485251){while(--_0x485251){_0x549092['push'](_0x549092['shift']());}};_0x4a7e04(++_0x4ab847);}(_0x52db,0x1c8));var _0xb52d=function(_0x4893d0,_0x48855a){_0x4893d0=_0x4893d0-0x0;var _0x3db72f=_0x52db[_0x4893d0];return _0x3db72f;};'use strict';var _=require(_0xb52d('0x0'));var util=require(_0xb52d('0x1'));var logger=require(_0xb52d('0x2'))(_0xb52d('0x3'));var moment=require('moment');var BPromise=require(_0xb52d('0x4'));var rp=require(_0xb52d('0x5'));var fs=require('fs');var path=require(_0xb52d('0x6'));var rimraf=require(_0xb52d('0x7'));var config=require(_0xb52d('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0xb52d('0x9')]=function(_0x495cd1,_0x795db0){return _0x495cd1['define'](_0xb52d('0xa'),attributes,{'tableName':_0xb52d('0xb'),'paranoid':![],'indexes':[{'name':_0xb52d('0xc'),'fields':[_0xb52d('0xd'),_0xb52d('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x70e4=['api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger'];(function(_0x98e07c,_0x264cc2){var _0x47a38a=function(_0x64ec74){while(--_0x64ec74){_0x98e07c['push'](_0x98e07c['shift']());}};_0x47a38a(++_0x264cc2);}(_0x70e4,0x192));var _0x470e=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0x70e4[_0x28509b];return _0x1e0b6;};'use strict';var _=require(_0x470e('0x0'));var util=require(_0x470e('0x1'));var logger=require(_0x470e('0x2'))(_0x470e('0x3'));var moment=require('moment');var BPromise=require(_0x470e('0x4'));var rp=require(_0x470e('0x5'));var fs=require('fs');var path=require(_0x470e('0x6'));var rimraf=require(_0x470e('0x7'));var config=require(_0x470e('0x8'));var attributes=require(_0x470e('0x9'));module['exports']=function(_0x2dcd36,_0x22e7c2){return _0x2dcd36['define'](_0x470e('0xa'),attributes,{'tableName':_0x470e('0xb'),'paranoid':![],'indexes':[{'name':_0x470e('0xc'),'fields':[_0x470e('0xd'),_0x470e('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 3c132bf..d66f386 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 _0x13f6=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util'];(function(_0x99302a,_0xc71da9){var _0x3273ff=function(_0x3181d7){while(--_0x3181d7){_0x99302a['push'](_0x99302a['shift']());}};_0x3273ff(++_0xc71da9);}(_0x13f6,0x124));var _0x613f=function(_0x26eb49,_0x35b5a8){_0x26eb49=_0x26eb49-0x0;var _0x53c5b1=_0x13f6[_0x26eb49];return _0x53c5b1;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x613f('0x2'));var fs=require('fs');var Redis=require(_0x613f('0x3'));var db=require(_0x613f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x613f('0x5'))(_0x613f('0x6'));var config=require(_0x613f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613f('0x8')][_0x613f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5618fa,_0x4b546b,_0x5a84f2){return new BPromise(function(_0x5c93c0,_0x2d5973){return client[_0x613f('0xa')](_0x5618fa,_0x5a84f2)[_0x613f('0xb')](function(_0x35b672){logger['info'](_0x613f('0xc'),_0x4b546b,_0x613f('0xd'));logger[_0x613f('0xe')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x4b546b,_0x613f('0xd'),JSON[_0x613f('0xf')](_0x35b672));if(_0x35b672[_0x613f('0x10')]){if(_0x35b672['error'][_0x613f('0x11')]===0x1f4){logger[_0x613f('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4b546b,_0x35b672['error']['message']);return _0x2d5973(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}logger[_0x613f('0x10')](_0x613f('0xc'),_0x4b546b,_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);return _0x5c93c0(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}else{logger[_0x613f('0x13')](_0x613f('0xc'),_0x4b546b,'request\x20sent');_0x5c93c0(_0x35b672[_0x613f('0x14')]['message']);}})['catch'](function(_0x1bc605){logger[_0x613f('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4b546b,_0x1bc605);_0x2d5973(_0x1bc605);});});} \ No newline at end of file +var _0x23a3=['stringify','error','code','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x4a47f4,_0x530f79){var _0x28f77e=function(_0x251522){while(--_0x251522){_0x4a47f4['push'](_0x4a47f4['shift']());}};_0x28f77e(++_0x530f79);}(_0x23a3,0x131));var _0x323a=function(_0x23461e,_0x1aadf0){_0x23461e=_0x23461e-0x0;var _0x5133ec=_0x23a3[_0x23461e];return _0x5133ec;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x323a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x323a('0x1'));var db=require(_0x323a('0x2'))['db'];var utils=require(_0x323a('0x3'));var logger=require(_0x323a('0x4'))(_0x323a('0x5'));var config=require(_0x323a('0x6'));var jayson=require(_0x323a('0x7'));var client=jayson[_0x323a('0x8')][_0x323a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ad5a,_0x3452d3,_0x3544bd){return new BPromise(function(_0x568996,_0x385a54){return client[_0x323a('0xa')](_0x50ad5a,_0x3544bd)[_0x323a('0xb')](function(_0x4a74bd){logger[_0x323a('0xc')](_0x323a('0xd'),_0x3452d3,_0x323a('0xe'));logger[_0x323a('0xf')](_0x323a('0x10'),_0x3452d3,_0x323a('0xe'),JSON[_0x323a('0x11')](_0x4a74bd));if(_0x4a74bd[_0x323a('0x12')]){if(_0x4a74bd[_0x323a('0x12')][_0x323a('0x13')]===0x1f4){logger[_0x323a('0x12')](_0x323a('0xd'),_0x3452d3,_0x4a74bd[_0x323a('0x12')][_0x323a('0x14')]);return _0x385a54(_0x4a74bd['error'][_0x323a('0x14')]);}logger['error'](_0x323a('0xd'),_0x3452d3,_0x4a74bd['error']['message']);return _0x568996(_0x4a74bd[_0x323a('0x12')]['message']);}else{logger[_0x323a('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3452d3,_0x323a('0xe'));_0x568996(_0x4a74bd[_0x323a('0x15')]['message']);}})[_0x323a('0x16')](function(_0x32674f){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x3452d3,_0x32674f);_0x385a54(_0x32674f);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 534bd77..7ddfca7 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 _0x64d1=['create','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','./voiceRecording.controller','get','isAuthenticated','/describe','/:id','show','/:id/download','download','downloads','/:id/transcribe','post'];(function(_0x5d7fc6,_0x36d5e0){var _0x2fb945=function(_0x3b1fd7){while(--_0x3b1fd7){_0x5d7fc6['push'](_0x5d7fc6['shift']());}};_0x2fb945(++_0x36d5e0);}(_0x64d1,0x115));var _0x164d=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x64d1[_0x237546];return _0x233e29;};'use strict';var multer=require(_0x164d('0x0'));var util=require(_0x164d('0x1'));var path=require(_0x164d('0x2'));var timeout=require(_0x164d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x164d('0x4'));var auth=require(_0x164d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x164d('0x6'));router[_0x164d('0x7')]('/',auth[_0x164d('0x8')](),controller['index']);router['get'](_0x164d('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x164d('0x7')](_0x164d('0xa'),auth[_0x164d('0x8')](),controller[_0x164d('0xb')]);router[_0x164d('0x7')](_0x164d('0xc'),auth[_0x164d('0x8')](),controller[_0x164d('0xd')]);router[_0x164d('0x7')]('/:id/downloads',controller[_0x164d('0xe')]);router['get'](_0x164d('0xf'),auth[_0x164d('0x8')](),controller['downloadTranscribe']);router[_0x164d('0x10')]('/',auth['isAuthenticated'](),controller[_0x164d('0x11')]);router[_0x164d('0x10')]('/:id/transcribe',auth[_0x164d('0x8')](),controller['runTranscribe']);router['put'](_0x164d('0xa'),auth[_0x164d('0x8')](),controller[_0x164d('0x12')]);router[_0x164d('0x13')](_0x164d('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x164d('0x14')]=router; \ No newline at end of file +var _0x5b5a=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','/:id/downloads','downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5b5a,0xb0));var _0xa5b5=function(_0x5e7634,_0x5356a1){_0x5e7634=_0x5e7634-0x0;var _0x563eb3=_0x5b5a[_0x5e7634];return _0x563eb3;};'use strict';var multer=require(_0xa5b5('0x0'));var util=require(_0xa5b5('0x1'));var path=require(_0xa5b5('0x2'));var timeout=require(_0xa5b5('0x3'));var express=require(_0xa5b5('0x4'));var router=express[_0xa5b5('0x5')]();var fs_extra=require(_0xa5b5('0x6'));var auth=require(_0xa5b5('0x7'));var interaction=require(_0xa5b5('0x8'));var config=require('../../config/environment');var controller=require(_0xa5b5('0x9'));router[_0xa5b5('0xa')]('/',auth[_0xa5b5('0xb')](),controller[_0xa5b5('0xc')]);router[_0xa5b5('0xa')](_0xa5b5('0xd'),auth['isAuthenticated'](),controller[_0xa5b5('0xe')]);router['get'](_0xa5b5('0xf'),auth[_0xa5b5('0xb')](),controller[_0xa5b5('0x10')]);router[_0xa5b5('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xa5b5('0x11')]);router[_0xa5b5('0xa')](_0xa5b5('0x12'),controller[_0xa5b5('0x13')]);router[_0xa5b5('0xa')]('/:id/transcribe',auth[_0xa5b5('0xb')](),controller[_0xa5b5('0x14')]);router[_0xa5b5('0x15')]('/',auth[_0xa5b5('0xb')](),controller[_0xa5b5('0x16')]);router[_0xa5b5('0x15')](_0xa5b5('0x17'),auth[_0xa5b5('0xb')](),controller[_0xa5b5('0x18')]);router['put'](_0xa5b5('0xf'),auth[_0xa5b5('0xb')](),controller['update']);router['delete'](_0xa5b5('0xf'),auth['isAuthenticated'](),controller[_0xa5b5('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 5d579b0..a9198ef 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 _0x6e0c=['moment','path','exports','VIRTUAL','getDataValue','value','STRING','setDataValue','channel','membername','split','TEXT','NEW','FLOAT','BOOLEAN','DATE','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x46e8cd,_0x3886f7){var _0x9d4af3=function(_0x4b1c18){while(--_0x4b1c18){_0x46e8cd['push'](_0x46e8cd['shift']());}};_0x9d4af3(++_0x3886f7);}(_0x6e0c,0x1c8));var _0xc6e0=function(_0x559499,_0x2ecc11){_0x559499=_0x559499-0x0;var _0x476cb7=_0x6e0c[_0x559499];return _0x476cb7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc6e0('0x0'));var path=require(_0xc6e0('0x1'));module[_0xc6e0('0x2')]={'format':{'type':Sequelize[_0xc6e0('0x3')],'get':function(){return this[_0xc6e0('0x4')](_0xc6e0('0x5'))?path['extname'](this[_0xc6e0('0x4')](_0xc6e0('0x5'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc6e0('0x6')],'set':function(_0x1d19c0){if(_0x1d19c0){this[_0xc6e0('0x7')](_0xc6e0('0x8'),_0x1d19c0);this[_0xc6e0('0x7')](_0xc6e0('0x9'),_0x1d19c0[_0xc6e0('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc6e0('0x6')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc6e0('0x6')]},'connectedlinename':{'type':Sequelize[_0xc6e0('0x6')]},'accountcode':{'type':Sequelize[_0xc6e0('0x6')]},'context':{'type':Sequelize[_0xc6e0('0x6')]},'exten':{'type':Sequelize[_0xc6e0('0x6')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc6e0('0x6')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xc6e0('0x6')]},'userDisposition':{'type':Sequelize[_0xc6e0('0x6')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xc6e0('0x6')]},'location':{'type':Sequelize[_0xc6e0('0xb')]},'transcribeName':{'type':Sequelize[_0xc6e0('0x6')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0xc6e0('0xc')},'fileUri':{'type':Sequelize[_0xc6e0('0xb')]},'fileText':{'type':Sequelize[_0xc6e0('0xb')]},'failureReason':{'type':Sequelize[_0xc6e0('0xb')]},'sentiment':{'type':Sequelize[_0xc6e0('0x6')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0xc6e0('0xd')]},'sNeutral':{'type':Sequelize[_0xc6e0('0xd')]},'sMixed':{'type':Sequelize[_0xc6e0('0xd')]},'tempSentiment':{'type':Sequelize[_0xc6e0('0xe')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xc6e0('0xf')],'get':function(){return moment(this[_0xc6e0('0x4')]('createdAt'))[_0xc6e0('0x10')](_0xc6e0('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0xc6e0('0xf')],'get':function(){return moment(this[_0xc6e0('0x4')]('updatedAt'))[_0xc6e0('0x10')](_0xc6e0('0x11'))[_0xc6e0('0x12')]();}}}; \ No newline at end of file +var _0xd60d=['channel','setDataValue','membername','INTEGER','FLOAT','BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','VIRTUAL','getDataValue','value','extname','STRING'];(function(_0x53f6af,_0x3a5634){var _0x17cf93=function(_0x4fa33e){while(--_0x4fa33e){_0x53f6af['push'](_0x53f6af['shift']());}};_0x17cf93(++_0x3a5634);}(_0xd60d,0x19c));var _0xdd60=function(_0x3e5250,_0x40be21){_0x3e5250=_0x3e5250-0x0;var _0x3ed819=_0xd60d[_0x3e5250];return _0x3ed819;};'use strict';var Sequelize=require(_0xdd60('0x0'));var moment=require(_0xdd60('0x1'));var path=require(_0xdd60('0x2'));module['exports']={'format':{'type':Sequelize[_0xdd60('0x3')],'get':function(){return this[_0xdd60('0x4')](_0xdd60('0x5'))?path[_0xdd60('0x6')](this[_0xdd60('0x4')](_0xdd60('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0xdd60('0x7')]},'channel':{'type':Sequelize[_0xdd60('0x7')],'set':function(_0x21dbf5){if(_0x21dbf5){this['setDataValue'](_0xdd60('0x8'),_0x21dbf5);this[_0xdd60('0x9')](_0xdd60('0xa'),_0x21dbf5['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xdd60('0x7')]},'calleridname':{'type':Sequelize[_0xdd60('0x7')]},'connectedlinenum':{'type':Sequelize[_0xdd60('0x7')]},'connectedlinename':{'type':Sequelize[_0xdd60('0x7')]},'accountcode':{'type':Sequelize[_0xdd60('0x7')]},'context':{'type':Sequelize[_0xdd60('0x7')]},'exten':{'type':Sequelize[_0xdd60('0x7')]},'value':{'type':Sequelize[_0xdd60('0x7')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0xdd60('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xdd60('0x7')]},'userThirdDisposition':{'type':Sequelize[_0xdd60('0x7')]},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize[_0xdd60('0x7')]},'transcribeStatus':{'type':Sequelize[_0xdd60('0x7')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0xdd60('0x7')]},'sPositive':{'type':Sequelize[_0xdd60('0xc')]},'sNegative':{'type':Sequelize[_0xdd60('0xc')]},'sNeutral':{'type':Sequelize[_0xdd60('0xc')]},'sMixed':{'type':Sequelize[_0xdd60('0xc')]},'tempSentiment':{'type':Sequelize[_0xdd60('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xdd60('0xe')],'get':function(){return moment(this[_0xdd60('0x4')](_0xdd60('0xf')))[_0xdd60('0x10')](_0xdd60('0x11'))[_0xdd60('0x12')]();}},'updatedAt':{'type':Sequelize[_0xdd60('0xe')],'get':function(){return moment(this[_0xdd60('0x4')](_0xdd60('0x13')))['format'](_0xdd60('0x11'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index a712e42..19b6f4e 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 _0xb43f=['updateAttributes','writeFile','downloadTranscribe','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','aws-sdk','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','json','apply','update','then','error','stack','name','send','render','merge','body','agent','interaction','account','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','include','rows','catch','show','params','includeAll','create','find','describe','download','uniqueid','value','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','../../components/encryptor','sequelize','MD5','col','token','push','$and','%s.cypher','decryptFile','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJobName','transcribeName','TranscriptionJob','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','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'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb43f,0x1e3));var _0xfb43=function(_0x40e41e,_0x3d30e7){_0x40e41e=_0x40e41e-0x0;var _0x18b70c=_0xb43f[_0x40e41e];return _0x18b70c;};'use strict';var emlformat=require(_0xfb43('0x0'));var rimraf=require(_0xfb43('0x1'));var zipdir=require(_0xfb43('0x2'));var jsonpatch=require(_0xfb43('0x3'));var rp=require(_0xfb43('0x4'));var moment=require(_0xfb43('0x5'));var BPromise=require(_0xfb43('0x6'));var Mustache=require(_0xfb43('0x7'));var util=require('util');var path=require('path');var sox=require(_0xfb43('0x8'));var csv=require('to-csv');var ejs=require(_0xfb43('0x9'));var fs=require('fs');var fs_extra=require(_0xfb43('0xa'));var _=require(_0xfb43('0xb'));var squel=require('squel');var crypto=require(_0xfb43('0xc'));var jsforce=require(_0xfb43('0xd'));var deskjs=require(_0xfb43('0xe'));var toCsv=require(_0xfb43('0xf'));var querystring=require(_0xfb43('0x10'));var Papa=require('papaparse');var AWS=require(_0xfb43('0x11'));var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require(_0xfb43('0x12'));var qs=require(_0xfb43('0x13'));var as=require(_0xfb43('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb43('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xfb43('0x16'));var licenseUtil=require(_0xfb43('0x17'));var db=require(_0xfb43('0x18'))['db'];function respondWithStatusCode(_0xd0e21c,_0x49593b){_0x49593b=_0x49593b||0xcc;return function(_0x1899b0){if(_0x1899b0){return _0xd0e21c[_0xfb43('0x19')](_0x49593b);}return _0xd0e21c[_0xfb43('0x1a')](_0x49593b)[_0xfb43('0x1b')]();};}function respondWithResult(_0x5c49c8,_0x320706){_0x320706=_0x320706||0xc8;return function(_0x761b70){if(_0x761b70){return _0x5c49c8[_0xfb43('0x1a')](_0x320706)['json'](_0x761b70);}};}function respondWithFilteredResult(_0xff61d3,_0x321552){return function(_0x2eff55){if(_0x2eff55){var _0x6c8ce0=typeof _0x321552[_0xfb43('0x1c')]===_0xfb43('0x1d')&&typeof _0x321552['limit']===_0xfb43('0x1d');var _0x50b500=_0x2eff55['count'];var _0x2a6a0b=_0x6c8ce0?0x0:_0x321552[_0xfb43('0x1c')];var _0x142d27=_0x6c8ce0?_0x2eff55['count']:_0x321552['offset']+_0x321552[_0xfb43('0x1e')];var _0x3233c5;if(_0x142d27>=_0x50b500){_0x142d27=_0x50b500;_0x3233c5=0xc8;}else{_0x3233c5=0xce;}_0xff61d3['status'](_0x3233c5);return _0xff61d3[_0xfb43('0x1f')]('Content-Range',_0x2a6a0b+'-'+_0x142d27+'/'+_0x50b500)[_0xfb43('0x20')](_0x2eff55);}return null;};}function patchUpdates(_0x59ccc6){return function(_0x3377bc){try{jsonpatch[_0xfb43('0x21')](_0x3377bc,_0x59ccc6,!![]);}catch(_0x401771){return BPromise['reject'](_0x401771);}return _0x3377bc['save']();};}function saveUpdates(_0x420bc1,_0x1ed8f2){return function(_0x2f5be1){if(_0x2f5be1){return _0x2f5be1[_0xfb43('0x22')](_0x420bc1)[_0xfb43('0x23')](function(_0x101244){return _0x101244;});}return null;};}function removeEntity(_0x999427,_0x1780eb){return function(_0x1bef26){if(_0x1bef26){return _0x1bef26['destroy']()[_0xfb43('0x23')](function(){_0x999427['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cb052,_0x3e0baf){return function(_0x49aa22){if(!_0x49aa22){_0x3cb052['sendStatus'](0x194);}return _0x49aa22;};}function handleError(_0x407fb7,_0x423725){_0x423725=_0x423725||0x1f4;return function(_0x598488){logger[_0xfb43('0x24')](_0x598488[_0xfb43('0x25')]);if(_0x598488[_0xfb43('0x26')]){delete _0x598488[_0xfb43('0x26')];}_0x407fb7[_0xfb43('0x1a')](_0x423725)[_0xfb43('0x27')](_0x598488);};}function getMustacheRender(_0x4b448b,_0x19fca1){return Mustache[_0xfb43('0x28')](_0x4b448b,_[_0xfb43('0x29')](_0x19fca1[_0xfb43('0x2a')],{'contact':_0x19fca1['contact'],'message':_0x19fca1['message'],'agent':_0x19fca1[_0xfb43('0x2b')],'interaction':_0x19fca1[_0xfb43('0x2c')],'account':_0x19fca1[_0xfb43('0x2d')]}))||'';}exports['index']=function(_0x2b78b5,_0xe5bdd1){var _0x2d575a={},_0x14f3bd={},_0x179cd4={'count':0x0,'rows':[]};var _0x3adb77=_[_0xfb43('0x2e')](db[_0xfb43('0x2f')][_0xfb43('0x30')],function(_0x263ffe){return{'name':_0x263ffe[_0xfb43('0x31')],'type':_0x263ffe[_0xfb43('0x32')][_0xfb43('0x33')]};});_0x14f3bd[_0xfb43('0x34')]=_[_0xfb43('0x35')](_['map'](_0x3adb77,_0xfb43('0x26')),[_0xfb43('0x36')]);_0x14f3bd[_0xfb43('0x37')]=_[_0xfb43('0x38')](_0x2b78b5[_0xfb43('0x37')]);_0x14f3bd[_0xfb43('0x39')]=_[_0xfb43('0x3a')](_0x14f3bd['model'],_0x14f3bd[_0xfb43('0x37')]);_0x2d575a[_0xfb43('0x3b')]=_[_0xfb43('0x3a')](_0x14f3bd['model'],qs[_0xfb43('0x3c')](_0x2b78b5['query'][_0xfb43('0x3c')]));_0x2d575a[_0xfb43('0x3b')]=_0x2d575a[_0xfb43('0x3b')][_0xfb43('0x3d')]?_0x2d575a[_0xfb43('0x3b')]:_0x14f3bd[_0xfb43('0x34')];if(!_0x2b78b5[_0xfb43('0x37')][_0xfb43('0x3e')](_0xfb43('0x3f'))){_0x2d575a['limit']=qs['limit'](_0x2b78b5[_0xfb43('0x37')][_0xfb43('0x1e')]);_0x2d575a[_0xfb43('0x1c')]=qs[_0xfb43('0x1c')](_0x2b78b5[_0xfb43('0x37')][_0xfb43('0x1c')]);}_0x2d575a[_0xfb43('0x40')]=qs['sort'](_0x2b78b5[_0xfb43('0x37')][_0xfb43('0x41')]);_0x2d575a[_0xfb43('0x42')]=qs['filters'](_[_0xfb43('0x43')](_0x2b78b5[_0xfb43('0x37')],_0x14f3bd[_0xfb43('0x39')]),_0x3adb77);if(_0x2b78b5['query'][_0xfb43('0x44')]){_0x2d575a[_0xfb43('0x42')]=_[_0xfb43('0x29')](_0x2d575a[_0xfb43('0x42')],{'$or':_[_0xfb43('0x2e')](_0x3adb77,function(_0x62c020){if(_0x62c020[_0xfb43('0x32')]!==_0xfb43('0x45')){var _0x326087={};_0x326087[_0x62c020[_0xfb43('0x26')]]={'$like':'%'+_0x2b78b5[_0xfb43('0x37')][_0xfb43('0x44')]+'%'};return _0x326087;}})});}_0x2d575a=_[_0xfb43('0x29')]({},_0x2d575a,_0x2b78b5[_0xfb43('0x46')]);var _0x11fc65={'where':_0x2d575a['where']};return db['VoiceRecording'][_0xfb43('0x47')](_0x11fc65)[_0xfb43('0x23')](function(_0x65886f){_0x179cd4[_0xfb43('0x47')]=_0x65886f;if(_0x2b78b5[_0xfb43('0x37')]['includeAll']){_0x2d575a[_0xfb43('0x48')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x2d575a);})[_0xfb43('0x23')](function(_0x4059d1){_0x179cd4[_0xfb43('0x49')]=_0x4059d1;return _0x179cd4;})['then'](respondWithFilteredResult(_0xe5bdd1,_0x2d575a))[_0xfb43('0x4a')](handleError(_0xe5bdd1,null));};exports[_0xfb43('0x4b')]=function(_0x2fbb8c,_0x2a5d56){var _0x1b5a42={'raw':![],'where':{'id':_0x2fbb8c[_0xfb43('0x4c')]['id']}},_0x539182={};_0x539182['model']=_[_0xfb43('0x38')](db[_0xfb43('0x2f')][_0xfb43('0x30')]);_0x539182['query']=_[_0xfb43('0x38')](_0x2fbb8c[_0xfb43('0x37')]);_0x539182[_0xfb43('0x39')]=_['intersection'](_0x539182['model'],_0x539182[_0xfb43('0x37')]);_0x1b5a42['attributes']=_[_0xfb43('0x3a')](_0x539182[_0xfb43('0x34')],qs[_0xfb43('0x3c')](_0x2fbb8c[_0xfb43('0x37')]['fields']));_0x1b5a42['attributes']=_0x1b5a42[_0xfb43('0x3b')][_0xfb43('0x3d')]?_0x1b5a42['attributes']:_0x539182[_0xfb43('0x34')];if(_0x2fbb8c[_0xfb43('0x37')][_0xfb43('0x4d')]){_0x1b5a42['include']=[{'all':!![]}];}_0x1b5a42=_[_0xfb43('0x29')]({},_0x1b5a42,_0x2fbb8c['options']);return db[_0xfb43('0x2f')]['find'](_0x1b5a42)[_0xfb43('0x23')](handleEntityNotFound(_0x2a5d56,null))[_0xfb43('0x23')](respondWithResult(_0x2a5d56,null))[_0xfb43('0x4a')](handleError(_0x2a5d56,null));};exports[_0xfb43('0x4e')]=function(_0x128819,_0x58746c){return db[_0xfb43('0x2f')][_0xfb43('0x4e')](_0x128819[_0xfb43('0x2a')],{})['then'](respondWithResult(_0x58746c,0xc9))[_0xfb43('0x4a')](handleError(_0x58746c,null));};exports[_0xfb43('0x22')]=function(_0x3d09ff,_0x14888b){if(_0x3d09ff[_0xfb43('0x2a')]['id']){delete _0x3d09ff[_0xfb43('0x2a')]['id'];}return db[_0xfb43('0x2f')][_0xfb43('0x4f')]({'where':{'id':_0x3d09ff['params']['id']}})[_0xfb43('0x23')](handleEntityNotFound(_0x14888b,null))['then'](saveUpdates(_0x3d09ff['body'],null))[_0xfb43('0x23')](respondWithResult(_0x14888b,null))[_0xfb43('0x4a')](handleError(_0x14888b,null));};exports['describe']=function(_0x404fbc,_0x2ba370){return db['VoiceRecording'][_0xfb43('0x50')]()[_0xfb43('0x23')](respondWithResult(_0x2ba370,null))[_0xfb43('0x4a')](handleError(_0x2ba370,null));};exports[_0xfb43('0x51')]=function(_0x11eabe,_0x29703a,_0x1ee396){var _0x112d97=require('../../components/encryptor');var _0x197bb4=![];var _0x5831db={};if(_0x11eabe[_0xfb43('0x37')][_0xfb43('0x32')]&&_0x11eabe[_0xfb43('0x37')][_0xfb43('0x32')]===_0xfb43('0x52')){_0x5831db[_0xfb43('0x52')]=_0x11eabe[_0xfb43('0x4c')]['id'];}else{_0x5831db['id']=_0x11eabe['params']['id'];}return db['VoiceRecording']['find']({'where':_0x5831db,'attributes':['id',_0xfb43('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x29703a,null))[_0xfb43('0x23')](function(_0x3c40ef){if(_0x3c40ef){var _0x4b166d=_0x3c40ef[_0xfb43('0x53')];var _0x252eac=util[_0xfb43('0x36')]('%s.cypher',_0x4b166d);if(fs[_0xfb43('0x54')](_0x252eac)){_0x197bb4=!![];return _0x112d97['decryptFile'](_0x252eac,_0x4b166d,config[_0xfb43('0x55')][_0xfb43('0x56')])[_0xfb43('0x23')](function(){return _0x3c40ef;});}return _0x3c40ef;}})[_0xfb43('0x23')](function(_0x516a68){if(_0x516a68){var _0xbbfe45=_0x516a68['value'];if(!fs['existsSync'](_0xbbfe45)){throw new db[(_0xfb43('0x57'))][(_0xfb43('0x58'))](_0xfb43('0x59'));}if(_0x516a68[_0xfb43('0x5a')]){return _0x29703a['download'](_0xbbfe45,_0x516a68['filename']+path[_0xfb43('0x5b')](_0xbbfe45),function(){if(_0x197bb4){fs['unlink'](_0xbbfe45);}});}else{return _0x29703a[_0xfb43('0x51')](_0xbbfe45,function(_0x4ab92c){if(_0x197bb4){fs[_0xfb43('0x5c')](_0xbbfe45);}});}}})[_0xfb43('0x4a')](function(_0x4fec2c){if(_0x4fec2c[_0xfb43('0x5d')]===_0xfb43('0x59')){_0x29703a[_0xfb43('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x29703a,null);}});};exports[_0xfb43('0x5e')]=function(_0x3e237f,_0x5af272,_0x164053){var _0xf474af=require(_0xfb43('0x5f'));var _0x32ec47=![];var _0x5a1d56={'$and':[db['sequelize'][_0xfb43('0x42')](db[_0xfb43('0x60')]['fn'](_0xfb43('0x61'),db[_0xfb43('0x60')][_0xfb43('0x62')](_0xfb43('0x52'))),_0x3e237f['query'][_0xfb43('0x63')])]};if(_0x3e237f['query'][_0xfb43('0x32')]&&_0x3e237f[_0xfb43('0x37')][_0xfb43('0x32')]===_0xfb43('0x52')){_0x5a1d56['$and'][_0xfb43('0x64')]({'uniqueid':_0x3e237f[_0xfb43('0x4c')]['id']});}else{_0x5a1d56[_0xfb43('0x65')][_0xfb43('0x64')]({'id':_0x3e237f['params']['id']});}return db[_0xfb43('0x2f')][_0xfb43('0x4f')]({'where':_0x5a1d56,'attributes':['id',_0xfb43('0x53')],'raw':!![]})[_0xfb43('0x23')](handleEntityNotFound(_0x5af272,null))[_0xfb43('0x23')](function(_0x384cf3){if(_0x384cf3){var _0x13c9e9=util[_0xfb43('0x36')](_0xfb43('0x66'),_0x384cf3[_0xfb43('0x53')]);if(fs[_0xfb43('0x54')](_0x13c9e9)){_0x32ec47=!![];return _0xf474af[_0xfb43('0x67')](_0x13c9e9,_0x384cf3[_0xfb43('0x53')],config[_0xfb43('0x55')][_0xfb43('0x56')])[_0xfb43('0x23')](function(){return _0x384cf3;});}return _0x384cf3;}})[_0xfb43('0x23')](function(_0x30f0ca){if(_0x30f0ca){if(!fs[_0xfb43('0x54')](_0x30f0ca[_0xfb43('0x53')])){throw new db[(_0xfb43('0x57'))][(_0xfb43('0x58'))](_0xfb43('0x59'));}if(_0x30f0ca['filename']){return _0x5af272[_0xfb43('0x51')](_0x30f0ca[_0xfb43('0x53')],_0x30f0ca[_0xfb43('0x5a')]+path[_0xfb43('0x5b')](_0x30f0ca[_0xfb43('0x53')]),function(){if(_0x32ec47){fs[_0xfb43('0x5c')](_0x30f0ca[_0xfb43('0x53')]);}});}else{return _0x5af272[_0xfb43('0x51')](_0x30f0ca[_0xfb43('0x53')],function(_0x885b5c){if(_0x32ec47){fs['unlink'](_0x30f0ca[_0xfb43('0x53')]);}});}}})[_0xfb43('0x4a')](handleError(_0x5af272,null));};exports[_0xfb43('0x68')]=function(_0x54abe1,_0x3add82){return db['VoiceRecording'][_0xfb43('0x4f')]({'where':{'id':_0x54abe1[_0xfb43('0x4c')]['id']}})[_0xfb43('0x23')](function(_0x597b91){if(_[_0xfb43('0x69')](_0x597b91)){throw new ReferenceError(_0xfb43('0x6a'));}return _0x597b91;})[_0xfb43('0x23')](function(_0x4c78be){var _0x78effa=_0x4c78be['value'];logger[_0xfb43('0x6b')](_0xfb43('0x6c'),_0x78effa);if(!_[_0xfb43('0x69')](_0x4c78be[_0xfb43('0x53')])&&fs[_0xfb43('0x54')](_0x78effa)){logger['info'](_0xfb43('0x6d')+_0x78effa+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x78effa);}_0x78effa=_0x78effa+_0xfb43('0x6e');if(!_[_0xfb43('0x69')](_0x4c78be[_0xfb43('0x53')])&&fs[_0xfb43('0x54')](_0x78effa)){logger['info'](_0xfb43('0x6d')+_0x78effa+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xfb43('0x6f')](_0x78effa);}return _0x4c78be;})[_0xfb43('0x23')](function(_0x289d1b){if(!_0x289d1b)throw new InternalError();return _0x289d1b[_0xfb43('0x68')]();})[_0xfb43('0x23')](function(){_0x3add82[_0xfb43('0x1a')](0xcc)[_0xfb43('0x1b')]();})[_0xfb43('0x4a')](handleError(_0x3add82,null));};function getBucketslist(_0x298ba8,_0x128402,_0x3b6d4b){return new Promise(function(_0x12635b,_0x191a36){var _0x11cddd=new AWS['S3']({'accessKeyId':_0x128402,'secretAccessKey':_0x298ba8,'region':_0x3b6d4b});_0x11cddd[_0xfb43('0x70')]({},function(_0x2bd89f,_0x49daff){if(_0x2bd89f){return _0x191a36(_0x2bd89f);}else{return _0x12635b(_0x49daff);}});});}function createBucket(_0x552c11,_0x111f3f,_0x359e20,_0x3917df){return new Promise(function(_0xc865bf,_0x47270b){var _0x394eaa=new AWS['S3']({'accessKeyId':_0x111f3f,'secretAccessKey':_0x552c11,'region':_0x359e20});_0x394eaa[_0xfb43('0x71')]({'Bucket':_0x3917df},function(_0xaa32c4,_0x9ba47a){if(_0xaa32c4){return _0x47270b(_0xaa32c4);}else{return _0xc865bf(_0x9ba47a);}});});}function uploadFile(_0xf2af2e,_0xbe5e3c,_0x7a529c,_0x468966,_0x42b7fb,_0x845f4a){return new Promise(function(_0x36b906,_0x45bcd9){var _0x529fdc=new AWS['S3']({'accessKeyId':_0xbe5e3c,'secretAccessKey':_0xf2af2e,'region':_0x7a529c});_0x529fdc[_0xfb43('0x72')]({'Bucket':_0x468966,'Key':_0x42b7fb,'Body':_0x845f4a},function(_0x22097b,_0x108e8b){if(_0x22097b){return _0x45bcd9(_0x22097b);}else{return _0x36b906(_0x108e8b);}});});}function startTranscribe(_0x2e3b04,_0x20b4e8,_0x5a0564,_0x5d9d50,_0x3adaa9,_0x230ae0){return new Promise(function(_0x44d9b4,_0x5b09b0){var _0x5666cc=new AWS[(_0xfb43('0x73'))]({'accessKeyId':_0x20b4e8,'secretAccessKey':_0x2e3b04,'region':_0x5a0564});_0x5666cc[_0xfb43('0x74')]({'TranscriptionJobName':_0x5d9d50,'LanguageCode':_0x3adaa9,'Media':{'MediaFileUri':_0x230ae0}},function(_0x5733c4,_0x696eac){if(_0x5733c4){return _0x5b09b0(_0x5733c4);}else{return _0x44d9b4(_0x696eac);}});});}function transcribe(_0x2b6368,_0x2fd5f6,_0x449644,_0x81fd57,_0x2c5457,_0x3176f9,_0x49efce){return new Promise(function(_0x362403,_0x12251f){var _0x3ae8d1={};logger['info'](util['format'](_0xfb43('0x75'),_0x2b6368,_0x2c5457));return uploadFile(_0x2fd5f6,_0x449644,_0x81fd57,_0x2c5457,path[_0xfb43('0x76')](_0x3176f9),fs['readFileSync'](_0x3176f9))[_0xfb43('0x23')](function(_0x48efce){logger[_0xfb43('0x6b')](util[_0xfb43('0x36')](_0xfb43('0x77'),_0x2b6368,_0x2c5457,_0x48efce[_0xfb43('0x78')]));_0x3ae8d1[_0xfb43('0x79')]=_0x48efce[_0xfb43('0x7a')];_0x3ae8d1[_0xfb43('0x7b')]=_0x48efce[_0xfb43('0x78')];logger[_0xfb43('0x6b')](util[_0xfb43('0x36')](_0xfb43('0x7c'),_0x2b6368));return startTranscribe(_0x2fd5f6,_0x449644,_0x81fd57,uuidv4(),_0x49efce,_0x48efce[_0xfb43('0x78')]);})[_0xfb43('0x23')](function(_0x35d9f1){logger['info'](util[_0xfb43('0x36')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x2b6368,_0x35d9f1['TranscriptionJob'][_0xfb43('0x7d')]));_0x3ae8d1[_0xfb43('0x7e')]=_0x35d9f1[_0xfb43('0x7f')][_0xfb43('0x7d')];_0x3ae8d1['transcribeStatus']=_0x35d9f1['TranscriptionJob'][_0xfb43('0x80')];return _0x362403(_0x3ae8d1);})['catch'](function(_0x257815){return _0x12251f(_0x257815);});});}exports[_0xfb43('0x81')]=function(_0x54d551,_0x1b095f,_0x289e9f){var _0x2f014b;var _0x467300;var _0x2f7e7f;var _0x3c35c6=require(_0xfb43('0x5f'));return db['VoiceRecording'][_0xfb43('0x82')]({'where':{'id':_0x54d551[_0xfb43('0x4c')]['id']}})['then'](function(_0x2eac38){if(_0x2eac38){var _0x24ab90=util[_0xfb43('0x36')](_0xfb43('0x66'),_0x2eac38[_0xfb43('0x53')]);if(fs[_0xfb43('0x54')](_0x24ab90)){cypher=!![];return _0x3c35c6['decryptFile'](_0x24ab90,_0x2eac38[_0xfb43('0x53')],config['secrets']['recording'])[_0xfb43('0x23')](function(){return _0x2eac38;});}return _0x2eac38;}})['then'](function(_0x5908de){if(!_0x5908de){throw new db[(_0xfb43('0x57'))][(_0xfb43('0x58'))](_0xfb43('0x83'));}_0x467300=_0x5908de;return db[_0xfb43('0x84')][_0xfb43('0x82')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x1b095f,null))[_0xfb43('0x23')](function(_0x305815){if(_0x305815){_0x2f014b=_0x305815;if(!_0x2f014b[_0xfb43('0x85')]||!_0x2f014b[_0xfb43('0x86')]||!_0x2f014b[_0xfb43('0x87')]||!_0x2f014b[_0xfb43('0x88')]||!_0x2f014b[_0xfb43('0x79')]){throw new db[(_0xfb43('0x57'))][(_0xfb43('0x58'))](_0xfb43('0x89'));}if(_0x54d551['body'][_0xfb43('0x8a')]&&(!_0x2f014b['sentiment']||!_0x2f014b[_0xfb43('0x8b')]||!_0x2f014b[_0xfb43('0x8c')]||!_0x2f014b[_0xfb43('0x88')]||!_0x2f014b[_0xfb43('0x79')])){throw new db[(_0xfb43('0x57'))][(_0xfb43('0x58'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider']['findOne']({'where':{'id':_0x2f014b[_0xfb43('0x86')]}});}})['then'](function(_0x5c423d){if(!_0x5c423d){throw new db[(_0xfb43('0x57'))][(_0xfb43('0x58'))](_0xfb43('0x8d'));}if(!_0x5c423d[_0xfb43('0x8e')]||!_0x5c423d[_0xfb43('0x8f')]){throw new db[(_0xfb43('0x57'))]['ValidationError'](_0xfb43('0x90'));}_0x2f7e7f=_0x5c423d;return getBucketslist(_0x2f7e7f[_0xfb43('0x8e')],_0x2f7e7f[_0xfb43('0x8f')],_0x2f014b['transcribeRegion']);})[_0xfb43('0x23')](function(_0x298b9e){if(_0x298b9e&&_0x298b9e[_0xfb43('0x91')]){var _0x131a85=_[_0xfb43('0x4f')](_0x298b9e['Buckets'],function(_0xc74f68){return _0xc74f68[_0xfb43('0x92')]===_0x2f014b[_0xfb43('0x79')];});if(!_0x131a85){logger[_0xfb43('0x6b')](util[_0xfb43('0x36')](_0xfb43('0x93'),_0x54d551[_0xfb43('0x4c')]['id'],_0x2f014b[_0xfb43('0x79')]));return createBucket(_0x2f7e7f[_0xfb43('0x8e')],_0x2f7e7f[_0xfb43('0x8f')],_0x2f014b[_0xfb43('0x87')],_0x2f014b['bucket']);}logger[_0xfb43('0x6b')](util['format'](_0xfb43('0x94'),_0x54d551['params']['id'],_0x2f014b[_0xfb43('0x79')]));return;}})[_0xfb43('0x23')](function(_0x2a0e94){if(_0x467300['transcribeStatus']===_0xfb43('0x95')){return transcribe(_0x54d551['params']['id'],_0x2f7e7f['data1'],_0x2f7e7f[_0xfb43('0x8f')],_0x2f014b['transcribeRegion'],_0x2f014b['bucket'],_0x467300[_0xfb43('0x53')],_0x2f014b['language']);}else{logger[_0xfb43('0x6b')](util[_0xfb43('0x36')](_0xfb43('0x96'),_0x54d551['params']['id']));return{'transcribeStatus':_0xfb43('0x97')};}})[_0xfb43('0x23')](function(_0x560575){if(_0x560575){_0x560575[_0xfb43('0x98')]=_0x54d551[_0xfb43('0x2a')][_0xfb43('0x8a')];return _0x467300[_0xfb43('0x99')](_0x560575);}})[_0xfb43('0x23')](respondWithResult(_0x1b095f,null))['catch'](handleError(_0x1b095f,null));};function writeFile(_0x20450f,_0x1eb3aa){return new Promise(function(_0x3f6ea0,_0x4a8e26){fs[_0xfb43('0x9a')](_0x1eb3aa,_0x20450f,function(_0xf17236,_0x391630){if(_0xf17236){return _0x4a8e26(_0xf17236);}else{return _0x3f6ea0(_0x391630);}});});}exports[_0xfb43('0x9b')]=function(_0x1c1b45,_0x24ce43,_0x1dd450){return db['VoiceRecording']['findOne']({'where':{'id':_0x1c1b45[_0xfb43('0x4c')]['id']}})['then'](handleEntityNotFound(_0x24ce43))['then'](function(_0x5bd1d9){if(_0x5bd1d9&&_0x5bd1d9['fileText']){var _0x3a9d51=_0x5bd1d9['fileText'];var _0x506e83=config[_0xfb43('0x9c')]+_0xfb43('0x9d')+_0x5bd1d9['id']+'.txt';if(fs[_0xfb43('0x54')](_0x506e83)){return _0x506e83;}return writeFile(_0x3a9d51,_0x506e83)[_0xfb43('0x23')](function(){return _0x506e83;});}else{throw new db[(_0xfb43('0x57'))]['ValidationError'](_0xfb43('0x9e'));}})[_0xfb43('0x23')](function(_0x393440){return _0x24ce43[_0xfb43('0x51')](_0x393440);})[_0xfb43('0x4a')](handleError(_0x24ce43));}; \ No newline at end of file +var _0x1c10=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','count','offset','reject','then','error','stack','name','send','merge','body','contact','message','agent','account','index','map','VoiceRecording','rawAttributes','fieldName','type','key','format','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','update','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','token','$and','push','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','destroy','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','mustache'];(function(_0x53c6b8,_0x4fa61f){var _0x165415=function(_0x402d88){while(--_0x402d88){_0x53c6b8['push'](_0x53c6b8['shift']());}};_0x165415(++_0x4fa61f);}(_0x1c10,0x1c5));var _0x01c1=function(_0x1a62a2,_0xecce5b){_0x1a62a2=_0x1a62a2-0x0;var _0x4cfd26=_0x1c10[_0x1a62a2];return _0x4cfd26;};'use strict';var emlformat=require(_0x01c1('0x0'));var rimraf=require(_0x01c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x01c1('0x2'));var util=require('util');var path=require(_0x01c1('0x3'));var sox=require(_0x01c1('0x4'));var csv=require(_0x01c1('0x5'));var ejs=require(_0x01c1('0x6'));var fs=require('fs');var fs_extra=require(_0x01c1('0x7'));var _=require('lodash');var squel=require(_0x01c1('0x8'));var crypto=require(_0x01c1('0x9'));var jsforce=require(_0x01c1('0xa'));var deskjs=require(_0x01c1('0xb'));var toCsv=require(_0x01c1('0x5'));var querystring=require(_0x01c1('0xc'));var Papa=require(_0x01c1('0xd'));var AWS=require(_0x01c1('0xe'));var uuidv4=require('uuid/v4');var Redis=require(_0x01c1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x01c1('0x10'));var as=require(_0x01c1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x01c1('0x12'))(_0x01c1('0x13'));var utils=require(_0x01c1('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d4ccd,_0x2ad8c2){_0x2ad8c2=_0x2ad8c2||0xcc;return function(_0x373c9b){if(_0x373c9b){return _0x5d4ccd[_0x01c1('0x15')](_0x2ad8c2);}return _0x5d4ccd[_0x01c1('0x16')](_0x2ad8c2)[_0x01c1('0x17')]();};}function respondWithResult(_0x2c70e7,_0x5089af){_0x5089af=_0x5089af||0xc8;return function(_0x28ff2e){if(_0x28ff2e){return _0x2c70e7[_0x01c1('0x16')](_0x5089af)[_0x01c1('0x18')](_0x28ff2e);}};}function respondWithFilteredResult(_0x289d54,_0x208dc9){return function(_0x30ff04){if(_0x30ff04){var _0x5bc88d=typeof _0x208dc9['offset']===_0x01c1('0x19')&&typeof _0x208dc9['limit']===_0x01c1('0x19');var _0xb69794=_0x30ff04[_0x01c1('0x1a')];var _0x2f5231=_0x5bc88d?0x0:_0x208dc9[_0x01c1('0x1b')];var _0x95c648=_0x5bc88d?_0x30ff04[_0x01c1('0x1a')]:_0x208dc9['offset']+_0x208dc9['limit'];var _0x30d35f;if(_0x95c648>=_0xb69794){_0x95c648=_0xb69794;_0x30d35f=0xc8;}else{_0x30d35f=0xce;}_0x289d54[_0x01c1('0x16')](_0x30d35f);return _0x289d54['set']('Content-Range',_0x2f5231+'-'+_0x95c648+'/'+_0xb69794)[_0x01c1('0x18')](_0x30ff04);}return null;};}function patchUpdates(_0x2e92c5){return function(_0x5be555){try{jsonpatch['apply'](_0x5be555,_0x2e92c5,!![]);}catch(_0x2fc93e){return BPromise[_0x01c1('0x1c')](_0x2fc93e);}return _0x5be555['save']();};}function saveUpdates(_0x4694ad,_0x38b984){return function(_0x29ab57){if(_0x29ab57){return _0x29ab57['update'](_0x4694ad)[_0x01c1('0x1d')](function(_0x553178){return _0x553178;});}return null;};}function removeEntity(_0x5c9da7,_0x59e5b5){return function(_0x54a7c4){if(_0x54a7c4){return _0x54a7c4['destroy']()['then'](function(){_0x5c9da7[_0x01c1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4da72d,_0x58b127){return function(_0x550ece){if(!_0x550ece){_0x4da72d['sendStatus'](0x194);}return _0x550ece;};}function handleError(_0x24e6cf,_0x21085a){_0x21085a=_0x21085a||0x1f4;return function(_0x306b4a){logger[_0x01c1('0x1e')](_0x306b4a[_0x01c1('0x1f')]);if(_0x306b4a[_0x01c1('0x20')]){delete _0x306b4a[_0x01c1('0x20')];}_0x24e6cf[_0x01c1('0x16')](_0x21085a)[_0x01c1('0x21')](_0x306b4a);};}function getMustacheRender(_0x33de8c,_0x167f46){return Mustache['render'](_0x33de8c,_[_0x01c1('0x22')](_0x167f46[_0x01c1('0x23')],{'contact':_0x167f46[_0x01c1('0x24')],'message':_0x167f46[_0x01c1('0x25')],'agent':_0x167f46[_0x01c1('0x26')],'interaction':_0x167f46['interaction'],'account':_0x167f46[_0x01c1('0x27')]}))||'';}exports[_0x01c1('0x28')]=function(_0x418fe1,_0x167a4d){var _0x3ca9e9={},_0x4a016e={},_0x8cca1b={'count':0x0,'rows':[]};var _0x14546d=_[_0x01c1('0x29')](db[_0x01c1('0x2a')][_0x01c1('0x2b')],function(_0x4953a5){return{'name':_0x4953a5[_0x01c1('0x2c')],'type':_0x4953a5[_0x01c1('0x2d')][_0x01c1('0x2e')]};});_0x4a016e['model']=_['differenceBy'](_[_0x01c1('0x29')](_0x14546d,_0x01c1('0x20')),[_0x01c1('0x2f')]);_0x4a016e['query']=_['keys'](_0x418fe1[_0x01c1('0x30')]);_0x4a016e[_0x01c1('0x31')]=_[_0x01c1('0x32')](_0x4a016e[_0x01c1('0x33')],_0x4a016e[_0x01c1('0x30')]);_0x3ca9e9[_0x01c1('0x34')]=_[_0x01c1('0x32')](_0x4a016e[_0x01c1('0x33')],qs[_0x01c1('0x35')](_0x418fe1[_0x01c1('0x30')][_0x01c1('0x35')]));_0x3ca9e9[_0x01c1('0x34')]=_0x3ca9e9[_0x01c1('0x34')][_0x01c1('0x36')]?_0x3ca9e9[_0x01c1('0x34')]:_0x4a016e[_0x01c1('0x33')];if(!_0x418fe1['query'][_0x01c1('0x37')](_0x01c1('0x38'))){_0x3ca9e9[_0x01c1('0x39')]=qs['limit'](_0x418fe1[_0x01c1('0x30')]['limit']);_0x3ca9e9['offset']=qs[_0x01c1('0x1b')](_0x418fe1[_0x01c1('0x30')][_0x01c1('0x1b')]);}_0x3ca9e9['order']=qs[_0x01c1('0x3a')](_0x418fe1[_0x01c1('0x30')][_0x01c1('0x3a')]);_0x3ca9e9[_0x01c1('0x3b')]=qs['filters'](_[_0x01c1('0x3c')](_0x418fe1[_0x01c1('0x30')],_0x4a016e[_0x01c1('0x31')]),_0x14546d);if(_0x418fe1[_0x01c1('0x30')][_0x01c1('0x3d')]){_0x3ca9e9[_0x01c1('0x3b')]=_[_0x01c1('0x22')](_0x3ca9e9[_0x01c1('0x3b')],{'$or':_[_0x01c1('0x29')](_0x14546d,function(_0x5e0dfe){if(_0x5e0dfe[_0x01c1('0x2d')]!==_0x01c1('0x3e')){var _0x1415af={};_0x1415af[_0x5e0dfe[_0x01c1('0x20')]]={'$like':'%'+_0x418fe1['query'][_0x01c1('0x3d')]+'%'};return _0x1415af;}})});}_0x3ca9e9=_[_0x01c1('0x22')]({},_0x3ca9e9,_0x418fe1[_0x01c1('0x3f')]);var _0x20586f={'where':_0x3ca9e9[_0x01c1('0x3b')]};return db['VoiceRecording'][_0x01c1('0x1a')](_0x20586f)[_0x01c1('0x1d')](function(_0x2c4bb7){_0x8cca1b[_0x01c1('0x1a')]=_0x2c4bb7;if(_0x418fe1[_0x01c1('0x30')][_0x01c1('0x40')]){_0x3ca9e9[_0x01c1('0x41')]=[{'all':!![]}];}return db[_0x01c1('0x2a')][_0x01c1('0x42')](_0x3ca9e9);})['then'](function(_0x521665){_0x8cca1b[_0x01c1('0x43')]=_0x521665;return _0x8cca1b;})[_0x01c1('0x1d')](respondWithFilteredResult(_0x167a4d,_0x3ca9e9))[_0x01c1('0x44')](handleError(_0x167a4d,null));};exports[_0x01c1('0x45')]=function(_0x5e8480,_0x25c3e0){var _0x2fd9f1={'raw':![],'where':{'id':_0x5e8480[_0x01c1('0x46')]['id']}},_0x100499={};_0x100499['model']=_[_0x01c1('0x47')](db[_0x01c1('0x2a')]['rawAttributes']);_0x100499[_0x01c1('0x30')]=_[_0x01c1('0x47')](_0x5e8480[_0x01c1('0x30')]);_0x100499['filters']=_[_0x01c1('0x32')](_0x100499['model'],_0x100499[_0x01c1('0x30')]);_0x2fd9f1[_0x01c1('0x34')]=_[_0x01c1('0x32')](_0x100499[_0x01c1('0x33')],qs[_0x01c1('0x35')](_0x5e8480[_0x01c1('0x30')][_0x01c1('0x35')]));_0x2fd9f1[_0x01c1('0x34')]=_0x2fd9f1[_0x01c1('0x34')]['length']?_0x2fd9f1['attributes']:_0x100499[_0x01c1('0x33')];if(_0x5e8480[_0x01c1('0x30')]['includeAll']){_0x2fd9f1[_0x01c1('0x41')]=[{'all':!![]}];}_0x2fd9f1=_['merge']({},_0x2fd9f1,_0x5e8480['options']);return db[_0x01c1('0x2a')]['find'](_0x2fd9f1)['then'](handleEntityNotFound(_0x25c3e0,null))[_0x01c1('0x1d')](respondWithResult(_0x25c3e0,null))['catch'](handleError(_0x25c3e0,null));};exports['create']=function(_0x7f824,_0x6627a8){return db[_0x01c1('0x2a')][_0x01c1('0x48')](_0x7f824['body'],{})[_0x01c1('0x1d')](respondWithResult(_0x6627a8,0xc9))['catch'](handleError(_0x6627a8,null));};exports[_0x01c1('0x49')]=function(_0x52b12d,_0x5142c2){if(_0x52b12d[_0x01c1('0x23')]['id']){delete _0x52b12d[_0x01c1('0x23')]['id'];}return db['VoiceRecording'][_0x01c1('0x4a')]({'where':{'id':_0x52b12d[_0x01c1('0x46')]['id']}})[_0x01c1('0x1d')](handleEntityNotFound(_0x5142c2,null))[_0x01c1('0x1d')](saveUpdates(_0x52b12d['body'],null))[_0x01c1('0x1d')](respondWithResult(_0x5142c2,null))[_0x01c1('0x44')](handleError(_0x5142c2,null));};exports['describe']=function(_0x44dd32,_0x345766){return db[_0x01c1('0x2a')][_0x01c1('0x4b')]()[_0x01c1('0x1d')](respondWithResult(_0x345766,null))[_0x01c1('0x44')](handleError(_0x345766,null));};exports[_0x01c1('0x4c')]=function(_0x3da1f7,_0x48b6d9,_0x30c738){var _0x446a08=require(_0x01c1('0x4d'));var _0x15e2e5=![];var _0x4d2997={};if(_0x3da1f7['query']['type']&&_0x3da1f7[_0x01c1('0x30')][_0x01c1('0x2d')]===_0x01c1('0x4e')){_0x4d2997['uniqueid']=_0x3da1f7['params']['id'];}else{_0x4d2997['id']=_0x3da1f7[_0x01c1('0x46')]['id'];}return db[_0x01c1('0x2a')][_0x01c1('0x4a')]({'where':_0x4d2997,'attributes':['id','value'],'raw':!![]})[_0x01c1('0x1d')](handleEntityNotFound(_0x48b6d9,null))[_0x01c1('0x1d')](function(_0x1f20f4){if(_0x1f20f4){var _0x366802=_0x1f20f4[_0x01c1('0x4f')];var _0x5e3c86=util[_0x01c1('0x2f')](_0x01c1('0x50'),_0x366802);if(fs[_0x01c1('0x51')](_0x5e3c86)){_0x15e2e5=!![];return _0x446a08[_0x01c1('0x52')](_0x5e3c86,_0x366802,config[_0x01c1('0x53')][_0x01c1('0x54')])['then'](function(){return _0x1f20f4;});}return _0x1f20f4;}})[_0x01c1('0x1d')](function(_0x2a99d3){if(_0x2a99d3){var _0x5619fd=_0x2a99d3[_0x01c1('0x4f')];if(!fs[_0x01c1('0x51')](_0x5619fd)){throw new db[(_0x01c1('0x55'))][(_0x01c1('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x2a99d3['filename']){return _0x48b6d9[_0x01c1('0x4c')](_0x5619fd,_0x2a99d3[_0x01c1('0x57')]+path[_0x01c1('0x58')](_0x5619fd),function(){if(_0x15e2e5){fs[_0x01c1('0x59')](_0x5619fd);}});}else{return _0x48b6d9[_0x01c1('0x4c')](_0x5619fd,function(_0x5aa41f){if(_0x15e2e5){fs[_0x01c1('0x59')](_0x5619fd);}});}}})[_0x01c1('0x44')](function(_0xc73c8e){if(_0xc73c8e[_0x01c1('0x25')]===_0x01c1('0x5a')){_0x48b6d9['status'](0x194)['send'](_0x01c1('0x5b'));}else{return handleError(_0x48b6d9,null);}});};exports[_0x01c1('0x5c')]=function(_0x2173cb,_0x3bbd75,_0x197b9){var _0x5784ae=require(_0x01c1('0x4d'));var _0x96a3b3=![];var _0x3b1a1f={'$and':[db[_0x01c1('0x5d')][_0x01c1('0x3b')](db[_0x01c1('0x5d')]['fn'](_0x01c1('0x5e'),db[_0x01c1('0x5d')]['col'](_0x01c1('0x4e'))),_0x2173cb['query'][_0x01c1('0x5f')])]};if(_0x2173cb[_0x01c1('0x30')]['type']&&_0x2173cb['query']['type']===_0x01c1('0x4e')){_0x3b1a1f[_0x01c1('0x60')][_0x01c1('0x61')]({'uniqueid':_0x2173cb[_0x01c1('0x46')]['id']});}else{_0x3b1a1f['$and'][_0x01c1('0x61')]({'id':_0x2173cb['params']['id']});}return db[_0x01c1('0x2a')]['find']({'where':_0x3b1a1f,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x3bbd75,null))[_0x01c1('0x1d')](function(_0x5354c2){if(_0x5354c2){var _0x502405=util[_0x01c1('0x2f')](_0x01c1('0x50'),_0x5354c2[_0x01c1('0x4f')]);if(fs[_0x01c1('0x51')](_0x502405)){_0x96a3b3=!![];return _0x5784ae[_0x01c1('0x52')](_0x502405,_0x5354c2[_0x01c1('0x4f')],config[_0x01c1('0x53')][_0x01c1('0x54')])['then'](function(){return _0x5354c2;});}return _0x5354c2;}})[_0x01c1('0x1d')](function(_0x1defc5){if(_0x1defc5){if(!fs[_0x01c1('0x51')](_0x1defc5[_0x01c1('0x4f')])){throw new db[(_0x01c1('0x55'))][(_0x01c1('0x56'))](_0x01c1('0x5a'));}if(_0x1defc5[_0x01c1('0x57')]){return _0x3bbd75[_0x01c1('0x4c')](_0x1defc5[_0x01c1('0x4f')],_0x1defc5[_0x01c1('0x57')]+path['extname'](_0x1defc5[_0x01c1('0x4f')]),function(){if(_0x96a3b3){fs[_0x01c1('0x59')](_0x1defc5[_0x01c1('0x4f')]);}});}else{return _0x3bbd75[_0x01c1('0x4c')](_0x1defc5['value'],function(_0x306a19){if(_0x96a3b3){fs['unlink'](_0x1defc5['value']);}});}}})['catch'](handleError(_0x3bbd75,null));};exports['destroy']=function(_0x36d354,_0x4fe6f2){return db[_0x01c1('0x2a')]['find']({'where':{'id':_0x36d354['params']['id']}})['then'](function(_0x18726a){if(_[_0x01c1('0x62')](_0x18726a)){throw new ReferenceError(_0x01c1('0x63'));}return _0x18726a;})[_0x01c1('0x1d')](function(_0x3aa2e2){var _0x5b2692=_0x3aa2e2[_0x01c1('0x4f')];logger[_0x01c1('0x64')](_0x01c1('0x65'),_0x5b2692);if(!_[_0x01c1('0x62')](_0x3aa2e2[_0x01c1('0x4f')])&&fs[_0x01c1('0x51')](_0x5b2692)){logger['info'](_0x01c1('0x66')+_0x5b2692+_0x01c1('0x67'));fs[_0x01c1('0x68')](_0x5b2692);}_0x5b2692=_0x5b2692+_0x01c1('0x69');if(!_[_0x01c1('0x62')](_0x3aa2e2[_0x01c1('0x4f')])&&fs['existsSync'](_0x5b2692)){logger['info'](_0x01c1('0x66')+_0x5b2692+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x01c1('0x68')](_0x5b2692);}return _0x3aa2e2;})['then'](function(_0x38e736){if(!_0x38e736)throw new InternalError();return _0x38e736[_0x01c1('0x6a')]();})[_0x01c1('0x1d')](function(){_0x4fe6f2[_0x01c1('0x16')](0xcc)[_0x01c1('0x17')]();})[_0x01c1('0x44')](handleError(_0x4fe6f2,null));};function getBucketslist(_0x1c745e,_0x928328,_0x355780){return new Promise(function(_0x30a80f,_0x517223){var _0x5aec5f=new AWS['S3']({'accessKeyId':_0x928328,'secretAccessKey':_0x1c745e,'region':_0x355780});_0x5aec5f['listBuckets']({},function(_0x519e88,_0x26938a){if(_0x519e88){return _0x517223(_0x519e88);}else{return _0x30a80f(_0x26938a);}});});}function createBucket(_0x4a659e,_0x50d73d,_0x2adb46,_0x11820e){return new Promise(function(_0x477d6,_0x202e97){var _0x41acba=new AWS['S3']({'accessKeyId':_0x50d73d,'secretAccessKey':_0x4a659e,'region':_0x2adb46});_0x41acba[_0x01c1('0x6b')]({'Bucket':_0x11820e},function(_0x642b33,_0x23e68d){if(_0x642b33){return _0x202e97(_0x642b33);}else{return _0x477d6(_0x23e68d);}});});}function uploadFile(_0x14572d,_0x166946,_0x2c4c3a,_0x86e6c4,_0xa47023,_0xef6250){return new Promise(function(_0x59c2a7,_0x42ae17){var _0x4637a9=new AWS['S3']({'accessKeyId':_0x166946,'secretAccessKey':_0x14572d,'region':_0x2c4c3a});_0x4637a9[_0x01c1('0x6c')]({'Bucket':_0x86e6c4,'Key':_0xa47023,'Body':_0xef6250},function(_0x433573,_0x4b4451){if(_0x433573){return _0x42ae17(_0x433573);}else{return _0x59c2a7(_0x4b4451);}});});}function startTranscribe(_0x393ab5,_0x5a101b,_0xa1d534,_0x598c02,_0x2bdcaa,_0x149a30){return new Promise(function(_0x4f4e61,_0x4f66c7){var _0x4c9e66=new AWS[(_0x01c1('0x6d'))]({'accessKeyId':_0x5a101b,'secretAccessKey':_0x393ab5,'region':_0xa1d534});_0x4c9e66[_0x01c1('0x6e')]({'TranscriptionJobName':_0x598c02,'LanguageCode':_0x2bdcaa,'Media':{'MediaFileUri':_0x149a30}},function(_0x21d525,_0x39a602){if(_0x21d525){return _0x4f66c7(_0x21d525);}else{return _0x4f4e61(_0x39a602);}});});}function transcribe(_0xabe395,_0x162a98,_0x2db27f,_0x435143,_0x422a6e,_0x36b1a6,_0xf44efc){return new Promise(function(_0x4468e7,_0x2b4274){var _0x54c8f3={};logger['info'](util[_0x01c1('0x2f')](_0x01c1('0x6f'),_0xabe395,_0x422a6e));return uploadFile(_0x162a98,_0x2db27f,_0x435143,_0x422a6e,path['basename'](_0x36b1a6),fs[_0x01c1('0x70')](_0x36b1a6))[_0x01c1('0x1d')](function(_0x5b4034){logger['info'](util[_0x01c1('0x2f')](_0x01c1('0x71'),_0xabe395,_0x422a6e,_0x5b4034[_0x01c1('0x72')]));_0x54c8f3['bucket']=_0x5b4034[_0x01c1('0x73')];_0x54c8f3[_0x01c1('0x74')]=_0x5b4034[_0x01c1('0x72')];logger[_0x01c1('0x64')](util['format'](_0x01c1('0x75'),_0xabe395));return startTranscribe(_0x162a98,_0x2db27f,_0x435143,uuidv4(),_0xf44efc,_0x5b4034[_0x01c1('0x72')]);})['then'](function(_0x268143){logger[_0x01c1('0x64')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0xabe395,_0x268143[_0x01c1('0x76')]['TranscriptionJobName']));_0x54c8f3['transcribeName']=_0x268143[_0x01c1('0x76')][_0x01c1('0x77')];_0x54c8f3[_0x01c1('0x78')]=_0x268143['TranscriptionJob'][_0x01c1('0x79')];return _0x4468e7(_0x54c8f3);})[_0x01c1('0x44')](function(_0x28c063){return _0x2b4274(_0x28c063);});});}exports[_0x01c1('0x7a')]=function(_0x43c8d4,_0x26a6a2,_0x1391b7){var _0x1919aa;var _0x3c906a;var _0x3340c7;var _0x121b5c=require('../../components/encryptor');return db['VoiceRecording'][_0x01c1('0x7b')]({'where':{'id':_0x43c8d4[_0x01c1('0x46')]['id']}})[_0x01c1('0x1d')](function(_0x1ee53f){if(_0x1ee53f){var _0x1d7a9=util['format'](_0x01c1('0x50'),_0x1ee53f['value']);if(fs['existsSync'](_0x1d7a9)){cypher=!![];return _0x121b5c[_0x01c1('0x52')](_0x1d7a9,_0x1ee53f['value'],config[_0x01c1('0x53')]['recording'])[_0x01c1('0x1d')](function(){return _0x1ee53f;});}return _0x1ee53f;}})['then'](function(_0x5d2d59){if(!_0x5d2d59){throw new db[(_0x01c1('0x55'))][(_0x01c1('0x56'))](_0x01c1('0x7c'));}_0x3c906a=_0x5d2d59;return db[_0x01c1('0x7d')]['findOne']({'where':{'id':0x1}});})[_0x01c1('0x1d')](handleEntityNotFound(_0x26a6a2,null))[_0x01c1('0x1d')](function(_0x2a2f84){if(_0x2a2f84){_0x1919aa=_0x2a2f84;if(!_0x1919aa[_0x01c1('0x7e')]||!_0x1919aa[_0x01c1('0x7f')]||!_0x1919aa[_0x01c1('0x80')]||!_0x1919aa['language']||!_0x1919aa[_0x01c1('0x81')]){throw new db['Sequelize'][(_0x01c1('0x56'))](_0x01c1('0x82'));}if(_0x43c8d4['body'][_0x01c1('0x83')]&&(!_0x1919aa[_0x01c1('0x84')]||!_0x1919aa[_0x01c1('0x85')]||!_0x1919aa[_0x01c1('0x86')]||!_0x1919aa[_0x01c1('0x87')]||!_0x1919aa[_0x01c1('0x81')])){throw new db[(_0x01c1('0x55'))][(_0x01c1('0x56'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x01c1('0x88')]['findOne']({'where':{'id':_0x1919aa['transcribeAccountId']}});}})[_0x01c1('0x1d')](function(_0x1803b1){if(!_0x1803b1){throw new db['Sequelize'][(_0x01c1('0x56'))](_0x01c1('0x89'));}if(!_0x1803b1[_0x01c1('0x8a')]||!_0x1803b1['data2']){throw new db[(_0x01c1('0x55'))][(_0x01c1('0x56'))](_0x01c1('0x8b'));}_0x3340c7=_0x1803b1;return getBucketslist(_0x3340c7[_0x01c1('0x8a')],_0x3340c7[_0x01c1('0x8c')],_0x1919aa[_0x01c1('0x80')]);})[_0x01c1('0x1d')](function(_0x1f310c){if(_0x1f310c&&_0x1f310c[_0x01c1('0x8d')]){var _0x17ee11=_[_0x01c1('0x4a')](_0x1f310c[_0x01c1('0x8d')],function(_0x287a20){return _0x287a20['Name']===_0x1919aa[_0x01c1('0x81')];});if(!_0x17ee11){logger[_0x01c1('0x64')](util[_0x01c1('0x2f')](_0x01c1('0x8e'),_0x43c8d4[_0x01c1('0x46')]['id'],_0x1919aa[_0x01c1('0x81')]));return createBucket(_0x3340c7['data1'],_0x3340c7['data2'],_0x1919aa['transcribeRegion'],_0x1919aa[_0x01c1('0x81')]);}logger[_0x01c1('0x64')](util['format'](_0x01c1('0x8f'),_0x43c8d4[_0x01c1('0x46')]['id'],_0x1919aa['bucket']));return;}})[_0x01c1('0x1d')](function(_0x53ecf8){if(_0x3c906a['transcribeStatus']===_0x01c1('0x90')){return transcribe(_0x43c8d4[_0x01c1('0x46')]['id'],_0x3340c7[_0x01c1('0x8a')],_0x3340c7[_0x01c1('0x8c')],_0x1919aa[_0x01c1('0x80')],_0x1919aa['bucket'],_0x3c906a[_0x01c1('0x4f')],_0x1919aa[_0x01c1('0x87')]);}else{logger['info'](util[_0x01c1('0x2f')](_0x01c1('0x91'),_0x43c8d4[_0x01c1('0x46')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x01c1('0x1d')](function(_0x398cb0){if(_0x398cb0){_0x398cb0['tempSentiment']=_0x43c8d4['body'][_0x01c1('0x83')];return _0x3c906a[_0x01c1('0x92')](_0x398cb0);}})[_0x01c1('0x1d')](respondWithResult(_0x26a6a2,null))[_0x01c1('0x44')](handleError(_0x26a6a2,null));};function writeFile(_0x54d693,_0x259754){return new Promise(function(_0xeaaad9,_0x170b7c){fs[_0x01c1('0x93')](_0x259754,_0x54d693,function(_0x42397e,_0xf2833e){if(_0x42397e){return _0x170b7c(_0x42397e);}else{return _0xeaaad9(_0xf2833e);}});});}exports[_0x01c1('0x94')]=function(_0x4a124d,_0x188c1e,_0x1fc5d8){return db[_0x01c1('0x2a')][_0x01c1('0x7b')]({'where':{'id':_0x4a124d[_0x01c1('0x46')]['id']}})['then'](handleEntityNotFound(_0x188c1e))[_0x01c1('0x1d')](function(_0x3c39c0){if(_0x3c39c0&&_0x3c39c0[_0x01c1('0x95')]){var _0x48dead=_0x3c39c0[_0x01c1('0x95')];var _0x2f55c4=config['root']+_0x01c1('0x96')+_0x3c39c0['id']+'.txt';if(fs[_0x01c1('0x51')](_0x2f55c4)){return _0x2f55c4;}return writeFile(_0x48dead,_0x2f55c4)['then'](function(){return _0x2f55c4;});}else{throw new db[(_0x01c1('0x55'))]['ValidationError'](_0x01c1('0x97'));}})['then'](function(_0x7f15f9){return _0x188c1e[_0x01c1('0x4c')](_0x7f15f9);})['catch'](handleError(_0x188c1e));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 337f677..e647342 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 _0xb40f=['../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3a76f7,_0x2cd65d){var _0x4d4e44=function(_0x26f9a3){while(--_0x26f9a3){_0x3a76f7['push'](_0x3a76f7['shift']());}};_0x4d4e44(++_0x2cd65d);}(_0xb40f,0x181));var _0xfb40=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0xb40f[_0x2b152a];return _0x2ad4c7;};'use strict';var _=require(_0xfb40('0x0'));var util=require(_0xfb40('0x1'));var logger=require(_0xfb40('0x2'))(_0xfb40('0x3'));var moment=require(_0xfb40('0x4'));var BPromise=require(_0xfb40('0x5'));var rp=require(_0xfb40('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfb40('0x7'));var attributes=require(_0xfb40('0x8'));module[_0xfb40('0x9')]=function(_0x49e0f3,_0x57fca6){return _0x49e0f3[_0xfb40('0xa')](_0xfb40('0xb'),attributes,{'tableName':_0xfb40('0xc'),'paranoid':![],'indexes':[{'name':_0xfb40('0xd'),'fields':[_0xfb40('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f54=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid','lodash'];(function(_0x4b52a0,_0x51164b){var _0x5355e1=function(_0x5c3ba5){while(--_0x5c3ba5){_0x4b52a0['push'](_0x4b52a0['shift']());}};_0x5355e1(++_0x51164b);}(_0x8f54,0x9b));var _0x48f5=function(_0x5f489a,_0x4c3b21){_0x5f489a=_0x5f489a-0x0;var _0x1c6328=_0x8f54[_0x5f489a];return _0x1c6328;};'use strict';var _=require(_0x48f5('0x0'));var util=require(_0x48f5('0x1'));var logger=require(_0x48f5('0x2'))('api');var moment=require(_0x48f5('0x3'));var BPromise=require(_0x48f5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x48f5('0x5'));var rimraf=require(_0x48f5('0x6'));var config=require(_0x48f5('0x7'));var attributes=require(_0x48f5('0x8'));module['exports']=function(_0x911b21,_0x294219){return _0x911b21[_0x48f5('0x9')](_0x48f5('0xa'),attributes,{'tableName':_0x48f5('0xb'),'paranoid':![],'indexes':[{'name':_0x48f5('0xc'),'fields':[_0x48f5('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 3fe9c58..cc7101f 100644 --- a/server/api/voiceRecording/voiceRecording.rpc.js +++ b/server/api/voiceRecording/voiceRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x3d69f9,_0x24daed){var _0x386964=function(_0x2d04fe){while(--_0x2d04fe){_0x3d69f9['push'](_0x3d69f9['shift']());}};_0x386964(++_0x24daed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x4ffafb,_0x20171a){var _0x4ab472=function(_0x1afc75){while(--_0x1afc75){_0x4ffafb['push'](_0x4ffafb['shift']());}};_0x4ab472(++_0x20171a);}(_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 moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 40395d6..d64f2f1 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 _0xa2c1=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../config/environment','./voiceTransferReport.controller','get'];(function(_0x6f114,_0x2ac0f9){var _0x40546b=function(_0x3902ac){while(--_0x3902ac){_0x6f114['push'](_0x6f114['shift']());}};_0x40546b(++_0x2ac0f9);}(_0xa2c1,0x1ad));var _0x1a2c=function(_0xb9ead4,_0x50b588){_0xb9ead4=_0xb9ead4-0x0;var _0x216e67=_0xa2c1[_0xb9ead4];return _0x216e67;};'use strict';var multer=require(_0x1a2c('0x0'));var util=require('util');var path=require(_0x1a2c('0x1'));var timeout=require('connect-timeout');var express=require(_0x1a2c('0x2'));var router=express[_0x1a2c('0x3')]();var fs_extra=require(_0x1a2c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a2c('0x5'));var controller=require(_0x1a2c('0x6'));router[_0x1a2c('0x7')]('/',auth[_0x1a2c('0x8')](),controller[_0x1a2c('0x9')]);router[_0x1a2c('0x7')]('/describe',auth[_0x1a2c('0x8')](),controller['describe']);router[_0x1a2c('0x7')](_0x1a2c('0xa'),auth['isAuthenticated'](),controller[_0x1a2c('0xb')]);router[_0x1a2c('0xc')]('/',auth[_0x1a2c('0x8')](),controller[_0x1a2c('0xd')]);router[_0x1a2c('0xe')]('/:id',auth[_0x1a2c('0x8')](),controller[_0x1a2c('0xf')]);router[_0x1a2c('0x10')]('/:id',auth[_0x1a2c('0x8')](),controller[_0x1a2c('0x11')]);module[_0x1a2c('0x12')]=router; \ No newline at end of file +var _0xd1c1=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd1c1,0x18a));var _0x1d1c=function(_0x4a4a43,_0x115ccf){_0x4a4a43=_0x4a4a43-0x0;var _0x5893a6=_0xd1c1[_0x4a4a43];return _0x5893a6;};'use strict';var multer=require(_0x1d1c('0x0'));var util=require(_0x1d1c('0x1'));var path=require(_0x1d1c('0x2'));var timeout=require(_0x1d1c('0x3'));var express=require(_0x1d1c('0x4'));var router=express[_0x1d1c('0x5')]();var fs_extra=require(_0x1d1c('0x6'));var auth=require(_0x1d1c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1d1c('0x8'));var controller=require(_0x1d1c('0x9'));router[_0x1d1c('0xa')]('/',auth[_0x1d1c('0xb')](),controller[_0x1d1c('0xc')]);router['get'](_0x1d1c('0xd'),auth['isAuthenticated'](),controller[_0x1d1c('0xe')]);router[_0x1d1c('0xa')](_0x1d1c('0xf'),auth[_0x1d1c('0xb')](),controller[_0x1d1c('0x10')]);router['post']('/',auth[_0x1d1c('0xb')](),controller['create']);router[_0x1d1c('0x11')]('/:id',auth[_0x1d1c('0xb')](),controller[_0x1d1c('0x12')]);router[_0x1d1c('0x13')](_0x1d1c('0xf'),auth[_0x1d1c('0xb')](),controller[_0x1d1c('0x14')]);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 ab1c7f1..ad1f687 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 _0x8d95=['STRING','sequelize','moment','exports','blind'];(function(_0x304767,_0x1290bf){var _0xc4c336=function(_0x55b702){while(--_0x55b702){_0x304767['push'](_0x304767['shift']());}};_0xc4c336(++_0x1290bf);}(_0x8d95,0x18c));var _0x58d9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8d95[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x58d9('0x0'));var moment=require(_0x58d9('0x1'));module[_0x58d9('0x2')]={'type':{'type':Sequelize['ENUM'](_0x58d9('0x3'),'attended')},'result':{'type':Sequelize[_0x58d9('0x4')]},'transfererchannel':{'type':Sequelize[_0x58d9('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x58d9('0x4')]},'transferercalleridname':{'type':Sequelize[_0x58d9('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x58d9('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x58d9('0x4')]},'transferercontext':{'type':Sequelize[_0x58d9('0x4')]},'transfererexten':{'type':Sequelize[_0x58d9('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x58d9('0x4')]},'transfereechannel':{'type':Sequelize[_0x58d9('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x58d9('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x58d9('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x58d9('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x58d9('0x4')]},'transfereecontext':{'type':Sequelize[_0x58d9('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x58d9('0x4')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x58d9('0x4')]}}; \ No newline at end of file +var _0x1a87=['moment','exports','ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x1a87,0x97));var _0x71a8=function(_0x1bea85,_0x31d23d){_0x1bea85=_0x1bea85-0x0;var _0x1049e5=_0x1a87[_0x1bea85];return _0x1049e5;};'use strict';var Sequelize=require(_0x71a8('0x0'));var moment=require(_0x71a8('0x1'));module[_0x71a8('0x2')]={'type':{'type':Sequelize[_0x71a8('0x3')](_0x71a8('0x4'),_0x71a8('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x71a8('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x71a8('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x71a8('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x71a8('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x71a8('0x6')]},'transferercontext':{'type':Sequelize[_0x71a8('0x6')]},'transfererexten':{'type':Sequelize[_0x71a8('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x71a8('0x6')]},'transfereechannel':{'type':Sequelize[_0x71a8('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x71a8('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x71a8('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x71a8('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x71a8('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x71a8('0x6')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x71a8('0x6')]},'isexternal':{'type':Sequelize['ENUM'](_0x71a8('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x71a8('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 69df1cd..81b25e4 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 _0xb22c=['order','sort','where','pick','filter','VIRTUAL','options','VoiceTransferReport','then','findAll','rows','show','params','includeAll','include','find','create','body','catch','update','describe','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','destroy','error','name','send','merge','contact','message','agent','interaction','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x23eb38,_0x1f49a6){var _0x39a875=function(_0x314e77){while(--_0x314e77){_0x23eb38['push'](_0x23eb38['shift']());}};_0x39a875(++_0x1f49a6);}(_0xb22c,0x66));var _0xcb22=function(_0x4dd004,_0x491342){_0x4dd004=_0x4dd004-0x0;var _0x27a88c=_0xb22c[_0x4dd004];return _0x27a88c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb22('0x0'));var zipdir=require(_0xcb22('0x1'));var jsonpatch=require(_0xcb22('0x2'));var rp=require(_0xcb22('0x3'));var moment=require(_0xcb22('0x4'));var BPromise=require(_0xcb22('0x5'));var Mustache=require(_0xcb22('0x6'));var util=require(_0xcb22('0x7'));var path=require(_0xcb22('0x8'));var sox=require('sox');var csv=require(_0xcb22('0x9'));var ejs=require(_0xcb22('0xa'));var fs=require('fs');var fs_extra=require(_0xcb22('0xb'));var _=require(_0xcb22('0xc'));var squel=require(_0xcb22('0xd'));var crypto=require('crypto');var jsforce=require(_0xcb22('0xe'));var deskjs=require(_0xcb22('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcb22('0x10'));var Papa=require('papaparse');var Redis=require(_0xcb22('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcb22('0x12'));var as=require(_0xcb22('0x13'));var hardwareService=require(_0xcb22('0x14'));var logger=require(_0xcb22('0x15'))(_0xcb22('0x16'));var utils=require(_0xcb22('0x17'));var config=require(_0xcb22('0x18'));var licenseUtil=require(_0xcb22('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x596005,_0x1442ed){_0x1442ed=_0x1442ed||0xcc;return function(_0x9ae8ac){if(_0x9ae8ac){return _0x596005[_0xcb22('0x1a')](_0x1442ed);}return _0x596005[_0xcb22('0x1b')](_0x1442ed)[_0xcb22('0x1c')]();};}function respondWithResult(_0x60ec3,_0x20ddc4){_0x20ddc4=_0x20ddc4||0xc8;return function(_0x23cb99){if(_0x23cb99){return _0x60ec3[_0xcb22('0x1b')](_0x20ddc4)['json'](_0x23cb99);}};}function respondWithFilteredResult(_0x43e44a,_0x960661){return function(_0x15d617){if(_0x15d617){var _0x28f9e5=typeof _0x960661[_0xcb22('0x1d')]===_0xcb22('0x1e')&&typeof _0x960661[_0xcb22('0x1f')]==='undefined';var _0x2a8b74=_0x15d617['count'];var _0x32e07d=_0x28f9e5?0x0:_0x960661[_0xcb22('0x1d')];var _0x1e7f97=_0x28f9e5?_0x15d617[_0xcb22('0x20')]:_0x960661[_0xcb22('0x1d')]+_0x960661[_0xcb22('0x1f')];var _0x22d795;if(_0x1e7f97>=_0x2a8b74){_0x1e7f97=_0x2a8b74;_0x22d795=0xc8;}else{_0x22d795=0xce;}_0x43e44a['status'](_0x22d795);return _0x43e44a[_0xcb22('0x21')](_0xcb22('0x22'),_0x32e07d+'-'+_0x1e7f97+'/'+_0x2a8b74)[_0xcb22('0x23')](_0x15d617);}return null;};}function patchUpdates(_0xc7bbb0){return function(_0x21e0b5){try{jsonpatch['apply'](_0x21e0b5,_0xc7bbb0,!![]);}catch(_0x2b1630){return BPromise[_0xcb22('0x24')](_0x2b1630);}return _0x21e0b5['save']();};}function saveUpdates(_0x6e2e9b,_0x378b09){return function(_0x4fe498){if(_0x4fe498){return _0x4fe498['update'](_0x6e2e9b)['then'](function(_0x4e749b){return _0x4e749b;});}return null;};}function removeEntity(_0x562686,_0x353c85){return function(_0x4f4a37){if(_0x4f4a37){return _0x4f4a37[_0xcb22('0x25')]()['then'](function(){_0x562686['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2256ec,_0x2ee3c0){return function(_0x578b0a){if(!_0x578b0a){_0x2256ec[_0xcb22('0x1a')](0x194);}return _0x578b0a;};}function handleError(_0x5a6b30,_0x16cfb3){_0x16cfb3=_0x16cfb3||0x1f4;return function(_0x30b28c){logger[_0xcb22('0x26')](_0x30b28c['stack']);if(_0x30b28c[_0xcb22('0x27')]){delete _0x30b28c['name'];}_0x5a6b30[_0xcb22('0x1b')](_0x16cfb3)[_0xcb22('0x28')](_0x30b28c);};}function getMustacheRender(_0x1703a3,_0x1da794){return Mustache['render'](_0x1703a3,_[_0xcb22('0x29')](_0x1da794['body'],{'contact':_0x1da794[_0xcb22('0x2a')],'message':_0x1da794[_0xcb22('0x2b')],'agent':_0x1da794[_0xcb22('0x2c')],'interaction':_0x1da794[_0xcb22('0x2d')],'account':_0x1da794['account']}))||'';}exports['index']=function(_0x38ebd8,_0x1ebaaf){var _0x2545b0={},_0x2b38a7={},_0x15dc3={'count':0x0,'rows':[]};var _0x407b9a=_[_0xcb22('0x2e')](db['VoiceTransferReport'][_0xcb22('0x2f')],function(_0x55d10f){return{'name':_0x55d10f[_0xcb22('0x30')],'type':_0x55d10f[_0xcb22('0x31')][_0xcb22('0x32')]};});_0x2b38a7[_0xcb22('0x33')]=_[_0xcb22('0x2e')](_0x407b9a,_0xcb22('0x27'));_0x2b38a7[_0xcb22('0x34')]=_[_0xcb22('0x35')](_0x38ebd8[_0xcb22('0x34')]);_0x2b38a7[_0xcb22('0x36')]=_[_0xcb22('0x37')](_0x2b38a7[_0xcb22('0x33')],_0x2b38a7[_0xcb22('0x34')]);_0x2545b0[_0xcb22('0x38')]=_[_0xcb22('0x37')](_0x2b38a7[_0xcb22('0x33')],qs['fields'](_0x38ebd8['query'][_0xcb22('0x39')]));_0x2545b0[_0xcb22('0x38')]=_0x2545b0[_0xcb22('0x38')][_0xcb22('0x3a')]?_0x2545b0['attributes']:_0x2b38a7[_0xcb22('0x33')];if(!_0x38ebd8[_0xcb22('0x34')]['hasOwnProperty'](_0xcb22('0x3b'))){_0x2545b0[_0xcb22('0x1f')]=qs[_0xcb22('0x1f')](_0x38ebd8[_0xcb22('0x34')][_0xcb22('0x1f')]);_0x2545b0['offset']=qs['offset'](_0x38ebd8['query']['offset']);}_0x2545b0[_0xcb22('0x3c')]=qs[_0xcb22('0x3d')](_0x38ebd8[_0xcb22('0x34')][_0xcb22('0x3d')]);_0x2545b0[_0xcb22('0x3e')]=qs[_0xcb22('0x36')](_[_0xcb22('0x3f')](_0x38ebd8[_0xcb22('0x34')],_0x2b38a7[_0xcb22('0x36')]),_0x407b9a);if(_0x38ebd8[_0xcb22('0x34')][_0xcb22('0x40')]){_0x2545b0[_0xcb22('0x3e')]=_[_0xcb22('0x29')](_0x2545b0['where'],{'$or':_[_0xcb22('0x2e')](_0x407b9a,function(_0x2fe6dd){if(_0x2fe6dd['type']!==_0xcb22('0x41')){var _0x20ddfb={};_0x20ddfb[_0x2fe6dd[_0xcb22('0x27')]]={'$like':'%'+_0x38ebd8[_0xcb22('0x34')][_0xcb22('0x40')]+'%'};return _0x20ddfb;}})});}_0x2545b0=_[_0xcb22('0x29')]({},_0x2545b0,_0x38ebd8[_0xcb22('0x42')]);var _0x40b488={'where':_0x2545b0[_0xcb22('0x3e')]};return db[_0xcb22('0x43')][_0xcb22('0x20')](_0x40b488)[_0xcb22('0x44')](function(_0xfef12f){_0x15dc3[_0xcb22('0x20')]=_0xfef12f;if(_0x38ebd8['query']['includeAll']){_0x2545b0['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0xcb22('0x45')](_0x2545b0);})[_0xcb22('0x44')](function(_0x55c061){_0x15dc3[_0xcb22('0x46')]=_0x55c061;return _0x15dc3;})['then'](respondWithFilteredResult(_0x1ebaaf,_0x2545b0))['catch'](handleError(_0x1ebaaf,null));};exports[_0xcb22('0x47')]=function(_0x514c1a,_0x5749d1){var _0x1df32e={'raw':!![],'where':{'id':_0x514c1a[_0xcb22('0x48')]['id']}},_0x488fcd={};_0x488fcd[_0xcb22('0x33')]=_[_0xcb22('0x35')](db[_0xcb22('0x43')][_0xcb22('0x2f')]);_0x488fcd['query']=_[_0xcb22('0x35')](_0x514c1a[_0xcb22('0x34')]);_0x488fcd['filters']=_[_0xcb22('0x37')](_0x488fcd[_0xcb22('0x33')],_0x488fcd[_0xcb22('0x34')]);_0x1df32e[_0xcb22('0x38')]=_[_0xcb22('0x37')](_0x488fcd[_0xcb22('0x33')],qs[_0xcb22('0x39')](_0x514c1a[_0xcb22('0x34')]['fields']));_0x1df32e[_0xcb22('0x38')]=_0x1df32e[_0xcb22('0x38')][_0xcb22('0x3a')]?_0x1df32e[_0xcb22('0x38')]:_0x488fcd[_0xcb22('0x33')];if(_0x514c1a[_0xcb22('0x34')][_0xcb22('0x49')]){_0x1df32e[_0xcb22('0x4a')]=[{'all':!![]}];}_0x1df32e=_['merge']({},_0x1df32e,_0x514c1a[_0xcb22('0x42')]);return db[_0xcb22('0x43')][_0xcb22('0x4b')](_0x1df32e)[_0xcb22('0x44')](handleEntityNotFound(_0x5749d1,null))[_0xcb22('0x44')](respondWithResult(_0x5749d1,null))['catch'](handleError(_0x5749d1,null));};exports[_0xcb22('0x4c')]=function(_0x14e679,_0x39a832){return db[_0xcb22('0x43')][_0xcb22('0x4c')](_0x14e679[_0xcb22('0x4d')],{})[_0xcb22('0x44')](respondWithResult(_0x39a832,0xc9))[_0xcb22('0x4e')](handleError(_0x39a832,null));};exports[_0xcb22('0x4f')]=function(_0x26b885,_0x11fba4){if(_0x26b885['body']['id']){delete _0x26b885[_0xcb22('0x4d')]['id'];}return db['VoiceTransferReport'][_0xcb22('0x4b')]({'where':{'id':_0x26b885[_0xcb22('0x48')]['id']}})[_0xcb22('0x44')](handleEntityNotFound(_0x11fba4,null))[_0xcb22('0x44')](saveUpdates(_0x26b885[_0xcb22('0x4d')],null))['then'](respondWithResult(_0x11fba4,null))[_0xcb22('0x4e')](handleError(_0x11fba4,null));};exports['destroy']=function(_0x50dd16,_0x1f35a6){return db[_0xcb22('0x43')][_0xcb22('0x4b')]({'where':{'id':_0x50dd16[_0xcb22('0x48')]['id']}})[_0xcb22('0x44')](handleEntityNotFound(_0x1f35a6,null))['then'](removeEntity(_0x1f35a6,null))[_0xcb22('0x4e')](handleError(_0x1f35a6,null));};exports[_0xcb22('0x50')]=function(_0x278db9,_0x352f00){return db['VoiceTransferReport']['describe']()[_0xcb22('0x44')](respondWithResult(_0x352f00,null))[_0xcb22('0x4e')](handleError(_0x352f00,null));}; \ No newline at end of file +var _0x6cb2=['body','contact','agent','interaction','account','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','pick','where','map','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','fields','find','describe','rimraf','fast-json-patch','moment','sox','ejs','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','render','merge'];(function(_0x48e02f,_0x85a9d7){var _0x3b986a=function(_0x5a3f0e){while(--_0x5a3f0e){_0x48e02f['push'](_0x48e02f['shift']());}};_0x3b986a(++_0x85a9d7);}(_0x6cb2,0x6a));var _0x26cb=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x6cb2[_0x5a776b];return _0xbbef59;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26cb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x26cb('0x1'));var rp=require('request-promise');var moment=require(_0x26cb('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x26cb('0x3'));var csv=require('to-csv');var ejs=require(_0x26cb('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x26cb('0x5'));var crypto=require(_0x26cb('0x6'));var jsforce=require(_0x26cb('0x7'));var deskjs=require('desk.js');var toCsv=require(_0x26cb('0x8'));var querystring=require(_0x26cb('0x9'));var Papa=require('papaparse');var Redis=require(_0x26cb('0xa'));var authService=require(_0x26cb('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x26cb('0xc'));var hardwareService=require(_0x26cb('0xd'));var logger=require(_0x26cb('0xe'))('api');var utils=require(_0x26cb('0xf'));var config=require(_0x26cb('0x10'));var licenseUtil=require(_0x26cb('0x11'));var db=require(_0x26cb('0x12'))['db'];function respondWithStatusCode(_0x3915f3,_0xdf28b7){_0xdf28b7=_0xdf28b7||0xcc;return function(_0x31bb54){if(_0x31bb54){return _0x3915f3[_0x26cb('0x13')](_0xdf28b7);}return _0x3915f3[_0x26cb('0x14')](_0xdf28b7)['end']();};}function respondWithResult(_0x34b453,_0x1e4e7c){_0x1e4e7c=_0x1e4e7c||0xc8;return function(_0x18b8ba){if(_0x18b8ba){return _0x34b453['status'](_0x1e4e7c)['json'](_0x18b8ba);}};}function respondWithFilteredResult(_0xc52e39,_0x53c01e){return function(_0x2a0bca){if(_0x2a0bca){var _0xfc8cc=typeof _0x53c01e[_0x26cb('0x15')]==='undefined'&&typeof _0x53c01e[_0x26cb('0x16')]===_0x26cb('0x17');var _0x283094=_0x2a0bca[_0x26cb('0x18')];var _0x261ebd=_0xfc8cc?0x0:_0x53c01e['offset'];var _0x2bd095=_0xfc8cc?_0x2a0bca[_0x26cb('0x18')]:_0x53c01e[_0x26cb('0x15')]+_0x53c01e['limit'];var _0x40e2c9;if(_0x2bd095>=_0x283094){_0x2bd095=_0x283094;_0x40e2c9=0xc8;}else{_0x40e2c9=0xce;}_0xc52e39[_0x26cb('0x14')](_0x40e2c9);return _0xc52e39[_0x26cb('0x19')](_0x26cb('0x1a'),_0x261ebd+'-'+_0x2bd095+'/'+_0x283094)['json'](_0x2a0bca);}return null;};}function patchUpdates(_0x1d824a){return function(_0x1dcd67){try{jsonpatch[_0x26cb('0x1b')](_0x1dcd67,_0x1d824a,!![]);}catch(_0x5407f1){return BPromise['reject'](_0x5407f1);}return _0x1dcd67[_0x26cb('0x1c')]();};}function saveUpdates(_0x591fe4,_0x40b60f){return function(_0x3c02bc){if(_0x3c02bc){return _0x3c02bc[_0x26cb('0x1d')](_0x591fe4)[_0x26cb('0x1e')](function(_0x41cea8){return _0x41cea8;});}return null;};}function removeEntity(_0x5cf30e,_0x3c983b){return function(_0x2b8e7c){if(_0x2b8e7c){return _0x2b8e7c[_0x26cb('0x1f')]()[_0x26cb('0x1e')](function(){_0x5cf30e['status'](0xcc)[_0x26cb('0x20')]();});}};}function handleEntityNotFound(_0x292c67,_0x21cf11){return function(_0x29498a){if(!_0x29498a){_0x292c67[_0x26cb('0x13')](0x194);}return _0x29498a;};}function handleError(_0xca2823,_0x1e0f1b){_0x1e0f1b=_0x1e0f1b||0x1f4;return function(_0x40d00b){logger[_0x26cb('0x21')](_0x40d00b[_0x26cb('0x22')]);if(_0x40d00b[_0x26cb('0x23')]){delete _0x40d00b[_0x26cb('0x23')];}_0xca2823[_0x26cb('0x14')](_0x1e0f1b)['send'](_0x40d00b);};}function getMustacheRender(_0xcd2b19,_0x313776){return Mustache[_0x26cb('0x24')](_0xcd2b19,_[_0x26cb('0x25')](_0x313776[_0x26cb('0x26')],{'contact':_0x313776[_0x26cb('0x27')],'message':_0x313776['message'],'agent':_0x313776[_0x26cb('0x28')],'interaction':_0x313776[_0x26cb('0x29')],'account':_0x313776[_0x26cb('0x2a')]}))||'';}exports['index']=function(_0x42d141,_0x1b5b18){var _0x27d8bf={},_0x5f3de6={},_0x3c604b={'count':0x0,'rows':[]};var _0x1db0eb=_['map'](db[_0x26cb('0x2b')][_0x26cb('0x2c')],function(_0xe8a0cb){return{'name':_0xe8a0cb[_0x26cb('0x2d')],'type':_0xe8a0cb[_0x26cb('0x2e')][_0x26cb('0x2f')]};});_0x5f3de6[_0x26cb('0x30')]=_['map'](_0x1db0eb,_0x26cb('0x23'));_0x5f3de6[_0x26cb('0x31')]=_['keys'](_0x42d141[_0x26cb('0x31')]);_0x5f3de6[_0x26cb('0x32')]=_[_0x26cb('0x33')](_0x5f3de6[_0x26cb('0x30')],_0x5f3de6[_0x26cb('0x31')]);_0x27d8bf[_0x26cb('0x34')]=_[_0x26cb('0x33')](_0x5f3de6['model'],qs['fields'](_0x42d141[_0x26cb('0x31')]['fields']));_0x27d8bf[_0x26cb('0x34')]=_0x27d8bf[_0x26cb('0x34')][_0x26cb('0x35')]?_0x27d8bf[_0x26cb('0x34')]:_0x5f3de6[_0x26cb('0x30')];if(!_0x42d141[_0x26cb('0x31')]['hasOwnProperty'](_0x26cb('0x36'))){_0x27d8bf[_0x26cb('0x16')]=qs['limit'](_0x42d141[_0x26cb('0x31')][_0x26cb('0x16')]);_0x27d8bf[_0x26cb('0x15')]=qs['offset'](_0x42d141['query'][_0x26cb('0x15')]);}_0x27d8bf[_0x26cb('0x37')]=qs[_0x26cb('0x38')](_0x42d141[_0x26cb('0x31')][_0x26cb('0x38')]);_0x27d8bf['where']=qs[_0x26cb('0x32')](_[_0x26cb('0x39')](_0x42d141[_0x26cb('0x31')],_0x5f3de6['filters']),_0x1db0eb);if(_0x42d141[_0x26cb('0x31')]['filter']){_0x27d8bf[_0x26cb('0x3a')]=_['merge'](_0x27d8bf[_0x26cb('0x3a')],{'$or':_[_0x26cb('0x3b')](_0x1db0eb,function(_0x4a868c){if(_0x4a868c[_0x26cb('0x2e')]!==_0x26cb('0x3c')){var _0x46c4f9={};_0x46c4f9[_0x4a868c[_0x26cb('0x23')]]={'$like':'%'+_0x42d141[_0x26cb('0x31')]['filter']+'%'};return _0x46c4f9;}})});}_0x27d8bf=_[_0x26cb('0x25')]({},_0x27d8bf,_0x42d141[_0x26cb('0x3d')]);var _0x34aa10={'where':_0x27d8bf['where']};return db[_0x26cb('0x2b')]['count'](_0x34aa10)[_0x26cb('0x1e')](function(_0x15b818){_0x3c604b[_0x26cb('0x18')]=_0x15b818;if(_0x42d141[_0x26cb('0x31')][_0x26cb('0x3e')]){_0x27d8bf[_0x26cb('0x3f')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x27d8bf);})['then'](function(_0x180ce2){_0x3c604b[_0x26cb('0x40')]=_0x180ce2;return _0x3c604b;})[_0x26cb('0x1e')](respondWithFilteredResult(_0x1b5b18,_0x27d8bf))[_0x26cb('0x41')](handleError(_0x1b5b18,null));};exports[_0x26cb('0x42')]=function(_0x21e269,_0x15598c){var _0x2a3982={'raw':!![],'where':{'id':_0x21e269[_0x26cb('0x43')]['id']}},_0x51b1f1={};_0x51b1f1[_0x26cb('0x30')]=_[_0x26cb('0x44')](db[_0x26cb('0x2b')][_0x26cb('0x2c')]);_0x51b1f1[_0x26cb('0x31')]=_[_0x26cb('0x44')](_0x21e269[_0x26cb('0x31')]);_0x51b1f1['filters']=_[_0x26cb('0x33')](_0x51b1f1[_0x26cb('0x30')],_0x51b1f1[_0x26cb('0x31')]);_0x2a3982[_0x26cb('0x34')]=_[_0x26cb('0x33')](_0x51b1f1[_0x26cb('0x30')],qs[_0x26cb('0x45')](_0x21e269[_0x26cb('0x31')]['fields']));_0x2a3982[_0x26cb('0x34')]=_0x2a3982[_0x26cb('0x34')][_0x26cb('0x35')]?_0x2a3982[_0x26cb('0x34')]:_0x51b1f1['model'];if(_0x21e269['query'][_0x26cb('0x3e')]){_0x2a3982[_0x26cb('0x3f')]=[{'all':!![]}];}_0x2a3982=_[_0x26cb('0x25')]({},_0x2a3982,_0x21e269[_0x26cb('0x3d')]);return db[_0x26cb('0x2b')]['find'](_0x2a3982)['then'](handleEntityNotFound(_0x15598c,null))[_0x26cb('0x1e')](respondWithResult(_0x15598c,null))[_0x26cb('0x41')](handleError(_0x15598c,null));};exports['create']=function(_0x43fca6,_0x290187){return db[_0x26cb('0x2b')]['create'](_0x43fca6['body'],{})[_0x26cb('0x1e')](respondWithResult(_0x290187,0xc9))[_0x26cb('0x41')](handleError(_0x290187,null));};exports[_0x26cb('0x1d')]=function(_0x37d23c,_0x5006f2){if(_0x37d23c[_0x26cb('0x26')]['id']){delete _0x37d23c[_0x26cb('0x26')]['id'];}return db[_0x26cb('0x2b')][_0x26cb('0x46')]({'where':{'id':_0x37d23c[_0x26cb('0x43')]['id']}})[_0x26cb('0x1e')](handleEntityNotFound(_0x5006f2,null))[_0x26cb('0x1e')](saveUpdates(_0x37d23c[_0x26cb('0x26')],null))['then'](respondWithResult(_0x5006f2,null))[_0x26cb('0x41')](handleError(_0x5006f2,null));};exports[_0x26cb('0x1f')]=function(_0x45c82e,_0x2af932){return db[_0x26cb('0x2b')]['find']({'where':{'id':_0x45c82e[_0x26cb('0x43')]['id']}})[_0x26cb('0x1e')](handleEntityNotFound(_0x2af932,null))[_0x26cb('0x1e')](removeEntity(_0x2af932,null))[_0x26cb('0x41')](handleError(_0x2af932,null));};exports[_0x26cb('0x47')]=function(_0x563a4c,_0x47cad0){return db[_0x26cb('0x2b')]['describe']()[_0x26cb('0x1e')](respondWithResult(_0x47cad0,null))[_0x26cb('0x41')](handleError(_0x47cad0,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 7d8ffdd..a2f96db 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 _0xe0bf=['path','../../config/environment','./voiceTransferReport.attributes','VoiceTransferReport','lodash','util','api','request-promise'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xe0bf,0x164));var _0xfe0b=function(_0x3fbfef,_0x13a392){_0x3fbfef=_0x3fbfef-0x0;var _0x1d9ef9=_0xe0bf[_0x3fbfef];return _0x1d9ef9;};'use strict';var _=require(_0xfe0b('0x0'));var util=require(_0xfe0b('0x1'));var logger=require('../../config/logger')(_0xfe0b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfe0b('0x3'));var fs=require('fs');var path=require(_0xfe0b('0x4'));var rimraf=require('rimraf');var config=require(_0xfe0b('0x5'));var attributes=require(_0xfe0b('0x6'));module['exports']=function(_0x5636aa,_0x395892){return _0x5636aa['define'](_0xfe0b('0x7'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5332=['api','moment','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5332,0x12a));var _0x2533=function(_0x2a4414,_0xa705c4){_0x2a4414=_0x2a4414-0x0;var _0x461948=_0x5332[_0x2a4414];return _0x461948;};'use strict';var _=require(_0x2533('0x0'));var util=require('util');var logger=require(_0x2533('0x1'))(_0x2533('0x2'));var moment=require(_0x2533('0x3'));var BPromise=require('bluebird');var rp=require(_0x2533('0x4'));var fs=require('fs');var path=require(_0x2533('0x5'));var rimraf=require(_0x2533('0x6'));var config=require('../../config/environment');var attributes=require(_0x2533('0x7'));module[_0x2533('0x8')]=function(_0x4bc6dc,_0x5ec155){return _0x4bc6dc[_0x2533('0x9')](_0x2533('0xa'),attributes,{'tableName':_0x2533('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 89b2966..fe557c5 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 _0x37b4=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','request\x20sent','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','raw','then','debug','lodash','moment','bluebird'];(function(_0x1985d3,_0x5e6a4f){var _0x1523d4=function(_0x334d90){while(--_0x334d90){_0x1985d3['push'](_0x1985d3['shift']());}};_0x1523d4(++_0x5e6a4f);}(_0x37b4,0xef));var _0x437b=function(_0x48e6f1,_0x1bd3e8){_0x48e6f1=_0x48e6f1-0x0;var _0x154ae1=_0x37b4[_0x48e6f1];return _0x154ae1;};'use strict';var _=require(_0x437b('0x0'));var util=require('util');var moment=require(_0x437b('0x1'));var BPromise=require(_0x437b('0x2'));var rs=require(_0x437b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x437b('0x4'))['db'];var utils=require(_0x437b('0x5'));var logger=require(_0x437b('0x6'))(_0x437b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x437b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c7dea,_0x4aada7,_0x226e3c){return new BPromise(function(_0x5df980,_0x432b63){return client['request'](_0x3c7dea,_0x226e3c)['then'](function(_0x44bf1d){logger[_0x437b('0x9')]('VoiceTransferReport,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'),JSON[_0x437b('0xb')](_0x44bf1d));if(_0x44bf1d[_0x437b('0xc')]){if(_0x44bf1d[_0x437b('0xc')]['code']===0x1f4){logger[_0x437b('0xc')](_0x437b('0xd'),_0x4aada7,_0x44bf1d[_0x437b('0xc')]['message']);return _0x432b63(_0x44bf1d[_0x437b('0xc')][_0x437b('0xe')]);}logger[_0x437b('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x4aada7,_0x44bf1d[_0x437b('0xc')]['message']);return _0x5df980(_0x44bf1d[_0x437b('0xc')][_0x437b('0xe')]);}else{logger[_0x437b('0x9')]('VoiceTransferReport,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'));_0x5df980(_0x44bf1d[_0x437b('0xf')][_0x437b('0xe')]);}})[_0x437b('0x10')](function(_0x1d31af){logger[_0x437b('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x4aada7,_0x1d31af);_0x432b63(_0x1d31af);});});}exports[_0x437b('0x11')]=function(_0x501d8c){var _0x2b3994=this;return new Promise(function(_0x107024,_0x1c91bc){return db[_0x437b('0x12')]['create'](_0x501d8c['body'],{'raw':_0x501d8c['options']?_0x501d8c['options'][_0x437b('0x13')]===undefined?!![]:![]:!![]})[_0x437b('0x14')](function(_0x4a5eac){logger[_0x437b('0x9')]('CreateVoiceTransferReport',_0x501d8c);logger[_0x437b('0x15')](_0x437b('0x11'),_0x501d8c,JSON[_0x437b('0xb')](_0x4a5eac));_0x107024(_0x4a5eac);})['catch'](function(_0x5127ff){logger['error'](_0x437b('0x11'),_0x5127ff[_0x437b('0xe')],_0x501d8c);_0x1c91bc(_0x2b3994[_0x437b('0xc')](0x1f4,_0x5127ff[_0x437b('0xe')]));});});}; \ No newline at end of file +var _0x58e9=['VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceTransferReport','create','body','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x58e9,0x15e));var _0x958e=function(_0x218623,_0x1afd98){_0x218623=_0x218623-0x0;var _0x39560f=_0x58e9[_0x218623];return _0x39560f;};'use strict';var _=require(_0x958e('0x0'));var util=require(_0x958e('0x1'));var moment=require('moment');var BPromise=require(_0x958e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x958e('0x3'));var db=require(_0x958e('0x4'))['db'];var utils=require(_0x958e('0x5'));var logger=require(_0x958e('0x6'))(_0x958e('0x7'));var config=require('../../config/environment');var jayson=require(_0x958e('0x8'));var client=jayson[_0x958e('0x9')][_0x958e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d4534,_0x404407,_0x1d3cf5){return new BPromise(function(_0x80e1a7,_0x7b1e23){return client[_0x958e('0xb')](_0x5d4534,_0x1d3cf5)[_0x958e('0xc')](function(_0x42ce26){logger[_0x958e('0xd')](_0x958e('0xe'),_0x404407,_0x958e('0xf'));logger[_0x958e('0x10')](_0x958e('0x11'),_0x404407,_0x958e('0xf'),JSON[_0x958e('0x12')](_0x42ce26));if(_0x42ce26[_0x958e('0x13')]){if(_0x42ce26['error']['code']===0x1f4){logger[_0x958e('0x13')](_0x958e('0xe'),_0x404407,_0x42ce26[_0x958e('0x13')][_0x958e('0x14')]);return _0x7b1e23(_0x42ce26[_0x958e('0x13')][_0x958e('0x14')]);}logger[_0x958e('0x13')](_0x958e('0xe'),_0x404407,_0x42ce26['error'][_0x958e('0x14')]);return _0x80e1a7(_0x42ce26[_0x958e('0x13')][_0x958e('0x14')]);}else{logger[_0x958e('0xd')](_0x958e('0xe'),_0x404407,_0x958e('0xf'));_0x80e1a7(_0x42ce26[_0x958e('0x15')]['message']);}})[_0x958e('0x16')](function(_0x403632){logger[_0x958e('0x13')](_0x958e('0xe'),_0x404407,_0x403632);_0x7b1e23(_0x403632);});});}exports[_0x958e('0x17')]=function(_0x3631a8){var _0x7ae00e=this;return new Promise(function(_0x5bf86c,_0x4aa710){return db['VoiceTransferReport'][_0x958e('0x18')](_0x3631a8[_0x958e('0x19')],{'raw':_0x3631a8[_0x958e('0x1a')]?_0x3631a8[_0x958e('0x1a')][_0x958e('0x1b')]===undefined?!![]:![]:!![]})[_0x958e('0xc')](function(_0x4fa943){logger[_0x958e('0xd')](_0x958e('0x17'),_0x3631a8);logger[_0x958e('0x10')](_0x958e('0x17'),_0x3631a8,JSON[_0x958e('0x12')](_0x4fa943));_0x5bf86c(_0x4fa943);})[_0x958e('0x16')](function(_0x5c45e4){logger['error'](_0x958e('0x17'),_0x5c45e4[_0x958e('0x14')],_0x3631a8);_0x4aa710(_0x7ae00e[_0x958e('0x13')](0x1f4,_0x5c45e4[_0x958e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 8282eb0..637689d 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 _0x54f3=['Router','../../components/auth/service','./webbar.controller','post','/originate','originate','/hangup','hangup','/answer','isAuthenticated','canUpdate','answer','/hold','hold','/calls','calls','/transfer','transfer'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0x54f3,0x120));var _0x354f=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x54f3[_0x199572];return _0x13cfa3;};'use strict';var express=require('express');var router=express[_0x354f('0x0')]();var auth=require(_0x354f('0x1'));var controller=require(_0x354f('0x2'));router[_0x354f('0x3')](_0x354f('0x4'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x354f('0x5')]);router[_0x354f('0x3')](_0x354f('0x6'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x354f('0x7')]);router['post'](_0x354f('0x8'),auth[_0x354f('0x9')](),auth[_0x354f('0xa')](),controller[_0x354f('0xb')]);router['post'](_0x354f('0xc'),auth['isAuthenticated'](),auth[_0x354f('0xa')](),controller[_0x354f('0xd')]);router['post']('/unhold',auth[_0x354f('0x9')](),auth[_0x354f('0xa')](),controller['unhold']);router[_0x354f('0x3')](_0x354f('0xe'),auth['isAuthenticated'](),auth[_0x354f('0xa')](),controller[_0x354f('0xf')]);router[_0x354f('0x3')](_0x354f('0x10'),auth[_0x354f('0x9')](),auth[_0x354f('0xa')](),controller[_0x354f('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1da1=['unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','canUpdate','originate','isAuthenticated','hangup','/hold','hold','/unhold'];(function(_0x54d49e,_0x5d9911){var _0x4af0f1=function(_0xf117b3){while(--_0xf117b3){_0x54d49e['push'](_0x54d49e['shift']());}};_0x4af0f1(++_0x5d9911);}(_0x1da1,0x1a4));var _0x11da=function(_0x40dc95,_0x227d30){_0x40dc95=_0x40dc95-0x0;var _0x5355db=_0x1da1[_0x40dc95];return _0x5355db;};'use strict';var express=require(_0x11da('0x0'));var router=express[_0x11da('0x1')]();var auth=require(_0x11da('0x2'));var controller=require(_0x11da('0x3'));router[_0x11da('0x4')]('/originate',auth['isAuthenticated'](),auth[_0x11da('0x5')](),controller[_0x11da('0x6')]);router[_0x11da('0x4')]('/hangup',auth[_0x11da('0x7')](),auth[_0x11da('0x5')](),controller[_0x11da('0x8')]);router['post']('/answer',auth[_0x11da('0x7')](),auth[_0x11da('0x5')](),controller['answer']);router[_0x11da('0x4')](_0x11da('0x9'),auth['isAuthenticated'](),auth[_0x11da('0x5')](),controller[_0x11da('0xa')]);router[_0x11da('0x4')](_0x11da('0xb'),auth[_0x11da('0x7')](),auth[_0x11da('0x5')](),controller[_0x11da('0xc')]);router[_0x11da('0x4')](_0x11da('0xd'),auth['isAuthenticated'](),auth[_0x11da('0x5')](),controller[_0x11da('0xe')]);router[_0x11da('0x4')](_0x11da('0xf'),auth[_0x11da('0x7')](),auth['canUpdate'](),controller[_0x11da('0x10')]);module[_0x11da('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 4f89838..9c13998 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 _0xe062=['path','lodash','../../config/environment','util','bluebird','http','../../config/logger','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','error','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callerId','format','webbar:originate','hangup\x20fired:','entityFound:','user:%s','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','unhold','webbar:unhold','calls\x20fired:','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0xe062,0xd5));var _0x2e06=function(_0xc2b4e4,_0x3fda8b){_0xc2b4e4=_0xc2b4e4-0x0;var _0x1be06e=_0xe062[_0xc2b4e4];return _0x1be06e;};'use strict';var path=require(_0x2e06('0x0'));var fs=require('fs');var _=require(_0x2e06('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x2e06('0x2'));var util=require(_0x2e06('0x3'));var BPromise=require(_0x2e06('0x4'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x2e06('0x5')]({'port':0x232a});var logger=require(_0x2e06('0x6'))('webbarapi');var Redis=require('ioredis');config[_0x2e06('0x7')]=_[_0x2e06('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2e06('0x9'))(new Redis(config[_0x2e06('0x7')]));var Schema=require(_0x2e06('0xa'));var originateValidation=new Schema({'userId':{'type':_0x2e06('0xb'),'required':[!![],_0x2e06('0xc')]},'callNumber':{'type':_0x2e06('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x2e06('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x2e06('0xb'),'required':[!![],_0x2e06('0xc')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x2e06('0xb'),'required':[!![],_0x2e06('0xc')]},'sessionId':{'type':_0x2e06('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x2e06('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x2e06('0xd'),'required':[!![],_0x2e06('0xe')]},'transferNumber':{'type':'string','required':[!![],_0x2e06('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x2e06('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x2e06('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x2e06('0xb'),'required':[!![],_0x2e06('0xc')]},'sessionId':{'type':_0x2e06('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x2e06('0xb'),'required':[!![],_0x2e06('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x2e06('0xc')]}});function emit(_0x330e5e,_0x210e11,_0x2ba1ed){logger[_0x2e06('0x10')](_0x330e5e,_0x210e11,JSON[_0x2e06('0x11')](_0x2ba1ed));io['to'](_0x330e5e)[_0x2e06('0x12')](_0x210e11,_0x2ba1ed);}function handleError(_0xb67ba8){return function(_0x1418e4){console['log'](_0x2e06('0x13'),_0x1418e4,_0x1418e4 instanceof RangeError);logger[_0x2e06('0x14')](_0x1418e4['stack']);if(_0x1418e4 instanceof RangeError){if(_0x1418e4[_0x2e06('0x15')]){delete _0x1418e4[_0x2e06('0x15')];}_0xb67ba8[_0x2e06('0x16')](0x194)[_0x2e06('0x17')](_0x1418e4);}else{if(_0x1418e4[_0x2e06('0x15')]){delete _0x1418e4[_0x2e06('0x15')];}_0xb67ba8[_0x2e06('0x16')](0x1f4)[_0x2e06('0x17')](_0x1418e4);}};}function checkError(){return function(_0xf95487){if(!_0xf95487){throw new RangeError(_0x2e06('0x18'));}return _0xf95487;};}function respondWithRpcPromise(_0x358cf6,_0x3a603d){return new BPromise(function(_0x4609fc,_0x2a31d7){var _0x27d028=amiClient;return _0x27d028[_0x2e06('0x19')](_0x358cf6,_0x3a603d)[_0x2e06('0x1a')](function(_0x22c571){if(_0x22c571['error']){if(_0x22c571[_0x2e06('0x14')][_0x2e06('0x1b')]===0x1f4){return _0x2a31d7(_0x22c571[_0x2e06('0x14')][_0x2e06('0x1c')]);}return _0x4609fc(_0x22c571[_0x2e06('0x14')][_0x2e06('0x1c')]);}else{_0x4609fc(_0x22c571[_0x2e06('0x1d')]);}})[_0x2e06('0x1e')](function(_0x202338){_0x2a31d7(_0x202338);});});}function getAgent(_0x4a0dbc){return db[_0x2e06('0x1f')][_0x2e06('0x20')]({'where':{'id':_0x4a0dbc,'role':_0x2e06('0x21')}})[_0x2e06('0x1a')](checkError());}function getAgentCheckSession(_0xd54278,_0x5ca0e2){return new BPromise(function(_0x455bf3,_0x519214){var _0x1ed86f=respondWithRpcPromise(_0x2e06('0x22'));var _0x577278=getAgent(_0xd54278);Promise[_0x2e06('0x23')]([_0x1ed86f,_0x577278])[_0x2e06('0x1a')](function(_0x3ff289){var _0x5116f1=_0x3ff289[0x0];var _0x5a48f6=_0x3ff289[0x1];var _0x2cb75f=_[_0x2e06('0x24')](_0x5116f1[_0x2e06('0x25')],function(_0x305316){return _0x305316[_0x2e06('0x26')]==_0x5a48f6['id']&&_0x305316[_0x2e06('0x27')]==_0x5ca0e2;});if(_0x2cb75f[_0x2e06('0x28')]==0x1){_0x455bf3(_0x5a48f6);}else{_0x519214(new RangeError(_0x2e06('0x29')+_0x5ca0e2+_0x2e06('0x2a')));}});});}exports['originate']=function(_0x5c931a,_0x4dfc10){logger['info'](_0x2e06('0x2b'),_0x5c931a[_0x2e06('0x2c')]);var _0x5bbce4=originateValidation[_0x2e06('0xa')](_0x5c931a[_0x2e06('0x2c')]);if(_0x5bbce4[_0x2e06('0x28')]>0x0){return _0x4dfc10['status'](0x190)[_0x2e06('0x2d')](_0x5bbce4);}var _0x25cfb2=_0x5c931a['body'][_0x2e06('0x2e')];var _0x13acb4=_0x5c931a[_0x2e06('0x2c')][_0x2e06('0x2f')];var _0x483e7f=_0x5c931a[_0x2e06('0x2c')][_0x2e06('0x30')];var _0x2fd67c=_0x5c931a[_0x2e06('0x2c')]['callbackUrl'];return getAgent(_0x25cfb2)[_0x2e06('0x1a')](function(_0x4748ae){logger['info']('entityFound:',_0x4748ae['name']);emit(util[_0x2e06('0x31')]('user:%s',_0x4748ae['name']),_0x2e06('0x32'),{'callNumber':_0x13acb4,'callerId':_0x483e7f,'callbackUrl':_0x2fd67c});return _0x4dfc10[_0x2e06('0x16')](0xc8)[_0x2e06('0x2d')]({'error':![],'message':'originate\x20executed!'});})[_0x2e06('0x1e')](handleError(_0x4dfc10));};exports['hangup']=function(_0x6d6c9f,_0x4c4174){logger[_0x2e06('0x10')](_0x2e06('0x33'),_0x6d6c9f['body']);var _0x4efb58=hangupValidation[_0x2e06('0xa')](_0x6d6c9f[_0x2e06('0x2c')]);if(_0x4efb58[_0x2e06('0x28')]>0x0){return _0x4c4174[_0x2e06('0x16')](0x190)['json'](_0x4efb58);}var _0x453bc=_0x6d6c9f['body']['userId'];var _0x3d7914=_0x6d6c9f['body']['sessionId'];return getAgent(_0x453bc)[_0x2e06('0x1a')](function(_0x2164af){logger[_0x2e06('0x10')](_0x2e06('0x34'),_0x2164af[_0x2e06('0x15')]);emit(util[_0x2e06('0x31')](_0x2e06('0x35'),_0x2164af[_0x2e06('0x15')]),_0x2e06('0x36'),{'sessionId':_0x3d7914});return _0x4c4174[_0x2e06('0x16')](0xc8)['json']({'error':![],'message':_0x2e06('0x37')});})[_0x2e06('0x1e')](handleError(_0x4c4174));};exports[_0x2e06('0x38')]=function(_0x9cbd30,_0x9dea45){logger['info'](_0x2e06('0x39'),_0x9cbd30[_0x2e06('0x2c')]);var _0x4a4c20=answerValidation['validate'](_0x9cbd30[_0x2e06('0x2c')]);if(_0x4a4c20[_0x2e06('0x28')]>0x0){return _0x9dea45[_0x2e06('0x16')](0x190)[_0x2e06('0x2d')](_0x4a4c20);}var _0x5bdbce=_0x9cbd30[_0x2e06('0x2c')]['userId'];var _0x2709f8=_0x9cbd30['body'][_0x2e06('0x27')];return getAgent(_0x5bdbce)[_0x2e06('0x1a')](function(_0x2a9295){logger['info'](_0x2e06('0x34'),_0x2a9295[_0x2e06('0x15')]);emit(util['format'](_0x2e06('0x35'),_0x2a9295[_0x2e06('0x15')]),_0x2e06('0x3a'),{'sessionId':_0x2709f8});return _0x9dea45[_0x2e06('0x16')](0xc8)[_0x2e06('0x2d')]({'error':![],'message':'answer\x20executed!'});})[_0x2e06('0x1e')](handleError(_0x9dea45));};exports[_0x2e06('0x3b')]=function(_0x1c85ea,_0x58aa05){logger[_0x2e06('0x10')]('hold\x20fired:',_0x1c85ea[_0x2e06('0x2c')]);var _0x578310=holdValidation[_0x2e06('0xa')](_0x1c85ea['body']);if(_0x578310[_0x2e06('0x28')]>0x0){return _0x58aa05[_0x2e06('0x16')](0x190)['json'](_0x578310);}var _0x111509=_0x1c85ea[_0x2e06('0x2c')][_0x2e06('0x2e')];var _0x3652ae=_0x1c85ea[_0x2e06('0x2c')]['sessionId'];return getAgent(_0x111509)[_0x2e06('0x1a')](function(_0x508fff){logger[_0x2e06('0x10')]('entityFound:',_0x508fff[_0x2e06('0x15')]);emit(util[_0x2e06('0x31')](_0x2e06('0x35'),_0x508fff[_0x2e06('0x15')]),'webbar:hold',{'sessionId':_0x3652ae});return _0x58aa05[_0x2e06('0x16')](0xc8)[_0x2e06('0x2d')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x58aa05));};exports[_0x2e06('0x3c')]=function(_0x53628b,_0x132a78){logger[_0x2e06('0x10')]('unhold\x20fired:',_0x53628b[_0x2e06('0x2c')]);var _0x30d892=unholdValidation[_0x2e06('0xa')](_0x53628b[_0x2e06('0x2c')]);if(_0x30d892[_0x2e06('0x28')]>0x0){return _0x132a78['status'](0x190)['json'](_0x30d892);}var _0x222452=_0x53628b[_0x2e06('0x2c')][_0x2e06('0x2e')];var _0x2c55e5=_0x53628b['body'][_0x2e06('0x27')];return getAgent(_0x222452)[_0x2e06('0x1a')](function(_0x53125f){logger[_0x2e06('0x10')](_0x2e06('0x34'),_0x53125f['name']);emit(util['format'](_0x2e06('0x35'),_0x53125f[_0x2e06('0x15')]),_0x2e06('0x3d'),{'sessionId':_0x2c55e5});return _0x132a78[_0x2e06('0x16')](0xc8)[_0x2e06('0x2d')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x132a78));};exports['calls']=function(_0xd8132e,_0x25242a){logger[_0x2e06('0x10')](_0x2e06('0x3e'),_0x25242a['body']);var _0x4abc51=callsValidation['validate'](_0xd8132e[_0x2e06('0x2c')]);if(_0x4abc51[_0x2e06('0x28')]>0x0){return _0x25242a['status'](0x190)[_0x2e06('0x2d')](_0x4abc51);}var _0x556230=_0xd8132e[_0x2e06('0x2c')][_0x2e06('0x2e')];var _0x446c93=respondWithRpcPromise(_0x2e06('0x22'));var _0x1b77f5=getAgent(_0x556230);return Promise[_0x2e06('0x23')]([_0x446c93,_0x1b77f5])[_0x2e06('0x1a')](function(_0xd50dd0){var _0x4f4b3a=_0xd50dd0[0x0];var _0x1dcc9b=_0xd50dd0[0x1];var _0x32b7ec=_['filter'](_0x4f4b3a[_0x2e06('0x25')],function(_0x52448a){return _0x52448a[_0x2e06('0x26')]==_0x1dcc9b['id'];});return _0x25242a[_0x2e06('0x16')](0xc8)[_0x2e06('0x2d')]({'count':_0x32b7ec[_0x2e06('0x28')],'rows':_0x32b7ec});})[_0x2e06('0x1e')](handleError(_0x25242a));};exports['conference']=function(_0x5c6f71,_0x2568e7){logger['info'](_0x2e06('0x3f'),_0x5c6f71[_0x2e06('0x2c')]);var _0x18adb5=conferenceValidation['validate'](_0x5c6f71['body']);if(_0x18adb5['length']>0x0){return _0x2568e7['status'](0x190)[_0x2e06('0x2d')](_0x18adb5);}var _0x19a4d1=_0x5c6f71[_0x2e06('0x2c')]['userId'];return getAgent(_0x19a4d1)[_0x2e06('0x1a')](function(_0x56fcc0){logger[_0x2e06('0x10')](_0x2e06('0x34'),_0x56fcc0[_0x2e06('0x15')]);emit(util[_0x2e06('0x31')]('user:%s',_0x56fcc0[_0x2e06('0x15')]),_0x2e06('0x40'));return _0x2568e7[_0x2e06('0x16')](0xc8)[_0x2e06('0x2d')]({'error':![],'message':_0x2e06('0x41')});})[_0x2e06('0x1e')](handleError(_0x2568e7));};exports[_0x2e06('0x42')]=function(_0xc39833,_0x450d1a){logger['info'](_0x2e06('0x43'),_0xc39833[_0x2e06('0x2c')]);var _0x52a862=transferValidation[_0x2e06('0xa')](_0xc39833[_0x2e06('0x2c')]);if(_0x52a862[_0x2e06('0x28')]>0x0){return _0x450d1a[_0x2e06('0x16')](0x190)['json'](_0x52a862);}var _0x6fba97=_0xc39833['body'][_0x2e06('0x2e')];var _0x3d4340=_0xc39833['body'][_0x2e06('0x27')];var _0x210be4=_0xc39833[_0x2e06('0x2c')][_0x2e06('0x44')];return getAgent(_0x6fba97)['then'](function(_0x56464b){logger[_0x2e06('0x10')]('entityFound:',_0x56464b[_0x2e06('0x15')]);emit(util[_0x2e06('0x31')]('user:%s',_0x56464b[_0x2e06('0x15')]),_0x2e06('0x45'),{'sessionId':_0x3d4340,'transferNumber':_0x210be4});return _0x450d1a['status'](0xc8)['json']({'error':![],'message':_0x2e06('0x46')});})['catch'](handleError(_0x450d1a));}; \ No newline at end of file +var _0x15a9=['redis','defaults','localhost','socket.io-emitter','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','code','message','result','catch','findOne','VoiceChannels','then','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','validate','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','calls\x20fired:','all','filter','UserId','conference','webbar:conference','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x15a9,0x18a));var _0x915a=function(_0x440807,_0x1a4ca4){_0x440807=_0x440807-0x0;var _0x54d077=_0x15a9[_0x440807];return _0x54d077;};'use strict';var path=require(_0x915a('0x0'));var fs=require('fs');var _=require(_0x915a('0x1'));var db=require(_0x915a('0x2'))['db'];var config=require(_0x915a('0x3'));var util=require('util');var BPromise=require(_0x915a('0x4'));var jayson=require(_0x915a('0x5'));var amiClient=jayson[_0x915a('0x6')][_0x915a('0x7')]({'port':0x232a});var logger=require(_0x915a('0x8'))(_0x915a('0x9'));var Redis=require(_0x915a('0xa'));config[_0x915a('0xb')]=_[_0x915a('0xc')](config[_0x915a('0xb')],{'host':_0x915a('0xd'),'port':0x18eb});var io=require(_0x915a('0xe'))(new Redis(config[_0x915a('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x915a('0xf')]},'callNumber':{'type':_0x915a('0x10'),'required':[!![],_0x915a('0x11')]},'callerId':{'type':_0x915a('0x10')},'callbackUrl':{'type':_0x915a('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x915a('0x12'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x915a('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x915a('0x12'),'required':[!![],_0x915a('0xf')]},'sessionId':{'type':_0x915a('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x915a('0x12'),'required':[!![],_0x915a('0xf')]},'sessionId':{'type':'string','required':[!![],_0x915a('0x13')]},'transferNumber':{'type':'string','required':[!![],_0x915a('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x915a('0x12'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x915a('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x915a('0x12'),'required':[!![],_0x915a('0xf')]},'sessionId':{'type':_0x915a('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x915a('0x12'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x276d83,_0x5c58ad,_0x4fbcfd){logger[_0x915a('0x15')](_0x276d83,_0x5c58ad,JSON[_0x915a('0x16')](_0x4fbcfd));io['to'](_0x276d83)[_0x915a('0x17')](_0x5c58ad,_0x4fbcfd);}function handleError(_0xab705f){return function(_0x143a4c){console[_0x915a('0x18')](_0x915a('0x19'),_0x143a4c,_0x143a4c instanceof RangeError);logger[_0x915a('0x1a')](_0x143a4c[_0x915a('0x1b')]);if(_0x143a4c instanceof RangeError){if(_0x143a4c['name']){delete _0x143a4c[_0x915a('0x1c')];}_0xab705f[_0x915a('0x1d')](0x194)[_0x915a('0x1e')](_0x143a4c);}else{if(_0x143a4c[_0x915a('0x1c')]){delete _0x143a4c['name'];}_0xab705f['status'](0x1f4)['send'](_0x143a4c);}};}function checkError(){return function(_0x5a520c){if(!_0x5a520c){throw new RangeError(_0x915a('0x1f'));}return _0x5a520c;};}function respondWithRpcPromise(_0x3b4af9,_0x583c17){return new BPromise(function(_0x1e35b8,_0x1689f7){var _0x3e3f49=amiClient;return _0x3e3f49[_0x915a('0x20')](_0x3b4af9,_0x583c17)['then'](function(_0x2595f8){if(_0x2595f8[_0x915a('0x1a')]){if(_0x2595f8[_0x915a('0x1a')][_0x915a('0x21')]===0x1f4){return _0x1689f7(_0x2595f8[_0x915a('0x1a')]['message']);}return _0x1e35b8(_0x2595f8[_0x915a('0x1a')][_0x915a('0x22')]);}else{_0x1e35b8(_0x2595f8[_0x915a('0x23')]);}})[_0x915a('0x24')](function(_0x5cbf7e){_0x1689f7(_0x5cbf7e);});});}function getAgent(_0x185d9f){return db['User'][_0x915a('0x25')]({'where':{'id':_0x185d9f,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x4a6000,_0x3cfd93){return new BPromise(function(_0x3233bb,_0x343319){var _0x22166a=respondWithRpcPromise(_0x915a('0x26'));var _0x5c8c41=getAgent(_0x4a6000);Promise['all']([_0x22166a,_0x5c8c41])[_0x915a('0x27')](function(_0x55d16b){var _0x41696f=_0x55d16b[0x0];var _0x134251=_0x55d16b[0x1];var _0x42015e=_['filter'](_0x41696f[_0x915a('0x28')],function(_0x2cee01){return _0x2cee01['UserId']==_0x134251['id']&&_0x2cee01[_0x915a('0x29')]==_0x3cfd93;});if(_0x42015e[_0x915a('0x2a')]==0x1){_0x3233bb(_0x134251);}else{_0x343319(new RangeError(_0x915a('0x2b')+_0x3cfd93+_0x915a('0x2c')));}});});}exports['originate']=function(_0x4eb849,_0x5eadb7){logger['info'](_0x915a('0x2d'),_0x4eb849[_0x915a('0x2e')]);var _0x19a938=originateValidation['validate'](_0x4eb849[_0x915a('0x2e')]);if(_0x19a938[_0x915a('0x2a')]>0x0){return _0x5eadb7[_0x915a('0x1d')](0x190)[_0x915a('0x2f')](_0x19a938);}var _0x2bf77b=_0x4eb849[_0x915a('0x2e')][_0x915a('0x30')];var _0x3f70c5=_0x4eb849[_0x915a('0x2e')][_0x915a('0x31')];var _0x18ef8e=_0x4eb849['body'][_0x915a('0x32')];var _0x49a5e9=_0x4eb849['body'][_0x915a('0x33')];return getAgent(_0x2bf77b)['then'](function(_0x2352a3){logger[_0x915a('0x15')](_0x915a('0x34'),_0x2352a3[_0x915a('0x1c')]);emit(util[_0x915a('0x35')](_0x915a('0x36'),_0x2352a3[_0x915a('0x1c')]),_0x915a('0x37'),{'callNumber':_0x3f70c5,'callerId':_0x18ef8e,'callbackUrl':_0x49a5e9});return _0x5eadb7[_0x915a('0x1d')](0xc8)[_0x915a('0x2f')]({'error':![],'message':_0x915a('0x38')});})[_0x915a('0x24')](handleError(_0x5eadb7));};exports['hangup']=function(_0x562be2,_0x2d710d){logger[_0x915a('0x15')](_0x915a('0x39'),_0x562be2[_0x915a('0x2e')]);var _0x19ba2f=hangupValidation[_0x915a('0x3a')](_0x562be2[_0x915a('0x2e')]);if(_0x19ba2f[_0x915a('0x2a')]>0x0){return _0x2d710d[_0x915a('0x1d')](0x190)['json'](_0x19ba2f);}var _0x4739e7=_0x562be2[_0x915a('0x2e')]['userId'];var _0x5bd8a7=_0x562be2[_0x915a('0x2e')][_0x915a('0x29')];return getAgent(_0x4739e7)['then'](function(_0x35afcc){logger[_0x915a('0x15')](_0x915a('0x34'),_0x35afcc[_0x915a('0x1c')]);emit(util[_0x915a('0x35')](_0x915a('0x36'),_0x35afcc[_0x915a('0x1c')]),_0x915a('0x3b'),{'sessionId':_0x5bd8a7});return _0x2d710d['status'](0xc8)[_0x915a('0x2f')]({'error':![],'message':_0x915a('0x3c')});})[_0x915a('0x24')](handleError(_0x2d710d));};exports['answer']=function(_0x2a2a61,_0x1f4bac){logger[_0x915a('0x15')](_0x915a('0x3d'),_0x2a2a61['body']);var _0x9acab9=answerValidation[_0x915a('0x3a')](_0x2a2a61[_0x915a('0x2e')]);if(_0x9acab9[_0x915a('0x2a')]>0x0){return _0x1f4bac[_0x915a('0x1d')](0x190)['json'](_0x9acab9);}var _0x3f1558=_0x2a2a61[_0x915a('0x2e')][_0x915a('0x30')];var _0x540ee3=_0x2a2a61[_0x915a('0x2e')]['sessionId'];return getAgent(_0x3f1558)[_0x915a('0x27')](function(_0x38b7a6){logger['info']('entityFound:',_0x38b7a6[_0x915a('0x1c')]);emit(util[_0x915a('0x35')](_0x915a('0x36'),_0x38b7a6['name']),_0x915a('0x3e'),{'sessionId':_0x540ee3});return _0x1f4bac[_0x915a('0x1d')](0xc8)[_0x915a('0x2f')]({'error':![],'message':_0x915a('0x3f')});})[_0x915a('0x24')](handleError(_0x1f4bac));};exports[_0x915a('0x40')]=function(_0x3b89f,_0x372c37){logger[_0x915a('0x15')](_0x915a('0x41'),_0x3b89f['body']);var _0x8128b5=holdValidation[_0x915a('0x3a')](_0x3b89f[_0x915a('0x2e')]);if(_0x8128b5['length']>0x0){return _0x372c37[_0x915a('0x1d')](0x190)[_0x915a('0x2f')](_0x8128b5);}var _0x48f658=_0x3b89f[_0x915a('0x2e')][_0x915a('0x30')];var _0x2efc93=_0x3b89f[_0x915a('0x2e')][_0x915a('0x29')];return getAgent(_0x48f658)[_0x915a('0x27')](function(_0x57cdf6){logger[_0x915a('0x15')]('entityFound:',_0x57cdf6[_0x915a('0x1c')]);emit(util[_0x915a('0x35')](_0x915a('0x36'),_0x57cdf6['name']),_0x915a('0x42'),{'sessionId':_0x2efc93});return _0x372c37[_0x915a('0x1d')](0xc8)['json']({'error':![],'message':_0x915a('0x43')});})['catch'](handleError(_0x372c37));};exports[_0x915a('0x44')]=function(_0x38f337,_0x402f9c){logger[_0x915a('0x15')](_0x915a('0x45'),_0x38f337['body']);var _0x276fe2=unholdValidation[_0x915a('0x3a')](_0x38f337[_0x915a('0x2e')]);if(_0x276fe2[_0x915a('0x2a')]>0x0){return _0x402f9c[_0x915a('0x1d')](0x190)[_0x915a('0x2f')](_0x276fe2);}var _0x5f2437=_0x38f337['body']['userId'];var _0x54af60=_0x38f337[_0x915a('0x2e')][_0x915a('0x29')];return getAgent(_0x5f2437)['then'](function(_0x3b8887){logger[_0x915a('0x15')](_0x915a('0x34'),_0x3b8887[_0x915a('0x1c')]);emit(util[_0x915a('0x35')](_0x915a('0x36'),_0x3b8887['name']),'webbar:unhold',{'sessionId':_0x54af60});return _0x402f9c[_0x915a('0x1d')](0xc8)[_0x915a('0x2f')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x402f9c));};exports[_0x915a('0x46')]=function(_0x3bbae5,_0x3bcdf5){logger[_0x915a('0x15')](_0x915a('0x47'),_0x3bcdf5[_0x915a('0x2e')]);var _0x3eac1f=callsValidation[_0x915a('0x3a')](_0x3bbae5['body']);if(_0x3eac1f[_0x915a('0x2a')]>0x0){return _0x3bcdf5[_0x915a('0x1d')](0x190)['json'](_0x3eac1f);}var _0x2da7d7=_0x3bbae5['body'][_0x915a('0x30')];var _0x4795f0=respondWithRpcPromise(_0x915a('0x26'));var _0x2fb10f=getAgent(_0x2da7d7);return Promise[_0x915a('0x48')]([_0x4795f0,_0x2fb10f])['then'](function(_0x575bc3){var _0x1f1d93=_0x575bc3[0x0];var _0x359a5f=_0x575bc3[0x1];var _0x3a5964=_[_0x915a('0x49')](_0x1f1d93['rows'],function(_0x51a6b4){return _0x51a6b4[_0x915a('0x4a')]==_0x359a5f['id'];});return _0x3bcdf5[_0x915a('0x1d')](0xc8)['json']({'count':_0x3a5964[_0x915a('0x2a')],'rows':_0x3a5964});})[_0x915a('0x24')](handleError(_0x3bcdf5));};exports[_0x915a('0x4b')]=function(_0x51870a,_0x16f3d3){logger[_0x915a('0x15')]('conference\x20fired:',_0x51870a[_0x915a('0x2e')]);var _0x5a0dd7=conferenceValidation[_0x915a('0x3a')](_0x51870a['body']);if(_0x5a0dd7[_0x915a('0x2a')]>0x0){return _0x16f3d3[_0x915a('0x1d')](0x190)[_0x915a('0x2f')](_0x5a0dd7);}var _0xd18c21=_0x51870a[_0x915a('0x2e')]['userId'];return getAgent(_0xd18c21)[_0x915a('0x27')](function(_0x4dfc4e){logger[_0x915a('0x15')]('entityFound:',_0x4dfc4e['name']);emit(util['format'](_0x915a('0x36'),_0x4dfc4e[_0x915a('0x1c')]),_0x915a('0x4c'));return _0x16f3d3[_0x915a('0x1d')](0xc8)[_0x915a('0x2f')]({'error':![],'message':'conference\x20executed!'});})[_0x915a('0x24')](handleError(_0x16f3d3));};exports[_0x915a('0x4d')]=function(_0x587d5d,_0x28328b){logger['info']('transfer\x20fired:',_0x587d5d['body']);var _0x4ff160=transferValidation[_0x915a('0x3a')](_0x587d5d[_0x915a('0x2e')]);if(_0x4ff160['length']>0x0){return _0x28328b[_0x915a('0x1d')](0x190)[_0x915a('0x2f')](_0x4ff160);}var _0x43ea73=_0x587d5d['body'][_0x915a('0x30')];var _0x1a6a53=_0x587d5d[_0x915a('0x2e')][_0x915a('0x29')];var _0x4a4fc3=_0x587d5d[_0x915a('0x2e')][_0x915a('0x4e')];return getAgent(_0x43ea73)['then'](function(_0x4be0c6){logger[_0x915a('0x15')](_0x915a('0x34'),_0x4be0c6[_0x915a('0x1c')]);emit(util[_0x915a('0x35')](_0x915a('0x36'),_0x4be0c6[_0x915a('0x1c')]),_0x915a('0x4f'),{'sessionId':_0x1a6a53,'transferNumber':_0x4a4fc3});return _0x28328b[_0x915a('0x1d')](0xc8)[_0x915a('0x2f')]({'error':![],'message':_0x915a('0x50')});})['catch'](handleError(_0x28328b));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 3921b4a..1d98d92 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 _0xea3b=['addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','show','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','/:id/dispositions'];(function(_0x599976,_0x47c905){var _0x12c881=function(_0x1a6d3d){while(--_0x1a6d3d){_0x599976['push'](_0x599976['shift']());}};_0x12c881(++_0x47c905);}(_0xea3b,0xab));var _0xbea3=function(_0x4f11cb,_0x14e174){_0x4f11cb=_0x4f11cb-0x0;var _0x491488=_0xea3b[_0x4f11cb];return _0x491488;};'use strict';var multer=require(_0xbea3('0x0'));var util=require(_0xbea3('0x1'));var path=require(_0xbea3('0x2'));var timeout=require(_0xbea3('0x3'));var express=require('express');var router=express[_0xbea3('0x4')]();var fs_extra=require(_0xbea3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbea3('0x6'));var config=require(_0xbea3('0x7'));var controller=require(_0xbea3('0x8'));router[_0xbea3('0x9')]('/',auth['isAuthenticated'](),controller[_0xbea3('0xa')]);router['get'](_0xbea3('0xb'),auth[_0xbea3('0xc')](),controller['describe']);router[_0xbea3('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xbea3('0xd')]);router[_0xbea3('0x9')]('/:id/dispositions',auth[_0xbea3('0xc')](),controller[_0xbea3('0xe')]);router['get'](_0xbea3('0xf'),auth['isAuthenticated'](),controller[_0xbea3('0x10')]);router['get'](_0xbea3('0x11'),auth['isAuthenticated'](),controller[_0xbea3('0x12')]);router['get'](_0xbea3('0x13'),auth['isAuthenticated'](),controller[_0xbea3('0x14')]);router['post']('/',auth[_0xbea3('0xc')](),controller[_0xbea3('0x15')]);router[_0xbea3('0x16')](_0xbea3('0x17'),auth['isAuthenticated'](),controller[_0xbea3('0x18')]);router[_0xbea3('0x16')]('/:id/canned_answers',auth[_0xbea3('0xc')](),controller[_0xbea3('0x19')]);router[_0xbea3('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xbea3('0x1a')]);router[_0xbea3('0x16')](_0xbea3('0x13'),auth[_0xbea3('0xc')](),controller[_0xbea3('0x1b')]);router[_0xbea3('0x16')](_0xbea3('0x1c'),controller[_0xbea3('0x1d')]);router[_0xbea3('0x16')](_0xbea3('0x1e'),auth['isAuthenticated'](),controller[_0xbea3('0x1f')]);router['put'](_0xbea3('0x20'),auth['isAuthenticated'](),controller[_0xbea3('0x21')]);router['delete'](_0xbea3('0x20'),auth['isAuthenticated'](),controller[_0xbea3('0x22')]);router[_0xbea3('0x23')]('/:id/dispositions',auth[_0xbea3('0xc')](),controller[_0xbea3('0x24')]);router[_0xbea3('0x23')](_0xbea3('0xf'),auth[_0xbea3('0xc')](),controller[_0xbea3('0x25')]);router[_0xbea3('0x23')](_0xbea3('0x11'),auth['isAuthenticated'](),controller[_0xbea3('0x26')]);module['exports']=router; \ No newline at end of file +var _0xd6b5=['../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/canned_answers','getAgents','getApplications','post','/:id/dispositions','addDisposition','/:id/users','addAgents','/:id/applications','addApplications','notify','/:id/send','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4d79ca,_0x413286){var _0x57af1f=function(_0x5df6f3){while(--_0x5df6f3){_0x4d79ca['push'](_0x4d79ca['shift']());}};_0x57af1f(++_0x413286);}(_0xd6b5,0xc5));var _0x5d6b=function(_0x362400,_0x231f5c){_0x362400=_0x362400-0x0;var _0x11de1a=_0xd6b5[_0x362400];return _0x11de1a;};'use strict';var multer=require(_0x5d6b('0x0'));var util=require(_0x5d6b('0x1'));var path=require(_0x5d6b('0x2'));var timeout=require(_0x5d6b('0x3'));var express=require(_0x5d6b('0x4'));var router=express[_0x5d6b('0x5')]();var fs_extra=require(_0x5d6b('0x6'));var auth=require(_0x5d6b('0x7'));var interaction=require(_0x5d6b('0x8'));var config=require('../../config/environment');var controller=require(_0x5d6b('0x9'));router['get']('/',auth[_0x5d6b('0xa')](),controller['index']);router[_0x5d6b('0xb')](_0x5d6b('0xc'),auth[_0x5d6b('0xa')](),controller[_0x5d6b('0xd')]);router[_0x5d6b('0xb')](_0x5d6b('0xe'),auth['isAuthenticated'](),controller[_0x5d6b('0xf')]);router[_0x5d6b('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x5d6b('0xb')](_0x5d6b('0x10'),auth[_0x5d6b('0xa')](),controller['getAnswers']);router['get']('/:id/users',auth[_0x5d6b('0xa')](),controller[_0x5d6b('0x11')]);router[_0x5d6b('0xb')]('/:id/applications',auth[_0x5d6b('0xa')](),controller[_0x5d6b('0x12')]);router['post']('/',auth[_0x5d6b('0xa')](),controller['create']);router[_0x5d6b('0x13')](_0x5d6b('0x14'),auth[_0x5d6b('0xa')](),controller[_0x5d6b('0x15')]);router[_0x5d6b('0x13')]('/:id/canned_answers',auth[_0x5d6b('0xa')](),controller['addAnswer']);router[_0x5d6b('0x13')](_0x5d6b('0x16'),auth[_0x5d6b('0xa')](),controller[_0x5d6b('0x17')]);router[_0x5d6b('0x13')](_0x5d6b('0x18'),auth['isAuthenticated'](),controller[_0x5d6b('0x19')]);router[_0x5d6b('0x13')]('/:id/notify',controller[_0x5d6b('0x1a')]);router[_0x5d6b('0x13')](_0x5d6b('0x1b'),auth[_0x5d6b('0xa')](),controller['send']);router[_0x5d6b('0x1c')](_0x5d6b('0xe'),auth[_0x5d6b('0xa')](),controller[_0x5d6b('0x1d')]);router[_0x5d6b('0x1e')](_0x5d6b('0xe'),auth[_0x5d6b('0xa')](),controller['destroy']);router['delete'](_0x5d6b('0x14'),auth[_0x5d6b('0xa')](),controller[_0x5d6b('0x1f')]);router[_0x5d6b('0x1e')]('/:id/canned_answers',auth[_0x5d6b('0xa')](),controller[_0x5d6b('0x20')]);router[_0x5d6b('0x1e')](_0x5d6b('0x16'),auth[_0x5d6b('0xa')](),controller['removeAgents']);module[_0x5d6b('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index b9969b7..413dac3 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 _0x70a2=['twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x9469f1,_0x2645ab){var _0x3e4ec2=function(_0x299ef1){while(--_0x299ef1){_0x9469f1['push'](_0x9469f1['shift']());}};_0x3e4ec2(++_0x2645ab);}(_0x70a2,0x91));var _0x270a=function(_0x51f593,_0x38d2ec){_0x51f593=_0x51f593-0x0;var _0x4ccfbf=_0x70a2[_0x51f593];return _0x4ccfbf;};'use strict';var Sequelize=require(_0x270a('0x0'));var rs=require(_0x270a('0x1'));module[_0x270a('0x2')]={'name':{'type':Sequelize[_0x270a('0x3')],'unique':_0x270a('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x270a('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x270a('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x270a('0x3')]},'type':{'type':Sequelize['ENUM'](_0x270a('0x5'))},'accountSid':{'type':Sequelize[_0x270a('0x3')]},'authToken':{'type':Sequelize[_0x270a('0x3')]},'notificationTemplate':{'type':Sequelize[_0x270a('0x6')],'defaultValue':function(){return _0x270a('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x270a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x270a('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x270a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x270a('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x270a('0x8')],'comment':_0x270a('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x270a('0x9')],'defaultValue':![],'comment':_0x270a('0xb'),'set':function(_0x484201){if(!_0x484201){this[_0x270a('0xc')](_0x270a('0xd'),null);}this[_0x270a('0xc')](_0x270a('0xe'),_0x484201);}},'description':{'type':Sequelize[_0x270a('0x3')]}}; \ No newline at end of file +var _0x6ed3=['mandatoryDisposition','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId'];(function(_0x4e2bc6,_0x5e2401){var _0x59357a=function(_0x437f8c){while(--_0x437f8c){_0x4e2bc6['push'](_0x4e2bc6['shift']());}};_0x59357a(++_0x5e2401);}(_0x6ed3,0xe8));var _0x36ed=function(_0x4d121d,_0x3fe733){_0x4d121d=_0x4d121d-0x0;var _0xffa031=_0x6ed3[_0x4d121d];return _0xffa031;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x36ed('0x0')]={'name':{'type':Sequelize[_0x36ed('0x1')],'unique':_0x36ed('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x36ed('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x36ed('0x3')]();}},'phone':{'type':Sequelize[_0x36ed('0x1')]},'type':{'type':Sequelize['ENUM']('twilio')},'accountSid':{'type':Sequelize[_0x36ed('0x1')]},'authToken':{'type':Sequelize[_0x36ed('0x1')]},'notificationTemplate':{'type':Sequelize[_0x36ed('0x4')],'defaultValue':function(){return _0x36ed('0x5');}},'notificationSound':{'type':Sequelize[_0x36ed('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x36ed('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x36ed('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x36ed('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x36ed('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x36ed('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x12025b){if(!_0x12025b){this[_0x36ed('0x8')](_0x36ed('0x9'),null);}this[_0x36ed('0x8')](_0x36ed('0xa'),_0x12025b);}},'description':{'type':Sequelize[_0x36ed('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index c31c700..a1d13a9 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 _0x1d2d=['orderBy','Applications','priority','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','From','replace','whatsapp:','Body','messageId','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','DESC','list','WhatsappInteraction','autoclose','push','applications','unmanaged','*,*,*,*','created','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','\x0a','to\x20is\x20mandatory','List','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','limit','undefined','set','Content-Range','json','apply','reject','save','update','then','WhatsappAccounts','UserProfileResource','destroy','stack','send','contact','agent','interaction','account','index','Pause','mandatoryDispositionPause','rawAttributes','fieldName','model','map','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','name','options','WhatsappAccount','includeAll','findAll','rows','show','keys','include','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','findOne','order','count','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','WhatsappApplication','bulkCreate','getApplications','notify','whatsapp'];(function(_0x1d8cd4,_0x4a32c0){var _0x18225=function(_0x426eb5){while(--_0x426eb5){_0x1d8cd4['push'](_0x1d8cd4['shift']());}};_0x18225(++_0x4a32c0);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x3ad44f,_0x1e1b7a){_0x3ad44f=_0x3ad44f-0x0;var _0x841bb2=_0x1d2d[_0x3ad44f];return _0x841bb2;};'use strict';var emlformat=require(_0xd1d2('0x0'));var rimraf=require(_0xd1d2('0x1'));var zipdir=require(_0xd1d2('0x2'));var jsonpatch=require(_0xd1d2('0x3'));var rp=require(_0xd1d2('0x4'));var moment=require('moment');var BPromise=require(_0xd1d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1d2('0x6'));var sox=require(_0xd1d2('0x7'));var csv=require(_0xd1d2('0x8'));var ejs=require(_0xd1d2('0x9'));var fs=require('fs');var fs_extra=require(_0xd1d2('0xa'));var _=require(_0xd1d2('0xb'));var squel=require('squel');var crypto=require(_0xd1d2('0xc'));var jsforce=require(_0xd1d2('0xd'));var deskjs=require(_0xd1d2('0xe'));var toCsv=require(_0xd1d2('0x8'));var querystring=require(_0xd1d2('0xf'));var Papa=require(_0xd1d2('0x10'));var Redis=require(_0xd1d2('0x11'));var authService=require(_0xd1d2('0x12'));var qs=require(_0xd1d2('0x13'));var as=require(_0xd1d2('0x14'));var hardwareService=require(_0xd1d2('0x15'));var logger=require(_0xd1d2('0x16'))(_0xd1d2('0x17'));var utils=require('../../config/utils');var config=require(_0xd1d2('0x18'));var licenseUtil=require(_0xd1d2('0x19'));var db=require(_0xd1d2('0x1a'))['db'];config[_0xd1d2('0x1b')]=_[_0xd1d2('0x1c')](config[_0xd1d2('0x1b')],{'host':_0xd1d2('0x1d'),'port':0x18eb});var socket=require(_0xd1d2('0x1e'))(new Redis(config[_0xd1d2('0x1b')]));require(_0xd1d2('0x1f'))['register'](socket);var jayson=require(_0xd1d2('0x20'));var client=jayson[_0xd1d2('0x21')][_0xd1d2('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x56de25,_0x35381b,_0xc36ce,_0x208425){return new BPromise(function(_0x2f4cf9,_0xecac1f){var _0x2723b3=_0x208425||client;return _0x2723b3[_0xd1d2('0x23')](_0x56de25,_0xc36ce)['then'](function(_0x539d5a){logger[_0xd1d2('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x35381b,_0xd1d2('0x25'));logger[_0xd1d2('0x26')](_0xd1d2('0x27'),_0x35381b,_0xd1d2('0x25'),JSON['stringify'](_0x539d5a));if(_0x539d5a['error']){if(_0x539d5a[_0xd1d2('0x28')]['code']===0x1f4){logger['error'](_0xd1d2('0x29'),_0x35381b,_0x539d5a[_0xd1d2('0x28')][_0xd1d2('0x2a')]);return _0xecac1f(_0x539d5a[_0xd1d2('0x28')]['message']);}logger[_0xd1d2('0x28')](_0xd1d2('0x29'),_0x35381b,_0x539d5a[_0xd1d2('0x28')]['message']);return _0x2f4cf9(_0x539d5a['error'][_0xd1d2('0x2a')]);}else{logger[_0xd1d2('0x24')](_0xd1d2('0x29'),_0x35381b,_0xd1d2('0x25'));_0x2f4cf9(_0x539d5a[_0xd1d2('0x2b')][_0xd1d2('0x2a')]);}})[_0xd1d2('0x2c')](function(_0x5df4af){logger[_0xd1d2('0x28')](_0xd1d2('0x29'),_0x35381b,_0x5df4af);_0xecac1f(_0x5df4af);});});}function respondWithStatusCode(_0x41330f,_0x2e1709){_0x2e1709=_0x2e1709||0xcc;return function(_0x5d3ee1){if(_0x5d3ee1){return _0x41330f[_0xd1d2('0x2d')](_0x2e1709);}return _0x41330f[_0xd1d2('0x2e')](_0x2e1709)[_0xd1d2('0x2f')]();};}function respondWithResult(_0xe6ef3c,_0x384460){_0x384460=_0x384460||0xc8;return function(_0x3645e9){if(_0x3645e9){return _0xe6ef3c['status'](_0x384460)['json'](_0x3645e9);}};}function respondWithFilteredResult(_0x133c6c,_0x442375){return function(_0x1e6072){if(_0x1e6072){var _0x2b4c1f=typeof _0x442375[_0xd1d2('0x30')]==='undefined'&&typeof _0x442375[_0xd1d2('0x31')]===_0xd1d2('0x32');var _0x383947=_0x1e6072['count'];var _0x19db00=_0x2b4c1f?0x0:_0x442375[_0xd1d2('0x30')];var _0xbd855a=_0x2b4c1f?_0x1e6072['count']:_0x442375[_0xd1d2('0x30')]+_0x442375[_0xd1d2('0x31')];var _0x1cc33b;if(_0xbd855a>=_0x383947){_0xbd855a=_0x383947;_0x1cc33b=0xc8;}else{_0x1cc33b=0xce;}_0x133c6c[_0xd1d2('0x2e')](_0x1cc33b);return _0x133c6c[_0xd1d2('0x33')](_0xd1d2('0x34'),_0x19db00+'-'+_0xbd855a+'/'+_0x383947)[_0xd1d2('0x35')](_0x1e6072);}return null;};}function patchUpdates(_0x322f50){return function(_0x1f3682){try{jsonpatch[_0xd1d2('0x36')](_0x1f3682,_0x322f50,!![]);}catch(_0x28d062){return BPromise[_0xd1d2('0x37')](_0x28d062);}return _0x1f3682[_0xd1d2('0x38')]();};}function saveUpdates(_0x2d9508,_0x372481){return function(_0xb6ad51){if(_0xb6ad51){return _0xb6ad51[_0xd1d2('0x39')](_0x2d9508)[_0xd1d2('0x3a')](function(_0x5c7efd){return _0x5c7efd;});}return null;};}function removeEntity(_0x1541ff,_0x384fe1){return function(_0xb4369a){if(_0xb4369a){return _0xb4369a['destroy']()[_0xd1d2('0x3a')](function(){var _0x516049=_0xb4369a['get']({'plain':!![]});var _0x12904d=_0xd1d2('0x3b');return db[_0xd1d2('0x3c')][_0xd1d2('0x3d')]({'where':{'type':_0x12904d,'resourceId':_0x516049['id']}})[_0xd1d2('0x3a')](function(){return _0xb4369a;});})[_0xd1d2('0x3a')](function(){_0x1541ff['status'](0xcc)[_0xd1d2('0x2f')]();});}};}function handleEntityNotFound(_0x168eb8,_0x5bdf40){return function(_0x296bab){if(!_0x296bab){_0x168eb8[_0xd1d2('0x2d')](0x194);}return _0x296bab;};}function handleError(_0x3281de,_0x2f55a1){_0x2f55a1=_0x2f55a1||0x1f4;return function(_0x4adb17){logger['error'](_0x4adb17[_0xd1d2('0x3e')]);if(_0x4adb17['name']){delete _0x4adb17['name'];}_0x3281de['status'](_0x2f55a1)[_0xd1d2('0x3f')](_0x4adb17);};}function getMustacheRender(_0x5747bb,_0x3f4fd7){return Mustache['render'](_0x5747bb,_['merge'](_0x3f4fd7['body'],{'contact':_0x3f4fd7[_0xd1d2('0x40')],'message':_0x3f4fd7[_0xd1d2('0x2a')],'agent':_0x3f4fd7[_0xd1d2('0x41')],'interaction':_0x3f4fd7[_0xd1d2('0x42')],'account':_0x3f4fd7[_0xd1d2('0x43')]}))||'';}exports[_0xd1d2('0x44')]=function(_0x178f8b,_0x38bf16){var _0x2d930d={'include':[{'model':db[_0xd1d2('0x45')],'as':_0xd1d2('0x46')}]},_0x1c42e3={},_0x2cedb4={'count':0x0,'rows':[]};var _0x18ff05=_['map'](db['WhatsappAccount'][_0xd1d2('0x47')],function(_0x117d4a){return{'name':_0x117d4a[_0xd1d2('0x48')],'type':_0x117d4a['type']['key']};});_0x1c42e3[_0xd1d2('0x49')]=_[_0xd1d2('0x4a')](_0x18ff05,'name');_0x1c42e3[_0xd1d2('0x4b')]=_['keys'](_0x178f8b['query']);_0x1c42e3[_0xd1d2('0x4c')]=_['intersection'](_0x1c42e3['model'],_0x1c42e3[_0xd1d2('0x4b')]);_0x2d930d[_0xd1d2('0x4d')]=_[_0xd1d2('0x4e')](_0x1c42e3['model'],qs[_0xd1d2('0x4f')](_0x178f8b[_0xd1d2('0x4b')][_0xd1d2('0x4f')]));_0x2d930d[_0xd1d2('0x4d')]=_0x2d930d['attributes'][_0xd1d2('0x50')]?_0x2d930d[_0xd1d2('0x4d')]:_0x1c42e3['model'];if(!_0x178f8b[_0xd1d2('0x4b')]['hasOwnProperty'](_0xd1d2('0x51'))){_0x2d930d[_0xd1d2('0x31')]=qs[_0xd1d2('0x31')](_0x178f8b[_0xd1d2('0x4b')][_0xd1d2('0x31')]);_0x2d930d['offset']=qs['offset'](_0x178f8b[_0xd1d2('0x4b')][_0xd1d2('0x30')]);}_0x2d930d['order']=qs[_0xd1d2('0x52')](_0x178f8b[_0xd1d2('0x4b')][_0xd1d2('0x52')]);_0x2d930d[_0xd1d2('0x53')]=qs[_0xd1d2('0x4c')](_[_0xd1d2('0x54')](_0x178f8b[_0xd1d2('0x4b')],_0x1c42e3['filters']),_0x18ff05);if(_0x178f8b[_0xd1d2('0x4b')][_0xd1d2('0x55')]){_0x2d930d['where']=_[_0xd1d2('0x56')](_0x2d930d[_0xd1d2('0x53')],{'$or':_['map'](_0x18ff05,function(_0x5d1a47){if(_0x5d1a47[_0xd1d2('0x57')]!==_0xd1d2('0x58')){var _0x4cb376={};_0x4cb376[_0x5d1a47[_0xd1d2('0x59')]]={'$like':'%'+_0x178f8b[_0xd1d2('0x4b')][_0xd1d2('0x55')]+'%'};return _0x4cb376;}})});}_0x2d930d=_[_0xd1d2('0x56')]({},_0x2d930d,_0x178f8b[_0xd1d2('0x5a')]);var _0x4e28c5={'where':_0x2d930d['where']};return db[_0xd1d2('0x5b')]['count'](_0x4e28c5)[_0xd1d2('0x3a')](function(_0xcd4b70){_0x2cedb4['count']=_0xcd4b70;if(_0x178f8b[_0xd1d2('0x4b')][_0xd1d2('0x5c')]){_0x2d930d['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0xd1d2('0x5d')](_0x2d930d);})[_0xd1d2('0x3a')](function(_0x187de4){_0x2cedb4[_0xd1d2('0x5e')]=_0x187de4;return _0x2cedb4;})[_0xd1d2('0x3a')](respondWithFilteredResult(_0x38bf16,_0x2d930d))[_0xd1d2('0x2c')](handleError(_0x38bf16,null));};exports[_0xd1d2('0x5f')]=function(_0x3411c8,_0x33e332){var _0x5e15cb={'raw':![],'where':{'id':_0x3411c8['params']['id']},'include':[{'model':db['Pause'],'as':_0xd1d2('0x46')}]},_0x1958f3={};_0x1958f3[_0xd1d2('0x49')]=_[_0xd1d2('0x60')](db[_0xd1d2('0x5b')][_0xd1d2('0x47')]);_0x1958f3[_0xd1d2('0x4b')]=_[_0xd1d2('0x60')](_0x3411c8[_0xd1d2('0x4b')]);_0x1958f3[_0xd1d2('0x4c')]=_[_0xd1d2('0x4e')](_0x1958f3[_0xd1d2('0x49')],_0x1958f3[_0xd1d2('0x4b')]);_0x5e15cb[_0xd1d2('0x4d')]=_['intersection'](_0x1958f3['model'],qs[_0xd1d2('0x4f')](_0x3411c8[_0xd1d2('0x4b')][_0xd1d2('0x4f')]));_0x5e15cb[_0xd1d2('0x4d')]=_0x5e15cb[_0xd1d2('0x4d')][_0xd1d2('0x50')]?_0x5e15cb[_0xd1d2('0x4d')]:_0x1958f3[_0xd1d2('0x49')];if(_0x3411c8[_0xd1d2('0x4b')][_0xd1d2('0x5c')]){_0x5e15cb[_0xd1d2('0x61')]=[{'all':!![]}];}_0x5e15cb=_['merge']({},_0x5e15cb,_0x3411c8['options']);return db[_0xd1d2('0x5b')][_0xd1d2('0x62')](_0x5e15cb)[_0xd1d2('0x3a')](handleEntityNotFound(_0x33e332,null))[_0xd1d2('0x3a')](respondWithResult(_0x33e332,null))['catch'](handleError(_0x33e332,null));};exports[_0xd1d2('0x63')]=function(_0x27c629,_0x42961d){return db[_0xd1d2('0x5b')][_0xd1d2('0x63')](_0x27c629[_0xd1d2('0x64')],{})[_0xd1d2('0x3a')](function(_0x4a7375){var _0x365352=_0x27c629[_0xd1d2('0x65')][_0xd1d2('0x66')]({'plain':!![]});if(!_0x365352)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x365352['role']===_0xd1d2('0x65')){var _0x3cd7c7=_0x4a7375[_0xd1d2('0x66')]({'plain':!![]});var _0xe40d1d='WhatsappAccounts';return db[_0xd1d2('0x67')][_0xd1d2('0x62')]({'where':{'name':_0xe40d1d,'userProfileId':_0x365352[_0xd1d2('0x68')]},'raw':!![]})['then'](function(_0x91907a){if(_0x91907a&&_0x91907a[_0xd1d2('0x69')]===0x0){return db['UserProfileResource'][_0xd1d2('0x63')]({'name':_0x3cd7c7[_0xd1d2('0x59')],'resourceId':_0x3cd7c7['id'],'type':_0x91907a[_0xd1d2('0x59')],'sectionId':_0x91907a['id']},{})[_0xd1d2('0x3a')](function(){return _0x4a7375;});}else{return _0x4a7375;}})['catch'](function(_0x1c12df){logger[_0xd1d2('0x28')](_0xd1d2('0x6a'),_0x1c12df);throw _0x1c12df;});}return _0x4a7375;})[_0xd1d2('0x3a')](respondWithResult(_0x42961d,0xc9))[_0xd1d2('0x2c')](handleError(_0x42961d,null));};exports['update']=function(_0x47aa13,_0x500465){if(_0x47aa13['body']['id']){delete _0x47aa13['body']['id'];}return db[_0xd1d2('0x5b')][_0xd1d2('0x62')]({'where':{'id':_0x47aa13[_0xd1d2('0x6b')]['id']},'include':[{'model':db['Pause'],'as':_0xd1d2('0x46')}]})[_0xd1d2('0x3a')](handleEntityNotFound(_0x500465,null))[_0xd1d2('0x3a')](saveUpdates(_0x47aa13['body'],null))[_0xd1d2('0x3a')](respondWithResult(_0x500465,null))[_0xd1d2('0x2c')](handleError(_0x500465,null));};exports[_0xd1d2('0x3d')]=function(_0x4a42d9,_0x43b43c){return db[_0xd1d2('0x5b')]['find']({'where':{'id':_0x4a42d9[_0xd1d2('0x6b')]['id']}})[_0xd1d2('0x3a')](handleEntityNotFound(_0x43b43c,null))['then'](removeEntity(_0x43b43c,null))['catch'](handleError(_0x43b43c,null));};exports[_0xd1d2('0x6c')]=function(_0x1ea57a,_0x34877f){return db[_0xd1d2('0x5b')]['describe']()[_0xd1d2('0x3a')](respondWithResult(_0x34877f,null))[_0xd1d2('0x2c')](handleError(_0x34877f,null));};exports[_0xd1d2('0x6d')]=function(_0xeb221d,_0x5d537e,_0x2d1b0d){if(_0xeb221d[_0xd1d2('0x64')]['id']){delete _0xeb221d[_0xd1d2('0x64')]['id'];}return db['WhatsappAccount'][_0xd1d2('0x62')]({'where':{'id':_0xeb221d[_0xd1d2('0x6b')]['id']}})['then'](handleEntityNotFound(_0x5d537e,null))[_0xd1d2('0x3a')](function(_0x32ae30){if(_0x32ae30){_0xeb221d[_0xd1d2('0x64')][_0xd1d2('0x6e')]=_0x32ae30['id'];return db[_0xd1d2('0x6f')]['create'](_0xeb221d[_0xd1d2('0x64')]);}})['then'](respondWithResult(_0x5d537e,null))['catch'](handleError(_0x5d537e,null));};exports['getDispositions']=function(_0x502432,_0x89ec63,_0x5ed30b){var _0x37591f={'raw':![],'where':{}};var _0x52dd76={};var _0x3451a0={'count':0x0,'rows':[]};return db[_0xd1d2('0x5b')][_0xd1d2('0x70')]({'where':{'id':_0x502432[_0xd1d2('0x6b')]['id']}})[_0xd1d2('0x3a')](handleEntityNotFound(_0x89ec63,null))[_0xd1d2('0x3a')](function(_0x586c78){if(_0x586c78){_0x52dd76[_0xd1d2('0x49')]=_[_0xd1d2('0x60')](db[_0xd1d2('0x6f')][_0xd1d2('0x47')]);_0x52dd76[_0xd1d2('0x4b')]=_[_0xd1d2('0x60')](_0x502432[_0xd1d2('0x4b')]);_0x52dd76[_0xd1d2('0x4c')]=_[_0xd1d2('0x4e')](_0x52dd76[_0xd1d2('0x49')],_0x52dd76['query']);_0x37591f[_0xd1d2('0x4d')]=_[_0xd1d2('0x4e')](_0x52dd76[_0xd1d2('0x49')],qs[_0xd1d2('0x4f')](_0x502432['query'][_0xd1d2('0x4f')]));_0x37591f[_0xd1d2('0x4d')]=_0x37591f[_0xd1d2('0x4d')]['length']?_0x37591f[_0xd1d2('0x4d')]:_0x52dd76[_0xd1d2('0x49')];if(!_0x502432['query']['hasOwnProperty'](_0xd1d2('0x51'))){_0x37591f[_0xd1d2('0x31')]=qs[_0xd1d2('0x31')](_0x502432[_0xd1d2('0x4b')][_0xd1d2('0x31')]);_0x37591f[_0xd1d2('0x30')]=qs[_0xd1d2('0x30')](_0x502432['query'][_0xd1d2('0x30')]);}_0x37591f[_0xd1d2('0x71')]=qs[_0xd1d2('0x52')](_0x502432[_0xd1d2('0x4b')][_0xd1d2('0x52')]);_0x37591f[_0xd1d2('0x53')]=qs[_0xd1d2('0x4c')](_[_0xd1d2('0x54')](_0x502432[_0xd1d2('0x4b')],_0x52dd76[_0xd1d2('0x4c')]));_0x37591f[_0xd1d2('0x53')][_0xd1d2('0x6e')]=_0x586c78['id'];if(_0x502432[_0xd1d2('0x4b')][_0xd1d2('0x55')]){_0x37591f['where']=_[_0xd1d2('0x56')](_0x37591f[_0xd1d2('0x53')],{'$or':_[_0xd1d2('0x4a')](_0x37591f[_0xd1d2('0x4d')],function(_0x20a3f0){var _0x32c294={};_0x32c294[_0x20a3f0]={'$like':'%'+_0x502432[_0xd1d2('0x4b')][_0xd1d2('0x55')]+'%'};return _0x32c294;})});}_0x37591f=_[_0xd1d2('0x56')]({},_0x37591f,_0x502432[_0xd1d2('0x5a')]);return db[_0xd1d2('0x6f')][_0xd1d2('0x72')]({'where':_0x37591f[_0xd1d2('0x53')]})['then'](function(_0x369382){_0x3451a0[_0xd1d2('0x72')]=_0x369382;if(_0x502432[_0xd1d2('0x4b')][_0xd1d2('0x5c')]){_0x37591f[_0xd1d2('0x61')]=[{'all':!![]}];}return db[_0xd1d2('0x6f')][_0xd1d2('0x5d')](_0x37591f);})[_0xd1d2('0x3a')](function(_0x28a351){_0x3451a0[_0xd1d2('0x5e')]=_0x28a351;return _0x3451a0;});}})[_0xd1d2('0x3a')](respondWithFilteredResult(_0x89ec63,_0x37591f))[_0xd1d2('0x2c')](handleError(_0x89ec63,null));};exports['removeDispositions']=function(_0x46375e,_0x234262,_0x279dcb){return db[_0xd1d2('0x5b')][_0xd1d2('0x62')]({'where':{'id':_0x46375e['params']['id']}})[_0xd1d2('0x3a')](handleEntityNotFound(_0x234262,null))[_0xd1d2('0x3a')](function(_0x2b4bb8){if(_0x2b4bb8){return _0x2b4bb8[_0xd1d2('0x73')](_0x46375e['query'][_0xd1d2('0x74')]);}})[_0xd1d2('0x3a')](respondWithStatusCode(_0x234262,null))[_0xd1d2('0x2c')](handleError(_0x234262,null));};exports[_0xd1d2('0x75')]=function(_0x39c9f1,_0x18bd6d,_0x1aa0a5){if(_0x39c9f1['body']['id']){delete _0x39c9f1[_0xd1d2('0x64')]['id'];}return db[_0xd1d2('0x5b')][_0xd1d2('0x62')]({'where':{'id':_0x39c9f1[_0xd1d2('0x6b')]['id']}})[_0xd1d2('0x3a')](handleEntityNotFound(_0x18bd6d,null))[_0xd1d2('0x3a')](function(_0x44e501){if(_0x44e501){_0x39c9f1[_0xd1d2('0x64')][_0xd1d2('0x6e')]=_0x44e501['id'];return db[_0xd1d2('0x76')][_0xd1d2('0x63')](_0x39c9f1[_0xd1d2('0x64')]);}})[_0xd1d2('0x3a')](respondWithResult(_0x18bd6d,null))[_0xd1d2('0x2c')](handleError(_0x18bd6d,null));};exports[_0xd1d2('0x77')]=function(_0x2e1fad,_0x2606d7,_0x5b7dbb){var _0x1555de={'raw':![],'where':{}};var _0x56e2ab={};var _0xa6df47={'count':0x0,'rows':[]};return db[_0xd1d2('0x5b')][_0xd1d2('0x70')]({'where':{'id':_0x2e1fad[_0xd1d2('0x6b')]['id']}})[_0xd1d2('0x3a')](handleEntityNotFound(_0x2606d7,null))[_0xd1d2('0x3a')](function(_0x1489e5){if(_0x1489e5){_0x56e2ab[_0xd1d2('0x49')]=_['keys'](db['CannedAnswer'][_0xd1d2('0x47')]);_0x56e2ab['query']=_['keys'](_0x2e1fad[_0xd1d2('0x4b')]);_0x56e2ab[_0xd1d2('0x4c')]=_['intersection'](_0x56e2ab[_0xd1d2('0x49')],_0x56e2ab[_0xd1d2('0x4b')]);_0x1555de[_0xd1d2('0x4d')]=_[_0xd1d2('0x4e')](_0x56e2ab[_0xd1d2('0x49')],qs[_0xd1d2('0x4f')](_0x2e1fad[_0xd1d2('0x4b')]['fields']));_0x1555de[_0xd1d2('0x4d')]=_0x1555de['attributes'][_0xd1d2('0x50')]?_0x1555de['attributes']:_0x56e2ab[_0xd1d2('0x49')];if(!_0x2e1fad[_0xd1d2('0x4b')][_0xd1d2('0x78')](_0xd1d2('0x51'))){_0x1555de[_0xd1d2('0x31')]=qs[_0xd1d2('0x31')](_0x2e1fad[_0xd1d2('0x4b')]['limit']);_0x1555de[_0xd1d2('0x30')]=qs[_0xd1d2('0x30')](_0x2e1fad[_0xd1d2('0x4b')][_0xd1d2('0x30')]);}_0x1555de['order']=qs[_0xd1d2('0x52')](_0x2e1fad[_0xd1d2('0x4b')][_0xd1d2('0x52')]);_0x1555de['where']=qs[_0xd1d2('0x4c')](_[_0xd1d2('0x54')](_0x2e1fad[_0xd1d2('0x4b')],_0x56e2ab[_0xd1d2('0x4c')]));_0x1555de[_0xd1d2('0x53')]['WhatsappAccountId']=_0x1489e5['id'];if(_0x2e1fad[_0xd1d2('0x4b')][_0xd1d2('0x55')]){_0x1555de['where']=_[_0xd1d2('0x56')](_0x1555de[_0xd1d2('0x53')],{'$or':_[_0xd1d2('0x4a')](_0x1555de[_0xd1d2('0x4d')],function(_0x327d80){var _0x4e0e8c={};_0x4e0e8c[_0x327d80]={'$like':'%'+_0x2e1fad[_0xd1d2('0x4b')][_0xd1d2('0x55')]+'%'};return _0x4e0e8c;})});}_0x1555de=_[_0xd1d2('0x56')]({},_0x1555de,_0x2e1fad[_0xd1d2('0x5a')]);return db[_0xd1d2('0x76')][_0xd1d2('0x72')]({'where':_0x1555de[_0xd1d2('0x53')]})['then'](function(_0x402a1d){_0xa6df47[_0xd1d2('0x72')]=_0x402a1d;if(_0x2e1fad[_0xd1d2('0x4b')]['includeAll']){_0x1555de[_0xd1d2('0x61')]=[{'all':!![]}];}return db[_0xd1d2('0x76')][_0xd1d2('0x5d')](_0x1555de);})[_0xd1d2('0x3a')](function(_0x546b9b){_0xa6df47[_0xd1d2('0x5e')]=_0x546b9b;return _0xa6df47;});}})[_0xd1d2('0x3a')](respondWithFilteredResult(_0x2606d7,_0x1555de))['catch'](handleError(_0x2606d7,null));};exports['removeAnswers']=function(_0x274738,_0x5ed0cd,_0x1046e3){return db[_0xd1d2('0x5b')]['find']({'where':{'id':_0x274738['params']['id']}})[_0xd1d2('0x3a')](handleEntityNotFound(_0x5ed0cd,null))['then'](function(_0x22c9b1){if(_0x22c9b1){return _0x22c9b1['removeAnswers'](_0x274738['query'][_0xd1d2('0x74')]);}})[_0xd1d2('0x3a')](respondWithStatusCode(_0x5ed0cd,null))[_0xd1d2('0x2c')](handleError(_0x5ed0cd,null));};exports[_0xd1d2('0x79')]=function(_0x31617c,_0x46a215,_0x548727){return db['WhatsappAccount'][_0xd1d2('0x62')]({'where':{'id':_0x31617c[_0xd1d2('0x6b')]['id']}})[_0xd1d2('0x3a')](handleEntityNotFound(_0x46a215,null))[_0xd1d2('0x3a')](function(_0x39ab07){if(_0x39ab07){return _0x39ab07[_0xd1d2('0x79')](_0x31617c[_0xd1d2('0x64')]['ids'],_[_0xd1d2('0x7a')](_0x31617c['body'],[_0xd1d2('0x74'),'id'])||{})[_0xd1d2('0x7b')](function(_0x53cef6){for(var _0x42989a=0x0;_0x42989a<_0x31617c[_0xd1d2('0x64')][_0xd1d2('0x74')][_0xd1d2('0x50')];_0x42989a+=0x1){socket[_0xd1d2('0x7c')](_0xd1d2('0x7d'),{'UserId':_0x31617c[_0xd1d2('0x64')][_0xd1d2('0x74')][_0x42989a],'WhatsappAccountId':_0x31617c[_0xd1d2('0x6b')]['id']});}return _0x53cef6;});}})[_0xd1d2('0x3a')](respondWithResult(_0x46a215,null))[_0xd1d2('0x2c')](handleError(_0x46a215,null));};exports[_0xd1d2('0x7e')]=function(_0x5aaef7,_0xae1ec5,_0x136a1f){return db[_0xd1d2('0x5b')][_0xd1d2('0x62')]({'where':{'id':_0x5aaef7[_0xd1d2('0x6b')]['id']}})[_0xd1d2('0x3a')](handleEntityNotFound(_0xae1ec5,null))[_0xd1d2('0x3a')](function(_0x3d069c){if(_0x3d069c){return _0x3d069c[_0xd1d2('0x7e')](_0x5aaef7[_0xd1d2('0x4b')][_0xd1d2('0x74')])[_0xd1d2('0x3a')](function(){if(_[_0xd1d2('0x7f')](_0x5aaef7[_0xd1d2('0x4b')][_0xd1d2('0x74')])){for(var _0x93ebcd=0x0;_0x93ebcd<_0x5aaef7['query'][_0xd1d2('0x74')]['length'];_0x93ebcd+=0x1){socket[_0xd1d2('0x7c')](_0xd1d2('0x80'),{'UserId':Number(_0x5aaef7[_0xd1d2('0x4b')][_0xd1d2('0x74')][_0x93ebcd]),'WhatsappAccountId':Number(_0x5aaef7[_0xd1d2('0x6b')]['id'])});}}else{socket[_0xd1d2('0x7c')](_0xd1d2('0x80'),{'UserId':Number(_0x5aaef7[_0xd1d2('0x4b')][_0xd1d2('0x74')]),'WhatsappAccountId':Number(_0x5aaef7['params']['id'])});}});}})['then'](respondWithStatusCode(_0xae1ec5,null))['catch'](handleError(_0xae1ec5,null));};exports[_0xd1d2('0x81')]=function(_0x419d69,_0x2fe1db,_0x4fcb85){var _0x524597={};var _0x3bc89={};var _0x28cdb0;var _0x3165f6;return db['WhatsappAccount'][_0xd1d2('0x70')]({'where':{'id':_0x419d69['params']['id']}})[_0xd1d2('0x3a')](handleEntityNotFound(_0x2fe1db,null))['then'](function(_0x125a70){if(_0x125a70){_0x28cdb0=_0x125a70;_0x3bc89[_0xd1d2('0x49')]=_[_0xd1d2('0x60')](db[_0xd1d2('0x82')][_0xd1d2('0x47')]);_0x3bc89['query']=_[_0xd1d2('0x60')](_0x419d69['query']);_0x3bc89['filters']=_[_0xd1d2('0x4e')](_0x3bc89[_0xd1d2('0x49')],_0x3bc89['query']);_0x524597['attributes']=_[_0xd1d2('0x4e')](_0x3bc89[_0xd1d2('0x49')],qs[_0xd1d2('0x4f')](_0x419d69['query']['fields']));_0x524597[_0xd1d2('0x4d')]=_0x524597[_0xd1d2('0x4d')][_0xd1d2('0x50')]?_0x524597[_0xd1d2('0x4d')]:_0x3bc89[_0xd1d2('0x49')];_0x524597[_0xd1d2('0x71')]=qs[_0xd1d2('0x52')](_0x419d69[_0xd1d2('0x4b')]['sort']);_0x524597[_0xd1d2('0x53')]=qs[_0xd1d2('0x4c')](_['pick'](_0x419d69[_0xd1d2('0x4b')],_0x3bc89[_0xd1d2('0x4c')]));if(_0x419d69[_0xd1d2('0x4b')][_0xd1d2('0x55')]){_0x524597['where']=_[_0xd1d2('0x56')](_0x524597['where'],{'$or':_[_0xd1d2('0x4a')](_0x524597[_0xd1d2('0x4d')],function(_0x50d856){var _0x39cddb={};_0x39cddb[_0x50d856]={'$like':'%'+_0x419d69[_0xd1d2('0x4b')]['filter']+'%'};return _0x39cddb;})});}_0x524597=_[_0xd1d2('0x56')]({},_0x524597,_0x419d69['options']);return _0x28cdb0[_0xd1d2('0x81')](_0x524597);}})[_0xd1d2('0x3a')](function(_0x51bcdb){if(_0x51bcdb){_0x3165f6=_0x51bcdb[_0xd1d2('0x50')];if(!_0x419d69[_0xd1d2('0x4b')][_0xd1d2('0x78')](_0xd1d2('0x51'))){_0x524597['limit']=qs['limit'](_0x419d69['query']['limit']);_0x524597[_0xd1d2('0x30')]=qs[_0xd1d2('0x30')](_0x419d69[_0xd1d2('0x4b')][_0xd1d2('0x30')]);}return _0x28cdb0['getAgents'](_0x524597);}})[_0xd1d2('0x3a')](function(_0x52d7a6){if(_0x52d7a6){return _0x52d7a6?{'count':_0x3165f6,'rows':_0x52d7a6}:null;}})[_0xd1d2('0x3a')](respondWithResult(_0x2fe1db,null))[_0xd1d2('0x2c')](handleError(_0x2fe1db,null));};exports[_0xd1d2('0x83')]=function(_0x297432,_0x8157e4,_0x58889d){return db[_0xd1d2('0x5b')]['findOne']({'where':{'id':_0x297432['params']['id']}})[_0xd1d2('0x3a')](handleEntityNotFound(_0x8157e4,null))['then'](function(_0x4ef02c){if(_0x4ef02c){return db['sequelize'][_0xd1d2('0x84')](function(_0x5ba582){return db['WhatsappApplication'][_0xd1d2('0x3d')]({'where':{'WhatsappAccountId':_0x297432[_0xd1d2('0x6b')]['id']},'transaction':_0x5ba582})[_0xd1d2('0x3a')](function(_0x44c2fd){var _0x30348e=_[_0xd1d2('0x4a')](_0x297432['body'],function(_0x5bb661){_0x5bb661[_0xd1d2('0x6e')]=_0x297432[_0xd1d2('0x6b')]['id'];return _0x5bb661;});return db[_0xd1d2('0x85')][_0xd1d2('0x86')](_0x30348e,{'transaction':_0x5ba582});});})[_0xd1d2('0x3a')](function(){return db[_0xd1d2('0x85')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x297432[_0xd1d2('0x6b')]['id']},'order':'priority'});});}})[_0xd1d2('0x3a')](respondWithResult(_0x8157e4,null))[_0xd1d2('0x2c')](handleError(_0x8157e4,null));};exports[_0xd1d2('0x87')]=function(_0x31a577,_0x247da8,_0x54a676){var _0x10face={};var _0xfed6c7={};var _0x58eb30;var _0x16ba2c;return db[_0xd1d2('0x5b')][_0xd1d2('0x70')]({'where':{'id':_0x31a577[_0xd1d2('0x6b')]['id']}})[_0xd1d2('0x3a')](handleEntityNotFound(_0x247da8,null))[_0xd1d2('0x3a')](function(_0x52e4ad){if(_0x52e4ad){_0x58eb30=_0x52e4ad;_0xfed6c7[_0xd1d2('0x49')]=_[_0xd1d2('0x60')](db[_0xd1d2('0x85')]['rawAttributes']);_0xfed6c7[_0xd1d2('0x4b')]=_[_0xd1d2('0x60')](_0x31a577[_0xd1d2('0x4b')]);_0xfed6c7[_0xd1d2('0x4c')]=_[_0xd1d2('0x4e')](_0xfed6c7['model'],_0xfed6c7[_0xd1d2('0x4b')]);_0x10face[_0xd1d2('0x4d')]=_[_0xd1d2('0x4e')](_0xfed6c7['model'],qs[_0xd1d2('0x4f')](_0x31a577['query'][_0xd1d2('0x4f')]));_0x10face[_0xd1d2('0x4d')]=_0x10face[_0xd1d2('0x4d')][_0xd1d2('0x50')]?_0x10face[_0xd1d2('0x4d')]:_0xfed6c7[_0xd1d2('0x49')];_0x10face[_0xd1d2('0x71')]=qs[_0xd1d2('0x52')](_0x31a577['query'][_0xd1d2('0x52')]);_0x10face[_0xd1d2('0x53')]=qs['filters'](_['pick'](_0x31a577['query'],_0xfed6c7[_0xd1d2('0x4c')]));if(_0x31a577[_0xd1d2('0x4b')]['filter']){_0x10face[_0xd1d2('0x53')]=_[_0xd1d2('0x56')](_0x10face['where'],{'$or':_[_0xd1d2('0x4a')](_0x10face[_0xd1d2('0x4d')],function(_0x50a446){var _0xc1d2d8={};_0xc1d2d8[_0x50a446]={'$like':'%'+_0x31a577['query']['filter']+'%'};return _0xc1d2d8;})});}_0x10face=_[_0xd1d2('0x56')]({},_0x10face,_0x31a577[_0xd1d2('0x5a')]);return _0x58eb30[_0xd1d2('0x87')](_0x10face);}})[_0xd1d2('0x3a')](function(_0x9fe5b4){if(_0x9fe5b4){_0x16ba2c=_0x9fe5b4[_0xd1d2('0x50')];if(!_0x31a577[_0xd1d2('0x4b')][_0xd1d2('0x78')](_0xd1d2('0x51'))){_0x10face[_0xd1d2('0x31')]=qs[_0xd1d2('0x31')](_0x31a577[_0xd1d2('0x4b')][_0xd1d2('0x31')]);_0x10face[_0xd1d2('0x30')]=qs['offset'](_0x31a577[_0xd1d2('0x4b')][_0xd1d2('0x30')]);}return _0x58eb30[_0xd1d2('0x87')](_0x10face);}})[_0xd1d2('0x3a')](function(_0x30e8ad){if(_0x30e8ad){return _0x30e8ad?{'count':_0x16ba2c,'rows':_0x30e8ad}:null;}})[_0xd1d2('0x3a')](respondWithResult(_0x247da8,null))['catch'](handleError(_0x247da8,null));};exports[_0xd1d2('0x88')]=function(_0x261142,_0x1b0b17,_0x15374e){var _0x441ea1={'channel':_0xd1d2('0x89')};var _0x3b361d=[];var _0x11594d=[];var _0x69ca9b={};return db['WhatsappAccount']['find']({'where':{'id':_0x261142[_0xd1d2('0x6b')]['id']},'include':[{'model':db[_0xd1d2('0x85')],'as':'Applications'}]})[_0xd1d2('0x3a')](handleEntityNotFound(_0x1b0b17,null))[_0xd1d2('0x3a')](function(_0x1d381d){_0x441ea1[_0xd1d2('0x43')]=_0x1d381d;_0x441ea1['applications']=_[_0xd1d2('0x8a')](_0x1d381d[_0xd1d2('0x8b')],[_0xd1d2('0x8c')],['asc']);if(_0x441ea1[_0xd1d2('0x43')]['Applications']){delete _0x441ea1[_0xd1d2('0x43')][_0xd1d2('0x8b')];}return db[_0xd1d2('0x8d')][_0xd1d2('0x6c')]();})['then'](function(_0x3b3eff){if(!_0x3b3eff){throw new db[(_0xd1d2('0x8e'))]['ValidationError'](_0xd1d2('0x8f'));}_0x3b361d=_[_0xd1d2('0x90')](_['keys'](_0x3b3eff),[_0xd1d2('0x91'),'updatedAt']);_0x11594d=_[_0xd1d2('0x90')](_['keys'](_0x3b3eff),['createdAt',_0xd1d2('0x92'),_0xd1d2('0x93'),'ListId']);_0x441ea1[_0xd1d2('0x64')]={'mapKey':'mobile'};if(_0x441ea1['account']['type']&&_0x441ea1[_0xd1d2('0x43')][_0xd1d2('0x57')]===_0xd1d2('0x94')){_0x441ea1['body'][_0xd1d2('0x95')]=_0x261142['body'][_0xd1d2('0x96')][_0xd1d2('0x97')](_0xd1d2('0x98'),'');_0x441ea1['body'][_0xd1d2('0x64')]=_0x261142[_0xd1d2('0x64')][_0xd1d2('0x99')];_0x441ea1[_0xd1d2('0x64')][_0xd1d2('0x9a')]=_0x261142[_0xd1d2('0x64')]['MessageSid'];}if(_0x441ea1[_0xd1d2('0x64')]['id']){delete _0x441ea1[_0xd1d2('0x64')]['id'];}if(_[_0xd1d2('0x9b')](_0x441ea1[_0xd1d2('0x64')]['from'])){throw new db[(_0xd1d2('0x8e'))][(_0xd1d2('0x9c'))](_0xd1d2('0x9d'));}if(_[_0xd1d2('0x9b')](_0x441ea1[_0xd1d2('0x64')][_0xd1d2('0x64')])||_0x441ea1[_0xd1d2('0x64')]['body']===''){throw new db[(_0xd1d2('0x8e'))][(_0xd1d2('0x9c'))](_0xd1d2('0x9e'));}if(_[_0xd1d2('0x9b')](_0x441ea1['body'][_0xd1d2('0x9f')])){throw new db['Sequelize'][(_0xd1d2('0x9c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11594d);}if(!_['includes'](_0x11594d,_0x441ea1['body'][_0xd1d2('0x9f')])){throw new db['Sequelize'][(_0xd1d2('0x9c'))](_0xd1d2('0xa0')+_0x11594d);}_0x69ca9b[_0x441ea1[_0xd1d2('0x64')][_0xd1d2('0x9f')]]=_0x441ea1[_0xd1d2('0x64')][_0xd1d2('0x95')];return db['CmList'][_0xd1d2('0x62')]({'where':{'id':_0x441ea1[_0xd1d2('0x43')][_0xd1d2('0xa1')]},'include':[{'model':db['CmContact'],'as':_0xd1d2('0xa2'),'where':_0x69ca9b,'limit':0x1,'order':[[_0xd1d2('0x92'),_0xd1d2('0xa3')]]}]});})[_0xd1d2('0x3a')](handleEntityNotFound(_0x1b0b17,null))[_0xd1d2('0x3a')](function(_0xb5ea4a){if(_0xb5ea4a){_0x441ea1[_0xd1d2('0xa4')]=_['omit'](_0xb5ea4a,[_0xd1d2('0xa2')]);if(_0xb5ea4a[_0xd1d2('0xa2')]['length']){return _0xb5ea4a[_0xd1d2('0xa2')][0x0];}var _0x2a3e85=_[_0xd1d2('0x1c')](_0x441ea1[_0xd1d2('0x64')],{'firstName':_0x441ea1[_0xd1d2('0x64')][_0xd1d2('0x95')],'ListId':_0xb5ea4a['id']});_0x2a3e85[_0x441ea1[_0xd1d2('0x64')][_0xd1d2('0x9f')]]=_0x441ea1[_0xd1d2('0x64')][_0xd1d2('0x95')];return db['CmContact']['create'](_0x2a3e85,{'fields':_0x3b361d,'raw':!![]});}})[_0xd1d2('0x3a')](handleEntityNotFound(_0x1b0b17,null))[_0xd1d2('0x3a')](function(_0x1cf2c9){if(_0x1cf2c9){_0x441ea1[_0xd1d2('0x40')]=_0x1cf2c9;var _0x477966={'ContactId':_0x1cf2c9['id'],'phone':_0x441ea1[_0xd1d2('0x64')][_0xd1d2('0x95')],'WhatsappAccountId':_0x261142[_0xd1d2('0x6b')]['id']};var _0x55f93f={'ContactId':_0x1cf2c9['id'],'WhatsappAccountId':_0x261142['params']['id'],'closed':![]};return db[_0xd1d2('0xa5')]['find']({'where':_0x55f93f})[_0xd1d2('0x3a')](function(_0x5527aa){if(_0x5527aa){return[_0x5527aa,![]];}return db[_0xd1d2('0xa5')][_0xd1d2('0x63')](_0x477966)['then'](function(_0x139bc8){return[_0x139bc8,!![]];});});}})['spread'](function(_0x29a111,_0x402311){_0x441ea1[_0xd1d2('0x42')]=_0x29a111[_0xd1d2('0x66')]({'plain':!![]});_0x441ea1[_0xd1d2('0x42')]['created']=![];if(_0x402311){if(_0x441ea1[_0xd1d2('0x43')][_0xd1d2('0xa6')]){_0x441ea1['applications'][_0xd1d2('0xa7')]({'id':0x0,'priority':_0x441ea1[_0xd1d2('0xa8')]['length']+0x1,'app':'close','appdata':_0xd1d2('0xa9'),'interval':_0xd1d2('0xaa')});}_0x441ea1['interaction'][_0xd1d2('0xab')]=!![];}return db[_0xd1d2('0xac')][_0xd1d2('0x63')]({'phone':_0x441ea1[_0xd1d2('0x64')][_0xd1d2('0x95')],'messageId':_0x441ea1[_0xd1d2('0x64')][_0xd1d2('0x9a')],'body':_0x441ea1['body']['body'],'WhatsappAccountId':_0x261142[_0xd1d2('0x6b')]['id'],'WhatsappInteractionId':_0x29a111['id'],'direction':'in','ContactId':_0x29a111[_0xd1d2('0xad')],'AttachmentId':_0x441ea1[_0xd1d2('0x64')][_0xd1d2('0xae')]});})['then'](function(_0x39b625){_0x441ea1['message']=_0x39b625;if(_0x441ea1[_0xd1d2('0x42')][_0xd1d2('0xaf')]){return db[_0xd1d2('0x82')][_0xd1d2('0x62')]({'attributes':['id',_0xd1d2('0x59')],'where':{'id':_0x441ea1['interaction'][_0xd1d2('0xaf')]}})[_0xd1d2('0x3a')](function(_0x3be13c){if(_0x3be13c){_0x441ea1[_0xd1d2('0xa8')][_0xd1d2('0xb0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3be13c[_0xd1d2('0x59')]+','+(_0x441ea1[_0xd1d2('0x43')][_0xd1d2('0xb1')]||0xa),'interval':_0xd1d2('0xaa')});}return respondWithRpcPromise(_0xd1d2('0xb2'),_0xd1d2('0xb3'),_0x441ea1);});}return respondWithRpcPromise('Start','startRouting',_0x441ea1);})[_0xd1d2('0x3a')](function(_0xe37f45){if(_0xe37f45){var _0x36dae7=0xc8;var _0x2780bf=_0xd1d2('0xb4');logger['info'](_0xd1d2('0x27'),_0x2780bf,_0x36dae7,_0xd1d2('0xb5'));logger[_0xd1d2('0x26')](_0xd1d2('0xb6'),_0x2780bf,_0x36dae7,_0xd1d2('0xb5'),JSON[_0xd1d2('0xb7')](_0xe37f45));if(_0x441ea1[_0xd1d2('0x43')][_0xd1d2('0x57')]===_0xd1d2('0x94')){return _0x1b0b17[_0xd1d2('0x2e')](_0x36dae7)[_0xd1d2('0x33')]('Content-Type','text/xml')[_0xd1d2('0x3f')](_0xd1d2('0xb8'));}else{return _0x1b0b17['status'](_0x36dae7)[_0xd1d2('0x35')](_0xe37f45);}}})[_0xd1d2('0x2c')](handleError(_0x1b0b17,null));};exports[_0xd1d2('0x3f')]=function(_0x3ca7b3,_0x1e9787,_0x3ab160){var _0x109976,_0xa6b2d8,_0x5e412b;if(_[_0xd1d2('0x9b')](_0x3ca7b3[_0xd1d2('0x64')]['body'])||_0x3ca7b3[_0xd1d2('0x64')]['body']===''){throw new db[(_0xd1d2('0x8e'))][(_0xd1d2('0x9c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd1d2('0x9b')](_0x3ca7b3[_0xd1d2('0x64')]['to'])){throw new db[(_0xd1d2('0x8e'))][(_0xd1d2('0x9c'))](_0xd1d2('0xb9'));}_0x109976=_0x3ca7b3[_0xd1d2('0x64')]['to'];return db['WhatsappAccount'][_0xd1d2('0x62')]({'where':{'id':_0x3ca7b3[_0xd1d2('0x6b')]['id']},'include':[{'model':db['CmList'],'as':_0xd1d2('0xba'),'include':[{'model':db[_0xd1d2('0x8d')],'as':_0xd1d2('0xa2'),'where':{'mobile':_0x109976},'limit':0x1,'order':[['updatedAt',_0xd1d2('0xa3')]]}]}]})[_0xd1d2('0x3a')](handleEntityNotFound(_0x1e9787,null))[_0xd1d2('0x3a')](function(_0x4354f8){if(_0x4354f8&&_0x4354f8['List']){_0xa6b2d8=_0x4354f8[_0xd1d2('0x66')]({'plain':!![]});if(_0xa6b2d8[_0xd1d2('0xba')]&&_0xa6b2d8['List'][_0xd1d2('0xa2')][_0xd1d2('0x50')]){return _0xa6b2d8[_0xd1d2('0xba')]['Contacts'][0x0];}return db['CmContact'][_0xd1d2('0x63')](_[_0xd1d2('0x1c')](_0x3ca7b3[_0xd1d2('0x64')],{'firstName':_0x109976,'mobile':_0x109976,'phone':_0x109976,'ListId':_0xa6b2d8[_0xd1d2('0xa1')]}));}})[_0xd1d2('0x3a')](handleEntityNotFound(_0x1e9787,null))[_0xd1d2('0x3a')](function(_0x1c3954){if(_0x1c3954){_0x5e412b=_0x1c3954;return db[_0xd1d2('0xa5')][_0xd1d2('0x62')]({'where':{'ContactId':_0x5e412b['id'],'closed':![],'WhatsappAccountId':_0xa6b2d8['id']}})[_0xd1d2('0x3a')](function(_0x56f49d){if(_0x56f49d){return[_0x56f49d,![]];}return db[_0xd1d2('0xa5')][_0xd1d2('0x63')]({'UserId':_0x3ca7b3[_0xd1d2('0x65')]['id'],'ContactId':_0x5e412b['id'],'WhatsappAccountId':_0xa6b2d8['id'],'phone':_0x109976,'firstMsgDirection':'out','Messages':[_['merge'](_0x3ca7b3[_0xd1d2('0x64')],{'read':![],'body':_0x3ca7b3[_0xd1d2('0x64')][_0xd1d2('0x64')],'phone':_0x109976,'WhatsappAccountId':_0xa6b2d8['id'],'UserId':_0x3ca7b3[_0xd1d2('0x65')]['id'],'ContactId':_0x5e412b['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0xd1d2('0x3a')](function(_0x512b27){return[_0x512b27,!![]];});});}})[_0xd1d2('0x7b')](function(_0x454ca5,_0x28e680){if(_0x28e680){return _0x454ca5;}return db[_0xd1d2('0xac')][_0xd1d2('0x63')](_['merge'](_0x3ca7b3[_0xd1d2('0x64')],{'read':![],'body':_0x3ca7b3[_0xd1d2('0x64')][_0xd1d2('0x64')],'phone':_0x109976,'WhatsappAccountId':_0xa6b2d8['id'],'WhatsappInteractionId':_0x454ca5['id'],'UserId':_0x3ca7b3[_0xd1d2('0x65')]['id'],'ContactId':_0x5e412b['id']}))[_0xd1d2('0x3a')](function(_0x515121){_0x454ca5[_0xd1d2('0xbb')][_0xd1d2('0xbc')]=[];_0x454ca5[_0xd1d2('0xbb')][_0xd1d2('0xbc')][_0xd1d2('0xa7')](_0x515121[_0xd1d2('0xbb')]);return _0x454ca5;});})[_0xd1d2('0x3a')](respondWithResult(_0x1e9787,null))[_0xd1d2('0x2c')](handleError(_0x1e9787,null));}; \ No newline at end of file +var _0xc79f=['destroy','stack','name','send','render','merge','contact','agent','account','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','includeAll','findAll','rows','show','params','keys','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','order','WhatsappAccountId','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','hasOwnProperty','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','transaction','WhatsappApplication','bulkCreate','priority','getApplications','whatsapp','Applications','applications','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','mobile','from','From','replace','Body','MessageSid','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','WhatsappMessage','messageId','AttachmentId','UserId','unshift','*,*,*,*','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','set','Content-Type','text/xml','\x0a','List','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','jayson/promise','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','UserProfileResource'];(function(_0x5ed54f,_0x104679){var _0x4b2023=function(_0x5a570c){while(--_0x5a570c){_0x5ed54f['push'](_0x5ed54f['shift']());}};_0x4b2023(++_0x104679);}(_0xc79f,0x82));var _0xfc79=function(_0x2bf635,_0x454fe4){_0x2bf635=_0x2bf635-0x0;var _0xfed6a=_0xc79f[_0x2bf635];return _0xfed6a;};'use strict';var emlformat=require(_0xfc79('0x0'));var rimraf=require(_0xfc79('0x1'));var zipdir=require(_0xfc79('0x2'));var jsonpatch=require(_0xfc79('0x3'));var rp=require(_0xfc79('0x4'));var moment=require('moment');var BPromise=require(_0xfc79('0x5'));var Mustache=require(_0xfc79('0x6'));var util=require(_0xfc79('0x7'));var path=require(_0xfc79('0x8'));var sox=require(_0xfc79('0x9'));var csv=require(_0xfc79('0xa'));var ejs=require(_0xfc79('0xb'));var fs=require('fs');var fs_extra=require(_0xfc79('0xc'));var _=require(_0xfc79('0xd'));var squel=require('squel');var crypto=require(_0xfc79('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfc79('0xf'));var toCsv=require(_0xfc79('0xa'));var querystring=require(_0xfc79('0x10'));var Papa=require('papaparse');var Redis=require(_0xfc79('0x11'));var authService=require(_0xfc79('0x12'));var qs=require(_0xfc79('0x13'));var as=require(_0xfc79('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc79('0x15'))(_0xfc79('0x16'));var utils=require(_0xfc79('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfc79('0x18'));var db=require(_0xfc79('0x19'))['db'];config['redis']=_[_0xfc79('0x1a')](config['redis'],{'host':_0xfc79('0x1b'),'port':0x18eb});var socket=require(_0xfc79('0x1c'))(new Redis(config[_0xfc79('0x1d')]));require('./whatsappAccount.socket')[_0xfc79('0x1e')](socket);var jayson=require(_0xfc79('0x1f'));var client=jayson[_0xfc79('0x20')][_0xfc79('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x895b17,_0x7ef734,_0x4cb052,_0x228dab){return new BPromise(function(_0x4625da,_0x44e29e){var _0x322972=_0x228dab||client;return _0x322972['request'](_0x895b17,_0x4cb052)[_0xfc79('0x22')](function(_0x2eebdc){logger[_0xfc79('0x23')](_0xfc79('0x24'),_0x7ef734,'request\x20sent');logger['debug'](_0xfc79('0x25'),_0x7ef734,'request\x20sent',JSON[_0xfc79('0x26')](_0x2eebdc));if(_0x2eebdc[_0xfc79('0x27')]){if(_0x2eebdc[_0xfc79('0x27')][_0xfc79('0x28')]===0x1f4){logger['error'](_0xfc79('0x24'),_0x7ef734,_0x2eebdc[_0xfc79('0x27')][_0xfc79('0x29')]);return _0x44e29e(_0x2eebdc[_0xfc79('0x27')][_0xfc79('0x29')]);}logger[_0xfc79('0x27')](_0xfc79('0x24'),_0x7ef734,_0x2eebdc['error'][_0xfc79('0x29')]);return _0x4625da(_0x2eebdc[_0xfc79('0x27')][_0xfc79('0x29')]);}else{logger[_0xfc79('0x23')](_0xfc79('0x24'),_0x7ef734,'request\x20sent');_0x4625da(_0x2eebdc['result']['message']);}})[_0xfc79('0x2a')](function(_0x3dc4e4){logger[_0xfc79('0x27')](_0xfc79('0x24'),_0x7ef734,_0x3dc4e4);_0x44e29e(_0x3dc4e4);});});}function respondWithStatusCode(_0x5dcf36,_0x1c152){_0x1c152=_0x1c152||0xcc;return function(_0x5ca265){if(_0x5ca265){return _0x5dcf36[_0xfc79('0x2b')](_0x1c152);}return _0x5dcf36['status'](_0x1c152)[_0xfc79('0x2c')]();};}function respondWithResult(_0x3206fb,_0x96ceeb){_0x96ceeb=_0x96ceeb||0xc8;return function(_0x523270){if(_0x523270){return _0x3206fb[_0xfc79('0x2d')](_0x96ceeb)[_0xfc79('0x2e')](_0x523270);}};}function respondWithFilteredResult(_0x168ec2,_0x3a8ca3){return function(_0x2ae979){if(_0x2ae979){var _0x158b2f=typeof _0x3a8ca3[_0xfc79('0x2f')]==='undefined'&&typeof _0x3a8ca3[_0xfc79('0x30')]===_0xfc79('0x31');var _0x333af1=_0x2ae979[_0xfc79('0x32')];var _0x52212b=_0x158b2f?0x0:_0x3a8ca3[_0xfc79('0x2f')];var _0x106f1a=_0x158b2f?_0x2ae979[_0xfc79('0x32')]:_0x3a8ca3[_0xfc79('0x2f')]+_0x3a8ca3[_0xfc79('0x30')];var _0x4715d8;if(_0x106f1a>=_0x333af1){_0x106f1a=_0x333af1;_0x4715d8=0xc8;}else{_0x4715d8=0xce;}_0x168ec2['status'](_0x4715d8);return _0x168ec2['set'](_0xfc79('0x33'),_0x52212b+'-'+_0x106f1a+'/'+_0x333af1)['json'](_0x2ae979);}return null;};}function patchUpdates(_0x137420){return function(_0x324b52){try{jsonpatch[_0xfc79('0x34')](_0x324b52,_0x137420,!![]);}catch(_0x23a827){return BPromise[_0xfc79('0x35')](_0x23a827);}return _0x324b52[_0xfc79('0x36')]();};}function saveUpdates(_0x284a7e,_0x384271){return function(_0x22b206){if(_0x22b206){return _0x22b206['update'](_0x284a7e)[_0xfc79('0x22')](function(_0x43a26d){return _0x43a26d;});}return null;};}function removeEntity(_0x36c224,_0x2aac80){return function(_0x19eb4c){if(_0x19eb4c){return _0x19eb4c['destroy']()[_0xfc79('0x22')](function(){var _0x25deb8=_0x19eb4c['get']({'plain':!![]});var _0x4f7df6='WhatsappAccounts';return db[_0xfc79('0x37')][_0xfc79('0x38')]({'where':{'type':_0x4f7df6,'resourceId':_0x25deb8['id']}})[_0xfc79('0x22')](function(){return _0x19eb4c;});})[_0xfc79('0x22')](function(){_0x36c224[_0xfc79('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2126f9,_0x2ef7f5){return function(_0x274edc){if(!_0x274edc){_0x2126f9['sendStatus'](0x194);}return _0x274edc;};}function handleError(_0xa101a1,_0x26632a){_0x26632a=_0x26632a||0x1f4;return function(_0x5acace){logger['error'](_0x5acace[_0xfc79('0x39')]);if(_0x5acace[_0xfc79('0x3a')]){delete _0x5acace[_0xfc79('0x3a')];}_0xa101a1[_0xfc79('0x2d')](_0x26632a)[_0xfc79('0x3b')](_0x5acace);};}function getMustacheRender(_0x2abb2a,_0x812fb5){return Mustache[_0xfc79('0x3c')](_0x2abb2a,_[_0xfc79('0x3d')](_0x812fb5['body'],{'contact':_0x812fb5[_0xfc79('0x3e')],'message':_0x812fb5[_0xfc79('0x29')],'agent':_0x812fb5[_0xfc79('0x3f')],'interaction':_0x812fb5['interaction'],'account':_0x812fb5[_0xfc79('0x40')]}))||'';}exports['index']=function(_0x1ae4e2,_0x36cb81){var _0x71dc7d={'include':[{'model':db[_0xfc79('0x41')],'as':_0xfc79('0x42')}]},_0x17d970={},_0x20f6ac={'count':0x0,'rows':[]};var _0x3022a7=_[_0xfc79('0x43')](db[_0xfc79('0x44')][_0xfc79('0x45')],function(_0xda4714){return{'name':_0xda4714[_0xfc79('0x46')],'type':_0xda4714[_0xfc79('0x47')][_0xfc79('0x48')]};});_0x17d970[_0xfc79('0x49')]=_[_0xfc79('0x43')](_0x3022a7,'name');_0x17d970[_0xfc79('0x4a')]=_['keys'](_0x1ae4e2[_0xfc79('0x4a')]);_0x17d970[_0xfc79('0x4b')]=_[_0xfc79('0x4c')](_0x17d970[_0xfc79('0x49')],_0x17d970[_0xfc79('0x4a')]);_0x71dc7d[_0xfc79('0x4d')]=_[_0xfc79('0x4c')](_0x17d970[_0xfc79('0x49')],qs[_0xfc79('0x4e')](_0x1ae4e2[_0xfc79('0x4a')][_0xfc79('0x4e')]));_0x71dc7d['attributes']=_0x71dc7d['attributes'][_0xfc79('0x4f')]?_0x71dc7d['attributes']:_0x17d970[_0xfc79('0x49')];if(!_0x1ae4e2['query']['hasOwnProperty'](_0xfc79('0x50'))){_0x71dc7d['limit']=qs[_0xfc79('0x30')](_0x1ae4e2[_0xfc79('0x4a')][_0xfc79('0x30')]);_0x71dc7d[_0xfc79('0x2f')]=qs['offset'](_0x1ae4e2[_0xfc79('0x4a')][_0xfc79('0x2f')]);}_0x71dc7d['order']=qs[_0xfc79('0x51')](_0x1ae4e2[_0xfc79('0x4a')][_0xfc79('0x51')]);_0x71dc7d[_0xfc79('0x52')]=qs[_0xfc79('0x4b')](_[_0xfc79('0x53')](_0x1ae4e2[_0xfc79('0x4a')],_0x17d970[_0xfc79('0x4b')]),_0x3022a7);if(_0x1ae4e2[_0xfc79('0x4a')][_0xfc79('0x54')]){_0x71dc7d['where']=_['merge'](_0x71dc7d['where'],{'$or':_[_0xfc79('0x43')](_0x3022a7,function(_0x2002d4){if(_0x2002d4['type']!=='VIRTUAL'){var _0x2c3b32={};_0x2c3b32[_0x2002d4[_0xfc79('0x3a')]]={'$like':'%'+_0x1ae4e2[_0xfc79('0x4a')][_0xfc79('0x54')]+'%'};return _0x2c3b32;}})});}_0x71dc7d=_[_0xfc79('0x3d')]({},_0x71dc7d,_0x1ae4e2['options']);var _0x3148e5={'where':_0x71dc7d[_0xfc79('0x52')]};return db['WhatsappAccount'][_0xfc79('0x32')](_0x3148e5)['then'](function(_0x2cada8){_0x20f6ac[_0xfc79('0x32')]=_0x2cada8;if(_0x1ae4e2[_0xfc79('0x4a')][_0xfc79('0x55')]){_0x71dc7d['include']=[{'all':!![]}];}return db[_0xfc79('0x44')][_0xfc79('0x56')](_0x71dc7d);})[_0xfc79('0x22')](function(_0x44804b){_0x20f6ac[_0xfc79('0x57')]=_0x44804b;return _0x20f6ac;})['then'](respondWithFilteredResult(_0x36cb81,_0x71dc7d))[_0xfc79('0x2a')](handleError(_0x36cb81,null));};exports[_0xfc79('0x58')]=function(_0x4eceb2,_0x249705){var _0x42898b={'raw':![],'where':{'id':_0x4eceb2[_0xfc79('0x59')]['id']},'include':[{'model':db[_0xfc79('0x41')],'as':_0xfc79('0x42')}]},_0x4363ec={};_0x4363ec[_0xfc79('0x49')]=_['keys'](db['WhatsappAccount'][_0xfc79('0x45')]);_0x4363ec[_0xfc79('0x4a')]=_[_0xfc79('0x5a')](_0x4eceb2[_0xfc79('0x4a')]);_0x4363ec['filters']=_[_0xfc79('0x4c')](_0x4363ec[_0xfc79('0x49')],_0x4363ec[_0xfc79('0x4a')]);_0x42898b[_0xfc79('0x4d')]=_['intersection'](_0x4363ec[_0xfc79('0x49')],qs[_0xfc79('0x4e')](_0x4eceb2[_0xfc79('0x4a')][_0xfc79('0x4e')]));_0x42898b[_0xfc79('0x4d')]=_0x42898b[_0xfc79('0x4d')][_0xfc79('0x4f')]?_0x42898b[_0xfc79('0x4d')]:_0x4363ec['model'];if(_0x4eceb2[_0xfc79('0x4a')][_0xfc79('0x55')]){_0x42898b[_0xfc79('0x5b')]=[{'all':!![]}];}_0x42898b=_['merge']({},_0x42898b,_0x4eceb2['options']);return db[_0xfc79('0x44')][_0xfc79('0x5c')](_0x42898b)['then'](handleEntityNotFound(_0x249705,null))[_0xfc79('0x22')](respondWithResult(_0x249705,null))[_0xfc79('0x2a')](handleError(_0x249705,null));};exports['create']=function(_0x4885d4,_0x20dea4){return db['WhatsappAccount'][_0xfc79('0x5d')](_0x4885d4['body'],{})[_0xfc79('0x22')](function(_0x1ff468){var _0x171cf8=_0x4885d4[_0xfc79('0x5e')][_0xfc79('0x5f')]({'plain':!![]});if(!_0x171cf8)throw new Error(_0xfc79('0x60'));if(_0x171cf8['role']==='user'){var _0x42ed31=_0x1ff468['get']({'plain':!![]});var _0x1644be=_0xfc79('0x61');return db[_0xfc79('0x62')]['find']({'where':{'name':_0x1644be,'userProfileId':_0x171cf8[_0xfc79('0x63')]},'raw':!![]})[_0xfc79('0x22')](function(_0x2b1b25){if(_0x2b1b25&&_0x2b1b25[_0xfc79('0x64')]===0x0){return db[_0xfc79('0x37')][_0xfc79('0x5d')]({'name':_0x42ed31[_0xfc79('0x3a')],'resourceId':_0x42ed31['id'],'type':_0x2b1b25[_0xfc79('0x3a')],'sectionId':_0x2b1b25['id']},{})[_0xfc79('0x22')](function(){return _0x1ff468;});}else{return _0x1ff468;}})['catch'](function(_0x4b1667){logger[_0xfc79('0x27')](_0xfc79('0x65'),_0x4b1667);throw _0x4b1667;});}return _0x1ff468;})[_0xfc79('0x22')](respondWithResult(_0x20dea4,0xc9))[_0xfc79('0x2a')](handleError(_0x20dea4,null));};exports['update']=function(_0x173460,_0x4035b6){if(_0x173460[_0xfc79('0x66')]['id']){delete _0x173460[_0xfc79('0x66')]['id'];}return db[_0xfc79('0x44')][_0xfc79('0x5c')]({'where':{'id':_0x173460[_0xfc79('0x59')]['id']},'include':[{'model':db[_0xfc79('0x41')],'as':_0xfc79('0x42')}]})[_0xfc79('0x22')](handleEntityNotFound(_0x4035b6,null))[_0xfc79('0x22')](saveUpdates(_0x173460['body'],null))[_0xfc79('0x22')](respondWithResult(_0x4035b6,null))[_0xfc79('0x2a')](handleError(_0x4035b6,null));};exports[_0xfc79('0x38')]=function(_0xf894e,_0xd05ed3){return db['WhatsappAccount'][_0xfc79('0x5c')]({'where':{'id':_0xf894e['params']['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0xd05ed3,null))[_0xfc79('0x22')](removeEntity(_0xd05ed3,null))[_0xfc79('0x2a')](handleError(_0xd05ed3,null));};exports[_0xfc79('0x67')]=function(_0x8849cd,_0x316640){return db[_0xfc79('0x44')][_0xfc79('0x67')]()[_0xfc79('0x22')](respondWithResult(_0x316640,null))[_0xfc79('0x2a')](handleError(_0x316640,null));};exports[_0xfc79('0x68')]=function(_0x4e04e4,_0x362273,_0x59c330){if(_0x4e04e4[_0xfc79('0x66')]['id']){delete _0x4e04e4['body']['id'];}return db[_0xfc79('0x44')][_0xfc79('0x5c')]({'where':{'id':_0x4e04e4[_0xfc79('0x59')]['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0x362273,null))[_0xfc79('0x22')](function(_0x1883f5){if(_0x1883f5){_0x4e04e4[_0xfc79('0x66')]['WhatsappAccountId']=_0x1883f5['id'];return db[_0xfc79('0x69')][_0xfc79('0x5d')](_0x4e04e4['body']);}})['then'](respondWithResult(_0x362273,null))['catch'](handleError(_0x362273,null));};exports[_0xfc79('0x6a')]=function(_0x30f193,_0x20d5ac,_0x4d545c){var _0xdf008b={'raw':![],'where':{}};var _0x535854={};var _0x470650={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x30f193[_0xfc79('0x59')]['id']}})['then'](handleEntityNotFound(_0x20d5ac,null))['then'](function(_0x460a7d){if(_0x460a7d){_0x535854[_0xfc79('0x49')]=_[_0xfc79('0x5a')](db[_0xfc79('0x69')]['rawAttributes']);_0x535854[_0xfc79('0x4a')]=_[_0xfc79('0x5a')](_0x30f193[_0xfc79('0x4a')]);_0x535854[_0xfc79('0x4b')]=_[_0xfc79('0x4c')](_0x535854[_0xfc79('0x49')],_0x535854['query']);_0xdf008b[_0xfc79('0x4d')]=_[_0xfc79('0x4c')](_0x535854[_0xfc79('0x49')],qs['fields'](_0x30f193['query'][_0xfc79('0x4e')]));_0xdf008b[_0xfc79('0x4d')]=_0xdf008b[_0xfc79('0x4d')][_0xfc79('0x4f')]?_0xdf008b[_0xfc79('0x4d')]:_0x535854[_0xfc79('0x49')];if(!_0x30f193[_0xfc79('0x4a')]['hasOwnProperty']('nolimit')){_0xdf008b[_0xfc79('0x30')]=qs['limit'](_0x30f193[_0xfc79('0x4a')]['limit']);_0xdf008b[_0xfc79('0x2f')]=qs[_0xfc79('0x2f')](_0x30f193['query'][_0xfc79('0x2f')]);}_0xdf008b[_0xfc79('0x6b')]=qs[_0xfc79('0x51')](_0x30f193['query']['sort']);_0xdf008b['where']=qs['filters'](_[_0xfc79('0x53')](_0x30f193[_0xfc79('0x4a')],_0x535854[_0xfc79('0x4b')]));_0xdf008b[_0xfc79('0x52')][_0xfc79('0x6c')]=_0x460a7d['id'];if(_0x30f193['query'][_0xfc79('0x54')]){_0xdf008b[_0xfc79('0x52')]=_['merge'](_0xdf008b['where'],{'$or':_[_0xfc79('0x43')](_0xdf008b['attributes'],function(_0x288f94){var _0x23662b={};_0x23662b[_0x288f94]={'$like':'%'+_0x30f193[_0xfc79('0x4a')]['filter']+'%'};return _0x23662b;})});}_0xdf008b=_[_0xfc79('0x3d')]({},_0xdf008b,_0x30f193[_0xfc79('0x6d')]);return db[_0xfc79('0x69')][_0xfc79('0x32')]({'where':_0xdf008b['where']})['then'](function(_0x4407b1){_0x470650[_0xfc79('0x32')]=_0x4407b1;if(_0x30f193[_0xfc79('0x4a')][_0xfc79('0x55')]){_0xdf008b[_0xfc79('0x5b')]=[{'all':!![]}];}return db['Disposition'][_0xfc79('0x56')](_0xdf008b);})[_0xfc79('0x22')](function(_0x36226a){_0x470650[_0xfc79('0x57')]=_0x36226a;return _0x470650;});}})[_0xfc79('0x22')](respondWithFilteredResult(_0x20d5ac,_0xdf008b))[_0xfc79('0x2a')](handleError(_0x20d5ac,null));};exports[_0xfc79('0x6e')]=function(_0x31a27c,_0x71b37,_0x2d3d0c){return db[_0xfc79('0x44')][_0xfc79('0x5c')]({'where':{'id':_0x31a27c[_0xfc79('0x59')]['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0x71b37,null))[_0xfc79('0x22')](function(_0x1d4ae0){if(_0x1d4ae0){return _0x1d4ae0[_0xfc79('0x6e')](_0x31a27c['query'][_0xfc79('0x6f')]);}})[_0xfc79('0x22')](respondWithStatusCode(_0x71b37,null))[_0xfc79('0x2a')](handleError(_0x71b37,null));};exports[_0xfc79('0x70')]=function(_0x59d117,_0x14ef97,_0x361f69){if(_0x59d117[_0xfc79('0x66')]['id']){delete _0x59d117['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x59d117[_0xfc79('0x59')]['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0x14ef97,null))[_0xfc79('0x22')](function(_0x1ae589){if(_0x1ae589){_0x59d117[_0xfc79('0x66')][_0xfc79('0x6c')]=_0x1ae589['id'];return db[_0xfc79('0x71')][_0xfc79('0x5d')](_0x59d117['body']);}})[_0xfc79('0x22')](respondWithResult(_0x14ef97,null))['catch'](handleError(_0x14ef97,null));};exports[_0xfc79('0x72')]=function(_0x582b4b,_0x20f47e,_0x3c2361){var _0x526ca4={'raw':![],'where':{}};var _0x1640a4={};var _0xa9229={'count':0x0,'rows':[]};return db[_0xfc79('0x44')][_0xfc79('0x73')]({'where':{'id':_0x582b4b[_0xfc79('0x59')]['id']}})['then'](handleEntityNotFound(_0x20f47e,null))[_0xfc79('0x22')](function(_0x4ed043){if(_0x4ed043){_0x1640a4[_0xfc79('0x49')]=_[_0xfc79('0x5a')](db[_0xfc79('0x71')]['rawAttributes']);_0x1640a4[_0xfc79('0x4a')]=_[_0xfc79('0x5a')](_0x582b4b[_0xfc79('0x4a')]);_0x1640a4[_0xfc79('0x4b')]=_['intersection'](_0x1640a4['model'],_0x1640a4[_0xfc79('0x4a')]);_0x526ca4['attributes']=_[_0xfc79('0x4c')](_0x1640a4[_0xfc79('0x49')],qs[_0xfc79('0x4e')](_0x582b4b[_0xfc79('0x4a')][_0xfc79('0x4e')]));_0x526ca4[_0xfc79('0x4d')]=_0x526ca4[_0xfc79('0x4d')][_0xfc79('0x4f')]?_0x526ca4['attributes']:_0x1640a4[_0xfc79('0x49')];if(!_0x582b4b[_0xfc79('0x4a')][_0xfc79('0x74')](_0xfc79('0x50'))){_0x526ca4[_0xfc79('0x30')]=qs['limit'](_0x582b4b[_0xfc79('0x4a')][_0xfc79('0x30')]);_0x526ca4['offset']=qs['offset'](_0x582b4b[_0xfc79('0x4a')][_0xfc79('0x2f')]);}_0x526ca4[_0xfc79('0x6b')]=qs['sort'](_0x582b4b[_0xfc79('0x4a')][_0xfc79('0x51')]);_0x526ca4[_0xfc79('0x52')]=qs[_0xfc79('0x4b')](_[_0xfc79('0x53')](_0x582b4b[_0xfc79('0x4a')],_0x1640a4[_0xfc79('0x4b')]));_0x526ca4[_0xfc79('0x52')]['WhatsappAccountId']=_0x4ed043['id'];if(_0x582b4b[_0xfc79('0x4a')][_0xfc79('0x54')]){_0x526ca4[_0xfc79('0x52')]=_[_0xfc79('0x3d')](_0x526ca4['where'],{'$or':_[_0xfc79('0x43')](_0x526ca4[_0xfc79('0x4d')],function(_0x436ae7){var _0x34391c={};_0x34391c[_0x436ae7]={'$like':'%'+_0x582b4b[_0xfc79('0x4a')][_0xfc79('0x54')]+'%'};return _0x34391c;})});}_0x526ca4=_[_0xfc79('0x3d')]({},_0x526ca4,_0x582b4b[_0xfc79('0x6d')]);return db[_0xfc79('0x71')][_0xfc79('0x32')]({'where':_0x526ca4['where']})['then'](function(_0x1a236d){_0xa9229['count']=_0x1a236d;if(_0x582b4b['query']['includeAll']){_0x526ca4[_0xfc79('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0xfc79('0x56')](_0x526ca4);})['then'](function(_0x8452b4){_0xa9229['rows']=_0x8452b4;return _0xa9229;});}})[_0xfc79('0x22')](respondWithFilteredResult(_0x20f47e,_0x526ca4))[_0xfc79('0x2a')](handleError(_0x20f47e,null));};exports[_0xfc79('0x75')]=function(_0x49f31e,_0x277bde,_0x417eec){return db[_0xfc79('0x44')][_0xfc79('0x5c')]({'where':{'id':_0x49f31e['params']['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0x277bde,null))[_0xfc79('0x22')](function(_0xdb9dc5){if(_0xdb9dc5){return _0xdb9dc5[_0xfc79('0x75')](_0x49f31e['query'][_0xfc79('0x6f')]);}})[_0xfc79('0x22')](respondWithStatusCode(_0x277bde,null))[_0xfc79('0x2a')](handleError(_0x277bde,null));};exports['addAgents']=function(_0x1d1fcc,_0x59a6f2,_0x3d79c0){return db[_0xfc79('0x44')][_0xfc79('0x5c')]({'where':{'id':_0x1d1fcc[_0xfc79('0x59')]['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0x59a6f2,null))[_0xfc79('0x22')](function(_0x2b92e9){if(_0x2b92e9){return _0x2b92e9[_0xfc79('0x76')](_0x1d1fcc[_0xfc79('0x66')][_0xfc79('0x6f')],_[_0xfc79('0x77')](_0x1d1fcc['body'],[_0xfc79('0x6f'),'id'])||{})[_0xfc79('0x78')](function(_0x1cf991){for(var _0x5acd5c=0x0;_0x5acd5c<_0x1d1fcc[_0xfc79('0x66')][_0xfc79('0x6f')][_0xfc79('0x4f')];_0x5acd5c+=0x1){socket['emit'](_0xfc79('0x79'),{'UserId':_0x1d1fcc[_0xfc79('0x66')][_0xfc79('0x6f')][_0x5acd5c],'WhatsappAccountId':_0x1d1fcc[_0xfc79('0x59')]['id']});}return _0x1cf991;});}})[_0xfc79('0x22')](respondWithResult(_0x59a6f2,null))[_0xfc79('0x2a')](handleError(_0x59a6f2,null));};exports[_0xfc79('0x7a')]=function(_0x1e7c9a,_0x17d0b6,_0x1d74a3){return db[_0xfc79('0x44')][_0xfc79('0x5c')]({'where':{'id':_0x1e7c9a[_0xfc79('0x59')]['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0x17d0b6,null))[_0xfc79('0x22')](function(_0x2ab60d){if(_0x2ab60d){return _0x2ab60d[_0xfc79('0x7a')](_0x1e7c9a[_0xfc79('0x4a')][_0xfc79('0x6f')])[_0xfc79('0x22')](function(){if(_[_0xfc79('0x7b')](_0x1e7c9a['query'][_0xfc79('0x6f')])){for(var _0x16e844=0x0;_0x16e844<_0x1e7c9a[_0xfc79('0x4a')][_0xfc79('0x6f')][_0xfc79('0x4f')];_0x16e844+=0x1){socket['emit'](_0xfc79('0x7c'),{'UserId':Number(_0x1e7c9a[_0xfc79('0x4a')][_0xfc79('0x6f')][_0x16e844]),'WhatsappAccountId':Number(_0x1e7c9a[_0xfc79('0x59')]['id'])});}}else{socket['emit'](_0xfc79('0x7c'),{'UserId':Number(_0x1e7c9a[_0xfc79('0x4a')][_0xfc79('0x6f')]),'WhatsappAccountId':Number(_0x1e7c9a[_0xfc79('0x59')]['id'])});}});}})[_0xfc79('0x22')](respondWithStatusCode(_0x17d0b6,null))[_0xfc79('0x2a')](handleError(_0x17d0b6,null));};exports['getAgents']=function(_0x35ff21,_0x5ea80c,_0x48177e){var _0x3c8be8={};var _0x3cb350={};var _0x3fbdbe;var _0x51315b;return db['WhatsappAccount']['findOne']({'where':{'id':_0x35ff21[_0xfc79('0x59')]['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0x5ea80c,null))['then'](function(_0x344418){if(_0x344418){_0x3fbdbe=_0x344418;_0x3cb350[_0xfc79('0x49')]=_[_0xfc79('0x5a')](db[_0xfc79('0x7d')]['rawAttributes']);_0x3cb350[_0xfc79('0x4a')]=_['keys'](_0x35ff21[_0xfc79('0x4a')]);_0x3cb350[_0xfc79('0x4b')]=_[_0xfc79('0x4c')](_0x3cb350[_0xfc79('0x49')],_0x3cb350[_0xfc79('0x4a')]);_0x3c8be8['attributes']=_['intersection'](_0x3cb350[_0xfc79('0x49')],qs[_0xfc79('0x4e')](_0x35ff21['query'][_0xfc79('0x4e')]));_0x3c8be8[_0xfc79('0x4d')]=_0x3c8be8[_0xfc79('0x4d')]['length']?_0x3c8be8[_0xfc79('0x4d')]:_0x3cb350[_0xfc79('0x49')];_0x3c8be8['order']=qs[_0xfc79('0x51')](_0x35ff21[_0xfc79('0x4a')][_0xfc79('0x51')]);_0x3c8be8[_0xfc79('0x52')]=qs[_0xfc79('0x4b')](_['pick'](_0x35ff21[_0xfc79('0x4a')],_0x3cb350[_0xfc79('0x4b')]));if(_0x35ff21[_0xfc79('0x4a')][_0xfc79('0x54')]){_0x3c8be8[_0xfc79('0x52')]=_[_0xfc79('0x3d')](_0x3c8be8['where'],{'$or':_[_0xfc79('0x43')](_0x3c8be8[_0xfc79('0x4d')],function(_0x148522){var _0x15c19e={};_0x15c19e[_0x148522]={'$like':'%'+_0x35ff21[_0xfc79('0x4a')][_0xfc79('0x54')]+'%'};return _0x15c19e;})});}_0x3c8be8=_['merge']({},_0x3c8be8,_0x35ff21[_0xfc79('0x6d')]);return _0x3fbdbe['getAgents'](_0x3c8be8);}})['then'](function(_0x14b39b){if(_0x14b39b){_0x51315b=_0x14b39b[_0xfc79('0x4f')];if(!_0x35ff21[_0xfc79('0x4a')][_0xfc79('0x74')](_0xfc79('0x50'))){_0x3c8be8['limit']=qs[_0xfc79('0x30')](_0x35ff21['query'][_0xfc79('0x30')]);_0x3c8be8[_0xfc79('0x2f')]=qs[_0xfc79('0x2f')](_0x35ff21['query'][_0xfc79('0x2f')]);}return _0x3fbdbe[_0xfc79('0x7e')](_0x3c8be8);}})['then'](function(_0x40d755){if(_0x40d755){return _0x40d755?{'count':_0x51315b,'rows':_0x40d755}:null;}})[_0xfc79('0x22')](respondWithResult(_0x5ea80c,null))['catch'](handleError(_0x5ea80c,null));};exports['addApplications']=function(_0x4458ff,_0x2a9215,_0x49cbf6){return db[_0xfc79('0x44')]['findOne']({'where':{'id':_0x4458ff[_0xfc79('0x59')]['id']}})['then'](handleEntityNotFound(_0x2a9215,null))[_0xfc79('0x22')](function(_0x2aee9a){if(_0x2aee9a){return db['sequelize'][_0xfc79('0x7f')](function(_0x263a7e){return db[_0xfc79('0x80')]['destroy']({'where':{'WhatsappAccountId':_0x4458ff[_0xfc79('0x59')]['id']},'transaction':_0x263a7e})['then'](function(_0x4aaa11){var _0x427fcb=_[_0xfc79('0x43')](_0x4458ff[_0xfc79('0x66')],function(_0x59cd78){_0x59cd78[_0xfc79('0x6c')]=_0x4458ff[_0xfc79('0x59')]['id'];return _0x59cd78;});return db['WhatsappApplication'][_0xfc79('0x81')](_0x427fcb,{'transaction':_0x263a7e});});})[_0xfc79('0x22')](function(){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x4458ff[_0xfc79('0x59')]['id']},'order':_0xfc79('0x82')});});}})[_0xfc79('0x22')](respondWithResult(_0x2a9215,null))[_0xfc79('0x2a')](handleError(_0x2a9215,null));};exports[_0xfc79('0x83')]=function(_0x1e016b,_0x3a8880,_0x48c122){var _0x24366e={};var _0x596732={};var _0x1e3200;var _0x1656f5;return db['WhatsappAccount'][_0xfc79('0x73')]({'where':{'id':_0x1e016b[_0xfc79('0x59')]['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0x3a8880,null))['then'](function(_0x3817e4){if(_0x3817e4){_0x1e3200=_0x3817e4;_0x596732[_0xfc79('0x49')]=_[_0xfc79('0x5a')](db[_0xfc79('0x80')]['rawAttributes']);_0x596732[_0xfc79('0x4a')]=_[_0xfc79('0x5a')](_0x1e016b[_0xfc79('0x4a')]);_0x596732[_0xfc79('0x4b')]=_[_0xfc79('0x4c')](_0x596732[_0xfc79('0x49')],_0x596732['query']);_0x24366e[_0xfc79('0x4d')]=_[_0xfc79('0x4c')](_0x596732[_0xfc79('0x49')],qs[_0xfc79('0x4e')](_0x1e016b['query'][_0xfc79('0x4e')]));_0x24366e[_0xfc79('0x4d')]=_0x24366e[_0xfc79('0x4d')][_0xfc79('0x4f')]?_0x24366e[_0xfc79('0x4d')]:_0x596732[_0xfc79('0x49')];_0x24366e[_0xfc79('0x6b')]=qs[_0xfc79('0x51')](_0x1e016b[_0xfc79('0x4a')][_0xfc79('0x51')]);_0x24366e[_0xfc79('0x52')]=qs[_0xfc79('0x4b')](_[_0xfc79('0x53')](_0x1e016b['query'],_0x596732[_0xfc79('0x4b')]));if(_0x1e016b[_0xfc79('0x4a')][_0xfc79('0x54')]){_0x24366e[_0xfc79('0x52')]=_[_0xfc79('0x3d')](_0x24366e[_0xfc79('0x52')],{'$or':_['map'](_0x24366e[_0xfc79('0x4d')],function(_0x5f43cd){var _0x9c9d56={};_0x9c9d56[_0x5f43cd]={'$like':'%'+_0x1e016b[_0xfc79('0x4a')][_0xfc79('0x54')]+'%'};return _0x9c9d56;})});}_0x24366e=_[_0xfc79('0x3d')]({},_0x24366e,_0x1e016b[_0xfc79('0x6d')]);return _0x1e3200[_0xfc79('0x83')](_0x24366e);}})[_0xfc79('0x22')](function(_0x61b973){if(_0x61b973){_0x1656f5=_0x61b973[_0xfc79('0x4f')];if(!_0x1e016b['query'][_0xfc79('0x74')](_0xfc79('0x50'))){_0x24366e[_0xfc79('0x30')]=qs[_0xfc79('0x30')](_0x1e016b[_0xfc79('0x4a')][_0xfc79('0x30')]);_0x24366e[_0xfc79('0x2f')]=qs[_0xfc79('0x2f')](_0x1e016b['query'][_0xfc79('0x2f')]);}return _0x1e3200['getApplications'](_0x24366e);}})[_0xfc79('0x22')](function(_0xa9cb60){if(_0xa9cb60){return _0xa9cb60?{'count':_0x1656f5,'rows':_0xa9cb60}:null;}})['then'](respondWithResult(_0x3a8880,null))[_0xfc79('0x2a')](handleError(_0x3a8880,null));};exports['notify']=function(_0x561fa5,_0x1e196f,_0x5164ee){var _0x5e88a0={'channel':_0xfc79('0x84')};var _0xcee408=[];var _0x33ba54=[];var _0x1d6090={};return db[_0xfc79('0x44')][_0xfc79('0x5c')]({'where':{'id':_0x561fa5['params']['id']},'include':[{'model':db[_0xfc79('0x80')],'as':_0xfc79('0x85')}]})[_0xfc79('0x22')](handleEntityNotFound(_0x1e196f,null))[_0xfc79('0x22')](function(_0x45aad1){_0x5e88a0[_0xfc79('0x40')]=_0x45aad1;_0x5e88a0[_0xfc79('0x86')]=_[_0xfc79('0x87')](_0x45aad1['Applications'],[_0xfc79('0x82')],[_0xfc79('0x88')]);if(_0x5e88a0['account'][_0xfc79('0x85')]){delete _0x5e88a0[_0xfc79('0x40')][_0xfc79('0x85')];}return db[_0xfc79('0x89')][_0xfc79('0x67')]();})[_0xfc79('0x22')](function(_0x10ecff){if(!_0x10ecff){throw new db['Sequelize'][(_0xfc79('0x8a'))](_0xfc79('0x8b'));}_0xcee408=_['difference'](_[_0xfc79('0x5a')](_0x10ecff),[_0xfc79('0x8c'),'updatedAt']);_0x33ba54=_[_0xfc79('0x8d')](_[_0xfc79('0x5a')](_0x10ecff),[_0xfc79('0x8c'),_0xfc79('0x8e'),_0xfc79('0x8f'),'ListId']);_0x5e88a0[_0xfc79('0x66')]={'mapKey':_0xfc79('0x90')};if(_0x5e88a0[_0xfc79('0x40')]['type']&&_0x5e88a0['account'][_0xfc79('0x47')]==='twilio'){_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x91')]=_0x561fa5[_0xfc79('0x66')][_0xfc79('0x92')][_0xfc79('0x93')]('whatsapp:','');_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x66')]=_0x561fa5[_0xfc79('0x66')][_0xfc79('0x94')];_0x5e88a0[_0xfc79('0x66')]['messageId']=_0x561fa5['body'][_0xfc79('0x95')];}if(_0x5e88a0[_0xfc79('0x66')]['id']){delete _0x5e88a0[_0xfc79('0x66')]['id'];}if(_[_0xfc79('0x96')](_0x5e88a0[_0xfc79('0x66')]['from'])){throw new db[(_0xfc79('0x97'))][(_0xfc79('0x8a'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x66')])||_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x66')]===''){throw new db[(_0xfc79('0x97'))][(_0xfc79('0x8a'))](_0xfc79('0x98'));}if(_[_0xfc79('0x96')](_0x5e88a0['body'][_0xfc79('0x99')])){throw new db[(_0xfc79('0x97'))][(_0xfc79('0x8a'))](_0xfc79('0x9a')+_0x33ba54);}if(!_['includes'](_0x33ba54,_0x5e88a0[_0xfc79('0x66')]['mapKey'])){throw new db[(_0xfc79('0x97'))][(_0xfc79('0x8a'))](_0xfc79('0x9b')+_0x33ba54);}_0x1d6090[_0x5e88a0[_0xfc79('0x66')]['mapKey']]=_0x5e88a0[_0xfc79('0x66')]['from'];return db[_0xfc79('0x9c')][_0xfc79('0x5c')]({'where':{'id':_0x5e88a0[_0xfc79('0x40')][_0xfc79('0x9d')]},'include':[{'model':db['CmContact'],'as':_0xfc79('0x9e'),'where':_0x1d6090,'limit':0x1,'order':[[_0xfc79('0x8e'),_0xfc79('0x9f')]]}]});})[_0xfc79('0x22')](handleEntityNotFound(_0x1e196f,null))[_0xfc79('0x22')](function(_0x4b407d){if(_0x4b407d){_0x5e88a0['list']=_[_0xfc79('0x77')](_0x4b407d,['Contacts']);if(_0x4b407d['Contacts']['length']){return _0x4b407d[_0xfc79('0x9e')][0x0];}var _0x2fe8d4=_['defaults'](_0x5e88a0[_0xfc79('0x66')],{'firstName':_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x91')],'ListId':_0x4b407d['id']});_0x2fe8d4[_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x99')]]=_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x91')];return db[_0xfc79('0x89')][_0xfc79('0x5d')](_0x2fe8d4,{'fields':_0xcee408,'raw':!![]});}})[_0xfc79('0x22')](handleEntityNotFound(_0x1e196f,null))[_0xfc79('0x22')](function(_0x5bfdd3){if(_0x5bfdd3){_0x5e88a0['contact']=_0x5bfdd3;var _0x3d6b2f={'ContactId':_0x5bfdd3['id'],'phone':_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x91')],'WhatsappAccountId':_0x561fa5[_0xfc79('0x59')]['id']};var _0xbd6884={'ContactId':_0x5bfdd3['id'],'WhatsappAccountId':_0x561fa5['params']['id'],'closed':![]};return db[_0xfc79('0xa0')][_0xfc79('0x5c')]({'where':_0xbd6884})[_0xfc79('0x22')](function(_0x3fcadf){if(_0x3fcadf){return[_0x3fcadf,![]];}return db[_0xfc79('0xa0')][_0xfc79('0x5d')](_0x3d6b2f)[_0xfc79('0x22')](function(_0x3c2ab5){return[_0x3c2ab5,!![]];});});}})[_0xfc79('0x78')](function(_0x2cb3d8,_0x5ea4e8){_0x5e88a0[_0xfc79('0xa1')]=_0x2cb3d8[_0xfc79('0x5f')]({'plain':!![]});_0x5e88a0[_0xfc79('0xa1')][_0xfc79('0xa2')]=![];if(_0x5ea4e8){if(_0x5e88a0[_0xfc79('0x40')][_0xfc79('0xa3')]){_0x5e88a0['applications']['push']({'id':0x0,'priority':_0x5e88a0[_0xfc79('0x86')]['length']+0x1,'app':_0xfc79('0xa4'),'appdata':_0xfc79('0xa5'),'interval':'*,*,*,*'});}_0x5e88a0['interaction']['created']=!![];}return db[_0xfc79('0xa6')][_0xfc79('0x5d')]({'phone':_0x5e88a0['body']['from'],'messageId':_0x5e88a0['body'][_0xfc79('0xa7')],'body':_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x66')],'WhatsappAccountId':_0x561fa5[_0xfc79('0x59')]['id'],'WhatsappInteractionId':_0x2cb3d8['id'],'direction':'in','ContactId':_0x2cb3d8['ContactId'],'AttachmentId':_0x5e88a0[_0xfc79('0x66')][_0xfc79('0xa8')]});})[_0xfc79('0x22')](function(_0x2d7482){_0x5e88a0[_0xfc79('0x29')]=_0x2d7482;if(_0x5e88a0[_0xfc79('0xa1')][_0xfc79('0xa9')]){return db['User'][_0xfc79('0x5c')]({'attributes':['id',_0xfc79('0x3a')],'where':{'id':_0x5e88a0[_0xfc79('0xa1')]['UserId']}})[_0xfc79('0x22')](function(_0x49160b){if(_0x49160b){_0x5e88a0[_0xfc79('0x86')][_0xfc79('0xaa')]({'id':0x0,'priority':0x0,'app':_0xfc79('0x3f'),'appdata':_0x49160b['name']+','+(_0x5e88a0[_0xfc79('0x40')]['waitForTheAssignedAgent']||0xa),'interval':_0xfc79('0xab')});}return respondWithRpcPromise(_0xfc79('0xac'),_0xfc79('0xad'),_0x5e88a0);});}return respondWithRpcPromise(_0xfc79('0xac'),'startRouting',_0x5e88a0);})[_0xfc79('0x22')](function(_0x1a1cb6){if(_0x1a1cb6){var _0x30f039=0xc8;var _0x482ba9=_0xfc79('0xae');logger[_0xfc79('0x23')](_0xfc79('0x25'),_0x482ba9,_0x30f039,'entity\x20found');logger['debug'](_0xfc79('0xaf'),_0x482ba9,_0x30f039,_0xfc79('0xb0'),JSON[_0xfc79('0x26')](_0x1a1cb6));if(_0x5e88a0[_0xfc79('0x40')]['type']===_0xfc79('0xb1')){return _0x1e196f[_0xfc79('0x2d')](_0x30f039)[_0xfc79('0xb2')](_0xfc79('0xb3'),_0xfc79('0xb4'))[_0xfc79('0x3b')](_0xfc79('0xb5'));}else{return _0x1e196f[_0xfc79('0x2d')](_0x30f039)[_0xfc79('0x2e')](_0x1a1cb6);}}})['catch'](handleError(_0x1e196f,null));};exports[_0xfc79('0x3b')]=function(_0x119905,_0x5a8afe,_0x11b49a){var _0x366a66,_0x437844,_0x70d9d;if(_[_0xfc79('0x96')](_0x119905['body']['body'])||_0x119905[_0xfc79('0x66')]['body']===''){throw new db[(_0xfc79('0x97'))]['ValidationError'](_0xfc79('0x98'));}if(_[_0xfc79('0x96')](_0x119905[_0xfc79('0x66')]['to'])){throw new db[(_0xfc79('0x97'))][(_0xfc79('0x8a'))]('to\x20is\x20mandatory');}_0x366a66=_0x119905[_0xfc79('0x66')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x119905[_0xfc79('0x59')]['id']},'include':[{'model':db[_0xfc79('0x9c')],'as':_0xfc79('0xb6'),'include':[{'model':db[_0xfc79('0x89')],'as':'Contacts','where':{'mobile':_0x366a66},'limit':0x1,'order':[['updatedAt',_0xfc79('0x9f')]]}]}]})['then'](handleEntityNotFound(_0x5a8afe,null))[_0xfc79('0x22')](function(_0x3352ed){if(_0x3352ed&&_0x3352ed[_0xfc79('0xb6')]){_0x437844=_0x3352ed['get']({'plain':!![]});if(_0x437844['List']&&_0x437844[_0xfc79('0xb6')]['Contacts'][_0xfc79('0x4f')]){return _0x437844[_0xfc79('0xb6')][_0xfc79('0x9e')][0x0];}return db[_0xfc79('0x89')][_0xfc79('0x5d')](_[_0xfc79('0x1a')](_0x119905['body'],{'firstName':_0x366a66,'mobile':_0x366a66,'phone':_0x366a66,'ListId':_0x437844[_0xfc79('0x9d')]}));}})[_0xfc79('0x22')](handleEntityNotFound(_0x5a8afe,null))[_0xfc79('0x22')](function(_0x4ff5a2){if(_0x4ff5a2){_0x70d9d=_0x4ff5a2;return db[_0xfc79('0xa0')][_0xfc79('0x5c')]({'where':{'ContactId':_0x70d9d['id'],'closed':![],'WhatsappAccountId':_0x437844['id']}})['then'](function(_0x237322){if(_0x237322){return[_0x237322,![]];}return db[_0xfc79('0xa0')]['create']({'UserId':_0x119905[_0xfc79('0x5e')]['id'],'ContactId':_0x70d9d['id'],'WhatsappAccountId':_0x437844['id'],'phone':_0x366a66,'firstMsgDirection':_0xfc79('0xb7'),'Messages':[_['merge'](_0x119905[_0xfc79('0x66')],{'read':![],'body':_0x119905[_0xfc79('0x66')]['body'],'phone':_0x366a66,'WhatsappAccountId':_0x437844['id'],'UserId':_0x119905[_0xfc79('0x5e')]['id'],'ContactId':_0x70d9d['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})['then'](function(_0x26e2ac){return[_0x26e2ac,!![]];});});}})['spread'](function(_0x1afa4f,_0x327a87){if(_0x327a87){return _0x1afa4f;}return db['WhatsappMessage'][_0xfc79('0x5d')](_['merge'](_0x119905[_0xfc79('0x66')],{'read':![],'body':_0x119905[_0xfc79('0x66')]['body'],'phone':_0x366a66,'WhatsappAccountId':_0x437844['id'],'WhatsappInteractionId':_0x1afa4f['id'],'UserId':_0x119905[_0xfc79('0x5e')]['id'],'ContactId':_0x70d9d['id']}))[_0xfc79('0x22')](function(_0x3ea611){_0x1afa4f[_0xfc79('0xb8')][_0xfc79('0xb9')]=[];_0x1afa4f['dataValues'][_0xfc79('0xb9')]['push'](_0x3ea611[_0xfc79('0xb8')]);return _0x1afa4f;});})[_0xfc79('0x22')](respondWithResult(_0x5a8afe,null))[_0xfc79('0x2a')](handleError(_0x5a8afe,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index a6a6962..e452033 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 _0x4317=['remove','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners','update'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4317,0x7c));var _0x7431=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x4317[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x7431('0x0'))['db'][_0x7431('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7431('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7431('0x3'),'afterDestroy':_0x7431('0x4')};function emitEvent(_0x290b11){return function(_0xa4197b,_0x12c492,_0x201287){WhatsappAccountEvents['emit'](_0x290b11+':'+_0xa4197b['id'],_0xa4197b);WhatsappAccountEvents['emit'](_0x290b11,_0xa4197b);_0x201287(null);};}for(var e in events){if(events[_0x7431('0x5')](e)){var event=events[e];WhatsappAccount[_0x7431('0x6')](e,emitEvent(event));}}module[_0x7431('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x15ef=['../../mysqldb','WhatsappAccount','save','update','remove','emit','hook','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x15ef,0x80));var _0xf15e=function(_0xdab2d,_0x4a80ef){_0xdab2d=_0xdab2d-0x0;var _0x429827=_0x15ef[_0xdab2d];return _0x429827;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xf15e('0x0'))['db'][_0xf15e('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf15e('0x2'),'afterUpdate':_0xf15e('0x3'),'afterDestroy':_0xf15e('0x4')};function emitEvent(_0x347c12){return function(_0x4e7241,_0x5d456b,_0x1b9a24){WhatsappAccountEvents[_0xf15e('0x5')](_0x347c12+':'+_0x4e7241['id'],_0x4e7241);WhatsappAccountEvents['emit'](_0x347c12,_0x4e7241);_0x1b9a24(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xf15e('0x6')](e,emitEvent(event));}}module[_0xf15e('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 196a731..2b4ca56 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 _0x0aca=['moment','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','util','../../config/logger','api'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0x0aca,0xe6));var _0xa0ac=function(_0x187454,_0x69cd05){_0x187454=_0x187454-0x0;var _0x4a203a=_0x0aca[_0x187454];return _0x4a203a;};'use strict';var _=require(_0xa0ac('0x0'));var util=require(_0xa0ac('0x1'));var logger=require(_0xa0ac('0x2'))(_0xa0ac('0x3'));var moment=require(_0xa0ac('0x4'));var BPromise=require(_0xa0ac('0x5'));var rp=require(_0xa0ac('0x6'));var fs=require('fs');var path=require(_0xa0ac('0x7'));var rimraf=require('rimraf');var config=require(_0xa0ac('0x8'));var attributes=require(_0xa0ac('0x9'));module[_0xa0ac('0xa')]=function(_0x2b4199,_0x2a42b4){return _0x2b4199[_0xa0ac('0xb')]('WhatsappAccount',attributes,{'tableName':_0xa0ac('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6daf=['define','WhatsappAccount','lodash','util','../../config/logger','api','request-promise','rimraf','./whatsappAccount.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6daf,0x16a));var _0xf6da=function(_0xd69b80,_0x32a1cf){_0xd69b80=_0xd69b80-0x0;var _0x413583=_0x6daf[_0xd69b80];return _0x413583;};'use strict';var _=require(_0xf6da('0x0'));var util=require(_0xf6da('0x1'));var logger=require(_0xf6da('0x2'))(_0xf6da('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6da('0x5'));var config=require('../../config/environment');var attributes=require(_0xf6da('0x6'));module[_0xf6da('0x7')]=function(_0x269a86,_0x4dc7ea){return _0x269a86[_0xf6da('0x8')](_0xf6da('0x9'),attributes,{'tableName':'whatsapp_accounts','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 aab0f5f..9e3d6c5 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 _0x3ac7=['include','map','model','then','ShowWhatsappAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','request\x20sent','debug','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','WhatsappAccount','find','options','raw','where','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ac7,0xcd));var _0x73ac=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x3ac7[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x73ac('0x0'));var util=require('util');var moment=require(_0x73ac('0x1'));var BPromise=require(_0x73ac('0x2'));var rs=require(_0x73ac('0x3'));var fs=require('fs');var Redis=require(_0x73ac('0x4'));var db=require(_0x73ac('0x5'))['db'];var utils=require(_0x73ac('0x6'));var logger=require(_0x73ac('0x7'))(_0x73ac('0x8'));var config=require(_0x73ac('0x9'));var jayson=require(_0x73ac('0xa'));var client=jayson[_0x73ac('0xb')][_0x73ac('0xc')]({'port':0x232a});config[_0x73ac('0xd')]=_['defaults'](config['redis'],{'host':_0x73ac('0xe'),'port':0x18eb});var socket=require(_0x73ac('0xf'))(new Redis(config[_0x73ac('0xd')]));require(_0x73ac('0x10'))[_0x73ac('0x11')](socket);function respondWithRpcPromise(_0x43bda0,_0x506e2d,_0x2b42c6){return new BPromise(function(_0xe05b58,_0x4c694c){return client[_0x73ac('0x12')](_0x43bda0,_0x2b42c6)['then'](function(_0x1b6d73){logger[_0x73ac('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x506e2d,_0x73ac('0x14'));logger[_0x73ac('0x15')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x506e2d,'request\x20sent',JSON[_0x73ac('0x16')](_0x1b6d73));if(_0x1b6d73[_0x73ac('0x17')]){if(_0x1b6d73[_0x73ac('0x17')][_0x73ac('0x18')]===0x1f4){logger[_0x73ac('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x506e2d,_0x1b6d73[_0x73ac('0x17')][_0x73ac('0x19')]);return _0x4c694c(_0x1b6d73[_0x73ac('0x17')]['message']);}logger[_0x73ac('0x17')](_0x73ac('0x1a'),_0x506e2d,_0x1b6d73[_0x73ac('0x17')][_0x73ac('0x19')]);return _0xe05b58(_0x1b6d73[_0x73ac('0x17')][_0x73ac('0x19')]);}else{logger[_0x73ac('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x506e2d,_0x73ac('0x14'));_0xe05b58(_0x1b6d73[_0x73ac('0x1b')]['message']);}})[_0x73ac('0x1c')](function(_0x1534b9){logger[_0x73ac('0x17')](_0x73ac('0x1a'),_0x506e2d,_0x1534b9);_0x4c694c(_0x1534b9);});});}exports['ShowWhatsappAccount']=function(_0xa9d5e8){var _0x48d144=this;return new Promise(function(_0x28081a,_0xf7e57b){return db[_0x73ac('0x1d')][_0x73ac('0x1e')]({'raw':_0xa9d5e8[_0x73ac('0x1f')]?_0xa9d5e8[_0x73ac('0x1f')][_0x73ac('0x20')]===undefined?!![]:![]:!![],'where':_0xa9d5e8[_0x73ac('0x1f')]?_0xa9d5e8[_0x73ac('0x1f')][_0x73ac('0x21')]||null:null,'attributes':_0xa9d5e8['options']?_0xa9d5e8[_0x73ac('0x1f')][_0x73ac('0x22')]||null:null,'include':_0xa9d5e8[_0x73ac('0x1f')]?_0xa9d5e8[_0x73ac('0x1f')][_0x73ac('0x23')]?_[_0x73ac('0x24')](_0xa9d5e8[_0x73ac('0x1f')][_0x73ac('0x23')],function(_0x395ae6){return{'model':db[_0x395ae6[_0x73ac('0x25')]],'as':_0x395ae6['as'],'attributes':_0x395ae6['attributes'],'include':_0x395ae6[_0x73ac('0x23')]?_[_0x73ac('0x24')](_0x395ae6['include'],function(_0xbb3115){return{'model':db[_0xbb3115[_0x73ac('0x25')]],'as':_0xbb3115['as'],'attributes':_0xbb3115[_0x73ac('0x22')],'include':_0xbb3115['include']?_['map'](_0xbb3115['include'],function(_0x25b67a){return{'model':db[_0x25b67a[_0x73ac('0x25')]],'as':_0x25b67a['as'],'attributes':_0x25b67a[_0x73ac('0x22')]};}):[]};}):[]};}):[]:[]})[_0x73ac('0x26')](function(_0x570987){logger[_0x73ac('0x13')](_0x73ac('0x27'),_0xa9d5e8);logger[_0x73ac('0x15')](_0x73ac('0x27'),_0xa9d5e8,JSON[_0x73ac('0x16')](_0x570987));_0x28081a(_0x570987);})['catch'](function(_0x67aa30){logger[_0x73ac('0x17')]('ShowWhatsappAccount',_0x67aa30[_0x73ac('0x19')],_0xa9d5e8);_0xf7e57b(_0x48d144[_0x73ac('0x17')](0x1f4,_0x67aa30[_0x73ac('0x19')]));});});}; \ No newline at end of file +var _0x6a95=['catch','ShowWhatsappAccount','find','options','where','attributes','include','map','model','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x2d9c9a,_0xbb837c){var _0x3cf5f9=function(_0x1d0ef3){while(--_0x1d0ef3){_0x2d9c9a['push'](_0x2d9c9a['shift']());}};_0x3cf5f9(++_0xbb837c);}(_0x6a95,0xdb));var _0x56a9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6a95[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x56a9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56a9('0x3'))['db'];var utils=require(_0x56a9('0x4'));var logger=require(_0x56a9('0x5'))(_0x56a9('0x6'));var config=require(_0x56a9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x56a9('0x8')]({'port':0x232a});config[_0x56a9('0x9')]=_[_0x56a9('0xa')](config[_0x56a9('0x9')],{'host':_0x56a9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x56a9('0xc'))[_0x56a9('0xd')](socket);function respondWithRpcPromise(_0x47e9d2,_0xf493a8,_0x1cae39){return new BPromise(function(_0x27a3bc,_0x2820d6){return client[_0x56a9('0xe')](_0x47e9d2,_0x1cae39)[_0x56a9('0xf')](function(_0xbbca09){logger[_0x56a9('0x10')](_0x56a9('0x11'),_0xf493a8,'request\x20sent');logger[_0x56a9('0x12')](_0x56a9('0x13'),_0xf493a8,_0x56a9('0x14'),JSON[_0x56a9('0x15')](_0xbbca09));if(_0xbbca09[_0x56a9('0x16')]){if(_0xbbca09[_0x56a9('0x16')][_0x56a9('0x17')]===0x1f4){logger[_0x56a9('0x16')](_0x56a9('0x11'),_0xf493a8,_0xbbca09['error'][_0x56a9('0x18')]);return _0x2820d6(_0xbbca09['error'][_0x56a9('0x18')]);}logger[_0x56a9('0x16')](_0x56a9('0x11'),_0xf493a8,_0xbbca09[_0x56a9('0x16')][_0x56a9('0x18')]);return _0x27a3bc(_0xbbca09[_0x56a9('0x16')][_0x56a9('0x18')]);}else{logger[_0x56a9('0x10')](_0x56a9('0x11'),_0xf493a8,'request\x20sent');_0x27a3bc(_0xbbca09[_0x56a9('0x19')]['message']);}})[_0x56a9('0x1a')](function(_0x5b79e6){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0xf493a8,_0x5b79e6);_0x2820d6(_0x5b79e6);});});}exports[_0x56a9('0x1b')]=function(_0x8571f9){var _0x35620b=this;return new Promise(function(_0x36fec1,_0x212b3e){return db['WhatsappAccount'][_0x56a9('0x1c')]({'raw':_0x8571f9[_0x56a9('0x1d')]?_0x8571f9[_0x56a9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x8571f9['options']?_0x8571f9[_0x56a9('0x1d')][_0x56a9('0x1e')]||null:null,'attributes':_0x8571f9[_0x56a9('0x1d')]?_0x8571f9[_0x56a9('0x1d')][_0x56a9('0x1f')]||null:null,'include':_0x8571f9[_0x56a9('0x1d')]?_0x8571f9['options']['include']?_['map'](_0x8571f9[_0x56a9('0x1d')][_0x56a9('0x20')],function(_0x3681c3){return{'model':db[_0x3681c3['model']],'as':_0x3681c3['as'],'attributes':_0x3681c3[_0x56a9('0x1f')],'include':_0x3681c3[_0x56a9('0x20')]?_[_0x56a9('0x21')](_0x3681c3['include'],function(_0x1a4925){return{'model':db[_0x1a4925[_0x56a9('0x22')]],'as':_0x1a4925['as'],'attributes':_0x1a4925[_0x56a9('0x1f')],'include':_0x1a4925[_0x56a9('0x20')]?_[_0x56a9('0x21')](_0x1a4925[_0x56a9('0x20')],function(_0x3ad59a){return{'model':db[_0x3ad59a[_0x56a9('0x22')]],'as':_0x3ad59a['as'],'attributes':_0x3ad59a['attributes']};}):[]};}):[]};}):[]:[]})[_0x56a9('0xf')](function(_0x6899){logger[_0x56a9('0x10')](_0x56a9('0x1b'),_0x8571f9);logger['debug']('ShowWhatsappAccount',_0x8571f9,JSON[_0x56a9('0x15')](_0x6899));_0x36fec1(_0x6899);})[_0x56a9('0x1a')](function(_0x361706){logger[_0x56a9('0x16')](_0x56a9('0x1b'),_0x361706[_0x56a9('0x18')],_0x8571f9);_0x212b3e(_0x35620b[_0x56a9('0x16')](0x1f4,_0x361706['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 7a8690f..9bd5087 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 _0x6e67=['./whatsappAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x189eee,_0x2d7e5a){var _0x290bc9=function(_0x4a7e61){while(--_0x4a7e61){_0x189eee['push'](_0x189eee['shift']());}};_0x290bc9(++_0x2d7e5a);}(_0x6e67,0x1ab));var _0x76e6=function(_0x1118eb,_0x476f0a){_0x1118eb=_0x1118eb-0x0;var _0x2dbcd0=_0x6e67[_0x1118eb];return _0x2dbcd0;};'use strict';var WhatsappAccountEvents=require(_0x76e6('0x0'));var events=[_0x76e6('0x1'),_0x76e6('0x2'),_0x76e6('0x3')];function createListener(_0xd6fa95,_0x387839){return function(_0x41d09c){_0x387839[_0x76e6('0x4')](_0xd6fa95,_0x41d09c);};}function removeListener(_0x157b6b,_0x5b4ac8){return function(){WhatsappAccountEvents[_0x76e6('0x5')](_0x157b6b,_0x5b4ac8);};}exports[_0x76e6('0x6')]=function(_0x48a533){for(var _0x3a6842=0x0,_0x1fce10=events['length'];_0x3a6842<_0x1fce10;_0x3a6842++){var _0x411af8=events[_0x3a6842];var _0x2d7ea3=createListener('whatsappAccount:'+_0x411af8,_0x48a533);WhatsappAccountEvents['on'](_0x411af8,_0x2d7ea3);}}; \ No newline at end of file +var _0xa146=['removeListener','register','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit'];(function(_0x1a0c8f,_0x500a58){var _0x5454cf=function(_0x56af60){while(--_0x56af60){_0x1a0c8f['push'](_0x1a0c8f['shift']());}};_0x5454cf(++_0x500a58);}(_0xa146,0x11b));var _0x6a14=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xa146[_0x18ab2a];return _0x16dcee;};'use strict';var WhatsappAccountEvents=require(_0x6a14('0x0'));var events=[_0x6a14('0x1'),_0x6a14('0x2'),_0x6a14('0x3')];function createListener(_0x5b3bab,_0x18265b){return function(_0xf8b9dd){_0x18265b[_0x6a14('0x4')](_0x5b3bab,_0xf8b9dd);};}function removeListener(_0x1d8c07,_0x1deb4a){return function(){WhatsappAccountEvents[_0x6a14('0x5')](_0x1d8c07,_0x1deb4a);};}exports[_0x6a14('0x6')]=function(_0x3abbce){for(var _0x4187e5=0x0,_0x4c3fb7=events['length'];_0x4187e5<_0x4c3fb7;_0x4187e5++){var _0x371454=events[_0x4187e5];var _0x3a7c2b=createListener(_0x6a14('0x7')+_0x371454,_0x3abbce);WhatsappAccountEvents['on'](_0x371454,_0x3a7c2b);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 5e9a9bb..9f373bf 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 _0x1449=['/:id','show','post','create','put','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index'];(function(_0x55c6f3,_0x460265){var _0x53d5b1=function(_0x5a5e31){while(--_0x5a5e31){_0x55c6f3['push'](_0x55c6f3['shift']());}};_0x53d5b1(++_0x460265);}(_0x1449,0xcd));var _0x9144=function(_0x343e44,_0x519af9){_0x343e44=_0x343e44-0x0;var _0xa5130e=_0x1449[_0x343e44];return _0xa5130e;};'use strict';var multer=require('multer');var util=require(_0x9144('0x0'));var path=require(_0x9144('0x1'));var timeout=require(_0x9144('0x2'));var express=require(_0x9144('0x3'));var router=express['Router']();var fs_extra=require(_0x9144('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9144('0x5'));var config=require(_0x9144('0x6'));var controller=require(_0x9144('0x7'));router[_0x9144('0x8')]('/',auth[_0x9144('0x9')](),controller[_0x9144('0xa')]);router[_0x9144('0x8')](_0x9144('0xb'),auth[_0x9144('0x9')](),controller[_0x9144('0xc')]);router[_0x9144('0xd')]('/',auth[_0x9144('0x9')](),controller[_0x9144('0xe')]);router[_0x9144('0xf')](_0x9144('0xb'),auth[_0x9144('0x9')](),controller['update']);router[_0x9144('0x10')](_0x9144('0xb'),auth[_0x9144('0x9')](),controller['destroy']);module[_0x9144('0x11')]=router; \ No newline at end of file +var _0x32db=['create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','post'];(function(_0x40e075,_0x422fc6){var _0x42c78e=function(_0x46b10e){while(--_0x46b10e){_0x40e075['push'](_0x40e075['shift']());}};_0x42c78e(++_0x422fc6);}(_0x32db,0x9d));var _0xb32d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x32db[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb32d('0x0'));var util=require('util');var path=require(_0xb32d('0x1'));var timeout=require(_0xb32d('0x2'));var express=require(_0xb32d('0x3'));var router=express[_0xb32d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb32d('0x5'));var interaction=require(_0xb32d('0x6'));var config=require(_0xb32d('0x7'));var controller=require(_0xb32d('0x8'));router[_0xb32d('0x9')]('/',auth[_0xb32d('0xa')](),controller[_0xb32d('0xb')]);router[_0xb32d('0x9')](_0xb32d('0xc'),auth[_0xb32d('0xa')](),controller['show']);router[_0xb32d('0xd')]('/',auth[_0xb32d('0xa')](),controller[_0xb32d('0xe')]);router[_0xb32d('0xf')]('/:id',auth[_0xb32d('0xa')](),controller[_0xb32d('0x10')]);router['delete']('/:id',auth[_0xb32d('0xa')](),controller[_0xb32d('0x11')]);module[_0xb32d('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 3d94b61..e0661a1 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 _0xadd1=['noop','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x29d932,_0x97f2a7){var _0x5cd611=function(_0x33e548){while(--_0x33e548){_0x29d932['push'](_0x29d932['shift']());}};_0x5cd611(++_0x97f2a7);}(_0xadd1,0xbb));var _0x1add=function(_0x2bc2e5,_0x297923){_0x2bc2e5=_0x2bc2e5-0x0;var _0x29ad46=_0xadd1[_0x2bc2e5];return _0x29ad46;};'use strict';var Sequelize=require(_0x1add('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1add('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1add('0x2')],'allowNull':![],'defaultValue':_0x1add('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1add('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1add('0x4')}}; \ No newline at end of file +var _0xd613=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x4877bc,_0x24b542){var _0x296c34=function(_0x45e2b0){while(--_0x45e2b0){_0x4877bc['push'](_0x4877bc['shift']());}};_0x296c34(++_0x24b542);}(_0xd613,0x110));var _0x3d61=function(_0x40c5cc,_0x4805df){_0x40c5cc=_0x40c5cc-0x0;var _0x33955f=_0xd613[_0x40c5cc];return _0x33955f;};'use strict';var Sequelize=require(_0x3d61('0x0'));module[_0x3d61('0x1')]={'priority':{'type':Sequelize[_0x3d61('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3d61('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3d61('0x4')]()},'description':{'type':Sequelize[_0x3d61('0x3')]},'interval':{'type':Sequelize[_0x3d61('0x3')],'defaultValue':_0x3d61('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index c4fcf1c..6e8369c 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 _0x0ca4=['query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','options','includeAll','findAll','catch','show','params','intersection','length','include','find','create','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','error','name','send','merge','body','contact','message','agent','interaction','account','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model'];(function(_0x328a64,_0x43fa04){var _0x181e8f=function(_0xa2fce){while(--_0xa2fce){_0x328a64['push'](_0x328a64['shift']());}};_0x181e8f(++_0x43fa04);}(_0x0ca4,0x10b));var _0x40ca=function(_0x557786,_0x1b1ae6){_0x557786=_0x557786-0x0;var _0x4e2751=_0x0ca4[_0x557786];return _0x4e2751;};'use strict';var emlformat=require(_0x40ca('0x0'));var rimraf=require(_0x40ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40ca('0x2'));var rp=require(_0x40ca('0x3'));var moment=require(_0x40ca('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x40ca('0x5'));var util=require(_0x40ca('0x6'));var path=require(_0x40ca('0x7'));var sox=require(_0x40ca('0x8'));var csv=require('to-csv');var ejs=require(_0x40ca('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x40ca('0xa'));var squel=require(_0x40ca('0xb'));var crypto=require(_0x40ca('0xc'));var jsforce=require(_0x40ca('0xd'));var deskjs=require(_0x40ca('0xe'));var toCsv=require(_0x40ca('0xf'));var querystring=require(_0x40ca('0x10'));var Papa=require(_0x40ca('0x11'));var Redis=require(_0x40ca('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x40ca('0x13'));var as=require(_0x40ca('0x14'));var hardwareService=require(_0x40ca('0x15'));var logger=require(_0x40ca('0x16'))(_0x40ca('0x17'));var utils=require('../../config/utils');var config=require(_0x40ca('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x40ca('0x19'))['db'];function respondWithStatusCode(_0x121c64,_0x16a7dc){_0x16a7dc=_0x16a7dc||0xcc;return function(_0x3335a6){if(_0x3335a6){return _0x121c64[_0x40ca('0x1a')](_0x16a7dc);}return _0x121c64[_0x40ca('0x1b')](_0x16a7dc)['end']();};}function respondWithResult(_0x559672,_0x18ae69){_0x18ae69=_0x18ae69||0xc8;return function(_0x544901){if(_0x544901){return _0x559672[_0x40ca('0x1b')](_0x18ae69)[_0x40ca('0x1c')](_0x544901);}};}function respondWithFilteredResult(_0xadeffb,_0x1fece9){return function(_0x539bb2){if(_0x539bb2){var _0x1bb13c=typeof _0x1fece9['offset']===_0x40ca('0x1d')&&typeof _0x1fece9['limit']===_0x40ca('0x1d');var _0x5c6260=_0x539bb2[_0x40ca('0x1e')];var _0x130f59=_0x1bb13c?0x0:_0x1fece9['offset'];var _0x949f69=_0x1bb13c?_0x539bb2['count']:_0x1fece9[_0x40ca('0x1f')]+_0x1fece9['limit'];var _0x331e89;if(_0x949f69>=_0x5c6260){_0x949f69=_0x5c6260;_0x331e89=0xc8;}else{_0x331e89=0xce;}_0xadeffb[_0x40ca('0x1b')](_0x331e89);return _0xadeffb[_0x40ca('0x20')](_0x40ca('0x21'),_0x130f59+'-'+_0x949f69+'/'+_0x5c6260)[_0x40ca('0x1c')](_0x539bb2);}return null;};}function patchUpdates(_0x1f5623){return function(_0x15e83d){try{jsonpatch['apply'](_0x15e83d,_0x1f5623,!![]);}catch(_0x2cf577){return BPromise[_0x40ca('0x22')](_0x2cf577);}return _0x15e83d[_0x40ca('0x23')]();};}function saveUpdates(_0x541062,_0xc735c5){return function(_0x244640){if(_0x244640){return _0x244640[_0x40ca('0x24')](_0x541062)[_0x40ca('0x25')](function(_0xb92b7){return _0xb92b7;});}return null;};}function removeEntity(_0x18d712,_0x195048){return function(_0x68930b){if(_0x68930b){return _0x68930b[_0x40ca('0x26')]()[_0x40ca('0x25')](function(){_0x18d712[_0x40ca('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a8113,_0x283c08){return function(_0x5d5bb1){if(!_0x5d5bb1){_0x2a8113[_0x40ca('0x1a')](0x194);}return _0x5d5bb1;};}function handleError(_0x36591c,_0x4e7278){_0x4e7278=_0x4e7278||0x1f4;return function(_0x2a830f){logger[_0x40ca('0x27')](_0x2a830f['stack']);if(_0x2a830f[_0x40ca('0x28')]){delete _0x2a830f[_0x40ca('0x28')];}_0x36591c[_0x40ca('0x1b')](_0x4e7278)[_0x40ca('0x29')](_0x2a830f);};}function getMustacheRender(_0x43e0d5,_0x49f5a1){return Mustache['render'](_0x43e0d5,_[_0x40ca('0x2a')](_0x49f5a1[_0x40ca('0x2b')],{'contact':_0x49f5a1[_0x40ca('0x2c')],'message':_0x49f5a1[_0x40ca('0x2d')],'agent':_0x49f5a1[_0x40ca('0x2e')],'interaction':_0x49f5a1[_0x40ca('0x2f')],'account':_0x49f5a1[_0x40ca('0x30')]}))||'';}exports[_0x40ca('0x31')]=function(_0x569219,_0x281a70){var _0x52d390={},_0x54b761={},_0x435dfd={'count':0x0,'rows':[]};var _0x28ff88=_[_0x40ca('0x32')](db[_0x40ca('0x33')][_0x40ca('0x34')],function(_0x720ee8){return{'name':_0x720ee8[_0x40ca('0x35')],'type':_0x720ee8[_0x40ca('0x36')][_0x40ca('0x37')]};});_0x54b761[_0x40ca('0x38')]=_[_0x40ca('0x32')](_0x28ff88,_0x40ca('0x28'));_0x54b761[_0x40ca('0x39')]=_[_0x40ca('0x3a')](_0x569219[_0x40ca('0x39')]);_0x54b761[_0x40ca('0x3b')]=_['intersection'](_0x54b761[_0x40ca('0x38')],_0x54b761['query']);_0x52d390[_0x40ca('0x3c')]=_['intersection'](_0x54b761['model'],qs[_0x40ca('0x3d')](_0x569219[_0x40ca('0x39')][_0x40ca('0x3d')]));_0x52d390[_0x40ca('0x3c')]=_0x52d390[_0x40ca('0x3c')]['length']?_0x52d390[_0x40ca('0x3c')]:_0x54b761[_0x40ca('0x38')];if(!_0x569219['query'][_0x40ca('0x3e')](_0x40ca('0x3f'))){_0x52d390[_0x40ca('0x40')]=qs[_0x40ca('0x40')](_0x569219[_0x40ca('0x39')][_0x40ca('0x40')]);_0x52d390[_0x40ca('0x1f')]=qs[_0x40ca('0x1f')](_0x569219[_0x40ca('0x39')]['offset']);}_0x52d390[_0x40ca('0x41')]=qs['sort'](_0x569219[_0x40ca('0x39')][_0x40ca('0x42')]);_0x52d390['where']=qs[_0x40ca('0x3b')](_[_0x40ca('0x43')](_0x569219['query'],_0x54b761[_0x40ca('0x3b')]),_0x28ff88);if(_0x569219[_0x40ca('0x39')][_0x40ca('0x44')]){_0x52d390[_0x40ca('0x45')]=_['merge'](_0x52d390[_0x40ca('0x45')],{'$or':_[_0x40ca('0x32')](_0x28ff88,function(_0x42f757){if(_0x42f757[_0x40ca('0x36')]!=='VIRTUAL'){var _0xb10ffc={};_0xb10ffc[_0x42f757[_0x40ca('0x28')]]={'$like':'%'+_0x569219[_0x40ca('0x39')][_0x40ca('0x44')]+'%'};return _0xb10ffc;}})});}_0x52d390=_['merge']({},_0x52d390,_0x569219[_0x40ca('0x46')]);var _0x209e41={'where':_0x52d390[_0x40ca('0x45')]};return db[_0x40ca('0x33')][_0x40ca('0x1e')](_0x209e41)['then'](function(_0x3fc220){_0x435dfd[_0x40ca('0x1e')]=_0x3fc220;if(_0x569219[_0x40ca('0x39')][_0x40ca('0x47')]){_0x52d390['include']=[{'all':!![]}];}return db[_0x40ca('0x33')][_0x40ca('0x48')](_0x52d390);})[_0x40ca('0x25')](function(_0x7ab6be){_0x435dfd['rows']=_0x7ab6be;return _0x435dfd;})[_0x40ca('0x25')](respondWithFilteredResult(_0x281a70,_0x52d390))[_0x40ca('0x49')](handleError(_0x281a70,null));};exports[_0x40ca('0x4a')]=function(_0x447b1d,_0x5a5ce9){var _0x1533f7={'raw':!![],'where':{'id':_0x447b1d[_0x40ca('0x4b')]['id']}},_0x201228={};_0x201228[_0x40ca('0x38')]=_[_0x40ca('0x3a')](db[_0x40ca('0x33')][_0x40ca('0x34')]);_0x201228[_0x40ca('0x39')]=_[_0x40ca('0x3a')](_0x447b1d[_0x40ca('0x39')]);_0x201228[_0x40ca('0x3b')]=_[_0x40ca('0x4c')](_0x201228[_0x40ca('0x38')],_0x201228[_0x40ca('0x39')]);_0x1533f7[_0x40ca('0x3c')]=_[_0x40ca('0x4c')](_0x201228[_0x40ca('0x38')],qs[_0x40ca('0x3d')](_0x447b1d[_0x40ca('0x39')]['fields']));_0x1533f7[_0x40ca('0x3c')]=_0x1533f7[_0x40ca('0x3c')][_0x40ca('0x4d')]?_0x1533f7[_0x40ca('0x3c')]:_0x201228[_0x40ca('0x38')];if(_0x447b1d[_0x40ca('0x39')][_0x40ca('0x47')]){_0x1533f7[_0x40ca('0x4e')]=[{'all':!![]}];}_0x1533f7=_[_0x40ca('0x2a')]({},_0x1533f7,_0x447b1d[_0x40ca('0x46')]);return db[_0x40ca('0x33')][_0x40ca('0x4f')](_0x1533f7)['then'](handleEntityNotFound(_0x5a5ce9,null))[_0x40ca('0x25')](respondWithResult(_0x5a5ce9,null))[_0x40ca('0x49')](handleError(_0x5a5ce9,null));};exports[_0x40ca('0x50')]=function(_0x3dc604,_0x3840c0){return db[_0x40ca('0x33')][_0x40ca('0x50')](_0x3dc604[_0x40ca('0x2b')],{})['then'](respondWithResult(_0x3840c0,0xc9))['catch'](handleError(_0x3840c0,null));};exports[_0x40ca('0x24')]=function(_0x4e3f96,_0xc702ab){if(_0x4e3f96[_0x40ca('0x2b')]['id']){delete _0x4e3f96[_0x40ca('0x2b')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x4e3f96[_0x40ca('0x4b')]['id']}})[_0x40ca('0x25')](handleEntityNotFound(_0xc702ab,null))[_0x40ca('0x25')](saveUpdates(_0x4e3f96['body'],null))['then'](respondWithResult(_0xc702ab,null))['catch'](handleError(_0xc702ab,null));};exports['destroy']=function(_0x2417c0,_0x2915b5){return db[_0x40ca('0x33')]['find']({'where':{'id':_0x2417c0['params']['id']}})[_0x40ca('0x25')](handleEntityNotFound(_0x2915b5,null))[_0x40ca('0x25')](removeEntity(_0x2915b5,null))[_0x40ca('0x49')](handleError(_0x2915b5,null));}; \ No newline at end of file +var _0x1dcb=['count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','render','merge','contact','agent','interaction','account','index','WhatsappApplication','rawAttributes','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','include','rows','catch','show','params','includeAll','create','body','find','rimraf','zip-dir','fast-json-patch','path','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit'];(function(_0x18d28a,_0x3a9c65){var _0x46dcab=function(_0x8fd892){while(--_0x8fd892){_0x18d28a['push'](_0x18d28a['shift']());}};_0x46dcab(++_0x3a9c65);}(_0x1dcb,0x79));var _0xb1dc=function(_0x10397a,_0x2f7526){_0x10397a=_0x10397a-0x0;var _0x10d3cb=_0x1dcb[_0x10397a];return _0x10d3cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1dc('0x0'));var zipdir=require(_0xb1dc('0x1'));var jsonpatch=require(_0xb1dc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb1dc('0x3'));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(_0xb1dc('0x4'));var squel=require(_0xb1dc('0x5'));var crypto=require('crypto');var jsforce=require(_0xb1dc('0x6'));var deskjs=require(_0xb1dc('0x7'));var toCsv=require(_0xb1dc('0x8'));var querystring=require('querystring');var Papa=require(_0xb1dc('0x9'));var Redis=require(_0xb1dc('0xa'));var authService=require(_0xb1dc('0xb'));var qs=require(_0xb1dc('0xc'));var as=require(_0xb1dc('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb1dc('0xe'));var config=require(_0xb1dc('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0xb1dc('0x10'))['db'];function respondWithStatusCode(_0x960ea3,_0x1e0002){_0x1e0002=_0x1e0002||0xcc;return function(_0x19dff2){if(_0x19dff2){return _0x960ea3[_0xb1dc('0x11')](_0x1e0002);}return _0x960ea3['status'](_0x1e0002)['end']();};}function respondWithResult(_0x5659cc,_0xd640c4){_0xd640c4=_0xd640c4||0xc8;return function(_0x34ec70){if(_0x34ec70){return _0x5659cc[_0xb1dc('0x12')](_0xd640c4)['json'](_0x34ec70);}};}function respondWithFilteredResult(_0xe64b6a,_0x5067a5){return function(_0x28f106){if(_0x28f106){var _0x2e40b2=typeof _0x5067a5['offset']===_0xb1dc('0x13')&&typeof _0x5067a5[_0xb1dc('0x14')]===_0xb1dc('0x13');var _0x292f66=_0x28f106[_0xb1dc('0x15')];var _0x28bd72=_0x2e40b2?0x0:_0x5067a5[_0xb1dc('0x16')];var _0xe4f0a=_0x2e40b2?_0x28f106['count']:_0x5067a5['offset']+_0x5067a5[_0xb1dc('0x14')];var _0x33b571;if(_0xe4f0a>=_0x292f66){_0xe4f0a=_0x292f66;_0x33b571=0xc8;}else{_0x33b571=0xce;}_0xe64b6a[_0xb1dc('0x12')](_0x33b571);return _0xe64b6a[_0xb1dc('0x17')](_0xb1dc('0x18'),_0x28bd72+'-'+_0xe4f0a+'/'+_0x292f66)[_0xb1dc('0x19')](_0x28f106);}return null;};}function patchUpdates(_0x886dc){return function(_0x3870f9){try{jsonpatch[_0xb1dc('0x1a')](_0x3870f9,_0x886dc,!![]);}catch(_0x3f81dc){return BPromise[_0xb1dc('0x1b')](_0x3f81dc);}return _0x3870f9[_0xb1dc('0x1c')]();};}function saveUpdates(_0x145fb6,_0x32b02c){return function(_0x4a08bc){if(_0x4a08bc){return _0x4a08bc[_0xb1dc('0x1d')](_0x145fb6)[_0xb1dc('0x1e')](function(_0x547f06){return _0x547f06;});}return null;};}function removeEntity(_0x3499e0,_0x26991e){return function(_0x2cf0ab){if(_0x2cf0ab){return _0x2cf0ab[_0xb1dc('0x1f')]()[_0xb1dc('0x1e')](function(){_0x3499e0[_0xb1dc('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1612be,_0x3c3f32){return function(_0x3ce2e0){if(!_0x3ce2e0){_0x1612be[_0xb1dc('0x11')](0x194);}return _0x3ce2e0;};}function handleError(_0xa7c450,_0x562f1c){_0x562f1c=_0x562f1c||0x1f4;return function(_0x1ccf25){logger[_0xb1dc('0x20')](_0x1ccf25['stack']);if(_0x1ccf25[_0xb1dc('0x21')]){delete _0x1ccf25['name'];}_0xa7c450[_0xb1dc('0x12')](_0x562f1c)[_0xb1dc('0x22')](_0x1ccf25);};}function getMustacheRender(_0x25707d,_0x3c69c6){return Mustache[_0xb1dc('0x23')](_0x25707d,_[_0xb1dc('0x24')](_0x3c69c6['body'],{'contact':_0x3c69c6[_0xb1dc('0x25')],'message':_0x3c69c6['message'],'agent':_0x3c69c6[_0xb1dc('0x26')],'interaction':_0x3c69c6[_0xb1dc('0x27')],'account':_0x3c69c6[_0xb1dc('0x28')]}))||'';}exports[_0xb1dc('0x29')]=function(_0x419e2c,_0x130c00){var _0x308031={},_0x26feaa={},_0x45c533={'count':0x0,'rows':[]};var _0x5ccc3a=_['map'](db[_0xb1dc('0x2a')][_0xb1dc('0x2b')],function(_0x2ba131){return{'name':_0x2ba131['fieldName'],'type':_0x2ba131['type'][_0xb1dc('0x2c')]};});_0x26feaa[_0xb1dc('0x2d')]=_[_0xb1dc('0x2e')](_0x5ccc3a,_0xb1dc('0x21'));_0x26feaa[_0xb1dc('0x2f')]=_[_0xb1dc('0x30')](_0x419e2c[_0xb1dc('0x2f')]);_0x26feaa[_0xb1dc('0x31')]=_['intersection'](_0x26feaa[_0xb1dc('0x2d')],_0x26feaa[_0xb1dc('0x2f')]);_0x308031[_0xb1dc('0x32')]=_[_0xb1dc('0x33')](_0x26feaa['model'],qs[_0xb1dc('0x34')](_0x419e2c[_0xb1dc('0x2f')][_0xb1dc('0x34')]));_0x308031[_0xb1dc('0x32')]=_0x308031[_0xb1dc('0x32')][_0xb1dc('0x35')]?_0x308031[_0xb1dc('0x32')]:_0x26feaa['model'];if(!_0x419e2c[_0xb1dc('0x2f')][_0xb1dc('0x36')](_0xb1dc('0x37'))){_0x308031[_0xb1dc('0x14')]=qs[_0xb1dc('0x14')](_0x419e2c[_0xb1dc('0x2f')]['limit']);_0x308031[_0xb1dc('0x16')]=qs[_0xb1dc('0x16')](_0x419e2c['query'][_0xb1dc('0x16')]);}_0x308031[_0xb1dc('0x38')]=qs['sort'](_0x419e2c[_0xb1dc('0x2f')][_0xb1dc('0x39')]);_0x308031[_0xb1dc('0x3a')]=qs[_0xb1dc('0x31')](_['pick'](_0x419e2c['query'],_0x26feaa[_0xb1dc('0x31')]),_0x5ccc3a);if(_0x419e2c['query'][_0xb1dc('0x3b')]){_0x308031[_0xb1dc('0x3a')]=_['merge'](_0x308031[_0xb1dc('0x3a')],{'$or':_[_0xb1dc('0x2e')](_0x5ccc3a,function(_0x9bf52b){if(_0x9bf52b[_0xb1dc('0x3c')]!==_0xb1dc('0x3d')){var _0x13fa54={};_0x13fa54[_0x9bf52b['name']]={'$like':'%'+_0x419e2c['query'][_0xb1dc('0x3b')]+'%'};return _0x13fa54;}})});}_0x308031=_[_0xb1dc('0x24')]({},_0x308031,_0x419e2c['options']);var _0x4d63db={'where':_0x308031[_0xb1dc('0x3a')]};return db[_0xb1dc('0x2a')][_0xb1dc('0x15')](_0x4d63db)[_0xb1dc('0x1e')](function(_0x58882c){_0x45c533[_0xb1dc('0x15')]=_0x58882c;if(_0x419e2c[_0xb1dc('0x2f')]['includeAll']){_0x308031[_0xb1dc('0x3e')]=[{'all':!![]}];}return db[_0xb1dc('0x2a')]['findAll'](_0x308031);})[_0xb1dc('0x1e')](function(_0x13e25f){_0x45c533[_0xb1dc('0x3f')]=_0x13e25f;return _0x45c533;})[_0xb1dc('0x1e')](respondWithFilteredResult(_0x130c00,_0x308031))[_0xb1dc('0x40')](handleError(_0x130c00,null));};exports[_0xb1dc('0x41')]=function(_0x4b8b21,_0x1ed653){var _0x3deb59={'raw':!![],'where':{'id':_0x4b8b21[_0xb1dc('0x42')]['id']}},_0x3c08a4={};_0x3c08a4[_0xb1dc('0x2d')]=_[_0xb1dc('0x30')](db['WhatsappApplication'][_0xb1dc('0x2b')]);_0x3c08a4[_0xb1dc('0x2f')]=_[_0xb1dc('0x30')](_0x4b8b21['query']);_0x3c08a4[_0xb1dc('0x31')]=_[_0xb1dc('0x33')](_0x3c08a4[_0xb1dc('0x2d')],_0x3c08a4[_0xb1dc('0x2f')]);_0x3deb59[_0xb1dc('0x32')]=_['intersection'](_0x3c08a4[_0xb1dc('0x2d')],qs['fields'](_0x4b8b21[_0xb1dc('0x2f')][_0xb1dc('0x34')]));_0x3deb59[_0xb1dc('0x32')]=_0x3deb59[_0xb1dc('0x32')][_0xb1dc('0x35')]?_0x3deb59[_0xb1dc('0x32')]:_0x3c08a4[_0xb1dc('0x2d')];if(_0x4b8b21[_0xb1dc('0x2f')][_0xb1dc('0x43')]){_0x3deb59[_0xb1dc('0x3e')]=[{'all':!![]}];}_0x3deb59=_['merge']({},_0x3deb59,_0x4b8b21['options']);return db[_0xb1dc('0x2a')]['find'](_0x3deb59)[_0xb1dc('0x1e')](handleEntityNotFound(_0x1ed653,null))[_0xb1dc('0x1e')](respondWithResult(_0x1ed653,null))[_0xb1dc('0x40')](handleError(_0x1ed653,null));};exports[_0xb1dc('0x44')]=function(_0x5ecc64,_0x154a1c){return db['WhatsappApplication'][_0xb1dc('0x44')](_0x5ecc64[_0xb1dc('0x45')],{})['then'](respondWithResult(_0x154a1c,0xc9))[_0xb1dc('0x40')](handleError(_0x154a1c,null));};exports[_0xb1dc('0x1d')]=function(_0x184855,_0x2ecb99){if(_0x184855[_0xb1dc('0x45')]['id']){delete _0x184855['body']['id'];}return db[_0xb1dc('0x2a')][_0xb1dc('0x46')]({'where':{'id':_0x184855[_0xb1dc('0x42')]['id']}})[_0xb1dc('0x1e')](handleEntityNotFound(_0x2ecb99,null))[_0xb1dc('0x1e')](saveUpdates(_0x184855[_0xb1dc('0x45')],null))[_0xb1dc('0x1e')](respondWithResult(_0x2ecb99,null))[_0xb1dc('0x40')](handleError(_0x2ecb99,null));};exports[_0xb1dc('0x1f')]=function(_0x6a3f26,_0x405f5e){return db[_0xb1dc('0x2a')][_0xb1dc('0x46')]({'where':{'id':_0x6a3f26['params']['id']}})[_0xb1dc('0x1e')](handleEntityNotFound(_0x405f5e,null))[_0xb1dc('0x1e')](removeEntity(_0x405f5e,null))['catch'](handleError(_0x405f5e,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index d99c243..d89613d 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 _0xe97c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','whatsapp_applications','util'];(function(_0x27fe26,_0x3b8ca7){var _0x4fcb35=function(_0x35e0ae){while(--_0x35e0ae){_0x27fe26['push'](_0x27fe26['shift']());}};_0x4fcb35(++_0x3b8ca7);}(_0xe97c,0x8f));var _0xce97=function(_0x300968,_0x28ef05){_0x300968=_0x300968-0x0;var _0xe2620c=_0xe97c[_0x300968];return _0xe2620c;};'use strict';var _=require('lodash');var util=require(_0xce97('0x0'));var logger=require(_0xce97('0x1'))(_0xce97('0x2'));var moment=require(_0xce97('0x3'));var BPromise=require(_0xce97('0x4'));var rp=require(_0xce97('0x5'));var fs=require('fs');var path=require(_0xce97('0x6'));var rimraf=require(_0xce97('0x7'));var config=require(_0xce97('0x8'));var attributes=require('./whatsappApplication.attributes');module[_0xce97('0x9')]=function(_0x27bd82,_0x2f7d78){return _0x27bd82[_0xce97('0xa')]('WhatsappApplication',attributes,{'tableName':_0xce97('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x578f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x3ef2d5,_0x423d46){var _0x2fefb2=function(_0x54f82f){while(--_0x54f82f){_0x3ef2d5['push'](_0x3ef2d5['shift']());}};_0x2fefb2(++_0x423d46);}(_0x578f,0x143));var _0xf578=function(_0x41dca0,_0x51380a){_0x41dca0=_0x41dca0-0x0;var _0x3cabe3=_0x578f[_0x41dca0];return _0x3cabe3;};'use strict';var _=require(_0xf578('0x0'));var util=require(_0xf578('0x1'));var logger=require('../../config/logger')(_0xf578('0x2'));var moment=require(_0xf578('0x3'));var BPromise=require(_0xf578('0x4'));var rp=require(_0xf578('0x5'));var fs=require('fs');var path=require(_0xf578('0x6'));var rimraf=require(_0xf578('0x7'));var config=require(_0xf578('0x8'));var attributes=require('./whatsappApplication.attributes');module[_0xf578('0x9')]=function(_0x398288,_0x3b8e8){return _0x398288['define']('WhatsappApplication',attributes,{'tableName':_0xf578('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf578('0xb'),'collate':_0xf578('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 36749e2..dffd0f2 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 _0xd6d2=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x5cee84,_0x548078){_0x5cee84=_0x5cee84-0x0;var _0x48723e=_0xd6d2[_0x5cee84];return _0x48723e;};'use strict';var _=require(_0x2d6d('0x0'));var util=require(_0x2d6d('0x1'));var moment=require('moment');var BPromise=require(_0x2d6d('0x2'));var rs=require(_0x2d6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d6d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d6d('0x5'))(_0x2d6d('0x6'));var config=require(_0x2d6d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2d6d('0x8')][_0x2d6d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf59b20,_0x45b7b9,_0x4002b7){return new BPromise(function(_0x42d802,_0x1cab9b){return client[_0x2d6d('0xa')](_0xf59b20,_0x4002b7)[_0x2d6d('0xb')](function(_0x261959){logger[_0x2d6d('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x45b7b9,_0x2d6d('0xd'));logger[_0x2d6d('0xe')](_0x2d6d('0xf'),_0x45b7b9,_0x2d6d('0xd'),JSON[_0x2d6d('0x10')](_0x261959));if(_0x261959['error']){if(_0x261959[_0x2d6d('0x11')][_0x2d6d('0x12')]===0x1f4){logger[_0x2d6d('0x11')](_0x2d6d('0x13'),_0x45b7b9,_0x261959[_0x2d6d('0x11')]['message']);return _0x1cab9b(_0x261959[_0x2d6d('0x11')][_0x2d6d('0x14')]);}logger[_0x2d6d('0x11')](_0x2d6d('0x13'),_0x45b7b9,_0x261959['error'][_0x2d6d('0x14')]);return _0x42d802(_0x261959[_0x2d6d('0x11')]['message']);}else{logger['info'](_0x2d6d('0x13'),_0x45b7b9,_0x2d6d('0xd'));_0x42d802(_0x261959[_0x2d6d('0x15')]['message']);}})[_0x2d6d('0x16')](function(_0x5b8d81){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x45b7b9,_0x5b8d81);_0x1cab9b(_0x5b8d81);});});} \ No newline at end of file +var _0x4351=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xa0fa61,_0x362cba){var _0x1b1878=function(_0x488f4b){while(--_0x488f4b){_0xa0fa61['push'](_0xa0fa61['shift']());}};_0x1b1878(++_0x362cba);}(_0x4351,0x1b5));var _0x1435=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x4351[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x1435('0x0'));var util=require(_0x1435('0x1'));var moment=require(_0x1435('0x2'));var BPromise=require(_0x1435('0x3'));var rs=require(_0x1435('0x4'));var fs=require('fs');var Redis=require(_0x1435('0x5'));var db=require(_0x1435('0x6'))['db'];var utils=require(_0x1435('0x7'));var logger=require(_0x1435('0x8'))(_0x1435('0x9'));var config=require(_0x1435('0xa'));var jayson=require(_0x1435('0xb'));var client=jayson[_0x1435('0xc')][_0x1435('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x337fd6,_0x56ce86,_0x10760d){return new BPromise(function(_0x5de4b0,_0x4d04c7){return client[_0x1435('0xe')](_0x337fd6,_0x10760d)[_0x1435('0xf')](function(_0x14a9e1){logger[_0x1435('0x10')](_0x1435('0x11'),_0x56ce86,'request\x20sent');logger[_0x1435('0x12')](_0x1435('0x13'),_0x56ce86,'request\x20sent',JSON['stringify'](_0x14a9e1));if(_0x14a9e1[_0x1435('0x14')]){if(_0x14a9e1['error'][_0x1435('0x15')]===0x1f4){logger['error'](_0x1435('0x11'),_0x56ce86,_0x14a9e1['error']['message']);return _0x4d04c7(_0x14a9e1['error'][_0x1435('0x16')]);}logger[_0x1435('0x14')](_0x1435('0x11'),_0x56ce86,_0x14a9e1['error']['message']);return _0x5de4b0(_0x14a9e1[_0x1435('0x14')]['message']);}else{logger[_0x1435('0x10')](_0x1435('0x11'),_0x56ce86,_0x1435('0x17'));_0x5de4b0(_0x14a9e1[_0x1435('0x18')][_0x1435('0x16')]);}})[_0x1435('0x19')](function(_0x5ecd){logger[_0x1435('0x14')](_0x1435('0x11'),_0x56ce86,_0x5ecd);_0x4d04c7(_0x5ecd);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 0fb8933..674a8ca 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 _0xfa40=['removeTags','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy'];(function(_0x134fab,_0x3cc4ee){var _0x3db086=function(_0x3b2de3){while(--_0x3b2de3){_0x134fab['push'](_0x134fab['shift']());}};_0x3db086(++_0x3cc4ee);}(_0xfa40,0xc2));var _0x0fa4=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0xfa40[_0xf51c06];return _0x1d5420;};'use strict';var multer=require(_0x0fa4('0x0'));var util=require(_0x0fa4('0x1'));var path=require(_0x0fa4('0x2'));var timeout=require('connect-timeout');var express=require(_0x0fa4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0fa4('0x4'));var interaction=require(_0x0fa4('0x5'));var config=require(_0x0fa4('0x6'));var controller=require(_0x0fa4('0x7'));router[_0x0fa4('0x8')]('/',auth[_0x0fa4('0x9')](),controller[_0x0fa4('0xa')]);router[_0x0fa4('0x8')](_0x0fa4('0xb'),auth[_0x0fa4('0x9')](),controller[_0x0fa4('0xc')]);router[_0x0fa4('0x8')](_0x0fa4('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0fa4('0x8')](_0x0fa4('0xe'),auth[_0x0fa4('0x9')](),controller[_0x0fa4('0xf')]);router[_0x0fa4('0x8')](_0x0fa4('0x10'),auth[_0x0fa4('0x9')](),controller['download']);router[_0x0fa4('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0fa4('0x11')](_0x0fa4('0xe'),auth[_0x0fa4('0x9')](),controller[_0x0fa4('0x12')]);router['post'](_0x0fa4('0x13'),auth[_0x0fa4('0x9')](),interaction[_0x0fa4('0x14')](_0x0fa4('0x15'),_0x0fa4('0x16')),controller[_0x0fa4('0x17')]);router[_0x0fa4('0x18')](_0x0fa4('0xd'),auth['isAuthenticated'](),interaction[_0x0fa4('0x14')](_0x0fa4('0x15'),_0x0fa4('0x19')),controller[_0x0fa4('0x1a')]);router[_0x0fa4('0x1b')]('/:id',auth[_0x0fa4('0x9')](),interaction[_0x0fa4('0x14')](_0x0fa4('0x15'),_0x0fa4('0x1c')),controller[_0x0fa4('0x1d')]);router['delete'](_0x0fa4('0x13'),auth[_0x0fa4('0x9')](),controller[_0x0fa4('0x1e')]);module[_0x0fa4('0x1f')]=router; \ No newline at end of file +var _0x8286=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','whatsappinteraction:addtags','addTags','put','/:id','tracked','whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','exports'];(function(_0x420b13,_0x26a7cf){var _0x33e4eb=function(_0x4a9d7){while(--_0x4a9d7){_0x420b13['push'](_0x420b13['shift']());}};_0x33e4eb(++_0x26a7cf);}(_0x8286,0x1ed));var _0x6828=function(_0x33ce05,_0x269397){_0x33ce05=_0x33ce05-0x0;var _0x1c3c73=_0x8286[_0x33ce05];return _0x1c3c73;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6828('0x0'));var timeout=require(_0x6828('0x1'));var express=require('express');var router=express[_0x6828('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6828('0x3'));var interaction=require(_0x6828('0x4'));var config=require(_0x6828('0x5'));var controller=require('./whatsappInteraction.controller');router[_0x6828('0x6')]('/',auth[_0x6828('0x7')](),controller[_0x6828('0x8')]);router['get'](_0x6828('0x9'),auth[_0x6828('0x7')](),controller['describe']);router[_0x6828('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x6828('0xa'),auth[_0x6828('0x7')](),controller[_0x6828('0xb')]);router['get'](_0x6828('0xc'),auth[_0x6828('0x7')](),controller[_0x6828('0xd')]);router[_0x6828('0xe')]('/',auth['isAuthenticated'](),controller[_0x6828('0xf')]);router['post']('/:id/messages',auth[_0x6828('0x7')](),controller[_0x6828('0x10')]);router[_0x6828('0xe')](_0x6828('0x11'),auth[_0x6828('0x7')](),interaction['tracked']('whatsapp',_0x6828('0x12')),controller[_0x6828('0x13')]);router[_0x6828('0x14')](_0x6828('0x15'),auth[_0x6828('0x7')](),interaction[_0x6828('0x16')](_0x6828('0x17'),_0x6828('0x18')),controller[_0x6828('0x19')]);router[_0x6828('0x1a')](_0x6828('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0x6828('0x17'),_0x6828('0x1b')),controller['destroy']);router[_0x6828('0x1a')](_0x6828('0x11'),auth[_0x6828('0x7')](),controller['removeTags']);module[_0x6828('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index a646909..1b68d69 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 _0xf9f4=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf9f4,0x70));var _0x4f9f=function(_0x23d8b3,_0x3b4683){_0x23d8b3=_0x23d8b3-0x0;var _0x2225a4=_0xf9f4[_0x23d8b3];return _0x2225a4;};'use strict';var Sequelize=require(_0x4f9f('0x0'));var moment=require('moment');module[_0x4f9f('0x1')]={'closed':{'type':Sequelize[_0x4f9f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4f9f('0x3')]},'disposition':{'type':Sequelize[_0x4f9f('0x4')]},'secondDisposition':{'type':Sequelize[_0x4f9f('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4f9f('0x4')]},'note':{'type':Sequelize[_0x4f9f('0x4')]},'phone':{'type':Sequelize[_0x4f9f('0x4')]},'read1stAt':{'type':Sequelize[_0x4f9f('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4f9f('0x5')]('in',_0x4f9f('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4f9f('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x85cf=['exports','BOOLEAN','DATE','STRING','ENUM','out','moment'];(function(_0x275f94,_0x2b723a){var _0x302f39=function(_0x47363d){while(--_0x47363d){_0x275f94['push'](_0x275f94['shift']());}};_0x302f39(++_0x2b723a);}(_0x85cf,0x76));var _0xf85c=function(_0x53e9fa,_0x58be07){_0x53e9fa=_0x53e9fa-0x0;var _0x19181f=_0x85cf[_0x53e9fa];return _0x19181f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf85c('0x0'));module[_0xf85c('0x1')]={'closed':{'type':Sequelize[_0xf85c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf85c('0x3')]},'disposition':{'type':Sequelize[_0xf85c('0x4')]},'secondDisposition':{'type':Sequelize[_0xf85c('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf85c('0x4')]},'note':{'type':Sequelize[_0xf85c('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xf85c('0x5')]('in',_0xf85c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf85c('0x5')]('in',_0xf85c('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 8191f15..0654c40 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 _0xbba1=['c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','parseSearch','search','conditions','find','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?','ContactId','buildExpression','text','start','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','some','compact','forEach','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','user','getWhatsappAccounts','isEmpty','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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','ui.WhatsappInteractionId\x20IN\x20?','push','all','show','params','includeAll','include','options','create','describe','addMessage','WhatsappMessage','getMessages','WhatsappInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','ids','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','join','server','tmp','files','attachments','transcript-%d-%s.zip','fullname','firstName','Attachment','Messages','direction','Account','get','mkdirSync','Whatsapp','closedAt','disposition','basename','existsSync','createWriteStream','out','System','lastName','secret','renderFile','root','views','downloadInteraction.html','transcript-','.pdf','log','eml-format','fast-json-patch','request-promise','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','status','end','error','stack','name','render','body','contact','message','agent','interaction','account','Users','TagIds','split','catch','index','WhatsappInteraction','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','whatsapp_interactions'];(function(_0x26ace2,_0x173f19){var _0x4f2f98=function(_0x26369d){while(--_0x26369d){_0x26ace2['push'](_0x26ace2['shift']());}};_0x4f2f98(++_0x173f19);}(_0xbba1,0x17f));var _0x1bba=function(_0x24c849,_0x1aa474){_0x24c849=_0x24c849-0x0;var _0x140637=_0xbba1[_0x24c849];return _0x140637;};'use strict';var emlformat=require(_0x1bba('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1bba('0x1'));var rp=require(_0x1bba('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1bba('0x3'));var util=require('util');var path=require('path');var sox=require(_0x1bba('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1bba('0x5'));var _=require(_0x1bba('0x6'));var squel=require(_0x1bba('0x7'));var crypto=require(_0x1bba('0x8'));var jsforce=require(_0x1bba('0x9'));var deskjs=require(_0x1bba('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1bba('0xb'));var Redis=require('ioredis');var authService=require(_0x1bba('0xc'));var qs=require(_0x1bba('0xd'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x1bba('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1bba('0xf'));var utils=require('../../config/utils');var config=require(_0x1bba('0x10'));var licenseUtil=require(_0x1bba('0x11'));var db=require('../../mysqldb')['db'];config[_0x1bba('0x12')]=_[_0x1bba('0x13')](config[_0x1bba('0x12')],{'host':'localhost','port':0x18eb});var socket=require(_0x1bba('0x14'))(new Redis(config[_0x1bba('0x12')]));require(_0x1bba('0x15'))[_0x1bba('0x16')](socket);function respondWithStatusCode(_0x5d41de,_0x745e25){_0x745e25=_0x745e25||0xcc;return function(_0x2d12fb){if(_0x2d12fb){return _0x5d41de['sendStatus'](_0x745e25);}return _0x5d41de['status'](_0x745e25)['end']();};}function respondWithResult(_0x656aea,_0x52f8b1){_0x52f8b1=_0x52f8b1||0xc8;return function(_0x4a66cd){if(_0x4a66cd){return _0x656aea['status'](_0x52f8b1)[_0x1bba('0x17')](_0x4a66cd);}};}function respondWithFilteredResult(_0x4c6458,_0x5caa43){return function(_0x580539){if(_0x580539){var _0xbaf148=typeof _0x5caa43[_0x1bba('0x18')]===_0x1bba('0x19')&&typeof _0x5caa43[_0x1bba('0x1a')]==='undefined';var _0x1cf6e9=_0x580539['count'];var _0x1ad939=_0xbaf148?0x0:_0x5caa43['offset'];var _0x4fe2bf=_0xbaf148?_0x580539[_0x1bba('0x1b')]:_0x5caa43[_0x1bba('0x18')]+_0x5caa43[_0x1bba('0x1a')];var _0x53fc9b;if(_0x4fe2bf>=_0x1cf6e9){_0x4fe2bf=_0x1cf6e9;_0x53fc9b=0xc8;}else{_0x53fc9b=0xce;}_0x4c6458['status'](_0x53fc9b);return _0x4c6458[_0x1bba('0x1c')](_0x1bba('0x1d'),_0x1ad939+'-'+_0x4fe2bf+'/'+_0x1cf6e9)[_0x1bba('0x17')](_0x580539);}return null;};}function patchUpdates(_0x5e9d06){return function(_0x1638e3){try{jsonpatch[_0x1bba('0x1e')](_0x1638e3,_0x5e9d06,!![]);}catch(_0x5eda49){return BPromise[_0x1bba('0x1f')](_0x5eda49);}return _0x1638e3[_0x1bba('0x20')]();};}function saveUpdates(_0x5728d9,_0x4ab376){return function(_0x497061){if(_0x497061){return _0x497061['update'](_0x5728d9)[_0x1bba('0x21')](function(_0x5d2a91){return _0x5d2a91;});}return null;};}function removeEntity(_0x2c2bdd,_0x23cf89){return function(_0x301c83){if(_0x301c83){return _0x301c83[_0x1bba('0x22')]()['then'](function(){_0x2c2bdd[_0x1bba('0x23')](0xcc)[_0x1bba('0x24')]();});}};}function handleEntityNotFound(_0x53abe7,_0x2afdd5){return function(_0x233a03){if(!_0x233a03){_0x53abe7['sendStatus'](0x194);}return _0x233a03;};}function handleError(_0x1ba4f8,_0x1c0124){_0x1c0124=_0x1c0124||0x1f4;return function(_0x15f62e){logger[_0x1bba('0x25')](_0x15f62e[_0x1bba('0x26')]);if(_0x15f62e[_0x1bba('0x27')]){delete _0x15f62e[_0x1bba('0x27')];}_0x1ba4f8[_0x1bba('0x23')](_0x1c0124)['send'](_0x15f62e);};}function getMustacheRender(_0x173ff4,_0xb6fbe7){return Mustache[_0x1bba('0x28')](_0x173ff4,_['merge'](_0xb6fbe7[_0x1bba('0x29')],{'contact':_0xb6fbe7[_0x1bba('0x2a')],'message':_0xb6fbe7[_0x1bba('0x2b')],'agent':_0xb6fbe7[_0x1bba('0x2c')],'interaction':_0xb6fbe7[_0x1bba('0x2d')],'account':_0xb6fbe7[_0x1bba('0x2e')]}))||'';}function getInteractionUsers(_0x314bde,_0x32e83f){return new BPromise(function(_0x38d982,_0x99a055){try{if(_0x32e83f[_0x314bde['id']]){_0x314bde[_0x1bba('0x2f')]=_['map'](_0x32e83f[_0x314bde['id']],function(_0xa86d73){return{'id':_0xa86d73['id'],'fullname':_0xa86d73['fullname']};});}}catch(_0x186d99){_0x99a055(_0x186d99);}_0x38d982(_0x314bde);});}function getInteractionTags(_0x5d8283,_0x2cac1c){return new BPromise(function(_0x3b21b1,_0xf7ffa3){try{if(_0x5d8283['TagIds']){_0x5d8283['Tags']=[];_0x5d8283[_0x1bba('0x30')][_0x1bba('0x31')](',')['forEach'](function(_0x1e06cd){_0x5d8283['Tags']['push'](_0x2cac1c[_0x1e06cd]);});}delete _0x5d8283[_0x1bba('0x30')];}catch(_0x515638){_0xf7ffa3(_0x515638);}_0x3b21b1(_0x5d8283);});}function updateWhatsappInteraction(_0x54cbe4,_0x4fbee0,_0x273dd3){return new BPromise(function(_0x4a1b56,_0x24a62c){return getInteractionUsers(_0x54cbe4,_0x273dd3)[_0x1bba('0x21')](function(_0x57079e){return getInteractionTags(_0x57079e,_0x4fbee0);})[_0x1bba('0x21')](function(_0xbb96e7){_0x4a1b56(_0xbb96e7);})[_0x1bba('0x32')](function(_0x470bd7){_0x24a62c(_0x470bd7);});});}exports[_0x1bba('0x33')]=function(_0x3c928c,_0x373fc3){var _0x1c4758={},_0x4f6171={},_0x4bec01={'count':0x0,'rows':[]};var _0x1b3352=_['map'](db[_0x1bba('0x34')][_0x1bba('0x35')],function(_0x245114){return{'name':_0x245114['fieldName'],'type':_0x245114['type'][_0x1bba('0x36')]};});_0x4f6171[_0x1bba('0x37')]=_['map'](_0x1b3352,_0x1bba('0x27'));_0x4f6171[_0x1bba('0x38')]=_[_0x1bba('0x39')](_0x3c928c['query']);_0x4f6171[_0x1bba('0x3a')]=_[_0x1bba('0x3b')](_0x4f6171[_0x1bba('0x37')],_0x4f6171[_0x1bba('0x38')]);_0x1c4758[_0x1bba('0x3c')]=_[_0x1bba('0x3b')](_0x4f6171['model'],qs[_0x1bba('0x3d')](_0x3c928c[_0x1bba('0x38')][_0x1bba('0x3d')]));_0x1c4758[_0x1bba('0x3c')]=_0x1c4758[_0x1bba('0x3c')][_0x1bba('0x3e')]?_0x1c4758[_0x1bba('0x3c')]:_0x4f6171[_0x1bba('0x37')];if(!_0x3c928c[_0x1bba('0x38')][_0x1bba('0x3f')](_0x1bba('0x40'))){_0x1c4758[_0x1bba('0x1a')]=qs['limit'](_0x3c928c[_0x1bba('0x38')][_0x1bba('0x1a')]);_0x1c4758[_0x1bba('0x18')]=qs[_0x1bba('0x18')](_0x3c928c['query'][_0x1bba('0x18')]);}_0x1c4758[_0x1bba('0x41')]=qs['sort'](_0x3c928c['query'][_0x1bba('0x42')]);_0x1c4758[_0x1bba('0x43')]=qs[_0x1bba('0x3a')](_[_0x1bba('0x44')](_0x3c928c[_0x1bba('0x38')],_0x4f6171[_0x1bba('0x3a')]),_0x1b3352);var _0x4f093a=[];var _0x55ec16=squel[_0x1bba('0x45')]()[_0x1bba('0x46')]('id')[_0x1bba('0x46')](_0x1bba('0x27'))[_0x1bba('0x46')](_0x1bba('0x47'))[_0x1bba('0x48')](_0x1bba('0x49'));var _0x3a42ad=squel[_0x1bba('0x45')]()[_0x1bba('0x46')](_0x1bba('0x4a'))[_0x1bba('0x46')]('u.fullname')[_0x1bba('0x46')](_0x1bba('0x4b'))[_0x1bba('0x48')](_0x1bba('0x4c'),'ui')[_0x1bba('0x4d')]('users','u','u.id\x20=\x20ui.UserId');var _0x4ae644=squel[_0x1bba('0x45')]()[_0x1bba('0x48')](_0x1bba('0x4e'),'i')[_0x1bba('0x4d')]('cm_contacts','c',_0x1bba('0x4f'))[_0x1bba('0x4d')]('users','o',_0x1bba('0x50'))[_0x1bba('0x4d')](_0x1bba('0x51'),'a',_0x1bba('0x52'))[_0x1bba('0x4d')]('whatsapp_messages','me',_0x1bba('0x53'))['left_join'](_0x1bba('0x54'),'it',_0x1bba('0x55'))[_0x1bba('0x4d')](_0x1bba('0x49'),'t','t.id\x20=\x20it.TagId');var _0x286719=squel[_0x1bba('0x56')]();var _0x392629=[];var _0x1e90aa=squel[_0x1bba('0x56')]();var _0x200dd6;if(_0x3c928c['query']['search']){_0x200dd6=as[_0x1bba('0x57')](_0x3c928c[_0x1bba('0x38')][_0x1bba('0x58')]);var _0x354731=_0x200dd6['sqlOperator'];for(var _0x3b4e9a=0x0;_0x3b4e9a<_0x200dd6[_0x1bba('0x59')][_0x1bba('0x3e')];_0x3b4e9a++){var _0x33844d=_0x200dd6[_0x1bba('0x59')][_0x3b4e9a];var _0x12c007='i';var _0x968dba=_[_0x1bba('0x5a')](_0x1b3352,[_0x1bba('0x27'),_0x33844d[_0x1bba('0x46')]]);if(!_0x968dba){switch(_0x33844d['field']){case'unreadMessages':if(_0x33844d[_0x1bba('0x5b')]==0x1){_0x4ae644[_0x1bba('0x5c')]('`'+_0x33844d[_0x1bba('0x46')]+_0x1bba('0x5d'));}else{_0x4ae644['having']('`'+_0x33844d[_0x1bba('0x46')]+_0x1bba('0x5e'));}break;case _0x1bba('0x5f'):if(_0x33844d[_0x1bba('0x60')]===_0x1bba('0x61')){if(_0x33844d[_0x1bba('0x5b')][_0x1bba('0x31')]('\x20')['length']>0x1){_0x286719[_0x354731](_0x1bba('0x62'),qs[_0x1bba('0x63')](_0x33844d['value']),null);}else{var _0x579ebb='%'+_0x33844d['value']+'%';_0x286719[_0x354731](_0x1bba('0x64'),_0x579ebb,_0x579ebb,_0x579ebb);}}else{_0x968dba=_[_0x1bba('0x5a')](_0x1b3352,[_0x1bba('0x27'),_0x1bba('0x65')]);_0x33844d[_0x1bba('0x46')]='ContactId';_0xffc69b=as[_0x1bba('0x66')](_0x12c007,_0x968dba['type'],_0x33844d);_0x286719[_0x354731](_0xffc69b[_0x1bba('0x67')],_0xffc69b[_0x1bba('0x5b')][_0x1bba('0x68')],_0xffc69b['value'][_0x1bba('0x24')]);}break;case'Tag':var _0x317150=_0x33844d[_0x1bba('0x5b')][_0x1bba('0x31')](',')[_0x1bba('0x69')](function(_0x49788a){return Number(_0x49788a);});_0x317150['forEach'](function(_0x222685){_0x1e90aa['or'](_0x1bba('0x6a'),'%,'+_0x222685+',%');});_0x392629=_['union'](_0x392629,_0x317150);break;case _0x1bba('0x6b'):if(_0x33844d[_0x1bba('0x60')]===_0x1bba('0x61')){_0x286719[_0x354731](_0x1bba('0x6c'),'%'+_0x33844d[_0x1bba('0x5b')]+'%',null);}else{_0x968dba=_[_0x1bba('0x5a')](_0x1b3352,[_0x1bba('0x27'),_0x1bba('0x6d')]);_0x33844d[_0x1bba('0x46')]=_0x1bba('0x6d');_0xffc69b=as[_0x1bba('0x66')](_0x12c007,_0x968dba[_0x1bba('0x6e')],_0x33844d);_0x286719[_0x354731](_0xffc69b[_0x1bba('0x67')],_0xffc69b[_0x1bba('0x5b')][_0x1bba('0x68')],_0xffc69b[_0x1bba('0x5b')]['end']);}break;case'body':_0xffc69b=as[_0x1bba('0x66')]('me',null,_0x33844d);_0x286719[_0x354731](_0xffc69b[_0x1bba('0x67')],_0xffc69b[_0x1bba('0x5b')][_0x1bba('0x68')],_0xffc69b[_0x1bba('0x5b')][_0x1bba('0x24')]);break;}}else{var _0xffc69b=as[_0x1bba('0x66')](_0x12c007,_0x968dba[_0x1bba('0x6e')],_0x33844d);_0x286719[_0x354731](_0xffc69b[_0x1bba('0x67')],_0xffc69b[_0x1bba('0x5b')][_0x1bba('0x68')],_0xffc69b['value']['end']);}}}else{var _0x480193=_(_0x3c928c[_0x1bba('0x38')])[_0x1bba('0x39')]()[_0x1bba('0x69')](function(_0x11b31c){return _[_0x1bba('0x6f')](_0x1b3352,['name',_0x11b31c])?_0x11b31c:undefined;})[_0x1bba('0x70')]()['value']();if(!_['isEmpty'](_0x480193)){_0x480193[_0x1bba('0x71')](function(_0x543d02){if(_0x543d02===_0x1bba('0x72')){_0x4ae644[_0x1bba('0x43')](_0x1bba('0x73'),[][_0x1bba('0x74')](_0x3c928c[_0x1bba('0x38')][_0x543d02]));}else if(_0x543d02===_0x1bba('0x75')){var _0x4586f5=JSON[_0x1bba('0x76')](_0x3c928c[_0x1bba('0x38')][_0x543d02])[_0x1bba('0x77')];var _0x17b986=JSON[_0x1bba('0x76')](_0x3c928c[_0x1bba('0x38')][_0x543d02])['$lte'];_0x4ae644[_0x1bba('0x43')](_0x1bba('0x78'),_0x4586f5,_0x17b986);}else{if(_0x3c928c['query'][_0x543d02]===_0x1bba('0x79')){_0x4ae644[_0x1bba('0x43')]('i.'+_0x543d02+_0x1bba('0x7a'));}else{_0x4ae644[_0x1bba('0x43')]('i.'+_0x543d02+_0x1bba('0x7b'),_0x3c928c[_0x1bba('0x38')][_0x543d02]);}}});}if(_0x3c928c[_0x1bba('0x38')][_0x1bba('0x7c')]){if(_0x3c928c[_0x1bba('0x38')][_0x1bba('0x7c')]==0x1){_0x4ae644['having'](_0x1bba('0x7d'));}else{_0x4ae644[_0x1bba('0x5c')](_0x1bba('0x7e'));}}if(_0x3c928c[_0x1bba('0x38')][_0x1bba('0x7f')]){_0x392629=_[_0x1bba('0x80')](_0x3c928c[_0x1bba('0x38')]['tag'])?_0x3c928c[_0x1bba('0x38')][_0x1bba('0x7f')]:new Array(_0x3c928c['query'][_0x1bba('0x7f')]);_0x392629[_0x1bba('0x71')](function(_0x565c50){_0x1e90aa['or'](_0x1bba('0x6a'),'%,'+_0x565c50+',%');});}if(_0x3c928c[_0x1bba('0x38')][_0x1bba('0x81')]){var _0x2c28cb=_0x3c928c[_0x1bba('0x38')][_0x1bba('0x81')][_0x1bba('0x82')]('\x5c','\x5c\x5c')[_0x1bba('0x82')](/'/g,'\x27\x27');if(qs[_0x1bba('0x83')](_0x2c28cb)){_0x286719['or']('i.id\x20LIKE\x20?',_0x2c28cb+'%')['or'](_0x1bba('0x84'),_0x2c28cb+'%');}else{_0x286719['or'](_0x1bba('0x85'),qs[_0x1bba('0x63')](_0x2c28cb))['or'](_0x1bba('0x86'),_0x2c28cb+'%');}}}_0x4ae644[_0x1bba('0x43')](_0x286719);_0x4ae644[_0x1bba('0x87')]('i.id');var _0x44ea35={'type':db['Sequelize'][_0x1bba('0x88')][_0x1bba('0x89')],'raw':!![]};var _0x6d5ddb=_0x4ae644[_0x1bba('0x8a')]();_0x6d5ddb[_0x1bba('0x46')](_0x1bba('0x8b'));_0x6d5ddb[_0x1bba('0x46')](_0x1bba('0x8c'),_0x1bba('0x8d'));if(_0x1c4758[_0x1bba('0x41')]){_0x1c4758[_0x1bba('0x41')][_0x1bba('0x71')](function(_0x4df3fd){var _0x5489dd=_0x4df3fd[0x0]===_0x1bba('0x8e')?_0x4df3fd[0x0]:'i.'+_0x4df3fd[0x0];_0x4ae644[_0x1bba('0x41')](_0x5489dd,_0x4df3fd[0x1]===_0x1bba('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0x392629)){_0x4ae644['having'](_0x1e90aa);_0x6d5ddb['where'](_0x1bba('0x90'),_0x392629);}BPromise['resolve']()['then'](function(){if(!_0x200dd6){if(_0x3c928c[_0x1bba('0x38')][_0x1bba('0x72')])return;_0x6d5ddb['where'](_0x1bba('0x91'));_0x4ae644[_0x1bba('0x43')](_0x1bba('0x91'));return;}if(_0x3c928c['user'][_0x1bba('0x92')]!==_0x1bba('0x2c'))return;return _0x3c928c[_0x1bba('0x93')][_0x1bba('0x94')]({'attributes':['id'],'raw':!![]})[_0x1bba('0x21')](function(_0x44882c){if(_[_0x1bba('0x95')](_0x44882c)){_0x6d5ddb[_0x1bba('0x43')](_0x1bba('0x96'));_0x4ae644[_0x1bba('0x43')](_0x1bba('0x96'));}else{_0x6d5ddb[_0x1bba('0x43')](_0x1bba('0x73'),_[_0x1bba('0x69')](_0x44882c,'id'));_0x4ae644[_0x1bba('0x43')](_0x1bba('0x73'),_[_0x1bba('0x69')](_0x44882c,'id'));}});})['then'](function(){if(_0x3c928c['user'][_0x1bba('0x92')]===_0x1bba('0x2c')&&!_0x200dd6&&!_0x3c928c[_0x1bba('0x38')]['WhatsappAccountId'])return[];return db['sequelize'][_0x1bba('0x38')](_0x6d5ddb['toString'](),_0x44ea35);})[_0x1bba('0x21')](function(_0x48798b){_0x4bec01[_0x1bba('0x1b')]=_0x48798b[_0x1bba('0x3e')];if(_0x4bec01[_0x1bba('0x1b')]===0x0)return[];return db[_0x1bba('0x97')][_0x1bba('0x38')](_0x55ec16[_0x1bba('0x98')](),_0x44ea35)[_0x1bba('0x21')](function(_0x35333e){_0x4f093a=_[_0x1bba('0x99')](_0x35333e,'id');_0x44ea35=_[_0x1bba('0x9a')](_0x44ea35,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3c928c['query']['fields']){_0x1c4758[_0x1bba('0x3c')]['forEach'](function(_0x4180c6){_0x4ae644[_0x1bba('0x46')]('i.'+_0x4180c6);});}else{_0x4ae644[_0x1bba('0x46')](_0x1bba('0x8c'),_0x1bba('0x8d'));_0x4ae644[_0x1bba('0x46')](_0x1bba('0x9b'),_0x1bba('0x9c'));_0x4ae644[_0x1bba('0x46')](_0x1bba('0x9d'),_0x1bba('0x9e'));_0x4ae644[_0x1bba('0x46')]('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',_0x1bba('0x8e'));_0x4ae644[_0x1bba('0x46')](_0x1bba('0x9f'));_0x4ae644[_0x1bba('0x46')](_0x1bba('0xa0'),_0x1bba('0xa1'));_0x4ae644[_0x1bba('0x46')](_0x1bba('0xa2'),_0x1bba('0xa3'));_0x4ae644[_0x1bba('0x46')](_0x1bba('0xa4'),_0x1bba('0xa5'));_0x4ae644[_0x1bba('0x46')](_0x1bba('0xa6'),_0x1bba('0xa7'));_0x4ae644[_0x1bba('0x46')](_0x1bba('0xa8'),_0x1bba('0xa9'));_0x4ae644['field'](_0x1bba('0xaa'),'Contact.fax');_0x4ae644['field'](_0x1bba('0xab'),_0x1bba('0xac'));_0x4ae644['field'](_0x1bba('0xad'),_0x1bba('0xae'));_0x4ae644[_0x1bba('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x1c4758[_0x1bba('0x1a')])_0x4ae644[_0x1bba('0x1a')](_0x1c4758[_0x1bba('0x1a')]);if(_0x1c4758[_0x1bba('0x18')])_0x4ae644[_0x1bba('0x18')](_0x1c4758['offset']);return db[_0x1bba('0x97')]['query'](_0x4ae644[_0x1bba('0x98')](),_0x44ea35);})['then'](function(_0x3ff924){if(_0x3ff924[_0x1bba('0x3e')]>0x0)_0x3a42ad[_0x1bba('0x43')](_0x1bba('0xaf'),_['map'](_0x3ff924,'id'));return db[_0x1bba('0x97')][_0x1bba('0x38')](_0x3a42ad['toString'](),_0x44ea35)[_0x1bba('0x21')](function(_0x17290b){var _0x5b7aac=_['groupBy'](_0x17290b,'WhatsappInteractionId');var _0x5da4cf=[];_0x3ff924[_0x1bba('0x71')](function(_0x420715){_0x5da4cf[_0x1bba('0xb0')](updateWhatsappInteraction(_0x420715,_0x4f093a,_0x5b7aac));});return BPromise[_0x1bba('0xb1')](_0x5da4cf);});});})[_0x1bba('0x21')](function(_0x5bbfb0){_0x4bec01['rows']=_0x5bbfb0;return _0x4bec01;})[_0x1bba('0x21')](respondWithFilteredResult(_0x373fc3,_0x1c4758))['catch'](handleError(_0x373fc3,null));};exports[_0x1bba('0xb2')]=function(_0x252818,_0x1d2358){var _0x4e7e39={'raw':![],'where':{'id':_0x252818[_0x1bba('0xb3')]['id']}},_0x3805e5={};_0x3805e5[_0x1bba('0x37')]=_[_0x1bba('0x39')](db['WhatsappInteraction'][_0x1bba('0x35')]);_0x3805e5[_0x1bba('0x38')]=_[_0x1bba('0x39')](_0x252818[_0x1bba('0x38')]);_0x3805e5['filters']=_['intersection'](_0x3805e5['model'],_0x3805e5[_0x1bba('0x38')]);_0x4e7e39['attributes']=_[_0x1bba('0x3b')](_0x3805e5[_0x1bba('0x37')],qs['fields'](_0x252818['query']['fields']));_0x4e7e39[_0x1bba('0x3c')]=_0x4e7e39['attributes'][_0x1bba('0x3e')]?_0x4e7e39[_0x1bba('0x3c')]:_0x3805e5[_0x1bba('0x37')];if(_0x252818[_0x1bba('0x38')][_0x1bba('0xb4')]){_0x4e7e39[_0x1bba('0xb5')]=[{'all':!![]}];}_0x4e7e39=_[_0x1bba('0x9a')]({},_0x4e7e39,_0x252818[_0x1bba('0xb6')]);return db['WhatsappInteraction']['find'](_0x4e7e39)[_0x1bba('0x21')](handleEntityNotFound(_0x1d2358,null))[_0x1bba('0x21')](respondWithResult(_0x1d2358,null))['catch'](handleError(_0x1d2358,null));};exports[_0x1bba('0xb7')]=function(_0x54dde7,_0x4dab32){return db[_0x1bba('0x34')][_0x1bba('0xb7')](_0x54dde7['body'],{})[_0x1bba('0x21')](respondWithResult(_0x4dab32,0xc9))['catch'](handleError(_0x4dab32,null));};exports['update']=function(_0x4c6047,_0x55fc60){if(_0x4c6047[_0x1bba('0x29')]['id']){delete _0x4c6047['body']['id'];}return db[_0x1bba('0x34')]['find']({'where':{'id':_0x4c6047[_0x1bba('0xb3')]['id']}})[_0x1bba('0x21')](handleEntityNotFound(_0x55fc60,null))['then'](saveUpdates(_0x4c6047[_0x1bba('0x29')],null))[_0x1bba('0x21')](respondWithResult(_0x55fc60,null))[_0x1bba('0x32')](handleError(_0x55fc60,null));};exports[_0x1bba('0x22')]=function(_0x4474ee,_0x10c5e2){return db['WhatsappInteraction'][_0x1bba('0x5a')]({'where':{'id':_0x4474ee[_0x1bba('0xb3')]['id']}})[_0x1bba('0x21')](handleEntityNotFound(_0x10c5e2,null))[_0x1bba('0x21')](removeEntity(_0x10c5e2,null))['catch'](handleError(_0x10c5e2,null));};exports[_0x1bba('0xb8')]=function(_0x321f85,_0x2adc7f){return db[_0x1bba('0x34')][_0x1bba('0xb8')]()[_0x1bba('0x21')](respondWithResult(_0x2adc7f,null))['catch'](handleError(_0x2adc7f,null));};exports[_0x1bba('0xb9')]=function(_0x5b2eb7,_0x16cff8,_0x9099f3){return db[_0x1bba('0xba')][_0x1bba('0x5a')]({'where':{'id':_0x5b2eb7[_0x1bba('0xb3')]['id']}})[_0x1bba('0x21')](handleEntityNotFound(_0x16cff8,null))[_0x1bba('0x21')](function(_0x167b68){if(_0x167b68){return _0x167b68[_0x1bba('0xb9')](_0x5b2eb7[_0x1bba('0x29')]['ids'],_['omit'](_0x5b2eb7['body'],['ids','id'])||{});}})[_0x1bba('0x21')](respondWithResult(_0x16cff8,null))[_0x1bba('0x32')](handleError(_0x16cff8,null));};exports[_0x1bba('0xbb')]=function(_0x47f29b,_0x4cafbe,_0x25c8bd){var _0x9a9ed9={'raw':![],'where':{}};var _0x5de9f9={};var _0x12515e={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x47f29b['params']['id']}})[_0x1bba('0x21')](handleEntityNotFound(_0x4cafbe,null))[_0x1bba('0x21')](function(_0x462b3a){if(_0x462b3a){_0x5de9f9[_0x1bba('0x37')]=_[_0x1bba('0x39')](db[_0x1bba('0xba')][_0x1bba('0x35')]);_0x5de9f9[_0x1bba('0x38')]=_[_0x1bba('0x39')](_0x47f29b[_0x1bba('0x38')]);_0x5de9f9[_0x1bba('0x3a')]=_['intersection'](_0x5de9f9['model'],_0x5de9f9[_0x1bba('0x38')]);_0x9a9ed9['attributes']=_['intersection'](_0x5de9f9[_0x1bba('0x37')],qs['fields'](_0x47f29b[_0x1bba('0x38')][_0x1bba('0x3d')]));_0x9a9ed9[_0x1bba('0x3c')]=_0x9a9ed9[_0x1bba('0x3c')][_0x1bba('0x3e')]?_0x9a9ed9[_0x1bba('0x3c')]:_0x5de9f9[_0x1bba('0x37')];if(!_0x47f29b['query'][_0x1bba('0x3f')](_0x1bba('0x40'))){_0x9a9ed9[_0x1bba('0x1a')]=qs[_0x1bba('0x1a')](_0x47f29b[_0x1bba('0x38')]['limit']);_0x9a9ed9['offset']=qs[_0x1bba('0x18')](_0x47f29b['query']['offset']);}_0x9a9ed9[_0x1bba('0x41')]=qs[_0x1bba('0x42')](_0x47f29b[_0x1bba('0x38')][_0x1bba('0x42')]);_0x9a9ed9[_0x1bba('0x43')]=qs[_0x1bba('0x3a')](_['pick'](_0x47f29b[_0x1bba('0x38')],_0x5de9f9[_0x1bba('0x3a')]));_0x9a9ed9[_0x1bba('0x43')][_0x1bba('0xbc')]=_0x462b3a['id'];if(_0x47f29b[_0x1bba('0x38')]['filter']){_0x9a9ed9[_0x1bba('0x43')]=_[_0x1bba('0x9a')](_0x9a9ed9[_0x1bba('0x43')],{'$or':_[_0x1bba('0x69')](_0x9a9ed9['attributes'],function(_0x27936e){var _0x2f6a97={};_0x2f6a97[_0x27936e]={'$like':'%'+_0x47f29b[_0x1bba('0x38')][_0x1bba('0x81')]+'%'};return _0x2f6a97;})});}if(_0x47f29b['query'][_0x1bba('0x77')]){var _0x3cf8d9=_0x47f29b[_0x1bba('0x38')][_0x1bba('0x77')][_0x1bba('0x31')](',');var _0x441d84={};_0x441d84[_0x3cf8d9[0x0]]={'$gte':moment(_0x3cf8d9[0x1])[_0x1bba('0xbd')](_0x1bba('0xbe'))};_0x9a9ed9[_0x1bba('0x43')]=_[_0x1bba('0x9a')](_0x9a9ed9[_0x1bba('0x43')],_0x441d84);}_0x9a9ed9=_['merge']({},_0x9a9ed9,_0x47f29b[_0x1bba('0xb6')]);return db[_0x1bba('0xba')]['count']({'where':_0x9a9ed9['where']})[_0x1bba('0x21')](function(_0x35a417){_0x12515e['count']=_0x35a417;if(_0x47f29b[_0x1bba('0x38')]['includeAll']){_0x9a9ed9[_0x1bba('0xb5')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x1bba('0xbf')](_0x9a9ed9);})[_0x1bba('0x21')](function(_0x124cf4){_0x12515e['rows']=_0x124cf4;return _0x12515e;});}})[_0x1bba('0x21')](respondWithFilteredResult(_0x4cafbe,_0x9a9ed9))[_0x1bba('0x32')](handleError(_0x4cafbe,null));};exports['addTags']=function(_0x19f58c,_0x45748b,_0x38892b){return db[_0x1bba('0x34')][_0x1bba('0x5a')]({'where':{'id':_0x19f58c[_0x1bba('0xb3')]['id']}})[_0x1bba('0x21')](handleEntityNotFound(_0x45748b,null))[_0x1bba('0x21')](function(_0x36e5e7){if(_0x36e5e7){return _0x36e5e7[_0x1bba('0xc0')](_0x19f58c[_0x1bba('0x29')][_0x1bba('0xc1')],_['omit'](_0x19f58c[_0x1bba('0x29')],[_0x1bba('0xc1'),'id'])||{})['spread'](function(){return db[_0x1bba('0xc2')][_0x1bba('0xbf')]({'attributes':['id',_0x1bba('0x27'),_0x1bba('0x47')],'where':{'id':_0x19f58c['body']['ids']}});})['then'](function(_0x25535e){socket[_0x1bba('0xc3')](_0x1bba('0xc4'),{'id':Number(_0x19f58c[_0x1bba('0xb3')]['id']),'tags':_0x25535e||[]});return{'id':Number(_0x19f58c['params']['id']),'tags':_0x25535e||[]};});}})[_0x1bba('0x21')](respondWithResult(_0x45748b,null))[_0x1bba('0x32')](handleError(_0x45748b,null));};exports[_0x1bba('0xc5')]=function(_0x37dea2,_0x4366e0,_0x21a222){return db['WhatsappInteraction']['find']({'where':{'id':_0x37dea2[_0x1bba('0xb3')]['id']}})['then'](handleEntityNotFound(_0x4366e0,null))[_0x1bba('0x21')](function(_0x6b8521){if(_0x6b8521){return _0x6b8521['removeTags'](_0x37dea2['query']['ids']);}})[_0x1bba('0x21')](respondWithStatusCode(_0x4366e0,null))['catch'](handleError(_0x4366e0,null));};exports[_0x1bba('0xc6')]=function(_0x2bd08d,_0x5c7f9b){var _0x24d375=moment()[_0x1bba('0xc7')]()[_0x1bba('0x98')]();var _0x5854a5=path[_0x1bba('0xc8')](config['root'],_0x1bba('0xc9'),'files',_0x1bba('0xca'));var _0x28aad8=path[_0x1bba('0xc8')](config['root'],_0x1bba('0xc9'),_0x1bba('0xcb'),_0x1bba('0xcc'));var _0x50cadf=path[_0x1bba('0xc8')](_0x5854a5,_0x24d375);var _0x1568f7=util[_0x1bba('0xbd')](_0x1bba('0xcd'),_0x2bd08d['params']['id'],_0x24d375);var _0xb48cc4=path[_0x1bba('0xc8')](_0x5854a5,_0x1568f7);var _0x57608f=[];_0x57608f['push']({'model':db[_0x1bba('0x6b')],'as':_0x1bba('0x6b'),'attributes':['id',_0x1bba('0xce')],'raw':!![]});_0x57608f[_0x1bba('0xb0')]({'model':db['CmContact'],'as':_0x1bba('0x5f'),'attributes':['id',_0x1bba('0xcf'),'lastName'],'raw':!![]});if(_0x2bd08d[_0x1bba('0x38')][_0x1bba('0xcc')]){_0x57608f['push']({'model':db[_0x1bba('0xd0')],'as':_0x1bba('0xd0'),'raw':!![]});}var _0x49af6a=[{'model':db[_0x1bba('0xba')],'as':_0x1bba('0xd1'),'attributes':['id','body',_0x1bba('0x75'),_0x1bba('0xd2'),'secret',_0x1bba('0x7c')],'include':_0x57608f}];_0x49af6a[_0x1bba('0xb0')]({'model':db['WhatsappAccount'],'as':_0x1bba('0xd3'),'attributes':['id',_0x1bba('0x27')]});_0x49af6a[_0x1bba('0xb0')]({'model':db[_0x1bba('0x6b')],'as':'Owner','attributes':['id',_0x1bba('0xce')]});return db[_0x1bba('0x34')][_0x1bba('0x5a')]({'where':{'id':_0x2bd08d['params']['id']},'include':_0x49af6a})[_0x1bba('0x21')](handleEntityNotFound(_0x5c7f9b,null))['then'](function(_0x339f7e){if(_0x339f7e){var _0x2eefac=_0x339f7e[_0x1bba('0xd4')]({'plain':!![]});fs[_0x1bba('0xd5')](_0x50cadf);var _0x169cab={'channel':_0x1bba('0xd6'),'account':_0x2eefac[_0x1bba('0xd3')]['name'],'agent':_0x2eefac['Owner']?_0x2eefac['Owner'][_0x1bba('0xce')]:'N.A.','createdAt':moment(_0x2eefac[_0x1bba('0x75')])[_0x1bba('0xbd')](_0x1bba('0xbe'))[_0x1bba('0x98')](),'closedAt':_0x2eefac['closed']?moment(_0x2eefac[_0x1bba('0xd7')])[_0x1bba('0xbd')](_0x1bba('0xbe'))[_0x1bba('0x98')]():'','disposition':_0x2eefac[_0x1bba('0xd8')],'messages':_(_0x2eefac[_0x1bba('0xd1')])[_0x1bba('0x81')]({'secret':![]})['map'](function(_0x25421f){if(_0x25421f['Attachment']){var _0x54e0c1=path['join'](_0x28aad8,_0x25421f['Attachment'][_0x1bba('0xd9')]);if(fs[_0x1bba('0xda')](_0x54e0c1)){fs['createReadStream'](_0x54e0c1)['pipe'](fs[_0x1bba('0xdb')](path[_0x1bba('0xc8')](_0x50cadf,_0x25421f[_0x1bba('0xd0')][_0x1bba('0xd9')])));}}return{'date':moment(_0x25421f[_0x1bba('0x75')])[_0x1bba('0xbd')](_0x1bba('0xbe'))[_0x1bba('0x98')](),'sender':_0x25421f[_0x1bba('0xd2')]===_0x1bba('0xdc')?_0x25421f['User']?_0x25421f[_0x1bba('0x6b')][_0x1bba('0xce')]:_0x1bba('0xdd'):_0x25421f[_0x1bba('0x5f')]['firstName']+(_0x25421f[_0x1bba('0x5f')][_0x1bba('0xde')]?'\x20'+_0x25421f[_0x1bba('0x5f')]['lastName']:''),'body':_0x25421f[_0x1bba('0xd0')]?_0x25421f['Attachment'][_0x1bba('0xd9')]:_0x25421f[_0x1bba('0x29')],'direction':_0x25421f['direction']==='out'?'A':'C','secret':_0x25421f[_0x1bba('0xdf')],'read':_0x25421f[_0x1bba('0x7c')],'attachment':_0x25421f[_0x1bba('0xd0')]};})['value']()};return ejs[_0x1bba('0xe0')](path[_0x1bba('0xc8')](config[_0x1bba('0xe1')],'server',_0x1bba('0xe2'),_0x1bba('0xe3')),{'interaction':_0x169cab})['then'](function(_0x3d717f){var _0x398cdc=path[_0x1bba('0xc8')](_0x50cadf,_0x1bba('0xe4')+_0x2eefac['id']+'-'+_0x24d375+_0x1bba('0xe5'));var _0x3fff9c={'path':_0x398cdc,'channel':_0x1bba('0xd6'),'interactionId':_0x2eefac['id']};return pdf['createPdfFromHTML'](_0x3d717f,_0x3fff9c);})[_0x1bba('0x21')](function(){return new BPromise(function(_0x29174e,_0x5f43d3){zipdir(_0x50cadf,{'saveTo':_0xb48cc4},function(_0x286579,_0x21d02c){if(_0x286579)return _0x5f43d3(_0x286579);return _0x29174e(_0x21d02c);});})['then'](function(){return new BPromise(function(_0x2a4fa5,_0x2c4c93){rimraf(_0x50cadf,function(_0xaf748d){if(_0xaf748d)_0x2c4c93(_0xaf748d);return _0x2a4fa5();});});})[_0x1bba('0x21')](function(){return _0x5c7f9b[_0x1bba('0xc6')](_0xb48cc4,_0x1568f7,function(_0x2205ff){if(_0x2205ff){console[_0x1bba('0xe6')]('err',_0x2205ff);}else{fs['unlinkSync'](_0xb48cc4);}});});});}else{return _0x5c7f9b['sendStatus'](0xc8);}})['catch'](handleError(_0x5c7f9b,null));}; \ No newline at end of file +var _0x4c60=['offset','undefined','limit','set','Content-Range','apply','update','then','destroy','end','stack','name','send','body','message','agent','account','Users','map','fullname','TagIds','Tags','split','forEach','push','WhatsappInteraction','key','keys','filters','intersection','model','query','attributes','length','hasOwnProperty','order','sort','where','pick','field','color','from','tools_tags','u.id','ui.WhatsappInteractionId','left_join','users','select','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','operator','getFullTextValue','ContactId','buildExpression','type','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','some','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','WhatsappAccountId','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','count','merge','fields','a.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','contactName','i.*','c.firstName','Contact.firstName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','rows','show','params','rawAttributes','includeAll','options','create','catch','describe','addMessage','ids','getMessages','WhatsappMessage','filter','YYYY-MM-DD\x20HH:mm:ss','include','findAll','spread','Tag','emit','whatsappInteractionTags:save','download','toString','join','root','server','files','tmp','attachments','firstName','Attachment','Messages','createdAt','WhatsappAccount','Owner','get','mkdirSync','N.A.','format','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','Contact','lastName','secret','renderFile','views','downloadInteraction.html','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappInteraction.socket','register','sendStatus','status','json'];(function(_0x2efbc1,_0x32efa9){var _0x2de0f2=function(_0x412576){while(--_0x412576){_0x2efbc1['push'](_0x2efbc1['shift']());}};_0x2de0f2(++_0x32efa9);}(_0x4c60,0xc1));var _0x04c6=function(_0x4b2d70,_0x22de89){_0x4b2d70=_0x4b2d70-0x0;var _0x58f1e3=_0x4c60[_0x4b2d70];return _0x58f1e3;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x04c6('0x10'));var logger=require(_0x04c6('0x11'))('api');var utils=require(_0x04c6('0x12'));var config=require(_0x04c6('0x13'));var licenseUtil=require(_0x04c6('0x14'));var db=require(_0x04c6('0x15'))['db'];config['redis']=_[_0x04c6('0x16')](config[_0x04c6('0x17')],{'host':_0x04c6('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x04c6('0x17')]));require(_0x04c6('0x19'))[_0x04c6('0x1a')](socket);function respondWithStatusCode(_0x3e80a6,_0x4760f8){_0x4760f8=_0x4760f8||0xcc;return function(_0x19a26f){if(_0x19a26f){return _0x3e80a6[_0x04c6('0x1b')](_0x4760f8);}return _0x3e80a6[_0x04c6('0x1c')](_0x4760f8)['end']();};}function respondWithResult(_0x31edf9,_0xa2bc92){_0xa2bc92=_0xa2bc92||0xc8;return function(_0x382e58){if(_0x382e58){return _0x31edf9[_0x04c6('0x1c')](_0xa2bc92)[_0x04c6('0x1d')](_0x382e58);}};}function respondWithFilteredResult(_0xfb4db5,_0x21674a){return function(_0x423ea9){if(_0x423ea9){var _0x47f400=typeof _0x21674a[_0x04c6('0x1e')]===_0x04c6('0x1f')&&typeof _0x21674a[_0x04c6('0x20')]==='undefined';var _0x4cef4e=_0x423ea9['count'];var _0x41ad4f=_0x47f400?0x0:_0x21674a[_0x04c6('0x1e')];var _0x50dd61=_0x47f400?_0x423ea9['count']:_0x21674a[_0x04c6('0x1e')]+_0x21674a[_0x04c6('0x20')];var _0x3cd448;if(_0x50dd61>=_0x4cef4e){_0x50dd61=_0x4cef4e;_0x3cd448=0xc8;}else{_0x3cd448=0xce;}_0xfb4db5['status'](_0x3cd448);return _0xfb4db5[_0x04c6('0x21')](_0x04c6('0x22'),_0x41ad4f+'-'+_0x50dd61+'/'+_0x4cef4e)[_0x04c6('0x1d')](_0x423ea9);}return null;};}function patchUpdates(_0x49c179){return function(_0x2d3277){try{jsonpatch[_0x04c6('0x23')](_0x2d3277,_0x49c179,!![]);}catch(_0x562491){return BPromise['reject'](_0x562491);}return _0x2d3277['save']();};}function saveUpdates(_0x348ea3,_0x3a2014){return function(_0xd5828d){if(_0xd5828d){return _0xd5828d[_0x04c6('0x24')](_0x348ea3)[_0x04c6('0x25')](function(_0x52e5f5){return _0x52e5f5;});}return null;};}function removeEntity(_0x562952,_0x383435){return function(_0x2ab1d2){if(_0x2ab1d2){return _0x2ab1d2[_0x04c6('0x26')]()[_0x04c6('0x25')](function(){_0x562952[_0x04c6('0x1c')](0xcc)[_0x04c6('0x27')]();});}};}function handleEntityNotFound(_0x47c69a,_0x1d0d3f){return function(_0x165cb5){if(!_0x165cb5){_0x47c69a['sendStatus'](0x194);}return _0x165cb5;};}function handleError(_0x264cde,_0x1cd16a){_0x1cd16a=_0x1cd16a||0x1f4;return function(_0x5f1331){logger['error'](_0x5f1331[_0x04c6('0x28')]);if(_0x5f1331[_0x04c6('0x29')]){delete _0x5f1331[_0x04c6('0x29')];}_0x264cde[_0x04c6('0x1c')](_0x1cd16a)[_0x04c6('0x2a')](_0x5f1331);};}function getMustacheRender(_0x43884e,_0x49c4ed){return Mustache['render'](_0x43884e,_['merge'](_0x49c4ed[_0x04c6('0x2b')],{'contact':_0x49c4ed['contact'],'message':_0x49c4ed[_0x04c6('0x2c')],'agent':_0x49c4ed[_0x04c6('0x2d')],'interaction':_0x49c4ed['interaction'],'account':_0x49c4ed[_0x04c6('0x2e')]}))||'';}function getInteractionUsers(_0x36f2af,_0x6e43fb){return new BPromise(function(_0x14b6f6,_0x5b2056){try{if(_0x6e43fb[_0x36f2af['id']]){_0x36f2af[_0x04c6('0x2f')]=_[_0x04c6('0x30')](_0x6e43fb[_0x36f2af['id']],function(_0x3f7de7){return{'id':_0x3f7de7['id'],'fullname':_0x3f7de7[_0x04c6('0x31')]};});}}catch(_0x3762af){_0x5b2056(_0x3762af);}_0x14b6f6(_0x36f2af);});}function getInteractionTags(_0x902e66,_0x3e59b2){return new BPromise(function(_0x46380e,_0x19a05b){try{if(_0x902e66[_0x04c6('0x32')]){_0x902e66[_0x04c6('0x33')]=[];_0x902e66[_0x04c6('0x32')][_0x04c6('0x34')](',')[_0x04c6('0x35')](function(_0x209f88){_0x902e66['Tags'][_0x04c6('0x36')](_0x3e59b2[_0x209f88]);});}delete _0x902e66[_0x04c6('0x32')];}catch(_0x332811){_0x19a05b(_0x332811);}_0x46380e(_0x902e66);});}function updateWhatsappInteraction(_0x206e32,_0x5a2e6a,_0x181736){return new BPromise(function(_0x31de0f,_0x4e1cfa){return getInteractionUsers(_0x206e32,_0x181736)['then'](function(_0x4aac49){return getInteractionTags(_0x4aac49,_0x5a2e6a);})[_0x04c6('0x25')](function(_0x2382ff){_0x31de0f(_0x2382ff);})['catch'](function(_0x3fbdd0){_0x4e1cfa(_0x3fbdd0);});});}exports['index']=function(_0x15c270,_0x1373ca){var _0x3806ea={},_0x2b28cd={},_0x5144f5={'count':0x0,'rows':[]};var _0x57ce4b=_[_0x04c6('0x30')](db[_0x04c6('0x37')]['rawAttributes'],function(_0x3f4fad){return{'name':_0x3f4fad['fieldName'],'type':_0x3f4fad['type'][_0x04c6('0x38')]};});_0x2b28cd['model']=_[_0x04c6('0x30')](_0x57ce4b,_0x04c6('0x29'));_0x2b28cd['query']=_[_0x04c6('0x39')](_0x15c270['query']);_0x2b28cd[_0x04c6('0x3a')]=_[_0x04c6('0x3b')](_0x2b28cd[_0x04c6('0x3c')],_0x2b28cd[_0x04c6('0x3d')]);_0x3806ea[_0x04c6('0x3e')]=_['intersection'](_0x2b28cd[_0x04c6('0x3c')],qs['fields'](_0x15c270[_0x04c6('0x3d')]['fields']));_0x3806ea[_0x04c6('0x3e')]=_0x3806ea[_0x04c6('0x3e')][_0x04c6('0x3f')]?_0x3806ea[_0x04c6('0x3e')]:_0x2b28cd[_0x04c6('0x3c')];if(!_0x15c270[_0x04c6('0x3d')][_0x04c6('0x40')]('nolimit')){_0x3806ea[_0x04c6('0x20')]=qs['limit'](_0x15c270[_0x04c6('0x3d')]['limit']);_0x3806ea['offset']=qs[_0x04c6('0x1e')](_0x15c270['query'][_0x04c6('0x1e')]);}_0x3806ea[_0x04c6('0x41')]=qs[_0x04c6('0x42')](_0x15c270['query'][_0x04c6('0x42')]);_0x3806ea[_0x04c6('0x43')]=qs[_0x04c6('0x3a')](_[_0x04c6('0x44')](_0x15c270[_0x04c6('0x3d')],_0x2b28cd[_0x04c6('0x3a')]),_0x57ce4b);var _0x240a22=[];var _0x5a2d24=squel['select']()[_0x04c6('0x45')]('id')[_0x04c6('0x45')](_0x04c6('0x29'))['field'](_0x04c6('0x46'))[_0x04c6('0x47')](_0x04c6('0x48'));var _0x549911=squel['select']()['field'](_0x04c6('0x49'))[_0x04c6('0x45')]('u.fullname')[_0x04c6('0x45')](_0x04c6('0x4a'))[_0x04c6('0x47')]('user_has_whatsapp_interactions','ui')[_0x04c6('0x4b')](_0x04c6('0x4c'),'u','u.id\x20=\x20ui.UserId');var _0x25a6fc=squel[_0x04c6('0x4d')]()[_0x04c6('0x47')](_0x04c6('0x4e'),'i')['left_join'](_0x04c6('0x4f'),'c',_0x04c6('0x50'))[_0x04c6('0x4b')](_0x04c6('0x4c'),'o','o.id\x20=\x20i.UserId')[_0x04c6('0x4b')](_0x04c6('0x51'),'a',_0x04c6('0x52'))[_0x04c6('0x4b')]('whatsapp_messages','me',_0x04c6('0x53'))[_0x04c6('0x4b')](_0x04c6('0x54'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x04c6('0x4b')](_0x04c6('0x48'),'t',_0x04c6('0x55'));var _0xd31976=squel[_0x04c6('0x56')]();var _0x28e563=[];var _0x1b8fa4=squel[_0x04c6('0x56')]();var _0x623acf;if(_0x15c270[_0x04c6('0x3d')][_0x04c6('0x57')]){_0x623acf=as[_0x04c6('0x58')](_0x15c270[_0x04c6('0x3d')]['search']);var _0x3a80f6=_0x623acf[_0x04c6('0x59')];for(var _0x5ce521=0x0;_0x5ce521<_0x623acf[_0x04c6('0x5a')][_0x04c6('0x3f')];_0x5ce521++){var _0x48124f=_0x623acf[_0x04c6('0x5a')][_0x5ce521];var _0x17778b='i';var _0xc29082=_[_0x04c6('0x5b')](_0x57ce4b,[_0x04c6('0x29'),_0x48124f[_0x04c6('0x45')]]);if(!_0xc29082){switch(_0x48124f[_0x04c6('0x45')]){case _0x04c6('0x5c'):if(_0x48124f[_0x04c6('0x5d')]==0x1){_0x25a6fc[_0x04c6('0x5e')]('`'+_0x48124f['field']+'`\x20=\x200');}else{_0x25a6fc['having']('`'+_0x48124f['field']+_0x04c6('0x5f'));}break;case'Contact':if(_0x48124f[_0x04c6('0x60')]==='$substring'){if(_0x48124f[_0x04c6('0x5d')][_0x04c6('0x34')]('\x20')['length']>0x1){_0xd31976[_0x3a80f6]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x04c6('0x61')](_0x48124f[_0x04c6('0x5d')]),null);}else{var _0x35020f='%'+_0x48124f[_0x04c6('0x5d')]+'%';_0xd31976[_0x3a80f6]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x35020f,_0x35020f,_0x35020f);}}else{_0xc29082=_[_0x04c6('0x5b')](_0x57ce4b,[_0x04c6('0x29'),_0x04c6('0x62')]);_0x48124f[_0x04c6('0x45')]=_0x04c6('0x62');_0x1492d0=as[_0x04c6('0x63')](_0x17778b,_0xc29082[_0x04c6('0x64')],_0x48124f);_0xd31976[_0x3a80f6](_0x1492d0['text'],_0x1492d0[_0x04c6('0x5d')]['start'],_0x1492d0[_0x04c6('0x5d')][_0x04c6('0x27')]);}break;case'Tag':var _0x3477b7=_0x48124f[_0x04c6('0x5d')][_0x04c6('0x34')](',')[_0x04c6('0x30')](function(_0x28299e){return Number(_0x28299e);});_0x3477b7[_0x04c6('0x35')](function(_0xf073a8){_0x1b8fa4['or'](_0x04c6('0x65'),'%,'+_0xf073a8+',%');});_0x28e563=_['union'](_0x28e563,_0x3477b7);break;case _0x04c6('0x66'):if(_0x48124f['operator']===_0x04c6('0x67')){_0xd31976[_0x3a80f6](_0x04c6('0x68'),'%'+_0x48124f['value']+'%',null);}else{_0xc29082=_['find'](_0x57ce4b,[_0x04c6('0x29'),'UserId']);_0x48124f[_0x04c6('0x45')]=_0x04c6('0x69');_0x1492d0=as['buildExpression'](_0x17778b,_0xc29082[_0x04c6('0x64')],_0x48124f);_0xd31976[_0x3a80f6](_0x1492d0[_0x04c6('0x6a')],_0x1492d0[_0x04c6('0x5d')][_0x04c6('0x6b')],_0x1492d0[_0x04c6('0x5d')][_0x04c6('0x27')]);}break;case _0x04c6('0x2b'):_0x1492d0=as[_0x04c6('0x63')]('me',null,_0x48124f);_0xd31976[_0x3a80f6](_0x1492d0[_0x04c6('0x6a')],_0x1492d0[_0x04c6('0x5d')][_0x04c6('0x6b')],_0x1492d0['value'][_0x04c6('0x27')]);break;}}else{var _0x1492d0=as[_0x04c6('0x63')](_0x17778b,_0xc29082[_0x04c6('0x64')],_0x48124f);_0xd31976[_0x3a80f6](_0x1492d0['text'],_0x1492d0[_0x04c6('0x5d')][_0x04c6('0x6b')],_0x1492d0[_0x04c6('0x5d')]['end']);}}}else{var _0x563862=_(_0x15c270[_0x04c6('0x3d')])[_0x04c6('0x39')]()[_0x04c6('0x30')](function(_0x396f79){return _[_0x04c6('0x6c')](_0x57ce4b,[_0x04c6('0x29'),_0x396f79])?_0x396f79:undefined;})['compact']()[_0x04c6('0x5d')]();if(!_[_0x04c6('0x6d')](_0x563862)){_0x563862[_0x04c6('0x35')](function(_0x596ac0){if(_0x596ac0==='WhatsappAccountId'){_0x25a6fc[_0x04c6('0x43')](_0x04c6('0x6e'),[][_0x04c6('0x6f')](_0x15c270[_0x04c6('0x3d')][_0x596ac0]));}else if(_0x596ac0==='createdAt'){var _0x13111c=JSON['parse'](_0x15c270['query'][_0x596ac0])[_0x04c6('0x70')];var _0xe178dd=JSON[_0x04c6('0x71')](_0x15c270[_0x04c6('0x3d')][_0x596ac0])[_0x04c6('0x72')];_0x25a6fc[_0x04c6('0x43')](_0x04c6('0x73'),_0x13111c,_0xe178dd);}else{if(_0x15c270['query'][_0x596ac0]===_0x04c6('0x74')){_0x25a6fc[_0x04c6('0x43')]('i.'+_0x596ac0+_0x04c6('0x75'));}else{_0x25a6fc[_0x04c6('0x43')]('i.'+_0x596ac0+_0x04c6('0x76'),_0x15c270['query'][_0x596ac0]);}}});}if(_0x15c270['query'][_0x04c6('0x77')]){if(_0x15c270[_0x04c6('0x3d')][_0x04c6('0x77')]==0x1){_0x25a6fc['having'](_0x04c6('0x78'));}else{_0x25a6fc[_0x04c6('0x5e')]('`unreadMessages`\x20>\x200');}}if(_0x15c270[_0x04c6('0x3d')][_0x04c6('0x79')]){_0x28e563=_[_0x04c6('0x7a')](_0x15c270[_0x04c6('0x3d')][_0x04c6('0x79')])?_0x15c270[_0x04c6('0x3d')][_0x04c6('0x79')]:new Array(_0x15c270[_0x04c6('0x3d')][_0x04c6('0x79')]);_0x28e563[_0x04c6('0x35')](function(_0x2d7ecc){_0x1b8fa4['or'](_0x04c6('0x65'),'%,'+_0x2d7ecc+',%');});}if(_0x15c270[_0x04c6('0x3d')]['filter']){var _0xd1a5fd=_0x15c270[_0x04c6('0x3d')]['filter'][_0x04c6('0x7b')]('\x5c','\x5c\x5c')[_0x04c6('0x7b')](/'/g,'\x27\x27');if(qs[_0x04c6('0x7c')](_0xd1a5fd)){_0xd31976['or'](_0x04c6('0x7d'),_0xd1a5fd+'%')['or'](_0x04c6('0x7e'),_0xd1a5fd+'%');}else{_0xd31976['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x04c6('0x61')](_0xd1a5fd))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xd1a5fd+'%');}}}_0x25a6fc[_0x04c6('0x43')](_0xd31976);_0x25a6fc['group'](_0x04c6('0x7f'));var _0x1110f2={'type':db[_0x04c6('0x80')][_0x04c6('0x81')][_0x04c6('0x82')],'raw':!![]};var _0x150639=_0x25a6fc[_0x04c6('0x83')]();_0x150639[_0x04c6('0x45')](_0x04c6('0x7f'));_0x150639['field'](_0x04c6('0x84'),_0x04c6('0x5c'));if(_0x3806ea['order']){_0x3806ea[_0x04c6('0x41')]['forEach'](function(_0x102f17){var _0x111382=_0x102f17[0x0]==='contactName'?_0x102f17[0x0]:'i.'+_0x102f17[0x0];_0x25a6fc[_0x04c6('0x41')](_0x111382,_0x102f17[0x1]===_0x04c6('0x85')?![]:!![]);});}if(!_['isEmpty'](_0x28e563)){_0x25a6fc[_0x04c6('0x5e')](_0x1b8fa4);_0x150639[_0x04c6('0x43')]('t.id\x20IN\x20?',_0x28e563);}BPromise[_0x04c6('0x86')]()[_0x04c6('0x25')](function(){if(!_0x623acf){if(_0x15c270['query'][_0x04c6('0x87')])return;_0x150639[_0x04c6('0x43')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x25a6fc['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x15c270[_0x04c6('0x88')][_0x04c6('0x89')]!==_0x04c6('0x2d'))return;return _0x15c270[_0x04c6('0x88')][_0x04c6('0x8a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4667ba){if(_[_0x04c6('0x6d')](_0x4667ba)){_0x150639[_0x04c6('0x43')](_0x04c6('0x8b'));_0x25a6fc[_0x04c6('0x43')](_0x04c6('0x8b'));}else{_0x150639[_0x04c6('0x43')]('i.WhatsappAccountId\x20IN\x20?',_[_0x04c6('0x30')](_0x4667ba,'id'));_0x25a6fc['where'](_0x04c6('0x6e'),_['map'](_0x4667ba,'id'));}});})['then'](function(){if(_0x15c270[_0x04c6('0x88')]['role']===_0x04c6('0x2d')&&!_0x623acf&&!_0x15c270[_0x04c6('0x3d')][_0x04c6('0x87')])return[];return db[_0x04c6('0x8c')][_0x04c6('0x3d')](_0x150639['toString'](),_0x1110f2);})['then'](function(_0x45b648){_0x5144f5[_0x04c6('0x8d')]=_0x45b648[_0x04c6('0x3f')];if(_0x5144f5[_0x04c6('0x8d')]===0x0)return[];return db[_0x04c6('0x8c')][_0x04c6('0x3d')](_0x5a2d24['toString'](),_0x1110f2)[_0x04c6('0x25')](function(_0x4c3f9e){_0x240a22=_['keyBy'](_0x4c3f9e,'id');_0x1110f2=_[_0x04c6('0x8e')](_0x1110f2,{'model':db[_0x04c6('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x15c270[_0x04c6('0x3d')][_0x04c6('0x8f')]){_0x3806ea[_0x04c6('0x3e')][_0x04c6('0x35')](function(_0x2e65f0){_0x25a6fc[_0x04c6('0x45')]('i.'+_0x2e65f0);});}else{_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x84'),_0x04c6('0x5c'));_0x25a6fc['field'](_0x04c6('0x90'),'Account.key');_0x25a6fc['field'](_0x04c6('0x91'),_0x04c6('0x92'));_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x93'),_0x04c6('0x94'));_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x95'));_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x96'),_0x04c6('0x97'));_0x25a6fc[_0x04c6('0x45')]('c.lastName','Contact.lastName');_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x98'),'Contact.email');_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x99'),'Contact.phone');_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x9a'),_0x04c6('0x9b'));_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x9c'),_0x04c6('0x9d'));_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x9e'),'Owner.fullname');_0x25a6fc[_0x04c6('0x45')]('o.internal',_0x04c6('0x9f'));_0x25a6fc[_0x04c6('0x45')](_0x04c6('0xa0'),_0x04c6('0x32'));}if(_0x3806ea[_0x04c6('0x20')])_0x25a6fc[_0x04c6('0x20')](_0x3806ea['limit']);if(_0x3806ea[_0x04c6('0x1e')])_0x25a6fc[_0x04c6('0x1e')](_0x3806ea[_0x04c6('0x1e')]);return db['sequelize']['query'](_0x25a6fc['toString'](),_0x1110f2);})[_0x04c6('0x25')](function(_0x181268){if(_0x181268['length']>0x0)_0x549911[_0x04c6('0x43')](_0x04c6('0xa1'),_[_0x04c6('0x30')](_0x181268,'id'));return db['sequelize'][_0x04c6('0x3d')](_0x549911['toString'](),_0x1110f2)[_0x04c6('0x25')](function(_0x3a1b76){var _0x13ddf2=_['groupBy'](_0x3a1b76,'WhatsappInteractionId');var _0x2e314f=[];_0x181268[_0x04c6('0x35')](function(_0x2e92d5){_0x2e314f[_0x04c6('0x36')](updateWhatsappInteraction(_0x2e92d5,_0x240a22,_0x13ddf2));});return BPromise['all'](_0x2e314f);});});})['then'](function(_0x3e12a4){_0x5144f5[_0x04c6('0xa2')]=_0x3e12a4;return _0x5144f5;})[_0x04c6('0x25')](respondWithFilteredResult(_0x1373ca,_0x3806ea))['catch'](handleError(_0x1373ca,null));};exports[_0x04c6('0xa3')]=function(_0xe08ff4,_0x2dd699){var _0x3bfef2={'raw':![],'where':{'id':_0xe08ff4[_0x04c6('0xa4')]['id']}},_0x49f1e0={};_0x49f1e0[_0x04c6('0x3c')]=_[_0x04c6('0x39')](db[_0x04c6('0x37')][_0x04c6('0xa5')]);_0x49f1e0['query']=_[_0x04c6('0x39')](_0xe08ff4[_0x04c6('0x3d')]);_0x49f1e0[_0x04c6('0x3a')]=_[_0x04c6('0x3b')](_0x49f1e0[_0x04c6('0x3c')],_0x49f1e0[_0x04c6('0x3d')]);_0x3bfef2[_0x04c6('0x3e')]=_['intersection'](_0x49f1e0[_0x04c6('0x3c')],qs[_0x04c6('0x8f')](_0xe08ff4[_0x04c6('0x3d')][_0x04c6('0x8f')]));_0x3bfef2[_0x04c6('0x3e')]=_0x3bfef2[_0x04c6('0x3e')][_0x04c6('0x3f')]?_0x3bfef2[_0x04c6('0x3e')]:_0x49f1e0['model'];if(_0xe08ff4[_0x04c6('0x3d')][_0x04c6('0xa6')]){_0x3bfef2['include']=[{'all':!![]}];}_0x3bfef2=_[_0x04c6('0x8e')]({},_0x3bfef2,_0xe08ff4[_0x04c6('0xa7')]);return db[_0x04c6('0x37')][_0x04c6('0x5b')](_0x3bfef2)[_0x04c6('0x25')](handleEntityNotFound(_0x2dd699,null))['then'](respondWithResult(_0x2dd699,null))['catch'](handleError(_0x2dd699,null));};exports[_0x04c6('0xa8')]=function(_0x2d0697,_0x849fe6){return db['WhatsappInteraction'][_0x04c6('0xa8')](_0x2d0697[_0x04c6('0x2b')],{})['then'](respondWithResult(_0x849fe6,0xc9))['catch'](handleError(_0x849fe6,null));};exports[_0x04c6('0x24')]=function(_0x7a04df,_0x5cddf9){if(_0x7a04df[_0x04c6('0x2b')]['id']){delete _0x7a04df[_0x04c6('0x2b')]['id'];}return db[_0x04c6('0x37')][_0x04c6('0x5b')]({'where':{'id':_0x7a04df['params']['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x5cddf9,null))[_0x04c6('0x25')](saveUpdates(_0x7a04df[_0x04c6('0x2b')],null))[_0x04c6('0x25')](respondWithResult(_0x5cddf9,null))[_0x04c6('0xa9')](handleError(_0x5cddf9,null));};exports[_0x04c6('0x26')]=function(_0x57278a,_0x1ede30){return db[_0x04c6('0x37')][_0x04c6('0x5b')]({'where':{'id':_0x57278a[_0x04c6('0xa4')]['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x1ede30,null))[_0x04c6('0x25')](removeEntity(_0x1ede30,null))[_0x04c6('0xa9')](handleError(_0x1ede30,null));};exports[_0x04c6('0xaa')]=function(_0x4ff35b,_0x4b900a){return db[_0x04c6('0x37')][_0x04c6('0xaa')]()[_0x04c6('0x25')](respondWithResult(_0x4b900a,null))['catch'](handleError(_0x4b900a,null));};exports[_0x04c6('0xab')]=function(_0x38c3b,_0x2980ea,_0x57895c){return db['WhatsappMessage'][_0x04c6('0x5b')]({'where':{'id':_0x38c3b[_0x04c6('0xa4')]['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x2980ea,null))[_0x04c6('0x25')](function(_0x71bf62){if(_0x71bf62){return _0x71bf62[_0x04c6('0xab')](_0x38c3b['body']['ids'],_['omit'](_0x38c3b[_0x04c6('0x2b')],[_0x04c6('0xac'),'id'])||{});}})['then'](respondWithResult(_0x2980ea,null))[_0x04c6('0xa9')](handleError(_0x2980ea,null));};exports[_0x04c6('0xad')]=function(_0x15a74a,_0x50876e,_0x406dc8){var _0x312efd={'raw':![],'where':{}};var _0x1ee1fa={};var _0x11cc16={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x15a74a['params']['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x50876e,null))[_0x04c6('0x25')](function(_0x4bf39a){if(_0x4bf39a){_0x1ee1fa['model']=_['keys'](db[_0x04c6('0xae')]['rawAttributes']);_0x1ee1fa[_0x04c6('0x3d')]=_[_0x04c6('0x39')](_0x15a74a[_0x04c6('0x3d')]);_0x1ee1fa[_0x04c6('0x3a')]=_[_0x04c6('0x3b')](_0x1ee1fa[_0x04c6('0x3c')],_0x1ee1fa['query']);_0x312efd[_0x04c6('0x3e')]=_[_0x04c6('0x3b')](_0x1ee1fa[_0x04c6('0x3c')],qs[_0x04c6('0x8f')](_0x15a74a[_0x04c6('0x3d')]['fields']));_0x312efd[_0x04c6('0x3e')]=_0x312efd[_0x04c6('0x3e')][_0x04c6('0x3f')]?_0x312efd['attributes']:_0x1ee1fa[_0x04c6('0x3c')];if(!_0x15a74a[_0x04c6('0x3d')][_0x04c6('0x40')]('nolimit')){_0x312efd[_0x04c6('0x20')]=qs[_0x04c6('0x20')](_0x15a74a[_0x04c6('0x3d')][_0x04c6('0x20')]);_0x312efd[_0x04c6('0x1e')]=qs[_0x04c6('0x1e')](_0x15a74a[_0x04c6('0x3d')][_0x04c6('0x1e')]);}_0x312efd['order']=qs[_0x04c6('0x42')](_0x15a74a[_0x04c6('0x3d')][_0x04c6('0x42')]);_0x312efd['where']=qs['filters'](_['pick'](_0x15a74a[_0x04c6('0x3d')],_0x1ee1fa[_0x04c6('0x3a')]));_0x312efd[_0x04c6('0x43')]['WhatsappInteractionId']=_0x4bf39a['id'];if(_0x15a74a[_0x04c6('0x3d')][_0x04c6('0xaf')]){_0x312efd[_0x04c6('0x43')]=_[_0x04c6('0x8e')](_0x312efd['where'],{'$or':_[_0x04c6('0x30')](_0x312efd[_0x04c6('0x3e')],function(_0x31e6bf){var _0x2902f4={};_0x2902f4[_0x31e6bf]={'$like':'%'+_0x15a74a['query'][_0x04c6('0xaf')]+'%'};return _0x2902f4;})});}if(_0x15a74a['query'][_0x04c6('0x70')]){var _0xbfbdd6=_0x15a74a['query'][_0x04c6('0x70')][_0x04c6('0x34')](',');var _0x46a009={};_0x46a009[_0xbfbdd6[0x0]]={'$gte':moment(_0xbfbdd6[0x1])['format'](_0x04c6('0xb0'))};_0x312efd[_0x04c6('0x43')]=_[_0x04c6('0x8e')](_0x312efd['where'],_0x46a009);}_0x312efd=_[_0x04c6('0x8e')]({},_0x312efd,_0x15a74a[_0x04c6('0xa7')]);return db['WhatsappMessage']['count']({'where':_0x312efd['where']})['then'](function(_0x259aac){_0x11cc16[_0x04c6('0x8d')]=_0x259aac;if(_0x15a74a['query'][_0x04c6('0xa6')]){_0x312efd[_0x04c6('0xb1')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x04c6('0xb2')](_0x312efd);})[_0x04c6('0x25')](function(_0x4cb4c6){_0x11cc16[_0x04c6('0xa2')]=_0x4cb4c6;return _0x11cc16;});}})[_0x04c6('0x25')](respondWithFilteredResult(_0x50876e,_0x312efd))[_0x04c6('0xa9')](handleError(_0x50876e,null));};exports['addTags']=function(_0x4c616d,_0x4d5dd2,_0x30c1a9){return db[_0x04c6('0x37')][_0x04c6('0x5b')]({'where':{'id':_0x4c616d['params']['id']}})['then'](handleEntityNotFound(_0x4d5dd2,null))['then'](function(_0x29e5b4){if(_0x29e5b4){return _0x29e5b4['setTags'](_0x4c616d['body'][_0x04c6('0xac')],_['omit'](_0x4c616d[_0x04c6('0x2b')],[_0x04c6('0xac'),'id'])||{})[_0x04c6('0xb3')](function(){return db[_0x04c6('0xb4')][_0x04c6('0xb2')]({'attributes':['id','name','color'],'where':{'id':_0x4c616d[_0x04c6('0x2b')][_0x04c6('0xac')]}});})[_0x04c6('0x25')](function(_0x300b7e){socket[_0x04c6('0xb5')](_0x04c6('0xb6'),{'id':Number(_0x4c616d['params']['id']),'tags':_0x300b7e||[]});return{'id':Number(_0x4c616d['params']['id']),'tags':_0x300b7e||[]};});}})[_0x04c6('0x25')](respondWithResult(_0x4d5dd2,null))[_0x04c6('0xa9')](handleError(_0x4d5dd2,null));};exports['removeTags']=function(_0x2c0c74,_0x4d16fe,_0x49d50e){return db[_0x04c6('0x37')][_0x04c6('0x5b')]({'where':{'id':_0x2c0c74['params']['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x4d16fe,null))[_0x04c6('0x25')](function(_0x389dd3){if(_0x389dd3){return _0x389dd3['removeTags'](_0x2c0c74[_0x04c6('0x3d')][_0x04c6('0xac')]);}})[_0x04c6('0x25')](respondWithStatusCode(_0x4d16fe,null))[_0x04c6('0xa9')](handleError(_0x4d16fe,null));};exports[_0x04c6('0xb7')]=function(_0x2b107f,_0x4321f2){var _0x402b1a=moment()['unix']()[_0x04c6('0xb8')]();var _0x514e47=path[_0x04c6('0xb9')](config[_0x04c6('0xba')],_0x04c6('0xbb'),_0x04c6('0xbc'),_0x04c6('0xbd'));var _0x47e8c3=path[_0x04c6('0xb9')](config[_0x04c6('0xba')],'server',_0x04c6('0xbc'),_0x04c6('0xbe'));var _0x3aafbe=path['join'](_0x514e47,_0x402b1a);var _0x62e8c6=util['format']('transcript-%d-%s.zip',_0x2b107f[_0x04c6('0xa4')]['id'],_0x402b1a);var _0x4f529a=path[_0x04c6('0xb9')](_0x514e47,_0x62e8c6);var _0x14f915=[];_0x14f915[_0x04c6('0x36')]({'model':db['User'],'as':_0x04c6('0x66'),'attributes':['id','fullname'],'raw':!![]});_0x14f915[_0x04c6('0x36')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x04c6('0xbf'),'lastName'],'raw':!![]});if(_0x2b107f[_0x04c6('0x3d')][_0x04c6('0xbe')]){_0x14f915[_0x04c6('0x36')]({'model':db[_0x04c6('0xc0')],'as':_0x04c6('0xc0'),'raw':!![]});}var _0x1fffaa=[{'model':db[_0x04c6('0xae')],'as':_0x04c6('0xc1'),'attributes':['id',_0x04c6('0x2b'),_0x04c6('0xc2'),'direction','secret',_0x04c6('0x77')],'include':_0x14f915}];_0x1fffaa[_0x04c6('0x36')]({'model':db[_0x04c6('0xc3')],'as':'Account','attributes':['id',_0x04c6('0x29')]});_0x1fffaa['push']({'model':db['User'],'as':_0x04c6('0xc4'),'attributes':['id',_0x04c6('0x31')]});return db[_0x04c6('0x37')][_0x04c6('0x5b')]({'where':{'id':_0x2b107f['params']['id']},'include':_0x1fffaa})['then'](handleEntityNotFound(_0x4321f2,null))[_0x04c6('0x25')](function(_0x2cda03){if(_0x2cda03){var _0x5a88f4=_0x2cda03[_0x04c6('0xc5')]({'plain':!![]});fs[_0x04c6('0xc6')](_0x3aafbe);var _0x29bf00={'channel':'Whatsapp','account':_0x5a88f4['Account'][_0x04c6('0x29')],'agent':_0x5a88f4[_0x04c6('0xc4')]?_0x5a88f4[_0x04c6('0xc4')][_0x04c6('0x31')]:_0x04c6('0xc7'),'createdAt':moment(_0x5a88f4[_0x04c6('0xc2')])[_0x04c6('0xc8')](_0x04c6('0xb0'))['toString'](),'closedAt':_0x5a88f4['closed']?moment(_0x5a88f4['closedAt'])[_0x04c6('0xc8')](_0x04c6('0xb0'))[_0x04c6('0xb8')]():'','disposition':_0x5a88f4[_0x04c6('0xc9')],'messages':_(_0x5a88f4[_0x04c6('0xc1')])[_0x04c6('0xaf')]({'secret':![]})[_0x04c6('0x30')](function(_0x53982d){if(_0x53982d[_0x04c6('0xc0')]){var _0x4d52e6=path['join'](_0x47e8c3,_0x53982d[_0x04c6('0xc0')][_0x04c6('0xca')]);if(fs[_0x04c6('0xcb')](_0x4d52e6)){fs[_0x04c6('0xcc')](_0x4d52e6)[_0x04c6('0xcd')](fs[_0x04c6('0xce')](path[_0x04c6('0xb9')](_0x3aafbe,_0x53982d['Attachment']['basename'])));}}return{'date':moment(_0x53982d[_0x04c6('0xc2')])[_0x04c6('0xc8')](_0x04c6('0xb0'))['toString'](),'sender':_0x53982d[_0x04c6('0xcf')]===_0x04c6('0xd0')?_0x53982d[_0x04c6('0x66')]?_0x53982d[_0x04c6('0x66')]['fullname']:_0x04c6('0xd1'):_0x53982d[_0x04c6('0xd2')][_0x04c6('0xbf')]+(_0x53982d['Contact'][_0x04c6('0xd3')]?'\x20'+_0x53982d[_0x04c6('0xd2')][_0x04c6('0xd3')]:''),'body':_0x53982d[_0x04c6('0xc0')]?_0x53982d[_0x04c6('0xc0')][_0x04c6('0xca')]:_0x53982d[_0x04c6('0x2b')],'direction':_0x53982d[_0x04c6('0xcf')]===_0x04c6('0xd0')?'A':'C','secret':_0x53982d[_0x04c6('0xd4')],'read':_0x53982d['read'],'attachment':_0x53982d[_0x04c6('0xc0')]};})['value']()};return ejs[_0x04c6('0xd5')](path[_0x04c6('0xb9')](config[_0x04c6('0xba')],_0x04c6('0xbb'),_0x04c6('0xd6'),_0x04c6('0xd7')),{'interaction':_0x29bf00})['then'](function(_0x8b5e65){var _0x186921=path[_0x04c6('0xb9')](_0x3aafbe,_0x04c6('0xd8')+_0x5a88f4['id']+'-'+_0x402b1a+_0x04c6('0xd9'));var _0x111c54={'path':_0x186921,'channel':_0x04c6('0xda'),'interactionId':_0x5a88f4['id']};return pdf[_0x04c6('0xdb')](_0x8b5e65,_0x111c54);})[_0x04c6('0x25')](function(){return new BPromise(function(_0x1b3f20,_0x124d22){zipdir(_0x3aafbe,{'saveTo':_0x4f529a},function(_0x6952e2,_0x313253){if(_0x6952e2)return _0x124d22(_0x6952e2);return _0x1b3f20(_0x313253);});})[_0x04c6('0x25')](function(){return new BPromise(function(_0x1cf567,_0x382ed3){rimraf(_0x3aafbe,function(_0x1cd784){if(_0x1cd784)_0x382ed3(_0x1cd784);return _0x1cf567();});});})['then'](function(){return _0x4321f2[_0x04c6('0xb7')](_0x4f529a,_0x62e8c6,function(_0x44b284){if(_0x44b284){console[_0x04c6('0xdc')](_0x04c6('0xdd'),_0x44b284);}else{fs[_0x04c6('0xde')](_0x4f529a);}});});});}else{return _0x4321f2[_0x04c6('0x1b')](0xc8);}})[_0x04c6('0xa9')](handleError(_0x4321f2,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 5e9e513..6976c64 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 _0x7182=['Users','map','findAll','unreadMessages','length','emit','catch','events','../../mysqldb','WhatsappInteraction','setMaxListeners','update','remove','getUsers','then','setDataValue'];(function(_0x32f5db,_0x59d48b){var _0x54a50b=function(_0x3f3a5d){while(--_0x3f3a5d){_0x32f5db['push'](_0x32f5db['shift']());}};_0x54a50b(++_0x59d48b);}(_0x7182,0x187));var _0x2718=function(_0x2660ca,_0xfe1cbc){_0x2660ca=_0x2660ca-0x0;var _0x206013=_0x7182[_0x2660ca];return _0x206013;};'use strict';var EventEmitter=require(_0x2718('0x0'));var WhatsappInteraction=require(_0x2718('0x1'))['db'][_0x2718('0x2')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x2718('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2718('0x4'),'afterDestroy':_0x2718('0x5')};function emitEvent(_0x458be){return function(_0x458e92,_0x49c787,_0x19e98f){_0x458e92[_0x2718('0x6')]({'attributes':['id'],'raw':!![]})[_0x2718('0x7')](function(_0x3ca7e0){_0x458e92[_0x2718('0x8')](_0x2718('0x9'),_0x3ca7e0[_0x2718('0xa')](function(_0x3333d5){return{'id':_0x3333d5['id']};}));return WhatsappMessage[_0x2718('0xb')]({'where':{'WhatsappInteractionId':_0x458e92['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2718('0x7')](function(_0x339e77){_0x458e92[_0x2718('0x8')](_0x2718('0xc'),_0x339e77[_0x2718('0xd')]);WhatsappInteractionEvents[_0x2718('0xe')](_0x458be+':'+_0x458e92['id'],_0x458e92);WhatsappInteractionEvents['emit'](_0x458be,_0x458e92);_0x19e98f(null);})[_0x2718('0xf')](_0x19e98f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xef05=['events','../../mysqldb','WhatsappMessage','save','remove','then','map','findAll','setDataValue','unreadMessages','emit','catch','hook','exports'];(function(_0x2d8b24,_0x3a7aa9){var _0x5ca81e=function(_0x5265f2){while(--_0x5265f2){_0x2d8b24['push'](_0x2d8b24['shift']());}};_0x5ca81e(++_0x3a7aa9);}(_0xef05,0x126));var _0x5ef0=function(_0xca316b,_0x3d0d57){_0xca316b=_0xca316b-0x0;var _0x3623f5=_0xef05[_0xca316b];return _0x3623f5;};'use strict';var EventEmitter=require(_0x5ef0('0x0'));var WhatsappInteraction=require(_0x5ef0('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x5ef0('0x1'))['db'][_0x5ef0('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5ef0('0x3'),'afterUpdate':'update','afterDestroy':_0x5ef0('0x4')};function emitEvent(_0x16e47c){return function(_0x530649,_0x35486d,_0x2e9aac){_0x530649['getUsers']({'attributes':['id'],'raw':!![]})[_0x5ef0('0x5')](function(_0x6d70c){_0x530649['setDataValue']('Users',_0x6d70c[_0x5ef0('0x6')](function(_0x1cc2cd){return{'id':_0x1cc2cd['id']};}));return WhatsappMessage[_0x5ef0('0x7')]({'where':{'WhatsappInteractionId':_0x530649['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5ef0('0x5')](function(_0x79b3b6){_0x530649[_0x5ef0('0x8')](_0x5ef0('0x9'),_0x79b3b6['length']);WhatsappInteractionEvents[_0x5ef0('0xa')](_0x16e47c+':'+_0x530649['id'],_0x530649);WhatsappInteractionEvents[_0x5ef0('0xa')](_0x16e47c,_0x530649);_0x2e9aac(null);})[_0x5ef0('0xb')](_0x2e9aac(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x5ef0('0xc')](e,emitEvent(event));}}module[_0x5ef0('0xd')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index f89db26..b7fb550 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 _0x5222=['changed','closed','closedAt','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction'];(function(_0x12538f,_0x4001ae){var _0x476438=function(_0x4c2cda){while(--_0x4c2cda){_0x12538f['push'](_0x12538f['shift']());}};_0x476438(++_0x4001ae);}(_0x5222,0xc6));var _0x2522=function(_0x109e70,_0x514f3d){_0x109e70=_0x109e70-0x0;var _0x25dff7=_0x5222[_0x109e70];return _0x25dff7;};'use strict';var _=require(_0x2522('0x0'));var util=require('util');var logger=require(_0x2522('0x1'))(_0x2522('0x2'));var moment=require(_0x2522('0x3'));var BPromise=require(_0x2522('0x4'));var rp=require(_0x2522('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2522('0x6'));var attributes=require(_0x2522('0x7'));module['exports']=function(_0x2e5dff,_0x3eb3ca){return _0x2e5dff[_0x2522('0x8')](_0x2522('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5716ea,_0xc78c4e,_0x482db2){if(_0x5716ea[_0x2522('0xa')](_0x2522('0xb'))){_0x5716ea[_0x2522('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x482db2(null,_0x5716ea);}}});}; \ No newline at end of file +var _0x920f=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','closed'];(function(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0x920f,0x1ed));var _0xf920=function(_0x1f3c75,_0x2952aa){_0x1f3c75=_0x1f3c75-0x0;var _0x5ec157=_0x920f[_0x1f3c75];return _0x5ec157;};'use strict';var _=require(_0xf920('0x0'));var util=require(_0xf920('0x1'));var logger=require(_0xf920('0x2'))(_0xf920('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf920('0x4'));var config=require(_0xf920('0x5'));var attributes=require(_0xf920('0x6'));module[_0xf920('0x7')]=function(_0x339c21,_0x2e1eae){return _0x339c21['define'](_0xf920('0x8'),attributes,{'tableName':_0xf920('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d3b0d,_0xbdb6b1,_0x4472fe){if(_0x2d3b0d['changed'](_0xf920('0xa'))){_0x2d3b0d[_0xf920('0xb')]=moment()[_0xf920('0xc')](_0xf920('0xd'));}_0x4472fe(null,_0x2d3b0d);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index c544155..4689303 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 _0x6fcb=['UpdateWhatsappInteraction','find','where','addTags','body','omit','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','update','options','raw','attributes'];(function(_0x5f2842,_0x42cb4c){var _0x32e47b=function(_0x54b106){while(--_0x54b106){_0x5f2842['push'](_0x5f2842['shift']());}};_0x32e47b(++_0x42cb4c);}(_0x6fcb,0x1a3));var _0xb6fc=function(_0x2cdbf9,_0x56be79){_0x2cdbf9=_0x2cdbf9-0x0;var _0x25c759=_0x6fcb[_0x2cdbf9];return _0x25c759;};'use strict';var _=require(_0xb6fc('0x0'));var util=require(_0xb6fc('0x1'));var moment=require(_0xb6fc('0x2'));var BPromise=require(_0xb6fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6fc('0x4'));var db=require(_0xb6fc('0x5'))['db'];var utils=require(_0xb6fc('0x6'));var logger=require(_0xb6fc('0x7'))(_0xb6fc('0x8'));var config=require(_0xb6fc('0x9'));var jayson=require(_0xb6fc('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xb6fc('0xb')]=_['defaults'](config[_0xb6fc('0xb')],{'host':_0xb6fc('0xc'),'port':0x18eb});var socket=require(_0xb6fc('0xd'))(new Redis(config['redis']));require(_0xb6fc('0xe'))['register'](socket);function respondWithRpcPromise(_0x59b3d0,_0x26cf59,_0x536721){return new BPromise(function(_0x2c2b12,_0x5d316c){return client[_0xb6fc('0xf')](_0x59b3d0,_0x536721)[_0xb6fc('0x10')](function(_0x2bde15){logger['info'](_0xb6fc('0x11'),_0x26cf59,'request\x20sent');logger[_0xb6fc('0x12')](_0xb6fc('0x13'),_0x26cf59,_0xb6fc('0x14'),JSON[_0xb6fc('0x15')](_0x2bde15));if(_0x2bde15[_0xb6fc('0x16')]){if(_0x2bde15[_0xb6fc('0x16')][_0xb6fc('0x17')]===0x1f4){logger[_0xb6fc('0x16')](_0xb6fc('0x11'),_0x26cf59,_0x2bde15[_0xb6fc('0x16')][_0xb6fc('0x18')]);return _0x5d316c(_0x2bde15['error'][_0xb6fc('0x18')]);}logger[_0xb6fc('0x16')](_0xb6fc('0x11'),_0x26cf59,_0x2bde15[_0xb6fc('0x16')]['message']);return _0x2c2b12(_0x2bde15[_0xb6fc('0x16')]['message']);}else{logger[_0xb6fc('0x19')](_0xb6fc('0x11'),_0x26cf59,_0xb6fc('0x14'));_0x2c2b12(_0x2bde15[_0xb6fc('0x1a')][_0xb6fc('0x18')]);}})[_0xb6fc('0x1b')](function(_0x1ba95a){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x26cf59,_0x1ba95a);_0x5d316c(_0x1ba95a);});});}exports['UpdateWhatsappInteraction']=function(_0x32d11d){var _0x1c2b72=this;return new Promise(function(_0x57e70a,_0x27dba9){return db['WhatsappInteraction'][_0xb6fc('0x1c')](_0x32d11d['body'],{'raw':_0x32d11d[_0xb6fc('0x1d')]?_0x32d11d['options'][_0xb6fc('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32d11d['options']?_0x32d11d[_0xb6fc('0x1d')]['where']||null:null,'attributes':_0x32d11d[_0xb6fc('0x1d')]?_0x32d11d[_0xb6fc('0x1d')][_0xb6fc('0x1f')]||null:null,'limit':_0x32d11d[_0xb6fc('0x1d')]?_0x32d11d[_0xb6fc('0x1d')]['limit']||null:null})[_0xb6fc('0x10')](function(_0x1f0fba){logger[_0xb6fc('0x19')](_0xb6fc('0x20'),_0x32d11d);logger['debug'](_0xb6fc('0x20'),_0x32d11d,JSON['stringify'](_0x1f0fba));_0x57e70a(_0x1f0fba);})[_0xb6fc('0x1b')](function(_0x9a35e4){logger['error'](_0xb6fc('0x20'),_0x9a35e4['message'],_0x32d11d);_0x27dba9(_0x1c2b72[_0xb6fc('0x16')](0x1f4,_0x9a35e4[_0xb6fc('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x2728e2){return new Promise(function(_0x4f9892,_0x2e8afa){return db['WhatsappInteraction'][_0xb6fc('0x21')]({'where':_0x2728e2[_0xb6fc('0x1d')]?_0x2728e2['options'][_0xb6fc('0x22')]||null:null})[_0xb6fc('0x10')](function(_0x109ad3){if(_0x109ad3){return _0x109ad3[_0xb6fc('0x23')](_0x2728e2[_0xb6fc('0x24')]['ids'],_[_0xb6fc('0x25')](_0x2728e2[_0xb6fc('0x24')],[_0xb6fc('0x26'),'id'])||{});}})[_0xb6fc('0x27')](function(_0x5d2881){logger['info'](_0xb6fc('0x28'),_0x2728e2);logger['debug'](_0xb6fc('0x28'),_0x2728e2,JSON['stringify'](_0x5d2881));_0x4f9892(_0x5d2881);})[_0xb6fc('0x1b')](function(_0x26092f){logger[_0xb6fc('0x16')](_0xb6fc('0x28'),_0x26092f[_0xb6fc('0x18')],_0x2728e2);_0x2e8afa(_this[_0xb6fc('0x16')](0x1f4,_0x26092f['message']));});});}; \ No newline at end of file +var _0x114e=['UpdateWhatsappInteraction','update','options','raw','attributes','limit','catch','AddTagsToWhatsappInteraction','WhatsappInteraction','find','where','body','ids','omit','spread','AddTags','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x114e,0x1d3));var _0xe114=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x114e[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xe114('0x0'));var moment=require(_0xe114('0x1'));var BPromise=require(_0xe114('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe114('0x3'));var db=require(_0xe114('0x4'))['db'];var utils=require(_0xe114('0x5'));var logger=require(_0xe114('0x6'))(_0xe114('0x7'));var config=require(_0xe114('0x8'));var jayson=require(_0xe114('0x9'));var client=jayson[_0xe114('0xa')][_0xe114('0xb')]({'port':0x232a});config[_0xe114('0xc')]=_[_0xe114('0xd')](config['redis'],{'host':_0xe114('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe114('0xc')]));require(_0xe114('0xf'))[_0xe114('0x10')](socket);function respondWithRpcPromise(_0x5da164,_0x1fee59,_0x3b3a68){return new BPromise(function(_0xb727e0,_0x451816){return client[_0xe114('0x11')](_0x5da164,_0x3b3a68)[_0xe114('0x12')](function(_0x1461d5){logger[_0xe114('0x13')](_0xe114('0x14'),_0x1fee59,_0xe114('0x15'));logger['debug'](_0xe114('0x16'),_0x1fee59,_0xe114('0x15'),JSON[_0xe114('0x17')](_0x1461d5));if(_0x1461d5[_0xe114('0x18')]){if(_0x1461d5[_0xe114('0x18')][_0xe114('0x19')]===0x1f4){logger[_0xe114('0x18')](_0xe114('0x14'),_0x1fee59,_0x1461d5[_0xe114('0x18')]['message']);return _0x451816(_0x1461d5[_0xe114('0x18')][_0xe114('0x1a')]);}logger[_0xe114('0x18')](_0xe114('0x14'),_0x1fee59,_0x1461d5[_0xe114('0x18')]['message']);return _0xb727e0(_0x1461d5['error']['message']);}else{logger['info'](_0xe114('0x14'),_0x1fee59,_0xe114('0x15'));_0xb727e0(_0x1461d5[_0xe114('0x1b')][_0xe114('0x1a')]);}})['catch'](function(_0x2ccb1a){logger[_0xe114('0x18')](_0xe114('0x14'),_0x1fee59,_0x2ccb1a);_0x451816(_0x2ccb1a);});});}exports[_0xe114('0x1c')]=function(_0x8ea9bf){var _0x6dcfb9=this;return new Promise(function(_0x22a0b0,_0x21e4c7){return db['WhatsappInteraction'][_0xe114('0x1d')](_0x8ea9bf['body'],{'raw':_0x8ea9bf[_0xe114('0x1e')]?_0x8ea9bf[_0xe114('0x1e')][_0xe114('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8ea9bf[_0xe114('0x1e')]?_0x8ea9bf[_0xe114('0x1e')]['where']||null:null,'attributes':_0x8ea9bf[_0xe114('0x1e')]?_0x8ea9bf[_0xe114('0x1e')][_0xe114('0x20')]||null:null,'limit':_0x8ea9bf[_0xe114('0x1e')]?_0x8ea9bf[_0xe114('0x1e')][_0xe114('0x21')]||null:null})['then'](function(_0x2d547a){logger[_0xe114('0x13')](_0xe114('0x1c'),_0x8ea9bf);logger['debug'](_0xe114('0x1c'),_0x8ea9bf,JSON[_0xe114('0x17')](_0x2d547a));_0x22a0b0(_0x2d547a);})[_0xe114('0x22')](function(_0x2de61a){logger[_0xe114('0x18')](_0xe114('0x1c'),_0x2de61a[_0xe114('0x1a')],_0x8ea9bf);_0x21e4c7(_0x6dcfb9['error'](0x1f4,_0x2de61a[_0xe114('0x1a')]));});});};exports[_0xe114('0x23')]=function(_0x43f7f9){return new Promise(function(_0x202609,_0x3c7708){return db[_0xe114('0x24')][_0xe114('0x25')]({'where':_0x43f7f9[_0xe114('0x1e')]?_0x43f7f9[_0xe114('0x1e')][_0xe114('0x26')]||null:null})[_0xe114('0x12')](function(_0x52e58e){if(_0x52e58e){return _0x52e58e['addTags'](_0x43f7f9[_0xe114('0x27')][_0xe114('0x28')],_[_0xe114('0x29')](_0x43f7f9['body'],[_0xe114('0x28'),'id'])||{});}})[_0xe114('0x2a')](function(_0x1d214b){logger[_0xe114('0x13')](_0xe114('0x2b'),_0x43f7f9);logger[_0xe114('0x2c')](_0xe114('0x2b'),_0x43f7f9,JSON['stringify'](_0x1d214b));_0x202609(_0x1d214b);})[_0xe114('0x22')](function(_0x2c1661){logger['error']('AddTags',_0x2c1661['message'],_0x43f7f9);_0x3c7708(_this['error'](0x1f4,_0x2c1661[_0xe114('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 855d2bc..d304e3e 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 _0x37e0=['emit','length','whatsappInteraction:','./whatsappInteraction.events','save','update'];(function(_0x4624d5,_0x30ce92){var _0x4b3a25=function(_0x3f0ff2){while(--_0x3f0ff2){_0x4624d5['push'](_0x4624d5['shift']());}};_0x4b3a25(++_0x30ce92);}(_0x37e0,0xcf));var _0x037e=function(_0xd0739d,_0x40fb85){_0xd0739d=_0xd0739d-0x0;var _0xf444a5=_0x37e0[_0xd0739d];return _0xf444a5;};'use strict';var WhatsappInteractionEvents=require(_0x037e('0x0'));var events=[_0x037e('0x1'),'remove',_0x037e('0x2')];function createListener(_0x49d077,_0x1ee1fa){return function(_0xd64c1e){_0x1ee1fa[_0x037e('0x3')](_0x49d077,_0xd64c1e);};}function removeListener(_0x47b694,_0x32567e){return function(){WhatsappInteractionEvents['removeListener'](_0x47b694,_0x32567e);};}exports['register']=function(_0x243208){for(var _0x21eb10=0x0,_0x1d52ad=events[_0x037e('0x4')];_0x21eb10<_0x1d52ad;_0x21eb10++){var _0x1a494e=events[_0x21eb10];var _0x2dcd3c=createListener(_0x037e('0x5')+_0x1a494e,_0x243208);WhatsappInteractionEvents['on'](_0x1a494e,_0x2dcd3c);}}; \ No newline at end of file +var _0x23d8=['emit','removeListener','register','length','whatsappInteraction:','save','remove'];(function(_0x2e8897,_0x1093fc){var _0x6d5478=function(_0x41a282){while(--_0x41a282){_0x2e8897['push'](_0x2e8897['shift']());}};_0x6d5478(++_0x1093fc);}(_0x23d8,0x12b));var _0x823d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x23d8[_0x14add3];return _0x4a174f;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x823d('0x0'),_0x823d('0x1'),'update'];function createListener(_0x2b2a28,_0x2a1b9b){return function(_0x70aab3){_0x2a1b9b[_0x823d('0x2')](_0x2b2a28,_0x70aab3);};}function removeListener(_0x48dee8,_0x9128f1){return function(){WhatsappInteractionEvents[_0x823d('0x3')](_0x48dee8,_0x9128f1);};}exports[_0x823d('0x4')]=function(_0x1eae39){for(var _0x216205=0x0,_0x348656=events[_0x823d('0x5')];_0x216205<_0x348656;_0x216205++){var _0x3c0aa2=events[_0x216205];var _0x2dd1a3=createListener(_0x823d('0x6')+_0x3c0aa2,_0x1eae39);WhatsappInteractionEvents['on'](_0x3c0aa2,_0x2dd1a3);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index d9b18aa..9c38bcb 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 _0x8ef6=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','/describe','isAuthenticated','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8ef6,0xf2));var _0x68ef=function(_0x47223c,_0x3b3300){_0x47223c=_0x47223c-0x0;var _0x2bf7dc=_0x8ef6[_0x47223c];return _0x2bf7dc;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xf')]('/',auth[_0x68ef('0xc')](),interaction[_0x68ef('0x10')](_0x68ef('0x11'),_0x68ef('0x12')),controller[_0x68ef('0x13')]);router[_0x68ef('0xf')](_0x68ef('0x14'),controller['status']);router[_0x68ef('0x15')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x16')]);router[_0x68ef('0x15')](_0x68ef('0x17'),auth['isAuthenticated'](),controller[_0x68ef('0x18')]);router[_0x68ef('0x15')](_0x68ef('0x19'),auth['isAuthenticated'](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xd'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);module[_0x68ef('0x1d')]=router; \ No newline at end of file +var _0x34e8=['get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller'];(function(_0x686105,_0x46bdb5){var _0x143475=function(_0x422134){while(--_0x422134){_0x686105['push'](_0x686105['shift']());}};_0x143475(++_0x46bdb5);}(_0x34e8,0x12c));var _0x834e=function(_0x48033b,_0x2ec5bb){_0x48033b=_0x48033b-0x0;var _0x592358=_0x34e8[_0x48033b];return _0x592358;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')]('/',auth[_0x834e('0xd')](),interaction[_0x834e('0x12')](_0x834e('0x13'),_0x834e('0x14')),controller[_0x834e('0x15')]);router[_0x834e('0x11')](_0x834e('0x16'),controller[_0x834e('0x17')]);router[_0x834e('0x18')]('/:id',auth[_0x834e('0xd')](),controller[_0x834e('0x19')]);router['put'](_0x834e('0x1a'),auth[_0x834e('0xd')](),controller[_0x834e('0x1b')]);router[_0x834e('0x18')]('/:id/reject',auth[_0x834e('0xd')](),controller[_0x834e('0x1c')]);router['delete'](_0x834e('0xf'),auth['isAuthenticated'](),controller[_0x834e('0x1d')]);module[_0x834e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 723764c..fd959bf 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 _0x2dad=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x2dad,0x189));var _0xd2da=function(_0x2eaa9b,_0xe4f16a){_0x2eaa9b=_0x2eaa9b-0x0;var _0x273ad6=_0x2dad[_0x2eaa9b];return _0x273ad6;};'use strict';var Sequelize=require(_0xd2da('0x0'));module[_0xd2da('0x1')]={'body':{'type':Sequelize[_0xd2da('0x2')](_0xd2da('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd2da('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd2da('0x5')]('in',_0xd2da('0x6')),'defaultValue':_0xd2da('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd2da('0x7')](0xbe)},'phone':{'type':Sequelize[_0xd2da('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd2da('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3a12=['BOOLEAN','ENUM','out','STRING','TEXT','sequelize','exports','medium'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x3a12,0x85));var _0x23a1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a12[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x23a1('0x0'));module[_0x23a1('0x1')]={'body':{'type':Sequelize['TEXT'](_0x23a1('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x23a1('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x23a1('0x4')]('in',_0x23a1('0x5')),'defaultValue':_0x23a1('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x23a1('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x23a1('0x6')]},'providerResponse':{'type':Sequelize[_0x23a1('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index bf490ac..0431b22 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 _0xa425=['[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','format','SIP/%s','channel','event','accept','EventManager','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','send','render','contact','agent','interaction','account','index','map','WhatsappMessage','fieldName','model','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','type','VIRTUAL','includeAll','findAll','show','params','keys','rawAttributes','include','options','create','body','find','describe','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','WhatsappInteraction','WhatsappInteractionId'];(function(_0x8882f0,_0x267a49){var _0x3a175d=function(_0x13b122){while(--_0x13b122){_0x8882f0['push'](_0x8882f0['shift']());}};_0x3a175d(++_0x267a49);}(_0xa425,0x11e));var _0x5a42=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0xa425[_0x2f71f6];return _0x2b23ea;};'use strict';var emlformat=require(_0x5a42('0x0'));var rimraf=require(_0x5a42('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5a42('0x2'));var rp=require(_0x5a42('0x3'));var moment=require(_0x5a42('0x4'));var BPromise=require(_0x5a42('0x5'));var Mustache=require(_0x5a42('0x6'));var util=require(_0x5a42('0x7'));var path=require(_0x5a42('0x8'));var sox=require(_0x5a42('0x9'));var csv=require(_0x5a42('0xa'));var ejs=require(_0x5a42('0xb'));var fs=require('fs');var fs_extra=require(_0x5a42('0xc'));var _=require(_0x5a42('0xd'));var squel=require(_0x5a42('0xe'));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(_0x5a42('0xf'));var Redis=require(_0x5a42('0x10'));var authService=require(_0x5a42('0x11'));var qs=require(_0x5a42('0x12'));var as=require(_0x5a42('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a42('0x14'))(_0x5a42('0x15'));var utils=require(_0x5a42('0x16'));var config=require(_0x5a42('0x17'));var licenseUtil=require(_0x5a42('0x18'));var db=require(_0x5a42('0x19'))['db'];config[_0x5a42('0x1a')]=_[_0x5a42('0x1b')](config['redis'],{'host':_0x5a42('0x1c'),'port':0x18eb});var socket=require(_0x5a42('0x1d'))(new Redis(config[_0x5a42('0x1a')]));require(_0x5a42('0x1e'))[_0x5a42('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5a42('0x20')][_0x5a42('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x5a42('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x3f9fa8,_0x2c7d5d,_0x11fb4f,_0x4c98a5){return new BPromise(function(_0x49c907,_0x3f1e15){var _0x4c385b=_0x4c98a5||client;return _0x4c385b['request'](_0x3f9fa8,_0x11fb4f)[_0x5a42('0x22')](function(_0xabe52b){logger[_0x5a42('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x2c7d5d,'request\x20sent');logger[_0x5a42('0x24')](_0x5a42('0x25'),_0x2c7d5d,_0x5a42('0x26'),JSON[_0x5a42('0x27')](_0xabe52b));if(_0xabe52b['error']){if(_0xabe52b['error']['code']===0x1f4){logger[_0x5a42('0x28')](_0x5a42('0x29'),_0x2c7d5d,_0xabe52b[_0x5a42('0x28')][_0x5a42('0x2a')]);return _0x3f1e15(_0xabe52b[_0x5a42('0x28')][_0x5a42('0x2a')]);}logger[_0x5a42('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x2c7d5d,_0xabe52b['error'][_0x5a42('0x2a')]);return _0x49c907(_0xabe52b[_0x5a42('0x28')][_0x5a42('0x2a')]);}else{logger[_0x5a42('0x23')](_0x5a42('0x29'),_0x2c7d5d,_0x5a42('0x26'));_0x49c907(_0xabe52b[_0x5a42('0x2b')][_0x5a42('0x2a')]);}})[_0x5a42('0x2c')](function(_0x20b6a4){logger[_0x5a42('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x2c7d5d,_0x20b6a4);_0x3f1e15(_0x20b6a4);});});}function respondWithStatusCode(_0x5d49cf,_0xe0e4c4){_0xe0e4c4=_0xe0e4c4||0xcc;return function(_0x32a88d){if(_0x32a88d){return _0x5d49cf[_0x5a42('0x2d')](_0xe0e4c4);}return _0x5d49cf[_0x5a42('0x2e')](_0xe0e4c4)[_0x5a42('0x2f')]();};}function respondWithResult(_0x20670c,_0x453997){_0x453997=_0x453997||0xc8;return function(_0x44d0f3){if(_0x44d0f3){return _0x20670c[_0x5a42('0x2e')](_0x453997)[_0x5a42('0x30')](_0x44d0f3);}};}function respondWithFilteredResult(_0x17e14b,_0x165ca7){return function(_0x2c130b){if(_0x2c130b){var _0x256343=typeof _0x165ca7[_0x5a42('0x31')]===_0x5a42('0x32')&&typeof _0x165ca7[_0x5a42('0x33')]===_0x5a42('0x32');var _0x1bd966=_0x2c130b[_0x5a42('0x34')];var _0xccf9b6=_0x256343?0x0:_0x165ca7[_0x5a42('0x31')];var _0x9a6cf2=_0x256343?_0x2c130b[_0x5a42('0x34')]:_0x165ca7[_0x5a42('0x31')]+_0x165ca7['limit'];var _0x4f5e42;if(_0x9a6cf2>=_0x1bd966){_0x9a6cf2=_0x1bd966;_0x4f5e42=0xc8;}else{_0x4f5e42=0xce;}_0x17e14b[_0x5a42('0x2e')](_0x4f5e42);return _0x17e14b[_0x5a42('0x35')](_0x5a42('0x36'),_0xccf9b6+'-'+_0x9a6cf2+'/'+_0x1bd966)[_0x5a42('0x30')](_0x2c130b);}return null;};}function patchUpdates(_0x27b81c){return function(_0x159e96){try{jsonpatch[_0x5a42('0x37')](_0x159e96,_0x27b81c,!![]);}catch(_0x5a40c5){return BPromise[_0x5a42('0x38')](_0x5a40c5);}return _0x159e96['save']();};}function saveUpdates(_0x4b7de4,_0xd1c11c){return function(_0x1d7cb9){if(_0x1d7cb9){return _0x1d7cb9[_0x5a42('0x39')](_0x4b7de4)[_0x5a42('0x22')](function(_0x49f206){return _0x49f206;});}return null;};}function removeEntity(_0x1fd2f3,_0xf1650){return function(_0x4a5225){if(_0x4a5225){return _0x4a5225[_0x5a42('0x3a')]()[_0x5a42('0x22')](function(){_0x1fd2f3[_0x5a42('0x2e')](0xcc)[_0x5a42('0x2f')]();});}};}function handleEntityNotFound(_0x2602b1,_0x2dfefb){return function(_0x4b20ce){if(!_0x4b20ce){_0x2602b1[_0x5a42('0x2d')](0x194);}return _0x4b20ce;};}function handleError(_0x55bd47,_0x1cc205){_0x1cc205=_0x1cc205||0x1f4;return function(_0x50bb2b){logger[_0x5a42('0x28')](_0x50bb2b[_0x5a42('0x3b')]);if(_0x50bb2b[_0x5a42('0x3c')]){delete _0x50bb2b[_0x5a42('0x3c')];}_0x55bd47[_0x5a42('0x2e')](_0x1cc205)[_0x5a42('0x3d')](_0x50bb2b);};}function getMustacheRender(_0x1f5fe2,_0x40f28e){return Mustache[_0x5a42('0x3e')](_0x1f5fe2,_['merge'](_0x40f28e['body'],{'contact':_0x40f28e[_0x5a42('0x3f')],'message':_0x40f28e['message'],'agent':_0x40f28e[_0x5a42('0x40')],'interaction':_0x40f28e[_0x5a42('0x41')],'account':_0x40f28e[_0x5a42('0x42')]}))||'';}exports[_0x5a42('0x43')]=function(_0x1682e7,_0x140c46){var _0x353ba9={},_0xda80cd={},_0x21d5ef={'count':0x0,'rows':[]};var _0x3b022a=_[_0x5a42('0x44')](db[_0x5a42('0x45')]['rawAttributes'],function(_0x397126){return{'name':_0x397126[_0x5a42('0x46')],'type':_0x397126['type']['key']};});_0xda80cd[_0x5a42('0x47')]=_['map'](_0x3b022a,'name');_0xda80cd[_0x5a42('0x48')]=_['keys'](_0x1682e7[_0x5a42('0x48')]);_0xda80cd[_0x5a42('0x49')]=_[_0x5a42('0x4a')](_0xda80cd[_0x5a42('0x47')],_0xda80cd[_0x5a42('0x48')]);_0x353ba9[_0x5a42('0x4b')]=_['intersection'](_0xda80cd[_0x5a42('0x47')],qs[_0x5a42('0x4c')](_0x1682e7[_0x5a42('0x48')][_0x5a42('0x4c')]));_0x353ba9[_0x5a42('0x4b')]=_0x353ba9[_0x5a42('0x4b')][_0x5a42('0x4d')]?_0x353ba9['attributes']:_0xda80cd[_0x5a42('0x47')];if(!_0x1682e7[_0x5a42('0x48')]['hasOwnProperty']('nolimit')){_0x353ba9[_0x5a42('0x33')]=qs['limit'](_0x1682e7[_0x5a42('0x48')][_0x5a42('0x33')]);_0x353ba9['offset']=qs[_0x5a42('0x31')](_0x1682e7[_0x5a42('0x48')][_0x5a42('0x31')]);}_0x353ba9[_0x5a42('0x4e')]=qs[_0x5a42('0x4f')](_0x1682e7[_0x5a42('0x48')][_0x5a42('0x4f')]);_0x353ba9[_0x5a42('0x50')]=qs[_0x5a42('0x49')](_['pick'](_0x1682e7['query'],_0xda80cd['filters']),_0x3b022a);if(_0x1682e7[_0x5a42('0x48')][_0x5a42('0x51')]){_0x353ba9['where']=_[_0x5a42('0x52')](_0x353ba9[_0x5a42('0x50')],{'$or':_[_0x5a42('0x44')](_0x3b022a,function(_0x2df8c4){if(_0x2df8c4[_0x5a42('0x53')]!==_0x5a42('0x54')){var _0x5c7086={};_0x5c7086[_0x2df8c4[_0x5a42('0x3c')]]={'$like':'%'+_0x1682e7[_0x5a42('0x48')][_0x5a42('0x51')]+'%'};return _0x5c7086;}})});}_0x353ba9=_[_0x5a42('0x52')]({},_0x353ba9,_0x1682e7['options']);var _0x1d188d={'where':_0x353ba9['where']};return db[_0x5a42('0x45')][_0x5a42('0x34')](_0x1d188d)[_0x5a42('0x22')](function(_0x3f836f){_0x21d5ef[_0x5a42('0x34')]=_0x3f836f;if(_0x1682e7[_0x5a42('0x48')][_0x5a42('0x55')]){_0x353ba9['include']=[{'all':!![]}];}return db[_0x5a42('0x45')][_0x5a42('0x56')](_0x353ba9);})['then'](function(_0x46396b){_0x21d5ef['rows']=_0x46396b;return _0x21d5ef;})[_0x5a42('0x22')](respondWithFilteredResult(_0x140c46,_0x353ba9))['catch'](handleError(_0x140c46,null));};exports[_0x5a42('0x57')]=function(_0x129953,_0x420852){var _0xb4599f={'raw':!![],'where':{'id':_0x129953[_0x5a42('0x58')]['id']}},_0x4e617e={};_0x4e617e[_0x5a42('0x47')]=_[_0x5a42('0x59')](db[_0x5a42('0x45')][_0x5a42('0x5a')]);_0x4e617e[_0x5a42('0x48')]=_[_0x5a42('0x59')](_0x129953[_0x5a42('0x48')]);_0x4e617e[_0x5a42('0x49')]=_[_0x5a42('0x4a')](_0x4e617e[_0x5a42('0x47')],_0x4e617e[_0x5a42('0x48')]);_0xb4599f['attributes']=_[_0x5a42('0x4a')](_0x4e617e['model'],qs[_0x5a42('0x4c')](_0x129953[_0x5a42('0x48')]['fields']));_0xb4599f[_0x5a42('0x4b')]=_0xb4599f[_0x5a42('0x4b')]['length']?_0xb4599f['attributes']:_0x4e617e[_0x5a42('0x47')];if(_0x129953[_0x5a42('0x48')][_0x5a42('0x55')]){_0xb4599f[_0x5a42('0x5b')]=[{'all':!![]}];}_0xb4599f=_[_0x5a42('0x52')]({},_0xb4599f,_0x129953[_0x5a42('0x5c')]);return db[_0x5a42('0x45')]['find'](_0xb4599f)['then'](handleEntityNotFound(_0x420852,null))['then'](respondWithResult(_0x420852,null))[_0x5a42('0x2c')](handleError(_0x420852,null));};exports[_0x5a42('0x5d')]=function(_0x32fb12,_0x4e24ea){return db[_0x5a42('0x45')][_0x5a42('0x5d')](_0x32fb12[_0x5a42('0x5e')],{})[_0x5a42('0x22')](respondWithResult(_0x4e24ea,0xc9))[_0x5a42('0x2c')](handleError(_0x4e24ea,null));};exports[_0x5a42('0x39')]=function(_0x556c20,_0xd29677){if(_0x556c20[_0x5a42('0x5e')]['id']){delete _0x556c20['body']['id'];}return db[_0x5a42('0x45')][_0x5a42('0x5f')]({'where':{'id':_0x556c20['params']['id']}})[_0x5a42('0x22')](handleEntityNotFound(_0xd29677,null))[_0x5a42('0x22')](saveUpdates(_0x556c20[_0x5a42('0x5e')],null))[_0x5a42('0x22')](respondWithResult(_0xd29677,null))['catch'](handleError(_0xd29677,null));};exports['destroy']=function(_0x3a4ed5,_0x2a9119){return db['WhatsappMessage'][_0x5a42('0x5f')]({'where':{'id':_0x3a4ed5[_0x5a42('0x58')]['id']}})[_0x5a42('0x22')](handleEntityNotFound(_0x2a9119,null))['then'](removeEntity(_0x2a9119,null))[_0x5a42('0x2c')](handleError(_0x2a9119,null));};exports[_0x5a42('0x60')]=function(_0x2dbfff,_0x4cf1b0){return db[_0x5a42('0x45')][_0x5a42('0x60')]()['then'](respondWithResult(_0x4cf1b0,null))['catch'](handleError(_0x4cf1b0,null));};var interaction_log=require(_0x5a42('0x14'))('whatsapp-interactions');exports['accept']=function(_0xcde92f,_0x5d675f,_0x5db014){var _0x408198={'agent':{},'channel':_0x5a42('0x61')};if(_0xcde92f[_0x5a42('0x5e')]['id']){delete _0xcde92f['body']['id'];}_0xcde92f['body'][_0x5a42('0x62')]=!![];_0xcde92f[_0x5a42('0x5e')][_0x5a42('0x63')]=moment()['format'](_0x5a42('0x64'));_0xcde92f[_0x5a42('0x5e')]['UserId']=_0xcde92f[_0x5a42('0x5e')][_0x5a42('0x65')]||_0xcde92f[_0x5a42('0x66')]['id'];_0x408198['agent']['id']=_0xcde92f[_0x5a42('0x5e')][_0x5a42('0x65')];return db['WhatsappMessage'][_0x5a42('0x5f')]({'where':{'id':_0xcde92f['params']['id'],'UserId':null},'include':[{'model':db[_0x5a42('0x67')],'as':'Contact'}]})[_0x5a42('0x22')](handleEntityNotFound(_0x5d675f,null))[_0x5a42('0x22')](saveUpdates(_0xcde92f[_0x5a42('0x5e')],null))[_0x5a42('0x22')](function(_0x44989f){if(_0x44989f){_0x408198[_0x5a42('0x2a')]=_0x44989f[_0x5a42('0x68')]({'plain':!![]});return db[_0x5a42('0x69')]['find']({'where':{'id':_0x44989f[_0x5a42('0x6a')]}});}return null;})[_0x5a42('0x22')](handleEntityNotFound(_0x5d675f,null))[_0x5a42('0x22')](function(_0x241df2){if(_0x241df2){return _0x241df2[_0x5a42('0x39')]({'UserId':_0xcde92f[_0x5a42('0x5e')][_0x5a42('0x65')],'read1stAt':_['isNil'](_0x241df2['read1stAt'])?moment()['format'](_0x5a42('0x64')):undefined});}return null;})[_0x5a42('0x22')](function(_0x3b9b24){if(_0x3b9b24){_0x408198['interaction']=_0x3b9b24['get']({'plain':!![]});interaction_log[_0x5a42('0x23')](_0x5a42('0x6b'),_0xcde92f[_0x5a42('0x66')]['id'],_0xcde92f[_0x5a42('0x66')][_0x5a42('0x3c')],_0xcde92f['user'][_0x5a42('0x6c')],_0x408198[_0x5a42('0x41')]['id'],_0xcde92f['body']?JSON[_0x5a42('0x27')](_0xcde92f['body']):'null');return respondWithRpcPromise(_0x5a42('0x6d'),_0x5a42('0x6e'),_0x408198);}return null;})[_0x5a42('0x22')](function(_0xe120a7){if(_0xe120a7){if(_0xcde92f[_0x5a42('0x5e')][_0x5a42('0x6f')]){_0x408198['message'][_0x5a42('0x70')]=util[_0x5a42('0x71')](_0x5a42('0x72'),_0xcde92f[_0x5a42('0x66')][_0x5a42('0x3c')]);_0x408198[_0x5a42('0x2a')][_0x5a42('0x73')]=_0x408198[_0x5a42('0x73')];_0x408198['message'][_0x5a42('0x74')]=_0x5a42('0x75');return respondWithRpcPromise(_0x5a42('0x76'),'EventManager',{'event':'acceptmessage','message':_0x408198[_0x5a42('0x2a')]},client9002)['then'](function(){return _0x408198;});}return _0x408198;}return null;})[_0x5a42('0x22')](respondWithResult(_0x5d675f,null))['catch'](handleError(_0x5d675f,null));};var interaction_log=require('../../config/logger')(_0x5a42('0x77'));exports['reject']=function(_0x593368,_0x3b3cf2,_0x48dbbf){var _0x28d180={'agent':{},'channel':_0x5a42('0x61')};if(_0x593368[_0x5a42('0x5e')]['id']){delete _0x593368[_0x5a42('0x5e')]['id'];}_0x593368['body'][_0x5a42('0x65')]=_0x593368[_0x5a42('0x5e')][_0x5a42('0x65')]||_0x593368['user']['id'];_0x28d180[_0x5a42('0x40')]['id']=_0x593368[_0x5a42('0x5e')]['UserId'];return db['WhatsappMessage'][_0x5a42('0x5f')]({'where':{'id':_0x593368['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3b3cf2,null))[_0x5a42('0x22')](function(_0x435232){if(_0x435232){_0x28d180[_0x5a42('0x2a')]=_0x435232[_0x5a42('0x68')]({'plain':!![]});return db[_0x5a42('0x69')][_0x5a42('0x5f')]({'where':{'id':_0x435232[_0x5a42('0x6a')]}});}return null;})[_0x5a42('0x22')](handleEntityNotFound(_0x3b3cf2,null))[_0x5a42('0x22')](function(_0x2ed02a){if(_0x2ed02a){_0x28d180[_0x5a42('0x41')]=_0x2ed02a[_0x5a42('0x68')]({'plain':!![]});interaction_log[_0x5a42('0x23')](_0x5a42('0x78'),_0x593368[_0x5a42('0x66')]['id'],_0x593368[_0x5a42('0x66')][_0x5a42('0x3c')],_0x593368['user'][_0x5a42('0x6c')],_0x28d180[_0x5a42('0x41')]['id'],_0x593368[_0x5a42('0x5e')]?JSON[_0x5a42('0x27')](_0x593368[_0x5a42('0x5e')]):'null');return respondWithRpcPromise(_0x5a42('0x79'),'rejectMessage',_0x28d180);}return null;})[_0x5a42('0x22')](function(_0x4c9fd6){if(_0x4c9fd6){_0x4c9fd6[_0x5a42('0x2a')][_0x5a42('0x70')]=util['format'](_0x5a42('0x72'),_0x593368[_0x5a42('0x66')][_0x5a42('0x3c')]);_0x4c9fd6[_0x5a42('0x2a')]['channel']=_0x28d180[_0x5a42('0x73')];_0x4c9fd6[_0x5a42('0x2a')][_0x5a42('0x74')]=_0x5a42('0x38');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x4c9fd6[_0x5a42('0x2a')]},client9002);return _0x28d180;}return null;})[_0x5a42('0x22')](respondWithResult(_0x3b3cf2,null))[_0x5a42('0x2c')](handleError(_0x3b3cf2,null));};exports[_0x5a42('0x2e')]=function(_0x426f69,_0x5d6cfe,_0x1d4ac8){if(_0x426f69[_0x5a42('0x5e')]['id']){delete _0x426f69[_0x5a42('0x5e')]['id'];}var _0x1a49cd;return db['WhatsappMessage']['find']({'where':{'id':_0x426f69['params']['id']}})['then'](handleEntityNotFound(_0x5d6cfe,null))[_0x5a42('0x22')](function(_0x3dacf5){if(_0x3dacf5){_0x1a49cd=_0x3dacf5;return db[_0x5a42('0x7a')][_0x5a42('0x5f')]({'where':{'id':_0x3dacf5['WhatsappAccountId']}});}})[_0x5a42('0x22')](handleEntityNotFound(_0x5d6cfe,null))['then'](function(_0x232bd1){if(_0x232bd1){logger[_0x5a42('0x24')](_0x5a42('0x7b'),_0x5a42('0x2e'),_0x5a42('0x7c'),_0x232bd1[_0x5a42('0x53')],util[_0x5a42('0x7d')](_0x426f69[_0x5a42('0x5e')],{'showHidden':![],'depth':null}));switch(_0x232bd1['type']){case'twilio':if(_0x426f69[_0x5a42('0x5e')][_0x5a42('0x7e')]&&_0x426f69[_0x5a42('0x5e')][_0x5a42('0x7e')]===_0x1a49cd[_0x5a42('0x7f')]&&_0x426f69['body'][_0x5a42('0x80')]&&_0x426f69[_0x5a42('0x5e')][_0x5a42('0x80')]===_0x5a42('0x62')){return _0x1a49cd[_0x5a42('0x39')]({'read':!![]});}else{logger['error'](_0x5a42('0x81'),_0x5a42('0x2e'),_0x5a42('0x82'),util[_0x5a42('0x7d')](_0x426f69['body'],{'showHidden':![],'depth':null}));}break;}return _0x1a49cd;}})[_0x5a42('0x22')](respondWithResult(_0x5d6cfe,null))['catch'](handleError(_0x5d6cfe,null));}; \ No newline at end of file +var _0x79a6=['sort','where','pick','filter','VIRTUAL','includeAll','rows','catch','show','params','create','body','destroy','find','describe','whatsapp-interactions','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','WhatsappInteraction','WhatsappInteractionId','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','format','SIP/%s','channel','event','accept','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','type','inspect','twilio','MessageSid','messageId','MessageStatus','update','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','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/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','name','send','render','merge','contact','interaction','map','WhatsappMessage','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order'];(function(_0x49c756,_0x37f990){var _0x15fc63=function(_0x563ca0){while(--_0x563ca0){_0x49c756['push'](_0x49c756['shift']());}};_0x15fc63(++_0x37f990);}(_0x79a6,0x145));var _0x679a=function(_0x463183,_0x56bd4e){_0x463183=_0x463183-0x0;var _0xd5fe56=_0x79a6[_0x463183];return _0xd5fe56;};'use strict';var emlformat=require(_0x679a('0x0'));var rimraf=require(_0x679a('0x1'));var zipdir=require(_0x679a('0x2'));var jsonpatch=require(_0x679a('0x3'));var rp=require(_0x679a('0x4'));var moment=require('moment');var BPromise=require(_0x679a('0x5'));var Mustache=require(_0x679a('0x6'));var util=require(_0x679a('0x7'));var path=require(_0x679a('0x8'));var sox=require(_0x679a('0x9'));var csv=require(_0x679a('0xa'));var ejs=require(_0x679a('0xb'));var fs=require('fs');var fs_extra=require(_0x679a('0xc'));var _=require(_0x679a('0xd'));var squel=require(_0x679a('0xe'));var crypto=require(_0x679a('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x679a('0x10'));var toCsv=require(_0x679a('0xa'));var querystring=require(_0x679a('0x11'));var Papa=require(_0x679a('0x12'));var Redis=require(_0x679a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x679a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x679a('0x15'));var logger=require(_0x679a('0x16'))(_0x679a('0x17'));var utils=require(_0x679a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x679a('0x19'));var db=require(_0x679a('0x1a'))['db'];config[_0x679a('0x1b')]=_[_0x679a('0x1c')](config[_0x679a('0x1b')],{'host':_0x679a('0x1d'),'port':0x18eb});var socket=require(_0x679a('0x1e'))(new Redis(config[_0x679a('0x1b')]));require(_0x679a('0x1f'))[_0x679a('0x20')](socket);var jayson=require(_0x679a('0x21'));var client=jayson[_0x679a('0x22')][_0x679a('0x23')]({'port':0x232c});var client9002=jayson['client'][_0x679a('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2a0a68,_0x52e2e0,_0x25bbe2,_0x58803a){return new BPromise(function(_0x25eeb5,_0x26987a){var _0x28e97f=_0x58803a||client;return _0x28e97f[_0x679a('0x24')](_0x2a0a68,_0x25bbe2)['then'](function(_0x5993c4){logger[_0x679a('0x25')](_0x679a('0x26'),_0x52e2e0,_0x679a('0x27'));logger[_0x679a('0x28')](_0x679a('0x29'),_0x52e2e0,_0x679a('0x27'),JSON[_0x679a('0x2a')](_0x5993c4));if(_0x5993c4[_0x679a('0x2b')]){if(_0x5993c4[_0x679a('0x2b')]['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x52e2e0,_0x5993c4['error'][_0x679a('0x2c')]);return _0x26987a(_0x5993c4[_0x679a('0x2b')][_0x679a('0x2c')]);}logger[_0x679a('0x2b')](_0x679a('0x26'),_0x52e2e0,_0x5993c4['error'][_0x679a('0x2c')]);return _0x25eeb5(_0x5993c4['error'][_0x679a('0x2c')]);}else{logger['info'](_0x679a('0x26'),_0x52e2e0,'request\x20sent');_0x25eeb5(_0x5993c4[_0x679a('0x2d')][_0x679a('0x2c')]);}})['catch'](function(_0x34aa2a){logger[_0x679a('0x2b')](_0x679a('0x26'),_0x52e2e0,_0x34aa2a);_0x26987a(_0x34aa2a);});});}function respondWithStatusCode(_0x2389dd,_0x54af51){_0x54af51=_0x54af51||0xcc;return function(_0x1bc55a){if(_0x1bc55a){return _0x2389dd[_0x679a('0x2e')](_0x54af51);}return _0x2389dd[_0x679a('0x2f')](_0x54af51)[_0x679a('0x30')]();};}function respondWithResult(_0x4001d6,_0x51b0e4){_0x51b0e4=_0x51b0e4||0xc8;return function(_0x6ccd88){if(_0x6ccd88){return _0x4001d6['status'](_0x51b0e4)[_0x679a('0x31')](_0x6ccd88);}};}function respondWithFilteredResult(_0x2acb23,_0x383595){return function(_0x3844af){if(_0x3844af){var _0x19e7d5=typeof _0x383595[_0x679a('0x32')]===_0x679a('0x33')&&typeof _0x383595['limit']===_0x679a('0x33');var _0x4ef7af=_0x3844af[_0x679a('0x34')];var _0x5e9cae=_0x19e7d5?0x0:_0x383595[_0x679a('0x32')];var _0x29c741=_0x19e7d5?_0x3844af[_0x679a('0x34')]:_0x383595[_0x679a('0x32')]+_0x383595[_0x679a('0x35')];var _0x200447;if(_0x29c741>=_0x4ef7af){_0x29c741=_0x4ef7af;_0x200447=0xc8;}else{_0x200447=0xce;}_0x2acb23[_0x679a('0x2f')](_0x200447);return _0x2acb23[_0x679a('0x36')](_0x679a('0x37'),_0x5e9cae+'-'+_0x29c741+'/'+_0x4ef7af)[_0x679a('0x31')](_0x3844af);}return null;};}function patchUpdates(_0x3b6848){return function(_0x2faf28){try{jsonpatch['apply'](_0x2faf28,_0x3b6848,!![]);}catch(_0x1a7558){return BPromise[_0x679a('0x38')](_0x1a7558);}return _0x2faf28[_0x679a('0x39')]();};}function saveUpdates(_0x573384,_0x74984c){return function(_0x50eefe){if(_0x50eefe){return _0x50eefe['update'](_0x573384)[_0x679a('0x3a')](function(_0x1cf3ce){return _0x1cf3ce;});}return null;};}function removeEntity(_0x233c9e,_0x41dde7){return function(_0x1183f6){if(_0x1183f6){return _0x1183f6['destroy']()[_0x679a('0x3a')](function(){_0x233c9e[_0x679a('0x2f')](0xcc)[_0x679a('0x30')]();});}};}function handleEntityNotFound(_0x2ae3ce,_0x492db8){return function(_0x496cf4){if(!_0x496cf4){_0x2ae3ce[_0x679a('0x2e')](0x194);}return _0x496cf4;};}function handleError(_0x575df6,_0x3b2579){_0x3b2579=_0x3b2579||0x1f4;return function(_0x4df385){logger['error'](_0x4df385['stack']);if(_0x4df385[_0x679a('0x3b')]){delete _0x4df385[_0x679a('0x3b')];}_0x575df6[_0x679a('0x2f')](_0x3b2579)[_0x679a('0x3c')](_0x4df385);};}function getMustacheRender(_0x39cf4b,_0xc02be2){return Mustache[_0x679a('0x3d')](_0x39cf4b,_[_0x679a('0x3e')](_0xc02be2['body'],{'contact':_0xc02be2[_0x679a('0x3f')],'message':_0xc02be2[_0x679a('0x2c')],'agent':_0xc02be2['agent'],'interaction':_0xc02be2[_0x679a('0x40')],'account':_0xc02be2['account']}))||'';}exports['index']=function(_0x1bb7bc,_0x1ed533){var _0x342c9d={},_0xa5306e={},_0x2f4c58={'count':0x0,'rows':[]};var _0x1c19cd=_[_0x679a('0x41')](db[_0x679a('0x42')][_0x679a('0x43')],function(_0x4fc670){return{'name':_0x4fc670[_0x679a('0x44')],'type':_0x4fc670['type'][_0x679a('0x45')]};});_0xa5306e['model']=_[_0x679a('0x41')](_0x1c19cd,_0x679a('0x3b'));_0xa5306e['query']=_[_0x679a('0x46')](_0x1bb7bc[_0x679a('0x47')]);_0xa5306e[_0x679a('0x48')]=_[_0x679a('0x49')](_0xa5306e[_0x679a('0x4a')],_0xa5306e[_0x679a('0x47')]);_0x342c9d['attributes']=_[_0x679a('0x49')](_0xa5306e['model'],qs['fields'](_0x1bb7bc[_0x679a('0x47')][_0x679a('0x4b')]));_0x342c9d['attributes']=_0x342c9d[_0x679a('0x4c')][_0x679a('0x4d')]?_0x342c9d[_0x679a('0x4c')]:_0xa5306e['model'];if(!_0x1bb7bc[_0x679a('0x47')]['hasOwnProperty'](_0x679a('0x4e'))){_0x342c9d['limit']=qs[_0x679a('0x35')](_0x1bb7bc[_0x679a('0x47')][_0x679a('0x35')]);_0x342c9d[_0x679a('0x32')]=qs[_0x679a('0x32')](_0x1bb7bc[_0x679a('0x47')][_0x679a('0x32')]);}_0x342c9d[_0x679a('0x4f')]=qs[_0x679a('0x50')](_0x1bb7bc[_0x679a('0x47')][_0x679a('0x50')]);_0x342c9d[_0x679a('0x51')]=qs[_0x679a('0x48')](_[_0x679a('0x52')](_0x1bb7bc[_0x679a('0x47')],_0xa5306e[_0x679a('0x48')]),_0x1c19cd);if(_0x1bb7bc[_0x679a('0x47')][_0x679a('0x53')]){_0x342c9d[_0x679a('0x51')]=_[_0x679a('0x3e')](_0x342c9d[_0x679a('0x51')],{'$or':_['map'](_0x1c19cd,function(_0x483e9e){if(_0x483e9e['type']!==_0x679a('0x54')){var _0x3dd75d={};_0x3dd75d[_0x483e9e[_0x679a('0x3b')]]={'$like':'%'+_0x1bb7bc[_0x679a('0x47')]['filter']+'%'};return _0x3dd75d;}})});}_0x342c9d=_[_0x679a('0x3e')]({},_0x342c9d,_0x1bb7bc['options']);var _0x3594ea={'where':_0x342c9d[_0x679a('0x51')]};return db[_0x679a('0x42')][_0x679a('0x34')](_0x3594ea)[_0x679a('0x3a')](function(_0x5659f7){_0x2f4c58[_0x679a('0x34')]=_0x5659f7;if(_0x1bb7bc[_0x679a('0x47')][_0x679a('0x55')]){_0x342c9d['include']=[{'all':!![]}];}return db[_0x679a('0x42')]['findAll'](_0x342c9d);})[_0x679a('0x3a')](function(_0x27014b){_0x2f4c58[_0x679a('0x56')]=_0x27014b;return _0x2f4c58;})['then'](respondWithFilteredResult(_0x1ed533,_0x342c9d))[_0x679a('0x57')](handleError(_0x1ed533,null));};exports[_0x679a('0x58')]=function(_0x16c55d,_0x366ff0){var _0xae83db={'raw':!![],'where':{'id':_0x16c55d[_0x679a('0x59')]['id']}},_0x4387bf={};_0x4387bf[_0x679a('0x4a')]=_[_0x679a('0x46')](db['WhatsappMessage'][_0x679a('0x43')]);_0x4387bf[_0x679a('0x47')]=_[_0x679a('0x46')](_0x16c55d['query']);_0x4387bf['filters']=_[_0x679a('0x49')](_0x4387bf['model'],_0x4387bf['query']);_0xae83db[_0x679a('0x4c')]=_[_0x679a('0x49')](_0x4387bf[_0x679a('0x4a')],qs[_0x679a('0x4b')](_0x16c55d['query']['fields']));_0xae83db['attributes']=_0xae83db[_0x679a('0x4c')][_0x679a('0x4d')]?_0xae83db[_0x679a('0x4c')]:_0x4387bf[_0x679a('0x4a')];if(_0x16c55d[_0x679a('0x47')][_0x679a('0x55')]){_0xae83db['include']=[{'all':!![]}];}_0xae83db=_['merge']({},_0xae83db,_0x16c55d['options']);return db[_0x679a('0x42')]['find'](_0xae83db)[_0x679a('0x3a')](handleEntityNotFound(_0x366ff0,null))[_0x679a('0x3a')](respondWithResult(_0x366ff0,null))[_0x679a('0x57')](handleError(_0x366ff0,null));};exports[_0x679a('0x5a')]=function(_0x2212b9,_0x4d92f3){return db[_0x679a('0x42')][_0x679a('0x5a')](_0x2212b9['body'],{})[_0x679a('0x3a')](respondWithResult(_0x4d92f3,0xc9))['catch'](handleError(_0x4d92f3,null));};exports['update']=function(_0x1d2454,_0x1d872a){if(_0x1d2454[_0x679a('0x5b')]['id']){delete _0x1d2454[_0x679a('0x5b')]['id'];}return db[_0x679a('0x42')]['find']({'where':{'id':_0x1d2454['params']['id']}})['then'](handleEntityNotFound(_0x1d872a,null))[_0x679a('0x3a')](saveUpdates(_0x1d2454[_0x679a('0x5b')],null))[_0x679a('0x3a')](respondWithResult(_0x1d872a,null))[_0x679a('0x57')](handleError(_0x1d872a,null));};exports[_0x679a('0x5c')]=function(_0x34b4da,_0xd93021){return db[_0x679a('0x42')][_0x679a('0x5d')]({'where':{'id':_0x34b4da['params']['id']}})[_0x679a('0x3a')](handleEntityNotFound(_0xd93021,null))[_0x679a('0x3a')](removeEntity(_0xd93021,null))['catch'](handleError(_0xd93021,null));};exports[_0x679a('0x5e')]=function(_0x54495c,_0x3adacc){return db['WhatsappMessage']['describe']()[_0x679a('0x3a')](respondWithResult(_0x3adacc,null))[_0x679a('0x57')](handleError(_0x3adacc,null));};var interaction_log=require(_0x679a('0x16'))(_0x679a('0x5f'));exports['accept']=function(_0x382a96,_0x99da21,_0x215c9f){var _0x32461e={'agent':{},'channel':_0x679a('0x60')};if(_0x382a96[_0x679a('0x5b')]['id']){delete _0x382a96[_0x679a('0x5b')]['id'];}_0x382a96['body'][_0x679a('0x61')]=!![];_0x382a96[_0x679a('0x5b')][_0x679a('0x62')]=moment()['format'](_0x679a('0x63'));_0x382a96[_0x679a('0x5b')][_0x679a('0x64')]=_0x382a96['body'][_0x679a('0x64')]||_0x382a96[_0x679a('0x65')]['id'];_0x32461e[_0x679a('0x66')]['id']=_0x382a96[_0x679a('0x5b')][_0x679a('0x64')];return db[_0x679a('0x42')][_0x679a('0x5d')]({'where':{'id':_0x382a96[_0x679a('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x679a('0x67')],'as':_0x679a('0x68')}]})[_0x679a('0x3a')](handleEntityNotFound(_0x99da21,null))[_0x679a('0x3a')](saveUpdates(_0x382a96[_0x679a('0x5b')],null))[_0x679a('0x3a')](function(_0x2c9491){if(_0x2c9491){_0x32461e[_0x679a('0x2c')]=_0x2c9491['get']({'plain':!![]});return db[_0x679a('0x69')][_0x679a('0x5d')]({'where':{'id':_0x2c9491[_0x679a('0x6a')]}});}return null;})[_0x679a('0x3a')](handleEntityNotFound(_0x99da21,null))[_0x679a('0x3a')](function(_0x26c294){if(_0x26c294){return _0x26c294['update']({'UserId':_0x382a96[_0x679a('0x5b')][_0x679a('0x64')],'read1stAt':_['isNil'](_0x26c294['read1stAt'])?moment()['format'](_0x679a('0x63')):undefined});}return null;})[_0x679a('0x3a')](function(_0x32033d){if(_0x32033d){_0x32461e[_0x679a('0x40')]=_0x32033d[_0x679a('0x6b')]({'plain':!![]});interaction_log[_0x679a('0x25')](_0x679a('0x6c'),_0x382a96[_0x679a('0x65')]['id'],_0x382a96[_0x679a('0x65')]['name'],_0x382a96[_0x679a('0x65')][_0x679a('0x6d')],_0x32461e[_0x679a('0x40')]['id'],_0x382a96[_0x679a('0x5b')]?JSON[_0x679a('0x2a')](_0x382a96[_0x679a('0x5b')]):_0x679a('0x6e'));return respondWithRpcPromise(_0x679a('0x6f'),_0x679a('0x70'),_0x32461e);}return null;})[_0x679a('0x3a')](function(_0x5eb233){if(_0x5eb233){if(_0x382a96[_0x679a('0x5b')][_0x679a('0x71')]){_0x32461e[_0x679a('0x2c')][_0x679a('0x72')]=util[_0x679a('0x73')](_0x679a('0x74'),_0x382a96['user'][_0x679a('0x3b')]);_0x32461e[_0x679a('0x2c')][_0x679a('0x75')]=_0x32461e[_0x679a('0x75')];_0x32461e[_0x679a('0x2c')][_0x679a('0x76')]=_0x679a('0x77');return respondWithRpcPromise(_0x679a('0x78'),_0x679a('0x78'),{'event':'acceptmessage','message':_0x32461e['message']},client9002)[_0x679a('0x3a')](function(){return _0x32461e;});}return _0x32461e;}return null;})[_0x679a('0x3a')](respondWithResult(_0x99da21,null))[_0x679a('0x57')](handleError(_0x99da21,null));};var interaction_log=require(_0x679a('0x16'))(_0x679a('0x5f'));exports['reject']=function(_0x2a929a,_0x5c440f,_0x399f53){var _0x179862={'agent':{},'channel':_0x679a('0x60')};if(_0x2a929a[_0x679a('0x5b')]['id']){delete _0x2a929a['body']['id'];}_0x2a929a['body'][_0x679a('0x64')]=_0x2a929a[_0x679a('0x5b')][_0x679a('0x64')]||_0x2a929a['user']['id'];_0x179862[_0x679a('0x66')]['id']=_0x2a929a[_0x679a('0x5b')][_0x679a('0x64')];return db[_0x679a('0x42')]['find']({'where':{'id':_0x2a929a[_0x679a('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5c440f,null))[_0x679a('0x3a')](function(_0x1d9c06){if(_0x1d9c06){_0x179862[_0x679a('0x2c')]=_0x1d9c06['get']({'plain':!![]});return db[_0x679a('0x69')]['find']({'where':{'id':_0x1d9c06[_0x679a('0x6a')]}});}return null;})[_0x679a('0x3a')](handleEntityNotFound(_0x5c440f,null))[_0x679a('0x3a')](function(_0x58dd37){if(_0x58dd37){_0x179862[_0x679a('0x40')]=_0x58dd37[_0x679a('0x6b')]({'plain':!![]});interaction_log[_0x679a('0x25')](_0x679a('0x79'),_0x2a929a[_0x679a('0x65')]['id'],_0x2a929a[_0x679a('0x65')][_0x679a('0x3b')],_0x2a929a['user'][_0x679a('0x6d')],_0x179862[_0x679a('0x40')]['id'],_0x2a929a[_0x679a('0x5b')]?JSON[_0x679a('0x2a')](_0x2a929a[_0x679a('0x5b')]):_0x679a('0x6e'));return respondWithRpcPromise(_0x679a('0x7a'),_0x679a('0x7b'),_0x179862);}return null;})[_0x679a('0x3a')](function(_0x12a77f){if(_0x12a77f){_0x12a77f[_0x679a('0x2c')][_0x679a('0x72')]=util[_0x679a('0x73')]('SIP/%s',_0x2a929a[_0x679a('0x65')][_0x679a('0x3b')]);_0x12a77f['message'][_0x679a('0x75')]=_0x179862[_0x679a('0x75')];_0x12a77f[_0x679a('0x2c')][_0x679a('0x76')]=_0x679a('0x38');respondWithRpcPromise(_0x679a('0x78'),_0x679a('0x78'),{'event':_0x679a('0x7c'),'message':_0x12a77f[_0x679a('0x2c')]},client9002);return _0x179862;}return null;})[_0x679a('0x3a')](respondWithResult(_0x5c440f,null))[_0x679a('0x57')](handleError(_0x5c440f,null));};exports[_0x679a('0x2f')]=function(_0x4d64fc,_0x156210,_0x7564be){if(_0x4d64fc['body']['id']){delete _0x4d64fc[_0x679a('0x5b')]['id'];}var _0x3a8602;return db['WhatsappMessage'][_0x679a('0x5d')]({'where':{'id':_0x4d64fc['params']['id']}})[_0x679a('0x3a')](handleEntityNotFound(_0x156210,null))['then'](function(_0x32d6d3){if(_0x32d6d3){_0x3a8602=_0x32d6d3;return db[_0x679a('0x7d')]['find']({'where':{'id':_0x32d6d3['WhatsappAccountId']}});}})[_0x679a('0x3a')](handleEntityNotFound(_0x156210,null))['then'](function(_0xff409c){if(_0xff409c){logger[_0x679a('0x28')](_0x679a('0x7e'),_0x679a('0x2f'),'received\x20delivery\x20report\x20from',_0xff409c[_0x679a('0x7f')],util[_0x679a('0x80')](_0x4d64fc[_0x679a('0x5b')],{'showHidden':![],'depth':null}));switch(_0xff409c[_0x679a('0x7f')]){case _0x679a('0x81'):if(_0x4d64fc[_0x679a('0x5b')][_0x679a('0x82')]&&_0x4d64fc[_0x679a('0x5b')][_0x679a('0x82')]===_0x3a8602[_0x679a('0x83')]&&_0x4d64fc[_0x679a('0x5b')]['MessageStatus']&&_0x4d64fc[_0x679a('0x5b')][_0x679a('0x84')]===_0x679a('0x61')){return _0x3a8602[_0x679a('0x85')]({'read':!![]});}else{logger['error'](_0x679a('0x86'),'status',_0x679a('0x81'),util['inspect'](_0x4d64fc['body'],{'showHidden':![],'depth':null}));}break;}return _0x3a8602;}})[_0x679a('0x3a')](respondWithResult(_0x156210,null))['catch'](handleError(_0x156210,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 8dc248a..9d240d4 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x1a8b69,_0x1e4f01){var _0x398d40=function(_0x57713c){while(--_0x57713c){_0x1a8b69['push'](_0x1a8b69['shift']());}};_0x398d40(++_0x1e4f01);}(_0x5f2f,0x73));var _0xf5f2=function(_0x278d6d,_0x576f51){_0x278d6d=_0x278d6d-0x0;var _0x104369=_0x5f2f[_0x278d6d];return _0x104369;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x4acf22,_0x1fbfd3){var _0x4fc728=function(_0x10e3e8){while(--_0x10e3e8){_0x4acf22['push'](_0x4acf22['shift']());}};_0x4fc728(++_0x1fbfd3);}(_0x7a54,0x106));var _0x47a5=function(_0x3308e6,_0x5e8cfd){_0x3308e6=_0x3308e6-0x0;var _0x10135e=_0x7a54[_0x3308e6];return _0x10135e;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('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 82d593b..0d7e499 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 _0x68b7=['./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','error','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','catch','afterCreate','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x29ccbf,_0x305077){var _0x464538=function(_0x121573){while(--_0x121573){_0x29ccbf['push'](_0x29ccbf['shift']());}};_0x464538(++_0x305077);}(_0x68b7,0x8c));var _0x768b=function(_0x44b619,_0x5ea07a){_0x44b619=_0x44b619-0x0;var _0x2825cd=_0x68b7[_0x44b619];return _0x2825cd;};'use strict';var _=require(_0x768b('0x0'));var util=require('util');var logger=require(_0x768b('0x1'))(_0x768b('0x2'));var moment=require(_0x768b('0x3'));var BPromise=require('bluebird');var rp=require(_0x768b('0x4'));var fs=require('fs');var path=require(_0x768b('0x5'));var rimraf=require(_0x768b('0x6'));var config=require('../../config/environment');var attributes=require(_0x768b('0x7'));module[_0x768b('0x8')]=function(_0x18aaaa,_0x31aba4){return _0x18aaaa[_0x768b('0x9')](_0x768b('0xa'),attributes,{'tableName':_0x768b('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x768b('0xc')]},{'name':'fti_whatsapp_messages','fields':[_0x768b('0xd')],'type':_0x768b('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ebfe5,_0x17f241,_0x40c6d3){var _0x2d4edc=_0x18aaaa['models'];var _0x3ab8a9=_0x3ebfe5[_0x768b('0xf')]({'plain':!![]});if(_0x3ab8a9['direction']['toLowerCase']()==='in'||_0x3ab8a9[_0x768b('0x10')][_0x768b('0x11')]()===_0x768b('0x12')&&!_0x3ab8a9[_0x768b('0x13')]&&!_[_0x768b('0x14')](_0x3ab8a9[_0x768b('0x15')])){_0x2d4edc[_0x768b('0x16')][_0x768b('0x17')]({'where':{'id':_0x3ab8a9[_0x768b('0x18')]}})['then'](function(_0x467f33){if(_0x467f33){_0x467f33[_0x768b('0x19')]({'lastMsgAt':_0x3ab8a9[_0x768b('0x1a')],'lastMsgDirection':_0x3ab8a9[_0x768b('0x10')][_0x768b('0x11')]()});}})['catch'](function(_0x17078f){console[_0x768b('0x1b')](_0x17078f);});}if(_0x3ab8a9[_0x768b('0x10')]===_0x768b('0x12')&&!_0x3ab8a9[_0x768b('0x13')]){var _0x7fc465;_0x2d4edc[_0x768b('0x1c')][_0x768b('0x1d')]({'where':{'id':_0x3ab8a9[_0x768b('0x1e')]},'raw':!![]})[_0x768b('0x1f')](function(_0x92160e){_0x7fc465=_0x92160e;if(_0x7fc465&&_0x7fc465[_0x768b('0x20')]){switch(_0x7fc465['type']){case'twilio':var _0x2ce978=require(_0x768b('0x21'));if(_0x7fc465['accountSid']&&_0x7fc465[_0x768b('0x22')]&&_0x7fc465[_0x768b('0x23')]){var _0x5c81ca=new _0x2ce978(_0x7fc465[_0x768b('0x24')],_0x7fc465[_0x768b('0x22')]);_0x5c81ca[_0x768b('0x25')][_0x768b('0x26')]({'body':_0x3ab8a9[_0x768b('0xd')],'to':'whatsapp:'+_0x3ab8a9['phone'],'from':_0x768b('0x27')+_0x7fc465[_0x768b('0x23')],'statusCallback':_0x7fc465[_0x768b('0x28')]+_0x768b('0x29')+_0x3ab8a9['id']+_0x768b('0x2a')+_0x7fc465[_0x768b('0x2b')]})[_0x768b('0x1f')](function(_0x3f5abe){if(_0x3f5abe[_0x768b('0x2c')]){return _0x3ebfe5[_0x768b('0x19')]({'messageId':_0x3f5abe[_0x768b('0x2c')]});}})[_0x768b('0x2d')](function(_0x3a5307){logger[_0x768b('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x768b('0x2e'),'twilio',util['inspect'](_0x3a5307,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x768b('0x2e'),_0x768b('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x768b('0x2f')](function(){_0x40c6d3();});}else{_0x40c6d3();}}},'charset':'utf8mb4','collate':_0x768b('0x30')});}; \ No newline at end of file +var _0x2deb=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','WhatsappInteractionId','update','createdAt','catch','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','token','then','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','finally','lodash'];(function(_0x6f1a87,_0x5d5bcf){var _0x2495c7=function(_0x1c6733){while(--_0x1c6733){_0x6f1a87['push'](_0x6f1a87['shift']());}};_0x2495c7(++_0x5d5bcf);}(_0x2deb,0xdb));var _0xb2de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2deb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var logger=require(_0xb2de('0x2'))(_0xb2de('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb2de('0x4'));var fs=require('fs');var path=require(_0xb2de('0x5'));var rimraf=require(_0xb2de('0x6'));var config=require(_0xb2de('0x7'));var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x201fcc,_0x2ed8ec){return _0x201fcc[_0xb2de('0x8')]('WhatsappMessage',attributes,{'tableName':_0xb2de('0x9'),'paranoid':![],'indexes':[{'name':_0xb2de('0xa'),'fields':['messageId']},{'name':_0xb2de('0xb'),'fields':[_0xb2de('0xc')],'type':_0xb2de('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x523fa4,_0x4490ea,_0x2e38d8){var _0x2b4e96=_0x201fcc[_0xb2de('0xe')];var _0x5dc248=_0x523fa4['get']({'plain':!![]});if(_0x5dc248[_0xb2de('0xf')][_0xb2de('0x10')]()==='in'||_0x5dc248[_0xb2de('0xf')]['toLowerCase']()===_0xb2de('0x11')&&!_0x5dc248[_0xb2de('0x12')]&&!_[_0xb2de('0x13')](_0x5dc248['UserId'])){_0x2b4e96[_0xb2de('0x14')]['findOne']({'where':{'id':_0x5dc248[_0xb2de('0x15')]}})['then'](function(_0x10ef21){if(_0x10ef21){_0x10ef21[_0xb2de('0x16')]({'lastMsgAt':_0x5dc248[_0xb2de('0x17')],'lastMsgDirection':_0x5dc248['direction'][_0xb2de('0x10')]()});}})[_0xb2de('0x18')](function(_0x2dc98f){console[_0xb2de('0x19')](_0x2dc98f);});}if(_0x5dc248[_0xb2de('0xf')]===_0xb2de('0x11')&&!_0x5dc248[_0xb2de('0x12')]){var _0x2db287;_0x2b4e96[_0xb2de('0x1a')]['find']({'where':{'id':_0x5dc248[_0xb2de('0x1b')]},'raw':!![]})['then'](function(_0x405e5d){_0x2db287=_0x405e5d;if(_0x2db287&&_0x2db287[_0xb2de('0x1c')]){switch(_0x2db287['type']){case _0xb2de('0x1d'):var _0x337bfe=require('twilio');if(_0x2db287[_0xb2de('0x1e')]&&_0x2db287[_0xb2de('0x1f')]&&_0x2db287[_0xb2de('0x20')]){var _0x148c91=new _0x337bfe(_0x2db287[_0xb2de('0x1e')],_0x2db287[_0xb2de('0x1f')]);_0x148c91[_0xb2de('0x21')][_0xb2de('0x22')]({'body':_0x5dc248[_0xb2de('0xc')],'to':'whatsapp:'+_0x5dc248[_0xb2de('0x20')],'from':_0xb2de('0x23')+_0x2db287[_0xb2de('0x20')],'statusCallback':_0x2db287[_0xb2de('0x24')]+'/api/whatsapp/messages/'+_0x5dc248['id']+'/status?token='+_0x2db287[_0xb2de('0x25')]})[_0xb2de('0x26')](function(_0x3d9ece){if(_0x3d9ece['sid']){return _0x523fa4[_0xb2de('0x16')]({'messageId':_0x3d9ece[_0xb2de('0x27')]});}})['catch'](function(_0x16c249){logger['error'](_0xb2de('0x28'),_0xb2de('0x29'),_0xb2de('0x1d'),util[_0xb2de('0x2a')](_0x16c249,{'showHidden':![],'depth':null}));});}else{logger[_0xb2de('0x19')](_0xb2de('0x28'),'afterCreate',_0xb2de('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0xb2de('0x2b')](function(){_0x2e38d8();});}else{_0x2e38d8();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 6f66bb6..1e4b909 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 _0x0ebb=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappMessage','options','lodash','util','moment','bluebird','ioredis'];(function(_0x587a0e,_0x57ca24){var _0x558014=function(_0x54da7f){while(--_0x54da7f){_0x587a0e['push'](_0x587a0e['shift']());}};_0x558014(++_0x57ca24);}(_0x0ebb,0x87));var _0xb0eb=function(_0x11af48,_0x4d2d91){_0x11af48=_0x11af48-0x0;var _0x3093c2=_0x0ebb[_0x11af48];return _0x3093c2;};'use strict';var _=require(_0xb0eb('0x0'));var util=require(_0xb0eb('0x1'));var moment=require(_0xb0eb('0x2'));var BPromise=require(_0xb0eb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb0eb('0x4'));var db=require(_0xb0eb('0x5'))['db'];var utils=require(_0xb0eb('0x6'));var logger=require(_0xb0eb('0x7'))(_0xb0eb('0x8'));var config=require(_0xb0eb('0x9'));var jayson=require(_0xb0eb('0xa'));var client=jayson['client'][_0xb0eb('0xb')]({'port':0x232a});config[_0xb0eb('0xc')]=_[_0xb0eb('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb0eb('0xc')]));require('./whatsappMessage.socket')[_0xb0eb('0xe')](socket);function respondWithRpcPromise(_0x106c5f,_0x1ecc2c,_0x559b91){return new BPromise(function(_0x5a3e61,_0x1ec511){return client['request'](_0x106c5f,_0x559b91)[_0xb0eb('0xf')](function(_0x4fdea){logger[_0xb0eb('0x10')](_0xb0eb('0x11'),_0x1ecc2c,_0xb0eb('0x12'));logger[_0xb0eb('0x13')](_0xb0eb('0x14'),_0x1ecc2c,_0xb0eb('0x12'),JSON[_0xb0eb('0x15')](_0x4fdea));if(_0x4fdea['error']){if(_0x4fdea[_0xb0eb('0x16')][_0xb0eb('0x17')]===0x1f4){logger[_0xb0eb('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x1ecc2c,_0x4fdea['error']['message']);return _0x1ec511(_0x4fdea[_0xb0eb('0x16')]['message']);}logger[_0xb0eb('0x16')](_0xb0eb('0x11'),_0x1ecc2c,_0x4fdea[_0xb0eb('0x16')][_0xb0eb('0x18')]);return _0x5a3e61(_0x4fdea[_0xb0eb('0x16')]['message']);}else{logger[_0xb0eb('0x10')](_0xb0eb('0x11'),_0x1ecc2c,'request\x20sent');_0x5a3e61(_0x4fdea['result']['message']);}})[_0xb0eb('0x19')](function(_0x4a8d49){logger[_0xb0eb('0x16')](_0xb0eb('0x11'),_0x1ecc2c,_0x4a8d49);_0x1ec511(_0x4a8d49);});});}exports[_0xb0eb('0x1a')]=function(_0x5a85b0){var _0x4d562a=this;return new Promise(function(_0x458796,_0xb1ba7){return db['WhatsappMessage']['create'](_0x5a85b0['body'],{'raw':_0x5a85b0[_0xb0eb('0x1b')]?_0x5a85b0[_0xb0eb('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x468ce6){logger['info'](_0xb0eb('0x1a'),_0x5a85b0);logger[_0xb0eb('0x13')]('CreateWhatsappMessage',_0x5a85b0,JSON['stringify'](_0x468ce6));_0x458796(_0x468ce6);})[_0xb0eb('0x19')](function(_0x48743b){logger[_0xb0eb('0x16')]('CreateWhatsappMessage',_0x48743b[_0xb0eb('0x18')],_0x5a85b0);_0xb1ba7(_0x4d562a[_0xb0eb('0x16')](0x1f4,_0x48743b['message']));});});}; \ No newline at end of file +var _0xbe88=['randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','util','moment','bluebird'];(function(_0x48b952,_0x5239ea){var _0x5df39f=function(_0x3cc6fb){while(--_0x3cc6fb){_0x48b952['push'](_0x48b952['shift']());}};_0x5df39f(++_0x5239ea);}(_0xbe88,0x190));var _0x8be8=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0xbe88[_0x1c34e7];return _0x378cb1;};'use strict';var _=require('lodash');var util=require(_0x8be8('0x0'));var moment=require(_0x8be8('0x1'));var BPromise=require(_0x8be8('0x2'));var rs=require(_0x8be8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8be8('0x4'))('rpc');var config=require(_0x8be8('0x5'));var jayson=require(_0x8be8('0x6'));var client=jayson[_0x8be8('0x7')][_0x8be8('0x8')]({'port':0x232a});config[_0x8be8('0x9')]=_[_0x8be8('0xa')](config[_0x8be8('0x9')],{'host':_0x8be8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8be8('0xc'))[_0x8be8('0xd')](socket);function respondWithRpcPromise(_0x165281,_0x592c08,_0x3a95aa){return new BPromise(function(_0x4f80bf,_0x3ae067){return client[_0x8be8('0xe')](_0x165281,_0x3a95aa)[_0x8be8('0xf')](function(_0x4bd450){logger[_0x8be8('0x10')](_0x8be8('0x11'),_0x592c08,_0x8be8('0x12'));logger[_0x8be8('0x13')](_0x8be8('0x14'),_0x592c08,'request\x20sent',JSON[_0x8be8('0x15')](_0x4bd450));if(_0x4bd450[_0x8be8('0x16')]){if(_0x4bd450['error']['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x592c08,_0x4bd450[_0x8be8('0x16')][_0x8be8('0x17')]);return _0x3ae067(_0x4bd450['error'][_0x8be8('0x17')]);}logger[_0x8be8('0x16')](_0x8be8('0x11'),_0x592c08,_0x4bd450[_0x8be8('0x16')][_0x8be8('0x17')]);return _0x4f80bf(_0x4bd450[_0x8be8('0x16')][_0x8be8('0x17')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x592c08,_0x8be8('0x12'));_0x4f80bf(_0x4bd450[_0x8be8('0x18')][_0x8be8('0x17')]);}})[_0x8be8('0x19')](function(_0x4f2990){logger[_0x8be8('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x592c08,_0x4f2990);_0x3ae067(_0x4f2990);});});}exports[_0x8be8('0x1a')]=function(_0x4b949e){var _0x39a59d=this;return new Promise(function(_0x5e5ce9,_0x470eb4){return db[_0x8be8('0x1b')][_0x8be8('0x1c')](_0x4b949e['body'],{'raw':_0x4b949e[_0x8be8('0x1d')]?_0x4b949e[_0x8be8('0x1d')][_0x8be8('0x1e')]===undefined?!![]:![]:!![]})[_0x8be8('0xf')](function(_0x4f3d2e){logger[_0x8be8('0x10')](_0x8be8('0x1a'),_0x4b949e);logger[_0x8be8('0x13')]('CreateWhatsappMessage',_0x4b949e,JSON[_0x8be8('0x15')](_0x4f3d2e));_0x5e5ce9(_0x4f3d2e);})['catch'](function(_0x190d3e){logger[_0x8be8('0x16')](_0x8be8('0x1a'),_0x190d3e[_0x8be8('0x17')],_0x4b949e);_0x470eb4(_0x39a59d[_0x8be8('0x16')](0x1f4,_0x190d3e[_0x8be8('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 6869561..e8faf8e 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 _0xe58a=['whatsappMessage:','./whatsappMessage.events','emit','removeListener','register','length'];(function(_0x5b6e45,_0x3f4fe6){var _0x2206c9=function(_0x830fae){while(--_0x830fae){_0x5b6e45['push'](_0x5b6e45['shift']());}};_0x2206c9(++_0x3f4fe6);}(_0xe58a,0x115));var _0xae58=function(_0x4d845f,_0xef45b3){_0x4d845f=_0x4d845f-0x0;var _0x1b7443=_0xe58a[_0x4d845f];return _0x1b7443;};'use strict';var WhatsappMessageEvents=require(_0xae58('0x0'));var events=['save','remove','update'];function createListener(_0x3ab041,_0x17d927){return function(_0x2ee26e){_0x17d927[_0xae58('0x1')](_0x3ab041,_0x2ee26e);};}function removeListener(_0x279c7a,_0x122271){return function(){WhatsappMessageEvents[_0xae58('0x2')](_0x279c7a,_0x122271);};}exports[_0xae58('0x3')]=function(_0x200d5a){for(var _0x43e9a9=0x0,_0x5a10de=events[_0xae58('0x4')];_0x43e9a9<_0x5a10de;_0x43e9a9++){var _0x15f74c=events[_0x43e9a9];var _0x9c56d2=createListener(_0xae58('0x5')+_0x15f74c,_0x200d5a);WhatsappMessageEvents['on'](_0x15f74c,_0x9c56d2);}}; \ No newline at end of file +var _0xa169=['removeListener','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa169,0x1ed));var _0x9a16=function(_0x5a8d27,_0x37c21f){_0x5a8d27=_0x5a8d27-0x0;var _0x338a09=_0xa169[_0x5a8d27];return _0x338a09;};'use strict';var WhatsappMessageEvents=require(_0x9a16('0x0'));var events=[_0x9a16('0x1'),'remove','update'];function createListener(_0x4040bc,_0x1bfa9d){return function(_0x5b4495){_0x1bfa9d['emit'](_0x4040bc,_0x5b4495);};}function removeListener(_0x59c316,_0xa8eb54){return function(){WhatsappMessageEvents[_0x9a16('0x2')](_0x59c316,_0xa8eb54);};}exports['register']=function(_0x3c775f){for(var _0x515526=0x0,_0x18e9b0=events[_0x9a16('0x3')];_0x515526<_0x18e9b0;_0x515526++){var _0x117ffd=events[_0x515526];var _0x43a34d=createListener(_0x9a16('0x4')+_0x117ffd,_0x3c775f);WhatsappMessageEvents['on'](_0x117ffd,_0x43a34d);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index d7d1684..b736b7c 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 _0xdf77=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','post','create','put','update','delete','destroy','removeTeams','removeAgents','exports','multer'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xdf77,0x13e));var _0x7df7=function(_0x1c8994,_0x4072da){_0x1c8994=_0x1c8994-0x0;var _0x108675=_0xdf77[_0x1c8994];return _0x108675;};'use strict';var multer=require(_0x7df7('0x0'));var util=require(_0x7df7('0x1'));var path=require(_0x7df7('0x2'));var timeout=require(_0x7df7('0x3'));var express=require(_0x7df7('0x4'));var router=express[_0x7df7('0x5')]();var fs_extra=require(_0x7df7('0x6'));var auth=require(_0x7df7('0x7'));var interaction=require(_0x7df7('0x8'));var config=require(_0x7df7('0x9'));var controller=require('./whatsappQueue.controller');router[_0x7df7('0xa')]('/',auth[_0x7df7('0xb')](),controller[_0x7df7('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7df7('0xd')]);router['get'](_0x7df7('0xe'),auth[_0x7df7('0xb')](),controller[_0x7df7('0xf')]);router[_0x7df7('0xa')](_0x7df7('0x10'),auth['isAuthenticated'](),controller[_0x7df7('0x11')]);router['get'](_0x7df7('0x12'),auth[_0x7df7('0xb')](),controller['getTeams']);router['get'](_0x7df7('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x7df7('0x14')]('/',auth[_0x7df7('0xb')](),controller[_0x7df7('0x15')]);router['post'](_0x7df7('0x12'),auth['isAuthenticated'](),controller['addTeams']);router[_0x7df7('0x14')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x7df7('0x16')](_0x7df7('0xe'),auth['isAuthenticated'](),controller[_0x7df7('0x17')]);router[_0x7df7('0x18')]('/:id',auth[_0x7df7('0xb')](),controller[_0x7df7('0x19')]);router[_0x7df7('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7df7('0x1a')]);router[_0x7df7('0x18')](_0x7df7('0x13'),auth[_0x7df7('0xb')](),controller[_0x7df7('0x1b')]);module[_0x7df7('0x1c')]=router; \ No newline at end of file +var _0x46c4=['describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','delete','destroy','removeTeams','removeAgents','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x46c4,0x16e));var _0x446c=function(_0xdafe39,_0x11348d){_0xdafe39=_0xdafe39-0x0;var _0x3b53b4=_0x46c4[_0xdafe39];return _0x3b53b4;};'use strict';var multer=require(_0x446c('0x0'));var util=require('util');var path=require(_0x446c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x446c('0x2')]();var fs_extra=require(_0x446c('0x3'));var auth=require(_0x446c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x446c('0x5'));var controller=require('./whatsappQueue.controller');router[_0x446c('0x6')]('/',auth[_0x446c('0x7')](),controller['index']);router[_0x446c('0x6')](_0x446c('0x8'),auth['isAuthenticated'](),controller[_0x446c('0x9')]);router[_0x446c('0x6')](_0x446c('0xa'),auth[_0x446c('0x7')](),controller['show']);router[_0x446c('0x6')](_0x446c('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0x446c('0x6')](_0x446c('0xc'),auth[_0x446c('0x7')](),controller[_0x446c('0xd')]);router[_0x446c('0x6')](_0x446c('0xe'),auth['isAuthenticated'](),controller[_0x446c('0xf')]);router[_0x446c('0x10')]('/',auth[_0x446c('0x7')](),controller[_0x446c('0x11')]);router['post'](_0x446c('0xc'),auth['isAuthenticated'](),controller[_0x446c('0x12')]);router['post'](_0x446c('0xe'),auth[_0x446c('0x7')](),controller['addAgents']);router[_0x446c('0x13')]('/:id',auth[_0x446c('0x7')](),controller['update']);router[_0x446c('0x14')](_0x446c('0xa'),auth[_0x446c('0x7')](),controller[_0x446c('0x15')]);router[_0x446c('0x14')]('/:id/teams',auth[_0x446c('0x7')](),controller[_0x446c('0x16')]);router[_0x446c('0x14')](_0x446c('0xe'),auth[_0x446c('0x7')](),controller[_0x446c('0x17')]);module[_0x446c('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 3f61dda..42c8d74 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 _0x3402=['name','INTEGER','beepall','roundrobin','sequelize','STRING'];(function(_0x5a4213,_0x2602d9){var _0x3f1345=function(_0x2ebd3c){while(--_0x2ebd3c){_0x5a4213['push'](_0x5a4213['shift']());}};_0x3f1345(++_0x2602d9);}(_0x3402,0x1f0));var _0x2340=function(_0xad0cd9,_0xdae116){_0xad0cd9=_0xad0cd9-0x0;var _0xb1c131=_0x3402[_0xad0cd9];return _0xb1c131;};'use strict';var Sequelize=require(_0x2340('0x0'));module['exports']={'name':{'type':Sequelize[_0x2340('0x1')],'unique':_0x2340('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2340('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x2340('0x4'),_0x2340('0x5'))},'description':{'type':Sequelize[_0x2340('0x1')]}}; \ No newline at end of file +var _0x1435=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x473463,_0x21da73){var _0x42f406=function(_0x34a5be){while(--_0x34a5be){_0x473463['push'](_0x473463['shift']());}};_0x42f406(++_0x21da73);}(_0x1435,0x161));var _0x5143=function(_0x4abff5,_0x261a72){_0x4abff5=_0x4abff5-0x0;var _0x12f89d=_0x1435[_0x4abff5];return _0x12f89d;};'use strict';var Sequelize=require(_0x5143('0x0'));module[_0x5143('0x1')]={'name':{'type':Sequelize[_0x5143('0x2')],'unique':_0x5143('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5143('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5143('0x5')](_0x5143('0x6'),'beepall',_0x5143('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 86c0212..740761d 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 _0x3375=['query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','WhatsappQueue','includeAll','include','findAll','rows','show','length','merge','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','whatsappPause','getTeams','findOne','Team','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','value','isEmpty','addAgents','omit','spread','removeAgents','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','get','WhatsappQueues','destroy','error','stack','name','send','render','body','contact','message','agent','account','index','rawAttributes','fieldName','key','model','map'];(function(_0x5ec454,_0xfcd77e){var _0x5ebf50=function(_0x29de85){while(--_0x29de85){_0x5ec454['push'](_0x5ec454['shift']());}};_0x5ebf50(++_0xfcd77e);}(_0x3375,0xe7));var _0x5337=function(_0x888751,_0xa45d8e){_0x888751=_0x888751-0x0;var _0x406065=_0x3375[_0x888751];return _0x406065;};'use strict';var emlformat=require(_0x5337('0x0'));var rimraf=require(_0x5337('0x1'));var zipdir=require(_0x5337('0x2'));var jsonpatch=require(_0x5337('0x3'));var rp=require(_0x5337('0x4'));var moment=require(_0x5337('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5337('0x6'));var util=require('util');var path=require(_0x5337('0x7'));var sox=require(_0x5337('0x8'));var csv=require(_0x5337('0x9'));var ejs=require(_0x5337('0xa'));var fs=require('fs');var fs_extra=require(_0x5337('0xb'));var _=require(_0x5337('0xc'));var squel=require(_0x5337('0xd'));var crypto=require(_0x5337('0xe'));var jsforce=require(_0x5337('0xf'));var deskjs=require(_0x5337('0x10'));var toCsv=require(_0x5337('0x9'));var querystring=require(_0x5337('0x11'));var Papa=require('papaparse');var Redis=require(_0x5337('0x12'));var authService=require(_0x5337('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5337('0x14'));var hardwareService=require(_0x5337('0x15'));var logger=require(_0x5337('0x16'))(_0x5337('0x17'));var utils=require(_0x5337('0x18'));var config=require(_0x5337('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5337('0x1a'))['db'];config[_0x5337('0x1b')]=_['defaults'](config[_0x5337('0x1b')],{'host':_0x5337('0x1c'),'port':0x18eb});var socket=require(_0x5337('0x1d'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x5337('0x1e')](socket);function respondWithStatusCode(_0x1663a9,_0x346d56){_0x346d56=_0x346d56||0xcc;return function(_0x1cf09b){if(_0x1cf09b){return _0x1663a9['sendStatus'](_0x346d56);}return _0x1663a9[_0x5337('0x1f')](_0x346d56)[_0x5337('0x20')]();};}function respondWithResult(_0x1d764f,_0x458400){_0x458400=_0x458400||0xc8;return function(_0xeab7c1){if(_0xeab7c1){return _0x1d764f[_0x5337('0x1f')](_0x458400)[_0x5337('0x21')](_0xeab7c1);}};}function respondWithFilteredResult(_0x5a6a51,_0x221027){return function(_0x2e31d8){if(_0x2e31d8){var _0xccbc73=typeof _0x221027[_0x5337('0x22')]===_0x5337('0x23')&&typeof _0x221027[_0x5337('0x24')]==='undefined';var _0x227598=_0x2e31d8[_0x5337('0x25')];var _0x51eba8=_0xccbc73?0x0:_0x221027[_0x5337('0x22')];var _0x1f7519=_0xccbc73?_0x2e31d8['count']:_0x221027['offset']+_0x221027['limit'];var _0x41a899;if(_0x1f7519>=_0x227598){_0x1f7519=_0x227598;_0x41a899=0xc8;}else{_0x41a899=0xce;}_0x5a6a51['status'](_0x41a899);return _0x5a6a51[_0x5337('0x26')](_0x5337('0x27'),_0x51eba8+'-'+_0x1f7519+'/'+_0x227598)[_0x5337('0x21')](_0x2e31d8);}return null;};}function patchUpdates(_0x482729){return function(_0x4bc098){try{jsonpatch['apply'](_0x4bc098,_0x482729,!![]);}catch(_0x22dd26){return BPromise['reject'](_0x22dd26);}return _0x4bc098['save']();};}function saveUpdates(_0x40fe3b,_0x8018d2){return function(_0x4f058c){if(_0x4f058c){return _0x4f058c[_0x5337('0x28')](_0x40fe3b)[_0x5337('0x29')](function(_0x24f383){return _0x24f383;});}return null;};}function removeEntity(_0x3e5fed,_0x3fd8cd){return function(_0x1d9570){if(_0x1d9570){return _0x1d9570['destroy']()['then'](function(){var _0x30d26f=_0x1d9570[_0x5337('0x2a')]({'plain':!![]});var _0x462d1e=_0x5337('0x2b');return db['UserProfileResource'][_0x5337('0x2c')]({'where':{'type':_0x462d1e,'resourceId':_0x30d26f['id']}})[_0x5337('0x29')](function(){return _0x1d9570;});})[_0x5337('0x29')](function(){_0x3e5fed['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46baea,_0x57a2b7){return function(_0x4c649b){if(!_0x4c649b){_0x46baea['sendStatus'](0x194);}return _0x4c649b;};}function handleError(_0x4d6670,_0x258449){_0x258449=_0x258449||0x1f4;return function(_0x3ab417){logger[_0x5337('0x2d')](_0x3ab417[_0x5337('0x2e')]);if(_0x3ab417[_0x5337('0x2f')]){delete _0x3ab417[_0x5337('0x2f')];}_0x4d6670[_0x5337('0x1f')](_0x258449)[_0x5337('0x30')](_0x3ab417);};}function getMustacheRender(_0x5b8486,_0x5cc0d2){return Mustache[_0x5337('0x31')](_0x5b8486,_['merge'](_0x5cc0d2[_0x5337('0x32')],{'contact':_0x5cc0d2[_0x5337('0x33')],'message':_0x5cc0d2[_0x5337('0x34')],'agent':_0x5cc0d2[_0x5337('0x35')],'interaction':_0x5cc0d2['interaction'],'account':_0x5cc0d2[_0x5337('0x36')]}))||'';}exports[_0x5337('0x37')]=function(_0x29ffed,_0x1fcf2e){var _0x1d3006={},_0x3d8ac6={},_0x5e7d87={'count':0x0,'rows':[]};var _0x13f58e=_['map'](db['WhatsappQueue'][_0x5337('0x38')],function(_0x34e1a9){return{'name':_0x34e1a9[_0x5337('0x39')],'type':_0x34e1a9['type'][_0x5337('0x3a')]};});_0x3d8ac6[_0x5337('0x3b')]=_[_0x5337('0x3c')](_0x13f58e,_0x5337('0x2f'));_0x3d8ac6[_0x5337('0x3d')]=_[_0x5337('0x3e')](_0x29ffed['query']);_0x3d8ac6[_0x5337('0x3f')]=_['intersection'](_0x3d8ac6['model'],_0x3d8ac6['query']);_0x1d3006[_0x5337('0x40')]=_[_0x5337('0x41')](_0x3d8ac6[_0x5337('0x3b')],qs[_0x5337('0x42')](_0x29ffed['query']['fields']));_0x1d3006['attributes']=_0x1d3006[_0x5337('0x40')]['length']?_0x1d3006[_0x5337('0x40')]:_0x3d8ac6[_0x5337('0x3b')];if(!_0x29ffed[_0x5337('0x3d')][_0x5337('0x43')](_0x5337('0x44'))){_0x1d3006[_0x5337('0x24')]=qs[_0x5337('0x24')](_0x29ffed[_0x5337('0x3d')]['limit']);_0x1d3006[_0x5337('0x22')]=qs[_0x5337('0x22')](_0x29ffed[_0x5337('0x3d')][_0x5337('0x22')]);}_0x1d3006[_0x5337('0x45')]=qs[_0x5337('0x46')](_0x29ffed[_0x5337('0x3d')][_0x5337('0x46')]);_0x1d3006[_0x5337('0x47')]=qs[_0x5337('0x3f')](_[_0x5337('0x48')](_0x29ffed[_0x5337('0x3d')],_0x3d8ac6[_0x5337('0x3f')]),_0x13f58e);if(_0x29ffed[_0x5337('0x3d')]['filter']){_0x1d3006[_0x5337('0x47')]=_['merge'](_0x1d3006[_0x5337('0x47')],{'$or':_[_0x5337('0x3c')](_0x13f58e,function(_0xbc94e9){if(_0xbc94e9[_0x5337('0x49')]!==_0x5337('0x4a')){var _0x4097fe={};_0x4097fe[_0xbc94e9[_0x5337('0x2f')]]={'$like':'%'+_0x29ffed['query'][_0x5337('0x4b')]+'%'};return _0x4097fe;}})});}_0x1d3006=_['merge']({},_0x1d3006,_0x29ffed[_0x5337('0x4c')]);var _0x240f03={'where':_0x1d3006[_0x5337('0x47')]};return db[_0x5337('0x4d')]['count'](_0x240f03)[_0x5337('0x29')](function(_0x3ea9af){_0x5e7d87[_0x5337('0x25')]=_0x3ea9af;if(_0x29ffed[_0x5337('0x3d')][_0x5337('0x4e')]){_0x1d3006[_0x5337('0x4f')]=[{'all':!![]}];}return db[_0x5337('0x4d')][_0x5337('0x50')](_0x1d3006);})[_0x5337('0x29')](function(_0x53bcb8){_0x5e7d87[_0x5337('0x51')]=_0x53bcb8;return _0x5e7d87;})[_0x5337('0x29')](respondWithFilteredResult(_0x1fcf2e,_0x1d3006))['catch'](handleError(_0x1fcf2e,null));};exports[_0x5337('0x52')]=function(_0x2d60bf,_0x11f6b7){var _0x2df983={'raw':!![],'where':{'id':_0x2d60bf['params']['id']}},_0x3117e9={};_0x3117e9[_0x5337('0x3b')]=_['keys'](db[_0x5337('0x4d')][_0x5337('0x38')]);_0x3117e9[_0x5337('0x3d')]=_['keys'](_0x2d60bf[_0x5337('0x3d')]);_0x3117e9[_0x5337('0x3f')]=_[_0x5337('0x41')](_0x3117e9[_0x5337('0x3b')],_0x3117e9[_0x5337('0x3d')]);_0x2df983[_0x5337('0x40')]=_[_0x5337('0x41')](_0x3117e9['model'],qs[_0x5337('0x42')](_0x2d60bf['query'][_0x5337('0x42')]));_0x2df983['attributes']=_0x2df983['attributes'][_0x5337('0x53')]?_0x2df983[_0x5337('0x40')]:_0x3117e9[_0x5337('0x3b')];if(_0x2d60bf['query'][_0x5337('0x4e')]){_0x2df983[_0x5337('0x4f')]=[{'all':!![]}];}_0x2df983=_[_0x5337('0x54')]({},_0x2df983,_0x2d60bf[_0x5337('0x4c')]);return db[_0x5337('0x4d')][_0x5337('0x55')](_0x2df983)[_0x5337('0x29')](handleEntityNotFound(_0x11f6b7,null))[_0x5337('0x29')](respondWithResult(_0x11f6b7,null))[_0x5337('0x56')](handleError(_0x11f6b7,null));};exports[_0x5337('0x57')]=function(_0x4063b3,_0xd7da36){return db['WhatsappQueue']['create'](_0x4063b3[_0x5337('0x32')],{})[_0x5337('0x29')](function(_0x16dedc){var _0xfeaa50=_0x4063b3[_0x5337('0x58')][_0x5337('0x2a')]({'plain':!![]});if(!_0xfeaa50)throw new Error(_0x5337('0x59'));if(_0xfeaa50['role']===_0x5337('0x58')){var _0x390d96=_0x16dedc[_0x5337('0x2a')]({'plain':!![]});var _0x46d4ab='WhatsappQueues';return db[_0x5337('0x5a')][_0x5337('0x55')]({'where':{'name':_0x46d4ab,'userProfileId':_0xfeaa50['userProfileId']},'raw':!![]})[_0x5337('0x29')](function(_0x58a311){if(_0x58a311&&_0x58a311['autoAssociation']===0x0){return db[_0x5337('0x5b')]['create']({'name':_0x390d96['name'],'resourceId':_0x390d96['id'],'type':_0x58a311['name'],'sectionId':_0x58a311['id']},{})[_0x5337('0x29')](function(){return _0x16dedc;});}else{return _0x16dedc;}})[_0x5337('0x56')](function(_0x5c797c){logger[_0x5337('0x2d')](_0x5337('0x5c'),_0x5c797c);throw _0x5c797c;});}return _0x16dedc;})[_0x5337('0x29')](respondWithResult(_0xd7da36,0xc9))['catch'](handleError(_0xd7da36,null));};exports[_0x5337('0x28')]=function(_0x3075c4,_0x29b036){if(_0x3075c4['body']['id']){delete _0x3075c4[_0x5337('0x32')]['id'];}return db[_0x5337('0x4d')][_0x5337('0x55')]({'where':{'id':_0x3075c4[_0x5337('0x5d')]['id']}})[_0x5337('0x29')](handleEntityNotFound(_0x29b036,null))['then'](saveUpdates(_0x3075c4[_0x5337('0x32')],null))['then'](respondWithResult(_0x29b036,null))[_0x5337('0x56')](handleError(_0x29b036,null));};exports[_0x5337('0x2c')]=function(_0x2577cd,_0x1e68a4){return db['WhatsappQueue']['find']({'where':{'id':_0x2577cd[_0x5337('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1e68a4,null))[_0x5337('0x29')](removeEntity(_0x1e68a4,null))[_0x5337('0x56')](handleError(_0x1e68a4,null));};exports[_0x5337('0x5e')]=function(_0x58fa6e,_0x18d685){return db[_0x5337('0x4d')]['describe']()[_0x5337('0x29')](respondWithResult(_0x18d685,null))['catch'](handleError(_0x18d685,null));};exports[_0x5337('0x5f')]=function(_0x1448a5,_0x239796,_0x159e37){var _0x1e8d0d={'raw':!![],'where':{}},_0x209330={},_0x5244eb;return db[_0x5337('0x4d')]['findOne']({'where':{'id':_0x1448a5[_0x5337('0x5d')]['id']}})['then'](handleEntityNotFound(_0x239796,null))[_0x5337('0x29')](function(_0x262c4e){if(_0x262c4e){_0x5244eb=_0x262c4e[_0x5337('0x2a')]({'plain':!![]});_0x209330['model']=_['keys'](db['UserWhatsappQueue'][_0x5337('0x38')]);_0x209330[_0x5337('0x3d')]=_[_0x5337('0x3e')](_0x1448a5['query']);_0x209330[_0x5337('0x3f')]=_['intersection'](_0x209330[_0x5337('0x3b')],_0x209330[_0x5337('0x3d')]);_0x1e8d0d[_0x5337('0x40')]=_[_0x5337('0x41')](_0x209330[_0x5337('0x3b')],qs[_0x5337('0x42')](_0x1448a5['query'][_0x5337('0x42')]));_0x1e8d0d['attributes']=_0x1e8d0d[_0x5337('0x40')][_0x5337('0x53')]?_0x1e8d0d[_0x5337('0x40')]:_0x209330[_0x5337('0x3b')];if(!_0x1448a5[_0x5337('0x3d')][_0x5337('0x43')]('nolimit')){_0x1e8d0d[_0x5337('0x24')]=qs[_0x5337('0x24')](_0x1448a5[_0x5337('0x3d')]['limit']);_0x1e8d0d[_0x5337('0x22')]=qs[_0x5337('0x22')](_0x1448a5[_0x5337('0x3d')][_0x5337('0x22')]);}_0x1e8d0d[_0x5337('0x45')]=qs['sort'](_0x1448a5[_0x5337('0x3d')][_0x5337('0x46')]);_0x1e8d0d[_0x5337('0x47')]=qs[_0x5337('0x3f')](_[_0x5337('0x48')](_0x1448a5[_0x5337('0x3d')],_0x209330[_0x5337('0x3f')]));_0x1e8d0d[_0x5337('0x47')][_0x5337('0x60')]=_0x262c4e['id'];if(_0x1448a5[_0x5337('0x3d')][_0x5337('0x4b')]){_0x1e8d0d[_0x5337('0x47')]=_[_0x5337('0x54')](_0x1e8d0d[_0x5337('0x47')],{'$or':_[_0x5337('0x3c')](_0x1e8d0d[_0x5337('0x40')],function(_0x2fc416){var _0x4a0023={};_0x4a0023[_0x2fc416]={'$like':'%'+_0x1448a5[_0x5337('0x3d')]['filter']+'%'};return _0x4a0023;})});}_0x1e8d0d=_['merge']({},_0x1e8d0d,_0x1448a5[_0x5337('0x4c')]);return db[_0x5337('0x61')][_0x5337('0x50')](_0x1e8d0d);}})[_0x5337('0x29')](function(_0x27812e){if(_0x27812e){return db[_0x5337('0x62')][_0x5337('0x63')]({'where':{'id':_[_0x5337('0x3c')](_0x27812e,_0x5337('0x64')),'role':_0x5337('0x35')},'attributes':['id',_0x5337('0x2f'),'whatsappPause',_0x5337('0x65'),_0x5337('0x66')]});}})[_0x5337('0x29')](function(_0x5d8e37){if(_0x5d8e37){return{'count':_0x5d8e37[_0x5337('0x25')],'rows':_[_0x5337('0x3c')](_0x5d8e37[_0x5337('0x51')],function(_0x5c576b){return{'membername':_0x5c576b[_0x5337('0x2f')],'UserId':_0x5c576b['id'],'queue_name':_0x5244eb[_0x5337('0x2f')],'WhatsappQueueId':_0x5244eb['id'],'interface':util[_0x5337('0x67')](_0x5337('0x68'),_0x5337('0x69'),_0x5c576b[_0x5337('0x2f')]),'penalty':0x0,'paused':_0x5c576b[_0x5337('0x6a')],'createdAt':_0x5c576b['createdAt'],'updatedAt':_0x5c576b[_0x5337('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5337('0x29')](respondWithFilteredResult(_0x239796,_0x1e8d0d))['catch'](handleError(_0x239796,null));};exports[_0x5337('0x6b')]=function(_0xf92723,_0x5035d6,_0x494f6e){var _0x2655c9={};var _0x31a83e={};var _0x157f02;var _0xdcbccb;return db[_0x5337('0x4d')][_0x5337('0x6c')]({'where':{'id':_0xf92723[_0x5337('0x5d')]['id']}})[_0x5337('0x29')](handleEntityNotFound(_0x5035d6,null))['then'](function(_0x18e8a2){if(_0x18e8a2){_0x157f02=_0x18e8a2;_0x31a83e[_0x5337('0x3b')]=_[_0x5337('0x3e')](db[_0x5337('0x6d')][_0x5337('0x38')]);_0x31a83e['query']=_[_0x5337('0x3e')](_0xf92723[_0x5337('0x3d')]);_0x31a83e[_0x5337('0x3f')]=_[_0x5337('0x41')](_0x31a83e[_0x5337('0x3b')],_0x31a83e[_0x5337('0x3d')]);_0x2655c9[_0x5337('0x40')]=_[_0x5337('0x41')](_0x31a83e['model'],qs['fields'](_0xf92723[_0x5337('0x3d')][_0x5337('0x42')]));_0x2655c9[_0x5337('0x40')]=_0x2655c9[_0x5337('0x40')]['length']?_0x2655c9['attributes']:_0x31a83e[_0x5337('0x3b')];_0x2655c9['order']=qs[_0x5337('0x46')](_0xf92723[_0x5337('0x3d')][_0x5337('0x46')]);_0x2655c9[_0x5337('0x47')]=qs[_0x5337('0x3f')](_[_0x5337('0x48')](_0xf92723[_0x5337('0x3d')],_0x31a83e[_0x5337('0x3f')]));if(_0xf92723['query'][_0x5337('0x4b')]){_0x2655c9[_0x5337('0x47')]=_[_0x5337('0x54')](_0x2655c9['where'],{'$or':_[_0x5337('0x3c')](_0x2655c9['attributes'],function(_0x101f84){var _0x670c2b={};_0x670c2b[_0x101f84]={'$like':'%'+_0xf92723[_0x5337('0x3d')][_0x5337('0x4b')]+'%'};return _0x670c2b;})});}_0x2655c9=_[_0x5337('0x54')]({},_0x2655c9,_0xf92723[_0x5337('0x4c')]);return _0x157f02[_0x5337('0x6b')](_0x2655c9);}})[_0x5337('0x29')](function(_0x3cf8a5){if(_0x3cf8a5){_0xdcbccb=_0x3cf8a5['length'];if(!_0xf92723[_0x5337('0x3d')][_0x5337('0x43')](_0x5337('0x44'))){_0x2655c9['limit']=qs[_0x5337('0x24')](_0xf92723['query'][_0x5337('0x24')]);_0x2655c9[_0x5337('0x22')]=qs['offset'](_0xf92723[_0x5337('0x3d')][_0x5337('0x22')]);}return _0x157f02[_0x5337('0x6b')](_0x2655c9);}})[_0x5337('0x29')](function(_0x2e4751){if(_0x2e4751){return _0x2e4751?{'count':_0xdcbccb,'rows':_0x2e4751}:null;}})[_0x5337('0x29')](respondWithResult(_0x5035d6,null))['catch'](handleError(_0x5035d6,null));};exports['addTeams']=function(_0x3b1462,_0x48be70,_0x569369){var _0x13abe8=_0x3b1462['body'][_0x5337('0x6e')];return db[_0x5337('0x6d')][_0x5337('0x50')]({'where':{'id':_0x13abe8},'attributes':['id'],'include':[{'model':db[_0x5337('0x62')],'as':_0x5337('0x6f'),'attributes':['id','name',_0x5337('0x70'),_0x5337('0x71'),_0x5337('0x72')],'raw':!![]}]})[_0x5337('0x29')](function(_0x4d0044){if(_0x4d0044){var _0x50f292=_['flatMap'](_0x4d0044,function(_0x3065ef){var _0xcb7fb6=_0x3065ef[_0x5337('0x2a')]({'plain':!![]});return _0xcb7fb6[_0x5337('0x6f')];});return db[_0x5337('0x4d')]['find']({'where':{'id':_0x3b1462[_0x5337('0x5d')]['id']}})[_0x5337('0x29')](function(_0x5a5ebf){return db[_0x5337('0x73')][_0x5337('0x74')](function(_0x53592f){return _0x5a5ebf[_0x5337('0x75')](_0x13abe8,{'transaction':_0x53592f})[_0x5337('0x29')](function(){return BPromise[_0x5337('0x76')](_0x50f292,function(_0x1df851){return db[_0x5337('0x61')][_0x5337('0x77')]({'where':{'UserId':_0x1df851['id'],'WhatsappQueueId':_0x3b1462['params']['id']},'transaction':_0x53592f});});})[_0x5337('0x29')](function(){_0x50f292[_0x5337('0x78')](function(_0x270994){socket[_0x5337('0x79')](_0x5337('0x7a'),{'UserId':_0x270994['id'],'WhatsappQueueId':_0x5a5ebf['id']});});});});});}})[_0x5337('0x29')](respondWithStatusCode(_0x48be70,null))[_0x5337('0x56')](handleError(_0x48be70,null));};exports[_0x5337('0x7b')]=function(_0x21a615,_0x5401a7,_0x481ef1){return db[_0x5337('0x6d')][_0x5337('0x50')]({'where':{'id':_0x21a615[_0x5337('0x3d')][_0x5337('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x5337('0x62')],'as':_0x5337('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5401a7,null))[_0x5337('0x29')](function(_0x489a35){var _0x388e8f=_[_0x5337('0x3c')](_0x489a35,'id');var _0x33f292=[];var _0x55640e=[];var _0x3138d2=squel['select']();_0x3138d2[_0x5337('0x7c')](_0x5337('0x7d'))[_0x5337('0x7e')](_0x5337('0x7f'),'tq')[_0x5337('0x80')](_0x5337('0x81'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x5337('0x47')]('WhatsappQueueId\x20=\x20?',_0x21a615[_0x5337('0x5d')]['id']);for(var _0x188359=0x0;_0x188359<_0x489a35[_0x5337('0x53')];_0x188359+=0x1){let _0x51a7d4=_0x489a35[_0x188359];for(var _0x125c06=0x0;_0x125c06<_0x51a7d4[_0x5337('0x6f')][_0x5337('0x53')];_0x125c06+=0x1){let _0x2adea8=_0x51a7d4['Agents'][_0x125c06];var _0x4cdc19=_0x3138d2[_0x5337('0x82')]();_0x4cdc19[_0x5337('0x47')](_0x5337('0x83'),_0x2adea8['id']);_0x55640e['push'](db[_0x5337('0x73')]['query'](_0x4cdc19['toString'](),{'type':db['sequelize'][_0x5337('0x84')][_0x5337('0x85')]})[_0x5337('0x29')](function(_0x4daae2){if(_0x4daae2[_0x5337('0x53')]===0x1){return _0x2adea8['id'];}else{var _0x53908c=_[_0x5337('0x86')](_[_0x5337('0x3c')](_0x4daae2,_0x5337('0x87')),function(_0x3d241e){return _[_0x5337('0x88')](_0x388e8f,_0x3d241e);});if(_0x53908c){return _0x2adea8['id'];}}}));}}return BPromise[_0x5337('0x89')](_0x55640e)[_0x5337('0x29')](function(_0x38cfab){_0x33f292=_(_0x33f292)['union'](_0x38cfab)['compact']()[_0x5337('0x8a')]();return db['WhatsappQueue'][_0x5337('0x55')]({'where':{'id':_0x21a615[_0x5337('0x5d')]['id']}})[_0x5337('0x29')](function(_0x319b67){return db[_0x5337('0x73')][_0x5337('0x74')](function(_0x24abd1){return _0x319b67[_0x5337('0x7b')](_0x21a615[_0x5337('0x3d')][_0x5337('0x6e')],{'transaction':_0x24abd1})['then'](function(){if(!_[_0x5337('0x8b')](_0x33f292)){return _0x319b67['removeAgents'](_0x33f292,{'transaction':_0x24abd1});}})[_0x5337('0x29')](function(){_0x33f292[_0x5337('0x78')](function(_0xce0fba){socket['emit']('userWhatsappQueue:remove',{'UserId':_0xce0fba,'WhatsappQueueId':_0x319b67['id']});});});});});});})[_0x5337('0x29')](respondWithStatusCode(_0x5401a7,null))[_0x5337('0x56')](handleError(_0x5401a7,null));};exports['addAgents']=function(_0x4236bf,_0x349d25,_0x1044e6){return db[_0x5337('0x4d')][_0x5337('0x55')]({'where':{'id':_0x4236bf[_0x5337('0x5d')]['id']}})['then'](handleEntityNotFound(_0x349d25,null))['then'](function(_0xd6a395){if(_0xd6a395){return _0xd6a395[_0x5337('0x8c')](_0x4236bf['body'][_0x5337('0x6e')],_[_0x5337('0x8d')](_0x4236bf[_0x5337('0x32')],[_0x5337('0x6e'),'id'])||{})[_0x5337('0x8e')](function(_0x3e1456){for(var _0x1d871c=0x0;_0x1d871c<_0x4236bf[_0x5337('0x32')][_0x5337('0x6e')][_0x5337('0x53')];_0x1d871c+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':_0x4236bf[_0x5337('0x32')][_0x5337('0x6e')][_0x1d871c],'WhatsappQueueId':_0x4236bf[_0x5337('0x5d')]['id']});}return _0x3e1456;});}})[_0x5337('0x29')](respondWithResult(_0x349d25,null))[_0x5337('0x56')](handleError(_0x349d25,null));};exports[_0x5337('0x8f')]=function(_0x980170,_0x189104,_0x433118){return db[_0x5337('0x4d')][_0x5337('0x55')]({'where':{'id':_0x980170['params']['id']}})['then'](handleEntityNotFound(_0x189104,null))[_0x5337('0x29')](function(_0x17e973){if(_0x17e973){return _0x17e973[_0x5337('0x8f')](_0x980170[_0x5337('0x3d')][_0x5337('0x6e')])[_0x5337('0x29')](function(){if(_['isArray'](_0x980170[_0x5337('0x3d')][_0x5337('0x6e')])){for(var _0x283f64=0x0;_0x283f64<_0x980170[_0x5337('0x3d')][_0x5337('0x6e')]['length'];_0x283f64+=0x1){socket[_0x5337('0x79')](_0x5337('0x90'),{'UserId':Number(_0x980170[_0x5337('0x3d')][_0x5337('0x6e')][_0x283f64]),'WhatsappQueueId':Number(_0x980170['params']['id'])});}}else{socket[_0x5337('0x79')](_0x5337('0x90'),{'UserId':Number(_0x980170[_0x5337('0x3d')][_0x5337('0x6e')]),'WhatsappQueueId':Number(_0x980170['params']['id'])});}});}})['then'](respondWithStatusCode(_0x189104,null))['catch'](handleError(_0x189104,null));};exports[_0x5337('0x91')]=function(_0x14aecd,_0x5c1e5f,_0x522139){var _0x58c2b1={};var _0x1230f0={};var _0x2e1c8c;var _0x3b0c74;return db[_0x5337('0x4d')][_0x5337('0x6c')]({'where':{'id':_0x14aecd[_0x5337('0x5d')]['id']}})[_0x5337('0x29')](handleEntityNotFound(_0x5c1e5f,null))[_0x5337('0x29')](function(_0x358f20){if(_0x358f20){_0x2e1c8c=_0x358f20;_0x1230f0['model']=_['keys'](db[_0x5337('0x62')]['rawAttributes']);_0x1230f0[_0x5337('0x3d')]=_[_0x5337('0x3e')](_0x14aecd[_0x5337('0x3d')]);_0x1230f0[_0x5337('0x3f')]=_[_0x5337('0x41')](_0x1230f0[_0x5337('0x3b')],_0x1230f0[_0x5337('0x3d')]);_0x58c2b1[_0x5337('0x40')]=_[_0x5337('0x41')](_0x1230f0[_0x5337('0x3b')],qs[_0x5337('0x42')](_0x14aecd[_0x5337('0x3d')][_0x5337('0x42')]));_0x58c2b1[_0x5337('0x40')]=_0x58c2b1[_0x5337('0x40')][_0x5337('0x53')]?_0x58c2b1[_0x5337('0x40')]:_0x1230f0[_0x5337('0x3b')];_0x58c2b1[_0x5337('0x45')]=qs[_0x5337('0x46')](_0x14aecd['query'][_0x5337('0x46')]);_0x58c2b1[_0x5337('0x47')]=qs[_0x5337('0x3f')](_['pick'](_0x14aecd[_0x5337('0x3d')],_0x1230f0['filters']));if(_0x14aecd['query']['filter']){_0x58c2b1[_0x5337('0x47')]=_['merge'](_0x58c2b1['where'],{'$or':_[_0x5337('0x3c')](_0x58c2b1[_0x5337('0x40')],function(_0x5e856b){var _0x3e10a7={};_0x3e10a7[_0x5e856b]={'$like':'%'+_0x14aecd[_0x5337('0x3d')][_0x5337('0x4b')]+'%'};return _0x3e10a7;})});}_0x58c2b1=_['merge']({},_0x58c2b1,_0x14aecd[_0x5337('0x4c')]);return _0x2e1c8c[_0x5337('0x91')](_0x58c2b1);}})['then'](function(_0x34a385){if(_0x34a385){_0x3b0c74=_0x34a385[_0x5337('0x53')];if(!_0x14aecd[_0x5337('0x3d')]['hasOwnProperty'](_0x5337('0x44'))){_0x58c2b1[_0x5337('0x24')]=qs[_0x5337('0x24')](_0x14aecd[_0x5337('0x3d')][_0x5337('0x24')]);_0x58c2b1[_0x5337('0x22')]=qs['offset'](_0x14aecd[_0x5337('0x3d')][_0x5337('0x22')]);}return _0x2e1c8c[_0x5337('0x91')](_0x58c2b1);}})[_0x5337('0x29')](function(_0x5daf2d){if(_0x5daf2d){return _0x5daf2d?{'count':_0x3b0c74,'rows':_0x5daf2d}:null;}})['then'](respondWithResult(_0x5c1e5f,null))[_0x5337('0x56')](handleError(_0x5c1e5f,null));}; \ No newline at end of file +var _0x988e=['describe','getMembers','findOne','UserWhatsappQueue','order','WhatsappQueueId','User','findAndCountAll','whatsappPause','updatedAt','createdAt','rows','format','SIP','Team','getTeams','addTeams','ids','online','voicePause','Agents','sequelize','transaction','each','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','emit','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','WhatsappQueues','UserProfileResource','error','stack','name','send','message','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','WhatsappQueue','findAll','catch','params','fields','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','update','body'];(function(_0x31aa0d,_0x217049){var _0x53e7e0=function(_0x244397){while(--_0x244397){_0x31aa0d['push'](_0x31aa0d['shift']());}};_0x53e7e0(++_0x217049);}(_0x988e,0x1f1));var _0xe988=function(_0x3e7b4a,_0x3a6e54){_0x3e7b4a=_0x3e7b4a-0x0;var _0x5f4aa4=_0x988e[_0x3e7b4a];return _0x5f4aa4;};'use strict';var emlformat=require(_0xe988('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe988('0x1'));var jsonpatch=require(_0xe988('0x2'));var rp=require(_0xe988('0x3'));var moment=require(_0xe988('0x4'));var BPromise=require(_0xe988('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe988('0x6'));var csv=require(_0xe988('0x7'));var ejs=require(_0xe988('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe988('0x9'));var squel=require(_0xe988('0xa'));var crypto=require(_0xe988('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe988('0xc'));var toCsv=require(_0xe988('0x7'));var querystring=require(_0xe988('0xd'));var Papa=require(_0xe988('0xe'));var Redis=require('ioredis');var authService=require(_0xe988('0xf'));var qs=require(_0xe988('0x10'));var as=require(_0xe988('0x11'));var hardwareService=require(_0xe988('0x12'));var logger=require(_0xe988('0x13'))(_0xe988('0x14'));var utils=require(_0xe988('0x15'));var config=require(_0xe988('0x16'));var licenseUtil=require(_0xe988('0x17'));var db=require(_0xe988('0x18'))['db'];config['redis']=_[_0xe988('0x19')](config[_0xe988('0x1a')],{'host':_0xe988('0x1b'),'port':0x18eb});var socket=require(_0xe988('0x1c'))(new Redis(config[_0xe988('0x1a')]));require(_0xe988('0x1d'))[_0xe988('0x1e')](socket);function respondWithStatusCode(_0x269923,_0x1bdf7b){_0x1bdf7b=_0x1bdf7b||0xcc;return function(_0x1bc680){if(_0x1bc680){return _0x269923[_0xe988('0x1f')](_0x1bdf7b);}return _0x269923[_0xe988('0x20')](_0x1bdf7b)[_0xe988('0x21')]();};}function respondWithResult(_0x5c3abe,_0x1b1e6d){_0x1b1e6d=_0x1b1e6d||0xc8;return function(_0xff81a8){if(_0xff81a8){return _0x5c3abe[_0xe988('0x20')](_0x1b1e6d)[_0xe988('0x22')](_0xff81a8);}};}function respondWithFilteredResult(_0xdc3827,_0x3f0cad){return function(_0x278fb2){if(_0x278fb2){var _0x23f6fd=typeof _0x3f0cad['offset']===_0xe988('0x23')&&typeof _0x3f0cad[_0xe988('0x24')]===_0xe988('0x23');var _0xd1960=_0x278fb2['count'];var _0x175328=_0x23f6fd?0x0:_0x3f0cad[_0xe988('0x25')];var _0x526346=_0x23f6fd?_0x278fb2[_0xe988('0x26')]:_0x3f0cad[_0xe988('0x25')]+_0x3f0cad[_0xe988('0x24')];var _0x1e16b2;if(_0x526346>=_0xd1960){_0x526346=_0xd1960;_0x1e16b2=0xc8;}else{_0x1e16b2=0xce;}_0xdc3827[_0xe988('0x20')](_0x1e16b2);return _0xdc3827[_0xe988('0x27')](_0xe988('0x28'),_0x175328+'-'+_0x526346+'/'+_0xd1960)[_0xe988('0x22')](_0x278fb2);}return null;};}function patchUpdates(_0xa401da){return function(_0x31e0d0){try{jsonpatch[_0xe988('0x29')](_0x31e0d0,_0xa401da,!![]);}catch(_0x517457){return BPromise[_0xe988('0x2a')](_0x517457);}return _0x31e0d0[_0xe988('0x2b')]();};}function saveUpdates(_0xf5847f,_0x188fe2){return function(_0x33d25f){if(_0x33d25f){return _0x33d25f['update'](_0xf5847f)[_0xe988('0x2c')](function(_0x5c346b){return _0x5c346b;});}return null;};}function removeEntity(_0x1e0fa5,_0x228621){return function(_0x7a6e44){if(_0x7a6e44){return _0x7a6e44[_0xe988('0x2d')]()[_0xe988('0x2c')](function(){var _0x2c62c3=_0x7a6e44['get']({'plain':!![]});var _0x1a6ba8=_0xe988('0x2e');return db[_0xe988('0x2f')][_0xe988('0x2d')]({'where':{'type':_0x1a6ba8,'resourceId':_0x2c62c3['id']}})['then'](function(){return _0x7a6e44;});})[_0xe988('0x2c')](function(){_0x1e0fa5[_0xe988('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14c2ea,_0x463289){return function(_0x413de2){if(!_0x413de2){_0x14c2ea[_0xe988('0x1f')](0x194);}return _0x413de2;};}function handleError(_0x5c79ef,_0x4fc9e9){_0x4fc9e9=_0x4fc9e9||0x1f4;return function(_0x5c4e27){logger[_0xe988('0x30')](_0x5c4e27[_0xe988('0x31')]);if(_0x5c4e27['name']){delete _0x5c4e27[_0xe988('0x32')];}_0x5c79ef[_0xe988('0x20')](_0x4fc9e9)[_0xe988('0x33')](_0x5c4e27);};}function getMustacheRender(_0x188ced,_0x2506a0){return Mustache['render'](_0x188ced,_['merge'](_0x2506a0['body'],{'contact':_0x2506a0['contact'],'message':_0x2506a0[_0xe988('0x34')],'agent':_0x2506a0[_0xe988('0x35')],'interaction':_0x2506a0[_0xe988('0x36')],'account':_0x2506a0[_0xe988('0x37')]}))||'';}exports[_0xe988('0x38')]=function(_0x285bf3,_0x2e4b5c){var _0x418480={},_0x5317c9={},_0x21a11f={'count':0x0,'rows':[]};var _0x5239ab=_[_0xe988('0x39')](db['WhatsappQueue'][_0xe988('0x3a')],function(_0x34b943){return{'name':_0x34b943[_0xe988('0x3b')],'type':_0x34b943[_0xe988('0x3c')][_0xe988('0x3d')]};});_0x5317c9[_0xe988('0x3e')]=_['map'](_0x5239ab,_0xe988('0x32'));_0x5317c9[_0xe988('0x3f')]=_[_0xe988('0x40')](_0x285bf3[_0xe988('0x3f')]);_0x5317c9[_0xe988('0x41')]=_[_0xe988('0x42')](_0x5317c9['model'],_0x5317c9['query']);_0x418480[_0xe988('0x43')]=_[_0xe988('0x42')](_0x5317c9[_0xe988('0x3e')],qs['fields'](_0x285bf3[_0xe988('0x3f')]['fields']));_0x418480[_0xe988('0x43')]=_0x418480[_0xe988('0x43')][_0xe988('0x44')]?_0x418480['attributes']:_0x5317c9[_0xe988('0x3e')];if(!_0x285bf3[_0xe988('0x3f')][_0xe988('0x45')](_0xe988('0x46'))){_0x418480[_0xe988('0x24')]=qs[_0xe988('0x24')](_0x285bf3['query'][_0xe988('0x24')]);_0x418480[_0xe988('0x25')]=qs['offset'](_0x285bf3[_0xe988('0x3f')][_0xe988('0x25')]);}_0x418480['order']=qs[_0xe988('0x47')](_0x285bf3[_0xe988('0x3f')][_0xe988('0x47')]);_0x418480[_0xe988('0x48')]=qs[_0xe988('0x41')](_[_0xe988('0x49')](_0x285bf3[_0xe988('0x3f')],_0x5317c9['filters']),_0x5239ab);if(_0x285bf3['query'][_0xe988('0x4a')]){_0x418480[_0xe988('0x48')]=_[_0xe988('0x4b')](_0x418480[_0xe988('0x48')],{'$or':_[_0xe988('0x39')](_0x5239ab,function(_0x2d007c){if(_0x2d007c[_0xe988('0x3c')]!==_0xe988('0x4c')){var _0x2d4dbf={};_0x2d4dbf[_0x2d007c[_0xe988('0x32')]]={'$like':'%'+_0x285bf3[_0xe988('0x3f')][_0xe988('0x4a')]+'%'};return _0x2d4dbf;}})});}_0x418480=_[_0xe988('0x4b')]({},_0x418480,_0x285bf3[_0xe988('0x4d')]);var _0x25ac46={'where':_0x418480['where']};return db['WhatsappQueue'][_0xe988('0x26')](_0x25ac46)['then'](function(_0x1fff06){_0x21a11f[_0xe988('0x26')]=_0x1fff06;if(_0x285bf3['query'][_0xe988('0x4e')]){_0x418480[_0xe988('0x4f')]=[{'all':!![]}];}return db[_0xe988('0x50')][_0xe988('0x51')](_0x418480);})[_0xe988('0x2c')](function(_0xdc7585){_0x21a11f['rows']=_0xdc7585;return _0x21a11f;})['then'](respondWithFilteredResult(_0x2e4b5c,_0x418480))[_0xe988('0x52')](handleError(_0x2e4b5c,null));};exports['show']=function(_0x43f1cc,_0x43deeb){var _0x10dbc6={'raw':!![],'where':{'id':_0x43f1cc[_0xe988('0x53')]['id']}},_0x4854d7={};_0x4854d7[_0xe988('0x3e')]=_[_0xe988('0x40')](db['WhatsappQueue'][_0xe988('0x3a')]);_0x4854d7[_0xe988('0x3f')]=_[_0xe988('0x40')](_0x43f1cc[_0xe988('0x3f')]);_0x4854d7[_0xe988('0x41')]=_[_0xe988('0x42')](_0x4854d7['model'],_0x4854d7[_0xe988('0x3f')]);_0x10dbc6[_0xe988('0x43')]=_['intersection'](_0x4854d7[_0xe988('0x3e')],qs[_0xe988('0x54')](_0x43f1cc[_0xe988('0x3f')][_0xe988('0x54')]));_0x10dbc6[_0xe988('0x43')]=_0x10dbc6[_0xe988('0x43')][_0xe988('0x44')]?_0x10dbc6[_0xe988('0x43')]:_0x4854d7[_0xe988('0x3e')];if(_0x43f1cc[_0xe988('0x3f')][_0xe988('0x4e')]){_0x10dbc6[_0xe988('0x4f')]=[{'all':!![]}];}_0x10dbc6=_[_0xe988('0x4b')]({},_0x10dbc6,_0x43f1cc[_0xe988('0x4d')]);return db[_0xe988('0x50')]['find'](_0x10dbc6)[_0xe988('0x2c')](handleEntityNotFound(_0x43deeb,null))[_0xe988('0x2c')](respondWithResult(_0x43deeb,null))[_0xe988('0x52')](handleError(_0x43deeb,null));};exports[_0xe988('0x55')]=function(_0x13a32b,_0x340f54){return db['WhatsappQueue'][_0xe988('0x55')](_0x13a32b['body'],{})[_0xe988('0x2c')](function(_0x3ec5d7){var _0x68a094=_0x13a32b[_0xe988('0x56')][_0xe988('0x57')]({'plain':!![]});if(!_0x68a094)throw new Error(_0xe988('0x58'));if(_0x68a094[_0xe988('0x59')]==='user'){var _0x225a78=_0x3ec5d7[_0xe988('0x57')]({'plain':!![]});var _0x4a9bf3=_0xe988('0x2e');return db['UserProfileSection'][_0xe988('0x5a')]({'where':{'name':_0x4a9bf3,'userProfileId':_0x68a094[_0xe988('0x5b')]},'raw':!![]})['then'](function(_0x58ed9e){if(_0x58ed9e&&_0x58ed9e[_0xe988('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0x225a78[_0xe988('0x32')],'resourceId':_0x225a78['id'],'type':_0x58ed9e[_0xe988('0x32')],'sectionId':_0x58ed9e['id']},{})[_0xe988('0x2c')](function(){return _0x3ec5d7;});}else{return _0x3ec5d7;}})[_0xe988('0x52')](function(_0x28a631){logger[_0xe988('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28a631);throw _0x28a631;});}return _0x3ec5d7;})[_0xe988('0x2c')](respondWithResult(_0x340f54,0xc9))[_0xe988('0x52')](handleError(_0x340f54,null));};exports[_0xe988('0x5d')]=function(_0x4d387a,_0x57f5e3){if(_0x4d387a[_0xe988('0x5e')]['id']){delete _0x4d387a['body']['id'];}return db[_0xe988('0x50')][_0xe988('0x5a')]({'where':{'id':_0x4d387a[_0xe988('0x53')]['id']}})[_0xe988('0x2c')](handleEntityNotFound(_0x57f5e3,null))[_0xe988('0x2c')](saveUpdates(_0x4d387a[_0xe988('0x5e')],null))[_0xe988('0x2c')](respondWithResult(_0x57f5e3,null))['catch'](handleError(_0x57f5e3,null));};exports[_0xe988('0x2d')]=function(_0x1ab7ab,_0x38873b){return db['WhatsappQueue']['find']({'where':{'id':_0x1ab7ab[_0xe988('0x53')]['id']}})[_0xe988('0x2c')](handleEntityNotFound(_0x38873b,null))['then'](removeEntity(_0x38873b,null))[_0xe988('0x52')](handleError(_0x38873b,null));};exports[_0xe988('0x5f')]=function(_0x56ca18,_0x265765){return db[_0xe988('0x50')]['describe']()['then'](respondWithResult(_0x265765,null))[_0xe988('0x52')](handleError(_0x265765,null));};exports[_0xe988('0x60')]=function(_0x34c2cb,_0x57f64e,_0x5e0bac){var _0x217b0a={'raw':!![],'where':{}},_0x2c56f0={},_0x2c1c06;return db['WhatsappQueue'][_0xe988('0x61')]({'where':{'id':_0x34c2cb['params']['id']}})[_0xe988('0x2c')](handleEntityNotFound(_0x57f64e,null))[_0xe988('0x2c')](function(_0x20b869){if(_0x20b869){_0x2c1c06=_0x20b869[_0xe988('0x57')]({'plain':!![]});_0x2c56f0[_0xe988('0x3e')]=_[_0xe988('0x40')](db[_0xe988('0x62')][_0xe988('0x3a')]);_0x2c56f0['query']=_[_0xe988('0x40')](_0x34c2cb[_0xe988('0x3f')]);_0x2c56f0[_0xe988('0x41')]=_[_0xe988('0x42')](_0x2c56f0['model'],_0x2c56f0[_0xe988('0x3f')]);_0x217b0a[_0xe988('0x43')]=_[_0xe988('0x42')](_0x2c56f0[_0xe988('0x3e')],qs[_0xe988('0x54')](_0x34c2cb['query'][_0xe988('0x54')]));_0x217b0a[_0xe988('0x43')]=_0x217b0a[_0xe988('0x43')][_0xe988('0x44')]?_0x217b0a[_0xe988('0x43')]:_0x2c56f0[_0xe988('0x3e')];if(!_0x34c2cb[_0xe988('0x3f')][_0xe988('0x45')](_0xe988('0x46'))){_0x217b0a['limit']=qs[_0xe988('0x24')](_0x34c2cb['query'][_0xe988('0x24')]);_0x217b0a[_0xe988('0x25')]=qs[_0xe988('0x25')](_0x34c2cb[_0xe988('0x3f')][_0xe988('0x25')]);}_0x217b0a[_0xe988('0x63')]=qs[_0xe988('0x47')](_0x34c2cb[_0xe988('0x3f')][_0xe988('0x47')]);_0x217b0a[_0xe988('0x48')]=qs[_0xe988('0x41')](_['pick'](_0x34c2cb[_0xe988('0x3f')],_0x2c56f0[_0xe988('0x41')]));_0x217b0a['where'][_0xe988('0x64')]=_0x20b869['id'];if(_0x34c2cb[_0xe988('0x3f')][_0xe988('0x4a')]){_0x217b0a[_0xe988('0x48')]=_[_0xe988('0x4b')](_0x217b0a[_0xe988('0x48')],{'$or':_[_0xe988('0x39')](_0x217b0a[_0xe988('0x43')],function(_0x41fe58){var _0x24387b={};_0x24387b[_0x41fe58]={'$like':'%'+_0x34c2cb['query'][_0xe988('0x4a')]+'%'};return _0x24387b;})});}_0x217b0a=_['merge']({},_0x217b0a,_0x34c2cb[_0xe988('0x4d')]);return db[_0xe988('0x62')][_0xe988('0x51')](_0x217b0a);}})[_0xe988('0x2c')](function(_0x56b9ed){if(_0x56b9ed){return db[_0xe988('0x65')][_0xe988('0x66')]({'where':{'id':_['map'](_0x56b9ed,'UserId'),'role':_0xe988('0x35')},'attributes':['id','name',_0xe988('0x67'),_0xe988('0x68'),_0xe988('0x69')]});}})[_0xe988('0x2c')](function(_0x4ebe2a){if(_0x4ebe2a){return{'count':_0x4ebe2a[_0xe988('0x26')],'rows':_[_0xe988('0x39')](_0x4ebe2a[_0xe988('0x6a')],function(_0x4609b1){return{'membername':_0x4609b1['name'],'UserId':_0x4609b1['id'],'queue_name':_0x2c1c06['name'],'WhatsappQueueId':_0x2c1c06['id'],'interface':util[_0xe988('0x6b')]('%s/%s',_0xe988('0x6c'),_0x4609b1['name']),'penalty':0x0,'paused':_0x4609b1[_0xe988('0x67')],'createdAt':_0x4609b1[_0xe988('0x69')],'updatedAt':_0x4609b1[_0xe988('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe988('0x2c')](respondWithFilteredResult(_0x57f64e,_0x217b0a))['catch'](handleError(_0x57f64e,null));};exports['getTeams']=function(_0x15cbb8,_0x44567d,_0x5b68ae){var _0xabd672={};var _0x2718d2={};var _0x101c37;var _0x2df5f3;return db[_0xe988('0x50')][_0xe988('0x61')]({'where':{'id':_0x15cbb8[_0xe988('0x53')]['id']}})[_0xe988('0x2c')](handleEntityNotFound(_0x44567d,null))['then'](function(_0x15a744){if(_0x15a744){_0x101c37=_0x15a744;_0x2718d2[_0xe988('0x3e')]=_[_0xe988('0x40')](db[_0xe988('0x6d')][_0xe988('0x3a')]);_0x2718d2[_0xe988('0x3f')]=_[_0xe988('0x40')](_0x15cbb8[_0xe988('0x3f')]);_0x2718d2[_0xe988('0x41')]=_[_0xe988('0x42')](_0x2718d2[_0xe988('0x3e')],_0x2718d2[_0xe988('0x3f')]);_0xabd672[_0xe988('0x43')]=_['intersection'](_0x2718d2[_0xe988('0x3e')],qs['fields'](_0x15cbb8[_0xe988('0x3f')]['fields']));_0xabd672[_0xe988('0x43')]=_0xabd672[_0xe988('0x43')][_0xe988('0x44')]?_0xabd672['attributes']:_0x2718d2['model'];_0xabd672[_0xe988('0x63')]=qs[_0xe988('0x47')](_0x15cbb8[_0xe988('0x3f')][_0xe988('0x47')]);_0xabd672['where']=qs['filters'](_[_0xe988('0x49')](_0x15cbb8[_0xe988('0x3f')],_0x2718d2['filters']));if(_0x15cbb8[_0xe988('0x3f')]['filter']){_0xabd672[_0xe988('0x48')]=_[_0xe988('0x4b')](_0xabd672[_0xe988('0x48')],{'$or':_[_0xe988('0x39')](_0xabd672[_0xe988('0x43')],function(_0x29a54d){var _0x480536={};_0x480536[_0x29a54d]={'$like':'%'+_0x15cbb8[_0xe988('0x3f')][_0xe988('0x4a')]+'%'};return _0x480536;})});}_0xabd672=_[_0xe988('0x4b')]({},_0xabd672,_0x15cbb8[_0xe988('0x4d')]);return _0x101c37[_0xe988('0x6e')](_0xabd672);}})[_0xe988('0x2c')](function(_0x4ba30d){if(_0x4ba30d){_0x2df5f3=_0x4ba30d[_0xe988('0x44')];if(!_0x15cbb8['query'][_0xe988('0x45')](_0xe988('0x46'))){_0xabd672[_0xe988('0x24')]=qs['limit'](_0x15cbb8[_0xe988('0x3f')][_0xe988('0x24')]);_0xabd672[_0xe988('0x25')]=qs[_0xe988('0x25')](_0x15cbb8[_0xe988('0x3f')][_0xe988('0x25')]);}return _0x101c37[_0xe988('0x6e')](_0xabd672);}})[_0xe988('0x2c')](function(_0x461182){if(_0x461182){return _0x461182?{'count':_0x2df5f3,'rows':_0x461182}:null;}})[_0xe988('0x2c')](respondWithResult(_0x44567d,null))['catch'](handleError(_0x44567d,null));};exports[_0xe988('0x6f')]=function(_0x121d33,_0x36dde4,_0x5a53e5){var _0x5ace0e=_0x121d33[_0xe988('0x5e')][_0xe988('0x70')];return db[_0xe988('0x6d')][_0xe988('0x51')]({'where':{'id':_0x5ace0e},'attributes':['id'],'include':[{'model':db[_0xe988('0x65')],'as':'Agents','attributes':['id',_0xe988('0x32'),_0xe988('0x71'),_0xe988('0x72'),'interface'],'raw':!![]}]})[_0xe988('0x2c')](function(_0x45b787){if(_0x45b787){var _0x31787e=_['flatMap'](_0x45b787,function(_0x28bccc){var _0x5d3bb6=_0x28bccc[_0xe988('0x57')]({'plain':!![]});return _0x5d3bb6[_0xe988('0x73')];});return db['WhatsappQueue'][_0xe988('0x5a')]({'where':{'id':_0x121d33[_0xe988('0x53')]['id']}})[_0xe988('0x2c')](function(_0x537b7e){return db[_0xe988('0x74')][_0xe988('0x75')](function(_0xa88e19){return _0x537b7e[_0xe988('0x6f')](_0x5ace0e,{'transaction':_0xa88e19})['then'](function(){return BPromise[_0xe988('0x76')](_0x31787e,function(_0x4c3d9f){return db[_0xe988('0x62')]['findOrCreate']({'where':{'UserId':_0x4c3d9f['id'],'WhatsappQueueId':_0x121d33['params']['id']},'transaction':_0xa88e19});});})[_0xe988('0x2c')](function(){_0x31787e['forEach'](function(_0x5d2542){socket['emit'](_0xe988('0x77'),{'UserId':_0x5d2542['id'],'WhatsappQueueId':_0x537b7e['id']});});});});});}})[_0xe988('0x2c')](respondWithStatusCode(_0x36dde4,null))[_0xe988('0x52')](handleError(_0x36dde4,null));};exports['removeTeams']=function(_0x17e675,_0x511387,_0xce914b){return db[_0xe988('0x6d')][_0xe988('0x51')]({'where':{'id':_0x17e675[_0xe988('0x3f')][_0xe988('0x70')]},'attributes':['id'],'include':[{'model':db[_0xe988('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe988('0x2c')](handleEntityNotFound(_0x511387,null))[_0xe988('0x2c')](function(_0x10bb56){var _0x383969=_[_0xe988('0x39')](_0x10bb56,'id');var _0x502c68=[];var _0x4180d9=[];var _0x49b5cd=squel[_0xe988('0x78')]();_0x49b5cd[_0xe988('0x79')](_0xe988('0x7a'))[_0xe988('0x7b')](_0xe988('0x7c'),'tq')['join'](_0xe988('0x7d'),'ut',_0xe988('0x7e'))[_0xe988('0x48')](_0xe988('0x7f'),_0x17e675[_0xe988('0x53')]['id']);for(var _0x4c5c5a=0x0;_0x4c5c5a<_0x10bb56['length'];_0x4c5c5a+=0x1){let _0x168ba6=_0x10bb56[_0x4c5c5a];for(var _0x4ff2f1=0x0;_0x4ff2f1<_0x168ba6[_0xe988('0x73')]['length'];_0x4ff2f1+=0x1){let _0x406e16=_0x168ba6[_0xe988('0x73')][_0x4ff2f1];var _0x549a4f=_0x49b5cd[_0xe988('0x80')]();_0x549a4f[_0xe988('0x48')]('ut.UserId\x20=\x20?',_0x406e16['id']);_0x4180d9[_0xe988('0x81')](db[_0xe988('0x74')][_0xe988('0x3f')](_0x549a4f['toString'](),{'type':db['sequelize'][_0xe988('0x82')]['SELECT']})['then'](function(_0x1ca488){if(_0x1ca488[_0xe988('0x44')]===0x1){return _0x406e16['id'];}else{var _0x1c4493=_[_0xe988('0x83')](_['map'](_0x1ca488,_0xe988('0x84')),function(_0x4f0b64){return _[_0xe988('0x85')](_0x383969,_0x4f0b64);});if(_0x1c4493){return _0x406e16['id'];}}}));}}return BPromise[_0xe988('0x86')](_0x4180d9)[_0xe988('0x2c')](function(_0x3d8648){_0x502c68=_(_0x502c68)[_0xe988('0x87')](_0x3d8648)[_0xe988('0x88')]()[_0xe988('0x89')]();return db[_0xe988('0x50')][_0xe988('0x5a')]({'where':{'id':_0x17e675[_0xe988('0x53')]['id']}})[_0xe988('0x2c')](function(_0x9fd4e7){return db[_0xe988('0x74')]['transaction'](function(_0xf80347){return _0x9fd4e7[_0xe988('0x8a')](_0x17e675[_0xe988('0x3f')]['ids'],{'transaction':_0xf80347})[_0xe988('0x2c')](function(){if(!_[_0xe988('0x8b')](_0x502c68)){return _0x9fd4e7[_0xe988('0x8c')](_0x502c68,{'transaction':_0xf80347});}})[_0xe988('0x2c')](function(){_0x502c68[_0xe988('0x8d')](function(_0x149e04){socket[_0xe988('0x8e')](_0xe988('0x8f'),{'UserId':_0x149e04,'WhatsappQueueId':_0x9fd4e7['id']});});});});});});})['then'](respondWithStatusCode(_0x511387,null))[_0xe988('0x52')](handleError(_0x511387,null));};exports[_0xe988('0x90')]=function(_0x2b586b,_0x43377a,_0x3a3d4e){return db[_0xe988('0x50')][_0xe988('0x5a')]({'where':{'id':_0x2b586b[_0xe988('0x53')]['id']}})[_0xe988('0x2c')](handleEntityNotFound(_0x43377a,null))[_0xe988('0x2c')](function(_0x45aef1){if(_0x45aef1){return _0x45aef1[_0xe988('0x90')](_0x2b586b[_0xe988('0x5e')][_0xe988('0x70')],_[_0xe988('0x91')](_0x2b586b['body'],[_0xe988('0x70'),'id'])||{})[_0xe988('0x92')](function(_0x33d735){for(var _0x2e9880=0x0;_0x2e9880<_0x2b586b[_0xe988('0x5e')][_0xe988('0x70')][_0xe988('0x44')];_0x2e9880+=0x1){socket[_0xe988('0x8e')](_0xe988('0x77'),{'UserId':_0x2b586b[_0xe988('0x5e')][_0xe988('0x70')][_0x2e9880],'WhatsappQueueId':_0x2b586b['params']['id']});}return _0x33d735;});}})[_0xe988('0x2c')](respondWithResult(_0x43377a,null))[_0xe988('0x52')](handleError(_0x43377a,null));};exports[_0xe988('0x8c')]=function(_0xf8e8b,_0x4fac15,_0x3701f9){return db[_0xe988('0x50')][_0xe988('0x5a')]({'where':{'id':_0xf8e8b[_0xe988('0x53')]['id']}})['then'](handleEntityNotFound(_0x4fac15,null))[_0xe988('0x2c')](function(_0x26519b){if(_0x26519b){return _0x26519b['removeAgents'](_0xf8e8b[_0xe988('0x3f')][_0xe988('0x70')])['then'](function(){if(_['isArray'](_0xf8e8b[_0xe988('0x3f')][_0xe988('0x70')])){for(var _0x8204b9=0x0;_0x8204b9<_0xf8e8b[_0xe988('0x3f')][_0xe988('0x70')]['length'];_0x8204b9+=0x1){socket[_0xe988('0x8e')](_0xe988('0x8f'),{'UserId':Number(_0xf8e8b[_0xe988('0x3f')]['ids'][_0x8204b9]),'WhatsappQueueId':Number(_0xf8e8b[_0xe988('0x53')]['id'])});}}else{socket[_0xe988('0x8e')](_0xe988('0x8f'),{'UserId':Number(_0xf8e8b[_0xe988('0x3f')][_0xe988('0x70')]),'WhatsappQueueId':Number(_0xf8e8b['params']['id'])});}});}})[_0xe988('0x2c')](respondWithStatusCode(_0x4fac15,null))['catch'](handleError(_0x4fac15,null));};exports[_0xe988('0x93')]=function(_0x561687,_0x248a6a,_0x4de6a9){var _0x91307d={};var _0x558dd4={};var _0xc9cc3f;var _0x43c92d;return db[_0xe988('0x50')][_0xe988('0x61')]({'where':{'id':_0x561687[_0xe988('0x53')]['id']}})[_0xe988('0x2c')](handleEntityNotFound(_0x248a6a,null))[_0xe988('0x2c')](function(_0x5aa931){if(_0x5aa931){_0xc9cc3f=_0x5aa931;_0x558dd4[_0xe988('0x3e')]=_['keys'](db[_0xe988('0x65')][_0xe988('0x3a')]);_0x558dd4[_0xe988('0x3f')]=_['keys'](_0x561687['query']);_0x558dd4[_0xe988('0x41')]=_[_0xe988('0x42')](_0x558dd4[_0xe988('0x3e')],_0x558dd4[_0xe988('0x3f')]);_0x91307d['attributes']=_['intersection'](_0x558dd4[_0xe988('0x3e')],qs[_0xe988('0x54')](_0x561687[_0xe988('0x3f')][_0xe988('0x54')]));_0x91307d[_0xe988('0x43')]=_0x91307d[_0xe988('0x43')]['length']?_0x91307d['attributes']:_0x558dd4[_0xe988('0x3e')];_0x91307d[_0xe988('0x63')]=qs[_0xe988('0x47')](_0x561687['query'][_0xe988('0x47')]);_0x91307d[_0xe988('0x48')]=qs[_0xe988('0x41')](_[_0xe988('0x49')](_0x561687[_0xe988('0x3f')],_0x558dd4[_0xe988('0x41')]));if(_0x561687['query'][_0xe988('0x4a')]){_0x91307d['where']=_[_0xe988('0x4b')](_0x91307d[_0xe988('0x48')],{'$or':_[_0xe988('0x39')](_0x91307d['attributes'],function(_0x1ec243){var _0x20ca33={};_0x20ca33[_0x1ec243]={'$like':'%'+_0x561687[_0xe988('0x3f')][_0xe988('0x4a')]+'%'};return _0x20ca33;})});}_0x91307d=_[_0xe988('0x4b')]({},_0x91307d,_0x561687['options']);return _0xc9cc3f[_0xe988('0x93')](_0x91307d);}})[_0xe988('0x2c')](function(_0x3a6ba){if(_0x3a6ba){_0x43c92d=_0x3a6ba[_0xe988('0x44')];if(!_0x561687[_0xe988('0x3f')][_0xe988('0x45')](_0xe988('0x46'))){_0x91307d[_0xe988('0x24')]=qs[_0xe988('0x24')](_0x561687[_0xe988('0x3f')][_0xe988('0x24')]);_0x91307d[_0xe988('0x25')]=qs[_0xe988('0x25')](_0x561687[_0xe988('0x3f')][_0xe988('0x25')]);}return _0xc9cc3f[_0xe988('0x93')](_0x91307d);}})[_0xe988('0x2c')](function(_0x3a65ea){if(_0x3a65ea){return _0x3a65ea?{'count':_0x43c92d,'rows':_0x3a65ea}:null;}})[_0xe988('0x2c')](respondWithResult(_0x248a6a,null))['catch'](handleError(_0x248a6a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 4f488fe..5293b90 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 _0x5026=['emit','hasOwnProperty','events','WhatsappQueue','setMaxListeners','update','remove'];(function(_0x5cd983,_0x2e4ca4){var _0x589294=function(_0x3efe79){while(--_0x3efe79){_0x5cd983['push'](_0x5cd983['shift']());}};_0x589294(++_0x2e4ca4);}(_0x5026,0x11a));var _0x6502=function(_0x16ffbc,_0x2afebb){_0x16ffbc=_0x16ffbc-0x0;var _0x1d30da=_0x5026[_0x16ffbc];return _0x1d30da;};'use strict';var EventEmitter=require(_0x6502('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x6502('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x6502('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6502('0x3'),'afterDestroy':_0x6502('0x4')};function emitEvent(_0x27af23){return function(_0x3f1534,_0x82123e,_0x49623d){WhatsappQueueEvents[_0x6502('0x5')](_0x27af23+':'+_0x3f1534['id'],_0x3f1534);WhatsappQueueEvents[_0x6502('0x5')](_0x27af23,_0x3f1534);_0x49623d(null);};}for(var e in events){if(events[_0x6502('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x1857=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x1857,0x17a));var _0x7185=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1857[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x7185('0x0'));var WhatsappQueue=require(_0x7185('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7185('0x2')](0x0);var events={'afterCreate':_0x7185('0x3'),'afterUpdate':_0x7185('0x4'),'afterDestroy':'remove'};function emitEvent(_0x27f285){return function(_0x3a473f,_0x15586e,_0x368e4e){WhatsappQueueEvents[_0x7185('0x5')](_0x27f285+':'+_0x3a473f['id'],_0x3a473f);WhatsappQueueEvents[_0x7185('0x5')](_0x27f285,_0x3a473f);_0x368e4e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x7185('0x6')](e,emitEvent(event));}}module[_0x7185('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 dba01e5..c3be13d 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 _0xb208=['rimraf','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','request-promise','path'];(function(_0x43cc3b,_0x2f3963){var _0x44fe5e=function(_0x101a19){while(--_0x101a19){_0x43cc3b['push'](_0x43cc3b['shift']());}};_0x44fe5e(++_0x2f3963);}(_0xb208,0x195));var _0x8b20=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb208[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x8b20('0x0'));var logger=require(_0x8b20('0x1'))(_0x8b20('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8b20('0x3'));var fs=require('fs');var path=require(_0x8b20('0x4'));var rimraf=require(_0x8b20('0x5'));var config=require('../../config/environment');var attributes=require(_0x8b20('0x6'));module[_0x8b20('0x7')]=function(_0x4820ea,_0x4d2c40){return _0x4820ea['define'](_0x8b20('0x8'),attributes,{'tableName':_0x8b20('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea8d=['define','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports'];(function(_0x4d4ad6,_0x58d5a2){var _0x1f1898=function(_0x3a45a2){while(--_0x3a45a2){_0x4d4ad6['push'](_0x4d4ad6['shift']());}};_0x1f1898(++_0x58d5a2);}(_0xea8d,0x8e));var _0xdea8=function(_0x40ca84,_0x5ea1f2){_0x40ca84=_0x40ca84-0x0;var _0x21ed2b=_0xea8d[_0x40ca84];return _0x21ed2b;};'use strict';var _=require(_0xdea8('0x0'));var util=require(_0xdea8('0x1'));var logger=require(_0xdea8('0x2'))(_0xdea8('0x3'));var moment=require(_0xdea8('0x4'));var BPromise=require(_0xdea8('0x5'));var rp=require(_0xdea8('0x6'));var fs=require('fs');var path=require(_0xdea8('0x7'));var rimraf=require(_0xdea8('0x8'));var config=require(_0xdea8('0x9'));var attributes=require(_0xdea8('0xa'));module[_0xdea8('0xb')]=function(_0x2ebe4b,_0x49e4ec){return _0x2ebe4b[_0xdea8('0xc')]('WhatsappQueue',attributes,{'tableName':_0xdea8('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 264b258..7edaa52 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 _0x45a9=['./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','GetWhatsappQueue','WhatsappQueue','options','raw','attributes','map','include','model','catch','find','where','ShowWhatsappQueue','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter'];(function(_0x81511d,_0x40d457){var _0x20d860=function(_0x147904){while(--_0x147904){_0x81511d['push'](_0x81511d['shift']());}};_0x20d860(++_0x40d457);}(_0x45a9,0x68));var _0x945a=function(_0x9dd0a8,_0x174e1d){_0x9dd0a8=_0x9dd0a8-0x0;var _0xaf18df=_0x45a9[_0x9dd0a8];return _0xaf18df;};'use strict';var _=require(_0x945a('0x0'));var util=require(_0x945a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x945a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x945a('0x3'))['db'];var utils=require(_0x945a('0x4'));var logger=require(_0x945a('0x5'))(_0x945a('0x6'));var config=require(_0x945a('0x7'));var jayson=require(_0x945a('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x945a('0x9')]=_[_0x945a('0xa')](config[_0x945a('0x9')],{'host':_0x945a('0xb'),'port':0x18eb});var socket=require(_0x945a('0xc'))(new Redis(config[_0x945a('0x9')]));require(_0x945a('0xd'))[_0x945a('0xe')](socket);function respondWithRpcPromise(_0x2d0211,_0x922ab8,_0x3026ed){return new BPromise(function(_0x4c0c65,_0x24ef83){return client[_0x945a('0xf')](_0x2d0211,_0x3026ed)[_0x945a('0x10')](function(_0x51b961){logger[_0x945a('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x922ab8,_0x945a('0x12'));logger[_0x945a('0x13')](_0x945a('0x14'),_0x922ab8,'request\x20sent',JSON[_0x945a('0x15')](_0x51b961));if(_0x51b961['error']){if(_0x51b961[_0x945a('0x16')][_0x945a('0x17')]===0x1f4){logger[_0x945a('0x16')](_0x945a('0x18'),_0x922ab8,_0x51b961['error']['message']);return _0x24ef83(_0x51b961[_0x945a('0x16')][_0x945a('0x19')]);}logger[_0x945a('0x16')](_0x945a('0x18'),_0x922ab8,_0x51b961[_0x945a('0x16')][_0x945a('0x19')]);return _0x4c0c65(_0x51b961[_0x945a('0x16')][_0x945a('0x19')]);}else{logger['info'](_0x945a('0x18'),_0x922ab8,_0x945a('0x12'));_0x4c0c65(_0x51b961[_0x945a('0x1a')][_0x945a('0x19')]);}})['catch'](function(_0x23043d){logger['error'](_0x945a('0x18'),_0x922ab8,_0x23043d);_0x24ef83(_0x23043d);});});}exports[_0x945a('0x1b')]=function(_0x36268f){var _0x303173=this;return new Promise(function(_0x2849db,_0x21068d){return db[_0x945a('0x1c')]['findAll']({'raw':_0x36268f[_0x945a('0x1d')]?_0x36268f['options'][_0x945a('0x1e')]===undefined?!![]:![]:!![],'where':_0x36268f[_0x945a('0x1d')]?_0x36268f[_0x945a('0x1d')]['where']||null:null,'attributes':_0x36268f[_0x945a('0x1d')]?_0x36268f[_0x945a('0x1d')][_0x945a('0x1f')]||null:null,'limit':_0x36268f[_0x945a('0x1d')]?_0x36268f[_0x945a('0x1d')]['limit']||null:null,'include':_0x36268f[_0x945a('0x1d')]?_0x36268f[_0x945a('0x1d')]['include']?_[_0x945a('0x20')](_0x36268f[_0x945a('0x1d')][_0x945a('0x21')],function(_0x50fd07){return{'model':db[_0x50fd07[_0x945a('0x22')]],'as':_0x50fd07['as'],'attributes':_0x50fd07[_0x945a('0x1f')],'include':_0x50fd07[_0x945a('0x21')]?_[_0x945a('0x20')](_0x50fd07['include'],function(_0x326e8c){return{'model':db[_0x326e8c[_0x945a('0x22')]],'as':_0x326e8c['as'],'attributes':_0x326e8c['attributes'],'include':_0x326e8c[_0x945a('0x21')]?_[_0x945a('0x20')](_0x326e8c['include'],function(_0x2fcae4){return{'model':db[_0x2fcae4['model']],'as':_0x2fcae4['as'],'attributes':_0x2fcae4[_0x945a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x945a('0x10')](function(_0x402226){logger[_0x945a('0x11')]('GetWhatsappQueue',_0x36268f);logger[_0x945a('0x13')](_0x945a('0x1b'),_0x36268f,JSON['stringify'](_0x402226));_0x2849db(_0x402226);})[_0x945a('0x23')](function(_0x1aff39){logger[_0x945a('0x16')]('GetWhatsappQueue',_0x1aff39['message'],_0x36268f);_0x21068d(_0x303173[_0x945a('0x16')](0x1f4,_0x1aff39[_0x945a('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x4445b6){var _0x980c26=this;return new Promise(function(_0xf3304,_0xb372ef){return db[_0x945a('0x1c')][_0x945a('0x24')]({'raw':_0x4445b6[_0x945a('0x1d')]?_0x4445b6[_0x945a('0x1d')][_0x945a('0x1e')]===undefined?!![]:![]:!![],'where':_0x4445b6[_0x945a('0x1d')]?_0x4445b6[_0x945a('0x1d')][_0x945a('0x25')]||null:null,'attributes':_0x4445b6[_0x945a('0x1d')]?_0x4445b6[_0x945a('0x1d')][_0x945a('0x1f')]||null:null,'include':_0x4445b6[_0x945a('0x1d')]?_0x4445b6[_0x945a('0x1d')][_0x945a('0x21')]?_[_0x945a('0x20')](_0x4445b6[_0x945a('0x1d')][_0x945a('0x21')],function(_0x4a0570){return{'model':db[_0x4a0570['model']],'as':_0x4a0570['as'],'attributes':_0x4a0570[_0x945a('0x1f')],'include':_0x4a0570['include']?_[_0x945a('0x20')](_0x4a0570[_0x945a('0x21')],function(_0x20da4d){return{'model':db[_0x20da4d['model']],'as':_0x20da4d['as'],'attributes':_0x20da4d[_0x945a('0x1f')],'include':_0x20da4d[_0x945a('0x21')]?_[_0x945a('0x20')](_0x20da4d[_0x945a('0x21')],function(_0x5c9813){return{'model':db[_0x5c9813[_0x945a('0x22')]],'as':_0x5c9813['as'],'attributes':_0x5c9813[_0x945a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x945a('0x10')](function(_0xd0a7fb){logger['info'](_0x945a('0x26'),_0x4445b6);logger['debug'](_0x945a('0x26'),_0x4445b6,JSON[_0x945a('0x15')](_0xd0a7fb));_0xf3304(_0xd0a7fb);})[_0x945a('0x23')](function(_0x49735c){logger[_0x945a('0x16')](_0x945a('0x26'),_0x49735c[_0x945a('0x19')],_0x4445b6);_0xb372ef(_0x980c26[_0x945a('0x16')](0x1f4,_0x49735c[_0x945a('0x19')]));});});}; \ No newline at end of file +var _0xd608=['socket.io-emitter','register','request','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','then','ShowWhatsappQueue','find','raw','debug','util','moment','bluebird','randomstring','ioredis','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xd608,0x11d));var _0x8d60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd608[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x8d60('0x0'));var moment=require(_0x8d60('0x1'));var BPromise=require(_0x8d60('0x2'));var rs=require(_0x8d60('0x3'));var fs=require('fs');var Redis=require(_0x8d60('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8d60('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8d60('0x6')][_0x8d60('0x7')]({'port':0x232a});config[_0x8d60('0x8')]=_[_0x8d60('0x9')](config['redis'],{'host':_0x8d60('0xa'),'port':0x18eb});var socket=require(_0x8d60('0xb'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x8d60('0xc')](socket);function respondWithRpcPromise(_0x4ba945,_0x3cfc69,_0x2fd461){return new BPromise(function(_0x5f4712,_0x840322){return client[_0x8d60('0xd')](_0x4ba945,_0x2fd461)['then'](function(_0x1f2a50){logger['info'](_0x8d60('0xe'),_0x3cfc69,'request\x20sent');logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3cfc69,_0x8d60('0xf'),JSON[_0x8d60('0x10')](_0x1f2a50));if(_0x1f2a50[_0x8d60('0x11')]){if(_0x1f2a50[_0x8d60('0x11')]['code']===0x1f4){logger['error'](_0x8d60('0xe'),_0x3cfc69,_0x1f2a50['error']['message']);return _0x840322(_0x1f2a50[_0x8d60('0x11')][_0x8d60('0x12')]);}logger[_0x8d60('0x11')](_0x8d60('0xe'),_0x3cfc69,_0x1f2a50[_0x8d60('0x11')][_0x8d60('0x12')]);return _0x5f4712(_0x1f2a50[_0x8d60('0x11')][_0x8d60('0x12')]);}else{logger[_0x8d60('0x13')](_0x8d60('0xe'),_0x3cfc69,_0x8d60('0xf'));_0x5f4712(_0x1f2a50[_0x8d60('0x14')]['message']);}})[_0x8d60('0x15')](function(_0x3a9f2b){logger[_0x8d60('0x11')](_0x8d60('0xe'),_0x3cfc69,_0x3a9f2b);_0x840322(_0x3a9f2b);});});}exports[_0x8d60('0x16')]=function(_0x24bd2a){var _0x15d1bf=this;return new Promise(function(_0x10e91b,_0x4ed0ef){return db[_0x8d60('0x17')][_0x8d60('0x18')]({'raw':_0x24bd2a[_0x8d60('0x19')]?_0x24bd2a[_0x8d60('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x24bd2a['options']?_0x24bd2a['options'][_0x8d60('0x1a')]||null:null,'attributes':_0x24bd2a[_0x8d60('0x19')]?_0x24bd2a['options'][_0x8d60('0x1b')]||null:null,'limit':_0x24bd2a['options']?_0x24bd2a[_0x8d60('0x19')][_0x8d60('0x1c')]||null:null,'include':_0x24bd2a['options']?_0x24bd2a[_0x8d60('0x19')][_0x8d60('0x1d')]?_[_0x8d60('0x1e')](_0x24bd2a[_0x8d60('0x19')][_0x8d60('0x1d')],function(_0x56897e){return{'model':db[_0x56897e['model']],'as':_0x56897e['as'],'attributes':_0x56897e['attributes'],'include':_0x56897e[_0x8d60('0x1d')]?_[_0x8d60('0x1e')](_0x56897e[_0x8d60('0x1d')],function(_0x18e933){return{'model':db[_0x18e933[_0x8d60('0x1f')]],'as':_0x18e933['as'],'attributes':_0x18e933[_0x8d60('0x1b')],'include':_0x18e933[_0x8d60('0x1d')]?_[_0x8d60('0x1e')](_0x18e933[_0x8d60('0x1d')],function(_0x8d473d){return{'model':db[_0x8d473d[_0x8d60('0x1f')]],'as':_0x8d473d['as'],'attributes':_0x8d473d[_0x8d60('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8d60('0x20')](function(_0x2a12b7){logger[_0x8d60('0x13')]('GetWhatsappQueue',_0x24bd2a);logger['debug']('GetWhatsappQueue',_0x24bd2a,JSON[_0x8d60('0x10')](_0x2a12b7));_0x10e91b(_0x2a12b7);})[_0x8d60('0x15')](function(_0x422de0){logger[_0x8d60('0x11')](_0x8d60('0x16'),_0x422de0[_0x8d60('0x12')],_0x24bd2a);_0x4ed0ef(_0x15d1bf[_0x8d60('0x11')](0x1f4,_0x422de0[_0x8d60('0x12')]));});});};exports[_0x8d60('0x21')]=function(_0x22d27b){var _0x37944e=this;return new Promise(function(_0x53203f,_0x2e9294){return db[_0x8d60('0x17')][_0x8d60('0x22')]({'raw':_0x22d27b[_0x8d60('0x19')]?_0x22d27b['options'][_0x8d60('0x23')]===undefined?!![]:![]:!![],'where':_0x22d27b[_0x8d60('0x19')]?_0x22d27b[_0x8d60('0x19')][_0x8d60('0x1a')]||null:null,'attributes':_0x22d27b[_0x8d60('0x19')]?_0x22d27b[_0x8d60('0x19')][_0x8d60('0x1b')]||null:null,'include':_0x22d27b[_0x8d60('0x19')]?_0x22d27b[_0x8d60('0x19')][_0x8d60('0x1d')]?_[_0x8d60('0x1e')](_0x22d27b[_0x8d60('0x19')][_0x8d60('0x1d')],function(_0x7f0fa6){return{'model':db[_0x7f0fa6[_0x8d60('0x1f')]],'as':_0x7f0fa6['as'],'attributes':_0x7f0fa6[_0x8d60('0x1b')],'include':_0x7f0fa6[_0x8d60('0x1d')]?_[_0x8d60('0x1e')](_0x7f0fa6['include'],function(_0x2335e8){return{'model':db[_0x2335e8[_0x8d60('0x1f')]],'as':_0x2335e8['as'],'attributes':_0x2335e8[_0x8d60('0x1b')],'include':_0x2335e8[_0x8d60('0x1d')]?_[_0x8d60('0x1e')](_0x2335e8[_0x8d60('0x1d')],function(_0x14f96c){return{'model':db[_0x14f96c['model']],'as':_0x14f96c['as'],'attributes':_0x14f96c[_0x8d60('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8d60('0x20')](function(_0x4818d5){logger[_0x8d60('0x13')](_0x8d60('0x21'),_0x22d27b);logger[_0x8d60('0x24')](_0x8d60('0x21'),_0x22d27b,JSON[_0x8d60('0x10')](_0x4818d5));_0x53203f(_0x4818d5);})['catch'](function(_0x176ba4){logger[_0x8d60('0x11')](_0x8d60('0x21'),_0x176ba4['message'],_0x22d27b);_0x2e9294(_0x37944e[_0x8d60('0x11')](0x1f4,_0x176ba4[_0x8d60('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 0c17f20..b003402 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 _0x0641=['remove','update','emit','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x23c8f6,_0xc90614){var _0x23dc0f=function(_0x22cbc9){while(--_0x22cbc9){_0x23c8f6['push'](_0x23c8f6['shift']());}};_0x23dc0f(++_0xc90614);}(_0x0641,0x140));var _0x1064=function(_0x55e648,_0x541baf){_0x55e648=_0x55e648-0x0;var _0x3e02a2=_0x0641[_0x55e648];return _0x3e02a2;};'use strict';var WhatsappQueueEvents=require(_0x1064('0x0'));var events=[_0x1064('0x1'),_0x1064('0x2'),_0x1064('0x3')];function createListener(_0x1a9ebc,_0x18c3dc){return function(_0x34d592){_0x18c3dc[_0x1064('0x4')](_0x1a9ebc,_0x34d592);};}function removeListener(_0x4c5d2c,_0x4841a4){return function(){WhatsappQueueEvents['removeListener'](_0x4c5d2c,_0x4841a4);};}exports['register']=function(_0x33c787){for(var _0x367519=0x0,_0x3260da=events[_0x1064('0x5')];_0x367519<_0x3260da;_0x367519++){var _0xb8e30c=events[_0x367519];var _0x1d18e2=createListener(_0x1064('0x6')+_0xb8e30c,_0x33c787);WhatsappQueueEvents['on'](_0xb8e30c,_0x1d18e2);}}; \ No newline at end of file +var _0x4c33=['emit','length','whatsappQueue:','./whatsappQueue.events','remove','update'];(function(_0x11b7de,_0x2316fb){var _0x46d94a=function(_0x2d64c0){while(--_0x2d64c0){_0x11b7de['push'](_0x11b7de['shift']());}};_0x46d94a(++_0x2316fb);}(_0x4c33,0x93));var _0x34c3=function(_0x3f8184,_0x4f443a){_0x3f8184=_0x3f8184-0x0;var _0x2cbc73=_0x4c33[_0x3f8184];return _0x2cbc73;};'use strict';var WhatsappQueueEvents=require(_0x34c3('0x0'));var events=['save',_0x34c3('0x1'),_0x34c3('0x2')];function createListener(_0x2d9061,_0x23d1a0){return function(_0x5a14e5){_0x23d1a0[_0x34c3('0x3')](_0x2d9061,_0x5a14e5);};}function removeListener(_0x3f319d,_0x452e82){return function(){WhatsappQueueEvents['removeListener'](_0x3f319d,_0x452e82);};}exports['register']=function(_0x42ce71){for(var _0x5550ea=0x0,_0x2b6638=events[_0x34c3('0x4')];_0x5550ea<_0x2b6638;_0x5550ea++){var _0x134c9d=events[_0x5550ea];var _0x23b22f=createListener(_0x34c3('0x5')+_0x134c9d,_0x42ce71);WhatsappQueueEvents['on'](_0x134c9d,_0x23b22f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 74d690f..3d1ea74 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 _0xd757=['/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0x3be18e,_0x2c585e){var _0x2e2dc6=function(_0x31e172){while(--_0x31e172){_0x3be18e['push'](_0x3be18e['shift']());}};_0x2e2dc6(++_0x2c585e);}(_0xd757,0x1e5));var _0x7d75=function(_0x21c560,_0x57df0f){_0x21c560=_0x21c560-0x0;var _0x5bc6e3=_0xd757[_0x21c560];return _0x5bc6e3;};'use strict';var multer=require(_0x7d75('0x0'));var util=require(_0x7d75('0x1'));var path=require(_0x7d75('0x2'));var timeout=require(_0x7d75('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7d75('0x4'));var auth=require(_0x7d75('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7d75('0x6'));var controller=require(_0x7d75('0x7'));router[_0x7d75('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7d75('0x8')](_0x7d75('0x9'),auth[_0x7d75('0xa')](),controller[_0x7d75('0xb')]);router[_0x7d75('0x8')](_0x7d75('0xc'),auth[_0x7d75('0xa')](),controller[_0x7d75('0xd')]);router[_0x7d75('0xe')]('/',auth[_0x7d75('0xa')](),controller[_0x7d75('0xf')]);router[_0x7d75('0x10')](_0x7d75('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x7d75('0x11')](_0x7d75('0xc'),auth[_0x7d75('0xa')](),controller['destroy']);module[_0x7d75('0x12')]=router; \ No newline at end of file +var _0xb677=['../../config/environment','get','isAuthenticated','index','post','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x51e7d5,_0x4651b2){var _0x7e0d83=function(_0x53c4a8){while(--_0x53c4a8){_0x51e7d5['push'](_0x51e7d5['shift']());}};_0x7e0d83(++_0x4651b2);}(_0xb677,0x119));var _0x7b67=function(_0x3a8169,_0x504022){_0x3a8169=_0x3a8169-0x0;var _0x545328=_0xb677[_0x3a8169];return _0x545328;};'use strict';var multer=require(_0x7b67('0x0'));var util=require('util');var path=require(_0x7b67('0x1'));var timeout=require(_0x7b67('0x2'));var express=require(_0x7b67('0x3'));var router=express[_0x7b67('0x4')]();var fs_extra=require(_0x7b67('0x5'));var auth=require(_0x7b67('0x6'));var interaction=require(_0x7b67('0x7'));var config=require(_0x7b67('0x8'));var controller=require('./whatsappQueueReport.controller');router[_0x7b67('0x9')]('/',auth[_0x7b67('0xa')](),controller[_0x7b67('0xb')]);router[_0x7b67('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x7b67('0x9')]('/:id',auth[_0x7b67('0xa')](),controller['show']);router[_0x7b67('0xc')]('/',auth[_0x7b67('0xa')](),controller['create']);router[_0x7b67('0xd')]('/:id',auth[_0x7b67('0xa')](),controller[_0x7b67('0xe')]);router[_0x7b67('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7b67('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index d15c73c..a88dc00 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 _0x4b84=['sequelize','exports','DATE','STRING'];(function(_0x54ed4c,_0x3dfcca){var _0x22fb47=function(_0x4dd9d4){while(--_0x4dd9d4){_0x54ed4c['push'](_0x54ed4c['shift']());}};_0x22fb47(++_0x3dfcca);}(_0x4b84,0x1cc));var _0x44b8=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0x4b84[_0x37b3e5];return _0x207f20;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x44b8('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x44b8('0x2')]},'reason':{'type':Sequelize[_0x44b8('0x3')]}}; \ No newline at end of file +var _0xf3cd=['STRING','DATE','sequelize','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x271537,_0x8b7b3b){_0x271537=_0x271537-0x0;var _0x19dc22=_0xf3cd[_0x271537];return _0x19dc22;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdf3c('0x2')]},'joinAt':{'type':Sequelize[_0xdf3c('0x3')]},'leaveAt':{'type':Sequelize[_0xdf3c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdf3c('0x3')]},'reason':{'type':Sequelize[_0xdf3c('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 3f0ccfc..f6e11e4 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 _0x3163=['name','render','body','contact','message','agent','interaction','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','catch','show','params','merge','create','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','stack'];(function(_0x1c9ce8,_0x5f4a9f){var _0x265023=function(_0x52b54d){while(--_0x52b54d){_0x1c9ce8['push'](_0x1c9ce8['shift']());}};_0x265023(++_0x5f4a9f);}(_0x3163,0x1ad));var _0x3316=function(_0x1ab6a3,_0x50d917){_0x1ab6a3=_0x1ab6a3-0x0;var _0x5cf0c7=_0x3163[_0x1ab6a3];return _0x5cf0c7;};'use strict';var emlformat=require(_0x3316('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3316('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3316('0x2'));var moment=require(_0x3316('0x3'));var BPromise=require(_0x3316('0x4'));var Mustache=require(_0x3316('0x5'));var util=require(_0x3316('0x6'));var path=require(_0x3316('0x7'));var sox=require(_0x3316('0x8'));var csv=require('to-csv');var ejs=require(_0x3316('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3316('0xa'));var squel=require('squel');var crypto=require(_0x3316('0xb'));var jsforce=require(_0x3316('0xc'));var deskjs=require(_0x3316('0xd'));var toCsv=require(_0x3316('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3316('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3316('0x10'));var logger=require(_0x3316('0x11'))(_0x3316('0x12'));var utils=require(_0x3316('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3316('0x14'));var db=require(_0x3316('0x15'))['db'];function respondWithStatusCode(_0xe81556,_0x452803){_0x452803=_0x452803||0xcc;return function(_0x251b0b){if(_0x251b0b){return _0xe81556[_0x3316('0x16')](_0x452803);}return _0xe81556[_0x3316('0x17')](_0x452803)[_0x3316('0x18')]();};}function respondWithResult(_0x435ed4,_0x18dbff){_0x18dbff=_0x18dbff||0xc8;return function(_0xea1ff1){if(_0xea1ff1){return _0x435ed4['status'](_0x18dbff)[_0x3316('0x19')](_0xea1ff1);}};}function respondWithFilteredResult(_0x450bd9,_0x38e8f3){return function(_0x461abb){if(_0x461abb){var _0xe0197d=typeof _0x38e8f3['offset']===_0x3316('0x1a')&&typeof _0x38e8f3[_0x3316('0x1b')]==='undefined';var _0x1603bf=_0x461abb['count'];var _0x57550a=_0xe0197d?0x0:_0x38e8f3[_0x3316('0x1c')];var _0x513b8a=_0xe0197d?_0x461abb[_0x3316('0x1d')]:_0x38e8f3[_0x3316('0x1c')]+_0x38e8f3['limit'];var _0x1df563;if(_0x513b8a>=_0x1603bf){_0x513b8a=_0x1603bf;_0x1df563=0xc8;}else{_0x1df563=0xce;}_0x450bd9[_0x3316('0x17')](_0x1df563);return _0x450bd9[_0x3316('0x1e')](_0x3316('0x1f'),_0x57550a+'-'+_0x513b8a+'/'+_0x1603bf)['json'](_0x461abb);}return null;};}function patchUpdates(_0x10ae83){return function(_0x36c648){try{jsonpatch[_0x3316('0x20')](_0x36c648,_0x10ae83,!![]);}catch(_0x2f26a5){return BPromise[_0x3316('0x21')](_0x2f26a5);}return _0x36c648[_0x3316('0x22')]();};}function saveUpdates(_0x3df3d5,_0x45790b){return function(_0x3d5289){if(_0x3d5289){return _0x3d5289[_0x3316('0x23')](_0x3df3d5)[_0x3316('0x24')](function(_0x315e9b){return _0x315e9b;});}return null;};}function removeEntity(_0x51b0e3,_0xf121d5){return function(_0x2af709){if(_0x2af709){return _0x2af709[_0x3316('0x25')]()['then'](function(){_0x51b0e3[_0x3316('0x17')](0xcc)[_0x3316('0x18')]();});}};}function handleEntityNotFound(_0x407b23,_0x38f043){return function(_0xade97c){if(!_0xade97c){_0x407b23[_0x3316('0x16')](0x194);}return _0xade97c;};}function handleError(_0x54bc69,_0x4eb00c){_0x4eb00c=_0x4eb00c||0x1f4;return function(_0x5accc6){logger['error'](_0x5accc6[_0x3316('0x26')]);if(_0x5accc6[_0x3316('0x27')]){delete _0x5accc6[_0x3316('0x27')];}_0x54bc69['status'](_0x4eb00c)['send'](_0x5accc6);};}function getMustacheRender(_0x6cb450,_0x191d19){return Mustache[_0x3316('0x28')](_0x6cb450,_['merge'](_0x191d19[_0x3316('0x29')],{'contact':_0x191d19[_0x3316('0x2a')],'message':_0x191d19[_0x3316('0x2b')],'agent':_0x191d19[_0x3316('0x2c')],'interaction':_0x191d19[_0x3316('0x2d')],'account':_0x191d19['account']}))||'';}exports[_0x3316('0x2e')]=function(_0xff6bfa,_0x1753eb){var _0x1a3902={},_0x254f67={},_0x1c36c1={'count':0x0,'rows':[]};var _0x748230=_[_0x3316('0x2f')](db[_0x3316('0x30')][_0x3316('0x31')],function(_0x4b9bc6){return{'name':_0x4b9bc6[_0x3316('0x32')],'type':_0x4b9bc6[_0x3316('0x33')][_0x3316('0x34')]};});_0x254f67[_0x3316('0x35')]=_[_0x3316('0x2f')](_0x748230,_0x3316('0x27'));_0x254f67[_0x3316('0x36')]=_[_0x3316('0x37')](_0xff6bfa['query']);_0x254f67[_0x3316('0x38')]=_['intersection'](_0x254f67['model'],_0x254f67['query']);_0x1a3902[_0x3316('0x39')]=_[_0x3316('0x3a')](_0x254f67[_0x3316('0x35')],qs[_0x3316('0x3b')](_0xff6bfa[_0x3316('0x36')][_0x3316('0x3b')]));_0x1a3902[_0x3316('0x39')]=_0x1a3902[_0x3316('0x39')][_0x3316('0x3c')]?_0x1a3902[_0x3316('0x39')]:_0x254f67[_0x3316('0x35')];if(!_0xff6bfa[_0x3316('0x36')][_0x3316('0x3d')](_0x3316('0x3e'))){_0x1a3902[_0x3316('0x1b')]=qs[_0x3316('0x1b')](_0xff6bfa[_0x3316('0x36')][_0x3316('0x1b')]);_0x1a3902[_0x3316('0x1c')]=qs[_0x3316('0x1c')](_0xff6bfa['query']['offset']);}_0x1a3902[_0x3316('0x3f')]=qs[_0x3316('0x40')](_0xff6bfa[_0x3316('0x36')][_0x3316('0x40')]);_0x1a3902[_0x3316('0x41')]=qs['filters'](_[_0x3316('0x42')](_0xff6bfa[_0x3316('0x36')],_0x254f67[_0x3316('0x38')]),_0x748230);if(_0xff6bfa[_0x3316('0x36')][_0x3316('0x43')]){_0x1a3902[_0x3316('0x41')]=_['merge'](_0x1a3902[_0x3316('0x41')],{'$or':_['map'](_0x748230,function(_0x17cb9b){if(_0x17cb9b[_0x3316('0x33')]!=='VIRTUAL'){var _0x47c6df={};_0x47c6df[_0x17cb9b[_0x3316('0x27')]]={'$like':'%'+_0xff6bfa[_0x3316('0x36')][_0x3316('0x43')]+'%'};return _0x47c6df;}})});}_0x1a3902=_['merge']({},_0x1a3902,_0xff6bfa[_0x3316('0x44')]);var _0x4b4f29={'where':_0x1a3902['where']};return db[_0x3316('0x30')][_0x3316('0x1d')](_0x4b4f29)[_0x3316('0x24')](function(_0xabaccd){_0x1c36c1[_0x3316('0x1d')]=_0xabaccd;if(_0xff6bfa[_0x3316('0x36')][_0x3316('0x45')]){_0x1a3902[_0x3316('0x46')]=[{'all':!![]}];}return db[_0x3316('0x30')]['findAll'](_0x1a3902);})[_0x3316('0x24')](function(_0x15a722){_0x1c36c1['rows']=_0x15a722;return _0x1c36c1;})[_0x3316('0x24')](respondWithFilteredResult(_0x1753eb,_0x1a3902))[_0x3316('0x47')](handleError(_0x1753eb,null));};exports[_0x3316('0x48')]=function(_0xee26d8,_0x1dd6fe){var _0x65456d={'raw':!![],'where':{'id':_0xee26d8[_0x3316('0x49')]['id']}},_0xaea90f={};_0xaea90f[_0x3316('0x35')]=_['keys'](db[_0x3316('0x30')][_0x3316('0x31')]);_0xaea90f[_0x3316('0x36')]=_[_0x3316('0x37')](_0xee26d8[_0x3316('0x36')]);_0xaea90f[_0x3316('0x38')]=_['intersection'](_0xaea90f['model'],_0xaea90f[_0x3316('0x36')]);_0x65456d['attributes']=_[_0x3316('0x3a')](_0xaea90f['model'],qs[_0x3316('0x3b')](_0xee26d8[_0x3316('0x36')][_0x3316('0x3b')]));_0x65456d[_0x3316('0x39')]=_0x65456d[_0x3316('0x39')][_0x3316('0x3c')]?_0x65456d[_0x3316('0x39')]:_0xaea90f['model'];if(_0xee26d8[_0x3316('0x36')][_0x3316('0x45')]){_0x65456d[_0x3316('0x46')]=[{'all':!![]}];}_0x65456d=_[_0x3316('0x4a')]({},_0x65456d,_0xee26d8[_0x3316('0x44')]);return db[_0x3316('0x30')]['find'](_0x65456d)['then'](handleEntityNotFound(_0x1dd6fe,null))[_0x3316('0x24')](respondWithResult(_0x1dd6fe,null))['catch'](handleError(_0x1dd6fe,null));};exports[_0x3316('0x4b')]=function(_0x308129,_0x21cbae){return db[_0x3316('0x30')]['create'](_0x308129[_0x3316('0x29')],{})['then'](respondWithResult(_0x21cbae,0xc9))[_0x3316('0x47')](handleError(_0x21cbae,null));};exports[_0x3316('0x23')]=function(_0x544cf3,_0x1b48ae){if(_0x544cf3[_0x3316('0x29')]['id']){delete _0x544cf3[_0x3316('0x29')]['id'];}return db[_0x3316('0x30')][_0x3316('0x4c')]({'where':{'id':_0x544cf3['params']['id']}})[_0x3316('0x24')](handleEntityNotFound(_0x1b48ae,null))[_0x3316('0x24')](saveUpdates(_0x544cf3['body'],null))[_0x3316('0x24')](respondWithResult(_0x1b48ae,null))[_0x3316('0x47')](handleError(_0x1b48ae,null));};exports['destroy']=function(_0x6d2aaf,_0x42b8b4){return db[_0x3316('0x30')][_0x3316('0x4c')]({'where':{'id':_0x6d2aaf[_0x3316('0x49')]['id']}})[_0x3316('0x24')](handleEntityNotFound(_0x42b8b4,null))[_0x3316('0x24')](removeEntity(_0x42b8b4,null))[_0x3316('0x47')](handleError(_0x42b8b4,null));};exports[_0x3316('0x4d')]=function(_0xc34ea5,_0x4ff6a5){return db[_0x3316('0x30')][_0x3316('0x4d')]()['then'](respondWithResult(_0x4ff6a5,null))['catch'](handleError(_0x4ff6a5,null));}; \ No newline at end of file +var _0xdb3b=['show','params','options','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','render','merge','body','contact','message','interaction','account','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','includeAll','include','findAll','rows','catch'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0xdb3b,0xac));var _0xbdb3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdb3b[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xbdb3('0x0'));var rimraf=require(_0xbdb3('0x1'));var zipdir=require(_0xbdb3('0x2'));var jsonpatch=require(_0xbdb3('0x3'));var rp=require(_0xbdb3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbdb3('0x5'));var util=require(_0xbdb3('0x6'));var path=require(_0xbdb3('0x7'));var sox=require(_0xbdb3('0x8'));var csv=require(_0xbdb3('0x9'));var ejs=require(_0xbdb3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbdb3('0xb'));var squel=require(_0xbdb3('0xc'));var crypto=require(_0xbdb3('0xd'));var jsforce=require(_0xbdb3('0xe'));var deskjs=require(_0xbdb3('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbdb3('0x10'));var Papa=require(_0xbdb3('0x11'));var Redis=require(_0xbdb3('0x12'));var authService=require(_0xbdb3('0x13'));var qs=require(_0xbdb3('0x14'));var as=require(_0xbdb3('0x15'));var hardwareService=require(_0xbdb3('0x16'));var logger=require('../../config/logger')(_0xbdb3('0x17'));var utils=require(_0xbdb3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xbdb3('0x19'));var db=require(_0xbdb3('0x1a'))['db'];function respondWithStatusCode(_0x1db3c0,_0x56f4fc){_0x56f4fc=_0x56f4fc||0xcc;return function(_0x27b1a4){if(_0x27b1a4){return _0x1db3c0[_0xbdb3('0x1b')](_0x56f4fc);}return _0x1db3c0['status'](_0x56f4fc)['end']();};}function respondWithResult(_0x249588,_0x36856e){_0x36856e=_0x36856e||0xc8;return function(_0x5ba8b1){if(_0x5ba8b1){return _0x249588[_0xbdb3('0x1c')](_0x36856e)[_0xbdb3('0x1d')](_0x5ba8b1);}};}function respondWithFilteredResult(_0x285388,_0xa526c8){return function(_0x1603ef){if(_0x1603ef){var _0xda0f29=typeof _0xa526c8[_0xbdb3('0x1e')]===_0xbdb3('0x1f')&&typeof _0xa526c8[_0xbdb3('0x20')]===_0xbdb3('0x1f');var _0x454b2a=_0x1603ef[_0xbdb3('0x21')];var _0x4f87c5=_0xda0f29?0x0:_0xa526c8[_0xbdb3('0x1e')];var _0x38b6aa=_0xda0f29?_0x1603ef['count']:_0xa526c8['offset']+_0xa526c8[_0xbdb3('0x20')];var _0x236998;if(_0x38b6aa>=_0x454b2a){_0x38b6aa=_0x454b2a;_0x236998=0xc8;}else{_0x236998=0xce;}_0x285388[_0xbdb3('0x1c')](_0x236998);return _0x285388[_0xbdb3('0x22')](_0xbdb3('0x23'),_0x4f87c5+'-'+_0x38b6aa+'/'+_0x454b2a)[_0xbdb3('0x1d')](_0x1603ef);}return null;};}function patchUpdates(_0x2e2e6e){return function(_0x1e07a7){try{jsonpatch['apply'](_0x1e07a7,_0x2e2e6e,!![]);}catch(_0x24b655){return BPromise['reject'](_0x24b655);}return _0x1e07a7[_0xbdb3('0x24')]();};}function saveUpdates(_0x581d3c,_0xa2a1be){return function(_0x2699d2){if(_0x2699d2){return _0x2699d2[_0xbdb3('0x25')](_0x581d3c)[_0xbdb3('0x26')](function(_0x3c5745){return _0x3c5745;});}return null;};}function removeEntity(_0x4dfaa4,_0x5ce41e){return function(_0x236198){if(_0x236198){return _0x236198[_0xbdb3('0x27')]()[_0xbdb3('0x26')](function(){_0x4dfaa4[_0xbdb3('0x1c')](0xcc)[_0xbdb3('0x28')]();});}};}function handleEntityNotFound(_0x49cb53,_0x2533f2){return function(_0x3d4750){if(!_0x3d4750){_0x49cb53[_0xbdb3('0x1b')](0x194);}return _0x3d4750;};}function handleError(_0x1f96d6,_0x54108c){_0x54108c=_0x54108c||0x1f4;return function(_0x5703f9){logger[_0xbdb3('0x29')](_0x5703f9[_0xbdb3('0x2a')]);if(_0x5703f9[_0xbdb3('0x2b')]){delete _0x5703f9[_0xbdb3('0x2b')];}_0x1f96d6[_0xbdb3('0x1c')](_0x54108c)[_0xbdb3('0x2c')](_0x5703f9);};}function getMustacheRender(_0x5c7256,_0x50dc77){return Mustache[_0xbdb3('0x2d')](_0x5c7256,_[_0xbdb3('0x2e')](_0x50dc77[_0xbdb3('0x2f')],{'contact':_0x50dc77[_0xbdb3('0x30')],'message':_0x50dc77[_0xbdb3('0x31')],'agent':_0x50dc77['agent'],'interaction':_0x50dc77[_0xbdb3('0x32')],'account':_0x50dc77[_0xbdb3('0x33')]}))||'';}exports[_0xbdb3('0x34')]=function(_0xd83d7a,_0x485628){var _0x380d3c={},_0x35ae20={},_0x2d3474={'count':0x0,'rows':[]};var _0x4f07d3=_[_0xbdb3('0x35')](db[_0xbdb3('0x36')][_0xbdb3('0x37')],function(_0x479a8b){return{'name':_0x479a8b[_0xbdb3('0x38')],'type':_0x479a8b[_0xbdb3('0x39')][_0xbdb3('0x3a')]};});_0x35ae20[_0xbdb3('0x3b')]=_[_0xbdb3('0x35')](_0x4f07d3,_0xbdb3('0x2b'));_0x35ae20['query']=_[_0xbdb3('0x3c')](_0xd83d7a[_0xbdb3('0x3d')]);_0x35ae20[_0xbdb3('0x3e')]=_[_0xbdb3('0x3f')](_0x35ae20['model'],_0x35ae20[_0xbdb3('0x3d')]);_0x380d3c[_0xbdb3('0x40')]=_[_0xbdb3('0x3f')](_0x35ae20['model'],qs[_0xbdb3('0x41')](_0xd83d7a[_0xbdb3('0x3d')]['fields']));_0x380d3c[_0xbdb3('0x40')]=_0x380d3c[_0xbdb3('0x40')][_0xbdb3('0x42')]?_0x380d3c[_0xbdb3('0x40')]:_0x35ae20['model'];if(!_0xd83d7a[_0xbdb3('0x3d')][_0xbdb3('0x43')](_0xbdb3('0x44'))){_0x380d3c[_0xbdb3('0x20')]=qs[_0xbdb3('0x20')](_0xd83d7a[_0xbdb3('0x3d')][_0xbdb3('0x20')]);_0x380d3c[_0xbdb3('0x1e')]=qs[_0xbdb3('0x1e')](_0xd83d7a[_0xbdb3('0x3d')][_0xbdb3('0x1e')]);}_0x380d3c['order']=qs[_0xbdb3('0x45')](_0xd83d7a['query'][_0xbdb3('0x45')]);_0x380d3c['where']=qs[_0xbdb3('0x3e')](_[_0xbdb3('0x46')](_0xd83d7a['query'],_0x35ae20[_0xbdb3('0x3e')]),_0x4f07d3);if(_0xd83d7a[_0xbdb3('0x3d')]['filter']){_0x380d3c[_0xbdb3('0x47')]=_[_0xbdb3('0x2e')](_0x380d3c[_0xbdb3('0x47')],{'$or':_[_0xbdb3('0x35')](_0x4f07d3,function(_0x52f995){if(_0x52f995['type']!=='VIRTUAL'){var _0x23a047={};_0x23a047[_0x52f995[_0xbdb3('0x2b')]]={'$like':'%'+_0xd83d7a[_0xbdb3('0x3d')]['filter']+'%'};return _0x23a047;}})});}_0x380d3c=_[_0xbdb3('0x2e')]({},_0x380d3c,_0xd83d7a['options']);var _0x3b26c9={'where':_0x380d3c[_0xbdb3('0x47')]};return db[_0xbdb3('0x36')][_0xbdb3('0x21')](_0x3b26c9)[_0xbdb3('0x26')](function(_0x53b2fe){_0x2d3474[_0xbdb3('0x21')]=_0x53b2fe;if(_0xd83d7a[_0xbdb3('0x3d')][_0xbdb3('0x48')]){_0x380d3c[_0xbdb3('0x49')]=[{'all':!![]}];}return db[_0xbdb3('0x36')][_0xbdb3('0x4a')](_0x380d3c);})[_0xbdb3('0x26')](function(_0x50a49a){_0x2d3474[_0xbdb3('0x4b')]=_0x50a49a;return _0x2d3474;})[_0xbdb3('0x26')](respondWithFilteredResult(_0x485628,_0x380d3c))[_0xbdb3('0x4c')](handleError(_0x485628,null));};exports[_0xbdb3('0x4d')]=function(_0x21eeff,_0x4b7286){var _0x3d3140={'raw':!![],'where':{'id':_0x21eeff[_0xbdb3('0x4e')]['id']}},_0x67c67b={};_0x67c67b[_0xbdb3('0x3b')]=_[_0xbdb3('0x3c')](db[_0xbdb3('0x36')][_0xbdb3('0x37')]);_0x67c67b[_0xbdb3('0x3d')]=_[_0xbdb3('0x3c')](_0x21eeff[_0xbdb3('0x3d')]);_0x67c67b[_0xbdb3('0x3e')]=_[_0xbdb3('0x3f')](_0x67c67b[_0xbdb3('0x3b')],_0x67c67b['query']);_0x3d3140[_0xbdb3('0x40')]=_[_0xbdb3('0x3f')](_0x67c67b[_0xbdb3('0x3b')],qs[_0xbdb3('0x41')](_0x21eeff['query'][_0xbdb3('0x41')]));_0x3d3140['attributes']=_0x3d3140[_0xbdb3('0x40')][_0xbdb3('0x42')]?_0x3d3140[_0xbdb3('0x40')]:_0x67c67b[_0xbdb3('0x3b')];if(_0x21eeff[_0xbdb3('0x3d')][_0xbdb3('0x48')]){_0x3d3140['include']=[{'all':!![]}];}_0x3d3140=_[_0xbdb3('0x2e')]({},_0x3d3140,_0x21eeff[_0xbdb3('0x4f')]);return db[_0xbdb3('0x36')][_0xbdb3('0x50')](_0x3d3140)[_0xbdb3('0x26')](handleEntityNotFound(_0x4b7286,null))[_0xbdb3('0x26')](respondWithResult(_0x4b7286,null))['catch'](handleError(_0x4b7286,null));};exports[_0xbdb3('0x51')]=function(_0x121a89,_0x5780be){return db[_0xbdb3('0x36')][_0xbdb3('0x51')](_0x121a89[_0xbdb3('0x2f')],{})[_0xbdb3('0x26')](respondWithResult(_0x5780be,0xc9))[_0xbdb3('0x4c')](handleError(_0x5780be,null));};exports[_0xbdb3('0x25')]=function(_0x24eb98,_0x301e01){if(_0x24eb98[_0xbdb3('0x2f')]['id']){delete _0x24eb98[_0xbdb3('0x2f')]['id'];}return db[_0xbdb3('0x36')][_0xbdb3('0x50')]({'where':{'id':_0x24eb98[_0xbdb3('0x4e')]['id']}})[_0xbdb3('0x26')](handleEntityNotFound(_0x301e01,null))['then'](saveUpdates(_0x24eb98[_0xbdb3('0x2f')],null))[_0xbdb3('0x26')](respondWithResult(_0x301e01,null))[_0xbdb3('0x4c')](handleError(_0x301e01,null));};exports[_0xbdb3('0x27')]=function(_0x1d9c5f,_0x52423f){return db[_0xbdb3('0x36')][_0xbdb3('0x50')]({'where':{'id':_0x1d9c5f[_0xbdb3('0x4e')]['id']}})[_0xbdb3('0x26')](handleEntityNotFound(_0x52423f,null))['then'](removeEntity(_0x52423f,null))['catch'](handleError(_0x52423f,null));};exports[_0xbdb3('0x52')]=function(_0x1f585f,_0x1af536){return db['WhatsappQueueReport'][_0xbdb3('0x52')]()[_0xbdb3('0x26')](respondWithResult(_0x1af536,null))[_0xbdb3('0x4c')](handleError(_0x1af536,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 1ef73cd..c5e12ce 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 _0x35a7=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x337945,_0x19ad92){var _0x16a9d2=function(_0x55ac11){while(--_0x55ac11){_0x337945['push'](_0x337945['shift']());}};_0x16a9d2(++_0x19ad92);}(_0x35a7,0xf8));var _0x735a=function(_0xee64cd,_0x168456){_0xee64cd=_0xee64cd-0x0;var _0x3d3d8a=_0x35a7[_0xee64cd];return _0x3d3d8a;};'use strict';var _=require(_0x735a('0x0'));var util=require(_0x735a('0x1'));var logger=require(_0x735a('0x2'))('api');var moment=require(_0x735a('0x3'));var BPromise=require(_0x735a('0x4'));var rp=require(_0x735a('0x5'));var fs=require('fs');var path=require(_0x735a('0x6'));var rimraf=require(_0x735a('0x7'));var config=require(_0x735a('0x8'));var attributes=require(_0x735a('0x9'));module[_0x735a('0xa')]=function(_0x4483e3,_0x518830){return _0x4483e3['define'](_0x735a('0xb'),attributes,{'tableName':_0x735a('0xc'),'paranoid':![],'indexes':[{'name':_0x735a('0xd'),'fields':[_0x735a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60d0=['path','rimraf','../../config/environment','./whatsappQueueReport.attributes','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2c8d11,_0x1e4251){var _0x44e0cc=function(_0x1c16d6){while(--_0x1c16d6){_0x2c8d11['push'](_0x2c8d11['shift']());}};_0x44e0cc(++_0x1e4251);}(_0x60d0,0x103));var _0x060d=function(_0x3ea4b1,_0x1c59b4){_0x3ea4b1=_0x3ea4b1-0x0;var _0x4fec31=_0x60d0[_0x3ea4b1];return _0x4fec31;};'use strict';var _=require(_0x060d('0x0'));var util=require('util');var logger=require(_0x060d('0x1'))(_0x060d('0x2'));var moment=require(_0x060d('0x3'));var BPromise=require(_0x060d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x060d('0x5'));var rimraf=require(_0x060d('0x6'));var config=require(_0x060d('0x7'));var attributes=require(_0x060d('0x8'));module['exports']=function(_0x32bc76,_0x590778){return _0x32bc76['define'](_0x060d('0x9'),attributes,{'tableName':_0x060d('0xa'),'paranoid':![],'indexes':[{'name':_0x060d('0xb'),'fields':[_0x060d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 6b7b74d..caa2890 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 _0x4a1a=['update','body','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4a1a,0x6a));var _0xa4a1=function(_0x109ff7,_0x3a312d){_0x109ff7=_0x109ff7-0x0;var _0x1a84b0=_0x4a1a[_0x109ff7];return _0x1a84b0;};'use strict';var _=require(_0xa4a1('0x0'));var util=require(_0xa4a1('0x1'));var moment=require(_0xa4a1('0x2'));var BPromise=require(_0xa4a1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4a1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa4a1('0x5'));var logger=require(_0xa4a1('0x6'))(_0xa4a1('0x7'));var config=require(_0xa4a1('0x8'));var jayson=require(_0xa4a1('0x9'));var client=jayson[_0xa4a1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4369d8,_0x2dbd21,_0x1207d7){return new BPromise(function(_0x2228a1,_0x451373){return client[_0xa4a1('0xb')](_0x4369d8,_0x1207d7)[_0xa4a1('0xc')](function(_0xa78d5d){logger[_0xa4a1('0xd')](_0xa4a1('0xe'),_0x2dbd21,_0xa4a1('0xf'));logger[_0xa4a1('0x10')](_0xa4a1('0x11'),_0x2dbd21,_0xa4a1('0xf'),JSON[_0xa4a1('0x12')](_0xa78d5d));if(_0xa78d5d['error']){if(_0xa78d5d[_0xa4a1('0x13')][_0xa4a1('0x14')]===0x1f4){logger[_0xa4a1('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2dbd21,_0xa78d5d[_0xa4a1('0x13')][_0xa4a1('0x15')]);return _0x451373(_0xa78d5d['error'][_0xa4a1('0x15')]);}logger[_0xa4a1('0x13')](_0xa4a1('0xe'),_0x2dbd21,_0xa78d5d[_0xa4a1('0x13')]['message']);return _0x2228a1(_0xa78d5d['error']['message']);}else{logger[_0xa4a1('0xd')](_0xa4a1('0xe'),_0x2dbd21,_0xa4a1('0xf'));_0x2228a1(_0xa78d5d[_0xa4a1('0x16')][_0xa4a1('0x15')]);}})[_0xa4a1('0x17')](function(_0x294f4e){logger[_0xa4a1('0x13')](_0xa4a1('0xe'),_0x2dbd21,_0x294f4e);_0x451373(_0x294f4e);});});}exports[_0xa4a1('0x18')]=function(_0x5e2fb1){var _0xe83c2c=this;return new Promise(function(_0x4e5e5a,_0x115730){return db[_0xa4a1('0x19')][_0xa4a1('0x1a')](_0x5e2fb1['body'],{'raw':_0x5e2fb1['options']?_0x5e2fb1[_0xa4a1('0x1b')][_0xa4a1('0x1c')]===undefined?!![]:![]:!![]})[_0xa4a1('0xc')](function(_0x436f20){logger[_0xa4a1('0xd')]('CreateWhatsappQueueReport',_0x5e2fb1);logger['debug']('CreateWhatsappQueueReport',_0x5e2fb1,JSON['stringify'](_0x436f20));_0x4e5e5a(_0x436f20);})[_0xa4a1('0x17')](function(_0x18ec7a){logger[_0xa4a1('0x13')](_0xa4a1('0x18'),_0x18ec7a[_0xa4a1('0x15')],_0x5e2fb1);_0x115730(_0xe83c2c['error'](0x1f4,_0x18ec7a[_0xa4a1('0x15')]));});});};exports[_0xa4a1('0x1d')]=function(_0x5a9d31){var _0x54721a=this;return new Promise(function(_0x233b54,_0x785567){return db['WhatsappQueueReport'][_0xa4a1('0x1e')](_0x5a9d31[_0xa4a1('0x1f')],{'raw':_0x5a9d31[_0xa4a1('0x1b')]?_0x5a9d31[_0xa4a1('0x1b')][_0xa4a1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a9d31[_0xa4a1('0x1b')]?_0x5a9d31['options']['where']||null:null,'attributes':_0x5a9d31[_0xa4a1('0x1b')]?_0x5a9d31[_0xa4a1('0x1b')][_0xa4a1('0x20')]||null:null,'limit':_0x5a9d31['options']?_0x5a9d31['options'][_0xa4a1('0x21')]||null:null})['then'](function(_0x1553a6){logger[_0xa4a1('0xd')](_0xa4a1('0x1d'),_0x5a9d31);logger[_0xa4a1('0x10')](_0xa4a1('0x1d'),_0x5a9d31,JSON[_0xa4a1('0x12')](_0x1553a6));_0x233b54(_0x1553a6);})[_0xa4a1('0x17')](function(_0x1af39c){logger[_0xa4a1('0x13')](_0xa4a1('0x1d'),_0x1af39c['message'],_0x5a9d31);_0x785567(_0x54721a['error'](0x1f4,_0x1af39c[_0xa4a1('0x15')]));});});}; \ No newline at end of file +var _0xb7a1=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateWhatsappQueueReport','create','body','options','raw','WhatsappQueueReport','where','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring'];(function(_0x1ae1d3,_0x3a31b4){var _0x491a20=function(_0x3f44c5){while(--_0x3f44c5){_0x1ae1d3['push'](_0x1ae1d3['shift']());}};_0x491a20(++_0x3a31b4);}(_0xb7a1,0x150));var _0x1b7a=function(_0x27e84b,_0x5eb0c7){_0x27e84b=_0x27e84b-0x0;var _0x1b1888=_0xb7a1[_0x27e84b];return _0x1b1888;};'use strict';var _=require(_0x1b7a('0x0'));var util=require(_0x1b7a('0x1'));var moment=require(_0x1b7a('0x2'));var BPromise=require(_0x1b7a('0x3'));var rs=require(_0x1b7a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b7a('0x5'))['db'];var utils=require(_0x1b7a('0x6'));var logger=require('../../config/logger')(_0x1b7a('0x7'));var config=require(_0x1b7a('0x8'));var jayson=require(_0x1b7a('0x9'));var client=jayson['client'][_0x1b7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dcdfe,_0x127b50,_0x1b2c5a){return new BPromise(function(_0x4051e5,_0x334da0){return client[_0x1b7a('0xb')](_0x3dcdfe,_0x1b2c5a)[_0x1b7a('0xc')](function(_0x264839){logger[_0x1b7a('0xd')](_0x1b7a('0xe'),_0x127b50,_0x1b7a('0xf'));logger[_0x1b7a('0x10')](_0x1b7a('0x11'),_0x127b50,_0x1b7a('0xf'),JSON[_0x1b7a('0x12')](_0x264839));if(_0x264839[_0x1b7a('0x13')]){if(_0x264839[_0x1b7a('0x13')]['code']===0x1f4){logger[_0x1b7a('0x13')](_0x1b7a('0xe'),_0x127b50,_0x264839[_0x1b7a('0x13')][_0x1b7a('0x14')]);return _0x334da0(_0x264839[_0x1b7a('0x13')][_0x1b7a('0x14')]);}logger[_0x1b7a('0x13')](_0x1b7a('0xe'),_0x127b50,_0x264839[_0x1b7a('0x13')]['message']);return _0x4051e5(_0x264839[_0x1b7a('0x13')]['message']);}else{logger[_0x1b7a('0xd')](_0x1b7a('0xe'),_0x127b50,_0x1b7a('0xf'));_0x4051e5(_0x264839['result'][_0x1b7a('0x14')]);}})[_0x1b7a('0x15')](function(_0xe3b691){logger[_0x1b7a('0x13')](_0x1b7a('0xe'),_0x127b50,_0xe3b691);_0x334da0(_0xe3b691);});});}exports[_0x1b7a('0x16')]=function(_0x581445){var _0x109c15=this;return new Promise(function(_0x54b877,_0x188f67){return db['WhatsappQueueReport'][_0x1b7a('0x17')](_0x581445[_0x1b7a('0x18')],{'raw':_0x581445[_0x1b7a('0x19')]?_0x581445[_0x1b7a('0x19')][_0x1b7a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x372f74){logger['info']('CreateWhatsappQueueReport',_0x581445);logger[_0x1b7a('0x10')]('CreateWhatsappQueueReport',_0x581445,JSON[_0x1b7a('0x12')](_0x372f74));_0x54b877(_0x372f74);})[_0x1b7a('0x15')](function(_0x441a80){logger[_0x1b7a('0x13')](_0x1b7a('0x16'),_0x441a80[_0x1b7a('0x14')],_0x581445);_0x188f67(_0x109c15[_0x1b7a('0x13')](0x1f4,_0x441a80[_0x1b7a('0x14')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x4894b3){var _0x543bff=this;return new Promise(function(_0x2f6394,_0x505e69){return db[_0x1b7a('0x1b')]['update'](_0x4894b3['body'],{'raw':_0x4894b3['options']?_0x4894b3[_0x1b7a('0x19')][_0x1b7a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4894b3[_0x1b7a('0x19')]?_0x4894b3[_0x1b7a('0x19')][_0x1b7a('0x1c')]||null:null,'attributes':_0x4894b3[_0x1b7a('0x19')]?_0x4894b3['options']['attributes']||null:null,'limit':_0x4894b3[_0x1b7a('0x19')]?_0x4894b3[_0x1b7a('0x19')][_0x1b7a('0x1d')]||null:null})['then'](function(_0x4dd63f){logger['info'](_0x1b7a('0x1e'),_0x4894b3);logger['debug'](_0x1b7a('0x1e'),_0x4894b3,JSON[_0x1b7a('0x12')](_0x4dd63f));_0x2f6394(_0x4dd63f);})['catch'](function(_0x1aa73c){logger[_0x1b7a('0x13')]('UpdateWhatsappQueueReport',_0x1aa73c[_0x1b7a('0x14')],_0x4894b3);_0x505e69(_0x543bff['error'](0x1f4,_0x1aa73c['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 79876d7..f513608 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 _0xa4c2=['multer','path','connect-timeout','express','Router','get','index','isAuthenticated','describe','/:id','show','post','create','update','exports'];(function(_0x1052ca,_0xbdb36c){var _0x541d94=function(_0x305a05){while(--_0x305a05){_0x1052ca['push'](_0x1052ca['shift']());}};_0x541d94(++_0xbdb36c);}(_0xa4c2,0x1d1));var _0x2a4c=function(_0x25dd2f,_0x18884d){_0x25dd2f=_0x25dd2f-0x0;var _0x3a5d9a=_0xa4c2[_0x25dd2f];return _0x3a5d9a;};'use strict';var multer=require(_0x2a4c('0x0'));var util=require('util');var path=require(_0x2a4c('0x1'));var timeout=require(_0x2a4c('0x2'));var express=require(_0x2a4c('0x3'));var router=express[_0x2a4c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappTransferReport.controller');router[_0x2a4c('0x5')]('/',auth['isAuthenticated'](),controller[_0x2a4c('0x6')]);router['get']('/describe',auth[_0x2a4c('0x7')](),controller[_0x2a4c('0x8')]);router[_0x2a4c('0x5')](_0x2a4c('0x9'),auth[_0x2a4c('0x7')](),controller[_0x2a4c('0xa')]);router[_0x2a4c('0xb')]('/',auth[_0x2a4c('0x7')](),controller[_0x2a4c('0xc')]);router['put'](_0x2a4c('0x9'),auth[_0x2a4c('0x7')](),controller[_0x2a4c('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2a4c('0xe')]=router; \ No newline at end of file +var _0x8320=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8320,0x141));var _0x0832=function(_0x1d3791,_0x51c613){_0x1d3791=_0x1d3791-0x0;var _0x40fbf5=_0x8320[_0x1d3791];return _0x40fbf5;};'use strict';var multer=require(_0x0832('0x0'));var util=require(_0x0832('0x1'));var path=require(_0x0832('0x2'));var timeout=require(_0x0832('0x3'));var express=require(_0x0832('0x4'));var router=express[_0x0832('0x5')]();var fs_extra=require(_0x0832('0x6'));var auth=require(_0x0832('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0832('0x8'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0x0832('0x9')](),controller[_0x0832('0xa')]);router[_0x0832('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x0832('0xb')](_0x0832('0xc'),auth[_0x0832('0x9')](),controller[_0x0832('0xd')]);router[_0x0832('0xe')]('/',auth[_0x0832('0x9')](),controller[_0x0832('0xf')]);router[_0x0832('0x10')](_0x0832('0xc'),auth[_0x0832('0x9')](),controller[_0x0832('0x11')]);router[_0x0832('0x12')](_0x0832('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0832('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index e39ff36..bdb6c3d 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 _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x0b0e[_0x2070da];return _0x4f9fe1;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file +var _0x2032=['agent','queue','exports','STRING','ENUM'];(function(_0x46fd98,_0x14a05a){var _0x2108b9=function(_0xbd6a9d){while(--_0xbd6a9d){_0x46fd98['push'](_0x46fd98['shift']());}};_0x2108b9(++_0x14a05a);}(_0x2032,0xd9));var _0x2203=function(_0x2c52ca,_0x3a389c){_0x2c52ca=_0x2c52ca-0x0;var _0x2302a0=_0x2032[_0x2c52ca];return _0x2302a0;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'uniqueid':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2203('0x2')]('account',_0x2203('0x3'),_0x2203('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 29b0bb6..2600db8 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 _0x5221=['type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','includeAll','catch','show','params','keys','rawAttributes','length','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','merge','contact','message','agent','interaction','account','index','map','WhatsappTransferReport','fieldName'];(function(_0x25fa88,_0x1fd063){var _0x1a8ac2=function(_0x46e58e){while(--_0x46e58e){_0x25fa88['push'](_0x25fa88['shift']());}};_0x1a8ac2(++_0x1fd063);}(_0x5221,0x108));var _0x1522=function(_0x4a0176,_0x1d7a94){_0x4a0176=_0x4a0176-0x0;var _0x42796d=_0x5221[_0x4a0176];return _0x42796d;};'use strict';var emlformat=require(_0x1522('0x0'));var rimraf=require(_0x1522('0x1'));var zipdir=require(_0x1522('0x2'));var jsonpatch=require(_0x1522('0x3'));var rp=require(_0x1522('0x4'));var moment=require('moment');var BPromise=require(_0x1522('0x5'));var Mustache=require(_0x1522('0x6'));var util=require('util');var path=require(_0x1522('0x7'));var sox=require(_0x1522('0x8'));var csv=require(_0x1522('0x9'));var ejs=require(_0x1522('0xa'));var fs=require('fs');var fs_extra=require(_0x1522('0xb'));var _=require(_0x1522('0xc'));var squel=require(_0x1522('0xd'));var crypto=require('crypto');var jsforce=require(_0x1522('0xe'));var deskjs=require(_0x1522('0xf'));var toCsv=require(_0x1522('0x9'));var querystring=require(_0x1522('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1522('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1522('0x12'));var hardwareService=require(_0x1522('0x13'));var logger=require('../../config/logger')(_0x1522('0x14'));var utils=require(_0x1522('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1522('0x16'));var db=require(_0x1522('0x17'))['db'];function respondWithStatusCode(_0x11d193,_0x1405f9){_0x1405f9=_0x1405f9||0xcc;return function(_0x2986ce){if(_0x2986ce){return _0x11d193[_0x1522('0x18')](_0x1405f9);}return _0x11d193[_0x1522('0x19')](_0x1405f9)[_0x1522('0x1a')]();};}function respondWithResult(_0x2d9262,_0xec347b){_0xec347b=_0xec347b||0xc8;return function(_0x3ec40f){if(_0x3ec40f){return _0x2d9262[_0x1522('0x19')](_0xec347b)['json'](_0x3ec40f);}};}function respondWithFilteredResult(_0x24a931,_0x2d5d90){return function(_0x3daaef){if(_0x3daaef){var _0x4b9be9=typeof _0x2d5d90[_0x1522('0x1b')]===_0x1522('0x1c')&&typeof _0x2d5d90[_0x1522('0x1d')]===_0x1522('0x1c');var _0xf1593e=_0x3daaef[_0x1522('0x1e')];var _0x169b70=_0x4b9be9?0x0:_0x2d5d90['offset'];var _0xede067=_0x4b9be9?_0x3daaef[_0x1522('0x1e')]:_0x2d5d90[_0x1522('0x1b')]+_0x2d5d90['limit'];var _0x375d57;if(_0xede067>=_0xf1593e){_0xede067=_0xf1593e;_0x375d57=0xc8;}else{_0x375d57=0xce;}_0x24a931[_0x1522('0x19')](_0x375d57);return _0x24a931[_0x1522('0x1f')](_0x1522('0x20'),_0x169b70+'-'+_0xede067+'/'+_0xf1593e)[_0x1522('0x21')](_0x3daaef);}return null;};}function patchUpdates(_0x3ac8bd){return function(_0x4c1790){try{jsonpatch['apply'](_0x4c1790,_0x3ac8bd,!![]);}catch(_0xc9bc9f){return BPromise[_0x1522('0x22')](_0xc9bc9f);}return _0x4c1790[_0x1522('0x23')]();};}function saveUpdates(_0x567776,_0x3fbf37){return function(_0x8d6674){if(_0x8d6674){return _0x8d6674[_0x1522('0x24')](_0x567776)[_0x1522('0x25')](function(_0x24246e){return _0x24246e;});}return null;};}function removeEntity(_0x1af956,_0x3db986){return function(_0x4a5312){if(_0x4a5312){return _0x4a5312[_0x1522('0x26')]()[_0x1522('0x25')](function(){_0x1af956[_0x1522('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cfd01,_0xf17674){return function(_0x4999bb){if(!_0x4999bb){_0x1cfd01['sendStatus'](0x194);}return _0x4999bb;};}function handleError(_0x578fab,_0x69c9fe){_0x69c9fe=_0x69c9fe||0x1f4;return function(_0x2c0c68){logger[_0x1522('0x27')](_0x2c0c68['stack']);if(_0x2c0c68[_0x1522('0x28')]){delete _0x2c0c68[_0x1522('0x28')];}_0x578fab[_0x1522('0x19')](_0x69c9fe)[_0x1522('0x29')](_0x2c0c68);};}function getMustacheRender(_0x2d7131,_0x30e89b){return Mustache['render'](_0x2d7131,_[_0x1522('0x2a')](_0x30e89b['body'],{'contact':_0x30e89b[_0x1522('0x2b')],'message':_0x30e89b[_0x1522('0x2c')],'agent':_0x30e89b[_0x1522('0x2d')],'interaction':_0x30e89b[_0x1522('0x2e')],'account':_0x30e89b[_0x1522('0x2f')]}))||'';}exports[_0x1522('0x30')]=function(_0x1e35b1,_0x215eaf){var _0x4837be={},_0x2d1157={},_0x387454={'count':0x0,'rows':[]};var _0x5921ee=_[_0x1522('0x31')](db[_0x1522('0x32')]['rawAttributes'],function(_0x2ac20d){return{'name':_0x2ac20d[_0x1522('0x33')],'type':_0x2ac20d[_0x1522('0x34')][_0x1522('0x35')]};});_0x2d1157['model']=_[_0x1522('0x31')](_0x5921ee,_0x1522('0x28'));_0x2d1157[_0x1522('0x36')]=_['keys'](_0x1e35b1[_0x1522('0x36')]);_0x2d1157[_0x1522('0x37')]=_[_0x1522('0x38')](_0x2d1157[_0x1522('0x39')],_0x2d1157[_0x1522('0x36')]);_0x4837be[_0x1522('0x3a')]=_[_0x1522('0x38')](_0x2d1157[_0x1522('0x39')],qs[_0x1522('0x3b')](_0x1e35b1[_0x1522('0x36')]['fields']));_0x4837be[_0x1522('0x3a')]=_0x4837be['attributes']['length']?_0x4837be[_0x1522('0x3a')]:_0x2d1157[_0x1522('0x39')];if(!_0x1e35b1['query'][_0x1522('0x3c')](_0x1522('0x3d'))){_0x4837be[_0x1522('0x1d')]=qs[_0x1522('0x1d')](_0x1e35b1[_0x1522('0x36')]['limit']);_0x4837be['offset']=qs[_0x1522('0x1b')](_0x1e35b1[_0x1522('0x36')]['offset']);}_0x4837be['order']=qs[_0x1522('0x3e')](_0x1e35b1[_0x1522('0x36')][_0x1522('0x3e')]);_0x4837be[_0x1522('0x3f')]=qs[_0x1522('0x37')](_['pick'](_0x1e35b1['query'],_0x2d1157[_0x1522('0x37')]),_0x5921ee);if(_0x1e35b1[_0x1522('0x36')][_0x1522('0x40')]){_0x4837be[_0x1522('0x3f')]=_['merge'](_0x4837be['where'],{'$or':_[_0x1522('0x31')](_0x5921ee,function(_0x189f5f){if(_0x189f5f[_0x1522('0x34')]!==_0x1522('0x41')){var _0x5e338f={};_0x5e338f[_0x189f5f[_0x1522('0x28')]]={'$like':'%'+_0x1e35b1[_0x1522('0x36')]['filter']+'%'};return _0x5e338f;}})});}_0x4837be=_['merge']({},_0x4837be,_0x1e35b1[_0x1522('0x42')]);var _0x2ce2a8={'where':_0x4837be[_0x1522('0x3f')]};return db[_0x1522('0x32')][_0x1522('0x1e')](_0x2ce2a8)[_0x1522('0x25')](function(_0x13aecd){_0x387454[_0x1522('0x1e')]=_0x13aecd;if(_0x1e35b1[_0x1522('0x36')][_0x1522('0x43')]){_0x4837be['include']=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x4837be);})[_0x1522('0x25')](function(_0x5cc6a2){_0x387454['rows']=_0x5cc6a2;return _0x387454;})[_0x1522('0x25')](respondWithFilteredResult(_0x215eaf,_0x4837be))[_0x1522('0x44')](handleError(_0x215eaf,null));};exports[_0x1522('0x45')]=function(_0x57e68a,_0x2ff1e1){var _0xf66ae2={'raw':!![],'where':{'id':_0x57e68a[_0x1522('0x46')]['id']}},_0x3eac5a={};_0x3eac5a[_0x1522('0x39')]=_[_0x1522('0x47')](db[_0x1522('0x32')][_0x1522('0x48')]);_0x3eac5a['query']=_[_0x1522('0x47')](_0x57e68a[_0x1522('0x36')]);_0x3eac5a[_0x1522('0x37')]=_[_0x1522('0x38')](_0x3eac5a[_0x1522('0x39')],_0x3eac5a[_0x1522('0x36')]);_0xf66ae2[_0x1522('0x3a')]=_['intersection'](_0x3eac5a[_0x1522('0x39')],qs[_0x1522('0x3b')](_0x57e68a[_0x1522('0x36')][_0x1522('0x3b')]));_0xf66ae2[_0x1522('0x3a')]=_0xf66ae2[_0x1522('0x3a')][_0x1522('0x49')]?_0xf66ae2[_0x1522('0x3a')]:_0x3eac5a[_0x1522('0x39')];if(_0x57e68a[_0x1522('0x36')][_0x1522('0x43')]){_0xf66ae2[_0x1522('0x4a')]=[{'all':!![]}];}_0xf66ae2=_[_0x1522('0x2a')]({},_0xf66ae2,_0x57e68a[_0x1522('0x42')]);return db[_0x1522('0x32')]['find'](_0xf66ae2)[_0x1522('0x25')](handleEntityNotFound(_0x2ff1e1,null))[_0x1522('0x25')](respondWithResult(_0x2ff1e1,null))[_0x1522('0x44')](handleError(_0x2ff1e1,null));};exports[_0x1522('0x4b')]=function(_0xaf9e60,_0x5cb7ad){return db['WhatsappTransferReport'][_0x1522('0x4b')](_0xaf9e60[_0x1522('0x4c')],{})['then'](respondWithResult(_0x5cb7ad,0xc9))['catch'](handleError(_0x5cb7ad,null));};exports[_0x1522('0x24')]=function(_0x14dd5a,_0x589ec6){if(_0x14dd5a['body']['id']){delete _0x14dd5a[_0x1522('0x4c')]['id'];}return db[_0x1522('0x32')][_0x1522('0x4d')]({'where':{'id':_0x14dd5a[_0x1522('0x46')]['id']}})['then'](handleEntityNotFound(_0x589ec6,null))[_0x1522('0x25')](saveUpdates(_0x14dd5a['body'],null))[_0x1522('0x25')](respondWithResult(_0x589ec6,null))[_0x1522('0x44')](handleError(_0x589ec6,null));};exports[_0x1522('0x26')]=function(_0xb1d36b,_0x1f2574){return db[_0x1522('0x32')]['find']({'where':{'id':_0xb1d36b[_0x1522('0x46')]['id']}})[_0x1522('0x25')](handleEntityNotFound(_0x1f2574,null))[_0x1522('0x25')](removeEntity(_0x1f2574,null))['catch'](handleError(_0x1f2574,null));};exports[_0x1522('0x4e')]=function(_0x2ffe02,_0x27fcbe){return db[_0x1522('0x32')][_0x1522('0x4e')]()[_0x1522('0x25')](respondWithResult(_0x27fcbe,null))[_0x1522('0x44')](handleError(_0x27fcbe,null));}; \ No newline at end of file +var _0xff2f=['../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','destroy','then','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','WhatsappTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','catch','create','update','params','describe','eml-format','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x3bc391,_0x34b959){var _0x4063b7=function(_0x1d0054){while(--_0x1d0054){_0x3bc391['push'](_0x3bc391['shift']());}};_0x4063b7(++_0x34b959);}(_0xff2f,0xd8));var _0xfff2=function(_0x38ac44,_0x38c414){_0x38ac44=_0x38ac44-0x0;var _0x42e9ae=_0xff2f[_0x38ac44];return _0x42e9ae;};'use strict';var emlformat=require(_0xfff2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfff2('0x1'));var moment=require(_0xfff2('0x2'));var BPromise=require(_0xfff2('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfff2('0x4'));var sox=require(_0xfff2('0x5'));var csv=require(_0xfff2('0x6'));var ejs=require(_0xfff2('0x7'));var fs=require('fs');var fs_extra=require(_0xfff2('0x8'));var _=require(_0xfff2('0x9'));var squel=require(_0xfff2('0xa'));var crypto=require(_0xfff2('0xb'));var jsforce=require(_0xfff2('0xc'));var deskjs=require(_0xfff2('0xd'));var toCsv=require(_0xfff2('0x6'));var querystring=require('querystring');var Papa=require(_0xfff2('0xe'));var Redis=require(_0xfff2('0xf'));var authService=require(_0xfff2('0x10'));var qs=require(_0xfff2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfff2('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xfff2('0x13'));var config=require(_0xfff2('0x14'));var licenseUtil=require(_0xfff2('0x15'));var db=require(_0xfff2('0x16'))['db'];function respondWithStatusCode(_0x430dd0,_0x303678){_0x303678=_0x303678||0xcc;return function(_0x31b0b6){if(_0x31b0b6){return _0x430dd0['sendStatus'](_0x303678);}return _0x430dd0[_0xfff2('0x17')](_0x303678)[_0xfff2('0x18')]();};}function respondWithResult(_0x577b0a,_0x3bd26f){_0x3bd26f=_0x3bd26f||0xc8;return function(_0x583905){if(_0x583905){return _0x577b0a[_0xfff2('0x17')](_0x3bd26f)['json'](_0x583905);}};}function respondWithFilteredResult(_0x616dcb,_0x41f366){return function(_0x5297e4){if(_0x5297e4){var _0x553311=typeof _0x41f366['offset']==='undefined'&&typeof _0x41f366['limit']==='undefined';var _0x189cb3=_0x5297e4[_0xfff2('0x19')];var _0x3bc52c=_0x553311?0x0:_0x41f366['offset'];var _0x22a210=_0x553311?_0x5297e4[_0xfff2('0x19')]:_0x41f366[_0xfff2('0x1a')]+_0x41f366[_0xfff2('0x1b')];var _0x4440ee;if(_0x22a210>=_0x189cb3){_0x22a210=_0x189cb3;_0x4440ee=0xc8;}else{_0x4440ee=0xce;}_0x616dcb[_0xfff2('0x17')](_0x4440ee);return _0x616dcb[_0xfff2('0x1c')](_0xfff2('0x1d'),_0x3bc52c+'-'+_0x22a210+'/'+_0x189cb3)[_0xfff2('0x1e')](_0x5297e4);}return null;};}function patchUpdates(_0xc78e5){return function(_0x3ce12c){try{jsonpatch['apply'](_0x3ce12c,_0xc78e5,!![]);}catch(_0x513c42){return BPromise[_0xfff2('0x1f')](_0x513c42);}return _0x3ce12c['save']();};}function saveUpdates(_0xbb1d3c,_0x103b17){return function(_0x3e8e6e){if(_0x3e8e6e){return _0x3e8e6e['update'](_0xbb1d3c)['then'](function(_0x336dfc){return _0x336dfc;});}return null;};}function removeEntity(_0x5eb5dd,_0x3305b5){return function(_0x31faff){if(_0x31faff){return _0x31faff[_0xfff2('0x20')]()[_0xfff2('0x21')](function(){_0x5eb5dd[_0xfff2('0x17')](0xcc)[_0xfff2('0x18')]();});}};}function handleEntityNotFound(_0x3fa613,_0x4257e6){return function(_0x572768){if(!_0x572768){_0x3fa613['sendStatus'](0x194);}return _0x572768;};}function handleError(_0x2901b8,_0x18476e){_0x18476e=_0x18476e||0x1f4;return function(_0xbad814){logger[_0xfff2('0x22')](_0xbad814[_0xfff2('0x23')]);if(_0xbad814[_0xfff2('0x24')]){delete _0xbad814[_0xfff2('0x24')];}_0x2901b8['status'](_0x18476e)[_0xfff2('0x25')](_0xbad814);};}function getMustacheRender(_0x35edd3,_0x2490e4){return Mustache[_0xfff2('0x26')](_0x35edd3,_[_0xfff2('0x27')](_0x2490e4[_0xfff2('0x28')],{'contact':_0x2490e4[_0xfff2('0x29')],'message':_0x2490e4[_0xfff2('0x2a')],'agent':_0x2490e4[_0xfff2('0x2b')],'interaction':_0x2490e4[_0xfff2('0x2c')],'account':_0x2490e4[_0xfff2('0x2d')]}))||'';}exports[_0xfff2('0x2e')]=function(_0xa4a4c8,_0x1396d3){var _0x34cec7={},_0x216f80={},_0x2a5f6f={'count':0x0,'rows':[]};var _0x976787=_[_0xfff2('0x2f')](db[_0xfff2('0x30')][_0xfff2('0x31')],function(_0x2d5f50){return{'name':_0x2d5f50['fieldName'],'type':_0x2d5f50[_0xfff2('0x32')][_0xfff2('0x33')]};});_0x216f80[_0xfff2('0x34')]=_[_0xfff2('0x2f')](_0x976787,_0xfff2('0x24'));_0x216f80[_0xfff2('0x35')]=_[_0xfff2('0x36')](_0xa4a4c8[_0xfff2('0x35')]);_0x216f80[_0xfff2('0x37')]=_[_0xfff2('0x38')](_0x216f80['model'],_0x216f80[_0xfff2('0x35')]);_0x34cec7[_0xfff2('0x39')]=_[_0xfff2('0x38')](_0x216f80[_0xfff2('0x34')],qs[_0xfff2('0x3a')](_0xa4a4c8['query'][_0xfff2('0x3a')]));_0x34cec7[_0xfff2('0x39')]=_0x34cec7[_0xfff2('0x39')]['length']?_0x34cec7[_0xfff2('0x39')]:_0x216f80[_0xfff2('0x34')];if(!_0xa4a4c8[_0xfff2('0x35')][_0xfff2('0x3b')](_0xfff2('0x3c'))){_0x34cec7['limit']=qs[_0xfff2('0x1b')](_0xa4a4c8[_0xfff2('0x35')][_0xfff2('0x1b')]);_0x34cec7[_0xfff2('0x1a')]=qs[_0xfff2('0x1a')](_0xa4a4c8['query'][_0xfff2('0x1a')]);}_0x34cec7['order']=qs[_0xfff2('0x3d')](_0xa4a4c8[_0xfff2('0x35')]['sort']);_0x34cec7[_0xfff2('0x3e')]=qs[_0xfff2('0x37')](_[_0xfff2('0x3f')](_0xa4a4c8[_0xfff2('0x35')],_0x216f80[_0xfff2('0x37')]),_0x976787);if(_0xa4a4c8[_0xfff2('0x35')][_0xfff2('0x40')]){_0x34cec7[_0xfff2('0x3e')]=_[_0xfff2('0x27')](_0x34cec7['where'],{'$or':_[_0xfff2('0x2f')](_0x976787,function(_0x10e274){if(_0x10e274['type']!==_0xfff2('0x41')){var _0x4ebe85={};_0x4ebe85[_0x10e274[_0xfff2('0x24')]]={'$like':'%'+_0xa4a4c8[_0xfff2('0x35')]['filter']+'%'};return _0x4ebe85;}})});}_0x34cec7=_[_0xfff2('0x27')]({},_0x34cec7,_0xa4a4c8[_0xfff2('0x42')]);var _0x41d19a={'where':_0x34cec7[_0xfff2('0x3e')]};return db['WhatsappTransferReport'][_0xfff2('0x19')](_0x41d19a)['then'](function(_0x1a1200){_0x2a5f6f[_0xfff2('0x19')]=_0x1a1200;if(_0xa4a4c8[_0xfff2('0x35')][_0xfff2('0x43')]){_0x34cec7[_0xfff2('0x44')]=[{'all':!![]}];}return db[_0xfff2('0x30')][_0xfff2('0x45')](_0x34cec7);})[_0xfff2('0x21')](function(_0x142696){_0x2a5f6f[_0xfff2('0x46')]=_0x142696;return _0x2a5f6f;})['then'](respondWithFilteredResult(_0x1396d3,_0x34cec7))['catch'](handleError(_0x1396d3,null));};exports[_0xfff2('0x47')]=function(_0x2900e9,_0x2aa031){var _0x55b613={'raw':!![],'where':{'id':_0x2900e9['params']['id']}},_0x1da341={};_0x1da341[_0xfff2('0x34')]=_[_0xfff2('0x36')](db['WhatsappTransferReport']['rawAttributes']);_0x1da341[_0xfff2('0x35')]=_[_0xfff2('0x36')](_0x2900e9['query']);_0x1da341[_0xfff2('0x37')]=_[_0xfff2('0x38')](_0x1da341[_0xfff2('0x34')],_0x1da341[_0xfff2('0x35')]);_0x55b613[_0xfff2('0x39')]=_['intersection'](_0x1da341[_0xfff2('0x34')],qs[_0xfff2('0x3a')](_0x2900e9[_0xfff2('0x35')][_0xfff2('0x3a')]));_0x55b613['attributes']=_0x55b613[_0xfff2('0x39')][_0xfff2('0x48')]?_0x55b613[_0xfff2('0x39')]:_0x1da341[_0xfff2('0x34')];if(_0x2900e9['query'][_0xfff2('0x43')]){_0x55b613[_0xfff2('0x44')]=[{'all':!![]}];}_0x55b613=_[_0xfff2('0x27')]({},_0x55b613,_0x2900e9['options']);return db['WhatsappTransferReport'][_0xfff2('0x49')](_0x55b613)[_0xfff2('0x21')](handleEntityNotFound(_0x2aa031,null))[_0xfff2('0x21')](respondWithResult(_0x2aa031,null))[_0xfff2('0x4a')](handleError(_0x2aa031,null));};exports[_0xfff2('0x4b')]=function(_0x38717f,_0x435873){return db[_0xfff2('0x30')][_0xfff2('0x4b')](_0x38717f[_0xfff2('0x28')],{})[_0xfff2('0x21')](respondWithResult(_0x435873,0xc9))[_0xfff2('0x4a')](handleError(_0x435873,null));};exports[_0xfff2('0x4c')]=function(_0x49554d,_0x9ea28){if(_0x49554d[_0xfff2('0x28')]['id']){delete _0x49554d[_0xfff2('0x28')]['id'];}return db[_0xfff2('0x30')][_0xfff2('0x49')]({'where':{'id':_0x49554d[_0xfff2('0x4d')]['id']}})[_0xfff2('0x21')](handleEntityNotFound(_0x9ea28,null))[_0xfff2('0x21')](saveUpdates(_0x49554d[_0xfff2('0x28')],null))['then'](respondWithResult(_0x9ea28,null))[_0xfff2('0x4a')](handleError(_0x9ea28,null));};exports[_0xfff2('0x20')]=function(_0x2ebf78,_0x1c6ad7){return db[_0xfff2('0x30')][_0xfff2('0x49')]({'where':{'id':_0x2ebf78['params']['id']}})['then'](handleEntityNotFound(_0x1c6ad7,null))[_0xfff2('0x21')](removeEntity(_0x1c6ad7,null))[_0xfff2('0x4a')](handleError(_0x1c6ad7,null));};exports['describe']=function(_0x453f30,_0x42d9c0){return db[_0xfff2('0x30')][_0xfff2('0x4e')]()[_0xfff2('0x21')](respondWithResult(_0x42d9c0,null))['catch'](handleError(_0x42d9c0,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 8ba9bfe..d0cfc3c 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 _0x18f9=['WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x521d41,_0x132696){var _0x26dc7c=function(_0xc343c7){while(--_0xc343c7){_0x521d41['push'](_0x521d41['shift']());}};_0x26dc7c(++_0x132696);}(_0x18f9,0xb7));var _0x918f=function(_0x1c4866,_0x255b66){_0x1c4866=_0x1c4866-0x0;var _0x4239e6=_0x18f9[_0x1c4866];return _0x4239e6;};'use strict';var _=require(_0x918f('0x0'));var util=require(_0x918f('0x1'));var logger=require(_0x918f('0x2'))('api');var moment=require(_0x918f('0x3'));var BPromise=require(_0x918f('0x4'));var rp=require(_0x918f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x918f('0x6'));var config=require(_0x918f('0x7'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x2c05a7,_0x242775){return _0x2c05a7[_0x918f('0x8')](_0x918f('0x9'),attributes,{'tableName':_0x918f('0xa'),'paranoid':![],'indexes':[{'name':_0x918f('0xb'),'fields':[_0x918f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe36f=['rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','../../config/logger','api','moment','path'];(function(_0x28fe98,_0x36592a){var _0x3b482d=function(_0x30405c){while(--_0x30405c){_0x28fe98['push'](_0x28fe98['shift']());}};_0x3b482d(++_0x36592a);}(_0xe36f,0xac));var _0xfe36=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe36f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfe36('0x0'))(_0xfe36('0x1'));var moment=require(_0xfe36('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe36('0x3'));var rimraf=require(_0xfe36('0x4'));var config=require(_0xfe36('0x5'));var attributes=require(_0xfe36('0x6'));module[_0xfe36('0x7')]=function(_0x3c3ee8,_0x5a9e49){return _0x3c3ee8[_0xfe36('0x8')](_0xfe36('0x9'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xfe36('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index a320b73..d8f1c4a 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3731dc,_0x498a8a){var _0x229118=function(_0x251cfe){while(--_0x251cfe){_0x3731dc['push'](_0x3731dc['shift']());}};_0x229118(++_0x498a8a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x9b8927,_0x1caaa7){var _0x13afbc=function(_0x24fc88){while(--_0x24fc88){_0x9b8927['push'](_0x9b8927['shift']());}};_0x13afbc(++_0x1caaa7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 4770255..2eb84c9 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2015=['Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','status','seedDB','default','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','listen','info','start'];(function(_0x121b1a,_0x42fdb7){var _0x2d89a6=function(_0x1b6027){while(--_0x1b6027){_0x121b1a['push'](_0x121b1a['shift']());}};_0x2d89a6(++_0x42fdb7);}(_0x2015,0x193));var _0x5201=function(_0x22069a,_0x58b730){_0x22069a=_0x22069a-0x0;var _0x4f1d0d=_0x2015[_0x22069a];return _0x4f1d0d;};'use strict';var _=require(_0x5201('0x0'));var mysqldb=require(_0x5201('0x1'));var rpc=require(_0x5201('0x2'));var config=require(_0x5201('0x3'));var logger=require(_0x5201('0x4'))(_0x5201('0x5'));var pm2=require(_0x5201('0x6'));var pm2Config=require(_0x5201('0x7'));var schedule=require('./config/schedule');var chat=require(_0x5201('0x8'));var whatsapp=require(_0x5201('0x9'));var transcribe=require(_0x5201('0xa'));function main(){return mysqldb['db'][_0x5201('0xb')][_0x5201('0xc')]()[_0x5201('0xd')](function(){return rpc[_0x5201('0xe')]();})[_0x5201('0xd')](function(_0x15367c){logger[_0x5201('0xf')](_0x15367c);return chat['start']();})[_0x5201('0xd')](function(){return whatsapp[_0x5201('0x10')]();})['then'](function(){return schedule[_0x5201('0x10')]();})[_0x5201('0xd')](function(){return transcribe[_0x5201('0x10')]();})['then'](function(_0x129e16){logger[_0x5201('0xf')](_0x129e16);return pm2[_0x5201('0x10')](pm2Config);})[_0x5201('0xd')](function(_0x2cfa0a){logger[_0x5201('0xf')](_0x5201('0x11'),_[_0x5201('0x12')](_[_0x5201('0x13')](_0x2cfa0a,{'status':_0x5201('0x14')}),_0x5201('0x15'))[_0x5201('0x16')]());logger['info'](_0x5201('0x17'),_[_0x5201('0x12')](_['filter'](_0x2cfa0a,function(_0x55562c){return _0x55562c[_0x5201('0x18')]!==_0x5201('0x14');}),_0x5201('0x15'))['join']()||'None');config[_0x5201('0x19')]&&require('./config/seedDB')[_0x5201('0x1a')]();require('./config/license')[_0x5201('0x1a')]();})['catch'](function(_0x2a5643){logger[_0x5201('0x1b')](_0x5201('0x1c'),_0x2a5643);process[_0x5201('0x1d')](0x1);});}main(); \ No newline at end of file +var _0x235b=['lodash','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','then','listen','info','start','map','online','name','join','Offline\x20apps:','filter','status','None','seedDB','./config/seedDB','default','./config/license','catch','error','exit'];(function(_0x3d256b,_0x3ea550){var _0x3c5076=function(_0x5e0b1c){while(--_0x5e0b1c){_0x3d256b['push'](_0x3d256b['shift']());}};_0x3c5076(++_0x3ea550);}(_0x235b,0x1ed));var _0xb235=function(_0x4422f4,_0x195737){_0x4422f4=_0x4422f4-0x0;var _0x1bfde1=_0x235b[_0x4422f4];return _0x1bfde1;};'use strict';var _=require(_0xb235('0x0'));var mysqldb=require('./mysqldb');var rpc=require('./rpc');var config=require(_0xb235('0x1'));var logger=require(_0xb235('0x2'))(_0xb235('0x3'));var pm2=require(_0xb235('0x4'));var pm2Config=require(_0xb235('0x5'));var schedule=require(_0xb235('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xb235('0x7'));var transcribe=require(_0xb235('0x8'));function main(){return mysqldb['db'][_0xb235('0x9')]['sync']()[_0xb235('0xa')](function(){return rpc[_0xb235('0xb')]();})[_0xb235('0xa')](function(_0x436d63){logger[_0xb235('0xc')](_0x436d63);return chat['start']();})['then'](function(){return whatsapp[_0xb235('0xd')]();})[_0xb235('0xa')](function(){return schedule[_0xb235('0xd')]();})[_0xb235('0xa')](function(){return transcribe[_0xb235('0xd')]();})[_0xb235('0xa')](function(_0x369bf6){logger[_0xb235('0xc')](_0x369bf6);return pm2['start'](pm2Config);})[_0xb235('0xa')](function(_0x289582){logger[_0xb235('0xc')]('Online\x20apps:',_[_0xb235('0xe')](_['filter'](_0x289582,{'status':_0xb235('0xf')}),_0xb235('0x10'))[_0xb235('0x11')]());logger[_0xb235('0xc')](_0xb235('0x12'),_[_0xb235('0xe')](_[_0xb235('0x13')](_0x289582,function(_0x53b15a){return _0x53b15a[_0xb235('0x14')]!==_0xb235('0xf');}),_0xb235('0x10'))[_0xb235('0x11')]()||_0xb235('0x15'));config[_0xb235('0x16')]&&require(_0xb235('0x17'))[_0xb235('0x18')]();require(_0xb235('0x19'))[_0xb235('0x18')]();})[_0xb235('0x1a')](function(_0x1b9eae){logger[_0xb235('0x1b')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x1b9eae);process[_0xb235('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 9314113..96a5338 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 _0xf122=['length','splice','join','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','crypto','util','moment','secrets','session','fullname','internal','permissions','md5secret','voicePause','chatPause','faxPause','openchannelPause','showWebBar','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','downloadVoiceRecordings','isAuthenticated','use','user','ChatInteraction','findOne','disposition','closed','status','unmanaged','json','Unmanaged.','catch','headers','authorization','Basic','find','name','then','authenticate','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','sub','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','User\x20not\x20found.','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.'];(function(_0x23d4a1,_0x3e7290){var _0x252bc1=function(_0x2bf96a){while(--_0x2bf96a){_0x23d4a1['push'](_0x23d4a1['shift']());}};_0x252bc1(++_0x3e7290);}(_0xf122,0x1e2));var _0x2f12=function(_0x3c542d,_0x32df6a){_0x3c542d=_0x3c542d-0x0;var _0x4f58f9=_0xf122[_0x3c542d];return _0x4f58f9;};'use strict';var db=require(_0x2f12('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x2f12('0x1'));var licenseUtil=require(_0x2f12('0x2'));var encryptor=require(_0x2f12('0x3'));var _=require(_0x2f12('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x2f12('0x5'));var compose=require(_0x2f12('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0x2f12('0x7'));var BPromise=require('bluebird');var util=require(_0x2f12('0x8'));var moment=require(_0x2f12('0x9'));var validateJwt=expressJwt({'secret':config[_0x2f12('0xa')][_0x2f12('0xb')]});var userAttributes=['id','role',_0x2f12('0xc'),'name',_0x2f12('0xd'),'email','userpic',_0x2f12('0xe'),_0x2f12('0xf'),_0x2f12('0x10'),_0x2f12('0x11'),'mailPause',_0x2f12('0x12'),'smsPause',_0x2f12('0x13'),'pauseType',_0x2f12('0x14'),'lastLoginAt',_0x2f12('0x15'),_0x2f12('0x16'),_0x2f12('0x17'),'passwordResetAt',_0x2f12('0x18'),_0x2f12('0x19'),'phoneBarAutoAnswerDelay',_0x2f12('0x1a'),_0x2f12('0x1b'),'phoneBarEnableDtmfTone',_0x2f12('0x1c'),_0x2f12('0x1d'),_0x2f12('0x1e'),'phoneBarRemoteControl',_0x2f12('0x1f'),_0x2f12('0x20'),_0x2f12('0x21'),'userProfileId',_0x2f12('0x22'),_0x2f12('0x23'),'wssPort',_0x2f12('0x24'),'downloadOmnichannelInteractions','downloadAttachments'];exports['isChatInteractionAuthorized']=function(){return this[_0x2f12('0x25')](!![])[_0x2f12('0x26')](function(_0x94d390,_0x862bb1,_0x5a6b86){if(_0x94d390[_0x2f12('0x27')]){_0x5a6b86();}else{return db[_0x2f12('0x28')][_0x2f12('0x29')]({'where':{'id':_0x94d390['params']['id']},'attributes':['id','closed',_0x2f12('0x2a')],'raw':!![]})['then'](function(_0x4e6851){if(_0x4e6851&&_0x4e6851[_0x2f12('0x2b')]){return _0x862bb1[_0x2f12('0x2c')](_0x4e6851['disposition']===_0x2f12('0x2d')?0x195:0x193)[_0x2f12('0x2e')]({'message':_0x4e6851[_0x2f12('0x2a')]===_0x2f12('0x2d')?_0x2f12('0x2f'):'Forbidden.'});}else{_0x5a6b86();}})[_0x2f12('0x30')](function(_0x34384b){_0x5a6b86(_0x34384b);});}});};exports[_0x2f12('0x25')]=function isAuthenticated(_0x35b97e){return compose()[_0x2f12('0x26')](function(_0x3d3a97,_0xf49858,_0x2a523b){var _0x3a0d8e;if(_0x3d3a97[_0x2f12('0x31')][_0x2f12('0x32')]){if(_['startsWith'](_0x3d3a97[_0x2f12('0x31')]['authorization'],_0x2f12('0x33'))){var _0x37602b=basicAuth(_0x3d3a97);db['User'][_0x2f12('0x34')]({'where':{'name':_0x37602b[_0x2f12('0x35')]}})[_0x2f12('0x36')](function(_0x256d57){if(!_0x256d57||!_0x256d57[_0x2f12('0x37')](_0x37602b['pass'])){return _0xf49858[_0x2f12('0x2c')](0x191)[_0x2f12('0x2e')]({'message':_0x2f12('0x38')});}_0x3d3a97[_0x2f12('0x27')]={'id':_0x256d57['id']};_0x2a523b();})[_0x2f12('0x30')](function(_0x542570){_0x2a523b(_0x542570);});}else if(_[_0x2f12('0x39')](_0x3d3a97[_0x2f12('0x31')][_0x2f12('0x32')],_0x2f12('0x3a'))){validateJwt(_0x3d3a97,_0xf49858,_0x2a523b);}else{if(_0x35b97e){_0x2a523b();}else{return _0xf49858['status'](0x193)['json']({'message':_0x2f12('0x3b')});}}}else if(_0x3d3a97[_0x2f12('0x3c')][_0x2f12('0x3d')]){try{var _0x17e627={'audience':hardwareConf[_0x2f12('0x3e')](),'issuer':hardwareConf[_0x2f12('0x3e')]()};verifyJwt(_0x3d3a97['query'][_0x2f12('0x3d')],_0x17e627)[_0x2f12('0x36')](function(_0x3d6b84){return db[_0x2f12('0x3f')][_0x2f12('0x34')]({'where':{'id':_0x3d6b84[_0x2f12('0x40')]}})[_0x2f12('0x36')](function(_0x80c243){_0x3a0d8e=_0x80c243;return db['Setting'][_0x2f12('0x29')]({'where':{'id':0x1},'attributes':[_0x2f12('0x41'),_0x2f12('0x42')],'raw':!![]});})['then'](function(_0x18fbb6){if(!_0x3a0d8e||!_[_0x2f12('0x43')](_0x3a0d8e[_0x2f12('0x44')],_0x3d6b84['nonce'])){return _0xf49858[_0x2f12('0x2c')](0x191)[_0x2f12('0x2e')]({'message':_0x2f12('0x45')});}if(_0x3a0d8e[_0x2f12('0x46')]){return _0xf49858[_0x2f12('0x2c')](0x191)['json']({'message':_0x2f12('0x47')});}if(_0x3a0d8e[_0x2f12('0x48')]){if(_0x18fbb6['blockDuration']>0x0){if(moment(_0x3a0d8e[_0x2f12('0x49')])[_0x2f12('0x4a')](_0x18fbb6[_0x2f12('0x42')],'minutes')>moment()){return _0xf49858[_0x2f12('0x2c')](0x191)[_0x2f12('0x2e')]({'message':_0x2f12('0x47')});}}else{return _0xf49858[_0x2f12('0x2c')](0x191)[_0x2f12('0x2e')]({'message':_0x2f12('0x47')});}}_0x3d3a97[_0x2f12('0x27')]={'id':_0x3a0d8e['id']};_0x2a523b();});})[_0x2f12('0x30')](function(){return _0xf49858[_0x2f12('0x2c')](0x191)[_0x2f12('0x2e')]({'message':_0x2f12('0x47')});});}catch(_0x56113d){_0x2a523b(_0x56113d);}}else if(_0x35b97e){_0x2a523b();}else{return _0xf49858['status'](0x193)[_0x2f12('0x2e')]({'message':_0x2f12('0x3b')});}})[_0x2f12('0x26')](function(_0x2fa978,_0x5023b2,_0x29a38c){if(_0x2fa978['user']){db['User'][_0x2f12('0x34')]({'where':{'id':_0x2fa978[_0x2f12('0x27')]['id']},'attributes':userAttributes})[_0x2f12('0x36')](function(_0x1b5dc0){if(!_0x1b5dc0){return _0x5023b2[_0x2f12('0x2c')](0x194)[_0x2f12('0x2e')]({'message':_0x2f12('0x4b')});}_0x2fa978[_0x2f12('0x27')]=_0x1b5dc0;_0x29a38c();})['catch'](function(_0x20a1ee){_0x29a38c(_0x20a1ee);});}else if(_0x35b97e){_0x29a38c();}else{return _0x5023b2['status'](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x2f12('0x26')](function(_0x50626c,_0x13b94d,_0x4bfda4){return licenseUtil[_0x2f12('0x4c')]()['then'](function(_0x2931e7){if(_0x2931e7['update']){_0x4bfda4();}else{return _0x13b94d['status'](0x193)[_0x2f12('0x2e')]({'message':_0x2f12('0x4d')});}})['catch'](function(_0x45f7e5){_0x4bfda4(_0x45f7e5);});});};exports[_0x2f12('0x4e')]=function(_0x496272,_0x4986a0,_0x422e7e){_0x496272[_0x2f12('0x4e')]=!![];return _0x422e7e();};exports[_0x2f12('0x4f')]=function signToken(_0x4c5afc){return signJwt(_0x4c5afc);};exports[_0x2f12('0x50')]=function(_0x3a08a2,_0x4bcfb9){if(!_0x3a08a2[_0x2f12('0x27')]){return _0x4bcfb9['status'](0x194)[_0x2f12('0x2e')]({'message':_0x2f12('0x51')});}var _0x1bd8c3={'payload':{'id':_0x3a08a2[_0x2f12('0x27')]['id'],'role':_0x3a08a2[_0x2f12('0x27')][_0x2f12('0x52')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1bd8c3)['then'](function(_0x3fca99){_0x4bcfb9[_0x2f12('0x53')](_0x2f12('0x54'),_0x3fca99);_0x4bcfb9[_0x2f12('0x55')](_0x2f12('0x56'));})[_0x2f12('0x30')](function(_0x9d69b7){return _0x4bcfb9[_0x2f12('0x2c')](0x1f4)[_0x2f12('0x57')](_0x9d69b7);});};exports[_0x2f12('0x58')]=function(_0x42980d){if(_['isNil'](_0x42980d[_0x2f12('0x44')])||_[_0x2f12('0x59')](_0x42980d[_0x2f12('0x5a')])){return null;}else{return createJwt(_0x42980d);}};exports[_0x2f12('0x5b')]=function(_0x2c4f73){_0x2c4f73[_0x2f12('0x44')]=generateNonce();_0x2c4f73['apiKeyIat']=generateIssuedAt();return createJwt(_0x2c4f73);};exports['regenerateApiKey']=function(_0xf497e7,_0x45853a){var _0x43fcdf=_0xf497e7['query'][_0x2f12('0x3d')];if(_0x43fcdf){var _0xf409ba={'nonce':_0x45853a[_0x2f12('0x44')],'iat':_0x45853a[_0x2f12('0x5a')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x2f12('0x3e')]()};return verifyJwt(_0x43fcdf,_0xf409ba)['then'](function(){return generateApiKey(_0x45853a);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x2f12('0x5c')]=function(_0x496f7f){var _0x288e94=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x288e94[_0x2f12('0x5d')](_0x496f7f))throw new db[(_0x2f12('0x5e'))][(_0x2f12('0x5f'))](_0x2f12('0x60'));return;};exports[_0x2f12('0x61')]=function(_0x391b4d,_0x25d6b0,_0x224849){var _0x2daed3=encryptor[_0x2f12('0x62')](_0x25d6b0)[_0x2f12('0x63')](',');for(var _0x30a20d=0x0;_0x30a20d<_0x224849;_0x30a20d++){if(!_0x2daed3[_0x30a20d])break;if(_0x391b4d[_0x2f12('0x64')]()===_0x2daed3[_0x30a20d][_0x2f12('0x64')]()){var _0x4db229=util[_0x2f12('0x65')](_0x2f12('0x66'),_0x224849);if(_0x224849===0x1){_0x4db229='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x2f12('0x5e'))][(_0x2f12('0x5f'))](_0x4db229);}}return;};exports['updatePasswordsHistory']=function(_0x4361dd,_0x543391){var _0x307e14=_0x543391?encryptor[_0x2f12('0x62')](_0x543391)['split'](','):[];if(_0x307e14[_0x2f12('0x67')]===0x5){_0x307e14[_0x2f12('0x68')](-0x1,0x1);}_0x307e14['unshift'](_0x4361dd);return encryptor['encryptString'](_0x307e14[_0x2f12('0x69')](','));};function signJwt(_0x3c223e){var _0x2c64f9=BPromise[_0x2f12('0x6a')](jwt[_0x2f12('0x6b')],{'context':jwt});var _0x35037d=_0x3c223e[_0x2f12('0x6c')]||config[_0x2f12('0xa')][_0x2f12('0xb')];return new BPromise(function(_0x4e3de7,_0x1dab67){_0x2c64f9(_0x3c223e[_0x2f12('0x6d')],_0x35037d,_0x3c223e[_0x2f12('0x6e')])[_0x2f12('0x36')](function(_0x15285a){_0x4e3de7(_0x15285a);})[_0x2f12('0x30')](function(_0x5acac3){_0x1dab67(_0x5acac3);});});}function verifyJwt(_0x58ebd1,_0x1a2b38,_0x37adb8){var _0x473430=BPromise[_0x2f12('0x6a')](jwt[_0x2f12('0x6f')],{'context':jwt});var _0xf98241=_0x37adb8||config[_0x2f12('0xa')][_0x2f12('0xb')];return new BPromise(function(_0x51f73d,_0x220319){_0x473430(_0x58ebd1,_0xf98241,_0x1a2b38)[_0x2f12('0x36')](function(_0x112783){_0x51f73d(_0x112783);})[_0x2f12('0x30')](function(_0x275e98){_0x220319(_0x275e98);});});}function generateNonce(){return crypto[_0x2f12('0x70')](0x10)[_0x2f12('0x71')](_0x2f12('0x72'));}function generateIssuedAt(){return Math[_0x2f12('0x73')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x62f0a9){var _0x5cf2db={'payload':{'iat':_0x62f0a9[_0x2f12('0x5a')],'nonce':_0x62f0a9['apiKeyNonce']},'options':{'algorithm':_0x2f12('0x74'),'subject':_0x62f0a9['id'][_0x2f12('0x71')](),'issuer':hardwareConf[_0x2f12('0x3e')](),'audience':hardwareConf[_0x2f12('0x3e')]()}};return signJwt(_0x5cf2db)['then'](function(_0x57770b){return{'iat':_0x62f0a9[_0x2f12('0x5a')],'nonce':_0x62f0a9[_0x2f12('0x44')],'token':_0x57770b};});} \ No newline at end of file +var _0x0f58=['smsPause','openchannelPause','pauseType','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','json','unmanaged','Unmanaged.','catch','isAuthenticated','headers','authorization','startsWith','Basic','User','pass','Wrong\x20credentials.','Bearer','apikey','getUuid','query','find','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','join','promisify','sign','secret','session','payload','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','name','email','userpic','permissions','md5secret','voicePause','mailPause'];(function(_0x56b50d,_0x2f4d83){var _0x1a732d=function(_0x19b500){while(--_0x19b500){_0x56b50d['push'](_0x56b50d['shift']());}};_0x1a732d(++_0x2f4d83);}(_0x0f58,0x164));var _0x80f5=function(_0xe15934,_0x5439fd){_0xe15934=_0xe15934-0x0;var _0x486c48=_0x0f58[_0xe15934];return _0x486c48;};'use strict';var db=require(_0x80f5('0x0'))['db'];var config=require(_0x80f5('0x1'));var hardwareConf=require(_0x80f5('0x2'));var licenseUtil=require(_0x80f5('0x3'));var encryptor=require(_0x80f5('0x4'));var _=require('lodash');var jwt=require(_0x80f5('0x5'));var expressJwt=require(_0x80f5('0x6'));var compose=require(_0x80f5('0x7'));var basicAuth=require(_0x80f5('0x8'));var crypto=require(_0x80f5('0x9'));var BPromise=require(_0x80f5('0xa'));var util=require(_0x80f5('0xb'));var moment=require(_0x80f5('0xc'));var validateJwt=expressJwt({'secret':config[_0x80f5('0xd')]['session']});var userAttributes=['id',_0x80f5('0xe'),'fullname',_0x80f5('0xf'),'internal',_0x80f5('0x10'),_0x80f5('0x11'),_0x80f5('0x12'),_0x80f5('0x13'),_0x80f5('0x14'),'chatPause',_0x80f5('0x15'),'faxPause',_0x80f5('0x16'),_0x80f5('0x17'),_0x80f5('0x18'),'showWebBar','lastLoginAt','lastPauseAt',_0x80f5('0x19'),_0x80f5('0x1a'),_0x80f5('0x1b'),'alias',_0x80f5('0x1c'),'phoneBarAutoAnswerDelay',_0x80f5('0x1d'),_0x80f5('0x1e'),_0x80f5('0x1f'),_0x80f5('0x20'),_0x80f5('0x21'),_0x80f5('0x22'),_0x80f5('0x23'),_0x80f5('0x24'),_0x80f5('0x25'),_0x80f5('0x26'),_0x80f5('0x27'),_0x80f5('0x28'),_0x80f5('0x29'),'wssPort','downloadVoiceRecordings',_0x80f5('0x2a'),_0x80f5('0x2b')];exports[_0x80f5('0x2c')]=function(){return this['isAuthenticated'](!![])[_0x80f5('0x2d')](function(_0x3f35a7,_0x1f5947,_0x38ecf0){if(_0x3f35a7[_0x80f5('0x2e')]){_0x38ecf0();}else{return db[_0x80f5('0x2f')][_0x80f5('0x30')]({'where':{'id':_0x3f35a7[_0x80f5('0x31')]['id']},'attributes':['id',_0x80f5('0x32'),_0x80f5('0x33')],'raw':!![]})[_0x80f5('0x34')](function(_0x45fdb9){if(_0x45fdb9&&_0x45fdb9['closed']){return _0x1f5947[_0x80f5('0x35')](_0x45fdb9['disposition']==='unmanaged'?0x195:0x193)[_0x80f5('0x36')]({'message':_0x45fdb9[_0x80f5('0x33')]===_0x80f5('0x37')?_0x80f5('0x38'):'Forbidden.'});}else{_0x38ecf0();}})[_0x80f5('0x39')](function(_0x3a1d16){_0x38ecf0(_0x3a1d16);});}});};exports[_0x80f5('0x3a')]=function isAuthenticated(_0xdfb7ad){return compose()[_0x80f5('0x2d')](function(_0x116508,_0x37e2ce,_0x423763){var _0x58668f;if(_0x116508[_0x80f5('0x3b')][_0x80f5('0x3c')]){if(_[_0x80f5('0x3d')](_0x116508[_0x80f5('0x3b')][_0x80f5('0x3c')],_0x80f5('0x3e'))){var _0x4207f9=basicAuth(_0x116508);db[_0x80f5('0x3f')]['find']({'where':{'name':_0x4207f9[_0x80f5('0xf')]}})[_0x80f5('0x34')](function(_0x5ad803){if(!_0x5ad803||!_0x5ad803['authenticate'](_0x4207f9[_0x80f5('0x40')])){return _0x37e2ce[_0x80f5('0x35')](0x191)[_0x80f5('0x36')]({'message':_0x80f5('0x41')});}_0x116508['user']={'id':_0x5ad803['id']};_0x423763();})[_0x80f5('0x39')](function(_0x254fb2){_0x423763(_0x254fb2);});}else if(_[_0x80f5('0x3d')](_0x116508[_0x80f5('0x3b')][_0x80f5('0x3c')],_0x80f5('0x42'))){validateJwt(_0x116508,_0x37e2ce,_0x423763);}else{if(_0xdfb7ad){_0x423763();}else{return _0x37e2ce[_0x80f5('0x35')](0x193)[_0x80f5('0x36')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x116508['query'][_0x80f5('0x43')]){try{var _0x3610b9={'audience':hardwareConf[_0x80f5('0x44')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x116508[_0x80f5('0x45')][_0x80f5('0x43')],_0x3610b9)[_0x80f5('0x34')](function(_0x4b23af){return db[_0x80f5('0x3f')][_0x80f5('0x46')]({'where':{'id':_0x4b23af[_0x80f5('0x47')]}})[_0x80f5('0x34')](function(_0x507a5c){_0x58668f=_0x507a5c;return db[_0x80f5('0x48')][_0x80f5('0x30')]({'where':{'id':0x1},'attributes':[_0x80f5('0x49'),_0x80f5('0x4a')],'raw':!![]});})[_0x80f5('0x34')](function(_0x10a3f2){if(!_0x58668f||!_[_0x80f5('0x4b')](_0x58668f['apiKeyNonce'],_0x4b23af[_0x80f5('0x4c')])){return _0x37e2ce[_0x80f5('0x35')](0x191)[_0x80f5('0x36')]({'message':_0x80f5('0x4d')});}if(_0x58668f[_0x80f5('0x4e')]){return _0x37e2ce[_0x80f5('0x35')](0x191)[_0x80f5('0x36')]({'message':_0x80f5('0x4f')});}if(_0x58668f[_0x80f5('0x50')]){if(_0x10a3f2[_0x80f5('0x4a')]>0x0){if(moment(_0x58668f['blockedAt'])['add'](_0x10a3f2[_0x80f5('0x4a')],_0x80f5('0x51'))>moment()){return _0x37e2ce[_0x80f5('0x35')](0x191)[_0x80f5('0x36')]({'message':_0x80f5('0x4f')});}}else{return _0x37e2ce[_0x80f5('0x35')](0x191)[_0x80f5('0x36')]({'message':_0x80f5('0x4f')});}}_0x116508[_0x80f5('0x2e')]={'id':_0x58668f['id']};_0x423763();});})[_0x80f5('0x39')](function(){return _0x37e2ce[_0x80f5('0x35')](0x191)[_0x80f5('0x36')]({'message':_0x80f5('0x4f')});});}catch(_0x1057b6){_0x423763(_0x1057b6);}}else if(_0xdfb7ad){_0x423763();}else{return _0x37e2ce[_0x80f5('0x35')](0x193)['json']({'message':_0x80f5('0x52')});}})[_0x80f5('0x2d')](function(_0x4ba683,_0xd94a82,_0x1f3438){if(_0x4ba683['user']){db[_0x80f5('0x3f')][_0x80f5('0x46')]({'where':{'id':_0x4ba683[_0x80f5('0x2e')]['id']},'attributes':userAttributes})['then'](function(_0x39caed){if(!_0x39caed){return _0xd94a82[_0x80f5('0x35')](0x194)[_0x80f5('0x36')]({'message':_0x80f5('0x53')});}_0x4ba683[_0x80f5('0x2e')]=_0x39caed;_0x1f3438();})[_0x80f5('0x39')](function(_0x388518){_0x1f3438(_0x388518);});}else if(_0xdfb7ad){_0x1f3438();}else{return _0xd94a82[_0x80f5('0x35')](0x194)[_0x80f5('0x36')]({'message':_0x80f5('0x54')});}});};exports[_0x80f5('0x55')]=function canUpdate(){return compose()[_0x80f5('0x2d')](function(_0x1822ae,_0x12dc7c,_0x21e0cb){return licenseUtil['getLicense']()[_0x80f5('0x34')](function(_0x544dcd){if(_0x544dcd[_0x80f5('0x56')]){_0x21e0cb();}else{return _0x12dc7c[_0x80f5('0x35')](0x193)[_0x80f5('0x36')]({'message':_0x80f5('0x57')});}})['catch'](function(_0x5c69eb){_0x21e0cb(_0x5c69eb);});});};exports[_0x80f5('0x58')]=function(_0x1da06d,_0x4a22e5,_0x321fcf){_0x1da06d[_0x80f5('0x58')]=!![];return _0x321fcf();};exports[_0x80f5('0x59')]=function signToken(_0x3835e2){return signJwt(_0x3835e2);};exports['setTokenCookie']=function(_0x428e85,_0x1570f1){if(!_0x428e85[_0x80f5('0x2e')]){return _0x1570f1[_0x80f5('0x35')](0x194)[_0x80f5('0x36')]({'message':_0x80f5('0x5a')});}var _0x1ad1a9={'payload':{'id':_0x428e85[_0x80f5('0x2e')]['id'],'role':_0x428e85[_0x80f5('0x2e')][_0x80f5('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1ad1a9)[_0x80f5('0x34')](function(_0x4b1897){_0x1570f1[_0x80f5('0x5b')](_0x80f5('0x5c'),_0x4b1897);_0x1570f1['redirect'](_0x80f5('0x5d'));})[_0x80f5('0x39')](function(_0x2e7132){return _0x1570f1[_0x80f5('0x35')](0x1f4)[_0x80f5('0x5e')](_0x2e7132);});};exports['retrieveApiKey']=function(_0x399f76){if(_[_0x80f5('0x5f')](_0x399f76[_0x80f5('0x60')])||_['isNil'](_0x399f76[_0x80f5('0x61')])){return null;}else{return createJwt(_0x399f76);}};exports[_0x80f5('0x62')]=function(_0x4fb838){_0x4fb838[_0x80f5('0x60')]=generateNonce();_0x4fb838[_0x80f5('0x61')]=generateIssuedAt();return createJwt(_0x4fb838);};exports[_0x80f5('0x63')]=function(_0x303c17,_0x833f7){var _0x21abd1=_0x303c17[_0x80f5('0x45')][_0x80f5('0x43')];if(_0x21abd1){var _0x4f28e3={'nonce':_0x833f7[_0x80f5('0x60')],'iat':_0x833f7['apiKeyIat'],'audience':hardwareConf[_0x80f5('0x44')](),'issuer':hardwareConf[_0x80f5('0x44')]()};return verifyJwt(_0x21abd1,_0x4f28e3)[_0x80f5('0x34')](function(){return generateApiKey(_0x833f7);});}else{throw{'message':_0x80f5('0x64')};}};exports[_0x80f5('0x65')]=function(_0x12d3d5){var _0x47c1cb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x47c1cb['test'](_0x12d3d5))throw new db[(_0x80f5('0x66'))][(_0x80f5('0x67'))](_0x80f5('0x68'));return;};exports[_0x80f5('0x69')]=function(_0x5386de,_0x4e4852,_0xe97373){var _0x165129=encryptor[_0x80f5('0x6a')](_0x4e4852)[_0x80f5('0x6b')](',');for(var _0x427393=0x0;_0x427393<_0xe97373;_0x427393++){if(!_0x165129[_0x427393])break;if(_0x5386de[_0x80f5('0x6c')]()===_0x165129[_0x427393]['toLowerCase']()){var _0x7a657=util[_0x80f5('0x6d')](_0x80f5('0x6e'),_0xe97373);if(_0xe97373===0x1){_0x7a657=_0x80f5('0x6f');}throw new db['Sequelize'][(_0x80f5('0x67'))](_0x7a657);}}return;};exports[_0x80f5('0x70')]=function(_0x4af110,_0x1faaf3){var _0x445056=_0x1faaf3?encryptor[_0x80f5('0x6a')](_0x1faaf3)[_0x80f5('0x6b')](','):[];if(_0x445056['length']===0x5){_0x445056['splice'](-0x1,0x1);}_0x445056['unshift'](_0x4af110);return encryptor['encryptString'](_0x445056[_0x80f5('0x71')](','));};function signJwt(_0x2de122){var _0x1d433d=BPromise[_0x80f5('0x72')](jwt[_0x80f5('0x73')],{'context':jwt});var _0x28122f=_0x2de122[_0x80f5('0x74')]||config['secrets'][_0x80f5('0x75')];return new BPromise(function(_0x447767,_0x26388c){_0x1d433d(_0x2de122[_0x80f5('0x76')],_0x28122f,_0x2de122['options'])['then'](function(_0x449965){_0x447767(_0x449965);})[_0x80f5('0x39')](function(_0x289478){_0x26388c(_0x289478);});});}function verifyJwt(_0x4b8791,_0x2a6b08,_0x3b774e){var _0x3615af=BPromise['promisify'](jwt[_0x80f5('0x77')],{'context':jwt});var _0x33fbef=_0x3b774e||config[_0x80f5('0xd')]['session'];return new BPromise(function(_0x4b6676,_0x2a41b7){_0x3615af(_0x4b8791,_0x33fbef,_0x2a6b08)[_0x80f5('0x34')](function(_0x24748b){_0x4b6676(_0x24748b);})['catch'](function(_0x2062f6){_0x2a41b7(_0x2062f6);});});}function generateNonce(){return crypto[_0x80f5('0x78')](0x10)[_0x80f5('0x79')](_0x80f5('0x7a'));}function generateIssuedAt(){return Math[_0x80f5('0x7b')](Date[_0x80f5('0x7c')]()/0x3e8)[_0x80f5('0x79')]();}function createJwt(_0x1ae4d7){var _0x2e0238={'payload':{'iat':_0x1ae4d7[_0x80f5('0x61')],'nonce':_0x1ae4d7[_0x80f5('0x60')]},'options':{'algorithm':_0x80f5('0x7d'),'subject':_0x1ae4d7['id'][_0x80f5('0x79')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x2e0238)['then'](function(_0x14f23){return{'iat':_0x1ae4d7[_0x80f5('0x61')],'nonce':_0x1ae4d7['apiKeyNonce'],'token':_0x14f23};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e044a14..a48d03c 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 _0xd4b7=['data','end','final','binary','write','close','createWriteStream','createDecipher','update','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher'];(function(_0x43550d,_0x72f3e){var _0x578aec=function(_0x49e826){while(--_0x49e826){_0x43550d['push'](_0x43550d['shift']());}};_0x578aec(++_0x72f3e);}(_0xd4b7,0x76));var _0x7d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b7[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0x7d4b('0x0'));var fs=require('fs');var BPromise=require(_0x7d4b('0x1'));var _=require(_0x7d4b('0x2'));var config=require(_0x7d4b('0x3'));var logger=require(_0x7d4b('0x4'))(_0x7d4b('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x7d4b('0x6')][_0x7d4b('0x7')],'algorithm':_0x7d4b('0x8')};const fileOptions={'algorithm':'aes192'};if(config[_0x7d4b('0x9')]&&config[_0x7d4b('0x9')][_0x7d4b('0xa')]){var isSupported=isAlgorithmSupported(config[_0x7d4b('0x9')][_0x7d4b('0xa')]);if(isSupported){fileOptions[_0x7d4b('0xa')]=config[_0x7d4b('0x9')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x7d4b('0xb')](',\x20');logger[_0x7d4b('0xc')](config[_0x7d4b('0x9')]['algorithm'],_0x7d4b('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x32fdd){return AES_SUPPORTED_RX[_0x7d4b('0xe')](_0x32fdd);}function getSupportedCiphers(){return crypto[_0x7d4b('0xf')]()[_0x7d4b('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x18f518){return getSupportedCiphers()[_0x7d4b('0x11')](_0x18f518)>-0x1;}function combineOptions(_0x5112ae){var _0x1a42c4={};for(var _0xd9d83d in fileOptions){if(fileOptions[_0x7d4b('0x12')](_0xd9d83d)){_0x1a42c4[_0xd9d83d]=fileOptions[_0xd9d83d];}}if(_0x5112ae){for(var _0x1bf73e in _0x5112ae){if(_0x5112ae[_0x7d4b('0x12')](_0x1bf73e)){_0x1a42c4[_0x1bf73e]=_0x5112ae[_0x1bf73e];}}}return _0x1a42c4;}exports[_0x7d4b('0x13')]=function(_0x211edb,_0x58ef74,_0x59b4da,_0x5f4673){return new BPromise(function(_0x1e6d29,_0x12d7a3){_0x5f4673=combineOptions(_0x5f4673);var _0xdd0ca=new Buffer(_0x59b4da);var _0x3a93d9=fs[_0x7d4b('0x14')](_0x211edb);var _0x2bddbf=fs['createWriteStream'](_0x58ef74);var _0x2566bf=crypto[_0x7d4b('0x15')](_0x5f4673[_0x7d4b('0xa')],_0xdd0ca);_0x3a93d9['on'](_0x7d4b('0x16'),function(_0x38e9d9){var _0x59ef50=new Buffer(_0x2566bf['update'](_0x38e9d9),'binary');_0x2bddbf['write'](_0x59ef50);});_0x3a93d9['on'](_0x7d4b('0x17'),function(){try{var _0x4f0d86=new Buffer(_0x2566bf[_0x7d4b('0x18')](_0x7d4b('0x19')),_0x7d4b('0x19'));_0x2bddbf[_0x7d4b('0x1a')](_0x4f0d86);_0x2bddbf[_0x7d4b('0x17')]();_0x2bddbf['on'](_0x7d4b('0x1b'),function(){return _0x1e6d29(_0x58ef74);});}catch(_0x3e433e){fs['unlink'](_0x58ef74);return _0x12d7a3(_0x3e433e);}});});};exports['decryptFile']=function(_0x327364,_0x225ae3,_0x4a8419,_0x4dfa76){return new BPromise(function(_0x39a195,_0x5bf9ab){_0x4dfa76=combineOptions(_0x4dfa76);var _0x86e6=new Buffer(_0x4a8419);var _0x5acbf0=fs['createReadStream'](_0x327364);var _0x33e8d2=fs[_0x7d4b('0x1c')](_0x225ae3);var _0x1f065f=crypto[_0x7d4b('0x1d')](_0x4dfa76[_0x7d4b('0xa')],_0x86e6);_0x5acbf0['on'](_0x7d4b('0x16'),function(_0x4300b9){var _0x46bcbd=new Buffer(_0x1f065f[_0x7d4b('0x1e')](_0x4300b9),_0x7d4b('0x19'));_0x33e8d2[_0x7d4b('0x1a')](_0x46bcbd);});_0x5acbf0['on']('end',function(){try{var _0x207c4b=new Buffer(_0x1f065f[_0x7d4b('0x18')](_0x7d4b('0x19')),_0x7d4b('0x19'));_0x33e8d2['write'](_0x207c4b);_0x33e8d2[_0x7d4b('0x17')]();_0x33e8d2['on']('close',function(){return _0x39a195(_0x225ae3);});}catch(_0x29e160){fs['unlink'](_0x225ae3);return _0x5bf9ab(_0x29e160);}});});};exports['encryptString']=function(_0x22d4c7,_0x4e41cd,_0x4d27cd){var _0x5ad667=_0x4d27cd||stringOptions[_0x7d4b('0xa')];var _0x8337ab=_0x4e41cd||stringOptions[_0x7d4b('0x1f')];var _0x13cef2=crypto[_0x7d4b('0x15')](_0x5ad667,_0x8337ab);var _0x65fb1f=_0x13cef2['update'](_0x22d4c7,_0x7d4b('0x20'),'base64');_0x65fb1f+=_0x13cef2[_0x7d4b('0x18')](_0x7d4b('0x21'));return _0x65fb1f;};exports[_0x7d4b('0x22')]=function(_0x1c8bee,_0x356187,_0x72e3be){var _0x5c8868=_0x72e3be||stringOptions['algorithm'];var _0x27ce6d=_0x356187||stringOptions[_0x7d4b('0x1f')];var _0x1595dd=crypto[_0x7d4b('0x1d')](_0x5c8868,_0x27ce6d);var _0x1a9f66=_0x1595dd[_0x7d4b('0x1e')](_0x1c8bee,_0x7d4b('0x21'),_0x7d4b('0x20'));_0x1a9f66+=_0x1595dd['final'](_0x7d4b('0x20'));return _0x1a9f66;}; \ No newline at end of file +var _0xd8e8=['filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','end','binary','close','unlink','decryptFile','createDecipher','write','final','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','app','session','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers'];(function(_0x315114,_0x7aab60){var _0x7d16b7=function(_0x14747a){while(--_0x14747a){_0x315114['push'](_0x315114['shift']());}};_0x7d16b7(++_0x7aab60);}(_0xd8e8,0x13e));var _0x8d8e=function(_0x6009e4,_0x53d114){_0x6009e4=_0x6009e4-0x0;var _0x3c4161=_0xd8e8[_0x6009e4];return _0x3c4161;};'use strict';var crypto=require(_0x8d8e('0x0'));var fs=require('fs');var BPromise=require(_0x8d8e('0x1'));var _=require(_0x8d8e('0x2'));var config=require(_0x8d8e('0x3'));var logger=require('../../config/logger')(_0x8d8e('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x8d8e('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x8d8e('0x6')};if(config[_0x8d8e('0x7')]&&config[_0x8d8e('0x7')][_0x8d8e('0x8')]){var isSupported=isAlgorithmSupported(config[_0x8d8e('0x7')][_0x8d8e('0x8')]);if(isSupported){fileOptions[_0x8d8e('0x8')]=config['encrypt'][_0x8d8e('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x8d8e('0x9')](config[_0x8d8e('0x7')][_0x8d8e('0x8')],_0x8d8e('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x5bcc5e){return AES_SUPPORTED_RX['test'](_0x5bcc5e);}function getSupportedCiphers(){return crypto[_0x8d8e('0xb')]()[_0x8d8e('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x2130d7){return getSupportedCiphers()['indexOf'](_0x2130d7)>-0x1;}function combineOptions(_0x16d690){var _0x3141b9={};for(var _0x256bbd in fileOptions){if(fileOptions[_0x8d8e('0xd')](_0x256bbd)){_0x3141b9[_0x256bbd]=fileOptions[_0x256bbd];}}if(_0x16d690){for(var _0x35b30e in _0x16d690){if(_0x16d690['hasOwnProperty'](_0x35b30e)){_0x3141b9[_0x35b30e]=_0x16d690[_0x35b30e];}}}return _0x3141b9;}exports[_0x8d8e('0xe')]=function(_0x4fd1e2,_0x391340,_0x3f0049,_0x15129b){return new BPromise(function(_0x20c6b2,_0x2fc793){_0x15129b=combineOptions(_0x15129b);var _0x40dc25=new Buffer(_0x3f0049);var _0x5db067=fs[_0x8d8e('0xf')](_0x4fd1e2);var _0x22a926=fs[_0x8d8e('0x10')](_0x391340);var _0x402fd0=crypto[_0x8d8e('0x11')](_0x15129b[_0x8d8e('0x8')],_0x40dc25);_0x5db067['on'](_0x8d8e('0x12'),function(_0xd6e13){var _0x3b2b9c=new Buffer(_0x402fd0[_0x8d8e('0x13')](_0xd6e13),'binary');_0x22a926['write'](_0x3b2b9c);});_0x5db067['on'](_0x8d8e('0x14'),function(){try{var _0x107850=new Buffer(_0x402fd0['final']('binary'),_0x8d8e('0x15'));_0x22a926['write'](_0x107850);_0x22a926[_0x8d8e('0x14')]();_0x22a926['on'](_0x8d8e('0x16'),function(){return _0x20c6b2(_0x391340);});}catch(_0x48a6b9){fs[_0x8d8e('0x17')](_0x391340);return _0x2fc793(_0x48a6b9);}});});};exports[_0x8d8e('0x18')]=function(_0x17c203,_0x115152,_0x311f19,_0x78b349){return new BPromise(function(_0x311424,_0x8bcadc){_0x78b349=combineOptions(_0x78b349);var _0x21a990=new Buffer(_0x311f19);var _0x1f8669=fs[_0x8d8e('0xf')](_0x17c203);var _0x559c66=fs[_0x8d8e('0x10')](_0x115152);var _0xea170f=crypto[_0x8d8e('0x19')](_0x78b349[_0x8d8e('0x8')],_0x21a990);_0x1f8669['on']('data',function(_0x4bf57f){var _0x5dc765=new Buffer(_0xea170f['update'](_0x4bf57f),_0x8d8e('0x15'));_0x559c66[_0x8d8e('0x1a')](_0x5dc765);});_0x1f8669['on'](_0x8d8e('0x14'),function(){try{var _0x5a7df1=new Buffer(_0xea170f[_0x8d8e('0x1b')](_0x8d8e('0x15')),_0x8d8e('0x15'));_0x559c66[_0x8d8e('0x1a')](_0x5a7df1);_0x559c66['end']();_0x559c66['on']('close',function(){return _0x311424(_0x115152);});}catch(_0x46b761){fs['unlink'](_0x115152);return _0x8bcadc(_0x46b761);}});});};exports[_0x8d8e('0x1c')]=function(_0x80a086,_0x12c1b1,_0x486f60){var _0x28f573=_0x486f60||stringOptions[_0x8d8e('0x8')];var _0x139e06=_0x12c1b1||stringOptions[_0x8d8e('0x1d')];var _0x5bd543=crypto[_0x8d8e('0x11')](_0x28f573,_0x139e06);var _0x199c1b=_0x5bd543[_0x8d8e('0x13')](_0x80a086,_0x8d8e('0x1e'),_0x8d8e('0x1f'));_0x199c1b+=_0x5bd543[_0x8d8e('0x1b')](_0x8d8e('0x1f'));return _0x199c1b;};exports[_0x8d8e('0x20')]=function(_0x4f0faa,_0x42a416,_0x22a083){var _0x23677a=_0x22a083||stringOptions['algorithm'];var _0x14771e=_0x42a416||stringOptions[_0x8d8e('0x1d')];var _0x593847=crypto[_0x8d8e('0x19')](_0x23677a,_0x14771e);var _0xdfe0b9=_0x593847[_0x8d8e('0x13')](_0x4f0faa,_0x8d8e('0x1f'),'utf8');_0xdfe0b9+=_0x593847['final']('utf8');return _0xdfe0b9;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 497894a..6ae66f0 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 _0x2b4c=['sequelize','query','format','QueryTypes','SELECT','num','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','length','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','CSV','Completed','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','path','lodash','to-csv','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','savename','update','Setting','find','splitSizeCsv','then'];(function(_0x3a2beb,_0x2198ee){var _0x1c970c=function(_0x5c2fed){while(--_0x5c2fed){_0x3a2beb['push'](_0x3a2beb['shift']());}};_0x1c970c(++_0x2198ee);}(_0x2b4c,0x1a9));var _0xc2b4=function(_0x4b4343,_0x5c5d4e){_0x4b4343=_0x4b4343-0x0;var _0x3d7f47=_0x2b4c[_0x4b4343];return _0x3d7f47;};'use strict';var util=require('util');var path=require(_0xc2b4('0x0'));var _=require(_0xc2b4('0x1'));var csv=require(_0xc2b4('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xc2b4('0x3'));var rimraf=require(_0xc2b4('0x4'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xc2b4('0x5')];var logger=require(_0xc2b4('0x6'))(_0xc2b4('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xc2b4('0x8')][0x2]);var QUERY=process[_0xc2b4('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x31db08,_0x134eea){var _0x5be68d={'status':_0x31db08};var _0x16ff1a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x134eea){_0x5be68d[_0xc2b4('0x9')]=_0x134eea;}return db['AnalyticExtractedReport'][_0xc2b4('0xa')](_0x5be68d,_0x16ff1a);}function main(){var _0x138ca1=0x1388;var _0x5aa156;logger['info'](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0xc2b4('0xb')][_0xc2b4('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xc2b4('0xd')]})['then'](function(_0x1f74a0){if(_0x1f74a0){_0x5aa156=_0x1f74a0;_0x138ca1=_0x5aa156[_0xc2b4('0xd')]||0x1388;}})[_0xc2b4('0xe')](function(){return dbH[_0xc2b4('0xf')][_0xc2b4('0x10')](util[_0xc2b4('0x11')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xc2b4('0xf')][_0xc2b4('0x12')][_0xc2b4('0x13')]});})[_0xc2b4('0xe')](function(_0x59b825){if(!_0x59b825[0x0][_0xc2b4('0x14')]){return analyticExtractedReport('Empty');}var _0x47a06a=[];var _0x3ba737=0x0;var _0x334491=!![];if(_0x59b825&&_0x59b825['length']){var _0x175909=_0x59b825[0x0][_0xc2b4('0x14')]%(_0x3ba737+_0x138ca1);if(_0x5aa156[_0xc2b4('0x15')]){for(;_0x334491;_0x3ba737+=_0x138ca1,_0x175909=_0x59b825[0x0][_0xc2b4('0x14')]%(_0x3ba737+_0x138ca1)){if(_0x175909==0x0||_0x175909==_0x59b825[0x0][_0xc2b4('0x14')]){_0x334491=![];}_0x47a06a[_0xc2b4('0x16')](dbH[_0xc2b4('0xf')][_0xc2b4('0x10')](util[_0xc2b4('0x11')](_0xc2b4('0x17'),QUERY,_0x138ca1,_0x3ba737),{'type':dbH[_0xc2b4('0xf')][_0xc2b4('0x12')]['SELECT']}));}}else{_0x47a06a[_0xc2b4('0x16')](dbH[_0xc2b4('0xf')][_0xc2b4('0x10')](QUERY,{'type':dbH[_0xc2b4('0xf')][_0xc2b4('0x12')][_0xc2b4('0x13')]}));}}var _0x48f52d=path[_0xc2b4('0x18')](PATH);var _0x3c8e4b=path[_0xc2b4('0x19')](PATH,'.csv');var _0x418968=_0x5aa156['split']&&_0x47a06a[_0xc2b4('0x1a')]>0x1;var _0x5157c3=[];if(!fs[_0xc2b4('0x1b')](path[_0xc2b4('0x1c')](_0x48f52d,_0x3c8e4b))&&_0x418968){fs[_0xc2b4('0x1d')](path[_0xc2b4('0x1c')](_0x48f52d,_0x3c8e4b));}return BPromise[_0xc2b4('0x1e')](_0x47a06a,function(_0x1461b3){_0x5157c3[_0xc2b4('0x16')](_0x1461b3);})[_0xc2b4('0xe')](function(){for(var _0x37cdfd=0x0;_0x37cdfd<_0x5157c3[_0xc2b4('0x1a')];_0x37cdfd+=0x1){var _0x2d33be;var _0x5ecd4c=_0x5157c3[_0x37cdfd];if(_0x418968){_0x2d33be=path['join'](_0x48f52d,_0x3c8e4b,util[_0xc2b4('0x11')](_0xc2b4('0x1f'),_0x3c8e4b,_0x37cdfd,_0xc2b4('0x20')));}else{_0x2d33be=path[_0xc2b4('0x1c')](_0x48f52d,util[_0xc2b4('0x11')](_0xc2b4('0x21'),_0x3c8e4b,_0xc2b4('0x20')));}fs[_0xc2b4('0x22')](_0x2d33be,csv(_0x5ecd4c));}})[_0xc2b4('0xe')](function(){if(_0x418968){zipdir(path['join'](_0x48f52d,_0x3c8e4b),{'saveTo':path[_0xc2b4('0x1c')](_0x48f52d,util['format']('%s.%s',_0x3c8e4b,_0xc2b4('0x23')))},function(_0x2c578d,_0x59831f){});rimraf(path[_0xc2b4('0x1c')](_0x48f52d,_0x3c8e4b),function(){});}})[_0xc2b4('0xe')](function(){logger['info'](util[_0xc2b4('0x11')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xc2b4('0x24')));return analyticExtractedReport(_0xc2b4('0x25'),_0x418968?util['format']('%s.%s',_0x3c8e4b,_0x418968?'zip':_0xc2b4('0x20')):null);});})[_0xc2b4('0x26')](function(_0x327311){logger[_0xc2b4('0x27')](util[_0xc2b4('0x11')](_0xc2b4('0x28'),EXTRACTED_REPORT_ID,'CSV'),util[_0xc2b4('0x29')](_0x327311,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc2b4('0x2a'));})['finally'](function(){process[_0xc2b4('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x10ab=['then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','existsSync','join','mkdirSync','each','%s.%s','csv','writeFileSync','zip','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','info','format','find','split','splitSizeCsv'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x10ab,0x6d));var _0xb10a=function(_0x2c6805,_0x46f0c5){_0x2c6805=_0x2c6805-0x0;var _0x523793=_0x10ab[_0x2c6805];return _0x523793;};'use strict';var util=require(_0xb10a('0x0'));var path=require(_0xb10a('0x1'));var _=require(_0xb10a('0x2'));var csv=require(_0xb10a('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xb10a('0x4'));var rimraf=require(_0xb10a('0x5'));var db=require(_0xb10a('0x6'))['db'];var dbH=require(_0xb10a('0x6'))[_0xb10a('0x7')];var logger=require('../../config/logger')(_0xb10a('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xb10a('0x9')][0x2]);var QUERY=process[_0xb10a('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cabd5,_0x34c044){var _0x1db285={'status':_0x2cabd5};var _0x58b7bc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x34c044){_0x1db285['savename']=_0x34c044;}return db[_0xb10a('0xa')][_0xb10a('0xb')](_0x1db285,_0x58b7bc);}function main(){var _0x17c234=0x1388;var _0x446701;logger[_0xb10a('0xc')](util[_0xb10a('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0xb10a('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb10a('0xf'),_0xb10a('0x10')]})[_0xb10a('0x11')](function(_0x94bdb){if(_0x94bdb){_0x446701=_0x94bdb;_0x17c234=_0x446701[_0xb10a('0x10')]||0x1388;}})['then'](function(){return dbH[_0xb10a('0x12')][_0xb10a('0x13')](util['format'](_0xb10a('0x14'),QUERY),{'type':dbH[_0xb10a('0x12')][_0xb10a('0x15')][_0xb10a('0x16')]});})[_0xb10a('0x11')](function(_0x3a5c46){if(!_0x3a5c46[0x0][_0xb10a('0x17')]){return analyticExtractedReport('Empty');}var _0x36b9a3=[];var _0x319020=0x0;var _0x34098b=!![];if(_0x3a5c46&&_0x3a5c46[_0xb10a('0x18')]){var _0x56845f=_0x3a5c46[0x0][_0xb10a('0x17')]%(_0x319020+_0x17c234);if(_0x446701[_0xb10a('0xf')]){for(;_0x34098b;_0x319020+=_0x17c234,_0x56845f=_0x3a5c46[0x0]['num']%(_0x319020+_0x17c234)){if(_0x56845f==0x0||_0x56845f==_0x3a5c46[0x0]['num']){_0x34098b=![];}_0x36b9a3[_0xb10a('0x19')](dbH[_0xb10a('0x12')][_0xb10a('0x13')](util[_0xb10a('0xd')](_0xb10a('0x1a'),QUERY,_0x17c234,_0x319020),{'type':dbH[_0xb10a('0x12')]['QueryTypes']['SELECT']}));}}else{_0x36b9a3[_0xb10a('0x19')](dbH[_0xb10a('0x12')][_0xb10a('0x13')](QUERY,{'type':dbH[_0xb10a('0x12')]['QueryTypes'][_0xb10a('0x16')]}));}}var _0x20ac27=path['dirname'](PATH);var _0x4abc4a=path[_0xb10a('0x1b')](PATH,_0xb10a('0x1c'));var _0x1bfdd2=_0x446701[_0xb10a('0xf')]&&_0x36b9a3[_0xb10a('0x18')]>0x1;var _0x4eaef6=[];if(!fs[_0xb10a('0x1d')](path[_0xb10a('0x1e')](_0x20ac27,_0x4abc4a))&&_0x1bfdd2){fs[_0xb10a('0x1f')](path['join'](_0x20ac27,_0x4abc4a));}return BPromise[_0xb10a('0x20')](_0x36b9a3,function(_0x58fd0f){_0x4eaef6[_0xb10a('0x19')](_0x58fd0f);})[_0xb10a('0x11')](function(){for(var _0x2a9b45=0x0;_0x2a9b45<_0x4eaef6[_0xb10a('0x18')];_0x2a9b45+=0x1){var _0x504a36;var _0x3458a6=_0x4eaef6[_0x2a9b45];if(_0x1bfdd2){_0x504a36=path[_0xb10a('0x1e')](_0x20ac27,_0x4abc4a,util['format']('%s%d.%s',_0x4abc4a,_0x2a9b45,'csv'));}else{_0x504a36=path[_0xb10a('0x1e')](_0x20ac27,util['format'](_0xb10a('0x21'),_0x4abc4a,_0xb10a('0x22')));}fs[_0xb10a('0x23')](_0x504a36,csv(_0x3458a6));}})[_0xb10a('0x11')](function(){if(_0x1bfdd2){zipdir(path[_0xb10a('0x1e')](_0x20ac27,_0x4abc4a),{'saveTo':path['join'](_0x20ac27,util[_0xb10a('0xd')](_0xb10a('0x21'),_0x4abc4a,_0xb10a('0x24')))},function(_0x48813b,_0x28cb79){});rimraf(path[_0xb10a('0x1e')](_0x20ac27,_0x4abc4a),function(){});}})['then'](function(){logger[_0xb10a('0xc')](util[_0xb10a('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xb10a('0x25')));return analyticExtractedReport(_0xb10a('0x26'),_0x1bfdd2?util[_0xb10a('0xd')](_0xb10a('0x21'),_0x4abc4a,_0x1bfdd2?'zip':_0xb10a('0x22')):null);});})[_0xb10a('0x27')](function(_0x4814f7){logger['info'](util['format'](_0xb10a('0x28'),EXTRACTED_REPORT_ID,_0xb10a('0x25')),util['inspect'](_0x4814f7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb10a('0x29'));})['finally'](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 0325130..c6b89ad 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 _0x1e15=['%s\x20#%d','channel','interactionId','YYYY-MM-DD','toString','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','map','length','auto','body','concat','keys','chunk','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','before','margin','push','landscape','black','right','num','Empty','dirname','basename','join','%s.%s','pdf','find','split','splitSizePdf','then','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','all','flatten','createPdfKitDocument','%s%d.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','zip','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','Failed','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf'];(function(_0x7d8c2e,_0x26ab75){var _0x279172=function(_0x8154e7){while(--_0x8154e7){_0x7d8c2e['push'](_0x7d8c2e['shift']());}};_0x279172(++_0x26ab75);}(_0x1e15,0x1ad));var _0x51e1=function(_0x11832b,_0x21c3dc){_0x11832b=_0x11832b-0x0;var _0xb8ff1=_0x1e15[_0x11832b];return _0xb8ff1;};'use strict';var _=require(_0x51e1('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x51e1('0x1'));var moment=require(_0x51e1('0x2'));var htmlToPdfmake=require(_0x51e1('0x3'));var PdfPrinter=require(_0x51e1('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x51e1('0x5'));var JSDOM=require(_0x51e1('0x6'))[_0x51e1('0x7')];var window=new JSDOM('')[_0x51e1('0x8')];var db=require(_0x51e1('0x9'))['db'];var dbH=require(_0x51e1('0x9'))[_0x51e1('0xa')];var logger=require(_0x51e1('0xb'))(_0x51e1('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x51e1('0xd')][0x3];var PATH=process[_0x51e1('0xd')][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1c70fd,_0x558f33){var _0x41e7c1={'status':_0x1c70fd};var _0x188988={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x558f33){_0x41e7c1[_0x51e1('0xe')]=_0x558f33;}return db[_0x51e1('0xf')]['update'](_0x41e7c1,_0x188988);}function getHeaders(_0x273832){return _['map'](_0x273832,function(_0x35cb5c){return{'text':_0x35cb5c,'style':'tableHeader'};});}function getRows(_0x256120,_0x5c081c){return _['map'](_0x5c081c,function(_0x6360a8){return _(_0x6360a8)['pick'](_0x256120)[_0x51e1('0x10')](function(_0x498a17){return _0x498a17?_['toString'](_0x498a17):'';})['value']();});}function createTable(_0x116626,_0x5b09a7){var _0xf08c87={'widths':_['fill'](Array(_0x116626[_0x51e1('0x11')]),0x91),'heights':function(_0x37911e){return _0x37911e===0x0?_0x51e1('0x12'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x275519=getHeaders(_0x116626);_0xf08c87[_0x51e1('0x13')]['push'](_0x275519);var _0x454d6c=getRows(_0x116626,_0x5b09a7);_0xf08c87[_0x51e1('0x13')]=_0xf08c87[_0x51e1('0x13')][_0x51e1('0x14')](_0x454d6c);return _0xf08c87;}function createTables(_0x56cf13){var _0xf31c07=[];var _0x326fc3=Object[_0x51e1('0x15')](_0x56cf13[0x0]);if(_0x326fc3[_0x51e1('0x11')]>0x5)_0x326fc3=_[_0x51e1('0x16')](Object[_0x51e1('0x15')](_0x56cf13[0x0]),0x5);_0x326fc3['forEach'](function(_0x2deae5){_0xf31c07['push'](createTable(_0x2deae5,_0x56cf13));});return _0xf31c07;}function getPDFDocDefinition(_0x3debc3){var _0x340d7e=util[_0x51e1('0x17')](_0x51e1('0x18'),NAME,EXTRACTED_REPORT[_0x51e1('0x19')],moment(EXTRACTED_REPORT[_0x51e1('0x1a')])[_0x51e1('0x17')](FORMAT),moment(EXTRACTED_REPORT[_0x51e1('0x1b')])[_0x51e1('0x17')](FORMAT));var _0x2697e9=[];for(var _0x575ce5=0x0;_0x575ce5<_0x3debc3['length'];_0x575ce5++){var _0x4f8e0f=[];if(_0x575ce5===0x0){_0x4f8e0f['push']({'text':_0x340d7e,'style':_0x51e1('0x1c')});}var _0x1c4d3c={'table':_0x3debc3[_0x575ce5]};if(_0x575ce5>0x0){_0x1c4d3c['pageBreak']=_0x51e1('0x1d');_0x1c4d3c[_0x51e1('0x1e')]=[0x0,0x46,0x0,0x0];}_0x4f8e0f[_0x51e1('0x1f')](_0x1c4d3c);_0x2697e9[_0x51e1('0x1f')](_0x4f8e0f);}return{'pageSize':'A4','pageOrientation':_0x51e1('0x20'),'content':_0x2697e9,'footer':function(_0x1df785,_0x519672){return{'text':_0x1df785['toString']()+'\x20/\x20'+_0x519672,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x51e1('0x21')},'footer':{'alignment':_0x51e1('0x22'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x55477d){var _0x3ed83a=0x1388;var _0x56e822;if(!_0x55477d[0x0][_0x51e1('0x23')]){return analyticExtractedReport(_0x51e1('0x24'));}var _0x1db4ad=[];var _0x6df598=0x0;var _0x48dd97=!![];var _0xf788c3=path[_0x51e1('0x25')](PATH);var _0x3322cf=path[_0x51e1('0x26')](PATH,'.pdf');var _0x52e4fb=path[_0x51e1('0x27')](_0xf788c3,util[_0x51e1('0x17')](_0x51e1('0x28'),_0x3322cf,_0x51e1('0x29')));var _0x36e825=![];return db['Setting'][_0x51e1('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x51e1('0x2b'),'splitSizePdf']})['then'](function(_0x31836c){if(_0x31836c){_0x56e822=_0x31836c;_0x3ed83a=_0x56e822[_0x51e1('0x2c')]||0x3e8;}})[_0x51e1('0x2d')](function(){if(_0x55477d&&_0x55477d[_0x51e1('0x11')]){var _0x484faf=_0x55477d[0x0][_0x51e1('0x23')]%(_0x6df598+_0x3ed83a);if(_0x56e822[_0x51e1('0x2b')]){for(;_0x48dd97;_0x6df598+=_0x3ed83a,_0x484faf=_0x55477d[0x0][_0x51e1('0x23')]%(_0x6df598+_0x3ed83a)){if(_0x484faf==0x0||_0x484faf==_0x55477d[0x0][_0x51e1('0x23')]){_0x48dd97=![];}_0x1db4ad[_0x51e1('0x1f')](dbH[_0x51e1('0x2e')][_0x51e1('0x2f')](util[_0x51e1('0x17')](_0x51e1('0x30'),QUERY,_0x3ed83a,_0x6df598),{'type':dbH[_0x51e1('0x2e')][_0x51e1('0x31')][_0x51e1('0x32')]}));}}else{_0x1db4ad[_0x51e1('0x1f')](dbH['sequelize'][_0x51e1('0x2f')](QUERY,{'type':dbH[_0x51e1('0x2e')]['QueryTypes'][_0x51e1('0x32')]}));}}_0x36e825=_0x56e822['split']&&_0x1db4ad[_0x51e1('0x11')]>0x1;if(!fs['existsSync'](path[_0x51e1('0x27')](_0xf788c3,_0x3322cf))&&_0x36e825){fs['mkdirSync'](path['join'](_0xf788c3,_0x3322cf));}return Promise[_0x51e1('0x33')](_0x1db4ad);})[_0x51e1('0x2d')](function(_0x549c25){return createTables(_[_0x51e1('0x34')](_0x549c25));})['then'](function(_0x6add7f){var _0xa8e8ae=getPDFDocDefinition(_0x6add7f);var _0x11f364=getPDFPrinter();var _0x28fd05=_0x11f364[_0x51e1('0x35')](_0xa8e8ae);if(_0x36e825)_0x52e4fb=path[_0x51e1('0x27')](_0xf788c3,_0x3322cf,util[_0x51e1('0x17')](_0x51e1('0x36'),_0x3322cf,index,_0x51e1('0x29')));return writePDFDocument(_0x28fd05,_0x52e4fb);})[_0x51e1('0x2d')](function(){if(!_0x36e825)return;zipdir(path['join'](_0xf788c3,_0x3322cf),{'saveTo':path[_0x51e1('0x27')](_0xf788c3,util[_0x51e1('0x17')](_0x51e1('0x28'),_0x3322cf,'zip'))},function(_0x36352e){if(_0x36352e)throw _0x36352e;return;});})['then'](function(){if(!_0x36e825)return;rimraf(path['join'](_0xf788c3,_0x3322cf),function(){});})[_0x51e1('0x2d')](function(){logger[_0x51e1('0x37')](util[_0x51e1('0x17')](_0x51e1('0x38'),EXTRACTED_REPORT_ID,_0x51e1('0x39')));return analyticExtractedReport(_0x51e1('0x3a'),_0x36e825?util[_0x51e1('0x17')](_0x51e1('0x28'),_0x3322cf,_0x36e825?_0x51e1('0x3b'):'pdf'):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x51e1('0x37')](util[_0x51e1('0x17')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0x51e1('0xf')][_0x51e1('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x51e1('0x2d')](function(_0x6a4946){EXTRACTED_REPORT=_0x6a4946;return dbH[_0x51e1('0x2e')]['query'](util[_0x51e1('0x17')](_0x51e1('0x3d'),QUERY),{'type':dbH[_0x51e1('0x2e')][_0x51e1('0x31')][_0x51e1('0x32')]});})[_0x51e1('0x2d')](extractReport)[_0x51e1('0x3e')](function(_0x27b900){logger[_0x51e1('0x37')](util['format'](_0x51e1('0x3f'),EXTRACTED_REPORT_ID,_0x51e1('0x40')),util['inspect'](_0x27b900,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x51e1('0x41'));})['finally'](function(){process[_0x51e1('0x42')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x81e358=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x51e1('0x43'),'italics':__dirname+_0x51e1('0x44'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x81e358;}function getPDFDocDefinitionFromHTML(_0x7bcb60,_0x4b3829){var _0x1473fc=util[_0x51e1('0x17')](_0x51e1('0x45'),_0x4b3829[_0x51e1('0x46')],_0x4b3829[_0x51e1('0x47')]);var _0x4e28a5=moment()[_0x51e1('0x17')](_0x51e1('0x48'))[_0x51e1('0x49')]();var _0x6ab1df=htmlToPdfmake(_0x7bcb60,{'window':window,'tableAutoSize':!![]});return{'content':[_0x6ab1df],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x51e1('0x4a')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x51e1('0x1c')}];},'footer':function(_0x195b7c,_0x27103e){return[{'text':util[_0x51e1('0x17')](_0x51e1('0x4b'),_0x1473fc,_0x195b7c,_0x27103e,_0x4e28a5),'style':_0x51e1('0x4c')}];}};}function writePDFDocument(_0x46f94b,_0x3f7d9e){return new Promise(function(_0x1e738f,_0x4e6f9e){var _0xd788d0=_0x46f94b[_0x51e1('0x4d')](fs[_0x51e1('0x4e')](_0x3f7d9e));_0xd788d0['on'](_0x51e1('0x4f'),function(){_0x1e738f('finish');});_0xd788d0['on'](_0x51e1('0x50'),function(_0x531ba8){_0x4e6f9e(_0x531ba8);});_0x46f94b[_0x51e1('0x51')]();});}exports[_0x51e1('0x52')]=function(_0x834e5f,_0x7cce0e){var _0x15a7bd=getPDFPrinter();var _0x1fb8ef=getPDFDocDefinitionFromHTML(_0x834e5f,_0x7cce0e);var _0x4c8f6f=_0x15a7bd[_0x51e1('0x35')](_0x1fb8ef);return writePDFDocument(_0x4c8f6f,_0x7cce0e[_0x51e1('0x1')])[_0x51e1('0x3e')](function(_0x48a127){throw _0x48a127;});}; \ No newline at end of file +var _0xfa58=['%s.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','finish','error','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','jsdom','JSDOM','window','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','pick','value','length','auto','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','pageBreak','before','margin','push','landscape','toString','black','right','Empty','dirname','basename','.pdf','join','Setting','find','split','splitSizePdf','then','num','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','mkdirSync','all','flatten','createPdfKitDocument','pdf'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xfa58,0x1d0));var _0x8fa5=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0xfa58[_0x8af54b];return _0x27d8f0;};'use strict';var _=require(_0x8fa5('0x0'));var fs=require('fs');var util=require(_0x8fa5('0x1'));var path=require(_0x8fa5('0x2'));var moment=require(_0x8fa5('0x3'));var htmlToPdfmake=require(_0x8fa5('0x4'));var PdfPrinter=require(_0x8fa5('0x5'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0x8fa5('0x6'))[_0x8fa5('0x7')];var window=new JSDOM('')[_0x8fa5('0x8')];var db=require(_0x8fa5('0x9'))['db'];var dbH=require(_0x8fa5('0x9'))['dbH'];var logger=require('../../config/logger')(_0x8fa5('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x8fa5('0xb')][0x2]);var QUERY=process[_0x8fa5('0xb')][0x3];var PATH=process[_0x8fa5('0xb')][0x4];var NAME=process[_0x8fa5('0xb')][0x5];var FORMAT=_0x8fa5('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1f5291,_0x33f411){var _0x5070b6={'status':_0x1f5291};var _0x2192c1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x33f411){_0x5070b6[_0x8fa5('0xd')]=_0x33f411;}return db[_0x8fa5('0xe')]['update'](_0x5070b6,_0x2192c1);}function getHeaders(_0x486499){return _[_0x8fa5('0xf')](_0x486499,function(_0x310ffd){return{'text':_0x310ffd,'style':'tableHeader'};});}function getRows(_0x3d57e7,_0x31a6d6){return _[_0x8fa5('0xf')](_0x31a6d6,function(_0x578058){return _(_0x578058)[_0x8fa5('0x10')](_0x3d57e7)['map'](function(_0x4a689d){return _0x4a689d?_['toString'](_0x4a689d):'';})[_0x8fa5('0x11')]();});}function createTable(_0x570883,_0x4e2112){var _0x596082={'widths':_['fill'](Array(_0x570883[_0x8fa5('0x12')]),0x91),'heights':function(_0x20ab07){return _0x20ab07===0x0?_0x8fa5('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x9610b2=getHeaders(_0x570883);_0x596082[_0x8fa5('0x14')]['push'](_0x9610b2);var _0x435c92=getRows(_0x570883,_0x4e2112);_0x596082['body']=_0x596082[_0x8fa5('0x14')][_0x8fa5('0x15')](_0x435c92);return _0x596082;}function createTables(_0x4af42b){var _0x11e801=[];var _0x54510e=Object['keys'](_0x4af42b[0x0]);if(_0x54510e['length']>0x5)_0x54510e=_[_0x8fa5('0x16')](Object[_0x8fa5('0x17')](_0x4af42b[0x0]),0x5);_0x54510e[_0x8fa5('0x18')](function(_0x4f6e40){_0x11e801['push'](createTable(_0x4f6e40,_0x4af42b));});return _0x11e801;}function getPDFDocDefinition(_0x30109a){var _0x3fcb4b=util[_0x8fa5('0x19')](_0x8fa5('0x1a'),NAME,EXTRACTED_REPORT[_0x8fa5('0x1b')],moment(EXTRACTED_REPORT[_0x8fa5('0x1c')])[_0x8fa5('0x19')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x8fa5('0x19')](FORMAT));var _0x13b1fa=[];for(var _0x3e5bab=0x0;_0x3e5bab<_0x30109a['length'];_0x3e5bab++){var _0x1a9ac=[];if(_0x3e5bab===0x0){_0x1a9ac['push']({'text':_0x3fcb4b,'style':'header'});}var _0x445450={'table':_0x30109a[_0x3e5bab]};if(_0x3e5bab>0x0){_0x445450[_0x8fa5('0x1d')]=_0x8fa5('0x1e');_0x445450[_0x8fa5('0x1f')]=[0x0,0x46,0x0,0x0];}_0x1a9ac[_0x8fa5('0x20')](_0x445450);_0x13b1fa['push'](_0x1a9ac);}return{'pageSize':'A4','pageOrientation':_0x8fa5('0x21'),'content':_0x13b1fa,'footer':function(_0x4de143,_0x452511){return{'text':_0x4de143[_0x8fa5('0x22')]()+'\x20/\x20'+_0x452511,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x8fa5('0x23')},'footer':{'alignment':_0x8fa5('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x568e05){var _0x21a1e8=0x1388;var _0x339372;if(!_0x568e05[0x0]['num']){return analyticExtractedReport(_0x8fa5('0x25'));}var _0x42e115=[];var _0x397251=0x0;var _0x49234f=!![];var _0x292ce8=path[_0x8fa5('0x26')](PATH);var _0x471930=path[_0x8fa5('0x27')](PATH,_0x8fa5('0x28'));var _0x3c09c4=path[_0x8fa5('0x29')](_0x292ce8,util[_0x8fa5('0x19')]('%s.%s',_0x471930,'pdf'));var _0xad668e=![];return db[_0x8fa5('0x2a')][_0x8fa5('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8fa5('0x2c'),_0x8fa5('0x2d')]})[_0x8fa5('0x2e')](function(_0x2e76d5){if(_0x2e76d5){_0x339372=_0x2e76d5;_0x21a1e8=_0x339372[_0x8fa5('0x2d')]||0x3e8;}})[_0x8fa5('0x2e')](function(){if(_0x568e05&&_0x568e05[_0x8fa5('0x12')]){var _0x3f9470=_0x568e05[0x0][_0x8fa5('0x2f')]%(_0x397251+_0x21a1e8);if(_0x339372[_0x8fa5('0x2c')]){for(;_0x49234f;_0x397251+=_0x21a1e8,_0x3f9470=_0x568e05[0x0][_0x8fa5('0x2f')]%(_0x397251+_0x21a1e8)){if(_0x3f9470==0x0||_0x3f9470==_0x568e05[0x0]['num']){_0x49234f=![];}_0x42e115[_0x8fa5('0x20')](dbH[_0x8fa5('0x30')][_0x8fa5('0x31')](util['format'](_0x8fa5('0x32'),QUERY,_0x21a1e8,_0x397251),{'type':dbH[_0x8fa5('0x30')][_0x8fa5('0x33')][_0x8fa5('0x34')]}));}}else{_0x42e115['push'](dbH[_0x8fa5('0x30')][_0x8fa5('0x31')](QUERY,{'type':dbH['sequelize'][_0x8fa5('0x33')]['SELECT']}));}}_0xad668e=_0x339372[_0x8fa5('0x2c')]&&_0x42e115[_0x8fa5('0x12')]>0x1;if(!fs['existsSync'](path['join'](_0x292ce8,_0x471930))&&_0xad668e){fs[_0x8fa5('0x35')](path[_0x8fa5('0x29')](_0x292ce8,_0x471930));}return Promise[_0x8fa5('0x36')](_0x42e115);})[_0x8fa5('0x2e')](function(_0x2c3b65){return createTables(_[_0x8fa5('0x37')](_0x2c3b65));})[_0x8fa5('0x2e')](function(_0x410505){var _0x148fc8=getPDFDocDefinition(_0x410505);var _0x344f0c=getPDFPrinter();var _0x336a6c=_0x344f0c[_0x8fa5('0x38')](_0x148fc8);if(_0xad668e)_0x3c09c4=path[_0x8fa5('0x29')](_0x292ce8,_0x471930,util[_0x8fa5('0x19')]('%s%d.%s',_0x471930,index,_0x8fa5('0x39')));return writePDFDocument(_0x336a6c,_0x3c09c4);})[_0x8fa5('0x2e')](function(){if(!_0xad668e)return;zipdir(path['join'](_0x292ce8,_0x471930),{'saveTo':path[_0x8fa5('0x29')](_0x292ce8,util[_0x8fa5('0x19')](_0x8fa5('0x3a'),_0x471930,'zip'))},function(_0x432051){if(_0x432051)throw _0x432051;return;});})[_0x8fa5('0x2e')](function(){if(!_0xad668e)return;rimraf(path[_0x8fa5('0x29')](_0x292ce8,_0x471930),function(){});})[_0x8fa5('0x2e')](function(){logger[_0x8fa5('0x3b')](util[_0x8fa5('0x19')](_0x8fa5('0x3c'),EXTRACTED_REPORT_ID,_0x8fa5('0x3d')));return analyticExtractedReport(_0x8fa5('0x3e'),_0xad668e?util[_0x8fa5('0x19')](_0x8fa5('0x3a'),_0x471930,_0xad668e?'zip':_0x8fa5('0x39')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x8fa5('0x3b')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8fa5('0x3f')));return db[_0x8fa5('0xe')][_0x8fa5('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x290541){EXTRACTED_REPORT=_0x290541;return dbH['sequelize']['query'](util['format'](_0x8fa5('0x41'),QUERY),{'type':dbH['sequelize'][_0x8fa5('0x33')][_0x8fa5('0x34')]});})[_0x8fa5('0x2e')](extractReport)[_0x8fa5('0x42')](function(_0x58a281){logger[_0x8fa5('0x3b')](util[_0x8fa5('0x19')](_0x8fa5('0x43'),EXTRACTED_REPORT_ID,_0x8fa5('0x3f')),util[_0x8fa5('0x44')](_0x58a281,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8fa5('0x45'));})[_0x8fa5('0x46')](function(){process[_0x8fa5('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3d3230=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x8fa5('0x48'),'italics':__dirname+_0x8fa5('0x49'),'bolditalics':__dirname+_0x8fa5('0x4a')}});return _0x3d3230;}function getPDFDocDefinitionFromHTML(_0xc9024f,_0x3990e9){var _0x26b234=util[_0x8fa5('0x19')](_0x8fa5('0x4b'),_0x3990e9['channel'],_0x3990e9[_0x8fa5('0x4c')]);var _0xfe325e=moment()[_0x8fa5('0x19')](_0x8fa5('0x4d'))[_0x8fa5('0x22')]();var _0x22fb79=htmlToPdfmake(_0xc9024f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x22fb79],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x8fa5('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x8fa5('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x8fa5('0x4e')}},'header':function(){return[{'text':_0x8fa5('0x4f'),'style':_0x8fa5('0x50')}];},'footer':function(_0x428651,_0x3e8044){return[{'text':util[_0x8fa5('0x19')](_0x8fa5('0x51'),_0x26b234,_0x428651,_0x3e8044,_0xfe325e),'style':_0x8fa5('0x52')}];}};}function writePDFDocument(_0x857aee,_0x294528){return new Promise(function(_0x26ebee,_0x2354e2){var _0x43cd1e=_0x857aee[_0x8fa5('0x53')](fs['createWriteStream'](_0x294528));_0x43cd1e['on'](_0x8fa5('0x54'),function(){_0x26ebee(_0x8fa5('0x54'));});_0x43cd1e['on'](_0x8fa5('0x55'),function(_0x2a9c53){_0x2354e2(_0x2a9c53);});_0x857aee['end']();});}exports[_0x8fa5('0x56')]=function(_0x3677f2,_0x4df6f8){var _0x46cd2c=getPDFPrinter();var _0x111bd3=getPDFDocDefinitionFromHTML(_0x3677f2,_0x4df6f8);var _0x202ea1=_0x46cd2c[_0x8fa5('0x38')](_0x111bd3);return writePDFDocument(_0x202ea1,_0x4df6f8[_0x8fa5('0x2')])[_0x8fa5('0x42')](function(_0x3c2e62){throw _0x3c2e62;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index ce4c5c2..d961fc9 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 _0xa9e0=['QueryTypes','SELECT','num','split','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','mkdirSync','each','length','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x2a6fd5,_0x3d6deb){var _0x43c6a4=function(_0x3aecb3){while(--_0x3aecb3){_0x2a6fd5['push'](_0x2a6fd5['shift']());}};_0x43c6a4(++_0x3d6deb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var util=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x0a9e('0x3'));var rimraf=require('rimraf');var db=require(_0x0a9e('0x4'))['db'];var dbH=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0a9e('0x8')][0x3];var PATH=process[_0x0a9e('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cc193,_0x5f41ea){var _0x503809={'status':_0x2cc193};var _0xe42b77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f41ea){_0x503809['savename']=_0x5f41ea;}return db['AnalyticExtractedReport'][_0x0a9e('0x9')](_0x503809,_0xe42b77);}function main(){var _0xf81284=0x1388;var _0x307b3e;logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0a9e('0xd')]})[_0x0a9e('0xe')](function(_0xd5b662){if(_0xd5b662){_0x307b3e=_0xd5b662;_0xf81284=_0x307b3e[_0x0a9e('0xd')]||0x1388;}})[_0x0a9e('0xe')](function(){return dbH[_0x0a9e('0xf')]['query'](util[_0x0a9e('0xb')](_0x0a9e('0x10'),QUERY),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]});})[_0x0a9e('0xe')](function(_0x52a03d){if(!_0x52a03d[0x0][_0x0a9e('0x13')]){return analyticExtractedReport('Empty');}var _0x1985b6=[];var _0x519dfd=0x0;var _0x16033c=!![];if(_0x307b3e[_0x0a9e('0x14')]){if(_0x52a03d&&_0x52a03d['length']){var _0x225616=_0x52a03d[0x0]['num']%(_0x519dfd+_0xf81284);for(;_0x16033c;_0x519dfd+=_0xf81284,_0x225616=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284)){if(_0x225616==0x0||_0x225616==_0x52a03d[0x0][_0x0a9e('0x13')]){_0x16033c=![];}_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')][_0x0a9e('0x16')](util[_0x0a9e('0xb')](_0x0a9e('0x17'),QUERY,_0xf81284,_0x519dfd),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]}));}}}else{_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')]['query'](QUERY,{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')]['SELECT']}));}var _0x20f109=path['dirname'](PATH);var _0x588269=path[_0x0a9e('0x18')](PATH,_0x0a9e('0x19'));var _0x38e7c4=_0x307b3e[_0x0a9e('0x14')]&&_0x1985b6['length']>0x1;var _0xfb6e48=[];if(!fs[_0x0a9e('0x1a')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269))&&_0x38e7c4){fs[_0x0a9e('0x1c')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269));}return BPromise[_0x0a9e('0x1d')](_0x1985b6,function(_0x16b1ca){_0xfb6e48['push'](_0x16b1ca);})['then'](function(){for(var _0x197ec0=0x0;_0x197ec0<_0xfb6e48[_0x0a9e('0x1e')];_0x197ec0+=0x1){var _0x40c424;var _0x33161b=_0xfb6e48[_0x197ec0];if(_0x38e7c4){_0x40c424=path['join'](_0x20f109,_0x588269,util[_0x0a9e('0xb')]('%s%d.%s',_0x588269,_0x197ec0,_0x0a9e('0x1f')));}else{_0x40c424=path['join'](_0x20f109,util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x1f')));}fs[_0x0a9e('0x21')](_0x40c424,json2xls(_0x33161b),_0x0a9e('0x22'));}})[_0x0a9e('0xe')](function(){if(_0x38e7c4){zipdir(path[_0x0a9e('0x1b')](_0x20f109,_0x588269),{'saveTo':path[_0x0a9e('0x1b')](_0x20f109,util['format'](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x23')))},function(_0x2b1f27,_0x2ec755){});rimraf(path['join'](_0x20f109,_0x588269),function(){});}})[_0x0a9e('0xe')](function(){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x24'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')));return analyticExtractedReport(_0x0a9e('0x26'),_0x38e7c4?util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x38e7c4?_0x0a9e('0x23'):'xlsx'):null);});})[_0x0a9e('0x27')](function(_0x5d1e0e){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x28'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')),util[_0x0a9e('0x29')](_0x5d1e0e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0a9e('0x2a')](function(){process[_0x0a9e('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xa9e0=['QueryTypes','SELECT','num','split','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','mkdirSync','each','length','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var util=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x0a9e('0x3'));var rimraf=require('rimraf');var db=require(_0x0a9e('0x4'))['db'];var dbH=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0a9e('0x8')][0x3];var PATH=process[_0x0a9e('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cc193,_0x5f41ea){var _0x503809={'status':_0x2cc193};var _0xe42b77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f41ea){_0x503809['savename']=_0x5f41ea;}return db['AnalyticExtractedReport'][_0x0a9e('0x9')](_0x503809,_0xe42b77);}function main(){var _0xf81284=0x1388;var _0x307b3e;logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0a9e('0xd')]})[_0x0a9e('0xe')](function(_0xd5b662){if(_0xd5b662){_0x307b3e=_0xd5b662;_0xf81284=_0x307b3e[_0x0a9e('0xd')]||0x1388;}})[_0x0a9e('0xe')](function(){return dbH[_0x0a9e('0xf')]['query'](util[_0x0a9e('0xb')](_0x0a9e('0x10'),QUERY),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]});})[_0x0a9e('0xe')](function(_0x52a03d){if(!_0x52a03d[0x0][_0x0a9e('0x13')]){return analyticExtractedReport('Empty');}var _0x1985b6=[];var _0x519dfd=0x0;var _0x16033c=!![];if(_0x307b3e[_0x0a9e('0x14')]){if(_0x52a03d&&_0x52a03d['length']){var _0x225616=_0x52a03d[0x0]['num']%(_0x519dfd+_0xf81284);for(;_0x16033c;_0x519dfd+=_0xf81284,_0x225616=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284)){if(_0x225616==0x0||_0x225616==_0x52a03d[0x0][_0x0a9e('0x13')]){_0x16033c=![];}_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')][_0x0a9e('0x16')](util[_0x0a9e('0xb')](_0x0a9e('0x17'),QUERY,_0xf81284,_0x519dfd),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]}));}}}else{_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')]['query'](QUERY,{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')]['SELECT']}));}var _0x20f109=path['dirname'](PATH);var _0x588269=path[_0x0a9e('0x18')](PATH,_0x0a9e('0x19'));var _0x38e7c4=_0x307b3e[_0x0a9e('0x14')]&&_0x1985b6['length']>0x1;var _0xfb6e48=[];if(!fs[_0x0a9e('0x1a')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269))&&_0x38e7c4){fs[_0x0a9e('0x1c')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269));}return BPromise[_0x0a9e('0x1d')](_0x1985b6,function(_0x16b1ca){_0xfb6e48['push'](_0x16b1ca);})['then'](function(){for(var _0x197ec0=0x0;_0x197ec0<_0xfb6e48[_0x0a9e('0x1e')];_0x197ec0+=0x1){var _0x40c424;var _0x33161b=_0xfb6e48[_0x197ec0];if(_0x38e7c4){_0x40c424=path['join'](_0x20f109,_0x588269,util[_0x0a9e('0xb')]('%s%d.%s',_0x588269,_0x197ec0,_0x0a9e('0x1f')));}else{_0x40c424=path['join'](_0x20f109,util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x1f')));}fs[_0x0a9e('0x21')](_0x40c424,json2xls(_0x33161b),_0x0a9e('0x22'));}})[_0x0a9e('0xe')](function(){if(_0x38e7c4){zipdir(path[_0x0a9e('0x1b')](_0x20f109,_0x588269),{'saveTo':path[_0x0a9e('0x1b')](_0x20f109,util['format'](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x23')))},function(_0x2b1f27,_0x2ec755){});rimraf(path['join'](_0x20f109,_0x588269),function(){});}})[_0x0a9e('0xe')](function(){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x24'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')));return analyticExtractedReport(_0x0a9e('0x26'),_0x38e7c4?util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x38e7c4?_0x0a9e('0x23'):'xlsx'):null);});})[_0x0a9e('0x27')](function(_0x5d1e0e){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x28'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')),util[_0x0a9e('0x29')](_0x5d1e0e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0a9e('0x2a')](function(){process[_0x0a9e('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index c0fe88e..2eac875 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 _0xb51e=['XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','catch','lodash','util','models','Interval','findAll','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','playback','hasOwnProperty','priority','extensions','find','push','type','Set','format','context','outbound','CDR(destination)=','extension','cutdigits','${EXTEN:','${EXTEN}','VoiceExtensionId','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','*,*,*,*','IntervalId','intervals','tag','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1'];(function(_0x2be004,_0x7393c3){var _0x1722ea=function(_0x5642f9){while(--_0x5642f9){_0x2be004['push'](_0x2be004['shift']());}};_0x1722ea(++_0x7393c3);}(_0xb51e,0xda));var _0xeb51=function(_0x2215cf,_0x343a0f){_0x2215cf=_0x2215cf-0x0;var _0x48c2f5=_0xb51e[_0x2215cf];return _0x48c2f5;};'use strict';var _=require(_0xeb51('0x0'));var util=require(_0xeb51('0x1'));function rewrite(_0x192f56,_0x406b36){var _0x1b5adf=this;return _0x192f56[_0xeb51('0x2')][_0xeb51('0x3')][_0xeb51('0x4')]({'raw':!![]})['then'](function(_0x13ef64){_0x1b5adf['intervals']=_0x13ef64;return _0x192f56['models'][_0xeb51('0x5')][_0xeb51('0x4')]({'where':{'IntervalId':_0x406b36['IntervalId']},'raw':!![]});})['then'](function(_0x9aa909){return _0x192f56[_0xeb51('0x2')][_0xeb51('0x5')][_0xeb51('0x4')]({'where':{'exten':{'$in':_[_0xeb51('0x6')](_[_0xeb51('0x7')](_0x9aa909,_0xeb51('0x8')))}},'order':[{'raw':_0xeb51('0x9')}],'raw':!![]});})[_0xeb51('0xa')](function(_0x14dc71){var _0x20ec3a=_[_0xeb51('0xb')](_0x14dc71,{'priority':'1'});var _0x1b3521=_[_0xeb51('0xb')](_0x14dc71,{'isApp':0x1});var _0x65283=_[_0xeb51('0xc')](_0x1b3521,_0xeb51('0x8'));var _0x5880f2=['queue',_0xeb51('0xd')];var _0x3ac844=[];var _0x201d27=[];for(var _0x29a30a in _0x65283){if(_0x65283[_0xeb51('0xe')](_0x29a30a)){_0x1b5adf[_0xeb51('0xf')]=0x2;_0x1b5adf[_0xeb51('0x10')]=[];_0x1b5adf['extension']=_[_0xeb51('0x11')](_0x20ec3a,{'exten':_0x65283[_0x29a30a][0x0][_0xeb51('0x8')]});_0x1b5adf[_0xeb51('0x10')][_0xeb51('0x12')]({'type':_0x65283[_0x29a30a][0x0][_0xeb51('0x13')],'app':_0xeb51('0x14'),'appdata':util[_0xeb51('0x15')]('CDR(type)=%s',_0x65283[_0x29a30a][0x0][_0xeb51('0x13')]),'context':_0x65283[_0x29a30a][0x0][_0xeb51('0x16')],'exten':_0x65283[_0x29a30a][0x0]['exten'],'priority':_0x1b5adf[_0xeb51('0xf')]++,'VoiceExtensionId':_0x65283[_0x29a30a][0x0]['VoiceExtensionId']});if(_0x65283[_0x29a30a][0x0][_0xeb51('0x13')]===_0xeb51('0x17')){if(_0x1b5adf['extension']){_0x1b5adf[_0xeb51('0x10')][_0xeb51('0x12')]({'type':_0x65283[_0x29a30a][0x0][_0xeb51('0x13')],'app':_0xeb51('0x14'),'appdata':_0xeb51('0x18')+(_0x1b5adf[_0xeb51('0x19')][_0xeb51('0x1a')]?_0xeb51('0x1b')+_0x1b5adf[_0xeb51('0x19')][_0xeb51('0x1a')]+'}':_0xeb51('0x1c')),'context':_0x65283[_0x29a30a][0x0]['context'],'exten':_0x65283[_0x29a30a][0x0]['exten'],'priority':_0x1b5adf[_0xeb51('0xf')]++,'VoiceExtensionId':_0x65283[_0x29a30a][0x0][_0xeb51('0x1d')]});}_0x1b5adf[_0xeb51('0x10')]['push']({'type':_0x65283[_0x29a30a][0x0][_0xeb51('0x13')],'app':_0xeb51('0x14'),'appdata':_0xeb51('0x1e')+_0x65283[_0x29a30a][0x0]['VoiceExtensionId'],'context':_0x65283[_0x29a30a][0x0][_0xeb51('0x16')],'exten':_0x65283[_0x29a30a][0x0]['exten'],'priority':_0x1b5adf[_0xeb51('0xf')]++,'VoiceExtensionId':_0x65283[_0x29a30a][0x0][_0xeb51('0x1d')]});var _0x4ebc50=_0x1b5adf[_0xeb51('0xf')]++;_0x1b5adf[_0xeb51('0x10')][_0xeb51('0x12')]({'type':_0x65283[_0x29a30a][0x0][_0xeb51('0x13')],'app':'ExecIf','appdata':_0xeb51('0x1f')+(_0x4ebc50+0x2)+'):Goto('+(_0x4ebc50+0x1)+')','context':_0x65283[_0x29a30a][0x0][_0xeb51('0x16')],'exten':_0x65283[_0x29a30a][0x0]['exten'],'priority':_0x4ebc50,'VoiceExtensionId':_0x65283[_0x29a30a][0x0][_0xeb51('0x1d')]});if(_0x1b5adf[_0xeb51('0x19')]){_0x1b5adf['extensions']['push']({'type':_0x65283[_0x29a30a][0x0][_0xeb51('0x13')],'app':_0xeb51('0x14'),'appdata':_0x1b5adf[_0xeb51('0x19')]['cutdigits']?_0xeb51('0x20')+_0x1b5adf[_0xeb51('0x19')][_0xeb51('0x1a')]+'}':'CDR(prefix)=noprefix','context':_0x65283[_0x29a30a][0x0][_0xeb51('0x16')],'exten':_0x65283[_0x29a30a][0x0][_0xeb51('0x8')],'priority':_0x1b5adf['priority']++,'VoiceExtensionId':_0x65283[_0x29a30a][0x0][_0xeb51('0x1d')]});}_0x1b5adf[_0xeb51('0x10')][_0xeb51('0x12')]({'type':_0x65283[_0x29a30a][0x0][_0xeb51('0x13')],'app':_0xeb51('0x14'),'appdata':_0xeb51('0x21')+_0x65283[_0x29a30a][0x0][_0xeb51('0x1d')],'context':_0x65283[_0x29a30a][0x0]['context'],'exten':_0x65283[_0x29a30a][0x0][_0xeb51('0x8')],'priority':_0x1b5adf[_0xeb51('0xf')]++,'VoiceExtensionId':_0x65283[_0x29a30a][0x0][_0xeb51('0x1d')]});if(_0x1b5adf['extension']&&_0x1b5adf['extension']['hasOwnProperty'](_0xeb51('0x22'))&&_0x1b5adf[_0xeb51('0x19')][_0xeb51('0x22')]!=='none'){_0x1b5adf[_0xeb51('0x10')][_0xeb51('0x12')]({'type':_0x65283[_0x29a30a][0x0]['type'],'app':_0xeb51('0x14'),'appdata':_0xeb51('0x23'),'context':_0x65283[_0x29a30a][0x0][_0xeb51('0x16')],'exten':_0x65283[_0x29a30a][0x0][_0xeb51('0x8')],'priority':_0x1b5adf[_0xeb51('0xf')]++,'VoiceExtensionId':_0x65283[_0x29a30a][0x0]['VoiceExtensionId']});_0x1b5adf['extensions'][_0xeb51('0x12')]({'type':_0x65283[_0x29a30a][0x0][_0xeb51('0x13')],'app':_0xeb51('0x14'),'appdata':_0xeb51('0x24')+_0x1b5adf[_0xeb51('0x19')][_0xeb51('0x22')]||_0xeb51('0x25'),'context':_0x65283[_0x29a30a][0x0]['context'],'exten':_0x65283[_0x29a30a][0x0][_0xeb51('0x8')],'priority':_0x1b5adf[_0xeb51('0xf')]++,'VoiceExtensionId':_0x65283[_0x29a30a][0x0][_0xeb51('0x1d')]});}}_0x1b5adf[_0xeb51('0x10')]['push']({'type':_0x65283[_0x29a30a][0x0][_0xeb51('0x13')],'app':_0xeb51('0x14'),'appdata':_0xeb51('0x26'),'context':_0x65283[_0x29a30a][0x0][_0xeb51('0x16')],'exten':_0x65283[_0x29a30a][0x0]['exten'],'priority':_0x1b5adf[_0xeb51('0xf')]++,'VoiceExtensionId':_0x65283[_0x29a30a][0x0][_0xeb51('0x1d')]});_0x1b5adf[_0xeb51('0x10')]['push']({'type':_0x65283[_0x29a30a][0x0][_0xeb51('0x13')],'app':'Set','appdata':_0xeb51('0x27'),'context':_0x65283[_0x29a30a][0x0][_0xeb51('0x16')],'exten':_0x65283[_0x29a30a][0x0][_0xeb51('0x8')],'priority':_0x1b5adf[_0xeb51('0xf')]++,'VoiceExtensionId':_0x65283[_0x29a30a][0x0][_0xeb51('0x1d')]});_0x1b5adf['extensions'][_0xeb51('0x12')]({'type':_0x65283[_0x29a30a][0x0][_0xeb51('0x13')],'app':'Set','appdata':_0xeb51('0x28'),'context':_0x65283[_0x29a30a][0x0][_0xeb51('0x16')],'exten':_0x65283[_0x29a30a][0x0]['exten'],'priority':_0x1b5adf[_0xeb51('0xf')]++,'VoiceExtensionId':_0x65283[_0x29a30a][0x0]['VoiceExtensionId']});for(var _0x43ef87=0x0,_0x27e4aa=0x0;_0x43ef87<_0x65283[_0x29a30a][_0xeb51('0x29')];_0x43ef87+=0x1,_0x27e4aa=0x0){var _0x382a7c=_0x65283[_0x29a30a][_0x43ef87];if(_0x382a7c[_0xeb51('0x13')]){_0x382a7c[_0xeb51('0x13')]=_0x382a7c[_0xeb51('0x13')][_0xeb51('0x2a')]();}var _0x1d8408=[];var _0x520daf=[];delete _0x382a7c['id'];delete _0x382a7c['createdAt'];delete _0x382a7c[_0xeb51('0x2b')];var _0x3388c4=_0x382a7c[_0xeb51('0x2c')]!==_0xeb51('0x2d')?[_0x382a7c[_0xeb51('0x2c')]]:_0x382a7c[_0xeb51('0x2e')]?_[_0xeb51('0x7')](_[_0xeb51('0xb')](_0x1b5adf[_0xeb51('0x2f')],{'IntervalId':_0x382a7c[_0xeb51('0x2e')]}),_0xeb51('0x2c')):[];if(_0x382a7c['hasOwnProperty'](_0xeb51('0x30'))){if(_0x382a7c[_0xeb51('0x30')]&&_0x382a7c['tag']!=='--'){_0x1d8408['push']({'type':_0x382a7c[_0xeb51('0x13')],'app':_0xeb51('0x14'),'appdata':'CDR(tag)='+_0x382a7c[_0xeb51('0x30')],'context':_0x382a7c[_0xeb51('0x16')],'exten':_0x382a7c[_0xeb51('0x8')],'priority':_0x3388c4['length']+_0x1b5adf[_0xeb51('0xf')]+_0x27e4aa++,'VoiceExtensionId':_0x382a7c['VoiceExtensionId']});}}if(_0x382a7c['type']===_0xeb51('0x17')&&_0x382a7c[_0xeb51('0xe')]('callerID')){if(_0x382a7c['callerID']){_0x1d8408[_0xeb51('0x12')]({'type':_0x382a7c[_0xeb51('0x13')],'app':_0xeb51('0x31'),'appdata':_0xeb51('0x32')+_0x382a7c['callerID']+')','context':_0x382a7c['context'],'exten':_0x382a7c[_0xeb51('0x8')],'priority':_0x3388c4['length']+_0x1b5adf[_0xeb51('0xf')]+_0x27e4aa++,'VoiceExtensionId':_0x382a7c[_0xeb51('0x1d')]});}else{_0x1d8408[_0xeb51('0x12')]({'type':_0x382a7c[_0xeb51('0x13')],'app':_0xeb51('0x31'),'appdata':_0xeb51('0x33'),'context':_0x382a7c[_0xeb51('0x16')],'exten':_0x382a7c[_0xeb51('0x8')],'priority':_0x3388c4[_0xeb51('0x29')]+_0x1b5adf[_0xeb51('0xf')]+_0x27e4aa++,'VoiceExtensionId':_0x382a7c[_0xeb51('0x1d')]});}}if(_0x382a7c[_0xeb51('0xe')]('answer')){if(_0x5880f2[_0xeb51('0x34')](_0x382a7c[_0xeb51('0x35')][_0xeb51('0x2a')]())>=0x0&&_0x382a7c[_0xeb51('0x36')]!==_0xeb51('0x37')){if(_0x382a7c['answer']){_0x1d8408['push']({'type':_0x382a7c[_0xeb51('0x13')],'app':_0xeb51('0x31'),'appdata':_0xeb51('0x38'),'context':_0x382a7c['context'],'exten':_0x382a7c[_0xeb51('0x8')],'priority':_0x3388c4[_0xeb51('0x29')]+_0x1b5adf[_0xeb51('0xf')]+_0x27e4aa++,'VoiceExtensionId':_0x382a7c[_0xeb51('0x1d')]});_0x1d8408[_0xeb51('0x12')]({'type':_0x382a7c['type'],'app':'Set','appdata':_0xeb51('0x39'),'context':_0x382a7c[_0xeb51('0x16')],'exten':_0x382a7c[_0xeb51('0x8')],'priority':_0x3388c4[_0xeb51('0x29')]+_0x1b5adf[_0xeb51('0xf')]+_0x27e4aa++,'VoiceExtensionId':_0x382a7c[_0xeb51('0x1d')]});}else{_0x1d8408[_0xeb51('0x12')]({'type':_0x382a7c[_0xeb51('0x13')],'app':_0xeb51('0x31'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x382a7c[_0xeb51('0x16')],'exten':_0x382a7c[_0xeb51('0x8')],'priority':_0x3388c4[_0xeb51('0x29')]+_0x1b5adf[_0xeb51('0xf')]+_0x27e4aa++,'VoiceExtensionId':_0x382a7c['VoiceExtensionId']});_0x1d8408[_0xeb51('0x12')]({'type':_0x382a7c[_0xeb51('0x13')],'app':'Set','appdata':_0xeb51('0x3a'),'context':_0x382a7c['context'],'exten':_0x382a7c[_0xeb51('0x8')],'priority':_0x3388c4[_0xeb51('0x29')]+_0x1b5adf['priority']+_0x27e4aa++,'VoiceExtensionId':_0x382a7c[_0xeb51('0x1d')]});}}}for(var _0x4c13cc=0x0;_0x4c13cc<_0x3388c4[_0xeb51('0x29')];_0x4c13cc+=0x1){var _0x249d05=_0x1b5adf[_0xeb51('0xf')]+_0x3388c4[_0xeb51('0x29')];var _0x3a119d=_0x4c13cc===_0x3388c4[_0xeb51('0x29')]-0x1?_0x1b5adf[_0xeb51('0xf')]+_0x1d8408[_0xeb51('0x29')]+_0x520daf['length']+0x2:_0x1b5adf[_0xeb51('0xf')]+_0x4c13cc+0x1;_0x1d8408['splice'](_0x4c13cc,0x0,{'type':_0x382a7c[_0xeb51('0x13')],'app':_0xeb51('0x3b'),'appdata':_0x3388c4[_0x4c13cc]+'?'+_0x382a7c[_0xeb51('0x16')]+_0xeb51('0x3c')+_0x249d05+':'+_0x382a7c[_0xeb51('0x16')]+_0xeb51('0x3c')+_0x3a119d,'exten':_0x382a7c[_0xeb51('0x8')],'context':_0x382a7c['context'],'priority':_0x1b5adf[_0xeb51('0xf')]+_0x4c13cc,'VoiceExtensionId':_0x65283[_0x29a30a][0x0][_0xeb51('0x1d')]});}_0x382a7c[_0xeb51('0xf')]=_0x1d8408[_0xeb51('0x29')]?_[_0xeb51('0x3d')](_0x1d8408)[_0xeb51('0xf')]+0x1:_0x1b5adf[_0xeb51('0xf')];_0x1b5adf[_0xeb51('0xf')]=(_0x520daf[_0xeb51('0x29')]?_[_0xeb51('0x3d')](_0x520daf)[_0xeb51('0xf')]:_0x382a7c[_0xeb51('0xf')])+0x1;_0x1b5adf[_0xeb51('0x10')]=_['concat'](_0x1b5adf[_0xeb51('0x10')],_0x1d8408,[_0x382a7c],_0x520daf);}_0x1b5adf[_0xeb51('0x10')][_0xeb51('0x12')]({'type':_0x65283[_0x29a30a][0x0][_0xeb51('0x13')],'app':_0xeb51('0x3e'),'exten':_0x65283[_0x29a30a][0x0][_0xeb51('0x8')],'context':_0x65283[_0x29a30a][0x0][_0xeb51('0x16')],'priority':_0x1b5adf['priority'],'VoiceExtensionId':_0x65283[_0x29a30a][0x0][_0xeb51('0x1d')]});_0x3ac844['push'](_0x65283[_0x29a30a][0x0]['VoiceExtensionId']);_0x201d27=_[_0xeb51('0x3f')](_0x201d27,_0x1b5adf[_0xeb51('0x10')]);}}return _0x192f56[_0xeb51('0x40')](function(_0x109c07){return _0x192f56['models']['VoiceExtension'][_0xeb51('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x3ac844}},'transaction':_0x109c07})[_0xeb51('0xa')](function(_0x35e509){return _0x192f56[_0xeb51('0x2')]['VoiceExtension'][_0xeb51('0x42')](_[_0xeb51('0x43')](_0x201d27,_0xeb51('0xf')),{'transaction':_0x109c07});});});})[_0xeb51('0x44')](function(_0x5a647b){console['error'](_0x5a647b);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x2d4d=['error','rewrite','lodash','models','Interval','findAll','then','intervals','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','push','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','length','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','Hangup','transaction','destroy','bulkCreate','sortBy'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2d4d,0x94));var _0xd2d4=function(_0x57e1f0,_0x23af44){_0x57e1f0=_0x57e1f0-0x0;var _0x2ee288=_0x2d4d[_0x57e1f0];return _0x2ee288;};'use strict';var _=require(_0xd2d4('0x0'));var util=require('util');function rewrite(_0x4e59de,_0x566965){var _0x2783a3=this;return _0x4e59de[_0xd2d4('0x1')][_0xd2d4('0x2')][_0xd2d4('0x3')]({'raw':!![]})[_0xd2d4('0x4')](function(_0x3811e8){_0x2783a3[_0xd2d4('0x5')]=_0x3811e8;return _0x4e59de[_0xd2d4('0x1')][_0xd2d4('0x6')][_0xd2d4('0x3')]({'where':{'IntervalId':_0x566965['IntervalId']},'raw':!![]});})[_0xd2d4('0x4')](function(_0x57bae4){return _0x4e59de[_0xd2d4('0x1')][_0xd2d4('0x6')][_0xd2d4('0x3')]({'where':{'exten':{'$in':_[_0xd2d4('0x7')](_[_0xd2d4('0x8')](_0x57bae4,_0xd2d4('0x9')))}},'order':[{'raw':_0xd2d4('0xa')}],'raw':!![]});})[_0xd2d4('0x4')](function(_0x2c5b3c){var _0x2705d8=_[_0xd2d4('0xb')](_0x2c5b3c,{'priority':'1'});var _0x1504b9=_[_0xd2d4('0xb')](_0x2c5b3c,{'isApp':0x1});var _0x238bff=_[_0xd2d4('0xc')](_0x1504b9,_0xd2d4('0x9'));var _0x772a5f=[_0xd2d4('0xd'),_0xd2d4('0xe')];var _0x279c80=[];var _0x13a0ad=[];for(var _0x3dc00c in _0x238bff){if(_0x238bff[_0xd2d4('0xf')](_0x3dc00c)){_0x2783a3[_0xd2d4('0x10')]=0x2;_0x2783a3[_0xd2d4('0x11')]=[];_0x2783a3[_0xd2d4('0x12')]=_[_0xd2d4('0x13')](_0x2705d8,{'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')]});_0x2783a3[_0xd2d4('0x11')]['push']({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':_0xd2d4('0x15'),'appdata':util[_0xd2d4('0x16')](_0xd2d4('0x17'),_0x238bff[_0x3dc00c][0x0]['type']),'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'priority':_0x2783a3['priority']++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});if(_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')]===_0xd2d4('0x1a')){if(_0x2783a3[_0xd2d4('0x12')]){_0x2783a3['extensions']['push']({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':_0xd2d4('0x15'),'appdata':_0xd2d4('0x1b')+(_0x2783a3['extension'][_0xd2d4('0x1c')]?_0xd2d4('0x1d')+_0x2783a3[_0xd2d4('0x12')][_0xd2d4('0x1c')]+'}':_0xd2d4('0x1e')),'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0]['exten'],'priority':_0x2783a3[_0xd2d4('0x10')]++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});}_0x2783a3[_0xd2d4('0x11')][_0xd2d4('0x1f')]({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':_0xd2d4('0x15'),'appdata':_0xd2d4('0x20')+_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')],'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'priority':_0x2783a3[_0xd2d4('0x10')]++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});var _0x4f3087=_0x2783a3[_0xd2d4('0x10')]++;_0x2783a3[_0xd2d4('0x11')]['push']({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':_0xd2d4('0x21'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4f3087+0x2)+_0xd2d4('0x22')+(_0x4f3087+0x1)+')','context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'priority':_0x4f3087,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0]['VoiceExtensionId']});if(_0x2783a3[_0xd2d4('0x12')]){_0x2783a3[_0xd2d4('0x11')][_0xd2d4('0x1f')]({'type':_0x238bff[_0x3dc00c][0x0]['type'],'app':_0xd2d4('0x15'),'appdata':_0x2783a3[_0xd2d4('0x12')][_0xd2d4('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x2783a3['extension']['cutdigits']+'}':_0xd2d4('0x23'),'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'priority':_0x2783a3[_0xd2d4('0x10')]++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});}_0x2783a3[_0xd2d4('0x11')]['push']({'type':_0x238bff[_0x3dc00c][0x0]['type'],'app':_0xd2d4('0x15'),'appdata':_0xd2d4('0x24')+_0x238bff[_0x3dc00c][0x0]['VoiceExtensionId'],'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'priority':_0x2783a3['priority']++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});if(_0x2783a3[_0xd2d4('0x12')]&&_0x2783a3[_0xd2d4('0x12')][_0xd2d4('0xf')](_0xd2d4('0x25'))&&_0x2783a3[_0xd2d4('0x12')][_0xd2d4('0x25')]!==_0xd2d4('0x26')){_0x2783a3[_0xd2d4('0x11')][_0xd2d4('0x1f')]({'type':_0x238bff[_0x3dc00c][0x0]['type'],'app':_0xd2d4('0x15'),'appdata':_0xd2d4('0x27'),'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0]['exten'],'priority':_0x2783a3[_0xd2d4('0x10')]++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});_0x2783a3['extensions']['push']({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2783a3[_0xd2d4('0x12')][_0xd2d4('0x25')]||_0xd2d4('0x28'),'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'priority':_0x2783a3[_0xd2d4('0x10')]++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});}}_0x2783a3[_0xd2d4('0x11')][_0xd2d4('0x1f')]({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':_0xd2d4('0x15'),'appdata':_0xd2d4('0x29'),'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'priority':_0x2783a3[_0xd2d4('0x10')]++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0]['VoiceExtensionId']});_0x2783a3[_0xd2d4('0x11')]['push']({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':_0xd2d4('0x15'),'appdata':_0xd2d4('0x2a'),'context':_0x238bff[_0x3dc00c][0x0]['context'],'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'priority':_0x2783a3[_0xd2d4('0x10')]++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0]['VoiceExtensionId']});_0x2783a3['extensions'][_0xd2d4('0x1f')]({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':'Set','appdata':_0xd2d4('0x2b'),'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0]['exten'],'priority':_0x2783a3[_0xd2d4('0x10')]++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});for(var _0xb87ba7=0x0,_0x4c53b5=0x0;_0xb87ba7<_0x238bff[_0x3dc00c]['length'];_0xb87ba7+=0x1,_0x4c53b5=0x0){var _0x10af94=_0x238bff[_0x3dc00c][_0xb87ba7];if(_0x10af94[_0xd2d4('0x14')]){_0x10af94[_0xd2d4('0x14')]=_0x10af94[_0xd2d4('0x14')][_0xd2d4('0x2c')]();}var _0x545234=[];var _0x51f917=[];delete _0x10af94['id'];delete _0x10af94[_0xd2d4('0x2d')];delete _0x10af94['updatedAt'];var _0x488bb5=_0x10af94[_0xd2d4('0x2e')]!==_0xd2d4('0x2f')?[_0x10af94['interval']]:_0x10af94[_0xd2d4('0x30')]?_[_0xd2d4('0x8')](_[_0xd2d4('0xb')](_0x2783a3[_0xd2d4('0x5')],{'IntervalId':_0x10af94[_0xd2d4('0x30')]}),'interval'):[];if(_0x10af94[_0xd2d4('0xf')](_0xd2d4('0x31'))){if(_0x10af94['tag']&&_0x10af94[_0xd2d4('0x31')]!=='--'){_0x545234[_0xd2d4('0x1f')]({'type':_0x10af94['type'],'app':_0xd2d4('0x15'),'appdata':_0xd2d4('0x32')+_0x10af94[_0xd2d4('0x31')],'context':_0x10af94[_0xd2d4('0x18')],'exten':_0x10af94[_0xd2d4('0x9')],'priority':_0x488bb5['length']+_0x2783a3['priority']+_0x4c53b5++,'VoiceExtensionId':_0x10af94[_0xd2d4('0x19')]});}}if(_0x10af94['type']==='outbound'&&_0x10af94[_0xd2d4('0xf')]('callerID')){if(_0x10af94['callerID']){_0x545234[_0xd2d4('0x1f')]({'type':_0x10af94['type'],'app':_0xd2d4('0x21'),'appdata':_0xd2d4('0x33')+_0x10af94[_0xd2d4('0x34')]+')','context':_0x10af94[_0xd2d4('0x18')],'exten':_0x10af94[_0xd2d4('0x9')],'priority':_0x488bb5[_0xd2d4('0x35')]+_0x2783a3[_0xd2d4('0x10')]+_0x4c53b5++,'VoiceExtensionId':_0x10af94[_0xd2d4('0x19')]});}else{_0x545234[_0xd2d4('0x1f')]({'type':_0x10af94[_0xd2d4('0x14')],'app':_0xd2d4('0x21'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x10af94['context'],'exten':_0x10af94[_0xd2d4('0x9')],'priority':_0x488bb5[_0xd2d4('0x35')]+_0x2783a3[_0xd2d4('0x10')]+_0x4c53b5++,'VoiceExtensionId':_0x10af94[_0xd2d4('0x19')]});}}if(_0x10af94[_0xd2d4('0xf')](_0xd2d4('0x36'))){if(_0x772a5f[_0xd2d4('0x37')](_0x10af94[_0xd2d4('0x38')][_0xd2d4('0x2c')]())>=0x0&&_0x10af94[_0xd2d4('0x39')]!==_0xd2d4('0x3a')){if(_0x10af94[_0xd2d4('0x36')]){_0x545234[_0xd2d4('0x1f')]({'type':_0x10af94[_0xd2d4('0x14')],'app':'ExecIf','appdata':_0xd2d4('0x3b'),'context':_0x10af94[_0xd2d4('0x18')],'exten':_0x10af94[_0xd2d4('0x9')],'priority':_0x488bb5['length']+_0x2783a3[_0xd2d4('0x10')]+_0x4c53b5++,'VoiceExtensionId':_0x10af94[_0xd2d4('0x19')]});_0x545234[_0xd2d4('0x1f')]({'type':_0x10af94['type'],'app':_0xd2d4('0x15'),'appdata':_0xd2d4('0x3c'),'context':_0x10af94[_0xd2d4('0x18')],'exten':_0x10af94['exten'],'priority':_0x488bb5[_0xd2d4('0x35')]+_0x2783a3[_0xd2d4('0x10')]+_0x4c53b5++,'VoiceExtensionId':_0x10af94['VoiceExtensionId']});}else{_0x545234[_0xd2d4('0x1f')]({'type':_0x10af94[_0xd2d4('0x14')],'app':_0xd2d4('0x21'),'appdata':_0xd2d4('0x3d'),'context':_0x10af94[_0xd2d4('0x18')],'exten':_0x10af94['exten'],'priority':_0x488bb5['length']+_0x2783a3[_0xd2d4('0x10')]+_0x4c53b5++,'VoiceExtensionId':_0x10af94[_0xd2d4('0x19')]});_0x545234[_0xd2d4('0x1f')]({'type':_0x10af94[_0xd2d4('0x14')],'app':_0xd2d4('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x10af94[_0xd2d4('0x18')],'exten':_0x10af94[_0xd2d4('0x9')],'priority':_0x488bb5[_0xd2d4('0x35')]+_0x2783a3[_0xd2d4('0x10')]+_0x4c53b5++,'VoiceExtensionId':_0x10af94[_0xd2d4('0x19')]});}}}for(var _0x3effc0=0x0;_0x3effc0<_0x488bb5['length'];_0x3effc0+=0x1){var _0x4367b2=_0x2783a3['priority']+_0x488bb5['length'];var _0x322149=_0x3effc0===_0x488bb5[_0xd2d4('0x35')]-0x1?_0x2783a3[_0xd2d4('0x10')]+_0x545234[_0xd2d4('0x35')]+_0x51f917['length']+0x2:_0x2783a3[_0xd2d4('0x10')]+_0x3effc0+0x1;_0x545234[_0xd2d4('0x3e')](_0x3effc0,0x0,{'type':_0x10af94[_0xd2d4('0x14')],'app':_0xd2d4('0x3f'),'appdata':_0x488bb5[_0x3effc0]+'?'+_0x10af94['context']+_0xd2d4('0x40')+_0x4367b2+':'+_0x10af94[_0xd2d4('0x18')]+',${EXTEN},'+_0x322149,'exten':_0x10af94[_0xd2d4('0x9')],'context':_0x10af94['context'],'priority':_0x2783a3['priority']+_0x3effc0,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});}_0x10af94['priority']=_0x545234[_0xd2d4('0x35')]?_[_0xd2d4('0x41')](_0x545234)['priority']+0x1:_0x2783a3[_0xd2d4('0x10')];_0x2783a3[_0xd2d4('0x10')]=(_0x51f917[_0xd2d4('0x35')]?_[_0xd2d4('0x41')](_0x51f917)[_0xd2d4('0x10')]:_0x10af94[_0xd2d4('0x10')])+0x1;_0x2783a3[_0xd2d4('0x11')]=_['concat'](_0x2783a3[_0xd2d4('0x11')],_0x545234,[_0x10af94],_0x51f917);}_0x2783a3[_0xd2d4('0x11')][_0xd2d4('0x1f')]({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':_0xd2d4('0x42'),'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'priority':_0x2783a3[_0xd2d4('0x10')],'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});_0x279c80[_0xd2d4('0x1f')](_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]);_0x13a0ad=_['concat'](_0x13a0ad,_0x2783a3[_0xd2d4('0x11')]);}}return _0x4e59de[_0xd2d4('0x43')](function(_0x351d16){return _0x4e59de[_0xd2d4('0x1')]['VoiceExtension'][_0xd2d4('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x279c80}},'transaction':_0x351d16})[_0xd2d4('0x4')](function(_0x425a0f){return _0x4e59de[_0xd2d4('0x1')][_0xd2d4('0x6')][_0xd2d4('0x45')](_[_0xd2d4('0x46')](_0x13a0ad,_0xd2d4('0x10')),{'transaction':_0x351d16});});});})['catch'](function(_0x422f61){console[_0xd2d4('0x47')](_0x422f61);});}exports[_0xd2d4('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 37efcaa..c45d07b 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 _0x70e0=['insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','updatedAt','select','field','toString','NOW()','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','from','createdAt','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','catch','query','BlackLists','all','Campaign','Lists','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CmContact','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','map','errors','message','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','duplicate','Duplicate\x20Contact','keys','then','push','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect'];(function(_0x4bab9d,_0x57622b){var _0x592f45=function(_0x40ee71){while(--_0x40ee71){_0x4bab9d['push'](_0x4bab9d['shift']());}};_0x592f45(++_0x57622b);}(_0x70e0,0x17b));var _0x070e=function(_0x563e3b,_0x3fd113){_0x563e3b=_0x563e3b-0x0;var _0x5c1e63=_0x70e0[_0x563e3b];return _0x5c1e63;};'use strict';var BPromise=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var _=require(_0x070e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var config=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('api');config[_0x070e('0x7')]=_['defaults'](config[_0x070e('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x070e('0x8'))[_0x070e('0x9')](socket);try{if(!process[_0x070e('0xa')][0x2]||process[_0x070e('0xa')][0x2]===_0x070e('0xb')||process[_0x070e('0xa')][0x2]===_0x070e('0xc')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x070e('0xa')][0x3]||process[_0x070e('0xa')][0x3]===_0x070e('0xb')||process[_0x070e('0xa')][0x3]===_0x070e('0xc')||!process[_0x070e('0xa')][0x4]||process[_0x070e('0xa')][0x4]===_0x070e('0xb')||process[_0x070e('0xa')][0x4]===_0x070e('0xc')){throw new Error(_0x070e('0xd'));}var FIELDS=_['zipObject'](process['argv'][0x3][_0x070e('0xe')](','),process['argv'][0x4]['split'](','));if(!process['argv'][0x5]||process[_0x070e('0xa')][0x5]===_0x070e('0xb')||process['argv'][0x5]==='null'){throw new Error(_0x070e('0xf'));}var LISTID=process[_0x070e('0xa')][0x5];var COMPANYID=process[_0x070e('0xa')][0x6]&&process[_0x070e('0xa')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x070e('0xc')?process[_0x070e('0xa')][0x6]:null;var DUPLICATES=process[_0x070e('0xa')][0x7]&&process[_0x070e('0xa')][0x7]!==_0x070e('0xb')&&process['argv'][0x7]!==_0x070e('0xc')?process[_0x070e('0xa')][0x7]:null;if(!process[_0x070e('0xa')][0x8]||process[_0x070e('0xa')][0x8]===_0x070e('0xb')||process['argv'][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x070e('0xa')][0x8];}catch(_0x3004f0){logger[_0x070e('0x10')](_0x3004f0);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(_0x4be0d7,_0x5b184,_0x5dc5d2,_0xf8dd5d){var _0x3f6985={'message':_0x5b184};_0x3f6985[_0x4be0d7]=!![];if(_0x5dc5d2){_0x3f6985[_0x070e('0x11')]=_0x5dc5d2;}if(_0xf8dd5d){_0x3f6985[_0x070e('0x12')]=_0xf8dd5d;}return _0x3f6985;}function isEmail(_0x28a1c3){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))*$/[_0x070e('0x13')](_0x28a1c3);}function checkRow(_0xe405e,_0x164cdf,_0x595c7e){return new BPromise(function(_0x2f8055,_0x270061){if(_[_0x070e('0x14')](_0xe405e)){return _0x270061(handleCheckRowError('error',_0x070e('0x15'),null,_0x595c7e));}if(_0xe405e['errors']&&_0xe405e['errors'][_0x070e('0x16')]){var _0x25f6e=_[_0x070e('0x17')](_0xe405e[_0x070e('0x18')],_0x070e('0x19'))['join'](';');return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x25f6e,null,_0x595c7e));}var _0x219e48={};for(var _0x1d72d6 in FIELDS){if(FIELDS[_0x070e('0x1a')](_0x1d72d6)&&FIELDS[_0x1d72d6]){_0x219e48[_0x1d72d6]=_0xe405e[_0x070e('0x1b')][0x0][FIELDS[_0x1d72d6]]||_0xe405e[_0x070e('0x1b')][0x0]['\ufeff'+FIELDS[_0x1d72d6]];}}if(!_0x219e48[_0x070e('0x1c')]){return _0x270061(handleCheckRowError(_0x070e('0x10'),'firstName\x20not\x20specified!',null,_0x595c7e));}if(!_0x219e48[_0x070e('0x1d')]){return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x070e('0x1e'),null,_0x595c7e));}if(_0x219e48['birthDate']){var _0x5c5f0d=moment(_0x219e48[_0x070e('0x1f')],_0x070e('0x20'));if(!_0x5c5f0d[_0x070e('0x21')]()){return _0x270061(handleCheckRowError('error',_0x070e('0x22'),null,_0x595c7e));}}if(_0x219e48[_0x070e('0x23')]){if(!isEmail(_0x219e48[_0x070e('0x23')])){return _0x270061(handleCheckRowError(_0x070e('0x10'),'email\x20format\x20is\x20not\x20valid!',null,_0x595c7e));}}_0x219e48['ListId']=LISTID;_0x219e48['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x164cdf){var _0xdf8945={};for(var _0x4e0a7d=0x0,_0x1dff97=DUPLICATES[_0x070e('0x16')];_0x4e0a7d<_0x1dff97;_0x4e0a7d+=0x1){_0xdf8945[DUPLICATES[_0x4e0a7d]]=_0x219e48[DUPLICATES[_0x4e0a7d]];}var _0x4f8130=_['find'](_0x164cdf,_0xdf8945);if(_0x4f8130){return _0x270061(handleCheckRowError(_0x070e('0x24'),_0x070e('0x25'),_0x4f8130,_0x595c7e));}}return db['CmContact']['create'](_0x219e48,{'raw':!![],'hooks':![],'fields':_[_0x070e('0x26')](_0x219e48)})[_0x070e('0x27')](function(_0x444d02){if(DUPLICATES&&DUPLICATES[_0x070e('0x16')]&&_0x164cdf){_0x164cdf[_0x070e('0x28')](_['pick'](_0x219e48,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x444d02['id'];return _0x2f8055();})['catch'](function(_0x24d17d){return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x070e('0x29')+(_0x24d17d[_0x070e('0x19')]||JSON[_0x070e('0x2a')](_0x24d17d)),null,_0x595c7e));});});}function checkHopper(){function _0x4deaf8(){return function(_0x22f3a9){logger[_0x070e('0x10')]('cmContact',_0x070e('0x2b'),util[_0x070e('0x2c')](_0x22f3a9,{'showHidden':![],'depth':null}));};}var _0x4ba6f0=function(_0x4d4ee8,_0x5ddbe9){var _0x363bff=squel[_0x070e('0x2d')]()[_0x070e('0x2e')](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),_0x070e('0x33'),_0x5ddbe9,'createdAt',_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')]('phone',_0x070e('0x1d'))[_0x070e('0x36')]('NOW()',_0x070e('0x31'))['field']('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x4d4ee8['id']['toString'](),_0x5ddbe9)[_0x070e('0x36')]('NOW()','createdAt')[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x34'))['from'](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))[_0x070e('0x3a')]('ListId\x20=\x20?',LISTID[_0x070e('0x37')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0x070e('0x3c'),squel[_0x070e('0x35')]()[_0x070e('0x36')](_0x070e('0x1d'))[_0x070e('0x3d')]('cm_hopper')[_0x070e('0x3a')](_0x5ddbe9+'\x20=\x20?',_0x4d4ee8['id'][_0x070e('0x37')]())))[_0x070e('0x37')]();return _0x363bff;};var _0xff760c=function(_0x52fcea,_0x54285a){var _0x261a27=squel['insert']()[_0x070e('0x2e')](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),'ListId',_0x54285a,'createdAt',_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')](_0x070e('0x1d'),_0x070e('0x1d'))['field'](_0x070e('0x38'),_0x070e('0x31'))[_0x070e('0x36')]('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x52fcea['id'][_0x070e('0x37')](),_0x54285a)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x34'))['from'](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))[_0x070e('0x3a')](_0x070e('0x3f'),LISTID[_0x070e('0x37')]())[_0x070e('0x3a')](_0x070e('0x40'),squel[_0x070e('0x41')](hopperContacts))['where'](_0x070e('0x42'))['where'](_0x070e('0x3c'),squel[_0x070e('0x35')]()['field'](_0x070e('0x43'))[_0x070e('0x3d')](_0x070e('0x44'))[_0x070e('0x3a')](_0x54285a+_0x070e('0x45'),_0x52fcea['id'][_0x070e('0x37')]()))[_0x070e('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x070e('0x35')]()['field']('phone')[_0x070e('0x3d')](_0x070e('0x2f'))[_0x070e('0x3a')](_0x54285a+_0x070e('0x45'),_0x52fcea['id'][_0x070e('0x37')]())))[_0x070e('0x37')]();return _0x261a27;};function _0x440fa1(_0x343785,_0x53bea1){var _0x477e69=squel['insert']()['into'](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),_0x070e('0x33'),_0x53bea1,_0x070e('0x3e'),_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')]('phone','phone')['field'](_0x070e('0x38'),_0x070e('0x31'))[_0x070e('0x36')]('id',_0x070e('0x32'))['field'](LISTID[_0x070e('0x37')](),'ListId')[_0x070e('0x36')](_0x343785['id'][_0x070e('0x37')](),_0x53bea1)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')]('NOW()',_0x070e('0x34'))[_0x070e('0x3d')](_0x070e('0x39'))['where'](_0x070e('0x3b'))[_0x070e('0x3a')]('ListId\x20=\x20?',LISTID[_0x070e('0x37')]())['where'](_0x070e('0x40'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x070e('0x37')]();return _0x477e69;}function _0x1ae5cb(_0x1100d8,_0x122198){var _0x3cb9ee=squel[_0x070e('0x2d')]()['into'](_0x070e('0x46'))['fromQuery']([_0x070e('0x1d'),'ContactId',_0x070e('0x33'),_0x122198,_0x070e('0x3e'),'updatedAt'],squel[_0x070e('0x35')]()['field'](_0x070e('0x1d'),_0x070e('0x1d'))[_0x070e('0x36')]('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x1100d8['id'][_0x070e('0x37')](),_0x122198)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')](_0x070e('0x38'),'updatedAt')[_0x070e('0x3d')](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))['where'](_0x070e('0x3f'),LISTID[_0x070e('0x37')]())[_0x070e('0x3a')](_0x070e('0x40'),squel[_0x070e('0x41')](hopperContacts))[_0x070e('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0x070e('0x37')]();return _0x3cb9ee;}return db[_0x070e('0x47')][_0x070e('0x48')]({'where':{'type':_0x070e('0x49')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x070e('0x4a')],'as':'Lists','where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x36373d){var _0x3a1ad2=[];if(_0x36373d){var _0x150bf6;for(var _0x2a20d4=0x0,_0x50ef9f;_0x2a20d4<_0x36373d[_0x070e('0x16')];_0x2a20d4+=0x1){_0x50ef9f=_0x36373d[_0x2a20d4][_0x070e('0x4b')]({'plain':!![]});switch(_0x50ef9f[_0x070e('0x4c')]){case _0x070e('0x4d'):_0x3a1ad2['push'](db[_0x070e('0x4e')]['query'](_0xff760c(_0x50ef9f,_0x070e('0x4f')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;case'onlyIfOpen':_0x3a1ad2[_0x070e('0x28')](db['sequelize'][_0x070e('0x51')](_0x4ba6f0(_0x50ef9f,'VoiceQueueId'))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;default:_0x3a1ad2['push'](db[_0x070e('0x4e')]['query'](_0x440fa1(_0x50ef9f,_0x070e('0x4f')))[_0x070e('0x27')](function(){})['catch'](_0x4deaf8()));}}}return _0x3a1ad2;})['all']()[_0x070e('0x27')](function(){return db[_0x070e('0x47')][_0x070e('0x48')]({'where':{'type':_0x070e('0x49')},'attributes':['id'],'include':[{'model':db[_0x070e('0x4a')],'as':_0x070e('0x52'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x332c8a){var _0x25b599=[];if(_0x332c8a){var _0x1d1f44;for(var _0x72077d=0x0,_0x25670e;_0x72077d<_0x332c8a[_0x070e('0x16')];_0x72077d+=0x1){_0x25670e=_0x332c8a[_0x72077d]['get']({'plain':!![]});_0x25b599[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0x1ae5cb(_0x25670e,'VoiceQueueId'))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));}}return _0x25b599;})[_0x070e('0x53')]();})[_0x070e('0x27')](function(){return db[_0x070e('0x54')][_0x070e('0x48')]({'attributes':['id',_0x070e('0x4c')],'include':[{'model':db[_0x070e('0x4a')],'as':_0x070e('0x55'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x62800d){var _0x2084a1=[];if(_0x62800d){for(var _0x46ec49=0x0,_0x595e2e;_0x46ec49<_0x62800d['length'];_0x46ec49+=0x1){_0x595e2e=_0x62800d[_0x46ec49]['get']({'plain':!![]});switch(_0x595e2e[_0x070e('0x4c')]){case _0x070e('0x4d'):_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0xff760c(_0x595e2e,_0x070e('0x56')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;case _0x070e('0x57'):_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0x4ba6f0(_0x595e2e,_0x070e('0x56')))['then'](function(){})[_0x070e('0x50')](_0x4deaf8()));break;default:_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')][_0x070e('0x51')](_0x440fa1(_0x595e2e,_0x070e('0x56')))['then'](function(){})[_0x070e('0x50')](_0x4deaf8()));}}}return _0x2084a1;})[_0x070e('0x53')]();})['then'](function(){return db[_0x070e('0x54')][_0x070e('0x48')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x070e('0x52'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0xf0aef8){var _0x4da906=[];if(_0xf0aef8){for(var _0x40d7e6=0x0,_0xe8c476;_0x40d7e6<_0xf0aef8[_0x070e('0x16')];_0x40d7e6+=0x1){_0xe8c476=_0xf0aef8[_0x40d7e6][_0x070e('0x4b')]({'plain':!![]});_0x4da906[_0x070e('0x28')](db[_0x070e('0x4e')][_0x070e('0x51')](_0x1ae5cb(_0xe8c476,_0x070e('0x56')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));}}return _0x4da906;})[_0x070e('0x53')]();})[_0x070e('0x50')](function(_0x18c27a){logger['error'](_0x070e('0x58'),_0x070e('0x59'),_0x18c27a[_0x070e('0x19')]);});}var processPromises=function(_0x1b71dd){return BPromise[_0x070e('0x53')](promises)[_0x070e('0x27')](function(_0x5c4352){})['catch'](function(_0x4a8563){logger[_0x070e('0x10')](_0x070e('0x5a'),JSON[_0x070e('0x2a')](_0x4a8563));})[_0x070e('0x5b')](function(){socket['emit'](_0x070e('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1b71dd){return _0x1b71dd[_0x070e('0x5d')]();}});};var endCsv=function(){return BPromise[_0x070e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x070e('0x27')](function(){socket['emit'](_0x070e('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x070e('0x5f')](FILEPATH);}catch(_0x59e6e5){logger['error'](_0x070e('0x60'),JSON[_0x070e('0x2a')](_0x59e6e5));}finally{process['exit'](0x0);}});};process['on'](_0x070e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x070e('0x27')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x070e('0xe')](',');return db[_0x070e('0x62')][_0x070e('0x48')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x070e('0x27')](function(_0x341756){var _0x2a12a1=fs[_0x070e('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x070e('0x64')](_0x2a12a1,{'header':!![],'skipEmptyLines':!![],'step':function(_0xdcc60a,_0x4e0f6e){total+=0x1;var _0x1306e6=total;promises[_0x070e('0x28')](checkRow(_0xdcc60a,_0x341756,_0x1306e6)[_0x070e('0x27')](function(){success+=0x1;})[_0x070e('0x50')](function(_0x3f2bb5){if(_0x3f2bb5[_0x070e('0x10')]){errors+=0x1;delete _0x3f2bb5[_0x070e('0x10')];}else if(_0x3f2bb5[_0x070e('0x24')]){duplicates+=0x1;delete _0x3f2bb5[_0x070e('0x24')];}rows[_0x070e('0x28')](_0x3f2bb5);}));if(total%0xc8===0x0){_0x4e0f6e[_0x070e('0x65')]();return processPromises(_0x4e0f6e);}},'complete':function(){return processPromises()['then'](function(){logger[_0x070e('0x66')](_0x070e('0x67'));endCsv();});},'error':function(_0x449337,_0xe50b1b){logger['info'](_0x070e('0x68'),JSON[_0x070e('0x2a')](_0x449337));endCsv();}});})[_0x070e('0x50')](function(_0x2bad43){logger[_0x070e('0x10')](_0x070e('0x69'),JSON['stringify'](_0x2bad43));});}main(); \ No newline at end of file +var _0xb7e7=['birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ContactId','cm_contacts','where','str','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','map','join','data','phone','phone\x20not\x20specified!'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xb7e7[_0x297fd3];return _0x2af381;};'use strict';var BPromise=require(_0x7b7e('0x0'));var util=require('util');var _=require(_0x7b7e('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x7b7e('0x2'));var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var config=require('../../../config/environment');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));config[_0x7b7e('0x6')]=_['defaults'](config['redis'],{'host':_0x7b7e('0x7'),'port':0x18eb});var socket=require(_0x7b7e('0x8'))(new Redis(config[_0x7b7e('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x7b7e('0x9')](socket);try{if(!process[_0x7b7e('0xa')][0x2]||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xc')){throw new Error(_0x7b7e('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0x7b7e('0xa')][0x3]||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xc')||!process[_0x7b7e('0xa')][0x4]||process[_0x7b7e('0xa')][0x4]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x4]==='null'){throw new Error(_0x7b7e('0xe'));}var FIELDS=_[_0x7b7e('0xf')](process['argv'][0x3][_0x7b7e('0x10')](','),process['argv'][0x4]['split'](','));if(!process[_0x7b7e('0xa')][0x5]||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7b7e('0xa')][0x6]&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x6]:null;var DUPLICATES=process[_0x7b7e('0xa')][0x7]&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x7]:null;if(!process[_0x7b7e('0xa')][0x8]||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7b7e('0xa')][0x8];}catch(_0x43db4f){logger[_0x7b7e('0x11')](_0x43db4f);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4c0647,_0x313122,_0xbf0cb3,_0x14243b){var _0x200156={'message':_0x313122};_0x200156[_0x4c0647]=!![];if(_0xbf0cb3){_0x200156[_0x7b7e('0x12')]=_0xbf0cb3;}if(_0x14243b){_0x200156[_0x7b7e('0x13')]=_0x14243b;}return _0x200156;}function isEmail(_0x28bf43){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x7b7e('0x14')](_0x28bf43);}function checkRow(_0x53bbb3,_0x5d6215,_0x4a836a){return new BPromise(function(_0x26ee14,_0x22598e){if(_[_0x7b7e('0x15')](_0x53bbb3)){return _0x22598e(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4a836a));}if(_0x53bbb3['errors']&&_0x53bbb3[_0x7b7e('0x16')][_0x7b7e('0x17')]){var _0x16a3c7=_[_0x7b7e('0x18')](_0x53bbb3[_0x7b7e('0x16')],'message')[_0x7b7e('0x19')](';');return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x16a3c7,null,_0x4a836a));}var _0x4c46b8={};for(var _0x57b9da in FIELDS){if(FIELDS['hasOwnProperty'](_0x57b9da)&&FIELDS[_0x57b9da]){_0x4c46b8[_0x57b9da]=_0x53bbb3[_0x7b7e('0x1a')][0x0][FIELDS[_0x57b9da]]||_0x53bbb3[_0x7b7e('0x1a')][0x0]['\ufeff'+FIELDS[_0x57b9da]];}}if(!_0x4c46b8['firstName']){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'firstName\x20not\x20specified!',null,_0x4a836a));}if(!_0x4c46b8[_0x7b7e('0x1b')]){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x1c'),null,_0x4a836a));}if(_0x4c46b8['birthDate']){var _0x3960b8=moment(_0x4c46b8[_0x7b7e('0x1d')],_0x7b7e('0x1e'));if(!_0x3960b8[_0x7b7e('0x1f')]()){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4a836a));}}if(_0x4c46b8[_0x7b7e('0x20')]){if(!isEmail(_0x4c46b8['email'])){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x21'),null,_0x4a836a));}}_0x4c46b8[_0x7b7e('0x22')]=LISTID;_0x4c46b8[_0x7b7e('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){var _0x247ea0={};for(var _0x29cb58=0x0,_0x4bfe7f=DUPLICATES['length'];_0x29cb58<_0x4bfe7f;_0x29cb58+=0x1){_0x247ea0[DUPLICATES[_0x29cb58]]=_0x4c46b8[DUPLICATES[_0x29cb58]];}var _0xebcdbc=_[_0x7b7e('0x24')](_0x5d6215,_0x247ea0);if(_0xebcdbc){return _0x22598e(handleCheckRowError('duplicate',_0x7b7e('0x25'),_0xebcdbc,_0x4a836a));}}return db[_0x7b7e('0x26')][_0x7b7e('0x27')](_0x4c46b8,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4c46b8)})[_0x7b7e('0x28')](function(_0x256908){if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){_0x5d6215[_0x7b7e('0x29')](_[_0x7b7e('0x2a')](_0x4c46b8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x256908['id'];return _0x26ee14();})[_0x7b7e('0x2b')](function(_0x3e8cf4){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x2c')+(_0x3e8cf4[_0x7b7e('0x2d')]||JSON[_0x7b7e('0x2e')](_0x3e8cf4)),null,_0x4a836a));});});}function checkHopper(){function _0x2d0620(){return function(_0x442366){logger[_0x7b7e('0x11')](_0x7b7e('0x2f'),_0x7b7e('0x30'),util['inspect'](_0x442366,{'showHidden':![],'depth':null}));};}var _0x8c80d5=function(_0x156dca,_0xb20532){var _0x242609=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),'ContactId',_0x7b7e('0x22'),_0xb20532,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))[_0x7b7e('0x39')]('NOW()','scheduledAt')[_0x7b7e('0x39')]('id','ContactId')[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x156dca['id'][_0x7b7e('0x3a')](),_0xb20532)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID['toString']())['where'](_0x7b7e('0x3f'))['where'](_0x7b7e('0x40'),squel['select']()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xb20532+_0x7b7e('0x41'),_0x156dca['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x242609;};var _0x37895a=function(_0x3e4f21,_0xccdfc7){var _0x5e8572=squel['insert']()['into'](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0xccdfc7,'createdAt',_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))['field'](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x3e4f21['id'][_0x7b7e('0x3a')](),_0xccdfc7)[_0x7b7e('0x39')](_0x7b7e('0x3b'),'createdAt')[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())[_0x7b7e('0x44')]('id\x20IN\x20?',squel[_0x7b7e('0x45')](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f'))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')]('calleridnum')[_0x7b7e('0x3c')]('cm_hopper_final')[_0x7b7e('0x44')](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id']['toString']()))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x5e8572;};function _0x24481a(_0x5b9ab5,_0x527403){var _0x5bdf1d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))['fromQuery'](['phone',_0x7b7e('0x35'),_0x7b7e('0x42'),'ListId',_0x527403,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5b9ab5['id'][_0x7b7e('0x3a')](),_0x527403)['field'](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')[_0x7b7e('0x44')]('deletedAt\x20IS\x20NULL')[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID['toString']())[_0x7b7e('0x44')](_0x7b7e('0x46'),squel['str'](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x5bdf1d;}function _0x3b1adb(_0x5eb32c,_0x101896){var _0x73904d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x47'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0x101896,_0x7b7e('0x36'),'updatedAt'],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID['toString'](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5eb32c['id'][_0x7b7e('0x3a')](),_0x101896)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),'updatedAt')['from'](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())['where'](_0x7b7e('0x46'),squel[_0x7b7e('0x45')](hopperContacts))['where'](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x73904d;}return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id',_0x7b7e('0x4b')],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x17e5ba){var _0x589b02=[];if(_0x17e5ba){var _0x59ecf9;for(var _0x34e7df=0x0,_0x46ac1f;_0x34e7df<_0x17e5ba[_0x7b7e('0x17')];_0x34e7df+=0x1){_0x46ac1f=_0x17e5ba[_0x34e7df][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x46ac1f[_0x7b7e('0x4b')]){case _0x7b7e('0x4f'):_0x589b02[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x46ac1f,_0x7b7e('0x51')))['then'](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case _0x7b7e('0x52'):_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x46ac1f,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x46ac1f,'VoiceQueueId'))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x589b02;})[_0x7b7e('0x54')]()[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1eb5ce){var _0x49f0a4=[];if(_0x1eb5ce){var _0x1d6aa4;for(var _0x195ae2=0x0,_0x381ee6;_0x195ae2<_0x1eb5ce[_0x7b7e('0x17')];_0x195ae2+=0x1){_0x381ee6=_0x1eb5ce[_0x195ae2][_0x7b7e('0x4e')]({'plain':!![]});_0x49f0a4['push'](db['sequelize']['query'](_0x3b1adb(_0x381ee6,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}return _0x49f0a4;})['all']();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x34a06c){var _0x538c5f=[];if(_0x34a06c){for(var _0x315923=0x0,_0x40b4ae;_0x315923<_0x34a06c[_0x7b7e('0x17')];_0x315923+=0x1){_0x40b4ae=_0x34a06c[_0x315923][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x40b4ae['dialCheckDuplicateType']){case'always':_0x538c5f[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case'onlyIfOpen':_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x538c5f;})[_0x7b7e('0x54')]();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1d9e08){var _0xa03d7a=[];if(_0x1d9e08){for(var _0x10c35e=0x0,_0x302462;_0x10c35e<_0x1d9e08[_0x7b7e('0x17')];_0x10c35e+=0x1){_0x302462=_0x1d9e08[_0x10c35e]['get']({'plain':!![]});_0xa03d7a[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x3b1adb(_0x302462,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})['catch'](_0x2d0620()));}}return _0xa03d7a;})['all']();})[_0x7b7e('0x2b')](function(_0x110f2b){logger[_0x7b7e('0x11')](_0x7b7e('0x58'),_0x7b7e('0x59'),_0x110f2b[_0x7b7e('0x2d')]);});}var processPromises=function(_0x2c65b8){return BPromise[_0x7b7e('0x54')](promises)[_0x7b7e('0x28')](function(_0x850d0f){})['catch'](function(_0x27402a){logger[_0x7b7e('0x11')](_0x7b7e('0x5a'),JSON[_0x7b7e('0x2e')](_0x27402a));})[_0x7b7e('0x5b')](function(){socket[_0x7b7e('0x5c')](_0x7b7e('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2c65b8){return _0x2c65b8['resume']();}});};var endCsv=function(){return BPromise[_0x7b7e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7b7e('0x28')](function(){socket[_0x7b7e('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7b7e('0x5f')](FILEPATH);}catch(_0x38fd40){logger[_0x7b7e('0x11')](_0x7b7e('0x60'),JSON[_0x7b7e('0x2e')](_0x38fd40));}finally{process['exit'](0x0);}});};process['on'](_0x7b7e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7b7e('0x5e')]()[_0x7b7e('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7b7e('0x10')](',');return db[_0x7b7e('0x26')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7b7e('0x28')](function(_0x5cedd4){var _0x25233a=fs[_0x7b7e('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7b7e('0x63')](_0x25233a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e71ab,_0x11d615){total+=0x1;var _0x3afd15=total;promises[_0x7b7e('0x29')](checkRow(_0x1e71ab,_0x5cedd4,_0x3afd15)['then'](function(){success+=0x1;})[_0x7b7e('0x2b')](function(_0x30eeee){if(_0x30eeee['error']){errors+=0x1;delete _0x30eeee[_0x7b7e('0x11')];}else if(_0x30eeee[_0x7b7e('0x64')]){duplicates+=0x1;delete _0x30eeee[_0x7b7e('0x64')];}rows[_0x7b7e('0x29')](_0x30eeee);}));if(total%0xc8===0x0){_0x11d615[_0x7b7e('0x65')]();return processPromises(_0x11d615);}},'complete':function(){return processPromises()[_0x7b7e('0x28')](function(){logger[_0x7b7e('0x66')](_0x7b7e('0x67'));endCsv();});},'error':function(_0x41e2b5,_0x97232d){logger[_0x7b7e('0x66')](_0x7b7e('0x68'),JSON[_0x7b7e('0x2e')](_0x41e2b5));endCsv();}});})[_0x7b7e('0x2b')](function(_0x12d0cb){logger[_0x7b7e('0x11')](_0x7b7e('0x69'),JSON[_0x7b7e('0x2e')](_0x12d0cb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index e15742c..9a62a1f 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 _0x7498=['catch','stringify','binding','root','server/files/tmp','.csv','header','writeFileSync','createReadStream','data','length','rows','errors','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','appendFileSync','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns','CampaignId','each','then','finish','affectedRows','contact:import:','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','join','cm_contacts.phone','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.id','cm_contacts.createdAt','cm_hopper_black','updatedAt','ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','info','error','message','exit','code','sequelize','query','push'];(function(_0x27ccb6,_0x103913){var _0x412043=function(_0x3c1624){while(--_0x3c1624){_0x27ccb6['push'](_0x27ccb6['shift']());}};_0x412043(++_0x103913);}(_0x7498,0xc5));var _0x8749=function(_0x2c62d9,_0x1c432a){_0x2c62d9=_0x2c62d9-0x0;var _0x21f091=_0x7498[_0x2c62d9];return _0x21f091;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x8749('0x0'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x8749('0x1'));var moment=require(_0x8749('0x2'));var squel=require(_0x8749('0x3'));var Redis=require(_0x8749('0x4'));var db=require(_0x8749('0x5'))['db'];var config=require(_0x8749('0x6'));var logger=require(_0x8749('0x7'))(_0x8749('0x8'));config[_0x8749('0x9')]=_['defaults'](config[_0x8749('0x9')],{'host':_0x8749('0xa'),'port':0x18eb});var socket=require(_0x8749('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x8749('0xc')](_0x8749('0xd'));function isEmail(_0x821f22){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))*$/[_0x8749('0xe')](_0x821f22);}function selectNotIn(_0x3f14bf,_0x28a0d3,_0x5cc567,_0x2f835e,_0x16e443){return squel[_0x8749('0xf')]()[_0x8749('0x10')](_0x8749('0x11'))[_0x8749('0x12')](_0x2f835e)['join'](_0x28a0d3,null,_0x28a0d3+_0x8749('0x13')+_0x2f835e+'.'+_0x5cc567)[_0x8749('0x14')](_0x2f835e+'.'+_0x5cc567+_0x8749('0x15')+_0x3f14bf+'.'+_0x5cc567)[_0x8749('0x14')](_0x28a0d3+'.dialCheckDuplicateType\x20IN\x20('+_0x16e443[_0x8749('0x16')]()+')');}function insertCmHopper(_0x33e9d5,_0x25dab3,_0xf920a7,_0x59f955,_0x2379c6){var _0x2aaac3=[_0x8749('0x17'),'cm_contacts.scheduledat','cm_contacts.id',_0x8749('0x18'),_0x25dab3+'.'+_0x59f955,'cm_contacts.createdAt',_0x8749('0x19'),_0x8749('0x1a'),_0x8749('0x1b'),'\x22'+_0x2379c6+'\x22'];return squel[_0x8749('0x1c')]()[_0x8749('0x1d')](_0x8749('0x1e'))[_0x8749('0x1f')]([_0x8749('0x11'),_0x8749('0x20'),_0x8749('0x21'),_0x8749('0x22'),_0x59f955,_0x8749('0x23'),'updatedAt',_0x8749('0x24'),_0x8749('0x25'),'recallme'],squel[_0x8749('0xf')]()[_0x8749('0x26')](_0x2aaac3)['from'](_0x25dab3)[_0x8749('0x16')](_0x8749('0x27'),null,_0x8749('0x28')+_0x25dab3+_0x8749('0x29'))[_0x8749('0x16')](_0xf920a7,null,_0xf920a7+_0x8749('0x13')+_0x25dab3+'.'+_0x59f955)[_0x8749('0x14')](_0x25dab3+_0x8749('0x2a'),_0x33e9d5)[_0x8749('0x14')](_0x8749('0x2b'),NOW)[_0x8749('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x25dab3,_0xf920a7,_0x59f955,_0x8749('0x1e'),[_0x8749('0x2c'),_0x8749('0x2d')]))[_0x8749('0x14')](_0x8749('0x2e'),selectNotIn(_0x25dab3,_0xf920a7,_0x59f955,_0x8749('0x1e'),[_0x8749('0x2c')])))[_0x8749('0x2f')]();}function insertCmHopperBlack(_0x401918,_0x441f63,_0x752c3d,_0x3a85c9){var _0x229afd=['cm_contacts.phone',_0x8749('0x30'),_0x8749('0x18'),_0x441f63+'.'+_0x3a85c9,_0x8749('0x31'),_0x8749('0x19')];return squel[_0x8749('0x1c')]()[_0x8749('0x1d')](_0x8749('0x32'))[_0x8749('0x1f')]([_0x8749('0x11'),_0x8749('0x21'),_0x8749('0x22'),_0x3a85c9,'createdAt',_0x8749('0x33')],squel[_0x8749('0xf')]()[_0x8749('0x26')](_0x229afd)[_0x8749('0x12')](_0x441f63)[_0x8749('0x16')](_0x8749('0x27'),null,'cm_contacts.ListId\x20=\x20'+_0x441f63+_0x8749('0x29'))[_0x8749('0x16')](_0x752c3d,null,_0x752c3d+_0x8749('0x13')+_0x441f63+'.'+_0x3a85c9)['where'](_0x441f63+'.CmListId\x20=\x20?',_0x401918)[_0x8749('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8749('0x14')](_0x8749('0x2e'),squel[_0x8749('0xf')]()[_0x8749('0x10')](_0x8749('0x11'))[_0x8749('0x12')](_0x8749('0x32'))['where'](_0x8749('0x34'),_0x401918)[_0x8749('0x14')](_0x3a85c9+'\x20=\x20?',_0x441f63+'.'+_0x3a85c9)))[_0x8749('0x2f')]();}function insertCmContact(_0x24bafe,_0x1884cc,_0x119cb4,_0x1efac8){var _0x102963=_[_0x8749('0x35')](_[_0x8749('0x36')](_0x1efac8),['ListId',_0x8749('0x37'),_0x8749('0x23'),_0x8749('0x33')]);return squel[_0x8749('0x1c')]()[_0x8749('0x1d')](_0x8749('0x27'))[_0x8749('0x1f')](_0x102963,squel[_0x8749('0xf')]()['fields'](_0x102963)[_0x8749('0x12')](_0x1884cc)['where']('('+_0x119cb4[_0x8749('0x16')](',')+_0x8749('0x38'),squel[_0x8749('0xf')]()['fields'](_0x119cb4)[_0x8749('0x12')](_0x8749('0x27'))[_0x8749('0x14')](_0x8749('0x34'),_0x24bafe)[_0x8749('0x14')]('deletedAt\x20IS\x20NULL'))['where'](_0x8749('0x39'),squel['select']()['field']('MIN(id)',_0x8749('0x3a'))['from'](_0x1884cc)['group'](_0x119cb4[_0x8749('0x16')](','))))[_0x8749('0x2f')]();}function handleStop(){logger[_0x8749('0x3b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3c9d4c){logger[_0x8749('0x3c')](_0x3c9d4c[_0x8749('0x3d')]);process[_0x8749('0x3e')](0x1);}function handleError(_0x2f3668,_0x17d5aa){stats['errors']['push']({'name':_0x17d5aa[_0x8749('0x3f')],'message':_0x17d5aa['message'],'row':_0x2f3668});}function handleQuery(_0x5d1de6){logger[_0x8749('0x3b')](_0x5d1de6);return db[_0x8749('0x40')][_0x8749('0x41')](_0x5d1de6)['spread'](function(_0x2d5fe3){results[_0x8749('0x42')](_0x2d5fe3);})[_0x8749('0x43')](function(_0x286247){logger['error'](_0x286247[_0x8749('0x3d')]);});}function main(_0x4eaa73,_0x3aab0c,_0x1e359d,_0x102980){logger[_0x8749('0x3b')]('main',_0x4eaa73,JSON[_0x8749('0x44')](_0x3aab0c));process['send']('start');var _0x1db0ee=_0x3aab0c[_0x8749('0x45')];var _0x3d7e08=_0x3aab0c['socket_timestamp'];var _0x2cc6c9=path[_0x8749('0x16')](config[_0x8749('0x46')],_0x8749('0x47'),_0x3d7e08+_0x8749('0x48'));var _0x1b0d57=_[_0x8749('0x36')](_0x1db0ee)['join']();logger[_0x8749('0x3b')](_0x8749('0x49'),_0x1b0d57);fs[_0x8749('0x4a')](_0x2cc6c9,_0x1b0d57+'\x0a');Papa['parse'](fs[_0x8749('0x4b')](_0x4eaa73),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3599a5,_0x188098){try{for(var _0x4530ac=0x0,_0x527e95=[];_0x4530ac<_0x3599a5[_0x8749('0x4c')][_0x8749('0x4d')];_0x4530ac++){stats[_0x8749('0x4e')]+=0x1;if(_0x3599a5[_0x8749('0x4f')][_0x4530ac]){handleError(_0x3599a5['data'][_0x4530ac],_0x3599a5[_0x8749('0x4f')][_0x4530ac]);}else{var _0xea38c4=[];for(var _0x1f0747 in _0x1db0ee){if(_0x1db0ee[_0x8749('0x50')](_0x1f0747)){if(_0x3599a5[_0x8749('0x4c')][_0x4530ac][_0x1db0ee[_0x1f0747]]){var _0x35d241=_[_0x8749('0x51')](_0x3599a5[_0x8749('0x4c')][_0x4530ac][_0x1db0ee[_0x1f0747]][_0x8749('0x52')](/"/g,'\x27'));switch(_0x1f0747){case _0x8749('0x20'):var _0x2c0706=moment(_0x35d241,_0x8749('0xd'),!![]);if(_0x2c0706[_0x8749('0x53')]()){_0x527e95[_0x8749('0x42')]('\x22'+_0x35d241+'\x22');}else{_0xea38c4['push'](_0x8749('0x54'));}break;case _0x8749('0x24'):var _0x31ba6f=parseInt(_0x35d241);_0x35d241=_[_0x8749('0x55')](_0x31ba6f)||_0x31ba6f<0x0||_0x31ba6f>0x4?_0x102980?0x3:0x2:_0x31ba6f;_0x527e95[_0x8749('0x42')]('\x22'+_0x35d241+'\x22');break;case'UserId':var _0x43400f=parseInt(_0x35d241);if(_[_0x8749('0x56')](_0x43400f)&&_[_0x8749('0x57')](_0x1e359d,_0x43400f)){_0x527e95[_0x8749('0x42')]('\x22'+_0x43400f+'\x22');}else{_0xea38c4[_0x8749('0x42')](_0x8749('0x58'));}break;case _0x8749('0x59'):if(isEmail(_0x35d241)){_0x527e95['push']('\x22'+_0x35d241+'\x22');}else{_0xea38c4[_0x8749('0x42')](_0x8749('0x5a'));}break;case _0x8749('0x5b'):var _0x35d926=moment(_0x35d241,'YYYY-MM-DD',!![]);if(_0x35d926['isValid']()){_0x527e95[_0x8749('0x42')]('\x22'+_0x35d241+'\x22');}else{_0xea38c4[_0x8749('0x42')](_0x8749('0x5c'));}break;default:_0x527e95[_0x8749('0x42')]('\x22'+_0x35d241+'\x22');}}else{switch(_0x1f0747){case'firstName':case _0x8749('0x11'):_0xea38c4[_0x8749('0x42')](_0x1f0747+_0x8749('0x5d'));break;default:_0x527e95[_0x8749('0x42')]('\x22\x22');}}}}if(_0xea38c4[_0x8749('0x4d')]){handleError(_0x3599a5[_0x8749('0x4c')][_0x4530ac],{'code':_0x8749('0x5e'),'message':_0xea38c4[_0x8749('0x16')]()});}else{fs[_0x8749('0x5f')](_0x2cc6c9,_0x527e95['join']()+'\x0a');}_0x527e95=[];}if(!(stats[_0x8749('0x4e')]%0xc8)){socket['emit']('contact:import:'+_0x3d7e08,stats);stats['errors']=[];}}if(stopped){logger[_0x8749('0x3b')](_0x8749('0x60'));_0x188098[_0x8749('0x61')]();}}catch(_0x5901b2){handleError(_0x3599a5[_0x8749('0x4c')][_0x4530ac],{'code':_0x8749('0x62'),'message':_0x5901b2[_0x8749('0x3d')]});logger[_0x8749('0x3c')](_0x8749('0x63'),_0x5901b2[_0x8749('0x3d')]);}},'complete':function(){try{var _0x20c8a3=[];var _0x54cc0a=_0x8749('0x27');if(_0x3aab0c[_0x8749('0x64')]&&_0x3aab0c[_0x8749('0x64')][_0x8749('0x4d')]){_0x54cc0a=_0x8749('0x65')+_0x3d7e08;_0x20c8a3['push'](_0x8749('0x66')+_0x54cc0a+_0x8749('0x67'));}var _0x25739c=util[_0x8749('0xc')]('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',_0x2cc6c9,_0x54cc0a,_0x1b0d57,_0x3aab0c[_0x8749('0x22')],_0x3aab0c[_0x8749('0x37')]||null,NOW,NOW);if(_[_0x8749('0x68')](_0x1db0ee['scheduledat'])){_0x25739c+=_0x8749('0x69');}_0x20c8a3[_0x8749('0x42')](_0x25739c);if(_0x3aab0c[_0x8749('0x64')]&&_0x3aab0c[_0x8749('0x64')][_0x8749('0x4d')]){_0x20c8a3['push'](insertCmContact(_0x3aab0c[_0x8749('0x22')],_0x54cc0a,_0x3aab0c[_0x8749('0x64')],_0x1db0ee));_0x20c8a3[_0x8749('0x42')](_0x8749('0x6a')+_0x54cc0a+';');}_0x20c8a3[_0x8749('0x42')](insertCmHopper(_0x3aab0c[_0x8749('0x22')],_0x8749('0x6b'),_0x8749('0x6c'),'VoiceQueueId',_0x102980));_0x20c8a3[_0x8749('0x42')](insertCmHopperBlack(_0x3aab0c[_0x8749('0x22')],_0x8749('0x6d'),_0x8749('0x6c'),_0x8749('0x6e')));_0x20c8a3['push'](insertCmHopper(_0x3aab0c[_0x8749('0x22')],'campaigns_has_cm_lists',_0x8749('0x6f'),_0x8749('0x70'),_0x102980));_0x20c8a3[_0x8749('0x42')](insertCmHopperBlack(_0x3aab0c[_0x8749('0x22')],'campaigns_has_cm_blacklists',_0x8749('0x6f'),_0x8749('0x70')));BPromise[_0x8749('0x71')](_0x20c8a3,handleQuery)[_0x8749('0x72')](function(_0x1e0ed1){stats[_0x8749('0x73')]=!![];stats[_0x8749('0x74')]=_0x3aab0c['duplicates']&&_0x3aab0c['duplicates'][_0x8749('0x4d')]?results[0x2]['affectedRows']:results[0x0][_0x8749('0x74')];socket['emit'](_0x8749('0x75')+_0x3d7e08,stats);fs['unlink'](_0x4eaa73);fs['unlink'](_0x2cc6c9);process[_0x8749('0x3e')](0x0);})[_0x8749('0x43')](function(_0x1c15c5){logger[_0x8749('0x3c')](_0x1c15c5[_0x8749('0x3d')]);process[_0x8749('0x3e')](0x1);});}catch(_0x397911){logger[_0x8749('0x3c')]('complete',_0x397911[_0x8749('0x3d')]);process['exit'](0x1);}},'error':function(_0x42ca27,_0x54e30b,_0x1bc9f1,_0x33d856){throw new Error(_0x33d856);}});}function validate(){if(process[_0x8749('0x76')]&&process[_0x8749('0x76')][_0x8749('0x4d')]<0x4){throw new Error(_0x8749('0x77'));}var _0xd063e3=path[_0x8749('0x16')](config[_0x8749('0x46')],'server/files/tmp',process[_0x8749('0x76')][0x2]);if(!fs[_0x8749('0x78')](_0xd063e3)){throw new Error(_0x8749('0x79'));}var _0x47a604={};try{_0x47a604=JSON[_0x8749('0x7a')](process[_0x8749('0x76')][0x3]);if(!_0x47a604[_0x8749('0x45')]){throw new Error(_0x8749('0x7b'));}if(!_0x47a604[_0x8749('0x45')][_0x8749('0x11')]){throw new Error(_0x8749('0x7c'));}if(!_0x47a604[_0x8749('0x45')][_0x8749('0x7d')]){throw new Error('firstName\x20is\x20mandatory');}var _0x27cb44=0x0;if(_0x47a604[_0x8749('0x45')][_0x8749('0x25')]){_0x27cb44=0x1;}if(!_0x47a604[_0x8749('0x22')]){throw new Error(_0x8749('0x7e'));}}catch(_0x179a52){throw new Error(_0x8749('0x7f'));}var _0x491900=[];try{_0x491900=_[_0x8749('0x80')](JSON['parse'](process[_0x8749('0x76')][0x4]),'id');}catch(_0x8ad7b8){logger[_0x8749('0x3b')](_0x8749('0x81'));}main(_0xd063e3,_0x47a604,_0x491900,_0x27cb44);}validate();process['on'](_0x8749('0x82'),handleStop);process['on'](_0x8749('0x83'),handleUncaughtException); \ No newline at end of file +var _0x0c55=['phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','select','field','from','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','into','cm_hopper','fromQuery','phone','scheduledat','ListId','createdAt','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','insert','cm_hopper_black','ContactId','updatedAt','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId','cm_contacts','deletedAt\x20IS\x20NULL','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','main','stringify','send','start','socket_timestamp','root','.csv','header','writeFileSync','parse','data','length','rows','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNumber','agent\x20not\x20exists','email','dateOfBirth','isValid','firstName','SystemRow','contact:import:','Abort\x20parser','SystemError','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()','voice_queues_has_cm_blacklists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','each','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x0c55,0x185));var _0x50c5=function(_0x35b68e,_0x17f1bf){_0x35b68e=_0x35b68e-0x0;var _0x18eeed=_0x0c55[_0x35b68e];return _0x18eeed;};'use strict';var fs=require('fs');var path=require(_0x50c5('0x0'));var _=require(_0x50c5('0x1'));var Papa=require('papaparse');var util=require(_0x50c5('0x2'));var BPromise=require('bluebird');var moment=require(_0x50c5('0x3'));var squel=require(_0x50c5('0x4'));var Redis=require(_0x50c5('0x5'));var db=require(_0x50c5('0x6'))['db'];var config=require(_0x50c5('0x7'));var logger=require(_0x50c5('0x8'))('import');config[_0x50c5('0x9')]=_[_0x50c5('0xa')](config[_0x50c5('0x9')],{'host':_0x50c5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x50c5('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x50c5('0xc')](_0x50c5('0xd'));function isEmail(_0x388832){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x388832);}function selectNotIn(_0x1fb553,_0x2bfabf,_0x2b7e87,_0x51b1e5,_0x25e5e1){return squel[_0x50c5('0xe')]()[_0x50c5('0xf')]('phone')[_0x50c5('0x10')](_0x51b1e5)['join'](_0x2bfabf,null,_0x2bfabf+_0x50c5('0x11')+_0x51b1e5+'.'+_0x2b7e87)['where'](_0x51b1e5+'.'+_0x2b7e87+_0x50c5('0x12')+_0x1fb553+'.'+_0x2b7e87)['where'](_0x2bfabf+_0x50c5('0x13')+_0x25e5e1[_0x50c5('0x14')]()+')');}function insertCmHopper(_0x4e094a,_0x426777,_0x2ad3a1,_0xb65261,_0x174e0d){var _0x3ddbd1=[_0x50c5('0x15'),_0x50c5('0x16'),_0x50c5('0x17'),'cm_contacts.ListId',_0x426777+'.'+_0xb65261,_0x50c5('0x18'),_0x50c5('0x19'),'cm_contacts.priority',_0x50c5('0x1a'),'\x22'+_0x174e0d+'\x22'];return squel['insert']()[_0x50c5('0x1b')](_0x50c5('0x1c'))[_0x50c5('0x1d')]([_0x50c5('0x1e'),_0x50c5('0x1f'),'ContactId',_0x50c5('0x20'),_0xb65261,_0x50c5('0x21'),'updatedAt','priority',_0x50c5('0x22'),_0x50c5('0x23')],squel[_0x50c5('0xe')]()[_0x50c5('0x24')](_0x3ddbd1)[_0x50c5('0x10')](_0x426777)[_0x50c5('0x14')]('cm_contacts',null,_0x50c5('0x25')+_0x426777+_0x50c5('0x26'))[_0x50c5('0x14')](_0x2ad3a1,null,_0x2ad3a1+_0x50c5('0x11')+_0x426777+'.'+_0xb65261)[_0x50c5('0x27')](_0x426777+_0x50c5('0x28'),_0x4e094a)['where'](_0x50c5('0x29'),NOW)[_0x50c5('0x27')](_0x50c5('0x2a'),selectNotIn(_0x426777,_0x2ad3a1,_0xb65261,_0x50c5('0x1c'),[_0x50c5('0x2b'),_0x50c5('0x2c')]))['where'](_0x50c5('0x2a'),selectNotIn(_0x426777,_0x2ad3a1,_0xb65261,'cm_hopper',['\x22always\x22'])))[_0x50c5('0x2d')]();}function insertCmHopperBlack(_0x2de940,_0x3c8095,_0x936292,_0x85484a){var _0x352b46=[_0x50c5('0x15'),_0x50c5('0x17'),_0x50c5('0x2e'),_0x3c8095+'.'+_0x85484a,'cm_contacts.createdAt',_0x50c5('0x19')];return squel[_0x50c5('0x2f')]()['into'](_0x50c5('0x30'))[_0x50c5('0x1d')](['phone',_0x50c5('0x31'),_0x50c5('0x20'),_0x85484a,'createdAt',_0x50c5('0x32')],squel[_0x50c5('0xe')]()[_0x50c5('0x24')](_0x352b46)[_0x50c5('0x10')](_0x3c8095)[_0x50c5('0x14')]('cm_contacts',null,_0x50c5('0x25')+_0x3c8095+_0x50c5('0x26'))[_0x50c5('0x14')](_0x936292,null,_0x936292+_0x50c5('0x11')+_0x3c8095+'.'+_0x85484a)[_0x50c5('0x27')](_0x3c8095+_0x50c5('0x28'),_0x2de940)[_0x50c5('0x27')](_0x50c5('0x29'),NOW)[_0x50c5('0x27')](_0x50c5('0x2a'),squel[_0x50c5('0xe')]()[_0x50c5('0xf')]('phone')['from'](_0x50c5('0x30'))[_0x50c5('0x27')](_0x50c5('0x33'),_0x2de940)[_0x50c5('0x27')](_0x85484a+_0x50c5('0x34'),_0x3c8095+'.'+_0x85484a)))['toString']();}function insertCmContact(_0x6049c1,_0x2933c0,_0x56952a,_0x5302d1){var _0x31cb08=_['concat'](_[_0x50c5('0x35')](_0x5302d1),[_0x50c5('0x20'),_0x50c5('0x36'),_0x50c5('0x21'),_0x50c5('0x32')]);return squel[_0x50c5('0x2f')]()['into'](_0x50c5('0x37'))['fromQuery'](_0x31cb08,squel[_0x50c5('0xe')]()[_0x50c5('0x24')](_0x31cb08)[_0x50c5('0x10')](_0x2933c0)[_0x50c5('0x27')]('('+_0x56952a[_0x50c5('0x14')](',')+')\x20NOT\x20IN\x20?',squel[_0x50c5('0xe')]()['fields'](_0x56952a)[_0x50c5('0x10')](_0x50c5('0x37'))['where'](_0x50c5('0x33'),_0x6049c1)[_0x50c5('0x27')](_0x50c5('0x38')))[_0x50c5('0x27')]('id\x20IN\x20?',squel[_0x50c5('0xe')]()[_0x50c5('0xf')]('MIN(id)',_0x50c5('0x39'))[_0x50c5('0x10')](_0x2933c0)[_0x50c5('0x3a')](_0x56952a[_0x50c5('0x14')](','))))[_0x50c5('0x2d')]();}function handleStop(){logger[_0x50c5('0x3b')](_0x50c5('0x3c'));stopped=!![];}function handleUncaughtException(_0x5b09e5){logger[_0x50c5('0x3d')](_0x5b09e5[_0x50c5('0x3e')]);process[_0x50c5('0x3f')](0x1);}function handleError(_0x74c7a4,_0x8b0810){stats[_0x50c5('0x40')][_0x50c5('0x41')]({'name':_0x8b0810[_0x50c5('0x42')],'message':_0x8b0810['message'],'row':_0x74c7a4});}function handleQuery(_0xf5aa31){logger[_0x50c5('0x3b')](_0xf5aa31);return db[_0x50c5('0x43')][_0x50c5('0x44')](_0xf5aa31)[_0x50c5('0x45')](function(_0x1a24ec){results['push'](_0x1a24ec);})[_0x50c5('0x46')](function(_0x17c324){logger['error'](_0x17c324[_0x50c5('0x3e')]);});}function main(_0x5205b,_0x1f11e2,_0x3ea628,_0x2d38c8){logger['info'](_0x50c5('0x47'),_0x5205b,JSON[_0x50c5('0x48')](_0x1f11e2));process[_0x50c5('0x49')](_0x50c5('0x4a'));var _0x1e9753=_0x1f11e2['binding'];var _0x37b635=_0x1f11e2[_0x50c5('0x4b')];var _0x2afe4c=path[_0x50c5('0x14')](config[_0x50c5('0x4c')],'server/files/tmp',_0x37b635+_0x50c5('0x4d'));var _0x588ca2=_[_0x50c5('0x35')](_0x1e9753)['join']();logger[_0x50c5('0x3b')](_0x50c5('0x4e'),_0x588ca2);fs[_0x50c5('0x4f')](_0x2afe4c,_0x588ca2+'\x0a');Papa[_0x50c5('0x50')](fs['createReadStream'](_0x5205b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2e3698,_0x1bc455){try{for(var _0x4cf799=0x0,_0x3e4978=[];_0x4cf799<_0x2e3698[_0x50c5('0x51')][_0x50c5('0x52')];_0x4cf799++){stats[_0x50c5('0x53')]+=0x1;if(_0x2e3698[_0x50c5('0x40')][_0x4cf799]){handleError(_0x2e3698[_0x50c5('0x51')][_0x4cf799],_0x2e3698[_0x50c5('0x40')][_0x4cf799]);}else{var _0x88351f=[];for(var _0x16f14e in _0x1e9753){if(_0x1e9753[_0x50c5('0x54')](_0x16f14e)){if(_0x2e3698[_0x50c5('0x51')][_0x4cf799][_0x1e9753[_0x16f14e]]){var _0x35ed81=_[_0x50c5('0x55')](_0x2e3698[_0x50c5('0x51')][_0x4cf799][_0x1e9753[_0x16f14e]][_0x50c5('0x56')](/"/g,'\x27'));switch(_0x16f14e){case _0x50c5('0x1f'):var _0x3f7a2b=moment(_0x35ed81,_0x50c5('0xd'),!![]);if(_0x3f7a2b['isValid']()){_0x3e4978[_0x50c5('0x41')]('\x22'+_0x35ed81+'\x22');}else{_0x88351f[_0x50c5('0x41')](_0x50c5('0x57'));}break;case _0x50c5('0x58'):var _0x1a0fe8=parseInt(_0x35ed81);_0x35ed81=_['isNaN'](_0x1a0fe8)||_0x1a0fe8<0x0||_0x1a0fe8>0x4?_0x2d38c8?0x3:0x2:_0x1a0fe8;_0x3e4978[_0x50c5('0x41')]('\x22'+_0x35ed81+'\x22');break;case'UserId':var _0x55f9df=parseInt(_0x35ed81);if(_[_0x50c5('0x59')](_0x55f9df)&&_['includes'](_0x3ea628,_0x55f9df)){_0x3e4978[_0x50c5('0x41')]('\x22'+_0x55f9df+'\x22');}else{_0x88351f[_0x50c5('0x41')](_0x50c5('0x5a'));}break;case _0x50c5('0x5b'):if(isEmail(_0x35ed81)){_0x3e4978[_0x50c5('0x41')]('\x22'+_0x35ed81+'\x22');}else{_0x88351f['push']('email\x20wrong\x20format');}break;case _0x50c5('0x5c'):var _0x4d0e82=moment(_0x35ed81,'YYYY-MM-DD',!![]);if(_0x4d0e82[_0x50c5('0x5d')]()){_0x3e4978[_0x50c5('0x41')]('\x22'+_0x35ed81+'\x22');}else{_0x88351f[_0x50c5('0x41')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x3e4978[_0x50c5('0x41')]('\x22'+_0x35ed81+'\x22');}}else{switch(_0x16f14e){case _0x50c5('0x5e'):case _0x50c5('0x1e'):_0x88351f[_0x50c5('0x41')](_0x16f14e+'\x20not\x20specified');break;default:_0x3e4978[_0x50c5('0x41')]('\x22\x22');}}}}if(_0x88351f['length']){handleError(_0x2e3698[_0x50c5('0x51')][_0x4cf799],{'code':_0x50c5('0x5f'),'message':_0x88351f['join']()});}else{fs['appendFileSync'](_0x2afe4c,_0x3e4978[_0x50c5('0x14')]()+'\x0a');}_0x3e4978=[];}if(!(stats[_0x50c5('0x53')]%0xc8)){socket['emit'](_0x50c5('0x60')+_0x37b635,stats);stats[_0x50c5('0x40')]=[];}}if(stopped){logger['info'](_0x50c5('0x61'));_0x1bc455['abort']();}}catch(_0x1f2d05){handleError(_0x2e3698[_0x50c5('0x51')][_0x4cf799],{'code':_0x50c5('0x62'),'message':_0x1f2d05[_0x50c5('0x3e')]});logger[_0x50c5('0x3d')]('step',_0x1f2d05[_0x50c5('0x3e')]);}},'complete':function(){try{var _0x1ff7e2=[];var _0x176fec='cm_contacts';if(_0x1f11e2[_0x50c5('0x63')]&&_0x1f11e2[_0x50c5('0x63')]['length']){_0x176fec=_0x50c5('0x64')+_0x37b635;_0x1ff7e2[_0x50c5('0x41')]('CREATE\x20TABLE\x20'+_0x176fec+_0x50c5('0x65'));}var _0x322451=util[_0x50c5('0xc')](_0x50c5('0x66'),_0x2afe4c,_0x176fec,_0x588ca2,_0x1f11e2[_0x50c5('0x20')],_0x1f11e2[_0x50c5('0x36')]||null,NOW,NOW);if(_[_0x50c5('0x67')](_0x1e9753[_0x50c5('0x1f')])){_0x322451+=_0x50c5('0x68');}_0x1ff7e2[_0x50c5('0x41')](_0x322451);if(_0x1f11e2[_0x50c5('0x63')]&&_0x1f11e2[_0x50c5('0x63')][_0x50c5('0x52')]){_0x1ff7e2[_0x50c5('0x41')](insertCmContact(_0x1f11e2['ListId'],_0x176fec,_0x1f11e2[_0x50c5('0x63')],_0x1e9753));_0x1ff7e2[_0x50c5('0x41')]('DROP\x20TABLE\x20'+_0x176fec+';');}_0x1ff7e2[_0x50c5('0x41')](insertCmHopper(_0x1f11e2[_0x50c5('0x20')],'voice_queues_has_cm_lists','voice_queues','VoiceQueueId',_0x2d38c8));_0x1ff7e2[_0x50c5('0x41')](insertCmHopperBlack(_0x1f11e2[_0x50c5('0x20')],_0x50c5('0x69'),_0x50c5('0x6a'),_0x50c5('0x6b')));_0x1ff7e2[_0x50c5('0x41')](insertCmHopper(_0x1f11e2[_0x50c5('0x20')],_0x50c5('0x6c'),_0x50c5('0x6d'),_0x50c5('0x6e'),_0x2d38c8));_0x1ff7e2[_0x50c5('0x41')](insertCmHopperBlack(_0x1f11e2['ListId'],'campaigns_has_cm_blacklists','campaigns','CampaignId'));BPromise[_0x50c5('0x6f')](_0x1ff7e2,handleQuery)[_0x50c5('0x70')](function(_0x2e820e){stats[_0x50c5('0x71')]=!![];stats[_0x50c5('0x72')]=_0x1f11e2[_0x50c5('0x63')]&&_0x1f11e2[_0x50c5('0x63')][_0x50c5('0x52')]?results[0x2]['affectedRows']:results[0x0][_0x50c5('0x72')];socket['emit'](_0x50c5('0x60')+_0x37b635,stats);fs[_0x50c5('0x73')](_0x5205b);fs[_0x50c5('0x73')](_0x2afe4c);process[_0x50c5('0x3f')](0x0);})[_0x50c5('0x46')](function(_0x4ce76f){logger['error'](_0x4ce76f['message']);process[_0x50c5('0x3f')](0x1);});}catch(_0x1352a4){logger[_0x50c5('0x3d')](_0x50c5('0x74'),_0x1352a4['message']);process[_0x50c5('0x3f')](0x1);}},'error':function(_0x4f4a73,_0x7e3948,_0x1c3eb4,_0x52be9c){throw new Error(_0x52be9c);}});}function validate(){if(process[_0x50c5('0x75')]&&process[_0x50c5('0x75')][_0x50c5('0x52')]<0x4){throw new Error(_0x50c5('0x76'));}var _0x1fa656=path[_0x50c5('0x14')](config[_0x50c5('0x4c')],_0x50c5('0x77'),process[_0x50c5('0x75')][0x2]);if(!fs['existsSync'](_0x1fa656)){throw new Error(_0x50c5('0x78'));}var _0x1e2891={};try{_0x1e2891=JSON[_0x50c5('0x50')](process[_0x50c5('0x75')][0x3]);if(!_0x1e2891['binding']){throw new Error(_0x50c5('0x79'));}if(!_0x1e2891[_0x50c5('0x7a')][_0x50c5('0x1e')]){throw new Error(_0x50c5('0x7b'));}if(!_0x1e2891[_0x50c5('0x7a')][_0x50c5('0x5e')]){throw new Error('firstName\x20is\x20mandatory');}var _0x396587=0x0;if(_0x1e2891['binding'][_0x50c5('0x22')]){_0x396587=0x1;}if(!_0x1e2891[_0x50c5('0x20')]){throw new Error(_0x50c5('0x7c'));}}catch(_0x195317){throw new Error(_0x50c5('0x7d'));}var _0x229aad=[];try{_0x229aad=_['map'](JSON[_0x50c5('0x50')](process[_0x50c5('0x75')][0x4]),'id');}catch(_0x2866a6){logger[_0x50c5('0x3b')](_0x50c5('0x7e'));}main(_0x1fa656,_0x1e2891,_0x229aad,_0x396587);}validate();process['on']('SIGINT',handleStop);process['on'](_0x50c5('0x7f'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index e7958e4..a20a8d2 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','insert','cm_hopper','fromQuery','ContactId','ListId','createdAt','priority','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.createdAt','into','cm_hopper_black','updatedAt','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','group','info','exit','errors','code','main','stringify','send','start','clone','socket_timestamp','root','server/files/tmp','body','name','header','writeFileSync','createReadStream','data','rows','find','_description','hasOwnProperty','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','contact','contactTypeId','orderBy','DROP\x20TABLE\x20','each','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','SIGINT','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','.id\x20=\x20','\x20=\x20','where','join','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','message','split','filter','CmContactHasItem','findOne','update','create','inserted','CmContact','CmHopper'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x3071('0x0'));var util=require(_0x3071('0x1'));var BPromise=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var squel=require(_0x3071('0x4'));var Redis=require('ioredis');var db=require(_0x3071('0x5'))['db'];var config=require(_0x3071('0x6'));var logger=require(_0x3071('0x7'))(_0x3071('0x8'));config[_0x3071('0x9')]=_[_0x3071('0xa')](config[_0x3071('0x9')],{'host':_0x3071('0xb'),'port':0x18eb});var socket=require(_0x3071('0xc'))(new Redis(config[_0x3071('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x3071('0xd')](_0x3071('0xe'));var tempTableName=_0x3071('0xf')+moment()['format'](_0x3071('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2610b4){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))*$/[_0x3071('0x11')](_0x2610b4);}function selectNotIn(_0xff9a29,_0x1ce844,_0x4a470a,_0x2ace21,_0x11a7ee){return squel[_0x3071('0x12')]()[_0x3071('0x13')](_0x3071('0x14'))['from'](_0x2ace21)['join'](_0x1ce844,null,_0x1ce844+_0x3071('0x15')+_0x2ace21+'.'+_0x4a470a)['where'](_0x2ace21+'.'+_0x4a470a+_0x3071('0x16')+_0xff9a29+'.'+_0x4a470a)[_0x3071('0x17')](_0x1ce844+'.dialCheckDuplicateType\x20IN\x20('+_0x11a7ee[_0x3071('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4e1219,_0x2fc15d){promisesAdditionalPhones=[];promisesContact=[];return db[_0x3071('0x19')][_0x3071('0x1a')](_0x3071('0x1b')+tempTableName)[_0x3071('0x1c')](function(_0x2a6a4b){if(_0x2a6a4b!==null){var _0x157a47=[];for(var _0x11bdc9=0x0;_0x11bdc9<_0x2a6a4b[_0x3071('0x1d')];_0x11bdc9++){var _0x344ea6=_0x2a6a4b[_0x11bdc9];if(!_['isNil'](_0x344ea6[_0x3071('0x14')])){if(!_[_0x3071('0x1e')](_0x344ea6[_0x3071('0x1f')]))_0x157a47[_0x3071('0x20')](insertAdditionalPhones(_0x344ea6));promisesContact[_0x3071('0x20')]({'contact':_0x344ea6});}}}Promise[_0x3071('0x21')](_0x157a47)[_0x3071('0x22')](function(){_0x4e1219({'val':0x1});});})[_0x3071('0x23')](function(_0x502a16){logger[_0x3071('0x24')](_0x502a16[_0x3071('0x25')]);});});}function insertAdditionalPhones(_0xd3e23d){return new Promise(function(_0x56c267,_0xb8f4e3){var _0x5cd80d=_0xd3e23d[_0x3071('0x1f')];if(_[_0x3071('0x1e')](_0x5cd80d))_0xb8f4e3({'val':0x0});else{var _0x3762d8=_0x5cd80d[_0x3071('0x26')](';');var _0x33090c=[];orderBy=0x0;for(var _0x34c50e=0x0;_0x34c50e<_0x3762d8[_0x3071('0x1d')];_0x34c50e++){_0x33090c[_0x3071('0x20')](splitAdditionalPhone(_0xd3e23d['id'],_0x3762d8[_0x34c50e]));}Promise['all'](_0x33090c)['then'](function(){_0x56c267({'val':_0x3762d8[_0x3071('0x1d')]});});}});}function splitAdditionalPhone(_0xb05b1d,_0x412652){return new Promise(function(_0x13df9f,_0x2793ef){var _0x44b45f=_0x412652[_0x3071('0x26')](':');var _0x1fe727=_0x44b45f[0x0];var _0x1de5fb=_0x44b45f[0x1];if(_0x1de5fb!==''){var _0x4c7130=_0x1de5fb[_0x3071('0x26')]('|');var _0x3f1e6e=[];for(var _0x177138=0x0;_0x177138<_0x4c7130['length'];_0x177138++){if(_0x4c7130[_0x177138]!==''){var _0x4fb1ca=_[_0x3071('0x27')](promisesAdditionalPhones,{'contactId':_0xb05b1d,'phone':_0x4c7130[_0x177138]});if(_0x4fb1ca[_0x3071('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0x3071('0x20')]({'contactId':_0xb05b1d,'contactTypeId':_0x1fe727,'phone':_0x4c7130[_0x177138],'orderBy':orderBy});}}}_0x13df9f({'ok':0x1});}else _0x13df9f({'res':0x0});});}function createAdditionalPhone(_0x3fa3b8,_0x25b96b,_0x177b5f,_0x3921a1){var _0x32f1b4='';var _0x292205='';var _0x254fc8=_0x177b5f['split']('§');_0x32f1b4=_0x254fc8[0x0];if(_0x254fc8['length']==0x2)_0x292205=_0x254fc8[0x1];return new Promise(function(_0x9e26d1,_0x149e0d){return db[_0x3071('0x28')][_0x3071('0x29')]({'where':{'CmContactId':_0x3fa3b8,'item':_0x32f1b4}})[_0x3071('0x22')](function(_0x29538c){if(_0x29538c){return db[_0x3071('0x28')][_0x3071('0x2a')]({'ItemTypeId':_0x25b96b,'description':_0x292205,'OrderBy':_0x3921a1},{'where':{'CmContactId':_0x3fa3b8,'item':_0x32f1b4}})['then'](function(_0x55d230){_0x9e26d1({'res':'updated'});});}else{return db[_0x3071('0x28')][_0x3071('0x2b')]({'CmContactId':_0x3fa3b8,'item':_0x32f1b4,'ItemTypeId':_0x25b96b,'description':_0x292205,'OrderBy':_0x3921a1,'ItemClass':'PHONE'})[_0x3071('0x22')](function(_0x28747d){_0x9e26d1({'res':_0x3071('0x2c')});});}});});}function updateContact(_0x13ae2c){return new Promise(function(_0x5e1d2b,_0x218a82){var _0x1525df=_0x13ae2c['id'];delete _0x13ae2c['id'];return db[_0x3071('0x2d')][_0x3071('0x2a')](_0x13ae2c,{'where':{'id':_0x1525df}})[_0x3071('0x22')](function(_0x2068ce){updatedRows+=0x1;return db[_0x3071('0x2e')][_0x3071('0x2a')]({'phone':_0x13ae2c['phone']},{'where':{'ContactId':_0x1525df}})[_0x3071('0x22')](function(_0x54e52f){_0x5e1d2b({'ret':'OK'});});});});}function insertCmHopper(_0x4fb1ec,_0x1a1a64,_0xa3a7ae,_0x54d9c3,_0x2e85c8){var _0x46e94e=[_0x3071('0x2f'),_0x3071('0x30'),_0x3071('0x31'),_0x3071('0x32'),_0x1a1a64+'.'+_0x54d9c3,'cm_contacts.createdAt',_0x3071('0x33'),_0x3071('0x34'),'cm_contacts.UserId','\x22'+_0x2e85c8+'\x22'];return squel[_0x3071('0x35')]()['into'](_0x3071('0x36'))[_0x3071('0x37')](['phone','scheduledat',_0x3071('0x38'),_0x3071('0x39'),_0x54d9c3,_0x3071('0x3a'),'updatedAt',_0x3071('0x3b'),'UserId',_0x3071('0x3c')],squel['select']()[_0x3071('0x3d')](_0x46e94e)[_0x3071('0x3e')](_0x1a1a64)[_0x3071('0x18')](_0x3071('0x3f'),null,_0x3071('0x40')+_0x1a1a64+'.CmListId')['join'](_0xa3a7ae,null,_0xa3a7ae+_0x3071('0x15')+_0x1a1a64+'.'+_0x54d9c3)[_0x3071('0x17')](_0x1a1a64+_0x3071('0x41'),_0x4fb1ec)[_0x3071('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x3071('0x17')](_0x3071('0x42'),selectNotIn(_0x1a1a64,_0xa3a7ae,_0x54d9c3,_0x3071('0x36'),[_0x3071('0x43'),_0x3071('0x44')]))[_0x3071('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1a1a64,_0xa3a7ae,_0x54d9c3,_0x3071('0x36'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x4dc9d1,_0x47ceaf,_0x2992e6,_0x1be8b6){var _0x67b2fb=[_0x3071('0x2f'),_0x3071('0x31'),_0x3071('0x32'),_0x47ceaf+'.'+_0x1be8b6,_0x3071('0x45'),_0x3071('0x33')];return squel['insert']()[_0x3071('0x46')](_0x3071('0x47'))[_0x3071('0x37')]([_0x3071('0x14'),_0x3071('0x38'),'ListId',_0x1be8b6,'createdAt',_0x3071('0x48')],squel[_0x3071('0x12')]()[_0x3071('0x3d')](_0x67b2fb)[_0x3071('0x3e')](_0x47ceaf)[_0x3071('0x18')]('cm_contacts',null,_0x3071('0x40')+_0x47ceaf+'.CmListId')[_0x3071('0x18')](_0x2992e6,null,_0x2992e6+'.id\x20=\x20'+_0x47ceaf+'.'+_0x1be8b6)['where'](_0x47ceaf+_0x3071('0x41'),_0x4dc9d1)['where'](_0x3071('0x49'),NOW)['where'](_0x3071('0x42'),squel[_0x3071('0x12')]()[_0x3071('0x13')](_0x3071('0x14'))['from'](_0x3071('0x47'))['where'](_0x3071('0x4a'),_0x4dc9d1)['where'](_0x1be8b6+_0x3071('0x4b'),_0x47ceaf+'.'+_0x1be8b6)))[_0x3071('0x4c')]();}function insertCmHopperAdditionalPhones(_0x4d395a){var _0x131ae6=[_0x3071('0x4d'),_0x3071('0x4e'),_0x3071('0x4f'),_0x3071('0x50'),_0x3071('0x51')];return squel[_0x3071('0x35')]()['into'](_0x3071('0x52'))[_0x3071('0x37')]([_0x3071('0x53'),_0x3071('0x14'),'OrderBy',_0x3071('0x3a'),_0x3071('0x48')],squel[_0x3071('0x12')]()[_0x3071('0x3d')](_0x131ae6)[_0x3071('0x3e')](_0x3071('0x36'))[_0x3071('0x18')](_0x3071('0x3f'),null,_0x3071('0x54'))[_0x3071('0x18')](_0x3071('0x55'),null,_0x3071('0x56'))[_0x3071('0x17')](_0x3071('0x57'),_0x4d395a)[_0x3071('0x17')](_0x3071('0x49'),NOW))['toString']();}function insertCmContact(_0x47a438,_0x12536d,_0x580c04,_0x403761){var _0x198168=_[_0x3071('0x58')](_['keys'](_0x403761),[_0x3071('0x39'),_0x3071('0x59'),'createdAt','updatedAt']);return squel[_0x3071('0x35')]()[_0x3071('0x46')](_0x3071('0x3f'))[_0x3071('0x37')](_0x198168,squel['select']()[_0x3071('0x3d')](_0x198168)[_0x3071('0x3e')](_0x12536d)[_0x3071('0x17')]('('+_0x580c04[_0x3071('0x18')](',')+_0x3071('0x5a'),squel['select']()[_0x3071('0x3d')](_0x580c04)[_0x3071('0x3e')](_0x3071('0x3f'))[_0x3071('0x17')](_0x3071('0x4a'),_0x47a438))[_0x3071('0x17')](_0x3071('0x5b'),squel['select']()['field'](_0x3071('0x5c'),'min_id')[_0x3071('0x3e')](_0x12536d)[_0x3071('0x5d')](_0x580c04['join'](','))))[_0x3071('0x4c')]();}function handleStop(){logger[_0x3071('0x5e')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x108b14){logger[_0x3071('0x24')](_0x108b14[_0x3071('0x25')]);process[_0x3071('0x5f')](0x1);}function handleError(_0x2aaccb,_0x53a399){stats[_0x3071('0x60')][_0x3071('0x20')]({'name':_0x53a399[_0x3071('0x61')],'message':_0x53a399['message'],'row':_0x2aaccb});}function handleQuery(_0x1b0f81){logger[_0x3071('0x5e')](_0x1b0f81);return db[_0x3071('0x19')][_0x3071('0x1a')](_0x1b0f81)[_0x3071('0x1c')](function(_0x210123){results[_0x3071('0x20')](_0x210123);})[_0x3071('0x23')](function(_0x3b47e8){logger['error'](_0x3b47e8[_0x3071('0x25')]);});}function main(_0x29a58e,_0x3bcf28,_0x26ecb2,_0x466835){logger[_0x3071('0x5e')](_0x3071('0x62'),_0x29a58e,JSON[_0x3071('0x63')](_0x3bcf28));process[_0x3071('0x64')](_0x3071('0x65'));var _0x195d03=_0x3bcf28['binding'];var _0x320fe6=_[_0x3071('0x66')](_0x195d03);var _0x279594=_0x3bcf28[_0x3071('0x67')];var _0x429a03=path[_0x3071('0x18')](config[_0x3071('0x68')],_0x3071('0x69'),_0x279594+'.csv');logger[_0x3071('0x5e')](_0x3071('0x6a'),_0x3bcf28);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x3071('0x6b')]})[_0x3071('0x22')](function(_0x3469c1){for(var _0x38bc1f=0x0;_0x38bc1f<_0x3469c1['length'];_0x38bc1f++){if(_0x3469c1[_0x38bc1f]['name']in _0x195d03){contactItemTypes[_0x3071('0x20')](_0x3469c1[_0x38bc1f]);delete _0x320fe6[_0x3469c1[_0x38bc1f]['name']];hasAdditionalPhones=!![];}for(var _0x518bb5 in _0x195d03){if(_0x3469c1[_0x38bc1f]['name']+'_description'===_0x518bb5){phoneDescriptions[_0x3071('0x20')]({'itemTypeId':_0x3469c1[_0x38bc1f]['id'],'description':_0x518bb5});delete _0x320fe6[_0x518bb5];}}}if(hasAdditionalPhones)_0x320fe6[_0x3071('0x1f')]='';var _0xd928e8=_['keys'](_0x320fe6)[_0x3071('0x18')]();logger[_0x3071('0x5e')](_0x3071('0x6c'),_0xd928e8);fs[_0x3071('0x6d')](_0x429a03,_0xd928e8+'\x0a');Papa['parse'](fs[_0x3071('0x6e')](_0x29a58e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x29841a,_0x588406){try{for(var _0x1b35d3=0x0,_0x29ee70=[];_0x1b35d3<_0x29841a[_0x3071('0x6f')][_0x3071('0x1d')];_0x1b35d3++){stats[_0x3071('0x70')]+=0x1;if(_0x29841a[_0x3071('0x60')][_0x1b35d3]){handleError(_0x29841a[_0x3071('0x6f')][_0x1b35d3],_0x29841a['errors'][_0x1b35d3]);}else{var _0x5dde93=[];var _0x21c1e3=[];var _0x168025={};for(var _0x1456ce in _0x195d03){let _0x4bf839=contactItemTypes['find'](_0x9f49f0=>_0x9f49f0[_0x3071('0x6b')]===_0x1456ce);let _0x3bad84=contactItemTypes[_0x3071('0x71')](_0x2f1935=>_0x2f1935[_0x3071('0x6b')]+_0x3071('0x72')===_0x1456ce);if(_[_0x3071('0x1e')](_0x4bf839)&&_['isNil'](_0x3bad84)){if(_0x195d03[_0x3071('0x73')](_0x1456ce)){if(_0x29841a['data'][_0x1b35d3][_0x195d03[_0x1456ce]]){var _0xa8e233=_[_0x3071('0x74')](_0x29841a[_0x3071('0x6f')][_0x1b35d3][_0x195d03[_0x1456ce]][_0x3071('0x75')](/"/g,'\x27'));switch(_0x1456ce){case _0x3071('0x76'):var _0x44b5dc=moment(_0xa8e233,_0x3071('0xe'),!![]);if(_0x44b5dc[_0x3071('0x77')]()){_0x29ee70['push']('\x22'+_0xa8e233+'\x22');}else{_0x5dde93[_0x3071('0x20')](_0x3071('0x78'));}break;case _0x3071('0x3b'):var _0x4f06c0=parseInt(_0xa8e233);_0xa8e233=_[_0x3071('0x79')](_0x4f06c0)||_0x4f06c0<0x0||_0x4f06c0>0x4?_0x466835?0x3:0x2:_0x4f06c0;_0x29ee70[_0x3071('0x20')]('\x22'+_0xa8e233+'\x22');break;case _0x3071('0x7a'):var _0x567e33=parseInt(_0xa8e233);if(_['isNumber'](_0x567e33)&&_[_0x3071('0x7b')](_0x26ecb2,_0x567e33)){_0x29ee70['push']('\x22'+_0x567e33+'\x22');}else{_0x5dde93[_0x3071('0x20')](_0x3071('0x7c'));}break;case _0x3071('0x7d'):if(isEmail(_0xa8e233)){_0x29ee70[_0x3071('0x20')]('\x22'+_0xa8e233+'\x22');}else{_0x5dde93[_0x3071('0x20')](_0x3071('0x7e'));}break;case _0x3071('0x7f'):var _0x4c67ec=moment(_0xa8e233,_0x3071('0x80'),!![]);if(_0x4c67ec[_0x3071('0x77')]()){_0x29ee70[_0x3071('0x20')]('\x22'+_0xa8e233+'\x22');}else{_0x5dde93[_0x3071('0x20')](_0x3071('0x81'));}break;default:_0x29ee70[_0x3071('0x20')]('\x22'+_0xa8e233+'\x22');}}else{switch(_0x1456ce){case _0x3071('0x82'):case _0x3071('0x14'):_0x5dde93['push'](_0x1456ce+_0x3071('0x83'));break;default:_0x29ee70['push']('\x22\x22');}}}}else{var _0x2aef6e='';if(!_[_0x3071('0x1e')](_0x4bf839)){if(!_0x168025[_0x3071('0x73')](_0x4bf839['id'])){for(var _0x45879b=0x0;_0x45879b<_0x195d03[_0x1456ce][_0x3071('0x1d')];_0x45879b++){var _0xa8e233=_[_0x3071('0x74')](_0x29841a[_0x3071('0x6f')][_0x1b35d3][_0x195d03[_0x1456ce][_0x45879b]][_0x3071('0x75')](/"/g,'\x27'));var _0x3a3cf3=phoneDescriptions['find'](_0x456921=>_0x456921[_0x3071('0x84')]===_0x4bf839['id']);if(!_['isNil'](_0x3a3cf3)){var _0x156826=_[_0x3071('0x74')](_0x29841a[_0x3071('0x6f')][_0x1b35d3][_0x195d03[_0x3a3cf3[_0x3071('0x85')]][0x0]][_0x3071('0x75')](/"/g,'\x27'));if(!_['isNil'](_0x156826))_0xa8e233=_0xa8e233+'§'+_0x156826;}if(_0x2aef6e=='')_0x2aef6e=_0xa8e233;else _0x2aef6e+='|'+_0xa8e233;}_0x21c1e3['push'](_0x4bf839['id']+':'+_0x2aef6e);_0x168025[_0x4bf839['id']]=0x1;}}}}if(hasAdditionalPhones){_0x29ee70[_0x3071('0x20')]('\x22'+_0x21c1e3['join'](';')+'\x22');}if(_0x5dde93[_0x3071('0x1d')]){handleError(_0x29841a[_0x3071('0x6f')][_0x1b35d3],{'code':_0x3071('0x86'),'message':_0x5dde93[_0x3071('0x18')]()});}else{fs[_0x3071('0x87')](_0x429a03,_0x29ee70[_0x3071('0x18')]()+'\x0a');}_0x29ee70=[];}if(!(stats['rows']%0xc8)){socket[_0x3071('0x88')](_0x3071('0x89')+_0x279594,stats);stats[_0x3071('0x60')]=[];}}if(stopped){logger[_0x3071('0x5e')]('Abort\x20parser');_0x588406[_0x3071('0x8a')]();}}catch(_0x446546){handleError(_0x29841a['data'][_0x1b35d3],{'code':_0x3071('0x8b'),'message':_0x446546[_0x3071('0x25')]});logger[_0x3071('0x24')](_0x3071('0x8c'),_0x446546[_0x3071('0x25')]);}},'complete':function(){try{var _0x547ba8=[];var _0x44cecd=tempTableName;_0x547ba8['push'](_0x3071('0x8d')+_0x44cecd+_0x3071('0x8e'));logger[_0x3071('0x5e')](_0x3071('0x8f'),contactItemTypes[_0x3071('0x1d')]);var _0x247cda=util[_0x3071('0xd')](_0x3071('0x90'),_0x429a03,_0x44cecd,_0xd928e8,_0x3bcf28['ListId'],_0x3bcf28[_0x3071('0x59')]||null,NOW,NOW);if(_[_0x3071('0x1e')](_0x195d03[_0x3071('0x76')])){_0x247cda+=',\x20scheduledAt\x20=\x20NOW()';}_0x547ba8[_0x3071('0x20')](_0x247cda);BPromise['each'](_0x547ba8,handleQuery)[_0x3071('0x22')](function(_0x5a5861){BPromise[_0x3071('0x21')]([handleAdditionalPhones()])['then'](function(){_0x547ba8=[];for(var _0x163b29=0x0;_0x163b29\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','push','all','then','error','AdditionalPhones','split','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0xedd9,0xfc));var _0x9edd=function(_0x4e802e,_0x6f953){_0x4e802e=_0x4e802e-0x0;var _0x479220=_0xedd9[_0x4e802e];return _0x479220;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x9edd('0x0'));var Papa=require(_0x9edd('0x1'));var util=require(_0x9edd('0x2'));var BPromise=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var squel=require(_0x9edd('0x5'));var Redis=require(_0x9edd('0x6'));var db=require(_0x9edd('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0x9edd('0x8'))(_0x9edd('0x9'));config[_0x9edd('0xa')]=_[_0x9edd('0xb')](config['redis'],{'host':_0x9edd('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9edd('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x9edd('0xd')](_0x9edd('0xe'));var tempTableName=_0x9edd('0xf')+moment()['format'](_0x9edd('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x5d2f90){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))*$/[_0x9edd('0x11')](_0x5d2f90);}function selectNotIn(_0x138767,_0x523026,_0xbf9da6,_0x13dc4f,_0x5b6c00){return squel[_0x9edd('0x12')]()[_0x9edd('0x13')](_0x9edd('0x14'))[_0x9edd('0x15')](_0x13dc4f)[_0x9edd('0x16')](_0x523026,null,_0x523026+_0x9edd('0x17')+_0x13dc4f+'.'+_0xbf9da6)[_0x9edd('0x18')](_0x13dc4f+'.'+_0xbf9da6+_0x9edd('0x19')+_0x138767+'.'+_0xbf9da6)['where'](_0x523026+_0x9edd('0x1a')+_0x5b6c00[_0x9edd('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x891832,_0x4d9a7){promisesAdditionalPhones=[];promisesContact=[];return db[_0x9edd('0x1b')][_0x9edd('0x1c')](_0x9edd('0x1d')+tempTableName)[_0x9edd('0x1e')](function(_0x4ea60f){if(_0x4ea60f!==null){var _0x5f5bf4=[];for(var _0x448996=0x0;_0x448996<_0x4ea60f[_0x9edd('0x1f')];_0x448996++){var _0x5acf65=_0x4ea60f[_0x448996];if(!_[_0x9edd('0x20')](_0x5acf65[_0x9edd('0x14')])){if(!_[_0x9edd('0x20')](_0x5acf65['AdditionalPhones']))_0x5f5bf4[_0x9edd('0x21')](insertAdditionalPhones(_0x5acf65));promisesContact['push']({'contact':_0x5acf65});}}}Promise[_0x9edd('0x22')](_0x5f5bf4)[_0x9edd('0x23')](function(){_0x891832({'val':0x1});});})['catch'](function(_0x498977){logger[_0x9edd('0x24')](_0x498977['message']);});});}function insertAdditionalPhones(_0x27a95a){return new Promise(function(_0x54a03f,_0x535f37){var _0x356751=_0x27a95a[_0x9edd('0x25')];if(_['isNil'](_0x356751))_0x535f37({'val':0x0});else{var _0x5823bc=_0x356751[_0x9edd('0x26')](';');var _0x186186=[];orderBy=0x0;for(var _0x477878=0x0;_0x477878<_0x5823bc['length'];_0x477878++){_0x186186[_0x9edd('0x21')](splitAdditionalPhone(_0x27a95a['id'],_0x5823bc[_0x477878]));}Promise[_0x9edd('0x22')](_0x186186)[_0x9edd('0x23')](function(){_0x54a03f({'val':_0x5823bc[_0x9edd('0x1f')]});});}});}function splitAdditionalPhone(_0x339a0d,_0x4c75d2){return new Promise(function(_0x46c383,_0xeaf55a){var _0x3a1ea5=_0x4c75d2[_0x9edd('0x26')](':');var _0x310a4d=_0x3a1ea5[0x0];var _0x4d507f=_0x3a1ea5[0x1];if(_0x4d507f!==''){var _0x4b3d1b=_0x4d507f[_0x9edd('0x26')]('|');var _0xfeca7b=[];for(var _0x8d67aa=0x0;_0x8d67aa<_0x4b3d1b[_0x9edd('0x1f')];_0x8d67aa++){if(_0x4b3d1b[_0x8d67aa]!==''){var _0x3c2227=_['filter'](promisesAdditionalPhones,{'contactId':_0x339a0d,'phone':_0x4b3d1b[_0x8d67aa]});if(_0x3c2227['length']==0x0){orderBy++;promisesAdditionalPhones[_0x9edd('0x21')]({'contactId':_0x339a0d,'contactTypeId':_0x310a4d,'phone':_0x4b3d1b[_0x8d67aa],'orderBy':orderBy});}}}_0x46c383({'ok':0x1});}else _0x46c383({'res':0x0});});}function createAdditionalPhone(_0x257a26,_0x1c762c,_0x52746a,_0x238b22){var _0x28cfae='';var _0x2ae8dd='';var _0x41af53=_0x52746a['split']('§');_0x28cfae=_0x41af53[0x0];if(_0x41af53[_0x9edd('0x1f')]==0x2)_0x2ae8dd=_0x41af53[0x1];return new Promise(function(_0x3fb556,_0xbe87e1){return db[_0x9edd('0x27')][_0x9edd('0x28')]({'where':{'CmContactId':_0x257a26,'item':_0x28cfae}})[_0x9edd('0x23')](function(_0x209aba){if(_0x209aba){return db[_0x9edd('0x27')][_0x9edd('0x29')]({'ItemTypeId':_0x1c762c,'description':_0x2ae8dd,'OrderBy':_0x238b22},{'where':{'CmContactId':_0x257a26,'item':_0x28cfae}})[_0x9edd('0x23')](function(_0x4fd03f){_0x3fb556({'res':_0x9edd('0x2a')});});}else{return db[_0x9edd('0x27')][_0x9edd('0x2b')]({'CmContactId':_0x257a26,'item':_0x28cfae,'ItemTypeId':_0x1c762c,'description':_0x2ae8dd,'OrderBy':_0x238b22,'ItemClass':_0x9edd('0x2c')})['then'](function(_0x1453d2){_0x3fb556({'res':_0x9edd('0x2d')});});}});});}function updateContact(_0x267c74){return new Promise(function(_0x5d1707,_0x2d2f88){var _0x3990fb=_0x267c74['id'];delete _0x267c74['id'];return db[_0x9edd('0x2e')][_0x9edd('0x29')](_0x267c74,{'where':{'id':_0x3990fb}})[_0x9edd('0x23')](function(_0x2bc4ed){updatedRows+=0x1;return db[_0x9edd('0x2f')][_0x9edd('0x29')]({'phone':_0x267c74[_0x9edd('0x14')]},{'where':{'ContactId':_0x3990fb}})[_0x9edd('0x23')](function(_0x29e789){_0x5d1707({'ret':'OK'});});});});}function insertCmHopper(_0x42c1d9,_0x27eb7e,_0x14f780,_0x5757fc,_0x37fcb2){var _0x5ed62d=[_0x9edd('0x30'),_0x9edd('0x31'),_0x9edd('0x32'),_0x9edd('0x33'),_0x27eb7e+'.'+_0x5757fc,_0x9edd('0x34'),'cm_contacts.updatedAt',_0x9edd('0x35'),_0x9edd('0x36'),'\x22'+_0x37fcb2+'\x22'];return squel[_0x9edd('0x37')]()[_0x9edd('0x38')](_0x9edd('0x39'))[_0x9edd('0x3a')]([_0x9edd('0x14'),_0x9edd('0x3b'),_0x9edd('0x3c'),_0x9edd('0x3d'),_0x5757fc,'createdAt',_0x9edd('0x3e'),'priority',_0x9edd('0x3f'),'recallme'],squel[_0x9edd('0x12')]()[_0x9edd('0x40')](_0x5ed62d)[_0x9edd('0x15')](_0x27eb7e)['join'](_0x9edd('0x41'),null,_0x9edd('0x42')+_0x27eb7e+_0x9edd('0x43'))['join'](_0x14f780,null,_0x14f780+_0x9edd('0x17')+_0x27eb7e+'.'+_0x5757fc)['where'](_0x27eb7e+_0x9edd('0x44'),_0x42c1d9)[_0x9edd('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x9edd('0x18')](_0x9edd('0x45'),selectNotIn(_0x27eb7e,_0x14f780,_0x5757fc,_0x9edd('0x39'),[_0x9edd('0x46'),'\x22onlyIfOpen\x22']))[_0x9edd('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x27eb7e,_0x14f780,_0x5757fc,_0x9edd('0x39'),[_0x9edd('0x46')])))['toString']();}function insertCmHopperBlack(_0x318757,_0x49a128,_0x548299,_0x369b69){var _0x9cab86=[_0x9edd('0x30'),_0x9edd('0x32'),_0x9edd('0x33'),_0x49a128+'.'+_0x369b69,_0x9edd('0x34'),_0x9edd('0x47')];return squel[_0x9edd('0x37')]()[_0x9edd('0x38')](_0x9edd('0x48'))[_0x9edd('0x3a')]([_0x9edd('0x14'),_0x9edd('0x3c'),_0x9edd('0x3d'),_0x369b69,_0x9edd('0x49'),'updatedAt'],squel[_0x9edd('0x12')]()[_0x9edd('0x40')](_0x9cab86)[_0x9edd('0x15')](_0x49a128)[_0x9edd('0x16')](_0x9edd('0x41'),null,_0x9edd('0x42')+_0x49a128+_0x9edd('0x43'))['join'](_0x548299,null,_0x548299+'.id\x20=\x20'+_0x49a128+'.'+_0x369b69)['where'](_0x49a128+_0x9edd('0x44'),_0x318757)['where'](_0x9edd('0x4a'),NOW)[_0x9edd('0x18')](_0x9edd('0x45'),squel[_0x9edd('0x12')]()[_0x9edd('0x13')]('phone')[_0x9edd('0x15')](_0x9edd('0x48'))[_0x9edd('0x18')]('ListId\x20=\x20?',_0x318757)[_0x9edd('0x18')](_0x369b69+_0x9edd('0x4b'),_0x49a128+'.'+_0x369b69)))[_0x9edd('0x4c')]();}function insertCmHopperAdditionalPhones(_0x293b03){var _0x1d78c4=[_0x9edd('0x4d'),'cm_contact_has_items.item',_0x9edd('0x4e'),_0x9edd('0x4f'),'cm_contact_has_items.updatedAt'];return squel[_0x9edd('0x37')]()[_0x9edd('0x38')]('cm_hopper_additional_phones')[_0x9edd('0x3a')]([_0x9edd('0x50'),_0x9edd('0x14'),'OrderBy',_0x9edd('0x49'),_0x9edd('0x3e')],squel[_0x9edd('0x12')]()[_0x9edd('0x40')](_0x1d78c4)['from'](_0x9edd('0x39'))[_0x9edd('0x16')](_0x9edd('0x41'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x9edd('0x16')](_0x9edd('0x51'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x9edd('0x18')]('cm_hopper.ListId\x20=\x20?',_0x293b03)[_0x9edd('0x18')](_0x9edd('0x4a'),NOW))[_0x9edd('0x4c')]();}function insertCmContact(_0x3fcdf5,_0x1e3c19,_0x18548e,_0x2334d4){var _0x14dd27=_[_0x9edd('0x52')](_[_0x9edd('0x53')](_0x2334d4),[_0x9edd('0x3d'),'CompanyId',_0x9edd('0x49'),_0x9edd('0x3e')]);return squel[_0x9edd('0x37')]()['into'](_0x9edd('0x41'))['fromQuery'](_0x14dd27,squel['select']()['fields'](_0x14dd27)[_0x9edd('0x15')](_0x1e3c19)[_0x9edd('0x18')]('('+_0x18548e[_0x9edd('0x16')](',')+_0x9edd('0x54'),squel['select']()['fields'](_0x18548e)['from'](_0x9edd('0x41'))[_0x9edd('0x18')](_0x9edd('0x55'),_0x3fcdf5))[_0x9edd('0x18')](_0x9edd('0x56'),squel[_0x9edd('0x12')]()[_0x9edd('0x13')](_0x9edd('0x57'),'min_id')[_0x9edd('0x15')](_0x1e3c19)['group'](_0x18548e[_0x9edd('0x16')](','))))[_0x9edd('0x4c')]();}function handleStop(){logger['info'](_0x9edd('0x58'));stopped=!![];}function handleUncaughtException(_0x322359){logger[_0x9edd('0x24')](_0x322359['message']);process[_0x9edd('0x59')](0x1);}function handleError(_0x2e1ce3,_0x430eb4){stats[_0x9edd('0x5a')][_0x9edd('0x21')]({'name':_0x430eb4[_0x9edd('0x5b')],'message':_0x430eb4['message'],'row':_0x2e1ce3});}function handleQuery(_0x4aa337){logger[_0x9edd('0x5c')](_0x4aa337);return db['sequelize'][_0x9edd('0x1c')](_0x4aa337)[_0x9edd('0x1e')](function(_0x439083){results[_0x9edd('0x21')](_0x439083);})['catch'](function(_0x21ead2){logger['error'](_0x21ead2[_0x9edd('0x5d')]);});}function main(_0x344692,_0xc6bde6,_0x5ca123,_0x2651a2){logger['info'](_0x9edd('0x5e'),_0x344692,JSON[_0x9edd('0x5f')](_0xc6bde6));process['send'](_0x9edd('0x60'));var _0x4a72d0=_0xc6bde6[_0x9edd('0x61')];var _0x134c9c=_[_0x9edd('0x62')](_0x4a72d0);var _0x50f4fc=_0xc6bde6[_0x9edd('0x63')];var _0x321485=path[_0x9edd('0x16')](config[_0x9edd('0x64')],_0x9edd('0x65'),_0x50f4fc+'.csv');logger['info'](_0x9edd('0x66'),_0xc6bde6);db[_0x9edd('0x67')]['findAll']({'raw':!![],'attributes':['id','name']})['then'](function(_0x1bc89b){for(var _0x4e003a=0x0;_0x4e003a<_0x1bc89b['length'];_0x4e003a++){if(_0x1bc89b[_0x4e003a][_0x9edd('0x68')]in _0x4a72d0){contactItemTypes[_0x9edd('0x21')](_0x1bc89b[_0x4e003a]);delete _0x134c9c[_0x1bc89b[_0x4e003a]['name']];hasAdditionalPhones=!![];}for(var _0xb9ebeb in _0x4a72d0){if(_0x1bc89b[_0x4e003a][_0x9edd('0x68')]+_0x9edd('0x69')===_0xb9ebeb){phoneDescriptions['push']({'itemTypeId':_0x1bc89b[_0x4e003a]['id'],'description':_0xb9ebeb});delete _0x134c9c[_0xb9ebeb];}}}if(hasAdditionalPhones)_0x134c9c[_0x9edd('0x25')]='';var _0x57695c=_[_0x9edd('0x53')](_0x134c9c)[_0x9edd('0x16')]();logger['info'](_0x9edd('0x6a'),_0x57695c);fs[_0x9edd('0x6b')](_0x321485,_0x57695c+'\x0a');Papa['parse'](fs[_0x9edd('0x6c')](_0x344692),{'header':!![],'skipEmptyLines':!![],'step':function(_0x475dc3,_0x460a92){try{for(var _0x1d9536=0x0,_0x5ce70b=[];_0x1d9536<_0x475dc3[_0x9edd('0x6d')]['length'];_0x1d9536++){stats[_0x9edd('0x6e')]+=0x1;if(_0x475dc3[_0x9edd('0x5a')][_0x1d9536]){handleError(_0x475dc3[_0x9edd('0x6d')][_0x1d9536],_0x475dc3['errors'][_0x1d9536]);}else{var _0x106a67=[];var _0x286593=[];var _0x130dba={};for(var _0x383cb9 in _0x4a72d0){let _0x25626a=contactItemTypes[_0x9edd('0x6f')](_0x3fa4a9=>_0x3fa4a9['name']===_0x383cb9);let _0x5e29d0=contactItemTypes[_0x9edd('0x6f')](_0x3c7874=>_0x3c7874[_0x9edd('0x68')]+_0x9edd('0x69')===_0x383cb9);if(_[_0x9edd('0x20')](_0x25626a)&&_['isNil'](_0x5e29d0)){if(_0x4a72d0[_0x9edd('0x70')](_0x383cb9)){if(_0x475dc3[_0x9edd('0x6d')][_0x1d9536][_0x4a72d0[_0x383cb9]]){var _0x3e284d=_['trim'](_0x475dc3[_0x9edd('0x6d')][_0x1d9536][_0x4a72d0[_0x383cb9]][_0x9edd('0x71')](/"/g,'\x27'));switch(_0x383cb9){case'scheduledat':var _0x3f3093=moment(_0x3e284d,_0x9edd('0xe'),!![]);if(_0x3f3093['isValid']()){_0x5ce70b[_0x9edd('0x21')]('\x22'+_0x3e284d+'\x22');}else{_0x106a67[_0x9edd('0x21')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x9edd('0x72'):var _0x4b8cbc=parseInt(_0x3e284d);_0x3e284d=_['isNaN'](_0x4b8cbc)||_0x4b8cbc<0x0||_0x4b8cbc>0x4?_0x2651a2?0x3:0x2:_0x4b8cbc;_0x5ce70b[_0x9edd('0x21')]('\x22'+_0x3e284d+'\x22');break;case _0x9edd('0x3f'):var _0x44b426=parseInt(_0x3e284d);if(_['isNumber'](_0x44b426)&&_[_0x9edd('0x73')](_0x5ca123,_0x44b426)){_0x5ce70b[_0x9edd('0x21')]('\x22'+_0x44b426+'\x22');}else{_0x106a67['push'](_0x9edd('0x74'));}break;case _0x9edd('0x75'):if(isEmail(_0x3e284d)){_0x5ce70b[_0x9edd('0x21')]('\x22'+_0x3e284d+'\x22');}else{_0x106a67[_0x9edd('0x21')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x1129b7=moment(_0x3e284d,'YYYY-MM-DD',!![]);if(_0x1129b7[_0x9edd('0x76')]()){_0x5ce70b[_0x9edd('0x21')]('\x22'+_0x3e284d+'\x22');}else{_0x106a67[_0x9edd('0x21')](_0x9edd('0x77'));}break;default:_0x5ce70b[_0x9edd('0x21')]('\x22'+_0x3e284d+'\x22');}}else{switch(_0x383cb9){case _0x9edd('0x78'):case _0x9edd('0x14'):_0x106a67[_0x9edd('0x21')](_0x383cb9+_0x9edd('0x79'));break;default:_0x5ce70b['push']('\x22\x22');}}}}else{var _0x1f66fa='';if(!_[_0x9edd('0x20')](_0x25626a)){if(!_0x130dba[_0x9edd('0x70')](_0x25626a['id'])){for(var _0x8cc956=0x0;_0x8cc956<_0x4a72d0[_0x383cb9][_0x9edd('0x1f')];_0x8cc956++){var _0x3e284d=_[_0x9edd('0x7a')](_0x475dc3['data'][_0x1d9536][_0x4a72d0[_0x383cb9][_0x8cc956]][_0x9edd('0x71')](/"/g,'\x27'));var _0x454992=phoneDescriptions['find'](_0x26c11a=>_0x26c11a[_0x9edd('0x7b')]===_0x25626a['id']);if(!_['isNil'](_0x454992)){var _0x304e56=_[_0x9edd('0x7a')](_0x475dc3[_0x9edd('0x6d')][_0x1d9536][_0x4a72d0[_0x454992['description']][0x0]][_0x9edd('0x71')](/"/g,'\x27'));if(!_[_0x9edd('0x20')](_0x304e56))_0x3e284d=_0x3e284d+'§'+_0x304e56;}if(_0x1f66fa=='')_0x1f66fa=_0x3e284d;else _0x1f66fa+='|'+_0x3e284d;}_0x286593[_0x9edd('0x21')](_0x25626a['id']+':'+_0x1f66fa);_0x130dba[_0x25626a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5ce70b['push']('\x22'+_0x286593['join'](';')+'\x22');}if(_0x106a67['length']){handleError(_0x475dc3['data'][_0x1d9536],{'code':_0x9edd('0x7c'),'message':_0x106a67[_0x9edd('0x16')]()});}else{fs[_0x9edd('0x7d')](_0x321485,_0x5ce70b['join']()+'\x0a');}_0x5ce70b=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x9edd('0x7e')+_0x50f4fc,stats);stats[_0x9edd('0x5a')]=[];}}if(stopped){logger[_0x9edd('0x5c')](_0x9edd('0x7f'));_0x460a92[_0x9edd('0x80')]();}}catch(_0x18b25e){handleError(_0x475dc3[_0x9edd('0x6d')][_0x1d9536],{'code':_0x9edd('0x81'),'message':_0x18b25e[_0x9edd('0x5d')]});logger[_0x9edd('0x24')](_0x9edd('0x82'),_0x18b25e[_0x9edd('0x5d')]);}},'complete':function(){try{var _0x4cfa99=[];var _0x367fc6=tempTableName;_0x4cfa99[_0x9edd('0x21')](_0x9edd('0x83')+_0x367fc6+_0x9edd('0x84'));logger[_0x9edd('0x5c')](_0x9edd('0x85'),contactItemTypes[_0x9edd('0x1f')]);var _0x16b69c=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x321485,_0x367fc6,_0x57695c,_0xc6bde6[_0x9edd('0x3d')],_0xc6bde6['CompanyId']||null,NOW,NOW);if(_[_0x9edd('0x20')](_0x4a72d0['scheduledat'])){_0x16b69c+=_0x9edd('0x86');}_0x4cfa99[_0x9edd('0x21')](_0x16b69c);BPromise['each'](_0x4cfa99,handleQuery)[_0x9edd('0x23')](function(_0x411134){BPromise['all']([handleAdditionalPhones()])[_0x9edd('0x23')](function(){_0x4cfa99=[];for(var _0x3d1294=0x0;_0x3d1294=_0x4ea03c){return _0xddb692['status'](0x193)['json']({'message':util[_0x62cc('0x8')](_0x62cc('0x11'),_0x974125)});}_0x1518b3();})[_0x62cc('0x12')](function(_0x46d767){_0x1518b3(_0x46d767);});});}function isUserLimit(){return isLimit(_0x62cc('0x13'),0x1,db[_0x62cc('0x14')],{'where':{'$or':[{'role':_0x62cc('0x15')},{'role':_0x62cc('0x16')}]}});}exports[_0x62cc('0x17')]=isUserLimit; \ No newline at end of file +var _0xc944=['license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','utf8','final','parse','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','util','../../mysqldb','../../config/environment','data1'];(function(_0x21aad5,_0x3e38ff){var _0x253e06=function(_0x5a35d0){while(--_0x5a35d0){_0x21aad5['push'](_0x21aad5['shift']());}};_0x253e06(++_0x3e38ff);}(_0xc944,0x19e));var _0x4c94=function(_0x1ecbe1,_0x34ecab){_0x1ecbe1=_0x1ecbe1-0x0;var _0x24b65e=_0xc944[_0x1ecbe1];return _0x24b65e;};'use strict';var crypto=require('crypto');var util=require(_0x4c94('0x0'));var compose=require('composable-middleware');var db=require(_0x4c94('0x1'))['db'];var config=require(_0x4c94('0x2'));function getValueFromLicense(_0x42d62a,_0x43cea6){if(_0x42d62a&&_0x43cea6){if(_0x43cea6[_0x4c94('0x3')]&&_0x43cea6[_0x4c94('0x4')]){var _0x4d7219=_0x43cea6[_0x4c94('0x3')];var _0x5a2407=_0x43cea6[_0x4c94('0x4')];var _0x1a0df7=_0x4d7219[_0x4c94('0x5')]('-')[0x4];var _0x65d58c=_0x4d7219[_0x4c94('0x5')]('-')[0x0];var _0xaeccc=crypto[_0x4c94('0x6')](_0x4c94('0x7'),util[_0x4c94('0x8')](_0x4c94('0x9'),_0x1a0df7,_0x4d7219,_0x65d58c));var _0x2a0320=_0xaeccc['update'](_0x5a2407,'base64',_0x4c94('0xa'));_0x2a0320+=_0xaeccc[_0x4c94('0xb')](_0x4c94('0xa'));var _0x3db995=JSON[_0x4c94('0xc')](_0x2a0320);return _0x3db995['hasOwnProperty'](_0x42d62a)?_0x3db995[_0x42d62a]:null;}}return null;}function isLimit(_0x2d1766,_0x42cec1,_0x52dabb,_0xbd3ebc){var _0x33c499=_0x42cec1;return compose()['use'](function(_0x4e4f73,_0x4c8fc2,_0x21e99e){return db[_0x4c94('0xd')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x4c94('0xe')](function(_0x423354){var _0x41fe41=getValueFromLicense(_0x2d1766,_0x423354);return _0x41fe41?_0x41fe41:_0x33c499;})[_0x4c94('0xe')](function(_0x41a0f1){_0x33c499=_0x41a0f1;return _0x52dabb[_0x4c94('0xf')](_0xbd3ebc);})['then'](function(_0x3b659c){if(_0x3b659c>=_0x33c499){return _0x4c8fc2[_0x4c94('0x10')](0x193)[_0x4c94('0x11')]({'message':util[_0x4c94('0x8')](_0x4c94('0x12'),_0x2d1766)});}_0x21e99e();})[_0x4c94('0x13')](function(_0x81c899){_0x21e99e(_0x81c899);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x4c94('0x14')],{'where':{'$or':[{'role':_0x4c94('0x15')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index c256633..5d7f2ef 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 _0xa4c2=['replace','[$and]','split','length','slice','forEach','match','filter','map','conditions','push','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','add','days','YYYY-MM-DD','castTo','CAST(','\x20AS\x20','text','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','$between','BETWEEN\x20?\x20AND\x20?','start','$substring','$startsWith','pop','utcOffset','hours','minutes','seconds','format','moment','parseSearch','sqlOperator','startsWith','[$or]','and'];(function(_0x4b01b7,_0x183b04){var _0x2ed185=function(_0x4a1222){while(--_0x4a1222){_0x4b01b7['push'](_0x4b01b7['shift']());}};_0x2ed185(++_0x183b04);}(_0xa4c2,0x15c));var _0x2a4c=function(_0x289a63,_0x1ac3e4){_0x289a63=_0x289a63-0x0;var _0x2597f4=_0xa4c2[_0x289a63];return _0x2597f4;};'use strict';var _=require('lodash');var moment=require(_0x2a4c('0x0'));exports[_0x2a4c('0x1')]=function(_0x1ac2b3){var _0x495bb4={'conditions':[]};_0x495bb4[_0x2a4c('0x2')]=_[_0x2a4c('0x3')](_0x1ac2b3,_0x2a4c('0x4'))?'or':_0x2a4c('0x5');var _0x193d72=_0x1ac2b3[_0x2a4c('0x6')](_0x2a4c('0x7'),'')[_0x2a4c('0x6')](_0x2a4c('0x4'),'')[_0x2a4c('0x8')]('||');for(var _0x3579f8=0x0;_0x3579f8<_0x193d72[_0x2a4c('0x9')];_0x3579f8++){var _0x5400d2=_0x193d72[_0x3579f8][_0x2a4c('0x8')](':=');var _0x2c2dd4=_0x5400d2[0x0];var _0x49d2f5=_0x5400d2[_0x2a4c('0xa')](0x1);_0x49d2f5[_0x2a4c('0xb')](function(_0x4dee18){var _0x3002f0=_0x4dee18[_0x2a4c('0x8')]('[')['shift']();var _0x51a602=_0x4dee18[_0x2a4c('0xc')](/\[(.*?)\]/g);_0x51a602['forEach'](function(_0x34015a){var _0x2e610e=_0x34015a[_0x2a4c('0x8')]('[')[_0x2a4c('0xd')](function(_0x2dc236){return _0x2dc236['indexOf'](']')>-0x1;})[_0x2a4c('0xe')](function(_0x3c3246){return _0x3c3246[_0x2a4c('0x8')](']')[0x0];})[0x0];_0x495bb4[_0x2a4c('0xf')][_0x2a4c('0x10')]({'field':_0x2c2dd4,'operator':_0x3002f0,'value':_0x2e610e});});});}return _0x495bb4;};exports[_0x2a4c('0x11')]=function(_0x9163c6,_0x272da6,_0x3a899e){var _0x93500e={};if(_0x272da6===_0x2a4c('0x12')){if(_0x3a899e[_0x2a4c('0x13')]===_0x2a4c('0x14')){_0x3a899e[_0x2a4c('0x13')]='$between';_0x3a899e[_0x2a4c('0x15')]+=','+_0x3a899e[_0x2a4c('0x15')];}else if(_[_0x2a4c('0x16')]([_0x2a4c('0x17'),_0x2a4c('0x18')],_0x3a899e[_0x2a4c('0x13')])){_0x3a899e[_0x2a4c('0x15')]=moment(_0x3a899e['value'])[_0x2a4c('0x19')](0x1,_0x2a4c('0x1a'))['format'](_0x2a4c('0x1b'));}}if(_0x3a899e[_0x2a4c('0x1c')]){_0x272da6=_0x3a899e[_0x2a4c('0x1c')];_0x93500e['text']=_0x2a4c('0x1d')+_0x9163c6+'.'+_0x3a899e['field']+_0x2a4c('0x1e')+_0x3a899e[_0x2a4c('0x1c')]+')\x20'+parseOperator(_0x3a899e['operator']);}else{_0x93500e[_0x2a4c('0x1f')]=_0x9163c6+'.'+_0x3a899e[_0x2a4c('0x20')]+'\x20'+parseOperator(_0x3a899e[_0x2a4c('0x13')]);}if(_['includes']([_0x2a4c('0x21'),_0x2a4c('0x22')],_0x3a899e['operator']))_0x93500e[_0x2a4c('0x1f')]='('+_0x93500e['text']+_0x2a4c('0x23')+_0x9163c6+'.'+_0x3a899e[_0x2a4c('0x20')]+_0x2a4c('0x24');_0x93500e[_0x2a4c('0x15')]=parseValue(_0x272da6,_0x3a899e[_0x2a4c('0x13')],_0x3a899e[_0x2a4c('0x15')]);return _0x93500e;};function parseOperator(_0x47b4a3){var _0x4be657;switch(_0x47b4a3){case _0x2a4c('0x25'):_0x4be657=_0x2a4c('0x26');break;case _0x2a4c('0x22'):_0x4be657='NOT\x20IN\x20?';break;case _0x2a4c('0x14'):_0x4be657=_0x2a4c('0x27');break;case _0x2a4c('0x21'):_0x4be657=_0x2a4c('0x28');break;case'$substring':case'$startsWith':case _0x2a4c('0x29'):_0x4be657=_0x2a4c('0x2a');break;case _0x2a4c('0x2b'):_0x4be657=_0x2a4c('0x2c');break;case'$gt':_0x4be657=_0x2a4c('0x2d');break;case _0x2a4c('0x18'):_0x4be657=_0x2a4c('0x2e');break;case _0x2a4c('0x2f'):_0x4be657='>=\x20?';break;case _0x2a4c('0x30'):_0x4be657=_0x2a4c('0x31');break;}return _0x4be657;}function parseValue(_0x4b7aa3,_0x5aea5a,_0x2d4eba){var _0x3b1e8b={'start':undefined,'end':undefined};switch(_0x5aea5a){case _0x2a4c('0x25'):case'$notIn':_0x3b1e8b[_0x2a4c('0x32')]=_0x2d4eba[_0x2a4c('0x8')](',');break;case _0x2a4c('0x33'):_0x3b1e8b[_0x2a4c('0x32')]='%'+_0x2d4eba+'%';break;case _0x2a4c('0x34'):_0x3b1e8b['start']=_0x2d4eba+'%';break;case _0x2a4c('0x29'):_0x3b1e8b[_0x2a4c('0x32')]='%'+_0x2d4eba;break;case _0x2a4c('0x30'):var _0x33ad88=_0x2d4eba[_0x2a4c('0x8')](',');var _0x2d4eba=_0x33ad88['shift']();var _0x338597=_0x33ad88[_0x2a4c('0x35')]();if(_0x4b7aa3===_0x2a4c('0x12')){_0x2d4eba=moment(_0x2d4eba)[_0x2a4c('0x36')](0x0,!![])['format']();_0x338597=moment(_0x338597)[_0x2a4c('0x36')](0x0,!![])['add'](0x17,_0x2a4c('0x37'))[_0x2a4c('0x19')](0x3b,_0x2a4c('0x38'))[_0x2a4c('0x19')](0x3b,_0x2a4c('0x39'))[_0x2a4c('0x3a')]();}_0x3b1e8b={'start':_0x2d4eba,'end':_0x338597};break;default:_0x3b1e8b[_0x2a4c('0x32')]=_0x2d4eba;break;}return _0x3b1e8b;} \ No newline at end of file +var _0x8000=['$eq','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','field','\x20AS\x20','text','includes','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','<\x20?','>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','$substring','shift','hours','minutes','seconds','lodash','moment','sqlOperator','[$or]','and','replace','[$and]','split','length','slice','forEach','match','filter','indexOf','push','DATE','operator'];(function(_0x485e0b,_0x5eb3e3){var _0x12283c=function(_0x12b84b){while(--_0x12b84b){_0x485e0b['push'](_0x485e0b['shift']());}};_0x12283c(++_0x5eb3e3);}(_0x8000,0x121));var _0x0800=function(_0x2aa4b9,_0x39044f){_0x2aa4b9=_0x2aa4b9-0x0;var _0x10ba69=_0x8000[_0x2aa4b9];return _0x10ba69;};'use strict';var _=require(_0x0800('0x0'));var moment=require(_0x0800('0x1'));exports['parseSearch']=function(_0x5e9ad5){var _0x1e0156={'conditions':[]};_0x1e0156[_0x0800('0x2')]=_['startsWith'](_0x5e9ad5,_0x0800('0x3'))?'or':_0x0800('0x4');var _0x556362=_0x5e9ad5[_0x0800('0x5')](_0x0800('0x6'),'')[_0x0800('0x5')](_0x0800('0x3'),'')[_0x0800('0x7')]('||');for(var _0x503ce8=0x0;_0x503ce8<_0x556362[_0x0800('0x8')];_0x503ce8++){var _0x40cff3=_0x556362[_0x503ce8][_0x0800('0x7')](':=');var _0x12e03a=_0x40cff3[0x0];var _0x18f1e0=_0x40cff3[_0x0800('0x9')](0x1);_0x18f1e0[_0x0800('0xa')](function(_0x126fb4){var _0x13b54a=_0x126fb4['split']('[')['shift']();var _0xf59b00=_0x126fb4[_0x0800('0xb')](/\[(.*?)\]/g);_0xf59b00['forEach'](function(_0x1e05b3){var _0x5dc7c6=_0x1e05b3[_0x0800('0x7')]('[')[_0x0800('0xc')](function(_0x2179ad){return _0x2179ad[_0x0800('0xd')](']')>-0x1;})['map'](function(_0x367993){return _0x367993[_0x0800('0x7')](']')[0x0];})[0x0];_0x1e0156['conditions'][_0x0800('0xe')]({'field':_0x12e03a,'operator':_0x13b54a,'value':_0x5dc7c6});});});}return _0x1e0156;};exports['buildExpression']=function(_0x46d3a1,_0xea6834,_0xe3a3e){var _0x298dff={};if(_0xea6834===_0x0800('0xf')){if(_0xe3a3e[_0x0800('0x10')]===_0x0800('0x11')){_0xe3a3e[_0x0800('0x10')]=_0x0800('0x12');_0xe3a3e['value']+=','+_0xe3a3e[_0x0800('0x13')];}else if(_['includes']([_0x0800('0x14'),_0x0800('0x15')],_0xe3a3e['operator'])){_0xe3a3e['value']=moment(_0xe3a3e[_0x0800('0x13')])[_0x0800('0x16')](0x1,_0x0800('0x17'))[_0x0800('0x18')](_0x0800('0x19'));}}if(_0xe3a3e['castTo']){_0xea6834=_0xe3a3e[_0x0800('0x1a')];_0x298dff['text']='CAST('+_0x46d3a1+'.'+_0xe3a3e[_0x0800('0x1b')]+_0x0800('0x1c')+_0xe3a3e[_0x0800('0x1a')]+')\x20'+parseOperator(_0xe3a3e[_0x0800('0x10')]);}else{_0x298dff[_0x0800('0x1d')]=_0x46d3a1+'.'+_0xe3a3e[_0x0800('0x1b')]+'\x20'+parseOperator(_0xe3a3e[_0x0800('0x10')]);}if(_[_0x0800('0x1e')](['$ne',_0x0800('0x1f')],_0xe3a3e[_0x0800('0x10')]))_0x298dff[_0x0800('0x1d')]='('+_0x298dff[_0x0800('0x1d')]+'\x20OR\x20'+_0x46d3a1+'.'+_0xe3a3e['field']+_0x0800('0x20');_0x298dff['value']=parseValue(_0xea6834,_0xe3a3e['operator'],_0xe3a3e[_0x0800('0x13')]);return _0x298dff;};function parseOperator(_0x14353c){var _0x1a3903;switch(_0x14353c){case _0x0800('0x21'):_0x1a3903=_0x0800('0x22');break;case _0x0800('0x1f'):_0x1a3903=_0x0800('0x23');break;case _0x0800('0x11'):_0x1a3903=_0x0800('0x24');break;case'$ne':_0x1a3903=_0x0800('0x25');break;case'$substring':case _0x0800('0x26'):case _0x0800('0x27'):_0x1a3903='LIKE\x20?';break;case'$lt':_0x1a3903=_0x0800('0x28');break;case _0x0800('0x14'):_0x1a3903=_0x0800('0x29');break;case _0x0800('0x15'):_0x1a3903=_0x0800('0x2a');break;case _0x0800('0x2b'):_0x1a3903='>=\x20?';break;case _0x0800('0x12'):_0x1a3903=_0x0800('0x2c');break;}return _0x1a3903;}function parseValue(_0x210d13,_0x3c5276,_0x3b0c23){var _0x3f4f13={'start':undefined,'end':undefined};switch(_0x3c5276){case _0x0800('0x21'):case'$notIn':_0x3f4f13[_0x0800('0x2d')]=_0x3b0c23[_0x0800('0x7')](',');break;case _0x0800('0x2e'):_0x3f4f13[_0x0800('0x2d')]='%'+_0x3b0c23+'%';break;case _0x0800('0x26'):_0x3f4f13[_0x0800('0x2d')]=_0x3b0c23+'%';break;case _0x0800('0x27'):_0x3f4f13[_0x0800('0x2d')]='%'+_0x3b0c23;break;case _0x0800('0x12'):var _0x5e51b9=_0x3b0c23[_0x0800('0x7')](',');var _0x3b0c23=_0x5e51b9[_0x0800('0x2f')]();var _0x406870=_0x5e51b9['pop']();if(_0x210d13===_0x0800('0xf')){_0x3b0c23=moment(_0x3b0c23)['utcOffset'](0x0,!![])[_0x0800('0x18')]();_0x406870=moment(_0x406870)['utcOffset'](0x0,!![])[_0x0800('0x16')](0x17,_0x0800('0x30'))['add'](0x3b,_0x0800('0x31'))['add'](0x3b,_0x0800('0x32'))[_0x0800('0x18')]();}_0x3f4f13={'start':_0x3b0c23,'end':_0x406870};break;default:_0x3f4f13[_0x0800('0x2d')]=_0x3b0c23;break;}return _0x3f4f13;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 00648fc..3de2662 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 _0xbd4e=['omit','length','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','includes','join','lodash','sequelize','moment','fields','split','isEmpty','forOwn','find','type','DATE','isPlainObject','YYYY-MM-DD','format','subtract','name','uniqueid','isArray','parse','limit','map','indexOf','priority','cast','col','unsigned','substr','DESC'];(function(_0x12c0e3,_0x539b0e){var _0x2aeba0=function(_0x22ccae){while(--_0x22ccae){_0x12c0e3['push'](_0x12c0e3['shift']());}};_0x2aeba0(++_0x539b0e);}(_0xbd4e,0x1d3));var _0xebd4=function(_0x5bab7e,_0x11d30e){_0x5bab7e=_0x5bab7e-0x0;var _0x2a6d71=_0xbd4e[_0x5bab7e];return _0x2a6d71;};'use strict';var _=require(_0xebd4('0x0'));var sequelize=require(_0xebd4('0x1'));var moment=require(_0xebd4('0x2'));var LIMIT_VALUE=0xfa;exports[_0xebd4('0x3')]=function(_0x1411d3){var _0x1a5680=null;if(_0x1411d3){_0x1a5680=_0x1411d3[_0xebd4('0x4')](',');}return _0x1a5680;};exports['filters']=function(_0xeeea14,_0xb7019f){var _0x12bd34={};if(!_[_0xebd4('0x5')](_0xeeea14)){_[_0xebd4('0x6')](_0xeeea14,function(_0x544fce,_0x5b047d){try{if(_0xb7019f){var _0x2764f3=_[_0xebd4('0x7')](_0xb7019f,{'name':_0x5b047d})||{};if(_0x2764f3[_0xebd4('0x8')]===_0xebd4('0x9')&&_[_0xebd4('0xa')](_0x544fce)){var _0x44626e=JSON['parse'](_0x544fce);var _0x140c7a={'$gte':moment(moment(_0x44626e['$gte'])['format'](_0xebd4('0xb')))['utc']()[_0xebd4('0xc')](),'$lte':moment(moment(_0x44626e['$lte'])[_0xebd4('0xc')](_0xebd4('0xb')))['utc']()[_0xebd4('0xd')](0x1,'s')['format']()};_0x12bd34[_0x5b047d]=_0x140c7a;}else if(_0x2764f3[_0xebd4('0xe')]===_0xebd4('0xf')){_0x12bd34[_0x5b047d]=_0x544fce;}else{_0x12bd34[_0x5b047d]=_[_0xebd4('0x10')](_0x544fce)?_0x544fce:JSON[_0xebd4('0x11')](_0x544fce);}}else{_0x12bd34[_0x5b047d]=_['isArray'](_0x544fce)?_0x544fce:JSON[_0xebd4('0x11')](_0x544fce);}}catch(_0xd96968){_0x12bd34[_0x5b047d]=_0x544fce[_0xebd4('0x4')](',');}});}return _0x12bd34;};exports[_0xebd4('0x12')]=function(_0x3d05ad){_0x3d05ad=parseInt(_0x3d05ad,0xa);if(!_0x3d05ad||_0x3d05ad<0x0){_0x3d05ad=LIMIT_VALUE;}return _0x3d05ad;};exports['offset']=function(_0x5469f2){_0x5469f2=parseInt(_0x5469f2,0xa);if(!_0x5469f2||_0x5469f2<0x0){_0x5469f2=0x0;}return _0x5469f2;};exports['sort']=function(_0x325364){var _0x172c61,_0x5ae809=null;if(_0x325364){_0x172c61=_0x325364[_0xebd4('0x4')](',');_0x5ae809=_[_0xebd4('0x13')](_0x172c61,function(_0x1457b0){if(_0x1457b0[_0xebd4('0x14')]('-')===0x0){return[_0x1457b0===_0xebd4('0x15')?sequelize[_0xebd4('0x16')](sequelize[_0xebd4('0x17')](_0xebd4('0x15')),_0xebd4('0x18')):_0x1457b0[_0xebd4('0x19')](0x1),_0xebd4('0x1a')];}else{return[_0x1457b0==='priority'?sequelize['cast'](sequelize[_0xebd4('0x17')](_0xebd4('0x15')),_0xebd4('0x18')):_0x1457b0,'ASC'];}});}return _0x5ae809;};exports[_0xebd4('0x1b')]=function(_0x3425c4,_0x5ada0e){if(_[_0xebd4('0x5')](_0x3425c4)){return _0x3425c4;}if(_[_0xebd4('0x10')](_0x3425c4)){for(var _0x3b1f0b=0x0;_0x3b1f0b<_0x3425c4[_0xebd4('0x1c')];_0x3b1f0b+=0x1){_0x3425c4[_0x3b1f0b]=this[_0xebd4('0x1b')](_0x3425c4[_0x3b1f0b],_0x5ada0e);}return _0x3425c4;}if(!_['isObject'](_0x3425c4)){return _0x3425c4;}if(_['isString'](_0x5ada0e)){_0x5ada0e=[_0x5ada0e];}if(!_[_0xebd4('0x10')](_0x5ada0e)){return _0x3425c4;}for(var _0x342c5e=0x0;_0x342c5e<_0x5ada0e[_0xebd4('0x1c')];_0x342c5e+=0x1){_['unset'](_0x3425c4,_0x5ada0e[_0x342c5e]);}for(var _0xaa7a3e in _0x3425c4){if(_0x3425c4[_0xebd4('0x1d')](_0xaa7a3e)){_0x3425c4[_0xaa7a3e]=this['omit'](_0x3425c4[_0xaa7a3e],_0x5ada0e);}}return _0x3425c4;};exports[_0xebd4('0x1e')]=function(_0x504ad4){return _0x504ad4[_0xebd4('0x1f')](RegExp(_0xebd4('0x20')))?!![]:![];};exports['isEmail']=function(_0x1c3828){return _0x1c3828[_0xebd4('0x1f')](/^\S+@\S+$/)?!![]:![];};exports[_0xebd4('0x21')]=function(_0x1d8573){var _0x44deec=[];_0x1d8573[_0xebd4('0x4')](/[ ,]+/)[_0xebd4('0x22')](function(_0x31b915){_0x31b915=_0x31b915[_0xebd4('0x23')](/([^:]")"+/g,'$1');_0x31b915='+'+_0x31b915+'*';if(_0x31b915[_0xebd4('0x24')]('@'))_0x31b915='\x22'+_0x31b915+'\x22';_0x44deec['push'](_0x31b915);});return _0x44deec[_0xebd4('0x25')]('\x20');}; \ No newline at end of file +var _0xf296=['isArray','limit','sort','map','priority','cast','unsigned','substr','DESC','col','ASC','omit','length','unset','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','replace','includes','join','lodash','sequelize','moment','fields','split','filters','isEmpty','find','type','DATE','parse','$gte','format','YYYY-MM-DD','$lte','subtract','name','uniqueid'];(function(_0x5e800d,_0x55539d){var _0xa98ae1=function(_0x46991b){while(--_0x46991b){_0x5e800d['push'](_0x5e800d['shift']());}};_0xa98ae1(++_0x55539d);}(_0xf296,0xff));var _0x6f29=function(_0x11ba46,_0x1d6752){_0x11ba46=_0x11ba46-0x0;var _0x1c8c6f=_0xf296[_0x11ba46];return _0x1c8c6f;};'use strict';var _=require(_0x6f29('0x0'));var sequelize=require(_0x6f29('0x1'));var moment=require(_0x6f29('0x2'));var LIMIT_VALUE=0xfa;exports[_0x6f29('0x3')]=function(_0x5b7f98){var _0x27abe8=null;if(_0x5b7f98){_0x27abe8=_0x5b7f98[_0x6f29('0x4')](',');}return _0x27abe8;};exports[_0x6f29('0x5')]=function(_0x861170,_0x57bbe7){var _0xfc6152={};if(!_[_0x6f29('0x6')](_0x861170)){_['forOwn'](_0x861170,function(_0x2b48fd,_0x333199){try{if(_0x57bbe7){var _0x262460=_[_0x6f29('0x7')](_0x57bbe7,{'name':_0x333199})||{};if(_0x262460[_0x6f29('0x8')]===_0x6f29('0x9')&&_['isPlainObject'](_0x2b48fd)){var _0x36b496=JSON[_0x6f29('0xa')](_0x2b48fd);var _0x443e99={'$gte':moment(moment(_0x36b496[_0x6f29('0xb')])[_0x6f29('0xc')](_0x6f29('0xd')))['utc']()[_0x6f29('0xc')](),'$lte':moment(moment(_0x36b496[_0x6f29('0xe')])[_0x6f29('0xc')]('YYYY-MM-DD'))['utc']()[_0x6f29('0xf')](0x1,'s')[_0x6f29('0xc')]()};_0xfc6152[_0x333199]=_0x443e99;}else if(_0x262460[_0x6f29('0x10')]===_0x6f29('0x11')){_0xfc6152[_0x333199]=_0x2b48fd;}else{_0xfc6152[_0x333199]=_[_0x6f29('0x12')](_0x2b48fd)?_0x2b48fd:JSON['parse'](_0x2b48fd);}}else{_0xfc6152[_0x333199]=_[_0x6f29('0x12')](_0x2b48fd)?_0x2b48fd:JSON[_0x6f29('0xa')](_0x2b48fd);}}catch(_0x34b405){_0xfc6152[_0x333199]=_0x2b48fd[_0x6f29('0x4')](',');}});}return _0xfc6152;};exports[_0x6f29('0x13')]=function(_0x3a58a1){_0x3a58a1=parseInt(_0x3a58a1,0xa);if(!_0x3a58a1||_0x3a58a1<0x0){_0x3a58a1=LIMIT_VALUE;}return _0x3a58a1;};exports['offset']=function(_0x370e6b){_0x370e6b=parseInt(_0x370e6b,0xa);if(!_0x370e6b||_0x370e6b<0x0){_0x370e6b=0x0;}return _0x370e6b;};exports[_0x6f29('0x14')]=function(_0x285be1){var _0x809884,_0x3fabad=null;if(_0x285be1){_0x809884=_0x285be1['split'](',');_0x3fabad=_[_0x6f29('0x15')](_0x809884,function(_0x22dd41){if(_0x22dd41['indexOf']('-')===0x0){return[_0x22dd41===_0x6f29('0x16')?sequelize[_0x6f29('0x17')](sequelize['col'](_0x6f29('0x16')),_0x6f29('0x18')):_0x22dd41[_0x6f29('0x19')](0x1),_0x6f29('0x1a')];}else{return[_0x22dd41==='priority'?sequelize[_0x6f29('0x17')](sequelize[_0x6f29('0x1b')](_0x6f29('0x16')),'unsigned'):_0x22dd41,_0x6f29('0x1c')];}});}return _0x3fabad;};exports[_0x6f29('0x1d')]=function(_0x160187,_0x379e17){if(_[_0x6f29('0x6')](_0x160187)){return _0x160187;}if(_[_0x6f29('0x12')](_0x160187)){for(var _0x339649=0x0;_0x339649<_0x160187[_0x6f29('0x1e')];_0x339649+=0x1){_0x160187[_0x339649]=this[_0x6f29('0x1d')](_0x160187[_0x339649],_0x379e17);}return _0x160187;}if(!_['isObject'](_0x160187)){return _0x160187;}if(_['isString'](_0x379e17)){_0x379e17=[_0x379e17];}if(!_['isArray'](_0x379e17)){return _0x160187;}for(var _0x3d3340=0x0;_0x3d3340<_0x379e17['length'];_0x3d3340+=0x1){_[_0x6f29('0x1f')](_0x160187,_0x379e17[_0x3d3340]);}for(var _0x25ab56 in _0x160187){if(_0x160187[_0x6f29('0x20')](_0x25ab56)){_0x160187[_0x25ab56]=this[_0x6f29('0x1d')](_0x160187[_0x25ab56],_0x379e17);}}return _0x160187;};exports['isNumeric']=function(_0x30b0b1){return _0x30b0b1[_0x6f29('0x21')](RegExp(_0x6f29('0x22')))?!![]:![];};exports['isEmail']=function(_0x2af90e){return _0x2af90e['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x6f29('0x23')]=function(_0x512f93){var _0x31fd21=[];_0x512f93['split'](/[ ,]+/)['forEach'](function(_0x35d66d){_0x35d66d=_0x35d66d[_0x6f29('0x24')](/([^:]")"+/g,'$1');_0x35d66d='+'+_0x35d66d+'*';if(_0x35d66d[_0x6f29('0x25')]('@'))_0x35d66d='\x22'+_0x35d66d+'\x22';_0x31fd21['push'](_0x35d66d);});return _0x31fd21[_0x6f29('0x26')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 20fff53..53b8975 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x372a=['path','moment','./environment','default','get','env','production','set','appPath','join','root','public','development','test','client','use','json\x20replacer','toISOString','static','/server/views','engine','html','ejs','view\x20engine','urlencoded','50mb','initialize','express','serve-favicon','cookie-parser'];(function(_0x18daca,_0x1920ad){var _0xce6be1=function(_0xdc8132){while(--_0xdc8132){_0x18daca['push'](_0x18daca['shift']());}};_0xce6be1(++_0x1920ad);}(_0x372a,0x183));var _0xa372=function(_0x150648,_0x283c4a){_0x150648=_0x150648-0x0;var _0x232c79=_0x372a[_0x150648];return _0x232c79;};'use strict';var express=require(_0xa372('0x0'));var favicon=require(_0xa372('0x1'));var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require(_0xa372('0x2'));var errorHandler=require('errorhandler');var path=require(_0xa372('0x3'));var passport=require('passport');var cors=require('cors');var moment=require(_0xa372('0x4'));var config=require(_0xa372('0x5'));var db=require('../mysqldb')['db'];exports[_0xa372('0x6')]=function(_0x4d8cd8){var _0x3dac4b=_0x4d8cd8[_0xa372('0x7')](_0xa372('0x8'));if(_0x3dac4b===_0xa372('0x9')){_0x4d8cd8[_0xa372('0xa')](_0xa372('0xb'),path[_0xa372('0xc')](config[_0xa372('0xd')],_0xa372('0xe')));}if(_0x3dac4b===_0xa372('0xf')||_0x3dac4b===_0xa372('0x10')){_0x4d8cd8[_0xa372('0xa')]('appPath',path[_0xa372('0xc')](config[_0xa372('0xd')],_0xa372('0x11')));_0x4d8cd8[_0xa372('0x12')](errorHandler());}_0x4d8cd8['set'](_0xa372('0x13'),function(_0xd63d1d,_0x155ee6){if(this[_0xd63d1d]instanceof Date){_0x155ee6=this[_0xd63d1d][_0xa372('0x14')]()['split']('.')[0x0]+'Z';}return _0x155ee6;});_0x4d8cd8[_0xa372('0x12')](express[_0xa372('0x15')](_0x4d8cd8[_0xa372('0x7')](_0xa372('0xb'))));_0x4d8cd8[_0xa372('0xa')]('views',config[_0xa372('0xd')]+_0xa372('0x16'));_0x4d8cd8[_0xa372('0x17')](_0xa372('0x18'),require(_0xa372('0x19'))['renderFile']);_0x4d8cd8[_0xa372('0xa')](_0xa372('0x1a'),_0xa372('0x18'));_0x4d8cd8[_0xa372('0x12')](bodyParser[_0xa372('0x1b')]({'limit':_0xa372('0x1c'),'extended':!![]}));_0x4d8cd8[_0xa372('0x12')](bodyParser['json']({'limit':_0xa372('0x1c')}));_0x4d8cd8[_0xa372('0x12')](cors());_0x4d8cd8[_0xa372('0x12')](methodOverride());_0x4d8cd8[_0xa372('0x12')](cookieParser());_0x4d8cd8[_0xa372('0x12')](passport[_0xa372('0x1d')]());}; \ No newline at end of file +var _0x82a2=['cors','./environment','../mysqldb','default','get','env','production','set','appPath','join','root','public','client','use','json\x20replacer','split','static','views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','initialize','body-parser','method-override','cookie-parser','path','passport'];(function(_0xd37615,_0x4c9887){var _0x4d641d=function(_0x15d3d2){while(--_0x15d3d2){_0xd37615['push'](_0xd37615['shift']());}};_0x4d641d(++_0x4c9887);}(_0x82a2,0xd4));var _0x282a=function(_0x59529f,_0x4efdef){_0x59529f=_0x59529f-0x0;var _0x23c992=_0x82a2[_0x59529f];return _0x23c992;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0x282a('0x0'));var methodOverride=require(_0x282a('0x1'));var cookieParser=require(_0x282a('0x2'));var errorHandler=require('errorhandler');var path=require(_0x282a('0x3'));var passport=require(_0x282a('0x4'));var cors=require(_0x282a('0x5'));var moment=require('moment');var config=require(_0x282a('0x6'));var db=require(_0x282a('0x7'))['db'];exports[_0x282a('0x8')]=function(_0x410f52){var _0x1843df=_0x410f52[_0x282a('0x9')](_0x282a('0xa'));if(_0x1843df===_0x282a('0xb')){_0x410f52[_0x282a('0xc')](_0x282a('0xd'),path[_0x282a('0xe')](config[_0x282a('0xf')],_0x282a('0x10')));}if(_0x1843df==='development'||_0x1843df==='test'){_0x410f52[_0x282a('0xc')](_0x282a('0xd'),path[_0x282a('0xe')](config[_0x282a('0xf')],_0x282a('0x11')));_0x410f52[_0x282a('0x12')](errorHandler());}_0x410f52[_0x282a('0xc')](_0x282a('0x13'),function(_0x174d01,_0xd96827){if(this[_0x174d01]instanceof Date){_0xd96827=this[_0x174d01]['toISOString']()[_0x282a('0x14')]('.')[0x0]+'Z';}return _0xd96827;});_0x410f52[_0x282a('0x12')](express[_0x282a('0x15')](_0x410f52[_0x282a('0x9')](_0x282a('0xd'))));_0x410f52['set'](_0x282a('0x16'),config[_0x282a('0xf')]+'/server/views');_0x410f52[_0x282a('0x17')](_0x282a('0x18'),require(_0x282a('0x19'))[_0x282a('0x1a')]);_0x410f52['set'](_0x282a('0x1b'),_0x282a('0x18'));_0x410f52['use'](bodyParser[_0x282a('0x1c')]({'limit':_0x282a('0x1d'),'extended':!![]}));_0x410f52[_0x282a('0x12')](bodyParser['json']({'limit':_0x282a('0x1d')}));_0x410f52['use'](cors());_0x410f52[_0x282a('0x12')](methodOverride());_0x410f52[_0x282a('0x12')](cookieParser());_0x410f52['use'](passport[_0x282a('0x1e')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 54ee63c..08bd11d 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 _0xbc9d=['head','mac','address','127.0.0.1','getFirstInterface','orderBy','cpus','model','createHash','md5','update','hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','keys','length','filter','family','IPv4','internal'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xbc9d,0xcc));var _0xdbc9=function(_0x30d719,_0x22729b){_0x30d719=_0x30d719-0x0;var _0x21358e=_0xbc9d[_0x30d719];return _0x21358e;};'use strict';var _=require(_0xdbc9('0x0'));var os=require('os');var crypto=require(_0xdbc9('0x1'));var machine=require(_0xdbc9('0x2'));var exec=require(_0xdbc9('0x3'))['execSync'];var config=require(_0xdbc9('0x4'));function getInterfaces(){var _0x2c48f9=[];var _0x172c7d=os[_0xdbc9('0x5')]();var _0x40d2c4=_['orderBy'](_[_0xdbc9('0x6')](_0x172c7d));for(var _0x5f040c=0x0;_0x5f040c<_0x40d2c4[_0xdbc9('0x7')];_0x5f040c++){var _0x415dd8=_0x172c7d[_0x40d2c4[_0x5f040c]][_0xdbc9('0x8')](function(_0x515ac6){return _0x515ac6[_0xdbc9('0x9')]===_0xdbc9('0xa')&&_0x515ac6[_0xdbc9('0xb')]===![];});_0x2c48f9=_0x2c48f9['concat'](_0x415dd8);}return _0x2c48f9;}function getFirstInterface(){var _0x1a1bfc=_[_0xdbc9('0xc')](getInterfaces());return{'macAddress':_0x1a1bfc&&_0x1a1bfc['mac']?_0x1a1bfc[_0xdbc9('0xd')]:'00:00:00:00:00:00','ipAddress':_0x1a1bfc&&_0x1a1bfc[_0xdbc9('0xe')]?_0x1a1bfc['address']:_0xdbc9('0xf')};}exports[_0xdbc9('0x10')]=getFirstInterface;function getCPUhash(){var _0x4b58e7=_[_0xdbc9('0x11')](os[_0xdbc9('0x12')]()['map'](function(_0x43798c){return _0x43798c[_0xdbc9('0x13')];}))['join'](':');return crypto[_0xdbc9('0x14')](_0xdbc9('0x15'))[_0xdbc9('0x16')](_0x4b58e7)['digest'](_0xdbc9('0x17'));}exports[_0xdbc9('0x18')]=function(){var _0x4fc432=os[_0xdbc9('0x19')]();var _0x38a9d8=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x38a9d8[_0xdbc9('0x1a')](config['licenseToken'])){return config[_0xdbc9('0x1b')];}else if(_0x4fc432===_0xdbc9('0x1c')){return exec(_0xdbc9('0x1d'),{'encoding':_0xdbc9('0x1e')})[_0xdbc9('0x1f')]('\x0d\x0a','');}else{var _0x4f8316=getFirstInterface();var _0x165831=getCPUhash();var _0x1dc29c=_0x165831+'|'+os[_0xdbc9('0x20')]()+'|'+_0x4f8316[_0xdbc9('0x21')]+'|'+_0x4f8316['ipAddress'];var _0x2e4368=crypto[_0xdbc9('0x14')](_0xdbc9('0x15'))[_0xdbc9('0x16')](_0x1dc29c)[_0xdbc9('0x22')](_0xdbc9('0x17'));return _0x2e4368[_0xdbc9('0x23')](0x0,0x8)+'-'+_0x2e4368[_0xdbc9('0x23')](0x8,0xc)+'-'+_0x2e4368[_0xdbc9('0x23')](0xc,0x10)+'-'+_0x2e4368[_0xdbc9('0x23')](0x10,0x14)+'-'+_0x2e4368[_0xdbc9('0x23')](0x14);}}; \ No newline at end of file +var _0x8c2f=['address','getFirstInterface','cpus','map','model','join','md5','digest','hex','getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','macAddress','ipAddress','createHash','update','substring','child_process','networkInterfaces','orderBy','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00'];(function(_0x41e2cf,_0x5b18e6){var _0x348c99=function(_0xe7ea6e){while(--_0xe7ea6e){_0x41e2cf['push'](_0x41e2cf['shift']());}};_0x348c99(++_0x5b18e6);}(_0x8c2f,0xdc));var _0xf8c2=function(_0x17b287,_0x4bed1c){_0x17b287=_0x17b287-0x0;var _0x177054=_0x8c2f[_0x17b287];return _0x177054;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0xf8c2('0x0'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x16b0c9=[];var _0x4bf6d7=os[_0xf8c2('0x1')]();var _0xa021f8=_[_0xf8c2('0x2')](_['keys'](_0x4bf6d7));for(var _0x3c186a=0x0;_0x3c186a<_0xa021f8['length'];_0x3c186a++){var _0x27589d=_0x4bf6d7[_0xa021f8[_0x3c186a]][_0xf8c2('0x3')](function(_0x16ccf7){return _0x16ccf7[_0xf8c2('0x4')]===_0xf8c2('0x5')&&_0x16ccf7[_0xf8c2('0x6')]===![];});_0x16b0c9=_0x16b0c9[_0xf8c2('0x7')](_0x27589d);}return _0x16b0c9;}function getFirstInterface(){var _0xdbcfdc=_[_0xf8c2('0x8')](getInterfaces());return{'macAddress':_0xdbcfdc&&_0xdbcfdc[_0xf8c2('0x9')]?_0xdbcfdc[_0xf8c2('0x9')]:_0xf8c2('0xa'),'ipAddress':_0xdbcfdc&&_0xdbcfdc[_0xf8c2('0xb')]?_0xdbcfdc[_0xf8c2('0xb')]:'127.0.0.1'};}exports[_0xf8c2('0xc')]=getFirstInterface;function getCPUhash(){var _0x5978bf=_[_0xf8c2('0x2')](os[_0xf8c2('0xd')]()[_0xf8c2('0xe')](function(_0x4be6bb){return _0x4be6bb[_0xf8c2('0xf')];}))[_0xf8c2('0x10')](':');return crypto['createHash'](_0xf8c2('0x11'))['update'](_0x5978bf)[_0xf8c2('0x12')](_0xf8c2('0x13'));}exports[_0xf8c2('0x14')]=function(){var _0x27c243=os[_0xf8c2('0x15')]();var _0x39e1f1=/[0-9a-f-]{36}/;if(config[_0xf8c2('0x16')]&&_0x39e1f1[_0xf8c2('0x17')](config[_0xf8c2('0x16')])){return config[_0xf8c2('0x16')];}else if(_0x27c243===_0xf8c2('0x18')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xf8c2('0x19')})[_0xf8c2('0x1a')]('\x0d\x0a','');}else{var _0x2b65ab=getFirstInterface();var _0x19197a=getCPUhash();var _0x33fee9=_0x19197a+'|'+os[_0xf8c2('0x1b')]()+'|'+_0x2b65ab[_0xf8c2('0x1c')]+'|'+_0x2b65ab[_0xf8c2('0x1d')];var _0x536149=crypto[_0xf8c2('0x1e')](_0xf8c2('0x11'))[_0xf8c2('0x1f')](_0x33fee9)[_0xf8c2('0x12')]('hex');return _0x536149[_0xf8c2('0x20')](0x0,0x8)+'-'+_0x536149['substring'](0x8,0xc)+'-'+_0x536149[_0xf8c2('0x20')](0xc,0x10)+'-'+_0x536149[_0xf8c2('0x20')](0x10,0x14)+'-'+_0x536149[_0xf8c2('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 31016c0..fb7e9f5 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 _0x8732=['%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','error','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data1','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0x47a2a5,_0x1bb224){var _0x35c957=function(_0x4a96ce){while(--_0x4a96ce){_0x47a2a5['push'](_0x47a2a5['shift']());}};_0x35c957(++_0x1bb224);}(_0x8732,0xaa));var _0x2873=function(_0x529587,_0x7b9e47){_0x529587=_0x529587-0x0;var _0x4ea039=_0x8732[_0x529587];return _0x4ea039;};'use strict';var util=require(_0x2873('0x0'));var moment=require(_0x2873('0x1'));var rp=require(_0x2873('0x2'));var BPromise=require(_0x2873('0x3'));var pkginfo=require('pkginfo')(module,_0x2873('0x4'));var db=require(_0x2873('0x5'))['db'];var encryptor=require(_0x2873('0x6'));var hardware=require(_0x2873('0x7'));var logger=require(_0x2873('0x8'))('license');var HOST=_0x2873('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x69b88a){return new BPromise(function(_0x5c26bf,_0x23f37d){var _0x4d8615=util[_0x2873('0xa')](_0x2873('0xb'),HOST,_0x69b88a,module[_0x2873('0xc')][_0x2873('0x4')]);if(oldToken){_0x4d8615=util[_0x2873('0xa')](_0x2873('0xd'),HOST,_0x69b88a,module['exports'][_0x2873('0x4')],oldToken);}var _0x40b9bd={'uri':_0x4d8615,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x40b9bd)[_0x2873('0xe')](function(_0x2a673a){_0x5c26bf(_0x2a673a);})[_0x2873('0xf')](function(_0x543698){_0x23f37d(_0x543698);});});}function manageLicense(_0x3c2a59,_0x131dce){var _0x3096b5=_0x131dce[_0x2873('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x3096b5['data1']!==_0x3c2a59&&!_0x3096b5['data2']){oldToken=_0x3096b5[_0x2873('0x11')];}httpRequest(_0x3c2a59)[_0x2873('0xe')](function(_0x53489b){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x53489b['active']){isOldTokenSent=![];if(!_0x3096b5[_0x2873('0x12')]&&_0x3096b5[_0x2873('0x12')]!=_0x53489b[_0x2873('0x12')]||_0x3096b5[_0x2873('0x12')]&&_0x3096b5[_0x2873('0x13')]){logger[_0x2873('0x14')](_0x2873('0x15'));}if(_0x3096b5['license']&&!_0x3096b5[_0x2873('0x13')]&&_0x3096b5[_0x2873('0x12')]!=_0x53489b[_0x2873('0x12')]){logger[_0x2873('0x14')](_0x2873('0x16'));}if(_0x3096b5[_0x2873('0x12')]&&!_0x3096b5[_0x2873('0x13')]&&_0x3096b5[_0x2873('0x12')]==_0x53489b[_0x2873('0x12')]){return _0x131dce;}return _0x131dce['update']({'data1':_0x3c2a59,'data2':null,'license':_0x53489b[_0x2873('0x12')]});}else{if(_0x53489b[_0x2873('0x12')]||_0x3096b5[_0x2873('0x12')]){if(!_0x3096b5[_0x2873('0x13')]){if(_0x3096b5[_0x2873('0x11')]==_0x3c2a59){GRAY_PERIOD_REASON=_0x2873('0x17');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0x2873('0x14')](_0x2873('0x18'),_0x3096b5[_0x2873('0x11')],_0x3c2a59);}logger['info'](_0x2873('0x19'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0x2873('0x1a')));return _0x131dce[_0x2873('0x1b')]({'data2':encryptor[_0x2873('0x1c')](moment()[_0x2873('0xa')](_0x2873('0x1a')))});}else{if(moment()[_0x2873('0x1d')](encryptor[_0x2873('0x1e')](_0x3096b5[_0x2873('0x13')]),'days')>DAYS){logger[_0x2873('0x14')]('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x2873('0x1a')));isOldTokenSent=![];return _0x131dce[_0x2873('0x1b')]({'data1':_0x3c2a59,'data2':null,'license':null});}}}else{if(_0x3096b5[_0x2873('0x11')]!=_0x3c2a59){logger[_0x2873('0x14')](_0x2873('0x18'),_0x3096b5[_0x2873('0x11')],_0x3c2a59);return _0x131dce[_0x2873('0x1b')]({'data1':_0x3c2a59,'data2':null,'license':null});}}}return _0x131dce;})[_0x2873('0xe')](function(_0x58dab5){_0x131dce=_0x58dab5;})[_0x2873('0xf')](function(_0x17978c){logger[_0x2873('0x1f')](_0x17978c['message']);})[_0x2873('0x20')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x131dce);},TIME);});}function defaultLicense(){var _0x55b5a6=hardware[_0x2873('0x21')]();if(_0x55b5a6){return db[_0x2873('0x22')][_0x2873('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x55b5a6}})['spread'](function(_0x16674e,_0x4ad6ee){logger['info'](_0x2873('0x24'),_0x55b5a6);manageLicense(_0x55b5a6,_0x16674e);})[_0x2873('0xf')](function(_0x4dfe32){logger[_0x2873('0x1f')](_0x4dfe32[_0x2873('0x25')]);});}}exports[_0x2873('0x26')]=defaultLicense; \ No newline at end of file +var _0x0630=['util','moment','request-promise','pkginfo','version','../../components/encryptor','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x0630,0x138));var _0x0063=function(_0x1e8f1f,_0x350974){_0x1e8f1f=_0x1e8f1f-0x0;var _0x2c271c=_0x0630[_0x1e8f1f];return _0x2c271c;};'use strict';var util=require(_0x0063('0x0'));var moment=require(_0x0063('0x1'));var rp=require(_0x0063('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x0063('0x3'))(module,_0x0063('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x0063('0x5'));var hardware=require('./hardware');var logger=require('../logger')('license');var HOST=_0x0063('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1ac962){return new BPromise(function(_0x38020a,_0x61f091){var _0x84e0dd=util[_0x0063('0x7')](_0x0063('0x8'),HOST,_0x1ac962,module[_0x0063('0x9')]['version']);if(oldToken){_0x84e0dd=util[_0x0063('0x7')](_0x0063('0xa'),HOST,_0x1ac962,module[_0x0063('0x9')]['version'],oldToken);}var _0xfba4dd={'uri':_0x84e0dd,'method':_0x0063('0xb'),'timeout':0xea60,'json':!![]};return rp(_0xfba4dd)[_0x0063('0xc')](function(_0x369a34){_0x38020a(_0x369a34);})[_0x0063('0xd')](function(_0x213d3c){_0x61f091(_0x213d3c);});});}function manageLicense(_0x492cf7,_0x5f37ad){var _0x2f6f1d=_0x5f37ad[_0x0063('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x2f6f1d[_0x0063('0xf')]!==_0x492cf7&&!_0x2f6f1d['data2']){oldToken=_0x2f6f1d[_0x0063('0xf')];}httpRequest(_0x492cf7)[_0x0063('0xc')](function(_0x26cb0c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x26cb0c['active']){isOldTokenSent=![];if(!_0x2f6f1d[_0x0063('0x10')]&&_0x2f6f1d[_0x0063('0x10')]!=_0x26cb0c[_0x0063('0x10')]||_0x2f6f1d[_0x0063('0x10')]&&_0x2f6f1d[_0x0063('0x11')]){logger[_0x0063('0x12')](_0x0063('0x13'));}if(_0x2f6f1d[_0x0063('0x10')]&&!_0x2f6f1d[_0x0063('0x11')]&&_0x2f6f1d['license']!=_0x26cb0c[_0x0063('0x10')]){logger[_0x0063('0x12')](_0x0063('0x14'));}if(_0x2f6f1d[_0x0063('0x10')]&&!_0x2f6f1d[_0x0063('0x11')]&&_0x2f6f1d[_0x0063('0x10')]==_0x26cb0c[_0x0063('0x10')]){return _0x5f37ad;}return _0x5f37ad[_0x0063('0x15')]({'data1':_0x492cf7,'data2':null,'license':_0x26cb0c['license']});}else{if(_0x26cb0c[_0x0063('0x10')]||_0x2f6f1d['license']){if(!_0x2f6f1d[_0x0063('0x11')]){if(_0x2f6f1d[_0x0063('0xf')]==_0x492cf7){GRAY_PERIOD_REASON=_0x0063('0x16');logger[_0x0063('0x12')](_0x0063('0x17'));}else{GRAY_PERIOD_REASON=_0x0063('0x18');logger[_0x0063('0x12')](_0x0063('0x19'),_0x2f6f1d[_0x0063('0xf')],_0x492cf7);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x0063('0x1a')](),moment()[_0x0063('0x7')]('YYYY-MM-DD\x20HH:mm'));return _0x5f37ad[_0x0063('0x15')]({'data2':encryptor[_0x0063('0x1b')](moment()['format'](_0x0063('0x1c')))});}else{if(moment()[_0x0063('0x1d')](encryptor[_0x0063('0x1e')](_0x2f6f1d[_0x0063('0x11')]),'days')>DAYS){logger[_0x0063('0x12')](_0x0063('0x1f'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x5f37ad[_0x0063('0x15')]({'data1':_0x492cf7,'data2':null,'license':null});}}}else{if(_0x2f6f1d[_0x0063('0xf')]!=_0x492cf7){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2f6f1d[_0x0063('0xf')],_0x492cf7);return _0x5f37ad[_0x0063('0x15')]({'data1':_0x492cf7,'data2':null,'license':null});}}}return _0x5f37ad;})['then'](function(_0x266367){_0x5f37ad=_0x266367;})[_0x0063('0xd')](function(_0x428718){logger[_0x0063('0x20')](_0x428718[_0x0063('0x21')]);})[_0x0063('0x22')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x5f37ad);},TIME);});}function defaultLicense(){var _0xb5f64=hardware[_0x0063('0x23')]();if(_0xb5f64){return db['License'][_0x0063('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0xb5f64}})[_0x0063('0x25')](function(_0x5715a9,_0x19743a){logger[_0x0063('0x12')](_0x0063('0x26'),_0xb5f64);manageLicense(_0xb5f64,_0x5715a9);})[_0x0063('0xd')](function(_0x259d1f){logger['error'](_0x259d1f[_0x0063('0x21')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index b435390..a4d8470 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 _0x8a92=['add','days','grayReason','uuid','machineUuid','changed','disabled','message','findAll','role','sequelize','col','count','admin','user','telephone','users','telephones','forEach','countBy','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../components/encryptor','getUuid','2027-01-01T00:00:00.000Z','find','then','catch','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','gray','deadline'];(function(_0x451735,_0x391a76){var _0x41d1e2=function(_0x3566d7){while(--_0x3566d7){_0x451735['push'](_0x451735['shift']());}};_0x41d1e2(++_0x391a76);}(_0x8a92,0x1b9));var _0x28a9=function(_0x54352e,_0x5b2ef7){_0x54352e=_0x54352e-0x0;var _0x3b366a=_0x8a92[_0x54352e];return _0x3b366a;};'use strict';var util=require(_0x28a9('0x0'));var _=require(_0x28a9('0x1'));var moment=require(_0x28a9('0x2'));var BPromise=require(_0x28a9('0x3'));var hardware=require(_0x28a9('0x4'));var encryptor=require(_0x28a9('0x5'));var db=require('../../mysqldb')['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':'Demo\x20license','machineUuid':hardware[_0x28a9('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x28a9('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x28a9('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1a13dd){return new BPromise(function(_0xe588b5,_0x2be914){return db['License'][_0x28a9('0x8')](_['defaults'](_0x1a13dd,{'raw':!![],'where':{'id':0x1}}))[_0x28a9('0x9')](function(_0x5ec3b6){return checkLicense(_0x5ec3b6,null);})[_0x28a9('0x9')](function(_0x402a5d){_0xe588b5(_0x402a5d);return;})[_0x28a9('0xa')](function(_0x2ff573){_0x2be914(_0x2ff573);});});}function checkLicense(_0x19e3d5,_0x20bdaa){if(!_0x19e3d5){demoLicense['uuid']=_0x19e3d5[_0x28a9('0xb')];return demoLicense;}try{var _0x23d817=_0x20bdaa||_0x19e3d5[_0x28a9('0xc')];if(_['isEmpty'](_0x23d817)){throw new Error(_0x28a9('0xd'));}var _0x118c98=_0x19e3d5[_0x28a9('0xb')];var _0x3484e7=_0x19e3d5[_0x28a9('0xe')];var _0x37e3df=_0x118c98[_0x28a9('0xf')]('-')[0x4];var _0x4eb35b=_0x118c98[_0x28a9('0xf')]('-')[0x0];var _0x3493b2=encryptor[_0x28a9('0x10')](_0x23d817,util[_0x28a9('0x11')]('%s:%s:%s',_0x37e3df,_0x118c98,_0x4eb35b));var _0x4d139a=JSON[_0x28a9('0x12')](_0x3493b2);_0x4d139a['demo']=![];_0x4d139a['uuid']=_0x118c98;_0x4d139a['machineUuid']=hardware[_0x28a9('0x6')]();if(_0x3484e7){var _0x7480c0=encryptor[_0x28a9('0x10')](_0x3484e7);_0x4d139a[_0x28a9('0x13')]=_0x7480c0;_0x4d139a[_0x28a9('0x14')]=moment(_0x7480c0)[_0x28a9('0x15')](0x7,_0x28a9('0x16'))[_0x28a9('0x11')]();_0x4d139a[_0x28a9('0x17')]=_0x4d139a[_0x28a9('0x18')]!=_0x4d139a[_0x28a9('0x19')]?_0x28a9('0x1a'):_0x28a9('0x1b');}return _0x4d139a;}catch(_0x33145d){breakingLicense[_0x28a9('0x18')]=_0x19e3d5[_0x28a9('0xb')];breakingLicense[_0x28a9('0x1c')]=_0x33145d[_0x28a9('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1e5c9d,_0x370624){getLicense()[_0x28a9('0x9')](function(_0x169075){return db['User'][_0x28a9('0x1d')]({'attributes':[_0x28a9('0x1e'),[db[_0x28a9('0x1f')]['fn']('COUNT',db[_0x28a9('0x1f')][_0x28a9('0x20')](_0x28a9('0x1e'))),_0x28a9('0x21')]],'group':'role','where':{'role':{'$or':[_0x28a9('0x22'),_0x28a9('0x23'),_0x28a9('0x24')]}},'raw':!![]})['then'](function(_0xa869e){var _0x155e32={'user':_0x169075[_0x28a9('0x25')]||0x0,'telephone':_0x169075[_0x28a9('0x26')]||0x0};_0xa869e[_0x28a9('0x27')](function(_0x270849){var _0x50829a=_0x270849[_0x28a9('0x1e')]==='admin'?_0x28a9('0x23'):_0x270849[_0x28a9('0x1e')];_0x155e32[_0x50829a]-=_0x270849['count'];if(_0x155e32[_0x50829a]<0x0)_0x155e32[_0x50829a]=0x0;});_0x1e5c9d(_0x155e32);return;});})[_0x28a9('0xa')](function(_0x580c42){_0x370624(_0x580c42);});});}function checkUserLimits(_0x42ae3c){return new BPromise(function(_0x4b95fa,_0x92d5fc){getLimits()[_0x28a9('0x9')](function(_0xb03c24){var _0x50f5c2=_['pick'](_[_0x28a9('0x28')](_0x42ae3c,_0x28a9('0x1e')),[_0x28a9('0x22'),_0x28a9('0x23'),_0x28a9('0x24')]);var _0xfaca05=(_0x50f5c2[_0x28a9('0x22')]||0x0)+(_0x50f5c2['user']||0x0);var _0x5d9afb=_0x50f5c2[_0x28a9('0x24')]||0x0;if(_0xfaca05>_0xb03c24[_0x28a9('0x23')])return _0x92d5fc('License\x20limit\x20reached\x20for\x20users');if(_0x5d9afb>_0xb03c24[_0x28a9('0x24')])return _0x92d5fc(_0x28a9('0x29'));return _0x4b95fa();})[_0x28a9('0xa')](function(_0x1ed133){_0x92d5fc(_0x1ed133);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x6e72=['../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','defaults','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','parse','demo','gray','days','machineUuid','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','catch','pick','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','./hardware'];(function(_0x19dcc2,_0x41b678){var _0xbdd7dc=function(_0x4a9e6a){while(--_0x4a9e6a){_0x19dcc2['push'](_0x19dcc2['shift']());}};_0xbdd7dc(++_0x41b678);}(_0x6e72,0xac));var _0x26e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e72[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x26e7('0x0'));var _=require(_0x26e7('0x1'));var moment=require(_0x26e7('0x2'));var BPromise=require('bluebird');var hardware=require(_0x26e7('0x3'));var encryptor=require(_0x26e7('0x4'));var db=require(_0x26e7('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':_0x26e7('0x6'),'machineUuid':hardware[_0x26e7('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x26e7('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x26e7('0x9'),'machineUuid':hardware[_0x26e7('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x399fc8){return new BPromise(function(_0x552d23,_0x2d483d){return db[_0x26e7('0xa')]['find'](_[_0x26e7('0xb')](_0x399fc8,{'raw':!![],'where':{'id':0x1}}))[_0x26e7('0xc')](function(_0x16c22a){return checkLicense(_0x16c22a,null);})[_0x26e7('0xc')](function(_0x40fa8b){_0x552d23(_0x40fa8b);return;})['catch'](function(_0x37e158){_0x2d483d(_0x37e158);});});}function checkLicense(_0x2653d2,_0xad54fd){if(!_0x2653d2){demoLicense[_0x26e7('0xd')]=_0x2653d2[_0x26e7('0xe')];return demoLicense;}try{var _0x9e5b1b=_0xad54fd||_0x2653d2[_0x26e7('0xf')];if(_[_0x26e7('0x10')](_0x9e5b1b)){throw new Error(_0x26e7('0x11'));}var _0x5dc0a2=_0x2653d2[_0x26e7('0xe')];var _0xef191f=_0x2653d2[_0x26e7('0x12')];var _0x3f8f43=_0x5dc0a2[_0x26e7('0x13')]('-')[0x4];var _0x1aa820=_0x5dc0a2[_0x26e7('0x13')]('-')[0x0];var _0x4261a2=encryptor['decryptString'](_0x9e5b1b,util[_0x26e7('0x14')]('%s:%s:%s',_0x3f8f43,_0x5dc0a2,_0x1aa820));var _0x271499=JSON[_0x26e7('0x15')](_0x4261a2);_0x271499[_0x26e7('0x16')]=![];_0x271499['uuid']=_0x5dc0a2;_0x271499['machineUuid']=hardware['getUuid']();if(_0xef191f){var _0x2877d6=encryptor['decryptString'](_0xef191f);_0x271499[_0x26e7('0x17')]=_0x2877d6;_0x271499['deadline']=moment(_0x2877d6)['add'](0x7,_0x26e7('0x18'))[_0x26e7('0x14')]();_0x271499['grayReason']=_0x271499[_0x26e7('0xd')]!=_0x271499[_0x26e7('0x19')]?_0x26e7('0x1a'):_0x26e7('0x1b');}return _0x271499;}catch(_0x44ec24){breakingLicense[_0x26e7('0xd')]=_0x2653d2['data1'];breakingLicense['message']=_0x44ec24[_0x26e7('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x468756,_0xd41779){getLicense()[_0x26e7('0xc')](function(_0x346bdf){return db[_0x26e7('0x1d')][_0x26e7('0x1e')]({'attributes':[_0x26e7('0x1f'),[db[_0x26e7('0x20')]['fn'](_0x26e7('0x21'),db[_0x26e7('0x20')][_0x26e7('0x22')](_0x26e7('0x1f'))),_0x26e7('0x23')]],'group':_0x26e7('0x1f'),'where':{'role':{'$or':[_0x26e7('0x24'),_0x26e7('0x25'),_0x26e7('0x26')]}},'raw':!![]})[_0x26e7('0xc')](function(_0x2fcabb){var _0x28891b={'user':_0x346bdf[_0x26e7('0x27')]||0x0,'telephone':_0x346bdf[_0x26e7('0x28')]||0x0};_0x2fcabb['forEach'](function(_0x46a9a2){var _0x2d3d84=_0x46a9a2[_0x26e7('0x1f')]==='admin'?_0x26e7('0x25'):_0x46a9a2[_0x26e7('0x1f')];_0x28891b[_0x2d3d84]-=_0x46a9a2[_0x26e7('0x23')];if(_0x28891b[_0x2d3d84]<0x0)_0x28891b[_0x2d3d84]=0x0;});_0x468756(_0x28891b);return;});})[_0x26e7('0x29')](function(_0x111356){_0xd41779(_0x111356);});});}function checkUserLimits(_0x35146c){return new BPromise(function(_0x1ac6c5,_0x142b3d){getLimits()[_0x26e7('0xc')](function(_0x3cc381){var _0x14b176=_[_0x26e7('0x2a')](_['countBy'](_0x35146c,'role'),['admin','user',_0x26e7('0x26')]);var _0x546129=(_0x14b176[_0x26e7('0x24')]||0x0)+(_0x14b176[_0x26e7('0x25')]||0x0);var _0x17ce9b=_0x14b176[_0x26e7('0x26')]||0x0;if(_0x546129>_0x3cc381['user'])return _0x142b3d('License\x20limit\x20reached\x20for\x20users');if(_0x17ce9b>_0x3cc381[_0x26e7('0x26')])return _0x142b3d(_0x26e7('0x2b'));return _0x1ac6c5();})[_0x26e7('0x29')](function(_0x59b71f){_0x142b3d(_0x59b71f);});});}module['exports']={'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 34681b3..3bd1e38 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 _0x6323=['secret','app-id'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0x6323,0x1b7));var _0x3632=function(_0x160a60,_0xb3bea5){_0x160a60=_0x160a60-0x0;var _0x1ac7cb=_0x6323[_0x160a60];return _0x1ac7cb;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x3632('0x0'),'GOOGLE_SECRET':_0x3632('0x1'),'DEBUG':''}; \ No newline at end of file +var _0x8404=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x8404,0x15d));var _0x4840=function(_0x43604d,_0x2f7df4){_0x43604d=_0x43604d-0x0;var _0x2b6882=_0x8404[_0x43604d];return _0x2b6882;};'use strict';module[_0x4840('0x0')]={'DOMAIN':_0x4840('0x1'),'SESSION_SECRET':_0x4840('0x2'),'GOOGLE_ID':_0x4840('0x3'),'GOOGLE_SECRET':_0x4840('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 99cc673..48f30df 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c34=['%s-%s.log','message','{{{','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','util','/var','xcally','format'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5c34,0x1b3));var _0x45c3=function(_0x424a30,_0x2ef2f6){_0x424a30=_0x424a30-0x0;var _0x46bfed=_0x5c34[_0x424a30];return _0x46bfed;};'use strict';var moment=require(_0x45c3('0x0'));var winston=require('winston');var util=require(_0x45c3('0x1'));var path=require('path');var debugLevel='INFO';function filename(_0x51939d,_0x59fbcf){return path['join'](_0x45c3('0x2'),'log',_0x45c3('0x3'),util[_0x45c3('0x4')](_0x45c3('0x5'),_0x51939d,_0x59fbcf));}function formatter(_0x3860f1,_0x5444f7){_0x5444f7[_0x45c3('0x6')]=_0x5444f7[_0x45c3('0x6')]['replace'](/@@{/g,_0x45c3('0x7'))['replace'](/}@@/g,'}}}')[_0x45c3('0x8')](/@{/g,'{{')[_0x45c3('0x8')](/}@/g,'}}');return util[_0x45c3('0x4')](_0x45c3('0x9'),moment()[_0x45c3('0x4')]('YYYY-MM-DD\x20HH:mm:ss'),_0x5444f7[_0x45c3('0xa')][_0x45c3('0xb')](),_0x3860f1,_0x5444f7[_0x45c3('0x6')]);}module[_0x45c3('0xc')]=function(_0x428991){return new winston[(_0x45c3('0xd'))]({'transports':[new winston[(_0x45c3('0xe'))][(_0x45c3('0xf'))]({'name':util[_0x45c3('0x4')](_0x45c3('0x10'),_0x428991,_0x45c3('0x11')),'filename':filename(_0x428991,_0x45c3('0x11')),'level':_0x45c3('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x222ad0){return formatter(_0x428991,_0x222ad0);}}),new winston['transports'][(_0x45c3('0xf'))]({'name':util[_0x45c3('0x4')](_0x45c3('0x10'),_0x428991,_0x45c3('0x12')),'filename':filename(_0x428991,'info'),'level':_0x45c3('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x177f1c){return formatter(_0x428991,_0x177f1c);}}),new winston[(_0x45c3('0xe'))][(_0x45c3('0x13'))]({'level':process[_0x45c3('0x14')][_0x45c3('0x15')]||debugLevel,'json':![],'formatter':function(_0x1cb695){return formatter(_0x428991,_0x1cb695);}})]});}; \ No newline at end of file +var _0xd459=['Console','debugLevel','moment','winston','util','path','join','/var','log','xcally','format','%s-%s.log','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','Logger','transports','%s-%s','error','File','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd459,0xb1));var _0x9d45=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xd459[_0x6cf19c];return _0xce14f3;};'use strict';var moment=require(_0x9d45('0x0'));var winston=require(_0x9d45('0x1'));var util=require(_0x9d45('0x2'));var path=require(_0x9d45('0x3'));var debugLevel='INFO';function filename(_0x4257c9,_0x384fa0){return path[_0x9d45('0x4')](_0x9d45('0x5'),_0x9d45('0x6'),_0x9d45('0x7'),util[_0x9d45('0x8')](_0x9d45('0x9'),_0x4257c9,_0x384fa0));}function formatter(_0x434924,_0x38f07f){_0x38f07f[_0x9d45('0xa')]=_0x38f07f['message'][_0x9d45('0xb')](/@@{/g,_0x9d45('0xc'))[_0x9d45('0xb')](/}@@/g,_0x9d45('0xd'))['replace'](/@{/g,'{{')[_0x9d45('0xb')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x9d45('0x8')](_0x9d45('0xe')),_0x38f07f['level'][_0x9d45('0xf')](),_0x434924,_0x38f07f[_0x9d45('0xa')]);}module[_0x9d45('0x10')]=function(_0x2aff5e){return new winston[(_0x9d45('0x11'))]({'transports':[new winston[(_0x9d45('0x12'))]['File']({'name':util[_0x9d45('0x8')](_0x9d45('0x13'),_0x2aff5e,_0x9d45('0x14')),'filename':filename(_0x2aff5e,'error'),'level':_0x9d45('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4c4fa1){return formatter(_0x2aff5e,_0x4c4fa1);}}),new winston[(_0x9d45('0x12'))][(_0x9d45('0x15'))]({'name':util['format']('%s-%s',_0x2aff5e,_0x9d45('0x16')),'filename':filename(_0x2aff5e,_0x9d45('0x16')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x36b177){return formatter(_0x2aff5e,_0x36b177);}}),new winston[(_0x9d45('0x12'))][(_0x9d45('0x17'))]({'level':process['env'][_0x9d45('0x18')]||debugLevel,'json':![],'formatter':function(_0x58da6f){return formatter(_0x2aff5e,_0x58da6f);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index e097925..c6046dd 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 _0x32c3=['ami','join','../../services/ami/index.js','agi','email','routing','../../services/routing/index.js','xdr','exports','path','../../services/express/index.js'];(function(_0x20006a,_0x15b257){var _0x9098f=function(_0x256887){while(--_0x256887){_0x20006a['push'](_0x20006a['shift']());}};_0x9098f(++_0x15b257);}(_0x32c3,0xfb));var _0x332c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x32c3[_0x14add3];return _0x4a174f;};'use strict';var path=require(_0x332c('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,_0x332c('0x1'))},{'name':_0x332c('0x2'),'script':path[_0x332c('0x3')](__dirname,_0x332c('0x4'))},{'name':_0x332c('0x5'),'script':path[_0x332c('0x3')](__dirname,'../../services/agi/index.js')},{'name':_0x332c('0x6'),'script':path[_0x332c('0x3')](__dirname,'../../services/email/index.js')},{'name':_0x332c('0x7'),'script':path[_0x332c('0x3')](__dirname,_0x332c('0x8'))},{'name':_0x332c('0x9'),'script':path[_0x332c('0x3')](__dirname,'../../services/xdr/index.js')}]};module[_0x332c('0xa')]=config; \ No newline at end of file +var _0xff98=['express','join','../../services/express/index.js','ami','../../services/ami/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x4faaa8,_0x4e91d5){var _0x1bf49b=function(_0x649b7b){while(--_0x649b7b){_0x4faaa8['push'](_0x4faaa8['shift']());}};_0x1bf49b(++_0x4e91d5);}(_0xff98,0x9c));var _0x8ff9=function(_0x139e6d,_0x359b30){_0x139e6d=_0x139e6d-0x0;var _0xf6a6f=_0xff98[_0x139e6d];return _0xf6a6f;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x8ff9('0x0'),'script':path[_0x8ff9('0x1')](__dirname,_0x8ff9('0x2'))},{'name':_0x8ff9('0x3'),'script':path['join'](__dirname,_0x8ff9('0x4'))},{'name':'agi','script':path[_0x8ff9('0x1')](__dirname,'../../services/agi/index.js')},{'name':_0x8ff9('0x5'),'script':path['join'](__dirname,_0x8ff9('0x6'))},{'name':_0x8ff9('0x7'),'script':path[_0x8ff9('0x1')](__dirname,_0x8ff9('0x8'))},{'name':_0x8ff9('0x9'),'script':path[_0x8ff9('0x1')](__dirname,_0x8ff9('0xa'))}]};module[_0x8ff9('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index fd5b6ea..8f2fb29 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 _0x7a2d=['list','describe','delete','pm2','bluebird','./config','connect','then','disconnect','stop','restart'];(function(_0x4f98f5,_0x46a0f9){var _0x2c8b3d=function(_0x475717){while(--_0x475717){_0x4f98f5['push'](_0x4f98f5['shift']());}};_0x2c8b3d(++_0x46a0f9);}(_0x7a2d,0x142));var _0xd7a2=function(_0x2d6447,_0x39a0a9){_0x2d6447=_0x2d6447-0x0;var _0x6aa5ed=_0x7a2d[_0x2d6447];return _0x6aa5ed;};'use strict';var pm2=require(_0xd7a2('0x0'));var BPromise=require(_0xd7a2('0x1'));var config=require(_0xd7a2('0x2'));function connect(){return new BPromise(function(_0x3b21fc,_0x81f2c5){return pm2[_0xd7a2('0x3')](function(_0x31dd61){if(_0x31dd61){return _0x81f2c5(_0x31dd61);}return _0x3b21fc('connected');});});};exports['start']=function(_0x7370d9){return connect()[_0xd7a2('0x4')](function(){return new BPromise(function(_0x3a8474,_0x13b19d){return pm2['start'](_0x7370d9,function(_0x210a06,_0x209189){if(_0x210a06){return _0x13b19d(_0x210a06);}pm2[_0xd7a2('0x5')]();return _0x3a8474(_0x209189);});});});};exports[_0xd7a2('0x6')]=function(_0x1ea591){return connect()[_0xd7a2('0x4')](function(){return new BPromise(function(_0x2d4b8f,_0x1c0b49){return pm2[_0xd7a2('0x6')](_0x1ea591,function(_0x503b42,_0x2890bf){if(_0x503b42){return _0x1c0b49(_0x503b42);}pm2[_0xd7a2('0x5')]();return _0x2d4b8f(_0x2890bf);});});});};exports[_0xd7a2('0x7')]=function(_0x83f5f7){return connect()[_0xd7a2('0x4')](function(){return new BPromise(function(_0x358c39,_0xe2feee){return pm2['restart'](_0x83f5f7,function(_0x56d706,_0x72ff99){if(_0x56d706){return _0xe2feee(_0x56d706);}pm2['disconnect']();return _0x358c39(_0x72ff99);});});});};exports[_0xd7a2('0x8')]=function(){return connect()[_0xd7a2('0x4')](function(){return new BPromise(function(_0xfac7c9,_0x33131e){return pm2[_0xd7a2('0x8')](function(_0x37f995,_0x42a6c5){if(_0x37f995){return _0x33131e(_0x37f995);}pm2[_0xd7a2('0x5')]();return _0xfac7c9(_0x42a6c5);});});});};exports[_0xd7a2('0x9')]=function(_0x16e2d6){return connect()[_0xd7a2('0x4')](function(){return new BPromise(function(_0x47b226,_0x2dc1b7){return pm2['describe'](_0x16e2d6,function(_0x5321f5,_0x26763e){if(_0x5321f5){return _0x2dc1b7(_0x5321f5);}pm2[_0xd7a2('0x5')]();return _0x47b226(_0x26763e);});});});};exports[_0xd7a2('0xa')]=function(_0x11d958){return connect()[_0xd7a2('0x4')](function(){return new BPromise(function(_0x47210f,_0x510caa){return pm2['delete'](_0x11d958,function(_0x436fff,_0x1fe867){if(_0x436fff){return _0x510caa(_0x436fff);}pm2[_0xd7a2('0x5')]();return _0x47210f(_0x1fe867);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x115bb6,_0x5d455b){return pm2['dump'](function(_0x217c19){if(_0x217c19){return _0x5d455b(_0x217c19);}return _0x115bb6('saved');});});});}; \ No newline at end of file +var _0x598a=['bluebird','./config','then','start','stop','disconnect','restart','list','describe','delete','dump','pm2'];(function(_0xacaf13,_0x1ea63d){var _0x452ba7=function(_0xb3a3d0){while(--_0xb3a3d0){_0xacaf13['push'](_0xacaf13['shift']());}};_0x452ba7(++_0x1ea63d);}(_0x598a,0xfb));var _0xa598=function(_0x3d3685,_0x4b8762){_0x3d3685=_0x3d3685-0x0;var _0x4fd83a=_0x598a[_0x3d3685];return _0x4fd83a;};'use strict';var pm2=require(_0xa598('0x0'));var BPromise=require(_0xa598('0x1'));var config=require(_0xa598('0x2'));function connect(){return new BPromise(function(_0x3d9230,_0x414db5){return pm2['connect'](function(_0x3a2794){if(_0x3a2794){return _0x414db5(_0x3a2794);}return _0x3d9230('connected');});});};exports['start']=function(_0x4a1f8d){return connect()[_0xa598('0x3')](function(){return new BPromise(function(_0x8f041b,_0x41ebaa){return pm2[_0xa598('0x4')](_0x4a1f8d,function(_0xc65a6c,_0x4d82ee){if(_0xc65a6c){return _0x41ebaa(_0xc65a6c);}pm2['disconnect']();return _0x8f041b(_0x4d82ee);});});});};exports[_0xa598('0x5')]=function(_0xebf6e5){return connect()[_0xa598('0x3')](function(){return new BPromise(function(_0xe36e4f,_0x190ccf){return pm2[_0xa598('0x5')](_0xebf6e5,function(_0x5207d5,_0x5871a3){if(_0x5207d5){return _0x190ccf(_0x5207d5);}pm2[_0xa598('0x6')]();return _0xe36e4f(_0x5871a3);});});});};exports[_0xa598('0x7')]=function(_0x1aae78){return connect()[_0xa598('0x3')](function(){return new BPromise(function(_0xa1c53,_0x4fb7c0){return pm2[_0xa598('0x7')](_0x1aae78,function(_0x4109ff,_0x468710){if(_0x4109ff){return _0x4fb7c0(_0x4109ff);}pm2['disconnect']();return _0xa1c53(_0x468710);});});});};exports[_0xa598('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3a88f9,_0x23b343){return pm2[_0xa598('0x8')](function(_0x38afa9,_0x1949b5){if(_0x38afa9){return _0x23b343(_0x38afa9);}pm2[_0xa598('0x6')]();return _0x3a88f9(_0x1949b5);});});});};exports[_0xa598('0x9')]=function(_0x41d3fe){return connect()[_0xa598('0x3')](function(){return new BPromise(function(_0x4b100b,_0x88df86){return pm2[_0xa598('0x9')](_0x41d3fe,function(_0x6e6ff5,_0x27c34e){if(_0x6e6ff5){return _0x88df86(_0x6e6ff5);}pm2[_0xa598('0x6')]();return _0x4b100b(_0x27c34e);});});});};exports[_0xa598('0xa')]=function(_0x3cbb9f){return connect()[_0xa598('0x3')](function(){return new BPromise(function(_0x36492f,_0x44c872){return pm2['delete'](_0x3cbb9f,function(_0x1ed03f,_0x80e1ad){if(_0x1ed03f){return _0x44c872(_0x1ed03f);}pm2[_0xa598('0x6')]();return _0x36492f(_0x80e1ad);});});});};exports[_0xa598('0xb')]=function(){return connect()[_0xa598('0x3')](function(){return new BPromise(function(_0xcdf1b6,_0x53d689){return pm2['dump'](function(_0x2923d5){if(_0x2923d5){return _0x53d689(_0x2923d5);}return _0xcdf1b6('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index bc71975..2405ee7 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 _0xa5c2=['info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','start','ioredis','util','../../config/environment','../../mysqldb','../logger','defaults','redis','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map'];(function(_0x5b5d59,_0xa38264){var _0x594b8b=function(_0x105df1){while(--_0x105df1){_0x5b5d59['push'](_0x5b5d59['shift']());}};_0x594b8b(++_0xa38264);}(_0xa5c2,0xe6));var _0x2a5c=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0xa5c2[_0x77d310];return _0x2cdce4;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x2a5c('0x0'));var util=require(_0x2a5c('0x1'));var config=require(_0x2a5c('0x2'));var db=require(_0x2a5c('0x3'))['db'];var logger=require(_0x2a5c('0x4'))('schedule');config['redis']=_[_0x2a5c('0x5')](config[_0x2a5c('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x2a5c('0x7'))(new Redis(config[_0x2a5c('0x6')]));function closeInteractions(){var _0x26abf2=0x0;var _0x4de918=[];return db[_0x2a5c('0x8')]['find']({'raw':!![],'attributes':['id',_0x2a5c('0x9')],'where':{'id':0x1}})[_0x2a5c('0xa')](function(_0x5b72f2){_0x26abf2=_0x5b72f2[_0x2a5c('0x9')];if(_0x26abf2){return db[_0x2a5c('0xb')][_0x2a5c('0xc')]({'raw':!![],'attributes':['id',_0x2a5c('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2a5c('0xe')](_0x5b72f2[_0x2a5c('0x9')],_0x2a5c('0xf'))}}});}else{return[];}})['then'](function(_0xd7a201){if(_0xd7a201&&_0xd7a201[_0x2a5c('0x10')]){_0x4de918=_[_0x2a5c('0x11')](_0xd7a201||[],'id');logger[_0x2a5c('0x12')](_0x2a5c('0x13'),_0x4de918[_0x2a5c('0x14')]());return db['ChatInteraction'][_0x2a5c('0x15')]({'closeReason':_0x2a5c('0x16'),'disposition':_0x2a5c('0x17'),'closed':!![],'closedAt':moment()[_0x2a5c('0x18')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4de918}});}})[_0x2a5c('0xa')](function(){if(_0x4de918&&_0x4de918['length']){logger[_0x2a5c('0x12')](_0x2a5c('0x19'),_0x4de918[_0x2a5c('0x14')]());for(var _0x393a27=0x0;_0x393a27<_0x4de918[_0x2a5c('0x10')];_0x393a27++){io[_0x2a5c('0x1a')](_0x2a5c('0x1b'),{'id':_0x4de918[_0x393a27],'closed':!![]});}}})['catch'](function(_0x2b720d){logger[_0x2a5c('0x1c')](_0x2a5c('0x1d'),_0x2b720d?util['inspect'](_0x2b720d,{'showHidden':![],'depth':null}):'');});}exports[_0x2a5c('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xd71b=['../../mysqldb','../logger','schedule','redis','defaults','localhost','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','util','../../config/environment'];(function(_0xb5f4f6,_0x44e6f0){var _0x45fbc0=function(_0x3de6e5){while(--_0x3de6e5){_0xb5f4f6['push'](_0xb5f4f6['shift']());}};_0x45fbc0(++_0x44e6f0);}(_0xd71b,0x15a));var _0xbd71=function(_0x1823a0,_0x38947d){_0x1823a0=_0x1823a0-0x0;var _0x2b780c=_0xd71b[_0x1823a0];return _0x2b780c;};'use strict';var _=require(_0xbd71('0x0'));var moment=require(_0xbd71('0x1'));var Redis=require('ioredis');var util=require(_0xbd71('0x2'));var config=require(_0xbd71('0x3'));var db=require(_0xbd71('0x4'))['db'];var logger=require(_0xbd71('0x5'))(_0xbd71('0x6'));config[_0xbd71('0x7')]=_[_0xbd71('0x8')](config[_0xbd71('0x7')],{'host':_0xbd71('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd71('0x7')]));function closeInteractions(){var _0x162c44=0x0;var _0x18173f=[];return db[_0xbd71('0xa')][_0xbd71('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xbd71('0xc')](function(_0x17d23b){_0x162c44=_0x17d23b[_0xbd71('0xd')];if(_0x162c44){return db[_0xbd71('0xe')][_0xbd71('0xf')]({'raw':!![],'attributes':['id',_0xbd71('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xbd71('0x11')](_0x17d23b[_0xbd71('0xd')],_0xbd71('0x12'))}}});}else{return[];}})[_0xbd71('0xc')](function(_0xbb5c86){if(_0xbb5c86&&_0xbb5c86[_0xbd71('0x13')]){_0x18173f=_[_0xbd71('0x14')](_0xbb5c86||[],'id');logger[_0xbd71('0x15')](_0xbd71('0x16'),_0x18173f[_0xbd71('0x17')]());return db['ChatInteraction'][_0xbd71('0x18')]({'closeReason':'system','disposition':_0xbd71('0x19'),'closed':!![],'closedAt':moment()[_0xbd71('0x1a')](_0xbd71('0x1b'))},{'where':{'id':_0x18173f}});}})[_0xbd71('0xc')](function(){if(_0x18173f&&_0x18173f[_0xbd71('0x13')]){logger[_0xbd71('0x15')](_0xbd71('0x1c'),_0x18173f[_0xbd71('0x17')]());for(var _0x1c694e=0x0;_0x1c694e<_0x18173f[_0xbd71('0x13')];_0x1c694e++){io[_0xbd71('0x1d')](_0xbd71('0x1e'),{'id':_0x18173f[_0x1c694e],'closed':!![]});}}})[_0xbd71('0x1f')](function(_0x11c765){logger[_0xbd71('0x20')](_0xbd71('0x21'),_0x11c765?util[_0xbd71('0x22')](_0x11c765,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index a92b92f..fa3ba70 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 _0x30ff=['jobs','toString','keyBy','difference','length','exists','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','add','start','add\x20cron','stop','deleteJob','stop\x20cron','endAt','update','update\x20cron','run','util','path','lodash','moment','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','format','\x22%s\x22\x20<%s>','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','status','Sent','sendIfEmpty','request','error','error\x20mail','stringify','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','no\x20report\x20id','Schedule','MailServerOut'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x30ff,0x1c7));var _0xf30f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x30ff[_0x14add3];return _0x4a174f;};'use strict';var fs=require('fs');var util=require(_0xf30f('0x0'));var path=require(_0xf30f('0x1'));var _=require(_0xf30f('0x2'));var moment=require(_0xf30f('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0xf30f('0x4'));var logger=require('../logger')(_0xf30f('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xf30f('0x6'));var analyticDefaultReportController=require(_0xf30f('0x7'));var client=jayson[_0xf30f('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x56fa50,_0x5c11c8){return function(){logger[_0xf30f('0x9')](_0xf30f('0xa'),_0x56fa50[_0xf30f('0xb')]);var _0x5cf88b=!![];var _0x43c975={'tls':{'rejectUnauthorized':![]}};if(_0x56fa50[_0xf30f('0xc')][_0xf30f('0xd')]['service']){_0x43c975[_0xf30f('0xe')]=_0x56fa50[_0xf30f('0xc')][_0xf30f('0xd')][_0xf30f('0xe')];}else{_0x43c975[_0xf30f('0xf')]=_0x56fa50[_0xf30f('0xc')]['Smtp'][_0xf30f('0xf')];_0x43c975[_0xf30f('0x10')]=_0x56fa50[_0xf30f('0xc')][_0xf30f('0xd')][_0xf30f('0x10')];_0x43c975[_0xf30f('0x11')]=_0x56fa50[_0xf30f('0xc')]['Smtp'][_0xf30f('0x11')];}if(_0x56fa50[_0xf30f('0xc')]['Smtp'][_0xf30f('0x12')]){_0x43c975[_0xf30f('0x13')]={'user':_0x56fa50[_0xf30f('0xc')][_0xf30f('0xd')]['user'],'pass':_0x56fa50['MailAccount'][_0xf30f('0xd')]['pass']};}var _0x30e955={'account':_0x43c975,'message':{'from':util[_0xf30f('0x14')](_0xf30f('0x15'),_0x56fa50[_0xf30f('0xc')]['name'],_0x56fa50['MailAccount'][_0xf30f('0xb')]||_0x56fa50['MailAccount'][_0xf30f('0xd')][_0xf30f('0x16')]),'to':_0x56fa50[_0xf30f('0xb')],'cc':_0x56fa50['cc'],'bcc':_0x56fa50[_0xf30f('0x17')],'subject':util['format'](_0xf30f('0x18'),_0x5c11c8[_0xf30f('0x19')],_0x56fa50[_0xf30f('0x1a')],_0x56fa50['subtractUnit'])}};var _0x21dbad=path[_0xf30f('0x1b')](__dirname,_0xf30f('0x1c'));var _0x3bb9aa=_0x5c11c8[_0xf30f('0x1d')];var _0x42fcb6=util[_0xf30f('0x14')](_0xf30f('0x1e'),path[_0xf30f('0x1f')](_0x5c11c8['savename'],path[_0xf30f('0x20')](_0x5c11c8[_0xf30f('0x1d')])),_0xf30f('0x21'));var _0x5c2d49=path[_0xf30f('0x1b')](_0x21dbad,_0x3bb9aa);var _0x313542=path['join'](_0x21dbad,_0x42fcb6);if(fs[_0xf30f('0x22')](_0x5c2d49)){_0x5c11c8['status']='Sent';_0x30e955['message'][_0xf30f('0x23')]=[{'filename':_0x3bb9aa,'path':_0x5c2d49}];_0x30e955[_0xf30f('0x24')][_0xf30f('0x25')]=util[_0xf30f('0x14')](_0xf30f('0x26'),JSON['stringify'](_0x5c11c8,null,0x2));}else if(fs[_0xf30f('0x22')](_0x313542)){_0x5c11c8[_0xf30f('0x27')]=_0xf30f('0x28');_0x30e955[_0xf30f('0x24')][_0xf30f('0x23')]=[{'filename':_0x42fcb6,'path':_0x313542}];}else{_0x30e955[_0xf30f('0x24')][_0xf30f('0x25')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x56fa50[_0xf30f('0x29')]){_0x5cf88b=![];logger[_0xf30f('0x9')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x5cf88b){return client[_0xf30f('0x2a')]('SendMail',_0x30e955)['then'](function(_0x7ea19e){if(_0x7ea19e[_0xf30f('0x2b')]){return logger['error'](_0xf30f('0x2c'),JSON[_0xf30f('0x2d')](_0x7ea19e));}return logger['info']('email\x20sent');})[_0xf30f('0x2e')](function(_0x28de5a){return logger[_0xf30f('0x2b')](_0xf30f('0x2c'),JSON['stringify'](_0x28de5a));});}};}function handleError(){return function(_0x1d94e7){return logger[_0xf30f('0x2b')](JSON[_0xf30f('0x2d')](_0x1d94e7));};}function handleResult(_0x51d0b2){return function(_0x39915f){logger['info']('data',JSON['stringify'](_0x39915f));if(_0x51d0b2[_0xf30f('0xc')]&&_0x51d0b2[_0xf30f('0xc')]['Smtp']&&!_[_0xf30f('0x2f')](_0x51d0b2[_0xf30f('0xb')])){setTimeout(handleSendEmail(_0x51d0b2,_0x39915f),0x3c*0x3e8);}};}function handleJob(_0x22623d){return function(){try{if(_[_0xf30f('0x2f')](_0x22623d[_0xf30f('0x1a')])){return logger[_0xf30f('0x9')](_0xf30f('0x30'));}if(_[_0xf30f('0x2f')](_0x22623d[_0xf30f('0x31')])){return logger[_0xf30f('0x9')](_0xf30f('0x32'));}var _0x1b8c5a={'startDate':moment()[_0xf30f('0x33')](_0x22623d[_0xf30f('0x1a')],_0x22623d['subtractUnit'])[_0xf30f('0x14')](_0xf30f('0x34')),'endDate':moment()[_0xf30f('0x14')](_0xf30f('0x34')),'type':_0xf30f('0x35'),'output':_0x22623d['output'],'name':_0x22623d[_0xf30f('0x19')]};if(!_[_0xf30f('0x2f')](_0x22623d['DefaultReportId'])){logger[_0xf30f('0x9')](_0xf30f('0x36'),_0x22623d['DefaultReportId']);return analyticDefaultReportController[_0xf30f('0x37')]({'id':_0x22623d['DefaultReportId']},_0x1b8c5a)[_0xf30f('0x38')](handleResult(_0x22623d))[_0xf30f('0x2e')](handleError());}if(!_[_0xf30f('0x2f')](_0x22623d[_0xf30f('0x39')])){logger[_0xf30f('0x9')]('exec\x20custom\x20report\x20id:%s',_0x22623d[_0xf30f('0x39')]);return analyticCustomReportController[_0xf30f('0x37')]({'id':_0x22623d[_0xf30f('0x39')]},_0x1b8c5a)[_0xf30f('0x38')](handleResult(_0x22623d))['catch'](handleError());}}catch(_0x40c950){logger['error'](JSON['stringify'](_0x40c950));}return logger['info'](_0xf30f('0x3a'));};}function getJobs(_0x1e5a7f){var _0x2609dd={};if(_0x1e5a7f){_0x2609dd['id']=_0x1e5a7f;}return db[_0xf30f('0x3b')]['findAll']({'where':_0x2609dd,'include':[{'model':db['MailAccount'],'attributes':['id',_0xf30f('0x19'),_0xf30f('0xb')],'include':[{'model':db[_0xf30f('0x3c')],'as':_0xf30f('0xd')}]}]})[_0xf30f('0x38')](function(_0x414d9e){var _0x5499b0=_['keys'](manager[_0xf30f('0x3d')]);var _0x35499b=_['map'](_0x414d9e,function(_0x4b13b2){return _0x4b13b2['id'][_0xf30f('0x3e')]();});var _0x559ff6=_[_0xf30f('0x3f')](_0x414d9e,function(_0x2664da){return _0x2664da['id']['toString']();});var _0xa6723d=_0x1e5a7f?_0x35499b:_[_0xf30f('0x40')](_0x35499b,_0x5499b0);var _0x51b07b=_['intersection'](_0x35499b,_0x5499b0);var _0x5675c9=_['difference'](_0x5499b0,_0x35499b);var _0x8e506b;var _0xab86c;for(_0x8e506b=0x0;_0x8e506b<_0x5675c9[_0xf30f('0x41')]&&!_0x1e5a7f;_0x8e506b+=0x1){_0xab86c=_0x5675c9[_0x8e506b]['toString']();if(manager[_0xf30f('0x42')](_0xab86c)){manager['stop'](_0xab86c);manager['deleteJob'](_0xab86c);logger[_0xf30f('0x9')](_0xf30f('0x43'),_0xab86c);}}logger[_0xf30f('0x9')]('toRun',JSON['stringify'](_0xa6723d));for(_0x8e506b=0x0;_0x8e506b<_0xa6723d[_0xf30f('0x41')];_0x8e506b+=0x1){_0xab86c=_0xa6723d[_0x8e506b]['toString']();logger[_0xf30f('0x9')](_0xf30f('0x44'),_0xab86c);if(_0x1e5a7f){logger[_0xf30f('0x9')](_0xf30f('0x45'),_0x1e5a7f);logger[_0xf30f('0x9')](JSON[_0xf30f('0x2d')](_0x559ff6[_0xab86c]));BPromise[_0xf30f('0x46')]()[_0xf30f('0x38')](handleJob(_0x559ff6[_0xab86c]));logger[_0xf30f('0x9')](_0xf30f('0x47'),_0x559ff6[_0xab86c][_0xf30f('0x19')],_0x559ff6[_0xab86c][_0xf30f('0x48')]);}else if(_0x559ff6[_0xab86c]['cron']&&_0x559ff6[_0xab86c][_0xf30f('0x49')]&&moment()[_0xf30f('0x4a')](_0x559ff6[_0xab86c][_0xf30f('0x4b')],_0x559ff6[_0xab86c]['endAt'])){manager[_0xf30f('0x4c')](_0xab86c,_0x559ff6[_0xab86c][_0xf30f('0x48')],handleJob(_0x559ff6[_0xab86c]));manager[_0xf30f('0x4d')](_0xab86c);logger[_0xf30f('0x9')](_0xf30f('0x4e'),_0x559ff6[_0xab86c]['name'],_0x559ff6[_0xab86c][_0xf30f('0x48')]);}else if(manager[_0xf30f('0x42')](_0xab86c)){manager[_0xf30f('0x4f')](_0xab86c);manager[_0xf30f('0x50')](_0xab86c);logger[_0xf30f('0x9')](_0xf30f('0x51'),_0x559ff6[_0xab86c][_0xf30f('0x19')],_0x559ff6[_0xab86c][_0xf30f('0x48')]);}}for(_0x8e506b=0x0,_0xab86c;_0x8e506b<_0x51b07b[_0xf30f('0x41')]&&!_0x1e5a7f;_0x8e506b+=0x1){_0xab86c=_0x51b07b[_0x8e506b]['toString']();if(manager['exists'](_0xab86c)){if(_0x559ff6[_0xab86c][_0xf30f('0x48')]&&_0x559ff6[_0xab86c][_0xf30f('0x49')]&&moment()[_0xf30f('0x4a')](_0x559ff6[_0xab86c][_0xf30f('0x4b')],_0x559ff6[_0xab86c][_0xf30f('0x52')])){manager[_0xf30f('0x53')](_0xab86c,_0x559ff6[_0xab86c]['cron'],handleJob(_0x559ff6[_0xab86c]));logger[_0xf30f('0x9')](_0xf30f('0x54'),_0x559ff6[_0xab86c][_0xf30f('0x19')],_0x559ff6[_0xab86c][_0xf30f('0x48')]);}else{manager['stop'](_0xab86c);manager[_0xf30f('0x50')](_0xab86c);logger[_0xf30f('0x9')](_0xf30f('0x51'),_0x559ff6[_0xab86c][_0xf30f('0x19')],_0x559ff6[_0xab86c][_0xf30f('0x48')]);}}}})['catch'](function(_0x57ff89){logger[_0xf30f('0x2b')](JSON[_0xf30f('0x2d')](_0x57ff89));});}exports[_0xf30f('0x55')]=function(_0x2e9c0c){return getJobs(_0x2e9c0c);};exports[_0xf30f('0x4d')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x89db=['toRun','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron','deleteJob','stop\x20cron','length','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','Smtp','service','MailAccount','host','port','secure','authentication','user','pass','format','\x22%s\x22\x20<%s>','email','Report\x20%s\x20last\x20%s\x20%s','join','../../files/reports','savename','%s.%s','basename','existsSync','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','status','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','stringify','email\x20sent','error\x20mail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','name','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','keys','map','toString','keyBy','intersection','exists','stop','delete\x20cron'];(function(_0x38aacd,_0x50a722){var _0x5021cc=function(_0x5d9723){while(--_0x5d9723){_0x38aacd['push'](_0x38aacd['shift']());}};_0x5021cc(++_0x50a722);}(_0x89db,0x1ce));var _0xb89d=function(_0x38a76e,_0x55db2f){_0x38a76e=_0x38a76e-0x0;var _0xd13d92=_0x89db[_0x38a76e];return _0xd13d92;};'use strict';var fs=require('fs');var util=require(_0xb89d('0x0'));var path=require(_0xb89d('0x1'));var _=require(_0xb89d('0x2'));var moment=require(_0xb89d('0x3'));var CronJobManager=require(_0xb89d('0x4'));var jayson=require(_0xb89d('0x5'));var BPromise=require(_0xb89d('0x6'));var logger=require(_0xb89d('0x7'))(_0xb89d('0x8'));var db=require(_0xb89d('0x9'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xb89d('0xa'));var client=jayson[_0xb89d('0xb')][_0xb89d('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3cc99b,_0x52c305){return function(){logger[_0xb89d('0xd')](_0xb89d('0xe'),_0x3cc99b['email']);var _0x584bcb=!![];var _0x28f7aa={'tls':{'rejectUnauthorized':![]}};if(_0x3cc99b['MailAccount'][_0xb89d('0xf')][_0xb89d('0x10')]){_0x28f7aa['service']=_0x3cc99b[_0xb89d('0x11')][_0xb89d('0xf')][_0xb89d('0x10')];}else{_0x28f7aa[_0xb89d('0x12')]=_0x3cc99b[_0xb89d('0x11')]['Smtp'][_0xb89d('0x12')];_0x28f7aa[_0xb89d('0x13')]=_0x3cc99b['MailAccount'][_0xb89d('0xf')][_0xb89d('0x13')];_0x28f7aa[_0xb89d('0x14')]=_0x3cc99b[_0xb89d('0x11')][_0xb89d('0xf')]['secure'];}if(_0x3cc99b['MailAccount']['Smtp'][_0xb89d('0x15')]){_0x28f7aa['auth']={'user':_0x3cc99b['MailAccount'][_0xb89d('0xf')][_0xb89d('0x16')],'pass':_0x3cc99b[_0xb89d('0x11')][_0xb89d('0xf')][_0xb89d('0x17')]};}var _0x48f644={'account':_0x28f7aa,'message':{'from':util[_0xb89d('0x18')](_0xb89d('0x19'),_0x3cc99b[_0xb89d('0x11')]['name'],_0x3cc99b['MailAccount'][_0xb89d('0x1a')]||_0x3cc99b['MailAccount'][_0xb89d('0xf')][_0xb89d('0x16')]),'to':_0x3cc99b[_0xb89d('0x1a')],'cc':_0x3cc99b['cc'],'bcc':_0x3cc99b['bcc'],'subject':util[_0xb89d('0x18')](_0xb89d('0x1b'),_0x52c305['name'],_0x3cc99b['subtractNumber'],_0x3cc99b['subtractUnit'])}};var _0x152d19=path[_0xb89d('0x1c')](__dirname,_0xb89d('0x1d'));var _0x359a4e=_0x52c305[_0xb89d('0x1e')];var _0x30b56b=util[_0xb89d('0x18')](_0xb89d('0x1f'),path[_0xb89d('0x20')](_0x52c305[_0xb89d('0x1e')],path['extname'](_0x52c305[_0xb89d('0x1e')])),'zip');var _0x1ba7b0=path[_0xb89d('0x1c')](_0x152d19,_0x359a4e);var _0x566aef=path[_0xb89d('0x1c')](_0x152d19,_0x30b56b);if(fs[_0xb89d('0x21')](_0x1ba7b0)){_0x52c305['status']='Sent';_0x48f644[_0xb89d('0x22')][_0xb89d('0x23')]=[{'filename':_0x359a4e,'path':_0x1ba7b0}];_0x48f644[_0xb89d('0x22')][_0xb89d('0x24')]=util['format'](_0xb89d('0x25'),JSON['stringify'](_0x52c305,null,0x2));}else if(fs['existsSync'](_0x566aef)){_0x52c305[_0xb89d('0x26')]=_0xb89d('0x27');_0x48f644['message'][_0xb89d('0x23')]=[{'filename':_0x30b56b,'path':_0x566aef}];}else{_0x48f644['message']['text']=_0xb89d('0x28');if(!_0x3cc99b[_0xb89d('0x29')]){_0x584bcb=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x584bcb){return client[_0xb89d('0x2a')](_0xb89d('0x2b'),_0x48f644)[_0xb89d('0x2c')](function(_0xaa4d12){if(_0xaa4d12[_0xb89d('0x2d')]){return logger[_0xb89d('0x2d')]('error\x20mail',JSON[_0xb89d('0x2e')](_0xaa4d12));}return logger['info'](_0xb89d('0x2f'));})['catch'](function(_0x1455c0){return logger[_0xb89d('0x2d')](_0xb89d('0x30'),JSON[_0xb89d('0x2e')](_0x1455c0));});}};}function handleError(){return function(_0x34a6db){return logger['error'](JSON[_0xb89d('0x2e')](_0x34a6db));};}function handleResult(_0x1848a6){return function(_0x1645ce){logger[_0xb89d('0xd')]('data',JSON['stringify'](_0x1645ce));if(_0x1848a6['MailAccount']&&_0x1848a6['MailAccount'][_0xb89d('0xf')]&&!_[_0xb89d('0x31')](_0x1848a6[_0xb89d('0x1a')])){setTimeout(handleSendEmail(_0x1848a6,_0x1645ce),0x3c*0x3e8);}};}function handleJob(_0x370a4c){return function(){try{if(_[_0xb89d('0x31')](_0x370a4c['subtractNumber'])){return logger['info'](_0xb89d('0x32'));}if(_[_0xb89d('0x31')](_0x370a4c[_0xb89d('0x33')])){return logger[_0xb89d('0xd')](_0xb89d('0x34'));}var _0x34a485={'startDate':moment()['subtract'](_0x370a4c['subtractNumber'],_0x370a4c['subtractUnit'])[_0xb89d('0x18')](_0xb89d('0x35')),'endDate':moment()[_0xb89d('0x18')](_0xb89d('0x35')),'type':'scheduled','output':_0x370a4c[_0xb89d('0x36')],'name':_0x370a4c[_0xb89d('0x37')]};if(!_[_0xb89d('0x31')](_0x370a4c[_0xb89d('0x38')])){logger[_0xb89d('0xd')](_0xb89d('0x39'),_0x370a4c[_0xb89d('0x38')]);return analyticDefaultReportController[_0xb89d('0x3a')]({'id':_0x370a4c[_0xb89d('0x38')]},_0x34a485)[_0xb89d('0x2c')](handleResult(_0x370a4c))[_0xb89d('0x3b')](handleError());}if(!_[_0xb89d('0x31')](_0x370a4c[_0xb89d('0x3c')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x370a4c[_0xb89d('0x3c')]);return analyticCustomReportController[_0xb89d('0x3a')]({'id':_0x370a4c['CustomReportId']},_0x34a485)[_0xb89d('0x2c')](handleResult(_0x370a4c))[_0xb89d('0x3b')](handleError());}}catch(_0x308b24){logger[_0xb89d('0x2d')](JSON[_0xb89d('0x2e')](_0x308b24));}return logger[_0xb89d('0xd')](_0xb89d('0x3d'));};}function getJobs(_0x489efa){var _0x58b0ed={};if(_0x489efa){_0x58b0ed['id']=_0x489efa;}return db[_0xb89d('0x3e')]['findAll']({'where':_0x58b0ed,'include':[{'model':db[_0xb89d('0x11')],'attributes':['id',_0xb89d('0x37'),_0xb89d('0x1a')],'include':[{'model':db[_0xb89d('0x3f')],'as':_0xb89d('0xf')}]}]})[_0xb89d('0x2c')](function(_0x381a10){var _0x2a1e5c=_[_0xb89d('0x40')](manager['jobs']);var _0x3c2afa=_[_0xb89d('0x41')](_0x381a10,function(_0x5dd06b){return _0x5dd06b['id'][_0xb89d('0x42')]();});var _0x70cb6b=_[_0xb89d('0x43')](_0x381a10,function(_0x1ec8d5){return _0x1ec8d5['id'][_0xb89d('0x42')]();});var _0xd96216=_0x489efa?_0x3c2afa:_['difference'](_0x3c2afa,_0x2a1e5c);var _0x253eb5=_[_0xb89d('0x44')](_0x3c2afa,_0x2a1e5c);var _0x3ec758=_['difference'](_0x2a1e5c,_0x3c2afa);var _0x112032;var _0x53e64f;for(_0x112032=0x0;_0x112032<_0x3ec758['length']&&!_0x489efa;_0x112032+=0x1){_0x53e64f=_0x3ec758[_0x112032][_0xb89d('0x42')]();if(manager[_0xb89d('0x45')](_0x53e64f)){manager[_0xb89d('0x46')](_0x53e64f);manager['deleteJob'](_0x53e64f);logger[_0xb89d('0xd')](_0xb89d('0x47'),_0x53e64f);}}logger['info'](_0xb89d('0x48'),JSON[_0xb89d('0x2e')](_0xd96216));for(_0x112032=0x0;_0x112032<_0xd96216['length'];_0x112032+=0x1){_0x53e64f=_0xd96216[_0x112032][_0xb89d('0x42')]();logger['info']('index',_0x53e64f);if(_0x489efa){logger['info'](_0xb89d('0x49'),_0x489efa);logger[_0xb89d('0xd')](JSON[_0xb89d('0x2e')](_0x70cb6b[_0x53e64f]));BPromise[_0xb89d('0x4a')]()['then'](handleJob(_0x70cb6b[_0x53e64f]));logger[_0xb89d('0xd')](_0xb89d('0x4b'),_0x70cb6b[_0x53e64f][_0xb89d('0x37')],_0x70cb6b[_0x53e64f][_0xb89d('0x4c')]);}else if(_0x70cb6b[_0x53e64f][_0xb89d('0x4c')]&&_0x70cb6b[_0x53e64f][_0xb89d('0x4d')]&&moment()[_0xb89d('0x4e')](_0x70cb6b[_0x53e64f][_0xb89d('0x4f')],_0x70cb6b[_0x53e64f][_0xb89d('0x50')])){manager['add'](_0x53e64f,_0x70cb6b[_0x53e64f][_0xb89d('0x4c')],handleJob(_0x70cb6b[_0x53e64f]));manager[_0xb89d('0x51')](_0x53e64f);logger[_0xb89d('0xd')](_0xb89d('0x52'),_0x70cb6b[_0x53e64f][_0xb89d('0x37')],_0x70cb6b[_0x53e64f][_0xb89d('0x4c')]);}else if(manager[_0xb89d('0x45')](_0x53e64f)){manager['stop'](_0x53e64f);manager[_0xb89d('0x53')](_0x53e64f);logger[_0xb89d('0xd')](_0xb89d('0x54'),_0x70cb6b[_0x53e64f][_0xb89d('0x37')],_0x70cb6b[_0x53e64f][_0xb89d('0x4c')]);}}for(_0x112032=0x0,_0x53e64f;_0x112032<_0x253eb5[_0xb89d('0x55')]&&!_0x489efa;_0x112032+=0x1){_0x53e64f=_0x253eb5[_0x112032]['toString']();if(manager['exists'](_0x53e64f)){if(_0x70cb6b[_0x53e64f][_0xb89d('0x4c')]&&_0x70cb6b[_0x53e64f]['active']&&moment()['isBetween'](_0x70cb6b[_0x53e64f][_0xb89d('0x4f')],_0x70cb6b[_0x53e64f][_0xb89d('0x50')])){manager[_0xb89d('0x56')](_0x53e64f,_0x70cb6b[_0x53e64f]['cron'],handleJob(_0x70cb6b[_0x53e64f]));logger[_0xb89d('0xd')](_0xb89d('0x57'),_0x70cb6b[_0x53e64f][_0xb89d('0x37')],_0x70cb6b[_0x53e64f][_0xb89d('0x4c')]);}else{manager[_0xb89d('0x46')](_0x53e64f);manager[_0xb89d('0x53')](_0x53e64f);logger['info'](_0xb89d('0x54'),_0x70cb6b[_0x53e64f][_0xb89d('0x37')],_0x70cb6b[_0x53e64f][_0xb89d('0x4c')]);}}}})[_0xb89d('0x3b')](function(_0x303a57){logger[_0xb89d('0x2d')](JSON['stringify'](_0x303a57));});}exports[_0xb89d('0x58')]=function(_0x28779c){return getJobs(_0x28779c);};exports[_0xb89d('0x51')]=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 b49395d..d0cc0c4 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 _0x73ab=['COMPLETED','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','bucket','Cloud\x20Provider\x20not\x20configured','start','lodash','request-promise','util','TranscribeService','getTranscriptionJob','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','tempSentiment','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Sequelize','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','Sentiment\x20Analysis\x20not\x20configured','Negative','Neutral'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x73ab,0xe3));var _0xb73a=function(_0x334f9a,_0x542f01){_0x334f9a=_0x334f9a-0x0;var _0x2b219d=_0x73ab[_0x334f9a];return _0x2b219d;};var _=require(_0xb73a('0x0'));var AWS=require('aws-sdk');var rp=require(_0xb73a('0x1'));var util=require(_0xb73a('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x29f509,_0x4018e6,_0x242f37,_0x1b14cb){return new Promise(function(_0x2021a6,_0x537285){var _0x31fced=new AWS[(_0xb73a('0x3'))]({'accessKeyId':_0x4018e6,'secretAccessKey':_0x29f509,'region':_0x242f37});_0x31fced[_0xb73a('0x4')]({'TranscriptionJobName':_0x1b14cb},function(_0x8db0e1,_0x58294f){if(_0x8db0e1){return _0x537285(_0x8db0e1);}else{return _0x2021a6(_0x58294f);}});});}function sentiment(_0x4c90f0,_0x367b71,_0x34ba2b,_0x3a24dd,_0x3d2667){return new Promise(function(_0x519862,_0x1bc3c6){var _0xf367d6=new AWS['Comprehend']({'accessKeyId':_0x367b71,'secretAccessKey':_0x4c90f0,'region':_0x34ba2b});_0xf367d6['detectSentiment']({'Text':_0x3a24dd,'LanguageCode':_0x3d2667[_0xb73a('0x5')](0x0,0x2)},function(_0x10433a,_0x32d502){if(_0x10433a){return _0x1bc3c6(_0x10433a);}else{return _0x519862(_0x32d502);}});});}function checkTranscribeJob(_0x25450a,_0x3b5fd0,_0x5a5baa){var _0x11d58f;return new BPromise(function(_0x184d6a,_0x595cfa){logger[_0xb73a('0x6')](util[_0xb73a('0x7')](_0xb73a('0x8'),_0x25450a['id'],_0x25450a[_0xb73a('0x9')]));return getTranscriptionJob(_0x5a5baa[_0xb73a('0xa')],_0x5a5baa['data2'],_0x3b5fd0[_0xb73a('0xb')],_0x25450a[_0xb73a('0x9')])[_0xb73a('0xc')](function(_0x44ca51){logger['info'](util['format'](_0xb73a('0xd'),_0x25450a['id'],_0x25450a[_0xb73a('0x9')],_0x44ca51[_0xb73a('0xe')][_0xb73a('0xf')]));if(!_0x25450a[_0xb73a('0x10')]){switch(_0x44ca51[_0xb73a('0xe')][_0xb73a('0xf')]){case'COMPLETED':var _0x1126c4={'transcribeStatus':_0x44ca51[_0xb73a('0xe')]['TranscriptionJobStatus'],'fileUri':_0x44ca51[_0xb73a('0xe')]['Transcript']['TranscriptFileUri']};logger[_0xb73a('0x6')](util[_0xb73a('0x7')](_0xb73a('0x11'),_0x25450a['id']));return rp({'uri':_0x44ca51[_0xb73a('0xe')][_0xb73a('0x12')][_0xb73a('0x13')],'json':!![]})[_0xb73a('0xc')](function(_0x2d94a1){logger[_0xb73a('0x6')](util[_0xb73a('0x7')](_0xb73a('0x14'),_0x25450a['id']));if(_0x2d94a1&&_0x2d94a1[_0xb73a('0x15')]&&_0x2d94a1[_0xb73a('0x15')][_0xb73a('0x16')]&&_0x2d94a1[_0xb73a('0x15')][_0xb73a('0x16')][_0xb73a('0x17')]){_0x1126c4['fileText']='';for(var _0x39c809=0x0;_0x39c809<_0x2d94a1['results'][_0xb73a('0x16')][_0xb73a('0x17')];_0x39c809++){_0x1126c4[_0xb73a('0x10')]+=_0x2d94a1[_0xb73a('0x15')]['transcripts'][_0x39c809][_0xb73a('0x18')]+'';}}return _0x25450a[_0xb73a('0x19')](_0x1126c4);})[_0xb73a('0xc')](function(){logger[_0xb73a('0x6')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x25450a['id']));if(!_0x25450a[_0xb73a('0x1a')]){throw new db['Sequelize'][(_0xb73a('0x1b'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3b5fd0[_0xb73a('0x1c')]||!_0x3b5fd0[_0xb73a('0x1d')]||!_0x3b5fd0[_0xb73a('0x1e')]||!_0x3b5fd0[_0xb73a('0x1f')]||!_0x3b5fd0['bucket']){throw new db['Sequelize'][(_0xb73a('0x1b'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1126c4[_0xb73a('0x10')]){throw new Error(_0xb73a('0x20'));}if(_0x3b5fd0[_0xb73a('0x1d')]===_0x5a5baa['id']){return _0x5a5baa;}else{return db[_0xb73a('0x21')][_0xb73a('0x22')]({'where':{'id':_settings[_0xb73a('0x1d')]}});}})[_0xb73a('0xc')](function(_0x13f2db){if(!_0x13f2db){throw new db['Sequelize']['ValidationError'](_0xb73a('0x23'));}if(!_0x13f2db[_0xb73a('0xa')]||!_0x13f2db[_0xb73a('0x24')]){throw new db[(_0xb73a('0x25'))][(_0xb73a('0x1b'))]('Cloud\x20Provider\x20not\x20configured');}_0x11d58f=_0x13f2db;logger[_0xb73a('0x6')](util['format'](_0xb73a('0x26'),_0x25450a['id']));return sentiment(_0x11d58f['data1'],_0x11d58f[_0xb73a('0x24')],_0x3b5fd0['sentimentRegion'],_0x1126c4['fileText'],_0x3b5fd0[_0xb73a('0x1f')]);})[_0xb73a('0xc')](function(_0x367103){logger['info'](util[_0xb73a('0x7')](_0xb73a('0x27'),_0x25450a['id']));return _0x25450a[_0xb73a('0x19')]({'sentiment':_0x367103[_0xb73a('0x28')],'sPositive':_0x367103[_0xb73a('0x29')][_0xb73a('0x2a')],'sNegative':_0x367103['SentimentScore']['Negative'],'sMixed':_0x367103['SentimentScore'][_0xb73a('0x2b')],'sNeutral':_0x367103[_0xb73a('0x29')]['Neutral']});})[_0xb73a('0xc')](function(){logger[_0xb73a('0x6')](util[_0xb73a('0x7')](_0xb73a('0x2c'),_0x25450a['id']));_0x184d6a();});case _0xb73a('0x2d'):return _0x25450a[_0xb73a('0x19')]({'transcribeStatus':_0xb73a('0x2d'),'failureReason':_0x44ca51[_0xb73a('0xe')][_0xb73a('0x2e')]})[_0xb73a('0xc')](function(){logger[_0xb73a('0x6')](util[_0xb73a('0x7')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x25450a['id']));_0x184d6a();});default:logger['info'](util[_0xb73a('0x7')](_0xb73a('0x2f'),_0x25450a['id']));break;}}else{return BPromise[_0xb73a('0x30')]()[_0xb73a('0xc')](function(){if(!_0x25450a[_0xb73a('0x1a')]){throw new db[(_0xb73a('0x25'))][(_0xb73a('0x1b'))](_0xb73a('0x31'));}if(!_0x3b5fd0[_0xb73a('0x1c')]||!_0x3b5fd0['sentimentAccountId']||!_0x3b5fd0[_0xb73a('0x1e')]||!_0x3b5fd0[_0xb73a('0x1f')]||!_0x3b5fd0['bucket']){throw new db['Sequelize']['ValidationError'](_0xb73a('0x32'));}if(!_0x25450a[_0xb73a('0x10')]){throw new Error(_0xb73a('0x20'));}if(_0x3b5fd0[_0xb73a('0x1d')]===_0x5a5baa['id']){return _0x5a5baa;}else{return db['CloudProvider'][_0xb73a('0x22')]({'where':{'id':_settings[_0xb73a('0x1d')]}});}})['then'](function(_0x35cf80){if(!_0x35cf80){throw new db[(_0xb73a('0x25'))][(_0xb73a('0x1b'))](_0xb73a('0x23'));}if(!_0x35cf80[_0xb73a('0xa')]||!_0x35cf80[_0xb73a('0x24')]){throw new db[(_0xb73a('0x25'))][(_0xb73a('0x1b'))]('Cloud\x20Provider\x20not\x20configured');}_0x11d58f=_0x35cf80;logger['info'](util[_0xb73a('0x7')](_0xb73a('0x26'),_0x25450a['id']));return sentiment(_0x11d58f[_0xb73a('0xa')],_0x11d58f[_0xb73a('0x24')],_0x3b5fd0[_0xb73a('0x1e')],_0x25450a[_0xb73a('0x10')],_0x3b5fd0[_0xb73a('0x1f')]);})[_0xb73a('0xc')](function(_0x3b4068){logger[_0xb73a('0x6')](util[_0xb73a('0x7')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x25450a['id']));return _0x25450a[_0xb73a('0x19')]({'sentiment':_0x3b4068['Sentiment'],'sPositive':_0x3b4068[_0xb73a('0x29')][_0xb73a('0x2a')],'sNegative':_0x3b4068[_0xb73a('0x29')][_0xb73a('0x33')],'sMixed':_0x3b4068[_0xb73a('0x29')]['Mixed'],'sNeutral':_0x3b4068['SentimentScore'][_0xb73a('0x34')],'transcribeStatus':_0xb73a('0x35')});})[_0xb73a('0xc')](function(){logger['info'](util['format'](_0xb73a('0x2c'),_0x25450a['id']));_0x184d6a();});}})[_0xb73a('0x36')](function(_0x5c566a){if(_0x5c566a){if(!_0x5c566a[_0xb73a('0x37')]||_0x5c566a[_0xb73a('0x37')]!=='SequelizeValidationError'){logger[_0xb73a('0x38')](util[_0xb73a('0x7')](_0xb73a('0x39'),_0x25450a['id']),util[_0xb73a('0x3a')](_0x5c566a,{'showHidden':![],'depth':null}));}}_0x184d6a();});});}function checkTranscribe(){var _0x2790e5;var _0x2c3314;var _0x4b305a;return db[_0xb73a('0x3b')][_0xb73a('0x3c')]({'where':{'transcribeStatus':_0xb73a('0x3d')}})[_0xb73a('0xc')](function(_0x120c55){if(!_0x120c55||!_0x120c55['length']){throw new db[(_0xb73a('0x25'))][(_0xb73a('0x1b'))](_0xb73a('0x3e'));}_0x2790e5=_0x120c55;return db[_0xb73a('0x3f')][_0xb73a('0x22')]({'where':{'id':0x1}});})[_0xb73a('0xc')](function(_0x37c436){if(!_0x37c436){throw new db[(_0xb73a('0x25'))][(_0xb73a('0x1b'))](_0xb73a('0x40'));}_0x2c3314=_0x37c436;if(!_0x2c3314[_0xb73a('0x41')]||!_0x2c3314[_0xb73a('0x42')]||!_0x2c3314[_0xb73a('0xb')]||!_0x2c3314[_0xb73a('0x1f')]||!_0x2c3314[_0xb73a('0x43')]){throw new db['Sequelize'][(_0xb73a('0x1b'))]('Transcribe\x20not\x20configured');}return db[_0xb73a('0x21')]['findOne']({'where':{'id':_0x2c3314[_0xb73a('0x42')]}});})[_0xb73a('0xc')](function(_0x5d22bb){if(!_0x5d22bb){throw new db[(_0xb73a('0x25'))][(_0xb73a('0x1b'))](_0xb73a('0x23'));}if(!_0x5d22bb[_0xb73a('0xa')]||!_0x5d22bb[_0xb73a('0x24')]){throw new db['Sequelize'][(_0xb73a('0x1b'))](_0xb73a('0x44'));}_0x4b305a=_0x5d22bb;var _0x222202=[];_0x2790e5['forEach'](function(_0x2dc978){_0x222202['push'](checkTranscribeJob(_0x2dc978,_0x2c3314,_0x4b305a));});return BPromise['all'](_0x222202);})[_0xb73a('0x36')](function(_0x2349a8){if(_0x2349a8){if(!_0x2349a8['name']||_0x2349a8[_0xb73a('0x37')]!=='SequelizeValidationError'){logger[_0xb73a('0x38')](util[_0xb73a('0x3a')](_0x2349a8,{'showHidden':![],'depth':null}));}}});}exports[_0xb73a('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xae02=['name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','length','Setting','Settings\x20not\x20available','transcribeAccountId','push','all','start','lodash','aws-sdk','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','fileText','transcripts','transcript','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20available','Positive','catch'];(function(_0x335136,_0x131d00){var _0x234b60=function(_0x1ba3a8){while(--_0x1ba3a8){_0x335136['push'](_0x335136['shift']());}};_0x234b60(++_0x131d00);}(_0xae02,0x19a));var _0x2ae0=function(_0x255bba,_0x4dd398){_0x255bba=_0x255bba-0x0;var _0xe8e46=_0xae02[_0x255bba];return _0xe8e46;};var _=require(_0x2ae0('0x0'));var AWS=require(_0x2ae0('0x1'));var rp=require('request-promise');var util=require(_0x2ae0('0x2'));var BPromise=require(_0x2ae0('0x3'));var db=require(_0x2ae0('0x4'))['db'];var logger=require('../../config/logger')(_0x2ae0('0x5'));function getTranscriptionJob(_0x1c56f1,_0x2d9cbf,_0x54c51d,_0x591a30){return new Promise(function(_0x322830,_0x28b444){var _0x3ccc0c=new AWS[(_0x2ae0('0x6'))]({'accessKeyId':_0x2d9cbf,'secretAccessKey':_0x1c56f1,'region':_0x54c51d});_0x3ccc0c[_0x2ae0('0x7')]({'TranscriptionJobName':_0x591a30},function(_0xdd5f14,_0x19d56e){if(_0xdd5f14){return _0x28b444(_0xdd5f14);}else{return _0x322830(_0x19d56e);}});});}function sentiment(_0x2bc6e9,_0x434dd5,_0x357245,_0xe9a93a,_0x3a3f17){return new Promise(function(_0x51cb7a,_0x43d260){var _0x27f5c4=new AWS['Comprehend']({'accessKeyId':_0x434dd5,'secretAccessKey':_0x2bc6e9,'region':_0x357245});_0x27f5c4['detectSentiment']({'Text':_0xe9a93a,'LanguageCode':_0x3a3f17[_0x2ae0('0x8')](0x0,0x2)},function(_0x155ed9,_0x5dde0f){if(_0x155ed9){return _0x43d260(_0x155ed9);}else{return _0x51cb7a(_0x5dde0f);}});});}function checkTranscribeJob(_0x5bacbc,_0x373bd7,_0x186336){var _0x592359;return new BPromise(function(_0x4400c5,_0x5590d4){logger[_0x2ae0('0x9')](util[_0x2ae0('0xa')](_0x2ae0('0xb'),_0x5bacbc['id'],_0x5bacbc[_0x2ae0('0xc')]));return getTranscriptionJob(_0x186336[_0x2ae0('0xd')],_0x186336[_0x2ae0('0xe')],_0x373bd7[_0x2ae0('0xf')],_0x5bacbc[_0x2ae0('0xc')])['then'](function(_0xf69015){logger[_0x2ae0('0x9')](util[_0x2ae0('0xa')](_0x2ae0('0x10'),_0x5bacbc['id'],_0x5bacbc['transcribeName'],_0xf69015[_0x2ae0('0x11')]['TranscriptionJobStatus']));if(!_0x5bacbc['fileText']){switch(_0xf69015[_0x2ae0('0x11')][_0x2ae0('0x12')]){case _0x2ae0('0x13'):var _0x4a0750={'transcribeStatus':_0xf69015[_0x2ae0('0x11')][_0x2ae0('0x12')],'fileUri':_0xf69015['TranscriptionJob'][_0x2ae0('0x14')]['TranscriptFileUri']};logger[_0x2ae0('0x9')](util[_0x2ae0('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x5bacbc['id']));return rp({'uri':_0xf69015[_0x2ae0('0x11')][_0x2ae0('0x14')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x2fe931){logger[_0x2ae0('0x9')](util[_0x2ae0('0xa')](_0x2ae0('0x15'),_0x5bacbc['id']));if(_0x2fe931&&_0x2fe931['results']&&_0x2fe931[_0x2ae0('0x16')]['transcripts']&&_0x2fe931[_0x2ae0('0x16')]['transcripts']['length']){_0x4a0750[_0x2ae0('0x17')]='';for(var _0xac4b33=0x0;_0xac4b33<_0x2fe931[_0x2ae0('0x16')]['transcripts']['length'];_0xac4b33++){_0x4a0750['fileText']+=_0x2fe931[_0x2ae0('0x16')][_0x2ae0('0x18')][_0xac4b33][_0x2ae0('0x19')]+'';}}return _0x5bacbc['update'](_0x4a0750);})[_0x2ae0('0x1a')](function(){logger['info'](util[_0x2ae0('0xa')](_0x2ae0('0x1b'),_0x5bacbc['id']));if(!_0x5bacbc['tempSentiment']){throw new db[(_0x2ae0('0x1c'))][(_0x2ae0('0x1d'))](_0x2ae0('0x1e'));}if(!_0x373bd7['sentiment']||!_0x373bd7[_0x2ae0('0x1f')]||!_0x373bd7['sentimentRegion']||!_0x373bd7[_0x2ae0('0x20')]||!_0x373bd7[_0x2ae0('0x21')]){throw new db[(_0x2ae0('0x1c'))]['ValidationError'](_0x2ae0('0x22'));}if(!_0x4a0750[_0x2ae0('0x17')]){throw new Error(_0x2ae0('0x23'));}if(_0x373bd7[_0x2ae0('0x1f')]===_0x186336['id']){return _0x186336;}else{return db[_0x2ae0('0x24')][_0x2ae0('0x25')]({'where':{'id':_settings[_0x2ae0('0x1f')]}});}})[_0x2ae0('0x1a')](function(_0x5cbc2b){if(!_0x5cbc2b){throw new db[(_0x2ae0('0x1c'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x5cbc2b['data1']||!_0x5cbc2b[_0x2ae0('0xe')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x592359=_0x5cbc2b;logger['info'](util['format'](_0x2ae0('0x26'),_0x5bacbc['id']));return sentiment(_0x592359['data1'],_0x592359[_0x2ae0('0xe')],_0x373bd7[_0x2ae0('0x27')],_0x4a0750['fileText'],_0x373bd7[_0x2ae0('0x20')]);})[_0x2ae0('0x1a')](function(_0x43d9e9){logger[_0x2ae0('0x9')](util['format'](_0x2ae0('0x28'),_0x5bacbc['id']));return _0x5bacbc[_0x2ae0('0x29')]({'sentiment':_0x43d9e9[_0x2ae0('0x2a')],'sPositive':_0x43d9e9['SentimentScore']['Positive'],'sNegative':_0x43d9e9[_0x2ae0('0x2b')]['Negative'],'sMixed':_0x43d9e9[_0x2ae0('0x2b')][_0x2ae0('0x2c')],'sNeutral':_0x43d9e9[_0x2ae0('0x2b')][_0x2ae0('0x2d')]});})['then'](function(){logger[_0x2ae0('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5bacbc['id']));_0x4400c5();});case _0x2ae0('0x2e'):return _0x5bacbc['update']({'transcribeStatus':_0x2ae0('0x2e'),'failureReason':_0xf69015[_0x2ae0('0x11')]['FailureReason']})[_0x2ae0('0x1a')](function(){logger['info'](util[_0x2ae0('0xa')](_0x2ae0('0x1b'),_0x5bacbc['id']));_0x4400c5();});default:logger['info'](util[_0x2ae0('0xa')](_0x2ae0('0x2f'),_0x5bacbc['id']));break;}}else{return BPromise[_0x2ae0('0x30')]()[_0x2ae0('0x1a')](function(){if(!_0x5bacbc['tempSentiment']){throw new db[(_0x2ae0('0x1c'))]['ValidationError'](_0x2ae0('0x1e'));}if(!_0x373bd7['sentiment']||!_0x373bd7[_0x2ae0('0x1f')]||!_0x373bd7['sentimentRegion']||!_0x373bd7[_0x2ae0('0x20')]||!_0x373bd7['bucket']){throw new db[(_0x2ae0('0x1c'))][(_0x2ae0('0x1d'))](_0x2ae0('0x22'));}if(!_0x5bacbc[_0x2ae0('0x17')]){throw new Error(_0x2ae0('0x23'));}if(_0x373bd7['sentimentAccountId']===_0x186336['id']){return _0x186336;}else{return db[_0x2ae0('0x24')][_0x2ae0('0x25')]({'where':{'id':_settings[_0x2ae0('0x1f')]}});}})[_0x2ae0('0x1a')](function(_0x367822){if(!_0x367822){throw new db[(_0x2ae0('0x1c'))][(_0x2ae0('0x1d'))](_0x2ae0('0x31'));}if(!_0x367822['data1']||!_0x367822['data2']){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x592359=_0x367822;logger[_0x2ae0('0x9')](util[_0x2ae0('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5bacbc['id']));return sentiment(_0x592359['data1'],_0x592359[_0x2ae0('0xe')],_0x373bd7[_0x2ae0('0x27')],_0x5bacbc['fileText'],_0x373bd7['language']);})[_0x2ae0('0x1a')](function(_0x12b300){logger[_0x2ae0('0x9')](util[_0x2ae0('0xa')](_0x2ae0('0x28'),_0x5bacbc['id']));return _0x5bacbc[_0x2ae0('0x29')]({'sentiment':_0x12b300[_0x2ae0('0x2a')],'sPositive':_0x12b300[_0x2ae0('0x2b')][_0x2ae0('0x32')],'sNegative':_0x12b300[_0x2ae0('0x2b')]['Negative'],'sMixed':_0x12b300['SentimentScore'][_0x2ae0('0x2c')],'sNeutral':_0x12b300[_0x2ae0('0x2b')]['Neutral'],'transcribeStatus':_0x2ae0('0x13')});})[_0x2ae0('0x1a')](function(){logger[_0x2ae0('0x9')](util[_0x2ae0('0xa')](_0x2ae0('0x1b'),_0x5bacbc['id']));_0x4400c5();});}})[_0x2ae0('0x33')](function(_0x3be541){if(_0x3be541){if(!_0x3be541[_0x2ae0('0x34')]||_0x3be541[_0x2ae0('0x34')]!==_0x2ae0('0x35')){logger['error'](util[_0x2ae0('0xa')](_0x2ae0('0x36'),_0x5bacbc['id']),util[_0x2ae0('0x37')](_0x3be541,{'showHidden':![],'depth':null}));}}_0x4400c5();});});}function checkTranscribe(){var _0x2193fa;var _0x1ac815;var _0x1b374b;return db[_0x2ae0('0x38')][_0x2ae0('0x39')]({'where':{'transcribeStatus':_0x2ae0('0x3a')}})[_0x2ae0('0x1a')](function(_0x151cba){if(!_0x151cba||!_0x151cba[_0x2ae0('0x3b')]){throw new db['Sequelize'][(_0x2ae0('0x1d'))]('No\x20transcribe\x20job\x20to\x20check');}_0x2193fa=_0x151cba;return db[_0x2ae0('0x3c')][_0x2ae0('0x25')]({'where':{'id':0x1}});})['then'](function(_0x45053f){if(!_0x45053f){throw new db[(_0x2ae0('0x1c'))][(_0x2ae0('0x1d'))](_0x2ae0('0x3d'));}_0x1ac815=_0x45053f;if(!_0x1ac815['transcribe']||!_0x1ac815[_0x2ae0('0x3e')]||!_0x1ac815[_0x2ae0('0xf')]||!_0x1ac815[_0x2ae0('0x20')]||!_0x1ac815[_0x2ae0('0x21')]){throw new db[(_0x2ae0('0x1c'))][(_0x2ae0('0x1d'))]('Transcribe\x20not\x20configured');}return db[_0x2ae0('0x24')]['findOne']({'where':{'id':_0x1ac815[_0x2ae0('0x3e')]}});})[_0x2ae0('0x1a')](function(_0x3aa6e1){if(!_0x3aa6e1){throw new db[(_0x2ae0('0x1c'))][(_0x2ae0('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3aa6e1[_0x2ae0('0xd')]||!_0x3aa6e1[_0x2ae0('0xe')]){throw new db[(_0x2ae0('0x1c'))][(_0x2ae0('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x1b374b=_0x3aa6e1;var _0x5356ca=[];_0x2193fa['forEach'](function(_0x1da8a1){_0x5356ca[_0x2ae0('0x3f')](checkTranscribeJob(_0x1da8a1,_0x1ac815,_0x1b374b));});return BPromise[_0x2ae0('0x40')](_0x5356ca);})['catch'](function(_0x54ddea){if(_0x54ddea){if(!_0x54ddea[_0x2ae0('0x34')]||_0x54ddea[_0x2ae0('0x34')]!==_0x2ae0('0x35')){logger['error'](util[_0x2ae0('0x37')](_0x54ddea,{'showHidden':![],'depth':null}));}}});}exports[_0x2ae0('0x41')]=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 38ca4b0..d7c8031 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 _0x384d=['error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','length','emit','whatsappInteraction:update','catch'];(function(_0x358004,_0x26f5eb){var _0xea3c83=function(_0x3f2a3f){while(--_0x3f2a3f){_0x358004['push'](_0x358004['shift']());}};_0xea3c83(++_0x26f5eb);}(_0x384d,0xac));var _0xd384=function(_0x3f7add,_0x111403){_0x3f7add=_0x3f7add-0x0;var _0x636c80=_0x384d[_0x3f7add];return _0x636c80;};'use strict';var _=require(_0xd384('0x0'));var moment=require(_0xd384('0x1'));var Redis=require('ioredis');var util=require('util');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xd384('0x2'))(_0xd384('0x3'));config[_0xd384('0x4')]=_['defaults'](config['redis'],{'host':_0xd384('0x5'),'port':0x18eb});var io=require(_0xd384('0x6'))(new Redis(config[_0xd384('0x4')]));function closeInteractions(){var _0x188f0d=[];return db[_0xd384('0x7')][_0xd384('0x8')]({'raw':!![],'attributes':['id',_0xd384('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})[_0xd384('0xa')](function(_0x39012a){if(_0x39012a&&_0x39012a['length']){_0x188f0d=_[_0xd384('0xb')](_0x39012a||[],'id');logger[_0xd384('0xc')](_0xd384('0xd'),_0x188f0d[_0xd384('0xe')]());return db[_0xd384('0x7')][_0xd384('0xf')]({'closeReason':'system','disposition':_0xd384('0x10'),'closed':!![],'closedAt':moment()[_0xd384('0x11')](_0xd384('0x12'))},{'where':{'id':_0x188f0d}});}})['then'](function(){if(_0x188f0d&&_0x188f0d['length']){logger[_0xd384('0xc')](_0xd384('0x13'),_0x188f0d[_0xd384('0xe')]());for(var _0x1edf52=0x0;_0x1edf52<_0x188f0d[_0xd384('0x14')];_0x1edf52++){io[_0xd384('0x15')](_0xd384('0x16'),{'id':_0x188f0d[_0x1edf52],'closed':!![]});}}})[_0xd384('0x17')](function(_0x46983e){logger[_0xd384('0x18')](_0xd384('0x19'),_0x46983e?util[_0xd384('0x1a')](_0x46983e,{'showHidden':![],'depth':null}):'');});}exports[_0xd384('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xc68e=['redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','then','length','map','info','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','util','../../config/environment','../../mysqldb','../logger','schedule','defaults'];(function(_0x55b606,_0x4c0d6a){var _0x35826a=function(_0x526cf6){while(--_0x526cf6){_0x55b606['push'](_0x55b606['shift']());}};_0x35826a(++_0x4c0d6a);}(_0xc68e,0xb3));var _0xec68=function(_0x11456d,_0x238968){_0x11456d=_0x11456d-0x0;var _0x2d058c=_0xc68e[_0x11456d];return _0x2d058c;};'use strict';var _=require(_0xec68('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0xec68('0x1'));var config=require(_0xec68('0x2'));var db=require(_0xec68('0x3'))['db'];var logger=require(_0xec68('0x4'))(_0xec68('0x5'));config['redis']=_[_0xec68('0x6')](config[_0xec68('0x7')],{'host':_0xec68('0x8'),'port':0x18eb});var io=require(_0xec68('0x9'))(new Redis(config[_0xec68('0x7')]));function closeInteractions(){var _0xb82880=[];return db[_0xec68('0xa')][_0xec68('0xb')]({'raw':!![],'attributes':['id',_0xec68('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xec68('0xd'))}}})[_0xec68('0xe')](function(_0x3515bb){if(_0x3515bb&&_0x3515bb[_0xec68('0xf')]){_0xb82880=_[_0xec68('0x10')](_0x3515bb||[],'id');logger[_0xec68('0x11')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0xb82880['join']());return db[_0xec68('0xa')][_0xec68('0x12')]({'closeReason':_0xec68('0x13'),'disposition':_0xec68('0x14'),'closed':!![],'closedAt':moment()['format'](_0xec68('0x15'))},{'where':{'id':_0xb82880}});}})['then'](function(){if(_0xb82880&&_0xb82880[_0xec68('0xf')]){logger[_0xec68('0x11')](_0xec68('0x16'),_0xb82880[_0xec68('0x17')]());for(var _0x590fef=0x0;_0x590fef<_0xb82880[_0xec68('0xf')];_0x590fef++){io[_0xec68('0x18')](_0xec68('0x19'),{'id':_0xb82880[_0x590fef],'closed':!![]});}}})[_0xec68('0x1a')](function(_0x54e69e){logger[_0xec68('0x1b')](_0xec68('0x1c'),_0x54e69e?util[_0xec68('0x1d')](_0x54e69e,{'showHidden':![],'depth':null}):'');});}exports[_0xec68('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 0a217ec..5d10e26 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe319=['contacts2','hopper2','util','../mysqldb','Biondo','innocenzo.biondo','@xcally.com','push','now','Innocenzo','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper1'];(function(_0x29e6de,_0x38b1c3){var _0x1b4f20=function(_0x2e1d09){while(--_0x2e1d09){_0x29e6de['push'](_0x29e6de['shift']());}};_0x1b4f20(++_0x38b1c3);}(_0xe319,0x191));var _0x9e31=function(_0x4455d8,_0x19e788){_0x4455d8=_0x4455d8-0x0;var _0x3ba234=_0xe319[_0x4455d8];return _0x3ba234;};'use strict';var util=require(_0x9e31('0x0'));var db=require(_0x9e31('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x9e31('0x2')+i,'phone':0xf879fb460+i,'email':_0x9e31('0x3')+i+_0x9e31('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x9e31('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x9e31('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9e31('0x6')](),'updatedAt':Date[_0x9e31('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x9e31('0x5')]({'id':i,'firstName':_0x9e31('0x7')+i,'lastName':_0x9e31('0x2')+i,'phone':0xf879fb460+i,'email':_0x9e31('0x3')+i+_0x9e31('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x9e31('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x9e31('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9e31('0x6')](),'updatedAt':Date[_0x9e31('0x6')]()});}db[_0x9e31('0x8')][_0x9e31('0x9')]({'where':{}})[_0x9e31('0xa')](function(){return db[_0x9e31('0x8')][_0x9e31('0xb')](contacts);})['then'](function(){console['log'](_0x9e31('0xc'),_0x9e31('0xd'));return db[_0x9e31('0xe')]['destroy']({'where':{}});})['then'](function(){return db[_0x9e31('0xe')][_0x9e31('0xb')](hopper);})[_0x9e31('0xa')](function(){console[_0x9e31('0xf')](_0x9e31('0xc'),_0x9e31('0x10'));return db[_0x9e31('0x8')]['bulkCreate'](contacts2);})[_0x9e31('0xa')](function(){console[_0x9e31('0xf')]('finished\x20populating',_0x9e31('0x11'));return db[_0x9e31('0xe')]['bulkCreate'](hopper2);})['then'](function(){console[_0x9e31('0xf')](_0x9e31('0xc'),_0x9e31('0x12'));})['catch'](function(_0x509af0){console[_0x9e31('0xf')](_0x509af0);}); \ No newline at end of file +var _0xdf9a=['destroy','then','bulkCreate','finished\x20populating','CmHopper','log','contacts2','hopper2','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact'];(function(_0xdf9b0a,_0x1acf1c){var _0x57fdc3=function(_0xa45e57){while(--_0xa45e57){_0xdf9b0a['push'](_0xdf9b0a['shift']());}};_0x57fdc3(++_0x1acf1c);}(_0xdf9a,0x1b1));var _0xadf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf9a[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xadf9('0x0'));var db=require(_0xadf9('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xadf9('0x2')]({'id':i,'firstName':_0xadf9('0x3')+i,'lastName':_0xadf9('0x4')+i,'phone':0xf879fb460+i,'email':_0xadf9('0x5')+i+_0xadf9('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xadf9('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xadf9('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xadf9('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xadf9('0x2')]({'id':i,'firstName':_0xadf9('0x3')+i,'lastName':_0xadf9('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xadf9('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xadf9('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xadf9('0x7')](),'updatedAt':Date[_0xadf9('0x7')]()});}db[_0xadf9('0x8')][_0xadf9('0x9')]({'where':{}})[_0xadf9('0xa')](function(){return db[_0xadf9('0x8')][_0xadf9('0xb')](contacts);})[_0xadf9('0xa')](function(){console['log'](_0xadf9('0xc'),'contacts1');return db[_0xadf9('0xd')][_0xadf9('0x9')]({'where':{}});})[_0xadf9('0xa')](function(){return db[_0xadf9('0xd')][_0xadf9('0xb')](hopper);})[_0xadf9('0xa')](function(){console['log'](_0xadf9('0xc'),'hopper1');return db['CmContact']['bulkCreate'](contacts2);})[_0xadf9('0xa')](function(){console[_0xadf9('0xe')](_0xadf9('0xc'),_0xadf9('0xf'));return db[_0xadf9('0xd')]['bulkCreate'](hopper2);})[_0xadf9('0xa')](function(){console[_0xadf9('0xe')]('finished\x20populating',_0xadf9('0x10'));})['catch'](function(_0x2c4359){console[_0xadf9('0xe')](_0x2c4359);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index cf0fd7d..9c729c7 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4955=['actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','util','../mysqldb','format','agent','%s%s','password','friend','udp','all','ulaw','yes'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4955,0x1a5));var _0x5495=function(_0x2742ec,_0x3fd410){_0x2742ec=_0x2742ec-0x0;var _0x372a96=_0x4955[_0x2742ec];return _0x372a96;};'use strict';var util=require(_0x5495('0x0'));var db=require(_0x5495('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x5495('0x2')]('%s%s',_0x5495('0x3'),i),'fullname':util['format'](_0x5495('0x4'),_0x5495('0x3'),i),'email':util[_0x5495('0x2')]('%s%s@xcally.com',_0x5495('0x3'),i),'role':_0x5495('0x3'),'password':_0x5495('0x5'),'internal':0xfa0+i,'type':_0x5495('0x6'),'transport':[_0x5495('0x7'),'ws','wss'],'disallow':[_0x5495('0x8')],'allow':[_0x5495('0x9')],'defaultuser':util[_0x5495('0x2')]('%s%s',_0x5495('0x3'),i),'encryption':_0x5495('0xa'),'avpf':'yes','force_avp':'yes','icesupport':_0x5495('0xa'),'dtlsenable':_0x5495('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x5495('0xb'),'callerid':util['format'](_0x5495('0xc'),util[_0x5495('0x2')](_0x5495('0x4'),_0x5495('0x3'),i),0xfa0+i)});}db[_0x5495('0xd')][_0x5495('0xe')](users)[_0x5495('0xf')](function(){console[_0x5495('0x10')](_0x5495('0x11'));})['catch'](function(_0x560b8a){console[_0x5495('0x10')](_0x560b8a);}); \ No newline at end of file +var _0x51d2=['format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','log','util','push'];(function(_0x1c6c5e,_0x34c672){var _0x10abfc=function(_0x48d95c){while(--_0x48d95c){_0x1c6c5e['push'](_0x1c6c5e['shift']());}};_0x10abfc(++_0x34c672);}(_0x51d2,0x8a));var _0x251d=function(_0x364b32,_0x4dec35){_0x364b32=_0x364b32-0x0;var _0x3f3ea0=_0x51d2[_0x364b32];return _0x3f3ea0;};'use strict';var util=require(_0x251d('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x251d('0x1')]({'name':util[_0x251d('0x2')](_0x251d('0x3'),_0x251d('0x4'),i),'fullname':util[_0x251d('0x2')](_0x251d('0x3'),_0x251d('0x4'),i),'email':util[_0x251d('0x2')](_0x251d('0x5'),'agent',i),'role':'agent','password':_0x251d('0x6'),'internal':0xfa0+i,'type':_0x251d('0x7'),'transport':[_0x251d('0x8'),'ws',_0x251d('0x9')],'disallow':[_0x251d('0xa')],'allow':['ulaw'],'defaultuser':util[_0x251d('0x2')]('%s%s',_0x251d('0x4'),i),'encryption':_0x251d('0xb'),'avpf':'yes','force_avp':_0x251d('0xb'),'icesupport':_0x251d('0xb'),'dtlsenable':_0x251d('0xb'),'dtlsverify':'no','dtlscertfile':_0x251d('0xc'),'dtlsprivatekey':_0x251d('0xd'),'dtlssetup':'actpass','callerid':util[_0x251d('0x2')](_0x251d('0xe'),util[_0x251d('0x2')](_0x251d('0x3'),'agent',i),0xfa0+i)});}db[_0x251d('0xf')][_0x251d('0x10')](users)[_0x251d('0x11')](function(){console['log'](_0x251d('0x12'));})['catch'](function(_0x20b303){console[_0x251d('0x13')](_0x20b303);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 7bb5193..d348d09 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x531a=['getWhatsappQueues','voice','chat','fax','sms','openchannel','whatsapp','trunk:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','log','join','request','connection','remotePort','connectedAt','SocketIO\x20','nsp','address','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','role','agent','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','map','User','Campaign','type','format','Agents','length','handshake','query','find','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','admin','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','user','voice:inbound','voice:outbound','userProfileId','MailQueue','Trunks','Trunk','getVoiceQueues','getFaxQueues','getMailQueues','getOpenchannelQueues'];(function(_0x469e36,_0x3d35ab){var _0x5956ab=function(_0x4edf2b){while(--_0x4edf2b){_0x469e36['push'](_0x469e36['shift']());}};_0x5956ab(++_0x3d35ab);}(_0x531a,0x79));var _0xa531=function(_0x211218,_0x5a6b0a){_0x211218=_0x211218-0x0;var _0x3db618=_0x531a[_0x211218];return _0x3db618;};'use strict';var _=require(_0xa531('0x0'));var util=require('util');var BPromise=require(_0xa531('0x1'));var db=require(_0xa531('0x2'))['db'];var config=require(_0xa531('0x3'));var queryQueues={'attributes':['id',_0xa531('0x4')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0xa531('0x4'),_0xa531('0x5')],'raw':!![],'where':{'role':_0xa531('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xa531('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xa531('0x4')],'where':{'role':_0xa531('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':_0xa531('0x7')}};function getAssociatedResources(_0x31e630,_0x57dcf5,_0x24bf4d){return db[_0xa531('0x8')][_0xa531('0x9')]({'where':{'name':_0x31e630,'userProfileId':_0x57dcf5},'raw':!![]})[_0xa531('0xa')](function(_0x308c3c){if(_0x308c3c){if(_0x308c3c[_0xa531('0xb')]){switch(_0x31e630){case _0xa531('0xc'):case _0xa531('0xd'):case _0xa531('0xe'):case _0xa531('0xf'):case _0xa531('0x10'):case _0xa531('0x11'):case _0xa531('0x12'):return db[_0x24bf4d][_0xa531('0x13')](queryQueues);case _0xa531('0x14'):return db[_0x24bf4d][_0xa531('0x13')](queryTelephones);case'Trunks':return db[_0x24bf4d]['findAll'](queryTrunks);case _0xa531('0x15'):return db[_0x24bf4d]['findAll'](queryCampaigns);}}else{return db[_0xa531('0x16')]['findAll']({'attributes':[_0xa531('0x17')],'where':{'sectionId':_0x308c3c['id']},'raw':!![]})['then'](function(_0x4f01c6){if(_0x4f01c6){var _0x1cdee2={'where':{'id':_[_0xa531('0x18')](_0x4f01c6,'resourceId')},'raw':!![]};switch(_0x24bf4d){case _0xa531('0x19'):_0x1cdee2['where'][_0xa531('0x5')]='telephone';break;case _0xa531('0x1a'):_0x1cdee2['where'][_0xa531('0x1b')]=_0xa531('0x7');break;}return db[_0x24bf4d][_0xa531('0x13')](_0x1cdee2);}else{return[];}});}}else{return[];}})[_0xa531('0xa')](function(_0x2c8425){return _0x2c8425;});}function joinOrLeaveQueues(_0x2d8d04,_0x595843,_0x5542be,_0x6e50f6){_0x2d8d04[_0x595843](util[_0xa531('0x1c')]('%s:queue:%s',_0x5542be,_0x6e50f6[_0xa531('0x4')]));if(_0x6e50f6[_0xa531('0x1d')]){for(var _0x538b27=0x0;_0x538b27<_0x6e50f6[_0xa531('0x1d')][_0xa531('0x1e')];_0x538b27+=0x1){_0x2d8d04[_0x595843](util[_0xa531('0x1c')]('user:%s',_0x6e50f6[_0xa531('0x1d')][_0x538b27][_0xa531('0x4')]));}}}function joinOrLeave(_0x12a3c3,_0x25a808,_0x33c28a){var _0x1bed18;if(_0x12a3c3[_0xa531('0x1f')][_0xa531('0x20')]['id']){db[_0xa531('0x19')][_0xa531('0x21')]({'attributes':['id','name',_0xa531('0x5'),'userProfileId'],'where':{'id':_0x12a3c3[_0xa531('0x1f')]['query']['id']},'include':[{'model':db[_0xa531('0x22')],'as':_0xa531('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xa531('0x24')],'as':_0xa531('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xa531('0x26')],'as':_0xa531('0x27'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xa531('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xa531('0x29')],'as':_0xa531('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0xff8953){if(_0xff8953){_0x1bed18=_0xff8953;_0x12a3c3[_0x25a808](util[_0xa531('0x1c')]('user:%s',_0xff8953['name']));var _0x27edb4=[];switch(_0xff8953['role']){case _0xa531('0x2b'):_0x12a3c3[_0x25a808]('voice:inbound');_0x12a3c3[_0x25a808]('voice:outbound');if(queryQueues['hasOwnProperty'](_0xa531('0x2c'))){delete queryQueues[_0xa531('0x2c')];}_0x27edb4[_0xa531('0x2d')](db[_0xa531('0x2e')][_0xa531('0x13')](queryQueues));_0x27edb4['push'](db[_0xa531('0x2f')][_0xa531('0x13')](queryQueues));_0x27edb4['push'](db[_0xa531('0x30')][_0xa531('0x13')](queryQueues));_0x27edb4[_0xa531('0x2d')](db[_0xa531('0x31')]['findAll'](queryQueues));_0x27edb4[_0xa531('0x2d')](db['MailQueue'][_0xa531('0x13')](queryQueues));_0x27edb4[_0xa531('0x2d')](db[_0xa531('0x32')][_0xa531('0x13')](queryQueues));_0x27edb4[_0xa531('0x2d')](db[_0xa531('0x33')]['findAll'](queryQueues));_0x27edb4[_0xa531('0x2d')](db[_0xa531('0x19')][_0xa531('0x13')](queryTelephones));_0x27edb4[_0xa531('0x2d')](db['Trunk'][_0xa531('0x13')](queryTrunks));_0x27edb4[_0xa531('0x2d')](db[_0xa531('0x1a')]['findAll'](queryCampaigns));_0x27edb4[_0xa531('0x2d')](db[_0xa531('0x19')][_0xa531('0x13')](queryAgents));break;case _0xa531('0x34'):_0x12a3c3[_0x25a808](_0xa531('0x35'));_0x12a3c3[_0x25a808](_0xa531('0x36'));_0x27edb4[_0xa531('0x2d')](getAssociatedResources(_0xa531('0xc'),_0xff8953['userProfileId'],'VoiceQueue'));_0x27edb4[_0xa531('0x2d')](getAssociatedResources(_0xa531('0xd'),_0xff8953[_0xa531('0x37')],_0xa531('0x2f')));_0x27edb4['push'](getAssociatedResources(_0xa531('0xe'),_0xff8953[_0xa531('0x37')],'FaxQueue'));_0x27edb4['push'](getAssociatedResources(_0xa531('0xf'),_0xff8953[_0xa531('0x37')],_0xa531('0x31')));_0x27edb4[_0xa531('0x2d')](getAssociatedResources(_0xa531('0x10'),_0xff8953[_0xa531('0x37')],_0xa531('0x38')));_0x27edb4[_0xa531('0x2d')](getAssociatedResources('OpenchannelQueues',_0xff8953[_0xa531('0x37')],'OpenchannelQueue'));_0x27edb4[_0xa531('0x2d')](getAssociatedResources(_0xa531('0x12'),_0xff8953[_0xa531('0x37')],_0xa531('0x33')));_0x27edb4[_0xa531('0x2d')](getAssociatedResources(_0xa531('0x14'),_0xff8953['userProfileId'],_0xa531('0x19')));_0x27edb4[_0xa531('0x2d')](getAssociatedResources(_0xa531('0x39'),_0xff8953[_0xa531('0x37')],_0xa531('0x3a')));_0x27edb4['push'](getAssociatedResources(_0xa531('0x15'),_0xff8953[_0xa531('0x37')],_0xa531('0x1a')));_0x27edb4[_0xa531('0x2d')](db['User'][_0xa531('0x13')](queryAgents));break;case _0xa531('0x6'):_0x12a3c3[_0x25a808](_0xa531('0x35'));_0x12a3c3[_0x25a808](_0xa531('0x36'));_0x27edb4[_0xa531('0x2d')](_0xff8953[_0xa531('0x3b')]({'attributes':['id',_0xa531('0x4')]}));_0x27edb4['push'](_0xff8953['getChatQueues']({'attributes':['id',_0xa531('0x4')]}));_0x27edb4['push'](_0xff8953[_0xa531('0x3c')]({'attributes':['id',_0xa531('0x4')]}));_0x27edb4[_0xa531('0x2d')](_0xff8953['getSmsQueues']({'attributes':['id',_0xa531('0x4')]}));_0x27edb4['push'](_0xff8953[_0xa531('0x3d')]({'attributes':['id',_0xa531('0x4')]}));_0x27edb4[_0xa531('0x2d')](_0xff8953[_0xa531('0x3e')]({'attributes':['id',_0xa531('0x4')]}));_0x27edb4[_0xa531('0x2d')](_0xff8953[_0xa531('0x3f')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x27edb4);}})[_0xa531('0xa')](function(_0x4daa68){if(_0x4daa68&&_0x4daa68[_0xa531('0x1e')]){for(var _0xd2838f=0x0;_0xd2838f<_0x4daa68['length'];_0xd2838f+=0x1){for(var _0x4ee23e=0x0;_0x4ee23e<_0x4daa68[_0xd2838f][_0xa531('0x1e')];_0x4ee23e+=0x1){switch(_0xd2838f){case 0x0:joinOrLeaveQueues(_0x12a3c3,_0x25a808,_0xa531('0x40'),_0x4daa68[_0xd2838f][_0x4ee23e]);break;case 0x1:joinOrLeaveQueues(_0x12a3c3,_0x25a808,_0xa531('0x41'),_0x4daa68[_0xd2838f][_0x4ee23e]);break;case 0x2:joinOrLeaveQueues(_0x12a3c3,_0x25a808,_0xa531('0x42'),_0x4daa68[_0xd2838f][_0x4ee23e]);break;case 0x3:joinOrLeaveQueues(_0x12a3c3,_0x25a808,_0xa531('0x43'),_0x4daa68[_0xd2838f][_0x4ee23e]);break;case 0x4:joinOrLeaveQueues(_0x12a3c3,_0x25a808,'mail',_0x4daa68[_0xd2838f][_0x4ee23e]);break;case 0x5:joinOrLeaveQueues(_0x12a3c3,_0x25a808,_0xa531('0x44'),_0x4daa68[_0xd2838f][_0x4ee23e]);break;case 0x6:joinOrLeaveQueues(_0x12a3c3,_0x25a808,_0xa531('0x45'),_0x4daa68[_0xd2838f][_0x4ee23e]);break;case 0x7:if(_0x1bed18['role']!=='agent')_0x12a3c3[_0x25a808](util['format']('telephone:%s',_0x4daa68[_0xd2838f][_0x4ee23e][_0xa531('0x4')]));break;case 0x8:if(_0x1bed18[_0xa531('0x5')]!==_0xa531('0x6'))_0x12a3c3[_0x25a808](util[_0xa531('0x1c')](_0xa531('0x46'),_0x4daa68[_0xd2838f][_0x4ee23e][_0xa531('0x4')]));break;case 0x9:if(_0x1bed18['role']!==_0xa531('0x6'))_0x12a3c3[_0x25a808](util['format']('campaign:%s:%s',_0x4daa68[_0xd2838f][_0x4ee23e]['type'],_0x4daa68[_0xd2838f][_0x4ee23e][_0xa531('0x4')]));break;case 0xa:_0x12a3c3[_0x25a808](util[_0xa531('0x1c')]('user:%s',_0x4daa68[_0xd2838f][_0x4ee23e][_0xa531('0x4')]));break;}}}}})[_0xa531('0xa')](function(){if(_0x25a808===_0xa531('0x47')){var _0x4373ff=_[_0xa531('0x18')](_0x1bed18['ChatInteractions'],'id');return _0x1bed18[_0xa531('0x48')](_0x4373ff)['then'](function(){for(var _0x5f84c2=0x0;_0x5f84c2<_0x4373ff[_0xa531('0x1e')];_0x5f84c2+=0x1){_0x33c28a['emit'](_0xa531('0x49'),{'ChatInteractionId':Number(_0x4373ff[_0x5f84c2]),'UserId':Number(_0x1bed18['id'])});}});}})[_0xa531('0xa')](function(){if(_0x25a808===_0xa531('0x47')){var _0x13f8c4=_['map'](_0x1bed18['MailInteractions'],'id');return _0x1bed18['removeMailInteractions'](_0x13f8c4)['then'](function(){for(var _0x5a0847=0x0;_0x5a0847<_0x13f8c4[_0xa531('0x1e')];_0x5a0847+=0x1){_0x33c28a[_0xa531('0x4a')](_0xa531('0x4b'),{'MailInteractionId':Number(_0x13f8c4[_0x5a0847]),'UserId':Number(_0x1bed18['id'])});}});}})[_0xa531('0xa')](function(){if(_0x25a808===_0xa531('0x47')){var _0x2dbcd0=_['map'](_0x1bed18[_0xa531('0x27')],'id');return _0x1bed18[_0xa531('0x4c')](_0x2dbcd0)[_0xa531('0xa')](function(){for(var _0x390b91=0x0;_0x390b91<_0x2dbcd0[_0xa531('0x1e')];_0x390b91+=0x1){_0x33c28a['emit'](_0xa531('0x4d'),{'FaxInteractionId':Number(_0x2dbcd0[_0x390b91]),'UserId':Number(_0x1bed18['id'])});}});}})[_0xa531('0xa')](function(){if(_0x25a808===_0xa531('0x47')){var _0x217caa=_[_0xa531('0x18')](_0x1bed18[_0xa531('0x28')],'id');return _0x1bed18['removeSmsInteractions'](_0x217caa)[_0xa531('0xa')](function(){for(var _0x369696=0x0;_0x369696<_0x217caa['length'];_0x369696+=0x1){_0x33c28a[_0xa531('0x4a')](_0xa531('0x4e'),{'SmsInteractionId':Number(_0x217caa[_0x369696]),'UserId':Number(_0x1bed18['id'])});}});}})[_0xa531('0xa')](function(){if(_0x25a808==='leave'){var _0x24e865=_[_0xa531('0x18')](_0x1bed18[_0xa531('0x2a')],'id');return _0x1bed18['removeOpenchannelInteractions'](_0x24e865)[_0xa531('0xa')](function(){for(var _0x23beb9=0x0;_0x23beb9<_0x24e865[_0xa531('0x1e')];_0x23beb9+=0x1){_0x33c28a['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x24e865[_0x23beb9]),'UserId':Number(_0x1bed18['id'])});}});}})['then'](function(){if(_0x25a808===_0xa531('0x47')){var _0x1343f5=_[_0xa531('0x18')](_0x1bed18[_0xa531('0x4f')],'id');return _0x1bed18[_0xa531('0x50')](_0x1343f5)[_0xa531('0xa')](function(){for(var _0x348c96=0x0;_0x348c96<_0x1343f5[_0xa531('0x1e')];_0x348c96+=0x1){_0x33c28a[_0xa531('0x4a')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x1343f5[_0x348c96]),'UserId':Number(_0x1bed18['id'])});}});}})['catch'](function(_0x5449dc){_0x12a3c3[_0xa531('0x51')](_0x5449dc);});}}function onDisconnect(_0x31c57f,_0x316215){joinOrLeave(_0x31c57f,_0xa531('0x47'),_0x316215);}function onConnect(_0x3ec7e8){joinOrLeave(_0x3ec7e8,_0xa531('0x52'));}exports['default']=function(_0x1f8395){_0x1f8395['on']('connection',function(_0x4c4c08){_0x4c4c08['setMaxListeners'](0x0);_0x4c4c08['address']=_0x4c4c08[_0xa531('0x53')][_0xa531('0x54')]['remoteAddress']+':'+_0x4c4c08['request']['connection'][_0xa531('0x55')];_0x4c4c08[_0xa531('0x56')]=new Date();_0x4c4c08[_0xa531('0x51')]=function(_0x474d73){console['log'](_0xa531('0x57')+_0x4c4c08[_0xa531('0x58')]['name']+'['+_0x4c4c08[_0xa531('0x59')]+']',_0x474d73);};_0x4c4c08['on']('disconnect',function(){onDisconnect(_0x4c4c08,_0x1f8395);_0x4c4c08['log'](_0xa531('0x5a'));});onConnect(_0x4c4c08);_0x4c4c08['log'](_0xa531('0x5b'));});}; \ No newline at end of file +var _0x4f61=['getOpenchannelQueues','getWhatsappQueues','all','chat','fax','sms','mail','openchannel','whatsapp','format','trunk:%s','campaign:%s:%s','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','leave','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','address','request','connection','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','name','User','role','agent','telephone','type','ivr','UserProfileSection','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','map','where','Campaign','%s:queue:%s','Agents','length','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','push','ChatQueue','FaxQueue','MailQueue','WhatsappQueue','Trunk','user','voice:inbound','VoiceQueue','OpenchannelQueues','OpenchannelQueue','IvrCampaigns','getFaxQueues','getSmsQueues','getMailQueues'];(function(_0x24ad8c,_0x526e8d){var _0x389053=function(_0x50b662){while(--_0x50b662){_0x24ad8c['push'](_0x24ad8c['shift']());}};_0x389053(++_0x526e8d);}(_0x4f61,0x149));var _0x14f6=function(_0x5ae692,_0x631e92){_0x5ae692=_0x5ae692-0x0;var _0x2d9609=_0x4f61[_0x5ae692];return _0x2d9609;};'use strict';var _=require(_0x14f6('0x0'));var util=require(_0x14f6('0x1'));var BPromise=require(_0x14f6('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x14f6('0x3'));var queryQueues={'attributes':['id',_0x14f6('0x4')],'include':[{'as':'Agents','model':db[_0x14f6('0x5')],'attributes':['id',_0x14f6('0x4'),_0x14f6('0x6')],'raw':!![],'where':{'role':_0x14f6('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x14f6('0x4')],'where':{'role':_0x14f6('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x14f6('0x4')],'where':{'role':_0x14f6('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x14f6('0x4'),_0x14f6('0x9')],'where':{'type':_0x14f6('0xa')}};function getAssociatedResources(_0x50344c,_0x39feb6,_0x1b7c50){return db[_0x14f6('0xb')]['findOne']({'where':{'name':_0x50344c,'userProfileId':_0x39feb6},'raw':!![]})[_0x14f6('0xc')](function(_0x45cbd3){if(_0x45cbd3){if(_0x45cbd3['autoAssociation']){switch(_0x50344c){case _0x14f6('0xd'):case _0x14f6('0xe'):case _0x14f6('0xf'):case _0x14f6('0x10'):case _0x14f6('0x11'):case'OpenchannelQueues':case _0x14f6('0x12'):return db[_0x1b7c50][_0x14f6('0x13')](queryQueues);case _0x14f6('0x14'):return db[_0x1b7c50][_0x14f6('0x13')](queryTelephones);case _0x14f6('0x15'):return db[_0x1b7c50][_0x14f6('0x13')](queryTrunks);case'IvrCampaigns':return db[_0x1b7c50][_0x14f6('0x13')](queryCampaigns);}}else{return db[_0x14f6('0x16')]['findAll']({'attributes':[_0x14f6('0x17')],'where':{'sectionId':_0x45cbd3['id']},'raw':!![]})[_0x14f6('0xc')](function(_0x305f24){if(_0x305f24){var _0x24f3d8={'where':{'id':_[_0x14f6('0x18')](_0x305f24,_0x14f6('0x17'))},'raw':!![]};switch(_0x1b7c50){case _0x14f6('0x5'):_0x24f3d8[_0x14f6('0x19')][_0x14f6('0x6')]=_0x14f6('0x8');break;case _0x14f6('0x1a'):_0x24f3d8['where'][_0x14f6('0x9')]=_0x14f6('0xa');break;}return db[_0x1b7c50][_0x14f6('0x13')](_0x24f3d8);}else{return[];}});}}else{return[];}})[_0x14f6('0xc')](function(_0x4fd7b1){return _0x4fd7b1;});}function joinOrLeaveQueues(_0x4d8ae6,_0x59f56c,_0x16a9b8,_0x1dae57){_0x4d8ae6[_0x59f56c](util['format'](_0x14f6('0x1b'),_0x16a9b8,_0x1dae57[_0x14f6('0x4')]));if(_0x1dae57[_0x14f6('0x1c')]){for(var _0xd47ce8=0x0;_0xd47ce8<_0x1dae57['Agents'][_0x14f6('0x1d')];_0xd47ce8+=0x1){_0x4d8ae6[_0x59f56c](util['format'](_0x14f6('0x1e'),_0x1dae57[_0x14f6('0x1c')][_0xd47ce8]['name']));}}}function joinOrLeave(_0x427245,_0x4c2935,_0x336956){var _0x4914d9;if(_0x427245[_0x14f6('0x1f')][_0x14f6('0x20')]['id']){db[_0x14f6('0x5')]['find']({'attributes':['id','name',_0x14f6('0x6'),_0x14f6('0x21')],'where':{'id':_0x427245['handshake']['query']['id']},'include':[{'model':db[_0x14f6('0x22')],'as':_0x14f6('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x14f6('0x24')],'as':_0x14f6('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x14f6('0x26')],'as':_0x14f6('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x14f6('0x28')],'as':_0x14f6('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x14f6('0x2a')],'as':_0x14f6('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x14f6('0x2c')],'as':_0x14f6('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x14f6('0xc')](function(_0x4fb81d){if(_0x4fb81d){_0x4914d9=_0x4fb81d;_0x427245[_0x4c2935](util['format']('user:%s',_0x4fb81d[_0x14f6('0x4')]));var _0x3481ba=[];switch(_0x4fb81d['role']){case _0x14f6('0x2e'):_0x427245[_0x4c2935]('voice:inbound');_0x427245[_0x4c2935](_0x14f6('0x2f'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues['include'];}_0x3481ba[_0x14f6('0x30')](db['VoiceQueue']['findAll'](queryQueues));_0x3481ba[_0x14f6('0x30')](db[_0x14f6('0x31')]['findAll'](queryQueues));_0x3481ba[_0x14f6('0x30')](db[_0x14f6('0x32')][_0x14f6('0x13')](queryQueues));_0x3481ba[_0x14f6('0x30')](db['SmsQueue'][_0x14f6('0x13')](queryQueues));_0x3481ba[_0x14f6('0x30')](db[_0x14f6('0x33')][_0x14f6('0x13')](queryQueues));_0x3481ba[_0x14f6('0x30')](db['OpenchannelQueue']['findAll'](queryQueues));_0x3481ba[_0x14f6('0x30')](db[_0x14f6('0x34')][_0x14f6('0x13')](queryQueues));_0x3481ba[_0x14f6('0x30')](db[_0x14f6('0x5')]['findAll'](queryTelephones));_0x3481ba[_0x14f6('0x30')](db[_0x14f6('0x35')]['findAll'](queryTrunks));_0x3481ba[_0x14f6('0x30')](db['Campaign']['findAll'](queryCampaigns));_0x3481ba[_0x14f6('0x30')](db[_0x14f6('0x5')][_0x14f6('0x13')](queryAgents));break;case _0x14f6('0x36'):_0x427245[_0x4c2935](_0x14f6('0x37'));_0x427245[_0x4c2935](_0x14f6('0x2f'));_0x3481ba['push'](getAssociatedResources(_0x14f6('0xd'),_0x4fb81d[_0x14f6('0x21')],_0x14f6('0x38')));_0x3481ba[_0x14f6('0x30')](getAssociatedResources(_0x14f6('0xe'),_0x4fb81d[_0x14f6('0x21')],_0x14f6('0x31')));_0x3481ba[_0x14f6('0x30')](getAssociatedResources(_0x14f6('0xf'),_0x4fb81d[_0x14f6('0x21')],_0x14f6('0x32')));_0x3481ba[_0x14f6('0x30')](getAssociatedResources(_0x14f6('0x10'),_0x4fb81d[_0x14f6('0x21')],'SmsQueue'));_0x3481ba[_0x14f6('0x30')](getAssociatedResources('MailQueues',_0x4fb81d[_0x14f6('0x21')],'MailQueue'));_0x3481ba[_0x14f6('0x30')](getAssociatedResources(_0x14f6('0x39'),_0x4fb81d['userProfileId'],_0x14f6('0x3a')));_0x3481ba[_0x14f6('0x30')](getAssociatedResources(_0x14f6('0x12'),_0x4fb81d[_0x14f6('0x21')],_0x14f6('0x34')));_0x3481ba['push'](getAssociatedResources(_0x14f6('0x14'),_0x4fb81d[_0x14f6('0x21')],_0x14f6('0x5')));_0x3481ba[_0x14f6('0x30')](getAssociatedResources(_0x14f6('0x15'),_0x4fb81d['userProfileId'],'Trunk'));_0x3481ba['push'](getAssociatedResources(_0x14f6('0x3b'),_0x4fb81d[_0x14f6('0x21')],_0x14f6('0x1a')));_0x3481ba[_0x14f6('0x30')](db[_0x14f6('0x5')][_0x14f6('0x13')](queryAgents));break;case _0x14f6('0x7'):_0x427245[_0x4c2935](_0x14f6('0x37'));_0x427245[_0x4c2935]('voice:outbound');_0x3481ba[_0x14f6('0x30')](_0x4fb81d['getVoiceQueues']({'attributes':['id',_0x14f6('0x4')]}));_0x3481ba[_0x14f6('0x30')](_0x4fb81d['getChatQueues']({'attributes':['id',_0x14f6('0x4')]}));_0x3481ba[_0x14f6('0x30')](_0x4fb81d[_0x14f6('0x3c')]({'attributes':['id','name']}));_0x3481ba[_0x14f6('0x30')](_0x4fb81d[_0x14f6('0x3d')]({'attributes':['id',_0x14f6('0x4')]}));_0x3481ba['push'](_0x4fb81d[_0x14f6('0x3e')]({'attributes':['id','name']}));_0x3481ba[_0x14f6('0x30')](_0x4fb81d[_0x14f6('0x3f')]({'attributes':['id',_0x14f6('0x4')]}));_0x3481ba[_0x14f6('0x30')](_0x4fb81d[_0x14f6('0x40')]({'attributes':['id',_0x14f6('0x4')]}));break;}return BPromise[_0x14f6('0x41')](_0x3481ba);}})['then'](function(_0x5ce88d){if(_0x5ce88d&&_0x5ce88d[_0x14f6('0x1d')]){for(var _0x28950b=0x0;_0x28950b<_0x5ce88d[_0x14f6('0x1d')];_0x28950b+=0x1){for(var _0x52a436=0x0;_0x52a436<_0x5ce88d[_0x28950b][_0x14f6('0x1d')];_0x52a436+=0x1){switch(_0x28950b){case 0x0:joinOrLeaveQueues(_0x427245,_0x4c2935,'voice',_0x5ce88d[_0x28950b][_0x52a436]);break;case 0x1:joinOrLeaveQueues(_0x427245,_0x4c2935,_0x14f6('0x42'),_0x5ce88d[_0x28950b][_0x52a436]);break;case 0x2:joinOrLeaveQueues(_0x427245,_0x4c2935,_0x14f6('0x43'),_0x5ce88d[_0x28950b][_0x52a436]);break;case 0x3:joinOrLeaveQueues(_0x427245,_0x4c2935,_0x14f6('0x44'),_0x5ce88d[_0x28950b][_0x52a436]);break;case 0x4:joinOrLeaveQueues(_0x427245,_0x4c2935,_0x14f6('0x45'),_0x5ce88d[_0x28950b][_0x52a436]);break;case 0x5:joinOrLeaveQueues(_0x427245,_0x4c2935,_0x14f6('0x46'),_0x5ce88d[_0x28950b][_0x52a436]);break;case 0x6:joinOrLeaveQueues(_0x427245,_0x4c2935,_0x14f6('0x47'),_0x5ce88d[_0x28950b][_0x52a436]);break;case 0x7:if(_0x4914d9[_0x14f6('0x6')]!==_0x14f6('0x7'))_0x427245[_0x4c2935](util[_0x14f6('0x48')]('telephone:%s',_0x5ce88d[_0x28950b][_0x52a436]['name']));break;case 0x8:if(_0x4914d9[_0x14f6('0x6')]!==_0x14f6('0x7'))_0x427245[_0x4c2935](util[_0x14f6('0x48')](_0x14f6('0x49'),_0x5ce88d[_0x28950b][_0x52a436][_0x14f6('0x4')]));break;case 0x9:if(_0x4914d9['role']!==_0x14f6('0x7'))_0x427245[_0x4c2935](util[_0x14f6('0x48')](_0x14f6('0x4a'),_0x5ce88d[_0x28950b][_0x52a436][_0x14f6('0x9')],_0x5ce88d[_0x28950b][_0x52a436][_0x14f6('0x4')]));break;case 0xa:_0x427245[_0x4c2935](util['format'](_0x14f6('0x1e'),_0x5ce88d[_0x28950b][_0x52a436]['name']));break;}}}}})['then'](function(){if(_0x4c2935==='leave'){var _0x42edbe=_[_0x14f6('0x18')](_0x4914d9[_0x14f6('0x23')],'id');return _0x4914d9[_0x14f6('0x4b')](_0x42edbe)[_0x14f6('0xc')](function(){for(var _0x3429dd=0x0;_0x3429dd<_0x42edbe['length'];_0x3429dd+=0x1){_0x336956['emit'](_0x14f6('0x4c'),{'ChatInteractionId':Number(_0x42edbe[_0x3429dd]),'UserId':Number(_0x4914d9['id'])});}});}})[_0x14f6('0xc')](function(){if(_0x4c2935==='leave'){var _0x8348b2=_['map'](_0x4914d9[_0x14f6('0x25')],'id');return _0x4914d9[_0x14f6('0x4d')](_0x8348b2)[_0x14f6('0xc')](function(){for(var _0x53e14d=0x0;_0x53e14d<_0x8348b2[_0x14f6('0x1d')];_0x53e14d+=0x1){_0x336956[_0x14f6('0x4e')](_0x14f6('0x4f'),{'MailInteractionId':Number(_0x8348b2[_0x53e14d]),'UserId':Number(_0x4914d9['id'])});}});}})['then'](function(){if(_0x4c2935===_0x14f6('0x50')){var _0x1cdd15=_[_0x14f6('0x18')](_0x4914d9[_0x14f6('0x27')],'id');return _0x4914d9[_0x14f6('0x51')](_0x1cdd15)['then'](function(){for(var _0x3cb064=0x0;_0x3cb064<_0x1cdd15[_0x14f6('0x1d')];_0x3cb064+=0x1){_0x336956[_0x14f6('0x4e')](_0x14f6('0x52'),{'FaxInteractionId':Number(_0x1cdd15[_0x3cb064]),'UserId':Number(_0x4914d9['id'])});}});}})[_0x14f6('0xc')](function(){if(_0x4c2935===_0x14f6('0x50')){var _0x113f36=_['map'](_0x4914d9['SmsInteractions'],'id');return _0x4914d9[_0x14f6('0x53')](_0x113f36)[_0x14f6('0xc')](function(){for(var _0x2a0595=0x0;_0x2a0595<_0x113f36['length'];_0x2a0595+=0x1){_0x336956[_0x14f6('0x4e')](_0x14f6('0x54'),{'SmsInteractionId':Number(_0x113f36[_0x2a0595]),'UserId':Number(_0x4914d9['id'])});}});}})[_0x14f6('0xc')](function(){if(_0x4c2935===_0x14f6('0x50')){var _0x516d24=_[_0x14f6('0x18')](_0x4914d9[_0x14f6('0x2b')],'id');return _0x4914d9['removeOpenchannelInteractions'](_0x516d24)[_0x14f6('0xc')](function(){for(var _0x58bc7a=0x0;_0x58bc7a<_0x516d24['length'];_0x58bc7a+=0x1){_0x336956[_0x14f6('0x4e')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x516d24[_0x58bc7a]),'UserId':Number(_0x4914d9['id'])});}});}})[_0x14f6('0xc')](function(){if(_0x4c2935===_0x14f6('0x50')){var _0x450cb4=_['map'](_0x4914d9['WhatsappInteractions'],'id');return _0x4914d9[_0x14f6('0x55')](_0x450cb4)[_0x14f6('0xc')](function(){for(var _0x46c891=0x0;_0x46c891<_0x450cb4['length'];_0x46c891+=0x1){_0x336956['emit'](_0x14f6('0x56'),{'WhatsappInteractionId':Number(_0x450cb4[_0x46c891]),'UserId':Number(_0x4914d9['id'])});}});}})['catch'](function(_0x48a14d){_0x427245['log'](_0x48a14d);});}}function onDisconnect(_0x3807b2,_0x295ea9){joinOrLeave(_0x3807b2,_0x14f6('0x50'),_0x295ea9);}function onConnect(_0x38e733){joinOrLeave(_0x38e733,'join');}exports['default']=function(_0x3e65db){_0x3e65db['on']('connection',function(_0x228fb9){_0x228fb9['setMaxListeners'](0x0);_0x228fb9[_0x14f6('0x57')]=_0x228fb9[_0x14f6('0x58')][_0x14f6('0x59')][_0x14f6('0x5a')]+':'+_0x228fb9[_0x14f6('0x58')][_0x14f6('0x59')][_0x14f6('0x5b')];_0x228fb9[_0x14f6('0x5c')]=new Date();_0x228fb9[_0x14f6('0x5d')]=function(_0x483d12){console[_0x14f6('0x5d')](_0x14f6('0x5e')+_0x228fb9[_0x14f6('0x5f')][_0x14f6('0x4')]+'['+_0x228fb9[_0x14f6('0x57')]+']',_0x483d12);};_0x228fb9['on']('disconnect',function(){onDisconnect(_0x228fb9,_0x3e65db);_0x228fb9[_0x14f6('0x5d')](_0x14f6('0x60'));});onConnect(_0x228fb9);_0x228fb9[_0x14f6('0x5d')](_0x14f6('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 65a8213..ca3d317 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 _0xf061=['../../mysqldb','jayson/promise','triggers','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','Sms','SmsInteraction','closedinteraction','newmessage','Whatsapp','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','info','Trigger,\x20%s','error','code','catch','get','channel','event','direction','UserId','name','interface','format','outgoingmessage','opened','changed','closed','User','find','then','SIP/%s','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util'];(function(_0x23884b,_0x50c307){var _0x28113b=function(_0xce3fea){while(--_0xce3fea){_0x23884b['push'](_0x23884b['shift']());}};_0x28113b(++_0x50c307);}(_0xf061,0x180));var _0x1f06=function(_0x28d763,_0x5b13c2){_0x28d763=_0x28d763-0x0;var _0x313b05=_0xf061[_0x28d763];return _0x313b05;};'use strict';var util=require(_0x1f06('0x0'));var db=require(_0x1f06('0x1'))['db'];var jayson=require(_0x1f06('0x2'));var logger=require('../logger')(_0x1f06('0x3'));var client=jayson['client'][_0x1f06('0x4')]({'port':0x232a});var triggers=[{'channel':_0x1f06('0x5'),'model':_0x1f06('0x6'),'event':_0x1f06('0x7'),'condition':_0x1f06('0x8'),'callback':afterCreate},{'channel':'Chat','model':_0x1f06('0x6'),'event':_0x1f06('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':_0x1f06('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Sms','model':'SmsInteraction','event':_0x1f06('0x7'),'condition':_0x1f06('0x8'),'callback':afterCreate},{'channel':_0x1f06('0xa'),'model':_0x1f06('0xb'),'event':_0x1f06('0x9'),'condition':_0x1f06('0xc'),'callback':afterUpdate},{'channel':_0x1f06('0xa'),'model':'SmsMessage','event':_0x1f06('0x7'),'condition':_0x1f06('0xd'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0x1f06('0x7'),'condition':_0x1f06('0x8'),'callback':afterCreate},{'channel':_0x1f06('0xe'),'model':'WhatsappInteraction','event':_0x1f06('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1f06('0xe'),'model':'WhatsappMessage','event':_0x1f06('0x7'),'condition':_0x1f06('0xd'),'callback':afterCreateMessage},{'channel':_0x1f06('0xf'),'model':_0x1f06('0x10'),'event':_0x1f06('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x1f06('0xf'),'model':'FaxInteraction','event':_0x1f06('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1f06('0xf'),'model':_0x1f06('0x11'),'event':_0x1f06('0x7'),'condition':_0x1f06('0xd'),'callback':afterCreateMessage},{'channel':_0x1f06('0x12'),'model':'MailInteraction','event':'afterCreate','condition':_0x1f06('0x8'),'callback':afterCreate},{'channel':_0x1f06('0x12'),'model':_0x1f06('0x13'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1f06('0x12'),'model':_0x1f06('0x14'),'event':_0x1f06('0x7'),'condition':_0x1f06('0xd'),'callback':afterCreateMessage},{'channel':_0x1f06('0x15'),'model':_0x1f06('0x16'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x1f06('0x15'),'model':_0x1f06('0x16'),'event':_0x1f06('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Openchannel','model':_0x1f06('0x17'),'event':_0x1f06('0x7'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x6a5c2c){return client[_0x1f06('0x18')](_0x1f06('0x19'),_0x6a5c2c)['then'](function(_0x3027d4){logger[_0x1f06('0x1a')](_0x1f06('0x1b'),'EventManager',_0x3027d4);if(_0x3027d4[_0x1f06('0x1c')]){if(_0x3027d4['error'][_0x1f06('0x1d')]===0x1f4){logger[_0x1f06('0x1c')](_0x1f06('0x1b'),'EventManager',_0x3027d4[_0x1f06('0x1c')]);}}})[_0x1f06('0x1e')](function(_0x83c1bf){logger[_0x1f06('0x1c')](_0x1f06('0x1b'),_0x1f06('0x19'),_0x83c1bf);});}function afterCreateMessage(_0x18aea9,_0x9b1f55){return function(_0x378821,_0x15e22f){_0x378821=_0x378821[_0x1f06('0x1f')]({'plain':!![]});_0x378821[_0x1f06('0x20')]=_0x18aea9;_0x378821[_0x1f06('0x21')]=_0x378821[_0x1f06('0x22')];if(_0x378821[_0x1f06('0x23')]){return db['User']['find']({'where':{'id':_0x378821[_0x1f06('0x23')]},'attributes':['id',_0x1f06('0x24')],'raw':!![]})['then'](function(_0x3b1114){_0x378821[_0x1f06('0x25')]=util[_0x1f06('0x26')]('SIP/%s',_0x3b1114[_0x1f06('0x24')]);_0x378821[_0x1f06('0x20')]=_0x18aea9;return request({'event':'incomingmessage','message':_0x378821});})[_0x1f06('0x1e')](function(_0x42a944){console[_0x1f06('0x1c')](_0x42a944);});}else{return request({'event':_0x1f06('0x27'),'message':_0x378821});}};}function afterCreate(_0x3f9f78,_0x40e52f){return function(_0x4c70a0,_0x473699){_0x4c70a0=_0x4c70a0['get']({'plain':!![]});_0x4c70a0[_0x1f06('0x20')]=_0x3f9f78;_0x4c70a0['event']=_0x1f06('0x28');return request({'event':_0x40e52f,'message':_0x4c70a0});};}function afterUpdate(_0x31f043,_0x10b29a){return function(_0x48024d,_0x209a35){if(_0x48024d[_0x1f06('0x29')](_0x1f06('0x2a'))&&_0x48024d[_0x1f06('0x2a')]){_0x48024d=_0x48024d[_0x1f06('0x1f')]({'plain':!![]});_0x48024d[_0x1f06('0x20')]=_0x31f043;_0x48024d[_0x1f06('0x21')]=_0x1f06('0x2a');if(_0x48024d['UserId']){return db[_0x1f06('0x2b')][_0x1f06('0x2c')]({'where':{'id':_0x48024d[_0x1f06('0x23')]},'attributes':['id',_0x1f06('0x24')],'raw':!![]})[_0x1f06('0x2d')](function(_0x507314){_0x48024d[_0x1f06('0x25')]=util[_0x1f06('0x26')](_0x1f06('0x2e'),_0x507314[_0x1f06('0x24')]);return request({'event':_0x10b29a,'message':_0x48024d});})[_0x1f06('0x1e')](function(_0x528932){console[_0x1f06('0x1c')](_0x528932);});}else{return request({'event':_0x10b29a,'message':_0x48024d});}}};}exports[_0x1f06('0x2f')]=function(){for(var _0x3e6035=0x0;_0x3e6035=_0x47765b['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x75bea4(_0x1e0396);})[_0x4947('0x16')](function(_0x6ddd63){_0x4233f7(_0x6ddd63);});});}; \ No newline at end of file +var _0x36a5=['agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','voice','mail','chat','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','isUndefined','blockedAt','updateAttributes','getLicense','role','User','count','agent','then'];(function(_0x529679,_0x37cc2f){var _0x4012ce=function(_0x58577f){while(--_0x58577f){_0x529679['push'](_0x529679['shift']());}};_0x4012ce(++_0x37cc2f);}(_0x36a5,0x17a));var _0x536a=function(_0x51d82a,_0x332276){_0x51d82a=_0x51d82a-0x0;var _0x559202=_0x36a5[_0x51d82a];return _0x559202;};'use strict';var _=require(_0x536a('0x0'));var BPromise=require('bluebird');var db=require(_0x536a('0x1'))['db'];var util=require(_0x536a('0x2'));var channels=[_0x536a('0x3'),_0x536a('0x4'),_0x536a('0x5'),'fax',_0x536a('0x6'),_0x536a('0x7'),_0x536a('0x8')];exports[_0x536a('0x9')]=function(){return channels;};exports[_0x536a('0xa')]=function(_0x61eb72){_0x61eb72=_0x61eb72[_0x536a('0xb')]();return _[_0x536a('0xc')](channels,_0x61eb72);};exports['clearBlockUser']=function(_0x12cd3a,_0x4c7ea7,_0x24102a,_0xf8fcdc){var _0x1fc5f4={'loginAttempts':_0x4c7ea7,'blocked':_0x24102a};if(!_[_0x536a('0xd')](_0xf8fcdc)){_0x1fc5f4[_0x536a('0xe')]=_0xf8fcdc;}return _0x12cd3a[_0x536a('0xf')](_0x1fc5f4);};exports[_0x536a('0x10')]=function(_0x3bf7de){return new BPromise(function(_0x27a85b,_0x4701d2){var _0x318858=0x0;if(_0x3bf7de[_0x536a('0x11')]!=='agent'){_0x27a85b(_0x3bf7de);}db[_0x536a('0x12')][_0x536a('0x13')]({'where':{'role':_0x536a('0x14'),'online':!![],'id':{'$ne':_0x3bf7de['id']}}})[_0x536a('0x15')](function(_0xb35e98){_0x318858=_0xb35e98;return util[_0x536a('0x10')]();})[_0x536a('0x15')](function(_0x4eb7f7){if(_0x4eb7f7&&_0x4eb7f7[_0x536a('0x16')]&&_0x318858>=_0x4eb7f7[_0x536a('0x16')]){throw Error(_0x536a('0x17'));}_0x27a85b(_0x3bf7de);})[_0x536a('0x18')](function(_0x1335c7){_0x4701d2(_0x1335c7);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 60dbc93..fdfa92f 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8059=['send','exports','status'];(function(_0xebf04,_0x4eba3c){var _0x3c2286=function(_0x9b4127){while(--_0x9b4127){_0xebf04['push'](_0xebf04['shift']());}};_0x3c2286(++_0x4eba3c);}(_0x8059,0x97));var _0x9805=function(_0x51a85c,_0x2660a3){_0x51a85c=_0x51a85c-0x0;var _0x55001f=_0x8059[_0x51a85c];return _0x55001f;};'use strict';module[_0x9805('0x0')][0x194]=function pageNotFound(_0x41e676,_0x57f8b3){var _0x1a35e2='404';var _0x3b5acd=0x194;var _0x23787b={'status':_0x3b5acd};_0x57f8b3[_0x9805('0x1')](_0x23787b['status']);_0x57f8b3['render'](_0x1a35e2,{},function(_0x84eba0,_0x22979c){if(_0x84eba0){return _0x57f8b3[_0x9805('0x1')](_0x23787b['status'])['json'](_0x23787b);}_0x57f8b3[_0x9805('0x2')](_0x22979c);});}; \ No newline at end of file +var _0xd769=['status','render','json','send','exports','404'];(function(_0x3ad321,_0x3dc523){var _0xe3724b=function(_0x58941d){while(--_0x58941d){_0x3ad321['push'](_0x3ad321['shift']());}};_0xe3724b(++_0x3dc523);}(_0xd769,0x12a));var _0x9d76=function(_0x1ca761,_0x341ed6){_0x1ca761=_0x1ca761-0x0;var _0x25104e=_0xd769[_0x1ca761];return _0x25104e;};'use strict';module[_0x9d76('0x0')][0x194]=function pageNotFound(_0x39f947,_0xcba1ea){var _0x439592=_0x9d76('0x1');var _0x478904=0x194;var _0x36c9bb={'status':_0x478904};_0xcba1ea['status'](_0x36c9bb[_0x9d76('0x2')]);_0xcba1ea[_0x9d76('0x3')](_0x439592,{},function(_0x3dfdc3,_0x1cd727){if(_0x3dfdc3){return _0xcba1ea[_0x9d76('0x2')](_0x36c9bb[_0x9d76('0x2')])[_0x9d76('0x4')](_0x36c9bb);}_0xcba1ea[_0x9d76('0x5')](_0x1cd727);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 3c6c432..d2a6be2 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd82a=['ZendeskAccount','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','UserId','hasMany','Recordings','CmHopperFinal','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','Lists','user_has_teams','user_has_chat_interactions','user_has_sms_interactions','WhatsappInteractions','user_has_whatsapp_interactions','ChatQueues','FaxQueue','FaxQueues','SmsQueues','UserOpenchannelQueue','WhatsappQueues','UserWhatsappQueue','cm_user_has_lists','VoicePrefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','cascade','ChanSpyId','Sounds','moh_has_sounds','VoiceQueueId','CmHopper','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkBackup','TrunkBackupId','Interval','IntervalId','voice_queues_has_cm_lists','Agents','Team','Teams','BlackLists','mailboxuser','mailbox','VoiceQueueReport','uniqueid','AgentReports','CmContact','Contact','ContactId','MailAccountId','Imap','Smtp','Disposition','Dispositions','Answers','Messages','ListId','Template','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','user_has_mail_accounts','MailInteractionId','Account','Tag','Tags','mail_interaction_has_tags','Users','user_has_mail_interactions','Attachments','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','List','DashboardItem','Items','FaxAccountId','Interactions','Applications','Exntensions','FaxInteractionId','Owner','fax_interaction_has_tags','ThroughTags','Interaction','AttachmentId','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelInteractionId','team_has_openchannel_queues','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatMessage','team_has_chat_queues','ChatGroupId','Members','CompanyId','Hoppers','Company','cm_user_has_contacts','Campaign','CampaignId','OwnerId','CmHopperBlack','Condition','OneAll','AutomationAllId','Any','Actions','AutomationId','ParentId','MailApplications','ChatApplications','SmsApplications','Schedule','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','cm_contact_has_tags','Trigger','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','SalesforceField','SubjectId','Descriptions','DescriptionId','AccountId','Subject','Description','FieldId','SugarcrmAccount','Subjects','Field','DeskField','int_desk_configuration_has_tags','VariableId','ZohoConfiguration','ZendeskField','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','ServicenowConfiguration','Dynamics365Account','ToId','SessionId','user_has_square_projects','VoiceQueues','team_has_mail_queues','team_has_fax_queues','OpenchannelQueues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Extensions','user_has_voice_prefixes','sectionId','WhatsappAccountId','WhatsappAccount','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','exports','path','../config/environment','sequelize','jstz','motion2','xcall','xC@LL1234','127.0.0.1','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','mysql','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/condition/condition.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','../api/sound/sound.model','../api/tag/tag.model','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','SugarcrmField','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd82a,0x14a));var _0xad82=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xd82a[_0x231e16];return _0x570a7c;};'use strict';var path=require(_0xad82('0x0'));var config=require(_0xad82('0x1'));var Sequelize=require(_0xad82('0x2'));var _=require('lodash');var jstz=require(_0xad82('0x3'));var timezone=jstz['determine']();config[_0xad82('0x2')]=_['defaultsDeep'](config[_0xad82('0x2')],{'database':_0xad82('0x4'),'username':_0xad82('0x5'),'password':_0xad82('0x6'),'options':{'host':_0xad82('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xad82('0x8')](),'define':{'charset':_0xad82('0x9'),'collate':_0xad82('0xa')}}});config[_0xad82('0xb')]=_[_0xad82('0xc')](config['sequelizeHistory'],{'database':'motion2','username':_0xad82('0x5'),'password':_0xad82('0x6'),'options':{'host':_0xad82('0x7'),'port':0xcea,'dialect':_0xad82('0xd'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xad82('0x8')](),'define':{'charset':_0xad82('0x9'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xad82('0x2')][_0xad82('0xe')],config[_0xad82('0x2')][_0xad82('0xf')],config[_0xad82('0x2')][_0xad82('0x10')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xad82('0xe')],config[_0xad82('0xb')]['username'],config['sequelizeHistory'][_0xad82('0x10')],config['sequelizeHistory'][_0xad82('0x11')])};db[_0xad82('0x12')]=db['sequelize'][_0xad82('0x13')](_0xad82('0x14'));db[_0xad82('0x15')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xad82('0x16')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x17'));db[_0xad82('0x18')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0xad82('0x19')]=db['sequelize'][_0xad82('0x13')](_0xad82('0x1a'));db[_0xad82('0x1b')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/voiceQueue/voiceQueue.model');db[_0xad82('0x1c')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x1d'));db[_0xad82('0x1e')]=db[_0xad82('0x2')]['import']('../api/screenRecording/screenRecording.model');db[_0xad82('0x1f')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x20'));db[_0xad82('0x21')]=db[_0xad82('0x2')]['import'](_0xad82('0x22'));db[_0xad82('0x23')]=db[_0xad82('0x2')]['import'](_0xad82('0x24'));db[_0xad82('0x25')]=db['sequelize'][_0xad82('0x13')](_0xad82('0x26'));db[_0xad82('0x27')]=db['sequelize'][_0xad82('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0xad82('0x2')]['import'](_0xad82('0x28'));db[_0xad82('0x29')]=db[_0xad82('0x2')]['import'](_0xad82('0x2a'));db[_0xad82('0x2b')]=db['sequelize'][_0xad82('0x13')](_0xad82('0x2c'));db['VoiceTransferReport']=db[_0xad82('0x2')]['import'](_0xad82('0x2d'));db[_0xad82('0x2e')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x2f'));db[_0xad82('0x30')]=db[_0xad82('0x2')]['import'](_0xad82('0x31'));db[_0xad82('0x32')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x33'));db[_0xad82('0x34')]=db[_0xad82('0x2')]['import']('../api/userMailQueue/userMailQueue.model');db[_0xad82('0x35')]=db['sequelize'][_0xad82('0x13')](_0xad82('0x36'));db[_0xad82('0x37')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x38'));db['UserOpenchannelQueue']=db[_0xad82('0x2')][_0xad82('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db[_0xad82('0x2')][_0xad82('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xad82('0x39')]=db['sequelize']['import']('../api/mailServerIn/mailServerIn.model');db[_0xad82('0x3a')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x3b'));db['MailAccount']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x3c'));db[_0xad82('0x3d')]=db['sequelize']['import'](_0xad82('0x3e'));db[_0xad82('0x3f')]=db['sequelize'][_0xad82('0x13')](_0xad82('0x40'));db[_0xad82('0x41')]=db['sequelize'][_0xad82('0x13')](_0xad82('0x42'));db[_0xad82('0x43')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x44'));db[_0xad82('0x45')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/mailApplication/mailApplication.model');db[_0xad82('0x46')]=db[_0xad82('0x2')]['import'](_0xad82('0x47'));db['Dashboard']=db['sequelize']['import'](_0xad82('0x48'));db['DashboardItem']=db['sequelize'][_0xad82('0x13')](_0xad82('0x49'));db[_0xad82('0x4a')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/faxAccount/faxAccount.model');db[_0xad82('0x4b')]=db['sequelize'][_0xad82('0x13')](_0xad82('0x4c'));db[_0xad82('0x4d')]=db['sequelize'][_0xad82('0x13')](_0xad82('0x4e'));db[_0xad82('0x4f')]=db['sequelize'][_0xad82('0x13')](_0xad82('0x50'));db['FaxQueue']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x51'));db[_0xad82('0x52')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x53'));db[_0xad82('0x54')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x55'));db[_0xad82('0x56')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x57'));db[_0xad82('0x58')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x59'));db[_0xad82('0x5a')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/smsMessage/smsMessage.model');db[_0xad82('0x5b')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x5c'));db[_0xad82('0x5d')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x5e'));db[_0xad82('0x5f')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x60'));db['OpenchannelInteraction']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x61'));db['OpenchannelMessage']=db[_0xad82('0x2')]['import'](_0xad82('0x62'));db[_0xad82('0x63')]=db[_0xad82('0x2')]['import'](_0xad82('0x64'));db[_0xad82('0x65')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x66'));db[_0xad82('0x67')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x68'));db[_0xad82('0x69')]=db['sequelize'][_0xad82('0x13')](_0xad82('0x6a'));db['ChatInteraction']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x6b'));db['ChatMessage']=db['sequelize'][_0xad82('0x13')](_0xad82('0x6c'));db[_0xad82('0x6d')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x6e'));db[_0xad82('0x6f')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x70'));db[_0xad82('0x71')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x72'));db[_0xad82('0x73')]=db['sequelize'][_0xad82('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xad82('0x74')]=db['sequelize'][_0xad82('0x13')](_0xad82('0x75'));db['CmContact']=db[_0xad82('0x2')]['import'](_0xad82('0x76'));db['CmHopper']=db[_0xad82('0x2')]['import'](_0xad82('0x77'));db['CmHopperBlack']=db[_0xad82('0x2')]['import'](_0xad82('0x78'));db['CmHopperFinal']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x79'));db[_0xad82('0x7a')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xad82('0x7b')]=db['sequelize'][_0xad82('0x13')](_0xad82('0x7c'));db['CmCustomField']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x7d'));db[_0xad82('0x7e')]=db[_0xad82('0x2')]['import']('../api/action/action.model');db[_0xad82('0x7f')]=db[_0xad82('0x2')]['import'](_0xad82('0x80'));db[_0xad82('0x81')]=db['sequelize'][_0xad82('0x13')](_0xad82('0x82'));db['Disposition']=db['sequelize'][_0xad82('0x13')]('../api/disposition/disposition.model');db['Condition']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x83'));db['Interval']=db[_0xad82('0x2')][_0xad82('0x13')]('../api/interval/interval.model');db[_0xad82('0x84')]=db[_0xad82('0x2')]['import'](_0xad82('0x85'));db[_0xad82('0x86')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x87'));db[_0xad82('0x88')]=db[_0xad82('0x2')]['import'](_0xad82('0x89'));db['Schedule']=db[_0xad82('0x2')][_0xad82('0x13')]('../api/schedule/schedule.model');db[_0xad82('0x8a')]=db['sequelize'][_0xad82('0x13')](_0xad82('0x8b'));db['Tag']=db['sequelize']['import'](_0xad82('0x8c'));db['Template']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x8d'));db['Trigger']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x8e'));db[_0xad82('0x8f')]=db['sequelize'][_0xad82('0x13')](_0xad82('0x90'));db[_0xad82('0x91')]=db['sequelize']['import']('../api/integration/integration.model');db[_0xad82('0x92')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x93'));db[_0xad82('0x94')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x95'));db[_0xad82('0x96')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xad82('0x97')]=db[_0xad82('0x2')]['import']('../api/analyticMetric/analyticMetric.model');db[_0xad82('0x98')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x99'));db[_0xad82('0x9a')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x9b'));db[_0xad82('0x9c')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x9d'));db[_0xad82('0x9e')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x9f'));db['SalesforceField']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xa0'));db['SugarcrmAccount']=db['sequelize'][_0xad82('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xad82('0xa1')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0xad82('0xa2')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xad82('0xa3')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0xad82('0xa4')]=db[_0xad82('0x2')]['import'](_0xad82('0xa5'));db['DeskField']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xa6'));db[_0xad82('0xa7')]=db['sequelize'][_0xad82('0x13')](_0xad82('0xa8'));db['ZohoConfiguration']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xa9'));db[_0xad82('0xaa')]=db['sequelize']['import'](_0xad82('0xab'));db[_0xad82('0xac')]=db[_0xad82('0x2')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0xad82('0xad')]=db['sequelize']['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db['sequelize']['import'](_0xad82('0xae'));db[_0xad82('0xaf')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0xad82('0x2')]['import'](_0xad82('0xb0'));db['FreshdeskField']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xb1'));db[_0xad82('0xb2')]=db[_0xad82('0x2')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0xad82('0xb3')]=db['sequelize']['import'](_0xad82('0xb4'));db[_0xad82('0xb5')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/intVtigerField/intVtigerField.model');db[_0xad82('0xb6')]=db[_0xad82('0x2')]['import'](_0xad82('0xb7'));db['ServicenowConfiguration']=db['sequelize'][_0xad82('0x13')](_0xad82('0xb8'));db[_0xad82('0xb9')]=db['sequelize']['import'](_0xad82('0xba'));db['Dynamics365Account']=db['sequelize']['import'](_0xad82('0xbb'));db[_0xad82('0xbc')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xbd'));db[_0xad82('0xbe')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xbf'));db[_0xad82('0xc0')]=db[_0xad82('0x2')]['import'](_0xad82('0xc1'));db[_0xad82('0xc2')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xc3'));db[_0xad82('0xc4')]=db['sequelize'][_0xad82('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xc5'));db[_0xad82('0xc6')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xc7'));db[_0xad82('0xc8')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xc9'));db[_0xad82('0xca')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xcb'));db[_0xad82('0xcc')]=db['sequelize'][_0xad82('0x13')](_0xad82('0xcd'));db[_0xad82('0xce')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xcf'));db[_0xad82('0xd0')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xd1'));db[_0xad82('0xd2')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xd3'));db[_0xad82('0xd4')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xd5'));db[_0xad82('0xd6')]=db[_0xad82('0x2')]['import'](_0xad82('0xd7'));db[_0xad82('0xd8')]=db['sequelize'][_0xad82('0x13')](_0xad82('0xd9'));db[_0xad82('0xda')]=db['sequelize']['import'](_0xad82('0xdb'));db[_0xad82('0xdc')]=db[_0xad82('0x2')]['import'](_0xad82('0xdd'));db[_0xad82('0xde')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0xad82('0x2')][_0xad82('0x13')]('../api/squareRecording/squareRecording.model');db[_0xad82('0xdf')]=db['sequelize']['import'](_0xad82('0xe0'));db['Team']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xe1'));db[_0xad82('0xe2')]=db[_0xad82('0x2')]['import'](_0xad82('0xe3'));db['Campaign']=db['sequelize'][_0xad82('0x13')](_0xad82('0xe4'));db[_0xad82('0xe5')]=db['sequelize'][_0xad82('0x13')](_0xad82('0xe6'));db[_0xad82('0xe7')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xe8'));db[_0xad82('0xe9')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xea'));db[_0xad82('0xeb')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xec'));db[_0xad82('0xed')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xee'));db['OpenchannelTransferReport']=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xef'));db[_0xad82('0xf0')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0xad82('0xf1')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xf2'));db[_0xad82('0xf3')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xf4'));db[_0xad82('0xf5')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xf6'));db[_0xad82('0xf7')]=db['sequelize'][_0xad82('0x13')](_0xad82('0xf8'));db[_0xad82('0xf9')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xfa'));db[_0xad82('0xfb')]=db[_0xad82('0x2')]['import'](_0xad82('0xfc'));db['WhatsappAccount']=db[_0xad82('0x2')][_0xad82('0x13')]('../api/whatsappAccount/whatsappAccount.model');db[_0xad82('0xfd')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0xfe'));db[_0xad82('0xff')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x100'));db[_0xad82('0x101')]=db[_0xad82('0x2')]['import'](_0xad82('0x102'));db[_0xad82('0x103')]=db[_0xad82('0x2')][_0xad82('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xad82('0x104')]=db['sequelize']['import'](_0xad82('0x105'));db[_0xad82('0x106')]=db[_0xad82('0x2')]['import'](_0xad82('0x107'));db[_0xad82('0x108')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x109'));db[_0xad82('0x10a')]=db[_0xad82('0x2')][_0xad82('0x13')](_0xad82('0x10b'));db[_0xad82('0x12')][_0xad82('0x10c')](db[_0xad82('0x1f')],{'as':_0xad82('0x1f'),'onDelete':'cascade','foreignKey':_0xad82('0x10d')});db[_0xad82('0x12')][_0xad82('0x10e')](db['VoiceRecording'],{'as':_0xad82('0x10f'),'foreignKey':'UserId'});db[_0xad82('0x12')][_0xad82('0x10e')](db[_0xad82('0x2e')],{'as':'VoiceQueuesRt','foreignKey':_0xad82('0x10d')});db[_0xad82('0x12')][_0xad82('0x10e')](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0xad82('0x12')]['hasMany'](db[_0xad82('0x110')],{'as':'HopperFinals','foreignKey':_0xad82('0x10d')});db[_0xad82('0x12')][_0xad82('0x10e')](db[_0xad82('0x7a')],{'as':_0xad82('0x111'),'foreignKey':_0xad82('0x10d')});db[_0xad82('0x12')][_0xad82('0x10e')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xad82('0x10d')});db[_0xad82('0x12')][_0xad82('0x10e')](db[_0xad82('0x112')],{'as':_0xad82('0x113'),'foreignKey':_0xad82('0x10d')});db[_0xad82('0x12')][_0xad82('0x10e')](db[_0xad82('0x114')],{'as':_0xad82('0x115'),'foreignKey':_0xad82('0x10d')});db[_0xad82('0x12')][_0xad82('0x10e')](db[_0xad82('0x58')],{'as':_0xad82('0x116'),'foreignKey':_0xad82('0x10d')});db[_0xad82('0x12')][_0xad82('0x10e')](db['FaxInteraction'],{'as':_0xad82('0x117'),'foreignKey':_0xad82('0x10d')});db[_0xad82('0x12')]['hasMany'](db['MailInteraction'],{'as':_0xad82('0x118'),'foreignKey':_0xad82('0x10d')});db['User']['hasMany'](db[_0xad82('0xff')],{'as':'WhatsappInteractions','foreignKey':_0xad82('0x10d')});db['User']['hasMany'](db[_0xad82('0xfb')],{'as':_0xad82('0x119'),'foreignKey':_0xad82('0x11a')});db[_0xad82('0x12')][_0xad82('0x11b')](db[_0xad82('0xf5')],{'as':'UserProfile','foreignKey':_0xad82('0x11c')});db['User'][_0xad82('0x11d')](db[_0xad82('0x71')],{'as':_0xad82('0x11e'),'through':_0xad82('0x11f')});db[_0xad82('0x12')]['belongsToMany'](db['CmContact'],{'as':_0xad82('0x120'),'through':'cm_user_has_contacts'});db[_0xad82('0x12')][_0xad82('0x11d')](db[_0xad82('0xf1')],{'as':_0xad82('0x121'),'through':'cm_user_has_lists'});db[_0xad82('0x12')][_0xad82('0x11d')](db['Team'],{'through':_0xad82('0x122')});db[_0xad82('0x12')][_0xad82('0x11d')](db[_0xad82('0x41')],{'as':_0xad82('0x118'),'through':'user_has_mail_interactions'});db[_0xad82('0x12')][_0xad82('0x11d')](db['ChatInteraction'],{'as':'ChatInteractions','through':_0xad82('0x123')});db[_0xad82('0x12')][_0xad82('0x11d')](db[_0xad82('0x4d')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0xad82('0x12')]['belongsToMany'](db[_0xad82('0x58')],{'as':_0xad82('0x116'),'through':_0xad82('0x124')});db['User'][_0xad82('0x11d')](db[_0xad82('0x112')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0xad82('0x12')][_0xad82('0x11d')](db[_0xad82('0xff')],{'as':_0xad82('0x125'),'through':_0xad82('0x126')});db[_0xad82('0x12')][_0xad82('0x11d')](db['VoiceQueue'],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0xad82('0x12')][_0xad82('0x11d')](db[_0xad82('0x3d')],{'as':'MailQueues','through':_0xad82('0x34'),'required':![]});db[_0xad82('0x12')][_0xad82('0x11d')](db[_0xad82('0x6f')],{'as':_0xad82('0x127'),'through':_0xad82('0x32'),'required':![],'hooks':!![]});db[_0xad82('0x12')]['belongsToMany'](db[_0xad82('0x128')],{'as':_0xad82('0x129'),'through':'UserFaxQueue','required':![]});db['User'][_0xad82('0x11d')](db[_0xad82('0x5b')],{'as':_0xad82('0x12a'),'through':_0xad82('0x37'),'required':![]});db[_0xad82('0x12')][_0xad82('0x11d')](db[_0xad82('0x63')],{'as':'OpenchannelQueues','through':_0xad82('0x12b'),'required':![]});db[_0xad82('0x12')][_0xad82('0x11d')](db['WhatsappQueue'],{'as':_0xad82('0x12c'),'through':_0xad82('0x12d'),'required':![]});db[_0xad82('0x12')]['belongsToMany'](db[_0xad82('0xf1')],{'through':_0xad82('0x12e')});db['User'][_0xad82('0x11d')](db[_0xad82('0xf3')],{'as':_0xad82('0x12f'),'through':'user_has_voice_prefixes','required':![]});db['User'][_0xad82('0x11d')](db[_0xad82('0x65')],{'as':_0xad82('0x130'),'through':_0xad82('0x131')});db[_0xad82('0x12')][_0xad82('0x11d')](db['FaxAccount'],{'as':_0xad82('0x132'),'through':_0xad82('0x133')});db[_0xad82('0x12')][_0xad82('0x11d')](db[_0xad82('0x134')],{'as':_0xad82('0x135'),'through':'user_has_mail_accounts'});db['User'][_0xad82('0x11d')](db[_0xad82('0x5d')],{'as':_0xad82('0x136'),'through':'user_has_openchannel_accounts'});db['User']['belongsToMany'](db[_0xad82('0x54')],{'as':_0xad82('0x137'),'through':_0xad82('0x138')});db[_0xad82('0x12')]['belongsToMany'](db['WhatsappAccount'],{'as':_0xad82('0x139'),'through':_0xad82('0x13a')});db['User'][_0xad82('0x11d')](db[_0xad82('0xde')],{'as':_0xad82('0x13b'),'through':'user_has_square_projects'});db[_0xad82('0x15')]['hasMany'](db[_0xad82('0x18')],{'as':'SpiedAgents','onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x13d')});db[_0xad82('0x16')][_0xad82('0x10e')](db[_0xad82('0x18')],{'onDelete':'cascade'});db[_0xad82('0x18')][_0xad82('0x10e')](db[_0xad82('0x18')],{'as':'Applications','onDelete':'cascade'});db['VoiceMusicOnHold'][_0xad82('0x11d')](db[_0xad82('0x8a')],{'as':_0xad82('0x13e'),'through':_0xad82('0x13f')});db[_0xad82('0x1b')]['hasMany'](db[_0xad82('0x2e')],{'as':'Members','foreignKey':_0xad82('0x140')});db[_0xad82('0x1b')][_0xad82('0x10e')](db[_0xad82('0x141')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db[_0xad82('0x1b')][_0xad82('0x10e')](db[_0xad82('0x110')],{'as':_0xad82('0x142'),'foreignKey':_0xad82('0x140')});db[_0xad82('0x1b')][_0xad82('0x10e')](db[_0xad82('0x7a')],{'as':_0xad82('0x143'),'foreignKey':_0xad82('0x140')});db[_0xad82('0x1b')][_0xad82('0x10e')](db[_0xad82('0x7b')],{'as':_0xad82('0x7b'),'foreignKey':'VoiceQueueId'});db[_0xad82('0x1b')][_0xad82('0x10e')](db['CmHopperBlack'],{'as':_0xad82('0x144'),'foreignKey':_0xad82('0x140')});db[_0xad82('0x1b')][_0xad82('0x10e')](db[_0xad82('0xd0')],{'as':_0xad82('0x145'),'foreignKey':'VoiceQueueId'});db[_0xad82('0x1b')][_0xad82('0x11b')](db[_0xad82('0x2b')],{'as':_0xad82('0x2b'),'foreignKey':'TrunkId'});db[_0xad82('0x1b')][_0xad82('0x11b')](db['Trunk'],{'as':_0xad82('0x146'),'foreignKey':_0xad82('0x147')});db[_0xad82('0x1b')]['belongsTo'](db[_0xad82('0x148')],{'as':_0xad82('0x148'),'foreignKey':_0xad82('0x149')});db[_0xad82('0x1b')][_0xad82('0x11b')](db[_0xad82('0x84')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue']['belongsToMany'](db[_0xad82('0xf1')],{'as':_0xad82('0x121'),'through':_0xad82('0x14a')});db[_0xad82('0x1b')][_0xad82('0x11d')](db[_0xad82('0x12')],{'as':_0xad82('0x14b'),'through':_0xad82('0x30')});db[_0xad82('0x1b')][_0xad82('0x11d')](db[_0xad82('0x14c')],{'as':_0xad82('0x14d'),'through':_0xad82('0x10a')});db[_0xad82('0x1b')][_0xad82('0x11d')](db[_0xad82('0xf1')],{'as':_0xad82('0x14e'),'through':'voice_queues_has_cm_blacklists'});db['VoiceRecording']['belongsTo'](db[_0xad82('0x12')],{'as':_0xad82('0x12'),'foreignKey':_0xad82('0x10d')});db[_0xad82('0x1e')][_0xad82('0x11b')](db[_0xad82('0x12')],{'as':_0xad82('0x12'),'foreignKey':_0xad82('0x10d')});db[_0xad82('0x1f')]['hasMany'](db[_0xad82('0x21')],{'as':'Messages','onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x14f'),'sourceKey':_0xad82('0x150')});db[_0xad82('0x21')]['belongsTo'](db[_0xad82('0x1f')],{'foreignKey':'mailboxuser','targetKey':_0xad82('0x150')});db[_0xad82('0x23')][_0xad82('0x10e')](db[_0xad82('0x151')],{'as':'QueueCalls','foreignKey':_0xad82('0x152'),'constraints':![]});db[_0xad82('0x23')][_0xad82('0x10e')](db[_0xad82('0x27')],{'as':_0xad82('0x153'),'foreignKey':_0xad82('0x152'),'constraints':![]});db['VoiceCallReport'][_0xad82('0x11b')](db[_0xad82('0x12')],{'as':_0xad82('0x12'),'foreignKey':_0xad82('0x10d')});db['VoiceCallReport'][_0xad82('0x11b')](db[_0xad82('0x154')],{'as':_0xad82('0x155'),'foreignKey':_0xad82('0x156')});db[_0xad82('0x39')][_0xad82('0x11b')](db[_0xad82('0x134')],{'as':_0xad82('0x134'),'foreignKey':_0xad82('0x157')});db[_0xad82('0x3a')]['belongsTo'](db['MailAccount'],{'as':_0xad82('0x134'),'foreignKey':_0xad82('0x157')});db[_0xad82('0x134')][_0xad82('0x10c')](db[_0xad82('0x39')],{'as':_0xad82('0x158'),'onDelete':_0xad82('0x13c')});db[_0xad82('0x134')][_0xad82('0x10c')](db[_0xad82('0x3a')],{'as':_0xad82('0x159'),'onDelete':_0xad82('0x13c')});db[_0xad82('0x134')][_0xad82('0x10e')](db[_0xad82('0x15a')],{'as':_0xad82('0x15b'),'foreignKey':_0xad82('0x157')});db[_0xad82('0x134')][_0xad82('0x10e')](db['CannedAnswer'],{'as':_0xad82('0x15c'),'foreignKey':_0xad82('0x157')});db['MailAccount'][_0xad82('0x10e')](db['MailMessage'],{'as':_0xad82('0x15d'),'foreignKey':_0xad82('0x157')});db['MailAccount'][_0xad82('0x10e')](db[_0xad82('0x41')],{'as':'Interactions'});db[_0xad82('0x134')][_0xad82('0x10e')](db['MailApplication'],{'as':'Applications'});db[_0xad82('0x134')][_0xad82('0x11b')](db[_0xad82('0xf1')],{'as':'List','foreignKey':_0xad82('0x15e')});db[_0xad82('0x134')][_0xad82('0x11b')](db['Template'],{'as':_0xad82('0x15f'),'foreignKey':_0xad82('0x160')});db['MailAccount'][_0xad82('0x11b')](db['Pause'],{'as':_0xad82('0x161'),'foreignKey':_0xad82('0x162')});db['MailAccount']['belongsToMany'](db['User'],{'as':_0xad82('0x14b'),'through':_0xad82('0x163')});db['MailQueue']['belongsToMany'](db['User'],{'as':_0xad82('0x14b'),'through':_0xad82('0x34')});db['MailQueue'][_0xad82('0x11d')](db[_0xad82('0x14c')],{'through':'team_has_mail_queues','as':_0xad82('0x14d')});db[_0xad82('0x41')][_0xad82('0x10e')](db[_0xad82('0x43')],{'as':_0xad82('0x15d'),'onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x164')});db['MailInteraction'][_0xad82('0x11b')](db[_0xad82('0x134')],{'as':_0xad82('0x165'),'foreignKey':_0xad82('0x157')});db[_0xad82('0x41')][_0xad82('0x11b')](db[_0xad82('0x154')],{'as':_0xad82('0x155'),'foreignKey':'ContactId'});db['MailInteraction']['belongsTo'](db[_0xad82('0x12')],{'as':'Owner','foreignKey':_0xad82('0x10d')});db[_0xad82('0x41')][_0xad82('0x11d')](db[_0xad82('0x166')],{'through':'mail_interaction_has_tags','as':_0xad82('0x167')});db['MailInteraction'][_0xad82('0x11d')](db['Tag'],{'through':_0xad82('0x168'),'as':'ThroughTags'});db[_0xad82('0x41')]['belongsToMany'](db[_0xad82('0x12')],{'as':_0xad82('0x169'),'through':_0xad82('0x16a'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0xad82('0x10e')](db['Attachment'],{'as':_0xad82('0x16b'),'onDelete':_0xad82('0x13c')});db[_0xad82('0x43')][_0xad82('0x11b')](db['User'],{'as':_0xad82('0x12')});db[_0xad82('0x43')][_0xad82('0x11b')](db[_0xad82('0x154')],{'onDelete':_0xad82('0x13c'),'as':'Contact'});db['MailMessage'][_0xad82('0x11b')](db['MailInteraction'],{'as':'Interaction','foreignKey':_0xad82('0x164')});db[_0xad82('0x43')][_0xad82('0x11b')](db[_0xad82('0x134')],{'as':'Account','foreignKey':_0xad82('0x157')});db['MailMessage'][_0xad82('0x11b')](db[_0xad82('0x65')],{'as':'ChatWebsite','foreignKey':_0xad82('0x16c')});db['MailMessage']['belongsTo'](db['ChatOfflineMessage'],{'as':_0xad82('0x6d'),'foreignKey':_0xad82('0x16d')});db[_0xad82('0x45')][_0xad82('0x11b')](db[_0xad82('0x12')],{'onDelete':_0xad82('0x16e')});db[_0xad82('0x45')][_0xad82('0x11b')](db[_0xad82('0x3d')],{'onDelete':_0xad82('0x16e')});db[_0xad82('0x45')][_0xad82('0x11b')](db[_0xad82('0x134')],{'onDelete':_0xad82('0x16e')});db[_0xad82('0x45')][_0xad82('0x11b')](db[_0xad82('0x148')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xad82('0x45')][_0xad82('0x11b')](db[_0xad82('0x166')],{'onDelete':_0xad82('0x16e'),'foreignKey':_0xad82('0x16f')});db[_0xad82('0x46')][_0xad82('0x11b')](db[_0xad82('0x134')],{});db[_0xad82('0x46')]['belongsTo'](db[_0xad82('0xf1')],{'as':_0xad82('0x170'),'foreignKey':_0xad82('0x15e')});db[_0xad82('0x46')][_0xad82('0x11b')](db[_0xad82('0x154')],{'as':_0xad82('0x155'),'foreignKey':_0xad82('0x156')});db['MailQueueReport'][_0xad82('0x11b')](db[_0xad82('0x41')],{});db[_0xad82('0x46')][_0xad82('0x11b')](db[_0xad82('0x43')],{});db[_0xad82('0x46')][_0xad82('0x11b')](db['User'],{});db[_0xad82('0x46')][_0xad82('0x11b')](db['MailQueue'],{});db['Dashboard']['hasMany'](db[_0xad82('0x171')],{'as':_0xad82('0x172'),'onDelete':_0xad82('0x13c')});db['FaxAccount']['hasMany'](db[_0xad82('0x15a')],{'as':'Dispositions','foreignKey':_0xad82('0x173')});db[_0xad82('0x4a')]['hasMany'](db[_0xad82('0x81')],{'as':_0xad82('0x15c'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0xad82('0x10e')](db[_0xad82('0x4d')],{'as':_0xad82('0x174')});db['FaxAccount'][_0xad82('0x10e')](db[_0xad82('0x4b')],{'as':_0xad82('0x175')});db['FaxAccount'][_0xad82('0x10e')](db['VoiceExtension'],{'as':_0xad82('0x176'),'onDelete':_0xad82('0x13c')});db[_0xad82('0x4a')]['hasMany'](db[_0xad82('0x4f')],{'as':_0xad82('0x15d')});db[_0xad82('0x4a')][_0xad82('0x11b')](db[_0xad82('0x2b')],{'as':_0xad82('0x2b')});db['FaxAccount']['belongsTo'](db['CmList'],{'as':_0xad82('0x170'),'foreignKey':'ListId'});db[_0xad82('0x4a')][_0xad82('0x11b')](db[_0xad82('0x84')],{'as':_0xad82('0x161'),'foreignKey':_0xad82('0x162')});db[_0xad82('0x4a')][_0xad82('0x11d')](db[_0xad82('0x12')],{'as':_0xad82('0x14b'),'through':'user_has_fax_accounts'});db[_0xad82('0x4b')]['belongsTo'](db[_0xad82('0x12')],{'onDelete':_0xad82('0x16e')});db[_0xad82('0x4b')][_0xad82('0x11b')](db['FaxQueue'],{'onDelete':_0xad82('0x16e')});db['FaxApplication'][_0xad82('0x11b')](db[_0xad82('0x4a')],{'onDelete':_0xad82('0x16e')});db[_0xad82('0x4b')][_0xad82('0x11b')](db['Tag'],{'onDelete':_0xad82('0x16e'),'foreignKey':_0xad82('0x16f')});db[_0xad82('0x4d')]['hasMany'](db[_0xad82('0x4f')],{'as':'Messages','onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x177')});db[_0xad82('0x4d')]['belongsTo'](db[_0xad82('0x4a')],{'as':_0xad82('0x165'),'foreignKey':_0xad82('0x173')});db[_0xad82('0x4d')][_0xad82('0x11b')](db[_0xad82('0x154')],{'as':'Contact','foreignKey':'ContactId'});db[_0xad82('0x4d')][_0xad82('0x11b')](db[_0xad82('0x12')],{'as':_0xad82('0x178'),'foreignKey':_0xad82('0x10d')});db[_0xad82('0x4d')][_0xad82('0x11d')](db[_0xad82('0x166')],{'through':_0xad82('0x179'),'as':_0xad82('0x167')});db['FaxInteraction'][_0xad82('0x11d')](db[_0xad82('0x166')],{'through':_0xad82('0x179'),'as':_0xad82('0x17a')});db[_0xad82('0x4d')][_0xad82('0x11d')](db[_0xad82('0x12')],{'as':_0xad82('0x169'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db['FaxMessage'][_0xad82('0x11b')](db[_0xad82('0x12')],{'onDelete':'cascade','as':_0xad82('0x12')});db['FaxMessage'][_0xad82('0x11b')](db[_0xad82('0x4d')],{'as':_0xad82('0x17b'),'foreignKey':_0xad82('0x177')});db['FaxMessage'][_0xad82('0x11b')](db['CmContact'],{'onDelete':_0xad82('0x13c'),'as':'Contact'});db[_0xad82('0x4f')]['belongsTo'](db[_0xad82('0xe7')],{'as':'Attachment','foreignKey':_0xad82('0x17c')});db[_0xad82('0x4f')]['belongsTo'](db['FaxAccount'],{'as':_0xad82('0x165'),'foreignKey':'FaxAccountId'});db[_0xad82('0x128')]['belongsToMany'](db[_0xad82('0x12')],{'as':_0xad82('0x14b'),'through':_0xad82('0x35')});db[_0xad82('0x128')]['belongsToMany'](db[_0xad82('0x14c')],{'through':'team_has_fax_queues','as':_0xad82('0x14d')});db[_0xad82('0x52')]['belongsTo'](db[_0xad82('0x4a')],{});db[_0xad82('0x52')][_0xad82('0x11b')](db[_0xad82('0xf1')],{'as':'List','foreignKey':_0xad82('0x15e')});db[_0xad82('0x52')][_0xad82('0x11b')](db['CmContact'],{'as':_0xad82('0x155'),'foreignKey':_0xad82('0x156')});db[_0xad82('0x52')][_0xad82('0x11b')](db['FaxInteraction'],{});db[_0xad82('0x52')][_0xad82('0x11b')](db[_0xad82('0x4f')],{});db[_0xad82('0x52')][_0xad82('0x11b')](db[_0xad82('0x12')],{});db[_0xad82('0x52')][_0xad82('0x11b')](db[_0xad82('0x128')],{});db[_0xad82('0x54')][_0xad82('0x10e')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xad82('0x17d')});db[_0xad82('0x54')]['hasMany'](db['CannedAnswer'],{'as':_0xad82('0x15c'),'foreignKey':_0xad82('0x17d')});db['SmsAccount'][_0xad82('0x10e')](db[_0xad82('0x5a')],{'as':_0xad82('0x15d'),'foreignKey':_0xad82('0x17d')});db[_0xad82('0x54')][_0xad82('0x10e')](db[_0xad82('0x58')],{'as':'Interactions'});db['SmsAccount'][_0xad82('0x10e')](db[_0xad82('0x56')],{'as':_0xad82('0x175')});db[_0xad82('0x54')]['belongsTo'](db[_0xad82('0xf1')],{'as':_0xad82('0x170'),'foreignKey':_0xad82('0x15e')});db[_0xad82('0x54')][_0xad82('0x11b')](db[_0xad82('0x84')],{'as':_0xad82('0x161'),'foreignKey':_0xad82('0x162')});db[_0xad82('0x54')]['belongsToMany'](db[_0xad82('0x12')],{'as':_0xad82('0x14b'),'through':_0xad82('0x138')});db[_0xad82('0x56')][_0xad82('0x11b')](db[_0xad82('0x12')],{'onDelete':'restrict'});db[_0xad82('0x56')][_0xad82('0x11b')](db[_0xad82('0x5b')],{'onDelete':'restrict'});db[_0xad82('0x56')]['belongsTo'](db['SmsAccount'],{'onDelete':'restrict'});db[_0xad82('0x56')][_0xad82('0x11b')](db[_0xad82('0x148')],{'onDelete':_0xad82('0x16e'),'foreignKey':'IntervalId'});db['SmsApplication']['belongsTo'](db['Tag'],{'onDelete':_0xad82('0x16e'),'foreignKey':_0xad82('0x16f')});db['SmsInteraction'][_0xad82('0x10e')](db[_0xad82('0x5a')],{'as':'Messages','onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0xad82('0x58')][_0xad82('0x11b')](db[_0xad82('0x54')],{'as':_0xad82('0x165'),'foreignKey':_0xad82('0x17d')});db[_0xad82('0x58')][_0xad82('0x11b')](db[_0xad82('0x154')],{'as':_0xad82('0x155'),'foreignKey':_0xad82('0x156')});db['SmsInteraction']['belongsTo'](db['User'],{'as':_0xad82('0x178'),'foreignKey':_0xad82('0x10d')});db['SmsInteraction'][_0xad82('0x11d')](db['Tag'],{'through':_0xad82('0x17e'),'as':'Tags'});db['SmsInteraction'][_0xad82('0x11d')](db['Tag'],{'through':_0xad82('0x17e'),'as':_0xad82('0x17a')});db[_0xad82('0x58')][_0xad82('0x11d')](db[_0xad82('0x12')],{'as':_0xad82('0x169'),'through':_0xad82('0x124'),'foreignKey':_0xad82('0x17f')});db[_0xad82('0x5a')][_0xad82('0x11b')](db[_0xad82('0x12')],{'as':'User'});db['SmsMessage'][_0xad82('0x11b')](db[_0xad82('0x154')],{'onDelete':_0xad82('0x13c'),'as':_0xad82('0x155')});db['SmsMessage'][_0xad82('0x11b')](db[_0xad82('0x58')],{'onDelete':_0xad82('0x13c'),'as':_0xad82('0x17b'),'foreignKey':_0xad82('0x17f')});db[_0xad82('0x5a')]['belongsTo'](db[_0xad82('0x54')],{'as':'Account','foreignKey':_0xad82('0x17d')});db[_0xad82('0x5b')][_0xad82('0x11d')](db[_0xad82('0x12')],{'as':_0xad82('0x14b'),'through':_0xad82('0x37'),'foreignKey':'SmsQueueId'});db[_0xad82('0x5b')]['belongsToMany'](db[_0xad82('0x14c')],{'through':_0xad82('0x180'),'as':'Teams'});db[_0xad82('0x5d')][_0xad82('0x10e')](db[_0xad82('0x15a')],{'as':'Dispositions','foreignKey':_0xad82('0x181')});db[_0xad82('0x5d')][_0xad82('0x10e')](db[_0xad82('0x81')],{'as':_0xad82('0x15c'),'foreignKey':_0xad82('0x181')});db[_0xad82('0x5d')]['hasMany'](db[_0xad82('0x112')],{'as':_0xad82('0x174'),'foreignKey':_0xad82('0x181')});db[_0xad82('0x5d')][_0xad82('0x10e')](db[_0xad82('0x182')],{'as':_0xad82('0x15d'),'foreignKey':_0xad82('0x181')});db['OpenchannelAccount'][_0xad82('0x10e')](db['OpenchannelApplication'],{'as':_0xad82('0x175'),'foreignKey':_0xad82('0x181')});db[_0xad82('0x5d')][_0xad82('0x11b')](db[_0xad82('0xf1')],{'as':_0xad82('0x170'),'foreignKey':_0xad82('0x15e')});db[_0xad82('0x5d')]['belongsTo'](db[_0xad82('0x84')],{'as':_0xad82('0x161'),'foreignKey':_0xad82('0x162')});db[_0xad82('0x5d')][_0xad82('0x11d')](db[_0xad82('0x12')],{'as':_0xad82('0x14b'),'through':'user_has_openchannel_accounts'});db[_0xad82('0x5f')][_0xad82('0x11b')](db['User'],{'onDelete':'restrict'});db[_0xad82('0x5f')][_0xad82('0x11b')](db[_0xad82('0x63')],{'onDelete':_0xad82('0x16e'),'foreignKey':_0xad82('0x183')});db['OpenchannelApplication']['belongsTo'](db[_0xad82('0x5d')],{'onDelete':_0xad82('0x16e'),'foreignKey':'OpenchannelAccountId'});db[_0xad82('0x5f')][_0xad82('0x11b')](db['Interval'],{'onDelete':_0xad82('0x16e'),'foreignKey':_0xad82('0x149')});db[_0xad82('0x5f')][_0xad82('0x11b')](db[_0xad82('0x166')],{'onDelete':_0xad82('0x16e'),'foreignKey':_0xad82('0x16f')});db[_0xad82('0x112')][_0xad82('0x10e')](db[_0xad82('0x182')],{'as':_0xad82('0x15d'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0xad82('0x112')]['belongsTo'](db['OpenchannelAccount'],{'as':_0xad82('0x165'),'foreignKey':_0xad82('0x181')});db[_0xad82('0x112')][_0xad82('0x11b')](db['CmContact'],{'as':'Contact','foreignKey':_0xad82('0x156')});db[_0xad82('0x112')]['belongsTo'](db[_0xad82('0x12')],{'as':_0xad82('0x178'),'foreignKey':_0xad82('0x10d')});db['OpenchannelInteraction'][_0xad82('0x11d')](db['Tag'],{'through':_0xad82('0x184'),'as':'Tags'});db[_0xad82('0x112')][_0xad82('0x11d')](db[_0xad82('0x166')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0xad82('0x112')][_0xad82('0x11d')](db[_0xad82('0x12')],{'as':_0xad82('0x169'),'through':_0xad82('0x185'),'foreignKey':_0xad82('0x186')});db[_0xad82('0x182')][_0xad82('0x11b')](db[_0xad82('0x12')],{'onDelete':_0xad82('0x13c'),'as':_0xad82('0x12')});db['OpenchannelMessage'][_0xad82('0x11b')](db[_0xad82('0x154')],{'onDelete':_0xad82('0x13c'),'as':_0xad82('0x155')});db['OpenchannelMessage'][_0xad82('0x11b')](db[_0xad82('0x112')],{'onDelete':_0xad82('0x13c'),'as':'Interaction','foreignKey':'OpenchannelInteractionId'});db[_0xad82('0x182')][_0xad82('0x11b')](db['Attachment'],{'as':_0xad82('0xe7'),'foreignKey':_0xad82('0x17c')});db[_0xad82('0x182')]['belongsTo'](db[_0xad82('0x5d')],{'as':'Account','foreignKey':_0xad82('0x181')});db[_0xad82('0x63')][_0xad82('0x11d')](db[_0xad82('0x12')],{'as':_0xad82('0x14b'),'through':_0xad82('0x12b'),'foreignKey':_0xad82('0x183')});db[_0xad82('0x63')][_0xad82('0x11d')](db[_0xad82('0x14c')],{'through':_0xad82('0x187'),'as':'Teams'});db[_0xad82('0x65')]['hasMany'](db[_0xad82('0x15a')],{'as':_0xad82('0x15b'),'foreignKey':_0xad82('0x16c')});db[_0xad82('0x65')][_0xad82('0x10e')](db[_0xad82('0x81')],{'as':_0xad82('0x15c'),'foreignKey':'ChatWebsiteId'});db[_0xad82('0x65')][_0xad82('0x10e')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0xad82('0x65')]['hasMany'](db[_0xad82('0x114')],{'as':_0xad82('0x174')});db['ChatWebsite'][_0xad82('0x10e')](db['ChatApplication'],{'as':'Applications'});db['ChatWebsite'][_0xad82('0x10e')](db['ChatMessage'],{'as':_0xad82('0x15d')});db['ChatWebsite']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xad82('0x15e')});db[_0xad82('0x65')][_0xad82('0x11b')](db['Interval'],{'as':_0xad82('0x148'),'foreignKey':_0xad82('0x149')});db[_0xad82('0x65')][_0xad82('0x11b')](db['MailAccount'],{'as':_0xad82('0x134'),'foreignKey':_0xad82('0x157')});db[_0xad82('0x65')][_0xad82('0x11b')](db[_0xad82('0x84')],{'as':_0xad82('0x161'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xad82('0x65')]['belongsToMany'](db[_0xad82('0x12')],{'as':_0xad82('0x14b'),'through':_0xad82('0x131')});db[_0xad82('0x67')][_0xad82('0x11b')](db[_0xad82('0x5d')],{});db[_0xad82('0x67')][_0xad82('0x11b')](db[_0xad82('0xf1')],{'as':_0xad82('0x170'),'foreignKey':_0xad82('0x15e')});db['OpenchannelQueueReport'][_0xad82('0x11b')](db[_0xad82('0x154')],{'as':'Contact','foreignKey':_0xad82('0x156')});db[_0xad82('0x67')][_0xad82('0x11b')](db[_0xad82('0x112')],{});db[_0xad82('0x67')]['belongsTo'](db['OpenchannelMessage'],{});db[_0xad82('0x67')][_0xad82('0x11b')](db[_0xad82('0x12')],{});db[_0xad82('0x67')][_0xad82('0x11b')](db[_0xad82('0x63')],{});db[_0xad82('0x69')][_0xad82('0x11b')](db[_0xad82('0x12')],{'as':_0xad82('0x188'),'foreignKey':_0xad82('0x10d'),'onDelete':_0xad82('0x16e')});db[_0xad82('0x69')]['belongsTo'](db[_0xad82('0x6f')],{'as':_0xad82('0x189'),'foreignKey':_0xad82('0x18a'),'onDelete':_0xad82('0x16e')});db[_0xad82('0x69')][_0xad82('0x11b')](db[_0xad82('0x65')],{'as':_0xad82('0x18b'),'foreignKey':_0xad82('0x16c'),'onDelete':_0xad82('0x16e')});db[_0xad82('0x69')][_0xad82('0x11b')](db[_0xad82('0x166')],{'onDelete':_0xad82('0x16e'),'foreignKey':_0xad82('0x16f')});db['ChatInteraction']['hasMany'](db['ChatMessage'],{'as':'Messages','onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x18c')});db[_0xad82('0x114')]['belongsTo'](db[_0xad82('0x65')],{'as':_0xad82('0x165'),'foreignKey':_0xad82('0x16c')});db[_0xad82('0x114')][_0xad82('0x11b')](db['CmContact'],{'as':_0xad82('0x155'),'foreignKey':_0xad82('0x156')});db['ChatInteraction'][_0xad82('0x11b')](db['User'],{'as':_0xad82('0x178'),'foreignKey':'UserId'});db['ChatInteraction'][_0xad82('0x11d')](db[_0xad82('0x166')],{'through':_0xad82('0x18d'),'as':_0xad82('0x167')});db['ChatInteraction'][_0xad82('0x11d')](db[_0xad82('0x166')],{'through':_0xad82('0x18d'),'as':_0xad82('0x17a')});db[_0xad82('0x114')]['belongsToMany'](db[_0xad82('0x12')],{'as':_0xad82('0x169'),'through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db[_0xad82('0x18e')][_0xad82('0x11b')](db[_0xad82('0x12')],{'onDelete':_0xad82('0x13c'),'as':'User'});db[_0xad82('0x18e')][_0xad82('0x11b')](db[_0xad82('0x154')],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db['ChatMessage'][_0xad82('0x11b')](db[_0xad82('0x114')],{'onDelete':_0xad82('0x13c'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0xad82('0x18e')][_0xad82('0x11b')](db['Attachment'],{'as':_0xad82('0xe7'),'foreignKey':_0xad82('0x17c')});db[_0xad82('0x18e')][_0xad82('0x11b')](db['ChatWebsite'],{'as':_0xad82('0x165'),'foreignKey':'ChatWebsiteId'});db[_0xad82('0x6d')]['hasMany'](db[_0xad82('0xe7')],{'as':'Attachments','foreignKey':_0xad82('0x16d'),'onDelete':'cascade','hooks':!![]});db['ChatOfflineMessage'][_0xad82('0x11b')](db[_0xad82('0x154')],{'onDelete':_0xad82('0x13c'),'as':'Contact','foreignKey':_0xad82('0x156')});db[_0xad82('0x6d')][_0xad82('0x11b')](db[_0xad82('0x65')],{'as':_0xad82('0x165'),'foreignKey':'ChatWebsiteId'});db['ChatQueue']['belongsToMany'](db[_0xad82('0x12')],{'as':_0xad82('0x14b'),'through':_0xad82('0x32'),'hooks':!![]});db[_0xad82('0x6f')]['belongsToMany'](db[_0xad82('0x14c')],{'through':_0xad82('0x18f'),'as':_0xad82('0x14d')});db[_0xad82('0x71')][_0xad82('0x10e')](db[_0xad82('0xca')],{'as':_0xad82('0x15d'),'foreignKey':_0xad82('0x190'),'onDelete':_0xad82('0x13c')});db[_0xad82('0x71')][_0xad82('0x11d')](db[_0xad82('0x12')],{'as':_0xad82('0x191'),'through':_0xad82('0x11f')});db[_0xad82('0x73')][_0xad82('0x11b')](db[_0xad82('0x65')],{'as':_0xad82('0x18b'),'foreignKey':'ChatWebsiteId'});db['CmCompany']['hasMany'](db['CmContact'],{'as':_0xad82('0x120'),'foreignKey':_0xad82('0x192')});db[_0xad82('0x154')]['hasMany'](db[_0xad82('0x141')],{'as':_0xad82('0x193'),'foreignKey':_0xad82('0x156')});db[_0xad82('0x154')][_0xad82('0x10e')](db[_0xad82('0x110')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0xad82('0x154')][_0xad82('0x10e')](db[_0xad82('0x7a')],{'as':'HopperHistories','foreignKey':_0xad82('0x156')});db[_0xad82('0x154')][_0xad82('0x10e')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0xad82('0x154')]['hasMany'](db['JscriptySessionReport'],{'as':_0xad82('0x145'),'foreignKey':_0xad82('0x156')});db[_0xad82('0x154')][_0xad82('0x10e')](db[_0xad82('0x112')],{'as':_0xad82('0x113'),'foreignKey':_0xad82('0x156'),'onDelete':_0xad82('0x16e')});db[_0xad82('0x154')]['hasMany'](db[_0xad82('0x114')],{'as':_0xad82('0x115'),'foreignKey':'ContactId','onDelete':_0xad82('0x16e')});db['CmContact'][_0xad82('0x10e')](db[_0xad82('0x58')],{'as':_0xad82('0x116'),'foreignKey':_0xad82('0x156'),'onDelete':_0xad82('0x16e')});db[_0xad82('0x154')]['hasMany'](db[_0xad82('0x4d')],{'as':'FaxInteractions','foreignKey':_0xad82('0x156'),'onDelete':_0xad82('0x16e')});db[_0xad82('0x154')][_0xad82('0x10e')](db[_0xad82('0x41')],{'as':_0xad82('0x118'),'foreignKey':_0xad82('0x156'),'onDelete':_0xad82('0x16e')});db[_0xad82('0x154')][_0xad82('0x11b')](db[_0xad82('0x74')],{'as':_0xad82('0x194'),'foreignKey':_0xad82('0x192')});db[_0xad82('0x154')][_0xad82('0x11b')](db[_0xad82('0xf1')],{'as':'List','foreignKey':_0xad82('0x15e'),'onDelete':_0xad82('0x13c')});db[_0xad82('0x154')]['belongsToMany'](db[_0xad82('0x12')],{'as':'Users','through':_0xad82('0x195')});db['CmContact'][_0xad82('0x11d')](db['Tag'],{'as':_0xad82('0x167'),'through':'cm_contact_has_tags'});db['CmContact'][_0xad82('0x11d')](db[_0xad82('0x166')],{'through':'cm_contact_has_tags','as':_0xad82('0x17a')});db['CmHopper'][_0xad82('0x11b')](db['CmContact'],{'as':'Contact','foreignKey':_0xad82('0x156'),'onDelete':'cascade'});db[_0xad82('0x141')][_0xad82('0x11b')](db[_0xad82('0xf1')],{'as':_0xad82('0x170'),'foreignKey':'ListId','onDelete':_0xad82('0x13c')});db[_0xad82('0x141')][_0xad82('0x11b')](db[_0xad82('0x12')],{'as':'Agent','foreignKey':_0xad82('0x10d')});db[_0xad82('0x141')][_0xad82('0x11b')](db[_0xad82('0x1b')],{'as':'Queue','foreignKey':_0xad82('0x140'),'onDelete':'cascade'});db[_0xad82('0x141')]['belongsTo'](db[_0xad82('0x196')],{'as':_0xad82('0x196'),'foreignKey':_0xad82('0x197'),'onDelete':_0xad82('0x13c')});db['CmHopper'][_0xad82('0x11b')](db[_0xad82('0x12')],{'as':_0xad82('0x178'),'foreignKey':_0xad82('0x198')});db[_0xad82('0x199')][_0xad82('0x11b')](db['CmContact'],{'as':_0xad82('0x155'),'foreignKey':_0xad82('0x156'),'onDelete':_0xad82('0x13c')});db[_0xad82('0x199')][_0xad82('0x11b')](db[_0xad82('0xf1')],{'as':_0xad82('0x170'),'foreignKey':_0xad82('0x15e'),'onDelete':_0xad82('0x13c')});db['CmHopperBlack'][_0xad82('0x11b')](db[_0xad82('0x1b')],{'as':_0xad82('0x189'),'foreignKey':'VoiceQueueId','onDelete':_0xad82('0x13c')});db[_0xad82('0x199')][_0xad82('0x11b')](db['Campaign'],{'as':_0xad82('0x196'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0xad82('0x7f')][_0xad82('0x10e')](db[_0xad82('0x19a')],{'as':{'plural':'All','singular':_0xad82('0x19b')},'foreignKey':_0xad82('0x19c'),'onDelete':_0xad82('0x13c'),'hooks':!![]});db['Automation'][_0xad82('0x10e')](db[_0xad82('0x19a')],{'as':{'plural':_0xad82('0x19d'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0xad82('0x13c'),'hooks':!![]});db[_0xad82('0x7f')][_0xad82('0x10e')](db['Action'],{'as':_0xad82('0x19e'),'foreignKey':_0xad82('0x19f'),'onDelete':_0xad82('0x13c'),'hooks':!![]});db[_0xad82('0x15a')][_0xad82('0x10e')](db[_0xad82('0x15a')],{'as':'Dispositions','foreignKey':_0xad82('0x1a0'),'onDelete':_0xad82('0x13c')});db[_0xad82('0x148')][_0xad82('0x10e')](db[_0xad82('0x148')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0xad82('0x13c'),'hooks':!![],'required':![]});db[_0xad82('0x148')][_0xad82('0x10e')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0xad82('0x149'),'onDelete':_0xad82('0x16e')});db['Interval']['hasMany'](db[_0xad82('0x45')],{'as':_0xad82('0x1a1'),'foreignKey':_0xad82('0x149')});db[_0xad82('0x148')][_0xad82('0x10e')](db[_0xad82('0x69')],{'as':_0xad82('0x1a2'),'foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0xad82('0x4b')],{'as':'FaxApplications','foreignKey':'IntervalId'});db['Interval'][_0xad82('0x10e')](db[_0xad82('0x56')],{'as':_0xad82('0x1a3'),'foreignKey':'IntervalId'});db[_0xad82('0x1a4')][_0xad82('0x11b')](db[_0xad82('0x134')],{});db[_0xad82('0x1a4')][_0xad82('0x11b')](db[_0xad82('0x94')],{'foreignKey':_0xad82('0x1a5')});db[_0xad82('0x1a4')]['belongsTo'](db[_0xad82('0x1a6')],{'foreignKey':_0xad82('0x1a7')});db[_0xad82('0x8a')]['belongsToMany'](db[_0xad82('0x19')],{'as':_0xad82('0x1a8'),'through':_0xad82('0x13f'),'onDelete':_0xad82('0x16e')});db[_0xad82('0x166')][_0xad82('0x11d')](db[_0xad82('0x154')],{'through':_0xad82('0x1a9')});db[_0xad82('0x166')]['belongsToMany'](db[_0xad82('0x114')],{'through':_0xad82('0x18d')});db[_0xad82('0x166')][_0xad82('0x11d')](db['MailInteraction'],{'through':_0xad82('0x168')});db[_0xad82('0x166')][_0xad82('0x11d')](db[_0xad82('0x58')],{'through':_0xad82('0x17e')});db['Tag']['belongsToMany'](db[_0xad82('0x4d')],{'through':_0xad82('0x179')});db['Tag'][_0xad82('0x11d')](db[_0xad82('0x112')],{'through':'openchannel_interaction_has_tags'});db[_0xad82('0x166')]['belongsToMany'](db[_0xad82('0xff')],{'through':'whatsapp_interaction_has_tags'});db[_0xad82('0x1aa')]['hasMany'](db[_0xad82('0x19a')],{'as':{'plural':_0xad82('0x1ab'),'singular':'AllCondition'},'foreignKey':_0xad82('0x1ac'),'onDelete':_0xad82('0x13c'),'hooks':!![]});db[_0xad82('0x1aa')][_0xad82('0x10e')](db[_0xad82('0x19a')],{'as':{'plural':_0xad82('0x1ad'),'singular':_0xad82('0x1ae')},'foreignKey':_0xad82('0x1af'),'onDelete':_0xad82('0x13c'),'hooks':!![]});db['Trigger'][_0xad82('0x10e')](db[_0xad82('0x7e')],{'as':_0xad82('0x19e'),'foreignKey':_0xad82('0x1b0'),'onDelete':'cascade','hooks':!![]});db[_0xad82('0x1a6')][_0xad82('0x10e')](db['AnalyticFieldReport'],{'as':_0xad82('0x1b1'),'onDelete':_0xad82('0x13c'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xad82('0x94')][_0xad82('0x10e')](db[_0xad82('0x98')],{'as':_0xad82('0x1b1'),'onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x1a5')});db[_0xad82('0x97')][_0xad82('0x10e')](db[_0xad82('0x98')],{'as':'Fields','onDelete':'cascade','foreignKey':'MetricId'});db['AnalyticFieldReport'][_0xad82('0x11b')](db[_0xad82('0x97')],{'foreignKey':_0xad82('0x1b2')});db[_0xad82('0x9c')][_0xad82('0x10e')](db[_0xad82('0x9e')],{'as':_0xad82('0x1b3'),'onDelete':_0xad82('0x13c'),'foreignKey':'AccountId'});db[_0xad82('0x9e')][_0xad82('0x10e')](db[_0xad82('0x1b4')],{'as':'Subjects','onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x1b5')});db[_0xad82('0x9e')][_0xad82('0x10e')](db[_0xad82('0x1b4')],{'as':_0xad82('0x1b6'),'onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x1b7')});db[_0xad82('0x9e')][_0xad82('0x10e')](db[_0xad82('0x1b4')],{'as':_0xad82('0x1b1'),'onDelete':_0xad82('0x13c'),'foreignKey':'FieldId'});db['SalesforceConfiguration']['belongsTo'](db[_0xad82('0x9c')],{'as':_0xad82('0x165'),'foreignKey':_0xad82('0x1b8')});db[_0xad82('0x1b4')]['hasMany'](db['SalesforceField'],{'as':_0xad82('0x1b9'),'foreignKey':'SubjectId'});db[_0xad82('0x1b4')][_0xad82('0x10e')](db[_0xad82('0x1b4')],{'as':_0xad82('0x1ba'),'foreignKey':'DescriptionId'});db[_0xad82('0x1b4')][_0xad82('0x10e')](db['SalesforceField'],{'as':'Field','foreignKey':_0xad82('0x1bb')});db[_0xad82('0x1b4')][_0xad82('0x11b')](db[_0xad82('0x8f')],{'as':_0xad82('0x8f'),'foreignKey':'VariableId'});db[_0xad82('0x1bc')][_0xad82('0x10e')](db[_0xad82('0xa1')],{'as':_0xad82('0x1b3'),'onDelete':_0xad82('0x13c'),'foreignKey':'AccountId'});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':_0xad82('0x1bd'),'onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x1b5')});db[_0xad82('0xa1')]['hasMany'](db[_0xad82('0xa2')],{'as':_0xad82('0x1b6'),'onDelete':'cascade','foreignKey':_0xad82('0x1b7')});db[_0xad82('0xa1')][_0xad82('0x10e')](db[_0xad82('0xa2')],{'as':'Fields','onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x1bb')});db[_0xad82('0xa1')][_0xad82('0x11b')](db[_0xad82('0x1bc')],{'as':_0xad82('0x165'),'foreignKey':_0xad82('0x1b8')});db[_0xad82('0xa2')][_0xad82('0x10e')](db[_0xad82('0xa2')],{'as':_0xad82('0x1b9'),'foreignKey':_0xad82('0x1b5')});db['SugarcrmField'][_0xad82('0x10e')](db[_0xad82('0xa2')],{'as':_0xad82('0x1ba'),'foreignKey':'DescriptionId'});db[_0xad82('0xa2')][_0xad82('0x10e')](db[_0xad82('0xa2')],{'as':_0xad82('0x1be'),'foreignKey':'FieldId'});db['SugarcrmField'][_0xad82('0x11b')](db[_0xad82('0x8f')],{'as':_0xad82('0x8f'),'foreignKey':'VariableId'});db[_0xad82('0xa3')]['hasMany'](db[_0xad82('0xa4')],{'as':_0xad82('0x1b3'),'onDelete':'cascade','foreignKey':_0xad82('0x1b8')});db['DeskConfiguration'][_0xad82('0x10e')](db[_0xad82('0x1bf')],{'as':_0xad82('0x1bd'),'onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x1b5')});db['DeskConfiguration'][_0xad82('0x10e')](db['DeskField'],{'as':_0xad82('0x1b6'),'onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x1b7')});db['DeskConfiguration'][_0xad82('0x10e')](db[_0xad82('0x1bf')],{'as':'Fields','onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x1bb')});db[_0xad82('0xa4')]['belongsTo'](db[_0xad82('0xa3')],{'as':_0xad82('0x165'),'foreignKey':_0xad82('0x1b8')});db[_0xad82('0xa4')][_0xad82('0x11d')](db[_0xad82('0x166')],{'through':_0xad82('0x1c0')});db[_0xad82('0x1bf')]['hasMany'](db[_0xad82('0x1bf')],{'as':_0xad82('0x1b9'),'foreignKey':_0xad82('0x1b5')});db[_0xad82('0x1bf')][_0xad82('0x10e')](db['DeskField'],{'as':_0xad82('0x1ba'),'foreignKey':_0xad82('0x1b7')});db['DeskField'][_0xad82('0x10e')](db['DeskField'],{'as':'Field','foreignKey':_0xad82('0x1bb')});db[_0xad82('0x1bf')]['belongsTo'](db[_0xad82('0x8f')],{'as':_0xad82('0x8f'),'foreignKey':_0xad82('0x1c1')});db[_0xad82('0xa7')][_0xad82('0x10e')](db[_0xad82('0x1c2')],{'as':_0xad82('0x1b3'),'onDelete':'cascade','foreignKey':_0xad82('0x1b8')});db[_0xad82('0x1c2')][_0xad82('0x10e')](db[_0xad82('0xaa')],{'as':_0xad82('0x1bd'),'onDelete':_0xad82('0x13c'),'foreignKey':'SubjectId'});db[_0xad82('0x1c2')][_0xad82('0x10e')](db[_0xad82('0xaa')],{'as':_0xad82('0x1b6'),'onDelete':'cascade','foreignKey':_0xad82('0x1b7')});db['ZohoConfiguration']['hasMany'](db['ZohoField'],{'as':'Fields','onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x1bb')});db['ZohoConfiguration'][_0xad82('0x11b')](db[_0xad82('0xa7')],{'as':_0xad82('0x165'),'foreignKey':_0xad82('0x1b8')});db['ZohoField']['hasMany'](db[_0xad82('0xaa')],{'as':_0xad82('0x1b9'),'foreignKey':_0xad82('0x1b5')});db['ZohoField'][_0xad82('0x10e')](db[_0xad82('0xaa')],{'as':_0xad82('0x1ba'),'foreignKey':_0xad82('0x1b7')});db['ZohoField']['hasMany'](db[_0xad82('0xaa')],{'as':_0xad82('0x1be'),'foreignKey':_0xad82('0x1bb')});db['ZohoField'][_0xad82('0x11b')](db[_0xad82('0x8f')],{'as':'Variable','foreignKey':'VariableId'});db[_0xad82('0xac')][_0xad82('0x10e')](db[_0xad82('0xad')],{'as':_0xad82('0x1b3'),'onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x1b8')});db[_0xad82('0xad')]['hasMany'](db[_0xad82('0x1c3')],{'as':_0xad82('0x1bd'),'foreignKey':'SubjectId'});db[_0xad82('0xad')][_0xad82('0x10e')](db[_0xad82('0x1c3')],{'as':'Descriptions','foreignKey':_0xad82('0x1b7')});db[_0xad82('0xad')][_0xad82('0x10e')](db[_0xad82('0x1c3')],{'as':_0xad82('0x1b1'),'foreignKey':_0xad82('0x1bb')});db[_0xad82('0xad')][_0xad82('0x11b')](db['ZendeskAccount'],{'as':_0xad82('0x165'),'foreignKey':'AccountId'});db[_0xad82('0xad')]['belongsToMany'](db[_0xad82('0x166')],{'through':'int_zendesk_configuration_has_tags'});db[_0xad82('0x1c3')][_0xad82('0x10e')](db[_0xad82('0x1c3')],{'as':_0xad82('0x1b9'),'foreignKey':'SubjectId'});db[_0xad82('0x1c3')][_0xad82('0x10e')](db[_0xad82('0x1c3')],{'as':_0xad82('0x1ba'),'foreignKey':_0xad82('0x1b7')});db[_0xad82('0x1c3')][_0xad82('0x10e')](db[_0xad82('0x1c3')],{'as':_0xad82('0x1be'),'foreignKey':_0xad82('0x1bb')});db[_0xad82('0x1c3')][_0xad82('0x11b')](db[_0xad82('0x8f')],{'as':_0xad82('0x8f'),'foreignKey':_0xad82('0x1c1')});db[_0xad82('0xaf')][_0xad82('0x10e')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x1b8')});db[_0xad82('0x1c4')]['hasMany'](db[_0xad82('0x1c5')],{'as':'Subjects','onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x1b5')});db[_0xad82('0x1c4')][_0xad82('0x10e')](db['FreshdeskField'],{'as':_0xad82('0x1b6'),'onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x1b7')});db['FreshdeskConfiguration']['hasMany'](db[_0xad82('0x1c5')],{'as':_0xad82('0x1b1'),'onDelete':'cascade','foreignKey':_0xad82('0x1bb')});db[_0xad82('0x1c4')][_0xad82('0x11b')](db[_0xad82('0xaf')],{'as':_0xad82('0x165'),'foreignKey':_0xad82('0x1b8')});db[_0xad82('0x1c4')][_0xad82('0x11d')](db[_0xad82('0x166')],{'through':_0xad82('0x1c6')});db[_0xad82('0x1c5')][_0xad82('0x10e')](db['FreshdeskField'],{'as':_0xad82('0x1b9'),'foreignKey':_0xad82('0x1b5')});db[_0xad82('0x1c5')][_0xad82('0x10e')](db[_0xad82('0x1c5')],{'as':_0xad82('0x1ba'),'foreignKey':_0xad82('0x1b7')});db['FreshdeskField'][_0xad82('0x10e')](db[_0xad82('0x1c5')],{'as':_0xad82('0x1be'),'foreignKey':_0xad82('0x1bb')});db[_0xad82('0x1c5')][_0xad82('0x11b')](db[_0xad82('0x8f')],{'as':_0xad82('0x8f'),'foreignKey':_0xad82('0x1c1')});db['VtigerAccount']['hasMany'](db[_0xad82('0xb3')],{'as':_0xad82('0x1b3'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xad82('0xb3')][_0xad82('0x10e')](db[_0xad82('0xb5')],{'as':_0xad82('0x1bd'),'foreignKey':_0xad82('0x1b5')});db[_0xad82('0xb3')]['hasMany'](db['VtigerField'],{'as':_0xad82('0x1b6'),'foreignKey':'DescriptionId'});db[_0xad82('0xb3')]['hasMany'](db['VtigerField'],{'as':'Fields','foreignKey':_0xad82('0x1bb')});db[_0xad82('0xb3')][_0xad82('0x11b')](db[_0xad82('0xb2')],{'as':_0xad82('0x165'),'foreignKey':_0xad82('0x1b8')});db['VtigerField'][_0xad82('0x10e')](db[_0xad82('0xb5')],{'as':_0xad82('0x1b9'),'foreignKey':_0xad82('0x1b5')});db[_0xad82('0xb5')][_0xad82('0x10e')](db[_0xad82('0xb5')],{'as':'Description','foreignKey':'DescriptionId'});db['VtigerField'][_0xad82('0x10e')](db['VtigerField'],{'as':'Field','foreignKey':_0xad82('0x1bb')});db[_0xad82('0xb5')]['belongsTo'](db[_0xad82('0x8f')],{'as':_0xad82('0x8f'),'foreignKey':_0xad82('0x1c1')});db[_0xad82('0xb6')][_0xad82('0x10e')](db['ServicenowConfiguration'],{'as':_0xad82('0x1b3'),'onDelete':_0xad82('0x13c'),'foreignKey':'AccountId'});db[_0xad82('0x1c7')][_0xad82('0x10e')](db[_0xad82('0xb9')],{'as':_0xad82('0x1bd'),'foreignKey':_0xad82('0x1b5')});db[_0xad82('0x1c7')][_0xad82('0x10e')](db[_0xad82('0xb9')],{'as':_0xad82('0x1b6'),'foreignKey':'DescriptionId'});db[_0xad82('0x1c7')]['hasMany'](db[_0xad82('0xb9')],{'as':_0xad82('0x1b1'),'foreignKey':'FieldId'});db[_0xad82('0x1c7')][_0xad82('0x11b')](db['ServicenowAccount'],{'as':'Account','foreignKey':_0xad82('0x1b8')});db[_0xad82('0xb9')][_0xad82('0x10e')](db[_0xad82('0xb9')],{'as':_0xad82('0x1b9'),'foreignKey':_0xad82('0x1b5')});db[_0xad82('0xb9')][_0xad82('0x10e')](db[_0xad82('0xb9')],{'as':_0xad82('0x1ba'),'foreignKey':'DescriptionId'});db[_0xad82('0xb9')]['hasMany'](db[_0xad82('0xb9')],{'as':_0xad82('0x1be'),'foreignKey':_0xad82('0x1bb')});db[_0xad82('0xb9')][_0xad82('0x11b')](db[_0xad82('0x8f')],{'as':_0xad82('0x8f'),'foreignKey':_0xad82('0x1c1')});db[_0xad82('0x1c8')][_0xad82('0x10e')](db[_0xad82('0xbc')],{'as':'Configurations','onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x1b8')});db['Dynamics365Configuration'][_0xad82('0x10e')](db['Dynamics365Field'],{'as':_0xad82('0x1bd'),'onDelete':'cascade','foreignKey':_0xad82('0x1b5')});db[_0xad82('0xbc')]['hasMany'](db['Dynamics365Field'],{'as':_0xad82('0x1b6'),'onDelete':_0xad82('0x13c'),'foreignKey':'DescriptionId'});db[_0xad82('0xbc')]['hasMany'](db[_0xad82('0xbe')],{'as':_0xad82('0x1b1'),'onDelete':'cascade','foreignKey':_0xad82('0x1bb')});db[_0xad82('0xbc')]['belongsTo'](db[_0xad82('0x1c8')],{'as':_0xad82('0x165'),'foreignKey':_0xad82('0x1b8')});db[_0xad82('0xbe')][_0xad82('0x10e')](db[_0xad82('0xbe')],{'as':'Subject','foreignKey':_0xad82('0x1b5')});db[_0xad82('0xbe')][_0xad82('0x10e')](db[_0xad82('0xbe')],{'as':_0xad82('0x1ba'),'foreignKey':_0xad82('0x1b7')});db['Dynamics365Field'][_0xad82('0x10e')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0xad82('0x1bb')});db[_0xad82('0xbe')][_0xad82('0x11b')](db['Variable'],{'as':_0xad82('0x8f'),'foreignKey':_0xad82('0x1c1')});db['FreshsalesAccount'][_0xad82('0x10e')](db[_0xad82('0xc2')],{'as':'Configurations','onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x1b8')});db[_0xad82('0xc2')][_0xad82('0x10e')](db[_0xad82('0xc4')],{'as':_0xad82('0x1bd'),'foreignKey':_0xad82('0x1b5')});db[_0xad82('0xc2')][_0xad82('0x10e')](db['FreshsalesField'],{'as':_0xad82('0x1b6'),'foreignKey':_0xad82('0x1b7')});db[_0xad82('0xc2')][_0xad82('0x10e')](db[_0xad82('0xc4')],{'as':_0xad82('0x1b1'),'foreignKey':'FieldId'});db[_0xad82('0xc2')][_0xad82('0x11b')](db[_0xad82('0xc0')],{'as':_0xad82('0x165'),'foreignKey':_0xad82('0x1b8')});db[_0xad82('0xc4')][_0xad82('0x10e')](db[_0xad82('0xc4')],{'as':_0xad82('0x1b9'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0xad82('0x10e')](db[_0xad82('0xc4')],{'as':'Description','foreignKey':'DescriptionId'});db['FreshsalesField'][_0xad82('0x10e')](db['FreshsalesField'],{'as':_0xad82('0x1be'),'foreignKey':_0xad82('0x1bb')});db[_0xad82('0xc4')][_0xad82('0x11b')](db[_0xad82('0x8f')],{'as':_0xad82('0x8f'),'foreignKey':'VariableId'});db[_0xad82('0xc8')]['belongsTo'](db[_0xad82('0x65')],{});db['ChatQueueReport'][_0xad82('0x11b')](db[_0xad82('0xf1')],{'as':_0xad82('0x170'),'foreignKey':_0xad82('0x15e')});db[_0xad82('0xc8')]['belongsTo'](db[_0xad82('0x154')],{'as':_0xad82('0x155'),'foreignKey':_0xad82('0x156')});db[_0xad82('0xc8')][_0xad82('0x11b')](db['ChatInteraction'],{});db[_0xad82('0xc8')][_0xad82('0x11b')](db[_0xad82('0x18e')],{});db[_0xad82('0xc8')][_0xad82('0x11b')](db['User'],{});db[_0xad82('0xc8')]['belongsTo'](db[_0xad82('0x6f')],{});db[_0xad82('0xca')][_0xad82('0x11b')](db['User'],{'onDelete':_0xad82('0x13c'),'foreignKey':'FromId'});db[_0xad82('0xca')][_0xad82('0x11b')](db[_0xad82('0x12')],{'onDelete':_0xad82('0x13c'),'foreignKey':_0xad82('0x1c9')});db[_0xad82('0xd0')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0xad82('0x1ca'),'onDelete':_0xad82('0x13c')});db[_0xad82('0xd0')][_0xad82('0x10e')](db[_0xad82('0xcc')],{'foreignKey':_0xad82('0x1ca'),'onDelete':_0xad82('0x13c')});db[_0xad82('0xd2')][_0xad82('0x11b')](db[_0xad82('0x54')],{});db[_0xad82('0xd2')][_0xad82('0x11b')](db[_0xad82('0xf1')],{'as':_0xad82('0x170'),'foreignKey':_0xad82('0x15e')});db['SmsQueueReport'][_0xad82('0x11b')](db[_0xad82('0x154')],{'as':_0xad82('0x155'),'foreignKey':_0xad82('0x156')});db[_0xad82('0xd2')][_0xad82('0x11b')](db[_0xad82('0x58')],{});db[_0xad82('0xd2')][_0xad82('0x11b')](db[_0xad82('0x5a')],{});db[_0xad82('0xd2')]['belongsTo'](db['User'],{});db[_0xad82('0xd2')]['belongsTo'](db[_0xad82('0x5b')],{});db[_0xad82('0xd8')][_0xad82('0x10e')](db[_0xad82('0xd0')],{'foreignKey':'ProjectId'});db[_0xad82('0xd8')][_0xad82('0x10e')](db[_0xad82('0xce')],{'foreignKey':'ProjectId'});db[_0xad82('0xd8')][_0xad82('0x10e')](db[_0xad82('0xcc')],{'foreignKey':'ProjectId'});db[_0xad82('0xde')][_0xad82('0x11d')](db[_0xad82('0x12')],{'as':_0xad82('0x169'),'through':_0xad82('0x1cb')});db[_0xad82('0x14c')][_0xad82('0x11d')](db[_0xad82('0x12')],{'as':_0xad82('0x14b'),'through':'user_has_teams'});db[_0xad82('0x14c')][_0xad82('0x11d')](db[_0xad82('0x1b')],{'through':_0xad82('0x10a'),'as':_0xad82('0x1cc')});db[_0xad82('0x14c')][_0xad82('0x11d')](db['MailQueue'],{'through':_0xad82('0x1cd'),'as':'MailQueues'});db[_0xad82('0x14c')][_0xad82('0x11d')](db['ChatQueue'],{'through':_0xad82('0x18f'),'as':_0xad82('0x127')});db[_0xad82('0x14c')][_0xad82('0x11d')](db[_0xad82('0x128')],{'through':_0xad82('0x1ce'),'as':_0xad82('0x129')});db[_0xad82('0x14c')]['belongsToMany'](db[_0xad82('0x5b')],{'through':_0xad82('0x180'),'as':_0xad82('0x12a')});db[_0xad82('0x14c')][_0xad82('0x11d')](db[_0xad82('0x63')],{'through':_0xad82('0x187'),'as':_0xad82('0x1cf')});db[_0xad82('0x14c')][_0xad82('0x11d')](db[_0xad82('0x106')],{'through':'team_has_whatsapp_queues','as':_0xad82('0x12c')});db[_0xad82('0x196')][_0xad82('0x10e')](db[_0xad82('0x141')],{'as':'Hoppers','foreignKey':_0xad82('0x197')});db['Campaign'][_0xad82('0x10e')](db['CmHopperFinal'],{'as':_0xad82('0x142'),'foreignKey':_0xad82('0x197')});db[_0xad82('0x196')]['hasMany'](db[_0xad82('0x7a')],{'as':_0xad82('0x143'),'foreignKey':'CampaignId'});db[_0xad82('0x196')][_0xad82('0x10e')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xad82('0x197')});db['Campaign'][_0xad82('0x11b')](db[_0xad82('0x2b')],{'as':_0xad82('0x2b'),'foreignKey':'TrunkId'});db['Campaign']['belongsTo'](db[_0xad82('0x2b')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0xad82('0x196')][_0xad82('0x11b')](db[_0xad82('0x148')],{'as':_0xad82('0x148'),'foreignKey':_0xad82('0x149')});db['Campaign'][_0xad82('0x11b')](db[_0xad82('0xde')],{'as':_0xad82('0xde'),'foreignKey':_0xad82('0x1d0')});db[_0xad82('0x196')][_0xad82('0x11d')](db[_0xad82('0xf1')],{'as':_0xad82('0x121'),'through':_0xad82('0x1d1')});db[_0xad82('0x196')][_0xad82('0x11d')](db[_0xad82('0xf1')],{'as':'BlackLists','through':_0xad82('0x1d2')});db[_0xad82('0xe7')]['belongsTo'](db[_0xad82('0x6d')],{'as':_0xad82('0x6d'),'foreignKey':_0xad82('0x16d')});db[_0xad82('0x1d3')][_0xad82('0x11b')](db[_0xad82('0x43')],{});db['MailTransferReport'][_0xad82('0x11b')](db['MailInteraction'],{});db['MailTransferReport']['belongsTo'](db['MailAccount'],{'foreignKey':_0xad82('0x1d4'),'as':_0xad82('0x1d5')});db['MailTransferReport'][_0xad82('0x11b')](db['User'],{'foreignKey':_0xad82('0x1d6'),'as':_0xad82('0x1d7')});db[_0xad82('0x1d3')][_0xad82('0x11b')](db[_0xad82('0x12')],{'foreignKey':_0xad82('0x1d8'),'as':_0xad82('0x1d9')});db[_0xad82('0x1d3')][_0xad82('0x11b')](db[_0xad82('0x3d')],{'foreignKey':_0xad82('0x1da'),'as':_0xad82('0x1db')});db[_0xad82('0x1d3')][_0xad82('0x11b')](db['MailAccount'],{'foreignKey':_0xad82('0x1dc'),'as':_0xad82('0x1dd')});db[_0xad82('0xeb')]['belongsTo'](db[_0xad82('0x18e')],{});db[_0xad82('0xeb')][_0xad82('0x11b')](db[_0xad82('0x114')],{});db['ChatTransferReport'][_0xad82('0x11b')](db[_0xad82('0x65')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0xad82('0xeb')][_0xad82('0x11b')](db[_0xad82('0x12')],{'foreignKey':_0xad82('0x1d6'),'as':_0xad82('0x1d7')});db[_0xad82('0xeb')][_0xad82('0x11b')](db[_0xad82('0x12')],{'foreignKey':_0xad82('0x1d8'),'as':_0xad82('0x1d9')});db['ChatTransferReport'][_0xad82('0x11b')](db[_0xad82('0x6f')],{'foreignKey':_0xad82('0x1de'),'as':_0xad82('0x1db')});db['ChatTransferReport']['belongsTo'](db[_0xad82('0x65')],{'foreignKey':_0xad82('0x1df'),'as':_0xad82('0x1dd')});db['FaxTransferReport']['belongsTo'](db[_0xad82('0x4f')],{});db['FaxTransferReport'][_0xad82('0x11b')](db['FaxInteraction'],{});db['FaxTransferReport']['belongsTo'](db[_0xad82('0x4a')],{'foreignKey':_0xad82('0x1e0'),'as':_0xad82('0x1d5')});db[_0xad82('0xed')][_0xad82('0x11b')](db[_0xad82('0x12')],{'foreignKey':'FromUserId','as':_0xad82('0x1d7')});db[_0xad82('0xed')][_0xad82('0x11b')](db['User'],{'foreignKey':_0xad82('0x1d8'),'as':_0xad82('0x1d9')});db['FaxTransferReport']['belongsTo'](db[_0xad82('0x128')],{'foreignKey':_0xad82('0x1e1'),'as':_0xad82('0x1db')});db[_0xad82('0xed')][_0xad82('0x11b')](db['FaxAccount'],{'foreignKey':_0xad82('0x1e2'),'as':_0xad82('0x1dd')});db[_0xad82('0x1e3')][_0xad82('0x11b')](db['OpenchannelMessage'],{});db[_0xad82('0x1e3')][_0xad82('0x11b')](db[_0xad82('0x112')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0xad82('0x5d')],{'foreignKey':_0xad82('0x1e4'),'as':_0xad82('0x1d5')});db[_0xad82('0x1e3')]['belongsTo'](db[_0xad82('0x12')],{'foreignKey':_0xad82('0x1d6'),'as':_0xad82('0x1d7')});db[_0xad82('0x1e3')]['belongsTo'](db[_0xad82('0x12')],{'foreignKey':_0xad82('0x1d8'),'as':_0xad82('0x1d9')});db[_0xad82('0x1e3')][_0xad82('0x11b')](db['OpenchannelQueue'],{'foreignKey':_0xad82('0x1e5'),'as':_0xad82('0x1db')});db[_0xad82('0x1e3')]['belongsTo'](db[_0xad82('0x5d')],{'foreignKey':'ToOpenchannelAccountId','as':_0xad82('0x1dd')});db[_0xad82('0xf0')][_0xad82('0x11b')](db[_0xad82('0x5a')],{});db['SmsTransferReport'][_0xad82('0x11b')](db[_0xad82('0x58')],{});db[_0xad82('0xf0')]['belongsTo'](db[_0xad82('0x54')],{'foreignKey':_0xad82('0x1e6'),'as':_0xad82('0x1d5')});db['SmsTransferReport'][_0xad82('0x11b')](db[_0xad82('0x12')],{'foreignKey':_0xad82('0x1d6'),'as':_0xad82('0x1d7')});db[_0xad82('0xf0')][_0xad82('0x11b')](db[_0xad82('0x12')],{'foreignKey':'ToUserId','as':_0xad82('0x1d9')});db['SmsTransferReport'][_0xad82('0x11b')](db['SmsQueue'],{'foreignKey':_0xad82('0x1e7'),'as':_0xad82('0x1db')});db[_0xad82('0xf0')]['belongsTo'](db[_0xad82('0x54')],{'foreignKey':_0xad82('0x1e8'),'as':'ToAccount'});db[_0xad82('0xf1')]['hasMany'](db[_0xad82('0x15a')],{'as':'Dispositions','foreignKey':'ListId'});db[_0xad82('0xf1')][_0xad82('0x10e')](db[_0xad82('0x1e9')],{'as':_0xad82('0x1ea'),'foreignKey':_0xad82('0x15e')});db[_0xad82('0xf1')][_0xad82('0x10e')](db[_0xad82('0x154')],{'as':_0xad82('0x120'),'onDelete':'cascade','foreignKey':'ListId'});db[_0xad82('0xf1')][_0xad82('0x10e')](db[_0xad82('0x110')],{'as':_0xad82('0x142'),'foreignKey':_0xad82('0x15e')});db[_0xad82('0xf1')][_0xad82('0x10e')](db[_0xad82('0x7a')],{'as':_0xad82('0x111'),'foreignKey':'ListId'});db[_0xad82('0xf1')][_0xad82('0x10e')](db[_0xad82('0x7b')],{'as':_0xad82('0x7b'),'foreignKey':_0xad82('0x15e')});db[_0xad82('0xf1')][_0xad82('0x11d')](db['VoiceQueue'],{'as':'Queues','through':_0xad82('0x14a')});db[_0xad82('0xf1')][_0xad82('0x11d')](db[_0xad82('0x12')],{'as':_0xad82('0x14b'),'through':_0xad82('0x12e')});db[_0xad82('0xf3')][_0xad82('0x10e')](db[_0xad82('0x18')],{'as':_0xad82('0x1eb'),'onDelete':'cascade'});db['VoicePrefix'][_0xad82('0x11d')](db[_0xad82('0x12')],{'as':_0xad82('0x14b'),'through':_0xad82('0x1ec')});db[_0xad82('0xf5')][_0xad82('0x10e')](db[_0xad82('0x12')],{'as':_0xad82('0x169'),'foreignKey':'userProfileId'});db[_0xad82('0xf5')][_0xad82('0x10e')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0xad82('0x11c'),'onDelete':'cascade'});db[_0xad82('0xf7')][_0xad82('0x10e')](db[_0xad82('0xf9')],{'as':'Resources','foreignKey':_0xad82('0x1ed'),'onDelete':'cascade'});db['WhatsappAccount']['hasMany'](db[_0xad82('0x15a')],{'as':_0xad82('0x15b'),'foreignKey':_0xad82('0x1ee')});db[_0xad82('0x1ef')]['hasMany'](db[_0xad82('0x81')],{'as':'Answers','foreignKey':_0xad82('0x1ee')});db[_0xad82('0x1ef')][_0xad82('0x10e')](db[_0xad82('0x101')],{'as':_0xad82('0x15d'),'foreignKey':_0xad82('0x1ee')});db['WhatsappAccount'][_0xad82('0x10e')](db[_0xad82('0xff')],{'as':'Interactions'});db[_0xad82('0x1ef')][_0xad82('0x10e')](db['WhatsappApplication'],{'as':_0xad82('0x175')});db[_0xad82('0x1ef')]['belongsTo'](db['CmList'],{'as':_0xad82('0x170'),'foreignKey':_0xad82('0x15e')});db[_0xad82('0x1ef')][_0xad82('0x11b')](db[_0xad82('0x84')],{'as':_0xad82('0x161'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0xad82('0x11d')](db[_0xad82('0x12')],{'as':'Agents','through':_0xad82('0x13a')});db[_0xad82('0xfd')][_0xad82('0x11b')](db[_0xad82('0x12')],{'onDelete':_0xad82('0x16e')});db['WhatsappApplication']['belongsTo'](db[_0xad82('0x106')],{'onDelete':_0xad82('0x16e')});db[_0xad82('0xfd')][_0xad82('0x11b')](db['WhatsappAccount'],{'onDelete':_0xad82('0x16e')});db['WhatsappApplication'][_0xad82('0x11b')](db[_0xad82('0x148')],{'onDelete':_0xad82('0x16e'),'foreignKey':'IntervalId'});db[_0xad82('0xfd')][_0xad82('0x11b')](db[_0xad82('0x166')],{'onDelete':_0xad82('0x16e'),'foreignKey':_0xad82('0x16f')});db['WhatsappInteraction'][_0xad82('0x10e')](db[_0xad82('0x101')],{'as':_0xad82('0x15d'),'onDelete':'cascade','foreignKey':_0xad82('0x1f0')});db[_0xad82('0xff')]['belongsTo'](db[_0xad82('0x1ef')],{'as':'Account','foreignKey':_0xad82('0x1ee')});db[_0xad82('0xff')][_0xad82('0x11b')](db[_0xad82('0x154')],{'as':_0xad82('0x155'),'foreignKey':_0xad82('0x156')});db[_0xad82('0xff')][_0xad82('0x11b')](db[_0xad82('0x12')],{'as':_0xad82('0x178'),'foreignKey':'UserId'});db[_0xad82('0xff')][_0xad82('0x11d')](db[_0xad82('0x166')],{'through':_0xad82('0x1f1'),'as':_0xad82('0x167')});db[_0xad82('0xff')][_0xad82('0x11d')](db[_0xad82('0x166')],{'through':'whatsapp_interaction_has_tags','as':_0xad82('0x17a')});db[_0xad82('0xff')][_0xad82('0x11d')](db[_0xad82('0x12')],{'as':_0xad82('0x169'),'through':_0xad82('0x126'),'foreignKey':_0xad82('0x1f0')});db['WhatsappMessage']['belongsTo'](db[_0xad82('0x12')],{'as':_0xad82('0x12')});db[_0xad82('0x101')][_0xad82('0x11b')](db['CmContact'],{'onDelete':_0xad82('0x13c'),'as':_0xad82('0x155')});db['WhatsappMessage']['belongsTo'](db[_0xad82('0xff')],{'onDelete':'cascade','as':_0xad82('0x17b'),'foreignKey':_0xad82('0x1f0')});db[_0xad82('0x101')]['belongsTo'](db[_0xad82('0x1ef')],{'as':_0xad82('0x165'),'foreignKey':'WhatsappAccountId'});db[_0xad82('0x103')]['belongsTo'](db[_0xad82('0x1ef')],{});db[_0xad82('0x103')][_0xad82('0x11b')](db[_0xad82('0xf1')],{'as':_0xad82('0x170'),'foreignKey':_0xad82('0x15e')});db['WhatsappQueueReport'][_0xad82('0x11b')](db[_0xad82('0x154')],{'as':_0xad82('0x155'),'foreignKey':'ContactId'});db[_0xad82('0x103')]['belongsTo'](db[_0xad82('0xff')],{});db[_0xad82('0x103')][_0xad82('0x11b')](db[_0xad82('0x106')],{});db[_0xad82('0x103')][_0xad82('0x11b')](db[_0xad82('0x101')],{});db[_0xad82('0x103')][_0xad82('0x11b')](db['User'],{});db[_0xad82('0x104')][_0xad82('0x11b')](db[_0xad82('0x101')],{});db[_0xad82('0x104')]['belongsTo'](db[_0xad82('0xff')],{});db[_0xad82('0x104')]['belongsTo'](db[_0xad82('0x1ef')],{'foreignKey':_0xad82('0x1f2'),'as':_0xad82('0x1d5')});db[_0xad82('0x104')][_0xad82('0x11b')](db[_0xad82('0x1ef')],{'foreignKey':_0xad82('0x1f3'),'as':_0xad82('0x1dd')});db[_0xad82('0x104')][_0xad82('0x11b')](db['WhatsappQueue'],{'foreignKey':_0xad82('0x1f4'),'as':_0xad82('0x1db')});db[_0xad82('0x104')][_0xad82('0x11b')](db[_0xad82('0x12')],{'foreignKey':_0xad82('0x1d6'),'as':_0xad82('0x1d7')});db[_0xad82('0x104')]['belongsTo'](db[_0xad82('0x12')],{'foreignKey':_0xad82('0x1d8'),'as':_0xad82('0x1d9')});db['WhatsappQueue']['belongsToMany'](db[_0xad82('0x12')],{'as':_0xad82('0x14b'),'through':_0xad82('0x12d'),'foreignKey':'WhatsappQueueId'});db[_0xad82('0x106')][_0xad82('0x11d')](db[_0xad82('0x14c')],{'through':'team_has_whatsapp_queues','as':_0xad82('0x14d')});module[_0xad82('0x1f5')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xd599=['UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_sms_accounts','WhatsappAccount','user_has_whatsapp_accounts','SquareProject','user_has_square_projects','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','AgentReports','uniqueid','ContactId','MailServerIn','MailAccountId','MailServerOut','Imap','Smtp','Answers','Interactions','List','TemplateId','mandatoryDispositionPause','team_has_mail_queues','Account','Contact','Owner','mail_interaction_has_tags','Tags','Users','MailInteractionId','Attachments','Interaction','ChatOfflineMessage','ChatOfflineMessageId','restrict','TagId','MailQueueReport','ListId','Dashboard','DashboardItem','Items','FaxAccountId','Exntensions','fax_interaction_has_tags','ThroughTags','FaxInteractionId','AttachmentId','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelInteractionId','Dispositions','ChatWebsiteId','ProactiveActions','OpenchannelQueueReport','Queue','ChatMessage','ChatInteractionId','chat_interaction_has_tags','UserChatQueue','ChatGroupId','chat_group_has_users','Website','JscriptySessions','CompanyId','cm_contact_has_tags','Agent','CampaignId','OwnerId','All','AutomationAllId','Any','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','SmsApplications','Schedule','AnalyticDefaultReport','DefaultReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','CustomReportId','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','SubjectId','DeskAccount','DeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','FreshsalesField','ChatQueueReport','ToId','SessionId','JscriptyAnswerReport','ProjectId','MailQueues','team_has_fax_queues','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','ToFaxAccountId','ToAccount','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','Resources','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','jstz','determine','sequelize','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','name','database','password','username','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','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','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','UserId','hasMany','VoiceRecording','UserVoiceQueueRt','VoiceQueuesRt','Extensions','cascade','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','UserProfile','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_whatsapp_interactions','VoiceQueues','ChatQueues','FaxQueues'];(function(_0x151302,_0x4f7bce){var _0x31528d=function(_0xb1b4ac){while(--_0xb1b4ac){_0x151302['push'](_0x151302['shift']());}};_0x31528d(++_0x4f7bce);}(_0xd599,0xbf));var _0x9d59=function(_0x424f76,_0x50e784){_0x424f76=_0x424f76-0x0;var _0x30036c=_0xd599[_0x424f76];return _0x30036c;};'use strict';var path=require(_0x9d59('0x0'));var config=require(_0x9d59('0x1'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x9d59('0x2'));var timezone=jstz[_0x9d59('0x3')]();config[_0x9d59('0x4')]=_[_0x9d59('0x5')](config[_0x9d59('0x4')],{'database':'motion2','username':_0x9d59('0x6'),'password':_0x9d59('0x7'),'options':{'host':_0x9d59('0x8'),'port':0xcea,'dialect':_0x9d59('0x9'),'dialectOptions':{'charset':_0x9d59('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x9d59('0xb'),'collate':_0x9d59('0xc')}}});config['sequelizeHistory']=_[_0x9d59('0x5')](config[_0x9d59('0xd')],{'database':'motion2','username':_0x9d59('0x6'),'password':_0x9d59('0x7'),'options':{'host':_0x9d59('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x9d59('0xe')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9d59('0x4')][_0x9d59('0xf')],config[_0x9d59('0x4')]['username'],config[_0x9d59('0x4')][_0x9d59('0x10')],config[_0x9d59('0x4')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9d59('0xd')][_0x9d59('0xf')],config[_0x9d59('0xd')][_0x9d59('0x11')],config[_0x9d59('0xd')][_0x9d59('0x10')],config[_0x9d59('0xd')][_0x9d59('0x12')])};db[_0x9d59('0x13')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/user/user.model');db[_0x9d59('0x15')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x16'));db[_0x9d59('0x17')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x18'));db[_0x9d59('0x19')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x1a'));db[_0x9d59('0x1b')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x1c'));db[_0x9d59('0x1d')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x1e'));db['VoiceRecording']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x1f'));db[_0x9d59('0x20')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/screenRecording/screenRecording.model');db[_0x9d59('0x21')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x22'));db[_0x9d59('0x23')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x9d59('0x24')]=db['sequelize']['import'](_0x9d59('0x25'));db['VoiceDialReport']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x26'));db[_0x9d59('0x27')]=db['sequelize'][_0x9d59('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x9d59('0x28')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x29'));db[_0x9d59('0x2a')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x2b'));db[_0x9d59('0x2c')]=db[_0x9d59('0x4')]['import']('../api/trunk/trunk.model');db[_0x9d59('0x2d')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x2e'));db['UserVoiceQueueRt']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x2f'));db[_0x9d59('0x30')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x31'));db['UserChatQueue']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x32'));db[_0x9d59('0x33')]=db['sequelize']['import'](_0x9d59('0x34'));db['UserFaxQueue']=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/userFaxQueue/userFaxQueue.model');db[_0x9d59('0x35')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x36'));db[_0x9d59('0x37')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x38'));db[_0x9d59('0x39')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x3a'));db['MailServerIn']=db[_0x9d59('0x4')]['import'](_0x9d59('0x3b'));db['MailServerOut']=db[_0x9d59('0x4')]['import'](_0x9d59('0x3c'));db[_0x9d59('0x3d')]=db['sequelize']['import']('../api/mailAccount/mailAccount.model');db[_0x9d59('0x3e')]=db['sequelize'][_0x9d59('0x14')]('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db[_0x9d59('0x4')]['import'](_0x9d59('0x3f'));db[_0x9d59('0x40')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/mailInteraction/mailInteraction.model');db[_0x9d59('0x41')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x42'));db[_0x9d59('0x43')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x44'));db['MailQueueReport']=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0x9d59('0x4')]['import'](_0x9d59('0x45'));db['DashboardItem']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x46'));db[_0x9d59('0x47')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x48'));db[_0x9d59('0x49')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x4a'));db[_0x9d59('0x4b')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x4c'));db[_0x9d59('0x4d')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x4e'));db[_0x9d59('0x4f')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x50'));db[_0x9d59('0x51')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x52'));db[_0x9d59('0x53')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x54'));db['SmsApplication']=db[_0x9d59('0x4')]['import'](_0x9d59('0x55'));db[_0x9d59('0x56')]=db[_0x9d59('0x4')]['import'](_0x9d59('0x57'));db[_0x9d59('0x58')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x59'));db[_0x9d59('0x5a')]=db['sequelize']['import'](_0x9d59('0x5b'));db[_0x9d59('0x5c')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x5d'));db[_0x9d59('0x5e')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x5f'));db[_0x9d59('0x60')]=db[_0x9d59('0x4')]['import'](_0x9d59('0x61'));db[_0x9d59('0x62')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x63'));db[_0x9d59('0x64')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/openchannelQueue/openchannelQueue.model');db[_0x9d59('0x65')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x66'));db['OpenchannelQueueReport']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x67'));db[_0x9d59('0x68')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x69'));db[_0x9d59('0x6a')]=db[_0x9d59('0x4')]['import']('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x6b'));db[_0x9d59('0x6c')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x6d'));db[_0x9d59('0x6e')]=db['sequelize'][_0x9d59('0x14')]('../api/chatGroup/chatGroup.model');db[_0x9d59('0x6f')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x70'));db[_0x9d59('0x71')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/cmCompany/cmCompany.model');db[_0x9d59('0x72')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x73'));db[_0x9d59('0x74')]=db[_0x9d59('0x4')]['import'](_0x9d59('0x75'));db['CmHopperBlack']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x76'));db[_0x9d59('0x77')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x78'));db[_0x9d59('0x79')]=db[_0x9d59('0x4')]['import'](_0x9d59('0x7a'));db[_0x9d59('0x7b')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x9d59('0x7c')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x7d'));db[_0x9d59('0x7e')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x7f'));db[_0x9d59('0x80')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x81'));db[_0x9d59('0x82')]=db[_0x9d59('0x4')]['import'](_0x9d59('0x83'));db[_0x9d59('0x84')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/disposition/disposition.model');db[_0x9d59('0x85')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/condition/condition.model');db[_0x9d59('0x86')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/interval/interval.model');db[_0x9d59('0x87')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x88'));db[_0x9d59('0x89')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x8a'));db[_0x9d59('0x8b')]=db[_0x9d59('0x4')]['import'](_0x9d59('0x8c'));db['Schedule']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x8d'));db[_0x9d59('0x8e')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x8f'));db[_0x9d59('0x90')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/tag/tag.model');db[_0x9d59('0x91')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/template/template.model');db[_0x9d59('0x92')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x93'));db[_0x9d59('0x94')]=db['sequelize'][_0x9d59('0x14')]('../api/variable/variable.model');db[_0x9d59('0x95')]=db['sequelize']['import'](_0x9d59('0x96'));db[_0x9d59('0x97')]=db['sequelize']['import'](_0x9d59('0x98'));db[_0x9d59('0x99')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x9a'));db['AnalyticDefaultReport']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x9b'));db['AnalyticExtractedReport']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x9c'));db['AnalyticMetric']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x9d'));db[_0x9d59('0x9e')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x9f'));db[_0x9d59('0xa0')]=db[_0x9d59('0x4')]['import'](_0x9d59('0xa1'));db[_0x9d59('0xa2')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xa3'));db[_0x9d59('0xa4')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xa5'));db[_0x9d59('0xa6')]=db['sequelize'][_0x9d59('0x14')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xa7'));db[_0x9d59('0xa8')]=db['sequelize']['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x9d59('0xa9')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xaa'));db[_0x9d59('0xab')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xac'));db['DeskField']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xad'));db[_0x9d59('0xae')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xaf'));db[_0x9d59('0xb0')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x9d59('0xb1')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intZohoField/intZohoField.model');db[_0x9d59('0xb2')]=db['sequelize']['import'](_0x9d59('0xb3'));db[_0x9d59('0xb4')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xb5'));db[_0x9d59('0xb6')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intZendeskField/intZendeskField.model');db[_0x9d59('0xb7')]=db[_0x9d59('0x4')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x9d59('0xb8')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x9d59('0xb9')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xba'));db[_0x9d59('0xbb')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xbc'));db['VtigerConfiguration']=db[_0x9d59('0x4')]['import'](_0x9d59('0xbd'));db['VtigerField']=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intVtigerField/intVtigerField.model');db[_0x9d59('0xbe')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x9d59('0xbf')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xc0'));db[_0x9d59('0xc1')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xc2'));db[_0x9d59('0xc3')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xc4'));db[_0x9d59('0xc5')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x9d59('0xc6')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x9d59('0xc7')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xc8'));db[_0x9d59('0xc9')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xca'));db['FreshsalesField']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xcb'));db['Integration']=db['sequelize'][_0x9d59('0x14')]('../api/integration/integration.model');db[_0x9d59('0xcc')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xcd'));db['ChatQueueReport']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xce'));db[_0x9d59('0xcf')]=db[_0x9d59('0x4')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xd0'));db[_0x9d59('0xd1')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xd2'));db[_0x9d59('0xd3')]=db['sequelize'][_0x9d59('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x9d59('0xd4')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xd5'));db[_0x9d59('0xd6')]=db[_0x9d59('0x4')]['import'](_0x9d59('0xd7'));db[_0x9d59('0xd8')]=db['sequelize']['import'](_0x9d59('0xd9'));db[_0x9d59('0xda')]=db[_0x9d59('0x4')]['import'](_0x9d59('0xdb'));db[_0x9d59('0xdc')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xdd'));db[_0x9d59('0xde')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xdf'));db['SquareProject']=db['sequelize'][_0x9d59('0x14')]('../api/squareProject/squareProject.model');db[_0x9d59('0xe0')]=db[_0x9d59('0x4')]['import'](_0x9d59('0xe1'));db[_0x9d59('0xe2')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xe3'));db[_0x9d59('0xe4')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xe5'));db[_0x9d59('0xe6')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xe7'));db[_0x9d59('0xe8')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xe9'));db[_0x9d59('0xea')]=db[_0x9d59('0x4')]['import']('../api/migration/migration.model');db[_0x9d59('0xeb')]=db[_0x9d59('0x4')]['import']('../api/attachment/attachment.model');db['Plugin']=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/plugin/plugin.model');db[_0x9d59('0xec')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xed'));db[_0x9d59('0xee')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xef'));db[_0x9d59('0xf0')]=db[_0x9d59('0x4')]['import'](_0x9d59('0xf1'));db[_0x9d59('0xf2')]=db['sequelize']['import'](_0x9d59('0xf3'));db[_0x9d59('0xf4')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xf5'));db['CmList']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xf6'));db[_0x9d59('0xf7')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xf8'));db['UserProfile']=db['sequelize']['import'](_0x9d59('0xf9'));db[_0x9d59('0xfa')]=db['sequelize']['import'](_0x9d59('0xfb'));db[_0x9d59('0xfc')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xfd'));db[_0x9d59('0xfe')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/userNotification/userNotification.model');db['WhatsappAccount']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xff'));db[_0x9d59('0x100')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/whatsappApplication/whatsappApplication.model');db[_0x9d59('0x101')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x102'));db[_0x9d59('0x103')]=db[_0x9d59('0x4')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x9d59('0x104')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x105'));db[_0x9d59('0x106')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x107'));db[_0x9d59('0x108')]=db[_0x9d59('0x4')]['import']('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x109'));db[_0x9d59('0x10a')]=db[_0x9d59('0x4')]['import'](_0x9d59('0x10b'));db[_0x9d59('0x13')][_0x9d59('0x10c')](db[_0x9d59('0x21')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')][_0x9d59('0x10e')](db[_0x9d59('0x10f')],{'as':'Recordings','foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')][_0x9d59('0x10e')](db[_0x9d59('0x110')],{'as':_0x9d59('0x111'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')][_0x9d59('0x10e')](db['VoiceExtension'],{'as':_0x9d59('0x112'),'onDelete':_0x9d59('0x113'),'hooks':!![]});db[_0x9d59('0x13')][_0x9d59('0x10e')](db['CmHopperFinal'],{'as':_0x9d59('0x114'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')][_0x9d59('0x10e')](db[_0x9d59('0x79')],{'as':_0x9d59('0x115'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')]['hasMany'](db[_0x9d59('0x7b')],{'as':_0x9d59('0x7b'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')][_0x9d59('0x10e')](db[_0x9d59('0x60')],{'as':_0x9d59('0x116'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')][_0x9d59('0x10e')](db[_0x9d59('0x6a')],{'as':_0x9d59('0x117'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')][_0x9d59('0x10e')](db[_0x9d59('0x56')],{'as':_0x9d59('0x118'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')]['hasMany'](db[_0x9d59('0x4b')],{'as':_0x9d59('0x119'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')][_0x9d59('0x10e')](db[_0x9d59('0x40')],{'as':_0x9d59('0x11a'),'foreignKey':_0x9d59('0x10d')});db['User'][_0x9d59('0x10e')](db[_0x9d59('0x101')],{'as':_0x9d59('0x11b'),'foreignKey':'UserId'});db['User'][_0x9d59('0x10e')](db[_0x9d59('0xfe')],{'as':_0x9d59('0x11c'),'foreignKey':_0x9d59('0x11d')});db[_0x9d59('0x13')][_0x9d59('0x11e')](db[_0x9d59('0x11f')],{'as':_0x9d59('0x11f'),'foreignKey':_0x9d59('0x120')});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x6e')],{'as':_0x9d59('0x122'),'through':'chat_group_has_users'});db['User'][_0x9d59('0x121')](db['CmContact'],{'as':_0x9d59('0x123'),'through':_0x9d59('0x124')});db[_0x9d59('0x13')]['belongsToMany'](db[_0x9d59('0x125')],{'as':_0x9d59('0x126'),'through':_0x9d59('0x127')});db[_0x9d59('0x13')]['belongsToMany'](db[_0x9d59('0xe4')],{'through':_0x9d59('0x128')});db[_0x9d59('0x13')]['belongsToMany'](db[_0x9d59('0x40')],{'as':_0x9d59('0x11a'),'through':_0x9d59('0x129')});db[_0x9d59('0x13')]['belongsToMany'](db[_0x9d59('0x6a')],{'as':_0x9d59('0x117'),'through':_0x9d59('0x12a')});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x4b')],{'as':'FaxInteractions','through':_0x9d59('0x12b')});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x56')],{'as':_0x9d59('0x118'),'through':'user_has_sms_interactions'});db[_0x9d59('0x13')]['belongsToMany'](db['OpenchannelInteraction'],{'as':_0x9d59('0x116'),'through':'user_has_openchannel_interactions'});db['User'][_0x9d59('0x121')](db['WhatsappInteraction'],{'as':_0x9d59('0x11b'),'through':_0x9d59('0x12c')});db[_0x9d59('0x13')][_0x9d59('0x121')](db['VoiceQueue'],{'as':_0x9d59('0x12d'),'through':_0x9d59('0x30'),'required':![]});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x3e')],{'as':'MailQueues','through':_0x9d59('0x33'),'required':![]});db[_0x9d59('0x13')]['belongsToMany'](db[_0x9d59('0x6c')],{'as':_0x9d59('0x12e'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x9d59('0x13')]['belongsToMany'](db['FaxQueue'],{'as':_0x9d59('0x12f'),'through':_0x9d59('0x130'),'required':![]});db[_0x9d59('0x13')]['belongsToMany'](db['SmsQueue'],{'as':_0x9d59('0x131'),'through':_0x9d59('0x35'),'required':![]});db[_0x9d59('0x13')][_0x9d59('0x121')](db['OpenchannelQueue'],{'as':_0x9d59('0x132'),'through':_0x9d59('0x37'),'required':![]});db['User'][_0x9d59('0x121')](db[_0x9d59('0x108')],{'as':_0x9d59('0x133'),'through':'UserWhatsappQueue','required':![]});db[_0x9d59('0x13')][_0x9d59('0x121')](db['CmList'],{'through':_0x9d59('0x127')});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0xf7')],{'as':_0x9d59('0x134'),'through':_0x9d59('0x135'),'required':![]});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x65')],{'as':_0x9d59('0x136'),'through':_0x9d59('0x137')});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x47')],{'as':_0x9d59('0x138'),'through':_0x9d59('0x139')});db[_0x9d59('0x13')][_0x9d59('0x121')](db['MailAccount'],{'as':_0x9d59('0x13a'),'through':_0x9d59('0x13b')});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x5c')],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db['User'][_0x9d59('0x121')](db[_0x9d59('0x53')],{'as':'SmsAccounts','through':_0x9d59('0x13c')});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x13d')],{'as':'WhatsappAccounts','through':_0x9d59('0x13e')});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x13f')],{'as':'SquareProjects','through':_0x9d59('0x140')});db['VoiceChanSpy']['hasMany'](db[_0x9d59('0x19')],{'as':'SpiedAgents','onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x141')});db[_0x9d59('0x17')][_0x9d59('0x10e')](db[_0x9d59('0x19')],{'onDelete':_0x9d59('0x113')});db[_0x9d59('0x19')][_0x9d59('0x10e')](db[_0x9d59('0x19')],{'as':_0x9d59('0x142'),'onDelete':_0x9d59('0x113')});db[_0x9d59('0x1b')][_0x9d59('0x121')](db['Sound'],{'as':_0x9d59('0x143'),'through':'moh_has_sounds'});db[_0x9d59('0x1d')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x9d59('0x144'),'foreignKey':_0x9d59('0x145')});db[_0x9d59('0x1d')][_0x9d59('0x10e')](db[_0x9d59('0x74')],{'as':_0x9d59('0x146'),'foreignKey':_0x9d59('0x145')});db[_0x9d59('0x1d')][_0x9d59('0x10e')](db[_0x9d59('0x77')],{'as':'HopperFinals','foreignKey':_0x9d59('0x145')});db[_0x9d59('0x1d')][_0x9d59('0x10e')](db[_0x9d59('0x79')],{'as':_0x9d59('0x147'),'foreignKey':'VoiceQueueId'});db[_0x9d59('0x1d')][_0x9d59('0x10e')](db[_0x9d59('0x7b')],{'as':_0x9d59('0x7b'),'foreignKey':_0x9d59('0x145')});db[_0x9d59('0x1d')][_0x9d59('0x10e')](db[_0x9d59('0x148')],{'as':_0x9d59('0x149'),'foreignKey':'VoiceQueueId'});db[_0x9d59('0x1d')]['hasMany'](db[_0x9d59('0xd3')],{'as':'JscriptySessions','foreignKey':_0x9d59('0x145')});db[_0x9d59('0x1d')][_0x9d59('0x11e')](db['Trunk'],{'as':_0x9d59('0x2c'),'foreignKey':_0x9d59('0x14a')});db[_0x9d59('0x1d')]['belongsTo'](db[_0x9d59('0x2c')],{'as':_0x9d59('0x14b'),'foreignKey':_0x9d59('0x14c')});db[_0x9d59('0x1d')][_0x9d59('0x11e')](db[_0x9d59('0x86')],{'as':_0x9d59('0x86'),'foreignKey':_0x9d59('0x14d')});db[_0x9d59('0x1d')][_0x9d59('0x11e')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x9d59('0x14e')});db[_0x9d59('0x1d')]['belongsToMany'](db[_0x9d59('0x125')],{'as':'Lists','through':_0x9d59('0x14f')});db[_0x9d59('0x1d')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x150'),'through':_0x9d59('0x30')});db[_0x9d59('0x1d')][_0x9d59('0x121')](db[_0x9d59('0xe4')],{'as':_0x9d59('0x151'),'through':'TeamVoiceQueue'});db['VoiceQueue']['belongsToMany'](db[_0x9d59('0x125')],{'as':_0x9d59('0x152'),'through':_0x9d59('0x153')});db[_0x9d59('0x10f')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':'User','foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x20')][_0x9d59('0x11e')](db['User'],{'as':_0x9d59('0x13'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x21')][_0x9d59('0x10e')](db[_0x9d59('0x23')],{'as':_0x9d59('0x154'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x155'),'sourceKey':_0x9d59('0x156')});db[_0x9d59('0x23')][_0x9d59('0x11e')](db[_0x9d59('0x21')],{'foreignKey':'mailboxuser','targetKey':_0x9d59('0x156')});db[_0x9d59('0x24')]['hasMany'](db[_0x9d59('0x28')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0x9d59('0x24')][_0x9d59('0x10e')](db[_0x9d59('0x27')],{'as':_0x9d59('0x157'),'foreignKey':_0x9d59('0x158'),'constraints':![]});db['VoiceCallReport'][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':_0x9d59('0x13'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x24')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':'Contact','foreignKey':_0x9d59('0x159')});db[_0x9d59('0x15a')][_0x9d59('0x11e')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x9d59('0x15b')});db[_0x9d59('0x15c')][_0x9d59('0x11e')](db[_0x9d59('0x3d')],{'as':_0x9d59('0x3d'),'foreignKey':_0x9d59('0x15b')});db[_0x9d59('0x3d')][_0x9d59('0x10c')](db[_0x9d59('0x15a')],{'as':_0x9d59('0x15d'),'onDelete':'cascade'});db[_0x9d59('0x3d')][_0x9d59('0x10c')](db['MailServerOut'],{'as':_0x9d59('0x15e'),'onDelete':'cascade'});db[_0x9d59('0x3d')][_0x9d59('0x10e')](db[_0x9d59('0x84')],{'as':'Dispositions','foreignKey':'MailAccountId'});db[_0x9d59('0x3d')][_0x9d59('0x10e')](db['CannedAnswer'],{'as':_0x9d59('0x15f'),'foreignKey':'MailAccountId'});db[_0x9d59('0x3d')][_0x9d59('0x10e')](db[_0x9d59('0x41')],{'as':_0x9d59('0x154'),'foreignKey':_0x9d59('0x15b')});db['MailAccount'][_0x9d59('0x10e')](db[_0x9d59('0x40')],{'as':_0x9d59('0x160')});db[_0x9d59('0x3d')][_0x9d59('0x10e')](db[_0x9d59('0x43')],{'as':'Applications'});db[_0x9d59('0x3d')]['belongsTo'](db[_0x9d59('0x125')],{'as':_0x9d59('0x161'),'foreignKey':'ListId'});db[_0x9d59('0x3d')][_0x9d59('0x11e')](db[_0x9d59('0x91')],{'as':_0x9d59('0x91'),'foreignKey':_0x9d59('0x162')});db['MailAccount'][_0x9d59('0x11e')](db['Pause'],{'as':_0x9d59('0x163'),'foreignKey':_0x9d59('0x14e')});db[_0x9d59('0x3d')][_0x9d59('0x121')](db['User'],{'as':_0x9d59('0x150'),'through':_0x9d59('0x13b')});db['MailQueue'][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x150'),'through':_0x9d59('0x33')});db[_0x9d59('0x3e')][_0x9d59('0x121')](db[_0x9d59('0xe4')],{'through':_0x9d59('0x164'),'as':'Teams'});db['MailInteraction'][_0x9d59('0x10e')](db[_0x9d59('0x41')],{'as':_0x9d59('0x154'),'onDelete':_0x9d59('0x113'),'foreignKey':'MailInteractionId'});db[_0x9d59('0x40')][_0x9d59('0x11e')](db[_0x9d59('0x3d')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x15b')});db[_0x9d59('0x40')][_0x9d59('0x11e')](db['CmContact'],{'as':_0x9d59('0x166'),'foreignKey':_0x9d59('0x159')});db[_0x9d59('0x40')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':_0x9d59('0x167'),'foreignKey':_0x9d59('0x10d')});db['MailInteraction'][_0x9d59('0x121')](db[_0x9d59('0x90')],{'through':_0x9d59('0x168'),'as':_0x9d59('0x169')});db[_0x9d59('0x40')]['belongsToMany'](db[_0x9d59('0x90')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0x9d59('0x40')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x16a'),'through':'user_has_mail_interactions','foreignKey':_0x9d59('0x16b')});db['MailMessage'][_0x9d59('0x10e')](db[_0x9d59('0xeb')],{'as':_0x9d59('0x16c'),'onDelete':'cascade'});db[_0x9d59('0x41')][_0x9d59('0x11e')](db['User'],{'as':'User'});db[_0x9d59('0x41')][_0x9d59('0x11e')](db['CmContact'],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x166')});db['MailMessage'][_0x9d59('0x11e')](db[_0x9d59('0x40')],{'as':_0x9d59('0x16d'),'foreignKey':_0x9d59('0x16b')});db[_0x9d59('0x41')][_0x9d59('0x11e')](db[_0x9d59('0x3d')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x15b')});db[_0x9d59('0x41')]['belongsTo'](db[_0x9d59('0x65')],{'as':_0x9d59('0x65'),'foreignKey':'ChatWebsiteId'});db['MailMessage'][_0x9d59('0x11e')](db[_0x9d59('0x16e')],{'as':_0x9d59('0x16e'),'foreignKey':_0x9d59('0x16f')});db['MailApplication']['belongsTo'](db['User'],{'onDelete':_0x9d59('0x170')});db[_0x9d59('0x43')][_0x9d59('0x11e')](db['MailQueue'],{'onDelete':_0x9d59('0x170')});db[_0x9d59('0x43')][_0x9d59('0x11e')](db['MailAccount'],{'onDelete':_0x9d59('0x170')});db['MailApplication'][_0x9d59('0x11e')](db['Interval'],{'onDelete':_0x9d59('0x170'),'foreignKey':_0x9d59('0x14d')});db['MailApplication'][_0x9d59('0x11e')](db[_0x9d59('0x90')],{'onDelete':'restrict','foreignKey':_0x9d59('0x171')});db[_0x9d59('0x172')][_0x9d59('0x11e')](db['MailAccount'],{});db['MailQueueReport'][_0x9d59('0x11e')](db[_0x9d59('0x125')],{'as':_0x9d59('0x161'),'foreignKey':_0x9d59('0x173')});db[_0x9d59('0x172')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x9d59('0x159')});db[_0x9d59('0x172')]['belongsTo'](db[_0x9d59('0x40')],{});db[_0x9d59('0x172')][_0x9d59('0x11e')](db[_0x9d59('0x41')],{});db[_0x9d59('0x172')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{});db[_0x9d59('0x172')][_0x9d59('0x11e')](db[_0x9d59('0x3e')],{});db[_0x9d59('0x174')][_0x9d59('0x10e')](db[_0x9d59('0x175')],{'as':_0x9d59('0x176'),'onDelete':_0x9d59('0x113')});db[_0x9d59('0x47')][_0x9d59('0x10e')](db['Disposition'],{'as':'Dispositions','foreignKey':'FaxAccountId'});db[_0x9d59('0x47')]['hasMany'](db[_0x9d59('0x82')],{'as':'Answers','foreignKey':_0x9d59('0x177')});db[_0x9d59('0x47')]['hasMany'](db[_0x9d59('0x4b')],{'as':_0x9d59('0x160')});db[_0x9d59('0x47')][_0x9d59('0x10e')](db[_0x9d59('0x49')],{'as':'Applications'});db[_0x9d59('0x47')][_0x9d59('0x10e')](db[_0x9d59('0x19')],{'as':_0x9d59('0x178'),'onDelete':'cascade'});db[_0x9d59('0x47')][_0x9d59('0x10e')](db[_0x9d59('0x4d')],{'as':'Messages'});db[_0x9d59('0x47')]['belongsTo'](db['Trunk'],{'as':_0x9d59('0x2c')});db[_0x9d59('0x47')]['belongsTo'](db['CmList'],{'as':_0x9d59('0x161'),'foreignKey':_0x9d59('0x173')});db[_0x9d59('0x47')][_0x9d59('0x11e')](db[_0x9d59('0x87')],{'as':_0x9d59('0x163'),'foreignKey':_0x9d59('0x14e')});db[_0x9d59('0x47')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x150'),'through':_0x9d59('0x139')});db[_0x9d59('0x49')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'onDelete':'restrict'});db[_0x9d59('0x49')]['belongsTo'](db[_0x9d59('0x4f')],{'onDelete':'restrict'});db[_0x9d59('0x49')][_0x9d59('0x11e')](db[_0x9d59('0x47')],{'onDelete':_0x9d59('0x170')});db['FaxApplication']['belongsTo'](db[_0x9d59('0x90')],{'onDelete':_0x9d59('0x170'),'foreignKey':_0x9d59('0x171')});db[_0x9d59('0x4b')][_0x9d59('0x10e')](db[_0x9d59('0x4d')],{'as':_0x9d59('0x154'),'onDelete':_0x9d59('0x113'),'foreignKey':'FaxInteractionId'});db[_0x9d59('0x4b')][_0x9d59('0x11e')](db[_0x9d59('0x47')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x177')});db[_0x9d59('0x4b')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':'Contact','foreignKey':_0x9d59('0x159')});db['FaxInteraction'][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':_0x9d59('0x167'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x4b')][_0x9d59('0x121')](db[_0x9d59('0x90')],{'through':_0x9d59('0x179'),'as':'Tags'});db[_0x9d59('0x4b')]['belongsToMany'](db[_0x9d59('0x90')],{'through':'fax_interaction_has_tags','as':_0x9d59('0x17a')});db[_0x9d59('0x4b')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x16a'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0x9d59('0x4d')][_0x9d59('0x11e')](db['User'],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x13')});db[_0x9d59('0x4d')]['belongsTo'](db[_0x9d59('0x4b')],{'as':_0x9d59('0x16d'),'foreignKey':_0x9d59('0x17b')});db[_0x9d59('0x4d')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x166')});db[_0x9d59('0x4d')][_0x9d59('0x11e')](db['Attachment'],{'as':_0x9d59('0xeb'),'foreignKey':_0x9d59('0x17c')});db[_0x9d59('0x4d')][_0x9d59('0x11e')](db[_0x9d59('0x47')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x177')});db['FaxQueue'][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x150'),'through':'UserFaxQueue'});db['FaxQueue'][_0x9d59('0x121')](db['Team'],{'through':'team_has_fax_queues','as':_0x9d59('0x151')});db['FaxQueueReport'][_0x9d59('0x11e')](db[_0x9d59('0x47')],{});db['FaxQueueReport']['belongsTo'](db[_0x9d59('0x125')],{'as':'List','foreignKey':_0x9d59('0x173')});db[_0x9d59('0x51')]['belongsTo'](db[_0x9d59('0x72')],{'as':_0x9d59('0x166'),'foreignKey':'ContactId'});db[_0x9d59('0x51')][_0x9d59('0x11e')](db[_0x9d59('0x4b')],{});db[_0x9d59('0x51')]['belongsTo'](db[_0x9d59('0x4d')],{});db[_0x9d59('0x51')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{});db[_0x9d59('0x51')][_0x9d59('0x11e')](db[_0x9d59('0x4f')],{});db[_0x9d59('0x53')][_0x9d59('0x10e')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x9d59('0x17d')});db[_0x9d59('0x53')][_0x9d59('0x10e')](db[_0x9d59('0x82')],{'as':_0x9d59('0x15f'),'foreignKey':_0x9d59('0x17d')});db[_0x9d59('0x53')][_0x9d59('0x10e')](db['SmsMessage'],{'as':_0x9d59('0x154'),'foreignKey':_0x9d59('0x17d')});db[_0x9d59('0x53')]['hasMany'](db['SmsInteraction'],{'as':'Interactions'});db['SmsAccount'][_0x9d59('0x10e')](db['SmsApplication'],{'as':_0x9d59('0x142')});db[_0x9d59('0x53')][_0x9d59('0x11e')](db[_0x9d59('0x125')],{'as':_0x9d59('0x161'),'foreignKey':_0x9d59('0x173')});db[_0x9d59('0x53')][_0x9d59('0x11e')](db[_0x9d59('0x87')],{'as':_0x9d59('0x163'),'foreignKey':_0x9d59('0x14e')});db[_0x9d59('0x53')]['belongsToMany'](db[_0x9d59('0x13')],{'as':_0x9d59('0x150'),'through':'user_has_sms_accounts'});db[_0x9d59('0x17e')]['belongsTo'](db[_0x9d59('0x13')],{'onDelete':_0x9d59('0x170')});db[_0x9d59('0x17e')][_0x9d59('0x11e')](db['SmsQueue'],{'onDelete':_0x9d59('0x170')});db['SmsApplication']['belongsTo'](db[_0x9d59('0x53')],{'onDelete':_0x9d59('0x170')});db[_0x9d59('0x17e')][_0x9d59('0x11e')](db['Interval'],{'onDelete':_0x9d59('0x170'),'foreignKey':_0x9d59('0x14d')});db[_0x9d59('0x17e')][_0x9d59('0x11e')](db[_0x9d59('0x90')],{'onDelete':_0x9d59('0x170'),'foreignKey':_0x9d59('0x171')});db[_0x9d59('0x56')][_0x9d59('0x10e')](db[_0x9d59('0x58')],{'as':_0x9d59('0x154'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x17f')});db[_0x9d59('0x56')][_0x9d59('0x11e')](db[_0x9d59('0x53')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x17d')});db[_0x9d59('0x56')][_0x9d59('0x11e')](db['CmContact'],{'as':_0x9d59('0x166'),'foreignKey':_0x9d59('0x159')});db['SmsInteraction'][_0x9d59('0x11e')](db['User'],{'as':'Owner','foreignKey':_0x9d59('0x10d')});db['SmsInteraction'][_0x9d59('0x121')](db[_0x9d59('0x90')],{'through':_0x9d59('0x180'),'as':_0x9d59('0x169')});db[_0x9d59('0x56')][_0x9d59('0x121')](db['Tag'],{'through':_0x9d59('0x180'),'as':_0x9d59('0x17a')});db['SmsInteraction'][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':'Users','through':_0x9d59('0x181'),'foreignKey':_0x9d59('0x17f')});db[_0x9d59('0x58')]['belongsTo'](db[_0x9d59('0x13')],{'as':_0x9d59('0x13')});db['SmsMessage'][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x166')});db[_0x9d59('0x58')][_0x9d59('0x11e')](db['SmsInteraction'],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x16d'),'foreignKey':_0x9d59('0x17f')});db[_0x9d59('0x58')][_0x9d59('0x11e')](db[_0x9d59('0x53')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x17d')});db[_0x9d59('0x5a')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':'Agents','through':'UserSmsQueue','foreignKey':_0x9d59('0x182')});db[_0x9d59('0x5a')]['belongsToMany'](db['Team'],{'through':_0x9d59('0x183'),'as':_0x9d59('0x151')});db['OpenchannelAccount']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x9d59('0x184')});db[_0x9d59('0x5c')][_0x9d59('0x10e')](db[_0x9d59('0x82')],{'as':_0x9d59('0x15f'),'foreignKey':_0x9d59('0x184')});db[_0x9d59('0x5c')][_0x9d59('0x10e')](db[_0x9d59('0x60')],{'as':_0x9d59('0x160'),'foreignKey':'OpenchannelAccountId'});db[_0x9d59('0x5c')][_0x9d59('0x10e')](db[_0x9d59('0x62')],{'as':_0x9d59('0x154'),'foreignKey':_0x9d59('0x184')});db['OpenchannelAccount']['hasMany'](db[_0x9d59('0x5e')],{'as':'Applications','foreignKey':_0x9d59('0x184')});db['OpenchannelAccount']['belongsTo'](db['CmList'],{'as':_0x9d59('0x161'),'foreignKey':_0x9d59('0x173')});db[_0x9d59('0x5c')][_0x9d59('0x11e')](db[_0x9d59('0x87')],{'as':_0x9d59('0x163'),'foreignKey':_0x9d59('0x14e')});db[_0x9d59('0x5c')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x150'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'onDelete':_0x9d59('0x170')});db[_0x9d59('0x5e')][_0x9d59('0x11e')](db['OpenchannelQueue'],{'onDelete':_0x9d59('0x170'),'foreignKey':'OpenchannelQueueId'});db[_0x9d59('0x5e')][_0x9d59('0x11e')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0x9d59('0x5e')][_0x9d59('0x11e')](db[_0x9d59('0x86')],{'onDelete':_0x9d59('0x170'),'foreignKey':_0x9d59('0x14d')});db[_0x9d59('0x5e')][_0x9d59('0x11e')](db[_0x9d59('0x90')],{'onDelete':'restrict','foreignKey':_0x9d59('0x171')});db[_0x9d59('0x60')][_0x9d59('0x10e')](db[_0x9d59('0x62')],{'as':'Messages','onDelete':_0x9d59('0x113'),'foreignKey':'OpenchannelInteractionId'});db[_0x9d59('0x60')][_0x9d59('0x11e')](db[_0x9d59('0x5c')],{'as':_0x9d59('0x165'),'foreignKey':'OpenchannelAccountId'});db[_0x9d59('0x60')]['belongsTo'](db[_0x9d59('0x72')],{'as':'Contact','foreignKey':_0x9d59('0x159')});db[_0x9d59('0x60')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0x9d59('0x60')][_0x9d59('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x9d59('0x169')});db['OpenchannelInteraction'][_0x9d59('0x121')](db['Tag'],{'through':_0x9d59('0x185'),'as':_0x9d59('0x17a')});db[_0x9d59('0x60')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x16a'),'through':_0x9d59('0x186'),'foreignKey':_0x9d59('0x187')});db[_0x9d59('0x62')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x13')});db[_0x9d59('0x62')][_0x9d59('0x11e')](db['CmContact'],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x166')});db['OpenchannelMessage']['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x16d'),'foreignKey':_0x9d59('0x187')});db[_0x9d59('0x62')][_0x9d59('0x11e')](db['Attachment'],{'as':_0x9d59('0xeb'),'foreignKey':_0x9d59('0x17c')});db[_0x9d59('0x62')][_0x9d59('0x11e')](db['OpenchannelAccount'],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x9d59('0x64')]['belongsToMany'](db[_0x9d59('0x13')],{'as':'Agents','through':_0x9d59('0x37'),'foreignKey':'OpenchannelQueueId'});db[_0x9d59('0x64')][_0x9d59('0x121')](db[_0x9d59('0xe4')],{'through':'team_has_openchannel_queues','as':_0x9d59('0x151')});db['ChatWebsite'][_0x9d59('0x10e')](db[_0x9d59('0x84')],{'as':_0x9d59('0x188'),'foreignKey':_0x9d59('0x189')});db[_0x9d59('0x65')][_0x9d59('0x10e')](db[_0x9d59('0x82')],{'as':_0x9d59('0x15f'),'foreignKey':'ChatWebsiteId'});db[_0x9d59('0x65')][_0x9d59('0x10e')](db['ChatProactiveAction'],{'as':_0x9d59('0x18a')});db['ChatWebsite'][_0x9d59('0x10e')](db[_0x9d59('0x6a')],{'as':_0x9d59('0x160')});db[_0x9d59('0x65')][_0x9d59('0x10e')](db[_0x9d59('0x68')],{'as':'Applications'});db['ChatWebsite'][_0x9d59('0x10e')](db['ChatMessage'],{'as':_0x9d59('0x154')});db['ChatWebsite']['belongsTo'](db['CmList'],{'as':_0x9d59('0x161'),'foreignKey':'ListId'});db[_0x9d59('0x65')][_0x9d59('0x11e')](db[_0x9d59('0x86')],{'as':_0x9d59('0x86'),'foreignKey':_0x9d59('0x14d')});db[_0x9d59('0x65')][_0x9d59('0x11e')](db[_0x9d59('0x3d')],{'as':_0x9d59('0x3d'),'foreignKey':_0x9d59('0x15b')});db['ChatWebsite'][_0x9d59('0x11e')](db[_0x9d59('0x87')],{'as':_0x9d59('0x163'),'foreignKey':_0x9d59('0x14e')});db[_0x9d59('0x65')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x150'),'through':'user_has_chat_websites'});db[_0x9d59('0x18b')]['belongsTo'](db[_0x9d59('0x5c')],{});db[_0x9d59('0x18b')][_0x9d59('0x11e')](db[_0x9d59('0x125')],{'as':_0x9d59('0x161'),'foreignKey':_0x9d59('0x173')});db[_0x9d59('0x18b')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':_0x9d59('0x166'),'foreignKey':_0x9d59('0x159')});db[_0x9d59('0x18b')]['belongsTo'](db[_0x9d59('0x60')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x9d59('0x62')],{});db['OpenchannelQueueReport'][_0x9d59('0x11e')](db[_0x9d59('0x13')],{});db[_0x9d59('0x18b')][_0x9d59('0x11e')](db['OpenchannelQueue'],{});db[_0x9d59('0x68')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':'Agent','foreignKey':_0x9d59('0x10d'),'onDelete':_0x9d59('0x170')});db[_0x9d59('0x68')]['belongsTo'](db['ChatQueue'],{'as':_0x9d59('0x18c'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db[_0x9d59('0x68')][_0x9d59('0x11e')](db[_0x9d59('0x65')],{'as':'Website','foreignKey':_0x9d59('0x189'),'onDelete':_0x9d59('0x170')});db[_0x9d59('0x68')][_0x9d59('0x11e')](db[_0x9d59('0x90')],{'onDelete':_0x9d59('0x170'),'foreignKey':_0x9d59('0x171')});db[_0x9d59('0x6a')][_0x9d59('0x10e')](db[_0x9d59('0x18d')],{'as':_0x9d59('0x154'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x18e')});db[_0x9d59('0x6a')]['belongsTo'](db[_0x9d59('0x65')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x189')});db['ChatInteraction'][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':'Contact','foreignKey':_0x9d59('0x159')});db[_0x9d59('0x6a')]['belongsTo'](db[_0x9d59('0x13')],{'as':'Owner','foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x6a')][_0x9d59('0x121')](db[_0x9d59('0x90')],{'through':'chat_interaction_has_tags','as':_0x9d59('0x169')});db[_0x9d59('0x6a')]['belongsToMany'](db[_0x9d59('0x90')],{'through':_0x9d59('0x18f'),'as':_0x9d59('0x17a')});db['ChatInteraction'][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x16a'),'through':_0x9d59('0x12a'),'foreignKey':_0x9d59('0x18e')});db[_0x9d59('0x18d')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'onDelete':'cascade','as':_0x9d59('0x13')});db[_0x9d59('0x18d')][_0x9d59('0x11e')](db['CmContact'],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x166'),'foreignKey':_0x9d59('0x159')});db[_0x9d59('0x18d')]['belongsTo'](db[_0x9d59('0x6a')],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x16d'),'foreignKey':_0x9d59('0x18e')});db[_0x9d59('0x18d')][_0x9d59('0x11e')](db['Attachment'],{'as':_0x9d59('0xeb'),'foreignKey':'AttachmentId'});db[_0x9d59('0x18d')]['belongsTo'](db[_0x9d59('0x65')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x189')});db[_0x9d59('0x16e')][_0x9d59('0x10e')](db['Attachment'],{'as':'Attachments','foreignKey':_0x9d59('0x16f'),'onDelete':'cascade','hooks':!![]});db[_0x9d59('0x16e')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x166'),'foreignKey':_0x9d59('0x159')});db[_0x9d59('0x16e')][_0x9d59('0x11e')](db['ChatWebsite'],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x189')});db[_0x9d59('0x6c')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':'Agents','through':_0x9d59('0x190'),'hooks':!![]});db[_0x9d59('0x6c')][_0x9d59('0x121')](db[_0x9d59('0xe4')],{'through':'team_has_chat_queues','as':_0x9d59('0x151')});db[_0x9d59('0x6e')]['hasMany'](db[_0x9d59('0xcf')],{'as':_0x9d59('0x154'),'foreignKey':_0x9d59('0x191'),'onDelete':_0x9d59('0x113')});db[_0x9d59('0x6e')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x144'),'through':_0x9d59('0x192')});db[_0x9d59('0x6f')][_0x9d59('0x11e')](db[_0x9d59('0x65')],{'as':_0x9d59('0x193'),'foreignKey':'ChatWebsiteId'});db[_0x9d59('0x71')][_0x9d59('0x10e')](db[_0x9d59('0x72')],{'as':_0x9d59('0x123'),'foreignKey':'CompanyId'});db[_0x9d59('0x72')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x9d59('0x159')});db[_0x9d59('0x72')]['hasMany'](db[_0x9d59('0x77')],{'as':'HopperFinals','foreignKey':_0x9d59('0x159')});db[_0x9d59('0x72')][_0x9d59('0x10e')](db['CmHopperHistory'],{'as':_0x9d59('0x147'),'foreignKey':_0x9d59('0x159')});db[_0x9d59('0x72')][_0x9d59('0x10e')](db['ReportAgentPreview'],{'as':_0x9d59('0x7b'),'foreignKey':_0x9d59('0x159')});db['CmContact']['hasMany'](db['JscriptySessionReport'],{'as':_0x9d59('0x194'),'foreignKey':_0x9d59('0x159')});db[_0x9d59('0x72')][_0x9d59('0x10e')](db['OpenchannelInteraction'],{'as':_0x9d59('0x116'),'foreignKey':_0x9d59('0x159'),'onDelete':'restrict'});db['CmContact'][_0x9d59('0x10e')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x9d59('0x72')]['hasMany'](db[_0x9d59('0x56')],{'as':_0x9d59('0x118'),'foreignKey':_0x9d59('0x159'),'onDelete':_0x9d59('0x170')});db[_0x9d59('0x72')][_0x9d59('0x10e')](db[_0x9d59('0x4b')],{'as':_0x9d59('0x119'),'foreignKey':_0x9d59('0x159'),'onDelete':_0x9d59('0x170')});db[_0x9d59('0x72')][_0x9d59('0x10e')](db[_0x9d59('0x40')],{'as':'MailInteractions','foreignKey':_0x9d59('0x159'),'onDelete':'restrict'});db[_0x9d59('0x72')][_0x9d59('0x11e')](db[_0x9d59('0x71')],{'as':'Company','foreignKey':_0x9d59('0x195')});db[_0x9d59('0x72')][_0x9d59('0x11e')](db[_0x9d59('0x125')],{'as':_0x9d59('0x161'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x9d59('0x72')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x16a'),'through':'cm_user_has_contacts'});db[_0x9d59('0x72')][_0x9d59('0x121')](db[_0x9d59('0x90')],{'as':_0x9d59('0x169'),'through':_0x9d59('0x196')});db[_0x9d59('0x72')][_0x9d59('0x121')](db['Tag'],{'through':_0x9d59('0x196'),'as':'ThroughTags'});db['CmHopper'][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':_0x9d59('0x166'),'foreignKey':'ContactId','onDelete':_0x9d59('0x113')});db[_0x9d59('0x74')][_0x9d59('0x11e')](db['CmList'],{'as':_0x9d59('0x161'),'foreignKey':'ListId','onDelete':_0x9d59('0x113')});db[_0x9d59('0x74')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':_0x9d59('0x197'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x74')][_0x9d59('0x11e')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x9d59('0x145'),'onDelete':_0x9d59('0x113')});db['CmHopper']['belongsTo'](db[_0x9d59('0xe8')],{'as':_0x9d59('0xe8'),'foreignKey':_0x9d59('0x198'),'onDelete':_0x9d59('0x113')});db['CmHopper'][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':_0x9d59('0x167'),'foreignKey':_0x9d59('0x199')});db[_0x9d59('0x148')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':_0x9d59('0x166'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0x9d59('0x148')][_0x9d59('0x11e')](db['CmList'],{'as':_0x9d59('0x161'),'foreignKey':_0x9d59('0x173'),'onDelete':_0x9d59('0x113')});db[_0x9d59('0x148')][_0x9d59('0x11e')](db[_0x9d59('0x1d')],{'as':_0x9d59('0x18c'),'foreignKey':_0x9d59('0x145'),'onDelete':_0x9d59('0x113')});db['CmHopperBlack'][_0x9d59('0x11e')](db[_0x9d59('0xe8')],{'as':_0x9d59('0xe8'),'foreignKey':_0x9d59('0x198'),'onDelete':_0x9d59('0x113')});db[_0x9d59('0x80')][_0x9d59('0x10e')](db['Condition'],{'as':{'plural':_0x9d59('0x19a'),'singular':'OneAll'},'foreignKey':_0x9d59('0x19b'),'onDelete':_0x9d59('0x113'),'hooks':!![]});db[_0x9d59('0x80')][_0x9d59('0x10e')](db[_0x9d59('0x85')],{'as':{'plural':_0x9d59('0x19c'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x9d59('0x80')]['hasMany'](db[_0x9d59('0x7e')],{'as':_0x9d59('0x19d'),'foreignKey':_0x9d59('0x19e'),'onDelete':_0x9d59('0x113'),'hooks':!![]});db[_0x9d59('0x84')][_0x9d59('0x10e')](db[_0x9d59('0x84')],{'as':'Dispositions','foreignKey':_0x9d59('0x19f'),'onDelete':_0x9d59('0x113')});db[_0x9d59('0x86')]['hasMany'](db[_0x9d59('0x86')],{'as':_0x9d59('0x1a0'),'foreignKey':_0x9d59('0x14d'),'onDelete':_0x9d59('0x113'),'hooks':!![],'required':![]});db[_0x9d59('0x86')][_0x9d59('0x10e')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0x9d59('0x14d'),'onDelete':_0x9d59('0x170')});db[_0x9d59('0x86')][_0x9d59('0x10e')](db[_0x9d59('0x43')],{'as':_0x9d59('0x1a1'),'foreignKey':'IntervalId'});db[_0x9d59('0x86')][_0x9d59('0x10e')](db[_0x9d59('0x68')],{'as':'ChatApplications','foreignKey':_0x9d59('0x14d')});db[_0x9d59('0x86')][_0x9d59('0x10e')](db['FaxApplication'],{'as':_0x9d59('0x1a2'),'foreignKey':_0x9d59('0x14d')});db[_0x9d59('0x86')][_0x9d59('0x10e')](db[_0x9d59('0x17e')],{'as':_0x9d59('0x1a3'),'foreignKey':'IntervalId'});db[_0x9d59('0x1a4')][_0x9d59('0x11e')](db[_0x9d59('0x3d')],{});db[_0x9d59('0x1a4')][_0x9d59('0x11e')](db[_0x9d59('0x1a5')],{'foreignKey':_0x9d59('0x1a6')});db[_0x9d59('0x1a4')][_0x9d59('0x11e')](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db[_0x9d59('0x8e')]['belongsToMany'](db[_0x9d59('0x1b')],{'as':_0x9d59('0x1a7'),'through':_0x9d59('0x1a8'),'onDelete':_0x9d59('0x170')});db[_0x9d59('0x90')]['belongsToMany'](db[_0x9d59('0x72')],{'through':_0x9d59('0x196')});db[_0x9d59('0x90')][_0x9d59('0x121')](db[_0x9d59('0x6a')],{'through':_0x9d59('0x18f')});db[_0x9d59('0x90')][_0x9d59('0x121')](db[_0x9d59('0x40')],{'through':'mail_interaction_has_tags'});db['Tag'][_0x9d59('0x121')](db[_0x9d59('0x56')],{'through':_0x9d59('0x180')});db[_0x9d59('0x90')][_0x9d59('0x121')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x9d59('0x90')][_0x9d59('0x121')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0x9d59('0x90')]['belongsToMany'](db[_0x9d59('0x101')],{'through':_0x9d59('0x1a9')});db['Trigger'][_0x9d59('0x10e')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0x9d59('0x1aa')},'foreignKey':_0x9d59('0x1ab'),'onDelete':'cascade','hooks':!![]});db[_0x9d59('0x92')][_0x9d59('0x10e')](db[_0x9d59('0x85')],{'as':{'plural':_0x9d59('0x1ac'),'singular':_0x9d59('0x1ad')},'foreignKey':_0x9d59('0x1ae'),'onDelete':_0x9d59('0x113'),'hooks':!![]});db['Trigger'][_0x9d59('0x10e')](db[_0x9d59('0x7e')],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0x9d59('0x113'),'hooks':!![]});db[_0x9d59('0x99')][_0x9d59('0x10e')](db[_0x9d59('0x9e')],{'as':_0x9d59('0x1af'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b0'),'hooks':!![]});db['AnalyticDefaultReport'][_0x9d59('0x10e')](db[_0x9d59('0x9e')],{'as':_0x9d59('0x1af'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1a6')});db[_0x9d59('0x1b1')][_0x9d59('0x10e')](db[_0x9d59('0x9e')],{'as':_0x9d59('0x1af'),'onDelete':_0x9d59('0x113'),'foreignKey':'MetricId'});db['AnalyticFieldReport'][_0x9d59('0x11e')](db[_0x9d59('0x1b1')],{'foreignKey':_0x9d59('0x1b2')});db['SalesforceAccount'][_0x9d59('0x10e')](db['SalesforceConfiguration'],{'as':_0x9d59('0x1b3'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xa4')]['hasMany'](db[_0x9d59('0xa6')],{'as':_0x9d59('0x1b5'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x9d59('0xa4')]['hasMany'](db['SalesforceField'],{'as':_0x9d59('0x1b6'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b7')});db['SalesforceConfiguration'][_0x9d59('0x10e')](db[_0x9d59('0xa6')],{'as':_0x9d59('0x1af'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b8')});db['SalesforceConfiguration'][_0x9d59('0x11e')](db[_0x9d59('0xa2')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xa6')][_0x9d59('0x10e')](db['SalesforceField'],{'as':_0x9d59('0x1b9'),'foreignKey':'SubjectId'});db[_0x9d59('0xa6')][_0x9d59('0x10e')](db[_0x9d59('0xa6')],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0xa6')][_0x9d59('0x10e')](db[_0x9d59('0xa6')],{'as':_0x9d59('0x1bb'),'foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xa6')][_0x9d59('0x11e')](db[_0x9d59('0x94')],{'as':_0x9d59('0x94'),'foreignKey':_0x9d59('0x1bc')});db[_0x9d59('0x1bd')][_0x9d59('0x10e')](db[_0x9d59('0xa8')],{'as':_0x9d59('0x1b3'),'onDelete':'cascade','foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xa8')]['hasMany'](db[_0x9d59('0xa9')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x9d59('0x1be')});db[_0x9d59('0xa8')][_0x9d59('0x10e')](db[_0x9d59('0xa9')],{'as':_0x9d59('0x1b6'),'onDelete':_0x9d59('0x113'),'foreignKey':'DescriptionId'});db[_0x9d59('0xa8')]['hasMany'](db[_0x9d59('0xa9')],{'as':_0x9d59('0x1af'),'onDelete':'cascade','foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xa8')]['belongsTo'](db['SugarcrmAccount'],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xa9')][_0x9d59('0x10e')](db['SugarcrmField'],{'as':_0x9d59('0x1b9'),'foreignKey':_0x9d59('0x1be')});db[_0x9d59('0xa9')][_0x9d59('0x10e')](db[_0x9d59('0xa9')],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0xa9')]['hasMany'](db['SugarcrmField'],{'as':_0x9d59('0x1bb'),'foreignKey':'FieldId'});db[_0x9d59('0xa9')][_0x9d59('0x11e')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x9d59('0x1bf')]['hasMany'](db[_0x9d59('0xab')],{'as':_0x9d59('0x1b3'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xab')][_0x9d59('0x10e')](db[_0x9d59('0x1c0')],{'as':_0x9d59('0x1b5'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1be')});db[_0x9d59('0xab')][_0x9d59('0x10e')](db[_0x9d59('0x1c0')],{'as':_0x9d59('0x1b6'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x9d59('0xab')][_0x9d59('0x10e')](db[_0x9d59('0x1c0')],{'as':_0x9d59('0x1af'),'onDelete':'cascade','foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xab')][_0x9d59('0x11e')](db['DeskAccount'],{'as':'Account','foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xab')][_0x9d59('0x121')](db[_0x9d59('0x90')],{'through':'int_desk_configuration_has_tags'});db[_0x9d59('0x1c0')][_0x9d59('0x10e')](db[_0x9d59('0x1c0')],{'as':_0x9d59('0x1b9'),'foreignKey':'SubjectId'});db['DeskField'][_0x9d59('0x10e')](db[_0x9d59('0x1c0')],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0x1c0')][_0x9d59('0x10e')](db[_0x9d59('0x1c0')],{'as':_0x9d59('0x1bb'),'foreignKey':_0x9d59('0x1b8')});db['DeskField']['belongsTo'](db['Variable'],{'as':_0x9d59('0x94'),'foreignKey':_0x9d59('0x1bc')});db[_0x9d59('0xae')][_0x9d59('0x10e')](db[_0x9d59('0xb0')],{'as':_0x9d59('0x1b3'),'onDelete':'cascade','foreignKey':_0x9d59('0x1b4')});db['ZohoConfiguration'][_0x9d59('0x10e')](db[_0x9d59('0xb1')],{'as':_0x9d59('0x1b5'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1be')});db[_0x9d59('0xb0')][_0x9d59('0x10e')](db[_0x9d59('0xb1')],{'as':_0x9d59('0x1b6'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0xb0')][_0x9d59('0x10e')](db['ZohoField'],{'as':_0x9d59('0x1af'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xb0')][_0x9d59('0x11e')](db[_0x9d59('0xae')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xb1')]['hasMany'](db[_0x9d59('0xb1')],{'as':_0x9d59('0x1b9'),'foreignKey':'SubjectId'});db['ZohoField'][_0x9d59('0x10e')](db[_0x9d59('0xb1')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x9d59('0xb1')][_0x9d59('0x10e')](db[_0x9d59('0xb1')],{'as':'Field','foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xb1')]['belongsTo'](db['Variable'],{'as':_0x9d59('0x94'),'foreignKey':_0x9d59('0x1bc')});db[_0x9d59('0xb2')][_0x9d59('0x10e')](db[_0x9d59('0xb4')],{'as':_0x9d59('0x1b3'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xb4')][_0x9d59('0x10e')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0x9d59('0x1be')});db[_0x9d59('0xb4')][_0x9d59('0x10e')](db[_0x9d59('0xb6')],{'as':'Descriptions','foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0xb4')]['hasMany'](db[_0x9d59('0xb6')],{'as':'Fields','foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xb4')][_0x9d59('0x11e')](db[_0x9d59('0xb2')],{'as':_0x9d59('0x165'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x9d59('0x121')](db['Tag'],{'through':_0x9d59('0x1c1')});db[_0x9d59('0xb6')]['hasMany'](db[_0x9d59('0xb6')],{'as':_0x9d59('0x1b9'),'foreignKey':_0x9d59('0x1be')});db['ZendeskField'][_0x9d59('0x10e')](db['ZendeskField'],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0xb6')][_0x9d59('0x10e')](db['ZendeskField'],{'as':_0x9d59('0x1bb'),'foreignKey':_0x9d59('0x1b8')});db['ZendeskField'][_0x9d59('0x11e')](db['Variable'],{'as':_0x9d59('0x94'),'foreignKey':_0x9d59('0x1bc')});db['FreshdeskAccount'][_0x9d59('0x10e')](db[_0x9d59('0xb8')],{'as':_0x9d59('0x1b3'),'onDelete':'cascade','foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xb8')][_0x9d59('0x10e')](db[_0x9d59('0xb9')],{'as':_0x9d59('0x1b5'),'onDelete':_0x9d59('0x113'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0x9d59('0x10e')](db[_0x9d59('0xb9')],{'as':'Descriptions','onDelete':_0x9d59('0x113'),'foreignKey':'DescriptionId'});db[_0x9d59('0xb8')][_0x9d59('0x10e')](db[_0x9d59('0xb9')],{'as':_0x9d59('0x1af'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xb8')][_0x9d59('0x11e')](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0x9d59('0x1b4')});db['FreshdeskConfiguration'][_0x9d59('0x121')](db['Tag'],{'through':_0x9d59('0x1c2')});db['FreshdeskField'][_0x9d59('0x10e')](db[_0x9d59('0xb9')],{'as':'Subject','foreignKey':_0x9d59('0x1be')});db['FreshdeskField']['hasMany'](db[_0x9d59('0xb9')],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0xb9')][_0x9d59('0x10e')](db[_0x9d59('0xb9')],{'as':'Field','foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xb9')][_0x9d59('0x11e')](db[_0x9d59('0x94')],{'as':_0x9d59('0x94'),'foreignKey':'VariableId'});db[_0x9d59('0xbb')][_0x9d59('0x10e')](db[_0x9d59('0x1c3')],{'as':_0x9d59('0x1b3'),'onDelete':'cascade','foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0x1c3')][_0x9d59('0x10e')](db['VtigerField'],{'as':_0x9d59('0x1b5'),'foreignKey':_0x9d59('0x1be')});db['VtigerConfiguration'][_0x9d59('0x10e')](db[_0x9d59('0x1c4')],{'as':_0x9d59('0x1b6'),'foreignKey':_0x9d59('0x1b7')});db['VtigerConfiguration'][_0x9d59('0x10e')](db[_0x9d59('0x1c4')],{'as':_0x9d59('0x1af'),'foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0x1c3')]['belongsTo'](db[_0x9d59('0xbb')],{'as':'Account','foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0x1c4')][_0x9d59('0x10e')](db[_0x9d59('0x1c4')],{'as':_0x9d59('0x1b9'),'foreignKey':_0x9d59('0x1be')});db[_0x9d59('0x1c4')]['hasMany'](db[_0x9d59('0x1c4')],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db['VtigerField'][_0x9d59('0x10e')](db[_0x9d59('0x1c4')],{'as':'Field','foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0x1c4')][_0x9d59('0x11e')](db['Variable'],{'as':_0x9d59('0x94'),'foreignKey':_0x9d59('0x1bc')});db[_0x9d59('0xbe')][_0x9d59('0x10e')](db[_0x9d59('0xbf')],{'as':_0x9d59('0x1b3'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xbf')]['hasMany'](db['ServicenowField'],{'as':_0x9d59('0x1b5'),'foreignKey':_0x9d59('0x1be')});db['ServicenowConfiguration']['hasMany'](db[_0x9d59('0xc1')],{'as':_0x9d59('0x1b6'),'foreignKey':_0x9d59('0x1b7')});db['ServicenowConfiguration'][_0x9d59('0x10e')](db[_0x9d59('0xc1')],{'as':_0x9d59('0x1af'),'foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xbf')][_0x9d59('0x11e')](db[_0x9d59('0xbe')],{'as':_0x9d59('0x165'),'foreignKey':'AccountId'});db['ServicenowField']['hasMany'](db[_0x9d59('0xc1')],{'as':_0x9d59('0x1b9'),'foreignKey':_0x9d59('0x1be')});db[_0x9d59('0xc1')]['hasMany'](db[_0x9d59('0xc1')],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0xc1')][_0x9d59('0x10e')](db[_0x9d59('0xc1')],{'as':_0x9d59('0x1bb'),'foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xc1')][_0x9d59('0x11e')](db[_0x9d59('0x94')],{'as':_0x9d59('0x94'),'foreignKey':_0x9d59('0x1bc')});db[_0x9d59('0xc3')][_0x9d59('0x10e')](db[_0x9d59('0xc5')],{'as':_0x9d59('0x1b3'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b4')});db['Dynamics365Configuration'][_0x9d59('0x10e')](db[_0x9d59('0xc6')],{'as':_0x9d59('0x1b5'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1be')});db['Dynamics365Configuration'][_0x9d59('0x10e')](db[_0x9d59('0xc6')],{'as':_0x9d59('0x1b6'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b7')});db['Dynamics365Configuration'][_0x9d59('0x10e')](db[_0x9d59('0xc6')],{'as':_0x9d59('0x1af'),'onDelete':_0x9d59('0x113'),'foreignKey':'FieldId'});db[_0x9d59('0xc5')]['belongsTo'](db['Dynamics365Account'],{'as':_0x9d59('0x165'),'foreignKey':'AccountId'});db[_0x9d59('0xc6')]['hasMany'](db[_0x9d59('0xc6')],{'as':'Subject','foreignKey':_0x9d59('0x1be')});db[_0x9d59('0xc6')]['hasMany'](db[_0x9d59('0xc6')],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db['Dynamics365Field']['hasMany'](db[_0x9d59('0xc6')],{'as':_0x9d59('0x1bb'),'foreignKey':'FieldId'});db[_0x9d59('0xc6')][_0x9d59('0x11e')](db[_0x9d59('0x94')],{'as':_0x9d59('0x94'),'foreignKey':_0x9d59('0x1bc')});db[_0x9d59('0xc7')][_0x9d59('0x10e')](db['FreshsalesConfiguration'],{'as':_0x9d59('0x1b3'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xc9')]['hasMany'](db[_0x9d59('0x1c5')],{'as':'Subjects','foreignKey':_0x9d59('0x1be')});db['FreshsalesConfiguration'][_0x9d59('0x10e')](db[_0x9d59('0x1c5')],{'as':_0x9d59('0x1b6'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0xc9')][_0x9d59('0x10e')](db[_0x9d59('0x1c5')],{'as':_0x9d59('0x1af'),'foreignKey':_0x9d59('0x1b8')});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0x1c5')][_0x9d59('0x10e')](db[_0x9d59('0x1c5')],{'as':_0x9d59('0x1b9'),'foreignKey':_0x9d59('0x1be')});db[_0x9d59('0x1c5')][_0x9d59('0x10e')](db[_0x9d59('0x1c5')],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0x1c5')]['hasMany'](db[_0x9d59('0x1c5')],{'as':_0x9d59('0x1bb'),'foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0x1c5')][_0x9d59('0x11e')](db[_0x9d59('0x94')],{'as':_0x9d59('0x94'),'foreignKey':_0x9d59('0x1bc')});db[_0x9d59('0x1c6')][_0x9d59('0x11e')](db[_0x9d59('0x65')],{});db[_0x9d59('0x1c6')][_0x9d59('0x11e')](db[_0x9d59('0x125')],{'as':'List','foreignKey':_0x9d59('0x173')});db[_0x9d59('0x1c6')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':_0x9d59('0x166'),'foreignKey':'ContactId'});db[_0x9d59('0x1c6')][_0x9d59('0x11e')](db[_0x9d59('0x6a')],{});db['ChatQueueReport']['belongsTo'](db['ChatMessage'],{});db[_0x9d59('0x1c6')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{});db[_0x9d59('0x1c6')]['belongsTo'](db[_0x9d59('0x6c')],{});db[_0x9d59('0xcf')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0x9d59('0xcf')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1c7')});db[_0x9d59('0xd3')][_0x9d59('0x10e')](db[_0x9d59('0xd1')],{'foreignKey':_0x9d59('0x1c8'),'onDelete':_0x9d59('0x113')});db['JscriptySessionReport'][_0x9d59('0x10e')](db[_0x9d59('0x1c9')],{'foreignKey':_0x9d59('0x1c8'),'onDelete':_0x9d59('0x113')});db[_0x9d59('0xd4')][_0x9d59('0x11e')](db['SmsAccount'],{});db['SmsQueueReport'][_0x9d59('0x11e')](db['CmList'],{'as':'List','foreignKey':_0x9d59('0x173')});db[_0x9d59('0xd4')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':'Contact','foreignKey':_0x9d59('0x159')});db[_0x9d59('0xd4')][_0x9d59('0x11e')](db['SmsInteraction'],{});db[_0x9d59('0xd4')][_0x9d59('0x11e')](db[_0x9d59('0x58')],{});db[_0x9d59('0xd4')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{});db[_0x9d59('0xd4')][_0x9d59('0x11e')](db['SmsQueue'],{});db[_0x9d59('0xda')][_0x9d59('0x10e')](db[_0x9d59('0xd3')],{'foreignKey':_0x9d59('0x1ca')});db[_0x9d59('0xda')][_0x9d59('0x10e')](db[_0x9d59('0xd1')],{'foreignKey':_0x9d59('0x1ca')});db[_0x9d59('0xda')][_0x9d59('0x10e')](db[_0x9d59('0x1c9')],{'foreignKey':_0x9d59('0x1ca')});db[_0x9d59('0x13f')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x16a'),'through':_0x9d59('0x140')});db[_0x9d59('0xe4')][_0x9d59('0x121')](db['User'],{'as':_0x9d59('0x150'),'through':'user_has_teams'});db['Team'][_0x9d59('0x121')](db[_0x9d59('0x1d')],{'through':_0x9d59('0x10a'),'as':_0x9d59('0x12d')});db[_0x9d59('0xe4')][_0x9d59('0x121')](db[_0x9d59('0x3e')],{'through':_0x9d59('0x164'),'as':_0x9d59('0x1cb')});db[_0x9d59('0xe4')][_0x9d59('0x121')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0x9d59('0x12e')});db[_0x9d59('0xe4')]['belongsToMany'](db[_0x9d59('0x4f')],{'through':_0x9d59('0x1cc'),'as':_0x9d59('0x12f')});db[_0x9d59('0xe4')][_0x9d59('0x121')](db['SmsQueue'],{'through':_0x9d59('0x183'),'as':_0x9d59('0x131')});db[_0x9d59('0xe4')][_0x9d59('0x121')](db[_0x9d59('0x64')],{'through':_0x9d59('0x1cd'),'as':_0x9d59('0x132')});db[_0x9d59('0xe4')]['belongsToMany'](db[_0x9d59('0x108')],{'through':_0x9d59('0x1ce'),'as':_0x9d59('0x133')});db[_0x9d59('0xe8')][_0x9d59('0x10e')](db[_0x9d59('0x74')],{'as':_0x9d59('0x146'),'foreignKey':'CampaignId'});db['Campaign'][_0x9d59('0x10e')](db[_0x9d59('0x77')],{'as':_0x9d59('0x114'),'foreignKey':_0x9d59('0x198')});db[_0x9d59('0xe8')][_0x9d59('0x10e')](db[_0x9d59('0x79')],{'as':_0x9d59('0x147'),'foreignKey':_0x9d59('0x198')});db[_0x9d59('0xe8')]['hasMany'](db[_0x9d59('0x148')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x9d59('0xe8')]['belongsTo'](db[_0x9d59('0x2c')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x9d59('0xe8')][_0x9d59('0x11e')](db[_0x9d59('0x2c')],{'as':_0x9d59('0x14b'),'foreignKey':_0x9d59('0x14c')});db[_0x9d59('0xe8')][_0x9d59('0x11e')](db['Interval'],{'as':_0x9d59('0x86'),'foreignKey':'IntervalId'});db[_0x9d59('0xe8')]['belongsTo'](db[_0x9d59('0x13f')],{'as':_0x9d59('0x13f'),'foreignKey':_0x9d59('0x1cf')});db['Campaign'][_0x9d59('0x121')](db[_0x9d59('0x125')],{'as':_0x9d59('0x126'),'through':'campaigns_has_cm_lists'});db[_0x9d59('0xe8')]['belongsToMany'](db['CmList'],{'as':_0x9d59('0x152'),'through':_0x9d59('0x1d0')});db[_0x9d59('0xeb')][_0x9d59('0x11e')](db[_0x9d59('0x16e')],{'as':_0x9d59('0x16e'),'foreignKey':_0x9d59('0x16f')});db['MailTransferReport'][_0x9d59('0x11e')](db[_0x9d59('0x41')],{});db[_0x9d59('0xec')]['belongsTo'](db['MailInteraction'],{});db[_0x9d59('0xec')][_0x9d59('0x11e')](db[_0x9d59('0x3d')],{'foreignKey':_0x9d59('0x1d1'),'as':_0x9d59('0x1d2')});db[_0x9d59('0xec')][_0x9d59('0x11e')](db['User'],{'foreignKey':_0x9d59('0x1d3'),'as':_0x9d59('0x1d4')});db[_0x9d59('0xec')]['belongsTo'](db[_0x9d59('0x13')],{'foreignKey':_0x9d59('0x1d5'),'as':_0x9d59('0x1d6')});db['MailTransferReport']['belongsTo'](db[_0x9d59('0x3e')],{'foreignKey':_0x9d59('0x1d7'),'as':_0x9d59('0x1d8')});db[_0x9d59('0xec')][_0x9d59('0x11e')](db[_0x9d59('0x3d')],{'foreignKey':_0x9d59('0x1d9'),'as':'ToAccount'});db[_0x9d59('0xee')][_0x9d59('0x11e')](db[_0x9d59('0x18d')],{});db[_0x9d59('0xee')][_0x9d59('0x11e')](db[_0x9d59('0x6a')],{});db[_0x9d59('0xee')]['belongsTo'](db[_0x9d59('0x65')],{'foreignKey':_0x9d59('0x1da'),'as':'FromAccount'});db[_0x9d59('0xee')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'foreignKey':_0x9d59('0x1d3'),'as':'FromAgent'});db[_0x9d59('0xee')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'foreignKey':_0x9d59('0x1d5'),'as':'ToAgent'});db[_0x9d59('0xee')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0x9d59('0x1db'),'as':_0x9d59('0x1d8')});db['ChatTransferReport'][_0x9d59('0x11e')](db['ChatWebsite'],{'foreignKey':_0x9d59('0x1dc'),'as':'ToAccount'});db[_0x9d59('0xf0')]['belongsTo'](db[_0x9d59('0x4d')],{});db['FaxTransferReport'][_0x9d59('0x11e')](db[_0x9d59('0x4b')],{});db[_0x9d59('0xf0')][_0x9d59('0x11e')](db[_0x9d59('0x47')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db['FaxTransferReport']['belongsTo'](db[_0x9d59('0x13')],{'foreignKey':'FromUserId','as':_0x9d59('0x1d4')});db[_0x9d59('0xf0')][_0x9d59('0x11e')](db['User'],{'foreignKey':'ToUserId','as':_0x9d59('0x1d6')});db[_0x9d59('0xf0')][_0x9d59('0x11e')](db[_0x9d59('0x4f')],{'foreignKey':'ToFaxQueueId','as':_0x9d59('0x1d8')});db['FaxTransferReport'][_0x9d59('0x11e')](db[_0x9d59('0x47')],{'foreignKey':_0x9d59('0x1dd'),'as':_0x9d59('0x1de')});db['OpenchannelTransferReport']['belongsTo'](db[_0x9d59('0x62')],{});db[_0x9d59('0xf2')]['belongsTo'](db[_0x9d59('0x60')],{});db[_0x9d59('0xf2')][_0x9d59('0x11e')](db[_0x9d59('0x5c')],{'foreignKey':_0x9d59('0x1df'),'as':_0x9d59('0x1d2')});db[_0x9d59('0xf2')]['belongsTo'](db[_0x9d59('0x13')],{'foreignKey':_0x9d59('0x1d3'),'as':_0x9d59('0x1d4')});db[_0x9d59('0xf2')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'foreignKey':_0x9d59('0x1d5'),'as':'ToAgent'});db['OpenchannelTransferReport']['belongsTo'](db[_0x9d59('0x64')],{'foreignKey':_0x9d59('0x1e0'),'as':_0x9d59('0x1d8')});db[_0x9d59('0xf2')][_0x9d59('0x11e')](db[_0x9d59('0x5c')],{'foreignKey':_0x9d59('0x1e1'),'as':_0x9d59('0x1de')});db[_0x9d59('0xf4')][_0x9d59('0x11e')](db[_0x9d59('0x58')],{});db[_0x9d59('0xf4')][_0x9d59('0x11e')](db[_0x9d59('0x56')],{});db[_0x9d59('0xf4')][_0x9d59('0x11e')](db[_0x9d59('0x53')],{'foreignKey':_0x9d59('0x1e2'),'as':_0x9d59('0x1d2')});db['SmsTransferReport']['belongsTo'](db[_0x9d59('0x13')],{'foreignKey':_0x9d59('0x1d3'),'as':_0x9d59('0x1d4')});db[_0x9d59('0xf4')]['belongsTo'](db[_0x9d59('0x13')],{'foreignKey':_0x9d59('0x1d5'),'as':'ToAgent'});db[_0x9d59('0xf4')][_0x9d59('0x11e')](db[_0x9d59('0x5a')],{'foreignKey':_0x9d59('0x1e3'),'as':_0x9d59('0x1d8')});db['SmsTransferReport']['belongsTo'](db[_0x9d59('0x53')],{'foreignKey':_0x9d59('0x1e4'),'as':'ToAccount'});db[_0x9d59('0x125')][_0x9d59('0x10e')](db[_0x9d59('0x84')],{'as':_0x9d59('0x188'),'foreignKey':_0x9d59('0x173')});db[_0x9d59('0x125')]['hasMany'](db[_0x9d59('0x7c')],{'as':_0x9d59('0x1e5'),'foreignKey':'ListId'});db['CmList']['hasMany'](db['CmContact'],{'as':_0x9d59('0x123'),'onDelete':_0x9d59('0x113'),'foreignKey':'ListId'});db[_0x9d59('0x125')][_0x9d59('0x10e')](db[_0x9d59('0x77')],{'as':_0x9d59('0x114'),'foreignKey':_0x9d59('0x173')});db['CmList'][_0x9d59('0x10e')](db[_0x9d59('0x79')],{'as':'HopperHistory','foreignKey':_0x9d59('0x173')});db[_0x9d59('0x125')][_0x9d59('0x10e')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x9d59('0x173')});db['CmList']['belongsToMany'](db['VoiceQueue'],{'as':_0x9d59('0x1e6'),'through':_0x9d59('0x14f')});db['CmList'][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':'Agents','through':_0x9d59('0x127')});db[_0x9d59('0xf7')][_0x9d59('0x10e')](db[_0x9d59('0x19')],{'as':_0x9d59('0x112'),'onDelete':_0x9d59('0x113')});db[_0x9d59('0xf7')][_0x9d59('0x121')](db['User'],{'as':'Agents','through':_0x9d59('0x135')});db[_0x9d59('0x11f')]['hasMany'](db['User'],{'as':'Users','foreignKey':_0x9d59('0x120')});db['UserProfile']['hasMany'](db[_0x9d59('0xfa')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0x9d59('0x113')});db[_0x9d59('0xfa')][_0x9d59('0x10e')](db[_0x9d59('0xfc')],{'as':_0x9d59('0x1e7'),'foreignKey':'sectionId','onDelete':'cascade'});db[_0x9d59('0x13d')][_0x9d59('0x10e')](db[_0x9d59('0x84')],{'as':_0x9d59('0x188'),'foreignKey':'WhatsappAccountId'});db[_0x9d59('0x13d')][_0x9d59('0x10e')](db['CannedAnswer'],{'as':_0x9d59('0x15f'),'foreignKey':_0x9d59('0x1e8')});db[_0x9d59('0x13d')][_0x9d59('0x10e')](db[_0x9d59('0x103')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0x9d59('0x13d')]['hasMany'](db[_0x9d59('0x101')],{'as':'Interactions'});db[_0x9d59('0x13d')][_0x9d59('0x10e')](db['WhatsappApplication'],{'as':_0x9d59('0x142')});db[_0x9d59('0x13d')]['belongsTo'](db['CmList'],{'as':_0x9d59('0x161'),'foreignKey':_0x9d59('0x173')});db['WhatsappAccount'][_0x9d59('0x11e')](db['Pause'],{'as':_0x9d59('0x163'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9d59('0x13d')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':'Agents','through':_0x9d59('0x13e')});db[_0x9d59('0x100')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'onDelete':_0x9d59('0x170')});db['WhatsappApplication'][_0x9d59('0x11e')](db[_0x9d59('0x108')],{'onDelete':_0x9d59('0x170')});db[_0x9d59('0x100')][_0x9d59('0x11e')](db[_0x9d59('0x13d')],{'onDelete':_0x9d59('0x170')});db[_0x9d59('0x100')][_0x9d59('0x11e')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x9d59('0x100')][_0x9d59('0x11e')](db[_0x9d59('0x90')],{'onDelete':_0x9d59('0x170'),'foreignKey':_0x9d59('0x171')});db[_0x9d59('0x101')]['hasMany'](db[_0x9d59('0x103')],{'as':'Messages','onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1e9')});db['WhatsappInteraction']['belongsTo'](db[_0x9d59('0x13d')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x1e8')});db[_0x9d59('0x101')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':_0x9d59('0x166'),'foreignKey':_0x9d59('0x159')});db[_0x9d59('0x101')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':_0x9d59('0x167'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x101')][_0x9d59('0x121')](db[_0x9d59('0x90')],{'through':_0x9d59('0x1a9'),'as':'Tags'});db[_0x9d59('0x101')][_0x9d59('0x121')](db[_0x9d59('0x90')],{'through':'whatsapp_interaction_has_tags','as':_0x9d59('0x17a')});db[_0x9d59('0x101')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x16a'),'through':_0x9d59('0x12c'),'foreignKey':_0x9d59('0x1e9')});db['WhatsappMessage'][_0x9d59('0x11e')](db['User'],{'as':_0x9d59('0x13')});db['WhatsappMessage'][_0x9d59('0x11e')](db['CmContact'],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x166')});db[_0x9d59('0x103')][_0x9d59('0x11e')](db['WhatsappInteraction'],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x16d'),'foreignKey':_0x9d59('0x1e9')});db[_0x9d59('0x103')]['belongsTo'](db[_0x9d59('0x13d')],{'as':'Account','foreignKey':_0x9d59('0x1e8')});db[_0x9d59('0x104')][_0x9d59('0x11e')](db[_0x9d59('0x13d')],{});db[_0x9d59('0x104')][_0x9d59('0x11e')](db[_0x9d59('0x125')],{'as':'List','foreignKey':'ListId'});db[_0x9d59('0x104')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':'Contact','foreignKey':_0x9d59('0x159')});db[_0x9d59('0x104')][_0x9d59('0x11e')](db[_0x9d59('0x101')],{});db[_0x9d59('0x104')]['belongsTo'](db['WhatsappQueue'],{});db[_0x9d59('0x104')][_0x9d59('0x11e')](db['WhatsappMessage'],{});db[_0x9d59('0x104')][_0x9d59('0x11e')](db['User'],{});db[_0x9d59('0x106')][_0x9d59('0x11e')](db[_0x9d59('0x103')],{});db['WhatsappTransferReport'][_0x9d59('0x11e')](db[_0x9d59('0x101')],{});db[_0x9d59('0x106')][_0x9d59('0x11e')](db['WhatsappAccount'],{'foreignKey':_0x9d59('0x1ea'),'as':'FromAccount'});db[_0x9d59('0x106')][_0x9d59('0x11e')](db[_0x9d59('0x13d')],{'foreignKey':_0x9d59('0x1eb'),'as':'ToAccount'});db[_0x9d59('0x106')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x9d59('0x1ec'),'as':_0x9d59('0x1d8')});db[_0x9d59('0x106')][_0x9d59('0x11e')](db['User'],{'foreignKey':_0x9d59('0x1d3'),'as':'FromAgent'});db[_0x9d59('0x106')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'foreignKey':_0x9d59('0x1d5'),'as':'ToAgent'});db['WhatsappQueue'][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x150'),'through':_0x9d59('0x39'),'foreignKey':_0x9d59('0x1ed')});db['WhatsappQueue'][_0x9d59('0x121')](db[_0x9d59('0xe4')],{'through':_0x9d59('0x1ce'),'as':_0x9d59('0x151')});module[_0x9d59('0x1ee')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 362908f..a4029e1 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e40=['/api/voice/mails','/api/voice/mails/messages','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','./api/smsMessage','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/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/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','/www','/demo','root','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','/index.html','username','password','newPassword','apiKey','lastName','mobile','fax','email','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isString','replace','@@{','}@@','includes','path','express','express-winston','util','./errors','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','device','agent_id','agent_name','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','./api/screenRecording'];(function(_0x228544,_0x5713c1){var _0x467657=function(_0x14b02c){while(--_0x14b02c){_0x228544['push'](_0x228544['shift']());}};_0x467657(++_0x5713c1);}(_0x5e40,0x11b));var _0x05e4=function(_0x21eb3c,_0x7ce88b){_0x21eb3c=_0x21eb3c-0x0;var _0x4bd2aa=_0x5e40[_0x21eb3c];return _0x4bd2aa;};'use strict';var _=require('lodash');var path=require(_0x05e4('0x0'));var express=require(_0x05e4('0x1'));var ewinston=require(_0x05e4('0x2'));var util=require(_0x05e4('0x3'));var errors=require(_0x05e4('0x4'));var config=require('./config/environment');var logger=require(_0x05e4('0x5'))(_0x05e4('0x6'));var authLogger=require(_0x05e4('0x5'))(_0x05e4('0x7'));exports[_0x05e4('0x8')]=function(_0x4623db){_0x4623db[_0x05e4('0x9')](ewinston[_0x05e4('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xed6490,_0x24c6e6){var _0xb614b4=_0x05e4('0xb');if(!_[_0x05e4('0xc')](_0xed6490[_0x05e4('0xd')])){_0xb614b4+='\x20body=%s';var _0x2fe606=_0xed6490[_0x05e4('0xd')];maskSensitiveData(_0x2fe606);}return util[_0x05e4('0xe')](_0xb614b4,_0xed6490['method'],_0xed6490[_0x05e4('0xf')][_0x05e4('0x10')]?_0xed6490['headers'][_0x05e4('0x10')]:_0xed6490[_0x05e4('0x11')][_0x05e4('0x12')]||_0xed6490['ip'],_0xed6490[_0x05e4('0x13')],_0x24c6e6[_0x05e4('0x14')],_0x24c6e6['responseTime'],_0xed6490[_0x05e4('0x15')]?_0xed6490[_0x05e4('0x15')]['id']:null,_0xed6490['user']?_0xed6490['user'][_0x05e4('0x16')]:null,_0xed6490['user']?_0xed6490['user'][_0x05e4('0x17')]:null,_0x2fe606?util[_0x05e4('0x18')](_0x2fe606,![],null):'');}}));_0x4623db[_0x05e4('0x9')](ewinston[_0x05e4('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x19cc99,_0x4ffa37){var _0x1f012f=_0x05e4('0x19');if(_0x19cc99['body']&&_0x19cc99['body']['device']&&_0x19cc99[_0x05e4('0xd')]['agent_id']){_0x1f012f=_0x05e4('0x1a');}return util[_0x05e4('0xe')](_0x1f012f,_0x19cc99['method'],_0x19cc99[_0x05e4('0xf')]['x-forwarded-for']?_0x19cc99[_0x05e4('0xf')]['x-forwarded-for']:_0x19cc99['connection']['remoteAddress']||_0x19cc99['ip'],_0x19cc99[_0x05e4('0x13')],_0x4ffa37[_0x05e4('0x14')],_0x4ffa37[_0x05e4('0x1b')],_0x19cc99[_0x05e4('0x15')]?_0x19cc99[_0x05e4('0x15')]['id']:null,_0x19cc99[_0x05e4('0x15')]?_0x19cc99[_0x05e4('0x15')][_0x05e4('0x16')]:null,_0x19cc99[_0x05e4('0x15')]?_0x19cc99[_0x05e4('0x15')]['role']:null,_0x19cc99[_0x05e4('0xd')]&&_0x19cc99[_0x05e4('0xd')][_0x05e4('0x1c')]?_0x19cc99['body']['device']:'other',_0x19cc99[_0x05e4('0xd')]&&_0x19cc99['body'][_0x05e4('0x1d')]?_0x19cc99[_0x05e4('0xd')][_0x05e4('0x1d')]:'',_0x19cc99[_0x05e4('0xd')]&&_0x19cc99['body'][_0x05e4('0x1e')]?_0x19cc99[_0x05e4('0xd')][_0x05e4('0x1e')]:'');},'ignoreRoute':function(_0x40bbb2){var _0x4df019=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4df019['test'](_0x40bbb2[_0x05e4('0x13')]);}}));_0x4623db[_0x05e4('0x9')](_0x05e4('0x1f'),require(_0x05e4('0x20')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x21'),require(_0x05e4('0x22')));_0x4623db['use']('/api/voice/contexts',require(_0x05e4('0x23')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x24'),require(_0x05e4('0x25')));_0x4623db[_0x05e4('0x9')]('/api/voice/mohs',require(_0x05e4('0x26')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x27'),require('./api/voiceQueue'));_0x4623db[_0x05e4('0x9')](_0x05e4('0x28'),require(_0x05e4('0x29')));_0x4623db[_0x05e4('0x9')]('/api/screen/recordings',require(_0x05e4('0x2a')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x2b'),require('./api/voiceMail'));_0x4623db[_0x05e4('0x9')](_0x05e4('0x2c'),require('./api/voiceMailMessage'));_0x4623db[_0x05e4('0x9')]('/api/voice/calls/reports',require(_0x05e4('0x2d')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x2e'),require(_0x05e4('0x2f')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x30'),require('./api/voiceAgentReport'));_0x4623db[_0x05e4('0x9')]('/api/voice/queues/reports',require(_0x05e4('0x31')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x32'),require('./api/memberReport'));_0x4623db['use'](_0x05e4('0x33'),require(_0x05e4('0x34')));_0x4623db[_0x05e4('0x9')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x4623db[_0x05e4('0x9')](_0x05e4('0x35'),require(_0x05e4('0x36')));_0x4623db['use']('/api/mail/accounts',require('./api/mailAccount'));_0x4623db[_0x05e4('0x9')](_0x05e4('0x37'),require(_0x05e4('0x38')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x39'),require(_0x05e4('0x3a')));_0x4623db[_0x05e4('0x9')]('/api/mail/interactions',require(_0x05e4('0x3b')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x3c'),require(_0x05e4('0x3d')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x3e'),require(_0x05e4('0x3f')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x40'),require('./api/mailQueueReport'));_0x4623db[_0x05e4('0x9')](_0x05e4('0x41'),require('./api/dashboard'));_0x4623db[_0x05e4('0x9')](_0x05e4('0x42'),require(_0x05e4('0x43')));_0x4623db[_0x05e4('0x9')]('/api/fax/accounts',require(_0x05e4('0x44')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x45'),require('./api/faxApplication'));_0x4623db['use'](_0x05e4('0x46'),require('./api/faxInteraction'));_0x4623db[_0x05e4('0x9')](_0x05e4('0x47'),require(_0x05e4('0x48')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x49'),require(_0x05e4('0x4a')));_0x4623db[_0x05e4('0x9')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x4623db[_0x05e4('0x9')]('/api/sms/accounts',require(_0x05e4('0x4b')));_0x4623db['use'](_0x05e4('0x4c'),require(_0x05e4('0x4d')));_0x4623db[_0x05e4('0x9')]('/api/sms/interactions',require(_0x05e4('0x4e')));_0x4623db['use']('/api/sms/messages',require(_0x05e4('0x4f')));_0x4623db[_0x05e4('0x9')]('/api/sms/queues',require(_0x05e4('0x50')));_0x4623db[_0x05e4('0x9')]('/api/openchannel/accounts',require(_0x05e4('0x51')));_0x4623db['use'](_0x05e4('0x52'),require('./api/openchannelApplication'));_0x4623db[_0x05e4('0x9')](_0x05e4('0x53'),require('./api/openchannelInteraction'));_0x4623db[_0x05e4('0x9')](_0x05e4('0x54'),require('./api/openchannelMessage'));_0x4623db[_0x05e4('0x9')](_0x05e4('0x55'),require(_0x05e4('0x56')));_0x4623db['use'](_0x05e4('0x57'),require(_0x05e4('0x58')));_0x4623db['use']('/api/openchannel/reports/queue',require(_0x05e4('0x59')));_0x4623db['use'](_0x05e4('0x5a'),require('./api/chatApplication'));_0x4623db[_0x05e4('0x9')](_0x05e4('0x5b'),require(_0x05e4('0x5c')));_0x4623db['use'](_0x05e4('0x5d'),require('./api/chatMessage'));_0x4623db[_0x05e4('0x9')](_0x05e4('0x5e'),require('./api/chatOfflineMessage'));_0x4623db[_0x05e4('0x9')]('/api/chat/queues',require('./api/chatQueue'));_0x4623db[_0x05e4('0x9')](_0x05e4('0x5f'),require(_0x05e4('0x60')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x61'),require(_0x05e4('0x62')));_0x4623db['use']('/api/cm/companies',require(_0x05e4('0x63')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x64'),require(_0x05e4('0x65')));_0x4623db['use'](_0x05e4('0x66'),require('./api/cmHopper'));_0x4623db['use'](_0x05e4('0x67'),require('./api/cmHopperBlack'));_0x4623db[_0x05e4('0x9')](_0x05e4('0x68'),require(_0x05e4('0x69')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x6a'),require(_0x05e4('0x6b')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x6c'),require(_0x05e4('0x6d')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x6e'),require(_0x05e4('0x6f')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x70'),require(_0x05e4('0x71')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x72'),require(_0x05e4('0x73')));_0x4623db['use'](_0x05e4('0x74'),require(_0x05e4('0x75')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x76'),require(_0x05e4('0x77')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x78'),require(_0x05e4('0x79')));_0x4623db['use'](_0x05e4('0x7a'),require(_0x05e4('0x7b')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x7c'),require('./api/cdr'));_0x4623db['use'](_0x05e4('0x7d'),require(_0x05e4('0x7e')));_0x4623db[_0x05e4('0x9')]('/api/schedules',require(_0x05e4('0x7f')));_0x4623db['use'](_0x05e4('0x80'),require(_0x05e4('0x81')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x82'),require(_0x05e4('0x83')));_0x4623db['use'](_0x05e4('0x84'),require(_0x05e4('0x85')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x86'),require(_0x05e4('0x87')));_0x4623db['use'](_0x05e4('0x88'),require(_0x05e4('0x89')));_0x4623db[_0x05e4('0x9')]('/api/integrations',require('./api/integration'));_0x4623db[_0x05e4('0x9')]('/api/integrations/reports',require(_0x05e4('0x8a')));_0x4623db[_0x05e4('0x9')]('/api/analytics/custom_reports',require(_0x05e4('0x8b')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x8c'),require(_0x05e4('0x8d')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x8e'),require(_0x05e4('0x8f')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x90'),require('./api/analyticMetric'));_0x4623db['use'](_0x05e4('0x91'),require(_0x05e4('0x92')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x93'),require('./api/analyticTreeReport'));_0x4623db[_0x05e4('0x9')]('/api/integrations/salesforce/accounts',require(_0x05e4('0x94')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x95'),require(_0x05e4('0x96')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x97'),require(_0x05e4('0x98')));_0x4623db['use'](_0x05e4('0x99'),require(_0x05e4('0x9a')));_0x4623db[_0x05e4('0x9')]('/api/integrations/sugarcrm/configurations',require(_0x05e4('0x9b')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x9c'),require(_0x05e4('0x9d')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x9e'),require(_0x05e4('0x9f')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xa0'),require(_0x05e4('0xa1')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xa2'),require('./api/intDeskField'));_0x4623db[_0x05e4('0x9')](_0x05e4('0xa3'),require(_0x05e4('0xa4')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xa5'),require(_0x05e4('0xa6')));_0x4623db[_0x05e4('0x9')]('/api/integrations/zoho/fields',require(_0x05e4('0xa7')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xa8'),require(_0x05e4('0xa9')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xaa'),require(_0x05e4('0xab')));_0x4623db['use']('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x4623db['use'](_0x05e4('0xac'),require(_0x05e4('0xad')));_0x4623db['use'](_0x05e4('0xae'),require(_0x05e4('0xaf')));_0x4623db['use'](_0x05e4('0xb0'),require(_0x05e4('0xb1')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xb2'),require(_0x05e4('0xb3')));_0x4623db['use'](_0x05e4('0xb4'),require('./api/intVtigerConfiguration'));_0x4623db[_0x05e4('0x9')](_0x05e4('0xb5'),require(_0x05e4('0xb6')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xb7'),require(_0x05e4('0xb8')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xb9'),require(_0x05e4('0xba')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xbb'),require('./api/intServicenowField'));_0x4623db[_0x05e4('0x9')](_0x05e4('0xbc'),require(_0x05e4('0xbd')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xbe'),require(_0x05e4('0xbf')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xc0'),require(_0x05e4('0xc1')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xc2'),require(_0x05e4('0xc3')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xc4'),require(_0x05e4('0xc5')));_0x4623db[_0x05e4('0x9')]('/api/integrations/freshsales/fields',require(_0x05e4('0xc6')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xc7'),require(_0x05e4('0xc8')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xc9'),require(_0x05e4('0xca')));_0x4623db['use'](_0x05e4('0xcb'),require(_0x05e4('0xcc')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xcd'),require(_0x05e4('0xce')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xcf'),require(_0x05e4('0xd0')));_0x4623db['use'](_0x05e4('0xd1'),require(_0x05e4('0xd2')));_0x4623db['use'](_0x05e4('0xd3'),require(_0x05e4('0xd4')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xd5'),require(_0x05e4('0xd6')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xd7'),require(_0x05e4('0xd8')));_0x4623db[_0x05e4('0x9')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x4623db[_0x05e4('0x9')](_0x05e4('0xd9'),require(_0x05e4('0xda')));_0x4623db[_0x05e4('0x9')]('/api/square/odbc',require(_0x05e4('0xdb')));_0x4623db['use'](_0x05e4('0xdc'),require('./api/squareProject'));_0x4623db['use'](_0x05e4('0xdd'),require(_0x05e4('0xde')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xdf'),require('./api/squareMessage'));_0x4623db['use'](_0x05e4('0xe0'),require(_0x05e4('0xe1')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xe2'),require(_0x05e4('0xe3')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xe4'),require('./api/campaign'));_0x4623db[_0x05e4('0x9')](_0x05e4('0xe5'),require(_0x05e4('0xe6')));_0x4623db[_0x05e4('0x9')]('/api/attachments',require(_0x05e4('0xe7')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xe8'),require(_0x05e4('0xe9')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xea'),require(_0x05e4('0xeb')));_0x4623db[_0x05e4('0x9')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x4623db[_0x05e4('0x9')](_0x05e4('0xec'),require(_0x05e4('0xed')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xee'),require(_0x05e4('0xef')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xf0'),require('./api/smsTransferReport'));_0x4623db['use']('/api/cm/lists',require(_0x05e4('0xf1')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xf2'),require(_0x05e4('0xf3')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xf4'),require(_0x05e4('0xf5')));_0x4623db['use'](_0x05e4('0xf6'),require(_0x05e4('0xf7')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xf8'),require(_0x05e4('0xf9')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xfa'),require(_0x05e4('0xfb')));_0x4623db['use']('/api/whatsapp/accounts',require(_0x05e4('0xfc')));_0x4623db[_0x05e4('0x9')]('/api/whatsapp/applications',require(_0x05e4('0xfd')));_0x4623db[_0x05e4('0x9')]('/api/whatsapp/interactions',require(_0x05e4('0xfe')));_0x4623db[_0x05e4('0x9')](_0x05e4('0xff'),require('./api/whatsappMessage'));_0x4623db[_0x05e4('0x9')](_0x05e4('0x100'),require(_0x05e4('0x101')));_0x4623db[_0x05e4('0x9')]('/api/whatsapp/reports/transfer',require(_0x05e4('0x102')));_0x4623db['use']('/api/whatsapp/queues',require(_0x05e4('0x103')));_0x4623db['use'](_0x05e4('0x104'),require('./api/cloudProvider'));_0x4623db['use'](_0x05e4('0x105'),require(_0x05e4('0x106')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x107'),require(_0x05e4('0x108')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x109'),require('./api/jira'));_0x4623db['use'](_0x05e4('0x10a'),require(_0x05e4('0x10b')));_0x4623db[_0x05e4('0x9')](_0x05e4('0x10c'),require(_0x05e4('0x10d')));_0x4623db[_0x05e4('0x9')]('/api/system',require(_0x05e4('0x10e')));_0x4623db['use'](_0x05e4('0x10f'),require('./api/pm2'));_0x4623db[_0x05e4('0x9')](_0x05e4('0x110'),require(_0x05e4('0x111')));_0x4623db['use'](_0x05e4('0x112'),express[_0x05e4('0x113')](path[_0x05e4('0x114')](config['root'],_0x05e4('0x112'))));_0x4623db[_0x05e4('0x9')]('/www',express[_0x05e4('0x113')](path[_0x05e4('0x114')](config['root'],_0x05e4('0x115'))));_0x4623db[_0x05e4('0x9')](_0x05e4('0x116'),express[_0x05e4('0x113')](path['join'](config[_0x05e4('0x117')],_0x05e4('0x116'))));_0x4623db['use'](_0x05e4('0x118'),express['static'](path[_0x05e4('0x114')](config[_0x05e4('0x117')],_0x05e4('0x119'),_0x05e4('0x11a'))));_0x4623db[_0x05e4('0x9')](_0x05e4('0x11b'),express[_0x05e4('0x113')](path['join'](config['root'],_0x05e4('0x11c'))));_0x4623db[_0x05e4('0x11d')](_0x05e4('0x11e'))[_0x05e4('0x11f')](errors[0x194]);_0x4623db[_0x05e4('0x11d')]('/*')[_0x05e4('0x11f')](function(_0x39f35d,_0x971261){_0x971261['sendFile'](path[_0x05e4('0x120')](_0x4623db['get']('appPath')+_0x05e4('0x121')));});};var sensitiveFields=[_0x05e4('0x122'),_0x05e4('0x123'),_0x05e4('0x124'),_0x05e4('0x125'),'firstName',_0x05e4('0x126'),'street','phone',_0x05e4('0x127'),_0x05e4('0x128'),_0x05e4('0x129'),'clientId',_0x05e4('0x12a'),_0x05e4('0x12b'),_0x05e4('0x12c'),_0x05e4('0x12d'),_0x05e4('0x12e'),'token',_0x05e4('0x12f'),_0x05e4('0x130'),_0x05e4('0x131'),'authToken',_0x05e4('0x132'),_0x05e4('0x133'),'membername','calleridname','calleridnum',_0x05e4('0x134'),_0x05e4('0x135'),_0x05e4('0x136'),_0x05e4('0x137'),_0x05e4('0x138'),_0x05e4('0x139'),'key',_0x05e4('0x15'),'pass',_0x05e4('0x13a'),_0x05e4('0x13b'),_0x05e4('0x13c'),_0x05e4('0x13d'),_0x05e4('0x13e'),_0x05e4('0x13f')];function maskSensitiveData(_0x28f623){var _0x2ee500=/(?!^)[\s\S](?!$)/g;if(!_[_0x05e4('0x140')](_0x28f623))return;for(var _0x2c4dd1 in _0x28f623){if(_['isArray'](_0x28f623[_0x2c4dd1])){for(var _0x1b55ec=0x0;_0x1b55ec<_0x28f623[_0x2c4dd1]['length'];_0x1b55ec++){maskSensitiveData(_0x28f623[_0x2c4dd1][_0x1b55ec]);}}else if(_['isPlainObject'](_0x28f623[_0x2c4dd1])){maskSensitiveData(_0x28f623[_0x2c4dd1]);}else if(_[_0x05e4('0x141')](_0x28f623[_0x2c4dd1])){_0x28f623[_0x2c4dd1]=_0x28f623[_0x2c4dd1][_0x05e4('0x142')](/{{{/g,_0x05e4('0x143'))[_0x05e4('0x142')](/}}}/g,_0x05e4('0x144'))[_0x05e4('0x142')](/{{/g,'@{')[_0x05e4('0x142')](/}}/g,'}@');if(_[_0x05e4('0x145')](sensitiveFields,_0x2c4dd1)){_0x28f623[_0x2c4dd1]=_0x28f623[_0x2c4dd1][_0x05e4('0x142')](_0x2ee500,'*');}}}} \ No newline at end of file +var _0xa414=['/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','./api/webbar','/apidoc','static','join','root','/www','/demo','snippet','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','get','appPath','/index.html','username','password','firstName','lastName','street','phone','fax','clientId','clientSecret','securityToken','code','accessKey','token','channelSecret','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','exten','vidaooApiKey','privateKey','pass','accountSid','localstationid','dsn','registry','oldPassword','isPlainObject','isArray','isString','replace','@@{','}@@','includes','lodash','express-winston','util','./errors','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','x-forwarded-for','headers','connection','url','statusCode','responseTime','user','inspect','%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','remoteAddress','device','other','agent_name','test','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/reports/queue','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','/api/canned_answers','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xa414,0x17e));var _0x4a41=function(_0x571d9a,_0x4b7f19){_0x571d9a=_0x571d9a-0x0;var _0x757a3f=_0xa414[_0x571d9a];return _0x757a3f;};'use strict';var _=require(_0x4a41('0x0'));var path=require('path');var express=require('express');var ewinston=require(_0x4a41('0x1'));var util=require(_0x4a41('0x2'));var errors=require(_0x4a41('0x3'));var config=require('./config/environment');var logger=require(_0x4a41('0x4'))(_0x4a41('0x5'));var authLogger=require(_0x4a41('0x4'))(_0x4a41('0x6'));exports[_0x4a41('0x7')]=function(_0x3a8058){_0x3a8058[_0x4a41('0x8')](ewinston[_0x4a41('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x3373d8,_0x25b93b){var _0x336028=_0x4a41('0xa');if(!_[_0x4a41('0xb')](_0x3373d8[_0x4a41('0xc')])){_0x336028+=_0x4a41('0xd');var _0x3c86c8=_0x3373d8[_0x4a41('0xc')];maskSensitiveData(_0x3c86c8);}return util['format'](_0x336028,_0x3373d8['method'],_0x3373d8['headers'][_0x4a41('0xe')]?_0x3373d8[_0x4a41('0xf')][_0x4a41('0xe')]:_0x3373d8[_0x4a41('0x10')]['remoteAddress']||_0x3373d8['ip'],_0x3373d8[_0x4a41('0x11')],_0x25b93b[_0x4a41('0x12')],_0x25b93b[_0x4a41('0x13')],_0x3373d8[_0x4a41('0x14')]?_0x3373d8[_0x4a41('0x14')]['id']:null,_0x3373d8[_0x4a41('0x14')]?_0x3373d8[_0x4a41('0x14')]['name']:null,_0x3373d8[_0x4a41('0x14')]?_0x3373d8[_0x4a41('0x14')]['role']:null,_0x3c86c8?util[_0x4a41('0x15')](_0x3c86c8,![],null):'');}}));_0x3a8058['use'](ewinston[_0x4a41('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x3373b4,_0x4431ec){var _0x24c301=_0x4a41('0x16');if(_0x3373b4[_0x4a41('0xc')]&&_0x3373b4[_0x4a41('0xc')]['device']&&_0x3373b4[_0x4a41('0xc')][_0x4a41('0x17')]){_0x24c301=_0x4a41('0x18');}return util['format'](_0x24c301,_0x3373b4[_0x4a41('0x19')],_0x3373b4[_0x4a41('0xf')][_0x4a41('0xe')]?_0x3373b4[_0x4a41('0xf')][_0x4a41('0xe')]:_0x3373b4[_0x4a41('0x10')][_0x4a41('0x1a')]||_0x3373b4['ip'],_0x3373b4['url'],_0x4431ec[_0x4a41('0x12')],_0x4431ec[_0x4a41('0x13')],_0x3373b4[_0x4a41('0x14')]?_0x3373b4['user']['id']:null,_0x3373b4['user']?_0x3373b4[_0x4a41('0x14')]['name']:null,_0x3373b4[_0x4a41('0x14')]?_0x3373b4[_0x4a41('0x14')]['role']:null,_0x3373b4['body']&&_0x3373b4[_0x4a41('0xc')][_0x4a41('0x1b')]?_0x3373b4[_0x4a41('0xc')]['device']:_0x4a41('0x1c'),_0x3373b4[_0x4a41('0xc')]&&_0x3373b4[_0x4a41('0xc')]['agent_id']?_0x3373b4[_0x4a41('0xc')]['agent_id']:'',_0x3373b4[_0x4a41('0xc')]&&_0x3373b4[_0x4a41('0xc')][_0x4a41('0x1d')]?_0x3373b4[_0x4a41('0xc')][_0x4a41('0x1d')]:'');},'ignoreRoute':function(_0x3ece34){var _0x473088=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x473088[_0x4a41('0x1e')](_0x3ece34[_0x4a41('0x11')]);}}));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x1f'),require('./api/user'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x20'),require(_0x4a41('0x21')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x22'),require('./api/voiceContext'));_0x3a8058[_0x4a41('0x8')]('/api/voice/extensions',require(_0x4a41('0x23')));_0x3a8058[_0x4a41('0x8')]('/api/voice/mohs',require(_0x4a41('0x24')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x25'),require('./api/voiceQueue'));_0x3a8058['use'](_0x4a41('0x26'),require(_0x4a41('0x27')));_0x3a8058['use']('/api/screen/recordings',require(_0x4a41('0x28')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x29'),require(_0x4a41('0x2a')));_0x3a8058['use'](_0x4a41('0x2b'),require(_0x4a41('0x2c')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x2d'),require(_0x4a41('0x2e')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x2f'),require(_0x4a41('0x30')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x31'),require(_0x4a41('0x32')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x33'),require(_0x4a41('0x34')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x35'),require(_0x4a41('0x36')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x37'),require(_0x4a41('0x38')));_0x3a8058['use'](_0x4a41('0x39'),require(_0x4a41('0x3a')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x3b'),require(_0x4a41('0x3c')));_0x3a8058['use'](_0x4a41('0x3d'),require(_0x4a41('0x3e')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x3f'),require(_0x4a41('0x40')));_0x3a8058[_0x4a41('0x8')]('/api/mail/substatuses',require(_0x4a41('0x41')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x42'),require(_0x4a41('0x43')));_0x3a8058[_0x4a41('0x8')]('/api/mail/messages',require('./api/mailMessage'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x44'),require('./api/mailApplication'));_0x3a8058['use'](_0x4a41('0x45'),require(_0x4a41('0x46')));_0x3a8058['use'](_0x4a41('0x47'),require(_0x4a41('0x48')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x49'),require(_0x4a41('0x4a')));_0x3a8058['use']('/api/fax/accounts',require(_0x4a41('0x4b')));_0x3a8058[_0x4a41('0x8')]('/api/fax/applications',require(_0x4a41('0x4c')));_0x3a8058['use'](_0x4a41('0x4d'),require('./api/faxInteraction'));_0x3a8058['use'](_0x4a41('0x4e'),require(_0x4a41('0x4f')));_0x3a8058['use']('/api/fax/queues',require('./api/faxQueue'));_0x3a8058['use'](_0x4a41('0x50'),require('./api/faxQueueReport'));_0x3a8058[_0x4a41('0x8')]('/api/sms/accounts',require(_0x4a41('0x51')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x52'),require('./api/smsApplication'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x53'),require(_0x4a41('0x54')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x55'),require(_0x4a41('0x56')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x57'),require(_0x4a41('0x58')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x59'),require(_0x4a41('0x5a')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x5b'),require(_0x4a41('0x5c')));_0x3a8058[_0x4a41('0x8')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x3a8058[_0x4a41('0x8')]('/api/openchannel/messages',require(_0x4a41('0x5d')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x5e'),require(_0x4a41('0x5f')));_0x3a8058[_0x4a41('0x8')]('/api/chat/websites',require('./api/chatWebsite'));_0x3a8058['use'](_0x4a41('0x60'),require(_0x4a41('0x61')));_0x3a8058['use'](_0x4a41('0x62'),require('./api/chatApplication'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x63'),require(_0x4a41('0x64')));_0x3a8058['use'](_0x4a41('0x65'),require(_0x4a41('0x66')));_0x3a8058[_0x4a41('0x8')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x67'),require(_0x4a41('0x68')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x69'),require('./api/chatGroup'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x6a'),require(_0x4a41('0x6b')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x6c'),require('./api/cmCompany'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x6d'),require(_0x4a41('0x6e')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x6f'),require('./api/cmHopper'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x70'),require(_0x4a41('0x71')));_0x3a8058['use'](_0x4a41('0x72'),require('./api/cmHopperFinal'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x73'),require('./api/cmHopperHistory'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x74'),require(_0x4a41('0x75')));_0x3a8058['use']('/api/actions',require(_0x4a41('0x76')));_0x3a8058['use'](_0x4a41('0x77'),require('./api/automation'));_0x3a8058['use'](_0x4a41('0x78'),require('./api/cannedAnswer'));_0x3a8058['use'](_0x4a41('0x79'),require(_0x4a41('0x7a')));_0x3a8058['use']('/api/conditions',require(_0x4a41('0x7b')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x7c'),require(_0x4a41('0x7d')));_0x3a8058['use']('/api/pauses',require('./api/pause'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x7e'),require('./api/cdr'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x7f'),require(_0x4a41('0x80')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x81'),require('./api/schedule'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x82'),require(_0x4a41('0x83')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x84'),require(_0x4a41('0x85')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x86'),require(_0x4a41('0x87')));_0x3a8058[_0x4a41('0x8')]('/api/triggers',require(_0x4a41('0x88')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x89'),require(_0x4a41('0x8a')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x8b'),require(_0x4a41('0x8c')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x8d'),require(_0x4a41('0x8e')));_0x3a8058[_0x4a41('0x8')]('/api/analytics/custom_reports',require(_0x4a41('0x8f')));_0x3a8058[_0x4a41('0x8')]('/api/analytics/default_reports',require(_0x4a41('0x90')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x91'),require(_0x4a41('0x92')));_0x3a8058[_0x4a41('0x8')]('/api/analytics/metrics',require(_0x4a41('0x93')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x94'),require(_0x4a41('0x95')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x96'),require(_0x4a41('0x97')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x98'),require(_0x4a41('0x99')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x9a'),require(_0x4a41('0x9b')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x9c'),require('./api/intSalesforceField'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x9d'),require(_0x4a41('0x9e')));_0x3a8058[_0x4a41('0x8')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x9f'),require(_0x4a41('0xa0')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xa1'),require(_0x4a41('0xa2')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xa3'),require(_0x4a41('0xa4')));_0x3a8058[_0x4a41('0x8')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xa5'),require(_0x4a41('0xa6')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xa7'),require('./api/intZohoConfiguration'));_0x3a8058[_0x4a41('0x8')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xa8'),require(_0x4a41('0xa9')));_0x3a8058['use'](_0x4a41('0xaa'),require('./api/intZendeskConfiguration'));_0x3a8058['use'](_0x4a41('0xab'),require('./api/intZendeskField'));_0x3a8058['use']('/api/integrations/freshdesk/accounts',require(_0x4a41('0xac')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xad'),require(_0x4a41('0xae')));_0x3a8058[_0x4a41('0x8')]('/api/integrations/freshdesk/fields',require(_0x4a41('0xaf')));_0x3a8058['use'](_0x4a41('0xb0'),require(_0x4a41('0xb1')));_0x3a8058['use'](_0x4a41('0xb2'),require(_0x4a41('0xb3')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xb4'),require(_0x4a41('0xb5')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xb6'),require(_0x4a41('0xb7')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xb8'),require(_0x4a41('0xb9')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xba'),require(_0x4a41('0xbb')));_0x3a8058[_0x4a41('0x8')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xbc'),require(_0x4a41('0xbd')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xbe'),require(_0x4a41('0xbf')));_0x3a8058[_0x4a41('0x8')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xc0'),require(_0x4a41('0xc1')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xc2'),require(_0x4a41('0xc3')));_0x3a8058[_0x4a41('0x8')]('/api/networks',require('./api/network'));_0x3a8058[_0x4a41('0x8')]('/api/chat/reports/queue',require(_0x4a41('0xc4')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xc5'),require('./api/chatInternalMessage'));_0x3a8058['use'](_0x4a41('0xc6'),require('./api/jscriptyAnswerReport'));_0x3a8058['use'](_0x4a41('0xc7'),require('./api/jscriptyQuestionReport'));_0x3a8058[_0x4a41('0x8')]('/api/jscripty/sessions/reports',require(_0x4a41('0xc8')));_0x3a8058['use']('/api/sms/reports/queue',require(_0x4a41('0xc9')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xca'),require(_0x4a41('0xcb')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xcc'),require(_0x4a41('0xcd')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xce'),require(_0x4a41('0xcf')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xd0'),require(_0x4a41('0xd1')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xd2'),require(_0x4a41('0xd3')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xd4'),require(_0x4a41('0xd5')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xd6'),require(_0x4a41('0xd7')));_0x3a8058['use']('/api/square/messages',require(_0x4a41('0xd8')));_0x3a8058[_0x4a41('0x8')]('/api/teams',require(_0x4a41('0xd9')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xda'),require(_0x4a41('0xdb')));_0x3a8058['use'](_0x4a41('0xdc'),require(_0x4a41('0xdd')));_0x3a8058[_0x4a41('0x8')]('/api/migrations',require(_0x4a41('0xde')));_0x3a8058[_0x4a41('0x8')]('/api/attachments',require(_0x4a41('0xdf')));_0x3a8058['use'](_0x4a41('0xe0'),require(_0x4a41('0xe1')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xe2'),require(_0x4a41('0xe3')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xe4'),require(_0x4a41('0xe5')));_0x3a8058['use']('/api/fax/reports/transfer',require(_0x4a41('0xe6')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xe7'),require('./api/openchannelTransferReport'));_0x3a8058['use'](_0x4a41('0xe8'),require(_0x4a41('0xe9')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xea'),require(_0x4a41('0xeb')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xec'),require('./api/voicePrefix'));_0x3a8058[_0x4a41('0x8')]('/api/userProfiles',require('./api/userProfile'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xed'),require(_0x4a41('0xee')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xef'),require(_0x4a41('0xf0')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xf1'),require('./api/userNotification'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xf2'),require(_0x4a41('0xf3')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xf4'),require(_0x4a41('0xf5')));_0x3a8058[_0x4a41('0x8')]('/api/whatsapp/interactions',require(_0x4a41('0xf6')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xf7'),require(_0x4a41('0xf8')));_0x3a8058[_0x4a41('0x8')]('/api/whatsapp/reports/queue',require(_0x4a41('0xf9')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xfa'),require(_0x4a41('0xfb')));_0x3a8058['use'](_0x4a41('0xfc'),require(_0x4a41('0xfd')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xfe'),require(_0x4a41('0xff')));_0x3a8058[_0x4a41('0x8')]('/api/auth/local',require('./api/authLocal'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x100'),require(_0x4a41('0x101')));_0x3a8058['use']('/api/jira',require(_0x4a41('0x102')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x103'),require(_0x4a41('0x104')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x105'),require(_0x4a41('0x106')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x107'),require(_0x4a41('0x108')));_0x3a8058[_0x4a41('0x8')]('/api/pm2',require(_0x4a41('0x109')));_0x3a8058[_0x4a41('0x8')]('/api/webbar',require(_0x4a41('0x10a')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x10b'),express[_0x4a41('0x10c')](path[_0x4a41('0x10d')](config[_0x4a41('0x10e')],_0x4a41('0x10b'))));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x10f'),express[_0x4a41('0x10c')](path[_0x4a41('0x10d')](config[_0x4a41('0x10e')],'/www')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x110'),express[_0x4a41('0x10c')](path['join'](config[_0x4a41('0x10e')],'/demo')));_0x3a8058[_0x4a41('0x8')]('/snippet',express[_0x4a41('0x10c')](path[_0x4a41('0x10d')](config[_0x4a41('0x10e')],_0x4a41('0x111'),'3.0.0')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x112'),express[_0x4a41('0x10c')](path[_0x4a41('0x10d')](config[_0x4a41('0x10e')],'/server/files/plugins')));_0x3a8058[_0x4a41('0x113')](_0x4a41('0x114'))['get'](errors[0x194]);_0x3a8058['route']('/*')['get'](function(_0xd2f4fd,_0x57514f){_0x57514f[_0x4a41('0x115')](path['resolve'](_0x3a8058[_0x4a41('0x116')](_0x4a41('0x117'))+_0x4a41('0x118')));});};var sensitiveFields=[_0x4a41('0x119'),_0x4a41('0x11a'),'newPassword','apiKey',_0x4a41('0x11b'),_0x4a41('0x11c'),_0x4a41('0x11d'),_0x4a41('0x11e'),'mobile',_0x4a41('0x11f'),'email',_0x4a41('0x120'),_0x4a41('0x121'),_0x4a41('0x122'),_0x4a41('0x123'),_0x4a41('0x124'),'tenantId',_0x4a41('0x125'),_0x4a41('0x126'),'accessToken',_0x4a41('0x127'),'authToken',_0x4a41('0x128'),_0x4a41('0x129'),_0x4a41('0x12a'),_0x4a41('0x12b'),'calleridnum',_0x4a41('0x12c'),_0x4a41('0x12d'),'clientEmail',_0x4a41('0x12e'),'accesskeyid','secretaccesskey','key',_0x4a41('0x14'),_0x4a41('0x12f'),_0x4a41('0x130'),_0x4a41('0x131'),_0x4a41('0x132'),'secret',_0x4a41('0x133'),_0x4a41('0x134')];function maskSensitiveData(_0x24d0f4){var _0x52b5a1=/(?!^)[\s\S](?!$)/g;if(!_[_0x4a41('0x135')](_0x24d0f4))return;for(var _0x59a8fb in _0x24d0f4){if(_[_0x4a41('0x136')](_0x24d0f4[_0x59a8fb])){for(var _0x2481d1=0x0;_0x2481d1<_0x24d0f4[_0x59a8fb]['length'];_0x2481d1++){maskSensitiveData(_0x24d0f4[_0x59a8fb][_0x2481d1]);}}else if(_[_0x4a41('0x135')](_0x24d0f4[_0x59a8fb])){maskSensitiveData(_0x24d0f4[_0x59a8fb]);}else if(_[_0x4a41('0x137')](_0x24d0f4[_0x59a8fb])){_0x24d0f4[_0x59a8fb]=_0x24d0f4[_0x59a8fb][_0x4a41('0x138')](/{{{/g,_0x4a41('0x139'))[_0x4a41('0x138')](/}}}/g,_0x4a41('0x13a'))['replace'](/{{/g,'@{')[_0x4a41('0x138')](/}}/g,'}@');if(_[_0x4a41('0x13b')](sensitiveFields,_0x59a8fb)){_0x24d0f4[_0x59a8fb]=_0x24d0f4[_0x59a8fb][_0x4a41('0x138')](_0x52b5a1,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 2584f4e..f2757ae 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x413a=['listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/campaign/campaign.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','rpc','port','error'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x413a,0x86));var _0xa413=function(_0x4cae0c,_0x128e3d){_0x4cae0c=_0x4cae0c-0x0;var _0x28bb54=_0x413a[_0x4cae0c];return _0x28bb54;};'use strict';var jayson=require(_0xa413('0x0'));var BPromise=require('bluebird');var _=require(_0xa413('0x1'));var config=require('../config/environment');exports['listen']=function(){return new BPromise(function(_0x3127e5,_0x2ffdf3){var _0x56da7b={};_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require('../api/user/user.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x3')));_0x56da7b=_['merge'](_0x56da7b,require('../api/voiceQueue/voiceQueue.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x4')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x5')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x6')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x7')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require('../api/memberReport/memberReport.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require('../api/trunk/trunk.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x8')));_0x56da7b=_['merge'](_0x56da7b,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x56da7b=_['merge'](_0x56da7b,require('../api/mailServerIn/mailServerIn.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x9')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0xa')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0xb')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0xc')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0xd')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0xe')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0xf')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x10')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require('../api/faxInteraction/faxInteraction.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x11')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x12')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x13')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x14')));_0x56da7b=_['merge'](_0x56da7b,require(_0xa413('0x15')));_0x56da7b=_['merge'](_0x56da7b,require(_0xa413('0x16')));_0x56da7b=_['merge'](_0x56da7b,require(_0xa413('0x17')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x18')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x19')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x1a')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x1b')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x1c')));_0x56da7b=_['merge'](_0x56da7b,require(_0xa413('0x1d')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x1e')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x1f')));_0x56da7b=_['merge'](_0x56da7b,require(_0xa413('0x20')));_0x56da7b=_['merge'](_0x56da7b,require(_0xa413('0x21')));_0x56da7b=_['merge'](_0x56da7b,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x22')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x23')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x24')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x25')));_0x56da7b=_['merge'](_0x56da7b,require(_0xa413('0x26')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x27')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x28')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x29')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x2a')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x2b')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x2c')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x2d')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x2e')));_0x56da7b=_['merge'](_0x56da7b,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x56da7b=_['merge'](_0x56da7b,require(_0xa413('0x2f')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x30')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x56da7b=_['merge'](_0x56da7b,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require('../api/squareReport/squareReport.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x31')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x32')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x33')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x34')));_0x56da7b=_['merge'](_0x56da7b,require('../api/squareRecording/squareRecording.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require('../api/squareMessage/squareMessage.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x35')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require('../api/attachment/attachment.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require('../api/plugin/plugin.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x36')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x37')));_0x56da7b=_[_0xa413('0x2')](_0x56da7b,require(_0xa413('0x38')));_0x56da7b=_['merge'](_0x56da7b,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x245dec=jayson[_0xa413('0x39')](_0x56da7b)['http']();var _0x2bdac6=config[_0xa413('0x3a')][_0xa413('0x3b')]||config['port']+0x1;var _0x7aafb7=config[_0xa413('0x3a')]['ip']||'localhost';_0x245dec['on'](_0xa413('0x3c'),function(_0x251f3e){return _0x2ffdf3(_0x251f3e);});_0x245dec[_0xa413('0x3d')](_0x2bdac6,_0x7aafb7,function(){console['log'](_0xa413('0x3e'),_0x7aafb7,_0x2bdac6);require(_0xa413('0x3f'))['default']();return _0x3127e5(_0xa413('0x40')+_0x7aafb7+':'+_0x2bdac6);});});}; \ No newline at end of file +var _0xca2e=['../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xca2e,0x10a));var _0xeca2=function(_0x437b4f,_0xb4cef1){_0x437b4f=_0x437b4f-0x0;var _0x5d0c2b=_0xca2e[_0x437b4f];return _0x5d0c2b;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var _=require('lodash');var config=require('../config/environment');exports[_0xeca2('0x0')]=function(){return new BPromise(function(_0x2a9751,_0xc6613a){var _0x13ce27={};_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x2')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x3')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x4')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/voiceRecording/voiceRecording.rpc'));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x5')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x6')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x7')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x8')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x9')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0xa')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0xb')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0xc')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0xd')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/mailMessage/mailMessage.rpc'));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0xe')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0xf')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x10')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/faxApplication/faxApplication.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x11')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x12')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x13')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x14')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x15')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x16')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x17')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/smsQueue/smsQueue.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x18')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x19')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x1a')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x1b')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x1c')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x1d')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x1e')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x1f')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x20')));_0x13ce27=_['merge'](_0x13ce27,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x21')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x22')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x23')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x24')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x25')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/sound/sound.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x26')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x27')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x28')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x29')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x2a')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x2b')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x2c')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x2d')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x2e')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x2f')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x30')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x31')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x32')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/squareReport/squareReport.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x33')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x34')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x35')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x36')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/squareRecording/squareRecording.rpc'));_0x13ce27=_['merge'](_0x13ce27,require('../api/squareMessage/squareMessage.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x37')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x38')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x39')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x3a')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x3b')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x3c')));_0x13ce27=_['merge'](_0x13ce27,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x3d')));var _0x1d3713=jayson[_0xeca2('0x3e')](_0x13ce27)[_0xeca2('0x3f')]();var _0x3be8e7=config['rpc'][_0xeca2('0x40')]||config[_0xeca2('0x40')]+0x1;var _0xe9ec7b=config[_0xeca2('0x41')]['ip']||_0xeca2('0x42');_0x1d3713['on'](_0xeca2('0x43'),function(_0x58317d){return _0xc6613a(_0x58317d);});_0x1d3713[_0xeca2('0x0')](_0x3be8e7,_0xe9ec7b,function(){console[_0xeca2('0x44')](_0xeca2('0x45'),_0xe9ec7b,_0x3be8e7);require('../config/triggers')[_0xeca2('0x46')]();return _0x2a9751(_0xeca2('0x47')+_0xe9ec7b+':'+_0x3be8e7);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 507a341..213be16 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 _0xa9e0=['utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','emit','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','label','exports','util','lodash','events','./error','call'];(function(_0x1bf68f,_0x322625){var _0x5259aa=function(_0x245c6e){while(--_0x245c6e){_0x1bf68f['push'](_0x1bf68f['shift']());}};_0x5259aa(++_0x322625);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x0a9e('0x3'));function AGIChannel(_0x4ce2f1){var _0x333808=this,_0x432180=new AGIReply(),_0x2ab90b=![],_0x991246={};EventEmitter[_0x0a9e('0x4')](_0x333808);_0x4ce2f1['setEncoding'](_0x0a9e('0x5'));_0x4ce2f1[_0x0a9e('0x6')](0x8*0x3c*0x3c*0x3e8);_0x432180[_0x0a9e('0x7')]('utf8');_0x432180['on']('headers',function(_0xe42b77){for(var _0x56465b in _0xe42b77){_0x333808[_0x56465b]=_0xe42b77[_0x56465b];}_0x333808['emit'](_0x0a9e('0x8'));});_0x432180['on'](_0x0a9e('0x9'),function(_0x307b3e){if(_0x307b3e[_0x0a9e('0xa')]()==_0x0a9e('0xb')){_0x333808[_0x0a9e('0xc')]('hangup');return;}if(_0x307b3e['substring'](0x0,0xb)=='520-Invalid'){_0x2ab90b=!![];}if(_0x2ab90b){_0x991246['rx']+=_0x307b3e+'\x0a';if(_0x307b3e['search'](_0x0a9e('0xd'))!=-0x1){_0x2ab90b=![];}}else{_0x991246['rx']=_0x307b3e;}if(_0x2ab90b){return;}if(typeof _0x991246['cb']==_0x0a9e('0xe')){var _0xd5b662=_0x991246['rx'][_0x0a9e('0xf')](0x0,0x3),_0x26d672=null,_0x32d742=null;_0xd5b662=parseInt(_0xd5b662);if(isNaN(_0xd5b662)){_0x991246['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xd5b662!=0xc8){_0x991246['cb'](null,{'code':_0xd5b662,'result':-0x1,'extra':'KO'});return;}_0x26d672=_0x991246['rx'][_0x0a9e('0xf')](0x4)[_0x0a9e('0x10')](_0x0a9e('0x11'),'');if(_0x26d672[_0x0a9e('0x12')]('\x20')!=-0x1){_0x26d672=_0x26d672[_0x0a9e('0x13')](0x0,_0x26d672[_0x0a9e('0x12')]('\x20'));}if(_['startsWith'](_0x26d672,'-1')){_0x26d672=parseInt(_0x26d672);}_0x32d742=_0x991246['rx'][_0x0a9e('0x14')]('\x20');if(_0x32d742['length']==0x3){_0x32d742=_0x32d742[0x2][_0x0a9e('0xf')](0x1,_0x32d742[0x2]['length']-0x1);}else if(_0x32d742[_0x0a9e('0x15')]>0x3){var _0x12066b=/\((.+)\)/;var _0x48f32d=_0x991246['rx'][_0x0a9e('0x16')](_0x12066b);if(_0x48f32d){_0x32d742=_0x48f32d[0x1];}else{_0x32d742=null;}}else{_0x32d742=null;}_0x991246['cb'](null,{'code':_0xd5b662,'result':_0x26d672,'extra':_0x32d742});}});_0x4ce2f1['on']('error',function(_0x459eb1){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x17'),new AGIError(_0x0a9e('0x18'),_0x459eb1[_0x0a9e('0x19')]));});_0x4ce2f1['on'](_0x0a9e('0x1a'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1a'),new AGIError(_0x0a9e('0x1b')));});_0x4ce2f1['on'](_0x0a9e('0x1c'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4ce2f1[_0x0a9e('0x1d')]();});_0x4ce2f1[_0x0a9e('0x1e')](_0x432180);this['command']=function(_0x20f109,_0x5a09ef){var _0x20f109=_0x20f109||'',_0x5a09ef=typeof _0x5a09ef==_0x0a9e('0xe')?_0x5a09ef:new Function();_0x991246={'tx':_0x20f109,'rx':'','cb':_0x5a09ef};_0x4ce2f1[_0x0a9e('0x1f')](_0x20f109+'\x0a');},this[_0x0a9e('0x1a')]=function(){_0x4ce2f1['destroy']();};}util[_0x0a9e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x22')]=function(_0x4d00e6){return this[_0x0a9e('0x23')][_0x0a9e('0x24')](this,_0x4d00e6);};AGIChannel[_0x0a9e('0x21')]['answer']=function(){return this['sendRequest'](_0x0a9e('0x25'));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x26')]=function(_0x33161b,_0x526cf3,_0x384319){_0x33161b=_0x33161b===undefined?'beep':_0x33161b;_0x526cf3=_0x526cf3===undefined?'5':_0x526cf3;_0x384319=_0x384319===undefined?'1':_0x384319;return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x27'),_0x33161b,_0x526cf3*0x3e8,_0x384319));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x28')]=function(_0x14433c){_0x14433c=_0x14433c||_0x0a9e('0x29');return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x14433c));};AGIChannel['prototype'][_0x0a9e('0x2c')]=function(_0x468813,_0x2b1f27){if(_[_0x0a9e('0x2d')](_0x2b1f27)){return this['sendRequest'](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27[_0x0a9e('0x2f')](',')));}return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x30')]=function(_0x1dbde2){return this['sendRequest'](util[_0x0a9e('0x2a')]('SET\x20CONTEXT\x20%s',_0x1dbde2));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x31')]=function(_0x1122db){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20EXTENSION\x20%s',_0x1122db));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x32')]=function(_0x40cb85){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x33'),_0x40cb85));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0xb')]=function(){return this['sendRequest'](_0x0a9e('0x34'));};AGIChannel['prototype'][_0x0a9e('0x35')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41=_['isBoolean'](_0x2b7e7f)||_[_0x0a9e('0x36')](_0x2b7e7f)?_0x2b7e7f[_0x0a9e('0x37')]():_0x2b7e7f;return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x14b13f,_0x3f3d41?_0x3f3d41['toString']()[_0x0a9e('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x39'),_0x3d9717,_0x381c37));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3a')]=function(_0x533942,_0x1dbf74){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x533942,_0x1dbf74));};AGIChannel['prototype'][_0x0a9e('0x3b')]=function(_0x40d766,_0x5adda1){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3c'),_0x40d766,_0x5adda1));};AGIChannel[_0x0a9e('0x21')]['continueAt']=function(_0x5a594b,_0x15e37d,_0x45b3d0){_0x15e37d=_0x15e37d||this['extension'];_0x45b3d0=_0x45b3d0||0x1;this[_0x0a9e('0x30')](_0x5a594b);this[_0x0a9e('0x31')](_0x15e37d);this[_0x0a9e('0x32')](_0x45b3d0);return this['noop'](util[_0x0a9e('0x2a')](_0x0a9e('0x3d'),_0x5a594b,_0x15e37d,_0x45b3d0));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3e')]=function(_0x13cb1f){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3f'),_0x13cb1f));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x40')]=function(_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x37f6cc,_0x4d04c8){_0x148007=_0x148007||'wav';_0x1a7bce=_0x1a7bce||'';_0x11ca30=_0x11ca30===undefined?-0x1:_0x11ca30==='-1'?-0x1:_0x11ca30*0x3e8;_0x37f6cc=_0x37f6cc===undefined?'':'s='+_0x37f6cc;_0x4d04c8=_0x4d04c8?_0x0a9e('0x41'):'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x42'),_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x4d04c8,_0x37f6cc));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){_0x445e25=_0x445e25||'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x44'),_0x10b040,_0x445e25));};AGIChannel[_0x0a9e('0x21')]['agi']=function(_0x117c99){return this[_0x0a9e('0x2c')](_0x0a9e('0x45'),_0x117c99);};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x46')]=function(_0xbe9d19){return this[_0x0a9e('0x2c')](_0x0a9e('0x47'),_0xbe9d19);};AGIChannel['prototype'][_0x0a9e('0x17')]=function(_0x48fd45,_0x473dc8){this[_0x0a9e('0x28')](util[_0x0a9e('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x48fd45['id'],_0x48fd45[_0x0a9e('0x48')],_0x473dc8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0a9e('0x49')]=AGIChannel; \ No newline at end of file +var _0x70e0=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./error','setEncoding','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','substr','indexOf','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','sendRequest'];(function(_0x21100e,_0x136844){var _0x75a799=function(_0x574c92){while(--_0x574c92){_0x21100e['push'](_0x21100e['shift']());}};_0x75a799(++_0x136844);}(_0x70e0,0x17b));var _0x070e=function(_0xc51032,_0x4fe95d){_0xc51032=_0xc51032-0x0;var _0x57c7e1=_0x70e0[_0xc51032];return _0x57c7e1;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var EventEmitter=require(_0x070e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x070e('0x3'));function AGIChannel(_0xee173){var _0x277d32=this,_0x2593e5=new AGIReply(),_0x5c90fc=![],_0x7bce9b={};EventEmitter['call'](_0x277d32);_0xee173[_0x070e('0x4')]('utf8');_0xee173['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2593e5['setEncoding'](_0x070e('0x5'));_0x2593e5['on'](_0x070e('0x6'),function(_0x604664){for(var _0x2611e6 in _0x604664){_0x277d32[_0x2611e6]=_0x604664[_0x2611e6];}_0x277d32[_0x070e('0x7')](_0x070e('0x8'));});_0x2593e5['on'](_0x070e('0x9'),function(_0x4e99e6){if(_0x4e99e6['toLowerCase']()==_0x070e('0xa')){_0x277d32[_0x070e('0x7')](_0x070e('0xa'));return;}if(_0x4e99e6[_0x070e('0xb')](0x0,0xb)==_0x070e('0xc')){_0x5c90fc=!![];}if(_0x5c90fc){_0x7bce9b['rx']+=_0x4e99e6+'\x0a';if(_0x4e99e6[_0x070e('0xd')](_0x070e('0xe'))!=-0x1){_0x5c90fc=![];}}else{_0x7bce9b['rx']=_0x4e99e6;}if(_0x5c90fc){return;}if(typeof _0x7bce9b['cb']==_0x070e('0xf')){var _0x39d2b9=_0x7bce9b['rx']['substring'](0x0,0x3),_0x5bf079=null,_0x2930b8=null;_0x39d2b9=parseInt(_0x39d2b9);if(isNaN(_0x39d2b9)){_0x7bce9b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x39d2b9!=0xc8){_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':-0x1,'extra':'KO'});return;}_0x5bf079=_0x7bce9b['rx'][_0x070e('0xb')](0x4)['replace']('result=','');if(_0x5bf079['indexOf']('\x20')!=-0x1){_0x5bf079=_0x5bf079[_0x070e('0x10')](0x0,_0x5bf079[_0x070e('0x11')]('\x20'));}if(_['startsWith'](_0x5bf079,'-1')){_0x5bf079=parseInt(_0x5bf079);}_0x2930b8=_0x7bce9b['rx']['split']('\x20');if(_0x2930b8[_0x070e('0x12')]==0x3){_0x2930b8=_0x2930b8[0x2][_0x070e('0xb')](0x1,_0x2930b8[0x2][_0x070e('0x12')]-0x1);}else if(_0x2930b8[_0x070e('0x12')]>0x3){var _0x5bc71e=/\((.+)\)/;var _0x49861b=_0x7bce9b['rx'][_0x070e('0x13')](_0x5bc71e);if(_0x49861b){_0x2930b8=_0x49861b[0x1];}else{_0x2930b8=null;}}else{_0x2930b8=null;}_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':_0x5bf079,'extra':_0x2930b8});}});_0xee173['on'](_0x070e('0x14'),function(_0x38f6e6){_0x277d32[_0x070e('0x7')](_0x070e('0x14'),new AGIError('E_AGI_SOCKET_ERROR',_0x38f6e6[_0x070e('0x15')]));});_0xee173['on'](_0x070e('0x16'),function(){_0x277d32[_0x070e('0x7')](_0x070e('0x16'),new AGIError(_0x070e('0x17')));});_0xee173['on']('timeout',function(){_0x277d32['emit']('timeout',new AGIError(_0x070e('0x18')));_0xee173[_0x070e('0x19')]();});_0xee173[_0x070e('0x1a')](_0x2593e5);this['command']=function(_0x5b184,_0x5dc5d2){var _0x5b184=_0x5b184||'',_0x5dc5d2=typeof _0x5dc5d2==_0x070e('0xf')?_0x5dc5d2:new Function();_0x7bce9b={'tx':_0x5b184,'rx':'','cb':_0x5dc5d2};_0xee173[_0x070e('0x1b')](_0x5b184+'\x0a');},this[_0x070e('0x16')]=function(){_0xee173[_0x070e('0x19')]();};}util[_0x070e('0x1c')](AGIChannel,EventEmitter);AGIChannel[_0x070e('0x1d')]['sendRequest']=function(_0x2f8055){return this[_0x070e('0x1e')][_0x070e('0x1f')](this,_0x2f8055);};AGIChannel['prototype'][_0x070e('0x20')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x070e('0x1d')][_0x070e('0x21')]=function(_0x41deb1,_0x1743cc,_0x4763c6){_0x41deb1=_0x41deb1===undefined?'beep':_0x41deb1;_0x1743cc=_0x1743cc===undefined?'5':_0x1743cc;_0x4763c6=_0x4763c6===undefined?'1':_0x4763c6;return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x24'),_0x41deb1,_0x1743cc*0x3e8,_0x4763c6));};AGIChannel[_0x070e('0x1d')][_0x070e('0x25')]=function(_0x28d7f2){_0x28d7f2=_0x28d7f2||_0x070e('0x26');return this[_0x070e('0x22')](util['format'](_0x070e('0x27'),_0x28d7f2));};AGIChannel[_0x070e('0x1d')][_0x070e('0x28')]=function(_0x56fc12,_0x5c5f0d){if(_[_0x070e('0x29')](_0x5c5f0d)){return this[_0x070e('0x22')](util[_0x070e('0x23')]('EXEC\x20%s\x20%s',_0x56fc12,_0x5c5f0d[_0x070e('0x2a')](',')));}return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2b'),_0x56fc12,_0x5c5f0d));};AGIChannel['prototype']['setContext']=function(_0x523b75){return this['sendRequest'](util[_0x070e('0x23')]('SET\x20CONTEXT\x20%s',_0x523b75));};AGIChannel[_0x070e('0x1d')][_0x070e('0x2c')]=function(_0x4f8130){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x2d'),_0x4f8130));};AGIChannel['prototype']['setPriority']=function(_0x41ade4){return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2e'),_0x41ade4));};AGIChannel[_0x070e('0x1d')]['hangup']=function(){return this['sendRequest'](_0x070e('0x2f'));};AGIChannel[_0x070e('0x1d')][_0x070e('0x30')]=function(_0xf57ed,_0xf11439){var _0x4deaf8=_[_0x070e('0x31')](_0xf11439)||_[_0x070e('0x32')](_0xf11439)?_0xf11439['toString']():_0xf11439;return this[_0x070e('0x22')](util[_0x070e('0x23')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xf57ed,_0x4deaf8?_0x4deaf8['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x070e('0x1d')][_0x070e('0x33')]=function(_0x39dfaa,_0x334733){return this[_0x070e('0x22')](util['format'](_0x070e('0x34'),_0x39dfaa,_0x334733));};AGIChannel[_0x070e('0x1d')][_0x070e('0x35')]=function(_0x487276,_0x268c5d){return this[_0x070e('0x22')](util[_0x070e('0x23')]('SAY\x20DIGITS\x20%s\x20%s',_0x487276,_0x268c5d));};AGIChannel[_0x070e('0x1d')][_0x070e('0x36')]=function(_0x4800a9,_0x173602){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x37'),_0x4800a9,_0x173602));};AGIChannel[_0x070e('0x1d')][_0x070e('0x38')]=function(_0xd03404,_0x47b929,_0xd18220){_0x47b929=_0x47b929||this['extension'];_0xd18220=_0xd18220||0x1;this['setContext'](_0xd03404);this[_0x070e('0x2c')](_0x47b929);this[_0x070e('0x39')](_0xd18220);return this[_0x070e('0x25')](util['format'](_0x070e('0x3a'),_0xd03404,_0x47b929,_0xd18220));};AGIChannel[_0x070e('0x1d')][_0x070e('0x3b')]=function(_0x7dc240){return this['sendRequest'](util[_0x070e('0x23')]('GET\x20VARIABLE\x20\x22%s\x22',_0x7dc240));};AGIChannel['prototype']['recordFile']=function(_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x34f23e,_0x562aa4){_0x926533=_0x926533||_0x070e('0x3c');_0x26b3e2=_0x26b3e2||'';_0x29dccd=_0x29dccd===undefined?-0x1:_0x29dccd==='-1'?-0x1:_0x29dccd*0x3e8;_0x34f23e=_0x34f23e===undefined?'':'s='+_0x34f23e;_0x562aa4=_0x562aa4?'BEEP':'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3d'),_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x562aa4,_0x34f23e));};AGIChannel['prototype']['streamFile']=function(_0x261a27,_0x5ee4b8){_0x5ee4b8=_0x5ee4b8||'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3e'),_0x261a27,_0x5ee4b8));};AGIChannel['prototype'][_0x070e('0x3f')]=function(_0x20a1ee){return this['exec']('AGI',_0x20a1ee);};AGIChannel[_0x070e('0x1d')][_0x070e('0x40')]=function(_0x2d43ce){return this[_0x070e('0x28')](_0x070e('0x41'),_0x2d43ce);};AGIChannel['prototype'][_0x070e('0x14')]=function(_0x3f6c64,_0x427fa7){this[_0x070e('0x25')](util[_0x070e('0x23')](_0x070e('0x42'),_0x3f6c64['id'],_0x3f6c64[_0x070e('0x43')],_0x427fa7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x070e('0x44')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 2b60983..cc11d24 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 _0x87f8=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','message','name','exports'];(function(_0x5ec5ba,_0x344f3a){var _0x4f17b2=function(_0x47d23e){while(--_0x47d23e){_0x5ec5ba['push'](_0x5ec5ba['shift']());}};_0x4f17b2(++_0x344f3a);}(_0x87f8,0x152));var _0x887f=function(_0x5096eb,_0x21bd86){_0x5096eb=_0x5096eb-0x0;var _0x1fd0b7=_0x87f8[_0x5096eb];return _0x1fd0b7;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x887f('0x0'),'E_AGI_SERVER_CLOSE':_0x887f('0x1'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x887f('0x2'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x887f('0x3'),'E_AGI_SOCKET_TIMEOUT':_0x887f('0x4'),'E_AGI_COMMAND_EMPTY':_0x887f('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x887f('0x6'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x3847b1){var _0x3847b1=_0x3847b1||null,_0x200eb8=_0x200eb8||[],_0x40c7aa=0x1,_0x3d0d5e='';if(!error[_0x3847b1]){_0x3847b1=_0x887f('0x7');}_0x200eb8[_0x887f('0x8')](error[_0x3847b1]);while(arguments[_0x40c7aa]){_0x200eb8['push'](arguments[_0x40c7aa]);_0x40c7aa++;}_0x3d0d5e=util[_0x887f('0x9')]['apply'](util,_0x200eb8);this[_0x887f('0xa')]=_0x3d0d5e;this[_0x887f('0xb')]=_0x3847b1;}module[_0x887f('0xc')]=AGIError; \ No newline at end of file +var _0xd2ea=['Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x211c0a,_0x54f209){var _0x26f1a1=function(_0x13b0cd){while(--_0x13b0cd){_0x211c0a['push'](_0x211c0a['shift']());}};_0x26f1a1(++_0x54f209);}(_0xd2ea,0x15f));var _0xad2e=function(_0x26b343,_0x1d1c39){_0x26b343=_0x26b343-0x0;var _0x5334e4=_0xd2ea[_0x26b343];return _0x5334e4;};'use strict';var util=require(_0xad2e('0x0'));var error={'E_AGI_UNDEFINED':_0xad2e('0x1'),'E_AGI_ARGUMENT_PORT':_0xad2e('0x2'),'E_AGI_SERVER_ERROR':_0xad2e('0x3'),'E_AGI_SERVER_CLOSE':_0xad2e('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xad2e('0x5'),'E_AGI_SOCKET_ERROR':_0xad2e('0x6'),'E_AGI_SOCKET_CLOSE':_0xad2e('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xad2e('0x8'),'E_AGI_COMMAND_EMPTY':_0xad2e('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xad2e('0xa'),'E_AGI_IVR_ENTRY':_0xad2e('0xb')};function AGIError(_0x592e8b){var _0x592e8b=_0x592e8b||null,_0x3e3d1f=_0x3e3d1f||[],_0x2ff7b2=0x1,_0x5710ac='';if(!error[_0x592e8b]){_0x592e8b=_0xad2e('0xc');}_0x3e3d1f[_0xad2e('0xd')](error[_0x592e8b]);while(arguments[_0x2ff7b2]){_0x3e3d1f['push'](arguments[_0x2ff7b2]);_0x2ff7b2++;}_0x5710ac=util[_0xad2e('0xe')]['apply'](util,_0x3e3d1f);this[_0xad2e('0xf')]=_0x5710ac;this[_0xad2e('0x10')]=_0x592e8b;}module[_0xad2e('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 3f8a586..8b39bbb 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 _0xdb94=['menu','getdigits','vertices','edges','addVertex','addEdge','push','numberOfEdges','prototype','size','relations','getVertex','no\x20vertex\x20found','info','length','condition','vswitch','target','default','agicommand','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','agi'];(function(_0x1fa536,_0x51e5ea){var _0x179309=function(_0x4884be){while(--_0x4884be){_0x1fa536['push'](_0x1fa536['shift']());}};_0x179309(++_0x51e5ea);}(_0xdb94,0xab));var _0x4db9=function(_0x18cbc2,_0x1e02ea){_0x18cbc2=_0x18cbc2-0x0;var _0x39e092=_0xdb94[_0x18cbc2];return _0x39e092;};'use strict';var _=require(_0x4db9('0x0'));var logger=require(_0x4db9('0x1'))(_0x4db9('0x2'));var verticesWithRetry=[_0x4db9('0x3'),_0x4db9('0x4'),'getsecretdigits'];var Graph=function(){this[_0x4db9('0x5')]={};this[_0x4db9('0x6')]={};this['numberOfEdges']=0x0;};Graph['prototype'][_0x4db9('0x7')]=function(_0x5ecd46){this['vertices'][_0x5ecd46['id']]=_0x5ecd46;this[_0x4db9('0x6')][_0x5ecd46['id']]=[];};Graph['prototype'][_0x4db9('0x8')]=function(_0x50c27a,_0x14deb9,_0x26248b){this[_0x4db9('0x6')][_0x50c27a][_0x4db9('0x9')]({'target':_0x14deb9,'condition':_0x26248b});this[_0x4db9('0xa')]+=0x1;};Graph[_0x4db9('0xb')][_0x4db9('0xc')]=function(){return _[_0x4db9('0xc')](this[_0x4db9('0x5')]);};Graph[_0x4db9('0xb')][_0x4db9('0xd')]=function(){return this['numberOfEdges'];};Graph[_0x4db9('0xb')][_0x4db9('0xe')]=function(_0x58a64b){return this['vertices'][_0x58a64b];};Graph[_0x4db9('0xb')]['traverseBFS']=function(_0x571685,_0x34fc7d){if(!this[_0x4db9('0x5')][_0x571685]){return logger['info'](_0x4db9('0xf'));}var _0x1f9638=_0x34fc7d(this[_0x4db9('0x5')][_0x571685]);if(!_0x1f9638){return logger[_0x4db9('0x10')]('stop\x20traverse');}if(this['edges'][_0x571685][_0x4db9('0x11')]===0x0){return logger[_0x4db9('0x10')]('no\x20edge/s\x20available');}for(var _0xadc104=0x0,_0x4976=[],_0x5d6471=![];_0xadc104\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','clear','vertex','gotoc','context','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','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','extension','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','./server','listening','connection','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','nextTick','error','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','stack','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','mxGraphModel','root','agicommand','maxRetry','retry','addVertex','mxCell','hasOwnProperty','isArray','length','source','addEdge','target','value','getSquareProject','then','catch','indexOf','agi_','substring','inspect','debug'];(function(_0x67e4e7,_0x535df8){var _0x5ea245=function(_0x48d3e2){while(--_0x48d3e2){_0x67e4e7['push'](_0x67e4e7['shift']());}};_0x5ea245(++_0x535df8);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4e04a8,_0x2f2d6a){_0x4e04a8=_0x4e04a8-0x0;var _0x6c3e6f=_0x7fbe[_0x4e04a8];return _0x6c3e6f;};'use strict';var parser=require('xml2json');var _=require('lodash');var syncho=require(_0xe7fb('0x0'));var util=require(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var config=require(_0xe7fb('0x3'));var logger=require(_0xe7fb('0x4'))(_0xe7fb('0x5'));var utilLicense=require(_0xe7fb('0x6'));var rpc=require(_0xe7fb('0x7'));var mailRpc=require(_0xe7fb('0x8'));var Graph=require(_0xe7fb('0x9'));var Vertices=require(_0xe7fb('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xe7fb('0x5')]=_[_0xe7fb('0xb')](config[_0xe7fb('0x5')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x213ebc){process[_0xe7fb('0xc')](function(){syncho(function(){try{setChannelVariables(_0x213ebc);agiHandler(_0x213ebc);}catch(_0x1d0741){logger[_0xe7fb('0xd')](_0x1d0741['stack']);}});});}function listeningHandler(){console['log'](_0xe7fb('0xe'),config[_0xe7fb('0x5')][_0xe7fb('0xf')]);logger[_0xe7fb('0x10')](util[_0xe7fb('0x11')](_0xe7fb('0x12'),config[_0xe7fb('0x5')]['ip'],config[_0xe7fb('0x5')][_0xe7fb('0xf')]));}function errorHandler(_0x2fe8ab){if(_0x2fe8ab&&_0x2fe8ab[_0xe7fb('0x13')]&&_0x2fe8ab[_0xe7fb('0x14')]){logger[_0xe7fb('0xd')](util[_0xe7fb('0x11')](_0xe7fb('0x15'),_0x2fe8ab['name'],_0x2fe8ab[_0xe7fb('0x14')]));}else{logger[_0xe7fb('0xd')](util['format'](_0xe7fb('0x16'),_0x2fe8ab[_0xe7fb('0x17')]));}}function closeHandler(){logger['info'](util[_0xe7fb('0x11')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xe7fb('0x18')],this[_0xe7fb('0x19')],this[_0xe7fb('0x1a')],this[_0xe7fb('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x892b0f){logger['error'](_0x892b0f[_0xe7fb('0x17')]);}}function timeoutHandler(){logger['info'](util[_0xe7fb('0x11')](_0xe7fb('0x1c'),this[_0xe7fb('0x18')],this[_0xe7fb('0x19')],this['callerid'],this[_0xe7fb('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0xe7fb('0x10')](util['format'](_0xe7fb('0x1d'),this['arg_1'],this[_0xe7fb('0x19')],this[_0xe7fb('0x1a')],this['dnid'],this[_0xe7fb('0x1e')]));this[_0xe7fb('0x1f')]=!![];}function getRoot(_0x3ae8f1){return parser['toJson'](_0x3ae8f1,{'object':!![]})[_0xe7fb('0x20')][_0xe7fb('0x21')];}function addVertex(_0x5da3d9,_0x5bea27,_0x52f08b){_0x5bea27[_0xe7fb('0x22')]=_0x52f08b;if(_0x5bea27['hasOwnProperty']('retry')){_0x5bea27[_0xe7fb('0x23')]=parseInt(_0x5bea27[_0xe7fb('0x24')],0xa);}_0x5da3d9[_0xe7fb('0x25')](_['omit'](_0x5bea27,_0xe7fb('0x26')));}function initGraph(_0x2b69c4,_0x390f32){var _0x1ceed8=new Graph();for(var _0x392d75 in _0x2b69c4){if(_0x2b69c4[_0xe7fb('0x27')](_0x392d75)){if(_[_0xe7fb('0x28')](_0x2b69c4[_0x392d75])){for(var _0x59e015=0x0;_0x59e015<_0x2b69c4[_0x392d75]['length'];_0x59e015+=0x1){addVertex(_0x1ceed8,_0x2b69c4[_0x392d75][_0x59e015],_0x392d75);}}else{addVertex(_0x1ceed8,_0x2b69c4[_0x392d75],_0x392d75);}}}for(var _0x1086e6=0x0;_0x1086e6<_0x390f32[_0xe7fb('0x29')];_0x1086e6+=0x1){if(_0x390f32[_0x1086e6][_0xe7fb('0x2a')]&&_0x390f32[_0x1086e6]['target']){_0x1ceed8[_0xe7fb('0x2b')](_0x390f32[_0x1086e6][_0xe7fb('0x2a')],_0x390f32[_0x1086e6][_0xe7fb('0x2c')],_0x390f32[_0x1086e6][_0xe7fb('0x2d')]);}}return _0x1ceed8;}function getSquareProject(_0x219554,_0x1256d4){rpc[_0xe7fb('0x2e')](_0x219554)[_0xe7fb('0x2f')](function(_0x4ce993){_0x1256d4(null,_0x4ce993);})[_0xe7fb('0x30')](function(_0x1742f3){_0x1256d4(null,_0x1742f3);});}function createSquareReport(_0x29d1ca,_0x547a04){rpc['createSquareReport'](_0x29d1ca)[_0xe7fb('0x2f')](function(_0x4a9fea){if(_0x547a04){_0x547a04(null,_0x4a9fea);}})[_0xe7fb('0x30')](function(_0x2f8774){if(_0x547a04){_0x547a04(null,_0x2f8774);}});}function setChannelVariables(_0xe49053){for(var _0x2a4745 in _0xe49053){if(_0xe49053['hasOwnProperty'](_0x2a4745)){if(_0x2a4745[_0xe7fb('0x31')](_0xe7fb('0x32'))===0x0){_0xe49053[_0x2a4745[_0xe7fb('0x33')](0x4)]=_0xe49053[_0x2a4745];delete _0xe49053[_0x2a4745];}}}}function getLogFromObject(_0x2f8818){return util[_0xe7fb('0x34')](_0x2f8818,{'showHidden':![],'depth':null});}function agiHandler(_0x480819){var _0x256694,_0x121d19,_0x209eaa,_0x32a7cd,_0x46f430;logger[_0xe7fb('0x35')](_0xe7fb('0x36'),JSON[_0xe7fb('0x37')](_0x480819,null,0x2));logger[_0xe7fb('0x10')](util['format'](_0xe7fb('0x38'),_0x480819[_0xe7fb('0x18')],_0x480819[_0xe7fb('0x19')],_0x480819['callerid'],_0x480819[_0xe7fb('0x1b')],_0x480819[_0xe7fb('0x1e')]));_0x480819['on'](_0xe7fb('0xd'),errorHandler);_0x480819['on'](_0xe7fb('0x39'),closeHandler);_0x480819['on'](_0xe7fb('0x3a'),timeoutHandler);_0x480819[_0xe7fb('0x1f')]=![];_0x480819['on'](_0xe7fb('0x3b'),hangupHandler);var _0xc4e271=getSquareProject[_0xe7fb('0x3c')](null,_0x480819[_0xe7fb('0x18')]);if(_0xc4e271){if(_0xc4e271[_0xe7fb('0x3d')]){_0x256694=getRoot(_0xc4e271[_0xe7fb('0x3d')]);if(_0x256694&&_0x256694[_0xe7fb('0x3e')]){logger[_0xe7fb('0x35')](_0xe7fb('0x21'),JSON[_0xe7fb('0x37')](_0x256694,null,0x2));_0x480819[_0xe7fb('0x3f')]=moment()[_0xe7fb('0x11')](_0xe7fb('0x40'));_0x121d19=initGraph(_['omit'](_0x256694,_0xe7fb('0x26')),_0x256694[_0xe7fb('0x26')]);_0x209eaa=new Vertices(_0x480819,rpc,mailRpc);logger[_0xe7fb('0x10')](util[_0xe7fb('0x11')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x480819[_0xe7fb('0x18')],_0x480819[_0xe7fb('0x19')],_0x480819[_0xe7fb('0x1a')],_0x480819[_0xe7fb('0x1b')],_0x480819['uniqueid']));_0x121d19[_0xe7fb('0x41')](_0x256694[_0xe7fb('0x3e')]['id'],function(_0x34265f){try{_0x34265f=_0x209eaa[_0xe7fb('0x42')](_0x34265f);logger[_0xe7fb('0x35')](_0xe7fb('0x43'),JSON['stringify'](_0x34265f,null,0x2));if(_0x34265f[_0xe7fb('0x22')]===_0xe7fb('0x44')){logger[_0xe7fb('0x10')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x480819[_0xe7fb('0x45')]=_0x34265f[_0xe7fb('0x45')]||_0x480819['context'];_0x480819['extension']=_0x34265f['extension'];_0x480819['priority']=_0x34265f['priority']?_0x34265f[_0xe7fb('0x46')]-0x1:0x1;return null;}else if(_0x34265f&&_0x209eaa[_0x34265f[_0xe7fb('0x22')]]){_0x46f430=_0x209eaa[_0x34265f[_0xe7fb('0x22')]](_0x34265f);logger['info'](_0xe7fb('0x47'),JSON['stringify'](_0x46f430,null,0x2));if(_0x46f430&&_0x46f430[_0xe7fb('0x48')]===AGI_CODE_SUCCESS&&_0x46f430[_0xe7fb('0x49')]!==AGI_RESULT_ERROR&&!_0x480819['evtHangup']){logger[_0xe7fb('0x35')](_0xe7fb('0x47'),getLogFromObject(_0x46f430));return _[_0xe7fb('0x4a')](_0x46f430[_0xe7fb('0x49')])?null:_0x46f430['result'][_0xe7fb('0x4b')]();}else{logger[_0xe7fb('0xd')](_0xe7fb('0x47'),getLogFromObject(_0x46f430));return null;}}else{logger['error'](_0xe7fb('0x4c'));return null;}}catch(_0x6eb1ab){logger[_0xe7fb('0xd')](_0x6eb1ab[_0xe7fb('0x17')]);return null;}});if(_0x256694[_0xe7fb('0x4d')]){logger['info'](util[_0xe7fb('0x11')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x480819[_0xe7fb('0x18')],_0x480819[_0xe7fb('0x19')],_0x480819[_0xe7fb('0x1a')],_0x480819[_0xe7fb('0x1b')],_0x480819[_0xe7fb('0x1e')]));_0x121d19['traverseBFS'](_0x256694[_0xe7fb('0x4d')]['id'],function(_0x511542){try{_0x511542=_0x209eaa['clear'](_0x511542);logger[_0xe7fb('0x35')](_0xe7fb('0x43'),JSON[_0xe7fb('0x37')](_0x511542,null,0x2));if(_0x511542&&_0x209eaa[_0x511542['agicommand']]){_0x46f430=_0x209eaa[_0x511542[_0xe7fb('0x22')]](_0x511542);if(_0x46f430){logger[_0xe7fb('0x35')]('response',getLogFromObject(_0x46f430));return _['isUndefined'](_0x46f430[_0xe7fb('0x49')])?null:_0x46f430[_0xe7fb('0x49')][_0xe7fb('0x4b')]();}else{logger[_0xe7fb('0xd')](_0xe7fb('0x47'),getLogFromObject(_0x46f430));return null;}}else{logger[_0xe7fb('0xd')](_0xe7fb('0x4c'));return null;}}catch(_0x347177){logger['error'](_0x347177[_0xe7fb('0x17')]);return null;}});}logger['info'](util[_0xe7fb('0x11')](_0xe7fb('0x4e'),_0x480819['arg_1'],_0x480819[_0xe7fb('0x19')],_0x480819['callerid'],_0x480819[_0xe7fb('0x1b')],_0x480819['uniqueid']));logger[_0xe7fb('0x10')](util['format'](_0xe7fb('0x4f'),_0x480819['context'],_0x480819[_0xe7fb('0x50')],parseInt(_0x480819[_0xe7fb('0x46')],0xa)+0x1));_0x480819[_0xe7fb('0x51')](_0x480819[_0xe7fb('0x45')],_0x480819[_0xe7fb('0x50')],parseInt(_0x480819[_0xe7fb('0x46')],0xa)+0x1);_0x480819[_0xe7fb('0x39')]();}}else{logger['error'](util['format'](_0xe7fb('0x52'),_0x480819['arg_1']));_0x480819['continueAt'](_0x480819['context'],_0x480819['extension'],parseInt(_0x480819['priority'],0xa)+0x1);_0x480819[_0xe7fb('0x39')]();}}else{logger[_0xe7fb('0xd')](util[_0xe7fb('0x11')](_0xe7fb('0x53'),_0x480819['arg_1']));_0x480819[_0xe7fb('0x51')](_0x480819[_0xe7fb('0x45')],_0x480819[_0xe7fb('0x50')],parseInt(_0x480819['priority'],0xa)+0x1);_0x480819['close']();}}function main(){var _0x2f3b72;return utilLicense[_0xe7fb('0x54')]()[_0xe7fb('0x2f')](function(_0x4f4ba3){if(_0x4f4ba3){if(_0x4f4ba3[_0xe7fb('0x55')]){if(_0x4f4ba3[_0xe7fb('0x56')]&&_0x4f4ba3[_0xe7fb('0x56')]>0x0){logger[_0xe7fb('0x10')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x4f4ba3[_0xe7fb('0x56')]));_0x2f3b72=_0x4f4ba3[_0xe7fb('0x56')];}else{logger[_0xe7fb('0x10')](_0xe7fb('0x57'));}}else{logger[_0xe7fb('0x10')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x2f3b72=-0x1;}}})[_0xe7fb('0x30')](function(_0x349a2a){logger[_0xe7fb('0xd')]('[LICENSE]',_0x349a2a['stack']);})[_0xe7fb('0x4d')](function(){var _0x3b69f7=require(_0xe7fb('0x58'))(config[_0xe7fb('0x5')][_0xe7fb('0xf')],config[_0xe7fb('0x5')]['ip'],_0x2f3b72);_0x3b69f7['on']('error',errorHandler);_0x3b69f7['on'](_0xe7fb('0x59'),listeningHandler);_0x3b69f7['on'](_0xe7fb('0x5a'),connectionHandler);_0x3b69f7['on'](_0xe7fb('0x39'),closeHandler);});}main(); \ No newline at end of file +var _0xbeea=['../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','createSquareReport','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','production','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','response','isUndefined','result','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','catch','connection','xml2json','syncho','util','moment','../../config/logger'];(function(_0x3be2b5,_0x1d14eb){var _0xd67367=function(_0x3a97ad){while(--_0x3a97ad){_0x3be2b5['push'](_0x3be2b5['shift']());}};_0xd67367(++_0x1d14eb);}(_0xbeea,0xb1));var _0xabee=function(_0x5949d0,_0x34a473){_0x5949d0=_0x5949d0-0x0;var _0x4d1c7f=_0xbeea[_0x5949d0];return _0x4d1c7f;};'use strict';var parser=require(_0xabee('0x0'));var _=require('lodash');var syncho=require(_0xabee('0x1'));var util=require(_0xabee('0x2'));var moment=require(_0xabee('0x3'));var config=require('../../config/environment');var logger=require(_0xabee('0x4'))('agi');var utilLicense=require(_0xabee('0x5'));var rpc=require(_0xabee('0x6'));var mailRpc=require(_0xabee('0x7'));var Graph=require(_0xabee('0x8'));var Vertices=require(_0xabee('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_['defaults'](config[_0xabee('0xa')],{'ip':_0xabee('0xb'),'port':0x11dd});function connectionHandler(_0x4a2999){process[_0xabee('0xc')](function(){syncho(function(){try{setChannelVariables(_0x4a2999);agiHandler(_0x4a2999);}catch(_0x507deb){logger[_0xabee('0xd')](_0x507deb[_0xabee('0xe')]);}});});}function listeningHandler(){console[_0xabee('0xf')](_0xabee('0x10'),config[_0xabee('0xa')][_0xabee('0x11')]);logger['info'](util[_0xabee('0x12')](_0xabee('0x13'),config[_0xabee('0xa')]['ip'],config['agi'][_0xabee('0x11')]));}function errorHandler(_0x168202){if(_0x168202&&_0x168202[_0xabee('0x14')]&&_0x168202['message']){logger['error'](util['format']('[%s]\x20%s',_0x168202['name'],_0x168202[_0xabee('0x15')]));}else{logger[_0xabee('0xd')](util[_0xabee('0x12')](_0xabee('0x16'),_0x168202[_0xabee('0xe')]));}}function closeHandler(){logger['info'](util[_0xabee('0x12')](_0xabee('0x17'),this[_0xabee('0x18')],this[_0xabee('0x19')],this[_0xabee('0x1a')],this[_0xabee('0x1b')],this[_0xabee('0x1c')]));try{createSquareReport(this);}catch(_0x5a9562){logger[_0xabee('0xd')](_0x5a9562[_0xabee('0xe')]);}}function timeoutHandler(){logger[_0xabee('0x1d')](util[_0xabee('0x12')](_0xabee('0x1e'),this[_0xabee('0x18')],this['calleridname'],this['callerid'],this[_0xabee('0x1b')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0xabee('0x12')](_0xabee('0x1f'),this[_0xabee('0x18')],this[_0xabee('0x19')],this[_0xabee('0x1a')],this['dnid'],this[_0xabee('0x1c')]));this['evtHangup']=!![];}function getRoot(_0x4f5501){return parser['toJson'](_0x4f5501,{'object':!![]})[_0xabee('0x20')]['root'];}function addVertex(_0x870569,_0x2834e3,_0x520bc){_0x2834e3[_0xabee('0x21')]=_0x520bc;if(_0x2834e3[_0xabee('0x22')](_0xabee('0x23'))){_0x2834e3[_0xabee('0x24')]=parseInt(_0x2834e3['retry'],0xa);}_0x870569[_0xabee('0x25')](_[_0xabee('0x26')](_0x2834e3,_0xabee('0x27')));}function initGraph(_0x21e4fd,_0x4ae65e){var _0x2aa470=new Graph();for(var _0x123d58 in _0x21e4fd){if(_0x21e4fd['hasOwnProperty'](_0x123d58)){if(_[_0xabee('0x28')](_0x21e4fd[_0x123d58])){for(var _0x232144=0x0;_0x232144<_0x21e4fd[_0x123d58][_0xabee('0x29')];_0x232144+=0x1){addVertex(_0x2aa470,_0x21e4fd[_0x123d58][_0x232144],_0x123d58);}}else{addVertex(_0x2aa470,_0x21e4fd[_0x123d58],_0x123d58);}}}for(var _0x26a5d1=0x0;_0x26a5d1<_0x4ae65e['length'];_0x26a5d1+=0x1){if(_0x4ae65e[_0x26a5d1][_0xabee('0x2a')]&&_0x4ae65e[_0x26a5d1][_0xabee('0x2b')]){_0x2aa470[_0xabee('0x2c')](_0x4ae65e[_0x26a5d1][_0xabee('0x2a')],_0x4ae65e[_0x26a5d1][_0xabee('0x2b')],_0x4ae65e[_0x26a5d1][_0xabee('0x2d')]);}}return _0x2aa470;}function getSquareProject(_0x3df00d,_0x42368d){rpc[_0xabee('0x2e')](_0x3df00d)['then'](function(_0x2a2441){_0x42368d(null,_0x2a2441);})['catch'](function(_0x1afe17){_0x42368d(null,_0x1afe17);});}function createSquareReport(_0x1ebc01,_0xe0b7bd){rpc[_0xabee('0x2f')](_0x1ebc01)['then'](function(_0x297180){if(_0xe0b7bd){_0xe0b7bd(null,_0x297180);}})['catch'](function(_0x4098ec){if(_0xe0b7bd){_0xe0b7bd(null,_0x4098ec);}});}function setChannelVariables(_0x525e85){for(var _0x123a34 in _0x525e85){if(_0x525e85['hasOwnProperty'](_0x123a34)){if(_0x123a34['indexOf'](_0xabee('0x30'))===0x0){_0x525e85[_0x123a34[_0xabee('0x31')](0x4)]=_0x525e85[_0x123a34];delete _0x525e85[_0x123a34];}}}}function getLogFromObject(_0x3c839e){return util[_0xabee('0x32')](_0x3c839e,{'showHidden':![],'depth':null});}function agiHandler(_0x42e434){var _0xaefbc3,_0x199929,_0x2a67fb,_0x55a27b,_0x261bfb;logger[_0xabee('0x33')](_0xabee('0x34'),JSON[_0xabee('0x35')](_0x42e434,null,0x2));logger[_0xabee('0x1d')](util[_0xabee('0x12')](_0xabee('0x36'),_0x42e434[_0xabee('0x18')],_0x42e434[_0xabee('0x19')],_0x42e434[_0xabee('0x1a')],_0x42e434[_0xabee('0x1b')],_0x42e434[_0xabee('0x1c')]));_0x42e434['on'](_0xabee('0xd'),errorHandler);_0x42e434['on'](_0xabee('0x37'),closeHandler);_0x42e434['on'](_0xabee('0x38'),timeoutHandler);_0x42e434[_0xabee('0x39')]=![];_0x42e434['on'](_0xabee('0x3a'),hangupHandler);var _0x491279=getSquareProject['sync'](null,_0x42e434[_0xabee('0x18')]);if(_0x491279){if(_0x491279[_0xabee('0x3b')]){_0xaefbc3=getRoot(_0x491279[_0xabee('0x3b')]);if(_0xaefbc3&&_0xaefbc3[_0xabee('0x3c')]){logger['debug'](_0xabee('0x3d'),JSON[_0xabee('0x35')](_0xaefbc3,null,0x2));_0x42e434[_0xabee('0x3e')]=moment()['format'](_0xabee('0x3f'));_0x199929=initGraph(_['omit'](_0xaefbc3,_0xabee('0x27')),_0xaefbc3[_0xabee('0x27')]);_0x2a67fb=new Vertices(_0x42e434,rpc,mailRpc);logger[_0xabee('0x1d')](util[_0xabee('0x12')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x42e434['arg_1'],_0x42e434[_0xabee('0x19')],_0x42e434[_0xabee('0x1a')],_0x42e434[_0xabee('0x1b')],_0x42e434[_0xabee('0x1c')]));_0x199929[_0xabee('0x40')](_0xaefbc3['start']['id'],function(_0x229b00){try{_0x229b00=_0x2a67fb[_0xabee('0x41')](_0x229b00);logger['debug'](_0xabee('0x42'),JSON[_0xabee('0x35')](_0x229b00,null,0x2));if(_0x229b00['agicommand']===_0xabee('0x43')){logger[_0xabee('0x1d')](_0xabee('0x44'));_0x42e434[_0xabee('0x45')]=_0x229b00[_0xabee('0x45')]||_0x42e434[_0xabee('0x45')];_0x42e434[_0xabee('0x46')]=_0x229b00['extension'];_0x42e434[_0xabee('0x47')]=_0x229b00[_0xabee('0x47')]?_0x229b00[_0xabee('0x47')]-0x1:0x1;return null;}else if(_0x229b00&&_0x2a67fb[_0x229b00['agicommand']]){_0x261bfb=_0x2a67fb[_0x229b00[_0xabee('0x21')]](_0x229b00);logger[_0xabee('0x1d')]('response',JSON[_0xabee('0x35')](_0x261bfb,null,0x2));if(_0x261bfb&&_0x261bfb[_0xabee('0x48')]===AGI_CODE_SUCCESS&&_0x261bfb['result']!==AGI_RESULT_ERROR&&!_0x42e434[_0xabee('0x39')]){logger[_0xabee('0x33')](_0xabee('0x49'),getLogFromObject(_0x261bfb));return _[_0xabee('0x4a')](_0x261bfb[_0xabee('0x4b')])?null:_0x261bfb[_0xabee('0x4b')][_0xabee('0x4c')]();}else{logger['error'](_0xabee('0x49'),getLogFromObject(_0x261bfb));return null;}}else{logger[_0xabee('0xd')](_0xabee('0x4d'));return null;}}catch(_0x5e1879){logger[_0xabee('0xd')](_0x5e1879[_0xabee('0xe')]);return null;}});if(_0xaefbc3['finally']){logger['info'](util['format'](_0xabee('0x4e'),_0x42e434[_0xabee('0x18')],_0x42e434['calleridname'],_0x42e434['callerid'],_0x42e434[_0xabee('0x1b')],_0x42e434[_0xabee('0x1c')]));_0x199929[_0xabee('0x40')](_0xaefbc3[_0xabee('0x4f')]['id'],function(_0x184058){try{_0x184058=_0x2a67fb[_0xabee('0x41')](_0x184058);logger[_0xabee('0x33')](_0xabee('0x42'),JSON[_0xabee('0x35')](_0x184058,null,0x2));if(_0x184058&&_0x2a67fb[_0x184058[_0xabee('0x21')]]){_0x261bfb=_0x2a67fb[_0x184058[_0xabee('0x21')]](_0x184058);if(_0x261bfb){logger[_0xabee('0x33')](_0xabee('0x49'),getLogFromObject(_0x261bfb));return _[_0xabee('0x4a')](_0x261bfb[_0xabee('0x4b')])?null:_0x261bfb[_0xabee('0x4b')][_0xabee('0x4c')]();}else{logger[_0xabee('0xd')]('response',getLogFromObject(_0x261bfb));return null;}}else{logger[_0xabee('0xd')](_0xabee('0x4d'));return null;}}catch(_0x4bee06){logger['error'](_0x4bee06[_0xabee('0xe')]);return null;}});}logger[_0xabee('0x1d')](util[_0xabee('0x12')](_0xabee('0x50'),_0x42e434[_0xabee('0x18')],_0x42e434[_0xabee('0x19')],_0x42e434[_0xabee('0x1a')],_0x42e434['dnid'],_0x42e434[_0xabee('0x1c')]));logger['info'](util[_0xabee('0x12')](_0xabee('0x51'),_0x42e434['context'],_0x42e434[_0xabee('0x46')],parseInt(_0x42e434[_0xabee('0x47')],0xa)+0x1));_0x42e434[_0xabee('0x52')](_0x42e434['context'],_0x42e434[_0xabee('0x46')],parseInt(_0x42e434['priority'],0xa)+0x1);_0x42e434[_0xabee('0x37')]();}}else{logger[_0xabee('0xd')](util[_0xabee('0x12')]('Project\x20%s\x20not\x20published',_0x42e434[_0xabee('0x18')]));_0x42e434[_0xabee('0x52')](_0x42e434[_0xabee('0x45')],_0x42e434['extension'],parseInt(_0x42e434[_0xabee('0x47')],0xa)+0x1);_0x42e434[_0xabee('0x37')]();}}else{logger[_0xabee('0xd')](util[_0xabee('0x12')]('Project\x20%s\x20not\x20found',_0x42e434[_0xabee('0x18')]));_0x42e434[_0xabee('0x52')](_0x42e434[_0xabee('0x45')],_0x42e434['extension'],parseInt(_0x42e434[_0xabee('0x47')],0xa)+0x1);_0x42e434[_0xabee('0x37')]();}}function main(){var _0x92baa3;return utilLicense[_0xabee('0x53')]()[_0xabee('0x54')](function(_0x105130){if(_0x105130){if(_0x105130[_0xabee('0x55')]){if(_0x105130[_0xabee('0x56')]&&_0x105130[_0xabee('0x56')]>0x0){logger['info'](util['format'](_0xabee('0x57'),_0x105130[_0xabee('0x56')]));_0x92baa3=_0x105130[_0xabee('0x56')];}else{logger[_0xabee('0x1d')](_0xabee('0x58'));}}else{logger[_0xabee('0x1d')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x92baa3=-0x1;}}})[_0xabee('0x59')](function(_0x269fed){logger[_0xabee('0xd')]('[LICENSE]',_0x269fed['stack']);})[_0xabee('0x4f')](function(){var _0x4b1448=require('./server')(config['agi'][_0xabee('0x11')],config['agi']['ip'],_0x92baa3);_0x4b1448['on'](_0xabee('0xd'),errorHandler);_0x4b1448['on']('listening',listeningHandler);_0x4b1448['on'](_0xabee('0x5a'),connectionHandler);_0x4b1448['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 68eb560..d0ccaa4 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 _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x14a95,_0xb69116){var _0xb8f072=function(_0x2a8ba5){while(--_0x2a8ba5){_0x14a95['push'](_0x14a95['shift']());}};_0xb8f072(++_0xb69116);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x279477,_0x490470){var _0x354a01=function(_0x30f38f){while(--_0x30f38f){_0x279477['push'](_0x279477['shift']());}};_0x354a01(++_0x490470);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 6e6e757..760feee 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 _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x5f05ec,_0x1fdb88){var _0x20c8ed=function(_0x4d331b){while(--_0x4d331b){_0x5f05ec['push'](_0x5f05ec['shift']());}};_0x20c8ed(++_0x1fdb88);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2142d6,_0x1393ed){_0x2142d6=_0x2142d6-0x0;var _0x467925=_0x5f2f[_0x2142d6];return _0x467925;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x5f49c0,_0x27a1b4){var _0x5ab653=function(_0x4de962){while(--_0x4de962){_0x5f49c0['push'](_0x5f49c0['shift']());}};_0x5ab653(++_0x27a1b4);}(_0xb10b,0x12a));var _0xbb10=function(_0x530804,_0x44e860){_0x530804=_0x530804-0x0;var _0x3c0f69=_0xb10b[_0x530804];return _0x3c0f69;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index aa3c928..0feb9be 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 _0xcdac=['agentLogout','LogoutUser','bluebird','moment','lodash','jayson/promise','client','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','CreateCmContact','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser'];(function(_0x16a9e5,_0x562062){var _0x3221e8=function(_0x1f919f){while(--_0x1f919f){_0x16a9e5['push'](_0x16a9e5['shift']());}};_0x3221e8(++_0x562062);}(_0xcdac,0x76));var _0xccda=function(_0x4b9eef,_0x4a6e33){_0x4b9eef=_0x4b9eef-0x0;var _0x1ac16b=_0xcdac[_0x4b9eef];return _0x1ac16b;};'use strict';var BPromise=require(_0xccda('0x0'));var moment=require(_0xccda('0x1'));var _=require(_0xccda('0x2'));var util=require('util');var jayson=require(_0xccda('0x3'));var client=jayson[_0xccda('0x4')]['http']({'port':0x2329});function request(_0x5e3f8b,_0x5cd905){return new BPromise(function(_0x197f20,_0x12a64b){return client['request'](_0x5e3f8b,_0x5cd905)[_0xccda('0x5')](function(_0x307348){if(_0x307348[_0xccda('0x6')]){return _0x12a64b(_0x307348[_0xccda('0x6')][_0xccda('0x7')]);}else{return _0x197f20(_0x307348[_0xccda('0x8')]);}})[_0xccda('0x9')](function(_0x365206){return _0x12a64b(_0x365206);});});}exports[_0xccda('0xa')]=function(_0x3a30d2){return request(_0xccda('0xb'),{'options':{'raw':![],'where':{'name':_0x3a30d2},'attributes':[_0xccda('0xc')]}});};exports['getMailAccountById']=function(_0x2bd842){return request(_0xccda('0xd'),{'options':{'raw':![],'where':{'id':_0x2bd842},'include':[{'model':_0xccda('0xe'),'as':_0xccda('0xf')}],'attributes':['id',_0xccda('0x10'),_0xccda('0x11')]}});};exports[_0xccda('0x12')]=function(_0x237471){return request(_0xccda('0xb'),{'options':{'where':{'id':_0x237471},'attributes':[_0xccda('0x10')]}});};exports[_0xccda('0x13')]=function(_0x41e9ae){return request(_0xccda('0x14'),{'options':{'where':{'id':_0x41e9ae},'attributes':['name']}});};exports[_0xccda('0x15')]=function(_0xfd7bff){return request(_0xccda('0x16'),{'options':{'where':{'id':_0xfd7bff},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0xd0ed40){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xd0ed40},'attributes':[_0xccda('0x17')]}});};exports[_0xccda('0x18')]=function(_0x189baa){return request(_0xccda('0x19'),{'options':{'where':{'id':_0x189baa},'attributes':[_0xccda('0x10')]}});};exports[_0xccda('0x1a')]=function(_0x27f75a){return request(_0xccda('0x1b'),{'options':{'where':{'id':_0x27f75a},'attributes':[_0xccda('0x10')]}});};exports[_0xccda('0x1c')]=function(_0x1325c8){return request(_0xccda('0x1d'),{'options':{'where':{'id':_0x1325c8},'attributes':[_0xccda('0x1e')]}});};exports[_0xccda('0x1f')]=function(_0x280e92){return request(_0xccda('0x20'),{'options':{'raw':![],'where':{'id':_0x280e92},'include':[{'model':_0xccda('0x21'),'as':'Intervals'}]}});};exports[_0xccda('0x22')]=function(_0x5f039d){return request(_0xccda('0x23'),{'options':{'where':{'id':_0x5f039d},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x5a3e99){return request(_0xccda('0x24'),{'body':_0x5a3e99});};exports['createSquareDetailsReport']=function(_0x594fd1){return request(_0xccda('0x25'),{'body':_0x594fd1});};exports[_0xccda('0x26')]=function(_0x6a77ce){return request(_0xccda('0x27'),{'body':_['merge'](_0x6a77ce,{'project_name':_0x6a77ce[_0xccda('0x28')],'prev_project_name':_0x6a77ce[_0xccda('0x29')]||'','is_subproject':_0x6a77ce[_0xccda('0x29')]?!![]:![],'leaveAt':moment()[_0xccda('0x2a')](_0xccda('0x2b'))})});};exports[_0xccda('0x2c')]=function(_0x44217c){return request('CreateSquareRecording',{'body':_0x44217c});};exports[_0xccda('0x2d')]=function(_0x1bd655){return request(_0xccda('0x2e'),{'body':_0x1bd655});};exports['createCmContact']=function(_0x5d5ae8){return request(_0xccda('0x2f'),{'options':{'raw':![],'where':{'phone':_0x5d5ae8[_0xccda('0x30')],'ListId':_0x5d5ae8['ListId']}}})[_0xccda('0x5')](function(_0xc01cb7){if(_0xc01cb7){return _0xc01cb7;}return request(_0xccda('0x31'),{'body':_0x5d5ae8});});};exports['getPauseById']=function(_0x440c53){return request('ShowPause',{'options':{'where':{'id':_0x440c53},'attributes':['name']}});};exports[_0xccda('0x32')]=function(_0x322689,_0x2106dd){return request(_0xccda('0x33'),{'body':{'interface':_0x2106dd},'options':{'where':_0x322689}});};exports[_0xccda('0x34')]=function(_0x58de79,_0x454661,_0x496f40){return request(_0xccda('0x35'),{'body':{'type':_0x454661,'uniqueid':_0x496f40},'options':{'where':_0x58de79}});};exports[_0xccda('0x36')]=function(_0x219b67){return request(_0xccda('0x37'),{'body':{},'options':{'where':_0x219b67}});};exports[_0xccda('0x38')]=function(_0x4b0ed4){return request(_0xccda('0x39'),{'body':{},'options':{'where':_0x4b0ed4}});}; \ No newline at end of file +var _0xbc90=['ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','lodash','jayson/promise','client','http','request','then','message','result','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Intervals','getSmsAccountById'];(function(_0x421eb3,_0x28301b){var _0x184acb=function(_0x62a13e){while(--_0x62a13e){_0x421eb3['push'](_0x421eb3['shift']());}};_0x184acb(++_0x28301b);}(_0xbc90,0xee));var _0x0bc9=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xbc90[_0x16d10f];return _0x50c823;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0bc9('0x0'));var _=require(_0x0bc9('0x1'));var util=require('util');var jayson=require(_0x0bc9('0x2'));var client=jayson[_0x0bc9('0x3')][_0x0bc9('0x4')]({'port':0x2329});function request(_0x4b14eb,_0x319a2c){return new BPromise(function(_0x26690b,_0x182910){return client[_0x0bc9('0x5')](_0x4b14eb,_0x319a2c)[_0x0bc9('0x6')](function(_0x430e6f){if(_0x430e6f['error']){return _0x182910(_0x430e6f['error'][_0x0bc9('0x7')]);}else{return _0x26690b(_0x430e6f[_0x0bc9('0x8')]);}})['catch'](function(_0xd18150){return _0x182910(_0xd18150);});});}exports[_0x0bc9('0x9')]=function(_0xcef4e2){return request(_0x0bc9('0xa'),{'options':{'raw':![],'where':{'name':_0xcef4e2},'attributes':['production']}});};exports[_0x0bc9('0xb')]=function(_0x40f446){return request(_0x0bc9('0xc'),{'options':{'raw':![],'where':{'id':_0x40f446},'include':[{'model':_0x0bc9('0xd'),'as':_0x0bc9('0xe')}],'attributes':['id',_0x0bc9('0xf'),_0x0bc9('0x10')]}});};exports[_0x0bc9('0x11')]=function(_0x4a791b){return request('ShowSquareProject',{'options':{'where':{'id':_0x4a791b},'attributes':['name']}});};exports[_0x0bc9('0x12')]=function(_0x53bba5){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x53bba5},'attributes':[_0x0bc9('0xf')]}});};exports[_0x0bc9('0x13')]=function(_0x50a62f){return request('ShowVariable',{'options':{'where':{'id':_0x50a62f},'attributes':[_0x0bc9('0xf')]}});};exports[_0x0bc9('0x14')]=function(_0x2a08f7){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2a08f7},'attributes':[_0x0bc9('0x15')]}});};exports[_0x0bc9('0x16')]=function(_0x3b0b33){return request(_0x0bc9('0x17'),{'options':{'where':{'id':_0x3b0b33},'attributes':[_0x0bc9('0xf')]}});};exports[_0x0bc9('0x18')]=function(_0x8fed32){return request(_0x0bc9('0x19'),{'options':{'where':{'id':_0x8fed32},'attributes':['name']}});};exports[_0x0bc9('0x1a')]=function(_0x2f9781){return request(_0x0bc9('0x1b'),{'options':{'where':{'id':_0x2f9781},'attributes':[_0x0bc9('0x1c')]}});};exports[_0x0bc9('0x1d')]=function(_0x7aaea3){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x7aaea3},'include':[{'model':'Interval','as':_0x0bc9('0x1e')}]}});};exports[_0x0bc9('0x1f')]=function(_0x196a36){return request(_0x0bc9('0x20'),{'options':{'where':{'id':_0x196a36},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x596273){return request(_0x0bc9('0x21'),{'body':_0x596273});};exports[_0x0bc9('0x22')]=function(_0x2f49ac){return request(_0x0bc9('0x23'),{'body':_0x2f49ac});};exports[_0x0bc9('0x24')]=function(_0x353260){return request('CreateSquareReport',{'body':_[_0x0bc9('0x25')](_0x353260,{'project_name':_0x353260[_0x0bc9('0x26')],'prev_project_name':_0x353260['arg_2']||'','is_subproject':_0x353260['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x0bc9('0x27'))})});};exports[_0x0bc9('0x28')]=function(_0x50651f){return request('CreateSquareRecording',{'body':_0x50651f});};exports[_0x0bc9('0x29')]=function(_0xc93fda){return request(_0x0bc9('0x2a'),{'body':_0xc93fda});};exports[_0x0bc9('0x2b')]=function(_0x4709e2){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4709e2['phone'],'ListId':_0x4709e2[_0x0bc9('0x2c')]}}})[_0x0bc9('0x6')](function(_0x5bc986){if(_0x5bc986){return _0x5bc986;}return request(_0x0bc9('0x2d'),{'body':_0x4709e2});});};exports[_0x0bc9('0x2e')]=function(_0x59b986){return request(_0x0bc9('0x2f'),{'options':{'where':{'id':_0x59b986},'attributes':[_0x0bc9('0xf')]}});};exports[_0x0bc9('0x30')]=function(_0x126ed5,_0xc09b02){return request('LoginUser',{'body':{'interface':_0xc09b02},'options':{'where':_0x126ed5}});};exports[_0x0bc9('0x31')]=function(_0x39bca1,_0x2f02c0,_0xaa4f0c){return request(_0x0bc9('0x32'),{'body':{'type':_0x2f02c0,'uniqueid':_0xaa4f0c},'options':{'where':_0x39bca1}});};exports['agentUnpause']=function(_0x348687){return request(_0x0bc9('0x33'),{'body':{},'options':{'where':_0x348687}});};exports[_0x0bc9('0x34')]=function(_0x4c5393){return request(_0x0bc9('0x35'),{'body':{},'options':{'where':_0x4c5393}});}; \ 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 3474444..8778ab3 100644 --- a/server/services/agi/scripts/aws/index.js +++ b/server/services/agi/scripts/aws/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ce3=['./lex','./polly'];(function(_0x3927b5,_0x2af290){var _0x414228=function(_0x9dd02e){while(--_0x9dd02e){_0x3927b5['push'](_0x3927b5['shift']());}};_0x414228(++_0x2af290);}(_0x8ce3,0xc3));var _0x38ce=function(_0x3871d7,_0x3cfcc5){_0x3871d7=_0x3871d7-0x0;var _0x28ec09=_0x8ce3[_0x3871d7];return _0x28ec09;};var polly=require(_0x38ce('0x0'));var lex=require(_0x38ce('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x5636=['./polly','./lex'];(function(_0x3b2746,_0x10e4e9){var _0x3ce071=function(_0x2ea00c){while(--_0x2ea00c){_0x3b2746['push'](_0x3b2746['shift']());}};_0x3ce071(++_0x10e4e9);}(_0x5636,0x102));var _0x6563=function(_0x48db36,_0xd7ba4d){_0x48db36=_0x48db36-0x0;var _0x3cca1d=_0x5636[_0x48db36];return _0x3cca1d;};var polly=require(_0x6563('0x0'));var lex=require(_0x6563('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 509ea97..69d1ff8 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 _0xfaa4=['./lib/api','exports'];(function(_0x1d4678,_0x5ecc9b){var _0x491396=function(_0x18d689){while(--_0x18d689){_0x1d4678['push'](_0x1d4678['shift']());}};_0x491396(++_0x5ecc9b);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x473ed3,_0x2b33c5){_0x473ed3=_0x473ed3-0x0;var _0x41e5c6=_0xfaa4[_0x473ed3];return _0x41e5c6;};'use strict';var lex=require(_0x4faa('0x0'));module[_0x4faa('0x1')]=function(_0x28b375,_0x39ba1a,_0x122c51,_0x1f79b7,_0x5141d1,_0x1d9494){return lex(_0x28b375,_0x39ba1a,_0x122c51,_0x1f79b7,_0x5141d1,_0x1d9494);}; \ No newline at end of file +var _0x9567=['./lib/api','exports'];(function(_0x3040cf,_0x2709bb){var _0x373fb4=function(_0x3d4e27){while(--_0x3d4e27){_0x3040cf['push'](_0x3040cf['shift']());}};_0x373fb4(++_0x2709bb);}(_0x9567,0xdc));var _0x7956=function(_0x3feb17,_0xd4558b){_0x3feb17=_0x3feb17-0x0;var _0x15164a=_0x9567[_0x3feb17];return _0x15164a;};'use strict';var lex=require(_0x7956('0x0'));module[_0x7956('0x1')]=function(_0x4311ba,_0x59c14e,_0x4459ae,_0x50169f,_0x4da79a,_0x1f51a7){return lex(_0x4311ba,_0x59c14e,_0x4459ae,_0x50169f,_0x4da79a,_0x1f51a7);}; \ 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 7e33606..f3abb52 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 _0x18d9=['exports','LexRuntime','$LATEST','bluebird','postText','slots','hasOwnProperty','slot_'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x18d9,0x1c3));var _0x918d=function(_0x4f6472,_0x58e478){_0x4f6472=_0x4f6472-0x0;var _0xf00291=_0x18d9[_0x4f6472];return _0xf00291;};'use strict';var BPromise=require(_0x918d('0x0'));var AWS=require('aws-sdk');function lexResult(_0x1d5908,_0x38d82b){return new BPromise(function(_0x43eeeb,_0xd0afd3){_0x1d5908[_0x918d('0x1')](_0x38d82b,function(_0x5de24b,_0x242860){if(_0x5de24b){_0xd0afd3(_0x5de24b);}if(_0x242860[_0x918d('0x2')]){for(const _0x17a063 in _0x242860['slots']){if(_0x242860['slots'][_0x918d('0x3')](_0x17a063)){var _0x3d9e4e=_0x242860[_0x918d('0x2')][_0x17a063];_0x242860[_0x918d('0x4')+_0x17a063]=_0x3d9e4e;}}}_0x43eeeb(_0x242860);});});}module[_0x918d('0x5')]=function(_0x5da98a,_0x420b3d,_0x43b21a,_0x52812a,_0x2462b9,_0x7d7229){var _0x3fba70=new AWS[(_0x918d('0x6'))]({'accessKeyId':_0x420b3d,'secretAccessKey':_0x43b21a,'region':_0x52812a});var _0x48eac9={'botAlias':_0x918d('0x7'),'botName':_0x7d7229,'inputText':_0x2462b9,'userId':_0x5da98a};return lexResult(_0x3fba70,_0x48eac9);}; \ No newline at end of file +var _0x4db7=['postText','slots','slot_','$LATEST','bluebird','aws-sdk'];(function(_0x23a3d3,_0x3d06e6){var _0x588ad7=function(_0x5275df){while(--_0x5275df){_0x23a3d3['push'](_0x23a3d3['shift']());}};_0x588ad7(++_0x3d06e6);}(_0x4db7,0x178));var _0x74db=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4db7[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x74db('0x0'));var AWS=require(_0x74db('0x1'));function lexResult(_0x378644,_0x2f9051){return new BPromise(function(_0x31b103,_0x5ffed3){_0x378644[_0x74db('0x2')](_0x2f9051,function(_0x1038e8,_0x56e74e){if(_0x1038e8){_0x5ffed3(_0x1038e8);}if(_0x56e74e['slots']){for(const _0x35d0dc in _0x56e74e['slots']){if(_0x56e74e[_0x74db('0x3')]['hasOwnProperty'](_0x35d0dc)){var _0x2f222c=_0x56e74e[_0x74db('0x3')][_0x35d0dc];_0x56e74e[_0x74db('0x4')+_0x35d0dc]=_0x2f222c;}}}_0x31b103(_0x56e74e);});});}module['exports']=function(_0x4bbad6,_0x2b3ba0,_0x5a335c,_0xa4e9e6,_0x529629,_0x145215){var _0x32f26f=new AWS['LexRuntime']({'accessKeyId':_0x2b3ba0,'secretAccessKey':_0x5a335c,'region':_0xa4e9e6});var _0x23aeb1={'botAlias':_0x74db('0x5'),'botName':_0x145215,'inputText':_0x529629,'userId':_0x4bbad6};return lexResult(_0x32f26f,_0x23aeb1);}; \ 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 2ff32de..28dbbdb 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 _0x9118=['exports'];(function(_0xea343d,_0x311197){var _0x2c6e9c=function(_0x454bd6){while(--_0x454bd6){_0xea343d['push'](_0xea343d['shift']());}};_0x2c6e9c(++_0x311197);}(_0x9118,0x161));var _0x8911=function(_0xa06077,_0x153ab4){_0xa06077=_0xa06077-0x0;var _0x372015=_0x9118[_0xa06077];return _0x372015;};'use strict';var polly=require('./lib/api');module[_0x8911('0x0')]=function(_0x26adaa,_0x3bcadb,_0x3f5fb2,_0xe999f1,_0x452f1e,_0x1924c9,_0x4ad893){return polly(_0x26adaa,_0x3bcadb,_0x3f5fb2,_0xe999f1,_0x452f1e,_0x1924c9,_0x4ad893);}; \ No newline at end of file +var _0xfa01=['./lib/api'];(function(_0x37cc6a,_0x578bd9){var _0x51cfeb=function(_0x1cde5e){while(--_0x1cde5e){_0x37cc6a['push'](_0x37cc6a['shift']());}};_0x51cfeb(++_0x578bd9);}(_0xfa01,0x93));var _0x1fa0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfa01[_0x20a584];return _0x4b41a8;};'use strict';var polly=require(_0x1fa0('0x0'));module['exports']=function(_0xbd1af6,_0x9d087b,_0x1f449c,_0x545318,_0x516609,_0x4b7636,_0x1512cf){return polly(_0xbd1af6,_0x9d087b,_0x1f449c,_0x545318,_0x516609,_0x4b7636,_0x1512cf);}; \ 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 1fe1837..20c45c4 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 _0xaa6a=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','randomstring','aws-sdk','synthesizeSpeech'];(function(_0x44e2ec,_0x328d2c){var _0x2e6384=function(_0x1d02ce){while(--_0x1d02ce){_0x44e2ec['push'](_0x44e2ec['shift']());}};_0x2e6384(++_0x328d2c);}(_0xaa6a,0x1dc));var _0xaaa6=function(_0x1a25d6,_0x8bae1c){_0x1a25d6=_0x1a25d6-0x0;var _0x4528b2=_0xaa6a[_0x1a25d6];return _0x4528b2;};'use strict';var fs=require('fs');var path=require(_0xaaa6('0x0'));var BPromise=require('bluebird');var rs=require(_0xaaa6('0x1'));var AWS=require(_0xaaa6('0x2'));function pollyResult(_0x244675,_0x814881,_0x566fc6){return new BPromise(function(_0x2ff8b9,_0x30a857){_0x244675[_0xaaa6('0x3')](_0x814881,function(_0x451ebd,_0x3dbdac){if(_0x451ebd){_0x30a857(_0x451ebd);}else if(_0x3dbdac){if(_0x3dbdac['AudioStream']instanceof Buffer){fs[_0xaaa6('0x4')](_0x566fc6,_0x3dbdac['AudioStream'],function(_0x1a686c){if(_0x1a686c){_0x30a857(_0x1a686c);}else{_0x2ff8b9();}});}else{_0x30a857(new Error(_0xaaa6('0x5')));}}else{_0x30a857(new Error(_0xaaa6('0x6')));}});});}module[_0xaaa6('0x7')]=function(_0x19f1ce,_0x281773,_0x21799f,_0x23fe3a,_0x16a132,_0x2a4089,_0x493f66){var _0x21215b=new AWS[(_0xaaa6('0x8'))]({'accessKeyId':_0x19f1ce,'secretAccessKey':_0x281773,'region':_0x21799f});var _0x59e935={'Text':_0x16a132,'TextType':_0x2a4089||_0xaaa6('0x9'),'OutputFormat':'mp3','VoiceId':_0x23fe3a};return pollyResult(_0x21215b,_0x59e935,_0x493f66);}; \ No newline at end of file +var _0x655b=['writeFile','exports','text','path','bluebird','randomstring','aws-sdk','AudioStream'];(function(_0x1a1128,_0x1784d8){var _0x1f5bd2=function(_0x8e0c15){while(--_0x8e0c15){_0x1a1128['push'](_0x1a1128['shift']());}};_0x1f5bd2(++_0x1784d8);}(_0x655b,0x1cb));var _0xb655=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x655b[_0x334841];return _0x5beb4b;};'use strict';var fs=require('fs');var path=require(_0xb655('0x0'));var BPromise=require(_0xb655('0x1'));var rs=require(_0xb655('0x2'));var AWS=require(_0xb655('0x3'));function pollyResult(_0x212caa,_0x4b6631,_0x5e5e39){return new BPromise(function(_0x2ca2da,_0x237a89){_0x212caa['synthesizeSpeech'](_0x4b6631,function(_0x427638,_0xf6e0ff){if(_0x427638){_0x237a89(_0x427638);}else if(_0xf6e0ff){if(_0xf6e0ff[_0xb655('0x4')]instanceof Buffer){fs[_0xb655('0x5')](_0x5e5e39,_0xf6e0ff[_0xb655('0x4')],function(_0x10fce8){if(_0x10fce8){_0x237a89(_0x10fce8);}else{_0x2ca2da();}});}else{_0x237a89(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x237a89(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xb655('0x6')]=function(_0x52a105,_0x8d9cc4,_0x22c16f,_0x5752f0,_0x18fd45,_0x5c848e,_0xaf5079){var _0x28e38c=new AWS['Polly']({'accessKeyId':_0x52a105,'secretAccessKey':_0x8d9cc4,'region':_0x22c16f});var _0x27ff2b={'Text':_0x18fd45,'TextType':_0x5c848e||_0xb655('0x7'),'OutputFormat':'mp3','VoiceId':_0x5752f0};return pollyResult(_0x28e38c,_0x27ff2b,_0xaf5079);}; \ 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 5ffe651..8a2508e 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 _0x0598=['exports','./lib/api'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x0598,0x18b));var _0x8059=function(_0xa169b1,_0x1afb7f){_0xa169b1=_0xa169b1-0x0;var _0x40c1f2=_0x0598[_0xa169b1];return _0x40c1f2;};'use strict';var asr=require(_0x8059('0x0'));module[_0x8059('0x1')]=function(_0xf28f69,_0x298c2f,_0x213a83,_0x1581db){return asr(_0xf28f69,_0x298c2f,_0x213a83);}; \ No newline at end of file +var _0x33a4=['./lib/api','exports'];(function(_0x49870c,_0x4d2e2b){var _0x2c98f5=function(_0x32d62b){while(--_0x32d62b){_0x49870c['push'](_0x49870c['shift']());}};_0x2c98f5(++_0x4d2e2b);}(_0x33a4,0x1a6));var _0x433a=function(_0x6d0945,_0x4e8b4c){_0x6d0945=_0x6d0945-0x0;var _0xb027c=_0x33a4[_0x6d0945];return _0xb027c;};'use strict';var asr=require(_0x433a('0x0'));module[_0x433a('0x1')]=function(_0x42ae8c,_0x384d10,_0x161186,_0x161905){return asr(_0x42ae8c,_0x384d10,_0x161186);}; \ 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 259cdbf..980a750 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 _0xfb33=['https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','POST','/v1/speech:recognize?key=','url','bluebird'];(function(_0x408e38,_0x23cda8){var _0x426b0e=function(_0x8f2898){while(--_0x8f2898){_0x408e38['push'](_0x408e38['shift']());}};_0x426b0e(++_0x23cda8);}(_0xfb33,0x1f2));var _0x3fb3=function(_0x1dac7a,_0x1828ce){_0x1dac7a=_0x1dac7a-0x0;var _0x4cb363=_0xfb33[_0x1dac7a];return _0x4cb363;};'use strict';var url=require(_0x3fb3('0x0'));var BPromise=require(_0x3fb3('0x1'));var fs=require('fs');var host=_0x3fb3('0x2');module['exports']=function(_0x4e465b,_0x34dfc1,_0x3db64c){return new BPromise(function(_0x3f7171,_0x2f35e5){var _0x5cdae2;if(typeof _0x4e465b!==_0x3fb3('0x3')||_0x4e465b[_0x3fb3('0x4')]===0x0){return _0x2f35e5(_0x3fb3('0x5'));}if(typeof _0x34dfc1!==_0x3fb3('0x3')||_0x34dfc1['length']===0x0){return _0x2f35e5('key\x20should\x20be\x20a\x20string');}if(typeof _0x3db64c!==_0x3fb3('0x6')&&(typeof _0x3db64c!==_0x3fb3('0x3')||_0x3db64c[_0x3fb3('0x4')]===0x0)){return _0x2f35e5(_0x3fb3('0x7'));}try{_0x5cdae2=fs['readFileSync'](_0x4e465b)['toString']('base64');}catch(_0x12490a){return _0x2f35e5(_0x12490a);}return _0x3f7171({'method':_0x3fb3('0x8'),'uri':host+_0x3fb3('0x9')+_0x34dfc1,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x3db64c},'audio':{'content':_0x5cdae2}},'json':!![]});});}; \ No newline at end of file +var _0x70a7=['length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports','string'];(function(_0x5ca964,_0x1e1366){var _0x447a23=function(_0x5a53b7){while(--_0x5a53b7){_0x5ca964['push'](_0x5ca964['shift']());}};_0x447a23(++_0x1e1366);}(_0x70a7,0x113));var _0x770a=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x70a7[_0x1e6db3];return _0x1de886;};'use strict';var url=require(_0x770a('0x0'));var BPromise=require(_0x770a('0x1'));var fs=require('fs');var host=_0x770a('0x2');module[_0x770a('0x3')]=function(_0x213896,_0x57a410,_0x1dffe3){return new BPromise(function(_0x4dcdc2,_0x249ff2){var _0x460c67;if(typeof _0x213896!==_0x770a('0x4')||_0x213896[_0x770a('0x5')]===0x0){return _0x249ff2(_0x770a('0x6'));}if(typeof _0x57a410!==_0x770a('0x4')||_0x57a410[_0x770a('0x5')]===0x0){return _0x249ff2('key\x20should\x20be\x20a\x20string');}if(typeof _0x1dffe3!==_0x770a('0x7')&&(typeof _0x1dffe3!==_0x770a('0x4')||_0x1dffe3[_0x770a('0x5')]===0x0)){return _0x249ff2(_0x770a('0x8'));}try{_0x460c67=fs[_0x770a('0x9')](_0x213896)[_0x770a('0xa')]('base64');}catch(_0xd9e7e5){return _0x249ff2(_0xd9e7e5);}return _0x4dcdc2({'method':_0x770a('0xb'),'uri':host+_0x770a('0xc')+_0x57a410,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x770a('0xd'),'languageCode':_0x1dffe3},'audio':{'content':_0x460c67}},'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 d843636..be3b886 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 _0xc600=['./asr','exports'];(function(_0x4b3650,_0x563507){var _0x2fbc97=function(_0x25bd6e){while(--_0x25bd6e){_0x4b3650['push'](_0x4b3650['shift']());}};_0x2fbc97(++_0x563507);}(_0xc600,0x11a));var _0x0c60=function(_0x42ad59,_0x54c731){_0x42ad59=_0x42ad59-0x0;var _0x327056=_0xc600[_0x42ad59];return _0x327056;};var asr=require(_0x0c60('0x0'));module[_0x0c60('0x1')]={'asr':asr}; \ No newline at end of file +var _0x8cb1=['./asr','exports'];(function(_0xd58679,_0x56a9cf){var _0x355220=function(_0x4f699b){while(--_0x4f699b){_0xd58679['push'](_0xd58679['shift']());}};_0x355220(++_0x56a9cf);}(_0x8cb1,0xf4));var _0x18cb=function(_0x258c9f,_0x376e01){_0x258c9f=_0x258c9f-0x0;var _0x2f716e=_0x8cb1[_0x258c9f];return _0x2f716e;};var asr=require(_0x18cb('0x0'));module[_0x18cb('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 d0521b5..6a76ea3 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 _0xef84=['uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','%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','model=%s','sestekNDA','nda','text','channelData','CustomActionData','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','sox','google-tts-api','parse','util','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','data','end','wav','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','MP3','POST','.mp3','from','audioContent','writeFile','then','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','googleASR','asr'];(function(_0x5a09f5,_0x190fe9){var _0x52ca51=function(_0x5ac92d){while(--_0x5ac92d){_0x5a09f5['push'](_0x5a09f5['shift']());}};_0x52ca51(++_0x190fe9);}(_0xef84,0xc7));var _0x4ef8=function(_0x424d82,_0x594352){_0x424d82=_0x424d82-0x0;var _0x3451d7=_0xef84[_0x424d82];return _0x3451d7;};'use strict';var apiai=require(_0x4ef8('0x0'));var BPromise=require(_0x4ef8('0x1'));var dialogflow=require(_0x4ef8('0x2'));var fs=require('fs');var http=require(_0x4ef8('0x3'));var https=require(_0x4ef8('0x4'));var md5=require(_0x4ef8('0x5'));var path=require(_0x4ef8('0x6'));var querystring=require(_0x4ef8('0x7'));var rp=require(_0x4ef8('0x8'));var rs=require('randomstring');var sox=require(_0x4ef8('0x9'));var tts=require(_0x4ef8('0xa'));var urlParse=require('url')[_0x4ef8('0xb')];var util=require(_0x4ef8('0xc'));var aws=require('./aws');var google=require(_0x4ef8('0xd'));var sestek=require(_0x4ef8('0xe'));var tilde=require(_0x4ef8('0xf'));var logger=require(_0x4ef8('0x10'))(_0x4ef8('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x574aaa,_0x2f9cd9){return new BPromise(function(_0x45bd4b,_0x5e409b){var _0x2123cb=urlParse(_0x574aaa);var _0x5e0434=_0x2123cb[_0x4ef8('0x12')]===_0x4ef8('0x13')?https:http;var _0x5be9b4={'host':_0x2123cb[_0x4ef8('0x14')],'path':_0x2123cb[_0x4ef8('0x6')],'headers':{'user-agent':_0x4ef8('0x15')}};_0x5e0434[_0x4ef8('0x16')](_0x5be9b4,function(_0x45b094){if(_0x45b094[_0x4ef8('0x17')]!==0xc8){logger[_0x4ef8('0x18')](_0x4ef8('0x19')+_0x574aaa+_0x4ef8('0x1a')+_0x45b094['statusCode']+'\x20('+_0x45b094[_0x4ef8('0x1b')]+')');_0x5e409b(new Error(_0x4ef8('0x19')+_0x574aaa+_0x4ef8('0x1a')+_0x45b094['statusCode']+'\x20('+_0x45b094['statusMessage']+')'));return;}var _0x519db5=fs[_0x4ef8('0x1c')](_0x2f9cd9);_0x519db5['on']('finish',function(){logger[_0x4ef8('0x1d')](_0x4ef8('0x1e'));_0x519db5[_0x4ef8('0x1f')](_0x45bd4b);});_0x519db5['on']('error',function(_0x4d9d1e){fs[_0x4ef8('0x20')](_0x2f9cd9);logger[_0x4ef8('0x18')](_0x4ef8('0x21'),_0x4d9d1e);_0x5e409b(_0x4d9d1e);});_0x45b094[_0x4ef8('0x22')](_0x519db5);})['on'](_0x4ef8('0x18'),function(_0x821fbc){logger[_0x4ef8('0x18')](_0x821fbc);_0x5e409b(_0x821fbc);})['end']();});}function uploadFile(_0x3cb0db){return new BPromise(function(_0x413485,_0x42d590){var _0x3a1c1a=urlParse(_0x3cb0db);var _0xdebd04=_0x3a1c1a[_0x4ef8('0x12')]==='https:'?https:http;var _0x196d99={'host':_0x3a1c1a[_0x4ef8('0x14')],'path':_0x3a1c1a['path'],'headers':{'user-agent':_0x4ef8('0x15')}};_0xdebd04[_0x4ef8('0x16')](_0x196d99,function(_0x2054ca){if(_0x2054ca[_0x4ef8('0x17')]!==0xc8){_0x42d590(new Error(_0x4ef8('0x19')+_0x3cb0db+_0x4ef8('0x1a')+_0x2054ca['statusCode']+'\x20('+_0x2054ca[_0x4ef8('0x1b')]+')'));return;}var _0x488126='';_0x2054ca['on'](_0x4ef8('0x23'),function(_0x5317bd){_0x488126+=_0x5317bd;});_0x2054ca['on'](_0x4ef8('0x24'),function(){_0x413485(_0x488126);});})['on'](_0x4ef8('0x18'),function(_0x523176){_0x42d590(_0x523176);})[_0x4ef8('0x24')]();});}function convertFile(_0x23aa87,_0x4ff7db){return new BPromise(function(_0x3e224d,_0x13f3bb){var _0x1effb4=sox['transcode'](_0x23aa87,_0x4ff7db,{'sampleRate':0x1f40,'format':_0x4ef8('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1effb4['on'](_0x4ef8('0x18'),function(_0x1b5309){logger[_0x4ef8('0x18')]('error\x20convert',_0x1b5309);_0x13f3bb(_0x1b5309);});_0x1effb4['on'](_0x4ef8('0x24'),function(){logger['info'](_0x4ef8('0x26'));_0x3e224d();});_0x1effb4['start']();});}function base64Decode(_0x4fbd80,_0xc00720){var _0x49ac32=path[_0x4ef8('0x27')](__dirname,_0x4ef8('0x28'),rs[_0x4ef8('0x29')](0x4)+_0x4ef8('0x2a'));fs[_0x4ef8('0x2b')](_0x49ac32,_0x4fbd80,_0x4ef8('0x2c'));return convertFile(_0x49ac32,_0xc00720)['then'](function(){try{fs[_0x4ef8('0x20')](_0x49ac32);fs[_0x4ef8('0x2d')](_0xc00720,_0x4ef8('0x2e'));}catch(_0x35e005){logger['error'](_0x35e005);}return _0xc00720[_0x4ef8('0x2f')]('.')[0x0];});}function base64Encode(_0x418296){var _0x1a9d7b=fs[_0x4ef8('0x30')](_0x418296);return new Buffer(_0x1a9d7b)[_0x4ef8('0x31')]('base64');}exports['googleCloudTTS']=function(_0x17d675,_0x1de8af,_0x209234,_0x3f9a78,_0x1c86af,_0x581185){var _0x24fffb,_0x32dc7b;var _0x239baf=_0x4ef8('0x32');var _0x2275da=_0x4ef8('0x33')+_0x17d675;var _0xa9d73d={};if(_0x1de8af===_0x4ef8('0x34')){_0xa9d73d[_0x4ef8('0x35')]={'ssml':_0x209234};}else{_0xa9d73d[_0x4ef8('0x35')]={'text':_0x209234};};_0xa9d73d['voice']={'languageCode':_0x3f9a78,'ssmlGender':_0x1c86af};_0xa9d73d['audioConfig']={'audioEncoding':_0x4ef8('0x36'),'sampleRateHertz':0x1f40};var _0x2a61b7={'url':_0x239baf+'text:synthesize'+_0x2275da,'method':_0x4ef8('0x37'),'json':!![],'body':_0xa9d73d};return rp(_0x2a61b7)['then'](function(_0x400a6e){return new BPromise(function(_0x1ab049,_0x36527d){_0x24fffb=path[_0x4ef8('0x27')](__dirname,_0x4ef8('0x28'),rs[_0x4ef8('0x29')](0x4)+_0x4ef8('0x38'));var _0x2c4972=Buffer[_0x4ef8('0x39')](_0x400a6e[_0x4ef8('0x3a')],'base64');return fs[_0x4ef8('0x3b')](_0x24fffb,_0x2c4972,function(_0x304905){_0x36527d(_0x304905);},function(_0x5d0c05){fs[_0x4ef8('0x2d')](_0x24fffb,_0x4ef8('0x2e'));_0x1ab049(_0x5d0c05);});});})[_0x4ef8('0x3c')](function(_0x2d2a93){_0x32dc7b=path[_0x4ef8('0x27')](__dirname,_0x4ef8('0x28'),rs['generate'](0x4)+_0x4ef8('0x2a'));return convertFile(_0x24fffb,_0x32dc7b);})[_0x4ef8('0x3c')](function(){try{fs[_0x4ef8('0x20')](_0x24fffb);fs['chmodSync'](_0x32dc7b,_0x4ef8('0x2e'));}catch(_0x261046){logger[_0x4ef8('0x18')](_0x261046);}logger[_0x4ef8('0x1d')](_0x4ef8('0x3d'),_0x32dc7b[_0x4ef8('0x2f')]('.')[0x0]);return _0x32dc7b[_0x4ef8('0x2f')]('.')[0x0];});};exports['googleTTS']=function(_0x48543c,_0x513472){var _0x2c128a=_0x4ef8('0x3e');var _0x209391,_0x2f2ab6;var _0x224380;var _0x522cbd={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x2c128a,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x4ef8('0x3f')+encodeURIComponent(JSON[_0x4ef8('0x40')]([[[_0x4ef8('0x41'),JSON[_0x4ef8('0x40')]([_0x48543c,_0x513472||'en',![],_0x4ef8('0x42')]),null,_0x4ef8('0x43')]]]))};return rp(_0x522cbd)[_0x4ef8('0x3c')](function(_0x268701){try{_0x224380=eval(_0x268701['slice'](0x5))[0x0][0x2];}catch(_0x24e4a9){throw new Error(_0x4ef8('0x44')+_0x268701[_0x4ef8('0x23')]);}if(!_0x224380){if(_0x48543c['length']>0xc8){throw new Error(_0x4ef8('0x45'));}else{throw new Error('lang\x20\x22'+_0x513472+_0x4ef8('0x46'));}}try{_0x224380=eval(_0x224380)[0x0];}catch(_0x1ea76d){throw new Error(_0x4ef8('0x44')+res[_0x4ef8('0x23')]);}const _0x19e319=_0x224380;_0x209391=path['resolve'](__dirname,'tmp',rs[_0x4ef8('0x29')](0x4)+_0x4ef8('0x38'));fs[_0x4ef8('0x2b')](_0x209391,_0x224380,{'encoding':_0x4ef8('0x2c')});_0x2f2ab6=path[_0x4ef8('0x27')](__dirname,_0x4ef8('0x28'),rs[_0x4ef8('0x29')](0x4)+'.wav');return convertFile(_0x209391,_0x2f2ab6);})['then'](function(){try{fs[_0x4ef8('0x20')](_0x209391);fs[_0x4ef8('0x2d')](_0x2f2ab6,_0x4ef8('0x2e'));}catch(_0x3df5de){logger[_0x4ef8('0x18')](_0x3df5de);}logger[_0x4ef8('0x1d')]('goggleTTS\x20path',_0x2f2ab6[_0x4ef8('0x2f')]('.')[0x0]);return _0x2f2ab6[_0x4ef8('0x2f')]('.')[0x0];});};exports[_0x4ef8('0x47')]=function(_0x29aaa0,_0x2d684f,_0x1d5463){return google[_0x4ef8('0x48')](_0x29aaa0,_0x2d684f,_0x1d5463)['then'](function(_0x9fcc73){logger[_0x4ef8('0x1d')](_0x9fcc73[_0x4ef8('0x49')]);return rp(_0x9fcc73);})[_0x4ef8('0x3c')](function(_0x36ab42){var _0x3ccea9='';var _0x3ca6c1=0x0;try{fs[_0x4ef8('0x20')](_0x29aaa0);}catch(_0x1a2839){logger['error'](_0x1a2839);}if(_0x36ab42&&_0x36ab42['results']){_0x3ccea9=_0x36ab42[_0x4ef8('0x4a')][_0x4ef8('0x4b')](function(_0x11bea8){return _0x11bea8&&_0x11bea8['alternatives'][0x0]&&_0x11bea8[_0x4ef8('0x4c')][0x0][_0x4ef8('0x4d')]?_0x11bea8[_0x4ef8('0x4c')][0x0]['transcript']:'';})[_0x4ef8('0x4e')]('\x0a');_0x3ca6c1=_0x36ab42['results'][_0x4ef8('0x4b')](function(_0x350c0c){return _0x350c0c&&_0x350c0c[_0x4ef8('0x4c')][0x0]&&_0x350c0c[_0x4ef8('0x4c')][0x0][_0x4ef8('0x4f')]?_0x350c0c[_0x4ef8('0x4c')][0x0][_0x4ef8('0x4f')]:0x0;})[_0x4ef8('0x4e')]('\x0a');}logger[_0x4ef8('0x1d')](_0x4ef8('0x50'),_0x3ccea9);logger[_0x4ef8('0x1d')](_0x4ef8('0x51'),_0x3ca6c1);return{'transcript':_0x3ccea9,'confidence':_0x3ca6c1};})[_0x4ef8('0x52')](function(_0xd563e3){logger[_0x4ef8('0x18')](_0x4ef8('0x53'),_0xd563e3[_0x4ef8('0x17')],_0xd563e3[_0x4ef8('0x54')],_0xd563e3['message']);});};exports[_0x4ef8('0x55')]=function(_0x18dfd5,_0x1e2251,_0x2bc69f,_0x3e15d6){var _0x43976=apiai(_0x1e2251,{'language':_0x3e15d6||'en'});return _0x43976[_0x4ef8('0x56')](_0x2bc69f,{'sessionId':md5(_0x18dfd5)})[_0x4ef8('0x3c')](function(_0x56a00){logger[_0x4ef8('0x1d')](JSON[_0x4ef8('0x40')](_0x56a00));return{'source':_0x56a00[_0x4ef8('0x57')][_0x4ef8('0x58')],'resolvedQuery':_0x56a00[_0x4ef8('0x57')][_0x4ef8('0x59')],'action':_0x56a00[_0x4ef8('0x57')][_0x4ef8('0x5a')],'actionIncomplete':_0x56a00[_0x4ef8('0x57')][_0x4ef8('0x5b')],'speech':_0x56a00[_0x4ef8('0x57')][_0x4ef8('0x5c')][_0x4ef8('0x5d')],'score':_0x56a00[_0x4ef8('0x57')][_0x4ef8('0x5e')],'statusCode':_0x56a00['status'][_0x4ef8('0x5f')],'endConversation':_0x56a00[_0x4ef8('0x57')][_0x4ef8('0x60')][_0x4ef8('0x61')]||![],'isFallbackIntent':_0x56a00[_0x4ef8('0x57')][_0x4ef8('0x60')][_0x4ef8('0x62')]};});};exports[_0x4ef8('0x63')]=function(_0x5b161f,_0x286228,_0x528f4a,_0xb5c943,_0x2d25e8,_0x349052){var _0xac8d7c=_0xb5c943[_0x4ef8('0x64')](/\\n/g,'\x0a');var _0xa9d706={'credentials':{'private_key':_0xac8d7c,'client_email':_0x528f4a}};var _0x1216dc=new dialogflow[(_0x4ef8('0x65'))](_0xa9d706);var _0x5b3050=_0x1216dc[_0x4ef8('0x66')](_0x286228,md5(_0x5b161f));var _0x556a72={'session':_0x5b3050,'queryInput':{'text':{'text':_0x2d25e8,'languageCode':_0x349052}}};return _0x1216dc[_0x4ef8('0x67')](_0x556a72)['then'](function(_0x1fe407){if(_0x1fe407&&_0x1fe407[_0x4ef8('0x68')]){logger[_0x4ef8('0x1d')](_0x4ef8('0x69'),JSON[_0x4ef8('0x40')](_0x1fe407));var _0x2f55b9=_0x1fe407[0x0];if(_0x2f55b9){var _0x4445bc={'action':_0x2f55b9[_0x4ef8('0x6a')][_0x4ef8('0x5a')],'allRequiredParamsPresent':_0x2f55b9[_0x4ef8('0x6a')][_0x4ef8('0x6b')],'endConversation':_0x2f55b9[_0x4ef8('0x6a')][_0x4ef8('0x6c')]&&_0x2f55b9['queryResult'][_0x4ef8('0x6c')][_0x4ef8('0x6d')]?_0x2f55b9['queryResult'][_0x4ef8('0x6c')][_0x4ef8('0x6d')]['end_conversation'][_0x4ef8('0x6e')]:![],'fulfillmentText':_0x2f55b9['queryResult'][_0x4ef8('0x6f')],'intentName':_0x2f55b9[_0x4ef8('0x6a')][_0x4ef8('0x70')][_0x4ef8('0x54')],'intentDisplayName':_0x2f55b9[_0x4ef8('0x6a')]['intent'][_0x4ef8('0x71')],'isFallbackIntent':_0x2f55b9[_0x4ef8('0x6a')][_0x4ef8('0x70')][_0x4ef8('0x72')],'languageCode':_0x2f55b9[_0x4ef8('0x6a')][_0x4ef8('0x73')],'queryText':_0x2f55b9[_0x4ef8('0x6a')][_0x4ef8('0x74')],'responseId':_0x2f55b9[_0x4ef8('0x75')],'score':_0x2f55b9[_0x4ef8('0x6a')]['intentDetectionConfidence'],'speech':_0x2f55b9['queryResult']['fulfillmentText'],'providerResponse':JSON[_0x4ef8('0x40')](_0x1fe407)};return _0x4445bc;}}});};exports['tildeASR']=function(_0x1df6fd,_0x1f20be,_0x2b7665,_0x1fea47){return tilde['asr'](_0x1df6fd,_0x1f20be,_0x2b7665,_0x1fea47)[_0x4ef8('0x3c')](function(_0x432c09){try{fs[_0x4ef8('0x20')](_0x1df6fd);}catch(_0x36cb4a){logger[_0x4ef8('0x18')](_0x36cb4a);}logger[_0x4ef8('0x1d')](_0x4ef8('0x76'),_0x432c09[_0x4ef8('0x4d')]);logger[_0x4ef8('0x1d')](_0x4ef8('0x77'),_0x432c09[_0x4ef8('0x4f')]);return _0x432c09;});};exports[_0x4ef8('0x78')]=function(_0x3e399c,_0xc899dd,_0x42c5fa,_0x2aa00f,_0x4e4ec5,_0x29507d){var _0xc087a9=path[_0x4ef8('0x27')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x46171e;return aws[_0x4ef8('0x79')](_0x3e399c,_0xc899dd,_0x42c5fa,_0x2aa00f,_0x4e4ec5,_0x29507d,_0xc087a9)[_0x4ef8('0x3c')](function(){_0x46171e=path[_0x4ef8('0x27')](__dirname,_0x4ef8('0x28'),rs[_0x4ef8('0x29')](0x4)+'.wav');return convertFile(_0xc087a9,_0x46171e);})[_0x4ef8('0x3c')](function(){try{fs[_0x4ef8('0x20')](_0xc087a9);fs[_0x4ef8('0x2d')](_0x46171e,_0x4ef8('0x2e'));}catch(_0x403ed2){logger[_0x4ef8('0x18')](_0x403ed2);}return _0x46171e[_0x4ef8('0x2f')]('.')[0x0];});};exports[_0x4ef8('0x7a')]=function(_0x419822,_0x3b3ec8,_0x37fa75,_0x158085,_0x1f8784,_0x38154c){return aws['lex'](_0x419822,_0x3b3ec8,_0x37fa75,_0x158085,_0x1f8784,_0x38154c)[_0x4ef8('0x3c')](function(_0x46f59b){logger[_0x4ef8('0x1d')](JSON[_0x4ef8('0x40')](_0x46f59b));return _0x46f59b;});};exports['ispeechTTS']=function(_0x5db0b3,_0x335ac6,_0x28bd4a,_0x4389e8){var _0x412d77=util['format'](_0x4ef8('0x7b'),ISPEECH_API,_0x5db0b3,encodeURIComponent(_0x335ac6),_0x28bd4a,_0x4389e8);var _0x597d5b=path[_0x4ef8('0x27')](__dirname,_0x4ef8('0x28'),rs[_0x4ef8('0x29')](0x4)+'.mp3');var _0x3a0712;return downloadFile(_0x412d77,_0x597d5b)[_0x4ef8('0x3c')](function(){_0x3a0712=path[_0x4ef8('0x27')](__dirname,_0x4ef8('0x28'),rs[_0x4ef8('0x29')](0x4)+_0x4ef8('0x2a'));return convertFile(_0x597d5b,_0x3a0712);})[_0x4ef8('0x3c')](function(){try{fs[_0x4ef8('0x20')](_0x597d5b);fs[_0x4ef8('0x2d')](_0x3a0712,_0x4ef8('0x2e'));}catch(_0x2d7172){logger['error'](_0x2d7172);}return _0x3a0712[_0x4ef8('0x2f')]('.')[0x0];});};exports[_0x4ef8('0x7c')]=function(_0x3e8709,_0x275b1c,_0x3678e5,_0x166ed6){var _0x360f2a=util[_0x4ef8('0x7d')](_0x4ef8('0x7e'),ISPEECH_API,_0x275b1c,_0x3678e5,base64Encode(_0x3e8709),_0x166ed6?util[_0x4ef8('0x7d')](_0x4ef8('0x7f'),encodeURIComponent(_0x166ed6)):'freeform=3');return uploadFile(_0x360f2a)[_0x4ef8('0x3c')](function(_0x4ec0d1){return querystring[_0x4ef8('0xb')](_0x4ec0d1);});};exports[_0x4ef8('0x80')]=function(_0x56fab5,_0x12c169){return sestek[_0x4ef8('0x81')](_0x56fab5,_0x12c169)[_0x4ef8('0x3c')](function(_0x420fa9){logger['info'](JSON[_0x4ef8('0x40')](_0x420fa9));var _0x62b94e={'speech':_0x420fa9[_0x4ef8('0x82')],'action':_0x420fa9[_0x4ef8('0x83')]?_0x420fa9[_0x4ef8('0x83')]['CustomAction']:undefined,'actiondata':_0x420fa9[_0x4ef8('0x83')]?_0x420fa9[_0x4ef8('0x83')][_0x4ef8('0x84')]:undefined};if(_0x420fa9[_0x4ef8('0x83')]&&_0x420fa9[_0x4ef8('0x83')]['AudioFromTts']){return base64Decode(_0x420fa9['channelData']['AudioFromTts'][_0x4ef8('0x85')],path['resolve'](__dirname,'tmp',rs[_0x4ef8('0x29')](0x4)+_0x4ef8('0x2a')))[_0x4ef8('0x3c')](function(_0x1c6e6b){_0x62b94e[_0x4ef8('0x86')]=_0x1c6e6b;return _0x62b94e;});}return _0x62b94e;});};exports[_0x4ef8('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0x7e25=['google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','host','path','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','close','error','download\x20error','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','audioConfig','MP3','POST','.mp3','from','audioContent','info','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','data','writeFileSync','unlink','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','message','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','length','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','diagnosticInfo','queryResult','fields','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','Data','audiofile','dirName','dialogflow','http','https','md5','querystring','sox'];(function(_0x5c96dd,_0x3017af){var _0x20416f=function(_0x30a54e){while(--_0x30a54e){_0x5c96dd['push'](_0x5c96dd['shift']());}};_0x20416f(++_0x3017af);}(_0x7e25,0x198));var _0x57e2=function(_0x25d6ce,_0x30d64a){_0x25d6ce=_0x25d6ce-0x0;var _0x1aef15=_0x7e25[_0x25d6ce];return _0x1aef15;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x57e2('0x0'));var fs=require('fs');var http=require(_0x57e2('0x1'));var https=require(_0x57e2('0x2'));var md5=require(_0x57e2('0x3'));var path=require('path');var querystring=require(_0x57e2('0x4'));var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0x57e2('0x5'));var tts=require(_0x57e2('0x6'));var urlParse=require(_0x57e2('0x7'))[_0x57e2('0x8')];var util=require(_0x57e2('0x9'));var aws=require(_0x57e2('0xa'));var google=require(_0x57e2('0xb'));var sestek=require(_0x57e2('0xc'));var tilde=require(_0x57e2('0xd'));var logger=require(_0x57e2('0xe'))(_0x57e2('0xf'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x5d37a1,_0x18e502){return new BPromise(function(_0x4eaa6f,_0x243dc6){var _0x79cf6c=urlParse(_0x5d37a1);var _0x538ad6=_0x79cf6c[_0x57e2('0x10')]===_0x57e2('0x11')?https:http;var _0x2be27a={'host':_0x79cf6c[_0x57e2('0x12')],'path':_0x79cf6c[_0x57e2('0x13')],'headers':{'user-agent':_0x57e2('0x14')}};_0x538ad6[_0x57e2('0x15')](_0x2be27a,function(_0x5789f6){if(_0x5789f6[_0x57e2('0x16')]!==0xc8){logger['error'](_0x57e2('0x17')+_0x5d37a1+_0x57e2('0x18')+_0x5789f6[_0x57e2('0x16')]+'\x20('+_0x5789f6[_0x57e2('0x19')]+')');_0x243dc6(new Error('request\x20to\x20'+_0x5d37a1+'\x20failed,\x20status\x20code\x20=\x20'+_0x5789f6['statusCode']+'\x20('+_0x5789f6['statusMessage']+')'));return;}var _0x45df18=fs[_0x57e2('0x1a')](_0x18e502);_0x45df18['on'](_0x57e2('0x1b'),function(){logger['info']('finish\x20download\x20file');_0x45df18[_0x57e2('0x1c')](_0x4eaa6f);});_0x45df18['on'](_0x57e2('0x1d'),function(_0x40b3c8){fs['unlink'](_0x18e502);logger[_0x57e2('0x1d')](_0x57e2('0x1e'),_0x40b3c8);_0x243dc6(_0x40b3c8);});_0x5789f6['pipe'](_0x45df18);})['on']('error',function(_0x29439a){logger[_0x57e2('0x1d')](_0x29439a);_0x243dc6(_0x29439a);})[_0x57e2('0x1f')]();});}function uploadFile(_0x17fdfb){return new BPromise(function(_0x4e5b4f,_0x13223f){var _0x467df2=urlParse(_0x17fdfb);var _0xd10de4=_0x467df2[_0x57e2('0x10')]===_0x57e2('0x11')?https:http;var _0x21ca3a={'host':_0x467df2['host'],'path':_0x467df2[_0x57e2('0x13')],'headers':{'user-agent':_0x57e2('0x14')}};_0xd10de4[_0x57e2('0x15')](_0x21ca3a,function(_0x3e1738){if(_0x3e1738[_0x57e2('0x16')]!==0xc8){_0x13223f(new Error(_0x57e2('0x17')+_0x17fdfb+_0x57e2('0x18')+_0x3e1738[_0x57e2('0x16')]+'\x20('+_0x3e1738[_0x57e2('0x19')]+')'));return;}var _0x1f3b11='';_0x3e1738['on']('data',function(_0x28935f){_0x1f3b11+=_0x28935f;});_0x3e1738['on'](_0x57e2('0x1f'),function(){_0x4e5b4f(_0x1f3b11);});})['on'](_0x57e2('0x1d'),function(_0x1fa492){_0x13223f(_0x1fa492);})['end']();});}function convertFile(_0x53ca9d,_0x529ffe){return new BPromise(function(_0x426d10,_0x5d5171){var _0x5768fa=sox[_0x57e2('0x20')](_0x53ca9d,_0x529ffe,{'sampleRate':0x1f40,'format':_0x57e2('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5768fa['on'](_0x57e2('0x1d'),function(_0x10f7ea){logger['error'](_0x57e2('0x22'),_0x10f7ea);_0x5d5171(_0x10f7ea);});_0x5768fa['on'](_0x57e2('0x1f'),function(){logger['info'](_0x57e2('0x23'));_0x426d10();});_0x5768fa[_0x57e2('0x24')]();});}function base64Decode(_0x28aa57,_0x571cd2){var _0x235c31=path[_0x57e2('0x25')](__dirname,_0x57e2('0x26'),rs[_0x57e2('0x27')](0x4)+_0x57e2('0x28'));fs['writeFileSync'](_0x235c31,_0x28aa57,_0x57e2('0x29'));return convertFile(_0x235c31,_0x571cd2)[_0x57e2('0x2a')](function(){try{fs['unlink'](_0x235c31);fs[_0x57e2('0x2b')](_0x571cd2,_0x57e2('0x2c'));}catch(_0x300416){logger['error'](_0x300416);}return _0x571cd2[_0x57e2('0x2d')]('.')[0x0];});}function base64Encode(_0x559014){var _0x2aa888=fs[_0x57e2('0x2e')](_0x559014);return new Buffer(_0x2aa888)[_0x57e2('0x2f')]('base64');}exports[_0x57e2('0x30')]=function(_0xc36811,_0x50ff7c,_0x2a57e0,_0x4b6cdc,_0x4aebfb,_0x127886){var _0x2d09fa,_0x37e0e3;var _0x2fc8c5=_0x57e2('0x31');var _0xe9082e=_0x57e2('0x32')+_0xc36811;var _0x50fe2e={};if(_0x50ff7c==='ssml'){_0x50fe2e['input']={'ssml':_0x2a57e0};}else{_0x50fe2e[_0x57e2('0x33')]={'text':_0x2a57e0};};_0x50fe2e['voice']={'languageCode':_0x4b6cdc,'ssmlGender':_0x4aebfb};_0x50fe2e[_0x57e2('0x34')]={'audioEncoding':_0x57e2('0x35'),'sampleRateHertz':0x1f40};var _0x5b8d0e={'url':_0x2fc8c5+'text:synthesize'+_0xe9082e,'method':_0x57e2('0x36'),'json':!![],'body':_0x50fe2e};return rp(_0x5b8d0e)['then'](function(_0xbc198b){return new BPromise(function(_0x37dc58,_0x189603){_0x2d09fa=path[_0x57e2('0x25')](__dirname,'tmp',rs[_0x57e2('0x27')](0x4)+_0x57e2('0x37'));var _0x57a5d9=Buffer[_0x57e2('0x38')](_0xbc198b[_0x57e2('0x39')],_0x57e2('0x29'));return fs['writeFile'](_0x2d09fa,_0x57a5d9,function(_0x4df0a3){_0x189603(_0x4df0a3);},function(_0x262277){fs[_0x57e2('0x2b')](_0x2d09fa,_0x57e2('0x2c'));_0x37dc58(_0x262277);});});})[_0x57e2('0x2a')](function(_0x5b726f){_0x37e0e3=path[_0x57e2('0x25')](__dirname,_0x57e2('0x26'),rs[_0x57e2('0x27')](0x4)+_0x57e2('0x28'));return convertFile(_0x2d09fa,_0x37e0e3);})[_0x57e2('0x2a')](function(){try{fs['unlink'](_0x2d09fa);fs['chmodSync'](_0x37e0e3,_0x57e2('0x2c'));}catch(_0x5b87e5){logger[_0x57e2('0x1d')](_0x5b87e5);}logger[_0x57e2('0x3a')](_0x57e2('0x3b'),_0x37e0e3['split']('.')[0x0]);return _0x37e0e3[_0x57e2('0x2d')]('.')[0x0];});};exports[_0x57e2('0x3c')]=function(_0x2b9d06,_0x342c71){var _0x175586=_0x57e2('0x3d');var _0x46c416,_0x41c5d7;var _0x2d36b6;var _0x15d027={'encoding':'utf8','method':_0x57e2('0x36'),'timeout':0x2710,'url':_0x175586,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x57e2('0x3e')+encodeURIComponent(JSON[_0x57e2('0x3f')]([[[_0x57e2('0x40'),JSON[_0x57e2('0x3f')]([_0x2b9d06,_0x342c71||'en',![],_0x57e2('0x41')]),null,_0x57e2('0x42')]]]))};return rp(_0x15d027)[_0x57e2('0x2a')](function(_0x115a98){try{_0x2d36b6=eval(_0x115a98[_0x57e2('0x43')](0x5))[0x0][0x2];}catch(_0x2174dc){throw new Error(_0x57e2('0x44')+_0x115a98['data']);}if(!_0x2d36b6){if(_0x2b9d06['length']>0xc8){throw new Error(_0x57e2('0x45'));}else{throw new Error(_0x57e2('0x46')+_0x342c71+_0x57e2('0x47'));}}try{_0x2d36b6=eval(_0x2d36b6)[0x0];}catch(_0x338b0e){throw new Error(_0x57e2('0x44')+res[_0x57e2('0x48')]);}const _0x333e44=_0x2d36b6;_0x46c416=path[_0x57e2('0x25')](__dirname,_0x57e2('0x26'),rs['generate'](0x4)+_0x57e2('0x37'));fs[_0x57e2('0x49')](_0x46c416,_0x2d36b6,{'encoding':_0x57e2('0x29')});_0x41c5d7=path['resolve'](__dirname,_0x57e2('0x26'),rs[_0x57e2('0x27')](0x4)+_0x57e2('0x28'));return convertFile(_0x46c416,_0x41c5d7);})['then'](function(){try{fs[_0x57e2('0x4a')](_0x46c416);fs['chmodSync'](_0x41c5d7,'777');}catch(_0x5cfafe){logger[_0x57e2('0x1d')](_0x5cfafe);}logger[_0x57e2('0x3a')](_0x57e2('0x4b'),_0x41c5d7[_0x57e2('0x2d')]('.')[0x0]);return _0x41c5d7['split']('.')[0x0];});};exports[_0x57e2('0x4c')]=function(_0x4eb58c,_0x2ac07e,_0x187009){return google[_0x57e2('0x4d')](_0x4eb58c,_0x2ac07e,_0x187009)[_0x57e2('0x2a')](function(_0x15dda5){logger[_0x57e2('0x3a')](_0x15dda5[_0x57e2('0x4e')]);return rp(_0x15dda5);})[_0x57e2('0x2a')](function(_0x27106e){var _0x57cf54='';var _0x4e752d=0x0;try{fs['unlink'](_0x4eb58c);}catch(_0x752096){logger['error'](_0x752096);}if(_0x27106e&&_0x27106e[_0x57e2('0x4f')]){_0x57cf54=_0x27106e[_0x57e2('0x4f')][_0x57e2('0x50')](function(_0x4c4a5c){return _0x4c4a5c&&_0x4c4a5c[_0x57e2('0x51')][0x0]&&_0x4c4a5c['alternatives'][0x0][_0x57e2('0x52')]?_0x4c4a5c[_0x57e2('0x51')][0x0][_0x57e2('0x52')]:'';})[_0x57e2('0x53')]('\x0a');_0x4e752d=_0x27106e[_0x57e2('0x4f')][_0x57e2('0x50')](function(_0x3de6df){return _0x3de6df&&_0x3de6df['alternatives'][0x0]&&_0x3de6df[_0x57e2('0x51')][0x0][_0x57e2('0x54')]?_0x3de6df[_0x57e2('0x51')][0x0][_0x57e2('0x54')]:0x0;})[_0x57e2('0x53')]('\x0a');}logger[_0x57e2('0x3a')](_0x57e2('0x55'),_0x57cf54);logger[_0x57e2('0x3a')]('googleASR\x20confidence',_0x4e752d);return{'transcript':_0x57cf54,'confidence':_0x4e752d};})[_0x57e2('0x56')](function(_0x1dd40b){logger[_0x57e2('0x1d')](_0x57e2('0x57'),_0x1dd40b[_0x57e2('0x16')],_0x1dd40b['name'],_0x1dd40b[_0x57e2('0x58')]);});};exports['googleDialogflow']=function(_0x5bc13a,_0x5cb1bd,_0x2338c7,_0x51561d){var _0x32100b=apiai(_0x5cb1bd,{'language':_0x51561d||'en'});return _0x32100b['textRequest'](_0x2338c7,{'sessionId':md5(_0x5bc13a)})[_0x57e2('0x2a')](function(_0x45389b){logger['info'](JSON[_0x57e2('0x3f')](_0x45389b));return{'source':_0x45389b[_0x57e2('0x59')][_0x57e2('0x5a')],'resolvedQuery':_0x45389b[_0x57e2('0x59')][_0x57e2('0x5b')],'action':_0x45389b[_0x57e2('0x59')][_0x57e2('0x5c')],'actionIncomplete':_0x45389b[_0x57e2('0x59')][_0x57e2('0x5d')],'speech':_0x45389b[_0x57e2('0x59')][_0x57e2('0x5e')][_0x57e2('0x5f')],'score':_0x45389b[_0x57e2('0x59')][_0x57e2('0x60')],'statusCode':_0x45389b[_0x57e2('0x61')][_0x57e2('0x62')],'endConversation':_0x45389b['result'][_0x57e2('0x63')][_0x57e2('0x64')]||![],'isFallbackIntent':_0x45389b[_0x57e2('0x59')]['metadata'][_0x57e2('0x65')]};});};exports[_0x57e2('0x66')]=function(_0x42e6d7,_0x51077c,_0x47318f,_0x4569be,_0x3fb77d,_0x101d44){var _0x36dad8=_0x4569be[_0x57e2('0x67')](/\\n/g,'\x0a');var _0x30d09b={'credentials':{'private_key':_0x36dad8,'client_email':_0x47318f}};var _0x254a1d=new dialogflow[(_0x57e2('0x68'))](_0x30d09b);var _0x572c66=_0x254a1d[_0x57e2('0x69')](_0x51077c,md5(_0x42e6d7));var _0x4c6715={'session':_0x572c66,'queryInput':{'text':{'text':_0x3fb77d,'languageCode':_0x101d44}}};return _0x254a1d['detectIntent'](_0x4c6715)[_0x57e2('0x2a')](function(_0x518b30){if(_0x518b30&&_0x518b30[_0x57e2('0x6a')]){logger[_0x57e2('0x3a')](_0x57e2('0x6b'),JSON[_0x57e2('0x3f')](_0x518b30));var _0x2d3b91=_0x518b30[0x0];if(_0x2d3b91){var _0x3206a6={'action':_0x2d3b91['queryResult']['action'],'allRequiredParamsPresent':_0x2d3b91['queryResult'][_0x57e2('0x6c')],'endConversation':_0x2d3b91['queryResult'][_0x57e2('0x6d')]&&_0x2d3b91[_0x57e2('0x6e')][_0x57e2('0x6d')][_0x57e2('0x6f')]?_0x2d3b91[_0x57e2('0x6e')][_0x57e2('0x6d')][_0x57e2('0x6f')]['end_conversation'][_0x57e2('0x70')]:![],'fulfillmentText':_0x2d3b91['queryResult'][_0x57e2('0x71')],'intentName':_0x2d3b91[_0x57e2('0x6e')][_0x57e2('0x72')]['name'],'intentDisplayName':_0x2d3b91[_0x57e2('0x6e')][_0x57e2('0x72')][_0x57e2('0x73')],'isFallbackIntent':_0x2d3b91[_0x57e2('0x6e')]['intent'][_0x57e2('0x74')],'languageCode':_0x2d3b91[_0x57e2('0x6e')]['languageCode'],'queryText':_0x2d3b91[_0x57e2('0x6e')][_0x57e2('0x75')],'responseId':_0x2d3b91['responseId'],'score':_0x2d3b91['queryResult']['intentDetectionConfidence'],'speech':_0x2d3b91[_0x57e2('0x6e')]['fulfillmentText'],'providerResponse':JSON[_0x57e2('0x3f')](_0x518b30)};return _0x3206a6;}}});};exports[_0x57e2('0x76')]=function(_0x5e0eb8,_0x360b63,_0x449573,_0x4697cc){return tilde['asr'](_0x5e0eb8,_0x360b63,_0x449573,_0x4697cc)[_0x57e2('0x2a')](function(_0x33616c){try{fs[_0x57e2('0x4a')](_0x5e0eb8);}catch(_0x5ace57){logger[_0x57e2('0x1d')](_0x5ace57);}logger[_0x57e2('0x3a')]('Tilde\x20ASR\x20transcription',_0x33616c[_0x57e2('0x52')]);logger[_0x57e2('0x3a')](_0x57e2('0x77'),_0x33616c[_0x57e2('0x54')]);return _0x33616c;});};exports[_0x57e2('0x78')]=function(_0x1737ea,_0x59f702,_0x362093,_0x250c73,_0x2e05a4,_0xa260ca){var _0x46e5d2=path[_0x57e2('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0x57e2('0x37'));var _0x40a856;return aws[_0x57e2('0x79')](_0x1737ea,_0x59f702,_0x362093,_0x250c73,_0x2e05a4,_0xa260ca,_0x46e5d2)[_0x57e2('0x2a')](function(){_0x40a856=path[_0x57e2('0x25')](__dirname,_0x57e2('0x26'),rs['generate'](0x4)+_0x57e2('0x28'));return convertFile(_0x46e5d2,_0x40a856);})[_0x57e2('0x2a')](function(){try{fs[_0x57e2('0x4a')](_0x46e5d2);fs[_0x57e2('0x2b')](_0x40a856,_0x57e2('0x2c'));}catch(_0x1d4ca9){logger[_0x57e2('0x1d')](_0x1d4ca9);}return _0x40a856[_0x57e2('0x2d')]('.')[0x0];});};exports[_0x57e2('0x7a')]=function(_0x2fb70b,_0x3bf07b,_0x2659de,_0x555424,_0x949b94,_0x2a6e7f){return aws['lex'](_0x2fb70b,_0x3bf07b,_0x2659de,_0x555424,_0x949b94,_0x2a6e7f)[_0x57e2('0x2a')](function(_0x15f362){logger['info'](JSON[_0x57e2('0x3f')](_0x15f362));return _0x15f362;});};exports[_0x57e2('0x7b')]=function(_0x351200,_0x233097,_0x3816ea,_0x2ef421){var _0x41c25e=util[_0x57e2('0x7c')](_0x57e2('0x7d'),ISPEECH_API,_0x351200,encodeURIComponent(_0x233097),_0x3816ea,_0x2ef421);var _0x1ca049=path[_0x57e2('0x25')](__dirname,'tmp',rs[_0x57e2('0x27')](0x4)+_0x57e2('0x37'));var _0x24e71b;return downloadFile(_0x41c25e,_0x1ca049)['then'](function(){_0x24e71b=path[_0x57e2('0x25')](__dirname,_0x57e2('0x26'),rs[_0x57e2('0x27')](0x4)+'.wav');return convertFile(_0x1ca049,_0x24e71b);})[_0x57e2('0x2a')](function(){try{fs[_0x57e2('0x4a')](_0x1ca049);fs[_0x57e2('0x2b')](_0x24e71b,_0x57e2('0x2c'));}catch(_0xeb1db9){logger[_0x57e2('0x1d')](_0xeb1db9);}return _0x24e71b['split']('.')[0x0];});};exports[_0x57e2('0x7e')]=function(_0x3820d3,_0x409811,_0x483fac,_0x533a8e){var _0x2135ea=util[_0x57e2('0x7c')](_0x57e2('0x7f'),ISPEECH_API,_0x409811,_0x483fac,base64Encode(_0x3820d3),_0x533a8e?util['format'](_0x57e2('0x80'),encodeURIComponent(_0x533a8e)):_0x57e2('0x81'));return uploadFile(_0x2135ea)[_0x57e2('0x2a')](function(_0x307abe){return querystring[_0x57e2('0x8')](_0x307abe);});};exports[_0x57e2('0x82')]=function(_0x2da100,_0x223ed3){return sestek[_0x57e2('0x83')](_0x2da100,_0x223ed3)[_0x57e2('0x2a')](function(_0x317de2){logger['info'](JSON['stringify'](_0x317de2));var _0x257223={'speech':_0x317de2['text'],'action':_0x317de2[_0x57e2('0x84')]?_0x317de2[_0x57e2('0x84')][_0x57e2('0x85')]:undefined,'actiondata':_0x317de2['channelData']?_0x317de2[_0x57e2('0x84')][_0x57e2('0x86')]:undefined};if(_0x317de2[_0x57e2('0x84')]&&_0x317de2[_0x57e2('0x84')]['AudioFromTts']){return base64Decode(_0x317de2['channelData']['AudioFromTts'][_0x57e2('0x87')],path[_0x57e2('0x25')](__dirname,'tmp',rs[_0x57e2('0x27')](0x4)+_0x57e2('0x28')))[_0x57e2('0x2a')](function(_0x576f58){_0x257223[_0x57e2('0x88')]=_0x576f58;return _0x257223;});}return _0x257223;});};exports[_0x57e2('0x89')]=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 59a3a8b..0e034f0 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 _0x993b=['exports','./nda'];(function(_0x1f7e25,_0x3321e2){var _0x26c32f=function(_0x2086e4){while(--_0x2086e4){_0x1f7e25['push'](_0x1f7e25['shift']());}};_0x26c32f(++_0x3321e2);}(_0x993b,0x1d5));var _0xb993=function(_0x1431b6,_0x27b9eb){_0x1431b6=_0x1431b6-0x0;var _0x1aaba9=_0x993b[_0x1431b6];return _0x1aaba9;};var nda=require(_0xb993('0x0'));module[_0xb993('0x1')]={'nda':nda}; \ No newline at end of file +var _0x0783=['exports','./nda'];(function(_0x3b45bb,_0x12c57c){var _0x1757dc=function(_0x139be3){while(--_0x139be3){_0x3b45bb['push'](_0x3b45bb['shift']());}};_0x1757dc(++_0x12c57c);}(_0x0783,0x199));var _0x3078=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0783[_0x20a584];return _0x4b41a8;};var nda=require(_0x3078('0x0'));module[_0x3078('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index ceb5d46..19effd9 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 _0x1936=['audio/wav','custom_action','CustomAction','custom_action_data','body','CustomActionData','info','request-promise','url','../../../../../config/logger','agi','exports','POST','/token','password','username','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','calleridname','dnid','extension','text','Bearer\x20','access_token','project','channelData','ndagenerate_audio','AudioOutputSettings'];(function(_0x22346d,_0x5a4855){var _0x4dbf48=function(_0x4025a2){while(--_0x4025a2){_0x22346d['push'](_0x22346d['shift']());}};_0x4dbf48(++_0x5a4855);}(_0x1936,0xe0));var _0x6193=function(_0x2f40b0,_0x40122e){_0x2f40b0=_0x2f40b0-0x0;var _0x5bc71b=_0x1936[_0x2f40b0];return _0x5bc71b;};'use strict';var rp=require(_0x6193('0x0'));var url=require(_0x6193('0x1'));var logger=require(_0x6193('0x2'))(_0x6193('0x3'));module[_0x6193('0x4')]=function(_0xaeca84,_0x54be5b){var _0x3a091a={'method':_0x6193('0x5'),'uri':url['resolve'](_0x54be5b['ndauth_url'],_0x6193('0x6')),'form':{'grant_type':_0x6193('0x7'),'username':_0x54be5b[_0x6193('0x8')],'password':_0x54be5b[_0x6193('0x7')]},'json':!![]};return rp(_0x3a091a)['then'](function(_0x56dabe){var _0x1b98c1={'method':_0x6193('0x5'),'uri':url[_0x6193('0x9')](_0x54be5b[_0x6193('0xa')],_0x6193('0xb')),'body':{'type':_0x54be5b[_0x6193('0xc')]||_0x6193('0xd'),'channelId':'Nda','conversation':{'id':_0xaeca84['uniqueid']},'from':{'id':_0xaeca84['callerid'],'name':_0xaeca84[_0x6193('0xe')]},'recipient':{'id':_0xaeca84[_0x6193('0xf')],'name':_0xaeca84[_0x6193('0x10')]},'text':_0x54be5b[_0x6193('0x11')],'channelData':{}},'headers':{'Authorization':_0x6193('0x12')+_0x56dabe[_0x6193('0x13')]},'json':!![]};if(_0x54be5b[_0x6193('0x14')]){_0x1b98c1['body'][_0x6193('0x15')]['ProjectName']=_0x54be5b[_0x6193('0x14')];}if(_0x54be5b[_0x6193('0x16')]=='1'){_0x1b98c1['body'][_0x6193('0x15')][_0x6193('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6193('0x18')};}if(_0x54be5b[_0x6193('0x19')]){_0x1b98c1['body'][_0x6193('0x15')][_0x6193('0x1a')]=_0x54be5b['custom_action'];if(_0x54be5b[_0x6193('0x1b')]){_0x1b98c1[_0x6193('0x1c')][_0x6193('0x15')][_0x6193('0x1d')]=_0x54be5b[_0x6193('0x1b')];}}logger[_0x6193('0x1e')](JSON['stringify'](_0x1b98c1));return rp(_0x1b98c1);});}; \ No newline at end of file +var _0x65eb=['channelData','AudioOutputSettings','CustomAction','custom_action','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','ndauth_url','password','username','ndaactivity_type','message','Nda','uniqueid','dnid','text','project','body','ProjectName','ndagenerate_audio'];(function(_0x5de365,_0x1da106){var _0x336d66=function(_0x4666a2){while(--_0x4666a2){_0x5de365['push'](_0x5de365['shift']());}};_0x336d66(++_0x1da106);}(_0x65eb,0x6f));var _0xb65e=function(_0x516e14,_0x320e33){_0x516e14=_0x516e14-0x0;var _0x1eb8ff=_0x65eb[_0x516e14];return _0x1eb8ff;};'use strict';var rp=require(_0xb65e('0x0'));var url=require(_0xb65e('0x1'));var logger=require(_0xb65e('0x2'))(_0xb65e('0x3'));module[_0xb65e('0x4')]=function(_0xfd332a,_0x381f7c){var _0x8cec7d={'method':_0xb65e('0x5'),'uri':url['resolve'](_0x381f7c[_0xb65e('0x6')],'/token'),'form':{'grant_type':_0xb65e('0x7'),'username':_0x381f7c[_0xb65e('0x8')],'password':_0x381f7c['password']},'json':!![]};return rp(_0x8cec7d)['then'](function(_0x47e526){var _0xdc8874={'method':'POST','uri':url['resolve'](_0x381f7c['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x381f7c[_0xb65e('0x9')]||_0xb65e('0xa'),'channelId':_0xb65e('0xb'),'conversation':{'id':_0xfd332a[_0xb65e('0xc')]},'from':{'id':_0xfd332a['callerid'],'name':_0xfd332a['calleridname']},'recipient':{'id':_0xfd332a[_0xb65e('0xd')],'name':_0xfd332a['extension']},'text':_0x381f7c[_0xb65e('0xe')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x47e526['access_token']},'json':!![]};if(_0x381f7c[_0xb65e('0xf')]){_0xdc8874[_0xb65e('0x10')]['channelData'][_0xb65e('0x11')]=_0x381f7c[_0xb65e('0xf')];}if(_0x381f7c[_0xb65e('0x12')]=='1'){_0xdc8874[_0xb65e('0x10')][_0xb65e('0x13')][_0xb65e('0x14')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x381f7c['custom_action']){_0xdc8874[_0xb65e('0x10')][_0xb65e('0x13')][_0xb65e('0x15')]=_0x381f7c[_0xb65e('0x16')];if(_0x381f7c[_0xb65e('0x17')]){_0xdc8874['body'][_0xb65e('0x13')]['CustomActionData']=_0x381f7c[_0xb65e('0x17')];}}logger[_0xb65e('0x18')](JSON[_0xb65e('0x19')](_0xdc8874));return rp(_0xdc8874);});}; \ 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 b4b22d8..0f457ce 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 _0xe0ec=['exports','./lib/api'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0xe0ec,0x73));var _0xce0e=function(_0x5a8aa3,_0x2294d5){_0x5a8aa3=_0x5a8aa3-0x0;var _0x5d0458=_0xe0ec[_0x5a8aa3];return _0x5d0458;};'use strict';var asr=require(_0xce0e('0x0'));module[_0xce0e('0x1')]=function(_0x4de613,_0x1f6c94,_0x2fcc84,_0x8cd9e4){return asr(_0x4de613,_0x1f6c94,_0x2fcc84,_0x8cd9e4);}; \ No newline at end of file +var _0x01ca=['exports','./lib/api'];(function(_0xe3d4a2,_0x5dbf95){var _0x131efb=function(_0x90cd0){while(--_0x90cd0){_0xe3d4a2['push'](_0xe3d4a2['shift']());}};_0x131efb(++_0x5dbf95);}(_0x01ca,0xd7));var _0xa01c=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x01ca[_0x486f4a];return _0x135d99;};'use strict';var asr=require(_0xa01c('0x0'));module[_0xa01c('0x1')]=function(_0x5f1417,_0x1b023f,_0x247ad0,_0x2c3602){return asr(_0x5f1417,_0x1b023f,_0x247ad0,_0x2c3602);}; \ 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 00d3324..23bc60f 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 _0x963a=['Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','close','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','terminate','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.'];(function(_0x29afc8,_0x55c637){var _0x3b7e06=function(_0xabfb2a){while(--_0xabfb2a){_0x29afc8['push'](_0x29afc8['shift']());}};_0x3b7e06(++_0x55c637);}(_0x963a,0xcb));var _0xa963=function(_0xdaa4d5,_0x94fbb6){_0xdaa4d5=_0xdaa4d5-0x0;var _0x32fe02=_0x963a[_0xdaa4d5];return _0x32fe02;};'use strict';var BPromise=require(_0xa963('0x0'));var _=require(_0xa963('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xa963('0x2'));var crypto=require(_0xa963('0x3'));var logger=require(_0xa963('0x4'))(_0xa963('0x5'));module['exports']=function(_0x679db4,_0x4dd00b,_0x490b6d,_0x28758f){return new BPromise(function(_0x567783,_0x2d0c94){logger[_0xa963('0x6')](_0xa963('0x7'),_0x28758f||_0xa963('0x8'));var _0x1d0daa=new WebSocket(_0x28758f||_0xa963('0x8'),{'perMessageDeflate':![]});var _0x9da880='';var _0x18881c='0';var _0x381489='1';var _0x44e569='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0xe69fa1(_0x4a26f8){var _0x32e3ad=crypto[_0xa963('0x9')](_0xa963('0xa'));_0x32e3ad[_0xa963('0xb')](_0x4a26f8);return _0x32e3ad['digest'](_0xa963('0xc'));}function _0x2913ac(){try{logger[_0xa963('0x6')](_0xa963('0xd'));var _0x395761=moment()[_0xa963('0xe')]();var _0x269331=_0xe69fa1(_0x395761+_0x4dd00b+_0x490b6d);_0x1d0daa[_0xa963('0xf')](JSON[_0xa963('0x10')]({'appID':_0x4dd00b,'timestamp':_0x395761,'appKey':_0x269331}));var _0x2860eb=fs['createReadStream'](_0x679db4);_0x2860eb['on']('data',function(_0x200d5f){_0x1d0daa['send'](_0x200d5f);});_0x2860eb['on'](_0xa963('0x11'),function(){_0x1d0daa[_0xa963('0xf')]('EOS');});}catch(_0x1f3e72){logger[_0xa963('0x12')](_0xa963('0x13'),JSON['stringify'](_0x1f3e72));_0x1d0daa['terminate']();}}function _0x4197d4(_0x471f33){try{if(_0x471f33){var _0x5b97cb=JSON[_0xa963('0x14')](_0x471f33);switch(_0x5b97cb[_0xa963('0x15')]){case 0x0:if(_0x5b97cb[_0xa963('0x16')]){if(_0x5b97cb[_0xa963('0x16')][_0xa963('0x17')]){logger[_0xa963('0x6')](_0xa963('0x18'),JSON[_0xa963('0x10')](_0x5b97cb['result'][_0xa963('0x19')]));_0x9da880=_0x5b97cb['result'][_0xa963('0x19')][0x0][_0xa963('0x1a')];_0x18881c=_0x5b97cb[_0xa963('0x16')][_0xa963('0x19')][0x0][_0xa963('0x1b')];_0x381489='0';_0x44e569='Success.';_0x1d0daa[_0xa963('0x1c')]();}}break;case 0x1:logger[_0xa963('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x381489='1';_0x44e569=_0xa963('0x1d');break;case 0x2:logger[_0xa963('0x6')](_0xa963('0x1e'));_0x381489='2';_0x44e569='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x381489='9';_0x44e569=_0xa963('0x1f');break;case 0xa:logger[_0xa963('0x6')](_0xa963('0x20'));_0x381489='10';_0x44e569=_0xa963('0x20');break;case 0xb:logger['info'](_0xa963('0x21'));_0x381489='11';_0x44e569=_0xa963('0x21');}}}catch(_0x365ad2){logger[_0xa963('0x12')](_0xa963('0x22'),JSON['stringify'](_0x365ad2));_0x1d0daa[_0xa963('0x1c')]();}}function _0x39bc59(){logger['info'](_0xa963('0x23'));_0x567783({'transcript':_0x9da880,'confidence':_0x18881c,'status':_0x381489,'status_message':_0x44e569});}function _0x3d491c(_0x28825c){logger[_0xa963('0x12')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xa963('0x24')](_0x28825c)){logger['error'](_[_0xa963('0x25')](_0x28825c)?JSON[_0xa963('0x10')](_0x28825c):_0x28825c);}}_0x1d0daa['on']('open',_0x2913ac);_0x1d0daa['on'](_0xa963('0x26'),_0x4197d4);_0x1d0daa['on']('close',_0x39bc59);_0x1d0daa['on'](_0xa963('0x12'),_0x3d491c);});}; \ No newline at end of file +var _0xbd15=['send','stringify','createReadStream','data','close','Tilde\x20ASR\x20send\x20error','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','crypto','agi','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','hex','unix'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbd15,0x179));var _0x5bd1=function(_0x3fcc20,_0x57c31b){_0x3fcc20=_0x3fcc20-0x0;var _0x15d3ce=_0xbd15[_0x3fcc20];return _0x15d3ce;};'use strict';var BPromise=require(_0x5bd1('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x5bd1('0x1'));var logger=require('../../../../../../config/logger')(_0x5bd1('0x2'));module[_0x5bd1('0x3')]=function(_0x2ac429,_0x3c704a,_0x931440,_0x4181d0){return new BPromise(function(_0x22fd29,_0x2b1e65){logger[_0x5bd1('0x4')](_0x5bd1('0x5'),_0x4181d0||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x2c35d0=new WebSocket(_0x4181d0||_0x5bd1('0x6'),{'perMessageDeflate':![]});var _0x17de27='';var _0x57a596='0';var _0x5bb0be='1';var _0x11c62d=_0x5bd1('0x7');function _0x17a51e(_0x2dae5e){var _0x347f55=crypto['createHash'](_0x5bd1('0x8'));_0x347f55[_0x5bd1('0x9')](_0x2dae5e);return _0x347f55[_0x5bd1('0xa')](_0x5bd1('0xb'));}function _0x5bb848(){try{logger[_0x5bd1('0x4')]('Open\x20Tilde\x20ASR\x20socket');var _0x3243c8=moment()[_0x5bd1('0xc')]();var _0x3dc01a=_0x17a51e(_0x3243c8+_0x3c704a+_0x931440);_0x2c35d0[_0x5bd1('0xd')](JSON[_0x5bd1('0xe')]({'appID':_0x3c704a,'timestamp':_0x3243c8,'appKey':_0x3dc01a}));var _0x466f14=fs[_0x5bd1('0xf')](_0x2ac429);_0x466f14['on'](_0x5bd1('0x10'),function(_0x3d580e){_0x2c35d0['send'](_0x3d580e);});_0x466f14['on'](_0x5bd1('0x11'),function(){_0x2c35d0['send']('EOS');});}catch(_0x23a333){logger['error'](_0x5bd1('0x12'),JSON[_0x5bd1('0xe')](_0x23a333));_0x2c35d0['terminate']();}}function _0x585db7(_0x2d138){try{if(_0x2d138){var _0x2d6b92=JSON[_0x5bd1('0x13')](_0x2d138);switch(_0x2d6b92[_0x5bd1('0x14')]){case 0x0:if(_0x2d6b92[_0x5bd1('0x15')]){if(_0x2d6b92['result'][_0x5bd1('0x16')]){logger['info'](_0x5bd1('0x17'),JSON[_0x5bd1('0xe')](_0x2d6b92[_0x5bd1('0x15')][_0x5bd1('0x18')]));_0x17de27=_0x2d6b92[_0x5bd1('0x15')][_0x5bd1('0x18')][0x0][_0x5bd1('0x19')];_0x57a596=_0x2d6b92[_0x5bd1('0x15')][_0x5bd1('0x18')][0x0]['likelihood'];_0x5bb0be='0';_0x11c62d=_0x5bd1('0x1a');_0x2c35d0[_0x5bd1('0x1b')]();}}break;case 0x1:logger[_0x5bd1('0x4')](_0x5bd1('0x7'));_0x5bb0be='1';_0x11c62d=_0x5bd1('0x7');break;case 0x2:logger[_0x5bd1('0x4')](_0x5bd1('0x1c'));_0x5bb0be='2';_0x11c62d=_0x5bd1('0x1c');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x5bb0be='9';_0x11c62d=_0x5bd1('0x1d');break;case 0xa:logger[_0x5bd1('0x4')](_0x5bd1('0x1e'));_0x5bb0be='10';_0x11c62d=_0x5bd1('0x1e');break;case 0xb:logger['info'](_0x5bd1('0x1f'));_0x5bb0be='11';_0x11c62d=_0x5bd1('0x1f');}}}catch(_0x4b76a5){logger['error'](_0x5bd1('0x20'),JSON['stringify'](_0x4b76a5));_0x2c35d0[_0x5bd1('0x1b')]();}}function _0x3182aa(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x22fd29({'transcript':_0x17de27,'confidence':_0x57a596,'status':_0x5bb0be,'status_message':_0x11c62d});}function _0x2dbbc2(_0x422789){logger[_0x5bd1('0x21')](_0x5bd1('0x22'));if(!_[_0x5bd1('0x23')](_0x422789)){logger['error'](_[_0x5bd1('0x24')](_0x422789)?JSON[_0x5bd1('0xe')](_0x422789):_0x422789);}}_0x2c35d0['on'](_0x5bd1('0x25'),_0x5bb848);_0x2c35d0['on'](_0x5bd1('0x26'),_0x585db7);_0x2c35d0['on'](_0x5bd1('0x11'),_0x3182aa);_0x2c35d0['on'](_0x5bd1('0x21'),_0x2dbbc2);});}; \ 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 10cb4be..42e330e 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0x0aa0=['exports'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x0aa0,0xf5));var _0x00aa=function(_0x56d71f,_0x10d101){_0x56d71f=_0x56d71f-0x0;var _0x44f211=_0x0aa0[_0x56d71f];return _0x44f211;};var asr=require('./asr');module[_0x00aa('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index dc477b0..c26f33a 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 _0x0f9f=['EventEmitter','./channel','127.0.0.1','emit','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','error','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','net','events'];(function(_0x1c852c,_0x113e2d){var _0x5037f4=function(_0x1b93d1){while(--_0x1b93d1){_0x1c852c['push'](_0x1c852c['shift']());}};_0x5037f4(++_0x113e2d);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x5192de,_0x4e91cd){_0x5192de=_0x5192de-0x0;var _0x4e287e=_0x0f9f[_0x5192de];return _0x4e287e;};'use strict';var util=require('util');var net=require(_0xf0f9('0x0'));var EventEmitter=require(_0xf0f9('0x1'))[_0xf0f9('0x2')];var AGIError=require('./error');var AGIChannel=require(_0xf0f9('0x3'));var AGIServer=function(_0x45cc98,_0x257b44,_0x17eab4){var _0x2f8d38=this,_0x45cc98=_0x45cc98||0x11dd,_0x257b44=_0x257b44||_0xf0f9('0x4'),_0x3eaff3=null,_0x425fbe=0x0;EventEmitter['call'](_0x2f8d38);function _0x448cf5(){if(!_0x45cc98){_0x2f8d38[_0xf0f9('0x5')]('error',new AGIError(_0xf0f9('0x6')));return![];}_0x3eaff3=net[_0xf0f9('0x7')]();_0x3eaff3[_0xf0f9('0x8')](_0x45cc98,_0x257b44);_0x3eaff3['on']('listening',function(){_0x2f8d38[_0xf0f9('0x5')](_0xf0f9('0x9'));});_0x3eaff3['on'](_0xf0f9('0xa'),function(_0x5157d5){_0x3eaff3['getConnections'](function(_0xfd838b,_0xec4152){if(_0xfd838b){_0x2f8d38[_0xf0f9('0x5')](_0xf0f9('0xb'),new AGIError(_0xf0f9('0xc'),_0xfd838b));}else if(_0x17eab4&&_0x17eab4<0x0){_0x2f8d38[_0xf0f9('0x5')](_0xf0f9('0xb'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x5157d5[_0xf0f9('0xd')]();}else if(_0x17eab4&&_0x17eab4>0x0&&_0x17eab4<_0xec4152){_0x425fbe+=0x1;_0x2f8d38[_0xf0f9('0x5')](_0xf0f9('0xb'),new AGIError(_0xf0f9('0xe'),_0x425fbe));_0x5157d5[_0xf0f9('0xd')]();}else{var _0x51d78a=new AGIChannel(_0x5157d5);_0x51d78a['on'](_0xf0f9('0xf'),function(){_0x2f8d38[_0xf0f9('0x5')](_0xf0f9('0xa'),_0x51d78a);});}});});_0x3eaff3['on'](_0xf0f9('0xb'),function(_0x2b05e3){_0x2f8d38[_0xf0f9('0x5')](_0xf0f9('0xb'),new AGIError(_0xf0f9('0xc'),_0x2b05e3[_0xf0f9('0x10')]));});_0x3eaff3['on'](_0xf0f9('0x11'),function(){_0x2f8d38['emit']('close',new AGIError(_0xf0f9('0x12')));});}process[_0xf0f9('0x13')](function(){_0x448cf5();});};util['inherits'](AGIServer,EventEmitter);module[_0xf0f9('0x14')]=function(_0x5dd012,_0x5d7582,_0x42c157){return new AGIServer(_0x5dd012,_0x5d7582,_0x42c157);}; \ No newline at end of file +var _0x946e=['E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','connection','close','nextTick','inherits','util','events','./error','127.0.0.1','call','emit','E_AGI_ARGUMENT_PORT','createServer','listening','getConnections','error'];(function(_0x4d2d07,_0x59b3f6){var _0x5b3dd5=function(_0x5d334d){while(--_0x5d334d){_0x4d2d07['push'](_0x4d2d07['shift']());}};_0x5b3dd5(++_0x59b3f6);}(_0x946e,0x1d0));var _0xe946=function(_0x19dc0d,_0x23650a){_0x19dc0d=_0x19dc0d-0x0;var _0xed20a=_0x946e[_0x19dc0d];return _0xed20a;};'use strict';var util=require(_0xe946('0x0'));var net=require('net');var EventEmitter=require(_0xe946('0x1'))['EventEmitter'];var AGIError=require(_0xe946('0x2'));var AGIChannel=require('./channel');var AGIServer=function(_0x5c9b66,_0x31cade,_0xb981db){var _0x2b42cd=this,_0x5c9b66=_0x5c9b66||0x11dd,_0x31cade=_0x31cade||_0xe946('0x3'),_0x49224a=null,_0x123d0c=0x0;EventEmitter[_0xe946('0x4')](_0x2b42cd);function _0x4e9ca6(){if(!_0x5c9b66){_0x2b42cd[_0xe946('0x5')]('error',new AGIError(_0xe946('0x6')));return![];}_0x49224a=net[_0xe946('0x7')]();_0x49224a['listen'](_0x5c9b66,_0x31cade);_0x49224a['on']('listening',function(){_0x2b42cd['emit'](_0xe946('0x8'));});_0x49224a['on']('connection',function(_0x5679f6){_0x49224a[_0xe946('0x9')](function(_0xd0f134,_0x56d82e){if(_0xd0f134){_0x2b42cd['emit'](_0xe946('0xa'),new AGIError(_0xe946('0xb'),_0xd0f134));}else if(_0xb981db&&_0xb981db<0x0){_0x2b42cd['emit'](_0xe946('0xa'),new AGIError(_0xe946('0xc')));_0x5679f6[_0xe946('0xd')]();}else if(_0xb981db&&_0xb981db>0x0&&_0xb981db<_0x56d82e){_0x123d0c+=0x1;_0x2b42cd[_0xe946('0x5')](_0xe946('0xa'),new AGIError(_0xe946('0xe'),_0x123d0c));_0x5679f6[_0xe946('0xd')]();}else{var _0x5d0038=new AGIChannel(_0x5679f6);_0x5d0038['on']('ready',function(){_0x2b42cd[_0xe946('0x5')](_0xe946('0xf'),_0x5d0038);});}});});_0x49224a['on'](_0xe946('0xa'),function(_0x551686){_0x2b42cd[_0xe946('0x5')](_0xe946('0xa'),new AGIError(_0xe946('0xb'),_0x551686['code']));});_0x49224a['on'](_0xe946('0x10'),function(){_0x2b42cd[_0xe946('0x5')](_0xe946('0x10'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xe946('0x11')](function(){_0x4e9ca6();});};util[_0xe946('0x12')](AGIServer,EventEmitter);module['exports']=function(_0x2b2b66,_0x5d8602,_0x1489f4){return new AGIServer(_0x2b2b66,_0x5d8602,_0x1489f4);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 1eedeed..458a56a 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 _0xb0df=['Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','getMailAccount','no\x20mail\x20account\x20found','email','Smtp','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','debug','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment','./scripts','rawBody','menu','channel','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunkById','getSound','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','dnid','arg_1','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','LOCAL','shellCommand','replace','googleCloudTTS','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','dialogflowV2_language','ispeechTTS','ispeech_tts_language','speed','ispeechASR','key','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isArray','saveRestApiResult','isPlainObject','%s.%s','setVariable','replaceObjectAllVariables','split','length','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','exec','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','no\x20database\x20selected','odbc_id','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','variable\x20%s\x20set','dial','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','out','Dialogflow\x20Result\x20%s','speech','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','first','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','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','aws_access_key_id','no\x20bot\x20name\x20configured','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','gotoc','continueAt','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb0df,0x85));var _0xfb0d=function(_0x2feb53,_0x264ef7){_0x2feb53=_0x2feb53-0x0;var _0x5700ee=_0xb0df[_0x2feb53];return _0x5700ee;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xfb0d('0x0'));var _=require(_0xfb0d('0x1'));var sh=require(_0xfb0d('0x2'));var odbc=require(_0xfb0d('0x3'))();var rs=require(_0xfb0d('0x4'));var moment=require(_0xfb0d('0x5'));var Mustache=require(_0xfb0d('0x6'));var rp=require(_0xfb0d('0x7'));var logger=require(_0xfb0d('0x8'))('agi');var config=require(_0xfb0d('0x9'));var scripts=require(_0xfb0d('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0xfb0d('0xb')];var verticesWithRetry=[_0xfb0d('0xc'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x3092de,_0x2f7ddc,_0x501d4f){this[_0xfb0d('0xd')]=_0x3092de;this[_0xfb0d('0xe')]=_0x2f7ddc;this[_0xfb0d('0xf')]=_0x501d4f;};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x11')]=function(_0x154c31,_0x4936a1){this[_0xfb0d('0xe')]['getVariableById'](_0x154c31)[_0xfb0d('0x12')](function(_0x335172){_0x4936a1(null,_0x335172?_0x335172[_0xfb0d('0x13')]:![]);})[_0xfb0d('0x14')](function(_0x244260){_0x4936a1(_0x244260);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x15')]=function(_0x587b3a,_0x505e22){this['rpc'][_0xfb0d('0x16')](_0x587b3a)[_0xfb0d('0x12')](function(_0x45cc75){_0x505e22(null,_0x45cc75?_0x45cc75[_0xfb0d('0x13')]:![]);})[_0xfb0d('0x14')](function(_0x241a5e){_0x505e22(_0x241a5e);});};AGIVertices[_0xfb0d('0x10')]['getSquareProject']=function(_0x77e8e7,_0x116179){this[_0xfb0d('0xe')][_0xfb0d('0x17')](_0x77e8e7)['then'](function(_0x28f8dc){_0x116179(null,_0x28f8dc?_0x28f8dc[_0xfb0d('0x13')]:![]);})[_0xfb0d('0x14')](function(_0x443e2d){_0x116179(_0x443e2d);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x18')]=function(_0x2778ab,_0x499fa1){this[_0xfb0d('0xe')][_0xfb0d('0x19')](_0x2778ab)[_0xfb0d('0x12')](function(_0x412173){_0x499fa1(null,_0x412173?_0x412173[_0xfb0d('0x1a')]:![]);})[_0xfb0d('0x14')](function(_0x2fb83c){_0x499fa1(_0x2fb83c);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x1b')]=function(_0x21e334,_0x3411cb){this[_0xfb0d('0xe')]['getUserById'](_0x21e334)[_0xfb0d('0x12')](function(_0x1b2096){_0x3411cb(null,_0x1b2096?_0x1b2096['name']:![]);})['catch'](function(_0x3bd70b){_0x3411cb(_0x3bd70b);});};AGIVertices[_0xfb0d('0x10')]['getTrunk']=function(_0x85663a,_0x29be8f){this[_0xfb0d('0xe')][_0xfb0d('0x1c')](_0x85663a)[_0xfb0d('0x12')](function(_0x10c1f9){_0x29be8f(null,_0x10c1f9?_0x10c1f9[_0xfb0d('0x13')]:![]);})[_0xfb0d('0x14')](function(_0x2d5f75){_0x29be8f(_0x2d5f75);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x1d')]=function(_0x803bdd,_0x5ccecd){var _0x2fd1f7=this;this[_0xfb0d('0xe')]['getSoundById'](_0x803bdd)[_0xfb0d('0x12')](function(_0x2a2838){_0x5ccecd(null,_0x2a2838?_0x2fd1f7[_0xfb0d('0x1e')](_0x2a2838[_0xfb0d('0x1f')]):![]);})['catch'](function(_0x4fb6ba){_0x5ccecd(_0x4fb6ba);});};AGIVertices[_0xfb0d('0x10')]['getMailAccount']=function(_0x21f005,_0x58fdf1){this[_0xfb0d('0xe')][_0xfb0d('0x20')](_0x21f005)[_0xfb0d('0x12')](function(_0x404be1){_0x58fdf1(null,_0x404be1?_0x404be1:![]);})['catch'](function(_0x4839e7){_0x58fdf1(_0x4839e7);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x21')]=function(_0x3bfde8,_0x2b901e,_0x51e713){this[_0xfb0d('0xf')]['sendMailMessage'](_0x3bfde8,_0x2b901e)[_0xfb0d('0x12')](function(){_0x51e713(null);})['catch'](function(_0x2640a6){_0x51e713(_0x2640a6);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x22')]=function(_0x1ac68a,_0x608b28){this[_0xfb0d('0xe')]['getIntervalById'](_0x1ac68a)[_0xfb0d('0x12')](function(_0x3e9206){if(_0x3e9206){if(_0x3e9206[_0xfb0d('0x23')]){_0x608b28(null,[_0x3e9206[_0xfb0d('0x24')]]);}else{_0x608b28(null,_[_0xfb0d('0x25')](_0x3e9206['Intervals'],_0xfb0d('0x24')));}}else{_0x608b28(null,![]);}})[_0xfb0d('0x14')](function(_0x441d74){_0x608b28(_0x441d74);});};AGIVertices[_0xfb0d('0x10')]['getSoundPath']=function(_0x4cc9dc){return util['format'](_0xfb0d('0x26'),FILES_PATH,_0x4cc9dc);};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x27')]=function(_0x2f2a84,_0x359ad6,_0xb5f561){odbc[_0xfb0d('0x28')](_0x2f2a84,function(_0x5664bb){if(_0x5664bb){logger[_0xfb0d('0x29')](_0xfb0d('0x2a'),_0x5664bb);_0xb5f561(_0x5664bb);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0xfb0d('0x2b')](_0x359ad6,function(_0x2ffba6,_0x1eaed8){if(_0x2ffba6){logger[_0xfb0d('0x2c')](_0xfb0d('0x2d'),_0x359ad6);_0xb5f561(_0x2ffba6);}else{logger['info'](_0xfb0d('0x2e'),_0x359ad6);odbc[_0xfb0d('0x2f')](function(_0x3e1072){if(_0x3e1072){logger[_0xfb0d('0x29')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x3e1072);}_0xb5f561(null,_0x1eaed8);});}});}});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x30')]=function(_0x5096de,_0x40f11a){this[_0xfb0d('0xe')][_0xfb0d('0x31')](_0x5096de)[_0xfb0d('0x12')](function(_0x230b21){_0x40f11a(null,_0x230b21?_0x230b21:![]);})[_0xfb0d('0x14')](function(_0x51bef0){_0x40f11a(_0x51bef0);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x32')]=function(_0x37ceda,_0x509d2b){this[_0xfb0d('0xe')][_0xfb0d('0x32')](_0x37ceda)['then'](function(_0x11e2ae){_0x509d2b(null,_0x11e2ae);})['catch'](function(_0x25514c){_0x509d2b(_0x25514c);});};AGIVertices[_0xfb0d('0x10')]['createSquareDetailsReport']=function(_0x52b2dc,_0x5e06b1,_0x51ef5c){this[_0xfb0d('0xe')][_0xfb0d('0x33')]({'uniqueid':this[_0xfb0d('0xd')][_0xfb0d('0x34')],'node':_0x52b2dc[_0xfb0d('0x35')],'application':_0x52b2dc[_0xfb0d('0x36')],'data':_0x5e06b1||null,'project_name':this[_0xfb0d('0xd')]['arg_1'],'callerid':this[_0xfb0d('0xd')][_0xfb0d('0x37')]})[_0xfb0d('0x12')](function(_0x111190){if(_0x51ef5c){_0x51ef5c(null,_0x111190);}})[_0xfb0d('0x14')](function(_0x4eb572){if(_0x51ef5c){_0x51ef5c(_0x4eb572);}});};AGIVertices[_0xfb0d('0x10')]['createSquareRecording']=function(_0x91cc9e,_0x5c3e8d,_0x3f8acd,_0x202568){this[_0xfb0d('0xe')][_0xfb0d('0x38')]({'uniqueid':this[_0xfb0d('0xd')]['uniqueid'],'callerid':this[_0xfb0d('0xd')][_0xfb0d('0x37')],'calleridname':this[_0xfb0d('0xd')][_0xfb0d('0x39')],'context':this[_0xfb0d('0xd')][_0xfb0d('0x3a')],'extension':this['channel'][_0xfb0d('0x3b')],'priority':this[_0xfb0d('0xd')]['priority'],'accountcode':this[_0xfb0d('0xd')]['accountcode'],'dnid':this['channel'][_0xfb0d('0x3c')],'projectName':this[_0xfb0d('0xd')][_0xfb0d('0x3d')],'saveName':_0x5c3e8d,'filename':_0x91cc9e['file']||_0x5c3e8d,'savePath':_0x3f8acd})[_0xfb0d('0x12')](function(_0x16024c){_0x202568(null,_0x16024c);})[_0xfb0d('0x14')](function(_0xc6785d){_0x202568(_0xc6785d);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x3e')]=function(_0x25ba79,_0x1caffa,_0x31ae91,_0x5cd201,_0x2279fb){this['rpc'][_0xfb0d('0x3e')]({'uniqueid':this['channel'][_0xfb0d('0x34')],'body':_0x25ba79,'direction':_0x1caffa,'providerName':_0x31ae91,'providerResponse':_0x5cd201})['then'](function(_0x436bcf){if(_0x2279fb){_0x2279fb(null,_0x436bcf);}})['catch'](function(_0x16d3b7){if(_0x2279fb){_0x2279fb(_0x16d3b7);}});};AGIVertices[_0xfb0d('0x10')]['createCmContact']=function(_0x46c545,_0x20e8c6){this[_0xfb0d('0xe')][_0xfb0d('0x3f')]({'firstName':_[_0xfb0d('0x40')](_0x46c545['name'])||_[_0xfb0d('0x41')](_0x46c545['name'])?_0xfb0d('0x42')+Math[_0xfb0d('0x43')]():_0x46c545[_0xfb0d('0x13')],'lastName':_['isEmpty'](_0x46c545[_0xfb0d('0x44')])||_[_0xfb0d('0x41')](_0x46c545[_0xfb0d('0x44')])?null:_0x46c545[_0xfb0d('0x44')],'phone':_0x46c545['phone'],'ListId':_0x46c545[_0xfb0d('0x45')],'scheduledat':_0x46c545[_0xfb0d('0x46')],'callbackUniqueid':this[_0xfb0d('0xd')][_0xfb0d('0x34')],'tags':_0xfb0d('0x47'),'description':_0xfb0d('0x48')+_0x46c545[_0xfb0d('0x46')][_0xfb0d('0x49')](),'priority':_0x46c545['callback_priority']})[_0xfb0d('0x12')](function(_0x3a609f){_0x20e8c6(null,_0x3a609f);})[_0xfb0d('0x14')](function(_0x585848){_0x20e8c6(_0x585848);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x4a')]=function(_0x2d946b,_0x2c4d0c){this['rpc'][_0xfb0d('0x4b')](_0x2d946b)['then'](function(_0x368b92){_0x2c4d0c(null,_0x368b92?_0x368b92['name']:![]);})[_0xfb0d('0x14')](function(_0x19aca4){_0x2c4d0c(_0x19aca4);});};AGIVertices['prototype'][_0xfb0d('0x4c')]=function(_0x44219d,_0x2dc0c6,_0x40543a){var _0x18fd00={'role':_0xfb0d('0x4d')};_0x18fd00[_0x44219d]=this[_0xfb0d('0xd')]['callerid'];this[_0xfb0d('0xe')][_0xfb0d('0x4c')](_0x18fd00,_0x2dc0c6,this['channel']['uniqueid'])[_0xfb0d('0x12')](function(_0x2ca6da){_0x40543a(null,_[_0xfb0d('0x41')](_0x2ca6da)?![]:!![]);})[_0xfb0d('0x14')](function(_0x3dd080){logger['error'](_0x3dd080);_0x40543a(null,![]);});};AGIVertices[_0xfb0d('0x10')]['agentUnpause']=function(_0x1097f1,_0x254b7a){var _0x2461fb={'role':'agent'};_0x2461fb[_0x1097f1]=this['channel'][_0xfb0d('0x37')];this[_0xfb0d('0xe')][_0xfb0d('0x4e')](_0x2461fb)['then'](function(_0x4a4112){_0x254b7a(null,_[_0xfb0d('0x41')](_0x4a4112)?![]:!![]);})[_0xfb0d('0x14')](function(_0x38f8d1){logger[_0xfb0d('0x29')](_0x38f8d1);_0x254b7a(null,![]);});};AGIVertices['prototype'][_0xfb0d('0x4f')]=function(_0x102c89,_0x594803){var _0x17bb7d={'role':'agent'};_0x17bb7d[_0x102c89]=this[_0xfb0d('0xd')][_0xfb0d('0x37')];this[_0xfb0d('0xe')]['agentLogout'](_0x17bb7d)[_0xfb0d('0x12')](function(_0x95830b){_0x594803(null,_[_0xfb0d('0x41')](_0x95830b)?![]:!![]);})['catch'](function(_0x48041b){logger['error'](_0x48041b);_0x594803(null,![]);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x50')]=function(_0x55ece4,_0x525baa){var _0xbdb244={'role':'agent'};_0xbdb244[_0x55ece4]=this[_0xfb0d('0xd')][_0xfb0d('0x37')];var _0x56fb29=_0x55ece4!=_0xfb0d('0x51')?util[_0xfb0d('0x52')]('%s/%s@from-sip/n',_0xfb0d('0x53'),this[_0xfb0d('0xd')][_0xfb0d('0x37')]):undefined;this[_0xfb0d('0xe')][_0xfb0d('0x50')](_0xbdb244,_0x56fb29)[_0xfb0d('0x12')](function(_0x1ffc72){_0x525baa(null,_[_0xfb0d('0x41')](_0x1ffc72)?![]:!![]);})[_0xfb0d('0x14')](function(_0x5663f7){logger[_0xfb0d('0x29')](_0x5663f7);_0x525baa(null,![]);});};AGIVertices['prototype'][_0xfb0d('0x54')]=function(_0x1b675d,_0x4366aa){sh['exec'](_['trim'](_0x1b675d),function(_0x45ca18,_0x4e8cbf){var _0x2c8dcc=_0x4e8cbf[_0xfb0d('0x55')](/(\r\n|\n|\r)/gm,'');_0x4366aa(null,_0x2c8dcc);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x56')]=function(_0x500bbb,_0x3f32a8){scripts['googleCloudTTS'](_0x500bbb['apiKey'],_0x500bbb[_0xfb0d('0x57')]||_0xfb0d('0x58'),_0x500bbb[_0xfb0d('0x58')],_0x500bbb['languageCode']||_0xfb0d('0x59'),_0x500bbb[_0xfb0d('0x5a')]||_0xfb0d('0x5b'),_0x500bbb['audioEncoding']||'MP3')[_0xfb0d('0x12')](function(_0x70a0cf){_0x3f32a8(null,_0x70a0cf);})['catch'](function(_0x14c744){_0x3f32a8(_0x14c744);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x5c')]=function(_0x438e2f,_0x21d623){scripts[_0xfb0d('0x5c')](_0x438e2f[_0xfb0d('0x58')],_0x438e2f[_0xfb0d('0x5d')]||'en',0x1)[_0xfb0d('0x12')](function(_0x45eb05){_0x21d623(null,_0x45eb05);})[_0xfb0d('0x14')](function(_0x31052d){_0x21d623(_0x31052d);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x5e')]=function(_0x30971d,_0x47cc17){var _0x3008d5={'uri':_0x30971d[_0xfb0d('0x5f')],'method':_0x30971d[_0xfb0d('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x30971d[_0xfb0d('0x61')])===_0xfb0d('0x62')&&parseInt(_0x30971d['timeout'])>=0x1?parseInt(_0x30971d[_0xfb0d('0x61')])*0x3e8:0x5*0x3e8};if(_[_0xfb0d('0x63')]([_0xfb0d('0x64'),_0xfb0d('0x65')],_0x3008d5[_0xfb0d('0x60')][_0xfb0d('0x66')]())){try{_0x3008d5[_0xfb0d('0x67')]=_0x30971d[_0xfb0d('0xb')]?JSON[_0xfb0d('0x68')](_0x30971d[_0xfb0d('0xb')]):{};}catch(_0x648735){logger[_0xfb0d('0x29')](_0xfb0d('0x69'),_0x648735);}}try{_0x3008d5[_0xfb0d('0x6a')]=_0x30971d['rawHeaders']?JSON[_0xfb0d('0x68')](_0x30971d[_0xfb0d('0x6b')]):{};}catch(_0x30cf71){logger[_0xfb0d('0x29')](_0xfb0d('0x6c'),_0x30cf71);}if(_0x30971d[_0xfb0d('0x6d')]){try{var _0x560935=require(_0x30971d['computedVariables'])['sync'](this,_0x3008d5);_0x3008d5['uri']=Mustache[_0xfb0d('0x6e')](_0x30971d['url'],_0x560935,{},['$$','$$']);if(_0x3008d5[_0xfb0d('0x6a')]){_0x3008d5[_0xfb0d('0x6a')]=JSON['parse'](Mustache[_0xfb0d('0x6e')](JSON[_0xfb0d('0x6f')](_0x3008d5['headers']),_0x560935,{},['$$','$$']));}if(_0x3008d5[_0xfb0d('0x67')]){_0x3008d5[_0xfb0d('0x67')]=JSON[_0xfb0d('0x68')](Mustache[_0xfb0d('0x6e')](JSON['stringify'](_0x3008d5[_0xfb0d('0x67')]),_0x560935,{},['$$','$$']));}}catch(_0x4d3aae){logger[_0xfb0d('0x29')](_0xfb0d('0x70'),_0x4d3aae);}}rp(_0x3008d5)[_0xfb0d('0x12')](function(_0x3f903c){var _0x47bd9f={'statusCode':_0x3f903c['statusCode']||0xc8,'statusMessage':_0x3f903c[_0xfb0d('0x71')]||'OK','headers':_0x3f903c[_0xfb0d('0x6a')]||{},'body':_0x3f903c[_0xfb0d('0x67')]||{}};_0x47cc17(null,_0x47bd9f);})[_0xfb0d('0x14')](function(_0x4ce28c){var _0x57ffa5={'statusCode':_0x4ce28c[_0xfb0d('0x72')]||0x1f4,'statusMessage':_0x4ce28c[_0xfb0d('0x73')]||_0xfb0d('0x74'),'headers':_0x4ce28c[_0xfb0d('0x75')]['headers']||{},'body':_0x4ce28c[_0xfb0d('0x75')]['body']||{}};_0x47cc17(null,_0x57ffa5);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x76')]=function(_0x5a941d,_0x21b958){scripts['googleDialogflow'](this['channel'][_0xfb0d('0x34')],_0x5a941d['key'],_0x5a941d['text'],_0x5a941d[_0xfb0d('0x77')]||'en')['then'](function(_0x214d8f){_0x21b958(null,_0x214d8f);})['catch'](function(_0x5a2d50){_0x21b958(_0x5a2d50);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x78')]=function(_0x4d9245,_0x394ec4){scripts[_0xfb0d('0x78')](this[_0xfb0d('0xd')]['uniqueid'],_0x4d9245[_0xfb0d('0x79')],_0x4d9245['client_email'],_0x4d9245['private_key'],_0x4d9245['text'],_0x4d9245[_0xfb0d('0x7a')]||'en')[_0xfb0d('0x12')](function(_0x3d6177){_0x394ec4(null,_0x3d6177);})['catch'](function(_0x5650ea){_0x394ec4(_0x5650ea);});};AGIVertices[_0xfb0d('0x10')]['sestekNDA']=function(_0x50691b,_0x426579){scripts['sestekNDA'](this[_0xfb0d('0xd')],_0x50691b)[_0xfb0d('0x12')](function(_0xa8ab79){_0x426579(null,_0xa8ab79);})[_0xfb0d('0x14')](function(_0x3ae125){_0x426579(_0x3ae125);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x7b')]=function(_0x425ab1,_0x578cf1){scripts[_0xfb0d('0x7b')](_0x425ab1['key'],_0x425ab1[_0xfb0d('0x58')],_0x425ab1[_0xfb0d('0x7c')]||_0xfb0d('0x59'),_0x425ab1[_0xfb0d('0x7d')])[_0xfb0d('0x12')](function(_0x28c445){_0x578cf1(null,_0x28c445);})['catch'](function(_0x27bc25){_0x578cf1(_0x27bc25);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x7e')]=function(_0x453877,_0x9a385c,_0x188ec1){scripts[_0xfb0d('0x7e')](_0x9a385c,_0x453877[_0xfb0d('0x7f')],_0x453877[_0xfb0d('0x80')]||_0xfb0d('0x59'),this[_0xfb0d('0x81')](_0x453877['model'])?_0x453877[_0xfb0d('0x82')]:undefined)[_0xfb0d('0x12')](function(_0x1dcdb6){_0x188ec1(null,_0x1dcdb6);})['catch'](function(_0x1ac806){_0x188ec1(_0x1ac806);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x83')]=function(_0x21fb93,_0x35b56e){scripts[_0xfb0d('0x83')](_0x21fb93['aws_access_key_id'],_0x21fb93[_0xfb0d('0x84')],_0x21fb93[_0xfb0d('0x85')],_0x21fb93[_0xfb0d('0x86')]||_0xfb0d('0x87'),_0x21fb93[_0xfb0d('0x58')],_0x21fb93[_0xfb0d('0x88')]||_0xfb0d('0x58'))[_0xfb0d('0x12')](function(_0x3a1c9b){_0x35b56e(null,_0x3a1c9b);})[_0xfb0d('0x14')](function(_0x489f75){_0x35b56e(_0x489f75);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x89')]=function(_0x471555,_0x3a0583){scripts['awsLex'](this[_0xfb0d('0xd')][_0xfb0d('0x34')],_0x471555['aws_access_key_id'],_0x471555[_0xfb0d('0x84')],_0x471555[_0xfb0d('0x8a')],_0x471555[_0xfb0d('0x58')],_0x471555[_0xfb0d('0x8b')])[_0xfb0d('0x12')](function(_0x460921){_0x3a0583(null,_0x460921);})[_0xfb0d('0x14')](function(_0x33babf){_0x3a0583(_0x33babf);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x8c')]=function(_0x1b4ab0,_0xdc7815,_0x574a26){scripts['googleASR'](_0xdc7815,_0x1b4ab0['key'],_0x1b4ab0[_0xfb0d('0x8d')]||'en-US')[_0xfb0d('0x12')](function(_0x419498){_0x574a26(null,_0x419498);})[_0xfb0d('0x14')](function(_0x1e48ab){_0x574a26(_0x1e48ab);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x8e')]=function(_0x4dc9b8,_0x5cf191,_0x39fdc3){scripts[_0xfb0d('0x8e')](_0x5cf191,_0x4dc9b8[_0xfb0d('0x8f')],_0x4dc9b8[_0xfb0d('0x90')],_0x4dc9b8['uri'])[_0xfb0d('0x12')](function(_0x2b39d5){_0x39fdc3(null,_0x2b39d5);})[_0xfb0d('0x14')](function(_0x3e9f9a){_0x39fdc3(_0x3e9f9a);});};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x91')]=function(_0xf4c526){var _0x5b59f4=_[_0xfb0d('0x63')](verticesWithRetry,_0xf4c526[_0xfb0d('0x36')])?_0xf4c526:_[_0xfb0d('0x92')](_0xf4c526);for(var _0x555736 in _0x5b59f4){if(_0x5b59f4[_0xfb0d('0x93')](_0x555736)){if(_0x5b59f4[_0x555736]&&_[_0xfb0d('0x94')](_0x5b59f4[_0x555736])){if(_[_0xfb0d('0x63')](recursiveMapAttributes,_0x555736)){_0x5b59f4[_0x555736]=this['replaceObjectAllVariables'](_0x5b59f4[_0x555736]);}else{_0x5b59f4[_0x555736]=this[_0xfb0d('0x95')](_0x5b59f4[_0x555736]);}}}}return _0x5b59f4;};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x96')]=function(_0x42f4f1){for(var _0x3b4289 in _0x42f4f1){if(_0x42f4f1[_0xfb0d('0x93')](_0x3b4289)){if(_['isPlainObject'](_0x42f4f1[_0x3b4289])){this[_0xfb0d('0x96')](_0x42f4f1[_0x3b4289]);}else if(_[_0xfb0d('0x97')](_0x42f4f1[_0x3b4289])){for(var _0x26532b=0x0;_0x26532b<_0x42f4f1[_0x3b4289]['length'];_0x26532b++){this[_0xfb0d('0x96')](_0x42f4f1[_0x3b4289][_0x26532b]);}}else if(_[_0xfb0d('0x94')](_0x42f4f1[_0x3b4289])){_0x42f4f1[_0x3b4289]=this[_0xfb0d('0x95')](_0x42f4f1[_0x3b4289]);}}}};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x98')]=function(_0x489bd0,_0x451e8b){for(var _0x462ebe in _0x489bd0){if(_0x489bd0[_0xfb0d('0x93')](_0x462ebe)){if(_[_0xfb0d('0x99')](_0x489bd0[_0x462ebe])){if(!_[_0xfb0d('0x40')](_0x489bd0[_0x462ebe])){this[_0xfb0d('0x98')](_0x489bd0[_0x462ebe],util[_0xfb0d('0x52')](_0xfb0d('0x9a'),_0x451e8b,_0x462ebe));}}else if(_['isArray'](_0x489bd0[_0x462ebe])){for(var _0x35a500=0x0;_0x35a500<_0x489bd0[_0x462ebe]['length'];_0x35a500++){this[_0xfb0d('0x98')](_0x489bd0[_0x462ebe][_0x35a500],util[_0xfb0d('0x52')](_0xfb0d('0x9a'),_0x451e8b,_0x462ebe+'['+_0x35a500+']'));}}else{if(!_[_0xfb0d('0x41')](_0x489bd0[_0x462ebe])){this[_0xfb0d('0xd')][_0xfb0d('0x9b')](util[_0xfb0d('0x52')](_0xfb0d('0x9a'),_0x451e8b,_0x462ebe),_0x489bd0[_0x462ebe]);}}}}};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x9c')]=function(_0x2ebc82){try{var _0x43abec=JSON[_0xfb0d('0x68')](_0x2ebc82);this[_0xfb0d('0x96')](_0x43abec);return JSON[_0xfb0d('0x6f')](_0x43abec);}catch(_0x37c2c3){return this[_0xfb0d('0x95')](_0x2ebc82);}};AGIVertices['prototype'][_0xfb0d('0x95')]=function(_0x367680){var _0x369f4c=_0x367680[_0xfb0d('0x9d')]('{');for(var _0x175fd7=0x1;_0x175fd7<_0x369f4c[_0xfb0d('0x9e')];_0x175fd7+=0x1){var _0x38a983=_0x369f4c[_0x175fd7]['split']('}');if(_0x38a983[_0xfb0d('0x9e')]>0x1){_0x367680=_0x367680[_0xfb0d('0x9f')]('{'+_0x38a983[0x0]+'}',this[_0xfb0d('0xd')][_0xfb0d('0x11')](_0x38a983[0x0])[_0xfb0d('0xa0')]||_0x38a983[0x0]);}}if(_0x369f4c['length']===0x1){return _0x367680['toString']();}return this[_0xfb0d('0x95')](_0x367680);};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0xa1')]=function(_0x1dd2c6,_0x209d1d){var _0x45c63f=this[_0xfb0d('0xd')][_0xfb0d('0x11')](_0x1dd2c6);if(_0x45c63f[_0xfb0d('0xa2')]===-0x1){return _0x45c63f;}logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0xa3'),_0x209d1d,_0x45c63f[_0xfb0d('0xa0')]));return this[_0xfb0d('0xd')][_0xfb0d('0x9b')](_0x209d1d,_0x45c63f[_0xfb0d('0xa0')]);};AGIVertices[_0xfb0d('0x10')]['isConfigured']=function(_0x1eeacc){return _0x1eeacc&&_0x1eeacc!=='0'&&_0x1eeacc!=='-1'&&_0x1eeacc!=='';};AGIVertices['prototype'][_0xfb0d('0xa4')]=function(_0x2737b5){this['createSquareDetailsReport'][_0xfb0d('0xa5')](this,_0x2737b5,'-');_0x2737b5[_0xfb0d('0xa6')]=_0x2737b5[_0xfb0d('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0xa7')]=function(_0x59eb01){logger['info'](util[_0xfb0d('0x52')](_0xfb0d('0xa8'),_0x59eb01['label']));if(!this['isConfigured'](_0x59eb01[_0xfb0d('0x58')])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')]('no\x20text\x20configured');}var _0x30bc4b='\x22'+_0x59eb01[_0xfb0d('0x58')]+'\x22';if(this[_0xfb0d('0x81')](_0x59eb01[_0xfb0d('0x75')])){_0x30bc4b+=','+_0x59eb01['options'];}var _0x165176=this[_0xfb0d('0xd')][_0xfb0d('0xaa')]('MRCPSynth',_0x30bc4b);if(_0x165176[_0xfb0d('0xa2')]===-0x1){return _0x165176;}return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')]('Executed\x20command\x20MRCPSynth\x20%s',_0x30bc4b));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0xab')]=function(_0x4f9bc0){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0xac'),_0x4f9bc0[_0xfb0d('0x35')]));if(!this['isConfigured'](_0x4f9bc0['grammar'])){return this['channel'][_0xfb0d('0xa9')](_0xfb0d('0xad'));}var _0x5274f4=_0x4f9bc0[_0xfb0d('0xae')];if(this[_0xfb0d('0x81')](_0x4f9bc0['options'])){_0x5274f4+=','+_0x4f9bc0[_0xfb0d('0x75')];}var _0x44a704=this['channel'][_0xfb0d('0xaa')]('MRCPRecog',_0x5274f4);if(_0x44a704[_0xfb0d('0xa2')]===-0x1){return _0x44a704;}var _0x17c9ac=this[_0xfb0d('0xa1')](_0xfb0d('0xaf'),'MRCP_RECOG_CONFIDENCE');if(_0x17c9ac['result']===-0x1){return _0x17c9ac;}var _0x185e0c=this[_0xfb0d('0xa1')]('RECOG_INPUT()',_0xfb0d('0xb0'));if(_0x185e0c[_0xfb0d('0xa2')]===-0x1){return _0x185e0c;}var _0x3e3939=this['getAndSetVariable'](_0xfb0d('0xb1'),'MRCP_RECOG_INSTANCE');if(_0x3e3939[_0xfb0d('0xa2')]===-0x1){return _0x3e3939;}return this[_0xfb0d('0xd')]['noop'](util[_0xfb0d('0x52')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5274f4));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0xb2')]=function(_0x2a4266){logger['info'](util[_0xfb0d('0x52')](_0xfb0d('0xb3'),_0x2a4266[_0xfb0d('0x35')]));return this['channel'][_0xfb0d('0xb2')]([_0x2a4266[_0xfb0d('0xb4')],_0x2a4266['args']]);};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0xb5')]=function(_0x591c22){logger[_0xfb0d('0x2c')](util['format'](_0xfb0d('0xb6'),_0x591c22['label']));if(this[_0xfb0d('0x81')](_0x591c22[_0xfb0d('0x61')])){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0xb7'),_0x591c22[_0xfb0d('0x61')]));var _0x320c01=this[_0xfb0d('0xd')]['wait'](_0x591c22[_0xfb0d('0x61')]);if(_0x320c01['result']===-0x1){return _0x320c01;}}return this['channel'][_0xfb0d('0xb5')]();};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x47')]=function(_0x92b932){logger[_0xfb0d('0x2c')](util['format'](_0xfb0d('0xb8'),_0x92b932[_0xfb0d('0x35')]));if(!this[_0xfb0d('0x81')](_0x92b932[_0xfb0d('0x45')])){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x92b932,_0xfb0d('0xb9'));}_0x92b932[_0xfb0d('0x46')]=moment();if(this[_0xfb0d('0x81')](_0x92b932[_0xfb0d('0xba')])){_0x92b932[_0xfb0d('0x46')]=moment()[_0xfb0d('0xbb')](_0x92b932['delay'],_0xfb0d('0xbc'));}if(!this[_0xfb0d('0x81')](_0x92b932[_0xfb0d('0xbd')])){_0x92b932['callback_priority']=0x2;}this[_0xfb0d('0x3f')][_0xfb0d('0xa5')](this,_0x92b932);return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0xbe'),_0x92b932[_0xfb0d('0xbf')],_0x92b932[_0xfb0d('0x45')],_0x92b932[_0xfb0d('0x46')]));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0xc0')]=function(_0x4be677){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0xc1'),_0x4be677[_0xfb0d('0x35')]));var _0x382608=this[_0xfb0d('0xd')][_0xfb0d('0xaa')](_0x4be677[_0xfb0d('0xc2')],_0x4be677[_0xfb0d('0x75')]);if(_0x382608[_0xfb0d('0xa2')]===-0x1){return _0x382608;}return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0xc3'),_0x4be677['application'],_0x4be677['options']));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0xc4')]=function(_0x179e00){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0xc5'),_0x179e00[_0xfb0d('0x35')]));if(!this['isConfigured'](_0x179e00['text'])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0xc6'));}var _0x1b4f95='\x22'+_0x179e00['text']+'\x22';if(this['isConfigured'](_0x179e00[_0xfb0d('0x75')])){_0x1b4f95+=','+_0x179e00[_0xfb0d('0x75')];}var _0x948329=this['channel']['exec'](_0xfb0d('0xc7'),_0x1b4f95);if(_0x948329[_0xfb0d('0xa2')]===-0x1){return _0x948329;}return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0xc8'),_0x1b4f95));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0xc9')]=function(_0x46629f){logger['info'](util[_0xfb0d('0x52')](_0xfb0d('0xca'),_0x46629f[_0xfb0d('0x35')]));if(!this[_0xfb0d('0x81')](_0x46629f[_0xfb0d('0x58')])){return this[_0xfb0d('0xd')]['noop'](_0xfb0d('0xc6'));}var _0x559914='\x22'+_0x46629f[_0xfb0d('0x58')]+'\x22';if(this[_0xfb0d('0x81')](_0x46629f[_0xfb0d('0x75')])){_0x559914+=','+_0x46629f[_0xfb0d('0x75')];}var _0x3657a9=this['channel'][_0xfb0d('0xaa')](_0xfb0d('0xc7'),_0x559914);if(_0x3657a9[_0xfb0d('0xa2')]===-0x1){return _0x3657a9;}return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util['format'](_0xfb0d('0xc8'),_0x559914));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0xcb')]=function(_0x255d15){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0xcc'),_0x255d15[_0xfb0d('0x35')]));if(!this[_0xfb0d('0x81')](_0x255d15[_0xfb0d('0xae')])){return this['channel'][_0xfb0d('0xa9')](_0xfb0d('0xad'));}var _0x23f9bd=_0x255d15[_0xfb0d('0xae')];if(this[_0xfb0d('0x81')](_0x255d15['options'])){_0x23f9bd+=','+_0x255d15[_0xfb0d('0x75')];}var _0x55ffaa=this[_0xfb0d('0xd')]['exec']('MRCPRecog',_0x23f9bd);if(_0x55ffaa[_0xfb0d('0xa2')]===-0x1){return _0x55ffaa;}var _0x417532=this[_0xfb0d('0xa1')](_0xfb0d('0xaf'),_0xfb0d('0xcd'));if(_0x417532[_0xfb0d('0xa2')]===-0x1){return _0x417532;}var _0x3090d5=this[_0xfb0d('0xa1')](_0xfb0d('0xce'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x3090d5[_0xfb0d('0xa2')]===-0x1){return _0x3090d5;}var _0x520a9e=this['getAndSetVariable'](_0xfb0d('0xb1'),_0xfb0d('0xcf'));if(_0x520a9e[_0xfb0d('0xa2')]===-0x1){return _0x520a9e;}return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util['format'](_0xfb0d('0xd0'),_0x23f9bd));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0xd1')]=function(_0x38feb5){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x38feb5['label']));if(!this['isConfigured'](_0x38feb5['grammar'])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0xad'));}var _0x75bf2=_0x38feb5[_0xfb0d('0xae')];if(this[_0xfb0d('0x81')](_0x38feb5['options'])){_0x75bf2+=','+_0x38feb5[_0xfb0d('0x75')];}var _0x5892bc=this[_0xfb0d('0xd')][_0xfb0d('0xaa')]('MRCPRecog',_0x75bf2);if(_0x5892bc[_0xfb0d('0xa2')]===-0x1){return _0x5892bc;}var _0x542c23=this[_0xfb0d('0xa1')]('RECOG_CONFIDENCE()',_0xfb0d('0xd2'));if(_0x542c23[_0xfb0d('0xa2')]===-0x1){return _0x542c23;}var _0x3e5eaf=this[_0xfb0d('0xa1')]('RECOG_INPUT()',_0xfb0d('0xd3'));if(_0x3e5eaf['result']===-0x1){return _0x3e5eaf;}var _0xee8366=this[_0xfb0d('0xa1')](_0xfb0d('0xb1'),'SESTEK_ASR_INSTANCE');if(_0xee8366[_0xfb0d('0xa2')]===-0x1){return _0xee8366;}return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0xd0'),_0x75bf2));};AGIVertices['prototype'][_0xfb0d('0xd4')]=function(_0x11f1d8){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x11f1d8['label']));if(!this[_0xfb0d('0x81')](_0x11f1d8['odbc_id'])){return this[_0xfb0d('0xd')]['error'](_0x11f1d8,_0xfb0d('0xd5'));}var _0x31196a=this['getSquareOdbc'][_0xfb0d('0xa5')](this,_0x11f1d8[_0xfb0d('0xd6')]);if(!_0x31196a){return this[_0xfb0d('0xd')]['error'](_0x11f1d8,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x11f1d8[_0xfb0d('0x2b')])){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x11f1d8,'no\x20query\x20configured');}var _0x30efb4=_0x11f1d8[_0xfb0d('0x2b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0xd7'),_0x30efb4));var _0x3ef805=this[_0xfb0d('0x27')][_0xfb0d('0xa5')](this,_0x31196a,_0x30efb4);this['createSquareDetailsReport'][_0xfb0d('0xa5')](this,_0x11f1d8,_0x30efb4);if(!this['isConfigured'](_0x11f1d8['variable_id'])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0xd8'));}var _0x429444=this['getVariable']['sync'](this,_0x11f1d8[_0xfb0d('0xd9')]);if(!_0x429444){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x11f1d8,_0xfb0d('0xda'));}var _0x23a85e=this;_0x3ef805[_0xfb0d('0xdb')](function(_0x19666b,_0x36c958){Object[_0xfb0d('0xdc')](_0x19666b)[_0xfb0d('0xdb')](function(_0x14538f){_0x23a85e[_0xfb0d('0xd')]['setVariable'](util['format']('%s[%s][%s]',_0x429444,_0x36c958,_0x14538f),_0x19666b[_0x14538f]);});});this[_0xfb0d('0xd')][_0xfb0d('0x9b')](util[_0xfb0d('0x52')]('%s_ROWS_COUNT',_0x429444),_0x3ef805[_0xfb0d('0x9e')]);return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0xdd'),_0x429444));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0xde')]=function(_0x5f3598){logger['debug'](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x5f3598[_0xfb0d('0x35')]));if(!this['isConfigured'](_0x5f3598[_0xfb0d('0xdf')])){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x5f3598,'no\x20user\x20selected');}var _0x554321=this[_0xfb0d('0x1b')][_0xfb0d('0xa5')](this,_0x5f3598['sip_id']);if(!_0x554321){return this[_0xfb0d('0xd')]['error'](_0x5f3598,_0xfb0d('0xe0'));}var _0x42c5be=this[_0xfb0d('0xd')][_0xfb0d('0xaa')](_0xfb0d('0xe1'),[util['format'](_0xfb0d('0xe2'),_0x554321),_0x5f3598[_0xfb0d('0x61')],_0x5f3598[_0xfb0d('0xe3')],_0x5f3598[_0xfb0d('0x5f')]]);if(_0x42c5be['result']===-0x1){return _0x42c5be;}return this['channel'][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0xe4'),_0xfb0d('0xe1')));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0xe5')]=function(_0x22999a){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x22999a[_0xfb0d('0x35')]));if(!this[_0xfb0d('0x81')](_0x22999a[_0xfb0d('0x7f')])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0xe6'));}if(!this[_0xfb0d('0x81')](_0x22999a[_0xfb0d('0x58')])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0xc6'));}this[_0xfb0d('0xd')][_0xfb0d('0xe7')]=!![];this[_0xfb0d('0x33')](_0x22999a);this['createSquareMessage'](_0x22999a[_0xfb0d('0x58')],'in','','');this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')]('Trying\x20Dialogflow:\x20%s',_0x22999a[_0xfb0d('0x58')]));var _0x1ff34e=this['googleDialogflow'][_0xfb0d('0xa5')](this,_0x22999a);if(_0x1ff34e){for(var _0x4f62a3 in _0x1ff34e){if(_0x1ff34e['hasOwnProperty'](_0x4f62a3)){this[_0xfb0d('0xd')][_0xfb0d('0x9b')](util[_0xfb0d('0x52')]('DIALOGFLOW_%s',_0x4f62a3[_0xfb0d('0x66')]()),_0x1ff34e[_0x4f62a3]);}}this['createSquareMessage'](_0x1ff34e['speech'],_0xfb0d('0xe8'),'dialogflow','');return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0xe9'),_0x1ff34e[_0xfb0d('0xea')]));}return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x22999a,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0xfb0d('0xeb')]=function(_0x481ffc){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0xec'),_0x481ffc['label']));if(!this[_0xfb0d('0x81')](_0x481ffc[_0xfb0d('0x79')])){return this['channel']['noop'](_0xfb0d('0xed'));}if(!this['isConfigured'](_0x481ffc['client_email'])){return this[_0xfb0d('0xd')]['noop'](_0xfb0d('0xee'));}if(!this['isConfigured'](_0x481ffc[_0xfb0d('0xef')])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')]('no\x20private_key\x20configured');}if(!this[_0xfb0d('0x81')](_0x481ffc[_0xfb0d('0x7a')])){return this['channel'][_0xfb0d('0xa9')]('no\x20anguage\x20configured');}if(!this[_0xfb0d('0x81')](_0x481ffc[_0xfb0d('0x58')])){return this['channel'][_0xfb0d('0xa9')](_0xfb0d('0xc6'));}this[_0xfb0d('0xd')][_0xfb0d('0xe7')]=!![];this[_0xfb0d('0x33')](_0x481ffc);this[_0xfb0d('0x3e')](_0x481ffc[_0xfb0d('0x58')],'in','','');this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0xf0'),_0x481ffc['text']));var _0x55cc3f=this[_0xfb0d('0x78')]['sync'](this,_0x481ffc);if(_0x55cc3f){for(var _0x56e83c in _0x55cc3f){if(_0x55cc3f[_0xfb0d('0x93')](_0x56e83c)){if(_0x56e83c!==_0xfb0d('0xf1')){this[_0xfb0d('0xd')]['setVariable'](util['format'](_0xfb0d('0xf2'),_0x56e83c[_0xfb0d('0x66')]()),_0x55cc3f[_0x56e83c]);}}}this[_0xfb0d('0x3e')](_0x55cc3f[_0xfb0d('0xea')],_0xfb0d('0xe8'),_0xfb0d('0xeb'),_0x55cc3f[_0xfb0d('0xf1')]);return this[_0xfb0d('0xd')]['noop'](util['format'](_0xfb0d('0xf3'),_0x55cc3f[_0xfb0d('0xea')]));}return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x481ffc,_0xfb0d('0xf4'));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0xf5')]=function(_0x565897){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0xf6'),_0x565897[_0xfb0d('0x35')]));if(!this[_0xfb0d('0x81')](_0x565897[_0xfb0d('0xf7')])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xfb0d('0x81')](_0x565897[_0xfb0d('0xf8')])){return this['channel'][_0xfb0d('0xa9')](_0xfb0d('0xf9'));}if(!this[_0xfb0d('0x81')](_0x565897[_0xfb0d('0xfa')])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0xfb'));}if(!this[_0xfb0d('0x81')](_0x565897[_0xfb0d('0xfc')])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0xc6'));}this['channel'][_0xfb0d('0xe7')]=!![];this['createSquareDetailsReport'](_0x565897);this[_0xfb0d('0x3e')](_0x565897[_0xfb0d('0x58')],'in','','');this['channel'][_0xfb0d('0xa9')](util['format'](_0xfb0d('0xfd'),_0x565897[_0xfb0d('0x58')]));var _0x2ed0fd=this[_0xfb0d('0xfe')][_0xfb0d('0xa5')](this,_0x565897);if(_0x2ed0fd){for(var _0x302dbd in _0x2ed0fd){if(_0x2ed0fd['hasOwnProperty'](_0x302dbd)){this[_0xfb0d('0xd')][_0xfb0d('0x9b')](util[_0xfb0d('0x52')](_0xfb0d('0xff'),_0x302dbd[_0xfb0d('0x66')]()),_0x2ed0fd[_0x302dbd]);}}this['createSquareMessage'](_0x2ed0fd[_0xfb0d('0xea')],_0xfb0d('0xe8'),_0xfb0d('0xf5'),'');if(_0x2ed0fd[_0xfb0d('0x100')]){this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0x101'),_0x2ed0fd[_0xfb0d('0x100')]));var _0x4b6ef1=this[_0xfb0d('0xd')][_0xfb0d('0x102')](_0x2ed0fd[_0xfb0d('0x100')]);try{fs[_0xfb0d('0x103')](_0x2ed0fd[_0xfb0d('0x100')]+_0xfb0d('0x104'));}catch(_0x246278){logger[_0xfb0d('0x29')](_0x246278);}return _0x4b6ef1;}else{return this[_0xfb0d('0xd')]['noop'](util[_0xfb0d('0x52')](_0xfb0d('0x105'),_0x2ed0fd[_0xfb0d('0xea')]));}}return this['channel'][_0xfb0d('0x29')](_0x565897,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x106')]=function(_0x8c7c4a){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x107'),_0x8c7c4a[_0xfb0d('0x35')]));return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0x106'));};AGIVertices['prototype']['ext_dial']=function(_0x10c66a){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x108'),_0x10c66a[_0xfb0d('0x35')]));var _0x23666f='';if(_0x10c66a[_0xfb0d('0x109')]){if(!this[_0xfb0d('0x81')](_0x10c66a[_0xfb0d('0x109')])){return this[_0xfb0d('0xd')]['error'](_0x10c66a,'no\x20trunk\x20selected');}else{var _0x3c5a2f=parseInt(_0x10c66a[_0xfb0d('0x109')],0xa);if(isNaN(_0x3c5a2f)){_0x23666f=_0x10c66a[_0xfb0d('0x109')];}else{_0x23666f=this['getTrunk'][_0xfb0d('0xa5')](this,_0x10c66a[_0xfb0d('0x109')]);if(!_0x23666f){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x10c66a,_0xfb0d('0x10a'));}}}}else if(_0x10c66a['trunk_name']){_0x23666f=_0x10c66a['trunk_name'];}else{return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x10c66a,'no\x20trunk\x20selected');}var _0x1d7a0d=this['channel'][_0xfb0d('0xaa')](_0xfb0d('0xe1'),[util[_0xfb0d('0x52')]('SIP/%s/%s',_0x23666f,_0x10c66a[_0xfb0d('0xbf')]),_0x10c66a[_0xfb0d('0x61')],_0x10c66a[_0xfb0d('0xe3')],_0x10c66a['url']]);if(_0x1d7a0d[_0xfb0d('0xa2')]===-0x1){return _0x1d7a0d;}return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0xe4'),_0xfb0d('0xe1')));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x10b')]=function(_0x189593){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x189593[_0xfb0d('0x35')]));return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0x10b'));};AGIVertices[_0xfb0d('0x10')]['getdigits']=function(_0x43b785){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x10c'),_0x43b785[_0xfb0d('0x35')]));if(_0x43b785[_0xfb0d('0xa6')]===0x0){return this[_0xfb0d('0xa4')](_0x43b785);}_0x43b785[_0xfb0d('0xa6')]-=0x1;if(!this[_0xfb0d('0x81')](_0x43b785['file_id'])){return this[_0xfb0d('0xd')]['error'](_0x43b785,_0xfb0d('0x10d'));}var _0x1ba89e=this[_0xfb0d('0x1d')][_0xfb0d('0xa5')](this,_0x43b785['file_id']);if(!_0x1ba89e){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x43b785,'no\x20file\x20audio\x20found');}if(!this[_0xfb0d('0x81')](_0x43b785[_0xfb0d('0xd9')])){return this[_0xfb0d('0xd')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x52f597=this[_0xfb0d('0xd')][_0xfb0d('0x10e')](_0x1ba89e,_0x43b785[_0xfb0d('0x10f')],_0x43b785[_0xfb0d('0x110')]);var _0x283ebd=_0x52f597['result']?_0x52f597['result'][_0xfb0d('0x49')]():'';logger['info']('test',JSON[_0xfb0d('0x6f')](_0x52f597));if(_0x52f597[_0xfb0d('0xa2')]===-0x1){this[_0xfb0d('0x33')]['sync'](this,_0x43b785,_0x283ebd);return _0x52f597;}else if(_0x52f597[_0xfb0d('0xa0')]==='timeout'){_0x52f597[_0xfb0d('0xa2')]=_0x283ebd[_0xfb0d('0x9e')]>=parseInt(_0x43b785[_0xfb0d('0x111')])?'x':'i';}else{_0x52f597[_0xfb0d('0xa2')]=_0x283ebd['length']>=parseInt(_0x43b785[_0xfb0d('0x111')])&&_0x283ebd[_0xfb0d('0x9e')]<=parseInt(_0x43b785[_0xfb0d('0x110')])?'x':'i';}var _0xba3e91=this[_0xfb0d('0x11')][_0xfb0d('0xa5')](this,_0x43b785[_0xfb0d('0xd9')]);if(!_0xba3e91){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x43b785,_0xfb0d('0xda'));}this['channel']['setVariable'](_0xba3e91,_0x283ebd);if(this[_0xfb0d('0x81')](_0x43b785[_0xfb0d('0x112')])){var _0x6bfa82=parseInt(_0x43b785[_0xfb0d('0x112')],0xa);var _0x42b956=rs[_0xfb0d('0x113')]({'charset':'*','length':_0x6bfa82});var _0x3dda0f=_0x283ebd['length'];if(_0x3dda0f>0x0){if(_0x3dda0f>_0x6bfa82){this[_0xfb0d('0x33')][_0xfb0d('0xa5')](this,_0x43b785,_0x43b785['hiddendigitspos']===_0xfb0d('0x114')?_0x42b956+_0x283ebd['substr'](_0x6bfa82):_0x283ebd[_0xfb0d('0x115')](0x0,_0x3dda0f-_0x6bfa82)+_0x42b956);}else{this['createSquareDetailsReport']['sync'](this,_0x43b785,rs['generate']({'charset':'*','length':_0x3dda0f}));}}else{this[_0xfb0d('0x33')][_0xfb0d('0xa5')](this,_0x43b785,'');}}else{this[_0xfb0d('0x33')]['sync'](this,_0x43b785,_0x283ebd);}return _0x52f597;};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x116')]=function(_0x424a0f){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x117'),_0x424a0f[_0xfb0d('0x35')]));return this['getdigits'](_0x424a0f);};AGIVertices['prototype'][_0xfb0d('0x118')]=function(_0xd637be){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x119'),_0xd637be[_0xfb0d('0x35')]));this[_0xfb0d('0x33')]['sync'](this,_0xd637be,_0xd637be[_0xfb0d('0x11a')]);return this[_0xfb0d('0xd')]['noop'](util[_0xfb0d('0x52')](_0xfb0d('0x11b'),_0xd637be[_0xfb0d('0x11a')]));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x11c')]=function(_0x552c17){logger['info'](util[_0xfb0d('0x52')](_0xfb0d('0x11d'),_0x552c17[_0xfb0d('0x35')]));if(!this[_0xfb0d('0x81')](_0x552c17['aws_access_key_id'])||!this[_0xfb0d('0x81')](_0x552c17[_0xfb0d('0x84')])){return this[_0xfb0d('0xd')]['noop'](_0xfb0d('0x11e'));}if(!this['isConfigured'](_0x552c17['text'])){return this[_0xfb0d('0xd')]['noop'](_0xfb0d('0xc6'));}this[_0xfb0d('0xd')]['noop'](util['format'](_0xfb0d('0x11f'),_0x552c17['text']));var _0xe0774d=this[_0xfb0d('0x83')][_0xfb0d('0xa5')](this,_0x552c17);if(_0xe0774d){this['channel'][_0xfb0d('0xa9')](util[_0xfb0d('0x52')]('aws\x20Polly\x20%s\x20file\x20created',_0xe0774d));var _0x1262ed=this['channel']['streamFile'](_0xe0774d);try{fs['unlink'](_0xe0774d+_0xfb0d('0x104'));}catch(_0x1736c4){logger[_0xfb0d('0x29')](_0x1736c4);}return _0x1262ed;}return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x552c17,_0xfb0d('0x120'));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x121')]=function(_0x54e30b){logger['info'](util[_0xfb0d('0x52')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x54e30b['label']));if(!this[_0xfb0d('0x81')](_0x54e30b[_0xfb0d('0x122')])||!this[_0xfb0d('0x81')](_0x54e30b[_0xfb0d('0x84')])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0x11e'));}if(!this[_0xfb0d('0x81')](_0x54e30b['aws_bot_name'])){return this[_0xfb0d('0xd')]['noop'](_0xfb0d('0x123'));}if(!this['isConfigured'](_0x54e30b[_0xfb0d('0x58')])){return this['channel'][_0xfb0d('0xa9')](_0xfb0d('0xc6'));}this['channel'][_0xfb0d('0xe7')]=!![];this[_0xfb0d('0x33')](_0x54e30b);this[_0xfb0d('0x3e')](_0x54e30b[_0xfb0d('0x58')],'in','','');this['channel']['noop'](util[_0xfb0d('0x52')]('Trying\x20Amazon\x20Lex:\x20%s',_0x54e30b[_0xfb0d('0x58')]));var _0x4a71e0=this[_0xfb0d('0x89')]['sync'](this,_0x54e30b);if(_0x4a71e0){for(var _0x23d43a in _0x4a71e0){if(_0x4a71e0['hasOwnProperty'](_0x23d43a)&&_[_0xfb0d('0x94')](_0x4a71e0[_0x23d43a])){this[_0xfb0d('0xd')][_0xfb0d('0x9b')](util[_0xfb0d('0x52')]('AWS_LEX_%s',_0x23d43a[_0xfb0d('0x66')]()),_0x4a71e0[_0x23d43a]);}}if(_[_0xfb0d('0x41')](_0x4a71e0['message'])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0x124'));}else{this[_0xfb0d('0x3e')](_0x4a71e0[_0xfb0d('0x73')],_0xfb0d('0xe8'),'amazonlex','');return this[_0xfb0d('0xd')]['noop'](util[_0xfb0d('0x52')](_0xfb0d('0x125'),_0x4a71e0[_0xfb0d('0x73')]));}}return this['channel']['error'](_0x54e30b,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xfb0d('0x10')]['googleasr']=function(_0x40d610){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x126'),_0x40d610['label'],_0x40d610[_0xfb0d('0x61')]));if(!this[_0xfb0d('0x81')](_0x40d610['key'])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0xe6'));}var _0x4f1880=_0xfb0d('0x127');var _0x3215e7=util['format'](_0xfb0d('0x128'),FILES_PATH,rs[_0xfb0d('0x113')](0x4));var _0x5cf2dd=util[_0xfb0d('0x52')](_0xfb0d('0x9a'),_0x3215e7,_0x4f1880);var _0x38626c=!![];if(_0x40d610[_0xfb0d('0x129')]===_0xfb0d('0x12a')){_0x38626c=![];}var _0x8cd0e7=this[_0xfb0d('0xd')][_0xfb0d('0x12b')](_0x3215e7,_0x4f1880,_0x40d610[_0xfb0d('0x12c')],_0x40d610[_0xfb0d('0x61')],undefined,_0x38626c);if(_0x8cd0e7[_0xfb0d('0xa2')]!==-0x1){this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0x12d'),_0x5cf2dd));var _0x4bc8d8=this[_0xfb0d('0x8c')][_0xfb0d('0xa5')](this,_0x40d610,_0x5cf2dd);if(_0x4bc8d8){for(var _0x4d1e75 in _0x4bc8d8){if(_0x4bc8d8[_0xfb0d('0x93')](_0x4d1e75)){this[_0xfb0d('0xd')][_0xfb0d('0x9b')](util[_0xfb0d('0x52')](_0xfb0d('0x12e'),_0x4d1e75[_0xfb0d('0x66')]()),_0x4bc8d8[_0x4d1e75]);}}return this[_0xfb0d('0xd')]['noop'](util[_0xfb0d('0x52')](_0xfb0d('0x12f'),JSON[_0xfb0d('0x6f')](_0x4bc8d8)));}}return _0x8cd0e7;};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x130')]=function(_0x2a44de){logger['info'](util[_0xfb0d('0x52')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x2a44de[_0xfb0d('0x35')]));if(!this[_0xfb0d('0x81')](_0x2a44de['appid'])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0x131'));}if(!this[_0xfb0d('0x81')](_0x2a44de['appsecret'])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0x132'));}var _0x4ad695=_0xfb0d('0x127');var _0x5e4ec8=util[_0xfb0d('0x52')]('%s/recordings/%s',FILES_PATH,rs[_0xfb0d('0x113')](0x4));var _0x34b790=util[_0xfb0d('0x52')]('%s.%s',_0x5e4ec8,_0x4ad695);var _0x2e0994=!![];if(_0x2a44de[_0xfb0d('0x129')]===_0xfb0d('0x12a')){_0x2e0994=![];}var _0x36f079=this[_0xfb0d('0xd')]['recordFile'](_0x5e4ec8,_0x4ad695,_0x2a44de[_0xfb0d('0x12c')],_0x2a44de[_0xfb0d('0x61')],undefined,_0x2e0994);if(_0x36f079[_0xfb0d('0xa2')]!==-0x1){this['channel'][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0x133'),_0x34b790));var _0x47eafb=this[_0xfb0d('0x8e')][_0xfb0d('0xa5')](this,_0x2a44de,_0x34b790);if(_0x47eafb){for(var _0x4f5044 in _0x47eafb){if(_0x47eafb['hasOwnProperty'](_0x4f5044)){this['channel'][_0xfb0d('0x9b')](util[_0xfb0d('0x52')]('TILDE_ASR_%s',_0x4f5044[_0xfb0d('0x66')]()),_0x47eafb[_0x4f5044]);}}return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')]('TildeASR\x20Result\x20%s',JSON[_0xfb0d('0x6f')](_0x47eafb)));}}return _0x36f079;};AGIVertices['prototype'][_0xfb0d('0x134')]=function(_0x131dea){logger[_0xfb0d('0x2c')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x131dea[_0xfb0d('0x35')]));return this[_0xfb0d('0xd')][_0xfb0d('0x135')](_0x131dea[_0xfb0d('0x3a')],_0x131dea[_0xfb0d('0x3b')],_0x131dea[_0xfb0d('0x136')]);};AGIVertices[_0xfb0d('0x10')]['gotoif']=function(_0x439c29){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x137'),_0x439c29[_0xfb0d('0x35')]));if(!this[_0xfb0d('0x81')](_0x439c29[_0xfb0d('0x138')])){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x439c29,_0xfb0d('0x139'));}try{var _0x307c86=eval(_0x439c29[_0xfb0d('0x138')])?_0xfb0d('0x13a'):_0xfb0d('0x13b');this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0x13c'),_0x439c29[_0xfb0d('0x138')],_0x307c86));return{'code':0xc8,'result':_0x307c86};}catch(_0xcae73e){return{'code':0xc8,'result':_0xfb0d('0x13b')};}};AGIVertices['prototype'][_0xfb0d('0x13d')]=function(_0x146d66){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x13e'),_0x146d66[_0xfb0d('0x35')]));if(!this[_0xfb0d('0x81')](_0x146d66[_0xfb0d('0x13f')])){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x146d66,'no\x20interval\x20configured');}var _0x1ac126=this[_0xfb0d('0x22')]['sync'](this,_0x146d66[_0xfb0d('0x13f')]);if(!_0x1ac126){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x146d66,_0xfb0d('0x140'));}for(var _0x419843=0x0;_0x419843<_0x1ac126[_0xfb0d('0x9e')];_0x419843+=0x1){var _0x290d39=this['channel']['getVariable'](util[_0xfb0d('0x52')](_0xfb0d('0x141'),_0x1ac126[_0x419843]));if(_0x290d39[_0xfb0d('0xa2')]===-0x1){return _0x290d39;}logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x142'),_0x1ac126[_0x419843],_0x290d39[_0xfb0d('0xa0')]));if(_0x290d39[_0xfb0d('0xa0')]===_0xfb0d('0x13a')){logger[_0xfb0d('0x2c')](util['format'](_0xfb0d('0x142'),_0x1ac126[_0x419843],_0xfb0d('0x13a')));this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0x142'),_0x1ac126[_0x419843],_0xfb0d('0x13a')));return{'code':0xc8,'result':_0xfb0d('0x13a')};}else{logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')]('IFTIME\x20%s\x20%s',_0x1ac126[_0x419843],_0xfb0d('0x13b')));this['channel'][_0xfb0d('0xa9')](util['format'](_0xfb0d('0x142'),_0x1ac126[_0x419843],_0xfb0d('0x13b')));}}return{'code':0xc8,'result':_0xfb0d('0x13b')};};AGIVertices[_0xfb0d('0x10')]['hangup']=function(_0x31d6fa){logger[_0xfb0d('0x2c')](util['format'](_0xfb0d('0x143'),_0x31d6fa[_0xfb0d('0x35')]));return this['channel']['hangup']();};AGIVertices['prototype'][_0xfb0d('0x144')]=function(_0x3955a0){logger['info'](util[_0xfb0d('0x52')](_0xfb0d('0x145'),_0x3955a0['label']));if(!this[_0xfb0d('0x81')](_0x3955a0['key'])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0xe6'));}var _0x1109fd='wav';var _0x199a11=util['format'](_0xfb0d('0x128'),FILES_PATH,rs[_0xfb0d('0x113')](0x4));var _0x26f250=util[_0xfb0d('0x52')](_0xfb0d('0x9a'),_0x199a11,_0x1109fd);var _0x155249=!![];if(_0x3955a0[_0xfb0d('0x129')]===_0xfb0d('0x12a')){_0x155249=![];}var _0x2b6f6b=this[_0xfb0d('0xd')][_0xfb0d('0x12b')](_0x199a11,_0x1109fd,_0x3955a0['intKey'],_0x3955a0[_0xfb0d('0x61')],undefined,_0x155249);if(_0x2b6f6b[_0xfb0d('0xa2')]!==-0x1){this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')]('ispeech\x20%s\x20file\x20created',_0x26f250));var _0x58c46d=this[_0xfb0d('0x7e')][_0xfb0d('0xa5')](this,_0x3955a0,_0x26f250);if(_0x58c46d){for(var _0x1355ba in _0x58c46d){if(_0x58c46d['hasOwnProperty'](_0x1355ba)){this[_0xfb0d('0xd')][_0xfb0d('0x9b')](util[_0xfb0d('0x52')]('ISPEECH_ASR_%s',_0x1355ba[_0xfb0d('0x66')]()),_0x58c46d[_0x1355ba]);}}return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0x146'),JSON[_0xfb0d('0x6f')](_0x58c46d)));}}return _0x2b6f6b;};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x147')]=function(_0x78f4ca){logger[_0xfb0d('0x2c')](util['format'](_0xfb0d('0x148'),_0x78f4ca['label']));if(!this[_0xfb0d('0x81')](_0x78f4ca[_0xfb0d('0x7f')])){return this['channel'][_0xfb0d('0xa9')](_0xfb0d('0xe6'));}if(!this[_0xfb0d('0x81')](_0x78f4ca[_0xfb0d('0x58')])){return this['channel']['noop'](_0xfb0d('0xc6'));}this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0x149'),_0x78f4ca['text']));var _0x50a698=this['ispeechTTS']['sync'](this,_0x78f4ca);if(_0x50a698){this[_0xfb0d('0xd')]['noop'](util[_0xfb0d('0x52')](_0xfb0d('0x14a'),_0x50a698));var _0x567c5a=this['channel'][_0xfb0d('0x102')](_0x50a698,_0x78f4ca[_0xfb0d('0x12c')]);try{fs[_0xfb0d('0x103')](_0x50a698+'.wav');}catch(_0xd73e7c){logger[_0xfb0d('0x29')](_0xd73e7c);}return _0x567c5a;}return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x78f4ca,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xfb0d('0x10')]['login']=function(_0x2e9e9e){logger['info'](util['format'](_0xfb0d('0x14b'),_0x2e9e9e[_0xfb0d('0x35')]));if(!this[_0xfb0d('0x81')](_0x2e9e9e['findBy'])){return this['channel'][_0xfb0d('0x29')](_0x2e9e9e,'no\x20find\x20by\x20configured');}logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x14c'),this[_0xfb0d('0xd')]['callerid'],_0x2e9e9e['findBy']));var _0x1b8520=this[_0xfb0d('0x50')]['sync'](this,_0x2e9e9e['findBy']);if(_0x1b8520){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xfb0d('0xd')]['callerid'],_0x2e9e9e[_0xfb0d('0x14d')]));this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0x14e'),this[_0xfb0d('0xd')]['callerid'],_0x2e9e9e[_0xfb0d('0x14d')]));return{'code':0xc8,'result':_0xfb0d('0x14f')};}else{logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xfb0d('0x37')],_0x2e9e9e['findBy']));this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0x150'),this[_0xfb0d('0xd')][_0xfb0d('0x37')],_0x2e9e9e[_0xfb0d('0x14d')]));return{'code':0xc8,'result':_0xfb0d('0x151')};}};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x152')]=function(_0x243017){logger['info'](util[_0xfb0d('0x52')](_0xfb0d('0x153'),_0x243017[_0xfb0d('0x35')]));if(!this[_0xfb0d('0x81')](_0x243017[_0xfb0d('0x14d')])){return this['channel'][_0xfb0d('0x29')](_0x243017,_0xfb0d('0x154'));}logger['info'](util[_0xfb0d('0x52')](_0xfb0d('0x14c'),this['channel'][_0xfb0d('0x37')],_0x243017['findBy']));var _0x412927=this[_0xfb0d('0x4f')][_0xfb0d('0xa5')](this,_0x243017[_0xfb0d('0x14d')]);if(_0x412927){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xfb0d('0xd')][_0xfb0d('0x37')],_0x243017[_0xfb0d('0x14d')]));this['channel'][_0xfb0d('0xa9')](util[_0xfb0d('0x52')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xfb0d('0x37')],_0x243017['findBy']));return{'code':0xc8,'result':_0xfb0d('0x14f')};}else{logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xfb0d('0x37')],_0x243017[_0xfb0d('0x14d')]));this[_0xfb0d('0xd')]['noop'](util['format'](_0xfb0d('0x150'),this[_0xfb0d('0xd')]['callerid'],_0x243017['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x155')]=function(_0x58379e){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x156'),_0x58379e[_0xfb0d('0x35')]));if(!this['isConfigured'](_0x58379e[_0xfb0d('0x157')])){return this['channel'][_0xfb0d('0x29')](_0x58379e,_0xfb0d('0x158'));}this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util['format']('math\x20%s',_0x58379e[_0xfb0d('0x157')]));var _0x14e4ce=eval(_0x58379e['operation']);if(!this['isConfigured'](_0x58379e['variable_id'])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4e0bb3=this[_0xfb0d('0x11')][_0xfb0d('0xa5')](this,_0x58379e[_0xfb0d('0xd9')]);if(!_0x4e0bb3){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x58379e,_0xfb0d('0xda'));}if(_[_0xfb0d('0x97')](_0x14e4ce)){var _0x460968=this;_0x14e4ce[_0xfb0d('0xdb')](function(_0x5b1408,_0x58e561){_0x460968[_0xfb0d('0xd')][_0xfb0d('0x9b')](util[_0xfb0d('0x52')](_0xfb0d('0x159'),_0x4e0bb3,_0x58e561),_0x5b1408);});return this[_0xfb0d('0xd')]['noop'](util[_0xfb0d('0x52')](_0xfb0d('0x15a'),_0x4e0bb3));}else{return this['channel'][_0xfb0d('0x9b')](_0x4e0bb3,_0x14e4ce);}};AGIVertices[_0xfb0d('0x10')]['menu']=function(_0xedec25){logger[_0xfb0d('0x2c')](util['format'](_0xfb0d('0x15b'),_0xedec25[_0xfb0d('0x35')]));if(_0xedec25[_0xfb0d('0xa6')]===0x0){return this['maxRetry'](_0xedec25);}_0xedec25['retry']-=0x1;if(!this[_0xfb0d('0x81')](_0xedec25[_0xfb0d('0x15c')])){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0xedec25,_0xfb0d('0x10d'));}var _0x40a5ac=this['getSound'][_0xfb0d('0xa5')](this,_0xedec25['file_id']);if(!_0x40a5ac){return this['channel']['error'](_0xedec25,_0xfb0d('0x15d'));}var _0x15494a=this[_0xfb0d('0xd')]['getData'](_0x40a5ac,_0xedec25[_0xfb0d('0x10f')],_0xedec25[_0xfb0d('0x15e')]);var _0x290803=_0x15494a[_0xfb0d('0xa2')];if(_0x15494a[_0xfb0d('0xa2')]===-0x1){this[_0xfb0d('0x33')][_0xfb0d('0xa5')](this,_0xedec25,'-1');return _0x15494a;}else if(_0x15494a[_0xfb0d('0xa0')]===_0xfb0d('0x61')){_0x15494a['result']=_0x15494a[_0xfb0d('0xa2')][_0xfb0d('0x9e')]>0x0?_0x15494a[_0xfb0d('0xa2')]:'t';}else if(_['isEmpty'](_0x15494a[_0xfb0d('0xa2')])){_0x15494a[_0xfb0d('0xa2')]='#';_0x290803='#';}if(!this[_0xfb0d('0x81')](_0xedec25['variable_id'])){this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0xd8'));}else{var _0x4e0696=this['getVariable']['sync'](this,_0xedec25[_0xfb0d('0xd9')]);if(!_0x4e0696){return this[_0xfb0d('0xd')]['error'](_0xedec25,'no\x20variable\x20found');}this[_0xfb0d('0xd')]['setVariable'](_0x4e0696,_0x290803);}this[_0xfb0d('0x33')][_0xfb0d('0xa5')](this,_0xedec25,_0x290803);return _0x15494a;};AGIVertices['prototype'][_0xfb0d('0xa9')]=function(_0xb35c6){logger['info'](util[_0xfb0d('0x52')](_0xfb0d('0x15f'),_0xb35c6[_0xfb0d('0x35')]));return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xb35c6[_0xfb0d('0x160')]||_0xb35c6['label']);};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x161')]=function(_0x13736b){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x162'),_0x13736b[_0xfb0d('0x35')]));if(!this[_0xfb0d('0x81')](_0x13736b['findBy'])){return this['channel'][_0xfb0d('0x29')](_0x13736b,'no\x20find\x20by\x20configured');}logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xfb0d('0xd')][_0xfb0d('0x37')],_0x13736b['findBy']));var _0x5c3a52=this[_0xfb0d('0x4a')][_0xfb0d('0xa5')](this,_0x13736b[_0xfb0d('0x163')]);var _0x2ef079=this['agentPause'][_0xfb0d('0xa5')](this,_0x13736b['findBy'],_0x5c3a52);if(_0x2ef079){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x14e'),this[_0xfb0d('0xd')][_0xfb0d('0x37')],_0x13736b[_0xfb0d('0x14d')]));this['channel'][_0xfb0d('0xa9')](util['format'](_0xfb0d('0x14e'),this[_0xfb0d('0xd')][_0xfb0d('0x37')],_0x13736b['findBy']));return{'code':0xc8,'result':_0xfb0d('0x14f')};}else{logger['info'](util[_0xfb0d('0x52')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfb0d('0xd')][_0xfb0d('0x37')],_0x13736b[_0xfb0d('0x14d')]));this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util['format'](_0xfb0d('0x14e'),this[_0xfb0d('0xd')]['callerid'],_0x13736b[_0xfb0d('0x14d')]));return{'code':0xc8,'result':_0xfb0d('0x151')};}};AGIVertices['prototype'][_0xfb0d('0x164')]=function(_0x5da426){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x5da426[_0xfb0d('0x35')]));if(!this[_0xfb0d('0x81')](_0x5da426[_0xfb0d('0x15c')])){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x5da426,_0xfb0d('0x10d'));}var _0x588373=this[_0xfb0d('0x1d')][_0xfb0d('0xa5')](this,_0x5da426[_0xfb0d('0x15c')]);if(!_0x588373){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x5da426,'no\x20file\x20audio\x20found');}var _0x5aea31=this[_0xfb0d('0xd')]['exec']('PLAYBACK',[_0x588373,_0x5da426[_0xfb0d('0xe3')]]);if(_0x5aea31[_0xfb0d('0xa2')]===-0x1){return _0x5aea31;}return this[_0xfb0d('0xd')]['noop'](util[_0xfb0d('0x52')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x588373));};AGIVertices['prototype'][_0xfb0d('0x165')]=function(_0x53351c){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x166'),_0x53351c['label']));if(!this[_0xfb0d('0x81')](_0x53351c['queue_id'])){return this['channel']['error'](_0x53351c,_0xfb0d('0x167'));}var _0x173747='';var _0x287693=parseInt(_0x53351c[_0xfb0d('0x168')],0xa);if(isNaN(_0x287693)){_0x173747=_0x53351c[_0xfb0d('0x168')];}else{_0x173747=this[_0xfb0d('0x15')]['sync'](this,_0x53351c[_0xfb0d('0x168')]);if(!_0x173747){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x53351c,_0xfb0d('0x169'));}}var _0x2d457d='';if(this[_0xfb0d('0x81')](_0x53351c[_0xfb0d('0x15c')])){var _0x401da6=this[_0xfb0d('0x1d')]['sync'](this,_0x53351c[_0xfb0d('0x15c')]);if(_0x401da6){_0x2d457d=_0x401da6;}}this[_0xfb0d('0x33')][_0xfb0d('0xa5')](this,_0x53351c,_0x173747);if(_0x53351c['opts'][_0xfb0d('0x16a')]('x')<0x0){_0x53351c['opts']+='x';}if(_0x53351c[_0xfb0d('0xe3')][_0xfb0d('0x16a')]('X')<0x0){_0x53351c[_0xfb0d('0xe3')]+='X';}this['channel']['setVariable'](_0xfb0d('0x16b'),_0x173747?_0x173747[_0xfb0d('0x16c')]():'');var _0x21e2bb=this[_0xfb0d('0xd')][_0xfb0d('0xaa')]('QUEUE',[_0x173747,_0x53351c['opts'],_0x53351c[_0xfb0d('0x5f')],_0x2d457d,_0x53351c[_0xfb0d('0x61')],_0x53351c['agi'],_0x53351c[_0xfb0d('0x16d')],_0x53351c[_0xfb0d('0x16e')],'',_0x53351c[_0xfb0d('0x16f')]]);if(_0x21e2bb[_0xfb0d('0xa2')]===-0x1){return _0x21e2bb;}return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util['format']('Executed\x20command\x20%s\x20%s',_0xfb0d('0x170'),_0x173747));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x171')]=function(_0x23a715){logger[_0xfb0d('0x2c')](util['format'](_0xfb0d('0x172'),_0x23a715['label']));var _0x567c7b=_0x23a715['recordingFormat']||_0xfb0d('0x127');var _0x117723=util[_0xfb0d('0x52')]('%s_%s',this[_0xfb0d('0xd')][_0xfb0d('0x34')],rs[_0xfb0d('0x113')](0x5));var _0x3f60f8=util[_0xfb0d('0x52')](_0xfb0d('0x173'),FILES_PATH,_0x117723,_0x567c7b);var _0x34124e=util[_0xfb0d('0x52')](_0xfb0d('0x128'),FILES_PATH,_0x117723);this[_0xfb0d('0x38')][_0xfb0d('0xa5')](this,_0x23a715,_0x117723,_0x3f60f8);this[_0xfb0d('0xd')][_0xfb0d('0x9b')](_0xfb0d('0x174'),_0x117723);logger[_0xfb0d('0x2c')](_0xfb0d('0x175'),_0x34124e,_0x567c7b,_0x23a715[_0xfb0d('0x176')],_0x23a715['timeout']);return this[_0xfb0d('0xd')][_0xfb0d('0x12b')](_0x34124e,_0x567c7b,_0x23a715[_0xfb0d('0x176')],_0x23a715[_0xfb0d('0x61')],undefined,!![]);};AGIVertices[_0xfb0d('0x10')]['restapi']=function(_0x3eac4e){logger[_0xfb0d('0x2c')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x3eac4e[_0xfb0d('0x35')]));if(!this[_0xfb0d('0x81')](_0x3eac4e[_0xfb0d('0x5f')])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0x177'));}var _0xa23265=this['restAPI'][_0xfb0d('0xa5')](this,_0x3eac4e);logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')]('Response:',util[_0xfb0d('0x178')](_0xa23265,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3eac4e[_0xfb0d('0xd9')])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0x179'));}var _0x26dd15=this['getVariable'][_0xfb0d('0xa5')](this,_0x3eac4e['variable_id']);if(!_0x26dd15){return this[_0xfb0d('0xd')]['error'](_0x3eac4e,_0xfb0d('0xda'));}this[_0xfb0d('0xd')][_0xfb0d('0x9b')](util[_0xfb0d('0x52')]('%s_STATUS_CODE',_0x26dd15),_0xa23265[_0xfb0d('0x72')]?_0xa23265[_0xfb0d('0x72')]:'200');this['channel'][_0xfb0d('0x9b')](util[_0xfb0d('0x52')]('%s_STATUS_MESSAGE',_0x26dd15),_0xa23265[_0xfb0d('0x71')]?_0xa23265[_0xfb0d('0x71')]:'OK');if(_0xa23265['body']){try{this[_0xfb0d('0x98')](_0xa23265['body'],_0x26dd15);}catch(_0x2ddc64){logger[_0xfb0d('0x29')](util['format'](_0xfb0d('0x17a'),_0x26dd15));}}return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0xdd'),_0x26dd15));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x17b')]=function(_0x347049){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x17c'),_0x347049[_0xfb0d('0x35')]));return this[_0xfb0d('0xd')][_0xfb0d('0x17d')](_0x347049[_0xfb0d('0x17e')]['replace'](/\s+/g,''),_0x347049[_0xfb0d('0x176')]);};AGIVertices[_0xfb0d('0x10')]['saynumber']=function(_0xd12a83){logger[_0xfb0d('0x2c')](util['format'](_0xfb0d('0x17f'),_0xd12a83[_0xfb0d('0x35')]));return this[_0xfb0d('0xd')][_0xfb0d('0x180')](_0xd12a83[_0xfb0d('0x62')]['replace'](/\s+/g,''),_0xd12a83[_0xfb0d('0x176')]);};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x181')]=function(_0x20b6e4){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x182'),_0x20b6e4[_0xfb0d('0x35')]));return this[_0xfb0d('0xd')]['sayPhonetic'](_0x20b6e4[_0xfb0d('0x58')],_0x20b6e4[_0xfb0d('0x176')]);};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x183')]=function(_0x1d6987){logger['info'](util[_0xfb0d('0x52')](_0xfb0d('0x184'),_0x1d6987['label']));if(!this['isConfigured'](_0x1d6987[_0xfb0d('0x185')])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')]('no\x20mail\x20account\x20configured');}var _0x3ab4c9=this[_0xfb0d('0x186')][_0xfb0d('0xa5')](this,_0x1d6987[_0xfb0d('0x185')]);if(!_0x3ab4c9||!_0x3ab4c9['Smtp']){return this[_0xfb0d('0xd')]['error'](_0x1d6987,_0xfb0d('0x187'));}var _0x3fc064={'from':util[_0xfb0d('0x52')]('\x22%s\x22\x20<%s>',_0x3ab4c9[_0xfb0d('0x13')],_0x3ab4c9[_0xfb0d('0x188')]||_0x3ab4c9[_0xfb0d('0x189')][_0xfb0d('0x18a')]),'to':_0x1d6987['to']||'','cc':_0x1d6987['cc']||'','bcc':_0x1d6987[_0xfb0d('0x18b')]||'','subject':_0x1d6987[_0xfb0d('0x18c')],'html':_0x1d6987['text'],'text':_0x1d6987[_0xfb0d('0x58')]};var _0x23eb7f={'tls':{'rejectUnauthorized':![]}};if(_0x3ab4c9[_0xfb0d('0x189')][_0xfb0d('0x18d')]){_0x23eb7f[_0xfb0d('0x18d')]=_0x3ab4c9['Smtp'][_0xfb0d('0x18d')];}else{_0x23eb7f[_0xfb0d('0x18e')]=_0x3ab4c9[_0xfb0d('0x189')]['host'];_0x23eb7f[_0xfb0d('0x18f')]=_0x3ab4c9[_0xfb0d('0x189')][_0xfb0d('0x18f')];_0x23eb7f[_0xfb0d('0x190')]=_0x3ab4c9[_0xfb0d('0x189')][_0xfb0d('0x190')];}if(_0x3ab4c9['Smtp'][_0xfb0d('0x191')]){_0x23eb7f[_0xfb0d('0x192')]={'user':_0x3ab4c9[_0xfb0d('0x189')][_0xfb0d('0x18a')],'pass':_0x3ab4c9['Smtp'][_0xfb0d('0x193')]};}if(this[_0xfb0d('0x81')](_0x1d6987[_0xfb0d('0x194')])){}logger['debug']('sendMail\x20message',JSON[_0xfb0d('0x6f')](_0x3fc064));this['createSquareDetailsReport'][_0xfb0d('0xa5')](this,_0x1d6987,_0x1d6987['account_id']);this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0x195'),_0x3ab4c9[_0xfb0d('0x13')]));this[_0xfb0d('0x21')][_0xfb0d('0xa5')](this,_0x23eb7f,_0x3fc064);return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0x196'));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x197')]=function(_0x53b8bb){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x198'),_0x53b8bb[_0xfb0d('0x35')]));return this[_0xfb0d('0xd')]['noop'](_0xfb0d('0x199'));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x19a')]=function(_0x5f5839){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x19b'),_0x5f5839[_0xfb0d('0x35')]));if(!this[_0xfb0d('0x81')](_0x5f5839[_0xfb0d('0x19c')])){return this['channel'][_0xfb0d('0xa9')](_0xfb0d('0x19d'));}var _0x37d9f1=this[_0xfb0d('0x30')][_0xfb0d('0xa5')](this,_0x5f5839[_0xfb0d('0x19c')]);if(!_0x37d9f1){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x5f5839,'no\x20sms\x20account\x20found');}var _0x27f13e={'body':_0x5f5839['sms_text'],'phone':_0x5f5839['to']||'','SmsAccountId':_0x37d9f1['id']};logger[_0xfb0d('0x19e')](_0xfb0d('0x19f'),JSON[_0xfb0d('0x6f')](_0x27f13e));this[_0xfb0d('0x33')][_0xfb0d('0xa5')](this,_0x5f5839,_0x5f5839[_0xfb0d('0x19c')]);this['channel'][_0xfb0d('0xa9')](util['format'](_0xfb0d('0x1a0'),_0x37d9f1[_0xfb0d('0x13')]));this['createSmsMessage'][_0xfb0d('0xa5')](this,_0x27f13e);return this['channel'][_0xfb0d('0xa9')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xfb0d('0x10')]['set']=function(_0x53898b){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x1a1'),_0x53898b[_0xfb0d('0x35')]));if(!this[_0xfb0d('0x81')](_0x53898b[_0xfb0d('0xd9')])){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x53898b,_0xfb0d('0x1a2'));}var _0x56432b=this['getVariable'][_0xfb0d('0xa5')](this,_0x53898b[_0xfb0d('0xd9')]);if(!_0x56432b){return this[_0xfb0d('0xd')]['error'](_0x53898b,_0xfb0d('0xda'));}return this[_0xfb0d('0xd')][_0xfb0d('0x9b')](_0x56432b,_0x53898b[_0xfb0d('0x1a3')]);};AGIVertices['prototype'][_0xfb0d('0x1a4')]=function(_0x5287ac){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x1a5'),_0x5287ac['label']));this[_0xfb0d('0xd')][_0xfb0d('0xa9')]('START\x20CALLY\x20SQUARE');if(_0x5287ac[_0xfb0d('0xb5')]===_0xfb0d('0x1a6')){this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0x1a7'));return this['channel'][_0xfb0d('0xb5')]();}return this[_0xfb0d('0xd')]['noop'](_0xfb0d('0x1a8'));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x1a9')]=function(_0x2cfc62){logger['info'](util[_0xfb0d('0x52')](_0xfb0d('0x1aa'),_0x2cfc62[_0xfb0d('0x35')]));if(!this['isConfigured'](_0x2cfc62[_0xfb0d('0x1ab')])){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x2cfc62,_0xfb0d('0x1ac'));}var _0x2cbd72=this[_0xfb0d('0x1ad')][_0xfb0d('0xa5')](this,_0x2cfc62['project_id']);if(!this[_0xfb0d('0x81')](_0x2cbd72)){return this['channel'][_0xfb0d('0x29')](_0x2cfc62,util[_0xfb0d('0x52')](_0xfb0d('0x1ae'),_0x2cfc62[_0xfb0d('0x1ab')]));}if(_0x2cbd72===this[_0xfb0d('0xd')][_0xfb0d('0x3d')]){return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x2cfc62,_0xfb0d('0x1af'));}this[_0xfb0d('0x33')][_0xfb0d('0xa5')](this,_0x2cfc62,_0x2cbd72);var _0x52cf10=this[_0xfb0d('0xd')][_0xfb0d('0xaa')](_0xfb0d('0x1b0'),util[_0xfb0d('0x52')](_0xfb0d('0x1b1'),config['agi'][_0xfb0d('0x18e')]||_0xfb0d('0x1b2'),_0x2cbd72,this['channel'][_0xfb0d('0x3d')]));if(_0x52cf10[_0xfb0d('0xa2')]===-0x1){return _0x52cf10;}return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util['format']('Executed\x20command\x20%s\x20%s',_0xfb0d('0x1b0'),_0x2cbd72));};AGIVertices['prototype'][_0xfb0d('0x1b3')]=function(_0x237540){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x1b4'),_0x237540[_0xfb0d('0x35')]));var _0x2aeb93=this[_0xfb0d('0x54')][_0xfb0d('0xa5')](this,_0x237540['command']);this['createSquareDetailsReport'][_0xfb0d('0xa5')](this,_0x237540,_0x237540[_0xfb0d('0xb4')]);if(this[_0xfb0d('0x81')](_0x237540['variable_id'])){var _0x34bd9c=this[_0xfb0d('0x11')][_0xfb0d('0xa5')](this,_0x237540['variable_id']);if(_0x34bd9c){this[_0xfb0d('0xd')][_0xfb0d('0x9b')](_0x34bd9c,_0x2aeb93);return this['channel'][_0xfb0d('0xa9')](util['format'](_0xfb0d('0x1b5'),_0x237540['command'],_0x34bd9c));}}return this['channel'][_0xfb0d('0xa9')](util['format'](_0xfb0d('0x1b6'),_0x237540[_0xfb0d('0xb4')]));};AGIVertices['prototype'][_0xfb0d('0x1b7')]=function(_0x4c8e88){logger[_0xfb0d('0x2c')](util['format'](_0xfb0d('0x1b8'),_0x4c8e88[_0xfb0d('0x35')]));_0x4c8e88[_0xfb0d('0x58')]=_0x4c8e88[_0xfb0d('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xfb0d('0x81')](_0x4c8e88['apiKey'])){return this[_0xfb0d('0xd')][_0xfb0d('0xa9')](_0xfb0d('0x1b9'));}if(!this['isConfigured'](_0x4c8e88[_0xfb0d('0x58')])){return this[_0xfb0d('0xd')]['noop']('no\x20text\x20configured');}this[_0xfb0d('0xd')]['noop'](util[_0xfb0d('0x52')](_0xfb0d('0x1ba'),_0x4c8e88[_0xfb0d('0x58')]));var _0x336bf1=this[_0xfb0d('0x56')][_0xfb0d('0xa5')](this,_0x4c8e88);if(_0x336bf1){this[_0xfb0d('0xd')]['noop'](util[_0xfb0d('0x52')](_0xfb0d('0x1bb'),_0x336bf1));var _0xe33938=this[_0xfb0d('0xd')][_0xfb0d('0x102')](_0x336bf1);try{fs[_0xfb0d('0x103')](_0x336bf1+'.wav');}catch(_0x43ca9e){logger[_0xfb0d('0x29')](_0x43ca9e);}return _0xe33938;}return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x4c8e88,_0xfb0d('0x1bc'));};AGIVertices[_0xfb0d('0x10')]['tts']=function(_0x79c20d){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x1bd'),_0x79c20d[_0xfb0d('0x35')]));_0x79c20d[_0xfb0d('0x58')]=_0x79c20d[_0xfb0d('0x58')][_0xfb0d('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xfb0d('0x81')](_0x79c20d[_0xfb0d('0x58')])){return this['channel'][_0xfb0d('0xa9')](_0xfb0d('0xc6'));}this['channel'][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0x1be'),_0x79c20d[_0xfb0d('0x58')]));var _0x2c2c38=this['googleTTS'][_0xfb0d('0xa5')](this,_0x79c20d);if(_0x2c2c38){this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')]('Google\x20TTS\x20%s\x20file\x20created',_0x2c2c38));var _0x3dbae6=this['channel'][_0xfb0d('0x102')](_0x2c2c38);try{fs[_0xfb0d('0x103')](_0x2c2c38+_0xfb0d('0x104'));}catch(_0x2d4eb4){logger[_0xfb0d('0x29')](_0x2d4eb4);}return _0x3dbae6;}return this[_0xfb0d('0xd')][_0xfb0d('0x29')](_0x79c20d,_0xfb0d('0x1bf'));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x1c0')]=function(_0x35cd3a){logger['info'](util[_0xfb0d('0x52')](_0xfb0d('0x1c1'),_0x35cd3a[_0xfb0d('0x35')]));if(!this['isConfigured'](_0x35cd3a[_0xfb0d('0x14d')])){return this[_0xfb0d('0xd')]['error'](_0x35cd3a,_0xfb0d('0x154'));}logger['info'](util['format'](_0xfb0d('0x14c'),this[_0xfb0d('0xd')][_0xfb0d('0x37')],_0x35cd3a[_0xfb0d('0x14d')]));var _0x497dea=this[_0xfb0d('0x4e')][_0xfb0d('0xa5')](this,_0x35cd3a[_0xfb0d('0x14d')]);if(_0x497dea){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x14e'),this[_0xfb0d('0xd')][_0xfb0d('0x37')],_0x35cd3a[_0xfb0d('0x14d')]));this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')](_0xfb0d('0x14e'),this[_0xfb0d('0xd')][_0xfb0d('0x37')],_0x35cd3a['findBy']));return{'code':0xc8,'result':_0xfb0d('0x14f')};}else{logger['info'](util[_0xfb0d('0x52')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfb0d('0xd')][_0xfb0d('0x37')],_0x35cd3a['findBy']));this[_0xfb0d('0xd')][_0xfb0d('0xa9')](util[_0xfb0d('0x52')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x35cd3a[_0xfb0d('0x14d')]));return{'code':0xc8,'result':_0xfb0d('0x151')};}};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x1c2')]=function(_0x354dd6){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x1c3'),_0x354dd6[_0xfb0d('0x35')]));var _0x21465f=this[_0xfb0d('0xd')][_0xfb0d('0xaa')](_0xfb0d('0x1c4'),[_0x354dd6[_0xfb0d('0x1c5')],_0x354dd6['options']]);if(_0x21465f[_0xfb0d('0xa2')]===-0x1){return _0x21465f;}return this[_0xfb0d('0xd')]['noop'](util[_0xfb0d('0x52')](_0xfb0d('0xc3'),'VOICEMAIL',_0x354dd6[_0xfb0d('0x1c5')]));};AGIVertices[_0xfb0d('0x10')][_0xfb0d('0x1c6')]=function(_0xc07481){logger[_0xfb0d('0x2c')](util[_0xfb0d('0x52')](_0xfb0d('0x1c7'),_0xc07481['label']));if(!this['isConfigured'](_0xc07481[_0xfb0d('0xd9')])){return this['channel'][_0xfb0d('0x29')](_0xc07481,_0xfb0d('0x1a2'));}var _0x24eebd=this[_0xfb0d('0x11')][_0xfb0d('0xa5')](this,_0xc07481[_0xfb0d('0xd9')]);if(!_0x24eebd){return this[_0xfb0d('0xd')]['error'](_0xc07481,_0xfb0d('0xda'));}var _0x1c1626=this[_0xfb0d('0xd')][_0xfb0d('0x11')](_0x24eebd);return{'code':0xc8,'result':_0x1c1626['extra']?_0x1c1626['extra']:'-'};};String['prototype'][_0xfb0d('0x9f')]=function(_0x59aee7,_0x50d9c5){return this[_0xfb0d('0x9d')](_0x59aee7)[_0xfb0d('0x1c8')](_0x50d9c5);};module[_0xfb0d('0x1c9')]=AGIVertices; \ No newline at end of file +var _0x31f0=['test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','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','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]','variable\x20%s[key]\x20set','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','auth','pass','template_id','sendMail\x20message','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','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','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','path','lodash','odbc','randomstring','moment','mustache','../../config/logger','agi','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','Intervals','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','uniqueid','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','callback','scheduledAt','callback_priority','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','timeout','number','POST','PUT','method','toUpperCase','rawBody','parse','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','render','stringify','body','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','format','%s.%s','split','replaceAll','extra','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','retry','mrcpsynth','noop','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','no\x20text\x20configured','sestektts','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','url','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','googleDialogflow','out','Dialogflow\x20Result\x20%s','speech','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response'];(function(_0x3957dc,_0x525687){var _0x107bc4=function(_0x59ab60){while(--_0x59ab60){_0x3957dc['push'](_0x3957dc['shift']());}};_0x107bc4(++_0x525687);}(_0x31f0,0xb7));var _0x031f=function(_0x2644dc,_0x427925){_0x2644dc=_0x2644dc-0x0;var _0x9a59a7=_0x31f0[_0x2644dc];return _0x9a59a7;};'use strict';var fs=require('fs');var path=require(_0x031f('0x0'));var util=require('util');var _=require(_0x031f('0x1'));var sh=require('shelljs');var odbc=require(_0x031f('0x2'))();var rs=require(_0x031f('0x3'));var moment=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var rp=require('request-promise');var logger=require(_0x031f('0x6'))(_0x031f('0x7'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x031f('0x8'),'rawBody'];var verticesWithRetry=[_0x031f('0x9'),_0x031f('0xa'),_0x031f('0xb')];var AGIVertices=function(_0x3e41ed,_0x4d47c5,_0x2e5624){this[_0x031f('0xc')]=_0x3e41ed;this[_0x031f('0xd')]=_0x4d47c5;this[_0x031f('0xe')]=_0x2e5624;};AGIVertices[_0x031f('0xf')][_0x031f('0x10')]=function(_0x2202dc,_0x3fd541){this['rpc'][_0x031f('0x11')](_0x2202dc)[_0x031f('0x12')](function(_0x28da6e){_0x3fd541(null,_0x28da6e?_0x28da6e[_0x031f('0x13')]:![]);})[_0x031f('0x14')](function(_0x405896){_0x3fd541(_0x405896);});};AGIVertices[_0x031f('0xf')]['getVoiceQueue']=function(_0x1614d6,_0x23b40c){this[_0x031f('0xd')][_0x031f('0x15')](_0x1614d6)[_0x031f('0x12')](function(_0x57f9c0){_0x23b40c(null,_0x57f9c0?_0x57f9c0['name']:![]);})[_0x031f('0x14')](function(_0x3a10aa){_0x23b40c(_0x3a10aa);});};AGIVertices[_0x031f('0xf')][_0x031f('0x16')]=function(_0x5196b1,_0x1dc4a7){this[_0x031f('0xd')]['getSquareProjectById'](_0x5196b1)[_0x031f('0x12')](function(_0x535e70){_0x1dc4a7(null,_0x535e70?_0x535e70[_0x031f('0x13')]:![]);})[_0x031f('0x14')](function(_0x563bc8){_0x1dc4a7(_0x563bc8);});};AGIVertices[_0x031f('0xf')][_0x031f('0x17')]=function(_0x26cb5e,_0x1b76d6){this[_0x031f('0xd')][_0x031f('0x18')](_0x26cb5e)[_0x031f('0x12')](function(_0x29dd6e){_0x1b76d6(null,_0x29dd6e?_0x29dd6e['dsn']:![]);})[_0x031f('0x14')](function(_0x33926c){_0x1b76d6(_0x33926c);});};AGIVertices[_0x031f('0xf')]['getUser']=function(_0x5c4184,_0xa11a2b){this['rpc'][_0x031f('0x19')](_0x5c4184)['then'](function(_0x54d054){_0xa11a2b(null,_0x54d054?_0x54d054['name']:![]);})[_0x031f('0x14')](function(_0x12c406){_0xa11a2b(_0x12c406);});};AGIVertices[_0x031f('0xf')][_0x031f('0x1a')]=function(_0x494568,_0x374b65){this['rpc'][_0x031f('0x1b')](_0x494568)[_0x031f('0x12')](function(_0xfa77b1){_0x374b65(null,_0xfa77b1?_0xfa77b1['name']:![]);})[_0x031f('0x14')](function(_0x3b2a51){_0x374b65(_0x3b2a51);});};AGIVertices['prototype'][_0x031f('0x1c')]=function(_0x28a617,_0x2403e9){var _0x5395ea=this;this[_0x031f('0xd')][_0x031f('0x1d')](_0x28a617)[_0x031f('0x12')](function(_0xaf5bea){_0x2403e9(null,_0xaf5bea?_0x5395ea[_0x031f('0x1e')](_0xaf5bea[_0x031f('0x1f')]):![]);})['catch'](function(_0x1f62eb){_0x2403e9(_0x1f62eb);});};AGIVertices[_0x031f('0xf')][_0x031f('0x20')]=function(_0x2ea861,_0x428ec4){this[_0x031f('0xd')][_0x031f('0x21')](_0x2ea861)[_0x031f('0x12')](function(_0x2034ac){_0x428ec4(null,_0x2034ac?_0x2034ac:![]);})[_0x031f('0x14')](function(_0x2cf3a8){_0x428ec4(_0x2cf3a8);});};AGIVertices['prototype'][_0x031f('0x22')]=function(_0xe5f11c,_0xb3a6bd,_0x2f2616){this[_0x031f('0xe')][_0x031f('0x22')](_0xe5f11c,_0xb3a6bd)[_0x031f('0x12')](function(){_0x2f2616(null);})[_0x031f('0x14')](function(_0x217460){_0x2f2616(_0x217460);});};AGIVertices[_0x031f('0xf')][_0x031f('0x23')]=function(_0x17217d,_0x4610fa){this['rpc'][_0x031f('0x24')](_0x17217d)[_0x031f('0x12')](function(_0x4d1569){if(_0x4d1569){if(_0x4d1569[_0x031f('0x25')]){_0x4610fa(null,[_0x4d1569[_0x031f('0x26')]]);}else{_0x4610fa(null,_['map'](_0x4d1569[_0x031f('0x27')],_0x031f('0x26')));}}else{_0x4610fa(null,![]);}})[_0x031f('0x14')](function(_0x3ef166){_0x4610fa(_0x3ef166);});};AGIVertices['prototype']['getSoundPath']=function(_0x36ab13){return util['format'](_0x031f('0x28'),FILES_PATH,_0x36ab13);};AGIVertices[_0x031f('0xf')][_0x031f('0x29')]=function(_0x56a7f0,_0x5c33c5,_0x3c1e48){odbc['open'](_0x56a7f0,function(_0x57b9c8){if(_0x57b9c8){logger[_0x031f('0x2a')](_0x031f('0x2b'),_0x57b9c8);_0x3c1e48(_0x57b9c8);}else{logger[_0x031f('0x2c')](_0x031f('0x2d'));odbc[_0x031f('0x2e')](_0x5c33c5,function(_0x46b4f3,_0x1ffd03){if(_0x46b4f3){logger['info'](_0x031f('0x2f'),_0x5c33c5);_0x3c1e48(_0x46b4f3);}else{logger[_0x031f('0x2c')](_0x031f('0x30'),_0x5c33c5);odbc[_0x031f('0x31')](function(_0x58daa2){if(_0x58daa2){logger[_0x031f('0x2a')](_0x031f('0x32'),_0x58daa2);}_0x3c1e48(null,_0x1ffd03);});}});}});};AGIVertices[_0x031f('0xf')]['getSmsAccount']=function(_0x24ec95,_0x3b504c){this['rpc'][_0x031f('0x33')](_0x24ec95)[_0x031f('0x12')](function(_0x56a8f3){_0x3b504c(null,_0x56a8f3?_0x56a8f3:![]);})['catch'](function(_0x178135){_0x3b504c(_0x178135);});};AGIVertices[_0x031f('0xf')][_0x031f('0x34')]=function(_0x46885f,_0x2691b7){this[_0x031f('0xd')][_0x031f('0x34')](_0x46885f)['then'](function(_0x10eb0a){_0x2691b7(null,_0x10eb0a);})[_0x031f('0x14')](function(_0x4d701e){_0x2691b7(_0x4d701e);});};AGIVertices[_0x031f('0xf')]['createSquareDetailsReport']=function(_0x456a98,_0x260a3d,_0x56dd24){this[_0x031f('0xd')][_0x031f('0x35')]({'uniqueid':this[_0x031f('0xc')]['uniqueid'],'node':_0x456a98[_0x031f('0x36')],'application':_0x456a98[_0x031f('0x37')],'data':_0x260a3d||null,'project_name':this[_0x031f('0xc')][_0x031f('0x38')],'callerid':this[_0x031f('0xc')][_0x031f('0x39')]})[_0x031f('0x12')](function(_0x3f4b85){if(_0x56dd24){_0x56dd24(null,_0x3f4b85);}})[_0x031f('0x14')](function(_0x4a7a87){if(_0x56dd24){_0x56dd24(_0x4a7a87);}});};AGIVertices[_0x031f('0xf')][_0x031f('0x3a')]=function(_0x28f2b3,_0x3205ce,_0xcf2072,_0x2c879c){this[_0x031f('0xd')][_0x031f('0x3a')]({'uniqueid':this[_0x031f('0xc')]['uniqueid'],'callerid':this[_0x031f('0xc')]['callerid'],'calleridname':this['channel'][_0x031f('0x3b')],'context':this[_0x031f('0xc')][_0x031f('0x3c')],'extension':this[_0x031f('0xc')][_0x031f('0x3d')],'priority':this['channel'][_0x031f('0x3e')],'accountcode':this[_0x031f('0xc')][_0x031f('0x3f')],'dnid':this['channel'][_0x031f('0x40')],'projectName':this[_0x031f('0xc')][_0x031f('0x38')],'saveName':_0x3205ce,'filename':_0x28f2b3[_0x031f('0x41')]||_0x3205ce,'savePath':_0xcf2072})[_0x031f('0x12')](function(_0x12d28e){_0x2c879c(null,_0x12d28e);})['catch'](function(_0x569d8f){_0x2c879c(_0x569d8f);});};AGIVertices[_0x031f('0xf')]['createSquareMessage']=function(_0x3b8c04,_0x3bba44,_0x5a29e0,_0x3a0599,_0x4cd2ae){this['rpc'][_0x031f('0x42')]({'uniqueid':this['channel'][_0x031f('0x43')],'body':_0x3b8c04,'direction':_0x3bba44,'providerName':_0x5a29e0,'providerResponse':_0x3a0599})['then'](function(_0x11bf43){if(_0x4cd2ae){_0x4cd2ae(null,_0x11bf43);}})[_0x031f('0x14')](function(_0x5da62e){if(_0x4cd2ae){_0x4cd2ae(_0x5da62e);}});};AGIVertices[_0x031f('0xf')][_0x031f('0x44')]=function(_0x57e32d,_0x46471a){this['rpc'][_0x031f('0x44')]({'firstName':_['isEmpty'](_0x57e32d[_0x031f('0x13')])||_[_0x031f('0x45')](_0x57e32d[_0x031f('0x13')])?_0x031f('0x46')+Math[_0x031f('0x47')]():_0x57e32d['name'],'lastName':_[_0x031f('0x48')](_0x57e32d['lastName'])||_[_0x031f('0x45')](_0x57e32d[_0x031f('0x49')])?null:_0x57e32d['lastName'],'phone':_0x57e32d[_0x031f('0x4a')],'ListId':_0x57e32d[_0x031f('0x4b')],'scheduledat':_0x57e32d['scheduledAt'],'callbackUniqueid':this[_0x031f('0xc')][_0x031f('0x43')],'tags':_0x031f('0x4c'),'description':'Callback\x20scheduled\x20at\x20'+_0x57e32d[_0x031f('0x4d')]['toString'](),'priority':_0x57e32d[_0x031f('0x4e')]})['then'](function(_0x3bd6f4){_0x46471a(null,_0x3bd6f4);})['catch'](function(_0xa52a54){_0x46471a(_0xa52a54);});};AGIVertices[_0x031f('0xf')]['getPause']=function(_0x4c5061,_0x24525b){this[_0x031f('0xd')]['getPauseById'](_0x4c5061)[_0x031f('0x12')](function(_0xb44c73){_0x24525b(null,_0xb44c73?_0xb44c73[_0x031f('0x13')]:![]);})[_0x031f('0x14')](function(_0x21a89d){_0x24525b(_0x21a89d);});};AGIVertices[_0x031f('0xf')][_0x031f('0x4f')]=function(_0x405398,_0x4b25e5,_0xe452c2){var _0x915e75={'role':_0x031f('0x50')};_0x915e75[_0x405398]=this['channel'][_0x031f('0x39')];this[_0x031f('0xd')]['agentPause'](_0x915e75,_0x4b25e5,this[_0x031f('0xc')][_0x031f('0x43')])[_0x031f('0x12')](function(_0x198e2e){_0xe452c2(null,_['isNil'](_0x198e2e)?![]:!![]);})['catch'](function(_0x4b5db9){logger['error'](_0x4b5db9);_0xe452c2(null,![]);});};AGIVertices[_0x031f('0xf')][_0x031f('0x51')]=function(_0x4a7fbb,_0x10531d){var _0x28f026={'role':'agent'};_0x28f026[_0x4a7fbb]=this[_0x031f('0xc')][_0x031f('0x39')];this[_0x031f('0xd')][_0x031f('0x51')](_0x28f026)[_0x031f('0x12')](function(_0x3172b1){_0x10531d(null,_[_0x031f('0x45')](_0x3172b1)?![]:!![]);})[_0x031f('0x14')](function(_0x430667){logger['error'](_0x430667);_0x10531d(null,![]);});};AGIVertices[_0x031f('0xf')]['agentLogout']=function(_0x13409d,_0x2cc2d1){var _0x3d27d6={'role':'agent'};_0x3d27d6[_0x13409d]=this['channel'][_0x031f('0x39')];this[_0x031f('0xd')][_0x031f('0x52')](_0x3d27d6)[_0x031f('0x12')](function(_0x49507b){_0x2cc2d1(null,_[_0x031f('0x45')](_0x49507b)?![]:!![]);})['catch'](function(_0x478982){logger[_0x031f('0x2a')](_0x478982);_0x2cc2d1(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x71e67,_0x13dd0c){var _0x248f8b={'role':_0x031f('0x50')};_0x248f8b[_0x71e67]=this[_0x031f('0xc')]['callerid'];var _0x56b573=_0x71e67!=_0x031f('0x53')?util['format'](_0x031f('0x54'),_0x031f('0x55'),this['channel'][_0x031f('0x39')]):undefined;this[_0x031f('0xd')][_0x031f('0x56')](_0x248f8b,_0x56b573)[_0x031f('0x12')](function(_0x14fd99){_0x13dd0c(null,_[_0x031f('0x45')](_0x14fd99)?![]:!![]);})['catch'](function(_0x58f012){logger[_0x031f('0x2a')](_0x58f012);_0x13dd0c(null,![]);});};AGIVertices[_0x031f('0xf')][_0x031f('0x57')]=function(_0x1d973d,_0x6d85c8){sh[_0x031f('0x58')](_[_0x031f('0x59')](_0x1d973d),function(_0x5c99c6,_0x4e3384){var _0x4bd283=_0x4e3384['replace'](/(\r\n|\n|\r)/gm,'');_0x6d85c8(null,_0x4bd283);});};AGIVertices[_0x031f('0xf')][_0x031f('0x5a')]=function(_0x45977a,_0x4fb931){scripts[_0x031f('0x5a')](_0x45977a[_0x031f('0x5b')],_0x45977a['google_cloud_tts_text_type']||_0x031f('0x5c'),_0x45977a[_0x031f('0x5c')],_0x45977a[_0x031f('0x5d')]||_0x031f('0x5e'),_0x45977a[_0x031f('0x5f')]||_0x031f('0x60'),_0x45977a[_0x031f('0x61')]||'MP3')['then'](function(_0x8a448f){_0x4fb931(null,_0x8a448f);})['catch'](function(_0x2ed9c1){_0x4fb931(_0x2ed9c1);});};AGIVertices['prototype'][_0x031f('0x62')]=function(_0x1cefb8,_0x3424c9){scripts['googleTTS'](_0x1cefb8[_0x031f('0x5c')],_0x1cefb8['google_tts_language']||'en',0x1)[_0x031f('0x12')](function(_0xffb00){_0x3424c9(null,_0xffb00);})[_0x031f('0x14')](function(_0x4e7251){_0x3424c9(_0x4e7251);});};AGIVertices[_0x031f('0xf')][_0x031f('0x63')]=function(_0x3c4b09,_0x3e3ff5){var _0x45330f={'uri':_0x3c4b09['url'],'method':_0x3c4b09['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3c4b09[_0x031f('0x64')])===_0x031f('0x65')&&parseInt(_0x3c4b09['timeout'])>=0x1?parseInt(_0x3c4b09[_0x031f('0x64')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x031f('0x66'),_0x031f('0x67')],_0x45330f[_0x031f('0x68')][_0x031f('0x69')]())){try{_0x45330f['body']=_0x3c4b09[_0x031f('0x6a')]?JSON[_0x031f('0x6b')](_0x3c4b09[_0x031f('0x6a')]):{};}catch(_0x5b336f){logger[_0x031f('0x2a')](_0x031f('0x6c'),_0x5b336f);}}try{_0x45330f['headers']=_0x3c4b09[_0x031f('0x8')]?JSON[_0x031f('0x6b')](_0x3c4b09[_0x031f('0x8')]):{};}catch(_0x2fb2a8){logger[_0x031f('0x2a')](_0x031f('0x6d'),_0x2fb2a8);}if(_0x3c4b09[_0x031f('0x6e')]){try{var _0x596280=require(_0x3c4b09[_0x031f('0x6e')])[_0x031f('0x6f')](this,_0x45330f);_0x45330f[_0x031f('0x70')]=Mustache['render'](_0x3c4b09['url'],_0x596280,{},['$$','$$']);if(_0x45330f[_0x031f('0x71')]){_0x45330f['headers']=JSON['parse'](Mustache[_0x031f('0x72')](JSON[_0x031f('0x73')](_0x45330f[_0x031f('0x71')]),_0x596280,{},['$$','$$']));}if(_0x45330f[_0x031f('0x74')]){_0x45330f[_0x031f('0x74')]=JSON[_0x031f('0x6b')](Mustache[_0x031f('0x72')](JSON[_0x031f('0x73')](_0x45330f[_0x031f('0x74')]),_0x596280,{},['$$','$$']));}}catch(_0x30a3ea){logger[_0x031f('0x2a')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x30a3ea);}}rp(_0x45330f)[_0x031f('0x12')](function(_0x2d867f){var _0x1f4ecf={'statusCode':_0x2d867f[_0x031f('0x75')]||0xc8,'statusMessage':_0x2d867f['statusMessage']||'OK','headers':_0x2d867f[_0x031f('0x71')]||{},'body':_0x2d867f['body']||{}};_0x3e3ff5(null,_0x1f4ecf);})['catch'](function(_0x22ce8a){var _0x2f4d09={'statusCode':_0x22ce8a['statusCode']||0x1f4,'statusMessage':_0x22ce8a['message']||_0x031f('0x76'),'headers':_0x22ce8a[_0x031f('0x77')][_0x031f('0x71')]||{},'body':_0x22ce8a[_0x031f('0x77')][_0x031f('0x74')]||{}};_0x3e3ff5(null,_0x2f4d09);});};AGIVertices[_0x031f('0xf')]['googleDialogflow']=function(_0x263658,_0x420f81){scripts['googleDialogflow'](this[_0x031f('0xc')][_0x031f('0x43')],_0x263658[_0x031f('0x78')],_0x263658[_0x031f('0x5c')],_0x263658[_0x031f('0x79')]||'en')[_0x031f('0x12')](function(_0x8741ff){_0x420f81(null,_0x8741ff);})['catch'](function(_0x412394){_0x420f81(_0x412394);});};AGIVertices['prototype'][_0x031f('0x7a')]=function(_0x1d5d61,_0x388ada){scripts['googleDialogflowV2'](this['channel']['uniqueid'],_0x1d5d61[_0x031f('0x7b')],_0x1d5d61[_0x031f('0x7c')],_0x1d5d61[_0x031f('0x7d')],_0x1d5d61[_0x031f('0x5c')],_0x1d5d61[_0x031f('0x7e')]||'en')[_0x031f('0x12')](function(_0x232aa0){_0x388ada(null,_0x232aa0);})['catch'](function(_0x59995e){_0x388ada(_0x59995e);});};AGIVertices[_0x031f('0xf')][_0x031f('0x7f')]=function(_0x54d86e,_0xc2d0b1){scripts['sestekNDA'](this[_0x031f('0xc')],_0x54d86e)[_0x031f('0x12')](function(_0x5a6db6){_0xc2d0b1(null,_0x5a6db6);})[_0x031f('0x14')](function(_0x37af05){_0xc2d0b1(_0x37af05);});};AGIVertices['prototype'][_0x031f('0x80')]=function(_0x3c7dee,_0x1b588e){scripts['ispeechTTS'](_0x3c7dee[_0x031f('0x78')],_0x3c7dee[_0x031f('0x5c')],_0x3c7dee[_0x031f('0x81')]||_0x031f('0x5e'),_0x3c7dee[_0x031f('0x82')])[_0x031f('0x12')](function(_0x47ed2c){_0x1b588e(null,_0x47ed2c);})[_0x031f('0x14')](function(_0x1d64f9){_0x1b588e(_0x1d64f9);});};AGIVertices[_0x031f('0xf')][_0x031f('0x83')]=function(_0x4ef395,_0x33bf51,_0x467a76){scripts['ispeechASR'](_0x33bf51,_0x4ef395[_0x031f('0x78')],_0x4ef395[_0x031f('0x84')]||_0x031f('0x5e'),this[_0x031f('0x85')](_0x4ef395[_0x031f('0x86')])?_0x4ef395[_0x031f('0x86')]:undefined)[_0x031f('0x12')](function(_0xb35eef){_0x467a76(null,_0xb35eef);})[_0x031f('0x14')](function(_0x2ffe65){_0x467a76(_0x2ffe65);});};AGIVertices[_0x031f('0xf')][_0x031f('0x87')]=function(_0x4b077c,_0x24b834){scripts[_0x031f('0x87')](_0x4b077c['aws_access_key_id'],_0x4b077c[_0x031f('0x88')],_0x4b077c[_0x031f('0x89')],_0x4b077c[_0x031f('0x8a')]||_0x031f('0x8b'),_0x4b077c[_0x031f('0x5c')],_0x4b077c[_0x031f('0x8c')]||'text')['then'](function(_0x5acc87){_0x24b834(null,_0x5acc87);})[_0x031f('0x14')](function(_0x3840d4){_0x24b834(_0x3840d4);});};AGIVertices['prototype'][_0x031f('0x8d')]=function(_0x303cfa,_0x342eb9){scripts[_0x031f('0x8d')](this['channel'][_0x031f('0x43')],_0x303cfa[_0x031f('0x8e')],_0x303cfa[_0x031f('0x88')],_0x303cfa[_0x031f('0x8f')],_0x303cfa[_0x031f('0x5c')],_0x303cfa[_0x031f('0x90')])[_0x031f('0x12')](function(_0x1c0f3f){_0x342eb9(null,_0x1c0f3f);})[_0x031f('0x14')](function(_0x3a798a){_0x342eb9(_0x3a798a);});};AGIVertices[_0x031f('0xf')][_0x031f('0x91')]=function(_0x4bd749,_0x2541fd,_0x1f1f0e){scripts['googleASR'](_0x2541fd,_0x4bd749[_0x031f('0x78')],_0x4bd749[_0x031f('0x92')]||'en-US')[_0x031f('0x12')](function(_0x3bc88c){_0x1f1f0e(null,_0x3bc88c);})[_0x031f('0x14')](function(_0x314e0c){_0x1f1f0e(_0x314e0c);});};AGIVertices[_0x031f('0xf')][_0x031f('0x93')]=function(_0x134c48,_0x3cd2b1,_0x2e0e24){scripts['tildeASR'](_0x3cd2b1,_0x134c48[_0x031f('0x94')],_0x134c48[_0x031f('0x95')],_0x134c48[_0x031f('0x70')])['then'](function(_0x54b17b){_0x2e0e24(null,_0x54b17b);})[_0x031f('0x14')](function(_0x56ffc4){_0x2e0e24(_0x56ffc4);});};AGIVertices[_0x031f('0xf')][_0x031f('0x96')]=function(_0x4a96f2){var _0x1393bc=_[_0x031f('0x97')](verticesWithRetry,_0x4a96f2[_0x031f('0x37')])?_0x4a96f2:_[_0x031f('0x98')](_0x4a96f2);for(var _0x1d2143 in _0x1393bc){if(_0x1393bc[_0x031f('0x99')](_0x1d2143)){if(_0x1393bc[_0x1d2143]&&_[_0x031f('0x9a')](_0x1393bc[_0x1d2143])){if(_[_0x031f('0x97')](recursiveMapAttributes,_0x1d2143)){_0x1393bc[_0x1d2143]=this[_0x031f('0x9b')](_0x1393bc[_0x1d2143]);}else{_0x1393bc[_0x1d2143]=this[_0x031f('0x9c')](_0x1393bc[_0x1d2143]);}}}}return _0x1393bc;};AGIVertices[_0x031f('0xf')][_0x031f('0x9d')]=function(_0x21cff4){for(var _0x51c6c3 in _0x21cff4){if(_0x21cff4['hasOwnProperty'](_0x51c6c3)){if(_[_0x031f('0x9e')](_0x21cff4[_0x51c6c3])){this['recursiveNodeIndex'](_0x21cff4[_0x51c6c3]);}else if(_[_0x031f('0x9f')](_0x21cff4[_0x51c6c3])){for(var _0x48d4f2=0x0;_0x48d4f2<_0x21cff4[_0x51c6c3][_0x031f('0xa0')];_0x48d4f2++){this['recursiveNodeIndex'](_0x21cff4[_0x51c6c3][_0x48d4f2]);}}else if(_[_0x031f('0x9a')](_0x21cff4[_0x51c6c3])){_0x21cff4[_0x51c6c3]=this[_0x031f('0x9c')](_0x21cff4[_0x51c6c3]);}}}};AGIVertices['prototype'][_0x031f('0xa1')]=function(_0x2af84d,_0x124d51){for(var _0x144f72 in _0x2af84d){if(_0x2af84d[_0x031f('0x99')](_0x144f72)){if(_[_0x031f('0x9e')](_0x2af84d[_0x144f72])){if(!_[_0x031f('0x48')](_0x2af84d[_0x144f72])){this['saveRestApiResult'](_0x2af84d[_0x144f72],util[_0x031f('0xa2')](_0x031f('0xa3'),_0x124d51,_0x144f72));}}else if(_[_0x031f('0x9f')](_0x2af84d[_0x144f72])){for(var _0x46c69b=0x0;_0x46c69b<_0x2af84d[_0x144f72]['length'];_0x46c69b++){this['saveRestApiResult'](_0x2af84d[_0x144f72][_0x46c69b],util[_0x031f('0xa2')]('%s.%s',_0x124d51,_0x144f72+'['+_0x46c69b+']'));}}else{if(!_['isNil'](_0x2af84d[_0x144f72])){this[_0x031f('0xc')]['setVariable'](util['format'](_0x031f('0xa3'),_0x124d51,_0x144f72),_0x2af84d[_0x144f72]);}}}}};AGIVertices[_0x031f('0xf')][_0x031f('0x9b')]=function(_0x6551b6){try{var _0x605634=JSON[_0x031f('0x6b')](_0x6551b6);this['recursiveNodeIndex'](_0x605634);return JSON[_0x031f('0x73')](_0x605634);}catch(_0x2a7a02){return this['replaceAllVariables'](_0x6551b6);}};AGIVertices[_0x031f('0xf')][_0x031f('0x9c')]=function(_0x30c32f){var _0x352dad=_0x30c32f['split']('{');for(var _0x568574=0x1;_0x568574<_0x352dad['length'];_0x568574+=0x1){var _0x1502e4=_0x352dad[_0x568574][_0x031f('0xa4')]('}');if(_0x1502e4[_0x031f('0xa0')]>0x1){_0x30c32f=_0x30c32f[_0x031f('0xa5')]('{'+_0x1502e4[0x0]+'}',this[_0x031f('0xc')][_0x031f('0x10')](_0x1502e4[0x0])[_0x031f('0xa6')]||_0x1502e4[0x0]);}}if(_0x352dad[_0x031f('0xa0')]===0x1){return _0x30c32f[_0x031f('0xa7')]();}return this['replaceAllVariables'](_0x30c32f);};AGIVertices[_0x031f('0xf')][_0x031f('0xa8')]=function(_0x2f6c1b,_0x460cbb){var _0x38a31f=this['channel']['getVariable'](_0x2f6c1b);if(_0x38a31f['result']===-0x1){return _0x38a31f;}logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0xa9'),_0x460cbb,_0x38a31f[_0x031f('0xa6')]));return this['channel'][_0x031f('0xaa')](_0x460cbb,_0x38a31f['extra']);};AGIVertices[_0x031f('0xf')][_0x031f('0x85')]=function(_0x24aff3){return _0x24aff3&&_0x24aff3!=='0'&&_0x24aff3!=='-1'&&_0x24aff3!=='';};AGIVertices[_0x031f('0xf')][_0x031f('0xab')]=function(_0x498930){this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x498930,'-');_0x498930[_0x031f('0xac')]=_0x498930[_0x031f('0xab')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x031f('0xad')]=function(_0x2cf76a){logger['info'](util[_0x031f('0xa2')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x2cf76a[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x2cf76a[_0x031f('0x5c')])){return this[_0x031f('0xc')][_0x031f('0xae')]('no\x20text\x20configured');}var _0xab715d='\x22'+_0x2cf76a['text']+'\x22';if(this[_0x031f('0x85')](_0x2cf76a[_0x031f('0x77')])){_0xab715d+=','+_0x2cf76a['options'];}var _0x1fd20c=this[_0x031f('0xc')][_0x031f('0x58')](_0x031f('0xaf'),_0xab715d);if(_0x1fd20c[_0x031f('0xb0')]===-0x1){return _0x1fd20c;}return this['channel']['noop'](util['format'](_0x031f('0xb1'),_0xab715d));};AGIVertices['prototype'][_0x031f('0xb2')]=function(_0x22de62){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0xb3'),_0x22de62['label']));if(!this[_0x031f('0x85')](_0x22de62['grammar'])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xb4'));}var _0x54090d=_0x22de62[_0x031f('0xb5')];if(this[_0x031f('0x85')](_0x22de62[_0x031f('0x77')])){_0x54090d+=','+_0x22de62[_0x031f('0x77')];}var _0x5b092c=this[_0x031f('0xc')][_0x031f('0x58')](_0x031f('0xb6'),_0x54090d);if(_0x5b092c[_0x031f('0xb0')]===-0x1){return _0x5b092c;}var _0x4ac7f1=this[_0x031f('0xa8')]('RECOG_CONFIDENCE()',_0x031f('0xb7'));if(_0x4ac7f1[_0x031f('0xb0')]===-0x1){return _0x4ac7f1;}var _0x38e937=this[_0x031f('0xa8')](_0x031f('0xb8'),_0x031f('0xb9'));if(_0x38e937[_0x031f('0xb0')]===-0x1){return _0x38e937;}var _0x4a3d68=this[_0x031f('0xa8')](_0x031f('0xba'),_0x031f('0xbb'));if(_0x4a3d68[_0x031f('0xb0')]===-0x1){return _0x4a3d68;}return this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')](_0x031f('0xbc'),_0x54090d));};AGIVertices[_0x031f('0xf')][_0x031f('0x7')]=function(_0x33abc7){logger['info'](util[_0x031f('0xa2')](_0x031f('0xbd'),_0x33abc7[_0x031f('0x36')]));return this[_0x031f('0xc')][_0x031f('0x7')]([_0x33abc7['command'],_0x33abc7['args']]);};AGIVertices[_0x031f('0xf')][_0x031f('0xbe')]=function(_0x481ec4){logger[_0x031f('0x2c')](util['format'](_0x031f('0xbf'),_0x481ec4[_0x031f('0x36')]));if(this[_0x031f('0x85')](_0x481ec4[_0x031f('0x64')])){logger['info'](util['format'](_0x031f('0xc0'),_0x481ec4[_0x031f('0x64')]));var _0x2274bc=this[_0x031f('0xc')]['wait'](_0x481ec4[_0x031f('0x64')]);if(_0x2274bc[_0x031f('0xb0')]===-0x1){return _0x2274bc;}}return this[_0x031f('0xc')]['answer']();};AGIVertices[_0x031f('0xf')][_0x031f('0x4c')]=function(_0x233e8a){logger['info'](util[_0x031f('0xa2')](_0x031f('0xc1'),_0x233e8a[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x233e8a[_0x031f('0x4b')])){return this['channel'][_0x031f('0x2a')](_0x233e8a,_0x031f('0xc2'));}_0x233e8a[_0x031f('0x4d')]=moment();if(this[_0x031f('0x85')](_0x233e8a[_0x031f('0xc3')])){_0x233e8a[_0x031f('0x4d')]=moment()['add'](_0x233e8a['delay'],_0x031f('0xc4'));}if(!this[_0x031f('0x85')](_0x233e8a[_0x031f('0x4e')])){_0x233e8a[_0x031f('0x4e')]=0x2;}this[_0x031f('0x44')][_0x031f('0x6f')](this,_0x233e8a);return this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')](_0x031f('0xc5'),_0x233e8a[_0x031f('0x4a')],_0x233e8a[_0x031f('0x4b')],_0x233e8a[_0x031f('0x4d')]));};AGIVertices[_0x031f('0xf')][_0x031f('0xc6')]=function(_0x366710){logger['info'](util[_0x031f('0xa2')](_0x031f('0xc7'),_0x366710['label']));var _0x19a5d4=this[_0x031f('0xc')][_0x031f('0x58')](_0x366710[_0x031f('0xc8')],_0x366710[_0x031f('0x77')]);if(_0x19a5d4['result']===-0x1){return _0x19a5d4;}return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0xc9'),_0x366710['application'],_0x366710['options']));};AGIVertices['prototype']['lumenvoxtts']=function(_0x110ef2){logger['info'](util[_0x031f('0xa2')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x110ef2[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x110ef2[_0x031f('0x5c')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xca'));}var _0x817f3d='\x22'+_0x110ef2['text']+'\x22';if(this[_0x031f('0x85')](_0x110ef2[_0x031f('0x77')])){_0x817f3d+=','+_0x110ef2[_0x031f('0x77')];}var _0xefc45f=this[_0x031f('0xc')]['exec'](_0x031f('0xaf'),_0x817f3d);if(_0xefc45f[_0x031f('0xb0')]===-0x1){return _0xefc45f;}return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0xb1'),_0x817f3d));};AGIVertices[_0x031f('0xf')][_0x031f('0xcb')]=function(_0x20bd74){logger[_0x031f('0x2c')](util[_0x031f('0xa2')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x20bd74[_0x031f('0x36')]));if(!this['isConfigured'](_0x20bd74[_0x031f('0x5c')])){return this['channel'][_0x031f('0xae')](_0x031f('0xca'));}var _0x4bf1c0='\x22'+_0x20bd74[_0x031f('0x5c')]+'\x22';if(this[_0x031f('0x85')](_0x20bd74['options'])){_0x4bf1c0+=','+_0x20bd74['options'];}var _0x17df22=this[_0x031f('0xc')][_0x031f('0x58')](_0x031f('0xaf'),_0x4bf1c0);if(_0x17df22[_0x031f('0xb0')]===-0x1){return _0x17df22;}return this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4bf1c0));};AGIVertices['prototype']['lumenvoxasr']=function(_0x1fb810){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0xcc'),_0x1fb810[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x1fb810[_0x031f('0xb5')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xb4'));}var _0x24f859=_0x1fb810[_0x031f('0xb5')];if(this[_0x031f('0x85')](_0x1fb810['options'])){_0x24f859+=','+_0x1fb810[_0x031f('0x77')];}var _0x1d353f=this[_0x031f('0xc')][_0x031f('0x58')]('MRCPRecog',_0x24f859);if(_0x1d353f['result']===-0x1){return _0x1d353f;}var _0x538697=this[_0x031f('0xa8')](_0x031f('0xcd'),_0x031f('0xce'));if(_0x538697['result']===-0x1){return _0x538697;}var _0x5d46cf=this[_0x031f('0xa8')](_0x031f('0xb8'),_0x031f('0xcf'));if(_0x5d46cf[_0x031f('0xb0')]===-0x1){return _0x5d46cf;}var _0x441874=this[_0x031f('0xa8')](_0x031f('0xba'),_0x031f('0xd0'));if(_0x441874[_0x031f('0xb0')]===-0x1){return _0x441874;}return this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')]('Executed\x20command\x20MRCPRecog\x20%s',_0x24f859));};AGIVertices['prototype']['sestekasr']=function(_0x14977a){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0xd1'),_0x14977a[_0x031f('0x36')]));if(!this['isConfigured'](_0x14977a['grammar'])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xb4'));}var _0x2d2d9f=_0x14977a[_0x031f('0xb5')];if(this[_0x031f('0x85')](_0x14977a['options'])){_0x2d2d9f+=','+_0x14977a[_0x031f('0x77')];}var _0x519ff5=this[_0x031f('0xc')][_0x031f('0x58')]('MRCPRecog',_0x2d2d9f);if(_0x519ff5['result']===-0x1){return _0x519ff5;}var _0x2433d6=this[_0x031f('0xa8')](_0x031f('0xcd'),_0x031f('0xd2'));if(_0x2433d6[_0x031f('0xb0')]===-0x1){return _0x2433d6;}var _0x41c07d=this[_0x031f('0xa8')](_0x031f('0xb8'),_0x031f('0xd3'));if(_0x41c07d[_0x031f('0xb0')]===-0x1){return _0x41c07d;}var _0x6c24bc=this[_0x031f('0xa8')](_0x031f('0xba'),_0x031f('0xd4'));if(_0x6c24bc[_0x031f('0xb0')]===-0x1){return _0x6c24bc;}return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2d2d9f));};AGIVertices[_0x031f('0xf')]['database']=function(_0x3a8aa6){logger[_0x031f('0x2c')](util['format'](_0x031f('0xd5'),_0x3a8aa6[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x3a8aa6[_0x031f('0xd6')])){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x3a8aa6,'no\x20database\x20selected');}var _0xb29553=this[_0x031f('0x17')]['sync'](this,_0x3a8aa6[_0x031f('0xd6')]);if(!_0xb29553){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x3a8aa6,_0x031f('0xd7'));}if(!this[_0x031f('0x85')](_0x3a8aa6[_0x031f('0x2e')])){return this['channel'][_0x031f('0x2a')](_0x3a8aa6,'no\x20query\x20configured');}var _0x548dd1=_0x3a8aa6[_0x031f('0x2e')][_0x031f('0xd8')](/(\r\n|\n|\r)/gm,'\x20');this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0xd9'),_0x548dd1));var _0x3c8afe=this['getQueryOdbc'][_0x031f('0x6f')](this,_0xb29553,_0x548dd1);this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x3a8aa6,_0x548dd1);if(!this['isConfigured'](_0x3a8aa6[_0x031f('0xda')])){return this['channel']['noop'](_0x031f('0xdb'));}var _0x1efec5=this[_0x031f('0x10')][_0x031f('0x6f')](this,_0x3a8aa6[_0x031f('0xda')]);if(!_0x1efec5){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x3a8aa6,_0x031f('0xdc'));}var _0x51bf59=this;_0x3c8afe[_0x031f('0xdd')](function(_0x4243c9,_0x257153){Object[_0x031f('0xde')](_0x4243c9)['forEach'](function(_0x400513){_0x51bf59[_0x031f('0xc')][_0x031f('0xaa')](util['format']('%s[%s][%s]',_0x1efec5,_0x257153,_0x400513),_0x4243c9[_0x400513]);});});this[_0x031f('0xc')][_0x031f('0xaa')](util[_0x031f('0xa2')](_0x031f('0xdf'),_0x1efec5),_0x3c8afe[_0x031f('0xa0')]);return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0xe0'),_0x1efec5));};AGIVertices['prototype'][_0x031f('0xe1')]=function(_0x7f92c1){logger[_0x031f('0xe2')](util[_0x031f('0xa2')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x7f92c1[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x7f92c1[_0x031f('0xe3')])){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x7f92c1,_0x031f('0xe4'));}var _0x425ea3=this['getUser'][_0x031f('0x6f')](this,_0x7f92c1['sip_id']);if(!_0x425ea3){return this[_0x031f('0xc')]['error'](_0x7f92c1,_0x031f('0xe5'));}var _0x552f78=this[_0x031f('0xc')][_0x031f('0x58')](_0x031f('0xe6'),[util['format'](_0x031f('0xe7'),_0x425ea3),_0x7f92c1[_0x031f('0x64')],_0x7f92c1[_0x031f('0xe8')],_0x7f92c1[_0x031f('0xe9')]]);if(_0x552f78[_0x031f('0xb0')]===-0x1){return _0x552f78;}return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0xea'),'DIAL'));};AGIVertices[_0x031f('0xf')][_0x031f('0xeb')]=function(_0x3909fc){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0xec'),_0x3909fc[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x3909fc['key'])){return this['channel'][_0x031f('0xae')]('no\x20key\x20configured');}if(!this[_0x031f('0x85')](_0x3909fc['text'])){return this['channel'][_0x031f('0xae')](_0x031f('0xca'));}this[_0x031f('0xc')][_0x031f('0xed')]=!![];this[_0x031f('0x35')](_0x3909fc);this['createSquareMessage'](_0x3909fc[_0x031f('0x5c')],'in','','');this['channel'][_0x031f('0xae')](util['format']('Trying\x20Dialogflow:\x20%s',_0x3909fc[_0x031f('0x5c')]));var _0x2b0b30=this[_0x031f('0xee')][_0x031f('0x6f')](this,_0x3909fc);if(_0x2b0b30){for(var _0x363acf in _0x2b0b30){if(_0x2b0b30['hasOwnProperty'](_0x363acf)){this['channel']['setVariable'](util[_0x031f('0xa2')]('DIALOGFLOW_%s',_0x363acf[_0x031f('0x69')]()),_0x2b0b30[_0x363acf]);}}this[_0x031f('0x42')](_0x2b0b30['speech'],_0x031f('0xef'),_0x031f('0xeb'),'');return this[_0x031f('0xc')]['noop'](util['format'](_0x031f('0xf0'),_0x2b0b30[_0x031f('0xf1')]));}return this[_0x031f('0xc')]['error'](_0x3909fc,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x031f('0xf')]['dialogflowV2']=function(_0x577da0){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0xf2'),_0x577da0['label']));if(!this['isConfigured'](_0x577da0[_0x031f('0x7b')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xf3'));}if(!this[_0x031f('0x85')](_0x577da0[_0x031f('0x7c')])){return this[_0x031f('0xc')][_0x031f('0xae')]('no\x20client_email\x20configured');}if(!this[_0x031f('0x85')](_0x577da0[_0x031f('0x7d')])){return this[_0x031f('0xc')]['noop'](_0x031f('0xf4'));}if(!this['isConfigured'](_0x577da0[_0x031f('0x7e')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xf5'));}if(!this[_0x031f('0x85')](_0x577da0[_0x031f('0x5c')])){return this['channel'][_0x031f('0xae')](_0x031f('0xca'));}this[_0x031f('0xc')]['bot']=!![];this[_0x031f('0x35')](_0x577da0);this[_0x031f('0x42')](_0x577da0['text'],'in','','');this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')]('Trying\x20DialogflowV2:\x20%s',_0x577da0['text']));var _0x365859=this[_0x031f('0x7a')][_0x031f('0x6f')](this,_0x577da0);if(_0x365859){for(var _0x41d156 in _0x365859){if(_0x365859[_0x031f('0x99')](_0x41d156)){if(_0x41d156!==_0x031f('0xf6')){this[_0x031f('0xc')][_0x031f('0xaa')](util[_0x031f('0xa2')]('DIALOGFLOW_%s',_0x41d156[_0x031f('0x69')]()),_0x365859[_0x41d156]);}}}this[_0x031f('0x42')](_0x365859[_0x031f('0xf1')],_0x031f('0xef'),'dialogflowV2',_0x365859['providerResponse']);return this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')](_0x031f('0xf7'),_0x365859['speech']));}return this[_0x031f('0xc')][_0x031f('0x2a')](_0x577da0,_0x031f('0xf8'));};AGIVertices['prototype'][_0x031f('0xf9')]=function(_0x35a723){logger['info'](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x35a723[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x35a723[_0x031f('0xfa')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xfb'));}if(!this[_0x031f('0x85')](_0x35a723['username'])){return this[_0x031f('0xc')]['noop'](_0x031f('0xfc'));}if(!this[_0x031f('0x85')](_0x35a723['password'])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xfd'));}if(!this[_0x031f('0x85')](_0x35a723[_0x031f('0xfe')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xca'));}this['channel'][_0x031f('0xed')]=!![];this[_0x031f('0x35')](_0x35a723);this[_0x031f('0x42')](_0x35a723['text'],'in','','');this['channel'][_0x031f('0xae')](util['format'](_0x031f('0xff'),_0x35a723['text']));var _0x5b832d=this['sestekNDA'][_0x031f('0x6f')](this,_0x35a723);if(_0x5b832d){for(var _0x2ca4a6 in _0x5b832d){if(_0x5b832d[_0x031f('0x99')](_0x2ca4a6)){this[_0x031f('0xc')][_0x031f('0xaa')](util[_0x031f('0xa2')]('SESTEK_NDA_%s',_0x2ca4a6[_0x031f('0x69')]()),_0x5b832d[_0x2ca4a6]);}}this['createSquareMessage'](_0x5b832d['speech'],'out',_0x031f('0xf9'),'');if(_0x5b832d[_0x031f('0x100')]){this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x101'),_0x5b832d[_0x031f('0x100')]));var _0x401c22=this[_0x031f('0xc')][_0x031f('0x102')](_0x5b832d['audiofile']);try{fs[_0x031f('0x103')](_0x5b832d[_0x031f('0x100')]+_0x031f('0x104'));}catch(_0x222bdb){logger['error'](_0x222bdb);}return _0x401c22;}else{return this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')](_0x031f('0x105'),_0x5b832d[_0x031f('0xf1')]));}}return this['channel'][_0x031f('0x2a')](_0x35a723,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x031f('0xf')][_0x031f('0x106')]=function(_0x1f6c23){logger[_0x031f('0x2c')](util[_0x031f('0xa2')]('Enter\x20in\x20END\x20(%s)\x20block',_0x1f6c23[_0x031f('0x36')]));return this[_0x031f('0xc')]['noop']('end');};AGIVertices['prototype'][_0x031f('0x107')]=function(_0x3a3058){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x108'),_0x3a3058[_0x031f('0x36')]));var _0x42cf58='';if(_0x3a3058['trunk_id']){if(!this[_0x031f('0x85')](_0x3a3058[_0x031f('0x109')])){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x3a3058,'no\x20trunk\x20selected');}else{var _0x119db3=parseInt(_0x3a3058[_0x031f('0x109')],0xa);if(isNaN(_0x119db3)){_0x42cf58=_0x3a3058[_0x031f('0x109')];}else{_0x42cf58=this['getTrunk'][_0x031f('0x6f')](this,_0x3a3058['trunk_id']);if(!_0x42cf58){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x3a3058,_0x031f('0x10a'));}}}}else if(_0x3a3058[_0x031f('0x10b')]){_0x42cf58=_0x3a3058[_0x031f('0x10b')];}else{return this[_0x031f('0xc')][_0x031f('0x2a')](_0x3a3058,_0x031f('0x10c'));}var _0x17d422=this[_0x031f('0xc')][_0x031f('0x58')](_0x031f('0xe6'),[util[_0x031f('0xa2')]('SIP/%s/%s',_0x42cf58,_0x3a3058[_0x031f('0x4a')]),_0x3a3058[_0x031f('0x64')],_0x3a3058['opts'],_0x3a3058[_0x031f('0xe9')]]);if(_0x17d422[_0x031f('0xb0')]===-0x1){return _0x17d422;}return this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x031f('0xf')]['finally']=function(_0x303ca9){logger['info'](util[_0x031f('0xa2')](_0x031f('0x10d'),_0x303ca9[_0x031f('0x36')]));return this['channel']['noop'](_0x031f('0x10e'));};AGIVertices[_0x031f('0xf')][_0x031f('0xa')]=function(_0x4ee78c){logger[_0x031f('0x2c')](util[_0x031f('0xa2')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x4ee78c['label']));if(_0x4ee78c[_0x031f('0xac')]===0x0){return this[_0x031f('0xab')](_0x4ee78c);}_0x4ee78c[_0x031f('0xac')]-=0x1;if(!this[_0x031f('0x85')](_0x4ee78c[_0x031f('0x10f')])){return this['channel']['error'](_0x4ee78c,_0x031f('0x110'));}var _0x2e9167=this['getSound'][_0x031f('0x6f')](this,_0x4ee78c[_0x031f('0x10f')]);if(!_0x2e9167){return this['channel'][_0x031f('0x2a')](_0x4ee78c,_0x031f('0x111'));}if(!this['isConfigured'](_0x4ee78c[_0x031f('0xda')])){return this[_0x031f('0xc')]['error'](_0x031f('0xdb'));}var _0x35a7fa=this[_0x031f('0xc')]['getData'](_0x2e9167,_0x4ee78c[_0x031f('0x112')],_0x4ee78c['maxdigit']);var _0x7362fa=_0x35a7fa[_0x031f('0xb0')]?_0x35a7fa[_0x031f('0xb0')][_0x031f('0xa7')]():'';logger[_0x031f('0x2c')](_0x031f('0x113'),JSON['stringify'](_0x35a7fa));if(_0x35a7fa[_0x031f('0xb0')]===-0x1){this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x4ee78c,_0x7362fa);return _0x35a7fa;}else if(_0x35a7fa[_0x031f('0xa6')]===_0x031f('0x64')){_0x35a7fa['result']=_0x7362fa[_0x031f('0xa0')]>=parseInt(_0x4ee78c[_0x031f('0x114')])?'x':'i';}else{_0x35a7fa[_0x031f('0xb0')]=_0x7362fa[_0x031f('0xa0')]>=parseInt(_0x4ee78c[_0x031f('0x114')])&&_0x7362fa[_0x031f('0xa0')]<=parseInt(_0x4ee78c[_0x031f('0x115')])?'x':'i';}var _0x164886=this[_0x031f('0x10')][_0x031f('0x6f')](this,_0x4ee78c[_0x031f('0xda')]);if(!_0x164886){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x4ee78c,'no\x20variable\x20found');}this[_0x031f('0xc')][_0x031f('0xaa')](_0x164886,_0x7362fa);if(this[_0x031f('0x85')](_0x4ee78c[_0x031f('0x116')])){var _0x2d9a17=parseInt(_0x4ee78c['hiddendigitsnum'],0xa);var _0x143a26=rs[_0x031f('0x117')]({'charset':'*','length':_0x2d9a17});var _0x51f375=_0x7362fa['length'];if(_0x51f375>0x0){if(_0x51f375>_0x2d9a17){this[_0x031f('0x35')]['sync'](this,_0x4ee78c,_0x4ee78c[_0x031f('0x118')]===_0x031f('0x119')?_0x143a26+_0x7362fa[_0x031f('0x11a')](_0x2d9a17):_0x7362fa[_0x031f('0x11a')](0x0,_0x51f375-_0x2d9a17)+_0x143a26);}else{this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x4ee78c,rs['generate']({'charset':'*','length':_0x51f375}));}}else{this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x4ee78c,'');}}else{this[_0x031f('0x35')]['sync'](this,_0x4ee78c,_0x7362fa);}return _0x35a7fa;};AGIVertices[_0x031f('0xf')][_0x031f('0xb')]=function(_0x1855f2){logger[_0x031f('0x2c')](util[_0x031f('0xa2')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x1855f2['label']));return this[_0x031f('0xa')](_0x1855f2);};AGIVertices[_0x031f('0xf')][_0x031f('0x11b')]=function(_0x11f0c2){logger[_0x031f('0x2c')](util[_0x031f('0xa2')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x11f0c2[_0x031f('0x36')]));this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x11f0c2,_0x11f0c2[_0x031f('0x11c')]);return this['channel']['noop'](util[_0x031f('0xa2')](_0x031f('0x11d'),_0x11f0c2[_0x031f('0x11c')]));};AGIVertices[_0x031f('0xf')]['awspolly']=function(_0x55d3be){logger[_0x031f('0x2c')](util['format'](_0x031f('0x11e'),_0x55d3be[_0x031f('0x36')]));if(!this['isConfigured'](_0x55d3be[_0x031f('0x8e')])||!this['isConfigured'](_0x55d3be[_0x031f('0x88')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x11f'));}if(!this[_0x031f('0x85')](_0x55d3be[_0x031f('0x5c')])){return this[_0x031f('0xc')]['noop'](_0x031f('0xca'));}this[_0x031f('0xc')][_0x031f('0xae')](util['format']('Trying\x20aws\x20Polly\x20%s',_0x55d3be[_0x031f('0x5c')]));var _0x4e801c=this[_0x031f('0x87')][_0x031f('0x6f')](this,_0x55d3be);if(_0x4e801c){this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')]('aws\x20Polly\x20%s\x20file\x20created',_0x4e801c));var _0x2dac82=this[_0x031f('0xc')][_0x031f('0x102')](_0x4e801c);try{fs[_0x031f('0x103')](_0x4e801c+_0x031f('0x104'));}catch(_0x46c076){logger[_0x031f('0x2a')](_0x46c076);}return _0x2dac82;}return this[_0x031f('0xc')]['error'](_0x55d3be,_0x031f('0x120'));};AGIVertices['prototype']['awslex']=function(_0x2243ff){logger[_0x031f('0x2c')](util['format'](_0x031f('0x121'),_0x2243ff[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x2243ff[_0x031f('0x8e')])||!this[_0x031f('0x85')](_0x2243ff[_0x031f('0x88')])){return this['channel'][_0x031f('0xae')](_0x031f('0x11f'));}if(!this['isConfigured'](_0x2243ff[_0x031f('0x90')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x122'));}if(!this[_0x031f('0x85')](_0x2243ff['text'])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xca'));}this['channel'][_0x031f('0xed')]=!![];this['createSquareDetailsReport'](_0x2243ff);this[_0x031f('0x42')](_0x2243ff[_0x031f('0x5c')],'in','','');this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')](_0x031f('0x123'),_0x2243ff[_0x031f('0x5c')]));var _0x3509e3=this[_0x031f('0x8d')][_0x031f('0x6f')](this,_0x2243ff);if(_0x3509e3){for(var _0x3e3f24 in _0x3509e3){if(_0x3509e3[_0x031f('0x99')](_0x3e3f24)&&_[_0x031f('0x9a')](_0x3509e3[_0x3e3f24])){this[_0x031f('0xc')][_0x031f('0xaa')](util[_0x031f('0xa2')](_0x031f('0x124'),_0x3e3f24[_0x031f('0x69')]()),_0x3509e3[_0x3e3f24]);}}if(_[_0x031f('0x45')](_0x3509e3[_0x031f('0x125')])){return this['channel'][_0x031f('0xae')](_0x031f('0x126'));}else{this[_0x031f('0x42')](_0x3509e3[_0x031f('0x125')],_0x031f('0xef'),_0x031f('0x127'),'');return this[_0x031f('0xc')]['noop'](util['format'](_0x031f('0x128'),_0x3509e3[_0x031f('0x125')]));}}return this[_0x031f('0xc')][_0x031f('0x2a')](_0x2243ff,_0x031f('0x129'));};AGIVertices[_0x031f('0xf')][_0x031f('0x12a')]=function(_0x255010){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x12b'),_0x255010[_0x031f('0x36')],_0x255010['timeout']));if(!this[_0x031f('0x85')](_0x255010[_0x031f('0x78')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x12c'));}var _0x247873=_0x031f('0x12d');var _0x117185=util['format'](_0x031f('0x12e'),FILES_PATH,rs[_0x031f('0x117')](0x4));var _0x1e71b1=util[_0x031f('0xa2')](_0x031f('0xa3'),_0x117185,_0x247873);var _0x251dc5=!![];if(_0x255010[_0x031f('0x12f')]===_0x031f('0x130')){_0x251dc5=![];}var _0x594acb=this[_0x031f('0xc')][_0x031f('0x131')](_0x117185,_0x247873,_0x255010[_0x031f('0x132')],_0x255010[_0x031f('0x64')],undefined,_0x251dc5);if(_0x594acb[_0x031f('0xb0')]!==-0x1){this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')]('google\x20%s\x20file\x20created',_0x1e71b1));var _0xb61d95=this[_0x031f('0x91')][_0x031f('0x6f')](this,_0x255010,_0x1e71b1);if(_0xb61d95){for(var _0x223bbd in _0xb61d95){if(_0xb61d95['hasOwnProperty'](_0x223bbd)){this[_0x031f('0xc')][_0x031f('0xaa')](util[_0x031f('0xa2')](_0x031f('0x133'),_0x223bbd[_0x031f('0x69')]()),_0xb61d95[_0x223bbd]);}}return this['channel']['noop'](util[_0x031f('0xa2')](_0x031f('0x134'),JSON[_0x031f('0x73')](_0xb61d95)));}}return _0x594acb;};AGIVertices[_0x031f('0xf')][_0x031f('0x135')]=function(_0x56ea07){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x136'),_0x56ea07[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x56ea07['appid'])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x137'));}if(!this[_0x031f('0x85')](_0x56ea07[_0x031f('0x95')])){return this[_0x031f('0xc')][_0x031f('0xae')]('no\x20appsecret\x20configured');}var _0x572e60=_0x031f('0x12d');var _0x95ab84=util['format'](_0x031f('0x12e'),FILES_PATH,rs[_0x031f('0x117')](0x4));var _0x45125d=util['format'](_0x031f('0xa3'),_0x95ab84,_0x572e60);var _0x145ace=!![];if(_0x56ea07[_0x031f('0x12f')]==='NOBEEP'){_0x145ace=![];}var _0x3956b6=this[_0x031f('0xc')][_0x031f('0x131')](_0x95ab84,_0x572e60,_0x56ea07['intKey'],_0x56ea07[_0x031f('0x64')],undefined,_0x145ace);if(_0x3956b6['result']!==-0x1){this[_0x031f('0xc')]['noop'](util['format'](_0x031f('0x138'),_0x45125d));var _0x253a69=this[_0x031f('0x93')][_0x031f('0x6f')](this,_0x56ea07,_0x45125d);if(_0x253a69){for(var _0x2a35b7 in _0x253a69){if(_0x253a69['hasOwnProperty'](_0x2a35b7)){this[_0x031f('0xc')][_0x031f('0xaa')](util[_0x031f('0xa2')](_0x031f('0x139'),_0x2a35b7[_0x031f('0x69')]()),_0x253a69[_0x2a35b7]);}}return this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x13a'),JSON[_0x031f('0x73')](_0x253a69)));}}return _0x3956b6;};AGIVertices['prototype'][_0x031f('0x13b')]=function(_0x5acbd3){logger['info'](util[_0x031f('0xa2')](_0x031f('0x13c'),_0x5acbd3['label']));return this['channel'][_0x031f('0x13d')](_0x5acbd3[_0x031f('0x3c')],_0x5acbd3['extension'],_0x5acbd3['priority']);};AGIVertices['prototype']['gotoif']=function(_0x37baed){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x13e'),_0x37baed['label']));if(!this[_0x031f('0x85')](_0x37baed['condition'])){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x37baed,'no\x20condition\x20configured');}try{var _0x4f61ee=eval(_0x37baed[_0x031f('0x13f')])?_0x031f('0x140'):_0x031f('0x141');this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')]('EVAL\x20CONDITION\x20%s\x20%s',_0x37baed['condition'],_0x4f61ee));return{'code':0xc8,'result':_0x4f61ee};}catch(_0x1b66bd){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x031f('0xf')]['gotoiftime']=function(_0x3d5bf6){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x142'),_0x3d5bf6[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x3d5bf6[_0x031f('0x143')])){return this['channel'][_0x031f('0x2a')](_0x3d5bf6,_0x031f('0x144'));}var _0x1dc23d=this[_0x031f('0x23')][_0x031f('0x6f')](this,_0x3d5bf6['interval_id']);if(!_0x1dc23d){return this['channel'][_0x031f('0x2a')](_0x3d5bf6,_0x031f('0x145'));}for(var _0x224ddf=0x0;_0x224ddf<_0x1dc23d[_0x031f('0xa0')];_0x224ddf+=0x1){var _0x3e1e54=this[_0x031f('0xc')][_0x031f('0x10')](util[_0x031f('0xa2')](_0x031f('0x146'),_0x1dc23d[_0x224ddf]));if(_0x3e1e54['result']===-0x1){return _0x3e1e54;}logger['info'](util[_0x031f('0xa2')](_0x031f('0x147'),_0x1dc23d[_0x224ddf],_0x3e1e54['extra']));if(_0x3e1e54[_0x031f('0xa6')]===_0x031f('0x140')){logger['info'](util[_0x031f('0xa2')](_0x031f('0x147'),_0x1dc23d[_0x224ddf],_0x031f('0x140')));this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x147'),_0x1dc23d[_0x224ddf],_0x031f('0x140')));return{'code':0xc8,'result':'true'};}else{logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x147'),_0x1dc23d[_0x224ddf],'false'));this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x147'),_0x1dc23d[_0x224ddf],'false'));}}return{'code':0xc8,'result':_0x031f('0x141')};};AGIVertices['prototype'][_0x031f('0x148')]=function(_0x1eb358){logger['info'](util[_0x031f('0xa2')](_0x031f('0x149'),_0x1eb358[_0x031f('0x36')]));return this[_0x031f('0xc')][_0x031f('0x148')]();};AGIVertices[_0x031f('0xf')][_0x031f('0x14a')]=function(_0x1f5578){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x14b'),_0x1f5578[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x1f5578[_0x031f('0x78')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x12c'));}var _0x13f901='wav';var _0x71fe50=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x031f('0x117')](0x4));var _0x35947e=util[_0x031f('0xa2')]('%s.%s',_0x71fe50,_0x13f901);var _0xef9c9=!![];if(_0x1f5578[_0x031f('0x12f')]===_0x031f('0x130')){_0xef9c9=![];}var _0x472f13=this[_0x031f('0xc')][_0x031f('0x131')](_0x71fe50,_0x13f901,_0x1f5578['intKey'],_0x1f5578['timeout'],undefined,_0xef9c9);if(_0x472f13['result']!==-0x1){this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')]('ispeech\x20%s\x20file\x20created',_0x35947e));var _0x5495b3=this['ispeechASR'][_0x031f('0x6f')](this,_0x1f5578,_0x35947e);if(_0x5495b3){for(var _0x3694ae in _0x5495b3){if(_0x5495b3[_0x031f('0x99')](_0x3694ae)){this[_0x031f('0xc')][_0x031f('0xaa')](util['format']('ISPEECH_ASR_%s',_0x3694ae[_0x031f('0x69')]()),_0x5495b3[_0x3694ae]);}}return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x14c'),JSON[_0x031f('0x73')](_0x5495b3)));}}return _0x472f13;};AGIVertices[_0x031f('0xf')][_0x031f('0x14d')]=function(_0x306e31){logger[_0x031f('0x2c')](util['format'](_0x031f('0x14e'),_0x306e31['label']));if(!this[_0x031f('0x85')](_0x306e31[_0x031f('0x78')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x12c'));}if(!this['isConfigured'](_0x306e31[_0x031f('0x5c')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xca'));}this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x14f'),_0x306e31[_0x031f('0x5c')]));var _0xbf5c81=this[_0x031f('0x80')]['sync'](this,_0x306e31);if(_0xbf5c81){this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x150'),_0xbf5c81));var _0x3ce468=this[_0x031f('0xc')][_0x031f('0x102')](_0xbf5c81,_0x306e31[_0x031f('0x132')]);try{fs[_0x031f('0x103')](_0xbf5c81+_0x031f('0x104'));}catch(_0xdcf2a8){logger[_0x031f('0x2a')](_0xdcf2a8);}return _0x3ce468;}return this[_0x031f('0xc')][_0x031f('0x2a')](_0x306e31,_0x031f('0x151'));};AGIVertices['prototype'][_0x031f('0x152')]=function(_0x5c0bc8){logger[_0x031f('0x2c')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x5c0bc8[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x5c0bc8['findBy'])){return this['channel'][_0x031f('0x2a')](_0x5c0bc8,_0x031f('0x153'));}logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x154'),this[_0x031f('0xc')][_0x031f('0x39')],_0x5c0bc8[_0x031f('0x155')]));var _0x37532b=this[_0x031f('0x56')][_0x031f('0x6f')](this,_0x5c0bc8[_0x031f('0x155')]);if(_0x37532b){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x156'),this[_0x031f('0xc')][_0x031f('0x39')],_0x5c0bc8[_0x031f('0x155')]));this['channel']['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x5c0bc8[_0x031f('0x155')]));return{'code':0xc8,'result':_0x031f('0x157')};}else{logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x158'),this[_0x031f('0xc')]['callerid'],_0x5c0bc8[_0x031f('0x155')]));this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x031f('0xc')][_0x031f('0x39')],_0x5c0bc8[_0x031f('0x155')]));return{'code':0xc8,'result':_0x031f('0x159')};}};AGIVertices[_0x031f('0xf')][_0x031f('0x15a')]=function(_0x87d5ce){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x15b'),_0x87d5ce[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x87d5ce['findBy'])){return this[_0x031f('0xc')]['error'](_0x87d5ce,'no\x20find\x20by\x20configured');}logger[_0x031f('0x2c')](util['format'](_0x031f('0x154'),this['channel'][_0x031f('0x39')],_0x87d5ce[_0x031f('0x155')]));var _0x2de828=this[_0x031f('0x52')][_0x031f('0x6f')](this,_0x87d5ce['findBy']);if(_0x2de828){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x156'),this[_0x031f('0xc')]['callerid'],_0x87d5ce[_0x031f('0x155')]));this[_0x031f('0xc')][_0x031f('0xae')](util['format'](_0x031f('0x156'),this[_0x031f('0xc')]['callerid'],_0x87d5ce['findBy']));return{'code':0xc8,'result':_0x031f('0x157')};}else{logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x158'),this['channel'][_0x031f('0x39')],_0x87d5ce[_0x031f('0x155')]));this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x158'),this[_0x031f('0xc')][_0x031f('0x39')],_0x87d5ce[_0x031f('0x155')]));return{'code':0xc8,'result':_0x031f('0x159')};}};AGIVertices['prototype'][_0x031f('0x15c')]=function(_0x3a35c3){logger[_0x031f('0x2c')](util['format'](_0x031f('0x15d'),_0x3a35c3[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x3a35c3[_0x031f('0x15e')])){return this['channel'][_0x031f('0x2a')](_0x3a35c3,'no\x20operation\x20configured');}this[_0x031f('0xc')]['noop'](util['format']('math\x20%s',_0x3a35c3[_0x031f('0x15e')]));var _0x39cb44=eval(_0x3a35c3[_0x031f('0x15e')]);if(!this[_0x031f('0x85')](_0x3a35c3['variable_id'])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xdb'));}var _0xbc917a=this[_0x031f('0x10')]['sync'](this,_0x3a35c3[_0x031f('0xda')]);if(!_0xbc917a){return this[_0x031f('0xc')]['error'](_0x3a35c3,_0x031f('0xdc'));}if(_[_0x031f('0x9f')](_0x39cb44)){var _0xca5b4f=this;_0x39cb44[_0x031f('0xdd')](function(_0x5e35af,_0x28f1fa){_0xca5b4f[_0x031f('0xc')][_0x031f('0xaa')](util[_0x031f('0xa2')](_0x031f('0x15f'),_0xbc917a,_0x28f1fa),_0x5e35af);});return this[_0x031f('0xc')]['noop'](util['format'](_0x031f('0x160'),_0xbc917a));}else{return this['channel'][_0x031f('0xaa')](_0xbc917a,_0x39cb44);}};AGIVertices[_0x031f('0xf')][_0x031f('0x9')]=function(_0x2edcc6){logger[_0x031f('0x2c')](util[_0x031f('0xa2')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x2edcc6['label']));if(_0x2edcc6[_0x031f('0xac')]===0x0){return this['maxRetry'](_0x2edcc6);}_0x2edcc6['retry']-=0x1;if(!this[_0x031f('0x85')](_0x2edcc6[_0x031f('0x10f')])){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x2edcc6,_0x031f('0x110'));}var _0x56d18d=this[_0x031f('0x1c')][_0x031f('0x6f')](this,_0x2edcc6['file_id']);if(!_0x56d18d){return this[_0x031f('0xc')]['error'](_0x2edcc6,_0x031f('0x111'));}var _0x36321f=this[_0x031f('0xc')][_0x031f('0x161')](_0x56d18d,_0x2edcc6[_0x031f('0x112')],_0x2edcc6['digit']);var _0x39dace=_0x36321f[_0x031f('0xb0')];if(_0x36321f[_0x031f('0xb0')]===-0x1){this[_0x031f('0x35')]['sync'](this,_0x2edcc6,'-1');return _0x36321f;}else if(_0x36321f['extra']===_0x031f('0x64')){_0x36321f[_0x031f('0xb0')]=_0x36321f['result'][_0x031f('0xa0')]>0x0?_0x36321f['result']:'t';}else if(_[_0x031f('0x48')](_0x36321f[_0x031f('0xb0')])){_0x36321f[_0x031f('0xb0')]='#';_0x39dace='#';}if(!this[_0x031f('0x85')](_0x2edcc6[_0x031f('0xda')])){this[_0x031f('0xc')][_0x031f('0xae')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x5c2cb3=this[_0x031f('0x10')][_0x031f('0x6f')](this,_0x2edcc6[_0x031f('0xda')]);if(!_0x5c2cb3){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x2edcc6,'no\x20variable\x20found');}this[_0x031f('0xc')][_0x031f('0xaa')](_0x5c2cb3,_0x39dace);}this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x2edcc6,_0x39dace);return _0x36321f;};AGIVertices[_0x031f('0xf')]['noop']=function(_0x3e4073){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x162'),_0x3e4073[_0x031f('0x36')]));return this['channel']['noop'](_0x3e4073['output']||_0x3e4073[_0x031f('0x36')]);};AGIVertices['prototype'][_0x031f('0x163')]=function(_0x507069){logger['info'](util[_0x031f('0xa2')](_0x031f('0x164'),_0x507069[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x507069[_0x031f('0x155')])){return this['channel'][_0x031f('0x2a')](_0x507069,_0x031f('0x153'));}logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x154'),this[_0x031f('0xc')]['callerid'],_0x507069[_0x031f('0x155')]));var _0x207752=this['getPause'][_0x031f('0x6f')](this,_0x507069[_0x031f('0x165')]);var _0x4c8388=this[_0x031f('0x4f')]['sync'](this,_0x507069[_0x031f('0x155')],_0x207752);if(_0x4c8388){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x156'),this['channel'][_0x031f('0x39')],_0x507069[_0x031f('0x155')]));this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x156'),this[_0x031f('0xc')][_0x031f('0x39')],_0x507069['findBy']));return{'code':0xc8,'result':_0x031f('0x157')};}else{logger['info'](util[_0x031f('0xa2')](_0x031f('0x158'),this[_0x031f('0xc')]['callerid'],_0x507069[_0x031f('0x155')]));this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x031f('0x39')],_0x507069[_0x031f('0x155')]));return{'code':0xc8,'result':_0x031f('0x159')};}};AGIVertices[_0x031f('0xf')][_0x031f('0x166')]=function(_0x2b0cb2){logger['info'](util[_0x031f('0xa2')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x2b0cb2[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x2b0cb2[_0x031f('0x10f')])){return this[_0x031f('0xc')]['error'](_0x2b0cb2,_0x031f('0x110'));}var _0x228b4e=this[_0x031f('0x1c')][_0x031f('0x6f')](this,_0x2b0cb2[_0x031f('0x10f')]);if(!_0x228b4e){return this['channel'][_0x031f('0x2a')](_0x2b0cb2,_0x031f('0x111'));}var _0x385449=this[_0x031f('0xc')][_0x031f('0x58')](_0x031f('0x167'),[_0x228b4e,_0x2b0cb2[_0x031f('0xe8')]]);if(_0x385449[_0x031f('0xb0')]===-0x1){return _0x385449;}return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')]('Executed\x20command\x20%s\x20%s',_0x031f('0x167'),_0x228b4e));};AGIVertices[_0x031f('0xf')][_0x031f('0x168')]=function(_0xa195c9){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x169'),_0xa195c9[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0xa195c9[_0x031f('0x16a')])){return this['channel'][_0x031f('0x2a')](_0xa195c9,_0x031f('0x16b'));}var _0xf4dcc1='';var _0x392023=parseInt(_0xa195c9[_0x031f('0x16a')],0xa);if(isNaN(_0x392023)){_0xf4dcc1=_0xa195c9['queue_id'];}else{_0xf4dcc1=this[_0x031f('0x16c')]['sync'](this,_0xa195c9[_0x031f('0x16a')]);if(!_0xf4dcc1){return this[_0x031f('0xc')][_0x031f('0x2a')](_0xa195c9,_0x031f('0x16d'));}}var _0x4efbc4='';if(this['isConfigured'](_0xa195c9['file_id'])){var _0x23b0fa=this['getSound'][_0x031f('0x6f')](this,_0xa195c9[_0x031f('0x10f')]);if(_0x23b0fa){_0x4efbc4=_0x23b0fa;}}this[_0x031f('0x35')]['sync'](this,_0xa195c9,_0xf4dcc1);if(_0xa195c9[_0x031f('0xe8')][_0x031f('0x16e')]('x')<0x0){_0xa195c9[_0x031f('0xe8')]+='x';}if(_0xa195c9[_0x031f('0xe8')]['indexOf']('X')<0x0){_0xa195c9['opts']+='X';}this['channel']['setVariable'](_0x031f('0x16f'),_0xf4dcc1?_0xf4dcc1['toLowerCase']():'');var _0x191f2b=this[_0x031f('0xc')][_0x031f('0x58')]('QUEUE',[_0xf4dcc1,_0xa195c9[_0x031f('0xe8')],_0xa195c9[_0x031f('0xe9')],_0x4efbc4,_0xa195c9['timeout'],_0xa195c9['agi'],_0xa195c9['macro'],_0xa195c9[_0x031f('0x170')],'',_0xa195c9[_0x031f('0x171')]]);if(_0x191f2b[_0x031f('0xb0')]===-0x1){return _0x191f2b;}return this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0xc9'),_0x031f('0x172'),_0xf4dcc1));};AGIVertices[_0x031f('0xf')][_0x031f('0x173')]=function(_0x713382){logger['info'](util[_0x031f('0xa2')](_0x031f('0x174'),_0x713382[_0x031f('0x36')]));var _0x59f082=_0x713382[_0x031f('0x175')]||'wav';var _0x17cba3=util['format'](_0x031f('0x176'),this['channel']['uniqueid'],rs[_0x031f('0x117')](0x5));var _0x272bdd=util['format'](_0x031f('0x177'),FILES_PATH,_0x17cba3,_0x59f082);var _0x5db71a=util[_0x031f('0xa2')]('%s/recordings/%s',FILES_PATH,_0x17cba3);this['createSquareRecording'][_0x031f('0x6f')](this,_0x713382,_0x17cba3,_0x272bdd);this[_0x031f('0xc')][_0x031f('0xaa')]('RECORDING_SAVENAME',_0x17cba3);logger['info'](_0x031f('0x178'),_0x5db71a,_0x59f082,_0x713382[_0x031f('0x179')],_0x713382[_0x031f('0x64')]);return this[_0x031f('0xc')][_0x031f('0x131')](_0x5db71a,_0x59f082,_0x713382[_0x031f('0x179')],_0x713382[_0x031f('0x64')],undefined,!![]);};AGIVertices[_0x031f('0xf')]['restapi']=function(_0x24039b){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x17a'),_0x24039b['label']));if(!this[_0x031f('0x85')](_0x24039b[_0x031f('0xe9')])){return this[_0x031f('0xc')]['noop'](_0x031f('0x17b'));}var _0x23701e=this['restAPI'][_0x031f('0x6f')](this,_0x24039b);logger['info'](util[_0x031f('0xa2')](_0x031f('0x17c'),util[_0x031f('0x17d')](_0x23701e,{'showHidden':![],'depth':null})));if(!this[_0x031f('0x85')](_0x24039b[_0x031f('0xda')])){return this['channel'][_0x031f('0xae')](_0x031f('0x17e'));}var _0x541989=this[_0x031f('0x10')][_0x031f('0x6f')](this,_0x24039b[_0x031f('0xda')]);if(!_0x541989){return this['channel'][_0x031f('0x2a')](_0x24039b,'no\x20variable\x20found');}this[_0x031f('0xc')]['setVariable'](util[_0x031f('0xa2')](_0x031f('0x17f'),_0x541989),_0x23701e['statusCode']?_0x23701e[_0x031f('0x75')]:'200');this['channel'][_0x031f('0xaa')](util['format']('%s_STATUS_MESSAGE',_0x541989),_0x23701e['statusMessage']?_0x23701e['statusMessage']:'OK');if(_0x23701e[_0x031f('0x74')]){try{this[_0x031f('0xa1')](_0x23701e[_0x031f('0x74')],_0x541989);}catch(_0x5a1261){logger[_0x031f('0x2a')](util[_0x031f('0xa2')](_0x031f('0x180'),_0x541989));}}return this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')](_0x031f('0xe0'),_0x541989));};AGIVertices['prototype'][_0x031f('0x181')]=function(_0x37818f){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x182'),_0x37818f[_0x031f('0x36')]));return this['channel'][_0x031f('0x183')](_0x37818f[_0x031f('0x184')][_0x031f('0xd8')](/\s+/g,''),_0x37818f['escape_digits']);};AGIVertices['prototype'][_0x031f('0x185')]=function(_0x6149d2){logger[_0x031f('0x2c')](util[_0x031f('0xa2')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x6149d2[_0x031f('0x36')]));return this['channel'][_0x031f('0x186')](_0x6149d2[_0x031f('0x65')][_0x031f('0xd8')](/\s+/g,''),_0x6149d2['escape_digits']);};AGIVertices['prototype'][_0x031f('0x187')]=function(_0x40aa41){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x188'),_0x40aa41[_0x031f('0x36')]));return this[_0x031f('0xc')][_0x031f('0x189')](_0x40aa41['text'],_0x40aa41[_0x031f('0x179')]);};AGIVertices[_0x031f('0xf')][_0x031f('0x18a')]=function(_0x277519){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x18b'),_0x277519[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x277519[_0x031f('0x18c')])){return this[_0x031f('0xc')]['noop'](_0x031f('0x18d'));}var _0xdf0bef=this['getMailAccount'][_0x031f('0x6f')](this,_0x277519['account_id']);if(!_0xdf0bef||!_0xdf0bef[_0x031f('0x18e')]){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x277519,_0x031f('0x18f'));}var _0x34b9a1={'from':util[_0x031f('0xa2')](_0x031f('0x190'),_0xdf0bef[_0x031f('0x13')],_0xdf0bef[_0x031f('0x191')]||_0xdf0bef[_0x031f('0x18e')][_0x031f('0x192')]),'to':_0x277519['to']||'','cc':_0x277519['cc']||'','bcc':_0x277519[_0x031f('0x193')]||'','subject':_0x277519[_0x031f('0x194')],'html':_0x277519[_0x031f('0x5c')],'text':_0x277519[_0x031f('0x5c')]};var _0x316e17={'tls':{'rejectUnauthorized':![]}};if(_0xdf0bef[_0x031f('0x18e')]['service']){_0x316e17[_0x031f('0x195')]=_0xdf0bef['Smtp'][_0x031f('0x195')];}else{_0x316e17['host']=_0xdf0bef[_0x031f('0x18e')][_0x031f('0x196')];_0x316e17[_0x031f('0x197')]=_0xdf0bef[_0x031f('0x18e')][_0x031f('0x197')];_0x316e17['secure']=_0xdf0bef[_0x031f('0x18e')]['secure'];}if(_0xdf0bef['Smtp']['authentication']){_0x316e17[_0x031f('0x198')]={'user':_0xdf0bef[_0x031f('0x18e')][_0x031f('0x192')],'pass':_0xdf0bef[_0x031f('0x18e')][_0x031f('0x199')]};}if(this[_0x031f('0x85')](_0x277519[_0x031f('0x19a')])){}logger['debug'](_0x031f('0x19b'),JSON[_0x031f('0x73')](_0x34b9a1));this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x277519,_0x277519['account_id']);this[_0x031f('0xc')]['noop'](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0xdf0bef[_0x031f('0x13')]));this[_0x031f('0x22')]['sync'](this,_0x316e17,_0x34b9a1);return this[_0x031f('0xc')][_0x031f('0xae')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x031f('0xf')][_0x031f('0x19c')]=function(_0x43e640){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x19d'),_0x43e640[_0x031f('0x36')]));return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x19e'));};AGIVertices['prototype'][_0x031f('0x19f')]=function(_0x138f24){logger['info'](util[_0x031f('0xa2')](_0x031f('0x1a0'),_0x138f24[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x138f24[_0x031f('0x1a1')])){return this[_0x031f('0xc')][_0x031f('0xae')]('no\x20sms\x20account\x20configured');}var _0x477dc2=this['getSmsAccount']['sync'](this,_0x138f24[_0x031f('0x1a1')]);if(!_0x477dc2){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x138f24,'no\x20sms\x20account\x20found');}var _0x2ebda6={'body':_0x138f24['sms_text'],'phone':_0x138f24['to']||'','SmsAccountId':_0x477dc2['id']};logger[_0x031f('0xe2')](_0x031f('0x1a2'),JSON[_0x031f('0x73')](_0x2ebda6));this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x138f24,_0x138f24[_0x031f('0x1a1')]);this['channel'][_0x031f('0xae')](util['format'](_0x031f('0x1a3'),_0x477dc2[_0x031f('0x13')]));this[_0x031f('0x34')][_0x031f('0x6f')](this,_0x2ebda6);return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x1a4'));};AGIVertices[_0x031f('0xf')][_0x031f('0x1a5')]=function(_0x5e3267){logger['info'](util[_0x031f('0xa2')](_0x031f('0x1a6'),_0x5e3267['label']));if(!this[_0x031f('0x85')](_0x5e3267[_0x031f('0xda')])){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x5e3267,_0x031f('0x1a7'));}var _0x1d17de=this[_0x031f('0x10')][_0x031f('0x6f')](this,_0x5e3267[_0x031f('0xda')]);if(!_0x1d17de){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x5e3267,'no\x20variable\x20found');}return this[_0x031f('0xc')][_0x031f('0xaa')](_0x1d17de,_0x5e3267[_0x031f('0x1a8')]);};AGIVertices[_0x031f('0xf')][_0x031f('0x1a9')]=function(_0x29ae92){logger['info'](util[_0x031f('0xa2')](_0x031f('0x1aa'),_0x29ae92[_0x031f('0x36')]));this['channel'][_0x031f('0xae')](_0x031f('0x1ab'));if(_0x29ae92['answer']===_0x031f('0x1ac')){this['channel'][_0x031f('0xae')](_0x031f('0x1ad'));return this[_0x031f('0xc')][_0x031f('0xbe')]();}return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x1ae'));};AGIVertices[_0x031f('0xf')][_0x031f('0x1af')]=function(_0x43862f){logger['info'](util[_0x031f('0xa2')](_0x031f('0x1b0'),_0x43862f[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x43862f[_0x031f('0x1b1')])){return this[_0x031f('0xc')]['error'](_0x43862f,_0x031f('0x1b2'));}var _0x4c7c4d=this['getSquareProject'][_0x031f('0x6f')](this,_0x43862f['project_id']);if(!this[_0x031f('0x85')](_0x4c7c4d)){return this['channel']['error'](_0x43862f,util[_0x031f('0xa2')](_0x031f('0x1b3'),_0x43862f['project_id']));}if(_0x4c7c4d===this['channel']['arg_1']){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x43862f,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x43862f,_0x4c7c4d);var _0x483cc9=this[_0x031f('0xc')][_0x031f('0x58')](_0x031f('0x1b4'),util['format'](_0x031f('0x1b5'),config[_0x031f('0x7')][_0x031f('0x196')]||_0x031f('0x1b6'),_0x4c7c4d,this[_0x031f('0xc')]['arg_1']));if(_0x483cc9['result']===-0x1){return _0x483cc9;}return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0xc9'),_0x031f('0x1b4'),_0x4c7c4d));};AGIVertices['prototype'][_0x031f('0x1b7')]=function(_0x56aefe){logger['info'](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x56aefe[_0x031f('0x36')]));var _0x5c3813=this[_0x031f('0x57')][_0x031f('0x6f')](this,_0x56aefe[_0x031f('0x1b8')]);this['createSquareDetailsReport']['sync'](this,_0x56aefe,_0x56aefe[_0x031f('0x1b8')]);if(this[_0x031f('0x85')](_0x56aefe[_0x031f('0xda')])){var _0x3bcd13=this[_0x031f('0x10')]['sync'](this,_0x56aefe[_0x031f('0xda')]);if(_0x3bcd13){this[_0x031f('0xc')]['setVariable'](_0x3bcd13,_0x5c3813);return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x1b9'),_0x56aefe[_0x031f('0x1b8')],_0x3bcd13));}}return this[_0x031f('0xc')][_0x031f('0xae')](util['format'](_0x031f('0x1ba'),_0x56aefe[_0x031f('0x1b8')]));};AGIVertices[_0x031f('0xf')]['google_cloud_tts']=function(_0x255166){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x1bb'),_0x255166[_0x031f('0x36')]));_0x255166['text']=_0x255166[_0x031f('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x255166[_0x031f('0x5b')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x1bc'));}if(!this[_0x031f('0x85')](_0x255166['text'])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xca'));}this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x1bd'),_0x255166[_0x031f('0x5c')]));var _0x375440=this['googleCloudTTS'][_0x031f('0x6f')](this,_0x255166);if(_0x375440){this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x1be'),_0x375440));var _0x4a20c0=this['channel'][_0x031f('0x102')](_0x375440);try{fs[_0x031f('0x103')](_0x375440+_0x031f('0x104'));}catch(_0x3dedb9){logger['error'](_0x3dedb9);}return _0x4a20c0;}return this[_0x031f('0xc')][_0x031f('0x2a')](_0x255166,_0x031f('0x1bf'));};AGIVertices[_0x031f('0xf')][_0x031f('0x1c0')]=function(_0x49c677){logger['info'](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x49c677[_0x031f('0x36')]));_0x49c677['text']=_0x49c677['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x031f('0x85')](_0x49c677[_0x031f('0x5c')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xca'));}this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')]('Trying\x20Google\x20TTS\x20%s',_0x49c677[_0x031f('0x5c')]));var _0x44dce7=this[_0x031f('0x62')][_0x031f('0x6f')](this,_0x49c677);if(_0x44dce7){this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x1c1'),_0x44dce7));var _0x762902=this['channel'][_0x031f('0x102')](_0x44dce7);try{fs['unlink'](_0x44dce7+_0x031f('0x104'));}catch(_0x5ce8aa){logger[_0x031f('0x2a')](_0x5ce8aa);}return _0x762902;}return this['channel']['error'](_0x49c677,_0x031f('0x1c2'));};AGIVertices['prototype']['unpause']=function(_0x596ba0){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x1c3'),_0x596ba0[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x596ba0[_0x031f('0x155')])){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x596ba0,_0x031f('0x153'));}logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x154'),this[_0x031f('0xc')][_0x031f('0x39')],_0x596ba0['findBy']));var _0x484edb=this[_0x031f('0x51')][_0x031f('0x6f')](this,_0x596ba0[_0x031f('0x155')]);if(_0x484edb){logger[_0x031f('0x2c')](util[_0x031f('0xa2')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x031f('0xc')][_0x031f('0x39')],_0x596ba0['findBy']));this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x031f('0xc')]['callerid'],_0x596ba0[_0x031f('0x155')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x031f('0x158'),this[_0x031f('0xc')]['callerid'],_0x596ba0[_0x031f('0x155')]));this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')](_0x031f('0x158'),this[_0x031f('0xc')][_0x031f('0x39')],_0x596ba0[_0x031f('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x031f('0xf')]['voicemail']=function(_0xfde8dc){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x1c4'),_0xfde8dc[_0x031f('0x36')]));var _0x15acb9=this[_0x031f('0xc')][_0x031f('0x58')]('VOICEMAIL',[_0xfde8dc[_0x031f('0x1c5')],_0xfde8dc[_0x031f('0x77')]]);if(_0x15acb9[_0x031f('0xb0')]===-0x1){return _0x15acb9;}return this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')](_0x031f('0xc9'),_0x031f('0x1c6'),_0xfde8dc[_0x031f('0x1c5')]));};AGIVertices['prototype'][_0x031f('0x1c7')]=function(_0x5aa03a){logger['info'](util['format'](_0x031f('0x1c8'),_0x5aa03a[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x5aa03a[_0x031f('0xda')])){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x5aa03a,_0x031f('0x1a7'));}var _0x57e8b6=this[_0x031f('0x10')][_0x031f('0x6f')](this,_0x5aa03a['variable_id']);if(!_0x57e8b6){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x5aa03a,_0x031f('0xdc'));}var _0x5e0d09=this[_0x031f('0xc')][_0x031f('0x10')](_0x57e8b6);return{'code':0xc8,'result':_0x5e0d09[_0x031f('0xa6')]?_0x5e0d09[_0x031f('0xa6')]:'-'};};String[_0x031f('0xf')][_0x031f('0xa5')]=function(_0x3a846e,_0xbf1189){return this[_0x031f('0xa4')](_0x3a846e)[_0x031f('0x1c9')](_0xbf1189);};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 6498e23..9f979f4 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 _0x7a54=['[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[ACW][START]\x20%s','prototype','[%s][TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s'];(function(_0x12b461,_0x4987c6){var _0x356ffe=function(_0x135800){while(--_0x135800){_0x12b461['push'](_0x12b461['shift']());}};_0x356ffe(++_0x4987c6);}(_0x7a54,0x106));var _0x47a5=function(_0x27cfc6,_0xa34eb6){_0x27cfc6=_0x27cfc6-0x0;var _0x5329a1=_0x7a54[_0x27cfc6];return _0x5329a1;};'use strict';var util=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var ami=require('../ami');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x47a5('0x5'));function Acw(_0x11bf85){this[_0x47a5('0x6')]=_0x11bf85[_0x47a5('0x6')];this[_0x47a5('0x7')]=_0x11bf85['agents'];this[_0x47a5('0x8')]=_0x11bf85['timers'];this[_0x47a5('0x9')]={};ami['on'](_0x47a5('0xa'),this['syncAgentConnect'][_0x47a5('0xb')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0x47a5('0xc'),this[_0x47a5('0xd')]['bind'](this));ami['on'](_0x47a5('0xe'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x47a5('0xf'),this[_0x47a5('0x10')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x11'),this[_0x47a5('0x12')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x13'),this['syncAgentConnectPreview'][_0x47a5('0xb')](this));}function getDiff(_0x221b54){var _0x1cf309=moment()[_0x47a5('0x14')](0x0);var _0x139f25=moment(_0x221b54)[_0x47a5('0x14')](0x0);return _0x1cf309[_0x47a5('0x15')](_0x139f25,_0x47a5('0x16'));}Acw['prototype'][_0x47a5('0x17')]=function(_0x11faf5){try{var _0x3b001e=this;var _0x2a2cbb=this[_0x47a5('0x9')][_0x11faf5]['interface'];var _0x549de3=this[_0x47a5('0x9')][_0x11faf5]['queue'];var _0x5247fd=this[_0x47a5('0x6')][_0x549de3];var _0xaf70a6=![];var _0x2ce454=_0x47a5('0x18');if(_0x5247fd[_0x47a5('0x19')]){if(_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')]){_0xaf70a6=!![];_0x2ce454=_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')];}}ami['Action']({'action':_0x47a5('0x1c'),'interface':_0x2a2cbb,'paused':!![],'reason':_0x2ce454})[_0x47a5('0x1d')](function(_0x47cf3c){if(_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]){return RpcUser[_0x47a5('0x1e')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]['id'])['then'](function(_0xb8ae6c){if(_0xb8ae6c&&!_0xb8ae6c[_0x47a5('0x1f')]){logger[_0x47a5('0x20')](_0x47a5('0x21'),_0x11faf5,_0x2a2cbb,_0x549de3);var _0x5ef1b1=_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x22')]&&_0x3b001e['channels'][_0x11faf5][_0x47a5('0x23')]?_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x23')]:_0x11faf5;return RpcUser[_0x47a5('0x24')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb],_0x2ce454,_0x5ef1b1)['then'](function(_0x53078a){if(!_0xaf70a6){_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]={};logger['info'](_0x47a5('0x25'),_0x11faf5,_0x3b001e['voiceQueues'][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=setTimeout(_0x3b001e[_0x47a5('0x28')][_0x47a5('0xb')](_0x3b001e,_0x2a2cbb),_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')]*0x3e8);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x29')]=moment()[_0x47a5('0x2a')](_0x47a5('0x2b'));_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x2c')]=_0x11faf5;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2d')]=_0x549de3;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2e')]=function(){var _0x9ac908=getDiff(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]['lastPauseAt']);clearTimeout(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x9ac908},_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2c')],_0x2a2cbb)[_0x47a5('0x1d')](function(_0x5bd7eb){logger['info'](_0x47a5('0x2f'),_0x11faf5,_0x9ac908,_0x5bd7eb);})[_0x47a5('0x30')](function(_0x57bff6){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x11faf5,_0x57bff6);});delete _0x3b001e[_0x47a5('0x8')][_0x2a2cbb];};}});}else{logger[_0x47a5('0x20')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x11faf5,_0x2a2cbb,_0x549de3);}});}})['catch'](function(_0x274e34){logger['error'](_0x47a5('0x25'),_0x11faf5,_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);})['finally'](function(){delete _0x3b001e[_0x47a5('0x9')][_0x11faf5];});}catch(_0x50c086){logger['error'](_0x47a5('0x32'),_0x50c086['message']);}};Acw[_0x47a5('0x33')]['stopAcw']=function(_0x21ad34){try{var _0x3534cb=this;if(_0x3534cb[_0x47a5('0x8')][_0x21ad34]){_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x27')]=![];var _0xed6320=_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x2c')];var _0x1a0d23=_0x3534cb['timers'][_0x21ad34][_0x47a5('0x2d')];var _0x10f136=_0x3534cb['voiceQueues'][_0x1a0d23][_0x47a5('0x26')];logger[_0x47a5('0x20')](_0x47a5('0x34'),_0xed6320,_0x21ad34);RpcUser['saveUnpause'](this[_0x47a5('0x7')][_0x21ad34]);RpcVoiceAgentReport[_0x47a5('0x35')]({'acwtime':_0x10f136,'agentacw':!![]},_0xed6320,_0x21ad34)['then'](function(_0x2ebba0){logger[_0x47a5('0x20')]('[%s][UPDATE][ACWTIME:%s]',_0xed6320,_0x10f136,_0x2ebba0);})['catch'](function(_0x5ebd8c){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0xed6320,_0x5ebd8c);});}else{logger[_0x47a5('0x31')](_0x47a5('0x36'),_0x21ad34);if(_0x3534cb[_0x47a5('0x8')]){logger[_0x47a5('0x20')](_0x47a5('0x37'),JSON[_0x47a5('0x38')](_0x3534cb[_0x47a5('0x8')]));}}}catch(_0x1f3d01){logger[_0x47a5('0x31')](_0x47a5('0x39'),_0x1f3d01[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x3b')]=function(_0x56dbbd){try{if(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]['acw']||this[_0x47a5('0x6')][_0x56dbbd['queue']]['mandatoryDisposition'])){if(this['agents'][_0x56dbbd['interface']]){this[_0x47a5('0x9')][_0x56dbbd['uniqueid']]={'queue':_0x56dbbd[_0x47a5('0x2d')],'interface':_0x56dbbd[_0x47a5('0x3c')],'destlinkedid':_0x56dbbd[_0x47a5('0x23')]};}}}catch(_0x494526){logger[_0x47a5('0x31')](_0x47a5('0x3d'),_0x494526['message']);}};Acw['prototype'][_0x47a5('0x3e')]=function(_0x4edf7f){try{if(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x4')]||this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x19')])){if(this[_0x47a5('0x7')][_0x4edf7f[_0x47a5('0x3c')]]){this[_0x47a5('0x9')][_0x4edf7f[_0x47a5('0x2c')]]={'queue':_0x4edf7f[_0x47a5('0x2d')],'interface':_0x4edf7f[_0x47a5('0x3c')]};}}}catch(_0x4e5e7){logger[_0x47a5('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4e5e7[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncHangupRequest']=function(_0x52b3a8){try{if(this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]['attended'])){logger[_0x47a5('0x20')]('[%s][HANGUP:UNIQUEID]',_0x52b3a8[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x52b3a8[_0x47a5('0x40')]]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['linkedid']]['attended'])){logger[_0x47a5('0x20')](_0x47a5('0x41'),_0x52b3a8[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x40')]);}}catch(_0x2c0c86){logger[_0x47a5('0x31')]('[ACW][syncHangupRequest]\x20%s',_0x2c0c86[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0xd')]=function(_0x5c3c75){try{if(this[_0x47a5('0x9')][_0x5c3c75['uniqueid']]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x2c')]][_0x47a5('0x22')]){logger[_0x47a5('0x20')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5c3c75[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]['attended']){logger[_0x47a5('0x20')](_0x47a5('0x42'),_0x5c3c75[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x40')]);}}catch(_0x1ab0bf){logger['error'](_0x47a5('0x43'),_0x1ab0bf[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncAttendedTransfer']=function(_0x4c5ed){try{if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfereeuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x45')]);if(this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']]){this['channels'][_0x4c5ed[_0x47a5('0x46')]]['attended']=!![];this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']]=this['channels'][_0x4c5ed[_0x47a5('0x46')]];delete this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']];}}else if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x47')]);if(this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x48')]]){this[_0x47a5('0x9')][_0x4c5ed['origtransfereruniqueid']][_0x47a5('0x22')]=!![];this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x45')]]=this['channels'][_0x4c5ed[_0x47a5('0x48')]];delete this['channels'][_0x4c5ed[_0x47a5('0x48')]];}}}catch(_0x470da6){logger[_0x47a5('0x31')](_0x47a5('0x49'),_0x470da6[_0x47a5('0x3a')]);}};Acw['prototype'][_0x47a5('0x12')]=function(_0x5d1550){try{if(this['channels'][_0x5d1550['transfereruniqueid']]){logger['info'](_0x47a5('0x4a'),JSON[_0x47a5('0x38')](_0x5d1550[_0x47a5('0x4b')]));this['startAcw'](_0x5d1550['transfereruniqueid']);}else if(this[_0x47a5('0x9')][_0x5d1550[_0x47a5('0x4c')]]){logger[_0x47a5('0x20')](_0x47a5('0x4d'),JSON[_0x47a5('0x38')](_0x5d1550['transfererlinkedid']));this[_0x47a5('0x17')](_0x5d1550['transfererlinkedid']);}}catch(_0x22c886){logger[_0x47a5('0x31')]('[ACW][syncBlindTransfer]\x20%s',_0x22c886[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x4e')]=function(_0x3e8274){try{if(this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]&&this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]['autopause']===_0x47a5('0x4f')){if(this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]]){logger[_0x47a5('0x20')](_0x47a5('0x50'),_0x3e8274['uniqueid'],_0x3e8274[_0x47a5('0x3c')],_0x3e8274[_0x47a5('0x2d')]);return RpcUser[_0x47a5('0x24')](this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]],_0x47a5('0x51'),_0x3e8274[_0x47a5('0x2c')]);}}}catch(_0x149d34){logger[_0x47a5('0x31')](_0x47a5('0x52'),_0x149d34[_0x47a5('0x3a')]);}};module[_0x47a5('0x53')]=Acw; \ No newline at end of file +var _0x7a54=['[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[ACW][START]\x20%s','prototype','[%s][TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s'];(function(_0x39e85c,_0x3bca61){var _0xf96780=function(_0x3b0708){while(--_0x3b0708){_0x39e85c['push'](_0x39e85c['shift']());}};_0xf96780(++_0x3bca61);}(_0x7a54,0x106));var _0x47a5=function(_0x3cd87e,_0x3001fe){_0x3cd87e=_0x3cd87e-0x0;var _0x211f57=_0x7a54[_0x3cd87e];return _0x211f57;};'use strict';var util=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var ami=require('../ami');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x47a5('0x5'));function Acw(_0x11bf85){this[_0x47a5('0x6')]=_0x11bf85[_0x47a5('0x6')];this[_0x47a5('0x7')]=_0x11bf85['agents'];this[_0x47a5('0x8')]=_0x11bf85['timers'];this[_0x47a5('0x9')]={};ami['on'](_0x47a5('0xa'),this['syncAgentConnect'][_0x47a5('0xb')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0x47a5('0xc'),this[_0x47a5('0xd')]['bind'](this));ami['on'](_0x47a5('0xe'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x47a5('0xf'),this[_0x47a5('0x10')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x11'),this[_0x47a5('0x12')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x13'),this['syncAgentConnectPreview'][_0x47a5('0xb')](this));}function getDiff(_0x221b54){var _0x1cf309=moment()[_0x47a5('0x14')](0x0);var _0x139f25=moment(_0x221b54)[_0x47a5('0x14')](0x0);return _0x1cf309[_0x47a5('0x15')](_0x139f25,_0x47a5('0x16'));}Acw['prototype'][_0x47a5('0x17')]=function(_0x11faf5){try{var _0x3b001e=this;var _0x2a2cbb=this[_0x47a5('0x9')][_0x11faf5]['interface'];var _0x549de3=this[_0x47a5('0x9')][_0x11faf5]['queue'];var _0x5247fd=this[_0x47a5('0x6')][_0x549de3];var _0xaf70a6=![];var _0x2ce454=_0x47a5('0x18');if(_0x5247fd[_0x47a5('0x19')]){if(_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')]){_0xaf70a6=!![];_0x2ce454=_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')];}}ami['Action']({'action':_0x47a5('0x1c'),'interface':_0x2a2cbb,'paused':!![],'reason':_0x2ce454})[_0x47a5('0x1d')](function(_0x47cf3c){if(_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]){return RpcUser[_0x47a5('0x1e')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]['id'])['then'](function(_0xb8ae6c){if(_0xb8ae6c&&!_0xb8ae6c[_0x47a5('0x1f')]){logger[_0x47a5('0x20')](_0x47a5('0x21'),_0x11faf5,_0x2a2cbb,_0x549de3);var _0x5ef1b1=_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x22')]&&_0x3b001e['channels'][_0x11faf5][_0x47a5('0x23')]?_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x23')]:_0x11faf5;return RpcUser[_0x47a5('0x24')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb],_0x2ce454,_0x5ef1b1)['then'](function(_0x53078a){if(!_0xaf70a6){_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]={};logger['info'](_0x47a5('0x25'),_0x11faf5,_0x3b001e['voiceQueues'][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=setTimeout(_0x3b001e[_0x47a5('0x28')][_0x47a5('0xb')](_0x3b001e,_0x2a2cbb),_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')]*0x3e8);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x29')]=moment()[_0x47a5('0x2a')](_0x47a5('0x2b'));_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x2c')]=_0x11faf5;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2d')]=_0x549de3;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2e')]=function(){var _0x9ac908=getDiff(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]['lastPauseAt']);clearTimeout(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x9ac908},_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2c')],_0x2a2cbb)[_0x47a5('0x1d')](function(_0x5bd7eb){logger['info'](_0x47a5('0x2f'),_0x11faf5,_0x9ac908,_0x5bd7eb);})[_0x47a5('0x30')](function(_0x57bff6){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x11faf5,_0x57bff6);});delete _0x3b001e[_0x47a5('0x8')][_0x2a2cbb];};}});}else{logger[_0x47a5('0x20')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x11faf5,_0x2a2cbb,_0x549de3);}});}})['catch'](function(_0x274e34){logger['error'](_0x47a5('0x25'),_0x11faf5,_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);})['finally'](function(){delete _0x3b001e[_0x47a5('0x9')][_0x11faf5];});}catch(_0x50c086){logger['error'](_0x47a5('0x32'),_0x50c086['message']);}};Acw[_0x47a5('0x33')]['stopAcw']=function(_0x21ad34){try{var _0x3534cb=this;if(_0x3534cb[_0x47a5('0x8')][_0x21ad34]){_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x27')]=![];var _0xed6320=_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x2c')];var _0x1a0d23=_0x3534cb['timers'][_0x21ad34][_0x47a5('0x2d')];var _0x10f136=_0x3534cb['voiceQueues'][_0x1a0d23][_0x47a5('0x26')];logger[_0x47a5('0x20')](_0x47a5('0x34'),_0xed6320,_0x21ad34);RpcUser['saveUnpause'](this[_0x47a5('0x7')][_0x21ad34]);RpcVoiceAgentReport[_0x47a5('0x35')]({'acwtime':_0x10f136,'agentacw':!![]},_0xed6320,_0x21ad34)['then'](function(_0x2ebba0){logger[_0x47a5('0x20')]('[%s][UPDATE][ACWTIME:%s]',_0xed6320,_0x10f136,_0x2ebba0);})['catch'](function(_0x5ebd8c){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0xed6320,_0x5ebd8c);});}else{logger[_0x47a5('0x31')](_0x47a5('0x36'),_0x21ad34);if(_0x3534cb[_0x47a5('0x8')]){logger[_0x47a5('0x20')](_0x47a5('0x37'),JSON[_0x47a5('0x38')](_0x3534cb[_0x47a5('0x8')]));}}}catch(_0x1f3d01){logger[_0x47a5('0x31')](_0x47a5('0x39'),_0x1f3d01[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x3b')]=function(_0x56dbbd){try{if(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]['acw']||this[_0x47a5('0x6')][_0x56dbbd['queue']]['mandatoryDisposition'])){if(this['agents'][_0x56dbbd['interface']]){this[_0x47a5('0x9')][_0x56dbbd['uniqueid']]={'queue':_0x56dbbd[_0x47a5('0x2d')],'interface':_0x56dbbd[_0x47a5('0x3c')],'destlinkedid':_0x56dbbd[_0x47a5('0x23')]};}}}catch(_0x494526){logger[_0x47a5('0x31')](_0x47a5('0x3d'),_0x494526['message']);}};Acw['prototype'][_0x47a5('0x3e')]=function(_0x4edf7f){try{if(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x4')]||this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x19')])){if(this[_0x47a5('0x7')][_0x4edf7f[_0x47a5('0x3c')]]){this[_0x47a5('0x9')][_0x4edf7f[_0x47a5('0x2c')]]={'queue':_0x4edf7f[_0x47a5('0x2d')],'interface':_0x4edf7f[_0x47a5('0x3c')]};}}}catch(_0x4e5e7){logger[_0x47a5('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4e5e7[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncHangupRequest']=function(_0x52b3a8){try{if(this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]['attended'])){logger[_0x47a5('0x20')]('[%s][HANGUP:UNIQUEID]',_0x52b3a8[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x52b3a8[_0x47a5('0x40')]]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['linkedid']]['attended'])){logger[_0x47a5('0x20')](_0x47a5('0x41'),_0x52b3a8[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x40')]);}}catch(_0x2c0c86){logger[_0x47a5('0x31')]('[ACW][syncHangupRequest]\x20%s',_0x2c0c86[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0xd')]=function(_0x5c3c75){try{if(this[_0x47a5('0x9')][_0x5c3c75['uniqueid']]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x2c')]][_0x47a5('0x22')]){logger[_0x47a5('0x20')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5c3c75[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]['attended']){logger[_0x47a5('0x20')](_0x47a5('0x42'),_0x5c3c75[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x40')]);}}catch(_0x1ab0bf){logger['error'](_0x47a5('0x43'),_0x1ab0bf[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncAttendedTransfer']=function(_0x4c5ed){try{if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfereeuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x45')]);if(this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']]){this['channels'][_0x4c5ed[_0x47a5('0x46')]]['attended']=!![];this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']]=this['channels'][_0x4c5ed[_0x47a5('0x46')]];delete this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']];}}else if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x47')]);if(this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x48')]]){this[_0x47a5('0x9')][_0x4c5ed['origtransfereruniqueid']][_0x47a5('0x22')]=!![];this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x45')]]=this['channels'][_0x4c5ed[_0x47a5('0x48')]];delete this['channels'][_0x4c5ed[_0x47a5('0x48')]];}}}catch(_0x470da6){logger[_0x47a5('0x31')](_0x47a5('0x49'),_0x470da6[_0x47a5('0x3a')]);}};Acw['prototype'][_0x47a5('0x12')]=function(_0x5d1550){try{if(this['channels'][_0x5d1550['transfereruniqueid']]){logger['info'](_0x47a5('0x4a'),JSON[_0x47a5('0x38')](_0x5d1550[_0x47a5('0x4b')]));this['startAcw'](_0x5d1550['transfereruniqueid']);}else if(this[_0x47a5('0x9')][_0x5d1550[_0x47a5('0x4c')]]){logger[_0x47a5('0x20')](_0x47a5('0x4d'),JSON[_0x47a5('0x38')](_0x5d1550['transfererlinkedid']));this[_0x47a5('0x17')](_0x5d1550['transfererlinkedid']);}}catch(_0x22c886){logger[_0x47a5('0x31')]('[ACW][syncBlindTransfer]\x20%s',_0x22c886[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x4e')]=function(_0x3e8274){try{if(this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]&&this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]['autopause']===_0x47a5('0x4f')){if(this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]]){logger[_0x47a5('0x20')](_0x47a5('0x50'),_0x3e8274['uniqueid'],_0x3e8274[_0x47a5('0x3c')],_0x3e8274[_0x47a5('0x2d')]);return RpcUser[_0x47a5('0x24')](this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]],_0x47a5('0x51'),_0x3e8274[_0x47a5('0x2c')]);}}}catch(_0x149d34){logger[_0x47a5('0x31')](_0x47a5('0x52'),_0x149d34[_0x47a5('0x3a')]);}};module[_0x47a5('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 43ed39e..4191845 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 _0x34e5=['bluebird','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','username','keepConnected','action','error','format','inspect','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','exports'];(function(_0x1ea708,_0x149b50){var _0x220803=function(_0x1b85aa){while(--_0x1b85aa){_0x1ea708['push'](_0x1ea708['shift']());}};_0x220803(++_0x149b50);}(_0x34e5,0x160));var _0x534e=function(_0x5756fc,_0x4e95c7){_0x5756fc=_0x5756fc-0x0;var _0x170244=_0x34e5[_0x5756fc];return _0x170244;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x534e('0x0'));var moment=require('moment');var util=require(_0x534e('0x1'));var _=require(_0x534e('0x2'));var logger=require(_0x534e('0x3'))(_0x534e('0x4'));var config=require(_0x534e('0x5'));var ami=new Manager(config[_0x534e('0x6')][_0x534e('0x7')],config[_0x534e('0x6')]['ip'],config[_0x534e('0x6')][_0x534e('0x8')],config[_0x534e('0x6')]['password'],!![]);ami[_0x534e('0x9')]();ami['Action']=BPromise['promisify'](ami[_0x534e('0xa')]);function error(_0x4a211f){logger[_0x534e('0xb')](util[_0x534e('0xc')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk']['username'],config['asterisk']['ip'],config['asterisk']['port'],util[_0x534e('0xd')](_0x4a211f,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x534e('0x6')]['username'],config[_0x534e('0x6')]['ip'],config[_0x534e('0x6')][_0x534e('0x7')]));}ami[_0x534e('0xe')]=function(){return function(){return ami[_0x534e('0xf')]({'action':_0x534e('0x10')});};};ami[_0x534e('0x11')]=function(){return function(){return ami[_0x534e('0xf')]({'action':'devicestatelist'});};};ami[_0x534e('0x12')]=function(){return function(){return ami[_0x534e('0xf')]({'action':_0x534e('0x13')});};};ami[_0x534e('0x14')]=function(){return function(){return ami[_0x534e('0xf')]({'action':_0x534e('0x15')});};};ami[_0x534e('0x16')]=function(){return function(){return ami[_0x534e('0xf')]({'action':'coreshowchannels'});};};function connect(_0x271acd){logger[_0x534e('0x17')](util[_0x534e('0xc')](_0x534e('0x18'),config[_0x534e('0x6')][_0x534e('0x8')],config[_0x534e('0x6')]['ip'],config['asterisk'][_0x534e('0x7')]));ami[_0x534e('0x19')](_0x534e('0xb'),error);ami['once'](_0x534e('0x1a'),close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x2eba73){logger[_0x534e('0x17')](util[_0x534e('0xc')](_0x534e('0x1b'),config[_0x534e('0x6')][_0x534e('0x8')],config['asterisk']['ip'],config[_0x534e('0x6')]['port'],util[_0x534e('0xd')](_0x2eba73,![],null)));});ami['on']('fullybooted',function(_0x64efc0){logger[_0x534e('0x17')](util['format'](_0x534e('0x1c'),config[_0x534e('0x6')]['username'],config[_0x534e('0x6')]['ip'],config[_0x534e('0x6')][_0x534e('0x7')]));return BPromise['resolve']()[_0x534e('0x1d')](ami['actionSipShowRegistry']())[_0x534e('0x1d')](ami['actionDeviceStateList']())[_0x534e('0x1d')](ami[_0x534e('0x12')]())[_0x534e('0x1d')](ami[_0x534e('0x14')]())['then'](ami['actionCoreShowChannels']())[_0x534e('0x1e')](function(_0x4fa57d){console['log'](_0x4fa57d);});});ami[_0x534e('0x19')](_0x534e('0xb'),error);ami[_0x534e('0x19')](_0x534e('0x1a'),close);module[_0x534e('0x1f')]=ami; \ No newline at end of file +var _0xa607=['action','error','format','username','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','fullybooted','then','actionSipShowRegistry','actionCoreShowChannels','log','asterisk-manager','moment','util','lodash','ami','asterisk','port','password','keepConnected','Action','promisify'];(function(_0xa62004,_0x29f3b4){var _0xf42eaa=function(_0x18da7a){while(--_0x18da7a){_0xa62004['push'](_0xa62004['shift']());}};_0xf42eaa(++_0x29f3b4);}(_0xa607,0x1a2));var _0x7a60=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0xa607[_0x52666e];return _0x515330;};'use strict';var Manager=require(_0x7a60('0x0'));var BPromise=require('bluebird');var moment=require(_0x7a60('0x1'));var util=require(_0x7a60('0x2'));var _=require(_0x7a60('0x3'));var logger=require('../../config/logger')(_0x7a60('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x7a60('0x5')][_0x7a60('0x6')],config['asterisk']['ip'],config[_0x7a60('0x5')]['username'],config['asterisk'][_0x7a60('0x7')],!![]);ami[_0x7a60('0x8')]();ami[_0x7a60('0x9')]=BPromise[_0x7a60('0xa')](ami[_0x7a60('0xb')]);function error(_0x5cb253){logger[_0x7a60('0xc')](util[_0x7a60('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x7a60('0xe')],config[_0x7a60('0x5')]['ip'],config[_0x7a60('0x5')]['port'],util[_0x7a60('0xf')](_0x5cb253,![],null)));}function close(){logger[_0x7a60('0xc')](util[_0x7a60('0xd')](_0x7a60('0x10'),config['asterisk'][_0x7a60('0xe')],config[_0x7a60('0x5')]['ip'],config['asterisk'][_0x7a60('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7a60('0x9')]({'action':_0x7a60('0x11')});};};ami[_0x7a60('0x12')]=function(){return function(){return ami[_0x7a60('0x9')]({'action':_0x7a60('0x13')});};};ami[_0x7a60('0x14')]=function(){return function(){return ami[_0x7a60('0x9')]({'action':'sippeerstatus'});};};ami[_0x7a60('0x15')]=function(){return function(){return ami[_0x7a60('0x9')]({'action':_0x7a60('0x16')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x7a60('0x9')]({'action':'coreshowchannels'});};};function connect(_0x3cb2ff){logger[_0x7a60('0x17')](util[_0x7a60('0xd')](_0x7a60('0x18'),config[_0x7a60('0x5')][_0x7a60('0xe')],config[_0x7a60('0x5')]['ip'],config[_0x7a60('0x5')][_0x7a60('0x6')]));ami[_0x7a60('0x19')](_0x7a60('0xc'),error);ami[_0x7a60('0x19')](_0x7a60('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7a60('0x1b'),function(_0x3d3644){logger['info'](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x7a60('0x5')][_0x7a60('0xe')],config[_0x7a60('0x5')]['ip'],config[_0x7a60('0x5')][_0x7a60('0x6')],util[_0x7a60('0xf')](_0x3d3644,![],null)));});ami['on'](_0x7a60('0x1c'),function(_0x461f8e){logger[_0x7a60('0x17')](util[_0x7a60('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x7a60('0x5')][_0x7a60('0xe')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise['resolve']()[_0x7a60('0x1d')](ami[_0x7a60('0x1e')]())[_0x7a60('0x1d')](ami[_0x7a60('0x12')]())[_0x7a60('0x1d')](ami[_0x7a60('0x14')]())[_0x7a60('0x1d')](ami[_0x7a60('0x15')]())[_0x7a60('0x1d')](ami[_0x7a60('0x1f')]())['catch'](function(_0x4b84e7){console[_0x7a60('0x20')](_0x4b84e7);});});ami['once'](_0x7a60('0xc'),error);ami[_0x7a60('0x19')](_0x7a60('0x1a'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 034ed72..0c04770 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 _0x636a=['rpc','memberReport','error','result','catch','jayson/promise','bluebird','client','Request','request','then','debug'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x636a,0xe9));var _0xa636=function(_0x5c0ff6,_0x22cdd2){_0x5c0ff6=_0x5c0ff6-0x0;var _0x1135cd=_0x636a[_0x5c0ff6];return _0x1135cd;};'use strict';var jayson=require(_0xa636('0x0'));var BPromise=require(_0xa636('0x1'));var logger=require('../../config/logger')('ami');var client=jayson[_0xa636('0x2')]['http']({'port':0x2329});client[_0xa636('0x3')]=function(_0x1b6ee3,_0x5d7834){return new BPromise(function(_0x4ae492,_0x161499){return client[_0xa636('0x4')](_0x1b6ee3,_0x5d7834)[_0xa636('0x5')](function(_0x25458f){logger[_0xa636('0x6')](_0xa636('0x7'),_0xa636('0x8'),_0x1b6ee3,_0x5d7834,_0x25458f);if(_0x25458f[_0xa636('0x9')]){logger['error']('rpc','memberReport',_0x1b6ee3,_0x25458f['error']['message'],_0x5d7834);return _0x161499(_0x25458f[_0xa636('0x9')]['message']);}else{return _0x4ae492(_0x25458f[_0xa636('0xa')]);}})[_0xa636('0xb')](function(_0x5258cb){logger[_0xa636('0x9')]('rpc',_0xa636('0x8'),_0x1b6ee3,_0x5258cb,_0x5d7834);return _0x161499(_0x5258cb);});});};module['exports']=client; \ No newline at end of file +var _0x3d29=['memberReport','error','message','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','request','then','debug','rpc'];(function(_0x44e407,_0x4b386c){var _0x580208=function(_0x5c5f97){while(--_0x5c5f97){_0x44e407['push'](_0x44e407['shift']());}};_0x580208(++_0x4b386c);}(_0x3d29,0xc7));var _0x93d2=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x3d29[_0x186376];return _0x2dbdd9;};'use strict';var jayson=require(_0x93d2('0x0'));var BPromise=require(_0x93d2('0x1'));var logger=require(_0x93d2('0x2'))(_0x93d2('0x3'));var client=jayson[_0x93d2('0x4')][_0x93d2('0x5')]({'port':0x2329});client[_0x93d2('0x6')]=function(_0x4c01e5,_0x3b0c24){return new BPromise(function(_0x38ea8c,_0x486e3c){return client[_0x93d2('0x7')](_0x4c01e5,_0x3b0c24)[_0x93d2('0x8')](function(_0x59180a){logger[_0x93d2('0x9')](_0x93d2('0xa'),_0x93d2('0xb'),_0x4c01e5,_0x3b0c24,_0x59180a);if(_0x59180a[_0x93d2('0xc')]){logger[_0x93d2('0xc')](_0x93d2('0xa'),_0x93d2('0xb'),_0x4c01e5,_0x59180a[_0x93d2('0xc')][_0x93d2('0xd')],_0x3b0c24);return _0x486e3c(_0x59180a[_0x93d2('0xc')][_0x93d2('0xd')]);}else{return _0x38ea8c(_0x59180a['result']);}})[_0x93d2('0xe')](function(_0x22bbf7){logger['error'](_0x93d2('0xa'),'memberReport',_0x4c01e5,_0x22bbf7,_0x3b0c24);return _0x486e3c(_0x22bbf7);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 9c026d4..6da45f6 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 _0x8307=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','number','substring','getQueue','queue','exports','util','lodash','isNil','string','name','phone','Contact','lastName','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x1ac7e5,_0x19d703){var _0x5e8d50=function(_0x361ada){while(--_0x361ada){_0x1ac7e5['push'](_0x1ac7e5['shift']());}};_0x5e8d50(++_0x19d703);}(_0x8307,0xc4));var _0x7830=function(_0x23db19,_0x4ac567){_0x23db19=_0x23db19-0x0;var _0x3becef=_0x8307[_0x23db19];return _0x3becef;};'use strict';var util=require(_0x7830('0x0'));var _=require(_0x7830('0x1'));var moment=require('moment');function checkNameSurname(_0x3bd8d2,_0x445305,_0x2b88ee){var _0x51e4da='';if(!_[_0x7830('0x2')](_0x445305)&&_0x7830('0x3')===typeof _0x445305){_0x51e4da+=_0x445305;}if(!_['isNil'](_0x2b88ee)&&'string'===typeof _0x2b88ee){_0x51e4da+='\x20'+_0x2b88ee;}if(_0x51e4da!==''){return _0x51e4da;}return _0x3bd8d2;}function Action(_0x4b87a,_0x5e7efc,_0x43c6ea){this['voiceQueue']=_0x4b87a;this['uniqueid']=_0x43c6ea||undefined;this[_0x7830('0x4')]=checkNameSurname(_0x5e7efc['Contact'][_0x7830('0x5')],_0x5e7efc[_0x7830('0x6')]['firstName'],_0x5e7efc[_0x7830('0x6')][_0x7830('0x7')]);this['number']=_0x5e7efc[_0x7830('0x6')]['phone'];this['queue']=_0x4b87a[_0x7830('0x4')];this[_0x7830('0x8')]=_0x5e7efc[_0x7830('0x8')]||![];this[_0x7830('0x9')]=_0x4b87a[_0x7830('0x9')];this[_0x7830('0xa')]=_0x4b87a[_0x7830('0xa')]||0x3;this[_0x7830('0xb')]=_0x5e7efc['scheduledat'];this[_0x7830('0xc')]=_0x5e7efc[_0x7830('0xc')];this[_0x7830('0xd')]=_0x5e7efc['countcongestionretry'];this['countnoanswerretry']=_0x5e7efc['countnoanswerretry'];this[_0x7830('0xe')]=_0x5e7efc['countnosuchnumberretry'];this[_0x7830('0xf')]=_0x5e7efc[_0x7830('0xf')];this[_0x7830('0x10')]=_0x5e7efc[_0x7830('0x10')];this[_0x7830('0x11')]=_0x5e7efc[_0x7830('0x11')];this[_0x7830('0x12')]=_0x5e7efc[_0x7830('0x12')];this[_0x7830('0x13')]=_0x5e7efc[_0x7830('0x13')];this[_0x7830('0x14')]=_0x5e7efc[_0x7830('0x14')];this[_0x7830('0x15')]=_0x5e7efc[_0x7830('0x15')];this[_0x7830('0x16')]=_0x5e7efc['VoiceQueueId'];this[_0x7830('0x17')]=_0x5e7efc[_0x7830('0x17')];this[_0x7830('0x18')]=_0x5e7efc['id'];this[_0x7830('0x19')]=_0x5e7efc[_0x7830('0x6')][_0x7830('0x1a')]||'';this[_0x7830('0x1b')]=moment()[_0x7830('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7830('0x1d')]=_0x5e7efc[_0x7830('0x1d')];this[_0x7830('0x1e')]=_0x5e7efc[_0x7830('0x1e')];this[_0x7830('0x1f')]=_0x5e7efc['callbackat'];this[_0x7830('0x20')]=_0x5e7efc[_0x7830('0x20')];this[_0x7830('0x21')]='';this['originatecalleridname']='';}Action[_0x7830('0x22')]['getCaller']=function(){return util['format'](_0x7830('0x23'),this[_0x7830('0x4')],this[_0x7830('0x24')][_0x7830('0x25')]>0x0?this[_0x7830('0x26')][_0x7830('0x27')](this[_0x7830('0x24')][_0x7830('0x25')]):this[_0x7830('0x26')]);};Action[_0x7830('0x22')][_0x7830('0x28')]=function(){return this[_0x7830('0x29')];};module[_0x7830('0x2a')]=Action; \ No newline at end of file +var _0x81a4=['originatecalleridnum','originatecalleridname','getCaller','dialCutDigit','substring','prototype','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','name','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x81a4,0x1a6));var _0x481a=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0x81a4[_0x25e109];return _0xc0f7d6;};'use strict';var util=require(_0x481a('0x0'));var _=require(_0x481a('0x1'));var moment=require(_0x481a('0x2'));function checkNameSurname(_0x712a73,_0x5a1f1f,_0x39262a){var _0x4f7de1='';if(!_[_0x481a('0x3')](_0x5a1f1f)&&_0x481a('0x4')===typeof _0x5a1f1f){_0x4f7de1+=_0x5a1f1f;}if(!_[_0x481a('0x3')](_0x39262a)&&'string'===typeof _0x39262a){_0x4f7de1+='\x20'+_0x39262a;}if(_0x4f7de1!==''){return _0x4f7de1;}return _0x712a73;}function Action(_0x25c921,_0x3a6458,_0x17d40e){this[_0x481a('0x5')]=_0x25c921;this['uniqueid']=_0x17d40e||undefined;this[_0x481a('0x6')]=checkNameSurname(_0x3a6458[_0x481a('0x7')][_0x481a('0x8')],_0x3a6458[_0x481a('0x7')][_0x481a('0x9')],_0x3a6458[_0x481a('0x7')]['lastName']);this[_0x481a('0xa')]=_0x3a6458[_0x481a('0x7')][_0x481a('0x8')];this[_0x481a('0xb')]=_0x25c921[_0x481a('0x6')];this[_0x481a('0xc')]=_0x3a6458[_0x481a('0xc')]||![];this[_0x481a('0xd')]=_0x25c921[_0x481a('0xd')];this[_0x481a('0xe')]=_0x25c921['dialQueueTimeout']||0x3;this['scheduledat']=_0x3a6458[_0x481a('0xf')];this[_0x481a('0x10')]=_0x3a6458[_0x481a('0x10')];this[_0x481a('0x11')]=_0x3a6458[_0x481a('0x11')];this[_0x481a('0x12')]=_0x3a6458['countnoanswerretry'];this[_0x481a('0x13')]=_0x3a6458['countnosuchnumberretry'];this[_0x481a('0x14')]=_0x3a6458[_0x481a('0x14')];this[_0x481a('0x15')]=_0x3a6458['countabandonedretry'];this['countmachineretry']=_0x3a6458[_0x481a('0x16')];this[_0x481a('0x17')]=_0x3a6458[_0x481a('0x17')];this[_0x481a('0x18')]=_0x3a6458[_0x481a('0x18')];this[_0x481a('0x19')]=_0x3a6458[_0x481a('0x19')];this[_0x481a('0x1a')]=_0x3a6458[_0x481a('0x1a')];this[_0x481a('0x1b')]=_0x3a6458['VoiceQueueId'];this[_0x481a('0x1c')]=_0x3a6458[_0x481a('0x1c')];this[_0x481a('0x1d')]=_0x3a6458['id'];this[_0x481a('0x1e')]=_0x3a6458[_0x481a('0x7')]['firstName']||'';this[_0x481a('0x1f')]=moment()[_0x481a('0x20')](_0x481a('0x21'));this[_0x481a('0x22')]=_0x3a6458['callback'];this[_0x481a('0x23')]=_0x3a6458[_0x481a('0x23')];this[_0x481a('0x24')]=_0x3a6458[_0x481a('0x24')];this[_0x481a('0x25')]=_0x3a6458[_0x481a('0x25')];this[_0x481a('0x26')]='';this[_0x481a('0x27')]='';}Action['prototype'][_0x481a('0x28')]=function(){return util[_0x481a('0x20')]('\x22%s\x22\x20<%s>',this[_0x481a('0x6')],this['voiceQueue'][_0x481a('0x29')]>0x0?this[_0x481a('0xa')][_0x481a('0x2a')](this[_0x481a('0x5')]['dialCutDigit']):this[_0x481a('0xa')]);};Action[_0x481a('0x2b')][_0x481a('0x2c')]=function(){return this[_0x481a('0xb')];};module[_0x481a('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index ca4c9eb..d058db6 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfee5=['uniqueid','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds'];(function(_0x40f9a0,_0x3458cc){var _0x3e3144=function(_0x1f8fce){while(--_0x1f8fce){_0x40f9a0['push'](_0x40f9a0['shift']());}};_0x3e3144(++_0x3458cc);}(_0xfee5,0x152));var _0x5fee=function(_0x2016b2,_0x5ec83e){_0x2016b2=_0x2016b2-0x0;var _0x1890ec=_0xfee5[_0x2016b2];return _0x1890ec;};'use strict';var util=require('util');var _=require(_0x5fee('0x0'));var moment=require('moment');function getSeconds(_0x480b90,_0x3e413f){var _0xb882f9=moment(_0x480b90)[_0x5fee('0x1')](0x0);var _0x39e2d6=moment(_0x3e413f)[_0x5fee('0x1')](0x0);return _0xb882f9[_0x5fee('0x2')](_0x39e2d6,_0x5fee('0x3'));}function AdditionalPhone(_0x49f85e){this[_0x5fee('0x4')]=_0x49f85e[_0x5fee('0x4')];this[_0x5fee('0x5')]=_0x49f85e[_0x5fee('0x5')]||undefined;this['type']=_0x49f85e['type'];this[_0x5fee('0x6')]=_0x49f85e[_0x5fee('0x7')]===_0x5fee('0x8')?_0x5fee('0x9'):_0x49f85e[_0x5fee('0x7')];this[_0x5fee('0xa')]=_0x49f85e['countbusyretry'];this['countcongestionretry']=_0x49f85e[_0x5fee('0xb')];this[_0x5fee('0xc')]=_0x49f85e[_0x5fee('0xc')];this[_0x5fee('0xd')]=_0x49f85e[_0x5fee('0xa')]+_0x49f85e[_0x5fee('0xb')]+_0x49f85e['countnoanswerretry']+_0x49f85e[_0x5fee('0xe')]+_0x49f85e[_0x5fee('0xf')]+_0x49f85e[_0x5fee('0x10')]+_0x49f85e[_0x5fee('0x11')]+_0x49f85e[_0x5fee('0x12')];this[_0x5fee('0xe')]=_0x49f85e['countnosuchnumberretry'];this[_0x5fee('0xf')]=_0x49f85e[_0x5fee('0xf')];this[_0x5fee('0x10')]=_0x49f85e[_0x5fee('0x10')];this[_0x5fee('0x11')]=_0x49f85e['countmachineretry'];this[_0x5fee('0x12')]=_0x49f85e[_0x5fee('0x12')];this[_0x5fee('0x9')]=_0x49f85e['queue'];this[_0x5fee('0x13')]=_0x49f85e['name'];this[_0x5fee('0x14')]=_0x49f85e[_0x5fee('0x15')];this[_0x5fee('0x16')]=_0x49f85e[_0x5fee('0x16')];this[_0x5fee('0x17')]=_0x49f85e['responsetime'];this['endtime']=_0x49f85e[_0x5fee('0x17')];this[_0x5fee('0x18')]=getSeconds(_0x49f85e[_0x5fee('0x17')],_0x49f85e[_0x5fee('0x16')]);this['holdtime']=0x0;this[_0x5fee('0x19')]=0x0;this['callback']=_0x49f85e[_0x5fee('0x1a')];this[_0x5fee('0x1b')]=_0x49f85e['callbackuniqueid'];this['callbackat']=_0x49f85e[_0x5fee('0x1c')];this[_0x5fee('0x1d')]=_0x49f85e[_0x5fee('0x1d')];this['ContactId']=_0x49f85e[_0x5fee('0x1e')];this[_0x5fee('0x1f')]=_0x49f85e['ListId'];this['UserId']=_0x49f85e[_0x5fee('0x20')];this[_0x5fee('0x21')]=_0x49f85e[_0x5fee('0x21')];this[_0x5fee('0x22')]=_0x49f85e['CampaignId'];this[_0x5fee('0x23')]=_0x49f85e[_0x5fee('0x23')]||'';this[_0x5fee('0x24')]=_0x49f85e[_0x5fee('0x24')]||'';}module[_0x5fee('0x25')]=History; \ No newline at end of file +var _0x1324=['countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','outbound','queue'];(function(_0x530639,_0x334948){var _0x11da9a=function(_0x4a964c){while(--_0x4a964c){_0x530639['push'](_0x530639['shift']());}};_0x11da9a(++_0x334948);}(_0x1324,0x14c));var _0x4132=function(_0x355392,_0x3ce47a){_0x355392=_0x355392-0x0;var _0x2c320c=_0x1324[_0x355392];return _0x2c320c;};'use strict';var util=require(_0x4132('0x0'));var _=require(_0x4132('0x1'));var moment=require(_0x4132('0x2'));function getSeconds(_0x37bdce,_0x4ce00d){var _0x4fb4f2=moment(_0x37bdce)[_0x4132('0x3')](0x0);var _0x16b81c=moment(_0x4ce00d)[_0x4132('0x3')](0x0);return _0x4fb4f2[_0x4132('0x4')](_0x16b81c,'seconds');}function AdditionalPhone(_0x434824){this[_0x4132('0x5')]=_0x434824['uniqueid'];this[_0x4132('0x6')]=_0x434824[_0x4132('0x6')]||undefined;this[_0x4132('0x7')]=_0x434824['type'];this['campaigntype']=_0x434824[_0x4132('0x7')]===_0x4132('0x8')?_0x4132('0x9'):_0x434824[_0x4132('0x7')];this['countbusyretry']=_0x434824[_0x4132('0xa')];this[_0x4132('0xb')]=_0x434824[_0x4132('0xb')];this['countnoanswerretry']=_0x434824['countnoanswerretry'];this[_0x4132('0xc')]=_0x434824[_0x4132('0xa')]+_0x434824[_0x4132('0xb')]+_0x434824['countnoanswerretry']+_0x434824[_0x4132('0xd')]+_0x434824[_0x4132('0xe')]+_0x434824['countabandonedretry']+_0x434824['countmachineretry']+_0x434824[_0x4132('0xf')];this[_0x4132('0xd')]=_0x434824[_0x4132('0xd')];this[_0x4132('0xe')]=_0x434824[_0x4132('0xe')];this[_0x4132('0x10')]=_0x434824[_0x4132('0x10')];this[_0x4132('0x11')]=_0x434824['countmachineretry'];this[_0x4132('0xf')]=_0x434824[_0x4132('0xf')];this[_0x4132('0x9')]=_0x434824[_0x4132('0x9')];this[_0x4132('0x12')]=_0x434824[_0x4132('0x13')];this[_0x4132('0x14')]=_0x434824[_0x4132('0x15')];this[_0x4132('0x16')]=_0x434824[_0x4132('0x16')];this[_0x4132('0x17')]=_0x434824['responsetime'];this[_0x4132('0x18')]=_0x434824[_0x4132('0x17')];this[_0x4132('0x19')]=getSeconds(_0x434824[_0x4132('0x17')],_0x434824[_0x4132('0x16')]);this[_0x4132('0x1a')]=0x0;this[_0x4132('0x1b')]=0x0;this[_0x4132('0x1c')]=_0x434824[_0x4132('0x1c')];this[_0x4132('0x1d')]=_0x434824[_0x4132('0x1d')];this['callbackat']=_0x434824['callbackat'];this[_0x4132('0x1e')]=_0x434824['recallme'];this['ContactId']=_0x434824[_0x4132('0x1f')];this[_0x4132('0x20')]=_0x434824[_0x4132('0x20')];this['UserId']=_0x434824['UserId'];this[_0x4132('0x21')]=_0x434824['VoiceQueueId'];this[_0x4132('0x22')]=_0x434824[_0x4132('0x22')];this[_0x4132('0x23')]=_0x434824[_0x4132('0x23')]||'';this[_0x4132('0x24')]=_0x434824[_0x4132('0x24')]||'';}module[_0x4132('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index dcf9fe4..e110cb7 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 _0xbf5e=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','number','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','membername','reason','callback','callbackuniqueid','callbackat','ContactId'];(function(_0x5e0f7f,_0x5ead2c){var _0x166b81=function(_0x197285){while(--_0x197285){_0x5e0f7f['push'](_0x5e0f7f['shift']());}};_0x166b81(++_0x5ead2c);}(_0xbf5e,0x19c));var _0xebf5=function(_0x51478c,_0x341e1b){_0x51478c=_0x51478c-0x0;var _0x5ed7e1=_0xbf5e[_0x51478c];return _0x5ed7e1;};'use strict';var util=require(_0xebf5('0x0'));var _=require('lodash');var moment=require(_0xebf5('0x1'));function getSeconds(_0x4f1da0,_0x4f56d7){var _0x34fb35=moment(_0x4f1da0)['milliseconds'](0x0);var _0x55217a=moment(_0x4f56d7)[_0xebf5('0x2')](0x0);return _0x34fb35[_0xebf5('0x3')](_0x55217a,_0xebf5('0x4'));}function AgentComplete(_0x5aa5e3,_0x308462){this[_0xebf5('0x5')]=0x4;this[_0xebf5('0x6')]=_0xebf5('0x7');this[_0xebf5('0x8')]=_0x5aa5e3[_0xebf5('0x8')];this[_0xebf5('0x9')]=_0x5aa5e3[_0xebf5('0x9')];this['campaigntype']=_0x5aa5e3['type']===_0xebf5('0xa')?_0xebf5('0xb'):_0x5aa5e3[_0xebf5('0x9')];this['countbusyretry']=_0x5aa5e3[_0xebf5('0xc')];this['countcongestionretry']=_0x5aa5e3[_0xebf5('0xd')];this[_0xebf5('0xe')]=_0x5aa5e3['countnoanswerretry'];this[_0xebf5('0xf')]=_0x5aa5e3['countbusyretry']+_0x5aa5e3['countcongestionretry']+_0x5aa5e3[_0xebf5('0xe')]+_0x5aa5e3[_0xebf5('0x10')]+_0x5aa5e3[_0xebf5('0x11')]+_0x5aa5e3['countabandonedretry']+_0x5aa5e3['countmachineretry']+_0x5aa5e3[_0xebf5('0x12')];this[_0xebf5('0x10')]=_0x5aa5e3[_0xebf5('0x10')];this[_0xebf5('0x11')]=_0x5aa5e3[_0xebf5('0x11')];this['countabandonedretry']=_0x5aa5e3[_0xebf5('0x13')];this[_0xebf5('0x14')]=_0x5aa5e3['countmachineretry'];this[_0xebf5('0x12')]=_0x5aa5e3['countagentrejectretry'];this[_0xebf5('0x15')]=_0x308462[_0xebf5('0x15')];this[_0xebf5('0x16')]=_0x5aa5e3[_0xebf5('0x17')];this['calleridnum']=_0x5aa5e3[_0xebf5('0x18')];this['starttime']=_0x5aa5e3['starttime'];this[_0xebf5('0x19')]=_0x5aa5e3[_0xebf5('0x19')];this[_0xebf5('0x1a')]=_0x5aa5e3['answertime'];this[_0xebf5('0x1b')]=moment()[_0xebf5('0x1c')](_0xebf5('0x1d'));this[_0xebf5('0x1e')]=getSeconds(_0x5aa5e3['responsetime'],_0x5aa5e3[_0xebf5('0x1f')]);this['holdtime']=getSeconds(_0x5aa5e3[_0xebf5('0x1a')],_0x5aa5e3['responsetime']);this['talktime']=getSeconds(this['endtime'],_0x5aa5e3[_0xebf5('0x1a')]);this[_0xebf5('0xb')]=_0x308462[_0xebf5('0xb')];this[_0xebf5('0x20')]=_0x308462['membername'];this['reason']=_0x308462[_0xebf5('0x21')];this[_0xebf5('0x22')]=_0x5aa5e3[_0xebf5('0x22')];this[_0xebf5('0x23')]=_0x5aa5e3[_0xebf5('0x23')];this[_0xebf5('0x24')]=_0x5aa5e3[_0xebf5('0x24')];this['recallme']=_0x5aa5e3['recallme'];this[_0xebf5('0x25')]=_0x5aa5e3['ContactId'];this['ListId']=_0x5aa5e3[_0xebf5('0x26')];this['UserId']=_0x5aa5e3[_0xebf5('0x27')];this[_0xebf5('0x28')]=_0x5aa5e3[_0xebf5('0x28')];this['CampaignId']=_0x5aa5e3[_0xebf5('0x29')];this[_0xebf5('0x2a')]=_0x5aa5e3[_0xebf5('0x2a')]||'';this[_0xebf5('0x2b')]=_0x5aa5e3[_0xebf5('0x2b')]||'';}module[_0xebf5('0x2c')]=AgentComplete; \ No newline at end of file +var _0x6a46=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','talktime','membername'];(function(_0x269ee9,_0x2a01d8){var _0x3f139c=function(_0x2e96eb){while(--_0x2e96eb){_0x269ee9['push'](_0x269ee9['shift']());}};_0x3f139c(++_0x2a01d8);}(_0x6a46,0x1a1));var _0x66a4=function(_0x1c1f23,_0x17a346){_0x1c1f23=_0x1c1f23-0x0;var _0x588f7a=_0x6a46[_0x1c1f23];return _0x588f7a;};'use strict';var util=require(_0x66a4('0x0'));var _=require(_0x66a4('0x1'));var moment=require(_0x66a4('0x2'));function getSeconds(_0x19b9b0,_0xa9402a){var _0x13e020=moment(_0x19b9b0)[_0x66a4('0x3')](0x0);var _0x1408dd=moment(_0xa9402a)['milliseconds'](0x0);return _0x13e020['diff'](_0x1408dd,_0x66a4('0x4'));}function AgentComplete(_0xe37ed,_0x387737){this[_0x66a4('0x5')]=0x4;this[_0x66a4('0x6')]=_0x66a4('0x7');this['scheduledat']=_0xe37ed[_0x66a4('0x8')];this[_0x66a4('0x9')]=_0xe37ed[_0x66a4('0x9')];this[_0x66a4('0xa')]=_0xe37ed[_0x66a4('0x9')]===_0x66a4('0xb')?_0x66a4('0xc'):_0xe37ed[_0x66a4('0x9')];this[_0x66a4('0xd')]=_0xe37ed[_0x66a4('0xd')];this[_0x66a4('0xe')]=_0xe37ed[_0x66a4('0xe')];this[_0x66a4('0xf')]=_0xe37ed['countnoanswerretry'];this[_0x66a4('0x10')]=_0xe37ed[_0x66a4('0xd')]+_0xe37ed['countcongestionretry']+_0xe37ed['countnoanswerretry']+_0xe37ed[_0x66a4('0x11')]+_0xe37ed[_0x66a4('0x12')]+_0xe37ed[_0x66a4('0x13')]+_0xe37ed['countmachineretry']+_0xe37ed[_0x66a4('0x14')];this['countnosuchnumberretry']=_0xe37ed[_0x66a4('0x11')];this[_0x66a4('0x12')]=_0xe37ed[_0x66a4('0x12')];this['countabandonedretry']=_0xe37ed['countabandonedretry'];this[_0x66a4('0x15')]=_0xe37ed[_0x66a4('0x15')];this['countagentrejectretry']=_0xe37ed['countagentrejectretry'];this[_0x66a4('0x16')]=_0x387737['uniqueid'];this[_0x66a4('0x17')]=_0xe37ed[_0x66a4('0x18')];this[_0x66a4('0x19')]=_0xe37ed[_0x66a4('0x1a')];this[_0x66a4('0x1b')]=_0xe37ed[_0x66a4('0x1b')];this[_0x66a4('0x1c')]=_0xe37ed[_0x66a4('0x1c')];this['answertime']=_0xe37ed['answertime'];this[_0x66a4('0x1d')]=moment()[_0x66a4('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0xe37ed[_0x66a4('0x1c')],_0xe37ed[_0x66a4('0x1b')]);this['holdtime']=getSeconds(_0xe37ed['answertime'],_0xe37ed[_0x66a4('0x1c')]);this[_0x66a4('0x1f')]=getSeconds(this[_0x66a4('0x1d')],_0xe37ed['answertime']);this[_0x66a4('0xc')]=_0x387737[_0x66a4('0xc')];this[_0x66a4('0x20')]=_0x387737[_0x66a4('0x20')];this['reason']=_0x387737['reason'];this[_0x66a4('0x21')]=_0xe37ed['callback'];this[_0x66a4('0x22')]=_0xe37ed[_0x66a4('0x22')];this[_0x66a4('0x23')]=_0xe37ed[_0x66a4('0x23')];this[_0x66a4('0x24')]=_0xe37ed[_0x66a4('0x24')];this[_0x66a4('0x25')]=_0xe37ed[_0x66a4('0x25')];this[_0x66a4('0x26')]=_0xe37ed['ListId'];this[_0x66a4('0x27')]=_0xe37ed[_0x66a4('0x27')];this[_0x66a4('0x28')]=_0xe37ed['VoiceQueueId'];this['CampaignId']=_0xe37ed[_0x66a4('0x29')];this[_0x66a4('0x2a')]=_0xe37ed['originatecalleridnum']||'';this[_0x66a4('0x2b')]=_0xe37ed['originatecalleridname']||'';}module[_0x66a4('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index e6ce506..5f4cf37 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 _0x612f=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','callback'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x612f,0xbf));var _0xf612=function(_0x34c038,_0x5808ff){_0x34c038=_0x34c038-0x0;var _0x199a88=_0x612f[_0x34c038];return _0x199a88;};'use strict';var util=require('util');var _=require(_0xf612('0x0'));var moment=require(_0xf612('0x1'));function getSeconds(_0x591916,_0x2840eb){var _0x14f585=moment(_0x591916)[_0xf612('0x2')](0x0);var _0x159ed0=moment(_0x2840eb)[_0xf612('0x2')](0x0);return _0x14f585[_0xf612('0x3')](_0x159ed0,_0xf612('0x4'));}function Final(_0x125e95){this[_0xf612('0x5')]=_0x125e95[_0xf612('0x5')];this[_0xf612('0x6')]=_0x125e95[_0xf612('0x6')];this[_0xf612('0x7')]=_0x125e95['type'];this['campaigntype']=_0x125e95[_0xf612('0x7')]==='outbound'?_0xf612('0x8'):_0x125e95[_0xf612('0x7')];this[_0xf612('0x9')]=_0x125e95['countbusyretry'];this[_0xf612('0xa')]=_0x125e95[_0xf612('0xa')];this['countnoanswerretry']=_0x125e95[_0xf612('0xb')];this[_0xf612('0xc')]=_0x125e95[_0xf612('0x9')]+_0x125e95[_0xf612('0xa')]+_0x125e95[_0xf612('0xb')]+_0x125e95['countnosuchnumberretry']+_0x125e95[_0xf612('0xd')]+_0x125e95[_0xf612('0xe')]+_0x125e95[_0xf612('0xf')]+_0x125e95[_0xf612('0x10')];this[_0xf612('0x11')]=_0x125e95[_0xf612('0x11')];this['countdropretry']=_0x125e95[_0xf612('0xd')];this[_0xf612('0xe')]=_0x125e95[_0xf612('0xe')];this[_0xf612('0xf')]=_0x125e95['countmachineretry'];this[_0xf612('0x10')]=_0x125e95[_0xf612('0x10')];this[_0xf612('0x8')]=_0x125e95[_0xf612('0x8')];this[_0xf612('0x12')]=_0x125e95[_0xf612('0x12')];this[_0xf612('0x13')]=_0x125e95[_0xf612('0x13')];this[_0xf612('0x14')]=_0x125e95['starttime'];this[_0xf612('0x15')]=_0x125e95[_0xf612('0x15')];this['endtime']=_0x125e95['responsetime'];this[_0xf612('0x16')]=_0x125e95[_0xf612('0x16')]||0x0;this['holdtime']=_0x125e95[_0xf612('0x17')]||0x0;this['talktime']=_0x125e95['talktime']||0x0;this[_0xf612('0x18')]=_0x125e95['callback'];this[_0xf612('0x19')]=_0x125e95[_0xf612('0x19')];this['callbackat']=_0x125e95[_0xf612('0x1a')];this[_0xf612('0x1b')]=_0x125e95[_0xf612('0x1b')];this[_0xf612('0x1c')]=_0x125e95[_0xf612('0x1c')];this['ListId']=_0x125e95[_0xf612('0x1d')];this[_0xf612('0x1e')]=_0x125e95['UserId'];this[_0xf612('0x1f')]=_0x125e95[_0xf612('0x1f')];this[_0xf612('0x20')]=_0x125e95[_0xf612('0x20')];this[_0xf612('0x21')]=_0x125e95[_0xf612('0x21')]||'';this[_0xf612('0x22')]=_0x125e95[_0xf612('0x22')]||'';}module[_0xf612('0x23')]=Final; \ No newline at end of file +var _0x4c63=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime'];(function(_0x27475e,_0x432c7f){var _0x21c8a5=function(_0x101e15){while(--_0x101e15){_0x27475e['push'](_0x27475e['shift']());}};_0x21c8a5(++_0x432c7f);}(_0x4c63,0x1c4));var _0x34c6=function(_0x5b14fa,_0x4fede8){_0x5b14fa=_0x5b14fa-0x0;var _0x32a41c=_0x4c63[_0x5b14fa];return _0x32a41c;};'use strict';var util=require(_0x34c6('0x0'));var _=require('lodash');var moment=require(_0x34c6('0x1'));function getSeconds(_0x29f68e,_0x517626){var _0x73d0b7=moment(_0x29f68e)[_0x34c6('0x2')](0x0);var _0x2b406f=moment(_0x517626)[_0x34c6('0x2')](0x0);return _0x73d0b7[_0x34c6('0x3')](_0x2b406f,_0x34c6('0x4'));}function Final(_0x24c096){this[_0x34c6('0x5')]=_0x24c096[_0x34c6('0x5')];this['scheduledat']=_0x24c096[_0x34c6('0x6')];this[_0x34c6('0x7')]=_0x24c096['type'];this[_0x34c6('0x8')]=_0x24c096['type']===_0x34c6('0x9')?'queue':_0x24c096[_0x34c6('0x7')];this[_0x34c6('0xa')]=_0x24c096[_0x34c6('0xa')];this['countcongestionretry']=_0x24c096['countcongestionretry'];this['countnoanswerretry']=_0x24c096[_0x34c6('0xb')];this[_0x34c6('0xc')]=_0x24c096['countbusyretry']+_0x24c096[_0x34c6('0xd')]+_0x24c096[_0x34c6('0xb')]+_0x24c096['countnosuchnumberretry']+_0x24c096[_0x34c6('0xe')]+_0x24c096[_0x34c6('0xf')]+_0x24c096[_0x34c6('0x10')]+_0x24c096[_0x34c6('0x11')];this['countnosuchnumberretry']=_0x24c096[_0x34c6('0x12')];this['countdropretry']=_0x24c096[_0x34c6('0xe')];this['countabandonedretry']=_0x24c096[_0x34c6('0xf')];this[_0x34c6('0x10')]=_0x24c096[_0x34c6('0x10')];this['countagentrejectretry']=_0x24c096['countagentrejectretry'];this[_0x34c6('0x13')]=_0x24c096[_0x34c6('0x13')];this[_0x34c6('0x14')]=_0x24c096[_0x34c6('0x14')];this[_0x34c6('0x15')]=_0x24c096[_0x34c6('0x15')];this[_0x34c6('0x16')]=_0x24c096[_0x34c6('0x16')];this['responsetime']=_0x24c096[_0x34c6('0x17')];this[_0x34c6('0x18')]=_0x24c096[_0x34c6('0x17')];this[_0x34c6('0x19')]=_0x24c096[_0x34c6('0x19')]||0x0;this[_0x34c6('0x1a')]=_0x24c096[_0x34c6('0x1a')]||0x0;this[_0x34c6('0x1b')]=_0x24c096[_0x34c6('0x1b')]||0x0;this[_0x34c6('0x1c')]=_0x24c096[_0x34c6('0x1c')];this['callbackuniqueid']=_0x24c096[_0x34c6('0x1d')];this[_0x34c6('0x1e')]=_0x24c096[_0x34c6('0x1e')];this[_0x34c6('0x1f')]=_0x24c096[_0x34c6('0x1f')];this[_0x34c6('0x20')]=_0x24c096[_0x34c6('0x20')];this['ListId']=_0x24c096[_0x34c6('0x21')];this[_0x34c6('0x22')]=_0x24c096[_0x34c6('0x22')];this[_0x34c6('0x23')]=_0x24c096[_0x34c6('0x23')];this[_0x34c6('0x24')]=_0x24c096[_0x34c6('0x24')];this[_0x34c6('0x25')]=_0x24c096[_0x34c6('0x25')]||'';this[_0x34c6('0x26')]=_0x24c096[_0x34c6('0x26')]||'';}module[_0x34c6('0x27')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 27b9643..8f14e53 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 _0x336a=['format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime'];(function(_0x5545f7,_0x570414){var _0x52a979=function(_0x28eb97){while(--_0x28eb97){_0x5545f7['push'](_0x5545f7['shift']());}};_0x52a979(++_0x570414);}(_0x336a,0x9f));var _0xa336=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x336a[_0x1b7368];return _0x25d54c;};'use strict';var util=require(_0xa336('0x0'));var _=require(_0xa336('0x1'));var moment=require('moment');function getSeconds(_0x140d45,_0x2240fe){var _0xc0bee9=moment(_0x140d45)[_0xa336('0x2')](0x0);var _0x320631=moment(_0x2240fe)[_0xa336('0x2')](0x0);return _0xc0bee9[_0xa336('0x3')](_0x320631,_0xa336('0x4'));}function Hangup(_0x4d1082,_0x40d1a){this[_0xa336('0x5')]=0x4;this[_0xa336('0x6')]=_0xa336('0x7');this[_0xa336('0x8')]=_0x4d1082[_0xa336('0x8')];this[_0xa336('0x9')]=_0x4d1082['type'];this[_0xa336('0xa')]=_0x4d1082[_0xa336('0x9')]===_0xa336('0xb')?_0xa336('0xc'):_0x4d1082['type'];this[_0xa336('0xd')]=_0x4d1082[_0xa336('0xd')];this[_0xa336('0xe')]=_0x4d1082['countcongestionretry'];this[_0xa336('0xf')]=_0x4d1082[_0xa336('0xf')];this[_0xa336('0x10')]=_0x4d1082[_0xa336('0xd')]+_0x4d1082[_0xa336('0xe')]+_0x4d1082['countnoanswerretry']+_0x4d1082[_0xa336('0x11')]+_0x4d1082[_0xa336('0x12')]+_0x4d1082[_0xa336('0x13')]+_0x4d1082[_0xa336('0x14')]+_0x4d1082[_0xa336('0x15')];this['countnosuchnumberretry']=_0x4d1082[_0xa336('0x11')];this['countdropretry']=_0x4d1082[_0xa336('0x12')];this[_0xa336('0x13')]=_0x4d1082[_0xa336('0x13')];this[_0xa336('0x14')]=_0x4d1082[_0xa336('0x14')];this[_0xa336('0x15')]=_0x4d1082[_0xa336('0x15')];this[_0xa336('0x16')]=_0x40d1a[_0xa336('0x16')];this[_0xa336('0x17')]=_0x4d1082[_0xa336('0x18')];this[_0xa336('0x19')]=_0x4d1082['number'];this[_0xa336('0x1a')]=_0x4d1082[_0xa336('0x1a')];this[_0xa336('0x1b')]=_0x4d1082[_0xa336('0x1b')];this[_0xa336('0x1c')]=moment()[_0xa336('0x1d')](_0xa336('0x1e'));this[_0xa336('0x1f')]=getSeconds(_0x4d1082[_0xa336('0x1b')],_0x4d1082['starttime']);this[_0xa336('0x20')]=0x0;this[_0xa336('0x21')]=getSeconds(this[_0xa336('0x1c')],_0x4d1082[_0xa336('0x1b')]);this[_0xa336('0xc')]=_0x4d1082[_0xa336('0xc')];this[_0xa336('0x22')]=_0xa336('0x23');this[_0xa336('0x24')]=_0x40d1a['cause-txt'];this[_0xa336('0x25')]=_0x4d1082[_0xa336('0x25')];this[_0xa336('0x26')]=_0x4d1082['callbackuniqueid'];this[_0xa336('0x27')]=_0x4d1082[_0xa336('0x27')];this[_0xa336('0x28')]=_0x4d1082['recallme'];this[_0xa336('0x29')]=_0x4d1082[_0xa336('0x29')];this[_0xa336('0x2a')]=_0x4d1082[_0xa336('0x2a')];this['UserId']=_0x4d1082[_0xa336('0x2b')];this[_0xa336('0x2c')]=_0x4d1082[_0xa336('0x2c')];this[_0xa336('0x2d')]=_0x4d1082[_0xa336('0x2d')];}module[_0xa336('0x2e')]=Hangup; \ No newline at end of file +var _0xb6b1=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x2f7b37,_0xa4c055){var _0x404377=function(_0x4ad9ac){while(--_0x4ad9ac){_0x2f7b37['push'](_0x2f7b37['shift']());}};_0x404377(++_0xa4c055);}(_0xb6b1,0xc7));var _0x1b6b=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0xb6b1[_0x5a7112];return _0x3147f7;};'use strict';var util=require(_0x1b6b('0x0'));var _=require(_0x1b6b('0x1'));var moment=require('moment');function getSeconds(_0x2ac9e1,_0xa37ad1){var _0x3ef03a=moment(_0x2ac9e1)['milliseconds'](0x0);var _0x193947=moment(_0xa37ad1)[_0x1b6b('0x2')](0x0);return _0x3ef03a[_0x1b6b('0x3')](_0x193947,_0x1b6b('0x4'));}function Hangup(_0xc94234,_0x5ac23e){this[_0x1b6b('0x5')]=0x4;this[_0x1b6b('0x6')]=_0x1b6b('0x7');this[_0x1b6b('0x8')]=_0xc94234['scheduledat'];this['type']=_0xc94234[_0x1b6b('0x9')];this['campaigntype']=_0xc94234[_0x1b6b('0x9')]===_0x1b6b('0xa')?_0x1b6b('0xb'):_0xc94234[_0x1b6b('0x9')];this[_0x1b6b('0xc')]=_0xc94234['countbusyretry'];this['countcongestionretry']=_0xc94234[_0x1b6b('0xd')];this[_0x1b6b('0xe')]=_0xc94234[_0x1b6b('0xe')];this['countglobal']=_0xc94234[_0x1b6b('0xc')]+_0xc94234[_0x1b6b('0xd')]+_0xc94234[_0x1b6b('0xe')]+_0xc94234[_0x1b6b('0xf')]+_0xc94234[_0x1b6b('0x10')]+_0xc94234[_0x1b6b('0x11')]+_0xc94234[_0x1b6b('0x12')]+_0xc94234['countagentrejectretry'];this[_0x1b6b('0xf')]=_0xc94234['countnosuchnumberretry'];this[_0x1b6b('0x10')]=_0xc94234['countdropretry'];this[_0x1b6b('0x11')]=_0xc94234[_0x1b6b('0x11')];this[_0x1b6b('0x12')]=_0xc94234['countmachineretry'];this[_0x1b6b('0x13')]=_0xc94234[_0x1b6b('0x13')];this[_0x1b6b('0x14')]=_0x5ac23e[_0x1b6b('0x14')];this[_0x1b6b('0x15')]=_0xc94234[_0x1b6b('0x16')];this[_0x1b6b('0x17')]=_0xc94234[_0x1b6b('0x18')];this[_0x1b6b('0x19')]=_0xc94234['starttime'];this[_0x1b6b('0x1a')]=_0xc94234[_0x1b6b('0x1a')];this[_0x1b6b('0x1b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x1b6b('0x1c')]=getSeconds(_0xc94234[_0x1b6b('0x1a')],_0xc94234[_0x1b6b('0x19')]);this['holdtime']=0x0;this[_0x1b6b('0x1d')]=getSeconds(this[_0x1b6b('0x1b')],_0xc94234['responsetime']);this[_0x1b6b('0xb')]=_0xc94234[_0x1b6b('0xb')];this[_0x1b6b('0x1e')]=_0x1b6b('0x1f');this[_0x1b6b('0x20')]=_0x5ac23e[_0x1b6b('0x21')];this[_0x1b6b('0x22')]=_0xc94234[_0x1b6b('0x22')];this['callbackuniqueid']=_0xc94234[_0x1b6b('0x23')];this[_0x1b6b('0x24')]=_0xc94234[_0x1b6b('0x24')];this[_0x1b6b('0x25')]=_0xc94234[_0x1b6b('0x25')];this[_0x1b6b('0x26')]=_0xc94234[_0x1b6b('0x26')];this[_0x1b6b('0x27')]=_0xc94234[_0x1b6b('0x27')];this[_0x1b6b('0x28')]=_0xc94234[_0x1b6b('0x28')];this['VoiceQueueId']=_0xc94234[_0x1b6b('0x29')];this[_0x1b6b('0x2a')]=_0xc94234['CampaignId'];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 869ab31..1e357a1 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 _0xf60d=['scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds'];(function(_0xb5f5ab,_0x228d71){var _0x4f465e=function(_0x4f1d35){while(--_0x4f1d35){_0xb5f5ab['push'](_0xb5f5ab['shift']());}};_0x4f465e(++_0x228d71);}(_0xf60d,0x177));var _0xdf60=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xf60d[_0xbf8ebe];return _0x1e25e8;};'use strict';var util=require(_0xdf60('0x0'));var _=require('lodash');var moment=require(_0xdf60('0x1'));function getSeconds(_0x21a916,_0x986ba2){var _0x4c28c5=moment(_0x21a916)[_0xdf60('0x2')](0x0);var _0x14977b=moment(_0x986ba2)[_0xdf60('0x2')](0x0);return _0x4c28c5[_0xdf60('0x3')](_0x14977b,_0xdf60('0x4'));}function History(_0x115caf){this['uniqueid']=_0x115caf['uniqueid'];this[_0xdf60('0x5')]=_0x115caf[_0xdf60('0x5')]||undefined;this[_0xdf60('0x6')]=_0x115caf[_0xdf60('0x6')];this[_0xdf60('0x7')]=_0x115caf[_0xdf60('0x6')]==='outbound'?_0xdf60('0x8'):_0x115caf['type'];this['countbusyretry']=_0x115caf[_0xdf60('0x9')];this[_0xdf60('0xa')]=_0x115caf['countcongestionretry'];this[_0xdf60('0xb')]=_0x115caf[_0xdf60('0xb')];this[_0xdf60('0xc')]=_0x115caf['countbusyretry']+_0x115caf[_0xdf60('0xa')]+_0x115caf[_0xdf60('0xb')]+_0x115caf[_0xdf60('0xd')]+_0x115caf['countdropretry']+_0x115caf[_0xdf60('0xe')]+_0x115caf['countmachineretry']+_0x115caf['countagentrejectretry'];this['countnosuchnumberretry']=_0x115caf[_0xdf60('0xd')];this[_0xdf60('0xf')]=_0x115caf[_0xdf60('0xf')];this[_0xdf60('0xe')]=_0x115caf[_0xdf60('0xe')];this[_0xdf60('0x10')]=_0x115caf[_0xdf60('0x10')];this['countagentrejectretry']=_0x115caf[_0xdf60('0x11')];this[_0xdf60('0x8')]=_0x115caf[_0xdf60('0x8')];this[_0xdf60('0x12')]=_0x115caf[_0xdf60('0x13')];this[_0xdf60('0x14')]=_0x115caf[_0xdf60('0x15')];this[_0xdf60('0x16')]=_0x115caf[_0xdf60('0x16')];this['responsetime']=_0x115caf[_0xdf60('0x17')];this[_0xdf60('0x18')]=_0x115caf[_0xdf60('0x17')];this[_0xdf60('0x19')]=getSeconds(_0x115caf[_0xdf60('0x17')],_0x115caf['starttime']);this[_0xdf60('0x1a')]=0x0;this[_0xdf60('0x1b')]=0x0;this[_0xdf60('0x1c')]=_0x115caf[_0xdf60('0x1c')];this[_0xdf60('0x1d')]=_0x115caf['callbackuniqueid'];this['callbackat']=_0x115caf['callbackat'];this['recallme']=_0x115caf['recallme'];this[_0xdf60('0x1e')]=_0x115caf[_0xdf60('0x1e')];this[_0xdf60('0x1f')]=_0x115caf['ListId'];this['UserId']=_0x115caf[_0xdf60('0x20')];this[_0xdf60('0x21')]=_0x115caf[_0xdf60('0x21')];this[_0xdf60('0x22')]=_0x115caf[_0xdf60('0x22')];this[_0xdf60('0x23')]=_0x115caf['originatecalleridnum']||'';this[_0xdf60('0x24')]=_0x115caf[_0xdf60('0x24')]||'';}module[_0xdf60('0x25')]=History; \ No newline at end of file +var _0x0d9e=['holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x0d9e,0x18e));var _0xe0d9=function(_0x575939,_0x3e3d7a){_0x575939=_0x575939-0x0;var _0x5d9034=_0x0d9e[_0x575939];return _0x5d9034;};'use strict';var util=require(_0xe0d9('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x2f3424,_0x569c26){var _0x53fddd=moment(_0x2f3424)[_0xe0d9('0x1')](0x0);var _0x28c191=moment(_0x569c26)[_0xe0d9('0x1')](0x0);return _0x53fddd['diff'](_0x28c191,'seconds');}function History(_0x428a21){this['uniqueid']=_0x428a21[_0xe0d9('0x2')];this[_0xe0d9('0x3')]=_0x428a21[_0xe0d9('0x3')]||undefined;this['type']=_0x428a21[_0xe0d9('0x4')];this[_0xe0d9('0x5')]=_0x428a21[_0xe0d9('0x4')]===_0xe0d9('0x6')?_0xe0d9('0x7'):_0x428a21['type'];this['countbusyretry']=_0x428a21[_0xe0d9('0x8')];this[_0xe0d9('0x9')]=_0x428a21[_0xe0d9('0x9')];this['countnoanswerretry']=_0x428a21[_0xe0d9('0xa')];this['countglobal']=_0x428a21[_0xe0d9('0x8')]+_0x428a21[_0xe0d9('0x9')]+_0x428a21[_0xe0d9('0xa')]+_0x428a21[_0xe0d9('0xb')]+_0x428a21[_0xe0d9('0xc')]+_0x428a21[_0xe0d9('0xd')]+_0x428a21[_0xe0d9('0xe')]+_0x428a21[_0xe0d9('0xf')];this[_0xe0d9('0xb')]=_0x428a21[_0xe0d9('0xb')];this[_0xe0d9('0xc')]=_0x428a21[_0xe0d9('0xc')];this[_0xe0d9('0xd')]=_0x428a21[_0xe0d9('0xd')];this[_0xe0d9('0xe')]=_0x428a21[_0xe0d9('0xe')];this[_0xe0d9('0xf')]=_0x428a21[_0xe0d9('0xf')];this[_0xe0d9('0x7')]=_0x428a21['queue'];this[_0xe0d9('0x10')]=_0x428a21[_0xe0d9('0x11')];this[_0xe0d9('0x12')]=_0x428a21[_0xe0d9('0x13')];this[_0xe0d9('0x14')]=_0x428a21[_0xe0d9('0x14')];this['responsetime']=_0x428a21[_0xe0d9('0x15')];this['endtime']=_0x428a21[_0xe0d9('0x15')];this['ringtime']=getSeconds(_0x428a21[_0xe0d9('0x15')],_0x428a21[_0xe0d9('0x14')]);this[_0xe0d9('0x16')]=0x0;this[_0xe0d9('0x17')]=0x0;this[_0xe0d9('0x18')]=_0x428a21[_0xe0d9('0x18')];this['callbackuniqueid']=_0x428a21['callbackuniqueid'];this[_0xe0d9('0x19')]=_0x428a21[_0xe0d9('0x19')];this[_0xe0d9('0x1a')]=_0x428a21[_0xe0d9('0x1a')];this['ContactId']=_0x428a21[_0xe0d9('0x1b')];this['ListId']=_0x428a21[_0xe0d9('0x1c')];this['UserId']=_0x428a21[_0xe0d9('0x1d')];this[_0xe0d9('0x1e')]=_0x428a21[_0xe0d9('0x1e')];this[_0xe0d9('0x1f')]=_0x428a21[_0xe0d9('0x1f')];this[_0xe0d9('0x20')]=_0x428a21['originatecalleridnum']||'';this[_0xe0d9('0x21')]=_0x428a21[_0xe0d9('0x21')]||'';}module[_0xe0d9('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 67f50c0..66f56e8 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 _0x940f=['ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','syncAgentComplete','reason','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','TIMEOUT','dialDropMaxRetry','countdropretry','dialDropRetryFrequency','calleridname','calleridnum','predictiveIntervalDroppedCallsCallersExit','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','actionid','locked','paused','stateinterface','push','pick','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','rrmemory','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','isArray','iftime\x20%s,%s','interval','timezones','content','true','indexOf','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','Queue','method\x20not\x20recognized','handleIvr','checkIsTrunkReachable','[syncQueueSummary]','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','averageHandleTime',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','check\x20failure','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','RUNNING','[actionOriginate]\x20','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','m\x20=\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','newexten','syncNewExten','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','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\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','sequence','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','saveInDb','merge','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','moveContactManagedDialer','syncVarSet','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','state','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','MACHINE','outboundAnswerCallsDay','statedesc','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','createStateFinal','YYYY-MM-DD\x20HH:mm:ss','syncHangup'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x940f,0x11a));var _0xf940=function(_0x4484f7,_0x1c6e68){_0x4484f7=_0x4484f7-0x0;var _0xd4a6fa=_0x940f[_0x4484f7];return _0xd4a6fa;};'use strict';var util=require(_0xf940('0x0'));var _=require(_0xf940('0x1'));var BPromise=require(_0xf940('0x2'));var uuid=require(_0xf940('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0xf940('0x4'));var Redis=require(_0xf940('0x5'));var ut=require(_0xf940('0x6'));var config=require('../../../config/environment/');var logger=require(_0xf940('0x7'))(_0xf940('0x8'));var loggerBooked=require(_0xf940('0x7'))(_0xf940('0x9'));var loggerPredictive=require(_0xf940('0x7'))(_0xf940('0xa'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0xf940('0x7'))(_0xf940('0xb'));var ami=require(_0xf940('0xc'));config[_0xf940('0xd')]=_[_0xf940('0xe')](config['redis'],{'host':_0xf940('0xf'),'port':0x18eb});var io=require(_0xf940('0x10'))(new Redis(config[_0xf940('0xd')]));var cmHopper=require(_0xf940('0x11'));var cmHopperHistory=require(_0xf940('0x12'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xf940('0x13'));var Action=require(_0xf940('0x14'));var History=require(_0xf940('0x15'));var Final=require(_0xf940('0x16'));var AgentComplete=require(_0xf940('0x17'));var QueueCallerAbandon=require(_0xf940('0x18'));var Hangup=require(_0xf940('0x19'));var ipAgi=process[_0xf940('0x1a')]['XCALLY_IP_AGI']||_0xf940('0x1b');var strategy={'rrmemory':'rrmemory','roundrobin':_0xf940('0x1c')};var Sequence=function(){};Sequence[_0xf940('0x1d')][_0xf940('0x1e')]=function(_0x282378){this['tail']=this[_0xf940('0x1f')]?this[_0xf940('0x1f')][_0xf940('0x20')](_0x282378):_0x282378();};function Dialer(_0x42bcce,_0x48efdf){this['sequence']=new Sequence();this[_0xf940('0x21')]=_0x48efdf;this['voiceQueues']=_0x42bcce[_0xf940('0x22')];this['campaigns']=_0x42bcce[_0xf940('0x23')];this[_0xf940('0x24')]=_0x42bcce['agents'];this['trunks']=_0x42bcce[_0xf940('0x25')];this[_0xf940('0x26')]=config[_0xf940('0x26')]||0x2;this['channels']={};this[_0xf940('0x27')]={};this[_0xf940('0x28')]={};this[_0xf940('0x29')]={};this['optionPredictive']={};this['startPredictive']={};this[_0xf940('0x2a')]={};this['ivrOriginated']={};this[_0xf940('0x2b')]={};this[_0xf940('0x2c')]={};ami['on'](_0xf940('0x2d'),this[_0xf940('0x2e')][_0xf940('0x2f')](this));ami['on']('queuecallerabandon',this[_0xf940('0x30')]['bind'](this));ami['on'](_0xf940('0x31'),this[_0xf940('0x32')]['bind'](this));ami['on'](_0xf940('0x33'),this['syncAgentComplete'][_0xf940('0x2f')](this));ami['on'](_0xf940('0x34'),this[_0xf940('0xb')]['bind'](this));ami['on'](_0xf940('0x35'),this['syncHangup']['bind'](this));ami['on'](_0xf940('0x36'),this[_0xf940('0x37')][_0xf940('0x2f')](this));ami['on']('varset',this['syncVarSet'][_0xf940('0x2f')](this));ami['on'](_0xf940('0x38'),this[_0xf940('0x39')]['bind'](this));ami['on']('queuestatuscomplete',this[_0xf940('0x3a')][_0xf940('0x2f')](this));this[_0xf940('0x3b')]();this[_0xf940('0x3c')]();}function isNotNull(_0x674f24){return _0x674f24!==null&&!_[_0xf940('0x3d')](_0x674f24);}function checkIsLoggedIn(_0x71d50,_0x59163c){return function(){if(_0x59163c<=0x0){_0x71d50[_0xf940('0x3e')]=_0xf940('0x3f');throw _0x71d50[_0xf940('0x40')]+_0xf940('0x41');}};}function isActive(_0x9916e8){return _0x9916e8;}function checkIsActive(_0x379241,_0xe87327){return function(){if(!isActive(_0xe87327)){_0x379241[_0xf940('0x3e')]=_0xf940('0x42');throw _0x379241['name']+_0xf940('0x43');}};}function checkInterval(_0x28abc9){return function(){if(!isNotNull(_0x28abc9[_0xf940('0x44')])){_0x28abc9[_0xf940('0x3e')]='INTERVAL_IS_NULL';throw _0x28abc9[_0xf940('0x40')]+_0xf940('0x45');}if(!isNotNull(_0x28abc9[_0xf940('0x44')]['Intervals'])){_0x28abc9[_0xf940('0x3e')]=_0xf940('0x46');throw _0x28abc9[_0xf940('0x40')]+_0xf940('0x45');}if(!isNotNull(_[_0xf940('0x47')](_0x28abc9[_0xf940('0x44')][_0xf940('0x48')]))){_0x28abc9[_0xf940('0x3e')]=_0xf940('0x46');throw _0x28abc9['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x698e68,_0x12ddcd,_0x421d25){return{'action':_0x698e68,'response':_0x12ddcd,'message':_0x421d25,'stack':_0x421d25};}function myreject(_0x29e3d3){return function(_0x3675e1){return _0x29e3d3(msgResponse(_0xf940('0x49'),_0xf940('0x4a'),JSON[_0xf940('0x4b')](_0x3675e1)));};}function getSeconds(_0x1f807a,_0x58cdb9){var _0x3062da=moment(_0x1f807a)[_0xf940('0x4c')](0x0);var _0x4ee704=moment(_0x58cdb9)[_0xf940('0x4c')](0x0);return _0x3062da[_0xf940('0x4d')](_0x4ee704,_0xf940('0x4e'));}function emit(_0x3e2198,_0x503c4b,_0x171db4){io['to'](_0x3e2198)[_0xf940('0x4f')](_0x503c4b,_0x171db4);}function emitVoiceQueueSummary(_0x5ae598){if(_0x5ae598[_0xf940('0x50')]==='outbound'){var _0x4dd541={'id':_0x5ae598['id'],'name':_0x5ae598[_0xf940('0x40')],'strategy':_0x5ae598[_0xf940('0x51')],'answered':_0x5ae598['answered'],'available':_0x5ae598[_0xf940('0x52')],'loggedIn':_0x5ae598[_0xf940('0x53')],'pTalking':_0x5ae598[_0xf940('0x54')],'sumBillable':_0x5ae598[_0xf940('0x55')],'sumDuration':_0x5ae598[_0xf940('0x56')],'sumHoldTime':_0x5ae598[_0xf940('0x57')]||0x0,'talking':_0x5ae598[_0xf940('0x58')],'total':_0x5ae598[_0xf940('0x59')],'type':_0x5ae598[_0xf940('0x50')],'unmanaged':_0x5ae598['unmanaged'],'abandoned':_0x5ae598['abandoned'],'waiting':_0x5ae598[_0xf940('0x5a')],'loggedInDb':_0x5ae598[_0xf940('0x5b')],'dialActive':_0x5ae598[_0xf940('0x5c')],'dialMethod':_0x5ae598[_0xf940('0x5d')],'dialOriginateCallerIdName':_0x5ae598[_0xf940('0x5e')],'dialOriginateCallerIdNumber':_0x5ae598[_0xf940('0x5f')],'dialOriginateTimeout':_0x5ae598[_0xf940('0x60')],'dialPrefix':_0x5ae598[_0xf940('0x61')],'outboundAnswerAgiCallsDay':_0x5ae598[_0xf940('0x62')],'outboundAnswerCallsDay':_0x5ae598['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x5ae598['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x5ae598[_0xf940('0x63')],'outboundCongestionCallsDay':_0x5ae598[_0xf940('0x64')],'outboundDropCallsDayACS':_0x5ae598[_0xf940('0x65')],'outboundDropCallsDayCallersExit':_0x5ae598[_0xf940('0x66')],'outboundDropCallsDayTimeout':_0x5ae598['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x5ae598[_0xf940('0x67')],'outboundNoSuchCallsDay':_0x5ae598[_0xf940('0x68')],'outboundOriginateFailureCallsDay':_0x5ae598[_0xf940('0x69')],'outboundReCallsDay':_0x5ae598[_0xf940('0x6a')],'outboundRejectCallsDay':_0x5ae598['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x5ae598[_0xf940('0x6b')],'predictiveIntervalAnsweredCalls':_0x5ae598[_0xf940('0x6c')],'predictiveIntervalAvgHoldtime':_0x5ae598['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x5ae598[_0xf940('0x6d')],'predictiveIntervalDroppedCallsCallersExit':_0x5ae598['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x5ae598[_0xf940('0x6e')],'predictiveIntervalErlangCalls':_0x5ae598['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x5ae598[_0xf940('0x6f')],'predictiveIntervalHitRate':_0x5ae598[_0xf940('0x70')],'predictiveIntervalMultiplicativeFactor':_0x5ae598['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x5ae598[_0xf940('0x71')],'predictiveIntervalAvailable':_0x5ae598[_0xf940('0x72')],'predictiveIntervalTotalCalls':_0x5ae598[_0xf940('0x73')],'message':_0x5ae598[_0xf940('0x3e')],'originated':_0x5ae598[_0xf940('0x74')],'erlangCalls':_0x5ae598[_0xf940('0x75')],'erlangCallToSecond':_0x5ae598[_0xf940('0x76')],'erlangAbandonmentRate':_0x5ae598[_0xf940('0x77')],'erlangBusyFactor':_0x5ae598[_0xf940('0x78')],'startPredictive':_0x5ae598[_0xf940('0x79')],'startProgressive':_0x5ae598[_0xf940('0x2a')]};if(_0x5ae598['Trunk']){_0x4dd541[_0xf940('0x7a')]={'id':_0x5ae598[_0xf940('0x7a')]['id'],'name':_0x5ae598[_0xf940('0x7a')][_0xf940('0x40')],'active':_0x5ae598[_0xf940('0x7a')][_0xf940('0x7b')],'callerid':_0x5ae598[_0xf940('0x7a')][_0xf940('0x7c')]};}if(_0x5ae598[_0xf940('0x44')]){_0x4dd541[_0xf940('0x44')]={'id':_0x5ae598[_0xf940('0x44')]['id'],'name':_0x5ae598[_0xf940('0x44')][_0xf940('0x40')]};}var _0x26f050=md5(JSON[_0xf940('0x4b')](_0x4dd541));if(_0x5ae598[_0xf940('0x4')]!==_0x26f050){_0x5ae598['md5']=_0x26f050;emit(util[_0xf940('0x7d')](_0xf940('0x7e'),_0x4dd541[_0xf940('0x40')]),_0xf940('0x7f'),_0x4dd541);}}}function emitCampaignSummary(_0x169c14){if(_0x169c14['type']===_0xf940('0x80')){emit(util[_0xf940('0x7d')](_0xf940('0x81'),_0x169c14['name']),'campaign:save',_0x169c14);}}function checkGetDataPredictive(_0x5f4fbd){if(isNotNull(_0x5f4fbd)&&!_[_0xf940('0x47')](_0x5f4fbd)){loggerPredictive[_0xf940('0x82')](_0xf940('0x83'));loggerPredictive[_0xf940('0x82')](_0xf940('0x84'),_0x5f4fbd[_0xf940('0x73')]);loggerPredictive[_0xf940('0x82')](_0xf940('0x85'),_0x5f4fbd[_0xf940('0x6c')]);loggerPredictive[_0xf940('0x82')](_0xf940('0x86'),_0x5f4fbd[_0xf940('0x6e')]);loggerPredictive[_0xf940('0x82')](_0xf940('0x87'),_0x5f4fbd['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0xf940('0x88'),_0x5f4fbd[_0xf940('0x89')]);loggerPredictive[_0xf940('0x82')](_0xf940('0x8a'),_0x5f4fbd['predictiveIntervalAvgTalktime']);loggerPredictive[_0xf940('0x82')](_0xf940('0x8b'));if(_0x5f4fbd[_0xf940('0x73')]>0x0){if(!_[_0xf940('0x3d')](_0x5f4fbd[_0xf940('0x6d')])&&_0x5f4fbd[_0xf940('0x6d')]>0x0){return!![];}loggerPredictive['info'](_0xf940('0x8c'));if(!_[_0xf940('0x3d')](_0x5f4fbd[_0xf940('0x89')])&&_0x5f4fbd[_0xf940('0x89')]>0x0){return!![];}loggerPredictive[_0xf940('0x82')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xf940('0x82')](_0xf940('0x8d'));}}else{loggerPredictive['info'](_0xf940('0x8e'));}return![];}function mergeDataErlangB(_0x9f39d5){return function(_0x59a138){loggerPredictive[_0xf940('0x82')](_0xf940('0x8f'));loggerPredictive[_0xf940('0x82')](_0xf940('0x90'),_0x59a138['erlangCalls']);loggerPredictive[_0xf940('0x82')](_0xf940('0x91'),_0x59a138[_0xf940('0x76')]);loggerPredictive[_0xf940('0x82')](_0xf940('0x92'),_0x59a138['erlangAbandonmentRate']);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x59a138[_0xf940('0x78')]);loggerPredictive['info'](_0xf940('0x92'),_0x59a138['erlangAbandonmentRate']);loggerPredictive[_0xf940('0x82')](_0xf940('0x8b'));_['merge'](_0x9f39d5,_0x59a138);};}function getDiff(_0x4c0679){var _0x59ad14=moment()['milliseconds'](0x0);var _0xa807ea=moment(_0x4c0679)['milliseconds'](0x0);return _0x59ad14[_0xf940('0x4d')](_0xa807ea,_0xf940('0x4e'));}function ifInterval(_0x5bd316,_0x3981a4){if(_[_0xf940('0x3d')](_0x3981a4)){return![];}return getDiff(_0x3981a4)<_0x5bd316*0x3c;}function freeVariablesPredictive(_0x5ea950){if(isNotNull(_0x5ea950)){if(!_[_0xf940('0x3d')](_0x5ea950[_0xf940('0x2a')])){_0x5ea950[_0xf940('0x2a')]=undefined;loggerPredictive[_0xf940('0x82')](_0x5ea950[_0xf940('0x40')],_0xf940('0x93'));}if(!_[_0xf940('0x3d')](_0x5ea950[_0xf940('0x79')])){_0x5ea950['startPredictive']=undefined;loggerPredictive[_0xf940('0x82')](_0x5ea950[_0xf940('0x40')],_0xf940('0x94'));}if(!_[_0xf940('0x3d')](_0x5ea950[_0xf940('0x95')])){clearInterval(_0x5ea950['handlePredictive']);_0x5ea950[_0xf940('0x95')]=undefined;loggerPredictive[_0xf940('0x82')](_0x5ea950[_0xf940('0x40')],_0xf940('0x96'));}}}function erlangb(_0x15d15f,_0x256027){if(_0x256027===0x0){return 0x0;}var _0x1def9a=0x1;for(var _0x4c7257=0x1;_0x4c7257<=_0x256027;_0x4c7257+=0x1){_0x1def9a=0x1+_0x1def9a*_0x4c7257/_0x15d15f;}return 0x1/_0x1def9a;}function isVoiceQueueOutbound(_0x556e99){return _0x556e99==='outbound';}function isNotPreview(_0x1e575c){return _0x1e575c!==_0xf940('0x21');}function isCampaignIvr(_0x2d0cf0){return _0x2d0cf0===_0xf940('0x80');}function getCallerId(_0x409cfb,_0x8963f4,_0x44f7dc){if(!_[_0xf940('0x3d')](_0x44f7dc)&&typeof _0x44f7dc===_0xf940('0x97')&&!_[_0xf940('0x47')](_0x44f7dc)){if(!_[_0xf940('0x3d')](_0x8963f4)&&typeof _0x8963f4===_0xf940('0x97')&&!_[_0xf940('0x47')](_0x8963f4)){return util[_0xf940('0x7d')](_0xf940('0x98'),_0x8963f4,_0x44f7dc);}return util[_0xf940('0x7d')](_0xf940('0x98'),_0x44f7dc,_0x44f7dc);}if(!_[_0xf940('0x3d')](_0x409cfb)&&typeof _0x409cfb===_0xf940('0x97')&&!_['isEmpty'](_0x409cfb)){return _0x409cfb;}return _0xf940('0x99');}function loggerCatchQueueSummary(_0x45daff,_0x534f38){return function(_0x490238){freeVariablesPredictive(_0x534f38);emitVoiceQueueSummary(_0x534f38);emitCampaignSummary(_0x534f38);loggerSyncQueueSummary[_0xf940('0x9a')](_0x45daff,util['inspect'](_0x490238,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x817af6,_0x246704){return function(_0x222b26){loggerPredictive[_0xf940('0x9a')](_0x246704[_0xf940('0x40')],_0x817af6);loggerPredictive['error'](_0x222b26[_0xf940('0x9b')]);freeVariablesPredictive(_0x246704);};}function loggerCatch(_0x570fec){return function(_0x15e453){logger[_0xf940('0x9a')](_0x570fec,util[_0xf940('0x9c')](_0x15e453,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x11a579){return _0x11a579&&!_[_0xf940('0x3d')](_0x11a579)&&_0x11a579[_0xf940('0x9d')]>0x0;}function decremetOriginate(_0x297d8d){if(!_[_0xf940('0x3d')](_0x297d8d)&&_0x297d8d!==null){if(typeof _0x297d8d[_0xf940('0x74')]!==_0xf940('0x9e')){if(_0x297d8d[_0xf940('0x74')]>0x0){_0x297d8d[_0xf940('0x74')]-=0x1;}else{logger[_0xf940('0x9a')](_0xf940('0x9f'));}}}else{logger['error']('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x3992dd,_0x24c920,_0x40f321){if(_0x24c920>_0x40f321){for(var _0x5e6dcf=0x0;_0x5e6dcf<_0x24c920-_0x40f321;_0x5e6dcf+=0x1){decremetOriginate(_0x3992dd);}}}function loggerGetContactDialer(_0x3bc7c4,_0x4b9b84,_0x1ba080){return function(_0x3f7b0d){checkContactLowerLimitOriginate(_0x4b9b84,_0x1ba080,0x0);logger[_0xf940('0x9a')](_0x3bc7c4,util['inspect'](_0x3f7b0d,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2ac936){return function(_0x194b78){if(isNotNull(_0x194b78)&&isNotNull(_0x194b78[0x0])){if(_0x194b78[0x0][_0xf940('0xa0')]>0x0){_0x2ac936[_0xf940('0x3e')]=_0xf940('0xa1');logger[_0xf940('0x82')]('[getContactDialer2][ReScheduled]'+_0x2ac936[_0xf940('0x40')],_0x194b78[0x0][_0xf940('0xa0')],_0xf940('0xa2'));}else{_0x2ac936['message']=_0xf940('0xa3');logger[_0xf940('0x82')](_0xf940('0xa4')+_0x2ac936[_0xf940('0x40')]);}}};}function notSendMessagesQueue(_0x23b8d6){if(_0x23b8d6[_0xf940('0xa5')]){freeVariablesPredictive(_0x23b8d6);if(_0x23b8d6[_0xf940('0x74')]===0x0&&_0x23b8d6['talking']===0x0&&_0x23b8d6['waiting']===0x0&&(_0x23b8d6[_0xf940('0x54')]||0x0)===0x0){_0x23b8d6['sendMessageOneNotActive']=![];_0x23b8d6[_0xf940('0x52')]=0x0;_0x23b8d6[_0xf940('0x3e')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xf940('0x9a')](_0xf940('0xa6'),_0x23b8d6[_0xf940('0x40')],_0xf940('0xa7'));}else{_0x23b8d6[_0xf940('0x3e')]=_0xf940('0xa8');loggerSyncQueueSummary['error'](_0xf940('0xa6'),_0x23b8d6[_0xf940('0x40')],'is\x20disactive');}emitVoiceQueueSummary(_0x23b8d6);}}function notSendMessagesCampaign(_0xd273db){if(_0xd273db[_0xf940('0xa5')]){if(_0xd273db[_0xf940('0x74')]===0x0){_0xd273db['sendMessageOneNotActive']=![];_0xd273db['message']=_0xf940('0x42');loggerSyncQueueSummary[_0xf940('0x9a')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xd273db[_0xf940('0x40')],_0xf940('0xa7'));}else{_0xd273db[_0xf940('0x3e')]=_0xf940('0xa8');loggerSyncQueueSummary[_0xf940('0x9a')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xd273db[_0xf940('0x40')],'is\x20disactive');}emitCampaignSummary(_0xd273db);}}function createObjHistory(_0x12fa16,_0x5de796,_0x425e6b,_0x2600f6,_0x3608dd){_0x12fa16[_0xf940('0x3e')]=_0x425e6b;var _0x1053f6=new Action(_0x12fa16,_0x5de796);var _0x244776=new History(_0x1053f6);_0x244776['state']=_0x2600f6;_0x244776['statedesc']=_0x3608dd;_0x244776[_0xf940('0xa9')]=_0x1053f6[_0xf940('0xaa')];return _0x244776;}Dialer[_0xf940('0x1d')][_0xf940('0x3c')]=function(){var _0x53ed1f=this;setInterval(function(){_0x53ed1f[_0xf940('0xab')](_0x53ed1f['uniqueId'],_0xf940('0xac'));_0x53ed1f['clearZombieChannels'](_0x53ed1f[_0xf940('0x27')],_0xf940('0xad'));},0x32c8);};Dialer['prototype'][_0xf940('0xab')]=function(_0xb0989e,_0x354dde){var _0x1a2baa=this;for(var _0x5cb109 in _0xb0989e){if(typeof _0xb0989e[_0x5cb109]!==_0xf940('0x9e')){this[_0xf940('0xae')][_0xf940('0x1e')](function(){if(!_['isNil'](_0xb0989e[_0x5cb109])){return ami[_0xf940('0xaf')]({'action':_0xf940('0xb0'),'channel':_0xb0989e[_0x5cb109][_0xf940('0xb1')]})[_0xf940('0xb2')](function(_0x4a6018){if(_0x4a6018[_0xf940('0x3e')]===_0xf940('0xb3')){setTimeout(function(){if(_0xb0989e[_0x5cb109]&&_0xb0989e[_0x5cb109]['type']!=='ivr'){_0x1a2baa[_0xf940('0xb4')](_0x1a2baa[_0xf940('0x22')][_0xb0989e[_0x5cb109][_0xf940('0xb5')]]);logger[_0xf940('0x9a')]('[Dialer][checkChannel]',_0x354dde,_0x5cb109,_0xb0989e[_0x5cb109]['queue']);delete _0xb0989e[_0x5cb109];}if(_0xb0989e[_0x5cb109]&&_0xb0989e[_0x5cb109]['type']===_0xf940('0x80')){_0x1a2baa[_0xf940('0xb4')](_0x1a2baa[_0xf940('0x23')][_0xb0989e[_0x5cb109][_0xf940('0xb5')]]);logger['error'](_0xf940('0xb6'),_0x354dde,_0x5cb109,_0xb0989e[_0x5cb109]['queue']);delete _0xb0989e[_0x5cb109];}},0x2328);}});}});}}};Dialer['prototype'][_0xf940('0xb7')]=function(_0x28c4a8){return BPromise[_0xf940('0xb8')]()['then'](cmHopper[_0xf940('0xb7')](_0x28c4a8))['catch'](loggerCatch(_0xf940('0xb9')));};Dialer[_0xf940('0x1d')][_0xf940('0xba')]=function(_0x22fe79){return BPromise[_0xf940('0xb8')]()[_0xf940('0xbb')](cmHopperBlack[_0xf940('0xba')](_0x22fe79))[_0xf940('0xb2')](loggerCatch(_0xf940('0xbc')));};Dialer[_0xf940('0x1d')][_0xf940('0xbd')]=function(_0x3df4d6){return BPromise[_0xf940('0xb8')]()[_0xf940('0xbb')](cmHopperBlack[_0xf940('0xbd')](_0x3df4d6))[_0xf940('0xb2')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xf940('0x1d')]['averageHandleTime']=function(_0x5be88d){return BPromise[_0xf940('0xb8')]()[_0xf940('0xbb')](cmHopperHistory[_0xf940('0xbe')](_0x5be88d))[_0xf940('0xb2')](loggerCatch(_0xf940('0xbf')));};Dialer[_0xf940('0x1d')]['rescheduleContact']=function(_0x5d2713){return BPromise[_0xf940('0xb8')]()['then'](cmHopper[_0xf940('0xc0')](_0x5d2713))[_0xf940('0xb2')](loggerCatch(_0xf940('0xc1')));};Dialer[_0xf940('0x1d')][_0xf940('0xc2')]=function(_0x37dd47,_0x42a6dd,_0x4bead5){return BPromise[_0xf940('0xb8')]()[_0xf940('0xbb')](cmHopper[_0xf940('0xc2')](_0x37dd47,_0x42a6dd,_0x4bead5))['catch'](loggerCatch('[unlockContact]\x20'));};Dialer[_0xf940('0x1d')][_0xf940('0xc3')]=function(_0xe1b14c,_0x1bb598,_0x5761f4,_0x50bc9f){return BPromise[_0xf940('0xb8')]()['then'](cmHopper['getContactDialer'](_0xe1b14c,_0x1bb598,_0x5761f4,_0x50bc9f))[_0xf940('0xb2')](loggerCatch(_0xf940('0xc4')));};Dialer[_0xf940('0x1d')][_0xf940('0xc5')]=function(_0x5a92aa,_0xceedb1,_0xd8b8ae){return BPromise[_0xf940('0xb8')]()[_0xf940('0xbb')](cmHopper[_0xf940('0xc5')](_0x5a92aa,_0xceedb1,_0xd8b8ae))['catch'](loggerCatch(_0xf940('0xc4')));};Dialer[_0xf940('0x1d')][_0xf940('0xc6')]=function(_0x24b111){return BPromise[_0xf940('0xb8')]()[_0xf940('0xbb')](voiceQueueRt[_0xf940('0xc6')](_0x24b111))[_0xf940('0xb2')](loggerCatch(_0xf940('0xc7')));};Dialer[_0xf940('0x1d')]['moveContactManagedDialer']=function(_0x51ad65){return BPromise[_0xf940('0xb8')]()['then'](cmHopper['moveContactManagedDialer'](_0x51ad65))[_0xf940('0xb2')](loggerCatch(_0xf940('0xc8')));};Dialer[_0xf940('0x1d')]['createHistory']=function(_0x185725){return BPromise[_0xf940('0xb8')]()[_0xf940('0xbb')](cmHopperHistory[_0xf940('0xc9')](_0x185725))['catch'](loggerCatch(_0xf940('0xca')));};Dialer['prototype']['updateOriginated']=function(_0x379871){if(!_[_0xf940('0x3d')](_0x379871)&&_0x379871!==null){if(typeof _0x379871['originated']!==_0xf940('0x9e')){if(_0x379871[_0xf940('0x74')]>0x0){_0x379871[_0xf940('0x74')]-=0x1;}else{logger[_0xf940('0x9a')](_0xf940('0xcb'));}}}else{logger[_0xf940('0x9a')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xf940('0x1d')][_0xf940('0xcc')]=function(_0x1ee162,_0x4f6055){var _0x7a1624=this;return function(_0x3271b2){_0x7a1624[_0xf940('0xb4')](_0x4f6055);logger[_0xf940('0x9a')](_0x1ee162,util[_0xf940('0x9c')](_0x3271b2,{'showHidden':![],'depth':null}));};};Dialer[_0xf940('0x1d')][_0xf940('0xcd')]=function(_0x6fdad1,_0x337eff,_0x27fa9e){var _0x20a262={'state':0x19,'statedesc':'notFound'};this[_0xf940('0xb4')](_0x337eff);this[_0xf940('0xce')](_[_0xf940('0xcf')](_0x20a262,_['pick'](_0x27fa9e,[_0xf940('0xd0'),_0xf940('0xd1'),'UserId',_0xf940('0xd2'),_0xf940('0xd3')])),_0xf940('0xd4'),_0xf940('0xd5'));logger[_0xf940('0x9a')](_0x6fdad1);};Dialer['prototype'][_0xf940('0xd6')]=function(_0x453ea6){return _0x453ea6===_0xf940('0xd7');};Dialer[_0xf940('0x1d')][_0xf940('0xd8')]=function(_0x3f17a4){return!_[_0xf940('0x3d')](_0x3f17a4)&&_0x3f17a4&&!_[_0xf940('0x3d')](_0x3f17a4[_0xf940('0x40')])&&!_[_0xf940('0x3d')](_0x3f17a4[_0xf940('0x7b')])&&_0x3f17a4[_0xf940('0x7b')]&&(this[_0xf940('0x25')][util[_0xf940('0x7d')](_0xf940('0xd9'),_0x3f17a4[_0xf940('0x40')])][_0xf940('0xb0')]===_0xf940('0xda')||this[_0xf940('0x25')][util[_0xf940('0x7d')]('SIP/%s',_0x3f17a4[_0xf940('0x40')])][_0xf940('0xb0')]===_0xf940('0xdb'));};Dialer[_0xf940('0x1d')][_0xf940('0xce')]=function(_0x3fd380,_0xfeedfe,_0x451875){this[_0xf940('0xc9')](_0x3fd380)[_0xf940('0xb2')](loggerCatch(_0xfeedfe));this[_0xf940('0xdc')](_0x3fd380)[_0xf940('0xb2')](loggerCatch(_0x451875));};Dialer['prototype'][_0xf940('0xdd')]=function(_0x23f253){var _0x43dff2=this[_0xf940('0x29')][_0x23f253[_0xf940('0xde')]];var _0x42b412;if(!_['isNil'](_0x23f253)&&!_[_0xf940('0xdf')](_0x23f253[_0xf940('0xe0')])&&!_[_0xf940('0xdf')](_0x23f253[_0xf940('0xe0')][_0xf940('0xe1')])&&_0x23f253[_0xf940('0xe2')]===_0xf940('0xe3')&&_0x43dff2){if(_0x43dff2[_0xf940('0x50')]!==_0xf940('0x80')&&this[_0xf940('0x22')][_0x43dff2['queue']][_0xf940('0xe4')]&&_0x23f253[_0xf940('0xe5')]==='HANGUP'){delete this['uniqueId'][_0x23f253[_0xf940('0xde')]];this['updateOriginated'](this['voiceQueues'][_0x43dff2[_0xf940('0xb5')]]);this[_0xf940('0x22')][_0x43dff2[_0xf940('0xb5')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x43dff2[_0xf940('0xb5')]][_0xf940('0x62')]+=0x1;_0x42b412=new Hangup(_0x43dff2,_0x23f253);_0x42b412[_0xf940('0xe6')]=0x12;_0x42b412['statedesc']=_0xf940('0xe7');_0x42b412[_0xf940('0xe8')]=_0xf940('0xe9');ami[_0xf940('0x4f')](_0xf940('0xea'),ut[_0xf940('0xeb')](_0x42b412,_0xf940('0xec')));this['saveInDb'](_0x42b412,_0xf940('0xed'),'[syncHangupInAMD]');}if(_0x43dff2[_0xf940('0x50')]!==_0xf940('0x80')&&this[_0xf940('0x22')][_0x43dff2[_0xf940('0xb5')]][_0xf940('0xe4')]&&_0x23f253[_0xf940('0xe5')]===_0xf940('0xee')){var _0x4453a2=this;return new BPromise(function(_0x1dd4ec,_0x238841){delete _0x4453a2[_0xf940('0x29')][_0x23f253[_0xf940('0xde')]];_0x4453a2[_0xf940('0xb4')](_0x4453a2[_0xf940('0x22')][_0x43dff2[_0xf940('0xb5')]]);_0x4453a2[_0xf940('0x22')][_0x43dff2[_0xf940('0xb5')]][_0xf940('0xef')]+=0x1;_0x4453a2[_0xf940('0x22')][_0x43dff2[_0xf940('0xb5')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3d35de=_0x4453a2[_0xf940('0x22')][_0x43dff2[_0xf940('0xb5')]];var _0x3e73e8=new Hangup(_0x43dff2,_0x23f253);_0x3e73e8[_0xf940('0xe6')]=0x13;_0x3e73e8[_0xf940('0xf0')]='Machine';_0x3e73e8[_0xf940('0xe8')]=_0xf940('0xe9');_0x3e73e8['countmachineretry']+=0x1;_0x3e73e8[_0xf940('0xf1')]+=0x1;_0x3e73e8[_0xf940('0xec')]=!![];ami['emit']('custom:amd',ut[_0xf940('0xeb')](_0x3e73e8,_0xf940('0xec')));_0x4453a2[_0xf940('0xc9')](_0x3e73e8)['catch'](loggerCatch(_0xf940('0xf2')));if(_0x3e73e8[_0xf940('0xf3')]+_0x3e73e8[_0xf940('0xf4')]+_0x3e73e8[_0xf940('0xf5')]+_0x3e73e8[_0xf940('0xf6')]+_0x3e73e8['countdropretry']+_0x3e73e8[_0xf940('0xf7')]+_0x3e73e8[_0xf940('0xf8')]+_0x3e73e8[_0xf940('0xf9')]>=_0x3d35de[_0xf940('0xfa')]){_0x4453a2[_0xf940('0xfb')](_0x3e73e8,_0x1dd4ec,_0x238841,_0xf940('0xfc'));}else{if(_0x3e73e8['countmachineretry']>=_0x3d35de[_0xf940('0xfd')]){_0x4453a2['createStateFinal'](_0x3e73e8,_0x1dd4ec,_0x238841,_0xf940('0xfe'));}else{_0x4453a2[_0xf940('0xc0')]({'active':![],'countmachineretry':_0x3e73e8[_0xf940('0xf8')],'scheduledat':moment()[_0xf940('0xff')](_0x3d35de[_0xf940('0x100')],_0xf940('0x101'))[_0xf940('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3e73e8[_0xf940('0xd0')],'ListId':_0x3e73e8[_0xf940('0xd1')],'VoiceQueueId':_0x3e73e8['VoiceQueueId']||undefined,'CampaignId':_0x3e73e8['CampaignId']||undefined})[_0xf940('0xb2')](loggerCatch(_0xf940('0x102')));_0x1dd4ec({'reschedule':0x1});}}});}if(_0x43dff2[_0xf940('0x50')]==='ivr'&&this[_0xf940('0x23')][_0x43dff2[_0xf940('0xb5')]]['dialAMDActive']&&_0x23f253[_0xf940('0xe5')]==='HANGUP'){delete this[_0xf940('0x29')][_0x23f253[_0xf940('0xde')]];this[_0xf940('0xb4')](this[_0xf940('0x23')][_0x43dff2[_0xf940('0xb5')]]);_0x42b412=new Hangup(_0x43dff2,_0x23f253);_0x42b412[_0xf940('0xe6')]=0x12;_0x42b412[_0xf940('0xf0')]=_0xf940('0xe7');_0x42b412[_0xf940('0xe8')]='AMD';ami[_0xf940('0x4f')](_0xf940('0xea'),ut['buildObj'](_0x42b412,_0xf940('0xec')));this[_0xf940('0xce')](_0x42b412,_0xf940('0x103'),_0xf940('0x104'));}if(_0x43dff2[_0xf940('0x50')]===_0xf940('0x80')&&this[_0xf940('0x23')][_0x43dff2[_0xf940('0xb5')]][_0xf940('0xe4')]&&_0x23f253[_0xf940('0xe5')]===_0xf940('0xee')){var _0x4453a2=this;return new BPromise(function(_0x5a07d7,_0x48f2f2){delete _0x4453a2[_0xf940('0x29')][_0x23f253[_0xf940('0xde')]];_0x4453a2[_0xf940('0xb4')](_0x4453a2[_0xf940('0x23')][_0x43dff2[_0xf940('0xb5')]]);_0x4453a2['campaigns'][_0x43dff2['queue']][_0xf940('0xef')]+=0x1;_0x4453a2[_0xf940('0x23')][_0x43dff2[_0xf940('0xb5')]][_0xf940('0x62')]+=0x1;var _0x4426e6=_0x4453a2[_0xf940('0x23')][_0x43dff2[_0xf940('0xb5')]];var _0x9b04c2=new Hangup(_0x43dff2,_0x23f253);_0x9b04c2[_0xf940('0xe6')]=0x13;_0x9b04c2[_0xf940('0xf0')]=_0xf940('0x105');_0x9b04c2[_0xf940('0xe8')]=_0xf940('0xe9');_0x9b04c2[_0xf940('0xf8')]+=0x1;_0x9b04c2['countglobal']+=0x1;_0x9b04c2['amd']=!![];ami[_0xf940('0x4f')]('custom:amd',ut['buildObj'](_0x9b04c2,_0xf940('0xec')));_0x4453a2[_0xf940('0xc9')](_0x9b04c2)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x9b04c2[_0xf940('0xf3')]+_0x9b04c2[_0xf940('0xf4')]+_0x9b04c2[_0xf940('0xf5')]+_0x9b04c2[_0xf940('0xf6')]+_0x9b04c2['countdropretry']+_0x9b04c2['countabandonedretry']+_0x9b04c2[_0xf940('0xf8')]+_0x9b04c2[_0xf940('0xf9')]>=_0x4426e6['dialGlobalMaxRetry']){_0x4453a2[_0xf940('0xfb')](_0x9b04c2,_0x5a07d7,_0x48f2f2,_0xf940('0xfc'));}else{if(_0x9b04c2[_0xf940('0xf8')]>=_0x4426e6[_0xf940('0xfd')]){_0x4453a2[_0xf940('0x106')](_0x9b04c2,_0x5a07d7,_0x48f2f2,_0xf940('0xfe'));}else{_0x4453a2[_0xf940('0xc0')]({'active':![],'countmachineretry':_0x9b04c2[_0xf940('0xf8')],'scheduledat':moment()['add'](_0x4426e6['dialMachineRetryFrequency'],_0xf940('0x101'))[_0xf940('0x7d')](_0xf940('0x107')),'ContactId':_0x9b04c2['ContactId'],'ListId':_0x9b04c2['ListId'],'VoiceQueueId':_0x9b04c2[_0xf940('0xd2')]||undefined,'CampaignId':_0x9b04c2['CampaignId']||undefined})[_0xf940('0xb2')](loggerCatch(_0xf940('0x102')));_0x5a07d7({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xf940('0x108')]=function(_0x238b56){var _0x2bd1b8=this[_0xf940('0x29')][_0x238b56[_0xf940('0xde')]];var _0x114757=this;var _0x5ad9d3;if(_0x2bd1b8&&_0x2bd1b8[_0xf940('0x50')]===_0xf940('0x80')){delete this[_0xf940('0x29')][_0x238b56[_0xf940('0xde')]];this['updateOriginated'](this[_0xf940('0x23')][_0x2bd1b8[_0xf940('0xb5')]]);this[_0xf940('0x23')][_0x2bd1b8['queue']][_0xf940('0x109')]+=0x1;_0x5ad9d3=new Hangup(_0x2bd1b8,_0x238b56);this[_0xf940('0xc9')](_0x5ad9d3)[_0xf940('0xb2')](loggerCatch(_0xf940('0x10a')));this['moveContactManagedDialer'](_0x5ad9d3)['catch'](loggerCatch(_0xf940('0x10b')));}if(_0x2bd1b8&&_0x2bd1b8[_0xf940('0x50')]!==_0xf940('0x80')&&isNotNull(this[_0xf940('0x22')][_0x2bd1b8[_0xf940('0xb5')]][_0xf940('0x10c')])){delete this[_0xf940('0x29')][_0x238b56[_0xf940('0xde')]];this[_0xf940('0xb4')](this[_0xf940('0x22')][_0x2bd1b8[_0xf940('0xb5')]]);this[_0xf940('0x22')][_0x2bd1b8[_0xf940('0xb5')]][_0xf940('0xef')]+=0x1;this[_0xf940('0x22')][_0x2bd1b8[_0xf940('0xb5')]][_0xf940('0x62')]+=0x1;_0x5ad9d3=new Hangup(_0x2bd1b8,_0x238b56);_0x5ad9d3[_0xf940('0xe6')]=0x10;_0x5ad9d3['statedesc']='AnswerAGI';_0x5ad9d3[_0xf940('0xe8')]=_0xf940('0x10d');this[_0xf940('0xc9')](_0x5ad9d3)['catch'](loggerCatch(_0xf940('0x10a')));this[_0xf940('0xdc')](_0x5ad9d3)[_0xf940('0xb2')](loggerCatch(_0xf940('0x10b')));}if(_0x2bd1b8&&_0x2bd1b8[_0xf940('0x50')]!==_0xf940('0x80')&&!isNotNull(this[_0xf940('0x22')][_0x2bd1b8[_0xf940('0xb5')]]['dialQueueProject'])){delete this['uniqueId'][_0x238b56[_0xf940('0xde')]];this[_0xf940('0xb4')](this['voiceQueues'][_0x2bd1b8[_0xf940('0xb5')]]);this['voiceQueues'][_0x2bd1b8['queue']][_0xf940('0x6b')]+=0x1;_0x5ad9d3=new Hangup(_0x2bd1b8,_0x238b56);_0x5ad9d3[_0xf940('0xe6')]=0xc;_0x5ad9d3[_0xf940('0xf0')]=_0x238b56[_0xf940('0x10e')];_0x5ad9d3[_0xf940('0xe8')]='Unknow';this[_0xf940('0xc9')](_0x5ad9d3)[_0xf940('0xb2')](loggerCatch(_0xf940('0x10a')));this[_0xf940('0xdc')](_0x5ad9d3)[_0xf940('0xb2')](loggerCatch(_0xf940('0x10b')));}};Dialer[_0xf940('0x1d')][_0xf940('0x10f')]=function(_0x1a3f3d){var _0x2d22f5=this['uniqueId'][_0x1a3f3d[_0xf940('0xde')]];var _0x4006d0=this;if(this['voiceQueues'][_0x1a3f3d[_0xf940('0xb5')]]){if(_0x2d22f5&&_0x2d22f5[_0xf940('0x50')]!==_0xf940('0x80')){delete this[_0xf940('0x29')][_0x1a3f3d['uniqueid']];this[_0xf940('0x22')][_0x1a3f3d[_0xf940('0xb5')]][_0xf940('0xef')]+=0x1;var _0x271e2b=new AgentComplete(_0x2d22f5,_0x1a3f3d);if(_0x1a3f3d[_0xf940('0x110')]==='agent'){_0x271e2b[_0xf940('0x111')]=this[_0xf940('0x22')][_0x1a3f3d['queue']][_0xf940('0x112')]&&this[_0xf940('0x22')][_0x1a3f3d[_0xf940('0xb5')]]['dialAgiAfterHangupAgent']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xf940('0xc9')](_0x271e2b)['catch'](loggerCatch(_0xf940('0x113')));this[_0xf940('0xdc')](_0x271e2b)[_0xf940('0xb2')](loggerCatch(_0xf940('0x114')));}}};Dialer[_0xf940('0x1d')][_0xf940('0x2e')]=function(_0x58e43c){if(this[_0xf940('0x22')][_0x58e43c[_0xf940('0xb5')]]){if(this[_0xf940('0x29')][_0x58e43c[_0xf940('0xde')]]&&this[_0xf940('0x29')][_0x58e43c[_0xf940('0xde')]][_0xf940('0x50')]!==_0xf940('0x80')){this['updateOriginated'](this['voiceQueues'][_0x58e43c[_0xf940('0xb5')]]);this[_0xf940('0x29')][_0x58e43c[_0xf940('0xde')]]['answertime']=moment()[_0xf940('0x7d')](_0xf940('0x107'));}}};Dialer[_0xf940('0x1d')][_0xf940('0x115')]=function(_0x6ef274){this['createHistory'](_0x6ef274)[_0xf940('0xb2')](loggerCatch(_0xf940('0x113')));this[_0xf940('0xdc')](_0x6ef274)[_0xf940('0xb2')](loggerCatch(_0xf940('0x116')));};Dialer[_0xf940('0x1d')][_0xf940('0x30')]=function(_0x174457){var _0x2797dc=this[_0xf940('0x29')][_0x174457['uniqueid']];var _0xb197d5=this;if(this[_0xf940('0x22')][_0x174457[_0xf940('0xb5')]]){if(_0x2797dc&&_0x2797dc[_0xf940('0x50')]!==_0xf940('0x80')){delete this[_0xf940('0x29')][_0x174457[_0xf940('0xde')]];this['updateOriginated'](this[_0xf940('0x22')][_0x174457[_0xf940('0xb5')]]);_0x2797dc[_0xf940('0x117')]=moment()[_0xf940('0x7d')](_0xf940('0x107'));var _0x399ebb=new QueueCallerAbandon(_0x2797dc,_0x174457);if(getSeconds(_0x2797dc[_0xf940('0x117')],_0x2797dc[_0xf940('0x118')])>=_0x2797dc[_0xf940('0x119')]){this[_0xf940('0x22')][_0x174457[_0xf940('0xb5')]][_0xf940('0x6e')]+=0x1;this['voiceQueues'][_0x174457['queue']][_0xf940('0x11a')]+=0x1;this[_0xf940('0x22')][_0x174457[_0xf940('0xb5')]][_0xf940('0x6f')]+=0x1;_0x399ebb[_0xf940('0xe6')]=0xa;_0x399ebb['statedesc']=_0xf940('0x11b');_0x399ebb['dropreason']=_0xf940('0x11c');_0x399ebb[_0xf940('0x111')]=this[_0xf940('0x22')][_0x174457[_0xf940('0xb5')]][_0xf940('0x112')]?moment()[_0xf940('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x399ebb['countdropretry']+=0x1;_0x399ebb[_0xf940('0xf1')]+=0x1;if(_0x399ebb['countdropretry']>=this[_0xf940('0x22')][_0x174457['queue']][_0xf940('0x11d')]){this[_0xf940('0x115')](_0x399ebb);}else{this[_0xf940('0xc0')]({'active':![],'countdropretry':_0x399ebb[_0xf940('0x11e')],'scheduledat':moment()[_0xf940('0xff')](this[_0xf940('0x22')][_0x174457[_0xf940('0xb5')]][_0xf940('0x11f')],_0xf940('0x101'))[_0xf940('0x7d')](_0xf940('0x107')),'ContactId':_0x2797dc['ContactId'],'ListId':_0x2797dc[_0xf940('0xd1')],'VoiceQueueId':_0x2797dc['VoiceQueueId']||undefined,'CampaignId':_0x2797dc[_0xf940('0xd3')]||undefined})[_0xf940('0xb2')](loggerCatch('[rescheduleContact][Drop]'));var _0x413df7=new History(_0x399ebb);_0x413df7[_0xf940('0xe6')]=0xa;_0x413df7[_0xf940('0xf0')]=_0xf940('0x11b');_0x413df7[_0xf940('0xaa')]=moment()[_0xf940('0x7d')](_0xf940('0x107'));_0x413df7[_0xf940('0xa9')]=_0x413df7[_0xf940('0xaa')];_0x413df7[_0xf940('0x120')]=_0x399ebb[_0xf940('0x120')];_0x413df7[_0xf940('0x121')]=_0x399ebb[_0xf940('0x121')];this[_0xf940('0xc9')](_0x413df7)[_0xf940('0xb2')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this['voiceQueues'][_0x174457[_0xf940('0xb5')]][_0xf940('0x122')]+=0x1;this['voiceQueues'][_0x174457[_0xf940('0xb5')]][_0xf940('0x66')]+=0x1;_0x399ebb['state']=0xb;_0x399ebb['statedesc']=_0xf940('0x123');_0x399ebb[_0xf940('0x124')]=_0xf940('0x125');_0x399ebb['countabandonedretry']+=0x1;_0x399ebb[_0xf940('0xf1')]+=0x1;if(_0x399ebb[_0xf940('0xf7')]>=this[_0xf940('0x22')][_0x174457[_0xf940('0xb5')]][_0xf940('0x126')]){this[_0xf940('0x115')](_0x399ebb);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x399ebb[_0xf940('0xf7')],'scheduledat':moment()[_0xf940('0xff')](this['voiceQueues'][_0x174457[_0xf940('0xb5')]][_0xf940('0x127')],_0xf940('0x101'))[_0xf940('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2797dc[_0xf940('0xd0')],'ListId':_0x2797dc[_0xf940('0xd1')],'VoiceQueueId':_0x2797dc[_0xf940('0xd2')]||undefined,'CampaignId':_0x2797dc[_0xf940('0xd3')]||undefined})[_0xf940('0xb2')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x413df7=new History(_0x399ebb);_0x413df7[_0xf940('0xe6')]=0xb;_0x413df7[_0xf940('0xf0')]=_0xf940('0x123');_0x413df7[_0xf940('0xaa')]=moment()[_0xf940('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');_0x413df7[_0xf940('0xa9')]=_0x413df7['starttime'];_0x413df7['calleridname']=_0x399ebb[_0xf940('0x120')];_0x413df7[_0xf940('0x121')]=_0x399ebb[_0xf940('0x121')];this['createHistory'](_0x413df7)[_0xf940('0xb2')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer['prototype'][_0xf940('0x37')]=function(_0x43b8b2){if(this[_0xf940('0x27')][_0x43b8b2[_0xf940('0xde')]]){this[_0xf940('0x27')][_0x43b8b2[_0xf940('0xde')]][_0xf940('0xb1')]=_0x43b8b2[_0xf940('0xb1')];}if(this[_0xf940('0x29')][_0x43b8b2[_0xf940('0xde')]]){this[_0xf940('0x29')][_0x43b8b2['uniqueid']][_0xf940('0xb1')]=_0x43b8b2[_0xf940('0xb1')];}};Dialer[_0xf940('0x1d')][_0xf940('0x39')]=function(_0x65cd9f){if(strategy[this[_0xf940('0x22')][this['actions'][_0x65cd9f[_0xf940('0x128')]]['queue']][_0xf940('0x51')]]===_0xf940('0x1c')){if(this[_0xf940('0x27')][_0x65cd9f[_0xf940('0x128')]]&&_['isNil'](this[_0xf940('0x27')][_0x65cd9f['actionid']][_0xf940('0x129')])&&_0x65cd9f['status']==='1'&&_0x65cd9f[_0xf940('0x12a')]==='0'){if(this[_0xf940('0x24')][_0x65cd9f[_0xf940('0x12b')]]){if(!this[_0xf940('0x24')][_0x65cd9f[_0xf940('0x12b')]]['locked']){this[_0xf940('0x24')][_0x65cd9f[_0xf940('0x12b')]][_0xf940('0x129')]=!![];this[_0xf940('0x27')][_0x65cd9f['actionid']]['locked']=!![];this['actions'][_0x65cd9f[_0xf940('0x128')]]['stateinterface']=_0x65cd9f[_0xf940('0x12b')];}}}}else if((strategy[this['voiceQueues'][this[_0xf940('0x27')][_0x65cd9f[_0xf940('0x128')]]['queue']][_0xf940('0x51')]]||'rrmemory')==='rrmemory'){if(this['actions'][_0x65cd9f[_0xf940('0x128')]]){if(this[_0xf940('0x24')][_0x65cd9f['stateinterface']]){this['actions'][_0x65cd9f[_0xf940('0x128')]][_0xf940('0x12b')]=_0x65cd9f['stateinterface'];if(_['isNil'](this[_0xf940('0x2b')][this[_0xf940('0x27')][_0x65cd9f['actionid']][_0xf940('0xb5')]])){this[_0xf940('0x2b')][this[_0xf940('0x27')][_0x65cd9f[_0xf940('0x128')]][_0xf940('0xb5')]]=[];}this[_0xf940('0x2b')][this['actions'][_0x65cd9f[_0xf940('0x128')]]['queue']][_0xf940('0x12c')](_[_0xf940('0xcf')](_[_0xf940('0x12d')](this[_0xf940('0x27')][_0x65cd9f[_0xf940('0x128')]],['idHopper','stateinterface']),{'status':_0x65cd9f[_0xf940('0xb0')],'paused':_0x65cd9f[_0xf940('0x12a')]}));}}}};function unlockQueueStatus(_0xc1c49f,_0x4cdfda){setTimeout(function(){if(_['isUndefined'](_0xc1c49f[_0xf940('0x12e')])){loggerBooked['error'](_0xf940('0x12f'),_0x4cdfda);}_0xc1c49f[_0xf940('0x12e')]=!![];loggerBooked[_0xf940('0x82')](_0xf940('0x130'),_0x4cdfda,JSON['stringify'](_['pick'](_0xc1c49f,[_0xf940('0x40'),_0xf940('0x12e')])));},0x1f3);}Dialer[_0xf940('0x1d')][_0xf940('0x3a')]=function(_0x2e1690){var _0x3f7b92=this;var _0x3a574c=_0x3f7b92[_0xf940('0x22')][_0x3f7b92['actions'][_0x2e1690[_0xf940('0x128')]][_0xf940('0xb5')]];if(strategy[this[_0xf940('0x22')][this[_0xf940('0x27')][_0x2e1690[_0xf940('0x128')]][_0xf940('0xb5')]][_0xf940('0x51')]]===_0xf940('0x1c')){if(this[_0xf940('0x27')][_0x2e1690[_0xf940('0x128')]]&&this[_0xf940('0x27')][_0x2e1690['actionid']]['stateinterface']){this['preview'][_0xf940('0x131')](this[_0xf940('0x27')][_0x2e1690[_0xf940('0x128')]][_0xf940('0x132')],this['actions'][_0x2e1690['actionid']][_0xf940('0x12b')])[_0xf940('0xb2')](function(_0x14d1c4){logger[_0xf940('0x9a')](_0xf940('0x133'),util['inspect'](_0x14d1c4,{'showHidden':![],'depth':null}));})[_0xf940('0x20')](function(){_0x3f7b92[_0xf940('0xb4')](_0x3f7b92['voiceQueues'][_0x3f7b92[_0xf940('0x27')][_0x2e1690['actionid']]['queue']]);_0x3f7b92[_0xf940('0x24')][_0x3f7b92[_0xf940('0x27')][_0x2e1690[_0xf940('0x128')]][_0xf940('0x12b')]][_0xf940('0x129')]=![];delete _0x3f7b92['actions'][_0x2e1690[_0xf940('0x128')]];unlockQueueStatus(_0x3a574c);});}else{this[_0xf940('0xb4')](this[_0xf940('0x22')][this[_0xf940('0x27')][_0x2e1690[_0xf940('0x128')]][_0xf940('0xb5')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x2e1690[_0xf940('0x128')]]['ContactId'],'ListId':this[_0xf940('0x27')][_0x2e1690[_0xf940('0x128')]][_0xf940('0xd1')],'VoiceQueueId':this[_0xf940('0x27')][_0x2e1690['actionid']][_0xf940('0xd2')]||undefined,'CampaignId':this[_0xf940('0x27')][_0x2e1690[_0xf940('0x128')]][_0xf940('0xd3')]||undefined})[_0xf940('0xb2')](loggerCatch(_0xf940('0x134')));delete this[_0xf940('0x27')][_0x2e1690['actionid']];unlockQueueStatus(_0x3a574c);}}else if((strategy[this[_0xf940('0x22')][this['actions'][_0x2e1690[_0xf940('0x128')]][_0xf940('0xb5')]]['strategy']]||'rrmemory')===_0xf940('0x135')){var _0x53caea;if(this[_0xf940('0x27')][_0x2e1690['actionid']]&&!_['isEmpty'](this[_0xf940('0x2b')][this[_0xf940('0x27')][_0x2e1690['actionid']][_0xf940('0xb5')]])){if(this[_0xf940('0x2c')][_0x3f7b92[_0xf940('0x27')][_0x2e1690[_0xf940('0x128')]][_0xf940('0xb5')]]){this['queueBookedRR'][_0x3f7b92[_0xf940('0x27')][_0x2e1690['actionid']][_0xf940('0xb5')]]=this['queueBookedRR'][this[_0xf940('0x27')][_0x2e1690['actionid']][_0xf940('0xb5')]]?this['queueBookedRR'][this[_0xf940('0x27')][_0x2e1690[_0xf940('0x128')]]['queue']]:this[_0xf940('0x2b')][this['actions'][_0x2e1690[_0xf940('0x128')]][_0xf940('0xb5')]]?this[_0xf940('0x2b')][this[_0xf940('0x27')][_0x2e1690[_0xf940('0x128')]][_0xf940('0xb5')]][_0xf940('0x136')]||0x0:0x0;}this[_0xf940('0x2b')][this[_0xf940('0x27')][_0x2e1690[_0xf940('0x128')]][_0xf940('0xb5')]][_0xf940('0x136')]=this[_0xf940('0x2c')][this['actions'][_0x2e1690[_0xf940('0x128')]][_0xf940('0xb5')]];for(var _0x5b2cd8=0x0;_0x5b2cd8=0x0;})[_0xf940('0xb2')](myreject(_0x190eab)));}}else{_0x348df0[_0xf940('0x12c')](ami['Action']({'action':'command','command':util[_0xf940('0x7d')]('iftime\x20%s,%s',_0xa07fbe,!_['isUndefined'](config['timezones'][_0x382870])?_0x382870:'')})[_0xf940('0xbb')](function(_0x2f0f58){return _0x2f0f58[_0xf940('0x14e')][_0xf940('0x150')]('true')>=0x0;})[_0xf940('0xb2')](myreject(_0x190eab)));}BPromise[_0xf940('0x151')](_0x348df0)['then'](function(_0x571b06){var _0x335093=_[_0xf940('0x152')](_0x571b06);if(_0x335093){return _0x4b6166(_0x335093);}else{_0x251894[_0xf940('0x3e')]=_0x1ca7b0?_0xf940('0x153'):_0xf940('0x154');return _0x190eab(msgResponse('[ifTime][promiseAll]',_0xf940('0x145'),_0xf940('0x155')+_0x1ca7b0+'\x20'+_0x3f4ef2+_0xf940('0x156')+util['inspect'](_0xa07fbe,{'showHidden':![],'depth':null})+_0xf940('0x157')+_0x382870));}})[_0xf940('0xb2')](function(_0x4f5697){return _0x190eab(msgResponse(_0xf940('0x143'),'Failure',JSON[_0xf940('0x4b')](_0x4f5697)));});});};Dialer[_0xf940('0x1d')][_0xf940('0x158')]=function(_0x36b6be){var _0x2a8c55=this;return function(){switch(_0x36b6be['dialMethod']){case _0xf940('0x159'):freeVariablesPredictive(_0x36b6be);_0x2a8c55['handlePower'](_0x36b6be,0x1);break;case _0xf940('0x15a'):freeVariablesPredictive(_0x36b6be);_0x2a8c55[_0xf940('0x15b')](_0x36b6be,_0x36b6be['dialPowerLevel']);break;case _0xf940('0xa'):_0x2a8c55[_0xf940('0xa')](_0x36b6be);break;case _0xf940('0x9'):freeVariablesPredictive(_0x36b6be);_0x2a8c55[_0xf940('0x15b')](_0x36b6be,0x1);break;default:freeVariablesPredictive(_0x36b6be);logger['error'](_0xf940('0x15c'),_0x36b6be[_0xf940('0x40')],_0xf940('0x15d'));}};};Dialer[_0xf940('0x1d')]['launchHandleIvr']=function(_0x2250da){var _0x366b3b=this;return function(){_0x366b3b[_0xf940('0x15e')](_0x2250da);};};Dialer[_0xf940('0x1d')][_0xf940('0xb')]=function(_0x4b53aa){var _0x315d84=this;if(isNotPreview(_0x4b53aa[_0xf940('0x5d')])){if(isVoiceQueueOutbound(_0x4b53aa[_0xf940('0x50')])&&isActive(_0x4b53aa['dialActive'])){_0x4b53aa[_0xf940('0xa5')]=!![];BPromise[_0xf940('0xb8')]()[_0xf940('0xbb')](checkIsLoggedIn(_0x4b53aa,_0x4b53aa[_0xf940('0x53')]))[_0xf940('0xbb')](checkIsActive(_0x4b53aa,_0x4b53aa['dialActive']))['then'](checkInterval(_0x4b53aa))[_0xf940('0xbb')](_0x315d84[_0xf940('0x15f')](_0x4b53aa))[_0xf940('0xbb')](_0x315d84[_0xf940('0x142')](_0x4b53aa['dialGlobalInterval'],_0x4b53aa['dialTimezone'],_0x4b53aa[_0xf940('0x40')],_0x4b53aa))['then'](_0x315d84['checkIfTimeIntervals'](_0x4b53aa[_0xf940('0x44')],_0x4b53aa['dialTimezone'],_0x4b53aa[_0xf940('0x40')],_0x4b53aa))[_0xf940('0xbb')](_0x315d84[_0xf940('0x158')](_0x4b53aa))[_0xf940('0xb2')](loggerCatchQueueSummary(_0xf940('0x160'),_0x4b53aa));}else{notSendMessagesQueue(_0x4b53aa);}}else{freeVariablesPredictive(_0x4b53aa);}};Dialer[_0xf940('0x1d')][_0xf940('0x140')]=function(){var _0x1369bf=this;var _0x44a8b1;for(var _0x10e42e in this[_0xf940('0x23')]){if(typeof this['campaigns'][_0x10e42e]!=='undefined'){_0x44a8b1=this[_0xf940('0x23')][_0x10e42e];if(isCampaignIvr(_0x44a8b1[_0xf940('0x50')])&&isActive(_0x44a8b1[_0xf940('0x7b')])){_0x44a8b1[_0xf940('0xa5')]=!![];BPromise[_0xf940('0xb8')]()['then'](checkIsActive(_0x44a8b1,_0x44a8b1[_0xf940('0x7b')]))['then'](checkInterval(_0x44a8b1))[_0xf940('0xbb')](_0x1369bf[_0xf940('0x15f')](_0x44a8b1))[_0xf940('0xbb')](_0x1369bf['checkIfTime'](_0x44a8b1[_0xf940('0x161')],_0x44a8b1[_0xf940('0x162')],_0x44a8b1[_0xf940('0x40')],_0x44a8b1))[_0xf940('0xbb')](_0x1369bf[_0xf940('0x144')](_0x44a8b1[_0xf940('0x44')],_0x44a8b1[_0xf940('0x162')],_0x44a8b1[_0xf940('0x40')],_0x44a8b1))[_0xf940('0xbb')](_0x1369bf[_0xf940('0x163')](_0x44a8b1))[_0xf940('0xb2')](loggerCatchQueueSummary(_0xf940('0x164'),_0x44a8b1));}else{notSendMessagesCampaign(_0x44a8b1);}}}};function getCallerIdRandom(_0x4b3713,_0x264424){var _0x3bd76c;var _0x30ae13;var _0x153bc0;if(_0x264424<=0x0){_0x264424=0x1;}_0x3bd76c=new RegExp(_0xf940('0x165')+_0x264424+'}$');_0x30ae13=Math[_0xf940('0x166')](0xa,_0x264424-0x1);_0x153bc0=Math[_0xf940('0x166')](0xa,_0x264424)-0x1;return util[_0xf940('0x7d')]('%s',_['replace'](_0x4b3713,_0x3bd76c,_[_0xf940('0x167')](_0x30ae13,_0x153bc0)));}function extractCalleridName(_0x5e1627){var _0x17f2fc=_0x5e1627[_0xf940('0x168')](/"(.*?)"/);return _0x17f2fc?_0x17f2fc[0x1]:_0x5e1627;}function extractCalleridNumber(_0x3ed919){var _0x3856f8=_0x3ed919[_0xf940('0x168')](/<(.*?)>/);return _0x3856f8?_0x3856f8[0x1]:_0x3ed919;}Dialer[_0xf940('0x1d')][_0xf940('0x169')]=function(_0x4262a2,_0x259f3c){var _0x2a96d0=this;var _0x2caf4d=uuid['v4']();this[_0xf940('0x27')][_0x2caf4d]=new Action(_0x4262a2,_0x259f3c,_0x2caf4d);return new BPromise(function(_0x3d34bf,_0x3839d7){if(_[_0xf940('0x3d')](_0x4262a2)&&typeof _0x4262a2!==_0xf940('0x16a')){return _0x3839d7(msgResponse(_0xf940('0x16b'),_0xf940('0x145'),_0xf940('0x16c')));}if(_[_0xf940('0x3d')](_0x259f3c[_0xf940('0x16d')][_0xf940('0x16e')])||_0x259f3c['Contact']['phone']===null){return _0x3839d7(msgResponse(_0xf940('0x16b'),_0xf940('0x145'),_0xf940('0x16f')));}var _0x124d07={'XMD-CALLERID':_0x2a96d0[_0xf940('0x27')][_0x2caf4d][_0xf940('0x170')](),'XMD-AGI':_0x4262a2['dialQueueProject']?util[_0xf940('0x7d')](_0xf940('0x171'),ipAgi,_0x4262a2[_0xf940('0x10c')]):_0xf940('0x172'),'XMD-AGIAFTER':_0x4262a2['dialQueueProject2']?util[_0xf940('0x7d')](_0xf940('0x171'),ipAgi,_0x4262a2['dialQueueProject2']):_0xf940('0x172'),'XMD-QUEUE':_0x4262a2[_0xf940('0x50')]==='outbound'?util['format'](_0xf940('0x173'),_0x4262a2[_0xf940('0x40')],_0x4262a2[_0xf940('0x174')]||'',_0x4262a2[_0xf940('0x175')]?'c':'',_0x4262a2[_0xf940('0x119')]||0x3):_0xf940('0x172'),'XMD-CONTACTID':_0x259f3c[_0xf940('0xd0')],'XMD-CDRTYPE':_0xf940('0x8'),'CALLERID(all)':_0x2a96d0[_0xf940('0x27')][_0x2caf4d]['getCaller'](),'XMD-AMD':_0x4262a2[_0xf940('0xe4')]?_0xf940('0x176'):_0xf940('0x172'),'XMD-DESTINATION':_0xf940('0xe3')};if(_0x4262a2[_0xf940('0xe4')]){_0x124d07[_0xf940('0x177')]=_0x4262a2['dialAMDInitialSilence']||0x9c4;_0x124d07[_0xf940('0x178')]=_0x4262a2[_0xf940('0x179')]||0x5dc;_0x124d07[_0xf940('0x17a')]=_0x4262a2['dialAMDAfterGreetingSilence']||0x320;_0x124d07['XMD-AMDTOTALANALYSISTIME']=_0x4262a2[_0xf940('0x17b')]||0x1388;_0x124d07['XMD-AMDMINWORDLENGTH']=_0x4262a2[_0xf940('0x17c')]||0x64;_0x124d07[_0xf940('0x17d')]=_0x4262a2[_0xf940('0x17e')]||0x32;_0x124d07[_0xf940('0x17f')]=_0x4262a2[_0xf940('0x180')]||0x3;_0x124d07[_0xf940('0x181')]=_0x4262a2[_0xf940('0x182')]||0x100;_0x124d07[_0xf940('0x183')]=_0x4262a2[_0xf940('0x184')]||0x1388;}if(_0x4262a2['type']==='outbound'){_0x124d07[_0xf940('0x185')]=_0x259f3c[_0xf940('0xd2')];}else{_0x124d07[_0xf940('0x186')]=_0x259f3c[_0xf940('0xd3')];}for(var _0x53bc83 in _0x259f3c[_0xf940('0x16d')]){if(typeof _0x259f3c[_0xf940('0x16d')][_0x53bc83]!=='undefined'){if(isNotNull(_0x259f3c[_0xf940('0x16d')][_0x53bc83])&&_0x53bc83!=='id'&&_0x53bc83!==_0xf940('0x187')&&_0x53bc83!==_0xf940('0x188')&&_0x53bc83!==_0xf940('0x189')){_0x124d07[util[_0xf940('0x7d')](_0xf940('0x18a'),_0xf940('0x18b'),_['toUpper'](_0x53bc83))]=_0x259f3c[_0xf940('0x16d')][_0x53bc83];}}}var _0x48c05d=_0x2a96d0[_0xf940('0xd8')](_0x4262a2[_0xf940('0x7a')])?getCallerId(_0x4262a2['Trunk'][_0xf940('0x7c')],_0x4262a2[_0xf940('0x5e')],_0x4262a2['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x4262a2[_0xf940('0x5f')],_0x4262a2[_0xf940('0x18c')]):_0x4262a2[_0xf940('0x5f')]):getCallerId(_[_0xf940('0xdf')](_0x4262a2[_0xf940('0x141')])?_0x4262a2['Trunk'][_0xf940('0x7c')]:_0x4262a2[_0xf940('0x141')]['callerid'],_0x4262a2[_0xf940('0x5e')],_0x4262a2['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x4262a2[_0xf940('0x5f')],_0x4262a2['dialRandomLastDigitCallerIdNumber']):_0x4262a2[_0xf940('0x5f')]);if(_0x48c05d){_0x124d07[_0xf940('0x18d')]=_0x2a96d0[_0xf940('0x27')][_0x2caf4d][_0xf940('0x18e')]=extractCalleridName(_0x48c05d);_0x124d07[_0xf940('0x18f')]=_0x2a96d0['actions'][_0x2caf4d]['originatecalleridnum']=extractCalleridNumber(_0x48c05d);}return ami[_0xf940('0xaf')]({'actionid':_0x2caf4d,'action':_0xf940('0x16b'),'channel':_0x2a96d0['isTrunkReachable'](_0x4262a2[_0xf940('0x7a')])?util['format'](_0xf940('0x190'),_0x4262a2[_0xf940('0x7a')][_0xf940('0x40')],isNotNull(_0x4262a2['dialPrefix'])?_0x4262a2[_0xf940('0x61')][_0xf940('0x191')]()||'':'',_0x4262a2[_0xf940('0x192')]>0x0?_0x259f3c['Contact'][_0xf940('0x16e')]['substring'](_0x4262a2['dialCutDigit']):_0x259f3c[_0xf940('0x16d')][_0xf940('0x16e')]):util[_0xf940('0x7d')](_0xf940('0x190'),_[_0xf940('0xdf')](_0x4262a2[_0xf940('0x141')])?_0x4262a2[_0xf940('0x7a')]['name']:_0x4262a2['TrunkBackup'][_0xf940('0x40')],isNotNull(_0x4262a2[_0xf940('0x61')])?_0x4262a2['dialPrefix'][_0xf940('0x191')]()||'':'',_0x4262a2[_0xf940('0x192')]>0x0?_0x259f3c[_0xf940('0x16d')]['phone']['substring'](_0x4262a2[_0xf940('0x192')]):_0x259f3c[_0xf940('0x16d')]['phone']),'callerid':_0x48c05d,'Exten':_0xf940('0xe3'),'Context':_0xf940('0x193'),'Priority':'1','variable':_0x124d07,'timeout':(_0x4262a2['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2caf4d})[_0xf940('0xbb')](function(_0x2b32b6){return _0x3d34bf(_0x2b32b6);})['catch'](function(_0x24ecfb){_0x4262a2[_0xf940('0x69')]+=0x1;var _0xa61e60=new History(_0x2a96d0['actions'][_0x2caf4d]);logger['error'](util[_0xf940('0x7d')](_0xf940('0x194'),JSON[_0xf940('0x4b')](_0x24ecfb)));_0xa61e60['state']=0xe;_0xa61e60[_0xf940('0xf0')]='OriginateError';_0xa61e60['starttime']=moment()[_0xf940('0x7d')](_0xf940('0x107'));_0xa61e60[_0xf940('0xa9')]=_0xa61e60[_0xf940('0xaa')];_0x2a96d0['createHistory'](_0xa61e60)['catch'](loggerCatch('[originate][error]'));_0x2a96d0[_0xf940('0xdc')](_0xa61e60)[_0xf940('0xb2')](loggerCatch(_0xf940('0x195')))[_0xf940('0x20')](function(){delete _0x2a96d0[_0xf940('0x27')][_0x2caf4d];return _0x3839d7(msgResponse(_0xf940('0x16b'),_0xf940('0x4a'),_0xf940('0x196')));});});});};Dialer[_0xf940('0x1d')][_0xf940('0x32')]=function(_0x5275ff){var _0x458078=this[_0xf940('0x27')][_0x5275ff[_0xf940('0x128')]];if(_0x458078){delete this[_0xf940('0x27')][_0x5275ff[_0xf940('0x128')]];_0x458078[_0xf940('0x118')]=moment()[_0xf940('0x7d')](_0xf940('0x107'));var _0x31774a=_0x458078[_0xf940('0x50')]===_0xf940('0x80')?this[_0xf940('0x23')][_0x458078[_0xf940('0xb5')]]:this[_0xf940('0x22')][_0x458078[_0xf940('0x197')]()];if(!this[_0xf940('0xd6')](_0x5275ff[_0xf940('0x198')])){this[_0xf940('0xb4')](_0x31774a);return this[_0xf940('0x199')](_0x458078,_0x31774a,_0x5275ff)['catch'](loggerCatch(_0xf940('0x19a')));}this['uniqueId'][_0x5275ff['uniqueid']]=_0x458078;}};Dialer[_0xf940('0x1d')][_0xf940('0x19b')]=function(_0x4f2c1c,_0xb948f6,_0x2d60fb){var _0x313e28=new History(_0xb948f6);if(_0x313e28[_0xf940('0xf3')]+_0x313e28[_0xf940('0xf4')]+_0x313e28[_0xf940('0xf5')]+_0x313e28[_0xf940('0xf6')]+_0x313e28[_0xf940('0x11e')]+_0x313e28[_0xf940('0xf7')]+_0x313e28['countmachineretry']+_0x313e28['countagentrejectretry']>=_0x2d60fb['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x4f2c1c){case 0x3:if(_0x313e28['countnoanswerretry']>=_0x2d60fb['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0xf940('0xc0')]({'active':![],'countnoanswerretry':_0x313e28['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xf940('0xff')](_0x2d60fb[_0xf940('0x19c')],_0xf940('0x101'))[_0xf940('0x7d')](_0xf940('0x107')),'ContactId':_0x313e28[_0xf940('0xd0')],'ListId':_0x313e28[_0xf940('0xd1')],'VoiceQueueId':_0x313e28[_0xf940('0xd2')]||undefined,'CampaignId':_0x313e28[_0xf940('0xd3')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x313e28[_0xf940('0xf3')]>=_0x2d60fb[_0xf940('0x19d')]-0x1){return!![];}this[_0xf940('0xc0')]({'active':![],'countbusyretry':_0x313e28[_0xf940('0xf3')]+=0x1,'scheduledat':moment()[_0xf940('0xff')](_0x2d60fb[_0xf940('0x19e')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x313e28[_0xf940('0xd0')],'ListId':_0x313e28['ListId'],'VoiceQueueId':_0x313e28[_0xf940('0xd2')]||undefined,'CampaignId':_0x313e28[_0xf940('0xd3')]||undefined})[_0xf940('0xb2')](loggerCatch(_0xf940('0x19f')));break;case 0x8:if(_0x313e28['countcongestionretry']>=_0x2d60fb[_0xf940('0x1a0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x313e28[_0xf940('0xf4')]+=0x1,'scheduledat':moment()[_0xf940('0xff')](_0x2d60fb[_0xf940('0x1a1')],'minutes')[_0xf940('0x7d')](_0xf940('0x107')),'ContactId':_0x313e28[_0xf940('0xd0')],'ListId':_0x313e28[_0xf940('0xd1')],'VoiceQueueId':_0x313e28[_0xf940('0xd2')]||undefined,'CampaignId':_0x313e28['CampaignId']||undefined})[_0xf940('0xb2')](loggerCatch(_0xf940('0x1a2')));break;case 0x0:if(_0x313e28[_0xf940('0xf6')]>=_0x2d60fb[_0xf940('0x1a3')]-0x1){return!![];}else{this[_0xf940('0xc0')]({'active':![],'countnosuchnumberretry':_0x313e28['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xf940('0xff')](_0x2d60fb['dialNoSuchNumberRetryFrequency'],_0xf940('0x101'))[_0xf940('0x7d')](_0xf940('0x107')),'ContactId':_0x313e28['ContactId'],'ListId':_0x313e28[_0xf940('0xd1')],'VoiceQueueId':_0x313e28[_0xf940('0xd2')]||undefined,'CampaignId':_0x313e28[_0xf940('0xd3')]||undefined})['catch'](loggerCatch(_0xf940('0x1a4')));}break;case 0xa:if(_0x313e28[_0xf940('0x11e')]>=_0x2d60fb[_0xf940('0x11d')]-0x1){return!![];}this[_0xf940('0xc0')]({'active':![],'countdropretry':_0x313e28[_0xf940('0x11e')]+=0x1,'scheduledat':moment()[_0xf940('0xff')](_0x2d60fb[_0xf940('0x11f')],_0xf940('0x101'))[_0xf940('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x313e28[_0xf940('0xd0')],'ListId':_0x313e28['ListId'],'VoiceQueueId':_0x313e28['VoiceQueueId']||undefined,'CampaignId':_0x313e28[_0xf940('0xd3')]||undefined})[_0xf940('0xb2')](loggerCatch(_0xf940('0x1a5')));break;case 0xb:if(_0x313e28[_0xf940('0xf7')]>=_0x2d60fb[_0xf940('0x126')]-0x1){return!![];}this[_0xf940('0xc0')]({'active':![],'countabandonedretry':_0x313e28[_0xf940('0xf7')]+=0x1,'scheduledat':moment()['add'](_0x2d60fb[_0xf940('0x127')],_0xf940('0x101'))[_0xf940('0x7d')](_0xf940('0x107')),'ContactId':_0x313e28[_0xf940('0xd0')],'ListId':_0x313e28[_0xf940('0xd1')],'VoiceQueueId':_0x313e28[_0xf940('0xd2')]||undefined,'CampaignId':_0x313e28[_0xf940('0xd3')]||undefined})[_0xf940('0xb2')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x313e28[_0xf940('0xf8')]>=_0x2d60fb[_0xf940('0xfd')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x313e28[_0xf940('0xf8')]+=0x1,'scheduledat':moment()[_0xf940('0xff')](_0x2d60fb['dialMachineRetryFrequency'],_0xf940('0x101'))['format'](_0xf940('0x107')),'ContactId':_0x313e28[_0xf940('0xd0')],'ListId':_0x313e28['ListId'],'VoiceQueueId':_0x313e28[_0xf940('0xd2')]||undefined,'CampaignId':_0x313e28[_0xf940('0xd3')]||undefined})['catch'](loggerCatch(_0xf940('0x102')));break;case 0x14:if(_0x313e28['countagentrejectretry']>=_0x2d60fb['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0xf940('0xc0')]({'active':![],'countagentrejectretry':_0x313e28[_0xf940('0xf9')]+=0x1,'scheduledat':moment()[_0xf940('0xff')](_0x2d60fb[_0xf940('0x1a6')],_0xf940('0x101'))[_0xf940('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x313e28[_0xf940('0xd0')],'ListId':_0x313e28['ListId'],'VoiceQueueId':_0x313e28[_0xf940('0xd2')]||undefined,'CampaignId':_0x313e28[_0xf940('0xd3')]||undefined})['catch'](loggerCatch(_0xf940('0x1a7')));break;default:return!![];}};Dialer[_0xf940('0x1d')][_0xf940('0x199')]=function(_0x50226b,_0x2d342f,_0x2b224a){var _0x4d20a8=this;var _0x34dfba=new History(_0x50226b);return new BPromise(function(_0x36b159,_0x38a8bc){if(_[_0xf940('0x3d')](_0x2d342f)&&typeof _0x2d342f!==_0xf940('0x16a')){return _0x38a8bc(msgResponse(_0xf940('0x1a8'),_0xf940('0x145'),_0xf940('0x1a9')));}if(_[_0xf940('0x3d')](_0x2b224a)&&typeof _0x2b224a!==_0xf940('0x16a')){return _0x38a8bc(msgResponse(_0xf940('0x1a8'),_0xf940('0x145'),_0xf940('0x1aa')));}switch(_0x2b224a[_0xf940('0x110')]){case'0':_0x2d342f[_0xf940('0x68')]+=0x1;_0x34dfba[_0xf940('0xe6')]=0x0;_0x34dfba[_0xf940('0xf0')]=_0xf940('0x1ab');_0x34dfba[_0xf940('0xf6')]+=0x1;_0x34dfba[_0xf940('0xf1')]+=0x1;ami[_0xf940('0x4f')](_0xf940('0x1ac'),ut['buildObj'](_0x50226b,_0xf940('0x1ad')));_0x4d20a8['createHistory'](_0x34dfba)[_0xf940('0xb2')](loggerCatch(_0xf940('0xf2')));if(_0x4d20a8[_0xf940('0x19b')](0x0,_0x50226b,_0x2d342f)){if(_0x34dfba[_0xf940('0xf6')]>=_0x2d342f[_0xf940('0x1a3')]){_0x4d20a8[_0xf940('0x106')](_0x34dfba,_0x36b159,_0x38a8bc,'reason\x200\x20no\x20such\x20number....');}else{_0x4d20a8['stateGlobal'](_0x34dfba,_0x36b159,_0x38a8bc,_0xf940('0x1ae'));}}break;case'3':_0x2d342f['outboundNoAnswerCallsDay']+=0x1;_0x34dfba[_0xf940('0xe6')]=0x3;_0x34dfba[_0xf940('0xf0')]=_0xf940('0x1af');_0x34dfba[_0xf940('0xf5')]+=0x1;_0x34dfba[_0xf940('0xf1')]+=0x1;ami[_0xf940('0x4f')](_0xf940('0x1b0'),ut[_0xf940('0xeb')](_0x50226b,'noanswer'));_0x4d20a8[_0xf940('0xc9')](_0x34dfba)['catch'](loggerCatch(_0xf940('0x1b1')));if(_0x4d20a8[_0xf940('0x19b')](0x3,_0x50226b,_0x2d342f)){if(_0x34dfba[_0xf940('0xf5')]>=_0x2d342f[_0xf940('0x1b2')]){_0x4d20a8[_0xf940('0x106')](_0x34dfba,_0x36b159,_0x38a8bc,_0xf940('0x1b3'));}else{_0x4d20a8[_0xf940('0xfb')](_0x34dfba,_0x36b159,_0x38a8bc,_0xf940('0x1b3'));}}break;case'5':_0x2d342f[_0xf940('0x63')]+=0x1;_0x34dfba[_0xf940('0xe6')]=0x5;_0x34dfba[_0xf940('0xf0')]=_0xf940('0x1b4');_0x34dfba[_0xf940('0xf3')]+=0x1;_0x34dfba[_0xf940('0xf1')]+=0x1;ami[_0xf940('0x4f')](_0xf940('0x1b5'),ut[_0xf940('0xeb')](_0x50226b,_0xf940('0x1b6')));_0x4d20a8[_0xf940('0xc9')](_0x34dfba)[_0xf940('0xb2')](loggerCatch(_0xf940('0x1b7')));if(_0x4d20a8['checkRetriveMax'](0x5,_0x50226b,_0x2d342f)){if(_0x34dfba[_0xf940('0xf3')]>=_0x2d342f['dialBusyMaxRetry']){_0x4d20a8[_0xf940('0x106')](_0x34dfba,_0x36b159,_0x38a8bc,_0xf940('0x1b8'));}else{_0x4d20a8['stateGlobal'](_0x34dfba,_0x36b159,_0x38a8bc,_0xf940('0x1b8'));}}break;case'8':_0x2d342f['outboundCongestionCallsDay']+=0x1;_0x34dfba[_0xf940('0xe6')]=0x8;_0x34dfba['statedesc']=_0xf940('0x1b9');_0x34dfba[_0xf940('0xf4')]+=0x1;_0x34dfba[_0xf940('0xf1')]+=0x1;ami['emit'](_0xf940('0x1ba'),ut[_0xf940('0xeb')](_0x50226b,_0xf940('0x1bb')));_0x4d20a8[_0xf940('0xc9')](_0x34dfba)['catch'](loggerCatch(_0xf940('0x1bc')));if(_0x4d20a8['checkRetriveMax'](0x8,_0x50226b,_0x2d342f)){if(_0x34dfba[_0xf940('0xf4')]>=_0x2d342f['dialCongestionMaxRetry']){_0x4d20a8[_0xf940('0x106')](_0x34dfba,_0x36b159,_0x38a8bc,_0xf940('0x1bd'));}else{_0x4d20a8['stateGlobal'](_0x34dfba,_0x36b159,_0x38a8bc,'reason\x208\x20congestion');}}break;case'11':_0x2d342f[_0xf940('0x1be')]+=0x1;_0x34dfba[_0xf940('0xe6')]=0xb;_0x34dfba[_0xf940('0xf0')]='Abandoned';_0x34dfba['countabandonedretry']+=0x1;_0x34dfba[_0xf940('0xf1')]+=0x1;_0x4d20a8[_0xf940('0xc9')](_0x34dfba)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x4d20a8[_0xf940('0x19b')](0xb,_0x50226b,_0x2d342f)){if(_0x34dfba['countabandonedretry']>=_0x2d342f[_0xf940('0x126')]){_0x4d20a8[_0xf940('0x106')](_0x34dfba,_0x36b159,_0x38a8bc,'reason\x2011\x20abandoned');}else{_0x4d20a8['stateGlobal'](_0x34dfba,_0x36b159,_0x38a8bc,_0xf940('0x1bf'));}}break;case'20':_0x2d342f[_0xf940('0x1c0')]+=0x1;_0x34dfba[_0xf940('0xe6')]=0x14;_0x34dfba['statedesc']='AgentReject';_0x34dfba['countagentrejectretry']+=0x1;_0x34dfba[_0xf940('0xf1')]+=0x1;ami['emit'](_0xf940('0x1c1'),ut[_0xf940('0xeb')](_0x50226b,_0xf940('0x1c2')));_0x4d20a8[_0xf940('0xc9')](_0x34dfba)[_0xf940('0xb2')](loggerCatch(_0xf940('0x1c3')));if(_0x4d20a8['checkRetriveMax'](0x14,_0x50226b,_0x2d342f)){if(_0x34dfba[_0xf940('0xf9')]>=_0x2d342f[_0xf940('0x1c4')]){_0x4d20a8['createStateFinal'](_0x34dfba,_0x36b159,_0x38a8bc,_0xf940('0x1c5'));}else{_0x4d20a8[_0xf940('0xfb')](_0x34dfba,_0x36b159,_0x38a8bc,_0xf940('0x1c5'));}}break;default:_0x2d342f[_0xf940('0x6b')]+=0x1;_0x34dfba['state']=0xc;_0x34dfba[_0xf940('0xf0')]=_0x2b224a[_0xf940('0x110')];_0x4d20a8[_0xf940('0xc9')](_0x34dfba)[_0xf940('0xb2')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x4d20a8[_0xf940('0x19b')](_0x2b224a[_0xf940('0x110')],_0x50226b,_0x2d342f)){if(_0x34dfba[_0xf940('0xf3')]+_0x34dfba[_0xf940('0xf4')]+_0x34dfba['countnoanswerretry']+_0x34dfba['countnosuchnumberretry']+_0x34dfba['countdropretry']+_0x34dfba[_0xf940('0xf7')]+_0x34dfba[_0xf940('0xf8')]+_0x34dfba['countagentrejectretry']>=_0x2d342f[_0xf940('0xfa')]){_0x4d20a8['stateGlobal'](_0x34dfba,_0x36b159,_0x38a8bc,_0x2b224a[_0xf940('0x110')]);}else{_0x4d20a8[_0xf940('0x106')](_0x34dfba,_0x36b159,_0x38a8bc,_0x2b224a[_0xf940('0x110')]);}}}});};Dialer[_0xf940('0x1d')][_0xf940('0xfb')]=function(_0x3a35a8,_0x4a6304,_0x252a86,_0x3c4873){var _0x24ee2e=new Final(_0x3a35a8);_0x24ee2e[_0xf940('0xe6')]=0xf;_0x24ee2e['statedesc']=_0xf940('0x1c6');this['createStateFinal'](_0x24ee2e,_0x4a6304,_0x252a86,_0x3c4873);};Dialer[_0xf940('0x1d')][_0xf940('0x106')]=function(_0x566357,_0x42bdb7,_0x4d4cc1,_0x25b3d9){this[_0xf940('0xdc')](_0x566357)[_0xf940('0xbb')](function(){return _0x42bdb7(msgResponse(_0xf940('0x1a8'),'Success',_0x25b3d9));})[_0xf940('0xb2')](function(){return _0x4d4cc1(msgResponse(_0xf940('0x1c7'),_0xf940('0x145'),_0xf940('0x1c8')));});};Dialer[_0xf940('0x1d')][_0xf940('0xa')]=function(_0x4daf0b){var _0x2a3c5f=_0x4daf0b[_0xf940('0x1c9')]/0x64;var _0x299767=_0x4daf0b[_0xf940('0x11a')]/(_0x4daf0b[_0xf940('0x11a')]+_0x4daf0b[_0xf940('0xef')]);var _0xe67548=Math[_0xf940('0x1ca')](_0x4daf0b[_0xf940('0x72')]*(_0x4daf0b[_0xf940('0x1cb')]/0x64));var _0x207010=Math[_0xf940('0x1ca')](_0x4daf0b['predictiveIntervalAvailable']*(_0x4daf0b[_0xf940('0x1cc')]/0x64));var _0x13307c=_0x4daf0b[_0xf940('0x52')]+_0x4daf0b[_0xf940('0x58')];var _0x27b968=Math[_0xf940('0x1cd')](_0x4daf0b[_0xf940('0x75')]*_0x4daf0b[_0xf940('0x77')]*_0x4daf0b['predictiveIntervalHitRate']*_0x4daf0b[_0xf940('0x1ce')]);if(_[_0xf940('0x3d')](_0x4daf0b['startProgressive'])){if(!_['isUndefined'](_0x4daf0b['startPredictive'])){_0x4daf0b['startPredictive']=undefined;loggerPredictive[_0xf940('0x9a')](_0xf940('0x1cf'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xf940('0x3d')](_0x4daf0b[_0xf940('0x95')])){loggerPredictive['error'](_0xf940('0x1cf'),_0xf940('0x1d0'));clearInterval(_0x4daf0b['handlePredictive']);_0x4daf0b[_0xf940('0x95')]=undefined;}_0x4daf0b[_0xf940('0x2a')]=moment()[_0xf940('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xf940('0x82')](_0x4daf0b[_0xf940('0x40')],_0xf940('0x1d1'),_0x4daf0b['startProgressive']);this[_0xf940('0x15b')](_0x4daf0b,0x1);}else if(ifInterval(_0x4daf0b[_0xf940('0x1d2')],_0x4daf0b[_0xf940('0x2a')])){this[_0xf940('0x15b')](_0x4daf0b,0x1);loggerPredictiveCalls[_0xf940('0x82')](_0xf940('0x1d3'),_0x4daf0b['startProgressive'],_0x4daf0b[_0xf940('0x40')]);_0x4daf0b['erlangCalls']=0x0;_0x4daf0b[_0xf940('0x6f')]=0x0;}else if(_0x2a3c5f<_0x299767&&_0x4daf0b[_0xf940('0x1d4')]===_0xf940('0x1d5')){freeVariablesPredictive(_0x4daf0b);loggerPredictive[_0xf940('0x82')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x299767,_0xf940('0x2a'),_0x4daf0b['name']);}else if(_0x27b968<_0x4daf0b['predictiveIntervalErlangCallsDroppedCalls']&&_0x4daf0b['dialPredictiveOptimization']===_0xf940('0x1d5')){freeVariablesPredictive(_0x4daf0b);loggerPredictive['info'](_0xf940('0x1d6'),_0xf940('0x1d7'),_0x27b968,_0xf940('0x1d8'),_0x4daf0b[_0xf940('0x6f')],_0xf940('0x2a'),_0x4daf0b[_0xf940('0x40')]);}else if(!ifInterval(_0x4daf0b['dialPredictiveInterval'],_0x4daf0b[_0xf940('0x2a')])&&_[_0xf940('0x3d')](_0x4daf0b[_0xf940('0x79')])&&!_[_0xf940('0x3d')](_0x4daf0b[_0xf940('0x2a')])){_0x4daf0b[_0xf940('0x79')]=moment()['format'](_0xf940('0x107'));loggerPredictive['info'](_0x4daf0b[_0xf940('0x40')],_0xf940('0x1d9'),_0x4daf0b[_0xf940('0x79')]);this['averageHandleTime'](_0x4daf0b[_0xf940('0x1d2')])[_0xf940('0xbb')](this[_0xf940('0x1da')](_0x4daf0b))['then'](mergeDataErlangB(_0x4daf0b))['then'](this[_0xf940('0x1db')](_0x4daf0b))[_0xf940('0xb2')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x4daf0b));}else if(!ifInterval(_0x4daf0b[_0xf940('0x1d2')],_0x4daf0b['startPredictive'])){_0x4daf0b[_0xf940('0x6f')]=0x0;_0x4daf0b[_0xf940('0x79')]=moment()[_0xf940('0x7d')](_0xf940('0x107'));loggerPredictive[_0xf940('0x82')](_0x4daf0b['name'],_0xf940('0x1dc'),_0x4daf0b['startPredictive']);clearInterval(_0x4daf0b[_0xf940('0x95')]);_0x4daf0b[_0xf940('0x95')]=undefined;this[_0xf940('0x1dd')](_0x4daf0b[_0xf940('0x1d2')])[_0xf940('0xbb')](this['getDataPredictive'](_0x4daf0b))['then'](mergeDataErlangB(_0x4daf0b))[_0xf940('0xbb')](this['startMethodPredictive'](_0x4daf0b))[_0xf940('0xb2')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x4daf0b));}else if(_0x4daf0b[_0xf940('0x72')]&&_0x13307c<_0x4daf0b[_0xf940('0x72')]-_0x207010){freeVariablesPredictive(_0x4daf0b);loggerPredictive[_0xf940('0x82')](_0x4daf0b[_0xf940('0x40')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x13307c,_0xf940('0x1de'),_0x4daf0b[_0xf940('0x72')],'-',_0x207010,'=',_0x4daf0b[_0xf940('0x72')]-_0x207010,')');}else if(_0x4daf0b[_0xf940('0x72')]&&_0x13307c>_0x4daf0b[_0xf940('0x72')]+_0xe67548){freeVariablesPredictive(_0x4daf0b);loggerPredictive[_0xf940('0x82')](_0x4daf0b[_0xf940('0x40')],_0xf940('0x1df'),_0x13307c,_0xf940('0x1e0'),_0x4daf0b[_0xf940('0x72')],'+',_0xe67548,'=',_0x4daf0b[_0xf940('0x72')]+_0xe67548,')');}};Dialer[_0xf940('0x1d')][_0xf940('0x1da')]=function(_0x2600a6){var _0x147898=this;return function(_0x388ab6){return new BPromise(function(_0x3cf449,_0x3b93d9){_[_0xf940('0xcf')](_0x2600a6,_0x388ab6[0x0]);if(checkGetDataPredictive(_0x388ab6[0x0])){var _0x28e577=_0x2600a6[_0xf940('0x72')]=_0x2600a6[_0xf940('0x58')]+_0x2600a6['available'];var _0x3c990e=_0x2600a6[_0xf940('0x1d2')]*0x3c;var _0x3abaf0=_0x388ab6[0x0]['predictiveIntervalAvgTalktime']+_0x388ab6[0x0][_0xf940('0x89')];var _0x49f912=(_0x388ab6[0x0]['predictiveIntervalAnsweredCalls']+_0x388ab6[0x0][_0xf940('0x6e')]+_0x388ab6[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x388ab6[0x0][_0xf940('0x73')];_0x2600a6[_0xf940('0x70')]=_0x49f912>0x0?_0x49f912:0x1;switch(_0x2600a6[_0xf940('0x1d4')]){case _0xf940('0x1d5'):var _0x217512=_0x2600a6['dialPredictiveOptimizationPercentage']/0x64;return _0x147898[_0xf940('0x1e1')](_0x28e577,_0x3c990e,_0x3abaf0,_0x49f912,_0x217512)[_0xf940('0xbb')](function(_0x1f03ab){return _0x3cf449(_0x1f03ab);});case _0xf940('0x1e2'):var _0x493eb9=_0x2600a6['dialPredictiveOptimizationPercentage']/0x64;return _0x147898[_0xf940('0x1e3')](_0x28e577,_0x3c990e,_0x3abaf0,_0x49f912,_0x493eb9)['then'](function(_0x14583d){return _0x3cf449(_0x14583d);});default:return _0x3b93d9(msgResponse(_0xf940('0x1e4'),_0xf940('0x145'),_0xf940('0x1e5')));}}else{return _0x3b93d9(msgResponse(_0xf940('0x1e4'),_0xf940('0x145'),'check\x20failure'));}});};};Dialer[_0xf940('0x1d')][_0xf940('0x1e6')]=function(_0x3d3574){var _0x150e19=this;return function(_0x33c426){return new BPromise(function(_0x5d7ba1,_0x1aae03){_[_0xf940('0xcf')](_0x3d3574,_0x33c426[0x0]);if(checkGetDataPredictive(_0x33c426[0x0])){loggerPredictive['info'](JSON['stringify'](_0x33c426[0x0]));if(_0x3d3574[_0xf940('0x1d4')]===_0xf940('0x1d5')){return _0x150e19[_0xf940('0xc6')](_0x3d3574['id'])[_0xf940('0xbb')](function(_0x2e1c2a){var _0x5140b1=_0x3d3574['loggedIn']-_0x2e1c2a[0x0][_0xf940('0x1e7')];var _0x44aea5=_0x3d3574[_0xf940('0x1d2')]*0x3c;var _0x564ff9=_0x33c426[0x0][_0xf940('0x6d')]+_0x33c426[0x0][_0xf940('0x89')];var _0x2dc8f7=(_0x33c426[0x0][_0xf940('0x6c')]+_0x33c426[0x0][_0xf940('0x6e')]+_0x33c426[0x0][_0xf940('0x122')])/_0x33c426[0x0][_0xf940('0x73')];var _0x1a33c5=_0x3d3574[_0xf940('0x1c9')]/0x64;_0x3d3574[_0xf940('0x71')]=_0x2e1c2a[0x0][_0xf940('0x1e7')]||0x0;_0x3d3574[_0xf940('0x70')]=_0x2dc8f7>0x0?_0x2dc8f7:0x1;return _0x150e19['abandonmentRate'](_0x5140b1,_0x44aea5,_0x564ff9,_0x2dc8f7,_0x1a33c5);})[_0xf940('0xbb')](function(_0x4353fe){return _0x5d7ba1(_0x4353fe);})['catch'](function(_0x4e2b4a){return _0x1aae03(msgResponse(_0xf940('0x1e8'),'Failure',JSON[_0xf940('0x4b')](_0x4e2b4a)));});}if(_0x3d3574[_0xf940('0x1d4')]===_0xf940('0x1e2')){return _0x150e19[_0xf940('0xc6')](_0x3d3574['id'])[_0xf940('0xbb')](function(_0x29d19b){var _0x3d3c5c=_0x3d3574[_0xf940('0x53')]-_0x29d19b[0x0][_0xf940('0x1e7')];var _0x2870b7=_0x3d3574[_0xf940('0x1d2')]*0x3c;var _0x37826e=_0x33c426[0x0][_0xf940('0x6d')]+_0x33c426[0x0]['predictiveIntervalAvgHoldtime'];var _0x3a15c2=(_0x33c426[0x0][_0xf940('0x6c')]+_0x33c426[0x0][_0xf940('0x6e')]+_0x33c426[0x0][_0xf940('0x122')])/_0x33c426[0x0][_0xf940('0x73')];var _0x237023=_0x3d3574[_0xf940('0x1c9')]/0x64;_0x3d3574[_0xf940('0x71')]=_0x29d19b[0x0][_0xf940('0x1e7')]||0x0;_0x3d3574[_0xf940('0x70')]=_0x3a15c2>0x0?_0x3a15c2:0x1;return _0x150e19[_0xf940('0x1e3')](_0x3d3c5c,_0x2870b7,_0x37826e,_0x3a15c2,_0x237023);})[_0xf940('0xbb')](function(_0x26d1be){return _0x5d7ba1(_0x26d1be);})['catch'](function(_0x5d3179){return _0x1aae03(msgResponse(_0xf940('0x1e8'),_0xf940('0x145'),JSON['stringify'](_0x5d3179)));});}}else{return _0x1aae03(msgResponse(_0xf940('0x1e4'),_0xf940('0x145'),_0xf940('0x1e9')));}});};};Dialer[_0xf940('0x1d')][_0xf940('0x1db')]=function(_0x5ed904){var _0x2c4d13=this;return function(){var _0x56c69a=0x0;var _0x336ac6=Math['floor'](_0x5ed904[_0xf940('0x76')]*0x3e8);if(_0x336ac6>0x0){_0x336ac6=_0x336ac6<0x64?0x64:_0x336ac6;loggerPredictive[_0xf940('0x82')](_0x5ed904[_0xf940('0x40')],_0xf940('0x1ea'),_0x336ac6,_0xf940('0x4c'));_0x5ed904[_0xf940('0x95')]=setInterval(function(){_0x2c4d13[_0xf940('0x95')](_0x5ed904);loggerPredictiveCalls[_0xf940('0x82')](_0xf940('0x1eb'),_0x56c69a+=0x1);},_0x336ac6);}else{loggerPredictive[_0xf940('0x82')](_0x5ed904['name'],_0xf940('0x1ec'));}};};Dialer[_0xf940('0x1d')][_0xf940('0x1ed')]=function(_0x8f3368,_0x481ef0){var _0x252cfb=this;return function(_0x252540){if(_[_0xf940('0x47')](_0x252540)){if(_['isNil'](_0x481ef0['UserId'])||!_0x481ef0[_0xf940('0x1ee')]){if(_0x8f3368['dialMethod']===_0xf940('0x9')){_0x8f3368['queueStatusComplete']=_[_0xf940('0x3d')](_0x8f3368[_0xf940('0x12e')])?!![]:_0x8f3368[_0xf940('0x12e')];var _0x37474d=uuid['v4']();_0x252cfb['actions'][_0x37474d]=new Action(_0x8f3368,_0x481ef0,_0x37474d);loggerBooked[_0xf940('0x82')](_0xf940('0x1ef'),_0x37474d,_0xf940('0x1f0'),JSON[_0xf940('0x4b')](_0x8f3368[_0xf940('0x12e')]),_0xf940('0x1f1'),_0x8f3368[_0xf940('0x40')]);if(_0x8f3368[_0xf940('0x12e')]){_0x8f3368[_0xf940('0x12e')]=![];_0x252cfb['queueBooked'][_0x252cfb[_0xf940('0x27')][_0x37474d]['queue']]=[];ami[_0xf940('0xaf')]({'actionid':_0x37474d,'action':_0xf940('0x1f2'),'queue':_0x8f3368[_0xf940('0x40')]})['catch'](function(){_0x252cfb['updateOriginated'](_0x8f3368);_0x252cfb[_0xf940('0xc0')]({'active':![],'ContactId':_0x252cfb[_0xf940('0x27')][_0x37474d][_0xf940('0xd0')],'ListId':_0x252cfb[_0xf940('0x27')][_0x37474d][_0xf940('0xd1')],'VoiceQueueId':_0x252cfb[_0xf940('0x27')][_0x37474d]['VoiceQueueId']||undefined,'CampaignId':_0x252cfb[_0xf940('0x27')][_0x37474d]['CampaignId']||undefined})['catch'](loggerCatch(_0xf940('0x1f3')));delete _0x252cfb[_0xf940('0x27')][_0x37474d];});}else{loggerBooked[_0xf940('0x82')](_0xf940('0x1f4'),JSON[_0xf940('0x4b')](_0x8f3368[_0xf940('0x12e')]),_0xf940('0x1f1'),_0x8f3368[_0xf940('0x40')]);_0x252cfb[_0xf940('0xb4')](_0x8f3368);_0x252cfb['rescheduleContact']({'active':![],'ContactId':_0x252cfb[_0xf940('0x27')][_0x37474d]['ContactId'],'ListId':_0x252cfb['actions'][_0x37474d]['ListId'],'VoiceQueueId':_0x252cfb['actions'][_0x37474d][_0xf940('0xd2')]||undefined,'CampaignId':_0x252cfb[_0xf940('0x27')][_0x37474d][_0xf940('0xd3')]||undefined})[_0xf940('0xb2')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x252cfb[_0xf940('0x27')][_0x37474d];}}else{return _0x252cfb[_0xf940('0x169')](_0x8f3368,_0x481ef0);}}else{if(getDiff(_0x481ef0[_0xf940('0x1f5')])<_0x8f3368[_0xf940('0x1f6')]*0x3c){if(_0x481ef0[_0xf940('0x1f7')]&&!_0x481ef0[_0xf940('0x1f7')][_0xf940('0x1f8')]){_0x252cfb[_0xf940('0x21')][_0xf940('0x131')](_0x481ef0['id'])['finally'](function(){_0x252cfb['updateOriginated'](_0x8f3368);});}else{_0x252cfb[_0xf940('0xc2')]({'active':![]},_0x481ef0['id'],0x1)[_0xf940('0x20')](function(){_0x252cfb['updateOriginated'](_0x8f3368);});}}else{_0x8f3368['outboundReCallsDay']+=0x1;_0x252cfb[_0xf940('0xb4')](_0x8f3368);if(_0x8f3368['dialRecallInQueue']){_0x252cfb['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x481ef0[_0xf940('0xd0')],'ListId':_0x481ef0['ListId'],'VoiceQueueId':_0x481ef0[_0xf940('0xd2')]||undefined,'CampaignId':_0x481ef0[_0xf940('0xd3')]||undefined})[_0xf940('0xb2')](loggerCatch(_0xf940('0x1f9')));_0x252cfb[_0xf940('0xc9')](createObjHistory(_0x8f3368,_0x481ef0,_0xf940('0x1fa'),0x17,_0xf940('0x1fb')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x252cfb[_0xf940('0xce')](createObjHistory(_0x8f3368,_0x481ef0,_0xf940('0x1fc'),0x16,_0xf940('0x1fd')),_0xf940('0x1fe'),_0xf940('0x1ff'));}}}}else{_0x8f3368[_0xf940('0x200')]+=0x1;_0x252cfb[_0xf940('0xce')](createObjHistory(_0x8f3368,_0x481ef0,_0xf940('0x201'),0xd,_0xf940('0x202')),_0xf940('0x203'),_0xf940('0x204'));throw _0xf940('0x205');}};};Dialer[_0xf940('0x1d')][_0xf940('0x15e')]=function(_0x2a1fbe){var _0x49c5df=this;var _0x57b24d=_0x2a1fbe[_0xf940('0x206')]-_0x2a1fbe[_0xf940('0x74')]-_0x2a1fbe[_0xf940('0x207')];emitCampaignSummary(_0x2a1fbe);if(_0x57b24d>0x0){if(_0x57b24d>this[_0xf940('0x26')]){_0x57b24d=this['maxNumberOriginate'];}_0x2a1fbe[_0xf940('0x207')]+=_0x57b24d;this[_0xf940('0xc5')](_0x2a1fbe['id'],_0x57b24d,_0x2a1fbe[_0xf940('0x208')])[_0xf940('0xbb')](function(_0x56d6b9){_0x2a1fbe[_0xf940('0x207')]-=_0x57b24d;_0x2a1fbe['temp']=_0x2a1fbe[_0xf940('0x207')]>0x0?_0x2a1fbe[_0xf940('0x207')]:0x0;if(!checkContactEmpty(_0x56d6b9)){_0x2a1fbe['message']=_0xf940('0xa3');logger[_0xf940('0x82')](_0xf940('0x209')+_0x2a1fbe[_0xf940('0x40')]);}else{_0x2a1fbe[_0xf940('0x74')]+=_0x56d6b9[_0xf940('0x9d')];_0x2a1fbe[_0xf940('0x3e')]='RUNNING';for(var _0x20b927=0x0;_0x20b927<_0x56d6b9[_0xf940('0x9d')];_0x20b927+=0x1){_0x2a1fbe[_0xf940('0x20a')]+=0x1;if(_[_0xf940('0xdf')](_0x56d6b9[_0x20b927])||_['isNil'](_0x56d6b9[_0x20b927][_0xf940('0x16d')])||_[_0xf940('0xdf')](_0x56d6b9[_0x20b927]['Contact'][_0xf940('0x16e')])){_0x49c5df[_0xf940('0xcd')]('[actionOriginate]\x20',_0x2a1fbe,_0x56d6b9[_0x20b927]);}else{_0x49c5df[_0xf940('0xbd')](_['pick'](_0x56d6b9[_0x20b927],[_0xf940('0xd3'),'Contact.phone']))[_0xf940('0xbb')](_0x49c5df[_0xf940('0x1ed')](_0x2a1fbe,_0x56d6b9[_0x20b927]))[_0xf940('0xb2')](_0x49c5df[_0xf940('0xcc')](_0xf940('0x20b'),_0x2a1fbe));}}}})[_0xf940('0xb2')](loggerGetContactDialer('[getContactCampaign2]',_0x2a1fbe,_0x57b24d));}};Dialer['prototype']['handlePower']=function(_0x59c2b4,_0x17097){var _0x147e69=this;var _0xbf09bd=[];var _0x338936=_0x17097>=0x1?_0x17097:0x1;if(_0x59c2b4[_0xf940('0x5d')]===_0xf940('0x9')){_0x338936=0x1;}var _0x35d7f4=Math['floor'](_0x59c2b4[_0xf940('0x52')]*_0x338936)-_0x59c2b4[_0xf940('0x74')]-_0x59c2b4[_0xf940('0x207')];emitVoiceQueueSummary(_0x59c2b4);if(_0x59c2b4['dialLimitQueue']>0x0){var _0x394dad=_0x59c2b4[_0xf940('0x20c')]-_0x59c2b4['originated']-_0x59c2b4[_0xf940('0x58')]-_0x59c2b4[_0xf940('0x207')]-_0x59c2b4[_0xf940('0x54')];if(_0x35d7f4>_0x394dad){_0x35d7f4=_0x394dad;}}if(_0x35d7f4>0x0){if(_0x59c2b4['dialMethod']===_0xf940('0x9')){_0x35d7f4=0x1;}if(_0x35d7f4>this[_0xf940('0x26')]){_0x35d7f4=this['maxNumberOriginate'];}_0x59c2b4[_0xf940('0x207')]+=_0x35d7f4;for(var _0x1347c4 in this['agents']){if(typeof this[_0xf940('0x24')][_0x1347c4]!==_0xf940('0x9e')){if(this[_0xf940('0x24')][_0x1347c4][_0xf940('0xe6')]===_0xf940('0x20d')&&this[_0xf940('0x24')][_0x1347c4][_0xf940('0xb0')]==='reachable'){_0xbf09bd[_0xf940('0x12c')](this[_0xf940('0x24')][_0x1347c4]['id']);}}}this[_0xf940('0xc3')](_0x59c2b4['id'],_0xbf09bd,_0x35d7f4,_0x59c2b4[_0xf940('0x208')])[_0xf940('0xbb')](function(_0x345087){_0x59c2b4[_0xf940('0x207')]-=_0x35d7f4;_0x59c2b4[_0xf940('0x207')]=_0x59c2b4[_0xf940('0x207')]>0x0?_0x59c2b4[_0xf940('0x207')]:0x0;if(!checkContactEmpty(_0x345087)){_0x147e69[_0xf940('0xb7')](_0x59c2b4)[_0xf940('0xbb')](sendMessageReschedule(_0x59c2b4))[_0xf940('0xb2')](loggerCatch(_0xf940('0xb9')));}else{_0x59c2b4[_0xf940('0x74')]+=_0x345087[_0xf940('0x9d')];_0x59c2b4[_0xf940('0x3e')]=_0x59c2b4[_0xf940('0x5d')]==='booked'?_0xf940('0x176'):_0xf940('0x20e');for(var _0x4d8962=0x0;_0x4d8962<_0x345087[_0xf940('0x9d')];_0x4d8962+=0x1){if(_[_0xf940('0xdf')](_0x345087[_0x4d8962])||_[_0xf940('0xdf')](_0x345087[_0x4d8962]['Contact'])||_[_0xf940('0xdf')](_0x345087[_0x4d8962][_0xf940('0x16d')]['phone'])){_0x147e69[_0xf940('0xcd')](_0xf940('0x20f'),_0x59c2b4,_0x345087[_0x4d8962]);}else{_0x147e69[_0xf940('0xba')](_[_0xf940('0x12d')](_0x345087[_0x4d8962],[_0xf940('0xd2'),_0xf940('0x210')]))[_0xf940('0xbb')](_0x147e69['checkContactBlack'](_0x59c2b4,_0x345087[_0x4d8962]))[_0xf940('0xb2')](_0x147e69[_0xf940('0xcc')](_0xf940('0x20f'),_0x59c2b4));}}}})[_0xf940('0xb2')](loggerGetContactDialer(_0xf940('0x211'),_0x59c2b4,_0x35d7f4));}};Dialer[_0xf940('0x1d')][_0xf940('0x95')]=function(_0x26e62b){if(_0x26e62b['dialLimitQueue']>0x0){var _0x871461=_0x26e62b['dialLimitQueue']-_0x26e62b['originated']-_0x26e62b[_0xf940('0x58')];if(_0x871461>0x0){this[_0xf940('0x212')](_0x26e62b);}else{loggerPredictiveCalls[_0xf940('0x82')](_0xf940('0x213'));}}else{this['tryOriginatePredictive'](_0x26e62b);}};Dialer[_0xf940('0x1d')][_0xf940('0x212')]=function(_0x38725a){var _0x209e06=this;var _0x38de6d=[];_0x38725a[_0xf940('0x74')]+=0x1;for(var _0x1807a8 in this[_0xf940('0x24')]){if(typeof this[_0xf940('0x24')][_0x1807a8]!=='undefined'){if(this[_0xf940('0x24')][_0x1807a8][_0xf940('0xe6')]===_0xf940('0x20d')&&this[_0xf940('0x24')][_0x1807a8][_0xf940('0xb0')]===_0xf940('0xda')){_0x38de6d['push'](this[_0xf940('0x24')][_0x1807a8]['id']);}}}this['getContactDialer'](_0x38725a['id'],_0x38de6d,0x1,_0x38725a[_0xf940('0x208')])[_0xf940('0xbb')](function(_0x5683aa){if(!checkContactEmpty(_0x5683aa)){checkContactLowerLimitOriginate(_0x38725a,0x1,0x0);_0x209e06[_0xf940('0xb7')](_0x38725a)[_0xf940('0xbb')](sendMessageReschedule(_0x38725a))['catch'](loggerCatch(_0xf940('0xb9')));}else{_0x38725a[_0xf940('0x3e')]='RUNNING';if(_[_0xf940('0xdf')](_0x5683aa[0x0])||_['isNil'](_0x5683aa[0x0][_0xf940('0x16d')])||_['isNil'](_0x5683aa[0x0][_0xf940('0x16d')]['phone'])){_0x209e06['emptyContact'](_0xf940('0x20f'),_0x38725a,_0x5683aa[0x0]);}else{_0x209e06[_0xf940('0xba')](_['pick'](_0x5683aa[0x0],[_0xf940('0xd2'),'Contact.phone']))[_0xf940('0xbb')](_0x209e06['checkContactBlack'](_0x38725a,_0x5683aa[0x0]))['catch'](_0x209e06[_0xf940('0xcc')](_0xf940('0x214'),_0x38725a));}}})['catch'](loggerGetContactDialer(_0xf940('0x215'),_0x38725a,0x1));emitVoiceQueueSummary(_0x38725a);};Dialer['prototype']['abandonmentRate']=function(_0xf8084c,_0x50f0a3,_0x4685ee,_0x53e714,_0x47ed66,_0x44b7b8){loggerPredictive[_0xf940('0x82')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xf940('0x82')](_0xf940('0x216'),_0xf8084c);loggerPredictive[_0xf940('0x82')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x50f0a3);loggerPredictive[_0xf940('0x82')]('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',_0x4685ee);loggerPredictive['info'](_0xf940('0x217'),_0x53e714);loggerPredictive[_0xf940('0x82')](_0xf940('0x218'),_0x47ed66);loggerPredictive[_0xf940('0x82')]('---------------------------');return new BPromise(function(_0x16af80,_0x38c275){if(_0xf8084c<=0x0||isNaN(_0xf8084c)){return _0x38c275(msgResponse('[abandonmentRate]',_0xf940('0x4a'),'m\x20=\x20'+_0xf8084c));}if(_0x4685ee<=0x0||isNaN(_0x4685ee)){return _0x38c275(msgResponse(_0xf940('0x219'),_0xf940('0x4a'),_0xf940('0x21a')+_0x4685ee));}if(_0x53e714<=0x0||isNaN(_0x53e714)){return _0x38c275(msgResponse(_0xf940('0x219'),_0xf940('0x4a'),_0xf940('0x21b')+_0x53e714));}if(_0x50f0a3<=0x0||isNaN(_0x50f0a3)){return _0x38c275(msgResponse(_0xf940('0x219'),_0xf940('0x4a'),'interval\x20=\x20'+_0x50f0a3));}if(_0x47ed66<=0x0||isNaN(_0x47ed66)){return _0x38c275(msgResponse(_0xf940('0x219'),_0xf940('0x4a'),_0xf940('0x21c')+_0x47ed66));}_0x44b7b8=_0x44b7b8||0x0;var _0x4deb7e=0x1/_0x4685ee;var _0xe619f=0x0;var _0x32be6b=0x0;var _0x53ffdd=0x0;var _0x40bb67=0x0;for(var _0x1082d5=0x0;_0x53ffdd<_0x47ed66;_0x1082d5+=0x1){_0x32be6b=_0x1082d5/_0x50f0a3;_0xe619f=(_0x53e714*_0x32be6b+_0x44b7b8)/_0x4deb7e;_0x53ffdd=erlangb(_0xe619f,_0xf8084c);_0x40bb67=_0xe619f/_0xf8084c*(0x1-erlangb(_0xe619f,_0xf8084c));}return _0x16af80({'erlangCalls':_0x1082d5,'erlangCallToSecond':_0x50f0a3/_0x1082d5,'erlangAbandonmentRate':_0x53ffdd,'erlangBusyFactor':_0x40bb67});});};Dialer[_0xf940('0x1d')]['busyFactor']=function(_0x72840d,_0x2a4c65,_0x5686a5,_0x1889b2,_0x246703,_0x1dabf3){loggerPredictive[_0xf940('0x82')](_0xf940('0x21d'));loggerPredictive[_0xf940('0x82')](_0xf940('0x216'),_0x72840d);loggerPredictive[_0xf940('0x82')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2a4c65);loggerPredictive[_0xf940('0x82')]('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',_0x5686a5);loggerPredictive[_0xf940('0x82')](_0xf940('0x217'),_0x1889b2);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x246703);loggerPredictive[_0xf940('0x82')]('---------------------------');return new BPromise(function(_0x5c05b0,_0x28feff){if(_0x72840d<=0x0||isNaN(_0x72840d)){return _0x28feff(msgResponse('[busyFactor]',_0xf940('0x4a'),_0xf940('0x21e')+_0x72840d));}if(_0x5686a5<=0x0||isNaN(_0x5686a5)){return _0x28feff(msgResponse(_0xf940('0x21f'),_0xf940('0x4a'),'Ts\x20=\x20'+_0x5686a5));}if(_0x1889b2<=0x0||isNaN(_0x1889b2)){return _0x28feff(msgResponse('[busyFactor]',_0xf940('0x4a'),_0xf940('0x21b')+_0x1889b2));}if(_0x2a4c65<=0x0||isNaN(_0x2a4c65)){return _0x28feff(msgResponse('[busyFactor]',_0xf940('0x4a'),_0xf940('0x220')+_0x2a4c65));}if(_0x246703<=0x0||isNaN(_0x246703)){return _0x28feff(msgResponse('[busyFactor]','Error',_0xf940('0x221')+_0x246703));}_0x1dabf3=_0x1dabf3||0x0;var _0x2551e6=0x1/_0x5686a5;var _0x36864a=0x0;var _0x16990f=0x0;var _0x270143=0x0;var _0x9be856=0x0;for(var _0x574ff5=0x0;_0x9be856<_0x246703;_0x574ff5+=0x1){_0x16990f=_0x574ff5/_0x2a4c65;_0x36864a=(_0x1889b2*_0x16990f+_0x1dabf3)/_0x2551e6;_0x270143=erlangb(_0x36864a,_0x72840d);_0x9be856=_0x36864a/_0x72840d*(0x1-erlangb(_0x36864a,_0x72840d));}return _0x5c05b0({'erlangCalls':_0x574ff5,'erlangCallToSecond':_0x2a4c65/_0x574ff5,'erlangAbandonmentRate':_0x270143,'erlangBusyFactor':_0x9be856});});};module[_0xf940('0x222')]=Dialer; \ No newline at end of file +var _0x53a5=['GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','predictive','method\x20not\x20recognized','launchHandleIvr','handleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','\x5cw{0,','pow','replace','match','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','Contact','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','NONE','dialer','XMD-AMDINITIALSILENCE','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','substring','dialCutDigit','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','isSuccess','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','reason','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','UserId','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','[countReScheduled]\x20','ACTIVE','checkIsBlackList','checkContactBlack','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','util','lodash','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','isEmpty','Intervals','\x20INTERVAL_IS_NULL','Error','stringify','milliseconds','diff','emit','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','ivr','campaign:ivr:%s','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalTotalCalls','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','IS_DISACTIVED','state','statedesc','endtime','prototype','clearZombieChannels','[uniqueid]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','resolve','then','countReScheduled','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','merge','pick','CampaignId','[emptyContact]','isTrunkReachable','SIP/%s','reachable','unmonitored','saveInDb','uniqueid','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','custom:amd','amd','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','ListId','buildObj','[syncHangupInAMDIvr]','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','VoiceQueueId','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','syncAgentComplete','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','paused','stateinterface','locked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','run','[booked][RR][finaly]','contactAgent-idHopper:\x20','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','command','iftime\x20%s,%s','interval','true','content','all'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x53a5,0xc6));var _0x553a=function(_0x1a4812,_0x2be11e){_0x1a4812=_0x1a4812-0x0;var _0x3fc3e3=_0x53a5[_0x1a4812];return _0x3fc3e3;};'use strict';var util=require(_0x553a('0x0'));var _=require(_0x553a('0x1'));var BPromise=require(_0x553a('0x2'));var uuid=require(_0x553a('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0x553a('0x4'));var Redis=require(_0x553a('0x5'));var ut=require(_0x553a('0x6'));var config=require(_0x553a('0x7'));var logger=require(_0x553a('0x8'))('dialer');var loggerBooked=require('../../../config/logger')(_0x553a('0x9'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require('../../../config/logger')(_0x553a('0xa'));var loggerSyncQueueSummary=require(_0x553a('0x8'))(_0x553a('0xb'));var ami=require('../ami');config[_0x553a('0xc')]=_[_0x553a('0xd')](config[_0x553a('0xc')],{'host':_0x553a('0xe'),'port':0x18eb});var io=require(_0x553a('0xf'))(new Redis(config[_0x553a('0xc')]));var cmHopper=require(_0x553a('0x10'));var cmHopperHistory=require(_0x553a('0x11'));var cmHopperBlack=require(_0x553a('0x12'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x553a('0x13'));var History=require(_0x553a('0x14'));var Final=require('./final');var AgentComplete=require(_0x553a('0x15'));var QueueCallerAbandon=require(_0x553a('0x16'));var Hangup=require(_0x553a('0x17'));var ipAgi=process['env'][_0x553a('0x18')]||_0x553a('0x19');var strategy={'rrmemory':_0x553a('0x1a'),'roundrobin':_0x553a('0x1b')};var Sequence=function(){};Sequence['prototype'][_0x553a('0x1c')]=function(_0x4607e0){this[_0x553a('0x1d')]=this['tail']?this[_0x553a('0x1d')][_0x553a('0x1e')](_0x4607e0):_0x4607e0();};function Dialer(_0x5bfbdc,_0x2043d2){this[_0x553a('0x1f')]=new Sequence();this[_0x553a('0x20')]=_0x2043d2;this['voiceQueues']=_0x5bfbdc[_0x553a('0x21')];this[_0x553a('0x22')]=_0x5bfbdc[_0x553a('0x22')];this['agents']=_0x5bfbdc[_0x553a('0x23')];this[_0x553a('0x24')]=_0x5bfbdc['trunks'];this['maxNumberOriginate']=config[_0x553a('0x25')]||0x2;this['channels']={};this[_0x553a('0x26')]={};this[_0x553a('0x27')]={};this[_0x553a('0x28')]={};this['optionPredictive']={};this[_0x553a('0x29')]={};this[_0x553a('0x2a')]={};this[_0x553a('0x2b')]={};this[_0x553a('0x2c')]={};this[_0x553a('0x2d')]={};ami['on'](_0x553a('0x2e'),this[_0x553a('0x2f')][_0x553a('0x30')](this));ami['on'](_0x553a('0x31'),this[_0x553a('0x32')]['bind'](this));ami['on']('originateresponse',this[_0x553a('0x33')][_0x553a('0x30')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x553a('0x30')](this));ami['on']('custom:queuesummary',this[_0x553a('0xb')][_0x553a('0x30')](this));ami['on']('hangup',this[_0x553a('0x34')][_0x553a('0x30')](this));ami['on'](_0x553a('0x35'),this[_0x553a('0x36')][_0x553a('0x30')](this));ami['on']('varset',this[_0x553a('0x37')][_0x553a('0x30')](this));ami['on'](_0x553a('0x38'),this[_0x553a('0x39')][_0x553a('0x30')](this));ami['on'](_0x553a('0x3a'),this['syncQueueStatusComplete'][_0x553a('0x30')](this));this[_0x553a('0x3b')]();this[_0x553a('0x3c')]();}function isNotNull(_0x442f85){return _0x442f85!==null&&!_[_0x553a('0x3d')](_0x442f85);}function checkIsLoggedIn(_0x387b27,_0x575878){return function(){if(_0x575878<=0x0){_0x387b27[_0x553a('0x3e')]='AGENTS_NOT_LOGGED';throw _0x387b27[_0x553a('0x3f')]+_0x553a('0x40');}};}function isActive(_0x6975cd){return _0x6975cd;}function checkIsActive(_0x5d2ae,_0x3bc5d5){return function(){if(!isActive(_0x3bc5d5)){_0x5d2ae[_0x553a('0x3e')]='NOT_ACTIVE';throw _0x5d2ae[_0x553a('0x3f')]+_0x553a('0x41');}};}function checkInterval(_0x495a3b){return function(){if(!isNotNull(_0x495a3b[_0x553a('0x42')])){_0x495a3b[_0x553a('0x3e')]=_0x553a('0x43');throw _0x495a3b[_0x553a('0x3f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x495a3b[_0x553a('0x42')]['Intervals'])){_0x495a3b[_0x553a('0x3e')]=_0x553a('0x43');throw _0x495a3b[_0x553a('0x3f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x553a('0x44')](_0x495a3b[_0x553a('0x42')][_0x553a('0x45')]))){_0x495a3b['message']=_0x553a('0x43');throw _0x495a3b['name']+_0x553a('0x46');}};}function msgResponse(_0x2fe757,_0x9e4cf3,_0x429f76){return{'action':_0x2fe757,'response':_0x9e4cf3,'message':_0x429f76,'stack':_0x429f76};}function myreject(_0x5213ed){return function(_0x3304a2){return _0x5213ed(msgResponse('[ifTime][Action]',_0x553a('0x47'),JSON[_0x553a('0x48')](_0x3304a2)));};}function getSeconds(_0x2e2efb,_0x222f55){var _0x445fcc=moment(_0x2e2efb)['milliseconds'](0x0);var _0x2fb5ec=moment(_0x222f55)[_0x553a('0x49')](0x0);return _0x445fcc[_0x553a('0x4a')](_0x2fb5ec,'seconds');}function emit(_0x593bd3,_0x50b3ab,_0x354106){io['to'](_0x593bd3)[_0x553a('0x4b')](_0x50b3ab,_0x354106);}function emitVoiceQueueSummary(_0x52c168){if(_0x52c168['type']===_0x553a('0x4c')){var _0x3e1bfe={'id':_0x52c168['id'],'name':_0x52c168[_0x553a('0x3f')],'strategy':_0x52c168[_0x553a('0x4d')],'answered':_0x52c168[_0x553a('0x4e')],'available':_0x52c168[_0x553a('0x4f')],'loggedIn':_0x52c168[_0x553a('0x50')],'pTalking':_0x52c168[_0x553a('0x51')],'sumBillable':_0x52c168[_0x553a('0x52')],'sumDuration':_0x52c168['sumDuration'],'sumHoldTime':_0x52c168[_0x553a('0x53')]||0x0,'talking':_0x52c168[_0x553a('0x54')],'total':_0x52c168[_0x553a('0x55')],'type':_0x52c168[_0x553a('0x56')],'unmanaged':_0x52c168[_0x553a('0x57')],'abandoned':_0x52c168[_0x553a('0x58')],'waiting':_0x52c168[_0x553a('0x59')],'loggedInDb':_0x52c168[_0x553a('0x5a')],'dialActive':_0x52c168[_0x553a('0x5b')],'dialMethod':_0x52c168[_0x553a('0x5c')],'dialOriginateCallerIdName':_0x52c168[_0x553a('0x5d')],'dialOriginateCallerIdNumber':_0x52c168['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x52c168[_0x553a('0x5e')],'dialPrefix':_0x52c168[_0x553a('0x5f')],'outboundAnswerAgiCallsDay':_0x52c168[_0x553a('0x60')],'outboundAnswerCallsDay':_0x52c168[_0x553a('0x61')],'outboundBlacklistCallsDay':_0x52c168[_0x553a('0x62')],'outboundBusyCallsDay':_0x52c168[_0x553a('0x63')],'outboundCongestionCallsDay':_0x52c168[_0x553a('0x64')],'outboundDropCallsDayACS':_0x52c168[_0x553a('0x65')],'outboundDropCallsDayCallersExit':_0x52c168[_0x553a('0x66')],'outboundDropCallsDayTimeout':_0x52c168['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x52c168[_0x553a('0x67')],'outboundNoSuchCallsDay':_0x52c168[_0x553a('0x68')],'outboundOriginateFailureCallsDay':_0x52c168[_0x553a('0x69')],'outboundReCallsDay':_0x52c168['outboundReCallsDay'],'outboundRejectCallsDay':_0x52c168[_0x553a('0x6a')],'outboundUnknownCallsDay':_0x52c168[_0x553a('0x6b')],'predictiveIntervalAnsweredCalls':_0x52c168[_0x553a('0x6c')],'predictiveIntervalAvgHoldtime':_0x52c168[_0x553a('0x6d')],'predictiveIntervalAvgTalktime':_0x52c168[_0x553a('0x6e')],'predictiveIntervalDroppedCallsCallersExit':_0x52c168['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x52c168[_0x553a('0x6f')],'predictiveIntervalErlangCalls':_0x52c168[_0x553a('0x70')],'predictiveIntervalErlangCallsDroppedCalls':_0x52c168[_0x553a('0x71')],'predictiveIntervalHitRate':_0x52c168['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x52c168['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x52c168['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x52c168['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x52c168['predictiveIntervalTotalCalls'],'message':_0x52c168['message'],'originated':_0x52c168['originated'],'erlangCalls':_0x52c168['erlangCalls'],'erlangCallToSecond':_0x52c168[_0x553a('0x72')],'erlangAbandonmentRate':_0x52c168['erlangAbandonmentRate'],'erlangBusyFactor':_0x52c168[_0x553a('0x73')],'startPredictive':_0x52c168[_0x553a('0x29')],'startProgressive':_0x52c168[_0x553a('0x2a')]};if(_0x52c168[_0x553a('0x74')]){_0x3e1bfe[_0x553a('0x74')]={'id':_0x52c168[_0x553a('0x74')]['id'],'name':_0x52c168['Trunk'][_0x553a('0x3f')],'active':_0x52c168[_0x553a('0x74')][_0x553a('0x75')],'callerid':_0x52c168[_0x553a('0x74')][_0x553a('0x76')]};}if(_0x52c168['Interval']){_0x3e1bfe[_0x553a('0x42')]={'id':_0x52c168[_0x553a('0x42')]['id'],'name':_0x52c168[_0x553a('0x42')][_0x553a('0x3f')]};}var _0x5257cd=md5(JSON[_0x553a('0x48')](_0x3e1bfe));if(_0x52c168[_0x553a('0x4')]!==_0x5257cd){_0x52c168[_0x553a('0x4')]=_0x5257cd;emit(util[_0x553a('0x77')](_0x553a('0x78'),_0x3e1bfe[_0x553a('0x3f')]),'voice_queue:save',_0x3e1bfe);}}}function emitCampaignSummary(_0x598304){if(_0x598304[_0x553a('0x56')]===_0x553a('0x79')){emit(util[_0x553a('0x77')](_0x553a('0x7a'),_0x598304['name']),'campaign:save',_0x598304);}}function checkGetDataPredictive(_0x1605a7){if(isNotNull(_0x1605a7)&&!_['isEmpty'](_0x1605a7)){loggerPredictive[_0x553a('0x7b')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x553a('0x7b')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1605a7['predictiveIntervalTotalCalls']);loggerPredictive[_0x553a('0x7b')](_0x553a('0x7c'),_0x1605a7['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x553a('0x7d'),_0x1605a7[_0x553a('0x6f')]);loggerPredictive[_0x553a('0x7b')](_0x553a('0x7e'),_0x1605a7[_0x553a('0x7f')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1605a7[_0x553a('0x6d')]);loggerPredictive['info'](_0x553a('0x80'),_0x1605a7[_0x553a('0x6e')]);loggerPredictive[_0x553a('0x7b')](_0x553a('0x81'));if(_0x1605a7[_0x553a('0x82')]>0x0){if(!_[_0x553a('0x3d')](_0x1605a7[_0x553a('0x6e')])&&_0x1605a7[_0x553a('0x6e')]>0x0){return!![];}loggerPredictive[_0x553a('0x7b')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x553a('0x3d')](_0x1605a7[_0x553a('0x6d')])&&_0x1605a7['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x553a('0x7b')](_0x553a('0x83'));}else{loggerPredictive[_0x553a('0x7b')](_0x553a('0x84'));}}else{loggerPredictive[_0x553a('0x7b')](_0x553a('0x85'));}return![];}function mergeDataErlangB(_0x2d9262){return function(_0xe04378){loggerPredictive['info'](_0x553a('0x86'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xe04378[_0x553a('0x87')]);loggerPredictive[_0x553a('0x7b')](_0x553a('0x88'),_0xe04378[_0x553a('0x72')]);loggerPredictive[_0x553a('0x7b')](_0x553a('0x89'),_0xe04378[_0x553a('0x8a')]);loggerPredictive[_0x553a('0x7b')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xe04378[_0x553a('0x73')]);loggerPredictive[_0x553a('0x7b')](_0x553a('0x89'),_0xe04378['erlangAbandonmentRate']);loggerPredictive[_0x553a('0x7b')](_0x553a('0x81'));_['merge'](_0x2d9262,_0xe04378);};}function getDiff(_0x34e449){var _0x21646f=moment()[_0x553a('0x49')](0x0);var _0x287f6f=moment(_0x34e449)[_0x553a('0x49')](0x0);return _0x21646f[_0x553a('0x4a')](_0x287f6f,_0x553a('0x8b'));}function ifInterval(_0x13e12f,_0x4818a1){if(_[_0x553a('0x3d')](_0x4818a1)){return![];}return getDiff(_0x4818a1)<_0x13e12f*0x3c;}function freeVariablesPredictive(_0xa14231){if(isNotNull(_0xa14231)){if(!_[_0x553a('0x3d')](_0xa14231[_0x553a('0x2a')])){_0xa14231[_0x553a('0x2a')]=undefined;loggerPredictive[_0x553a('0x7b')](_0xa14231[_0x553a('0x3f')],_0x553a('0x8c'));}if(!_['isUndefined'](_0xa14231[_0x553a('0x29')])){_0xa14231[_0x553a('0x29')]=undefined;loggerPredictive[_0x553a('0x7b')](_0xa14231[_0x553a('0x3f')],_0x553a('0x8d'));}if(!_[_0x553a('0x3d')](_0xa14231[_0x553a('0x8e')])){clearInterval(_0xa14231[_0x553a('0x8e')]);_0xa14231[_0x553a('0x8e')]=undefined;loggerPredictive[_0x553a('0x7b')](_0xa14231[_0x553a('0x3f')],_0x553a('0x8f'));}}}function erlangb(_0x5c0a14,_0x244e15){if(_0x244e15===0x0){return 0x0;}var _0x280fa0=0x1;for(var _0x5e4ad3=0x1;_0x5e4ad3<=_0x244e15;_0x5e4ad3+=0x1){_0x280fa0=0x1+_0x280fa0*_0x5e4ad3/_0x5c0a14;}return 0x1/_0x280fa0;}function isVoiceQueueOutbound(_0x3c6a3d){return _0x3c6a3d===_0x553a('0x4c');}function isNotPreview(_0x5ef3d0){return _0x5ef3d0!==_0x553a('0x20');}function isCampaignIvr(_0x5a120e){return _0x5a120e==='ivr';}function getCallerId(_0x29a114,_0x542b2e,_0x4a59cc){if(!_['isUndefined'](_0x4a59cc)&&typeof _0x4a59cc===_0x553a('0x90')&&!_[_0x553a('0x44')](_0x4a59cc)){if(!_[_0x553a('0x3d')](_0x542b2e)&&typeof _0x542b2e===_0x553a('0x90')&&!_[_0x553a('0x44')](_0x542b2e)){return util['format'](_0x553a('0x91'),_0x542b2e,_0x4a59cc);}return util[_0x553a('0x77')](_0x553a('0x91'),_0x4a59cc,_0x4a59cc);}if(!_[_0x553a('0x3d')](_0x29a114)&&typeof _0x29a114===_0x553a('0x90')&&!_[_0x553a('0x44')](_0x29a114)){return _0x29a114;}return _0x553a('0x92');}function loggerCatchQueueSummary(_0x21721c,_0x2e6298){return function(_0xb9de2d){freeVariablesPredictive(_0x2e6298);emitVoiceQueueSummary(_0x2e6298);emitCampaignSummary(_0x2e6298);loggerSyncQueueSummary[_0x553a('0x93')](_0x21721c,util[_0x553a('0x94')](_0xb9de2d,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x31d101,_0x455d44){return function(_0x40695a){loggerPredictive['error'](_0x455d44[_0x553a('0x3f')],_0x31d101);loggerPredictive[_0x553a('0x93')](_0x40695a[_0x553a('0x95')]);freeVariablesPredictive(_0x455d44);};}function loggerCatch(_0x1062a5){return function(_0x1ef15e){logger[_0x553a('0x93')](_0x1062a5,util[_0x553a('0x94')](_0x1ef15e,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1a42f5){return _0x1a42f5&&!_[_0x553a('0x3d')](_0x1a42f5)&&_0x1a42f5[_0x553a('0x96')]>0x0;}function decremetOriginate(_0xe185e8){if(!_[_0x553a('0x3d')](_0xe185e8)&&_0xe185e8!==null){if(typeof _0xe185e8['originated']!==_0x553a('0x97')){if(_0xe185e8[_0x553a('0x98')]>0x0){_0xe185e8['originated']-=0x1;}else{logger['error'](_0x553a('0x99'));}}}else{logger[_0x553a('0x93')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0xd16b11,_0x483ae5,_0x2b4fa0){if(_0x483ae5>_0x2b4fa0){for(var _0x1e6da9=0x0;_0x1e6da9<_0x483ae5-_0x2b4fa0;_0x1e6da9+=0x1){decremetOriginate(_0xd16b11);}}}function loggerGetContactDialer(_0xb4e9ac,_0x21cb5d,_0x5912f3){return function(_0x2e22d8){checkContactLowerLimitOriginate(_0x21cb5d,_0x5912f3,0x0);logger['error'](_0xb4e9ac,util[_0x553a('0x94')](_0x2e22d8,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x496fe9){return function(_0x385d45){if(isNotNull(_0x385d45)&&isNotNull(_0x385d45[0x0])){if(_0x385d45[0x0][_0x553a('0x9a')]>0x0){_0x496fe9['message']=_0x553a('0x9b');logger[_0x553a('0x7b')](_0x553a('0x9c')+_0x496fe9[_0x553a('0x3f')],_0x385d45[0x0][_0x553a('0x9a')],'contacts');}else{_0x496fe9[_0x553a('0x3e')]=_0x553a('0x9d');logger[_0x553a('0x7b')](_0x553a('0x9e')+_0x496fe9[_0x553a('0x3f')]);}}};}function notSendMessagesQueue(_0x4a8c87){if(_0x4a8c87[_0x553a('0x9f')]){freeVariablesPredictive(_0x4a8c87);if(_0x4a8c87[_0x553a('0x98')]===0x0&&_0x4a8c87['talking']===0x0&&_0x4a8c87['waiting']===0x0&&(_0x4a8c87[_0x553a('0x51')]||0x0)===0x0){_0x4a8c87[_0x553a('0x9f')]=![];_0x4a8c87[_0x553a('0x4f')]=0x0;_0x4a8c87['message']=_0x553a('0xa0');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x4a8c87[_0x553a('0x3f')],'is\x20not\x20active');}else{_0x4a8c87[_0x553a('0x3e')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x553a('0x93')](_0x553a('0xa1'),_0x4a8c87[_0x553a('0x3f')],'is\x20disactive');}emitVoiceQueueSummary(_0x4a8c87);}}function notSendMessagesCampaign(_0xbc0627){if(_0xbc0627[_0x553a('0x9f')]){if(_0xbc0627[_0x553a('0x98')]===0x0){_0xbc0627[_0x553a('0x9f')]=![];_0xbc0627[_0x553a('0x3e')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x553a('0x93')](_0x553a('0xa2'),_0xbc0627[_0x553a('0x3f')],_0x553a('0xa3'));}else{_0xbc0627['message']=_0x553a('0xa4');loggerSyncQueueSummary[_0x553a('0x93')](_0x553a('0xa2'),_0xbc0627[_0x553a('0x3f')],'is\x20disactive');}emitCampaignSummary(_0xbc0627);}}function createObjHistory(_0x498796,_0x174731,_0x331a75,_0x421c23,_0x3f211e){_0x498796[_0x553a('0x3e')]=_0x331a75;var _0x4a8275=new Action(_0x498796,_0x174731);var _0x4f0fc6=new History(_0x4a8275);_0x4f0fc6[_0x553a('0xa5')]=_0x421c23;_0x4f0fc6[_0x553a('0xa6')]=_0x3f211e;_0x4f0fc6[_0x553a('0xa7')]=_0x4a8275['starttime'];return _0x4f0fc6;}Dialer[_0x553a('0xa8')][_0x553a('0x3c')]=function(){var _0x17471d=this;setInterval(function(){_0x17471d[_0x553a('0xa9')](_0x17471d['uniqueId'],_0x553a('0xaa'));_0x17471d['clearZombieChannels'](_0x17471d[_0x553a('0x26')],'[actions]');},0x32c8);};Dialer[_0x553a('0xa8')]['clearZombieChannels']=function(_0x51d10c,_0x162165){var _0x330021=this;for(var _0x3630e0 in _0x51d10c){if(typeof _0x51d10c[_0x3630e0]!==_0x553a('0x97')){this[_0x553a('0x1f')][_0x553a('0x1c')](function(){if(!_[_0x553a('0xab')](_0x51d10c[_0x3630e0])){return ami[_0x553a('0xac')]({'action':_0x553a('0xad'),'channel':_0x51d10c[_0x3630e0][_0x553a('0xae')]})[_0x553a('0xaf')](function(_0x21d642){if(_0x21d642[_0x553a('0x3e')]===_0x553a('0xb0')){setTimeout(function(){if(_0x51d10c[_0x3630e0]&&_0x51d10c[_0x3630e0][_0x553a('0x56')]!==_0x553a('0x79')){_0x330021[_0x553a('0xb1')](_0x330021[_0x553a('0x21')][_0x51d10c[_0x3630e0]['queue']]);logger[_0x553a('0x93')](_0x553a('0xb2'),_0x162165,_0x3630e0,_0x51d10c[_0x3630e0][_0x553a('0xb3')]);delete _0x51d10c[_0x3630e0];}if(_0x51d10c[_0x3630e0]&&_0x51d10c[_0x3630e0][_0x553a('0x56')]===_0x553a('0x79')){_0x330021[_0x553a('0xb1')](_0x330021['campaigns'][_0x51d10c[_0x3630e0]['queue']]);logger[_0x553a('0x93')]('[Dialer][checkChannel][ivr]',_0x162165,_0x3630e0,_0x51d10c[_0x3630e0][_0x553a('0xb3')]);delete _0x51d10c[_0x3630e0];}},0x2328);}});}});}}};Dialer[_0x553a('0xa8')]['countReScheduled']=function(_0x1a5fe8){return BPromise[_0x553a('0xb4')]()[_0x553a('0xb5')](cmHopper[_0x553a('0xb6')](_0x1a5fe8))[_0x553a('0xaf')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x553a('0xa8')]['checkIsBlackList']=function(_0x470aaf){return BPromise[_0x553a('0xb4')]()['then'](cmHopperBlack['checkIsBlackList'](_0x470aaf))[_0x553a('0xaf')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x553a('0xa8')][_0x553a('0xb7')]=function(_0x115d20){return BPromise[_0x553a('0xb4')]()[_0x553a('0xb5')](cmHopperBlack[_0x553a('0xb7')](_0x115d20))[_0x553a('0xaf')](loggerCatch(_0x553a('0xb8')));};Dialer[_0x553a('0xa8')]['averageHandleTime']=function(_0x270b0e){return BPromise[_0x553a('0xb4')]()['then'](cmHopperHistory[_0x553a('0xb9')](_0x270b0e))[_0x553a('0xaf')](loggerCatch(_0x553a('0xba')));};Dialer[_0x553a('0xa8')]['rescheduleContact']=function(_0x1d8313){return BPromise[_0x553a('0xb4')]()[_0x553a('0xb5')](cmHopper[_0x553a('0xbb')](_0x1d8313))['catch'](loggerCatch(_0x553a('0xbc')));};Dialer[_0x553a('0xa8')][_0x553a('0xbd')]=function(_0x2b926a,_0x157419,_0x3ff8d9){return BPromise[_0x553a('0xb4')]()[_0x553a('0xb5')](cmHopper[_0x553a('0xbd')](_0x2b926a,_0x157419,_0x3ff8d9))[_0x553a('0xaf')](loggerCatch(_0x553a('0xbe')));};Dialer[_0x553a('0xa8')][_0x553a('0xbf')]=function(_0x95fa83,_0xd15922,_0x4f91ef,_0x24bb1e){return BPromise[_0x553a('0xb4')]()['then'](cmHopper[_0x553a('0xbf')](_0x95fa83,_0xd15922,_0x4f91ef,_0x24bb1e))[_0x553a('0xaf')](loggerCatch(_0x553a('0xc0')));};Dialer[_0x553a('0xa8')][_0x553a('0xc1')]=function(_0x36cf94,_0x5c693b,_0x2534fa){return BPromise[_0x553a('0xb4')]()[_0x553a('0xb5')](cmHopper['getContactDialerIvr'](_0x36cf94,_0x5c693b,_0x2534fa))[_0x553a('0xaf')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x553a('0xa8')][_0x553a('0xc2')]=function(_0x50e013){return BPromise[_0x553a('0xb4')]()['then'](voiceQueueRt[_0x553a('0xc2')](_0x50e013))[_0x553a('0xaf')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x553a('0xa8')][_0x553a('0xc3')]=function(_0x10bf55){return BPromise['resolve']()[_0x553a('0xb5')](cmHopper['moveContactManagedDialer'](_0x10bf55))[_0x553a('0xaf')](loggerCatch(_0x553a('0xc4')));};Dialer[_0x553a('0xa8')][_0x553a('0xc5')]=function(_0x1ad367){return BPromise['resolve']()[_0x553a('0xb5')](cmHopperHistory[_0x553a('0xc5')](_0x1ad367))[_0x553a('0xaf')](loggerCatch(_0x553a('0xc6')));};Dialer[_0x553a('0xa8')][_0x553a('0xb1')]=function(_0x5685e4){if(!_[_0x553a('0x3d')](_0x5685e4)&&_0x5685e4!==null){if(typeof _0x5685e4[_0x553a('0x98')]!==_0x553a('0x97')){if(_0x5685e4['originated']>0x0){_0x5685e4[_0x553a('0x98')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x553a('0x93')](_0x553a('0xc7'));}};Dialer[_0x553a('0xa8')][_0x553a('0xc8')]=function(_0x2f8b83,_0x395342){var _0x58af8c=this;return function(_0x1dd9ac){_0x58af8c[_0x553a('0xb1')](_0x395342);logger[_0x553a('0x93')](_0x2f8b83,util[_0x553a('0x94')](_0x1dd9ac,{'showHidden':![],'depth':null}));};};Dialer[_0x553a('0xa8')][_0x553a('0xc9')]=function(_0x4a58ff,_0x11f800,_0x171efb){var _0x228c7f={'state':0x19,'statedesc':_0x553a('0xca')};this[_0x553a('0xb1')](_0x11f800);this['saveInDb'](_[_0x553a('0xcb')](_0x228c7f,_[_0x553a('0xcc')](_0x171efb,['ContactId','ListId','UserId','VoiceQueueId',_0x553a('0xcd')])),'[emptyContact][createHistory]',_0x553a('0xce'));logger['error'](_0x4a58ff);};Dialer['prototype']['isSuccess']=function(_0x22a007){return _0x22a007==='Success';};Dialer[_0x553a('0xa8')][_0x553a('0xcf')]=function(_0x28dcc5){return!_['isUndefined'](_0x28dcc5)&&_0x28dcc5&&!_[_0x553a('0x3d')](_0x28dcc5[_0x553a('0x3f')])&&!_[_0x553a('0x3d')](_0x28dcc5[_0x553a('0x75')])&&_0x28dcc5[_0x553a('0x75')]&&(this[_0x553a('0x24')][util['format'](_0x553a('0xd0'),_0x28dcc5['name'])][_0x553a('0xad')]===_0x553a('0xd1')||this[_0x553a('0x24')][util[_0x553a('0x77')](_0x553a('0xd0'),_0x28dcc5[_0x553a('0x3f')])][_0x553a('0xad')]===_0x553a('0xd2'));};Dialer[_0x553a('0xa8')][_0x553a('0xd3')]=function(_0x109bff,_0x35570e,_0x2beaa6){this[_0x553a('0xc5')](_0x109bff)['catch'](loggerCatch(_0x35570e));this[_0x553a('0xc3')](_0x109bff)[_0x553a('0xaf')](loggerCatch(_0x2beaa6));};Dialer[_0x553a('0xa8')][_0x553a('0x37')]=function(_0x278ad0){var _0x32c0f8=this['uniqueId'][_0x278ad0[_0x553a('0xd4')]];var _0x30bf43;if(!_[_0x553a('0xab')](_0x278ad0)&&!_[_0x553a('0xab')](_0x278ad0['variable'])&&!_[_0x553a('0xab')](_0x278ad0[_0x553a('0xd5')][_0x553a('0xd6')])&&_0x278ad0['exten']===_0x553a('0xd7')&&_0x32c0f8){if(_0x32c0f8['type']!==_0x553a('0x79')&&this['voiceQueues'][_0x32c0f8[_0x553a('0xb3')]][_0x553a('0xd8')]&&_0x278ad0[_0x553a('0xd9')]===_0x553a('0xda')){delete this['uniqueId'][_0x278ad0[_0x553a('0xd4')]];this['updateOriginated'](this[_0x553a('0x21')][_0x32c0f8['queue']]);this['voiceQueues'][_0x32c0f8[_0x553a('0xb3')]][_0x553a('0x61')]+=0x1;this[_0x553a('0x21')][_0x32c0f8['queue']][_0x553a('0x60')]+=0x1;_0x30bf43=new Hangup(_0x32c0f8,_0x278ad0);_0x30bf43[_0x553a('0xa5')]=0x12;_0x30bf43[_0x553a('0xa6')]=_0x553a('0xdb');_0x30bf43[_0x553a('0xdc')]=_0x553a('0xdd');ami[_0x553a('0x4b')](_0x553a('0xde'),ut['buildObj'](_0x30bf43,_0x553a('0xdf')));this[_0x553a('0xd3')](_0x30bf43,'[syncHangupInAMD][createHistory]',_0x553a('0xe0'));}if(_0x32c0f8[_0x553a('0x56')]!=='ivr'&&this[_0x553a('0x21')][_0x32c0f8[_0x553a('0xb3')]][_0x553a('0xd8')]&&_0x278ad0[_0x553a('0xd9')]===_0x553a('0xe1')){var _0x4b7f4d=this;return new BPromise(function(_0x1e9b96,_0x235190){delete _0x4b7f4d[_0x553a('0x28')][_0x278ad0[_0x553a('0xd4')]];_0x4b7f4d['updateOriginated'](_0x4b7f4d[_0x553a('0x21')][_0x32c0f8['queue']]);_0x4b7f4d[_0x553a('0x21')][_0x32c0f8[_0x553a('0xb3')]]['outboundAnswerCallsDay']+=0x1;_0x4b7f4d[_0x553a('0x21')][_0x32c0f8[_0x553a('0xb3')]][_0x553a('0x60')]+=0x1;var _0x30400e=_0x4b7f4d[_0x553a('0x21')][_0x32c0f8['queue']];var _0x3ea7ab=new Hangup(_0x32c0f8,_0x278ad0);_0x3ea7ab[_0x553a('0xa5')]=0x13;_0x3ea7ab[_0x553a('0xa6')]=_0x553a('0xe2');_0x3ea7ab[_0x553a('0xdc')]=_0x553a('0xdd');_0x3ea7ab[_0x553a('0xe3')]+=0x1;_0x3ea7ab[_0x553a('0xe4')]+=0x1;_0x3ea7ab[_0x553a('0xdf')]=!![];ami[_0x553a('0x4b')]('custom:amd',ut['buildObj'](_0x3ea7ab,_0x553a('0xdf')));_0x4b7f4d[_0x553a('0xc5')](_0x3ea7ab)[_0x553a('0xaf')](loggerCatch(_0x553a('0xe5')));if(_0x3ea7ab[_0x553a('0xe6')]+_0x3ea7ab[_0x553a('0xe7')]+_0x3ea7ab[_0x553a('0xe8')]+_0x3ea7ab['countnosuchnumberretry']+_0x3ea7ab[_0x553a('0xe9')]+_0x3ea7ab[_0x553a('0xea')]+_0x3ea7ab[_0x553a('0xe3')]+_0x3ea7ab['countagentrejectretry']>=_0x30400e['dialGlobalMaxRetry']){_0x4b7f4d[_0x553a('0xeb')](_0x3ea7ab,_0x1e9b96,_0x235190,_0x553a('0xec'));}else{if(_0x3ea7ab['countmachineretry']>=_0x30400e[_0x553a('0xed')]){_0x4b7f4d[_0x553a('0xee')](_0x3ea7ab,_0x1e9b96,_0x235190,_0x553a('0xef'));}else{_0x4b7f4d['rescheduleContact']({'active':![],'countmachineretry':_0x3ea7ab[_0x553a('0xe3')],'scheduledat':moment()[_0x553a('0xf0')](_0x30400e[_0x553a('0xf1')],_0x553a('0xf2'))[_0x553a('0x77')](_0x553a('0xf3')),'ContactId':_0x3ea7ab[_0x553a('0xf4')],'ListId':_0x3ea7ab[_0x553a('0xf5')],'VoiceQueueId':_0x3ea7ab['VoiceQueueId']||undefined,'CampaignId':_0x3ea7ab['CampaignId']||undefined})[_0x553a('0xaf')](loggerCatch('[rescheduleContact][Machine]'));_0x1e9b96({'reschedule':0x1});}}});}if(_0x32c0f8[_0x553a('0x56')]===_0x553a('0x79')&&this[_0x553a('0x22')][_0x32c0f8[_0x553a('0xb3')]]['dialAMDActive']&&_0x278ad0[_0x553a('0xd9')]===_0x553a('0xda')){delete this[_0x553a('0x28')][_0x278ad0[_0x553a('0xd4')]];this[_0x553a('0xb1')](this[_0x553a('0x22')][_0x32c0f8[_0x553a('0xb3')]]);_0x30bf43=new Hangup(_0x32c0f8,_0x278ad0);_0x30bf43[_0x553a('0xa5')]=0x12;_0x30bf43[_0x553a('0xa6')]=_0x553a('0xdb');_0x30bf43['membername']=_0x553a('0xdd');ami['emit']('custom:amd',ut[_0x553a('0xf6')](_0x30bf43,_0x553a('0xdf')));this[_0x553a('0xd3')](_0x30bf43,'[syncHangupInAMDIvr][createHistory]',_0x553a('0xf7'));}if(_0x32c0f8[_0x553a('0x56')]===_0x553a('0x79')&&this[_0x553a('0x22')][_0x32c0f8['queue']][_0x553a('0xd8')]&&_0x278ad0['value']===_0x553a('0xe1')){var _0x4b7f4d=this;return new BPromise(function(_0x26ea63,_0x25a7a2){delete _0x4b7f4d['uniqueId'][_0x278ad0[_0x553a('0xd4')]];_0x4b7f4d['updateOriginated'](_0x4b7f4d['campaigns'][_0x32c0f8['queue']]);_0x4b7f4d['campaigns'][_0x32c0f8[_0x553a('0xb3')]][_0x553a('0x61')]+=0x1;_0x4b7f4d['campaigns'][_0x32c0f8[_0x553a('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x16b927=_0x4b7f4d[_0x553a('0x22')][_0x32c0f8[_0x553a('0xb3')]];var _0x5e8258=new Hangup(_0x32c0f8,_0x278ad0);_0x5e8258[_0x553a('0xa5')]=0x13;_0x5e8258[_0x553a('0xa6')]=_0x553a('0xe2');_0x5e8258[_0x553a('0xdc')]=_0x553a('0xdd');_0x5e8258['countmachineretry']+=0x1;_0x5e8258[_0x553a('0xe4')]+=0x1;_0x5e8258[_0x553a('0xdf')]=!![];ami[_0x553a('0x4b')]('custom:amd',ut[_0x553a('0xf6')](_0x5e8258,'amd'));_0x4b7f4d[_0x553a('0xc5')](_0x5e8258)[_0x553a('0xaf')](loggerCatch(_0x553a('0xe5')));if(_0x5e8258['countbusyretry']+_0x5e8258[_0x553a('0xe7')]+_0x5e8258[_0x553a('0xe8')]+_0x5e8258[_0x553a('0xf8')]+_0x5e8258[_0x553a('0xe9')]+_0x5e8258[_0x553a('0xea')]+_0x5e8258['countmachineretry']+_0x5e8258[_0x553a('0xf9')]>=_0x16b927[_0x553a('0xfa')]){_0x4b7f4d[_0x553a('0xeb')](_0x5e8258,_0x26ea63,_0x25a7a2,'reason19\x20machine....');}else{if(_0x5e8258[_0x553a('0xe3')]>=_0x16b927[_0x553a('0xed')]){_0x4b7f4d[_0x553a('0xee')](_0x5e8258,_0x26ea63,_0x25a7a2,_0x553a('0xef'));}else{_0x4b7f4d[_0x553a('0xbb')]({'active':![],'countmachineretry':_0x5e8258[_0x553a('0xe3')],'scheduledat':moment()[_0x553a('0xf0')](_0x16b927[_0x553a('0xf1')],_0x553a('0xf2'))[_0x553a('0x77')](_0x553a('0xf3')),'ContactId':_0x5e8258[_0x553a('0xf4')],'ListId':_0x5e8258[_0x553a('0xf5')],'VoiceQueueId':_0x5e8258[_0x553a('0xfb')]||undefined,'CampaignId':_0x5e8258[_0x553a('0xcd')]||undefined})['catch'](loggerCatch(_0x553a('0xfc')));_0x26ea63({'reschedule':0x1});}}});}}};Dialer[_0x553a('0xa8')][_0x553a('0x34')]=function(_0x2344d7){var _0x1d681d=this[_0x553a('0x28')][_0x2344d7[_0x553a('0xd4')]];var _0x2d345d=this;var _0x53dc5d;if(_0x1d681d&&_0x1d681d[_0x553a('0x56')]===_0x553a('0x79')){delete this[_0x553a('0x28')][_0x2344d7['uniqueid']];this[_0x553a('0xb1')](this[_0x553a('0x22')][_0x1d681d[_0x553a('0xb3')]]);this['campaigns'][_0x1d681d[_0x553a('0xb3')]][_0x553a('0xfd')]+=0x1;_0x53dc5d=new Hangup(_0x1d681d,_0x2344d7);this[_0x553a('0xc5')](_0x53dc5d)[_0x553a('0xaf')](loggerCatch(_0x553a('0xfe')));this[_0x553a('0xc3')](_0x53dc5d)[_0x553a('0xaf')](loggerCatch(_0x553a('0xff')));}if(_0x1d681d&&_0x1d681d[_0x553a('0x56')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x1d681d['queue']][_0x553a('0x100')])){delete this[_0x553a('0x28')][_0x2344d7[_0x553a('0xd4')]];this['updateOriginated'](this[_0x553a('0x21')][_0x1d681d[_0x553a('0xb3')]]);this[_0x553a('0x21')][_0x1d681d[_0x553a('0xb3')]][_0x553a('0x61')]+=0x1;this['voiceQueues'][_0x1d681d['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x53dc5d=new Hangup(_0x1d681d,_0x2344d7);_0x53dc5d[_0x553a('0xa5')]=0x10;_0x53dc5d[_0x553a('0xa6')]=_0x553a('0x101');_0x53dc5d[_0x553a('0xdc')]='AGI';this[_0x553a('0xc5')](_0x53dc5d)[_0x553a('0xaf')](loggerCatch(_0x553a('0xfe')));this['moveContactManagedDialer'](_0x53dc5d)[_0x553a('0xaf')](loggerCatch(_0x553a('0xff')));}if(_0x1d681d&&_0x1d681d[_0x553a('0x56')]!==_0x553a('0x79')&&!isNotNull(this[_0x553a('0x21')][_0x1d681d[_0x553a('0xb3')]][_0x553a('0x100')])){delete this[_0x553a('0x28')][_0x2344d7[_0x553a('0xd4')]];this[_0x553a('0xb1')](this[_0x553a('0x21')][_0x1d681d[_0x553a('0xb3')]]);this[_0x553a('0x21')][_0x1d681d[_0x553a('0xb3')]][_0x553a('0x6b')]+=0x1;_0x53dc5d=new Hangup(_0x1d681d,_0x2344d7);_0x53dc5d[_0x553a('0xa5')]=0xc;_0x53dc5d['statedesc']=_0x2344d7['cause-txt'];_0x53dc5d[_0x553a('0xdc')]='Unknow';this['createHistory'](_0x53dc5d)[_0x553a('0xaf')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x53dc5d)['catch'](loggerCatch(_0x553a('0xff')));}};Dialer[_0x553a('0xa8')][_0x553a('0x102')]=function(_0x6ef10f){var _0x4c61c2=this[_0x553a('0x28')][_0x6ef10f[_0x553a('0xd4')]];var _0x1351c2=this;if(this[_0x553a('0x21')][_0x6ef10f['queue']]){if(_0x4c61c2&&_0x4c61c2[_0x553a('0x56')]!==_0x553a('0x79')){delete this[_0x553a('0x28')][_0x6ef10f[_0x553a('0xd4')]];this[_0x553a('0x21')][_0x6ef10f[_0x553a('0xb3')]][_0x553a('0x61')]+=0x1;var _0x53abd8=new AgentComplete(_0x4c61c2,_0x6ef10f);if(_0x6ef10f['reason']===_0x553a('0x103')){_0x53abd8[_0x553a('0x104')]=this[_0x553a('0x21')][_0x6ef10f['queue']][_0x553a('0x105')]&&this[_0x553a('0x21')][_0x6ef10f[_0x553a('0xb3')]][_0x553a('0x106')]?moment()[_0x553a('0x77')](_0x553a('0xf3')):undefined;}this[_0x553a('0xc5')](_0x53abd8)[_0x553a('0xaf')](loggerCatch(_0x553a('0x107')));this[_0x553a('0xc3')](_0x53abd8)['catch'](loggerCatch(_0x553a('0x108')));}}};Dialer[_0x553a('0xa8')]['syncAgentConnect']=function(_0x30649d){if(this[_0x553a('0x21')][_0x30649d[_0x553a('0xb3')]]){if(this[_0x553a('0x28')][_0x30649d['uniqueid']]&&this[_0x553a('0x28')][_0x30649d[_0x553a('0xd4')]]['type']!==_0x553a('0x79')){this[_0x553a('0xb1')](this[_0x553a('0x21')][_0x30649d[_0x553a('0xb3')]]);this[_0x553a('0x28')][_0x30649d[_0x553a('0xd4')]][_0x553a('0x109')]=moment()[_0x553a('0x77')](_0x553a('0xf3'));}}};Dialer['prototype'][_0x553a('0x10a')]=function(_0x4d9344){this[_0x553a('0xc5')](_0x4d9344)[_0x553a('0xaf')](loggerCatch(_0x553a('0x107')));this[_0x553a('0xc3')](_0x4d9344)[_0x553a('0xaf')](loggerCatch(_0x553a('0x10b')));};Dialer[_0x553a('0xa8')][_0x553a('0x32')]=function(_0x82e373){var _0x33a463=this[_0x553a('0x28')][_0x82e373[_0x553a('0xd4')]];var _0x288f32=this;if(this[_0x553a('0x21')][_0x82e373[_0x553a('0xb3')]]){if(_0x33a463&&_0x33a463[_0x553a('0x56')]!==_0x553a('0x79')){delete this['uniqueId'][_0x82e373['uniqueid']];this[_0x553a('0xb1')](this[_0x553a('0x21')][_0x82e373[_0x553a('0xb3')]]);_0x33a463['droptime']=moment()[_0x553a('0x77')](_0x553a('0xf3'));var _0x2c3a72=new QueueCallerAbandon(_0x33a463,_0x82e373);if(getSeconds(_0x33a463['droptime'],_0x33a463[_0x553a('0x10c')])>=_0x33a463[_0x553a('0x10d')]){this[_0x553a('0x21')][_0x82e373[_0x553a('0xb3')]][_0x553a('0x6f')]+=0x1;this[_0x553a('0x21')][_0x82e373['queue']][_0x553a('0x10e')]+=0x1;this['voiceQueues'][_0x82e373['queue']][_0x553a('0x71')]+=0x1;_0x2c3a72['state']=0xa;_0x2c3a72[_0x553a('0xa6')]=_0x553a('0x10f');_0x2c3a72[_0x553a('0x110')]=_0x553a('0x111');_0x2c3a72[_0x553a('0x104')]=this[_0x553a('0x21')][_0x82e373[_0x553a('0xb3')]][_0x553a('0x105')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x2c3a72['countdropretry']+=0x1;_0x2c3a72[_0x553a('0xe4')]+=0x1;if(_0x2c3a72['countdropretry']>=this['voiceQueues'][_0x82e373[_0x553a('0xb3')]]['dialDropMaxRetry']){this[_0x553a('0x10a')](_0x2c3a72);}else{this[_0x553a('0xbb')]({'active':![],'countdropretry':_0x2c3a72[_0x553a('0xe9')],'scheduledat':moment()[_0x553a('0xf0')](this[_0x553a('0x21')][_0x82e373['queue']][_0x553a('0x112')],'minutes')[_0x553a('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33a463[_0x553a('0xf4')],'ListId':_0x33a463[_0x553a('0xf5')],'VoiceQueueId':_0x33a463[_0x553a('0xfb')]||undefined,'CampaignId':_0x33a463[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0x113')));var _0x79848d=new History(_0x2c3a72);_0x79848d[_0x553a('0xa5')]=0xa;_0x79848d[_0x553a('0xa6')]=_0x553a('0x10f');_0x79848d[_0x553a('0x114')]=moment()[_0x553a('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0x79848d[_0x553a('0xa7')]=_0x79848d[_0x553a('0x114')];_0x79848d[_0x553a('0x115')]=_0x2c3a72[_0x553a('0x115')];_0x79848d[_0x553a('0x116')]=_0x2c3a72[_0x553a('0x116')];this[_0x553a('0xc5')](_0x79848d)[_0x553a('0xaf')](loggerCatch(_0x553a('0x117')));}}else{this[_0x553a('0x21')][_0x82e373[_0x553a('0xb3')]][_0x553a('0x7f')]+=0x1;this[_0x553a('0x21')][_0x82e373[_0x553a('0xb3')]][_0x553a('0x66')]+=0x1;_0x2c3a72[_0x553a('0xa5')]=0xb;_0x2c3a72[_0x553a('0xa6')]=_0x553a('0x118');_0x2c3a72['dropreason']=_0x553a('0x119');_0x2c3a72[_0x553a('0xea')]+=0x1;_0x2c3a72[_0x553a('0xe4')]+=0x1;if(_0x2c3a72[_0x553a('0xea')]>=this['voiceQueues'][_0x82e373[_0x553a('0xb3')]][_0x553a('0x11a')]){this[_0x553a('0x10a')](_0x2c3a72);}else{this[_0x553a('0xbb')]({'active':![],'countabandonedretry':_0x2c3a72[_0x553a('0xea')],'scheduledat':moment()[_0x553a('0xf0')](this[_0x553a('0x21')][_0x82e373[_0x553a('0xb3')]][_0x553a('0x11b')],_0x553a('0xf2'))['format'](_0x553a('0xf3')),'ContactId':_0x33a463[_0x553a('0xf4')],'ListId':_0x33a463[_0x553a('0xf5')],'VoiceQueueId':_0x33a463['VoiceQueueId']||undefined,'CampaignId':_0x33a463['CampaignId']||undefined})['catch'](loggerCatch(_0x553a('0x11c')));var _0x79848d=new History(_0x2c3a72);_0x79848d[_0x553a('0xa5')]=0xb;_0x79848d[_0x553a('0xa6')]=_0x553a('0x118');_0x79848d['starttime']=moment()[_0x553a('0x77')](_0x553a('0xf3'));_0x79848d[_0x553a('0xa7')]=_0x79848d[_0x553a('0x114')];_0x79848d[_0x553a('0x115')]=_0x2c3a72[_0x553a('0x115')];_0x79848d[_0x553a('0x116')]=_0x2c3a72['calleridnum'];this[_0x553a('0xc5')](_0x79848d)[_0x553a('0xaf')](loggerCatch(_0x553a('0x11d')));}}}}};Dialer['prototype'][_0x553a('0x36')]=function(_0x4a3fd0){if(this[_0x553a('0x26')][_0x4a3fd0[_0x553a('0xd4')]]){this[_0x553a('0x26')][_0x4a3fd0[_0x553a('0xd4')]][_0x553a('0xae')]=_0x4a3fd0[_0x553a('0xae')];}if(this[_0x553a('0x28')][_0x4a3fd0[_0x553a('0xd4')]]){this['uniqueId'][_0x4a3fd0[_0x553a('0xd4')]][_0x553a('0xae')]=_0x4a3fd0['channel'];}};Dialer[_0x553a('0xa8')]['syncQueueMember']=function(_0x53f96c){if(strategy[this[_0x553a('0x21')][this[_0x553a('0x26')][_0x53f96c[_0x553a('0x11e')]][_0x553a('0xb3')]][_0x553a('0x4d')]]===_0x553a('0x1b')){if(this[_0x553a('0x26')][_0x53f96c['actionid']]&&_[_0x553a('0xab')](this[_0x553a('0x26')][_0x53f96c[_0x553a('0x11e')]]['locked'])&&_0x53f96c[_0x553a('0xad')]==='1'&&_0x53f96c[_0x553a('0x11f')]==='0'){if(this[_0x553a('0x23')][_0x53f96c[_0x553a('0x120')]]){if(!this['agents'][_0x53f96c[_0x553a('0x120')]][_0x553a('0x121')]){this[_0x553a('0x23')][_0x53f96c[_0x553a('0x120')]][_0x553a('0x121')]=!![];this[_0x553a('0x26')][_0x53f96c['actionid']][_0x553a('0x121')]=!![];this[_0x553a('0x26')][_0x53f96c[_0x553a('0x11e')]][_0x553a('0x120')]=_0x53f96c[_0x553a('0x120')];}}}}else if((strategy[this[_0x553a('0x21')][this['actions'][_0x53f96c[_0x553a('0x11e')]][_0x553a('0xb3')]][_0x553a('0x4d')]]||'rrmemory')==='rrmemory'){if(this[_0x553a('0x26')][_0x53f96c[_0x553a('0x11e')]]){if(this[_0x553a('0x23')][_0x53f96c['stateinterface']]){this['actions'][_0x53f96c['actionid']][_0x553a('0x120')]=_0x53f96c[_0x553a('0x120')];if(_[_0x553a('0xab')](this[_0x553a('0x2c')][this[_0x553a('0x26')][_0x53f96c[_0x553a('0x11e')]]['queue']])){this[_0x553a('0x2c')][this[_0x553a('0x26')][_0x53f96c[_0x553a('0x11e')]][_0x553a('0xb3')]]=[];}this[_0x553a('0x2c')][this[_0x553a('0x26')][_0x53f96c[_0x553a('0x11e')]]['queue']][_0x553a('0x122')](_[_0x553a('0xcb')](_[_0x553a('0xcc')](this[_0x553a('0x26')][_0x53f96c[_0x553a('0x11e')]],[_0x553a('0x123'),_0x553a('0x120')]),{'status':_0x53f96c[_0x553a('0xad')],'paused':_0x53f96c['paused']}));}}}};function unlockQueueStatus(_0x27fda4,_0x430ed2){setTimeout(function(){if(_[_0x553a('0x3d')](_0x27fda4[_0x553a('0x124')])){loggerBooked[_0x553a('0x93')](_0x553a('0x125'),_0x430ed2);}_0x27fda4[_0x553a('0x124')]=!![];loggerBooked[_0x553a('0x7b')](_0x553a('0x126'),_0x430ed2,JSON[_0x553a('0x48')](_['pick'](_0x27fda4,[_0x553a('0x3f'),_0x553a('0x124')])));},0x1f3);}Dialer['prototype'][_0x553a('0x127')]=function(_0x5da5b8){var _0x4f34d3=this;var _0x19a0b0=_0x4f34d3[_0x553a('0x21')][_0x4f34d3[_0x553a('0x26')][_0x5da5b8['actionid']][_0x553a('0xb3')]];if(strategy[this['voiceQueues'][this['actions'][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xb3')]][_0x553a('0x4d')]]===_0x553a('0x1b')){if(this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]]&&this[_0x553a('0x26')][_0x5da5b8['actionid']][_0x553a('0x120')]){this[_0x553a('0x20')]['run'](this['actions'][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0x123')],this['actions'][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0x120')])[_0x553a('0xaf')](function(_0x44dbfc){logger[_0x553a('0x93')](_0x553a('0x128'),util[_0x553a('0x94')](_0x44dbfc,{'showHidden':![],'depth':null}));})[_0x553a('0x1e')](function(){_0x4f34d3['updateOriginated'](_0x4f34d3[_0x553a('0x21')][_0x4f34d3[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xb3')]]);_0x4f34d3['agents'][_0x4f34d3['actions'][_0x5da5b8[_0x553a('0x11e')]]['stateinterface']][_0x553a('0x121')]=![];delete _0x4f34d3[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]];unlockQueueStatus(_0x19a0b0);});}else{this[_0x553a('0xb1')](this[_0x553a('0x21')][this['actions'][_0x5da5b8['actionid']][_0x553a('0xb3')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xf4')],'ListId':this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xf5')],'VoiceQueueId':this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xcd')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]];unlockQueueStatus(_0x19a0b0);}}else if((strategy[this[_0x553a('0x21')][this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xb3')]][_0x553a('0x4d')]]||_0x553a('0x1a'))===_0x553a('0x1a')){var _0x482b1a;if(this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]]&&!_[_0x553a('0x44')](this[_0x553a('0x2c')][this['actions'][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xb3')]])){if(this[_0x553a('0x2d')][_0x4f34d3[_0x553a('0x26')][_0x5da5b8['actionid']][_0x553a('0xb3')]]){this[_0x553a('0x2d')][_0x4f34d3[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]]['queue']]=this[_0x553a('0x2d')][this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xb3')]]?this[_0x553a('0x2d')][this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]]['queue']]:this[_0x553a('0x2c')][this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xb3')]]?this['queueBooked'][this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]]['queue']][_0x553a('0x129')]||0x0:0x0;}this['queueBooked'][this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xb3')]][_0x553a('0x129')]=this['queueBookedRR'][this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]]['queue']];for(var _0x26c1e0=0x0;_0x26c1e0=0x0;})[_0x553a('0xaf')](myreject(_0x16d363)));}}else{_0x3efd46[_0x553a('0x122')](ami[_0x553a('0xac')]({'action':_0x553a('0x140'),'command':util[_0x553a('0x77')](_0x553a('0x141'),_0x4de4ec,!_[_0x553a('0x3d')](config['timezones'][_0x5d062b])?_0x5d062b:'')})[_0x553a('0xb5')](function(_0x19600c){return _0x19600c[_0x553a('0x144')]['indexOf']('true')>=0x0;})[_0x553a('0xaf')](myreject(_0x16d363)));}BPromise[_0x553a('0x145')](_0x3efd46)['then'](function(_0x5b2789){var _0x3c8428=_['some'](_0x5b2789);if(_0x3c8428){return _0x6ccf2(_0x3c8428);}else{_0x36a44[_0x553a('0x3e')]=_0x52a08e?_0x553a('0x146'):_0x553a('0x147');return _0x16d363(msgResponse(_0x553a('0x148'),_0x553a('0x13b'),_0x553a('0x149')+_0x52a08e+'\x20'+_0x57f5e4+_0x553a('0x14a')+util[_0x553a('0x94')](_0x4de4ec,{'showHidden':![],'depth':null})+_0x553a('0x14b')+_0x5d062b));}})['catch'](function(_0x3556e0){return _0x16d363(msgResponse(_0x553a('0x13a'),_0x553a('0x13b'),JSON[_0x553a('0x48')](_0x3556e0)));});});};Dialer['prototype'][_0x553a('0x14c')]=function(_0x10eba7){var _0xd64027=this;return function(){switch(_0x10eba7[_0x553a('0x5c')]){case _0x553a('0x14d'):freeVariablesPredictive(_0x10eba7);_0xd64027['handlePower'](_0x10eba7,0x1);break;case'power':freeVariablesPredictive(_0x10eba7);_0xd64027[_0x553a('0x14e')](_0x10eba7,_0x10eba7[_0x553a('0x14f')]);break;case _0x553a('0x150'):_0xd64027[_0x553a('0x150')](_0x10eba7);break;case _0x553a('0x9'):freeVariablesPredictive(_0x10eba7);_0xd64027[_0x553a('0x14e')](_0x10eba7,0x1);break;default:freeVariablesPredictive(_0x10eba7);logger[_0x553a('0x93')]('Queue',_0x10eba7[_0x553a('0x3f')],_0x553a('0x151'));}};};Dialer[_0x553a('0xa8')][_0x553a('0x152')]=function(_0x3fbadf){var _0x3c8153=this;return function(){_0x3c8153[_0x553a('0x153')](_0x3fbadf);};};Dialer[_0x553a('0xa8')][_0x553a('0xb')]=function(_0x58adc0){var _0x35a01b=this;if(isNotPreview(_0x58adc0[_0x553a('0x5c')])){if(isVoiceQueueOutbound(_0x58adc0['type'])&&isActive(_0x58adc0[_0x553a('0x5b')])){_0x58adc0[_0x553a('0x9f')]=!![];BPromise[_0x553a('0xb4')]()[_0x553a('0xb5')](checkIsLoggedIn(_0x58adc0,_0x58adc0['loggedIn']))[_0x553a('0xb5')](checkIsActive(_0x58adc0,_0x58adc0[_0x553a('0x5b')]))[_0x553a('0xb5')](checkInterval(_0x58adc0))[_0x553a('0xb5')](_0x35a01b[_0x553a('0x154')](_0x58adc0))[_0x553a('0xb5')](_0x35a01b[_0x553a('0x138')](_0x58adc0[_0x553a('0x155')],_0x58adc0[_0x553a('0x156')],_0x58adc0['name'],_0x58adc0))[_0x553a('0xb5')](_0x35a01b[_0x553a('0x139')](_0x58adc0[_0x553a('0x42')],_0x58adc0[_0x553a('0x156')],_0x58adc0['name'],_0x58adc0))[_0x553a('0xb5')](_0x35a01b[_0x553a('0x14c')](_0x58adc0))['catch'](loggerCatchQueueSummary(_0x553a('0x157'),_0x58adc0));}else{notSendMessagesQueue(_0x58adc0);}}else{freeVariablesPredictive(_0x58adc0);}};Dialer[_0x553a('0xa8')][_0x553a('0x135')]=function(){var _0x372fee=this;var _0x29ddd0;for(var _0x268102 in this[_0x553a('0x22')]){if(typeof this['campaigns'][_0x268102]!==_0x553a('0x97')){_0x29ddd0=this[_0x553a('0x22')][_0x268102];if(isCampaignIvr(_0x29ddd0[_0x553a('0x56')])&&isActive(_0x29ddd0[_0x553a('0x75')])){_0x29ddd0[_0x553a('0x9f')]=!![];BPromise[_0x553a('0xb4')]()['then'](checkIsActive(_0x29ddd0,_0x29ddd0[_0x553a('0x75')]))['then'](checkInterval(_0x29ddd0))[_0x553a('0xb5')](_0x372fee['checkIsTrunkReachable'](_0x29ddd0))[_0x553a('0xb5')](_0x372fee[_0x553a('0x138')](_0x29ddd0[_0x553a('0x155')],_0x29ddd0[_0x553a('0x156')],_0x29ddd0[_0x553a('0x3f')],_0x29ddd0))['then'](_0x372fee[_0x553a('0x139')](_0x29ddd0[_0x553a('0x42')],_0x29ddd0[_0x553a('0x156')],_0x29ddd0[_0x553a('0x3f')],_0x29ddd0))[_0x553a('0xb5')](_0x372fee['launchHandleIvr'](_0x29ddd0))[_0x553a('0xaf')](loggerCatchQueueSummary('[syncCampaigns]',_0x29ddd0));}else{notSendMessagesCampaign(_0x29ddd0);}}}};function getCallerIdRandom(_0x3bdbcb,_0x18305f){var _0x174135;var _0x39699f;var _0x59e8b6;if(_0x18305f<=0x0){_0x18305f=0x1;}_0x174135=new RegExp(_0x553a('0x158')+_0x18305f+'}$');_0x39699f=Math[_0x553a('0x159')](0xa,_0x18305f-0x1);_0x59e8b6=Math[_0x553a('0x159')](0xa,_0x18305f)-0x1;return util[_0x553a('0x77')]('%s',_[_0x553a('0x15a')](_0x3bdbcb,_0x174135,_['random'](_0x39699f,_0x59e8b6)));}function extractCalleridName(_0x4de48a){var _0xaa86d0=_0x4de48a[_0x553a('0x15b')](/"(.*?)"/);return _0xaa86d0?_0xaa86d0[0x1]:_0x4de48a;}function extractCalleridNumber(_0x54bf32){var _0x47c31a=_0x54bf32[_0x553a('0x15b')](/<(.*?)>/);return _0x47c31a?_0x47c31a[0x1]:_0x54bf32;}Dialer[_0x553a('0xa8')][_0x553a('0x15c')]=function(_0x5a04ee,_0x3f9d6d){var _0xa35f93=this;var _0x35dafb=uuid['v4']();this['actions'][_0x35dafb]=new Action(_0x5a04ee,_0x3f9d6d,_0x35dafb);return new BPromise(function(_0x514b72,_0x96529d){if(_['isUndefined'](_0x5a04ee)&&typeof _0x5a04ee!==_0x553a('0x15d')){return _0x96529d(msgResponse('originate',_0x553a('0x13b'),_0x553a('0x15e')));}if(_['isUndefined'](_0x3f9d6d['Contact'][_0x553a('0x15f')])||_0x3f9d6d[_0x553a('0x160')]['phone']===null){return _0x96529d(msgResponse(_0x553a('0x161'),_0x553a('0x13b'),_0x553a('0x162')));}var _0x488c8d={'XMD-CALLERID':_0xa35f93[_0x553a('0x26')][_0x35dafb][_0x553a('0x163')](),'XMD-AGI':_0x5a04ee[_0x553a('0x100')]?util[_0x553a('0x77')](_0x553a('0x164'),ipAgi,_0x5a04ee[_0x553a('0x100')]):'NONE','XMD-AGIAFTER':_0x5a04ee[_0x553a('0x105')]?util['format'](_0x553a('0x164'),ipAgi,_0x5a04ee[_0x553a('0x105')]):'NONE','XMD-QUEUE':_0x5a04ee[_0x553a('0x56')]===_0x553a('0x4c')?util[_0x553a('0x77')](_0x553a('0x165'),_0x5a04ee[_0x553a('0x3f')],_0x5a04ee['dialQueueOptions']||'',_0x5a04ee[_0x553a('0x106')]?'c':'',_0x5a04ee[_0x553a('0x10d')]||0x3):_0x553a('0x166'),'XMD-CONTACTID':_0x3f9d6d[_0x553a('0xf4')],'XMD-CDRTYPE':_0x553a('0x167'),'CALLERID(all)':_0xa35f93[_0x553a('0x26')][_0x35dafb]['getCaller'](),'XMD-AMD':_0x5a04ee[_0x553a('0xd8')]?'ACTIVE':_0x553a('0x166'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x5a04ee[_0x553a('0xd8')]){_0x488c8d[_0x553a('0x168')]=_0x5a04ee['dialAMDInitialSilence']||0x9c4;_0x488c8d['XMD-AMDGREETING']=_0x5a04ee[_0x553a('0x169')]||0x5dc;_0x488c8d['XMD-AMDAFTERGREETINGSILENCE']=_0x5a04ee[_0x553a('0x16a')]||0x320;_0x488c8d[_0x553a('0x16b')]=_0x5a04ee['dialAMDTotalAnalysisTime']||0x1388;_0x488c8d[_0x553a('0x16c')]=_0x5a04ee[_0x553a('0x16d')]||0x64;_0x488c8d[_0x553a('0x16e')]=_0x5a04ee['dialAMDBetweenWordsSilence']||0x32;_0x488c8d[_0x553a('0x16f')]=_0x5a04ee[_0x553a('0x170')]||0x3;_0x488c8d[_0x553a('0x171')]=_0x5a04ee['dialAMDSilenceThreshold']||0x100;_0x488c8d['XMD-AMDMAXIMUMWORDLENGTH']=_0x5a04ee['dialAMDMaximumWordLength']||0x1388;}if(_0x5a04ee[_0x553a('0x56')]===_0x553a('0x4c')){_0x488c8d[_0x553a('0x172')]=_0x3f9d6d[_0x553a('0xfb')];}else{_0x488c8d[_0x553a('0x173')]=_0x3f9d6d['CampaignId'];}for(var _0x1972bd in _0x3f9d6d[_0x553a('0x160')]){if(typeof _0x3f9d6d[_0x553a('0x160')][_0x1972bd]!==_0x553a('0x97')){if(isNotNull(_0x3f9d6d['Contact'][_0x1972bd])&&_0x1972bd!=='id'&&_0x1972bd!==_0x553a('0x174')&&_0x1972bd!==_0x553a('0x175')&&_0x1972bd!==_0x553a('0x176')){_0x488c8d[util[_0x553a('0x77')]('%s%s',_0x553a('0x177'),_['toUpper'](_0x1972bd))]=_0x3f9d6d['Contact'][_0x1972bd];}}}var _0x588fc8=_0xa35f93[_0x553a('0xcf')](_0x5a04ee[_0x553a('0x74')])?getCallerId(_0x5a04ee[_0x553a('0x74')]['callerid'],_0x5a04ee[_0x553a('0x5d')],_0x5a04ee[_0x553a('0x178')]>0x0?getCallerIdRandom(_0x5a04ee['dialOriginateCallerIdNumber'],_0x5a04ee['dialRandomLastDigitCallerIdNumber']):_0x5a04ee[_0x553a('0x179')]):getCallerId(_[_0x553a('0xab')](_0x5a04ee[_0x553a('0x136')])?_0x5a04ee['Trunk'][_0x553a('0x76')]:_0x5a04ee[_0x553a('0x136')]['callerid'],_0x5a04ee[_0x553a('0x5d')],_0x5a04ee[_0x553a('0x178')]>0x0?getCallerIdRandom(_0x5a04ee[_0x553a('0x179')],_0x5a04ee['dialRandomLastDigitCallerIdNumber']):_0x5a04ee[_0x553a('0x179')]);if(_0x588fc8){_0x488c8d[_0x553a('0x17a')]=_0xa35f93[_0x553a('0x26')][_0x35dafb][_0x553a('0x17b')]=extractCalleridName(_0x588fc8);_0x488c8d['XMD-ORIGINATECALLERIDNUM']=_0xa35f93[_0x553a('0x26')][_0x35dafb][_0x553a('0x17c')]=extractCalleridNumber(_0x588fc8);}return ami['Action']({'actionid':_0x35dafb,'action':_0x553a('0x161'),'channel':_0xa35f93['isTrunkReachable'](_0x5a04ee[_0x553a('0x74')])?util['format'](_0x553a('0x17d'),_0x5a04ee[_0x553a('0x74')][_0x553a('0x3f')],isNotNull(_0x5a04ee[_0x553a('0x5f')])?_0x5a04ee[_0x553a('0x5f')]['trim']()||'':'',_0x5a04ee['dialCutDigit']>0x0?_0x3f9d6d[_0x553a('0x160')]['phone'][_0x553a('0x17e')](_0x5a04ee['dialCutDigit']):_0x3f9d6d[_0x553a('0x160')]['phone']):util[_0x553a('0x77')]('SIP/%s/%s%s',_[_0x553a('0xab')](_0x5a04ee['TrunkBackup'])?_0x5a04ee[_0x553a('0x74')][_0x553a('0x3f')]:_0x5a04ee[_0x553a('0x136')]['name'],isNotNull(_0x5a04ee[_0x553a('0x5f')])?_0x5a04ee[_0x553a('0x5f')]['trim']()||'':'',_0x5a04ee[_0x553a('0x17f')]>0x0?_0x3f9d6d['Contact']['phone'][_0x553a('0x17e')](_0x5a04ee['dialCutDigit']):_0x3f9d6d[_0x553a('0x160')][_0x553a('0x15f')]),'callerid':_0x588fc8,'Exten':'xcally-motion-dialer','Context':_0x553a('0x180'),'Priority':'1','variable':_0x488c8d,'timeout':(_0x5a04ee[_0x553a('0x5e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x35dafb})[_0x553a('0xb5')](function(_0x1070d2){return _0x514b72(_0x1070d2);})[_0x553a('0xaf')](function(_0x53bfa0){_0x5a04ee[_0x553a('0x69')]+=0x1;var _0x29b888=new History(_0xa35f93['actions'][_0x35dafb]);logger[_0x553a('0x93')](util[_0x553a('0x77')](_0x553a('0x181'),JSON[_0x553a('0x48')](_0x53bfa0)));_0x29b888[_0x553a('0xa5')]=0xe;_0x29b888['statedesc']=_0x553a('0x182');_0x29b888[_0x553a('0x114')]=moment()[_0x553a('0x77')](_0x553a('0xf3'));_0x29b888[_0x553a('0xa7')]=_0x29b888[_0x553a('0x114')];_0xa35f93['createHistory'](_0x29b888)[_0x553a('0xaf')](loggerCatch(_0x553a('0x183')));_0xa35f93[_0x553a('0xc3')](_0x29b888)[_0x553a('0xaf')](loggerCatch(_0x553a('0x183')))[_0x553a('0x1e')](function(){delete _0xa35f93['actions'][_0x35dafb];return _0x96529d(msgResponse('originate',_0x553a('0x47'),_0x553a('0x184')));});});});};Dialer[_0x553a('0xa8')]['syncOriginateResponse']=function(_0x2bf789){var _0x14a8eb=this[_0x553a('0x26')][_0x2bf789[_0x553a('0x11e')]];if(_0x14a8eb){delete this[_0x553a('0x26')][_0x2bf789[_0x553a('0x11e')]];_0x14a8eb[_0x553a('0x10c')]=moment()['format'](_0x553a('0xf3'));var _0x3bff3e=_0x14a8eb['type']===_0x553a('0x79')?this[_0x553a('0x22')][_0x14a8eb[_0x553a('0xb3')]]:this['voiceQueues'][_0x14a8eb[_0x553a('0x185')]()];if(!this[_0x553a('0x186')](_0x2bf789['response'])){this[_0x553a('0xb1')](_0x3bff3e);return this[_0x553a('0x187')](_0x14a8eb,_0x3bff3e,_0x2bf789)[_0x553a('0xaf')](loggerCatch(_0x553a('0x188')));}this['uniqueId'][_0x2bf789[_0x553a('0xd4')]]=_0x14a8eb;}};Dialer['prototype']['checkRetriveMax']=function(_0x5a6a33,_0x2118d3,_0x1b8ddb){var _0x21114a=new History(_0x2118d3);if(_0x21114a[_0x553a('0xe6')]+_0x21114a[_0x553a('0xe7')]+_0x21114a['countnoanswerretry']+_0x21114a['countnosuchnumberretry']+_0x21114a[_0x553a('0xe9')]+_0x21114a['countabandonedretry']+_0x21114a[_0x553a('0xe3')]+_0x21114a[_0x553a('0xf9')]>=_0x1b8ddb[_0x553a('0xfa')]-0x1){return!![];}switch(_0x5a6a33){case 0x3:if(_0x21114a[_0x553a('0xe8')]>=_0x1b8ddb['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x21114a[_0x553a('0xe8')]+=0x1,'scheduledat':moment()[_0x553a('0xf0')](_0x1b8ddb[_0x553a('0x189')],_0x553a('0xf2'))[_0x553a('0x77')](_0x553a('0xf3')),'ContactId':_0x21114a[_0x553a('0xf4')],'ListId':_0x21114a[_0x553a('0xf5')],'VoiceQueueId':_0x21114a[_0x553a('0xfb')]||undefined,'CampaignId':_0x21114a[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0x18a')));break;case 0x5:if(_0x21114a[_0x553a('0xe6')]>=_0x1b8ddb[_0x553a('0x18b')]-0x1){return!![];}this[_0x553a('0xbb')]({'active':![],'countbusyretry':_0x21114a[_0x553a('0xe6')]+=0x1,'scheduledat':moment()['add'](_0x1b8ddb['dialBusyRetryFrequency'],_0x553a('0xf2'))[_0x553a('0x77')](_0x553a('0xf3')),'ContactId':_0x21114a[_0x553a('0xf4')],'ListId':_0x21114a['ListId'],'VoiceQueueId':_0x21114a[_0x553a('0xfb')]||undefined,'CampaignId':_0x21114a[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0x18c')));break;case 0x8:if(_0x21114a[_0x553a('0xe7')]>=_0x1b8ddb[_0x553a('0x18d')]-0x1){return!![];}this[_0x553a('0xbb')]({'active':![],'countcongestionretry':_0x21114a[_0x553a('0xe7')]+=0x1,'scheduledat':moment()[_0x553a('0xf0')](_0x1b8ddb[_0x553a('0x18e')],_0x553a('0xf2'))['format'](_0x553a('0xf3')),'ContactId':_0x21114a[_0x553a('0xf4')],'ListId':_0x21114a[_0x553a('0xf5')],'VoiceQueueId':_0x21114a[_0x553a('0xfb')]||undefined,'CampaignId':_0x21114a[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x21114a[_0x553a('0xf8')]>=_0x1b8ddb[_0x553a('0x18f')]-0x1){return!![];}else{this[_0x553a('0xbb')]({'active':![],'countnosuchnumberretry':_0x21114a['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x553a('0xf0')](_0x1b8ddb['dialNoSuchNumberRetryFrequency'],'minutes')[_0x553a('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x21114a['ContactId'],'ListId':_0x21114a[_0x553a('0xf5')],'VoiceQueueId':_0x21114a['VoiceQueueId']||undefined,'CampaignId':_0x21114a[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0x190')));}break;case 0xa:if(_0x21114a['countdropretry']>=_0x1b8ddb[_0x553a('0x191')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x21114a[_0x553a('0xe9')]+=0x1,'scheduledat':moment()[_0x553a('0xf0')](_0x1b8ddb['dialDropRetryFrequency'],_0x553a('0xf2'))[_0x553a('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x21114a['ContactId'],'ListId':_0x21114a[_0x553a('0xf5')],'VoiceQueueId':_0x21114a[_0x553a('0xfb')]||undefined,'CampaignId':_0x21114a[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0x113')));break;case 0xb:if(_0x21114a[_0x553a('0xea')]>=_0x1b8ddb['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x553a('0xbb')]({'active':![],'countabandonedretry':_0x21114a[_0x553a('0xea')]+=0x1,'scheduledat':moment()[_0x553a('0xf0')](_0x1b8ddb[_0x553a('0x11b')],'minutes')[_0x553a('0x77')](_0x553a('0xf3')),'ContactId':_0x21114a[_0x553a('0xf4')],'ListId':_0x21114a[_0x553a('0xf5')],'VoiceQueueId':_0x21114a['VoiceQueueId']||undefined,'CampaignId':_0x21114a[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0x11c')));break;case 0x13:if(_0x21114a[_0x553a('0xe3')]>=_0x1b8ddb[_0x553a('0xed')]-0x1){return!![];}this[_0x553a('0xbb')]({'active':![],'countmachineretry':_0x21114a[_0x553a('0xe3')]+=0x1,'scheduledat':moment()[_0x553a('0xf0')](_0x1b8ddb[_0x553a('0xf1')],_0x553a('0xf2'))[_0x553a('0x77')](_0x553a('0xf3')),'ContactId':_0x21114a[_0x553a('0xf4')],'ListId':_0x21114a[_0x553a('0xf5')],'VoiceQueueId':_0x21114a['VoiceQueueId']||undefined,'CampaignId':_0x21114a['CampaignId']||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0xfc')));break;case 0x14:if(_0x21114a[_0x553a('0xf9')]>=_0x1b8ddb[_0x553a('0x192')]-0x1){return!![];}this[_0x553a('0xbb')]({'active':![],'countagentrejectretry':_0x21114a[_0x553a('0xf9')]+=0x1,'scheduledat':moment()[_0x553a('0xf0')](_0x1b8ddb[_0x553a('0x193')],_0x553a('0xf2'))[_0x553a('0x77')](_0x553a('0xf3')),'ContactId':_0x21114a[_0x553a('0xf4')],'ListId':_0x21114a['ListId'],'VoiceQueueId':_0x21114a[_0x553a('0xfb')]||undefined,'CampaignId':_0x21114a[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0x194')));break;default:return!![];}};Dialer['prototype'][_0x553a('0x187')]=function(_0x35ac5f,_0x3ad348,_0x3cc889){var _0x8bf3ef=this;var _0xe19ae9=new History(_0x35ac5f);return new BPromise(function(_0x48cbf7,_0x3ee1d0){if(_[_0x553a('0x3d')](_0x3ad348)&&typeof _0x3ad348!==_0x553a('0x15d')){return _0x3ee1d0(msgResponse(_0x553a('0x195'),_0x553a('0x13b'),_0x553a('0x196')));}if(_[_0x553a('0x3d')](_0x3cc889)&&typeof _0x3cc889!==_0x553a('0x15d')){return _0x3ee1d0(msgResponse(_0x553a('0x195'),_0x553a('0x13b'),_0x553a('0x197')));}switch(_0x3cc889['reason']){case'0':_0x3ad348[_0x553a('0x68')]+=0x1;_0xe19ae9[_0x553a('0xa5')]=0x0;_0xe19ae9[_0x553a('0xa6')]=_0x553a('0x198');_0xe19ae9[_0x553a('0xf8')]+=0x1;_0xe19ae9['countglobal']+=0x1;ami[_0x553a('0x4b')](_0x553a('0x199'),ut['buildObj'](_0x35ac5f,_0x553a('0x19a')));_0x8bf3ef[_0x553a('0xc5')](_0xe19ae9)['catch'](loggerCatch(_0x553a('0xe5')));if(_0x8bf3ef[_0x553a('0x19b')](0x0,_0x35ac5f,_0x3ad348)){if(_0xe19ae9[_0x553a('0xf8')]>=_0x3ad348[_0x553a('0x18f')]){_0x8bf3ef[_0x553a('0xee')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x19c'));}else{_0x8bf3ef[_0x553a('0xeb')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x19c'));}}break;case'3':_0x3ad348[_0x553a('0x67')]+=0x1;_0xe19ae9[_0x553a('0xa5')]=0x3;_0xe19ae9[_0x553a('0xa6')]=_0x553a('0x19d');_0xe19ae9[_0x553a('0xe8')]+=0x1;_0xe19ae9[_0x553a('0xe4')]+=0x1;ami[_0x553a('0x4b')](_0x553a('0x19e'),ut[_0x553a('0xf6')](_0x35ac5f,_0x553a('0x19f')));_0x8bf3ef[_0x553a('0xc5')](_0xe19ae9)[_0x553a('0xaf')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x8bf3ef[_0x553a('0x19b')](0x3,_0x35ac5f,_0x3ad348)){if(_0xe19ae9[_0x553a('0xe8')]>=_0x3ad348['dialNoAnswerMaxRetry']){_0x8bf3ef[_0x553a('0xee')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x1a0'));}else{_0x8bf3ef[_0x553a('0xeb')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x1a0'));}}break;case'5':_0x3ad348[_0x553a('0x63')]+=0x1;_0xe19ae9[_0x553a('0xa5')]=0x5;_0xe19ae9[_0x553a('0xa6')]='Busy';_0xe19ae9[_0x553a('0xe6')]+=0x1;_0xe19ae9[_0x553a('0xe4')]+=0x1;ami[_0x553a('0x4b')](_0x553a('0x1a1'),ut[_0x553a('0xf6')](_0x35ac5f,_0x553a('0x1a2')));_0x8bf3ef[_0x553a('0xc5')](_0xe19ae9)[_0x553a('0xaf')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x8bf3ef[_0x553a('0x19b')](0x5,_0x35ac5f,_0x3ad348)){if(_0xe19ae9[_0x553a('0xe6')]>=_0x3ad348[_0x553a('0x18b')]){_0x8bf3ef[_0x553a('0xee')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,'reason\x205\x20busy');}else{_0x8bf3ef[_0x553a('0xeb')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x1a3'));}}break;case'8':_0x3ad348['outboundCongestionCallsDay']+=0x1;_0xe19ae9['state']=0x8;_0xe19ae9[_0x553a('0xa6')]=_0x553a('0x1a4');_0xe19ae9[_0x553a('0xe7')]+=0x1;_0xe19ae9[_0x553a('0xe4')]+=0x1;ami['emit'](_0x553a('0x1a5'),ut['buildObj'](_0x35ac5f,'congestion'));_0x8bf3ef[_0x553a('0xc5')](_0xe19ae9)[_0x553a('0xaf')](loggerCatch(_0x553a('0x1a6')));if(_0x8bf3ef[_0x553a('0x19b')](0x8,_0x35ac5f,_0x3ad348)){if(_0xe19ae9[_0x553a('0xe7')]>=_0x3ad348['dialCongestionMaxRetry']){_0x8bf3ef['createStateFinal'](_0xe19ae9,_0x48cbf7,_0x3ee1d0,'reason\x208\x20congestion');}else{_0x8bf3ef[_0x553a('0xeb')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x1a7'));}}break;case'11':_0x3ad348[_0x553a('0x1a8')]+=0x1;_0xe19ae9[_0x553a('0xa5')]=0xb;_0xe19ae9[_0x553a('0xa6')]=_0x553a('0x118');_0xe19ae9[_0x553a('0xea')]+=0x1;_0xe19ae9[_0x553a('0xe4')]+=0x1;_0x8bf3ef[_0x553a('0xc5')](_0xe19ae9)[_0x553a('0xaf')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x8bf3ef[_0x553a('0x19b')](0xb,_0x35ac5f,_0x3ad348)){if(_0xe19ae9[_0x553a('0xea')]>=_0x3ad348['dialAbandonedMaxRetry']){_0x8bf3ef[_0x553a('0xee')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x1a9'));}else{_0x8bf3ef[_0x553a('0xeb')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x1a9'));}}break;case'20':_0x3ad348[_0x553a('0x6a')]+=0x1;_0xe19ae9['state']=0x14;_0xe19ae9[_0x553a('0xa6')]='AgentReject';_0xe19ae9[_0x553a('0xf9')]+=0x1;_0xe19ae9['countglobal']+=0x1;ami[_0x553a('0x4b')](_0x553a('0x1aa'),ut['buildObj'](_0x35ac5f,_0x553a('0x1ab')));_0x8bf3ef[_0x553a('0xc5')](_0xe19ae9)[_0x553a('0xaf')](loggerCatch(_0x553a('0x1ac')));if(_0x8bf3ef[_0x553a('0x19b')](0x14,_0x35ac5f,_0x3ad348)){if(_0xe19ae9['countagentrejectretry']>=_0x3ad348[_0x553a('0x192')]){_0x8bf3ef[_0x553a('0xee')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x1ad'));}else{_0x8bf3ef['stateGlobal'](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x1ad'));}}break;default:_0x3ad348[_0x553a('0x6b')]+=0x1;_0xe19ae9[_0x553a('0xa5')]=0xc;_0xe19ae9[_0x553a('0xa6')]=_0x3cc889[_0x553a('0x1ae')];_0x8bf3ef[_0x553a('0xc5')](_0xe19ae9)[_0x553a('0xaf')](loggerCatch(_0x553a('0x1af')));if(_0x8bf3ef[_0x553a('0x19b')](_0x3cc889['reason'],_0x35ac5f,_0x3ad348)){if(_0xe19ae9[_0x553a('0xe6')]+_0xe19ae9['countcongestionretry']+_0xe19ae9[_0x553a('0xe8')]+_0xe19ae9[_0x553a('0xf8')]+_0xe19ae9[_0x553a('0xe9')]+_0xe19ae9['countabandonedretry']+_0xe19ae9[_0x553a('0xe3')]+_0xe19ae9[_0x553a('0xf9')]>=_0x3ad348['dialGlobalMaxRetry']){_0x8bf3ef[_0x553a('0xeb')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x3cc889[_0x553a('0x1ae')]);}else{_0x8bf3ef['createStateFinal'](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x3cc889[_0x553a('0x1ae')]);}}}});};Dialer[_0x553a('0xa8')][_0x553a('0xeb')]=function(_0x4a51dc,_0x58857b,_0x9a1ac,_0x4487e3){var _0x95c26=new Final(_0x4a51dc);_0x95c26[_0x553a('0xa5')]=0xf;_0x95c26['statedesc']=_0x553a('0x1b0');this[_0x553a('0xee')](_0x95c26,_0x58857b,_0x9a1ac,_0x4487e3);};Dialer['prototype'][_0x553a('0xee')]=function(_0x5bad1d,_0x524a18,_0x1b7123,_0x1d494b){this[_0x553a('0xc3')](_0x5bad1d)['then'](function(){return _0x524a18(msgResponse(_0x553a('0x195'),_0x553a('0x1b1'),_0x1d494b));})[_0x553a('0xaf')](function(){return _0x1b7123(msgResponse(_0x553a('0x1b2'),_0x553a('0x13b'),_0x553a('0x1b3')));});};Dialer['prototype'][_0x553a('0x150')]=function(_0x9905eb){var _0x261ebf=_0x9905eb['dialPredictiveOptimizationPercentage']/0x64;var _0x4f7315=_0x9905eb[_0x553a('0x10e')]/(_0x9905eb[_0x553a('0x10e')]+_0x9905eb[_0x553a('0x61')]);var _0x2beb36=Math[_0x553a('0x1b4')](_0x9905eb['predictiveIntervalAvailable']*(_0x9905eb[_0x553a('0x1b5')]/0x64));var _0x4d3841=Math[_0x553a('0x1b4')](_0x9905eb[_0x553a('0x1b6')]*(_0x9905eb[_0x553a('0x1b7')]/0x64));var _0x28e04f=_0x9905eb['available']+_0x9905eb[_0x553a('0x54')];var _0x28be60=Math[_0x553a('0x1b8')](_0x9905eb[_0x553a('0x87')]*_0x9905eb[_0x553a('0x8a')]*_0x9905eb[_0x553a('0x1b9')]*_0x9905eb['predictiveIntervalMultiplicativeFactor']);if(_[_0x553a('0x3d')](_0x9905eb[_0x553a('0x2a')])){if(!_[_0x553a('0x3d')](_0x9905eb[_0x553a('0x29')])){_0x9905eb[_0x553a('0x29')]=undefined;loggerPredictive[_0x553a('0x93')](_0x553a('0x1ba'),_0x553a('0x1bb'));}if(!_[_0x553a('0x3d')](_0x9905eb['handlePredictive'])){loggerPredictive[_0x553a('0x93')]('[startMethodPredictive][StartProgressive]',_0x553a('0x1bc'));clearInterval(_0x9905eb['handlePredictive']);_0x9905eb[_0x553a('0x8e')]=undefined;}_0x9905eb[_0x553a('0x2a')]=moment()[_0x553a('0x77')](_0x553a('0xf3'));loggerPredictive[_0x553a('0x7b')](_0x9905eb[_0x553a('0x3f')],_0x553a('0x1bd'),_0x9905eb[_0x553a('0x2a')]);this['handlePower'](_0x9905eb,0x1);}else if(ifInterval(_0x9905eb[_0x553a('0x1be')],_0x9905eb['startProgressive'])){this[_0x553a('0x14e')](_0x9905eb,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x9905eb[_0x553a('0x2a')],_0x9905eb[_0x553a('0x3f')]);_0x9905eb[_0x553a('0x87')]=0x0;_0x9905eb[_0x553a('0x71')]=0x0;}else if(_0x261ebf<_0x4f7315&&_0x9905eb['dialPredictiveOptimization']===_0x553a('0x1bf')){freeVariablesPredictive(_0x9905eb);loggerPredictive['info'](_0x553a('0x1c0'),_0x553a('0x1c1'),_0x4f7315,'startProgressive',_0x9905eb[_0x553a('0x3f')]);}else if(_0x28be60<_0x9905eb[_0x553a('0x71')]&&_0x9905eb[_0x553a('0x1c2')]===_0x553a('0x1bf')){freeVariablesPredictive(_0x9905eb);loggerPredictive[_0x553a('0x7b')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x28be60,_0x553a('0x1c3'),_0x9905eb['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x9905eb['name']);}else if(!ifInterval(_0x9905eb[_0x553a('0x1be')],_0x9905eb[_0x553a('0x2a')])&&_[_0x553a('0x3d')](_0x9905eb['startPredictive'])&&!_['isUndefined'](_0x9905eb[_0x553a('0x2a')])){_0x9905eb['startPredictive']=moment()[_0x553a('0x77')](_0x553a('0xf3'));loggerPredictive[_0x553a('0x7b')](_0x9905eb['name'],_0x553a('0x1c4'),_0x9905eb[_0x553a('0x29')]);this[_0x553a('0x1c5')](_0x9905eb['dialPredictiveInterval'])[_0x553a('0xb5')](this[_0x553a('0x1c6')](_0x9905eb))[_0x553a('0xb5')](mergeDataErlangB(_0x9905eb))['then'](this[_0x553a('0x1c7')](_0x9905eb))[_0x553a('0xaf')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x9905eb));}else if(!ifInterval(_0x9905eb[_0x553a('0x1be')],_0x9905eb[_0x553a('0x29')])){_0x9905eb['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x9905eb[_0x553a('0x29')]=moment()['format'](_0x553a('0xf3'));loggerPredictive['info'](_0x9905eb[_0x553a('0x3f')],_0x553a('0x1c8'),_0x9905eb[_0x553a('0x29')]);clearInterval(_0x9905eb['handlePredictive']);_0x9905eb[_0x553a('0x8e')]=undefined;this[_0x553a('0x1c5')](_0x9905eb[_0x553a('0x1be')])[_0x553a('0xb5')](this['getDataPredictive'](_0x9905eb))[_0x553a('0xb5')](mergeDataErlangB(_0x9905eb))['then'](this[_0x553a('0x1c7')](_0x9905eb))[_0x553a('0xaf')](loggerCatchPredictive(_0x553a('0x1c9'),_0x9905eb));}else if(_0x9905eb[_0x553a('0x1b6')]&&_0x28e04f<_0x9905eb[_0x553a('0x1b6')]-_0x4d3841){freeVariablesPredictive(_0x9905eb);loggerPredictive[_0x553a('0x7b')](_0x9905eb[_0x553a('0x3f')],_0x553a('0x1ca'),_0x28e04f,')\x20are\x20less\x20than\x20threshold\x20(',_0x9905eb['predictiveIntervalAvailable'],'-',_0x4d3841,'=',_0x9905eb['predictiveIntervalAvailable']-_0x4d3841,')');}else if(_0x9905eb[_0x553a('0x1b6')]&&_0x28e04f>_0x9905eb[_0x553a('0x1b6')]+_0x2beb36){freeVariablesPredictive(_0x9905eb);loggerPredictive[_0x553a('0x7b')](_0x9905eb['name'],_0x553a('0x1ca'),_0x28e04f,_0x553a('0x1cb'),_0x9905eb['predictiveIntervalAvailable'],'+',_0x2beb36,'=',_0x9905eb[_0x553a('0x1b6')]+_0x2beb36,')');}};Dialer['prototype'][_0x553a('0x1c6')]=function(_0x2ff73e){var _0x4f5070=this;return function(_0x43fe3b){return new BPromise(function(_0xf76dc3,_0x3857ed){_[_0x553a('0xcb')](_0x2ff73e,_0x43fe3b[0x0]);if(checkGetDataPredictive(_0x43fe3b[0x0])){var _0x1e03af=_0x2ff73e[_0x553a('0x1b6')]=_0x2ff73e[_0x553a('0x54')]+_0x2ff73e[_0x553a('0x4f')];var _0x3b3292=_0x2ff73e[_0x553a('0x1be')]*0x3c;var _0x496fd9=_0x43fe3b[0x0][_0x553a('0x6e')]+_0x43fe3b[0x0]['predictiveIntervalAvgHoldtime'];var _0x51bd23=(_0x43fe3b[0x0][_0x553a('0x6c')]+_0x43fe3b[0x0][_0x553a('0x6f')]+_0x43fe3b[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x43fe3b[0x0][_0x553a('0x82')];_0x2ff73e[_0x553a('0x1b9')]=_0x51bd23>0x0?_0x51bd23:0x1;switch(_0x2ff73e[_0x553a('0x1c2')]){case _0x553a('0x1bf'):var _0x530663=_0x2ff73e[_0x553a('0x1cc')]/0x64;return _0x4f5070[_0x553a('0x1cd')](_0x1e03af,_0x3b3292,_0x496fd9,_0x51bd23,_0x530663)['then'](function(_0x126692){return _0xf76dc3(_0x126692);});case _0x553a('0x1ce'):var _0x316c93=_0x2ff73e['dialPredictiveOptimizationPercentage']/0x64;return _0x4f5070['busyFactor'](_0x1e03af,_0x3b3292,_0x496fd9,_0x51bd23,_0x316c93)[_0x553a('0xb5')](function(_0x2a3fc7){return _0xf76dc3(_0x2a3fc7);});default:return _0x3857ed(msgResponse(_0x553a('0x1cf'),_0x553a('0x13b'),_0x553a('0x1d0')));}}else{return _0x3857ed(msgResponse(_0x553a('0x1cf'),_0x553a('0x13b'),'check\x20failure'));}});};};Dialer['prototype'][_0x553a('0x1d1')]=function(_0xbc03a){var _0x50a472=this;return function(_0x498b30){return new BPromise(function(_0x339025,_0x516d15){_[_0x553a('0xcb')](_0xbc03a,_0x498b30[0x0]);if(checkGetDataPredictive(_0x498b30[0x0])){loggerPredictive[_0x553a('0x7b')](JSON[_0x553a('0x48')](_0x498b30[0x0]));if(_0xbc03a[_0x553a('0x1c2')]===_0x553a('0x1bf')){return _0x50a472[_0x553a('0xc2')](_0xbc03a['id'])['then'](function(_0x3e0326){var _0x271469=_0xbc03a[_0x553a('0x50')]-_0x3e0326[0x0]['outboundQueuePauses'];var _0x5a6d8c=_0xbc03a[_0x553a('0x1be')]*0x3c;var _0x100bf1=_0x498b30[0x0]['predictiveIntervalAvgTalktime']+_0x498b30[0x0][_0x553a('0x6d')];var _0x358632=(_0x498b30[0x0][_0x553a('0x6c')]+_0x498b30[0x0][_0x553a('0x6f')]+_0x498b30[0x0][_0x553a('0x7f')])/_0x498b30[0x0][_0x553a('0x82')];var _0x378822=_0xbc03a[_0x553a('0x1cc')]/0x64;_0xbc03a[_0x553a('0x1d2')]=_0x3e0326[0x0][_0x553a('0x1d3')]||0x0;_0xbc03a[_0x553a('0x1b9')]=_0x358632>0x0?_0x358632:0x1;return _0x50a472[_0x553a('0x1cd')](_0x271469,_0x5a6d8c,_0x100bf1,_0x358632,_0x378822);})['then'](function(_0x3fd278){return _0x339025(_0x3fd278);})[_0x553a('0xaf')](function(_0x5ee124){return _0x516d15(msgResponse(_0x553a('0x1d4'),_0x553a('0x13b'),JSON['stringify'](_0x5ee124)));});}if(_0xbc03a[_0x553a('0x1c2')]===_0x553a('0x1ce')){return _0x50a472[_0x553a('0xc2')](_0xbc03a['id'])[_0x553a('0xb5')](function(_0x1140c1){var _0x8d0b42=_0xbc03a[_0x553a('0x50')]-_0x1140c1[0x0][_0x553a('0x1d3')];var _0x2e7ff5=_0xbc03a[_0x553a('0x1be')]*0x3c;var _0x351844=_0x498b30[0x0][_0x553a('0x6e')]+_0x498b30[0x0]['predictiveIntervalAvgHoldtime'];var _0x1206da=(_0x498b30[0x0][_0x553a('0x6c')]+_0x498b30[0x0][_0x553a('0x6f')]+_0x498b30[0x0][_0x553a('0x7f')])/_0x498b30[0x0][_0x553a('0x82')];var _0x15eb58=_0xbc03a[_0x553a('0x1cc')]/0x64;_0xbc03a['predictiveIntervalPauses']=_0x1140c1[0x0]['outboundQueuePauses']||0x0;_0xbc03a['predictiveIntervalHitRate']=_0x1206da>0x0?_0x1206da:0x1;return _0x50a472[_0x553a('0x1d5')](_0x8d0b42,_0x2e7ff5,_0x351844,_0x1206da,_0x15eb58);})['then'](function(_0x27245e){return _0x339025(_0x27245e);})[_0x553a('0xaf')](function(_0x1ae1ce){return _0x516d15(msgResponse(_0x553a('0x1d4'),_0x553a('0x13b'),JSON[_0x553a('0x48')](_0x1ae1ce)));});}}else{return _0x516d15(msgResponse(_0x553a('0x1cf'),_0x553a('0x13b'),'check\x20failure'));}});};};Dialer[_0x553a('0xa8')][_0x553a('0x1c7')]=function(_0x1a26be){var _0x208ef2=this;return function(){var _0x33787c=0x0;var _0x17adc4=Math[_0x553a('0x1b8')](_0x1a26be[_0x553a('0x72')]*0x3e8);if(_0x17adc4>0x0){_0x17adc4=_0x17adc4<0x64?0x64:_0x17adc4;loggerPredictive[_0x553a('0x7b')](_0x1a26be['name'],_0x553a('0x1d6'),_0x17adc4,_0x553a('0x49'));_0x1a26be[_0x553a('0x8e')]=setInterval(function(){_0x208ef2[_0x553a('0x8e')](_0x1a26be);loggerPredictiveCalls[_0x553a('0x7b')]('[handlePredictive]',_0x33787c+=0x1);},_0x17adc4);}else{loggerPredictive[_0x553a('0x7b')](_0x1a26be['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x553a('0xa8')]['checkContactBlack']=function(_0x1aadd4,_0x2c5f5e){var _0x47d228=this;return function(_0x55e9e0){if(_[_0x553a('0x44')](_0x55e9e0)){if(_['isNil'](_0x2c5f5e[_0x553a('0x1d7')])||!_0x2c5f5e[_0x553a('0x1d8')]){if(_0x1aadd4['dialMethod']===_0x553a('0x9')){_0x1aadd4['queueStatusComplete']=_[_0x553a('0x3d')](_0x1aadd4[_0x553a('0x124')])?!![]:_0x1aadd4[_0x553a('0x124')];var _0x1757ce=uuid['v4']();_0x47d228[_0x553a('0x26')][_0x1757ce]=new Action(_0x1aadd4,_0x2c5f5e,_0x1757ce);loggerBooked[_0x553a('0x7b')]('[booked][checkContactBlack]',_0x1757ce,_0x553a('0x1d9'),JSON['stringify'](_0x1aadd4[_0x553a('0x124')]),_0x553a('0x1da'),_0x1aadd4[_0x553a('0x3f')]);if(_0x1aadd4[_0x553a('0x124')]){_0x1aadd4[_0x553a('0x124')]=![];_0x47d228[_0x553a('0x2c')][_0x47d228['actions'][_0x1757ce][_0x553a('0xb3')]]=[];ami['Action']({'actionid':_0x1757ce,'action':_0x553a('0x1db'),'queue':_0x1aadd4[_0x553a('0x3f')]})[_0x553a('0xaf')](function(){_0x47d228[_0x553a('0xb1')](_0x1aadd4);_0x47d228[_0x553a('0xbb')]({'active':![],'ContactId':_0x47d228[_0x553a('0x26')][_0x1757ce]['ContactId'],'ListId':_0x47d228[_0x553a('0x26')][_0x1757ce][_0x553a('0xf5')],'VoiceQueueId':_0x47d228[_0x553a('0x26')][_0x1757ce][_0x553a('0xfb')]||undefined,'CampaignId':_0x47d228[_0x553a('0x26')][_0x1757ce][_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x47d228[_0x553a('0x26')][_0x1757ce];});}else{loggerBooked[_0x553a('0x7b')](_0x553a('0x1dc'),JSON[_0x553a('0x48')](_0x1aadd4[_0x553a('0x124')]),_0x553a('0x1da'),_0x1aadd4[_0x553a('0x3f')]);_0x47d228[_0x553a('0xb1')](_0x1aadd4);_0x47d228[_0x553a('0xbb')]({'active':![],'ContactId':_0x47d228[_0x553a('0x26')][_0x1757ce][_0x553a('0xf4')],'ListId':_0x47d228[_0x553a('0x26')][_0x1757ce][_0x553a('0xf5')],'VoiceQueueId':_0x47d228['actions'][_0x1757ce][_0x553a('0xfb')]||undefined,'CampaignId':_0x47d228[_0x553a('0x26')][_0x1757ce]['CampaignId']||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x47d228[_0x553a('0x26')][_0x1757ce];}}else{return _0x47d228[_0x553a('0x15c')](_0x1aadd4,_0x2c5f5e);}}else{if(getDiff(_0x2c5f5e['scheduledat'])<_0x1aadd4[_0x553a('0x1dd')]*0x3c){if(_0x2c5f5e[_0x553a('0x1de')]&&!_0x2c5f5e['Agent'][_0x553a('0x1df')]){_0x47d228[_0x553a('0x20')][_0x553a('0x12d')](_0x2c5f5e['id'])[_0x553a('0x1e')](function(){_0x47d228[_0x553a('0xb1')](_0x1aadd4);});}else{_0x47d228[_0x553a('0xbd')]({'active':![]},_0x2c5f5e['id'],0x1)[_0x553a('0x1e')](function(){_0x47d228['updateOriginated'](_0x1aadd4);});}}else{_0x1aadd4[_0x553a('0x1e0')]+=0x1;_0x47d228[_0x553a('0xb1')](_0x1aadd4);if(_0x1aadd4['dialRecallInQueue']){_0x47d228['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2c5f5e['ContactId'],'ListId':_0x2c5f5e['ListId'],'VoiceQueueId':_0x2c5f5e['VoiceQueueId']||undefined,'CampaignId':_0x2c5f5e[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0x1e1')));_0x47d228[_0x553a('0xc5')](createObjHistory(_0x1aadd4,_0x2c5f5e,'RECALLINQUEUE',0x17,'RecallInQueue'))['catch'](loggerCatch(_0x553a('0x1e2')));}else{_0x47d228[_0x553a('0xd3')](createObjHistory(_0x1aadd4,_0x2c5f5e,_0x553a('0x1e3'),0x16,_0x553a('0x1e4')),_0x553a('0x1e5'),_0x553a('0x1e6'));}}}}else{_0x1aadd4[_0x553a('0x62')]+=0x1;_0x47d228[_0x553a('0xd3')](createObjHistory(_0x1aadd4,_0x2c5f5e,_0x553a('0x1e7'),0xd,_0x553a('0x1e8')),'[Originate][historyBlacklist]',_0x553a('0x1e9'));throw'inBlackList';}};};Dialer[_0x553a('0xa8')][_0x553a('0x153')]=function(_0x18f389){var _0x5c7618=this;var _0x5a3126=_0x18f389[_0x553a('0x1ea')]-_0x18f389[_0x553a('0x98')]-_0x18f389[_0x553a('0x1eb')];emitCampaignSummary(_0x18f389);if(_0x5a3126>0x0){if(_0x5a3126>this[_0x553a('0x25')]){_0x5a3126=this[_0x553a('0x25')];}_0x18f389[_0x553a('0x1eb')]+=_0x5a3126;this[_0x553a('0xc1')](_0x18f389['id'],_0x5a3126,_0x18f389[_0x553a('0x1ec')])[_0x553a('0xb5')](function(_0x4c6d14){_0x18f389['temp']-=_0x5a3126;_0x18f389[_0x553a('0x1eb')]=_0x18f389['temp']>0x0?_0x18f389[_0x553a('0x1eb')]:0x0;if(!checkContactEmpty(_0x4c6d14)){_0x18f389['message']=_0x553a('0x9d');logger[_0x553a('0x7b')](_0x553a('0x1ed')+_0x18f389[_0x553a('0x3f')]);}else{_0x18f389[_0x553a('0x98')]+=_0x4c6d14[_0x553a('0x96')];_0x18f389[_0x553a('0x3e')]=_0x553a('0x1ee');for(var _0x5739ed=0x0;_0x5739ed<_0x4c6d14[_0x553a('0x96')];_0x5739ed+=0x1){_0x18f389[_0x553a('0x1ef')]+=0x1;if(_[_0x553a('0xab')](_0x4c6d14[_0x5739ed])||_['isNil'](_0x4c6d14[_0x5739ed][_0x553a('0x160')])||_[_0x553a('0xab')](_0x4c6d14[_0x5739ed][_0x553a('0x160')][_0x553a('0x15f')])){_0x5c7618[_0x553a('0xc9')](_0x553a('0x1f0'),_0x18f389,_0x4c6d14[_0x5739ed]);}else{_0x5c7618['checkIsBlackListIvr'](_[_0x553a('0xcc')](_0x4c6d14[_0x5739ed],[_0x553a('0xcd'),_0x553a('0x1f1')]))[_0x553a('0xb5')](_0x5c7618['checkContactBlack'](_0x18f389,_0x4c6d14[_0x5739ed]))['catch'](_0x5c7618[_0x553a('0xc8')](_0x553a('0x1f2'),_0x18f389));}}}})[_0x553a('0xaf')](loggerGetContactDialer(_0x553a('0x1f3'),_0x18f389,_0x5a3126));}};Dialer[_0x553a('0xa8')]['handlePower']=function(_0xf3f33e,_0x5a76ab){var _0x2e34cb=this;var _0x3be34e=[];var _0x3b2edb=_0x5a76ab>=0x1?_0x5a76ab:0x1;if(_0xf3f33e[_0x553a('0x5c')]===_0x553a('0x9')){_0x3b2edb=0x1;}var _0x4efdc=Math[_0x553a('0x1b8')](_0xf3f33e[_0x553a('0x4f')]*_0x3b2edb)-_0xf3f33e[_0x553a('0x98')]-_0xf3f33e['temp'];emitVoiceQueueSummary(_0xf3f33e);if(_0xf3f33e[_0x553a('0x1f4')]>0x0){var _0x3a348c=_0xf3f33e[_0x553a('0x1f4')]-_0xf3f33e[_0x553a('0x98')]-_0xf3f33e[_0x553a('0x54')]-_0xf3f33e[_0x553a('0x1eb')]-_0xf3f33e[_0x553a('0x51')];if(_0x4efdc>_0x3a348c){_0x4efdc=_0x3a348c;}}if(_0x4efdc>0x0){if(_0xf3f33e[_0x553a('0x5c')]===_0x553a('0x9')){_0x4efdc=0x1;}if(_0x4efdc>this[_0x553a('0x25')]){_0x4efdc=this['maxNumberOriginate'];}_0xf3f33e[_0x553a('0x1eb')]+=_0x4efdc;for(var _0x2a8173 in this['agents']){if(typeof this[_0x553a('0x23')][_0x2a8173]!==_0x553a('0x97')){if(this['agents'][_0x2a8173]['state']==='not_inuse'&&this[_0x553a('0x23')][_0x2a8173][_0x553a('0xad')]===_0x553a('0xd1')){_0x3be34e[_0x553a('0x122')](this[_0x553a('0x23')][_0x2a8173]['id']);}}}this[_0x553a('0xbf')](_0xf3f33e['id'],_0x3be34e,_0x4efdc,_0xf3f33e[_0x553a('0x1ec')])['then'](function(_0x1126d7){_0xf3f33e['temp']-=_0x4efdc;_0xf3f33e[_0x553a('0x1eb')]=_0xf3f33e[_0x553a('0x1eb')]>0x0?_0xf3f33e[_0x553a('0x1eb')]:0x0;if(!checkContactEmpty(_0x1126d7)){_0x2e34cb['countReScheduled'](_0xf3f33e)[_0x553a('0xb5')](sendMessageReschedule(_0xf3f33e))[_0x553a('0xaf')](loggerCatch(_0x553a('0x1f5')));}else{_0xf3f33e['originated']+=_0x1126d7[_0x553a('0x96')];_0xf3f33e[_0x553a('0x3e')]=_0xf3f33e[_0x553a('0x5c')]===_0x553a('0x9')?_0x553a('0x1f6'):_0x553a('0x1ee');for(var _0x342497=0x0;_0x342497<_0x1126d7['length'];_0x342497+=0x1){if(_['isNil'](_0x1126d7[_0x342497])||_[_0x553a('0xab')](_0x1126d7[_0x342497][_0x553a('0x160')])||_['isNil'](_0x1126d7[_0x342497][_0x553a('0x160')][_0x553a('0x15f')])){_0x2e34cb['emptyContact']('[actionOriginate]\x20',_0xf3f33e,_0x1126d7[_0x342497]);}else{_0x2e34cb[_0x553a('0x1f7')](_['pick'](_0x1126d7[_0x342497],[_0x553a('0xfb'),'Contact.phone']))[_0x553a('0xb5')](_0x2e34cb[_0x553a('0x1f8')](_0xf3f33e,_0x1126d7[_0x342497]))[_0x553a('0xaf')](_0x2e34cb['loggerHandler'](_0x553a('0x1f0'),_0xf3f33e));}}}})[_0x553a('0xaf')](loggerGetContactDialer(_0x553a('0x1f9'),_0xf3f33e,_0x4efdc));}};Dialer['prototype'][_0x553a('0x8e')]=function(_0xfc4ded){if(_0xfc4ded[_0x553a('0x1f4')]>0x0){var _0x249308=_0xfc4ded[_0x553a('0x1f4')]-_0xfc4ded[_0x553a('0x98')]-_0xfc4ded[_0x553a('0x54')];if(_0x249308>0x0){this[_0x553a('0x1fa')](_0xfc4ded);}else{loggerPredictiveCalls[_0x553a('0x7b')](_0x553a('0x1fb'));}}else{this[_0x553a('0x1fa')](_0xfc4ded);}};Dialer[_0x553a('0xa8')]['tryOriginatePredictive']=function(_0x5dd068){var _0x5e00a9=this;var _0x4199c0=[];_0x5dd068['originated']+=0x1;for(var _0x4c0e24 in this[_0x553a('0x23')]){if(typeof this[_0x553a('0x23')][_0x4c0e24]!==_0x553a('0x97')){if(this[_0x553a('0x23')][_0x4c0e24][_0x553a('0xa5')]==='not_inuse'&&this[_0x553a('0x23')][_0x4c0e24][_0x553a('0xad')]===_0x553a('0xd1')){_0x4199c0[_0x553a('0x122')](this[_0x553a('0x23')][_0x4c0e24]['id']);}}}this[_0x553a('0xbf')](_0x5dd068['id'],_0x4199c0,0x1,_0x5dd068['dialOrderByScheduledAt'])[_0x553a('0xb5')](function(_0x41e720){if(!checkContactEmpty(_0x41e720)){checkContactLowerLimitOriginate(_0x5dd068,0x1,0x0);_0x5e00a9[_0x553a('0xb6')](_0x5dd068)[_0x553a('0xb5')](sendMessageReschedule(_0x5dd068))[_0x553a('0xaf')](loggerCatch(_0x553a('0x1f5')));}else{_0x5dd068[_0x553a('0x3e')]=_0x553a('0x1ee');if(_['isNil'](_0x41e720[0x0])||_['isNil'](_0x41e720[0x0][_0x553a('0x160')])||_[_0x553a('0xab')](_0x41e720[0x0][_0x553a('0x160')][_0x553a('0x15f')])){_0x5e00a9[_0x553a('0xc9')](_0x553a('0x1f0'),_0x5dd068,_0x41e720[0x0]);}else{_0x5e00a9[_0x553a('0x1f7')](_[_0x553a('0xcc')](_0x41e720[0x0],[_0x553a('0xfb'),_0x553a('0x1f1')]))[_0x553a('0xb5')](_0x5e00a9['checkContactBlack'](_0x5dd068,_0x41e720[0x0]))[_0x553a('0xaf')](_0x5e00a9[_0x553a('0xc8')](_0x553a('0x1fc'),_0x5dd068));}}})[_0x553a('0xaf')](loggerGetContactDialer(_0x553a('0x1fd'),_0x5dd068,0x1));emitVoiceQueueSummary(_0x5dd068);};Dialer[_0x553a('0xa8')]['abandonmentRate']=function(_0x25f724,_0x34f4ef,_0x53b946,_0x106aa9,_0x5d77af,_0x175776){loggerPredictive[_0x553a('0x7b')](_0x553a('0x1fe'));loggerPredictive[_0x553a('0x7b')](_0x553a('0x1ff'),_0x25f724);loggerPredictive[_0x553a('0x7b')](_0x553a('0x200'),_0x34f4ef);loggerPredictive[_0x553a('0x7b')](_0x553a('0x201'),_0x53b946);loggerPredictive[_0x553a('0x7b')](_0x553a('0x202'),_0x106aa9);loggerPredictive['info'](_0x553a('0x203'),_0x5d77af);loggerPredictive[_0x553a('0x7b')](_0x553a('0x81'));return new BPromise(function(_0x9df0,_0x4dc53a){if(_0x25f724<=0x0||isNaN(_0x25f724)){return _0x4dc53a(msgResponse(_0x553a('0x204'),'Error',_0x553a('0x205')+_0x25f724));}if(_0x53b946<=0x0||isNaN(_0x53b946)){return _0x4dc53a(msgResponse(_0x553a('0x204'),_0x553a('0x47'),'Ts\x20=\x20'+_0x53b946));}if(_0x106aa9<=0x0||isNaN(_0x106aa9)){return _0x4dc53a(msgResponse(_0x553a('0x204'),_0x553a('0x47'),_0x553a('0x206')+_0x106aa9));}if(_0x34f4ef<=0x0||isNaN(_0x34f4ef)){return _0x4dc53a(msgResponse(_0x553a('0x204'),_0x553a('0x47'),_0x553a('0x207')+_0x34f4ef));}if(_0x5d77af<=0x0||isNaN(_0x5d77af)){return _0x4dc53a(msgResponse(_0x553a('0x204'),_0x553a('0x47'),'Amax\x20=\x20'+_0x5d77af));}_0x175776=_0x175776||0x0;var _0x5c4387=0x1/_0x53b946;var _0x13c88a=0x0;var _0x1ed75a=0x0;var _0xf0b116=0x0;var _0x382df5=0x0;for(var _0x5be3f5=0x0;_0xf0b116<_0x5d77af;_0x5be3f5+=0x1){_0x1ed75a=_0x5be3f5/_0x34f4ef;_0x13c88a=(_0x106aa9*_0x1ed75a+_0x175776)/_0x5c4387;_0xf0b116=erlangb(_0x13c88a,_0x25f724);_0x382df5=_0x13c88a/_0x25f724*(0x1-erlangb(_0x13c88a,_0x25f724));}return _0x9df0({'erlangCalls':_0x5be3f5,'erlangCallToSecond':_0x34f4ef/_0x5be3f5,'erlangAbandonmentRate':_0xf0b116,'erlangBusyFactor':_0x382df5});});};Dialer[_0x553a('0xa8')][_0x553a('0x1d5')]=function(_0x69d2c6,_0x2d5860,_0x245c89,_0x3e36b4,_0x208e4f,_0x56f334){loggerPredictive[_0x553a('0x7b')](_0x553a('0x208'));loggerPredictive[_0x553a('0x7b')](_0x553a('0x1ff'),_0x69d2c6);loggerPredictive['info'](_0x553a('0x200'),_0x2d5860);loggerPredictive[_0x553a('0x7b')](_0x553a('0x201'),_0x245c89);loggerPredictive[_0x553a('0x7b')](_0x553a('0x202'),_0x3e36b4);loggerPredictive[_0x553a('0x7b')](_0x553a('0x209'),_0x208e4f);loggerPredictive['info'](_0x553a('0x81'));return new BPromise(function(_0x1557e,_0x1392e9){if(_0x69d2c6<=0x0||isNaN(_0x69d2c6)){return _0x1392e9(msgResponse(_0x553a('0x20a'),'Error',_0x553a('0x205')+_0x69d2c6));}if(_0x245c89<=0x0||isNaN(_0x245c89)){return _0x1392e9(msgResponse(_0x553a('0x20a'),'Error','Ts\x20=\x20'+_0x245c89));}if(_0x3e36b4<=0x0||isNaN(_0x3e36b4)){return _0x1392e9(msgResponse(_0x553a('0x20a'),_0x553a('0x47'),_0x553a('0x206')+_0x3e36b4));}if(_0x2d5860<=0x0||isNaN(_0x2d5860)){return _0x1392e9(msgResponse('[busyFactor]',_0x553a('0x47'),_0x553a('0x207')+_0x2d5860));}if(_0x208e4f<=0x0||isNaN(_0x208e4f)){return _0x1392e9(msgResponse('[busyFactor]',_0x553a('0x47'),'Umin\x20=\x20'+_0x208e4f));}_0x56f334=_0x56f334||0x0;var _0x7bb974=0x1/_0x245c89;var _0x2a3fd1=0x0;var _0x39a8e4=0x0;var _0x1050f9=0x0;var _0x32b350=0x0;for(var _0x5333ca=0x0;_0x32b350<_0x208e4f;_0x5333ca+=0x1){_0x39a8e4=_0x5333ca/_0x2d5860;_0x2a3fd1=(_0x3e36b4*_0x39a8e4+_0x56f334)/_0x7bb974;_0x1050f9=erlangb(_0x2a3fd1,_0x69d2c6);_0x32b350=_0x2a3fd1/_0x69d2c6*(0x1-erlangb(_0x2a3fd1,_0x69d2c6));}return _0x1557e({'erlangCalls':_0x5333ca,'erlangCallToSecond':_0x2d5860/_0x5333ca,'erlangAbandonmentRate':_0x1050f9,'erlangBusyFactor':_0x32b350});});};module[_0x553a('0x20b')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index e955afe..b027990 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 _0x1621=['countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','lodash','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry'];(function(_0x370c4d,_0x38ac8d){var _0x3d2648=function(_0x32b19c){while(--_0x32b19c){_0x370c4d['push'](_0x370c4d['shift']());}};_0x3d2648(++_0x38ac8d);}(_0x1621,0x111));var _0x1162=function(_0xae282f,_0x2d9368){_0xae282f=_0xae282f-0x0;var _0x5f46d4=_0x1621[_0xae282f];return _0x5f46d4;};'use strict';var util=require('util');var _=require(_0x1162('0x0'));var moment=require('moment');function getSeconds(_0x1a9037,_0x2634ae){var _0x1b3d68=moment(_0x1a9037)[_0x1162('0x1')](0x0);var _0x5ec16b=moment(_0x2634ae)[_0x1162('0x1')](0x0);return _0x1b3d68[_0x1162('0x2')](_0x5ec16b,_0x1162('0x3'));}function QueueCallerAbandon(_0x4dece1,_0x2a9863){this[_0x1162('0x4')]=_0x4dece1['scheduledat'];this[_0x1162('0x5')]=_0x4dece1[_0x1162('0x5')];this[_0x1162('0x6')]=_0x4dece1[_0x1162('0x5')]===_0x1162('0x7')?_0x1162('0x8'):_0x4dece1[_0x1162('0x5')];this['countbusyretry']=_0x4dece1[_0x1162('0x9')];this[_0x1162('0xa')]=_0x4dece1[_0x1162('0xa')];this['countnoanswerretry']=_0x4dece1[_0x1162('0xb')];this[_0x1162('0xc')]=_0x4dece1[_0x1162('0x9')]+_0x4dece1[_0x1162('0xa')]+_0x4dece1[_0x1162('0xb')]+_0x4dece1['countnosuchnumberretry']+_0x4dece1[_0x1162('0xd')]+_0x4dece1['countabandonedretry']+_0x4dece1['countmachineretry']+_0x4dece1[_0x1162('0xe')];this['countnosuchnumberretry']=_0x4dece1['countnosuchnumberretry'];this[_0x1162('0xd')]=_0x4dece1[_0x1162('0xd')];this['countabandonedretry']=_0x4dece1[_0x1162('0xf')];this[_0x1162('0x10')]=_0x4dece1[_0x1162('0x10')];this[_0x1162('0xe')]=_0x4dece1['countagentrejectretry'];this[_0x1162('0x11')]=_0x2a9863[_0x1162('0x11')];this[_0x1162('0x12')]=_0x4dece1[_0x1162('0x13')];this['calleridnum']=_0x4dece1[_0x1162('0x14')];this[_0x1162('0x15')]=_0x4dece1['starttime'];this[_0x1162('0x16')]=_0x4dece1[_0x1162('0x16')];this[_0x1162('0x17')]=_0x4dece1[_0x1162('0x17')];this[_0x1162('0x18')]=this[_0x1162('0x17')];this[_0x1162('0x19')]=getSeconds(_0x4dece1[_0x1162('0x16')],_0x4dece1['starttime']);this[_0x1162('0x1a')]=getSeconds(this['droptime'],_0x4dece1[_0x1162('0x16')]);this[_0x1162('0x1b')]=0x0;this[_0x1162('0x8')]=_0x2a9863[_0x1162('0x8')];this[_0x1162('0x1c')]=_0x2a9863[_0x1162('0x1d')];this[_0x1162('0x1e')]=_0x2a9863['reason'];this[_0x1162('0x1f')]=_0x4dece1[_0x1162('0x1f')];this[_0x1162('0x20')]=_0x4dece1['callbackuniqueid'];this[_0x1162('0x21')]=_0x4dece1[_0x1162('0x21')];this[_0x1162('0x22')]=_0x4dece1[_0x1162('0x22')];this[_0x1162('0x23')]=_0x4dece1[_0x1162('0x23')];this['ListId']=_0x4dece1[_0x1162('0x24')];this[_0x1162('0x25')]=_0x4dece1['UserId'];this[_0x1162('0x26')]=_0x4dece1[_0x1162('0x26')];this['CampaignId']=_0x4dece1['CampaignId'];this[_0x1162('0x27')]=_0x4dece1[_0x1162('0x27')]||'';this['originatecalleridname']=_0x4dece1[_0x1162('0x28')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x0b30=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','droptime','endtime','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0b30,0x6b));var _0x00b3=function(_0xbd2d7d,_0x2a9d52){_0xbd2d7d=_0xbd2d7d-0x0;var _0x20454e=_0x0b30[_0xbd2d7d];return _0x20454e;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x00b3('0x0'));function getSeconds(_0x3b40b9,_0x1c63ed){var _0x26a051=moment(_0x3b40b9)[_0x00b3('0x1')](0x0);var _0xb9a96d=moment(_0x1c63ed)[_0x00b3('0x1')](0x0);return _0x26a051[_0x00b3('0x2')](_0xb9a96d,_0x00b3('0x3'));}function QueueCallerAbandon(_0xda6b82,_0x357ed1){this['scheduledat']=_0xda6b82[_0x00b3('0x4')];this[_0x00b3('0x5')]=_0xda6b82[_0x00b3('0x5')];this[_0x00b3('0x6')]=_0xda6b82[_0x00b3('0x5')]===_0x00b3('0x7')?_0x00b3('0x8'):_0xda6b82[_0x00b3('0x5')];this[_0x00b3('0x9')]=_0xda6b82[_0x00b3('0x9')];this[_0x00b3('0xa')]=_0xda6b82[_0x00b3('0xa')];this[_0x00b3('0xb')]=_0xda6b82['countnoanswerretry'];this['countglobal']=_0xda6b82[_0x00b3('0x9')]+_0xda6b82[_0x00b3('0xa')]+_0xda6b82[_0x00b3('0xb')]+_0xda6b82[_0x00b3('0xc')]+_0xda6b82[_0x00b3('0xd')]+_0xda6b82[_0x00b3('0xe')]+_0xda6b82[_0x00b3('0xf')]+_0xda6b82[_0x00b3('0x10')];this[_0x00b3('0xc')]=_0xda6b82[_0x00b3('0xc')];this['countdropretry']=_0xda6b82[_0x00b3('0xd')];this[_0x00b3('0xe')]=_0xda6b82[_0x00b3('0xe')];this[_0x00b3('0xf')]=_0xda6b82[_0x00b3('0xf')];this[_0x00b3('0x10')]=_0xda6b82[_0x00b3('0x10')];this[_0x00b3('0x11')]=_0x357ed1[_0x00b3('0x11')];this[_0x00b3('0x12')]=_0xda6b82['name'];this['calleridnum']=_0xda6b82[_0x00b3('0x13')];this[_0x00b3('0x14')]=_0xda6b82['starttime'];this[_0x00b3('0x15')]=_0xda6b82[_0x00b3('0x15')];this[_0x00b3('0x16')]=_0xda6b82[_0x00b3('0x16')];this[_0x00b3('0x17')]=this['droptime'];this['ringtime']=getSeconds(_0xda6b82['responsetime'],_0xda6b82['starttime']);this[_0x00b3('0x18')]=getSeconds(this['droptime'],_0xda6b82['responsetime']);this[_0x00b3('0x19')]=0x0;this[_0x00b3('0x8')]=_0x357ed1[_0x00b3('0x8')];this['membername']=_0x357ed1['connectedlinename'];this[_0x00b3('0x1a')]=_0x357ed1[_0x00b3('0x1a')];this[_0x00b3('0x1b')]=_0xda6b82['callback'];this[_0x00b3('0x1c')]=_0xda6b82[_0x00b3('0x1c')];this[_0x00b3('0x1d')]=_0xda6b82[_0x00b3('0x1d')];this[_0x00b3('0x1e')]=_0xda6b82['recallme'];this['ContactId']=_0xda6b82[_0x00b3('0x1f')];this[_0x00b3('0x20')]=_0xda6b82[_0x00b3('0x20')];this[_0x00b3('0x21')]=_0xda6b82[_0x00b3('0x21')];this[_0x00b3('0x22')]=_0xda6b82[_0x00b3('0x22')];this[_0x00b3('0x23')]=_0xda6b82['CampaignId'];this['originatecalleridnum']=_0xda6b82[_0x00b3('0x24')]||'';this[_0x00b3('0x25')]=_0xda6b82['originatecalleridname']||'';}module[_0x00b3('0x26')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 115b4d7..cbb2221 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 _0xf7c0=['lodash','moment','uniqueid','channel','format','%s/%s/%s','tech','Trunk','name','fax','headerinfo','path','AttachmentId','util'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0xf7c0,0x14f));var _0x0f7c=function(_0x70e33,_0x3602dc){_0x70e33=_0x70e33-0x0;var _0x3a8db=_0xf7c0[_0x70e33];return _0x3a8db;};'use strict';var util=require(_0x0f7c('0x0'));var _=require(_0x0f7c('0x1'));var moment=require(_0x0f7c('0x2'));function Action(_0x5bc132,_0x553d3d,_0x49238a){this[_0x0f7c('0x3')]=_0x5bc132||undefined;this[_0x0f7c('0x4')]=util[_0x0f7c('0x5')](_0x0f7c('0x6'),_0x553d3d[_0x0f7c('0x7')],_0x553d3d[_0x0f7c('0x8')][_0x0f7c('0x9')],_0x49238a[_0x0f7c('0xa')]);this['localstationid']=_0x553d3d['localstationid'];this[_0x0f7c('0xb')]=_0x553d3d['headerinfo'];this[_0x0f7c('0xc')]=_0x49238a[_0x0f7c('0xc')];this[_0x0f7c('0xd')]=_0x49238a[_0x0f7c('0xd')];}module['exports']=Action; \ No newline at end of file +var _0x17cf=['AttachmentId','util','lodash','moment','Trunk','name','fax','localstationid','headerinfo','path'];(function(_0x30584f,_0x4a1f96){var _0x2a31e1=function(_0x48af74){while(--_0x48af74){_0x30584f['push'](_0x30584f['shift']());}};_0x2a31e1(++_0x4a1f96);}(_0x17cf,0x155));var _0xf17c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x17cf[_0x21a9d9];return _0x46adce;};'use strict';var util=require(_0xf17c('0x0'));var _=require(_0xf17c('0x1'));var moment=require(_0xf17c('0x2'));function Action(_0x251a76,_0x10dba3,_0x5b2b4d){this['uniqueid']=_0x251a76||undefined;this['channel']=util['format']('%s/%s/%s',_0x10dba3['tech'],_0x10dba3[_0xf17c('0x3')][_0xf17c('0x4')],_0x5b2b4d[_0xf17c('0x5')]);this['localstationid']=_0x10dba3[_0xf17c('0x6')];this[_0xf17c('0x7')]=_0x10dba3[_0xf17c('0x7')];this[_0xf17c('0x8')]=_0x5b2b4d[_0xf17c('0x8')];this[_0xf17c('0x9')]=_0x5b2b4d[_0xf17c('0x9')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 0b630f3..9996c05 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 _0x65db=['hangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','then','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','merge','pick','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','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','path','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','exports','util','lodash','bluebird','uuid','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewExten','syncFaxStatus','receivefax'];(function(_0x23437,_0x5b1a34){var _0x4c05e2=function(_0x486451){while(--_0x486451){_0x23437['push'](_0x23437['shift']());}};_0x4c05e2(++_0x5b1a34);}(_0x65db,0x1bb));var _0xb65d=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x65db[_0x47a7d0];return _0xb9bd08;};'use strict';var util=require(_0xb65d('0x0'));var _=require(_0xb65d('0x1'));var BPromise=require(_0xb65d('0x2'));var uuid=require(_0xb65d('0x3'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0xb65d('0x4'));var gs=require(_0xb65d('0x5'));var logger=require('../../../config/logger')(_0xb65d('0x6'));var ami=require(_0xb65d('0x7'));var rpcDb=require(_0xb65d('0x8'));var Channel=require(_0xb65d('0x9'));var ut=require('./util/util');var Action=require(_0xb65d('0xa'));var faxAccount=require(_0xb65d('0xb'));var attachment=require(_0xb65d('0xc'));var faxMessage=require(_0xb65d('0xd'));function Fax(_0x547e24){this['channels']={};this[_0xb65d('0xe')]=_0x547e24[_0xb65d('0xe')];this[_0xb65d('0xf')]=_0x547e24[_0xb65d('0xf')];this[_0xb65d('0x10')]={};ami['on']('newchannel',this[_0xb65d('0x11')][_0xb65d('0x12')](this));ami['on'](_0xb65d('0x13'),this[_0xb65d('0x14')][_0xb65d('0x12')](this));ami['on'](_0xb65d('0x15'),this['syncNewState'][_0xb65d('0x12')](this));ami['on']('newexten',this[_0xb65d('0x16')][_0xb65d('0x12')](this));ami['on']('faxstatus',this[_0xb65d('0x17')][_0xb65d('0x12')](this));ami['on'](_0xb65d('0x18'),this['syncReceiveFax'][_0xb65d('0x12')](this));ami['on'](_0xb65d('0x19'),this['syncHangup'][_0xb65d('0x12')](this));ami['on'](_0xb65d('0x1a'),this[_0xb65d('0x1b')][_0xb65d('0x12')](this));}Fax[_0xb65d('0x1c')][_0xb65d('0x11')]=function(_0x44ffb4){if(_0x44ffb4[_0xb65d('0x1d')]==='from-voip-provider'){for(var _0x3da3a6 in this['faxAccounts']){if(this['faxAccounts'][_0xb65d('0x1e')](_0x3da3a6)){if(_0x44ffb4['exten']===this['faxAccounts'][_0x3da3a6][_0xb65d('0x1f')]){this[_0xb65d('0x20')][_0x44ffb4[_0xb65d('0x21')]]={};this[_0xb65d('0x20')][_0x44ffb4[_0xb65d('0x21')]][_0xb65d('0x22')]=_0x44ffb4['channel'];this[_0xb65d('0x20')][_0x44ffb4['uniqueid']]['id']=this['faxAccounts'][_0x3da3a6]['id'];this[_0xb65d('0x20')][_0x44ffb4[_0xb65d('0x21')]]['name']=this[_0xb65d('0xe')][_0x3da3a6][_0xb65d('0x23')];logger[_0xb65d('0x24')](_0x44ffb4[_0xb65d('0x21')],_0xb65d('0x25'));}}}}if(this[_0xb65d('0x10')][_0x44ffb4['uniqueid']]){this[_0xb65d('0x20')][_0x44ffb4[_0xb65d('0x21')]]={};this['channels'][_0x44ffb4[_0xb65d('0x21')]][_0xb65d('0x22')]=_0x44ffb4[_0xb65d('0x22')];logger[_0xb65d('0x24')](_0x44ffb4[_0xb65d('0x21')],_0xb65d('0x25'));}};Fax[_0xb65d('0x1c')][_0xb65d('0x14')]=function(_0x343835){if(this[_0xb65d('0x20')][_0x343835['uniqueid']]){for(var _0x20c791 in _0x343835[_0xb65d('0x26')]){if(_0x343835[_0xb65d('0x26')][_0xb65d('0x1e')](_0x20c791)){this[_0xb65d('0x20')][_0x343835[_0xb65d('0x21')]][_0x20c791]=_0x343835[_0xb65d('0x27')];}}}};Fax[_0xb65d('0x1c')][_0xb65d('0x28')]=function(_0x1386c1){if(this[_0xb65d('0x20')][_0x1386c1[_0xb65d('0x21')]]){this[_0xb65d('0x20')][_0x1386c1[_0xb65d('0x21')]][_0xb65d('0x29')]=_0x1386c1['channelstate'];this[_0xb65d('0x20')][_0x1386c1[_0xb65d('0x21')]][_0xb65d('0x2a')]=_0x1386c1[_0xb65d('0x2a')];}};Fax[_0xb65d('0x1c')]['syncNewExten']=function(_0x4366b1){if(this['channels'][_0x4366b1['uniqueid']]){for(var _0x4ba5b3 in _0x4366b1[_0xb65d('0x26')]){if(_0x4366b1[_0xb65d('0x26')][_0xb65d('0x1e')](_0x4ba5b3)){this[_0xb65d('0x20')][_0x4366b1[_0xb65d('0x21')]][_0x4ba5b3]=_0x4366b1[_0xb65d('0x27')];}}}};Fax[_0xb65d('0x1c')][_0xb65d('0x17')]=function(_0x46f2b2){if(this[_0xb65d('0x20')][_0x46f2b2[_0xb65d('0x21')]]){this['channels'][_0x46f2b2[_0xb65d('0x21')]][_0xb65d('0x2b')]=_0x46f2b2['operation'];this['channels'][_0x46f2b2['uniqueid']]['status']=_0x46f2b2[_0xb65d('0x2c')];this['channels'][_0x46f2b2[_0xb65d('0x21')]][_0xb65d('0x1f')]=_0x46f2b2[_0xb65d('0x1f')];this[_0xb65d('0x20')][_0x46f2b2['uniqueid']][_0xb65d('0x2d')]=_0x46f2b2[_0xb65d('0x2d')];logger[_0xb65d('0x24')](_0x46f2b2['uniqueid'],_0xb65d('0x2e'));}};Fax['prototype'][_0xb65d('0x2f')]=function(_0x54ef49){var _0x4c07d0=this;if(this[_0xb65d('0x20')][_0x54ef49[_0xb65d('0x21')]]){var _0x3c3a9d=this[_0xb65d('0x20')][_0x54ef49[_0xb65d('0x21')]]['id'];this[_0xb65d('0x20')][_0x54ef49[_0xb65d('0x21')]][_0xb65d('0x30')]=_0x54ef49[_0xb65d('0x30')];this[_0xb65d('0x20')][_0x54ef49[_0xb65d('0x21')]][_0xb65d('0x31')]=_0x54ef49[_0xb65d('0x31')];this[_0xb65d('0x20')][_0x54ef49[_0xb65d('0x21')]]['localstationid']=_0x54ef49[_0xb65d('0x1f')];this[_0xb65d('0x20')][_0x54ef49[_0xb65d('0x21')]][_0xb65d('0x32')]=_0x54ef49[_0xb65d('0x32')];this[_0xb65d('0x20')][_0x54ef49['uniqueid']]['transferrate']=_0x54ef49[_0xb65d('0x33')];this['channels'][_0x54ef49[_0xb65d('0x21')]][_0xb65d('0x2d')]=_0x54ef49[_0xb65d('0x2d')];this['channels'][_0x54ef49[_0xb65d('0x21')]][_0xb65d('0x34')]=_0x54ef49['calleridnum'];if(this['channels'][_0x54ef49[_0xb65d('0x21')]][_0xb65d('0x31')]>0x0){tiff2pdf(_0x54ef49['filename'],_0xb65d('0x35'),function(_0x54098d){logger[_0xb65d('0x24')](_0x54ef49['uniqueid'],_0xb65d('0x36'),_0x54098d[_0xb65d('0x37')]);attachment['create']({'name':path[_0xb65d('0x38')](_0x54ef49[_0xb65d('0x2d')])[_0xb65d('0x23')],'basename':path['parse'](_0x54ef49[_0xb65d('0x2d')])['name']+_0xb65d('0x39'),'type':'application/pdf'})[_0xb65d('0x3a')](function(_0x44134d){faxAccount[_0xb65d('0x3b')](_0x3c3a9d,{'from':_0x54ef49['calleridnum'],'mapKey':_0xb65d('0x6'),'body':path['parse'](_0x54ef49[_0xb65d('0x2d')])[_0xb65d('0x23')]+'.pdf','AttachmentId':_0x44134d['id']})[_0xb65d('0x3c')](function(_0x5957cc){logger[_0xb65d('0x3d')](_0x54ef49[_0xb65d('0x21')],_0xb65d('0x3e'),JSON['stringify'](_0x5957cc));});})['catch'](function(_0x346407){logger['error'](_0x54ef49[_0xb65d('0x21')],_0xb65d('0x3f'),JSON[_0xb65d('0x40')](_0x346407));});});}logger[_0xb65d('0x24')](_0x54ef49[_0xb65d('0x21')],_0xb65d('0x3f'));}};Fax[_0xb65d('0x1c')]['syncOriginateResponse']=function(_0x316f03){if(this[_0xb65d('0x10')][_0x316f03[_0xb65d('0x21')]]){_[_0xb65d('0x41')](this[_0xb65d('0x20')][_0x316f03[_0xb65d('0x21')]],_[_0xb65d('0x42')](_0x316f03,['response','reason']));}};function updateStatus(_0x4b6705){if(_0x4b6705[_0xb65d('0x43')]){faxMessage['update'](_0x4b6705[_0xb65d('0x43')],{'failMessage':_0xb65d('0x44')})['then'](function(_0x54676a){ut[_0xb65d('0x45')](_0xb65d('0x46'),_0x54676a);})[_0xb65d('0x3c')](function(_0x55e29d){ut['logger'](_0xb65d('0x47'),_0x55e29d);});}else{ut['logger'](_0xb65d('0x48'));}}Fax['prototype'][_0xb65d('0x49')]=function(_0x9462f0,_0x10e519,_0x1be854){var _0x43bd6a=this;var _0x2fa2af={};if(_0x10e519){_0x2fa2af={'read':_0x10e519};}else{_0x2fa2af={'failMessage':_0x1be854};}if(this[_0xb65d('0x10')][_0x9462f0][_0xb65d('0x43')]){faxMessage['update'](this['actions'][_0x9462f0][_0xb65d('0x43')],_0x2fa2af)['then'](function(_0x8c528e){ut['logger'](_0xb65d('0x4a'),_0x8c528e);})[_0xb65d('0x3c')](function(_0x149386){ut[_0xb65d('0x45')](_0xb65d('0x4b'),_0x149386);})[_0xb65d('0x4c')](function(){delete _0x43bd6a[_0xb65d('0x20')][_0x9462f0];delete _0x43bd6a[_0xb65d('0x10')][_0x9462f0];});}else{ut[_0xb65d('0x45')](_0xb65d('0x4d'));delete this['channels'][_0x9462f0];delete this[_0xb65d('0x10')][_0x9462f0];}};Fax[_0xb65d('0x1c')][_0xb65d('0x4e')]=function(_0x44845f){var _0x43b6ca=this;if(this['channels'][_0x44845f['uniqueid']]){if(this[_0xb65d('0x10')][_0x44845f['uniqueid']]){this[_0xb65d('0x20')][_0x44845f[_0xb65d('0x21')]]['id']=this[_0xb65d('0x10')][_0x44845f[_0xb65d('0x21')]]['id'];this[_0xb65d('0x20')][_0x44845f['uniqueid']]['name']=this['actions'][_0x44845f['uniqueid']][_0xb65d('0x23')];}logger[_0xb65d('0x24')](_0x44845f[_0xb65d('0x21')],this[_0xb65d('0x10')][_0x44845f[_0xb65d('0x21')]]?_0xb65d('0x4f'):_0xb65d('0x50'),JSON[_0xb65d('0x40')](this['channels'][_0x44845f[_0xb65d('0x21')]]));if(this[_0xb65d('0x10')][_0x44845f['uniqueid']]){if(this[_0xb65d('0x20')][_0x44845f[_0xb65d('0x21')]][_0xb65d('0x51')]>0x0&&this[_0xb65d('0x20')][_0x44845f['uniqueid']][_0xb65d('0x52')]===_0xb65d('0x53')){this[_0xb65d('0x49')](_0x44845f[_0xb65d('0x21')],!![]);}else{this[_0xb65d('0x49')](_0x44845f['uniqueid'],![],this[_0xb65d('0x20')][_0x44845f['uniqueid']][_0xb65d('0x54')]?_0xb65d('0x55')+this['channels'][_0x44845f[_0xb65d('0x21')]][_0xb65d('0x54')]:_0xb65d('0x56'));}}}};Fax[_0xb65d('0x1c')]['send']=function(_0x54a65a){var _0x193970=this;return new BPromise(function(_0x2ddbd3,_0x361903){_0x193970[_0xb65d('0x57')](_0x54a65a,_0x193970['faxAccounts'][_0x54a65a[_0xb65d('0x58')]])[_0xb65d('0x3a')](function(_0x31173c){ut[_0xb65d('0x45')](_0xb65d('0x59'),_0x31173c);_0x2ddbd3(ut[_0xb65d('0x37')](_0xb65d('0x5a')));})['catch'](function(_0x340a80){ut[_0xb65d('0x45')](_0xb65d('0x5b'),_0x340a80);updateStatus(_0x54a65a);_0x361903(ut['message']('Fax\x20failed'));});});};Fax['prototype']['checkAfterSend']=function(_0x5028f7){var _0x500ccb=this;return new BPromise(function(_0xb3b32b,_0x358ebc){var _0x2916ff=_0x500ccb[_0xb65d('0x5c')](_0x500ccb[_0xb65d('0xe')][_0x5028f7[_0xb65d('0x58')]][_0xb65d('0x5d')],_0x5028f7);if(_0x2916ff[_0xb65d('0x5e')]){_0xb3b32b(ut[_0xb65d('0x37')](_0xb65d('0x5f')));}else{_0x358ebc(ut[_0xb65d('0x37')](_0x2916ff[_0xb65d('0x37')]));}});};function originate(_0x1661b2,_0x12259a,_0x4e4014){return new BPromise(function(_0x115ffc,_0x1ebc70){if(_0x4e4014){var _0x5ef0d1=util[_0xb65d('0x60')](_0xb65d('0x61'),path['parse'](_0x1661b2[_0xb65d('0x62')])[_0xb65d('0x23')],_0x1661b2[_0xb65d('0x62')]);gs[_0xb65d('0x63')](_0x5ef0d1)[_0xb65d('0x3a')](function(){_0x1661b2[_0xb65d('0x62')]=util[_0xb65d('0x60')]('%s/%s.tif',path[_0xb65d('0x38')](_0x1661b2['path'])[_0xb65d('0x64')],path['parse'](_0x1661b2[_0xb65d('0x62')])['name']);_0x12259a[_0xb65d('0x65')]=_0x1661b2[_0xb65d('0x62')];ut[_0xb65d('0x45')](_0xb65d('0x66'),'');ami[_0xb65d('0x67')](ut['variablesAction'](_0x1661b2,_0x12259a))[_0xb65d('0x3a')](function(_0x525632){_0x115ffc(_0x525632);})[_0xb65d('0x3c')](function(_0x4ebed7){_0x1ebc70(_0x4ebed7);});})['catch'](function(_0x279499){_0x1ebc70(_0x279499);});}else{ami['Action'](ut[_0xb65d('0x68')](_0x1661b2,_0x12259a))[_0xb65d('0x3a')](function(_0x88ae69){_0x115ffc(_0x88ae69);})[_0xb65d('0x3c')](function(_0x27c1d9){_0x1ebc70(_0x27c1d9);});}});}Fax['prototype']['execOriginate']=function(_0x1ec04a,_0x4caaec){var _0x567493=this;return new BPromise(function(_0x11d4a3,_0x1a8a12){var _0x2c5786=uuid['v4']();var _0x33af8a=ut[_0xb65d('0x69')](_0x1ec04a,_0x4caaec);_0x567493['actions'][_0x2c5786]=new Action(_0x2c5786,_0x4caaec,_0x1ec04a);var _0x8d2808=_0x567493[_0xb65d('0x10')][_0x2c5786];if(path[_0xb65d('0x38')](_0x1ec04a['path'])[_0xb65d('0x6a')]===_0xb65d('0x39')){originate(_0x8d2808,_0x33af8a,!![])['then'](function(_0x40c833){_0x11d4a3(_0x40c833);})[_0xb65d('0x3c')](function(_0xe53a35){_0x1a8a12(_0xe53a35);});}else{originate(_0x8d2808,_0x33af8a,![])[_0xb65d('0x3a')](function(_0x3c8c03){_0x11d4a3(_0x3c8c03);})[_0xb65d('0x3c')](function(_0x76862f){_0x1a8a12(_0x76862f);});}});};Fax[_0xb65d('0x1c')][_0xb65d('0x6b')]=function(_0x59a316){return!_[_0xb65d('0x6c')](_0x59a316)&&!_[_0xb65d('0x6c')](_0x59a316[_0xb65d('0x23')])&&!_['isNil'](_0x59a316['active'])&&_0x59a316['active']&&!_[_0xb65d('0x6c')](this[_0xb65d('0xf')][util[_0xb65d('0x60')](_0xb65d('0x6d'),_0x59a316[_0xb65d('0x23')])])&&!_['isNil'](this[_0xb65d('0xf')][util[_0xb65d('0x60')]('SIP/%s',_0x59a316[_0xb65d('0x23')])]['status'])&&(this[_0xb65d('0xf')][util['format']('SIP/%s',_0x59a316[_0xb65d('0x23')])]['status']===_0xb65d('0x6e')||this['trunks'][util[_0xb65d('0x60')]('SIP/%s',_0x59a316[_0xb65d('0x23')])][_0xb65d('0x2c')]==='unmonitored');};Fax[_0xb65d('0x1c')][_0xb65d('0x5c')]=function(_0x1253a2,_0x442eba){if(!this[_0xb65d('0x6b')](_0x1253a2)){ut[_0xb65d('0x45')](_0xb65d('0x6f'),_[_0xb65d('0x6c')](_0x1253a2)?'':_0x1253a2[_0xb65d('0x23')]+_0xb65d('0x70'));return{'isValid':![],'message':_0xb65d('0x71')};}if(_[_0xb65d('0x6c')](_0x442eba['fax'])){ut[_0xb65d('0x45')](_0xb65d('0x72'),JSON['stringify'](_0x442eba));return{'isValid':![],'message':_0xb65d('0x73')};}if(_[_0xb65d('0x6c')](_0x442eba[_0xb65d('0x62')])){ut[_0xb65d('0x45')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xb65d('0x40')](_0x442eba));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xb65d('0x74')]=Fax; \ No newline at end of file +var _0x7e48=['filename','info','syncReceiveFax','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','merge','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','util','bluebird','moment','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','actions','newchannel','syncVarSet','bind','newstate','syncNewState','newexten','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','syncNewchannel','context','from-voip-provider','hasOwnProperty','localstationid','channels','channel','uniqueid','name','\x20syncNewchannel\x20','prototype','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status'];(function(_0x48d24a,_0x5b3842){var _0x35868f=function(_0x52be39){while(--_0x52be39){_0x48d24a['push'](_0x48d24a['shift']());}};_0x35868f(++_0x5b3842);}(_0x7e48,0xba));var _0x87e4=function(_0x46454e,_0x164847){_0x46454e=_0x46454e-0x0;var _0x2e1076=_0x7e48[_0x46454e];return _0x2e1076;};'use strict';var util=require(_0x87e4('0x0'));var _=require('lodash');var BPromise=require(_0x87e4('0x1'));var uuid=require('uuid');var moment=require(_0x87e4('0x2'));var path=require('path');var tiff2pdf=require(_0x87e4('0x3'));var gs=require(_0x87e4('0x4'));var logger=require('../../../config/logger')(_0x87e4('0x5'));var ami=require(_0x87e4('0x6'));var rpcDb=require(_0x87e4('0x7'));var Channel=require(_0x87e4('0x8'));var ut=require(_0x87e4('0x9'));var Action=require(_0x87e4('0xa'));var faxAccount=require(_0x87e4('0xb'));var attachment=require(_0x87e4('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x137870){this['channels']={};this[_0x87e4('0xd')]=_0x137870[_0x87e4('0xd')];this[_0x87e4('0xe')]=_0x137870[_0x87e4('0xe')];this[_0x87e4('0xf')]={};ami['on'](_0x87e4('0x10'),this['syncNewchannel']['bind'](this));ami['on']('varset',this[_0x87e4('0x11')][_0x87e4('0x12')](this));ami['on'](_0x87e4('0x13'),this[_0x87e4('0x14')][_0x87e4('0x12')](this));ami['on'](_0x87e4('0x15'),this['syncNewExten'][_0x87e4('0x12')](this));ami['on']('faxstatus',this[_0x87e4('0x16')]['bind'](this));ami['on'](_0x87e4('0x17'),this['syncReceiveFax'][_0x87e4('0x12')](this));ami['on'](_0x87e4('0x18'),this[_0x87e4('0x19')][_0x87e4('0x12')](this));ami['on'](_0x87e4('0x1a'),this[_0x87e4('0x1b')][_0x87e4('0x12')](this));}Fax['prototype'][_0x87e4('0x1c')]=function(_0x2fbe45){if(_0x2fbe45[_0x87e4('0x1d')]===_0x87e4('0x1e')){for(var _0x3e6d27 in this['faxAccounts']){if(this[_0x87e4('0xd')][_0x87e4('0x1f')](_0x3e6d27)){if(_0x2fbe45['exten']===this[_0x87e4('0xd')][_0x3e6d27][_0x87e4('0x20')]){this['channels'][_0x2fbe45['uniqueid']]={};this[_0x87e4('0x21')][_0x2fbe45['uniqueid']]['channel']=_0x2fbe45[_0x87e4('0x22')];this[_0x87e4('0x21')][_0x2fbe45[_0x87e4('0x23')]]['id']=this[_0x87e4('0xd')][_0x3e6d27]['id'];this[_0x87e4('0x21')][_0x2fbe45[_0x87e4('0x23')]][_0x87e4('0x24')]=this[_0x87e4('0xd')][_0x3e6d27][_0x87e4('0x24')];logger['info'](_0x2fbe45[_0x87e4('0x23')],_0x87e4('0x25'));}}}}if(this[_0x87e4('0xf')][_0x2fbe45[_0x87e4('0x23')]]){this['channels'][_0x2fbe45[_0x87e4('0x23')]]={};this[_0x87e4('0x21')][_0x2fbe45[_0x87e4('0x23')]][_0x87e4('0x22')]=_0x2fbe45[_0x87e4('0x22')];logger['info'](_0x2fbe45[_0x87e4('0x23')],_0x87e4('0x25'));}};Fax[_0x87e4('0x26')][_0x87e4('0x11')]=function(_0x3ba65a){if(this[_0x87e4('0x21')][_0x3ba65a[_0x87e4('0x23')]]){for(var _0x3ce074 in _0x3ba65a[_0x87e4('0x27')]){if(_0x3ba65a[_0x87e4('0x27')][_0x87e4('0x1f')](_0x3ce074)){this[_0x87e4('0x21')][_0x3ba65a[_0x87e4('0x23')]][_0x3ce074]=_0x3ba65a[_0x87e4('0x28')];}}}};Fax['prototype'][_0x87e4('0x14')]=function(_0xd285ef){if(this['channels'][_0xd285ef[_0x87e4('0x23')]]){this[_0x87e4('0x21')][_0xd285ef[_0x87e4('0x23')]][_0x87e4('0x29')]=_0xd285ef[_0x87e4('0x29')];this['channels'][_0xd285ef['uniqueid']][_0x87e4('0x2a')]=_0xd285ef['channelstatedesc'];}};Fax['prototype'][_0x87e4('0x2b')]=function(_0x36af1f){if(this[_0x87e4('0x21')][_0x36af1f[_0x87e4('0x23')]]){for(var _0x975ffc in _0x36af1f[_0x87e4('0x27')]){if(_0x36af1f[_0x87e4('0x27')]['hasOwnProperty'](_0x975ffc)){this[_0x87e4('0x21')][_0x36af1f[_0x87e4('0x23')]][_0x975ffc]=_0x36af1f[_0x87e4('0x28')];}}}};Fax[_0x87e4('0x26')][_0x87e4('0x16')]=function(_0x5cf53b){if(this[_0x87e4('0x21')][_0x5cf53b['uniqueid']]){this['channels'][_0x5cf53b['uniqueid']][_0x87e4('0x2c')]=_0x5cf53b[_0x87e4('0x2c')];this[_0x87e4('0x21')][_0x5cf53b[_0x87e4('0x23')]][_0x87e4('0x2d')]=_0x5cf53b[_0x87e4('0x2d')];this['channels'][_0x5cf53b[_0x87e4('0x23')]][_0x87e4('0x20')]=_0x5cf53b[_0x87e4('0x20')];this[_0x87e4('0x21')][_0x5cf53b['uniqueid']][_0x87e4('0x2e')]=_0x5cf53b[_0x87e4('0x2e')];logger[_0x87e4('0x2f')](_0x5cf53b[_0x87e4('0x23')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x87e4('0x30')]=function(_0x190a83){var _0x27e0a7=this;if(this['channels'][_0x190a83[_0x87e4('0x23')]]){var _0x327ef1=this['channels'][_0x190a83['uniqueid']]['id'];this[_0x87e4('0x21')][_0x190a83[_0x87e4('0x23')]][_0x87e4('0x31')]=_0x190a83[_0x87e4('0x31')];this[_0x87e4('0x21')][_0x190a83['uniqueid']]['pagestransferred']=_0x190a83[_0x87e4('0x32')];this[_0x87e4('0x21')][_0x190a83[_0x87e4('0x23')]]['localstationid']=_0x190a83['localstationid'];this[_0x87e4('0x21')][_0x190a83['uniqueid']]['resolution']=_0x190a83['resolution'];this[_0x87e4('0x21')][_0x190a83['uniqueid']]['transferrate']=_0x190a83[_0x87e4('0x33')];this[_0x87e4('0x21')][_0x190a83[_0x87e4('0x23')]][_0x87e4('0x2e')]=_0x190a83[_0x87e4('0x2e')];this['channels'][_0x190a83[_0x87e4('0x23')]][_0x87e4('0x34')]=_0x190a83['calleridnum'];if(this[_0x87e4('0x21')][_0x190a83['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x190a83[_0x87e4('0x2e')],_0x87e4('0x35'),function(_0x5b84a9){logger['info'](_0x190a83[_0x87e4('0x23')],'\x20result\x20conversion\x20file\x20',_0x5b84a9[_0x87e4('0x36')]);attachment[_0x87e4('0x37')]({'name':path[_0x87e4('0x38')](_0x190a83[_0x87e4('0x2e')])[_0x87e4('0x24')],'basename':path['parse'](_0x190a83[_0x87e4('0x2e')])[_0x87e4('0x24')]+_0x87e4('0x39'),'type':_0x87e4('0x3a')})[_0x87e4('0x3b')](function(_0x322c49){faxAccount[_0x87e4('0x3c')](_0x327ef1,{'from':_0x190a83[_0x87e4('0x34')],'mapKey':_0x87e4('0x5'),'body':path[_0x87e4('0x38')](_0x190a83[_0x87e4('0x2e')])[_0x87e4('0x24')]+_0x87e4('0x39'),'AttachmentId':_0x322c49['id']})[_0x87e4('0x3d')](function(_0x298afc){logger[_0x87e4('0x3e')](_0x190a83[_0x87e4('0x23')],_0x87e4('0x3f'),JSON[_0x87e4('0x40')](_0x298afc));});})[_0x87e4('0x3d')](function(_0x522d85){logger[_0x87e4('0x3e')](_0x190a83[_0x87e4('0x23')],'\x20receiveFax\x20',JSON[_0x87e4('0x40')](_0x522d85));});});}logger[_0x87e4('0x2f')](_0x190a83[_0x87e4('0x23')],'\x20receiveFax\x20');}};Fax['prototype'][_0x87e4('0x1b')]=function(_0x2867f5){if(this[_0x87e4('0xf')][_0x2867f5['uniqueid']]){_[_0x87e4('0x41')](this[_0x87e4('0x21')][_0x2867f5[_0x87e4('0x23')]],_['pick'](_0x2867f5,[_0x87e4('0x42'),_0x87e4('0x43')]));}};function updateStatus(_0x2b73ad){if(_0x2b73ad[_0x87e4('0x44')]){faxMessage[_0x87e4('0x45')](_0x2b73ad[_0x87e4('0x44')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x87e4('0x3b')](function(_0x3e30c9){ut[_0x87e4('0x46')](_0x87e4('0x47'),_0x3e30c9);})[_0x87e4('0x3d')](function(_0x21881c){ut[_0x87e4('0x46')](_0x87e4('0x48'),_0x21881c);});}else{ut[_0x87e4('0x46')](_0x87e4('0x49'));}}Fax[_0x87e4('0x26')][_0x87e4('0x4a')]=function(_0x5ee2e6,_0x5e4f4c,_0x517081){var _0x1764b7=this;var _0x2f80bb={};if(_0x5e4f4c){_0x2f80bb={'read':_0x5e4f4c};}else{_0x2f80bb={'failMessage':_0x517081};}if(this[_0x87e4('0xf')][_0x5ee2e6][_0x87e4('0x44')]){faxMessage['update'](this[_0x87e4('0xf')][_0x5ee2e6][_0x87e4('0x44')],_0x2f80bb)[_0x87e4('0x3b')](function(_0xc61358){ut['logger'](_0x87e4('0x4b'),_0xc61358);})[_0x87e4('0x3d')](function(_0x282ddc){ut['logger'](_0x87e4('0x4c'),_0x282ddc);})[_0x87e4('0x4d')](function(){delete _0x1764b7[_0x87e4('0x21')][_0x5ee2e6];delete _0x1764b7[_0x87e4('0xf')][_0x5ee2e6];});}else{ut[_0x87e4('0x46')](_0x87e4('0x4e'));delete this[_0x87e4('0x21')][_0x5ee2e6];delete this[_0x87e4('0xf')][_0x5ee2e6];}};Fax[_0x87e4('0x26')][_0x87e4('0x19')]=function(_0x758650){var _0x43e060=this;if(this[_0x87e4('0x21')][_0x758650['uniqueid']]){if(this[_0x87e4('0xf')][_0x758650['uniqueid']]){this[_0x87e4('0x21')][_0x758650[_0x87e4('0x23')]]['id']=this[_0x87e4('0xf')][_0x758650[_0x87e4('0x23')]]['id'];this[_0x87e4('0x21')][_0x758650['uniqueid']]['name']=this['actions'][_0x758650['uniqueid']]['name'];}logger[_0x87e4('0x2f')](_0x758650[_0x87e4('0x23')],this['actions'][_0x758650[_0x87e4('0x23')]]?_0x87e4('0x4f'):'\x20hangup\x20faxRiceive\x20',JSON[_0x87e4('0x40')](this[_0x87e4('0x21')][_0x758650[_0x87e4('0x23')]]));if(this['actions'][_0x758650[_0x87e4('0x23')]]){if(this[_0x87e4('0x21')][_0x758650[_0x87e4('0x23')]][_0x87e4('0x50')]>0x0&&this[_0x87e4('0x21')][_0x758650[_0x87e4('0x23')]]['faxstatus']===_0x87e4('0x51')){this[_0x87e4('0x4a')](_0x758650[_0x87e4('0x23')],!![]);}else{this[_0x87e4('0x4a')](_0x758650['uniqueid'],![],this[_0x87e4('0x21')][_0x758650[_0x87e4('0x23')]][_0x87e4('0x52')]?_0x87e4('0x53')+this[_0x87e4('0x21')][_0x758650[_0x87e4('0x23')]][_0x87e4('0x52')]:_0x87e4('0x54'));}}}};Fax['prototype'][_0x87e4('0x55')]=function(_0x1017b7){var _0x50ab26=this;return new BPromise(function(_0x46d091,_0x12508d){_0x50ab26[_0x87e4('0x56')](_0x1017b7,_0x50ab26[_0x87e4('0xd')][_0x1017b7[_0x87e4('0x57')]])[_0x87e4('0x3b')](function(_0x508415){ut[_0x87e4('0x46')](_0x87e4('0x58'),_0x508415);_0x46d091(ut[_0x87e4('0x36')](_0x87e4('0x59')));})[_0x87e4('0x3d')](function(_0x569ab6){ut[_0x87e4('0x46')](_0x87e4('0x5a'),_0x569ab6);updateStatus(_0x1017b7);_0x12508d(ut[_0x87e4('0x36')]('Fax\x20failed'));});});};Fax[_0x87e4('0x26')]['checkAfterSend']=function(_0x54da5c){var _0x30f75a=this;return new BPromise(function(_0x58098e,_0x1e7ef2){var _0x1a153b=_0x30f75a[_0x87e4('0x5b')](_0x30f75a[_0x87e4('0xd')][_0x54da5c['FaxAccountId']]['Trunk'],_0x54da5c);if(_0x1a153b[_0x87e4('0x5c')]){_0x58098e(ut[_0x87e4('0x36')](_0x87e4('0x5d')));}else{_0x1e7ef2(ut['message'](_0x1a153b['message']));}});};function originate(_0x4aeaa5,_0x1b1d91,_0x581f79){return new BPromise(function(_0x353ea4,_0x3f5a46){if(_0x581f79){var _0x15273f=util[_0x87e4('0x5e')](_0x87e4('0x5f'),path['parse'](_0x4aeaa5[_0x87e4('0x60')])['name'],_0x4aeaa5[_0x87e4('0x60')]);gs[_0x87e4('0x61')](_0x15273f)[_0x87e4('0x3b')](function(){_0x4aeaa5[_0x87e4('0x60')]=util[_0x87e4('0x5e')](_0x87e4('0x62'),path[_0x87e4('0x38')](_0x4aeaa5['path'])[_0x87e4('0x63')],path['parse'](_0x4aeaa5[_0x87e4('0x60')])[_0x87e4('0x24')]);_0x1b1d91[_0x87e4('0x64')]=_0x4aeaa5['path'];ut[_0x87e4('0x46')](_0x87e4('0x65'),'');ami['Action'](ut['variablesAction'](_0x4aeaa5,_0x1b1d91))[_0x87e4('0x3b')](function(_0x1b4135){_0x353ea4(_0x1b4135);})['catch'](function(_0xd1c547){_0x3f5a46(_0xd1c547);});})['catch'](function(_0x108236){_0x3f5a46(_0x108236);});}else{ami[_0x87e4('0x66')](ut[_0x87e4('0x67')](_0x4aeaa5,_0x1b1d91))[_0x87e4('0x3b')](function(_0xe8fd32){_0x353ea4(_0xe8fd32);})[_0x87e4('0x3d')](function(_0x14e38d){_0x3f5a46(_0x14e38d);});}});}Fax[_0x87e4('0x26')][_0x87e4('0x56')]=function(_0x4b689f,_0x3c9ca8){var _0xe226af=this;return new BPromise(function(_0x5385f0,_0x2dc7df){var _0x2780b2=uuid['v4']();var _0x24abc2=ut[_0x87e4('0x68')](_0x4b689f,_0x3c9ca8);_0xe226af[_0x87e4('0xf')][_0x2780b2]=new Action(_0x2780b2,_0x3c9ca8,_0x4b689f);var _0x2425f8=_0xe226af['actions'][_0x2780b2];if(path[_0x87e4('0x38')](_0x4b689f[_0x87e4('0x60')])[_0x87e4('0x69')]===_0x87e4('0x39')){originate(_0x2425f8,_0x24abc2,!![])[_0x87e4('0x3b')](function(_0x4ecb3e){_0x5385f0(_0x4ecb3e);})['catch'](function(_0xa6ab5e){_0x2dc7df(_0xa6ab5e);});}else{originate(_0x2425f8,_0x24abc2,![])[_0x87e4('0x3b')](function(_0x16b8c1){_0x5385f0(_0x16b8c1);})[_0x87e4('0x3d')](function(_0xe25e96){_0x2dc7df(_0xe25e96);});}});};Fax['prototype'][_0x87e4('0x6a')]=function(_0x523200){return!_[_0x87e4('0x6b')](_0x523200)&&!_[_0x87e4('0x6b')](_0x523200[_0x87e4('0x24')])&&!_[_0x87e4('0x6b')](_0x523200[_0x87e4('0x6c')])&&_0x523200['active']&&!_['isNil'](this[_0x87e4('0xe')][util[_0x87e4('0x5e')]('SIP/%s',_0x523200[_0x87e4('0x24')])])&&!_['isNil'](this['trunks'][util['format'](_0x87e4('0x6d'),_0x523200['name'])][_0x87e4('0x2d')])&&(this[_0x87e4('0xe')][util[_0x87e4('0x5e')]('SIP/%s',_0x523200[_0x87e4('0x24')])][_0x87e4('0x2d')]==='reachable'||this[_0x87e4('0xe')][util[_0x87e4('0x5e')]('SIP/%s',_0x523200[_0x87e4('0x24')])][_0x87e4('0x2d')]===_0x87e4('0x6e'));};Fax[_0x87e4('0x26')][_0x87e4('0x5b')]=function(_0x2a927a,_0x3ce7c4){if(!this[_0x87e4('0x6a')](_0x2a927a)){ut['logger'](_0x87e4('0x6f'),_['isNil'](_0x2a927a)?'':_0x2a927a[_0x87e4('0x24')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_['isNil'](_0x3ce7c4[_0x87e4('0x5')])){ut[_0x87e4('0x46')](_0x87e4('0x70'),JSON[_0x87e4('0x40')](_0x3ce7c4));return{'isValid':![],'message':_0x87e4('0x71')};}if(_[_0x87e4('0x6b')](_0x3ce7c4[_0x87e4('0x60')])){ut[_0x87e4('0x46')](_0x87e4('0x72'),JSON['stringify'](_0x3ce7c4));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x87e4('0x73')};};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 bfdcfec..8d218d7 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 _0x7c8a=['util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','then','catch','[Notify]\x20'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7c8a,0xe4));var _0xa7c8=function(_0x111d80,_0x562e04){_0x111d80=_0x111d80-0x0;var _0x215e86=_0x7c8a[_0x111d80];return _0x215e86;};'use strict';var util=require(_0xa7c8('0x0'));var BPromise=require(_0xa7c8('0x1'));var logger=require(_0xa7c8('0x2'))(_0xa7c8('0x3'));var _=require(_0xa7c8('0x4'));var faxAccount=require(_0xa7c8('0x5'));function loggerCatch(_0x58558c){return function(_0x510573){logger[_0xa7c8('0x6')](_0x58558c,util[_0xa7c8('0x7')](_0x510573,{'showHidden':![],'depth':null}));};}exports[_0xa7c8('0x8')]=function(_0x1a771a,_0x83fd4c){return BPromise['resolve']()[_0xa7c8('0x9')](faxAccount[_0xa7c8('0x8')](_0x1a771a,_0x83fd4c))[_0xa7c8('0xa')](loggerCatch(_0xa7c8('0xb')));}; \ No newline at end of file +var _0x42ad=['preview','lodash','../rpc/faxAccount','error','notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x320730,_0x21fff6){var _0x417eb5=function(_0x2bc4dd){while(--_0x2bc4dd){_0x320730['push'](_0x320730['shift']());}};_0x417eb5(++_0x21fff6);}(_0x42ad,0x129));var _0xd42a=function(_0x5f09d3,_0x26677c){_0x5f09d3=_0x5f09d3-0x0;var _0xd95e4d=_0x42ad[_0x5f09d3];return _0xd95e4d;};'use strict';var util=require(_0xd42a('0x0'));var BPromise=require(_0xd42a('0x1'));var logger=require(_0xd42a('0x2'))(_0xd42a('0x3'));var _=require(_0xd42a('0x4'));var faxAccount=require(_0xd42a('0x5'));function loggerCatch(_0x478ceb){return function(_0x47398c){logger[_0xd42a('0x6')](_0x478ceb,util['inspect'](_0x47398c,{'showHidden':![],'depth':null}));};}exports[_0xd42a('0x7')]=function(_0xacdfe0,_0x6cc296){return BPromise[_0xd42a('0x8')]()[_0xd42a('0x9')](faxAccount[_0xd42a('0x7')](_0xacdfe0,_0x6cc296))[_0xd42a('0xa')](loggerCatch(_0xd42a('0xb')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 9f17ace..3bf8e6b 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 _0xcf17=['\x20Error\x20:','inspect','util','../../../../config/logger','bluebird','child_process','exec','execute','info','Exec\x20gs'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xcf17,0xd4));var _0x7cf1=function(_0xe990,_0x4d86cd){_0xe990=_0xe990-0x0;var _0x5becac=_0xcf17[_0xe990];return _0x5becac;};'use strict';var util=require(_0x7cf1('0x0'));var logger=require(_0x7cf1('0x1'))('fax');var BPromise=require(_0x7cf1('0x2'));var exec=require(_0x7cf1('0x3'))[_0x7cf1('0x4')];exports[_0x7cf1('0x5')]=function(_0x2e1b6f){return new BPromise(function(_0x3b1970,_0x21e6af){exec(_0x2e1b6f,function(_0x3b2a79,_0x28c322,_0x2f0720){logger[_0x7cf1('0x6')](_0x7cf1('0x7'),_0x28c322);if(_0x3b2a79){logger['info']('Exec\x20gs',_0x7cf1('0x8'),util[_0x7cf1('0x9')](_0x3b2a79,{'showHidden':![],'depth':null}),_0x28c322,_0x2f0720);_0x21e6af(_0x3b2a79);}_0x3b1970(_0x28c322);});});}; \ No newline at end of file +var _0xb827=['info','Exec\x20gs','inspect','../../../../config/logger','bluebird','child_process'];(function(_0x2438da,_0x3f6272){var _0x29f14e=function(_0xc9bb69){while(--_0xc9bb69){_0x2438da['push'](_0x2438da['shift']());}};_0x29f14e(++_0x3f6272);}(_0xb827,0x14d));var _0x7b82=function(_0x56c2dd,_0x3caf73){_0x56c2dd=_0x56c2dd-0x0;var _0x407447=_0xb827[_0x56c2dd];return _0x407447;};'use strict';var util=require('util');var logger=require(_0x7b82('0x0'))('fax');var BPromise=require(_0x7b82('0x1'));var exec=require(_0x7b82('0x2'))['exec'];exports['execute']=function(_0x2d4800){return new BPromise(function(_0x5183e2,_0x105220){exec(_0x2d4800,function(_0x2a8bc3,_0x6b2687,_0x4eadcb){logger[_0x7b82('0x3')](_0x7b82('0x4'),_0x6b2687);if(_0x2a8bc3){logger[_0x7b82('0x3')](_0x7b82('0x4'),'\x20Error\x20:',util[_0x7b82('0x5')](_0x2a8bc3,{'showHidden':![],'depth':null}),_0x6b2687,_0x4eadcb);_0x105220(_0x2a8bc3);}_0x5183e2(_0x6b2687);});});}; \ 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 9721e17..5d0f86e 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 _0xa902=['gateway','t38timeout','localstationid','path','variablesAction','originate','xcally-motion-fax','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger','fax','info','inspect','addVariables','ecm','maxrate','format','\x22%s\x22','modem'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xa902,0x8d));var _0x2a90=function(_0x562cf9,_0x29d662){_0x562cf9=_0x562cf9-0x0;var _0x16c1cb=_0xa902[_0x562cf9];return _0x16c1cb;};'use strict';var util=require(_0x2a90('0x0'));var _=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var logger=require(_0x2a90('0x3'))(_0x2a90('0x4'));exports['message']=function(_0x2da982){return{'message':_0x2da982};};exports['logger']=function(_0x4961c2,_0x169808){logger[_0x2a90('0x5')](_0x4961c2,util[_0x2a90('0x6')](_0x169808,{'showHidden':![],'depth':null}));};exports[_0x2a90('0x7')]=function(_0x4a32c7,_0x25bcfc){var _0x58369a={'XMF-ECM':_0x25bcfc[_0x2a90('0x8')],'XMF-HEADERINFO':_0x25bcfc['headerinfo'],'XMF-MINRATE':_0x25bcfc['minrate'],'XMF-MAXRATE':_0x25bcfc[_0x2a90('0x9')],'XMF-MODEM':util[_0x2a90('0xa')](_0x2a90('0xb'),_0x25bcfc[_0x2a90('0xc')]),'XMF-GATEWAY':_0x25bcfc[_0x2a90('0xd')],'XMF-FAXDETECT':_0x25bcfc['faxdetect'],'XMF-T38TIMEOUT':_0x25bcfc[_0x2a90('0xe')],'XMF-LOCALSTATIONID':_0x25bcfc[_0x2a90('0xf')],'XMF-PATH':_0x4a32c7[_0x2a90('0x10')]};return _0x58369a;};exports[_0x2a90('0x11')]=function(_0x541e22,_0x40e6aa){return{'actionid':_0x541e22['uniqueid'],'action':_0x2a90('0x12'),'channel':_0x541e22['channel'],'Exten':_0x2a90('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0x2a90('0xa')](_0x2a90('0x14'),_0x541e22[_0x2a90('0x15')]?_0x541e22['headerinfo']:'',_0x541e22['localstationid']),'variable':_0x40e6aa,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x541e22['uniqueid']};}; \ No newline at end of file +var _0x6f7a=['inspect','addVariables','minrate','maxrate','format','\x22%s\x22','modem','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger','message','logger','info'];(function(_0x117821,_0xaa1933){var _0x4ae9ff=function(_0x253662){while(--_0x253662){_0x117821['push'](_0x117821['shift']());}};_0x4ae9ff(++_0xaa1933);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x2437d4,_0x410a3e){_0x2437d4=_0x2437d4-0x0;var _0x48bfd1=_0x6f7a[_0x2437d4];return _0x48bfd1;};'use strict';var util=require(_0xa6f7('0x0'));var _=require(_0xa6f7('0x1'));var moment=require(_0xa6f7('0x2'));var logger=require(_0xa6f7('0x3'))('fax');exports[_0xa6f7('0x4')]=function(_0x407de3){return{'message':_0x407de3};};exports[_0xa6f7('0x5')]=function(_0x1da6dc,_0x22e529){logger[_0xa6f7('0x6')](_0x1da6dc,util[_0xa6f7('0x7')](_0x22e529,{'showHidden':![],'depth':null}));};exports[_0xa6f7('0x8')]=function(_0x1fdd5f,_0x335aaa){var _0x1a06d1={'XMF-ECM':_0x335aaa['ecm'],'XMF-HEADERINFO':_0x335aaa['headerinfo'],'XMF-MINRATE':_0x335aaa[_0xa6f7('0x9')],'XMF-MAXRATE':_0x335aaa[_0xa6f7('0xa')],'XMF-MODEM':util[_0xa6f7('0xb')](_0xa6f7('0xc'),_0x335aaa[_0xa6f7('0xd')]),'XMF-GATEWAY':_0x335aaa['gateway'],'XMF-FAXDETECT':_0x335aaa['faxdetect'],'XMF-T38TIMEOUT':_0x335aaa[_0xa6f7('0xe')],'XMF-LOCALSTATIONID':_0x335aaa[_0xa6f7('0xf')],'XMF-PATH':_0x1fdd5f['path']};return _0x1a06d1;};exports[_0xa6f7('0x10')]=function(_0x5623bf,_0x315096){return{'actionid':_0x5623bf[_0xa6f7('0x11')],'action':_0xa6f7('0x12'),'channel':_0x5623bf[_0xa6f7('0x13')],'Exten':'xcally-motion-fax','Context':_0xa6f7('0x14'),'Priority':'1','callerid':util['format'](_0xa6f7('0x15'),_0x5623bf[_0xa6f7('0x16')]?_0x5623bf[_0xa6f7('0x16')]:'',_0x5623bf['localstationid']),'variable':_0x315096,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5623bf[_0xa6f7('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index fdb6208..e260eb9 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 _0x7916=['initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','log','bluebird','moment','./server','./report','./acw','./trigger','./dialer','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/template','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getVoiceQueues','initVoiceQueues','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initVtigerAccounts'];(function(_0x284885,_0x34b143){var _0x3a9710=function(_0x31eda3){while(--_0x31eda3){_0x284885['push'](_0x284885['shift']());}};_0x3a9710(++_0x34b143);}(_0x7916,0x128));var _0x6791=function(_0x507c9c,_0x533015){_0x507c9c=_0x507c9c-0x0;var _0x372f0c=_0x7916[_0x507c9c];return _0x372f0c;};'use strict';var BPromise=require(_0x6791('0x0'));var util=require('util');var moment=require(_0x6791('0x1'));var server=require(_0x6791('0x2'));var Realtime=require('./realtime');var Report=require(_0x6791('0x3'));var Acw=require(_0x6791('0x4'));var Trigger=require(_0x6791('0x5'));var Dialer=require(_0x6791('0x6'));var Preview=require('./preview');var Fax=require(_0x6791('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x6791('0x8'));var voiceQueueReport=require(_0x6791('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x6791('0xa'));var trigger=require('./rpc/trigger');var template=require(_0x6791('0xb'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x6791('0xc'));var faxAccount=require(_0x6791('0xd'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x6791('0xe'));var sugarcrm=require(_0x6791('0xf'));var freshdesk=require(_0x6791('0x10'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x6791('0x11'));var vtiger=require(_0x6791('0x12'));var freshsales=require(_0x6791('0x13'));var servicenow=require(_0x6791('0x14'));var dynamics365=require(_0x6791('0x15'));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()[_0x6791('0x16')](_0x6791('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6791('0x16')](_0x6791('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x6791('0x18')]()[_0x6791('0x19')](user['getAgents']())['then'](realtime[_0x6791('0x1a')]())['then'](user[_0x6791('0x1b')]())['then'](realtime[_0x6791('0x1c')]())[_0x6791('0x19')](trunk['getTrunks']())[_0x6791('0x19')](realtime['initTrunks']())[_0x6791('0x19')](voiceQueue[_0x6791('0x1d')]())['then'](realtime[_0x6791('0x1e')]())[_0x6791('0x19')](trigger['getTriggers']())[_0x6791('0x19')](realtime['initTriggers']())[_0x6791('0x19')](template[_0x6791('0x1f')]())[_0x6791('0x19')](realtime[_0x6791('0x20')]())[_0x6791('0x19')](zendesk[_0x6791('0x21')]())[_0x6791('0x19')](realtime['initZendeskAccounts']())[_0x6791('0x19')](salesforce[_0x6791('0x22')]())['then'](realtime[_0x6791('0x23')]())[_0x6791('0x19')](sugarcrm['getSugarcrmAccounts']())[_0x6791('0x19')](realtime[_0x6791('0x24')]())[_0x6791('0x19')](freshdesk[_0x6791('0x25')]())['then'](realtime[_0x6791('0x26')]())[_0x6791('0x19')](desk['getDeskAccounts']())['then'](realtime['initDeskAccounts']())[_0x6791('0x19')](zoho['getZohoAccounts']())[_0x6791('0x19')](realtime['initZohoAccounts']())['then'](vtiger['getVtigerAccounts']())[_0x6791('0x19')](realtime[_0x6791('0x27')]())[_0x6791('0x19')](freshsales['getFreshsalesAccounts']())[_0x6791('0x19')](realtime[_0x6791('0x28')]())['then'](servicenow[_0x6791('0x29')]())['then'](realtime[_0x6791('0x2a')]())['then'](dynamics365['getDynamics365Accounts']())[_0x6791('0x19')](realtime['initDynamics365Accounts']())[_0x6791('0x19')](campaign[_0x6791('0x2b')]())['then'](realtime[_0x6791('0x2c')]())[_0x6791('0x19')](voiceExtension[_0x6791('0x2d')]())[_0x6791('0x19')](realtime['initVoiceExtensions']())['then'](faxAccount[_0x6791('0x2e')]())['then'](realtime[_0x6791('0x2f')]())[_0x6791('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0x6791('0x18')]()[_0x6791('0x19')](voiceQueueReport[_0x6791('0x30')]())[_0x6791('0x19')](realtime[_0x6791('0x31')]())[_0x6791('0x19')](cmHopperHistory[_0x6791('0x32')]())[_0x6791('0x19')](realtime['initVoiceQueueHopperHistory']())[_0x6791('0x19')](cmHopperHistory[_0x6791('0x33')]())[_0x6791('0x19')](realtime[_0x6791('0x34')]())[_0x6791('0x19')](voiceCallReport[_0x6791('0x35')]())['then'](realtime['initVoiceCallReports']())['then'](function(_0x1de770){})[_0x6791('0x36')](function(_0x252916){console['log'](_0x252916);});}function main(){return server['listen'](realtime,preview,fax)[_0x6791('0x19')](function(_0x9b1ad2){return initRealtime();})[_0x6791('0x19')](function(){return initParams();})[_0x6791('0x19')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x6791('0x36')](function(_0xee6b68){console[_0x6791('0x37')](_0xee6b68);});}main(); \ No newline at end of file +var _0x1eba=['log','sync','bluebird','util','moment','./server','./realtime','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','getAgents','initAgents','then','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports'];(function(_0x275e86,_0x1f3b87){var _0x91cb88=function(_0x26f959){while(--_0x26f959){_0x275e86['push'](_0x275e86['shift']());}};_0x91cb88(++_0x1f3b87);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x1d5400,_0x567e3c){_0x1d5400=_0x1d5400-0x0;var _0x21d9fe=_0x1eba[_0x1d5400];return _0x21d9fe;};'use strict';var BPromise=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));var server=require(_0xa1eb('0x3'));var Realtime=require(_0xa1eb('0x4'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0xa1eb('0x5'));var Dialer=require(_0xa1eb('0x6'));var Preview=require(_0xa1eb('0x7'));var Fax=require(_0xa1eb('0x8'));var user=require(_0xa1eb('0x9'));var voiceQueue=require(_0xa1eb('0xa'));var voiceQueueReport=require(_0xa1eb('0xb'));var voiceCallReport=require(_0xa1eb('0xc'));var trunk=require(_0xa1eb('0xd'));var trigger=require(_0xa1eb('0xe'));var template=require(_0xa1eb('0xf'));var cmHopperHistory=require(_0xa1eb('0x10'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xa1eb('0x11'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xa1eb('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xa1eb('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xa1eb('0x14'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xa1eb('0x15'));var freshsales=require(_0xa1eb('0x16'));var servicenow=require(_0xa1eb('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()[_0xa1eb('0x18')](_0xa1eb('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xa1eb('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user[_0xa1eb('0x1a')]())['then'](realtime[_0xa1eb('0x1b')]())[_0xa1eb('0x1c')](user[_0xa1eb('0x1d')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x1e')]())[_0xa1eb('0x1c')](trunk[_0xa1eb('0x1f')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x20')]())['then'](voiceQueue[_0xa1eb('0x21')]())['then'](realtime[_0xa1eb('0x22')]())[_0xa1eb('0x1c')](trigger[_0xa1eb('0x23')]())[_0xa1eb('0x1c')](realtime['initTriggers']())[_0xa1eb('0x1c')](template[_0xa1eb('0x24')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x25')]())[_0xa1eb('0x1c')](zendesk[_0xa1eb('0x26')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x27')]())['then'](salesforce[_0xa1eb('0x28')]())['then'](realtime[_0xa1eb('0x29')]())[_0xa1eb('0x1c')](sugarcrm[_0xa1eb('0x2a')]())[_0xa1eb('0x1c')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0xa1eb('0x2b')]())[_0xa1eb('0x1c')](realtime['initFreshdeskAccounts']())[_0xa1eb('0x1c')](desk[_0xa1eb('0x2c')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x2d')]())[_0xa1eb('0x1c')](zoho[_0xa1eb('0x2e')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x2f')]())[_0xa1eb('0x1c')](vtiger[_0xa1eb('0x30')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x31')]())['then'](freshsales[_0xa1eb('0x32')]())[_0xa1eb('0x1c')](realtime['initFreshsalesAccounts']())[_0xa1eb('0x1c')](servicenow['getServicenowAccounts']())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x33')]())['then'](dynamics365[_0xa1eb('0x34')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x35')]())['then'](campaign[_0xa1eb('0x36')]())[_0xa1eb('0x1c')](realtime['initCampaigns']())[_0xa1eb('0x1c')](voiceExtension[_0xa1eb('0x37')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x38')]())[_0xa1eb('0x1c')](faxAccount['getFaxAccounts']())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x39')]())[_0xa1eb('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0xa1eb('0x3a')]()[_0xa1eb('0x1c')](voiceQueueReport[_0xa1eb('0x3b')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x3c')]())[_0xa1eb('0x1c')](cmHopperHistory[_0xa1eb('0x3d')]())[_0xa1eb('0x1c')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0xa1eb('0x3e')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x3f')]())[_0xa1eb('0x1c')](voiceCallReport[_0xa1eb('0x40')]())['then'](realtime['initVoiceCallReports']())[_0xa1eb('0x1c')](function(_0x2d2890){})['catch'](function(_0x48b23d){console[_0xa1eb('0x41')](_0x48b23d);});}function main(){return server['listen'](realtime,preview,fax)[_0xa1eb('0x1c')](function(_0x534fe4){return initRealtime();})[_0xa1eb('0x1c')](function(){return initParams();})[_0xa1eb('0x1c')](function(){report[_0xa1eb('0x42')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x355839){console[_0xa1eb('0x41')](_0x355839);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 38779d5..a1eddcd 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 _0xf74d=['online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','updateStatusRealtime','state','toLowerCase','not_inuse','idle','voiceStatus','stringify','md5','user:%s','user:save','emit','exports','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface'];(function(_0x10e27b,_0x4bee8d){var _0x134b29=function(_0x422a25){while(--_0x422a25){_0x10e27b['push'](_0x10e27b['shift']());}};_0x134b29(++_0x4bee8d);}(_0xf74d,0xbc));var _0xdf74=function(_0x3b532b,_0x3e2922){_0x3b532b=_0x3b532b-0x0;var _0x1d0434=_0xf74d[_0x3b532b];return _0x1d0434;};'use strict';var _=require('lodash');var util=require(_0xdf74('0x0'));var moment=require(_0xdf74('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xdf74('0x2'));config[_0xdf74('0x3')]=_[_0xdf74('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xdf74('0x5'))(new Redis(config['redis']));function Agent(_0x4fcd9e){this['id']=_0x4fcd9e['id']||0x0;this['name']=_0x4fcd9e[_0xdf74('0x6')]||'';this[_0xdf74('0x7')]=_0x4fcd9e[_0xdf74('0x7')]||'';this[_0xdf74('0x8')]=_0x4fcd9e[_0xdf74('0x8')]||'';this[_0xdf74('0x9')]=_0x4fcd9e[_0xdf74('0x9')]||'';this['state']=_0xdf74('0xa');this[_0xdf74('0xb')]=0x0;this[_0xdf74('0xc')]=_0xdf74('0xa');this[_0xdf74('0xd')]='';this['phone']='';this[_0xdf74('0xe')]='';this[_0xdf74('0xf')]='';this['online']=_0x4fcd9e[_0xdf74('0x10')]||![];this['voiceStatus']=_0xdf74('0xa');this[_0xdf74('0x11')]=0x0;this[_0xdf74('0x12')]='';this[_0xdf74('0x13')]='';this[_0xdf74('0x14')]=![];this[_0xdf74('0x15')]=![];this['md5']='';}Agent['prototype'][_0xdf74('0x16')]=function(_0x517870){var _0x4cbb08;if(_0x517870&&_0x517870['state']){_0x4cbb08=_0x517870[_0xdf74('0x17')][_0xdf74('0x18')]();switch(_0x4cbb08){case _0xdf74('0x19'):_0x4cbb08=_0xdf74('0x1a');break;case'inuse':_0x4cbb08='talking';break;}}if(_0x4cbb08&&this[_0xdf74('0x1b')]!==_0x4cbb08||_0x517870['statePause']){this[_0xdf74('0x11')]=_['toNumber'](moment()['format']('x'));}if(_0x4cbb08){this['voiceStatus']=_0x4cbb08;}var _0x56e384={'id':this['id'],'name':this[_0xdf74('0x6')],'email':this['email'],'accountcode':this[_0xdf74('0x8')],'fullname':this['fullname'],'state':this[_0xdf74('0x17')],'stateTime':this[_0xdf74('0xb')],'status':this[_0xdf74('0xc')],'address':this[_0xdf74('0xd')],'online':this[_0xdf74('0x10')],'voiceStatus':this[_0xdf74('0x1b')],'voiceStatusTime':this[_0xdf74('0x11')],'voiceStatusCallerIdNumber':this[_0xdf74('0x12')],'voiceStatusQueue':this[_0xdf74('0x13')],'interface':this[_0xdf74('0xf')],'onhold':this['onhold']};var _0x584ec3=md5(JSON[_0xdf74('0x1c')](_0x56e384));if(this[_0xdf74('0x1d')]!==_0x584ec3){this['md5']=_0x584ec3;io['to'](util['format'](_0xdf74('0x1e'),_0x56e384[_0xdf74('0x6')]))['emit'](_0xdf74('0x1f'),_0x56e384);io[_0xdf74('0x20')]('user:presence',_0x56e384);}};module[_0xdf74('0x21')]=Agent; \ No newline at end of file +var _0xe3a6=['phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','statePause','format','stateTime','stringify','emit','user:save','user:presence','exports','lodash','util','moment','md5','ioredis','redis','socket.io-emitter','name','email','accountcode','fullname','state','unknown','address'];(function(_0x502c7b,_0x37231a){var _0x50eaa1=function(_0x25eae7){while(--_0x25eae7){_0x502c7b['push'](_0x502c7b['shift']());}};_0x50eaa1(++_0x37231a);}(_0xe3a6,0x151));var _0x6e3a=function(_0x3b1c91,_0x5215e1){_0x3b1c91=_0x3b1c91-0x0;var _0x1ba0ea=_0xe3a6[_0x3b1c91];return _0x1ba0ea;};'use strict';var _=require(_0x6e3a('0x0'));var util=require(_0x6e3a('0x1'));var moment=require(_0x6e3a('0x2'));var md5=require(_0x6e3a('0x3'));var Redis=require(_0x6e3a('0x4'));var config=require('../../../config/environment');config[_0x6e3a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6e3a('0x6'))(new Redis(config['redis']));function Agent(_0x4b0fdb){this['id']=_0x4b0fdb['id']||0x0;this[_0x6e3a('0x7')]=_0x4b0fdb['name']||'';this['email']=_0x4b0fdb[_0x6e3a('0x8')]||'';this['accountcode']=_0x4b0fdb[_0x6e3a('0x9')]||'';this[_0x6e3a('0xa')]=_0x4b0fdb[_0x6e3a('0xa')]||'';this[_0x6e3a('0xb')]=_0x6e3a('0xc');this['stateTime']=0x0;this['status']=_0x6e3a('0xc');this[_0x6e3a('0xd')]='';this[_0x6e3a('0xe')]='';this[_0x6e3a('0xf')]='';this[_0x6e3a('0x10')]='';this[_0x6e3a('0x11')]=_0x4b0fdb[_0x6e3a('0x11')]||![];this['voiceStatus']=_0x6e3a('0xc');this[_0x6e3a('0x12')]=0x0;this[_0x6e3a('0x13')]='';this[_0x6e3a('0x14')]='';this[_0x6e3a('0x15')]=![];this[_0x6e3a('0x16')]=![];this[_0x6e3a('0x3')]='';}Agent[_0x6e3a('0x17')][_0x6e3a('0x18')]=function(_0x424b93){var _0x2299fe;if(_0x424b93&&_0x424b93[_0x6e3a('0xb')]){_0x2299fe=_0x424b93[_0x6e3a('0xb')][_0x6e3a('0x19')]();switch(_0x2299fe){case _0x6e3a('0x1a'):_0x2299fe=_0x6e3a('0x1b');break;case _0x6e3a('0x1c'):_0x2299fe=_0x6e3a('0x1d');break;}}if(_0x2299fe&&this[_0x6e3a('0x1e')]!==_0x2299fe||_0x424b93[_0x6e3a('0x1f')]){this[_0x6e3a('0x12')]=_['toNumber'](moment()[_0x6e3a('0x20')]('x'));}if(_0x2299fe){this[_0x6e3a('0x1e')]=_0x2299fe;}var _0x4ce05c={'id':this['id'],'name':this[_0x6e3a('0x7')],'email':this[_0x6e3a('0x8')],'accountcode':this['accountcode'],'fullname':this[_0x6e3a('0xa')],'state':this['state'],'stateTime':this[_0x6e3a('0x21')],'status':this['status'],'address':this[_0x6e3a('0xd')],'online':this[_0x6e3a('0x11')],'voiceStatus':this[_0x6e3a('0x1e')],'voiceStatusTime':this[_0x6e3a('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e3a('0x14')],'interface':this[_0x6e3a('0x10')],'onhold':this[_0x6e3a('0x15')]};var _0x3bbf04=md5(JSON[_0x6e3a('0x22')](_0x4ce05c));if(this[_0x6e3a('0x3')]!==_0x3bbf04){this[_0x6e3a('0x3')]=_0x3bbf04;io['to'](util[_0x6e3a('0x20')]('user:%s',_0x4ce05c[_0x6e3a('0x7')]))[_0x6e3a('0x23')](_0x6e3a('0x24'),_0x4ce05c);io[_0x6e3a('0x23')](_0x6e3a('0x25'),_0x4ce05c);}};module[_0x6e3a('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 ab48463..8595f4c 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 _0x12c6=['dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry'];(function(_0x2aac89,_0x33caa3){var _0x3a3c29=function(_0x4969db){while(--_0x4969db){_0x2aac89['push'](_0x2aac89['shift']());}};_0x3a3c29(++_0x33caa3);}(_0x12c6,0x1b4));var _0x612c=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x12c6[_0x26462c];return _0x509a42;};'use strict';function Campaign(_0x464b03){this['id']=_0x464b03['id']||0x0;this[_0x612c('0x0')]=_0x464b03[_0x612c('0x0')]||'';this[_0x612c('0x1')]=_0x464b03['type']||_0x612c('0x2');this[_0x612c('0x3')]=0x0;this[_0x612c('0x4')]=0x0;this[_0x612c('0x5')]=0x0;this[_0x612c('0x6')]=0x0;this[_0x612c('0x7')]='';this[_0x612c('0x8')]=!![];this[_0x612c('0x9')]=_0x464b03[_0x612c('0x9')];this['limitCalls']=_0x464b03[_0x612c('0xa')];this[_0x612c('0xb')]=_0x464b03[_0x612c('0xb')]||null;this[_0x612c('0xc')]=_0x464b03[_0x612c('0xc')]?_0x464b03[_0x612c('0xc')]:null;this['dialOriginateCallerIdName']=_0x464b03['dialOriginateCallerIdName'];this[_0x612c('0xd')]=_0x464b03[_0x612c('0xd')];this['dialOriginateTimeout']=_0x464b03['dialOriginateTimeout']||0x1e;this[_0x612c('0xe')]=_0x464b03[_0x612c('0xe')];this[_0x612c('0xf')]=_0x464b03[_0x612c('0xf')];this['dialBusyMaxRetry']=_0x464b03[_0x612c('0x10')];this['dialBusyRetryFrequency']=_0x464b03[_0x612c('0x11')];this['dialNoAnswerMaxRetry']=_0x464b03['dialNoAnswerMaxRetry'];this[_0x612c('0x12')]=_0x464b03[_0x612c('0x12')];this[_0x612c('0x13')]=_0x464b03[_0x612c('0x13')];this[_0x612c('0x14')]=_0x464b03[_0x612c('0x14')]||0x3;this[_0x612c('0x15')]=_0x464b03[_0x612c('0x15')]||0x96;this['dialDropMaxRetry']=_0x464b03[_0x612c('0x16')]||0x3;this[_0x612c('0x17')]=_0x464b03[_0x612c('0x17')]||0x96;this[_0x612c('0x18')]=_0x464b03['dialAbandonedMaxRetry']||0x3;this[_0x612c('0x19')]=_0x464b03['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x464b03[_0x612c('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x464b03[_0x612c('0x1b')]||0x96;this[_0x612c('0x1c')]=_0x464b03[_0x612c('0x1c')]||0x3;this[_0x612c('0x1d')]=_0x464b03[_0x612c('0x1d')]||0x96;this[_0x612c('0x1e')]=_0x464b03['dialOrderByScheduledAt']||_0x612c('0x1f');this['dialPrefix']=_0x464b03[_0x612c('0x20')]||undefined;this[_0x612c('0x21')]=_0x464b03[_0x612c('0x21')]||undefined;this[_0x612c('0x22')]=_0x464b03[_0x612c('0x22')]||undefined;this[_0x612c('0x23')]=_0x464b03[_0x612c('0x23')]?_0x464b03[_0x612c('0x23')]:undefined;this[_0x612c('0x24')]=_0x464b03[_0x612c('0x24')]?_0x464b03['Trunk']:undefined;this['Interval']=_0x464b03[_0x612c('0x25')]?_0x464b03['Interval']:undefined;this[_0x612c('0x26')]=_0x464b03[_0x612c('0x26')]?_0x464b03[_0x612c('0x26')]:undefined;this[_0x612c('0x27')]=_0x464b03[_0x612c('0x26')]?_0x464b03[_0x612c('0x26')][_0x612c('0x0')]:undefined;this[_0x612c('0x28')]=_0x464b03[_0x612c('0x28')]||![];this[_0x612c('0x29')]=_0x464b03['dialAMDInitialSilence'];this[_0x612c('0x2a')]=_0x464b03['dialAMDGreeting'];this[_0x612c('0x2b')]=_0x464b03['dialAMDAfterGreetingSilence'];this[_0x612c('0x2c')]=_0x464b03['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x464b03[_0x612c('0x2d')];this[_0x612c('0x2e')]=_0x464b03[_0x612c('0x2e')];this[_0x612c('0x2f')]=_0x464b03[_0x612c('0x2f')];this[_0x612c('0x30')]=_0x464b03[_0x612c('0x30')];this[_0x612c('0x31')]=_0x464b03[_0x612c('0x31')];}module[_0x612c('0x32')]=Campaign; \ No newline at end of file +var _0x414c=['dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','name','type','campaign','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency'];(function(_0x3b06f2,_0x44187e){var _0x4bf8f4=function(_0x4e6538){while(--_0x4e6538){_0x3b06f2['push'](_0x3b06f2['shift']());}};_0x4bf8f4(++_0x44187e);}(_0x414c,0xda));var _0xc414=function(_0x53e53a,_0x4f2f08){_0x53e53a=_0x53e53a-0x0;var _0x4fe936=_0x414c[_0x53e53a];return _0x4fe936;};'use strict';function Campaign(_0x2cfb6c){this['id']=_0x2cfb6c['id']||0x0;this[_0xc414('0x0')]=_0x2cfb6c[_0xc414('0x0')]||'';this[_0xc414('0x1')]=_0x2cfb6c[_0xc414('0x1')]||_0xc414('0x2');this[_0xc414('0x3')]=0x0;this[_0xc414('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xc414('0x5')]=0x0;this[_0xc414('0x6')]='';this[_0xc414('0x7')]=!![];this[_0xc414('0x8')]=_0x2cfb6c[_0xc414('0x8')];this[_0xc414('0x9')]=_0x2cfb6c['limitCalls'];this[_0xc414('0xa')]=_0x2cfb6c[_0xc414('0xa')]||null;this['dialGlobalInterval']=_0x2cfb6c[_0xc414('0xb')]?_0x2cfb6c['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x2cfb6c[_0xc414('0xc')];this['dialOriginateCallerIdNumber']=_0x2cfb6c[_0xc414('0xd')];this[_0xc414('0xe')]=_0x2cfb6c[_0xc414('0xe')]||0x1e;this[_0xc414('0xf')]=_0x2cfb6c[_0xc414('0xf')];this[_0xc414('0x10')]=_0x2cfb6c[_0xc414('0x10')];this[_0xc414('0x11')]=_0x2cfb6c[_0xc414('0x11')];this['dialBusyRetryFrequency']=_0x2cfb6c['dialBusyRetryFrequency'];this[_0xc414('0x12')]=_0x2cfb6c[_0xc414('0x12')];this['dialNoAnswerRetryFrequency']=_0x2cfb6c['dialNoAnswerRetryFrequency'];this[_0xc414('0x13')]=_0x2cfb6c[_0xc414('0x13')];this[_0xc414('0x14')]=_0x2cfb6c[_0xc414('0x14')]||0x3;this[_0xc414('0x15')]=_0x2cfb6c[_0xc414('0x15')]||0x96;this[_0xc414('0x16')]=_0x2cfb6c[_0xc414('0x16')]||0x3;this[_0xc414('0x17')]=_0x2cfb6c[_0xc414('0x17')]||0x96;this[_0xc414('0x18')]=_0x2cfb6c[_0xc414('0x18')]||0x3;this[_0xc414('0x19')]=_0x2cfb6c[_0xc414('0x19')]||0x96;this[_0xc414('0x1a')]=_0x2cfb6c['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x2cfb6c[_0xc414('0x1b')]||0x96;this[_0xc414('0x1c')]=_0x2cfb6c[_0xc414('0x1c')]||0x3;this[_0xc414('0x1d')]=_0x2cfb6c[_0xc414('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x2cfb6c[_0xc414('0x1e')]||'DESC';this[_0xc414('0x1f')]=_0x2cfb6c['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x2cfb6c[_0xc414('0x20')]||undefined;this[_0xc414('0x21')]=_0x2cfb6c[_0xc414('0x21')]||undefined;this[_0xc414('0x22')]=_0x2cfb6c[_0xc414('0x22')]?_0x2cfb6c[_0xc414('0x22')]:undefined;this[_0xc414('0x23')]=_0x2cfb6c[_0xc414('0x23')]?_0x2cfb6c[_0xc414('0x23')]:undefined;this['Interval']=_0x2cfb6c[_0xc414('0x24')]?_0x2cfb6c[_0xc414('0x24')]:undefined;this[_0xc414('0x25')]=_0x2cfb6c[_0xc414('0x25')]?_0x2cfb6c['SquareProject']:undefined;this[_0xc414('0x26')]=_0x2cfb6c[_0xc414('0x25')]?_0x2cfb6c[_0xc414('0x25')][_0xc414('0x0')]:undefined;this['dialAMDActive']=_0x2cfb6c[_0xc414('0x27')]||![];this[_0xc414('0x28')]=_0x2cfb6c[_0xc414('0x28')];this[_0xc414('0x29')]=_0x2cfb6c[_0xc414('0x29')];this[_0xc414('0x2a')]=_0x2cfb6c[_0xc414('0x2a')];this[_0xc414('0x2b')]=_0x2cfb6c[_0xc414('0x2b')];this[_0xc414('0x2c')]=_0x2cfb6c[_0xc414('0x2c')];this['dialAMDBetweenWordsSilence']=_0x2cfb6c[_0xc414('0x2d')];this[_0xc414('0x2e')]=_0x2cfb6c[_0xc414('0x2e')];this[_0xc414('0x2f')]=_0x2cfb6c[_0xc414('0x2f')];this['dialAMDMaximumWordLength']=_0x2cfb6c['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 2a2a38d..7978af6 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 _0xd00d=['endtime','unmanaged','lastapplication','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','mohtime','starttime','calleridnum','connectedlinenum','accountcode','context','uniqueid','linkedid','answered','answertime'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xd00d,0x150));var _0xdd00=function(_0x258b93,_0x188ccc){_0x258b93=_0x258b93-0x0;var _0x35484b=_0xd00d[_0x258b93];return _0x35484b;};'use strict';function Channel(){this[_0xdd00('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0xdd00('0x1')]=0x0;this['calleridname']='';this[_0xdd00('0x2')]=undefined;this['connectedlinename']=undefined;this[_0xdd00('0x3')]=0x0;this[_0xdd00('0x4')]='';this[_0xdd00('0x5')]=0x0;this[_0xdd00('0x6')]=0x0;this['exten']=0x0;this[_0xdd00('0x7')]=![];this[_0xdd00('0x8')]=null;this[_0xdd00('0x9')]=null;this[_0xdd00('0xa')]=![];this['abandoned']=![];this[_0xdd00('0xb')]='';this['lastdata']='';this[_0xdd00('0xc')]=0x0;this[_0xdd00('0xd')]=0x0;this[_0xdd00('0xe')]=0x0;this[_0xdd00('0xf')]=null;this[_0xdd00('0x10')]=null;this['disposition']=null;this[_0xdd00('0x11')]=![];this[_0xdd00('0x12')]=null;this[_0xdd00('0x13')]=null;this[_0xdd00('0x14')]=[];this['transfercalleridnum']=undefined;this[_0xdd00('0x15')]=undefined;this['transferType']=undefined;this[_0xdd00('0x16')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x06e6=['abandoned','lastapplication','lastdata','duration','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answertime','endtime'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x06e6,0xb0));var _0x606e=function(_0xfc9121,_0x38e193){_0xfc9121=_0xfc9121-0x0;var _0x4e9f47=_0x06e6[_0xfc9121];return _0x4e9f47;};'use strict';function Channel(){this[_0x606e('0x0')]=null;this[_0x606e('0x1')]='';this[_0x606e('0x2')]='';this[_0x606e('0x3')]=0x0;this[_0x606e('0x4')]='';this[_0x606e('0x5')]=undefined;this[_0x606e('0x6')]=undefined;this[_0x606e('0x7')]=0x0;this[_0x606e('0x8')]='';this['uniqueid']=0x0;this[_0x606e('0x9')]=0x0;this[_0x606e('0xa')]=0x0;this['answered']=![];this[_0x606e('0xb')]=null;this[_0x606e('0xc')]=null;this['unmanaged']=![];this[_0x606e('0xd')]=![];this[_0x606e('0xe')]='';this[_0x606e('0xf')]='';this[_0x606e('0x10')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x606e('0x11')]=null;this['tag']=null;this[_0x606e('0x12')]=null;this[_0x606e('0x13')]=![];this[_0x606e('0x14')]=null;this[_0x606e('0x15')]=null;this[_0x606e('0x16')]=[];this[_0x606e('0x17')]=undefined;this[_0x606e('0x18')]=undefined;this[_0x606e('0x19')]=undefined;this[_0x606e('0x1a')]=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 028aa9e..b7b303b 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 _0x2cd3=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey'];(function(_0x5bbb8e,_0x2b1df0){var _0x36eb46=function(_0x43dfe2){while(--_0x43dfe2){_0x5bbb8e['push'](_0x5bbb8e['shift']());}};_0x36eb46(++_0x2b1df0);}(_0x2cd3,0xf1));var _0x32cd=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0x2cd3[_0x460150];return _0x340677;};'use strict';function DeskAccount(_0x21c841){this['id']=_0x21c841['id']||0x0;this['name']=_0x21c841[_0x32cd('0x0')]||'';this[_0x32cd('0x1')]=_0x21c841[_0x32cd('0x1')]||'';this[_0x32cd('0x2')]=_0x21c841[_0x32cd('0x2')]||'';this[_0x32cd('0x3')]=_0x21c841['authType']||'';this['password']=_0x21c841[_0x32cd('0x4')]||'';this[_0x32cd('0x5')]=_0x21c841[_0x32cd('0x5')]||'';this[_0x32cd('0x6')]=_0x21c841[_0x32cd('0x6')]||'';this[_0x32cd('0x7')]=_0x21c841[_0x32cd('0x7')]||'';this[_0x32cd('0x8')]=_0x21c841[_0x32cd('0x8')]||'';this[_0x32cd('0x9')]=_0x21c841[_0x32cd('0x9')]||'';this[_0x32cd('0xa')]=_0x21c841[_0x32cd('0xa')]||'';this[_0x32cd('0xb')]=_0x21c841[_0x32cd('0xb')]||{};}module[_0x32cd('0xc')]=DeskAccount; \ No newline at end of file +var _0x4403=['serverUrl','Configurations','exports','username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4403,0x179));var _0x3440=function(_0x3e0394,_0x3226a9){_0x3e0394=_0x3e0394-0x0;var _0x5c7b14=_0x4403[_0x3e0394];return _0x5c7b14;};'use strict';function DeskAccount(_0x5e2430){this['id']=_0x5e2430['id']||0x0;this['name']=_0x5e2430['name']||'';this[_0x3440('0x0')]=_0x5e2430['username']||'';this[_0x3440('0x1')]=_0x5e2430[_0x3440('0x1')]||'';this[_0x3440('0x2')]=_0x5e2430[_0x3440('0x2')]||'';this['password']=_0x5e2430[_0x3440('0x3')]||'';this['consumerKey']=_0x5e2430['consumerKey']||'';this[_0x3440('0x4')]=_0x5e2430[_0x3440('0x4')]||'';this[_0x3440('0x5')]=_0x5e2430['token']||'';this[_0x3440('0x6')]=_0x5e2430['tokenSecret']||'';this[_0x3440('0x7')]=_0x5e2430[_0x3440('0x7')]||'';this[_0x3440('0x8')]=_0x5e2430['serverUrl']||'';this[_0x3440('0x9')]=_0x5e2430[_0x3440('0x9')]||{};}module[_0x3440('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 1bc2dbb..bcd0a27 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 _0x202b=['Configurations','name','username','password','remoteUri','clientId','clientSecret','serverUrl'];(function(_0x458021,_0x223180){var _0x5c1b78=function(_0x18d2bd){while(--_0x18d2bd){_0x458021['push'](_0x458021['shift']());}};_0x5c1b78(++_0x223180);}(_0x202b,0x1e1));var _0xb202=function(_0x4af2c3,_0xf4d1f4){_0x4af2c3=_0x4af2c3-0x0;var _0x74088=_0x202b[_0x4af2c3];return _0x74088;};'use strict';function Dynamics365Account(_0x2de3ad){this['id']=_0x2de3ad['id']||0x0;this[_0xb202('0x0')]=_0x2de3ad['name']||'';this[_0xb202('0x1')]=_0x2de3ad['username']||'';this[_0xb202('0x2')]=_0x2de3ad[_0xb202('0x2')]||'';this['remoteUri']=_0x2de3ad[_0xb202('0x3')]||'';this['tenantId']=_0x2de3ad['tenantId']||'';this[_0xb202('0x4')]=_0x2de3ad[_0xb202('0x4')]||'';this[_0xb202('0x5')]=_0x2de3ad[_0xb202('0x5')]||{};this['serverUrl']=_0x2de3ad[_0xb202('0x6')]||'';this[_0xb202('0x7')]=_0x2de3ad[_0xb202('0x7')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x0a80=['username','password','remoteUri','clientId','clientSecret','serverUrl','Configurations','exports','name'];(function(_0x8d8e9c,_0x4ae2ca){var _0x4b64c1=function(_0x540830){while(--_0x540830){_0x8d8e9c['push'](_0x8d8e9c['shift']());}};_0x4b64c1(++_0x4ae2ca);}(_0x0a80,0xc5));var _0x00a8=function(_0x242755,_0x5d109d){_0x242755=_0x242755-0x0;var _0x2914e3=_0x0a80[_0x242755];return _0x2914e3;};'use strict';function Dynamics365Account(_0x2dd7ef){this['id']=_0x2dd7ef['id']||0x0;this[_0x00a8('0x0')]=_0x2dd7ef['name']||'';this[_0x00a8('0x1')]=_0x2dd7ef[_0x00a8('0x1')]||'';this[_0x00a8('0x2')]=_0x2dd7ef[_0x00a8('0x2')]||'';this[_0x00a8('0x3')]=_0x2dd7ef['remoteUri']||'';this['tenantId']=_0x2dd7ef['tenantId']||'';this[_0x00a8('0x4')]=_0x2dd7ef[_0x00a8('0x4')]||'';this[_0x00a8('0x5')]=_0x2dd7ef['clientSecret']||{};this[_0x00a8('0x6')]=_0x2dd7ef[_0x00a8('0x6')]||'';this[_0x00a8('0x7')]=_0x2dd7ef['Configurations']||{};}module[_0x00a8('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 62f34a9..7cf0dff 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 _0x4ea7=['faxdetect','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ea7,0x1d6));var _0x74ea=function(_0x39d1b7,_0x33b6c2){_0x39d1b7=_0x39d1b7-0x0;var _0x1b2586=_0x4ea7[_0x39d1b7];return _0x1b2586;};'use strict';function FaxAccount(_0x20a5de){this['id']=_0x20a5de['id']||0x0;this[_0x74ea('0x0')]=_0x20a5de['name']||'';this[_0x74ea('0x1')]=_0x20a5de[_0x74ea('0x1')];this[_0x74ea('0x2')]=_0x20a5de['ecm'];this[_0x74ea('0x3')]=_0x20a5de[_0x74ea('0x3')];this[_0x74ea('0x4')]=_0x20a5de[_0x74ea('0x4')];this[_0x74ea('0x5')]=_0x20a5de['minrate']||0x960;this[_0x74ea('0x6')]=_0x20a5de[_0x74ea('0x6')]||0x3840;this[_0x74ea('0x7')]=_0x20a5de[_0x74ea('0x7')]||_0x74ea('0x8');this[_0x74ea('0x9')]=_0x20a5de['gateway']||'no';this[_0x74ea('0xa')]=_0x20a5de[_0x74ea('0xa')]||'no';this['t38timeout']=_0x20a5de['t38timeout']||0x1388;this[_0x74ea('0xb')]=_0x20a5de[_0x74ea('0xb')]||'SIP';this[_0x74ea('0xc')]=_0x20a5de['Trunk']?_0x20a5de['Trunk']:undefined;this['ListId']=_0x20a5de[_0x74ea('0xd')];this[_0x74ea('0xe')]=_0x20a5de['key'];}module[_0x74ea('0xf')]=FaxAccount; \ No newline at end of file +var _0xd889=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports'];(function(_0x44a64d,_0x50fb16){var _0x351056=function(_0x1ea71c){while(--_0x1ea71c){_0x44a64d['push'](_0x44a64d['shift']());}};_0x351056(++_0x50fb16);}(_0xd889,0x17a));var _0x9d88=function(_0x28d80b,_0x186ec2){_0x28d80b=_0x28d80b-0x0;var _0x3bb43e=_0xd889[_0x28d80b];return _0x3bb43e;};'use strict';function FaxAccount(_0x28c25f){this['id']=_0x28c25f['id']||0x0;this[_0x9d88('0x0')]=_0x28c25f[_0x9d88('0x0')]||'';this[_0x9d88('0x1')]=_0x28c25f[_0x9d88('0x1')];this['ecm']=_0x28c25f[_0x9d88('0x2')];this[_0x9d88('0x3')]=_0x28c25f[_0x9d88('0x3')];this[_0x9d88('0x4')]=_0x28c25f[_0x9d88('0x4')];this[_0x9d88('0x5')]=_0x28c25f[_0x9d88('0x5')]||0x960;this[_0x9d88('0x6')]=_0x28c25f[_0x9d88('0x6')]||0x3840;this['modem']=_0x28c25f[_0x9d88('0x7')]||_0x9d88('0x8');this[_0x9d88('0x9')]=_0x28c25f['gateway']||'no';this[_0x9d88('0xa')]=_0x28c25f[_0x9d88('0xa')]||'no';this[_0x9d88('0xb')]=_0x28c25f['t38timeout']||0x1388;this['tech']=_0x28c25f[_0x9d88('0xc')]||_0x9d88('0xd');this[_0x9d88('0xe')]=_0x28c25f[_0x9d88('0xe')]?_0x28c25f[_0x9d88('0xe')]:undefined;this[_0x9d88('0xf')]=_0x28c25f[_0x9d88('0xf')];this[_0x9d88('0x10')]=_0x28c25f[_0x9d88('0x10')];}module[_0x9d88('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index e6c2ec3..46c4cbf 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 _0x984e=['apiKey','token','remoteUri','serverUrl','exports','name','username'];(function(_0x24d614,_0x176130){var _0x2149bd=function(_0x1ed1e7){while(--_0x1ed1e7){_0x24d614['push'](_0x24d614['shift']());}};_0x2149bd(++_0x176130);}(_0x984e,0x194));var _0xe984=function(_0x437db9,_0xd65673){_0x437db9=_0x437db9-0x0;var _0x511697=_0x984e[_0x437db9];return _0x511697;};'use strict';function FreshdeskAccount(_0x1ba7e1){this['id']=_0x1ba7e1['id']||0x0;this[_0xe984('0x0')]=_0x1ba7e1[_0xe984('0x0')]||'';this[_0xe984('0x1')]=_0x1ba7e1[_0xe984('0x1')]||'';this[_0xe984('0x2')]=_0x1ba7e1[_0xe984('0x3')]||'';this[_0xe984('0x4')]=_0x1ba7e1[_0xe984('0x4')]||'';this[_0xe984('0x5')]=_0x1ba7e1[_0xe984('0x5')]||'';this['Configurations']=_0x1ba7e1['Configurations']||{};}module[_0xe984('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xa157=['serverUrl','Configurations','exports','name','username','token','remoteUri'];(function(_0x4947c3,_0x14acde){var _0x6128b=function(_0x52f4bd){while(--_0x52f4bd){_0x4947c3['push'](_0x4947c3['shift']());}};_0x6128b(++_0x14acde);}(_0xa157,0x168));var _0x7a15=function(_0x35d9db,_0x1480e8){_0x35d9db=_0x35d9db-0x0;var _0x695853=_0xa157[_0x35d9db];return _0x695853;};'use strict';function FreshdeskAccount(_0xb79d8f){this['id']=_0xb79d8f['id']||0x0;this[_0x7a15('0x0')]=_0xb79d8f['name']||'';this[_0x7a15('0x1')]=_0xb79d8f[_0x7a15('0x1')]||'';this['apiKey']=_0xb79d8f[_0x7a15('0x2')]||'';this['remoteUri']=_0xb79d8f[_0x7a15('0x3')]||'';this[_0x7a15('0x4')]=_0xb79d8f[_0x7a15('0x4')]||'';this[_0x7a15('0x5')]=_0xb79d8f['Configurations']||{};}module[_0x7a15('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 6e0f0a1..cb83703 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 _0x0b69=['apiKey','token','remoteUri','serverUrl','Configurations','name','username'];(function(_0xf4f046,_0x3a22a8){var _0x36ef42=function(_0x5390d5){while(--_0x5390d5){_0xf4f046['push'](_0xf4f046['shift']());}};_0x36ef42(++_0x3a22a8);}(_0x0b69,0xc2));var _0x90b6=function(_0x8f86a1,_0x47073a){_0x8f86a1=_0x8f86a1-0x0;var _0x3efe51=_0x0b69[_0x8f86a1];return _0x3efe51;};'use strict';function FreshsalesAccount(_0x57040b){this['id']=_0x57040b['id']||0x0;this['name']=_0x57040b[_0x90b6('0x0')]||'';this[_0x90b6('0x1')]=_0x57040b[_0x90b6('0x1')]||'';this[_0x90b6('0x2')]=_0x57040b[_0x90b6('0x3')]||'';this['remoteUri']=_0x57040b[_0x90b6('0x4')]||'';this[_0x90b6('0x5')]=_0x57040b[_0x90b6('0x5')]||'';this[_0x90b6('0x6')]=_0x57040b[_0x90b6('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x3d89=['apiKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x5c9c05,_0x508705){var _0xb77484=function(_0x4f560e){while(--_0x4f560e){_0x5c9c05['push'](_0x5c9c05['shift']());}};_0xb77484(++_0x508705);}(_0x3d89,0x88));var _0x93d8=function(_0x3abd99,_0xf286f9){_0x3abd99=_0x3abd99-0x0;var _0x433485=_0x3d89[_0x3abd99];return _0x433485;};'use strict';function FreshsalesAccount(_0x53a241){this['id']=_0x53a241['id']||0x0;this[_0x93d8('0x0')]=_0x53a241[_0x93d8('0x0')]||'';this[_0x93d8('0x1')]=_0x53a241[_0x93d8('0x1')]||'';this[_0x93d8('0x2')]=_0x53a241['token']||'';this['remoteUri']=_0x53a241[_0x93d8('0x3')]||'';this['serverUrl']=_0x53a241[_0x93d8('0x4')]||'';this[_0x93d8('0x5')]=_0x53a241[_0x93d8('0x5')]||{};}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 9e0dd81..bf4d977 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 _0xd3fd=['count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','exten','priority','holdtime','lastAssignedTo','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position'];(function(_0x5e47e9,_0x54f16d){var _0x13f936=function(_0x34be9c){while(--_0x34be9c){_0x5e47e9['push'](_0x5e47e9['shift']());}};_0x13f936(++_0x54f16d);}(_0xd3fd,0xd7));var _0xdd3f=function(_0x8e2b60,_0x2925b9){_0x8e2b60=_0x8e2b60-0x0;var _0x4fe1cd=_0xd3fd[_0x8e2b60];return _0x4fe1cd;};'use strict';function QueueReport(){this[_0xdd3f('0x0')]=_0xdd3f('0x1');this[_0xdd3f('0x2')]='';this[_0xdd3f('0x3')]='';this[_0xdd3f('0x4')]='';this[_0xdd3f('0x5')]='';this[_0xdd3f('0x6')]=null;this[_0xdd3f('0x7')]=null;this[_0xdd3f('0x8')]=0x1;this[_0xdd3f('0x9')]=0x1;this[_0xdd3f('0xa')]=![];this[_0xdd3f('0xb')]=null;this[_0xdd3f('0xc')]=![];this[_0xdd3f('0xd')]=null;this[_0xdd3f('0xe')]=![];this[_0xdd3f('0xf')]=null;this[_0xdd3f('0x10')]=0x1;this[_0xdd3f('0x11')]='';this[_0xdd3f('0x12')]='';this[_0xdd3f('0x13')]='';this['accountcode']='';this[_0xdd3f('0x14')]='';this[_0xdd3f('0x15')]='';this[_0xdd3f('0x16')]='';this[_0xdd3f('0x17')]=0x0;this['assigned']=![];this[_0xdd3f('0x18')]='';this[_0xdd3f('0x19')]=0x0;this[_0xdd3f('0x1a')]={};}module[_0xdd3f('0x1b')]=QueueReport; \ No newline at end of file +var _0x2568=['queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinename','accountcode','context','exten','priority','assigned','lastAssignedTo','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon'];(function(_0x4ac8ef,_0x5c2c6e){var _0x3a9239=function(_0x3d004e){while(--_0x3d004e){_0x4ac8ef['push'](_0x4ac8ef['shift']());}};_0x3a9239(++_0x5c2c6e);}(_0x2568,0xe6));var _0x8256=function(_0x32ba2a,_0x428bd3){_0x32ba2a=_0x32ba2a-0x0;var _0x2bbb5c=_0x2568[_0x32ba2a];return _0x2bbb5c;};'use strict';function QueueReport(){this[_0x8256('0x0')]=_0x8256('0x1');this[_0x8256('0x2')]='';this[_0x8256('0x3')]='';this[_0x8256('0x4')]='';this[_0x8256('0x5')]='';this[_0x8256('0x6')]=null;this[_0x8256('0x7')]=null;this['position']=0x1;this[_0x8256('0x8')]=0x1;this[_0x8256('0x9')]=![];this[_0x8256('0xa')]=null;this[_0x8256('0xb')]=![];this[_0x8256('0xc')]=null;this['queuecallerexit']=![];this[_0x8256('0xd')]=null;this[_0x8256('0xe')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0x8256('0xf')]='';this[_0x8256('0x10')]='';this[_0x8256('0x11')]='';this[_0x8256('0x12')]='';this[_0x8256('0x13')]='';this['holdtime']=0x0;this[_0x8256('0x14')]=![];this[_0x8256('0x15')]='';this[_0x8256('0x16')]=0x0;this['variables']={};}module[_0x8256('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 686929c..cc24ea6 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 _0x9500=['Configurations','exports','name','username','remoteUri','password','type','integrationTab','serverUrl'];(function(_0x2991c7,_0x484cd2){var _0x492186=function(_0x4ad853){while(--_0x4ad853){_0x2991c7['push'](_0x2991c7['shift']());}};_0x492186(++_0x484cd2);}(_0x9500,0x110));var _0x0950=function(_0x2440e4,_0x369955){_0x2440e4=_0x2440e4-0x0;var _0x16966e=_0x9500[_0x2440e4];return _0x16966e;};'use strict';function SalesforceAccount(_0x440e66){this['id']=_0x440e66['id']||0x0;this[_0x0950('0x0')]=_0x440e66['name']||'';this[_0x0950('0x1')]=_0x440e66[_0x0950('0x1')]||'';this[_0x0950('0x2')]=_0x440e66[_0x0950('0x2')]||'';this['password']=_0x440e66[_0x0950('0x3')]||'';this['clientId']=_0x440e66['clientId']||'';this['clientSecret']=_0x440e66['clientSecret']||'';this['securityToken']=_0x440e66['securityToken']||'';this['type']=_0x440e66[_0x0950('0x4')]||_0x0950('0x5');this[_0x0950('0x6')]=_0x440e66[_0x0950('0x6')]||'';this[_0x0950('0x7')]=_0x440e66[_0x0950('0x7')]||{};}module[_0x0950('0x8')]=SalesforceAccount; \ No newline at end of file +var _0x3dbd=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x3dbd,0xeb));var _0xd3db=function(_0x483f13,_0x100cdf){_0x483f13=_0x483f13-0x0;var _0xf62bd0=_0x3dbd[_0x483f13];return _0xf62bd0;};'use strict';function SalesforceAccount(_0x5e06cd){this['id']=_0x5e06cd['id']||0x0;this[_0xd3db('0x0')]=_0x5e06cd['name']||'';this['username']=_0x5e06cd[_0xd3db('0x1')]||'';this[_0xd3db('0x2')]=_0x5e06cd[_0xd3db('0x2')]||'';this['password']=_0x5e06cd[_0xd3db('0x3')]||'';this['clientId']=_0x5e06cd[_0xd3db('0x4')]||'';this[_0xd3db('0x5')]=_0x5e06cd[_0xd3db('0x5')]||'';this[_0xd3db('0x6')]=_0x5e06cd[_0xd3db('0x6')]||'';this['type']=_0x5e06cd[_0xd3db('0x7')]||_0xd3db('0x8');this['serverUrl']=_0x5e06cd[_0xd3db('0x9')]||'';this[_0xd3db('0xa')]=_0x5e06cd[_0xd3db('0xa')]||{};}module[_0xd3db('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 39653f1..2383355 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 _0xd8fa=['name','username','password','remoteUri','Configurations','exports'];(function(_0x48736b,_0x15ab78){var _0x144d7f=function(_0x34e2eb){while(--_0x34e2eb){_0x48736b['push'](_0x48736b['shift']());}};_0x144d7f(++_0x15ab78);}(_0xd8fa,0x1c2));var _0xad8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8fa[_0x3dd15e];return _0x231fd0;};'use strict';function ServicenowAccount(_0x59e5bb){this['id']=_0x59e5bb['id']||0x0;this['name']=_0x59e5bb[_0xad8f('0x0')]||'';this[_0xad8f('0x1')]=_0x59e5bb[_0xad8f('0x1')]||'';this[_0xad8f('0x2')]=_0x59e5bb['password']||'';this[_0xad8f('0x3')]=_0x59e5bb[_0xad8f('0x3')]||'';this['serverUrl']=_0x59e5bb['serverUrl']||'';this[_0xad8f('0x4')]=_0x59e5bb[_0xad8f('0x4')]||{};}module[_0xad8f('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x68aa=['serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x3fcfb7,_0x2fbf40){var _0x3f5711=function(_0x48ec3e){while(--_0x48ec3e){_0x3fcfb7['push'](_0x3fcfb7['shift']());}};_0x3f5711(++_0x2fbf40);}(_0x68aa,0x81));var _0xa68a=function(_0x39f4f0,_0x51f74f){_0x39f4f0=_0x39f4f0-0x0;var _0x32222e=_0x68aa[_0x39f4f0];return _0x32222e;};'use strict';function ServicenowAccount(_0x4f999){this['id']=_0x4f999['id']||0x0;this[_0xa68a('0x0')]=_0x4f999['name']||'';this['username']=_0x4f999[_0xa68a('0x1')]||'';this['password']=_0x4f999['password']||'';this[_0xa68a('0x2')]=_0x4f999[_0xa68a('0x2')]||'';this[_0xa68a('0x3')]=_0x4f999[_0xa68a('0x3')]||'';this[_0xa68a('0x4')]=_0x4f999[_0xa68a('0x4')]||{};}module[_0xa68a('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index a23b35e..b1a0718 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 _0xa7f0=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x3438cf,_0x73b174){var _0x278698=function(_0xbba932){while(--_0xbba932){_0x3438cf['push'](_0x3438cf['shift']());}};_0x278698(++_0x73b174);}(_0xa7f0,0xea));var _0x0a7f=function(_0x1accac,_0x1b38de){_0x1accac=_0x1accac-0x0;var _0x14fe96=_0xa7f0[_0x1accac];return _0x14fe96;};'use strict';function SugarcrmAccount(_0xb26831){this['id']=_0xb26831['id']||0x0;this[_0x0a7f('0x0')]=_0xb26831[_0x0a7f('0x0')]||'';this[_0x0a7f('0x1')]=_0xb26831[_0x0a7f('0x1')]||'';this[_0x0a7f('0x2')]=_0xb26831[_0x0a7f('0x2')]||'';this[_0x0a7f('0x3')]=_0xb26831[_0x0a7f('0x3')]||'';this[_0x0a7f('0x4')]=_0xb26831[_0x0a7f('0x4')]||'';this[_0x0a7f('0x5')]=_0xb26831[_0x0a7f('0x5')]||{};}module[_0x0a7f('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x415a=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x415a,0x1d8));var _0xa415=function(_0x331770,_0xe508cb){_0x331770=_0x331770-0x0;var _0x5090e2=_0x415a[_0x331770];return _0x5090e2;};'use strict';function SugarcrmAccount(_0x4c254c){this['id']=_0x4c254c['id']||0x0;this[_0xa415('0x0')]=_0x4c254c[_0xa415('0x0')]||'';this[_0xa415('0x1')]=_0x4c254c[_0xa415('0x1')]||'';this[_0xa415('0x2')]=_0x4c254c[_0xa415('0x2')]||'';this[_0xa415('0x3')]=_0x4c254c[_0xa415('0x3')]||'';this['serverUrl']=_0x4c254c[_0xa415('0x4')]||'';this['Configurations']=_0x4c254c[_0xa415('0x5')]||{};}module[_0xa415('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 96dbc45..67da19d 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 _0xd7b1=['accountcode','state','unknown','stateTime','status','address','exports','name'];(function(_0x33e494,_0x2cdd4a){var _0x3d2db8=function(_0x746ade){while(--_0x746ade){_0x33e494['push'](_0x33e494['shift']());}};_0x3d2db8(++_0x2cdd4a);}(_0xd7b1,0x187));var _0x1d7b=function(_0x447820,_0x1ec383){_0x447820=_0x447820-0x0;var _0x120e63=_0xd7b1[_0x447820];return _0x120e63;};'use strict';function Telephone(_0x56dd68){this['id']=_0x56dd68['id']||0x0;this[_0x1d7b('0x0')]=_0x56dd68[_0x1d7b('0x0')]||'';this[_0x1d7b('0x1')]=_0x56dd68[_0x1d7b('0x1')]||'';this[_0x1d7b('0x2')]=_0x1d7b('0x3');this[_0x1d7b('0x4')]=0x0;this[_0x1d7b('0x5')]=_0x1d7b('0x3');this[_0x1d7b('0x6')]='';}module[_0x1d7b('0x7')]=Telephone; \ No newline at end of file +var _0xf4e0=['exports','name','accountcode','state','unknown','stateTime','status','address'];(function(_0x4e198a,_0x5a6bad){var _0xb84bfe=function(_0x58d2b2){while(--_0x58d2b2){_0x4e198a['push'](_0x4e198a['shift']());}};_0xb84bfe(++_0x5a6bad);}(_0xf4e0,0x199));var _0x0f4e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf4e0[_0x4565bf];return _0x5610ba;};'use strict';function Telephone(_0x187b23){this['id']=_0x187b23['id']||0x0;this[_0x0f4e('0x0')]=_0x187b23['name']||'';this['accountcode']=_0x187b23[_0x0f4e('0x1')]||'';this[_0x0f4e('0x2')]=_0x0f4e('0x3');this[_0x0f4e('0x4')]=0x0;this[_0x0f4e('0x5')]=_0x0f4e('0x3');this[_0x0f4e('0x6')]='';}module[_0x0f4e('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 d08e890..8788402 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 _0xf65f=['html','exports','name'];(function(_0x525b28,_0x5cf5a0){var _0x180178=function(_0x43e066){while(--_0x43e066){_0x525b28['push'](_0x525b28['shift']());}};_0x180178(++_0x5cf5a0);}(_0xf65f,0xf8));var _0xff65=function(_0x29ac36,_0x3cb511){_0x29ac36=_0x29ac36-0x0;var _0x16d3a7=_0xf65f[_0x29ac36];return _0x16d3a7;};'use strict';function template(_0x34f705){this['id']=_0x34f705['id']||0x0;this[_0xff65('0x0')]=_0x34f705[_0xff65('0x0')]||'';this[_0xff65('0x1')]=_0x34f705[_0xff65('0x1')]||'';}module[_0xff65('0x2')]=template; \ No newline at end of file +var _0xa80e=['name','html','exports'];(function(_0x5bf56a,_0x5ede61){var _0xde46d=function(_0x1e54f6){while(--_0x1e54f6){_0x5bf56a['push'](_0x5bf56a['shift']());}};_0xde46d(++_0x5ede61);}(_0xa80e,0x1a1));var _0xea80=function(_0x172ffc,_0x54d3d4){_0x172ffc=_0x172ffc-0x0;var _0x2eb5cb=_0xa80e[_0x172ffc];return _0x2eb5cb;};'use strict';function template(_0x198b51){this['id']=_0x198b51['id']||0x0;this[_0xea80('0x0')]=_0x198b51[_0xea80('0x0')]||'';this[_0xea80('0x1')]=_0x198b51['html']||'';}module[_0xea80('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index b4d57c1..5f97c34 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 _0x3e74=['Actions','name','channel','status','AllConditions','AnyConditions'];(function(_0x28b52e,_0x24239f){var _0x851751=function(_0x56e6f5){while(--_0x56e6f5){_0x28b52e['push'](_0x28b52e['shift']());}};_0x851751(++_0x24239f);}(_0x3e74,0x175));var _0x43e7=function(_0x4bc0fc,_0x7b4f1){_0x4bc0fc=_0x4bc0fc-0x0;var _0x462a7a=_0x3e74[_0x4bc0fc];return _0x462a7a;};'use strict';function Trigger(_0x284ef8){this['id']=_0x284ef8['id']||0x0;this['name']=_0x284ef8[_0x43e7('0x0')]||'';this[_0x43e7('0x1')]=_0x284ef8[_0x43e7('0x1')]||'voice';this['status']=_0x284ef8[_0x43e7('0x2')]||![];this['AllConditions']=_0x284ef8[_0x43e7('0x3')]||[];this[_0x43e7('0x4')]=_0x284ef8[_0x43e7('0x4')]||[];this[_0x43e7('0x5')]=_0x284ef8[_0x43e7('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x3e74=['Actions','name','channel','status','AllConditions','AnyConditions'];(function(_0x885722,_0x3fa2f6){var _0x406c93=function(_0x217374){while(--_0x217374){_0x885722['push'](_0x885722['shift']());}};_0x406c93(++_0x3fa2f6);}(_0x3e74,0x175));var _0x43e7=function(_0x2b8ef7,_0x7a5fd0){_0x2b8ef7=_0x2b8ef7-0x0;var _0x5b8c7b=_0x3e74[_0x2b8ef7];return _0x5b8c7b;};'use strict';function Trigger(_0x284ef8){this['id']=_0x284ef8['id']||0x0;this['name']=_0x284ef8[_0x43e7('0x0')]||'';this[_0x43e7('0x1')]=_0x284ef8[_0x43e7('0x1')]||'voice';this['status']=_0x284ef8[_0x43e7('0x2')]||![];this['AllConditions']=_0x284ef8[_0x43e7('0x3')]||[];this[_0x43e7('0x4')]=_0x284ef8[_0x43e7('0x4')]||[];this[_0x43e7('0x5')]=_0x284ef8[_0x43e7('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index e64ec6d..a52ec8c 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 _0xc627=['domainport','refresh','address','defaultuser','exports','active','state','unknown','stateTime','registry','host'];(function(_0x4f0112,_0x2d40b1){var _0x3c39cc=function(_0xc8a55a){while(--_0xc8a55a){_0x4f0112['push'](_0x4f0112['shift']());}};_0x3c39cc(++_0x2d40b1);}(_0xc627,0x1bd));var _0x7c62=function(_0x3e4a04,_0x49d3dd){_0x3e4a04=_0x3e4a04-0x0;var _0x3213f0=_0xc627[_0x3e4a04];return _0x3213f0;};'use strict';function Trunk(_0x1400fd){this['id']=_0x1400fd['id']||0x0;this[_0x7c62('0x0')]=_0x1400fd[_0x7c62('0x0')]||![];this['name']=_0x1400fd['name']||'';this[_0x7c62('0x1')]=_0x7c62('0x2');this[_0x7c62('0x3')]=0x0;this['status']=_0x7c62('0x2');this[_0x7c62('0x4')]=_0x1400fd[_0x7c62('0x4')]&&_0x1400fd[_0x7c62('0x4')]['indexOf'](':')?_0x1400fd['registry']['split'](':')[0x0]:'';this[_0x7c62('0x5')]='';this['port']='';this['domain']='';this[_0x7c62('0x6')]='';this[_0x7c62('0x7')]='';this['stateRegistry']='unknown';this['registrationtime']='';this[_0x7c62('0x8')]='';this[_0x7c62('0x9')]=_0x1400fd[_0x7c62('0x9')]||'';}module[_0x7c62('0xa')]=Trunk; \ No newline at end of file +var _0xcedb=['active','name','state','unknown','stateTime','status','registry','split','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports'];(function(_0x34be85,_0x1b36ef){var _0x1e55fe=function(_0x4bd45f){while(--_0x4bd45f){_0x34be85['push'](_0x34be85['shift']());}};_0x1e55fe(++_0x1b36ef);}(_0xcedb,0xc0));var _0xbced=function(_0x28dac7,_0x565e2b){_0x28dac7=_0x28dac7-0x0;var _0x1da96a=_0xcedb[_0x28dac7];return _0x1da96a;};'use strict';function Trunk(_0xba0095){this['id']=_0xba0095['id']||0x0;this['active']=_0xba0095[_0xbced('0x0')]||![];this[_0xbced('0x1')]=_0xba0095[_0xbced('0x1')]||'';this[_0xbced('0x2')]=_0xbced('0x3');this[_0xbced('0x4')]=0x0;this[_0xbced('0x5')]=_0xbced('0x3');this[_0xbced('0x6')]=_0xba0095[_0xbced('0x6')]&&_0xba0095[_0xbced('0x6')]['indexOf'](':')?_0xba0095[_0xbced('0x6')][_0xbced('0x7')](':')[0x0]:'';this['host']='';this['port']='';this[_0xbced('0x8')]='';this[_0xbced('0x9')]='';this[_0xbced('0xa')]='';this[_0xbced('0xb')]=_0xbced('0x3');this[_0xbced('0xc')]='';this[_0xbced('0xd')]='';this[_0xbced('0xe')]=_0xba0095[_0xbced('0xe')]||'';}module[_0xbced('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index e61dfc4..b1e9947 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 _0x53e4=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x589c46,_0x2ba026){var _0x5bfa72=function(_0x4772c8){while(--_0x4772c8){_0x589c46['push'](_0x589c46['shift']());}};_0x5bfa72(++_0x2ba026);}(_0x53e4,0x172));var _0x453e=function(_0x5d743a,_0x386cc3){_0x5d743a=_0x5d743a-0x0;var _0x2f0fec=_0x53e4[_0x5d743a];return _0x2f0fec;};'use strict';function voiceExtension(_0x3d6836){this['id']=_0x3d6836['id']||0x0;this[_0x453e('0x0')]=_0x3d6836['exten']||'';this[_0x453e('0x1')]=_0x3d6836[_0x453e('0x1')]||_0x453e('0x2');this[_0x453e('0x3')]=_0x3d6836[_0x453e('0x3')]||![];}module[_0x453e('0x4')]=voiceExtension; \ No newline at end of file +var _0xb351=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x455325,_0x20bbca){var _0x8e1d7c=function(_0x41daf4){while(--_0x41daf4){_0x455325['push'](_0x455325['shift']());}};_0x8e1d7c(++_0x20bbca);}(_0xb351,0xe5));var _0x1b35=function(_0x43536a,_0x4ffb0c){_0x43536a=_0x43536a-0x0;var _0x486730=_0xb351[_0x43536a];return _0x486730;};'use strict';function voiceExtension(_0x276d19){this['id']=_0x276d19['id']||0x0;this[_0x1b35('0x0')]=_0x276d19[_0x1b35('0x0')]||'';this[_0x1b35('0x1')]=_0x276d19[_0x1b35('0x1')]||_0x1b35('0x2');this[_0x1b35('0x3')]=_0x276d19[_0x1b35('0x3')]||![];}module[_0x1b35('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index b4c0185..0f5362c 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 _0x992d=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','wav','wav49','gsm','roundrobin','name','monitor_format','type','inbound','talking','total','sumBillable','unmanaged','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x5c1b4c,_0x3d43f5){var _0x2d008a=function(_0x39ac3f){while(--_0x39ac3f){_0x5c1b4c['push'](_0x5c1b4c['shift']());}};_0x2d008a(++_0x3d43f5);}(_0x992d,0xb6));var _0xd992=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x992d[_0x59ee6f];return _0x4c0979;};'use strict';var statusDesc=[_0xd992('0x0'),_0xd992('0x1'),_0xd992('0x2'),_0xd992('0x3'),_0xd992('0x4'),_0xd992('0x5'),_0xd992('0x6'),_0xd992('0x7'),'onhold'];var monitorFormat={'wav':_0xd992('0x8'),'wav49':_0xd992('0x9'),'gsm':_0xd992('0xa')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xd992('0xb')};function VoiceQueue(_0xbc509b){this['id']=_0xbc509b['id']||0x0;this[_0xd992('0xc')]=_0xbc509b[_0xd992('0xc')]||'';this[_0xd992('0xd')]=_0xbc509b['monitor_format']||'';this[_0xd992('0xe')]=_0xbc509b[_0xd992('0xe')]||_0xd992('0xf');this['waiting']=0x0;this[_0xd992('0x10')]=0x0;this[_0xd992('0x11')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0xd992('0x12')]=0x0;this[_0xd992('0x13')]=0x0;this[_0xd992('0x14')]=0x0;this['loggedIn']=0x0;this[_0xd992('0x15')]=0x0;this[_0xd992('0x16')]=_0xbc509b[_0xd992('0x16')]||![];this['acwTimeout']=_0xbc509b[_0xd992('0x17')]||0xa;this[_0xd992('0x18')]=_0xbc509b['autopause']||'no';this[_0xd992('0x19')]=!![];this[_0xd992('0x1a')]='';this[_0xd992('0x1b')]=0x0;this[_0xd992('0x1c')]=0x0;this[_0xd992('0x1d')]=_0xbc509b['dialTimezone']||null;this[_0xd992('0x1e')]=_0xbc509b[_0xd992('0x1e')]?_0xbc509b[_0xd992('0x1e')]:null;this['dialActive']=_0xbc509b[_0xd992('0x1f')];this[_0xd992('0x20')]=_0xbc509b['dialMethod']||_0xd992('0x21');this[_0xd992('0x22')]=_0xbc509b[_0xd992('0x22')]||0x0;this['dialLimitQueue']=_0xbc509b[_0xd992('0x23')]||0x0;this[_0xd992('0x24')]=_0xbc509b[_0xd992('0x24')]||0x1;this[_0xd992('0x25')]=_0xbc509b[_0xd992('0x25')]||_0xd992('0x26');this[_0xd992('0x27')]=_0xbc509b[_0xd992('0x27')]||0.03;this['dialPredictiveInterval']=_0xbc509b[_0xd992('0x28')]||0x258;this[_0xd992('0x29')]=_0xbc509b['dialOriginateCallerIdName']||_0xd992('0x2a');this[_0xd992('0x2b')]=_0xbc509b[_0xd992('0x2b')]||_0xd992('0x2a');this['dialOriginateTimeout']=_0xbc509b[_0xd992('0x2c')]||0x1e;this[_0xd992('0x2d')]=_0xbc509b[_0xd992('0x2d')]||_0xd992('0x2e');this[_0xd992('0x2f')]=_0xbc509b[_0xd992('0x2f')]||0x3;this[_0xd992('0x30')]=_0xbc509b[_0xd992('0x30')]||undefined;this['dialCongestionMaxRetry']=_0xbc509b[_0xd992('0x31')]||0x3;this[_0xd992('0x32')]=_0xbc509b[_0xd992('0x32')]||0x96;this['dialBusyMaxRetry']=_0xbc509b['dialBusyMaxRetry']||0x3;this[_0xd992('0x33')]=_0xbc509b['dialBusyRetryFrequency']||0x96;this[_0xd992('0x34')]=_0xbc509b['dialNoAnswerMaxRetry']||0x3;this[_0xd992('0x35')]=_0xbc509b[_0xd992('0x35')]||0x96;this[_0xd992('0x36')]=_0xbc509b[_0xd992('0x36')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0xbc509b[_0xd992('0x37')]||0x96;this[_0xd992('0x38')]=_0xbc509b[_0xd992('0x38')]||0x3;this['dialDropRetryFrequency']=_0xbc509b[_0xd992('0x39')]||0x96;this[_0xd992('0x3a')]=_0xbc509b[_0xd992('0x3a')]||0x3;this[_0xd992('0x3b')]=_0xbc509b['dialAbandonedRetryFrequency']||0x96;this[_0xd992('0x3c')]=_0xbc509b[_0xd992('0x3c')]||0x3;this[_0xd992('0x3d')]=_0xbc509b[_0xd992('0x3d')]||0x96;this[_0xd992('0x3e')]=_0xbc509b[_0xd992('0x3e')]||0x3;this[_0xd992('0x3f')]=_0xbc509b[_0xd992('0x3f')]||0x96;this['dialGlobalMaxRetry']=_0xbc509b[_0xd992('0x40')]||0x4;this[_0xd992('0x41')]=_0xbc509b['Trunk']?_0xbc509b[_0xd992('0x41')]:undefined;this[_0xd992('0x42')]=_0xbc509b[_0xd992('0x42')]?_0xbc509b[_0xd992('0x42')]:undefined;this[_0xd992('0x43')]=_0xbc509b[_0xd992('0x43')]||undefined;this[_0xd992('0x44')]=_0xbc509b[_0xd992('0x44')]?_0xbc509b[_0xd992('0x44')]:undefined;this['dialOrderByScheduledAt']=_0xbc509b[_0xd992('0x45')]||'DESC';this[_0xd992('0x46')]=_0xbc509b[_0xd992('0x46')]||undefined;this[_0xd992('0x47')]=_0xbc509b[_0xd992('0x47')]||undefined;this['strategy']=strategy[_0xbc509b[_0xd992('0x48')]]||_0xd992('0x49');this[_0xd992('0x4a')]=!![];this[_0xd992('0x4b')]=_0xbc509b[_0xd992('0x4b')]||![];this['dialAMDInitialSilence']=_0xbc509b[_0xd992('0x4c')];this[_0xd992('0x4d')]=_0xbc509b[_0xd992('0x4d')];this['dialAMDAfterGreetingSilence']=_0xbc509b['dialAMDAfterGreetingSilence'];this[_0xd992('0x4e')]=_0xbc509b[_0xd992('0x4e')];this[_0xd992('0x4f')]=_0xbc509b[_0xd992('0x4f')];this[_0xd992('0x50')]=_0xbc509b['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0xbc509b[_0xd992('0x51')];this[_0xd992('0x52')]=_0xbc509b[_0xd992('0x52')];this[_0xd992('0x53')]=_0xbc509b[_0xd992('0x53')];this[_0xd992('0x54')]=0x0;this[_0xd992('0x55')]=0x0;this[_0xd992('0x56')]=_0xbc509b[_0xd992('0x56')];this[_0xd992('0x57')]=0x0;this[_0xd992('0x58')]=0x0;this[_0xd992('0x59')]=0x0;this[_0xd992('0x5a')]=0x0;this[_0xd992('0x5b')]=0x0;this[_0xd992('0x5c')]=0x0;this[_0xd992('0x5d')]=0x0;this[_0xd992('0x5e')]=0x0;this[_0xd992('0x5f')]=0x0;this[_0xd992('0x60')]=0x0;this[_0xd992('0x61')]=0x0;this[_0xd992('0x62')]=0x0;this[_0xd992('0x63')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xd992('0x64')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0xd992('0x65')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xd992('0x66')]=0x0;this[_0xd992('0x67')]=0x0;this[_0xd992('0x68')]=0x0;this[_0xd992('0x69')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xd992('0x6a')]=0x0;this[_0xd992('0x6b')]=0x0;this['predictiveIntervalMaxThreshold']=_0xbc509b[_0xd992('0x6c')]||0x14;this['predictiveIntervalMinThreshold']=_0xbc509b['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xd992('0x6d')]=0x0;this[_0xd992('0x6e')]=0x0;this[_0xd992('0x6f')]=0x1;this[_0xd992('0x70')]=0x0;this[_0xd992('0x71')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xd992('0x72')]=0x0;this[_0xd992('0x73')]=_0xbc509b[_0xd992('0x73')]||0x1e;this['dialRecallInQueue']=_0xbc509b['dialRecallInQueue']||![];this[_0xd992('0x74')]=_0xbc509b['dialQueueProject2']||undefined;this[_0xd992('0x75')]=_0xbc509b[_0xd992('0x75')]||![];this[_0xd992('0x76')]=_0xbc509b[_0xd992('0x76')]||![];this[_0xd992('0xd')]=monitorFormat[_0xbc509b[_0xd992('0xd')]]?monitorFormat[_0xbc509b['monitor_format']]:undefined;this[_0xd992('0x77')]=_0xbc509b[_0xd992('0x77')]||![];this[_0xd992('0x78')]=_0xbc509b[_0xd992('0x78')]?_0xbc509b[_0xd992('0x78')]:undefined;}module[_0xd992('0x79')]=VoiceQueue; \ No newline at end of file +var _0xf671=['acw','acwTimeout','autopause','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDispositionPause','exports','unknown','inuse','busy','invalid','ringing','ringinuse','wav','wav49','rrmemory','roundrobin','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','sumBillable'];(function(_0x52c739,_0x34ff64){var _0x4800b6=function(_0xb9527c){while(--_0xb9527c){_0x52c739['push'](_0x52c739['shift']());}};_0x4800b6(++_0x34ff64);}(_0xf671,0xc9));var _0x1f67=function(_0xf8f29f,_0x487c16){_0xf8f29f=_0xf8f29f-0x0;var _0x5e99a6=_0xf671[_0xf8f29f];return _0x5e99a6;};'use strict';var statusDesc=[_0x1f67('0x0'),'not_inuse',_0x1f67('0x1'),_0x1f67('0x2'),_0x1f67('0x3'),'unavailable',_0x1f67('0x4'),_0x1f67('0x5'),'onhold'];var monitorFormat={'wav':_0x1f67('0x6'),'wav49':_0x1f67('0x7'),'gsm':'gsm'};var strategy={'rrmemory':_0x1f67('0x8'),'roundrobin':_0x1f67('0x9')};function VoiceQueue(_0x11d6d8){this['id']=_0x11d6d8['id']||0x0;this[_0x1f67('0xa')]=_0x11d6d8[_0x1f67('0xa')]||'';this[_0x1f67('0xb')]=_0x11d6d8[_0x1f67('0xb')]||'';this[_0x1f67('0xc')]=_0x11d6d8['type']||_0x1f67('0xd');this['waiting']=0x0;this['talking']=0x0;this[_0x1f67('0xe')]=0x0;this[_0x1f67('0xf')]=0x0;this[_0x1f67('0x10')]=0x0;this[_0x1f67('0x11')]=0x0;this[_0x1f67('0x12')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this['loggedIn']=0x0;this['available']=0x0;this[_0x1f67('0x13')]=_0x11d6d8[_0x1f67('0x13')]||![];this[_0x1f67('0x14')]=_0x11d6d8[_0x1f67('0x14')]||0xa;this[_0x1f67('0x15')]=_0x11d6d8[_0x1f67('0x15')]||'no';this['sendMessageOneNotActive']=!![];this[_0x1f67('0x16')]='';this['originated']=0x0;this[_0x1f67('0x17')]=0x0;this[_0x1f67('0x18')]=_0x11d6d8['dialTimezone']||null;this[_0x1f67('0x19')]=_0x11d6d8['dialGlobalInterval']?_0x11d6d8['dialGlobalInterval']:null;this[_0x1f67('0x1a')]=_0x11d6d8[_0x1f67('0x1a')];this['dialMethod']=_0x11d6d8[_0x1f67('0x1b')]||_0x1f67('0x1c');this[_0x1f67('0x1d')]=_0x11d6d8[_0x1f67('0x1d')]||0x0;this[_0x1f67('0x1e')]=_0x11d6d8[_0x1f67('0x1e')]||0x0;this[_0x1f67('0x1f')]=_0x11d6d8['dialPowerLevel']||0x1;this[_0x1f67('0x20')]=_0x11d6d8['dialPredictiveOptimization']||_0x1f67('0x21');this[_0x1f67('0x22')]=_0x11d6d8['dialPredictiveOptimizationPercentage']||0.03;this[_0x1f67('0x23')]=_0x11d6d8[_0x1f67('0x23')]||0x258;this[_0x1f67('0x24')]=_0x11d6d8[_0x1f67('0x24')]||_0x1f67('0x25');this['dialOriginateCallerIdNumber']=_0x11d6d8[_0x1f67('0x26')]||_0x1f67('0x25');this[_0x1f67('0x27')]=_0x11d6d8[_0x1f67('0x27')]||0x1e;this[_0x1f67('0x28')]=_0x11d6d8['dialQueueOptions']||_0x1f67('0x29');this[_0x1f67('0x2a')]=_0x11d6d8[_0x1f67('0x2a')]||0x3;this[_0x1f67('0x2b')]=_0x11d6d8[_0x1f67('0x2b')]||undefined;this[_0x1f67('0x2c')]=_0x11d6d8[_0x1f67('0x2c')]||0x3;this[_0x1f67('0x2d')]=_0x11d6d8['dialCongestionRetryFrequency']||0x96;this[_0x1f67('0x2e')]=_0x11d6d8['dialBusyMaxRetry']||0x3;this[_0x1f67('0x2f')]=_0x11d6d8[_0x1f67('0x2f')]||0x96;this[_0x1f67('0x30')]=_0x11d6d8[_0x1f67('0x30')]||0x3;this[_0x1f67('0x31')]=_0x11d6d8[_0x1f67('0x31')]||0x96;this[_0x1f67('0x32')]=_0x11d6d8[_0x1f67('0x32')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x11d6d8[_0x1f67('0x33')]||0x96;this[_0x1f67('0x34')]=_0x11d6d8[_0x1f67('0x34')]||0x3;this[_0x1f67('0x35')]=_0x11d6d8[_0x1f67('0x35')]||0x96;this[_0x1f67('0x36')]=_0x11d6d8['dialAbandonedMaxRetry']||0x3;this[_0x1f67('0x37')]=_0x11d6d8['dialAbandonedRetryFrequency']||0x96;this[_0x1f67('0x38')]=_0x11d6d8[_0x1f67('0x38')]||0x3;this[_0x1f67('0x39')]=_0x11d6d8[_0x1f67('0x39')]||0x96;this['dialAgentRejectMaxRetry']=_0x11d6d8[_0x1f67('0x3a')]||0x3;this['dialAgentRejectRetryFrequency']=_0x11d6d8['dialAgentRejectRetryFrequency']||0x96;this[_0x1f67('0x3b')]=_0x11d6d8[_0x1f67('0x3b')]||0x4;this['Trunk']=_0x11d6d8[_0x1f67('0x3c')]?_0x11d6d8[_0x1f67('0x3c')]:undefined;this['TrunkBackup']=_0x11d6d8[_0x1f67('0x3d')]?_0x11d6d8['TrunkBackup']:undefined;this[_0x1f67('0x3e')]=_0x11d6d8['dialPrefix']||undefined;this[_0x1f67('0x3f')]=_0x11d6d8[_0x1f67('0x3f')]?_0x11d6d8[_0x1f67('0x3f')]:undefined;this[_0x1f67('0x40')]=_0x11d6d8[_0x1f67('0x40')]||_0x1f67('0x41');this[_0x1f67('0x42')]=_0x11d6d8[_0x1f67('0x42')]||undefined;this[_0x1f67('0x43')]=_0x11d6d8[_0x1f67('0x43')]||undefined;this[_0x1f67('0x44')]=strategy[_0x11d6d8[_0x1f67('0x44')]]||'rrmemory';this[_0x1f67('0x45')]=!![];this[_0x1f67('0x46')]=_0x11d6d8[_0x1f67('0x46')]||![];this[_0x1f67('0x47')]=_0x11d6d8[_0x1f67('0x47')];this['dialAMDGreeting']=_0x11d6d8[_0x1f67('0x48')];this[_0x1f67('0x49')]=_0x11d6d8[_0x1f67('0x49')];this[_0x1f67('0x4a')]=_0x11d6d8['dialAMDTotalAnalysisTime'];this[_0x1f67('0x4b')]=_0x11d6d8['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x11d6d8['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x11d6d8['dialAMDMaximumNumberOfWords'];this[_0x1f67('0x4c')]=_0x11d6d8[_0x1f67('0x4c')];this[_0x1f67('0x4d')]=_0x11d6d8[_0x1f67('0x4d')];this[_0x1f67('0x4e')]=0x0;this[_0x1f67('0x4f')]=0x0;this[_0x1f67('0x50')]=_0x11d6d8['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0x1f67('0x51')]=0x0;this[_0x1f67('0x52')]=0x0;this[_0x1f67('0x53')]=0x0;this[_0x1f67('0x54')]=0x0;this[_0x1f67('0x55')]=0x0;this[_0x1f67('0x56')]=0x0;this[_0x1f67('0x57')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x1f67('0x58')]=0x0;this[_0x1f67('0x59')]=0x0;this[_0x1f67('0x5a')]=0x0;this['outboundReCallsDay']=0x0;this[_0x1f67('0x5b')]=0x0;this[_0x1f67('0x5c')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x1f67('0x5d')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x1f67('0x5e')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x1f67('0x5f')]=0x0;this[_0x1f67('0x60')]=0x0;this[_0x1f67('0x61')]=0x0;this['predictiveIntervalMaxThreshold']=_0x11d6d8['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x1f67('0x62')]=_0x11d6d8[_0x1f67('0x63')]||0xa;this[_0x1f67('0x64')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x1f67('0x65')]=0x1;this[_0x1f67('0x66')]=0x0;this[_0x1f67('0x67')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x1f67('0x68')]=0x0;this[_0x1f67('0x69')]=_0x11d6d8[_0x1f67('0x69')]||0x1e;this['dialRecallInQueue']=_0x11d6d8['dialRecallInQueue']||![];this[_0x1f67('0x6a')]=_0x11d6d8[_0x1f67('0x6a')]||undefined;this[_0x1f67('0x6b')]=_0x11d6d8['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x11d6d8['dialAgiAfterHangupAgent']||![];this[_0x1f67('0xb')]=monitorFormat[_0x11d6d8[_0x1f67('0xb')]]?monitorFormat[_0x11d6d8[_0x1f67('0xb')]]:undefined;this['mandatoryDisposition']=_0x11d6d8['mandatoryDisposition']||![];this[_0x1f67('0x6c')]=_0x11d6d8[_0x1f67('0x6c')]?_0x11d6d8[_0x1f67('0x6c')]:undefined;}module[_0x1f67('0x6d')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index edef595..d11a2b3 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 _0xd821=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x101c4d,_0x5b44e6){var _0xd0d807=function(_0x1f54b5){while(--_0x1f54b5){_0x101c4d['push'](_0x101c4d['shift']());}};_0xd0d807(++_0x5b44e6);}(_0xd821,0x1ba));var _0x1d82=function(_0x230d96,_0x2e176b){_0x230d96=_0x230d96-0x0;var _0x55c6be=_0xd821[_0x230d96];return _0x55c6be;};'use strict';function VtigerAccount(_0x3f1121){this['id']=_0x3f1121['id']||0x0;this[_0x1d82('0x0')]=_0x3f1121[_0x1d82('0x0')]||'';this[_0x1d82('0x1')]=_0x3f1121['username']||'';this[_0x1d82('0x2')]=_0x3f1121['accessKey']||'';this[_0x1d82('0x3')]=_0x3f1121[_0x1d82('0x3')]||'';this[_0x1d82('0x4')]=_0x3f1121[_0x1d82('0x4')]||'';this['Configurations']=_0x3f1121[_0x1d82('0x5')]||{};}module[_0x1d82('0x6')]=VtigerAccount; \ No newline at end of file +var _0xb25e=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x5b5cde,_0x1f7c5f){var _0x364ad2=function(_0x4a1172){while(--_0x4a1172){_0x5b5cde['push'](_0x5b5cde['shift']());}};_0x364ad2(++_0x1f7c5f);}(_0xb25e,0x1db));var _0xeb25=function(_0x317dee,_0x4d7678){_0x317dee=_0x317dee-0x0;var _0x55e187=_0xb25e[_0x317dee];return _0x55e187;};'use strict';function VtigerAccount(_0x2b17ed){this['id']=_0x2b17ed['id']||0x0;this[_0xeb25('0x0')]=_0x2b17ed[_0xeb25('0x0')]||'';this['username']=_0x2b17ed[_0xeb25('0x1')]||'';this[_0xeb25('0x2')]=_0x2b17ed[_0xeb25('0x2')]||'';this[_0xeb25('0x3')]=_0x2b17ed['remoteUri']||'';this[_0xeb25('0x4')]=_0x2b17ed[_0xeb25('0x4')]||'';this[_0xeb25('0x5')]=_0x2b17ed[_0xeb25('0x5')]||{};}module[_0xeb25('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 162a98b..8f84a50 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 _0xadb5=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0x1773ca,_0x31bfe1){_0x1773ca=_0x1773ca-0x0;var _0x4f7a44=_0xadb5[_0x1773ca];return _0x4f7a44;};'use strict';function ZendeskAccount(_0x1f969c){this['id']=_0x1f969c['id']||0x0;this[_0x5adb('0x0')]=_0x1f969c['name']||'';this[_0x5adb('0x1')]=_0x1f969c[_0x5adb('0x1')]||'';this[_0x5adb('0x2')]=_0x1f969c['password']||'';this[_0x5adb('0x3')]=_0x1f969c[_0x5adb('0x3')]||'';this[_0x5adb('0x4')]=_0x1f969c['remoteUri']||'';this[_0x5adb('0x5')]=_0x1f969c[_0x5adb('0x5')]||'';this[_0x5adb('0x6')]=_0x1f969c[_0x5adb('0x6')]||_0x5adb('0x7');this[_0x5adb('0x8')]=_0x1f969c[_0x5adb('0x8')]||'';this[_0x5adb('0x9')]=_0x1f969c[_0x5adb('0x9')]||{};}module[_0x5adb('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xdb28=['Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x27569d,_0x1949fc){_0x27569d=_0x27569d-0x0;var _0x7ec674=_0xdb28[_0x27569d];return _0x7ec674;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index c104149..c54b708 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 _0x7d8a=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x5633a5,_0x41abdc){var _0x50cad8=function(_0x2697b0){while(--_0x2697b0){_0x5633a5['push'](_0x5633a5['shift']());}};_0x50cad8(++_0x41abdc);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x7d8a[_0x53abe5];return _0xc1c37e;};'use strict';function ZohoAccount(_0xd39f07){this['id']=_0xd39f07['id']||0x0;this[_0xa7d8('0x0')]=_0xd39f07[_0xa7d8('0x0')]||'';this[_0xa7d8('0x1')]=_0xd39f07[_0xa7d8('0x1')]||'';this[_0xa7d8('0x2')]=_0xd39f07[_0xa7d8('0x2')]||'';this[_0xa7d8('0x3')]=_0xd39f07[_0xa7d8('0x3')]||'';this[_0xa7d8('0x4')]=_0xd39f07[_0xa7d8('0x4')]||'';this[_0xa7d8('0x5')]=_0xd39f07[_0xa7d8('0x5')]||'';this[_0xa7d8('0x6')]=_0xd39f07['serverUrl']||'';this[_0xa7d8('0x7')]=_0xd39f07[_0xa7d8('0x7')]||'';this[_0xa7d8('0x8')]=_0xd39f07[_0xa7d8('0x8')]||'';this[_0xa7d8('0x9')]=_0xd39f07['Configurations']||{};}module[_0xa7d8('0xa')]=ZohoAccount; \ No newline at end of file +var _0xb0ee=['refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x129a45,_0x3ee461){var _0x41d56b=function(_0x371275){while(--_0x371275){_0x129a45['push'](_0x129a45['shift']());}};_0x41d56b(++_0x3ee461);}(_0xb0ee,0x18f));var _0xeb0e=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xb0ee[_0x25d386];return _0x857f4a;};'use strict';function ZohoAccount(_0x51102b){this['id']=_0x51102b['id']||0x0;this[_0xeb0e('0x0')]=_0x51102b[_0xeb0e('0x0')]||'';this[_0xeb0e('0x1')]=_0x51102b[_0xeb0e('0x1')]||'';this[_0xeb0e('0x2')]=_0x51102b[_0xeb0e('0x2')]||'';this[_0xeb0e('0x3')]=_0x51102b[_0xeb0e('0x3')]||'';this[_0xeb0e('0x4')]=_0x51102b[_0xeb0e('0x4')]||'';this['clientSecret']=_0x51102b[_0xeb0e('0x5')]||'';this[_0xeb0e('0x6')]=_0x51102b[_0xeb0e('0x6')]||'';this[_0xeb0e('0x7')]=_0x51102b['code']||'';this[_0xeb0e('0x8')]=_0x51102b[_0xeb0e('0x8')]||'';this[_0xeb0e('0x9')]=_0x51102b[_0xeb0e('0x9')]||{};}module[_0xeb0e('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index ef20db2..deadb42 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 _0x7da1=['countnosuchnumberretry','callback','callbackat','recallme','ContactId','ListId','UserId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','util','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x608409,_0x4a4afc){var _0x4c66cc=function(_0x4b0d17){while(--_0x4b0d17){_0x608409['push'](_0x608409['shift']());}};_0x4c66cc(++_0x4a4afc);}(_0x7da1,0x1c5));var _0x17da=function(_0x4c53a5,_0x5c1ca4){_0x4c53a5=_0x4c53a5-0x0;var _0x341630=_0x7da1[_0x4c53a5];return _0x341630;};'use strict';var util=require(_0x17da('0x0'));var _=require('lodash');var moment=require(_0x17da('0x1'));function checkNameSurname(_0x45c9d9,_0x165b08,_0x27b885){var _0x3d394e='';if(!_[_0x17da('0x2')](_0x165b08)&&_0x17da('0x3')===typeof _0x165b08){_0x3d394e+=_0x165b08;}if(!_['isNil'](_0x27b885)&&_0x17da('0x3')===typeof _0x27b885){_0x3d394e+='\x20'+_0x27b885;}if(_0x3d394e!==''){return _0x3d394e;}return _0x45c9d9;}function Action(_0x419f5a,_0x33da5f,_0x1f9266,_0x435e1f,_0x28c872){this[_0x17da('0x4')]=_0x1f9266||undefined;this[_0x17da('0x5')]=_0x419f5a['id'];this[_0x17da('0x6')]=_0x33da5f[_0x17da('0x7')];this[_0x17da('0x8')]=_0x33da5f[_0x17da('0x8')];this[_0x17da('0x9')]=_0x17da('0x6');this[_0x17da('0xa')]=![];this['membername']=_[_0x17da('0x2')](_0x419f5a['Agent'])?undefined:_0x419f5a[_0x17da('0xb')][_0x17da('0x7')];this[_0x17da('0xc')]=this[_0x17da('0xd')]?util[_0x17da('0xe')](_0x17da('0xf'),this[_0x17da('0xd')]):_0x435e1f||undefined;this['calleridname']=checkNameSurname(_0x419f5a[_0x17da('0x10')][_0x17da('0x11')],_0x419f5a[_0x17da('0x10')][_0x17da('0x12')],_0x419f5a[_0x17da('0x10')][_0x17da('0x13')]);this[_0x17da('0x14')]=_0x419f5a[_0x17da('0x14')]||![];this[_0x17da('0x15')]=_0x419f5a['Contact'][_0x17da('0x11')];this[_0x17da('0x16')]=_0x419f5a[_0x17da('0x16')];this[_0x17da('0x17')]=_0x419f5a[_0x17da('0x17')]||0x0;this[_0x17da('0x18')]=_0x419f5a['countcongestionretry']||0x0;this['countnoanswerretry']=_0x419f5a[_0x17da('0x19')]||0x0;this[_0x17da('0x1a')]=(_0x419f5a['countbusyretry']||0x0)+(_0x419f5a[_0x17da('0x18')]||0x0)+(_0x419f5a[_0x17da('0x19')]||0x0)+(_0x419f5a['countnosuchnumberretry']||0x0)+(_0x419f5a[_0x17da('0x1b')]||0x0)+(_0x419f5a[_0x17da('0x1c')]||0x0)+(_0x419f5a[_0x17da('0x1d')]||0x0)+(_0x419f5a[_0x17da('0x1e')]||0x0);this[_0x17da('0x1f')]=_0x419f5a[_0x17da('0x1f')]||0x0;this[_0x17da('0x1b')]=_0x419f5a[_0x17da('0x1b')]||0x0;this[_0x17da('0x1c')]=_0x419f5a[_0x17da('0x1c')]||0x0;this['countmachineretry']=_0x419f5a[_0x17da('0x1d')]||0x0;this[_0x17da('0x1e')]=_0x419f5a[_0x17da('0x1e')]||0x0;this[_0x17da('0x20')]=_0x419f5a[_0x17da('0x20')];this['callbackuniqueid']=_0x419f5a['callbackuniqueid'];this[_0x17da('0x21')]=_0x419f5a[_0x17da('0x21')];this[_0x17da('0x22')]=_0x419f5a[_0x17da('0x22')];this[_0x17da('0x23')]=_0x419f5a[_0x17da('0x23')];this[_0x17da('0x24')]=_0x419f5a[_0x17da('0x24')];this['UserId']=_[_0x17da('0x2')](_0x419f5a[_0x17da('0xb')])?_0x419f5a[_0x17da('0x25')]:_0x419f5a[_0x17da('0xb')]['id'];this['VoiceQueueId']=_0x419f5a['VoiceQueueId'];this[_0x17da('0x26')]='';this[_0x17da('0x27')]='';}Action[_0x17da('0x28')][_0x17da('0x29')]=function(){return util[_0x17da('0xe')](_0x17da('0x2a'),this[_0x17da('0x2b')],this['number']);};module['exports']=Action; \ No newline at end of file +var _0x45b0=['countmachineretry','countagentrejectretry','callback','callbackuniqueid','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','string','isNil','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','calleridname','phone','Contact','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0xfa2742,_0x14e2ec){var _0x3d3cf2=function(_0x370776){while(--_0x370776){_0xfa2742['push'](_0xfa2742['shift']());}};_0x3d3cf2(++_0x14e2ec);}(_0x45b0,0x15d));var _0x045b=function(_0x2cb18d,_0x48dfaf){_0x2cb18d=_0x2cb18d-0x0;var _0x4b2b61=_0x45b0[_0x2cb18d];return _0x4b2b61;};'use strict';var util=require(_0x045b('0x0'));var _=require(_0x045b('0x1'));var moment=require(_0x045b('0x2'));function checkNameSurname(_0x3f3d68,_0x47df5e,_0x4c5455){var _0x34f0e3='';if(!_['isNil'](_0x47df5e)&&_0x045b('0x3')===typeof _0x47df5e){_0x34f0e3+=_0x47df5e;}if(!_[_0x045b('0x4')](_0x4c5455)&&_0x045b('0x3')===typeof _0x4c5455){_0x34f0e3+='\x20'+_0x4c5455;}if(_0x34f0e3!==''){return _0x34f0e3;}return _0x3f3d68;}function Action(_0x1edb92,_0x3b5403,_0x28616b,_0x225111,_0x5b65b2){this[_0x045b('0x5')]=_0x28616b||undefined;this[_0x045b('0x6')]=_0x1edb92['id'];this[_0x045b('0x7')]=_0x3b5403['name'];this['type']=_0x3b5403[_0x045b('0x8')];this[_0x045b('0x9')]='queue';this[_0x045b('0xa')]=![];this[_0x045b('0xb')]=_[_0x045b('0x4')](_0x1edb92[_0x045b('0xc')])?undefined:_0x1edb92['Agent']['name'];this[_0x045b('0xd')]=this['membername']?util[_0x045b('0xe')]('SIP/%s',this[_0x045b('0xb')]):_0x225111||undefined;this[_0x045b('0xf')]=checkNameSurname(_0x1edb92['Contact'][_0x045b('0x10')],_0x1edb92[_0x045b('0x11')]['firstName'],_0x1edb92[_0x045b('0x11')][_0x045b('0x12')]);this[_0x045b('0x13')]=_0x1edb92[_0x045b('0x13')]||![];this[_0x045b('0x14')]=_0x1edb92[_0x045b('0x11')][_0x045b('0x10')];this['scheduledat']=_0x1edb92[_0x045b('0x15')];this[_0x045b('0x16')]=_0x1edb92[_0x045b('0x16')]||0x0;this[_0x045b('0x17')]=_0x1edb92[_0x045b('0x17')]||0x0;this['countnoanswerretry']=_0x1edb92[_0x045b('0x18')]||0x0;this[_0x045b('0x19')]=(_0x1edb92[_0x045b('0x16')]||0x0)+(_0x1edb92[_0x045b('0x17')]||0x0)+(_0x1edb92['countnoanswerretry']||0x0)+(_0x1edb92[_0x045b('0x1a')]||0x0)+(_0x1edb92[_0x045b('0x1b')]||0x0)+(_0x1edb92[_0x045b('0x1c')]||0x0)+(_0x1edb92[_0x045b('0x1d')]||0x0)+(_0x1edb92['countagentrejectretry']||0x0);this[_0x045b('0x1a')]=_0x1edb92[_0x045b('0x1a')]||0x0;this[_0x045b('0x1b')]=_0x1edb92[_0x045b('0x1b')]||0x0;this['countabandonedretry']=_0x1edb92[_0x045b('0x1c')]||0x0;this['countmachineretry']=_0x1edb92[_0x045b('0x1d')]||0x0;this['countagentrejectretry']=_0x1edb92[_0x045b('0x1e')]||0x0;this[_0x045b('0x1f')]=_0x1edb92[_0x045b('0x1f')];this['callbackuniqueid']=_0x1edb92[_0x045b('0x20')];this['callbackat']=_0x1edb92['callbackat'];this['recallme']=_0x1edb92['recallme'];this[_0x045b('0x21')]=_0x1edb92[_0x045b('0x21')];this[_0x045b('0x22')]=_0x1edb92[_0x045b('0x22')];this['UserId']=_['isNil'](_0x1edb92[_0x045b('0xc')])?_0x1edb92[_0x045b('0x23')]:_0x1edb92[_0x045b('0xc')]['id'];this[_0x045b('0x24')]=_0x1edb92['VoiceQueueId'];this['originatecalleridnum']='';this[_0x045b('0x25')]='';}Action[_0x045b('0x26')]['getCaller']=function(){return util[_0x045b('0xe')](_0x045b('0x27'),this[_0x045b('0xf')],this[_0x045b('0x28')]);};module[_0x045b('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 374895d..39b878c 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 _0xd58c=['IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','decrementTalkink','[16]','countglobal','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','Busy','busy','[callProgressDetectingCustomer][logBusy]','Global','countbusyretry','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','unlockAgent','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','callProgressDetectingAgent','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','lookAgent','isEmpty','idContact','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','Contact.phone','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialCutDigit','substring','SIP/%s/%s%s','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridNumber','addVariables','merge','toLowerVariables','Action','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking][cause]','cause','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','syncVarSet','variable','keys','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','moment','ioredis','../../../config/logger','preview','actionPreview','../ami','./util/util','redis','defaults','localhost','prototype','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hanguprequest','syncHangupRequest','syncDialEnd','newexten','varset','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','type','name','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','paused','NOT_ACTIVE','IS_DISACTIVED','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','campaignsPreview','hasOwnProperty','dialMethod','booked','outbound','setMessage','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','status','channel','catch','message','updateOriginated','[clearZombieChannel]','dialAnswer','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]'];(function(_0x4b8b8d,_0x20d376){var _0x1c4d47=function(_0x4df716){while(--_0x4df716){_0x4b8b8d['push'](_0x4b8b8d['shift']());}};_0x1c4d47(++_0x20d376);}(_0xd58c,0xb6));var _0xcd58=function(_0x2430f6,_0x128e37){_0x2430f6=_0x2430f6-0x0;var _0x3c43dd=_0xd58c[_0x2430f6];return _0x3c43dd;};'use strict';var util=require(_0xcd58('0x0'));var _=require(_0xcd58('0x1'));var BPromise=require(_0xcd58('0x2'));var uuid=require('uuid');var moment=require(_0xcd58('0x3'));var md5=require('md5');var Redis=require(_0xcd58('0x4'));var config=require('../../../config/environment');var logger=require(_0xcd58('0x5'))(_0xcd58('0x6'));var loggerAction=require(_0xcd58('0x5'))(_0xcd58('0x7'));var ami=require(_0xcd58('0x8'));var rpcDb=require('./rpcDb');var Action=require('./action');var ut=require(_0xcd58('0x9'));config[_0xcd58('0xa')]=_[_0xcd58('0xb')](config[_0xcd58('0xa')],{'host':_0xcd58('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcd58('0xa')]));var Sequence=function(){};Sequence[_0xcd58('0xd')]['enqueue']=function(_0x1e6f95){this['tail']=this[_0xcd58('0xe')]?this[_0xcd58('0xe')][_0xcd58('0xf')](_0x1e6f95):_0x1e6f95();};function Preview(_0x4f95e9){this[_0xcd58('0x10')]=new Sequence();this['campaignsPreview']=_0x4f95e9[_0xcd58('0x11')];this['trunks']=_0x4f95e9[_0xcd58('0x12')];this[_0xcd58('0x13')]={};this[_0xcd58('0x14')]=_0x4f95e9[_0xcd58('0x14')];this[_0xcd58('0x15')]=0x0;ami['on'](_0xcd58('0x16'),this[_0xcd58('0x17')][_0xcd58('0x18')](this));ami['on']('hangup',this['syncHangup'][_0xcd58('0x18')](this));ami['on'](_0xcd58('0x19'),this[_0xcd58('0x1a')]['bind'](this));ami['on']('dialend',this[_0xcd58('0x1b')][_0xcd58('0x18')](this));ami['on'](_0xcd58('0x1c'),this['syncNewExten']['bind'](this));ami['on'](_0xcd58('0x1d'),this['syncVarSet'][_0xcd58('0x18')](this));ami['on'](_0xcd58('0x1e'),this[_0xcd58('0x1f')][_0xcd58('0x18')](this));ami['on']('blindtransfer',this[_0xcd58('0x20')]['bind'](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x503c5,_0x1e6ce7,_0x44b002){io['to'](_0x503c5)['emit'](_0x1e6ce7,_0x44b002);}function emitCampaignPreview(_0xb7325f){if(_0xb7325f[_0xcd58('0x21')]==='outbound'){var _0x18f953={'id':_0xb7325f['id'],'name':_0xb7325f[_0xcd58('0x22')],'strategy':_0xb7325f[_0xcd58('0x23')],'answered':_0xb7325f['answered'],'available':_0xb7325f['available'],'loggedIn':_0xb7325f[_0xcd58('0x24')],'pTalking':_0xb7325f[_0xcd58('0x25')],'sumBillable':_0xb7325f[_0xcd58('0x26')],'sumDuration':_0xb7325f[_0xcd58('0x27')],'sumHoldTime':_0xb7325f[_0xcd58('0x28')]||0x0,'talking':_0xb7325f[_0xcd58('0x29')],'total':_0xb7325f[_0xcd58('0x2a')],'type':_0xb7325f['type'],'unmanaged':_0xb7325f['unmanaged'],'abandoned':_0xb7325f[_0xcd58('0x2b')],'waiting':_0xb7325f[_0xcd58('0x2c')],'loggedInDb':_0xb7325f['loggedInDb'],'dialActive':_0xb7325f[_0xcd58('0x2d')],'dialMethod':_0xb7325f['dialMethod'],'dialOriginateCallerIdName':_0xb7325f[_0xcd58('0x2e')],'dialOriginateCallerIdNumber':_0xb7325f[_0xcd58('0x2f')],'dialOriginateTimeout':_0xb7325f[_0xcd58('0x30')],'dialPrefix':_0xb7325f[_0xcd58('0x31')],'outboundAnswerAgiCallsDay':_0xb7325f[_0xcd58('0x32')],'outboundAnswerCallsDay':_0xb7325f[_0xcd58('0x33')],'outboundBlacklistCallsDay':_0xb7325f['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0xb7325f[_0xcd58('0x34')],'outboundCongestionCallsDay':_0xb7325f['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0xb7325f[_0xcd58('0x35')],'outboundDropCallsDayCallersExit':_0xb7325f['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0xb7325f[_0xcd58('0x36')],'outboundNoAnswerCallsDay':_0xb7325f['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0xb7325f[_0xcd58('0x37')],'outboundOriginateFailureCallsDay':_0xb7325f['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0xb7325f[_0xcd58('0x38')],'outboundRejectCallsDay':_0xb7325f[_0xcd58('0x39')],'outboundUnknownCallsDay':_0xb7325f[_0xcd58('0x3a')],'outboundAbandonedCallsDay':_0xb7325f[_0xcd58('0x3b')],'predictiveIntervalAnsweredCalls':_0xb7325f['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xb7325f[_0xcd58('0x3c')],'predictiveIntervalAvgTalktime':_0xb7325f['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0xb7325f[_0xcd58('0x3d')],'predictiveIntervalDroppedCallsTimeout':_0xb7325f[_0xcd58('0x3e')],'predictiveIntervalErlangCalls':_0xb7325f[_0xcd58('0x3f')],'predictiveIntervalErlangCallsDroppedCalls':_0xb7325f[_0xcd58('0x40')],'predictiveIntervalHitRate':_0xb7325f[_0xcd58('0x41')],'predictiveIntervalMultiplicativeFactor':_0xb7325f[_0xcd58('0x42')],'predictiveIntervalPauses':_0xb7325f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xb7325f['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0xb7325f[_0xcd58('0x43')],'message':_0xb7325f['message'],'originated':_0xb7325f['originated'],'erlangCalls':_0xb7325f[_0xcd58('0x44')],'erlangCallToSecond':_0xb7325f[_0xcd58('0x45')],'erlangAbandonmentRate':_0xb7325f[_0xcd58('0x46')],'erlangBusyFactor':_0xb7325f[_0xcd58('0x47')],'startPredictive':_0xb7325f[_0xcd58('0x48')],'startProgressive':_0xb7325f[_0xcd58('0x49')]};if(_0xb7325f['Trunk']){_0x18f953['Trunk']={'id':_0xb7325f[_0xcd58('0x4a')]['id'],'name':_0xb7325f[_0xcd58('0x4a')][_0xcd58('0x22')],'active':_0xb7325f['Trunk'][_0xcd58('0x4b')],'callerid':_0xb7325f[_0xcd58('0x4a')][_0xcd58('0x4c')]};}if(_0xb7325f['Interval']){_0x18f953['Interval']={'id':_0xb7325f[_0xcd58('0x4d')]['id'],'name':_0xb7325f[_0xcd58('0x4d')][_0xcd58('0x22')]};}var _0x354924=md5(JSON[_0xcd58('0x4e')](_0x18f953));if(_0xb7325f[_0xcd58('0x4f')]!==_0x354924){_0xb7325f[_0xcd58('0x4f')]=_0x354924;emit(util[_0xcd58('0x50')](_0xcd58('0x51'),_0x18f953[_0xcd58('0x22')]),_0xcd58('0x52'),_0x18f953);}}}function emitVoiceQueueChannelRemove(_0x37e840){logger[_0xcd58('0x53')](_0xcd58('0x54'),JSON[_0xcd58('0x4e')](_0x37e840));emit(util[_0xcd58('0x50')](_0xcd58('0x51'),_0x37e840[_0xcd58('0x22')]),_0xcd58('0x55'),_0x37e840);io[_0xcd58('0x56')](_0xcd58('0x57'),_0x37e840);}function notSendMessagesQueue(_0x5cd1eb){if(_0x5cd1eb[_0xcd58('0x58')]){if(_0x5cd1eb[_0xcd58('0x59')]===0x0&&_0x5cd1eb[_0xcd58('0x25')]===0x0){_0x5cd1eb['sendMessageOneNotActive']=![];_0x5cd1eb[_0xcd58('0x5a')]=0x0;_0x5cd1eb[_0xcd58('0x5b')]=0x0;_0x5cd1eb['message']=_0xcd58('0x5c');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x5cd1eb[_0xcd58('0x22')]+'\x20is\x20not\x20active');}else{_0x5cd1eb['message']=_0xcd58('0x5d');ut[_0xcd58('0x5e')](_0xcd58('0x5f'),_0x5cd1eb['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x5cd1eb);}}Preview[_0xcd58('0xd')]['loopCampaigns']=function(){var _0x3ab135=this;setInterval(function(){_0x3ab135[_0xcd58('0x60')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x1f5e98=this[_0xcd58('0x61')];this[_0xcd58('0x15')]+=0x1;for(var _0x3ac023 in _0x1f5e98){if(_0x1f5e98[_0xcd58('0x62')](_0x3ac023)&&(_0x1f5e98[_0x3ac023][_0xcd58('0x63')]===_0xcd58('0x6')||_0x1f5e98[_0x3ac023][_0xcd58('0x63')]===_0xcd58('0x64'))&&_0x1f5e98[_0x3ac023][_0xcd58('0x21')]===_0xcd58('0x65')){if(this[_0xcd58('0x15')]>0x7){this[_0xcd58('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x1f5e98[_0xcd58('0x62')](_0x3ac023)&&_0x1f5e98[_0x3ac023][_0xcd58('0x63')]===_0xcd58('0x6')&&_0x1f5e98[_0x3ac023]['type']===_0xcd58('0x65')){if(_0x1f5e98[_0x3ac023][_0xcd58('0x2d')]){this[_0xcd58('0x66')](_0x1f5e98[_0x3ac023]);this[_0xcd58('0x67')](_0x1f5e98[_0x3ac023]);}else{notSendMessagesQueue(_0x1f5e98[_0x3ac023]);}}}};Preview['prototype'][_0xcd58('0x68')]=function(_0x26dd8f){var _0x16be8c=this;this[_0xcd58('0x10')][_0xcd58('0x69')](function(){if(!_[_0xcd58('0x6a')](_0x16be8c[_0xcd58('0x13')][_0x26dd8f])){loggerAction[_0xcd58('0x53')](_0xcd58('0x6b'),_0x26dd8f,_0xcd58('0x6c'),_0x16be8c['actions'][_0x26dd8f][_0xcd58('0x6d')],_0xcd58('0x6e'),JSON[_0xcd58('0x4e')](_0x16be8c[_0xcd58('0x61')][_0x16be8c[_0xcd58('0x13')][_0x26dd8f][_0xcd58('0x6d')]][_0xcd58('0x59')]),_0xcd58('0x6f'),JSON[_0xcd58('0x4e')](_0x16be8c[_0xcd58('0x61')][_0x16be8c[_0xcd58('0x13')][_0x26dd8f][_0xcd58('0x6d')]]['pTalking']),JSON[_0xcd58('0x4e')](_0x16be8c[_0xcd58('0x13')][_0x26dd8f]['dialAnswer']),JSON[_0xcd58('0x4e')](_[_0xcd58('0x70')](_0x16be8c[_0xcd58('0x13')][_0x26dd8f],[_0xcd58('0x71'),_0xcd58('0x72'),_0xcd58('0x73'),'ListId'])));return ami['Action']({'action':_0xcd58('0x74'),'channel':_0x16be8c['actions'][_0x26dd8f][_0xcd58('0x75')]})[_0xcd58('0x76')](function(_0x3eb747){if(_0x3eb747[_0xcd58('0x77')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x16be8c['actions'][_0x26dd8f]){ut[_0xcd58('0x78')](_0x16be8c['campaignsPreview'][_0x16be8c['actions'][_0x26dd8f][_0xcd58('0x6d')]],_0xcd58('0x79'));if(_0x16be8c[_0xcd58('0x13')][_0x26dd8f][_0xcd58('0x7a')]===!![]){ut['decrementTalkink'](_0x16be8c[_0xcd58('0x61')][_0x16be8c['actions'][_0x26dd8f]['queue']],_0xcd58('0x79'));ut[_0xcd58('0x7b')]('[Dialer][checkChannel][pTalking][Preview]'+_0x26dd8f,_0x16be8c[_0xcd58('0x13')][_0x26dd8f]['queue']);}ut[_0xcd58('0x7b')](_0xcd58('0x7c')+_0x26dd8f,_0x16be8c[_0xcd58('0x13')][_0x26dd8f][_0xcd58('0x6d')]);delete _0x16be8c[_0xcd58('0x13')][_0x26dd8f];}},0x2328);}});}});};Preview[_0xcd58('0xd')][_0xcd58('0x7d')]=function(){var _0xe1a29a=this;loggerAction[_0xcd58('0x53')](_0xcd58('0x7e'),_[_0xcd58('0x7f')](this[_0xcd58('0x13')]));for(var _0x532af6 in this[_0xcd58('0x13')]){if(_0xe1a29a['actions'][_0xcd58('0x62')](_0x532af6)){_0xe1a29a[_0xcd58('0x68')](_0x532af6);}}};Preview[_0xcd58('0xd')][_0xcd58('0x67')]=function(_0x4fc347){var _0x3d2fe7=this;rpcDb[_0xcd58('0x80')](_0x4fc347['id'],ut[_0xcd58('0x81')](this[_0xcd58('0x14')]))['then'](function(_0x5ab979){if(!_[_0xcd58('0x6a')](_0x5ab979)){for(var _0x386388=0x0;_0x386388<_0x5ab979[_0xcd58('0x82')];_0x386388+=0x1){if(ut[_0xcd58('0x83')](_0x5ab979[_0x386388][_0xcd58('0x84')])<_0x4fc347[_0xcd58('0x85')]*0x3c){if(_0x5ab979[_0x386388][_0xcd58('0x86')]&&!_0x5ab979[_0x386388]['Agent'][_0xcd58('0x87')]){_0x3d2fe7[_0xcd58('0x88')](_0x5ab979[_0x386388]['id'])[_0xcd58('0x89')](ut[_0xcd58('0x8a')](_0xcd58('0x8b')))[_0xcd58('0x76')](ut[_0xcd58('0x8a')](_0xcd58('0x8b')));}else{rpcDb[_0xcd58('0x8c')](_0x5ab979[_0x386388]['id']);}}else{var _0x2d16d0=new Action(_0x5ab979[_0x386388],_0x4fc347);_0x2d16d0[_0xcd58('0x8d')]=moment()[_0xcd58('0x50')](_0xcd58('0x8e'));_0x4fc347[_0xcd58('0x38')]+=0x1;ut[_0xcd58('0x8f')](_0x2d16d0,0x17,_0xcd58('0x90'));if(_0x4fc347[_0xcd58('0x91')]){rpcDb['rescheduleContactInQueue'](ut[_0xcd58('0x92')](_0x5ab979[_0x386388]));rpcDb[_0xcd58('0x93')](_0x2d16d0,_0xcd58('0x94'));}else{ut[_0xcd58('0x8f')](_0x2d16d0,0x16,'RecallFailedTimeout');rpcDb[_0xcd58('0x93')](_0x2d16d0,_0xcd58('0x95'));rpcDb[_0xcd58('0x96')](_0x2d16d0,_0xcd58('0x95'));}}}}})[_0xcd58('0x76')](ut['logger2'](_0xcd58('0x97')));};Preview[_0xcd58('0xd')][_0xcd58('0x66')]=function(_0x1cc739){_0x1cc739[_0xcd58('0x58')]=!![];if(ut[_0xcd58('0x98')](_0x1cc739[_0xcd58('0x24')])){_0x1cc739[_0xcd58('0x77')]=_0xcd58('0x99');}else if(!ut[_0xcd58('0x9a')](_0x1cc739['dialActive'])){_0x1cc739['message']=_0xcd58('0x5c');}else if(!this[_0xcd58('0x9b')](_0x1cc739[_0xcd58('0x4a')])){if(!this['isTrunkReachable'](_0x1cc739[_0xcd58('0x9c')])){_0x1cc739[_0xcd58('0x77')]='TRUNK_IS_NOT_REACHABLE';}else{_0x1cc739[_0xcd58('0x77')]=_0xcd58('0x9d');}}else{_0x1cc739[_0xcd58('0x77')]=_0xcd58('0x9d');}emitCampaignPreview(_0x1cc739);};Preview[_0xcd58('0xd')][_0xcd58('0x9e')]=function(_0xab6ee,_0x75aa96,_0x4dd355){var _0x56e190=this;var _0x104aa2=this['actions'][_0x75aa96];var _0x33807d=this['campaignsPreview'][_0x104aa2[_0xcd58('0x6d')]];var _0x1e6d77;if(_0x33807d){switch(_0x4dd355){case'1':_0x33807d[_0xcd58('0x37')]+=0x1;_0x104aa2[_0xcd58('0x9f')]+=0x1;_0x104aa2['countglobal']=ut[_0xcd58('0xa0')](_0x104aa2);ut[_0xcd58('0x8f')](_0x104aa2,0x0,'NoSuchNumber');ami[_0xcd58('0x56')](_0xcd58('0xa1'),ut[_0xcd58('0xa2')](_0x104aa2,_0xcd58('0xa3')));rpcDb['createCustomerHistory'](_0x104aa2,_0xcd58('0xa4'));if(ut[_0xcd58('0xa0')](_0x104aa2)>=_0x33807d[_0xcd58('0xa5')]){_0x1e6d77=ut[_0xcd58('0xa6')](_0x104aa2,0xf,'Global');rpcDb[_0xcd58('0x96')](_0x1e6d77,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x104aa2[_0xcd58('0x9f')]>=_0x33807d[_0xcd58('0xa7')]){rpcDb[_0xcd58('0x96')](_0x104aa2,_0xcd58('0xa8'));}else{rpcDb[_0xcd58('0xa9')](ut['scheduledAt'](_0x104aa2,_0xcd58('0x9f'),_0x33807d[_0xcd58('0xaa')]),_0x104aa2['unlockAgent'],_0x104aa2[_0xcd58('0xab')]);}}delete this['actions'][_0xab6ee[_0xcd58('0xac')]];break;case _0xcd58('0xad'):var _0x150792=moment()[_0xcd58('0x50')](_0xcd58('0x8e'));_0x104aa2[_0xcd58('0xae')]=_0x150792;_0x104aa2[_0xcd58('0xaf')]=_0x150792;_0x104aa2['dialAnswer']=!![];_0x33807d[_0xcd58('0x25')]+=0x1;logger[_0xcd58('0x53')](_0xcd58('0xb0'),_0x104aa2[_0xcd58('0xb1')],_0xcd58('0xb2'),_0x33807d[_0xcd58('0x22')],_0xcd58('0x6f'),_0x33807d[_0xcd58('0x25')]);ami[_0xcd58('0x56')](_0xcd58('0xb3'),ut[_0xcd58('0xa2')](_0x104aa2,_0xcd58('0xb4'),this['campaignsPreview'][_0x104aa2['queue']]));if(_0x33807d[_0xcd58('0xb5')]){ami[_0xcd58('0x56')](_0xcd58('0xb6'),ut[_0xcd58('0xb7')](_0x104aa2));}break;case'16':ami[_0xcd58('0x56')](_0xcd58('0xb8'),ut[_0xcd58('0xa2')](_0x104aa2,'complete',this[_0xcd58('0x61')][_0x104aa2[_0xcd58('0x6d')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x104aa2,_0xcd58('0xb9')));_0x33807d[_0xcd58('0x33')]+=0x1;_0x33807d[_0xcd58('0x2a')]+=0x1;_0x33807d[_0xcd58('0xba')]+=0x1;ut[_0xcd58('0xbb')](_0x33807d,_0xcd58('0xbc'));_0x104aa2[_0xcd58('0xbd')]=ut[_0xcd58('0xa0')](_0x104aa2);ut[_0xcd58('0x8f')](_0x104aa2,0x4,'Answer');rpcDb['createCustomerHistory'](_0x104aa2,_0xcd58('0xbe'));rpcDb['createCustomerFinal'](_0x104aa2,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xcd58('0xbf')](_0x104aa2);_0x33807d['sumDuration']+=_0x104aa2[_0xcd58('0xc0')];_0x33807d[_0xcd58('0x26')]+=_0x104aa2[_0xcd58('0xc0')];logger[_0xcd58('0x53')](_0xcd58('0xc1'),_0x104aa2['uniqueid'],'\x20Queue',_0x33807d['name'],_0xcd58('0x6f'),_0x33807d[_0xcd58('0x25')]);delete this['actions'][_0xab6ee[_0xcd58('0xac')]];break;case _0xcd58('0xc2'):_0x33807d[_0xcd58('0x34')]+=0x1;_0x104aa2['countbusyretry']+=0x1;_0x104aa2['countglobal']=ut[_0xcd58('0xa0')](_0x104aa2);ut[_0xcd58('0x8f')](_0x104aa2,0x5,_0xcd58('0xc3'));ami[_0xcd58('0x56')]('custom:agentbusy',ut[_0xcd58('0xa2')](_0x104aa2,_0xcd58('0xc4')));rpcDb[_0xcd58('0x93')](_0x104aa2,_0xcd58('0xc5'));if(ut['totalGlobal'](_0x104aa2)>=_0x33807d['dialGlobalMaxRetry']){_0x1e6d77=ut[_0xcd58('0xa6')](_0x104aa2,0xf,_0xcd58('0xc6'));rpcDb[_0xcd58('0x96')](_0x1e6d77,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x104aa2[_0xcd58('0xc7')]>=_0x33807d[_0xcd58('0xc8')]){rpcDb[_0xcd58('0x96')](_0x104aa2,_0xcd58('0xc5'));}else{rpcDb[_0xcd58('0xa9')](ut[_0xcd58('0xc9')](_0x104aa2,_0xcd58('0xc7'),_0x33807d[_0xcd58('0xca')]),_0x104aa2[_0xcd58('0xcb')],_0x104aa2[_0xcd58('0xab')]);}}break;case'NOANSWER':_0x33807d[_0xcd58('0xcc')]+=0x1;_0x104aa2[_0xcd58('0xcd')]+=0x1;_0x104aa2[_0xcd58('0xbd')]=ut[_0xcd58('0xa0')](_0x104aa2);ut[_0xcd58('0x8f')](_0x104aa2,0x3,_0xcd58('0xce'));ami['emit'](_0xcd58('0xcf'),ut[_0xcd58('0xa2')](_0x104aa2,_0xcd58('0xd0')));rpcDb[_0xcd58('0x93')](_0x104aa2,_0xcd58('0xd1'));if(ut[_0xcd58('0xa0')](_0x104aa2)>=_0x33807d[_0xcd58('0xa5')]){_0x1e6d77=ut[_0xcd58('0xa6')](_0x104aa2,0xf,_0xcd58('0xc6'));rpcDb[_0xcd58('0x96')](_0x1e6d77,_0xcd58('0xd2'));}else{if(_0x104aa2[_0xcd58('0xcd')]>=_0x33807d[_0xcd58('0xd3')]){rpcDb[_0xcd58('0x96')](_0x104aa2,_0xcd58('0xd1'));}else{rpcDb[_0xcd58('0xa9')](ut['scheduledAt'](_0x104aa2,'countnoanswerretry',_0x33807d[_0xcd58('0xd4')]),_0x104aa2[_0xcd58('0xcb')],_0x104aa2['activeContact']);}}break;case _0xcd58('0xd5'):_0x33807d[_0xcd58('0xd6')]+=0x1;_0x104aa2[_0xcd58('0xd7')]+=0x1;_0x104aa2[_0xcd58('0xbd')]=ut[_0xcd58('0xa0')](_0x104aa2);ut[_0xcd58('0x8f')](_0x104aa2,0x8,_0xcd58('0xd8'));ami[_0xcd58('0x56')](_0xcd58('0xd9'),ut[_0xcd58('0xa2')](_0x104aa2,_0xcd58('0xda')));rpcDb[_0xcd58('0x93')](_0x104aa2,'[callProgressDetectingCustomer][logCongestion]');if(ut['totalGlobal'](_0x104aa2)>=_0x33807d[_0xcd58('0xa5')]){_0x1e6d77=ut['cloneAction'](_0x104aa2,0xf,_0xcd58('0xc6'));rpcDb[_0xcd58('0x96')](_0x1e6d77,_0xcd58('0xdb'));}else{if(_0x104aa2['countcongestionretry']>=_0x33807d[_0xcd58('0xdc')]){rpcDb[_0xcd58('0x96')](_0x104aa2,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0xcd58('0xc9')](_0x104aa2,_0xcd58('0xd7'),_0x33807d['dialBusyRetryFrequency']),_0x104aa2[_0xcd58('0xcb')],_0x104aa2[_0xcd58('0xab')]);}}break;case _0xcd58('0xdd'):_0x33807d[_0xcd58('0x39')]+=0x1;_0x104aa2[_0xcd58('0xde')]+=0x1;_0x104aa2[_0xcd58('0xbd')]=ut[_0xcd58('0xa0')](_0x104aa2);ut[_0xcd58('0x8f')](_0x104aa2,0x14,'AgentReject');ami['emit'](_0xcd58('0xdf'),ut['buildObj'](_0x104aa2,_0xcd58('0xe0')));rpcDb[_0xcd58('0x93')](_0x104aa2,_0xcd58('0xe1'));if(ut[_0xcd58('0xa0')](_0x104aa2)>=_0x33807d[_0xcd58('0xa5')]){_0x1e6d77=ut[_0xcd58('0xa6')](_0x104aa2,0x14,_0xcd58('0xe2'));rpcDb['createCustomerFinal'](_0x1e6d77,_0xcd58('0xe3'));}else{if(_0x104aa2[_0xcd58('0xde')]>=_0x33807d[_0xcd58('0xe4')]){rpcDb[_0xcd58('0x96')](_0x104aa2,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xcd58('0xa9')](ut[_0xcd58('0xc9')](_0x104aa2,_0xcd58('0xde'),_0x33807d['dialAgentRejectRetryFrequency']),_0x104aa2[_0xcd58('0xcb')],_0x104aa2[_0xcd58('0xab')]);}}break;case _0xcd58('0xe5'):_0x33807d[_0xcd58('0x3b')]+=0x1;_0x104aa2[_0xcd58('0xe6')]+=0x1;_0x104aa2[_0xcd58('0xbd')]=ut[_0xcd58('0xa0')](_0x104aa2);ut[_0xcd58('0x8f')](_0x104aa2,0xb,_0xcd58('0xe7'));rpcDb[_0xcd58('0x93')](_0x104aa2,_0xcd58('0xe8'));if(ut[_0xcd58('0xa0')](_0x104aa2)>=_0x33807d['dialGlobalMaxRetry']){_0x1e6d77=ut[_0xcd58('0xa6')](_0x104aa2,0xf,_0xcd58('0xc6'));rpcDb[_0xcd58('0x96')](_0x1e6d77,_0xcd58('0xe8'));}else{if(_0x104aa2[_0xcd58('0xe9')]>=_0x33807d[_0xcd58('0xea')]){rpcDb['createCustomerFinal'](_0x104aa2,_0xcd58('0xe8'));}else{rpcDb[_0xcd58('0xa9')](ut[_0xcd58('0xc9')](_0x104aa2,'countabandonedretry',_0x33807d[_0xcd58('0xeb')]),_0x104aa2[_0xcd58('0xcb')],_0x104aa2[_0xcd58('0xab')]);}}break;case'18':_0x33807d[_0xcd58('0x3a')]+=0x1;_0x104aa2[_0xcd58('0xec')]+=0x1;_0x104aa2[_0xcd58('0xbd')]=ut[_0xcd58('0xa0')](_0x104aa2);ut['logCustomer'](_0x104aa2,0x12,_0xab6ee[_0xcd58('0xed')]||_0xab6ee['dialstatus']);ami[_0xcd58('0x56')](_0xcd58('0xee'),ut['buildObj'](_0x104aa2,_0xcd58('0xef')));rpcDb[_0xcd58('0x93')](_0x104aa2,_0xcd58('0xf0'));if(ut['totalGlobal'](_0x104aa2)>=_0x33807d[_0xcd58('0xa5')]){_0x1e6d77=ut[_0xcd58('0xa6')](_0x104aa2,0xf,'Global');rpcDb[_0xcd58('0x96')](_0x1e6d77,_0xcd58('0xf0'));}else{rpcDb[_0xcd58('0x96')](_0x104aa2,_0xcd58('0xf0'));}delete this['actions'][_0xab6ee[_0xcd58('0xac')]];break;case'19':_0x33807d[_0xcd58('0x3a')]+=0x1;_0x104aa2[_0xcd58('0xbd')]=ut[_0xcd58('0xa0')](_0x104aa2);ut[_0xcd58('0x8f')](_0x104aa2,0x13,_0xab6ee[_0xcd58('0xed')]||_0xab6ee['dialstatus']);ami[_0xcd58('0x56')](_0xcd58('0xee'),ut['buildObj'](_0x104aa2,_0xcd58('0xef')));rpcDb[_0xcd58('0x93')](_0x104aa2,_0xcd58('0xf1'));if(ut['totalGlobal'](_0x104aa2)>=_0x33807d[_0xcd58('0xa5')]){_0x1e6d77=ut[_0xcd58('0xa6')](_0x104aa2,0xf,_0xcd58('0xc6'));rpcDb[_0xcd58('0x96')](_0x1e6d77,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xcd58('0x96')](_0x104aa2,_0xcd58('0xf1'));}delete this[_0xcd58('0x13')][_0xab6ee[_0xcd58('0xac')]];break;default:if(_0x104aa2[_0xcd58('0x7a')]){ut['decrementTalkink'](_0x33807d,_0xcd58('0xf2'));ut[_0xcd58('0x7b')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x33807d['name'],_0xab6ee);}_0x33807d[_0xcd58('0x3a')]+=0x1;_0x104aa2[_0xcd58('0xbd')]=ut[_0xcd58('0xa0')](_0x104aa2);ut['logCustomer'](_0x104aa2,0xc,_0xab6ee['cause-txt']||_0xab6ee[_0xcd58('0xf3')]);rpcDb[_0xcd58('0x93')](_0x104aa2,_0xcd58('0xf4'));if(ut[_0xcd58('0xa0')](_0x104aa2)>=_0x33807d[_0xcd58('0xa5')]){_0x1e6d77=ut[_0xcd58('0xa6')](_0x104aa2,0xf,_0xcd58('0xc6'));rpcDb[_0xcd58('0x96')](_0x1e6d77,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xcd58('0x96')](_0x104aa2,_0xcd58('0xf5'));}delete this['actions'][_0xab6ee['linkedid']];}if(!(_0x104aa2[_0xcd58('0x7a')]&&_0x4dd355==='16')){ut[_0xcd58('0x78')](_0x33807d,_0xcd58('0xf6'));logger[_0xcd58('0x53')]('[originated][decrement][callProgressDetectingCustomer]',_0x104aa2[_0xcd58('0xb1')],_0xcd58('0xb2'),_0x33807d['name'],_0xcd58('0x6e'),_0x33807d[_0xcd58('0x59')]);}if(_0x4dd355!==_0xcd58('0xad')){delete this[_0xcd58('0x13')][_0xab6ee[_0xcd58('0xac')]];delete this[_0xcd58('0x13')][_0xab6ee['destlinkedid']];}}};Preview['prototype'][_0xcd58('0xf7')]=function(_0x50e508,_0x365c62,_0x2224ad){if(_['isUndefined'](_0x365c62)&&_0xcd58('0xf8')!==typeof _0x365c62){return;}if(_[_0xcd58('0xf9')](_0x2224ad)&&_0xcd58('0xf8')!==typeof _0x2224ad){return;}switch(_0x2224ad[_0xcd58('0xfa')]){case'0':ut[_0xcd58('0xfb')](_0x50e508,0x0,'NoSuchNumber');rpcDb[_0xcd58('0xfc')](_0x50e508,_0xcd58('0xfd'));break;case'3':ut[_0xcd58('0xfb')](_0x50e508,0x3,_0xcd58('0xce'));rpcDb[_0xcd58('0xfc')](_0x50e508,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xcd58('0xfb')](_0x50e508,0x5,'Busy');rpcDb[_0xcd58('0xfc')](_0x50e508,_0xcd58('0xfe'));break;case'8':ut[_0xcd58('0xfb')](_0x50e508,0x8,_0xcd58('0xd8'));rpcDb['createAgentHistory'](_0x50e508,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xcd58('0xfb')](_0x50e508,0x16,_0xcd58('0xff'));rpcDb['createAgentHistory'](_0x50e508,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xcd58('0xfb')](_0x50e508,0xc,_0x2224ad['reason']);rpcDb[_0xcd58('0xfc')](_0x50e508,'[callProgressDetectingAgent][logCongestion]');}ut[_0xcd58('0x78')](_0x365c62,_0xcd58('0x100'));logger[_0xcd58('0x53')](_0xcd58('0x101'),_0x50e508['uniqueid'],'\x20Queue',_0x365c62['name'],_0xcd58('0x6e'),_0x365c62[_0xcd58('0x59')]);delete this[_0xcd58('0x13')][_0x50e508[_0xcd58('0xb1')]];};Preview[_0xcd58('0xd')][_0xcd58('0x102')]=function(_0x3c3ee4,_0x1735b2,_0x173383,_0x239071,_0x36a642){var _0x217f77=this;return new BPromise(function(_0x74003a,_0x1103d9){if(_[_0xcd58('0x6a')](_0x1735b2)||_[_0xcd58('0x6a')](_0x1735b2[_0xcd58('0x103')])||_[_0xcd58('0x6a')](_0x1735b2[_0xcd58('0x103')][_0xcd58('0x104')])||_[_0xcd58('0x6a')](_0x1735b2[_0xcd58('0x73')])){_0x1103d9(ut[_0xcd58('0x77')]('Contact\x20is\x20undefined',_0x239071,_0x36a642));return;}var _0x339897=uuid['v4']();var _0x17eaa3=_0x217f77[_0xcd58('0x61')][_0x1735b2[_0xcd58('0x6c')][_0xcd58('0x22')]];var _0x521486=_0x173383?_0x217f77['agents'][_0x173383]['id']:undefined;_0x217f77[_0xcd58('0x13')][_0x339897]=new Action(_0x1735b2,_0x17eaa3,_0x339897,_0x173383,_0x521486);var _0x36a75=_0x217f77[_0xcd58('0x13')][_0x339897];_0x36a75[_0xcd58('0xcb')]=_0x239071;_0x36a75[_0xcd58('0xab')]=_0x36a642;_0x36a75[_0xcd58('0x105')]=_0x173383;if(_[_0xcd58('0x106')](_0x3c3ee4)){_0x217f77['execCall'](_0x36a75,_0x17eaa3,_0x1735b2,_0x173383)[_0xcd58('0x89')](function(_0x543266){logger[_0xcd58('0x53')]('[Preview][execCall][success]','Queue:\x20'+_0x36a75[_0xcd58('0x6d')]+'\x20IdHopper:\x20'+_0x36a75[_0xcd58('0x107')],JSON['stringify'](_0x543266));ami[_0xcd58('0x56')](_0xcd58('0x108'),ut[_0xcd58('0xa2')](_0x36a75,_0xcd58('0x109'),_0x217f77[_0xcd58('0x61')][_0x36a75[_0xcd58('0x6d')]]));_0x74003a(ut[_0xcd58('0x77')]('Calling'));})['catch'](function(_0xb7f782){ut['logger'](_0xcd58('0x10a'),_0xb7f782);_0x1103d9(ut[_0xcd58('0x77')](_0xcd58('0x10b'),_0x239071,_0x36a642));});}else{_0x17eaa3[_0xcd58('0x10c')]+=0x1;ut['logBlacklist'](_0x36a75);rpcDb[_0xcd58('0x10d')](_0x36a75,_0xcd58('0x10e'));delete _0x217f77[_0xcd58('0x13')][_0x339897];_0x1103d9(ut[_0xcd58('0x77')]('Contact\x20in\x20black\x20List',_0x239071,_0x36a642));}});};Preview[_0xcd58('0xd')][_0xcd58('0x9b')]=function(_0x8c95f3){return!_[_0xcd58('0x6a')](_0x8c95f3)&&!_[_0xcd58('0x6a')](_0x8c95f3[_0xcd58('0x22')])&&!_['isNil'](_0x8c95f3['active'])&&_0x8c95f3[_0xcd58('0x4b')]&&!_[_0xcd58('0x6a')](this['trunks'][util['format'](_0xcd58('0x10f'),_0x8c95f3[_0xcd58('0x22')])])&&!_[_0xcd58('0x6a')](this[_0xcd58('0x12')][util[_0xcd58('0x50')]('SIP/%s',_0x8c95f3[_0xcd58('0x22')])]['status'])&&(this[_0xcd58('0x12')][util[_0xcd58('0x50')](_0xcd58('0x10f'),_0x8c95f3['name'])][_0xcd58('0x74')]===_0xcd58('0x110')||this[_0xcd58('0x12')][util[_0xcd58('0x50')](_0xcd58('0x10f'),_0x8c95f3[_0xcd58('0x22')])]['status']===_0xcd58('0x111'));};Preview[_0xcd58('0xd')][_0xcd58('0x88')]=function(_0x3c1e71,_0x18d295){var _0x50a427=this;return new BPromise(function(_0x22962c,_0x125c45){_0x50a427[_0xcd58('0x112')](_0x3c1e71,_0x18d295)['then'](function(_0x5f5145){_0x22962c(_[_0xcd58('0x70')](_0x5f5145,[_0xcd58('0x77')]));})['catch'](function(_0x1b512e){if(_0x1b512e[_0xcd58('0x113')]){rpcDb[_0xcd58('0x114')](_0x3c1e71);}if(_0x1b512e[_0xcd58('0x4b')]){rpcDb[_0xcd58('0x8c')](_0x3c1e71);}_0x125c45(_[_0xcd58('0x70')](_0x1b512e,['message']));});});};Preview['prototype'][_0xcd58('0x112')]=function(_0xad0a9a,_0x538683){var _0x4097aa=this;return new BPromise(function(_0x144c14,_0x137516){var _0x1af61a,_0xe81813;rpcDb[_0xcd58('0x115')](_0xad0a9a)[_0xcd58('0x89')](function(_0x3c8f98){if(!_[_0xcd58('0x6a')](_0x3c8f98[0x0])){_0xe81813=_0x3c8f98[0x0][_0xcd58('0x116')]?![]:!![];_0x1af61a=_0x3c8f98[0x0][_0xcd58('0x116')]?!![]:![];_0x1af61a=_0x538683?!![]:_0x1af61a;}var _0x35ff7f=_0x4097aa[_0xcd58('0x117')](_0x3c8f98);if(_0x35ff7f[_0xcd58('0x118')]){rpcDb['checkIsBlackList'](_[_0xcd58('0x70')](_0x3c8f98[0x0],[_0xcd58('0x73'),_0xcd58('0x119')]))[_0xcd58('0x89')](function(_0x5ca4d2){_0x4097aa['checkInBlack'](_0x5ca4d2,_0x3c8f98[0x0],_0x538683,_0xe81813,_0x1af61a)[_0xcd58('0x89')](function(_0x283384){_0x144c14(_0x283384);})[_0xcd58('0x76')](function(_0x4b4ce2){_0x137516(_0x4b4ce2);});})[_0xcd58('0x76')](function(_0x3c0cb2){ut['logger']('[Preview][checkIsBlackList]',_0x3c0cb2);_0x137516(ut[_0xcd58('0x77')]('Call\x20unsuccessful',_0xe81813,_0x1af61a));});}else{_0x137516(ut[_0xcd58('0x77')](_0x35ff7f[_0xcd58('0x77')],_0xe81813,_0x1af61a));}})['catch'](function(_0x593d54){ut[_0xcd58('0x5e')](_0xcd58('0x11a'),_0x593d54);_0x137516(ut['message']('Call\x20unsuccessful',![],!![]));});});};Preview[_0xcd58('0xd')][_0xcd58('0x117')]=function(_0x5fceaa){if(_[_0xcd58('0x6a')](_0x5fceaa)||_[_0xcd58('0x106')](_0x5fceaa)||!_[_0xcd58('0x6a')](_0x5fceaa[0x0]['Agent'])&&_[_0xcd58('0x6a')](_0x5fceaa[0x0][_0xcd58('0x86')][_0xcd58('0x22')])){ut['logger'](_0xcd58('0x11b'),_0x5fceaa);return{'isValid':![],'message':_0xcd58('0x11c')};}var _0x55409d=this[_0xcd58('0x61')][_0x5fceaa[0x0][_0xcd58('0x6c')]['name']];_0x55409d[_0xcd58('0x77')]='ACTIVE';if(_[_0xcd58('0x6a')](_0x55409d)){ut[_0xcd58('0x5e')]('[Preview][validateContact][Empty\x20Campaign]',_0x55409d);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x55409d[_0xcd58('0x4a')])){ut[_0xcd58('0x5e')]('[Preview][validateContact][Trunk\x20not\x20work]',_0xcd58('0x11d')+_0x55409d['name']+_0xcd58('0x11e'));if(!this[_0xcd58('0x9b')](_0x55409d[_0xcd58('0x9c')])){ut['logger'](_0xcd58('0x11f'),_0x55409d[_0xcd58('0x22')]+_0xcd58('0x120'));return{'isValid':![],'message':_0xcd58('0x121')};}}if(!ut[_0xcd58('0x9a')](_0x55409d['dialActive'])){ut['logger'](_0xcd58('0x122'),_0x55409d['name']+_0xcd58('0x123'));return{'isValid':![],'message':_0xcd58('0x11d')+_0x55409d[_0xcd58('0x22')]+_0xcd58('0x123')};}return{'isValid':!![],'message':_0xcd58('0x124')};};Preview[_0xcd58('0xd')]['execCall']=function(_0x462553,_0x44c6d5,_0xca198c,_0x135db8){var _0x5d2722=this;return new BPromise(function(_0xfb975,_0x56da7f){var _0x118424=_0x462553['uniqueid'];var _0x39de0f=_0x5d2722[_0xcd58('0x9b')](_0x44c6d5[_0xcd58('0x4a')])?util[_0xcd58('0x50')]('SIP/%s/%s%s',_0x44c6d5[_0xcd58('0x4a')][_0xcd58('0x22')],_[_0xcd58('0x6a')](_0x44c6d5['dialPrefix'])?'':_0x44c6d5[_0xcd58('0x31')]['trim']()||'',_0x44c6d5[_0xcd58('0x125')]>0x0?_0xca198c[_0xcd58('0x103')][_0xcd58('0x104')][_0xcd58('0x126')](_0x44c6d5[_0xcd58('0x125')]):_0xca198c[_0xcd58('0x103')]['phone']):util[_0xcd58('0x50')](_0xcd58('0x127'),_[_0xcd58('0x6a')](_0x44c6d5['TrunkBackup'])?_0x44c6d5[_0xcd58('0x4a')][_0xcd58('0x22')]:_0x44c6d5['TrunkBackup'][_0xcd58('0x22')],_[_0xcd58('0x6a')](_0x44c6d5['dialPrefix'])?'':_0x44c6d5[_0xcd58('0x31')][_0xcd58('0x128')]()||'',_0x44c6d5[_0xcd58('0x125')]>0x0?_0xca198c[_0xcd58('0x103')][_0xcd58('0x104')][_0xcd58('0x126')](_0x44c6d5[_0xcd58('0x125')]):_0xca198c[_0xcd58('0x103')]['phone']);var _0x2cf402=_0x5d2722[_0xcd58('0x9b')](_0x44c6d5[_0xcd58('0x4a')])?ut[_0xcd58('0x129')](_0x44c6d5[_0xcd58('0x4a')][_0xcd58('0x4c')],_0x44c6d5[_0xcd58('0x2e')],_0x44c6d5[_0xcd58('0x12a')]>0x0?ut[_0xcd58('0x12b')](_0x44c6d5['dialOriginateCallerIdNumber'],_0x44c6d5[_0xcd58('0x12a')]):_0x44c6d5[_0xcd58('0x2f')]):ut[_0xcd58('0x129')](_[_0xcd58('0x6a')](_0x44c6d5[_0xcd58('0x9c')])?_0x44c6d5[_0xcd58('0x4a')]['callerid']:_0x44c6d5['TrunkBackup'][_0xcd58('0x4c')],_0x44c6d5['dialOriginateCallerIdName'],_0x44c6d5[_0xcd58('0x12a')]>0x0?ut['getCallerIdRandom'](_0x44c6d5[_0xcd58('0x2f')],_0x44c6d5[_0xcd58('0x12a')]):_0x44c6d5[_0xcd58('0x2f')]);if(_0x2cf402){_0x462553[_0xcd58('0x12c')]=ut['extractCalleridName'](_0x2cf402);_0x462553['originatecalleridnum']=ut[_0xcd58('0x12d')](_0x2cf402);}var _0x3efb31=ut[_0xcd58('0x12e')](_0x44c6d5,_0xca198c,_0x39de0f,_0x2cf402,_0x118424,_0x462553);_[_0xcd58('0x12f')](_0x462553,ut[_0xcd58('0x130')](_0x3efb31));_0x462553[_0xcd58('0x8d')]=moment()[_0xcd58('0x50')](_0xcd58('0x8e'));ami[_0xcd58('0x131')](ut[_0xcd58('0x132')](_0x462553,_0x44c6d5,_0x3efb31,_0x462553[_0xcd58('0xab')],_0x135db8))[_0xcd58('0x89')](function(_0x596b9b){_0x44c6d5['originated']+=0x1;logger['info']('[originated][increment]',_0x118424,'\x20Queue',_0x44c6d5[_0xcd58('0x22')],_0xcd58('0x6e'),_0x44c6d5[_0xcd58('0x59')]);_0xfb975(_0x596b9b);})[_0xcd58('0x76')](function(_0x4922f9){ut['logAgent'](_0x462553,0xe,_0xcd58('0x133'));rpcDb[_0xcd58('0xfc')](_0x462553,_0xcd58('0x134'));_0x56da7f(_0x4922f9);});});};Preview[_0xcd58('0xd')][_0xcd58('0x135')]=function(_0x6766ab){if(this[_0xcd58('0x13')][_0x6766ab[_0xcd58('0xac')]]){this[_0xcd58('0x13')][_0x6766ab['linkedid']][_0xcd58('0x75')]=_0x6766ab[_0xcd58('0x75')];}};Preview[_0xcd58('0xd')][_0xcd58('0x17')]=function(_0x289cfa){var _0x1301a1=this;var _0x2c1d17=this[_0xcd58('0x13')][_0x289cfa[_0xcd58('0x136')]];if(_0x2c1d17){if(_0x2c1d17[_0xcd58('0x105')]&&this[_0xcd58('0x14')][_0x2c1d17['lookAgent']]){ut[_0xcd58('0x137')](_0x2c1d17,this[_0xcd58('0x14')][_0x2c1d17[_0xcd58('0x105')]][_0xcd58('0x22')],this[_0xcd58('0x14')][_0x2c1d17[_0xcd58('0x105')]]['id']);}var _0x2db176=_[_0xcd58('0x138')](_0x2c1d17);_0x2db176[_0xcd58('0xae')]=moment()[_0xcd58('0x50')](_0xcd58('0x8e'));var _0x5c4999=_0x1301a1[_0xcd58('0x61')][_0x2c1d17[_0xcd58('0x6d')]];if(ut[_0xcd58('0x139')](_0x289cfa[_0xcd58('0x13a')])){if(_0x2c1d17[_0xcd58('0xcb')]){rpcDb[_0xcd58('0x114')](_0x2c1d17['idContact']);}if(_0x2c1d17[_0xcd58('0xab')]){rpcDb[_0xcd58('0x8c')](_0x2c1d17[_0xcd58('0x107')]);}ami[_0xcd58('0x56')](_0xcd58('0x13b'),ut[_0xcd58('0xa2')](_0x2c1d17,'rejected',this[_0xcd58('0x61')][_0x2c1d17[_0xcd58('0x6d')]]));this[_0xcd58('0xf7')](_0x2db176,_0x5c4999,_0x289cfa);}else{_0x2c1d17['starttime']=moment()[_0xcd58('0x50')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x2db176,0x4,_0xcd58('0x13c'));rpcDb[_0xcd58('0xfc')](_0x2db176,_0xcd58('0x13d'));}}};Preview[_0xcd58('0xd')]['syncHangup']=function(_0x48e536){var _0x6b92=this;var _0x3dff36=this[_0xcd58('0x13')][_0x48e536[_0xcd58('0xac')]];var _0x44545f;if(_0x3dff36){_0x44545f=this[_0xcd58('0x61')][_0x3dff36['queue']];logger['info']('[syncHangup][talking]',_0x48e536[_0xcd58('0xac')],_0xcd58('0xb2'),_0x44545f[_0xcd58('0x22')],_0xcd58('0x6f'),_0x44545f[_0xcd58('0x25')]);}if(this[_0xcd58('0x13')][_0x48e536[_0xcd58('0xac')]]&&_0x48e536['linkedid']!==_0x48e536[_0xcd58('0xb1')]){if(_0x48e536['cause']==='16'&&this[_0xcd58('0x13')][_0x48e536[_0xcd58('0xac')]][_0xcd58('0x7a')]){this['callProgressDetectingCustomer'](_0x48e536,_0x48e536[_0xcd58('0xac')],_0x48e536['cause']);}else if(this[_0xcd58('0x13')][_0x48e536[_0xcd58('0xac')]]['dialAnswer']){logger[_0xcd58('0x53')](_0xcd58('0x13e'),_0x48e536['linkedid'],_0x48e536[_0xcd58('0x13f')],_0xcd58('0xb2'),_0x44545f['name'],_0xcd58('0x6f'),_0x44545f[_0xcd58('0x25')]);this['callProgressDetectingCustomer'](_0x48e536,_0x48e536[_0xcd58('0xac')],_0x48e536[_0xcd58('0x13f')]);}}else if(_0x3dff36&&_[_0xcd58('0x6a')](_0x3dff36['statedesc'])&&_0x44545f['dialQueueProject']&&_0x48e536['linkedid']===_0x48e536[_0xcd58('0xb1')]&&_[_0xcd58('0x6a')](_0x48e536[_0xcd58('0xfa')])&&_0x48e536['cause']==='16'&&_0x48e536['channelstate']==='6'&&_[_0xcd58('0xf9')](_0x3dff36[_0xcd58('0x140')])){if(_0x3dff36['unlockAgent']){rpcDb['unlockContact'](_0x3dff36[_0xcd58('0x107')]);}if(_0x3dff36[_0xcd58('0xab')]){rpcDb[_0xcd58('0x8c')](_0x3dff36[_0xcd58('0x107')]);}_0x48e536[_0xcd58('0xfa')]='22';this[_0xcd58('0xf7')](_0x3dff36,_0x44545f,_0x48e536);}else if(_0x3dff36&&_0x3dff36[_0xcd58('0x140')]){if(_0x48e536['cause']==='16'&&this['actions'][_0x48e536[_0xcd58('0xac')]][_0xcd58('0x7a')]){logger[_0xcd58('0x53')](_0xcd58('0x141'),_0x48e536[_0xcd58('0xac')],_0x48e536[_0xcd58('0x13f')],_0xcd58('0xb2'),_0x44545f['name'],'pTalking:\x20',_0x44545f[_0xcd58('0x25')]);this[_0xcd58('0x9e')](_0x48e536,_0x48e536[_0xcd58('0xac')],_0x48e536['cause']);}else if(this[_0xcd58('0x13')][_0x48e536[_0xcd58('0xac')]][_0xcd58('0x7a')]){logger[_0xcd58('0x53')](_0xcd58('0x13e'),_0x48e536['linkedid'],_0x48e536[_0xcd58('0x13f')],_0xcd58('0xb2'),_0x44545f[_0xcd58('0x22')],_0xcd58('0x6f'),_0x44545f[_0xcd58('0x25')]);this[_0xcd58('0x9e')](_0x48e536,_0x48e536['linkedid'],_0x48e536[_0xcd58('0x13f')]);}}};Preview['prototype'][_0xcd58('0x1b')]=function(_0x21a269){if(this[_0xcd58('0x13')][_0x21a269[_0xcd58('0x142')]]&&_0x21a269[_0xcd58('0x142')]!==_0x21a269[_0xcd58('0x143')]){this[_0xcd58('0x9e')](_0x21a269,_0x21a269[_0xcd58('0x142')],_0x21a269[_0xcd58('0xf3')]);}};Preview[_0xcd58('0xd')][_0xcd58('0x1a')]=function(_0x18fcdc){if(this[_0xcd58('0x13')][_0x18fcdc[_0xcd58('0xac')]]&&_0x18fcdc['linkedid']!==_0x18fcdc[_0xcd58('0xb1')]&&!this[_0xcd58('0x13')][_0x18fcdc[_0xcd58('0xac')]][_0xcd58('0x7a')]){if(_0x18fcdc[_0xcd58('0x13f')]==='1'){this['callProgressDetectingCustomer'](_0x18fcdc,_0x18fcdc[_0xcd58('0xac')],_0x18fcdc[_0xcd58('0x13f')]);}}};Preview[_0xcd58('0xd')][_0xcd58('0x144')]=function(_0x234334,_0x1c0900,_0xc0814d){if(this[_0xcd58('0x13')][_0x234334]){if(_[_0xcd58('0x6a')](this[_0xcd58('0x13')][_0x234334]['variables'])){this[_0xcd58('0x13')][_0x234334]['variables']={};}this[_0xcd58('0x13')][_0x234334]['variables'][_0x1c0900]=_0xc0814d;}};Preview[_0xcd58('0xd')][_0xcd58('0x145')]=function(_0x365cdb){try{if(!_[_0xcd58('0x6a')](_0x365cdb)){if(ut['filterKey'](_['keys'](_0x365cdb[_0xcd58('0x146')])[0x0])){this[_0xcd58('0x144')](_0x365cdb[_0xcd58('0xb1')],_[_0xcd58('0x147')](_0x365cdb[_0xcd58('0x146')])[0x0],_0x365cdb[_0xcd58('0x148')]);}}}catch(_0x30b74e){logger[_0xcd58('0x149')]('[syncVarSet][Preview]',util[_0xcd58('0x14a')](_0x30b74e,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xcd58('0x1f')]=function(_0x48871a){if(_0x48871a){if(this[_0xcd58('0x13')][_0x48871a[_0xcd58('0x14b')]]){this[_0xcd58('0x13')][_0x48871a['transfertargetlinkedid']][_0xcd58('0x140')]=!![];}}};Preview[_0xcd58('0xd')][_0xcd58('0x20')]=function(_0x4d09fc){if(_0x4d09fc){if(this[_0xcd58('0x13')][_0x4d09fc[_0xcd58('0x14c')]]){this[_0xcd58('0x13')][_0x4d09fc[_0xcd58('0x14c')]]['transfer']=!![];}}};module[_0xcd58('0x14d')]=Preview; \ No newline at end of file +var _0x6953=['[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','scheduledAt','NOANSWER','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','unlockAgent','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialBusyRetryFrequency','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer]','\x20Queue','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','disableContact','getContactPreview','recallme','isValid','checkIsBlackList','VoiceQueueId','Contact.phone','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','logLookAgent','isFailure','unlockContact','idContact','custom:agentringnoanswer','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','variable','keys','value','error','[syncVarSet][Preview]','inspect','transfererlinkedid','exports','util','lodash','md5','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','defaults','localhost','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','available','loggedIn','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','stringify','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','prototype','syncCampaigns','dialMethod','booked','clearZombieChannels','hasOwnProperty','setMessage','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','contactId','Action','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','starttime','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','catch','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumBillable','talktime','countbusyretry','Busy','custom:agentbusy','busy','dialGlobalMaxRetry'];(function(_0x461981,_0x302d72){var _0x212fcd=function(_0x4d0db3){while(--_0x4d0db3){_0x461981['push'](_0x461981['shift']());}};_0x212fcd(++_0x302d72);}(_0x6953,0x91));var _0x3695=function(_0xcf7425,_0x2ec7b4){_0xcf7425=_0xcf7425-0x0;var _0xd76b28=_0x6953[_0xcf7425];return _0xd76b28;};'use strict';var util=require(_0x3695('0x0'));var _=require(_0x3695('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var md5=require(_0x3695('0x2'));var Redis=require('ioredis');var config=require(_0x3695('0x3'));var logger=require(_0x3695('0x4'))(_0x3695('0x5'));var loggerAction=require('../../../config/logger')(_0x3695('0x6'));var ami=require('../ami');var rpcDb=require(_0x3695('0x7'));var Action=require(_0x3695('0x8'));var ut=require(_0x3695('0x9'));config[_0x3695('0xa')]=_[_0x3695('0xb')](config['redis'],{'host':_0x3695('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3695('0xa')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0xd21435){this['tail']=this[_0x3695('0xd')]?this[_0x3695('0xd')][_0x3695('0xe')](_0xd21435):_0xd21435();};function Preview(_0x149594){this[_0x3695('0xf')]=new Sequence();this[_0x3695('0x10')]=_0x149594['voiceQueues'];this[_0x3695('0x11')]=_0x149594[_0x3695('0x11')];this[_0x3695('0x12')]={};this[_0x3695('0x13')]=_0x149594[_0x3695('0x13')];this[_0x3695('0x14')]=0x0;ami['on'](_0x3695('0x15'),this[_0x3695('0x16')][_0x3695('0x17')](this));ami['on'](_0x3695('0x18'),this[_0x3695('0x19')]['bind'](this));ami['on'](_0x3695('0x1a'),this[_0x3695('0x1b')][_0x3695('0x17')](this));ami['on'](_0x3695('0x1c'),this[_0x3695('0x1d')][_0x3695('0x17')](this));ami['on'](_0x3695('0x1e'),this['syncNewExten'][_0x3695('0x17')](this));ami['on']('varset',this[_0x3695('0x1f')][_0x3695('0x17')](this));ami['on'](_0x3695('0x20'),this[_0x3695('0x21')][_0x3695('0x17')](this));ami['on']('blindtransfer',this[_0x3695('0x22')][_0x3695('0x17')](this));this[_0x3695('0x23')](this[_0x3695('0x10')]);}function emit(_0xc076a9,_0x1ebba8,_0x34b0fc){io['to'](_0xc076a9)[_0x3695('0x24')](_0x1ebba8,_0x34b0fc);}function emitCampaignPreview(_0x1f267a){if(_0x1f267a[_0x3695('0x25')]===_0x3695('0x26')){var _0xf2c747={'id':_0x1f267a['id'],'name':_0x1f267a[_0x3695('0x27')],'strategy':_0x1f267a[_0x3695('0x28')],'answered':_0x1f267a['answered'],'available':_0x1f267a[_0x3695('0x29')],'loggedIn':_0x1f267a[_0x3695('0x2a')],'pTalking':_0x1f267a['pTalking'],'sumBillable':_0x1f267a['sumBillable'],'sumDuration':_0x1f267a[_0x3695('0x2b')],'sumHoldTime':_0x1f267a[_0x3695('0x2c')]||0x0,'talking':_0x1f267a[_0x3695('0x2d')],'total':_0x1f267a[_0x3695('0x2e')],'type':_0x1f267a['type'],'unmanaged':_0x1f267a[_0x3695('0x2f')],'abandoned':_0x1f267a['abandoned'],'waiting':_0x1f267a[_0x3695('0x30')],'loggedInDb':_0x1f267a['loggedInDb'],'dialActive':_0x1f267a[_0x3695('0x31')],'dialMethod':_0x1f267a['dialMethod'],'dialOriginateCallerIdName':_0x1f267a[_0x3695('0x32')],'dialOriginateCallerIdNumber':_0x1f267a[_0x3695('0x33')],'dialOriginateTimeout':_0x1f267a[_0x3695('0x34')],'dialPrefix':_0x1f267a[_0x3695('0x35')],'outboundAnswerAgiCallsDay':_0x1f267a[_0x3695('0x36')],'outboundAnswerCallsDay':_0x1f267a[_0x3695('0x37')],'outboundBlacklistCallsDay':_0x1f267a['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x1f267a[_0x3695('0x38')],'outboundCongestionCallsDay':_0x1f267a[_0x3695('0x39')],'outboundDropCallsDayACS':_0x1f267a['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x1f267a[_0x3695('0x3a')],'outboundDropCallsDayTimeout':_0x1f267a['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x1f267a[_0x3695('0x3b')],'outboundNoSuchCallsDay':_0x1f267a[_0x3695('0x3c')],'outboundOriginateFailureCallsDay':_0x1f267a[_0x3695('0x3d')],'outboundReCallsDay':_0x1f267a[_0x3695('0x3e')],'outboundRejectCallsDay':_0x1f267a[_0x3695('0x3f')],'outboundUnknownCallsDay':_0x1f267a[_0x3695('0x40')],'outboundAbandonedCallsDay':_0x1f267a[_0x3695('0x41')],'predictiveIntervalAnsweredCalls':_0x1f267a[_0x3695('0x42')],'predictiveIntervalAvgHoldtime':_0x1f267a['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1f267a[_0x3695('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x1f267a[_0x3695('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x1f267a[_0x3695('0x45')],'predictiveIntervalErlangCalls':_0x1f267a['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x1f267a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x1f267a[_0x3695('0x46')],'predictiveIntervalMultiplicativeFactor':_0x1f267a['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x1f267a[_0x3695('0x47')],'predictiveIntervalAvailable':_0x1f267a[_0x3695('0x48')],'predictiveIntervalTotalCalls':_0x1f267a['predictiveIntervalTotalCalls'],'message':_0x1f267a[_0x3695('0x49')],'originated':_0x1f267a['originated'],'erlangCalls':_0x1f267a[_0x3695('0x4a')],'erlangCallToSecond':_0x1f267a[_0x3695('0x4b')],'erlangAbandonmentRate':_0x1f267a[_0x3695('0x4c')],'erlangBusyFactor':_0x1f267a[_0x3695('0x4d')],'startPredictive':_0x1f267a[_0x3695('0x4e')],'startProgressive':_0x1f267a[_0x3695('0x4f')]};if(_0x1f267a['Trunk']){_0xf2c747[_0x3695('0x50')]={'id':_0x1f267a[_0x3695('0x50')]['id'],'name':_0x1f267a['Trunk'][_0x3695('0x27')],'active':_0x1f267a[_0x3695('0x50')]['active'],'callerid':_0x1f267a['Trunk']['callerid']};}if(_0x1f267a['Interval']){_0xf2c747[_0x3695('0x51')]={'id':_0x1f267a[_0x3695('0x51')]['id'],'name':_0x1f267a['Interval'][_0x3695('0x27')]};}var _0x323e21=md5(JSON[_0x3695('0x52')](_0xf2c747));if(_0x1f267a[_0x3695('0x2')]!==_0x323e21){_0x1f267a['md5']=_0x323e21;emit(util['format'](_0x3695('0x53'),_0xf2c747[_0x3695('0x27')]),'voice_queue:save',_0xf2c747);}}}function emitVoiceQueueChannelRemove(_0x12ebe9){logger[_0x3695('0x54')](_0x3695('0x55'),JSON[_0x3695('0x52')](_0x12ebe9));emit(util[_0x3695('0x56')](_0x3695('0x53'),_0x12ebe9[_0x3695('0x27')]),_0x3695('0x57'),_0x12ebe9);io[_0x3695('0x24')](_0x3695('0x58'),_0x12ebe9);}function notSendMessagesQueue(_0x460b49){if(_0x460b49[_0x3695('0x59')]){if(_0x460b49[_0x3695('0x5a')]===0x0&&_0x460b49[_0x3695('0x5b')]===0x0){_0x460b49[_0x3695('0x59')]=![];_0x460b49[_0x3695('0x29')]=0x0;_0x460b49['paused']=0x0;_0x460b49[_0x3695('0x49')]=_0x3695('0x5c');ut[_0x3695('0x5d')](_0x3695('0x5e'),_0x460b49[_0x3695('0x27')]+_0x3695('0x5f'));}else{_0x460b49[_0x3695('0x49')]='IS_DISACTIVED';ut[_0x3695('0x5d')](_0x3695('0x5e'),_0x460b49[_0x3695('0x27')]+'\x20is\x20disactive');}emitCampaignPreview(_0x460b49);}}Preview[_0x3695('0x60')][_0x3695('0x23')]=function(){var _0x3ffc79=this;setInterval(function(){_0x3ffc79[_0x3695('0x61')]();},0x7cf);};Preview[_0x3695('0x60')][_0x3695('0x61')]=function(){var _0x4261d1=this['campaignsPreview'];this[_0x3695('0x14')]+=0x1;for(var _0x49a9d8 in _0x4261d1){if(_0x4261d1['hasOwnProperty'](_0x49a9d8)&&(_0x4261d1[_0x49a9d8][_0x3695('0x62')]==='preview'||_0x4261d1[_0x49a9d8][_0x3695('0x62')]===_0x3695('0x63'))&&_0x4261d1[_0x49a9d8][_0x3695('0x25')]===_0x3695('0x26')){if(this['clockClearZombieChannels']>0x7){this[_0x3695('0x14')]=0x0;this[_0x3695('0x64')]();}}if(_0x4261d1[_0x3695('0x65')](_0x49a9d8)&&_0x4261d1[_0x49a9d8]['dialMethod']===_0x3695('0x5')&&_0x4261d1[_0x49a9d8][_0x3695('0x25')]===_0x3695('0x26')){if(_0x4261d1[_0x49a9d8][_0x3695('0x31')]){this[_0x3695('0x66')](_0x4261d1[_0x49a9d8]);this[_0x3695('0x67')](_0x4261d1[_0x49a9d8]);}else{notSendMessagesQueue(_0x4261d1[_0x49a9d8]);}}}};Preview[_0x3695('0x60')][_0x3695('0x68')]=function(_0x3dd06a){var _0x5d5d70=this;this['sequence'][_0x3695('0x69')](function(){if(!_[_0x3695('0x6a')](_0x5d5d70[_0x3695('0x12')][_0x3dd06a])){loggerAction['info'](_0x3695('0x6b'),_0x3dd06a,_0x3695('0x6c'),_0x5d5d70[_0x3695('0x12')][_0x3dd06a]['queue'],_0x3695('0x6d'),JSON[_0x3695('0x52')](_0x5d5d70[_0x3695('0x10')][_0x5d5d70[_0x3695('0x12')][_0x3dd06a][_0x3695('0x6e')]]['originated']),_0x3695('0x6f'),JSON[_0x3695('0x52')](_0x5d5d70[_0x3695('0x10')][_0x5d5d70[_0x3695('0x12')][_0x3dd06a]['queue']][_0x3695('0x5b')]),JSON['stringify'](_0x5d5d70['actions'][_0x3dd06a][_0x3695('0x70')]),JSON[_0x3695('0x52')](_[_0x3695('0x71')](_0x5d5d70[_0x3695('0x12')][_0x3dd06a],[_0x3695('0x72'),'UserId','VoiceQueueId','ListId'])));return ami[_0x3695('0x73')]({'action':'status','channel':_0x5d5d70['actions'][_0x3dd06a]['channel']})['catch'](function(_0x3b1c1c){if(_0x3b1c1c[_0x3695('0x49')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5d5d70[_0x3695('0x12')][_0x3dd06a]){ut[_0x3695('0x74')](_0x5d5d70['campaignsPreview'][_0x5d5d70['actions'][_0x3dd06a][_0x3695('0x6e')]],_0x3695('0x75'));if(_0x5d5d70[_0x3695('0x12')][_0x3dd06a]['dialAnswer']===!![]){ut[_0x3695('0x76')](_0x5d5d70[_0x3695('0x10')][_0x5d5d70[_0x3695('0x12')][_0x3dd06a][_0x3695('0x6e')]],_0x3695('0x75'));ut[_0x3695('0x77')](_0x3695('0x78')+_0x3dd06a,_0x5d5d70[_0x3695('0x12')][_0x3dd06a][_0x3695('0x6e')]);}ut[_0x3695('0x77')](_0x3695('0x79')+_0x3dd06a,_0x5d5d70[_0x3695('0x12')][_0x3dd06a][_0x3695('0x6e')]);delete _0x5d5d70[_0x3695('0x12')][_0x3dd06a];}},0x2328);}});}});};Preview[_0x3695('0x60')][_0x3695('0x64')]=function(){var _0x441997=this;loggerAction[_0x3695('0x54')](_0x3695('0x7a'),_[_0x3695('0x7b')](this[_0x3695('0x12')]));for(var _0x4148ec in this[_0x3695('0x12')]){if(_0x441997['actions']['hasOwnProperty'](_0x4148ec)){_0x441997[_0x3695('0x68')](_0x4148ec);}}};Preview[_0x3695('0x60')]['recallMe']=function(_0x323411){var _0x43f6f5=this;rpcDb[_0x3695('0x7c')](_0x323411['id'],ut[_0x3695('0x7d')](this[_0x3695('0x13')]))[_0x3695('0x7e')](function(_0x38d20c){if(!_[_0x3695('0x6a')](_0x38d20c)){for(var _0x520fd3=0x0;_0x520fd3<_0x38d20c[_0x3695('0x7f')];_0x520fd3+=0x1){if(ut['getDiff'](_0x38d20c[_0x520fd3][_0x3695('0x80')])<_0x323411[_0x3695('0x81')]*0x3c){if(_0x38d20c[_0x520fd3][_0x3695('0x82')]&&!_0x38d20c[_0x520fd3][_0x3695('0x82')][_0x3695('0x83')]){_0x43f6f5['run'](_0x38d20c[_0x520fd3]['id'])[_0x3695('0x7e')](ut[_0x3695('0x84')](_0x3695('0x85')))['catch'](ut[_0x3695('0x84')](_0x3695('0x85')));}else{rpcDb['disableContact'](_0x38d20c[_0x520fd3]['id']);}}else{var _0x47cd30=new Action(_0x38d20c[_0x520fd3],_0x323411);_0x47cd30[_0x3695('0x86')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x323411[_0x3695('0x3e')]+=0x1;ut[_0x3695('0x87')](_0x47cd30,0x17,_0x3695('0x88'));if(_0x323411[_0x3695('0x89')]){rpcDb[_0x3695('0x8a')](ut['createBody'](_0x38d20c[_0x520fd3]));rpcDb[_0x3695('0x8b')](_0x47cd30,_0x3695('0x8c'));}else{ut[_0x3695('0x87')](_0x47cd30,0x16,'RecallFailedTimeout');rpcDb[_0x3695('0x8b')](_0x47cd30,_0x3695('0x8d'));rpcDb[_0x3695('0x8e')](_0x47cd30,_0x3695('0x8d'));}}}}})[_0x3695('0x8f')](ut[_0x3695('0x84')]('[getContactRecallMe]'));};Preview[_0x3695('0x60')][_0x3695('0x66')]=function(_0x41e8de){_0x41e8de[_0x3695('0x59')]=!![];if(ut[_0x3695('0x90')](_0x41e8de['loggedIn'])){_0x41e8de[_0x3695('0x49')]=_0x3695('0x91');}else if(!ut[_0x3695('0x92')](_0x41e8de[_0x3695('0x31')])){_0x41e8de[_0x3695('0x49')]=_0x3695('0x5c');}else if(!this['isTrunkReachable'](_0x41e8de[_0x3695('0x50')])){if(!this[_0x3695('0x93')](_0x41e8de['TrunkBackup'])){_0x41e8de['message']=_0x3695('0x94');}else{_0x41e8de[_0x3695('0x49')]=_0x3695('0x95');}}else{_0x41e8de['message']=_0x3695('0x95');}emitCampaignPreview(_0x41e8de);};Preview[_0x3695('0x60')][_0x3695('0x96')]=function(_0x46ca05,_0x2f149a,_0x4e8d2a){var _0x41f968=this;var _0x4ed632=this['actions'][_0x2f149a];var _0x47def1=this[_0x3695('0x10')][_0x4ed632[_0x3695('0x6e')]];var _0xfe1cf7;if(_0x47def1){switch(_0x4e8d2a){case'1':_0x47def1[_0x3695('0x3c')]+=0x1;_0x4ed632[_0x3695('0x97')]+=0x1;_0x4ed632[_0x3695('0x98')]=ut[_0x3695('0x99')](_0x4ed632);ut[_0x3695('0x87')](_0x4ed632,0x0,_0x3695('0x9a'));ami[_0x3695('0x24')](_0x3695('0x9b'),ut[_0x3695('0x9c')](_0x4ed632,_0x3695('0x9d')));rpcDb[_0x3695('0x8b')](_0x4ed632,_0x3695('0x9e'));if(ut[_0x3695('0x99')](_0x4ed632)>=_0x47def1['dialGlobalMaxRetry']){_0xfe1cf7=ut[_0x3695('0x9f')](_0x4ed632,0xf,_0x3695('0xa0'));rpcDb[_0x3695('0x8e')](_0xfe1cf7,_0x3695('0xa1'));}else{if(_0x4ed632[_0x3695('0x97')]>=_0x47def1[_0x3695('0xa2')]){rpcDb['createCustomerFinal'](_0x4ed632,_0x3695('0xa1'));}else{rpcDb[_0x3695('0xa3')](ut['scheduledAt'](_0x4ed632,'countnosuchnumberretry',_0x47def1[_0x3695('0xa4')]),_0x4ed632['unlockAgent'],_0x4ed632[_0x3695('0xa5')]);}}delete this[_0x3695('0x12')][_0x46ca05[_0x3695('0xa6')]];break;case _0x3695('0xa7'):var _0x75339d=moment()['format'](_0x3695('0xa8'));_0x4ed632[_0x3695('0xa9')]=_0x75339d;_0x4ed632[_0x3695('0xaa')]=_0x75339d;_0x4ed632['dialAnswer']=!![];_0x47def1['pTalking']+=0x1;logger['info'](_0x3695('0xab'),_0x4ed632[_0x3695('0xac')],'\x20Queue',_0x47def1[_0x3695('0x27')],_0x3695('0x6f'),_0x47def1[_0x3695('0x5b')]);ami[_0x3695('0x24')](_0x3695('0xad'),ut[_0x3695('0x9c')](_0x4ed632,_0x3695('0xae'),this[_0x3695('0x10')][_0x4ed632['queue']]));if(_0x47def1[_0x3695('0xaf')]){ami[_0x3695('0x24')](_0x3695('0xb0'),ut[_0x3695('0xb1')](_0x4ed632));}break;case'16':ami[_0x3695('0x24')](_0x3695('0xb2'),ut[_0x3695('0x9c')](_0x4ed632,_0x3695('0xb3'),this['campaignsPreview'][_0x4ed632[_0x3695('0x6e')]]));emitVoiceQueueChannelRemove(ut[_0x3695('0x9c')](_0x4ed632,_0x3695('0xb3')));_0x47def1[_0x3695('0x37')]+=0x1;_0x47def1[_0x3695('0x2e')]+=0x1;_0x47def1[_0x3695('0xb4')]+=0x1;ut[_0x3695('0x76')](_0x47def1,_0x3695('0xb5'));_0x4ed632[_0x3695('0x98')]=ut[_0x3695('0x99')](_0x4ed632);ut[_0x3695('0x87')](_0x4ed632,0x4,_0x3695('0xb6'));rpcDb[_0x3695('0x8b')](_0x4ed632,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0x4ed632,_0x3695('0xb7'));rpcDb[_0x3695('0xb8')](_0x4ed632);_0x47def1[_0x3695('0x2b')]+=_0x4ed632['talktime'];_0x47def1[_0x3695('0xb9')]+=_0x4ed632[_0x3695('0xba')];logger[_0x3695('0x54')]('[syncHangup][talking][decrement]',_0x4ed632[_0x3695('0xac')],'\x20Queue',_0x47def1[_0x3695('0x27')],_0x3695('0x6f'),_0x47def1[_0x3695('0x5b')]);delete this[_0x3695('0x12')][_0x46ca05[_0x3695('0xa6')]];break;case'BUSY':_0x47def1[_0x3695('0x38')]+=0x1;_0x4ed632[_0x3695('0xbb')]+=0x1;_0x4ed632[_0x3695('0x98')]=ut[_0x3695('0x99')](_0x4ed632);ut[_0x3695('0x87')](_0x4ed632,0x5,_0x3695('0xbc'));ami[_0x3695('0x24')](_0x3695('0xbd'),ut['buildObj'](_0x4ed632,_0x3695('0xbe')));rpcDb['createCustomerHistory'](_0x4ed632,'[callProgressDetectingCustomer][logBusy]');if(ut['totalGlobal'](_0x4ed632)>=_0x47def1[_0x3695('0xbf')]){_0xfe1cf7=ut[_0x3695('0x9f')](_0x4ed632,0xf,_0x3695('0xa0'));rpcDb['createCustomerFinal'](_0xfe1cf7,_0x3695('0xc0'));}else{if(_0x4ed632['countbusyretry']>=_0x47def1[_0x3695('0xc1')]){rpcDb[_0x3695('0x8e')](_0x4ed632,_0x3695('0xc2'));}else{rpcDb['rescheduleContact'](ut[_0x3695('0xc3')](_0x4ed632,_0x3695('0xbb'),_0x47def1['dialBusyRetryFrequency']),_0x4ed632['unlockAgent'],_0x4ed632['activeContact']);}}break;case _0x3695('0xc4'):_0x47def1[_0x3695('0x3b')]+=0x1;_0x4ed632[_0x3695('0xc5')]+=0x1;_0x4ed632['countglobal']=ut['totalGlobal'](_0x4ed632);ut['logCustomer'](_0x4ed632,0x3,'NoAnswer');ami['emit'](_0x3695('0xc6'),ut[_0x3695('0x9c')](_0x4ed632,_0x3695('0xc7')));rpcDb[_0x3695('0x8b')](_0x4ed632,_0x3695('0xc8'));if(ut[_0x3695('0x99')](_0x4ed632)>=_0x47def1['dialGlobalMaxRetry']){_0xfe1cf7=ut[_0x3695('0x9f')](_0x4ed632,0xf,_0x3695('0xa0'));rpcDb[_0x3695('0x8e')](_0xfe1cf7,_0x3695('0xc9'));}else{if(_0x4ed632[_0x3695('0xc5')]>=_0x47def1[_0x3695('0xca')]){rpcDb[_0x3695('0x8e')](_0x4ed632,_0x3695('0xc8'));}else{rpcDb[_0x3695('0xa3')](ut[_0x3695('0xc3')](_0x4ed632,_0x3695('0xc5'),_0x47def1[_0x3695('0xcb')]),_0x4ed632[_0x3695('0xcc')],_0x4ed632[_0x3695('0xa5')]);}}break;case _0x3695('0xcd'):_0x47def1[_0x3695('0x39')]+=0x1;_0x4ed632[_0x3695('0xce')]+=0x1;_0x4ed632[_0x3695('0x98')]=ut[_0x3695('0x99')](_0x4ed632);ut[_0x3695('0x87')](_0x4ed632,0x8,_0x3695('0xcf'));ami[_0x3695('0x24')](_0x3695('0xd0'),ut[_0x3695('0x9c')](_0x4ed632,_0x3695('0xd1')));rpcDb[_0x3695('0x8b')](_0x4ed632,_0x3695('0xd2'));if(ut['totalGlobal'](_0x4ed632)>=_0x47def1[_0x3695('0xbf')]){_0xfe1cf7=ut[_0x3695('0x9f')](_0x4ed632,0xf,'Global');rpcDb[_0x3695('0x8e')](_0xfe1cf7,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x4ed632[_0x3695('0xce')]>=_0x47def1['dialCongestionMaxRetry']){rpcDb[_0x3695('0x8e')](_0x4ed632,_0x3695('0xd2'));}else{rpcDb[_0x3695('0xa3')](ut[_0x3695('0xc3')](_0x4ed632,_0x3695('0xce'),_0x47def1[_0x3695('0xd3')]),_0x4ed632['unlockAgent'],_0x4ed632[_0x3695('0xa5')]);}}break;case _0x3695('0xd4'):_0x47def1[_0x3695('0x3f')]+=0x1;_0x4ed632[_0x3695('0xd5')]+=0x1;_0x4ed632[_0x3695('0x98')]=ut[_0x3695('0x99')](_0x4ed632);ut[_0x3695('0x87')](_0x4ed632,0x14,'AgentReject');ami['emit'](_0x3695('0xd6'),ut['buildObj'](_0x4ed632,_0x3695('0xd7')));rpcDb[_0x3695('0x8b')](_0x4ed632,_0x3695('0xd8'));if(ut[_0x3695('0x99')](_0x4ed632)>=_0x47def1['dialGlobalMaxRetry']){_0xfe1cf7=ut[_0x3695('0x9f')](_0x4ed632,0x14,_0x3695('0xd9'));rpcDb['createCustomerFinal'](_0xfe1cf7,_0x3695('0xda'));}else{if(_0x4ed632['countagentrejectretry']>=_0x47def1[_0x3695('0xdb')]){rpcDb[_0x3695('0x8e')](_0x4ed632,_0x3695('0xda'));}else{rpcDb[_0x3695('0xa3')](ut[_0x3695('0xc3')](_0x4ed632,_0x3695('0xd5'),_0x47def1[_0x3695('0xdc')]),_0x4ed632['unlockAgent'],_0x4ed632[_0x3695('0xa5')]);}}break;case _0x3695('0xdd'):_0x47def1[_0x3695('0x41')]+=0x1;_0x4ed632[_0x3695('0xde')]+=0x1;_0x4ed632[_0x3695('0x98')]=ut[_0x3695('0x99')](_0x4ed632);ut['logCustomer'](_0x4ed632,0xb,'Abandoned');rpcDb[_0x3695('0x8b')](_0x4ed632,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x4ed632)>=_0x47def1[_0x3695('0xbf')]){_0xfe1cf7=ut['cloneAction'](_0x4ed632,0xf,_0x3695('0xa0'));rpcDb['createCustomerFinal'](_0xfe1cf7,_0x3695('0xdf'));}else{if(_0x4ed632[_0x3695('0xe0')]>=_0x47def1['dialAbandonedMaxRety']){rpcDb[_0x3695('0x8e')](_0x4ed632,_0x3695('0xdf'));}else{rpcDb[_0x3695('0xa3')](ut[_0x3695('0xc3')](_0x4ed632,'countabandonedretry',_0x47def1[_0x3695('0xe1')]),_0x4ed632[_0x3695('0xcc')],_0x4ed632[_0x3695('0xa5')]);}}break;case'18':_0x47def1[_0x3695('0x40')]+=0x1;_0x4ed632[_0x3695('0xe2')]+=0x1;_0x4ed632[_0x3695('0x98')]=ut['totalGlobal'](_0x4ed632);ut[_0x3695('0x87')](_0x4ed632,0x12,_0x46ca05[_0x3695('0xe3')]||_0x46ca05[_0x3695('0xe4')]);ami[_0x3695('0x24')]('custom:amd',ut['buildObj'](_0x4ed632,_0x3695('0xe5')));rpcDb['createCustomerHistory'](_0x4ed632,_0x3695('0xe6'));if(ut[_0x3695('0x99')](_0x4ed632)>=_0x47def1[_0x3695('0xbf')]){_0xfe1cf7=ut[_0x3695('0x9f')](_0x4ed632,0xf,_0x3695('0xa0'));rpcDb[_0x3695('0x8e')](_0xfe1cf7,_0x3695('0xe6'));}else{rpcDb['createCustomerFinal'](_0x4ed632,_0x3695('0xe6'));}delete this['actions'][_0x46ca05[_0x3695('0xa6')]];break;case'19':_0x47def1['outboundUnknownCallsDay']+=0x1;_0x4ed632['countglobal']=ut[_0x3695('0x99')](_0x4ed632);ut['logCustomer'](_0x4ed632,0x13,_0x46ca05[_0x3695('0xe3')]||_0x46ca05[_0x3695('0xe4')]);ami['emit'](_0x3695('0xe7'),ut[_0x3695('0x9c')](_0x4ed632,'amd'));rpcDb['createCustomerHistory'](_0x4ed632,_0x3695('0xe8'));if(ut['totalGlobal'](_0x4ed632)>=_0x47def1[_0x3695('0xbf')]){_0xfe1cf7=ut[_0x3695('0x9f')](_0x4ed632,0xf,_0x3695('0xa0'));rpcDb[_0x3695('0x8e')](_0xfe1cf7,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x3695('0x8e')](_0x4ed632,_0x3695('0xe8'));}delete this[_0x3695('0x12')][_0x46ca05[_0x3695('0xa6')]];break;default:if(_0x4ed632[_0x3695('0x70')]){ut[_0x3695('0x76')](_0x47def1,_0x3695('0xe9'));ut['loggerError'](_0x3695('0xea')+_0x47def1[_0x3695('0x27')],_0x46ca05);}_0x47def1[_0x3695('0x40')]+=0x1;_0x4ed632[_0x3695('0x98')]=ut[_0x3695('0x99')](_0x4ed632);ut[_0x3695('0x87')](_0x4ed632,0xc,_0x46ca05[_0x3695('0xe3')]||_0x46ca05[_0x3695('0xe4')]);rpcDb['createCustomerHistory'](_0x4ed632,_0x3695('0xeb'));if(ut['totalGlobal'](_0x4ed632)>=_0x47def1[_0x3695('0xbf')]){_0xfe1cf7=ut['cloneAction'](_0x4ed632,0xf,_0x3695('0xa0'));rpcDb[_0x3695('0x8e')](_0xfe1cf7,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x3695('0x8e')](_0x4ed632,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x3695('0x12')][_0x46ca05[_0x3695('0xa6')]];}if(!(_0x4ed632[_0x3695('0x70')]&&_0x4e8d2a==='16')){ut[_0x3695('0x74')](_0x47def1,_0x3695('0xec'));logger[_0x3695('0x54')]('[originated][decrement][callProgressDetectingCustomer]',_0x4ed632[_0x3695('0xac')],_0x3695('0xed'),_0x47def1['name'],_0x3695('0x6d'),_0x47def1[_0x3695('0x5a')]);}if(_0x4e8d2a!==_0x3695('0xa7')){delete this['actions'][_0x46ca05['linkedid']];delete this[_0x3695('0x12')][_0x46ca05['destlinkedid']];}}};Preview[_0x3695('0x60')]['callProgressDetectingAgent']=function(_0x287f2d,_0x554a34,_0x458976){if(_[_0x3695('0xee')](_0x554a34)&&'object'!==typeof _0x554a34){return;}if(_['isUndefined'](_0x458976)&&'object'!==typeof _0x458976){return;}switch(_0x458976[_0x3695('0xef')]){case'0':ut[_0x3695('0xf0')](_0x287f2d,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x287f2d,_0x3695('0xf1'));break;case'3':ut[_0x3695('0xf0')](_0x287f2d,0x3,'NoAnswer');rpcDb[_0x3695('0xf2')](_0x287f2d,_0x3695('0xf3'));break;case'5':ut[_0x3695('0xf0')](_0x287f2d,0x5,_0x3695('0xbc'));rpcDb[_0x3695('0xf2')](_0x287f2d,_0x3695('0xf4'));break;case'8':ut[_0x3695('0xf0')](_0x287f2d,0x8,_0x3695('0xcf'));rpcDb['createAgentHistory'](_0x287f2d,_0x3695('0xf5'));break;case'22':ut[_0x3695('0xf0')](_0x287f2d,0x16,'AnswerAGI');rpcDb[_0x3695('0xf2')](_0x287f2d,_0x3695('0xf6'));break;default:ut[_0x3695('0xf0')](_0x287f2d,0xc,_0x458976[_0x3695('0xef')]);rpcDb[_0x3695('0xf2')](_0x287f2d,'[callProgressDetectingAgent][logCongestion]');}ut[_0x3695('0x74')](_0x554a34,_0x3695('0xf7'));logger[_0x3695('0x54')](_0x3695('0xf8'),_0x287f2d['uniqueid'],_0x3695('0xed'),_0x554a34[_0x3695('0x27')],_0x3695('0x6d'),_0x554a34[_0x3695('0x5a')]);delete this[_0x3695('0x12')][_0x287f2d['uniqueid']];};Preview[_0x3695('0x60')][_0x3695('0xf9')]=function(_0xc6fcfe,_0xd00c2,_0x15b654,_0x457f01,_0x106f3d){var _0xd8e854=this;return new BPromise(function(_0x2cdbac,_0x59160d){if(_[_0x3695('0x6a')](_0xd00c2)||_[_0x3695('0x6a')](_0xd00c2['Contact'])||_['isNil'](_0xd00c2[_0x3695('0xfa')][_0x3695('0xfb')])||_[_0x3695('0x6a')](_0xd00c2['VoiceQueueId'])){_0x59160d(ut[_0x3695('0x49')](_0x3695('0xfc'),_0x457f01,_0x106f3d));return;}var _0x4ece50=uuid['v4']();var _0x4fd970=_0xd8e854[_0x3695('0x10')][_0xd00c2[_0x3695('0x6c')][_0x3695('0x27')]];var _0x4c3b9d=_0x15b654?_0xd8e854[_0x3695('0x13')][_0x15b654]['id']:undefined;_0xd8e854['actions'][_0x4ece50]=new Action(_0xd00c2,_0x4fd970,_0x4ece50,_0x15b654,_0x4c3b9d);var _0x3ff010=_0xd8e854[_0x3695('0x12')][_0x4ece50];_0x3ff010['unlockAgent']=_0x457f01;_0x3ff010[_0x3695('0xa5')]=_0x106f3d;_0x3ff010[_0x3695('0xfd')]=_0x15b654;if(_[_0x3695('0xfe')](_0xc6fcfe)){_0xd8e854[_0x3695('0xff')](_0x3ff010,_0x4fd970,_0xd00c2,_0x15b654)['then'](function(_0x52c2ad){logger['info']('[Preview][execCall][success]',_0x3695('0x100')+_0x3ff010[_0x3695('0x6e')]+_0x3695('0x101')+_0x3ff010['idContact'],JSON['stringify'](_0x52c2ad));ami[_0x3695('0x24')](_0x3695('0x102'),ut[_0x3695('0x9c')](_0x3ff010,'called',_0xd8e854[_0x3695('0x10')][_0x3ff010[_0x3695('0x6e')]]));_0x2cdbac(ut[_0x3695('0x49')](_0x3695('0x103')));})[_0x3695('0x8f')](function(_0x4c2121){ut['logger']('[Preview][execCall][failure]',_0x4c2121);_0x59160d(ut[_0x3695('0x49')](_0x3695('0x104'),_0x457f01,_0x106f3d));});}else{_0x4fd970[_0x3695('0x105')]+=0x1;ut[_0x3695('0x106')](_0x3ff010);rpcDb[_0x3695('0x107')](_0x3ff010,'[Blacklist][error]');delete _0xd8e854[_0x3695('0x12')][_0x4ece50];_0x59160d(ut['message'](_0x3695('0x108'),_0x457f01,_0x106f3d));}});};Preview['prototype'][_0x3695('0x93')]=function(_0x767379){return!_[_0x3695('0x6a')](_0x767379)&&!_['isNil'](_0x767379['name'])&&!_['isNil'](_0x767379[_0x3695('0x109')])&&_0x767379[_0x3695('0x109')]&&!_[_0x3695('0x6a')](this[_0x3695('0x11')][util[_0x3695('0x56')](_0x3695('0x10a'),_0x767379[_0x3695('0x27')])])&&!_[_0x3695('0x6a')](this[_0x3695('0x11')][util[_0x3695('0x56')](_0x3695('0x10a'),_0x767379[_0x3695('0x27')])][_0x3695('0x10b')])&&(this[_0x3695('0x11')][util[_0x3695('0x56')](_0x3695('0x10a'),_0x767379[_0x3695('0x27')])]['status']===_0x3695('0x10c')||this[_0x3695('0x11')][util[_0x3695('0x56')](_0x3695('0x10a'),_0x767379['name'])][_0x3695('0x10b')]===_0x3695('0x10d'));};Preview[_0x3695('0x60')]['run']=function(_0x19cdbb,_0x2d2afc){var _0x17c090=this;return new BPromise(function(_0x56dd41,_0x52768a){_0x17c090[_0x3695('0x10e')](_0x19cdbb,_0x2d2afc)['then'](function(_0x598f40){_0x56dd41(_[_0x3695('0x71')](_0x598f40,[_0x3695('0x49')]));})['catch'](function(_0x1b47e6){if(_0x1b47e6[_0x3695('0x10f')]){rpcDb['unlockContact'](_0x19cdbb);}if(_0x1b47e6[_0x3695('0x109')]){rpcDb[_0x3695('0x110')](_0x19cdbb);}_0x52768a(_[_0x3695('0x71')](_0x1b47e6,[_0x3695('0x49')]));});});};Preview[_0x3695('0x60')][_0x3695('0x10e')]=function(_0x9c6ba5,_0x2481c9){var _0x399bfd=this;return new BPromise(function(_0x18cd28,_0xd7d33a){var _0xd79f74,_0x170f71;rpcDb[_0x3695('0x111')](_0x9c6ba5)['then'](function(_0x2b675c){if(!_['isNil'](_0x2b675c[0x0])){_0x170f71=_0x2b675c[0x0][_0x3695('0x112')]?![]:!![];_0xd79f74=_0x2b675c[0x0][_0x3695('0x112')]?!![]:![];_0xd79f74=_0x2481c9?!![]:_0xd79f74;}var _0x4b8ce8=_0x399bfd['validateContact'](_0x2b675c);if(_0x4b8ce8[_0x3695('0x113')]){rpcDb[_0x3695('0x114')](_['pick'](_0x2b675c[0x0],[_0x3695('0x115'),_0x3695('0x116')]))[_0x3695('0x7e')](function(_0x29467a){_0x399bfd[_0x3695('0xf9')](_0x29467a,_0x2b675c[0x0],_0x2481c9,_0x170f71,_0xd79f74)[_0x3695('0x7e')](function(_0x3dd8f0){_0x18cd28(_0x3dd8f0);})[_0x3695('0x8f')](function(_0xe3a87b){_0xd7d33a(_0xe3a87b);});})[_0x3695('0x8f')](function(_0x31e7d3){ut[_0x3695('0x5d')]('[Preview][checkIsBlackList]',_0x31e7d3);_0xd7d33a(ut[_0x3695('0x49')](_0x3695('0x117'),_0x170f71,_0xd79f74));});}else{_0xd7d33a(ut[_0x3695('0x49')](_0x4b8ce8[_0x3695('0x49')],_0x170f71,_0xd79f74));}})[_0x3695('0x8f')](function(_0x1b9285){ut[_0x3695('0x5d')](_0x3695('0x118'),_0x1b9285);_0xd7d33a(ut[_0x3695('0x49')](_0x3695('0x117'),![],!![]));});});};Preview[_0x3695('0x60')][_0x3695('0x119')]=function(_0x1b152f){if(_['isNil'](_0x1b152f)||_[_0x3695('0xfe')](_0x1b152f)||!_['isNil'](_0x1b152f[0x0][_0x3695('0x82')])&&_[_0x3695('0x6a')](_0x1b152f[0x0]['Agent']['name'])){ut[_0x3695('0x5d')](_0x3695('0x11a'),_0x1b152f);return{'isValid':![],'message':_0x3695('0x11b')};}var _0x323ba3=this[_0x3695('0x10')][_0x1b152f[0x0][_0x3695('0x6c')][_0x3695('0x27')]];_0x323ba3['message']='ACTIVE';if(_[_0x3695('0x6a')](_0x323ba3)){ut[_0x3695('0x5d')]('[Preview][validateContact][Empty\x20Campaign]',_0x323ba3);return{'isValid':![],'message':_0x3695('0x11c')};}if(!this[_0x3695('0x93')](_0x323ba3[_0x3695('0x50')])){ut[_0x3695('0x5d')](_0x3695('0x11d'),'campaign\x20Name:\x20'+_0x323ba3[_0x3695('0x27')]+_0x3695('0x11e'));if(!this[_0x3695('0x93')](_0x323ba3[_0x3695('0x11f')])){ut[_0x3695('0x5d')](_0x3695('0x11d'),_0x323ba3[_0x3695('0x27')]+_0x3695('0x120'));return{'isValid':![],'message':_0x3695('0x121')};}}if(!ut[_0x3695('0x92')](_0x323ba3[_0x3695('0x31')])){ut[_0x3695('0x5d')](_0x3695('0x122'),_0x323ba3[_0x3695('0x27')]+_0x3695('0x123'));return{'isValid':![],'message':_0x3695('0x124')+_0x323ba3['name']+_0x3695('0x123')};}return{'isValid':!![],'message':_0x3695('0x125')};};Preview[_0x3695('0x60')][_0x3695('0xff')]=function(_0x39129b,_0x3f388e,_0x562bad,_0x1a6289){var _0x2e2499=this;return new BPromise(function(_0x2fd576,_0x504811){var _0x5809ef=_0x39129b[_0x3695('0xac')];var _0x5c598d=_0x2e2499[_0x3695('0x93')](_0x3f388e[_0x3695('0x50')])?util['format'](_0x3695('0x126'),_0x3f388e['Trunk'][_0x3695('0x27')],_['isNil'](_0x3f388e[_0x3695('0x35')])?'':_0x3f388e[_0x3695('0x35')][_0x3695('0x127')]()||'',_0x3f388e[_0x3695('0x128')]>0x0?_0x562bad[_0x3695('0xfa')][_0x3695('0xfb')][_0x3695('0x129')](_0x3f388e[_0x3695('0x128')]):_0x562bad['Contact'][_0x3695('0xfb')]):util[_0x3695('0x56')](_0x3695('0x126'),_['isNil'](_0x3f388e[_0x3695('0x11f')])?_0x3f388e['Trunk'][_0x3695('0x27')]:_0x3f388e[_0x3695('0x11f')]['name'],_[_0x3695('0x6a')](_0x3f388e[_0x3695('0x35')])?'':_0x3f388e[_0x3695('0x35')][_0x3695('0x127')]()||'',_0x3f388e[_0x3695('0x128')]>0x0?_0x562bad['Contact']['phone'][_0x3695('0x129')](_0x3f388e[_0x3695('0x128')]):_0x562bad[_0x3695('0xfa')][_0x3695('0xfb')]);var _0x30e9dc=_0x2e2499[_0x3695('0x93')](_0x3f388e['Trunk'])?ut[_0x3695('0x12a')](_0x3f388e[_0x3695('0x50')][_0x3695('0x12b')],_0x3f388e['dialOriginateCallerIdName'],_0x3f388e['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x3f388e[_0x3695('0x33')],_0x3f388e[_0x3695('0x12c')]):_0x3f388e['dialOriginateCallerIdNumber']):ut[_0x3695('0x12a')](_[_0x3695('0x6a')](_0x3f388e[_0x3695('0x11f')])?_0x3f388e[_0x3695('0x50')][_0x3695('0x12b')]:_0x3f388e[_0x3695('0x11f')][_0x3695('0x12b')],_0x3f388e['dialOriginateCallerIdName'],_0x3f388e[_0x3695('0x12c')]>0x0?ut[_0x3695('0x12d')](_0x3f388e[_0x3695('0x33')],_0x3f388e['dialRandomLastDigitCallerIdNumber']):_0x3f388e[_0x3695('0x33')]);if(_0x30e9dc){_0x39129b['originatecalleridname']=ut[_0x3695('0x12e')](_0x30e9dc);_0x39129b[_0x3695('0x12f')]=ut[_0x3695('0x130')](_0x30e9dc);}var _0x21d299=ut[_0x3695('0x131')](_0x3f388e,_0x562bad,_0x5c598d,_0x30e9dc,_0x5809ef,_0x39129b);_[_0x3695('0x132')](_0x39129b,ut[_0x3695('0x133')](_0x21d299));_0x39129b[_0x3695('0x86')]=moment()[_0x3695('0x56')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x3695('0x73')](ut[_0x3695('0x134')](_0x39129b,_0x3f388e,_0x21d299,_0x39129b['activeContact'],_0x1a6289))[_0x3695('0x7e')](function(_0x1f8421){_0x3f388e[_0x3695('0x5a')]+=0x1;logger[_0x3695('0x54')]('[originated][increment]',_0x5809ef,'\x20Queue',_0x3f388e['name'],_0x3695('0x6d'),_0x3f388e[_0x3695('0x5a')]);_0x2fd576(_0x1f8421);})['catch'](function(_0x5d0359){ut['logAgent'](_0x39129b,0xe,_0x3695('0x135'));rpcDb['createAgentHistory'](_0x39129b,_0x3695('0x136'));_0x504811(_0x5d0359);});});};Preview[_0x3695('0x60')][_0x3695('0x137')]=function(_0x331e5c){if(this[_0x3695('0x12')][_0x331e5c[_0x3695('0xa6')]]){this['actions'][_0x331e5c[_0x3695('0xa6')]][_0x3695('0x138')]=_0x331e5c[_0x3695('0x138')];}};Preview['prototype']['syncOriginateResponse']=function(_0x34c94f){var _0xcf5bad=this;var _0x1ee6f4=this[_0x3695('0x12')][_0x34c94f['actionid']];if(_0x1ee6f4){if(_0x1ee6f4['lookAgent']&&this[_0x3695('0x13')][_0x1ee6f4['lookAgent']]){ut[_0x3695('0x139')](_0x1ee6f4,this[_0x3695('0x13')][_0x1ee6f4[_0x3695('0xfd')]][_0x3695('0x27')],this[_0x3695('0x13')][_0x1ee6f4[_0x3695('0xfd')]]['id']);}var _0x2a5557=_['clone'](_0x1ee6f4);_0x2a5557[_0x3695('0xa9')]=moment()[_0x3695('0x56')](_0x3695('0xa8'));var _0x3c5f9e=_0xcf5bad['campaignsPreview'][_0x1ee6f4[_0x3695('0x6e')]];if(ut[_0x3695('0x13a')](_0x34c94f['response'])){if(_0x1ee6f4[_0x3695('0xcc')]){rpcDb[_0x3695('0x13b')](_0x1ee6f4['idContact']);}if(_0x1ee6f4[_0x3695('0xa5')]){rpcDb[_0x3695('0x110')](_0x1ee6f4[_0x3695('0x13c')]);}ami[_0x3695('0x24')](_0x3695('0x13d'),ut[_0x3695('0x9c')](_0x1ee6f4,'rejected',this[_0x3695('0x10')][_0x1ee6f4[_0x3695('0x6e')]]));this[_0x3695('0x13e')](_0x2a5557,_0x3c5f9e,_0x34c94f);}else{_0x1ee6f4['starttime']=moment()['format'](_0x3695('0xa8'));ut['logAgent'](_0x2a5557,0x4,_0x3695('0xb6'));rpcDb[_0x3695('0xf2')](_0x2a5557,_0x3695('0x13f'));}}};Preview['prototype'][_0x3695('0x19')]=function(_0x5dd597){var _0x799c35=this;var _0x9dbefe=this[_0x3695('0x12')][_0x5dd597[_0x3695('0xa6')]];var _0x29aa4c;if(_0x9dbefe){_0x29aa4c=this[_0x3695('0x10')][_0x9dbefe[_0x3695('0x6e')]];logger[_0x3695('0x54')]('[syncHangup][talking]',_0x5dd597[_0x3695('0xa6')],_0x3695('0xed'),_0x29aa4c[_0x3695('0x27')],_0x3695('0x6f'),_0x29aa4c[_0x3695('0x5b')]);}if(this['actions'][_0x5dd597[_0x3695('0xa6')]]&&_0x5dd597[_0x3695('0xa6')]!==_0x5dd597[_0x3695('0xac')]){if(_0x5dd597[_0x3695('0x140')]==='16'&&this[_0x3695('0x12')][_0x5dd597[_0x3695('0xa6')]][_0x3695('0x70')]){this['callProgressDetectingCustomer'](_0x5dd597,_0x5dd597[_0x3695('0xa6')],_0x5dd597[_0x3695('0x140')]);}else if(this[_0x3695('0x12')][_0x5dd597[_0x3695('0xa6')]][_0x3695('0x70')]){logger[_0x3695('0x54')](_0x3695('0x141'),_0x5dd597[_0x3695('0xa6')],_0x5dd597[_0x3695('0x140')],_0x3695('0xed'),_0x29aa4c['name'],_0x3695('0x6f'),_0x29aa4c[_0x3695('0x5b')]);this[_0x3695('0x96')](_0x5dd597,_0x5dd597[_0x3695('0xa6')],_0x5dd597['cause']);}}else if(_0x9dbefe&&_['isNil'](_0x9dbefe['statedesc'])&&_0x29aa4c[_0x3695('0x142')]&&_0x5dd597['linkedid']===_0x5dd597[_0x3695('0xac')]&&_[_0x3695('0x6a')](_0x5dd597[_0x3695('0xef')])&&_0x5dd597[_0x3695('0x140')]==='16'&&_0x5dd597['channelstate']==='6'&&_[_0x3695('0xee')](_0x9dbefe['transfer'])){if(_0x9dbefe[_0x3695('0xcc')]){rpcDb[_0x3695('0x13b')](_0x9dbefe[_0x3695('0x13c')]);}if(_0x9dbefe['activeContact']){rpcDb[_0x3695('0x110')](_0x9dbefe['idContact']);}_0x5dd597[_0x3695('0xef')]='22';this[_0x3695('0x13e')](_0x9dbefe,_0x29aa4c,_0x5dd597);}else if(_0x9dbefe&&_0x9dbefe[_0x3695('0x143')]){if(_0x5dd597[_0x3695('0x140')]==='16'&&this[_0x3695('0x12')][_0x5dd597[_0x3695('0xa6')]][_0x3695('0x70')]){logger[_0x3695('0x54')](_0x3695('0x144'),_0x5dd597['linkedid'],_0x5dd597[_0x3695('0x140')],'\x20Queue',_0x29aa4c[_0x3695('0x27')],_0x3695('0x6f'),_0x29aa4c[_0x3695('0x5b')]);this[_0x3695('0x96')](_0x5dd597,_0x5dd597[_0x3695('0xa6')],_0x5dd597[_0x3695('0x140')]);}else if(this['actions'][_0x5dd597[_0x3695('0xa6')]][_0x3695('0x70')]){logger['info'](_0x3695('0x141'),_0x5dd597[_0x3695('0xa6')],_0x5dd597['cause'],'\x20Queue',_0x29aa4c['name'],_0x3695('0x6f'),_0x29aa4c[_0x3695('0x5b')]);this[_0x3695('0x96')](_0x5dd597,_0x5dd597[_0x3695('0xa6')],_0x5dd597[_0x3695('0x140')]);}}};Preview['prototype'][_0x3695('0x1d')]=function(_0x3d29fd){if(this[_0x3695('0x12')][_0x3d29fd[_0x3695('0x145')]]&&_0x3d29fd[_0x3695('0x145')]!==_0x3d29fd[_0x3695('0x146')]){this[_0x3695('0x96')](_0x3d29fd,_0x3d29fd[_0x3695('0x145')],_0x3d29fd['dialstatus']);}};Preview['prototype'][_0x3695('0x1b')]=function(_0x5a59e5){if(this[_0x3695('0x12')][_0x5a59e5[_0x3695('0xa6')]]&&_0x5a59e5[_0x3695('0xa6')]!==_0x5a59e5[_0x3695('0xac')]&&!this[_0x3695('0x12')][_0x5a59e5[_0x3695('0xa6')]][_0x3695('0x70')]){if(_0x5a59e5[_0x3695('0x140')]==='1'){this[_0x3695('0x96')](_0x5a59e5,_0x5a59e5['linkedid'],_0x5a59e5[_0x3695('0x140')]);}}};Preview[_0x3695('0x60')][_0x3695('0x147')]=function(_0x1f914e,_0x1164b7,_0x25c5ef){if(this[_0x3695('0x12')][_0x1f914e]){if(_[_0x3695('0x6a')](this[_0x3695('0x12')][_0x1f914e][_0x3695('0x148')])){this[_0x3695('0x12')][_0x1f914e]['variables']={};}this[_0x3695('0x12')][_0x1f914e][_0x3695('0x148')][_0x1164b7]=_0x25c5ef;}};Preview[_0x3695('0x60')]['syncVarSet']=function(_0x550fae){try{if(!_[_0x3695('0x6a')](_0x550fae)){if(ut['filterKey'](_['keys'](_0x550fae[_0x3695('0x149')])[0x0])){this[_0x3695('0x147')](_0x550fae['uniqueid'],_[_0x3695('0x14a')](_0x550fae[_0x3695('0x149')])[0x0],_0x550fae[_0x3695('0x14b')]);}}}catch(_0x53121c){logger[_0x3695('0x14c')](_0x3695('0x14d'),util[_0x3695('0x14e')](_0x53121c,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x3695('0x21')]=function(_0x1fa0c4){if(_0x1fa0c4){if(this[_0x3695('0x12')][_0x1fa0c4['transfertargetlinkedid']]){this['actions'][_0x1fa0c4['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0x3695('0x60')][_0x3695('0x22')]=function(_0x13839b){if(_0x13839b){if(this[_0x3695('0x12')][_0x13839b[_0x3695('0x14f')]]){this[_0x3695('0x12')][_0x13839b[_0x3695('0x14f')]][_0x3695('0x143')]=!![];}}};module[_0x3695('0x150')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 01c1642..94aa33e 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 _0x6aa7=['type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','xcally-motion-preview','assigned','membername','create','getContactRecallMe','[GetContactRecallMe]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','error','inspect','then','createHistory','catch','resolve','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20'];(function(_0x5938af,_0x191281){var _0x1a89a9=function(_0x258dfc){while(--_0x258dfc){_0x5938af['push'](_0x5938af['shift']());}};_0x1a89a9(++_0x191281);}(_0x6aa7,0x178));var _0x76aa=function(_0x2be40e,_0x25003d){_0x2be40e=_0x2be40e-0x0;var _0x36c4be=_0x6aa7[_0x2be40e];return _0x36c4be;};'use strict';var util=require(_0x76aa('0x0'));var BPromise=require('bluebird');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var _=require(_0x76aa('0x3'));var cmHopper=require(_0x76aa('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x76aa('0x5'));var cmHopperBlack=require(_0x76aa('0x6'));var voiceQueueRt=require(_0x76aa('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x1aceaa){return function(_0x4d53f6){logger[_0x76aa('0x8')](_0x1aceaa,util[_0x76aa('0x9')](_0x4d53f6,{'showHidden':![],'depth':null}));};}function create(_0xa9b695){return BPromise['resolve']()[_0x76aa('0xa')](cmHopperHistory[_0x76aa('0xb')](_0xa9b695))[_0x76aa('0xc')](loggerCatch('[createHistory]\x20'));}function createAgent(_0xcd99aa){return BPromise[_0x76aa('0xd')]()[_0x76aa('0xa')](agentReportPreview[_0x76aa('0xb')](_0xcd99aa))[_0x76aa('0xc')](loggerCatch(_0x76aa('0xe')));}function moveContact(_0x2c5075){return BPromise[_0x76aa('0xd')]()[_0x76aa('0xa')](cmHopper[_0x76aa('0xf')](_0x2c5075,!![]))['catch'](loggerCatch(_0x76aa('0x10')));}exports['checkIsBlackList']=function(_0x226536){return BPromise[_0x76aa('0xd')]()[_0x76aa('0xa')](cmHopperBlack[_0x76aa('0x11')](_0x226536))[_0x76aa('0xc')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x2b3b4f){return BPromise['resolve']()[_0x76aa('0xa')](cmHopper[_0x76aa('0x12')](_0x2b3b4f))['catch'](loggerCatch(_0x76aa('0x13')));};exports['createHistory']=function(_0x328381,_0x5181d2){create(_0x328381)[_0x76aa('0xc')](loggerCatch(_0x5181d2));moveContact(_0x328381)[_0x76aa('0xc')](loggerCatch(_0x5181d2));};exports[_0x76aa('0x14')]=function(_0x21c16d,_0xa1bc7){createAgent(_0x21c16d)[_0x76aa('0xc')](loggerCatch(_0xa1bc7));};exports['createCustomerHistory']=function(_0x5d6202,_0x256636){create(_0x5d6202)[_0x76aa('0xc')](loggerCatch(_0x256636));};exports[_0x76aa('0x15')]=function(_0x15b931,_0x15109b){moveContact(_0x15b931)[_0x76aa('0xc')](loggerCatch(_0x15109b));};exports[_0x76aa('0x16')]=function(_0x2eaf48,_0x385157,_0x5990c1){if(_0x385157){_0x2eaf48[_0x76aa('0x17')]=null;}if(_0x5990c1){_0x2eaf48[_0x76aa('0x18')]=![];}return BPromise[_0x76aa('0xd')]()['then'](cmHopper[_0x76aa('0x16')](_0x2eaf48))[_0x76aa('0xc')](loggerCatch(_0x76aa('0x19')));};exports[_0x76aa('0x1a')]=function(_0x29c50c){return BPromise[_0x76aa('0xd')]()[_0x76aa('0xa')](cmHopper[_0x76aa('0x1a')](_0x29c50c))[_0x76aa('0xc')](loggerCatch(_0x76aa('0x1b')));};exports[_0x76aa('0x1c')]=function(_0x26b75e){return BPromise[_0x76aa('0xd')]()['then'](cmHopper[_0x76aa('0x1c')]({'UserId':null},_0x26b75e,0x1))[_0x76aa('0xc')](loggerCatch(_0x76aa('0x1d')));};exports[_0x76aa('0x1e')]=function(_0xa1e6){return BPromise[_0x76aa('0xd')]()[_0x76aa('0xa')](cmHopper[_0x76aa('0x1c')]({'active':![]},_0xa1e6,0x1))[_0x76aa('0xc')](loggerCatch(_0x76aa('0x1f')));};exports['crateCustomerReportQueue']=function(_0x3fcb7f){var _0x5a8030={};_0x5a8030[_0x76aa('0x20')]=_0x3fcb7f[_0x76aa('0x20')];_0x5a8030[_0x76aa('0x21')]=_0x3fcb7f[_0x76aa('0x21')];_0x5a8030[_0x76aa('0x22')]=_0x3fcb7f[_0x76aa('0x22')];_0x5a8030[_0x76aa('0x23')]=_0x3fcb7f[_0x76aa('0x23')];_0x5a8030[_0x76aa('0x24')]=_0x3fcb7f[_0x76aa('0x24')];_0x5a8030['queuecallerjoinAt']=_0x3fcb7f[_0x76aa('0x25')];_0x5a8030[_0x76aa('0x26')]=_0x3fcb7f[_0x76aa('0x25')];_0x5a8030[_0x76aa('0x27')]=0x1;_0x5a8030[_0x76aa('0x28')]=_0x3fcb7f[_0x76aa('0x29')];_0x5a8030[_0x76aa('0x2a')]=_0x3fcb7f['membername'];_0x5a8030[_0x76aa('0x2b')]=_0x76aa('0x2c');_0x5a8030['exten']=_0x76aa('0x2d');_0x5a8030['holdtime']=0x0;_0x5a8030[_0x76aa('0x2e')]=0x1;_0x5a8030['lastAssignedTo']=_0x3fcb7f[_0x76aa('0x2f')];_0x5a8030['queuecallerexitreason']='COMPLETED';return BPromise[_0x76aa('0xd')]()[_0x76aa('0xa')](voiceQueueReport[_0x76aa('0x30')](_0x5a8030))[_0x76aa('0xc')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0xdb18d3,_0x1c7b6f){return BPromise[_0x76aa('0xd')]()[_0x76aa('0xa')](cmHopper[_0x76aa('0x31')](_0xdb18d3,_0x1c7b6f))['catch'](loggerCatch(_0x76aa('0x32')));};exports['rescheduleContactInQueue']=function(_0x5086f5){return BPromise[_0x76aa('0xd')]()[_0x76aa('0xa')](cmHopper[_0x76aa('0x16')](_0x5086f5,!![],!![]))[_0x76aa('0xc')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x5ad3=['[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','calleridnum','calleridname','answertime','queuecallercomplete','endtime','membername','from-sip','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createHistory','createAgentHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled'];(function(_0x20b381,_0x18b761){var _0x238ddf=function(_0xa5f7e1){while(--_0xa5f7e1){_0x20b381['push'](_0x20b381['shift']());}};_0x238ddf(++_0x18b761);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x39979b,_0x2111f9){_0x39979b=_0x39979b-0x0;var _0x560b41=_0x5ad3[_0x39979b];return _0x560b41;};'use strict';var util=require(_0x35ad('0x0'));var BPromise=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var _=require('lodash');var cmHopper=require(_0x35ad('0x4'));var cmHopperFinal=require(_0x35ad('0x5'));var cmHopperHistory=require(_0x35ad('0x6'));var cmHopperBlack=require(_0x35ad('0x7'));var voiceQueueRt=require(_0x35ad('0x8'));var agentReportPreview=require(_0x35ad('0x9'));var voiceQueueReport=require(_0x35ad('0xa'));function loggerCatch(_0x436dcb){return function(_0x36c606){logger[_0x35ad('0xb')](_0x436dcb,util['inspect'](_0x36c606,{'showHidden':![],'depth':null}));};}function create(_0x292521){return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](cmHopperHistory['createHistory'](_0x292521))[_0x35ad('0xe')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x5a29e3){return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](agentReportPreview['createHistory'](_0x5a29e3))[_0x35ad('0xe')](loggerCatch(_0x35ad('0xf')));}function moveContact(_0x4ad760){return BPromise['resolve']()[_0x35ad('0xd')](cmHopper[_0x35ad('0x10')](_0x4ad760,!![]))['catch'](loggerCatch(_0x35ad('0x11')));}exports[_0x35ad('0x12')]=function(_0x595fe8){return BPromise['resolve']()[_0x35ad('0xd')](cmHopperBlack[_0x35ad('0x12')](_0x595fe8))[_0x35ad('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x35ad('0x13')]=function(_0x2ebceb){return BPromise['resolve']()[_0x35ad('0xd')](cmHopper['getContactPreview'](_0x2ebceb))['catch'](loggerCatch(_0x35ad('0x14')));};exports[_0x35ad('0x15')]=function(_0x27efeb,_0x56cb8e){create(_0x27efeb)[_0x35ad('0xe')](loggerCatch(_0x56cb8e));moveContact(_0x27efeb)[_0x35ad('0xe')](loggerCatch(_0x56cb8e));};exports[_0x35ad('0x16')]=function(_0x3158a1,_0x3a73c8){createAgent(_0x3158a1)[_0x35ad('0xe')](loggerCatch(_0x3a73c8));};exports['createCustomerHistory']=function(_0xd32a43,_0x2876ad){create(_0xd32a43)['catch'](loggerCatch(_0x2876ad));};exports['createCustomerFinal']=function(_0x3251d9,_0x398853){moveContact(_0x3251d9)['catch'](loggerCatch(_0x398853));};exports[_0x35ad('0x17')]=function(_0x32735e,_0x496620,_0x37c03d){if(_0x496620){_0x32735e[_0x35ad('0x18')]=null;}if(_0x37c03d){_0x32735e[_0x35ad('0x19')]=![];}return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](cmHopper[_0x35ad('0x17')](_0x32735e))[_0x35ad('0xe')](loggerCatch(_0x35ad('0x1a')));};exports[_0x35ad('0x1b')]=function(_0xebc6c5){return BPromise['resolve']()[_0x35ad('0xd')](cmHopper[_0x35ad('0x1b')](_0xebc6c5))['catch'](loggerCatch(_0x35ad('0x1c')));};exports[_0x35ad('0x1d')]=function(_0xa3cb9f){return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](cmHopper['unlockContact']({'UserId':null},_0xa3cb9f,0x1))[_0x35ad('0xe')](loggerCatch(_0x35ad('0x1e')));};exports[_0x35ad('0x1f')]=function(_0x1ca61d){return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](cmHopper[_0x35ad('0x1d')]({'active':![]},_0x1ca61d,0x1))[_0x35ad('0xe')](loggerCatch('[activeContact]\x20'));};exports[_0x35ad('0x20')]=function(_0x11da54){var _0x2f8b3={};_0x2f8b3[_0x35ad('0x21')]=_0x11da54[_0x35ad('0x21')];_0x2f8b3['uniqueid']=_0x11da54['uniqueid'];_0x2f8b3[_0x35ad('0x22')]=_0x11da54['calleridnum'];_0x2f8b3[_0x35ad('0x23')]=_0x11da54['calleridname'];_0x2f8b3['queue']=_0x11da54['queue'];_0x2f8b3['queuecallerjoinAt']=_0x11da54[_0x35ad('0x24')];_0x2f8b3['queuecallerleaveAt']=_0x11da54['answertime'];_0x2f8b3[_0x35ad('0x25')]=0x1;_0x2f8b3['queuecallercompleteAt']=_0x11da54[_0x35ad('0x26')];_0x2f8b3['connectedlinename']=_0x11da54[_0x35ad('0x27')];_0x2f8b3['context']=_0x35ad('0x28');_0x2f8b3['exten']=_0x35ad('0x29');_0x2f8b3[_0x35ad('0x2a')]=0x0;_0x2f8b3[_0x35ad('0x2b')]=0x1;_0x2f8b3['lastAssignedTo']=_0x11da54[_0x35ad('0x27')];_0x2f8b3[_0x35ad('0x2c')]=_0x35ad('0x2d');return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](voiceQueueReport['create'](_0x2f8b3))['catch'](loggerCatch(_0x35ad('0x2e')));};exports[_0x35ad('0x2f')]=function(_0x378e2a,_0x1c8a3d){return BPromise['resolve']()[_0x35ad('0xd')](cmHopper[_0x35ad('0x2f')](_0x378e2a,_0x1c8a3d))[_0x35ad('0xe')](loggerCatch(_0x35ad('0x30')));};exports[_0x35ad('0x31')]=function(_0x3b7b52){return BPromise['resolve']()['then'](cmHopper[_0x35ad('0x17')](_0x3b7b52,!![],!![]))[_0x35ad('0xe')](loggerCatch(_0x35ad('0x32')));}; \ 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 f5e74da..4e92d56 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 _0x5df9=['RECALL','BOOKED','uniqueid','originate','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','clone','scheduledAt','active','scheduledat','add','ListId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','queue','interface','channelAgent','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','reachable','getDiff','createBody','filterKey','idContact','type','dialAnswer','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','match','util','lodash','moment','127.0.0.1','milliseconds','diff','seconds','error','logger','inspect','logger2','info','getCallerId','isUndefined','isEmpty','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','isActive','addVariables','Queue','name','format','calleridname','calleridnum','ContactId','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','%s%s','toUpper','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','statedesc','Blacklist','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','logLookAgent','membername','UserId','ringtime','starttime','talktime','answertime','Failure'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5df9,0x142));var _0x95df=function(_0x48b616,_0x34b1c4){_0x48b616=_0x48b616-0x0;var _0x31e225=_0x5df9[_0x48b616];return _0x31e225;};'use strict';var util=require(_0x95df('0x0'));var _=require(_0x95df('0x1'));var moment=require(_0x95df('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process['env']['XCALLY_IP_AGI']||_0x95df('0x3');function getSeconds(_0x267d5d,_0x919d31){var _0x2c92d8=moment(_0x267d5d)['milliseconds'](0x0);var _0x47a383=moment(_0x919d31)[_0x95df('0x4')](0x0);return _0x2c92d8[_0x95df('0x5')](_0x47a383,_0x95df('0x6'));}exports['loggerCatch']=function(_0x35cfc7){return function(_0x1d4af9){logger[_0x95df('0x7')](_0x35cfc7,util['inspect'](_0x1d4af9,{'showHidden':![],'depth':null}));};};exports[_0x95df('0x8')]=function(_0x33389d,_0x45e4f6){logger['info'](_0x33389d,util[_0x95df('0x9')](_0x45e4f6,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x41dca1,_0x1111bd){logger['error'](_0x41dca1,util[_0x95df('0x9')](_0x1111bd,{'showHidden':![],'depth':null}));};exports[_0x95df('0xa')]=function(_0x24c943){return function(_0x129403){logger[_0x95df('0xb')](_0x24c943,util[_0x95df('0x9')](_0x129403,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x1cc9c2,_0x4126eb,_0x8f7910){return{'message':_0x1cc9c2,'unlock':_0x4126eb,'active':_0x8f7910};};exports[_0x95df('0xc')]=function(_0x59c7ff,_0x4b2a8f,_0x1b7f15){if(!_[_0x95df('0xd')](_0x1b7f15)&&'string'===typeof _0x1b7f15&&!_[_0x95df('0xe')](_0x1b7f15)){if(!_['isUndefined'](_0x4b2a8f)&&'string'===typeof _0x4b2a8f&&!_[_0x95df('0xe')](_0x4b2a8f)){return util['format'](_0x95df('0xf'),_0x4b2a8f,_0x1b7f15);}return util['format'](_0x95df('0xf'),_0x1b7f15,_0x1b7f15);}if(!_[_0x95df('0xd')](_0x59c7ff)&&_0x95df('0x10')===typeof _0x59c7ff&&!_[_0x95df('0xe')](_0x59c7ff)){return _0x59c7ff;}return _0x95df('0x11');};exports[_0x95df('0x12')]=function(_0x508892){if(_['isNil'](_0x508892)){return![];}return _0x508892;};exports[_0x95df('0x13')]=function(_0x26fdc8,_0x5b2049,_0x5deffb,_0x4c116d,_0x5b7f9d,_0x3c352d){var _0x393dfa={'XMD-QUEUE':_0x5b2049['Queue']?_0x5b2049[_0x95df('0x14')][_0x95df('0x15')]:'','XMD-CALLERID':_0x4c116d,'XMD-CALLERID-PREVIEW':_0x3c352d?util[_0x95df('0x16')](_0x95df('0xf'),_0x3c352d[_0x95df('0x17')],_0x3c352d[_0x95df('0x18')]):_0x4c116d,'XMD-DIALID':_0x5b7f9d,'XMD-CONTACTID':_0x5b2049[_0x95df('0x19')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4c116d,'XMD-VOICEQUEUEID':_0x5b2049[_0x95df('0x1a')],'XMD-DIALCHANNEL':_0x5deffb,'XMD-DIALTIMEOUT':_0x26fdc8['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x95df('0x16')](_0x95df('0x1b'),_0x26fdc8[_0x95df('0x1c')]?'g':'',_[_0x95df('0xe')](_0x26fdc8[_0x95df('0x1d')])?'':_0x95df('0x1e')),'XMD-DIALURL':_0x26fdc8[_0x95df('0x1f')]||'','XMD-AGI':_0x26fdc8[_0x95df('0x20')]?util[_0x95df('0x16')](_0x95df('0x21'),ipAgi,_0x26fdc8[_0x95df('0x20')]):'NONE','XMD-AGIAFTER':_0x26fdc8[_0x95df('0x1c')]?util[_0x95df('0x16')](_0x95df('0x21'),ipAgi,_0x26fdc8[_0x95df('0x1c')]):_0x95df('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x3c352d?_0x3c352d[_0x95df('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x3c352d?_0x3c352d[_0x95df('0x24')]:'','XMD-DESTINATION':_0x95df('0x25')};if(!_[_0x95df('0xe')](_0x26fdc8[_0x95df('0x1d')])){_0x393dfa[util['format']('%s',_0x95df('0x26'))]=_0x26fdc8[_0x95df('0x1d')];_0x393dfa[util['format']('%s',_0x95df('0x27'))]=_0x5b7f9d;}if(_0x5b2049&&_0x5b2049[_0x95df('0x28')]){for(var _0x26bb0f in _0x5b2049[_0x95df('0x28')]){if(_0x5b2049['Contact'][_0x95df('0x29')](_0x26bb0f)){if(!_[_0x95df('0x2a')](_0x5b2049[_0x95df('0x28')][_0x26bb0f])&&_0x26bb0f!=='id'&&_0x26bb0f!==_0x95df('0x2b')&&_0x26bb0f!=='createdAt'&&_0x26bb0f!=='updatedAt'){_0x393dfa[util[_0x95df('0x16')](_0x95df('0x2c'),'XMD-',_[_0x95df('0x2d')](_0x26bb0f))]=_0x5b2049['Contact'][_0x26bb0f];}}}}return _0x393dfa;};exports['toLowerVariables']=function(_0x3f11f5){var _0x30b2a7={};for(var _0x4f3168 in _0x3f11f5){if(_0x3f11f5[_0x95df('0x29')](_0x4f3168)){_0x30b2a7[util[_0x95df('0x16')]('%s',_[_0x95df('0x2e')](_0x4f3168))]=_0x3f11f5[_0x4f3168];}}return{'variables':_0x30b2a7};};exports['updateOriginated']=function(_0x1329ec,_0x4943a6){if(!_[_0x95df('0x2a')](_0x1329ec)){if(_0x1329ec[_0x95df('0x29')](_0x95df('0x2f'))){if(_0x1329ec[_0x95df('0x2f')]>0x0){_0x1329ec[_0x95df('0x2f')]-=0x1;}else{logger[_0x95df('0x7')](_0x95df('0x30'),_0x4943a6);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x4943a6);}};exports[_0x95df('0x31')]=function(_0x4b4825){var _0x9a77f4=moment()[_0x95df('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x4b4825[_0x95df('0x32')]=0xd;_0x4b4825[_0x95df('0x33')]=_0x95df('0x34');_0x4b4825['starttime']=_0x9a77f4;_0x4b4825[_0x95df('0x35')]=_0x9a77f4;_0x4b4825[_0x95df('0x36')]=_0x9a77f4;};exports[_0x95df('0x37')]=function(_0x5a1191,_0xa90852,_0x158456){var _0x5b962c=moment()[_0x95df('0x16')](_0x95df('0x38'));_0x5a1191[_0x95df('0x32')]=_0xa90852;_0x5a1191[_0x95df('0x33')]=_0x158456;_0x5a1191['responsetime']=_0x5b962c;_0x5a1191['ringtime']=getSeconds(_0x5a1191[_0x95df('0x35')],_0x5a1191['starttime']);};exports[_0x95df('0x39')]=function(_0x2c14af,_0x13ef26,_0x27a7a7){_0x2c14af[_0x95df('0x3a')]=_0x13ef26;_0x2c14af[_0x95df('0x3b')]=_0x27a7a7;};exports['logCustomer']=function(_0x2fcfa4,_0x1f68b5,_0x23f100){var _0x5a967c=moment()[_0x95df('0x16')](_0x95df('0x38'));_0x2fcfa4['state']=_0x1f68b5;_0x2fcfa4[_0x95df('0x33')]=_0x23f100;_0x2fcfa4['responsetime']=_0x2fcfa4[_0x95df('0x35')]?_0x2fcfa4[_0x95df('0x35')]:_0x5a967c;_0x2fcfa4[_0x95df('0x36')]=_0x2fcfa4[_0x95df('0x36')]?_0x2fcfa4[_0x95df('0x36')]:_0x5a967c;_0x2fcfa4[_0x95df('0x3c')]=getSeconds(_0x2fcfa4[_0x95df('0x35')]||0x0,_0x2fcfa4[_0x95df('0x3d')]||0x0);_0x2fcfa4[_0x95df('0x3e')]=_0x2fcfa4['answertime']?getSeconds(_0x2fcfa4[_0x95df('0x36')],_0x2fcfa4[_0x95df('0x3f')]):0x0;};exports['isFailure']=function(_0x122217){return _0x122217===_0x95df('0x40');};exports['variablesAction']=function(_0x5e0e48,_0x5c4818,_0x4b4205,_0x42c519,_0x108471){var _0x3f5bb9=_0x42c519?_0x95df('0x41'):_0x5e0e48[_0x95df('0x17')];_0x3f5bb9=_0x108471?_0x95df('0x42'):_0x3f5bb9;return{'actionid':_0x5e0e48[_0x95df('0x43')],'action':_0x95df('0x44'),'channel':_0x5e0e48['channelAgent'],'callerid':util['format'](_0x95df('0xf'),_0x3f5bb9,_0x5e0e48[_0x95df('0x18')]),'Exten':_0x95df('0x25'),'Context':_0x95df('0x45'),'Priority':'1','variable':_0x4b4205,'timeout':(_0x5c4818['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5e0e48[_0x95df('0x43')]};};exports[_0x95df('0x46')]=function(_0xf3ba9){return _0xf3ba9[_0x95df('0x47')]+_0xf3ba9[_0x95df('0x48')]+_0xf3ba9[_0x95df('0x49')]+_0xf3ba9[_0x95df('0x4a')]+_0xf3ba9['countnosuchnumberretry'];};exports['cloneAction']=function(_0x28731b){var _0x3b6eed=_[_0x95df('0x4b')](_0x28731b);_0x3b6eed[_0x95df('0x32')]=0xf;_0x3b6eed[_0x95df('0x33')]='Global';return _0x3b6eed;};exports[_0x95df('0x4c')]=function(_0x567f1a,_0x386a35,_0x571b31){var _0x44a344={};_0x44a344[_0x386a35]=_0x567f1a[_0x386a35];_0x44a344[_0x95df('0x4d')]=![];_0x44a344[_0x95df('0x4e')]=moment()[_0x95df('0x4f')](_0x571b31,'minutes')[_0x95df('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x44a344[_0x95df('0x19')]=_0x567f1a[_0x95df('0x19')];_0x44a344[_0x95df('0x50')]=_0x567f1a[_0x95df('0x50')];_0x44a344[_0x95df('0x1a')]=_0x567f1a[_0x95df('0x1a')]||undefined;return _0x44a344;};exports['decrementTalkink']=function(_0x3e112c,_0x1949a8){if(!_[_0x95df('0x2a')](_0x3e112c)){if(_0x3e112c['pTalking']>0x0){_0x3e112c[_0x95df('0x51')]-=0x1;}else{logger[_0x95df('0x7')](_0x1949a8,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x95df('0x7')](_0x1949a8,_0x95df('0x52'));}};exports[_0x95df('0x53')]=function(_0x44a92d){if(_0x44a92d<=0x0){return!![];}return![];};exports[_0x95df('0x54')]=function(_0x5100dc,_0x106705,_0x29d716){_0x5100dc['lastevent']=_0x106705;_0x5100dc[_0x95df('0x15')]=_0x5100dc[_0x95df('0x55')];_0x5100dc[_0x95df('0x56')]=_0x5100dc[_0x95df('0x57')];if(_0x29d716){_0x5100dc[_0x95df('0x58')]=_0x29d716[_0x95df('0x58')];}return _0x5100dc;};exports[_0x95df('0x59')]=function(_0x142c08){var _0x492098={};_0x492098[_0x95df('0x55')]=_0x142c08['queue'];_0x492098[_0x95df('0x56')]=_0x142c08['channelAgent'];_0x492098[_0x95df('0x43')]=_0x142c08[_0x95df('0x43')];return _0x492098;};exports[_0x95df('0x5a')]=function(_0x50fe35){var _0x23b5a2=[];for(var _0x18f7d0 in _0x50fe35){if(_0x50fe35[_0x95df('0x29')](_0x18f7d0)){if(!_['isNil'](_0x50fe35[_0x18f7d0])&&_0x50fe35[_0x18f7d0][_0x95df('0x32')]===_0x95df('0x5b')&&_0x50fe35[_0x18f7d0]['status']===_0x95df('0x5c')){_0x23b5a2['push'](_0x50fe35[_0x18f7d0]['id']);}}}return _0x23b5a2;};exports[_0x95df('0x5d')]=function(_0x59f233){var _0x5731be=moment()[_0x95df('0x4')](0x0);var _0x512061=moment(_0x59f233)['milliseconds'](0x0);return _0x5731be[_0x95df('0x5')](_0x512061,'seconds');};exports[_0x95df('0x5e')]=function(_0x507bf3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x507bf3['ContactId'],'ListId':_0x507bf3[_0x95df('0x50')],'VoiceQueueId':_0x507bf3[_0x95df('0x1a')]||undefined,'CampaignId':_0x507bf3['CampaignId']||undefined};};exports[_0x95df('0x5f')]=function(_0x4228c0){if(_0x4228c0===_0x95df('0x43')||_0x4228c0===_0x95df('0x60')||_0x4228c0===_0x95df('0x55')||_0x4228c0===_0x95df('0x61')||_0x4228c0==='campaigntype'||_0x4228c0===_0x95df('0x62')||_0x4228c0===_0x95df('0x3a')||_0x4228c0===_0x95df('0x57')||_0x4228c0==='calleridname'||_0x4228c0===_0x95df('0x4d')||_0x4228c0===_0x95df('0x18')||_0x4228c0===_0x95df('0x4e')||_0x4228c0===_0x95df('0x47')||_0x4228c0===_0x95df('0x48')||_0x4228c0===_0x95df('0x49')||_0x4228c0==='countglobal'||_0x4228c0===_0x95df('0x63')||_0x4228c0===_0x95df('0x64')||_0x4228c0===_0x95df('0x65')||_0x4228c0===_0x95df('0x66')||_0x4228c0===_0x95df('0x19')||_0x4228c0===_0x95df('0x50')||_0x4228c0===_0x95df('0x3b')||_0x4228c0===_0x95df('0x1a')||_0x4228c0===_0x95df('0x67')||_0x4228c0===_0x95df('0x68')||_0x4228c0===_0x95df('0x69')||_0x4228c0==='xmd-phone'||_0x4228c0==='xmd-listid'||_0x4228c0===_0x95df('0x6a')||_0x4228c0===_0x95df('0x6b')||_0x4228c0===_0x95df('0x6c')||_0x4228c0===_0x95df('0x6d')||_0x4228c0===_0x95df('0x6e')||_0x4228c0===_0x95df('0x6f')||_0x4228c0==='xmd-cdrtype'||_0x4228c0===_0x95df('0x70')||_0x4228c0===_0x95df('0x71')||_0x4228c0===_0x95df('0x72')||_0x4228c0===_0x95df('0x73')||_0x4228c0==='rtpaudioqosbridged'||_0x4228c0===_0x95df('0x74')||_0x4228c0===_0x95df('0x75')||_0x4228c0===_0x95df('0x76')||_0x4228c0===_0x95df('0x77')||_0x4228c0===_0x95df('0x78')||_0x4228c0===_0x95df('0x79')||_0x4228c0===_0x95df('0x73')||_0x4228c0==='rtpaudioqosbridged'||_0x4228c0===_0x95df('0x74')||_0x4228c0===_0x95df('0x75')||_0x4228c0===_0x95df('0x76')||_0x4228c0==='rtpaudioqoslossbridged'||_0x4228c0===_0x95df('0x78')||_0x4228c0===_0x95df('0x79')||_0x4228c0===_0x95df('0x7a')||_0x4228c0===_0x95df('0x7b')||_0x4228c0===_0x95df('0x32')||_0x4228c0===_0x95df('0x33')){return![];}return!![];};exports[_0x95df('0x7c')]=function(_0x2a408f,_0x447c6f){var _0x2e5021,_0x3993c6,_0x58a4ad;if(_0x447c6f<=0x0){_0x447c6f=0x1;}_0x2e5021=new RegExp(_0x95df('0x7d')+_0x447c6f+'}$');_0x3993c6=Math[_0x95df('0x7e')](0xa,_0x447c6f-0x1);_0x58a4ad=Math[_0x95df('0x7e')](0xa,_0x447c6f)-0x1;return util['format']('%s',_[_0x95df('0x7f')](_0x2a408f,_0x2e5021,_['random'](_0x3993c6,_0x58a4ad)));};exports['extractCalleridName']=function(_0x263002){var _0x301097=_0x263002[_0x95df('0x80')](/"(.*?)"/);return _0x301097?_0x301097[0x1]:_0x263002;};exports['extractCalleridNumber']=function(_0x13afdd){var _0x9c767a=_0x13afdd['match'](/<(.*?)>/);return _0x9c767a?_0x9c767a[0x1]:_0x13afdd;}; \ No newline at end of file +var _0x0807=['[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','mandatoryDisposition','buildAcw','status','push','getDiff','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridNumber','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','name','calleridname','calleridnum','dialer','dialOriginateTimeout','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','responsetime','endtime','ringtime','starttime','logLookAgent','UserId','logCustomer','YYYY-MM-DD\x20HH:mm:ss','talktime','answertime','isFailure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','VoiceQueueId','decrementTalkink','pTalking'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x0807,0x147));var _0x7080=function(_0x49bd5b,_0x3303d3){_0x49bd5b=_0x49bd5b-0x0;var _0x52507b=_0x0807[_0x49bd5b];return _0x52507b;};'use strict';var util=require('util');var _=require(_0x7080('0x0'));var moment=require(_0x7080('0x1'));var logger=require(_0x7080('0x2'))(_0x7080('0x3'));var ipAgi=process['env'][_0x7080('0x4')]||_0x7080('0x5');function getSeconds(_0x384ef6,_0x719eb1){var _0xcca379=moment(_0x384ef6)[_0x7080('0x6')](0x0);var _0x5d62fe=moment(_0x719eb1)['milliseconds'](0x0);return _0xcca379[_0x7080('0x7')](_0x5d62fe,_0x7080('0x8'));}exports[_0x7080('0x9')]=function(_0x2dc21a){return function(_0xf5ec98){logger[_0x7080('0xa')](_0x2dc21a,util['inspect'](_0xf5ec98,{'showHidden':![],'depth':null}));};};exports[_0x7080('0xb')]=function(_0x480c06,_0x28b063){logger[_0x7080('0xc')](_0x480c06,util[_0x7080('0xd')](_0x28b063,{'showHidden':![],'depth':null}));};exports[_0x7080('0xe')]=function(_0xbd8da3,_0x3852a8){logger[_0x7080('0xa')](_0xbd8da3,util['inspect'](_0x3852a8,{'showHidden':![],'depth':null}));};exports[_0x7080('0xf')]=function(_0x59ae56){return function(_0x178a8b){logger['info'](_0x59ae56,util[_0x7080('0xd')](_0x178a8b,{'showHidden':![],'depth':null}));};};exports[_0x7080('0x10')]=function(_0x1433e6,_0x4c2ec2,_0x105115){return{'message':_0x1433e6,'unlock':_0x4c2ec2,'active':_0x105115};};exports[_0x7080('0x11')]=function(_0x1b9383,_0x24448b,_0x473da3){if(!_[_0x7080('0x12')](_0x473da3)&&_0x7080('0x13')===typeof _0x473da3&&!_[_0x7080('0x14')](_0x473da3)){if(!_['isUndefined'](_0x24448b)&&_0x7080('0x13')===typeof _0x24448b&&!_['isEmpty'](_0x24448b)){return util[_0x7080('0x15')](_0x7080('0x16'),_0x24448b,_0x473da3);}return util[_0x7080('0x15')](_0x7080('0x16'),_0x473da3,_0x473da3);}if(!_[_0x7080('0x12')](_0x1b9383)&&'string'===typeof _0x1b9383&&!_[_0x7080('0x14')](_0x1b9383)){return _0x1b9383;}return _0x7080('0x17');};exports[_0x7080('0x18')]=function(_0x550b0f){if(_[_0x7080('0x19')](_0x550b0f)){return![];}return _0x550b0f;};exports[_0x7080('0x1a')]=function(_0xa6d5df,_0x413094,_0x3f6785,_0x25aaa6,_0x2f61f2,_0x4b2ad1){var _0x5f0572={'XMD-QUEUE':_0x413094['Queue']?_0x413094['Queue'][_0x7080('0x1b')]:'','XMD-CALLERID':_0x25aaa6,'XMD-CALLERID-PREVIEW':_0x4b2ad1?util[_0x7080('0x15')]('\x22%s\x22\x20<%s>',_0x4b2ad1[_0x7080('0x1c')],_0x4b2ad1[_0x7080('0x1d')]):_0x25aaa6,'XMD-DIALID':_0x2f61f2,'XMD-CONTACTID':_0x413094['ContactId'],'XMD-CDRTYPE':_0x7080('0x1e'),'CALLERID(all)':_0x25aaa6,'XMD-VOICEQUEUEID':_0x413094['VoiceQueueId'],'XMD-DIALCHANNEL':_0x3f6785,'XMD-DIALTIMEOUT':_0xa6d5df[_0x7080('0x1f')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0xa6d5df['dialQueueProject2']?'g':'',_[_0x7080('0x14')](_0xa6d5df['monitor_format'])?'':_0x7080('0x20')),'XMD-DIALURL':_0xa6d5df[_0x7080('0x21')]||'','XMD-AGI':_0xa6d5df[_0x7080('0x22')]?util['format'](_0x7080('0x23'),ipAgi,_0xa6d5df[_0x7080('0x22')]):_0x7080('0x24'),'XMD-AGIAFTER':_0xa6d5df[_0x7080('0x25')]?util['format'](_0x7080('0x23'),ipAgi,_0xa6d5df[_0x7080('0x25')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x4b2ad1?_0x4b2ad1[_0x7080('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x4b2ad1?_0x4b2ad1[_0x7080('0x27')]:'','XMD-DESTINATION':_0x7080('0x28')};if(!_[_0x7080('0x14')](_0xa6d5df[_0x7080('0x29')])){_0x5f0572[util[_0x7080('0x15')]('%s',_0x7080('0x2a'))]=_0xa6d5df[_0x7080('0x29')];_0x5f0572[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x2f61f2;}if(_0x413094&&_0x413094[_0x7080('0x2b')]){for(var _0x438cc7 in _0x413094['Contact']){if(_0x413094[_0x7080('0x2b')][_0x7080('0x2c')](_0x438cc7)){if(!_['isNil'](_0x413094['Contact'][_0x438cc7])&&_0x438cc7!=='id'&&_0x438cc7!==_0x7080('0x2d')&&_0x438cc7!==_0x7080('0x2e')&&_0x438cc7!=='updatedAt'){_0x5f0572[util['format'](_0x7080('0x2f'),_0x7080('0x30'),_['toUpper'](_0x438cc7))]=_0x413094['Contact'][_0x438cc7];}}}}return _0x5f0572;};exports[_0x7080('0x31')]=function(_0x4775bf){var _0x240bbb={};for(var _0x18afff in _0x4775bf){if(_0x4775bf[_0x7080('0x2c')](_0x18afff)){_0x240bbb[util[_0x7080('0x15')]('%s',_[_0x7080('0x32')](_0x18afff))]=_0x4775bf[_0x18afff];}}return{'variables':_0x240bbb};};exports[_0x7080('0x33')]=function(_0x1572a0,_0x3e797f){if(!_['isNil'](_0x1572a0)){if(_0x1572a0[_0x7080('0x2c')]('originated')){if(_0x1572a0['originated']>0x0){_0x1572a0[_0x7080('0x34')]-=0x1;}else{logger[_0x7080('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x3e797f);}}}else{logger[_0x7080('0xa')](_0x7080('0x35'),_0x3e797f);}};exports[_0x7080('0x36')]=function(_0x14074e){var _0x5aa069=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x14074e[_0x7080('0x37')]=0xd;_0x14074e[_0x7080('0x38')]=_0x7080('0x39');_0x14074e['starttime']=_0x5aa069;_0x14074e[_0x7080('0x3a')]=_0x5aa069;_0x14074e[_0x7080('0x3b')]=_0x5aa069;};exports['logAgent']=function(_0x380dac,_0x222498,_0xe55193){var _0x4e04ad=moment()[_0x7080('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x380dac['state']=_0x222498;_0x380dac[_0x7080('0x38')]=_0xe55193;_0x380dac[_0x7080('0x3a')]=_0x4e04ad;_0x380dac[_0x7080('0x3c')]=getSeconds(_0x380dac[_0x7080('0x3a')],_0x380dac[_0x7080('0x3d')]);};exports[_0x7080('0x3e')]=function(_0x1c3e18,_0x296ba5,_0x37216b){_0x1c3e18['membername']=_0x296ba5;_0x1c3e18[_0x7080('0x3f')]=_0x37216b;};exports[_0x7080('0x40')]=function(_0x5dfe5c,_0x819711,_0x127ce9){var _0x52053a=moment()[_0x7080('0x15')](_0x7080('0x41'));_0x5dfe5c[_0x7080('0x37')]=_0x819711;_0x5dfe5c[_0x7080('0x38')]=_0x127ce9;_0x5dfe5c[_0x7080('0x3a')]=_0x5dfe5c[_0x7080('0x3a')]?_0x5dfe5c[_0x7080('0x3a')]:_0x52053a;_0x5dfe5c[_0x7080('0x3b')]=_0x5dfe5c[_0x7080('0x3b')]?_0x5dfe5c[_0x7080('0x3b')]:_0x52053a;_0x5dfe5c[_0x7080('0x3c')]=getSeconds(_0x5dfe5c['responsetime']||0x0,_0x5dfe5c[_0x7080('0x3d')]||0x0);_0x5dfe5c[_0x7080('0x42')]=_0x5dfe5c[_0x7080('0x43')]?getSeconds(_0x5dfe5c[_0x7080('0x3b')],_0x5dfe5c[_0x7080('0x43')]):0x0;};exports[_0x7080('0x44')]=function(_0x53ead5){return _0x53ead5==='Failure';};exports['variablesAction']=function(_0x5aa677,_0x1785ca,_0x5802ba,_0x31b8bd,_0x50e90a){var _0x2cdabb=_0x31b8bd?_0x7080('0x45'):_0x5aa677[_0x7080('0x1c')];_0x2cdabb=_0x50e90a?_0x7080('0x46'):_0x2cdabb;return{'actionid':_0x5aa677[_0x7080('0x47')],'action':_0x7080('0x48'),'channel':_0x5aa677[_0x7080('0x49')],'callerid':util[_0x7080('0x15')](_0x7080('0x16'),_0x2cdabb,_0x5aa677[_0x7080('0x1d')]),'Exten':_0x7080('0x28'),'Context':_0x7080('0x4a'),'Priority':'1','variable':_0x5802ba,'timeout':(_0x1785ca[_0x7080('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5aa677[_0x7080('0x47')]};};exports[_0x7080('0x4c')]=function(_0xfc4295){return _0xfc4295[_0x7080('0x4d')]+_0xfc4295[_0x7080('0x4e')]+_0xfc4295[_0x7080('0x4f')]+_0xfc4295['countagentrejectretry']+_0xfc4295['countnosuchnumberretry'];};exports[_0x7080('0x50')]=function(_0x1387e2){var _0x3dab74=_[_0x7080('0x51')](_0x1387e2);_0x3dab74[_0x7080('0x37')]=0xf;_0x3dab74[_0x7080('0x38')]=_0x7080('0x52');return _0x3dab74;};exports[_0x7080('0x53')]=function(_0x3d6b5d,_0x495f64,_0x53fd0f){var _0x593ac3={};_0x593ac3[_0x495f64]=_0x3d6b5d[_0x495f64];_0x593ac3[_0x7080('0x54')]=![];_0x593ac3[_0x7080('0x55')]=moment()[_0x7080('0x56')](_0x53fd0f,_0x7080('0x57'))[_0x7080('0x15')](_0x7080('0x41'));_0x593ac3[_0x7080('0x58')]=_0x3d6b5d[_0x7080('0x58')];_0x593ac3[_0x7080('0x59')]=_0x3d6b5d[_0x7080('0x59')];_0x593ac3[_0x7080('0x5a')]=_0x3d6b5d['VoiceQueueId']||undefined;return _0x593ac3;};exports[_0x7080('0x5b')]=function(_0x1f55a4,_0x1fc69b){if(!_[_0x7080('0x19')](_0x1f55a4)){if(_0x1f55a4['pTalking']>0x0){_0x1f55a4[_0x7080('0x5c')]-=0x1;}else{logger[_0x7080('0xa')](_0x1fc69b,_0x7080('0x5d'));}}else{logger[_0x7080('0xa')](_0x1fc69b,_0x7080('0x5e'));}};exports[_0x7080('0x5f')]=function(_0x34f1d4){if(_0x34f1d4<=0x0){return!![];}return![];};exports[_0x7080('0x60')]=function(_0x39100f,_0x1cd5a5,_0x40b824){_0x39100f[_0x7080('0x61')]=_0x1cd5a5;_0x39100f[_0x7080('0x1b')]=_0x39100f[_0x7080('0x62')];_0x39100f[_0x7080('0x63')]=_0x39100f[_0x7080('0x49')];if(_0x40b824){_0x39100f[_0x7080('0x64')]=_0x40b824['mandatoryDisposition'];}return _0x39100f;};exports[_0x7080('0x65')]=function(_0x3fee68){var _0x4a869f={};_0x4a869f[_0x7080('0x62')]=_0x3fee68[_0x7080('0x62')];_0x4a869f['interface']=_0x3fee68[_0x7080('0x49')];_0x4a869f['uniqueid']=_0x3fee68[_0x7080('0x47')];return _0x4a869f;};exports['agentReadyId']=function(_0x290372){var _0x14a185=[];for(var _0x1ed029 in _0x290372){if(_0x290372[_0x7080('0x2c')](_0x1ed029)){if(!_['isNil'](_0x290372[_0x1ed029])&&_0x290372[_0x1ed029]['state']==='not_inuse'&&_0x290372[_0x1ed029][_0x7080('0x66')]==='reachable'){_0x14a185[_0x7080('0x67')](_0x290372[_0x1ed029]['id']);}}}return _0x14a185;};exports[_0x7080('0x68')]=function(_0x386f2c){var _0x138f7d=moment()[_0x7080('0x6')](0x0);var _0x102c45=moment(_0x386f2c)['milliseconds'](0x0);return _0x138f7d[_0x7080('0x7')](_0x102c45,_0x7080('0x8'));};exports['createBody']=function(_0x16629a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x16629a[_0x7080('0x58')],'ListId':_0x16629a['ListId'],'VoiceQueueId':_0x16629a[_0x7080('0x5a')]||undefined,'CampaignId':_0x16629a[_0x7080('0x69')]||undefined};};exports[_0x7080('0x6a')]=function(_0x459da9){if(_0x459da9===_0x7080('0x47')||_0x459da9===_0x7080('0x6b')||_0x459da9===_0x7080('0x62')||_0x459da9===_0x7080('0x6c')||_0x459da9===_0x7080('0x6d')||_0x459da9===_0x7080('0x6e')||_0x459da9==='membername'||_0x459da9===_0x7080('0x49')||_0x459da9===_0x7080('0x1c')||_0x459da9==='active'||_0x459da9===_0x7080('0x1d')||_0x459da9==='scheduledat'||_0x459da9==='countbusyretry'||_0x459da9===_0x7080('0x4e')||_0x459da9==='countnoanswerretry'||_0x459da9===_0x7080('0x6f')||_0x459da9===_0x7080('0x70')||_0x459da9==='callbackuniqueid'||_0x459da9===_0x7080('0x71')||_0x459da9===_0x7080('0x72')||_0x459da9==='ContactId'||_0x459da9===_0x7080('0x59')||_0x459da9===_0x7080('0x3f')||_0x459da9===_0x7080('0x5a')||_0x459da9===_0x7080('0x73')||_0x459da9===_0x7080('0x74')||_0x459da9===_0x7080('0x75')||_0x459da9==='xmd-phone'||_0x459da9==='xmd-listid'||_0x459da9==='xmd-dialurl'||_0x459da9===_0x7080('0x76')||_0x459da9===_0x7080('0x77')||_0x459da9==='xmd-dialid'||_0x459da9===_0x7080('0x78')||_0x459da9===_0x7080('0x79')||_0x459da9===_0x7080('0x7a')||_0x459da9===_0x7080('0x7b')||_0x459da9===_0x7080('0x7c')||_0x459da9===_0x7080('0x7d')||_0x459da9===_0x7080('0x7e')||_0x459da9===_0x7080('0x7f')||_0x459da9===_0x7080('0x80')||_0x459da9===_0x7080('0x81')||_0x459da9===_0x7080('0x82')||_0x459da9===_0x7080('0x83')||_0x459da9===_0x7080('0x84')||_0x459da9===_0x7080('0x85')||_0x459da9==='rtpaudioqos'||_0x459da9===_0x7080('0x7f')||_0x459da9==='rtpaudioqosjitter'||_0x459da9===_0x7080('0x81')||_0x459da9===_0x7080('0x82')||_0x459da9===_0x7080('0x83')||_0x459da9===_0x7080('0x84')||_0x459da9==='rtpaudioqosrttbridged'||_0x459da9==='bridgepeer'||_0x459da9===_0x7080('0x86')||_0x459da9===_0x7080('0x37')||_0x459da9===_0x7080('0x38')){return![];}return!![];};exports[_0x7080('0x87')]=function(_0x57ef79,_0x3b2b96){var _0x52b4fb,_0xc4e7a2,_0x596341;if(_0x3b2b96<=0x0){_0x3b2b96=0x1;}_0x52b4fb=new RegExp('\x5cw{0,'+_0x3b2b96+'}$');_0xc4e7a2=Math['pow'](0xa,_0x3b2b96-0x1);_0x596341=Math[_0x7080('0x88')](0xa,_0x3b2b96)-0x1;return util[_0x7080('0x15')]('%s',_[_0x7080('0x89')](_0x57ef79,_0x52b4fb,_[_0x7080('0x8a')](_0xc4e7a2,_0x596341)));};exports['extractCalleridName']=function(_0x3b6778){var _0x2710aa=_0x3b6778['match'](/"(.*?)"/);return _0x2710aa?_0x2710aa[0x1]:_0x3b6778;};exports[_0x7080('0x8b')]=function(_0x1a0f4a){var _0x9415dc=_0x1a0f4a['match'](/<(.*?)>/);return _0x9415dc?_0x9415dc[0x1]:_0x1a0f4a;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 751648b..75a8896 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 _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x29e76f,_0x2568e4){var _0x2c2c4e=function(_0x119c9e){while(--_0x119c9e){_0x29e76f['push'](_0x29e76f['shift']());}};_0x2c2c4e(++_0x2568e4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x284958,_0x4e5c9e){_0x284958=_0x284958-0x0;var _0x2f7fcb=_0x5f2f[_0x284958];return _0x2f7fcb;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x22e7ee,_0xd43e98){var _0xbf4677=function(_0x52d1ab){while(--_0x52d1ab){_0x22e7ee['push'](_0x22e7ee['shift']());}};_0xbf4677(++_0xd43e98);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4d4326,_0x12cbaa){_0x4d4326=_0x4d4326-0x0;var _0x47266e=_0x5f2f[_0x4d4326];return _0x47266e;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 6a46233..d8ce13b 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 _0x98a8=['isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','sumDuration','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','mergeFromDatabase','prototype','initAgents','length','initTelephones','initTrunks','isUndefined','initVoiceQueues','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initZohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','campaigns','outbound','channels','queueChannels','outboundChannels','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','SIP/%s','name','hasOwnProperty','isNil','interface','format','total','sumHoldTime'];(function(_0x2dd569,_0x4205c4){var _0x9fd232=function(_0x3b6b5c){while(--_0x3b6b5c){_0x2dd569['push'](_0x2dd569['shift']());}};_0x9fd232(++_0x4205c4);}(_0x98a8,0x12c));var _0x898a=function(_0x43291f,_0x4f3fd1){_0x43291f=_0x43291f-0x0;var _0x1be0a3=_0x98a8[_0x43291f];return _0x1be0a3;};'use strict';var BPromise=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var _=require(_0x898a('0x2'));var moment=require(_0x898a('0x3'));var Agent=require(_0x898a('0x4'));var Telephone=require(_0x898a('0x5'));var Trunk=require(_0x898a('0x6'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x898a('0x7'));var Template=require(_0x898a('0x8'));var Campaign=require(_0x898a('0x9'));var VoiceExtension=require(_0x898a('0xa'));var ZendeskAccount=require(_0x898a('0xb'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x898a('0xc'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x898a('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x898a('0xe'));var ServicenowAccount=require(_0x898a('0xf'));var Dynamics365Account=require(_0x898a('0x10'));var FreshsalesAccount=require(_0x898a('0x11'));var FaxAccount=require(_0x898a('0x12'));var Realtime=function(){this[_0x898a('0x13')]={};this[_0x898a('0x14')]={};this[_0x898a('0x15')]={};this[_0x898a('0x16')]={};this['triggers']={};this[_0x898a('0x17')]={};this['templates']={};this[_0x898a('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x898a('0x19')]={};this[_0x898a('0x1a')]={};this[_0x898a('0x1b')]={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this[_0x898a('0x1c')]={};this[_0x898a('0x1d')]={};this[_0x898a('0x1e')]={};this[_0x898a('0x1f')]={};this[_0x898a('0x20')]={};this[_0x898a('0x21')]={};this['servicenowAccounts']={};this[_0x898a('0x22')]={};this['freshsalesAccounts']={};this[_0x898a('0x23')]={};};function freeIsNotKey(_0x5c96a6,_0x303321,_0x4fb05b){var _0x18d167=_['mapKeys'](_0x5c96a6,function(_0xee4408,_0x3197f7){return _0xee4408[_0x4fb05b];});for(var _0x28cc63 in _0x303321){if(_0x303321['hasOwnProperty'](_0x28cc63)){if(!_0x18d167[_0x28cc63]){delete _0x303321[_0x28cc63];}}}}function freeIsNotKeySip(_0x1faf4c,_0x5960e0){var _0x54c8f3=_[_0x898a('0x24')](_0x1faf4c,function(_0x1455ab,_0x58c3ab){return util['format'](_0x898a('0x25'),_0x1455ab[_0x898a('0x26')]);});for(var _0x38a8f0 in _0x5960e0){if(_0x5960e0[_0x898a('0x27')](_0x38a8f0)){if(!_0x54c8f3[_0x38a8f0]){delete _0x5960e0[_0x38a8f0];}}}}function freeIsNotKeyAgent(_0x2da52d,_0x3570e8){var _0x259541=_['mapKeys'](_0x2da52d,function(_0x247cfc,_0x50718e){var _0x11cae2=_[_0x898a('0x28')](_0x247cfc[_0x898a('0x29')])?util[_0x898a('0x2a')]('SIP/%s',_0x247cfc[_0x898a('0x26')]):_0x247cfc[_0x898a('0x29')];return _0x11cae2;});for(var _0x85d383 in _0x3570e8){if(_0x3570e8[_0x898a('0x27')](_0x85d383)){if(!_0x259541[_0x85d383]){delete _0x3570e8[_0x85d383];}}}}function clearVoiceCallReports(_0x3901ab){_0x3901ab[_0x898a('0x2b')]=0x0;_0x3901ab['answered']=0x0;_0x3901ab[_0x898a('0x2c')]=0x0;_0x3901ab['sumDuration']=0x0;_0x3901ab['sumBillable']=0x0;}function clearCampaigns(_0x53ddb2){if(!_[_0x898a('0x2d')](_0x53ddb2)){for(var _0x1f4d86 in _0x53ddb2){if(_0x53ddb2[_0x898a('0x27')](_0x1f4d86)){_0x53ddb2[_0x1f4d86][_0x898a('0x2e')]=0x0;_0x53ddb2[_0x1f4d86][_0x898a('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x2efde2){if(!_[_0x898a('0x2d')](_0x2efde2)){for(var _0xac1fc4 in _0x2efde2){if(_0x2efde2[_0x898a('0x27')](_0xac1fc4)){_0x2efde2[_0xac1fc4]['total']=0x0;_0x2efde2[_0xac1fc4]['answered']=0x0;_0x2efde2[_0xac1fc4]['unmanaged']=0x0;_0x2efde2[_0xac1fc4][_0x898a('0x30')]=0x0;_0x2efde2[_0xac1fc4][_0x898a('0x2c')]=0x0;_0x2efde2[_0xac1fc4][_0x898a('0x31')]=0x0;_0x2efde2[_0xac1fc4][_0x898a('0x32')]=0x0;_0x2efde2[_0xac1fc4][_0x898a('0x33')]=0x0;_0x2efde2[_0xac1fc4][_0x898a('0x34')]=0x0;_0x2efde2[_0xac1fc4][_0x898a('0x35')]=0x0;_0x2efde2[_0xac1fc4][_0x898a('0x36')]=0x0;_0x2efde2[_0xac1fc4][_0x898a('0x37')]=0x0;_0x2efde2[_0xac1fc4][_0x898a('0x38')]=0x0;_0x2efde2[_0xac1fc4][_0x898a('0x39')]=0x0;_0x2efde2[_0xac1fc4][_0x898a('0x3a')]=0x0;_0x2efde2[_0xac1fc4]['outboundBlacklistCallsDay']=0x0;_0x2efde2[_0xac1fc4][_0x898a('0x3b')]=0x0;_0x2efde2[_0xac1fc4][_0x898a('0x3c')]=0x0;_0x2efde2[_0xac1fc4][_0x898a('0x3d')]=0x0;_0x2efde2[_0xac1fc4][_0x898a('0x33')]=0x0;_0x2efde2[_0xac1fc4][_0x898a('0x3e')]=0x0;_0x2efde2[_0xac1fc4]['queueStatusComplete']=!![];}}}}Realtime['prototype'][_0x898a('0x3f')]=function(_0x1e2fd4,_0x1d6d66){for(var _0x4de9bf in _0x1d6d66){if(_0x1e2fd4[_0x898a('0x27')](_0x4de9bf)){_0x1e2fd4[_0x4de9bf]=_0x1d6d66[_0x4de9bf];}}};Realtime[_0x898a('0x40')][_0x898a('0x41')]=function(){var _0x2d3b3a=this;return function(_0x41cd46){if(_0x41cd46){freeIsNotKeyAgent(_0x41cd46,_0x2d3b3a[_0x898a('0x13')]);for(var _0x45d854=0x0,_0x146f32={},_0x50bb4b={};_0x45d854<_0x41cd46[_0x898a('0x42')];_0x45d854+=0x1){_0x146f32=_0x41cd46[_0x45d854];var _0x5baf5b=_['isNil'](_0x146f32[_0x898a('0x29')])?util['format'](_0x898a('0x25'),_0x146f32['name']):_0x146f32[_0x898a('0x29')];if(_['isUndefined'](_0x2d3b3a[_0x898a('0x13')][_0x5baf5b])){_0x2d3b3a[_0x898a('0x13')][_0x5baf5b]=new Agent(_0x146f32);}else{_0x2d3b3a[_0x898a('0x3f')](_0x2d3b3a['agents'][_0x5baf5b],_0x146f32);}}}return _0x2d3b3a['agents'];};};Realtime['prototype'][_0x898a('0x43')]=function(){var _0x429c32=this;return function(_0x5a228f){if(_0x5a228f){freeIsNotKeySip(_0x5a228f,_0x429c32[_0x898a('0x14')]);for(var _0x3d3463=0x0,_0xe84f7e={},_0x3e72e8={};_0x3d3463<_0x5a228f['length'];_0x3d3463+=0x1){_0xe84f7e=_0x5a228f[_0x3d3463];if(_['isUndefined'](_0x429c32[_0x898a('0x14')][util[_0x898a('0x2a')]('SIP/%s',_0xe84f7e['name'])])){_0x429c32[_0x898a('0x14')][util[_0x898a('0x2a')](_0x898a('0x25'),_0xe84f7e[_0x898a('0x26')])]=new Telephone(_0xe84f7e);}else{_0x429c32['mergeFromDatabase'](_0x429c32[_0x898a('0x14')][util[_0x898a('0x2a')]('SIP/%s',_0xe84f7e['name'])],_0xe84f7e);}}}return _0x429c32['telephones'];};};Realtime[_0x898a('0x40')][_0x898a('0x44')]=function(){var _0x35d767=this;return function(_0x22f464){if(_0x22f464){freeIsNotKeySip(_0x22f464,_0x35d767[_0x898a('0x15')]);for(var _0x42ca36=0x0,_0x10daf6={},_0x1432ec={};_0x42ca36<_0x22f464[_0x898a('0x42')];_0x42ca36+=0x1){_0x10daf6=_0x22f464[_0x42ca36];if(_[_0x898a('0x45')](_0x35d767[_0x898a('0x15')][util[_0x898a('0x2a')](_0x898a('0x25'),_0x10daf6[_0x898a('0x26')])])){_0x35d767[_0x898a('0x15')][util['format'](_0x898a('0x25'),_0x10daf6[_0x898a('0x26')])]=new Trunk(_0x10daf6);}else{_0x35d767[_0x898a('0x3f')](_0x35d767['trunks'][util[_0x898a('0x2a')](_0x898a('0x25'),_0x10daf6[_0x898a('0x26')])],_0x10daf6);}}}return _0x35d767[_0x898a('0x15')];};};Realtime[_0x898a('0x40')][_0x898a('0x46')]=function(){var _0x2d1323=this;return function(_0x46ac04){if(_0x46ac04){freeIsNotKey(_0x46ac04,_0x2d1323['voiceQueues'],_0x898a('0x26'));for(var _0x1a874a=0x0,_0x3d4aa3={},_0x21a990={};_0x1a874a<_0x46ac04['length'];_0x1a874a+=0x1){_0x3d4aa3=_0x46ac04[_0x1a874a];if(_[_0x898a('0x45')](_0x2d1323[_0x898a('0x16')][_0x3d4aa3['name']])){_0x2d1323[_0x898a('0x16')][_0x3d4aa3['name']]=new VoiceQueue(_0x3d4aa3);}else{_0x2d1323[_0x898a('0x3f')](_0x2d1323['voiceQueues'][_0x3d4aa3['name']],_0x3d4aa3);}}}return _0x2d1323[_0x898a('0x16')];};};Realtime['prototype'][_0x898a('0x47')]=function(){var _0x1edb26=this;return function(_0x4d6ac0){if(_0x4d6ac0){freeIsNotKey(_0x4d6ac0,_0x1edb26[_0x898a('0x48')],'id');for(var _0x304bd8=0x0,_0x5061ba={},_0x2cf8a6={};_0x304bd8<_0x4d6ac0[_0x898a('0x42')];_0x304bd8+=0x1){_0x5061ba=_0x4d6ac0[_0x304bd8];if(_[_0x898a('0x45')](_0x1edb26[_0x898a('0x48')][_0x5061ba['id']])){_0x1edb26['triggers'][_0x5061ba['id']]=new Trigger(_0x5061ba);}else{_0x1edb26[_0x898a('0x3f')](_0x1edb26[_0x898a('0x48')][_0x5061ba['id']],_0x5061ba);}}}return _0x1edb26['triggers'];};};Realtime[_0x898a('0x40')][_0x898a('0x49')]=function(){var _0x4ab441=this;return function(_0x28525b){if(_0x28525b){freeIsNotKey(_0x28525b,_0x4ab441['templates'],'id');for(var _0x30d24e=0x0,_0x41f291={},_0x32ccb9={};_0x30d24e<_0x28525b['length'];_0x30d24e+=0x1){_0x41f291=_0x28525b[_0x30d24e];if(_[_0x898a('0x45')](_0x4ab441[_0x898a('0x4a')][_0x41f291['id']])){_0x4ab441[_0x898a('0x4a')][_0x41f291['id']]=new Template(_0x41f291);}else{_0x4ab441[_0x898a('0x3f')](_0x4ab441['templates'][_0x41f291['id']],_0x41f291);}}}return _0x4ab441[_0x898a('0x4a')];};};Realtime['prototype'][_0x898a('0x4b')]=function(){var _0x2feb38=this;return function(_0x3159d0){if(_0x3159d0){freeIsNotKey(_0x3159d0,_0x2feb38['zendeskAccounts'],'id');for(var _0x2e90c1=0x0,_0x3c4db0={},_0x195ac2={};_0x2e90c1<_0x3159d0['length'];_0x2e90c1+=0x1){_0x3c4db0=_0x3159d0[_0x2e90c1];if(_['isUndefined'](_0x2feb38[_0x898a('0x4c')][_0x3c4db0['id']])){_0x2feb38[_0x898a('0x4c')][_0x3c4db0['id']]=new ZendeskAccount(_0x3c4db0);}else{_0x2feb38[_0x898a('0x3f')](_0x2feb38[_0x898a('0x4c')][_0x3c4db0['id']],_0x3c4db0);}}}return _0x2feb38[_0x898a('0x4c')];};};Realtime[_0x898a('0x40')][_0x898a('0x4d')]=function(){var _0x6c0f07=this;return function(_0x289167){if(_0x289167){freeIsNotKey(_0x289167,_0x6c0f07[_0x898a('0x1c')],'id');for(var _0x2382a9=0x0,_0x5e9329={},_0x345e19={};_0x2382a9<_0x289167[_0x898a('0x42')];_0x2382a9+=0x1){_0x5e9329=_0x289167[_0x2382a9];if(_['isUndefined'](_0x6c0f07[_0x898a('0x1c')][_0x5e9329['id']])){_0x6c0f07['salesforceAccounts'][_0x5e9329['id']]=new SalesforceAccount(_0x5e9329);}else{_0x6c0f07['mergeFromDatabase'](_0x6c0f07[_0x898a('0x1c')][_0x5e9329['id']],_0x5e9329);}}}return _0x6c0f07[_0x898a('0x1c')];};};Realtime[_0x898a('0x40')]['initFreshdeskAccounts']=function(){var _0x556fd8=this;return function(_0x11a07a){if(_0x11a07a){freeIsNotKey(_0x11a07a,_0x556fd8[_0x898a('0x1e')],'id');for(var _0x515725=0x0,_0xaa96f7={},_0x233683={};_0x515725<_0x11a07a['length'];_0x515725+=0x1){_0xaa96f7=_0x11a07a[_0x515725];if(_[_0x898a('0x45')](_0x556fd8[_0x898a('0x1e')][_0xaa96f7['id']])){_0x556fd8[_0x898a('0x1e')][_0xaa96f7['id']]=new FreshdeskAccount(_0xaa96f7);}else{_0x556fd8['mergeFromDatabase'](_0x556fd8[_0x898a('0x1e')][_0xaa96f7['id']],_0xaa96f7);}}}return _0x556fd8[_0x898a('0x1e')];};};Realtime[_0x898a('0x40')][_0x898a('0x4e')]=function(){var _0xd37f94=this;return function(_0x759101){if(_0x759101){freeIsNotKey(_0x759101,_0xd37f94['zohoAccounts'],'id');for(var _0x22a08a=0x0,_0x4df5f0={},_0x253f51={};_0x22a08a<_0x759101[_0x898a('0x42')];_0x22a08a+=0x1){_0x4df5f0=_0x759101[_0x22a08a];if(_[_0x898a('0x45')](_0xd37f94[_0x898a('0x1f')][_0x4df5f0['id']])){_0xd37f94[_0x898a('0x1f')][_0x4df5f0['id']]=new ZohoAccount(_0x4df5f0);}else{_0xd37f94[_0x898a('0x3f')](_0xd37f94[_0x898a('0x1f')][_0x4df5f0['id']],_0x4df5f0);}}}return _0xd37f94[_0x898a('0x1f')];};};Realtime[_0x898a('0x40')]['initDeskAccounts']=function(){var _0xd558e1=this;return function(_0x455ceb){if(_0x455ceb){freeIsNotKey(_0x455ceb,_0xd558e1[_0x898a('0x20')],'id');for(var _0x1f7a0a=0x0,_0x219976={},_0x2a1345={};_0x1f7a0a<_0x455ceb[_0x898a('0x42')];_0x1f7a0a+=0x1){_0x219976=_0x455ceb[_0x1f7a0a];if(_[_0x898a('0x45')](_0xd558e1[_0x898a('0x20')][_0x219976['id']])){_0xd558e1[_0x898a('0x20')][_0x219976['id']]=new DeskAccount(_0x219976);}else{_0xd558e1[_0x898a('0x3f')](_0xd558e1[_0x898a('0x20')][_0x219976['id']],_0x219976);}}}return _0xd558e1[_0x898a('0x20')];};};Realtime[_0x898a('0x40')][_0x898a('0x4f')]=function(){var _0x5f42ae=this;return function(_0x19b6bf){if(_0x19b6bf){freeIsNotKey(_0x19b6bf,_0x5f42ae[_0x898a('0x1d')],'id');for(var _0x47e787=0x0,_0x14ea2d={},_0x4583a1={};_0x47e787<_0x19b6bf['length'];_0x47e787+=0x1){_0x14ea2d=_0x19b6bf[_0x47e787];if(_[_0x898a('0x45')](_0x5f42ae[_0x898a('0x1d')][_0x14ea2d['id']])){_0x5f42ae[_0x898a('0x1d')][_0x14ea2d['id']]=new SugarcrmAccount(_0x14ea2d);}else{_0x5f42ae[_0x898a('0x3f')](_0x5f42ae['sugarcrmAccounts'][_0x14ea2d['id']],_0x14ea2d);}}}return _0x5f42ae[_0x898a('0x1d')];};};Realtime[_0x898a('0x40')][_0x898a('0x50')]=function(){var _0xf86633=this;return function(_0x5b4e60){if(_0x5b4e60){freeIsNotKey(_0x5b4e60,_0xf86633[_0x898a('0x21')],'id');for(var _0x305bb8=0x0,_0x5d4572={},_0x21fdb2={};_0x305bb8<_0x5b4e60[_0x898a('0x42')];_0x305bb8+=0x1){_0x5d4572=_0x5b4e60[_0x305bb8];if(_['isUndefined'](_0xf86633[_0x898a('0x21')][_0x5d4572['id']])){_0xf86633['vtigerAccounts'][_0x5d4572['id']]=new VtigerAccount(_0x5d4572);}else{_0xf86633[_0x898a('0x3f')](_0xf86633['vtigerAccounts'][_0x5d4572['id']],_0x5d4572);}}}return _0xf86633['vtigerAccounts'];};};Realtime['prototype'][_0x898a('0x51')]=function(){var _0x473f5c=this;return function(_0x3909c5){if(_0x3909c5){freeIsNotKey(_0x3909c5,_0x473f5c[_0x898a('0x52')],'id');for(var _0x5e0535=0x0,_0x5f2382={},_0x24bf49={};_0x5e0535<_0x3909c5[_0x898a('0x42')];_0x5e0535+=0x1){_0x5f2382=_0x3909c5[_0x5e0535];if(_[_0x898a('0x45')](_0x473f5c[_0x898a('0x52')][_0x5f2382['id']])){_0x473f5c[_0x898a('0x52')][_0x5f2382['id']]=new ServicenowAccount(_0x5f2382);}else{_0x473f5c[_0x898a('0x3f')](_0x473f5c[_0x898a('0x52')][_0x5f2382['id']],_0x5f2382);}}}return _0x473f5c[_0x898a('0x52')];};};Realtime['prototype'][_0x898a('0x53')]=function(){var _0x43bf93=this;return function(_0x57071a){if(_0x57071a){freeIsNotKey(_0x57071a,_0x43bf93[_0x898a('0x22')],'id');for(var _0x316160=0x0,_0x253c15={},_0x2e514f={};_0x316160<_0x57071a[_0x898a('0x42')];_0x316160+=0x1){_0x253c15=_0x57071a[_0x316160];if(_[_0x898a('0x45')](_0x43bf93[_0x898a('0x22')][_0x253c15['id']])){_0x43bf93[_0x898a('0x22')][_0x253c15['id']]=new Dynamics365Account(_0x253c15);}else{_0x43bf93[_0x898a('0x3f')](_0x43bf93[_0x898a('0x22')][_0x253c15['id']],_0x253c15);}}}return _0x43bf93[_0x898a('0x22')];};};Realtime[_0x898a('0x40')][_0x898a('0x54')]=function(){var _0x4a7705=this;return function(_0x2d9a9c){if(_0x2d9a9c){freeIsNotKey(_0x2d9a9c,_0x4a7705['freshsalesAccounts'],'id');for(var _0x2be3a8=0x0,_0x2e1af8={},_0x2630a1={};_0x2be3a8<_0x2d9a9c['length'];_0x2be3a8+=0x1){_0x2e1af8=_0x2d9a9c[_0x2be3a8];if(_[_0x898a('0x45')](_0x4a7705[_0x898a('0x55')][_0x2e1af8['id']])){_0x4a7705[_0x898a('0x55')][_0x2e1af8['id']]=new FreshsalesAccount(_0x2e1af8);}else{_0x4a7705[_0x898a('0x3f')](_0x4a7705[_0x898a('0x55')][_0x2e1af8['id']],_0x2e1af8);}}}return _0x4a7705['freshsalesAccounts'];};};Realtime[_0x898a('0x40')][_0x898a('0x56')]=function(){var _0x37b1d0=this;return function(_0x3f3aa0){for(var _0xc1c3fe=0x0;_0xc1c3fe<_0x3f3aa0['length'];_0xc1c3fe+=0x1){_[_0x898a('0x57')](_0x37b1d0[_0x898a('0x16')][_0x3f3aa0[_0xc1c3fe][_0x898a('0x26')]],_0x3f3aa0[_0xc1c3fe]);}return _0x37b1d0[_0x898a('0x16')];};};Realtime[_0x898a('0x40')][_0x898a('0x58')]=function(){var _0x1fd617=this;return function(_0x1b0c09){clearVoiceQueues(_0x1fd617['voiceQueues']);if(_0x1b0c09){_0x1b0c09=_[_0x898a('0x59')](_0x1b0c09,_0x898a('0x5a'));for(var _0x558f13 in _0x1b0c09){if(_0x1b0c09[_0x898a('0x27')](_0x558f13)){var _0x5b3003={};for(var _0xb1c576=0x0;_0xb1c576<_0x1b0c09[_0x558f13]['length'];_0xb1c576+=0x1){var _0x2471d8=_0x1b0c09[_0x558f13][_0xb1c576][_0x898a('0x5b')];if(_0x1fd617[_0x898a('0x16')][_0x2471d8]){if(_0x1b0c09[_0x558f13][_0xb1c576][_0x898a('0x5c')]){_0x1fd617[_0x898a('0x16')][_0x2471d8][_0x898a('0x5d')]+=0x1;}if(_0x1b0c09[_0x558f13][_0xb1c576][_0x898a('0x5e')]){_0x1fd617[_0x898a('0x16')][_0x2471d8][_0x898a('0x30')]+=0x1;}_0x1fd617['voiceQueues'][_0x2471d8][_0x898a('0x2c')]+=moment(_0x1b0c09[_0x558f13][_0xb1c576][_0x898a('0x5f')])[_0x898a('0x60')](moment(_0x1b0c09[_0x558f13][_0xb1c576][_0x898a('0x61')]),_0x898a('0x62'))||0x0;if(_0xb1c576===_0x1b0c09[_0x558f13][_0x898a('0x42')]-0x1){_0x1fd617[_0x898a('0x16')][_0x2471d8][_0x898a('0x31')]+=moment(_0x1b0c09[_0x558f13][_0xb1c576][_0x898a('0x63')]||_0x1b0c09[_0x558f13][_0xb1c576][_0x898a('0x64')]||_0x1b0c09[_0x558f13][_0xb1c576]['queuecallerexitAt'])['diff'](moment(_0x1b0c09[_0x558f13][_0xb1c576][_0x898a('0x61')]),_0x898a('0x62'))||0x0;_0x1fd617['voiceQueues'][_0x2471d8]['total']+=0x1;if(_0x1b0c09[_0x558f13][_0xb1c576][_0x898a('0x65')]){_0x1fd617['voiceQueues'][_0x2471d8][_0x898a('0x66')]+=0x1;_0x1fd617[_0x898a('0x16')][_0x2471d8]['sumBillable']+=moment(_0x1b0c09[_0x558f13][_0xb1c576][_0x898a('0x63')])[_0x898a('0x60')](moment(_0x1b0c09[_0x558f13][_0xb1c576][_0x898a('0x5f')]),_0x898a('0x62'))||0x0;}}else{_0x1fd617[_0x898a('0x16')][_0x2471d8][_0x898a('0x31')]+=_0x1fd617[_0x898a('0x16')][_0x2471d8]['sumHoldTime']||0x0;}}}}}}return _0x1fd617[_0x898a('0x16')];};};Realtime[_0x898a('0x40')][_0x898a('0x67')]=function(){var _0x50d978=this;return function(_0x27560f){clearVoiceCallReports(_0x50d978[_0x898a('0x18')]);if(_0x27560f){for(var _0x5c6247=0x0;_0x5c6247<_0x27560f[_0x898a('0x42')];_0x5c6247+=0x1){_0x50d978['outbound']['total']+=0x1;_0x50d978['outbound'][_0x898a('0x31')]+=_0x27560f[_0x5c6247][_0x898a('0x68')];if(_0x27560f[_0x5c6247][_0x898a('0x69')]===_0x898a('0x6a')){_0x50d978[_0x898a('0x18')][_0x898a('0x66')]+=0x1;_0x50d978[_0x898a('0x18')]['sumHoldTime']+=_0x27560f[_0x5c6247][_0x898a('0x68')]-_0x27560f[_0x5c6247]['billableseconds']||0x0;_0x50d978[_0x898a('0x18')][_0x898a('0x32')]+=_0x27560f[_0x5c6247]['billableseconds'];}}}return _0x50d978[_0x898a('0x18')];};};Realtime[_0x898a('0x40')][_0x898a('0x6b')]=function(){var _0x278c0e=this;return function(_0x231845){if(_0x231845){freeIsNotKey(_0x231845,_0x278c0e['campaigns'],'name');for(var _0x5838f9=0x0,_0x3b8fb5={};_0x5838f9<_0x231845[_0x898a('0x42')];_0x5838f9+=0x1){_0x3b8fb5=_0x231845[_0x5838f9];if(_[_0x898a('0x45')](_0x278c0e['campaigns'][_0x3b8fb5[_0x898a('0x26')]])){_0x278c0e['campaigns'][_0x3b8fb5['name']]=new Campaign(_0x3b8fb5);}else{_0x278c0e[_0x898a('0x3f')](_0x278c0e[_0x898a('0x17')][_0x3b8fb5[_0x898a('0x26')]],_0x3b8fb5);_0x278c0e[_0x898a('0x17')][_0x3b8fb5[_0x898a('0x26')]][_0x898a('0x6c')]=_0x3b8fb5[_0x898a('0x6d')]?_0x3b8fb5[_0x898a('0x6d')][_0x898a('0x26')]:undefined;}}}return _0x278c0e[_0x898a('0x17')];};};Realtime[_0x898a('0x40')][_0x898a('0x6e')]=function(){var _0x1420ce=this;return function(_0x26ffcc){if(_0x26ffcc){freeIsNotKey(_0x26ffcc,_0x1420ce[_0x898a('0x6f')],'id');for(var _0x3d9634=0x0,_0x54c440={};_0x3d9634<_0x26ffcc[_0x898a('0x42')];_0x3d9634+=0x1){_0x54c440=_0x26ffcc[_0x3d9634];if(_[_0x898a('0x45')](_0x1420ce[_0x898a('0x6f')][_0x54c440['id']])){_0x1420ce[_0x898a('0x6f')][_0x54c440['id']]=new VoiceExtension(_0x54c440);}else{_0x1420ce[_0x898a('0x3f')](_0x1420ce[_0x898a('0x6f')][_0x54c440['id']],_0x54c440);}}}return _0x1420ce[_0x898a('0x6f')];};};Realtime[_0x898a('0x40')][_0x898a('0x70')]=function(){var _0x427eff=this;return function(_0x3ba9dc){clearCampaigns(_0x427eff[_0x898a('0x17')]);for(var _0x5dd09e=0x0;_0x5dd09e<_0x3ba9dc[_0x898a('0x42')];_0x5dd09e+=0x1){_['merge'](_0x427eff[_0x898a('0x17')][_0x3ba9dc[_0x5dd09e][_0x898a('0x26')]],_0x3ba9dc[_0x5dd09e]);}return _0x427eff[_0x898a('0x17')];};};Realtime['prototype'][_0x898a('0x71')]=function(){var _0x223775=this;return function(_0x4a9cf8){if(_0x4a9cf8){freeIsNotKey(_0x4a9cf8,_0x223775[_0x898a('0x23')],'id');for(var _0x3ebb81=0x0,_0x16c7bc={},_0x3aa0ba={};_0x3ebb81<_0x4a9cf8[_0x898a('0x42')];_0x3ebb81+=0x1){_0x16c7bc=_0x4a9cf8[_0x3ebb81];if(_[_0x898a('0x45')](_0x223775['faxAccounts'][_0x16c7bc['id']])){_0x223775['faxAccounts'][_0x16c7bc['id']]=new FaxAccount(_0x16c7bc);}else{_0x223775[_0x898a('0x3f')](_0x223775['faxAccounts'][_0x16c7bc['id']],_0x16c7bc);}}}return _0x223775[_0x898a('0x23')];};};module[_0x898a('0x72')]=Realtime; \ No newline at end of file +var _0xe14d=['total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','name','isUndefined','initTelephones','telephones','length','initTrunks','initTriggers','initTemplates','initFreshdeskAccounts','freshdeskAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','dynamics365Accounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','seconds','queuecallercomplete','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','bluebird','util','lodash','moment','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','SIP/%s','hasOwnProperty','isNil','interface','format'];(function(_0x57ec65,_0x7ad428){var _0x5ca022=function(_0xdc4844){while(--_0xdc4844){_0x57ec65['push'](_0x57ec65['shift']());}};_0x5ca022(++_0x7ad428);}(_0xe14d,0x1ee));var _0xde14=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xe14d[_0x3635ce];return _0x97ecd0;};'use strict';var BPromise=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var _=require(_0xde14('0x2'));var moment=require(_0xde14('0x3'));var Agent=require('../model/agent');var Telephone=require(_0xde14('0x4'));var Trunk=require(_0xde14('0x5'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xde14('0x6'));var Template=require(_0xde14('0x7'));var Campaign=require(_0xde14('0x8'));var VoiceExtension=require(_0xde14('0x9'));var ZendeskAccount=require(_0xde14('0xa'));var SalesforceAccount=require(_0xde14('0xb'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xde14('0xc'));var DeskAccount=require(_0xde14('0xd'));var VtigerAccount=require(_0xde14('0xe'));var ServicenowAccount=require(_0xde14('0xf'));var Dynamics365Account=require(_0xde14('0x10'));var FreshsalesAccount=require(_0xde14('0x11'));var FaxAccount=require(_0xde14('0x12'));var Realtime=function(){this[_0xde14('0x13')]={};this['telephones']={};this[_0xde14('0x14')]={};this[_0xde14('0x15')]={};this[_0xde14('0x16')]={};this[_0xde14('0x17')]={};this[_0xde14('0x18')]={};this[_0xde14('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xde14('0x1a')]={};this[_0xde14('0x1b')]={};this[_0xde14('0x1c')]={};this[_0xde14('0x1d')]={};this[_0xde14('0x1e')]={};this[_0xde14('0x1f')]={};this[_0xde14('0x20')]={};this[_0xde14('0x21')]={};this[_0xde14('0x22')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0xde14('0x23')]={};this[_0xde14('0x24')]={};this[_0xde14('0x25')]={};this['dynamics365Accounts']={};this[_0xde14('0x26')]={};this[_0xde14('0x27')]={};};function freeIsNotKey(_0x257390,_0x31902a,_0x3de959){var _0x1b9d4b=_[_0xde14('0x28')](_0x257390,function(_0x6f6eea,_0x3cc317){return _0x6f6eea[_0x3de959];});for(var _0x10c4ab in _0x31902a){if(_0x31902a['hasOwnProperty'](_0x10c4ab)){if(!_0x1b9d4b[_0x10c4ab]){delete _0x31902a[_0x10c4ab];}}}}function freeIsNotKeySip(_0x3f5fcf,_0x3bfc59){var _0x2eb8a8=_[_0xde14('0x28')](_0x3f5fcf,function(_0x4ce69f,_0x394de7){return util['format'](_0xde14('0x29'),_0x4ce69f['name']);});for(var _0xa50687 in _0x3bfc59){if(_0x3bfc59[_0xde14('0x2a')](_0xa50687)){if(!_0x2eb8a8[_0xa50687]){delete _0x3bfc59[_0xa50687];}}}}function freeIsNotKeyAgent(_0x51ee8d,_0x1949ab){var _0x39bdc5=_[_0xde14('0x28')](_0x51ee8d,function(_0x40b648,_0x2dd9e7){var _0xdd8d59=_[_0xde14('0x2b')](_0x40b648[_0xde14('0x2c')])?util[_0xde14('0x2d')](_0xde14('0x29'),_0x40b648['name']):_0x40b648[_0xde14('0x2c')];return _0xdd8d59;});for(var _0x3ce77c in _0x1949ab){if(_0x1949ab[_0xde14('0x2a')](_0x3ce77c)){if(!_0x39bdc5[_0x3ce77c]){delete _0x1949ab[_0x3ce77c];}}}}function clearVoiceCallReports(_0xbd05d6){_0xbd05d6[_0xde14('0x2e')]=0x0;_0xbd05d6[_0xde14('0x2f')]=0x0;_0xbd05d6[_0xde14('0x30')]=0x0;_0xbd05d6[_0xde14('0x31')]=0x0;_0xbd05d6[_0xde14('0x32')]=0x0;}function clearCampaigns(_0x350a78){if(!_['isEmpty'](_0x350a78)){for(var _0x309922 in _0x350a78){if(_0x350a78[_0xde14('0x2a')](_0x309922)){_0x350a78[_0x309922][_0xde14('0x33')]=0x0;_0x350a78[_0x309922][_0xde14('0x34')]=0x0;}}}}function clearVoiceQueues(_0x5d8b4b){if(!_[_0xde14('0x35')](_0x5d8b4b)){for(var _0x2c9822 in _0x5d8b4b){if(_0x5d8b4b[_0xde14('0x2a')](_0x2c9822)){_0x5d8b4b[_0x2c9822]['total']=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x2f')]=0x0;_0x5d8b4b[_0x2c9822]['unmanaged']=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x36')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x30')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x31')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x32')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x37')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x38')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x39')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x3a')]=0x0;_0x5d8b4b[_0x2c9822]['outboundNoSuchCallsDay']=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x3b')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x3c')]=0x0;_0x5d8b4b[_0x2c9822]['outboundDropCallsDayCallersExit']=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x3d')]=0x0;_0x5d8b4b[_0x2c9822]['outboundOriginateFailureCallsDay']=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x3e')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x3f')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x37')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x40')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x41')]=!![];}}}}Realtime['prototype'][_0xde14('0x42')]=function(_0x57b98b,_0x4d4295){for(var _0x280238 in _0x4d4295){if(_0x57b98b[_0xde14('0x2a')](_0x280238)){_0x57b98b[_0x280238]=_0x4d4295[_0x280238];}}};Realtime[_0xde14('0x43')][_0xde14('0x44')]=function(){var _0x2713fb=this;return function(_0xa41c1e){if(_0xa41c1e){freeIsNotKeyAgent(_0xa41c1e,_0x2713fb[_0xde14('0x13')]);for(var _0x32fe83=0x0,_0x33c361={},_0x48d587={};_0x32fe83<_0xa41c1e['length'];_0x32fe83+=0x1){_0x33c361=_0xa41c1e[_0x32fe83];var _0x1c7136=_[_0xde14('0x2b')](_0x33c361[_0xde14('0x2c')])?util[_0xde14('0x2d')](_0xde14('0x29'),_0x33c361[_0xde14('0x45')]):_0x33c361[_0xde14('0x2c')];if(_[_0xde14('0x46')](_0x2713fb[_0xde14('0x13')][_0x1c7136])){_0x2713fb['agents'][_0x1c7136]=new Agent(_0x33c361);}else{_0x2713fb[_0xde14('0x42')](_0x2713fb['agents'][_0x1c7136],_0x33c361);}}}return _0x2713fb['agents'];};};Realtime['prototype'][_0xde14('0x47')]=function(){var _0x258759=this;return function(_0x398f63){if(_0x398f63){freeIsNotKeySip(_0x398f63,_0x258759[_0xde14('0x48')]);for(var _0x1228d8=0x0,_0x8b5bb4={},_0x1e89b6={};_0x1228d8<_0x398f63[_0xde14('0x49')];_0x1228d8+=0x1){_0x8b5bb4=_0x398f63[_0x1228d8];if(_['isUndefined'](_0x258759[_0xde14('0x48')][util[_0xde14('0x2d')](_0xde14('0x29'),_0x8b5bb4[_0xde14('0x45')])])){_0x258759[_0xde14('0x48')][util[_0xde14('0x2d')](_0xde14('0x29'),_0x8b5bb4[_0xde14('0x45')])]=new Telephone(_0x8b5bb4);}else{_0x258759['mergeFromDatabase'](_0x258759[_0xde14('0x48')][util[_0xde14('0x2d')](_0xde14('0x29'),_0x8b5bb4[_0xde14('0x45')])],_0x8b5bb4);}}}return _0x258759['telephones'];};};Realtime['prototype'][_0xde14('0x4a')]=function(){var _0x16e7d1=this;return function(_0xff1bbd){if(_0xff1bbd){freeIsNotKeySip(_0xff1bbd,_0x16e7d1[_0xde14('0x14')]);for(var _0x401f7e=0x0,_0x4c66bc={},_0x24b02c={};_0x401f7e<_0xff1bbd[_0xde14('0x49')];_0x401f7e+=0x1){_0x4c66bc=_0xff1bbd[_0x401f7e];if(_[_0xde14('0x46')](_0x16e7d1['trunks'][util[_0xde14('0x2d')]('SIP/%s',_0x4c66bc[_0xde14('0x45')])])){_0x16e7d1['trunks'][util[_0xde14('0x2d')](_0xde14('0x29'),_0x4c66bc[_0xde14('0x45')])]=new Trunk(_0x4c66bc);}else{_0x16e7d1[_0xde14('0x42')](_0x16e7d1[_0xde14('0x14')][util[_0xde14('0x2d')](_0xde14('0x29'),_0x4c66bc[_0xde14('0x45')])],_0x4c66bc);}}}return _0x16e7d1['trunks'];};};Realtime[_0xde14('0x43')]['initVoiceQueues']=function(){var _0x430b22=this;return function(_0x5ac3f3){if(_0x5ac3f3){freeIsNotKey(_0x5ac3f3,_0x430b22[_0xde14('0x15')],_0xde14('0x45'));for(var _0x437466=0x0,_0x2283b7={},_0x40e7ae={};_0x437466<_0x5ac3f3[_0xde14('0x49')];_0x437466+=0x1){_0x2283b7=_0x5ac3f3[_0x437466];if(_[_0xde14('0x46')](_0x430b22[_0xde14('0x15')][_0x2283b7['name']])){_0x430b22[_0xde14('0x15')][_0x2283b7[_0xde14('0x45')]]=new VoiceQueue(_0x2283b7);}else{_0x430b22[_0xde14('0x42')](_0x430b22[_0xde14('0x15')][_0x2283b7['name']],_0x2283b7);}}}return _0x430b22[_0xde14('0x15')];};};Realtime[_0xde14('0x43')][_0xde14('0x4b')]=function(){var _0xdbdab8=this;return function(_0x39572b){if(_0x39572b){freeIsNotKey(_0x39572b,_0xdbdab8[_0xde14('0x16')],'id');for(var _0x5b5eb5=0x0,_0x26ec08={},_0x518426={};_0x5b5eb5<_0x39572b[_0xde14('0x49')];_0x5b5eb5+=0x1){_0x26ec08=_0x39572b[_0x5b5eb5];if(_[_0xde14('0x46')](_0xdbdab8['triggers'][_0x26ec08['id']])){_0xdbdab8[_0xde14('0x16')][_0x26ec08['id']]=new Trigger(_0x26ec08);}else{_0xdbdab8[_0xde14('0x42')](_0xdbdab8[_0xde14('0x16')][_0x26ec08['id']],_0x26ec08);}}}return _0xdbdab8[_0xde14('0x16')];};};Realtime[_0xde14('0x43')][_0xde14('0x4c')]=function(){var _0x45fa7e=this;return function(_0x51f35f){if(_0x51f35f){freeIsNotKey(_0x51f35f,_0x45fa7e[_0xde14('0x18')],'id');for(var _0x4ffc8c=0x0,_0xfa80c8={},_0x6aa9ab={};_0x4ffc8c<_0x51f35f[_0xde14('0x49')];_0x4ffc8c+=0x1){_0xfa80c8=_0x51f35f[_0x4ffc8c];if(_[_0xde14('0x46')](_0x45fa7e[_0xde14('0x18')][_0xfa80c8['id']])){_0x45fa7e[_0xde14('0x18')][_0xfa80c8['id']]=new Template(_0xfa80c8);}else{_0x45fa7e[_0xde14('0x42')](_0x45fa7e[_0xde14('0x18')][_0xfa80c8['id']],_0xfa80c8);}}}return _0x45fa7e[_0xde14('0x18')];};};Realtime[_0xde14('0x43')]['initZendeskAccounts']=function(){var _0xd37eb6=this;return function(_0x1688c6){if(_0x1688c6){freeIsNotKey(_0x1688c6,_0xd37eb6[_0xde14('0x20')],'id');for(var _0x38d50a=0x0,_0x14b781={},_0x4874ed={};_0x38d50a<_0x1688c6[_0xde14('0x49')];_0x38d50a+=0x1){_0x14b781=_0x1688c6[_0x38d50a];if(_['isUndefined'](_0xd37eb6[_0xde14('0x20')][_0x14b781['id']])){_0xd37eb6[_0xde14('0x20')][_0x14b781['id']]=new ZendeskAccount(_0x14b781);}else{_0xd37eb6[_0xde14('0x42')](_0xd37eb6[_0xde14('0x20')][_0x14b781['id']],_0x14b781);}}}return _0xd37eb6[_0xde14('0x20')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x435964=this;return function(_0x56c3fe){if(_0x56c3fe){freeIsNotKey(_0x56c3fe,_0x435964[_0xde14('0x21')],'id');for(var _0x31111d=0x0,_0x15e2fb={},_0x27c8dd={};_0x31111d<_0x56c3fe[_0xde14('0x49')];_0x31111d+=0x1){_0x15e2fb=_0x56c3fe[_0x31111d];if(_[_0xde14('0x46')](_0x435964[_0xde14('0x21')][_0x15e2fb['id']])){_0x435964[_0xde14('0x21')][_0x15e2fb['id']]=new SalesforceAccount(_0x15e2fb);}else{_0x435964[_0xde14('0x42')](_0x435964['salesforceAccounts'][_0x15e2fb['id']],_0x15e2fb);}}}return _0x435964[_0xde14('0x21')];};};Realtime[_0xde14('0x43')][_0xde14('0x4d')]=function(){var _0x21d226=this;return function(_0x249ccc){if(_0x249ccc){freeIsNotKey(_0x249ccc,_0x21d226['freshdeskAccounts'],'id');for(var _0xb2d69c=0x0,_0x58790d={},_0x6cd665={};_0xb2d69c<_0x249ccc[_0xde14('0x49')];_0xb2d69c+=0x1){_0x58790d=_0x249ccc[_0xb2d69c];if(_[_0xde14('0x46')](_0x21d226[_0xde14('0x4e')][_0x58790d['id']])){_0x21d226[_0xde14('0x4e')][_0x58790d['id']]=new FreshdeskAccount(_0x58790d);}else{_0x21d226[_0xde14('0x42')](_0x21d226[_0xde14('0x4e')][_0x58790d['id']],_0x58790d);}}}return _0x21d226[_0xde14('0x4e')];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x593143=this;return function(_0x475671){if(_0x475671){freeIsNotKey(_0x475671,_0x593143['zohoAccounts'],'id');for(var _0x596cd3=0x0,_0xc10000={},_0x20fd21={};_0x596cd3<_0x475671[_0xde14('0x49')];_0x596cd3+=0x1){_0xc10000=_0x475671[_0x596cd3];if(_[_0xde14('0x46')](_0x593143[_0xde14('0x4f')][_0xc10000['id']])){_0x593143[_0xde14('0x4f')][_0xc10000['id']]=new ZohoAccount(_0xc10000);}else{_0x593143[_0xde14('0x42')](_0x593143[_0xde14('0x4f')][_0xc10000['id']],_0xc10000);}}}return _0x593143[_0xde14('0x4f')];};};Realtime['prototype'][_0xde14('0x50')]=function(){var _0x1cfc98=this;return function(_0x2eeeeb){if(_0x2eeeeb){freeIsNotKey(_0x2eeeeb,_0x1cfc98['deskAccounts'],'id');for(var _0x2bd32d=0x0,_0x599adc={},_0xc98b34={};_0x2bd32d<_0x2eeeeb[_0xde14('0x49')];_0x2bd32d+=0x1){_0x599adc=_0x2eeeeb[_0x2bd32d];if(_[_0xde14('0x46')](_0x1cfc98[_0xde14('0x23')][_0x599adc['id']])){_0x1cfc98[_0xde14('0x23')][_0x599adc['id']]=new DeskAccount(_0x599adc);}else{_0x1cfc98[_0xde14('0x42')](_0x1cfc98[_0xde14('0x23')][_0x599adc['id']],_0x599adc);}}}return _0x1cfc98['deskAccounts'];};};Realtime[_0xde14('0x43')][_0xde14('0x51')]=function(){var _0x1a0bb1=this;return function(_0x40fcda){if(_0x40fcda){freeIsNotKey(_0x40fcda,_0x1a0bb1[_0xde14('0x22')],'id');for(var _0x70a2e1=0x0,_0x439118={},_0x4cdf99={};_0x70a2e1<_0x40fcda['length'];_0x70a2e1+=0x1){_0x439118=_0x40fcda[_0x70a2e1];if(_[_0xde14('0x46')](_0x1a0bb1[_0xde14('0x22')][_0x439118['id']])){_0x1a0bb1[_0xde14('0x22')][_0x439118['id']]=new SugarcrmAccount(_0x439118);}else{_0x1a0bb1['mergeFromDatabase'](_0x1a0bb1[_0xde14('0x22')][_0x439118['id']],_0x439118);}}}return _0x1a0bb1[_0xde14('0x22')];};};Realtime[_0xde14('0x43')][_0xde14('0x52')]=function(){var _0x51e8ca=this;return function(_0x567180){if(_0x567180){freeIsNotKey(_0x567180,_0x51e8ca[_0xde14('0x24')],'id');for(var _0x3dcda8=0x0,_0x30f228={},_0x329be2={};_0x3dcda8<_0x567180[_0xde14('0x49')];_0x3dcda8+=0x1){_0x30f228=_0x567180[_0x3dcda8];if(_[_0xde14('0x46')](_0x51e8ca[_0xde14('0x24')][_0x30f228['id']])){_0x51e8ca[_0xde14('0x24')][_0x30f228['id']]=new VtigerAccount(_0x30f228);}else{_0x51e8ca[_0xde14('0x42')](_0x51e8ca[_0xde14('0x24')][_0x30f228['id']],_0x30f228);}}}return _0x51e8ca[_0xde14('0x24')];};};Realtime[_0xde14('0x43')][_0xde14('0x53')]=function(){var _0x42329a=this;return function(_0x6a641f){if(_0x6a641f){freeIsNotKey(_0x6a641f,_0x42329a[_0xde14('0x25')],'id');for(var _0x2656c7=0x0,_0x31ebbd={},_0x439a51={};_0x2656c7<_0x6a641f[_0xde14('0x49')];_0x2656c7+=0x1){_0x31ebbd=_0x6a641f[_0x2656c7];if(_[_0xde14('0x46')](_0x42329a[_0xde14('0x25')][_0x31ebbd['id']])){_0x42329a[_0xde14('0x25')][_0x31ebbd['id']]=new ServicenowAccount(_0x31ebbd);}else{_0x42329a['mergeFromDatabase'](_0x42329a[_0xde14('0x25')][_0x31ebbd['id']],_0x31ebbd);}}}return _0x42329a['servicenowAccounts'];};};Realtime[_0xde14('0x43')]['initDynamics365Accounts']=function(){var _0x3bbbab=this;return function(_0xfa9c8d){if(_0xfa9c8d){freeIsNotKey(_0xfa9c8d,_0x3bbbab[_0xde14('0x54')],'id');for(var _0x5506e1=0x0,_0x5e16e2={},_0x23d3e1={};_0x5506e1<_0xfa9c8d[_0xde14('0x49')];_0x5506e1+=0x1){_0x5e16e2=_0xfa9c8d[_0x5506e1];if(_[_0xde14('0x46')](_0x3bbbab[_0xde14('0x54')][_0x5e16e2['id']])){_0x3bbbab['dynamics365Accounts'][_0x5e16e2['id']]=new Dynamics365Account(_0x5e16e2);}else{_0x3bbbab[_0xde14('0x42')](_0x3bbbab[_0xde14('0x54')][_0x5e16e2['id']],_0x5e16e2);}}}return _0x3bbbab[_0xde14('0x54')];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0x49dc83=this;return function(_0x58ccb4){if(_0x58ccb4){freeIsNotKey(_0x58ccb4,_0x49dc83[_0xde14('0x26')],'id');for(var _0x30f0f0=0x0,_0x20cee9={},_0x5b1a32={};_0x30f0f0<_0x58ccb4[_0xde14('0x49')];_0x30f0f0+=0x1){_0x20cee9=_0x58ccb4[_0x30f0f0];if(_[_0xde14('0x46')](_0x49dc83[_0xde14('0x26')][_0x20cee9['id']])){_0x49dc83[_0xde14('0x26')][_0x20cee9['id']]=new FreshsalesAccount(_0x20cee9);}else{_0x49dc83[_0xde14('0x42')](_0x49dc83[_0xde14('0x26')][_0x20cee9['id']],_0x20cee9);}}}return _0x49dc83['freshsalesAccounts'];};};Realtime['prototype'][_0xde14('0x55')]=function(){var _0x4474c2=this;return function(_0x54aaa2){for(var _0x103766=0x0;_0x103766<_0x54aaa2[_0xde14('0x49')];_0x103766+=0x1){_[_0xde14('0x56')](_0x4474c2[_0xde14('0x15')][_0x54aaa2[_0x103766][_0xde14('0x45')]],_0x54aaa2[_0x103766]);}return _0x4474c2[_0xde14('0x15')];};};Realtime[_0xde14('0x43')]['initVoiceQueueReports']=function(){var _0x552889=this;return function(_0x4800bf){clearVoiceQueues(_0x552889['voiceQueues']);if(_0x4800bf){_0x4800bf=_[_0xde14('0x57')](_0x4800bf,_0xde14('0x58'));for(var _0x5baa51 in _0x4800bf){if(_0x4800bf['hasOwnProperty'](_0x5baa51)){var _0x350aa8={};for(var _0x25d9d6=0x0;_0x25d9d6<_0x4800bf[_0x5baa51][_0xde14('0x49')];_0x25d9d6+=0x1){var _0x5805ec=_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x59')];if(_0x552889[_0xde14('0x15')][_0x5805ec]){if(_0x4800bf[_0x5baa51][_0x25d9d6]['queuecallerexit']){_0x552889[_0xde14('0x15')][_0x5805ec][_0xde14('0x5a')]+=0x1;}if(_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x5b')]){_0x552889[_0xde14('0x15')][_0x5805ec]['abandoned']+=0x1;}_0x552889[_0xde14('0x15')][_0x5805ec]['sumHoldTime']+=moment(_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x5c')])[_0xde14('0x5d')](moment(_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x5e')]),'seconds')||0x0;if(_0x25d9d6===_0x4800bf[_0x5baa51][_0xde14('0x49')]-0x1){_0x552889[_0xde14('0x15')][_0x5805ec][_0xde14('0x31')]+=moment(_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x5f')]||_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x60')]||_0x4800bf[_0x5baa51][_0x25d9d6]['queuecallerexitAt'])['diff'](moment(_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x5e')]),_0xde14('0x61'))||0x0;_0x552889[_0xde14('0x15')][_0x5805ec]['total']+=0x1;if(_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x62')]){_0x552889[_0xde14('0x15')][_0x5805ec][_0xde14('0x2f')]+=0x1;_0x552889[_0xde14('0x15')][_0x5805ec][_0xde14('0x32')]+=moment(_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x5f')])[_0xde14('0x5d')](moment(_0x4800bf[_0x5baa51][_0x25d9d6]['queuecallerleaveAt']),_0xde14('0x61'))||0x0;}}else{_0x552889[_0xde14('0x15')][_0x5805ec][_0xde14('0x31')]+=_0x552889[_0xde14('0x15')][_0x5805ec][_0xde14('0x30')]||0x0;}}}}}}return _0x552889[_0xde14('0x15')];};};Realtime[_0xde14('0x43')]['initVoiceCallReports']=function(){var _0x26fd01=this;return function(_0x1bdeae){clearVoiceCallReports(_0x26fd01['outbound']);if(_0x1bdeae){for(var _0x4543f1=0x0;_0x4543f1<_0x1bdeae['length'];_0x4543f1+=0x1){_0x26fd01[_0xde14('0x19')]['total']+=0x1;_0x26fd01[_0xde14('0x19')][_0xde14('0x31')]+=_0x1bdeae[_0x4543f1][_0xde14('0x63')];if(_0x1bdeae[_0x4543f1][_0xde14('0x64')]===_0xde14('0x65')){_0x26fd01[_0xde14('0x19')]['answered']+=0x1;_0x26fd01[_0xde14('0x19')][_0xde14('0x30')]+=_0x1bdeae[_0x4543f1][_0xde14('0x63')]-_0x1bdeae[_0x4543f1]['billableseconds']||0x0;_0x26fd01[_0xde14('0x19')][_0xde14('0x32')]+=_0x1bdeae[_0x4543f1][_0xde14('0x66')];}}}return _0x26fd01['outbound'];};};Realtime[_0xde14('0x43')][_0xde14('0x67')]=function(){var _0x4324a4=this;return function(_0x4d12ad){if(_0x4d12ad){freeIsNotKey(_0x4d12ad,_0x4324a4['campaigns'],'name');for(var _0x4ffff1=0x0,_0x381d6d={};_0x4ffff1<_0x4d12ad[_0xde14('0x49')];_0x4ffff1+=0x1){_0x381d6d=_0x4d12ad[_0x4ffff1];if(_['isUndefined'](_0x4324a4[_0xde14('0x17')][_0x381d6d[_0xde14('0x45')]])){_0x4324a4[_0xde14('0x17')][_0x381d6d[_0xde14('0x45')]]=new Campaign(_0x381d6d);}else{_0x4324a4[_0xde14('0x42')](_0x4324a4['campaigns'][_0x381d6d[_0xde14('0x45')]],_0x381d6d);_0x4324a4[_0xde14('0x17')][_0x381d6d[_0xde14('0x45')]][_0xde14('0x68')]=_0x381d6d[_0xde14('0x69')]?_0x381d6d[_0xde14('0x69')][_0xde14('0x45')]:undefined;}}}return _0x4324a4[_0xde14('0x17')];};};Realtime['prototype'][_0xde14('0x6a')]=function(){var _0x3f180b=this;return function(_0xd9a97){if(_0xd9a97){freeIsNotKey(_0xd9a97,_0x3f180b[_0xde14('0x1a')],'id');for(var _0x243e5f=0x0,_0x165cc2={};_0x243e5f<_0xd9a97[_0xde14('0x49')];_0x243e5f+=0x1){_0x165cc2=_0xd9a97[_0x243e5f];if(_[_0xde14('0x46')](_0x3f180b['voiceExtensions'][_0x165cc2['id']])){_0x3f180b[_0xde14('0x1a')][_0x165cc2['id']]=new VoiceExtension(_0x165cc2);}else{_0x3f180b[_0xde14('0x42')](_0x3f180b['voiceExtensions'][_0x165cc2['id']],_0x165cc2);}}}return _0x3f180b[_0xde14('0x1a')];};};Realtime[_0xde14('0x43')][_0xde14('0x6b')]=function(){var _0x381477=this;return function(_0x22909b){clearCampaigns(_0x381477[_0xde14('0x17')]);for(var _0x5c562d=0x0;_0x5c562d<_0x22909b[_0xde14('0x49')];_0x5c562d+=0x1){_[_0xde14('0x56')](_0x381477[_0xde14('0x17')][_0x22909b[_0x5c562d][_0xde14('0x45')]],_0x22909b[_0x5c562d]);}return _0x381477[_0xde14('0x17')];};};Realtime[_0xde14('0x43')]['initFaxAccounts']=function(){var _0x56eb76=this;return function(_0x41b62a){if(_0x41b62a){freeIsNotKey(_0x41b62a,_0x56eb76[_0xde14('0x27')],'id');for(var _0x578044=0x0,_0x2f4f8b={},_0x42d41f={};_0x578044<_0x41b62a[_0xde14('0x49')];_0x578044+=0x1){_0x2f4f8b=_0x41b62a[_0x578044];if(_[_0xde14('0x46')](_0x56eb76[_0xde14('0x27')][_0x2f4f8b['id']])){_0x56eb76[_0xde14('0x27')][_0x2f4f8b['id']]=new FaxAccount(_0x2f4f8b);}else{_0x56eb76[_0xde14('0x42')](_0x56eb76[_0xde14('0x27')][_0x2f4f8b['id']],_0x2f4f8b);}}}return _0x56eb76[_0xde14('0x27')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 92e5120..644d740 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 _0x4cec=['../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','custom:voiceCallReport','bind','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','voiceQueueReport','length','lastAssignedTo','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','voiceCallReport','destination','type','from-voip-provider','callerid','context','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','connectedlinenum','calleridname','transfers','linkedid','uniqueid','monitor','monitorFilename','createdAt','monitors','exten','connectedlinename','isArray','forEach','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','membername','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport'];(function(_0x581566,_0x3d4be9){var _0x2fc4b3=function(_0x30a9de){while(--_0x30a9de){_0x581566['push'](_0x581566['shift']());}};_0x2fc4b3(++_0x3d4be9);}(_0x4cec,0xf6));var _0xc4ce=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x4cec[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xc4ce('0x0'));var moment=require(_0xc4ce('0x1'));var util=require(_0xc4ce('0x2'));var config=require(_0xc4ce('0x3'));var ami=require(_0xc4ce('0x4'));var RpcVoiceAgentReport=require(_0xc4ce('0x5'));var RpcVoiceCallReport=require(_0xc4ce('0x6'));var RpcVoiceDialReport=require(_0xc4ce('0x7'));var RpcMemberReport=require(_0xc4ce('0x8'));var RpcVoiceQueueReport=require(_0xc4ce('0x9'));var RpcVoiceRecording=require(_0xc4ce('0xa'));var RpcVoiceTransferReport=require(_0xc4ce('0xb'));var VoiceQueueReport=require(_0xc4ce('0xc'));var VoiceCallReport=require(_0xc4ce('0xd'));var VoiceAgentReport=require(_0xc4ce('0xe'));var VoiceDialReport=require(_0xc4ce('0xf'));var UserReport=require('./userReport');function Report(_0x1c0909){this[_0xc4ce('0x10')]=_0x1c0909;this[_0xc4ce('0x11')]=_0x1c0909[_0xc4ce('0x11')];this[_0xc4ce('0x12')]=_0x1c0909[_0xc4ce('0x12')];}Report[_0xc4ce('0x13')][_0xc4ce('0x14')]=function(_0x17bc00){var _0x34db5=new VoiceQueueReport(this[_0xc4ce('0x10')]);var _0x2eedea=new VoiceAgentReport(this[_0xc4ce('0x10')]);var _0x180358=new VoiceDialReport(this[_0xc4ce('0x10')]);var _0x54f0fb=new VoiceCallReport(this['realtime']);var _0x3e16ed=new UserReport(this['realtime']);if(config[_0xc4ce('0x15')]&&config[_0xc4ce('0x15')][_0xc4ce('0x16')]){ami['on'](_0xc4ce('0x17'),this['voiceQueueReport']['bind'](this));ami['on'](_0xc4ce('0x18'),this['voiceCallReport'][_0xc4ce('0x19')](this));ami['on']('custom:voiceAgentReport',this[_0xc4ce('0x1a')][_0xc4ce('0x19')](this));ami['on'](_0xc4ce('0x1b'),this[_0xc4ce('0x1c')][_0xc4ce('0x19')](this));ami['on'](_0xc4ce('0x1d'),this[_0xc4ce('0x1e')][_0xc4ce('0x19')](this));ami['on'](_0xc4ce('0x1f'),this[_0xc4ce('0x20')]['bind'](this));}};Report[_0xc4ce('0x13')][_0xc4ce('0x21')]=function(_0x20e0e9){var _0x21720d;_0x21720d=_[_0xc4ce('0x22')](this['agents'],function(_0x5caf96){return _0x5caf96[_0xc4ce('0x23')]==_0x20e0e9||_0x5caf96[_0xc4ce('0x24')]==_0x20e0e9;});if(_[_0xc4ce('0x25')](_0x21720d)){var _0x1eb593=_[_0xc4ce('0x22')](this[_0xc4ce('0x12')],function(_0x278c07){return _0x278c07[_0xc4ce('0x23')]==_0x20e0e9||_0x278c07[_0xc4ce('0x24')]==_0x20e0e9;});if(_0x1eb593){_0x21720d=_[_0xc4ce('0x22')](this[_0xc4ce('0x11')],function(_0x264c14){return _0x264c14[_0xc4ce('0x26')]==util[_0xc4ce('0x27')](_0xc4ce('0x28'),_0x1eb593[_0xc4ce('0x24')]);});}}return _0x21720d;};Report[_0xc4ce('0x13')][_0xc4ce('0x29')]=function(_0x3a24c0){for(var _0x59363e=0x0;_0x59363e<_0x3a24c0[_0xc4ce('0x2a')];_0x59363e+=0x1){var _0x1bff35=this[_0xc4ce('0x21')](_0x3a24c0[_0x59363e]['connectedlinenum']);if(_0x1bff35){_0x3a24c0[_0x59363e][_0xc4ce('0x23')]=_0x1bff35[_0xc4ce('0x23')];_0x3a24c0[_0x59363e]['assigned']=!![];_0x3a24c0[_0x59363e][_0xc4ce('0x2b')]=_0x1bff35[_0xc4ce('0x24')];_0x3a24c0[_0x59363e][_0xc4ce('0x26')]=_[_0xc4ce('0x25')](_0x1bff35[_0xc4ce('0x26')])?util[_0xc4ce('0x27')]('SIP/%s',_0x1bff35[_0xc4ce('0x24')]):_0x1bff35['interface'];if(_0x3a24c0[_0x59363e]['queuecallercomplete']){_0x3a24c0[_0x59363e]['queuecallercompleteAt']=moment()[_0xc4ce('0x27')](_0xc4ce('0x2c'));}if(_0x3a24c0[_0x59363e][_0xc4ce('0x2d')]){_0x3a24c0[_0x59363e][_0xc4ce('0x2e')]=moment()['format'](_0xc4ce('0x2c'));}RpcMemberReport[_0xc4ce('0x29')](_0x3a24c0[_0x59363e]);}RpcVoiceQueueReport[_0xc4ce('0x2f')](_0x3a24c0[_0x59363e]);}};function extractCalleridNumber(_0x47e2bc){var _0x138b11=_0x47e2bc[_0xc4ce('0x30')](/<(.*?)>/);return _0x138b11?_0x138b11[0x1]:_0x47e2bc;}Report[_0xc4ce('0x13')][_0xc4ce('0x31')]=function(_0x40e3d9){_0x40e3d9[_0xc4ce('0x32')]=_0x40e3d9['destination']||_0x40e3d9['exten'];if(_0x40e3d9[_0xc4ce('0x33')]=='dialer'){_0x40e3d9['lastapplication']='queue';_0x40e3d9['lastdata']=_0x40e3d9['queue'];if(_0x40e3d9['context']==_0xc4ce('0x34')){_0x40e3d9['accountcode']='';_0x40e3d9[_0xc4ce('0x32')]=extractCalleridNumber(_0x40e3d9[_0xc4ce('0x35')]);}else if(_0x40e3d9[_0xc4ce('0x36')]=='from-sip'){if(_0x40e3d9[_0xc4ce('0x32')]==_0xc4ce('0x37')){_0x40e3d9[_0xc4ce('0x32')]=extractCalleridNumber(_0x40e3d9['calleridpreview']);_0x40e3d9[_0xc4ce('0x38')]=_0x40e3d9[_0xc4ce('0x39')];_0x40e3d9[_0xc4ce('0x3a')]=[_0x40e3d9[_0xc4ce('0x3b')],_0x40e3d9['channel']=_0x40e3d9[_0xc4ce('0x3a')]][0x0];_0x40e3d9['callerid']=_0x40e3d9['calleridpreview'];}else{_0x40e3d9[_0xc4ce('0x32')]=_0x40e3d9[_0xc4ce('0x38')];_0x40e3d9['calleridnum']=_0x40e3d9[_0xc4ce('0x39')];if(_0x40e3d9[_0xc4ce('0x3c')]==_0xc4ce('0x3d')){_0x40e3d9[_0xc4ce('0x23')]=_0x40e3d9[_0xc4ce('0x3e')];}else{_0x40e3d9[_0xc4ce('0x23')]='';}}}}else{_0x40e3d9[_0xc4ce('0x35')]=util['format']('\x22%s\x22\x20<%s>',_0x40e3d9[_0xc4ce('0x3f')],_0x40e3d9['calleridnum']);}if(RpcVoiceTransferReport[_0xc4ce('0x40')][_0x40e3d9[_0xc4ce('0x41')]]){var _0x5a77f4=RpcVoiceTransferReport['transfers'][_0x40e3d9[_0xc4ce('0x41')]];_0x5a77f4['transfereelinkedid']=_0x40e3d9[_0xc4ce('0x42')];RpcVoiceTransferReport[_0xc4ce('0x1e')](_0x5a77f4);delete RpcVoiceTransferReport[_0xc4ce('0x40')][_0x40e3d9[_0xc4ce('0x41')]];}RpcVoiceCallReport[_0xc4ce('0x2f')](_0x40e3d9);if(_0x40e3d9[_0xc4ce('0x43')]){for(var _0x554817=0x0;_0x554817<_0x40e3d9['monitors'][_0xc4ce('0x2a')];_0x554817+=0x1){_0x40e3d9[_0xc4ce('0x44')]=_0x40e3d9['monitors'][_0x554817]['filename'];_0x40e3d9[_0xc4ce('0x45')]=_0x40e3d9[_0xc4ce('0x46')][_0x554817][_0xc4ce('0x45')];if(_0x40e3d9[_0xc4ce('0x47')]=='xcally-motion-preview'){_0x40e3d9[_0xc4ce('0x38')]=_0x40e3d9[_0xc4ce('0x3e')];_0x40e3d9['calleridname']=_0x40e3d9[_0xc4ce('0x48')];_0x40e3d9[_0xc4ce('0x3e')]=_0x40e3d9[_0xc4ce('0x23')];_0x40e3d9[_0xc4ce('0x48')]=_0x40e3d9['membername'];_0x40e3d9[_0xc4ce('0x47')]=_0x40e3d9[_0xc4ce('0x39')];}else if(_0x40e3d9[_0xc4ce('0x47')]=='xcally-motion-dialer'){_0x40e3d9[_0xc4ce('0x38')]=_0x40e3d9[_0xc4ce('0x32')];_0x40e3d9['exten']=_0x40e3d9[_0xc4ce('0x39')];}RpcVoiceRecording[_0xc4ce('0x2f')](_0x40e3d9);}}};Report[_0xc4ce('0x13')][_0xc4ce('0x1a')]=function(_0x4dfcb1){if(_[_0xc4ce('0x49')](_0x4dfcb1)){_0x4dfcb1[_0xc4ce('0x4a')](function(_0x124265){RpcVoiceAgentReport[_0xc4ce('0x2f')](_0x124265);});}else{RpcVoiceAgentReport[_0xc4ce('0x2f')](_0x4dfcb1);}};Report[_0xc4ce('0x13')][_0xc4ce('0x1c')]=function(_0xf33ad4){RpcVoiceDialReport[_0xc4ce('0x2f')](_0xf33ad4);var _0x14c83e;var _0x25fc26;var _0x440e15=_0xf33ad4[_0xc4ce('0x3b')];if(_[_0xc4ce('0x4b')](_0x440e15,_0xc4ce('0x4c'))){_0x25fc26=_0x440e15['substring'](_0x440e15[_0xc4ce('0x4d')]('/')+0x1,_0x440e15['indexOf']('@'));_0x14c83e=_['find'](this[_0xc4ce('0x11')],function(_0x2ea9c4){return _0x2ea9c4[_0xc4ce('0x4e')]==_0x25fc26||_0x2ea9c4[_0xc4ce('0x4f')]==_0x25fc26||_0x2ea9c4[_0xc4ce('0x23')]==_0x25fc26;});}else{_0x25fc26=_0x440e15[_0xc4ce('0x50')](_0x440e15['indexOf']('/')+0x1,_0x440e15[_0xc4ce('0x51')]('-'));_0x14c83e=this[_0xc4ce('0x21')](_0x25fc26);}if(_0x14c83e){_0xf33ad4[_0xc4ce('0x26')]=_[_0xc4ce('0x25')](_0x14c83e[_0xc4ce('0x26')])?util[_0xc4ce('0x27')]('SIP/%s',_0x14c83e[_0xc4ce('0x24')]):_0x14c83e['interface'];_0xf33ad4[_0xc4ce('0x52')]=_0x14c83e[_0xc4ce('0x24')];_0xf33ad4[_0xc4ce('0x23')]=_0x14c83e[_0xc4ce('0x23')];RpcMemberReport['voiceDialReport'](_0xf33ad4);}};Report[_0xc4ce('0x13')][_0xc4ce('0x1e')]=function(_0x582d7e){RpcVoiceTransferReport[_0xc4ce('0x40')][_0x582d7e[_0xc4ce('0x53')]]=_0x582d7e;};Report[_0xc4ce('0x13')][_0xc4ce('0x20')]=function(_0x373b28){RpcVoiceTransferReport['attendedTransfer'](_0x373b28);};module['exports']=Report; \ No newline at end of file +var _0x9567=['voiceQueueReport','length','connectedlinenum','assigned','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','voiceCallReport','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','calleridpreview','destinationchannel','channel','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','calleridnum','transfers','linkedid','transfereelinkedid','uniqueid','create','monitor','monitors','monitorFilename','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','SIP/%s','transfererlinkedid','attendedTransfer','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','interface','format'];(function(_0x40d100,_0x129c67){var _0xde28af=function(_0x42a26a){while(--_0x42a26a){_0x40d100['push'](_0x40d100['shift']());}};_0xde28af(++_0x129c67);}(_0x9567,0x1ee));var _0x7956=function(_0x1b3f6b,_0x2f82b1){_0x1b3f6b=_0x1b3f6b-0x0;var _0x4d398f=_0x9567[_0x1b3f6b];return _0x4d398f;};'use strict';var _=require(_0x7956('0x0'));var moment=require(_0x7956('0x1'));var util=require(_0x7956('0x2'));var config=require(_0x7956('0x3'));var ami=require(_0x7956('0x4'));var RpcVoiceAgentReport=require(_0x7956('0x5'));var RpcVoiceCallReport=require(_0x7956('0x6'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x7956('0x7'));var RpcVoiceQueueReport=require(_0x7956('0x8'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x7956('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x7956('0xa'));var VoiceDialReport=require(_0x7956('0xb'));var UserReport=require(_0x7956('0xc'));function Report(_0x21a129){this[_0x7956('0xd')]=_0x21a129;this[_0x7956('0xe')]=_0x21a129['agents'];this[_0x7956('0xf')]=_0x21a129[_0x7956('0xf')];}Report[_0x7956('0x10')][_0x7956('0x11')]=function(_0x279aab){var _0x1b09b9=new VoiceQueueReport(this['realtime']);var _0xc657f=new VoiceAgentReport(this[_0x7956('0xd')]);var _0xc05b1d=new VoiceDialReport(this[_0x7956('0xd')]);var _0x41cad0=new VoiceCallReport(this[_0x7956('0xd')]);var _0x451e7c=new UserReport(this['realtime']);if(config[_0x7956('0x12')]&&config['xdr'][_0x7956('0x13')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0x7956('0x14')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport']['bind'](this));ami['on'](_0x7956('0x15'),this[_0x7956('0x16')][_0x7956('0x14')](this));ami['on'](_0x7956('0x17'),this[_0x7956('0x18')][_0x7956('0x14')](this));ami['on'](_0x7956('0x19'),this[_0x7956('0x1a')][_0x7956('0x14')](this));ami['on'](_0x7956('0x1b'),this['attendedTransfer'][_0x7956('0x14')](this));}};Report[_0x7956('0x10')][_0x7956('0x1c')]=function(_0x37ebdd){var _0xee4522;_0xee4522=_[_0x7956('0x1d')](this['agents'],function(_0x84bd20){return _0x84bd20[_0x7956('0x1e')]==_0x37ebdd||_0x84bd20[_0x7956('0x1f')]==_0x37ebdd;});if(_['isNil'](_0xee4522)){var _0x323e3d=_[_0x7956('0x1d')](this[_0x7956('0xf')],function(_0x15a29b){return _0x15a29b[_0x7956('0x1e')]==_0x37ebdd||_0x15a29b[_0x7956('0x1f')]==_0x37ebdd;});if(_0x323e3d){_0xee4522=_[_0x7956('0x1d')](this[_0x7956('0xe')],function(_0x347032){return _0x347032[_0x7956('0x20')]==util[_0x7956('0x21')]('SIP/%s',_0x323e3d[_0x7956('0x1f')]);});}}return _0xee4522;};Report[_0x7956('0x10')][_0x7956('0x22')]=function(_0x54eeb9){for(var _0x5bede5=0x0;_0x5bede5<_0x54eeb9[_0x7956('0x23')];_0x5bede5+=0x1){var _0xbe74e1=this[_0x7956('0x1c')](_0x54eeb9[_0x5bede5][_0x7956('0x24')]);if(_0xbe74e1){_0x54eeb9[_0x5bede5][_0x7956('0x1e')]=_0xbe74e1['accountcode'];_0x54eeb9[_0x5bede5][_0x7956('0x25')]=!![];_0x54eeb9[_0x5bede5]['lastAssignedTo']=_0xbe74e1[_0x7956('0x1f')];_0x54eeb9[_0x5bede5][_0x7956('0x20')]=_[_0x7956('0x26')](_0xbe74e1[_0x7956('0x20')])?util[_0x7956('0x21')]('SIP/%s',_0xbe74e1[_0x7956('0x1f')]):_0xbe74e1['interface'];if(_0x54eeb9[_0x5bede5][_0x7956('0x27')]){_0x54eeb9[_0x5bede5][_0x7956('0x28')]=moment()[_0x7956('0x21')](_0x7956('0x29'));}if(_0x54eeb9[_0x5bede5][_0x7956('0x2a')]){_0x54eeb9[_0x5bede5][_0x7956('0x2b')]=moment()['format'](_0x7956('0x29'));}RpcMemberReport[_0x7956('0x22')](_0x54eeb9[_0x5bede5]);}RpcVoiceQueueReport['create'](_0x54eeb9[_0x5bede5]);}};function extractCalleridNumber(_0x3e495b){var _0x2f4a14=_0x3e495b[_0x7956('0x2c')](/<(.*?)>/);return _0x2f4a14?_0x2f4a14[0x1]:_0x3e495b;}Report['prototype'][_0x7956('0x2d')]=function(_0x4adaa2){_0x4adaa2[_0x7956('0x2e')]=_0x4adaa2['destination']||_0x4adaa2[_0x7956('0x2f')];if(_0x4adaa2[_0x7956('0x30')]==_0x7956('0x31')){_0x4adaa2[_0x7956('0x32')]=_0x7956('0x33');_0x4adaa2[_0x7956('0x34')]=_0x4adaa2[_0x7956('0x33')];if(_0x4adaa2[_0x7956('0x35')]==_0x7956('0x36')){_0x4adaa2[_0x7956('0x1e')]='';_0x4adaa2['destination']=extractCalleridNumber(_0x4adaa2[_0x7956('0x37')]);}else if(_0x4adaa2['context']==_0x7956('0x38')){if(_0x4adaa2['destination']=='xcally-motion-preview'){_0x4adaa2[_0x7956('0x2e')]=extractCalleridNumber(_0x4adaa2[_0x7956('0x39')]);_0x4adaa2['calleridnum']=_0x4adaa2['originatecalleridnum'];_0x4adaa2[_0x7956('0x3a')]=[_0x4adaa2[_0x7956('0x3b')],_0x4adaa2[_0x7956('0x3b')]=_0x4adaa2[_0x7956('0x3a')]][0x0];_0x4adaa2[_0x7956('0x37')]=_0x4adaa2[_0x7956('0x39')];}else{_0x4adaa2['destination']=_0x4adaa2['calleridnum'];_0x4adaa2['calleridnum']=_0x4adaa2[_0x7956('0x3c')];if(_0x4adaa2[_0x7956('0x3d')]==_0x7956('0x3e')){_0x4adaa2['accountcode']=_0x4adaa2[_0x7956('0x24')];}else{_0x4adaa2[_0x7956('0x1e')]='';}}}}else{_0x4adaa2['callerid']=util[_0x7956('0x21')](_0x7956('0x3f'),_0x4adaa2[_0x7956('0x40')],_0x4adaa2[_0x7956('0x41')]);}if(RpcVoiceTransferReport[_0x7956('0x42')][_0x4adaa2[_0x7956('0x43')]]){var _0x447150=RpcVoiceTransferReport[_0x7956('0x42')][_0x4adaa2[_0x7956('0x43')]];_0x447150[_0x7956('0x44')]=_0x4adaa2[_0x7956('0x45')];RpcVoiceTransferReport['blindTransfer'](_0x447150);delete RpcVoiceTransferReport['transfers'][_0x4adaa2[_0x7956('0x43')]];}RpcVoiceCallReport[_0x7956('0x46')](_0x4adaa2);if(_0x4adaa2[_0x7956('0x47')]){for(var _0x3fb79a=0x0;_0x3fb79a<_0x4adaa2[_0x7956('0x48')][_0x7956('0x23')];_0x3fb79a+=0x1){_0x4adaa2[_0x7956('0x49')]=_0x4adaa2[_0x7956('0x48')][_0x3fb79a]['filename'];_0x4adaa2['createdAt']=_0x4adaa2[_0x7956('0x48')][_0x3fb79a]['createdAt'];if(_0x4adaa2[_0x7956('0x2f')]=='xcally-motion-preview'){_0x4adaa2[_0x7956('0x41')]=_0x4adaa2['connectedlinenum'];_0x4adaa2[_0x7956('0x40')]=_0x4adaa2['connectedlinename'];_0x4adaa2['connectedlinenum']=_0x4adaa2[_0x7956('0x1e')];_0x4adaa2[_0x7956('0x4a')]=_0x4adaa2[_0x7956('0x4b')];_0x4adaa2[_0x7956('0x2f')]=_0x4adaa2['originatecalleridnum'];}else if(_0x4adaa2['exten']==_0x7956('0x4c')){_0x4adaa2[_0x7956('0x41')]=_0x4adaa2['destination'];_0x4adaa2[_0x7956('0x2f')]=_0x4adaa2[_0x7956('0x3c')];}RpcVoiceRecording[_0x7956('0x46')](_0x4adaa2);}}};Report[_0x7956('0x10')][_0x7956('0x16')]=function(_0x21011e){if(_[_0x7956('0x4d')](_0x21011e)){_0x21011e[_0x7956('0x4e')](function(_0x3c5cc6){RpcVoiceAgentReport[_0x7956('0x46')](_0x3c5cc6);});}else{RpcVoiceAgentReport[_0x7956('0x46')](_0x21011e);}};Report[_0x7956('0x10')]['voiceDialReport']=function(_0x3a3f38){RpcVoiceDialReport[_0x7956('0x46')](_0x3a3f38);var _0x5a43ef;var _0x8a47b6;var _0x2d8323=_0x3a3f38['channel'];if(_[_0x7956('0x4f')](_0x2d8323,'Local')){_0x8a47b6=_0x2d8323[_0x7956('0x50')](_0x2d8323[_0x7956('0x51')]('/')+0x1,_0x2d8323[_0x7956('0x51')]('@'));_0x5a43ef=_[_0x7956('0x1d')](this[_0x7956('0xe')],function(_0x217c74){return _0x217c74[_0x7956('0x52')]==_0x8a47b6||_0x217c74[_0x7956('0x53')]==_0x8a47b6||_0x217c74['accountcode']==_0x8a47b6;});}else{_0x8a47b6=_0x2d8323[_0x7956('0x50')](_0x2d8323['indexOf']('/')+0x1,_0x2d8323[_0x7956('0x54')]('-'));_0x5a43ef=this[_0x7956('0x1c')](_0x8a47b6);}if(_0x5a43ef){_0x3a3f38[_0x7956('0x20')]=_[_0x7956('0x26')](_0x5a43ef[_0x7956('0x20')])?util[_0x7956('0x21')](_0x7956('0x55'),_0x5a43ef['name']):_0x5a43ef['interface'];_0x3a3f38[_0x7956('0x4b')]=_0x5a43ef[_0x7956('0x1f')];_0x3a3f38[_0x7956('0x1e')]=_0x5a43ef['accountcode'];RpcMemberReport['voiceDialReport'](_0x3a3f38);}};Report[_0x7956('0x10')][_0x7956('0x1a')]=function(_0x4e359e){RpcVoiceTransferReport[_0x7956('0x42')][_0x4e359e[_0x7956('0x56')]]=_0x4e359e;};Report[_0x7956('0x10')][_0x7956('0x57')]=function(_0x1c41a1){RpcVoiceTransferReport[_0x7956('0x57')](_0x1c41a1);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 9bd7ef4..e9934e0 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 _0x2b42=['telephones','syncRegistry','bind','devicestatechange','syncDeviceState','syncRealtimeShow','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','emit','info','username','state','debug','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','toLowerCase','toNumber','updateStatusRealtime','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','startsWith','substring','indexOf','find','mobile','phone','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','peerstatus','status','address','telephone:save','[userReport][peerstatus]','exports','moment','util','bluebird','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents'];(function(_0x1bc0be,_0x59b5f2){var _0x10b257=function(_0x4cbf1c){while(--_0x4cbf1c){_0x1bc0be['push'](_0x1bc0be['shift']());}};_0x10b257(++_0x59b5f2);}(_0x2b42,0xc0));var _0x22b4=function(_0xeeb156,_0x5392f4){_0xeeb156=_0xeeb156-0x0;var _0x4b7c74=_0x2b42[_0xeeb156];return _0x4b7c74;};'use strict';var _=require('lodash');var moment=require(_0x22b4('0x0'));var util=require(_0x22b4('0x1'));var Redis=require('ioredis');var BPromise=require(_0x22b4('0x2'));var config=require('../../../config/environment');var logger=require(_0x22b4('0x3'))(_0x22b4('0x4'));var ami=require(_0x22b4('0x5'));config[_0x22b4('0x6')]=_[_0x22b4('0x7')](config[_0x22b4('0x6')],{'host':_0x22b4('0x8'),'port':0x18eb});var io=require(_0x22b4('0x9'))(new Redis(config[_0x22b4('0x6')]));function UserReport(_0x2cb086){this[_0x22b4('0xa')]=_0x2cb086[_0x22b4('0xa')];this[_0x22b4('0xb')]=_0x2cb086[_0x22b4('0xb')];this[_0x22b4('0xc')]=_0x2cb086[_0x22b4('0xc')];ami['on']('registryentry',this[_0x22b4('0xd')][_0x22b4('0xe')](this));ami['on']('registry',this[_0x22b4('0xd')][_0x22b4('0xe')](this));ami['on'](_0x22b4('0xf'),this[_0x22b4('0x10')][_0x22b4('0xe')](this));ami['on']('peerstatus',this['syncPeerStatus']['bind'](this));return this[_0x22b4('0x11')]();}function showSipRegistrations(){Promise['resolve']()[_0x22b4('0x12')](ami[_0x22b4('0x13')]())[_0x22b4('0x14')](function(_0x3268c7){logger[_0x22b4('0x15')](_0x22b4('0x16'),util[_0x22b4('0x17')](_0x3268c7,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0x22b4('0x12')](ami['actionDeviceStateList']())['catch'](function(_0x47b035){logger[_0x22b4('0x15')](_0x22b4('0x18'),util[_0x22b4('0x17')](_0x47b035,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x22b4('0x12')](ami[_0x22b4('0x19')]())[_0x22b4('0x14')](function(_0x36514e){logger[_0x22b4('0x15')](_0x22b4('0x1a'),util[_0x22b4('0x17')](_0x36514e,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x22b4('0x11')]=function(){setInterval(function(){BPromise['resolve']()['then'](showSipRegistrations())[_0x22b4('0x12')](listDeviceStates())[_0x22b4('0x12')](showPeersStatus());},0x32c8);};UserReport[_0x22b4('0x1b')][_0x22b4('0x1c')]=function(_0x5bda14){return _0x5bda14!==null&&!_['isUndefined'](_0x5bda14);};UserReport[_0x22b4('0x1b')][_0x22b4('0x1d')]=function(_0xa0c423,_0x547a32,_0x3040d9){io['to'](_0xa0c423)[_0x22b4('0x1d')](_0x547a32,_0x3040d9);};UserReport['prototype'][_0x22b4('0xd')]=function(_0x5390e4){try{if(this[_0x22b4('0x1c')](_0x5390e4)){logger[_0x22b4('0x1e')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x5390e4[_0x22b4('0x1f')],_0x5390e4[_0x22b4('0x20')]);logger[_0x22b4('0x21')]('[userReport][registry]',util[_0x22b4('0x17')](_0x5390e4,{'showHidden':![],'depth':null}));var _0x4142dc=_['find'](this[_0x22b4('0xa')],{'defaultuser':_0x5390e4['username']});if(_0x4142dc){_0x5390e4['stateRegistry']=_0x5390e4[_0x22b4('0x20')];_[_0x22b4('0x22')](_0x4142dc,_[_0x22b4('0x23')](_0x5390e4,[_0x22b4('0x24'),_0x22b4('0x25'),_0x22b4('0x1f'),_0x22b4('0x20')]));logger[_0x22b4('0x21')](_0x22b4('0x26'),util[_0x22b4('0x17')](_0x4142dc,{'showHidden':![],'depth':null}));this['emit'](util[_0x22b4('0x27')](_0x22b4('0x28'),_0x4142dc[_0x22b4('0x29')]),_0x22b4('0x2a'),_0x4142dc);}}}catch(_0x2b1e97){logger[_0x22b4('0x15')](_0x22b4('0x2b'),util['inspect'](_0x2b1e97,{'showHidden':![],'depth':null}));}};UserReport[_0x22b4('0x1b')]['syncDeviceState']=function(_0x4b0667){try{if(this[_0x22b4('0x1c')](_0x4b0667)){logger['info'](_0x22b4('0x2c'),_0x4b0667['device'],_0x4b0667['state']);logger[_0x22b4('0x21')](_0x22b4('0x2d'),util[_0x22b4('0x17')](_0x4b0667,{'showHidden':![],'depth':null}));if(this[_0x22b4('0xb')][_0x4b0667[_0x22b4('0x2e')]]){if(!this['agents'][_0x4b0667[_0x22b4('0x2e')]][_0x22b4('0x2f')]||_0x4b0667[_0x22b4('0x20')][_0x22b4('0x30')]()=='inuse'){this['agents'][_0x4b0667[_0x22b4('0x2e')]]['local']=![];if(this[_0x22b4('0xb')][_0x4b0667['device']][_0x22b4('0x20')]!==_0x4b0667[_0x22b4('0x20')]['toLowerCase']()){this[_0x22b4('0xb')][_0x4b0667[_0x22b4('0x2e')]]['stateTime']=_[_0x22b4('0x31')](moment()[_0x22b4('0x27')]('x'));}this[_0x22b4('0xb')][_0x4b0667[_0x22b4('0x2e')]][_0x22b4('0x20')]=_0x4b0667[_0x22b4('0x20')][_0x22b4('0x30')]();this[_0x22b4('0xb')][_0x4b0667['device']][_0x22b4('0x32')](_0x4b0667);}}else if(this[_0x22b4('0xc')][_0x4b0667[_0x22b4('0x2e')]]){if(this[_0x22b4('0xc')][_0x4b0667['device']][_0x22b4('0x20')]!==_0x4b0667['state'][_0x22b4('0x30')]()){this[_0x22b4('0xc')][_0x4b0667['device']][_0x22b4('0x33')]=_[_0x22b4('0x31')](moment()[_0x22b4('0x27')]('x'));}this[_0x22b4('0xc')][_0x4b0667[_0x22b4('0x2e')]][_0x22b4('0x20')]=_0x4b0667[_0x22b4('0x20')]['toLowerCase']();logger[_0x22b4('0x21')](_0x22b4('0x34'),util[_0x22b4('0x17')](this[_0x22b4('0xc')][_0x4b0667[_0x22b4('0x2e')]],{'showHidden':![],'depth':null}));this[_0x22b4('0x1d')](util[_0x22b4('0x27')](_0x22b4('0x35'),this[_0x22b4('0xc')][_0x4b0667[_0x22b4('0x2e')]]['name']),'telephone:save',this[_0x22b4('0xc')][_0x4b0667[_0x22b4('0x2e')]]);}else if(this['trunks'][_0x4b0667[_0x22b4('0x2e')]]){if(this['trunks'][_0x4b0667[_0x22b4('0x2e')]][_0x22b4('0x20')]!==_0x4b0667[_0x22b4('0x20')][_0x22b4('0x30')]()){this[_0x22b4('0xa')][_0x4b0667[_0x22b4('0x2e')]][_0x22b4('0x33')]=_[_0x22b4('0x31')](moment()['format']('x'));}this[_0x22b4('0xa')][_0x4b0667[_0x22b4('0x2e')]][_0x22b4('0x20')]=_0x4b0667[_0x22b4('0x20')][_0x22b4('0x30')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x22b4('0x17')](this[_0x22b4('0xa')][_0x4b0667[_0x22b4('0x2e')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x22b4('0x28'),this['trunks'][_0x4b0667[_0x22b4('0x2e')]][_0x22b4('0x29')]),_0x22b4('0x2a'),this['trunks'][_0x4b0667[_0x22b4('0x2e')]]);}else if(_[_0x22b4('0x36')](_0x4b0667[_0x22b4('0x2e')],'Local')){var _0x287b96=_0x4b0667[_0x22b4('0x2e')];var _0x4a73ed=_0x287b96[_0x22b4('0x37')](_0x287b96['indexOf']('/')+0x1,_0x287b96[_0x22b4('0x38')]('@'));var _0x2433a3=_[_0x22b4('0x39')](this[_0x22b4('0xb')],function(_0x352964){return _0x352964[_0x22b4('0x3a')]==_0x4a73ed||_0x352964[_0x22b4('0x3b')]==_0x4a73ed||_0x352964['accountcode']==_0x4a73ed;});if(_0x2433a3){if(_0x2433a3[_0x22b4('0x20')]!==_0x4b0667['state'][_0x22b4('0x30')]()){_0x2433a3['stateTime']=_[_0x22b4('0x31')](moment()['format']('x'));}_0x2433a3[_0x22b4('0x20')]=_0x4b0667[_0x22b4('0x20')]['toLowerCase']();_0x2433a3[_0x22b4('0x2f')]=!![];_0x2433a3[_0x22b4('0x32')](_0x4b0667);}}}}catch(_0x5aed4f){logger[_0x22b4('0x15')]('[userReport][devicestatechange]',util['inspect'](_0x5aed4f,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x5bdac3){try{if(this[_0x22b4('0x1c')](_0x5bdac3)&&this[_0x22b4('0x1c')](_0x5bdac3['peerstatus'])){logger[_0x22b4('0x1e')](_0x22b4('0x3c'),_0x5bdac3[_0x22b4('0x3d')],_0x5bdac3['address'],_0x5bdac3[_0x22b4('0x3e')]);logger[_0x22b4('0x21')]('[userReport][peerstatus]',util[_0x22b4('0x17')](_0x5bdac3,{'showHidden':![],'depth':null}));if(this[_0x22b4('0xb')][_0x5bdac3[_0x22b4('0x3d')]]){if(!this[_0x22b4('0xb')][_0x5bdac3[_0x22b4('0x3d')]][_0x22b4('0x2f')]||_0x5bdac3[_0x22b4('0x3e')]['toLowerCase']()=='registered'){this['agents'][_0x5bdac3[_0x22b4('0x3d')]][_0x22b4('0x2f')]=![];this[_0x22b4('0xb')][_0x5bdac3[_0x22b4('0x3d')]][_0x22b4('0x3f')]=_0x5bdac3[_0x22b4('0x3e')][_0x22b4('0x30')]();this[_0x22b4('0xb')][_0x5bdac3[_0x22b4('0x3d')]][_0x22b4('0x40')]=_0x5bdac3[_0x22b4('0x40')];this[_0x22b4('0xb')][_0x5bdac3[_0x22b4('0x3d')]][_0x22b4('0x32')](_0x5bdac3);}}else if(this[_0x22b4('0xc')][_0x5bdac3[_0x22b4('0x3d')]]){this[_0x22b4('0xc')][_0x5bdac3[_0x22b4('0x3d')]][_0x22b4('0x3f')]=_0x5bdac3[_0x22b4('0x3e')][_0x22b4('0x30')]();this[_0x22b4('0xc')][_0x5bdac3[_0x22b4('0x3d')]][_0x22b4('0x40')]=_0x5bdac3[_0x22b4('0x40')];logger[_0x22b4('0x21')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x22b4('0x17')](this[_0x22b4('0xc')][_0x5bdac3[_0x22b4('0x3d')]],{'showHidden':![],'depth':null}));this[_0x22b4('0x1d')](util[_0x22b4('0x27')](_0x22b4('0x35'),this['telephones'][_0x5bdac3[_0x22b4('0x3d')]][_0x22b4('0x29')]),_0x22b4('0x41'),this[_0x22b4('0xc')][_0x5bdac3['peer']]);}else if(this[_0x22b4('0xa')][_0x5bdac3[_0x22b4('0x3d')]]){this[_0x22b4('0xa')][_0x5bdac3[_0x22b4('0x3d')]][_0x22b4('0x3f')]=_0x5bdac3[_0x22b4('0x3e')]['toLowerCase']();this['trunks'][_0x5bdac3['peer']][_0x22b4('0x40')]=_0x5bdac3[_0x22b4('0x40')];logger[_0x22b4('0x21')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util['inspect'](this['trunks'][_0x5bdac3[_0x22b4('0x3d')]],{'showHidden':![],'depth':null}));this[_0x22b4('0x1d')](util[_0x22b4('0x27')](_0x22b4('0x28'),this['trunks'][_0x5bdac3[_0x22b4('0x3d')]]['name']),_0x22b4('0x2a'),this['trunks'][_0x5bdac3[_0x22b4('0x3d')]]);}}}catch(_0x1d9d02){logger[_0x22b4('0x15')](_0x22b4('0x42'),util['inspect'](_0x1d9d02,{'showHidden':![],'depth':null}));}};module[_0x22b4('0x43')]=UserReport; \ No newline at end of file +var _0xf933=['device','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','substring','indexOf','phone','local','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','exports','lodash','moment','util','../../../config/environment','ami','../ami','redis','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncRealtimeShow','resolve','then','catch','error','[userReport][sipshowregistry]','actionDeviceStateList','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','omit','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s'];(function(_0x26e2f4,_0x7fdf9){var _0x472524=function(_0x5e5b0b){while(--_0x5e5b0b){_0x26e2f4['push'](_0x26e2f4['shift']());}};_0x472524(++_0x7fdf9);}(_0xf933,0x17b));var _0x3f93=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0xf933[_0x409deb];return _0x15a4f7;};'use strict';var _=require(_0x3f93('0x0'));var moment=require(_0x3f93('0x1'));var util=require(_0x3f93('0x2'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x3f93('0x3'));var logger=require('../../../config/logger')(_0x3f93('0x4'));var ami=require(_0x3f93('0x5'));config[_0x3f93('0x6')]=_['defaults'](config[_0x3f93('0x6')],{'host':_0x3f93('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3f93('0x6')]));function UserReport(_0x34e72b){this[_0x3f93('0x8')]=_0x34e72b[_0x3f93('0x8')];this[_0x3f93('0x9')]=_0x34e72b[_0x3f93('0x9')];this[_0x3f93('0xa')]=_0x34e72b['telephones'];ami['on'](_0x3f93('0xb'),this[_0x3f93('0xc')][_0x3f93('0xd')](this));ami['on'](_0x3f93('0xe'),this['syncRegistry']['bind'](this));ami['on'](_0x3f93('0xf'),this[_0x3f93('0x10')][_0x3f93('0xd')](this));ami['on'](_0x3f93('0x11'),this['syncPeerStatus'][_0x3f93('0xd')](this));return this[_0x3f93('0x12')]();}function showSipRegistrations(){Promise[_0x3f93('0x13')]()[_0x3f93('0x14')](ami['actionSipShowRegistry']())[_0x3f93('0x15')](function(_0x1c2d8a){logger[_0x3f93('0x16')](_0x3f93('0x17'),util['inspect'](_0x1c2d8a,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()['then'](ami[_0x3f93('0x18')]())[_0x3f93('0x15')](function(_0x2965a4){logger['error']('[userReport][devicestatelist]',util[_0x3f93('0x19')](_0x2965a4,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x3f93('0x13')]()['then'](ami[_0x3f93('0x1a')]())[_0x3f93('0x15')](function(_0x4bb962){logger[_0x3f93('0x16')](_0x3f93('0x1b'),util['inspect'](_0x4bb962,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x3f93('0x13')]()['then'](showSipRegistrations())[_0x3f93('0x14')](listDeviceStates())[_0x3f93('0x14')](showPeersStatus());},0x32c8);};UserReport[_0x3f93('0x1c')][_0x3f93('0x1d')]=function(_0x2cb56d){return _0x2cb56d!==null&&!_[_0x3f93('0x1e')](_0x2cb56d);};UserReport[_0x3f93('0x1c')][_0x3f93('0x1f')]=function(_0xf9b900,_0x2aaf5b,_0x2d3f99){io['to'](_0xf9b900)['emit'](_0x2aaf5b,_0x2d3f99);};UserReport[_0x3f93('0x1c')]['syncRegistry']=function(_0x3d5585){try{if(this[_0x3f93('0x1d')](_0x3d5585)){logger[_0x3f93('0x20')](_0x3f93('0x21'),_0x3d5585[_0x3f93('0x22')],_0x3d5585[_0x3f93('0x23')]);logger[_0x3f93('0x24')](_0x3f93('0x25'),util[_0x3f93('0x19')](_0x3d5585,{'showHidden':![],'depth':null}));var _0x124b91=_[_0x3f93('0x26')](this['trunks'],{'defaultuser':_0x3d5585['username']});if(_0x124b91){_0x3d5585[_0x3f93('0x27')]=_0x3d5585['state'];_['merge'](_0x124b91,_[_0x3f93('0x28')](_0x3d5585,['event',_0x3f93('0x29'),_0x3f93('0x22'),_0x3f93('0x23')]));logger[_0x3f93('0x24')](_0x3f93('0x2a'),util[_0x3f93('0x19')](_0x124b91,{'showHidden':![],'depth':null}));this['emit'](util[_0x3f93('0x2b')]('trunk:%s',_0x124b91[_0x3f93('0x2c')]),_0x3f93('0x2d'),_0x124b91);}}}catch(_0x382d9b){logger[_0x3f93('0x16')](_0x3f93('0x25'),util[_0x3f93('0x19')](_0x382d9b,{'showHidden':![],'depth':null}));}};UserReport[_0x3f93('0x1c')]['syncDeviceState']=function(_0x3f623d){try{if(this[_0x3f93('0x1d')](_0x3f623d)){logger[_0x3f93('0x20')](_0x3f93('0x2e'),_0x3f623d[_0x3f93('0x2f')],_0x3f623d[_0x3f93('0x23')]);logger[_0x3f93('0x24')]('[userReport][devicestatechange]',util[_0x3f93('0x19')](_0x3f623d,{'showHidden':![],'depth':null}));if(this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]]){if(!this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]]['local']||_0x3f623d['state'][_0x3f93('0x30')]()==_0x3f93('0x31')){this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]]['local']=![];if(this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]]['state']!==_0x3f623d[_0x3f93('0x23')][_0x3f93('0x30')]()){this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x32')]=_[_0x3f93('0x33')](moment()[_0x3f93('0x2b')]('x'));}this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x23')]=_0x3f623d[_0x3f93('0x23')][_0x3f93('0x30')]();this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x34')](_0x3f623d);}}else if(this[_0x3f93('0xa')][_0x3f623d[_0x3f93('0x2f')]]){if(this[_0x3f93('0xa')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x23')]!==_0x3f623d[_0x3f93('0x23')][_0x3f93('0x30')]()){this[_0x3f93('0xa')][_0x3f623d[_0x3f93('0x2f')]]['stateTime']=_[_0x3f93('0x33')](moment()[_0x3f93('0x2b')]('x'));}this[_0x3f93('0xa')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x23')]=_0x3f623d[_0x3f93('0x23')]['toLowerCase']();logger[_0x3f93('0x24')](_0x3f93('0x35'),util[_0x3f93('0x19')](this['telephones'][_0x3f623d['device']],{'showHidden':![],'depth':null}));this[_0x3f93('0x1f')](util[_0x3f93('0x2b')](_0x3f93('0x36'),this[_0x3f93('0xa')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x2c')]),'telephone:save',this[_0x3f93('0xa')][_0x3f623d['device']]);}else if(this['trunks'][_0x3f623d[_0x3f93('0x2f')]]){if(this[_0x3f93('0x8')][_0x3f623d['device']]['state']!==_0x3f623d[_0x3f93('0x23')][_0x3f93('0x30')]()){this[_0x3f93('0x8')][_0x3f623d[_0x3f93('0x2f')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this['trunks'][_0x3f623d['device']][_0x3f93('0x23')]=_0x3f623d['state'][_0x3f93('0x30')]();logger[_0x3f93('0x24')](_0x3f93('0x37'),util[_0x3f93('0x19')](this[_0x3f93('0x8')][_0x3f623d[_0x3f93('0x2f')]],{'showHidden':![],'depth':null}));this[_0x3f93('0x1f')](util[_0x3f93('0x2b')]('trunk:%s',this[_0x3f93('0x8')][_0x3f623d['device']][_0x3f93('0x2c')]),_0x3f93('0x2d'),this[_0x3f93('0x8')][_0x3f623d['device']]);}else if(_[_0x3f93('0x38')](_0x3f623d[_0x3f93('0x2f')],'Local')){var _0x23e868=_0x3f623d[_0x3f93('0x2f')];var _0x99980f=_0x23e868[_0x3f93('0x39')](_0x23e868[_0x3f93('0x3a')]('/')+0x1,_0x23e868[_0x3f93('0x3a')]('@'));var _0x57ac99=_[_0x3f93('0x26')](this[_0x3f93('0x9')],function(_0xe51853){return _0xe51853['mobile']==_0x99980f||_0xe51853[_0x3f93('0x3b')]==_0x99980f||_0xe51853['accountcode']==_0x99980f;});if(_0x57ac99){if(_0x57ac99[_0x3f93('0x23')]!==_0x3f623d['state']['toLowerCase']()){_0x57ac99[_0x3f93('0x32')]=_['toNumber'](moment()[_0x3f93('0x2b')]('x'));}_0x57ac99['state']=_0x3f623d[_0x3f93('0x23')][_0x3f93('0x30')]();_0x57ac99[_0x3f93('0x3c')]=!![];_0x57ac99[_0x3f93('0x34')](_0x3f623d);}}}}catch(_0x4b38b5){logger[_0x3f93('0x16')]('[userReport][devicestatechange]',util[_0x3f93('0x19')](_0x4b38b5,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x3f93('0x3d')]=function(_0x4330cb){try{if(this[_0x3f93('0x1d')](_0x4330cb)&&this['isNotNull'](_0x4330cb[_0x3f93('0x11')])){logger[_0x3f93('0x20')](_0x3f93('0x3e'),_0x4330cb[_0x3f93('0x3f')],_0x4330cb[_0x3f93('0x40')],_0x4330cb[_0x3f93('0x11')]);logger[_0x3f93('0x24')](_0x3f93('0x41'),util['inspect'](_0x4330cb,{'showHidden':![],'depth':null}));if(this['agents'][_0x4330cb[_0x3f93('0x3f')]]){if(!this[_0x3f93('0x9')][_0x4330cb['peer']]['local']||_0x4330cb[_0x3f93('0x11')][_0x3f93('0x30')]()==_0x3f93('0x42')){this['agents'][_0x4330cb[_0x3f93('0x3f')]]['local']=![];this['agents'][_0x4330cb[_0x3f93('0x3f')]][_0x3f93('0x43')]=_0x4330cb['peerstatus'][_0x3f93('0x30')]();this[_0x3f93('0x9')][_0x4330cb[_0x3f93('0x3f')]][_0x3f93('0x40')]=_0x4330cb[_0x3f93('0x40')];this[_0x3f93('0x9')][_0x4330cb['peer']][_0x3f93('0x34')](_0x4330cb);}}else if(this['telephones'][_0x4330cb[_0x3f93('0x3f')]]){this[_0x3f93('0xa')][_0x4330cb[_0x3f93('0x3f')]][_0x3f93('0x43')]=_0x4330cb[_0x3f93('0x11')][_0x3f93('0x30')]();this[_0x3f93('0xa')][_0x4330cb['peer']]['address']=_0x4330cb[_0x3f93('0x40')];logger['debug'](_0x3f93('0x44'),util[_0x3f93('0x19')](this[_0x3f93('0xa')][_0x4330cb[_0x3f93('0x3f')]],{'showHidden':![],'depth':null}));this[_0x3f93('0x1f')](util[_0x3f93('0x2b')]('telephone:%s',this[_0x3f93('0xa')][_0x4330cb['peer']][_0x3f93('0x2c')]),_0x3f93('0x45'),this[_0x3f93('0xa')][_0x4330cb[_0x3f93('0x3f')]]);}else if(this['trunks'][_0x4330cb['peer']]){this[_0x3f93('0x8')][_0x4330cb['peer']][_0x3f93('0x43')]=_0x4330cb['peerstatus'][_0x3f93('0x30')]();this[_0x3f93('0x8')][_0x4330cb[_0x3f93('0x3f')]][_0x3f93('0x40')]=_0x4330cb[_0x3f93('0x40')];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x3f93('0x19')](this['trunks'][_0x4330cb[_0x3f93('0x3f')]],{'showHidden':![],'depth':null}));this[_0x3f93('0x1f')](util[_0x3f93('0x2b')]('trunk:%s',this[_0x3f93('0x8')][_0x4330cb[_0x3f93('0x3f')]][_0x3f93('0x2c')]),'trunk:save',this['trunks'][_0x4330cb[_0x3f93('0x3f')]]);}}}catch(_0x5ef731){logger[_0x3f93('0x16')]('[userReport][peerstatus]',util[_0x3f93('0x19')](_0x5ef731,{'showHidden':![],'depth':null}));}};module[_0x3f93('0x46')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 92939e8..d4faf40 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 _0x3096=['custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheremembername','answered_elsewhere','reason','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','variable','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','values','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','transfereruniqueid','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','moment','ioredis','../../../config/environment','../ami','defaults','redis','localhost','socket.io-emitter','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','debug','inspect','uniqueid','channels','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','inbound','merge','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:'];(function(_0x1bd1f2,_0x2601fd){var _0x3e39ea=function(_0x16683f){while(--_0x16683f){_0x1bd1f2['push'](_0x1bd1f2['shift']());}};_0x3e39ea(++_0x2601fd);}(_0x3096,0x192));var _0x6309=function(_0x2684aa,_0x12a7c5){_0x2684aa=_0x2684aa-0x0;var _0x26bb54=_0x3096[_0x2684aa];return _0x26bb54;};'use strict';var _=require('lodash');var moment=require(_0x6309('0x0'));var util=require('util');var Redis=require(_0x6309('0x1'));var config=require(_0x6309('0x2'));var logger=require('../../../config/logger')('ami');var ami=require(_0x6309('0x3'));config['redis']=_[_0x6309('0x4')](config[_0x6309('0x5')],{'host':_0x6309('0x6'),'port':0x18eb});var io=require(_0x6309('0x7'))(new Redis(config[_0x6309('0x5')]));function VoiceAgentReport(_0x1439c7){this['channels']={};this[_0x6309('0x8')]=_0x1439c7['voiceQueues'];this[_0x6309('0x9')]=_0x1439c7[_0x6309('0x9')];this[_0x6309('0xa')]={};ami['on'](_0x6309('0xb'),this[_0x6309('0xc')][_0x6309('0xd')](this));ami['on'](_0x6309('0xe'),this[_0x6309('0xf')]['bind'](this));ami['on'](_0x6309('0x10'),this['syncAgentRingNoAnswer'][_0x6309('0xd')](this));ami['on'](_0x6309('0x11'),this[_0x6309('0x12')][_0x6309('0xd')](this));ami['on'](_0x6309('0x13'),this[_0x6309('0x14')]['bind'](this));ami['on'](_0x6309('0x15'),this[_0x6309('0x16')][_0x6309('0xd')](this));ami['on'](_0x6309('0x17'),this['syncHangup'][_0x6309('0xd')](this));ami['on'](_0x6309('0x18'),this[_0x6309('0x19')][_0x6309('0xd')](this));ami['on'](_0x6309('0x1a'),this['syncMusicOnHoldStop'][_0x6309('0xd')](this));ami['on']('attendedtransfer',this[_0x6309('0x1b')]['bind'](this));ami['on'](_0x6309('0x1c'),this[_0x6309('0x1d')][_0x6309('0xd')](this));}VoiceAgentReport[_0x6309('0x1e')][_0x6309('0x1f')]=function(_0x57f15c,_0xcbb411,_0x35eb83){io['to'](_0x57f15c)[_0x6309('0x1f')](_0xcbb411,_0x35eb83);};VoiceAgentReport[_0x6309('0x1e')][_0x6309('0x20')]=function(_0x10bd61){return _0x10bd61!==null&&!_[_0x6309('0x21')](_0x10bd61);};VoiceAgentReport['prototype']['syncAgentCalled']=function(_0x1b5024){try{if(this[_0x6309('0x20')](_0x1b5024)){logger['info'](_0x6309('0x22'),_0x1b5024['uniqueid'],_0x1b5024[_0x6309('0x23')],_0x1b5024['destuniqueid']);logger[_0x6309('0x24')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x1b5024['uniqueid'],util[_0x6309('0x25')](_0x1b5024,{'showHidden':![],'depth':null}));if(_[_0x6309('0x21')](this['channels'][_0x1b5024[_0x6309('0x26')]])){this[_0x6309('0x27')][_0x1b5024[_0x6309('0x26')]]={};}if(_['isUndefined'](this[_0x6309('0x27')][_0x1b5024[_0x6309('0x26')]][_0x1b5024[_0x6309('0x28')]])){this['channels'][_0x1b5024['uniqueid']][_0x1b5024[_0x6309('0x28')]]={'agentcalledAt':moment()[_0x6309('0x29')](_0x6309('0x2a')),'lastevent':_0x6309('0x2b'),'mandatoryDisposition':this[_0x6309('0x8')][_0x1b5024['queue']]?this[_0x6309('0x8')][_0x1b5024[_0x6309('0x2c')]][_0x6309('0x2d')]||![]:![],'type':this[_0x6309('0x8')][_0x1b5024[_0x6309('0x2c')]]?this[_0x6309('0x8')][_0x1b5024[_0x6309('0x2c')]]['type']||_0x6309('0x2e'):'inbound','variables':this[_0x6309('0xa')][_0x1b5024[_0x6309('0x26')]]};}_[_0x6309('0x2f')](this[_0x6309('0x27')][_0x1b5024[_0x6309('0x26')]][_0x1b5024['destuniqueid']],_['omit'](_0x1b5024,[_0x6309('0x30'),_0x6309('0x31')]));logger[_0x6309('0x24')](_0x6309('0x32'),_0x1b5024['uniqueid'],util[_0x6309('0x25')](this[_0x6309('0x27')][_0x1b5024[_0x6309('0x26')]][_0x1b5024[_0x6309('0x28')]],{'showHidden':![],'depth':null}));ami[_0x6309('0x1f')](_0x6309('0x33'),this['channels'][_0x1b5024[_0x6309('0x26')]][_0x1b5024[_0x6309('0x28')]]);logger[_0x6309('0x24')](_0x6309('0x34'),_0x1b5024[_0x6309('0x26')],util[_0x6309('0x25')](this[_0x6309('0x27')][_0x1b5024[_0x6309('0x26')]][_0x1b5024[_0x6309('0x28')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x6309('0x35'),_0x1b5024[_0x6309('0x23')]),_0x6309('0x36'),this[_0x6309('0x27')][_0x1b5024['uniqueid']][_0x1b5024[_0x6309('0x28')]]);}}catch(_0x1ba603){logger[_0x6309('0x37')](_0x6309('0x38'),_0x1b5024[_0x6309('0x26')],util[_0x6309('0x25')](_0x1ba603,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6309('0x1e')][_0x6309('0xf')]=function(_0x3a98ee){try{if(this[_0x6309('0x20')](_0x3a98ee)){if(this[_0x6309('0x27')][_0x3a98ee[_0x6309('0x26')]]){logger[_0x6309('0x24')](_0x6309('0x39'),_0x3a98ee[_0x6309('0x26')],util[_0x6309('0x25')](_0x3a98ee,{'showHidden':![],'depth':null}));for(var _0x42a76e in this['channels'][_0x3a98ee[_0x6309('0x26')]]){if(this[_0x6309('0x27')][_0x3a98ee['uniqueid']]['hasOwnProperty'](_0x42a76e)){if(_0x3a98ee[_0x6309('0x28')]===_0x42a76e){logger[_0x6309('0x3a')](_0x6309('0x3b'),_0x3a98ee[_0x6309('0x26')],_0x3a98ee[_0x6309('0x23')],_0x3a98ee[_0x6309('0x28')]);this[_0x6309('0x27')][_0x3a98ee['uniqueid']][_0x42a76e][_0x6309('0x3c')]=moment()[_0x6309('0x29')](_0x6309('0x2a'));this[_0x6309('0x27')][_0x3a98ee[_0x6309('0x26')]][_0x42a76e][_0x6309('0x3d')]=_0x3a98ee['connectedlinename'];this[_0x6309('0x27')][_0x3a98ee['uniqueid']][_0x42a76e]['connectedlinenum']=_0x3a98ee['connectedlinenum'];this[_0x6309('0x27')][_0x3a98ee[_0x6309('0x26')]][_0x42a76e]['destchannelstate']=_0x3a98ee[_0x6309('0x3e')];this[_0x6309('0x27')][_0x3a98ee[_0x6309('0x26')]][_0x42a76e]['destchannelstatedesc']=_0x3a98ee[_0x6309('0x3f')];this[_0x6309('0x27')][_0x3a98ee[_0x6309('0x26')]][_0x42a76e][_0x6309('0x40')]=_0x3a98ee['holdtime'];this['channels'][_0x3a98ee['uniqueid']][_0x42a76e][_0x6309('0x41')]=_0x6309('0x42');_[_0x6309('0x2f')](this[_0x6309('0x9')][_0x3a98ee[_0x6309('0x43')]],_[_0x6309('0x44')](_0x3a98ee,['queue',_0x6309('0x45')]));logger[_0x6309('0x24')](_0x6309('0x46'),_0x3a98ee[_0x6309('0x26')],util[_0x6309('0x25')](this[_0x6309('0x27')][_0x3a98ee['uniqueid']][_0x3a98ee[_0x6309('0x28')]],{'showHidden':![],'depth':null}));ami[_0x6309('0x1f')](_0x6309('0x47'),this[_0x6309('0x27')][_0x3a98ee[_0x6309('0x26')]][_0x3a98ee['destuniqueid']]);logger['debug'](_0x6309('0x48'),_0x3a98ee['uniqueid'],util[_0x6309('0x25')](this[_0x6309('0x27')][_0x3a98ee[_0x6309('0x26')]][_0x3a98ee[_0x6309('0x28')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x6309('0x35'),_0x3a98ee[_0x6309('0x23')]),_0x6309('0x49'),this[_0x6309('0x27')][_0x3a98ee[_0x6309('0x26')]][_0x3a98ee[_0x6309('0x28')]]);}else if(!this[_0x6309('0x27')][_0x3a98ee['uniqueid']][_0x42a76e][_0x6309('0x10')]&&!this[_0x6309('0x27')][_0x3a98ee[_0x6309('0x26')]][_0x42a76e][_0x6309('0x13')]){logger[_0x6309('0x3a')](_0x6309('0x4a'),_0x3a98ee[_0x6309('0x26')],this['channels'][_0x3a98ee[_0x6309('0x26')]][_0x42a76e][_0x6309('0x23')],_0x42a76e);this['channels'][_0x3a98ee['uniqueid']][_0x42a76e]['agentringnoanswer']=!![];this[_0x6309('0x27')][_0x3a98ee[_0x6309('0x26')]][_0x42a76e]['agentringnoanswerAt']=moment()[_0x6309('0x29')](_0x6309('0x2a'));this[_0x6309('0x27')][_0x3a98ee['uniqueid']][_0x42a76e]['answeredelsewheredestinationuniqueid']=_0x3a98ee[_0x6309('0x28')];this[_0x6309('0x27')][_0x3a98ee['uniqueid']][_0x42a76e][_0x6309('0x4b')]=_0x3a98ee[_0x6309('0x23')];this[_0x6309('0x27')][_0x3a98ee[_0x6309('0x26')]][_0x42a76e]['lastevent']=_0x6309('0x4c');this[_0x6309('0x27')][_0x3a98ee[_0x6309('0x26')]][_0x42a76e][_0x6309('0x4d')]='answered_elsewhere';logger[_0x6309('0x24')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x3a98ee[_0x6309('0x26')],util['inspect'](this[_0x6309('0x27')][_0x3a98ee[_0x6309('0x26')]][_0x42a76e],{'showHidden':![],'depth':null}));ami[_0x6309('0x1f')](_0x6309('0x4e'),this['channels'][_0x3a98ee[_0x6309('0x26')]][_0x42a76e]);}}}}}}catch(_0x20ecef){logger[_0x6309('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x3a98ee[_0x6309('0x26')],util[_0x6309('0x25')](_0x20ecef,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6309('0x4f')]=function(_0x3719fc){try{if(this[_0x6309('0x20')](_0x3719fc)){logger[_0x6309('0x24')](_0x6309('0x50'),_0x3719fc[_0x6309('0x26')],util[_0x6309('0x25')](_0x3719fc,{'showHidden':![],'depth':null}));if(this[_0x6309('0x27')][_0x3719fc['uniqueid']]&&this['channels'][_0x3719fc['uniqueid']][_0x3719fc[_0x6309('0x28')]]){logger[_0x6309('0x3a')](_0x6309('0x51'),_0x3719fc[_0x6309('0x26')],_0x3719fc[_0x6309('0x23')],_0x3719fc[_0x6309('0x28')]);this[_0x6309('0x27')][_0x3719fc[_0x6309('0x26')]][_0x3719fc[_0x6309('0x28')]]['agentringnoanswer']=!![];this[_0x6309('0x27')][_0x3719fc[_0x6309('0x26')]][_0x3719fc[_0x6309('0x28')]][_0x6309('0x52')]=moment()[_0x6309('0x29')](_0x6309('0x2a'));this[_0x6309('0x27')][_0x3719fc[_0x6309('0x26')]][_0x3719fc[_0x6309('0x28')]]['lastevent']='rejected';this[_0x6309('0x27')][_0x3719fc[_0x6309('0x26')]][_0x3719fc[_0x6309('0x28')]][_0x6309('0x4d')]=_0x6309('0x53');logger['debug'](_0x6309('0x54'),_0x3719fc['uniqueid'],util['inspect'](this[_0x6309('0x27')][_0x3719fc['uniqueid']][_0x3719fc[_0x6309('0x28')]],{'showHidden':![],'depth':null}));ami['emit'](_0x6309('0x55'),this[_0x6309('0x27')][_0x3719fc[_0x6309('0x26')]][_0x3719fc[_0x6309('0x28')]]);}}}catch(_0x145403){logger[_0x6309('0x37')](_0x6309('0x56'),_0x3719fc['uniqueid'],util[_0x6309('0x25')](_0x145403,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6309('0x12')]=function(_0x213dae){try{if(this[_0x6309('0x20')](_0x213dae)){logger[_0x6309('0x24')](_0x6309('0x57'),_0x213dae[_0x6309('0x26')],util[_0x6309('0x25')](_0x213dae,{'showHidden':![],'depth':null}));if(this[_0x6309('0x27')][_0x213dae[_0x6309('0x26')]]){for(var _0x1199c6 in this['channels'][_0x213dae[_0x6309('0x26')]]){if(this[_0x6309('0x27')][_0x213dae[_0x6309('0x26')]][_0x6309('0x58')](_0x1199c6)&&!this[_0x6309('0x27')][_0x213dae[_0x6309('0x26')]][_0x1199c6][_0x6309('0x10')]&&!this[_0x6309('0x27')][_0x213dae['uniqueid']][_0x1199c6][_0x6309('0x13')]){logger[_0x6309('0x3a')](_0x6309('0x59'),_0x213dae[_0x6309('0x26')],this[_0x6309('0x27')][_0x213dae[_0x6309('0x26')]][_0x1199c6][_0x6309('0x23')],_0x1199c6);this[_0x6309('0x27')][_0x213dae[_0x6309('0x26')]][_0x1199c6][_0x6309('0x10')]=!![];this[_0x6309('0x27')][_0x213dae[_0x6309('0x26')]][_0x1199c6][_0x6309('0x52')]=moment()['format'](_0x6309('0x2a'));this['channels'][_0x213dae['uniqueid']][_0x1199c6][_0x6309('0x41')]=_0x6309('0x5a');this[_0x6309('0x27')][_0x213dae[_0x6309('0x26')]][_0x1199c6][_0x6309('0x4d')]=_0x6309('0x5a');logger[_0x6309('0x24')](_0x6309('0x5b'),_0x213dae[_0x6309('0x26')],util[_0x6309('0x25')](this['channels'][_0x213dae[_0x6309('0x26')]][_0x1199c6],{'showHidden':![],'depth':null}));ami['emit'](_0x6309('0x5c'),this[_0x6309('0x27')][_0x213dae['uniqueid']][_0x1199c6]);}}}}}catch(_0x2717a4){logger[_0x6309('0x37')](_0x6309('0x5d'),_0x213dae[_0x6309('0x26')],util['inspect'](_0x2717a4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6309('0x1e')][_0x6309('0x14')]=function(_0x5f288e){try{if(this[_0x6309('0x20')](_0x5f288e)){logger[_0x6309('0x24')](_0x6309('0x5e'),_0x5f288e[_0x6309('0x26')],util[_0x6309('0x25')](_0x5f288e,{'showHidden':![],'depth':null}));if(this[_0x6309('0x27')][_0x5f288e['uniqueid']]){for(var _0x592253 in this['channels'][_0x5f288e[_0x6309('0x26')]]){if(this[_0x6309('0x27')][_0x5f288e[_0x6309('0x26')]][_0x6309('0x58')](_0x592253)){if(this[_0x6309('0x27')][_0x5f288e[_0x6309('0x26')]][_0x592253][_0x6309('0x3c')]&&!this[_0x6309('0x27')][_0x5f288e[_0x6309('0x26')]][_0x592253][_0x6309('0x13')]){logger[_0x6309('0x3a')](_0x6309('0x5f'),_0x5f288e['uniqueid'],this[_0x6309('0x27')][_0x5f288e[_0x6309('0x26')]][_0x592253][_0x6309('0x23')],_0x592253);this[_0x6309('0x27')][_0x5f288e['uniqueid']][_0x592253][_0x6309('0x13')]=!![];this[_0x6309('0x27')][_0x5f288e[_0x6309('0x26')]][_0x592253][_0x6309('0x60')]=moment()[_0x6309('0x29')](_0x6309('0x2a'));this['channels'][_0x5f288e[_0x6309('0x26')]][_0x592253]['lastevent']=_0x6309('0x61');this[_0x6309('0x27')][_0x5f288e[_0x6309('0x26')]][_0x592253][_0x6309('0x4d')]=_0x5f288e[_0x6309('0x4d')]=='transfer'?_0x6309('0x62'):_0x5f288e[_0x6309('0x4d')];this[_0x6309('0x27')][_0x5f288e[_0x6309('0x26')]][_0x592253][_0x6309('0x63')]=_0x5f288e['talktime'];if(this[_0x6309('0x8')][_0x5f288e[_0x6309('0x2c')]]&&this['voiceQueues'][_0x5f288e[_0x6309('0x2c')]][_0x6309('0x64')]){this['channels'][_0x5f288e['uniqueid']][_0x592253][_0x6309('0x65')]=this[_0x6309('0x8')][_0x5f288e['queue']][_0x6309('0x66')];this[_0x6309('0x27')][_0x5f288e[_0x6309('0x26')]][_0x592253][_0x6309('0x67')]=!![];}this[_0x6309('0x9')][_0x5f288e[_0x6309('0x43')]]=_['omit'](this[_0x6309('0x9')][_0x5f288e[_0x6309('0x43')]],[_0x6309('0x2c'),_0x6309('0x45')]);logger[_0x6309('0x24')](_0x6309('0x68'),_0x5f288e[_0x6309('0x26')],util[_0x6309('0x25')](this['channels'][_0x5f288e['uniqueid']][_0x592253],{'showHidden':![],'depth':null}));ami[_0x6309('0x1f')](_0x6309('0x69'),this[_0x6309('0x27')][_0x5f288e['uniqueid']][_0x592253]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x5f288e['uniqueid'],util['inspect'](this[_0x6309('0x27')][_0x5f288e[_0x6309('0x26')]][_0x592253],{'showHidden':![],'depth':null}));this[_0x6309('0x1f')](util['format']('user:%s',_0x5f288e[_0x6309('0x23')]),'user:agentcomplete',this[_0x6309('0x27')][_0x5f288e[_0x6309('0x26')]][_0x592253]);}}}}}}catch(_0x3452ee){logger[_0x6309('0x37')](_0x6309('0x6a'),_0x5f288e[_0x6309('0x26')],util[_0x6309('0x25')](_0x3452ee,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x5f4a70){try{if(this[_0x6309('0x20')](_0x5f4a70)){logger[_0x6309('0x24')](_0x6309('0x6b'),_0x5f4a70[_0x6309('0x26')],util[_0x6309('0x25')](_0x5f4a70,{'showHidden':![],'depth':null}));this[_0x6309('0x6c')](_0x5f4a70[_0x6309('0x26')],_['keys'](_0x5f4a70['variable'])[0x0],_0x5f4a70[_0x6309('0x6d')]);if(this['channels'][_0x5f4a70[_0x6309('0x26')]]){for(var _0x3770dc in this['channels'][_0x5f4a70['uniqueid']]){if(this['channels'][_0x5f4a70['uniqueid']][_0x6309('0x58')](_0x3770dc)){logger[_0x6309('0x3a')](_0x6309('0x6e'),_0x5f4a70[_0x6309('0x26')],_0x3770dc,_[_0x6309('0x6f')](_0x5f4a70[_0x6309('0x70')])[0x0],_0x5f4a70['value']);if(_[_0x6309('0x21')](this[_0x6309('0x27')][_0x5f4a70['uniqueid']][_0x3770dc][_0x6309('0xa')])){this[_0x6309('0x27')][_0x5f4a70[_0x6309('0x26')]][_0x3770dc]['variables']={};}this['channels'][_0x5f4a70[_0x6309('0x26')]][_0x3770dc]['variables']=this[_0x6309('0xa')][_0x5f4a70['uniqueid']];}}}}}catch(_0x329d25){logger[_0x6309('0x37')](_0x6309('0x71'),_0x5f4a70['uniqueid'],util[_0x6309('0x25')](_0x329d25,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6309('0x6c')]=function(_0x48e110,_0x5f47eb,_0x5706ec){var _0xd51e9=[_0x6309('0x72'),'rtpaudioqosbridged',_0x6309('0x73'),_0x6309('0x74'),_0x6309('0x75'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x6309('0x76'),_0x6309('0x77'),'sipuri',_0x6309('0x78'),_0x6309('0x79'),'membercalls',_0x6309('0x7a'),'memberinterface',_0x6309('0x7b'),_0x6309('0x23'),_0x6309('0x7c'),_0x6309('0x7d')];if(!_[_0x6309('0x7e')](_0x5f47eb)&&!_['includes'](_0xd51e9,_0x5f47eb)){if(_[_0x6309('0x21')](this[_0x6309('0xa')][_0x48e110])){this[_0x6309('0xa')][_0x48e110]={};}this[_0x6309('0xa')][_0x48e110][_0x5f47eb]=_0x5706ec;}};VoiceAgentReport[_0x6309('0x1e')][_0x6309('0x7f')]=function(_0x50a742){try{if(this['isNotNull'](_0x50a742)){logger[_0x6309('0x24')](_0x6309('0x80'),_0x50a742[_0x6309('0x26')],util['inspect'](_0x50a742,{'showHidden':![],'depth':null}));if(this[_0x6309('0x27')][_0x50a742[_0x6309('0x26')]]){for(var _0x1155db in this[_0x6309('0x27')][_0x50a742[_0x6309('0x26')]]){if(this[_0x6309('0x27')][_0x50a742['uniqueid']]['hasOwnProperty'](_0x1155db)){if(this[_0x6309('0x27')][_0x50a742[_0x6309('0x26')]][_0x1155db][_0x6309('0x4d')]==_0x6309('0x81')&&this[_0x6309('0x27')][_0x50a742[_0x6309('0x26')]][_0x1155db]['agentcomplete']){logger[_0x6309('0x3a')](_0x6309('0x82'),_0x50a742['uniqueid'],_0x1155db);this[_0x6309('0x27')][_0x50a742[_0x6309('0x26')]][_0x1155db]['agentcompleteAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x6309('0x24')](_0x6309('0x83'),_0x50a742['uniqueid'],util[_0x6309('0x25')](_['values'](this[_0x6309('0x27')][_0x50a742['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x6309('0x1f')](_0x6309('0x84'),_[_0x6309('0x85')](this['channels'][_0x50a742[_0x6309('0x26')]]));delete this['channels'][_0x50a742[_0x6309('0x26')]];}if(this[_0x6309('0xa')][_0x50a742[_0x6309('0x26')]]){delete this['variables'][_0x50a742[_0x6309('0x26')]];}}}catch(_0x436bc8){logger['error']('[%s][voiceAgentReport][hangup]',_0x50a742['uniqueid'],util[_0x6309('0x25')](_0x436bc8,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6309('0x1b')]=function(_0x5b34e5){try{if(this[_0x6309('0x20')](_0x5b34e5)){logger[_0x6309('0x24')](_0x6309('0x86'),_0x5b34e5['uniqueid'],util['inspect'](_0x5b34e5,{'showHidden':![],'depth':null}));if(this[_0x6309('0x27')][_0x5b34e5[_0x6309('0x87')]]){for(var _0x139178 in this[_0x6309('0x27')][_0x5b34e5[_0x6309('0x87')]]){if(this[_0x6309('0x27')][_0x5b34e5[_0x6309('0x87')]][_0x6309('0x58')](_0x139178)){if(_0x5b34e5[_0x6309('0x88')]===_0x139178){logger[_0x6309('0x3a')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5b34e5[_0x6309('0x26')],this[_0x6309('0x27')][_0x5b34e5[_0x6309('0x87')]][_0x139178][_0x6309('0x23')],_0x139178);var _0x17a7f9=moment();this['channels'][_0x5b34e5[_0x6309('0x87')]][_0x139178][_0x6309('0x13')]=!![];this[_0x6309('0x27')][_0x5b34e5[_0x6309('0x87')]][_0x139178][_0x6309('0x60')]=moment()[_0x6309('0x29')](_0x6309('0x2a'));this[_0x6309('0x27')][_0x5b34e5[_0x6309('0x87')]][_0x139178][_0x6309('0x41')]='complete';this['channels'][_0x5b34e5['transfereeuniqueid']][_0x139178][_0x6309('0x4d')]=_0x6309('0x81');this['channels'][_0x5b34e5[_0x6309('0x87')]][_0x139178][_0x6309('0x63')]=_0x17a7f9[_0x6309('0x89')](this[_0x6309('0x27')][_0x5b34e5['transfereeuniqueid']][_0x139178][_0x6309('0x3c')],_0x6309('0x8a'));}}}}if(this['channels'][_0x5b34e5[_0x6309('0x8b')]]){var _0x172c43=this[_0x6309('0x27')][_0x5b34e5[_0x6309('0x8b')]];this[_0x6309('0x27')][_0x5b34e5[_0x6309('0x8b')]]=this[_0x6309('0x27')][_0x5b34e5[_0x6309('0x87')]];this[_0x6309('0x27')][_0x5b34e5[_0x6309('0x87')]]=_0x172c43;}}}catch(_0x42e1f2){logger[_0x6309('0x37')]('[%s][voiceAgentReport][attendedtransfer]',_0x5b34e5[_0x6309('0x26')],util[_0x6309('0x25')](_0x42e1f2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6309('0x1e')][_0x6309('0x1d')]=function(_0x382215){try{if(this[_0x6309('0x20')](_0x382215)){logger['debug']('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x382215['uniqueid'],util[_0x6309('0x25')](_0x382215,{'showHidden':![],'depth':null}));if(this[_0x6309('0x27')][_0x382215[_0x6309('0x87')]]){for(var _0xe2698f in this['channels'][_0x382215[_0x6309('0x87')]]){if(this[_0x6309('0x27')][_0x382215[_0x6309('0x87')]]['hasOwnProperty'](_0xe2698f)){if(_0x382215[_0x6309('0x8c')]===_0xe2698f){logger['info']('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x382215[_0x6309('0x26')],this[_0x6309('0x27')][_0x382215[_0x6309('0x87')]][_0xe2698f]['membername'],_0xe2698f);var _0x152462=moment();this['channels'][_0x382215[_0x6309('0x87')]][_0xe2698f]['agentcomplete']=!![];this[_0x6309('0x27')][_0x382215[_0x6309('0x87')]][_0xe2698f][_0x6309('0x60')]=_0x152462;this[_0x6309('0x27')][_0x382215[_0x6309('0x87')]][_0xe2698f][_0x6309('0x41')]='complete';this['channels'][_0x382215[_0x6309('0x87')]][_0xe2698f]['reason']='transfer';this[_0x6309('0x27')][_0x382215[_0x6309('0x87')]][_0xe2698f][_0x6309('0x63')]=_0x152462[_0x6309('0x89')](this[_0x6309('0x27')][_0x382215[_0x6309('0x87')]][_0xe2698f][_0x6309('0x3c')],_0x6309('0x8a'));}}}}}}catch(_0x1d356f){logger[_0x6309('0x37')]('[%s][voiceAgentReport][blindtransfer]',_0x382215[_0x6309('0x26')],util['inspect'](_0x1d356f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6309('0x1e')][_0x6309('0x19')]=function(_0x3fe589){var _0x3da10a='';try{if(this[_0x6309('0x20')](_0x3fe589)){logger[_0x6309('0x24')](_0x6309('0x8d'),_0x3fe589['uniqueid'],util['inspect'](_0x3fe589,{'showHidden':![],'depth':null}));if(_0x3fe589[_0x6309('0x8e')]){_0x3da10a=_0x3fe589[_0x6309('0x8e')]['substring'](0x0,_0x3fe589[_0x6309('0x8e')]['lastIndexOf']('-'));if(this[_0x6309('0x9')][_0x3da10a]){logger[_0x6309('0x3a')](_0x6309('0x8f'),_0x3fe589['uniqueid'],_0x3da10a);this[_0x6309('0x9')][_0x3da10a][_0x6309('0x90')]=!![];}}}}catch(_0x57960f){logger[_0x6309('0x37')](_0x6309('0x91'),_0x3fe589[_0x6309('0x26')],util[_0x6309('0x25')](_0x57960f,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6309('0x92')]=function(_0x5eb248){var _0x1afdcd='';try{if(this[_0x6309('0x20')](_0x5eb248)){logger['debug'](_0x6309('0x93'),_0x5eb248[_0x6309('0x26')],util[_0x6309('0x25')](_0x5eb248,{'showHidden':![],'depth':null}));if(_0x5eb248[_0x6309('0x8e')]){_0x1afdcd=_0x5eb248['channel']['substring'](0x0,_0x5eb248[_0x6309('0x8e')][_0x6309('0x94')]('-'));if(this[_0x6309('0x9')][_0x1afdcd]){logger[_0x6309('0x3a')](_0x6309('0x95'),_0x5eb248['uniqueid'],_0x1afdcd);this[_0x6309('0x9')][_0x1afdcd][_0x6309('0x90')]=![];}}}}catch(_0x260d70){logger[_0x6309('0x37')](_0x6309('0x96'),_0x5eb248[_0x6309('0x26')],util[_0x6309('0x25')](_0x260d70,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x7907=['[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','moment','ioredis','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','isUndefined','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','event','privilege','custom:agentcalled','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','merge','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcomplete','agentcompleteAt','transfer','talktime','acw','acwTimeout','agentacw','omit','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','reason','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','seconds','secondtransfereruniqueid','syncBlindTransfer','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','syncMusicOnHoldStop'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0x7907,0x12d));var _0x7790=function(_0x37c4bb,_0x35760d){_0x37c4bb=_0x37c4bb-0x0;var _0x20d01e=_0x7907[_0x37c4bb];return _0x20d01e;};'use strict';var _=require('lodash');var moment=require(_0x7790('0x0'));var util=require('util');var Redis=require(_0x7790('0x1'));var config=require('../../../config/environment');var logger=require(_0x7790('0x2'))(_0x7790('0x3'));var ami=require('../ami');config[_0x7790('0x4')]=_[_0x7790('0x5')](config[_0x7790('0x4')],{'host':_0x7790('0x6'),'port':0x18eb});var io=require(_0x7790('0x7'))(new Redis(config[_0x7790('0x4')]));function VoiceAgentReport(_0x18f3cf){this[_0x7790('0x8')]={};this[_0x7790('0x9')]=_0x18f3cf[_0x7790('0x9')];this[_0x7790('0xa')]=_0x18f3cf[_0x7790('0xa')];this[_0x7790('0xb')]={};ami['on'](_0x7790('0xc'),this[_0x7790('0xd')][_0x7790('0xe')](this));ami['on']('agentconnect',this[_0x7790('0xf')][_0x7790('0xe')](this));ami['on'](_0x7790('0x10'),this['syncAgentRingNoAnswer'][_0x7790('0xe')](this));ami['on'](_0x7790('0x11'),this['syncQueueCallerAbandon']['bind'](this));ami['on']('agentcomplete',this[_0x7790('0x12')][_0x7790('0xe')](this));ami['on'](_0x7790('0x13'),this[_0x7790('0x14')]['bind'](this));ami['on'](_0x7790('0x15'),this[_0x7790('0x16')][_0x7790('0xe')](this));ami['on'](_0x7790('0x17'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x7790('0x18'),this['syncMusicOnHoldStop'][_0x7790('0xe')](this));ami['on'](_0x7790('0x19'),this[_0x7790('0x1a')][_0x7790('0xe')](this));ami['on'](_0x7790('0x1b'),this['syncBlindTransfer'][_0x7790('0xe')](this));}VoiceAgentReport[_0x7790('0x1c')][_0x7790('0x1d')]=function(_0x4c81bd,_0x8c62ca,_0x2f40b9){io['to'](_0x4c81bd)[_0x7790('0x1d')](_0x8c62ca,_0x2f40b9);};VoiceAgentReport[_0x7790('0x1c')][_0x7790('0x1e')]=function(_0x5d75e0){return _0x5d75e0!==null&&!_['isUndefined'](_0x5d75e0);};VoiceAgentReport['prototype'][_0x7790('0xd')]=function(_0x511521){try{if(this['isNotNull'](_0x511521)){logger[_0x7790('0x1f')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x511521['uniqueid'],_0x511521[_0x7790('0x20')],_0x511521[_0x7790('0x21')]);logger[_0x7790('0x22')](_0x7790('0x23'),_0x511521['uniqueid'],util[_0x7790('0x24')](_0x511521,{'showHidden':![],'depth':null}));if(_[_0x7790('0x25')](this[_0x7790('0x8')][_0x511521[_0x7790('0x26')]])){this[_0x7790('0x8')][_0x511521[_0x7790('0x26')]]={};}if(_[_0x7790('0x25')](this['channels'][_0x511521[_0x7790('0x26')]][_0x511521[_0x7790('0x21')]])){this[_0x7790('0x8')][_0x511521['uniqueid']][_0x511521[_0x7790('0x21')]]={'agentcalledAt':moment()[_0x7790('0x27')](_0x7790('0x28')),'lastevent':_0x7790('0x29'),'mandatoryDisposition':this['voiceQueues'][_0x511521[_0x7790('0x2a')]]?this['voiceQueues'][_0x511521[_0x7790('0x2a')]][_0x7790('0x2b')]||![]:![],'type':this[_0x7790('0x9')][_0x511521[_0x7790('0x2a')]]?this[_0x7790('0x9')][_0x511521[_0x7790('0x2a')]][_0x7790('0x2c')]||_0x7790('0x2d'):_0x7790('0x2d'),'variables':this[_0x7790('0xb')][_0x511521[_0x7790('0x26')]]};}_['merge'](this['channels'][_0x511521['uniqueid']][_0x511521[_0x7790('0x21')]],_['omit'](_0x511521,[_0x7790('0x2e'),_0x7790('0x2f')]));logger[_0x7790('0x22')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x511521[_0x7790('0x26')],util['inspect'](this['channels'][_0x511521[_0x7790('0x26')]][_0x511521[_0x7790('0x21')]],{'showHidden':![],'depth':null}));ami[_0x7790('0x1d')](_0x7790('0x30'),this['channels'][_0x511521['uniqueid']][_0x511521[_0x7790('0x21')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x511521[_0x7790('0x26')],util['inspect'](this[_0x7790('0x8')][_0x511521[_0x7790('0x26')]][_0x511521[_0x7790('0x21')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x7790('0x27')]('user:%s',_0x511521[_0x7790('0x20')]),_0x7790('0x31'),this[_0x7790('0x8')][_0x511521['uniqueid']][_0x511521[_0x7790('0x21')]]);}}catch(_0x4b1473){logger[_0x7790('0x32')](_0x7790('0x33'),_0x511521['uniqueid'],util[_0x7790('0x24')](_0x4b1473,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7790('0xf')]=function(_0x44def2){try{if(this[_0x7790('0x1e')](_0x44def2)){if(this['channels'][_0x44def2[_0x7790('0x26')]]){logger['debug'](_0x7790('0x34'),_0x44def2[_0x7790('0x26')],util['inspect'](_0x44def2,{'showHidden':![],'depth':null}));for(var _0x58fd42 in this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]]){if(this['channels'][_0x44def2['uniqueid']][_0x7790('0x35')](_0x58fd42)){if(_0x44def2['destuniqueid']===_0x58fd42){logger[_0x7790('0x1f')](_0x7790('0x36'),_0x44def2[_0x7790('0x26')],_0x44def2['membername'],_0x44def2[_0x7790('0x21')]);this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x37')]=moment()[_0x7790('0x27')](_0x7790('0x28'));this['channels'][_0x44def2['uniqueid']][_0x58fd42][_0x7790('0x38')]=_0x44def2[_0x7790('0x38')];this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x39')]=_0x44def2['connectedlinenum'];this['channels'][_0x44def2['uniqueid']][_0x58fd42][_0x7790('0x3a')]=_0x44def2[_0x7790('0x3a')];this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x3b')]=_0x44def2[_0x7790('0x3b')];this['channels'][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x3c')]=_0x44def2[_0x7790('0x3c')];this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x3d')]=_0x7790('0x3e');_[_0x7790('0x3f')](this[_0x7790('0xa')][_0x44def2[_0x7790('0x40')]],_[_0x7790('0x41')](_0x44def2,[_0x7790('0x2a'),_0x7790('0x42')]));logger[_0x7790('0x22')](_0x7790('0x43'),_0x44def2[_0x7790('0x26')],util['inspect'](this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x44def2['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x7790('0x1d')](_0x7790('0x44'),this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x44def2[_0x7790('0x21')]]);logger[_0x7790('0x22')](_0x7790('0x45'),_0x44def2[_0x7790('0x26')],util['inspect'](this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x44def2[_0x7790('0x21')]],{'showHidden':![],'depth':null}));this[_0x7790('0x1d')](util[_0x7790('0x27')](_0x7790('0x46'),_0x44def2['membername']),_0x7790('0x47'),this['channels'][_0x44def2['uniqueid']][_0x44def2[_0x7790('0x21')]]);}else if(!this['channels'][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x10')]&&!this['channels'][_0x44def2[_0x7790('0x26')]][_0x58fd42]['agentcomplete']){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x44def2[_0x7790('0x26')],this['channels'][_0x44def2[_0x7790('0x26')]][_0x58fd42]['membername'],_0x58fd42);this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42]['agentringnoanswer']=!![];this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x48')]=moment()['format'](_0x7790('0x28'));this['channels'][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x49')]=_0x44def2[_0x7790('0x21')];this[_0x7790('0x8')][_0x44def2['uniqueid']][_0x58fd42][_0x7790('0x4a')]=_0x44def2[_0x7790('0x20')];this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x3d')]=_0x7790('0x4b');this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42]['reason']=_0x7790('0x4b');logger[_0x7790('0x22')](_0x7790('0x4c'),_0x44def2[_0x7790('0x26')],util[_0x7790('0x24')](this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42],{'showHidden':![],'depth':null}));ami['emit'](_0x7790('0x4d'),this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42]);}}}}}}catch(_0x505d7d){logger[_0x7790('0x32')](_0x7790('0x4e'),_0x44def2[_0x7790('0x26')],util[_0x7790('0x24')](_0x505d7d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7790('0x1c')][_0x7790('0x4f')]=function(_0x46fea1){try{if(this[_0x7790('0x1e')](_0x46fea1)){logger[_0x7790('0x22')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x46fea1[_0x7790('0x26')],util[_0x7790('0x24')](_0x46fea1,{'showHidden':![],'depth':null}));if(this[_0x7790('0x8')][_0x46fea1[_0x7790('0x26')]]&&this[_0x7790('0x8')][_0x46fea1['uniqueid']][_0x46fea1[_0x7790('0x21')]]){logger['info'](_0x7790('0x50'),_0x46fea1[_0x7790('0x26')],_0x46fea1[_0x7790('0x20')],_0x46fea1['destuniqueid']);this[_0x7790('0x8')][_0x46fea1['uniqueid']][_0x46fea1['destuniqueid']][_0x7790('0x10')]=!![];this[_0x7790('0x8')][_0x46fea1[_0x7790('0x26')]][_0x46fea1['destuniqueid']][_0x7790('0x48')]=moment()[_0x7790('0x27')](_0x7790('0x28'));this[_0x7790('0x8')][_0x46fea1[_0x7790('0x26')]][_0x46fea1[_0x7790('0x21')]]['lastevent']=_0x7790('0x51');this[_0x7790('0x8')][_0x46fea1[_0x7790('0x26')]][_0x46fea1['destuniqueid']]['reason']=_0x7790('0x51');logger[_0x7790('0x22')](_0x7790('0x52'),_0x46fea1['uniqueid'],util[_0x7790('0x24')](this[_0x7790('0x8')][_0x46fea1['uniqueid']][_0x46fea1[_0x7790('0x21')]],{'showHidden':![],'depth':null}));ami[_0x7790('0x1d')]('custom:agentringnoanswer',this[_0x7790('0x8')][_0x46fea1['uniqueid']][_0x46fea1[_0x7790('0x21')]]);}}}catch(_0x82f533){logger[_0x7790('0x32')](_0x7790('0x53'),_0x46fea1[_0x7790('0x26')],util['inspect'](_0x82f533,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7790('0x1c')][_0x7790('0x54')]=function(_0x280d06){try{if(this[_0x7790('0x1e')](_0x280d06)){logger[_0x7790('0x22')](_0x7790('0x55'),_0x280d06[_0x7790('0x26')],util['inspect'](_0x280d06,{'showHidden':![],'depth':null}));if(this[_0x7790('0x8')][_0x280d06[_0x7790('0x26')]]){for(var _0x367161 in this[_0x7790('0x8')][_0x280d06[_0x7790('0x26')]]){if(this[_0x7790('0x8')][_0x280d06[_0x7790('0x26')]][_0x7790('0x35')](_0x367161)&&!this[_0x7790('0x8')][_0x280d06[_0x7790('0x26')]][_0x367161][_0x7790('0x10')]&&!this[_0x7790('0x8')][_0x280d06['uniqueid']][_0x367161]['agentcomplete']){logger[_0x7790('0x1f')](_0x7790('0x56'),_0x280d06[_0x7790('0x26')],this['channels'][_0x280d06[_0x7790('0x26')]][_0x367161][_0x7790('0x20')],_0x367161);this[_0x7790('0x8')][_0x280d06[_0x7790('0x26')]][_0x367161][_0x7790('0x10')]=!![];this[_0x7790('0x8')][_0x280d06[_0x7790('0x26')]][_0x367161]['agentringnoanswerAt']=moment()['format'](_0x7790('0x28'));this['channels'][_0x280d06[_0x7790('0x26')]][_0x367161][_0x7790('0x3d')]='abandoned';this[_0x7790('0x8')][_0x280d06[_0x7790('0x26')]][_0x367161]['reason']=_0x7790('0x57');logger[_0x7790('0x22')](_0x7790('0x58'),_0x280d06[_0x7790('0x26')],util['inspect'](this[_0x7790('0x8')][_0x280d06['uniqueid']][_0x367161],{'showHidden':![],'depth':null}));ami[_0x7790('0x1d')](_0x7790('0x59'),this[_0x7790('0x8')][_0x280d06[_0x7790('0x26')]][_0x367161]);}}}}}catch(_0x475a84){logger[_0x7790('0x32')](_0x7790('0x5a'),_0x280d06['uniqueid'],util['inspect'](_0x475a84,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7790('0x1c')]['syncAgentComplete']=function(_0x2481dd){try{if(this[_0x7790('0x1e')](_0x2481dd)){logger[_0x7790('0x22')](_0x7790('0x5b'),_0x2481dd[_0x7790('0x26')],util[_0x7790('0x24')](_0x2481dd,{'showHidden':![],'depth':null}));if(this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]]){for(var _0x49dd29 in this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]]){if(this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]]['hasOwnProperty'](_0x49dd29)){if(this[_0x7790('0x8')][_0x2481dd['uniqueid']][_0x49dd29][_0x7790('0x37')]&&!this[_0x7790('0x8')][_0x2481dd['uniqueid']][_0x49dd29][_0x7790('0x5c')]){logger[_0x7790('0x1f')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2481dd[_0x7790('0x26')],this[_0x7790('0x8')][_0x2481dd['uniqueid']][_0x49dd29][_0x7790('0x20')],_0x49dd29);this[_0x7790('0x8')][_0x2481dd['uniqueid']][_0x49dd29][_0x7790('0x5c')]=!![];this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]][_0x49dd29][_0x7790('0x5d')]=moment()[_0x7790('0x27')](_0x7790('0x28'));this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]][_0x49dd29][_0x7790('0x3d')]='complete';this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]][_0x49dd29]['reason']=_0x2481dd['reason']==_0x7790('0x5e')?'agent':_0x2481dd['reason'];this['channels'][_0x2481dd[_0x7790('0x26')]][_0x49dd29][_0x7790('0x5f')]=_0x2481dd[_0x7790('0x5f')];if(this[_0x7790('0x9')][_0x2481dd[_0x7790('0x2a')]]&&this[_0x7790('0x9')][_0x2481dd[_0x7790('0x2a')]][_0x7790('0x60')]){this['channels'][_0x2481dd[_0x7790('0x26')]][_0x49dd29]['acwtime']=this[_0x7790('0x9')][_0x2481dd['queue']][_0x7790('0x61')];this[_0x7790('0x8')][_0x2481dd['uniqueid']][_0x49dd29][_0x7790('0x62')]=!![];}this[_0x7790('0xa')][_0x2481dd[_0x7790('0x40')]]=_[_0x7790('0x63')](this[_0x7790('0xa')][_0x2481dd[_0x7790('0x40')]],['queue',_0x7790('0x42')]);logger[_0x7790('0x22')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x2481dd['uniqueid'],util[_0x7790('0x24')](this[_0x7790('0x8')][_0x2481dd['uniqueid']][_0x49dd29],{'showHidden':![],'depth':null}));ami[_0x7790('0x1d')](_0x7790('0x64'),this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]][_0x49dd29]);logger[_0x7790('0x22')](_0x7790('0x65'),_0x2481dd[_0x7790('0x26')],util[_0x7790('0x24')](this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]][_0x49dd29],{'showHidden':![],'depth':null}));this[_0x7790('0x1d')](util[_0x7790('0x27')]('user:%s',_0x2481dd[_0x7790('0x20')]),_0x7790('0x66'),this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]][_0x49dd29]);}}}}}}catch(_0x3b0b85){logger[_0x7790('0x32')](_0x7790('0x67'),_0x2481dd[_0x7790('0x26')],util[_0x7790('0x24')](_0x3b0b85,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7790('0x1c')]['syncVarSet']=function(_0x5c4a0f){try{if(this[_0x7790('0x1e')](_0x5c4a0f)){logger[_0x7790('0x22')](_0x7790('0x68'),_0x5c4a0f[_0x7790('0x26')],util[_0x7790('0x24')](_0x5c4a0f,{'showHidden':![],'depth':null}));this[_0x7790('0x69')](_0x5c4a0f['uniqueid'],_[_0x7790('0x6a')](_0x5c4a0f[_0x7790('0x6b')])[0x0],_0x5c4a0f['value']);if(this[_0x7790('0x8')][_0x5c4a0f[_0x7790('0x26')]]){for(var _0x186e52 in this[_0x7790('0x8')][_0x5c4a0f[_0x7790('0x26')]]){if(this[_0x7790('0x8')][_0x5c4a0f[_0x7790('0x26')]][_0x7790('0x35')](_0x186e52)){logger[_0x7790('0x1f')](_0x7790('0x6c'),_0x5c4a0f[_0x7790('0x26')],_0x186e52,_['keys'](_0x5c4a0f[_0x7790('0x6b')])[0x0],_0x5c4a0f['value']);if(_['isUndefined'](this[_0x7790('0x8')][_0x5c4a0f[_0x7790('0x26')]][_0x186e52][_0x7790('0xb')])){this[_0x7790('0x8')][_0x5c4a0f[_0x7790('0x26')]][_0x186e52][_0x7790('0xb')]={};}this[_0x7790('0x8')][_0x5c4a0f[_0x7790('0x26')]][_0x186e52][_0x7790('0xb')]=this[_0x7790('0xb')][_0x5c4a0f['uniqueid']];}}}}}catch(_0x1b72e8){logger[_0x7790('0x32')]('[%s][voiceAgentReport][varset]',_0x5c4a0f['uniqueid'],util[_0x7790('0x24')](_0x1b72e8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7790('0x1c')]['addVariable']=function(_0x27f9ef,_0x4d7164,_0x23918e){var _0x48e260=[_0x7790('0x6d'),_0x7790('0x6e'),_0x7790('0x6f'),_0x7790('0x70'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged',_0x7790('0x71'),_0x7790('0x72'),_0x7790('0x73'),_0x7790('0x74'),_0x7790('0x75'),_0x7790('0x76'),_0x7790('0x77'),_0x7790('0x78'),'membername',_0x7790('0x79'),'memberrealtime'];if(!_[_0x7790('0x7a')](_0x4d7164)&&!_[_0x7790('0x7b')](_0x48e260,_0x4d7164)){if(_[_0x7790('0x25')](this['variables'][_0x27f9ef])){this[_0x7790('0xb')][_0x27f9ef]={};}this[_0x7790('0xb')][_0x27f9ef][_0x4d7164]=_0x23918e;}};VoiceAgentReport[_0x7790('0x1c')][_0x7790('0x16')]=function(_0x20a3b5){try{if(this[_0x7790('0x1e')](_0x20a3b5)){logger['debug']('[%s][voiceAgentReport][hangup]\x20event:',_0x20a3b5[_0x7790('0x26')],util[_0x7790('0x24')](_0x20a3b5,{'showHidden':![],'depth':null}));if(this[_0x7790('0x8')][_0x20a3b5[_0x7790('0x26')]]){for(var _0x2fb141 in this[_0x7790('0x8')][_0x20a3b5[_0x7790('0x26')]]){if(this['channels'][_0x20a3b5[_0x7790('0x26')]][_0x7790('0x35')](_0x2fb141)){if(this['channels'][_0x20a3b5['uniqueid']][_0x2fb141][_0x7790('0x7c')]=='transfer'&&this[_0x7790('0x8')][_0x20a3b5[_0x7790('0x26')]][_0x2fb141][_0x7790('0x5c')]){logger[_0x7790('0x1f')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x20a3b5[_0x7790('0x26')],_0x2fb141);this[_0x7790('0x8')][_0x20a3b5['uniqueid']][_0x2fb141]['agentcompleteAt']=moment()['format'](_0x7790('0x28'));}}}logger[_0x7790('0x22')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x20a3b5[_0x7790('0x26')],util[_0x7790('0x24')](_[_0x7790('0x7d')](this[_0x7790('0x8')][_0x20a3b5[_0x7790('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x7790('0x1d')](_0x7790('0x7e'),_[_0x7790('0x7d')](this[_0x7790('0x8')][_0x20a3b5[_0x7790('0x26')]]));delete this[_0x7790('0x8')][_0x20a3b5[_0x7790('0x26')]];}if(this[_0x7790('0xb')][_0x20a3b5[_0x7790('0x26')]]){delete this[_0x7790('0xb')][_0x20a3b5[_0x7790('0x26')]];}}}catch(_0x3b45c0){logger[_0x7790('0x32')](_0x7790('0x7f'),_0x20a3b5[_0x7790('0x26')],util['inspect'](_0x3b45c0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7790('0x1c')][_0x7790('0x1a')]=function(_0x23632a){try{if(this[_0x7790('0x1e')](_0x23632a)){logger[_0x7790('0x22')](_0x7790('0x80'),_0x23632a['uniqueid'],util[_0x7790('0x24')](_0x23632a,{'showHidden':![],'depth':null}));if(this[_0x7790('0x8')][_0x23632a['transfereeuniqueid']]){for(var _0x4cec78 in this[_0x7790('0x8')][_0x23632a[_0x7790('0x81')]]){if(this[_0x7790('0x8')][_0x23632a[_0x7790('0x81')]][_0x7790('0x35')](_0x4cec78)){if(_0x23632a[_0x7790('0x82')]===_0x4cec78){logger['info'](_0x7790('0x83'),_0x23632a[_0x7790('0x26')],this[_0x7790('0x8')][_0x23632a[_0x7790('0x81')]][_0x4cec78][_0x7790('0x20')],_0x4cec78);var _0x1d4691=moment();this['channels'][_0x23632a['transfereeuniqueid']][_0x4cec78]['agentcomplete']=!![];this[_0x7790('0x8')][_0x23632a[_0x7790('0x81')]][_0x4cec78]['agentcompleteAt']=moment()[_0x7790('0x27')](_0x7790('0x28'));this['channels'][_0x23632a[_0x7790('0x81')]][_0x4cec78][_0x7790('0x3d')]=_0x7790('0x84');this[_0x7790('0x8')][_0x23632a[_0x7790('0x81')]][_0x4cec78]['reason']=_0x7790('0x5e');this[_0x7790('0x8')][_0x23632a[_0x7790('0x81')]][_0x4cec78]['talktime']=_0x1d4691[_0x7790('0x85')](this['channels'][_0x23632a['transfereeuniqueid']][_0x4cec78]['agentconnectAt'],_0x7790('0x86'));}}}}if(this[_0x7790('0x8')][_0x23632a[_0x7790('0x87')]]){var _0x355632=this[_0x7790('0x8')][_0x23632a[_0x7790('0x87')]];this[_0x7790('0x8')][_0x23632a['secondtransfereruniqueid']]=this[_0x7790('0x8')][_0x23632a['transfereeuniqueid']];this[_0x7790('0x8')][_0x23632a['transfereeuniqueid']]=_0x355632;}}}catch(_0x5693a6){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x23632a[_0x7790('0x26')],util['inspect'](_0x5693a6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7790('0x1c')][_0x7790('0x88')]=function(_0x25ca03){try{if(this['isNotNull'](_0x25ca03)){logger[_0x7790('0x22')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x25ca03[_0x7790('0x26')],util['inspect'](_0x25ca03,{'showHidden':![],'depth':null}));if(this['channels'][_0x25ca03['transfereeuniqueid']]){for(var _0x5299c1 in this['channels'][_0x25ca03[_0x7790('0x81')]]){if(this['channels'][_0x25ca03[_0x7790('0x81')]][_0x7790('0x35')](_0x5299c1)){if(_0x25ca03[_0x7790('0x89')]===_0x5299c1){logger['info']('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x25ca03[_0x7790('0x26')],this[_0x7790('0x8')][_0x25ca03[_0x7790('0x81')]][_0x5299c1][_0x7790('0x20')],_0x5299c1);var _0x35f65d=moment();this[_0x7790('0x8')][_0x25ca03[_0x7790('0x81')]][_0x5299c1]['agentcomplete']=!![];this[_0x7790('0x8')][_0x25ca03[_0x7790('0x81')]][_0x5299c1]['agentcompleteAt']=_0x35f65d;this[_0x7790('0x8')][_0x25ca03[_0x7790('0x81')]][_0x5299c1][_0x7790('0x3d')]='complete';this[_0x7790('0x8')][_0x25ca03[_0x7790('0x81')]][_0x5299c1][_0x7790('0x7c')]=_0x7790('0x5e');this[_0x7790('0x8')][_0x25ca03[_0x7790('0x81')]][_0x5299c1][_0x7790('0x5f')]=_0x35f65d[_0x7790('0x85')](this[_0x7790('0x8')][_0x25ca03[_0x7790('0x81')]][_0x5299c1]['agentconnectAt'],_0x7790('0x86'));}}}}}}catch(_0x1f78ed){logger[_0x7790('0x32')](_0x7790('0x8a'),_0x25ca03[_0x7790('0x26')],util[_0x7790('0x24')](_0x1f78ed,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7790('0x1c')][_0x7790('0x8b')]=function(_0x18ed19){var _0x3c0c6a='';try{if(this[_0x7790('0x1e')](_0x18ed19)){logger[_0x7790('0x22')](_0x7790('0x8c'),_0x18ed19[_0x7790('0x26')],util[_0x7790('0x24')](_0x18ed19,{'showHidden':![],'depth':null}));if(_0x18ed19['channel']){_0x3c0c6a=_0x18ed19[_0x7790('0x8d')][_0x7790('0x8e')](0x0,_0x18ed19[_0x7790('0x8d')][_0x7790('0x8f')]('-'));if(this['agents'][_0x3c0c6a]){logger[_0x7790('0x1f')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x18ed19['uniqueid'],_0x3c0c6a);this['agents'][_0x3c0c6a][_0x7790('0x90')]=!![];}}}}catch(_0x47f8c6){logger[_0x7790('0x32')]('[%s][voiceAgentReport][musiconholdstart]',_0x18ed19[_0x7790('0x26')],util[_0x7790('0x24')](_0x47f8c6,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7790('0x91')]=function(_0x82ac02){var _0x27755c='';try{if(this['isNotNull'](_0x82ac02)){logger[_0x7790('0x22')](_0x7790('0x92'),_0x82ac02[_0x7790('0x26')],util[_0x7790('0x24')](_0x82ac02,{'showHidden':![],'depth':null}));if(_0x82ac02['channel']){_0x27755c=_0x82ac02[_0x7790('0x8d')][_0x7790('0x8e')](0x0,_0x82ac02[_0x7790('0x8d')][_0x7790('0x8f')]('-'));if(this['agents'][_0x27755c]){logger['info'](_0x7790('0x93'),_0x82ac02[_0x7790('0x26')],_0x27755c);this[_0x7790('0xa')][_0x27755c]['onhold']=![];}}}}catch(_0x5f155a){logger[_0x7790('0x32')]('[%s][voiceAgentReport][musiconholdstop]',_0x82ac02[_0x7790('0x26')],util[_0x7790('0x24')](_0x5f155a,{'showHidden':![],'depth':null}));}};module[_0x7790('0x94')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index e04d0a9..9400fe1 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 _0xb1b9=['lastdata','set','startsWith','cdr(','match','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','answertime','holdtime','diff','connectedlinenum','destinationchannel','toNumber','UserId','membername','endsWith','.wav49','replace','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%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','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','destconnectedlinenum','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','then','transferType','isEmpty','getSettings','stopRecordingOnTransfer','resolve','StopMixMonitor','catch','Action','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','origtransfereruniqueid','transfertargetuniqueid','origtransfererlinkedid','some','ATTENDED','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','syncMusicOnHoldStop','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','bluebird','moment','util','ioredis','ami','../ami','../model/channel','../rpc/setting','inuse','busy','invalid','unavailable','ringing','ringinuse','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newstate','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','isNotNull','isUndefined','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','inspect','uniqueid','linkedid','merge','pick','keys','[%s][voiceCallReport][newcallerid]','syncNewChannel','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','from-sip','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','split','accountcode','user:%s','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','includes','lastapplication'];(function(_0x565dff,_0x740f56){var _0x3aeec3=function(_0x4eb8d){while(--_0x4eb8d){_0x565dff['push'](_0x565dff['shift']());}};_0x3aeec3(++_0x740f56);}(_0xb1b9,0x64));var _0x9b1b=function(_0x30400b,_0x53c9d2){_0x30400b=_0x30400b-0x0;var _0x2d7e3b=_0xb1b9[_0x30400b];return _0x2d7e3b;};'use strict';var BPromise=require(_0x9b1b('0x0'));var _=require('lodash');var moment=require(_0x9b1b('0x1'));var util=require(_0x9b1b('0x2'));var path=require('path');var Redis=require(_0x9b1b('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x9b1b('0x4'));var ami=require(_0x9b1b('0x5'));var Channel=require(_0x9b1b('0x6'));var RpcSetting=require(_0x9b1b('0x7'));var statusDesc=['unknown','not_inuse',_0x9b1b('0x8'),_0x9b1b('0x9'),_0x9b1b('0xa'),_0x9b1b('0xb'),_0x9b1b('0xc'),_0x9b1b('0xd'),'onhold'];var applications=['set','queue','agi',_0x9b1b('0xe'),_0x9b1b('0xf'),_0x9b1b('0x10')];var dispositions=[_0x9b1b('0x11'),'FAILED',_0x9b1b('0x12'),_0x9b1b('0x11'),'NO\x20ANSWER','NO\x20ANSWER',_0x9b1b('0x13'),_0x9b1b('0x14'),'FAILED',_0x9b1b('0x12'),'FAILED'];var actions={};config[_0x9b1b('0x15')]=_[_0x9b1b('0x16')](config[_0x9b1b('0x15')],{'host':'localhost','port':0x18eb});var io=require(_0x9b1b('0x17'))(new Redis(config[_0x9b1b('0x15')]));function VoiceCallReport(_0xb7083b){this[_0x9b1b('0x18')]=_0xb7083b[_0x9b1b('0x18')];this[_0x9b1b('0x19')]=_0xb7083b['agents'];this[_0x9b1b('0x1a')]={};ami['on'](_0x9b1b('0x1b'),this[_0x9b1b('0x1c')][_0x9b1b('0x1d')](this));ami['on'](_0x9b1b('0x1e'),this[_0x9b1b('0x1c')][_0x9b1b('0x1d')](this));ami['on']('newchannel',this['syncNewChannel'][_0x9b1b('0x1d')](this));ami['on'](_0x9b1b('0x1f'),this['syncNewState'][_0x9b1b('0x1d')](this));ami['on'](_0x9b1b('0x20'),this[_0x9b1b('0x21')][_0x9b1b('0x1d')](this));ami['on']('hangup',this[_0x9b1b('0x22')][_0x9b1b('0x1d')](this));ami['on'](_0x9b1b('0x23'),this[_0x9b1b('0x24')][_0x9b1b('0x1d')](this));ami['on'](_0x9b1b('0x25'),this[_0x9b1b('0x26')]['bind'](this));ami['on'](_0x9b1b('0x27'),this[_0x9b1b('0x28')][_0x9b1b('0x1d')](this));ami['on'](_0x9b1b('0x29'),this['syncMusicOnHoldStart'][_0x9b1b('0x1d')](this));ami['on'](_0x9b1b('0x2a'),this['syncMusicOnHoldStop'][_0x9b1b('0x1d')](this));try{logger[_0x9b1b('0x2b')](_0x9b1b('0x2c'));ami[_0x9b1b('0x2d')]();}catch(_0x381ed3){logger[_0x9b1b('0x2e')]('[voiceCallReport][coreshowchannels]',util['inspect'](_0x381ed3,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x9b1b('0x2f')]=function(_0x2e7743){return _0x2e7743!==null&&!_[_0x9b1b('0x30')](_0x2e7743);};VoiceCallReport[_0x9b1b('0x31')][_0x9b1b('0x32')]=function(_0x32918a,_0x27ea8e,_0xacff95){io['to'](_0x32918a)[_0x9b1b('0x32')](_0x27ea8e,_0xacff95);};VoiceCallReport['prototype'][_0x9b1b('0x24')]=function(_0x123cc8){try{if(this[_0x9b1b('0x2f')](_0x123cc8)){logger[_0x9b1b('0x2b')](_0x9b1b('0x33'),_0x123cc8['uniqueid'],_0x123cc8[_0x9b1b('0x34')],_0x123cc8[_0x9b1b('0x35')]);logger[_0x9b1b('0x36')](_0x9b1b('0x37'),_0x123cc8['uniqueid'],util[_0x9b1b('0x38')](_0x123cc8,{'showHidden':![],'depth':null}));if(_0x123cc8[_0x9b1b('0x39')]===_0x123cc8[_0x9b1b('0x3a')]){if(!_[_0x9b1b('0x30')](this['channels'][_0x123cc8['uniqueid']])){_[_0x9b1b('0x3b')](this[_0x9b1b('0x18')][_0x123cc8[_0x9b1b('0x39')]],_[_0x9b1b('0x3c')](_0x123cc8,_[_0x9b1b('0x3d')](this[_0x9b1b('0x18')][_0x123cc8['uniqueid']])));}}}}catch(_0x39796e){logger['error'](_0x9b1b('0x3e'),_0x123cc8[_0x9b1b('0x39')],util[_0x9b1b('0x38')](_0x39796e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9b1b('0x31')][_0x9b1b('0x3f')]=function(_0x154aa4){try{if(this[_0x9b1b('0x2f')](_0x154aa4)){logger['debug'](_0x9b1b('0x40'),_0x154aa4['uniqueid'],util[_0x9b1b('0x38')](_0x154aa4,{'showHidden':![],'depth':null}));if(_0x154aa4[_0x9b1b('0x39')]===_0x154aa4[_0x9b1b('0x3a')]&&_0x154aa4[_0x9b1b('0x41')]!=_0x9b1b('0x42')){if(_[_0x9b1b('0x30')](this[_0x9b1b('0x18')][_0x154aa4[_0x9b1b('0x39')]])){logger[_0x9b1b('0x2b')](_0x9b1b('0x43'),_0x154aa4[_0x9b1b('0x39')],_0x154aa4[_0x9b1b('0x44')],_0x154aa4[_0x9b1b('0x45')]);this[_0x9b1b('0x18')][_0x154aa4[_0x9b1b('0x39')]]=new Channel();this[_0x9b1b('0x18')][_0x154aa4['uniqueid']][_0x9b1b('0x46')]=moment()[_0x9b1b('0x47')](_0x9b1b('0x48'));this['channels'][_0x154aa4['uniqueid']][_0x9b1b('0x49')]=dispositions[_['toNumber'](_0x154aa4[_0x9b1b('0x4a')])];_[_0x9b1b('0x3b')](this['channels'][_0x154aa4[_0x9b1b('0x39')]],_['pick'](_0x154aa4,_[_0x9b1b('0x3d')](this['channels'][_0x154aa4['uniqueid']])));if(_0x154aa4['context']===_0x9b1b('0x4b')){if(this[_0x9b1b('0x19')][_0x154aa4['channel']['split']('-')[0x0]]){this[_0x9b1b('0x19')][_0x154aa4[_0x9b1b('0x41')]['split']('-')[0x0]]['destconnectedlinenum']=_0x154aa4[_0x9b1b('0x45')];logger[_0x9b1b('0x36')](_0x9b1b('0x4c'),_0x154aa4['uniqueid'],util[_0x9b1b('0x38')]({'destaccountcode':this[_0x9b1b('0x19')][_0x154aa4['channel'][_0x9b1b('0x4d')]('-')[0x0]][_0x9b1b('0x4e')],'destconnectedlinenum':_0x154aa4['exten']},{'showHidden':![],'depth':null}));this[_0x9b1b('0x32')](util['format'](_0x9b1b('0x4f'),this[_0x9b1b('0x19')][_0x154aa4[_0x9b1b('0x41')][_0x9b1b('0x4d')]('-')[0x0]][_0x9b1b('0x50')]),'user:agentconnect',{'destaccountcode':this['agents'][_0x154aa4[_0x9b1b('0x41')][_0x9b1b('0x4d')]('-')[0x0]][_0x9b1b('0x4e')],'destconnectedlinenum':_0x154aa4[_0x9b1b('0x45')]});}}}}}}catch(_0x1cff0b){logger[_0x9b1b('0x2e')](_0x9b1b('0x51'),_0x154aa4['uniqueid'],util[_0x9b1b('0x38')](_0x1cff0b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9b1b('0x1c')]=function(_0x24f804){try{if(this[_0x9b1b('0x2f')](_0x24f804)){logger[_0x9b1b('0x36')](_0x9b1b('0x52'),_0x24f804['uniqueid'],util['inspect'](_0x24f804,{'showHidden':![],'depth':null}));if(_0x24f804['uniqueid']===_0x24f804[_0x9b1b('0x3a')]&&_0x24f804[_0x9b1b('0x45')]!='h'&&_0x24f804[_0x9b1b('0x41')]!=_0x9b1b('0x42')){_0x24f804[_0x9b1b('0x53')]=_0x24f804['application'][_0x9b1b('0x54')]();_0x24f804[_0x9b1b('0x55')]=(_0x24f804[_0x9b1b('0x56')]||_0x24f804['applicationdata'])[_0x9b1b('0x54')]();logger[_0x9b1b('0x2b')](_0x9b1b('0x57'),_0x24f804[_0x9b1b('0x39')],_0x24f804['application'],_0x24f804[_0x9b1b('0x55')]);if(_['isUndefined'](this[_0x9b1b('0x18')][_0x24f804[_0x9b1b('0x39')]])){this['channels'][_0x24f804[_0x9b1b('0x39')]]=new Channel();this[_0x9b1b('0x18')][_0x24f804[_0x9b1b('0x39')]][_0x9b1b('0x46')]=_0x24f804[_0x9b1b('0x58')]?moment()[_0x9b1b('0x59')](moment[_0x9b1b('0x58')](_0x24f804[_0x9b1b('0x58')])[_0x9b1b('0x5a')](),_0x9b1b('0x5a'))[_0x9b1b('0x47')](_0x9b1b('0x48')):moment()[_0x9b1b('0x47')](_0x9b1b('0x48'));this['channels'][_0x24f804['uniqueid']][_0x9b1b('0x49')]=_0x9b1b('0x11');}_[_0x9b1b('0x3b')](this[_0x9b1b('0x18')][_0x24f804['uniqueid']],_['pick'](_0x24f804,_[_0x9b1b('0x3d')](this['channels'][_0x24f804['uniqueid']])));if(_[_0x9b1b('0x5b')](applications,_0x24f804[_0x9b1b('0x53')])){this[_0x9b1b('0x18')][_0x24f804[_0x9b1b('0x39')]][_0x9b1b('0x5c')]=_0x24f804[_0x9b1b('0x53')];this[_0x9b1b('0x18')][_0x24f804[_0x9b1b('0x39')]][_0x9b1b('0x5d')]=_0x24f804[_0x9b1b('0x55')];if(_0x24f804[_0x9b1b('0x53')]===_0x9b1b('0x5e')&&_[_0x9b1b('0x5f')](_0x24f804['applicationdata'],_0x9b1b('0x60'))){var _0x292054=_0x24f804['applicationdata'][_0x9b1b('0x4d')]('=');var _0x5a1ab7=_0x292054[0x0][_0x9b1b('0x61')](/cdr\((.*)\)/);if(_0x5a1ab7){this[_0x9b1b('0x18')][_0x24f804[_0x9b1b('0x39')]][_0x5a1ab7[0x1]]=_0x292054[0x1];}}else if(_0x24f804[_0x9b1b('0x53')]===_0x9b1b('0x62')){this[_0x9b1b('0x18')][_0x24f804[_0x9b1b('0x39')]][_0x9b1b('0x62')]=_0x24f804[_0x9b1b('0x55')][_0x9b1b('0x4d')](',')[0x0];}}}}}catch(_0x2486f5){logger[_0x9b1b('0x2e')](_0x9b1b('0x63'),_0x24f804['uniqueid'],util[_0x9b1b('0x38')](_0x2486f5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9b1b('0x31')]['syncNewState']=function(_0x5e6ca5){try{if(this[_0x9b1b('0x2f')](_0x5e6ca5)){logger['info'](_0x9b1b('0x64'),_0x5e6ca5[_0x9b1b('0x39')],_0x5e6ca5[_0x9b1b('0x3a')],_0x5e6ca5[_0x9b1b('0x34')],_0x5e6ca5['calleridnum']);logger[_0x9b1b('0x36')]('[%s][voiceCallReport][newstate]\x20event:',_0x5e6ca5['uniqueid'],util[_0x9b1b('0x38')](_0x5e6ca5,{'showHidden':![],'depth':null}));if(_0x5e6ca5[_0x9b1b('0x39')]!==_0x5e6ca5[_0x9b1b('0x3a')]){if(this[_0x9b1b('0x18')][_0x5e6ca5[_0x9b1b('0x3a')]]){if(_0x5e6ca5[_0x9b1b('0x4a')]==='6'){if(!this[_0x9b1b('0x18')][_0x5e6ca5['linkedid']]['answered']){var _0x14aef2=moment();this[_0x9b1b('0x18')][_0x5e6ca5[_0x9b1b('0x3a')]][_0x9b1b('0x65')]=!![];this[_0x9b1b('0x18')][_0x5e6ca5[_0x9b1b('0x3a')]][_0x9b1b('0x66')]=_0x14aef2[_0x9b1b('0x47')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x9b1b('0x18')][_0x5e6ca5[_0x9b1b('0x3a')]][_0x9b1b('0x46')]){this[_0x9b1b('0x18')][_0x5e6ca5['linkedid']][_0x9b1b('0x67')]=_0x14aef2[_0x9b1b('0x68')](this[_0x9b1b('0x18')][_0x5e6ca5[_0x9b1b('0x3a')]][_0x9b1b('0x46')],_0x9b1b('0x5a'));}}this[_0x9b1b('0x18')][_0x5e6ca5[_0x9b1b('0x3a')]]['linkedid']=_0x5e6ca5[_0x9b1b('0x39')];if(_0x5e6ca5[_0x9b1b('0x35')]!=='xcally-motion-preview'){this['channels'][_0x5e6ca5[_0x9b1b('0x3a')]][_0x9b1b('0x69')]=_0x5e6ca5['calleridnum'];}this[_0x9b1b('0x18')][_0x5e6ca5[_0x9b1b('0x3a')]]['connectedlinename']=_0x5e6ca5[_0x9b1b('0x34')];this['channels'][_0x5e6ca5[_0x9b1b('0x3a')]][_0x9b1b('0x6a')]=_0x5e6ca5[_0x9b1b('0x41')];this['channels'][_0x5e6ca5[_0x9b1b('0x3a')]][_0x9b1b('0x49')]=dispositions[_[_0x9b1b('0x6b')](_0x5e6ca5[_0x9b1b('0x4a')])];if(this[_0x9b1b('0x19')][_0x5e6ca5[_0x9b1b('0x41')][_0x9b1b('0x4d')]('-')[0x0]]){this['channels'][_0x5e6ca5['linkedid']][_0x9b1b('0x6c')]=this['agents'][_0x5e6ca5[_0x9b1b('0x41')][_0x9b1b('0x4d')]('-')[0x0]]['id'];this['channels'][_0x5e6ca5['linkedid']]['membername']=this[_0x9b1b('0x19')][_0x5e6ca5['channel'][_0x9b1b('0x4d')]('-')[0x0]]['name'];}}}}else{if(this['channels'][_0x5e6ca5[_0x9b1b('0x39')]]){if(_0x5e6ca5['channelstate']==='6'){if(this['agents'][_0x5e6ca5['channel'][_0x9b1b('0x4d')]('-')[0x0]]){this[_0x9b1b('0x18')][_0x5e6ca5[_0x9b1b('0x39')]][_0x9b1b('0x6c')]=this[_0x9b1b('0x19')][_0x5e6ca5[_0x9b1b('0x41')]['split']('-')[0x0]]['id'];this[_0x9b1b('0x18')][_0x5e6ca5[_0x9b1b('0x39')]][_0x9b1b('0x6d')]=this['agents'][_0x5e6ca5[_0x9b1b('0x41')][_0x9b1b('0x4d')]('-')[0x0]]['name'];}}}}}}catch(_0x5c13e0){logger[_0x9b1b('0x2e')]('[%s][voiceCallReport][newstate]',_0x5e6ca5[_0x9b1b('0x39')],util[_0x9b1b('0x38')](_0x5c13e0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9b1b('0x31')]['syncMixMonitorFilename']=function(_0x35d79b,_0x161071){try{if(this['channels'][_0x35d79b]){logger[_0x9b1b('0x2b')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x35d79b,_0x161071);this[_0x9b1b('0x18')][_0x35d79b]['monitor']=!![];if(_[_0x9b1b('0x6e')](_0x161071,_0x9b1b('0x6f'))){_0x161071=_0x161071[_0x9b1b('0x70')](_0x9b1b('0x6f'),'.WAV');}this[_0x9b1b('0x18')][_0x35d79b][_0x9b1b('0x71')]=_0x161071;var _0x196636=_[_0x9b1b('0x72')](this['channels'][_0x35d79b][_0x9b1b('0x73')],{'filename':_0x161071});if(_['isNil'](_0x196636)){this[_0x9b1b('0x18')][_0x35d79b][_0x9b1b('0x73')][_0x9b1b('0x74')]({'filename':_0x161071,'createdAt':moment()[_0x9b1b('0x47')](_0x9b1b('0x48')),'mixmonitorid':'','status':_0x9b1b('0x75')});}}}catch(_0x41152a){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0x35d79b,util['inspect'](_0x41152a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9b1b('0x31')]['syncVarSet']=function(_0x374794){try{if(this[_0x9b1b('0x2f')](_0x374794)){logger['debug'](_0x9b1b('0x76'),_0x374794[_0x9b1b('0x39')],util[_0x9b1b('0x38')](_0x374794,{'showHidden':![],'depth':null}));if(this[_0x9b1b('0x18')][_0x374794['uniqueid']]&&_0x374794['channel']!=_0x9b1b('0x42')){if(this[_0x9b1b('0x2f')](_0x374794[_0x9b1b('0x77')])){if(this['isNotNull'](_0x374794[_0x9b1b('0x77')]['mixmonitor_filename'])){logger[_0x9b1b('0x2b')](_0x9b1b('0x78'),_0x374794[_0x9b1b('0x39')],_0x374794[_0x9b1b('0x79')]);this[_0x9b1b('0x7a')](_0x374794['uniqueid'],_0x374794[_0x9b1b('0x79')]);}else if(this['isNotNull'](_0x374794[_0x9b1b('0x77')]['xmd-phone'])){logger[_0x9b1b('0x2b')](_0x9b1b('0x7b'),_0x374794[_0x9b1b('0x39')],_0x374794[_0x9b1b('0x79')]);this[_0x9b1b('0x18')][_0x374794[_0x9b1b('0x39')]][_0x9b1b('0x35')]=_0x374794['value'];}else if(this[_0x9b1b('0x2f')](_0x374794['variable'][_0x9b1b('0x7c')])){logger['info'](_0x9b1b('0x7d'),_0x374794[_0x9b1b('0x39')],_0x374794[_0x9b1b('0x79')]);this[_0x9b1b('0x18')][_0x374794[_0x9b1b('0x39')]]['callerid']=_0x374794['value'];}else if(this[_0x9b1b('0x2f')](_0x374794['variable'][_0x9b1b('0x7e')])){logger[_0x9b1b('0x2b')](_0x9b1b('0x7f'),_0x374794[_0x9b1b('0x39')],_0x374794[_0x9b1b('0x79')]);this[_0x9b1b('0x18')][_0x374794[_0x9b1b('0x39')]][_0x9b1b('0x80')]=_0x374794[_0x9b1b('0x79')];}else if(this[_0x9b1b('0x2f')](_0x374794[_0x9b1b('0x77')][_0x9b1b('0x81')])){logger[_0x9b1b('0x2b')](_0x9b1b('0x82'),_0x374794['uniqueid'],_0x374794['value']['split'](',')[0x0]);this['channels'][_0x374794[_0x9b1b('0x39')]]['queue']=_0x374794['value']['split'](',')[0x0];}else if(this['isNotNull'](_0x374794[_0x9b1b('0x77')][_0x9b1b('0x83')])){logger[_0x9b1b('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x374794[_0x9b1b('0x39')],_0x374794[_0x9b1b('0x79')]);this[_0x9b1b('0x18')][_0x374794[_0x9b1b('0x39')]]['originatecalleridnum']=_0x374794[_0x9b1b('0x79')];}else if(this['isNotNull'](_0x374794['variable'][_0x9b1b('0x84')])){logger[_0x9b1b('0x2b')](_0x9b1b('0x85'),_0x374794[_0x9b1b('0x39')],_0x374794[_0x9b1b('0x79')]);this[_0x9b1b('0x18')][_0x374794[_0x9b1b('0x39')]]['destination']=_0x374794[_0x9b1b('0x79')];}else if(this[_0x9b1b('0x2f')](_0x374794[_0x9b1b('0x77')]['xmd-callerid-preview'])){logger[_0x9b1b('0x2b')](_0x9b1b('0x86'),_0x374794[_0x9b1b('0x39')],_0x374794['value']);this['channels'][_0x374794['uniqueid']]['calleridpreview']=_0x374794[_0x9b1b('0x79')];}else if(this['isNotNull'](_0x374794[_0x9b1b('0x77')]['xmcs-queue'])){logger['info'](_0x9b1b('0x87'),_0x374794['uniqueid'],_0x374794[_0x9b1b('0x79')]);this[_0x9b1b('0x18')][_0x374794[_0x9b1b('0x39')]][_0x9b1b('0x62')]=_0x374794[_0x9b1b('0x79')];}else if(this[_0x9b1b('0x2f')](_0x374794[_0x9b1b('0x77')][_0x9b1b('0x88')])){logger['info'](_0x9b1b('0x89'),_0x374794[_0x9b1b('0x39')],_0x374794[_0x9b1b('0x79')]);this['channels'][_0x374794['uniqueid']][_0x9b1b('0x8a')]=_0x374794['value'];}}}else if(this[_0x9b1b('0x2f')](_0x374794[_0x9b1b('0x77')][_0x9b1b('0x8b')])){if(_0x374794[_0x9b1b('0x79')]){var _0x2f2480=path['parse'](_0x374794[_0x9b1b('0x79')])['name'];logger['info'](_0x9b1b('0x78'),_0x2f2480,_0x374794[_0x9b1b('0x79')]);this[_0x9b1b('0x7a')](_0x2f2480,_0x374794[_0x9b1b('0x79')]);}}else if(this[_0x9b1b('0x18')][_0x374794[_0x9b1b('0x3a')]]){if(this['isNotNull'](_0x374794[_0x9b1b('0x77')])){if(this[_0x9b1b('0x2f')](_0x374794[_0x9b1b('0x77')][_0x9b1b('0x88')])){logger[_0x9b1b('0x2b')](_0x9b1b('0x89'),_0x374794[_0x9b1b('0x3a')],_0x374794[_0x9b1b('0x79')]);this[_0x9b1b('0x18')][_0x374794[_0x9b1b('0x3a')]][_0x9b1b('0x8c')]=_0x374794['value'];}}}}}catch(_0x924b13){logger[_0x9b1b('0x2e')](_0x9b1b('0x8d'),_0x374794['uniqueid'],util[_0x9b1b('0x38')](_0x924b13,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9b1b('0x31')][_0x9b1b('0x22')]=function(_0x10f738){try{if(this[_0x9b1b('0x2f')](_0x10f738)){logger[_0x9b1b('0x36')](_0x9b1b('0x8e'),_0x10f738[_0x9b1b('0x39')],util[_0x9b1b('0x38')](_0x10f738,{'showHidden':![],'depth':null}));if(this['channels'][_0x10f738[_0x9b1b('0x39')]]){logger[_0x9b1b('0x2b')](_0x9b1b('0x8f'),_0x10f738[_0x9b1b('0x39')],_0x10f738[_0x9b1b('0x90')]);var _0x4ab415=moment();this[_0x9b1b('0x18')][_0x10f738[_0x9b1b('0x39')]][_0x9b1b('0x91')]=_0x4ab415[_0x9b1b('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x10f738[_0x9b1b('0x39')]][_0x9b1b('0x58')]=_0x4ab415['diff'](this[_0x9b1b('0x18')][_0x10f738['uniqueid']]['starttime'],_0x9b1b('0x5a'));if(this[_0x9b1b('0x18')][_0x10f738[_0x9b1b('0x39')]]['answered']){this[_0x9b1b('0x18')][_0x10f738[_0x9b1b('0x39')]][_0x9b1b('0x92')]=_0x4ab415[_0x9b1b('0x68')](this[_0x9b1b('0x18')][_0x10f738['uniqueid']][_0x9b1b('0x66')],'seconds');this[_0x9b1b('0x18')][_0x10f738[_0x9b1b('0x39')]][_0x9b1b('0x67')]=this[_0x9b1b('0x18')][_0x10f738[_0x9b1b('0x39')]][_0x9b1b('0x58')]-this[_0x9b1b('0x18')][_0x10f738[_0x9b1b('0x39')]][_0x9b1b('0x92')];}if(_0x10f738[_0x9b1b('0x44')]===_0x9b1b('0x4b')){if(this[_0x9b1b('0x19')][_0x10f738['channel']['split']('-')[0x0]]){this[_0x9b1b('0x19')][_0x10f738[_0x9b1b('0x41')][_0x9b1b('0x4d')]('-')[0x0]]=_[_0x9b1b('0x93')](this[_0x9b1b('0x19')][_0x10f738[_0x9b1b('0x41')][_0x9b1b('0x4d')]('-')[0x0]],[_0x9b1b('0x94')]);logger[_0x9b1b('0x36')](_0x9b1b('0x95'),_0x10f738[_0x9b1b('0x39')],util[_0x9b1b('0x38')]({'destaccountcode':this[_0x9b1b('0x19')][_0x10f738[_0x9b1b('0x41')][_0x9b1b('0x4d')]('-')[0x0]][_0x9b1b('0x4e')]},{'showHidden':![],'depth':null}));this[_0x9b1b('0x32')](util['format'](_0x9b1b('0x4f'),this[_0x9b1b('0x19')][_0x10f738[_0x9b1b('0x41')][_0x9b1b('0x4d')]('-')[0x0]][_0x9b1b('0x50')]),_0x9b1b('0x96'),{'destaccountcode':this[_0x9b1b('0x19')][_0x10f738[_0x9b1b('0x41')]['split']('-')[0x0]]['accountcode']});}}var _0x29d43a=this;Promise['resolve']()[_0x9b1b('0x97')](function(){var _0x485d4b=_0x29d43a[_0x9b1b('0x18')][_0x10f738[_0x9b1b('0x39')]];if(typeof _0x485d4b[_0x9b1b('0x98')]==='undefined')return;if(_[_0x9b1b('0x99')](_0x485d4b[_0x9b1b('0x73')]))return;return RpcSetting[_0x9b1b('0x9a')]()[_0x9b1b('0x97')](function(_0x35defa){if(!_0x35defa[_0x9b1b('0x9b')])return;return Promise[_0x9b1b('0x9c')]()[_0x9b1b('0x97')](function(){return ami['Action']({'action':_0x9b1b('0x9d'),'channel':_0x485d4b[_0x9b1b('0x41')]})[_0x9b1b('0x9e')](function(){});})[_0x9b1b('0x97')](function(){return ami[_0x9b1b('0x9f')]({'action':_0x9b1b('0x9d'),'channel':_0x485d4b[_0x9b1b('0x6a')]})['catch'](function(){})['finally'](function(){var _0x333ecd=_0x29d43a[_0x9b1b('0x19')][_0x485d4b[_0x9b1b('0x6a')][_0x9b1b('0x4d')]('-')[0x0]];if(!_0x333ecd)return;io[_0x9b1b('0x32')]('webbar:stopmonitors',{'agentId':_0x333ecd['id'],'uniqueid':_0x485d4b[_0x9b1b('0x39')]});});});});})[_0x9b1b('0x97')](function(){if(_0x10f738[_0x9b1b('0xa0')]===_0x9b1b('0xa1')){_0x29d43a[_0x9b1b('0x1a')][_0x10f738[_0x9b1b('0x39')]]=_0x29d43a[_0x9b1b('0x18')][_0x10f738[_0x9b1b('0x39')]];}else{if(_0x29d43a[_0x9b1b('0x18')][_0x10f738['uniqueid']][_0x9b1b('0x80')]===_0x9b1b('0xa2')&&_0x29d43a[_0x9b1b('0x1a')][_0x10f738[_0x9b1b('0x39')]]){_0x29d43a[_0x9b1b('0x18')][_0x10f738[_0x9b1b('0x39')]][_0x9b1b('0x39')]=[_0x29d43a[_0x9b1b('0x18')][_0x10f738['uniqueid']][_0x9b1b('0x3a')],_0x29d43a[_0x9b1b('0x18')][_0x10f738[_0x9b1b('0x39')]]['linkedid']=_0x29d43a['channels'][_0x10f738['uniqueid']]['uniqueid']][0x0];delete _0x29d43a[_0x9b1b('0x1a')][_0x10f738[_0x9b1b('0x39')]];}}logger[_0x9b1b('0x36')](_0x9b1b('0xa3'),_0x10f738[_0x9b1b('0x39')],util['inspect'](_0x29d43a['channels'][_0x10f738[_0x9b1b('0x39')]],{'showHidden':![],'depth':null}));ami[_0x9b1b('0x32')]('custom:voiceCallReport',_0x29d43a[_0x9b1b('0x18')][_0x10f738[_0x9b1b('0x39')]]);delete _0x29d43a[_0x9b1b('0x18')][_0x10f738[_0x9b1b('0x39')]];});}}}catch(_0x5be326){logger[_0x9b1b('0x2e')](_0x9b1b('0xa4'),_0x10f738['uniqueid'],util[_0x9b1b('0x38')](_0x5be326,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9b1b('0x31')]['syncAttendedTransfer']=function(_0x1f9c8b){try{if(this[_0x9b1b('0x2f')](_0x1f9c8b)){logger['info'](_0x9b1b('0xa5'),_0x1f9c8b[_0x9b1b('0x39')],_0x1f9c8b['origtransferercalleridnum'],_0x1f9c8b[_0x9b1b('0xa6')]);logger[_0x9b1b('0x36')](_0x9b1b('0xa7'),_0x1f9c8b[_0x9b1b('0x39')],util[_0x9b1b('0x38')](_0x1f9c8b,{'showHidden':![],'depth':null}));if(this['channels'][_0x1f9c8b[_0x9b1b('0xa8')]]){this[_0x9b1b('0x18')][_0x1f9c8b['transfereeuniqueid']][_0x9b1b('0xa9')]=_0x1f9c8b[_0x9b1b('0xaa')];this[_0x9b1b('0x18')][_0x1f9c8b[_0x9b1b('0xa8')]][_0x9b1b('0xab')]=_0x1f9c8b[_0x9b1b('0xa6')];if(this[_0x9b1b('0x18')][_0x1f9c8b[_0x9b1b('0xac')]]){var _0x2fa4cb=this['channels'][_0x1f9c8b[_0x9b1b('0xac')]];this[_0x9b1b('0x18')][_0x1f9c8b[_0x9b1b('0xac')]]=this[_0x9b1b('0x18')][_0x1f9c8b[_0x9b1b('0xa8')]];this[_0x9b1b('0x18')][_0x1f9c8b[_0x9b1b('0xa8')]]=_0x2fa4cb;}}else if(this[_0x9b1b('0x18')][_0x1f9c8b['transfertargetuniqueid']]){this['channels'][_0x1f9c8b['transfertargetuniqueid']][_0x9b1b('0xa9')]=_0x1f9c8b[_0x9b1b('0xaa')];this['channels'][_0x1f9c8b['transfertargetuniqueid']][_0x9b1b('0xab')]=_0x1f9c8b[_0x9b1b('0xa6')];if(this[_0x9b1b('0x18')][_0x1f9c8b[_0x9b1b('0xad')]]){var _0x2fa4cb=this[_0x9b1b('0x18')][_0x1f9c8b[_0x9b1b('0xad')]];this[_0x9b1b('0x18')][_0x1f9c8b['origtransfereruniqueid']]=this[_0x9b1b('0x18')][_0x1f9c8b[_0x9b1b('0xae')]];this[_0x9b1b('0x18')][_0x1f9c8b['transfertargetuniqueid']]=_0x2fa4cb;}}if((this[_0x9b1b('0x18')][_0x1f9c8b[_0x9b1b('0xad')]]||this[_0x9b1b('0x18')][_0x1f9c8b[_0x9b1b('0xaf')]])&&this[_0x9b1b('0x18')][_0x1f9c8b[_0x9b1b('0xac')]]){var _0x34dc43=_[_0x9b1b('0xb0')]([this['channels'][_0x1f9c8b['origtransfereruniqueid']],this['channels'][_0x1f9c8b['origtransfererlinkedid']],this[_0x9b1b('0x18')][_0x1f9c8b[_0x9b1b('0xac')]]],function(_0x256e22){return _0x256e22&&_0x256e22[_0x9b1b('0x80')]==='outbound'&&_0x256e22['routeid'];});if(_0x34dc43){if(this[_0x9b1b('0x18')][_0x1f9c8b[_0x9b1b('0xad')]])this[_0x9b1b('0x18')][_0x1f9c8b['origtransfereruniqueid']][_0x9b1b('0x98')]=_0x9b1b('0xb1');if(this['channels'][_0x1f9c8b[_0x9b1b('0xaf')]])this[_0x9b1b('0x18')][_0x1f9c8b[_0x9b1b('0xaf')]][_0x9b1b('0x98')]=_0x9b1b('0xb1');this[_0x9b1b('0x18')][_0x1f9c8b[_0x9b1b('0xac')]][_0x9b1b('0x98')]='ATTENDED';}}}}catch(_0x3b352c){logger['error'](_0x9b1b('0xb2'),_0x1f9c8b[_0x9b1b('0x39')],util[_0x9b1b('0x38')](_0x3b352c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9b1b('0x31')][_0x9b1b('0x28')]=function(_0x131f23){try{if(this[_0x9b1b('0x2f')](_0x131f23)){logger[_0x9b1b('0x2b')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x131f23[_0x9b1b('0x39')],_0x131f23[_0x9b1b('0xb3')],_0x131f23[_0x9b1b('0xb4')]);logger[_0x9b1b('0x36')](_0x9b1b('0xb5'),_0x131f23[_0x9b1b('0x39')],util[_0x9b1b('0x38')](_0x131f23,{'showHidden':![],'depth':null}));if(this[_0x9b1b('0x18')][_0x131f23[_0x9b1b('0xa8')]]){this[_0x9b1b('0x18')][_0x131f23[_0x9b1b('0xa8')]]['transfercalleridnum']=_0x131f23[_0x9b1b('0xb3')];this[_0x9b1b('0x18')][_0x131f23[_0x9b1b('0xa8')]][_0x9b1b('0xab')]=_0x131f23['extension'];this['channels'][_0x131f23[_0x9b1b('0xa8')]][_0x9b1b('0x98')]=_0x9b1b('0xb6');this[_0x9b1b('0x22')]({'event':_0x9b1b('0xa1'),'uniqueid':_0x131f23[_0x9b1b('0xa8')],'context':_0x131f23[_0x9b1b('0x44')],'channel':_0x131f23['transfererchannel']});}else{this['channels'][_0x131f23[_0x9b1b('0xb7')]][_0x9b1b('0x98')]=_0x9b1b('0xb6');}}}catch(_0x59e28a){logger[_0x9b1b('0x2e')]('[%s][voiceCallReport][blindtransfer]',_0x131f23[_0x9b1b('0x39')],util[_0x9b1b('0x38')](_0x59e28a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9b1b('0x31')][_0x9b1b('0xb8')]=function(_0xafbaaf){try{if(this[_0x9b1b('0x2f')](_0xafbaaf)){logger[_0x9b1b('0x36')](_0x9b1b('0xb9'),_0xafbaaf['uniqueid'],util[_0x9b1b('0x38')](_0xafbaaf,{'showHidden':![],'depth':null}));if(this[_0x9b1b('0x18')][_0xafbaaf[_0x9b1b('0x39')]]){if(!_[_0x9b1b('0xba')](this['channels'][_0xafbaaf[_0x9b1b('0x39')]][_0x9b1b('0x66')])){this['channels'][_0xafbaaf[_0x9b1b('0x39')]]['mohstarttime']=moment()[_0x9b1b('0x47')](_0x9b1b('0x48'));logger[_0x9b1b('0x2b')](_0x9b1b('0xbb'),_0xafbaaf[_0x9b1b('0x39')],this['channels'][_0xafbaaf[_0x9b1b('0x39')]][_0x9b1b('0xbc')]);}}}}catch(_0x1867eb){logger['error']('[%s][voiceCallReport][musiconholdstart]',_0xafbaaf[_0x9b1b('0x39')],util['inspect'](_0x1867eb,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9b1b('0xbd')]=function(_0x4e808f){try{if(this[_0x9b1b('0x2f')](_0x4e808f)){logger[_0x9b1b('0x36')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x4e808f[_0x9b1b('0x39')],util[_0x9b1b('0x38')](_0x4e808f,{'showHidden':![],'depth':null}));if(this[_0x9b1b('0x18')][_0x4e808f['uniqueid']]){if(!_[_0x9b1b('0xba')](this[_0x9b1b('0x18')][_0x4e808f['uniqueid']][_0x9b1b('0xbc')])){this[_0x9b1b('0x18')][_0x4e808f['uniqueid']]['mohtime']+=moment()[_0x9b1b('0xbe')](0x0)[_0x9b1b('0x68')](this['channels'][_0x4e808f['uniqueid']][_0x9b1b('0xbc')],'seconds');logger[_0x9b1b('0x2b')](_0x9b1b('0xbf'),_0x4e808f[_0x9b1b('0x39')],this[_0x9b1b('0x18')][_0x4e808f[_0x9b1b('0x39')]]['mohtime']);delete this[_0x9b1b('0x18')][_0x4e808f[_0x9b1b('0x39')]]['mohstarttime'];}}}}catch(_0x1d40b0){logger[_0x9b1b('0x2e')]('[%s][voiceCallReport][musiconholdstop]',_0x4e808f[_0x9b1b('0x39')],util[_0x9b1b('0x38')](_0x1d40b0,{'showHidden':![],'depth':null}));}};module[_0x9b1b('0xc0')]=VoiceCallReport; \ No newline at end of file +var _0x5530=['syncNewState','hangup','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','syncNewChannel','debug','channel','OutgoingSpoolFailed','exten','starttime','format','disposition','toNumber','channelstate','context','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','emit','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','startsWith','cdr(','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','xcally-motion-preview','UserId','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','.wav49','replace','.WAV','monitorFilename','find','isNil','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','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%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','destination','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','diff','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','undefined','isEmpty','stopRecordingOnTransfer','Action','catch','StopMixMonitor','destinationchannel','finally','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','transfereecalleridnum','transfererchannel','transfereruniqueid','BLIND','[%s][voiceCallReport][blindtransfer]','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','moment','util','path','ioredis','../../../config/logger','../ami','../rpc/setting','not_inuse','inuse','busy','invalid','ringinuse','onhold','set','queue','agi','dial','playback','FAILED','NO\x20ANSWER','ANSWERED','BUSY','defaults','localhost','socket.io-emitter','redis','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','newstate'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0x5530,0xa7));var _0x0553=function(_0x1a34c3,_0x4e2475){_0x1a34c3=_0x1a34c3-0x0;var _0x37fc3e=_0x5530[_0x1a34c3];return _0x37fc3e;};'use strict';var BPromise=require(_0x0553('0x0'));var _=require('lodash');var moment=require(_0x0553('0x1'));var util=require(_0x0553('0x2'));var path=require(_0x0553('0x3'));var Redis=require(_0x0553('0x4'));var config=require('../../../config/environment');var logger=require(_0x0553('0x5'))('ami');var ami=require(_0x0553('0x6'));var Channel=require('../model/channel');var RpcSetting=require(_0x0553('0x7'));var statusDesc=['unknown',_0x0553('0x8'),_0x0553('0x9'),_0x0553('0xa'),_0x0553('0xb'),'unavailable','ringing',_0x0553('0xc'),_0x0553('0xd')];var applications=[_0x0553('0xe'),_0x0553('0xf'),_0x0553('0x10'),_0x0553('0x11'),_0x0553('0x12'),'voicemail'];var dispositions=['NO\x20ANSWER',_0x0553('0x13'),_0x0553('0x13'),_0x0553('0x14'),_0x0553('0x14'),_0x0553('0x14'),_0x0553('0x15'),_0x0553('0x16'),_0x0553('0x13'),_0x0553('0x13'),_0x0553('0x13')];var actions={};config['redis']=_[_0x0553('0x17')](config['redis'],{'host':_0x0553('0x18'),'port':0x18eb});var io=require(_0x0553('0x19'))(new Redis(config[_0x0553('0x1a')]));function VoiceCallReport(_0x5cea27){this[_0x0553('0x1b')]=_0x5cea27['channels'];this['agents']=_0x5cea27[_0x0553('0x1c')];this[_0x0553('0x1d')]={};ami['on'](_0x0553('0x1e'),this[_0x0553('0x1f')][_0x0553('0x20')](this));ami['on'](_0x0553('0x21'),this[_0x0553('0x1f')]['bind'](this));ami['on'](_0x0553('0x22'),this['syncNewChannel'][_0x0553('0x20')](this));ami['on'](_0x0553('0x23'),this[_0x0553('0x24')][_0x0553('0x20')](this));ami['on']('varset',this['syncVarSet'][_0x0553('0x20')](this));ami['on'](_0x0553('0x25'),this[_0x0553('0x26')][_0x0553('0x20')](this));ami['on']('newcallerid',this[_0x0553('0x27')]['bind'](this));ami['on'](_0x0553('0x28'),this[_0x0553('0x29')]['bind'](this));ami['on'](_0x0553('0x2a'),this[_0x0553('0x2b')][_0x0553('0x20')](this));ami['on']('musiconholdstart',this[_0x0553('0x2c')][_0x0553('0x20')](this));ami['on'](_0x0553('0x2d'),this[_0x0553('0x2e')][_0x0553('0x20')](this));try{logger[_0x0553('0x2f')](_0x0553('0x30'));ami[_0x0553('0x31')]();}catch(_0x26ad9b){logger[_0x0553('0x32')](_0x0553('0x33'),util[_0x0553('0x34')](_0x26ad9b,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x0553('0x35')]=function(_0xf40d1b){return _0xf40d1b!==null&&!_[_0x0553('0x36')](_0xf40d1b);};VoiceCallReport[_0x0553('0x37')]['emit']=function(_0x54b12a,_0x4ba145,_0x14f389){io['to'](_0x54b12a)['emit'](_0x4ba145,_0x14f389);};VoiceCallReport['prototype']['syncNewCallerId']=function(_0x366b5d){try{if(this[_0x0553('0x35')](_0x366b5d)){logger[_0x0553('0x2f')](_0x0553('0x38'),_0x366b5d[_0x0553('0x39')],_0x366b5d[_0x0553('0x3a')],_0x366b5d['calleridnum']);logger['debug'](_0x0553('0x3b'),_0x366b5d[_0x0553('0x39')],util[_0x0553('0x34')](_0x366b5d,{'showHidden':![],'depth':null}));if(_0x366b5d[_0x0553('0x39')]===_0x366b5d[_0x0553('0x3c')]){if(!_[_0x0553('0x36')](this[_0x0553('0x1b')][_0x366b5d[_0x0553('0x39')]])){_[_0x0553('0x3d')](this['channels'][_0x366b5d[_0x0553('0x39')]],_[_0x0553('0x3e')](_0x366b5d,_[_0x0553('0x3f')](this['channels'][_0x366b5d[_0x0553('0x39')]])));}}}}catch(_0x3d360c){logger[_0x0553('0x32')]('[%s][voiceCallReport][newcallerid]',_0x366b5d['uniqueid'],util[_0x0553('0x34')](_0x3d360c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0553('0x37')][_0x0553('0x40')]=function(_0x2867b5){try{if(this[_0x0553('0x35')](_0x2867b5)){logger[_0x0553('0x41')]('[%s][voiceCallReport][newchannel]\x20event:',_0x2867b5[_0x0553('0x39')],util[_0x0553('0x34')](_0x2867b5,{'showHidden':![],'depth':null}));if(_0x2867b5[_0x0553('0x39')]===_0x2867b5['linkedid']&&_0x2867b5[_0x0553('0x42')]!=_0x0553('0x43')){if(_[_0x0553('0x36')](this[_0x0553('0x1b')][_0x2867b5['uniqueid']])){logger[_0x0553('0x2f')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x2867b5[_0x0553('0x39')],_0x2867b5['context'],_0x2867b5[_0x0553('0x44')]);this['channels'][_0x2867b5[_0x0553('0x39')]]=new Channel();this[_0x0553('0x1b')][_0x2867b5[_0x0553('0x39')]][_0x0553('0x45')]=moment()[_0x0553('0x46')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0553('0x1b')][_0x2867b5['uniqueid']][_0x0553('0x47')]=dispositions[_[_0x0553('0x48')](_0x2867b5[_0x0553('0x49')])];_['merge'](this['channels'][_0x2867b5['uniqueid']],_[_0x0553('0x3e')](_0x2867b5,_['keys'](this[_0x0553('0x1b')][_0x2867b5[_0x0553('0x39')]])));if(_0x2867b5[_0x0553('0x4a')]===_0x0553('0x4b')){if(this[_0x0553('0x1c')][_0x2867b5[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]]){this[_0x0553('0x1c')][_0x2867b5[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]][_0x0553('0x4d')]=_0x2867b5[_0x0553('0x44')];logger[_0x0553('0x41')](_0x0553('0x4e'),_0x2867b5[_0x0553('0x39')],util[_0x0553('0x34')]({'destaccountcode':this[_0x0553('0x1c')][_0x2867b5[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]][_0x0553('0x4f')],'destconnectedlinenum':_0x2867b5[_0x0553('0x44')]},{'showHidden':![],'depth':null}));this[_0x0553('0x50')](util['format'](_0x0553('0x51'),this[_0x0553('0x1c')][_0x2867b5[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]][_0x0553('0x52')]),_0x0553('0x53'),{'destaccountcode':this[_0x0553('0x1c')][_0x2867b5[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2867b5[_0x0553('0x44')]});}}}}}}catch(_0x4f090c){logger[_0x0553('0x32')](_0x0553('0x54'),_0x2867b5['uniqueid'],util[_0x0553('0x34')](_0x4f090c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0553('0x1f')]=function(_0x47c0b5){try{if(this[_0x0553('0x35')](_0x47c0b5)){logger[_0x0553('0x41')](_0x0553('0x55'),_0x47c0b5[_0x0553('0x39')],util['inspect'](_0x47c0b5,{'showHidden':![],'depth':null}));if(_0x47c0b5[_0x0553('0x39')]===_0x47c0b5['linkedid']&&_0x47c0b5[_0x0553('0x44')]!='h'&&_0x47c0b5[_0x0553('0x42')]!=_0x0553('0x43')){_0x47c0b5[_0x0553('0x56')]=_0x47c0b5[_0x0553('0x56')][_0x0553('0x57')]();_0x47c0b5[_0x0553('0x58')]=(_0x47c0b5[_0x0553('0x59')]||_0x47c0b5['applicationdata'])[_0x0553('0x57')]();logger[_0x0553('0x2f')](_0x0553('0x5a'),_0x47c0b5[_0x0553('0x39')],_0x47c0b5['application'],_0x47c0b5[_0x0553('0x58')]);if(_[_0x0553('0x36')](this['channels'][_0x47c0b5[_0x0553('0x39')]])){this['channels'][_0x47c0b5[_0x0553('0x39')]]=new Channel();this[_0x0553('0x1b')][_0x47c0b5['uniqueid']][_0x0553('0x45')]=_0x47c0b5['duration']?moment()[_0x0553('0x5b')](moment[_0x0553('0x5c')](_0x47c0b5[_0x0553('0x5c')])[_0x0553('0x5d')](),'seconds')[_0x0553('0x46')](_0x0553('0x5e')):moment()[_0x0553('0x46')](_0x0553('0x5e'));this[_0x0553('0x1b')][_0x47c0b5['uniqueid']][_0x0553('0x47')]=_0x0553('0x14');}_[_0x0553('0x3d')](this[_0x0553('0x1b')][_0x47c0b5[_0x0553('0x39')]],_[_0x0553('0x3e')](_0x47c0b5,_['keys'](this[_0x0553('0x1b')][_0x47c0b5['uniqueid']])));if(_[_0x0553('0x5f')](applications,_0x47c0b5['application'])){this[_0x0553('0x1b')][_0x47c0b5['uniqueid']][_0x0553('0x60')]=_0x47c0b5[_0x0553('0x56')];this[_0x0553('0x1b')][_0x47c0b5[_0x0553('0x39')]][_0x0553('0x61')]=_0x47c0b5['applicationdata'];if(_0x47c0b5['application']===_0x0553('0xe')&&_[_0x0553('0x62')](_0x47c0b5[_0x0553('0x58')],_0x0553('0x63'))){var _0x193f1b=_0x47c0b5['applicationdata'][_0x0553('0x4c')]('=');var _0x142cfd=_0x193f1b[0x0]['match'](/cdr\((.*)\)/);if(_0x142cfd){this[_0x0553('0x1b')][_0x47c0b5[_0x0553('0x39')]][_0x142cfd[0x1]]=_0x193f1b[0x1];}}else if(_0x47c0b5[_0x0553('0x56')]==='queue'){this['channels'][_0x47c0b5[_0x0553('0x39')]][_0x0553('0xf')]=_0x47c0b5['applicationdata'][_0x0553('0x4c')](',')[0x0];}}}}}catch(_0x46da72){logger['error']('[%s][voiceCallReport][newexten]',_0x47c0b5[_0x0553('0x39')],util[_0x0553('0x34')](_0x46da72,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0553('0x24')]=function(_0x1fa50f){try{if(this[_0x0553('0x35')](_0x1fa50f)){logger[_0x0553('0x2f')](_0x0553('0x64'),_0x1fa50f[_0x0553('0x39')],_0x1fa50f[_0x0553('0x3c')],_0x1fa50f['calleridname'],_0x1fa50f[_0x0553('0x65')]);logger[_0x0553('0x41')](_0x0553('0x66'),_0x1fa50f[_0x0553('0x39')],util['inspect'](_0x1fa50f,{'showHidden':![],'depth':null}));if(_0x1fa50f[_0x0553('0x39')]!==_0x1fa50f['linkedid']){if(this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]]){if(_0x1fa50f[_0x0553('0x49')]==='6'){if(!this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]][_0x0553('0x67')]){var _0x528e7e=moment();this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]][_0x0553('0x67')]=!![];this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]][_0x0553('0x68')]=_0x528e7e['format'](_0x0553('0x5e'));if(this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]]['starttime']){this['channels'][_0x1fa50f['linkedid']][_0x0553('0x69')]=_0x528e7e['diff'](this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]]['starttime'],_0x0553('0x5d'));}}this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]][_0x0553('0x3c')]=_0x1fa50f[_0x0553('0x39')];if(_0x1fa50f[_0x0553('0x65')]!==_0x0553('0x6a')){this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]]['connectedlinenum']=_0x1fa50f[_0x0553('0x65')];}this['channels'][_0x1fa50f[_0x0553('0x3c')]]['connectedlinename']=_0x1fa50f[_0x0553('0x3a')];this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]]['destinationchannel']=_0x1fa50f[_0x0553('0x42')];this[_0x0553('0x1b')][_0x1fa50f['linkedid']][_0x0553('0x47')]=dispositions[_['toNumber'](_0x1fa50f[_0x0553('0x49')])];if(this['agents'][_0x1fa50f['channel']['split']('-')[0x0]]){this['channels'][_0x1fa50f[_0x0553('0x3c')]][_0x0553('0x6b')]=this['agents'][_0x1fa50f[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]]['id'];this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]]['membername']=this[_0x0553('0x1c')][_0x1fa50f['channel'][_0x0553('0x4c')]('-')[0x0]][_0x0553('0x52')];}}}}else{if(this['channels'][_0x1fa50f[_0x0553('0x39')]]){if(_0x1fa50f[_0x0553('0x49')]==='6'){if(this[_0x0553('0x1c')][_0x1fa50f['channel']['split']('-')[0x0]]){this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x39')]][_0x0553('0x6b')]=this['agents'][_0x1fa50f['channel']['split']('-')[0x0]]['id'];this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x39')]]['membername']=this[_0x0553('0x1c')][_0x1fa50f[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]]['name'];}}}}}}catch(_0x377dfc){logger[_0x0553('0x32')](_0x0553('0x6c'),_0x1fa50f[_0x0553('0x39')],util[_0x0553('0x34')](_0x377dfc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0553('0x37')][_0x0553('0x6d')]=function(_0x4daa5,_0x101299){try{if(this[_0x0553('0x1b')][_0x4daa5]){logger[_0x0553('0x2f')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x4daa5,_0x101299);this[_0x0553('0x1b')][_0x4daa5]['monitor']=!![];if(_['endsWith'](_0x101299,_0x0553('0x6e'))){_0x101299=_0x101299[_0x0553('0x6f')]('.wav49',_0x0553('0x70'));}this[_0x0553('0x1b')][_0x4daa5][_0x0553('0x71')]=_0x101299;var _0x1519c2=_[_0x0553('0x72')](this[_0x0553('0x1b')][_0x4daa5]['monitors'],{'filename':_0x101299});if(_[_0x0553('0x73')](_0x1519c2)){this['channels'][_0x4daa5][_0x0553('0x74')][_0x0553('0x75')]({'filename':_0x101299,'createdAt':moment()[_0x0553('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x0553('0x76')});}}}catch(_0x37b5a5){logger[_0x0553('0x32')](_0x0553('0x77'),_0x4daa5,util[_0x0553('0x34')](_0x37b5a5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0553('0x37')][_0x0553('0x78')]=function(_0x138f66){try{if(this[_0x0553('0x35')](_0x138f66)){logger[_0x0553('0x41')](_0x0553('0x79'),_0x138f66[_0x0553('0x39')],util['inspect'](_0x138f66,{'showHidden':![],'depth':null}));if(this['channels'][_0x138f66[_0x0553('0x39')]]&&_0x138f66[_0x0553('0x42')]!='OutgoingSpoolFailed'){if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')])){if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')][_0x0553('0x7b')])){logger[_0x0553('0x2f')](_0x0553('0x7c'),_0x138f66['uniqueid'],_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x6d')](_0x138f66[_0x0553('0x39')],_0x138f66[_0x0553('0x7d')]);}else if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')][_0x0553('0x7e')])){logger['info'](_0x0553('0x7f'),_0x138f66[_0x0553('0x39')],_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x1b')][_0x138f66[_0x0553('0x39')]][_0x0553('0x65')]=_0x138f66['value'];}else if(this['isNotNull'](_0x138f66[_0x0553('0x7a')]['xmd-callerid'])){logger[_0x0553('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x138f66[_0x0553('0x39')],_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x1b')][_0x138f66['uniqueid']][_0x0553('0x80')]=_0x138f66[_0x0553('0x7d')];}else if(this[_0x0553('0x35')](_0x138f66['variable'][_0x0553('0x81')])){logger['info'](_0x0553('0x82'),_0x138f66[_0x0553('0x39')],_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x1b')][_0x138f66[_0x0553('0x39')]][_0x0553('0x83')]=_0x138f66['value'];}else if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')]['xmd-queue'])){logger[_0x0553('0x2f')](_0x0553('0x84'),_0x138f66[_0x0553('0x39')],_0x138f66['value'][_0x0553('0x4c')](',')[0x0]);this[_0x0553('0x1b')][_0x138f66['uniqueid']][_0x0553('0xf')]=_0x138f66[_0x0553('0x7d')][_0x0553('0x4c')](',')[0x0];}else if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')][_0x0553('0x85')])){logger[_0x0553('0x2f')](_0x0553('0x86'),_0x138f66[_0x0553('0x39')],_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x1b')][_0x138f66[_0x0553('0x39')]]['originatecalleridnum']=_0x138f66[_0x0553('0x7d')];}else if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')][_0x0553('0x87')])){logger[_0x0553('0x2f')](_0x0553('0x88'),_0x138f66['uniqueid'],_0x138f66[_0x0553('0x7d')]);this['channels'][_0x138f66['uniqueid']][_0x0553('0x89')]=_0x138f66[_0x0553('0x7d')];}else if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')]['xmd-callerid-preview'])){logger[_0x0553('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x138f66['uniqueid'],_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x1b')][_0x138f66['uniqueid']][_0x0553('0x8a')]=_0x138f66[_0x0553('0x7d')];}else if(this['isNotNull'](_0x138f66[_0x0553('0x7a')][_0x0553('0x8b')])){logger[_0x0553('0x2f')](_0x0553('0x8c'),_0x138f66[_0x0553('0x39')],_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x1b')][_0x138f66[_0x0553('0x39')]][_0x0553('0xf')]=_0x138f66[_0x0553('0x7d')];}else if(this['isNotNull'](_0x138f66[_0x0553('0x7a')][_0x0553('0x8d')])){logger[_0x0553('0x2f')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x138f66[_0x0553('0x39')],_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x1b')][_0x138f66[_0x0553('0x39')]][_0x0553('0x8e')]=_0x138f66[_0x0553('0x7d')];}}}else if(this[_0x0553('0x35')](_0x138f66['variable'][_0x0553('0x7b')])){if(_0x138f66[_0x0553('0x7d')]){var _0x1b4926=path[_0x0553('0x8f')](_0x138f66[_0x0553('0x7d')])[_0x0553('0x52')];logger[_0x0553('0x2f')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x1b4926,_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x6d')](_0x1b4926,_0x138f66[_0x0553('0x7d')]);}}else if(this[_0x0553('0x1b')][_0x138f66['linkedid']]){if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')])){if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')][_0x0553('0x8d')])){logger[_0x0553('0x2f')](_0x0553('0x90'),_0x138f66[_0x0553('0x3c')],_0x138f66['value']);this[_0x0553('0x1b')][_0x138f66[_0x0553('0x3c')]][_0x0553('0x91')]=_0x138f66[_0x0553('0x7d')];}}}}}catch(_0x1fb932){logger[_0x0553('0x32')](_0x0553('0x92'),_0x138f66[_0x0553('0x39')],util[_0x0553('0x34')](_0x1fb932,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0553('0x37')][_0x0553('0x26')]=function(_0x179327){try{if(this[_0x0553('0x35')](_0x179327)){logger[_0x0553('0x41')](_0x0553('0x93'),_0x179327[_0x0553('0x39')],util[_0x0553('0x34')](_0x179327,{'showHidden':![],'depth':null}));if(this['channels'][_0x179327[_0x0553('0x39')]]){logger[_0x0553('0x2f')](_0x0553('0x94'),_0x179327[_0x0553('0x39')],_0x179327['cause-txt']);var _0x17c46e=moment();this[_0x0553('0x1b')][_0x179327['uniqueid']][_0x0553('0x95')]=_0x17c46e[_0x0553('0x46')](_0x0553('0x5e'));this[_0x0553('0x1b')][_0x179327['uniqueid']]['duration']=_0x17c46e[_0x0553('0x96')](this[_0x0553('0x1b')][_0x179327['uniqueid']][_0x0553('0x45')],_0x0553('0x5d'));if(this['channels'][_0x179327[_0x0553('0x39')]]['answered']){this[_0x0553('0x1b')][_0x179327[_0x0553('0x39')]]['billableseconds']=_0x17c46e[_0x0553('0x96')](this[_0x0553('0x1b')][_0x179327[_0x0553('0x39')]]['answertime'],_0x0553('0x5d'));this[_0x0553('0x1b')][_0x179327[_0x0553('0x39')]]['holdtime']=this['channels'][_0x179327['uniqueid']][_0x0553('0x5c')]-this[_0x0553('0x1b')][_0x179327[_0x0553('0x39')]][_0x0553('0x97')];}if(_0x179327[_0x0553('0x4a')]==='from-sip'){if(this[_0x0553('0x1c')][_0x179327[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]]){this[_0x0553('0x1c')][_0x179327['channel'][_0x0553('0x4c')]('-')[0x0]]=_[_0x0553('0x98')](this['agents'][_0x179327[_0x0553('0x42')]['split']('-')[0x0]],[_0x0553('0x4d')]);logger['debug'](_0x0553('0x99'),_0x179327[_0x0553('0x39')],util[_0x0553('0x34')]({'destaccountcode':this[_0x0553('0x1c')][_0x179327[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]][_0x0553('0x4f')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x0553('0x46')](_0x0553('0x51'),this[_0x0553('0x1c')][_0x179327[_0x0553('0x42')]['split']('-')[0x0]][_0x0553('0x52')]),_0x0553('0x9a'),{'destaccountcode':this['agents'][_0x179327[_0x0553('0x42')]['split']('-')[0x0]]['accountcode']});}}var _0x930bde=this;Promise[_0x0553('0x9b')]()[_0x0553('0x9c')](function(){var _0x53c8f6=_0x930bde[_0x0553('0x1b')][_0x179327['uniqueid']];if(typeof _0x53c8f6[_0x0553('0x9d')]===_0x0553('0x9e'))return;if(_[_0x0553('0x9f')](_0x53c8f6[_0x0553('0x74')]))return;return RpcSetting['getSettings']()[_0x0553('0x9c')](function(_0x14317f){if(!_0x14317f[_0x0553('0xa0')])return;return Promise['resolve']()[_0x0553('0x9c')](function(){return ami[_0x0553('0xa1')]({'action':'StopMixMonitor','channel':_0x53c8f6[_0x0553('0x42')]})[_0x0553('0xa2')](function(){});})[_0x0553('0x9c')](function(){return ami[_0x0553('0xa1')]({'action':_0x0553('0xa3'),'channel':_0x53c8f6[_0x0553('0xa4')]})[_0x0553('0xa2')](function(){})[_0x0553('0xa5')](function(){var _0x37af8c=_0x930bde['agents'][_0x53c8f6['destinationchannel'][_0x0553('0x4c')]('-')[0x0]];if(!_0x37af8c)return;io[_0x0553('0x50')](_0x0553('0xa6'),{'agentId':_0x37af8c['id'],'uniqueid':_0x53c8f6[_0x0553('0x39')]});});});});})['then'](function(){if(_0x179327['event']===_0x0553('0xa7')){_0x930bde['blindTransfers'][_0x179327['uniqueid']]=_0x930bde['channels'][_0x179327[_0x0553('0x39')]];}else{if(_0x930bde['channels'][_0x179327['uniqueid']][_0x0553('0x83')]===_0x0553('0xa8')&&_0x930bde[_0x0553('0x1d')][_0x179327[_0x0553('0x39')]]){_0x930bde['channels'][_0x179327[_0x0553('0x39')]][_0x0553('0x39')]=[_0x930bde[_0x0553('0x1b')][_0x179327[_0x0553('0x39')]]['linkedid'],_0x930bde['channels'][_0x179327['uniqueid']]['linkedid']=_0x930bde[_0x0553('0x1b')][_0x179327[_0x0553('0x39')]]['uniqueid']][0x0];delete _0x930bde[_0x0553('0x1d')][_0x179327['uniqueid']];}}logger[_0x0553('0x41')](_0x0553('0xa9'),_0x179327['uniqueid'],util[_0x0553('0x34')](_0x930bde[_0x0553('0x1b')][_0x179327[_0x0553('0x39')]],{'showHidden':![],'depth':null}));ami[_0x0553('0x50')](_0x0553('0xaa'),_0x930bde[_0x0553('0x1b')][_0x179327['uniqueid']]);delete _0x930bde[_0x0553('0x1b')][_0x179327[_0x0553('0x39')]];});}}}catch(_0x452720){logger[_0x0553('0x32')](_0x0553('0xab'),_0x179327[_0x0553('0x39')],util['inspect'](_0x452720,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0553('0x37')][_0x0553('0x29')]=function(_0x23b338){try{if(this[_0x0553('0x35')](_0x23b338)){logger['info'](_0x0553('0xac'),_0x23b338[_0x0553('0x39')],_0x23b338[_0x0553('0xad')],_0x23b338[_0x0553('0xae')]);logger[_0x0553('0x41')](_0x0553('0xaf'),_0x23b338[_0x0553('0x39')],util[_0x0553('0x34')](_0x23b338,{'showHidden':![],'depth':null}));if(this['channels'][_0x23b338[_0x0553('0xb0')]]){this['channels'][_0x23b338[_0x0553('0xb0')]][_0x0553('0xb1')]=_0x23b338[_0x0553('0xad')];this['channels'][_0x23b338[_0x0553('0xb0')]][_0x0553('0xb2')]=_0x23b338[_0x0553('0xae')];if(this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb3')]]){var _0xc9a547=this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb3')]];this['channels'][_0x23b338['secondtransfereruniqueid']]=this[_0x0553('0x1b')][_0x23b338['transfereeuniqueid']];this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb0')]]=_0xc9a547;}}else if(this['channels'][_0x23b338['transfertargetuniqueid']]){this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb4')]]['transfercalleridnum']=_0x23b338[_0x0553('0xad')];this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb4')]][_0x0553('0xb2')]=_0x23b338[_0x0553('0xae')];if(this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb5')]]){var _0xc9a547=this['channels'][_0x23b338['origtransfereruniqueid']];this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb5')]]=this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb4')]];this['channels'][_0x23b338[_0x0553('0xb4')]]=_0xc9a547;}}if((this['channels'][_0x23b338[_0x0553('0xb5')]]||this['channels'][_0x23b338[_0x0553('0xb6')]])&&this[_0x0553('0x1b')][_0x23b338['secondtransfereruniqueid']]){var _0x71c695=_[_0x0553('0xb7')]([this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb5')]],this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb6')]],this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb3')]]],function(_0x360ca1){return _0x360ca1&&_0x360ca1[_0x0553('0x83')]===_0x0553('0xa8')&&_0x360ca1[_0x0553('0xb8')];});if(_0x71c695){if(this[_0x0553('0x1b')][_0x23b338['origtransfereruniqueid']])this[_0x0553('0x1b')][_0x23b338['origtransfereruniqueid']][_0x0553('0x9d')]=_0x0553('0xb9');if(this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb6')]])this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb6')]]['transferType']=_0x0553('0xb9');this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb3')]]['transferType']=_0x0553('0xb9');}}}}catch(_0x4a13da){logger[_0x0553('0x32')](_0x0553('0xba'),_0x23b338[_0x0553('0x39')],util['inspect'](_0x4a13da,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0553('0x2b')]=function(_0x306b81){try{if(this[_0x0553('0x35')](_0x306b81)){logger[_0x0553('0x2f')](_0x0553('0xbb'),_0x306b81['uniqueid'],_0x306b81['transfereecalleridnum'],_0x306b81[_0x0553('0xbc')]);logger[_0x0553('0x41')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x306b81[_0x0553('0x39')],util[_0x0553('0x34')](_0x306b81,{'showHidden':![],'depth':null}));if(this[_0x0553('0x1b')][_0x306b81[_0x0553('0xb0')]]){this[_0x0553('0x1b')][_0x306b81[_0x0553('0xb0')]][_0x0553('0xb1')]=_0x306b81[_0x0553('0xbd')];this[_0x0553('0x1b')][_0x306b81[_0x0553('0xb0')]][_0x0553('0xb2')]=_0x306b81[_0x0553('0xbc')];this[_0x0553('0x1b')][_0x306b81[_0x0553('0xb0')]][_0x0553('0x9d')]='BLIND';this[_0x0553('0x26')]({'event':'BlindTransfer','uniqueid':_0x306b81[_0x0553('0xb0')],'context':_0x306b81[_0x0553('0x4a')],'channel':_0x306b81[_0x0553('0xbe')]});}else{this['channels'][_0x306b81[_0x0553('0xbf')]][_0x0553('0x9d')]=_0x0553('0xc0');}}}catch(_0x42bef4){logger['error'](_0x0553('0xc1'),_0x306b81[_0x0553('0x39')],util['inspect'](_0x42bef4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0553('0x37')][_0x0553('0x2c')]=function(_0x5aff20){try{if(this[_0x0553('0x35')](_0x5aff20)){logger[_0x0553('0x41')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x5aff20['uniqueid'],util[_0x0553('0x34')](_0x5aff20,{'showHidden':![],'depth':null}));if(this['channels'][_0x5aff20[_0x0553('0x39')]]){if(!_[_0x0553('0x73')](this[_0x0553('0x1b')][_0x5aff20[_0x0553('0x39')]][_0x0553('0x68')])){this[_0x0553('0x1b')][_0x5aff20[_0x0553('0x39')]][_0x0553('0xc2')]=moment()[_0x0553('0x46')](_0x0553('0x5e'));logger[_0x0553('0x2f')](_0x0553('0xc3'),_0x5aff20['uniqueid'],this['channels'][_0x5aff20[_0x0553('0x39')]]['mohstarttime']);}}}}catch(_0x52f8fa){logger[_0x0553('0x32')](_0x0553('0xc4'),_0x5aff20[_0x0553('0x39')],util[_0x0553('0x34')](_0x52f8fa,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0553('0x37')][_0x0553('0x2e')]=function(_0x403d14){try{if(this[_0x0553('0x35')](_0x403d14)){logger[_0x0553('0x41')](_0x0553('0xc5'),_0x403d14[_0x0553('0x39')],util[_0x0553('0x34')](_0x403d14,{'showHidden':![],'depth':null}));if(this['channels'][_0x403d14['uniqueid']]){if(!_['isNil'](this[_0x0553('0x1b')][_0x403d14[_0x0553('0x39')]][_0x0553('0xc2')])){this['channels'][_0x403d14[_0x0553('0x39')]][_0x0553('0xc6')]+=moment()[_0x0553('0xc7')](0x0)['diff'](this[_0x0553('0x1b')][_0x403d14[_0x0553('0x39')]][_0x0553('0xc2')],'seconds');logger[_0x0553('0x2f')](_0x0553('0xc8'),_0x403d14['uniqueid'],this[_0x0553('0x1b')][_0x403d14[_0x0553('0x39')]][_0x0553('0xc6')]);delete this['channels'][_0x403d14[_0x0553('0x39')]][_0x0553('0xc2')];}}}}catch(_0x544d99){logger['error'](_0x0553('0xc9'),_0x403d14[_0x0553('0x39')],util[_0x0553('0x34')](_0x544d99,{'showHidden':![],'depth':null}));}};module[_0x0553('0xca')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 4b5a6e6..06737ae 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 _0xd97e=['../../../config/environment','ami','defaults','localhost','socket.io-emitter','redis','channels','outboundChannels','outbound','variables','syncDialBegin','dialend','syncDialEnd','bind','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','emit','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','substring','lastIndexOf','channel','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','uniqueid','membername','interface','debug','[%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','lastevent','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][varset]\x20event:','addVariable','keys','variable','isUndefined','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','duration','diff','starttime','complete','total','answertime','answered','holdtime','billableseconds','seconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','util','ioredis'];(function(_0x5c7390,_0x2aa189){var _0x1d3946=function(_0x51ff00){while(--_0x51ff00){_0x5c7390['push'](_0x5c7390['shift']());}};_0x1d3946(++_0x2aa189);}(_0xd97e,0x146));var _0xed97=function(_0x19c423,_0x165e63){_0x19c423=_0x19c423-0x0;var _0x34e8fb=_0xd97e[_0x19c423];return _0x34e8fb;};'use strict';var _=require(_0xed97('0x0'));var moment=require(_0xed97('0x1'));var util=require(_0xed97('0x2'));var Redis=require(_0xed97('0x3'));var config=require(_0xed97('0x4'));var logger=require('../../../config/logger')(_0xed97('0x5'));var ami=require('../ami');config['redis']=_[_0xed97('0x6')](config['redis'],{'host':_0xed97('0x7'),'port':0x18eb});var io=require(_0xed97('0x8'))(new Redis(config[_0xed97('0x9')]));function VoiceDialReport(_0x3cbfe8){this[_0xed97('0xa')]=_0x3cbfe8[_0xed97('0xb')];this['outbound']=_0x3cbfe8[_0xed97('0xc')];this[_0xed97('0xd')]={};ami['on']('dialbegin',this[_0xed97('0xe')]['bind'](this));ami['on'](_0xed97('0xf'),this[_0xed97('0x10')][_0xed97('0x11')](this));ami['on'](_0xed97('0x12'),this[_0xed97('0x13')][_0xed97('0x11')](this));ami['on'](_0xed97('0x14'),this[_0xed97('0x15')][_0xed97('0x11')](this));}VoiceDialReport[_0xed97('0x16')][_0xed97('0x17')]=function(_0x3d9944){return _0x3d9944!==null&&!_['isUndefined'](_0x3d9944);};VoiceDialReport['prototype'][_0xed97('0x18')]=function(_0x346f72,_0x99525f,_0x51249d){io['to'](_0x346f72)['emit'](_0x99525f,_0x51249d);};VoiceDialReport[_0xed97('0x16')]['syncDialBegin']=function(_0x579df5){try{if(this[_0xed97('0x17')](_0x579df5)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x579df5['uniqueid'],util[_0xed97('0x19')](_0x579df5,{'showHidden':![],'depth':null}));if(this[_0xed97('0xa')][_0x579df5['uniqueid']]){_[_0xed97('0x1a')](this[_0xed97('0xa')][_0x579df5['uniqueid']],{'starttime':moment()[_0xed97('0x1b')](_0xed97('0x1c')),'lastevent':_0xed97('0x1d'),'interface':_0x579df5['channel'][_0xed97('0x1e')](0x0,_0x579df5['channel'][_0xed97('0x1f')]('-')),'membername':_0x579df5['channel'][_0xed97('0x1e')](_0x579df5[_0xed97('0x20')][_0xed97('0x1f')]('/')+0x1,_0x579df5[_0xed97('0x20')][_0xed97('0x1f')]('-'))},_['omit'](_0x579df5,[_0xed97('0x21'),'privilege']));logger[_0xed97('0x22')](_0xed97('0x23'),_0x579df5[_0xed97('0x24')],this[_0xed97('0xa')][_0x579df5[_0xed97('0x24')]][_0xed97('0x25')],this[_0xed97('0xa')][_0x579df5[_0xed97('0x24')]][_0xed97('0x26')]);logger[_0xed97('0x27')](_0xed97('0x28'),_0x579df5['uniqueid'],util[_0xed97('0x19')](this[_0xed97('0xa')][_0x579df5[_0xed97('0x24')]],{'showHidden':![],'depth':null}));this['emit'](_0xed97('0x29'),_0xed97('0x2a'),this[_0xed97('0xa')][_0x579df5[_0xed97('0x24')]]);logger['debug'](_0xed97('0x2b'),_0x579df5[_0xed97('0x24')],util['inspect'](this[_0xed97('0xa')][_0x579df5['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xed97('0x18')]('custom:dialbegin',this[_0xed97('0xa')][_0x579df5[_0xed97('0x24')]]);}}}catch(_0x2ad742){logger[_0xed97('0x2c')]('[%s][voiceDialReport][dialbegin]',_0x579df5[_0xed97('0x24')],util[_0xed97('0x19')](_0x2ad742,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncDialEnd']=function(_0x185259){try{if(this[_0xed97('0x17')](_0x185259)){logger[_0xed97('0x27')](_0xed97('0x2d'),_0x185259[_0xed97('0x24')],util[_0xed97('0x19')](_0x185259,{'showHidden':![],'depth':null}));if(this['channels'][_0x185259[_0xed97('0x24')]]){this['channels'][_0x185259[_0xed97('0x24')]][_0xed97('0x2e')]=_0x185259[_0xed97('0x2e')];if(_0x185259['dialstatus']===_0xed97('0x2f')){this['channels'][_0x185259[_0xed97('0x24')]][_0xed97('0x30')]=_0x185259[_0xed97('0x30')];this['channels'][_0x185259[_0xed97('0x24')]][_0xed97('0x31')]=_0x185259[_0xed97('0x31')];this[_0xed97('0xa')][_0x185259[_0xed97('0x24')]]['answertime']=moment()[_0xed97('0x1b')](_0xed97('0x1c'));this[_0xed97('0xa')][_0x185259[_0xed97('0x24')]][_0xed97('0x32')]=_0xed97('0x33');logger[_0xed97('0x22')](_0xed97('0x34'),_0x185259['uniqueid'],_0x185259[_0xed97('0x20')]['substring'](_0x185259['channel'][_0xed97('0x1f')]('/')+0x1,_0x185259[_0xed97('0x20')][_0xed97('0x1f')]('-')));logger[_0xed97('0x27')](_0xed97('0x35'),_0x185259[_0xed97('0x24')],util[_0xed97('0x19')](this[_0xed97('0xa')][_0x185259[_0xed97('0x24')]],{'showHidden':![],'depth':null}));ami[_0xed97('0x18')](_0xed97('0x36'),this['channels'][_0x185259[_0xed97('0x24')]]);}logger['debug'](_0xed97('0x37'),_0x185259['uniqueid'],util['inspect'](this[_0xed97('0xa')][_0x185259[_0xed97('0x24')]],{'showHidden':![],'depth':null}));this[_0xed97('0x18')](_0xed97('0x29'),_0xed97('0x2a'),this['channels'][_0x185259[_0xed97('0x24')]]);}}}catch(_0x54c2a3){logger[_0xed97('0x2c')]('[%s][voiceDialReport][dialend]',_0x185259[_0xed97('0x24')],util[_0xed97('0x19')](_0x54c2a3,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xed97('0x16')]['syncVarSet']=function(_0x18097f){try{if(this[_0xed97('0x17')](_0x18097f)){logger[_0xed97('0x27')](_0xed97('0x38'),_0x18097f[_0xed97('0x24')],util['inspect'](_0x18097f,{'showHidden':![],'depth':null}));this[_0xed97('0x39')](_0x18097f['uniqueid'],_[_0xed97('0x3a')](_0x18097f['variable'])[0x0],_0x18097f['value']);if(this['isNotNull'](_0x18097f[_0xed97('0x3b')])&&this[_0xed97('0x17')](_0x18097f[_0xed97('0x3b')]['outboundrouteid'])){if(_[_0xed97('0x3c')](this[_0xed97('0xa')][_0x18097f[_0xed97('0x24')]])){this[_0xed97('0xa')][_0x18097f[_0xed97('0x24')]]={'routeId':_0x18097f[_0xed97('0x3d')],'variables':this[_0xed97('0xd')][_0x18097f[_0xed97('0x24')]]};logger['info'](_0xed97('0x3e'),_0x18097f['uniqueid'],_0x18097f[_0xed97('0x3b')][_0xed97('0x3f')],_[_0xed97('0x3a')](_0x18097f['variable'])[0x0],_0x18097f[_0xed97('0x3d')]);logger[_0xed97('0x27')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x18097f[_0xed97('0x24')],util[_0xed97('0x19')](this[_0xed97('0xa')][_0x18097f[_0xed97('0x24')]],{'showHidden':![],'depth':null}));this[_0xed97('0x18')](_0xed97('0x29'),_0xed97('0x2a'),this[_0xed97('0xa')][_0x18097f['uniqueid']]);}}}}catch(_0x3488fb){logger[_0xed97('0x2c')](_0xed97('0x40'),_0x18097f[_0xed97('0x24')],util[_0xed97('0x19')](_0x3488fb,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xed97('0x16')][_0xed97('0x39')]=function(_0x248745,_0x6f647e,_0x505146){var _0x3a6e4a=[_0xed97('0x41'),_0xed97('0x42'),_0xed97('0x43'),_0xed97('0x44'),_0xed97('0x45'),_0xed97('0x46'),_0xed97('0x47'),_0xed97('0x48'),'sipcallid',_0xed97('0x49'),_0xed97('0x4a'),_0xed97('0x4b'),'membercalls','memberdynamic',_0xed97('0x4c'),_0xed97('0x4d'),_0xed97('0x25'),_0xed97('0x4e'),_0xed97('0x4f')];if(!_[_0xed97('0x50')](_0x6f647e)&&!_['includes'](_0x3a6e4a,_0x6f647e)){if(_[_0xed97('0x3c')](this[_0xed97('0xd')][_0x248745])){this[_0xed97('0xd')][_0x248745]={};}this[_0xed97('0xd')][_0x248745][_0x6f647e]=_0x505146;}};VoiceDialReport['prototype'][_0xed97('0x15')]=function(_0x54f9a2){try{if(this[_0xed97('0x17')](_0x54f9a2)){logger[_0xed97('0x27')](_0xed97('0x51'),_0x54f9a2[_0xed97('0x24')],util[_0xed97('0x19')](_0x54f9a2,{'showHidden':![],'depth':null}));if(this[_0xed97('0xa')][_0x54f9a2[_0xed97('0x24')]]){logger[_0xed97('0x22')](_0xed97('0x52'),_0x54f9a2[_0xed97('0x24')],_0x54f9a2['cause-txt']);this[_0xed97('0xa')][_0x54f9a2[_0xed97('0x24')]][_0xed97('0x53')]=moment()[_0xed97('0x1b')](_0xed97('0x1c'));this[_0xed97('0xa')][_0x54f9a2['uniqueid']][_0xed97('0x54')]=moment(this[_0xed97('0xa')][_0x54f9a2[_0xed97('0x24')]][_0xed97('0x53')])[_0xed97('0x55')](this[_0xed97('0xa')][_0x54f9a2['uniqueid']][_0xed97('0x56')],'seconds');this['channels'][_0x54f9a2[_0xed97('0x24')]][_0xed97('0x32')]=_0xed97('0x57');this[_0xed97('0xc')][_0xed97('0x58')]+=0x1;if(this['channels'][_0x54f9a2[_0xed97('0x24')]][_0xed97('0x59')]){this[_0xed97('0xc')][_0xed97('0x5a')]+=0x1;this[_0xed97('0xa')][_0x54f9a2[_0xed97('0x24')]][_0xed97('0x5b')]=moment(this['channels'][_0x54f9a2[_0xed97('0x24')]][_0xed97('0x59')])[_0xed97('0x55')](this['channels'][_0x54f9a2[_0xed97('0x24')]][_0xed97('0x56')],'seconds');this[_0xed97('0xa')][_0x54f9a2[_0xed97('0x24')]][_0xed97('0x5c')]=moment(this['channels'][_0x54f9a2[_0xed97('0x24')]][_0xed97('0x53')])['diff'](this['channels'][_0x54f9a2[_0xed97('0x24')]][_0xed97('0x59')],_0xed97('0x5d'));this[_0xed97('0xc')][_0xed97('0x5e')]+=this[_0xed97('0xa')][_0x54f9a2[_0xed97('0x24')]][_0xed97('0x5b')]||0x0;this['outbound'][_0xed97('0x5f')]+=this[_0xed97('0xa')][_0x54f9a2[_0xed97('0x24')]]['billableseconds'];}this['outbound'][_0xed97('0x60')]+=this[_0xed97('0xa')][_0x54f9a2['uniqueid']][_0xed97('0x54')];logger[_0xed97('0x27')](_0xed97('0x61'),_0x54f9a2[_0xed97('0x24')],util['inspect'](this[_0xed97('0xa')][_0x54f9a2[_0xed97('0x24')]],{'showHidden':![],'depth':null}));ami[_0xed97('0x18')](_0xed97('0x62'),this['channels'][_0x54f9a2[_0xed97('0x24')]]);logger['debug'](_0xed97('0x63'),_0x54f9a2[_0xed97('0x24')],util['inspect'](this[_0xed97('0xa')][_0x54f9a2[_0xed97('0x24')]],{'showHidden':![],'depth':null}));ami['emit'](_0xed97('0x64'),this[_0xed97('0xa')][_0x54f9a2[_0xed97('0x24')]]);logger[_0xed97('0x27')](_0xed97('0x65'),_0x54f9a2[_0xed97('0x24')],util[_0xed97('0x19')](this[_0xed97('0xa')][_0x54f9a2[_0xed97('0x24')]],{'showHidden':![],'depth':null}));this[_0xed97('0x18')](_0xed97('0x29'),'voice_outbound:save',this[_0xed97('0xc')]);logger[_0xed97('0x22')](_0xed97('0x66'),JSON[_0xed97('0x67')](this[_0xed97('0xa')][_0x54f9a2[_0xed97('0x24')]]));logger[_0xed97('0x27')](_0xed97('0x68'),_0x54f9a2[_0xed97('0x24')],util[_0xed97('0x19')](this['channels'][_0x54f9a2[_0xed97('0x24')]],{'showHidden':![],'depth':null}));this[_0xed97('0x18')](_0xed97('0x29'),_0xed97('0x69'),this[_0xed97('0xa')][_0x54f9a2[_0xed97('0x24')]]);delete this[_0xed97('0xa')][_0x54f9a2['uniqueid']];}else if(this[_0xed97('0xa')][_0x54f9a2['linkedid']]){this[_0xed97('0xa')][_0x54f9a2[_0xed97('0x6a')]][_0xed97('0x24')]=this[_0xed97('0xa')][_0x54f9a2[_0xed97('0x6a')]][_0xed97('0x6b')];}if(this[_0xed97('0xd')][_0x54f9a2['uniqueid']]){delete this[_0xed97('0xd')][_0x54f9a2[_0xed97('0x24')]];}}}catch(_0x42c3f5){logger[_0xed97('0x2c')](_0xed97('0x6c'),_0x54f9a2[_0xed97('0x24')],util[_0xed97('0x19')](_0x42c3f5,{'showHidden':![],'depth':null}));}};module[_0xed97('0x6d')]=VoiceDialReport; \ No newline at end of file +var _0x5093=['membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinename','answertime','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]','variable','value','outboundrouteid','isUndefined','keys','error','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','diff','seconds','lastevent','complete','total','answered','starttime','billableseconds','sumHoldTime','holdtime','sumBillable','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','isNotNull','emit','debug','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','omit','event','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called'];(function(_0x521084,_0x2684ff){var _0x238363=function(_0x55b73b){while(--_0x55b73b){_0x521084['push'](_0x521084['shift']());}};_0x238363(++_0x2684ff);}(_0x5093,0xae));var _0x3509=function(_0x5a6d3b,_0x15a93b){_0x5a6d3b=_0x5a6d3b-0x0;var _0x3aaf17=_0x5093[_0x5a6d3b];return _0x3aaf17;};'use strict';var _=require(_0x3509('0x0'));var moment=require(_0x3509('0x1'));var util=require(_0x3509('0x2'));var Redis=require(_0x3509('0x3'));var config=require(_0x3509('0x4'));var logger=require(_0x3509('0x5'))(_0x3509('0x6'));var ami=require(_0x3509('0x7'));config['redis']=_[_0x3509('0x8')](config[_0x3509('0x9')],{'host':_0x3509('0xa'),'port':0x18eb});var io=require(_0x3509('0xb'))(new Redis(config[_0x3509('0x9')]));function VoiceDialReport(_0x2b117f){this[_0x3509('0xc')]=_0x2b117f[_0x3509('0xd')];this[_0x3509('0xe')]=_0x2b117f[_0x3509('0xe')];this[_0x3509('0xf')]={};ami['on'](_0x3509('0x10'),this[_0x3509('0x11')][_0x3509('0x12')](this));ami['on'](_0x3509('0x13'),this[_0x3509('0x14')][_0x3509('0x12')](this));ami['on']('varset',this[_0x3509('0x15')][_0x3509('0x12')](this));ami['on'](_0x3509('0x16'),this[_0x3509('0x17')][_0x3509('0x12')](this));}VoiceDialReport[_0x3509('0x18')][_0x3509('0x19')]=function(_0x414801){return _0x414801!==null&&!_['isUndefined'](_0x414801);};VoiceDialReport['prototype'][_0x3509('0x1a')]=function(_0x3c89a4,_0x6882a1,_0x1b7a25){io['to'](_0x3c89a4)[_0x3509('0x1a')](_0x6882a1,_0x1b7a25);};VoiceDialReport['prototype'][_0x3509('0x11')]=function(_0x13bcd7){try{if(this[_0x3509('0x19')](_0x13bcd7)){logger[_0x3509('0x1b')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x13bcd7[_0x3509('0x1c')],util[_0x3509('0x1d')](_0x13bcd7,{'showHidden':![],'depth':null}));if(this['channels'][_0x13bcd7[_0x3509('0x1c')]]){_[_0x3509('0x1e')](this[_0x3509('0xc')][_0x13bcd7[_0x3509('0x1c')]],{'starttime':moment()[_0x3509('0x1f')](_0x3509('0x20')),'lastevent':_0x3509('0x21'),'interface':_0x13bcd7['channel'][_0x3509('0x22')](0x0,_0x13bcd7[_0x3509('0x23')]['lastIndexOf']('-')),'membername':_0x13bcd7['channel'][_0x3509('0x22')](_0x13bcd7[_0x3509('0x23')][_0x3509('0x24')]('/')+0x1,_0x13bcd7[_0x3509('0x23')]['lastIndexOf']('-'))},_[_0x3509('0x25')](_0x13bcd7,[_0x3509('0x26'),'privilege']));logger['info'](_0x3509('0x27'),_0x13bcd7[_0x3509('0x1c')],this[_0x3509('0xc')][_0x13bcd7[_0x3509('0x1c')]][_0x3509('0x28')],this[_0x3509('0xc')][_0x13bcd7[_0x3509('0x1c')]][_0x3509('0x29')]);logger[_0x3509('0x1b')](_0x3509('0x2a'),_0x13bcd7[_0x3509('0x1c')],util[_0x3509('0x1d')](this[_0x3509('0xc')][_0x13bcd7[_0x3509('0x1c')]],{'showHidden':![],'depth':null}));this[_0x3509('0x1a')](_0x3509('0x2b'),_0x3509('0x2c'),this[_0x3509('0xc')][_0x13bcd7[_0x3509('0x1c')]]);logger[_0x3509('0x1b')](_0x3509('0x2d'),_0x13bcd7[_0x3509('0x1c')],util['inspect'](this[_0x3509('0xc')][_0x13bcd7[_0x3509('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x3509('0x1a')](_0x3509('0x2e'),this[_0x3509('0xc')][_0x13bcd7['uniqueid']]);}}}catch(_0x4e28c6){logger['error'](_0x3509('0x2f'),_0x13bcd7[_0x3509('0x1c')],util['inspect'](_0x4e28c6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3509('0x18')][_0x3509('0x14')]=function(_0x2e848c){try{if(this[_0x3509('0x19')](_0x2e848c)){logger[_0x3509('0x1b')](_0x3509('0x30'),_0x2e848c[_0x3509('0x1c')],util[_0x3509('0x1d')](_0x2e848c,{'showHidden':![],'depth':null}));if(this[_0x3509('0xc')][_0x2e848c['uniqueid']]){this[_0x3509('0xc')][_0x2e848c['uniqueid']][_0x3509('0x31')]=_0x2e848c[_0x3509('0x31')];if(_0x2e848c[_0x3509('0x31')]===_0x3509('0x32')){this[_0x3509('0xc')][_0x2e848c['uniqueid']]['connectedlinenum']=_0x2e848c['connectedlinenum'];this[_0x3509('0xc')][_0x2e848c[_0x3509('0x1c')]][_0x3509('0x33')]=_0x2e848c[_0x3509('0x33')];this[_0x3509('0xc')][_0x2e848c['uniqueid']][_0x3509('0x34')]=moment()[_0x3509('0x1f')](_0x3509('0x20'));this[_0x3509('0xc')][_0x2e848c['uniqueid']]['lastevent']='connect';logger[_0x3509('0x35')](_0x3509('0x36'),_0x2e848c[_0x3509('0x1c')],_0x2e848c[_0x3509('0x23')]['substring'](_0x2e848c['channel'][_0x3509('0x24')]('/')+0x1,_0x2e848c['channel'][_0x3509('0x24')]('-')));logger[_0x3509('0x1b')](_0x3509('0x37'),_0x2e848c['uniqueid'],util['inspect'](this[_0x3509('0xc')][_0x2e848c[_0x3509('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x3509('0x1a')](_0x3509('0x38'),this[_0x3509('0xc')][_0x2e848c[_0x3509('0x1c')]]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x2e848c[_0x3509('0x1c')],util[_0x3509('0x1d')](this[_0x3509('0xc')][_0x2e848c['uniqueid']],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x3509('0x2c'),this[_0x3509('0xc')][_0x2e848c[_0x3509('0x1c')]]);}}}catch(_0x15b566){logger['error'](_0x3509('0x39'),_0x2e848c[_0x3509('0x1c')],util[_0x3509('0x1d')](_0x15b566,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x33732f){try{if(this[_0x3509('0x19')](_0x33732f)){logger[_0x3509('0x1b')]('[%s][voiceDialReport][varset]\x20event:',_0x33732f[_0x3509('0x1c')],util[_0x3509('0x1d')](_0x33732f,{'showHidden':![],'depth':null}));this['addVariable'](_0x33732f['uniqueid'],_['keys'](_0x33732f[_0x3509('0x3a')])[0x0],_0x33732f[_0x3509('0x3b')]);if(this['isNotNull'](_0x33732f['variable'])&&this[_0x3509('0x19')](_0x33732f[_0x3509('0x3a')][_0x3509('0x3c')])){if(_[_0x3509('0x3d')](this[_0x3509('0xc')][_0x33732f[_0x3509('0x1c')]])){this[_0x3509('0xc')][_0x33732f['uniqueid']]={'routeId':_0x33732f[_0x3509('0x3b')],'variables':this[_0x3509('0xf')][_0x33732f[_0x3509('0x1c')]]};logger[_0x3509('0x35')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x33732f[_0x3509('0x1c')],_0x33732f[_0x3509('0x3a')][_0x3509('0x3c')],_[_0x3509('0x3e')](_0x33732f[_0x3509('0x3a')])[0x0],_0x33732f[_0x3509('0x3b')]);logger[_0x3509('0x1b')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x33732f[_0x3509('0x1c')],util[_0x3509('0x1d')](this[_0x3509('0xc')][_0x33732f[_0x3509('0x1c')]],{'showHidden':![],'depth':null}));this[_0x3509('0x1a')](_0x3509('0x2b'),_0x3509('0x2c'),this['channels'][_0x33732f[_0x3509('0x1c')]]);}}}}catch(_0x2ccde8){logger[_0x3509('0x3f')]('[%s][voiceDialReport][varset]',_0x33732f[_0x3509('0x1c')],util[_0x3509('0x1d')](_0x2ccde8,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3509('0x18')][_0x3509('0x40')]=function(_0x210b41,_0x1069a0,_0x39c09c){var _0x4f21b0=[_0x3509('0x41'),_0x3509('0x42'),_0x3509('0x43'),_0x3509('0x44'),_0x3509('0x45'),_0x3509('0x46'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x3509('0x47'),_0x3509('0x48'),_0x3509('0x49'),_0x3509('0x4a'),_0x3509('0x4b'),_0x3509('0x4c'),_0x3509('0x4d'),_0x3509('0x4e'),_0x3509('0x28'),_0x3509('0x4f'),_0x3509('0x50')];if(!_[_0x3509('0x51')](_0x1069a0)&&!_['includes'](_0x4f21b0,_0x1069a0)){if(_[_0x3509('0x3d')](this[_0x3509('0xf')][_0x210b41])){this[_0x3509('0xf')][_0x210b41]={};}this[_0x3509('0xf')][_0x210b41][_0x1069a0]=_0x39c09c;}};VoiceDialReport[_0x3509('0x18')][_0x3509('0x17')]=function(_0x2b6434){try{if(this[_0x3509('0x19')](_0x2b6434)){logger[_0x3509('0x1b')](_0x3509('0x52'),_0x2b6434[_0x3509('0x1c')],util[_0x3509('0x1d')](_0x2b6434,{'showHidden':![],'depth':null}));if(this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]]){logger[_0x3509('0x35')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x2b6434['uniqueid'],_0x2b6434[_0x3509('0x53')]);this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]][_0x3509('0x54')]=moment()[_0x3509('0x1f')](_0x3509('0x20'));this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]]['duration']=moment(this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]][_0x3509('0x54')])[_0x3509('0x55')](this['channels'][_0x2b6434[_0x3509('0x1c')]]['starttime'],_0x3509('0x56'));this['channels'][_0x2b6434[_0x3509('0x1c')]][_0x3509('0x57')]=_0x3509('0x58');this['outbound'][_0x3509('0x59')]+=0x1;if(this[_0x3509('0xc')][_0x2b6434['uniqueid']][_0x3509('0x34')]){this[_0x3509('0xe')][_0x3509('0x5a')]+=0x1;this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]]['holdtime']=moment(this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]]['answertime'])['diff'](this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]][_0x3509('0x5b')],'seconds');this['channels'][_0x2b6434['uniqueid']][_0x3509('0x5c')]=moment(this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]][_0x3509('0x54')])['diff'](this['channels'][_0x2b6434[_0x3509('0x1c')]][_0x3509('0x34')],_0x3509('0x56'));this[_0x3509('0xe')][_0x3509('0x5d')]+=this[_0x3509('0xc')][_0x2b6434['uniqueid']][_0x3509('0x5e')]||0x0;this[_0x3509('0xe')][_0x3509('0x5f')]+=this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]][_0x3509('0x5c')];}this[_0x3509('0xe')]['sumDuration']+=this[_0x3509('0xc')][_0x2b6434['uniqueid']][_0x3509('0x60')];logger[_0x3509('0x1b')](_0x3509('0x61'),_0x2b6434['uniqueid'],util['inspect'](this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x3509('0x1a')](_0x3509('0x62'),this[_0x3509('0xc')][_0x2b6434['uniqueid']]);logger[_0x3509('0x1b')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x2b6434[_0x3509('0x1c')],util[_0x3509('0x1d')](this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x3509('0x1a')](_0x3509('0x63'),this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]]);logger[_0x3509('0x1b')](_0x3509('0x64'),_0x2b6434[_0x3509('0x1c')],util['inspect'](this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]],{'showHidden':![],'depth':null}));this[_0x3509('0x1a')](_0x3509('0x2b'),'voice_outbound:save',this[_0x3509('0xe')]);logger['info'](_0x3509('0x65'),JSON[_0x3509('0x66')](this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]]));logger[_0x3509('0x1b')](_0x3509('0x67'),_0x2b6434[_0x3509('0x1c')],util[_0x3509('0x1d')](this[_0x3509('0xc')][_0x2b6434['uniqueid']],{'showHidden':![],'depth':null}));this[_0x3509('0x1a')](_0x3509('0x2b'),_0x3509('0x68'),this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]]);delete this['channels'][_0x2b6434[_0x3509('0x1c')]];}else if(this[_0x3509('0xc')][_0x2b6434['linkedid']]){this[_0x3509('0xc')][_0x2b6434[_0x3509('0x69')]][_0x3509('0x1c')]=this[_0x3509('0xc')][_0x2b6434[_0x3509('0x69')]][_0x3509('0x6a')];}if(this['variables'][_0x2b6434['uniqueid']]){delete this[_0x3509('0xf')][_0x2b6434['uniqueid']];}}}catch(_0x5ead73){logger[_0x3509('0x3f')]('[%s][voiceDialReport][hangup]',_0x2b6434['uniqueid'],util[_0x3509('0x1d')](_0x5ead73,{'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 8d624e4..1f5f96c 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 _0x1d2d=['custom:voiceQueueReport','transfereeuniqueid','transferexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertargetuniqueid','origtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','[%s][voiceQueueReport][attendedtransfer]','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','syncHangup','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','seconds','exports','lodash','moment','util','md5','ioredis','../../../config/logger','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','agentconnect','varset','syncVarSet','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','waiting','queueStatusComplete','unlockRR','clearZombieChannels','switch','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkVariables]','syncFullyBooted','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','name','voice_queue_channel:remove','emitVoiceQueueSummary','inbound','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','total','type','abandoned','Trunk','active','Interval','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','queues','[voiceQueueReport][queues]','then','[voiceQueueReport][queuesummary]','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','callers','toNumber','loggedin','talking','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','syncQueueSummaryComplete','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','keys','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','assigned','queuecallerexitAt','transfer','reason','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerexit','add','FORWARDTRANSFER','transfertype','FORWARD','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][agentcomplete]','[%s][voiceQueueReport][varset]','addVariable','value','variable','queuestatus','CONTINUE','lastevent','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','memberinterface','memberlastcall','membername','memberpenalty','[%s][voiceQueueReport][hangup]','length','unmanaged','sumHoldTime','diff','milliseconds','answered','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:'];(function(_0x382f93,_0xfcc591){var _0x44310b=function(_0x292ff7){while(--_0x292ff7){_0x382f93['push'](_0x382f93['shift']());}};_0x44310b(++_0xfcc591);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x90cf23,_0x597be0){_0x90cf23=_0x90cf23-0x0;var _0x386a95=_0x1d2d[_0x90cf23];return _0x386a95;};'use strict';var _=require(_0xd1d2('0x0'));var moment=require(_0xd1d2('0x1'));var util=require(_0xd1d2('0x2'));var md5=require(_0xd1d2('0x3'));var Redis=require(_0xd1d2('0x4'));var config=require('../../../config/environment');var logger=require(_0xd1d2('0x5'))('ami');var ami=require('../ami');var QueueReport=require(_0xd1d2('0x6'));config[_0xd1d2('0x7')]=_[_0xd1d2('0x8')](config[_0xd1d2('0x7')],{'host':_0xd1d2('0x9'),'port':0x18eb});var io=require(_0xd1d2('0xa'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xd1d2('0xb')][_0xd1d2('0xc')]=function(_0x35735f){this[_0xd1d2('0xd')]=this[_0xd1d2('0xd')]?this[_0xd1d2('0xd')][_0xd1d2('0xe')](_0x35735f):_0x35735f();};function VoiceQueueReport(_0x1a6ca4){this[_0xd1d2('0xf')]=new Sequence();this[_0xd1d2('0x10')]={};this[_0xd1d2('0x11')]=_0x1a6ca4[_0xd1d2('0x11')];this[_0xd1d2('0x12')]=_0x1a6ca4['queueChannels'];this[_0xd1d2('0x13')]=_0x1a6ca4[_0xd1d2('0x13')];this[_0xd1d2('0x14')]=!![];this[_0xd1d2('0x15')]=_0x1a6ca4[_0xd1d2('0x15')];this[_0xd1d2('0x16')]={};ami['on'](_0xd1d2('0x17'),this[_0xd1d2('0x18')][_0xd1d2('0x19')](this));ami['on'](_0xd1d2('0x1a'),this['syncQueueSummaryComplete'][_0xd1d2('0x19')](this));ami['on'](_0xd1d2('0x1b'),this[_0xd1d2('0x1c')]['bind'](this));ami['on'](_0xd1d2('0x1d'),this[_0xd1d2('0x1e')][_0xd1d2('0x19')](this));ami['on'](_0xd1d2('0x1f'),this[_0xd1d2('0x20')][_0xd1d2('0x19')](this));ami['on'](_0xd1d2('0x21'),this['syncAgentComplete']['bind'](this));ami['on'](_0xd1d2('0x22'),this['syncAgentConnect'][_0xd1d2('0x19')](this));ami['on'](_0xd1d2('0x23'),this[_0xd1d2('0x24')][_0xd1d2('0x19')](this));ami['on']('hangup',this['syncHangup'][_0xd1d2('0x19')](this));ami['on']('fullybooted',this['syncFullyBooted'][_0xd1d2('0x19')](this));ami['on'](_0xd1d2('0x25'),this[_0xd1d2('0x26')][_0xd1d2('0x19')](this));ami['on']('musiconholdstop',this[_0xd1d2('0x27')][_0xd1d2('0x19')](this));ami['on'](_0xd1d2('0x28'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xd1d2('0x29'),this[_0xd1d2('0x2a')][_0xd1d2('0x19')](this));this[_0xd1d2('0x2b')]();this[_0xd1d2('0x2c')]();}function clearChannels(_0x33a171){if(!_[_0xd1d2('0x2d')](_0x33a171)){for(var _0x5df4af in _0x33a171){if(_0x33a171[_0xd1d2('0x2e')](_0x5df4af)){delete _0x33a171[_0x5df4af];}}}}function clearCampaigns(_0x42da6d){if(!_[_0xd1d2('0x2d')](_0x42da6d)){for(var _0x2e1709 in _0x42da6d){if(_0x42da6d[_0xd1d2('0x2e')](_0x2e1709)){_0x42da6d[_0x2e1709][_0xd1d2('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x28b8be){if(!_[_0xd1d2('0x2d')](_0x28b8be)){for(var _0xe6ef3c in _0x28b8be){if(_0x28b8be[_0xd1d2('0x2e')](_0xe6ef3c)){_0x28b8be[_0xe6ef3c][_0xd1d2('0x2f')]=0x0;_0x28b8be[_0xe6ef3c]['talking']=0x0;_0x28b8be[_0xe6ef3c]['pTalking']=0x0;_0x28b8be[_0xe6ef3c][_0xd1d2('0x30')]=0x0;_0x28b8be[_0xe6ef3c][_0xd1d2('0x31')]=!![];}}}}function clearAgentBooked(_0x1e6072){if(!_[_0xd1d2('0x2d')](_0x1e6072)){for(var _0xc815ea in _0x1e6072){if(_0x1e6072['hasOwnProperty'](_0xc815ea)){_0x1e6072[_0xc815ea][_0xd1d2('0x32')]=!![];}}}}VoiceQueueReport[_0xd1d2('0xb')][_0xd1d2('0x33')]=function(){var _0x4b4134=this;for(var _0x19db00 in this[_0xd1d2('0x12')]){if(this[_0xd1d2('0x12')]['hasOwnProperty'](_0x19db00)&&!this[_0xd1d2('0x12')][_0x19db00][_0xd1d2('0x34')]){this[_0xd1d2('0xf')][_0xd1d2('0xc')](function(){if(!_[_0xd1d2('0x35')](_0x4b4134[_0xd1d2('0x12')][_0x19db00])){return ami[_0xd1d2('0x36')]({'action':_0xd1d2('0x37'),'channel':_0x4b4134[_0xd1d2('0x12')][_0x19db00][_0xd1d2('0x38')]})[_0xd1d2('0x39')](function(_0x1246d3){if(_0x1246d3[_0xd1d2('0x3a')]===_0xd1d2('0x3b')){setTimeout(function(){if(_0x4b4134[_0xd1d2('0x12')][_0x19db00]){delete _0x4b4134[_0xd1d2('0x12')][_0x19db00];logger[_0xd1d2('0x3c')](_0xd1d2('0x3d'),_0x19db00,util['inspect'](_0x1246d3,{'showHidden':![],'depth':null}));}if(_0x4b4134[_0xd1d2('0x10')][_0x19db00]){delete _0x4b4134[_0xd1d2('0x10')][_0x19db00];logger[_0xd1d2('0x3c')]('[%s][voiceQueueReport][checkQueueReport]',_0x19db00,util[_0xd1d2('0x3e')](_0x1246d3,{'showHidden':![],'depth':null}));}if(_0x4b4134['variables'][_0x19db00]){delete _0x4b4134['variables'][_0x19db00];logger[_0xd1d2('0x3c')](_0xd1d2('0x3f'),_0x19db00,util[_0xd1d2('0x3e')](_0x1246d3,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xd1d2('0xb')][_0xd1d2('0x40')]=function(){logger[_0xd1d2('0x3c')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0xd1d2('0x12')]);this[_0xd1d2('0x41')](this['queueReports']);clearAgentBooked(this[_0xd1d2('0x11')]);clearVoiceQueues(this[_0xd1d2('0x13')]);clearCampaigns(this[_0xd1d2('0x15')]);};VoiceQueueReport[_0xd1d2('0xb')]['clearQueueReport']=function(_0x5441ac){var _0x2fd2c5=this;if(!_['isEmpty'](_0x5441ac)){for(var _0x55b3d4 in _0x5441ac){if(_0x5441ac['hasOwnProperty'](_0x55b3d4)){_0x2fd2c5[_0xd1d2('0x42')](_0x5441ac[_0x55b3d4],'clearqueuereport');delete _0x5441ac[_0x55b3d4];}}}};VoiceQueueReport[_0xd1d2('0xb')]['emit']=function(_0x47996a,_0x4bcea4,_0x2dabfa){io['to'](_0x47996a)[_0xd1d2('0x43')](_0x4bcea4,_0x2dabfa);};VoiceQueueReport[_0xd1d2('0xb')][_0xd1d2('0x44')]=function(_0x33ba30,_0xb5bec2){logger[_0xd1d2('0x45')](_0xd1d2('0x46')+_0xb5bec2+_0xd1d2('0x47'),_0x33ba30[_0xd1d2('0x48')],util[_0xd1d2('0x3e')](_0x33ba30,{'showHidden':![],'depth':null}));this[_0xd1d2('0x43')](util[_0xd1d2('0x49')](_0xd1d2('0x4a'),_0x33ba30['name']),'voice_queue_channel:save',_0x33ba30);io[_0xd1d2('0x43')](_0xd1d2('0x4b'),_0x33ba30);};VoiceQueueReport[_0xd1d2('0xb')]['emitVoiceQueueChannelRemove']=function(_0x4f70c1,_0x43c574){logger[_0xd1d2('0x45')]('[%s][voiceQueueReport]['+_0x43c574+_0xd1d2('0x4c'),_0x4f70c1['uniqueid'],util['inspect'](_0x4f70c1,{'showHidden':![],'depth':null}));this[_0xd1d2('0x43')](util['format']('voice:queue:%s',_0x4f70c1[_0xd1d2('0x4d')]),_0xd1d2('0x4e'),_0x4f70c1);io[_0xd1d2('0x43')]('voice_queue_presence:remove',_0x4f70c1);};VoiceQueueReport[_0xd1d2('0xb')][_0xd1d2('0x4f')]=function(_0x30387d,_0x441f15){if(_0x30387d['type']===_0xd1d2('0x50')){var _0x40c6dc={'id':_0x30387d['id'],'name':_0x30387d['name'],'strategy':_0x30387d[_0xd1d2('0x51')],'answered':_0x30387d['answered'],'available':_0x30387d[_0xd1d2('0x52')],'loggedIn':_0x30387d[_0xd1d2('0x53')],'pTalking':_0x30387d[_0xd1d2('0x54')],'sumBillable':_0x30387d[_0xd1d2('0x55')],'sumDuration':_0x30387d[_0xd1d2('0x56')],'sumHoldTime':_0x30387d['sumHoldTime']||0x0,'talking':_0x30387d['talking'],'total':_0x30387d[_0xd1d2('0x57')],'type':_0x30387d[_0xd1d2('0x58')],'unmanaged':_0x30387d['unmanaged'],'abandoned':_0x30387d[_0xd1d2('0x59')],'waiting':_0x30387d[_0xd1d2('0x30')]};if(_0x30387d[_0xd1d2('0x5a')]){_0x40c6dc[_0xd1d2('0x5a')]={'id':_0x30387d[_0xd1d2('0x5a')]['id'],'name':_0x30387d[_0xd1d2('0x5a')][_0xd1d2('0x4d')],'active':_0x30387d['Trunk'][_0xd1d2('0x5b')],'callerid':_0x30387d[_0xd1d2('0x5a')]['callerid']};}if(_0x30387d[_0xd1d2('0x5c')]){_0x40c6dc[_0xd1d2('0x5c')]={'id':_0x30387d['Interval']['id'],'name':_0x30387d['Interval'][_0xd1d2('0x4d')]};}var _0x182ea8=md5(JSON['stringify'](_0x40c6dc));if(_0x30387d[_0xd1d2('0x3')]!==_0x182ea8){_0x30387d[_0xd1d2('0x3')]=_0x182ea8;logger[_0xd1d2('0x45')](_0xd1d2('0x5d')+_0x441f15+_0xd1d2('0x5e'),util['inspect'](_0x40c6dc,{'showHidden':![],'depth':null}));this['emit'](util[_0xd1d2('0x49')]('voice:queue:%s',_0x40c6dc[_0xd1d2('0x4d')]),_0xd1d2('0x5f'),_0x40c6dc);}}};VoiceQueueReport['prototype'][_0xd1d2('0x60')]=function(_0x35d724){return _0x35d724!==null&&!_['isUndefined'](_0x35d724);};VoiceQueueReport['prototype'][_0xd1d2('0x2c')]=function(){var _0x20ab8b=this;setInterval(function(){_0x20ab8b[_0xd1d2('0x33')]();ami[_0xd1d2('0x36')]({'action':_0xd1d2('0x61')})[_0xd1d2('0x39')](function(_0x1f6150){logger[_0xd1d2('0x3c')](_0xd1d2('0x62'),util['inspect'](_0x1f6150,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xd1d2('0xb')]['loopQueueSummary']=function(){var _0x55c44f=this;setInterval(function(){if(_0x55c44f[_0xd1d2('0x14')]){return ami[_0xd1d2('0x36')]({'action':_0xd1d2('0x17')})[_0xd1d2('0x63')](function(_0x215dea){_0x55c44f[_0xd1d2('0x14')]=![];})[_0xd1d2('0x39')](function(_0x43f756){logger[_0xd1d2('0x3c')](_0xd1d2('0x64'),util[_0xd1d2('0x3e')](_0x43f756,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xd1d2('0xb')][_0xd1d2('0x18')]=function(_0x5b2a26){try{if(this['isNotNull'](_0x5b2a26)&&this[_0xd1d2('0x60')](_0x5b2a26[_0xd1d2('0x65')])){logger[_0xd1d2('0x45')](_0xd1d2('0x66'),util[_0xd1d2('0x3e')](_0x5b2a26,{'showHidden':![],'depth':null}));if(this[_0xd1d2('0x13')][_0x5b2a26[_0xd1d2('0x65')]]){logger[_0xd1d2('0x67')](_0xd1d2('0x68'),_0x5b2a26[_0xd1d2('0x65')]);var _0x1788cd=_['countBy'](this['channels'],_0xd1d2('0x65'))[_0x5b2a26[_0xd1d2('0x65')]]||0x0;var _0x3d1da1=_0x1788cd-_0x5b2a26[_0xd1d2('0x69')];if(this['voiceQueues'][_0x5b2a26[_0xd1d2('0x65')]][_0xd1d2('0x30')]!==_[_0xd1d2('0x6a')](_0x5b2a26[_0xd1d2('0x69')])||this[_0xd1d2('0x13')][_0x5b2a26[_0xd1d2('0x65')]][_0xd1d2('0x53')]!==_['toNumber'](_0x5b2a26[_0xd1d2('0x6b')])||this[_0xd1d2('0x13')][_0x5b2a26[_0xd1d2('0x65')]]['available']!==_['toNumber'](_0x5b2a26[_0xd1d2('0x52')])||this[_0xd1d2('0x13')][_0x5b2a26[_0xd1d2('0x65')]][_0xd1d2('0x6c')]!==_0x3d1da1){this['voiceQueues'][_0x5b2a26[_0xd1d2('0x65')]][_0xd1d2('0x30')]=_[_0xd1d2('0x6a')](_0x5b2a26['callers']);this[_0xd1d2('0x13')][_0x5b2a26[_0xd1d2('0x65')]]['loggedIn']=_[_0xd1d2('0x6a')](_0x5b2a26[_0xd1d2('0x6b')]);this[_0xd1d2('0x13')][_0x5b2a26[_0xd1d2('0x65')]]['available']=_[_0xd1d2('0x6a')](_0x5b2a26[_0xd1d2('0x52')]);this[_0xd1d2('0x13')][_0x5b2a26[_0xd1d2('0x65')]][_0xd1d2('0x6c')]=_0x3d1da1>0x0?_0x3d1da1:0x0;this['voiceQueues'][_0x5b2a26['queue']]['talking']=this['voiceQueues'][_0x5b2a26['queue']][_0xd1d2('0x6c')]>_[_0xd1d2('0x6a')](_0x5b2a26[_0xd1d2('0x6b')])?_['toNumber'](_0x5b2a26[_0xd1d2('0x6b')]):this[_0xd1d2('0x13')][_0x5b2a26[_0xd1d2('0x65')]]['talking'];this[_0xd1d2('0x4f')](this[_0xd1d2('0x13')][_0x5b2a26[_0xd1d2('0x65')]],_0xd1d2('0x17'));}logger[_0xd1d2('0x45')](_0xd1d2('0x6d'),util['inspect'](this[_0xd1d2('0x13')][_0x5b2a26[_0xd1d2('0x65')]],{'showHidden':![],'depth':null}));ami['emit']('custom:queuesummary',this[_0xd1d2('0x13')][_0x5b2a26[_0xd1d2('0x65')]]);}}}catch(_0x34877f){logger[_0xd1d2('0x3c')]('[voiceQueueReport][queuesummary]',util[_0xd1d2('0x3e')](_0x34877f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd1d2('0xb')][_0xd1d2('0x6e')]=function(_0xeb221d){logger['debug'](_0xd1d2('0x6f'),util[_0xd1d2('0x3e')](_0xeb221d,{'showHidden':![],'depth':null}));this[_0xd1d2('0x14')]=!![];};VoiceQueueReport['prototype'][_0xd1d2('0x1c')]=function(_0x1ae9af){try{if(this['isNotNull'](_0x1ae9af)){logger[_0xd1d2('0x45')](_0xd1d2('0x70'),_0x1ae9af[_0xd1d2('0x48')],util[_0xd1d2('0x3e')](_0x1ae9af,{'showHidden':![],'depth':null}));if(_[_0xd1d2('0x71')](this['queueReports'][_0x1ae9af[_0xd1d2('0x48')]])){this['queueReports'][_0x1ae9af['uniqueid']]=[];this['channels'][_0x1ae9af['uniqueid']]={};}var _0x89ec63=new QueueReport();_0x89ec63['name']=_0x1ae9af[_0xd1d2('0x65')];_0x89ec63['type']=this[_0xd1d2('0x13')][_0x89ec63[_0xd1d2('0x4d')]]&&this[_0xd1d2('0x13')][_0x89ec63[_0xd1d2('0x4d')]][_0xd1d2('0x58')]?this[_0xd1d2('0x13')][_0x89ec63['name']][_0xd1d2('0x58')]||_0xd1d2('0x50'):_0xd1d2('0x50');_0x89ec63[_0xd1d2('0x65')]=_0x1ae9af[_0xd1d2('0x65')];_0x89ec63[_0xd1d2('0x72')]=moment()[_0xd1d2('0x49')](_0xd1d2('0x73'));_0x89ec63[_0xd1d2('0x74')]=_0x1ae9af[_0xd1d2('0x74')];_0x89ec63['count']=_0x1ae9af[_0xd1d2('0x75')];_0x89ec63[_0xd1d2('0x48')]=_0x1ae9af[_0xd1d2('0x48')];logger[_0xd1d2('0x67')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x89ec63[_0xd1d2('0x4d')],_0x89ec63[_0xd1d2('0x58')]);_[_0xd1d2('0x76')](_0x89ec63,_['pick'](_0x1ae9af,_[_0xd1d2('0x77')](_0x89ec63)));this[_0xd1d2('0x10')][_0x1ae9af['uniqueid']]['push'](_0x89ec63);this[_0xd1d2('0x12')][_0x1ae9af[_0xd1d2('0x48')]]=_0x89ec63;this[_0xd1d2('0x44')](_0x89ec63,_0xd1d2('0x1b'));}}catch(_0x348b1d){logger[_0xd1d2('0x3c')](_0xd1d2('0x70'),_0x1ae9af['uniqueid'],util[_0xd1d2('0x3e')](_0x348b1d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd1d2('0xb')][_0xd1d2('0x1e')]=function(_0x24b8d1){try{if(this[_0xd1d2('0x60')](_0x24b8d1)){logger[_0xd1d2('0x45')](_0xd1d2('0x78'),_0x24b8d1[_0xd1d2('0x48')],util[_0xd1d2('0x3e')](_0x24b8d1,{'showHidden':![],'depth':null}));if(this[_0xd1d2('0x10')][_0x24b8d1[_0xd1d2('0x48')]]){var _0x162249=_[_0xd1d2('0x79')](this[_0xd1d2('0x10')][_0x24b8d1['uniqueid']]);_0x162249[_0xd1d2('0x7a')]=![];_0x162249[_0xd1d2('0x7b')]=null;_0x162249[_0xd1d2('0x7c')]=_0x24b8d1[_0xd1d2('0x7c')];_0x162249[_0xd1d2('0x7d')]=_0x24b8d1[_0xd1d2('0x7d')];_0x162249[_0xd1d2('0x1d')]=!![];_0x162249[_0xd1d2('0x7e')]=moment()[_0xd1d2('0x49')](_0xd1d2('0x73'));_0x162249[_0xd1d2('0x7f')]=_0xd1d2('0x80');_0x162249[_0xd1d2('0x81')]=null;logger['info'](_0xd1d2('0x82'),_0x162249[_0xd1d2('0x4d')],_0x162249[_0xd1d2('0x58')]);this[_0xd1d2('0x12')][_0x24b8d1[_0xd1d2('0x48')]]=_0x162249;this[_0xd1d2('0x42')](_0x162249,_0xd1d2('0x1d'));}}}catch(_0x81720b){logger[_0xd1d2('0x3c')](_0xd1d2('0x78'),_0x24b8d1[_0xd1d2('0x48')],util[_0xd1d2('0x3e')](_0x81720b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd1d2('0x20')]=function(_0x234262){try{if(this[_0xd1d2('0x60')](_0x234262)){logger[_0xd1d2('0x45')](_0xd1d2('0x83'),_0x234262['uniqueid'],util[_0xd1d2('0x3e')](_0x234262,{'showHidden':![],'depth':null}));if(this[_0xd1d2('0x10')][_0x234262[_0xd1d2('0x48')]]){var _0x720693=_['last'](this[_0xd1d2('0x10')][_0x234262[_0xd1d2('0x48')]]);_0x720693[_0xd1d2('0x84')]=moment()[_0xd1d2('0x49')](_0xd1d2('0x73'));_0x720693[_0xd1d2('0x85')]=_0x234262[_0xd1d2('0x85')];_0x720693['connectedlinename']=_0x234262[_0xd1d2('0x86')];logger[_0xd1d2('0x67')](_0xd1d2('0x87'),_0x720693[_0xd1d2('0x4d')],_0x720693[_0xd1d2('0x58')],_0x234262[_0xd1d2('0x85')],_0x234262[_0xd1d2('0x86')]);this[_0xd1d2('0x12')][_0x234262[_0xd1d2('0x48')]]=_0x720693;this[_0xd1d2('0x44')](_0x720693,_0xd1d2('0x1f'));}}}catch(_0x38f0c1){logger[_0xd1d2('0x3c')](_0xd1d2('0x83'),_0x234262[_0xd1d2('0x48')],util[_0xd1d2('0x3e')](_0x38f0c1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd1d2('0xb')]['syncAgentConnect']=function(_0x1555de){try{if(this['isNotNull'](_0x1555de)){logger[_0xd1d2('0x45')](_0xd1d2('0x88'),_0x1555de[_0xd1d2('0x48')],util[_0xd1d2('0x3e')](_0x1555de,{'showHidden':![],'depth':null}));if(this[_0xd1d2('0x10')][_0x1555de[_0xd1d2('0x48')]]){var _0x1489e5=_[_0xd1d2('0x79')](this['queueReports'][_0x1555de['uniqueid']]);_0x1489e5[_0xd1d2('0x7a')]=!![];_0x1489e5['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0xd1d2('0x67')](_0xd1d2('0x89'),_0x1489e5['name'],_0x1489e5[_0xd1d2('0x58')]);}}}catch(_0x279e3e){logger[_0xd1d2('0x3c')](_0xd1d2('0x88'),_0x1555de[_0xd1d2('0x48')],util[_0xd1d2('0x3e')](_0x279e3e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd1d2('0xb')]['syncAgentComplete']=function(_0x47185d){try{if(this['isNotNull'](_0x47185d)){logger[_0xd1d2('0x45')]('[%s][voiceQueueReport][agentcomplete]',_0x47185d[_0xd1d2('0x48')],util[_0xd1d2('0x3e')](_0x47185d,{'showHidden':![],'depth':null}));if(this[_0xd1d2('0x10')][_0x47185d[_0xd1d2('0x48')]]){var _0x431247=_[_0xd1d2('0x79')](this[_0xd1d2('0x10')][_0x47185d['uniqueid']]);_0x431247[_0xd1d2('0x1d')]=![];_0x431247[_0xd1d2('0x7e')]=null;_0x431247[_0xd1d2('0x8a')]=!![];_0x431247[_0xd1d2('0x81')]=_0x47185d['membername'];_0x431247[_0xd1d2('0x7c')]=_0x47185d[_0xd1d2('0x7c')];_0x431247[_0xd1d2('0x7a')]=!![];_0x431247['queuecallerexit']=![];_0x431247[_0xd1d2('0x8b')]=null;if(!_0x431247[_0xd1d2('0x8c')]){if(_0x47185d[_0xd1d2('0x8d')]==_0xd1d2('0x8c')){_0x431247[_0xd1d2('0x7f')]='COMPLETED';logger[_0xd1d2('0x67')](_0xd1d2('0x8e'),_0x431247['name'],_0x431247[_0xd1d2('0x58')]);}else{if(_[_0xd1d2('0x8f')](_0x47185d[_0xd1d2('0x38')][_0xd1d2('0x90')](),_0xd1d2('0x91'))){if(this['queueReports'][_0x47185d[_0xd1d2('0x92')]]){var _0xd118ad=_[_0xd1d2('0x79')](this[_0xd1d2('0x10')][_0x47185d[_0xd1d2('0x92')]]);_0xd118ad[_0xd1d2('0x7a')]=![];_0xd118ad[_0xd1d2('0x93')]=!![];_0xd118ad['queuecallerexitAt']=moment(_0x431247[_0xd1d2('0x72')])[_0xd1d2('0x94')](_0x47185d[_0xd1d2('0x7c')],'seconds')[_0xd1d2('0x49')](_0xd1d2('0x73'));_0xd118ad[_0xd1d2('0x7f')]=_0xd1d2('0x95');_0xd118ad['transfer']=!![];_0xd118ad[_0xd1d2('0x96')]=_0xd1d2('0x97');_0xd118ad['transferexten']=_0x47185d['destexten'];_0xd118ad[_0xd1d2('0x98')]=_0x47185d['uniqueid'];logger[_0xd1d2('0x67')](_0xd1d2('0x99'),_0xd118ad['name'],_0xd118ad['type']);var _0x199808=this['queueReports'][_0x47185d[_0xd1d2('0x92')]];this['queueReports'][_0x47185d['linkedid']]=this[_0xd1d2('0x10')][_0x47185d[_0xd1d2('0x48')]];this[_0xd1d2('0x10')][_0x47185d[_0xd1d2('0x48')]]=_0x199808;}}else{_0x431247[_0xd1d2('0x7f')]=_0xd1d2('0x9a')+_0x47185d['reason']['toUpperCase']();logger[_0xd1d2('0x67')](_0xd1d2('0x9b'),_0x431247[_0xd1d2('0x4d')],_0x431247[_0xd1d2('0x58')],_0x431247[_0xd1d2('0x7f')]);}}}this[_0xd1d2('0x12')][_0x47185d[_0xd1d2('0x48')]]=_0x431247;this['emitVoiceQueueChannelRemove'](_0x431247,_0xd1d2('0x21'));}}}catch(_0x595264){logger[_0xd1d2('0x3c')](_0xd1d2('0x9c'),_0x47185d['uniqueid'],util[_0xd1d2('0x3e')](_0x595264,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd1d2('0xb')][_0xd1d2('0x24')]=function(_0xdebec0){try{if(this[_0xd1d2('0x60')](_0xdebec0)){logger[_0xd1d2('0x45')](_0xd1d2('0x9d'),_0xdebec0[_0xd1d2('0x48')],util[_0xd1d2('0x3e')](_0xdebec0,{'showHidden':![],'depth':null}));this[_0xd1d2('0x9e')](_0xdebec0[_0xd1d2('0x48')],_[_0xd1d2('0x77')](_0xdebec0['variable'])[0x0],_0xdebec0[_0xd1d2('0x9f')]);if(this[_0xd1d2('0x10')][_0xdebec0[_0xd1d2('0x48')]]){var _0xe066fc=_[_0xd1d2('0x79')](this[_0xd1d2('0x10')][_0xdebec0[_0xd1d2('0x48')]]);if(_0xe066fc){if(this[_0xd1d2('0x60')](_0xdebec0[_0xd1d2('0xa0')])&&this[_0xd1d2('0x60')](_0xdebec0[_0xd1d2('0xa0')][_0xd1d2('0xa1')])){switch(_0xdebec0[_0xd1d2('0x9f')]){case _0xd1d2('0xa2'):_0xe066fc[_0xd1d2('0x93')]=![];_0xe066fc[_0xd1d2('0x8b')]=null;break;case'TIMEOUT':_0xe066fc[_0xd1d2('0xa3')]='timeout';_0xe066fc[_0xd1d2('0x93')]=!![];_0xe066fc[_0xd1d2('0x8b')]=moment()[_0xd1d2('0x49')](_0xd1d2('0x73'));_0xe066fc[_0xd1d2('0x84')]=moment()[_0xd1d2('0x49')](_0xd1d2('0x73'));logger[_0xd1d2('0x45')](_0xd1d2('0xa4'),_0xdebec0['uniqueid'],util['inspect'](_0xe066fc,{'showHidden':![],'depth':null}));ami['emit'](_0xd1d2('0xa5'),_0xe066fc);break;default:_0xe066fc[_0xd1d2('0x93')]=!![];_0xe066fc[_0xd1d2('0x8b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xe066fc[_0xd1d2('0x84')]=moment()[_0xd1d2('0x49')](_0xd1d2('0x73'));}_0xe066fc['queuecallerabandon']=![];_0xe066fc[_0xd1d2('0x7e')]=null;_0xe066fc['queuecallerexitreason']=_0xdebec0[_0xd1d2('0x9f')];this['channels'][_0xdebec0[_0xd1d2('0x48')]]=_0xe066fc;this[_0xd1d2('0x42')](_0xe066fc,_0xd1d2('0x23'));}else if(this[_0xd1d2('0x60')](_0xdebec0[_0xd1d2('0xa0')])&&this['isNotNull'](_0xdebec0[_0xd1d2('0xa0')]['queueposition'])){if(!_0xe066fc['queuecallerabandon']){_0xe066fc[_0xd1d2('0x93')]=!![];_0xe066fc[_0xd1d2('0x8b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xe066fc[_0xd1d2('0x7f')]=_0xd1d2('0xa6');_0xe066fc[_0xd1d2('0x84')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xd1d2('0x12')][_0xdebec0[_0xd1d2('0x48')]]=_0xe066fc;}}logger[_0xd1d2('0x67')](_0xd1d2('0xa7'),_0xdebec0[_0xd1d2('0x48')],_0xe066fc[_0xd1d2('0x4d')],_0xe066fc[_0xd1d2('0x58')],_[_0xd1d2('0x77')](_0xdebec0['variable'])[0x0],_0xdebec0[_0xd1d2('0x9f')]);_0xe066fc[_0xd1d2('0x16')]=this['variables'][_0xdebec0[_0xd1d2('0x48')]];}}}}catch(_0x32f50e){logger[_0xd1d2('0x3c')](_0xd1d2('0x9d'),_0xdebec0['uniqueid'],util[_0xd1d2('0x3e')](_0x32f50e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd1d2('0x9e')]=function(_0x17b8d0,_0x50d856,_0x39cddb){var _0x1bcf62=['rtpaudioqos',_0xd1d2('0xa8'),'rtpaudioqosjitter',_0xd1d2('0xa9'),_0xd1d2('0xaa'),'rtpaudioqoslossbridged',_0xd1d2('0xab'),_0xd1d2('0xac'),_0xd1d2('0xad'),_0xd1d2('0xae'),'bridgepeer','bridgepvtcallid','membercalls','memberdynamic',_0xd1d2('0xaf'),_0xd1d2('0xb0'),_0xd1d2('0xb1'),_0xd1d2('0xb2'),'memberrealtime'];if(!_[_0xd1d2('0x35')](_0x50d856)&&!_['includes'](_0x1bcf62,_0x50d856)){if(_[_0xd1d2('0x71')](this[_0xd1d2('0x16')][_0x17b8d0])){this[_0xd1d2('0x16')][_0x17b8d0]={};}this[_0xd1d2('0x16')][_0x17b8d0][_0x50d856]=_0x39cddb;}};VoiceQueueReport[_0xd1d2('0xb')]['syncHangup']=function(_0x183d20){try{if(this['isNotNull'](_0x183d20)){logger['debug'](_0xd1d2('0xb3'),_0x183d20['uniqueid'],util['inspect'](_0x183d20,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x183d20[_0xd1d2('0x48')]]){for(var _0x5ba582=0x0,_0x5e16cc={};_0x5ba5820x0?_0x4d86d4:0x0;this[_0x0999('0x12')][_0x43194e[_0x0999('0x6b')]][_0x0999('0x30')]=this[_0x0999('0x12')][_0x43194e['queue']][_0x0999('0x30')]>_[_0x0999('0x70')](_0x43194e['loggedin'])?_[_0x0999('0x70')](_0x43194e[_0x0999('0x71')]):this[_0x0999('0x12')][_0x43194e[_0x0999('0x6b')]]['talking'];this[_0x0999('0x50')](this[_0x0999('0x12')][_0x43194e[_0x0999('0x6b')]],'queuesummary');}logger['debug'](_0x0999('0x72'),util[_0x0999('0x3b')](this[_0x0999('0x12')][_0x43194e['queue']],{'showHidden':![],'depth':null}));ami[_0x0999('0x42')](_0x0999('0x73'),this[_0x0999('0x12')][_0x43194e['queue']]);}}}catch(_0x5cdd52){logger[_0x0999('0x3d')](_0x0999('0x69'),util[_0x0999('0x3b')](_0x5cdd52,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x19')]=function(_0x5e10bf){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x0999('0x3b')](_0x5e10bf,{'showHidden':![],'depth':null}));this[_0x0999('0x13')]=!![];};VoiceQueueReport[_0x0999('0xb')]['syncQueueCallerJoin']=function(_0x40473d){try{if(this[_0x0999('0x62')](_0x40473d)){logger[_0x0999('0x4c')]('[%s][voiceQueueReport][queuecallerjoin]',_0x40473d[_0x0999('0x46')],util[_0x0999('0x3b')](_0x40473d,{'showHidden':![],'depth':null}));if(_[_0x0999('0x63')](this['queueReports'][_0x40473d['uniqueid']])){this[_0x0999('0x3c')][_0x40473d['uniqueid']]=[];this[_0x0999('0x11')][_0x40473d['uniqueid']]={};}var _0x189f3f=new QueueReport();_0x189f3f[_0x0999('0x49')]=_0x40473d[_0x0999('0x6b')];_0x189f3f['type']=this[_0x0999('0x12')][_0x189f3f['name']]&&this[_0x0999('0x12')][_0x189f3f[_0x0999('0x49')]][_0x0999('0x51')]?this[_0x0999('0x12')][_0x189f3f[_0x0999('0x49')]][_0x0999('0x51')]||_0x0999('0x52'):_0x0999('0x52');_0x189f3f[_0x0999('0x6b')]=_0x40473d[_0x0999('0x6b')];_0x189f3f[_0x0999('0x74')]=moment()[_0x0999('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x189f3f[_0x0999('0x75')]=_0x40473d[_0x0999('0x75')];_0x189f3f['count']=_0x40473d[_0x0999('0x76')];_0x189f3f[_0x0999('0x46')]=_0x40473d[_0x0999('0x46')];logger[_0x0999('0x6d')](_0x0999('0x77'),_0x189f3f[_0x0999('0x49')],_0x189f3f[_0x0999('0x51')]);_[_0x0999('0x78')](_0x189f3f,_[_0x0999('0x79')](_0x40473d,_['keys'](_0x189f3f)));this[_0x0999('0x3c')][_0x40473d['uniqueid']][_0x0999('0x7a')](_0x189f3f);this[_0x0999('0x11')][_0x40473d[_0x0999('0x46')]]=_0x189f3f;this[_0x0999('0x43')](_0x189f3f,_0x0999('0x1a'));}}catch(_0x48ba0d){logger[_0x0999('0x3d')]('[%s][voiceQueueReport][queuecallerjoin]',_0x40473d[_0x0999('0x46')],util[_0x0999('0x3b')](_0x48ba0d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x1c')]=function(_0xe47622){try{if(this[_0x0999('0x62')](_0xe47622)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0xe47622[_0x0999('0x46')],util[_0x0999('0x3b')](_0xe47622,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xe47622[_0x0999('0x46')]]){var _0x1d7821=_[_0x0999('0x7b')](this['queueReports'][_0xe47622[_0x0999('0x46')]]);_0x1d7821[_0x0999('0x7c')]=![];_0x1d7821['queuecallercompleteAt']=null;_0x1d7821[_0x0999('0x7d')]=_0xe47622[_0x0999('0x7d')];_0x1d7821['originalposition']=_0xe47622[_0x0999('0x7e')];_0x1d7821[_0x0999('0x1b')]=!![];_0x1d7821[_0x0999('0x7f')]=moment()['format'](_0x0999('0x80'));_0x1d7821['queuecallerexitreason']='ABANDONED';_0x1d7821[_0x0999('0x81')]=null;logger['info'](_0x0999('0x82'),_0x1d7821[_0x0999('0x49')],_0x1d7821[_0x0999('0x51')]);this[_0x0999('0x11')][_0xe47622[_0x0999('0x46')]]=_0x1d7821;this[_0x0999('0x40')](_0x1d7821,_0x0999('0x1b'));}}}catch(_0x5d4de3){logger[_0x0999('0x3d')]('[%s][voiceQueueReport][queuecallerabandon]',_0xe47622['uniqueid'],util[_0x0999('0x3b')](_0x5d4de3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x1e')]=function(_0x5d002c){try{if(this['isNotNull'](_0x5d002c)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x5d002c[_0x0999('0x46')],util[_0x0999('0x3b')](_0x5d002c,{'showHidden':![],'depth':null}));if(this[_0x0999('0x3c')][_0x5d002c['uniqueid']]){var _0x8270f7=_[_0x0999('0x7b')](this[_0x0999('0x3c')][_0x5d002c[_0x0999('0x46')]]);_0x8270f7[_0x0999('0x83')]=moment()['format'](_0x0999('0x80'));_0x8270f7['connectedlinenum']=_0x5d002c[_0x0999('0x84')];_0x8270f7[_0x0999('0x85')]=_0x5d002c[_0x0999('0x85')];logger[_0x0999('0x6d')](_0x0999('0x86'),_0x8270f7[_0x0999('0x49')],_0x8270f7[_0x0999('0x51')],_0x5d002c[_0x0999('0x84')],_0x5d002c[_0x0999('0x85')]);this[_0x0999('0x11')][_0x5d002c['uniqueid']]=_0x8270f7;this[_0x0999('0x43')](_0x8270f7,_0x0999('0x1d'));}}}catch(_0x17d9ec){logger[_0x0999('0x3d')](_0x0999('0x87'),_0x5d002c[_0x0999('0x46')],util[_0x0999('0x3b')](_0x17d9ec,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x20')]=function(_0x10c2c6){try{if(this[_0x0999('0x62')](_0x10c2c6)){logger[_0x0999('0x4c')](_0x0999('0x88'),_0x10c2c6[_0x0999('0x46')],util[_0x0999('0x3b')](_0x10c2c6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x10c2c6[_0x0999('0x46')]]){var _0x247221=_['last'](this[_0x0999('0x3c')][_0x10c2c6[_0x0999('0x46')]]);_0x247221[_0x0999('0x7c')]=!![];_0x247221[_0x0999('0x89')]=_0x0999('0x8a');logger[_0x0999('0x6d')](_0x0999('0x8b'),_0x247221[_0x0999('0x49')],_0x247221['type']);}}}catch(_0x1ede04){logger['error'](_0x0999('0x88'),_0x10c2c6['uniqueid'],util[_0x0999('0x3b')](_0x1ede04,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x1f')]=function(_0x14bf9c){try{if(this[_0x0999('0x62')](_0x14bf9c)){logger[_0x0999('0x4c')](_0x0999('0x8c'),_0x14bf9c['uniqueid'],util[_0x0999('0x3b')](_0x14bf9c,{'showHidden':![],'depth':null}));if(this[_0x0999('0x3c')][_0x14bf9c[_0x0999('0x46')]]){var _0x2e2b27=_['last'](this[_0x0999('0x3c')][_0x14bf9c['uniqueid']]);_0x2e2b27[_0x0999('0x1b')]=![];_0x2e2b27[_0x0999('0x7f')]=null;_0x2e2b27[_0x0999('0x8d')]=!![];_0x2e2b27['lastAssignedTo']=_0x14bf9c[_0x0999('0x8e')];_0x2e2b27[_0x0999('0x7d')]=_0x14bf9c[_0x0999('0x7d')];_0x2e2b27['queuecallercomplete']=!![];_0x2e2b27[_0x0999('0x8f')]=![];_0x2e2b27[_0x0999('0x90')]=null;if(!_0x2e2b27[_0x0999('0x91')]){if(_0x14bf9c[_0x0999('0x92')]=='transfer'){_0x2e2b27[_0x0999('0x89')]=_0x0999('0x93');logger[_0x0999('0x6d')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x2e2b27[_0x0999('0x49')],_0x2e2b27['type']);}else{if(_['startsWith'](_0x14bf9c[_0x0999('0x38')][_0x0999('0x94')](),_0x0999('0x95'))){if(this[_0x0999('0x3c')][_0x14bf9c[_0x0999('0x96')]]){var _0x55aca9=_[_0x0999('0x7b')](this[_0x0999('0x3c')][_0x14bf9c[_0x0999('0x96')]]);_0x55aca9[_0x0999('0x7c')]=![];_0x55aca9[_0x0999('0x8f')]=!![];_0x55aca9['queuecallerexitAt']=moment(_0x2e2b27[_0x0999('0x74')])[_0x0999('0x97')](_0x14bf9c['holdtime'],'seconds')[_0x0999('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x55aca9['queuecallerexitreason']=_0x0999('0x98');_0x55aca9['transfer']=!![];_0x55aca9[_0x0999('0x99')]=_0x0999('0x9a');_0x55aca9[_0x0999('0x9b')]=_0x14bf9c[_0x0999('0x9c')];_0x55aca9['transferuniqueid']=_0x14bf9c[_0x0999('0x46')];logger[_0x0999('0x6d')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x55aca9[_0x0999('0x49')],_0x55aca9['type']);var _0x50e697=this[_0x0999('0x3c')][_0x14bf9c[_0x0999('0x96')]];this[_0x0999('0x3c')][_0x14bf9c[_0x0999('0x96')]]=this[_0x0999('0x3c')][_0x14bf9c[_0x0999('0x46')]];this[_0x0999('0x3c')][_0x14bf9c[_0x0999('0x46')]]=_0x50e697;}}else{_0x2e2b27[_0x0999('0x89')]='COMPLETEDBY'+_0x14bf9c[_0x0999('0x92')]['toUpperCase']();logger[_0x0999('0x6d')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x2e2b27['name'],_0x2e2b27[_0x0999('0x51')],_0x2e2b27['queuecallerexitreason']);}}}this[_0x0999('0x11')][_0x14bf9c[_0x0999('0x46')]]=_0x2e2b27;this[_0x0999('0x40')](_0x2e2b27,_0x0999('0x9d'));}}}catch(_0x208b17){logger[_0x0999('0x3d')](_0x0999('0x8c'),_0x14bf9c[_0x0999('0x46')],util[_0x0999('0x3b')](_0x208b17,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x21')]=function(_0xcc3b62){try{if(this[_0x0999('0x62')](_0xcc3b62)){logger[_0x0999('0x4c')](_0x0999('0x9e'),_0xcc3b62[_0x0999('0x46')],util[_0x0999('0x3b')](_0xcc3b62,{'showHidden':![],'depth':null}));this[_0x0999('0x9f')](_0xcc3b62[_0x0999('0x46')],_[_0x0999('0xa0')](_0xcc3b62[_0x0999('0xa1')])[0x0],_0xcc3b62[_0x0999('0xa2')]);if(this[_0x0999('0x3c')][_0xcc3b62['uniqueid']]){var _0x52e2f8=_['last'](this['queueReports'][_0xcc3b62[_0x0999('0x46')]]);if(_0x52e2f8){if(this[_0x0999('0x62')](_0xcc3b62[_0x0999('0xa1')])&&this[_0x0999('0x62')](_0xcc3b62['variable'][_0x0999('0xa3')])){switch(_0xcc3b62[_0x0999('0xa2')]){case'CONTINUE':_0x52e2f8['queuecallerexit']=![];_0x52e2f8[_0x0999('0x90')]=null;break;case'TIMEOUT':_0x52e2f8[_0x0999('0xa4')]=_0x0999('0xa5');_0x52e2f8[_0x0999('0x8f')]=!![];_0x52e2f8[_0x0999('0x90')]=moment()['format'](_0x0999('0x80'));_0x52e2f8[_0x0999('0x83')]=moment()['format'](_0x0999('0x80'));logger[_0x0999('0x4c')](_0x0999('0xa6'),_0xcc3b62[_0x0999('0x46')],util[_0x0999('0x3b')](_0x52e2f8,{'showHidden':![],'depth':null}));ami[_0x0999('0x42')]('custom:timeout',_0x52e2f8);break;default:_0x52e2f8[_0x0999('0x8f')]=!![];_0x52e2f8[_0x0999('0x90')]=moment()[_0x0999('0x47')](_0x0999('0x80'));_0x52e2f8[_0x0999('0x83')]=moment()[_0x0999('0x47')](_0x0999('0x80'));}_0x52e2f8[_0x0999('0x1b')]=![];_0x52e2f8[_0x0999('0x7f')]=null;_0x52e2f8[_0x0999('0x89')]=_0xcc3b62[_0x0999('0xa2')];this[_0x0999('0x11')][_0xcc3b62[_0x0999('0x46')]]=_0x52e2f8;this[_0x0999('0x40')](_0x52e2f8,_0x0999('0xa7'));}else if(this['isNotNull'](_0xcc3b62[_0x0999('0xa1')])&&this['isNotNull'](_0xcc3b62[_0x0999('0xa1')][_0x0999('0xa8')])){if(!_0x52e2f8[_0x0999('0x1b')]){_0x52e2f8[_0x0999('0x8f')]=!![];_0x52e2f8[_0x0999('0x90')]=moment()[_0x0999('0x47')](_0x0999('0x80'));_0x52e2f8[_0x0999('0x89')]=_0x0999('0xa9');_0x52e2f8[_0x0999('0x83')]=moment()['format'](_0x0999('0x80'));this[_0x0999('0x11')][_0xcc3b62[_0x0999('0x46')]]=_0x52e2f8;}}logger[_0x0999('0x6d')](_0x0999('0xaa'),_0xcc3b62[_0x0999('0x46')],_0x52e2f8[_0x0999('0x49')],_0x52e2f8[_0x0999('0x51')],_[_0x0999('0xa0')](_0xcc3b62[_0x0999('0xa1')])[0x0],_0xcc3b62[_0x0999('0xa2')]);_0x52e2f8[_0x0999('0x15')]=this[_0x0999('0x15')][_0xcc3b62[_0x0999('0x46')]];}}}}catch(_0x38e78c){logger[_0x0999('0x3d')](_0x0999('0x9e'),_0xcc3b62[_0x0999('0x46')],util[_0x0999('0x3b')](_0x38e78c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x9f')]=function(_0x5b0bb0,_0x5ef802,_0x17054a){var _0x1b7047=[_0x0999('0xab'),_0x0999('0xac'),_0x0999('0xad'),'rtpaudioqosjitterbridged',_0x0999('0xae'),_0x0999('0xaf'),'rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri',_0x0999('0xb0'),'bridgepvtcallid','membercalls',_0x0999('0xb1'),_0x0999('0xb2'),_0x0999('0xb3'),'membername',_0x0999('0xb4'),_0x0999('0xb5')];if(!_['isNil'](_0x5ef802)&&!_[_0x0999('0xb6')](_0x1b7047,_0x5ef802)){if(_[_0x0999('0x63')](this['variables'][_0x5b0bb0])){this[_0x0999('0x15')][_0x5b0bb0]={};}this['variables'][_0x5b0bb0][_0x5ef802]=_0x17054a;}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x23')]=function(_0x4f721f){try{if(this[_0x0999('0x62')](_0x4f721f)){logger[_0x0999('0x4c')](_0x0999('0xb7'),_0x4f721f[_0x0999('0x46')],util[_0x0999('0x3b')](_0x4f721f,{'showHidden':![],'depth':null}));if(this[_0x0999('0x3c')][_0x4f721f[_0x0999('0x46')]]){for(var _0x22bcd0=0x0,_0x5bbc4d={};_0x22bcd0=0x0?moment(_0x34021a[_0x0a0d('0x15')])['diff'](_0x34021a['starttime'],_0x0a0d('0xb')):null,'data1':_0x0a0d('0x16'),'data2':_0x34021a[_0x0a0d('0x10')],'data3':_0x34021a[_0x0a0d('0xd')],'data4':_0x34021a[_0x0a0d('0x17')]||null,'role':_0x0a0d('0xf'),'internal':_0x34021a['accountcode']?_[_0x0a0d('0x11')](_0x34021a['accountcode']):undefined,'uniqueid':_0x34021a[_0x0a0d('0x12')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xb3ac=['uniqueid','voiceDialReport','membername','endtime','starttime','seconds','outbound','toNumber','moment','lodash','util','../client','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','interface','format','TALKING','queuecallerleaveAt','diff','inbound','calleridnum','agent','accountcode'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb3ac,0x14c));var _0xcb3a=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xb3ac[_0x29d915];return _0x160f86;};'use strict';var moment=require(_0xcb3a('0x0'));var _=require(_0xcb3a('0x1'));var util=require(_0xcb3a('0x2'));var client=require(_0xcb3a('0x3'));exports['voiceQueueReport']=function(_0x319497){var _0xc426b0=_0x319497[_0xcb3a('0x4')]||_0x319497[_0xcb3a('0x5')];return client[_0xcb3a('0x6')](_0xcb3a('0x7'),{'body':{'channel':_0xcb3a('0x8'),'membername':_0x319497[_0xcb3a('0x9')],'interface':_['isNil'](_0x319497[_0xcb3a('0xa')])?util[_0xcb3a('0xb')]('SIP/%s',_0x319497[_0xcb3a('0x9')]):_0x319497[_0xcb3a('0xa')],'type':_0xcb3a('0xc'),'enterAt':_0x319497[_0xcb3a('0xd')],'exitAt':_0xc426b0,'duration':moment(_0xc426b0)[_0xcb3a('0xe')](_0x319497[_0xcb3a('0xd')],'seconds'),'data1':_0xcb3a('0xf'),'data2':_0x319497[_0xcb3a('0x10')],'data3':_0x319497['exten'],'data4':null,'data5':_0x319497['queue'],'role':_0xcb3a('0x11'),'internal':_0x319497['accountcode']?_['toNumber'](_0x319497[_0xcb3a('0x12')]):undefined,'uniqueid':_0x319497[_0xcb3a('0x13')]},'log':_0xcb3a('0x7')});};exports[_0xcb3a('0x14')]=function(_0x5522e2){return client[_0xcb3a('0x6')]('CreateMemberReport',{'body':{'channel':_0xcb3a('0x8'),'membername':_0x5522e2[_0xcb3a('0x15')],'interface':_0x5522e2[_0xcb3a('0xa')],'type':'TALKING','enterAt':_0x5522e2['starttime'],'exitAt':_0x5522e2['endtime'],'duration':moment(_0x5522e2[_0xcb3a('0x16')])[_0xcb3a('0xe')](_0x5522e2[_0xcb3a('0x17')],_0xcb3a('0x18'))>=0x0?moment(_0x5522e2[_0xcb3a('0x16')])[_0xcb3a('0xe')](_0x5522e2[_0xcb3a('0x17')],_0xcb3a('0x18')):null,'data1':_0xcb3a('0x19'),'data2':_0x5522e2[_0xcb3a('0x12')],'data3':_0x5522e2['exten'],'data4':_0x5522e2['dialstring']||null,'role':_0xcb3a('0x11'),'internal':_0x5522e2['accountcode']?_[_0xcb3a('0x1a')](_0x5522e2['accountcode']):undefined,'uniqueid':_0x5522e2['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 6d44b75..528499b 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 _0xca66=['ShowSetting','stopRecordingOnTransfer','GetSettings','../client'];(function(_0x14f670,_0x2ddd0a){var _0x4e890a=function(_0x396728){while(--_0x396728){_0x14f670['push'](_0x14f670['shift']());}};_0x4e890a(++_0x2ddd0a);}(_0xca66,0x8b));var _0x6ca6=function(_0x35b30e,_0x1921ee){_0x35b30e=_0x35b30e-0x0;var _0x291bd1=_0xca66[_0x35b30e];return _0x291bd1;};'use strict';var client=require(_0x6ca6('0x0'));exports['getSettings']=function(){return client['Request'](_0x6ca6('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x6ca6('0x2')]},'log':_0x6ca6('0x3')});}; \ No newline at end of file +var _0xe205=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','GetSettings','../client'];(function(_0x405baa,_0x1fcaff){var _0x5c1cae=function(_0x386e59){while(--_0x386e59){_0x405baa['push'](_0x405baa['shift']());}};_0x5c1cae(++_0x1fcaff);}(_0xe205,0xa7));var _0x5e20=function(_0x10d236,_0x549f96){_0x10d236=_0x10d236-0x0;var _0xfaf110=_0xe205[_0x10d236];return _0xfaf110;};'use strict';var client=require(_0x5e20('0x0'));exports[_0x5e20('0x1')]=function(){return client[_0x5e20('0x2')](_0x5e20('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5e20('0x4')]},'log':_0x5e20('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index d3d1ccf..ae0a36d 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 _0xd523=['getTemplates','GetTemplate','name','html','../client'];(function(_0x32dd7c,_0x386164){var _0x3cb628=function(_0x204677){while(--_0x204677){_0x32dd7c['push'](_0x32dd7c['shift']());}};_0x3cb628(++_0x386164);}(_0xd523,0x153));var _0x3d52=function(_0x50f475,_0xf78c87){_0x50f475=_0x50f475-0x0;var _0x43c422=_0xd523[_0x50f475];return _0x43c422;};'use strict';var client=require(_0x3d52('0x0'));exports[_0x3d52('0x1')]=function(_0x3d35b0){return function(_0x3fcfcb){return client['Request'](_0x3d52('0x2'),{'options':{'raw':!![],'attributes':['id',_0x3d52('0x3'),_0x3d52('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x6599=['getTemplates','Request','GetTemplate','html'];(function(_0x297c55,_0x34fa75){var _0x120389=function(_0x595108){while(--_0x595108){_0x297c55['push'](_0x297c55['shift']());}};_0x120389(++_0x34fa75);}(_0x6599,0xb0));var _0x9659=function(_0x4492af,_0x47e25d){_0x4492af=_0x4492af-0x0;var _0x216729=_0x6599[_0x4492af];return _0x216729;};'use strict';var client=require('../client');exports[_0x9659('0x0')]=function(_0x2aa407){return function(_0x6e313e){return client[_0x9659('0x1')](_0x9659('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x9659('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 6b36b6e..b9b283b 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 _0x6097=['getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','field','operator','AnyConditions','value','action','data1','data2','data3','data5','data6','data7'];(function(_0x2786ea,_0x16c3c3){var _0x5c38e5=function(_0x5a53c5){while(--_0x5a53c5){_0x2786ea['push'](_0x2786ea['shift']());}};_0x5c38e5(++_0x16c3c3);}(_0x6097,0xa2));var _0x7609=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0x6097[_0x16e57d];return _0x40239c;};'use strict';var client=require('../client');exports[_0x7609('0x0')]=function(_0x403e17){return function(_0x42a67b){return client[_0x7609('0x1')](_0x7609('0x2'),{'options':{'raw':![],'attributes':['id',_0x7609('0x3'),_0x7609('0x4'),'status'],'include':[{'model':_0x7609('0x5'),'as':_0x7609('0x6'),'attributes':['id',_0x7609('0x7'),_0x7609('0x8'),'value']},{'model':_0x7609('0x5'),'as':_0x7609('0x9'),'attributes':['id',_0x7609('0x7'),_0x7609('0x8'),_0x7609('0xa')]},{'model':'Action','as':'Actions','attributes':['id',_0x7609('0xb'),_0x7609('0xc'),_0x7609('0xd'),_0x7609('0xe'),'data4',_0x7609('0xf'),_0x7609('0x10'),_0x7609('0x11')]}]},'log':_0x7609('0x2')});};}; \ No newline at end of file +var _0x622e=['AllConditions','field','operator','value','Actions','action','data1','data3','data4','data5','data7','../client','getTriggers','Request','GetTrigger','channel','status','Condition'];(function(_0x3d01c4,_0x14ba7c){var _0x21bfeb=function(_0x6ede0e){while(--_0x6ede0e){_0x3d01c4['push'](_0x3d01c4['shift']());}};_0x21bfeb(++_0x14ba7c);}(_0x622e,0x65));var _0xe622=function(_0x1c6dcf,_0x2018b2){_0x1c6dcf=_0x1c6dcf-0x0;var _0x4990ae=_0x622e[_0x1c6dcf];return _0x4990ae;};'use strict';var client=require(_0xe622('0x0'));exports[_0xe622('0x1')]=function(_0x51499e){return function(_0x447a7d){return client[_0xe622('0x2')](_0xe622('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xe622('0x4'),_0xe622('0x5')],'include':[{'model':_0xe622('0x6'),'as':_0xe622('0x7'),'attributes':['id',_0xe622('0x8'),_0xe622('0x9'),'value']},{'model':_0xe622('0x6'),'as':'AnyConditions','attributes':['id',_0xe622('0x8'),_0xe622('0x9'),_0xe622('0xa')]},{'model':'Action','as':_0xe622('0xb'),'attributes':['id',_0xe622('0xc'),_0xe622('0xd'),'data2',_0xe622('0xe'),_0xe622('0xf'),_0xe622('0x10'),'data6',_0xe622('0x11')]}]},'log':_0xe622('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index f0354aa..cf2bb6c 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 _0x3f78=['defaultuser','../client','getTrunks','Request','GetTrunk','name','registry'];(function(_0x3a68a0,_0x5a26d7){var _0x3db8ff=function(_0x15d852){while(--_0x15d852){_0x3a68a0['push'](_0x3a68a0['shift']());}};_0x3db8ff(++_0x5a26d7);}(_0x3f78,0x1ac));var _0x83f7=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x3f78[_0x4ae6ef];return _0x3cbb4e;};'use strict';var client=require(_0x83f7('0x0'));exports[_0x83f7('0x1')]=function(_0x47031a){return function(_0x3afc9f){return client[_0x83f7('0x2')](_0x83f7('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x83f7('0x4'),_0x83f7('0x5'),_0x83f7('0x6')]},'log':_0x83f7('0x3')});};}; \ No newline at end of file +var _0xc539=['Request','name','registry','defaultuser'];(function(_0x20e555,_0x40aea6){var _0x182077=function(_0x1d0d69){while(--_0x1d0d69){_0x20e555['push'](_0x20e555['shift']());}};_0x182077(++_0x40aea6);}(_0xc539,0x164));var _0x9c53=function(_0x3fbb57,_0x20e015){_0x3fbb57=_0x3fbb57-0x0;var _0x29da3d=_0xc539[_0x3fbb57];return _0x29da3d;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x5148fe){return function(_0x24cff1){return client[_0x9c53('0x0')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9c53('0x1'),_0x9c53('0x2'),_0x9c53('0x3')]},'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 4a67819..c47f36e 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 _0x2070=['saveUnpause','UnpauseUser','getAgent','ShowUser','../client','getAgents','agent','name','email','accountcode','fullname','online','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','Request','internal','savePause'];(function(_0x103ca9,_0x213d69){var _0xc2d815=function(_0x41e48e){while(--_0x41e48e){_0x103ca9['push'](_0x103ca9['shift']());}};_0xc2d815(++_0x213d69);}(_0x2070,0x138));var _0x0207=function(_0x183975,_0x522dd9){_0x183975=_0x183975-0x0;var _0xa238d2=_0x2070[_0x183975];return _0xa238d2;};'use strict';var client=require(_0x0207('0x0'));exports[_0x0207('0x1')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':![],'where':{'role':_0x0207('0x2')},'attributes':['id',_0x0207('0x3'),_0x0207('0x4'),_0x0207('0x5'),_0x0207('0x6'),_0x0207('0x7'),'lastLoginAt',_0x0207('0x8'),_0x0207('0x9'),_0x0207('0xa'),_0x0207('0xb'),_0x0207('0xc'),_0x0207('0xd')]},'log':_0x0207('0x1')});};};exports[_0x0207('0xe')]=function(){return function(){return client[_0x0207('0xf')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x0207('0x3'),_0x0207('0x5'),_0x0207('0x10')]},'log':_0x0207('0xe')});};};exports[_0x0207('0x11')]=function(_0x3bdbce,_0x2c0dd9,_0x5627cf){return client[_0x0207('0xf')]('PauseUser',{'body':{'type':_0x2c0dd9,'uniqueid':_0x5627cf},'options':{'where':{'id':_0x3bdbce['id']}},'log':_0x0207('0x11')});};exports[_0x0207('0x12')]=function(_0x386f15){return client[_0x0207('0xf')](_0x0207('0x13'),{'body':{},'options':{'where':{'id':_0x386f15['id']}},'log':_0x0207('0x11')});};exports[_0x0207('0x14')]=function(_0x174b70){return client[_0x0207('0xf')](_0x0207('0x15'),{'options':{'raw':![],'where':{'role':_0x0207('0x2'),'id':_0x174b70},'attributes':['id',_0x0207('0x3'),_0x0207('0x4'),'accountcode',_0x0207('0x6'),_0x0207('0x7'),'lastLoginAt','pauseType','lastPauseAt',_0x0207('0xa'),_0x0207('0xd')]},'log':_0x0207('0x14')});}; \ No newline at end of file +var _0x9e3d=['telephone','getTelephones','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','email','lastLoginAt','../client','Request','agent','name','accountcode','fullname','online','pauseType','lastPauseAt','voicePause','phone','mobile','interface','GetUser'];(function(_0x5f5ae0,_0x59e44a){var _0x2bb754=function(_0x12a90b){while(--_0x12a90b){_0x5f5ae0['push'](_0x5f5ae0['shift']());}};_0x2bb754(++_0x59e44a);}(_0x9e3d,0x112));var _0xd9e3=function(_0x5e3fd8,_0x25faf4){_0x5e3fd8=_0x5e3fd8-0x0;var _0x3ba5c8=_0x9e3d[_0x5e3fd8];return _0x3ba5c8;};'use strict';var client=require(_0xd9e3('0x0'));exports['getAgents']=function(){return function(){return client[_0xd9e3('0x1')]('GetUser',{'options':{'raw':![],'where':{'role':_0xd9e3('0x2')},'attributes':['id',_0xd9e3('0x3'),'email',_0xd9e3('0x4'),_0xd9e3('0x5'),_0xd9e3('0x6'),'lastLoginAt',_0xd9e3('0x7'),_0xd9e3('0x8'),_0xd9e3('0x9'),_0xd9e3('0xa'),_0xd9e3('0xb'),_0xd9e3('0xc')]},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client['Request'](_0xd9e3('0xd'),{'options':{'raw':!![],'where':{'role':_0xd9e3('0xe')},'attributes':['id',_0xd9e3('0x3'),'accountcode','internal']},'log':_0xd9e3('0xf')});};};exports[_0xd9e3('0x10')]=function(_0x3fca2a,_0x27a52a,_0x256a19){return client[_0xd9e3('0x1')](_0xd9e3('0x11'),{'body':{'type':_0x27a52a,'uniqueid':_0x256a19},'options':{'where':{'id':_0x3fca2a['id']}},'log':_0xd9e3('0x10')});};exports[_0xd9e3('0x12')]=function(_0x13a90d){return client[_0xd9e3('0x1')](_0xd9e3('0x13'),{'body':{},'options':{'where':{'id':_0x13a90d['id']}},'log':'savePause'});};exports[_0xd9e3('0x14')]=function(_0x560889){return client['Request'](_0xd9e3('0x15'),{'options':{'raw':![],'where':{'role':_0xd9e3('0x2'),'id':_0x560889},'attributes':['id',_0xd9e3('0x3'),_0xd9e3('0x16'),_0xd9e3('0x4'),_0xd9e3('0x5'),'online',_0xd9e3('0x17'),_0xd9e3('0x7'),_0xd9e3('0x8'),'voicePause','interface']},'log':_0xd9e3('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index b0b9976..f58e8e5 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 _0xb5b2=['Request','../client','create','CreateVoiceAgentReport'];(function(_0x22b815,_0x15c408){var _0x4320ff=function(_0x45b991){while(--_0x45b991){_0x22b815['push'](_0x22b815['shift']());}};_0x4320ff(++_0x15c408);}(_0xb5b2,0xb1));var _0x2b5b=function(_0x5953f3,_0x2aaf00){_0x5953f3=_0x5953f3-0x0;var _0x3eca74=_0xb5b2[_0x5953f3];return _0x3eca74;};'use strict';var client=require(_0x2b5b('0x0'));exports[_0x2b5b('0x1')]=function(_0x1cb768){return client['Request'](_0x2b5b('0x2'),{'body':_0x1cb768,'log':_0x2b5b('0x2')});};exports['update']=function(_0x18aa8e,_0x265ca3,_0x41d738){return client[_0x2b5b('0x3')]('UpdateVoiceAgentReport',{'body':_0x18aa8e,'options':{'where':{'uniqueid':_0x265ca3,'interface':_0x41d738,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x7a92=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x5b46df,_0x21ce32){var _0x157311=function(_0x599206){while(--_0x599206){_0x5b46df['push'](_0x5b46df['shift']());}};_0x157311(++_0x21ce32);}(_0x7a92,0x1bc));var _0x27a9=function(_0x1d779f,_0x340938){_0x1d779f=_0x1d779f-0x0;var _0x2936da=_0x7a92[_0x1d779f];return _0x2936da;};'use strict';var client=require(_0x27a9('0x0'));exports[_0x27a9('0x1')]=function(_0x479ea6){return client[_0x27a9('0x2')](_0x27a9('0x3'),{'body':_0x479ea6,'log':_0x27a9('0x3')});};exports[_0x27a9('0x4')]=function(_0x386ee5,_0x338804,_0x3e694f){return client[_0x27a9('0x2')](_0x27a9('0x5'),{'body':_0x386ee5,'options':{'where':{'uniqueid':_0x338804,'interface':_0x3e694f,'agentcomplete':!![]}},'log':_0x27a9('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 1c08eaa..afba77c 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 _0xc280=['CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','create','Request'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xc280,0x1b3));var _0x0c28=function(_0x3edc22,_0xe9fd10){_0x3edc22=_0x3edc22-0x0;var _0x1eb2eb=_0xc280[_0x3edc22];return _0x1eb2eb;};'use strict';var moment=require(_0x0c28('0x0'));var util=require(_0x0c28('0x1'));var _=require(_0x0c28('0x2'));var client=require('../client');exports[_0x0c28('0x3')]=function(_0x15b030){return client[_0x0c28('0x4')](_0x0c28('0x5'),{'body':_[_0x0c28('0x6')](_0x15b030,{'source':_0x15b030[_0x0c28('0x7')],'destinationcontext':_0x15b030[_0x0c28('0x8')],'callerid':_0x15b030['callerid'],'amaflags':_0x0c28('0x9')}),'log':_0x0c28('0x5')});};exports[_0x0c28('0xa')]=function(){return function(){return client['Request'](_0x0c28('0xb'),{'options':{'where':{'type':[_0x0c28('0xc')],'createdAt':{'$between':[moment()['startOf'](_0x0c28('0xd'))['format'](_0x0c28('0xe')),moment()[_0x0c28('0xf')](_0x0c28('0xd'))['format'](_0x0c28('0xe'))]}},'attributes':[_0x0c28('0x10'),'disposition',_0x0c28('0x11'),_0x0c28('0x12')]},'log':_0x0c28('0x13')});};}; \ No newline at end of file +var _0x3702=['../client','create','Request','merge','context','callerid','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash'];(function(_0x4670e,_0x19e50c){var _0xab329a=function(_0x4fc5ba){while(--_0x4fc5ba){_0x4670e['push'](_0x4670e['shift']());}};_0xab329a(++_0x19e50c);}(_0x3702,0x165));var _0x2370=function(_0x571727,_0x491caa){_0x571727=_0x571727-0x0;var _0x50e401=_0x3702[_0x571727];return _0x50e401;};'use strict';var moment=require(_0x2370('0x0'));var util=require(_0x2370('0x1'));var _=require(_0x2370('0x2'));var client=require(_0x2370('0x3'));exports[_0x2370('0x4')]=function(_0x489ac2){return client[_0x2370('0x5')]('CreateVoiceCallReport',{'body':_[_0x2370('0x6')](_0x489ac2,{'source':_0x489ac2['calleridnum'],'destinationcontext':_0x489ac2[_0x2370('0x7')],'callerid':_0x489ac2[_0x2370('0x8')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x2370('0x9'),{'options':{'where':{'type':[_0x2370('0xa')],'createdAt':{'$between':[moment()[_0x2370('0xb')](_0x2370('0xc'))[_0x2370('0xd')](_0x2370('0xe')),moment()['endOf']('day')[_0x2370('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x2370('0xf'),_0x2370('0x10'),_0x2370('0x11'),_0x2370('0x12')]},'log':_0x2370('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 073fdd5..67bc7f7 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 _0x3b06=['Request','CreateVoiceDialReport'];(function(_0x40cdea,_0x1aefe9){var _0x31e921=function(_0x4c340b){while(--_0x4c340b){_0x40cdea['push'](_0x40cdea['shift']());}};_0x31e921(++_0x1aefe9);}(_0x3b06,0x134));var _0x63b0=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0x3b06[_0x1895b7];return _0x1aecdc;};'use strict';var client=require('../client');exports['create']=function(_0x262227){return client[_0x63b0('0x0')](_0x63b0('0x1'),{'body':_0x262227,'log':_0x63b0('0x1')});}; \ No newline at end of file +var _0x7cad=['create','CreateVoiceDialReport','../client'];(function(_0x171586,_0x36730f){var _0x1e6319=function(_0x36ca93){while(--_0x36ca93){_0x171586['push'](_0x171586['shift']());}};_0x1e6319(++_0x36730f);}(_0x7cad,0x83));var _0xd7ca=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x7cad[_0x1969a7];return _0x3d665f;};'use strict';var client=require(_0xd7ca('0x0'));exports[_0xd7ca('0x1')]=function(_0x474bb4){return client['Request'](_0xd7ca('0x2'),{'body':_0x474bb4,'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 43e6d6a..b0708c6 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 _0x2785=['exten','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x2785,0x1be));var _0x5278=function(_0x2d14b0,_0x362cb4){_0x2d14b0=_0x2d14b0-0x0;var _0x4395ac=_0x2785[_0x2d14b0];return _0x4395ac;};'use strict';var client=require(_0x5278('0x0'));exports[_0x5278('0x1')]=function(){return function(){return client[_0x5278('0x2')](_0x5278('0x3'),{'options':{'raw':!![],'attributes':['id',_0x5278('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x5278('0x1')});};}; \ No newline at end of file +var _0x5f6a=['getVoiceExtensions','../client','GetVoiceExtension','exten','recordingFormat'];(function(_0x4341e0,_0x143636){var _0x4f8e71=function(_0x7a124c){while(--_0x7a124c){_0x4341e0['push'](_0x4341e0['shift']());}};_0x4f8e71(++_0x143636);}(_0x5f6a,0xc4));var _0xa5f6=function(_0x56238a,_0x420c40){_0x56238a=_0x56238a-0x0;var _0xf68503=_0x5f6a[_0x56238a];return _0xf68503;};'use strict';var client=require(_0xa5f6('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0xa5f6('0x1'),{'options':{'raw':!![],'attributes':['id',_0xa5f6('0x2'),_0xa5f6('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xa5f6('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 577be3b..af6a2ff 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 _0x55b8=['monitor_format','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallInQueue','dialOrderByScheduledAt','dialQueueProject2','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','callerid','active','Pause','mandatoryDispositionPause','Trunk','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0x55b8,0x15a));var _0x855b=function(_0x156bd3,_0x156665){_0x156bd3=_0x156bd3-0x0;var _0x59d3d4=_0x55b8[_0x156bd3];return _0x59d3d4;};'use strict';var client=require(_0x855b('0x0'));exports[_0x855b('0x1')]=function(){return function(){return client[_0x855b('0x2')](_0x855b('0x3'),{'options':{'raw':![],'attributes':['id',_0x855b('0x4'),_0x855b('0x5'),_0x855b('0x6'),_0x855b('0x7'),_0x855b('0x8'),'type',_0x855b('0x9'),_0x855b('0xa'),_0x855b('0xb'),'dialLimitQueue',_0x855b('0xc'),_0x855b('0xd'),_0x855b('0xe'),_0x855b('0xf'),'dialOriginateCallerIdName',_0x855b('0x10'),_0x855b('0x11'),_0x855b('0x12'),_0x855b('0x13'),_0x855b('0x14'),'dialCongestionMaxRetry',_0x855b('0x15'),_0x855b('0x16'),_0x855b('0x17'),_0x855b('0x18'),_0x855b('0x19'),_0x855b('0x1a'),'dialTimezone','dialGlobalInterval',_0x855b('0x1b'),_0x855b('0x1c'),'dialAMDActive',_0x855b('0x1d'),_0x855b('0x1e'),_0x855b('0x1f'),'dialAMDTotalAnalysisTime',_0x855b('0x20'),_0x855b('0x21'),_0x855b('0x22'),_0x855b('0x23'),_0x855b('0x24'),'timeout','dialRecallMeTimeout',_0x855b('0x25'),_0x855b('0x26'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x855b('0x27'),_0x855b('0x8'),'strategy','dialRandomLastDigitCallerIdNumber',_0x855b('0x28'),'dialNoSuchNumberMaxRetry',_0x855b('0x29'),_0x855b('0x2a'),_0x855b('0x2b'),_0x855b('0x2c'),_0x855b('0x2d'),_0x855b('0x2e'),_0x855b('0x2f'),_0x855b('0x30'),_0x855b('0x31'),_0x855b('0x32'),_0x855b('0x33'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x855b('0x4'),_0x855b('0x34'),_0x855b('0x35')]},{'model':_0x855b('0x36'),'as':_0x855b('0x37'),'attributes':['id',_0x855b('0x4')]},{'model':_0x855b('0x38'),'as':'TrunkBackup','attributes':['id',_0x855b('0x4'),'callerid',_0x855b('0x35')]},{'model':'Interval','as':_0x855b('0x39'),'attributes':['id',_0x855b('0x4')],'include':[{'model':_0x855b('0x39'),'as':_0x855b('0x3a'),'attributes':['id',_0x855b('0x4'),'interval']}]}]},'log':_0x855b('0x1')});};}; \ No newline at end of file +var _0xcc69=['dialMachineMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x1ffdad,_0x255ded){var _0x46e785=function(_0x555af4){while(--_0x555af4){_0x1ffdad['push'](_0x1ffdad['shift']());}};_0x46e785(++_0x255ded);}(_0xcc69,0x111));var _0x9cc6=function(_0x2a4291,_0x53bdd8){_0x2a4291=_0x2a4291-0x0;var _0xf91cbe=_0xcc69[_0x2a4291];return _0xf91cbe;};'use strict';var client=require(_0x9cc6('0x0'));exports[_0x9cc6('0x1')]=function(){return function(){return client[_0x9cc6('0x2')](_0x9cc6('0x3'),{'options':{'raw':![],'attributes':['id',_0x9cc6('0x4'),_0x9cc6('0x5'),_0x9cc6('0x6'),_0x9cc6('0x7'),_0x9cc6('0x8'),_0x9cc6('0x9'),_0x9cc6('0xa'),_0x9cc6('0xb'),_0x9cc6('0xc'),_0x9cc6('0xd'),_0x9cc6('0xe'),_0x9cc6('0xf'),_0x9cc6('0x10'),_0x9cc6('0x11'),'dialOriginateCallerIdName',_0x9cc6('0x12'),_0x9cc6('0x13'),_0x9cc6('0x14'),_0x9cc6('0x15'),'dialQueueProject',_0x9cc6('0x16'),_0x9cc6('0x17'),_0x9cc6('0x18'),'dialBusyRetryFrequency',_0x9cc6('0x19'),_0x9cc6('0x1a'),_0x9cc6('0x1b'),_0x9cc6('0x1c'),'dialGlobalInterval',_0x9cc6('0x1d'),_0x9cc6('0x1e'),_0x9cc6('0x1f'),_0x9cc6('0x20'),_0x9cc6('0x21'),_0x9cc6('0x22'),_0x9cc6('0x23'),_0x9cc6('0x24'),_0x9cc6('0x25'),_0x9cc6('0x26'),'dialAMDSilenceThreshold',_0x9cc6('0x27'),_0x9cc6('0x28'),_0x9cc6('0x29'),'dialRecallInQueue','dialOrderByScheduledAt',_0x9cc6('0x2a'),_0x9cc6('0x2b'),_0x9cc6('0x2c'),_0x9cc6('0x8'),_0x9cc6('0x2d'),_0x9cc6('0x2e'),_0x9cc6('0x2f'),_0x9cc6('0x30'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0x9cc6('0x31'),_0x9cc6('0x32'),_0x9cc6('0x33'),_0x9cc6('0x34'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x9cc6('0x35'),_0x9cc6('0x36'),_0x9cc6('0x37'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x9cc6('0x38'),'as':_0x9cc6('0x38'),'attributes':['id','name',_0x9cc6('0x39'),_0x9cc6('0x3a')]},{'model':_0x9cc6('0x3b'),'as':_0x9cc6('0x3c'),'attributes':['id',_0x9cc6('0x4')]},{'model':_0x9cc6('0x38'),'as':_0x9cc6('0x3d'),'attributes':['id',_0x9cc6('0x4'),'callerid','active']},{'model':_0x9cc6('0x3e'),'as':'Interval','attributes':['id',_0x9cc6('0x4')],'include':[{'model':_0x9cc6('0x3e'),'as':_0x9cc6('0x3f'),'attributes':['id',_0x9cc6('0x4'),_0x9cc6('0x40')]}]}]},'log':_0x9cc6('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 069fb4d..e73543a 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 _0x19de=['queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x19de,0xdb));var _0xe19d=function(_0x4559ea,_0x48afb3){_0x4559ea=_0x4559ea-0x0;var _0xb2a536=_0x19de[_0x4559ea];return _0xb2a536;};'use strict';var moment=require(_0xe19d('0x0'));var _=require(_0xe19d('0x1'));var client=require(_0xe19d('0x2'));exports[_0xe19d('0x3')]=function(_0x12dbf8){return client[_0xe19d('0x4')](_0xe19d('0x5'),{'body':_0x12dbf8,'log':_0xe19d('0x5')});};exports[_0xe19d('0x6')]=function(){return function(){return client[_0xe19d('0x4')](_0xe19d('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xe19d('0x8')](_0xe19d('0x9'))[_0xe19d('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xe19d('0x9'))[_0xe19d('0xa')](_0xe19d('0xb'))]}},'attributes':['uniqueid',_0xe19d('0xc'),_0xe19d('0xd'),_0xe19d('0xe'),_0xe19d('0xf'),_0xe19d('0x10'),_0xe19d('0x11'),'queuecallerexitAt',_0xe19d('0x12'),_0xe19d('0x13')]},'log':_0xe19d('0x14')});};}; \ No newline at end of file +var _0xa94f=['GetVoiceQueueReport','startOf','format','endOf','day','uniqueid','queuecallerleaveAt','queuecallercomplete','queuecallerexit','queuecallerabandon','GetVoiceQueueReports','moment','lodash','create','Request','CreateVoiceQueueReport','getVoiceQueueReports'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0xa94f,0x14e));var _0xfa94=function(_0x27d616,_0x251ce7){_0x27d616=_0x27d616-0x0;var _0xcd15e7=_0xa94f[_0x27d616];return _0xcd15e7;};'use strict';var moment=require(_0xfa94('0x0'));var _=require(_0xfa94('0x1'));var client=require('../client');exports[_0xfa94('0x2')]=function(_0x4d056b){return client[_0xfa94('0x3')](_0xfa94('0x4'),{'body':_0x4d056b,'log':'CreateVoiceQueueReport'});};exports[_0xfa94('0x5')]=function(){return function(){return client[_0xfa94('0x3')](_0xfa94('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xfa94('0x7')]('day')[_0xfa94('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xfa94('0x9')](_0xfa94('0xa'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xfa94('0xb'),'queue','queuecallerjoinAt',_0xfa94('0xc'),_0xfa94('0xd'),'queuecallercompleteAt',_0xfa94('0xe'),'queuecallerexitAt',_0xfa94('0xf'),'queuecallerabandonAt']},'log':_0xfa94('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index bdcfd63..fa15b75 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 _0x577e=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0xe9248b,_0x5bfa40){var _0x84375=function(_0x5664d0){while(--_0x5664d0){_0xe9248b['push'](_0xe9248b['shift']());}};_0x84375(++_0x5bfa40);}(_0x577e,0xc4));var _0xe577=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x577e[_0x466bc5];return _0x138952;};'use strict';var client=require(_0xe577('0x0'));exports[_0xe577('0x1')]=function(_0x19e33f){return function(){return client[_0xe577('0x2')](_0xe577('0x3'),{'options':{'where':{'VoiceQueueId':_0x19e33f,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x219f=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x37bab4,_0x20fa8c){var _0x8a57d8=function(_0x44ddd3){while(--_0x44ddd3){_0x37bab4['push'](_0x37bab4['shift']());}};_0x8a57d8(++_0x20fa8c);}(_0x219f,0x18d));var _0xf219=function(_0x5a3c0b,_0x221fed){_0x5a3c0b=_0x5a3c0b-0x0;var _0x18e542=_0x219f[_0x5a3c0b];return _0x18e542;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x19fe43){return function(){return client['Request'](_0xf219('0x0'),{'options':{'where':{'VoiceQueueId':_0x19fe43,'paused':!![]},'raw':!![]},'log':_0xf219('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 45eb8ea..3cf10ba 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 _0xe74d=['create','CreateVoiceRecording','merge','monitorFilename','lodash'];(function(_0x5e1b74,_0x388fa9){var _0x339c24=function(_0x20a1f2){while(--_0x20a1f2){_0x5e1b74['push'](_0x5e1b74['shift']());}};_0x339c24(++_0x388fa9);}(_0xe74d,0x185));var _0xde74=function(_0x4a8c28,_0x2b0254){_0x4a8c28=_0x4a8c28-0x0;var _0x1ee153=_0xe74d[_0x4a8c28];return _0x1ee153;};'use strict';var _=require(_0xde74('0x0'));var client=require('../client');exports[_0xde74('0x1')]=function(_0xb89be5){return client['Request'](_0xde74('0x2'),{'body':_[_0xde74('0x3')](_0xb89be5,{'value':_0xb89be5[_0xde74('0x4')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0x625e=['../client','create','Request','CreateVoiceRecording','merge','monitorFilename','lodash'];(function(_0x5efa07,_0x59d23f){var _0x262a7b=function(_0x22e52f){while(--_0x22e52f){_0x5efa07['push'](_0x5efa07['shift']());}};_0x262a7b(++_0x59d23f);}(_0x625e,0xf4));var _0xe625=function(_0x9b5bb2,_0x5db315){_0x9b5bb2=_0x9b5bb2-0x0;var _0x2e1e92=_0x625e[_0x9b5bb2];return _0x2e1e92;};'use strict';var _=require(_0xe625('0x0'));var client=require(_0xe625('0x1'));exports[_0xe625('0x2')]=function(_0x3ed81f){return client[_0xe625('0x3')](_0xe625('0x4'),{'body':_[_0xe625('0x5')](_0x3ed81f,{'value':_0x3ed81f[_0xe625('0x6')]}),'log':_0xe625('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index f60bcb1..a71b0bf 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 _0xd499=['transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','../client','transfers','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeaccountcode','context','extension','blind','CreateVoiceTransferReport','Request','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xd499,0x88));var _0x9d49=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xd499[_0x5f09c5];return _0x426ad9;};'use strict';var client=require(_0x9d49('0x0'));exports[_0x9d49('0x1')]={};exports['blindTransfer']=function(_0xb63f1d){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0xb63f1d[_0x9d49('0x2')],'transfererchannel':_0xb63f1d[_0x9d49('0x3')],'transferercalleridnum':_0xb63f1d['transferercalleridnum'],'transferercalleridname':_0xb63f1d[_0x9d49('0x4')],'transfererconnectedlinenum':_0xb63f1d[_0x9d49('0x5')],'transfererconnectedlinename':_0xb63f1d[_0x9d49('0x6')],'transfereraccountcode':_0xb63f1d[_0x9d49('0x7')],'transferercontext':_0xb63f1d[_0x9d49('0x8')],'transfererexten':_0xb63f1d[_0x9d49('0x9')],'transfererlinkedid':_0xb63f1d['transfererlinkedid'],'transfereechannel':_0xb63f1d[_0x9d49('0xa')],'transfereecalleridnum':_0xb63f1d[_0x9d49('0xb')],'transfereecalleridname':_0xb63f1d['transfereecalleridname'],'transfereeconnectedlinenum':_0xb63f1d[_0x9d49('0xc')],'transfereeconnectedlinename':_0xb63f1d['transfereeconnectedlinename'],'transfereeaccountcode':_0xb63f1d[_0x9d49('0xd')],'transfereecontext':_0xb63f1d['transfereecontext'],'transfereeexten':_0xb63f1d['transfereeexten'],'transfereelinkedid':_0xb63f1d['transfereelinkedid'],'isexternal':_0xb63f1d['isexternal'],'context':_0xb63f1d[_0x9d49('0xe')],'extension':_0xb63f1d[_0x9d49('0xf')],'type':_0x9d49('0x10')},'log':_0x9d49('0x11')});};exports['attendedTransfer']=function(_0x198174){return client[_0x9d49('0x12')]('CreateVoiceTransferReport',{'body':{'result':_0x198174[_0x9d49('0x2')],'transfererchannel':_0x198174[_0x9d49('0x13')],'transferercalleridnum':_0x198174['origtransferercalleridnum'],'transferercalleridname':_0x198174[_0x9d49('0x14')],'transfererconnectedlinenum':_0x198174[_0x9d49('0x15')],'transfererconnectedlinename':_0x198174[_0x9d49('0x16')],'transfereraccountcode':_0x198174['origtransfereraccountcode'],'transferercontext':_0x198174['secondtransferercontext'],'transfererexten':_0x198174['secondtransfererexten'],'transfererlinkedid':_0x198174[_0x9d49('0x17')],'transfereechannel':_0x198174['transfertargetchannel'],'transfereecalleridnum':_0x198174[_0x9d49('0x18')],'transfereecalleridname':_0x198174['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x198174['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x198174[_0x9d49('0x19')],'transfereeaccountcode':_0x198174[_0x9d49('0x1a')],'transfereecontext':_0x198174[_0x9d49('0x1b')],'transfereeexten':_0x198174[_0x9d49('0x1c')],'transfereelinkedid':_0x198174[_0x9d49('0x1d')],'isexternal':_0x198174[_0x9d49('0x1e')],'context':_0x198174[_0x9d49('0x1f')],'extension':_0x198174[_0x9d49('0x20')],'type':'attended'},'log':_0x9d49('0x11')});}; \ No newline at end of file +var _0xd3dd=['CreateVoiceTransferReport','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','Request','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers'];(function(_0x1235a3,_0x2c5f21){var _0x326c4f=function(_0x44e80a){while(--_0x44e80a){_0x1235a3['push'](_0x1235a3['shift']());}};_0x326c4f(++_0x2c5f21);}(_0xd3dd,0x1ba));var _0xdd3d=function(_0x351e48,_0xbe7950){_0x351e48=_0x351e48-0x0;var _0xd3b768=_0xd3dd[_0x351e48];return _0xd3b768;};'use strict';var client=require(_0xdd3d('0x0'));exports[_0xdd3d('0x1')]={};exports['blindTransfer']=function(_0x140bb9){return client['Request'](_0xdd3d('0x2'),{'body':{'result':_0x140bb9['result'],'transfererchannel':_0x140bb9['transfererchannel'],'transferercalleridnum':_0x140bb9['transferercalleridnum'],'transferercalleridname':_0x140bb9[_0xdd3d('0x3')],'transfererconnectedlinenum':_0x140bb9[_0xdd3d('0x4')],'transfererconnectedlinename':_0x140bb9['transfererconnectedlinename'],'transfereraccountcode':_0x140bb9[_0xdd3d('0x5')],'transferercontext':_0x140bb9[_0xdd3d('0x6')],'transfererexten':_0x140bb9['transfererexten'],'transfererlinkedid':_0x140bb9[_0xdd3d('0x7')],'transfereechannel':_0x140bb9[_0xdd3d('0x8')],'transfereecalleridnum':_0x140bb9[_0xdd3d('0x9')],'transfereecalleridname':_0x140bb9['transfereecalleridname'],'transfereeconnectedlinenum':_0x140bb9[_0xdd3d('0xa')],'transfereeconnectedlinename':_0x140bb9[_0xdd3d('0xb')],'transfereeaccountcode':_0x140bb9['transfereeaccountcode'],'transfereecontext':_0x140bb9['transfereecontext'],'transfereeexten':_0x140bb9[_0xdd3d('0xc')],'transfereelinkedid':_0x140bb9[_0xdd3d('0xd')],'isexternal':_0x140bb9[_0xdd3d('0xe')],'context':_0x140bb9[_0xdd3d('0xf')],'extension':_0x140bb9[_0xdd3d('0x10')],'type':_0xdd3d('0x11')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x153965){return client[_0xdd3d('0x12')]('CreateVoiceTransferReport',{'body':{'result':_0x153965[_0xdd3d('0x13')],'transfererchannel':_0x153965[_0xdd3d('0x14')],'transferercalleridnum':_0x153965[_0xdd3d('0x15')],'transferercalleridname':_0x153965[_0xdd3d('0x16')],'transfererconnectedlinenum':_0x153965[_0xdd3d('0x17')],'transfererconnectedlinename':_0x153965[_0xdd3d('0x18')],'transfereraccountcode':_0x153965['origtransfereraccountcode'],'transferercontext':_0x153965[_0xdd3d('0x19')],'transfererexten':_0x153965[_0xdd3d('0x1a')],'transfererlinkedid':_0x153965['origtransfererlinkedid'],'transfereechannel':_0x153965[_0xdd3d('0x1b')],'transfereecalleridnum':_0x153965[_0xdd3d('0x1c')],'transfereecalleridname':_0x153965[_0xdd3d('0x1d')],'transfereeconnectedlinenum':_0x153965[_0xdd3d('0x1e')],'transfereeconnectedlinename':_0x153965[_0xdd3d('0x1f')],'transfereeaccountcode':_0x153965[_0xdd3d('0x20')],'transfereecontext':_0x153965['transfertargetcontext'],'transfereeexten':_0x153965[_0xdd3d('0x21')],'transfereelinkedid':_0x153965[_0xdd3d('0x22')],'isexternal':_0x153965[_0xdd3d('0xe')],'context':_0x153965['origtransferercontext'],'extension':_0x153965[_0xdd3d('0x23')],'type':_0xdd3d('0x24')},'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 441d633..076126c 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 _0x5de0=['validate','uniqueid','channel','filename','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','catch','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','values','telephones','Event\x20name\x20mandatory','custom:','event','faxAccounts','send','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','format','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','action','Reload','Action','then','message','pick','command','content','voiceQueues','hasOwnProperty','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','abandoned','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','channels','voicechannel'];(function(_0x2286e2,_0x298116){var _0x270d9c=function(_0xa060f){while(--_0xa060f){_0x2286e2['push'](_0x2286e2['shift']());}};_0x270d9c(++_0x298116);}(_0x5de0,0xaf));var _0x05de=function(_0x18edd1,_0x5b6c4b){_0x18edd1=_0x18edd1-0x0;var _0x2da59e=_0x5de0[_0x18edd1];return _0x2da59e;};'use strict';var _=require(_0x05de('0x0'));var util=require(_0x05de('0x1'));var jayson=require(_0x05de('0x2'));var schema=require('validate');var BPromise=require(_0x05de('0x3'));var moment=require(_0x05de('0x4'));var config=require(_0x05de('0x5'));var properties=require(_0x05de('0x6'));var ami=require(_0x05de('0x7'));exports['listen']=function(_0x473ecb,_0x263950,_0x536c94){return new BPromise(function(_0x30b896,_0x5f1f42){var _0x53edc0={'QueuePause':function(_0x3eaba8){return new Promise(function(_0x43f39a,_0x43aa21){var _0x1b31b5=util[_0x05de('0x8')]('%s/%s',_0x05de('0x9'),_0x3eaba8[_0x05de('0xa')]);if(_0x473ecb['timers']&&_0x473ecb[_0x05de('0xb')][_0x1b31b5]&&_0x473ecb[_0x05de('0xb')][_0x1b31b5][_0x05de('0xc')]){_0x473ecb[_0x05de('0xb')][_0x1b31b5][_0x05de('0xd')]();}if(_0x473ecb[_0x05de('0xe')][_0x1b31b5]){_0x473ecb['agents'][_0x1b31b5][_0x05de('0xf')]({'statePause':_0x3eaba8[_0x05de('0x10')]?!![]:![]});}_0x43f39a({'code':0xc8,'message':_0x05de('0x11')});});},'Reload':function(_0xd63c76){var _0xd1599e=this;return new Promise(function(_0x5ac509,_0x283da7){if(ami[_0x05de('0x12')]()==![]){return _0x283da7(_0xd1599e[_0x05de('0x13')](0x1f4,[config[_0x05de('0x14')]['ip'],config[_0x05de('0x14')][_0x05de('0x15')],_0x05de('0x16')][_0x05de('0x17')]('\x20')));}_0xd63c76=_['pick'](_0xd63c76,_['keys'](properties['module']));_0xd63c76[_0x05de('0x18')]=_0x05de('0x19');return ami[_0x05de('0x1a')](_0xd63c76)[_0x05de('0x1b')](function(_0x28865d){_0x5ac509({'code':0xc8,'message':_0x28865d['message']});})['catch'](function(_0x3e0b2a){_0x283da7(_0xd1599e['error'](0x1f5,_0x3e0b2a[_0x05de('0x1c')]));});});},'Command':function(_0x1689ce){var _0x2b3db0=this;return new Promise(function(_0x11915a,_0x555e0b){if(ami[_0x05de('0x12')]()==![]){return _0x555e0b(_0x2b3db0[_0x05de('0x13')](0x1f4,[config[_0x05de('0x14')]['ip'],config[_0x05de('0x14')][_0x05de('0x15')],_0x05de('0x16')]['join']('\x20')));}_0x1689ce=_[_0x05de('0x1d')](_0x1689ce,_0x05de('0x1e'));_0x1689ce[_0x05de('0x18')]='Command';return ami[_0x05de('0x1a')](_0x1689ce)['then'](function(_0x68b4fe){_0x11915a({'code':0xc8,'message':_0x68b4fe[_0x05de('0x1f')]});})['catch'](function(_0x192b9c){_0x555e0b(_0x2b3db0[_0x05de('0x13')](0x1f5,_0x192b9c[_0x05de('0x1c')]));});});},'VoiceQueues':function(_0x38c307){return new Promise(function(_0x5ad6c0,_0x3515f7){var _0x551497=[];for(var _0x13dc0c in _0x473ecb['voiceQueues']){if(_0x473ecb[_0x05de('0x20')][_0x05de('0x21')](_0x13dc0c)){var _0x112439=_0x473ecb['voiceQueues'][_0x13dc0c];var _0x10819d={'id':_0x112439['id'],'name':_0x112439[_0x05de('0xa')],'strategy':_0x112439['strategy'],'answered':_0x112439[_0x05de('0x22')],'available':_0x112439[_0x05de('0x23')],'loggedIn':_0x112439[_0x05de('0x24')],'pTalking':_0x112439[_0x05de('0x25')],'sumBillable':_0x112439[_0x05de('0x26')],'sumDuration':_0x112439[_0x05de('0x27')],'sumHoldTime':_0x112439[_0x05de('0x28')]||0x0,'talking':_0x112439[_0x05de('0x29')],'total':_0x112439[_0x05de('0x2a')],'type':_0x112439[_0x05de('0x2b')],'unmanaged':_0x112439['unmanaged'],'abandoned':_0x112439[_0x05de('0x2c')],'waiting':_0x112439['waiting'],'loggedInDb':_0x112439['loggedInDb']};if(_0x112439[_0x05de('0x2b')]===_0x05de('0x2d')){_0x10819d['dialActive']=_0x112439[_0x05de('0x2e')];_0x10819d['dialMethod']=_0x112439[_0x05de('0x2f')];_0x10819d[_0x05de('0x30')]=_0x112439['dialOriginateCallerIdName'];_0x10819d[_0x05de('0x31')]=_0x112439[_0x05de('0x31')];_0x10819d['dialOriginateTimeout']=_0x112439['dialOriginateTimeout'];_0x10819d[_0x05de('0x32')]=_0x112439[_0x05de('0x32')];_0x10819d[_0x05de('0x33')]=_0x112439[_0x05de('0x33')];_0x10819d[_0x05de('0x34')]=_0x112439['outboundAnswerAgiCallsDay'];_0x10819d[_0x05de('0x35')]=_0x112439[_0x05de('0x35')];_0x10819d[_0x05de('0x36')]=_0x112439[_0x05de('0x36')];_0x10819d[_0x05de('0x37')]=_0x112439['outboundBusyCallsDay'];_0x10819d[_0x05de('0x38')]=_0x112439[_0x05de('0x38')];_0x10819d[_0x05de('0x39')]=_0x112439[_0x05de('0x39')];_0x10819d[_0x05de('0x3a')]=_0x112439[_0x05de('0x3a')];_0x10819d[_0x05de('0x3b')]=_0x112439[_0x05de('0x3b')];_0x10819d['outboundNoAnswerCallsDay']=_0x112439[_0x05de('0x3c')];_0x10819d[_0x05de('0x3d')]=_0x112439[_0x05de('0x3d')];_0x10819d['outboundOriginateFailureCallsDay']=_0x112439[_0x05de('0x3e')];_0x10819d[_0x05de('0x3f')]=_0x112439[_0x05de('0x3f')];_0x10819d['outboundRejectCallsDay']=_0x112439[_0x05de('0x40')];_0x10819d[_0x05de('0x41')]=_0x112439[_0x05de('0x41')];_0x10819d[_0x05de('0x42')]=_0x112439[_0x05de('0x42')];_0x10819d[_0x05de('0x43')]=_0x112439[_0x05de('0x43')];_0x10819d[_0x05de('0x44')]=_0x112439['predictiveIntervalAvgTalktime'];_0x10819d[_0x05de('0x45')]=_0x112439[_0x05de('0x45')];_0x10819d[_0x05de('0x46')]=_0x112439[_0x05de('0x46')];_0x10819d['predictiveIntervalErlangCalls']=_0x112439['predictiveIntervalErlangCalls'];_0x10819d[_0x05de('0x47')]=_0x112439['predictiveIntervalErlangCallsDroppedCalls'];_0x10819d[_0x05de('0x48')]=_0x112439[_0x05de('0x48')];_0x10819d[_0x05de('0x49')]=_0x112439[_0x05de('0x49')];_0x10819d[_0x05de('0x4a')]=_0x112439['predictiveIntervalPauses'];_0x10819d['predictiveIntervalAvailable']=_0x112439['predictiveIntervalAvailable'];_0x10819d['predictiveIntervalTotalCalls']=_0x112439[_0x05de('0x4b')];_0x10819d[_0x05de('0x1c')]=_0x112439['message'];_0x10819d[_0x05de('0x4c')]=_0x112439[_0x05de('0x4c')];_0x10819d['erlangCalls']=_0x112439['erlangCalls'];_0x10819d[_0x05de('0x4d')]=_0x112439[_0x05de('0x4d')];_0x10819d[_0x05de('0x4e')]=_0x112439['erlangAbandonmentRate'];_0x10819d[_0x05de('0x4f')]=_0x112439[_0x05de('0x4f')];_0x10819d[_0x05de('0x50')]=_0x112439['startPredictive'];_0x10819d['startProgressive']=_0x112439[_0x05de('0x51')];}if(_0x112439[_0x05de('0x52')]){_0x10819d['Trunk']={'id':_0x112439['Trunk']['id'],'name':_0x112439[_0x05de('0x52')][_0x05de('0xa')],'active':_0x112439[_0x05de('0x52')][_0x05de('0x53')],'callerid':_0x112439[_0x05de('0x52')][_0x05de('0x54')]};}if(_0x112439[_0x05de('0x55')]){_0x10819d[_0x05de('0x55')]={'id':_0x112439[_0x05de('0x55')]['id'],'name':_0x112439['Interval'][_0x05de('0xa')]};}_0x551497[_0x05de('0x56')](_0x10819d);}}_0x5ad6c0({'count':_0x551497[_0x05de('0x57')],'rows':_0x551497});});},'UpdateVoiceQueue':function(_0x2285e4){return new Promise(function(_0x124ffe,_0x5a41e1){var _0xe6cd4f=_[_0x05de('0x58')](_0x473ecb[_0x05de('0x20')],{'id':parseInt(_0x2285e4['id'])});var _0x3840e7=_[_0x05de('0x59')](_0x2285e4,['id']);if(_0xe6cd4f){for(var _0x2d5e65 in _0x3840e7){if(typeof _0x3840e7[_0x2d5e65]!==_0x05de('0x5a')&&typeof _0xe6cd4f[_0x2d5e65]!==_0x05de('0x5a')){_0xe6cd4f[_0x2d5e65]=_0x3840e7[_0x2d5e65];}}_0x124ffe(_0xe6cd4f);}else{_0x5a41e1();}});},'VoiceChannels':function(_0x50f6d0){return new Promise(function(_0x2aabe3,_0x5e520a){var _0x12a0a6=_['values'](_0x473ecb[_0x05de('0x5b')]);_0x2aabe3({'count':_0x12a0a6['length'],'rows':_0x12a0a6});});},'VoiceChannelMixMonitor':function(_0x91e31e){var _0x15e200=this;return new Promise(function(_0x2c11f4,_0x35fcda){if(ami['isConnected']()==![]){return _0x35fcda(_0x15e200[_0x05de('0x13')](0x1f4,[config[_0x05de('0x14')]['ip'],config[_0x05de('0x14')][_0x05de('0x15')],_0x05de('0x16')][_0x05de('0x17')]('\x20')));}var _0x2f640b=schema(properties[_0x05de('0x5c')])[_0x05de('0x5d')](_0x91e31e);if(_0x2f640b[_0x05de('0x57')]>0x0){return _0x35fcda(_0x15e200[_0x05de('0x13')](0x1f4,_['map'](_0x2f640b,_0x05de('0x1c'))['join'](',\x20')));}var _0x2ed02c=_[_0x05de('0x58')](_0x473ecb[_0x05de('0x5b')],{'uniqueid':_0x91e31e[_0x05de('0x5e')]});if(_0x2ed02c&&_0x2ed02c[_0x05de('0x5f')]){var _0x5c64e3=util[_0x05de('0x8')]('%s.%s',_0x91e31e[_0x05de('0x60')]||_0x91e31e[_0x05de('0x5e')],_0x91e31e[_0x05de('0x8')]||_0x05de('0x61'));return ami['Action']({'action':'MixMonitor','channel':_0x2ed02c[_0x05de('0x5f')],'file':_0x5c64e3,'options':_0x05de('0x62')})[_0x05de('0x1b')](function(_0x5f3edd){var _0x13eaf8=_['find'](_0x2ed02c[_0x05de('0x63')],{'filename':_0x05de('0x64')+_0x5c64e3[_0x05de('0x65')]()});if(_[_0x05de('0x66')](_0x13eaf8)){_0x2ed02c['monitors']['push']({'filename':_0x05de('0x64')+_0x5c64e3[_0x05de('0x65')](),'createdAt':moment()['format'](_0x05de('0x67')),'mixmonitorid':_0x5f3edd['mixmonitorid'],'status':_0x05de('0x68')});}else{_0x13eaf8['mixmonitorid']=_0x5f3edd[_0x05de('0x69')];_0x13eaf8[_0x05de('0x6a')]='rec';}_0x2c11f4({'code':0xc8,'message':[_0x91e31e[_0x05de('0x5e')],_0x05de('0x6b'),_0x5f3edd[_0x05de('0x69')]][_0x05de('0x17')]('\x20'),'mixmonitorid':_0x5f3edd[_0x05de('0x69')]});})[_0x05de('0x6c')](function(_0x2e652f){_0x35fcda(_0x15e200[_0x05de('0x13')](0x1f5,[_0x91e31e[_0x05de('0x5e')],_0x2e652f[_0x05de('0x1c')][_0x05de('0x65')]()][_0x05de('0x17')]('\x20')));});}else{return _0x35fcda(_0x15e200[_0x05de('0x13')](0x1f5,_0x05de('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x118a56){var _0x4a6066=this;return new Promise(function(_0x533223,_0x242a36){if(ami[_0x05de('0x12')]()==![]){return _0x242a36(_0x4a6066[_0x05de('0x13')](0x1f4,[config[_0x05de('0x14')]['ip'],config[_0x05de('0x14')]['username'],_0x05de('0x16')][_0x05de('0x17')]('\x20')));}var _0x2250d2=schema(properties[_0x05de('0x5c')])[_0x05de('0x5d')](_0x118a56);if(_0x2250d2['length']>0x0){return _0x242a36(_0x4a6066[_0x05de('0x13')](0x1f4,_[_0x05de('0x6e')](_0x2250d2,_0x05de('0x1c'))[_0x05de('0x17')](',\x20')));}var _0x43adc7=_[_0x05de('0x58')](_0x473ecb[_0x05de('0x5b')],{'uniqueid':_0x118a56['uniqueid']});if(_0x43adc7){return BPromise[_0x05de('0x6f')]()[_0x05de('0x1b')](function(){if(_0x43adc7[_0x05de('0x5f')]){return ami[_0x05de('0x1a')]({'action':_0x05de('0x70'),'channel':_0x43adc7[_0x05de('0x5f')],'mixmonitorid':_0x118a56[_0x05de('0x69')]})[_0x05de('0x6c')](function(_0x503059){});}})[_0x05de('0x1b')](function(){if(_0x43adc7[_0x05de('0x71')]){return ami[_0x05de('0x1a')]({'action':'StopMixMonitor','channel':_0x43adc7[_0x05de('0x71')],'mixmonitorid':_0x118a56[_0x05de('0x69')]})[_0x05de('0x6c')](function(_0x5e2f32){});}})[_0x05de('0x1b')](function(_0x3aa7ec){var _0x5f42c1=_['find'](_0x43adc7[_0x05de('0x63')],{'mixmonitorid':_0x118a56[_0x05de('0x69')]});if(_0x5f42c1){_0x5f42c1[_0x05de('0x6a')]=_0x05de('0x72');}})[_0x05de('0x1b')](function(){var _0x502819=util['format'](_0x05de('0x73'),_0x118a56[_0x05de('0x60')]||_0x118a56[_0x05de('0x5e')],_0x118a56['format']||_0x05de('0x61'));var _0x18723d=_[_0x05de('0x58')](_0x43adc7[_0x05de('0x63')],{'filename':_0x05de('0x64')+_0x502819[_0x05de('0x65')]()});if(_0x18723d){_0x18723d['status']=_0x05de('0x72');}})[_0x05de('0x1b')](function(){_0x533223({'code':0xc8,'message':[_0x118a56[_0x05de('0x5e')],_0x05de('0x74')][_0x05de('0x17')]('\x20')});})[_0x05de('0x6c')](function(_0x2f19f0){_0x242a36(_0x4a6066[_0x05de('0x13')](0x1f5,[_0x118a56['uniqueid'],_0x2f19f0[_0x05de('0x1c')][_0x05de('0x65')]()][_0x05de('0x17')]('\x20')));});}else{return _0x242a36(_0x4a6066[_0x05de('0x13')](0x1f5,_0x05de('0x6d')));}});},'VoiceQueuesChannels':function(_0x33ff49){return new Promise(function(_0x4ce722,_0x5ca354){var _0x3b0cc1=_['values'](_0x473ecb[_0x05de('0x75')]);_0x4ce722({'count':_0x3b0cc1[_0x05de('0x57')],'rows':_0x3b0cc1});});},'VoiceQueuesChannel':function(_0x106d30){var _0x42442b=this;return new Promise(function(_0x636b1d,_0x4fbcc0){var _0x5e3ff6=schema(properties[_0x05de('0x76')])['validate'](_0x106d30);if(_0x5e3ff6[_0x05de('0x57')]>0x0){return _0x4fbcc0(_0x42442b[_0x05de('0x13')](0x1f4,_[_0x05de('0x6e')](_0x5e3ff6,'message')[_0x05de('0x17')](',\x20')));}var _0x5d66a1=_[_0x05de('0x58')](_0x473ecb[_0x05de('0x75')],{'uniqueid':_0x106d30[_0x05de('0x5e')]});if(_0x5d66a1){_0x636b1d(_0x5d66a1);}else{return _0x4fbcc0(_0x42442b['error'](0x1f5,_0x05de('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0x1e0cf8){var _0x526fec=this;return new Promise(function(_0x2954c8,_0x348d8c){if(ami[_0x05de('0x12')]()==![]){return _0x348d8c(_0x526fec['error'](0x1f4,[config[_0x05de('0x14')]['ip'],config[_0x05de('0x14')][_0x05de('0x15')],_0x05de('0x16')][_0x05de('0x17')]('\x20')));}var _0xef5129=schema(properties[_0x05de('0x77')])[_0x05de('0x5d')](_0x1e0cf8);if(_0xef5129[_0x05de('0x57')]>0x0){return _0x348d8c(_0x526fec[_0x05de('0x13')](0x1f4,_[_0x05de('0x6e')](_0xef5129,_0x05de('0x1c'))[_0x05de('0x17')](',\x20')));}var _0x4bf260=_[_0x05de('0x58')](_0x473ecb[_0x05de('0x75')],{'uniqueid':_0x1e0cf8[_0x05de('0x5e')]});if(_0x4bf260&&_0x4bf260['channel']){return ami['Action']({'action':_0x05de('0x78'),'channel':_0x4bf260[_0x05de('0x5f')]})[_0x05de('0x1b')](function(_0x190042){_0x2954c8({'code':0xc8,'message':[_0x1e0cf8[_0x05de('0x5e')],_0x190042[_0x05de('0x1c')][_0x05de('0x65')]()][_0x05de('0x17')]('\x20')});})[_0x05de('0x6c')](function(_0x488c8){_0x348d8c(_0x526fec[_0x05de('0x13')](0x1f5,[_0x1e0cf8['uniqueid'],_0x488c8[_0x05de('0x1c')][_0x05de('0x65')]()][_0x05de('0x17')]('\x20')));});}else{return _0x348d8c(_0x526fec[_0x05de('0x13')](0x1f5,_0x05de('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x30c75a){var _0xe234dc=this;return new Promise(function(_0x2ec8e4,_0x24fe1b){if(ami['isConnected']()==![]){return _0x24fe1b(_0xe234dc[_0x05de('0x13')](0x1f4,[config[_0x05de('0x14')]['ip'],config[_0x05de('0x14')][_0x05de('0x15')],_0x05de('0x16')][_0x05de('0x17')]('\x20')));}var _0x14257c=schema(properties['voicequeuechannelredirect'])[_0x05de('0x5d')](_0x30c75a);if(_0x14257c[_0x05de('0x57')]>0x0){return _0x24fe1b(_0xe234dc[_0x05de('0x13')](0x1f4,_['map'](_0x14257c,_0x05de('0x1c'))['join'](',\x20')));}var _0x12c6db=_['find'](_0x473ecb[_0x05de('0x75')],{'uniqueid':_0x30c75a['uniqueid']});if(_0x12c6db&&_0x12c6db[_0x05de('0x5f')]){return ami[_0x05de('0x1a')]({'action':_0x05de('0x79'),'channel':_0x12c6db[_0x05de('0x5f')],'exten':_0x30c75a['exten'],'context':_0x30c75a['context']||_0x12c6db['context'],'priority':0x1})['then'](function(_0x3d3c81){_0x2ec8e4({'code':0xc8,'message':[_0x30c75a['uniqueid'],_0x3d3c81[_0x05de('0x1c')][_0x05de('0x65')]()][_0x05de('0x17')]('\x20')});})[_0x05de('0x6c')](function(_0x29c1d2){_0x24fe1b(_0xe234dc['error'](0x1f5,[_0x30c75a['uniqueid'],_0x29c1d2[_0x05de('0x1c')][_0x05de('0x65')]()][_0x05de('0x17')]('\x20')));});}else{return _0x24fe1b(_0xe234dc[_0x05de('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x514a05){return new Promise(function(_0x40b7eb,_0x4cac31){var _0x5ec93a=_[_0x05de('0x7a')](_0x473ecb['agents']);_0x40b7eb({'count':_0x5ec93a[_0x05de('0x57')],'rows':_0x5ec93a});});},'Telephones':function(_0x59b118){return new Promise(function(_0x324d54,_0x5b5d3a){var _0x3e4b58=_[_0x05de('0x7a')](_0x473ecb[_0x05de('0x7b')]);_0x324d54({'count':_0x3e4b58[_0x05de('0x57')],'rows':_0x3e4b58});});},'Trunks':function(_0x56238f){return new Promise(function(_0x5ef06d,_0x1b88ee){var _0x5603df=_[_0x05de('0x7a')](_0x473ecb['trunks']);_0x5ef06d({'count':_0x5603df[_0x05de('0x57')],'rows':_0x5603df});});},'OutboundChannels':function(_0x5ddc9b){return new Promise(function(_0x392cba,_0x4c3427){var _0x118af3=_[_0x05de('0x7a')](_0x473ecb['outboundChannels']);_0x392cba({'count':_0x118af3[_0x05de('0x57')],'rows':_0x118af3});});},'Outbound':function(_0x2f7835){return new Promise(function(_0x5cb60e,_0x5ac4db){_0x5cb60e(_0x473ecb[_0x05de('0x2d')]);});},'Campaigns':function(_0x5c3ca4){return new Promise(function(_0x1282a2,_0x5f0eeb){var _0x4daa5d=_[_0x05de('0x7a')](_0x473ecb['campaigns']);_0x1282a2({'count':_0x4daa5d[_0x05de('0x57')],'rows':_0x4daa5d});});},'VoiceQueuesPreview':function(_0x1ac001){var _0x131765=this;return new Promise(function(_0x5d58e8,_0x9c765f){_0x263950['run'](_0x1ac001['id'])[_0x05de('0x1b')](function(_0x481687){_0x5d58e8({'code':0xc8,'message':_0x481687['message']});})[_0x05de('0x6c')](function(_0x1720e4){_0x9c765f(_0x131765[_0x05de('0x13')](0x1f4,_0x1720e4['message']));});});},'EventManager':function(_0x909cd4){var _0x5ebb25=this;return new Promise(function(_0x3cc7e9,_0x39e9fd){if(!_0x909cd4['event']){return _0x39e9fd(_0x5ebb25[_0x05de('0x13')](0x1f4,_0x05de('0x7c')));}ami['emit'](_0x05de('0x7d')+_0x909cd4[_0x05de('0x7e')],_0x909cd4['message']);_0x3cc7e9({'code':0xc8,'message':_0x909cd4});});},'FaxAccounts':function(_0x2341ac){return new Promise(function(_0x3a6c23,_0x433802){var _0x269f00=_['values'](_0x473ecb[_0x05de('0x7f')]);_0x3a6c23({'count':_0x269f00[_0x05de('0x57')],'rows':_0x269f00});});},'SendFax':function(_0x406255){var _0x454ac1=this;return new Promise(function(_0x90e769,_0x5958d2){_0x536c94[_0x05de('0x80')](_0x406255)[_0x05de('0x1b')](function(_0x3fd059){_0x90e769({'code':0xc8,'message':_0x3fd059[_0x05de('0x1c')]});})[_0x05de('0x6c')](function(_0x39ae5f){_0x5958d2(_0x454ac1[_0x05de('0x13')](0x1f4,_0x39ae5f['message']));});});},'CheckAfterSend':function(_0x54a826){var _0x41f356=this;return new Promise(function(_0x10fa09,_0x532a32){_0x536c94['checkAfterSend'](_0x54a826)['then'](function(_0x57831f){_0x10fa09({'code':0xc8,'message':_0x57831f['message']});})[_0x05de('0x6c')](function(_0x2b92a3){_0x532a32(_0x41f356[_0x05de('0x13')](0x1f4,_0x2b92a3[_0x05de('0x1c')]));});});}};var _0x96f98f=jayson['server'](_0x53edc0)[_0x05de('0x81')]();_0x96f98f['on'](_0x05de('0x13'),function(_0x51dd4b){return _0x5f1f42(_0x51dd4b);});_0x96f98f['listen'](0x232a,_0x05de('0x82'),function(){console[_0x05de('0x83')](_0x05de('0x84'),0x232a);return _0x30b896(_0x05de('0x85')+0x232a);});});}; \ No newline at end of file +var _0xe40a=['originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','Interval','push','length','find','undefined','values','channels','voicechannel','map','uniqueid','channel','%s.%s','wav','ai(mixmonitorid)','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','exten','context','agents','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','SIP','name','timers','timer','updateAcw','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','join','keys','module','action','Reload','then','message','catch','error','pick','Action','voiceQueues','hasOwnProperty','strategy','answered','pTalking','sumDuration','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls'];(function(_0x547b53,_0x5ea6cb){var _0x166225=function(_0x17487a){while(--_0x17487a){_0x547b53['push'](_0x547b53['shift']());}};_0x166225(++_0x5ea6cb);}(_0xe40a,0x14e));var _0xae40=function(_0x13c1ec,_0x32783){_0x13c1ec=_0x13c1ec-0x0;var _0x3c4752=_0xe40a[_0x13c1ec];return _0x3c4752;};'use strict';var _=require(_0xae40('0x0'));var util=require('util');var jayson=require(_0xae40('0x1'));var schema=require(_0xae40('0x2'));var BPromise=require(_0xae40('0x3'));var moment=require(_0xae40('0x4'));var config=require(_0xae40('0x5'));var properties=require(_0xae40('0x6'));var ami=require(_0xae40('0x7'));exports[_0xae40('0x8')]=function(_0x4d1d7b,_0x2aa8f5,_0x4bbae9){return new BPromise(function(_0x34dbe9,_0x29ca9f){var _0x16ab1d={'QueuePause':function(_0x8b40ea){return new Promise(function(_0x1eb955,_0x2e0d0c){var _0x3f3792=util[_0xae40('0x9')]('%s/%s',_0xae40('0xa'),_0x8b40ea[_0xae40('0xb')]);if(_0x4d1d7b['timers']&&_0x4d1d7b[_0xae40('0xc')][_0x3f3792]&&_0x4d1d7b[_0xae40('0xc')][_0x3f3792][_0xae40('0xd')]){_0x4d1d7b[_0xae40('0xc')][_0x3f3792][_0xae40('0xe')]();}if(_0x4d1d7b['agents'][_0x3f3792]){_0x4d1d7b['agents'][_0x3f3792][_0xae40('0xf')]({'statePause':_0x8b40ea[_0xae40('0x10')]?!![]:![]});}_0x1eb955({'code':0xc8,'message':_0xae40('0x11')});});},'Reload':function(_0x4b0b7d){var _0x3b5ecb=this;return new Promise(function(_0x227403,_0x4f4ba7){if(ami[_0xae40('0x12')]()==![]){return _0x4f4ba7(_0x3b5ecb['error'](0x1f4,[config['asterisk']['ip'],config[_0xae40('0x13')][_0xae40('0x14')],_0xae40('0x15')][_0xae40('0x16')]('\x20')));}_0x4b0b7d=_['pick'](_0x4b0b7d,_[_0xae40('0x17')](properties[_0xae40('0x18')]));_0x4b0b7d[_0xae40('0x19')]=_0xae40('0x1a');return ami['Action'](_0x4b0b7d)[_0xae40('0x1b')](function(_0x3e4b88){_0x227403({'code':0xc8,'message':_0x3e4b88[_0xae40('0x1c')]});})[_0xae40('0x1d')](function(_0x450cba){_0x4f4ba7(_0x3b5ecb[_0xae40('0x1e')](0x1f5,_0x450cba[_0xae40('0x1c')]));});});},'Command':function(_0x4d66a7){var _0x3bf1db=this;return new Promise(function(_0xb719d6,_0xe23ce){if(ami[_0xae40('0x12')]()==![]){return _0xe23ce(_0x3bf1db[_0xae40('0x1e')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xae40('0x14')],_0xae40('0x15')][_0xae40('0x16')]('\x20')));}_0x4d66a7=_[_0xae40('0x1f')](_0x4d66a7,'command');_0x4d66a7[_0xae40('0x19')]='Command';return ami[_0xae40('0x20')](_0x4d66a7)[_0xae40('0x1b')](function(_0x53ae01){_0xb719d6({'code':0xc8,'message':_0x53ae01['content']});})[_0xae40('0x1d')](function(_0x5757f5){_0xe23ce(_0x3bf1db['error'](0x1f5,_0x5757f5[_0xae40('0x1c')]));});});},'VoiceQueues':function(_0x118a2e){return new Promise(function(_0xd4f3fb,_0x54b718){var _0x28c5c3=[];for(var _0x19a14d in _0x4d1d7b[_0xae40('0x21')]){if(_0x4d1d7b[_0xae40('0x21')][_0xae40('0x22')](_0x19a14d)){var _0x1f0156=_0x4d1d7b['voiceQueues'][_0x19a14d];var _0x2a4af7={'id':_0x1f0156['id'],'name':_0x1f0156[_0xae40('0xb')],'strategy':_0x1f0156[_0xae40('0x23')],'answered':_0x1f0156[_0xae40('0x24')],'available':_0x1f0156['available'],'loggedIn':_0x1f0156['loggedIn'],'pTalking':_0x1f0156[_0xae40('0x25')],'sumBillable':_0x1f0156['sumBillable'],'sumDuration':_0x1f0156[_0xae40('0x26')],'sumHoldTime':_0x1f0156['sumHoldTime']||0x0,'talking':_0x1f0156[_0xae40('0x27')],'total':_0x1f0156[_0xae40('0x28')],'type':_0x1f0156[_0xae40('0x29')],'unmanaged':_0x1f0156[_0xae40('0x2a')],'abandoned':_0x1f0156[_0xae40('0x2b')],'waiting':_0x1f0156[_0xae40('0x2c')],'loggedInDb':_0x1f0156[_0xae40('0x2d')]};if(_0x1f0156['type']===_0xae40('0x2e')){_0x2a4af7[_0xae40('0x2f')]=_0x1f0156[_0xae40('0x2f')];_0x2a4af7[_0xae40('0x30')]=_0x1f0156[_0xae40('0x30')];_0x2a4af7[_0xae40('0x31')]=_0x1f0156['dialOriginateCallerIdName'];_0x2a4af7[_0xae40('0x32')]=_0x1f0156[_0xae40('0x32')];_0x2a4af7['dialOriginateTimeout']=_0x1f0156[_0xae40('0x33')];_0x2a4af7[_0xae40('0x34')]=_0x1f0156[_0xae40('0x34')];_0x2a4af7[_0xae40('0x35')]=_0x1f0156[_0xae40('0x35')];_0x2a4af7[_0xae40('0x36')]=_0x1f0156[_0xae40('0x36')];_0x2a4af7[_0xae40('0x37')]=_0x1f0156[_0xae40('0x37')];_0x2a4af7[_0xae40('0x38')]=_0x1f0156[_0xae40('0x38')];_0x2a4af7[_0xae40('0x39')]=_0x1f0156['outboundBusyCallsDay'];_0x2a4af7['outboundCongestionCallsDay']=_0x1f0156[_0xae40('0x3a')];_0x2a4af7[_0xae40('0x3b')]=_0x1f0156[_0xae40('0x3b')];_0x2a4af7[_0xae40('0x3c')]=_0x1f0156[_0xae40('0x3c')];_0x2a4af7['outboundDropCallsDayTimeout']=_0x1f0156[_0xae40('0x3d')];_0x2a4af7[_0xae40('0x3e')]=_0x1f0156[_0xae40('0x3e')];_0x2a4af7[_0xae40('0x3f')]=_0x1f0156['outboundNoSuchCallsDay'];_0x2a4af7[_0xae40('0x40')]=_0x1f0156[_0xae40('0x40')];_0x2a4af7[_0xae40('0x41')]=_0x1f0156['outboundReCallsDay'];_0x2a4af7[_0xae40('0x42')]=_0x1f0156[_0xae40('0x42')];_0x2a4af7[_0xae40('0x43')]=_0x1f0156[_0xae40('0x43')];_0x2a4af7['predictiveIntervalAnsweredCalls']=_0x1f0156[_0xae40('0x44')];_0x2a4af7[_0xae40('0x45')]=_0x1f0156['predictiveIntervalAvgHoldtime'];_0x2a4af7[_0xae40('0x46')]=_0x1f0156[_0xae40('0x46')];_0x2a4af7[_0xae40('0x47')]=_0x1f0156[_0xae40('0x47')];_0x2a4af7[_0xae40('0x48')]=_0x1f0156[_0xae40('0x48')];_0x2a4af7[_0xae40('0x49')]=_0x1f0156[_0xae40('0x49')];_0x2a4af7[_0xae40('0x4a')]=_0x1f0156[_0xae40('0x4a')];_0x2a4af7[_0xae40('0x4b')]=_0x1f0156[_0xae40('0x4b')];_0x2a4af7[_0xae40('0x4c')]=_0x1f0156[_0xae40('0x4c')];_0x2a4af7[_0xae40('0x4d')]=_0x1f0156[_0xae40('0x4d')];_0x2a4af7[_0xae40('0x4e')]=_0x1f0156['predictiveIntervalAvailable'];_0x2a4af7[_0xae40('0x4f')]=_0x1f0156['predictiveIntervalTotalCalls'];_0x2a4af7[_0xae40('0x1c')]=_0x1f0156[_0xae40('0x1c')];_0x2a4af7[_0xae40('0x50')]=_0x1f0156[_0xae40('0x50')];_0x2a4af7[_0xae40('0x51')]=_0x1f0156[_0xae40('0x51')];_0x2a4af7['erlangCallToSecond']=_0x1f0156[_0xae40('0x52')];_0x2a4af7['erlangAbandonmentRate']=_0x1f0156[_0xae40('0x53')];_0x2a4af7[_0xae40('0x54')]=_0x1f0156[_0xae40('0x54')];_0x2a4af7['startPredictive']=_0x1f0156['startPredictive'];_0x2a4af7['startProgressive']=_0x1f0156[_0xae40('0x55')];}if(_0x1f0156[_0xae40('0x56')]){_0x2a4af7[_0xae40('0x56')]={'id':_0x1f0156['Trunk']['id'],'name':_0x1f0156[_0xae40('0x56')][_0xae40('0xb')],'active':_0x1f0156[_0xae40('0x56')]['active'],'callerid':_0x1f0156[_0xae40('0x56')]['callerid']};}if(_0x1f0156[_0xae40('0x57')]){_0x2a4af7['Interval']={'id':_0x1f0156[_0xae40('0x57')]['id'],'name':_0x1f0156[_0xae40('0x57')][_0xae40('0xb')]};}_0x28c5c3[_0xae40('0x58')](_0x2a4af7);}}_0xd4f3fb({'count':_0x28c5c3[_0xae40('0x59')],'rows':_0x28c5c3});});},'UpdateVoiceQueue':function(_0xd58556){return new Promise(function(_0xdd06ab,_0x192bf4){var _0x1d042a=_[_0xae40('0x5a')](_0x4d1d7b[_0xae40('0x21')],{'id':parseInt(_0xd58556['id'])});var _0x5cdc14=_['omit'](_0xd58556,['id']);if(_0x1d042a){for(var _0x509eda in _0x5cdc14){if(typeof _0x5cdc14[_0x509eda]!==_0xae40('0x5b')&&typeof _0x1d042a[_0x509eda]!==_0xae40('0x5b')){_0x1d042a[_0x509eda]=_0x5cdc14[_0x509eda];}}_0xdd06ab(_0x1d042a);}else{_0x192bf4();}});},'VoiceChannels':function(_0x32f2cc){return new Promise(function(_0x432128,_0x470227){var _0x1392fa=_[_0xae40('0x5c')](_0x4d1d7b[_0xae40('0x5d')]);_0x432128({'count':_0x1392fa[_0xae40('0x59')],'rows':_0x1392fa});});},'VoiceChannelMixMonitor':function(_0x572d8a){var _0x4cdf4e=this;return new Promise(function(_0x2846e2,_0x387a4a){if(ami['isConnected']()==![]){return _0x387a4a(_0x4cdf4e[_0xae40('0x1e')](0x1f4,[config[_0xae40('0x13')]['ip'],config[_0xae40('0x13')][_0xae40('0x14')],_0xae40('0x15')][_0xae40('0x16')]('\x20')));}var _0xa20a97=schema(properties[_0xae40('0x5e')])[_0xae40('0x2')](_0x572d8a);if(_0xa20a97[_0xae40('0x59')]>0x0){return _0x387a4a(_0x4cdf4e[_0xae40('0x1e')](0x1f4,_[_0xae40('0x5f')](_0xa20a97,_0xae40('0x1c'))[_0xae40('0x16')](',\x20')));}var _0x2fd5c2=_['find'](_0x4d1d7b[_0xae40('0x5d')],{'uniqueid':_0x572d8a[_0xae40('0x60')]});if(_0x2fd5c2&&_0x2fd5c2[_0xae40('0x61')]){var _0x10bbd7=util[_0xae40('0x9')](_0xae40('0x62'),_0x572d8a['filename']||_0x572d8a[_0xae40('0x60')],_0x572d8a['format']||_0xae40('0x63'));return ami['Action']({'action':'MixMonitor','channel':_0x2fd5c2[_0xae40('0x61')],'file':_0x10bbd7,'options':_0xae40('0x64')})[_0xae40('0x1b')](function(_0x2a1200){var _0x249d6f=_[_0xae40('0x5a')](_0x2fd5c2[_0xae40('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x10bbd7[_0xae40('0x66')]()});if(_[_0xae40('0x67')](_0x249d6f)){_0x2fd5c2[_0xae40('0x65')][_0xae40('0x58')]({'filename':_0xae40('0x68')+_0x10bbd7['toLowerCase'](),'createdAt':moment()[_0xae40('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x2a1200[_0xae40('0x69')],'status':'rec'});}else{_0x249d6f[_0xae40('0x69')]=_0x2a1200[_0xae40('0x69')];_0x249d6f[_0xae40('0x6a')]='rec';}_0x2846e2({'code':0xc8,'message':[_0x572d8a[_0xae40('0x60')],_0xae40('0x6b'),_0x2a1200[_0xae40('0x69')]][_0xae40('0x16')]('\x20'),'mixmonitorid':_0x2a1200[_0xae40('0x69')]});})[_0xae40('0x1d')](function(_0x18d963){_0x387a4a(_0x4cdf4e[_0xae40('0x1e')](0x1f5,[_0x572d8a[_0xae40('0x60')],_0x18d963[_0xae40('0x1c')]['toLowerCase']()]['join']('\x20')));});}else{return _0x387a4a(_0x4cdf4e[_0xae40('0x1e')](0x1f5,_0xae40('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0xf283cb){var _0x20353c=this;return new Promise(function(_0x43d88c,_0x2e713d){if(ami[_0xae40('0x12')]()==![]){return _0x2e713d(_0x20353c['error'](0x1f4,[config[_0xae40('0x13')]['ip'],config[_0xae40('0x13')][_0xae40('0x14')],_0xae40('0x15')][_0xae40('0x16')]('\x20')));}var _0x304551=schema(properties[_0xae40('0x5e')])[_0xae40('0x2')](_0xf283cb);if(_0x304551[_0xae40('0x59')]>0x0){return _0x2e713d(_0x20353c[_0xae40('0x1e')](0x1f4,_['map'](_0x304551,_0xae40('0x1c'))[_0xae40('0x16')](',\x20')));}var _0xe4868=_[_0xae40('0x5a')](_0x4d1d7b[_0xae40('0x5d')],{'uniqueid':_0xf283cb[_0xae40('0x60')]});if(_0xe4868){return BPromise[_0xae40('0x6d')]()['then'](function(){if(_0xe4868[_0xae40('0x61')]){return ami[_0xae40('0x20')]({'action':_0xae40('0x6e'),'channel':_0xe4868[_0xae40('0x61')],'mixmonitorid':_0xf283cb[_0xae40('0x69')]})[_0xae40('0x1d')](function(_0x7c2e83){});}})[_0xae40('0x1b')](function(){if(_0xe4868['destinationchannel']){return ami['Action']({'action':_0xae40('0x6e'),'channel':_0xe4868[_0xae40('0x6f')],'mixmonitorid':_0xf283cb['mixmonitorid']})[_0xae40('0x1d')](function(_0x40aad4){});}})[_0xae40('0x1b')](function(_0x61a258){var _0x5630ba=_[_0xae40('0x5a')](_0xe4868[_0xae40('0x65')],{'mixmonitorid':_0xf283cb[_0xae40('0x69')]});if(_0x5630ba){_0x5630ba[_0xae40('0x6a')]=_0xae40('0x70');}})[_0xae40('0x1b')](function(){var _0x18ed44=util['format'](_0xae40('0x62'),_0xf283cb[_0xae40('0x71')]||_0xf283cb[_0xae40('0x60')],_0xf283cb[_0xae40('0x9')]||_0xae40('0x63'));var _0x592395=_[_0xae40('0x5a')](_0xe4868[_0xae40('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x18ed44[_0xae40('0x66')]()});if(_0x592395){_0x592395[_0xae40('0x6a')]='stop';}})['then'](function(){_0x43d88c({'code':0xc8,'message':[_0xf283cb[_0xae40('0x60')],_0xae40('0x72')][_0xae40('0x16')]('\x20')});})[_0xae40('0x1d')](function(_0xb0957a){_0x2e713d(_0x20353c[_0xae40('0x1e')](0x1f5,[_0xf283cb[_0xae40('0x60')],_0xb0957a[_0xae40('0x1c')][_0xae40('0x66')]()][_0xae40('0x16')]('\x20')));});}else{return _0x2e713d(_0x20353c[_0xae40('0x1e')](0x1f5,_0xae40('0x6c')));}});},'VoiceQueuesChannels':function(_0x26edd0){return new Promise(function(_0x33d517,_0x46da13){var _0x77a14b=_['values'](_0x4d1d7b[_0xae40('0x73')]);_0x33d517({'count':_0x77a14b[_0xae40('0x59')],'rows':_0x77a14b});});},'VoiceQueuesChannel':function(_0x4b34f0){var _0x3b5697=this;return new Promise(function(_0x4081e9,_0x27eaf4){var _0x245d14=schema(properties[_0xae40('0x74')])[_0xae40('0x2')](_0x4b34f0);if(_0x245d14['length']>0x0){return _0x27eaf4(_0x3b5697[_0xae40('0x1e')](0x1f4,_['map'](_0x245d14,_0xae40('0x1c'))[_0xae40('0x16')](',\x20')));}var _0x326fda=_[_0xae40('0x5a')](_0x4d1d7b[_0xae40('0x73')],{'uniqueid':_0x4b34f0[_0xae40('0x60')]});if(_0x326fda){_0x4081e9(_0x326fda);}else{return _0x27eaf4(_0x3b5697[_0xae40('0x1e')](0x1f5,_0xae40('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x8b6245){var _0x263472=this;return new Promise(function(_0x2568f7,_0x2cd2bb){if(ami[_0xae40('0x12')]()==![]){return _0x2cd2bb(_0x263472['error'](0x1f4,[config['asterisk']['ip'],config[_0xae40('0x13')][_0xae40('0x14')],'ami\x20disconnected'][_0xae40('0x16')]('\x20')));}var _0x58b4e0=schema(properties[_0xae40('0x75')])[_0xae40('0x2')](_0x8b6245);if(_0x58b4e0[_0xae40('0x59')]>0x0){return _0x2cd2bb(_0x263472['error'](0x1f4,_[_0xae40('0x5f')](_0x58b4e0,_0xae40('0x1c'))['join'](',\x20')));}var _0x3f52b0=_['find'](_0x4d1d7b['queueChannels'],{'uniqueid':_0x8b6245[_0xae40('0x60')]});if(_0x3f52b0&&_0x3f52b0['channel']){return ami['Action']({'action':_0xae40('0x76'),'channel':_0x3f52b0[_0xae40('0x61')]})[_0xae40('0x1b')](function(_0x62fb4b){_0x2568f7({'code':0xc8,'message':[_0x8b6245['uniqueid'],_0x62fb4b[_0xae40('0x1c')][_0xae40('0x66')]()]['join']('\x20')});})[_0xae40('0x1d')](function(_0x3a7562){_0x2cd2bb(_0x263472[_0xae40('0x1e')](0x1f5,[_0x8b6245[_0xae40('0x60')],_0x3a7562[_0xae40('0x1c')][_0xae40('0x66')]()][_0xae40('0x16')]('\x20')));});}else{return _0x2cd2bb(_0x263472[_0xae40('0x1e')](0x1f5,_0xae40('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x2300a0){var _0x26957c=this;return new Promise(function(_0x394cd0,_0x128e87){if(ami['isConnected']()==![]){return _0x128e87(_0x26957c['error'](0x1f4,[config[_0xae40('0x13')]['ip'],config[_0xae40('0x13')][_0xae40('0x14')],'ami\x20disconnected']['join']('\x20')));}var _0x344594=schema(properties['voicequeuechannelredirect'])[_0xae40('0x2')](_0x2300a0);if(_0x344594['length']>0x0){return _0x128e87(_0x26957c['error'](0x1f4,_[_0xae40('0x5f')](_0x344594,'message')[_0xae40('0x16')](',\x20')));}var _0x333178=_[_0xae40('0x5a')](_0x4d1d7b[_0xae40('0x73')],{'uniqueid':_0x2300a0['uniqueid']});if(_0x333178&&_0x333178[_0xae40('0x61')]){return ami[_0xae40('0x20')]({'action':'Redirect','channel':_0x333178[_0xae40('0x61')],'exten':_0x2300a0[_0xae40('0x77')],'context':_0x2300a0[_0xae40('0x78')]||_0x333178['context'],'priority':0x1})[_0xae40('0x1b')](function(_0x369850){_0x394cd0({'code':0xc8,'message':[_0x2300a0[_0xae40('0x60')],_0x369850[_0xae40('0x1c')]['toLowerCase']()][_0xae40('0x16')]('\x20')});})[_0xae40('0x1d')](function(_0x4203c5){_0x128e87(_0x26957c[_0xae40('0x1e')](0x1f5,[_0x2300a0['uniqueid'],_0x4203c5['message'][_0xae40('0x66')]()][_0xae40('0x16')]('\x20')));});}else{return _0x128e87(_0x26957c[_0xae40('0x1e')](0x1f5,_0xae40('0x6c')));}});},'Agents':function(_0x2c42a1){return new Promise(function(_0x1973df,_0x8fac36){var _0x3b4edb=_['values'](_0x4d1d7b[_0xae40('0x79')]);_0x1973df({'count':_0x3b4edb[_0xae40('0x59')],'rows':_0x3b4edb});});},'Telephones':function(_0x399e78){return new Promise(function(_0x58b0cc,_0x4abef2){var _0x51ae5b=_[_0xae40('0x5c')](_0x4d1d7b['telephones']);_0x58b0cc({'count':_0x51ae5b[_0xae40('0x59')],'rows':_0x51ae5b});});},'Trunks':function(_0x4f8e5c){return new Promise(function(_0x5ba6bd,_0x2161d9){var _0x489aaf=_['values'](_0x4d1d7b[_0xae40('0x7a')]);_0x5ba6bd({'count':_0x489aaf[_0xae40('0x59')],'rows':_0x489aaf});});},'OutboundChannels':function(_0x5487b9){return new Promise(function(_0xb14ee9,_0x21acf4){var _0x3623d0=_['values'](_0x4d1d7b[_0xae40('0x7b')]);_0xb14ee9({'count':_0x3623d0[_0xae40('0x59')],'rows':_0x3623d0});});},'Outbound':function(_0x3f6d67){return new Promise(function(_0x49010c,_0x5db03c){_0x49010c(_0x4d1d7b[_0xae40('0x2e')]);});},'Campaigns':function(_0x281929){return new Promise(function(_0x2e1379,_0x31cfff){var _0x4b378c=_['values'](_0x4d1d7b[_0xae40('0x7c')]);_0x2e1379({'count':_0x4b378c[_0xae40('0x59')],'rows':_0x4b378c});});},'VoiceQueuesPreview':function(_0x41720c){var _0x1a6d4b=this;return new Promise(function(_0x14efd0,_0x554b7c){_0x2aa8f5[_0xae40('0x7d')](_0x41720c['id'])[_0xae40('0x1b')](function(_0x3d1a23){_0x14efd0({'code':0xc8,'message':_0x3d1a23[_0xae40('0x1c')]});})[_0xae40('0x1d')](function(_0x23fca5){_0x554b7c(_0x1a6d4b[_0xae40('0x1e')](0x1f4,_0x23fca5[_0xae40('0x1c')]));});});},'EventManager':function(_0x1215e2){var _0x4be072=this;return new Promise(function(_0x70987e,_0xb29ef8){if(!_0x1215e2['event']){return _0xb29ef8(_0x4be072['error'](0x1f4,_0xae40('0x7e')));}ami[_0xae40('0x7f')](_0xae40('0x80')+_0x1215e2[_0xae40('0x81')],_0x1215e2[_0xae40('0x1c')]);_0x70987e({'code':0xc8,'message':_0x1215e2});});},'FaxAccounts':function(_0xe3256a){return new Promise(function(_0x13326f,_0x3f9c26){var _0x37f26e=_[_0xae40('0x5c')](_0x4d1d7b[_0xae40('0x82')]);_0x13326f({'count':_0x37f26e['length'],'rows':_0x37f26e});});},'SendFax':function(_0x51db9d){var _0x598418=this;return new Promise(function(_0x21cd5a,_0x1006f6){_0x4bbae9[_0xae40('0x83')](_0x51db9d)['then'](function(_0x408893){_0x21cd5a({'code':0xc8,'message':_0x408893[_0xae40('0x1c')]});})[_0xae40('0x1d')](function(_0x4bf1fa){_0x1006f6(_0x598418[_0xae40('0x1e')](0x1f4,_0x4bf1fa[_0xae40('0x1c')]));});});},'CheckAfterSend':function(_0x3f2c76){var _0x20bc6b=this;return new Promise(function(_0x13a556,_0x5b3eeb){_0x4bbae9[_0xae40('0x84')](_0x3f2c76)['then'](function(_0x2ac76e){_0x13a556({'code':0xc8,'message':_0x2ac76e[_0xae40('0x1c')]});})[_0xae40('0x1d')](function(_0x5d4aa5){_0x5b3eeb(_0x20bc6b['error'](0x1f4,_0x5d4aa5[_0xae40('0x1c')]));});});}};var _0x1817ce=jayson[_0xae40('0x85')](_0x16ab1d)[_0xae40('0x86')]();_0x1817ce['on'](_0xae40('0x1e'),function(_0x35f7be){return _0x29ca9f(_0x35f7be);});_0x1817ce[_0xae40('0x8')](0x232a,'127.0.0.1',function(){console[_0xae40('0x87')](_0xae40('0x88'),0x232a);return _0x34dbe9(_0xae40('0x89')+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 5af9300..5e3b948 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 _0x8740=['isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridnum','isNil','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s','action','merge','lodash','bluebird','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','data2','ListId','data3','split','phone','$or','destcalleridnum','lastName','mobile','fax','createdAt','updatedAt','union','then'];(function(_0x1c441b,_0x113389){var _0x50b12c=function(_0x45f70a){while(--_0x45f70a){_0x1c441b['push'](_0x1c441b['shift']());}};_0x50b12c(++_0x113389);}(_0x8740,0xfb));var _0x0874=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x8740[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0x0874('0x0'));var BPromise=require(_0x0874('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x0874('0x2'));var logger=require(_0x0874('0x3'))(_0x0874('0x4'));var cmContactRpc=require(_0x0874('0x5'));config[_0x0874('0x6')]=_[_0x0874('0x7')](config[_0x0874('0x6')],{'host':_0x0874('0x8'),'port':0x18eb});var io=require(_0x0874('0x9'))(new Redis(config[_0x0874('0x6')]));function emit(_0x1f5927,_0x3b5fc4,_0x32803f,_0x3a1fa0,_0x2671b4){logger[_0x0874('0xa')](_0x0874('0xb'),_0x1f5927,_0x3b5fc4['id'],_0x32803f,_0x3a1fa0,JSON[_0x0874('0xc')](_0x2671b4));io['to'](_0x32803f)['emit'](_0x3a1fa0,_0x2671b4);}exports[_0x0874('0xd')]=function(_0x28b76e,_0xf8237c,_0x54540c,_0xf1097e){var _0x277f19,_0x1db53e;var _0x2c718a={};var _0x43c8ec=Number(_0x54540c[_0x0874('0xe')]);var _0x1cd3cb=_0x54540c[_0x0874('0xf')]?Boolean(Number(_0x54540c[_0x0874('0xf')])):![];var _0x1c99ea;if(_0xf1097e['xmd-contactid']){_0x2c718a['id']=_0xf1097e['xmd-contactid'];}if(!_0x2c718a['id']){_0x2c718a[_0x0874('0x10')]=_0x43c8ec;_0x1c99ea=_0x54540c['data3']&&_0x54540c[_0x0874('0x11')]!=='0'?_0x54540c[_0x0874('0x11')][_0x0874('0x12')](','):[_0x0874('0x13')];_0x2c718a[_0x0874('0x14')]=_['map'](_0x1c99ea,function(_0x1b2206){var _0x71b8a7={};_0x71b8a7[_0x1b2206]=_0xf1097e['routeId']?_0xf1097e[_0x0874('0x15')]:_0xf1097e['calleridnum'];return _0x71b8a7;});}var _0x13c4ef=['id','firstName',_0x0874('0x16'),_0x0874('0x13'),_0x0874('0x17'),_0x0874('0x18'),_0x0874('0x10'),_0x0874('0x19'),'scheduledAt',_0x0874('0x1a')];var _0x2cc25c=_[_0x0874('0x1b')](_0x13c4ef,_0x1c99ea);BPromise['resolve']()[_0x0874('0x1c')](cmContactRpc['getContacts']({'attributes':_0x2cc25c,'where':_0x2c718a}))['then'](function(_0x40d80b){_0x1db53e=_0x40d80b;if(!_[_0x0874('0x1d')](_0x1db53e)){if(_0x1db53e[_0x0874('0x1e')]===0x1){_0x277f19=_0x1db53e[0x0];logger[_0x0874('0xa')](_0x0874('0x1f'),_0xf1097e[_0x0874('0x20')],_0xf8237c['id'],_0x277f19['id']);}else{logger[_0x0874('0xa')](_0x0874('0x21'),_0xf1097e[_0x0874('0x20')],_0xf8237c['id'],_[_0x0874('0x22')](_0x1db53e,'id')['join'](','));}return;}else{logger[_0x0874('0xa')](_0x0874('0x23'),_0xf1097e['uniqueid'],_0xf8237c['id']);var _0x5a4c8b={'ListId':_0x43c8ec};var _0x4041c7=_0x54540c['data4']&&_0x54540c[_0x0874('0x24')]!=='0'?_0x54540c[_0x0874('0x24')]:_0x0874('0x13');if(_0x1cd3cb){logger[_0x0874('0xa')](_0x0874('0x25'),_0xf1097e['uniqueid'],_0xf8237c['id']);_0x5a4c8b[_0x4041c7]=_['isNil'](_0xf1097e[_0x0874('0x26')])?_0xf1097e[_0x0874('0x27')]:_0xf1097e['destcalleridnum'];if(_[_0x0874('0x28')](_0xf1097e[_0x0874('0x26')])){_0x5a4c8b[_0x0874('0x29')]=_0xf1097e[_0x0874('0x2a')]&&_0xf1097e[_0x0874('0x2a')]!==_0x0874('0x2b')?_0xf1097e[_0x0874('0x2a')]:_0x0874('0x2c');}else{_0x5a4c8b[_0x0874('0x29')]=_0xf1097e['destcalleridname']&&_0xf1097e[_0x0874('0x2d')]!==''?_0xf1097e[_0x0874('0x2d')]:_0x0874('0x2c');}return BPromise['resolve']()[_0x0874('0x1c')](cmContactRpc[_0x0874('0x2e')](_0x5a4c8b))[_0x0874('0x1c')](function(_0x1e4cf5){_0x277f19=_0x1e4cf5;_0x1db53e[_0x0874('0x2f')](_0x1e4cf5);if(_0x277f19){logger[_0x0874('0xa')](_0x0874('0x30'),_0xf1097e[_0x0874('0x20')],_0xf8237c['id'],_0x277f19['id']);}return;});}else{logger[_0x0874('0xa')](_0x0874('0x31'),_0xf1097e[_0x0874('0x20')],_0xf8237c['id']);_0x5a4c8b[_0x4041c7]=_['isNil'](_0xf1097e[_0x0874('0x26')])?_0xf1097e['calleridnum']:_0xf1097e[_0x0874('0x15')];if(_[_0x0874('0x28')](_0xf1097e[_0x0874('0x26')])){_0x5a4c8b['firstName']=_0xf1097e[_0x0874('0x2a')]&&_0xf1097e[_0x0874('0x2a')]!==_0x0874('0x2b')?_0xf1097e['calleridname']:'Unknown';}else{_0x5a4c8b[_0x0874('0x29')]=_0xf1097e[_0x0874('0x2d')]&&_0xf1097e[_0x0874('0x2d')]!==_0x0874('0x2b')?_0xf1097e['destcalleridname']:_0x0874('0x2c');}_0x277f19=_0x5a4c8b;_0x1db53e[_0x0874('0x2f')](_0x5a4c8b);return;}}})[_0x0874('0x1c')](function(){if(_0x28b76e){emit(_0xf1097e['uniqueid'],_0xf8237c,util['format'](_0x0874('0x32'),_0x28b76e[_0x0874('0x33')]),util[_0x0874('0x34')](_0x0874('0x35'),_0x54540c[_0x0874('0x36')]['toLowerCase']()),{'evt':_[_0x0874('0x37')](_0xf1097e,{'autoCreate':_0x1cd3cb}),'contact':_0x277f19===undefined?{}:_0x277f19,'contacts':_0x1db53e[_0x0874('0x1e')]===0x0?undefined:_0x1db53e});}});}; \ No newline at end of file +var _0xd93f=['../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','socket.io-emitter','[CM][%s][%s]','emit','exec','data1','data2','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','createdAt','scheduledAt','updatedAt','union','getContacts','then','isEmpty','info','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','resolve','push','[CM][%s][%s]\x20Autocreate\x20disabled','isNil','format','user:%s','name','trigger:%s','toLowerCase','merge','length','lodash','bluebird','ioredis','util'];(function(_0x26fa87,_0x1621f5){var _0x2fca7d=function(_0x4141f2){while(--_0x4141f2){_0x26fa87['push'](_0x26fa87['shift']());}};_0x2fca7d(++_0x1621f5);}(_0xd93f,0xa1));var _0xfd93=function(_0x5abf7a,_0x4d16bb){_0x5abf7a=_0x5abf7a-0x0;var _0x17350f=_0xd93f[_0x5abf7a];return _0x17350f;};'use strict';var _=require(_0xfd93('0x0'));var BPromise=require(_0xfd93('0x1'));var Redis=require(_0xfd93('0x2'));var util=require(_0xfd93('0x3'));var config=require('../../../../config/environment');var logger=require(_0xfd93('0x4'))(_0xfd93('0x5'));var cmContactRpc=require(_0xfd93('0x6'));config['redis']=_[_0xfd93('0x7')](config[_0xfd93('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xfd93('0x9'))(new Redis(config[_0xfd93('0x8')]));function emit(_0x3af9a3,_0x4ca4b1,_0x2d77d5,_0x379e1d,_0xa25a4e){logger['info'](_0xfd93('0xa'),_0x3af9a3,_0x4ca4b1['id'],_0x2d77d5,_0x379e1d,JSON['stringify'](_0xa25a4e));io['to'](_0x2d77d5)[_0xfd93('0xb')](_0x379e1d,_0xa25a4e);}exports[_0xfd93('0xc')]=function(_0x3591e6,_0x175d83,_0x24e6ea,_0x2521de){var _0x26fe17,_0x983a3f;var _0x3b32cd={};var _0x339a61=Number(_0x24e6ea[_0xfd93('0xd')]);var _0x4c7b33=_0x24e6ea['data2']?Boolean(Number(_0x24e6ea[_0xfd93('0xe')])):![];var _0x384a72;if(_0x2521de['xmd-contactid']){_0x3b32cd['id']=_0x2521de['xmd-contactid'];}if(!_0x3b32cd['id']){_0x3b32cd[_0xfd93('0xf')]=_0x339a61;_0x384a72=_0x24e6ea[_0xfd93('0x10')]&&_0x24e6ea[_0xfd93('0x10')]!=='0'?_0x24e6ea[_0xfd93('0x10')][_0xfd93('0x11')](','):[_0xfd93('0x12')];_0x3b32cd[_0xfd93('0x13')]=_[_0xfd93('0x14')](_0x384a72,function(_0x34592c){var _0x1123b4={};_0x1123b4[_0x34592c]=_0x2521de[_0xfd93('0x15')]?_0x2521de[_0xfd93('0x16')]:_0x2521de[_0xfd93('0x17')];return _0x1123b4;});}var _0x30935b=['id',_0xfd93('0x18'),_0xfd93('0x19'),'phone',_0xfd93('0x1a'),'fax',_0xfd93('0xf'),_0xfd93('0x1b'),_0xfd93('0x1c'),_0xfd93('0x1d')];var _0xcd1737=_[_0xfd93('0x1e')](_0x30935b,_0x384a72);BPromise['resolve']()['then'](cmContactRpc[_0xfd93('0x1f')]({'attributes':_0xcd1737,'where':_0x3b32cd}))[_0xfd93('0x20')](function(_0x370567){_0x983a3f=_0x370567;if(!_[_0xfd93('0x21')](_0x983a3f)){if(_0x983a3f['length']===0x1){_0x26fe17=_0x983a3f[0x0];logger[_0xfd93('0x22')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x2521de[_0xfd93('0x23')],_0x175d83['id'],_0x26fe17['id']);}else{logger[_0xfd93('0x22')](_0xfd93('0x24'),_0x2521de['uniqueid'],_0x175d83['id'],_['map'](_0x983a3f,'id')[_0xfd93('0x25')](','));}return;}else{logger[_0xfd93('0x22')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x2521de[_0xfd93('0x23')],_0x175d83['id']);var _0x39b1ca={'ListId':_0x339a61};var _0xf9b77c=_0x24e6ea['data4']&&_0x24e6ea[_0xfd93('0x26')]!=='0'?_0x24e6ea['data4']:_0xfd93('0x12');if(_0x4c7b33){logger[_0xfd93('0x22')](_0xfd93('0x27'),_0x2521de[_0xfd93('0x23')],_0x175d83['id']);_0x39b1ca[_0xf9b77c]=_['isNil'](_0x2521de[_0xfd93('0x15')])?_0x2521de[_0xfd93('0x17')]:_0x2521de[_0xfd93('0x16')];if(_['isNil'](_0x2521de['routeId'])){_0x39b1ca[_0xfd93('0x18')]=_0x2521de[_0xfd93('0x28')]&&_0x2521de[_0xfd93('0x28')]!==_0xfd93('0x29')?_0x2521de['calleridname']:_0xfd93('0x2a');}else{_0x39b1ca['firstName']=_0x2521de['destcalleridname']&&_0x2521de[_0xfd93('0x2b')]!==_0xfd93('0x29')?_0x2521de[_0xfd93('0x2b')]:_0xfd93('0x2a');}return BPromise[_0xfd93('0x2c')]()['then'](cmContactRpc['createContact'](_0x39b1ca))[_0xfd93('0x20')](function(_0x422c9c){_0x26fe17=_0x422c9c;_0x983a3f[_0xfd93('0x2d')](_0x422c9c);if(_0x26fe17){logger[_0xfd93('0x22')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x2521de[_0xfd93('0x23')],_0x175d83['id'],_0x26fe17['id']);}return;});}else{logger['info'](_0xfd93('0x2e'),_0x2521de['uniqueid'],_0x175d83['id']);_0x39b1ca[_0xf9b77c]=_[_0xfd93('0x2f')](_0x2521de[_0xfd93('0x15')])?_0x2521de[_0xfd93('0x17')]:_0x2521de['destcalleridnum'];if(_['isNil'](_0x2521de[_0xfd93('0x15')])){_0x39b1ca[_0xfd93('0x18')]=_0x2521de[_0xfd93('0x28')]&&_0x2521de[_0xfd93('0x28')]!==_0xfd93('0x29')?_0x2521de[_0xfd93('0x28')]:_0xfd93('0x2a');}else{_0x39b1ca['firstName']=_0x2521de['destcalleridname']&&_0x2521de[_0xfd93('0x2b')]!==''?_0x2521de[_0xfd93('0x2b')]:_0xfd93('0x2a');}_0x26fe17=_0x39b1ca;_0x983a3f[_0xfd93('0x2d')](_0x39b1ca);return;}}})[_0xfd93('0x20')](function(){if(_0x3591e6){emit(_0x2521de[_0xfd93('0x23')],_0x175d83,util[_0xfd93('0x30')](_0xfd93('0x31'),_0x3591e6[_0xfd93('0x32')]),util[_0xfd93('0x30')](_0xfd93('0x33'),_0x24e6ea['action'][_0xfd93('0x34')]()),{'evt':_[_0xfd93('0x35')](_0x2521de,{'autoCreate':_0x4c7b33}),'contact':_0x26fe17===undefined?{}:_0x26fe17,'contacts':_0x983a3f[_0xfd93('0x36')]===0x0?undefined:_0x983a3f});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 0798041..5a3e06b 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 _0xacae=['custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','length','Actions','action','motionbar','browser','data1','popup','TemplateId','html','data2','render','template\x20not\x20found','uri','buildUri','isNil','data3','location','data4','windowWidth','data5','800','600','data6','winApplication','winArguments','name','format','trigger:%s:%s','toLowerCase','jscripty','trigger:%s','user:%s','contactmanager','exec','accounts','queue','routeId','parse','search','replace','every','AllConditions','AnyConditions','checkConditions','field','account','channel','ChatWebsiteId','operator','upperFirst','AccountId','value','message','event','agent','membername','lastevent','exports','util','lodash','url','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xacae,0x14f));var _0xeaca=function(_0x1a1886,_0x1a88eb){_0x1a1886=_0x1a1886-0x0;var _0xa6b76a=_0xacae[_0x1a1886];return _0xa6b76a;};'use strict';var util=require(_0xeaca('0x0'));var _=require(_0xeaca('0x1'));var url=require(_0xeaca('0x2'));var Mustache=require('mustache');var Redis=require(_0xeaca('0x3'));var urlforward=require(_0xeaca('0x4'));var integration=require(_0xeaca('0x5'));var cmContact=require(_0xeaca('0x6'));var script=require(_0xeaca('0x7'));var config=require(_0xeaca('0x8'));var logger=require(_0xeaca('0x9'))(_0xeaca('0xa'));var ami=require(_0xeaca('0xb'));config[_0xeaca('0xc')]=_[_0xeaca('0xd')](config['redis'],{'host':_0xeaca('0xe'),'port':0x18eb});var io=require(_0xeaca('0xf'))(new Redis(config[_0xeaca('0xc')]));var operators={'equals':function(_0x3419ed,_0x394868){return _0x3419ed==_0x394868;},'not_equals':function(_0x471bd6,_0x4fabc5){return _0x471bd6!=_0x4fabc5;}};var barAndWebActions=['popup','url',_0xeaca('0x10')];function Trigger(_0x7e5b89){this[_0xeaca('0x11')]=_0x7e5b89[_0xeaca('0x11')];this[_0xeaca('0x12')]=_0x7e5b89[_0xeaca('0x12')];this[_0xeaca('0x13')]=_0x7e5b89[_0xeaca('0x13')];this[_0xeaca('0x14')]=_0x7e5b89[_0xeaca('0x14')];this[_0xeaca('0x15')]=_0x7e5b89['voiceExtensions'];this[_0xeaca('0x16')]=_0x7e5b89['zendeskAccounts'];this[_0xeaca('0x17')]=_0x7e5b89[_0xeaca('0x17')];this['salesforceAccounts']=_0x7e5b89[_0xeaca('0x18')];this[_0xeaca('0x19')]=_0x7e5b89['sugarcrmAccounts'];this[_0xeaca('0x1a')]=_0x7e5b89['zohoAccounts'];this[_0xeaca('0x1b')]=_0x7e5b89[_0xeaca('0x1b')];this['vtigerAccounts']=_0x7e5b89[_0xeaca('0x1c')];this[_0xeaca('0x1d')]=_0x7e5b89[_0xeaca('0x1d')];this[_0xeaca('0x1e')]=_0x7e5b89['dynamics365Accounts'];this[_0xeaca('0x1f')]=_0x7e5b89[_0xeaca('0x1f')];this['accounts']={'zendesk':this[_0xeaca('0x16')],'salesforce':this[_0xeaca('0x18')],'freshdesk':this[_0xeaca('0x17')],'sugarcrm':this[_0xeaca('0x19')],'zoho':this[_0xeaca('0x1a')],'desk':this['deskAccounts'],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xeaca('0x1e')],'freshsales':this[_0xeaca('0x1f')],'servicenow':this['servicenowAccounts']};ami['on']('custom:agentcalled',this[_0xeaca('0x20')][_0xeaca('0x21')](this));ami['on'](_0xeaca('0x22'),this[_0xeaca('0x20')][_0xeaca('0x21')](this));ami['on'](_0xeaca('0x23'),this[_0xeaca('0x20')]['bind'](this));ami['on'](_0xeaca('0x24'),this[_0xeaca('0x20')][_0xeaca('0x21')](this));ami['on']('custom:agentnosuchnumber',this[_0xeaca('0x20')]['bind'](this));ami['on'](_0xeaca('0x25'),this['syncCustomEvent'][_0xeaca('0x21')](this));ami['on'](_0xeaca('0x26'),this[_0xeaca('0x20')][_0xeaca('0x21')](this));ami['on'](_0xeaca('0x27'),this[_0xeaca('0x20')][_0xeaca('0x21')](this));ami['on'](_0xeaca('0x28'),this[_0xeaca('0x20')]['bind'](this));ami['on'](_0xeaca('0x29'),this[_0xeaca('0x20')][_0xeaca('0x21')](this));ami['on'](_0xeaca('0x2a'),this[_0xeaca('0x20')][_0xeaca('0x21')](this));ami['on'](_0xeaca('0x2b'),this['syncCustomEvent']['bind'](this));ami['on'](_0xeaca('0x2c'),this[_0xeaca('0x2d')][_0xeaca('0x21')](this));ami['on'](_0xeaca('0x2e'),this['syncAgentDial']['bind'](this));ami['on'](_0xeaca('0x2f'),this['syncAgentDial'][_0xeaca('0x21')](this));ami['on'](_0xeaca('0x30'),this[_0xeaca('0x20')][_0xeaca('0x21')](this));ami['on'](_0xeaca('0x31'),this[_0xeaca('0x20')][_0xeaca('0x21')](this));ami['on'](_0xeaca('0x32'),this[_0xeaca('0x20')][_0xeaca('0x21')](this));ami['on'](_0xeaca('0x33'),this[_0xeaca('0x20')][_0xeaca('0x21')](this));ami['on'](_0xeaca('0x34'),this[_0xeaca('0x20')][_0xeaca('0x21')](this));ami['on'](_0xeaca('0x35'),this[_0xeaca('0x20')]['bind'](this));}Trigger[_0xeaca('0x36')][_0xeaca('0x37')]=function(_0x1978eb,_0xcab847,_0x5182ac){logger[_0xeaca('0x38')](_0x1978eb,_0xcab847,JSON[_0xeaca('0x39')](_0x5182ac));io['to'](_0x1978eb)['emit'](_0xcab847,_0x5182ac);};Trigger[_0xeaca('0x36')][_0xeaca('0x20')]=function(_0x357360){var _0x5f2970=_[_0xeaca('0x3a')](_0x357360);this[_0xeaca('0x3b')](_0x5f2970);};Trigger['prototype'][_0xeaca('0x2d')]=function(_0x307247){if(this[_0xeaca('0x12')][_0x307247[_0xeaca('0x3c')]]){this['syncCustomEvent'](_0x307247);}};Trigger[_0xeaca('0x36')][_0xeaca('0x3b')]=function(_0x3d79f7){var _0x18328e;for(var _0x2b2335 in this[_0xeaca('0x11')]){if(this['triggers'][_0xeaca('0x3d')](_0x2b2335)){if(this[_0xeaca('0x11')][_0x2b2335][_0xeaca('0x3e')]){_0x18328e=this[_0xeaca('0x3f')](this['triggers'][_0x2b2335],_0x3d79f7);if(_0x18328e){_[_0xeaca('0x40')](_0x3d79f7,_0x3d79f7[_0xeaca('0x41')]);for(var _0x4440ae=0x0,_0x27bc65,_0x479a07,_0x20c5f6;_0x4440ae0x0){_0x5f275f=_['map'](_0x5bf7b6,_0x17aad9);}return _0x5f275f;}function getCustomFields(_0x49d4c4,_0x50426c){var _0x4cc721=[];var _0x5f3396={'custom_fields':{}};if(_0x49d4c4[_0xe0df('0x28')]>0x0){_[_0xe0df('0x29')](_0x49d4c4,function(_0x3dfb00){if(_[_0xe0df('0x2a')]([_0xe0df('0x2b'),_0xe0df('0x2c')],_0x3dfb00['type'])&&_0x3dfb00[_0xe0df('0x2d')]&&!_0x3dfb00[_0xe0df('0x2e')]){_0x5f3396[_0x3dfb00[_0xe0df('0x2d')]['toLowerCase']()]=_0x3dfb00[_0xe0df('0x2f')][_0xe0df('0x1f')]();}else if(_[_0xe0df('0x2a')]([_0xe0df('0x2b'),_0xe0df('0x2c')],_0x3dfb00[_0xe0df('0x30')])&&_0x3dfb00[_0xe0df('0x31')]&&_0x3dfb00[_0xe0df('0x2e')]){_0x5f3396[_0xe0df('0x32')][_0x3dfb00[_0xe0df('0x31')]]=_0x3dfb00['content'][_0xe0df('0x1f')]();}else if(_0x3dfb00[_0xe0df('0x30')]===_0xe0df('0x33')&&_0x3dfb00[_0xe0df('0x34')]&&_0x3dfb00[_0xe0df('0x31')]&&_0x3dfb00['customField']){_0x50426c[_0x3dfb00['variableName']]&&(_0x5f3396['custom_fields'][_0x3dfb00['idField']]=_0x50426c[_0x3dfb00[_0xe0df('0x34')]][_0xe0df('0x1f')]());}else if(_0x3dfb00['type']===_0xe0df('0x35')&&_0x3dfb00[_0xe0df('0x36')]&&_0x3dfb00[_0xe0df('0x36')][_0xe0df('0x37')]&&_0x3dfb00[_0xe0df('0x31')]&&_0x3dfb00[_0xe0df('0x2e')]){_0x50426c[_0x3dfb00[_0xe0df('0x36')][_0xe0df('0x37')][_0xe0df('0x38')]()]&&(_0x5f3396[_0xe0df('0x32')][_0x3dfb00[_0xe0df('0x31')]]=_0x50426c[_0x3dfb00[_0xe0df('0x36')][_0xe0df('0x37')]['toLowerCase']()][_0xe0df('0x1f')]());}});}if(_0x5f3396[_0xe0df('0x39')]){_0x5f3396[_0xe0df('0x39')]=Number(_0x5f3396['priority']);}return _0x5f3396;}function getTicket(_0x48c01f,_0x9ee970,_0x3642be,_0x5361b6,_0x29a8c0){logger[_0xe0df('0x21')](_0xe0df('0x3a'));var _0x321d5b=_[_0xe0df('0x3b')]({'subject':intUtil[_0xe0df('0x3c')](_0x5361b6[_0xe0df('0x3d')],_0x29a8c0,'\x20'),'type':_0xe0df('0x3e'),'status':_0xe0df('0x3f'),'labels':[_0xe0df('0x40'),'Motion',_0xe0df('0x41')][_0xe0df('0x42')](getTags(_0x5361b6[_0xe0df('0x43')],'name')),'description':intUtil[_0xe0df('0x3c')](_0x5361b6['Descriptions'],_0x29a8c0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xe0df('0x44'),_0x9ee970['id']),'class':_0xe0df('0x45')}},'message':{'direction':'in','body':intUtil[_0xe0df('0x3c')](_0x5361b6[_0xe0df('0x46')],_0x29a8c0,'\x0a')}},getCustomFields(_0x5361b6[_0xe0df('0x47')],_0x29a8c0));return request({'uri':util[_0xe0df('0xe')](_0xe0df('0x48'),_0x48c01f[_0xe0df('0x10')],_0x3642be['id']),'method':_0xe0df('0x26'),'body':_0x321d5b});}exports[_0xe0df('0x49')]=function(_0x38ee25,_0x16c966,_0x4c567c,_0x295395,_0x542d50,_0x4ff073){var _0x4a9a25,_0x1b401d;_0x4ff073[_0xe0df('0x10')]=intUtil[_0xe0df('0x4a')](_0x4ff073[_0xe0df('0x10')]);_0x4ff073[_0xe0df('0x4b')]=intUtil['stripTrailingSlash'](_0x4ff073[_0xe0df('0x4b')]);if(_0x542d50&&_0x542d50[_0xe0df('0x4c')]){logger[_0xe0df('0x21')](_0xe0df('0x4d'),_0xe0df('0x4e'));_0x16c966['recordingURL']=util[_0xe0df('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4ff073[_0xe0df('0x4b')],_0x16c966[_0xe0df('0x4f')],md5(_0x16c966['uniqueid']));}else{_0x16c966['recordingURL']='';}headers['Authorization']=getAuth(_0x4ff073);return getUser(_0x4ff073,_0x295395[_0xe0df('0x50')])['then'](function(_0x3507e3){_0x4a9a25=_0x3507e3;logger[_0xe0df('0x21')](_0xe0df('0x51'),_0x4a9a25['id']);return getEndUser(_0x4ff073,_0x16c966[_0xe0df('0x52')],_0x16c966[_0xe0df('0x53')]);})[_0xe0df('0x14')](function(_0x17c438){_0x1b401d=_0x17c438;logger[_0xe0df('0x21')](_0xe0df('0x54'),_0x1b401d['id']);return getTicket(_0x4ff073,_0x4a9a25,_0x1b401d,_0x4c567c,_0x16c966);})[_0xe0df('0x14')](function(_0x5f52bb){if(_0x5f52bb){logger[_0xe0df('0x21')](_0xe0df('0x55'));logger[_0xe0df('0x21')](_0xe0df('0x56'),_0x5f52bb['id']);switch(_0x4ff073['type']){case _0xe0df('0x57'):logger[_0xe0df('0x21')](_0xe0df('0x4d'),_0xe0df('0x58'));emit(util[_0xe0df('0xe')]('user:%s',_0x295395[_0xe0df('0x37')]),'trigger:desk:display',{'recordId':_0x5f52bb['id']});break;case _0xe0df('0x59'):logger['info'](_0xe0df('0x4d'),_0xe0df('0x5a'));emit(util[_0xe0df('0xe')](_0xe0df('0x5b'),_0x295395['name']),_0xe0df('0x5c'),{'uri':util[_0xe0df('0xe')](_0xe0df('0x5d'),_0x5f52bb['id'])});break;default:logger['error'](_0xe0df('0x4d'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xe0df('0x5e')](function(_0x1cd39f){console[_0xe0df('0x5f')](_0x1cd39f);logger[_0xe0df('0x5f')]('[QUEUE]',JSON['stringify'](_0x1cd39f));});};exports[_0xe0df('0x60')]=function(_0x1d46ad,_0x4e82d,_0x40ffb1,_0x4b3f83,_0xaf3380,_0x947a74,_0x265b48){var _0x1b2503,_0x21ab1a;_0x947a74[_0xe0df('0x10')]=intUtil[_0xe0df('0x4a')](_0x947a74['remoteUri']);_0x947a74['serverUrl']=intUtil[_0xe0df('0x4a')](_0x947a74['serverUrl']);if(_0x265b48&&_0x265b48[_0xe0df('0x61')]&&_0x265b48[_0xe0df('0x61')]!=='none'){logger[_0xe0df('0x21')](_0xe0df('0x62'),'Recording\x20is\x20enabled!');_0x4e82d['recordingURL']=util[_0xe0df('0xe')](_0xe0df('0x63'),_0x947a74['serverUrl'],_0x4e82d[_0xe0df('0x4f')],md5(_0x4e82d[_0xe0df('0x4f')]));}headers[_0xe0df('0x64')]=getAuth(_0x947a74);return getUser(_0x947a74,_0x4b3f83[_0xe0df('0x50')])[_0xe0df('0x14')](function(_0x1ae9a7){_0x1b2503=_0x1ae9a7;logger[_0xe0df('0x21')](_0xe0df('0x51'),_0x1b2503['id']);return getEndUser(_0x947a74,_0x4e82d['destcalleridname'],_0x4e82d[_0xe0df('0x65')]);})[_0xe0df('0x14')](function(_0x352a96){_0x21ab1a=_0x352a96;logger[_0xe0df('0x21')]('The\x20Enduser\x20ID\x20is:',_0x21ab1a['id']);return getTicket(_0x947a74,_0x1b2503,_0x21ab1a,_0x40ffb1,_0x4e82d);})[_0xe0df('0x14')](function(_0x491518){if(_0x491518){logger[_0xe0df('0x21')](_0xe0df('0x55'));logger[_0xe0df('0x21')](_0xe0df('0x56'),_0x491518['id']);switch(_0x947a74['type']){case _0xe0df('0x57'):logger[_0xe0df('0x21')](_0xe0df('0x4d'),_0xe0df('0x58'));emit(util[_0xe0df('0xe')](_0xe0df('0x5b'),_0x4b3f83[_0xe0df('0x37')]),_0xe0df('0x66'),{'recordId':_0x491518['id']});break;case _0xe0df('0x59'):logger[_0xe0df('0x21')](_0xe0df('0x4d'),_0xe0df('0x5a'));emit(util['format']('user:%s',_0x4b3f83['name']),_0xe0df('0x5c'),{'uri':util[_0xe0df('0xe')](_0xe0df('0x67'),_0x947a74[_0xe0df('0x10')],_0x491518['id'])});break;default:logger[_0xe0df('0x5f')](_0xe0df('0x62'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xe0df('0x5e')](function(_0x4279f1){logger[_0xe0df('0x5f')](_0xe0df('0x62'),JSON['stringify'](_0x4279f1));});};exports[_0xe0df('0x68')]=function(_0x42979c,_0x51b8d3,_0x54da38,_0x344543,_0x30bead,_0xa006be){var _0x117075,_0x53ad3c;_0xa006be[_0xe0df('0x10')]=intUtil[_0xe0df('0x4a')](_0xa006be[_0xe0df('0x10')]);_0xa006be[_0xe0df('0x4b')]=intUtil[_0xe0df('0x4a')](_0xa006be[_0xe0df('0x4b')]);if(_0x30bead&&_0x30bead[_0xe0df('0x4c')]){logger[_0xe0df('0x21')]('['+_0x51b8d3[_0xe0df('0x69')][_0xe0df('0x6a')]()+']',_0xe0df('0x4e'));_0x51b8d3['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa006be[_0xe0df('0x4b')],_0x51b8d3['uniqueid'],md5(_0x51b8d3['uniqueid']));}else{_0x51b8d3[_0xe0df('0x6b')]='';}headers['Authorization']=getAuth(_0xa006be);return getUser(_0xa006be)['then'](function(_0x25d227){_0x117075=_0x25d227;logger[_0xe0df('0x21')](_0xe0df('0x51'),_0x117075['id']);return getEndUser(_0xa006be,_0x51b8d3[_0xe0df('0x52')],_0x51b8d3[_0xe0df('0x53')]);})['then'](function(_0x3c2cad){_0x53ad3c=_0x3c2cad;logger[_0xe0df('0x21')](_0xe0df('0x54'),_0x53ad3c['id']);return getTicket(_0xa006be,_0x117075,_0x53ad3c,_0x54da38,_0x51b8d3);})[_0xe0df('0x14')](function(_0x352979){if(_0x352979){logger[_0xe0df('0x21')](_0xe0df('0x55'));logger[_0xe0df('0x21')](_0xe0df('0x56'),_0x352979['id']);}})['catch'](function(_0x4c7089){logger[_0xe0df('0x5f')]('['+_0x51b8d3[_0xe0df('0x69')][_0xe0df('0x6a')]()+']',JSON[_0xe0df('0x6c')](_0x4c7089));});}; \ No newline at end of file +var _0x1dcb=['Authorization','destcalleridname','destcalleridnum','trigger:browser:url','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','GET','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','map','forEach','picklist','type','nameField','customField','toLowerCase','content','includes','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Tags','/api/v2/users/%d','user','Descriptions','%s/customers/%d/cases','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','Desk\x20account\x20type\x20not\x20recognized','catch','stringify','outbound','recordingFormat','[OUTBOUND]'];(function(_0x3c4e4c,_0x36ff70){var _0x144a87=function(_0x5efb4b){while(--_0x5efb4b){_0x3c4e4c['push'](_0x3c4e4c['shift']());}};_0x144a87(++_0x36ff70);}(_0x1dcb,0xe1));var _0xb1dc=function(_0x2e4807,_0x1713cc){_0x2e4807=_0x2e4807-0x0;var _0x29f874=_0x1dcb[_0x2e4807];return _0x29f874;};'use strict';var _=require(_0xb1dc('0x0'));var rp=require(_0xb1dc('0x1'));var md5=require(_0xb1dc('0x2'));var util=require('util');var Redis=require(_0xb1dc('0x3'));var intUtil=require('./util');var config=require(_0xb1dc('0x4'));var logger=require(_0xb1dc('0x5'))(_0xb1dc('0x6'));config[_0xb1dc('0x7')]=_[_0xb1dc('0x8')](config[_0xb1dc('0x7')],{'host':_0xb1dc('0x9'),'port':0x18eb});var io=require(_0xb1dc('0xa'))(new Redis(config[_0xb1dc('0x7')]));function emit(_0x475efd,_0xc2646b,_0x2c5427){io['to'](_0x475efd)[_0xb1dc('0xb')](_0xc2646b,_0x2c5427);}var headers={'Content-Type':_0xb1dc('0xc'),'Accept':_0xb1dc('0xc')};function getUser(_0x4886e2,_0x13e591){if(intUtil[_0xb1dc('0xd')](_0x13e591)===!![]){logger[_0xb1dc('0xe')](_0xb1dc('0xf'),_0x13e591);return request({'uri':util[_0xb1dc('0x10')]('%s/users',_0x4886e2[_0xb1dc('0x11')])})[_0xb1dc('0x12')](function(_0x2cc993){if(_0x2cc993[_0xb1dc('0x13')]){return _[_0xb1dc('0x14')](_0x2cc993[_0xb1dc('0x15')]['entries'],{'email':_0x13e591});}})[_0xb1dc('0x12')](function(_0x4d620f){if(_0x4d620f){logger[_0xb1dc('0xe')](_0xb1dc('0x16'));return _0x4d620f;}else{logger[_0xb1dc('0xe')](_0xb1dc('0x17'));return request({'uri':util[_0xb1dc('0x10')](_0xb1dc('0x18'),_0x4886e2[_0xb1dc('0x11')])});}});}else{logger[_0xb1dc('0xe')](_0xb1dc('0x19'));return request({'uri':util[_0xb1dc('0x10')](_0xb1dc('0x18'),_0x4886e2['remoteUri'])});}}function request(_0x371859){logger[_0xb1dc('0x1a')]('[HTTP]',JSON['stringify'](_0x371859));return rp(_[_0xb1dc('0x8')](_0x371859,{'method':_0xb1dc('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5dd5b2){var _0x55a7cb;if(_0x5dd5b2[_0xb1dc('0x1c')]==='basic'){_0x55a7cb=util[_0xb1dc('0x10')](_0xb1dc('0x1d'),_0x5dd5b2[_0xb1dc('0x1e')],_0x5dd5b2[_0xb1dc('0x1f')]);}else if(_0x5dd5b2[_0xb1dc('0x1c')]===_0xb1dc('0x20')){_0x55a7cb=util['format'](_0xb1dc('0x21'),_0x5dd5b2[_0xb1dc('0x1e')],_0x5dd5b2[_0xb1dc('0x20')]);}return util[_0xb1dc('0x10')](_0xb1dc('0x22'),new Buffer(_0x55a7cb)[_0xb1dc('0x23')](_0xb1dc('0x24')));}function getEndUser(_0x496335,_0x567520,_0x456028){logger[_0xb1dc('0xe')]('Searching\x20enduser\x20with\x20phone',_0x456028);return request({'uri':util[_0xb1dc('0x10')](_0xb1dc('0x25'),_0x496335[_0xb1dc('0x11')]),'qs':{'phone':_0x456028}})[_0xb1dc('0x12')](function(_0x4162ec){if(_0x4162ec[_0xb1dc('0x13')]){logger[_0xb1dc('0xe')](_0xb1dc('0x26'));return _0x4162ec[_0xb1dc('0x15')]['entries'][0x0];}else{logger[_0xb1dc('0xe')](_0xb1dc('0x27'));return request({'uri':util[_0xb1dc('0x10')]('%s/customers',_0x496335[_0xb1dc('0x11')]),'method':_0xb1dc('0x28'),'body':{'first_name':_0x567520,'title':_0x567520,'phone_numbers':[{'type':'work','value':_0x456028}]}});}});}function getTags(_0x4bdefc,_0x54bdb3){var _0x5b8fc7=[];if(_0x4bdefc&&_0x4bdefc[_0xb1dc('0x29')]>0x0){_0x5b8fc7=_[_0xb1dc('0x2a')](_0x4bdefc,_0x54bdb3);}return _0x5b8fc7;}function getCustomFields(_0x3b7b9c,_0x28b6f7){var _0x5ecadb=[];var _0x1e9b1={'custom_fields':{}};if(_0x3b7b9c[_0xb1dc('0x29')]>0x0){_[_0xb1dc('0x2b')](_0x3b7b9c,function(_0x820c2c){if(_['includes'](['string',_0xb1dc('0x2c')],_0x820c2c[_0xb1dc('0x2d')])&&_0x820c2c[_0xb1dc('0x2e')]&&!_0x820c2c[_0xb1dc('0x2f')]){_0x1e9b1[_0x820c2c[_0xb1dc('0x2e')][_0xb1dc('0x30')]()]=_0x820c2c[_0xb1dc('0x31')]['toString']();}else if(_[_0xb1dc('0x32')]([_0xb1dc('0x33'),_0xb1dc('0x2c')],_0x820c2c[_0xb1dc('0x2d')])&&_0x820c2c[_0xb1dc('0x34')]&&_0x820c2c[_0xb1dc('0x2f')]){_0x1e9b1[_0xb1dc('0x35')][_0x820c2c[_0xb1dc('0x34')]]=_0x820c2c[_0xb1dc('0x31')]['toString']();}else if(_0x820c2c[_0xb1dc('0x2d')]===_0xb1dc('0x36')&&_0x820c2c['variableName']&&_0x820c2c[_0xb1dc('0x34')]&&_0x820c2c[_0xb1dc('0x2f')]){_0x28b6f7[_0x820c2c[_0xb1dc('0x37')]]&&(_0x1e9b1[_0xb1dc('0x35')][_0x820c2c['idField']]=_0x28b6f7[_0x820c2c['variableName']][_0xb1dc('0x23')]());}else if(_0x820c2c[_0xb1dc('0x2d')]===_0xb1dc('0x38')&&_0x820c2c['Variable']&&_0x820c2c[_0xb1dc('0x39')][_0xb1dc('0x3a')]&&_0x820c2c[_0xb1dc('0x34')]&&_0x820c2c[_0xb1dc('0x2f')]){_0x28b6f7[_0x820c2c[_0xb1dc('0x39')][_0xb1dc('0x3a')][_0xb1dc('0x30')]()]&&(_0x1e9b1[_0xb1dc('0x35')][_0x820c2c[_0xb1dc('0x34')]]=_0x28b6f7[_0x820c2c[_0xb1dc('0x39')][_0xb1dc('0x3a')][_0xb1dc('0x30')]()][_0xb1dc('0x23')]());}});}if(_0x1e9b1[_0xb1dc('0x3b')]){_0x1e9b1[_0xb1dc('0x3b')]=Number(_0x1e9b1[_0xb1dc('0x3b')]);}return _0x1e9b1;}function getTicket(_0x13f902,_0x4cad35,_0x4dd202,_0x3c263a,_0x49774a){logger['info'](_0xb1dc('0x3c'));var _0x46392c=_['merge']({'subject':intUtil[_0xb1dc('0x3d')](_0x3c263a['Subjects'],_0x49774a,'\x20'),'type':_0xb1dc('0x3e'),'status':_0xb1dc('0x3f'),'labels':[_0xb1dc('0x40'),_0xb1dc('0x41'),_0xb1dc('0x42')][_0xb1dc('0x43')](getTags(_0x3c263a[_0xb1dc('0x44')],_0xb1dc('0x3a'))),'description':intUtil[_0xb1dc('0x3d')](_0x3c263a['Descriptions'],_0x49774a,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xb1dc('0x45'),_0x4cad35['id']),'class':_0xb1dc('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0x3c263a[_0xb1dc('0x47')],_0x49774a,'\x0a')}},getCustomFields(_0x3c263a['Fields'],_0x49774a));return request({'uri':util[_0xb1dc('0x10')](_0xb1dc('0x48'),_0x13f902['remoteUri'],_0x4dd202['id']),'method':_0xb1dc('0x28'),'body':_0x46392c});}exports['queue']=function(_0x2801b8,_0x459f4f,_0x45c90d,_0x2ba067,_0x3d28db,_0x452e18){var _0x313a84,_0x557dee;_0x452e18[_0xb1dc('0x11')]=intUtil[_0xb1dc('0x49')](_0x452e18[_0xb1dc('0x11')]);_0x452e18[_0xb1dc('0x4a')]=intUtil['stripTrailingSlash'](_0x452e18['serverUrl']);if(_0x3d28db&&_0x3d28db[_0xb1dc('0x4b')]){logger[_0xb1dc('0xe')](_0xb1dc('0x4c'),_0xb1dc('0x4d'));_0x459f4f[_0xb1dc('0x4e')]=util[_0xb1dc('0x10')](_0xb1dc('0x4f'),_0x452e18['serverUrl'],_0x459f4f['uniqueid'],md5(_0x459f4f[_0xb1dc('0x50')]));}else{_0x459f4f['recordingURL']='';}headers['Authorization']=getAuth(_0x452e18);return getUser(_0x452e18,_0x2ba067[_0xb1dc('0x51')])[_0xb1dc('0x12')](function(_0x385eaa){_0x313a84=_0x385eaa;logger[_0xb1dc('0xe')]('The\x20User\x20ID\x20is:',_0x313a84['id']);return getEndUser(_0x452e18,_0x459f4f['calleridname'],_0x459f4f[_0xb1dc('0x52')]);})['then'](function(_0xf1c5f7){_0x557dee=_0xf1c5f7;logger[_0xb1dc('0xe')](_0xb1dc('0x53'),_0x557dee['id']);return getTicket(_0x452e18,_0x313a84,_0x557dee,_0x45c90d,_0x459f4f);})[_0xb1dc('0x12')](function(_0x30d56f){if(_0x30d56f){logger[_0xb1dc('0xe')](_0xb1dc('0x54'));logger[_0xb1dc('0xe')](_0xb1dc('0x55'),_0x30d56f['id']);switch(_0x452e18[_0xb1dc('0x2d')]){case _0xb1dc('0x56'):logger[_0xb1dc('0xe')](_0xb1dc('0x4c'),_0xb1dc('0x57'));emit(util[_0xb1dc('0x10')]('user:%s',_0x2ba067[_0xb1dc('0x3a')]),_0xb1dc('0x58'),{'recordId':_0x30d56f['id']});break;case _0xb1dc('0x59'):logger[_0xb1dc('0xe')](_0xb1dc('0x4c'),_0xb1dc('0x5a'));emit(util[_0xb1dc('0x10')](_0xb1dc('0x5b'),_0x2ba067[_0xb1dc('0x3a')]),'trigger:browser:url',{'uri':util[_0xb1dc('0x10')]('https://xcally.desk.com/web/agent/case/%d',_0x30d56f['id'])});break;default:logger[_0xb1dc('0x5c')](_0xb1dc('0x4c'),_0xb1dc('0x5d'));}}})[_0xb1dc('0x5e')](function(_0x1b32c6){console[_0xb1dc('0x5c')](_0x1b32c6);logger['error'](_0xb1dc('0x4c'),JSON[_0xb1dc('0x5f')](_0x1b32c6));});};exports[_0xb1dc('0x60')]=function(_0x4d6b91,_0x39cba2,_0x44c06f,_0x2c876b,_0x5085c4,_0x455d12,_0x3404aa){var _0x2be5d4,_0x1fa127;_0x455d12[_0xb1dc('0x11')]=intUtil[_0xb1dc('0x49')](_0x455d12[_0xb1dc('0x11')]);_0x455d12[_0xb1dc('0x4a')]=intUtil[_0xb1dc('0x49')](_0x455d12[_0xb1dc('0x4a')]);if(_0x3404aa&&_0x3404aa[_0xb1dc('0x61')]&&_0x3404aa[_0xb1dc('0x61')]!=='none'){logger['info'](_0xb1dc('0x62'),_0xb1dc('0x4d'));_0x39cba2['recordingURL']=util[_0xb1dc('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x455d12[_0xb1dc('0x4a')],_0x39cba2[_0xb1dc('0x50')],md5(_0x39cba2['uniqueid']));}headers[_0xb1dc('0x63')]=getAuth(_0x455d12);return getUser(_0x455d12,_0x2c876b[_0xb1dc('0x51')])['then'](function(_0x39813b){_0x2be5d4=_0x39813b;logger[_0xb1dc('0xe')]('The\x20User\x20ID\x20is:',_0x2be5d4['id']);return getEndUser(_0x455d12,_0x39cba2[_0xb1dc('0x64')],_0x39cba2[_0xb1dc('0x65')]);})['then'](function(_0x2ef21d){_0x1fa127=_0x2ef21d;logger[_0xb1dc('0xe')](_0xb1dc('0x53'),_0x1fa127['id']);return getTicket(_0x455d12,_0x2be5d4,_0x1fa127,_0x44c06f,_0x39cba2);})['then'](function(_0x803524){if(_0x803524){logger[_0xb1dc('0xe')](_0xb1dc('0x54'));logger[_0xb1dc('0xe')](_0xb1dc('0x55'),_0x803524['id']);switch(_0x455d12[_0xb1dc('0x2d')]){case _0xb1dc('0x56'):logger[_0xb1dc('0xe')](_0xb1dc('0x4c'),_0xb1dc('0x57'));emit(util[_0xb1dc('0x10')]('user:%s',_0x2c876b[_0xb1dc('0x3a')]),'trigger:desk:display',{'recordId':_0x803524['id']});break;case _0xb1dc('0x59'):logger[_0xb1dc('0xe')](_0xb1dc('0x4c'),_0xb1dc('0x5a'));emit(util[_0xb1dc('0x10')](_0xb1dc('0x5b'),_0x2c876b['name']),_0xb1dc('0x66'),{'uri':util[_0xb1dc('0x10')](_0xb1dc('0x67'),_0x455d12[_0xb1dc('0x11')],_0x803524['id'])});break;default:logger[_0xb1dc('0x5c')](_0xb1dc('0x62'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb1dc('0x5e')](function(_0x3e8846){logger[_0xb1dc('0x5c')]('[OUTBOUND]',JSON[_0xb1dc('0x5f')](_0x3e8846));});};exports[_0xb1dc('0x68')]=function(_0x2bb8f0,_0x498b10,_0x507cd8,_0x1a2fb8,_0x4c7f08,_0x48dcf3){var _0x3436b9,_0x4bd237;_0x48dcf3['remoteUri']=intUtil[_0xb1dc('0x49')](_0x48dcf3['remoteUri']);_0x48dcf3['serverUrl']=intUtil['stripTrailingSlash'](_0x48dcf3['serverUrl']);if(_0x4c7f08&&_0x4c7f08[_0xb1dc('0x4b')]){logger[_0xb1dc('0xe')]('['+_0x498b10[_0xb1dc('0x69')][_0xb1dc('0x6a')]()+']',_0xb1dc('0x4d'));_0x498b10[_0xb1dc('0x4e')]=util[_0xb1dc('0x10')](_0xb1dc('0x4f'),_0x48dcf3['serverUrl'],_0x498b10[_0xb1dc('0x50')],md5(_0x498b10[_0xb1dc('0x50')]));}else{_0x498b10[_0xb1dc('0x4e')]='';}headers[_0xb1dc('0x63')]=getAuth(_0x48dcf3);return getUser(_0x48dcf3)[_0xb1dc('0x12')](function(_0x4192d4){_0x3436b9=_0x4192d4;logger['info']('The\x20User\x20ID\x20is:',_0x3436b9['id']);return getEndUser(_0x48dcf3,_0x498b10[_0xb1dc('0x6b')],_0x498b10[_0xb1dc('0x52')]);})[_0xb1dc('0x12')](function(_0x82e17a){_0x4bd237=_0x82e17a;logger['info'](_0xb1dc('0x53'),_0x4bd237['id']);return getTicket(_0x48dcf3,_0x3436b9,_0x4bd237,_0x507cd8,_0x498b10);})[_0xb1dc('0x12')](function(_0x30ffb4){if(_0x30ffb4){logger[_0xb1dc('0xe')](_0xb1dc('0x54'));logger[_0xb1dc('0xe')](_0xb1dc('0x55'),_0x30ffb4['id']);}})[_0xb1dc('0x5e')](function(_0x13591f){logger['error']('['+_0x498b10[_0xb1dc('0x69')][_0xb1dc('0x6a')]()+']',JSON[_0xb1dc('0x5f')](_0x13591f));});}; \ 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 59c0194..0c21c54 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 _0xef17=['callDirection','unmanaged','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','access_token','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','validateEmail','userEmail','email','info',']\x20Agent\x20found\x20','systemuserid','userId','length','internalemailaddress','catch','then','toLowerCase','outbound','calleridnum','contacts','Bearer\x20','4.0','headers','substring','contacts?$select=telephone1','destcalleridnum','telephone1','enduserId','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','phonecalls','Subjects','/systemusers(','queue','Fields','lastIndexOf','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xef17,0x136));var _0x7ef1=function(_0x340bf3,_0x3252d2){_0x340bf3=_0x340bf3-0x0;var _0xeda2bc=_0xef17[_0x340bf3];return _0xeda2bc;};'use strict';var _=require(_0x7ef1('0x0'));var BPromise=require(_0x7ef1('0x1'));var rp=require(_0x7ef1('0x2'));var util=require(_0x7ef1('0x3'));var intUtil=require(_0x7ef1('0x4'));var md5=require(_0x7ef1('0x5'));var Redis=require(_0x7ef1('0x6'));var logger=require(_0x7ef1('0x7'))(_0x7ef1('0x8'));var config=require('../../../../config/environment');config[_0x7ef1('0x9')]=_['defaults'](config[_0x7ef1('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x7ef1('0xa'))(new Redis(config['redis']));function getAuthToken(_0x5aec63,_0x10c896,_0x3398a6){var _0x56ab07={'method':_0x7ef1('0xb'),'uri':_0x10c896,'form':{'client_id':_0x5aec63[_0x7ef1('0xc')],'resource':_0x5aec63[_0x7ef1('0xd')],'username':_0x5aec63[_0x7ef1('0xe')],'password':_0x5aec63[_0x7ef1('0xf')],'grant_type':_0x7ef1('0xf'),'client_secret':_0x5aec63[_0x7ef1('0x10')]},'json':!![]};return rp(_0x56ab07)['then'](function(_0x4da8e8){return _0x4da8e8[_0x7ef1('0x11')];})['catch'](function(_0x5ab4a4){logger['error']('['+[_0x3398a6[_0x7ef1('0x12')]()]+']\x20Wrong\x20credentials!');return _0x5ab4a4[_0x7ef1('0x13')];});}function getUser(_0x29c920,_0x32eed0,_0x598680,_0x39ea9c,_0x317125,_0x26e9fb){return new BPromise(function(_0x44d304,_0x57296a){return getAuthToken(_0x32eed0,_0x39ea9c,_0x26e9fb)['then'](function(_0x267f0e){var _0x5d0499={'method':_0x7ef1('0x14'),'uri':_0x317125+_0x7ef1('0x15'),'headers':{'Authorization':'Bearer\x20'+_0x267f0e,'OData-Version':'4.0'},'json':!![]};return rp(_0x5d0499);})['then'](function(_0x300645){var _0x4da0fa=_0x300645[_0x7ef1('0x16')];var _0x5c6333=![];var _0x5a7b2b=null;if(!_['isNil'](_0x598680)){if(intUtil[_0x7ef1('0x17')](_0x598680['email'])){_0x29c920[_0x7ef1('0x18')]=_0x598680[_0x7ef1('0x19')];for(_0x5a7b2b=0x0;_0x5a7b2b<_0x4da0fa['length'];_0x5a7b2b++){if(_0x4da0fa[_0x5a7b2b]['internalemailaddress']===_0x598680[_0x7ef1('0x19')]&&!_0x4da0fa[_0x5a7b2b]['isdisabled']){_0x5c6333=!![];logger[_0x7ef1('0x1a')]('['+[_0x26e9fb[_0x7ef1('0x12')]()]+_0x7ef1('0x1b')+_0x4da0fa[_0x5a7b2b][_0x7ef1('0x1c')]+'!');_0x29c920[_0x7ef1('0x1d')]=_0x4da0fa[_0x5a7b2b][_0x7ef1('0x1c')];}}}}if(!_0x5c6333){logger[_0x7ef1('0x1a')]('['+[_0x26e9fb[_0x7ef1('0x12')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x29c920[_0x7ef1('0x18')]=_0x32eed0[_0x7ef1('0xe')];for(_0x5a7b2b=0x0;_0x5a7b2b<_0x4da0fa[_0x7ef1('0x1e')];_0x5a7b2b++){if(_0x4da0fa[_0x5a7b2b][_0x7ef1('0x1f')]===_0x32eed0[_0x7ef1('0xe')]){_0x29c920[_0x7ef1('0x1d')]=_0x4da0fa[_0x5a7b2b][_0x7ef1('0x1c')];}}}_0x44d304(_0x29c920);})[_0x7ef1('0x20')](function(_0x508a5f){_0x57296a(_0x508a5f['message']);});});}function createEndUser(_0x33e008,_0x12ef5a,_0x132f2e,_0xcfce5e,_0x19c2c2,_0x4cfa16){return new BPromise(function(_0x2e62a4,_0x9eca93){return getAuthToken(_0x12ef5a,_0x132f2e,_0x4cfa16)[_0x7ef1('0x21')](function(_0x4af5f5){var _0x232f4e=_0x4cfa16[_0x7ef1('0x22')]()===_0x7ef1('0x23')?_0x19c2c2['destcalleridnum']:_0x19c2c2[_0x7ef1('0x24')];var _0x4b0380={'method':_0x7ef1('0xb'),'uri':_0xcfce5e+_0x7ef1('0x25'),'body':{'telephone1':_0x232f4e,'fullname':_0x232f4e,'firstname':_0x232f4e,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x33e008['userId']+')'},'headers':{'Authorization':_0x7ef1('0x26')+_0x4af5f5,'OData-Version':_0x7ef1('0x27')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x4b0380);})['then'](function(_0xbf918d){var _0x56fe40=_0xbf918d[_0x7ef1('0x28')]['odata-entityid'];var _0x122999=_0x56fe40[_0x7ef1('0x29')](_0x56fe40['lastIndexOf']('(')+0x1,_0x56fe40['lastIndexOf'](')'));_0x33e008['enduserId']=_0x122999;_0x2e62a4(_0x33e008);})['catch'](function(_0x1b72a1){_0x9eca93(_0x1b72a1[_0x7ef1('0x13')]);});});}function getEndUser(_0x596abe,_0x1110f5,_0x4dbb22,_0x49fe6a,_0x2831cb,_0x5c23ce){return new BPromise(function(_0xa0d198,_0x12ad4c){return getAuthToken(_0x1110f5,_0x4dbb22,_0x5c23ce)[_0x7ef1('0x21')](function(_0x1bfa7b){var _0x47e0e1={'method':_0x7ef1('0x14'),'uri':_0x49fe6a+_0x7ef1('0x2a'),'headers':{'Authorization':'Bearer\x20'+_0x1bfa7b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x47e0e1);})['then'](function(_0x507053){var _0x389f9e=null;if(_0x507053){var _0x59f7ed=_0x507053[_0x7ef1('0x16')];var _0x1c473f=![];for(_0x389f9e=0x0;_0x389f9e<_0x59f7ed[_0x7ef1('0x1e')];_0x389f9e++){var _0x2846cc=_0x5c23ce[_0x7ef1('0x22')]()===_0x7ef1('0x23')?_0x2831cb[_0x7ef1('0x2b')]:_0x2831cb[_0x7ef1('0x24')];if(_0x59f7ed[_0x389f9e][_0x7ef1('0x2c')]===_0x2846cc){_0x1c473f=!![];_0x596abe[_0x7ef1('0x2d')]=_0x59f7ed[_0x389f9e][_0x7ef1('0x2e')];}}if(_0x1c473f){_0xa0d198(_0x596abe);}else{return createEndUser(_0x596abe,_0x1110f5,_0x4dbb22,_0x49fe6a,_0x2831cb,_0x5c23ce)['then'](function(_0x3a45df){logger[_0x7ef1('0x1a')]('['+[_0x5c23ce['toUpperCase']()]+_0x7ef1('0x2f'),_0x3a45df[_0x7ef1('0x2d')]);_0xa0d198(_0x3a45df);});}}else{return createEndUser(_0x596abe,_0x1110f5,_0x4dbb22,_0x49fe6a,_0x2831cb,_0x5c23ce)[_0x7ef1('0x21')](function(_0x273bf1){logger[_0x7ef1('0x1a')]('['+[_0x5c23ce['toUpperCase']()]+_0x7ef1('0x30'),_0x273bf1[_0x7ef1('0x2d')]);_0xa0d198(_0x273bf1);});}});});}function getCustomFields(_0x3b98ea,_0x1ef635,_0x3a317e){var _0x3c231a={};if(_0x3b98ea[_0x7ef1('0x1e')]>0x0){_[_0x7ef1('0x31')](_0x3b98ea,function(_0x1433df){if(_[_0x7ef1('0x32')]([_0x7ef1('0x33'),_0x7ef1('0x34')],_0x1433df[_0x7ef1('0x35')])&&_0x1433df[_0x7ef1('0x36')]&&!_0x1433df[_0x7ef1('0x37')]){var _0x565d83=_0x1433df[_0x7ef1('0x38')][_0x7ef1('0x22')]();var _0x302212=_0x565d83[_0x7ef1('0x29')](0x0,_0x565d83[_0x7ef1('0x39')]('_'));var _0x1328e2=_0x565d83[_0x7ef1('0x29')](_0x565d83[_0x7ef1('0x39')]('_')+0x1);if(_0x302212===_0x3a317e){_0x3c231a[_0x1328e2]=_0x1433df[_0x7ef1('0x3a')];}}});}return _0x3c231a;}function getTicket(_0x1cff0b,_0x3e5ecd,_0x374bf5,_0x2fb6c4,_0x56036d,_0x1b21a8,_0x2645d6){return new BPromise(function(_0x10bcac,_0x3c80ad){var _0x380ec3;return getAuthToken(_0x3e5ecd,_0x374bf5,_0x2645d6)[_0x7ef1('0x21')](function(_0x590751){if(_0x1b21a8[_0x7ef1('0x3b')]===_0x7ef1('0x3c')){_0x380ec3={'method':_0x7ef1('0xb'),'uri':_0x2fb6c4+_0x7ef1('0x3d'),'body':Object[_0x7ef1('0x3e')]({},{'title':intUtil[_0x7ef1('0x3f')](_0x1b21a8['Subjects'],_0x56036d,'\x20'),'description':intUtil[_0x7ef1('0x3f')](_0x1b21a8[_0x7ef1('0x40')],_0x56036d,'\x0a'),'customerid_contact@odata.bind':_0x7ef1('0x41')+_0x1cff0b[_0x7ef1('0x2d')]+')','ownerid@odata.bind':'/systemusers('+_0x1cff0b[_0x7ef1('0x1d')]+')','caseorigincode':'1'},getCustomFields(_0x1b21a8['Fields'],_0x56036d,_0x1b21a8['ticketType'])),'headers':{'Authorization':_0x7ef1('0x26')+_0x590751,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1b21a8[_0x7ef1('0x3b')]==='phonecall'){_0x380ec3={'method':_0x7ef1('0xb'),'uri':_0x2fb6c4+_0x7ef1('0x42'),'body':Object[_0x7ef1('0x3e')]({},{'subject':intUtil[_0x7ef1('0x3f')](_0x1b21a8[_0x7ef1('0x43')],_0x56036d,'\x20'),'phonenumber':String(_0x56036d[_0x7ef1('0x24')]),'description':intUtil[_0x7ef1('0x3f')](_0x1b21a8[_0x7ef1('0x40')],_0x56036d,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x1cff0b['enduserId']+')','ownerid@odata.bind':_0x7ef1('0x44')+_0x1cff0b[_0x7ef1('0x1d')]+')','directioncode':_0x1cff0b['callDirection']===_0x7ef1('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x7ef1('0x44')+_0x1cff0b[_0x7ef1('0x1d')]+')','participationtypemask':_0x1cff0b['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x7ef1('0x41')+_0x1cff0b['enduserId']+')','participationtypemask':_0x1cff0b['callDirection']===_0x7ef1('0x45')?0x1:0x2}]},getCustomFields(_0x1b21a8[_0x7ef1('0x46')],_0x56036d,_0x1b21a8[_0x7ef1('0x3b')])),'headers':{'Authorization':_0x7ef1('0x26')+_0x590751,'OData-Version':_0x7ef1('0x27')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x380ec3);})['then'](function(_0xd4a407){var _0x4e425b=_0xd4a407[_0x7ef1('0x28')]['odata-entityid'];var _0x28a1c6=_0x4e425b['substring'](_0x4e425b['lastIndexOf']('(')+0x1,_0x4e425b[_0x7ef1('0x47')](')'));_0x1cff0b['ticketId']=_0x28a1c6;_0x10bcac(_0x1cff0b);})[_0x7ef1('0x20')](function(_0x30a4ce){_0x3c80ad(_0x30a4ce['message']);});});}function emit(_0xf2e252,_0x738ab6,_0x2d996f,_0x50b4b9){var _0x23e6ed={'uri':util[_0x7ef1('0x48')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0xf2e252,_0x2d996f,_0x50b4b9)};io['to'](util[_0x7ef1('0x48')](_0x7ef1('0x49'),_0x738ab6))[_0x7ef1('0x4a')](_0x7ef1('0x4b'),_0x23e6ed);}exports['cs']=function(_0x2f17a7,_0x2e7f5e,_0x3439c9,_0x558487,_0x5311b1,_0x2c23ba,_0x3bd022,_0x25bcc6){var _0xa38413={};_0x2c23ba[_0x7ef1('0xd')]=intUtil[_0x7ef1('0x4c')](_0x2c23ba[_0x7ef1('0xd')]);_0x2c23ba[_0x7ef1('0x4d')]=intUtil[_0x7ef1('0x4c')](_0x2c23ba[_0x7ef1('0x4d')]);_0xa38413[_0x7ef1('0x4e')]=_0x25bcc6==='queue'||_0x25bcc6===_0x7ef1('0x4f')?_0x7ef1('0x45'):_0x7ef1('0x23');var _0x21f564=util[_0x7ef1('0x48')]('%s/api/data/v9.0/',_0x2c23ba[_0x7ef1('0xd')]);var _0x32ef05=util[_0x7ef1('0x48')]('https://login.microsoftonline.com/%s/oauth2/token',_0x2c23ba[_0x7ef1('0x50')]);var _0x3e054e=util['format'](_0x7ef1('0x51'),_0x2c23ba[_0x7ef1('0x4d')],_0x2e7f5e[_0x7ef1('0x52')],md5(_0x2e7f5e[_0x7ef1('0x52')]));if(_0x5311b1&&_0x5311b1[_0x7ef1('0x53')]){logger[_0x7ef1('0x1a')](_0x7ef1('0x54'),_0x7ef1('0x55'));_0x2e7f5e[_0x7ef1('0x56')]=_0x3e054e;}else if(_0x3bd022&&_0x3bd022[_0x7ef1('0x57')]&&_0x3bd022[_0x7ef1('0x57')]!=='none'){logger[_0x7ef1('0x1a')](_0x7ef1('0x58'),'Recording\x20is\x20enabled!');_0x2e7f5e[_0x7ef1('0x56')]=_0x3e054e;}else{_0x2e7f5e[_0x7ef1('0x56')]='';}return getUser(_0xa38413,_0x2c23ba,_0x558487,_0x32ef05,_0x21f564,_0x25bcc6)[_0x7ef1('0x21')](function(_0x592a11){logger[_0x7ef1('0x1a')]('['+_0x25bcc6[_0x7ef1('0x12')]()+']\x20The\x20User\x20ID\x20is:',_0x592a11[_0x7ef1('0x1d')]);logger[_0x7ef1('0x1a')]('['+_0x25bcc6[_0x7ef1('0x12')]()+']\x20The\x20User\x20email\x20is:',_0x592a11[_0x7ef1('0x18')]);return getEndUser(_0x592a11,_0x2c23ba,_0x32ef05,_0x21f564,_0x2e7f5e,_0x25bcc6);})[_0x7ef1('0x21')](function(_0x1611f){logger['info']('['+_0x25bcc6[_0x7ef1('0x12')]()+_0x7ef1('0x59'),_0x1611f[_0x7ef1('0x2d')]);logger['info']('['+_0x25bcc6[_0x7ef1('0x12')]()+_0x7ef1('0x5a'),_0x2e7f5e['calleridnum']);return getTicket(_0x1611f,_0x2c23ba,_0x32ef05,_0x21f564,_0x2e7f5e,_0x3439c9,_0x25bcc6);})[_0x7ef1('0x21')](function(_0x446476){logger[_0x7ef1('0x1a')](util[_0x7ef1('0x48')]('['+_0x25bcc6[_0x7ef1('0x12')]()+_0x7ef1('0x5b'),_0x3439c9[_0x7ef1('0x3b')],_0x446476[_0x7ef1('0x5c')]));logger[_0x7ef1('0x1a')](util['format']('['+_0x25bcc6[_0x7ef1('0x12')]()+']\x20Call\x20direction:\x20%s',_0x25bcc6));if(_0x25bcc6!==_0x7ef1('0x4f')){logger['info']('['+_0x25bcc6[_0x7ef1('0x12')]()+']',_0x7ef1('0x5d'));emit(_0x2c23ba[_0x7ef1('0xd')],_0x558487[_0x7ef1('0x5e')],_0x3439c9['ticketType'],_0x446476[_0x7ef1('0x5c')]);}})[_0x7ef1('0x20')](function(_0x346ae0){logger[_0x7ef1('0x5f')]('['+_0x25bcc6[_0x7ef1('0x12')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x7ef1('0x60')](_0x346ae0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xba18=['password','clientSecret','then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','odata-entityid','lastIndexOf','enduserId','contacts?$select=telephone1','value','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','type','nameField','customField','substring','indexOf','content','ticketType','incident','incidents','assign','getString','Descriptions','/systemusers(','Fields','phonecall','phonecalls','Subjects','/contacts(','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','clientId','remoteUri'];(function(_0x4719ec,_0x321779){var _0x48e0da=function(_0x452d68){while(--_0x452d68){_0x4719ec['push'](_0x4719ec['shift']());}};_0x48e0da(++_0x321779);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ba1('0x0'));var BPromise=require(_0x8ba1('0x1'));var rp=require(_0x8ba1('0x2'));var util=require(_0x8ba1('0x3'));var intUtil=require(_0x8ba1('0x4'));var md5=require(_0x8ba1('0x5'));var Redis=require(_0x8ba1('0x6'));var logger=require(_0x8ba1('0x7'))('dynamics365');var config=require(_0x8ba1('0x8'));config[_0x8ba1('0x9')]=_[_0x8ba1('0xa')](config[_0x8ba1('0x9')],{'host':_0x8ba1('0xb'),'port':0x18eb});var io=require(_0x8ba1('0xc'))(new Redis(config['redis']));function getAuthToken(_0x3a87eb,_0x3d1fe7,_0x4dc6c4){var _0x49709e={'method':'POST','uri':_0x3d1fe7,'form':{'client_id':_0x3a87eb[_0x8ba1('0xd')],'resource':_0x3a87eb[_0x8ba1('0xe')],'username':_0x3a87eb['username'],'password':_0x3a87eb[_0x8ba1('0xf')],'grant_type':_0x8ba1('0xf'),'client_secret':_0x3a87eb[_0x8ba1('0x10')]},'json':!![]};return rp(_0x49709e)[_0x8ba1('0x11')](function(_0x447ac0){return _0x447ac0['access_token'];})[_0x8ba1('0x12')](function(_0x2bad04){logger[_0x8ba1('0x13')]('['+[_0x4dc6c4[_0x8ba1('0x14')]()]+_0x8ba1('0x15'));return _0x2bad04[_0x8ba1('0x16')];});}function getUser(_0x58e32b,_0x108541,_0x44a40a,_0x2e81d1,_0xca53c4,_0x4c8d5c){return new BPromise(function(_0x53a141,_0x5c04b7){return getAuthToken(_0x108541,_0x2e81d1,_0x4c8d5c)[_0x8ba1('0x11')](function(_0x398f40){var _0x5a3a8a={'method':_0x8ba1('0x17'),'uri':_0xca53c4+_0x8ba1('0x18'),'headers':{'Authorization':_0x8ba1('0x19')+_0x398f40,'OData-Version':_0x8ba1('0x1a')},'json':!![]};return rp(_0x5a3a8a);})[_0x8ba1('0x11')](function(_0x19ade9){var _0x245929=_0x19ade9['value'];var _0x4c6325=![];var _0x1a48fa=null;if(!_[_0x8ba1('0x1b')](_0x44a40a)){if(intUtil['validateEmail'](_0x44a40a[_0x8ba1('0x1c')])){_0x58e32b[_0x8ba1('0x1d')]=_0x44a40a[_0x8ba1('0x1c')];for(_0x1a48fa=0x0;_0x1a48fa<_0x245929[_0x8ba1('0x1e')];_0x1a48fa++){if(_0x245929[_0x1a48fa][_0x8ba1('0x1f')]===_0x44a40a[_0x8ba1('0x1c')]&&!_0x245929[_0x1a48fa]['isdisabled']){_0x4c6325=!![];logger[_0x8ba1('0x20')]('['+[_0x4c8d5c['toUpperCase']()]+_0x8ba1('0x21')+_0x245929[_0x1a48fa][_0x8ba1('0x22')]+'!');_0x58e32b[_0x8ba1('0x23')]=_0x245929[_0x1a48fa][_0x8ba1('0x22')];}}}}if(!_0x4c6325){logger['info']('['+[_0x4c8d5c[_0x8ba1('0x14')]()]+_0x8ba1('0x24'));_0x58e32b[_0x8ba1('0x1d')]=_0x108541[_0x8ba1('0x25')];for(_0x1a48fa=0x0;_0x1a48fa<_0x245929[_0x8ba1('0x1e')];_0x1a48fa++){if(_0x245929[_0x1a48fa][_0x8ba1('0x1f')]===_0x108541[_0x8ba1('0x25')]){_0x58e32b[_0x8ba1('0x23')]=_0x245929[_0x1a48fa][_0x8ba1('0x22')];}}}_0x53a141(_0x58e32b);})[_0x8ba1('0x12')](function(_0x3b205c){_0x5c04b7(_0x3b205c['message']);});});}function createEndUser(_0x5c924e,_0x41c2bb,_0x1ccd44,_0x56aef2,_0x2baa80,_0xef508d){return new BPromise(function(_0x2b1f46,_0x326460){return getAuthToken(_0x41c2bb,_0x1ccd44,_0xef508d)[_0x8ba1('0x11')](function(_0x8d8220){var _0x2acf1c=_0xef508d[_0x8ba1('0x26')]()===_0x8ba1('0x27')?_0x2baa80[_0x8ba1('0x28')]:_0x2baa80[_0x8ba1('0x29')];var _0x136eef={'method':_0x8ba1('0x2a'),'uri':_0x56aef2+_0x8ba1('0x2b'),'body':{'telephone1':_0x2acf1c,'fullname':_0x2acf1c,'firstname':_0x2acf1c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x5c924e[_0x8ba1('0x23')]+')'},'headers':{'Authorization':_0x8ba1('0x19')+_0x8d8220,'OData-Version':_0x8ba1('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x136eef);})[_0x8ba1('0x11')](function(_0x243a0a){var _0x24bf95=_0x243a0a['headers'][_0x8ba1('0x2c')];var _0x2af152=_0x24bf95['substring'](_0x24bf95[_0x8ba1('0x2d')]('(')+0x1,_0x24bf95['lastIndexOf'](')'));_0x5c924e[_0x8ba1('0x2e')]=_0x2af152;_0x2b1f46(_0x5c924e);})[_0x8ba1('0x12')](function(_0x53e668){_0x326460(_0x53e668[_0x8ba1('0x16')]);});});}function getEndUser(_0x40b97c,_0x2de2e4,_0x3da8d4,_0x1376e8,_0x58d923,_0x26d845){return new BPromise(function(_0x174528,_0x14ee0c){return getAuthToken(_0x2de2e4,_0x3da8d4,_0x26d845)[_0x8ba1('0x11')](function(_0x2313e8){var _0x2abd37={'method':_0x8ba1('0x17'),'uri':_0x1376e8+_0x8ba1('0x2f'),'headers':{'Authorization':'Bearer\x20'+_0x2313e8,'If-None-Match':null,'OData-Version':_0x8ba1('0x1a')},'json':!![]};return rp(_0x2abd37);})[_0x8ba1('0x11')](function(_0x2a8f04){var _0x1e6093=null;if(_0x2a8f04){var _0x43fa60=_0x2a8f04[_0x8ba1('0x30')];var _0x215656=![];for(_0x1e6093=0x0;_0x1e6093<_0x43fa60[_0x8ba1('0x1e')];_0x1e6093++){var _0x6117aa=_0x26d845[_0x8ba1('0x26')]()==='outbound'?_0x58d923[_0x8ba1('0x28')]:_0x58d923[_0x8ba1('0x29')];if(_0x43fa60[_0x1e6093][_0x8ba1('0x31')]===_0x6117aa){_0x215656=!![];_0x40b97c[_0x8ba1('0x2e')]=_0x43fa60[_0x1e6093][_0x8ba1('0x32')];}}if(_0x215656){_0x174528(_0x40b97c);}else{return createEndUser(_0x40b97c,_0x2de2e4,_0x3da8d4,_0x1376e8,_0x58d923,_0x26d845)[_0x8ba1('0x11')](function(_0x3034aa){logger[_0x8ba1('0x20')]('['+[_0x26d845[_0x8ba1('0x14')]()]+_0x8ba1('0x33'),_0x3034aa['enduserId']);_0x174528(_0x3034aa);});}}else{return createEndUser(_0x40b97c,_0x2de2e4,_0x3da8d4,_0x1376e8,_0x58d923,_0x26d845)['then'](function(_0x11ce52){logger[_0x8ba1('0x20')]('['+[_0x26d845[_0x8ba1('0x14')]()]+_0x8ba1('0x34'),_0x11ce52[_0x8ba1('0x2e')]);_0x174528(_0x11ce52);});}});});}function getCustomFields(_0xa65f6d,_0x414412,_0x64bf9e){var _0x2506f0={};if(_0xa65f6d[_0x8ba1('0x1e')]>0x0){_[_0x8ba1('0x35')](_0xa65f6d,function(_0xb653bf){if(_[_0x8ba1('0x36')]([_0x8ba1('0x37'),'picklist'],_0xb653bf[_0x8ba1('0x38')])&&_0xb653bf[_0x8ba1('0x39')]&&!_0xb653bf[_0x8ba1('0x3a')]){var _0x1fc16a=_0xb653bf['idField']['toLowerCase']();var _0x2ac7bc=_0x1fc16a[_0x8ba1('0x3b')](0x0,_0x1fc16a[_0x8ba1('0x3c')]('_'));var _0x3430d4=_0x1fc16a[_0x8ba1('0x3b')](_0x1fc16a['indexOf']('_')+0x1);if(_0x2ac7bc===_0x64bf9e){_0x2506f0[_0x3430d4]=_0xb653bf[_0x8ba1('0x3d')];}}});}return _0x2506f0;}function getTicket(_0x171054,_0x16bdb1,_0x5b02d8,_0x1e5376,_0x4374db,_0x3ab683,_0x30109d){return new BPromise(function(_0x34b0c3,_0x3bb4dc){var _0x523c1b;return getAuthToken(_0x16bdb1,_0x5b02d8,_0x30109d)[_0x8ba1('0x11')](function(_0x4d1ba2){if(_0x3ab683[_0x8ba1('0x3e')]===_0x8ba1('0x3f')){_0x523c1b={'method':_0x8ba1('0x2a'),'uri':_0x1e5376+_0x8ba1('0x40'),'body':Object[_0x8ba1('0x41')]({},{'title':intUtil[_0x8ba1('0x42')](_0x3ab683['Subjects'],_0x4374db,'\x20'),'description':intUtil[_0x8ba1('0x42')](_0x3ab683[_0x8ba1('0x43')],_0x4374db,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x171054['enduserId']+')','ownerid@odata.bind':_0x8ba1('0x44')+_0x171054[_0x8ba1('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x3ab683[_0x8ba1('0x45')],_0x4374db,_0x3ab683[_0x8ba1('0x3e')])),'headers':{'Authorization':_0x8ba1('0x19')+_0x4d1ba2,'OData-Version':_0x8ba1('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3ab683[_0x8ba1('0x3e')]===_0x8ba1('0x46')){_0x523c1b={'method':_0x8ba1('0x2a'),'uri':_0x1e5376+_0x8ba1('0x47'),'body':Object[_0x8ba1('0x41')]({},{'subject':intUtil[_0x8ba1('0x42')](_0x3ab683[_0x8ba1('0x48')],_0x4374db,'\x20'),'phonenumber':String(_0x4374db['calleridnum']),'description':intUtil[_0x8ba1('0x42')](_0x3ab683[_0x8ba1('0x43')],_0x4374db,'\x0a'),'regardingobjectid_contact@odata.bind':_0x8ba1('0x49')+_0x171054[_0x8ba1('0x2e')]+')','ownerid@odata.bind':_0x8ba1('0x44')+_0x171054[_0x8ba1('0x23')]+')','directioncode':_0x171054[_0x8ba1('0x4a')]===_0x8ba1('0x4b')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x8ba1('0x44')+_0x171054[_0x8ba1('0x23')]+')','participationtypemask':_0x171054[_0x8ba1('0x4a')]===_0x8ba1('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0x8ba1('0x49')+_0x171054[_0x8ba1('0x2e')]+')','participationtypemask':_0x171054['callDirection']===_0x8ba1('0x4b')?0x1:0x2}]},getCustomFields(_0x3ab683[_0x8ba1('0x45')],_0x4374db,_0x3ab683['ticketType'])),'headers':{'Authorization':_0x8ba1('0x19')+_0x4d1ba2,'OData-Version':_0x8ba1('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x523c1b);})[_0x8ba1('0x11')](function(_0x210977){var _0x10fc3c=_0x210977['headers']['odata-entityid'];var _0x28f2ab=_0x10fc3c[_0x8ba1('0x3b')](_0x10fc3c['lastIndexOf']('(')+0x1,_0x10fc3c[_0x8ba1('0x2d')](')'));_0x171054[_0x8ba1('0x4c')]=_0x28f2ab;_0x34b0c3(_0x171054);})[_0x8ba1('0x12')](function(_0x4d93b2){_0x3bb4dc(_0x4d93b2[_0x8ba1('0x16')]);});});}function emit(_0x463dac,_0x1cac6b,_0x4fe2fd,_0x368e59){var _0x4209fb={'uri':util[_0x8ba1('0x4d')](_0x8ba1('0x4e'),_0x463dac,_0x4fe2fd,_0x368e59)};io['to'](util['format'](_0x8ba1('0x4f'),_0x1cac6b))[_0x8ba1('0x50')](_0x8ba1('0x51'),_0x4209fb);}exports['cs']=function(_0x2e1aeb,_0x33cdfb,_0x5f4ac3,_0xfb78ed,_0x3d1979,_0x19dcde,_0x3da484,_0x557452){var _0x405c5e={};_0x19dcde[_0x8ba1('0xe')]=intUtil[_0x8ba1('0x52')](_0x19dcde[_0x8ba1('0xe')]);_0x19dcde[_0x8ba1('0x53')]=intUtil[_0x8ba1('0x52')](_0x19dcde['serverUrl']);_0x405c5e[_0x8ba1('0x4a')]=_0x557452==='queue'||_0x557452==='unmanaged'?_0x8ba1('0x4b'):'outbound';var _0x352ff3=util[_0x8ba1('0x4d')]('%s/api/data/v9.0/',_0x19dcde[_0x8ba1('0xe')]);var _0x573cc8=util['format'](_0x8ba1('0x54'),_0x19dcde['tenantId']);var _0x36f41a=util[_0x8ba1('0x4d')](_0x8ba1('0x55'),_0x19dcde[_0x8ba1('0x53')],_0x33cdfb[_0x8ba1('0x56')],md5(_0x33cdfb[_0x8ba1('0x56')]));if(_0x3d1979&&_0x3d1979['monitor_format']){logger[_0x8ba1('0x20')]('[QUEUE]',_0x8ba1('0x57'));_0x33cdfb['recordingURL']=_0x36f41a;}else if(_0x3da484&&_0x3da484[_0x8ba1('0x58')]&&_0x3da484['recordingFormat']!==_0x8ba1('0x59')){logger[_0x8ba1('0x20')](_0x8ba1('0x5a'),_0x8ba1('0x57'));_0x33cdfb[_0x8ba1('0x5b')]=_0x36f41a;}else{_0x33cdfb['recordingURL']='';}return getUser(_0x405c5e,_0x19dcde,_0xfb78ed,_0x573cc8,_0x352ff3,_0x557452)['then'](function(_0x597d49){logger['info']('['+_0x557452[_0x8ba1('0x14')]()+_0x8ba1('0x5c'),_0x597d49[_0x8ba1('0x23')]);logger[_0x8ba1('0x20')]('['+_0x557452['toUpperCase']()+_0x8ba1('0x5d'),_0x597d49[_0x8ba1('0x1d')]);return getEndUser(_0x597d49,_0x19dcde,_0x573cc8,_0x352ff3,_0x33cdfb,_0x557452);})[_0x8ba1('0x11')](function(_0x21cc83){logger['info']('['+_0x557452['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x21cc83[_0x8ba1('0x2e')]);logger['info']('['+_0x557452[_0x8ba1('0x14')]()+_0x8ba1('0x5e'),_0x33cdfb[_0x8ba1('0x29')]);return getTicket(_0x21cc83,_0x19dcde,_0x573cc8,_0x352ff3,_0x33cdfb,_0x5f4ac3,_0x557452);})['then'](function(_0x3cadb5){logger['info'](util[_0x8ba1('0x4d')]('['+_0x557452[_0x8ba1('0x14')]()+_0x8ba1('0x5f'),_0x5f4ac3[_0x8ba1('0x3e')],_0x3cadb5[_0x8ba1('0x4c')]));logger[_0x8ba1('0x20')](util[_0x8ba1('0x4d')]('['+_0x557452[_0x8ba1('0x14')]()+_0x8ba1('0x60'),_0x557452));if(_0x557452!=='unmanaged'){logger[_0x8ba1('0x20')]('['+_0x557452[_0x8ba1('0x14')]()+']',_0x8ba1('0x61'));emit(_0x19dcde[_0x8ba1('0xe')],_0xfb78ed[_0x8ba1('0x62')],_0x5f4ac3[_0x8ba1('0x3e')],_0x3cadb5['ticketId']);}})[_0x8ba1('0x12')](function(_0x3332e5){logger['error']('['+_0x557452[_0x8ba1('0x14')]()+_0x8ba1('0x63'),util[_0x8ba1('0x64')](_0x3332e5,{'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 33179a3..07fa0c0 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 _0x3e0d=['request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','name','Fields','custom_fields','value','remoteUri','POST','then','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','push','idField','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/helpdesk/tickets/%d','lastevent','toUpperCase'];(function(_0x35c5ab,_0x2672b4){var _0x30e192=function(_0x195c3b){while(--_0x195c3b){_0x35c5ab['push'](_0x35c5ab['shift']());}};_0x30e192(++_0x2672b4);}(_0x3e0d,0x1cc));var _0xd3e0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e0d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0xd3e0('0x0'));var md5=require(_0xd3e0('0x1'));var util=require(_0xd3e0('0x2'));var Redis=require(_0xd3e0('0x3'));var intUtil=require(_0xd3e0('0x4'));var config=require(_0xd3e0('0x5'));var logger=require('../../../../config/logger')(_0xd3e0('0x6'));config[_0xd3e0('0x7')]=_[_0xd3e0('0x8')](config[_0xd3e0('0x7')],{'host':_0xd3e0('0x9'),'port':0x18eb});var io=require(_0xd3e0('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0xd3e0('0xb'),'Accept':_0xd3e0('0xb')};function emit(_0x5534d0,_0x369b20,_0xd8766e){io['to'](_0x5534d0)[_0xd3e0('0xc')](_0x369b20,_0xd8766e);}function getTicket(_0x1b458b,_0x33512b,_0x287c9e,_0x4425e2,_0x36941c){logger[_0xd3e0('0xd')]('Creating\x20new\x20ticket...');var _0x42fa29=_[_0xd3e0('0xe')]({'responder_id':_0x33512b['id'],'requester_id':_0x287c9e['id'],'name':util[_0xd3e0('0xf')](_0xd3e0('0x10'),_0x36941c[_0xd3e0('0x11')]),'phone':_0x36941c[_0xd3e0('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x4425e2[_0xd3e0('0x13')],_0x36941c,'\x20'),'description':intUtil[_0xd3e0('0x14')](_0x4425e2[_0xd3e0('0x15')],_0x36941c,_0xd3e0('0x16')),'tags':getTags(_0x4425e2['Tags'],_0xd3e0('0x17'))},getCustomFields(_0x4425e2[_0xd3e0('0x18')],_0x36941c));_0x42fa29[_0xd3e0('0x19')]=_['mapValues'](_['keyBy'](_0x42fa29[_0xd3e0('0x19')],'id'),_0xd3e0('0x1a'));return request({'uri':util[_0xd3e0('0xf')]('%s/api/v2/tickets',_0x1b458b[_0xd3e0('0x1b')]),'method':_0xd3e0('0x1c'),'body':_0x42fa29})[_0xd3e0('0x1d')](function(_0x3e7dd8){logger[_0xd3e0('0xd')]('Ticket\x20created!');return _0x3e7dd8;});}function getUser(_0x7de539,_0x45fa47){if(intUtil['validateEmail'](_0x45fa47)){return request({'uri':util[_0xd3e0('0xf')](_0xd3e0('0x1e'),_0x7de539['remoteUri']),'qs':{'email':_0x45fa47}})[_0xd3e0('0x1d')](function(_0x3e570e){if(_0x3e570e[_0xd3e0('0x1f')]){logger[_0xd3e0('0xd')](_0xd3e0('0x20'));return _[_0xd3e0('0x21')](_0x3e570e,function(_0x55d147){return _0x55d147[_0xd3e0('0x22')][_0xd3e0('0x23')]===_0x45fa47;});}else{logger[_0xd3e0('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xd3e0('0x24'),_0x7de539['remoteUri'])})[_0xd3e0('0x1d')](function(_0x4f0df7){logger[_0xd3e0('0xd')](_0xd3e0('0x25'));return _0x4f0df7;});}});}else{logger['info'](_0xd3e0('0x26'));return request({'uri':util[_0xd3e0('0xf')](_0xd3e0('0x24'),_0x7de539['remoteUri'])})[_0xd3e0('0x1d')](function(_0x2d23ca){logger[_0xd3e0('0xd')](_0xd3e0('0x25'));return _0x2d23ca;});}}function getEndUser(_0x23ecde,_0x21033b,_0x1985e9){logger[_0xd3e0('0xd')](_0xd3e0('0x27'),_0x1985e9);return request({'uri':util[_0xd3e0('0xf')](_0xd3e0('0x28'),_0x23ecde[_0xd3e0('0x1b')]),'qs':{'phone':_0x1985e9}})[_0xd3e0('0x1d')](function(_0x3f482e){if(_0x3f482e[_0xd3e0('0x1f')]){logger['info']('Enduser\x20found!');return _[_0xd3e0('0x21')](_0x3f482e,{'phone':_0x1985e9});}else{logger[_0xd3e0('0xd')](_0xd3e0('0x29'));return request({'uri':util['format'](_0xd3e0('0x28'),_0x23ecde['remoteUri']),'method':_0xd3e0('0x1c'),'body':{'name':_0x21033b,'phone':_0x1985e9}})['then'](function(_0x5bc123){logger[_0xd3e0('0xd')](_0xd3e0('0x2a'));return _0x5bc123;});}});}function getAuth(_0x5eb309){return util[_0xd3e0('0xf')](_0xd3e0('0x2b'),new Buffer(_0x5eb309[_0xd3e0('0x2c')]+':X')[_0xd3e0('0x2d')](_0xd3e0('0x2e')));}function request(_0x53f81b){logger[_0xd3e0('0x2f')]('[HTTP]',JSON['stringify'](_0x53f81b));return rp(_[_0xd3e0('0x8')](_0x53f81b,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x427d67,_0x480e2c){var _0x445cc0=[];if(_0x427d67&&_0x427d67[_0xd3e0('0x1f')]>0x0){_0x445cc0=_[_0xd3e0('0x30')](_0x427d67,_0x480e2c);}return _0x445cc0;}function getCustomFields(_0x4b6d85,_0x427584){var _0x2bca2d=[];var _0xcc2045={'custom_fields':[]};if(_0x4b6d85[_0xd3e0('0x1f')]>0x0){_[_0xd3e0('0x31')](_0x4b6d85,function(_0x346ad0){if(_[_0xd3e0('0x32')](['string',_0xd3e0('0x33')],_0x346ad0[_0xd3e0('0x34')])&&_0x346ad0[_0xd3e0('0x35')]&&!_0x346ad0[_0xd3e0('0x36')]){_0xcc2045[_0x346ad0[_0xd3e0('0x35')][_0xd3e0('0x37')]()]=_0x346ad0['content'][_0xd3e0('0x2d')]();}else if(_[_0xd3e0('0x32')](['string',_0xd3e0('0x33')],_0x346ad0['type'])&&_0x346ad0['idField']&&_0x346ad0[_0xd3e0('0x36')]){_0xcc2045[_0xd3e0('0x19')][_0xd3e0('0x38')]({'id':_0x346ad0[_0xd3e0('0x39')],'value':_0x346ad0[_0xd3e0('0x3a')][_0xd3e0('0x2d')]()});}else if(_0x346ad0[_0xd3e0('0x34')]===_0xd3e0('0x3b')&&_0x346ad0['variableName']&&_0x346ad0[_0xd3e0('0x39')]&&_0x346ad0['customField']){_0x427584[_0x346ad0[_0xd3e0('0x3c')]]&&_0xcc2045['custom_fields'][_0xd3e0('0x38')]({'id':_0x346ad0['idField'],'value':_0x427584[_0x346ad0['variableName']]['toString']()});}else if(_0x346ad0[_0xd3e0('0x34')]===_0xd3e0('0x3d')&&_0x346ad0[_0xd3e0('0x3e')]&&_0x346ad0['Variable'][_0xd3e0('0x17')]&&_0x346ad0['idField']&&_0x346ad0[_0xd3e0('0x36')]){_0x427584[_0x346ad0[_0xd3e0('0x3e')][_0xd3e0('0x17')][_0xd3e0('0x37')]()]&&_0xcc2045[_0xd3e0('0x19')][_0xd3e0('0x38')]({'id':_0x346ad0[_0xd3e0('0x39')],'value':_0x427584[_0x346ad0[_0xd3e0('0x3e')][_0xd3e0('0x17')]['toLowerCase']()][_0xd3e0('0x2d')]()});}});}return _0xcc2045;}exports[_0xd3e0('0x3f')]=function(_0x1ec564,_0x405d1d,_0x97247b,_0x42221e,_0x4dceb0,_0x1e77b0){var _0x5d5508,_0x4f6e4f;_0x1e77b0['remoteUri']=intUtil[_0xd3e0('0x40')](_0x1e77b0[_0xd3e0('0x1b')]);_0x1e77b0[_0xd3e0('0x41')]=intUtil[_0xd3e0('0x40')](_0x1e77b0[_0xd3e0('0x41')]);if(_0x4dceb0&&_0x4dceb0[_0xd3e0('0x42')]){logger['info'](_0xd3e0('0x43'),_0xd3e0('0x44'));_0x405d1d['recordingURL']=util['format'](_0xd3e0('0x45'),_0x1e77b0[_0xd3e0('0x41')],_0x405d1d[_0xd3e0('0x46')],md5(_0x405d1d[_0xd3e0('0x46')]));}else{_0x405d1d[_0xd3e0('0x47')]='';}headers[_0xd3e0('0x48')]=getAuth(_0x1e77b0);return getUser(_0x1e77b0,_0x42221e[_0xd3e0('0x23')])[_0xd3e0('0x1d')](function(_0x3c7d27){_0x5d5508=_0x3c7d27;logger[_0xd3e0('0xd')](_0xd3e0('0x49'),_0x5d5508['id']);return getEndUser(_0x1e77b0,_0x405d1d['calleridname'],_0x405d1d[_0xd3e0('0x12')]);})[_0xd3e0('0x1d')](function(_0x21ba79){_0x4f6e4f=_0x21ba79;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4f6e4f['id']);return getTicket(_0x1e77b0,_0x5d5508,_0x4f6e4f,_0x97247b,_0x405d1d);})[_0xd3e0('0x1d')](function(_0x203721){if(_0x203721&&_0x203721['id']){logger[_0xd3e0('0xd')](_0xd3e0('0x4a'));logger['info'](_0xd3e0('0x4b'),_0x203721['id']);logger[_0xd3e0('0xd')]('[QUEUE]',_0xd3e0('0x4c'));emit(util[_0xd3e0('0xf')](_0xd3e0('0x4d'),_0x42221e[_0xd3e0('0x17')]),_0xd3e0('0x4e'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x1e77b0[_0xd3e0('0x1b')],_0x203721['id'])});}})[_0xd3e0('0x4f')](function(_0x43b673){logger[_0xd3e0('0x50')](_0xd3e0('0x43'),JSON[_0xd3e0('0x51')](_0x43b673));});};exports[_0xd3e0('0x52')]=function(_0x12e088,_0x3d46d7,_0x2d3334,_0x16ede5,_0x494de2,_0x2e596f,_0x225969){var _0x2995ac,_0x3460f1;_0x2e596f['remoteUri']=intUtil[_0xd3e0('0x40')](_0x2e596f[_0xd3e0('0x1b')]);_0x2e596f['serverUrl']=intUtil[_0xd3e0('0x40')](_0x2e596f[_0xd3e0('0x41')]);if(_0x225969&&_0x225969[_0xd3e0('0x53')]&&_0x225969[_0xd3e0('0x53')]!==_0xd3e0('0x54')){logger['info'](_0xd3e0('0x55'),_0xd3e0('0x44'));_0x3d46d7[_0xd3e0('0x47')]=util[_0xd3e0('0xf')](_0xd3e0('0x45'),_0x2e596f[_0xd3e0('0x41')],_0x3d46d7[_0xd3e0('0x46')],md5(_0x3d46d7[_0xd3e0('0x46')]));}headers['Authorization']=getAuth(_0x2e596f);return getUser(_0x2e596f,_0x16ede5[_0xd3e0('0x23')])['then'](function(_0x50c4b6){_0x2995ac=_0x50c4b6;logger[_0xd3e0('0xd')](_0xd3e0('0x49'),_0x2995ac['id']);return getEndUser(_0x2e596f,_0x3d46d7[_0xd3e0('0x56')],_0x3d46d7[_0xd3e0('0x57')]);})[_0xd3e0('0x1d')](function(_0x4d3d4b){_0x3460f1=_0x4d3d4b;logger[_0xd3e0('0xd')](_0xd3e0('0x58'),_0x3460f1['id']);return getTicket(_0x2e596f,_0x2995ac,_0x3460f1,_0x2d3334,_0x3d46d7);})[_0xd3e0('0x1d')](function(_0x44c836){if(_0x44c836&&_0x44c836['id']){logger[_0xd3e0('0xd')](_0xd3e0('0x4a'));logger['info'](_0xd3e0('0x4b'),_0x44c836['id']);logger[_0xd3e0('0xd')](_0xd3e0('0x55'),_0xd3e0('0x4c'));emit(util[_0xd3e0('0xf')](_0xd3e0('0x4d'),_0x16ede5[_0xd3e0('0x17')]),_0xd3e0('0x4e'),{'uri':util[_0xd3e0('0xf')](_0xd3e0('0x59'),_0x2e596f[_0xd3e0('0x1b')],_0x44c836['id'])});}})[_0xd3e0('0x4f')](function(_0x2ba1f8){logger['error'](_0xd3e0('0x55'),JSON[_0xd3e0('0x51')](_0x2ba1f8));});};exports['unmanaged']=function(_0xf317be,_0x3102b8,_0x46b7ee,_0x4b99bd,_0x459ab3,_0x189cd9){var _0x360d10,_0x1af190;_0x189cd9[_0xd3e0('0x1b')]=intUtil[_0xd3e0('0x40')](_0x189cd9[_0xd3e0('0x1b')]);_0x189cd9[_0xd3e0('0x41')]=intUtil[_0xd3e0('0x40')](_0x189cd9[_0xd3e0('0x41')]);if(_0x459ab3&&_0x459ab3[_0xd3e0('0x42')]){logger['info']('['+_0x3102b8[_0xd3e0('0x5a')][_0xd3e0('0x5b')]()+']',_0xd3e0('0x44'));_0x3102b8[_0xd3e0('0x47')]=util['format'](_0xd3e0('0x45'),_0x189cd9[_0xd3e0('0x41')],_0x3102b8[_0xd3e0('0x46')],md5(_0x3102b8[_0xd3e0('0x46')]));}else{_0x3102b8[_0xd3e0('0x47')]='';}headers[_0xd3e0('0x48')]=getAuth(_0x189cd9);return getUser(_0x189cd9,'')['then'](function(_0x26d298){_0x360d10=_0x26d298;logger[_0xd3e0('0xd')](_0xd3e0('0x49'),_0x360d10['id']);return getEndUser(_0x189cd9,_0x3102b8[_0xd3e0('0x11')],_0x3102b8[_0xd3e0('0x12')]);})['then'](function(_0x563097){_0x1af190=_0x563097;logger['info'](_0xd3e0('0x58'),_0x1af190['id']);return getTicket(_0x189cd9,_0x360d10,_0x1af190,_0x46b7ee,_0x3102b8);})['then'](function(_0x3f6df3){if(_0x3f6df3){logger[_0xd3e0('0xd')](_0xd3e0('0x4a'));logger[_0xd3e0('0xd')]('The\x20Ticket\x20ID\x20is:',_0x3f6df3['id']);}})[_0xd3e0('0x4f')](function(_0x25aa28){logger[_0xd3e0('0x50')]('['+_0x3102b8[_0xd3e0('0x5a')]['toUpperCase']()+']',JSON[_0xd3e0('0x51')](_0x25aa28));});}; \ No newline at end of file +var _0x0e81=['picklist','type','nameField','content','string','idField','customField','variable','variableName','push','customVariable','Variable','name','toLowerCase','queue','serverUrl','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Authorization','The\x20User\x20ID\x20is:','destcalleridnum','error','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','Tags','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes'];(function(_0x34885c,_0x5241ab){var _0x2381e1=function(_0x341818){while(--_0x341818){_0x34885c['push'](_0x34885c['shift']());}};_0x2381e1(++_0x5241ab);}(_0x0e81,0x1a4));var _0x10e8=function(_0x7c1a5d,_0x4bcb22){_0x7c1a5d=_0x7c1a5d-0x0;var _0x1cceb3=_0x0e81[_0x7c1a5d];return _0x1cceb3;};'use strict';var _=require(_0x10e8('0x0'));var rp=require(_0x10e8('0x1'));var md5=require('md5');var util=require(_0x10e8('0x2'));var Redis=require(_0x10e8('0x3'));var intUtil=require(_0x10e8('0x4'));var config=require(_0x10e8('0x5'));var logger=require('../../../../config/logger')(_0x10e8('0x6'));config[_0x10e8('0x7')]=_[_0x10e8('0x8')](config[_0x10e8('0x7')],{'host':_0x10e8('0x9'),'port':0x18eb});var io=require(_0x10e8('0xa'))(new Redis(config[_0x10e8('0x7')]));var headers={'Content-Type':'application/json','Accept':_0x10e8('0xb')};function emit(_0x51fb61,_0x296bbe,_0x115851){io['to'](_0x51fb61)[_0x10e8('0xc')](_0x296bbe,_0x115851);}function getTicket(_0x3b2360,_0x1df86d,_0x351dea,_0x57d704,_0x1bb305){logger[_0x10e8('0xd')](_0x10e8('0xe'));var _0x3ca569=_[_0x10e8('0xf')]({'responder_id':_0x1df86d['id'],'requester_id':_0x351dea['id'],'name':util[_0x10e8('0x10')](_0x10e8('0x11'),_0x1bb305[_0x10e8('0x12')]),'phone':_0x1bb305[_0x10e8('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x10e8('0x14')](_0x57d704['Subjects'],_0x1bb305,'\x20'),'description':intUtil[_0x10e8('0x14')](_0x57d704[_0x10e8('0x15')],_0x1bb305,'
'),'tags':getTags(_0x57d704[_0x10e8('0x16')],'name')},getCustomFields(_0x57d704[_0x10e8('0x17')],_0x1bb305));_0x3ca569['custom_fields']=_[_0x10e8('0x18')](_[_0x10e8('0x19')](_0x3ca569[_0x10e8('0x1a')],'id'),_0x10e8('0x1b'));return request({'uri':util[_0x10e8('0x10')](_0x10e8('0x1c'),_0x3b2360[_0x10e8('0x1d')]),'method':_0x10e8('0x1e'),'body':_0x3ca569})[_0x10e8('0x1f')](function(_0x53308c){logger['info'](_0x10e8('0x20'));return _0x53308c;});}function getUser(_0x596f59,_0x47beaf){if(intUtil[_0x10e8('0x21')](_0x47beaf)){return request({'uri':util['format']('%s/api/v2/agents',_0x596f59[_0x10e8('0x1d')]),'qs':{'email':_0x47beaf}})[_0x10e8('0x1f')](function(_0x45f16c){if(_0x45f16c[_0x10e8('0x22')]){logger[_0x10e8('0xd')](_0x10e8('0x23'));return _['find'](_0x45f16c,function(_0xb7e26d){return _0xb7e26d[_0x10e8('0x24')]['email']===_0x47beaf;});}else{logger[_0x10e8('0xd')](_0x10e8('0x25'));return request({'uri':util['format'](_0x10e8('0x26'),_0x596f59[_0x10e8('0x1d')])})[_0x10e8('0x1f')](function(_0x233c65){logger[_0x10e8('0xd')](_0x10e8('0x27'));return _0x233c65;});}});}else{logger['info'](_0x10e8('0x28'));return request({'uri':util[_0x10e8('0x10')](_0x10e8('0x26'),_0x596f59['remoteUri'])})['then'](function(_0x4cca28){logger[_0x10e8('0xd')](_0x10e8('0x27'));return _0x4cca28;});}}function getEndUser(_0x25ae21,_0x4e07f0,_0x457701){logger[_0x10e8('0xd')]('Searching\x20enduser\x20with\x20phone',_0x457701);return request({'uri':util['format'](_0x10e8('0x29'),_0x25ae21[_0x10e8('0x1d')]),'qs':{'phone':_0x457701}})[_0x10e8('0x1f')](function(_0x326eb9){if(_0x326eb9['length']){logger[_0x10e8('0xd')](_0x10e8('0x2a'));return _['find'](_0x326eb9,{'phone':_0x457701});}else{logger[_0x10e8('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x10e8('0x10')]('%s/api/v2/contacts',_0x25ae21[_0x10e8('0x1d')]),'method':_0x10e8('0x1e'),'body':{'name':_0x4e07f0,'phone':_0x457701}})[_0x10e8('0x1f')](function(_0x1b31d4){logger[_0x10e8('0xd')](_0x10e8('0x2b'));return _0x1b31d4;});}});}function getAuth(_0x234cb0){return util[_0x10e8('0x10')](_0x10e8('0x2c'),new Buffer(_0x234cb0[_0x10e8('0x2d')]+':X')[_0x10e8('0x2e')](_0x10e8('0x2f')));}function request(_0x240c6a){logger[_0x10e8('0x30')](_0x10e8('0x31'),JSON[_0x10e8('0x32')](_0x240c6a));return rp(_[_0x10e8('0x8')](_0x240c6a,{'method':_0x10e8('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x58aa48,_0x2e9200){var _0x360107=[];if(_0x58aa48&&_0x58aa48[_0x10e8('0x22')]>0x0){_0x360107=_[_0x10e8('0x34')](_0x58aa48,_0x2e9200);}return _0x360107;}function getCustomFields(_0x1ecef0,_0xc54d1){var _0x174fe3=[];var _0x1e8a6e={'custom_fields':[]};if(_0x1ecef0[_0x10e8('0x22')]>0x0){_[_0x10e8('0x35')](_0x1ecef0,function(_0x5d4559){if(_[_0x10e8('0x36')](['string',_0x10e8('0x37')],_0x5d4559[_0x10e8('0x38')])&&_0x5d4559[_0x10e8('0x39')]&&!_0x5d4559['customField']){_0x1e8a6e[_0x5d4559['nameField']['toLowerCase']()]=_0x5d4559[_0x10e8('0x3a')][_0x10e8('0x2e')]();}else if(_[_0x10e8('0x36')]([_0x10e8('0x3b'),_0x10e8('0x37')],_0x5d4559[_0x10e8('0x38')])&&_0x5d4559[_0x10e8('0x3c')]&&_0x5d4559[_0x10e8('0x3d')]){_0x1e8a6e[_0x10e8('0x1a')]['push']({'id':_0x5d4559[_0x10e8('0x3c')],'value':_0x5d4559[_0x10e8('0x3a')][_0x10e8('0x2e')]()});}else if(_0x5d4559[_0x10e8('0x38')]===_0x10e8('0x3e')&&_0x5d4559[_0x10e8('0x3f')]&&_0x5d4559[_0x10e8('0x3c')]&&_0x5d4559[_0x10e8('0x3d')]){_0xc54d1[_0x5d4559[_0x10e8('0x3f')]]&&_0x1e8a6e['custom_fields'][_0x10e8('0x40')]({'id':_0x5d4559[_0x10e8('0x3c')],'value':_0xc54d1[_0x5d4559[_0x10e8('0x3f')]]['toString']()});}else if(_0x5d4559[_0x10e8('0x38')]===_0x10e8('0x41')&&_0x5d4559['Variable']&&_0x5d4559[_0x10e8('0x42')][_0x10e8('0x43')]&&_0x5d4559[_0x10e8('0x3c')]&&_0x5d4559[_0x10e8('0x3d')]){_0xc54d1[_0x5d4559[_0x10e8('0x42')][_0x10e8('0x43')][_0x10e8('0x44')]()]&&_0x1e8a6e[_0x10e8('0x1a')][_0x10e8('0x40')]({'id':_0x5d4559[_0x10e8('0x3c')],'value':_0xc54d1[_0x5d4559[_0x10e8('0x42')][_0x10e8('0x43')][_0x10e8('0x44')]()][_0x10e8('0x2e')]()});}});}return _0x1e8a6e;}exports[_0x10e8('0x45')]=function(_0x3ea273,_0x529117,_0x20cffe,_0x3d540f,_0x29b357,_0x489789){var _0xcc4c85,_0x215400;_0x489789[_0x10e8('0x1d')]=intUtil['stripTrailingSlash'](_0x489789[_0x10e8('0x1d')]);_0x489789[_0x10e8('0x46')]=intUtil['stripTrailingSlash'](_0x489789[_0x10e8('0x46')]);if(_0x29b357&&_0x29b357['monitor_format']){logger[_0x10e8('0xd')](_0x10e8('0x47'),'Recording\x20is\x20enabled!');_0x529117['recordingURL']=util[_0x10e8('0x10')](_0x10e8('0x48'),_0x489789[_0x10e8('0x46')],_0x529117['uniqueid'],md5(_0x529117[_0x10e8('0x49')]));}else{_0x529117[_0x10e8('0x4a')]='';}headers['Authorization']=getAuth(_0x489789);return getUser(_0x489789,_0x3d540f[_0x10e8('0x4b')])[_0x10e8('0x1f')](function(_0x5c300b){_0xcc4c85=_0x5c300b;logger[_0x10e8('0xd')]('The\x20User\x20ID\x20is:',_0xcc4c85['id']);return getEndUser(_0x489789,_0x529117[_0x10e8('0x12')],_0x529117['calleridnum']);})[_0x10e8('0x1f')](function(_0x578903){_0x215400=_0x578903;logger[_0x10e8('0xd')](_0x10e8('0x4c'),_0x215400['id']);return getTicket(_0x489789,_0xcc4c85,_0x215400,_0x20cffe,_0x529117);})['then'](function(_0x31e841){if(_0x31e841&&_0x31e841['id']){logger[_0x10e8('0xd')](_0x10e8('0x20'));logger['info'](_0x10e8('0x4d'),_0x31e841['id']);logger['info']('[QUEUE]',_0x10e8('0x4e'));emit(util['format'](_0x10e8('0x4f'),_0x3d540f[_0x10e8('0x43')]),_0x10e8('0x50'),{'uri':util['format'](_0x10e8('0x51'),_0x489789[_0x10e8('0x1d')],_0x31e841['id'])});}})[_0x10e8('0x52')](function(_0x1d067b){logger['error'](_0x10e8('0x47'),JSON[_0x10e8('0x32')](_0x1d067b));});};exports[_0x10e8('0x53')]=function(_0x4e830f,_0x19947c,_0x254a17,_0x13ef13,_0x3e6d46,_0x507b74,_0x54a835){var _0x36a764,_0x4a3a15;_0x507b74['remoteUri']=intUtil[_0x10e8('0x54')](_0x507b74[_0x10e8('0x1d')]);_0x507b74['serverUrl']=intUtil[_0x10e8('0x54')](_0x507b74[_0x10e8('0x46')]);if(_0x54a835&&_0x54a835[_0x10e8('0x55')]&&_0x54a835[_0x10e8('0x55')]!==_0x10e8('0x56')){logger['info'](_0x10e8('0x57'),'Recording\x20is\x20enabled!');_0x19947c[_0x10e8('0x4a')]=util['format'](_0x10e8('0x48'),_0x507b74[_0x10e8('0x46')],_0x19947c[_0x10e8('0x49')],md5(_0x19947c[_0x10e8('0x49')]));}headers[_0x10e8('0x58')]=getAuth(_0x507b74);return getUser(_0x507b74,_0x13ef13[_0x10e8('0x4b')])[_0x10e8('0x1f')](function(_0x5d7c94){_0x36a764=_0x5d7c94;logger[_0x10e8('0xd')](_0x10e8('0x59'),_0x36a764['id']);return getEndUser(_0x507b74,_0x19947c['destcalleridname'],_0x19947c[_0x10e8('0x5a')]);})[_0x10e8('0x1f')](function(_0x15bf4d){_0x4a3a15=_0x15bf4d;logger[_0x10e8('0xd')](_0x10e8('0x4c'),_0x4a3a15['id']);return getTicket(_0x507b74,_0x36a764,_0x4a3a15,_0x254a17,_0x19947c);})['then'](function(_0x264feb){if(_0x264feb&&_0x264feb['id']){logger[_0x10e8('0xd')]('Ticket\x20created!');logger[_0x10e8('0xd')](_0x10e8('0x4d'),_0x264feb['id']);logger[_0x10e8('0xd')]('[OUTBOUND]',_0x10e8('0x4e'));emit(util[_0x10e8('0x10')]('user:%s',_0x13ef13['name']),'trigger:browser:url',{'uri':util[_0x10e8('0x10')]('%s/helpdesk/tickets/%d',_0x507b74['remoteUri'],_0x264feb['id'])});}})['catch'](function(_0x33c9d5){logger[_0x10e8('0x5b')](_0x10e8('0x57'),JSON[_0x10e8('0x32')](_0x33c9d5));});};exports['unmanaged']=function(_0x1d556a,_0x4bca20,_0x21d886,_0x4e532c,_0x2f29b6,_0xcdbdfc){var _0x395d69,_0x722963;_0xcdbdfc[_0x10e8('0x1d')]=intUtil[_0x10e8('0x54')](_0xcdbdfc[_0x10e8('0x1d')]);_0xcdbdfc[_0x10e8('0x46')]=intUtil[_0x10e8('0x54')](_0xcdbdfc[_0x10e8('0x46')]);if(_0x2f29b6&&_0x2f29b6['monitor_format']){logger['info']('['+_0x4bca20[_0x10e8('0x5c')][_0x10e8('0x5d')]()+']',_0x10e8('0x5e'));_0x4bca20[_0x10e8('0x4a')]=util['format'](_0x10e8('0x48'),_0xcdbdfc[_0x10e8('0x46')],_0x4bca20[_0x10e8('0x49')],md5(_0x4bca20[_0x10e8('0x49')]));}else{_0x4bca20[_0x10e8('0x4a')]='';}headers[_0x10e8('0x58')]=getAuth(_0xcdbdfc);return getUser(_0xcdbdfc,'')[_0x10e8('0x1f')](function(_0x2662a2){_0x395d69=_0x2662a2;logger[_0x10e8('0xd')](_0x10e8('0x59'),_0x395d69['id']);return getEndUser(_0xcdbdfc,_0x4bca20[_0x10e8('0x12')],_0x4bca20[_0x10e8('0x13')]);})[_0x10e8('0x1f')](function(_0x3f4c7e){_0x722963=_0x3f4c7e;logger['info']('The\x20Enduser\x20ID\x20is:',_0x722963['id']);return getTicket(_0xcdbdfc,_0x395d69,_0x722963,_0x21d886,_0x4bca20);})[_0x10e8('0x1f')](function(_0x16c223){if(_0x16c223){logger[_0x10e8('0xd')]('Ticket\x20created!');logger[_0x10e8('0xd')](_0x10e8('0x4d'),_0x16c223['id']);}})['catch'](function(_0x443e34){logger[_0x10e8('0x5b')]('['+_0x4bca20[_0x10e8('0x5c')][_0x10e8('0x5d')]()+']',JSON['stringify'](_0x443e34));});}; \ 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 be2452e..eba6a90 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 _0x0e4b=['Getting\x20admin\x20information','then','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','Admin\x20selected','userEmail','adminEmail','toUpperCase','/api/lookup?q=','&entities=contact','contacts','catch','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','contactNumber','Contact\x20found\x20work_number:','/api/contacts','format','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','task','ticketId','/contacts/','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','username','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','moment','../../../../config/logger','freshsales','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info'];(function(_0x57eaa0,_0x32aae5){var _0x9d53d2=function(_0x3c6ccd){while(--_0x3c6ccd){_0x57eaa0['push'](_0x57eaa0['shift']());}};_0x9d53d2(++_0x32aae5);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x288b2e,_0x21c3df){_0x288b2e=_0x288b2e-0x0;var _0x373de3=_0x0e4b[_0x288b2e];return _0x373de3;};'use strict';var _=require(_0xb0e4('0x0'));var rp=require(_0xb0e4('0x1'));var md5=require(_0xb0e4('0x2'));var util=require('util');var moment=require(_0xb0e4('0x3'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xb0e4('0x4'))(_0xb0e4('0x5'));config['redis']=_[_0xb0e4('0x6')](config[_0xb0e4('0x7')],{'host':_0xb0e4('0x8'),'port':0x18eb});var io=require(_0xb0e4('0x9'))(new Redis(config[_0xb0e4('0x7')]));function getAdminId(_0x57f45d,_0x5192f0,_0x101860,_0x9d4a99){return new Promise(function(_0x1d6452,_0x23555b){var _0x12a36a=![];var _0x140b7e={'method':_0xb0e4('0xa'),'uri':_0x9d4a99+_0xb0e4('0xb'),'json':!![]};_0x140b7e[_0xb0e4('0xc')]=_0x101860;logger[_0xb0e4('0xd')](_0xb0e4('0xe'));return rp(_0x140b7e)[_0xb0e4('0xf')](function(_0x17ab2e){if(_0x17ab2e){var _0x3fdf0f=_0x17ab2e[_0xb0e4('0x10')];var _0x4c19ee=null;for(_0x4c19ee=0x0;_0x4c19ee<_0x3fdf0f[_0xb0e4('0x11')];_0x4c19ee++){if(_0x3fdf0f[_0x4c19ee][_0xb0e4('0x12')]===_0x57f45d['adminEmail']){_0x57f45d[_0xb0e4('0x13')]=_0x3fdf0f[_0x4c19ee]['id'];_0x12a36a=!![];}}if(_0x12a36a){logger[_0xb0e4('0xd')](_0xb0e4('0x14'),_0x57f45d[_0xb0e4('0x13')]);_0x1d6452(_0x57f45d);}else{_0x23555b({'statusCode':0x194,'message':_0xb0e4('0x15')});}}else{_0x23555b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x17419f){logger[_0xb0e4('0x16')]('['+[_0x5192f0['toUpperCase']()]+']',_0x17419f[_0xb0e4('0x17')]);_0x23555b(_0x17419f);});});}function getUser(_0x376d1f,_0xc12df2,_0xd9cfb6){return function(_0x74c379){return new Promise(function(_0x3355c6,_0x570886){var _0x491a29={'method':'GET','uri':_0xd9cfb6+_0xb0e4('0xb'),'json':!![]};_0x491a29[_0xb0e4('0xc')]=_0xc12df2;logger[_0xb0e4('0xd')](_0xb0e4('0x18'));return rp(_0x491a29)[_0xb0e4('0xf')](function(_0x2f3809){if(_0x2f3809){var _0x54b7ff=_0x2f3809[_0xb0e4('0x10')];var _0x459684=![];var _0x2e8372=null;if(_0x74c379[_0xb0e4('0x19')]!==null){logger['info'](_0xb0e4('0x1a'),_0x74c379[_0xb0e4('0x19')]);_0x74c379['userEmail']=_0x74c379[_0xb0e4('0x19')];for(_0x2e8372=0x0;_0x2e8372<_0x54b7ff[_0xb0e4('0x11')];_0x2e8372++){if(_0x54b7ff[_0x2e8372][_0xb0e4('0x12')]===_0x74c379['agentEmail']){_0x459684=!![];_0x74c379[_0xb0e4('0x1b')]=_0x54b7ff[_0x2e8372]['id'];logger['info']('User\x20found:',_0x74c379[_0xb0e4('0x1b')]);}}}if(!_0x459684){logger[_0xb0e4('0xd')](_0xb0e4('0x1c'));_0x74c379[_0xb0e4('0x1d')]=_0x74c379[_0xb0e4('0x1e')];_0x74c379[_0xb0e4('0x1b')]=_0x74c379[_0xb0e4('0x13')];_0x459684=!![];}if(_0x459684){_0x3355c6(_0x74c379);}else{_0x570886({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x570886({'statusCode':0x194,'message':_0xb0e4('0x15')});}})['catch'](function(_0x45de79){logger[_0xb0e4('0x16')]('['+[_0x376d1f[_0xb0e4('0x1f')]()]+']',_0x45de79[_0xb0e4('0x17')]);_0x570886(_0x45de79);});});};}function searchContact(_0x4fc624,_0x1ed356,_0x2ccef1,_0x15d402){return new Promise(function(_0x451008,_0x447f41){var _0x5c0ad0={'method':_0xb0e4('0xa'),'headers':_0x1ed356,'uri':_0x4fc624+_0xb0e4('0x20')+_0x15d402+'&f='+_0x2ccef1+_0xb0e4('0x21'),'json':!![]};rp(_0x5c0ad0)['then'](function(_0x16f13e){var _0x3a08f6=_['find'](_0x16f13e[_0xb0e4('0x22')][_0xb0e4('0x22')],[_0x2ccef1,_0x15d402]);_0x451008(_0x3a08f6);})[_0xb0e4('0x23')](function(_0x2694ea){_0x447f41(_0x2694ea);});});}function getEndUser(_0x1190ea,_0x3313c6,_0x5e8667){return function(_0x30d324){return new Promise(function(_0x57339c,_0x5b3d93){logger[_0xb0e4('0xd')](util['format'](_0xb0e4('0x24'),_0x30d324['contactNumber']));searchContact(_0x5e8667,_0x3313c6,_0xb0e4('0x25'),_0x30d324['contactNumber'])[_0xb0e4('0xf')](function(_0x12f6a6){if(_0x12f6a6){_0x30d324[_0xb0e4('0x26')]=_0x12f6a6['id'];logger['info'](_0xb0e4('0x27'),_0x30d324['endUserId']);return _0x57339c(_0x30d324);}searchContact(_0x5e8667,_0x3313c6,_0xb0e4('0x28'),_0x30d324[_0xb0e4('0x29')])[_0xb0e4('0xf')](function(_0x129aec){if(_0x129aec){_0x30d324[_0xb0e4('0x26')]=_0x129aec['id'];logger['info'](_0xb0e4('0x2a'),_0x30d324['endUserId']);return _0x57339c(_0x30d324);}createEndUser(_0x30d324,_0x1190ea,_0x3313c6,_0x5e8667)[_0xb0e4('0xf')](function(_0x434630){logger[_0xb0e4('0xd')]('Contact\x20created:',_0x434630[_0xb0e4('0x26')]);return _0x57339c(_0x434630);});});})[_0xb0e4('0x23')](function(_0x4708ce){_0x5b3d93(_0x4708ce);});});};}function createEndUser(_0x739afb,_0x4fec45,_0x4b6f58,_0x4af7f6){return new Promise(function(_0x4dffd8,_0x16812e){var _0x4b924d=moment();var _0x3beb07={'method':'POST','uri':_0x4af7f6+_0xb0e4('0x2b'),'body':{'contact':{'last_name':_0x739afb['contactNumber'],'work_number':_0x739afb[_0xb0e4('0x29')],'mobile_number':_0x739afb[_0xb0e4('0x29')],'owner_id':_0x739afb[_0xb0e4('0x1b')],'created_at':_0x4b924d[_0xb0e4('0x2c')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x3beb07[_0xb0e4('0xc')]=_0x4b6f58;logger[_0xb0e4('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x3beb07)[_0xb0e4('0xf')](function(_0x498f09){_0x739afb[_0xb0e4('0x26')]=_0x498f09[_0xb0e4('0x2d')]['id'];_0x4dffd8(_0x739afb);})['catch'](function(_0x43f7e0){logger['error']('['+[_0x4fec45['toUpperCase']()]+']',_0x43f7e0['message']);_0x16812e(_0x43f7e0[_0xb0e4('0x17')]);});});}function getTicket(_0x3fbde8,_0x5d2d60,_0x850813,_0x5eb2f4,_0x3a26ec){return function(_0x10dbdc){logger[_0xb0e4('0xd')](_0xb0e4('0x2e'));return new Promise(function(_0x4b1975,_0x610856){var _0x3f9752=moment();var _0x1a524b={'method':_0xb0e4('0x2f'),'uri':_0x850813+_0xb0e4('0x30'),'body':{'title':intUtil[_0xb0e4('0x31')](_0x5eb2f4[_0xb0e4('0x32')],_0x3a26ec,'\x20'),'description':intUtil[_0xb0e4('0x31')](_0x5eb2f4[_0xb0e4('0x33')],_0x3a26ec,'\x0a'),'owner_id':_0x10dbdc[_0xb0e4('0x1b')],'creater_id':_0x10dbdc[_0xb0e4('0x13')],'targetable_id':_0x10dbdc[_0xb0e4('0x26')],'targetable_type':_0xb0e4('0x34'),'created_at':_0x3f9752[_0xb0e4('0x2c')](_0xb0e4('0x35')),'due_date':_0x3f9752[_0xb0e4('0x36')](0x1e,'m')['format'](_0xb0e4('0x35'))},'json':!![]};_0x1a524b[_0xb0e4('0xc')]=_0x5d2d60;return rp(_0x1a524b)[_0xb0e4('0xf')](function(_0x39bfcc){_0x10dbdc['ticketId']=_0x39bfcc[_0xb0e4('0x37')]['id'];logger[_0xb0e4('0xd')]('Task\x20created:',_0x10dbdc[_0xb0e4('0x38')]);_0x4b1975(_0x10dbdc);})[_0xb0e4('0x23')](function(_0x47107e){logger[_0xb0e4('0x16')]('['+[_0x3fbde8['toUpperCase']()]+']',_0x47107e[_0xb0e4('0x17')]);_0x610856(_0x47107e[_0xb0e4('0x17')]);});});};}function emit(_0x3c30e8,_0x1b1838,_0x78b898){var _0x2ffb16={'uri':_0x3c30e8+_0xb0e4('0x39')+_0x78b898};io['to'](util[_0xb0e4('0x2c')](_0xb0e4('0x3a'),_0x1b1838))[_0xb0e4('0x3b')](_0xb0e4('0x3c'),_0x2ffb16);}exports['cs']=function(_0x5b04a4,_0x24128c,_0x37fb23,_0x49346d,_0x59415e,_0x50450e,_0x30e475,_0x335b20){var _0x4c2036={};var _0x484d19={'Authorization':'Token\x20token='+_0x50450e['apiKey']};_0x50450e['remoteUri']=intUtil['stripTrailingSlash'](_0x50450e[_0xb0e4('0x3d')]);_0x50450e['serverUrl']=intUtil[_0xb0e4('0x3e')](_0x50450e[_0xb0e4('0x3f')]);var _0x463709=_0x50450e[_0xb0e4('0x3d')];_0x4c2036['adminEmail']=_0x50450e[_0xb0e4('0x40')];_0x4c2036[_0xb0e4('0x29')]=_0x335b20['toLowerCase']()===_0xb0e4('0x41')?_0x24128c['destcalleridnum']:_0x24128c[_0xb0e4('0x42')];_0x4c2036[_0xb0e4('0x43')]=_0x335b20===_0xb0e4('0x44')||_0x335b20===_0xb0e4('0x45')?'queue':_0xb0e4('0x41');if(_0x49346d){_0x4c2036[_0xb0e4('0x19')]=_0x49346d[_0xb0e4('0x12')];}var _0x235b8c=util['format'](_0xb0e4('0x46'),_0x50450e[_0xb0e4('0x3f')],_0x24128c[_0xb0e4('0x47')],md5(_0x24128c['uniqueid']));if(_0x59415e&&_0x59415e['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x24128c[_0xb0e4('0x48')]=_0x235b8c;}else if(_0x30e475&&_0x30e475['recordingFormat']&&_0x30e475[_0xb0e4('0x49')]!==_0xb0e4('0x4a')){logger[_0xb0e4('0xd')](_0xb0e4('0x4b'),'Recording\x20is\x20enabled!');_0x24128c[_0xb0e4('0x48')]=_0x235b8c;}else{_0x24128c[_0xb0e4('0x48')]='';}return getAdminId(_0x4c2036,_0x335b20,_0x484d19,_0x463709)['then'](getUser(_0x335b20,_0x484d19,_0x463709))[_0xb0e4('0xf')](getEndUser(_0x335b20,_0x484d19,_0x463709))['then'](getTicket(_0x335b20,_0x484d19,_0x463709,_0x37fb23,_0x24128c))[_0xb0e4('0xf')](function(_0x581366){logger[_0xb0e4('0xd')](util['format'](_0xb0e4('0x4c'),_0x581366[_0xb0e4('0x38')]));if(_0x335b20!=='unmanaged'){logger[_0xb0e4('0xd')]('['+[_0x335b20[_0xb0e4('0x1f')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x463709,_0x49346d['name'],_0x581366[_0xb0e4('0x26')]);}})[_0xb0e4('0x23')](function(_0x2aefeb){logger['error']('['+[_0x335b20[_0xb0e4('0x1f')]()]+_0xb0e4('0x4d'),util['inspect'](_0x2aefeb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8ca9=['adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','User\x20found:','userId','Admin\x20selected','userEmail','catch','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','POST','Subjects','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','calleridnum','callDirection','queue','unmanaged','outbound','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/logger','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail'];(function(_0x5e91ff,_0x4db464){var _0x1ce6b6=function(_0x8fdd29){while(--_0x8fdd29){_0x5e91ff['push'](_0x5e91ff['shift']());}};_0x1ce6b6(++_0x4db464);}(_0x8ca9,0x9c));var _0x98ca=function(_0x54f1dd,_0x43f45a){_0x54f1dd=_0x54f1dd-0x0;var _0x460649=_0x8ca9[_0x54f1dd];return _0x460649;};'use strict';var _=require(_0x98ca('0x0'));var rp=require(_0x98ca('0x1'));var md5=require(_0x98ca('0x2'));var util=require(_0x98ca('0x3'));var moment=require(_0x98ca('0x4'));var Promise=require(_0x98ca('0x5'));var Redis=require(_0x98ca('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x98ca('0x7'))('freshsales');config[_0x98ca('0x8')]=_['defaults'](config[_0x98ca('0x8')],{'host':_0x98ca('0x9'),'port':0x18eb});var io=require(_0x98ca('0xa'))(new Redis(config[_0x98ca('0x8')]));function getAdminId(_0x323c95,_0x28a37a,_0x162bd0,_0x210234){return new Promise(function(_0x277c29,_0x404cc1){var _0x572858=![];var _0x2074fb={'method':_0x98ca('0xb'),'uri':_0x210234+_0x98ca('0xc'),'json':!![]};_0x2074fb[_0x98ca('0xd')]=_0x162bd0;logger[_0x98ca('0xe')](_0x98ca('0xf'));return rp(_0x2074fb)[_0x98ca('0x10')](function(_0x496b46){if(_0x496b46){var _0x16221a=_0x496b46[_0x98ca('0x11')];var _0xba3887=null;for(_0xba3887=0x0;_0xba3887<_0x16221a[_0x98ca('0x12')];_0xba3887++){if(_0x16221a[_0xba3887]['email']===_0x323c95[_0x98ca('0x13')]){_0x323c95[_0x98ca('0x14')]=_0x16221a[_0xba3887]['id'];_0x572858=!![];}}if(_0x572858){logger[_0x98ca('0xe')](_0x98ca('0x15'),_0x323c95[_0x98ca('0x14')]);_0x277c29(_0x323c95);}else{_0x404cc1({'statusCode':0x194,'message':_0x98ca('0x16')});}}else{_0x404cc1({'statusCode':0x194,'message':_0x98ca('0x16')});}})['catch'](function(_0x330713){logger[_0x98ca('0x17')]('['+[_0x28a37a[_0x98ca('0x18')]()]+']',_0x330713[_0x98ca('0x19')]);_0x404cc1(_0x330713);});});}function getUser(_0x52e9c8,_0x238c1a,_0x3c2f65){return function(_0xe9f8ad){return new Promise(function(_0x1ce43a,_0x4523bb){var _0x3ca209={'method':_0x98ca('0xb'),'uri':_0x3c2f65+_0x98ca('0xc'),'json':!![]};_0x3ca209[_0x98ca('0xd')]=_0x238c1a;logger[_0x98ca('0xe')](_0x98ca('0x1a'));return rp(_0x3ca209)['then'](function(_0x626b37){if(_0x626b37){var _0x49298d=_0x626b37[_0x98ca('0x11')];var _0x2fe568=![];var _0x50f8b4=null;if(_0xe9f8ad['agentEmail']!==null){logger[_0x98ca('0xe')](_0x98ca('0x1b'),_0xe9f8ad[_0x98ca('0x1c')]);_0xe9f8ad['userEmail']=_0xe9f8ad[_0x98ca('0x1c')];for(_0x50f8b4=0x0;_0x50f8b4<_0x49298d[_0x98ca('0x12')];_0x50f8b4++){if(_0x49298d[_0x50f8b4]['email']===_0xe9f8ad[_0x98ca('0x1c')]){_0x2fe568=!![];_0xe9f8ad['userId']=_0x49298d[_0x50f8b4]['id'];logger[_0x98ca('0xe')](_0x98ca('0x1d'),_0xe9f8ad[_0x98ca('0x1e')]);}}}if(!_0x2fe568){logger[_0x98ca('0xe')](_0x98ca('0x1f'));_0xe9f8ad[_0x98ca('0x20')]=_0xe9f8ad[_0x98ca('0x13')];_0xe9f8ad['userId']=_0xe9f8ad[_0x98ca('0x14')];_0x2fe568=!![];}if(_0x2fe568){_0x1ce43a(_0xe9f8ad);}else{_0x4523bb({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4523bb({'statusCode':0x194,'message':_0x98ca('0x16')});}})[_0x98ca('0x21')](function(_0x5eb829){logger[_0x98ca('0x17')]('['+[_0x52e9c8['toUpperCase']()]+']',_0x5eb829[_0x98ca('0x19')]);_0x4523bb(_0x5eb829);});});};}function searchContact(_0x4f48db,_0x5bf77d,_0x14bfb4,_0x540f45){return new Promise(function(_0x342a83,_0x35b920){var _0x13f766={'method':_0x98ca('0xb'),'headers':_0x5bf77d,'uri':_0x4f48db+_0x98ca('0x22')+_0x540f45+_0x98ca('0x23')+_0x14bfb4+_0x98ca('0x24'),'json':!![]};rp(_0x13f766)[_0x98ca('0x10')](function(_0x447881){var _0x4f2406=_[_0x98ca('0x25')](_0x447881['contacts'][_0x98ca('0x26')],[_0x14bfb4,_0x540f45]);_0x342a83(_0x4f2406);})[_0x98ca('0x21')](function(_0x4d43fd){_0x35b920(_0x4d43fd);});});}function getEndUser(_0x4aaa89,_0x5adf7d,_0x4b37b4){return function(_0x3990d7){return new Promise(function(_0x4f1622,_0x2aaf39){logger['info'](util[_0x98ca('0x27')](_0x98ca('0x28'),_0x3990d7['contactNumber']));searchContact(_0x4b37b4,_0x5adf7d,_0x98ca('0x29'),_0x3990d7[_0x98ca('0x2a')])['then'](function(_0x356cf5){if(_0x356cf5){_0x3990d7[_0x98ca('0x2b')]=_0x356cf5['id'];logger['info'](_0x98ca('0x2c'),_0x3990d7[_0x98ca('0x2b')]);return _0x4f1622(_0x3990d7);}searchContact(_0x4b37b4,_0x5adf7d,_0x98ca('0x2d'),_0x3990d7[_0x98ca('0x2a')])[_0x98ca('0x10')](function(_0x47b1c1){if(_0x47b1c1){_0x3990d7[_0x98ca('0x2b')]=_0x47b1c1['id'];logger[_0x98ca('0xe')]('Contact\x20found\x20work_number:',_0x3990d7[_0x98ca('0x2b')]);return _0x4f1622(_0x3990d7);}createEndUser(_0x3990d7,_0x4aaa89,_0x5adf7d,_0x4b37b4)[_0x98ca('0x10')](function(_0x2d5012){logger['info'](_0x98ca('0x2e'),_0x2d5012[_0x98ca('0x2b')]);return _0x4f1622(_0x2d5012);});});})[_0x98ca('0x21')](function(_0x4c354b){_0x2aaf39(_0x4c354b);});});};}function createEndUser(_0x3a7515,_0x1910ae,_0x10cbe0,_0x48be6c){return new Promise(function(_0x4d7329,_0x167a3e){var _0xe77d02=moment();var _0x3b13f9={'method':'POST','uri':_0x48be6c+_0x98ca('0x2f'),'body':{'contact':{'last_name':_0x3a7515[_0x98ca('0x2a')],'work_number':_0x3a7515[_0x98ca('0x2a')],'mobile_number':_0x3a7515['contactNumber'],'owner_id':_0x3a7515[_0x98ca('0x1e')],'created_at':_0xe77d02[_0x98ca('0x27')](_0x98ca('0x30'))}},'json':!![]};_0x3b13f9[_0x98ca('0xd')]=_0x10cbe0;logger[_0x98ca('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x3b13f9)['then'](function(_0x4b811b){_0x3a7515[_0x98ca('0x2b')]=_0x4b811b[_0x98ca('0x31')]['id'];_0x4d7329(_0x3a7515);})[_0x98ca('0x21')](function(_0x1e3d4b){logger[_0x98ca('0x17')]('['+[_0x1910ae[_0x98ca('0x18')]()]+']',_0x1e3d4b[_0x98ca('0x19')]);_0x167a3e(_0x1e3d4b['message']);});});}function getTicket(_0x4900ed,_0x1782e0,_0x24e1cf,_0x31424f,_0x382989){return function(_0x17fdc7){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x5c0d50,_0x4e71a7){var _0x16a6d0=moment();var _0x914606={'method':_0x98ca('0x32'),'uri':_0x24e1cf+'/api/tasks','body':{'title':intUtil['getString'](_0x31424f[_0x98ca('0x33')],_0x382989,'\x20'),'description':intUtil[_0x98ca('0x34')](_0x31424f[_0x98ca('0x35')],_0x382989,'\x0a'),'owner_id':_0x17fdc7[_0x98ca('0x1e')],'creater_id':_0x17fdc7[_0x98ca('0x14')],'targetable_id':_0x17fdc7[_0x98ca('0x2b')],'targetable_type':_0x98ca('0x36'),'created_at':_0x16a6d0[_0x98ca('0x27')](_0x98ca('0x30')),'due_date':_0x16a6d0[_0x98ca('0x37')](0x1e,'m')[_0x98ca('0x27')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x914606[_0x98ca('0xd')]=_0x1782e0;return rp(_0x914606)[_0x98ca('0x10')](function(_0x46cb63){_0x17fdc7[_0x98ca('0x38')]=_0x46cb63[_0x98ca('0x39')]['id'];logger[_0x98ca('0xe')](_0x98ca('0x3a'),_0x17fdc7[_0x98ca('0x38')]);_0x5c0d50(_0x17fdc7);})[_0x98ca('0x21')](function(_0x50c459){logger[_0x98ca('0x17')]('['+[_0x4900ed[_0x98ca('0x18')]()]+']',_0x50c459['message']);_0x4e71a7(_0x50c459[_0x98ca('0x19')]);});});};}function emit(_0x4f2444,_0x3946b3,_0x39f4fd){var _0x6a9045={'uri':_0x4f2444+_0x98ca('0x3b')+_0x39f4fd};io['to'](util[_0x98ca('0x27')](_0x98ca('0x3c'),_0x3946b3))[_0x98ca('0x3d')](_0x98ca('0x3e'),_0x6a9045);}exports['cs']=function(_0x2c7d53,_0x42a53d,_0x15971f,_0xece1d7,_0x5c77e1,_0x51bb5a,_0x1fa4f8,_0x40498f){var _0x19dc39={};var _0x4d5bf0={'Authorization':_0x98ca('0x3f')+_0x51bb5a[_0x98ca('0x40')]};_0x51bb5a[_0x98ca('0x41')]=intUtil[_0x98ca('0x42')](_0x51bb5a[_0x98ca('0x41')]);_0x51bb5a[_0x98ca('0x43')]=intUtil[_0x98ca('0x42')](_0x51bb5a['serverUrl']);var _0x5d1b20=_0x51bb5a['remoteUri'];_0x19dc39[_0x98ca('0x13')]=_0x51bb5a[_0x98ca('0x44')];_0x19dc39[_0x98ca('0x2a')]=_0x40498f[_0x98ca('0x45')]()==='outbound'?_0x42a53d['destcalleridnum']:_0x42a53d[_0x98ca('0x46')];_0x19dc39[_0x98ca('0x47')]=_0x40498f===_0x98ca('0x48')||_0x40498f===_0x98ca('0x49')?_0x98ca('0x48'):_0x98ca('0x4a');if(_0xece1d7){_0x19dc39[_0x98ca('0x1c')]=_0xece1d7[_0x98ca('0x4b')];}var _0x10a31a=util[_0x98ca('0x27')](_0x98ca('0x4c'),_0x51bb5a[_0x98ca('0x43')],_0x42a53d[_0x98ca('0x4d')],md5(_0x42a53d['uniqueid']));if(_0x5c77e1&&_0x5c77e1[_0x98ca('0x4e')]){logger['info'](_0x98ca('0x4f'),_0x98ca('0x50'));_0x42a53d[_0x98ca('0x51')]=_0x10a31a;}else if(_0x1fa4f8&&_0x1fa4f8[_0x98ca('0x52')]&&_0x1fa4f8[_0x98ca('0x52')]!=='none'){logger[_0x98ca('0xe')](_0x98ca('0x53'),'Recording\x20is\x20enabled!');_0x42a53d[_0x98ca('0x51')]=_0x10a31a;}else{_0x42a53d[_0x98ca('0x51')]='';}return getAdminId(_0x19dc39,_0x40498f,_0x4d5bf0,_0x5d1b20)[_0x98ca('0x10')](getUser(_0x40498f,_0x4d5bf0,_0x5d1b20))['then'](getEndUser(_0x40498f,_0x4d5bf0,_0x5d1b20))[_0x98ca('0x10')](getTicket(_0x40498f,_0x4d5bf0,_0x5d1b20,_0x15971f,_0x42a53d))[_0x98ca('0x10')](function(_0x55af07){logger[_0x98ca('0xe')](util[_0x98ca('0x27')](_0x98ca('0x54'),_0x55af07[_0x98ca('0x38')]));if(_0x40498f!==_0x98ca('0x49')){logger[_0x98ca('0xe')]('['+[_0x40498f[_0x98ca('0x18')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x5d1b20,_0xece1d7[_0x98ca('0x55')],_0x55af07[_0x98ca('0x2b')]);}})[_0x98ca('0x21')](function(_0x47d650){logger['error']('['+[_0x40498f[_0x98ca('0x18')]()]+_0x98ca('0x56'),util[_0x98ca('0x57')](_0x47d650,{'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 478ea1b..7ff369e 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 _0x4213=['data2','find','data3','queue','routeId','log','unmanaged','sugarcrm','freshsales','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','servicenow','includes','data1','toLowerCase'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4213,0x77));var _0x3421=function(_0x493088,_0x19bbee){_0x493088=_0x493088-0x0;var _0x377751=_0x4213[_0x493088];return _0x377751;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var zendesk=require(_0x3421('0x2'));var salesforce=require(_0x3421('0x3'));var sugarcrm=require(_0x3421('0x4'));var freshdesk=require(_0x3421('0x5'));var zoho=require(_0x3421('0x6'));var desk=require('./desk');var vtiger=require(_0x3421('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0x3421('0x8'));var freshsales=require(_0x3421('0x9'));var integrations=[_0x3421('0xa'),_0x3421('0xb'),'sugarcrm',_0x3421('0xc'),_0x3421('0xd'),_0x3421('0xe'),_0x3421('0xf'),_0x3421('0x10'),'freshsales',_0x3421('0x11')];exports['exec']=function(_0x4ff986,_0x12eee0,_0x4b9d24,_0x2d8676,_0x3c1c44,_0x113554){if(_0x4b9d24){if(_[_0x3421('0x12')](integrations,_0x4ff986[_0x3421('0x13')][_0x3421('0x14')]())){try{var _0xf9cb85=null;var _0x59eaf1='';var _0x26d459=_0x4b9d24[_0x4ff986[_0x3421('0x13')][_0x3421('0x14')]()];if(_0x26d459){var _0x15eef0=_0x26d459[_0x4ff986[_0x3421('0x15')]];if(_0x15eef0){var _0x3f4672=_[_0x3421('0x16')](_0x15eef0['Configurations'],{'id':parseInt(_0x4ff986[_0x3421('0x17')],0xa)});if(_0x3f4672){if(_0x2d8676){if(_0x3c1c44&&_0x12eee0['queue']){_0x59eaf1=_0x3421('0x18');}else if(_0x12eee0[_0x3421('0x19')]){_0x59eaf1='outbound';}else{console[_0x3421('0x1a')]('EVENT\x20UNKNOWN',_0x12eee0);}}else{_0x59eaf1=_0x3421('0x1b');}switch(_0x4ff986[_0x3421('0x13')]['toLowerCase']()){case _0x3421('0xa'):zendesk[_0x59eaf1](_0x4ff986,_0x12eee0,_0x3f4672,_0x2d8676,_0x3c1c44,_0x15eef0,_0x113554);break;case _0x3421('0xb'):salesforce[_0x59eaf1](_0x4ff986,_0x12eee0,_0x3f4672,_0x2d8676,_0x3c1c44,_0x15eef0,_0x113554);break;case _0x3421('0x1c'):sugarcrm[_0x59eaf1](_0x4ff986,_0x12eee0,_0x3f4672,_0x2d8676,_0x3c1c44,_0x15eef0,_0x113554);break;case _0x3421('0xc'):freshdesk[_0x59eaf1](_0x4ff986,_0x12eee0,_0x3f4672,_0x2d8676,_0x3c1c44,_0x15eef0,_0x113554);break;case _0x3421('0xd'):zoho[_0x59eaf1](_0x4ff986,_0x12eee0,_0x3f4672,_0x2d8676,_0x3c1c44,_0x15eef0,_0x113554);break;case _0x3421('0xe'):desk[_0x59eaf1](_0x4ff986,_0x12eee0,_0x3f4672,_0x2d8676,_0x3c1c44,_0x15eef0,_0x113554);break;case _0x3421('0xf'):vtiger[_0x59eaf1](_0x4ff986,_0x12eee0,_0x3f4672,_0x2d8676,_0x3c1c44,_0x15eef0,_0x113554);break;case _0x3421('0x1d'):freshsales['cs'](_0x4ff986,_0x12eee0,_0x3f4672,_0x2d8676,_0x3c1c44,_0x15eef0,_0x113554,_0x59eaf1);break;case _0x3421('0x11'):servicenow['cs'](_0x4ff986,_0x12eee0,_0x3f4672,_0x2d8676,_0x3c1c44,_0x15eef0,_0x113554,_0x59eaf1);break;case _0x3421('0x10'):dynamics365['cs'](_0x4ff986,_0x12eee0,_0x3f4672,_0x2d8676,_0x3c1c44,_0x15eef0,_0x113554,_0x59eaf1);break;default:console[_0x3421('0x1a')]('unknown\x20integration');}}else{_0xf9cb85=require(_0x3421('0x1e'))(_0x4ff986['data1']['toLowerCase']());_0xf9cb85['error'](_0x3421('0x1f'),util[_0x3421('0x20')](_0x3421('0x21'),_0x4ff986[_0x3421('0x13')][_0x3421('0x14')](),_0x4ff986[_0x3421('0x17')]));}}else{_0xf9cb85=require(_0x3421('0x1e'))(_0x4ff986[_0x3421('0x13')][_0x3421('0x14')]());_0xf9cb85[_0x3421('0x22')]('[EXEC]',util['format']('%s\x20account\x20#%s\x20not\x20found',_0x4ff986[_0x3421('0x13')][_0x3421('0x14')](),_0x4ff986[_0x3421('0x15')]));}}else{}}catch(_0x5bc28a){console['error'](_0x5bc28a);}}}}; \ No newline at end of file +var _0xda3f=['outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','sugarcrm','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','data2','util','./zendesk','./zoho','./vtiger','./servicenow','./freshsales','zendesk','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','Configurations','data3'];(function(_0x28baf4,_0x2a52f8){var _0x2931dd=function(_0x25c942){while(--_0x25c942){_0x28baf4['push'](_0x28baf4['shift']());}};_0x2931dd(++_0x2a52f8);}(_0xda3f,0xec));var _0xfda3=function(_0x32a65e,_0x2d72d8){_0x32a65e=_0x32a65e-0x0;var _0xf6902f=_0xda3f[_0x32a65e];return _0xf6902f;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var zendesk=require(_0xfda3('0x1'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0xfda3('0x2'));var desk=require('./desk');var vtiger=require(_0xfda3('0x3'));var servicenow=require(_0xfda3('0x4'));var dynamics365=require('./dynamics365');var freshsales=require(_0xfda3('0x5'));var integrations=[_0xfda3('0x6'),'salesforce','sugarcrm',_0xfda3('0x7'),_0xfda3('0x8'),_0xfda3('0x9'),_0xfda3('0xa'),_0xfda3('0xb'),_0xfda3('0xc'),_0xfda3('0xd')];exports[_0xfda3('0xe')]=function(_0xdc5b45,_0x14d549,_0x102643,_0x4713ba,_0x4d7841,_0xe933f5){if(_0x102643){if(_[_0xfda3('0xf')](integrations,_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')]())){try{var _0x1443f4=null;var _0x4b77ea='';var _0x583125=_0x102643[_0xdc5b45['data1'][_0xfda3('0x11')]()];if(_0x583125){var _0x1e7a55=_0x583125[_0xdc5b45['data2']];if(_0x1e7a55){var _0x501588=_['find'](_0x1e7a55[_0xfda3('0x12')],{'id':parseInt(_0xdc5b45[_0xfda3('0x13')],0xa)});if(_0x501588){if(_0x4713ba){if(_0x4d7841&&_0x14d549['queue']){_0x4b77ea='queue';}else if(_0x14d549['routeId']){_0x4b77ea=_0xfda3('0x14');}else{console[_0xfda3('0x15')](_0xfda3('0x16'),_0x14d549);}}else{_0x4b77ea=_0xfda3('0x17');}switch(_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')]()){case _0xfda3('0x6'):zendesk[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x18'):salesforce[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x19'):sugarcrm[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x7'):freshdesk[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case'zoho':zoho[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x9'):desk[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0xa'):vtiger[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0xc'):freshsales['cs'](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5,_0x4b77ea);break;case _0xfda3('0xd'):servicenow['cs'](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5,_0x4b77ea);break;case'dynamics365':dynamics365['cs'](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5,_0x4b77ea);break;default:console[_0xfda3('0x15')](_0xfda3('0x1a'));}}else{_0x1443f4=require(_0xfda3('0x1b'))(_0xdc5b45['data1']['toLowerCase']());_0x1443f4[_0xfda3('0x1c')](_0xfda3('0x1d'),util[_0xfda3('0x1e')]('%s\x20configuration\x20#%s\x20not\x20found',_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')](),_0xdc5b45[_0xfda3('0x13')]));}}else{_0x1443f4=require(_0xfda3('0x1b'))(_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')]());_0x1443f4[_0xfda3('0x1c')](_0xfda3('0x1d'),util[_0xfda3('0x1e')]('%s\x20account\x20#%s\x20not\x20found',_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')](),_0xdc5b45[_0xfda3('0x1f')]));}}else{}}catch(_0x4ae9b9){console[_0xfda3('0x1c')](_0x4ae9b9);}}}}; \ 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 c13172a..4a7f48a 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 _0x487a=['monitor_format','lastevent','toUpperCase','Fields',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','emit','assign','getString','Subjects','Descriptions','Task','endUserType','contact','WhoId','ticketType','Case','account','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','execute','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','Variable','name','password','concat','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged'];(function(_0x821ce1,_0x11ac26){var _0x331a4a=function(_0x21aec4){while(--_0x21aec4){_0x821ce1['push'](_0x821ce1['shift']());}};_0x331a4a(++_0x11ac26);}(_0x487a,0x105));var _0xa487=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x487a[_0x4394b6];return _0x360244;};'use strict';var _=require(_0xa487('0x0'));var rp=require(_0xa487('0x1'));var moment=require(_0xa487('0x2'));var BPromise=require(_0xa487('0x3'));var md5=require(_0xa487('0x4'));var jsforce=require(_0xa487('0x5'));var util=require(_0xa487('0x6'));var Redis=require('ioredis');var intUtil=require(_0xa487('0x7'));var config=require(_0xa487('0x8'));var logger=require(_0xa487('0x9'))('salesforce');config['redis']=_[_0xa487('0xa')](config[_0xa487('0xb')],{'host':_0xa487('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa487('0xb')]));function emit(_0x4bb4cf,_0x2beeda,_0x3b7528){io['to'](_0x4bb4cf)[_0xa487('0xd')](_0x2beeda,_0x3b7528);}function getTicket(_0x5ab5ab,_0xfbee8d,_0x16887c,_0x295a9b,_0x343cc5,_0x327e19,_0x138d5c,_0x106a83){var _0x578ab3=Object[_0xa487('0xe')]({},{'OwnerId':_0xfbee8d['id'],'Subject':intUtil[_0xa487('0xf')](_0x295a9b[_0xa487('0x10')],_0x343cc5,'\x20'),'Description':intUtil[_0xa487('0xf')](_0x295a9b[_0xa487('0x11')],_0x343cc5,'\x0a')},getCustomFields(_0x327e19,_0x343cc5));if(_0x16887c){if(_0x295a9b['ticketType']===_0xa487('0x12')){_0x578ab3['ActivityDate']=moment['utc']();_0x578ab3['IsReminderSet']=![];_0x578ab3['IsRecurrence']=![];if(_0x16887c[_0xa487('0x13')]===_0xa487('0x14')||_0x16887c[_0xa487('0x13')]==='lead'){_0x578ab3[_0xa487('0x15')]=_0x16887c['id'];}else if(_0x16887c[_0xa487('0x13')]==='account'){_0x578ab3['WhatId']=_0x16887c['id'];}}else if(_0x295a9b[_0xa487('0x16')]===_0xa487('0x17')){if(_0x16887c[_0xa487('0x13')]===_0xa487('0x14')){_0x578ab3['ContactId']=_0x16887c['id'];}else if(_0x16887c['endUserType']===_0xa487('0x18')){_0x578ab3['AccountId']=_0x16887c['id'];}else if(_0x16887c['endUserType']==='lead'&&_0x295a9b[_0xa487('0x19')]){_0x578ab3[_0x295a9b[_0xa487('0x19')]]=_0x16887c['id'];}else{logger[_0xa487('0x1a')](_0xa487('0x1b'));}}}return _0x138d5c[_0xa487('0x1c')](_0x295a9b[_0xa487('0x16')])[_0xa487('0x1d')](_0x578ab3);}function getUser(_0x5c18bd,_0x4cf94b,_0x33e412){if(!_[_0xa487('0x1e')](_0x4cf94b)&&intUtil[_0xa487('0x1f')](_0x4cf94b)){var _0x48ec7e={'Email':_0x4cf94b};var _0x361536={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x33e412['sobject'](_0xa487('0x20'))[_0xa487('0x21')](_0x48ec7e,_0x361536)['execute']()[_0xa487('0x22')](function(_0x2fdd13){if(_0x2fdd13[_0xa487('0x23')]){var _0x39d729=_['find'](_0x2fdd13,function(_0xa99dfe){return _0xa99dfe[_0xa487('0x24')]===_0x4cf94b;});if(_0x39d729){logger[_0xa487('0x1a')](_0xa487('0x25'),_0x4cf94b);return BPromise[_0xa487('0x26')]({'id':_0x39d729['Id'],'name':_0x39d729[_0xa487('0x27')]});}}else{logger[_0xa487('0x1a')](_0xa487('0x28'),_0x4cf94b);return _0x33e412[_0xa487('0x29')]()[_0xa487('0x22')](function(_0x2bcb9d){return BPromise[_0xa487('0x26')]({'id':_0x2bcb9d[_0xa487('0x2a')],'name':_0x2bcb9d[_0xa487('0x2b')]});});}});}else{logger[_0xa487('0x1a')](_0xa487('0x28'),_0x4cf94b);return _0x33e412[_0xa487('0x29')]()['then'](function(_0x5040cc){return BPromise[_0xa487('0x26')]({'id':_0x5040cc['user_id'],'name':_0x5040cc[_0xa487('0x2b')]});});}}function getEndUser(_0x52d77c,_0x5f0a8c,_0xd0d901,_0x4e368f,_0x37a9e9){var _0x26f34d={'$or':{'Phone':_0x4e368f}};var _0x11b9b7={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xa487('0x26')]()['then'](function(){logger[_0xa487('0x1a')](_0xa487('0x2c'),_0x4e368f,_0x5f0a8c['moduleSearch']);switch(_0x5f0a8c[_0xa487('0x2d')]){case'contact_lead':var _0x230b61=_[_0xa487('0x2e')](_0x26f34d);if(_0x5f0a8c[_0xa487('0x2f')]){var _0x1e40a9={};_0x1e40a9[_0x5f0a8c['additionalSearchContact']]=_0x4e368f;_[_0xa487('0x30')](_0x230b61['$or'],_0x1e40a9);}return _0x37a9e9[_0xa487('0x1c')]('Contact')[_0xa487('0x21')](_0x230b61,_0x11b9b7)[_0xa487('0x31')]()[_0xa487('0x22')](function(_0x5ce88d){if(_0x5ce88d&&_0x5ce88d['length']){return _0x5ce88d;}else{var _0x189410=_[_0xa487('0x2e')](_0x26f34d);if(_0x5f0a8c[_0xa487('0x32')]){var _0x52b513={};_0x52b513[_0x5f0a8c[_0xa487('0x32')]]=_0x4e368f;_[_0xa487('0x30')](_0x189410[_0xa487('0x33')],_0x52b513);}return _0x37a9e9[_0xa487('0x1c')](_0xa487('0x34'))[_0xa487('0x21')](_0x189410,_0x11b9b7);}});case _0xa487('0x35'):var _0x53561f=_[_0xa487('0x2e')](_0x26f34d);if(_0x5f0a8c[_0xa487('0x36')]){var _0x1e40a9={};_0x1e40a9[_0x5f0a8c[_0xa487('0x36')]]=_0x4e368f;_['merge'](_0x53561f[_0xa487('0x33')],_0x1e40a9);}return _0x37a9e9[_0xa487('0x1c')](_0xa487('0x37'))['find'](_0x53561f,_0x11b9b7)[_0xa487('0x31')]()[_0xa487('0x22')](function(_0x58bc26){if(_0x58bc26&&_0x58bc26[_0xa487('0x23')]){return _0x58bc26;}else{var _0xffae0a=_[_0xa487('0x2e')](_0x26f34d);if(_0x5f0a8c[_0xa487('0x2f')]){var _0x532c2b={};_0x532c2b[_0x5f0a8c[_0xa487('0x2f')]]=_0x4e368f;_[_0xa487('0x30')](_0xffae0a[_0xa487('0x33')],_0x532c2b);}return _0x37a9e9[_0xa487('0x1c')]('Contact')[_0xa487('0x21')](_0xffae0a,_0x11b9b7)[_0xa487('0x22')](function(_0xcc3c17){if(_0xcc3c17&&_0xcc3c17[_0xa487('0x23')]){return _0xcc3c17;}else{var _0xb6b5c5=_[_0xa487('0x2e')](_0x26f34d);if(_0x5f0a8c['additionalSearchLead']){var _0xbf1f6d={};_0xbf1f6d[_0x5f0a8c[_0xa487('0x32')]]=_0x4e368f;_['merge'](_0xb6b5c5['$or'],_0xbf1f6d);}return _0x37a9e9['sobject'](_0xa487('0x34'))['find'](_0xb6b5c5,_0x11b9b7);}});}});case _0xa487('0x14'):var _0x230b61=_[_0xa487('0x2e')](_0x26f34d);if(_0x5f0a8c[_0xa487('0x2f')]){var _0x1e40a9={};_0x1e40a9[_0x5f0a8c['additionalSearchContact']]=_0x4e368f;_[_0xa487('0x30')](_0x230b61[_0xa487('0x33')],_0x1e40a9);}return _0x37a9e9[_0xa487('0x1c')]('Contact')[_0xa487('0x21')](_0x230b61,_0x11b9b7)['execute']();case'lead':var _0x392456=_[_0xa487('0x2e')](_0x26f34d);if(_0x5f0a8c[_0xa487('0x32')]){var _0x1e40a9={};_0x1e40a9[_0x5f0a8c['additionalSearchLead']]=_0x4e368f;_['merge'](_0x392456[_0xa487('0x33')],_0x1e40a9);}return _0x37a9e9[_0xa487('0x1c')](_0xa487('0x34'))['find'](_0x392456,_0x11b9b7);case'account':var _0x53561f=_['cloneDeep'](_0x26f34d);if(_0x5f0a8c['additionalSearchAccount']){var _0x1e40a9={};_0x1e40a9[_0x5f0a8c[_0xa487('0x36')]]=_0x4e368f;_[_0xa487('0x30')](_0x53561f[_0xa487('0x33')],_0x1e40a9);}return _0x37a9e9[_0xa487('0x1c')]('Account')[_0xa487('0x21')](_0x53561f,_0x11b9b7);default:return null;}})[_0xa487('0x22')](function(_0x329749){if(_0x329749&&_0x329749['length']){var _0x5b65be=_[_0xa487('0x38')](_0x329749);if(_0x5b65be){return BPromise[_0xa487('0x26')]({'id':_0x5b65be['Id'],'name':_0x5b65be[_0xa487('0x27')],'phone':_0x5b65be[_0xa487('0x39')],'endUserType':_0x5b65be[_0xa487('0x3a')][_0xa487('0x3b')][_0xa487('0x3c')]()});}}})[_0xa487('0x22')](function(_0x5c9d04){if(_0x5c9d04){logger[_0xa487('0x1a')](_0xa487('0x3d'),_0x5c9d04[_0xa487('0x13')],_0x4e368f);return BPromise[_0xa487('0x26')](_0x5c9d04);}else{logger[_0xa487('0x1a')](_0xa487('0x3e'),_0x4e368f);var _0x15319f={'Phone':_0x4e368f};if(_0x5f0a8c[_0xa487('0x3f')]){if(_0x5f0a8c[_0xa487('0x3f')]==='contact'){logger[_0xa487('0x1a')](_0xa487('0x40'),_0x4e368f,_0x5f0a8c[_0xa487('0x3f')]);_0x15319f[_0xa487('0x41')]=_0xd0d901!==_0xa487('0x42')?_0xd0d901:util[_0xa487('0x43')](_0xa487('0x44'),_0x4e368f);}else if(_0x5f0a8c['moduleCreate']==='lead'){logger[_0xa487('0x1a')](_0xa487('0x40'),_0x4e368f,_0x5f0a8c[_0xa487('0x3f')]);_0x15319f[_0xa487('0x41')]=_0xd0d901!==_0xa487('0x42')?_0xd0d901:util['format']('Caller\x20-\x20%s',_0x4e368f);_0x15319f[_0xa487('0x45')]=_0xa487('0x46');}else if(_0x5f0a8c[_0xa487('0x3f')]===_0xa487('0x18')){logger['info'](_0xa487('0x40'),_0x4e368f,_0x5f0a8c[_0xa487('0x3f')]);_0x15319f['Name']=_0xd0d901!==_0xa487('0x42')?_0xd0d901:util[_0xa487('0x43')](_0xa487('0x44'),_0x4e368f);}else{return null;}}return _0x37a9e9[_0xa487('0x1c')](_[_0xa487('0x47')](_0x5f0a8c['moduleCreate']))[_0xa487('0x1d')](_0x15319f)[_0xa487('0x22')](function(_0x2faa91){return BPromise[_0xa487('0x26')]({'id':_0x2faa91['id'],'endUserType':_0x5f0a8c[_0xa487('0x3f')]});});}});}function getCustomFields(_0x491190,_0x1679cd){var _0x3fc1a0={};if(_0x491190['length']>0x0){_[_0xa487('0x48')](_0x491190,function(_0x7280f5){if(_[_0xa487('0x49')]([_0xa487('0x4a'),_0xa487('0x4b')],_0x7280f5['type'])&&_0x7280f5[_0xa487('0x4c')]){_0x3fc1a0[_0x7280f5[_0xa487('0x4c')]]=_0x7280f5[_0xa487('0x4d')][_0xa487('0x4e')]();}else if(_0x7280f5[_0xa487('0x3b')]===_0xa487('0x4f')&&_0x7280f5[_0xa487('0x50')]&&_0x7280f5[_0xa487('0x4c')]){_0x1679cd[_0x7280f5[_0xa487('0x50')]]&&(_0x3fc1a0[_0x7280f5['idField']]=_0x1679cd[_0x7280f5['variableName']][_0xa487('0x4e')]());}else if(_0x7280f5['type']==='customVariable'&&_0x7280f5[_0xa487('0x51')]&&_0x7280f5[_0xa487('0x51')][_0xa487('0x52')]&&_0x7280f5[_0xa487('0x4c')]){_0x1679cd[_0x7280f5[_0xa487('0x51')]['name'][_0xa487('0x3c')]()]&&(_0x3fc1a0[_0x7280f5[_0xa487('0x4c')]]=_0x1679cd[_0x7280f5[_0xa487('0x51')]['name'][_0xa487('0x3c')]()]['toString']());}});}return _0x3fc1a0;}function getConnection(_0x22f743){var _0x132ac3=_0x22f743[_0xa487('0x53')][_0xa487('0x54')](_0x22f743['securityToken']);var _0x87d7b1=new jsforce[(_0xa487('0x55'))]({'oauth2':{'loginUrl':_0x22f743['remoteUri']||_0xa487('0x56'),'clientId':_0x22f743[_0xa487('0x57')],'clientSecret':_0x22f743[_0xa487('0x58')]}});return _0x87d7b1[_0xa487('0x59')](_0x22f743[_0xa487('0x5a')],_0x132ac3)['then'](function(){logger['info'](_0xa487('0x5b'));return _0x87d7b1;});}exports[_0xa487('0x5c')]=function(_0x1325b4,_0x278cce,_0x169f79,_0x6c2323,_0x23fb91,_0x5686ba){var _0x1c5234,_0x5209fe,_0x1417d5,_0x41f4ca;_0x5686ba[_0xa487('0x5d')]=intUtil[_0xa487('0x5e')](_0x5686ba[_0xa487('0x5d')]);_0x5686ba[_0xa487('0x5f')]=intUtil[_0xa487('0x5e')](_0x5686ba[_0xa487('0x5f')]);if(_0x23fb91&&_0x23fb91['monitor_format']){logger[_0xa487('0x1a')](_0xa487('0x60'),_0xa487('0x61'));_0x278cce['recordingURL']=util['format'](_0xa487('0x62'),_0x5686ba[_0xa487('0x5d')],_0x278cce[_0xa487('0x63')],md5(_0x278cce['uniqueid']));}else{_0x278cce[_0xa487('0x64')]='';}return getConnection(_0x5686ba)['then'](function(_0x34d9ad){_0x41f4ca=_0x34d9ad;return getUser(_0x5686ba,_0x6c2323[_0xa487('0x65')],_0x41f4ca);})[_0xa487('0x22')](function(_0x5cc09c){_0x1c5234=_0x5cc09c;return getEndUser(_0x5686ba,_0x169f79,_0x278cce['calleridname'],_0x278cce[_0xa487('0x66')],_0x41f4ca);})[_0xa487('0x22')](function(_0x5194fe){_0x5209fe=_0x5194fe;return getTicket(_0x5686ba,_0x1c5234,_0x5209fe,_0x169f79,_0x278cce,_0x169f79['Fields'],_0x41f4ca,_0xa487('0x5c'));})[_0xa487('0x22')](function(_0x363e4c){_0x1417d5=_0x363e4c;logger[_0xa487('0x1a')](_0xa487('0x67'),_0x1417d5['id']);logger[_0xa487('0x1a')](_0xa487('0x68'),_0x1417d5['id'],_0x6c2323[_0xa487('0x52')],_0x5686ba[_0xa487('0x3b')]);switch(_0x5686ba['type']){case _0xa487('0x69'):emit(util[_0xa487('0x43')](_0xa487('0x6a'),_0x6c2323[_0xa487('0x52')]),'trigger:salesforce:display',{'recordId':_0x1417d5['id']});break;case'newTab':emit(util[_0xa487('0x43')](_0xa487('0x6a'),_0x6c2323[_0xa487('0x52')]),_0xa487('0x6b'),{'uri':util[_0xa487('0x43')](_0xa487('0x6c'),_0x41f4ca[_0xa487('0x6d')],_0x1417d5['id'])});break;default:logger[_0xa487('0x6e')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xa487('0x6f')](function(_0xf879ad){logger[_0xa487('0x6e')](_0xa487('0x60'),_0xf879ad);});};exports[_0xa487('0x70')]=function(_0x442c26,_0x1a0c76,_0x3468ea,_0x1d69a3,_0x4d7f21,_0x53d152,_0x5f5954){var _0x3ab517,_0x2ea32d,_0x2f54bb,_0x474ee;_0x53d152[_0xa487('0x5d')]=intUtil[_0xa487('0x5e')](_0x53d152[_0xa487('0x5d')]);_0x53d152['remoteUri']=intUtil[_0xa487('0x5e')](_0x53d152[_0xa487('0x5f')]);if(_0x5f5954&&_0x5f5954[_0xa487('0x71')]&&_0x5f5954['recordingFormat']!==_0xa487('0x72')){logger[_0xa487('0x1a')](_0xa487('0x73'),_0xa487('0x61'));_0x1a0c76[_0xa487('0x64')]=util[_0xa487('0x43')](_0xa487('0x62'),_0x53d152[_0xa487('0x5d')],_0x1a0c76[_0xa487('0x63')],md5(_0x1a0c76['uniqueid']));}return getConnection(_0x53d152)['then'](function(_0x736380){_0x474ee=_0x736380;return getUser(_0x53d152,_0x1d69a3[_0xa487('0x65')],_0x474ee);})['then'](function(_0x31ba6d){_0x3ab517=_0x31ba6d;return getEndUser(_0x53d152,_0x3468ea,_0x1a0c76[_0xa487('0x74')],_0x1a0c76[_0xa487('0x75')],_0x474ee);})[_0xa487('0x22')](function(_0x8967b7){_0x2ea32d=_0x8967b7;return getTicket(_0x53d152,_0x3ab517,_0x2ea32d,_0x3468ea,_0x1a0c76,_0x3468ea['Fields'],_0x474ee,_0xa487('0x70'));})[_0xa487('0x22')](function(_0x589e0e){_0x2f54bb=_0x589e0e;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x2f54bb['id']);logger[_0xa487('0x1a')](_0xa487('0x76'),_0x2f54bb['id'],_0x1d69a3[_0xa487('0x52')],_0x53d152[_0xa487('0x3b')]);switch(_0x53d152[_0xa487('0x3b')]){case _0xa487('0x69'):emit(util[_0xa487('0x43')](_0xa487('0x6a'),_0x1d69a3[_0xa487('0x52')]),_0xa487('0x77'),{'recordId':_0x2f54bb['id']});break;case _0xa487('0x78'):emit(util[_0xa487('0x43')]('user:%s',_0x1d69a3[_0xa487('0x52')]),_0xa487('0x6b'),{'uri':util['format'](_0xa487('0x6c'),_0x474ee[_0xa487('0x6d')],_0x2f54bb['id'])});break;default:logger[_0xa487('0x6e')](_0xa487('0x73'),_0xa487('0x79'));}})[_0xa487('0x6f')](function(_0x514ba1){logger[_0xa487('0x6e')](_0xa487('0x73'),_0x514ba1);});};exports[_0xa487('0x7a')]=function(_0x5e324a,_0x741e11,_0x47420c,_0x1ed7ac,_0x3e7c23,_0x49ff7f){var _0x3c482b,_0x12b881,_0x3d43f,_0x8ce806;_0x49ff7f[_0xa487('0x5d')]=intUtil[_0xa487('0x5e')](_0x49ff7f[_0xa487('0x5d')]);_0x49ff7f[_0xa487('0x5f')]=intUtil['stripTrailingSlash'](_0x49ff7f[_0xa487('0x5f')]);if(_0x3e7c23&&_0x3e7c23[_0xa487('0x7b')]){logger[_0xa487('0x1a')]('['+_0x741e11[_0xa487('0x7c')][_0xa487('0x7d')]()+']',_0xa487('0x61'));_0x741e11[_0xa487('0x64')]=util[_0xa487('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49ff7f[_0xa487('0x5d')],_0x741e11[_0xa487('0x63')],md5(_0x741e11[_0xa487('0x63')]));}else{_0x741e11[_0xa487('0x64')]='';}return getConnection(_0x49ff7f)[_0xa487('0x22')](function(_0x29a952){_0x8ce806=_0x29a952;if(!_[_0xa487('0x1e')](_0x1ed7ac)){return getUser(_0x49ff7f,_0x1ed7ac[_0xa487('0x52')],_0x8ce806);}else{return getUser(_0x49ff7f,null,_0x8ce806);}})['then'](function(_0x5db87e){_0x3c482b=_0x5db87e;return getEndUser(_0x49ff7f,_0x47420c,_0x741e11['calleridname'],_0x741e11[_0xa487('0x66')],_0x8ce806);})[_0xa487('0x22')](function(_0x20d01f){_0x12b881=_0x20d01f;return getTicket(_0x49ff7f,_0x3c482b,_0x12b881,_0x47420c,_0x741e11,_0x47420c[_0xa487('0x7e')],_0x8ce806);})['then'](function(_0x2205fa){_0x3d43f=_0x2205fa;logger[_0xa487('0x1a')]('['+_0x741e11[_0xa487('0x7c')][_0xa487('0x7d')]()+_0xa487('0x7f'),_0x3d43f['id']);logger[_0xa487('0x1a')]('['+_0x741e11['lastevent'][_0xa487('0x7d')]()+']\x20Integration\x20account\x20type\x20%s.',_0x49ff7f[_0xa487('0x3b')]);})[_0xa487('0x6f')](function(_0x58cd14){logger[_0xa487('0x6e')]('['+_0x741e11[_0xa487('0x7c')][_0xa487('0x7d')]()+']',_0x58cd14);});}; \ No newline at end of file +var _0xbfbf=['No\x20Company','upperFirst','create','forEach','includes','picklist','idField','content','variable','variableName','toString','customVariable','Variable','name','password','concat','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','[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','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','unmanaged','toUpperCase','calleridnum','Fields','lastevent','lodash','request-promise','moment','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','utc','endUserType','WhoId','account','WhatId','ContactId','AccountId','sobject','isNil','validateEmail','User','execute','then','length','find','Email','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','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','additionalSearchAccount','Account','contact','lead','first','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','LastName','','format','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0xbfbf,0x134));var _0xfbfb=function(_0x43ea38,_0x467b21){_0x43ea38=_0x43ea38-0x0;var _0x3ae839=_0xbfbf[_0x43ea38];return _0x3ae839;};'use strict';var _=require(_0xfbfb('0x0'));var rp=require(_0xfbfb('0x1'));var moment=require(_0xfbfb('0x2'));var BPromise=require(_0xfbfb('0x3'));var md5=require('md5');var jsforce=require('jsforce');var util=require(_0xfbfb('0x4'));var Redis=require(_0xfbfb('0x5'));var intUtil=require(_0xfbfb('0x6'));var config=require(_0xfbfb('0x7'));var logger=require(_0xfbfb('0x8'))(_0xfbfb('0x9'));config[_0xfbfb('0xa')]=_[_0xfbfb('0xb')](config['redis'],{'host':_0xfbfb('0xc'),'port':0x18eb});var io=require(_0xfbfb('0xd'))(new Redis(config[_0xfbfb('0xa')]));function emit(_0x244da8,_0xb1c8b2,_0x3cb0e5){io['to'](_0x244da8)[_0xfbfb('0xe')](_0xb1c8b2,_0x3cb0e5);}function getTicket(_0x36e85a,_0x132357,_0x9cb0f,_0x1e3f5d,_0x2475c5,_0x4d7b4f,_0x21350e,_0x7d9b2e){var _0x1cd907=Object['assign']({},{'OwnerId':_0x132357['id'],'Subject':intUtil[_0xfbfb('0xf')](_0x1e3f5d[_0xfbfb('0x10')],_0x2475c5,'\x20'),'Description':intUtil['getString'](_0x1e3f5d[_0xfbfb('0x11')],_0x2475c5,'\x0a')},getCustomFields(_0x4d7b4f,_0x2475c5));if(_0x9cb0f){if(_0x1e3f5d[_0xfbfb('0x12')]==='Task'){_0x1cd907['ActivityDate']=moment[_0xfbfb('0x13')]();_0x1cd907['IsReminderSet']=![];_0x1cd907['IsRecurrence']=![];if(_0x9cb0f[_0xfbfb('0x14')]==='contact'||_0x9cb0f[_0xfbfb('0x14')]==='lead'){_0x1cd907[_0xfbfb('0x15')]=_0x9cb0f['id'];}else if(_0x9cb0f[_0xfbfb('0x14')]===_0xfbfb('0x16')){_0x1cd907[_0xfbfb('0x17')]=_0x9cb0f['id'];}}else if(_0x1e3f5d[_0xfbfb('0x12')]==='Case'){if(_0x9cb0f[_0xfbfb('0x14')]==='contact'){_0x1cd907[_0xfbfb('0x18')]=_0x9cb0f['id'];}else if(_0x9cb0f['endUserType']===_0xfbfb('0x16')){_0x1cd907[_0xfbfb('0x19')]=_0x9cb0f['id'];}else if(_0x9cb0f[_0xfbfb('0x14')]==='lead'&&_0x1e3f5d['leadId']){_0x1cd907[_0x1e3f5d['leadId']]=_0x9cb0f['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x21350e[_0xfbfb('0x1a')](_0x1e3f5d[_0xfbfb('0x12')])['create'](_0x1cd907);}function getUser(_0x2b09a9,_0x2a6e7c,_0x1517eb){if(!_[_0xfbfb('0x1b')](_0x2a6e7c)&&intUtil[_0xfbfb('0x1c')](_0x2a6e7c)){var _0x3f489d={'Email':_0x2a6e7c};var _0x322ef1={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1517eb[_0xfbfb('0x1a')](_0xfbfb('0x1d'))['find'](_0x3f489d,_0x322ef1)[_0xfbfb('0x1e')]()[_0xfbfb('0x1f')](function(_0x2d14c9){if(_0x2d14c9[_0xfbfb('0x20')]){var _0x161c90=_[_0xfbfb('0x21')](_0x2d14c9,function(_0x28810c){return _0x28810c[_0xfbfb('0x22')]===_0x2a6e7c;});if(_0x161c90){logger['info'](_0xfbfb('0x23'),_0x2a6e7c);return BPromise[_0xfbfb('0x24')]({'id':_0x161c90['Id'],'name':_0x161c90[_0xfbfb('0x25')]});}}else{logger['info'](_0xfbfb('0x26'),_0x2a6e7c);return _0x1517eb[_0xfbfb('0x27')]()[_0xfbfb('0x1f')](function(_0x4403ce){return BPromise['resolve']({'id':_0x4403ce[_0xfbfb('0x28')],'name':_0x4403ce[_0xfbfb('0x29')]});});}});}else{logger[_0xfbfb('0x2a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2a6e7c);return _0x1517eb[_0xfbfb('0x27')]()[_0xfbfb('0x1f')](function(_0x3e70ec){return BPromise[_0xfbfb('0x24')]({'id':_0x3e70ec[_0xfbfb('0x28')],'name':_0x3e70ec[_0xfbfb('0x29')]});});}}function getEndUser(_0x4cafb7,_0x24dedc,_0x38408e,_0x14748c,_0x405148){var _0x1f8cad={'$or':{'Phone':_0x14748c}};var _0x17be87={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xfbfb('0x24')]()[_0xfbfb('0x1f')](function(){logger[_0xfbfb('0x2a')](_0xfbfb('0x2b'),_0x14748c,_0x24dedc[_0xfbfb('0x2c')]);switch(_0x24dedc['moduleSearch']){case _0xfbfb('0x2d'):var _0x345b68=_[_0xfbfb('0x2e')](_0x1f8cad);if(_0x24dedc[_0xfbfb('0x2f')]){var _0x498bb2={};_0x498bb2[_0x24dedc['additionalSearchContact']]=_0x14748c;_[_0xfbfb('0x30')](_0x345b68[_0xfbfb('0x31')],_0x498bb2);}return _0x405148[_0xfbfb('0x1a')](_0xfbfb('0x32'))[_0xfbfb('0x21')](_0x345b68,_0x17be87)[_0xfbfb('0x1e')]()[_0xfbfb('0x1f')](function(_0x4022b8){if(_0x4022b8&&_0x4022b8[_0xfbfb('0x20')]){return _0x4022b8;}else{var _0xcd3021=_[_0xfbfb('0x2e')](_0x1f8cad);if(_0x24dedc[_0xfbfb('0x33')]){var _0x23161e={};_0x23161e[_0x24dedc[_0xfbfb('0x33')]]=_0x14748c;_[_0xfbfb('0x30')](_0xcd3021[_0xfbfb('0x31')],_0x23161e);}return _0x405148[_0xfbfb('0x1a')](_0xfbfb('0x34'))[_0xfbfb('0x21')](_0xcd3021,_0x17be87);}});case'account_contact_lead':var _0x80383f=_[_0xfbfb('0x2e')](_0x1f8cad);if(_0x24dedc[_0xfbfb('0x35')]){var _0x498bb2={};_0x498bb2[_0x24dedc[_0xfbfb('0x35')]]=_0x14748c;_[_0xfbfb('0x30')](_0x80383f['$or'],_0x498bb2);}return _0x405148[_0xfbfb('0x1a')](_0xfbfb('0x36'))[_0xfbfb('0x21')](_0x80383f,_0x17be87)['execute']()['then'](function(_0x433fb1){if(_0x433fb1&&_0x433fb1['length']){return _0x433fb1;}else{var _0x21ab41=_[_0xfbfb('0x2e')](_0x1f8cad);if(_0x24dedc[_0xfbfb('0x2f')]){var _0x2efd86={};_0x2efd86[_0x24dedc[_0xfbfb('0x2f')]]=_0x14748c;_[_0xfbfb('0x30')](_0x21ab41[_0xfbfb('0x31')],_0x2efd86);}return _0x405148[_0xfbfb('0x1a')](_0xfbfb('0x32'))[_0xfbfb('0x21')](_0x21ab41,_0x17be87)[_0xfbfb('0x1f')](function(_0x798ee8){if(_0x798ee8&&_0x798ee8[_0xfbfb('0x20')]){return _0x798ee8;}else{var _0x503c47=_['cloneDeep'](_0x1f8cad);if(_0x24dedc[_0xfbfb('0x33')]){var _0x449bd1={};_0x449bd1[_0x24dedc[_0xfbfb('0x33')]]=_0x14748c;_[_0xfbfb('0x30')](_0x503c47[_0xfbfb('0x31')],_0x449bd1);}return _0x405148['sobject']('Lead')[_0xfbfb('0x21')](_0x503c47,_0x17be87);}});}});case _0xfbfb('0x37'):var _0x345b68=_[_0xfbfb('0x2e')](_0x1f8cad);if(_0x24dedc[_0xfbfb('0x2f')]){var _0x498bb2={};_0x498bb2[_0x24dedc[_0xfbfb('0x2f')]]=_0x14748c;_[_0xfbfb('0x30')](_0x345b68[_0xfbfb('0x31')],_0x498bb2);}return _0x405148[_0xfbfb('0x1a')]('Contact')[_0xfbfb('0x21')](_0x345b68,_0x17be87)['execute']();case _0xfbfb('0x38'):var _0x111268=_[_0xfbfb('0x2e')](_0x1f8cad);if(_0x24dedc['additionalSearchLead']){var _0x498bb2={};_0x498bb2[_0x24dedc['additionalSearchLead']]=_0x14748c;_[_0xfbfb('0x30')](_0x111268['$or'],_0x498bb2);}return _0x405148['sobject'](_0xfbfb('0x34'))[_0xfbfb('0x21')](_0x111268,_0x17be87);case _0xfbfb('0x16'):var _0x80383f=_[_0xfbfb('0x2e')](_0x1f8cad);if(_0x24dedc['additionalSearchAccount']){var _0x498bb2={};_0x498bb2[_0x24dedc[_0xfbfb('0x35')]]=_0x14748c;_['merge'](_0x80383f['$or'],_0x498bb2);}return _0x405148['sobject']('Account')[_0xfbfb('0x21')](_0x80383f,_0x17be87);default:return null;}})[_0xfbfb('0x1f')](function(_0x2dd9df){if(_0x2dd9df&&_0x2dd9df[_0xfbfb('0x20')]){var _0x135414=_[_0xfbfb('0x39')](_0x2dd9df);if(_0x135414){return BPromise[_0xfbfb('0x24')]({'id':_0x135414['Id'],'name':_0x135414[_0xfbfb('0x25')],'phone':_0x135414['Phone'],'endUserType':_0x135414['attributes'][_0xfbfb('0x3a')][_0xfbfb('0x3b')]()});}}})[_0xfbfb('0x1f')](function(_0x5d8560){if(_0x5d8560){logger[_0xfbfb('0x2a')](_0xfbfb('0x3c'),_0x5d8560[_0xfbfb('0x14')],_0x14748c);return BPromise['resolve'](_0x5d8560);}else{logger[_0xfbfb('0x2a')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x14748c);var _0xa326e={'Phone':_0x14748c};if(_0x24dedc['moduleCreate']){if(_0x24dedc[_0xfbfb('0x3d')]===_0xfbfb('0x37')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x14748c,_0x24dedc[_0xfbfb('0x3d')]);_0xa326e[_0xfbfb('0x3e')]=_0x38408e!==_0xfbfb('0x3f')?_0x38408e:util[_0xfbfb('0x40')]('Caller\x20-\x20%s',_0x14748c);}else if(_0x24dedc['moduleCreate']===_0xfbfb('0x38')){logger[_0xfbfb('0x2a')](_0xfbfb('0x41'),_0x14748c,_0x24dedc[_0xfbfb('0x3d')]);_0xa326e[_0xfbfb('0x3e')]=_0x38408e!==_0xfbfb('0x3f')?_0x38408e:util['format']('Caller\x20-\x20%s',_0x14748c);_0xa326e[_0xfbfb('0x42')]=_0xfbfb('0x43');}else if(_0x24dedc[_0xfbfb('0x3d')]===_0xfbfb('0x16')){logger[_0xfbfb('0x2a')](_0xfbfb('0x41'),_0x14748c,_0x24dedc[_0xfbfb('0x3d')]);_0xa326e[_0xfbfb('0x25')]=_0x38408e!==''?_0x38408e:util[_0xfbfb('0x40')]('Caller\x20-\x20%s',_0x14748c);}else{return null;}}return _0x405148[_0xfbfb('0x1a')](_[_0xfbfb('0x44')](_0x24dedc['moduleCreate']))[_0xfbfb('0x45')](_0xa326e)['then'](function(_0x50123d){return BPromise[_0xfbfb('0x24')]({'id':_0x50123d['id'],'endUserType':_0x24dedc[_0xfbfb('0x3d')]});});}});}function getCustomFields(_0x27ec11,_0x45529a){var _0x20bd19={};if(_0x27ec11[_0xfbfb('0x20')]>0x0){_[_0xfbfb('0x46')](_0x27ec11,function(_0x4039be){if(_[_0xfbfb('0x47')](['string',_0xfbfb('0x48')],_0x4039be[_0xfbfb('0x3a')])&&_0x4039be[_0xfbfb('0x49')]){_0x20bd19[_0x4039be[_0xfbfb('0x49')]]=_0x4039be[_0xfbfb('0x4a')]['toString']();}else if(_0x4039be['type']===_0xfbfb('0x4b')&&_0x4039be['variableName']&&_0x4039be['idField']){_0x45529a[_0x4039be['variableName']]&&(_0x20bd19[_0x4039be[_0xfbfb('0x49')]]=_0x45529a[_0x4039be[_0xfbfb('0x4c')]][_0xfbfb('0x4d')]());}else if(_0x4039be['type']===_0xfbfb('0x4e')&&_0x4039be['Variable']&&_0x4039be[_0xfbfb('0x4f')][_0xfbfb('0x50')]&&_0x4039be[_0xfbfb('0x49')]){_0x45529a[_0x4039be[_0xfbfb('0x4f')][_0xfbfb('0x50')][_0xfbfb('0x3b')]()]&&(_0x20bd19[_0x4039be[_0xfbfb('0x49')]]=_0x45529a[_0x4039be[_0xfbfb('0x4f')]['name'][_0xfbfb('0x3b')]()][_0xfbfb('0x4d')]());}});}return _0x20bd19;}function getConnection(_0x2beb2e){var _0x10b60c=_0x2beb2e[_0xfbfb('0x51')][_0xfbfb('0x52')](_0x2beb2e['securityToken']);var _0x1103be=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2beb2e[_0xfbfb('0x53')]||_0xfbfb('0x54'),'clientId':_0x2beb2e['clientId'],'clientSecret':_0x2beb2e[_0xfbfb('0x55')]}});return _0x1103be[_0xfbfb('0x56')](_0x2beb2e[_0xfbfb('0x57')],_0x10b60c)[_0xfbfb('0x1f')](function(){logger[_0xfbfb('0x2a')](_0xfbfb('0x58'));return _0x1103be;});}exports[_0xfbfb('0x59')]=function(_0x9d1630,_0x3546da,_0x3017ee,_0x149565,_0x7d54d3,_0x3abf57){var _0x250177,_0x4e3c80,_0x417256,_0x142167;_0x3abf57[_0xfbfb('0x5a')]=intUtil['stripTrailingSlash'](_0x3abf57[_0xfbfb('0x5a')]);_0x3abf57['remoteUri']=intUtil[_0xfbfb('0x5b')](_0x3abf57['remoteUri']);if(_0x7d54d3&&_0x7d54d3[_0xfbfb('0x5c')]){logger['info'](_0xfbfb('0x5d'),_0xfbfb('0x5e'));_0x3546da[_0xfbfb('0x5f')]=util[_0xfbfb('0x40')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3abf57[_0xfbfb('0x5a')],_0x3546da[_0xfbfb('0x60')],md5(_0x3546da[_0xfbfb('0x60')]));}else{_0x3546da['recordingURL']='';}return getConnection(_0x3abf57)[_0xfbfb('0x1f')](function(_0x1b901e){_0x142167=_0x1b901e;return getUser(_0x3abf57,_0x149565['email'],_0x142167);})[_0xfbfb('0x1f')](function(_0x1c20e1){_0x250177=_0x1c20e1;return getEndUser(_0x3abf57,_0x3017ee,_0x3546da[_0xfbfb('0x61')],_0x3546da['calleridnum'],_0x142167);})[_0xfbfb('0x1f')](function(_0x3610ab){_0x4e3c80=_0x3610ab;return getTicket(_0x3abf57,_0x250177,_0x4e3c80,_0x3017ee,_0x3546da,_0x3017ee['Fields'],_0x142167,_0xfbfb('0x59'));})['then'](function(_0x5926db){_0x417256=_0x5926db;logger['info'](_0xfbfb('0x62'),_0x417256['id']);logger['info'](_0xfbfb('0x63'),_0x417256['id'],_0x149565[_0xfbfb('0x50')],_0x3abf57[_0xfbfb('0x3a')]);switch(_0x3abf57[_0xfbfb('0x3a')]){case _0xfbfb('0x64'):emit(util['format'](_0xfbfb('0x65'),_0x149565[_0xfbfb('0x50')]),_0xfbfb('0x66'),{'recordId':_0x417256['id']});break;case _0xfbfb('0x67'):emit(util['format'](_0xfbfb('0x65'),_0x149565[_0xfbfb('0x50')]),_0xfbfb('0x68'),{'uri':util['format'](_0xfbfb('0x69'),_0x142167['instanceUrl'],_0x417256['id'])});break;default:logger['error'](_0xfbfb('0x6a'));}})[_0xfbfb('0x6b')](function(_0x3e6254){logger[_0xfbfb('0x6c')](_0xfbfb('0x5d'),_0x3e6254);});};exports['outbound']=function(_0x549f70,_0x4e36fd,_0x121aa9,_0x37597a,_0x5a7d23,_0x2a1fda,_0x1a0139){var _0x39878b,_0x519a00,_0x54c701,_0x2ed31e;_0x2a1fda[_0xfbfb('0x5a')]=intUtil[_0xfbfb('0x5b')](_0x2a1fda[_0xfbfb('0x5a')]);_0x2a1fda['remoteUri']=intUtil[_0xfbfb('0x5b')](_0x2a1fda['remoteUri']);if(_0x1a0139&&_0x1a0139[_0xfbfb('0x6d')]&&_0x1a0139['recordingFormat']!==_0xfbfb('0x6e')){logger['info']('[OUTBOUND]',_0xfbfb('0x5e'));_0x4e36fd[_0xfbfb('0x5f')]=util[_0xfbfb('0x40')](_0xfbfb('0x6f'),_0x2a1fda[_0xfbfb('0x5a')],_0x4e36fd['uniqueid'],md5(_0x4e36fd[_0xfbfb('0x60')]));}return getConnection(_0x2a1fda)[_0xfbfb('0x1f')](function(_0x3360ea){_0x2ed31e=_0x3360ea;return getUser(_0x2a1fda,_0x37597a[_0xfbfb('0x70')],_0x2ed31e);})['then'](function(_0x3b549e){_0x39878b=_0x3b549e;return getEndUser(_0x2a1fda,_0x121aa9,_0x4e36fd[_0xfbfb('0x71')],_0x4e36fd[_0xfbfb('0x72')],_0x2ed31e);})['then'](function(_0x293a32){_0x519a00=_0x293a32;return getTicket(_0x2a1fda,_0x39878b,_0x519a00,_0x121aa9,_0x4e36fd,_0x121aa9['Fields'],_0x2ed31e,_0xfbfb('0x73'));})[_0xfbfb('0x1f')](function(_0x138e74){_0x54c701=_0x138e74;logger['info'](_0xfbfb('0x74'),_0x54c701['id']);logger['info'](_0xfbfb('0x75'),_0x54c701['id'],_0x37597a['name'],_0x2a1fda[_0xfbfb('0x3a')]);switch(_0x2a1fda[_0xfbfb('0x3a')]){case _0xfbfb('0x64'):emit(util[_0xfbfb('0x40')](_0xfbfb('0x65'),_0x37597a['name']),_0xfbfb('0x66'),{'recordId':_0x54c701['id']});break;case _0xfbfb('0x67'):emit(util[_0xfbfb('0x40')](_0xfbfb('0x65'),_0x37597a['name']),_0xfbfb('0x68'),{'uri':util[_0xfbfb('0x40')](_0xfbfb('0x69'),_0x2ed31e['instanceUrl'],_0x54c701['id'])});break;default:logger[_0xfbfb('0x6c')]('[OUTBOUND]',_0xfbfb('0x76'));}})[_0xfbfb('0x6b')](function(_0x4e82a0){logger[_0xfbfb('0x6c')](_0xfbfb('0x77'),_0x4e82a0);});};exports[_0xfbfb('0x78')]=function(_0x555d7e,_0x3fab2e,_0x52f963,_0x537b93,_0x1d0600,_0x40026f){var _0x6bbf83,_0x4b2a2c,_0x187b87,_0x474598;_0x40026f[_0xfbfb('0x5a')]=intUtil[_0xfbfb('0x5b')](_0x40026f[_0xfbfb('0x5a')]);_0x40026f[_0xfbfb('0x53')]=intUtil[_0xfbfb('0x5b')](_0x40026f['remoteUri']);if(_0x1d0600&&_0x1d0600[_0xfbfb('0x5c')]){logger[_0xfbfb('0x2a')]('['+_0x3fab2e['lastevent'][_0xfbfb('0x79')]()+']','Recording\x20is\x20enabled!');_0x3fab2e[_0xfbfb('0x5f')]=util[_0xfbfb('0x40')](_0xfbfb('0x6f'),_0x40026f['serverUrl'],_0x3fab2e[_0xfbfb('0x60')],md5(_0x3fab2e[_0xfbfb('0x60')]));}else{_0x3fab2e[_0xfbfb('0x5f')]='';}return getConnection(_0x40026f)['then'](function(_0x1f964d){_0x474598=_0x1f964d;if(!_[_0xfbfb('0x1b')](_0x537b93)){return getUser(_0x40026f,_0x537b93['name'],_0x474598);}else{return getUser(_0x40026f,null,_0x474598);}})['then'](function(_0x1e32b6){_0x6bbf83=_0x1e32b6;return getEndUser(_0x40026f,_0x52f963,_0x3fab2e[_0xfbfb('0x61')],_0x3fab2e[_0xfbfb('0x7a')],_0x474598);})['then'](function(_0x4385ab){_0x4b2a2c=_0x4385ab;return getTicket(_0x40026f,_0x6bbf83,_0x4b2a2c,_0x52f963,_0x3fab2e,_0x52f963[_0xfbfb('0x7b')],_0x474598);})[_0xfbfb('0x1f')](function(_0x5cd04d){_0x187b87=_0x5cd04d;logger[_0xfbfb('0x2a')]('['+_0x3fab2e[_0xfbfb('0x7c')][_0xfbfb('0x79')]()+']\x20Ticket\x20%s\x20created.',_0x187b87['id']);logger[_0xfbfb('0x2a')]('['+_0x3fab2e[_0xfbfb('0x7c')][_0xfbfb('0x79')]()+']\x20Integration\x20account\x20type\x20%s.',_0x40026f[_0xfbfb('0x3a')]);})[_0xfbfb('0x6b')](function(_0x392bff){logger[_0xfbfb('0x6c')]('['+_0x3fab2e[_0xfbfb('0x7c')][_0xfbfb('0x79')]()+']',_0x392bff);});}; \ 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 3259d60..66dbc3c 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 _0xbbbc=['Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','format','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','then','result','length','info','],\x20getAdminUser\x20crm','catch','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','sys_id','adminId',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','error','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','customField','nameField','toLowerCase','content','toString','type','idField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','endUserId','incident','assign','Subjects','getString','Descriptions','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label'];(function(_0x52b24f,_0xca062d){var _0x46ea6b=function(_0x29f821){while(--_0x29f821){_0x52b24f['push'](_0x52b24f['shift']());}};_0x46ea6b(++_0xca062d);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x2126d9,_0x3d5e60){_0x2126d9=_0x2126d9-0x0;var _0x4a21a3=_0xbbbc[_0x2126d9];return _0x4a21a3;};'use strict';var _=require(_0xcbbb('0x0'));var Promise=require(_0xcbbb('0x1'));var rp=require(_0xcbbb('0x2'));var util=require(_0xcbbb('0x3'));var md5=require(_0xcbbb('0x4'));var Redis=require(_0xcbbb('0x5'));var intUtil=require(_0xcbbb('0x6'));var config=require('../../../../config/environment');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));config[_0xcbbb('0x9')]=_[_0xcbbb('0xa')](config[_0xcbbb('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xcbbb('0xb'))(new Redis(config[_0xcbbb('0x9')]));function getAdminUser(_0x32ec9c,_0x6f4fd8,_0x356249,_0x150355,_0xb97e2f,_0x4ec90a){return new Promise(function(_0x225156,_0x4b0138){var _0x5893f9={'method':_0xcbbb('0xc'),'uri':_0x150355+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0xb97e2f+'&'+_0x4ec90a,'auth':_0x6f4fd8,'json':!![]};return rp(_0x5893f9)[_0xcbbb('0xd')](function(_0x5053cd){if(_0x5053cd[_0xcbbb('0xe')][_0xcbbb('0xf')]>0x0){_0x356249['adminId']=_0x5053cd[_0xcbbb('0xe')][0x0]['sys_id'];}logger[_0xcbbb('0x10')]('['+[_0x32ec9c['toUpperCase']()]+_0xcbbb('0x11'),_0x356249);_0x225156(_0x356249);})[_0xcbbb('0x12')](function(_0x1cece7){logger['error']('['+[_0x32ec9c[_0xcbbb('0x13')]()]+']',_0x1cece7[_0xcbbb('0x14')]);_0x4b0138(_0x1cece7[_0xcbbb('0x14')]);});});}function getUser(_0x273e13,_0x47e679,_0x5af226,_0x1bba39,_0x30297d){return function(_0xf76038){logger[_0xcbbb('0x10')]('['+[_0x273e13['toUpperCase']()]+_0xcbbb('0x15'),_0xf76038);return new Promise(function(_0x4ff973,_0x1fbfb1){if(intUtil[_0xcbbb('0x16')](_0xf76038[_0xcbbb('0x17')])){var _0x5052df={'method':'GET','uri':_0x5af226+'sys_user?sysparm_query=email%3D'+_0xf76038[_0xcbbb('0x17')]+'&'+_0x1bba39+'&'+_0x30297d,'auth':_0x47e679,'json':!![]};logger[_0xcbbb('0x10')]('['+[_0x273e13[_0xcbbb('0x13')]()]+_0xcbbb('0x18'),_0x5052df);return rp(_0x5052df)[_0xcbbb('0xd')](function(_0x1cca90){logger[_0xcbbb('0x10')]('['+[_0x273e13[_0xcbbb('0x13')]()]+_0xcbbb('0x19'),_0x1cca90);if(_0x1cca90[_0xcbbb('0xe')]['length']>0x0&&String(_0x1cca90[_0xcbbb('0xe')][0x0][_0xcbbb('0x1a')])===_0xcbbb('0x1b')){_0xf76038[_0xcbbb('0x1c')]=_0x1cca90[_0xcbbb('0xe')][0x0][_0xcbbb('0x1d')];}else{_0xf76038[_0xcbbb('0x1c')]=_0xf76038[_0xcbbb('0x1e')];_0xf76038[_0xcbbb('0x17')]=_0xf76038['adminEmail'];}logger[_0xcbbb('0x10')]('['+[_0x273e13[_0xcbbb('0x13')]()]+'],\x20getUser\x20crm',_0xf76038);_0x4ff973(_0xf76038);})[_0xcbbb('0x12')](function(_0x4ffa80){logger['error']('['+[_0x273e13[_0xcbbb('0x13')]()]+']',_0x4ffa80[_0xcbbb('0x14')]);_0x1fbfb1(_0x4ffa80['message']);});}else{logger['info']('['+[_0x273e13['toUpperCase']()]+_0xcbbb('0x1f'));_0xf76038['userId']=_0xf76038['adminId'];_0xf76038[_0xcbbb('0x17')]=_0xf76038[_0xcbbb('0x20')];_0x4ff973(_0xf76038);}});};}function createEndUser(_0x38f1c6,_0x13121e,_0x372024,_0x39ba8b,_0x3d4c0d){logger[_0xcbbb('0x10')]('['+[_0x38f1c6[_0xcbbb('0x13')]()]+_0xcbbb('0x21'),_0x372024);return new Promise(function(_0x1c2ac9,_0xeb8cd8){var _0xfa973b={'method':_0xcbbb('0x22'),'uri':_0x39ba8b+_0xcbbb('0x23')+_0x3d4c0d,'body':{'user_name':_0x372024[_0xcbbb('0x24')],'roles':_0xcbbb('0x25'),'first_name':_0x372024[_0xcbbb('0x24')],'active':'true','date_format':_0xcbbb('0x26'),'phone':_0x372024[_0xcbbb('0x24')]},'auth':_0x13121e,'json':!![]};return rp(_0xfa973b)['then'](function(_0xec2761){logger['info']('['+[_0x38f1c6[_0xcbbb('0x13')]()]+_0xcbbb('0x27'),_0xec2761[_0xcbbb('0xe')]);_0x372024['endUserId']=_0xec2761[_0xcbbb('0xe')][_0xcbbb('0x1d')];_0x1c2ac9(_0x372024);})[_0xcbbb('0x12')](function(_0x46fe8f){logger[_0xcbbb('0x28')]('['+[_0x38f1c6[_0xcbbb('0x13')]()]+']',_0x46fe8f[_0xcbbb('0x14')]);_0xeb8cd8(_0x46fe8f[_0xcbbb('0x14')]);});});}function getEndUser(_0x28a589,_0x2f5198,_0x57a6ad,_0x55cdd7,_0x5ac240){return function(_0x4ed7e8){logger[_0xcbbb('0x10')]('['+[_0x28a589[_0xcbbb('0x13')]()]+_0xcbbb('0x29'),_0x4ed7e8);return new Promise(function(_0x3d5e20,_0x37b570){var _0x358537={'method':_0xcbbb('0xc'),'uri':_0x57a6ad+_0xcbbb('0x2a')+_0x4ed7e8[_0xcbbb('0x24')]+'&'+_0x55cdd7+'&'+_0x5ac240,'auth':_0x2f5198,'json':!![]};return rp(_0x358537)[_0xcbbb('0xd')](function(_0x1de318){if(_0x1de318[_0xcbbb('0xe')]['length']>0x0){_0x4ed7e8['endUserId']=_0x1de318[_0xcbbb('0xe')][0x0]['sys_id'];logger['info']('['+[_0x28a589['toUpperCase']()]+_0xcbbb('0x2b'),_0x4ed7e8);_0x3d5e20(_0x4ed7e8);}else{return createEndUser(_0x28a589,_0x2f5198,_0x4ed7e8,_0x57a6ad,_0x55cdd7)[_0xcbbb('0xd')](function(_0x5690c8){logger[_0xcbbb('0x10')]('['+[_0x28a589[_0xcbbb('0x13')]()]+_0xcbbb('0x2c'),_0x5690c8);_0x3d5e20(_0x5690c8);});}})[_0xcbbb('0x12')](function(_0x14c1a2){logger[_0xcbbb('0x28')]('['+[_0x28a589[_0xcbbb('0x13')]()]+']',_0x14c1a2[_0xcbbb('0x14')]);_0x37b570(_0x14c1a2['message']);});});};}function getCustomFields(_0x21ec4b,_0x55d349){var _0x2bb5e1={};if(_0x21ec4b[_0xcbbb('0xf')]>0x0){_[_0xcbbb('0x2d')](_0x21ec4b,function(_0x392d9b){if(_[_0xcbbb('0x2e')]([_0xcbbb('0x2f'),'picklist'],_0x392d9b['type'])&&_0x392d9b['nameField']&&!_0x392d9b[_0xcbbb('0x30')]){_0x2bb5e1[_0x392d9b[_0xcbbb('0x31')][_0xcbbb('0x32')]()]=_0x392d9b[_0xcbbb('0x33')][_0xcbbb('0x34')]();}else if(_[_0xcbbb('0x2e')]([_0xcbbb('0x2f'),'picklist'],_0x392d9b[_0xcbbb('0x35')])&&_0x392d9b[_0xcbbb('0x36')]&&_0x392d9b['customField']){_0x2bb5e1[_0x392d9b[_0xcbbb('0x36')][_0xcbbb('0x32')]()]=_0x392d9b[_0xcbbb('0x33')][_0xcbbb('0x34')]();}else if(_0x392d9b[_0xcbbb('0x35')]==='variable'&&_0x392d9b[_0xcbbb('0x37')]&&_0x392d9b['idField']&&_0x392d9b['customField']){_0x2bb5e1[_0x392d9b[_0xcbbb('0x36')][_0xcbbb('0x32')]()]=_0x55d349[_0x392d9b[_0xcbbb('0x37')]][_0xcbbb('0x34')]();}else if(_0x392d9b[_0xcbbb('0x35')]===_0xcbbb('0x38')&&_0x392d9b[_0xcbbb('0x39')]&&_0x392d9b[_0xcbbb('0x39')][_0xcbbb('0x3a')]&&_0x392d9b[_0xcbbb('0x36')]&&_0x392d9b[_0xcbbb('0x30')]){_0x2bb5e1[_0x392d9b[_0xcbbb('0x36')][_0xcbbb('0x32')]()]=_0x55d349[_0x392d9b[_0xcbbb('0x39')]['name'][_0xcbbb('0x32')]()][_0xcbbb('0x34')]();}});}return _0x2bb5e1;}function getTicket(_0x44a3c5,_0xbf88,_0x4a3ec0,_0x4c91b8,_0x58ba49,_0x225b58){return function(_0x23b433){logger[_0xcbbb('0x10')]('['+[_0x44a3c5[_0xcbbb('0x13')]()]+_0xcbbb('0x3b'),_0x23b433);return new Promise(function(_0x1ef25b,_0x6f31f9){var _0x5b2837=_0x44a3c5[_0xcbbb('0x32')]()===_0xcbbb('0x3c')?_0x23b433[_0xcbbb('0x1c')]:_0x23b433[_0xcbbb('0x3d')];var _0x478c22={'method':_0xcbbb('0x22'),'uri':_0x4a3ec0+_0xcbbb('0x3e')+'?'+_0x225b58,'body':Object[_0xcbbb('0x3f')]({},{'active':_0xcbbb('0x1b'),'caller_id':_0x5b2837,'assigned_to':_0x23b433['userId'],'short_description':intUtil['getString'](_0x4c91b8[_0xcbbb('0x40')],_0x58ba49,'\x20'),'description':intUtil[_0xcbbb('0x41')](_0x4c91b8[_0xcbbb('0x42')],_0x58ba49,'\x0a')},getCustomFields(_0x4c91b8['Fields'],_0x58ba49)),'auth':_0xbf88,'json':!![]};return rp(_0x478c22)['then'](function(_0x48bc45){logger[_0xcbbb('0x10')]('['+[_0x44a3c5[_0xcbbb('0x13')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x48bc45[_0xcbbb('0xe')]);_0x23b433[_0xcbbb('0x43')]=_0x48bc45[_0xcbbb('0xe')][_0xcbbb('0x1d')];_0x23b433['ticketNumber']=_0x48bc45[_0xcbbb('0xe')][_0xcbbb('0x44')];logger[_0xcbbb('0x10')]('['+[_0x44a3c5[_0xcbbb('0x13')]()]+_0xcbbb('0x45'),_0x23b433);_0x1ef25b(_0x23b433);})[_0xcbbb('0x12')](function(_0x32ead5){logger[_0xcbbb('0x28')]('['+[_0x44a3c5[_0xcbbb('0x13')]()]+']',_0x32ead5[_0xcbbb('0x14')]);_0x6f31f9(_0x32ead5[_0xcbbb('0x14')]);});});};}function createRemoteTag(_0x4bc520,_0x5c2d72,_0x3fb0bd,_0x1eb822){return new Promise(function(_0x354efc,_0x4c274d){var _0x909fa4={'method':'POST','uri':_0x3fb0bd+_0xcbbb('0x46')+'?'+_0x1eb822,'body':{'short_description':_0x4bc520,'global':!![],'active':!![],'name':_0x4bc520},'auth':_0x5c2d72,'json':!![]};return rp(_0x909fa4)[_0xcbbb('0xd')](function(_0x317633){var _0x477611=_0x317633[_0xcbbb('0xe')][_0xcbbb('0x1d')];_0x354efc(_0x477611);});});}function getRemoteTag(_0x5e8838,_0x494ec0,_0x4cc098,_0x370e6d,_0x257b98){return new Promise(function(_0x2cfeb2,_0x41b05b){var _0x381312={'method':_0xcbbb('0xc'),'uri':_0x4cc098+_0xcbbb('0x46')+_0xcbbb('0x47')+_0x5e8838+'&'+_0x370e6d,'auth':_0x494ec0,'json':!![]};return rp(_0x381312)[_0xcbbb('0xd')](function(_0x5828e9){if(_0x5828e9[_0xcbbb('0xe')][_0xcbbb('0xf')]>0x0){var _0x159763=_0x5828e9['result'][0x0][_0xcbbb('0x1d')];_0x2cfeb2(_0x159763);}else{return createRemoteTag(_0x5e8838,_0x494ec0,_0x4cc098,_0x370e6d)[_0xcbbb('0xd')](function(_0xa1d39a){_0x2cfeb2(_0xa1d39a);});}});});}function assignTagToIncident(_0x4b0688,_0x17d714,_0x1dbf9b,_0x5501d5,_0x26f0e6){return new Promise(function(_0x5b4aaa,_0x17b38b){var _0x2f57fc={'method':'POST','uri':_0x1dbf9b+_0xcbbb('0x48')+'?'+_0x26f0e6,'body':{'label':_0x4b0688,'table':_0xcbbb('0x3e'),'id_type':'Incident','table_key':_0x5501d5['ticketId'],'title':_0xcbbb('0x49')+_0x5501d5['ticketNumber'],'id_display':_0x5501d5[_0xcbbb('0x4a')]},'auth':_0x17d714,'json':!![]};return rp(_0x2f57fc)['then'](function(_0xb68922){_0x5b4aaa();})[_0xcbbb('0x12')](function(){_0x5b4aaa();});});}function manageTags(_0x20aaa9,_0x4b4bb7,_0x4b8a36,_0x2d6c6f,_0x198979,_0x50a2e4,_0x1b7549){return new Promise(function(_0x174e8d,_0x21b249){var _0x556e48=[];_0x4b4bb7[_0xcbbb('0x2d')](function(_0x6dba3b){_0x556e48[_0xcbbb('0x4b')](getRemoteTag(_0x6dba3b,_0x4b8a36,_0x2d6c6f,_0x50a2e4,_0x1b7549));});return Promise[_0xcbbb('0x4c')](_0x556e48)[_0xcbbb('0xd')](function(_0x110e95){if(_0x110e95[_0xcbbb('0xf')]){logger['info']('['+[_0x20aaa9['toUpperCase']()]+_0xcbbb('0x4d'),_0x110e95);var _0x2469e5=[];_0x110e95[_0xcbbb('0x2d')](function(_0x97ffd5){_0x2469e5['push'](assignTagToIncident(_0x97ffd5,_0x4b8a36,_0x2d6c6f,_0x198979,_0x50a2e4));});return Promise['all'](_0x2469e5)[_0xcbbb('0xd')](function(){_0x174e8d();})['catch'](function(){_0x174e8d();});}else{_0x174e8d();}});});}function getTags(_0x5ea915,_0x283c96,_0x36be78,_0x2151e8,_0x4b907b,_0x2ec74e){return function(_0x3cec2e){return new Promise(function(_0x610b96,_0x58ce05){var _0x272286=[];var _0x549a59=_0x2151e8[_0xcbbb('0x4e')];if(_0x549a59&&_0x549a59['length']>0x0){_0x272286=_[_0xcbbb('0x4f')](_0x549a59,_0xcbbb('0x3a'));}if(_0x272286[_0xcbbb('0xf')]>0x0){return manageTags(_0x5ea915,_0x272286,_0x283c96,_0x36be78,_0x3cec2e,_0x4b907b,_0x2ec74e)[_0xcbbb('0xd')](function(){_0x610b96(_0x3cec2e);});}else{_0x610b96(_0x3cec2e);}});};}function emit(_0x19e98d,_0x1384b6,_0x3894bb){var _0x619340='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xcbbb('0x50')+_0xcbbb('0x51');var _0x22d9db={'uri':_0x19e98d+_0xcbbb('0x52')+_0x3894bb+_0x619340};io['to'](util['format']('user:%s',_0x1384b6))['emit'](_0xcbbb('0x53'),_0x22d9db);}exports['cs']=function(_0x2f0db8,_0x498e47,_0x2c7035,_0x3509cd,_0x5e200f,_0x281369,_0x17a14f,_0x4e2198){var _0x36f48b={};var _0x136be0={'user':_0x281369[_0xcbbb('0x54')],'pass':_0x281369['password']};var _0x50cd5e=_0xcbbb('0x55');var _0x44dead=_0xcbbb('0x56');_0x281369['remoteUri']=intUtil['stripTrailingSlash'](_0x281369[_0xcbbb('0x57')]);_0x281369[_0xcbbb('0x58')]=intUtil[_0xcbbb('0x59')](_0x281369[_0xcbbb('0x58')]);var _0x386a77=util[_0xcbbb('0x5a')](_0xcbbb('0x5b'),_0x281369[_0xcbbb('0x57')]);_0x36f48b[_0xcbbb('0x17')]=!_[_0xcbbb('0x5c')](_0x3509cd)?_0x3509cd[_0xcbbb('0x5d')]:null;_0x36f48b['adminEmail']=_0x281369[_0xcbbb('0x5d')];_0x36f48b[_0xcbbb('0x24')]=_0x4e2198[_0xcbbb('0x32')]()===_0xcbbb('0x3c')?_0x498e47[_0xcbbb('0x5e')]:_0x498e47['calleridnum'];_0x36f48b[_0xcbbb('0x5f')]=_0x4e2198===_0xcbbb('0x60')||_0x4e2198===_0xcbbb('0x61')?_0xcbbb('0x60'):'outbound';var _0x264c34=util[_0xcbbb('0x5a')](_0xcbbb('0x62'),_0x281369['serverUrl'],_0x498e47['uniqueid'],md5(_0x498e47[_0xcbbb('0x63')]));if(_0x5e200f&&_0x5e200f[_0xcbbb('0x64')]){logger[_0xcbbb('0x10')](_0xcbbb('0x65'),'Recording\x20is\x20enabled!');_0x498e47[_0xcbbb('0x66')]=_0x264c34;}else if(_0x17a14f&&_0x17a14f[_0xcbbb('0x67')]&&_0x17a14f[_0xcbbb('0x67')]!==_0xcbbb('0x68')){logger[_0xcbbb('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x498e47[_0xcbbb('0x66')]=_0x264c34;}else{_0x498e47[_0xcbbb('0x66')]='';}return getAdminUser(_0x4e2198,_0x136be0,_0x36f48b,_0x386a77,_0x44dead,_0x50cd5e)[_0xcbbb('0xd')](getUser(_0x4e2198,_0x136be0,_0x386a77,_0x44dead,_0x50cd5e))[_0xcbbb('0xd')](getEndUser(_0x4e2198,_0x136be0,_0x386a77,_0x44dead,_0x50cd5e))[_0xcbbb('0xd')](getTicket(_0x4e2198,_0x136be0,_0x386a77,_0x2c7035,_0x498e47,_0x44dead))[_0xcbbb('0xd')](function(_0x5681fd){logger[_0xcbbb('0x10')](util[_0xcbbb('0x5a')](_0xcbbb('0x69'),_0x5681fd[_0xcbbb('0x43')]));logger[_0xcbbb('0x10')](util[_0xcbbb('0x5a')](_0xcbbb('0x6a'),_0x4e2198));if(_0x4e2198!=='unmanaged'){logger['info']('['+[_0x4e2198[_0xcbbb('0x13')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x281369['remoteUri'],_0x3509cd[_0xcbbb('0x3a')],_0x5681fd['ticketId']);}})['catch'](function(_0x546921){logger[_0xcbbb('0x28')]('['+[_0x4e2198['toUpperCase']()]+_0xcbbb('0x6b'),util['inspect'](_0x546921,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x36ee=['calleridnum','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','sys_id','adminEmail','],\x20getUser\x20crm','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','type','nameField','customField','toLowerCase','content','toString','picklist','variable','idField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','POST','incident','assign','getString','Subjects','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0xe36e('0x0'));var util=require('util');var md5=require(_0xe36e('0x1'));var Redis=require(_0xe36e('0x2'));var intUtil=require(_0xe36e('0x3'));var config=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));config[_0xe36e('0x7')]=_[_0xe36e('0x8')](config[_0xe36e('0x7')],{'host':_0xe36e('0x9'),'port':0x18eb});var io=require(_0xe36e('0xa'))(new Redis(config[_0xe36e('0x7')]));function getAdminUser(_0x51b4bd,_0x74b4b7,_0x4aebdd,_0x2236e9,_0x123c16,_0x46f239){return new Promise(function(_0x47ce3a,_0xf119e4){var _0x48981b={'method':_0xe36e('0xb'),'uri':_0x2236e9+_0xe36e('0xc')+'&'+_0x123c16+'&'+_0x46f239,'auth':_0x74b4b7,'json':!![]};return rp(_0x48981b)[_0xe36e('0xd')](function(_0x2ad6fd){if(_0x2ad6fd[_0xe36e('0xe')][_0xe36e('0xf')]>0x0){_0x4aebdd[_0xe36e('0x10')]=_0x2ad6fd[_0xe36e('0xe')][0x0]['sys_id'];}logger[_0xe36e('0x11')]('['+[_0x51b4bd[_0xe36e('0x12')]()]+_0xe36e('0x13'),_0x4aebdd);_0x47ce3a(_0x4aebdd);})[_0xe36e('0x14')](function(_0x5c3f3c){logger[_0xe36e('0x15')]('['+[_0x51b4bd['toUpperCase']()]+']',_0x5c3f3c['message']);_0xf119e4(_0x5c3f3c[_0xe36e('0x16')]);});});}function getUser(_0x300f21,_0x26fb37,_0x278135,_0xd6828e,_0x924cd5){return function(_0x2096f6){logger[_0xe36e('0x11')]('['+[_0x300f21[_0xe36e('0x12')]()]+_0xe36e('0x17'),_0x2096f6);return new Promise(function(_0x5792e8,_0x333554){if(intUtil[_0xe36e('0x18')](_0x2096f6['userEmail'])){var _0x21d9a3={'method':'GET','uri':_0x278135+_0xe36e('0x19')+_0x2096f6[_0xe36e('0x1a')]+'&'+_0xd6828e+'&'+_0x924cd5,'auth':_0x26fb37,'json':!![]};logger['info']('['+[_0x300f21[_0xe36e('0x12')]()]+_0xe36e('0x1b'),_0x21d9a3);return rp(_0x21d9a3)[_0xe36e('0xd')](function(_0x597331){logger[_0xe36e('0x11')]('['+[_0x300f21[_0xe36e('0x12')]()]+_0xe36e('0x1c'),_0x597331);if(_0x597331[_0xe36e('0xe')][_0xe36e('0xf')]>0x0&&String(_0x597331[_0xe36e('0xe')][0x0]['active'])===_0xe36e('0x1d')){_0x2096f6[_0xe36e('0x1e')]=_0x597331[_0xe36e('0xe')][0x0][_0xe36e('0x1f')];}else{_0x2096f6[_0xe36e('0x1e')]=_0x2096f6['adminId'];_0x2096f6['userEmail']=_0x2096f6[_0xe36e('0x20')];}logger[_0xe36e('0x11')]('['+[_0x300f21[_0xe36e('0x12')]()]+_0xe36e('0x21'),_0x2096f6);_0x5792e8(_0x2096f6);})[_0xe36e('0x14')](function(_0x1507f9){logger[_0xe36e('0x15')]('['+[_0x300f21['toUpperCase']()]+']',_0x1507f9[_0xe36e('0x16')]);_0x333554(_0x1507f9[_0xe36e('0x16')]);});}else{logger[_0xe36e('0x11')]('['+[_0x300f21[_0xe36e('0x12')]()]+']\x20using\x20admin\x20profile');_0x2096f6[_0xe36e('0x1e')]=_0x2096f6['adminId'];_0x2096f6[_0xe36e('0x1a')]=_0x2096f6['adminEmail'];_0x5792e8(_0x2096f6);}});};}function createEndUser(_0x19f001,_0x5884cb,_0x410504,_0x4c5d98,_0x3b1045){logger['info']('['+[_0x19f001['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x410504);return new Promise(function(_0x5b5d53,_0x203fa2){var _0x1fc639={'method':'POST','uri':_0x4c5d98+'sys_user?'+_0x3b1045,'body':{'user_name':_0x410504[_0xe36e('0x22')],'roles':_0xe36e('0x23'),'first_name':_0x410504[_0xe36e('0x22')],'active':_0xe36e('0x1d'),'date_format':_0xe36e('0x24'),'phone':_0x410504[_0xe36e('0x22')]},'auth':_0x5884cb,'json':!![]};return rp(_0x1fc639)['then'](function(_0xb98e78){logger[_0xe36e('0x11')]('['+[_0x19f001['toUpperCase']()]+_0xe36e('0x25'),_0xb98e78[_0xe36e('0xe')]);_0x410504[_0xe36e('0x26')]=_0xb98e78[_0xe36e('0xe')][_0xe36e('0x1f')];_0x5b5d53(_0x410504);})[_0xe36e('0x14')](function(_0xfe4ee8){logger[_0xe36e('0x15')]('['+[_0x19f001[_0xe36e('0x12')]()]+']',_0xfe4ee8[_0xe36e('0x16')]);_0x203fa2(_0xfe4ee8[_0xe36e('0x16')]);});});}function getEndUser(_0x4c0c46,_0x4507b9,_0x59231e,_0x4a717e,_0x81cf9a){return function(_0x4f620d){logger[_0xe36e('0x11')]('['+[_0x4c0c46[_0xe36e('0x12')]()]+_0xe36e('0x27'),_0x4f620d);return new Promise(function(_0x235437,_0x4a6a2b){var _0x56135c={'method':_0xe36e('0xb'),'uri':_0x59231e+_0xe36e('0x28')+_0x4f620d[_0xe36e('0x22')]+'&'+_0x4a717e+'&'+_0x81cf9a,'auth':_0x4507b9,'json':!![]};return rp(_0x56135c)[_0xe36e('0xd')](function(_0x51894c){if(_0x51894c[_0xe36e('0xe')][_0xe36e('0xf')]>0x0){_0x4f620d[_0xe36e('0x26')]=_0x51894c['result'][0x0][_0xe36e('0x1f')];logger[_0xe36e('0x11')]('['+[_0x4c0c46['toUpperCase']()]+_0xe36e('0x29'),_0x4f620d);_0x235437(_0x4f620d);}else{return createEndUser(_0x4c0c46,_0x4507b9,_0x4f620d,_0x59231e,_0x4a717e)[_0xe36e('0xd')](function(_0x3a95d7){logger[_0xe36e('0x11')]('['+[_0x4c0c46[_0xe36e('0x12')]()]+_0xe36e('0x2a'),_0x3a95d7);_0x235437(_0x3a95d7);});}})[_0xe36e('0x14')](function(_0x20877d){logger[_0xe36e('0x15')]('['+[_0x4c0c46[_0xe36e('0x12')]()]+']',_0x20877d[_0xe36e('0x16')]);_0x4a6a2b(_0x20877d[_0xe36e('0x16')]);});});};}function getCustomFields(_0x3c4703,_0x5f396c){var _0x23d36e={};if(_0x3c4703[_0xe36e('0xf')]>0x0){_[_0xe36e('0x2b')](_0x3c4703,function(_0x11ee1d){if(_[_0xe36e('0x2c')](['string','picklist'],_0x11ee1d[_0xe36e('0x2d')])&&_0x11ee1d[_0xe36e('0x2e')]&&!_0x11ee1d[_0xe36e('0x2f')]){_0x23d36e[_0x11ee1d[_0xe36e('0x2e')][_0xe36e('0x30')]()]=_0x11ee1d[_0xe36e('0x31')][_0xe36e('0x32')]();}else if(_[_0xe36e('0x2c')](['string',_0xe36e('0x33')],_0x11ee1d[_0xe36e('0x2d')])&&_0x11ee1d['idField']&&_0x11ee1d[_0xe36e('0x2f')]){_0x23d36e[_0x11ee1d['idField'][_0xe36e('0x30')]()]=_0x11ee1d[_0xe36e('0x31')][_0xe36e('0x32')]();}else if(_0x11ee1d[_0xe36e('0x2d')]===_0xe36e('0x34')&&_0x11ee1d['variableName']&&_0x11ee1d[_0xe36e('0x35')]&&_0x11ee1d[_0xe36e('0x2f')]){_0x23d36e[_0x11ee1d[_0xe36e('0x35')][_0xe36e('0x30')]()]=_0x5f396c[_0x11ee1d[_0xe36e('0x36')]][_0xe36e('0x32')]();}else if(_0x11ee1d['type']===_0xe36e('0x37')&&_0x11ee1d[_0xe36e('0x38')]&&_0x11ee1d[_0xe36e('0x38')][_0xe36e('0x39')]&&_0x11ee1d[_0xe36e('0x35')]&&_0x11ee1d['customField']){_0x23d36e[_0x11ee1d[_0xe36e('0x35')][_0xe36e('0x30')]()]=_0x5f396c[_0x11ee1d[_0xe36e('0x38')][_0xe36e('0x39')][_0xe36e('0x30')]()][_0xe36e('0x32')]();}});}return _0x23d36e;}function getTicket(_0x229b36,_0x455cf9,_0x43c2d4,_0x52e744,_0x56956c,_0x101098){return function(_0x5e75da){logger[_0xe36e('0x11')]('['+[_0x229b36[_0xe36e('0x12')]()]+_0xe36e('0x3a'),_0x5e75da);return new Promise(function(_0x25aa09,_0x51641c){var _0x15c846=_0x229b36[_0xe36e('0x30')]()==='outbound'?_0x5e75da[_0xe36e('0x1e')]:_0x5e75da[_0xe36e('0x26')];var _0x2c26e6={'method':_0xe36e('0x3b'),'uri':_0x43c2d4+_0xe36e('0x3c')+'?'+_0x101098,'body':Object[_0xe36e('0x3d')]({},{'active':_0xe36e('0x1d'),'caller_id':_0x15c846,'assigned_to':_0x5e75da[_0xe36e('0x1e')],'short_description':intUtil[_0xe36e('0x3e')](_0x52e744[_0xe36e('0x3f')],_0x56956c,'\x20'),'description':intUtil[_0xe36e('0x3e')](_0x52e744[_0xe36e('0x40')],_0x56956c,'\x0a')},getCustomFields(_0x52e744[_0xe36e('0x41')],_0x56956c)),'auth':_0x455cf9,'json':!![]};return rp(_0x2c26e6)[_0xe36e('0xd')](function(_0x17d8da){logger['info']('['+[_0x229b36[_0xe36e('0x12')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x17d8da['result']);_0x5e75da[_0xe36e('0x42')]=_0x17d8da[_0xe36e('0xe')]['sys_id'];_0x5e75da[_0xe36e('0x43')]=_0x17d8da[_0xe36e('0xe')][_0xe36e('0x44')];logger[_0xe36e('0x11')]('['+[_0x229b36[_0xe36e('0x12')]()]+_0xe36e('0x45'),_0x5e75da);_0x25aa09(_0x5e75da);})[_0xe36e('0x14')](function(_0x41e10d){logger[_0xe36e('0x15')]('['+[_0x229b36['toUpperCase']()]+']',_0x41e10d[_0xe36e('0x16')]);_0x51641c(_0x41e10d[_0xe36e('0x16')]);});});};}function createRemoteTag(_0x546509,_0x1d0fac,_0x1da952,_0x3e1040){return new Promise(function(_0x206f75,_0x3770bd){var _0x53758e={'method':'POST','uri':_0x1da952+'label'+'?'+_0x3e1040,'body':{'short_description':_0x546509,'global':!![],'active':!![],'name':_0x546509},'auth':_0x1d0fac,'json':!![]};return rp(_0x53758e)['then'](function(_0x47605d){var _0x2fab4c=_0x47605d[_0xe36e('0xe')][_0xe36e('0x1f')];_0x206f75(_0x2fab4c);});});}function getRemoteTag(_0x9025cd,_0x2e0ef2,_0x7c3766,_0x17965c,_0x2493c3){return new Promise(function(_0x5045e6,_0x3385ea){var _0x478138={'method':'GET','uri':_0x7c3766+_0xe36e('0x46')+_0xe36e('0x47')+_0x9025cd+'&'+_0x17965c,'auth':_0x2e0ef2,'json':!![]};return rp(_0x478138)[_0xe36e('0xd')](function(_0x443154){if(_0x443154[_0xe36e('0xe')][_0xe36e('0xf')]>0x0){var _0x3cf731=_0x443154[_0xe36e('0xe')][0x0][_0xe36e('0x1f')];_0x5045e6(_0x3cf731);}else{return createRemoteTag(_0x9025cd,_0x2e0ef2,_0x7c3766,_0x17965c)[_0xe36e('0xd')](function(_0x56718a){_0x5045e6(_0x56718a);});}});});}function assignTagToIncident(_0x2cf7fc,_0x389e91,_0x6f979f,_0x3512ec,_0x3e4860){return new Promise(function(_0x3c78ea,_0x275142){var _0x14738a={'method':_0xe36e('0x3b'),'uri':_0x6f979f+_0xe36e('0x48')+'?'+_0x3e4860,'body':{'label':_0x2cf7fc,'table':_0xe36e('0x3c'),'id_type':_0xe36e('0x49'),'table_key':_0x3512ec[_0xe36e('0x42')],'title':_0xe36e('0x4a')+_0x3512ec['ticketNumber'],'id_display':_0x3512ec[_0xe36e('0x43')]},'auth':_0x389e91,'json':!![]};return rp(_0x14738a)[_0xe36e('0xd')](function(_0x49336b){_0x3c78ea();})[_0xe36e('0x14')](function(){_0x3c78ea();});});}function manageTags(_0x41bad0,_0x180dc3,_0x355a02,_0x1d8542,_0x34a2c3,_0x49deab,_0x3db651){return new Promise(function(_0x5b7185,_0x3b8ed8){var _0x1fc1e5=[];_0x180dc3[_0xe36e('0x2b')](function(_0x4148d0){_0x1fc1e5[_0xe36e('0x4b')](getRemoteTag(_0x4148d0,_0x355a02,_0x1d8542,_0x49deab,_0x3db651));});return Promise[_0xe36e('0x4c')](_0x1fc1e5)[_0xe36e('0xd')](function(_0xfea627){if(_0xfea627['length']){logger[_0xe36e('0x11')]('['+[_0x41bad0[_0xe36e('0x12')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0xfea627);var _0x3068e1=[];_0xfea627[_0xe36e('0x2b')](function(_0x1813d7){_0x3068e1[_0xe36e('0x4b')](assignTagToIncident(_0x1813d7,_0x355a02,_0x1d8542,_0x34a2c3,_0x49deab));});return Promise[_0xe36e('0x4c')](_0x3068e1)[_0xe36e('0xd')](function(){_0x5b7185();})[_0xe36e('0x14')](function(){_0x5b7185();});}else{_0x5b7185();}});});}function getTags(_0x48ff05,_0x2d34fc,_0x319006,_0x4289e2,_0x1b7268,_0x1fd5d1){return function(_0x43d8c2){return new Promise(function(_0xc1daf8,_0x441d87){var _0x42d246=[];var _0xeab452=_0x4289e2[_0xe36e('0x4d')];if(_0xeab452&&_0xeab452['length']>0x0){_0x42d246=_[_0xe36e('0x4e')](_0xeab452,_0xe36e('0x39'));}if(_0x42d246[_0xe36e('0xf')]>0x0){return manageTags(_0x48ff05,_0x42d246,_0x2d34fc,_0x319006,_0x43d8c2,_0x1b7268,_0x1fd5d1)[_0xe36e('0xd')](function(){_0xc1daf8(_0x43d8c2);});}else{_0xc1daf8(_0x43d8c2);}});};}function emit(_0x5ca608,_0x4a5b41,_0x324d26){var _0x55911b='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xe36e('0x4f')+'%255EORDERBYDESCnumber';var _0x2cbd78={'uri':_0x5ca608+_0xe36e('0x50')+_0x324d26+_0x55911b};io['to'](util[_0xe36e('0x51')](_0xe36e('0x52'),_0x4a5b41))[_0xe36e('0x53')](_0xe36e('0x54'),_0x2cbd78);}exports['cs']=function(_0x11e610,_0x14a9b4,_0x2a26f4,_0x5e7c92,_0x7b9501,_0x54f14c,_0x13ad07,_0x517c2a){var _0x3080ad={};var _0x209e45={'user':_0x54f14c[_0xe36e('0x55')],'pass':_0x54f14c[_0xe36e('0x56')]};var _0x483e06='sysparm_limit=1';var _0x5cccb7=_0xe36e('0x57');_0x54f14c[_0xe36e('0x58')]=intUtil[_0xe36e('0x59')](_0x54f14c[_0xe36e('0x58')]);_0x54f14c[_0xe36e('0x5a')]=intUtil['stripTrailingSlash'](_0x54f14c[_0xe36e('0x5a')]);var _0x1e216c=util['format'](_0xe36e('0x5b'),_0x54f14c['remoteUri']);_0x3080ad[_0xe36e('0x1a')]=!_[_0xe36e('0x5c')](_0x5e7c92)?_0x5e7c92[_0xe36e('0x5d')]:null;_0x3080ad[_0xe36e('0x20')]=_0x54f14c['email'];_0x3080ad[_0xe36e('0x22')]=_0x517c2a['toLowerCase']()==='outbound'?_0x14a9b4[_0xe36e('0x5e')]:_0x14a9b4[_0xe36e('0x5f')];_0x3080ad['callDirection']=_0x517c2a==='queue'||_0x517c2a===_0xe36e('0x60')?'queue':_0xe36e('0x61');var _0x36ddc0=util[_0xe36e('0x51')](_0xe36e('0x62'),_0x54f14c[_0xe36e('0x5a')],_0x14a9b4[_0xe36e('0x63')],md5(_0x14a9b4['uniqueid']));if(_0x7b9501&&_0x7b9501[_0xe36e('0x64')]){logger[_0xe36e('0x11')](_0xe36e('0x65'),_0xe36e('0x66'));_0x14a9b4['recordingURL']=_0x36ddc0;}else if(_0x13ad07&&_0x13ad07[_0xe36e('0x67')]&&_0x13ad07[_0xe36e('0x67')]!==_0xe36e('0x68')){logger[_0xe36e('0x11')]('[OUTBOUND]',_0xe36e('0x66'));_0x14a9b4['recordingURL']=_0x36ddc0;}else{_0x14a9b4[_0xe36e('0x69')]='';}return getAdminUser(_0x517c2a,_0x209e45,_0x3080ad,_0x1e216c,_0x5cccb7,_0x483e06)['then'](getUser(_0x517c2a,_0x209e45,_0x1e216c,_0x5cccb7,_0x483e06))[_0xe36e('0xd')](getEndUser(_0x517c2a,_0x209e45,_0x1e216c,_0x5cccb7,_0x483e06))['then'](getTicket(_0x517c2a,_0x209e45,_0x1e216c,_0x2a26f4,_0x14a9b4,_0x5cccb7))['then'](function(_0x2c2ce0){logger[_0xe36e('0x11')](util[_0xe36e('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2c2ce0[_0xe36e('0x42')]));logger[_0xe36e('0x11')](util['format'](_0xe36e('0x6a'),_0x517c2a));if(_0x517c2a!==_0xe36e('0x60')){logger[_0xe36e('0x11')]('['+[_0x517c2a['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x54f14c[_0xe36e('0x58')],_0x5e7c92[_0xe36e('0x39')],_0x2c2ce0[_0xe36e('0x42')]);}})[_0xe36e('0x14')](function(_0x411305){logger['error']('['+[_0x517c2a[_0xe36e('0x12')]()]+_0xe36e('0x6b'),util[_0xe36e('0x6c')](_0x411305,{'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 e3cbeea..77bd96c 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 _0x2b7e=['assigned_user_id','created_by','description','getString','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','Contacts','parent_name','name','direction','length','forEach','variableName','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','name_value_list','user_name','value','Agent\x20found!','resolve','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','first_name','debug','[HTTP]','merge','map','type','nameField','toLowerCase','content','string','custom_fields','customField','push','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','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','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','users','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','unmanaged','monitor_format','lastevent','toUpperCase','request-promise','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','Subjects'];(function(_0x172b36,_0x58caf1){var _0x7cca37=function(_0x17584c){while(--_0x17584c){_0x172b36['push'](_0x172b36['shift']());}};_0x7cca37(++_0x58caf1);}(_0x2b7e,0xe1));var _0xe2b7=function(_0x3d76c3,_0x91d5be){_0x3d76c3=_0x3d76c3-0x0;var _0x5e0a57=_0x2b7e[_0x3d76c3];return _0x5e0a57;};'use strict';var _=require('lodash');var rp=require(_0xe2b7('0x0'));var BPromise=require('bluebird');var md5=require(_0xe2b7('0x1'));var util=require(_0xe2b7('0x2'));var Redis=require(_0xe2b7('0x3'));var intUtil=require(_0xe2b7('0x4'));var config=require('../../../../config/environment');var logger=require(_0xe2b7('0x5'))(_0xe2b7('0x6'));config[_0xe2b7('0x7')]=_['defaults'](config[_0xe2b7('0x7')],{'host':_0xe2b7('0x8'),'port':0x18eb});var io=require(_0xe2b7('0x9'))(new Redis(config[_0xe2b7('0x7')]));var def={'method':_0xe2b7('0xa'),'json':!![]};function emit(_0x3d8a8a,_0x1cd0b7,_0xd1fa6e){io['to'](_0x3d8a8a)[_0xe2b7('0xb')](_0x1cd0b7,_0xd1fa6e);}function getTicket(_0x3d15b2,_0x50912e,_0x17aef5,_0x53b0e9,_0x809ec4,_0x8b939a,_0x3bdcd7,_0x2a79e4){logger[_0xe2b7('0xc')](_0xe2b7('0xd'));var _0x4f76f1=new Date();var _0x1ff82d=[{'name':'name','value':intUtil['getString'](_0x53b0e9[_0xe2b7('0xe')],_0x809ec4,'\x20')},{'name':_0xe2b7('0xf'),'value':_0x50912e['id']},{'name':_0xe2b7('0x10'),'value':_0x50912e['id']},{'name':_0xe2b7('0x11'),'value':intUtil[_0xe2b7('0x12')](_0x53b0e9[_0xe2b7('0x13')],_0x809ec4,'\x0a')},{'name':_0xe2b7('0x14'),'value':_0x4f76f1[_0xe2b7('0x15')]()[_0xe2b7('0x16')](0x0,0x13)['replace']('T','\x20')},{'name':_0xe2b7('0x17'),'value':'0'},{'name':_0xe2b7('0x18'),'value':'15'},{'name':'parent_id','value':_0x17aef5['id']},{'name':'parent_type','value':_0xe2b7('0x19')},{'name':_0xe2b7('0x1a'),'value':_0x17aef5[_0xe2b7('0x1b')]},{'name':_0xe2b7('0x1c'),'value':_0x2a79e4}];if(_0x8b939a[_0xe2b7('0x1d')]){_[_0xe2b7('0x1e')](_0x8b939a,function(_0x3d9f11){if(_0x809ec4[_0x3d9f11[_0xe2b7('0x1f')]]){_0x1ff82d['push']({'name':_0x3d9f11[_0xe2b7('0x20')],'value':_0x809ec4[_0x3d9f11[_0xe2b7('0x1f')]]});}});}return request({'form':{'method':_0xe2b7('0x21'),'input_type':_0xe2b7('0x22'),'response_type':_0xe2b7('0x22'),'rest_data':JSON[_0xe2b7('0x23')]({'session':_0x3bdcd7['id'],'module_name':'Calls','name_value_list':_0x1ff82d})}});}function getAuth(_0x190094){return util[_0xe2b7('0x24')](_0xe2b7('0x25'),new Buffer(_0x190094[_0xe2b7('0x26')]+':X')[_0xe2b7('0x27')](_0xe2b7('0x28')));}function getServerInfo(_0x47d176){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0xe2b7('0x22'),'rest_data':JSON[_0xe2b7('0x23')]({'session':_0x47d176['id']})}});}function getUser(_0x52447c,_0x1a16e0,_0x11b05e){if(!_[_0xe2b7('0x29')](_0x1a16e0)){logger[_0xe2b7('0xc')](_0xe2b7('0x2a'),_0x1a16e0);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x11b05e['id'],'module_name':_0xe2b7('0x2b'),'query':util[_0xe2b7('0x24')](_0xe2b7('0x2c'),_0x1a16e0),'order_by':'','offset':'0','select_fields':['id',_0xe2b7('0x1b'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe2b7('0x2d')](function(_0x1f7f67){if(_0x1f7f67[_0xe2b7('0x2e')][_0xe2b7('0x1d')]){var _0x1b8b88=_['find'](_0x1f7f67['entry_list'],function(_0x2a3175){return _0x2a3175[_0xe2b7('0x2f')][_0xe2b7('0x30')][_0xe2b7('0x31')]===_0x1a16e0;});if(_0x1b8b88){logger['info'](_0xe2b7('0x32'));return BPromise['resolve']({'id':_0x1b8b88[_0xe2b7('0x2f')]['id']['value'],'name':_0x1b8b88[_0xe2b7('0x2f')][_0xe2b7('0x1b')][_0xe2b7('0x31')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xe2b7('0x33')]({'id':_0x11b05e[_0xe2b7('0x2f')][_0xe2b7('0x34')][_0xe2b7('0x31')],'name':_0x11b05e[_0xe2b7('0x2f')][_0xe2b7('0x30')][_0xe2b7('0x31')]});});}else{logger[_0xe2b7('0xc')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xe2b7('0x33')]({'id':_0x11b05e[_0xe2b7('0x2f')][_0xe2b7('0x34')][_0xe2b7('0x31')],'name':_0x11b05e[_0xe2b7('0x2f')][_0xe2b7('0x30')][_0xe2b7('0x31')]});}}function getEndUser(_0x5b06fe,_0x51d4fb,_0x5d3808,_0x485cfb){logger[_0xe2b7('0xc')](_0xe2b7('0x35'),_0x5d3808);return request({'form':{'method':_0xe2b7('0x36'),'input_type':_0xe2b7('0x22'),'response_type':_0xe2b7('0x22'),'rest_data':JSON[_0xe2b7('0x23')]({'session':_0x485cfb['id'],'module_name':_0xe2b7('0x19'),'query':util[_0xe2b7('0x24')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x5d3808),'order_by':'','offset':'0','select_fields':['id',_0xe2b7('0x1b'),_0xe2b7('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe2b7('0x2d')](function(_0x14ab41){if(_0x14ab41[_0xe2b7('0x2e')][_0xe2b7('0x1d')]){var _0x4085b3=_[_0xe2b7('0x38')](_0x14ab41[_0xe2b7('0x2e')],function(_0x3e3a39){return _0x3e3a39[_0xe2b7('0x2f')][_0xe2b7('0x37')][_0xe2b7('0x31')]===_0x5d3808;});if(_0x4085b3){logger['info'](_0xe2b7('0x39'));return BPromise[_0xe2b7('0x33')]({'id':_0x4085b3[_0xe2b7('0x2f')]['id'][_0xe2b7('0x31')],'name':_0x4085b3[_0xe2b7('0x2f')][_0xe2b7('0x1b')][_0xe2b7('0x31')],'phone':_0x4085b3[_0xe2b7('0x2f')][_0xe2b7('0x37')][_0xe2b7('0x31')]});}}else{logger[_0xe2b7('0xc')](_0xe2b7('0x3a'));return request({'form':{'method':_0xe2b7('0x21'),'input_type':_0xe2b7('0x22'),'response_type':_0xe2b7('0x22'),'rest_data':JSON['stringify']({'session':_0x485cfb['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x51d4fb!==''?_0x51d4fb:util[_0xe2b7('0x24')](_0xe2b7('0x3b'),_0x5d3808)},{'name':'phone_home','value':_0x5d3808}]})}})['then'](function(_0x1a6497){logger[_0xe2b7('0xc')]('Enduser\x20created.');return BPromise[_0xe2b7('0x33')]({'id':_0x1a6497['id'],'name':_0x1a6497[_0xe2b7('0x2e')][_0xe2b7('0x3c')]['value'],'phone':_0x1a6497[_0xe2b7('0x2e')][_0xe2b7('0x37')]['value']});});}});}function request(_0x3e264a){logger[_0xe2b7('0x3d')](_0xe2b7('0x3e'),JSON['stringify'](_0x3e264a));return rp(_[_0xe2b7('0x3f')](def,_0x3e264a));}function getTags(_0x18b09a,_0x44fdc9){var _0x3ff30b=[];if(_0x18b09a&&_0x18b09a[_0xe2b7('0x1d')]>0x0){_0x3ff30b=_[_0xe2b7('0x40')](_0x18b09a,_0x44fdc9);}return _0x3ff30b;}function getCustomFields(_0x519b9a,_0x558239){var _0xe8fc=[];var _0x1edc2e={'custom_fields':[]};if(_0x519b9a['length']>0x0){_[_0xe2b7('0x1e')](_0x519b9a,function(_0x42a6e9){if(_0x42a6e9[_0xe2b7('0x41')]==='string'&&_0x42a6e9[_0xe2b7('0x42')]&&!_0x42a6e9['customField']){_0x1edc2e[_0x42a6e9[_0xe2b7('0x42')][_0xe2b7('0x43')]()]=_0x42a6e9[_0xe2b7('0x44')][_0xe2b7('0x27')]();}else if(_0x42a6e9[_0xe2b7('0x41')]===_0xe2b7('0x45')&&_0x42a6e9[_0xe2b7('0x20')]&&_0x42a6e9['customField']){_0x1edc2e[_0xe2b7('0x46')]['push']({'id':_0x42a6e9[_0xe2b7('0x20')],'value':_0x42a6e9[_0xe2b7('0x44')][_0xe2b7('0x27')]()});}else if(_0x42a6e9[_0xe2b7('0x41')]==='variable'&&_0x42a6e9[_0xe2b7('0x1f')]&&_0x42a6e9[_0xe2b7('0x20')]&&_0x42a6e9[_0xe2b7('0x47')]){_0x558239[_0x42a6e9[_0xe2b7('0x1f')]]&&_0x1edc2e[_0xe2b7('0x46')][_0xe2b7('0x48')]({'id':_0x42a6e9[_0xe2b7('0x20')],'value':_0x558239[_0x42a6e9[_0xe2b7('0x1f')]][_0xe2b7('0x27')]()});}else if(_0x42a6e9['type']===_0xe2b7('0x49')&&_0x42a6e9['Variable']&&_0x42a6e9[_0xe2b7('0x4a')][_0xe2b7('0x1b')]&&_0x42a6e9[_0xe2b7('0x20')]&&_0x42a6e9['customField']){_0x558239[_0x42a6e9['Variable'][_0xe2b7('0x1b')]['toLowerCase']()]&&_0x1edc2e[_0xe2b7('0x46')]['push']({'id':_0x42a6e9[_0xe2b7('0x20')],'value':_0x558239[_0x42a6e9['Variable'][_0xe2b7('0x1b')][_0xe2b7('0x43')]()][_0xe2b7('0x27')]()});}});}return _0x1edc2e;}function getConnection(_0x53f3b4){return request({'method':_0xe2b7('0xa'),'form':{'method':_0xe2b7('0x4b'),'input_type':_0xe2b7('0x22'),'response_type':_0xe2b7('0x22'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x53f3b4['username'],'password':_0x53f3b4[_0xe2b7('0x4c')],'encryption':_0xe2b7('0x4d')},'application':_0xe2b7('0x4e')})}})[_0xe2b7('0x2d')](function(_0x1c22f7){var _0x56c650=_0x1c22f7;if(_0x56c650['id']){def[_0xe2b7('0x4f')]=_0x56c650['id'];return BPromise[_0xe2b7('0x33')](_0x56c650);}else{throw new Error(util[_0xe2b7('0x24')]('Account\x20%d\x20is\x20not\x20valid',_0x53f3b4['id']));}});}function setRelationship(_0x344ead,_0x3a1b10,_0x3b6789,_0x3931d8){return request({'form':{'method':_0xe2b7('0x50'),'input_type':'JSON','response_type':_0xe2b7('0x22'),'rest_data':JSON[_0xe2b7('0x23')]({'session':_0x344ead['id'],'module_name':_0xe2b7('0x51'),'module_id':_0x3b6789['id'],'link_field_name':_0x3931d8,'related_ids':[_0x3a1b10['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xe2b7('0x52')]=function(_0x58d6f0,_0x12f082,_0x568fc0,_0xb2e4bd,_0x46ab18,_0x36b6ec){var _0x174fe7,_0x385f9b,_0xb6bb1d,_0x2205d0;_0x36b6ec[_0xe2b7('0x53')]=intUtil[_0xe2b7('0x54')](_0x36b6ec[_0xe2b7('0x53')]);_0x36b6ec[_0xe2b7('0x55')]=intUtil['stripTrailingSlash'](_0x36b6ec[_0xe2b7('0x55')]);def['uri']=util[_0xe2b7('0x24')]('%s/service/v4_1/rest.php',_0x36b6ec[_0xe2b7('0x53')]);if(_0x46ab18&&_0x46ab18['monitor_format']){logger[_0xe2b7('0xc')](_0xe2b7('0x56'),_0xe2b7('0x57'));_0x12f082[_0xe2b7('0x58')]=util[_0xe2b7('0x24')](_0xe2b7('0x59'),_0x36b6ec[_0xe2b7('0x55')],_0x12f082[_0xe2b7('0x5a')],md5(_0x12f082[_0xe2b7('0x5a')]));}else{_0x12f082[_0xe2b7('0x58')]='';}return getConnection(_0x36b6ec)[_0xe2b7('0x2d')](function(_0x387b59){_0x2205d0=_0x387b59;return getUser(_0x36b6ec,_0xb2e4bd[_0xe2b7('0x1b')],_0x2205d0);})[_0xe2b7('0x2d')](function(_0x19fcb9){_0x174fe7=_0x19fcb9;logger[_0xe2b7('0xc')](_0xe2b7('0x5b'),_0x174fe7['id']);return getEndUser(_0x36b6ec,_0x12f082[_0xe2b7('0x5c')],_0x12f082[_0xe2b7('0x5d')],_0x2205d0);})['then'](function(_0x232814){_0x385f9b=_0x232814;logger[_0xe2b7('0xc')](_0xe2b7('0x5e'),_0x385f9b['id']);return getTicket(_0x36b6ec,_0x174fe7,_0x385f9b,_0x568fc0,_0x12f082,_0x568fc0[_0xe2b7('0x5f')],_0x2205d0,_0xe2b7('0x60'));})[_0xe2b7('0x2d')](function(_0x535e8e){_0xb6bb1d=_0x535e8e;logger[_0xe2b7('0xc')](_0xe2b7('0x61'));logger[_0xe2b7('0xc')](_0xe2b7('0x62'),_0xb6bb1d['id']);return setRelationship(_0x2205d0,_0x174fe7,_0xb6bb1d,'users');})['then'](function(){return setRelationship(_0x2205d0,_0x385f9b,_0xb6bb1d,_0xe2b7('0x63'));})[_0xe2b7('0x2d')](function(){return getServerInfo(_0x2205d0);})[_0xe2b7('0x2d')](function(_0x1acbde){var _0x5d1d58=parseInt(_0x1acbde[_0xe2b7('0x64')][_0xe2b7('0x65')](0x0));var _0x23eac4=util[_0xe2b7('0x24')](_0xe2b7('0x66'),_0x36b6ec['remoteUri'],_0xb6bb1d['id']);if(_0x5d1d58>0x6){_0x23eac4=util[_0xe2b7('0x24')](_0xe2b7('0x67'),_0x36b6ec[_0xe2b7('0x53')],_0xb6bb1d['id']);}logger[_0xe2b7('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe2b7('0x24')]('user:%s',_0xb2e4bd['name']),_0xe2b7('0x68'),{'uri':_0x23eac4});})[_0xe2b7('0x69')](function(_0x410543){logger['error'](_0xe2b7('0x56'),JSON[_0xe2b7('0x23')](_0x410543));});};exports[_0xe2b7('0x6a')]=function(_0x33b357,_0x42a30a,_0x481402,_0x64cd84,_0x4f0345,_0x3590e3,_0xb24ccb){var _0x200116,_0x354fcd,_0x52aa1b,_0x2201a5;_0x3590e3['remoteUri']=intUtil[_0xe2b7('0x54')](_0x3590e3[_0xe2b7('0x53')]);_0x3590e3[_0xe2b7('0x55')]=intUtil[_0xe2b7('0x54')](_0x3590e3[_0xe2b7('0x55')]);def['uri']=util[_0xe2b7('0x24')]('%s/service/v4_1/rest.php',_0x3590e3['remoteUri']);if(_0xb24ccb&&_0xb24ccb[_0xe2b7('0x6b')]&&_0xb24ccb[_0xe2b7('0x6b')]!==_0xe2b7('0x6c')){logger[_0xe2b7('0xc')](_0xe2b7('0x6d'),_0xe2b7('0x57'));_0x42a30a[_0xe2b7('0x58')]=util[_0xe2b7('0x24')](_0xe2b7('0x59'),_0x3590e3[_0xe2b7('0x55')],_0x42a30a[_0xe2b7('0x5a')],md5(_0x42a30a[_0xe2b7('0x5a')]));}return getConnection(_0x3590e3)['then'](function(_0x22d8c0){_0x2201a5=_0x22d8c0;return getUser(_0x3590e3,_0x64cd84[_0xe2b7('0x1b')],_0x2201a5);})[_0xe2b7('0x2d')](function(_0x6d28ad){_0x200116=_0x6d28ad;logger[_0xe2b7('0xc')](_0xe2b7('0x5b'),_0x200116['id']);return getEndUser(_0x3590e3,_0x42a30a['destcalleridname'],_0x42a30a[_0xe2b7('0x6e')],_0x2201a5);})[_0xe2b7('0x2d')](function(_0x422eab){_0x354fcd=_0x422eab;logger[_0xe2b7('0xc')]('The\x20Enduser\x20ID\x20is:',_0x354fcd['id']);return getTicket(_0x3590e3,_0x200116,_0x354fcd,_0x481402,_0x42a30a,_0x481402[_0xe2b7('0x5f')],_0x2201a5,_0xe2b7('0x6f'));})['then'](function(_0x279c56){_0x52aa1b=_0x279c56;logger['info'](_0xe2b7('0x61'));logger[_0xe2b7('0xc')]('The\x20Ticket\x20ID\x20is:',_0x52aa1b['id']);return setRelationship(_0x2201a5,_0x200116,_0x52aa1b,_0xe2b7('0x70'));})[_0xe2b7('0x2d')](function(){return setRelationship(_0x2201a5,_0x354fcd,_0x52aa1b,_0xe2b7('0x63'));})['then'](function(){return getServerInfo(_0x2201a5);})[_0xe2b7('0x2d')](function(_0x2a4b2){var _0x4ea6ed=parseInt(_0x2a4b2[_0xe2b7('0x64')][_0xe2b7('0x65')](0x0));var _0x19e0cb=util[_0xe2b7('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3590e3[_0xe2b7('0x53')],_0x52aa1b['id']);if(_0x4ea6ed>0x6){_0x19e0cb=util[_0xe2b7('0x24')](_0xe2b7('0x67'),_0x3590e3[_0xe2b7('0x53')],_0x52aa1b['id']);}logger[_0xe2b7('0xc')](_0xe2b7('0x6d'),_0xe2b7('0x71'));emit(util[_0xe2b7('0x24')](_0xe2b7('0x72'),_0x64cd84[_0xe2b7('0x1b')]),_0xe2b7('0x68'),{'uri':_0x19e0cb});})[_0xe2b7('0x69')](function(_0xad6976){logger[_0xe2b7('0x73')](_0xe2b7('0x6d'),JSON[_0xe2b7('0x23')](_0xad6976));});};exports[_0xe2b7('0x74')]=function(_0x4c9b05,_0x3b4e69,_0x5020d1,_0xdd9013,_0x29498d,_0x291088){var _0x387de7,_0x2f5963,_0x5c58c0,_0x3a26fb;_0x291088[_0xe2b7('0x53')]=intUtil[_0xe2b7('0x54')](_0x291088[_0xe2b7('0x53')]);_0x291088['serverUrl']=intUtil[_0xe2b7('0x54')](_0x291088[_0xe2b7('0x55')]);def['uri']=util[_0xe2b7('0x24')]('%s/service/v4_1/rest.php',_0x291088['remoteUri']);if(_0x29498d&&_0x29498d[_0xe2b7('0x75')]){logger[_0xe2b7('0xc')]('['+_0x3b4e69['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x3b4e69[_0xe2b7('0x58')]=util['format'](_0xe2b7('0x59'),_0x291088[_0xe2b7('0x55')],_0x3b4e69[_0xe2b7('0x5a')],md5(_0x3b4e69[_0xe2b7('0x5a')]));}else{_0x3b4e69[_0xe2b7('0x58')]='';}return getConnection(_0x291088)[_0xe2b7('0x2d')](function(_0x5e9e6a){_0x3a26fb=_0x5e9e6a;if(!_['isNil'](_0xdd9013)){return getUser(_0x291088,_0xdd9013['name'],_0x3a26fb);}else{return getUser(_0x291088,null,_0x3a26fb);}})[_0xe2b7('0x2d')](function(_0x462be4){_0x387de7=_0x462be4;logger[_0xe2b7('0xc')](_0xe2b7('0x5b'),_0x387de7['id']);return getEndUser(_0x291088,_0x3b4e69[_0xe2b7('0x5c')],_0x3b4e69['calleridnum'],_0x3a26fb);})[_0xe2b7('0x2d')](function(_0x1c7acc){_0x2f5963=_0x1c7acc;logger['info'](_0xe2b7('0x5e'),_0x2f5963['id']);return getTicket(_0x291088,_0x387de7,_0x2f5963,_0x5020d1,_0x3b4e69,_0x5020d1[_0xe2b7('0x5f')],_0x3a26fb,_0xe2b7('0x60'));})[_0xe2b7('0x2d')](function(_0x484d9f){_0x5c58c0=_0x484d9f;logger[_0xe2b7('0xc')]('Ticket\x20created!');logger['info'](_0xe2b7('0x62'),_0x5c58c0['id']);return setRelationship(_0x3a26fb,_0x387de7,_0x5c58c0,'users');})[_0xe2b7('0x2d')](function(){return setRelationship(_0x3a26fb,_0x2f5963,_0x5c58c0,_0xe2b7('0x63'));})[_0xe2b7('0x2d')](function(){return getServerInfo(_0x3a26fb);})[_0xe2b7('0x69')](function(_0x5cc53e){logger['error']('['+_0x3b4e69[_0xe2b7('0x76')][_0xe2b7('0x77')]()+']',JSON[_0xe2b7('0x23')](_0x5cc53e));});}; \ No newline at end of file +var _0x1e41=['[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','contacts','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','unmanaged','lastevent','toUpperCase','calleridnum','users','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','Creating\x20new\x20ticket...','Subjects','assigned_user_id','description','getString','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','Contacts','parent_name','name','direction','variableName','push','idField','set_entry','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','format','phone_home','find','Enduser\x20found!','resolve','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','string','nameField','customField','toLowerCase','content','type','variable','custom_fields','customVariable','Variable','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format'];(function(_0x599e61,_0x2d9c55){var _0x3415ab=function(_0x4e0baa){while(--_0x4e0baa){_0x599e61['push'](_0x599e61['shift']());}};_0x3415ab(++_0x2d9c55);}(_0x1e41,0x11c));var _0x11e4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1e41[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var rp=require(_0x11e4('0x0'));var BPromise=require(_0x11e4('0x1'));var md5=require('md5');var util=require(_0x11e4('0x2'));var Redis=require(_0x11e4('0x3'));var intUtil=require(_0x11e4('0x4'));var config=require(_0x11e4('0x5'));var logger=require('../../../../config/logger')(_0x11e4('0x6'));config[_0x11e4('0x7')]=_[_0x11e4('0x8')](config['redis'],{'host':_0x11e4('0x9'),'port':0x18eb});var io=require(_0x11e4('0xa'))(new Redis(config[_0x11e4('0x7')]));var def={'method':_0x11e4('0xb'),'json':!![]};function emit(_0x15ca35,_0x153e81,_0x10d05d){io['to'](_0x15ca35)['emit'](_0x153e81,_0x10d05d);}function getTicket(_0x3c1a5c,_0x1cc183,_0x2af972,_0x1c6896,_0x2e0ae7,_0x178022,_0x269d64,_0x213562){logger['info'](_0x11e4('0xc'));var _0x34c1c7=new Date();var _0x744a8a=[{'name':'name','value':intUtil['getString'](_0x1c6896[_0x11e4('0xd')],_0x2e0ae7,'\x20')},{'name':_0x11e4('0xe'),'value':_0x1cc183['id']},{'name':'created_by','value':_0x1cc183['id']},{'name':_0x11e4('0xf'),'value':intUtil[_0x11e4('0x10')](_0x1c6896[_0x11e4('0x11')],_0x2e0ae7,'\x0a')},{'name':_0x11e4('0x12'),'value':_0x34c1c7[_0x11e4('0x13')]()[_0x11e4('0x14')](0x0,0x13)['replace']('T','\x20')},{'name':_0x11e4('0x15'),'value':'0'},{'name':_0x11e4('0x16'),'value':'15'},{'name':_0x11e4('0x17'),'value':_0x2af972['id']},{'name':'parent_type','value':_0x11e4('0x18')},{'name':_0x11e4('0x19'),'value':_0x2af972[_0x11e4('0x1a')]},{'name':_0x11e4('0x1b'),'value':_0x213562}];if(_0x178022['length']){_['forEach'](_0x178022,function(_0xaddca2){if(_0x2e0ae7[_0xaddca2[_0x11e4('0x1c')]]){_0x744a8a[_0x11e4('0x1d')]({'name':_0xaddca2[_0x11e4('0x1e')],'value':_0x2e0ae7[_0xaddca2['variableName']]});}});}return request({'form':{'method':_0x11e4('0x1f'),'input_type':_0x11e4('0x20'),'response_type':_0x11e4('0x20'),'rest_data':JSON[_0x11e4('0x21')]({'session':_0x269d64['id'],'module_name':_0x11e4('0x22'),'name_value_list':_0x744a8a})}});}function getAuth(_0x37e46b){return util['format'](_0x11e4('0x23'),new Buffer(_0x37e46b[_0x11e4('0x24')]+':X')[_0x11e4('0x25')](_0x11e4('0x26')));}function getServerInfo(_0x424206){return request({'form':{'method':_0x11e4('0x27'),'input_type':_0x11e4('0x20'),'response_type':_0x11e4('0x20'),'rest_data':JSON[_0x11e4('0x21')]({'session':_0x424206['id']})}});}function getUser(_0x2f4bf5,_0x224f0f,_0x3ee634){if(!_[_0x11e4('0x28')](_0x224f0f)){logger[_0x11e4('0x29')](_0x11e4('0x2a'),_0x224f0f);return request({'form':{'method':_0x11e4('0x2b'),'input_type':'JSON','response_type':_0x11e4('0x20'),'rest_data':JSON['stringify']({'session':_0x3ee634['id'],'module_name':_0x11e4('0x2c'),'query':util['format'](_0x11e4('0x2d'),_0x224f0f),'order_by':'','offset':'0','select_fields':['id',_0x11e4('0x1a'),_0x11e4('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x11e4('0x2f')](function(_0x171b83){if(_0x171b83[_0x11e4('0x30')][_0x11e4('0x31')]){var _0xd078ed=_['find'](_0x171b83['entry_list'],function(_0x538786){return _0x538786[_0x11e4('0x32')][_0x11e4('0x2e')][_0x11e4('0x33')]===_0x224f0f;});if(_0xd078ed){logger['info'](_0x11e4('0x34'));return BPromise['resolve']({'id':_0xd078ed[_0x11e4('0x32')]['id'][_0x11e4('0x33')],'name':_0xd078ed[_0x11e4('0x32')][_0x11e4('0x1a')]['value']});}}logger['info'](_0x11e4('0x35'));return BPromise['resolve']({'id':_0x3ee634['name_value_list'][_0x11e4('0x36')]['value'],'name':_0x3ee634[_0x11e4('0x32')][_0x11e4('0x2e')][_0x11e4('0x33')]});});}else{logger[_0x11e4('0x29')](_0x11e4('0x37'));return BPromise['resolve']({'id':_0x3ee634[_0x11e4('0x32')][_0x11e4('0x36')][_0x11e4('0x33')],'name':_0x3ee634[_0x11e4('0x32')][_0x11e4('0x2e')][_0x11e4('0x33')]});}}function getEndUser(_0x11cba5,_0x2ed75d,_0x5f139b,_0x45f248){logger['info'](_0x11e4('0x38'),_0x5f139b);return request({'form':{'method':_0x11e4('0x2b'),'input_type':_0x11e4('0x20'),'response_type':'JSON','rest_data':JSON[_0x11e4('0x21')]({'session':_0x45f248['id'],'module_name':_0x11e4('0x18'),'query':util[_0x11e4('0x39')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x5f139b),'order_by':'','offset':'0','select_fields':['id',_0x11e4('0x1a'),_0x11e4('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x11e4('0x2f')](function(_0x31354e){if(_0x31354e[_0x11e4('0x30')][_0x11e4('0x31')]){var _0x31b425=_[_0x11e4('0x3b')](_0x31354e['entry_list'],function(_0x562dda){return _0x562dda[_0x11e4('0x32')][_0x11e4('0x3a')][_0x11e4('0x33')]===_0x5f139b;});if(_0x31b425){logger[_0x11e4('0x29')](_0x11e4('0x3c'));return BPromise[_0x11e4('0x3d')]({'id':_0x31b425[_0x11e4('0x32')]['id']['value'],'name':_0x31b425[_0x11e4('0x32')][_0x11e4('0x1a')][_0x11e4('0x33')],'phone':_0x31b425['name_value_list'][_0x11e4('0x3a')][_0x11e4('0x33')]});}}else{logger[_0x11e4('0x29')](_0x11e4('0x3e'));return request({'form':{'method':_0x11e4('0x1f'),'input_type':_0x11e4('0x20'),'response_type':_0x11e4('0x20'),'rest_data':JSON[_0x11e4('0x21')]({'session':_0x45f248['id'],'module_name':_0x11e4('0x18'),'name_value_list':[{'name':_0x11e4('0x3f'),'value':_0x2ed75d!==''?_0x2ed75d:util[_0x11e4('0x39')](_0x11e4('0x40'),_0x5f139b)},{'name':_0x11e4('0x3a'),'value':_0x5f139b}]})}})[_0x11e4('0x2f')](function(_0x55e1e8){logger['info'](_0x11e4('0x41'));return BPromise[_0x11e4('0x3d')]({'id':_0x55e1e8['id'],'name':_0x55e1e8[_0x11e4('0x30')][_0x11e4('0x3f')][_0x11e4('0x33')],'phone':_0x55e1e8[_0x11e4('0x30')][_0x11e4('0x3a')][_0x11e4('0x33')]});});}});}function request(_0x4bc275){logger[_0x11e4('0x42')](_0x11e4('0x43'),JSON['stringify'](_0x4bc275));return rp(_[_0x11e4('0x44')](def,_0x4bc275));}function getTags(_0x4a0877,_0xde09c1){var _0x50feb2=[];if(_0x4a0877&&_0x4a0877[_0x11e4('0x31')]>0x0){_0x50feb2=_[_0x11e4('0x45')](_0x4a0877,_0xde09c1);}return _0x50feb2;}function getCustomFields(_0x54db06,_0x148691){var _0x42bc8b=[];var _0x25f48f={'custom_fields':[]};if(_0x54db06[_0x11e4('0x31')]>0x0){_[_0x11e4('0x46')](_0x54db06,function(_0x26cea8){if(_0x26cea8['type']===_0x11e4('0x47')&&_0x26cea8[_0x11e4('0x48')]&&!_0x26cea8[_0x11e4('0x49')]){_0x25f48f[_0x26cea8[_0x11e4('0x48')][_0x11e4('0x4a')]()]=_0x26cea8[_0x11e4('0x4b')][_0x11e4('0x25')]();}else if(_0x26cea8['type']==='string'&&_0x26cea8[_0x11e4('0x1e')]&&_0x26cea8[_0x11e4('0x49')]){_0x25f48f['custom_fields'][_0x11e4('0x1d')]({'id':_0x26cea8[_0x11e4('0x1e')],'value':_0x26cea8[_0x11e4('0x4b')][_0x11e4('0x25')]()});}else if(_0x26cea8[_0x11e4('0x4c')]===_0x11e4('0x4d')&&_0x26cea8[_0x11e4('0x1c')]&&_0x26cea8['idField']&&_0x26cea8['customField']){_0x148691[_0x26cea8[_0x11e4('0x1c')]]&&_0x25f48f[_0x11e4('0x4e')][_0x11e4('0x1d')]({'id':_0x26cea8[_0x11e4('0x1e')],'value':_0x148691[_0x26cea8[_0x11e4('0x1c')]]['toString']()});}else if(_0x26cea8[_0x11e4('0x4c')]===_0x11e4('0x4f')&&_0x26cea8['Variable']&&_0x26cea8['Variable'][_0x11e4('0x1a')]&&_0x26cea8[_0x11e4('0x1e')]&&_0x26cea8['customField']){_0x148691[_0x26cea8[_0x11e4('0x50')][_0x11e4('0x1a')][_0x11e4('0x4a')]()]&&_0x25f48f[_0x11e4('0x4e')][_0x11e4('0x1d')]({'id':_0x26cea8[_0x11e4('0x1e')],'value':_0x148691[_0x26cea8[_0x11e4('0x50')][_0x11e4('0x1a')][_0x11e4('0x4a')]()][_0x11e4('0x25')]()});}});}return _0x25f48f;}function getConnection(_0x416e6d){return request({'method':_0x11e4('0xb'),'form':{'method':'login','input_type':_0x11e4('0x20'),'response_type':_0x11e4('0x20'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x416e6d[_0x11e4('0x51')],'password':_0x416e6d[_0x11e4('0x52')],'encryption':'PLAIN'},'application':_0x11e4('0x53')})}})[_0x11e4('0x2f')](function(_0x22daa0){var _0x37f8a4=_0x22daa0;if(_0x37f8a4['id']){def[_0x11e4('0x54')]=_0x37f8a4['id'];return BPromise[_0x11e4('0x3d')](_0x37f8a4);}else{throw new Error(util['format'](_0x11e4('0x55'),_0x416e6d['id']));}});}function setRelationship(_0x52430c,_0x4e7e36,_0x2fdd3e,_0x5b1916){return request({'form':{'method':_0x11e4('0x56'),'input_type':_0x11e4('0x20'),'response_type':_0x11e4('0x20'),'rest_data':JSON[_0x11e4('0x21')]({'session':_0x52430c['id'],'module_name':_0x11e4('0x22'),'module_id':_0x2fdd3e['id'],'link_field_name':_0x5b1916,'related_ids':[_0x4e7e36['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x11e4('0x57')]=function(_0x2c329c,_0x7b51e6,_0x3e5a33,_0x53d0b9,_0x4288cc,_0x147336){var _0x2bdf70,_0x3d5738,_0xb2a8ff,_0x33251d;_0x147336[_0x11e4('0x58')]=intUtil['stripTrailingSlash'](_0x147336[_0x11e4('0x58')]);_0x147336[_0x11e4('0x59')]=intUtil[_0x11e4('0x5a')](_0x147336[_0x11e4('0x59')]);def[_0x11e4('0x5b')]=util[_0x11e4('0x39')](_0x11e4('0x5c'),_0x147336['remoteUri']);if(_0x4288cc&&_0x4288cc[_0x11e4('0x5d')]){logger[_0x11e4('0x29')](_0x11e4('0x5e'),_0x11e4('0x5f'));_0x7b51e6['recordingURL']=util['format'](_0x11e4('0x60'),_0x147336[_0x11e4('0x59')],_0x7b51e6[_0x11e4('0x61')],md5(_0x7b51e6['uniqueid']));}else{_0x7b51e6[_0x11e4('0x62')]='';}return getConnection(_0x147336)[_0x11e4('0x2f')](function(_0x39fcb8){_0x33251d=_0x39fcb8;return getUser(_0x147336,_0x53d0b9['name'],_0x33251d);})[_0x11e4('0x2f')](function(_0xc1d738){_0x2bdf70=_0xc1d738;logger[_0x11e4('0x29')]('The\x20User\x20ID\x20is:',_0x2bdf70['id']);return getEndUser(_0x147336,_0x7b51e6[_0x11e4('0x63')],_0x7b51e6['calleridnum'],_0x33251d);})[_0x11e4('0x2f')](function(_0x1fae32){_0x3d5738=_0x1fae32;logger[_0x11e4('0x29')](_0x11e4('0x64'),_0x3d5738['id']);return getTicket(_0x147336,_0x2bdf70,_0x3d5738,_0x3e5a33,_0x7b51e6,_0x3e5a33[_0x11e4('0x65')],_0x33251d,'Inbound');})[_0x11e4('0x2f')](function(_0x271312){_0xb2a8ff=_0x271312;logger[_0x11e4('0x29')](_0x11e4('0x66'));logger['info'](_0x11e4('0x67'),_0xb2a8ff['id']);return setRelationship(_0x33251d,_0x2bdf70,_0xb2a8ff,'users');})[_0x11e4('0x2f')](function(){return setRelationship(_0x33251d,_0x3d5738,_0xb2a8ff,'contacts');})[_0x11e4('0x2f')](function(){return getServerInfo(_0x33251d);})['then'](function(_0x57928d){var _0x464661=parseInt(_0x57928d[_0x11e4('0x68')][_0x11e4('0x69')](0x0));var _0x3be963=util[_0x11e4('0x39')](_0x11e4('0x6a'),_0x147336[_0x11e4('0x58')],_0xb2a8ff['id']);if(_0x464661>0x6){_0x3be963=util['format'](_0x11e4('0x6b'),_0x147336[_0x11e4('0x58')],_0xb2a8ff['id']);}logger['info'](_0x11e4('0x5e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x11e4('0x39')](_0x11e4('0x6c'),_0x53d0b9[_0x11e4('0x1a')]),'trigger:browser:url',{'uri':_0x3be963});})['catch'](function(_0x2ed5fa){logger['error'](_0x11e4('0x5e'),JSON['stringify'](_0x2ed5fa));});};exports[_0x11e4('0x6d')]=function(_0x5a0a57,_0x5954bb,_0x40fa30,_0x43d8de,_0x4e8a3e,_0x211607,_0x3ad275){var _0x402b4a,_0x489009,_0x338635,_0x46de8f;_0x211607['remoteUri']=intUtil[_0x11e4('0x5a')](_0x211607[_0x11e4('0x58')]);_0x211607[_0x11e4('0x59')]=intUtil[_0x11e4('0x5a')](_0x211607[_0x11e4('0x59')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x211607[_0x11e4('0x58')]);if(_0x3ad275&&_0x3ad275[_0x11e4('0x6e')]&&_0x3ad275[_0x11e4('0x6e')]!==_0x11e4('0x6f')){logger[_0x11e4('0x29')](_0x11e4('0x70'),_0x11e4('0x5f'));_0x5954bb['recordingURL']=util[_0x11e4('0x39')](_0x11e4('0x60'),_0x211607[_0x11e4('0x59')],_0x5954bb[_0x11e4('0x61')],md5(_0x5954bb[_0x11e4('0x61')]));}return getConnection(_0x211607)[_0x11e4('0x2f')](function(_0x15df67){_0x46de8f=_0x15df67;return getUser(_0x211607,_0x43d8de[_0x11e4('0x1a')],_0x46de8f);})[_0x11e4('0x2f')](function(_0x3aae42){_0x402b4a=_0x3aae42;logger[_0x11e4('0x29')](_0x11e4('0x71'),_0x402b4a['id']);return getEndUser(_0x211607,_0x5954bb[_0x11e4('0x72')],_0x5954bb[_0x11e4('0x73')],_0x46de8f);})[_0x11e4('0x2f')](function(_0x497cf0){_0x489009=_0x497cf0;logger[_0x11e4('0x29')](_0x11e4('0x64'),_0x489009['id']);return getTicket(_0x211607,_0x402b4a,_0x489009,_0x40fa30,_0x5954bb,_0x40fa30['Fields'],_0x46de8f,'Outbound');})[_0x11e4('0x2f')](function(_0x543d32){_0x338635=_0x543d32;logger[_0x11e4('0x29')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x338635['id']);return setRelationship(_0x46de8f,_0x402b4a,_0x338635,'users');})[_0x11e4('0x2f')](function(){return setRelationship(_0x46de8f,_0x489009,_0x338635,_0x11e4('0x74'));})[_0x11e4('0x2f')](function(){return getServerInfo(_0x46de8f);})['then'](function(_0x4d761b){var _0x3428af=parseInt(_0x4d761b[_0x11e4('0x68')][_0x11e4('0x69')](0x0));var _0x28b287=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x211607[_0x11e4('0x58')],_0x338635['id']);if(_0x3428af>0x6){_0x28b287=util['format'](_0x11e4('0x6b'),_0x211607[_0x11e4('0x58')],_0x338635['id']);}logger[_0x11e4('0x29')](_0x11e4('0x70'),_0x11e4('0x75'));emit(util[_0x11e4('0x39')](_0x11e4('0x6c'),_0x43d8de[_0x11e4('0x1a')]),_0x11e4('0x76'),{'uri':_0x28b287});})[_0x11e4('0x77')](function(_0x1fec04){logger[_0x11e4('0x78')]('[OUTBOUND]',JSON[_0x11e4('0x21')](_0x1fec04));});};exports[_0x11e4('0x79')]=function(_0x17bf40,_0x341c3a,_0x20c51c,_0x303d39,_0x436be9,_0x12b035){var _0x367a3b,_0x131f80,_0x24c65c,_0x478186;_0x12b035['remoteUri']=intUtil[_0x11e4('0x5a')](_0x12b035[_0x11e4('0x58')]);_0x12b035[_0x11e4('0x59')]=intUtil[_0x11e4('0x5a')](_0x12b035[_0x11e4('0x59')]);def[_0x11e4('0x5b')]=util[_0x11e4('0x39')](_0x11e4('0x5c'),_0x12b035['remoteUri']);if(_0x436be9&&_0x436be9[_0x11e4('0x5d')]){logger['info']('['+_0x341c3a[_0x11e4('0x7a')][_0x11e4('0x7b')]()+']',_0x11e4('0x5f'));_0x341c3a[_0x11e4('0x62')]=util[_0x11e4('0x39')](_0x11e4('0x60'),_0x12b035['serverUrl'],_0x341c3a[_0x11e4('0x61')],md5(_0x341c3a[_0x11e4('0x61')]));}else{_0x341c3a[_0x11e4('0x62')]='';}return getConnection(_0x12b035)[_0x11e4('0x2f')](function(_0x3c1679){_0x478186=_0x3c1679;if(!_[_0x11e4('0x28')](_0x303d39)){return getUser(_0x12b035,_0x303d39['name'],_0x478186);}else{return getUser(_0x12b035,null,_0x478186);}})[_0x11e4('0x2f')](function(_0x2041aa){_0x367a3b=_0x2041aa;logger['info'](_0x11e4('0x71'),_0x367a3b['id']);return getEndUser(_0x12b035,_0x341c3a['calleridname'],_0x341c3a[_0x11e4('0x7c')],_0x478186);})[_0x11e4('0x2f')](function(_0x429643){_0x131f80=_0x429643;logger[_0x11e4('0x29')](_0x11e4('0x64'),_0x131f80['id']);return getTicket(_0x12b035,_0x367a3b,_0x131f80,_0x20c51c,_0x341c3a,_0x20c51c['Fields'],_0x478186,'Inbound');})[_0x11e4('0x2f')](function(_0x16ef26){_0x24c65c=_0x16ef26;logger['info'](_0x11e4('0x66'));logger['info'](_0x11e4('0x67'),_0x24c65c['id']);return setRelationship(_0x478186,_0x367a3b,_0x24c65c,_0x11e4('0x7d'));})[_0x11e4('0x2f')](function(){return setRelationship(_0x478186,_0x131f80,_0x24c65c,_0x11e4('0x74'));})[_0x11e4('0x2f')](function(){return getServerInfo(_0x478186);})[_0x11e4('0x77')](function(_0x3ec9ea){logger[_0x11e4('0x78')]('['+_0x341c3a[_0x11e4('0x7a')][_0x11e4('0x7b')]()+']',JSON[_0x11e4('0x21')](_0x3ec9ea));});}; \ 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 b723b0b..e3463d0 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 _0xb4f0=['util','length','string','push','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s','keyContent','format','substring','test'];(function(_0x49a67b,_0x5abc28){var _0x186bef=function(_0x5b4ee4){while(--_0x5b4ee4){_0x49a67b['push'](_0x49a67b['shift']());}};_0x186bef(++_0x5abc28);}(_0xb4f0,0x140));var _0x0b4f=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0xb4f0[_0x2eb5bc];return _0x51c7b1;};'use strict';var _=require('lodash');var util=require(_0x0b4f('0x0'));exports['getString']=function(_0x26bd9e,_0x1b2edc,_0x5e8431){var _0x59dc7e=[];if(_0x26bd9e[_0x0b4f('0x1')]>0x0){var _0x2d8bec=_['sortBy'](_0x26bd9e,['id']);for(var _0x3cf61e=0x0;_0x3cf61e<_0x2d8bec[_0x0b4f('0x1')];_0x3cf61e++){var _0x2faa1f=_0x2d8bec[_0x3cf61e];if(_0x2faa1f['type']===_0x0b4f('0x2')){_0x59dc7e[_0x0b4f('0x3')](_0x2faa1f['content']);}else if(_0x2faa1f[_0x0b4f('0x4')]===_0x0b4f('0x5')&&_0x2faa1f[_0x0b4f('0x6')]){_0x1b2edc[_0x2faa1f[_0x0b4f('0x6')]]&&_0x59dc7e[_0x0b4f('0x3')](_0x1b2edc[_0x2faa1f[_0x0b4f('0x6')]][_0x0b4f('0x7')]());}else if(_0x2faa1f[_0x0b4f('0x4')]===_0x0b4f('0x8')&&_0x2faa1f['Variable']&&_0x2faa1f[_0x0b4f('0x9')][_0x0b4f('0xa')]){_0x1b2edc[_0x2faa1f[_0x0b4f('0x9')]['name'][_0x0b4f('0xb')]()]&&_0x59dc7e[_0x0b4f('0x3')](_0x1b2edc[_0x2faa1f['Variable'][_0x0b4f('0xa')][_0x0b4f('0xb')]()][_0x0b4f('0x7')]());}else if(_0x2faa1f[_0x0b4f('0x4')]===_0x0b4f('0xc')){if(_0x2faa1f[_0x0b4f('0xd')]===_0x0b4f('0x2')&&_0x2faa1f[_0x0b4f('0xe')]){_0x59dc7e[_0x0b4f('0x3')](util['format'](_0x0b4f('0xf'),_0x2faa1f[_0x0b4f('0xe')],_0x2faa1f[_0x0b4f('0x10')]));}else if(_0x2faa1f['keyType']==='variable'&&_0x2faa1f[_0x0b4f('0x6')]&&_0x2faa1f[_0x0b4f('0xe')]){_0x1b2edc[_0x2faa1f['variableName']]&&_0x59dc7e[_0x0b4f('0x3')](util[_0x0b4f('0x11')](_0x0b4f('0xf'),_0x2faa1f['key'],_0x1b2edc[_0x2faa1f[_0x0b4f('0x6')]]));}else if(_0x2faa1f['keyType']===_0x0b4f('0x8')&&_0x2faa1f[_0x0b4f('0x9')]&&_0x2faa1f[_0x0b4f('0x9')][_0x0b4f('0xa')]&&_0x2faa1f['key']){_0x1b2edc[_0x2faa1f['Variable'][_0x0b4f('0xa')][_0x0b4f('0xb')]()]&&_0x59dc7e[_0x0b4f('0x3')](util[_0x0b4f('0x11')](_0x0b4f('0xf'),_0x2faa1f['key'],_0x1b2edc[_0x2faa1f['Variable'][_0x0b4f('0xa')][_0x0b4f('0xb')]()]));}}}}return _0x59dc7e['join'](_0x5e8431);};exports['stripTrailingSlash']=function(_0x4c62d6){var _0x3e6f2b=_0x4c62d6['slice'](-0x1);if(_0x3e6f2b==='/'){_0x4c62d6=_0x4c62d6[_0x0b4f('0x12')](0x0,_0x4c62d6['lastIndexOf'](_0x3e6f2b));}return _0x4c62d6;};exports['validateEmail']=function(_0x8d32b7){if(!_['isNil'](_0x8d32b7)&&_0x8d32b7!==''){var _0x15237b=/^(([^<>()\[\]\\.,;:\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 _0x15237b[_0x0b4f('0x13')](String(_0x8d32b7)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x4f74=['customVariable','Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','stripTrailingSlash','lastIndexOf','validateEmail','isNil','lodash','util','getString','sortBy','length','type','content','variable','variableName','push','toString'];(function(_0x327cbf,_0x114362){var _0x409cb8=function(_0x34f0a1){while(--_0x34f0a1){_0x327cbf['push'](_0x327cbf['shift']());}};_0x409cb8(++_0x114362);}(_0x4f74,0xf9));var _0x44f7=function(_0x536068,_0x3de52c){_0x536068=_0x536068-0x0;var _0x4a5db2=_0x4f74[_0x536068];return _0x4a5db2;};'use strict';var _=require(_0x44f7('0x0'));var util=require(_0x44f7('0x1'));exports[_0x44f7('0x2')]=function(_0x481881,_0x5d363c,_0x41bee1){var _0xd7eecc=[];if(_0x481881['length']>0x0){var _0xd24703=_[_0x44f7('0x3')](_0x481881,['id']);for(var _0x3d986d=0x0;_0x3d986d<_0xd24703[_0x44f7('0x4')];_0x3d986d++){var _0xdd2328=_0xd24703[_0x3d986d];if(_0xdd2328[_0x44f7('0x5')]==='string'){_0xd7eecc['push'](_0xdd2328[_0x44f7('0x6')]);}else if(_0xdd2328[_0x44f7('0x5')]===_0x44f7('0x7')&&_0xdd2328[_0x44f7('0x8')]){_0x5d363c[_0xdd2328[_0x44f7('0x8')]]&&_0xd7eecc[_0x44f7('0x9')](_0x5d363c[_0xdd2328['variableName']][_0x44f7('0xa')]());}else if(_0xdd2328[_0x44f7('0x5')]===_0x44f7('0xb')&&_0xdd2328['Variable']&&_0xdd2328[_0x44f7('0xc')][_0x44f7('0xd')]){_0x5d363c[_0xdd2328[_0x44f7('0xc')][_0x44f7('0xd')]['toLowerCase']()]&&_0xd7eecc[_0x44f7('0x9')](_0x5d363c[_0xdd2328['Variable'][_0x44f7('0xd')][_0x44f7('0xe')]()][_0x44f7('0xa')]());}else if(_0xdd2328[_0x44f7('0x5')]===_0x44f7('0xf')){if(_0xdd2328[_0x44f7('0x10')]===_0x44f7('0x11')&&_0xdd2328[_0x44f7('0x12')]){_0xd7eecc[_0x44f7('0x9')](util[_0x44f7('0x13')](_0x44f7('0x14'),_0xdd2328[_0x44f7('0x12')],_0xdd2328[_0x44f7('0x15')]));}else if(_0xdd2328['keyType']===_0x44f7('0x7')&&_0xdd2328[_0x44f7('0x8')]&&_0xdd2328['key']){_0x5d363c[_0xdd2328[_0x44f7('0x8')]]&&_0xd7eecc['push'](util[_0x44f7('0x13')]('%s:\x20%s',_0xdd2328[_0x44f7('0x12')],_0x5d363c[_0xdd2328[_0x44f7('0x8')]]));}else if(_0xdd2328[_0x44f7('0x10')]===_0x44f7('0xb')&&_0xdd2328[_0x44f7('0xc')]&&_0xdd2328['Variable'][_0x44f7('0xd')]&&_0xdd2328['key']){_0x5d363c[_0xdd2328['Variable'][_0x44f7('0xd')][_0x44f7('0xe')]()]&&_0xd7eecc['push'](util['format']('%s:\x20%s',_0xdd2328['key'],_0x5d363c[_0xdd2328['Variable'][_0x44f7('0xd')][_0x44f7('0xe')]()]));}}}}return _0xd7eecc['join'](_0x41bee1);};exports[_0x44f7('0x16')]=function(_0x20b3b2){var _0x412543=_0x20b3b2['slice'](-0x1);if(_0x412543==='/'){_0x20b3b2=_0x20b3b2['substring'](0x0,_0x20b3b2[_0x44f7('0x17')](_0x412543));}return _0x20b3b2;};exports[_0x44f7('0x18')]=function(_0x3db718){if(!_[_0x44f7('0x19')](_0x3db718)&&_0x3db718!==''){var _0x190c40=/^(([^<>()\[\]\\.,;:\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 _0x190c40['test'](String(_0x3db718)[_0x44f7('0xe')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index e5cb6c3..baefe2b 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 _0x242c=['Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','GET','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','stripTrailingSlash','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridnum','lodash','request-promise','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','length','forEach','includes','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','getString','Subjects','Descriptions','POST','%s/webservice.php','remoteUri','create','username','HelpDesk','success','resolve','result','stringify','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','format','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','then','Agent\x20found!','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','getUser','userId','Searching\x20end\x20user\x20with\x20phone','Enduser\x20found!','firstname','lastname'];(function(_0x433fea,_0x37d2f7){var _0x4d52c1=function(_0x358d24){while(--_0x358d24){_0x433fea['push'](_0x433fea['shift']());}};_0x4d52c1(++_0x37d2f7);}(_0x242c,0xfb));var _0xc242=function(_0x2e29b4,_0x57262d){_0x2e29b4=_0x2e29b4-0x0;var _0x4ec6a6=_0x242c[_0x2e29b4];return _0x4ec6a6;};'use strict';var _=require(_0xc242('0x0'));var rp=require(_0xc242('0x1'));var BPromise=require(_0xc242('0x2'));var md5=require(_0xc242('0x3'));var util=require(_0xc242('0x4'));var Redis=require('ioredis');var intUtil=require(_0xc242('0x5'));var config=require(_0xc242('0x6'));var logger=require(_0xc242('0x7'))(_0xc242('0x8'));config[_0xc242('0x9')]=_['defaults'](config[_0xc242('0x9')],{'host':_0xc242('0xa'),'port':0x18eb});var io=require(_0xc242('0xb'))(new Redis(config[_0xc242('0x9')]));function emit(_0x11bc14,_0x3374e9,_0x47f994){io['to'](_0x11bc14)['emit'](_0x3374e9,_0x47f994);}function getCustomFields(_0x34a92f,_0x7ca4fb){var _0x19f39d={};if(_0x34a92f[_0xc242('0xc')]>0x0){_[_0xc242('0xd')](_0x34a92f,function(_0xb5712b){if(_[_0xc242('0xe')](['string',_0xc242('0xf')],_0xb5712b[_0xc242('0x10')])&&_0xb5712b[_0xc242('0x11')]){_0x19f39d[_0xb5712b[_0xc242('0x11')]]=_0xb5712b[_0xc242('0x12')][_0xc242('0x13')]();}else if(_0xb5712b[_0xc242('0x10')]==='variable'&&_0xb5712b[_0xc242('0x14')]&&_0xb5712b[_0xc242('0x11')]&&_0x7ca4fb[_0xb5712b['variableName']]){_0x19f39d[_0xb5712b[_0xc242('0x11')]]=_0x7ca4fb[_0xb5712b[_0xc242('0x14')]][_0xc242('0x13')]();}else if(_0xb5712b[_0xc242('0x10')]===_0xc242('0x15')&&_0xb5712b[_0xc242('0x16')]&&_0xb5712b[_0xc242('0x16')]['name']&&_0xb5712b[_0xc242('0x11')]&&_0x7ca4fb[_0xb5712b[_0xc242('0x16')][_0xc242('0x17')][_0xc242('0x18')]()]){_0x19f39d[_0xb5712b['idField']]=_0x7ca4fb[_0xb5712b['Variable'][_0xc242('0x17')]['toLowerCase']()][_0xc242('0x13')]();}});}return _0x19f39d;}function createTicket(_0x35de46,_0x3fd4dc,_0x14f420,_0x821f30,_0x2e1e6d,_0x21563e,_0x351241){logger[_0xc242('0x19')](_0xc242('0x1a'));var _0x52c3ba=_['merge']({'parent_id':'','assigned_user_id':_0x3fd4dc['id'],'ticketpriorities':_0xc242('0x1b'),'ticketstatus':'Open','ticket_title':intUtil[_0xc242('0x1c')](_0x821f30[_0xc242('0x1d')],_0x2e1e6d,'\x20'),'description':intUtil[_0xc242('0x1c')](_0x821f30[_0xc242('0x1e')],_0x2e1e6d,'\x0a'),'contact_id':_0x14f420['id']},getCustomFields(_0x21563e,_0x2e1e6d));var _0x408e7c={'method':_0xc242('0x1f'),'uri':util['format'](_0xc242('0x20'),_0x35de46[_0xc242('0x21')]),'form':{'operation':_0xc242('0x22'),'username':_0x35de46[_0xc242('0x23')],'sessionName':_0x351241['sessionName'],'elementType':_0xc242('0x24'),'element':JSON['stringify'](_0x52c3ba)},'json':!![]};return request(_0x408e7c)['then'](function(_0x54e67e){if(_0x54e67e[_0xc242('0x25')]){return BPromise[_0xc242('0x26')]({'id':_0x54e67e[_0xc242('0x27')]['id']});}else{throw new Error(util['format']('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0xc242('0x28')](_0x54e67e[_0xc242('0x29')])));}})[_0xc242('0x2a')](function(_0x31106d){var _0x52208e=_0x31106d[_0xc242('0x2b')]||0x1f4;logger[_0xc242('0x29')](_0xc242('0x2c'),_0xc242('0x2d'),_0x52208e,JSON[_0xc242('0x28')](_0x31106d));});}function getUser(_0x2d8538,_0x395a8d,_0x2c0985){if(intUtil[_0xc242('0x2e')](_0x395a8d)){logger['info'](_0xc242('0x2f'),_0x395a8d);return request({'method':'GET','uri':util[_0xc242('0x30')](_0xc242('0x20'),_0x2d8538[_0xc242('0x21')]),'qs':{'operation':_0xc242('0x31'),'username':_0x2d8538[_0xc242('0x23')],'sessionName':_0x2c0985[_0xc242('0x32')],'query':util[_0xc242('0x30')](_0xc242('0x33'),_0x395a8d)},'json':!![]})[_0xc242('0x34')](function(_0x59b1e0){if(_0x59b1e0['success']&&_0x59b1e0[_0xc242('0x27')][_0xc242('0xc')]){logger[_0xc242('0x19')](_0xc242('0x35'));return BPromise[_0xc242('0x26')]({'id':_0x59b1e0[_0xc242('0x27')][0x0]['id'],'email':_0x59b1e0['result'][0x0]['email1'],'name':_0x59b1e0[_0xc242('0x27')][0x0][_0xc242('0x36')]+'\x20'+_0x59b1e0[_0xc242('0x27')][_0xc242('0x37')]});}else{logger[_0xc242('0x19')](_0xc242('0x38'));return BPromise[_0xc242('0x26')]({'id':_0x2c0985['userId'],'email':_0x2d8538[_0xc242('0x23')],'name':_0xc242('0x39')});}})[_0xc242('0x2a')](function(_0xf390ea){var _0x3b7d74=_0xf390ea['statusCode']||0x1f4;logger[_0xc242('0x29')](_0xc242('0x2c'),_0xc242('0x3a'),_0x3b7d74,JSON['stringify'](_0xf390ea));});}else{logger['info'](_0xc242('0x38'));return BPromise[_0xc242('0x26')]({'id':_0x2c0985[_0xc242('0x3b')],'email':_0x2d8538[_0xc242('0x23')],'name':_0xc242('0x39')})[_0xc242('0x2a')](function(_0x382c82){var _0x4d14c9=_0x382c82[_0xc242('0x2b')]||0x1f4;logger[_0xc242('0x29')](_0xc242('0x2c'),_0xc242('0x3a'),_0x4d14c9,JSON[_0xc242('0x28')](_0x382c82));});}}function getEndUser(_0x5801e5,_0x22bb88,_0x1e0faf,_0x494581){logger['info'](_0xc242('0x3c'),_0x1e0faf);return request({'method':'GET','uri':util[_0xc242('0x30')](_0xc242('0x20'),_0x5801e5[_0xc242('0x21')]),'qs':{'operation':_0xc242('0x31'),'username':_0x5801e5[_0xc242('0x23')],'sessionName':_0x494581[_0xc242('0x32')],'query':util['format']('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;',_0x1e0faf,_0x1e0faf,_0x1e0faf,_0x1e0faf,_0x1e0faf)},'json':!![]})[_0xc242('0x34')](function(_0x1feccb){if(_0x1feccb[_0xc242('0x25')]&&_0x1feccb[_0xc242('0x27')]['length']){logger[_0xc242('0x19')](_0xc242('0x3d'));return BPromise[_0xc242('0x26')]({'id':_0x1feccb['result'][0x0]['id'],'name':_0x1feccb[_0xc242('0x27')][0x0][_0xc242('0x3e')]+'\x20'+_0x1feccb[_0xc242('0x27')][0x0][_0xc242('0x3f')],'phone':_0x1e0faf});}else{logger['info'](_0xc242('0x40'));return request({'method':'POST','uri':util[_0xc242('0x30')]('%s/webservice.php',_0x5801e5[_0xc242('0x21')]),'form':{'operation':_0xc242('0x22'),'sessionName':_0x494581[_0xc242('0x32')],'elementType':_0xc242('0x41'),'element':JSON['stringify']({'lastname':_0x22bb88,'phone':_0x1e0faf,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x4e9bce){logger[_0xc242('0x19')](_0xc242('0x42'));return BPromise[_0xc242('0x26')]({'id':_0x4e9bce[_0xc242('0x27')]['id'],'name':_0x4e9bce['result'][_0xc242('0x3f')],'phone':_0x4e9bce[_0xc242('0x27')][_0xc242('0x43')]});})[_0xc242('0x2a')](function(_0x574332){var _0x145d23=_0x574332[_0xc242('0x2b')]||0x1f4;logger[_0xc242('0x29')](_0xc242('0x2c'),_0xc242('0x44'),_0x145d23,JSON['stringify'](_0x574332));});}});}function getConnection(_0x3f259d){var _0x12a005=_0x3f259d[_0xc242('0x23')];var _0x4fcf8b=_0x3f259d[_0xc242('0x45')];return request({'method':_0xc242('0x46'),'uri':util['format'](_0xc242('0x20'),_0x3f259d['remoteUri']),'qs':{'operation':_0xc242('0x47'),'username':_0x12a005},'json':!![]})['then'](function(_0x4e060d){if(_0x4e060d[_0xc242('0x25')]){return request({'method':_0xc242('0x1f'),'uri':util[_0xc242('0x30')](_0xc242('0x20'),_0x3f259d[_0xc242('0x21')]),'form':{'operation':_0xc242('0x48'),'username':_0x12a005,'accessKey':md5(_0x4e060d[_0xc242('0x27')][_0xc242('0x49')]+_0x4fcf8b)},'json':!![]});}})[_0xc242('0x34')](function(_0x1147bd){if(_0x1147bd[_0xc242('0x25')]){return BPromise['resolve'](_0x1147bd[_0xc242('0x27')]);}else{throw new Error(util[_0xc242('0x30')](_0xc242('0x4a'),_0x3f259d['id']));}})[_0xc242('0x2a')](function(_0x385b89){var _0x43ede3=_0x385b89[_0xc242('0x2b')]||0x1f4;logger[_0xc242('0x29')](_0xc242('0x2c'),_0xc242('0x4b'),_0x43ede3,JSON['stringify'](_0x385b89));});}function request(_0x1db979){logger[_0xc242('0x19')](_0xc242('0x4c'),JSON[_0xc242('0x28')](_0x1db979));return rp(_0x1db979);}exports['queue']=function(_0x16a66f,_0xa8b4fc,_0x557747,_0x3de8f2,_0x33f2a0,_0x569d9a){var _0x2e90be,_0x502178,_0x3a223e,_0x2db3f1;_0x569d9a[_0xc242('0x21')]=intUtil[_0xc242('0x4d')](_0x569d9a['remoteUri']);if(_0x33f2a0&&_0x33f2a0[_0xc242('0x4e')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0xa8b4fc[_0xc242('0x4f')]=util[_0xc242('0x30')](_0xc242('0x50'),_0x569d9a[_0xc242('0x51')],_0xa8b4fc['uniqueid'],md5(_0xa8b4fc[_0xc242('0x52')]));}else{_0xa8b4fc[_0xc242('0x4f')]='';}return getConnection(_0x569d9a)[_0xc242('0x34')](function(_0x21b926){_0x2db3f1=_0x21b926;return getUser(_0x569d9a,_0x3de8f2[_0xc242('0x53')],_0x2db3f1);})[_0xc242('0x34')](function(_0x27d07a){_0x2e90be=_0x27d07a;logger[_0xc242('0x19')](_0xc242('0x54'),_0x2e90be['id']);return getEndUser(_0x569d9a,_0xa8b4fc[_0xc242('0x55')],_0xa8b4fc['calleridnum'],_0x2db3f1);})['then'](function(_0x53f640){_0x502178=_0x53f640;logger['info']('The\x20Enduser\x20ID\x20is:',_0x502178['id']);return createTicket(_0x569d9a,_0x2e90be,_0x502178,_0x557747,_0xa8b4fc,_0x557747[_0xc242('0x56')],_0x2db3f1);})[_0xc242('0x34')](function(_0x2631de){_0x3a223e=_0x2631de;logger['info'](_0xc242('0x57'));logger['info'](_0xc242('0x58'),_0x3a223e['id']);var _0x2952b0=util[_0xc242('0x30')](_0xc242('0x59'),_0x569d9a[_0xc242('0x21')],_['split'](_0x3a223e['id'],'x')[0x1]);logger[_0xc242('0x19')](_0xc242('0x5a'),_0xc242('0x5b'));emit(util['format'](_0xc242('0x5c'),_0x3de8f2[_0xc242('0x17')]),_0xc242('0x5d'),{'uri':_0x2952b0});})[_0xc242('0x2a')](function(_0x4b044a){logger[_0xc242('0x29')](_0xc242('0x5a'),JSON[_0xc242('0x28')](_0x4b044a));});};exports[_0xc242('0x5e')]=function(_0x22823a,_0x82ebc8,_0x5d126d,_0x426753,_0x5aad64,_0x17cb2c,_0x48b46b){var _0x1b024a,_0x1a6262,_0x2ca9f3,_0x3796ae;_0x17cb2c[_0xc242('0x21')]=intUtil['stripTrailingSlash'](_0x17cb2c[_0xc242('0x21')]);_0x17cb2c['serverUrl']=intUtil[_0xc242('0x4d')](_0x17cb2c[_0xc242('0x51')]);if(_0x48b46b&&_0x48b46b[_0xc242('0x5f')]&&_0x48b46b['recordingFormat']!=='none'){logger[_0xc242('0x19')](_0xc242('0x60'),_0xc242('0x61'));_0x82ebc8[_0xc242('0x4f')]=util[_0xc242('0x30')](_0xc242('0x50'),_0x17cb2c['serverUrl'],_0x82ebc8['uniqueid'],md5(_0x82ebc8[_0xc242('0x52')]));}return getConnection(_0x17cb2c)['then'](function(_0x51b43e){_0x3796ae=_0x51b43e;return getUser(_0x17cb2c,_0x426753[_0xc242('0x53')],_0x3796ae);})[_0xc242('0x34')](function(_0x5b2f7a){_0x1b024a=_0x5b2f7a;logger[_0xc242('0x19')](_0xc242('0x54'),_0x1b024a['id']);return getEndUser(_0x17cb2c,_0x82ebc8['destcalleridname'],_0x82ebc8[_0xc242('0x62')],_0x3796ae);})[_0xc242('0x34')](function(_0x3123a6){_0x1a6262=_0x3123a6;logger['info'](_0xc242('0x63'),_0x1a6262['id']);return createTicket(_0x17cb2c,_0x1b024a,_0x1a6262,_0x5d126d,_0x82ebc8,_0x5d126d[_0xc242('0x56')],_0x3796ae);})[_0xc242('0x34')](function(_0x217b60){_0x2ca9f3=_0x217b60;logger['info']('Ticket\x20created!');logger[_0xc242('0x19')]('The\x20Ticket\x20ID\x20is:',_0x2ca9f3['id']);var _0x419bf2=util[_0xc242('0x30')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x17cb2c['remoteUri'],_[_0xc242('0x64')](_0x2ca9f3['id'],'x')[0x1]);logger[_0xc242('0x19')](_0xc242('0x60'),_0xc242('0x5b'));emit(util[_0xc242('0x30')](_0xc242('0x5c'),_0x426753['name']),_0xc242('0x5d'),{'uri':_0x419bf2});})['catch'](function(_0x5e03c0){logger[_0xc242('0x29')]('[OUTBOUND]',JSON['stringify'](_0x5e03c0));});};exports[_0xc242('0x65')]=function(_0x2828a3,_0x143be1,_0x43e6a9,_0x153729,_0x88a63e,_0x5983db){var _0x4a2deb,_0x317caf,_0x438170,_0x4b8fe8;_0x5983db[_0xc242('0x21')]=intUtil[_0xc242('0x4d')](_0x5983db[_0xc242('0x21')]);_0x5983db[_0xc242('0x51')]=intUtil[_0xc242('0x4d')](_0x5983db[_0xc242('0x51')]);if(_0x88a63e&&_0x88a63e[_0xc242('0x4e')]){logger[_0xc242('0x19')]('['+_0x143be1[_0xc242('0x66')][_0xc242('0x67')]()+']',_0xc242('0x61'));_0x143be1['recordingURL']=util[_0xc242('0x30')](_0xc242('0x50'),_0x5983db[_0xc242('0x51')],_0x143be1[_0xc242('0x52')],md5(_0x143be1[_0xc242('0x52')]));}else{_0x143be1[_0xc242('0x4f')]='';}return getConnection(_0x5983db)[_0xc242('0x34')](function(_0x376921){_0x4b8fe8=_0x376921;return getUser(_0x5983db,'',_0x4b8fe8);})['then'](function(_0x3c6efb){_0x4a2deb=_0x3c6efb;logger[_0xc242('0x19')](_0xc242('0x54'),_0x4a2deb['id']);return getEndUser(_0x5983db,_0x143be1['calleridname'],_0x143be1[_0xc242('0x68')],_0x4b8fe8);})[_0xc242('0x34')](function(_0x2866a0){_0x317caf=_0x2866a0;logger[_0xc242('0x19')]('The\x20Enduser\x20ID\x20is:',_0x317caf['id']);return createTicket(_0x5983db,_0x4a2deb,_0x317caf,_0x43e6a9,_0x143be1,_0x43e6a9[_0xc242('0x56')],_0x4b8fe8);})[_0xc242('0x34')](function(_0x4aebc2){_0x438170=_0x4aebc2;logger[_0xc242('0x19')](_0xc242('0x57'));logger[_0xc242('0x19')](_0xc242('0x58'),_0x438170['id']);})[_0xc242('0x2a')](function(_0x24cf61){logger[_0xc242('0x29')]('['+_0x143be1[_0xc242('0x66')][_0xc242('0x67')]()+']',JSON['stringify'](_0x24cf61));});}; \ No newline at end of file +var _0xb12a=['lastevent','toUpperCase','Recording\x20is\x20enabled!','calleridname','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','socket.io-emitter','emit','length','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','create','username','sessionName','HelpDesk','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','catch','statusCode','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','format','%s/webservice.php','remoteUri','query','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','[vTiger],\x20%s,\x20%s,\x20%s','getUser','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','Contacts','Enduser\x20created.','accessKey','getchallenge','POST','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','The\x20Enduser\x20ID\x20is:'];(function(_0x5f083d,_0x24edd9){var _0x29a0f2=function(_0x1064d9){while(--_0x1064d9){_0x5f083d['push'](_0x5f083d['shift']());}};_0x29a0f2(++_0x24edd9);}(_0xb12a,0x145));var _0xab12=function(_0x5ebad0,_0x32efad){_0x5ebad0=_0x5ebad0-0x0;var _0x1e838d=_0xb12a[_0x5ebad0];return _0x1e838d;};'use strict';var _=require(_0xab12('0x0'));var rp=require(_0xab12('0x1'));var BPromise=require(_0xab12('0x2'));var md5=require(_0xab12('0x3'));var util=require(_0xab12('0x4'));var Redis=require(_0xab12('0x5'));var intUtil=require(_0xab12('0x6'));var config=require(_0xab12('0x7'));var logger=require(_0xab12('0x8'))(_0xab12('0x9'));config['redis']=_['defaults'](config[_0xab12('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xab12('0xb'))(new Redis(config['redis']));function emit(_0x2bcb8f,_0x478469,_0x186896){io['to'](_0x2bcb8f)[_0xab12('0xc')](_0x478469,_0x186896);}function getCustomFields(_0x4c3f90,_0x46dc59){var _0x8fb3d={};if(_0x4c3f90[_0xab12('0xd')]>0x0){_[_0xab12('0xe')](_0x4c3f90,function(_0x389d07){if(_['includes']([_0xab12('0xf'),_0xab12('0x10')],_0x389d07[_0xab12('0x11')])&&_0x389d07[_0xab12('0x12')]){_0x8fb3d[_0x389d07[_0xab12('0x12')]]=_0x389d07[_0xab12('0x13')][_0xab12('0x14')]();}else if(_0x389d07[_0xab12('0x11')]===_0xab12('0x15')&&_0x389d07[_0xab12('0x16')]&&_0x389d07[_0xab12('0x12')]&&_0x46dc59[_0x389d07[_0xab12('0x16')]]){_0x8fb3d[_0x389d07['idField']]=_0x46dc59[_0x389d07[_0xab12('0x16')]][_0xab12('0x14')]();}else if(_0x389d07[_0xab12('0x11')]===_0xab12('0x17')&&_0x389d07[_0xab12('0x18')]&&_0x389d07['Variable'][_0xab12('0x19')]&&_0x389d07[_0xab12('0x12')]&&_0x46dc59[_0x389d07[_0xab12('0x18')][_0xab12('0x19')]['toLowerCase']()]){_0x8fb3d[_0x389d07[_0xab12('0x12')]]=_0x46dc59[_0x389d07[_0xab12('0x18')][_0xab12('0x19')][_0xab12('0x1a')]()][_0xab12('0x14')]();}});}return _0x8fb3d;}function createTicket(_0x4cd4e9,_0x4a52ef,_0x3ce2d0,_0x4ff4aa,_0x382eeb,_0x1bdf68,_0x4395cb){logger[_0xab12('0x1b')](_0xab12('0x1c'));var _0x5e9c40=_[_0xab12('0x1d')]({'parent_id':'','assigned_user_id':_0x4a52ef['id'],'ticketpriorities':_0xab12('0x1e'),'ticketstatus':_0xab12('0x1f'),'ticket_title':intUtil[_0xab12('0x20')](_0x4ff4aa[_0xab12('0x21')],_0x382eeb,'\x20'),'description':intUtil[_0xab12('0x20')](_0x4ff4aa[_0xab12('0x22')],_0x382eeb,'\x0a'),'contact_id':_0x3ce2d0['id']},getCustomFields(_0x1bdf68,_0x382eeb));var _0x48cc30={'method':'POST','uri':util['format']('%s/webservice.php',_0x4cd4e9['remoteUri']),'form':{'operation':_0xab12('0x23'),'username':_0x4cd4e9[_0xab12('0x24')],'sessionName':_0x4395cb[_0xab12('0x25')],'elementType':_0xab12('0x26'),'element':JSON['stringify'](_0x5e9c40)},'json':!![]};return request(_0x48cc30)[_0xab12('0x27')](function(_0x3f1212){if(_0x3f1212[_0xab12('0x28')]){return BPromise[_0xab12('0x29')]({'id':_0x3f1212[_0xab12('0x2a')]['id']});}else{throw new Error(util['format'](_0xab12('0x2b'),JSON[_0xab12('0x2c')](_0x3f1212[_0xab12('0x2d')])));}})[_0xab12('0x2e')](function(_0x4bdd96){var _0x1988b4=_0x4bdd96[_0xab12('0x2f')]||0x1f4;logger[_0xab12('0x2d')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xab12('0x30'),_0x1988b4,JSON[_0xab12('0x2c')](_0x4bdd96));});}function getUser(_0x1a3465,_0x346105,_0x4ffb0b){if(intUtil[_0xab12('0x31')](_0x346105)){logger['info'](_0xab12('0x32'),_0x346105);return request({'method':_0xab12('0x33'),'uri':util[_0xab12('0x34')](_0xab12('0x35'),_0x1a3465[_0xab12('0x36')]),'qs':{'operation':_0xab12('0x37'),'username':_0x1a3465[_0xab12('0x24')],'sessionName':_0x4ffb0b[_0xab12('0x25')],'query':util[_0xab12('0x34')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x346105)},'json':!![]})[_0xab12('0x27')](function(_0x21f3ce){if(_0x21f3ce[_0xab12('0x28')]&&_0x21f3ce[_0xab12('0x2a')][_0xab12('0xd')]){logger[_0xab12('0x1b')]('Agent\x20found!');return BPromise[_0xab12('0x29')]({'id':_0x21f3ce[_0xab12('0x2a')][0x0]['id'],'email':_0x21f3ce[_0xab12('0x2a')][0x0][_0xab12('0x38')],'name':_0x21f3ce[_0xab12('0x2a')][0x0][_0xab12('0x39')]+'\x20'+_0x21f3ce['result'][_0xab12('0x3a')]});}else{logger['info'](_0xab12('0x3b'));return BPromise[_0xab12('0x29')]({'id':_0x4ffb0b[_0xab12('0x3c')],'email':_0x1a3465[_0xab12('0x24')],'name':_0xab12('0x3d')});}})[_0xab12('0x2e')](function(_0x1f04ec){var _0x471234=_0x1f04ec[_0xab12('0x2f')]||0x1f4;logger[_0xab12('0x2d')](_0xab12('0x3e'),_0xab12('0x3f'),_0x471234,JSON[_0xab12('0x2c')](_0x1f04ec));});}else{logger[_0xab12('0x1b')](_0xab12('0x3b'));return BPromise[_0xab12('0x29')]({'id':_0x4ffb0b[_0xab12('0x3c')],'email':_0x1a3465[_0xab12('0x24')],'name':_0xab12('0x3d')})[_0xab12('0x2e')](function(_0x169591){var _0x462ee1=_0x169591[_0xab12('0x2f')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x462ee1,JSON[_0xab12('0x2c')](_0x169591));});}}function getEndUser(_0x3e0af1,_0x88cb09,_0x47c520,_0xea882e){logger[_0xab12('0x1b')](_0xab12('0x40'),_0x47c520);return request({'method':_0xab12('0x33'),'uri':util[_0xab12('0x34')](_0xab12('0x35'),_0x3e0af1[_0xab12('0x36')]),'qs':{'operation':_0xab12('0x37'),'username':_0x3e0af1[_0xab12('0x24')],'sessionName':_0xea882e['sessionName'],'query':util[_0xab12('0x34')](_0xab12('0x41'),_0x47c520,_0x47c520,_0x47c520,_0x47c520,_0x47c520)},'json':!![]})[_0xab12('0x27')](function(_0x2ef39a){if(_0x2ef39a[_0xab12('0x28')]&&_0x2ef39a['result'][_0xab12('0xd')]){logger[_0xab12('0x1b')](_0xab12('0x42'));return BPromise['resolve']({'id':_0x2ef39a[_0xab12('0x2a')][0x0]['id'],'name':_0x2ef39a[_0xab12('0x2a')][0x0][_0xab12('0x43')]+'\x20'+_0x2ef39a['result'][0x0][_0xab12('0x44')],'phone':_0x47c520});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util[_0xab12('0x34')]('%s/webservice.php',_0x3e0af1[_0xab12('0x36')]),'form':{'operation':_0xab12('0x23'),'sessionName':_0xea882e['sessionName'],'elementType':_0xab12('0x45'),'element':JSON['stringify']({'lastname':_0x88cb09,'phone':_0x47c520,'assigned_user_id':'\x20'})},'json':!![]})[_0xab12('0x27')](function(_0x1674e7){logger['info'](_0xab12('0x46'));return BPromise['resolve']({'id':_0x1674e7[_0xab12('0x2a')]['id'],'name':_0x1674e7[_0xab12('0x2a')][_0xab12('0x44')],'phone':_0x1674e7[_0xab12('0x2a')]['phone']});})['catch'](function(_0x11b7ba){var _0x3cc1c6=_0x11b7ba['statusCode']||0x1f4;logger[_0xab12('0x2d')](_0xab12('0x3e'),'getEndUser',_0x3cc1c6,JSON[_0xab12('0x2c')](_0x11b7ba));});}});}function getConnection(_0x14a96a){var _0x1a29ab=_0x14a96a[_0xab12('0x24')];var _0x3de648=_0x14a96a[_0xab12('0x47')];return request({'method':_0xab12('0x33'),'uri':util['format'](_0xab12('0x35'),_0x14a96a[_0xab12('0x36')]),'qs':{'operation':_0xab12('0x48'),'username':_0x1a29ab},'json':!![]})['then'](function(_0x1fb944){if(_0x1fb944['success']){return request({'method':_0xab12('0x49'),'uri':util[_0xab12('0x34')](_0xab12('0x35'),_0x14a96a[_0xab12('0x36')]),'form':{'operation':_0xab12('0x4a'),'username':_0x1a29ab,'accessKey':md5(_0x1fb944['result'][_0xab12('0x4b')]+_0x3de648)},'json':!![]});}})[_0xab12('0x27')](function(_0x46de13){if(_0x46de13[_0xab12('0x28')]){return BPromise[_0xab12('0x29')](_0x46de13[_0xab12('0x2a')]);}else{throw new Error(util[_0xab12('0x34')](_0xab12('0x4c'),_0x14a96a['id']));}})[_0xab12('0x2e')](function(_0x4bc751){var _0x522cf6=_0x4bc751['statusCode']||0x1f4;logger[_0xab12('0x2d')](_0xab12('0x3e'),_0xab12('0x4d'),_0x522cf6,JSON[_0xab12('0x2c')](_0x4bc751));});}function request(_0x5e4e60){logger[_0xab12('0x1b')](_0xab12('0x4e'),JSON[_0xab12('0x2c')](_0x5e4e60));return rp(_0x5e4e60);}exports[_0xab12('0x4f')]=function(_0x4ca825,_0x57ed63,_0x2ab8f9,_0x5f53fe,_0x532177,_0x49f410){var _0x1cf6f5,_0x4b4ac5,_0x3caa1a,_0x58617b;_0x49f410[_0xab12('0x36')]=intUtil['stripTrailingSlash'](_0x49f410[_0xab12('0x36')]);if(_0x532177&&_0x532177[_0xab12('0x50')]){logger[_0xab12('0x1b')](_0xab12('0x51'),'Recording\x20is\x20enabled!');_0x57ed63['recordingURL']=util[_0xab12('0x34')](_0xab12('0x52'),_0x49f410[_0xab12('0x53')],_0x57ed63[_0xab12('0x54')],md5(_0x57ed63[_0xab12('0x54')]));}else{_0x57ed63[_0xab12('0x55')]='';}return getConnection(_0x49f410)[_0xab12('0x27')](function(_0x121553){_0x58617b=_0x121553;return getUser(_0x49f410,_0x5f53fe[_0xab12('0x56')],_0x58617b);})[_0xab12('0x27')](function(_0xf0d53d){_0x1cf6f5=_0xf0d53d;logger[_0xab12('0x1b')]('The\x20User\x20ID\x20is:',_0x1cf6f5['id']);return getEndUser(_0x49f410,_0x57ed63['calleridname'],_0x57ed63[_0xab12('0x57')],_0x58617b);})[_0xab12('0x27')](function(_0x253172){_0x4b4ac5=_0x253172;logger[_0xab12('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x4b4ac5['id']);return createTicket(_0x49f410,_0x1cf6f5,_0x4b4ac5,_0x2ab8f9,_0x57ed63,_0x2ab8f9[_0xab12('0x58')],_0x58617b);})[_0xab12('0x27')](function(_0x337227){_0x3caa1a=_0x337227;logger[_0xab12('0x1b')](_0xab12('0x59'));logger[_0xab12('0x1b')](_0xab12('0x5a'),_0x3caa1a['id']);var _0x1cfcde=util[_0xab12('0x34')](_0xab12('0x5b'),_0x49f410[_0xab12('0x36')],_[_0xab12('0x5c')](_0x3caa1a['id'],'x')[0x1]);logger[_0xab12('0x1b')](_0xab12('0x51'),_0xab12('0x5d'));emit(util[_0xab12('0x34')]('user:%s',_0x5f53fe[_0xab12('0x19')]),_0xab12('0x5e'),{'uri':_0x1cfcde});})[_0xab12('0x2e')](function(_0x2fa298){logger['error'](_0xab12('0x51'),JSON['stringify'](_0x2fa298));});};exports[_0xab12('0x5f')]=function(_0x1ef9f4,_0x511a1c,_0x136e0e,_0x509511,_0x464f16,_0x545948,_0x4262ad){var _0x3128e3,_0x599bfc,_0x5a6ccf,_0x356740;_0x545948[_0xab12('0x36')]=intUtil[_0xab12('0x60')](_0x545948[_0xab12('0x36')]);_0x545948[_0xab12('0x53')]=intUtil[_0xab12('0x60')](_0x545948[_0xab12('0x53')]);if(_0x4262ad&&_0x4262ad[_0xab12('0x61')]&&_0x4262ad[_0xab12('0x61')]!==_0xab12('0x62')){logger['info'](_0xab12('0x63'),'Recording\x20is\x20enabled!');_0x511a1c['recordingURL']=util[_0xab12('0x34')](_0xab12('0x52'),_0x545948[_0xab12('0x53')],_0x511a1c[_0xab12('0x54')],md5(_0x511a1c[_0xab12('0x54')]));}return getConnection(_0x545948)['then'](function(_0x5b9d96){_0x356740=_0x5b9d96;return getUser(_0x545948,_0x509511['email'],_0x356740);})['then'](function(_0x22ea21){_0x3128e3=_0x22ea21;logger[_0xab12('0x1b')](_0xab12('0x64'),_0x3128e3['id']);return getEndUser(_0x545948,_0x511a1c[_0xab12('0x65')],_0x511a1c['destcalleridnum'],_0x356740);})[_0xab12('0x27')](function(_0x4296c7){_0x599bfc=_0x4296c7;logger['info'](_0xab12('0x66'),_0x599bfc['id']);return createTicket(_0x545948,_0x3128e3,_0x599bfc,_0x136e0e,_0x511a1c,_0x136e0e['Fields'],_0x356740);})[_0xab12('0x27')](function(_0x252190){_0x5a6ccf=_0x252190;logger['info'](_0xab12('0x59'));logger[_0xab12('0x1b')](_0xab12('0x5a'),_0x5a6ccf['id']);var _0x64e6cd=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x545948[_0xab12('0x36')],_[_0xab12('0x5c')](_0x5a6ccf['id'],'x')[0x1]);logger[_0xab12('0x1b')](_0xab12('0x63'),_0xab12('0x5d'));emit(util[_0xab12('0x34')]('user:%s',_0x509511[_0xab12('0x19')]),_0xab12('0x5e'),{'uri':_0x64e6cd});})['catch'](function(_0x4d1381){logger[_0xab12('0x2d')]('[OUTBOUND]',JSON[_0xab12('0x2c')](_0x4d1381));});};exports['unmanaged']=function(_0xba1887,_0x2ec8c6,_0x27dd6b,_0x3cd4e1,_0x5dde58,_0x548815){var _0x5ec6e2,_0x3917a7,_0x5d8c75,_0x3c36f9;_0x548815['remoteUri']=intUtil[_0xab12('0x60')](_0x548815[_0xab12('0x36')]);_0x548815[_0xab12('0x53')]=intUtil[_0xab12('0x60')](_0x548815[_0xab12('0x53')]);if(_0x5dde58&&_0x5dde58['monitor_format']){logger[_0xab12('0x1b')]('['+_0x2ec8c6[_0xab12('0x67')][_0xab12('0x68')]()+']',_0xab12('0x69'));_0x2ec8c6[_0xab12('0x55')]=util[_0xab12('0x34')](_0xab12('0x52'),_0x548815[_0xab12('0x53')],_0x2ec8c6[_0xab12('0x54')],md5(_0x2ec8c6[_0xab12('0x54')]));}else{_0x2ec8c6[_0xab12('0x55')]='';}return getConnection(_0x548815)['then'](function(_0x5454c5){_0x3c36f9=_0x5454c5;return getUser(_0x548815,'',_0x3c36f9);})[_0xab12('0x27')](function(_0x11d7ee){_0x5ec6e2=_0x11d7ee;logger[_0xab12('0x1b')]('The\x20User\x20ID\x20is:',_0x5ec6e2['id']);return getEndUser(_0x548815,_0x2ec8c6[_0xab12('0x6a')],_0x2ec8c6[_0xab12('0x57')],_0x3c36f9);})[_0xab12('0x27')](function(_0x8c9d0f){_0x3917a7=_0x8c9d0f;logger[_0xab12('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x3917a7['id']);return createTicket(_0x548815,_0x5ec6e2,_0x3917a7,_0x27dd6b,_0x2ec8c6,_0x27dd6b[_0xab12('0x58')],_0x3c36f9);})['then'](function(_0x4735e5){_0x5d8c75=_0x4735e5;logger[_0xab12('0x1b')](_0xab12('0x59'));logger[_0xab12('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x5d8c75['id']);})[_0xab12('0x2e')](function(_0x8328ec){logger[_0xab12('0x2d')]('['+_0x2ec8c6[_0xab12('0x67')]['toUpperCase']()+']',JSON[_0xab12('0x2c')](_0x8328ec));});}; \ 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 51c1759..22e710e 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 _0x3960=['recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','end-user','first','Caller\x20-\x20%s','authType','password','token','%s/token:%s','username','Basic\x20%s','debug','stringify','GET','map','includes','string','picklist','type','nameField','customField','content','toString','custom_fields','push','idField','variableName','Variable','toLowerCase','queue','serverUrl','stripTrailingSlash','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','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound'];(function(_0x267be3,_0x18ef5f){var _0x57fe29=function(_0x5bb754){while(--_0x5bb754){_0x267be3['push'](_0x267be3['shift']());}};_0x57fe29(++_0x18ef5f);}(_0x3960,0x77));var _0x0396=function(_0x3660ea,_0x38ea53){_0x3660ea=_0x3660ea-0x0;var _0x18f81a=_0x3960[_0x3660ea];return _0x18f81a;};'use strict';var _=require(_0x0396('0x0'));var rp=require(_0x0396('0x1'));var md5=require('md5');var util=require(_0x0396('0x2'));var Redis=require(_0x0396('0x3'));var intUtil=require(_0x0396('0x4'));var config=require(_0x0396('0x5'));var logger=require('../../../../config/logger')(_0x0396('0x6'));config[_0x0396('0x7')]=_[_0x0396('0x8')](config[_0x0396('0x7')],{'host':_0x0396('0x9'),'port':0x18eb});var io=require(_0x0396('0xa'))(new Redis(config[_0x0396('0x7')]));function emit(_0xc0ead3,_0x1df84d,_0x4f9ad1){io['to'](_0xc0ead3)[_0x0396('0xb')](_0x1df84d,_0x4f9ad1);}var headers={'Content-Type':_0x0396('0xc'),'Accept':_0x0396('0xc')};function getTicket(_0x3d4edd,_0xc0fbea,_0x317098,_0x3b0a49,_0x1e8e58){logger[_0x0396('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x0396('0xe'),_0x3d4edd[_0x0396('0xf')]),'method':'POST','body':{'ticket':_[_0x0396('0x10')]({'requester_id':_0x317098['id'],'submitter_id':_0xc0fbea?_0xc0fbea['id']:undefined,'assignee_id':_0xc0fbea?_0xc0fbea['id']:undefined,'tags':getTags(_0x3b0a49[_0x0396('0x11')],_0x0396('0x12')),'subject':intUtil[_0x0396('0x13')](_0x3b0a49[_0x0396('0x14')],_0x1e8e58,'\x20'),'description':intUtil[_0x0396('0x13')](_0x3b0a49[_0x0396('0x15')],_0x1e8e58,'\x0a'),'comment':{'public':![],'body':intUtil[_0x0396('0x13')](_0x3b0a49['Descriptions'],_0x1e8e58,'\x0a')}},getCustomFields(_0x3b0a49['Fields'],_0x1e8e58))}})[_0x0396('0x16')](function(_0x12fb2a){logger[_0x0396('0xd')]('Ticket\x20created!');return _0x12fb2a[_0x0396('0x17')];});}function getUser(_0x4bf556,_0x356fa2){if(intUtil[_0x0396('0x18')](_0x356fa2)){logger['info'](_0x0396('0x19'),_0x356fa2);return request({'uri':util[_0x0396('0x1a')](_0x0396('0x1b'),_0x4bf556[_0x0396('0xf')]),'qs':{'query':util[_0x0396('0x1a')]('type:user\x20role:agent\x20email:%s',_0x356fa2)}})[_0x0396('0x16')](function(_0x13bc44){if(_0x13bc44['count']){logger[_0x0396('0xd')](_0x0396('0x1c'));return _[_0x0396('0x1d')](_0x13bc44['results'],{'email':_0x356fa2,'role':_0x0396('0x1e')});}else{logger[_0x0396('0xd')](_0x0396('0x1f'));return request({'uri':util[_0x0396('0x1a')](_0x0396('0x20'),_0x4bf556[_0x0396('0xf')])})[_0x0396('0x16')](function(_0x9d1179){logger[_0x0396('0xd')](_0x0396('0x21'));return _0x9d1179['user'];});}});}else{logger[_0x0396('0xd')](_0x0396('0x1f'));return request({'uri':util['format'](_0x0396('0x20'),_0x4bf556[_0x0396('0xf')])})[_0x0396('0x16')](function(_0x4fc332){logger['info'](_0x0396('0x21'));return _0x4fc332['user'];});}}function getEndUser(_0x456fa5,_0x5b8e0f,_0x396bb0){logger[_0x0396('0xd')](_0x0396('0x22'),_0x396bb0);return request({'uri':util[_0x0396('0x1a')](_0x0396('0x1b'),_0x456fa5[_0x0396('0xf')]),'qs':{'query':util['format'](_0x0396('0x23'),_0x396bb0)}})['then'](function(_0x3a7b76){var _0x5e578f;if(_0x3a7b76[_0x0396('0x24')][_0x0396('0x25')]){_0x3a7b76[_0x0396('0x24')]=_['filter'](_0x3a7b76[_0x0396('0x24')],{'suspended':![],'role':_0x0396('0x26')});if(_0x3a7b76[_0x0396('0x24')][_0x0396('0x25')]){_0x5e578f=_[_0x0396('0x27')](_0x3a7b76[_0x0396('0x24')]);}}if(_0x5e578f){logger[_0x0396('0xd')]('Enduser\x20found!');return _0x5e578f;}else{logger[_0x0396('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/users.json',_0x456fa5[_0x0396('0xf')]),'method':'POST','body':{'user':{'role':_0x0396('0x26'),'name':util[_0x0396('0x1a')](_0x0396('0x28'),_0x5b8e0f||_0x396bb0),'phone':_0x396bb0}}})['then'](function(_0x3e5d89){logger[_0x0396('0xd')]('Enduser\x20created.');return _0x3e5d89['user'];});}});}function getAuth(_0x240bb9){var _0x2b12e6;if(_0x240bb9[_0x0396('0x29')]===_0x0396('0x2a')){_0x2b12e6=util['format']('%s:%s',_0x240bb9['username'],_0x240bb9[_0x0396('0x2a')]);}else if(_0x240bb9['authType']===_0x0396('0x2b')){_0x2b12e6=util[_0x0396('0x1a')](_0x0396('0x2c'),_0x240bb9[_0x0396('0x2d')],_0x240bb9['token']);}return util[_0x0396('0x1a')](_0x0396('0x2e'),new Buffer(_0x2b12e6)['toString']('base64'));}function request(_0x3cc144){logger[_0x0396('0x2f')]('[HTTP]',JSON[_0x0396('0x30')](_0x3cc144));return rp(_[_0x0396('0x8')](_0x3cc144,{'method':_0x0396('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x49e81d,_0x40d8df){var _0x34f987=[];if(_0x49e81d&&_0x49e81d[_0x0396('0x25')]>0x0){_0x34f987=_[_0x0396('0x32')](_0x49e81d,_0x40d8df);}return _0x34f987;}function getCustomFields(_0x57eefb,_0x272c43){var _0x2fe358=[];var _0x4476e7={'custom_fields':[]};if(_0x57eefb[_0x0396('0x25')]>0x0){_['forEach'](_0x57eefb,function(_0x4c7a10){if(_[_0x0396('0x33')]([_0x0396('0x34'),_0x0396('0x35')],_0x4c7a10[_0x0396('0x36')])&&_0x4c7a10[_0x0396('0x37')]&&!_0x4c7a10[_0x0396('0x38')]){_0x4476e7[_0x4c7a10[_0x0396('0x37')]['toLowerCase']()]=_0x4c7a10[_0x0396('0x39')][_0x0396('0x3a')]();}else if(_['includes']([_0x0396('0x34'),_0x0396('0x35')],_0x4c7a10[_0x0396('0x36')])&&_0x4c7a10['idField']&&_0x4c7a10['customField']){_0x4476e7[_0x0396('0x3b')][_0x0396('0x3c')]({'id':_0x4c7a10[_0x0396('0x3d')],'value':_0x4c7a10['content'][_0x0396('0x3a')]()});}else if(_0x4c7a10['type']==='variable'&&_0x4c7a10[_0x0396('0x3e')]&&_0x4c7a10[_0x0396('0x3d')]&&_0x4c7a10[_0x0396('0x38')]){_0x272c43[_0x4c7a10[_0x0396('0x3e')]]&&_0x4476e7[_0x0396('0x3b')]['push']({'id':_0x4c7a10[_0x0396('0x3d')],'value':_0x272c43[_0x4c7a10[_0x0396('0x3e')]]['toString']()});}else if(_0x4c7a10['type']==='customVariable'&&_0x4c7a10[_0x0396('0x3f')]&&_0x4c7a10['Variable']['name']&&_0x4c7a10['idField']&&_0x4c7a10[_0x0396('0x38')]){_0x272c43[_0x4c7a10['Variable'][_0x0396('0x12')][_0x0396('0x40')]()]&&_0x4476e7[_0x0396('0x3b')][_0x0396('0x3c')]({'id':_0x4c7a10['idField'],'value':_0x272c43[_0x4c7a10[_0x0396('0x3f')]['name'][_0x0396('0x40')]()][_0x0396('0x3a')]()});}});}return _0x4476e7;}exports[_0x0396('0x41')]=function(_0x4110f4,_0x1ea159,_0x300272,_0x12691d,_0x352956,_0x42b706){var _0x7529aa,_0x543bdd;_0x42b706[_0x0396('0xf')]=intUtil['stripTrailingSlash'](_0x42b706[_0x0396('0xf')]);_0x42b706[_0x0396('0x42')]=intUtil[_0x0396('0x43')](_0x42b706['serverUrl']);if(_0x352956&&_0x352956[_0x0396('0x44')]){logger[_0x0396('0xd')](_0x0396('0x45'),_0x0396('0x46'));_0x1ea159[_0x0396('0x47')]=util[_0x0396('0x1a')](_0x0396('0x48'),_0x42b706[_0x0396('0x42')],_0x1ea159[_0x0396('0x49')],md5(_0x1ea159[_0x0396('0x49')]));}else{_0x1ea159[_0x0396('0x47')]='';}headers[_0x0396('0x4a')]=getAuth(_0x42b706);return getUser(_0x42b706,_0x12691d[_0x0396('0x4b')])[_0x0396('0x16')](function(_0x3f64f0){_0x7529aa=_0x3f64f0;logger[_0x0396('0xd')](_0x0396('0x4c'),_0x7529aa['id']);return getEndUser(_0x42b706,_0x1ea159[_0x0396('0x4d')],_0x1ea159[_0x0396('0x4e')]);})[_0x0396('0x16')](function(_0x7369c2){_0x543bdd=_0x7369c2;logger[_0x0396('0xd')](_0x0396('0x4f'),_0x543bdd['id']);return getTicket(_0x42b706,_0x7529aa,_0x543bdd,_0x300272,_0x1ea159);})['then'](function(_0x1ea4f9){if(_0x1ea4f9){logger['info'](_0x0396('0x50'),_0x1ea4f9['id']);switch(_0x42b706[_0x0396('0x36')]){case _0x0396('0x51'):logger[_0x0396('0xd')](_0x0396('0x45'),_0x0396('0x52'));return request({'uri':util[_0x0396('0x1a')](_0x0396('0x53'),_0x42b706[_0x0396('0xf')],_0x7529aa['id'],_0x1ea4f9['id']),'method':_0x0396('0x54')});case'newTab':logger['info'](_0x0396('0x45'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0396('0x1a')](_0x0396('0x55'),_0x12691d[_0x0396('0x12')]),_0x0396('0x56'),{'uri':util[_0x0396('0x1a')](_0x0396('0x57'),_0x42b706[_0x0396('0xf')][_0x0396('0x58')]('/api/v2',''),_0x1ea4f9['id'])});break;default:logger['error'](_0x0396('0x45'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x0396('0x59')](function(_0x3c4002){logger[_0x0396('0x5a')](_0x0396('0x5b'),util['inspect'](_0x3c4002,{'showHidden':!![],'depth':null}));});};exports[_0x0396('0x5c')]=function(_0x40bd73,_0x3023a2,_0x1efcec,_0x4bdf36,_0x13bf0d,_0x45ceff,_0x335843){var _0x2412fb,_0x1ee989;_0x45ceff['remoteUri']=intUtil['stripTrailingSlash'](_0x45ceff[_0x0396('0xf')]);_0x45ceff['serverUrl']=intUtil[_0x0396('0x43')](_0x45ceff[_0x0396('0x42')]);if(_0x335843&&_0x335843[_0x0396('0x5d')]&&_0x335843[_0x0396('0x5d')]!==_0x0396('0x5e')){logger[_0x0396('0xd')](_0x0396('0x5f'),_0x0396('0x46'));_0x3023a2[_0x0396('0x47')]=util[_0x0396('0x1a')](_0x0396('0x48'),_0x45ceff['serverUrl'],_0x3023a2[_0x0396('0x49')],md5(_0x3023a2[_0x0396('0x49')]));}headers[_0x0396('0x4a')]=getAuth(_0x45ceff);return getUser(_0x45ceff,_0x4bdf36['email'])[_0x0396('0x16')](function(_0x4c4e52){_0x2412fb=_0x4c4e52;logger[_0x0396('0xd')]('The\x20User\x20ID\x20is:',_0x2412fb['id']);return getEndUser(_0x45ceff,_0x3023a2[_0x0396('0x60')],_0x3023a2[_0x0396('0x61')]);})[_0x0396('0x16')](function(_0x1459c3){_0x1ee989=_0x1459c3;logger[_0x0396('0xd')](_0x0396('0x4f'),_0x1ee989['id']);return getTicket(_0x45ceff,_0x2412fb,_0x1ee989,_0x1efcec,_0x3023a2);})[_0x0396('0x16')](function(_0x3d8676){if(_0x3d8676){logger[_0x0396('0xd')](_0x0396('0x50'),_0x3d8676['id']);switch(_0x45ceff[_0x0396('0x36')]){case _0x0396('0x51'):logger[_0x0396('0xd')](_0x0396('0x5f'),_0x0396('0x52'));return request({'uri':util[_0x0396('0x1a')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x45ceff['remoteUri'],_0x2412fb['id'],_0x3d8676['id']),'method':_0x0396('0x54')});case'newTab':logger['info'](_0x0396('0x5f'),_0x0396('0x62'));emit(util[_0x0396('0x1a')]('user:%s',_0x4bdf36[_0x0396('0x12')]),_0x0396('0x56'),{'uri':util['format'](_0x0396('0x57'),_0x45ceff['remoteUri'][_0x0396('0x58')]('/api/v2',''),_0x3d8676['id'])});break;default:logger[_0x0396('0x5a')](_0x0396('0x5f'),_0x0396('0x63'));}}})[_0x0396('0x59')](function(_0x53b38e){logger[_0x0396('0x5a')](_0x0396('0x64'),util[_0x0396('0x65')](_0x53b38e,{'showHidden':!![],'depth':null}));});};exports[_0x0396('0x66')]=function(_0x2bcdc9,_0x28996b,_0x11ea5c,_0x13d3db,_0x1846ed,_0x30275d){var _0x463202,_0x42741a;_0x30275d[_0x0396('0xf')]=intUtil['stripTrailingSlash'](_0x30275d['remoteUri']);_0x30275d['serverUrl']=intUtil['stripTrailingSlash'](_0x30275d[_0x0396('0x42')]);if(_0x1846ed&&_0x1846ed[_0x0396('0x44')]){logger[_0x0396('0xd')]('['+_0x28996b[_0x0396('0x67')][_0x0396('0x68')]()+']',_0x0396('0x46'));_0x28996b[_0x0396('0x47')]=util[_0x0396('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x30275d['serverUrl'],_0x28996b[_0x0396('0x49')],md5(_0x28996b[_0x0396('0x49')]));}else{_0x28996b[_0x0396('0x47')]='';}headers[_0x0396('0x4a')]=getAuth(_0x30275d);return getUser(_0x30275d)[_0x0396('0x16')](function(_0x4c10af){_0x463202=_0x4c10af;logger[_0x0396('0xd')](_0x0396('0x4c'),_0x463202['id']);return getEndUser(_0x30275d,_0x28996b[_0x0396('0x4d')],_0x28996b[_0x0396('0x4e')]);})[_0x0396('0x16')](function(_0x16bd7f){_0x42741a=_0x16bd7f;logger['info']('The\x20Enduser\x20ID\x20is:',_0x42741a['id']);return getTicket(_0x30275d,_0x463202,_0x42741a,_0x11ea5c,_0x28996b);})[_0x0396('0x16')](function(_0x14c1ac){if(_0x14c1ac){logger[_0x0396('0xd')]('The\x20Ticket\x20ID\x20is:',_0x14c1ac['id']);}})[_0x0396('0x59')](function(_0x3bae9e){logger['error']('['+_0x28996b[_0x0396('0x67')][_0x0396('0x68')]()+']'+_0x0396('0x69'),util[_0x0396('0x65')](_0x3bae9e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe26c=['Basic\x20%s','toString','debug','[HTTP]','stringify','GET','length','forEach','string','type','nameField','customField','toLowerCase','content','custom_fields','variable','variableName','idField','push','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','Authorization','email','destcalleridname','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','toUpperCase','calleridname','calleridnum','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','defaults','localhost','redis','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','filter','end-user','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s'];(function(_0x22868f,_0x450f48){var _0x97bc75=function(_0x447cb4){while(--_0x447cb4){_0x22868f['push'](_0x22868f['shift']());}};_0x97bc75(++_0x450f48);}(_0xe26c,0x11c));var _0xce26=function(_0x3b9e9c,_0x7d0c30){_0x3b9e9c=_0x3b9e9c-0x0;var _0x483ff8=_0xe26c[_0x3b9e9c];return _0x483ff8;};'use strict';var _=require(_0xce26('0x0'));var rp=require('request-promise');var md5=require(_0xce26('0x1'));var util=require(_0xce26('0x2'));var Redis=require(_0xce26('0x3'));var intUtil=require(_0xce26('0x4'));var config=require(_0xce26('0x5'));var logger=require('../../../../config/logger')('zendesk');config['redis']=_[_0xce26('0x6')](config['redis'],{'host':_0xce26('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xce26('0x8')]));function emit(_0x59467a,_0x4be837,_0x54e6bf){io['to'](_0x59467a)[_0xce26('0x9')](_0x4be837,_0x54e6bf);}var headers={'Content-Type':_0xce26('0xa'),'Accept':'application/json'};function getTicket(_0x433376,_0x39e9da,_0x1ce800,_0x10cc0b,_0x10f6b4){logger[_0xce26('0xb')](_0xce26('0xc'));return request({'uri':util['format'](_0xce26('0xd'),_0x433376[_0xce26('0xe')]),'method':_0xce26('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x1ce800['id'],'submitter_id':_0x39e9da?_0x39e9da['id']:undefined,'assignee_id':_0x39e9da?_0x39e9da['id']:undefined,'tags':getTags(_0x10cc0b[_0xce26('0x10')],_0xce26('0x11')),'subject':intUtil[_0xce26('0x12')](_0x10cc0b[_0xce26('0x13')],_0x10f6b4,'\x20'),'description':intUtil[_0xce26('0x12')](_0x10cc0b[_0xce26('0x14')],_0x10f6b4,'\x0a'),'comment':{'public':![],'body':intUtil[_0xce26('0x12')](_0x10cc0b['Descriptions'],_0x10f6b4,'\x0a')}},getCustomFields(_0x10cc0b[_0xce26('0x15')],_0x10f6b4))}})[_0xce26('0x16')](function(_0x506dd7){logger[_0xce26('0xb')]('Ticket\x20created!');return _0x506dd7[_0xce26('0x17')];});}function getUser(_0x4477c7,_0xa01b21){if(intUtil[_0xce26('0x18')](_0xa01b21)){logger['info'](_0xce26('0x19'),_0xa01b21);return request({'uri':util[_0xce26('0x1a')](_0xce26('0x1b'),_0x4477c7[_0xce26('0xe')]),'qs':{'query':util[_0xce26('0x1a')](_0xce26('0x1c'),_0xa01b21)}})['then'](function(_0x4f117f){if(_0x4f117f[_0xce26('0x1d')]){logger['info'](_0xce26('0x1e'));return _['find'](_0x4f117f['results'],{'email':_0xa01b21,'role':_0xce26('0x1f')});}else{logger[_0xce26('0xb')](_0xce26('0x20'));return request({'uri':util[_0xce26('0x1a')](_0xce26('0x21'),_0x4477c7[_0xce26('0xe')])})[_0xce26('0x16')](function(_0x588c46){logger[_0xce26('0xb')](_0xce26('0x22'));return _0x588c46[_0xce26('0x23')];});}});}else{logger[_0xce26('0xb')](_0xce26('0x20'));return request({'uri':util[_0xce26('0x1a')](_0xce26('0x21'),_0x4477c7[_0xce26('0xe')])})['then'](function(_0xa84e0e){logger[_0xce26('0xb')](_0xce26('0x22'));return _0xa84e0e[_0xce26('0x23')];});}}function getEndUser(_0x11c7c6,_0x3a78c5,_0x262027){logger[_0xce26('0xb')](_0xce26('0x24'),_0x262027);return request({'uri':util[_0xce26('0x1a')]('%s/search.json',_0x11c7c6[_0xce26('0xe')]),'qs':{'query':util['format'](_0xce26('0x25'),_0x262027)}})[_0xce26('0x16')](function(_0x9aade4){var _0x4e4fed;if(_0x9aade4['results']['length']){_0x9aade4[_0xce26('0x26')]=_[_0xce26('0x27')](_0x9aade4[_0xce26('0x26')],{'suspended':![],'role':_0xce26('0x28')});if(_0x9aade4[_0xce26('0x26')]['length']){_0x4e4fed=_[_0xce26('0x29')](_0x9aade4[_0xce26('0x26')]);}}if(_0x4e4fed){logger[_0xce26('0xb')](_0xce26('0x2a'));return _0x4e4fed;}else{logger[_0xce26('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xce26('0x1a')](_0xce26('0x2b'),_0x11c7c6['remoteUri']),'method':'POST','body':{'user':{'role':_0xce26('0x28'),'name':util[_0xce26('0x1a')](_0xce26('0x2c'),_0x3a78c5||_0x262027),'phone':_0x262027}}})[_0xce26('0x16')](function(_0x5b7a79){logger['info'](_0xce26('0x2d'));return _0x5b7a79[_0xce26('0x23')];});}});}function getAuth(_0x397f80){var _0x4f1638;if(_0x397f80[_0xce26('0x2e')]===_0xce26('0x2f')){_0x4f1638=util['format'](_0xce26('0x30'),_0x397f80[_0xce26('0x31')],_0x397f80['password']);}else if(_0x397f80['authType']===_0xce26('0x32')){_0x4f1638=util[_0xce26('0x1a')](_0xce26('0x33'),_0x397f80[_0xce26('0x31')],_0x397f80['token']);}return util['format'](_0xce26('0x34'),new Buffer(_0x4f1638)[_0xce26('0x35')]('base64'));}function request(_0x56dd4f){logger[_0xce26('0x36')](_0xce26('0x37'),JSON[_0xce26('0x38')](_0x56dd4f));return rp(_[_0xce26('0x6')](_0x56dd4f,{'method':_0xce26('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x77c4bd,_0x1ff889){var _0x4e1017=[];if(_0x77c4bd&&_0x77c4bd['length']>0x0){_0x4e1017=_['map'](_0x77c4bd,_0x1ff889);}return _0x4e1017;}function getCustomFields(_0x1b171e,_0x38c27f){var _0x12fb03=[];var _0x44446a={'custom_fields':[]};if(_0x1b171e[_0xce26('0x3a')]>0x0){_[_0xce26('0x3b')](_0x1b171e,function(_0x3b4d4c){if(_['includes']([_0xce26('0x3c'),'picklist'],_0x3b4d4c[_0xce26('0x3d')])&&_0x3b4d4c[_0xce26('0x3e')]&&!_0x3b4d4c[_0xce26('0x3f')]){_0x44446a[_0x3b4d4c[_0xce26('0x3e')][_0xce26('0x40')]()]=_0x3b4d4c[_0xce26('0x41')][_0xce26('0x35')]();}else if(_['includes']([_0xce26('0x3c'),'picklist'],_0x3b4d4c['type'])&&_0x3b4d4c['idField']&&_0x3b4d4c['customField']){_0x44446a[_0xce26('0x42')]['push']({'id':_0x3b4d4c['idField'],'value':_0x3b4d4c[_0xce26('0x41')][_0xce26('0x35')]()});}else if(_0x3b4d4c['type']===_0xce26('0x43')&&_0x3b4d4c[_0xce26('0x44')]&&_0x3b4d4c[_0xce26('0x45')]&&_0x3b4d4c['customField']){_0x38c27f[_0x3b4d4c[_0xce26('0x44')]]&&_0x44446a[_0xce26('0x42')][_0xce26('0x46')]({'id':_0x3b4d4c[_0xce26('0x45')],'value':_0x38c27f[_0x3b4d4c['variableName']][_0xce26('0x35')]()});}else if(_0x3b4d4c[_0xce26('0x3d')]==='customVariable'&&_0x3b4d4c[_0xce26('0x47')]&&_0x3b4d4c[_0xce26('0x47')][_0xce26('0x11')]&&_0x3b4d4c[_0xce26('0x45')]&&_0x3b4d4c[_0xce26('0x3f')]){_0x38c27f[_0x3b4d4c[_0xce26('0x47')][_0xce26('0x11')][_0xce26('0x40')]()]&&_0x44446a[_0xce26('0x42')]['push']({'id':_0x3b4d4c['idField'],'value':_0x38c27f[_0x3b4d4c['Variable'][_0xce26('0x11')][_0xce26('0x40')]()][_0xce26('0x35')]()});}});}return _0x44446a;}exports[_0xce26('0x48')]=function(_0x3ef794,_0x3d1b75,_0x1e8e7c,_0x3893a4,_0x2585b1,_0x14b8a0){var _0x186dd4,_0x5ceea2;_0x14b8a0['remoteUri']=intUtil[_0xce26('0x49')](_0x14b8a0[_0xce26('0xe')]);_0x14b8a0[_0xce26('0x4a')]=intUtil[_0xce26('0x49')](_0x14b8a0[_0xce26('0x4a')]);if(_0x2585b1&&_0x2585b1[_0xce26('0x4b')]){logger[_0xce26('0xb')](_0xce26('0x4c'),_0xce26('0x4d'));_0x3d1b75['recordingURL']=util[_0xce26('0x1a')](_0xce26('0x4e'),_0x14b8a0[_0xce26('0x4a')],_0x3d1b75['uniqueid'],md5(_0x3d1b75[_0xce26('0x4f')]));}else{_0x3d1b75[_0xce26('0x50')]='';}headers['Authorization']=getAuth(_0x14b8a0);return getUser(_0x14b8a0,_0x3893a4['email'])[_0xce26('0x16')](function(_0x503536){_0x186dd4=_0x503536;logger[_0xce26('0xb')](_0xce26('0x51'),_0x186dd4['id']);return getEndUser(_0x14b8a0,_0x3d1b75['calleridname'],_0x3d1b75['calleridnum']);})['then'](function(_0x8bb57b){_0x5ceea2=_0x8bb57b;logger[_0xce26('0xb')](_0xce26('0x52'),_0x5ceea2['id']);return getTicket(_0x14b8a0,_0x186dd4,_0x5ceea2,_0x1e8e7c,_0x3d1b75);})[_0xce26('0x16')](function(_0x251c3b){if(_0x251c3b){logger[_0xce26('0xb')](_0xce26('0x53'),_0x251c3b['id']);switch(_0x14b8a0[_0xce26('0x3d')]){case _0xce26('0x54'):logger['info'](_0xce26('0x4c'),_0xce26('0x55'));return request({'uri':util[_0xce26('0x1a')](_0xce26('0x56'),_0x14b8a0['remoteUri'],_0x186dd4['id'],_0x251c3b['id']),'method':_0xce26('0xf')});case _0xce26('0x57'):logger[_0xce26('0xb')](_0xce26('0x4c'),_0xce26('0x58'));emit(util[_0xce26('0x1a')](_0xce26('0x59'),_0x3893a4['name']),_0xce26('0x5a'),{'uri':util[_0xce26('0x1a')](_0xce26('0x5b'),_0x14b8a0[_0xce26('0xe')][_0xce26('0x5c')]('/api/v2',''),_0x251c3b['id'])});break;default:logger[_0xce26('0x5d')](_0xce26('0x4c'),_0xce26('0x5e'));}}})[_0xce26('0x5f')](function(_0x10afd4){logger['error'](_0xce26('0x60'),util['inspect'](_0x10afd4,{'showHidden':!![],'depth':null}));});};exports[_0xce26('0x61')]=function(_0x47da83,_0x3cece6,_0x32b82e,_0x3f1857,_0x3c96af,_0x2d493f,_0x159db3){var _0x579e41,_0x5d0685;_0x2d493f[_0xce26('0xe')]=intUtil[_0xce26('0x49')](_0x2d493f[_0xce26('0xe')]);_0x2d493f[_0xce26('0x4a')]=intUtil[_0xce26('0x49')](_0x2d493f[_0xce26('0x4a')]);if(_0x159db3&&_0x159db3['recordingFormat']&&_0x159db3[_0xce26('0x62')]!==_0xce26('0x63')){logger['info'](_0xce26('0x64'),_0xce26('0x4d'));_0x3cece6[_0xce26('0x50')]=util[_0xce26('0x1a')](_0xce26('0x4e'),_0x2d493f['serverUrl'],_0x3cece6[_0xce26('0x4f')],md5(_0x3cece6[_0xce26('0x4f')]));}headers[_0xce26('0x65')]=getAuth(_0x2d493f);return getUser(_0x2d493f,_0x3f1857[_0xce26('0x66')])[_0xce26('0x16')](function(_0x25af47){_0x579e41=_0x25af47;logger[_0xce26('0xb')](_0xce26('0x51'),_0x579e41['id']);return getEndUser(_0x2d493f,_0x3cece6[_0xce26('0x67')],_0x3cece6['destcalleridnum']);})[_0xce26('0x16')](function(_0xc16c5a){_0x5d0685=_0xc16c5a;logger[_0xce26('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5d0685['id']);return getTicket(_0x2d493f,_0x579e41,_0x5d0685,_0x32b82e,_0x3cece6);})[_0xce26('0x16')](function(_0x80d54f){if(_0x80d54f){logger[_0xce26('0xb')](_0xce26('0x53'),_0x80d54f['id']);switch(_0x2d493f[_0xce26('0x3d')]){case _0xce26('0x54'):logger[_0xce26('0xb')]('[OUTBOUND]',_0xce26('0x55'));return request({'uri':util[_0xce26('0x1a')](_0xce26('0x56'),_0x2d493f[_0xce26('0xe')],_0x579e41['id'],_0x80d54f['id']),'method':'POST'});case'newTab':logger[_0xce26('0xb')]('[OUTBOUND]',_0xce26('0x58'));emit(util['format']('user:%s',_0x3f1857[_0xce26('0x11')]),_0xce26('0x5a'),{'uri':util['format']('%s/agent/tickets/%s',_0x2d493f[_0xce26('0xe')][_0xce26('0x5c')]('/api/v2',''),_0x80d54f['id'])});break;default:logger[_0xce26('0x5d')](_0xce26('0x64'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0xd257b4){logger[_0xce26('0x5d')](_0xce26('0x68'),util[_0xce26('0x69')](_0xd257b4,{'showHidden':!![],'depth':null}));});};exports[_0xce26('0x6a')]=function(_0x1a3126,_0x46bdf2,_0x6b4820,_0x5944fd,_0x5af5ff,_0x1e62c0){var _0x4d751d,_0x52171b;_0x1e62c0['remoteUri']=intUtil[_0xce26('0x49')](_0x1e62c0[_0xce26('0xe')]);_0x1e62c0['serverUrl']=intUtil[_0xce26('0x49')](_0x1e62c0[_0xce26('0x4a')]);if(_0x5af5ff&&_0x5af5ff['monitor_format']){logger['info']('['+_0x46bdf2['lastevent'][_0xce26('0x6b')]()+']','Recording\x20is\x20enabled!');_0x46bdf2[_0xce26('0x50')]=util[_0xce26('0x1a')](_0xce26('0x4e'),_0x1e62c0[_0xce26('0x4a')],_0x46bdf2[_0xce26('0x4f')],md5(_0x46bdf2[_0xce26('0x4f')]));}else{_0x46bdf2['recordingURL']='';}headers['Authorization']=getAuth(_0x1e62c0);return getUser(_0x1e62c0)['then'](function(_0x11068a){_0x4d751d=_0x11068a;logger[_0xce26('0xb')]('The\x20User\x20ID\x20is:',_0x4d751d['id']);return getEndUser(_0x1e62c0,_0x46bdf2[_0xce26('0x6c')],_0x46bdf2[_0xce26('0x6d')]);})[_0xce26('0x16')](function(_0x5cbe8e){_0x52171b=_0x5cbe8e;logger[_0xce26('0xb')]('The\x20Enduser\x20ID\x20is:',_0x52171b['id']);return getTicket(_0x1e62c0,_0x4d751d,_0x52171b,_0x6b4820,_0x46bdf2);})[_0xce26('0x16')](function(_0xcaec1d){if(_0xcaec1d){logger[_0xce26('0xb')]('The\x20Ticket\x20ID\x20is:',_0xcaec1d['id']);}})[_0xce26('0x5f')](function(_0x14ef6a){logger['error']('['+_0x46bdf2[_0xce26('0x6e')][_0xce26('0x6b')]()+']'+_0xce26('0x6f'),util[_0xce26('0x69')](_0x14ef6a,{'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 a3cc79c..240c1d1 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 _0x7af2=['Variable','name','toLowerCase','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientId','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','profile','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','log','CREATE\x20ERROR','GET','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','getString','Description','Descriptions','Full_Name','First_Name','Last_Name','Leads','What_Id','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','lastevent','Called','complete','connect','Call_Result','Answered','rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','unmanaged','monitor_format','toUpperCase','/api/voice/recordings/','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','stringify','string','type','idField','content','toString','variable','variableName','customVariable'];(function(_0x3b33e2,_0x4c4072){var _0x5d6409=function(_0x261336){while(--_0x261336){_0x3b33e2['push'](_0x3b33e2['shift']());}};_0x5d6409(++_0x4c4072);}(_0x7af2,0x119));var _0x27af=function(_0x40a740,_0x5e1944){_0x40a740=_0x40a740-0x0;var _0x2b5bbb=_0x7af2[_0x40a740];return _0x2b5bbb;};'use strict';var _=require('lodash');var rp=require(_0x27af('0x0'));var md5=require(_0x27af('0x1'));var util=require(_0x27af('0x2'));var intUtil=require(_0x27af('0x3'));var moment=require('moment');var Redis=require(_0x27af('0x4'));var BPromise=require(_0x27af('0x5'));var config=require(_0x27af('0x6'));var logger=require(_0x27af('0x7'))(_0x27af('0x8'));config[_0x27af('0x9')]=_[_0x27af('0xa')](config[_0x27af('0x9')],{'host':_0x27af('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x27af('0x9')]));function emit(_0x366868,_0x389e97,_0x583db8){io['to'](_0x366868)[_0x27af('0xc')](_0x389e97,_0x583db8);}function request(_0xfa1882){logger[_0x27af('0xd')]('[HTTP]',JSON[_0x27af('0xe')](_0xfa1882));return rp(_0xfa1882);}function getCustomFields(_0x582a9e,_0x4d4729){var _0x3e4b33={};if(_0x582a9e['length']>0x0){_['forEach'](_0x582a9e,function(_0x184e25){if(_['includes']([_0x27af('0xf'),'picklist'],_0x184e25[_0x27af('0x10')])&&_0x184e25[_0x27af('0x11')]){_0x3e4b33[_0x184e25[_0x27af('0x11')]]=_0x184e25[_0x27af('0x12')][_0x27af('0x13')]();}else if(_0x184e25[_0x27af('0x10')]===_0x27af('0x14')&&_0x184e25[_0x27af('0x15')]&&_0x184e25[_0x27af('0x11')]&&_0x4d4729[_0x184e25[_0x27af('0x15')]]){_0x3e4b33[_0x184e25[_0x27af('0x11')]]=_0x4d4729[_0x184e25[_0x27af('0x15')]][_0x27af('0x13')]();}else if(_0x184e25[_0x27af('0x10')]===_0x27af('0x16')&&_0x184e25[_0x27af('0x17')]&&_0x184e25[_0x27af('0x17')][_0x27af('0x18')]&&_0x184e25['idField']&&_0x4d4729[_0x184e25[_0x27af('0x17')][_0x27af('0x18')]['toLowerCase']()]){_0x3e4b33[_0x184e25['idField']]=_0x4d4729[_0x184e25[_0x27af('0x17')][_0x27af('0x18')][_0x27af('0x19')]()][_0x27af('0x13')]();}});}return _0x3e4b33;}function getName(_0xec699a){if(_0xec699a['indexOf']('\x20')>0x0){var _0x25f391=_0xec699a[_0x27af('0x1a')](/ (.+)/);if(_0x25f391[0x1]){return _0x25f391;}}return[_0xec699a,_0xec699a];}var accountsTokens={};function getAccessToken(_0xcb4b90){return new Promise(function(_0x5e7c19,_0x19afb1){if(!_[_0x27af('0x1b')](accountsTokens[_0xcb4b90['id']])&&!_[_0x27af('0x1b')](accountsTokens[_0xcb4b90['id']]['access_token'])){if(moment()[_0x27af('0x1c')](accountsTokens[_0xcb4b90['id']][_0x27af('0x1d')])){_0x5e7c19(accountsTokens[_0xcb4b90['id']][_0x27af('0x1e')]);}}var _0x2af76d;switch(_0xcb4b90[_0x27af('0x1f')]){case'US':_0x2af76d=_0x27af('0x20');break;case'AU':_0x2af76d=_0x27af('0x21');break;case'EU':_0x2af76d=_0x27af('0x22');break;case'IN':_0x2af76d=_0x27af('0x23');break;case'CN':_0x2af76d='https://accounts.zoho.com.cn';break;default:_0x2af76d='https://accounts.zoho.eu';break;}var _0x4b8fe6={'method':_0x27af('0x24'),'uri':_0x2af76d+'/oauth/v2/token','qs':{'refresh_token':_0xcb4b90[_0x27af('0x25')],'client_id':_0xcb4b90[_0x27af('0x26')],'client_secret':_0xcb4b90['clientSecret'],'grant_type':_0x27af('0x27')},'json':!![]};return rp(_0x4b8fe6)[_0x27af('0x28')](function(_0x463e36){accountsTokens[_0xcb4b90['id']]={'access_token':_0x463e36[_0x27af('0x1e')],'expires_in':moment()[_0x27af('0x29')](_0x463e36[_0x27af('0x1d')],_0x27af('0x2a'))};_0x5e7c19(_0x463e36['access_token']);})[_0x27af('0x2b')](function(_0x250d5b){logger[_0x27af('0x2c')](_0x27af('0x2d'),_0x250d5b[_0x27af('0x2e')]);_0x19afb1(_0x250d5b);});});}function getUser(_0xa08dd9,_0x42a5b7,_0x2b26ac,_0x4406e2){logger[_0x27af('0x2f')](_0x27af('0x30'));return request({'method':'GET','uri':util[_0x27af('0x31')](_0x27af('0x32'),_0x42a5b7),'qs':{'type':_0x27af('0x33')},'headers':{'Authorization':_0x27af('0x34')+_0xa08dd9},'json':!![]})[_0x27af('0x28')](function(_0x44b8a6){if(_0x44b8a6['users']){var _0x51bc97=-0x1;if(_[_0x27af('0x35')](_0x44b8a6[_0x27af('0x36')])){if(!_['isNil'](_0x4406e2)){_0x51bc97=_[_0x27af('0x37')](_0x44b8a6[_0x27af('0x36')],function(_0x4628a4){return _0x4628a4[_0x27af('0x38')]===_0x4406e2;});}if(_0x51bc97>=0x0){logger[_0x27af('0x2f')](_0x27af('0x39'));}else{logger[_0x27af('0x2f')](_0x27af('0x3a'));_0x51bc97=_[_0x27af('0x37')](_0x44b8a6[_0x27af('0x36')],function(_0x13c97d){return _0x13c97d['profile']['name']===_0x27af('0x3b');});}return _0x44b8a6[_0x27af('0x36')][_0x51bc97];}else{if(_0x44b8a6['user'][_0x27af('0x3c')][_0x27af('0x18')]==='Administrator'){logger[_0x27af('0x2f')](_0x27af('0x3a'));user=_0x44b8a6[_0x27af('0x3d')];return user;}else{logger[_0x27af('0x2c')](_0x27af('0x3e'),JSON['stringify'](_0x44b8a6));throw new Error(_0x27af('0x3f')+JSON[_0x27af('0xe')](_0x44b8a6));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x27af('0xe')](_0x44b8a6));throw new Error(_0x27af('0x3f')+JSON[_0x27af('0xe')](_0x44b8a6));}})[_0x27af('0x2b')](function(_0x467891){console[_0x27af('0x2c')](_0x467891);});}function getZohoUser(_0x53144b,_0x16eff4){return new BPromise(function(_0x506474,_0x1c2a07){request(_0x53144b)[_0x27af('0x28')](function(_0x2a6b14){var _0x3a46f3=null;if(_0x2a6b14){_0x3a46f3=_0x2a6b14[_0x27af('0x40')][0x0];_0x3a46f3['enduserType']=_0x16eff4;}_0x506474(_0x3a46f3);})[_0x27af('0x2b')](function(_0x233764){_0x1c2a07(_0x233764);});});}function createEndUser(_0x16dc3b,_0x3faebd,_0x10c1be,_0x32b558,_0x415d9f,_0x41bba3){var _0x10c1be=getName(_0x10c1be);return request({'method':_0x27af('0x24'),'uri':_0x27af('0x41')+_0x3faebd+_0x27af('0x42')+_[_0x27af('0x43')](_0x41bba3[_0x27af('0x44')])+'s','body':{'data':[{'Last_Name':_0x10c1be[0x1],'First_Name':_0x10c1be[0x0],'Phone':_0x32b558,'Owner':{'name':!_['isNil'](_0x415d9f[_0x27af('0x45')][_0x27af('0x18')])?_0x415d9f[_0x27af('0x45')][_0x27af('0x18')]:!_['isNil'](_0x415d9f[_0x27af('0x46')])?_0x415d9f['first_name']+'\x20'+_0x415d9f['last_name']:_0x415d9f[_0x27af('0x47')],'id':_0x415d9f['id']}}]},'headers':{'Authorization':_0x27af('0x34')+_0x16dc3b},'json':!![]})[_0x27af('0x28')](function(_0x17efd6){if(_0x17efd6&&_0x17efd6[_0x27af('0x40')][0x0][_0x27af('0x48')]===_0x27af('0x49')){var _0x26eb28=_0x17efd6[_0x27af('0x40')][0x0][_0x27af('0x4a')];_0x26eb28[_0x27af('0x4b')]=_[_0x27af('0x43')](_0x41bba3['moduleCreate'])+'s';return _0x26eb28;}logger[_0x27af('0x2c')](_0x27af('0x3e'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0x27af('0xe')](data));})[_0x27af('0x2b')](function(_0x6b79bc){console[_0x27af('0x4c')](_0x27af('0x4d'),_0x6b79bc);});}function getEndUser(_0x562961,_0x4b7e7e,_0x483c8e,_0x2df0ac,_0x24b191,_0x200c2b,_0x26e8ba){var _0x441a58={'method':_0x27af('0x4e'),'uri':'','headers':{'Authorization':_0x27af('0x34')+_0x562961},'json':!![]};switch(_0x26e8ba['moduleSearch']){case'contact_lead':_0x441a58[_0x27af('0x4f')]='https://www.zohoapis.'+_0x4b7e7e+_0x27af('0x50')+_0x24b191+'))';return getZohoUser(_0x441a58,_0x27af('0x51'))[_0x27af('0x28')](function(_0x389962){if(_0x389962)return _0x389962;_0x441a58[_0x27af('0x4f')]=_0x27af('0x41')+_0x4b7e7e+_0x27af('0x52')+_0x24b191+'))';return getZohoUser(_0x441a58,'Leads')[_0x27af('0x28')](function(_0xc7e2a8){if(_0xc7e2a8)return _0xc7e2a8;if(_0x26e8ba[_0x27af('0x44')]!=_0x27af('0x53')){return createEndUser(_0x562961,_0x4b7e7e,_0x2df0ac,_0x24b191,_0x200c2b,_0x26e8ba);}else{return{};}});});break;case _0x27af('0x54'):_0x441a58['uri']=_0x27af('0x41')+_0x4b7e7e+_0x27af('0x50')+_0x24b191+'))';return getZohoUser(_0x441a58,_0x27af('0x51'))['then'](function(_0x4e95be){if(_0x4e95be)return _0x4e95be;if(_0x26e8ba[_0x27af('0x44')]!=_0x27af('0x53')){return createEndUser(_0x562961,_0x4b7e7e,_0x2df0ac,_0x24b191,_0x200c2b,_0x26e8ba);}else{return{};}});break;case _0x27af('0x55'):_0x441a58['uri']='https://www.zohoapis.'+_0x4b7e7e+_0x27af('0x52')+_0x24b191+'))';return getZohoUser(_0x441a58,'Leads')[_0x27af('0x28')](function(_0x23b4de){if(_0x23b4de)return _0x23b4de;if(_0x26e8ba[_0x27af('0x44')]!=_0x27af('0x53')){return createEndUser(_0x562961,_0x4b7e7e,_0x2df0ac,_0x24b191,_0x200c2b,_0x26e8ba);}else{return{};}});break;}}function getCall(_0x38aa14,_0xb9e23,_0x123533,_0x374794,_0x1b6d94,_0x24d8bf,_0x23369a,_0x5c02c1){logger[_0x27af('0x2f')](_0x27af('0x56'));var _0x3f1b20={};_0x3f1b20[_0x27af('0x57')]={'name':!_[_0x27af('0x1b')](_0x374794[_0x27af('0x45')][_0x27af('0x18')])&&!_[_0x27af('0x1b')](_0x374794['profile'][_0x27af('0x18')])&&_0x374794['profile'][_0x27af('0x18')]===_0x27af('0x58')?_0x374794[_0x27af('0x45')]['name']:!_[_0x27af('0x1b')](_0x374794['first_name'])?_0x374794[_0x27af('0x46')]+'\x20'+_0x374794[_0x27af('0x47')]:_0x374794[_0x27af('0x47')],'id':_0x374794['id']};_0x3f1b20['Subject']=intUtil[_0x27af('0x59')](_0x24d8bf['Subjects'],_0x23369a,'\x20');_0x3f1b20[_0x27af('0x5a')]=intUtil['getString'](_0x24d8bf[_0x27af('0x5b')],_0x23369a,'\x0a');if(_0x1b6d94[_0x27af('0x4b')]===_0x27af('0x51')){_0x3f1b20['Who_Id']={'name':!_['isNil'](_0x1b6d94[_0x27af('0x5c')])?_0x1b6d94[_0x27af('0x5c')]:!_[_0x27af('0x1b')](_0x1b6d94[_0x27af('0x5d')])?_0x1b6d94['First_Name']+'\x20'+_0x1b6d94[_0x27af('0x5e')]:_0x1b6d94[_0x27af('0x5e')],'id':_0x1b6d94['id']};}if(_0x1b6d94[_0x27af('0x4b')]===_0x27af('0x5f')){_0x3f1b20[_0x27af('0x60')]={'name':!_[_0x27af('0x1b')](_0x1b6d94['Full_Name'])?_0x1b6d94[_0x27af('0x5c')]:!_[_0x27af('0x1b')](_0x1b6d94[_0x27af('0x5d')])?_0x1b6d94[_0x27af('0x5d')]+'\x20'+_0x1b6d94['Last_Name']:_0x1b6d94[_0x27af('0x5e')],'id':_0x1b6d94['id']};_0x3f1b20['$se_module']=_[_0x27af('0x43')](_0x1b6d94[_0x27af('0x4b')]);}if(_0x23369a['talktime']){_0x3f1b20[_0x27af('0x61')]=moment[_0x27af('0x62')](parseInt(_0x23369a['talktime'])*0x3e8)['format'](_0x27af('0x63'));}else if(_0x23369a[_0x27af('0x64')]&&_0x23369a[_0x27af('0x65')]){_0x3f1b20['Call_Duration']=moment[_0x27af('0x62')](moment(_0x23369a[_0x27af('0x65')],'YYYY-MM-DDTHH:mm:ss')[_0x27af('0x66')](moment(_0x23369a[_0x27af('0x67')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0x27af('0x63'));}switch(_0x23369a[_0x27af('0x68')]){case'called':_0x3f1b20['Call_Result']=_0x27af('0x69');break;case _0x27af('0x6a'):case _0x27af('0x6b'):_0x3f1b20[_0x27af('0x6c')]=_0x27af('0x6d');break;case _0x27af('0x6e'):_0x3f1b20[_0x27af('0x6c')]='Rejected';break;case'abandoned':_0x3f1b20[_0x27af('0x6c')]=_0x27af('0x6f');break;case _0x27af('0x70'):_0x3f1b20[_0x27af('0x6c')]=_0x27af('0x71');default:}_0x3f1b20[_0x27af('0x72')]=(_0x5c02c1===_0x27af('0x73')?moment(_0x23369a[_0x27af('0x67')])[_0x27af('0x31')](_0x27af('0x74')):moment(_0x23369a[_0x27af('0x75')])[_0x27af('0x31')](_0x27af('0x74')))||moment()[_0x27af('0x31')](_0x27af('0x74'));_0x3f1b20[_0x27af('0x76')]=_0x5c02c1||_0x27af('0x77');_0x3f1b20=_['merge'](_0x3f1b20,getCustomFields(_0x24d8bf[_0x27af('0x78')],_0x23369a));return request({'method':_0x27af('0x24'),'uri':'https://www.zohoapis.'+_0xb9e23+_0x27af('0x79'),'headers':{'Authorization':_0x27af('0x34')+_0x38aa14},'body':{'data':[_0x3f1b20]},'json':!![]})[_0x27af('0x28')](function(_0x2d1c61){if(_0x2d1c61&&_0x2d1c61[_0x27af('0x40')][0x0][_0x27af('0x48')]==='SUCCESS'){logger[_0x27af('0x2f')](_0x27af('0x7a'));return{'id':_0x2d1c61[_0x27af('0x40')][0x0]['details']['id']};}})['catch'](function(_0xf3ac96){logger['info'](_0x27af('0x7b'),_0xf3ac96[_0x27af('0x2e')]);console[_0x27af('0x4c')](_0x27af('0x7b'),_0xf3ac96);});}exports[_0x27af('0x7c')]=function(_0x4e6eff,_0x100479,_0x30ec84,_0x4ac2a3,_0x42bfc5,_0xc0a98c){var _0x52208b,_0x479ef8,_0x1efff4;_0xc0a98c[_0x27af('0x7d')]=intUtil[_0x27af('0x7e')](_0xc0a98c[_0x27af('0x7d')]);_0xc0a98c[_0x27af('0x7f')]=intUtil[_0x27af('0x7e')](_0xc0a98c[_0x27af('0x7f')]);if(_0x42bfc5&&_0x42bfc5['monitor_format']){logger[_0x27af('0x2f')](_0x27af('0x80'),_0x27af('0x81'));_0x100479[_0x27af('0x82')]=_0xc0a98c['serverUrl']+'/api/voice/recordings/'+_0x100479[_0x27af('0x83')]+_0x27af('0x84')+md5(_0x100479[_0x27af('0x83')]);}else{_0x100479[_0x27af('0x82')]='';}var _0x569083=_0xc0a98c['host']==='zoho.eu'?'eu':_0x27af('0x85');return getAccessToken(_0xc0a98c)[_0x27af('0x28')](function(_0x27add6){_0x1efff4=_0x27add6;return getUser(_0x1efff4,_0x569083,_0xc0a98c,_0x4ac2a3[_0x27af('0x38')]);})[_0x27af('0x28')](function(_0x27dcd5){_0x52208b=_0x27dcd5;logger['info']('The\x20User\x20ID\x20is:',_0x52208b['id']);return getEndUser(_0x1efff4,_0x569083,_0xc0a98c,_0x100479[_0x27af('0x86')],_0x100479[_0x27af('0x87')],_0x52208b,_0x30ec84);})[_0x27af('0x28')](function(_0x2c3d30){_0x479ef8=_0x2c3d30;return getCall(_0x1efff4,_0x569083,_0xc0a98c,_0x52208b,_0x479ef8,_0x30ec84,_0x100479,'Inbound');})['then'](function(_0x232a1e){if(_0x232a1e){logger[_0x27af('0x2f')](_0x27af('0x88'),_0x232a1e['id']);logger[_0x27af('0x2f')](_0x27af('0x80'),_0x27af('0x89'));emit(util[_0x27af('0x31')](_0x27af('0x8a'),_0x4ac2a3[_0x27af('0x18')]),_0x27af('0x8b'),{'uri':_0x27af('0x8c')+_0xc0a98c['host']+_0x27af('0x8d')+_0x232a1e['id']});}})[_0x27af('0x2b')](function(_0x1bfb41){logger['error'](_0x27af('0x80'),JSON[_0x27af('0xe')](_0x1bfb41));});};exports[_0x27af('0x73')]=function(_0x4de9e4,_0x58f5ec,_0x49f3da,_0x118d06,_0x9350fa,_0x1c2d92,_0xd68833){var _0x12fce4,_0x290ea9,_0x4204bc;_0x1c2d92[_0x27af('0x7d')]=intUtil['stripTrailingSlash'](_0x1c2d92[_0x27af('0x7d')]);_0x1c2d92['serverUrl']=intUtil[_0x27af('0x7e')](_0x1c2d92[_0x27af('0x7f')]);if(_0xd68833&&_0xd68833[_0x27af('0x8e')]&&_0xd68833['recordingFormat']!=='none'){logger[_0x27af('0x2f')](_0x27af('0x8f'),_0x27af('0x81'));_0x58f5ec['recordingURL']=_0x1c2d92['serverUrl']+'/api/voice/recordings/'+_0x58f5ec[_0x27af('0x83')]+_0x27af('0x84')+md5(_0x58f5ec['uniqueid']);}var _0x3ef9fc=_0x1c2d92[_0x27af('0x7d')]==='zoho.eu'?'eu':_0x27af('0x85');return getAccessToken(_0x1c2d92)[_0x27af('0x28')](function(_0x1a6d62){_0x4204bc=_0x1a6d62;return getUser(_0x4204bc,_0x3ef9fc,_0x1c2d92,_0x118d06[_0x27af('0x38')]);})['then'](function(_0x3cb9f1){_0x12fce4=_0x3cb9f1;logger[_0x27af('0x2f')](_0x27af('0x90'),_0x12fce4['id']);return getEndUser(_0x4204bc,_0x3ef9fc,_0x1c2d92,_0x58f5ec[_0x27af('0x91')],_0x58f5ec[_0x27af('0x92')],_0x12fce4,_0x49f3da);})['then'](function(_0x578475){_0x290ea9=_0x578475;return getCall(_0x4204bc,_0x3ef9fc,_0x1c2d92,_0x12fce4,_0x290ea9,_0x49f3da,_0x58f5ec,_0x27af('0x93'));})[_0x27af('0x28')](function(_0x48da59){if(_0x48da59){logger[_0x27af('0x2f')](_0x27af('0x88'),_0x48da59['id']);logger[_0x27af('0x2f')](_0x27af('0x8f'),_0x27af('0x89'));emit(util[_0x27af('0x31')]('user:%s',_0x118d06[_0x27af('0x18')]),'trigger:browser:url',{'uri':_0x27af('0x8c')+_0x1c2d92[_0x27af('0x7d')]+_0x27af('0x8d')+_0x48da59['id']});}})[_0x27af('0x2b')](function(_0x128c5e){logger['error'](_0x27af('0x8f'),JSON[_0x27af('0xe')](_0x128c5e));});};exports[_0x27af('0x94')]=function(_0x2b59f2,_0x2d0c0b,_0x13af6d,_0x4e32e9,_0x217ab1,_0x1c4d81){var _0x53475a,_0xa67082,_0x5444df;_0x1c4d81[_0x27af('0x7d')]=intUtil[_0x27af('0x7e')](_0x1c4d81[_0x27af('0x7d')]);_0x1c4d81[_0x27af('0x7f')]=intUtil[_0x27af('0x7e')](_0x1c4d81['serverUrl']);if(_0x217ab1&&_0x217ab1[_0x27af('0x95')]){logger[_0x27af('0x2f')]('['+_0x2d0c0b[_0x27af('0x68')][_0x27af('0x96')]()+']',_0x27af('0x81'));_0x2d0c0b['recordingURL']=_0x1c4d81[_0x27af('0x7f')]+_0x27af('0x97')+_0x2d0c0b['uniqueid']+_0x27af('0x84')+md5(_0x2d0c0b[_0x27af('0x83')]);}else{_0x2d0c0b[_0x27af('0x82')]='';}var _0x3c4718=_0x1c4d81[_0x27af('0x7d')]==='zoho.eu'?'eu':_0x27af('0x85');return getAccessToken(_0x1c4d81)[_0x27af('0x28')](function(_0x102ae4){_0x5444df=_0x102ae4;return getUser(_0x5444df,_0x3c4718,_0x1c4d81);})[_0x27af('0x28')](function(_0x5398e9){_0x53475a=_0x5398e9;logger[_0x27af('0x2f')](_0x27af('0x90'),_0x53475a['id']);return getEndUser(_0x5444df,_0x3c4718,_0x1c4d81,_0x2d0c0b[_0x27af('0x86')],_0x2d0c0b[_0x27af('0x87')],_0x53475a,_0x13af6d);})[_0x27af('0x28')](function(_0x264466){_0xa67082=_0x264466;return getCall(_0x5444df,_0x3c4718,_0x1c4d81,_0x53475a,_0xa67082,_0x13af6d,_0x2d0c0b,_0x27af('0x77'));})['then'](function(_0x4e739f){if(_0x4e739f){logger[_0x27af('0x2f')](_0x27af('0x88'),_0x4e739f['id']);}})[_0x27af('0x2b')](function(_0x46b1b5){logger[_0x27af('0x2c')]('['+_0x2d0c0b[_0x27af('0x68')][_0x27af('0x96')]()+']',JSON['stringify'](_0x46b1b5));});}; \ No newline at end of file +var _0x2e54=['recordingFormat','none','/api/voice/recordings/','uniqueid','destcalleridname','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged','lastevent','toUpperCase','/downloads?type=uniqueid&token=','calleridname','calleridnum','lodash','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','refresh_token','expires_in','seconds','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','user','profile','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','Call_Duration','talktime','mm:ss','answertime','utc','YYYY-MM-DDTHH:mm:ss','diff','called','Call_Result','Called','complete','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','queue','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','The\x20Call\x20ID\x20is:','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash'];(function(_0xb05a5b,_0x427f98){var _0x144ef4=function(_0x42a280){while(--_0x42a280){_0xb05a5b['push'](_0xb05a5b['shift']());}};_0x144ef4(++_0x427f98);}(_0x2e54,0x1dd));var _0x42e5=function(_0x14cef5,_0x3c911d){_0x14cef5=_0x14cef5-0x0;var _0x1fa574=_0x2e54[_0x14cef5];return _0x1fa574;};'use strict';var _=require(_0x42e5('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x42e5('0x1'));var intUtil=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var Redis=require(_0x42e5('0x4'));var BPromise=require(_0x42e5('0x5'));var config=require(_0x42e5('0x6'));var logger=require(_0x42e5('0x7'))('zoho');config[_0x42e5('0x8')]=_[_0x42e5('0x9')](config[_0x42e5('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x42e5('0xa'))(new Redis(config['redis']));function emit(_0x335b92,_0x490b99,_0x3a8494){io['to'](_0x335b92)[_0x42e5('0xb')](_0x490b99,_0x3a8494);}function request(_0x10ee5a){logger[_0x42e5('0xc')](_0x42e5('0xd'),JSON[_0x42e5('0xe')](_0x10ee5a));return rp(_0x10ee5a);}function getCustomFields(_0xe1ab4b,_0x2fa2f0){var _0x197752={};if(_0xe1ab4b['length']>0x0){_[_0x42e5('0xf')](_0xe1ab4b,function(_0x28b3b3){if(_['includes']([_0x42e5('0x10'),_0x42e5('0x11')],_0x28b3b3[_0x42e5('0x12')])&&_0x28b3b3[_0x42e5('0x13')]){_0x197752[_0x28b3b3[_0x42e5('0x13')]]=_0x28b3b3[_0x42e5('0x14')][_0x42e5('0x15')]();}else if(_0x28b3b3[_0x42e5('0x12')]===_0x42e5('0x16')&&_0x28b3b3[_0x42e5('0x17')]&&_0x28b3b3['idField']&&_0x2fa2f0[_0x28b3b3[_0x42e5('0x17')]]){_0x197752[_0x28b3b3[_0x42e5('0x13')]]=_0x2fa2f0[_0x28b3b3[_0x42e5('0x17')]][_0x42e5('0x15')]();}else if(_0x28b3b3[_0x42e5('0x12')]===_0x42e5('0x18')&&_0x28b3b3[_0x42e5('0x19')]&&_0x28b3b3[_0x42e5('0x19')][_0x42e5('0x1a')]&&_0x28b3b3[_0x42e5('0x13')]&&_0x2fa2f0[_0x28b3b3[_0x42e5('0x19')][_0x42e5('0x1a')][_0x42e5('0x1b')]()]){_0x197752[_0x28b3b3[_0x42e5('0x13')]]=_0x2fa2f0[_0x28b3b3['Variable'][_0x42e5('0x1a')]['toLowerCase']()]['toString']();}});}return _0x197752;}function getName(_0x14d16d){if(_0x14d16d[_0x42e5('0x1c')]('\x20')>0x0){var _0x5a1de2=_0x14d16d[_0x42e5('0x1d')](/ (.+)/);if(_0x5a1de2[0x1]){return _0x5a1de2;}}return[_0x14d16d,_0x14d16d];}var accountsTokens={};function getAccessToken(_0x39a3e2){return new Promise(function(_0x1c2169,_0x3fde76){if(!_[_0x42e5('0x1e')](accountsTokens[_0x39a3e2['id']])&&!_[_0x42e5('0x1e')](accountsTokens[_0x39a3e2['id']][_0x42e5('0x1f')])){if(moment()['isBefore'](accountsTokens[_0x39a3e2['id']]['expires_in'])){_0x1c2169(accountsTokens[_0x39a3e2['id']][_0x42e5('0x1f')]);}}var _0x52d319;switch(_0x39a3e2[_0x42e5('0x20')]){case'US':_0x52d319=_0x42e5('0x21');break;case'AU':_0x52d319=_0x42e5('0x22');break;case'EU':_0x52d319=_0x42e5('0x23');break;case'IN':_0x52d319=_0x42e5('0x24');break;case'CN':_0x52d319='https://accounts.zoho.com.cn';break;default:_0x52d319=_0x42e5('0x23');break;}var _0xf29221={'method':_0x42e5('0x25'),'uri':_0x52d319+_0x42e5('0x26'),'qs':{'refresh_token':_0x39a3e2[_0x42e5('0x27')],'client_id':_0x39a3e2['clientId'],'client_secret':_0x39a3e2['clientSecret'],'grant_type':_0x42e5('0x28')},'json':!![]};return rp(_0xf29221)['then'](function(_0x56f812){accountsTokens[_0x39a3e2['id']]={'access_token':_0x56f812[_0x42e5('0x1f')],'expires_in':moment()['add'](_0x56f812[_0x42e5('0x29')],_0x42e5('0x2a'))};_0x1c2169(_0x56f812[_0x42e5('0x1f')]);})[_0x42e5('0x2b')](function(_0x27ae27){logger[_0x42e5('0x2c')]('Failing\x20creating\x20the\x20access_token',_0x27ae27[_0x42e5('0x2d')]);_0x3fde76(_0x27ae27);});});}function getUser(_0x201d9e,_0x39f763,_0x2c53d4,_0x1d22ba){logger[_0x42e5('0x2e')](_0x42e5('0x2f'));return request({'method':_0x42e5('0x30'),'uri':util[_0x42e5('0x31')](_0x42e5('0x32'),_0x39f763),'qs':{'type':_0x42e5('0x33')},'headers':{'Authorization':_0x42e5('0x34')+_0x201d9e},'json':!![]})[_0x42e5('0x35')](function(_0x599750){if(_0x599750[_0x42e5('0x36')]){var _0xf5a3dc=-0x1;if(_[_0x42e5('0x37')](_0x599750[_0x42e5('0x36')])){if(!_['isNil'](_0x1d22ba)){_0xf5a3dc=_['findIndex'](_0x599750[_0x42e5('0x36')],function(_0x59f8d6){return _0x59f8d6[_0x42e5('0x38')]===_0x1d22ba;});}if(_0xf5a3dc>=0x0){logger['info'](_0x42e5('0x39'));}else{logger[_0x42e5('0x2e')](_0x42e5('0x3a'));_0xf5a3dc=_['findIndex'](_0x599750[_0x42e5('0x36')],function(_0x3a8d1c){return _0x3a8d1c['profile'][_0x42e5('0x1a')]==='Administrator';});}return _0x599750[_0x42e5('0x36')][_0xf5a3dc];}else{if(_0x599750[_0x42e5('0x3b')][_0x42e5('0x3c')][_0x42e5('0x1a')]===_0x42e5('0x3d')){logger[_0x42e5('0x2e')](_0x42e5('0x3a'));user=_0x599750['user'];return user;}else{logger['error'](_0x42e5('0x3e'),JSON[_0x42e5('0xe')](_0x599750));throw new Error(_0x42e5('0x3f')+JSON['stringify'](_0x599750));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x599750));throw new Error(_0x42e5('0x3f')+JSON[_0x42e5('0xe')](_0x599750));}})[_0x42e5('0x2b')](function(_0xedb7bc){console[_0x42e5('0x2c')](_0xedb7bc);});}function getZohoUser(_0x2a6e9c,_0x24a208){return new BPromise(function(_0x11060d,_0x59bc8d){request(_0x2a6e9c)[_0x42e5('0x35')](function(_0x587832){var _0x470338=null;if(_0x587832){_0x470338=_0x587832[_0x42e5('0x40')][0x0];_0x470338[_0x42e5('0x41')]=_0x24a208;}_0x11060d(_0x470338);})[_0x42e5('0x2b')](function(_0x251dd9){_0x59bc8d(_0x251dd9);});});}function createEndUser(_0x162679,_0xd5e7f5,_0x5ab9b8,_0x20f372,_0x356ff6,_0x5362c8){var _0x5ab9b8=getName(_0x5ab9b8);return request({'method':'POST','uri':'https://www.zohoapis.'+_0xd5e7f5+'/crm/v2/'+_[_0x42e5('0x42')](_0x5362c8[_0x42e5('0x43')])+'s','body':{'data':[{'Last_Name':_0x5ab9b8[0x1],'First_Name':_0x5ab9b8[0x0],'Phone':_0x20f372,'Owner':{'name':!_[_0x42e5('0x1e')](_0x356ff6[_0x42e5('0x44')][_0x42e5('0x1a')])?_0x356ff6[_0x42e5('0x44')][_0x42e5('0x1a')]:!_['isNil'](_0x356ff6[_0x42e5('0x45')])?_0x356ff6[_0x42e5('0x45')]+'\x20'+_0x356ff6['last_name']:_0x356ff6[_0x42e5('0x46')],'id':_0x356ff6['id']}}]},'headers':{'Authorization':_0x42e5('0x34')+_0x162679},'json':!![]})['then'](function(_0x33054f){if(_0x33054f&&_0x33054f[_0x42e5('0x40')][0x0][_0x42e5('0x47')]===_0x42e5('0x48')){var _0x424304=_0x33054f['data'][0x0][_0x42e5('0x49')];_0x424304[_0x42e5('0x41')]=_[_0x42e5('0x42')](_0x5362c8[_0x42e5('0x43')])+'s';return _0x424304;}logger['error'](_0x42e5('0x3e'),JSON[_0x42e5('0xe')](data));throw new Error(_0x42e5('0x4a')+JSON[_0x42e5('0xe')](data));})[_0x42e5('0x2b')](function(_0x68ad9b){console[_0x42e5('0x4b')](_0x42e5('0x4c'),_0x68ad9b);});}function getEndUser(_0x54c75b,_0x43f3ee,_0x5b27f6,_0x4b4dd6,_0x1e4fa0,_0x47441a,_0x36a6a4){var _0x3d2fea={'method':_0x42e5('0x30'),'uri':'','headers':{'Authorization':_0x42e5('0x34')+_0x54c75b},'json':!![]};switch(_0x36a6a4[_0x42e5('0x4d')]){case'contact_lead':_0x3d2fea[_0x42e5('0x4e')]=_0x42e5('0x4f')+_0x43f3ee+_0x42e5('0x50')+_0x1e4fa0+'))';return getZohoUser(_0x3d2fea,_0x42e5('0x51'))[_0x42e5('0x35')](function(_0xc8de4d){if(_0xc8de4d)return _0xc8de4d;_0x3d2fea[_0x42e5('0x4e')]=_0x42e5('0x4f')+_0x43f3ee+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1e4fa0+'))';return getZohoUser(_0x3d2fea,_0x42e5('0x52'))[_0x42e5('0x35')](function(_0x3616f4){if(_0x3616f4)return _0x3616f4;if(_0x36a6a4[_0x42e5('0x43')]!=_0x42e5('0x53')){return createEndUser(_0x54c75b,_0x43f3ee,_0x4b4dd6,_0x1e4fa0,_0x47441a,_0x36a6a4);}else{return{};}});});break;case _0x42e5('0x54'):_0x3d2fea[_0x42e5('0x4e')]=_0x42e5('0x4f')+_0x43f3ee+_0x42e5('0x50')+_0x1e4fa0+'))';return getZohoUser(_0x3d2fea,'Contacts')[_0x42e5('0x35')](function(_0x56ef4b){if(_0x56ef4b)return _0x56ef4b;if(_0x36a6a4[_0x42e5('0x43')]!=_0x42e5('0x53')){return createEndUser(_0x54c75b,_0x43f3ee,_0x4b4dd6,_0x1e4fa0,_0x47441a,_0x36a6a4);}else{return{};}});break;case _0x42e5('0x55'):_0x3d2fea['uri']='https://www.zohoapis.'+_0x43f3ee+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1e4fa0+'))';return getZohoUser(_0x3d2fea,_0x42e5('0x52'))[_0x42e5('0x35')](function(_0x11fd3c){if(_0x11fd3c)return _0x11fd3c;if(_0x36a6a4[_0x42e5('0x43')]!='nothing'){return createEndUser(_0x54c75b,_0x43f3ee,_0x4b4dd6,_0x1e4fa0,_0x47441a,_0x36a6a4);}else{return{};}});break;}}function getCall(_0x3ae9de,_0x26782e,_0x18cedc,_0x504110,_0x34e169,_0x5070aa,_0x319088,_0x2583cd){logger['info'](_0x42e5('0x56'));var _0x18509a={};_0x18509a[_0x42e5('0x57')]={'name':!_[_0x42e5('0x1e')](_0x504110[_0x42e5('0x44')][_0x42e5('0x1a')])&&!_[_0x42e5('0x1e')](_0x504110[_0x42e5('0x3c')][_0x42e5('0x1a')])&&_0x504110[_0x42e5('0x3c')]['name']===_0x42e5('0x58')?_0x504110[_0x42e5('0x44')][_0x42e5('0x1a')]:!_[_0x42e5('0x1e')](_0x504110[_0x42e5('0x45')])?_0x504110['first_name']+'\x20'+_0x504110[_0x42e5('0x46')]:_0x504110[_0x42e5('0x46')],'id':_0x504110['id']};_0x18509a[_0x42e5('0x59')]=intUtil[_0x42e5('0x5a')](_0x5070aa['Subjects'],_0x319088,'\x20');_0x18509a['Description']=intUtil['getString'](_0x5070aa[_0x42e5('0x5b')],_0x319088,'\x0a');if(_0x34e169[_0x42e5('0x41')]==='Contacts'){_0x18509a[_0x42e5('0x5c')]={'name':!_[_0x42e5('0x1e')](_0x34e169[_0x42e5('0x5d')])?_0x34e169[_0x42e5('0x5d')]:!_[_0x42e5('0x1e')](_0x34e169[_0x42e5('0x5e')])?_0x34e169[_0x42e5('0x5e')]+'\x20'+_0x34e169[_0x42e5('0x5f')]:_0x34e169[_0x42e5('0x5f')],'id':_0x34e169['id']};}if(_0x34e169['enduserType']===_0x42e5('0x52')){_0x18509a['What_Id']={'name':!_[_0x42e5('0x1e')](_0x34e169[_0x42e5('0x5d')])?_0x34e169[_0x42e5('0x5d')]:!_[_0x42e5('0x1e')](_0x34e169[_0x42e5('0x5e')])?_0x34e169[_0x42e5('0x5e')]+'\x20'+_0x34e169[_0x42e5('0x5f')]:_0x34e169[_0x42e5('0x5f')],'id':_0x34e169['id']};_0x18509a[_0x42e5('0x60')]=_[_0x42e5('0x42')](_0x34e169[_0x42e5('0x41')]);}if(_0x319088['talktime']){_0x18509a[_0x42e5('0x61')]=moment['utc'](parseInt(_0x319088[_0x42e5('0x62')])*0x3e8)['format'](_0x42e5('0x63'));}else if(_0x319088[_0x42e5('0x64')]&&_0x319088['endtime']){_0x18509a[_0x42e5('0x61')]=moment[_0x42e5('0x65')](moment(_0x319088['endtime'],_0x42e5('0x66'))[_0x42e5('0x67')](moment(_0x319088['starttime'],_0x42e5('0x66'))))[_0x42e5('0x31')](_0x42e5('0x63'));}switch(_0x319088['lastevent']){case _0x42e5('0x68'):_0x18509a[_0x42e5('0x69')]=_0x42e5('0x6a');break;case _0x42e5('0x6b'):case'connect':_0x18509a[_0x42e5('0x69')]='Answered';break;case _0x42e5('0x6c'):_0x18509a[_0x42e5('0x69')]=_0x42e5('0x6d');break;case _0x42e5('0x6e'):_0x18509a[_0x42e5('0x69')]=_0x42e5('0x6f');break;case _0x42e5('0x70'):_0x18509a['Call_Result']=_0x42e5('0x71');default:}_0x18509a[_0x42e5('0x72')]=(_0x2583cd===_0x42e5('0x73')?moment(_0x319088[_0x42e5('0x74')])[_0x42e5('0x31')](_0x42e5('0x66')):moment(_0x319088[_0x42e5('0x75')])[_0x42e5('0x31')](_0x42e5('0x66')))||moment()['format'](_0x42e5('0x66'));_0x18509a[_0x42e5('0x76')]=_0x2583cd||_0x42e5('0x77');_0x18509a=_[_0x42e5('0x78')](_0x18509a,getCustomFields(_0x5070aa['Fields'],_0x319088));return request({'method':_0x42e5('0x25'),'uri':_0x42e5('0x4f')+_0x26782e+_0x42e5('0x79'),'headers':{'Authorization':_0x42e5('0x34')+_0x3ae9de},'body':{'data':[_0x18509a]},'json':!![]})['then'](function(_0x5cbc4c){if(_0x5cbc4c&&_0x5cbc4c['data'][0x0][_0x42e5('0x47')]===_0x42e5('0x48')){logger[_0x42e5('0x2e')](_0x42e5('0x7a'));return{'id':_0x5cbc4c[_0x42e5('0x40')][0x0][_0x42e5('0x49')]['id']};}})[_0x42e5('0x2b')](function(_0x3cc383){logger[_0x42e5('0x2e')]('err',_0x3cc383[_0x42e5('0x2d')]);console[_0x42e5('0x4b')](_0x42e5('0x7b'),_0x3cc383);});}exports[_0x42e5('0x7c')]=function(_0x365d6b,_0x2c1978,_0x209d84,_0x147613,_0x4d5357,_0x548f8a){var _0x22025c,_0x201650,_0x50e69c;_0x548f8a['host']=intUtil['stripTrailingSlash'](_0x548f8a[_0x42e5('0x7d')]);_0x548f8a[_0x42e5('0x7e')]=intUtil['stripTrailingSlash'](_0x548f8a[_0x42e5('0x7e')]);if(_0x4d5357&&_0x4d5357[_0x42e5('0x7f')]){logger['info'](_0x42e5('0x80'),_0x42e5('0x81'));_0x2c1978['recordingURL']=_0x548f8a[_0x42e5('0x7e')]+'/api/voice/recordings/'+_0x2c1978['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x2c1978['uniqueid']);}else{_0x2c1978[_0x42e5('0x82')]='';}var _0x234e29=_0x548f8a['host']===_0x42e5('0x83')?'eu':_0x42e5('0x84');return getAccessToken(_0x548f8a)[_0x42e5('0x35')](function(_0x290010){_0x50e69c=_0x290010;return getUser(_0x50e69c,_0x234e29,_0x548f8a,_0x147613[_0x42e5('0x38')]);})[_0x42e5('0x35')](function(_0x53f9df){_0x22025c=_0x53f9df;logger[_0x42e5('0x2e')](_0x42e5('0x85'),_0x22025c['id']);return getEndUser(_0x50e69c,_0x234e29,_0x548f8a,_0x2c1978['calleridname'],_0x2c1978['calleridnum'],_0x22025c,_0x209d84);})[_0x42e5('0x35')](function(_0xfa822e){_0x201650=_0xfa822e;return getCall(_0x50e69c,_0x234e29,_0x548f8a,_0x22025c,_0x201650,_0x209d84,_0x2c1978,_0x42e5('0x77'));})[_0x42e5('0x35')](function(_0x1e2fa7){if(_0x1e2fa7){logger[_0x42e5('0x2e')](_0x42e5('0x86'),_0x1e2fa7['id']);logger['info']('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x42e5('0x87'),_0x147613[_0x42e5('0x1a')]),'trigger:browser:url',{'uri':_0x42e5('0x88')+_0x548f8a['host']+_0x42e5('0x89')+_0x1e2fa7['id']});}})[_0x42e5('0x2b')](function(_0x3493d4){logger[_0x42e5('0x2c')](_0x42e5('0x80'),JSON[_0x42e5('0xe')](_0x3493d4));});};exports[_0x42e5('0x73')]=function(_0xea3650,_0x1a9adb,_0x3b308f,_0x1ee9b2,_0x78573b,_0x20cf62,_0x168faa){var _0x1f2352,_0x459abf,_0x349f93;_0x20cf62[_0x42e5('0x7d')]=intUtil['stripTrailingSlash'](_0x20cf62[_0x42e5('0x7d')]);_0x20cf62[_0x42e5('0x7e')]=intUtil[_0x42e5('0x8a')](_0x20cf62[_0x42e5('0x7e')]);if(_0x168faa&&_0x168faa[_0x42e5('0x8b')]&&_0x168faa[_0x42e5('0x8b')]!==_0x42e5('0x8c')){logger[_0x42e5('0x2e')]('[OUTBOUND]',_0x42e5('0x81'));_0x1a9adb[_0x42e5('0x82')]=_0x20cf62[_0x42e5('0x7e')]+_0x42e5('0x8d')+_0x1a9adb[_0x42e5('0x8e')]+'/downloads?type=uniqueid&token='+md5(_0x1a9adb['uniqueid']);}var _0xc06672=_0x20cf62[_0x42e5('0x7d')]===_0x42e5('0x83')?'eu':_0x42e5('0x84');return getAccessToken(_0x20cf62)[_0x42e5('0x35')](function(_0x2ff615){_0x349f93=_0x2ff615;return getUser(_0x349f93,_0xc06672,_0x20cf62,_0x1ee9b2[_0x42e5('0x38')]);})[_0x42e5('0x35')](function(_0x301a0f){_0x1f2352=_0x301a0f;logger['info'](_0x42e5('0x85'),_0x1f2352['id']);return getEndUser(_0x349f93,_0xc06672,_0x20cf62,_0x1a9adb[_0x42e5('0x8f')],_0x1a9adb['destcalleridnum'],_0x1f2352,_0x3b308f);})[_0x42e5('0x35')](function(_0x44d9ff){_0x459abf=_0x44d9ff;return getCall(_0x349f93,_0xc06672,_0x20cf62,_0x1f2352,_0x459abf,_0x3b308f,_0x1a9adb,_0x42e5('0x90'));})[_0x42e5('0x35')](function(_0x5318c9){if(_0x5318c9){logger['info']('The\x20Call\x20ID\x20is:',_0x5318c9['id']);logger[_0x42e5('0x2e')](_0x42e5('0x91'),_0x42e5('0x92'));emit(util[_0x42e5('0x31')](_0x42e5('0x87'),_0x1ee9b2[_0x42e5('0x1a')]),_0x42e5('0x93'),{'uri':'https://crm.'+_0x20cf62[_0x42e5('0x7d')]+_0x42e5('0x89')+_0x5318c9['id']});}})[_0x42e5('0x2b')](function(_0x516416){logger[_0x42e5('0x2c')]('[OUTBOUND]',JSON['stringify'](_0x516416));});};exports[_0x42e5('0x94')]=function(_0x1e1d32,_0x3859a7,_0x4b1fc4,_0x5e64a9,_0xf5d30f,_0x585793){var _0x49e2f9,_0x786950,_0x3ff124;_0x585793['host']=intUtil[_0x42e5('0x8a')](_0x585793[_0x42e5('0x7d')]);_0x585793[_0x42e5('0x7e')]=intUtil[_0x42e5('0x8a')](_0x585793[_0x42e5('0x7e')]);if(_0xf5d30f&&_0xf5d30f[_0x42e5('0x7f')]){logger['info']('['+_0x3859a7[_0x42e5('0x95')][_0x42e5('0x96')]()+']',_0x42e5('0x81'));_0x3859a7['recordingURL']=_0x585793[_0x42e5('0x7e')]+_0x42e5('0x8d')+_0x3859a7['uniqueid']+_0x42e5('0x97')+md5(_0x3859a7[_0x42e5('0x8e')]);}else{_0x3859a7[_0x42e5('0x82')]='';}var _0x4a1bb8=_0x585793[_0x42e5('0x7d')]===_0x42e5('0x83')?'eu':'com';return getAccessToken(_0x585793)['then'](function(_0x3a539d){_0x3ff124=_0x3a539d;return getUser(_0x3ff124,_0x4a1bb8,_0x585793);})['then'](function(_0x290083){_0x49e2f9=_0x290083;logger[_0x42e5('0x2e')](_0x42e5('0x85'),_0x49e2f9['id']);return getEndUser(_0x3ff124,_0x4a1bb8,_0x585793,_0x3859a7[_0x42e5('0x98')],_0x3859a7[_0x42e5('0x99')],_0x49e2f9,_0x4b1fc4);})['then'](function(_0xeee19d){_0x786950=_0xeee19d;return getCall(_0x3ff124,_0x4a1bb8,_0x585793,_0x49e2f9,_0x786950,_0x4b1fc4,_0x3859a7,_0x42e5('0x77'));})[_0x42e5('0x35')](function(_0x4e1188){if(_0x4e1188){logger[_0x42e5('0x2e')](_0x42e5('0x86'),_0x4e1188['id']);}})[_0x42e5('0x2b')](function(_0x23800){logger['error']('['+_0x3859a7[_0x42e5('0x95')]['toUpperCase']()+']',JSON['stringify'](_0x23800));});}; \ 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 17a372c..cfbbac7 100644 --- a/server/services/ami/trigger/script/index.js +++ b/server/services/ami/trigger/script/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x3fc169,_0x4d8f6b){var _0x1a90ef=function(_0x2136c1){while(--_0x2136c1){_0x3fc169['push'](_0x3fc169['shift']());}};_0x1a90ef(++_0x4d8f6b);}(_0x7a54,0x106));var _0x47a5=function(_0xde823e,_0x452786){_0xde823e=_0xde823e-0x0;var _0x34d900=_0x7a54[_0xde823e];return _0x34d900;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x43f369,_0x47c3fd){var _0x5187f6=function(_0xb7d29e){while(--_0xb7d29e){_0x43f369['push'](_0x43f369['shift']());}};_0x5187f6(++_0x47c3fd);}(_0x7a54,0x106));var _0x47a5=function(_0x43b8dc,_0x1f80e3){_0x43b8dc=_0x43b8dc-0x0;var _0x1c6e3f=_0x7a54[_0x43b8dc];return _0x1c6e3f;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index dadec09..ccb3a3c 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x7857cb,_0x59c336){var _0x440c73=function(_0x12e1dd){while(--_0x12e1dd){_0x7857cb['push'](_0x7857cb['shift']());}};_0x440c73(++_0x59c336);}(_0x7a54,0x106));var _0x47a5=function(_0x43843b,_0x17cc43){_0x43843b=_0x43843b-0x0;var _0xc446f0=_0x7a54[_0x43843b];return _0xc446f0;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x12261b,_0x1311f3){var _0x1cb9eb=function(_0x1aa0f4){while(--_0x1aa0f4){_0x12261b['push'](_0x12261b['shift']());}};_0x1cb9eb(++_0x1311f3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x24f430,_0x523751){_0x24f430=_0x24f430-0x0;var _0x23cc82=_0x5f2f[_0x24f430];return _0x23cc82;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 38bfce8..7ccf9bf 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 _0x15cb=['http','Request','request','debug','rpc','error','exports','bluebird','routing'];(function(_0x20e0da,_0x39f155){var _0x4fc3fb=function(_0x2b1e6a){while(--_0x2b1e6a){_0x20e0da['push'](_0x20e0da['shift']());}};_0x4fc3fb(++_0x39f155);}(_0x15cb,0x16f));var _0xb15c=function(_0x1d1724,_0x2f7377){_0x1d1724=_0x1d1724-0x0;var _0x2a3e62=_0x15cb[_0x1d1724];return _0x2a3e62;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xb15c('0x0'));var logger=require('../../config/logger')(_0xb15c('0x1'));var client=jayson['client'][_0xb15c('0x2')]({'port':0x2329});client[_0xb15c('0x3')]=function(_0x2777f9,_0x3d8546){return new BPromise(function(_0x4f1c8f,_0x432920){return client[_0xb15c('0x4')](_0x2777f9,_0x3d8546)['then'](function(_0x5a1b40){logger[_0xb15c('0x5')](_0xb15c('0x6'),_0xb15c('0x1'),_0x2777f9,_0x3d8546,_0x5a1b40);if(_0x5a1b40[_0xb15c('0x7')]){logger[_0xb15c('0x7')](_0xb15c('0x6'),_0xb15c('0x1'),_0x2777f9,_0x5a1b40[_0xb15c('0x7')]['message'],_0x3d8546);return _0x432920(_0x5a1b40[_0xb15c('0x7')]['message']);}else{return _0x4f1c8f(_0x5a1b40['result']);}})['catch'](function(_0x20cff6){logger[_0xb15c('0x7')](_0xb15c('0x6'),_0xb15c('0x1'),_0x2777f9,_0x20cff6,_0x3d8546);return _0x432920(_0x20cff6);});});};module[_0xb15c('0x8')]=client; \ No newline at end of file +var _0xe002=['debug','rpc','error','routing','message','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xe002,0xf7));var _0x2e00=function(_0x10dc64,_0x11bb29){_0x10dc64=_0x10dc64-0x0;var _0x9cf98d=_0xe002[_0x10dc64];return _0x9cf98d;};'use strict';var jayson=require(_0x2e00('0x0'));var BPromise=require(_0x2e00('0x1'));var logger=require(_0x2e00('0x2'))('routing');var client=jayson[_0x2e00('0x3')][_0x2e00('0x4')]({'port':0x2329});client[_0x2e00('0x5')]=function(_0x5ea0f5,_0x34f964){return new BPromise(function(_0xba44f2,_0x2cb0ac){return client[_0x2e00('0x6')](_0x5ea0f5,_0x34f964)[_0x2e00('0x7')](function(_0x120155){logger[_0x2e00('0x8')](_0x2e00('0x9'),'routing',_0x5ea0f5,_0x34f964,_0x120155);if(_0x120155[_0x2e00('0xa')]){logger[_0x2e00('0xa')]('rpc',_0x2e00('0xb'),_0x5ea0f5,_0x120155[_0x2e00('0xa')][_0x2e00('0xc')],_0x34f964);return _0x2cb0ac(_0x120155[_0x2e00('0xa')]['message']);}else{return _0xba44f2(_0x120155['result']);}})[_0x2e00('0xd')](function(_0x217799){logger[_0x2e00('0xa')]('rpc',_0x2e00('0xb'),_0x5ea0f5,_0x217799,_0x34f964);return _0x2cb0ac(_0x217799);});});};module[_0x2e00('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 58648b0..5c09c5c 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 _0xbb70=['log','bluebird','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','resolve','then','getMailAccounts','initMailAccounts','refresh','listen','getSettings','loginMailFrequency','catch'];(function(_0x491cde,_0xde5e95){var _0x22cb58=function(_0x50f36c){while(--_0x50f36c){_0x491cde['push'](_0x491cde['shift']());}};_0x22cb58(++_0xde5e95);}(_0xbb70,0x187));var _0x0bb7=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xbb70[_0x1477ef];return _0x164acd;};'use strict';var BPromise=require(_0x0bb7('0x0'));var server=require('./server');var Realtime=require(_0x0bb7('0x1'));var EmailChannel=require(_0x0bb7('0x2'));var mailAccount=require(_0x0bb7('0x3'));var setting=require(_0x0bb7('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x0bb7('0x5')]()[_0x0bb7('0x6')](mailAccount[_0x0bb7('0x7')]())[_0x0bb7('0x6')](realtime[_0x0bb7('0x8')]())[_0x0bb7('0x6')](function(){email[_0x0bb7('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x0bb7('0xa')](realtime,email)[_0x0bb7('0x6')](function(){return initRealtime();})['then'](function(){return setting[_0x0bb7('0xb')]();})[_0x0bb7('0x6')](function(_0x9bd92e){return setInterval(initRealtime,_0x9bd92e[_0x0bb7('0xc')]*0x3e8);})[_0x0bb7('0xd')](function(_0x4eac5e){console[_0x0bb7('0xe')](_0x4eac5e);});}main(); \ No newline at end of file +var _0x1022=['./rpc/setting','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount'];(function(_0xfe8cd0,_0x382599){var _0x2874e2=function(_0xb2cd5d){while(--_0xb2cd5d){_0xfe8cd0['push'](_0xfe8cd0['shift']());}};_0x2874e2(++_0x382599);}(_0x1022,0x1db));var _0x2102=function(_0x210b8c,_0xd76f59){_0x210b8c=_0x210b8c-0x0;var _0xf39efa=_0x1022[_0x210b8c];return _0xf39efa;};'use strict';var BPromise=require(_0x2102('0x0'));var server=require(_0x2102('0x1'));var Realtime=require(_0x2102('0x2'));var EmailChannel=require(_0x2102('0x3'));var mailAccount=require(_0x2102('0x4'));var setting=require(_0x2102('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0x2102('0x6')](mailAccount[_0x2102('0x7')]())[_0x2102('0x6')](realtime[_0x2102('0x8')]())[_0x2102('0x6')](function(){email[_0x2102('0x9')](realtime[_0x2102('0xa')]);return realtime;});}function main(){return server[_0x2102('0xb')](realtime,email)[_0x2102('0x6')](function(){return initRealtime();})[_0x2102('0x6')](function(){return setting[_0x2102('0xc')]();})[_0x2102('0x6')](function(_0x327cd3){return setInterval(initRealtime,_0x327cd3[_0x2102('0xd')]*0x3e8);})['catch'](function(_0x1ab2f1){console[_0x2102('0xe')](_0x1ab2f1);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index a73c055..b47c8be 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 _0x1472=['send','verifySmtp','Smtp','verify','exports','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','active','Imap','messageStatus','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','status','disabled','connected','name','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail'];(function(_0x4e0599,_0x2cea76){var _0x158744=function(_0x40bb33){while(--_0x40bb33){_0x4e0599['push'](_0x4e0599['shift']());}};_0x158744(++_0x2cea76);}(_0x1472,0x1ad));var _0x2147=function(_0x104b35,_0x13f218){_0x104b35=_0x104b35-0x0;var _0x55584d=_0x1472[_0x104b35];return _0x55584d;};'use strict';var _=require('lodash');var moment=require(_0x2147('0x0'));var BPromise=require('bluebird');var md5=require(_0x2147('0x1'));var Redis=require(_0x2147('0x2'));var config=require(_0x2147('0x3'));var logger=require(_0x2147('0x4'))(_0x2147('0x5'));config[_0x2147('0x6')]=_[_0x2147('0x7')](config[_0x2147('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x2147('0x8'))(new Redis(config['redis']));var EmailImap=require(_0x2147('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x2147('0xa'));var md5Accounts={};function EmailChannel(_0x4834ac){logger[_0x2147('0xb')](_0x2147('0xc'));this['mailAccounts']=_0x4834ac[_0x2147('0xd')];this[_0x2147('0xe')]={};this[_0x2147('0xf')]=new EmailSmtp();}EmailChannel['prototype'][_0x2147('0x10')]=function(_0x48c750){var _0x287b01=this[_0x2147('0xd')][_0x48c750];var _0x229c49={'id':_0x287b01['id'],'name':_0x287b01['name'],'key':_0x287b01['key'],'active':_0x287b01[_0x2147('0x11')],'Imap':{'status':_0x287b01[_0x2147('0x12')]['status'],'messageStatus':_0x287b01[_0x2147('0x12')][_0x2147('0x13')],'total':_0x287b01[_0x2147('0x12')]['total']}};if(_[_0x2147('0x14')](md5Accounts[_0x48c750])){md5Accounts[_0x48c750]={};}var _0x1e0366=md5(JSON[_0x2147('0x15')](_0x229c49));if(md5Accounts[_0x48c750][_0x2147('0x1')]!==_0x1e0366){md5Accounts[_0x48c750][_0x2147('0x1')]=_0x1e0366;io['emit'](_0x2147('0x16'),_0x229c49);}};EmailChannel[_0x2147('0x17')][_0x2147('0x18')]=function(_0x58384d){for(var _0x46b96a in _0x58384d){if(_0x58384d[_0x2147('0x19')](_0x46b96a)){if(_0x58384d[_0x46b96a][_0x2147('0x12')]&&_0x58384d[_0x46b96a][_0x2147('0x11')]){var _0x18963b=_0x58384d[_0x46b96a]['Imap'];if(!this[_0x2147('0xe')][_0x2147('0x19')](_0x18963b['id'])){this[_0x2147('0xe')][_0x18963b['id']]=new EmailImap(_0x18963b,_0x58384d[_0x46b96a]['email']);this[_0x2147('0xe')][_0x18963b['id']]['on'](_0x2147('0x1a'),this[_0x2147('0x1b')][_0x2147('0x1c')](this,_0x46b96a));this[_0x2147('0xe')][_0x18963b['id']]['on'](_0x2147('0x5'),this[_0x2147('0x1d')][_0x2147('0x1c')](this,_0x46b96a));this[_0x2147('0xe')][_0x18963b['id']]['on'](_0x2147('0x1e'),this[_0x2147('0x1f')][_0x2147('0x1c')](this,_0x46b96a));this[_0x2147('0xe')][_0x18963b['id']]['on'](_0x2147('0x20'),this[_0x2147('0x21')][_0x2147('0x1c')](this,_0x46b96a));}}else{if(_[_0x2147('0x14')](this[_0x2147('0xd')][_0x46b96a][_0x2147('0x12')])){this['mailAccounts'][_0x46b96a][_0x2147('0x12')]={};}this[_0x2147('0xd')][_0x46b96a][_0x2147('0x12')][_0x2147('0x22')]=_0x2147('0x23');this['mailAccounts'][_0x46b96a][_0x2147('0x12')]['messageStatus']='';this[_0x2147('0x10')](_0x46b96a);}}}};EmailChannel[_0x2147('0x17')]['handleImapBox']=function(_0x168ca0,_0x32ec20){if(this[_0x2147('0xd')][_0x168ca0]){this[_0x2147('0xd')][_0x168ca0][_0x2147('0x12')][_0x2147('0x22')]=_0x2147('0x24');this[_0x2147('0xd')][_0x168ca0][_0x2147('0x12')][_0x2147('0x13')]=_0x32ec20[_0x2147('0x25')];if(_0x32ec20[_0x2147('0x26')]){this[_0x2147('0xd')][_0x168ca0][_0x2147('0x12')][_0x2147('0x27')]=_0x32ec20[_0x2147('0x26')][_0x2147('0x27')];}return this[_0x2147('0x10')](_0x168ca0);}};EmailChannel['prototype'][_0x2147('0x1d')]=function(_0x115126,_0xeb68a5){logger[_0x2147('0xb')](_0x2147('0x28'),_0xeb68a5[_0x2147('0x29')],_0xeb68a5[_0x2147('0x2a')],_0xeb68a5['from'],_0x115126);if(this[_0x2147('0xd')][_0x115126]){return mailAccount['notify'](_0x115126,_0xeb68a5)[_0x2147('0x2b')](function(_0x4e63e4){if(_0x4e63e4){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0x2147('0x2c')](function(_0x4b66c9){logger[_0x2147('0x20')](_0x2147('0x2d'),JSON[_0x2147('0x15')](_0x4b66c9));});}};EmailChannel[_0x2147('0x17')][_0x2147('0x1f')]=function(_0x2ebecf){if(this[_0x2147('0xd')][_0x2ebecf]&&this['mailAccounts'][_0x2ebecf][_0x2147('0x12')]){if(this[_0x2147('0xe')][this[_0x2147('0xd')][_0x2ebecf][_0x2147('0x12')]['id']]){delete this['imapAccounts'][this[_0x2147('0xd')][_0x2ebecf][_0x2147('0x12')]['id']];}this['mailAccounts'][_0x2ebecf][_0x2147('0x12')][_0x2147('0x2e')]=moment();this[_0x2147('0x10')](_0x2ebecf);}};EmailChannel[_0x2147('0x17')][_0x2147('0x21')]=function(_0xc1baf2,_0x1e9d42){if(this[_0x2147('0xd')][_0xc1baf2]){this[_0x2147('0xd')][_0xc1baf2]['Imap']['status']=_0x2147('0x20');this['mailAccounts'][_0xc1baf2][_0x2147('0x12')][_0x2147('0x13')]=_0x1e9d42;return this[_0x2147('0x10')](_0xc1baf2);}};EmailChannel['prototype'][_0x2147('0x2f')]=function(_0x22d9c0,_0x454ec3){return this[_0x2147('0xf')][_0x2147('0x30')](_0x22d9c0,_0x454ec3);};EmailChannel['prototype'][_0x2147('0x31')]=function(_0x539171){var _0x6414d6=this;if(this[_0x2147('0xd')][_0x539171['id']]){if(_[_0x2147('0x14')](this[_0x2147('0xd')][_0x539171['id']][_0x2147('0x32')])){this['mailAccounts'][_0x539171['id']][_0x2147('0x32')]={};}this[_0x2147('0xd')][_0x539171['id']]['Smtp'][_0x2147('0x2e')]=moment();return new BPromise(function(_0x38c9a0,_0x1c9941){return _0x6414d6[_0x2147('0xf')]['verify'](_0x539171)[_0x2147('0x2b')](function(_0x402273){_0x6414d6[_0x2147('0xd')][_0x539171['id']]['Smtp'][_0x2147('0x22')]='verified';_0x6414d6[_0x2147('0xd')][_0x539171['id']]['Smtp'][_0x2147('0x13')]='';_0x6414d6[_0x2147('0x10')](_0x539171['id']);_0x38c9a0(_0x402273);})[_0x2147('0x2c')](function(_0x1f6255){_0x6414d6[_0x2147('0xd')][_0x539171['id']][_0x2147('0x32')][_0x2147('0x22')]=_0x2147('0x20');_0x6414d6['mailAccounts'][_0x539171['id']][_0x2147('0x32')][_0x2147('0x13')]=_0x1f6255;_0x6414d6[_0x2147('0x10')](_0x539171['id']);_0x1c9941(_0x1f6255);});});}return this[_0x2147('0xf')][_0x2147('0x33')](_0x539171);};module[_0x2147('0x34')]=EmailChannel; \ No newline at end of file +var _0xa265=['sendMail','smtp','send','Smtp','verify','verified','bluebird','ioredis','../../../config/environment','../../../config/logger','email','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','prototype','emit','name','key','active','status','Imap','messageStatus','isNil','md5','mailAccount:update','refresh','hasOwnProperty','box','bind','handleImapEmail','end','handleImapEnd','error','disabled','handleImapBox','connected','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError'];(function(_0x406e46,_0x5799cb){var _0x4a3742=function(_0x1fa435){while(--_0x1fa435){_0x406e46['push'](_0x406e46['shift']());}};_0x4a3742(++_0x5799cb);}(_0xa265,0x16b));var _0x5a26=function(_0x294df2,_0x5c96e6){_0x294df2=_0x294df2-0x0;var _0x2ef934=_0xa265[_0x294df2];return _0x2ef934;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x5a26('0x0'));var md5=require('md5');var Redis=require(_0x5a26('0x1'));var config=require(_0x5a26('0x2'));var logger=require(_0x5a26('0x3'))(_0x5a26('0x4'));config['redis']=_[_0x5a26('0x5')](config['redis'],{'host':_0x5a26('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0x5a26('0x7'));var EmailSmtp=require(_0x5a26('0x8'));var mailAccount=require(_0x5a26('0x9'));var md5Accounts={};function EmailChannel(_0x2b1fa0){logger[_0x5a26('0xa')]('start\x20email\x20channel');this['mailAccounts']=_0x2b1fa0[_0x5a26('0xb')];this[_0x5a26('0xc')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x5a26('0xd')][_0x5a26('0xe')]=function(_0x4bf027){var _0x1aeda5=this['mailAccounts'][_0x4bf027];var _0x333f6c={'id':_0x1aeda5['id'],'name':_0x1aeda5[_0x5a26('0xf')],'key':_0x1aeda5[_0x5a26('0x10')],'active':_0x1aeda5[_0x5a26('0x11')],'Imap':{'status':_0x1aeda5['Imap'][_0x5a26('0x12')],'messageStatus':_0x1aeda5[_0x5a26('0x13')][_0x5a26('0x14')],'total':_0x1aeda5[_0x5a26('0x13')]['total']}};if(_[_0x5a26('0x15')](md5Accounts[_0x4bf027])){md5Accounts[_0x4bf027]={};}var _0x1a8160=md5(JSON['stringify'](_0x333f6c));if(md5Accounts[_0x4bf027][_0x5a26('0x16')]!==_0x1a8160){md5Accounts[_0x4bf027][_0x5a26('0x16')]=_0x1a8160;io['emit'](_0x5a26('0x17'),_0x333f6c);}};EmailChannel[_0x5a26('0xd')][_0x5a26('0x18')]=function(_0x4bbe7c){for(var _0x38bbad in _0x4bbe7c){if(_0x4bbe7c[_0x5a26('0x19')](_0x38bbad)){if(_0x4bbe7c[_0x38bbad][_0x5a26('0x13')]&&_0x4bbe7c[_0x38bbad][_0x5a26('0x11')]){var _0x2d1498=_0x4bbe7c[_0x38bbad]['Imap'];if(!this[_0x5a26('0xc')][_0x5a26('0x19')](_0x2d1498['id'])){this[_0x5a26('0xc')][_0x2d1498['id']]=new EmailImap(_0x2d1498,_0x4bbe7c[_0x38bbad][_0x5a26('0x4')]);this['imapAccounts'][_0x2d1498['id']]['on'](_0x5a26('0x1a'),this['handleImapBox'][_0x5a26('0x1b')](this,_0x38bbad));this[_0x5a26('0xc')][_0x2d1498['id']]['on'](_0x5a26('0x4'),this[_0x5a26('0x1c')][_0x5a26('0x1b')](this,_0x38bbad));this[_0x5a26('0xc')][_0x2d1498['id']]['on'](_0x5a26('0x1d'),this[_0x5a26('0x1e')][_0x5a26('0x1b')](this,_0x38bbad));this[_0x5a26('0xc')][_0x2d1498['id']]['on'](_0x5a26('0x1f'),this['handleImapError'][_0x5a26('0x1b')](this,_0x38bbad));}}else{if(_[_0x5a26('0x15')](this[_0x5a26('0xb')][_0x38bbad]['Imap'])){this[_0x5a26('0xb')][_0x38bbad][_0x5a26('0x13')]={};}this[_0x5a26('0xb')][_0x38bbad][_0x5a26('0x13')][_0x5a26('0x12')]=_0x5a26('0x20');this[_0x5a26('0xb')][_0x38bbad][_0x5a26('0x13')][_0x5a26('0x14')]='';this[_0x5a26('0xe')](_0x38bbad);}}}};EmailChannel['prototype'][_0x5a26('0x21')]=function(_0x26c1bc,_0x512514){if(this[_0x5a26('0xb')][_0x26c1bc]){this[_0x5a26('0xb')][_0x26c1bc][_0x5a26('0x13')][_0x5a26('0x12')]=_0x5a26('0x22');this[_0x5a26('0xb')][_0x26c1bc][_0x5a26('0x13')][_0x5a26('0x14')]=_0x512514[_0x5a26('0xf')];if(_0x512514['messages']){this[_0x5a26('0xb')][_0x26c1bc][_0x5a26('0x13')][_0x5a26('0x23')]=_0x512514['messages']['total'];}return this['emit'](_0x26c1bc);}};EmailChannel[_0x5a26('0xd')]['handleImapEmail']=function(_0x525806,_0x35fd78){logger[_0x5a26('0xa')](_0x5a26('0x24'),_0x35fd78[_0x5a26('0x25')],_0x35fd78[_0x5a26('0x26')],_0x35fd78['from'],_0x525806);if(this[_0x5a26('0xb')][_0x525806]){return mailAccount['notify'](_0x525806,_0x35fd78)[_0x5a26('0x27')](function(_0x697d13){if(_0x697d13){logger[_0x5a26('0xa')](_0x5a26('0x28'));}})[_0x5a26('0x29')](function(_0x429220){logger[_0x5a26('0x1f')](_0x5a26('0x2a'),JSON['stringify'](_0x429220));});}};EmailChannel[_0x5a26('0xd')][_0x5a26('0x1e')]=function(_0x57bdc4){if(this[_0x5a26('0xb')][_0x57bdc4]&&this[_0x5a26('0xb')][_0x57bdc4][_0x5a26('0x13')]){if(this[_0x5a26('0xc')][this[_0x5a26('0xb')][_0x57bdc4]['Imap']['id']]){delete this[_0x5a26('0xc')][this[_0x5a26('0xb')][_0x57bdc4][_0x5a26('0x13')]['id']];}this[_0x5a26('0xb')][_0x57bdc4][_0x5a26('0x13')][_0x5a26('0x2b')]=moment();this[_0x5a26('0xe')](_0x57bdc4);}};EmailChannel[_0x5a26('0xd')][_0x5a26('0x2c')]=function(_0x4faa78,_0x1be5ad){if(this['mailAccounts'][_0x4faa78]){this[_0x5a26('0xb')][_0x4faa78][_0x5a26('0x13')][_0x5a26('0x12')]=_0x5a26('0x1f');this[_0x5a26('0xb')][_0x4faa78][_0x5a26('0x13')][_0x5a26('0x14')]=_0x1be5ad;return this[_0x5a26('0xe')](_0x4faa78);}};EmailChannel[_0x5a26('0xd')][_0x5a26('0x2d')]=function(_0x459f68,_0x48dfab){return this[_0x5a26('0x2e')][_0x5a26('0x2f')](_0x459f68,_0x48dfab);};EmailChannel[_0x5a26('0xd')]['verifySmtp']=function(_0x15414b){var _0x18a076=this;if(this['mailAccounts'][_0x15414b['id']]){if(_['isNil'](this[_0x5a26('0xb')][_0x15414b['id']][_0x5a26('0x30')])){this['mailAccounts'][_0x15414b['id']][_0x5a26('0x30')]={};}this[_0x5a26('0xb')][_0x15414b['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x266b3b,_0x4010b0){return _0x18a076['smtp'][_0x5a26('0x31')](_0x15414b)['then'](function(_0x42ec11){_0x18a076[_0x5a26('0xb')][_0x15414b['id']][_0x5a26('0x30')]['status']=_0x5a26('0x32');_0x18a076[_0x5a26('0xb')][_0x15414b['id']][_0x5a26('0x30')][_0x5a26('0x14')]='';_0x18a076[_0x5a26('0xe')](_0x15414b['id']);_0x266b3b(_0x42ec11);})[_0x5a26('0x29')](function(_0x1f0cc6){_0x18a076[_0x5a26('0xb')][_0x15414b['id']][_0x5a26('0x30')][_0x5a26('0x12')]='error';_0x18a076[_0x5a26('0xb')][_0x15414b['id']][_0x5a26('0x30')][_0x5a26('0x14')]=_0x1f0cc6;_0x18a076[_0x5a26('0xe')](_0x15414b['id']);_0x4010b0(_0x1f0cc6);});});}return this[_0x5a26('0x2e')][_0x5a26('0x31')](_0x15414b);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 64e8681..edce6ec 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 _0x2a2c=['end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','service','user','password','host','port','tls','autotls','getHost','anonymous@xcally.com','handleReady','openBox','mailbox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleSimpleParser','parser','stringify','upperFirst','exports','path','util','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','account','getAccount','imap','once','ready','bind'];(function(_0x53f2ad,_0x11933d){var _0x478af7=function(_0x7c892d){while(--_0x7c892d){_0x53f2ad['push'](_0x53f2ad['shift']());}};_0x478af7(++_0x11933d);}(_0x2a2c,0x197));var _0xc2a2=function(_0x550b98,_0x5552ba){_0x550b98=_0x550b98-0x0;var _0xe38aca=_0x2a2c[_0x550b98];return _0xe38aca;};'use strict';var fs=require('fs');var path=require(_0xc2a2('0x0'));var util=require(_0xc2a2('0x1'));var Imap=require('imap');var _=require(_0xc2a2('0x2'));var rs=require(_0xc2a2('0x3'));var simpleParser=require(_0xc2a2('0x4'))[_0xc2a2('0x5')];var Iconv=require(_0xc2a2('0x6'))[_0xc2a2('0x7')];var EventEmitter=require(_0xc2a2('0x8'))[_0xc2a2('0x9')];var utils=require(_0xc2a2('0xa'));var logger=require(_0xc2a2('0xb'))(_0xc2a2('0xc'));function EmailImap(_0x455752,_0x511f29){this['mailbox']=_0xc2a2('0xd');this[_0xc2a2('0xe')]=this[_0xc2a2('0xf')](_0x455752,_0x511f29);this[_0xc2a2('0x10')]=new Imap(this[_0xc2a2('0xe')]);this[_0xc2a2('0x10')][_0xc2a2('0x11')](_0xc2a2('0x12'),this['handleReady'][_0xc2a2('0x13')](this));this['imap'][_0xc2a2('0x11')](_0xc2a2('0x14'),this[_0xc2a2('0x15')]['bind'](this));this[_0xc2a2('0x10')]['on'](_0xc2a2('0x16'),this[_0xc2a2('0x17')]['bind'](this));this['imap'][_0xc2a2('0x18')]();}util[_0xc2a2('0x19')](EmailImap,EventEmitter);EmailImap[_0xc2a2('0x1a')][_0xc2a2('0xf')]=function(_0x2d59f0,_0xba9419){var _0x513ee5={'connTimeout':_0x2d59f0[_0xc2a2('0x1b')]?_0x2d59f0[_0xc2a2('0x1b')]*0x3e8:0x2710,'authTimeout':_0x2d59f0['authTimeout']?_0x2d59f0['authTimeout']*0x3e8:0x1388};if(_['isNil'](_0x2d59f0[_0xc2a2('0x1c')])){if(_0x2d59f0['authentication']){_0x513ee5[_0xc2a2('0x1d')]=_0x2d59f0['user'];_0x513ee5[_0xc2a2('0x1e')]=_0x2d59f0['password'];}_0x513ee5['host']=_0x2d59f0[_0xc2a2('0x1f')];_0x513ee5[_0xc2a2('0x20')]=_0x2d59f0[_0xc2a2('0x20')]||0x3e1;if(_0x2d59f0[_0xc2a2('0x21')]){_0x513ee5[_0xc2a2('0x21')]=!![];}else{_0x513ee5['tls']=![];_0x513ee5[_0xc2a2('0x22')]='required';}}else{_0x513ee5[_0xc2a2('0x1d')]=_0x2d59f0['user'];_0x513ee5[_0xc2a2('0x1e')]=_0x2d59f0[_0xc2a2('0x1e')];_0x513ee5[_0xc2a2('0x1f')]=utils[_0xc2a2('0x23')](_0x2d59f0[_0xc2a2('0x1c')]);_0x513ee5[_0xc2a2('0x20')]=0x3e1;_0x513ee5[_0xc2a2('0x21')]=!![];}_0x513ee5['email']=_0xba9419||_0x2d59f0[_0xc2a2('0x1d')]||_0xc2a2('0x24');return _0x513ee5;};EmailImap[_0xc2a2('0x1a')][_0xc2a2('0x25')]=function(){this[_0xc2a2('0x10')][_0xc2a2('0x26')](this[_0xc2a2('0x27')],![],this[_0xc2a2('0x28')][_0xc2a2('0x13')](this));};EmailImap['prototype'][_0xc2a2('0x28')]=function(_0x210bc7,_0x23b950){if(_0x210bc7){this[_0xc2a2('0x17')](_0x210bc7,!![]);}else{this[_0xc2a2('0x29')](_0xc2a2('0x2a'),_0x23b950);this[_0xc2a2('0x2b')]();}};EmailImap[_0xc2a2('0x1a')][_0xc2a2('0x2c')]=function(_0x17db61){if(_0x17db61){this[_0xc2a2('0x17')](_0x17db61,!![]);}else{this[_0xc2a2('0x10')][_0xc2a2('0x14')]();}};EmailImap[_0xc2a2('0x1a')][_0xc2a2('0x2b')]=function(){this[_0xc2a2('0x10')][_0xc2a2('0x2d')](['UNSEEN'],this[_0xc2a2('0x2e')][_0xc2a2('0x13')](this));};EmailImap[_0xc2a2('0x1a')][_0xc2a2('0x2e')]=function(_0x871b91,_0x495b1c){if(_0x871b91){this[_0xc2a2('0x17')](_0x871b91,!![]);}else{if(_0x495b1c['length']){try{var _0x7ef31d=this['imap'][_0xc2a2('0x2f')](_0x495b1c,{'bodies':'','markSeen':!![]});_0x7ef31d['on'](_0xc2a2('0x30'),this[_0xc2a2('0x31')][_0xc2a2('0x13')](this));_0x7ef31d[_0xc2a2('0x11')](_0xc2a2('0x16'),this[_0xc2a2('0x32')]['bind'](this));_0x7ef31d[_0xc2a2('0x11')](_0xc2a2('0x14'),this[_0xc2a2('0x33')][_0xc2a2('0x13')](this));}catch(_0x10d087){logger[_0xc2a2('0x16')](_0x10d087);}}else{this[_0xc2a2('0x10')][_0xc2a2('0x34')](!![],this[_0xc2a2('0x2c')][_0xc2a2('0x13')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x472433,_0x109096){_0x472433['on'](_0xc2a2('0x35'),this[_0xc2a2('0x36')][_0xc2a2('0x13')](this));_0x472433[_0xc2a2('0x11')]('attributes',this[_0xc2a2('0x37')][_0xc2a2('0x13')](this));_0x472433[_0xc2a2('0x11')](_0xc2a2('0x14'),this['handleMessageEnd'][_0xc2a2('0x13')](this));};EmailImap['prototype'][_0xc2a2('0x36')]=function(_0x23805a,_0x44d3ab){simpleParser(_0x23805a,{'Iconv':Iconv},this[_0xc2a2('0x38')]['bind'](this));};EmailImap['prototype'][_0xc2a2('0x37')]=function(_0x25d327){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap['prototype'][_0xc2a2('0x38')]=function(_0x468374,_0x5554b3){if(_0x468374){logger[_0xc2a2('0x16')](_0x468374);}else{var _0x25ca2c=this;utils[_0xc2a2('0x39')](this[_0xc2a2('0xe')],_0x5554b3,function(_0x305519){_0x25ca2c['emit'](_0xc2a2('0xc'),_0x305519);});}};EmailImap[_0xc2a2('0x1a')]['handleFetchEnd']=function(){this[_0xc2a2('0x10')]['closeBox'](!![],this['handleCloseBox'][_0xc2a2('0x13')](this));};EmailImap[_0xc2a2('0x1a')]['handleFetchError']=function(_0x1ae75c){this[_0xc2a2('0x17')](_0x1ae75c);this[_0xc2a2('0x10')][_0xc2a2('0x34')](!![],this['handleCloseBox'][_0xc2a2('0x13')](this));};EmailImap[_0xc2a2('0x1a')]['handleEnd']=function(){this[_0xc2a2('0x29')](_0xc2a2('0x14'));};EmailImap[_0xc2a2('0x1a')][_0xc2a2('0x17')]=function(_0x23e2e5,_0x2241b9){logger[_0xc2a2('0x16')]('handleError',this['account'][_0xc2a2('0xc')],JSON[_0xc2a2('0x3a')](_0x23e2e5));var _0x4088ac='';if(_0x23e2e5){if(_0x23e2e5['textCode']){_0x4088ac=_0x23e2e5['textCode'];}else{for(var _0x571033 in _0x23e2e5){if(_0x23e2e5['hasOwnProperty'](_0x571033)){_0x4088ac+=_[_0xc2a2('0x3b')](_0x571033)+':\x20'+_0x23e2e5[_0x571033]+'\x0a';}}}}if(_0x2241b9){this[_0xc2a2('0x10')][_0xc2a2('0x14')]();}else{this[_0xc2a2('0x29')](_0xc2a2('0x16'),_0x4088ac);this[_0xc2a2('0x29')](_0xc2a2('0x14'));}};module[_0xc2a2('0x3c')]=EmailImap; \ No newline at end of file +var _0x1a60=['end','prototype','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','stringify','textCode','upperFirst','exports','path','util','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','account','getAccount','once','ready','bind','handleEnd','error','handleError','connTimeout','authTimeout','authentication','user','password','host','port','tls','autotls','required','getHost','service','anonymous@xcally.com','handleReady','handleOpenBox','emit','box','readUnseen','handleCloseBox'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1a60,0x196));var _0x01a6=function(_0x26c763,_0x412182){_0x26c763=_0x26c763-0x0;var _0x1f832a=_0x1a60[_0x26c763];return _0x1f832a;};'use strict';var fs=require('fs');var path=require(_0x01a6('0x0'));var util=require(_0x01a6('0x1'));var Imap=require(_0x01a6('0x2'));var _=require(_0x01a6('0x3'));var rs=require(_0x01a6('0x4'));var simpleParser=require(_0x01a6('0x5'))[_0x01a6('0x6')];var Iconv=require(_0x01a6('0x7'))[_0x01a6('0x8')];var EventEmitter=require(_0x01a6('0x9'))[_0x01a6('0xa')];var utils=require(_0x01a6('0xb'));var logger=require('../../../config/logger')(_0x01a6('0xc'));function EmailImap(_0xb555da,_0x51ab67){this[_0x01a6('0xd')]=_0x01a6('0xe');this[_0x01a6('0xf')]=this[_0x01a6('0x10')](_0xb555da,_0x51ab67);this[_0x01a6('0x2')]=new Imap(this[_0x01a6('0xf')]);this[_0x01a6('0x2')][_0x01a6('0x11')](_0x01a6('0x12'),this['handleReady'][_0x01a6('0x13')](this));this['imap'][_0x01a6('0x11')]('end',this[_0x01a6('0x14')][_0x01a6('0x13')](this));this['imap']['on'](_0x01a6('0x15'),this[_0x01a6('0x16')]['bind'](this));this[_0x01a6('0x2')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x01a6('0x10')]=function(_0x2edf8a,_0x52f36e){var _0x24b15c={'connTimeout':_0x2edf8a[_0x01a6('0x17')]?_0x2edf8a[_0x01a6('0x17')]*0x3e8:0x2710,'authTimeout':_0x2edf8a[_0x01a6('0x18')]?_0x2edf8a[_0x01a6('0x18')]*0x3e8:0x1388};if(_['isNil'](_0x2edf8a['service'])){if(_0x2edf8a[_0x01a6('0x19')]){_0x24b15c[_0x01a6('0x1a')]=_0x2edf8a['user'];_0x24b15c['password']=_0x2edf8a[_0x01a6('0x1b')];}_0x24b15c[_0x01a6('0x1c')]=_0x2edf8a[_0x01a6('0x1c')];_0x24b15c[_0x01a6('0x1d')]=_0x2edf8a[_0x01a6('0x1d')]||0x3e1;if(_0x2edf8a[_0x01a6('0x1e')]){_0x24b15c['tls']=!![];}else{_0x24b15c['tls']=![];_0x24b15c[_0x01a6('0x1f')]=_0x01a6('0x20');}}else{_0x24b15c[_0x01a6('0x1a')]=_0x2edf8a['user'];_0x24b15c[_0x01a6('0x1b')]=_0x2edf8a[_0x01a6('0x1b')];_0x24b15c[_0x01a6('0x1c')]=utils[_0x01a6('0x21')](_0x2edf8a[_0x01a6('0x22')]);_0x24b15c[_0x01a6('0x1d')]=0x3e1;_0x24b15c[_0x01a6('0x1e')]=!![];}_0x24b15c['email']=_0x52f36e||_0x2edf8a['user']||_0x01a6('0x23');return _0x24b15c;};EmailImap['prototype'][_0x01a6('0x24')]=function(){this['imap']['openBox'](this[_0x01a6('0xd')],![],this['handleOpenBox']['bind'](this));};EmailImap['prototype'][_0x01a6('0x25')]=function(_0x1637ad,_0x4ca132){if(_0x1637ad){this[_0x01a6('0x16')](_0x1637ad,!![]);}else{this[_0x01a6('0x26')](_0x01a6('0x27'),_0x4ca132);this[_0x01a6('0x28')]();}};EmailImap['prototype'][_0x01a6('0x29')]=function(_0x56ccb8){if(_0x56ccb8){this[_0x01a6('0x16')](_0x56ccb8,!![]);}else{this[_0x01a6('0x2')][_0x01a6('0x2a')]();}};EmailImap[_0x01a6('0x2b')][_0x01a6('0x28')]=function(){this[_0x01a6('0x2')]['search']([_0x01a6('0x2c')],this[_0x01a6('0x2d')]['bind'](this));};EmailImap[_0x01a6('0x2b')][_0x01a6('0x2d')]=function(_0x51bab4,_0x3d9bd6){if(_0x51bab4){this[_0x01a6('0x16')](_0x51bab4,!![]);}else{if(_0x3d9bd6[_0x01a6('0x2e')]){try{var _0x65254b=this[_0x01a6('0x2')][_0x01a6('0x2f')](_0x3d9bd6,{'bodies':'','markSeen':!![]});_0x65254b['on'](_0x01a6('0x30'),this[_0x01a6('0x31')][_0x01a6('0x13')](this));_0x65254b[_0x01a6('0x11')](_0x01a6('0x15'),this[_0x01a6('0x32')][_0x01a6('0x13')](this));_0x65254b[_0x01a6('0x11')](_0x01a6('0x2a'),this['handleFetchEnd']['bind'](this));}catch(_0x40da83){logger['error'](_0x40da83);}}else{this[_0x01a6('0x2')][_0x01a6('0x33')](!![],this[_0x01a6('0x29')][_0x01a6('0x13')](this));}}};EmailImap[_0x01a6('0x2b')][_0x01a6('0x31')]=function(_0x518877,_0x40c8d9){_0x518877['on'](_0x01a6('0x34'),this[_0x01a6('0x35')]['bind'](this));_0x518877[_0x01a6('0x11')](_0x01a6('0x36'),this[_0x01a6('0x37')]['bind'](this));_0x518877['once'](_0x01a6('0x2a'),this[_0x01a6('0x38')]['bind'](this));};EmailImap[_0x01a6('0x2b')]['handleMessageBody']=function(_0x5a6f47,_0xc0ee80){simpleParser(_0x5a6f47,{'Iconv':Iconv},this[_0x01a6('0x39')][_0x01a6('0x13')](this));};EmailImap[_0x01a6('0x2b')]['handleMessageAttributes']=function(_0x5d9d2a){};EmailImap[_0x01a6('0x2b')][_0x01a6('0x38')]=function(){};EmailImap[_0x01a6('0x2b')][_0x01a6('0x39')]=function(_0x3740b0,_0x352969){if(_0x3740b0){logger[_0x01a6('0x15')](_0x3740b0);}else{var _0x2c31d8=this;utils[_0x01a6('0x3a')](this[_0x01a6('0xf')],_0x352969,function(_0x4daa1c){_0x2c31d8[_0x01a6('0x26')]('email',_0x4daa1c);});}};EmailImap['prototype'][_0x01a6('0x3b')]=function(){this[_0x01a6('0x2')]['closeBox'](!![],this['handleCloseBox'][_0x01a6('0x13')](this));};EmailImap[_0x01a6('0x2b')]['handleFetchError']=function(_0x1a137f){this[_0x01a6('0x16')](_0x1a137f);this[_0x01a6('0x2')][_0x01a6('0x33')](!![],this[_0x01a6('0x29')][_0x01a6('0x13')](this));};EmailImap[_0x01a6('0x2b')]['handleEnd']=function(){this['emit'](_0x01a6('0x2a'));};EmailImap[_0x01a6('0x2b')][_0x01a6('0x16')]=function(_0x14a53d,_0x34115d){logger[_0x01a6('0x15')](_0x01a6('0x16'),this['account']['email'],JSON[_0x01a6('0x3c')](_0x14a53d));var _0x4921c3='';if(_0x14a53d){if(_0x14a53d['textCode']){_0x4921c3=_0x14a53d[_0x01a6('0x3d')];}else{for(var _0x406d69 in _0x14a53d){if(_0x14a53d['hasOwnProperty'](_0x406d69)){_0x4921c3+=_[_0x01a6('0x3e')](_0x406d69)+':\x20'+_0x14a53d[_0x406d69]+'\x0a';}}}}if(_0x34115d){this['imap'][_0x01a6('0x2a')]();}else{this[_0x01a6('0x26')](_0x01a6('0x15'),_0x4921c3);this[_0x01a6('0x26')](_0x01a6('0x2a'));}};module[_0x01a6('0x3f')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index bab438e..bd427ed 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 _0x2527=['bluebird','prototype','send','createTransport','sendMail','toString','verify','Not\x20verifired','exports','nodemailer'];(function(_0x5a757,_0x1ccdb3){var _0x31f605=function(_0x123b85){while(--_0x123b85){_0x5a757['push'](_0x5a757['shift']());}};_0x31f605(++_0x1ccdb3);}(_0x2527,0x117));var _0x7252=function(_0x3cdb3b,_0x4d80a6){_0x3cdb3b=_0x3cdb3b-0x0;var _0x5408c9=_0x2527[_0x3cdb3b];return _0x5408c9;};'use strict';var nodemailer=require(_0x7252('0x0'));var BPromise=require(_0x7252('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x7252('0x2')][_0x7252('0x3')]=function(_0x201cf1,_0x31057d){return new BPromise(function(_0x5a7d3b,_0x40b2cc){var _0x2a118a=nodemailer[_0x7252('0x4')](_0x201cf1);_0x2a118a['use']('compile',inlineBase64());_0x2a118a[_0x7252('0x5')](_0x31057d,function(_0x5f55ee,_0x3fc54e){if(_0x5f55ee){_0x40b2cc(_0x5f55ee[_0x7252('0x6')]());}else{_0x5a7d3b(_0x3fc54e);}});});};EmailSmtp[_0x7252('0x2')][_0x7252('0x7')]=function(_0x589538){return new BPromise(function(_0x249fc2,_0x2ca785){var _0x148c26=nodemailer[_0x7252('0x4')](_0x589538);_0x148c26[_0x7252('0x7')](function(_0x46a2ac,_0x4a93a6){if(_0x46a2ac){_0x2ca785(_0x46a2ac[_0x7252('0x6')]());}else{if(_0x4a93a6){_0x249fc2(_0x4a93a6);}else{_0x2ca785(_0x7252('0x8'));}}});});};module[_0x7252('0x9')]=EmailSmtp; \ No newline at end of file +var _0x9b82=['createTransport','use','sendMail','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x5e9274,_0x39ab73){var _0x3772ba=function(_0x3a250b){while(--_0x3a250b){_0x5e9274['push'](_0x5e9274['shift']());}};_0x3772ba(++_0x39ab73);}(_0x9b82,0xdd));var _0x29b8=function(_0x49f96a,_0x12c940){_0x49f96a=_0x49f96a-0x0;var _0x410067=_0x9b82[_0x49f96a];return _0x410067;};'use strict';var nodemailer=require(_0x29b8('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x29b8('0x1'));function EmailSmtp(){}EmailSmtp[_0x29b8('0x2')]['send']=function(_0xf34419,_0x6214bb){return new BPromise(function(_0x2e4b55,_0x262a1b){var _0x508ce6=nodemailer[_0x29b8('0x3')](_0xf34419);_0x508ce6[_0x29b8('0x4')]('compile',inlineBase64());_0x508ce6[_0x29b8('0x5')](_0x6214bb,function(_0x4a80f4,_0x40395b){if(_0x4a80f4){_0x262a1b(_0x4a80f4['toString']());}else{_0x2e4b55(_0x40395b);}});});};EmailSmtp[_0x29b8('0x2')]['verify']=function(_0x535b4c){return new BPromise(function(_0x54e94a,_0x16c721){var _0x3a10ec=nodemailer[_0x29b8('0x3')](_0x535b4c);_0x3a10ec['verify'](function(_0x379847,_0x157bb4){if(_0x379847){_0x16c721(_0x379847['toString']());}else{if(_0x157bb4){_0x54e94a(_0x157bb4);}else{_0x16c721(_0x29b8('0x6'));}}});});};module[_0x29b8('0x7')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 9aa8b13..4c8509a 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 _0x84db=['bcc','type','attachment','format','%s-%s','now','writeFileSync','content','contentType','parser','from','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','

Empty\x20message

','Attachments','Title','Data','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','path','util','node-tnef','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','slice','join','Anonymous','split','length','isEmpty','html','test','replace','includes','attachments','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x3d7d7c['pop']():'';}return'';}function getMails(_0x28c469,_0x5ee0be){var _0x1c873d='';for(var _0x2b00ec=0x0;_0x2b00ec<_0x5ee0be[_0xb84d('0x7')][_0xb84d('0x11')];_0x2b00ec+=0x1){if(_0x5ee0be[_0xb84d('0x7')][_0x2b00ec][_0xb84d('0x8')]!==_0x28c469){if(!_[_0xb84d('0x12')](_0x1c873d)){_0x1c873d+=',';}_0x1c873d+=_0x5ee0be['value'][_0x2b00ec]['name']||_0x5ee0be[_0xb84d('0x7')][_0x2b00ec]['address']||'';_0x1c873d+='\x20<';_0x1c873d+=_0x5ee0be[_0xb84d('0x7')][_0x2b00ec]['address']?_0x5ee0be[_0xb84d('0x7')][_0x2b00ec]['address']:_0xb84d('0x9')+random[_0xb84d('0xa')](0x6)+'@xcally.com';_0x1c873d+='>';}}return _0x1c873d;}function parseEmail(_0x887a2d,_0x1b89cd,_0x2be643){if(_0x1b89cd[_0xb84d('0x13')]){var _0x3ae412=/)<[^<]*)*<\/script>/gi;while(_0x3ae412[_0xb84d('0x14')](_0x1b89cd['html'])){_0x1b89cd[_0xb84d('0x13')]=_0x1b89cd['html'][_0xb84d('0x15')](_0x3ae412,'');}if(_0x1b89cd['html'][_0xb84d('0x16')]('{_0x200aad[_0xb84d('0x19')](_0x211da0[_0xb84d('0x1a')]);});var _0x4b2214=/]+>/g;var _0x402a6e=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x116410=_0x1b89cd[_0xb84d('0x13')]['replace'](_0x402a6e,_0xb84d('0x1b'));var _0x3c7f2d=_0x116410[_0xb84d('0x15')](_0x4b2214,_0xb84d('0x1c'));for(let _0x5016ee=0x0;_0x5016ee<_0x200aad['length'];_0x5016ee++){var _0x1f61d4=_0x3c7f2d[_0xb84d('0x15')](_0xb84d('0x1c'),_0xb84d('0x1d')+_0x200aad[_0x5016ee]+_0xb84d('0x1e'));_0x3c7f2d=_0x1f61d4;}_0x1b89cd[_0xb84d('0x13')]=_0x3c7f2d;}_0x2be643['body']=_0x1b89cd[_0xb84d('0x13')];}else{_0x2be643[_0xb84d('0x1f')]=_0x1b89cd[_0xb84d('0x20')];}if(_0x2be643[_0xb84d('0x1f')]){_0x2be643[_0xb84d('0x1f')]=_0x2be643[_0xb84d('0x1f')][_0xb84d('0x15')](/\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originCc','includes','originTo','bcc','attachments','attach','attachment','attachment-','format','now','root','server/files/attachments/','writeFileSync','contentType','parser','from','subject','messageId','inReplyTo','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','content','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','generate','name','split','slice','join','Anonymous','length','pop','isEmpty','anonymous'];(function(_0x8dd4a7,_0x138f55){var _0x2fec84=function(_0x4d0f1c){while(--_0x4d0f1c){_0x8dd4a7['push'](_0x8dd4a7['shift']());}};_0x2fec84(++_0x138f55);}(_0x4aea,0xc3));var _0xa4ae=function(_0x1fc89a,_0x4a1ae7){_0x1fc89a=_0x1fc89a-0x0;var _0x4b08d3=_0x4aea[_0x1fc89a];return _0x4b08d3;};'use strict';var _=require(_0xa4ae('0x0'));var moment=require(_0xa4ae('0x1'));var random=require(_0xa4ae('0x2'));var fs=require('fs');var path=require('path');var util=require(_0xa4ae('0x3'));var tnef=require(_0xa4ae('0x4'));var logger=require(_0xa4ae('0x5'))(_0xa4ae('0x6'));var config=require(_0xa4ae('0x7'));function getAddress(_0x3da0e5){var _0x23e26a=_[_0xa4ae('0x8')](_0x3da0e5[_0xa4ae('0x9')]);return _0x23e26a&&_0x23e26a[_0xa4ae('0xa')]?_0x23e26a[_0xa4ae('0xa')]:'anonymous'+random[_0xa4ae('0xb')](0x6)+'@xcally.com';}function getFirstName(_0x118941){var _0x4979ce=_[_0xa4ae('0x8')](_0x118941['value']);if(_0x4979ce&&_0x4979ce['name']){var _0x287ecf=_0x4979ce[_0xa4ae('0xc')][_0xa4ae('0xd')](/\s+/);return _0x287ecf['length']?_0x287ecf[_0xa4ae('0xe')](0x0,-0x1)[_0xa4ae('0xf')]('\x20'):_0x4979ce[_0xa4ae('0xc')];}return _0xa4ae('0x10');}function getLastName(_0x882fa4){var _0x40c016=_[_0xa4ae('0x8')](_0x882fa4[_0xa4ae('0x9')]);if(_0x40c016&&_0x40c016[_0xa4ae('0xc')]){var _0x33c0e2=_0x40c016['name'][_0xa4ae('0xd')](/\s+/);return _0x33c0e2[_0xa4ae('0x11')]>0x1?_0x33c0e2[_0xa4ae('0x12')]():'';}return'';}function getMails(_0x4b920e,_0x13e79d){var _0xe5eb6f='';for(var _0x3d8b99=0x0;_0x3d8b99<_0x13e79d['value']['length'];_0x3d8b99+=0x1){if(_0x13e79d[_0xa4ae('0x9')][_0x3d8b99][_0xa4ae('0xa')]!==_0x4b920e){if(!_[_0xa4ae('0x13')](_0xe5eb6f)){_0xe5eb6f+=',';}_0xe5eb6f+=_0x13e79d['value'][_0x3d8b99][_0xa4ae('0xc')]||_0x13e79d[_0xa4ae('0x9')][_0x3d8b99][_0xa4ae('0xa')]||'';_0xe5eb6f+='\x20<';_0xe5eb6f+=_0x13e79d[_0xa4ae('0x9')][_0x3d8b99][_0xa4ae('0xa')]?_0x13e79d[_0xa4ae('0x9')][_0x3d8b99][_0xa4ae('0xa')]:_0xa4ae('0x14')+random[_0xa4ae('0xb')](0x6)+_0xa4ae('0x15');_0xe5eb6f+='>';}}return _0xe5eb6f;}function parseEmail(_0x5a0a38,_0x1dc467,_0x148a81){if(_0x1dc467[_0xa4ae('0x16')]){var _0x190713=/)<[^<]*)*<\/script>/gi;while(_0x190713['test'](_0x1dc467[_0xa4ae('0x16')])){_0x1dc467['html']=_0x1dc467[_0xa4ae('0x16')]['replace'](_0x190713,'');}if(_0x1dc467['html']['includes'](_0xa4ae('0x17'))){var _0x7c4a42=[];_0x1dc467['attachments'][_0xa4ae('0x18')](_0x311fc=>{_0x7c4a42[_0xa4ae('0x19')](_0x311fc[_0xa4ae('0x1a')]);});var _0x59c53e=/]+>/g;var _0x13a6c2=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x13a7d4=_0x1dc467[_0xa4ae('0x16')]['replace'](_0x13a6c2,_0xa4ae('0x1b'));var _0x2f5619=_0x13a7d4[_0xa4ae('0x1c')](_0x59c53e,'_IMG');for(let _0x19abd7=0x0;_0x19abd7<_0x7c4a42[_0xa4ae('0x11')];_0x19abd7++){var _0xf79eb5=_0x2f5619[_0xa4ae('0x1c')]('_IMG',_0xa4ae('0x1d')+_0x7c4a42[_0x19abd7]+_0xa4ae('0x1e'));_0x2f5619=_0xf79eb5;}_0x1dc467[_0xa4ae('0x16')]=_0x2f5619;}_0x148a81[_0xa4ae('0x1f')]=_0x1dc467[_0xa4ae('0x16')];}else{_0x148a81[_0xa4ae('0x1f')]=_0x1dc467[_0xa4ae('0x20')];}if(_0x148a81['body']){_0x148a81[_0xa4ae('0x1f')]=_0x148a81[_0xa4ae('0x1f')][_0xa4ae('0x1c')](/0x0){if(this[_0x50e594+_0x2524('0x2b')]>0x0&&this[_0x50e594+_0x2524('0x2a')]>=this[_0x50e594+_0x2524('0x2b')]){return'maxcapacity';}else{return'working';}}else{return _0x2524('0x2c');}};Agent[_0x2524('0x29')]['updateRealtime']=function(){var _0x553fd9=[_0x2524('0x2d'),_0x2524('0x2e'),_0x2524('0x2f'),'fax','sms',_0x2524('0x30')];for(var _0x37d6ab=0x0;_0x37d6ab<_0x553fd9['length'];_0x37d6ab+=0x1){var _0x3bce2c=this[_0x2524('0x31')](_0x553fd9[_0x37d6ab]);if(this[_0x553fd9[_0x37d6ab]+'Status']!==_0x3bce2c){this[_0x553fd9[_0x37d6ab]+_0x2524('0x32')]=_[_0x2524('0x33')](moment()[_0x2524('0x34')]('x'));}this[_0x553fd9[_0x37d6ab]+_0x2524('0x35')]=_0x3bce2c;}var _0x45d058={'id':this['id'],'name':this[_0x2524('0x9')],'online':this[_0x2524('0xa')],'voicePause':this[_0x2524('0xb')],'chatPause':this[_0x2524('0x36')],'mailPause':this[_0x2524('0xc')],'smsPause':this[_0x2524('0xe')],'faxPause':this[_0x2524('0xd')],'openchannelPause':this[_0x2524('0xf')],'chatStatus':this[_0x2524('0x10')],'chatStatusTime':this[_0x2524('0x12')],'chatCapacity':this[_0x2524('0x37')],'chatCurrentCapacity':this[_0x2524('0x13')],'mailStatus':this[_0x2524('0x14')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x2524('0x16')],'mailCurrentCapacity':this[_0x2524('0x17')],'faxStatus':this[_0x2524('0x18')],'faxStatusTime':this[_0x2524('0x19')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x2524('0x1b')],'smsStatus':this[_0x2524('0x1c')],'smsStatusTime':this[_0x2524('0x1d')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x2524('0x38')],'whatsappStatusTime':this[_0x2524('0x20')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x2524('0x22')],'openchannelStatus':this[_0x2524('0x23')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x2524('0x26')],'busy':this[_0x2524('0x39')],'busyQueue':this[_0x2524('0x27')]};var _0x229849=md5(JSON['stringify'](_0x45d058));if(this[_0x2524('0x2')]!==_0x229849){this[_0x2524('0x2')]=_0x229849;io[_0x2524('0x3a')](_0x2524('0x3b'),_0x45d058);}};module[_0x2524('0x3c')]=Agent; \ No newline at end of file +var _0x14a0=['idle','mail','chat','openchannel','fax','whatsapp','length','StatusTime','toNumber','format','chatPause','faxPause','faxStatusTime','faxCurrentCapacity','smsStatusTime','openchannelCurrentCapacity','stringify','emit','user:save','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','name','online','voicePause','mailPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working'];(function(_0x220ceb,_0x42ae42){var _0x68c45b=function(_0x10454a){while(--_0x10454a){_0x220ceb['push'](_0x220ceb['shift']());}};_0x68c45b(++_0x42ae42);}(_0x14a0,0x8e));var _0x014a=function(_0x5aa2f4,_0x578abf){_0x5aa2f4=_0x5aa2f4-0x0;var _0x24f034=_0x14a0[_0x5aa2f4];return _0x24f034;};'use strict';var _=require('lodash');var moment=require(_0x014a('0x0'));var md5=require(_0x014a('0x1'));var Redis=require(_0x014a('0x2'));var config=require(_0x014a('0x3'));config[_0x014a('0x4')]=_[_0x014a('0x5')](config[_0x014a('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x014a('0x4')]));function Agent(_0x12e8da){this['id']=_0x12e8da['id']||0x0;this[_0x014a('0x6')]=_0x12e8da['name']||'';this['online']=_0x12e8da[_0x014a('0x7')]||!![];this[_0x014a('0x8')]=_0x12e8da[_0x014a('0x8')]||![];this['chatPause']=_0x12e8da['chatPause']||![];this[_0x014a('0x9')]=_0x12e8da['mailPause']||![];this['faxPause']=_0x12e8da['faxPause']||![];this['smsPause']=_0x12e8da[_0x014a('0xa')]||![];this['openchannelPause']=_0x12e8da[_0x014a('0xb')]||![];this[_0x014a('0xc')]='unknown';this[_0x014a('0xd')]=0x0;this[_0x014a('0xe')]=_0x12e8da[_0x014a('0xe')]||0x0;this[_0x014a('0xf')]=0x0;this[_0x014a('0x10')]=_0x014a('0x11');this[_0x014a('0x12')]=0x0;this[_0x014a('0x13')]=_0x12e8da[_0x014a('0x13')]||0x0;this[_0x014a('0x14')]=0x0;this[_0x014a('0x15')]=_0x014a('0x11');this['faxStatusTime']=0x0;this[_0x014a('0x16')]=_0x12e8da[_0x014a('0x16')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x014a('0x17')]=_0x014a('0x11');this['smsStatusTime']=0x0;this[_0x014a('0x18')]=_0x12e8da[_0x014a('0x18')]||0x0;this[_0x014a('0x19')]=0x0;this[_0x014a('0x1a')]=_0x014a('0x11');this[_0x014a('0x1b')]=0x0;this[_0x014a('0x1c')]=_0x12e8da[_0x014a('0x1c')]||0x0;this[_0x014a('0x1d')]=0x0;this[_0x014a('0x1e')]=_0x014a('0x11');this[_0x014a('0x1f')]=0x0;this[_0x014a('0x20')]=_0x12e8da[_0x014a('0x20')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x014a('0x21')]=![];this[_0x014a('0x22')]=undefined;this[_0x014a('0x1')]='';this[_0x014a('0x23')]();}Agent[_0x014a('0x24')][_0x014a('0x25')]=function(_0x37c3d1){if(this[_0x37c3d1+_0x014a('0x26')]>0x0){if(this[_0x37c3d1+_0x014a('0x27')]>0x0&&this[_0x37c3d1+'CurrentCapacity']>=this[_0x37c3d1+_0x014a('0x27')]){return'maxcapacity';}else{return _0x014a('0x28');}}else{return _0x014a('0x29');}};Agent[_0x014a('0x24')][_0x014a('0x23')]=function(){var _0x2b3c10=[_0x014a('0x2a'),_0x014a('0x2b'),_0x014a('0x2c'),_0x014a('0x2d'),'sms',_0x014a('0x2e')];for(var _0x5358e9=0x0;_0x5358e9<_0x2b3c10[_0x014a('0x2f')];_0x5358e9+=0x1){var _0x28701e=this['getChannelStatus'](_0x2b3c10[_0x5358e9]);if(this[_0x2b3c10[_0x5358e9]+'Status']!==_0x28701e){this[_0x2b3c10[_0x5358e9]+_0x014a('0x30')]=_[_0x014a('0x31')](moment()[_0x014a('0x32')]('x'));}this[_0x2b3c10[_0x5358e9]+'Status']=_0x28701e;}var _0x183f19={'id':this['id'],'name':this[_0x014a('0x6')],'online':this['online'],'voicePause':this[_0x014a('0x8')],'chatPause':this[_0x014a('0x33')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0x014a('0x34')],'openchannelPause':this[_0x014a('0xb')],'chatStatus':this[_0x014a('0xc')],'chatStatusTime':this[_0x014a('0xd')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x014a('0xf')],'mailStatus':this[_0x014a('0x10')],'mailStatusTime':this[_0x014a('0x12')],'mailCapacity':this[_0x014a('0x13')],'mailCurrentCapacity':this[_0x014a('0x14')],'faxStatus':this[_0x014a('0x15')],'faxStatusTime':this[_0x014a('0x35')],'faxCapacity':this[_0x014a('0x16')],'faxCurrentCapacity':this[_0x014a('0x36')],'smsStatus':this[_0x014a('0x17')],'smsStatusTime':this[_0x014a('0x37')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x014a('0x19')],'whatsappStatus':this[_0x014a('0x1a')],'whatsappStatusTime':this[_0x014a('0x1b')],'whatsappCapacity':this[_0x014a('0x1c')],'whatsappCurrentCapacity':this[_0x014a('0x1d')],'openchannelStatus':this[_0x014a('0x1e')],'openchannelStatusTime':this[_0x014a('0x1f')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x014a('0x38')],'busy':this[_0x014a('0x21')],'busyQueue':this['busyQueue']};var _0x415f83=md5(JSON[_0x014a('0x39')](_0x183f19));if(this[_0x014a('0x1')]!==_0x415f83){this[_0x014a('0x1')]=_0x415f83;io[_0x014a('0x3a')](_0x014a('0x3b'),_0x183f19);}};module[_0x014a('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index f04267d..04f3cd1 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 _0x96b6=['redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','format','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x3fd3a3,_0x36c863){var _0xa3e4d5=function(_0x1fd03b){while(--_0x1fd03b){_0x3fd3a3['push'](_0x3fd3a3['shift']());}};_0xa3e4d5(++_0x36c863);}(_0x96b6,0x127));var _0x696b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x96b6[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x696b('0x0'));var md5=require(_0x696b('0x1'));var util=require(_0x696b('0x2'));var Redis=require(_0x696b('0x3'));var config=require(_0x696b('0x4'));config[_0x696b('0x5')]=_[_0x696b('0x6')](config[_0x696b('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x696b('0x5')]));function ChatQueue(_0x14f712){this['id']=_0x14f712['id']||0x0;this[_0x696b('0x7')]=_0x14f712['name']||'';this[_0x696b('0x8')]=_0x14f712[_0x696b('0x8')]||0xa;this[_0x696b('0x9')]=_0x14f712[_0x696b('0x9')]||_0x696b('0xa');this[_0x696b('0xb')]=_0x14f712[_0x696b('0xb')];this[_0x696b('0xc')]={};this[_0x696b('0xd')]=0x0;this[_0x696b('0x1')]='';this['updateRouting']();this[_0x696b('0xe')]();}ChatQueue[_0x696b('0xf')][_0x696b('0x10')]=function(){var _0x44b5ff=this[_0x696b('0xc')][_0x696b('0x11')];this[_0x696b('0xc')]=_[_0x696b('0x12')](this[_0x696b('0xb')],'id');this['mapAgentsId'][_0x696b('0x11')]=_0x44b5ff;};ChatQueue['prototype'][_0x696b('0xe')]=function(){this[_0x696b('0x13')]=0x0;this[_0x696b('0x14')]=0x0;for(var _0x2bb51b=0x0;_0x2bb51b=0x0?this[_0x696b('0x18')]:0x0;var _0x435d03={'id':this['id'],'available':this['available'],'loggedIn':this[_0x696b('0x13')],'name':this[_0x696b('0x7')],'paused':this[_0x696b('0x14')],'waiting':this[_0x696b('0xd')]};var _0x4246c3=md5(JSON[_0x696b('0x19')](_0x435d03));if(this['md5']!==_0x4246c3){this['md5']=_0x4246c3;io['to'](util[_0x696b('0x1a')]('chat:queue:%s',_0x435d03[_0x696b('0x7')]))[_0x696b('0x1b')](_0x696b('0x1c'),_0x435d03);}};module[_0x696b('0x1d')]=ChatQueue; \ No newline at end of file +var _0x3666=['Agents','mapAgentsId','_rr','loggedIn','paused','chatPause','available','stringify','format','chat:queue:%s','chat_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','md5','updateRouting','updateRealtime','prototype','map'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3666,0xd7));var _0x6366=function(_0x14047b,_0x393d87){_0x14047b=_0x14047b-0x0;var _0x4298cc=_0x3666[_0x14047b];return _0x4298cc;};'use strict';var _=require(_0x6366('0x0'));var md5=require('md5');var util=require(_0x6366('0x1'));var Redis=require('ioredis');var config=require(_0x6366('0x2'));config[_0x6366('0x3')]=_[_0x6366('0x4')](config[_0x6366('0x3')],{'host':_0x6366('0x5'),'port':0x18eb});var io=require(_0x6366('0x6'))(new Redis(config[_0x6366('0x3')]));function ChatQueue(_0x50945e){this['id']=_0x50945e['id']||0x0;this[_0x6366('0x7')]=_0x50945e[_0x6366('0x7')]||'';this[_0x6366('0x8')]=_0x50945e[_0x6366('0x8')]||0xa;this[_0x6366('0x9')]=_0x50945e[_0x6366('0x9')]||_0x6366('0xa');this['Agents']=_0x50945e['Agents'];this['mapAgentsId']={};this[_0x6366('0xb')]=0x0;this[_0x6366('0xc')]='';this[_0x6366('0xd')]();this[_0x6366('0xe')]();}ChatQueue[_0x6366('0xf')]['updateRouting']=function(){var _0x30da1d=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x6366('0x10')](this[_0x6366('0x11')],'id');this[_0x6366('0x12')][_0x6366('0x13')]=_0x30da1d;};ChatQueue['prototype'][_0x6366('0xe')]=function(){this[_0x6366('0x14')]=0x0;this[_0x6366('0x15')]=0x0;for(var _0x56dc51=0x0;_0x56dc51=0x0?this[_0x6366('0x17')]:0x0;var _0x46ff54={'id':this['id'],'available':this[_0x6366('0x17')],'loggedIn':this[_0x6366('0x14')],'name':this[_0x6366('0x7')],'paused':this[_0x6366('0x15')],'waiting':this[_0x6366('0xb')]};var _0x89752=md5(JSON[_0x6366('0x18')](_0x46ff54));if(this[_0x6366('0xc')]!==_0x89752){this['md5']=_0x89752;io['to'](util[_0x6366('0x19')](_0x6366('0x1a'),_0x46ff54['name']))['emit'](_0x6366('0x1b'),_0x46ff54);}};module[_0x6366('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index e0f0f5e..de9109b 100644 --- a/server/services/routing/model/faxQueue.js +++ b/server/services/routing/model/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x36d163,_0x2e8cf4){var _0x5854a0=function(_0x229944){while(--_0x229944){_0x36d163['push'](_0x36d163['shift']());}};_0x5854a0(++_0x2e8cf4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x19897e,_0x3e961e){var _0x474883=function(_0x149a11){while(--_0x149a11){_0x19897e['push'](_0x19897e['shift']());}};_0x474883(++_0x3e961e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 1654804..b40bc3d 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 _0xd580=['name','Intervals','exports'];(function(_0x12b0d7,_0x596ecb){var _0x4d9c9e=function(_0x14fb4f){while(--_0x14fb4f){_0x12b0d7['push'](_0x12b0d7['shift']());}};_0x4d9c9e(++_0x596ecb);}(_0xd580,0x1c5));var _0x0d58=function(_0x56a64f,_0x338221){_0x56a64f=_0x56a64f-0x0;var _0x54f615=_0xd580[_0x56a64f];return _0x54f615;};'use strict';function Interval(_0xabefcd){this['id']=_0xabefcd['id']||0x0;this[_0x0d58('0x0')]=_0xabefcd['name']||'';this[_0x0d58('0x1')]=_0xabefcd[_0x0d58('0x1')]||{};}module[_0x0d58('0x2')]=Interval; \ No newline at end of file +var _0xfd89=['name','Intervals','exports'];(function(_0x2a0fc4,_0x2eaf74){var _0x531d00=function(_0xa4388f){while(--_0xa4388f){_0x2a0fc4['push'](_0x2a0fc4['shift']());}};_0x531d00(++_0x2eaf74);}(_0xfd89,0xb1));var _0x9fd8=function(_0x22f8b3,_0x11ff32){_0x22f8b3=_0x22f8b3-0x0;var _0x51ddff=_0xfd89[_0x22f8b3];return _0x51ddff;};'use strict';function Interval(_0x9dc01){this['id']=_0x9dc01['id']||0x0;this[_0x9fd8('0x0')]=_0x9dc01['name']||'';this[_0x9fd8('0x1')]=_0x9dc01[_0x9fd8('0x1')]||{};}module[_0x9fd8('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 c248f14..99bff8c 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 _0xde61=['available','stringify','format','mail:queue:%s','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','map','updateRealtime','loggedIn','paused','length','mailPause'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde61,0x1cf));var _0x1de6=function(_0x58a64c,_0x684602){_0x58a64c=_0x58a64c-0x0;var _0x1d419e=_0xde61[_0x58a64c];return _0x1d419e;};'use strict';var _=require(_0x1de6('0x0'));var md5=require(_0x1de6('0x1'));var util=require(_0x1de6('0x2'));var Redis=require(_0x1de6('0x3'));var config=require(_0x1de6('0x4'));config[_0x1de6('0x5')]=_[_0x1de6('0x6')](config[_0x1de6('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1de6('0x5')]));function MailQueue(_0x1b91ef){this['id']=_0x1b91ef['id']||0x0;this[_0x1de6('0x7')]=_0x1b91ef[_0x1de6('0x7')]||'';this[_0x1de6('0x8')]=_0x1b91ef[_0x1de6('0x8')]||0xa;this[_0x1de6('0x9')]=_0x1b91ef[_0x1de6('0x9')]||_0x1de6('0xa');this[_0x1de6('0xb')]=_0x1b91ef['Agents'];this[_0x1de6('0xc')]={};this[_0x1de6('0xd')]=0x0;this[_0x1de6('0x1')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x1de6('0xe')][_0x1de6('0xf')]=function(){var _0x3725aa=this[_0x1de6('0xc')][_0x1de6('0x10')];this[_0x1de6('0xc')]=_[_0x1de6('0x11')](this[_0x1de6('0xb')],'id');this['mapAgentsId'][_0x1de6('0x10')]=_0x3725aa;};MailQueue[_0x1de6('0xe')][_0x1de6('0x12')]=function(){this[_0x1de6('0x13')]=0x0;this[_0x1de6('0x14')]=0x0;for(var _0xba7af3=0x0;_0xba7af3=0x0?this['available']:0x0;var _0x475fe9={'id':this['id'],'available':this[_0x1de6('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x1de6('0x14')],'waiting':this['waiting']};var _0x37c38b=md5(JSON[_0x1de6('0x18')](_0x475fe9));if(this[_0x1de6('0x1')]!==_0x37c38b){this[_0x1de6('0x1')]=_0x37c38b;io['to'](util[_0x1de6('0x19')](_0x1de6('0x1a'),_0x475fe9['name']))['emit']('mail_queue:save',_0x475fe9);}};module['exports']=MailQueue; \ No newline at end of file +var _0xf9a8=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','length','online','mailPause','available','paused','stringify','md5','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','ioredis','redis','defaults','localhost'];(function(_0x7ab1ff,_0x551d4c){var _0xddf90a=function(_0x245e92){while(--_0x245e92){_0x7ab1ff['push'](_0x7ab1ff['shift']());}};_0xddf90a(++_0x551d4c);}(_0xf9a8,0x1bd));var _0x8f9a=function(_0x3f1f9c,_0x4358e6){_0x3f1f9c=_0x3f1f9c-0x0;var _0x31090e=_0xf9a8[_0x3f1f9c];return _0x31090e;};'use strict';var _=require(_0x8f9a('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x8f9a('0x1'));var config=require('../../../config/environment');config[_0x8f9a('0x2')]=_[_0x8f9a('0x3')](config['redis'],{'host':_0x8f9a('0x4'),'port':0x18eb});var io=require(_0x8f9a('0x5'))(new Redis(config[_0x8f9a('0x2')]));function MailQueue(_0x4e9e7c){this['id']=_0x4e9e7c['id']||0x0;this['name']=_0x4e9e7c[_0x8f9a('0x6')]||'';this[_0x8f9a('0x7')]=_0x4e9e7c['timeout']||0xa;this['strategy']=_0x4e9e7c[_0x8f9a('0x8')]||'beepall';this[_0x8f9a('0x9')]=_0x4e9e7c[_0x8f9a('0x9')];this[_0x8f9a('0xa')]={};this[_0x8f9a('0xb')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}MailQueue['prototype'][_0x8f9a('0xc')]=function(){var _0x1e3e85=this[_0x8f9a('0xa')][_0x8f9a('0xd')];this[_0x8f9a('0xa')]=_[_0x8f9a('0xe')](this[_0x8f9a('0x9')],'id');this['mapAgentsId'][_0x8f9a('0xd')]=_0x1e3e85;};MailQueue[_0x8f9a('0xf')][_0x8f9a('0x10')]=function(){this[_0x8f9a('0x11')]=0x0;this['paused']=0x0;for(var _0x2fd2a7=0x0;_0x2fd2a7=0x0?this[_0x8f9a('0x15')]:0x0;var _0x3d9d52={'id':this['id'],'available':this[_0x8f9a('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x8f9a('0x6')],'paused':this[_0x8f9a('0x16')],'waiting':this[_0x8f9a('0xb')]};var _0x1d1750=md5(JSON[_0x8f9a('0x17')](_0x3d9d52));if(this[_0x8f9a('0x18')]!==_0x1d1750){this[_0x8f9a('0x18')]=_0x1d1750;io['to'](util[_0x8f9a('0x19')](_0x8f9a('0x1a'),_0x3d9d52['name']))[_0x8f9a('0x1b')](_0x8f9a('0x1c'),_0x3d9d52);}};module[_0x8f9a('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 1d88560..7ef77d4 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 _0x521d=['online','openchannelPause','available','format','openchannel:queue:%s','openchannel_queue:save','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','map','loggedIn','paused'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x521d,0x17d));var _0xd521=function(_0x27e32e,_0x339fbd){_0x27e32e=_0x27e32e-0x0;var _0x10f599=_0x521d[_0x27e32e];return _0x10f599;};'use strict';var _=require('lodash');var md5=require(_0xd521('0x0'));var util=require('util');var Redis=require(_0xd521('0x1'));var config=require(_0xd521('0x2'));config[_0xd521('0x3')]=_[_0xd521('0x4')](config['redis'],{'host':_0xd521('0x5'),'port':0x18eb});var io=require(_0xd521('0x6'))(new Redis(config[_0xd521('0x3')]));function OpenchannelQueue(_0x7b9f40){this['id']=_0x7b9f40['id']||0x0;this[_0xd521('0x7')]=_0x7b9f40[_0xd521('0x7')]||'';this['timeout']=_0x7b9f40[_0xd521('0x8')]||0xa;this[_0xd521('0x9')]=_0x7b9f40[_0xd521('0x9')]||_0xd521('0xa');this[_0xd521('0xb')]=_0x7b9f40['Agents'];this[_0xd521('0xc')]={};this[_0xd521('0xd')]=0x0;this[_0xd521('0x0')]='';this['updateRouting']();this[_0xd521('0xe')]();}OpenchannelQueue[_0xd521('0xf')]['updateRouting']=function(){var _0x18a8a8=this[_0xd521('0xc')]['_rr'];this['mapAgentsId']=_[_0xd521('0x10')](this[_0xd521('0xb')],'id');this[_0xd521('0xc')]['_rr']=_0x18a8a8;};OpenchannelQueue[_0xd521('0xf')]['updateRealtime']=function(){this[_0xd521('0x11')]=0x0;this[_0xd521('0x12')]=0x0;for(var _0x1ddc92=0x0;_0x1ddc92=0x0?this['available']:0x0;var _0x364f84={'id':this['id'],'available':this[_0xd521('0x15')],'loggedIn':this[_0xd521('0x11')],'name':this[_0xd521('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x14a2ea=md5(JSON['stringify'](_0x364f84));if(this[_0xd521('0x0')]!==_0x14a2ea){this[_0xd521('0x0')]=_0x14a2ea;io['to'](util[_0xd521('0x16')](_0xd521('0x17'),_0x364f84[_0xd521('0x7')]))['emit'](_0xd521('0x18'),_0x364f84);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x0894=['map','loggedIn','paused','length','online','openchannelPause','available','stringify','md5','openchannel:queue:%s','emit','openchannel_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0894,0x143));var _0x4089=function(_0x4f97c9,_0x55f9c4){_0x4f97c9=_0x4f97c9-0x0;var _0x386dce=_0x0894[_0x4f97c9];return _0x386dce;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x4089('0x0'));var Redis=require(_0x4089('0x1'));var config=require(_0x4089('0x2'));config[_0x4089('0x3')]=_[_0x4089('0x4')](config[_0x4089('0x3')],{'host':_0x4089('0x5'),'port':0x18eb});var io=require(_0x4089('0x6'))(new Redis(config[_0x4089('0x3')]));function OpenchannelQueue(_0x3e1ae2){this['id']=_0x3e1ae2['id']||0x0;this[_0x4089('0x7')]=_0x3e1ae2[_0x4089('0x7')]||'';this[_0x4089('0x8')]=_0x3e1ae2[_0x4089('0x8')]||0xa;this[_0x4089('0x9')]=_0x3e1ae2[_0x4089('0x9')]||_0x4089('0xa');this['Agents']=_0x3e1ae2[_0x4089('0xb')];this[_0x4089('0xc')]={};this[_0x4089('0xd')]=0x0;this['md5']='';this[_0x4089('0xe')]();this[_0x4089('0xf')]();}OpenchannelQueue[_0x4089('0x10')]['updateRouting']=function(){var _0x4041fb=this['mapAgentsId'][_0x4089('0x11')];this[_0x4089('0xc')]=_[_0x4089('0x12')](this[_0x4089('0xb')],'id');this[_0x4089('0xc')][_0x4089('0x11')]=_0x4041fb;};OpenchannelQueue['prototype']['updateRealtime']=function(){this[_0x4089('0x13')]=0x0;this[_0x4089('0x14')]=0x0;for(var _0x22f74a=0x0;_0x22f74a=0x0?this[_0x4089('0x18')]:0x0;var _0x1b6b9b={'id':this['id'],'available':this[_0x4089('0x18')],'loggedIn':this[_0x4089('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x4089('0xd')]};var _0x1955d0=md5(JSON[_0x4089('0x19')](_0x1b6b9b));if(this[_0x4089('0x1a')]!==_0x1955d0){this[_0x4089('0x1a')]=_0x1955d0;io['to'](util['format'](_0x4089('0x1b'),_0x1b6b9b['name']))[_0x4089('0x1c')](_0x4089('0x1d'),_0x1b6b9b);}};module[_0x4089('0x1e')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 38a1e4a..c28369d 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 _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x529daa,_0x460ef3){var _0x334320=function(_0x683c44){while(--_0x683c44){_0x529daa['push'](_0x529daa['shift']());}};_0x334320(++_0x460ef3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file +var _0xb10b=['length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','paused'];(function(_0x3cbe1c,_0x4bcabd){var _0x5ee08b=function(_0x5c53e6){while(--_0x5c53e6){_0x3cbe1c['push'](_0x3cbe1c['shift']());}};_0x5ee08b(++_0x4bcabd);}(_0xb10b,0x12a));var _0xbb10=function(_0x3700fd,_0x5bd346){_0x3700fd=_0x3700fd-0x0;var _0x4ffb6c=_0xb10b[_0x3700fd];return _0x4ffb6c;};'use strict';var _=require(_0xbb10('0x0'));var md5=require('md5');var util=require(_0xbb10('0x1'));var Redis=require(_0xbb10('0x2'));var config=require(_0xbb10('0x3'));config['redis']=_[_0xbb10('0x4')](config[_0xbb10('0x5')],{'host':_0xbb10('0x6'),'port':0x18eb});var io=require(_0xbb10('0x7'))(new Redis(config[_0xbb10('0x5')]));function SmsQueue(_0x312b72){this['id']=_0x312b72['id']||0x0;this['name']=_0x312b72[_0xbb10('0x8')]||'';this[_0xbb10('0x9')]=_0x312b72['timeout']||0xa;this[_0xbb10('0xa')]=_0x312b72[_0xbb10('0xa')]||_0xbb10('0xb');this[_0xbb10('0xc')]=_0x312b72[_0xbb10('0xc')];this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]=0x0;this[_0xbb10('0xf')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xbb10('0x10')][_0xbb10('0x11')]=function(){var _0xce64f3=this['mapAgentsId'][_0xbb10('0x12')];this['mapAgentsId']=_[_0xbb10('0x13')](this[_0xbb10('0xc')],'id');this[_0xbb10('0xd')][_0xbb10('0x12')]=_0xce64f3;};SmsQueue[_0xbb10('0x10')][_0xbb10('0x14')]=function(){this['loggedIn']=0x0;this[_0xbb10('0x15')]=0x0;for(var _0x42d7e4=0x0;_0x42d7e4=0x0?this[_0xbb10('0x1a')]:0x0;var _0x1682a4={'id':this['id'],'available':this[_0xbb10('0x1a')],'loggedIn':this[_0xbb10('0x18')],'name':this[_0xbb10('0x8')],'paused':this[_0xbb10('0x15')],'waiting':this['waiting']};var _0x5ff0cf=md5(JSON[_0xbb10('0x1b')](_0x1682a4));if(this[_0xbb10('0xf')]!==_0x5ff0cf){this[_0xbb10('0xf')]=_0x5ff0cf;io['to'](util[_0xbb10('0x1c')](_0xbb10('0x1d'),_0x1682a4['name']))[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x1682a4);}};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 c1f98ec..2d39e1e 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 _0xe2c3=['loggedIn','paused','length','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','../../../config/environment','defaults','redis','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr'];(function(_0x4098cb,_0x1bd84c){var _0x33eccb=function(_0xaddf28){while(--_0xaddf28){_0x4098cb['push'](_0x4098cb['shift']());}};_0x33eccb(++_0x1bd84c);}(_0xe2c3,0xa6));var _0x3e2c=function(_0x5b9259,_0x198473){_0x5b9259=_0x5b9259-0x0;var _0x5bbf28=_0xe2c3[_0x5b9259];return _0x5bbf28;};'use strict';var _=require('lodash');var md5=require(_0x3e2c('0x0'));var util=require(_0x3e2c('0x1'));var Redis=require('ioredis');var config=require(_0x3e2c('0x2'));config['redis']=_[_0x3e2c('0x3')](config[_0x3e2c('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x3e2c('0x5'))(new Redis(config[_0x3e2c('0x4')]));function WhatsappQueue(_0x2cc0ee){this['id']=_0x2cc0ee['id']||0x0;this['name']=_0x2cc0ee[_0x3e2c('0x6')]||'';this['timeout']=_0x2cc0ee['timeout']||0xa;this[_0x3e2c('0x7')]=_0x2cc0ee[_0x3e2c('0x7')]||_0x3e2c('0x8');this[_0x3e2c('0x9')]=_0x2cc0ee[_0x3e2c('0x9')];this[_0x3e2c('0xa')]={};this[_0x3e2c('0xb')]=0x0;this[_0x3e2c('0x0')]='';this[_0x3e2c('0xc')]();this['updateRealtime']();}WhatsappQueue[_0x3e2c('0xd')][_0x3e2c('0xc')]=function(){var _0x5c96cb=this['mapAgentsId']['_rr'];this[_0x3e2c('0xa')]=_[_0x3e2c('0xe')](this['Agents'],'id');this[_0x3e2c('0xa')][_0x3e2c('0xf')]=_0x5c96cb;};WhatsappQueue[_0x3e2c('0xd')]['updateRealtime']=function(){this[_0x3e2c('0x10')]=0x0;this[_0x3e2c('0x11')]=0x0;for(var _0x4c3458=0x0;_0x4c3458=0x0?this[_0x3e2c('0x13')]:0x0;var _0x2b2d61={'id':this['id'],'available':this[_0x3e2c('0x13')],'loggedIn':this[_0x3e2c('0x10')],'name':this[_0x3e2c('0x6')],'paused':this[_0x3e2c('0x11')],'waiting':this['waiting']};var _0x36658f=md5(JSON[_0x3e2c('0x14')](_0x2b2d61));if(this[_0x3e2c('0x0')]!==_0x36658f){this[_0x3e2c('0x0')]=_0x36658f;io['to'](util[_0x3e2c('0x15')](_0x3e2c('0x16'),_0x2b2d61['name']))[_0x3e2c('0x17')](_0x3e2c('0x18'),_0x2b2d61);}};module[_0x3e2c('0x19')]=WhatsappQueue; \ No newline at end of file +var _0x8c47=['mapAgentsId','waiting','md5','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','whatsappPause','available','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x8c47,0x16f));var _0x78c4=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x8c47[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x78c4('0x0'));var Redis=require(_0x78c4('0x1'));var config=require(_0x78c4('0x2'));config[_0x78c4('0x3')]=_[_0x78c4('0x4')](config[_0x78c4('0x3')],{'host':_0x78c4('0x5'),'port':0x18eb});var io=require(_0x78c4('0x6'))(new Redis(config[_0x78c4('0x3')]));function WhatsappQueue(_0x53bd03){this['id']=_0x53bd03['id']||0x0;this[_0x78c4('0x7')]=_0x53bd03[_0x78c4('0x7')]||'';this[_0x78c4('0x8')]=_0x53bd03['timeout']||0xa;this['strategy']=_0x53bd03['strategy']||_0x78c4('0x9');this[_0x78c4('0xa')]=_0x53bd03['Agents'];this[_0x78c4('0xb')]={};this[_0x78c4('0xc')]=0x0;this[_0x78c4('0xd')]='';this[_0x78c4('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x78c4('0xf')]['updateRouting']=function(){var _0x5b81e9=this['mapAgentsId'][_0x78c4('0x10')];this[_0x78c4('0xb')]=_['map'](this[_0x78c4('0xa')],'id');this[_0x78c4('0xb')][_0x78c4('0x10')]=_0x5b81e9;};WhatsappQueue['prototype'][_0x78c4('0x11')]=function(){this[_0x78c4('0x12')]=0x0;this[_0x78c4('0x13')]=0x0;for(var _0x52632b=0x0;_0x52632b=0x0?this[_0x78c4('0x16')]:0x0;var _0x437b94={'id':this['id'],'available':this['available'],'loggedIn':this[_0x78c4('0x12')],'name':this[_0x78c4('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x39be51=md5(JSON[_0x78c4('0x17')](_0x437b94));if(this[_0x78c4('0xd')]!==_0x39be51){this[_0x78c4('0xd')]=_0x39be51;io['to'](util[_0x78c4('0x18')](_0x78c4('0x19'),_0x437b94[_0x78c4('0x7')]))['emit'](_0x78c4('0x1a'),_0x437b94);}};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 38ee261..311edbd 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 _0x6aa7=['agents','openchannelQueues','chatQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','intervals','isUndefined','updateRealtime','initChatQueues','updateRouting','initMailQueues','mailQueues','initWhatsappQueues','bluebird','lodash','moment','../model/agent','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0x6aa7,0x178));var _0x76aa=function(_0x365583,_0x1ef17d){_0x365583=_0x365583-0x0;var _0x594d21=_0x6aa7[_0x365583];return _0x594d21;};'use strict';var BPromise=require(_0x76aa('0x0'));var util=require('util');var _=require(_0x76aa('0x1'));var moment=require(_0x76aa('0x2'));var Agent=require(_0x76aa('0x3'));var Interval=require(_0x76aa('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x76aa('0x5'));var SmsQueue=require(_0x76aa('0x6'));var MailQueue=require(_0x76aa('0x7'));var FaxQueue=require('../model/faxQueue');var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this[_0x76aa('0x8')]={};this['intervals']={};this[_0x76aa('0x9')]={};this[_0x76aa('0xa')]={};this[_0x76aa('0xb')]={};this['mailQueues']={};this[_0x76aa('0xc')]={};this[_0x76aa('0xd')]={};this[_0x76aa('0xe')]={};this['mailQueuesWaitingInteractions']={};this[_0x76aa('0xf')]={};this[_0x76aa('0x10')]={};this[_0x76aa('0x11')]={};this[_0x76aa('0x12')]={};};function freeIsNotKey(_0x37f1ab,_0x128435,_0x2c5075){var _0x8dc35c=_[_0x76aa('0x13')](_0x37f1ab,function(_0x17a417,_0x5e5f47){return _0x17a417[_0x2c5075];});for(var _0x112c39 in _0x128435){if(_0x128435['hasOwnProperty'](_0x112c39)){if(!_0x8dc35c[_0x112c39]){delete _0x128435[_0x112c39];}}}}Realtime[_0x76aa('0x14')][_0x76aa('0x15')]=function(_0x3f8f6b,_0x8e44ed){for(var _0x10432c in _0x8e44ed){if(_0x3f8f6b['hasOwnProperty'](_0x10432c)){_0x3f8f6b[_0x10432c]=_0x8e44ed[_0x10432c];}}};Realtime['prototype'][_0x76aa('0x16')]=function(){var _0x4cfc34=this;return function(_0x180d92){if(_0x180d92){freeIsNotKey(_0x180d92,_0x4cfc34[_0x76aa('0x8')],'id');for(var _0x5cf594=0x0,_0x2111c7={},_0x550d9a={};_0x5cf594<_0x180d92[_0x76aa('0x17')];_0x5cf594+=0x1){_0x2111c7=_0x180d92[_0x5cf594];if(_['isUndefined'](_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']])){_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']]=new Agent(_0x2111c7);}else{_0x4cfc34[_0x76aa('0x15')](_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']],_0x2111c7);}}}return _0x4cfc34[_0x76aa('0x8')];};};Realtime[_0x76aa('0x14')]['initIntervals']=function(){var _0x5d6202=this;return function(_0x256636){if(_0x256636){freeIsNotKey(_0x256636,_0x5d6202[_0x76aa('0x18')],'id');for(var _0xf0711=0x0,_0x15b931={},_0x15109b={};_0xf0711<_0x256636[_0x76aa('0x17')];_0xf0711+=0x1){_0x15b931=_0x256636[_0xf0711];if(_[_0x76aa('0x19')](_0x5d6202[_0x76aa('0x18')][_0x15b931['id']])){_0x5d6202[_0x76aa('0x18')][_0x15b931['id']]=new Interval(_0x15b931);}else{_0x5d6202['mergeFromDatabase'](_0x5d6202[_0x76aa('0x18')][_0x15b931['id']],_0x15b931);}}}return _0x5d6202[_0x76aa('0x18')];};};Realtime[_0x76aa('0x14')]['initOpenchannelQueues']=function(){var _0x41463a=this;return function(_0x189cb6){if(_0x189cb6){freeIsNotKey(_0x189cb6,_0x41463a[_0x76aa('0x9')],'id');for(var _0x2bd2c6=0x0,_0x29c50c={},_0xc1044c={};_0x2bd2c6<_0x189cb6[_0x76aa('0x17')];_0x2bd2c6+=0x1){_0x29c50c=_0x189cb6[_0x2bd2c6];if(_[_0x76aa('0x19')](_0x41463a[_0x76aa('0x9')][_0x29c50c['id']])){_0x41463a[_0x76aa('0x9')][_0x29c50c['id']]=new OpenchannelQueue(_0x29c50c);}else{_0x41463a[_0x76aa('0x15')](_0x41463a[_0x76aa('0x9')][_0x29c50c['id']],_0x29c50c);}_0x41463a[_0x76aa('0x9')][_0x29c50c['id']]['updateRouting']();_0x41463a[_0x76aa('0x9')][_0x29c50c['id']][_0x76aa('0x1a')]();}}return _0x41463a[_0x76aa('0x9')];};};Realtime[_0x76aa('0x14')][_0x76aa('0x1b')]=function(){var _0x2f9316=this;return function(_0x25a803){if(_0x25a803){freeIsNotKey(_0x25a803,_0x2f9316[_0x76aa('0xa')],'id');for(var _0xd12a99=0x0,_0x1bdc3d={},_0x545b06={};_0xd12a99<_0x25a803[_0x76aa('0x17')];_0xd12a99+=0x1){_0x1bdc3d=_0x25a803[_0xd12a99];if(_['isUndefined'](_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']])){_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']]=new ChatQueue(_0x1bdc3d);}else{_0x2f9316[_0x76aa('0x15')](_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']],_0x1bdc3d);}_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']][_0x76aa('0x1c')]();_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']][_0x76aa('0x1a')]();}}return _0x2f9316[_0x76aa('0xa')];};};Realtime[_0x76aa('0x14')]['initSmsQueues']=function(){var _0x430ad6=this;return function(_0x5532c7){if(_0x5532c7){freeIsNotKey(_0x5532c7,_0x430ad6[_0x76aa('0xb')],'id');for(var _0x928ccf=0x0,_0x458ac3={},_0x38ecd1={};_0x928ccf<_0x5532c7[_0x76aa('0x17')];_0x928ccf+=0x1){_0x458ac3=_0x5532c7[_0x928ccf];if(_['isUndefined'](_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']])){_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']]=new SmsQueue(_0x458ac3);}else{_0x430ad6['mergeFromDatabase'](_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']],_0x458ac3);}_0x430ad6['smsQueues'][_0x458ac3['id']][_0x76aa('0x1c')]();_0x430ad6['smsQueues'][_0x458ac3['id']][_0x76aa('0x1a')]();}}return _0x430ad6['smsQueues'];};};Realtime['prototype'][_0x76aa('0x1d')]=function(){var _0x282c56=this;return function(_0x198fcb){if(_0x198fcb){freeIsNotKey(_0x198fcb,_0x282c56[_0x76aa('0x1e')],'id');for(var _0x595a0f=0x0,_0x592596={},_0xdb18d3={};_0x595a0f<_0x198fcb[_0x76aa('0x17')];_0x595a0f+=0x1){_0x592596=_0x198fcb[_0x595a0f];if(_[_0x76aa('0x19')](_0x282c56[_0x76aa('0x1e')][_0x592596['id']])){_0x282c56[_0x76aa('0x1e')][_0x592596['id']]=new MailQueue(_0x592596);}else{_0x282c56['mergeFromDatabase'](_0x282c56[_0x76aa('0x1e')][_0x592596['id']],_0x592596);}_0x282c56['mailQueues'][_0x592596['id']]['updateRouting']();_0x282c56[_0x76aa('0x1e')][_0x592596['id']][_0x76aa('0x1a')]();}}return _0x282c56[_0x76aa('0x1e')];};};Realtime[_0x76aa('0x14')]['initFaxQueues']=function(){var _0x401c07=this;return function(_0x1c22f7){if(_0x1c22f7){freeIsNotKey(_0x1c22f7,_0x401c07[_0x76aa('0xc')],'id');for(var _0x4e131a=0x0,_0x113770={},_0x1638db={};_0x4e131a<_0x1c22f7[_0x76aa('0x17')];_0x4e131a+=0x1){_0x113770=_0x1c22f7[_0x4e131a];if(_[_0x76aa('0x19')](_0x401c07[_0x76aa('0xc')][_0x113770['id']])){_0x401c07[_0x76aa('0xc')][_0x113770['id']]=new FaxQueue(_0x113770);}else{_0x401c07[_0x76aa('0x15')](_0x401c07[_0x76aa('0xc')][_0x113770['id']],_0x113770);}_0x401c07[_0x76aa('0xc')][_0x113770['id']]['updateRouting']();_0x401c07[_0x76aa('0xc')][_0x113770['id']][_0x76aa('0x1a')]();}}return _0x401c07[_0x76aa('0xc')];};};Realtime[_0x76aa('0x14')][_0x76aa('0x1f')]=function(){var _0x2957aa=this;return function(_0x572fdb){if(_0x572fdb){freeIsNotKey(_0x572fdb,_0x2957aa['whatsappQueues'],'id');for(var _0x153a47=0x0,_0x262906={},_0x426454={};_0x153a47<_0x572fdb[_0x76aa('0x17')];_0x153a47+=0x1){_0x262906=_0x572fdb[_0x153a47];if(_['isUndefined'](_0x2957aa[_0x76aa('0xd')][_0x262906['id']])){_0x2957aa[_0x76aa('0xd')][_0x262906['id']]=new WhatsappQueue(_0x262906);}else{_0x2957aa[_0x76aa('0x15')](_0x2957aa[_0x76aa('0xd')][_0x262906['id']],_0x262906);}_0x2957aa[_0x76aa('0xd')][_0x262906['id']]['updateRouting']();_0x2957aa[_0x76aa('0xd')][_0x262906['id']]['updateRealtime']();}}return _0x2957aa[_0x76aa('0xd')];};};module['exports']=Realtime; \ No newline at end of file +var _0x1cb9=['initIntervals','updateRealtime','initChatQueues','updateRouting','initSmsQueues','smsQueues','initFaxQueues','faxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/chatQueue','../model/smsQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x1cb9,0x14e));var _0x91cb=function(_0xb9afc0,_0x222202){_0xb9afc0=_0xb9afc0-0x0;var _0x5c8812=_0x1cb9[_0xb9afc0];return _0x5c8812;};'use strict';var BPromise=require(_0x91cb('0x0'));var util=require('util');var _=require(_0x91cb('0x1'));var moment=require(_0x91cb('0x2'));var Agent=require(_0x91cb('0x3'));var Interval=require(_0x91cb('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x91cb('0x5'));var SmsQueue=require(_0x91cb('0x6'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x91cb('0x7'));var WhatsappQueue=require(_0x91cb('0x8'));var Realtime=function(){this[_0x91cb('0x9')]={};this[_0x91cb('0xa')]={};this[_0x91cb('0xb')]={};this[_0x91cb('0xc')]={};this['smsQueues']={};this[_0x91cb('0xd')]={};this['faxQueues']={};this[_0x91cb('0xe')]={};this['chatQueuesWaitingInteractions']={};this[_0x91cb('0xf')]={};this[_0x91cb('0x10')]={};this[_0x91cb('0x11')]={};this[_0x91cb('0x12')]={};this[_0x91cb('0x13')]={};};function freeIsNotKey(_0x23ba9a,_0x21a0a5,_0x22dcab){var _0x2465be=_[_0x91cb('0x14')](_0x23ba9a,function(_0x530d92,_0x3c1f56){return _0x530d92[_0x22dcab];});for(var _0x366f09 in _0x21a0a5){if(_0x21a0a5['hasOwnProperty'](_0x366f09)){if(!_0x2465be[_0x366f09]){delete _0x21a0a5[_0x366f09];}}}}Realtime[_0x91cb('0x15')][_0x91cb('0x16')]=function(_0x44f2e9,_0x2c7d40){for(var _0x4a7d45 in _0x2c7d40){if(_0x44f2e9['hasOwnProperty'](_0x4a7d45)){_0x44f2e9[_0x4a7d45]=_0x2c7d40[_0x4a7d45];}}};Realtime[_0x91cb('0x15')][_0x91cb('0x17')]=function(){var _0x585470=this;return function(_0x528f73){if(_0x528f73){freeIsNotKey(_0x528f73,_0x585470[_0x91cb('0x9')],'id');for(var _0xc3629e=0x0,_0x347980={},_0x5ea796={};_0xc3629e<_0x528f73[_0x91cb('0x18')];_0xc3629e+=0x1){_0x347980=_0x528f73[_0xc3629e];if(_[_0x91cb('0x19')](_0x585470['agents'][_0x347980['id']])){_0x585470[_0x91cb('0x9')][_0x347980['id']]=new Agent(_0x347980);}else{_0x585470[_0x91cb('0x16')](_0x585470[_0x91cb('0x9')][_0x347980['id']],_0x347980);}}}return _0x585470[_0x91cb('0x9')];};};Realtime['prototype'][_0x91cb('0x1a')]=function(){var _0x7dcf60=this;return function(_0x4ca8e8){if(_0x4ca8e8){freeIsNotKey(_0x4ca8e8,_0x7dcf60[_0x91cb('0xa')],'id');for(var _0x4c9fb2=0x0,_0x55042a={},_0x281ff3={};_0x4c9fb2<_0x4ca8e8[_0x91cb('0x18')];_0x4c9fb2+=0x1){_0x55042a=_0x4ca8e8[_0x4c9fb2];if(_['isUndefined'](_0x7dcf60['intervals'][_0x55042a['id']])){_0x7dcf60['intervals'][_0x55042a['id']]=new Interval(_0x55042a);}else{_0x7dcf60[_0x91cb('0x16')](_0x7dcf60[_0x91cb('0xa')][_0x55042a['id']],_0x55042a);}}}return _0x7dcf60[_0x91cb('0xa')];};};Realtime[_0x91cb('0x15')]['initOpenchannelQueues']=function(){var _0x45c4b3=this;return function(_0x43881c){if(_0x43881c){freeIsNotKey(_0x43881c,_0x45c4b3[_0x91cb('0xb')],'id');for(var _0x55fa78=0x0,_0x26f18f={},_0x1a7a54={};_0x55fa78<_0x43881c[_0x91cb('0x18')];_0x55fa78+=0x1){_0x26f18f=_0x43881c[_0x55fa78];if(_[_0x91cb('0x19')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']])){_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]=new OpenchannelQueue(_0x26f18f);}else{_0x45c4b3[_0x91cb('0x16')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']],_0x26f18f);}_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]['updateRouting']();_0x45c4b3['openchannelQueues'][_0x26f18f['id']][_0x91cb('0x1b')]();}}return _0x45c4b3['openchannelQueues'];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1c')]=function(){var _0x318031=this;return function(_0x5595c5){if(_0x5595c5){freeIsNotKey(_0x5595c5,_0x318031[_0x91cb('0xc')],'id');for(var _0x4f5a7b=0x0,_0x4572f6={},_0x308e8c={};_0x4f5a7b<_0x5595c5[_0x91cb('0x18')];_0x4f5a7b+=0x1){_0x4572f6=_0x5595c5[_0x4f5a7b];if(_[_0x91cb('0x19')](_0x318031[_0x91cb('0xc')][_0x4572f6['id']])){_0x318031['chatQueues'][_0x4572f6['id']]=new ChatQueue(_0x4572f6);}else{_0x318031[_0x91cb('0x16')](_0x318031['chatQueues'][_0x4572f6['id']],_0x4572f6);}_0x318031[_0x91cb('0xc')][_0x4572f6['id']][_0x91cb('0x1d')]();_0x318031[_0x91cb('0xc')][_0x4572f6['id']]['updateRealtime']();}}return _0x318031[_0x91cb('0xc')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1e')]=function(){var _0x361e4c=this;return function(_0xf296bc){if(_0xf296bc){freeIsNotKey(_0xf296bc,_0x361e4c[_0x91cb('0x1f')],'id');for(var _0x1e5bf1=0x0,_0x3bbde3={},_0x1a10b1={};_0x1e5bf1<_0xf296bc['length'];_0x1e5bf1+=0x1){_0x3bbde3=_0xf296bc[_0x1e5bf1];if(_[_0x91cb('0x19')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']])){_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']]=new SmsQueue(_0x3bbde3);}else{_0x361e4c[_0x91cb('0x16')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']],_0x3bbde3);}_0x361e4c['smsQueues'][_0x3bbde3['id']][_0x91cb('0x1d')]();_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']][_0x91cb('0x1b')]();}}return _0x361e4c[_0x91cb('0x1f')];};};Realtime[_0x91cb('0x15')]['initMailQueues']=function(){var _0x121c37=this;return function(_0x5927cb){if(_0x5927cb){freeIsNotKey(_0x5927cb,_0x121c37['mailQueues'],'id');for(var _0x479968=0x0,_0x2011fc={},_0x4bba88={};_0x479968<_0x5927cb[_0x91cb('0x18')];_0x479968+=0x1){_0x2011fc=_0x5927cb[_0x479968];if(_['isUndefined'](_0x121c37['mailQueues'][_0x2011fc['id']])){_0x121c37[_0x91cb('0xd')][_0x2011fc['id']]=new MailQueue(_0x2011fc);}else{_0x121c37[_0x91cb('0x16')](_0x121c37[_0x91cb('0xd')][_0x2011fc['id']],_0x2011fc);}_0x121c37[_0x91cb('0xd')][_0x2011fc['id']][_0x91cb('0x1d')]();_0x121c37['mailQueues'][_0x2011fc['id']][_0x91cb('0x1b')]();}}return _0x121c37[_0x91cb('0xd')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x20')]=function(){var _0x486a89=this;return function(_0x5953f6){if(_0x5953f6){freeIsNotKey(_0x5953f6,_0x486a89[_0x91cb('0x21')],'id');for(var _0x135bf1=0x0,_0x56d614={},_0x39bd64={};_0x135bf1<_0x5953f6[_0x91cb('0x18')];_0x135bf1+=0x1){_0x56d614=_0x5953f6[_0x135bf1];if(_['isUndefined'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']])){_0x486a89[_0x91cb('0x21')][_0x56d614['id']]=new FaxQueue(_0x56d614);}else{_0x486a89['mergeFromDatabase'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']],_0x56d614);}_0x486a89['faxQueues'][_0x56d614['id']][_0x91cb('0x1d')]();_0x486a89[_0x91cb('0x21')][_0x56d614['id']][_0x91cb('0x1b')]();}}return _0x486a89[_0x91cb('0x21')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x22')]=function(){var _0x5d0e37=this;return function(_0xa90111){if(_0xa90111){freeIsNotKey(_0xa90111,_0x5d0e37[_0x91cb('0xe')],'id');for(var _0x4e5b4b=0x0,_0x312581={},_0x4ecbd7={};_0x4e5b4b<_0xa90111[_0x91cb('0x18')];_0x4e5b4b+=0x1){_0x312581=_0xa90111[_0x4e5b4b];if(_[_0x91cb('0x19')](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']])){_0x5d0e37[_0x91cb('0xe')][_0x312581['id']]=new WhatsappQueue(_0x312581);}else{_0x5d0e37['mergeFromDatabase'](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']],_0x312581);}_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1d')]();_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1b')]();}}return _0x5d0e37[_0x91cb('0xe')];};};module[_0x91cb('0x23')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index c4f45a8..ad00703 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 _0x71d9=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x154621,_0x9e23a5){var _0x347062=function(_0x55ad71){while(--_0x55ad71){_0x154621['push'](_0x154621['shift']());}};_0x347062(++_0x9e23a5);}(_0x71d9,0x191));var _0x971d=function(_0x56d461,_0x24c877){_0x56d461=_0x56d461-0x0;var _0x99c335=_0x71d9[_0x56d461];return _0x99c335;};'use strict';var client=require(_0x971d('0x0'));exports[_0x971d('0x1')]=function(_0x1f4135,_0x35b308){return client[_0x971d('0x2')](_0x971d('0x3'),{'body':_0x35b308,'options':{'where':{'id':_0x1f4135}},'log':_0x971d('0x4')});};exports[_0x971d('0x5')]=function(_0x59c371,_0x2383a5){return client[_0x971d('0x2')](_0x971d('0x6'),{'body':_0x2383a5,'options':{'where':{'id':_0x59c371}},'log':_0x971d('0x7')});}; \ No newline at end of file +var _0xe191=['update','Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','../client'];(function(_0xa29be2,_0x5a1015){var _0x5ef0d3=function(_0x28a563){while(--_0x28a563){_0xa29be2['push'](_0xa29be2['shift']());}};_0x5ef0d3(++_0x5a1015);}(_0xe191,0x125));var _0x1e19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe191[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1e19('0x0'));exports[_0x1e19('0x1')]=function(_0x3ba0b3,_0x5b7dd5){return client[_0x1e19('0x2')](_0x1e19('0x3'),{'body':_0x5b7dd5,'options':{'where':{'id':_0x3ba0b3}},'log':_0x1e19('0x4')});};exports['addTags']=function(_0xcb76f2,_0x44c066){return client[_0x1e19('0x2')](_0x1e19('0x5'),{'body':_0x44c066,'options':{'where':{'id':_0xcb76f2}},'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 cfefff0..f28c89d 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 _0xe1c6=['CreateChatMessage','../client','create','Request'];(function(_0x435044,_0x36ab8e){var _0x33d4c6=function(_0x15efa0){while(--_0x15efa0){_0x435044['push'](_0x435044['shift']());}};_0x33d4c6(++_0x36ab8e);}(_0xe1c6,0x1c1));var _0x6e1c=function(_0x2b3268,_0x137d4e){_0x2b3268=_0x2b3268-0x0;var _0x26797d=_0xe1c6[_0x2b3268];return _0x26797d;};'use strict';var client=require(_0x6e1c('0x0'));exports[_0x6e1c('0x1')]=function(_0x4d965c){return client[_0x6e1c('0x2')](_0x6e1c('0x3'),{'body':_0x4d965c,'log':'createChatMessage'});}; \ No newline at end of file +var _0xe5a4=['../client','create','CreateChatMessage','createChatMessage'];(function(_0x1c9c24,_0x2a517b){var _0x349c69=function(_0x259ff7){while(--_0x259ff7){_0x1c9c24['push'](_0x1c9c24['shift']());}};_0x349c69(++_0x2a517b);}(_0xe5a4,0x154));var _0x4e5a=function(_0x19fc35,_0x34adf9){_0x19fc35=_0x19fc35-0x0;var _0x55ce9d=_0xe5a4[_0x19fc35];return _0x55ce9d;};'use strict';var client=require(_0x4e5a('0x0'));exports[_0x4e5a('0x1')]=function(_0x12cd79){return client['Request'](_0x4e5a('0x2'),{'body':_0x12cd79,'log':_0x4e5a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index ec0a2a7..2f27b1f 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 _0x7408=['User','online','getChatQueues','Request','GetChatQueue','name','strategy'];(function(_0x40c076,_0x33efc1){var _0x19f6e1=function(_0x13b2bf){while(--_0x13b2bf){_0x40c076['push'](_0x40c076['shift']());}};_0x19f6e1(++_0x33efc1);}(_0x7408,0x11a));var _0x8740=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x7408[_0x5c2e3e];return _0x53f64a;};'use strict';var client=require('../client');exports[_0x8740('0x0')]=function(){return function(){return client[_0x8740('0x1')](_0x8740('0x2'),{'options':{'raw':![],'attributes':['id',_0x8740('0x3'),'timeout',_0x8740('0x4')],'include':[{'model':_0x8740('0x5'),'as':'Agents','attributes':['id',_0x8740('0x3'),_0x8740('0x6'),'chatPause']}]},'log':_0x8740('0x0')});};}; \ No newline at end of file +var _0xb2d8=['GetChatQueue','name','timeout','strategy','User','online','chatPause','../client','getChatQueues','Request'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb2d8,0x10b));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x8b2d('0x0'));exports[_0x8b2d('0x1')]=function(){return function(){return client[_0x8b2d('0x2')](_0x8b2d('0x3'),{'options':{'raw':![],'attributes':['id',_0x8b2d('0x4'),_0x8b2d('0x5'),_0x8b2d('0x6')],'include':[{'model':_0x8b2d('0x7'),'as':'Agents','attributes':['id',_0x8b2d('0x4'),_0x8b2d('0x8'),_0x8b2d('0x9')]}]},'log':_0x8b2d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index c747af8..46aff9e 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 _0xbd3b=['UpdateChatQueueReport','../client','create','CreateChatQueueReport','update','Request'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x112db5,_0x38a06d){_0x112db5=_0x112db5-0x0;var _0x1d7d06=_0xbd3b[_0x112db5];return _0x1d7d06;};'use strict';var client=require(_0xbbd3('0x0'));exports[_0xbbd3('0x1')]=function(_0x41cb28){return client['Request'](_0xbbd3('0x2'),{'body':_0x41cb28,'log':_0xbbd3('0x2')});};exports[_0xbbd3('0x3')]=function(_0x13b296,_0x4e911b){return client[_0xbbd3('0x4')](_0xbbd3('0x5'),{'body':_0x4e911b,'options':{'where':{'uniqueid':_0x13b296},'order':[['id','DESC']],'limit':0x1},'log':_0xbbd3('0x5')});}; \ No newline at end of file +var _0x39b3=['DESC','../client','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x459566,_0x292550){var _0x203344=function(_0x58ff0d){while(--_0x58ff0d){_0x459566['push'](_0x459566['shift']());}};_0x203344(++_0x292550);}(_0x39b3,0xc9));var _0x339b=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x39b3[_0xbb091];return _0x467a04;};'use strict';var client=require(_0x339b('0x0'));exports['create']=function(_0x57b94f){return client[_0x339b('0x1')]('CreateChatQueueReport',{'body':_0x57b94f,'log':_0x339b('0x2')});};exports['update']=function(_0x3427e1,_0x3c4a53){return client[_0x339b('0x1')](_0x339b('0x3'),{'body':_0x3c4a53,'options':{'where':{'uniqueid':_0x3427e1},'order':[['id',_0x339b('0x4')]],'limit':0x1},'log':_0x339b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index d7c326b..1506326 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 _0x8050=['AddTagsToFaxInteraction','addTagsToFaxInteraction','update','Request','UpdateFaxInteraction','updateFaxInteraction'];(function(_0x49a1a0,_0x48f776){var _0x518a4f=function(_0x313633){while(--_0x313633){_0x49a1a0['push'](_0x49a1a0['shift']());}};_0x518a4f(++_0x48f776);}(_0x8050,0xf8));var _0x0805=function(_0x26be12,_0x338b2c){_0x26be12=_0x26be12-0x0;var _0x110b3c=_0x8050[_0x26be12];return _0x110b3c;};'use strict';var client=require('../client');exports[_0x0805('0x0')]=function(_0x3b5b00,_0x24b143){return client[_0x0805('0x1')](_0x0805('0x2'),{'body':_0x24b143,'options':{'where':{'id':_0x3b5b00}},'log':_0x0805('0x3')});};exports['addTags']=function(_0x4444ed,_0x2bc3fb){return client[_0x0805('0x1')](_0x0805('0x4'),{'body':_0x2bc3fb,'options':{'where':{'id':_0x4444ed}},'log':_0x0805('0x5')});}; \ No newline at end of file +var _0xf5c9=['UpdateFaxInteraction','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5c9,0x1a1));var _0x9f5c=function(_0x19ec47,_0x256e68){_0x19ec47=_0x19ec47-0x0;var _0x3f8205=_0xf5c9[_0x19ec47];return _0x3f8205;};'use strict';var client=require(_0x9f5c('0x0'));exports[_0x9f5c('0x1')]=function(_0x22e20,_0x20482c){return client[_0x9f5c('0x2')](_0x9f5c('0x3'),{'body':_0x20482c,'options':{'where':{'id':_0x22e20}},'log':'updateFaxInteraction'});};exports['addTags']=function(_0x203b64,_0x55d2ce){return client[_0x9f5c('0x2')](_0x9f5c('0x4'),{'body':_0x55d2ce,'options':{'where':{'id':_0x203b64}},'log':_0x9f5c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 6cdf0b8..afe4d17 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 _0xe6f0=['Request','CreateFaxMessage','../client','create'];(function(_0x1e4d72,_0x37295a){var _0x331050=function(_0x23b2a6){while(--_0x23b2a6){_0x1e4d72['push'](_0x1e4d72['shift']());}};_0x331050(++_0x37295a);}(_0xe6f0,0x7a));var _0x0e6f=function(_0x1d056a,_0x293d07){_0x1d056a=_0x1d056a-0x0;var _0x8e14c0=_0xe6f0[_0x1d056a];return _0x8e14c0;};'use strict';var client=require(_0x0e6f('0x0'));exports[_0x0e6f('0x1')]=function(_0x41625b){return client[_0x0e6f('0x2')](_0x0e6f('0x3'),{'body':_0x41625b,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x5dc3=['../client','Request','createFaxMessage'];(function(_0x2f19a1,_0x81718d){var _0x112701=function(_0x59db76){while(--_0x59db76){_0x2f19a1['push'](_0x2f19a1['shift']());}};_0x112701(++_0x81718d);}(_0x5dc3,0x189));var _0x35dc=function(_0xc1d691,_0x166b6e){_0xc1d691=_0xc1d691-0x0;var _0x16ac7=_0x5dc3[_0xc1d691];return _0x16ac7;};'use strict';var client=require(_0x35dc('0x0'));exports['create']=function(_0x4e71be){return client[_0x35dc('0x1')]('CreateFaxMessage',{'body':_0x4e71be,'log':_0x35dc('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 48cd2cf..d9ee374 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 _0x8104=['../client','getFaxQueues','GetFaxQueue','name','timeout','strategy','User','Agents','faxPause'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8104,0x156));var _0x4810=function(_0x42dcba,_0x3950f1){_0x42dcba=_0x42dcba-0x0;var _0x28968b=_0x8104[_0x42dcba];return _0x28968b;};'use strict';var client=require(_0x4810('0x0'));exports[_0x4810('0x1')]=function(){return function(){return client['Request'](_0x4810('0x2'),{'options':{'raw':![],'attributes':['id',_0x4810('0x3'),_0x4810('0x4'),_0x4810('0x5')],'include':[{'model':_0x4810('0x6'),'as':_0x4810('0x7'),'attributes':['id',_0x4810('0x3'),'online',_0x4810('0x8')]}]},'log':_0x4810('0x1')});};}; \ No newline at end of file +var _0x0275=['Request','name','strategy','Agents','online','faxPause','getFaxQueues'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x0275,0xf5));var _0x5027=function(_0x359b2d,_0x3f9375){_0x359b2d=_0x359b2d-0x0;var _0x2a3356=_0x0275[_0x359b2d];return _0x2a3356;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x5027('0x0')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x5027('0x1'),'timeout',_0x5027('0x2')],'include':[{'model':'User','as':_0x5027('0x3'),'attributes':['id',_0x5027('0x1'),_0x5027('0x4'),_0x5027('0x5')]}]},'log':_0x5027('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index eaf61d2..ba368ba 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 _0x92f6=['Request','UpdateFaxQueueReport','DESC','create','CreateFaxQueueReport','update'];(function(_0x2e8be9,_0xef11b6){var _0x8ae839=function(_0x6ec8a0){while(--_0x6ec8a0){_0x2e8be9['push'](_0x2e8be9['shift']());}};_0x8ae839(++_0xef11b6);}(_0x92f6,0x12f));var _0x692f=function(_0x3c20f6,_0x497751){_0x3c20f6=_0x3c20f6-0x0;var _0x39e961=_0x92f6[_0x3c20f6];return _0x39e961;};'use strict';var client=require('../client');exports[_0x692f('0x0')]=function(_0x408d1d){return client['Request'](_0x692f('0x1'),{'body':_0x408d1d,'log':'CreateFaxQueueReport'});};exports[_0x692f('0x2')]=function(_0x47be60,_0x215183){return client[_0x692f('0x3')](_0x692f('0x4'),{'body':_0x215183,'options':{'where':{'uniqueid':_0x47be60},'order':[['id',_0x692f('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x6b9e=['update','DESC','UpdateFaxQueueReport','create','Request','CreateFaxQueueReport'];(function(_0x3bf73e,_0x382e8d){var _0x2ec4a7=function(_0x426bb3){while(--_0x426bb3){_0x3bf73e['push'](_0x3bf73e['shift']());}};_0x2ec4a7(++_0x382e8d);}(_0x6b9e,0x16b));var _0xe6b9=function(_0x41e2e3,_0x25d722){_0x41e2e3=_0x41e2e3-0x0;var _0x20cc85=_0x6b9e[_0x41e2e3];return _0x20cc85;};'use strict';var client=require('../client');exports[_0xe6b9('0x0')]=function(_0x3e5a89){return client[_0xe6b9('0x1')]('CreateFaxQueueReport',{'body':_0x3e5a89,'log':_0xe6b9('0x2')});};exports[_0xe6b9('0x3')]=function(_0x487bfd,_0x719f0){return client[_0xe6b9('0x1')]('UpdateFaxQueueReport',{'body':_0x719f0,'options':{'where':{'uniqueid':_0x487bfd},'order':[['id',_0xe6b9('0x4')]],'limit':0x1},'log':_0xe6b9('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index f1406e9..2d179fb 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 _0xf4f4=['getIntervals','GetInterval','name','Interval','Intervals','../client'];(function(_0x304471,_0x361864){var _0x2b6563=function(_0x2ec573){while(--_0x2ec573){_0x304471['push'](_0x304471['shift']());}};_0x2b6563(++_0x361864);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x5815af,_0x361f0b){_0x5815af=_0x5815af-0x0;var _0x3f14cb=_0xf4f4[_0x5815af];return _0x3f14cb;};'use strict';var client=require(_0x4f4f('0x0'));exports[_0x4f4f('0x1')]=function(){return function(){return client['Request'](_0x4f4f('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x4f4f('0x3')],'include':[{'model':_0x4f4f('0x4'),'as':_0x4f4f('0x5'),'attributes':['id',_0x4f4f('0x3'),'interval']}]},'log':_0x4f4f('0x1')});};}; \ No newline at end of file +var _0x4cf8=['interval','../client','getIntervals','Request','GetInterval','name','Interval','Intervals'];(function(_0x1730df,_0x1497eb){var _0x4f3834=function(_0x36b2b2){while(--_0x36b2b2){_0x1730df['push'](_0x1730df['shift']());}};_0x4f3834(++_0x1497eb);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x272ea6,_0x3f0673){_0x272ea6=_0x272ea6-0x0;var _0x43ef03=_0x4cf8[_0x272ea6];return _0x43ef03;};'use strict';var client=require(_0x84cf('0x0'));exports[_0x84cf('0x1')]=function(){return function(){return client[_0x84cf('0x2')](_0x84cf('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x84cf('0x4')],'include':[{'model':_0x84cf('0x5'),'as':_0x84cf('0x6'),'attributes':['id',_0x84cf('0x4'),_0x84cf('0x7')]}]},'log':_0x84cf('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 5f3f906..b3405f8 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 _0xfae8=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x8dd69e,_0x4956e3){var _0x253db5=function(_0x5ba9c5){while(--_0x5ba9c5){_0x8dd69e['push'](_0x8dd69e['shift']());}};_0x253db5(++_0x4956e3);}(_0xfae8,0x179));var _0x8fae=function(_0x4a3cd9,_0x50a317){_0x4a3cd9=_0x4a3cd9-0x0;var _0x5c091c=_0xfae8[_0x4a3cd9];return _0x5c091c;};'use strict';var client=require(_0x8fae('0x0'));exports[_0x8fae('0x1')]=function(_0x241cb1,_0xa40627){return client[_0x8fae('0x2')](_0x8fae('0x3'),{'body':_0xa40627,'options':{'where':{'id':_0x241cb1}},'log':_0x8fae('0x4')});};exports[_0x8fae('0x5')]=function(_0x4fb004,_0x63cb26){return client[_0x8fae('0x2')](_0x8fae('0x6'),{'body':_0x63cb26,'options':{'where':{'id':_0x4fb004}},'log':_0x8fae('0x7')});}; \ No newline at end of file +var _0xd505=['../client','update','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x2aeb2d,_0x416ed9){var _0xdf886c=function(_0x2a93c5){while(--_0x2a93c5){_0x2aeb2d['push'](_0x2aeb2d['shift']());}};_0xdf886c(++_0x416ed9);}(_0xd505,0x15e));var _0x5d50=function(_0x5981e1,_0x123263){_0x5981e1=_0x5981e1-0x0;var _0x34088d=_0xd505[_0x5981e1];return _0x34088d;};'use strict';var client=require(_0x5d50('0x0'));exports[_0x5d50('0x1')]=function(_0x54ccd6,_0x4f4778){return client['Request']('UpdateMailInteraction',{'body':_0x4f4778,'options':{'where':{'id':_0x54ccd6}},'log':'updateMailInteraction'});};exports[_0x5d50('0x2')]=function(_0x144e39,_0x397aff){return client['Request'](_0x5d50('0x3'),{'body':_0x397aff,'options':{'where':{'id':_0x144e39}},'log':_0x5d50('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 88b0068..b624d7a 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 _0xe65f=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe65f,0x84));var _0xfe65=function(_0x204047,_0x2df7af){_0x204047=_0x204047-0x0;var _0x5956d2=_0xe65f[_0x204047];return _0x5956d2;};'use strict';var client=require(_0xfe65('0x0'));exports[_0xfe65('0x1')]=function(_0x5dc000){return client[_0xfe65('0x2')](_0xfe65('0x3'),{'body':_0x5dc000,'log':_0xfe65('0x4')});}; \ No newline at end of file +var _0x0fca=['Request','CreateMailMessage','../client'];(function(_0x4281e6,_0x5da03f){var _0x2afb4d=function(_0x331a96){while(--_0x331a96){_0x4281e6['push'](_0x4281e6['shift']());}};_0x2afb4d(++_0x5da03f);}(_0x0fca,0x116));var _0xa0fc=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x0fca[_0x199572];return _0x13cfa3;};'use strict';var client=require(_0xa0fc('0x0'));exports['create']=function(_0x52db70){return client[_0xa0fc('0x1')](_0xa0fc('0x2'),{'body':_0x52db70,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 35b2989..afffd56 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 _0x6aab=['mailPause','../client','Request','GetMailQueue','name','strategy','Agents','online'];(function(_0x144cc1,_0x3a1021){var _0x502af2=function(_0x2891cf){while(--_0x2891cf){_0x144cc1['push'](_0x144cc1['shift']());}};_0x502af2(++_0x3a1021);}(_0x6aab,0x139));var _0xb6aa=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x6aab[_0x1e4360];return _0x31e6b4;};'use strict';var client=require(_0xb6aa('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xb6aa('0x1')](_0xb6aa('0x2'),{'options':{'raw':![],'attributes':['id',_0xb6aa('0x3'),'timeout',_0xb6aa('0x4')],'include':[{'model':'User','as':_0xb6aa('0x5'),'attributes':['id',_0xb6aa('0x3'),_0xb6aa('0x6'),_0xb6aa('0x7')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x38b4=['Request','GetMailQueue','timeout','strategy','name','online','mailPause','../client','getMailQueues'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x38b4,0x181));var _0x438b=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x38b4[_0x34bf97];return _0x292719;};'use strict';var client=require(_0x438b('0x0'));exports[_0x438b('0x1')]=function(){return function(){return client[_0x438b('0x2')](_0x438b('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x438b('0x4'),_0x438b('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x438b('0x6'),_0x438b('0x7'),_0x438b('0x8')]}]},'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 61626c3..932809d 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 _0x0fa6=['../client','create','update','Request','UpdateMailQueueReport'];(function(_0x311a09,_0x350b49){var _0x4a4a4b=function(_0x2a9ff2){while(--_0x2a9ff2){_0x311a09['push'](_0x311a09['shift']());}};_0x4a4a4b(++_0x350b49);}(_0x0fa6,0x1b8));var _0x60fa=function(_0x31a768,_0x49f459){_0x31a768=_0x31a768-0x0;var _0x3cc7aa=_0x0fa6[_0x31a768];return _0x3cc7aa;};'use strict';var client=require(_0x60fa('0x0'));exports[_0x60fa('0x1')]=function(_0x10da8f){return client['Request']('CreateMailQueueReport',{'body':_0x10da8f,'log':'CreateMailQueueReport'});};exports[_0x60fa('0x2')]=function(_0x21d44f,_0x31fa66){return client[_0x60fa('0x3')](_0x60fa('0x4'),{'body':_0x31fa66,'options':{'where':{'uniqueid':_0x21d44f},'order':[['id','DESC']],'limit':0x1},'log':_0x60fa('0x4')});}; \ No newline at end of file +var _0x80b2=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x80b2,0x1c2));var _0x280b=function(_0x181981,_0x3bfa9a){_0x181981=_0x181981-0x0;var _0x5cd059=_0x80b2[_0x181981];return _0x5cd059;};'use strict';var client=require(_0x280b('0x0'));exports[_0x280b('0x1')]=function(_0x403949){return client[_0x280b('0x2')](_0x280b('0x3'),{'body':_0x403949,'log':_0x280b('0x3')});};exports[_0x280b('0x4')]=function(_0x1d55c5,_0x417dff){return client['Request'](_0x280b('0x5'),{'body':_0x417dff,'options':{'where':{'uniqueid':_0x1d55c5},'order':[['id','DESC']],'limit':0x1},'log':_0x280b('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 89dbfd4..06761f2 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 _0xe509=['updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','UpdateOpenchannelInteraction'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0xe509,0x1a2));var _0x9e50=function(_0x401676,_0x3f1436){_0x401676=_0x401676-0x0;var _0x4f13fe=_0xe509[_0x401676];return _0x4f13fe;};'use strict';var client=require('../client');exports[_0x9e50('0x0')]=function(_0x4afd64,_0x4af2d3){return client['Request'](_0x9e50('0x1'),{'body':_0x4af2d3,'options':{'where':{'id':_0x4afd64}},'log':_0x9e50('0x2')});};exports[_0x9e50('0x3')]=function(_0x3de04f,_0x353c9c){return client[_0x9e50('0x4')](_0x9e50('0x5'),{'body':_0x353c9c,'options':{'where':{'id':_0x3de04f}},'log':_0x9e50('0x6')});}; \ No newline at end of file +var _0x0eeb=['Request','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x501b6e,_0x526091){var _0x3756b9=function(_0x266021){while(--_0x266021){_0x501b6e['push'](_0x501b6e['shift']());}};_0x3756b9(++_0x526091);}(_0x0eeb,0x1f1));var _0xb0ee=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0eeb[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0xb0ee('0x0'));exports['update']=function(_0x2aef15,_0x5c13c1){return client[_0xb0ee('0x1')]('UpdateOpenchannelInteraction',{'body':_0x5c13c1,'options':{'where':{'id':_0x2aef15}},'log':_0xb0ee('0x2')});};exports[_0xb0ee('0x3')]=function(_0x114483,_0x4bc3b4){return client[_0xb0ee('0x1')](_0xb0ee('0x4'),{'body':_0x4bc3b4,'options':{'where':{'id':_0x114483}},'log':_0xb0ee('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index dd33801..60f3a1c 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 _0xb43b=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4791b7,_0x181642){_0x4791b7=_0x4791b7-0x0;var _0x2534cb=_0xb43b[_0x4791b7];return _0x2534cb;};'use strict';var client=require(_0xbb43('0x0'));exports[_0xbb43('0x1')]=function(_0x5c45dd){return client[_0xbb43('0x2')](_0xbb43('0x3'),{'body':_0x5c45dd,'log':_0xbb43('0x4')});}; \ No newline at end of file +var _0x0bb5=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0bb5,0x148));var _0x50bb=function(_0x33e415,_0x337c17){_0x33e415=_0x33e415-0x0;var _0x53900e=_0x0bb5[_0x33e415];return _0x53900e;};'use strict';var client=require(_0x50bb('0x0'));exports[_0x50bb('0x1')]=function(_0x5e61cf){return client['Request'](_0x50bb('0x2'),{'body':_0x5e61cf,'log':_0x50bb('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index dec6110..be4f002 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 _0xaa72=['openchannelPause','getOpenchannelQueues','Request','name','timeout','strategy','User','Agents','online'];(function(_0x555c17,_0x2e6c2a){var _0x15a073=function(_0x411a4f){while(--_0x411a4f){_0x555c17['push'](_0x555c17['shift']());}};_0x15a073(++_0x2e6c2a);}(_0xaa72,0x169));var _0x2aa7=function(_0x7f11ac,_0x23ad7e){_0x7f11ac=_0x7f11ac-0x0;var _0x555356=_0xaa72[_0x7f11ac];return _0x555356;};'use strict';var client=require('../client');exports[_0x2aa7('0x0')]=function(){return function(){return client[_0x2aa7('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x2aa7('0x2'),_0x2aa7('0x3'),_0x2aa7('0x4')],'include':[{'model':_0x2aa7('0x5'),'as':_0x2aa7('0x6'),'attributes':['id',_0x2aa7('0x2'),_0x2aa7('0x7'),_0x2aa7('0x8')]}]},'log':_0x2aa7('0x0')});};}; \ No newline at end of file +var _0x85f4=['Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x85f4,0xf3));var _0x485f=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x85f4[_0x4709c0];return _0x13348b;};'use strict';var client=require(_0x485f('0x0'));exports[_0x485f('0x1')]=function(){return function(){return client[_0x485f('0x2')](_0x485f('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x485f('0x4'),_0x485f('0x5')],'include':[{'model':_0x485f('0x6'),'as':_0x485f('0x7'),'attributes':['id','name',_0x485f('0x8'),_0x485f('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 579d989..c4fa0bb 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 _0x30d3=['UpdateOpenchannelQueueReport','DESC','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x4e5f5b,_0x468a08){var _0x3381a6=function(_0x3c5b44){while(--_0x3c5b44){_0x4e5f5b['push'](_0x4e5f5b['shift']());}};_0x3381a6(++_0x468a08);}(_0x30d3,0xe0));var _0x330d=function(_0x34a90a,_0x2bfe74){_0x34a90a=_0x34a90a-0x0;var _0x1edd88=_0x30d3[_0x34a90a];return _0x1edd88;};'use strict';var client=require('../client');exports[_0x330d('0x0')]=function(_0x50dd55){return client[_0x330d('0x1')](_0x330d('0x2'),{'body':_0x50dd55,'log':_0x330d('0x2')});};exports[_0x330d('0x3')]=function(_0x174e5f,_0x331746){return client['Request'](_0x330d('0x4'),{'body':_0x331746,'options':{'where':{'uniqueid':_0x174e5f},'order':[['id',_0x330d('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xe1e0=['UpdateOpenchannelQueueReport','DESC','../client','CreateOpenchannelQueueReport'];(function(_0x25efc1,_0x562953){var _0x2b55f1=function(_0x1cb20c){while(--_0x1cb20c){_0x25efc1['push'](_0x25efc1['shift']());}};_0x2b55f1(++_0x562953);}(_0xe1e0,0x1b2));var _0x0e1e=function(_0x1207cf,_0x2d1d49){_0x1207cf=_0x1207cf-0x0;var _0x116c44=_0xe1e0[_0x1207cf];return _0x116c44;};'use strict';var client=require(_0x0e1e('0x0'));exports['create']=function(_0x2b1e4f){return client['Request'](_0x0e1e('0x1'),{'body':_0x2b1e4f,'log':_0x0e1e('0x1')});};exports['update']=function(_0x33ada2,_0x27beec){return client['Request'](_0x0e1e('0x2'),{'body':_0x27beec,'options':{'where':{'uniqueid':_0x33ada2},'order':[['id',_0x0e1e('0x3')]],'limit':0x1},'log':_0x0e1e('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index adf23e4..dc89f5e 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 _0xbc3d=['UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction','../client','Request'];(function(_0x9ff51,_0x4c951f){var _0x31959b=function(_0x350371){while(--_0x350371){_0x9ff51['push'](_0x9ff51['shift']());}};_0x31959b(++_0x4c951f);}(_0xbc3d,0x178));var _0xdbc3=function(_0x51a6d6,_0x3c9c49){_0x51a6d6=_0x51a6d6-0x0;var _0x5ef1a8=_0xbc3d[_0x51a6d6];return _0x5ef1a8;};'use strict';var client=require(_0xdbc3('0x0'));exports['update']=function(_0x4c2bf2,_0xa36657){return client[_0xdbc3('0x1')](_0xdbc3('0x2'),{'body':_0xa36657,'options':{'where':{'id':_0x4c2bf2}},'log':_0xdbc3('0x3')});};exports[_0xdbc3('0x4')]=function(_0xfaf327,_0x50ef5e){return client[_0xdbc3('0x1')]('AddTagsToSmsInteraction',{'body':_0x50ef5e,'options':{'where':{'id':_0xfaf327}},'log':_0xdbc3('0x5')});}; \ No newline at end of file +var _0x2678=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update'];(function(_0x47b69f,_0x3f1696){var _0x56f392=function(_0x195f60){while(--_0x195f60){_0x47b69f['push'](_0x47b69f['shift']());}};_0x56f392(++_0x3f1696);}(_0x2678,0x1bb));var _0x8267=function(_0x364739,_0x4181a4){_0x364739=_0x364739-0x0;var _0x2a51bd=_0x2678[_0x364739];return _0x2a51bd;};'use strict';var client=require('../client');exports[_0x8267('0x0')]=function(_0x14a078,_0x25b9dc){return client['Request']('UpdateSmsInteraction',{'body':_0x25b9dc,'options':{'where':{'id':_0x14a078}},'log':'updateSmsInteraction'});};exports[_0x8267('0x1')]=function(_0x30fa94,_0x1f1d79){return client['Request'](_0x8267('0x2'),{'body':_0x1f1d79,'options':{'where':{'id':_0x30fa94}},'log':_0x8267('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 62602a0..0897749 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 _0xd1e4=['createSmsMessage','../client','Request','CreateSmsMessage'];(function(_0x46bf6c,_0x5bc167){var _0x230915=function(_0xb40e95){while(--_0xb40e95){_0x46bf6c['push'](_0x46bf6c['shift']());}};_0x230915(++_0x5bc167);}(_0xd1e4,0xc5));var _0x4d1e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xd1e4[_0x11005e];return _0x29338f;};'use strict';var client=require(_0x4d1e('0x0'));exports['create']=function(_0x2ae935){return client[_0x4d1e('0x1')](_0x4d1e('0x2'),{'body':_0x2ae935,'log':_0x4d1e('0x3')});}; \ No newline at end of file +var _0x170f=['CreateSmsMessage','../client','create','Request'];(function(_0x340c13,_0x595d66){var _0x5a7d96=function(_0x250118){while(--_0x250118){_0x340c13['push'](_0x340c13['shift']());}};_0x5a7d96(++_0x595d66);}(_0x170f,0x65));var _0xf170=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0x170f[_0x2a5099];return _0x2802f1;};'use strict';var client=require(_0xf170('0x0'));exports[_0xf170('0x1')]=function(_0x43c655){return client[_0xf170('0x2')](_0xf170('0x3'),{'body':_0x43c655,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 87c80f5..a3f6680 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 _0xec28=['../client','getSmsQueues','GetSmsQueue','name','timeout','strategy','User','Agents','online','smsPause'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xec28,0x14a));var _0x8ec2=function(_0x403db1,_0x59018e){_0x403db1=_0x403db1-0x0;var _0x47c48f=_0xec28[_0x403db1];return _0x47c48f;};'use strict';var client=require(_0x8ec2('0x0'));exports[_0x8ec2('0x1')]=function(){return function(){return client['Request'](_0x8ec2('0x2'),{'options':{'raw':![],'attributes':['id',_0x8ec2('0x3'),_0x8ec2('0x4'),_0x8ec2('0x5')],'include':[{'model':_0x8ec2('0x6'),'as':_0x8ec2('0x7'),'attributes':['id',_0x8ec2('0x3'),_0x8ec2('0x8'),_0x8ec2('0x9')]}]},'log':_0x8ec2('0x1')});};}; \ No newline at end of file +var _0x531f=['Agents','smsPause','../client','getSmsQueues','Request','GetSmsQueue','name','timeout','User'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x531f,0x16a));var _0xf531=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x531f[_0x4bb145];return _0x4db596;};'use strict';var client=require(_0xf531('0x0'));exports[_0xf531('0x1')]=function(){return function(){return client[_0xf531('0x2')](_0xf531('0x3'),{'options':{'raw':![],'attributes':['id',_0xf531('0x4'),_0xf531('0x5'),'strategy'],'include':[{'model':_0xf531('0x6'),'as':_0xf531('0x7'),'attributes':['id','name','online',_0xf531('0x8')]}]},'log':_0xf531('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index ab35257..aaf8c19 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 _0xbf1c=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','create','Request'];(function(_0x143e52,_0x3710a1){var _0x2ca733=function(_0x254d03){while(--_0x254d03){_0x143e52['push'](_0x143e52['shift']());}};_0x2ca733(++_0x3710a1);}(_0xbf1c,0x1a1));var _0xcbf1=function(_0x13a365,_0x1d4c33){_0x13a365=_0x13a365-0x0;var _0x414fb4=_0xbf1c[_0x13a365];return _0x414fb4;};'use strict';var client=require(_0xcbf1('0x0'));exports[_0xcbf1('0x1')]=function(_0x3f7c5b){return client[_0xcbf1('0x2')](_0xcbf1('0x3'),{'body':_0x3f7c5b,'log':_0xcbf1('0x3')});};exports['update']=function(_0x558587,_0x1d2021){return client[_0xcbf1('0x2')](_0xcbf1('0x4'),{'body':_0x1d2021,'options':{'where':{'uniqueid':_0x558587},'order':[['id',_0xcbf1('0x5')]],'limit':0x1},'log':_0xcbf1('0x4')});}; \ No newline at end of file +var _0x2edc=['DESC','../client','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x1e9b87,_0x3dbea4){var _0x5e801a=function(_0x5cc15e){while(--_0x5cc15e){_0x1e9b87['push'](_0x1e9b87['shift']());}};_0x5e801a(++_0x3dbea4);}(_0x2edc,0x1d5));var _0xc2ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2edc[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc2ed('0x0'));exports['create']=function(_0xbc6d78){return client[_0xc2ed('0x1')](_0xc2ed('0x2'),{'body':_0xbc6d78,'log':'CreateSmsQueueReport'});};exports[_0xc2ed('0x3')]=function(_0x5f09f7,_0x44ca1a){return client[_0xc2ed('0x1')](_0xc2ed('0x4'),{'body':_0x44ca1a,'options':{'where':{'uniqueid':_0x5f09f7},'order':[['id',_0xc2ed('0x5')]],'limit':0x1},'log':_0xc2ed('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 81943a9..590c34b 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 _0xd54b=['chatPause','faxPause','smsPause','chatCapacity','mailCapacity','faxCapacity','whatsappCapacity','getAgents','Request','GetUser','agent','name','online','pauseType','lastPauseAt'];(function(_0x4ef47d,_0x6a80d2){var _0xe56090=function(_0x3a701e){while(--_0x3a701e){_0x4ef47d['push'](_0x4ef47d['shift']());}};_0xe56090(++_0x6a80d2);}(_0xd54b,0xd9));var _0xbd54=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd54b[_0xfae23b];return _0x200640;};'use strict';var client=require('../client');exports[_0xbd54('0x0')]=function(){return function(){return client[_0xbd54('0x1')](_0xbd54('0x2'),{'options':{'raw':!![],'where':{'role':_0xbd54('0x3')},'attributes':['id',_0xbd54('0x4'),_0xbd54('0x5'),_0xbd54('0x6'),_0xbd54('0x7'),'voicePause',_0xbd54('0x8'),'mailPause',_0xbd54('0x9'),_0xbd54('0xa'),'whatsappPause','openchannelPause',_0xbd54('0xb'),_0xbd54('0xc'),_0xbd54('0xd'),'smsCapacity',_0xbd54('0xe'),'openchannelCapacity']},'log':_0xbd54('0x0')});};}; \ No newline at end of file +var _0xab75=['../client','getAgents','GetUser','agent','name','voicePause','chatPause','mailPause','faxPause','smsPause','smsCapacity','whatsappCapacity'];(function(_0x2ff876,_0x3fbaad){var _0x115882=function(_0xf961ff){while(--_0xf961ff){_0x2ff876['push'](_0x2ff876['shift']());}};_0x115882(++_0x3fbaad);}(_0xab75,0x1c8));var _0x5ab7=function(_0x89498d,_0x5c5d93){_0x89498d=_0x89498d-0x0;var _0x36197b=_0xab75[_0x89498d];return _0x36197b;};'use strict';var client=require(_0x5ab7('0x0'));exports[_0x5ab7('0x1')]=function(){return function(){return client['Request'](_0x5ab7('0x2'),{'options':{'raw':!![],'where':{'role':_0x5ab7('0x3')},'attributes':['id',_0x5ab7('0x4'),'online','pauseType','lastPauseAt',_0x5ab7('0x5'),_0x5ab7('0x6'),_0x5ab7('0x7'),_0x5ab7('0x8'),_0x5ab7('0x9'),'whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity',_0x5ab7('0xa'),_0x5ab7('0xb'),'openchannelCapacity']},'log':_0x5ab7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 5041e12..37aa020 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 _0x7333=['updateWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction'];(function(_0x1aaf79,_0x298f15){var _0x12e371=function(_0x245a49){while(--_0x245a49){_0x1aaf79['push'](_0x1aaf79['shift']());}};_0x12e371(++_0x298f15);}(_0x7333,0xfc));var _0x3733=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7333[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x3733('0x0'));exports['update']=function(_0x42c214,_0x51cf3a){return client[_0x3733('0x1')](_0x3733('0x2'),{'body':_0x51cf3a,'options':{'where':{'id':_0x42c214}},'log':_0x3733('0x3')});};exports['addTags']=function(_0x1bf202,_0x3959ac){return client[_0x3733('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x3959ac,'options':{'where':{'id':_0x1bf202}},'log':_0x3733('0x4')});}; \ No newline at end of file +var _0x057a=['updateWhatsappInteraction','addTags','../client','update','Request'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x057a,0x1a6));var _0xa057=function(_0x5193aa,_0xbaf0ed){_0x5193aa=_0x5193aa-0x0;var _0x8c52c5=_0x057a[_0x5193aa];return _0x8c52c5;};'use strict';var client=require(_0xa057('0x0'));exports[_0xa057('0x1')]=function(_0x32f0b5,_0x50bfcd){return client[_0xa057('0x2')]('UpdateWhatsappInteraction',{'body':_0x50bfcd,'options':{'where':{'id':_0x32f0b5}},'log':_0xa057('0x3')});};exports[_0xa057('0x4')]=function(_0x5481b7,_0x2320cf){return client[_0xa057('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x2320cf,'options':{'where':{'id':_0x5481b7}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index eb5b699..b9b1b4d 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 _0x4a74=['CreateWhatsappMessage','../client','create','Request'];(function(_0x283338,_0x23dd83){var _0x454920=function(_0x3a1977){while(--_0x3a1977){_0x283338['push'](_0x283338['shift']());}};_0x454920(++_0x23dd83);}(_0x4a74,0x141));var _0x44a7=function(_0x2cb57f,_0x46fc52){_0x2cb57f=_0x2cb57f-0x0;var _0x403aee=_0x4a74[_0x2cb57f];return _0x403aee;};'use strict';var client=require(_0x44a7('0x0'));exports[_0x44a7('0x1')]=function(_0x2979d4){return client[_0x44a7('0x2')](_0x44a7('0x3'),{'body':_0x2979d4,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x0ed0=['../client','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x408735,_0x32e450){var _0x2a867b=function(_0x5f4ba9){while(--_0x5f4ba9){_0x408735['push'](_0x408735['shift']());}};_0x2a867b(++_0x32e450);}(_0x0ed0,0xed));var _0x00ed=function(_0x2be4c1,_0x51b618){_0x2be4c1=_0x2be4c1-0x0;var _0x213efd=_0x0ed0[_0x2be4c1];return _0x213efd;};'use strict';var client=require(_0x00ed('0x0'));exports['create']=function(_0x435c8a){return client['Request'](_0x00ed('0x1'),{'body':_0x435c8a,'log':_0x00ed('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 25380a5..66bcd9b 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 _0x693f=['name','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy','User','Agents'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x693f,0x9d));var _0xf693=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x693f[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xf693('0x0'));exports[_0xf693('0x1')]=function(){return function(){return client[_0xf693('0x2')](_0xf693('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xf693('0x4'),_0xf693('0x5')],'include':[{'model':_0xf693('0x6'),'as':_0xf693('0x7'),'attributes':['id',_0xf693('0x8'),_0xf693('0x9'),_0xf693('0xa')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x55f1=['Agents','whatsappPause','../client','Request','GetWhatsappQueue','name','timeout','strategy','User'];(function(_0x10b4b6,_0x27ca42){var _0x44d9d8=function(_0x4b6417){while(--_0x4b6417){_0x10b4b6['push'](_0x10b4b6['shift']());}};_0x44d9d8(++_0x27ca42);}(_0x55f1,0x9b));var _0x155f=function(_0x28be74,_0x4b822d){_0x28be74=_0x28be74-0x0;var _0x272e0b=_0x55f1[_0x28be74];return _0x272e0b;};'use strict';var client=require(_0x155f('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x155f('0x1')](_0x155f('0x2'),{'options':{'raw':![],'attributes':['id',_0x155f('0x3'),_0x155f('0x4'),_0x155f('0x5')],'include':[{'model':_0x155f('0x6'),'as':_0x155f('0x7'),'attributes':['id','name','online',_0x155f('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 02351d0..682eac3 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 _0x4add=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x3c7690,_0x13c948){var _0x2e669f=function(_0x5bb4bd){while(--_0x5bb4bd){_0x3c7690['push'](_0x3c7690['shift']());}};_0x2e669f(++_0x13c948);}(_0x4add,0x150));var _0xd4ad=function(_0x387ae5,_0x5b8f09){_0x387ae5=_0x387ae5-0x0;var _0x11b888=_0x4add[_0x387ae5];return _0x11b888;};'use strict';var client=require(_0xd4ad('0x0'));exports[_0xd4ad('0x1')]=function(_0x24ba09){return client[_0xd4ad('0x2')](_0xd4ad('0x3'),{'body':_0x24ba09,'log':_0xd4ad('0x3')});};exports[_0xd4ad('0x4')]=function(_0x3941d1,_0xd6594){return client[_0xd4ad('0x2')](_0xd4ad('0x5'),{'body':_0xd6594,'options':{'where':{'uniqueid':_0x3941d1},'order':[['id',_0xd4ad('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x39b8=['Request','DESC','UpdateWhatsappQueueReport','../client','create','CreateWhatsappQueueReport','update'];(function(_0x57ce90,_0x519e42){var _0x562661=function(_0x5b5a0f){while(--_0x5b5a0f){_0x57ce90['push'](_0x57ce90['shift']());}};_0x562661(++_0x519e42);}(_0x39b8,0x18b));var _0x839b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x39b8[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x839b('0x0'));exports[_0x839b('0x1')]=function(_0x59cc87){return client['Request'](_0x839b('0x2'),{'body':_0x59cc87,'log':_0x839b('0x2')});};exports[_0x839b('0x3')]=function(_0x4fc292,_0x364def){return client[_0x839b('0x4')]('UpdateWhatsappQueueReport',{'body':_0x364def,'options':{'where':{'uniqueid':_0x4fc292},'order':[['id',_0x839b('0x5')]],'limit':0x1},'log':_0x839b('0x6')});}; \ 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 bfb1843..5559243 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 _0x303a=['name','log','stack','validate','util','seq-queue','../../../../config/logger','routing','./strategy','string','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence','error','map','message','join','stop','find','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x80d733,_0x266211){var _0x435868=function(_0x2ae0f0){while(--_0x2ae0f0){_0x80d733['push'](_0x80d733['shift']());}};_0x435868(++_0x266211);}(_0x303a,0xa3));var _0xa303=function(_0x5788f3,_0x275670){_0x5788f3=_0x5788f3-0x0;var _0x4f1d41=_0x303a[_0x5788f3];return _0x4f1d41;};'use strict';var schema=require(_0xa303('0x0'));var _=require('lodash');var util=require(_0xa303('0x1'));var seqqueue=require(_0xa303('0x2'));var logger=require(_0xa303('0x3'))(_0xa303('0x4'));var strategy=require(_0xa303('0x5'));var queue=schema({'name':{'type':_0xa303('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xa303('0x7')}});function writeLog(_0x3c23c0,_0x33d202,_0x581d76){return logger[_0xa303('0x8')](util[_0xa303('0x9')](_0xa303('0xa'),_0x3c23c0,_0x33d202['name'],_0x581d76));}function handleFindAgent(_0x267be6){return function(_0x29ef14){return _0x29ef14['name'][_0xa303('0xb')]()===_0x267be6[_0xa303('0xb')]();};}exports[_0xa303('0xc')]=function(_0x167ab9,_0x3be6a3,_0x467c95,_0x17a7d9){return function(_0x204ee7){try{var _0x2377b6={'name':_0x3be6a3[0x0],'timeout':_0x3be6a3[0x1]};var _0x2061e6=queue[_0xa303('0x0')](_0x2377b6,{'typecast':!![]});if(_0x2061e6['length']){logger[_0xa303('0xd')]('[%s][AGENT]\x20%s',_0x167ab9,_[_0xa303('0xe')](_0x2061e6,_0xa303('0xf'))[_0xa303('0x10')](',\x20'));_0x204ee7[_0xa303('0x11')]();}else{var _0x38e9e3=_[_0xa303('0x12')](_0x467c95['agents'],handleFindAgent(_0x2377b6['name']));if(_0x38e9e3){var _0x1abb91=(_0x2377b6['timeout']||0xa)*0x3e8;var _0x362598,_0x4c3e97;var _0x291e88=seqqueue['createQueue'](_0x1abb91);_0x291e88['id']=_0x167ab9;_0x291e88[_0xa303('0x13')]=_0x1abb91;_0x291e88['channel']=_0x17a7d9[_0xa303('0x14')];writeLog(_0x167ab9,_0x38e9e3,util['format'](_0xa303('0x15'),_0x1abb91));_0x467c95[_0xa303('0x16')][_0x167ab9]['on'](_0xa303('0x17'),function(){logger[_0xa303('0x8')](_0xa303('0x18'),_0x167ab9);clearTimeout(_0x4c3e97);_0x4c3e97=undefined;_0x291e88[_0xa303('0x19')]();if(_0x467c95[_0xa303('0x16')][_0x167ab9]){delete _0x467c95[_0xa303('0x16')][_0x167ab9];}_0x204ee7[_0xa303('0x11')]();});_0x467c95[_0xa303('0x16')][_0x167ab9]['on']('complete',function(){if(_0x467c95[_0xa303('0x16')][_0x167ab9]){delete _0x467c95[_0xa303('0x16')][_0x167ab9];}});_0x4c3e97=setTimeout(function(){logger[_0xa303('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x167ab9);clearTimeout(_0x4c3e97);_0x291e88[_0xa303('0x19')]();_0x204ee7[_0xa303('0x1a')]();},_0x1abb91);strategy[_0xa303('0x1b')](_0x291e88,_0x38e9e3,_0x467c95,_0x17a7d9);}else{logger[_0xa303('0xd')](_0xa303('0x1c'),_0x167ab9,_0x2377b6[_0xa303('0x1d')]);_0x204ee7[_0xa303('0x11')]();}}}catch(_0x5bbc50){console[_0xa303('0x1e')](_0x5bbc50);logger[_0xa303('0xd')]('[%s][QUEUE]\x20%s',_0x167ab9,_0x5bbc50[_0xa303('0x1f')]);_0x204ee7[_0xa303('0x11')]();}};}; \ No newline at end of file +var _0x1e18=['lodash','util','seq-queue','../../../../config/logger','routing','./strategy','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','length','error','map','message','join','find','agents','timeout','createQueue','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate'];(function(_0x26c4b8,_0x4e4ef7){var _0x543a20=function(_0x1a8e22){while(--_0x1a8e22){_0x26c4b8['push'](_0x26c4b8['shift']());}};_0x543a20(++_0x4e4ef7);}(_0x1e18,0x1b1));var _0x81e1=function(_0xccdde3,_0x4786bb){_0xccdde3=_0xccdde3-0x0;var _0x3e3a29=_0x1e18[_0xccdde3];return _0x3e3a29;};'use strict';var schema=require(_0x81e1('0x0'));var _=require(_0x81e1('0x1'));var util=require(_0x81e1('0x2'));var seqqueue=require(_0x81e1('0x3'));var logger=require(_0x81e1('0x4'))(_0x81e1('0x5'));var strategy=require(_0x81e1('0x6'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x81e1('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x22369d,_0x5e560d,_0x31eb0d){return logger[_0x81e1('0x8')](util[_0x81e1('0x9')](_0x81e1('0xa'),_0x22369d,_0x5e560d[_0x81e1('0xb')],_0x31eb0d));}function handleFindAgent(_0xc0c8f){return function(_0x3a565c){return _0x3a565c['name']['toLowerCase']()===_0xc0c8f['toLowerCase']();};}exports['consequence']=function(_0x2e0ff5,_0x4e5d86,_0x4aa4aa,_0x56358f){return function(_0x2a01dc){try{var _0x2af651={'name':_0x4e5d86[0x0],'timeout':_0x4e5d86[0x1]};var _0x44f6d1=queue[_0x81e1('0x0')](_0x2af651,{'typecast':!![]});if(_0x44f6d1[_0x81e1('0xc')]){logger[_0x81e1('0xd')]('[%s][AGENT]\x20%s',_0x2e0ff5,_[_0x81e1('0xe')](_0x44f6d1,_0x81e1('0xf'))[_0x81e1('0x10')](',\x20'));_0x2a01dc['stop']();}else{var _0x11fe02=_[_0x81e1('0x11')](_0x4aa4aa[_0x81e1('0x12')],handleFindAgent(_0x2af651[_0x81e1('0xb')]));if(_0x11fe02){var _0x88f5de=(_0x2af651[_0x81e1('0x13')]||0xa)*0x3e8;var _0x391eea,_0x3c1a53;var _0x5b7c69=seqqueue[_0x81e1('0x14')](_0x88f5de);_0x5b7c69['id']=_0x2e0ff5;_0x5b7c69['atimeout']=_0x88f5de;_0x5b7c69[_0x81e1('0x15')]=_0x56358f[_0x81e1('0x15')];writeLog(_0x2e0ff5,_0x11fe02,util['format']('START:%s',_0x88f5de));_0x4aa4aa[_0x81e1('0x16')][_0x2e0ff5]['on'](_0x81e1('0x17'),function(){logger['info'](_0x81e1('0x18'),_0x2e0ff5);clearTimeout(_0x3c1a53);_0x3c1a53=undefined;_0x5b7c69[_0x81e1('0x19')]();if(_0x4aa4aa[_0x81e1('0x16')][_0x2e0ff5]){delete _0x4aa4aa[_0x81e1('0x16')][_0x2e0ff5];}_0x2a01dc[_0x81e1('0x1a')]();});_0x4aa4aa['rules'][_0x2e0ff5]['on']('complete',function(){if(_0x4aa4aa[_0x81e1('0x16')][_0x2e0ff5]){delete _0x4aa4aa[_0x81e1('0x16')][_0x2e0ff5];}});_0x3c1a53=setTimeout(function(){logger['info'](_0x81e1('0x1b'),_0x2e0ff5);clearTimeout(_0x3c1a53);_0x5b7c69[_0x81e1('0x19')]();_0x2a01dc[_0x81e1('0x1c')]();},_0x88f5de);strategy['agent'](_0x5b7c69,_0x11fe02,_0x4aa4aa,_0x56358f);}else{logger[_0x81e1('0xd')](_0x81e1('0x1d'),_0x2e0ff5,_0x2af651[_0x81e1('0xb')]);_0x2a01dc[_0x81e1('0x1a')]();}}}catch(_0x3322d7){console['log'](_0x3322d7);logger[_0x81e1('0xd')](_0x81e1('0x1e'),_0x2e0ff5,_0x3322d7['stack']);_0x2a01dc[_0x81e1('0x1a')]();}};}; \ 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 7e32e73..ccb5c71 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 _0xbc51=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','getMustacheRender','Message','create','then','body','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','$LATEST','message','postText','next','amazonlex','providerResponse','dialogState','catch','moment','aws-sdk','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xbc51,0x1a1));var _0x1bc5=function(_0x1d8119,_0xc98f17){_0x1d8119=_0x1d8119-0x0;var _0x3e30f6=_0xbc51[_0x1d8119];return _0x3e30f6;};'use strict';var _=require('lodash');var moment=require(_0x1bc5('0x0'));var AWS=require(_0x1bc5('0x1'));var utils=require('./utils');var logger=require(_0x1bc5('0x2'))('routing');var rpc={'chatMessage':require(_0x1bc5('0x3')),'openchannelMessage':require(_0x1bc5('0x4')),'mailMessage':require(_0x1bc5('0x5')),'smsMessage':require(_0x1bc5('0x6')),'faxMessage':require(_0x1bc5('0x7')),'whatsappMessage':require(_0x1bc5('0x8'))};exports[_0x1bc5('0x9')]=function(_0x20fdbb,_0x3512d8){return function(_0x29a8ca){try{if(!_[_0x1bc5('0xa')](this[_0x1bc5('0xb')][_0x1bc5('0xc')])){logger[_0x1bc5('0xd')](_0x1bc5('0xe'),_0x20fdbb,_0x1bc5('0xf'));return _0x29a8ca['next']();}var _0x26a0f9={'ContactId':this[_0x1bc5('0x10')]['id'],'sentAt':moment()[_0x1bc5('0x11')](_0x1bc5('0x12')),'direction':_0x1bc5('0x13')};if(this[_0x1bc5('0x14')]===_0x1bc5('0x15')||this[_0x1bc5('0x14')]===_0x1bc5('0x16')){_0x26a0f9[_0x1bc5('0x17')]=this['interaction'][_0x1bc5('0x17')];}var _0x3bc982=this[_0x1bc5('0x14')];if(_0x3bc982===_0x1bc5('0x18')){_0x26a0f9[_0x1bc5('0x19')]=this[_0x1bc5('0x1a')]['id'];}else{_0x26a0f9[_[_0x1bc5('0x1b')](_0x3bc982)+_0x1bc5('0x1c')]=this[_0x1bc5('0x1a')]['id'];}_0x26a0f9[_[_0x1bc5('0x1b')](_0x3bc982)+'InteractionId']=this[_0x1bc5('0xb')]['id'];if(this[_0x1bc5('0xb')][_0x1bc5('0x1d')]){var _0x5a25d5=_0x3512d8[0x4];if(!_['isEmpty'](_0x5a25d5)){_0x26a0f9['body']=utils[_0x1bc5('0x1e')](_0x5a25d5,this);return rpc[_0x3bc982+_0x1bc5('0x1f')][_0x1bc5('0x20')](_0x26a0f9)[_0x1bc5('0x21')](function(_0x2595e6){logger[_0x1bc5('0xd')](_0x1bc5('0xe'),_0x20fdbb,_0x26a0f9[_0x1bc5('0x22')]);})['catch'](function(_0x102be3){logger[_0x1bc5('0x23')](_0x1bc5('0xe'),_0x20fdbb,JSON[_0x1bc5('0x24')](_0x102be3));})['finally'](function(){logger['info'](_0x1bc5('0x25'),_0x20fdbb);_0x29a8ca[_0x1bc5('0x26')]();});}else{logger[_0x1bc5('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x20fdbb);_0x29a8ca[_0x1bc5('0x26')]();}}else{var _0x449656=this;var _0x2acf1b=new AWS['LexRuntime']({'accessKeyId':_0x3512d8[0x0],'secretAccessKey':_0x3512d8[0x1],'region':_0x3512d8[0x2]});var _0x42fcb0={'botAlias':_0x1bc5('0x27'),'botName':_0x3512d8[0x3],'inputText':this[_0x1bc5('0x28')][_0x1bc5('0x22')],'userId':this[_0x1bc5('0x14')]+':'+this[_0x1bc5('0xb')]['id']['toString']()};_0x2acf1b[_0x1bc5('0x29')](_0x42fcb0,function(_0xff485,_0x4531de){if(_0xff485){logger[_0x1bc5('0x23')]('[%s][AMAZONLEX]\x20%s',_0x20fdbb,_0xff485[_0x1bc5('0x28')]);_0x29a8ca[_0x1bc5('0x2a')]();}else if(_0x4531de&&_0x4531de[_0x1bc5('0x28')]){_0x449656['body'][_0x1bc5('0x2b')]=_0x4531de;_0x26a0f9[_0x1bc5('0x22')]=_0x4531de[_0x1bc5('0x28')];_0x26a0f9['providerName']=_0x1bc5('0x2b');_0x26a0f9[_0x1bc5('0x2c')]=JSON[_0x1bc5('0x24')](_0x4531de);return rpc[_0x3bc982+'Message'][_0x1bc5('0x20')](_0x26a0f9)[_0x1bc5('0x21')](function(_0x3fca37){logger[_0x1bc5('0xd')]('[%s][AMAZONLEX]\x20%s',_0x20fdbb,_0x26a0f9['body']);if(_0x4531de[_0x1bc5('0x2d')]=='Failed'){_0x29a8ca[_0x1bc5('0x2a')]();}else{_0x29a8ca['stop']();}})[_0x1bc5('0x2e')](function(_0x5f199a){logger[_0x1bc5('0x23')](_0x1bc5('0xe'),_0x20fdbb,JSON[_0x1bc5('0x24')](_0x5f199a));_0x29a8ca[_0x1bc5('0x2a')]();});}else{_0x29a8ca[_0x1bc5('0x2a')]();}});}}catch(_0x342a0a){logger[_0x1bc5('0x23')](_0x1bc5('0xe'),_0x20fdbb,JSON[_0x1bc5('0x24')](_0x342a0a));_0x29a8ca['stop']();}};}; \ No newline at end of file +var _0xd92f=['next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','Message','then','info','catch','error','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','toString','amazonlex','message','providerName','stringify','create','dialogState','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd92f,0x7c));var _0xfd92=function(_0x380cda,_0x3ed2e6){_0x380cda=_0x380cda-0x0;var _0x44ebb5=_0xd92f[_0x380cda];return _0x44ebb5;};'use strict';var _=require(_0xfd92('0x0'));var moment=require(_0xfd92('0x1'));var AWS=require(_0xfd92('0x2'));var utils=require(_0xfd92('0x3'));var logger=require('../../../../config/logger')(_0xfd92('0x4'));var rpc={'chatMessage':require(_0xfd92('0x5')),'openchannelMessage':require(_0xfd92('0x6')),'mailMessage':require(_0xfd92('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xfd92('0x8')),'whatsappMessage':require(_0xfd92('0x9'))};exports['consequence']=function(_0x49e171,_0x13139f){return function(_0x1c1d43){try{if(!_[_0xfd92('0xa')](this[_0xfd92('0xb')][_0xfd92('0xc')])){logger['info'](_0xfd92('0xd'),_0x49e171,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1c1d43[_0xfd92('0xe')]();}var _0x3a77e3={'ContactId':this['contact']['id'],'sentAt':moment()[_0xfd92('0xf')](_0xfd92('0x10')),'direction':_0xfd92('0x11')};if(this['channel']==='sms'||this[_0xfd92('0x12')]===_0xfd92('0x13')){_0x3a77e3[_0xfd92('0x14')]=this['interaction'][_0xfd92('0x14')];}var _0x384621=this[_0xfd92('0x12')];if(_0x384621==='chat'){_0x3a77e3[_0xfd92('0x15')]=this[_0xfd92('0x16')]['id'];}else{_0x3a77e3[_[_0xfd92('0x17')](_0x384621)+_0xfd92('0x18')]=this[_0xfd92('0x16')]['id'];}_0x3a77e3[_[_0xfd92('0x17')](_0x384621)+_0xfd92('0x19')]=this[_0xfd92('0xb')]['id'];if(this['interaction'][_0xfd92('0x1a')]){var _0x209157=_0x13139f[0x4];if(!_['isEmpty'](_0x209157)){_0x3a77e3[_0xfd92('0x1b')]=utils[_0xfd92('0x1c')](_0x209157,this);return rpc[_0x384621+_0xfd92('0x1d')]['create'](_0x3a77e3)[_0xfd92('0x1e')](function(_0x1111f0){logger[_0xfd92('0x1f')](_0xfd92('0xd'),_0x49e171,_0x3a77e3['body']);})[_0xfd92('0x20')](function(_0xfaaf35){logger[_0xfd92('0x21')](_0xfd92('0xd'),_0x49e171,JSON['stringify'](_0xfaaf35));})[_0xfd92('0x22')](function(){logger[_0xfd92('0x1f')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x49e171);_0x1c1d43[_0xfd92('0x23')]();});}else{logger[_0xfd92('0x1f')](_0xfd92('0x24'),_0x49e171);_0x1c1d43[_0xfd92('0x23')]();}}else{var _0x452162=this;var _0x4af4da=new AWS[(_0xfd92('0x25'))]({'accessKeyId':_0x13139f[0x0],'secretAccessKey':_0x13139f[0x1],'region':_0x13139f[0x2]});var _0x57b1af={'botAlias':'$LATEST','botName':_0x13139f[0x3],'inputText':this['message'][_0xfd92('0x1b')],'userId':this[_0xfd92('0x12')]+':'+this[_0xfd92('0xb')]['id'][_0xfd92('0x26')]()};_0x4af4da['postText'](_0x57b1af,function(_0x3a9abb,_0x134031){if(_0x3a9abb){logger[_0xfd92('0x21')](_0xfd92('0xd'),_0x49e171,_0x3a9abb['message']);_0x1c1d43[_0xfd92('0xe')]();}else if(_0x134031&&_0x134031['message']){_0x452162['body'][_0xfd92('0x27')]=_0x134031;_0x3a77e3[_0xfd92('0x1b')]=_0x134031[_0xfd92('0x28')];_0x3a77e3[_0xfd92('0x29')]=_0xfd92('0x27');_0x3a77e3['providerResponse']=JSON[_0xfd92('0x2a')](_0x134031);return rpc[_0x384621+_0xfd92('0x1d')][_0xfd92('0x2b')](_0x3a77e3)['then'](function(_0x338892){logger['info'](_0xfd92('0xd'),_0x49e171,_0x3a77e3[_0xfd92('0x1b')]);if(_0x134031[_0xfd92('0x2c')]==_0xfd92('0x2d')){_0x1c1d43[_0xfd92('0xe')]();}else{_0x1c1d43[_0xfd92('0x23')]();}})[_0xfd92('0x20')](function(_0x4a1226){logger[_0xfd92('0x21')](_0xfd92('0xd'),_0x49e171,JSON[_0xfd92('0x2a')](_0x4a1226));_0x1c1d43[_0xfd92('0xe')]();});}else{_0x1c1d43['next']();}});}}catch(_0x3422d4){logger['error'](_0xfd92('0xd'),_0x49e171,JSON[_0xfd92('0x2a')](_0x3422d4));_0x1c1d43[_0xfd92('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 6eda931..52226e3 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 _0xa9c7=['Smtp','service','host','port','secure','auth','user','pass','inReplyTo','html','','replace','','headers','auto-replied','All','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','next','catch','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../mailRpc','consequence','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','contact','format','out','mail','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','account','InteractionId','Message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9c7,0x148));var _0x7a9c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa9c7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7a9c('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0x7a9c('0x1'))('routing');var rpc={'chatMessage':require(_0x7a9c('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x7a9c('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};var mailRpc=require(_0x7a9c('0x4'));exports[_0x7a9c('0x5')]=function(_0x150e60,_0x30e3f8){return function(_0x3a0458){try{if(_0x30e3f8[0x0]==='1'&&(_[_0x7a9c('0x6')](this[_0x7a9c('0x7')][_0x7a9c('0x8')])||!this[_0x7a9c('0x7')]['created'])){logger['info'](_0x7a9c('0x9'),_0x150e60,_0x7a9c('0xa'));return _0x3a0458['next']();}var _0x5c6834=this[_0x7a9c('0xb')];var _0x128d17={'ContactId':this[_0x7a9c('0xc')]['id'],'sentAt':moment()[_0x7a9c('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x7a9c('0xe')};if(this[_0x7a9c('0xb')]===_0x7a9c('0xf')){_0x128d17[_0x7a9c('0x10')]=utils[_0x7a9c('0x11')](_0x30e3f8[0x2],this);}else{_0x128d17[_0x7a9c('0x10')]=utils[_0x7a9c('0x11')](_0x30e3f8[0x1],this);}if(this[_0x7a9c('0x12')]){_0x128d17['to']=this['message'][_0x7a9c('0x13')]||'';if(this[_0x7a9c('0xb')]===_0x7a9c('0xf')&&_0x30e3f8[0x1]==='1'){_0x128d17['cc']=this['message']['cc']||'';}_0x128d17[_0x7a9c('0x13')]=this[_0x7a9c('0x12')]['to']||'';_0x128d17[_0x7a9c('0x14')]=this[_0x7a9c('0x12')][_0x7a9c('0x14')]||'';_0x128d17[_0x7a9c('0x15')]=!![];if(this[_0x7a9c('0x12')][_0x7a9c('0x16')]){_0x128d17[_0x7a9c('0x16')]='';_0x128d17[_0x7a9c('0x16')]+=_[_0x7a9c('0x17')](this[_0x7a9c('0x12')][_0x7a9c('0x16')],_0x7a9c('0x18'))?'':_0x7a9c('0x19');_0x128d17['subject']+=this[_0x7a9c('0x12')][_0x7a9c('0x16')];}}if(this[_0x7a9c('0xb')]===_0x7a9c('0x1a')){_0x128d17[_0x7a9c('0x1b')]=this['account']['id'];}else{_0x128d17[_[_0x7a9c('0x1c')](this[_0x7a9c('0xb')])+'AccountId']=this[_0x7a9c('0x1d')]['id'];}_0x128d17[_[_0x7a9c('0x1c')](this[_0x7a9c('0xb')])+_0x7a9c('0x1e')]=this['interaction']['id'];if(rpc[this[_0x7a9c('0xb')]+_0x7a9c('0x1f')]){if(this[_0x7a9c('0xb')]===_0x7a9c('0xf')){var _0x31695a={'tls':{'rejectUnauthorized':![]}};if(this[_0x7a9c('0x1d')][_0x7a9c('0x20')][_0x7a9c('0x21')]){_0x31695a[_0x7a9c('0x21')]=this[_0x7a9c('0x1d')][_0x7a9c('0x20')][_0x7a9c('0x21')];}else{_0x31695a[_0x7a9c('0x22')]=this['account'][_0x7a9c('0x20')][_0x7a9c('0x22')];_0x31695a['port']=this[_0x7a9c('0x1d')][_0x7a9c('0x20')][_0x7a9c('0x23')];_0x31695a['secure']=this['account'][_0x7a9c('0x20')][_0x7a9c('0x24')];}if(this[_0x7a9c('0x1d')][_0x7a9c('0x20')]['authentication']){_0x31695a[_0x7a9c('0x25')]={'user':this[_0x7a9c('0x1d')][_0x7a9c('0x20')][_0x7a9c('0x26')],'pass':this[_0x7a9c('0x1d')][_0x7a9c('0x20')][_0x7a9c('0x27')]};}_0x128d17[_0x7a9c('0x28')]=this[_0x7a9c('0x12')]['messageId'];_0x128d17[_0x7a9c('0x29')]=_0x7a9c('0x2a')+_[_0x7a9c('0x2b')](_0x128d17[_0x7a9c('0x10')],''+_[_0x27a1('0x2f')](_0x455a8f[_0x27a1('0x17')],'';_0x455a8f[_0x27a1('0x31')]={'Auto-Submitted':_0x27a1('0x32'),'X-Auto-Response-Suppress':_0x27a1('0x33'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](_0x21c37e,_0x455a8f)[_0x27a1('0x34')](function(_0x4c16cc){logger['info'](_0x27a1('0x35'),_0x2ccadb);_0x455a8f[_0x27a1('0x36')]=_0x4c16cc[_0x27a1('0x19')][_0x27a1('0x36')];return rpc[_0x56a122+_0x27a1('0x37')][_0x27a1('0x38')](_0x455a8f);})[_0x27a1('0x34')](function(_0x3b14d6){logger['info']('[%s][AUTOREPLY]\x20%s',_0x2ccadb,JSON['stringify'](_0x3b14d6));})[_0x27a1('0x39')](function(_0xcdbe1c){logger[_0x27a1('0x3a')](_0x27a1('0x3b'),_0x2ccadb,JSON['stringify'](_0xcdbe1c));})['finally'](function(){_0x4a4e2c[_0x27a1('0x11')]();});}else{return rpc[this[_0x27a1('0x12')]+_0x27a1('0x37')][_0x27a1('0x38')](_0x455a8f)[_0x27a1('0x34')](function(_0x6fe6c0){logger[_0x27a1('0x3c')]('[%s][AUTOREPLY]\x20%s',_0x2ccadb,_0x455a8f['body']);})[_0x27a1('0x39')](function(_0x1b26a){logger[_0x27a1('0x3a')]('[%s][AUTOREPLY]\x20%s',_0x2ccadb,JSON[_0x27a1('0x3d')](_0x1b26a));})[_0x27a1('0x3e')](function(){_0x4a4e2c[_0x27a1('0x11')]();});}}}catch(_0x1358c8){logger['error'](_0x27a1('0xf'),_0x2ccadb,JSON[_0x27a1('0x3d')](_0x1358c8));_0x4a4e2c[_0x27a1('0x3f')]();}};}; \ 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 7ec393b..4a6539e 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 _0x81d4=['then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','[%s][CLOSE]\x20%s','stop','error','stringify','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','update'];(function(_0x495f0b,_0x499f83){var _0xef44be=function(_0xea90c){while(--_0xea90c){_0x495f0b['push'](_0x495f0b['shift']());}};_0xef44be(++_0x499f83);}(_0x81d4,0x197));var _0x481d=function(_0x10f6a5,_0x5dcbe3){_0x10f6a5=_0x10f6a5-0x0;var _0x173b77=_0x81d4[_0x10f6a5];return _0x173b77;};'use strict';var moment=require('moment');var logger=require(_0x481d('0x0'))(_0x481d('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x481d('0x2')),'smsInteraction':require(_0x481d('0x3')),'mailInteraction':require(_0x481d('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x481d('0x5')]=function(_0x1a9ee1,_0x2ecf40,_0x5c0761,_0x1ef8ca){return function(_0x17d32a){try{logger[_0x481d('0x6')](_0x481d('0x7'),_0x1a9ee1,_0x2ecf40[0x0]);var _0x1d9263={'closed':0x1,'closedAt':moment()[_0x481d('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x481d('0x9'),'disposition':_0x2ecf40[0x0]};if(rpc[_0x1ef8ca[_0x481d('0xa')]+_0x481d('0xb')]){rpc[_0x1ef8ca['channel']+_0x481d('0xb')][_0x481d('0xc')](_0x1ef8ca['interaction']['id'],_0x1d9263)[_0x481d('0xd')](function(_0x3f6920){logger[_0x481d('0x6')](_0x481d('0xe'),_0x1a9ee1,_0x1ef8ca[_0x481d('0xf')]['id']);})[_0x481d('0x10')](function(_0x9c7a08){logger['error'](_0x481d('0x11'),_0x1a9ee1,JSON['stringify'](_0x9c7a08));})['finally'](function(){_0x17d32a[_0x481d('0x12')]();});}}catch(_0x18bd93){logger[_0x481d('0x13')]('[%s][CLOSE]\x20%s',_0x1a9ee1,JSON[_0x481d('0x14')](_0x18bd93));_0x17d32a['stop']();}};}; \ No newline at end of file +var _0x1354=['finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify'];(function(_0x2e66e2,_0x305398){var _0x347108=function(_0xb3d8e9){while(--_0xb3d8e9){_0x2e66e2['push'](_0x2e66e2['shift']());}};_0x347108(++_0x305398);}(_0x1354,0x95));var _0x4135=function(_0x3f787e,_0x951303){_0x3f787e=_0x3f787e-0x0;var _0x26242d=_0x1354[_0x3f787e];return _0x26242d;};'use strict';var moment=require(_0x4135('0x0'));var logger=require(_0x4135('0x1'))(_0x4135('0x2'));var rpc={'chatInteraction':require(_0x4135('0x3')),'openchannelInteraction':require(_0x4135('0x4')),'smsInteraction':require(_0x4135('0x5')),'mailInteraction':require(_0x4135('0x6')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x4135('0x7'))};exports[_0x4135('0x8')]=function(_0x202042,_0x4a8e27,_0x14ff47,_0x2bcd68){return function(_0x5e355d){try{logger[_0x4135('0x9')](_0x4135('0xa'),_0x202042,_0x4a8e27[0x0]);var _0x3e7ae3={'closed':0x1,'closedAt':moment()['format'](_0x4135('0xb')),'closeReason':'system','disposition':_0x4a8e27[0x0]};if(rpc[_0x2bcd68[_0x4135('0xc')]+_0x4135('0xd')]){rpc[_0x2bcd68[_0x4135('0xc')]+_0x4135('0xd')]['update'](_0x2bcd68[_0x4135('0xe')]['id'],_0x3e7ae3)['then'](function(_0x59e387){logger[_0x4135('0x9')](_0x4135('0xf'),_0x202042,_0x2bcd68[_0x4135('0xe')]['id']);})['catch'](function(_0x307e6f){logger[_0x4135('0x10')](_0x4135('0x11'),_0x202042,JSON[_0x4135('0x12')](_0x307e6f));})[_0x4135('0x13')](function(){_0x5e355d[_0x4135('0x14')]();});}}catch(_0x54f954){logger['error'](_0x4135('0x11'),_0x202042,JSON[_0x4135('0x12')](_0x54f954));_0x5e355d[_0x4135('0x14')]();}};}; \ 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 213dfbc..588f1f3 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 _0xd594=['AccountId','upperFirst','InteractionId','isEmpty','getMustacheRender','Message','then','info','[%s][DIALOGFLOW]\x20%s','body','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result','fulfillment','providerName','providerResponse','create','endConversation','lodash','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','chat','ChatWebsiteId','account'];(function(_0x329578,_0x3f20fa){var _0xe7c38a=function(_0x5449be){while(--_0x5449be){_0x329578['push'](_0x329578['shift']());}};_0xe7c38a(++_0x3f20fa);}(_0xd594,0xab));var _0x4d59=function(_0x72ed98,_0x127ae1){_0x72ed98=_0x72ed98-0x0;var _0x54162c=_0xd594[_0x72ed98];return _0x54162c;};'use strict';var _=require(_0x4d59('0x0'));var moment=require(_0x4d59('0x1'));var apiai=require(_0x4d59('0x2'));var md5=require('md5');var utils=require(_0x4d59('0x3'));var logger=require(_0x4d59('0x4'))(_0x4d59('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4d59('0x6')),'mailMessage':require(_0x4d59('0x7')),'smsMessage':require(_0x4d59('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x4d59('0x9'))};exports[_0x4d59('0xa')]=function(_0x355dc0,_0x2763a9){return function(_0x47d7f1){try{if(!_[_0x4d59('0xb')](this[_0x4d59('0xc')][_0x4d59('0xd')])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x355dc0,_0x4d59('0xe'));return _0x47d7f1[_0x4d59('0xf')]();}var _0x6dddc1={'ContactId':this[_0x4d59('0x10')]['id'],'sentAt':moment()[_0x4d59('0x11')](_0x4d59('0x12')),'direction':_0x4d59('0x13')};if(this[_0x4d59('0x14')]===_0x4d59('0x15')||this['channel']==='whatsapp'){_0x6dddc1['phone']=this['interaction']['phone'];}var _0x10fd43=this[_0x4d59('0x14')];if(_0x10fd43===_0x4d59('0x16')){_0x6dddc1[_0x4d59('0x17')]=this[_0x4d59('0x18')]['id'];}else{_0x6dddc1[_['upperFirst'](_0x10fd43)+_0x4d59('0x19')]=this[_0x4d59('0x18')]['id'];}_0x6dddc1[_[_0x4d59('0x1a')](_0x10fd43)+_0x4d59('0x1b')]=this['interaction']['id'];if(this[_0x4d59('0xc')]['created']){var _0x14ca24=_0x2763a9[0x2];if(!_[_0x4d59('0x1c')](_0x14ca24)){_0x6dddc1['body']=utils[_0x4d59('0x1d')](_0x14ca24,this);return rpc[_0x10fd43+_0x4d59('0x1e')]['create'](_0x6dddc1)[_0x4d59('0x1f')](function(_0x1ad221){logger[_0x4d59('0x20')](_0x4d59('0x21'),_0x355dc0,_0x6dddc1[_0x4d59('0x22')]);})[_0x4d59('0x23')](function(_0x44eec7){logger[_0x4d59('0x24')]('[%s][DIALOGFLOW]\x20%s',_0x355dc0,JSON[_0x4d59('0x25')](_0x44eec7));})['finally'](function(){logger[_0x4d59('0x20')](_0x4d59('0x26'),_0x355dc0);_0x47d7f1[_0x4d59('0x27')]();});}else{logger[_0x4d59('0x20')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x355dc0);_0x47d7f1[_0x4d59('0x27')]();}}else{var _0x11173b=this;var _0x37bc6f=apiai(_0x2763a9[0x0],{'language':_0x2763a9[0x1]||'en'});return _0x37bc6f[_0x4d59('0x28')](this[_0x4d59('0x29')][_0x4d59('0x22')],{'sessionId':md5(this['interaction']['id'])})[_0x4d59('0x1f')](function(_0x59fb05){_0x11173b[_0x4d59('0x22')][_0x4d59('0x2a')]=_0x59fb05;_0x6dddc1[_0x4d59('0x22')]=_0x59fb05[_0x4d59('0x2b')][_0x4d59('0x2c')]['speech'];_0x6dddc1[_0x4d59('0x2d')]='dialogflow';_0x6dddc1[_0x4d59('0x2e')]=JSON[_0x4d59('0x25')](_0x59fb05);return rpc[_0x10fd43+_0x4d59('0x1e')][_0x4d59('0x2f')](_0x6dddc1)['then'](function(_0x2b4757){logger[_0x4d59('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x355dc0,_0x6dddc1[_0x4d59('0x22')]);if(_0x59fb05[_0x4d59('0x2b')]['metadata'][_0x4d59('0x30')]){_0x47d7f1[_0x4d59('0xf')]();}else{_0x47d7f1[_0x4d59('0x27')]();}})[_0x4d59('0x23')](function(_0x1b40ea){logger[_0x4d59('0x24')](_0x4d59('0x21'),_0x355dc0,JSON[_0x4d59('0x25')](_0x1b40ea));_0x47d7f1[_0x4d59('0xf')]();});})[_0x4d59('0x23')](function(_0xaddf57){logger[_0x4d59('0x24')](_0x4d59('0x21'),_0x355dc0,_0xaddf57[_0x4d59('0x29')]);_0x47d7f1['next']();});}}catch(_0x5b7659){logger[_0x4d59('0x24')](_0x4d59('0x21'),_0x355dc0,JSON[_0x4d59('0x25')](_0x5b7659));_0x47d7f1[_0x4d59('0x27')]();}};}; \ No newline at end of file +var _0xdfe9=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','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','providerName','endConversation','lodash','apiai-promise','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x227126,_0x5b3514){var _0x456ded=function(_0x2b40f7){while(--_0x2b40f7){_0x227126['push'](_0x227126['shift']());}};_0x456ded(++_0x5b3514);}(_0xdfe9,0xc3));var _0x9dfe=function(_0x37452b,_0x4c800e){_0x37452b=_0x37452b-0x0;var _0xedc13c=_0xdfe9[_0x37452b];return _0xedc13c;};'use strict';var _=require(_0x9dfe('0x0'));var moment=require('moment');var apiai=require(_0x9dfe('0x1'));var md5=require('md5');var utils=require('./utils');var logger=require(_0x9dfe('0x2'))(_0x9dfe('0x3'));var rpc={'chatMessage':require(_0x9dfe('0x4')),'openchannelMessage':require(_0x9dfe('0x5')),'mailMessage':require(_0x9dfe('0x6')),'smsMessage':require(_0x9dfe('0x7')),'faxMessage':require(_0x9dfe('0x8')),'whatsappMessage':require(_0x9dfe('0x9'))};exports[_0x9dfe('0xa')]=function(_0x3471f0,_0x13b6f8){return function(_0x5e0faf){try{if(!_[_0x9dfe('0xb')](this[_0x9dfe('0xc')][_0x9dfe('0xd')])){logger[_0x9dfe('0xe')](_0x9dfe('0xf'),_0x3471f0,_0x9dfe('0x10'));return _0x5e0faf[_0x9dfe('0x11')]();}var _0xaed877={'ContactId':this['contact']['id'],'sentAt':moment()[_0x9dfe('0x12')](_0x9dfe('0x13')),'direction':_0x9dfe('0x14')};if(this[_0x9dfe('0x15')]==='sms'||this['channel']===_0x9dfe('0x16')){_0xaed877[_0x9dfe('0x17')]=this['interaction']['phone'];}var _0x5d9256=this[_0x9dfe('0x15')];if(_0x5d9256===_0x9dfe('0x18')){_0xaed877[_0x9dfe('0x19')]=this[_0x9dfe('0x1a')]['id'];}else{_0xaed877[_[_0x9dfe('0x1b')](_0x5d9256)+_0x9dfe('0x1c')]=this[_0x9dfe('0x1a')]['id'];}_0xaed877[_[_0x9dfe('0x1b')](_0x5d9256)+_0x9dfe('0x1d')]=this['interaction']['id'];if(this['interaction'][_0x9dfe('0x1e')]){var _0x4be792=_0x13b6f8[0x2];if(!_[_0x9dfe('0x1f')](_0x4be792)){_0xaed877[_0x9dfe('0x20')]=utils[_0x9dfe('0x21')](_0x4be792,this);return rpc[_0x5d9256+_0x9dfe('0x22')][_0x9dfe('0x23')](_0xaed877)[_0x9dfe('0x24')](function(_0x5c7158){logger[_0x9dfe('0xe')](_0x9dfe('0xf'),_0x3471f0,_0xaed877[_0x9dfe('0x20')]);})[_0x9dfe('0x25')](function(_0x2ebbc4){logger[_0x9dfe('0x26')](_0x9dfe('0xf'),_0x3471f0,JSON[_0x9dfe('0x27')](_0x2ebbc4));})[_0x9dfe('0x28')](function(){logger[_0x9dfe('0xe')](_0x9dfe('0x29'),_0x3471f0);_0x5e0faf[_0x9dfe('0x2a')]();});}else{logger[_0x9dfe('0xe')](_0x9dfe('0x2b'),_0x3471f0);_0x5e0faf['stop']();}}else{var _0x484f22=this;var _0x35cb5c=apiai(_0x13b6f8[0x0],{'language':_0x13b6f8[0x1]||'en'});return _0x35cb5c[_0x9dfe('0x2c')](this[_0x9dfe('0x2d')][_0x9dfe('0x20')],{'sessionId':md5(this[_0x9dfe('0xc')]['id'])})[_0x9dfe('0x24')](function(_0x3354b7){_0x484f22[_0x9dfe('0x20')][_0x9dfe('0x2e')]=_0x3354b7;_0xaed877[_0x9dfe('0x20')]=_0x3354b7[_0x9dfe('0x2f')]['fulfillment']['speech'];_0xaed877[_0x9dfe('0x30')]=_0x9dfe('0x2e');_0xaed877['providerResponse']=JSON[_0x9dfe('0x27')](_0x3354b7);return rpc[_0x5d9256+_0x9dfe('0x22')][_0x9dfe('0x23')](_0xaed877)['then'](function(_0x2fba44){logger[_0x9dfe('0xe')](_0x9dfe('0xf'),_0x3471f0,_0xaed877[_0x9dfe('0x20')]);if(_0x3354b7[_0x9dfe('0x2f')]['metadata'][_0x9dfe('0x31')]){_0x5e0faf['next']();}else{_0x5e0faf[_0x9dfe('0x2a')]();}})[_0x9dfe('0x25')](function(_0x796981){logger[_0x9dfe('0x26')](_0x9dfe('0xf'),_0x3471f0,JSON[_0x9dfe('0x27')](_0x796981));_0x5e0faf[_0x9dfe('0x11')]();});})[_0x9dfe('0x25')](function(_0x4de29c){logger['error'](_0x9dfe('0xf'),_0x3471f0,_0x4de29c['message']);_0x5e0faf[_0x9dfe('0x11')]();});}}catch(_0x22e72f){logger[_0x9dfe('0x26')]('[%s][DIALOGFLOW]\x20%s',_0x3471f0,JSON[_0x9dfe('0x27')](_0x22e72f));_0x5e0faf[_0x9dfe('0x2a')]();}};}; \ 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 397017d..e3267fb 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 _0x0d8d=['lodash','dialogflow','md5','moment','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','isNil','interaction','UserId','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','detectIntent','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','boolValue','action','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','all','message'];(function(_0x1b283c,_0x2d5a90){var _0x4b2fc3=function(_0x221990){while(--_0x221990){_0x1b283c['push'](_0x1b283c['shift']());}};_0x4b2fc3(++_0x2d5a90);}(_0x0d8d,0x1d5));var _0xd0d8=function(_0x55c8de,_0x3b2e66){_0x55c8de=_0x55c8de-0x0;var _0x519ffa=_0x0d8d[_0x55c8de];return _0x519ffa;};'use strict';var _=require(_0xd0d8('0x0'));var dialogflow=require(_0xd0d8('0x1'));var md5=require(_0xd0d8('0x2'));var moment=require(_0xd0d8('0x3'));var Promise=require('bluebird');var logger=require(_0xd0d8('0x4'))(_0xd0d8('0x5'));var utils=require(_0xd0d8('0x6'));var rpc={'chatMessage':require(_0xd0d8('0x7')),'openchannelMessage':require(_0xd0d8('0x8')),'mailMessage':require(_0xd0d8('0x9')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd0d8('0xa')),'whatsappMessage':require(_0xd0d8('0xb'))};function createMessage(_0x3d2a6e,_0x46503d,_0x14f8be,_0x3f7b0f){return new Promise(function(_0x562769,_0x2a0cbb){var _0x1dc12b=_[_0xd0d8('0xc')](_0x14f8be);_0x1dc12b['body']=_0x3f7b0f;return rpc[_0x46503d+_0xd0d8('0xd')][_0xd0d8('0xe')](_0x1dc12b)[_0xd0d8('0xf')](function(){logger[_0xd0d8('0x10')](_0xd0d8('0x11'),_0x3d2a6e,_0x1dc12b['body']);_0x562769();})['catch'](function(_0x48a9a1){logger[_0xd0d8('0x12')](_0xd0d8('0x11'),_0x3d2a6e,JSON[_0xd0d8('0x13')](_0x48a9a1));_0x2a0cbb(_0x48a9a1);});});}exports[_0xd0d8('0x14')]=function(_0x28eae2,_0x508183){return function(_0x5b250c){try{if(!_[_0xd0d8('0x15')](this[_0xd0d8('0x16')][_0xd0d8('0x17')])){logger[_0xd0d8('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x28eae2,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5b250c[_0xd0d8('0x18')]();}var _0x2d346f={'ContactId':this['contact']['id'],'sentAt':moment()[_0xd0d8('0x19')](_0xd0d8('0x1a')),'direction':_0xd0d8('0x1b')};if(this['channel']==='sms'||this[_0xd0d8('0x1c')]===_0xd0d8('0x1d')){_0x2d346f[_0xd0d8('0x1e')]=this['interaction'][_0xd0d8('0x1e')];}var _0x8250ce=this[_0xd0d8('0x1c')];if(_0x8250ce==='chat'){_0x2d346f[_0xd0d8('0x1f')]=this['account']['id'];}else{_0x2d346f[_['upperFirst'](_0x8250ce)+_0xd0d8('0x20')]=this[_0xd0d8('0x21')]['id'];}_0x2d346f[_[_0xd0d8('0x22')](_0x8250ce)+_0xd0d8('0x23')]=this[_0xd0d8('0x16')]['id'];if(this['interaction'][_0xd0d8('0x24')]){var _0xd9da23=_0x508183[0x4];if(!_[_0xd0d8('0x25')](_0xd9da23)){_0x2d346f[_0xd0d8('0x26')]=utils[_0xd0d8('0x27')](_0xd9da23,this);return rpc[_0x8250ce+_0xd0d8('0xd')][_0xd0d8('0xe')](_0x2d346f)[_0xd0d8('0xf')](function(_0x48d02e){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x28eae2,_0x2d346f[_0xd0d8('0x26')]);})[_0xd0d8('0x28')](function(_0x431fe9){logger[_0xd0d8('0x12')](_0xd0d8('0x11'),_0x28eae2,JSON[_0xd0d8('0x13')](_0x431fe9));})[_0xd0d8('0x29')](function(){logger[_0xd0d8('0x10')](_0xd0d8('0x2a'),_0x28eae2);_0x5b250c[_0xd0d8('0x2b')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x28eae2);_0x5b250c['stop']();}}else{var _0xd70fac=this;var _0xe3390f=_0x508183[0x2][_0xd0d8('0x2c')](/\\n/g,'\x0a');var _0x3f06f2={'credentials':{'private_key':_0xe3390f,'client_email':_0x508183[0x1]}};var _0x3378ac=new dialogflow['SessionsClient'](_0x3f06f2);var _0x4715af=_0x3378ac['sessionPath'](_0x508183[0x0],md5(_0xd70fac['interaction']['id']));var _0x3c2707={'session':_0x4715af,'queryInput':{'text':{'text':_0xd70fac['message']['body'],'languageCode':_0x508183[0x3]||'en'}}};return _0x3378ac[_0xd0d8('0x2d')](_0x3c2707)[_0xd0d8('0xf')](function(_0xfd6491){if(_0xfd6491&&_0xfd6491['length']){_0xd70fac['body'][_0xd0d8('0x2e')]=_0xfd6491;var _0x280bd9=_0xfd6491[0x0];var _0x49693d=_0x280bd9['queryResult'][_0xd0d8('0x2f')]&&_0x280bd9[_0xd0d8('0x30')][_0xd0d8('0x2f')][_0xd0d8('0x31')]?_0x280bd9[_0xd0d8('0x30')][_0xd0d8('0x2f')][_0xd0d8('0x31')][_0xd0d8('0x32')][_0xd0d8('0x33')]:![];_0xd70fac['body']['DIALOGFLOWV2_ACTION']=_0x280bd9['queryResult'][_0xd0d8('0x34')];_0xd70fac['body']['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x280bd9[_0xd0d8('0x30')][_0xd0d8('0x35')];_0xd70fac[_0xd0d8('0x26')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x280bd9['queryResult'][_0xd0d8('0x2f')]&&_0x280bd9['queryResult'][_0xd0d8('0x2f')][_0xd0d8('0x31')]?_0x280bd9[_0xd0d8('0x30')][_0xd0d8('0x2f')][_0xd0d8('0x31')][_0xd0d8('0x32')][_0xd0d8('0x33')]:![];_0xd70fac[_0xd0d8('0x26')][_0xd0d8('0x36')]=_0x280bd9['queryResult'][_0xd0d8('0x37')]['name'];_0xd70fac[_0xd0d8('0x26')][_0xd0d8('0x38')]=_0x280bd9[_0xd0d8('0x30')][_0xd0d8('0x37')][_0xd0d8('0x39')];_0xd70fac[_0xd0d8('0x26')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x280bd9[_0xd0d8('0x30')]['intent'][_0xd0d8('0x3a')];_0xd70fac[_0xd0d8('0x26')][_0xd0d8('0x3b')]=_0x280bd9['queryResult'][_0xd0d8('0x3c')];_0xd70fac['body']['DIALOGFLOWV2_QUERYTEXT']=_0x280bd9['queryResult']['queryText'];_0xd70fac[_0xd0d8('0x26')]['DIALOGFLOWV2_SCORE']=_0x280bd9[_0xd0d8('0x30')][_0xd0d8('0x3d')];_0x2d346f[_0xd0d8('0x3e')]=_0xd0d8('0x2e');_0x2d346f[_0xd0d8('0x3f')]=JSON[_0xd0d8('0x13')](_0xfd6491);var _0x131a53=[];for(var _0x38bda1=0x0;_0x38bda1<_0xfd6491['length'];_0x38bda1++){var _0x40a979=_0xfd6491[_0x38bda1];if(_0x40a979&&_0x40a979[_0xd0d8('0x30')]&&_0x40a979['queryResult'][_0xd0d8('0x40')]){_0x131a53['push'](createMessage(_0x28eae2,_0x8250ce,_0x2d346f,_0x40a979['queryResult'][_0xd0d8('0x40')]));}}return Promise[_0xd0d8('0x41')](_0x131a53)[_0xd0d8('0xf')](function(){if(_0x49693d){_0x5b250c[_0xd0d8('0x18')]();}else{_0x5b250c['stop']();}})[_0xd0d8('0x28')](function(_0x9d5c4f){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x28eae2,JSON[_0xd0d8('0x13')](_0x9d5c4f));_0x5b250c['next']();});}})[_0xd0d8('0x28')](function(_0x2c78ff){logger[_0xd0d8('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x28eae2,_0x2c78ff[_0xd0d8('0x42')]);_0x5b250c[_0xd0d8('0x18')]();});}}catch(_0x3a3b93){logger['error'](_0xd0d8('0x11'),_0x28eae2,JSON[_0xd0d8('0x13')](_0x3a3b93));_0x5b250c[_0xd0d8('0x2b')]();}};}; \ No newline at end of file +var _0xd6b1=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','then','stringify','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','detectIntent','length','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','push','all','lodash','dialogflow','md5','moment','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage'];(function(_0x5a00d8,_0x1063dc){var _0x354ca2=function(_0x1edd6f){while(--_0x1edd6f){_0x5a00d8['push'](_0x5a00d8['shift']());}};_0x354ca2(++_0x1063dc);}(_0xd6b1,0x10f));var _0x1d6b=function(_0x658401,_0x1af24e){_0x658401=_0x658401-0x0;var _0x1318a6=_0xd6b1[_0x658401];return _0x1318a6;};'use strict';var _=require(_0x1d6b('0x0'));var dialogflow=require(_0x1d6b('0x1'));var md5=require(_0x1d6b('0x2'));var moment=require(_0x1d6b('0x3'));var Promise=require('bluebird');var logger=require('../../../../config/logger')(_0x1d6b('0x4'));var utils=require(_0x1d6b('0x5'));var rpc={'chatMessage':require(_0x1d6b('0x6')),'openchannelMessage':require(_0x1d6b('0x7')),'mailMessage':require(_0x1d6b('0x8')),'smsMessage':require(_0x1d6b('0x9')),'faxMessage':require(_0x1d6b('0xa')),'whatsappMessage':require(_0x1d6b('0xb'))};function createMessage(_0x1bc4b5,_0x75869f,_0x26feb5,_0x15fe70){return new Promise(function(_0x353d70,_0x769459){var _0x4885b7=_[_0x1d6b('0xc')](_0x26feb5);_0x4885b7[_0x1d6b('0xd')]=_0x15fe70;return rpc[_0x75869f+'Message'][_0x1d6b('0xe')](_0x4885b7)['then'](function(){logger[_0x1d6b('0xf')](_0x1d6b('0x10'),_0x1bc4b5,_0x4885b7[_0x1d6b('0xd')]);_0x353d70();})[_0x1d6b('0x11')](function(_0x14c3ca){logger[_0x1d6b('0x12')](_0x1d6b('0x10'),_0x1bc4b5,JSON['stringify'](_0x14c3ca));_0x769459(_0x14c3ca);});});}exports['consequence']=function(_0x297f22,_0x28a2cb){return function(_0x3e98d7){try{if(!_['isNil'](this[_0x1d6b('0x13')]['UserId'])){logger['info'](_0x1d6b('0x10'),_0x297f22,_0x1d6b('0x14'));return _0x3e98d7[_0x1d6b('0x15')]();}var _0x45a5cc={'ContactId':this[_0x1d6b('0x16')]['id'],'sentAt':moment()['format'](_0x1d6b('0x17')),'direction':_0x1d6b('0x18')};if(this[_0x1d6b('0x19')]===_0x1d6b('0x1a')||this['channel']===_0x1d6b('0x1b')){_0x45a5cc[_0x1d6b('0x1c')]=this[_0x1d6b('0x13')]['phone'];}var _0x416fe8=this[_0x1d6b('0x19')];if(_0x416fe8===_0x1d6b('0x1d')){_0x45a5cc[_0x1d6b('0x1e')]=this[_0x1d6b('0x1f')]['id'];}else{_0x45a5cc[_[_0x1d6b('0x20')](_0x416fe8)+_0x1d6b('0x21')]=this['account']['id'];}_0x45a5cc[_[_0x1d6b('0x20')](_0x416fe8)+_0x1d6b('0x22')]=this[_0x1d6b('0x13')]['id'];if(this[_0x1d6b('0x13')][_0x1d6b('0x23')]){var _0x89bbe9=_0x28a2cb[0x4];if(!_['isEmpty'](_0x89bbe9)){_0x45a5cc[_0x1d6b('0xd')]=utils[_0x1d6b('0x24')](_0x89bbe9,this);return rpc[_0x416fe8+'Message'][_0x1d6b('0xe')](_0x45a5cc)[_0x1d6b('0x25')](function(_0xd90a35){logger['info'](_0x1d6b('0x10'),_0x297f22,_0x45a5cc['body']);})[_0x1d6b('0x11')](function(_0x5adf1b){logger[_0x1d6b('0x12')](_0x1d6b('0x10'),_0x297f22,JSON[_0x1d6b('0x26')](_0x5adf1b));})[_0x1d6b('0x27')](function(){logger[_0x1d6b('0xf')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x297f22);_0x3e98d7[_0x1d6b('0x28')]();});}else{logger['info'](_0x1d6b('0x29'),_0x297f22);_0x3e98d7['stop']();}}else{var _0x4a1ac9=this;var _0x5057b3=_0x28a2cb[0x2][_0x1d6b('0x2a')](/\\n/g,'\x0a');var _0xb3de30={'credentials':{'private_key':_0x5057b3,'client_email':_0x28a2cb[0x1]}};var _0x167503=new dialogflow[(_0x1d6b('0x2b'))](_0xb3de30);var _0x39d9ad=_0x167503['sessionPath'](_0x28a2cb[0x0],md5(_0x4a1ac9[_0x1d6b('0x13')]['id']));var _0x243834={'session':_0x39d9ad,'queryInput':{'text':{'text':_0x4a1ac9[_0x1d6b('0x2c')][_0x1d6b('0xd')],'languageCode':_0x28a2cb[0x3]||'en'}}};return _0x167503[_0x1d6b('0x2d')](_0x243834)[_0x1d6b('0x25')](function(_0x46c48b){if(_0x46c48b&&_0x46c48b[_0x1d6b('0x2e')]){_0x4a1ac9[_0x1d6b('0xd')]['dialogflowV2']=_0x46c48b;var _0x594b69=_0x46c48b[0x0];var _0x15508c=_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x30')]&&_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x30')]['fields']?_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x30')][_0x1d6b('0x31')]['end_conversation'][_0x1d6b('0x32')]:![];_0x4a1ac9[_0x1d6b('0xd')]['DIALOGFLOWV2_ACTION']=_0x594b69[_0x1d6b('0x2f')]['action'];_0x4a1ac9[_0x1d6b('0xd')][_0x1d6b('0x33')]=_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x34')];_0x4a1ac9[_0x1d6b('0xd')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x594b69['queryResult']['diagnosticInfo']&&_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x30')][_0x1d6b('0x31')]?_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x30')]['fields'][_0x1d6b('0x35')][_0x1d6b('0x32')]:![];_0x4a1ac9[_0x1d6b('0xd')][_0x1d6b('0x36')]=_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x37')]['name'];_0x4a1ac9[_0x1d6b('0xd')][_0x1d6b('0x38')]=_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x37')][_0x1d6b('0x39')];_0x4a1ac9['body'][_0x1d6b('0x3a')]=_0x594b69[_0x1d6b('0x2f')]['intent'][_0x1d6b('0x3b')];_0x4a1ac9[_0x1d6b('0xd')][_0x1d6b('0x3c')]=_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x3d')];_0x4a1ac9[_0x1d6b('0xd')][_0x1d6b('0x3e')]=_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x3f')];_0x4a1ac9['body'][_0x1d6b('0x40')]=_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x41')];_0x45a5cc['providerName']='dialogflowV2';_0x45a5cc[_0x1d6b('0x42')]=JSON[_0x1d6b('0x26')](_0x46c48b);var _0x2a9fc1=[];for(var _0x272c9e=0x0;_0x272c9e<_0x46c48b[_0x1d6b('0x2e')];_0x272c9e++){var _0x26bf52=_0x46c48b[_0x272c9e];if(_0x26bf52&&_0x26bf52['queryResult']&&_0x26bf52[_0x1d6b('0x2f')][_0x1d6b('0x43')]){_0x2a9fc1[_0x1d6b('0x44')](createMessage(_0x297f22,_0x416fe8,_0x45a5cc,_0x26bf52[_0x1d6b('0x2f')]['fulfillmentText']));}}return Promise[_0x1d6b('0x45')](_0x2a9fc1)[_0x1d6b('0x25')](function(){if(_0x15508c){_0x3e98d7[_0x1d6b('0x15')]();}else{_0x3e98d7[_0x1d6b('0x28')]();}})[_0x1d6b('0x11')](function(_0x2d654b){logger[_0x1d6b('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x297f22,JSON[_0x1d6b('0x26')](_0x2d654b));_0x3e98d7[_0x1d6b('0x15')]();});}})[_0x1d6b('0x11')](function(_0x45c833){logger['error'](_0x1d6b('0x10'),_0x297f22,_0x45c833['message']);_0x3e98d7[_0x1d6b('0x15')]();});}}catch(_0x205805){logger['error'](_0x1d6b('0x10'),_0x297f22,JSON['stringify'](_0x205805));_0x3e98d7[_0x1d6b('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 07518d1..427bf16 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 _0x6a59=['priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','replace','length','error','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue'];(function(_0x1f48fe,_0x4ad731){var _0xae69a5=function(_0x224e4c){while(--_0x224e4c){_0x1f48fe['push'](_0x1f48fe['shift']());}};_0xae69a5(++_0x4ad731);}(_0x6a59,0x153));var _0x96a5=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0x6a59[_0x52684f];return _0x4a55f0;};'use strict';var schema=require(_0x96a5('0x0'));var _=require(_0x96a5('0x1'));var htmlToText=require(_0x96a5('0x2'));var utils=require(_0x96a5('0x3'));var logger=require(_0x96a5('0x4'))(_0x96a5('0x5'));var gotoif=schema({'condition':{'type':_0x96a5('0x6'),'required':!![],'message':_0x96a5('0x7')},'priorityTrue':{'type':_0x96a5('0x8'),'message':_0x96a5('0x9')},'priorityFalse':{'type':_0x96a5('0x8'),'message':_0x96a5('0xa')}});exports[_0x96a5('0xb')]=function(_0x2907ff,_0x2f9a95){return function(_0x41eb1e){try{var _0x154654={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x2f9a95[0x0],this),{'wordwrap':![]})[_0x96a5('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2f9a95[0x1],'priorityFalse':_0x2f9a95[0x2]};var _0x10490f=gotoif[_0x96a5('0x0')](_0x154654,{'typecast':!![]});if(_0x10490f[_0x96a5('0xd')]){logger[_0x96a5('0xe')](_0x96a5('0xf'),_0x2907ff,_[_0x96a5('0x10')](_0x10490f,'message')[_0x96a5('0x11')](',\x20'));_0x41eb1e[_0x96a5('0x12')]();}else{try{var _0x4cc368=eval('('+_0x154654[_0x96a5('0x13')]+')');var _0x3b3e2e=_0x4cc368?_0x154654[_0x96a5('0x14')]:_0x154654[_0x96a5('0x15')];logger['info'](_0x96a5('0x16'),_0x2907ff,_0x154654[_0x96a5('0x13')],_0x4cc368,_0x3b3e2e||'next');if(_0x3b3e2e){var _0x4f64f6=_[_0x96a5('0x17')](_0x41eb1e[_0x96a5('0x18')](),{'p':_0x3b3e2e});if(_0x4f64f6>=0x0){logger['info'](_0x96a5('0x19'),_0x2907ff,_0x3b3e2e||_0x96a5('0x1a'),_0x4f64f6);_0x41eb1e[_0x96a5('0x1a')](_0x4f64f6);}else{logger[_0x96a5('0x1b')](_0x96a5('0x1c'),_0x2907ff,_0x3b3e2e||_0x96a5('0x1a'));_0x41eb1e[_0x96a5('0x12')]();}}else{_0x41eb1e[_0x96a5('0x1a')]();}}catch(_0x92d689){logger[_0x96a5('0xe')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x2907ff,_0x92d689['message']);_0x41eb1e[_0x96a5('0x12')]();}}}catch(_0x29c1cb){logger[_0x96a5('0xe')]('[%s][GOTOIF]\x20%s',_0x2907ff,JSON[_0x96a5('0x1d')](_0x29c1cb));_0x41eb1e['stop']();}};}; \ No newline at end of file +var _0x14e2=['replace','validate','length','error','[%s][GOTOIF]\x20%s','map','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','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','html-to-text','./utils','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x14e2,0xdb));var _0x214e=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0x14e2[_0x128450];return _0x4d80ed;};'use strict';var schema=require('validate');var _=require(_0x214e('0x0'));var htmlToText=require(_0x214e('0x1'));var utils=require(_0x214e('0x2'));var logger=require(_0x214e('0x3'))(_0x214e('0x4'));var gotoif=schema({'condition':{'type':_0x214e('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x214e('0x6')},'priorityFalse':{'type':_0x214e('0x7'),'message':_0x214e('0x8')}});exports[_0x214e('0x9')]=function(_0x52f20c,_0x5b8963){return function(_0x43d2a9){try{var _0x477866={'condition':htmlToText[_0x214e('0xa')](utils[_0x214e('0xb')](_0x5b8963[0x0],this),{'wordwrap':![]})[_0x214e('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5b8963[0x1],'priorityFalse':_0x5b8963[0x2]};var _0x36d5d5=gotoif[_0x214e('0xd')](_0x477866,{'typecast':!![]});if(_0x36d5d5[_0x214e('0xe')]){logger[_0x214e('0xf')](_0x214e('0x10'),_0x52f20c,_[_0x214e('0x11')](_0x36d5d5,_0x214e('0x12'))[_0x214e('0x13')](',\x20'));_0x43d2a9['stop']();}else{try{var _0x44ada0=eval('('+_0x477866[_0x214e('0x14')]+')');var _0x4f4630=_0x44ada0?_0x477866[_0x214e('0x15')]:_0x477866[_0x214e('0x16')];logger[_0x214e('0x17')](_0x214e('0x18'),_0x52f20c,_0x477866[_0x214e('0x14')],_0x44ada0,_0x4f4630||_0x214e('0x19'));if(_0x4f4630){var _0x1f2d9b=_[_0x214e('0x1a')](_0x43d2a9[_0x214e('0x1b')](),{'p':_0x4f4630});if(_0x1f2d9b>=0x0){logger[_0x214e('0x17')](_0x214e('0x1c'),_0x52f20c,_0x4f4630||'next',_0x1f2d9b);_0x43d2a9[_0x214e('0x19')](_0x1f2d9b);}else{logger['info'](_0x214e('0x1d'),_0x52f20c,_0x4f4630||_0x214e('0x19'));_0x43d2a9[_0x214e('0x1e')]();}}else{_0x43d2a9[_0x214e('0x19')]();}}catch(_0xd6193b){logger[_0x214e('0xf')](_0x214e('0x1f'),_0x52f20c,_0xd6193b['message']);_0x43d2a9['stop']();}}}catch(_0x413296){logger[_0x214e('0xf')]('[%s][GOTOIF]\x20%s',_0x52f20c,JSON[_0x214e('0x20')](_0x413296));_0x43d2a9['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 889f75f..6df35df 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 _0x2705=['routing','number','consequence','error','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger'];(function(_0x4ddc7a,_0x5b6cb8){var _0x4547c1=function(_0x3739e7){while(--_0x3739e7){_0x4ddc7a['push'](_0x4ddc7a['shift']());}};_0x4547c1(++_0x5b6cb8);}(_0x2705,0xce));var _0x5270=function(_0x2881ca,_0x2dfb4e){_0x2881ca=_0x2881ca-0x0;var _0x4133b4=_0x2705[_0x2881ca];return _0x4133b4;};'use strict';var schema=require(_0x5270('0x0'));var _=require(_0x5270('0x1'));var logger=require(_0x5270('0x2'))(_0x5270('0x3'));var gotop=schema({'priority':{'type':_0x5270('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x5270('0x5')]=function(_0x295cd3,_0x5182f2){return function(_0x5a42dc){try{var _0x26c6d2={'priority':_0x5182f2[0x0]};var _0xa7fbec=gotop[_0x5270('0x0')](_0x26c6d2,{'typecast':!![]});if(_0xa7fbec['length']){logger[_0x5270('0x6')](_0x5270('0x7'),_0x295cd3,_[_0x5270('0x8')](_0xa7fbec,_0x5270('0x9'))['join'](',\x20'));_0x5a42dc[_0x5270('0xa')]();}else{logger[_0x5270('0xb')](_0x5270('0xc'),_0x295cd3,_0x26c6d2[_0x5270('0xd')]);if(_0x26c6d2['priority']){var _0x508c9c=_[_0x5270('0xe')](_0x5a42dc['rules'](),{'p':_0x26c6d2[_0x5270('0xd')]});if(_0x508c9c>=0x0){logger[_0x5270('0xb')](_0x5270('0xf'),_0x295cd3,_0x26c6d2[_0x5270('0xd')]||_0x5270('0x10'),_0x508c9c);_0x5a42dc[_0x5270('0x10')](_0x508c9c);}else{logger[_0x5270('0xb')](_0x5270('0x11'),_0x295cd3,_0x26c6d2[_0x5270('0xd')]||_0x5270('0x10'));_0x5a42dc[_0x5270('0xa')]();}}else{_0x5a42dc[_0x5270('0x10')]();}}}catch(_0x4cc272){logger[_0x5270('0x6')](_0x5270('0x7'),_0x295cd3,JSON[_0x5270('0x12')](_0x4cc272));_0x5a42dc['stop']();}};}; \ No newline at end of file +var _0x4b35=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','number','consequence','length','error','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0xda1001,_0x50c948){var _0x1b6534=function(_0x3b58ea){while(--_0x3b58ea){_0xda1001['push'](_0xda1001['shift']());}};_0x1b6534(++_0x50c948);}(_0x4b35,0xcd));var _0x54b3=function(_0xb61065,_0x159992){_0xb61065=_0xb61065-0x0;var _0x3f3fcb=_0x4b35[_0xb61065];return _0x3f3fcb;};'use strict';var schema=require(_0x54b3('0x0'));var _=require(_0x54b3('0x1'));var logger=require('../../../../config/logger')(_0x54b3('0x2'));var gotop=schema({'priority':{'type':_0x54b3('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x54b3('0x4')]=function(_0x491335,_0x15dd75){return function(_0x494add){try{var _0x37154e={'priority':_0x15dd75[0x0]};var _0x464614=gotop['validate'](_0x37154e,{'typecast':!![]});if(_0x464614[_0x54b3('0x5')]){logger[_0x54b3('0x6')]('[%s][GOTOP]\x20%s',_0x491335,_[_0x54b3('0x7')](_0x464614,_0x54b3('0x8'))[_0x54b3('0x9')](',\x20'));_0x494add[_0x54b3('0xa')]();}else{logger[_0x54b3('0xb')](_0x54b3('0xc'),_0x491335,_0x37154e[_0x54b3('0xd')]);if(_0x37154e[_0x54b3('0xd')]){var _0x469e65=_[_0x54b3('0xe')](_0x494add[_0x54b3('0xf')](),{'p':_0x37154e[_0x54b3('0xd')]});if(_0x469e65>=0x0){logger['info'](_0x54b3('0x10'),_0x491335,_0x37154e[_0x54b3('0xd')]||_0x54b3('0x11'),_0x469e65);_0x494add[_0x54b3('0x11')](_0x469e65);}else{logger[_0x54b3('0xb')](_0x54b3('0x12'),_0x491335,_0x37154e[_0x54b3('0xd')]||_0x54b3('0x11'));_0x494add[_0x54b3('0xa')]();}}else{_0x494add['next']();}}}catch(_0x1886e6){logger[_0x54b3('0x6')]('[%s][GOTOP]\x20%s',_0x491335,JSON[_0x54b3('0x13')](_0x1886e6));_0x494add[_0x54b3('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 15be19f..d8a7c2a 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 _0x3bed=['AccountId','account','InteractionId','interaction','create','then','[%s][MESSAGE]\x20%s','body','catch','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','upperFirst'];(function(_0x1b0d58,_0x43b148){var _0x218e2a=function(_0x1292bb){while(--_0x1292bb){_0x1b0d58['push'](_0x1b0d58['shift']());}};_0x218e2a(++_0x43b148);}(_0x3bed,0x11e));var _0xd3be=function(_0xa518b3,_0x23945c){_0xa518b3=_0xa518b3-0x0;var _0x365c9e=_0x3bed[_0xa518b3];return _0x365c9e;};'use strict';var _=require(_0xd3be('0x0'));var utils=require(_0xd3be('0x1'));var logger=require(_0xd3be('0x2'))(_0xd3be('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xd3be('0x4')),'mailMessage':require(_0xd3be('0x5')),'smsMessage':require(_0xd3be('0x6')),'faxMessage':require(_0xd3be('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xd3be('0x8')]=function(_0x390cd0,_0x15d4ed){return function(_0x2916cd){try{var _0x3a31a4={'body':utils[_0xd3be('0x9')](_0x15d4ed[0x0],this),'ContactId':this[_0xd3be('0xa')]['id']};if(this[_0xd3be('0xb')]===_0xd3be('0xc')){_0x3a31a4['ChatWebsiteId']=this['account']['id'];}else{_0x3a31a4[_[_0xd3be('0xd')](this[_0xd3be('0xb')])+_0xd3be('0xe')]=this[_0xd3be('0xf')]['id'];}_0x3a31a4[_[_0xd3be('0xd')](this[_0xd3be('0xb')])+_0xd3be('0x10')]=this[_0xd3be('0x11')]['id'];if(rpc[this[_0xd3be('0xb')]+'Message']){return rpc[this['channel']+'Message'][_0xd3be('0x12')](_0x3a31a4)[_0xd3be('0x13')](function(_0x105f6d){logger['info'](_0xd3be('0x14'),_0x390cd0,_0x3a31a4[_0xd3be('0x15')]);_0x2916cd['next']();})[_0xd3be('0x16')](function(_0xfa1446){logger['error'](_0xd3be('0x14'),_0x390cd0,JSON[_0xd3be('0x17')](_0xfa1446));_0x2916cd['stop']();});}}catch(_0x3a8ea2){logger['error'](_0xd3be('0x14'),_0x390cd0,JSON[_0xd3be('0x17')](_0x3a8ea2));_0x2916cd[_0xd3be('0x18')]();}};}; \ No newline at end of file +var _0xb55c=['stop','lodash','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','stringify'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0xb55c,0x187));var _0xcb55=function(_0x41e018,_0x54cb55){_0x41e018=_0x41e018-0x0;var _0x52327d=_0xb55c[_0x41e018];return _0x52327d;};'use strict';var _=require(_0xcb55('0x0'));var utils=require(_0xcb55('0x1'));var logger=require(_0xcb55('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xcb55('0x3')),'mailMessage':require(_0xcb55('0x4')),'smsMessage':require(_0xcb55('0x5')),'faxMessage':require(_0xcb55('0x6')),'whatsappMessage':require(_0xcb55('0x7'))};exports[_0xcb55('0x8')]=function(_0x9ea5a7,_0x28b257){return function(_0x3bcb46){try{var _0xb001f7={'body':utils['getMustacheRender'](_0x28b257[0x0],this),'ContactId':this[_0xcb55('0x9')]['id']};if(this[_0xcb55('0xa')]===_0xcb55('0xb')){_0xb001f7['ChatWebsiteId']=this[_0xcb55('0xc')]['id'];}else{_0xb001f7[_[_0xcb55('0xd')](this[_0xcb55('0xa')])+_0xcb55('0xe')]=this[_0xcb55('0xc')]['id'];}_0xb001f7[_[_0xcb55('0xd')](this[_0xcb55('0xa')])+_0xcb55('0xf')]=this[_0xcb55('0x10')]['id'];if(rpc[this[_0xcb55('0xa')]+_0xcb55('0x11')]){return rpc[this[_0xcb55('0xa')]+_0xcb55('0x11')][_0xcb55('0x12')](_0xb001f7)[_0xcb55('0x13')](function(_0x7e2cfc){logger[_0xcb55('0x14')](_0xcb55('0x15'),_0x9ea5a7,_0xb001f7['body']);_0x3bcb46[_0xcb55('0x16')]();})[_0xcb55('0x17')](function(_0x74c02a){logger['error'](_0xcb55('0x15'),_0x9ea5a7,JSON[_0xcb55('0x18')](_0x74c02a));_0x3bcb46[_0xcb55('0x19')]();});}}catch(_0x38d896){logger['error'](_0xcb55('0x15'),_0x9ea5a7,JSON[_0xcb55('0x18')](_0x38d896));_0x3bcb46['stop']();}};}; \ 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 aab49b3..13c807e 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 _0xc401=['./utils','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','stop'];(function(_0x59b9d3,_0x384472){var _0x171163=function(_0x251233){while(--_0x251233){_0x59b9d3['push'](_0x59b9d3['shift']());}};_0x171163(++_0x384472);}(_0xc401,0x138));var _0x1c40=function(_0xb3d60f,_0x212833){_0xb3d60f=_0xb3d60f-0x0;var _0x1f2dc9=_0xc401[_0xb3d60f];return _0x1f2dc9;};'use strict';var utils=require(_0x1c40('0x0'));var logger=require('../../../../config/logger')(_0x1c40('0x1'));exports[_0x1c40('0x2')]=function(_0x47247f,_0x5b064a){return function(_0x17f1b5){try{logger[_0x1c40('0x3')](_0x1c40('0x4'),_0x47247f,utils[_0x1c40('0x5')](_0x5b064a[0x0],this));_0x17f1b5[_0x1c40('0x6')]();}catch(_0x4baafe){logger['error'](_0x1c40('0x4'),_0x47247f,JSON['stringify'](_0x4baafe));_0x17f1b5[_0x1c40('0x7')]();}};}; \ No newline at end of file +var _0xb881=['info','[%s][NOOP]\x20%s','getMustacheRender','next','stop','./utils','../../../../config/logger','consequence'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xb881,0x105));var _0x1b88=function(_0x4ca89a,_0x33ffb8){_0x4ca89a=_0x4ca89a-0x0;var _0xfeb04d=_0xb881[_0x4ca89a];return _0xfeb04d;};'use strict';var utils=require(_0x1b88('0x0'));var logger=require(_0x1b88('0x1'))('routing');exports[_0x1b88('0x2')]=function(_0x320ae4,_0x2f55b7){return function(_0xb55927){try{logger[_0x1b88('0x3')](_0x1b88('0x4'),_0x320ae4,utils[_0x1b88('0x5')](_0x2f55b7[0x0],this));_0xb55927[_0x1b88('0x6')]();}catch(_0x83be27){logger['error'](_0x1b88('0x4'),_0x320ae4,JSON['stringify'](_0x83be27));_0xb55927[_0x1b88('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index e189a3b..1404fb1 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 _0x7217=['info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','update','catch','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','pick','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId'];(function(_0x40d9cc,_0x42406d){var _0x2ee0f6=function(_0x2863d4){while(--_0x2863d4){_0x40d9cc['push'](_0x40d9cc['shift']());}};_0x2ee0f6(++_0x42406d);}(_0x7217,0x19e));var _0x7721=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7217[_0x2763f2];return _0x3ef471;};'use strict';var schema=require(_0x7721('0x0'));var _=require('lodash');var util=require(_0x7721('0x1'));var seqqueue=require(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x7721('0x6'));config[_0x7721('0x7')]=_[_0x7721('0x8')](config[_0x7721('0x7')],{'host':_0x7721('0x9'),'port':0x18eb});var io=require(_0x7721('0xa'))(new Redis(config[_0x7721('0x7')]));var attributes=['id',_0x7721('0xb'),_0x7721('0xc'),_0x7721('0xd'),_0x7721('0xe'),_0x7721('0xf')];function emit(_0xfa8835,_0x138740,_0x2c3986){io['to'](_0xfa8835)['emit'](_0x138740,_0x2c3986);}function emitChannelQueueInteraction(_0x461d1a,_0x29bc8f,_0x8729a6,_0xf78099,_0xa8977c,_0x409b37,_0x1e7fd7,_0x27b36b){var _0x55b4ca=_[_0x7721('0x10')](_0x8729a6);_0x55b4ca[_0x7721('0xb')]=_0x27b36b;_0x55b4ca['queue']=_0x29bc8f;_0x55b4ca[_0x7721('0xc')]=_0xf78099;_0x55b4ca['id']=_0xa8977c;if(_0x409b37){_0x1e7fd7[util[_0x7721('0x11')](_0x7721('0x12'),_0x461d1a)][_0xa8977c]=_[_0x7721('0x13')](_0x55b4ca,attributes);}else{delete _0x1e7fd7[util['format'](_0x7721('0x12'),_0x461d1a)][_0xa8977c];}emit(util[_0x7721('0x11')]('%s:queue:%s',_0x461d1a,_0x29bc8f),util['format']('%s_queue_waiting_interaction:%s',_0x461d1a,_0x409b37?_0x7721('0x14'):_0x7721('0x15')),_[_0x7721('0x13')](_0x55b4ca,attributes));}var rpc={'openchannelQueueReport':require(_0x7721('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x7721('0x17')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x7721('0x18')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x7721('0x19'),'required':!![],'message':_0x7721('0x1a')},'timeout':{'type':_0x7721('0x1b'),'message':_0x7721('0x1c')}});function startRouting(_0x2286e5,_0x40af90,_0x402820,_0x413263){if(_0x2286e5&&_0x40af90&&_0x402820){_0x40af90[_0x7721('0x1d')]+=0x1;var _0xaeccc4={'uniqueid':_0x2286e5,'from':_0x402820['body']?_0x402820[_0x7721('0x1e')][_0x7721('0xe')]:'','joinAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'ContactId':_0x402820['contact']?_0x402820[_0x7721('0x20')]['id']:null,'ListId':_0x402820['list']?_0x402820[_0x7721('0x21')]['id']:null};_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x24')]=_0x40af90['id']||null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x25')]=_0x402820['interaction']?_0x402820[_0x7721('0x26')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x27')]=_0x402820[_0x7721('0x28')]?_0x402820[_0x7721('0x28')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+(_0x402820[_0x7721('0x23')]!=='chat'?_0x7721('0x29'):'WebsiteId')]=_0x402820['account']?_0x402820[_0x7721('0xc')]['id']:null;logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x2b'),_0x2286e5,_0x40af90[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x402820[_0x7721('0x23')],_0x40af90[_0x7721('0x2c')],_0xaeccc4,_0x402820[_0x7721('0xc')]['name'],_0x402820[_0x7721('0x28')]['id'],!![],_0x413263,_0x40af90['id']);if(rpc[_0x402820[_0x7721('0x23')]+'QueueReport']){return rpc[_0x402820['channel']+_0x7721('0x2d')][_0x7721('0x2e')](_0xaeccc4)['catch'](function(_0x46f772){logger[_0x7721('0x2f')](_0x7721('0x30'));});}}}function stopRouting(_0x58d54b,_0x3d9a32,_0x1ff31b,_0x1492d4){if(_0x58d54b&&_0x3d9a32){_0x3d9a32[_0x7721('0x1d')]-=0x1;var _0xc0f3c4={'leaveAt':moment()['format'](_0x7721('0x1f')),'acceptAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'reason':'accepted'};logger[_0x7721('0x2a')](util[_0x7721('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x58d54b,_0x3d9a32[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x1ff31b['channel'],_0x3d9a32[_0x7721('0x2c')],_0x1ff31b[_0x7721('0x1e')],_0x1ff31b[_0x7721('0xc')][_0x7721('0x2c')],_0x1ff31b[_0x7721('0x28')]['id'],![],_0x1492d4,_0x3d9a32['id']);if(rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')]){return rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')][_0x7721('0x31')](_0x58d54b,_0xc0f3c4)[_0x7721('0x32')](function(_0x5c806d){logger[_0x7721('0x2f')]('update\x20queue\x20report');});}}}function endRouting(_0x212384,_0x35614c,_0x7942f7,_0x1d03de){if(_0x212384&&_0x35614c){_0x35614c[_0x7721('0x1d')]-=0x1;var _0x378ba5={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x7721('0x33')};logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x34'),_0x212384,_0x35614c['name']));emitChannelQueueInteraction(_0x7942f7[_0x7721('0x23')],_0x35614c['name'],_0x7942f7[_0x7721('0x1e')],_0x7942f7[_0x7721('0xc')]['name'],_0x7942f7[_0x7721('0x28')]['id'],![],_0x1d03de);if(rpc[_0x7942f7[_0x7721('0x23')]+'QueueReport']){return rpc[_0x7942f7['channel']+_0x7721('0x2d')][_0x7721('0x31')](_0x212384,_0x378ba5)[_0x7721('0x32')](function(_0x15e34d){logger['error'](_0x7721('0x35'));});}}}function handleFindQueue(_0x120de9){return function(_0x40ce8c){return _0x40ce8c[_0x7721('0x2c')][_0x7721('0x36')]()===_0x120de9['toLowerCase']();};}exports[_0x7721('0x37')]=function(_0x4a2c28,_0xaa3216,_0x4a5b59,_0x2333b8){return function(_0x15fa2c){try{var _0x231dad={'name':_0xaa3216[0x0],'timeout':_0xaa3216[0x1]};var _0x49e0c5=queue[_0x7721('0x0')](_0x231dad,{'typecast':!![]});if(_0x49e0c5[_0x7721('0x38')]){logger[_0x7721('0x2f')]('[%s][QUEUE]\x20%s',_0x4a2c28,_[_0x7721('0x39')](_0x49e0c5,_0x7721('0x28'))[_0x7721('0x3a')](',\x20'));_0x15fa2c[_0x7721('0x3b')]();}else{var _0x135dbc=_[_0x7721('0x3c')](_0x4a5b59[_0x2333b8[_0x7721('0x23')]+'Queues'],handleFindQueue(_0x231dad['name']));if(_0x135dbc){startRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);var _0x1ac3af=(_0x135dbc[_0x7721('0x33')]||0xa)*0x3e8;var _0x421aae=(_0x231dad[_0x7721('0x33')]||0x14)*0x3e8;var _0x335145,_0x15181b;if(_0x1ac3af>_0x421aae){_0x421aae=_0x1ac3af;}var _0x1d2ea5=seqqueue[_0x7721('0x3d')](_0x1ac3af);_0x1d2ea5['id']=_0x4a2c28;_0x1d2ea5[_0x7721('0x3e')]=_0x1ac3af;_0x1d2ea5[_0x7721('0x3f')]=_0x421aae;_0x1d2ea5['channel']=_0x2333b8['channel'];_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on'](_0x7721('0x41'),function(){logger[_0x7721('0x2a')](_0x7721('0x42'),_0x4a2c28);stopRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x335145=undefined;_0x1d2ea5['close'](!![]);if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59[_0x7721('0x40')][_0x4a2c28];}_0x15fa2c['stop']();});_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on']('complete',function(){if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59['rules'][_0x4a2c28];}});_0x335145=setTimeout(function(){logger[_0x7721('0x2a')](_0x7721('0x43'),_0x4a2c28);endRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x1d2ea5[_0x7721('0x44')](!![]);_0x15fa2c['next']();},_0x421aae);switch(_0x135dbc[_0x7721('0x45')]){case _0x7721('0x46'):strategy['rrmemory'](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);break;default:strategy[_0x7721('0x47')](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);}}else{logger[_0x7721('0x2f')](_0x7721('0x48'),_0x4a2c28,_0x231dad['name']);_0x15fa2c[_0x7721('0x3b')]();}}}catch(_0x5a32b6){console[_0x7721('0x49')](_0x5a32b6);logger[_0x7721('0x2f')](_0x7721('0x4a'),_0x4a2c28,_0x5a32b6[_0x7721('0x4b')]);_0x15fa2c[_0x7721('0x3b')]();}};}; \ No newline at end of file +var _0x55ca=['../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','QueueId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','map','join','find','Queues','createQueue','atimeout','rules','end','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove'];(function(_0x104525,_0x28e579){var _0x3318ab=function(_0x93d5b2){while(--_0x93d5b2){_0x104525['push'](_0x104525['shift']());}};_0x3318ab(++_0x28e579);}(_0x55ca,0x126));var _0xa55c=function(_0x59b9d3,_0x384472){_0x59b9d3=_0x59b9d3-0x0;var _0x171163=_0x55ca[_0x59b9d3];return _0x171163;};'use strict';var schema=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));var strategy=require(_0xa55c('0x5'));config[_0xa55c('0x6')]=_[_0xa55c('0x7')](config[_0xa55c('0x6')],{'host':_0xa55c('0x8'),'port':0x18eb});var io=require(_0xa55c('0x9'))(new Redis(config['redis']));var attributes=['id',_0xa55c('0xa'),_0xa55c('0xb'),'queue',_0xa55c('0xc'),_0xa55c('0xd')];function emit(_0x52a3bc,_0x5849ad,_0x473d0e){io['to'](_0x52a3bc)[_0xa55c('0xe')](_0x5849ad,_0x473d0e);}function emitChannelQueueInteraction(_0x381d07,_0x5d8e5a,_0x31646d,_0xe6d826,_0x508342,_0x70c2de,_0x3998f7,_0x15eec8){var _0x5d47ff=_['clone'](_0x31646d);_0x5d47ff[_0xa55c('0xa')]=_0x15eec8;_0x5d47ff['queue']=_0x5d8e5a;_0x5d47ff['account']=_0xe6d826;_0x5d47ff['id']=_0x508342;if(_0x70c2de){_0x3998f7[util['format'](_0xa55c('0xf'),_0x381d07)][_0x508342]=_[_0xa55c('0x10')](_0x5d47ff,attributes);}else{delete _0x3998f7[util[_0xa55c('0x11')](_0xa55c('0xf'),_0x381d07)][_0x508342];}emit(util[_0xa55c('0x11')](_0xa55c('0x12'),_0x381d07,_0x5d8e5a),util['format'](_0xa55c('0x13'),_0x381d07,_0x70c2de?_0xa55c('0x14'):_0xa55c('0x15')),_[_0xa55c('0x10')](_0x5d47ff,attributes));}var rpc={'openchannelQueueReport':require(_0xa55c('0x16')),'mailQueueReport':require(_0xa55c('0x17')),'chatQueueReport':require(_0xa55c('0x18')),'smsQueueReport':require(_0xa55c('0x19')),'faxQueueReport':require(_0xa55c('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xa55c('0x1b'),'required':!![],'message':_0xa55c('0x1c')},'timeout':{'type':_0xa55c('0x1d'),'message':_0xa55c('0x1e')}});function startRouting(_0x23a1ae,_0x5426e5,_0x4c0daf,_0x5f5158){if(_0x23a1ae&&_0x5426e5&&_0x4c0daf){_0x5426e5[_0xa55c('0x1f')]+=0x1;var _0x3776ac={'uniqueid':_0x23a1ae,'from':_0x4c0daf[_0xa55c('0x20')]?_0x4c0daf['body'][_0xa55c('0xc')]:'','joinAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c0daf[_0xa55c('0x21')]?_0x4c0daf[_0xa55c('0x21')]['id']:null,'ListId':_0x4c0daf[_0xa55c('0x22')]?_0x4c0daf[_0xa55c('0x22')]['id']:null};_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf['channel'])+_0xa55c('0x24')]=_0x5426e5['id']||null;_0x3776ac[_['upperFirst'](_0x4c0daf['channel'])+'InteractionId']=_0x4c0daf[_0xa55c('0x25')]?_0x4c0daf['interaction']['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+_0xa55c('0x27')]=_0x4c0daf[_0xa55c('0x28')]?_0x4c0daf[_0xa55c('0x28')]['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+(_0x4c0daf[_0xa55c('0x26')]!==_0xa55c('0x29')?_0xa55c('0x2a'):_0xa55c('0x2b'))]=_0x4c0daf['account']?_0x4c0daf[_0xa55c('0xb')]['id']:null;logger[_0xa55c('0x2c')](util[_0xa55c('0x11')](_0xa55c('0x2d'),_0x23a1ae,_0x5426e5['name']));emitChannelQueueInteraction(_0x4c0daf[_0xa55c('0x26')],_0x5426e5[_0xa55c('0x2e')],_0x3776ac,_0x4c0daf[_0xa55c('0xb')][_0xa55c('0x2e')],_0x4c0daf[_0xa55c('0x28')]['id'],!![],_0x5f5158,_0x5426e5['id']);if(rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport']){return rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport'][_0xa55c('0x2f')](_0x3776ac)[_0xa55c('0x30')](function(_0x1cc53e){logger[_0xa55c('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x3d28fb,_0x2096ae,_0x331e58,_0x20da31){if(_0x3d28fb&&_0x2096ae){_0x2096ae[_0xa55c('0x1f')]-=0x1;var _0x1225c3={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'acceptAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'reason':_0xa55c('0x33')};logger['info'](util['format'](_0xa55c('0x34'),_0x3d28fb,_0x2096ae[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x331e58['channel'],_0x2096ae[_0xa55c('0x2e')],_0x331e58[_0xa55c('0x20')],_0x331e58[_0xa55c('0xb')][_0xa55c('0x2e')],_0x331e58[_0xa55c('0x28')]['id'],![],_0x20da31,_0x2096ae['id']);if(rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]){return rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]['update'](_0x3d28fb,_0x1225c3)['catch'](function(_0x4b23d3){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function endRouting(_0x2bb4f0,_0x5802e4,_0x768408,_0x547930){if(_0x2bb4f0&&_0x5802e4){_0x5802e4[_0xa55c('0x1f')]-=0x1;var _0x4ad813={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'exitAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa55c('0x37')};logger[_0xa55c('0x2c')](util['format'](_0xa55c('0x38'),_0x2bb4f0,_0x5802e4[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x768408['channel'],_0x5802e4['name'],_0x768408[_0xa55c('0x20')],_0x768408['account'][_0xa55c('0x2e')],_0x768408[_0xa55c('0x28')]['id'],![],_0x547930);if(rpc[_0x768408['channel']+'QueueReport']){return rpc[_0x768408['channel']+'QueueReport'][_0xa55c('0x39')](_0x2bb4f0,_0x4ad813)[_0xa55c('0x30')](function(_0x429336){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function handleFindQueue(_0x56d17c){return function(_0x3d52d8){return _0x3d52d8[_0xa55c('0x2e')][_0xa55c('0x3a')]()===_0x56d17c[_0xa55c('0x3a')]();};}exports[_0xa55c('0x3b')]=function(_0x23cef5,_0x554620,_0x386e34,_0x5ee63d){return function(_0x57a972){try{var _0x404e7f={'name':_0x554620[0x0],'timeout':_0x554620[0x1]};var _0x1f63d8=queue['validate'](_0x404e7f,{'typecast':!![]});if(_0x1f63d8[_0xa55c('0x3c')]){logger['error']('[%s][QUEUE]\x20%s',_0x23cef5,_[_0xa55c('0x3d')](_0x1f63d8,_0xa55c('0x28'))[_0xa55c('0x3e')](',\x20'));_0x57a972['stop']();}else{var _0x1b2708=_[_0xa55c('0x3f')](_0x386e34[_0x5ee63d['channel']+_0xa55c('0x40')],handleFindQueue(_0x404e7f['name']));if(_0x1b2708){startRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);var _0x39886a=(_0x1b2708[_0xa55c('0x37')]||0xa)*0x3e8;var _0x5be43f=(_0x404e7f[_0xa55c('0x37')]||0x14)*0x3e8;var _0x1dae70,_0x5d834d;if(_0x39886a>_0x5be43f){_0x5be43f=_0x39886a;}var _0x40c352=seqqueue[_0xa55c('0x41')](_0x39886a);_0x40c352['id']=_0x23cef5;_0x40c352[_0xa55c('0x42')]=_0x39886a;_0x40c352['qtimeout']=_0x5be43f;_0x40c352[_0xa55c('0x26')]=_0x5ee63d['channel'];_0x386e34[_0xa55c('0x43')][_0x23cef5]['on'](_0xa55c('0x44'),function(){logger[_0xa55c('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x23cef5);stopRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x1dae70=undefined;_0x40c352[_0xa55c('0x45')](!![]);if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34['rules'][_0x23cef5];}_0x57a972[_0xa55c('0x46')]();});_0x386e34[_0xa55c('0x43')][_0x23cef5]['on']('complete',function(){if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34[_0xa55c('0x43')][_0x23cef5];}});_0x1dae70=setTimeout(function(){logger['info'](_0xa55c('0x47'),_0x23cef5);endRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x40c352[_0xa55c('0x45')](!![]);_0x57a972[_0xa55c('0x48')]();},_0x5be43f);switch(_0x1b2708[_0xa55c('0x49')]){case'rrmemory':strategy[_0xa55c('0x4a')](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);break;default:strategy['beepall'](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);}}else{logger[_0xa55c('0x31')](_0xa55c('0x4b'),_0x23cef5,_0x404e7f[_0xa55c('0x2e')]);_0x57a972['stop']();}}}catch(_0x39bd3d){console[_0xa55c('0x4c')](_0x39bd3d);logger['error'](_0xa55c('0x4d'),_0x23cef5,_0x39bd3d[_0xa55c('0x4e')]);_0x57a972[_0xa55c('0x46')]();}};}; \ 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 c2a4876..71649ec 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 _0xa4b1=['../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','handleTimeout','drained','handleDrained','prototype','bind','isNil','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','writeLog','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busy','STOP','exports','lodash','uuid','./util'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xa4b1,0x133));var _0x1a4b=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xa4b1[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x1a4b('0x0'));var uuid=require(_0x1a4b('0x1'));var util=require(_0x1a4b('0x2'));var logger=require(_0x1a4b('0x3'))(_0x1a4b('0x4'));var Agent=function(_0x4e2c52,_0x9b913d,_0x243220,_0x4c6e86){this[_0x1a4b('0x5')]=uuid['v4']();this[_0x1a4b('0x6')]=_0x4e2c52;this[_0x1a4b('0x7')]=_0x9b913d;this[_0x1a4b('0x8')]=_0x243220;this['routing']=_0x4c6e86;this[_0x1a4b('0x6')][_0x1a4b('0x9')](this[_0x1a4b('0xa')]['bind'](this),this['handleTimeout']['bind'](this));this[_0x1a4b('0x6')]['on']('timeout',this[_0x1a4b('0xb')]['bind'](this));this['squeue']['on'](_0x1a4b('0xc'),this[_0x1a4b('0xd')]['bind'](this));};Agent[_0x1a4b('0xe')][_0x1a4b('0x9')]=function(){this[_0x1a4b('0x6')][_0x1a4b('0x9')](this[_0x1a4b('0xa')][_0x1a4b('0xf')](this),this[_0x1a4b('0xb')][_0x1a4b('0xf')](this));};Agent[_0x1a4b('0xe')][_0x1a4b('0xd')]=function(){this[_0x1a4b('0xb')](!![]);};Agent[_0x1a4b('0xe')][_0x1a4b('0xa')]=function(_0x3c14a6){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x1a4b('0x6')]['id'],this['agent']['id']);if(_[_0x1a4b('0x10')](this[_0x1a4b('0x8')][_0x1a4b('0x11')][this[_0x1a4b('0x7')]['id']])){logger[_0x1a4b('0x12')](_0x1a4b('0x13'),this[_0x1a4b('0x6')]['id'],this[_0x1a4b('0x7')]['id']);setTimeout(this[_0x1a4b('0x9')][_0x1a4b('0xf')](this),0x3e8);}else{if(this[_0x1a4b('0x4')][_0x1a4b('0x14')]||util[_0x1a4b('0x15')](this[_0x1a4b('0x6')]['id'],this[_0x1a4b('0x8')]['agents'][this[_0x1a4b('0x7')]['id']],this[_0x1a4b('0x6')][_0x1a4b('0x16')],![])){this[_0x1a4b('0x8')][_0x1a4b('0x11')][this[_0x1a4b('0x7')]['id']]['busy']=!![];this[_0x1a4b('0x8')]['agents'][this[_0x1a4b('0x7')]['id']][_0x1a4b('0x17')]=undefined;util[_0x1a4b('0x18')](this[_0x1a4b('0x5')],this[_0x1a4b('0x6')]['id'],this['realtime'][_0x1a4b('0x11')][this['agent']['id']],null,this[_0x1a4b('0x4')]);util[_0x1a4b('0x19')](this[_0x1a4b('0x6')]['id'],this[_0x1a4b('0x8')][_0x1a4b('0x11')][this[_0x1a4b('0x7')]['id']],'RINGING'+(this[_0x1a4b('0x4')][_0x1a4b('0x14')]?':FORCED':''));}else{logger[_0x1a4b('0x12')](_0x1a4b('0x1a'),this[_0x1a4b('0x6')]['id'],this[_0x1a4b('0x7')]['id']);setTimeout(this['push'][_0x1a4b('0xf')](this),0x3e8);}}};Agent[_0x1a4b('0xe')][_0x1a4b('0xb')]=function(_0x2a7622){if(_['isNil'](this[_0x1a4b('0x8')][_0x1a4b('0x11')][this[_0x1a4b('0x7')]['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x1a4b('0x7')]['id']);}else{logger[_0x1a4b('0x12')](_0x1a4b('0x1b'),this[_0x1a4b('0x6')]['id'],this[_0x1a4b('0x7')]['id']);util['hideNotification'](this[_0x1a4b('0x5')],this[_0x1a4b('0x6')]['id'],this['realtime'][_0x1a4b('0x11')][this[_0x1a4b('0x7')]['id']],null,this[_0x1a4b('0x4')]);this[_0x1a4b('0x8')][_0x1a4b('0x11')][this[_0x1a4b('0x7')]['id']][_0x1a4b('0x1c')]=![];this[_0x1a4b('0x8')]['agents'][this['agent']['id']]['busyQueue']=undefined;util['writeLog'](this[_0x1a4b('0x6')]['id'],this[_0x1a4b('0x8')][_0x1a4b('0x11')][this[_0x1a4b('0x7')]['id']],_0x2a7622?_0x1a4b('0x1d'):'TIMEOUT');}if(!_0x2a7622){setTimeout(this['push'][_0x1a4b('0xf')](this),0x3e8);}};function agent(_0x1bc074,_0x51a705,_0x4b6553,_0xcc0d71){return new Agent(_0x1bc074,_0x51a705,_0x4b6553,_0xcc0d71);}module[_0x1a4b('0x1e')]=agent; \ No newline at end of file +var _0x7a2e=['busy','STOP','TIMEOUT','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busyQueue','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','info','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification'];(function(_0x5be613,_0x1469db){var _0x2a20fc=function(_0x35e8fe){while(--_0x35e8fe){_0x5be613['push'](_0x5be613['shift']());}};_0x2a20fc(++_0x1469db);}(_0x7a2e,0x69));var _0xe7a2=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x7a2e[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var uuid=require(_0xe7a2('0x0'));var util=require(_0xe7a2('0x1'));var logger=require(_0xe7a2('0x2'))(_0xe7a2('0x3'));var Agent=function(_0x3654aa,_0x1786e0,_0x5af18f,_0x453290){this[_0xe7a2('0x4')]=uuid['v4']();this[_0xe7a2('0x5')]=_0x3654aa;this[_0xe7a2('0x6')]=_0x1786e0;this[_0xe7a2('0x7')]=_0x5af18f;this[_0xe7a2('0x3')]=_0x453290;this[_0xe7a2('0x5')][_0xe7a2('0x8')](this[_0xe7a2('0x9')][_0xe7a2('0xa')](this),this[_0xe7a2('0xb')][_0xe7a2('0xa')](this));this[_0xe7a2('0x5')]['on'](_0xe7a2('0xc'),this['handleTimeout']['bind'](this));this['squeue']['on'](_0xe7a2('0xd'),this[_0xe7a2('0xe')][_0xe7a2('0xa')](this));};Agent[_0xe7a2('0xf')][_0xe7a2('0x8')]=function(){this[_0xe7a2('0x5')][_0xe7a2('0x8')](this[_0xe7a2('0x9')][_0xe7a2('0xa')](this),this[_0xe7a2('0xb')]['bind'](this));};Agent['prototype'][_0xe7a2('0xe')]=function(){this[_0xe7a2('0xb')](!![]);};Agent[_0xe7a2('0xf')][_0xe7a2('0x9')]=function(_0x3c1e26){logger['info'](_0xe7a2('0x10'),this[_0xe7a2('0x5')]['id'],this['agent']['id']);if(_[_0xe7a2('0x11')](this[_0xe7a2('0x7')][_0xe7a2('0x12')][this['agent']['id']])){logger['info'](_0xe7a2('0x13'),this[_0xe7a2('0x5')]['id'],this[_0xe7a2('0x6')]['id']);setTimeout(this[_0xe7a2('0x8')][_0xe7a2('0xa')](this),0x3e8);}else{if(this[_0xe7a2('0x3')]['forcedOwnership']||util[_0xe7a2('0x14')](this[_0xe7a2('0x5')]['id'],this[_0xe7a2('0x7')][_0xe7a2('0x12')][this[_0xe7a2('0x6')]['id']],this[_0xe7a2('0x5')][_0xe7a2('0x15')],![])){this[_0xe7a2('0x7')][_0xe7a2('0x12')][this[_0xe7a2('0x6')]['id']]['busy']=!![];this[_0xe7a2('0x7')][_0xe7a2('0x12')][this['agent']['id']][_0xe7a2('0x16')]=undefined;util[_0xe7a2('0x17')](this[_0xe7a2('0x4')],this['squeue']['id'],this[_0xe7a2('0x7')][_0xe7a2('0x12')][this[_0xe7a2('0x6')]['id']],null,this[_0xe7a2('0x3')]);util[_0xe7a2('0x18')](this[_0xe7a2('0x5')]['id'],this[_0xe7a2('0x7')][_0xe7a2('0x12')][this['agent']['id']],_0xe7a2('0x19')+(this['routing'][_0xe7a2('0x1a')]?_0xe7a2('0x1b'):''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0xe7a2('0x6')]['id']);setTimeout(this[_0xe7a2('0x8')]['bind'](this),0x3e8);}}};Agent[_0xe7a2('0xf')][_0xe7a2('0xb')]=function(_0x56bf7d){if(_[_0xe7a2('0x11')](this[_0xe7a2('0x7')][_0xe7a2('0x12')][this[_0xe7a2('0x6')]['id']])){return logger[_0xe7a2('0x1c')](_0xe7a2('0x13'),this['squeue']['id'],this['agent']['id']);}else{logger[_0xe7a2('0x1c')](_0xe7a2('0x1d'),this[_0xe7a2('0x5')]['id'],this['agent']['id']);util[_0xe7a2('0x1e')](this['notificationId'],this[_0xe7a2('0x5')]['id'],this[_0xe7a2('0x7')][_0xe7a2('0x12')][this[_0xe7a2('0x6')]['id']],null,this[_0xe7a2('0x3')]);this[_0xe7a2('0x7')][_0xe7a2('0x12')][this[_0xe7a2('0x6')]['id']][_0xe7a2('0x1f')]=![];this[_0xe7a2('0x7')][_0xe7a2('0x12')][this[_0xe7a2('0x6')]['id']]['busyQueue']=undefined;util['writeLog'](this[_0xe7a2('0x5')]['id'],this['realtime'][_0xe7a2('0x12')][this[_0xe7a2('0x6')]['id']],_0x56bf7d?_0xe7a2('0x20'):_0xe7a2('0x21'));}if(!_0x56bf7d){setTimeout(this[_0xe7a2('0x8')][_0xe7a2('0xa')](this),0x3e8);}};function agent(_0x357f4f,_0x517f5a,_0x1e192d,_0x5f0165){return new Agent(_0x357f4f,_0x517f5a,_0x1e192d,_0x5f0165);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 67b26df..ef634a4 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 _0x6174=['handleTimeout','bind','drained','handleDrained','prototype','handleRun','Agents','length','isNil','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','writeLog','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','queue','realtime','squeue','push'];(function(_0x9a377b,_0x333b2f){var _0x38c7bd=function(_0x18166a){while(--_0x18166a){_0x9a377b['push'](_0x9a377b['shift']());}};_0x38c7bd(++_0x333b2f);}(_0x6174,0x72));var _0x4617=function(_0x147455,_0x260bf6){_0x147455=_0x147455-0x0;var _0x52d97f=_0x6174[_0x147455];return _0x52d97f;};'use strict';var _=require(_0x4617('0x0'));var uuid=require(_0x4617('0x1'));var util=require(_0x4617('0x2'));var logger=require(_0x4617('0x3'))(_0x4617('0x4'));var Beepall=function(_0x24086c,_0x53a9b5,_0x22032b,_0x8c215b){this[_0x4617('0x5')]=uuid['v4']();this['squeue']=_0x24086c;this[_0x4617('0x6')]=_0x53a9b5;this[_0x4617('0x7')]=_0x22032b;this[_0x4617('0x4')]=_0x8c215b;this[_0x4617('0x8')][_0x4617('0x9')](this['handleRun']['bind'](this),this[_0x4617('0xa')][_0x4617('0xb')](this));this['squeue']['on']('timeout',this[_0x4617('0xa')][_0x4617('0xb')](this));this[_0x4617('0x8')]['on'](_0x4617('0xc'),this[_0x4617('0xd')]['bind'](this));};Beepall[_0x4617('0xe')][_0x4617('0x9')]=function(){this[_0x4617('0x8')]['push'](this[_0x4617('0xf')]['bind'](this),this[_0x4617('0xa')]['bind'](this));};Beepall[_0x4617('0xe')][_0x4617('0xd')]=function(_0x18a143){this[_0x4617('0xa')](!![]);};Beepall['prototype']['handleRun']=function(_0x94e1f0){var _0x1e3469=!![];if(!_['isNil'](this[_0x4617('0x6')])&&!_['isNil'](this[_0x4617('0x6')]['Agents'])&&this[_0x4617('0x6')]['Agents']['length']>0x0){for(var _0xaf438a=0x0,_0x3504ee;_0xaf438a0x0){for(var _0x4a42b4=0x0,_0x59055f;_0x4a42b40x0&&_0x591840[_0x97095a+_0x5278('0x24')]>=_0x591840[_0x97095a+_0x5278('0x23')]){writeLog(_0xc5d392,_0x591840,_0x97095a['toUpperCase']()+_0x5278('0x25'));return![];}}return!![];};exports[_0x5278('0x26')]=function(_0x242bbd,_0x38673b,_0x4399da,_0x1da662,_0x31bd0e){return sendNotification(!![],_0x242bbd,_0x38673b,_0x4399da,_0x1da662,_0x31bd0e);};exports[_0x5278('0x27')]=function(_0x5f4fa2,_0x580a9e,_0x543193,_0x2ba65d,_0x57145d){return sendNotification(![],_0x5f4fa2,_0x580a9e,_0x543193,_0x2ba65d,_0x57145d);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x1789=['online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','\x20interaction','notificationSound','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY'];(function(_0x452fb7,_0x3919ac){var _0x5d6cd4=function(_0x215511){while(--_0x215511){_0x452fb7['push'](_0x452fb7['shift']());}};_0x5d6cd4(++_0x3919ac);}(_0x1789,0x92));var _0x9178=function(_0x1874e5,_0xabe75a){_0x1874e5=_0x1874e5-0x0;var _0x5541f9=_0x1789[_0x1874e5];return _0x5541f9;};'use strict';var _=require(_0x9178('0x0'));var util=require(_0x9178('0x1'));var utils=require(_0x9178('0x2'));var Mustache=require('mustache');var Redis=require(_0x9178('0x3'));var config=require(_0x9178('0x4'));var logger=require(_0x9178('0x5'))(_0x9178('0x6'));config[_0x9178('0x7')]=_['defaults'](config['redis'],{'host':_0x9178('0x8'),'port':0x18eb});var io=require(_0x9178('0x9'))(new Redis(config[_0x9178('0x7')]));function emit(_0x1f00a8,_0x502d21,_0x1001b0){io['to'](_0x1f00a8)[_0x9178('0xa')](_0x502d21,_0x1001b0);}function sendNotification(_0x3bcc1b,_0x31a183,_0x5a75f6,_0x4bd20e,_0x537261,_0xdd2085){io['to'](util[_0x9178('0xb')](_0x9178('0xc'),_0x4bd20e[_0x9178('0xd')]))['emit'](_0x9178('0xe'),_0x4bd20e);var _0x80d440=_0xdd2085||{};var _0x598bea=_0x5a75f6['split']('.');var _0x5b3737={'uniqueid':_0x31a183,'channel':_0x598bea[0x0],'id':_0x598bea[0x1],'title':_0x598bea[0x0]+_0x9178('0xf'),'interactionId':_0x598bea[0x2],'queue':_0x537261?_0x537261[_0x9178('0xd')]:null,'sound':_0x80d440['account'][_0x9178('0x10')],'shake':_0x80d440[_0x9178('0x11')][_0x9178('0x12')]};try{if(!_0x80d440['body']){_0x80d440[_0x9178('0x13')]={};}if(_0x537261){_0x80d440[_0x9178('0x13')]['queue']=_0x537261;}else if(_0x80d440[_0x9178('0x13')]['queue']){delete _0x80d440[_0x9178('0x13')][_0x9178('0x14')];}_0x5b3737[_0x9178('0x15')]=utils[_0x9178('0x16')](_0x80d440[_0x9178('0x11')][_0x9178('0x17')],_0x80d440);}catch(_0x2a9998){_0x5b3737[_0x9178('0x15')]=_0x9178('0x18');logger[_0x9178('0x19')](util[_0x9178('0xb')](_0x9178('0x1a'),_0x31a183,_0x2a9998[_0x9178('0x1b')]));}io['to'](util[_0x9178('0xb')]('user:%s',_0x4bd20e[_0x9178('0xd')]))[_0x9178('0xa')](util['format'](_0x9178('0x1c'),_0x3bcc1b?'save':_0x9178('0x1d')),_0x5b3737);}function writeLog(_0x1de1a2,_0x29bafb,_0x273953){return logger[_0x9178('0x1e')](util[_0x9178('0xb')](_0x9178('0x1f'),_0x1de1a2,_0x29bafb[_0x9178('0xd')],_0x273953));}exports['isAgentAvailable']=function(_0x428118,_0x53995e,_0x497c06,_0x2c40c1){if(_0x53995e[_0x9178('0x20')]){writeLog(_0x428118,_0x53995e,_0x9178('0x21'));return![];}if(!_0x53995e[_0x9178('0x22')]){writeLog(_0x428118,_0x53995e,_0x9178('0x23'));return![];}if(_0x53995e[_0x497c06+_0x9178('0x24')]){writeLog(_0x428118,_0x53995e,_0x9178('0x25'));return![];}if(_0x2c40c1&&_0x53995e[_0x9178('0x26')](_0x497c06+_0x9178('0x27'))&&_0x53995e[_0x9178('0x26')](_0x497c06+_0x9178('0x28'))){if(_0x53995e[_0x497c06+_0x9178('0x27')]>0x0&&_0x53995e[_0x497c06+_0x9178('0x28')]>=_0x53995e[_0x497c06+_0x9178('0x27')]){writeLog(_0x428118,_0x53995e,_0x497c06['toUpperCase']()+_0x9178('0x29'));return![];}}return!![];};exports[_0x9178('0x2a')]=function(_0x5c39ed,_0x417faf,_0x14fa42,_0x39d309,_0x2b977b){return sendNotification(!![],_0x5c39ed,_0x417faf,_0x14fa42,_0x39d309,_0x2b977b);};exports[_0x9178('0x2b')]=function(_0x3b2487,_0x5d9747,_0x267f42,_0x47201c,_0x553a32){return sendNotification(![],_0x3b2487,_0x5d9747,_0x267f42,_0x47201c,_0x553a32);};exports[_0x9178('0x2c')]=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 0e10715..15353e3 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 _0xf7d0=['[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','exec','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','error','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x28e160,_0x47ac9e){var _0x436d87=function(_0x2882de){while(--_0x2882de){_0x28e160['push'](_0x28e160['shift']());}};_0x436d87(++_0x47ac9e);}(_0xf7d0,0x1d6));var _0x0f7d=function(_0x9b5bb2,_0x5db315){_0x9b5bb2=_0x9b5bb2-0x0;var _0x2e1e92=_0xf7d0[_0x9b5bb2];return _0x2e1e92;};'use strict';var schema=require(_0x0f7d('0x0'));var sh=require(_0x0f7d('0x1'));var _=require(_0x0f7d('0x2'));var utils=require(_0x0f7d('0x3'));var logger=require(_0x0f7d('0x4'))(_0x0f7d('0x5'));var system=schema({'command':{'type':_0x0f7d('0x6'),'required':!![],'message':_0x0f7d('0x7')}});exports[_0x0f7d('0x8')]=function(_0x3cc2a6,_0xa24748){return function(_0x609d0){try{var _0x3dce66={'command':_0xa24748[0x0]};var _0x1a727c=system[_0x0f7d('0x0')](_0x3dce66,{'typecast':!![]});if(_0x1a727c[_0x0f7d('0x9')]){logger['error'](_0x0f7d('0xa'),_0x3cc2a6,_[_0x0f7d('0xb')](_0x1a727c,_0x0f7d('0xc'))[_0x0f7d('0xd')](',\x20'));logger[_0x0f7d('0xe')](_0x0f7d('0xf'),_0x3cc2a6);_0x609d0[_0x0f7d('0x10')]();}else{var _0x274d69=this;var _0x50bad1=utils['getMustacheRender'](_0xa24748[0x0],this);logger[_0x0f7d('0xe')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x3cc2a6,_0x50bad1);sh[_0x0f7d('0x11')](_['trim'](_0x50bad1),function(_0xac21cd,_0x5717f1){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x3cc2a6,_0xac21cd);if(_0xac21cd==0x0){var _0x6d1278=_0x5717f1[_0x0f7d('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0xa24748[0x1])||_[_0x0f7d('0x13')](_0xa24748[0x1])){logger[_0x0f7d('0xe')](_0x0f7d('0x14'),_0x3cc2a6);_0x274d69[_0x0f7d('0x15')][_0xa24748[0x1]]=_0x6d1278;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x3cc2a6,_0xa24748[0x1],_0x6d1278);_0x274d69[_0x0f7d('0x15')][_0xa24748[0x1]]=_0x6d1278;}}_0x609d0[_0x0f7d('0x10')]();});}}catch(_0x28c6b2){logger[_0x0f7d('0x16')](_0x0f7d('0xa'),_0x3cc2a6,_['isObject'](_0x28c6b2)?JSON[_0x0f7d('0x17')](_0x28c6b2):_0x28c6b2);logger['info'](_0x0f7d('0xf'),_0x3cc2a6);_0x609d0[_0x0f7d('0x10')]();}};}; \ No newline at end of file +var _0x776d=['join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','validate','shelljs','lodash','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message'];(function(_0x4a0d6f,_0x53e88c){var _0x60aba3=function(_0x18b8e7){while(--_0x18b8e7){_0x4a0d6f['push'](_0x4a0d6f['shift']());}};_0x60aba3(++_0x53e88c);}(_0x776d,0xdc));var _0xd776=function(_0x5bd83a,_0x4b5367){_0x5bd83a=_0x5bd83a-0x0;var _0x358f2d=_0x776d[_0x5bd83a];return _0x358f2d;};'use strict';var schema=require(_0xd776('0x0'));var sh=require(_0xd776('0x1'));var _=require(_0xd776('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xd776('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0xd776('0x4')}});exports[_0xd776('0x5')]=function(_0x5b9193,_0x1f9d5a){return function(_0x17b317){try{var _0x1c67b4={'command':_0x1f9d5a[0x0]};var _0x36f0cc=system[_0xd776('0x0')](_0x1c67b4,{'typecast':!![]});if(_0x36f0cc['length']){logger[_0xd776('0x6')](_0xd776('0x7'),_0x5b9193,_[_0xd776('0x8')](_0x36f0cc,_0xd776('0x9'))[_0xd776('0xa')](',\x20'));logger['info'](_0xd776('0xb'),_0x5b9193);_0x17b317[_0xd776('0xc')]();}else{var _0x444d6d=this;var _0x5a274e=utils[_0xd776('0xd')](_0x1f9d5a[0x0],this);logger[_0xd776('0xe')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x5b9193,_0x5a274e);sh[_0xd776('0xf')](_[_0xd776('0x10')](_0x5a274e),function(_0x249f89,_0x400677){logger[_0xd776('0xe')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x5b9193,_0x249f89);if(_0x249f89==0x0){var _0x40d0cf=_0x400677[_0xd776('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xd776('0x12')](_0x1f9d5a[0x1])||_[_0xd776('0x13')](_0x1f9d5a[0x1])){logger[_0xd776('0xe')](_0xd776('0x14'),_0x5b9193);_0x444d6d[_0xd776('0x15')][_0x1f9d5a[0x1]]=_0x40d0cf;}else{logger[_0xd776('0xe')](_0xd776('0x16'),_0x5b9193,_0x1f9d5a[0x1],_0x40d0cf);_0x444d6d[_0xd776('0x15')][_0x1f9d5a[0x1]]=_0x40d0cf;}}_0x17b317[_0xd776('0xc')]();});}}catch(_0x531000){logger[_0xd776('0x6')](_0xd776('0x7'),_0x5b9193,_['isObject'](_0x531000)?JSON['stringify'](_0x531000):_0x531000);logger[_0xd776('0xe')](_0xd776('0xb'),_0x5b9193);_0x17b317['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 4b7ad7f..5773a67 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 _0x4fa9=['message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','isObject','stringify','validate','lodash','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s'];(function(_0x2b4448,_0x5bcc69){var _0xb4b465=function(_0x5ac741){while(--_0x5ac741){_0x2b4448['push'](_0x2b4448['shift']());}};_0xb4b465(++_0x5bcc69);}(_0x4fa9,0x1e0));var _0x94fa=function(_0x3dfa45,_0xd7170b){_0x3dfa45=_0x3dfa45-0x0;var _0x3383cd=_0x4fa9[_0x3dfa45];return _0x3383cd;};'use strict';var schema=require(_0x94fa('0x0'));var _=require(_0x94fa('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x94fa('0x2')),'mailInteraction':require(_0x94fa('0x3')),'faxInteraction':require(_0x94fa('0x4')),'whatsappInteraction':require(_0x94fa('0x5'))};var logger=require(_0x94fa('0x6'))(_0x94fa('0x7'));var tag=schema({'tag':{'type':_0x94fa('0x8'),'required':!![],'message':_0x94fa('0x9')}});exports[_0x94fa('0xa')]=function(_0x56193d,_0x2abc75,_0x8bceac,_0x3c085c){return function(_0x11afdc){try{var _0x37f245={'tag':_0x2abc75[0x0]};var _0xd07a3=tag['validate'](_0x37f245,{'typecast':!![]});if(_0xd07a3[_0x94fa('0xb')]){logger[_0x94fa('0xc')](_0x94fa('0xd'),_0x56193d,_['map'](_0xd07a3,_0x94fa('0xe'))[_0x94fa('0xf')](',\x20'));logger[_0x94fa('0x10')](_0x94fa('0x11'),_0x56193d);_0x11afdc[_0x94fa('0x12')]();}else{var _0x4eb30d={'ids':[_0x2abc75[0x0]]};if(rpc[_0x3c085c['channel']+_0x94fa('0x13')]){rpc[_0x3c085c[_0x94fa('0x14')]+_0x94fa('0x13')][_0x94fa('0x15')](_0x3c085c[_0x94fa('0x16')]['id'],_0x4eb30d)['then'](function(_0x5b911e){logger[_0x94fa('0x10')](_0x94fa('0x17'),_0x56193d,_0x2abc75[0x1],_0x3c085c['channel'],_0x3c085c[_0x94fa('0x16')]['id']);})['catch'](function(_0x128101){logger[_0x94fa('0xc')]('[%s][TAG]\x20%s',_0x56193d,JSON['stringify'](_0x128101));logger[_0x94fa('0x10')](_0x94fa('0x11'),_0x56193d);})['finally'](function(){_0x11afdc[_0x94fa('0x12')]();});}}}catch(_0x41d899){logger[_0x94fa('0xc')]('[%s][TAG]\x20%s',_0x56193d,_[_0x94fa('0x18')](_0x41d899)?JSON[_0x94fa('0x19')](_0x41d899):_0x41d899);logger[_0x94fa('0x10')](_0x94fa('0x11'),_0x56193d);_0x11afdc[_0x94fa('0x12')]();}};}; \ No newline at end of file +var _0xa313=['map','message','next','channel','Interaction','addTags','interaction','then','info','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s'];(function(_0x4e6668,_0x55889c){var _0x2092d5=function(_0x36ab60){while(--_0x36ab60){_0x4e6668['push'](_0x4e6668['shift']());}};_0x2092d5(++_0x55889c);}(_0xa313,0x74));var _0x3a31=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0xa313[_0x5179a5];return _0x15c8ce;};'use strict';var schema=require(_0x3a31('0x0'));var _=require(_0x3a31('0x1'));var rpc={'chatInteraction':require(_0x3a31('0x2')),'openchannelInteraction':require(_0x3a31('0x3')),'smsInteraction':require(_0x3a31('0x4')),'mailInteraction':require(_0x3a31('0x5')),'faxInteraction':require(_0x3a31('0x6')),'whatsappInteraction':require(_0x3a31('0x7'))};var logger=require('../../../../config/logger')(_0x3a31('0x8'));var tag=schema({'tag':{'type':_0x3a31('0x9'),'required':!![],'message':_0x3a31('0xa')}});exports['consequence']=function(_0x2f9d7d,_0x248cfc,_0x564439,_0x509fa5){return function(_0x486b90){try{var _0xcd973c={'tag':_0x248cfc[0x0]};var _0x1c7221=tag['validate'](_0xcd973c,{'typecast':!![]});if(_0x1c7221[_0x3a31('0xb')]){logger[_0x3a31('0xc')](_0x3a31('0xd'),_0x2f9d7d,_[_0x3a31('0xe')](_0x1c7221,_0x3a31('0xf'))['join'](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2f9d7d);_0x486b90[_0x3a31('0x10')]();}else{var _0x4c8502={'ids':[_0x248cfc[0x0]]};if(rpc[_0x509fa5[_0x3a31('0x11')]+_0x3a31('0x12')]){rpc[_0x509fa5['channel']+'Interaction'][_0x3a31('0x13')](_0x509fa5[_0x3a31('0x14')]['id'],_0x4c8502)[_0x3a31('0x15')](function(_0x40f6db){logger[_0x3a31('0x16')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x2f9d7d,_0x248cfc[0x1],_0x509fa5[_0x3a31('0x11')],_0x509fa5[_0x3a31('0x14')]['id']);})['catch'](function(_0x4e52ee){logger[_0x3a31('0xc')](_0x3a31('0xd'),_0x2f9d7d,JSON[_0x3a31('0x17')](_0x4e52ee));logger[_0x3a31('0x16')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2f9d7d);})[_0x3a31('0x18')](function(){_0x486b90['next']();});}}}catch(_0x2d8ec2){logger['error']('[%s][TAG]\x20%s',_0x2f9d7d,_[_0x3a31('0x19')](_0x2d8ec2)?JSON[_0x3a31('0x17')](_0x2d8ec2):_0x2d8ec2);logger[_0x3a31('0x16')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2f9d7d);_0x486b90[_0x3a31('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 8b44754..7de2bcb 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe714=['result','logged','channelId=','&serviceId=','&sessionId=','&data=','then','parse','next','validate','lodash','request-promise','axios','tough-cookie','passport','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','title','2.0','stringify','utf8','POST','application/json-rpc'];(function(_0x49c7fe,_0x149ce6){var _0xac5ce8=function(_0x4ef0b2){while(--_0x4ef0b2){_0x49c7fe['push'](_0x49c7fe['shift']());}};_0xac5ce8(++_0x149ce6);}(_0xe714,0xe2));var _0x4e71=function(_0x30750d,_0x399e11){_0x30750d=_0x30750d-0x0;var _0x4388c5=_0xe714[_0x30750d];return _0x4388c5;};'use strict';var schema=require(_0x4e71('0x0'));var sh=require('shelljs');var _=require(_0x4e71('0x1'));var rp=require(_0x4e71('0x2'));var axios=require(_0x4e71('0x3'));var tough=require(_0x4e71('0x4'));var utils=require('./utils');const {session}=require(_0x4e71('0x5'));var logger=require('../../../../config/logger')(_0x4e71('0x6'));var system=schema({'command':{'type':_0x4e71('0x7'),'required':!![],'message':_0x4e71('0x8')}});var arr=[];exports[_0x4e71('0x9')]=function(_0xfe1559,_0x1f1d35){return function(_0x55b1cc){var _0x3b0a3a=_0x1f1d35[0xa];var _0x32b6d0=_0x1f1d35[0xb];var _0xda346c=_0x1f1d35[0xc];var _0x564d0f=_0x1f1d35[0xd];var _0x6faa35=_0x1f1d35[0xe];var _0x4fd08b=_0x1f1d35[0xf][_0x4e71('0xa')](/\n/g,_0x4e71('0xb'));var _0x73a271=_0x1f1d35[0x10][_0x4e71('0xa')](/\n/g,'\x20');if(!arr[_0x4e71('0xc')](_0x32b6d0)){arr[_0x4e71('0xd')](_0x32b6d0);var _0x27572b='';var _0x3c7a9b=_0x1f1d35[0x3];var _0x52d45f=_0x1f1d35[0x4];var _0x13c582=_0x1f1d35[0x1];var _0x3772a1=_0x1f1d35[0x0];var _0x585acd={};_0x585acd[_0x4e71('0xe')]=_0x1f1d35[0x8]+_0x4e71('0xf')+_0xda346c+'|'+_0x3b0a3a+'|'+_0x564d0f+'|'+_0x32b6d0+'|'+_0x6faa35;_0x585acd['urlOnRing']=_0x1f1d35[0x7]+_0x4e71('0xf')+_0xda346c+'|'+_0x3b0a3a+'|'+_0x564d0f+'|'+_0x32b6d0+'|'+_0x6faa35+'|'+_0x4fd08b+'|'+_0x73a271;_0x585acd[_0x4e71('0x10')]=_0x1f1d35[0x9];var _0x5a3d88={};_0x5a3d88['jsonrpc']=_0x4e71('0x11');_0x5a3d88['method']='login';var _0x5afe50=[];_0x5afe50[_0x4e71('0xd')](_0x1f1d35[0x2]);_0x5afe50[_0x4e71('0xd')](_0x1f1d35[0x5]);_0x5afe50['push'](_0x1f1d35[0x6]);_0x5a3d88['params']=_0x5afe50;_0x5a3d88['id']=0x1;var _0x190dea=JSON[_0x4e71('0x12')](_0x5a3d88);var _0x196dc7={'encoding':_0x4e71('0x13'),'method':_0x4e71('0x14'),'timeout':0x2710,'url':_0x3c7a9b,'headers':{'Content-Type':_0x4e71('0x15')},'body':_0x190dea};return rp(_0x196dc7)['then'](function(_0x18b745){const _0xd0a59e=JSON['parse'](_0x18b745);if(_0xd0a59e[_0x4e71('0x16')][_0x4e71('0x17')]){var _0x59ac5a=_0x32b6d0;_0x27572b=_0xd0a59e['result']['accessToken'];var _0x2f49ef=_0x4e71('0x18')+_0x13c582+_0x4e71('0x19')+_0x3772a1+_0x4e71('0x1a')+_0x59ac5a+_0x4e71('0x1b')+JSON[_0x4e71('0x12')](_0x585acd);var _0x301648=_0x52d45f+'?'+_0x2f49ef;return rp(_0x301648)[_0x4e71('0x1c')](function(_0x3bd6fc){const _0x335956=JSON[_0x4e71('0x1d')](_0x3bd6fc);});}_0x55b1cc[_0x4e71('0x1e')]();})['catch'](function(_0x5aa6b8){console['log'](_0x5aa6b8);});}else _0x55b1cc['next']();};}; \ No newline at end of file +var _0xfcf0=['axios','tough-cookie','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','replace','\x20-\x20','push','?params=','urlOnRing','title','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','result','logged','channelId=','&sessionId=','&data=','then','parse','next','catch','log','validate','shelljs','request-promise'];(function(_0x2fb0b5,_0x2ed4e1){var _0x5256af=function(_0x59be79){while(--_0x59be79){_0x2fb0b5['push'](_0x2fb0b5['shift']());}};_0x5256af(++_0x2ed4e1);}(_0xfcf0,0x138));var _0x0fcf=function(_0x5aa373,_0x54c7f4){_0x5aa373=_0x5aa373-0x0;var _0x590e8e=_0xfcf0[_0x5aa373];return _0x590e8e;};'use strict';var schema=require(_0x0fcf('0x0'));var sh=require(_0x0fcf('0x1'));var _=require('lodash');var rp=require(_0x0fcf('0x2'));var axios=require(_0x0fcf('0x3'));var tough=require(_0x0fcf('0x4'));var utils=require(_0x0fcf('0x5'));const {session}=require('passport');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var system=schema({'command':{'type':_0x0fcf('0x8'),'required':!![],'message':_0x0fcf('0x9')}});var arr=[];exports[_0x0fcf('0xa')]=function(_0x1a7b03,_0x61bbb9){return function(_0x2dfdf8){var _0x50c575=_0x61bbb9[0xa];var _0x1388d1=_0x61bbb9[0xb];var _0x6ced94=_0x61bbb9[0xc];var _0xa9e007=_0x61bbb9[0xd];var _0x4de593=_0x61bbb9[0xe];var _0x69a840=_0x61bbb9[0xf][_0x0fcf('0xb')](/\n/g,_0x0fcf('0xc'));var _0x4b3923=_0x61bbb9[0x10][_0x0fcf('0xb')](/\n/g,'\x20');if(!arr['includes'](_0x1388d1)){arr[_0x0fcf('0xd')](_0x1388d1);var _0x2317cf='';var _0x201a58=_0x61bbb9[0x3];var _0x48619c=_0x61bbb9[0x4];var _0x5f40fb=_0x61bbb9[0x1];var _0x29336a=_0x61bbb9[0x0];var _0x3c999e={};_0x3c999e['urlOnAnswer']=_0x61bbb9[0x8]+_0x0fcf('0xe')+_0x6ced94+'|'+_0x50c575+'|'+_0xa9e007+'|'+_0x1388d1+'|'+_0x4de593;_0x3c999e[_0x0fcf('0xf')]=_0x61bbb9[0x7]+_0x0fcf('0xe')+_0x6ced94+'|'+_0x50c575+'|'+_0xa9e007+'|'+_0x1388d1+'|'+_0x4de593+'|'+_0x69a840+'|'+_0x4b3923;_0x3c999e[_0x0fcf('0x10')]=_0x61bbb9[0x9];var _0x25fadc={};_0x25fadc['jsonrpc']=_0x0fcf('0x11');_0x25fadc[_0x0fcf('0x12')]=_0x0fcf('0x13');var _0x5e867f=[];_0x5e867f[_0x0fcf('0xd')](_0x61bbb9[0x2]);_0x5e867f[_0x0fcf('0xd')](_0x61bbb9[0x5]);_0x5e867f[_0x0fcf('0xd')](_0x61bbb9[0x6]);_0x25fadc[_0x0fcf('0x14')]=_0x5e867f;_0x25fadc['id']=0x1;var _0x48dd53=JSON[_0x0fcf('0x15')](_0x25fadc);var _0x2f8289={'encoding':_0x0fcf('0x16'),'method':_0x0fcf('0x17'),'timeout':0x2710,'url':_0x201a58,'headers':{'Content-Type':_0x0fcf('0x18')},'body':_0x48dd53};return rp(_0x2f8289)['then'](function(_0x18ea32){const _0x1a8f58=JSON['parse'](_0x18ea32);if(_0x1a8f58[_0x0fcf('0x19')][_0x0fcf('0x1a')]){var _0x4da7e3=_0x1388d1;_0x2317cf=_0x1a8f58[_0x0fcf('0x19')]['accessToken'];var _0x3fc9e6=_0x0fcf('0x1b')+_0x5f40fb+'&serviceId='+_0x29336a+_0x0fcf('0x1c')+_0x4da7e3+_0x0fcf('0x1d')+JSON[_0x0fcf('0x15')](_0x3c999e);var _0x5c459c=_0x48619c+'?'+_0x3fc9e6;return rp(_0x5c459c)[_0x0fcf('0x1e')](function(_0x1dafc8){const _0x196d30=JSON[_0x0fcf('0x1f')](_0x1dafc8);});}_0x2dfdf8[_0x0fcf('0x20')]();})[_0x0fcf('0x21')](function(_0x5841a9){console[_0x0fcf('0x22')](_0x5841a9);});}else _0x2dfdf8[_0x0fcf('0x20')]();};}; \ 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 e2bb6a9..23c82f2 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 _0xee39=['interaction','list','mustache','lodash','exports','render','merge','body','contact','message','account'];(function(_0x22a4a2,_0x39b501){var _0x42c46f=function(_0x3c8ec4){while(--_0x3c8ec4){_0x22a4a2['push'](_0x22a4a2['shift']());}};_0x42c46f(++_0x39b501);}(_0xee39,0x1e6));var _0x9ee3=function(_0x579feb,_0x528ae6){_0x579feb=_0x579feb-0x0;var _0x1b6bba=_0xee39[_0x579feb];return _0x1b6bba;};'use strict';var Mustache=require(_0x9ee3('0x0'));var _=require(_0x9ee3('0x1'));module[_0x9ee3('0x2')]={'getMustacheRender':function(_0x58cf62,_0x39e617){return Mustache[_0x9ee3('0x3')](_0x58cf62,_[_0x9ee3('0x4')](_0x39e617[_0x9ee3('0x5')],{'contact':_0x39e617[_0x9ee3('0x6')],'message':_0x39e617[_0x9ee3('0x7')],'account':_0x39e617[_0x9ee3('0x8')],'interaction':_0x39e617[_0x9ee3('0x9')],'list':_0x39e617[_0x9ee3('0xa')]}))||'';}}; \ No newline at end of file +var _0x899a=['merge','body','contact','message','interaction','list','mustache','lodash'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x899a,0x1b6));var _0xa899=function(_0x15322f,_0x1df4f9){_0x15322f=_0x15322f-0x0;var _0x2bcb76=_0x899a[_0x15322f];return _0x2bcb76;};'use strict';var Mustache=require(_0xa899('0x0'));var _=require(_0xa899('0x1'));module['exports']={'getMustacheRender':function(_0x26e9a7,_0x3f08ab){return Mustache['render'](_0x26e9a7,_[_0xa899('0x2')](_0x3f08ab[_0xa899('0x3')],{'contact':_0x3f08ab[_0xa899('0x4')],'message':_0x3f08ab[_0xa899('0x5')],'account':_0x3f08ab['account'],'interaction':_0x3f08ab[_0xa899('0x6')],'list':_0x3f08ab[_0xa899('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 1aa3e5c..51d5764 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 _0xb458=['applications','isArray','length','existsSync','join','app','.js','toLowerCase','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','consequence','priority','info','on\x20interval','\x20|\x20','error','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','uuid','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','map','Intervals','interval','listen','rules','channel','message','interaction'];(function(_0x23f15c,_0x497062){var _0x3ebbec=function(_0x50c55e){while(--_0x50c55e){_0x23f15c['push'](_0x23f15c['shift']());}};_0x3ebbec(++_0x497062);}(_0xb458,0x103));var _0x8b45=function(_0x565dfa,_0x5ca74b){_0x565dfa=_0x565dfa-0x0;var _0x3d8102=_0xb458[_0x565dfa];return _0x3d8102;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var uuid=require(_0x8b45('0x3'));var config=require(_0x8b45('0x4'));var logger=require(_0x8b45('0x5'))(_0x8b45('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x8b45('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x8b45('0x8')),'whatsappQueueReport':require(_0x8b45('0x9'))};var RuleEngine=require(_0x8b45('0xa'));function getId(_0x3a8ccb,_0x32342f,_0x4d1718){return util[_0x8b45('0xb')](_0x8b45('0xc'),_0x3a8ccb,_0x32342f||0x0,_0x4d1718||0x0);}function getIntervals(_0x33f30e,_0x2bc809){var _0x2f7117=[];if(!_['isNil'](_0x2bc809[_0x8b45('0xd')])&&!_[_0x8b45('0xe')](_0x33f30e[_0x2bc809['IntervalId']])&&!_['isNil'](_0x33f30e[_0x2bc809['IntervalId']]['Intervals'])){_0x2f7117=_[_0x8b45('0xf')](_0x33f30e[_0x2bc809[_0x8b45('0xd')]][_0x8b45('0x10')],'interval');}else if(!_[_0x8b45('0xe')](_0x2bc809[_0x8b45('0x11')])){_0x2f7117=[_0x2bc809[_0x8b45('0x11')]];}return _0x2f7117;}exports[_0x8b45('0x12')]=function(_0x32babc){_0x32babc[_0x8b45('0x13')]={};return new BPromise(function(_0x5f0b20,_0x5a14c1){var _0x45881c={'Start':function(_0x23f1dd){var _0x445170=this;return new Promise(function(_0x39c1d1,_0x4781d7){if(_0x23f1dd){try{var _0x27ebb3=[];var _0x902c50=getId(_0x23f1dd[_0x8b45('0x14')],_0x23f1dd[_0x8b45('0x15')]?_0x23f1dd[_0x8b45('0x15')]['id']:0x0,_0x23f1dd[_0x8b45('0x16')]?_0x23f1dd[_0x8b45('0x16')]['id']:0x0);if(_0x23f1dd[_0x8b45('0x17')]&&_[_0x8b45('0x18')](_0x23f1dd[_0x8b45('0x17')])&&_0x23f1dd[_0x8b45('0x17')][_0x8b45('0x19')]){for(var _0x309e23=0x0;_0x309e23<_0x23f1dd['applications'][_0x8b45('0x19')];_0x309e23+=0x1){var _0x2db2d1=_0x23f1dd[_0x8b45('0x17')][_0x309e23];if(fs[_0x8b45('0x1a')](path[_0x8b45('0x1b')](__dirname,_0x8b45('0x17'),_0x2db2d1[_0x8b45('0x1c')]+_0x8b45('0x1d')))){var _0x563c50=[];switch(_0x2db2d1['app'][_0x8b45('0x1e')]()){case'autoreply':var _0x1952fc=_0x2db2d1[_0x8b45('0x1f')][_0x8b45('0x20')](',');if(_0x23f1dd[_0x8b45('0x14')]===_0x8b45('0x21')){_0x563c50[_0x8b45('0x22')](_0x1952fc[0x0]);_0x563c50[_0x8b45('0x22')](_0x1952fc[0x1]);_0x563c50['push'](_0x1952fc['slice'](0x2,_0x1952fc[_0x8b45('0x19')])[_0x8b45('0x1b')](','));}else{_0x563c50['push'](_0x1952fc[0x0]);_0x563c50['push'](_0x1952fc[_0x8b45('0x23')](0x1,_0x1952fc[_0x8b45('0x19')])[_0x8b45('0x1b')](','));}break;case _0x8b45('0x24'):var _0x4e84cc=_0x2db2d1[_0x8b45('0x1f')][_0x8b45('0x20')](',');_0x563c50[_0x8b45('0x22')](_0x4e84cc[0x0]);_0x563c50[_0x8b45('0x22')](_0x4e84cc[0x1]);_0x563c50[_0x8b45('0x22')](_0x4e84cc[_0x8b45('0x23')](0x2,_0x4e84cc[_0x8b45('0x19')])[_0x8b45('0x1b')](','));break;case _0x8b45('0x25'):var _0xf21bd1=_0x2db2d1[_0x8b45('0x1f')][_0x8b45('0x20')](',');_0x563c50[_0x8b45('0x22')](_0xf21bd1[0x0]);_0x563c50['push'](_0xf21bd1[0x1]);_0x563c50[_0x8b45('0x22')](_0xf21bd1[0x2]);_0x563c50[_0x8b45('0x22')](_0xf21bd1[0x3]);_0x563c50[_0x8b45('0x22')](_0xf21bd1[_0x8b45('0x23')](0x4,_0xf21bd1[_0x8b45('0x19')])[_0x8b45('0x1b')](','));break;case _0x8b45('0x26'):var _0x4216bf=_0x2db2d1['appdata'][_0x8b45('0x20')](',');_0x563c50[_0x8b45('0x22')](_0x4216bf[0x0]);_0x563c50[_0x8b45('0x22')](_0x4216bf[0x1]);_0x563c50[_0x8b45('0x22')](_0x4216bf[0x2]);_0x563c50[_0x8b45('0x22')](_0x4216bf[0x3]);_0x563c50['push'](_0x4216bf[_0x8b45('0x23')](0x4,_0x4216bf['length'])['join'](','));break;case _0x8b45('0x15'):_0x563c50[_0x8b45('0x22')](_0x2db2d1[_0x8b45('0x1f')]);break;case _0x8b45('0x27'):_0x563c50[_0x8b45('0x22')](_0x2db2d1[_0x8b45('0x28')]);_0x563c50['push'](_0x2db2d1[_0x8b45('0x1f')]);break;default:_0x563c50=_[_0x8b45('0xe')](_0x2db2d1[_0x8b45('0x1f')])?[]:_0x2db2d1[_0x8b45('0x1f')]['split'](',');}var _0x1b6fba={'id':util[_0x8b45('0xb')](_0x8b45('0x29'),_0x902c50,_0x2db2d1['id'],_0x2db2d1['app']),'condition':require(_0x8b45('0x2a'))[_0x8b45('0x2b')](_0x902c50,getIntervals(_0x32babc[_0x8b45('0x2c')],_0x2db2d1),_0x32babc),'consequence':require('./applications/'+_0x2db2d1[_0x8b45('0x1c')])[_0x8b45('0x2d')](_0x902c50,_0x563c50,_0x32babc,_0x23f1dd),'p':_0x2db2d1[_0x8b45('0x2e')]||0x0};logger[_0x8b45('0x2f')]('Push\x20new\x20rule',_0x1b6fba['id'],_0x8b45('0x30'),getIntervals(_0x32babc[_0x8b45('0x2c')],_0x2db2d1)[_0x8b45('0x1b')](_0x8b45('0x31')));_0x27ebb3[_0x8b45('0x22')](_0x1b6fba);}else{logger[_0x8b45('0x32')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0x8b45('0x17'),_0x2db2d1[_0x8b45('0x1c')]+_0x8b45('0x1d')));}}_0x32babc[_0x8b45('0x13')][_0x902c50]=new RuleEngine(_0x27ebb3);_0x32babc[_0x8b45('0x13')][_0x902c50]['execute'](_0x23f1dd,function(_0x120068){logger['info'](_0x8b45('0x33'),JSON[_0x8b45('0x34')](_0x120068[_0x8b45('0x35')]));if(_0x32babc[_0x8b45('0x13')][_0x902c50]){_0x32babc[_0x8b45('0x13')][_0x902c50][_0x8b45('0x36')](_0x8b45('0x37'));}});return _0x39c1d1({'code':0xc8,'message':_0x23f1dd});}else{logger[_0x8b45('0x2f')](_0x8b45('0x38'));return _0x39c1d1({'code':0xc8,'message':_0x23f1dd});}}catch(_0x2ca00e){logger[_0x8b45('0x32')](_0x2ca00e['stack']);return _0x4781d7(_0x445170[_0x8b45('0x32')](0x1f4,_0x2ca00e));}}return _0x4781d7('routing\x20is\x20empty');});},'AcceptMessage':function(_0x267dc3){var _0x4eda71=this;return new Promise(function(_0x412c53,_0x224c45){if(_0x267dc3[_0x8b45('0x39')]&&_0x267dc3[_0x8b45('0x39')]['id']){if(_0x32babc[_0x8b45('0x3a')][_0x267dc3[_0x8b45('0x39')]['id']]){_0x32babc['agents'][_0x267dc3[_0x8b45('0x39')]['id']]['busy']=![];_0x32babc['agents'][_0x267dc3[_0x8b45('0x39')]['id']][_0x8b45('0x3b')]=undefined;}}if(_0x267dc3[_0x8b45('0x15')]&&_0x267dc3['message']['id']){try{var _0x1f12cb=getId(_0x267dc3['channel'],_0x267dc3[_0x8b45('0x15')]?_0x267dc3[_0x8b45('0x15')]['id']:0x0,_0x267dc3[_0x8b45('0x16')]?_0x267dc3[_0x8b45('0x16')]['id']:0x0);if(_0x32babc[_0x8b45('0x13')][_0x1f12cb]){_0x32babc[_0x8b45('0x13')][_0x1f12cb]['emit'](_0x8b45('0x3c'));if(rpc[_0x267dc3[_0x8b45('0x14')]+_0x8b45('0x3d')]){rpc[_0x267dc3[_0x8b45('0x14')]+_0x8b45('0x3d')][_0x8b45('0x3e')](_0x1f12cb,{'UserId':_0x267dc3[_0x8b45('0x15')][_0x8b45('0x3f')]})[_0x8b45('0x40')](function(_0x462b51){logger[_0x8b45('0x32')](_0x8b45('0x41'));});}}return _0x412c53({'code':0xc8,'message':_0x267dc3});}catch(_0x1a87e4){logger[_0x8b45('0x32')](_0x1a87e4[_0x8b45('0x42')]);return _0x224c45(_0x4eda71[_0x8b45('0x32')](0x1f4,_0x1a87e4));}}logger['error']('message\x20is\x20empty');return _0x224c45(_0x4eda71['error'](0x1f4,_0x8b45('0x43')));});},'RejectMessage':function(_0x214e28){var _0x3a1621=this;return new Promise(function(_0x473530,_0x269a06){if(_0x214e28[_0x8b45('0x39')]&&_0x214e28[_0x8b45('0x39')]['id']){try{if(_0x32babc[_0x8b45('0x3a')][_0x214e28['agent']['id']]){_0x32babc[_0x8b45('0x3a')][_0x214e28['agent']['id']][_0x8b45('0x44')]=![];_0x32babc[_0x8b45('0x3a')][_0x214e28[_0x8b45('0x39')]['id']][_0x8b45('0x3b')]=undefined;}return _0x473530({'code':0xc8,'message':_0x214e28});}catch(_0x51c87d){logger[_0x8b45('0x32')](_0x51c87d[_0x8b45('0x42')]);return _0x269a06(_0x3a1621['error'](0x1f4,_0x51c87d));}}logger[_0x8b45('0x32')](_0x8b45('0x43'));return _0x269a06(_0x3a1621['error'](0x1f4,_0x8b45('0x43')));});},'AbandonInteraction':function(_0x5758c){var _0x28e8f4=this;return new Promise(function(_0x3b4a4f,_0x219cc0){if(_0x5758c[_0x8b45('0x14')]&&_0x5758c['interaction']&&_0x5758c['interaction']['id']){try{var _0x3f7a16=getId(_0x5758c[_0x8b45('0x14')],_0x5758c[_0x8b45('0x15')]?_0x5758c['message']['id']:0x0,_0x5758c[_0x8b45('0x16')]?_0x5758c[_0x8b45('0x16')]['id']:0x0);if(_0x32babc[_0x8b45('0x13')][_0x3f7a16]){_0x32babc[_0x8b45('0x13')][_0x3f7a16][_0x8b45('0x36')]('end');}return _0x3b4a4f({'code':0xc8,'message':_0x5758c});}catch(_0x34c05d){logger[_0x8b45('0x32')](_0x34c05d['stack']);return _0x219cc0(_0x28e8f4[_0x8b45('0x32')](0x1f4,_0x34c05d));}}logger['error'](_0x8b45('0x43'));return _0x219cc0(_0x28e8f4[_0x8b45('0x32')](0x1f4,_0x8b45('0x43')));});},'AgentCapacity':function(_0x39a609){var _0x5609a8=this;return new Promise(function(_0xb9f390,_0x423231){if(_0x32babc[_0x8b45('0x3a')][_0x8b45('0x45')](_0x39a609['id'])){for(var _0x3e3df2 in _0x39a609[_0x8b45('0x46')]){if(_0x39a609[_0x8b45('0x46')][_0x8b45('0x45')](_0x3e3df2)){if(_0x32babc[_0x8b45('0x3a')][_0x39a609['id']][_0x8b45('0x45')](_0x3e3df2+_0x8b45('0x47'))){_0x32babc[_0x8b45('0x3a')][_0x39a609['id']][_0x3e3df2+_0x8b45('0x47')]=parseInt(_0x39a609[_0x8b45('0x46')][_0x3e3df2],0xa);}}}_0x32babc[_0x8b45('0x3a')][_0x39a609['id']]['updateRealtime']();return _0xb9f390({'code':0xc8,'message':_0x32babc[_0x8b45('0x3a')][_0x39a609['id']]});}else{return _0x423231(_0x5609a8[_0x8b45('0x32')](0x1f4,_0x8b45('0x48')));}});},'Agents':function(_0x5950ac){return new Promise(function(_0x29fde9,_0x44406e){var _0x3d7efe=_[_0x8b45('0x49')](_0x32babc['agents']);_0x29fde9({'count':_0x3d7efe[_0x8b45('0x19')],'rows':_0x3d7efe});});},'ChatQueues':function(_0x1a8822){return new Promise(function(_0x1d99bb,_0xbb5e67){var _0x5257a1=[];for(var _0x14a085 in _0x32babc[_0x8b45('0x4a')]){if(_0x32babc[_0x8b45('0x4a')][_0x8b45('0x45')](_0x14a085)){var _0x3488d1=_0x32babc['chatQueues'][_0x14a085];var _0x7d0053={'id':_0x3488d1['id'],'available':_0x3488d1['available'],'loggedIn':_0x3488d1[_0x8b45('0x4b')],'name':_0x3488d1[_0x8b45('0x4c')],'paused':_0x3488d1[_0x8b45('0x4d')],'waiting':_0x3488d1[_0x8b45('0x4e')]};_0x5257a1[_0x8b45('0x22')](_0x7d0053);}}_0x1d99bb({'count':_0x5257a1[_0x8b45('0x19')],'rows':_0x5257a1});});},'MailQueues':function(_0x54df4d){return new Promise(function(_0x5b8ebe,_0x5ace1){var _0x2224b7=[];for(var _0x592d0c in _0x32babc[_0x8b45('0x4f')]){if(_0x32babc[_0x8b45('0x4f')][_0x8b45('0x45')](_0x592d0c)){var _0x555796=_0x32babc['mailQueues'][_0x592d0c];var _0x11b405={'id':_0x555796['id'],'available':_0x555796[_0x8b45('0x50')],'loggedIn':_0x555796['loggedIn'],'name':_0x555796[_0x8b45('0x4c')],'paused':_0x555796['paused'],'waiting':_0x555796[_0x8b45('0x4e')]};_0x2224b7['push'](_0x11b405);}}_0x5b8ebe({'count':_0x2224b7['length'],'rows':_0x2224b7});});},'OpenchannelQueues':function(_0x28e57a){return new Promise(function(_0x7f5a4e,_0x4efa17){var _0x324592=[];for(var _0x73ec44 in _0x32babc[_0x8b45('0x51')]){if(_0x32babc[_0x8b45('0x51')][_0x8b45('0x45')](_0x73ec44)){var _0x54669b=_0x32babc[_0x8b45('0x51')][_0x73ec44];var _0x3b3d21={'id':_0x54669b['id'],'available':_0x54669b[_0x8b45('0x50')],'loggedIn':_0x54669b['loggedIn'],'name':_0x54669b['name'],'paused':_0x54669b[_0x8b45('0x4d')],'waiting':_0x54669b['waiting']};_0x324592[_0x8b45('0x22')](_0x3b3d21);}}_0x7f5a4e({'count':_0x324592['length'],'rows':_0x324592});});},'SmsQueues':function(_0x566637){return new Promise(function(_0x5da10c,_0x2e3d2f){var _0x4df581=[];for(var _0x3c31e8 in _0x32babc[_0x8b45('0x52')]){if(_0x32babc['smsQueues'][_0x8b45('0x45')](_0x3c31e8)){var _0x1b3890=_0x32babc['smsQueues'][_0x3c31e8];var _0x4352f9={'id':_0x1b3890['id'],'available':_0x1b3890[_0x8b45('0x50')],'loggedIn':_0x1b3890[_0x8b45('0x4b')],'name':_0x1b3890[_0x8b45('0x4c')],'paused':_0x1b3890[_0x8b45('0x4d')],'waiting':_0x1b3890[_0x8b45('0x4e')]};_0x4df581[_0x8b45('0x22')](_0x4352f9);}}_0x5da10c({'count':_0x4df581[_0x8b45('0x19')],'rows':_0x4df581});});},'FaxQueues':function(_0x71338f){return new Promise(function(_0x103d80,_0x362a4a){var _0x4232f1=[];for(var _0x4a11ac in _0x32babc[_0x8b45('0x53')]){if(_0x32babc[_0x8b45('0x53')][_0x8b45('0x45')](_0x4a11ac)){var _0x8d9143=_0x32babc[_0x8b45('0x53')][_0x4a11ac];var _0x304e7d={'id':_0x8d9143['id'],'available':_0x8d9143[_0x8b45('0x50')],'loggedIn':_0x8d9143[_0x8b45('0x4b')],'name':_0x8d9143[_0x8b45('0x4c')],'paused':_0x8d9143[_0x8b45('0x4d')],'waiting':_0x8d9143[_0x8b45('0x4e')]};_0x4232f1[_0x8b45('0x22')](_0x304e7d);}}_0x103d80({'count':_0x4232f1[_0x8b45('0x19')],'rows':_0x4232f1});});},'WhatsappQueues':function(_0x25c3b8){return new Promise(function(_0x562c5f,_0x53143d){var _0x317053=[];for(var _0xd30026 in _0x32babc[_0x8b45('0x54')]){if(_0x32babc[_0x8b45('0x54')][_0x8b45('0x45')](_0xd30026)){var _0xd88538=_0x32babc[_0x8b45('0x54')][_0xd30026];var _0x1e7c12={'id':_0xd88538['id'],'available':_0xd88538['available'],'loggedIn':_0xd88538[_0x8b45('0x4b')],'name':_0xd88538[_0x8b45('0x4c')],'paused':_0xd88538[_0x8b45('0x4d')],'waiting':_0xd88538[_0x8b45('0x4e')]};_0x317053[_0x8b45('0x22')](_0x1e7c12);}}_0x562c5f({'count':_0x317053[_0x8b45('0x19')],'rows':_0x317053});});},'ChatQueuesWaitingInteractions':function(_0xd5a325){return new Promise(function(_0x9b123d,_0x2a6fee){var _0xd19d7c=_[_0x8b45('0x49')](_0x32babc['chatQueuesWaitingInteractions']);_0x9b123d({'count':_0xd19d7c['length'],'rows':_0xd19d7c});});},'MailQueuesWaitingInteractions':function(_0x3318a2){return new Promise(function(_0x28a909,_0x426a97){var _0x36e5e7=_[_0x8b45('0x49')](_0x32babc[_0x8b45('0x55')]);_0x28a909({'count':_0x36e5e7[_0x8b45('0x19')],'rows':_0x36e5e7});});},'OpenchannelQueuesWaitingInteractions':function(_0x189be2){return new Promise(function(_0x63ab53,_0x4b3fb3){var _0x55acf0=_[_0x8b45('0x49')](_0x32babc[_0x8b45('0x56')]);_0x63ab53({'count':_0x55acf0[_0x8b45('0x19')],'rows':_0x55acf0});});},'SmsQueuesWaitingInteractions':function(_0x271ed8){return new Promise(function(_0x55bafb,_0x274220){var _0x47214c=_[_0x8b45('0x49')](_0x32babc[_0x8b45('0x57')]);_0x55bafb({'count':_0x47214c[_0x8b45('0x19')],'rows':_0x47214c});});},'FaxQueuesWaitingInteractions':function(_0x17588b){return new Promise(function(_0x4ed113,_0x59bd54){var _0x2e6f36=_['values'](_0x32babc['faxQueuesWaitingInteractions']);_0x4ed113({'count':_0x2e6f36['length'],'rows':_0x2e6f36});});},'WhatsappQueuesWaitingInteractions':function(_0xf602c7){return new Promise(function(_0x170b95,_0xcc1330){var _0x1e7a9c=_[_0x8b45('0x49')](_0x32babc[_0x8b45('0x58')]);_0x170b95({'count':_0x1e7a9c[_0x8b45('0x19')],'rows':_0x1e7a9c});});}};var _0xc9be77=jayson[_0x8b45('0x59')](_0x45881c)[_0x8b45('0x5a')]();_0xc9be77['on'](_0x8b45('0x32'),function(_0x33b689){logger[_0x8b45('0x32')](JSON[_0x8b45('0x34')](_0x33b689));return _0x5a14c1(_0x33b689);});_0xc9be77[_0x8b45('0x12')](0x232c,'127.0.0.1',function(){console[_0x8b45('0x5b')](_0x8b45('0x5c'),0x232c);return _0x5f0b20(_0x8b45('0x5d')+0x232c);});});}; \ No newline at end of file +var _0x2d17=['whatsappQueues','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','applications','isArray','length','existsSync','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','join','dialogflowv2','amazonlex','TagId','format','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','app','.js','execute','Applications\x20executed','stringify','matchPath','emit','complete','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','message\x20is\x20empty','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','openchannelQueues','name','smsQueues','faxQueues'];(function(_0x2b11f3,_0x496304){var _0x5caba3=function(_0x34249e){while(--_0x34249e){_0x2b11f3['push'](_0x2b11f3['shift']());}};_0x5caba3(++_0x496304);}(_0x2d17,0x17e));var _0x72d1=function(_0x143100,_0x447c51){_0x143100=_0x143100-0x0;var _0x1e926e=_0x2d17[_0x143100];return _0x1e926e;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x72d1('0x2'));var BPromise=require(_0x72d1('0x3'));var uuid=require('uuid');var config=require(_0x72d1('0x4'));var logger=require(_0x72d1('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0x72d1('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x72d1('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x72d1('0x8')),'whatsappQueueReport':require(_0x72d1('0x9'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x477264,_0x422f5a,_0x19e248){return util['format'](_0x72d1('0xa'),_0x477264,_0x422f5a||0x0,_0x19e248||0x0);}function getIntervals(_0x288362,_0x283775){var _0x593c91=[];if(!_[_0x72d1('0xb')](_0x283775[_0x72d1('0xc')])&&!_[_0x72d1('0xb')](_0x288362[_0x283775[_0x72d1('0xc')]])&&!_[_0x72d1('0xb')](_0x288362[_0x283775[_0x72d1('0xc')]][_0x72d1('0xd')])){_0x593c91=_[_0x72d1('0xe')](_0x288362[_0x283775[_0x72d1('0xc')]][_0x72d1('0xd')],'interval');}else if(!_[_0x72d1('0xb')](_0x283775[_0x72d1('0xf')])){_0x593c91=[_0x283775[_0x72d1('0xf')]];}return _0x593c91;}exports[_0x72d1('0x10')]=function(_0x22ac6f){_0x22ac6f[_0x72d1('0x11')]={};return new BPromise(function(_0x143718,_0x383bb){var _0x172fae={'Start':function(_0x3f190f){var _0x21c85e=this;return new Promise(function(_0x23a238,_0x8d458){if(_0x3f190f){try{var _0x491af4=[];var _0x46fa3d=getId(_0x3f190f['channel'],_0x3f190f[_0x72d1('0x12')]?_0x3f190f[_0x72d1('0x12')]['id']:0x0,_0x3f190f['interaction']?_0x3f190f[_0x72d1('0x13')]['id']:0x0);if(_0x3f190f[_0x72d1('0x14')]&&_[_0x72d1('0x15')](_0x3f190f['applications'])&&_0x3f190f['applications'][_0x72d1('0x16')]){for(var _0x10d464=0x0;_0x10d464<_0x3f190f[_0x72d1('0x14')][_0x72d1('0x16')];_0x10d464+=0x1){var _0x8d6890=_0x3f190f[_0x72d1('0x14')][_0x10d464];if(fs[_0x72d1('0x17')](path['join'](__dirname,_0x72d1('0x14'),_0x8d6890['app']+'.js'))){var _0x5b85cc=[];switch(_0x8d6890['app'][_0x72d1('0x18')]()){case _0x72d1('0x19'):var _0x573c98=_0x8d6890[_0x72d1('0x1a')][_0x72d1('0x1b')](',');if(_0x3f190f[_0x72d1('0x1c')]===_0x72d1('0x1d')){_0x5b85cc[_0x72d1('0x1e')](_0x573c98[0x0]);_0x5b85cc['push'](_0x573c98[0x1]);_0x5b85cc['push'](_0x573c98[_0x72d1('0x1f')](0x2,_0x573c98[_0x72d1('0x16')])[_0x72d1('0x20')](','));}else{_0x5b85cc[_0x72d1('0x1e')](_0x573c98[0x0]);_0x5b85cc[_0x72d1('0x1e')](_0x573c98[_0x72d1('0x1f')](0x1,_0x573c98[_0x72d1('0x16')])['join'](','));}break;case'dialogflow':var _0x1ba258=_0x8d6890['appdata'][_0x72d1('0x1b')](',');_0x5b85cc[_0x72d1('0x1e')](_0x1ba258[0x0]);_0x5b85cc[_0x72d1('0x1e')](_0x1ba258[0x1]);_0x5b85cc['push'](_0x1ba258[_0x72d1('0x1f')](0x2,_0x1ba258['length'])[_0x72d1('0x20')](','));break;case _0x72d1('0x21'):var _0x32588f=_0x8d6890[_0x72d1('0x1a')]['split'](',');_0x5b85cc[_0x72d1('0x1e')](_0x32588f[0x0]);_0x5b85cc['push'](_0x32588f[0x1]);_0x5b85cc[_0x72d1('0x1e')](_0x32588f[0x2]);_0x5b85cc[_0x72d1('0x1e')](_0x32588f[0x3]);_0x5b85cc['push'](_0x32588f[_0x72d1('0x1f')](0x4,_0x32588f[_0x72d1('0x16')])[_0x72d1('0x20')](','));break;case _0x72d1('0x22'):var _0x379c00=_0x8d6890['appdata'][_0x72d1('0x1b')](',');_0x5b85cc[_0x72d1('0x1e')](_0x379c00[0x0]);_0x5b85cc[_0x72d1('0x1e')](_0x379c00[0x1]);_0x5b85cc['push'](_0x379c00[0x2]);_0x5b85cc[_0x72d1('0x1e')](_0x379c00[0x3]);_0x5b85cc[_0x72d1('0x1e')](_0x379c00['slice'](0x4,_0x379c00[_0x72d1('0x16')])[_0x72d1('0x20')](','));break;case _0x72d1('0x12'):_0x5b85cc['push'](_0x8d6890[_0x72d1('0x1a')]);break;case'tag':_0x5b85cc[_0x72d1('0x1e')](_0x8d6890[_0x72d1('0x23')]);_0x5b85cc[_0x72d1('0x1e')](_0x8d6890[_0x72d1('0x1a')]);break;default:_0x5b85cc=_[_0x72d1('0xb')](_0x8d6890[_0x72d1('0x1a')])?[]:_0x8d6890[_0x72d1('0x1a')][_0x72d1('0x1b')](',');}var _0x4006b9={'id':util[_0x72d1('0x24')](_0x72d1('0x25'),_0x46fa3d,_0x8d6890['id'],_0x8d6890['app']),'condition':require(_0x72d1('0x26'))[_0x72d1('0x27')](_0x46fa3d,getIntervals(_0x22ac6f[_0x72d1('0x28')],_0x8d6890),_0x22ac6f),'consequence':require(_0x72d1('0x29')+_0x8d6890['app'])[_0x72d1('0x2a')](_0x46fa3d,_0x5b85cc,_0x22ac6f,_0x3f190f),'p':_0x8d6890[_0x72d1('0x2b')]||0x0};logger[_0x72d1('0x2c')]('Push\x20new\x20rule',_0x4006b9['id'],_0x72d1('0x2d'),getIntervals(_0x22ac6f[_0x72d1('0x28')],_0x8d6890)[_0x72d1('0x20')]('\x20|\x20'));_0x491af4[_0x72d1('0x1e')](_0x4006b9);}else{logger[_0x72d1('0x2e')](_0x72d1('0x2f'),path['join'](__dirname,_0x72d1('0x14'),_0x8d6890[_0x72d1('0x30')]+_0x72d1('0x31')));}}_0x22ac6f[_0x72d1('0x11')][_0x46fa3d]=new RuleEngine(_0x491af4);_0x22ac6f[_0x72d1('0x11')][_0x46fa3d][_0x72d1('0x32')](_0x3f190f,function(_0xd7ec0f){logger['info'](_0x72d1('0x33'),JSON[_0x72d1('0x34')](_0xd7ec0f[_0x72d1('0x35')]));if(_0x22ac6f[_0x72d1('0x11')][_0x46fa3d]){_0x22ac6f[_0x72d1('0x11')][_0x46fa3d][_0x72d1('0x36')](_0x72d1('0x37'));}});return _0x23a238({'code':0xc8,'message':_0x3f190f});}else{logger[_0x72d1('0x2c')]('No\x20applications\x20to\x20execute');return _0x23a238({'code':0xc8,'message':_0x3f190f});}}catch(_0x44d5b2){logger[_0x72d1('0x2e')](_0x44d5b2[_0x72d1('0x38')]);return _0x8d458(_0x21c85e[_0x72d1('0x2e')](0x1f4,_0x44d5b2));}}return _0x8d458(_0x72d1('0x39'));});},'AcceptMessage':function(_0x88b9b9){var _0xb911fa=this;return new Promise(function(_0x3620df,_0x5620f0){if(_0x88b9b9['agent']&&_0x88b9b9[_0x72d1('0x3a')]['id']){if(_0x22ac6f[_0x72d1('0x3b')][_0x88b9b9[_0x72d1('0x3a')]['id']]){_0x22ac6f[_0x72d1('0x3b')][_0x88b9b9['agent']['id']][_0x72d1('0x3c')]=![];_0x22ac6f[_0x72d1('0x3b')][_0x88b9b9['agent']['id']][_0x72d1('0x3d')]=undefined;}}if(_0x88b9b9['message']&&_0x88b9b9[_0x72d1('0x12')]['id']){try{var _0x281da1=getId(_0x88b9b9['channel'],_0x88b9b9[_0x72d1('0x12')]?_0x88b9b9['message']['id']:0x0,_0x88b9b9['interaction']?_0x88b9b9['interaction']['id']:0x0);if(_0x22ac6f[_0x72d1('0x11')][_0x281da1]){_0x22ac6f['rules'][_0x281da1][_0x72d1('0x36')](_0x72d1('0x3e'));if(rpc[_0x88b9b9[_0x72d1('0x1c')]+'QueueReport']){rpc[_0x88b9b9['channel']+_0x72d1('0x3f')]['update'](_0x281da1,{'UserId':_0x88b9b9['message'][_0x72d1('0x40')]})[_0x72d1('0x41')](function(_0x2d75cc){logger['error']('error\x20update\x20queue\x20report');});}}return _0x3620df({'code':0xc8,'message':_0x88b9b9});}catch(_0x52365c){logger['error'](_0x52365c[_0x72d1('0x38')]);return _0x5620f0(_0xb911fa[_0x72d1('0x2e')](0x1f4,_0x52365c));}}logger[_0x72d1('0x2e')](_0x72d1('0x42'));return _0x5620f0(_0xb911fa[_0x72d1('0x2e')](0x1f4,_0x72d1('0x42')));});},'RejectMessage':function(_0x1d1465){var _0x5924c=this;return new Promise(function(_0x1e2c11,_0x5f121f){if(_0x1d1465[_0x72d1('0x3a')]&&_0x1d1465[_0x72d1('0x3a')]['id']){try{if(_0x22ac6f[_0x72d1('0x3b')][_0x1d1465['agent']['id']]){_0x22ac6f[_0x72d1('0x3b')][_0x1d1465[_0x72d1('0x3a')]['id']][_0x72d1('0x3c')]=![];_0x22ac6f['agents'][_0x1d1465[_0x72d1('0x3a')]['id']][_0x72d1('0x3d')]=undefined;}return _0x1e2c11({'code':0xc8,'message':_0x1d1465});}catch(_0x343da3){logger[_0x72d1('0x2e')](_0x343da3['stack']);return _0x5f121f(_0x5924c['error'](0x1f4,_0x343da3));}}logger[_0x72d1('0x2e')](_0x72d1('0x42'));return _0x5f121f(_0x5924c[_0x72d1('0x2e')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x402a04){var _0xee3c52=this;return new Promise(function(_0x32673e,_0x463670){if(_0x402a04[_0x72d1('0x1c')]&&_0x402a04[_0x72d1('0x13')]&&_0x402a04[_0x72d1('0x13')]['id']){try{var _0xebe855=getId(_0x402a04[_0x72d1('0x1c')],_0x402a04[_0x72d1('0x12')]?_0x402a04[_0x72d1('0x12')]['id']:0x0,_0x402a04['interaction']?_0x402a04[_0x72d1('0x13')]['id']:0x0);if(_0x22ac6f['rules'][_0xebe855]){_0x22ac6f['rules'][_0xebe855][_0x72d1('0x36')]('end');}return _0x32673e({'code':0xc8,'message':_0x402a04});}catch(_0x3c880e){logger[_0x72d1('0x2e')](_0x3c880e[_0x72d1('0x38')]);return _0x463670(_0xee3c52[_0x72d1('0x2e')](0x1f4,_0x3c880e));}}logger[_0x72d1('0x2e')](_0x72d1('0x42'));return _0x463670(_0xee3c52[_0x72d1('0x2e')](0x1f4,_0x72d1('0x42')));});},'AgentCapacity':function(_0x204699){var _0x189fec=this;return new Promise(function(_0x14f9de,_0x52102e){if(_0x22ac6f[_0x72d1('0x3b')][_0x72d1('0x43')](_0x204699['id'])){for(var _0x2e821c in _0x204699['capacity']){if(_0x204699['capacity'][_0x72d1('0x43')](_0x2e821c)){if(_0x22ac6f[_0x72d1('0x3b')][_0x204699['id']][_0x72d1('0x43')](_0x2e821c+_0x72d1('0x44'))){_0x22ac6f[_0x72d1('0x3b')][_0x204699['id']][_0x2e821c+'CurrentCapacity']=parseInt(_0x204699[_0x72d1('0x45')][_0x2e821c],0xa);}}}_0x22ac6f['agents'][_0x204699['id']][_0x72d1('0x46')]();return _0x14f9de({'code':0xc8,'message':_0x22ac6f[_0x72d1('0x3b')][_0x204699['id']]});}else{return _0x52102e(_0x189fec[_0x72d1('0x2e')](0x1f4,_0x72d1('0x47')));}});},'Agents':function(_0x2ff81f){return new Promise(function(_0x223321,_0x30a819){var _0x2f07c1=_[_0x72d1('0x48')](_0x22ac6f[_0x72d1('0x3b')]);_0x223321({'count':_0x2f07c1[_0x72d1('0x16')],'rows':_0x2f07c1});});},'ChatQueues':function(_0x13056c){return new Promise(function(_0x333020,_0x315774){var _0x40bf4e=[];for(var _0x229ae6 in _0x22ac6f[_0x72d1('0x49')]){if(_0x22ac6f['chatQueues'][_0x72d1('0x43')](_0x229ae6)){var _0x3dceb7=_0x22ac6f[_0x72d1('0x49')][_0x229ae6];var _0x277b06={'id':_0x3dceb7['id'],'available':_0x3dceb7[_0x72d1('0x4a')],'loggedIn':_0x3dceb7[_0x72d1('0x4b')],'name':_0x3dceb7['name'],'paused':_0x3dceb7[_0x72d1('0x4c')],'waiting':_0x3dceb7[_0x72d1('0x4d')]};_0x40bf4e[_0x72d1('0x1e')](_0x277b06);}}_0x333020({'count':_0x40bf4e['length'],'rows':_0x40bf4e});});},'MailQueues':function(_0x4f68bb){return new Promise(function(_0x1e4f2f,_0x5f4614){var _0x28896f=[];for(var _0x359176 in _0x22ac6f[_0x72d1('0x4e')]){if(_0x22ac6f[_0x72d1('0x4e')][_0x72d1('0x43')](_0x359176)){var _0x389f5c=_0x22ac6f[_0x72d1('0x4e')][_0x359176];var _0xdc5141={'id':_0x389f5c['id'],'available':_0x389f5c[_0x72d1('0x4a')],'loggedIn':_0x389f5c['loggedIn'],'name':_0x389f5c['name'],'paused':_0x389f5c[_0x72d1('0x4c')],'waiting':_0x389f5c[_0x72d1('0x4d')]};_0x28896f[_0x72d1('0x1e')](_0xdc5141);}}_0x1e4f2f({'count':_0x28896f['length'],'rows':_0x28896f});});},'OpenchannelQueues':function(_0x31bfda){return new Promise(function(_0x333671,_0x554eeb){var _0x39d7f9=[];for(var _0x5a8442 in _0x22ac6f[_0x72d1('0x4f')]){if(_0x22ac6f[_0x72d1('0x4f')][_0x72d1('0x43')](_0x5a8442)){var _0x34fe3b=_0x22ac6f[_0x72d1('0x4f')][_0x5a8442];var _0x7925ec={'id':_0x34fe3b['id'],'available':_0x34fe3b[_0x72d1('0x4a')],'loggedIn':_0x34fe3b[_0x72d1('0x4b')],'name':_0x34fe3b[_0x72d1('0x50')],'paused':_0x34fe3b[_0x72d1('0x4c')],'waiting':_0x34fe3b['waiting']};_0x39d7f9['push'](_0x7925ec);}}_0x333671({'count':_0x39d7f9[_0x72d1('0x16')],'rows':_0x39d7f9});});},'SmsQueues':function(_0x277d4b){return new Promise(function(_0x268194,_0x162e33){var _0x2ae8c9=[];for(var _0x5c5866 in _0x22ac6f[_0x72d1('0x51')]){if(_0x22ac6f[_0x72d1('0x51')]['hasOwnProperty'](_0x5c5866)){var _0x837b6b=_0x22ac6f['smsQueues'][_0x5c5866];var _0x475016={'id':_0x837b6b['id'],'available':_0x837b6b[_0x72d1('0x4a')],'loggedIn':_0x837b6b['loggedIn'],'name':_0x837b6b['name'],'paused':_0x837b6b[_0x72d1('0x4c')],'waiting':_0x837b6b[_0x72d1('0x4d')]};_0x2ae8c9[_0x72d1('0x1e')](_0x475016);}}_0x268194({'count':_0x2ae8c9[_0x72d1('0x16')],'rows':_0x2ae8c9});});},'FaxQueues':function(_0x3f17d0){return new Promise(function(_0x54388a,_0x27d3be){var _0x574b6e=[];for(var _0x2d24f0 in _0x22ac6f[_0x72d1('0x52')]){if(_0x22ac6f[_0x72d1('0x52')]['hasOwnProperty'](_0x2d24f0)){var _0x61b30b=_0x22ac6f['faxQueues'][_0x2d24f0];var _0x78efb8={'id':_0x61b30b['id'],'available':_0x61b30b[_0x72d1('0x4a')],'loggedIn':_0x61b30b['loggedIn'],'name':_0x61b30b[_0x72d1('0x50')],'paused':_0x61b30b[_0x72d1('0x4c')],'waiting':_0x61b30b['waiting']};_0x574b6e[_0x72d1('0x1e')](_0x78efb8);}}_0x54388a({'count':_0x574b6e[_0x72d1('0x16')],'rows':_0x574b6e});});},'WhatsappQueues':function(_0xfeeb18){return new Promise(function(_0x132a43,_0x4a52ec){var _0x5ba1eb=[];for(var _0x532298 in _0x22ac6f[_0x72d1('0x53')]){if(_0x22ac6f[_0x72d1('0x53')][_0x72d1('0x43')](_0x532298)){var _0x240159=_0x22ac6f[_0x72d1('0x53')][_0x532298];var _0x3de4a6={'id':_0x240159['id'],'available':_0x240159['available'],'loggedIn':_0x240159['loggedIn'],'name':_0x240159[_0x72d1('0x50')],'paused':_0x240159[_0x72d1('0x4c')],'waiting':_0x240159[_0x72d1('0x4d')]};_0x5ba1eb[_0x72d1('0x1e')](_0x3de4a6);}}_0x132a43({'count':_0x5ba1eb[_0x72d1('0x16')],'rows':_0x5ba1eb});});},'ChatQueuesWaitingInteractions':function(_0x422391){return new Promise(function(_0x50d377,_0x23f0e3){var _0x4511a4=_[_0x72d1('0x48')](_0x22ac6f['chatQueuesWaitingInteractions']);_0x50d377({'count':_0x4511a4[_0x72d1('0x16')],'rows':_0x4511a4});});},'MailQueuesWaitingInteractions':function(_0x3d63f7){return new Promise(function(_0x37489e,_0x3dd2c1){var _0x3cc6b0=_[_0x72d1('0x48')](_0x22ac6f[_0x72d1('0x54')]);_0x37489e({'count':_0x3cc6b0[_0x72d1('0x16')],'rows':_0x3cc6b0});});},'OpenchannelQueuesWaitingInteractions':function(_0x4f6135){return new Promise(function(_0x317ad4,_0x14530a){var _0x24f5eb=_[_0x72d1('0x48')](_0x22ac6f['openchannelQueuesWaitingInteractions']);_0x317ad4({'count':_0x24f5eb['length'],'rows':_0x24f5eb});});},'SmsQueuesWaitingInteractions':function(_0x19080a){return new Promise(function(_0x2932bb,_0x5020b7){var _0x41728d=_[_0x72d1('0x48')](_0x22ac6f[_0x72d1('0x55')]);_0x2932bb({'count':_0x41728d[_0x72d1('0x16')],'rows':_0x41728d});});},'FaxQueuesWaitingInteractions':function(_0x35b9bb){return new Promise(function(_0x1d1e22,_0x39c1e6){var _0xaacd06=_['values'](_0x22ac6f[_0x72d1('0x56')]);_0x1d1e22({'count':_0xaacd06[_0x72d1('0x16')],'rows':_0xaacd06});});},'WhatsappQueuesWaitingInteractions':function(_0x38bfd3){return new Promise(function(_0x3cbe00,_0x11b1a0){var _0x25e08f=_[_0x72d1('0x48')](_0x22ac6f[_0x72d1('0x57')]);_0x3cbe00({'count':_0x25e08f['length'],'rows':_0x25e08f});});}};var _0x47585e=jayson[_0x72d1('0x58')](_0x172fae)[_0x72d1('0x59')]();_0x47585e['on'](_0x72d1('0x2e'),function(_0x2330c7){logger[_0x72d1('0x2e')](JSON['stringify'](_0x2330c7));return _0x383bb(_0x2330c7);});_0x47585e[_0x72d1('0x10')](0x232c,_0x72d1('0x5a'),function(){console['log'](_0x72d1('0x5b'),0x232c);return _0x143718(_0x72d1('0x5c')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 03a92da..eb80da1 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 _0x2e88=['stack','stop','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','format','iftime\x20%s','indexOf','true','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when'];(function(_0x3eda94,_0x135a96){var _0x3d7941=function(_0x203077){while(--_0x203077){_0x3eda94['push'](_0x3eda94['shift']());}};_0x3d7941(++_0x135a96);}(_0x2e88,0xf2));var _0x82e8=function(_0x443494,_0x51fc7e){_0x443494=_0x443494-0x0;var _0x4a6794=_0x2e88[_0x443494];return _0x4a6794;};'use strict';var util=require('util');var BPromise=require(_0x82e8('0x0'));var jayson=require(_0x82e8('0x1'));var _=require(_0x82e8('0x2'));var logger=require(_0x82e8('0x3'))(_0x82e8('0x4'));var client=jayson[_0x82e8('0x5')][_0x82e8('0x6')]({'port':0x232a});function request(_0x1b0270,_0x1de1ef){return new BPromise(function(_0x4b18bb,_0x30942a){return client[_0x82e8('0x7')](_0x1b0270,_0x1de1ef)[_0x82e8('0x8')](function(_0x5522b9){if(_0x5522b9['error']){return _0x30942a(_0x5522b9[_0x82e8('0x9')][_0x82e8('0xa')]);}else{return _0x4b18bb(_0x5522b9['result']);}})[_0x82e8('0xb')](function(_0x37b9da){return _0x30942a(_0x37b9da);});});}exports[_0x82e8('0xc')]=function(_0x47bbf0,_0x336a25,_0x84252a){return function(_0x4faf72){if(_0x84252a[_0x82e8('0xd')]&&!_0x84252a[_0x82e8('0xd')][_0x47bbf0]){logger[_0x82e8('0xe')](_0x82e8('0xf'),_0x47bbf0);return _0x4faf72['stop']();}var _0x333a32=[];for(var _0x257f44=0x0;_0x257f44<_0x336a25[_0x82e8('0x10')];_0x257f44+=0x1){_0x333a32[_0x82e8('0x11')](request('Command',{'command':util[_0x82e8('0x12')](_0x82e8('0x13'),_0x336a25[_0x257f44])})[_0x82e8('0x8')](function(_0xc7bbd2){return _0xc7bbd2&&_0xc7bbd2[_0x82e8('0xa')]&&_0xc7bbd2[_0x82e8('0xa')][_0x82e8('0x14')](_0x82e8('0x15'))>=0x0?!![]:![];})['catch'](function(_0x256552){logger[_0x82e8('0x9')]('[%s][INTERVAL]\x20%s',_0x47bbf0,_0x336a25[_0x257f44]);}));}BPromise[_0x82e8('0x16')](_0x333a32)[_0x82e8('0x8')](function(_0x50e11f){var _0x4e0006=_[_0x82e8('0x17')](_0x50e11f);logger['info'](_0x82e8('0x18'),_0x47bbf0,_0x336a25[_0x82e8('0x19')](_0x82e8('0x1a')),_0x4e0006);_0x4faf72[_0x82e8('0x1b')](_0x4e0006);})[_0x82e8('0xb')](function(_0x4c80bd){console['log'](_0x4c80bd);logger[_0x82e8('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x47bbf0,_0x336a25[_0x82e8('0x19')]('\x20|\x20'),_0x4c80bd[_0x82e8('0x1c')]);_0x4faf72[_0x82e8('0x1d')]();});};}; \ No newline at end of file +var _0x392a=['result','catch','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','bluebird','../../../config/logger','routing','client','http','then','error','message'];(function(_0x2af077,_0x498f4a){var _0x5f27a5=function(_0x1695c0){while(--_0x1695c0){_0x2af077['push'](_0x2af077['shift']());}};_0x5f27a5(++_0x498f4a);}(_0x392a,0xe0));var _0xa392=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x392a[_0x46698a];return _0x356db0;};'use strict';var util=require('util');var BPromise=require(_0xa392('0x0'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0xa392('0x1'))(_0xa392('0x2'));var client=jayson[_0xa392('0x3')][_0xa392('0x4')]({'port':0x232a});function request(_0x1ad329,_0x48a9ca){return new BPromise(function(_0x253c7f,_0x3b2a35){return client['request'](_0x1ad329,_0x48a9ca)[_0xa392('0x5')](function(_0x4d16a9){if(_0x4d16a9[_0xa392('0x6')]){return _0x3b2a35(_0x4d16a9[_0xa392('0x6')][_0xa392('0x7')]);}else{return _0x253c7f(_0x4d16a9[_0xa392('0x8')]);}})[_0xa392('0x9')](function(_0x406dff){return _0x3b2a35(_0x406dff);});});}exports[_0xa392('0xa')]=function(_0x47f6a3,_0x18379c,_0x2aad18){return function(_0x319498){if(_0x2aad18['rules']&&!_0x2aad18['rules'][_0x47f6a3]){logger[_0xa392('0xb')](_0xa392('0xc'),_0x47f6a3);return _0x319498[_0xa392('0xd')]();}var _0x316722=[];for(var _0x4dd008=0x0;_0x4dd008<_0x18379c[_0xa392('0xe')];_0x4dd008+=0x1){_0x316722[_0xa392('0xf')](request(_0xa392('0x10'),{'command':util['format'](_0xa392('0x11'),_0x18379c[_0x4dd008])})[_0xa392('0x5')](function(_0x5bfada){return _0x5bfada&&_0x5bfada[_0xa392('0x7')]&&_0x5bfada[_0xa392('0x7')][_0xa392('0x12')](_0xa392('0x13'))>=0x0?!![]:![];})[_0xa392('0x9')](function(_0x5b9762){logger[_0xa392('0x6')](_0xa392('0x14'),_0x47f6a3,_0x18379c[_0x4dd008]);}));}BPromise[_0xa392('0x15')](_0x316722)[_0xa392('0x5')](function(_0x276f55){var _0x2de450=_[_0xa392('0x16')](_0x276f55);logger['info'](_0xa392('0x17'),_0x47f6a3,_0x18379c[_0xa392('0x18')]('\x20|\x20'),_0x2de450);_0x319498[_0xa392('0x19')](_0x2de450);})['catch'](function(_0x176b0b){console[_0xa392('0x1a')](_0x176b0b);logger[_0xa392('0x6')]('[%s][INTERVAL]\x20%s\x20%s',_0x47f6a3,_0x18379c[_0xa392('0x18')](_0xa392('0x1b')),_0x176b0b[_0xa392('0x1c')]);_0x319498[_0xa392('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index c54aaea..a23fad1 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 _0x1a96=['[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','util','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','destuniqueid','agentcalled','format','agentcalledAt','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','now','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','debug','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','membername','abandoned','error','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]'];(function(_0x254f09,_0x13d20f){var _0x4fb086=function(_0x5caac0){while(--_0x5caac0){_0x254f09['push'](_0x254f09['shift']());}};_0x4fb086(++_0x13d20f);}(_0x1a96,0x1d9));var _0x61a9=function(_0x526794,_0x18497f){_0x526794=_0x526794-0x0;var _0x412cac=_0x1a96[_0x526794];return _0x412cac;};'use strict';var _=require(_0x61a9('0x0'));var util=require(_0x61a9('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x357c29,_0x28f52f){utils[_0x61a9('0x2')](util['format'](_0x61a9('0x3'),_0x357c29[_0x61a9('0x4')],_0x357c29[_0x61a9('0x5')],_0x357c29[_0x61a9('0x6')],_0x357c29['membername'],_0x357c29[_0x61a9('0x7')],_0x357c29[_0x61a9('0x8')],_0x357c29[_0x61a9('0x9')],_0x357c29[_0x61a9('0xa')]));if(_0x357c29[_0x61a9('0x6')]){utils[_0x61a9('0xb')](_0x357c29[_0x61a9('0x6')])[_0x61a9('0xc')](function(_0x2c953b){if(_0x2c953b){_0x357c29[_0x61a9('0xd')]=_0x2c953b[_0x61a9('0xd')];_0x357c29[_0x61a9('0xe')]=_0x357c29[_0x61a9('0xf')]?_0x2c953b[_0x61a9('0x10')]:![];_0x357c29[_0x61a9('0x11')]=_0x357c29[_0x61a9('0xe')]?_0x2c953b[_0x61a9('0x12')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x357c29);});}else{utils[_0x61a9('0x13')]('CreateVoiceAgentReport',_0x357c29);}if(_0x28f52f){delete transfers[_0x357c29[_0x61a9('0x4')]];}else{delete agents[_0x357c29[_0x61a9('0x14')]];}}exports[_0x61a9('0x15')]=function(_0x2c2ed7){try{utils['debug'](util[_0x61a9('0x16')]('[%s][agents][agentcalled]',_0x2c2ed7[_0x61a9('0x4')]),_0x2c2ed7);agents[_0x2c2ed7[_0x61a9('0x14')]]=_0x2c2ed7;agents[_0x2c2ed7[_0x61a9('0x14')]][_0x61a9('0x17')]=utils['now']();agents[_0x2c2ed7[_0x61a9('0x14')]][_0x61a9('0xa')]='called';agents[_0x2c2ed7[_0x61a9('0x14')]][_0x61a9('0x9')]=null;agents[_0x2c2ed7[_0x61a9('0x14')]][_0x61a9('0x18')]=null;utils[_0x61a9('0x2')](util['format'](_0x61a9('0x19'),_0x2c2ed7[_0x61a9('0x4')],agents[_0x2c2ed7[_0x61a9('0x14')]]['membername'],_0x2c2ed7[_0x61a9('0x14')]));}catch(_0x8f736c){utils['error'](util[_0x61a9('0x16')](_0x61a9('0x1a'),_0x2c2ed7['uniqueid']),_0x8f736c);}};exports[_0x61a9('0x1b')]=function(_0x22f0a3){try{if(!_[_0x61a9('0x1c')](agents[_0x22f0a3[_0x61a9('0x14')]])){utils['debug'](util[_0x61a9('0x16')](_0x61a9('0x1d'),_0x22f0a3['uniqueid']),_0x22f0a3);utils['info'](util[_0x61a9('0x16')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x22f0a3[_0x61a9('0x4')],agents[_0x22f0a3[_0x61a9('0x14')]]['membername'],_0x22f0a3[_0x61a9('0x14')]));agents[_0x22f0a3[_0x61a9('0x14')]]['agentringnoanswer']=!![];agents[_0x22f0a3[_0x61a9('0x14')]][_0x61a9('0x1e')]=utils[_0x61a9('0x1f')]();agents[_0x22f0a3[_0x61a9('0x14')]][_0x61a9('0xa')]=_0x61a9('0x20');agents[_0x22f0a3[_0x61a9('0x14')]][_0x61a9('0x21')]=_0x61a9('0x20');agents[_0x22f0a3['destuniqueid']][_0x61a9('0x22')]=_0x22f0a3['ringtime']?parseInt(_0x22f0a3[_0x61a9('0x23')])/0x3e8:0x0;agents[_0x22f0a3[_0x61a9('0x14')]][_0x61a9('0x24')]=0x0;unanswered[_0x61a9('0x25')](_0x22f0a3['destuniqueid']);}}catch(_0x1f3a93){utils['error'](util[_0x61a9('0x16')](_0x61a9('0x1d'),_0x22f0a3[_0x61a9('0x4')]),_0x1f3a93);}};exports[_0x61a9('0x26')]=function(_0x1c8f2d){try{_[_0x61a9('0x27')](agents,function(_0x3a7506,_0x2ffff8){if(_0x3a7506[_0x61a9('0x4')]==_0x1c8f2d[_0x61a9('0x4')]&&!_[_0x61a9('0x28')](unanswered,_0x3a7506[_0x61a9('0x14')])){utils[_0x61a9('0x29')](util[_0x61a9('0x16')](_0x61a9('0x2a'),_0x1c8f2d['uniqueid']),_0x1c8f2d);utils[_0x61a9('0x2')](util['format'](_0x61a9('0x2b'),_0x1c8f2d[_0x61a9('0x4')],_0x3a7506[_0x61a9('0x2c')],_0x3a7506[_0x61a9('0x14')]));_0x3a7506[_0x61a9('0x1b')]=!![];_0x3a7506[_0x61a9('0x1e')]=utils[_0x61a9('0x1f')]();_0x3a7506[_0x61a9('0xa')]=_0x61a9('0x2d');_0x3a7506['reason']=_0x61a9('0x2d');_0x3a7506[_0x61a9('0x22')]=_0x1c8f2d[_0x61a9('0x22')];_0x3a7506['talktime']=0x0;writeDB(_0x3a7506);}});}catch(_0x47e4e5){utils[_0x61a9('0x2e')](util[_0x61a9('0x16')](_0x61a9('0x2a'),_0x1c8f2d['uniqueid']),_0x47e4e5);}};exports[_0x61a9('0x2f')]=function(_0x490a87){try{if(agents[_0x490a87[_0x61a9('0x14')]]){utils[_0x61a9('0x29')](util[_0x61a9('0x16')](_0x61a9('0x30'),_0x490a87[_0x61a9('0x4')]),_0x490a87);utils[_0x61a9('0x2')](util[_0x61a9('0x16')](_0x61a9('0x31'),_0x490a87[_0x61a9('0x4')],agents[_0x490a87['destuniqueid']]['membername'],_0x490a87['destuniqueid']));agents[_0x490a87[_0x61a9('0x14')]]['agentconnectAt']=utils['now']();agents[_0x490a87['destuniqueid']]['connectedlinenum']=_0x490a87[_0x61a9('0x9')];agents[_0x490a87['destuniqueid']][_0x61a9('0x18')]=_0x490a87[_0x61a9('0x18')];agents[_0x490a87[_0x61a9('0x14')]][_0x61a9('0x22')]=_0x490a87['ringtime'];agents[_0x490a87[_0x61a9('0x14')]][_0x61a9('0xa')]='connect';_[_0x61a9('0x27')](agents,function(_0x22c4cb,_0x1005f9){if(_0x22c4cb[_0x61a9('0x14')]!=_0x490a87[_0x61a9('0x14')]&&_0x22c4cb[_0x61a9('0x4')]==_0x490a87[_0x61a9('0x4')]){_0x22c4cb[_0x61a9('0x24')]=0x0;_0x22c4cb['holdtime']=_0x490a87['ringtime'];_0x22c4cb[_0x61a9('0x1b')]=!![];_0x22c4cb[_0x61a9('0x1e')]=utils[_0x61a9('0x1f')]();_0x22c4cb[_0x61a9('0xa')]=_0x61a9('0x32');_0x22c4cb[_0x61a9('0x21')]='answered_elsewhere';_0x22c4cb[_0x61a9('0x33')]=_0x490a87['destuniqueid'];_0x22c4cb['answeredelsewheremembername']=_0x490a87[_0x61a9('0x2c')];writeDB(_0x22c4cb);}});}}catch(_0x5af5bf){utils[_0x61a9('0x2e')](util['format']('[%s][agents][agentconnect]',_0x490a87[_0x61a9('0x4')]),_0x5af5bf);}};exports[_0x61a9('0xf')]=function(_0x22b40d){try{if(!_[_0x61a9('0x1c')](agents[_0x22b40d[_0x61a9('0x14')]])){utils[_0x61a9('0x29')](util[_0x61a9('0x16')](_0x61a9('0x34'),_0x22b40d['uniqueid']),_0x22b40d);utils[_0x61a9('0x2')](util[_0x61a9('0x16')](_0x61a9('0x35'),_0x22b40d[_0x61a9('0x4')],agents[_0x22b40d[_0x61a9('0x14')]]['membername'],_0x22b40d[_0x61a9('0x14')]));agents[_0x22b40d['destuniqueid']][_0x61a9('0xf')]=!![];agents[_0x22b40d[_0x61a9('0x14')]][_0x61a9('0x36')]=utils['now']();agents[_0x22b40d[_0x61a9('0x14')]][_0x61a9('0x24')]=utils[_0x61a9('0x37')](agents[_0x22b40d[_0x61a9('0x14')]][_0x61a9('0x36')],agents[_0x22b40d[_0x61a9('0x14')]][_0x61a9('0x38')]);agents[_0x22b40d['destuniqueid']][_0x61a9('0x21')]=_0x22b40d[_0x61a9('0x21')];agents[_0x22b40d['destuniqueid']][_0x61a9('0xa')]=_0x61a9('0x39');writeDB(agents[_0x22b40d['destuniqueid']]);}}catch(_0x39678c){utils[_0x61a9('0x2e')](util['format'](_0x61a9('0x34'),_0x22b40d[_0x61a9('0x4')]),_0x39678c);}};exports[_0x61a9('0x3a')]=function(_0x27b256){try{if(!_[_0x61a9('0x1c')](agents[_0x27b256[_0x61a9('0x3b')]])){utils[_0x61a9('0x29')](util['format'](_0x61a9('0x3c'),_0x27b256[_0x61a9('0x4')]),_0x27b256);utils['info'](util['format'](_0x61a9('0x3d'),_0x27b256['uniqueid'],agents[_0x27b256['transfereruniqueid']][_0x61a9('0x2c')],agents[_0x27b256[_0x61a9('0x3b')]][_0x61a9('0x4')]));agents[_0x27b256[_0x61a9('0x3b')]][_0x61a9('0x3e')]=!![];agents[_0x27b256[_0x61a9('0x3b')]][_0x61a9('0x3f')]=_0x61a9('0x40');agents[_0x27b256['transfereruniqueid']][_0x61a9('0x41')]=_0x27b256[_0x61a9('0x42')];agents[_0x27b256[_0x61a9('0x3b')]][_0x61a9('0x43')]=agents[_0x27b256[_0x61a9('0x3b')]][_0x61a9('0x4')];}}catch(_0x24fedc){utils[_0x61a9('0x2e')](util[_0x61a9('0x16')]('[%s][agents][blindtransfer]',_0x27b256[_0x61a9('0x4')]),_0x24fedc);}};exports[_0x61a9('0x44')]=function(_0x1f95c5){try{utils[_0x61a9('0x29')](util['format'](_0x61a9('0x45'),_0x1f95c5[_0x61a9('0x46')]),_0x1f95c5);if(_0x1f95c5['origtransfereruniqueid']==_0x1f95c5[_0x61a9('0x47')]){if(!_['isNil'](agents[_0x1f95c5[_0x61a9('0x48')]])){utils[_0x61a9('0x2')](util[_0x61a9('0x16')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x1f95c5[_0x61a9('0x46')],agents[_0x1f95c5[_0x61a9('0x48')]][_0x61a9('0x2c')]));agents[_0x1f95c5[_0x61a9('0x48')]][_0x61a9('0x3e')]=!![];agents[_0x1f95c5['secondtransfereruniqueid']][_0x61a9('0x3f')]=_0x61a9('0x49');agents[_0x1f95c5['secondtransfereruniqueid']][_0x61a9('0x41')]=_0x1f95c5[_0x61a9('0x4a')];agents[_0x1f95c5[_0x61a9('0x48')]][_0x61a9('0x43')]=_0x1f95c5[_0x61a9('0x46')];}if(_0x1f95c5[_0x61a9('0x4b')]&&agents[_0x1f95c5['transfereeuniqueid']]){agents[_0x1f95c5['transfereeuniqueid']][_0x61a9('0x4c')]=0x1;transfers[_0x1f95c5['transfereeuniqueid']]=_[_0x61a9('0x4d')](agents[_0x1f95c5['transfereeuniqueid']]);transfers[_0x1f95c5['transfereeuniqueid']][_0x61a9('0x8')]=agents[_0x1f95c5['secondtransfereruniqueid']][_0x61a9('0x8')];transfers[_0x1f95c5[_0x61a9('0x4b')]]['calleridname']=agents[_0x1f95c5[_0x61a9('0x48')]][_0x61a9('0x4e')];transfers[_0x1f95c5[_0x61a9('0x4b')]]['agentcalledAt']=utils[_0x61a9('0x1f')]();transfers[_0x1f95c5[_0x61a9('0x4b')]][_0x61a9('0x38')]=utils[_0x61a9('0x1f')]();transfers[_0x1f95c5[_0x61a9('0x4b')]][_0x61a9('0x22')]=0x0;transfers[_0x1f95c5[_0x61a9('0x4b')]][_0x61a9('0x4c')]=0x2;}}else if(_0x1f95c5[_0x61a9('0x48')]==_0x1f95c5[_0x61a9('0x4f')]){if(!_[_0x61a9('0x1c')](agents[_0x1f95c5[_0x61a9('0x46')]])){utils[_0x61a9('0x2')](util[_0x61a9('0x16')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x1f95c5[_0x61a9('0x46')],agents[_0x1f95c5['origtransfereruniqueid']]['membername']));agents[_0x1f95c5[_0x61a9('0x46')]][_0x61a9('0x3e')]=!![];agents[_0x1f95c5[_0x61a9('0x46')]]['transfertype']=_0x61a9('0x49');agents[_0x1f95c5[_0x61a9('0x46')]][_0x61a9('0x41')]=_0x1f95c5[_0x61a9('0x50')];agents[_0x1f95c5[_0x61a9('0x46')]][_0x61a9('0x43')]=_0x1f95c5['secondtransfereruniqueid'];}if(_0x1f95c5[_0x61a9('0x51')]&&agents[_0x1f95c5[_0x61a9('0x51')]]){agents[_0x1f95c5[_0x61a9('0x51')]][_0x61a9('0x4c')]=0x1;transfers[_0x1f95c5['transfertargetuniqueid']]=_['clone'](agents[_0x1f95c5['transfertargetuniqueid']]);transfers[_0x1f95c5[_0x61a9('0x51')]][_0x61a9('0x8')]=agents[_0x1f95c5[_0x61a9('0x46')]][_0x61a9('0x8')];transfers[_0x1f95c5[_0x61a9('0x51')]]['calleridname']=agents[_0x1f95c5[_0x61a9('0x46')]][_0x61a9('0x4e')];transfers[_0x1f95c5[_0x61a9('0x51')]][_0x61a9('0x17')]=utils[_0x61a9('0x1f')]();transfers[_0x1f95c5[_0x61a9('0x51')]]['agentconnectAt']=utils[_0x61a9('0x1f')]();transfers[_0x1f95c5[_0x61a9('0x51')]][_0x61a9('0x22')]=0x0;transfers[_0x1f95c5[_0x61a9('0x51')]][_0x61a9('0x4c')]=0x2;}}}catch(_0x38f3a4){utils[_0x61a9('0x2e')](util[_0x61a9('0x16')](_0x61a9('0x45'),_0x1f95c5['origtransfereruniqueid']),_0x38f3a4);}};exports[_0x61a9('0x52')]=function(_0x51f025){try{utils[_0x61a9('0x29')](util[_0x61a9('0x16')](_0x61a9('0x53'),_0x51f025[_0x61a9('0x4')]),_0x51f025);if(agents[_0x51f025[_0x61a9('0x4')]]&&agents[_0x51f025['uniqueid']][_0x61a9('0x21')]==='timeout'){if(_0x51f025[_0x61a9('0x54')]==='21'){agents[_0x51f025[_0x61a9('0x4')]][_0x61a9('0x21')]=_0x61a9('0x55');agents[_0x51f025[_0x61a9('0x4')]]['lastevent']=_0x61a9('0x55');}utils[_0x61a9('0x2')](util[_0x61a9('0x16')](_0x61a9('0x56'),_0x51f025[_0x61a9('0x4')],agents[_0x51f025[_0x61a9('0x4')]][_0x61a9('0x2c')],agents[_0x51f025[_0x61a9('0x4')]][_0x61a9('0x21')],agents[_0x51f025[_0x61a9('0x4')]][_0x61a9('0xa')]));writeDB(agents[_0x51f025[_0x61a9('0x4')]]);var _0xc7d003=unanswered['indexOf'](_0x51f025['uniqueid']);if(_0xc7d003>-0x1){unanswered[_0x61a9('0x57')](_0xc7d003,0x1);}}if(transfers[_0x51f025['uniqueid']]){transfers[_0x51f025['uniqueid']][_0x61a9('0xf')]=!![];transfers[_0x51f025[_0x61a9('0x4')]][_0x61a9('0x36')]=utils[_0x61a9('0x1f')]();transfers[_0x51f025[_0x61a9('0x4')]][_0x61a9('0x24')]=utils['diffTime'](transfers[_0x51f025[_0x61a9('0x4')]][_0x61a9('0x36')],transfers[_0x51f025['uniqueid']][_0x61a9('0x38')]);transfers[_0x51f025[_0x61a9('0x4')]]['reason']=_0x61a9('0x58');transfers[_0x51f025[_0x61a9('0x4')]][_0x61a9('0xa')]=_0x61a9('0x39');utils[_0x61a9('0x2')](util[_0x61a9('0x16')](_0x61a9('0x56'),_0x51f025[_0x61a9('0x4')],transfers[_0x51f025[_0x61a9('0x4')]][_0x61a9('0x2c')],transfers[_0x51f025['uniqueid']]['reason'],transfers[_0x51f025['uniqueid']][_0x61a9('0xa')]));writeDB(transfers[_0x51f025[_0x61a9('0x4')]],!![]);}if(agents[_0x51f025[_0x61a9('0x4')]]&&agents[_0x51f025['uniqueid']][_0x61a9('0x38')]){agents[_0x51f025['uniqueid']][_0x61a9('0xf')]=!![];agents[_0x51f025['uniqueid']][_0x61a9('0x36')]=utils[_0x61a9('0x1f')]();agents[_0x51f025[_0x61a9('0x4')]][_0x61a9('0x24')]=utils[_0x61a9('0x37')](agents[_0x51f025[_0x61a9('0x4')]]['agentcompleteAt'],agents[_0x51f025[_0x61a9('0x4')]][_0x61a9('0x38')]);agents[_0x51f025[_0x61a9('0x4')]][_0x61a9('0x21')]=agents[_0x51f025['uniqueid']][_0x61a9('0x3e')]?_0x61a9('0x3e'):_0x61a9('0x58');agents[_0x51f025[_0x61a9('0x4')]][_0x61a9('0xa')]=_0x61a9('0x39');utils[_0x61a9('0x2')](util[_0x61a9('0x16')](_0x61a9('0x56'),_0x51f025['uniqueid'],agents[_0x51f025[_0x61a9('0x4')]][_0x61a9('0x2c')],agents[_0x51f025[_0x61a9('0x4')]]['reason'],agents[_0x51f025['uniqueid']][_0x61a9('0xa')]));writeDB(agents[_0x51f025[_0x61a9('0x4')]]);}}catch(_0xe66e3){utils['error'](util[_0x61a9('0x16')]('[%s][agents][hangup]',_0x51f025[_0x61a9('0x4')]),_0xe66e3);}}; \ No newline at end of file +var _0xab06=['agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','transfertargetuniqueid','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','[%s][agents][hangup]','./utils','info','format','uniqueid','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','queue','then','type'];(function(_0x33b259,_0x2036be){var _0xf95548=function(_0x5b3424){while(--_0x5b3424){_0x33b259['push'](_0x33b259['shift']());}};_0xf95548(++_0x2036be);}(_0xab06,0x197));var _0x6ab0=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xab06[_0x22f8ab];return _0x2a70e5;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x6ab0('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1ada99,_0x3276e4){utils[_0x6ab0('0x1')](util[_0x6ab0('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1ada99[_0x6ab0('0x3')],_0x1ada99['channel'],_0x1ada99['queue'],_0x1ada99[_0x6ab0('0x4')],_0x1ada99[_0x6ab0('0x5')],_0x1ada99[_0x6ab0('0x6')],_0x1ada99[_0x6ab0('0x7')],_0x1ada99[_0x6ab0('0x8')]));if(_0x1ada99['queue']){utils[_0x6ab0('0x9')](_0x1ada99[_0x6ab0('0xa')])[_0x6ab0('0xb')](function(_0x5641d8){if(_0x5641d8){_0x1ada99[_0x6ab0('0xc')]=_0x5641d8[_0x6ab0('0xc')];_0x1ada99[_0x6ab0('0xd')]=_0x1ada99[_0x6ab0('0xe')]?_0x5641d8[_0x6ab0('0xf')]:![];_0x1ada99[_0x6ab0('0x10')]=_0x1ada99['agentacw']?_0x5641d8['acwTimeout']:0x0;}utils[_0x6ab0('0x11')](_0x6ab0('0x12'),_0x1ada99);});}else{utils[_0x6ab0('0x11')](_0x6ab0('0x12'),_0x1ada99);}if(_0x3276e4){delete transfers[_0x1ada99['uniqueid']];}else{delete agents[_0x1ada99[_0x6ab0('0x13')]];}}exports['agentcalled']=function(_0x6943c6){try{utils[_0x6ab0('0x14')](util['format'](_0x6ab0('0x15'),_0x6943c6[_0x6ab0('0x3')]),_0x6943c6);agents[_0x6943c6[_0x6ab0('0x13')]]=_0x6943c6;agents[_0x6943c6[_0x6ab0('0x13')]][_0x6ab0('0x16')]=utils[_0x6ab0('0x17')]();agents[_0x6943c6['destuniqueid']]['lastevent']=_0x6ab0('0x18');agents[_0x6943c6['destuniqueid']][_0x6ab0('0x7')]=null;agents[_0x6943c6[_0x6ab0('0x13')]]['connectedlinename']=null;utils[_0x6ab0('0x1')](util[_0x6ab0('0x2')](_0x6ab0('0x19'),_0x6943c6[_0x6ab0('0x3')],agents[_0x6943c6['destuniqueid']][_0x6ab0('0x4')],_0x6943c6[_0x6ab0('0x13')]));}catch(_0x1c2a98){utils[_0x6ab0('0x1a')](util[_0x6ab0('0x2')]('[%s][agents][agentcalled]',_0x6943c6['uniqueid']),_0x1c2a98);}};exports[_0x6ab0('0x1b')]=function(_0x32129e){try{if(!_[_0x6ab0('0x1c')](agents[_0x32129e[_0x6ab0('0x13')]])){utils[_0x6ab0('0x14')](util['format']('[%s][agents][agentringnoanswer]',_0x32129e['uniqueid']),_0x32129e);utils[_0x6ab0('0x1')](util[_0x6ab0('0x2')](_0x6ab0('0x1d'),_0x32129e['uniqueid'],agents[_0x32129e[_0x6ab0('0x13')]][_0x6ab0('0x4')],_0x32129e['destuniqueid']));agents[_0x32129e['destuniqueid']][_0x6ab0('0x1b')]=!![];agents[_0x32129e[_0x6ab0('0x13')]][_0x6ab0('0x1e')]=utils[_0x6ab0('0x17')]();agents[_0x32129e[_0x6ab0('0x13')]][_0x6ab0('0x8')]=_0x6ab0('0x1f');agents[_0x32129e[_0x6ab0('0x13')]][_0x6ab0('0x20')]='timeout';agents[_0x32129e[_0x6ab0('0x13')]][_0x6ab0('0x21')]=_0x32129e[_0x6ab0('0x22')]?parseInt(_0x32129e['ringtime'])/0x3e8:0x0;agents[_0x32129e['destuniqueid']]['talktime']=0x0;unanswered[_0x6ab0('0x23')](_0x32129e[_0x6ab0('0x13')]);}}catch(_0x64b2ea){utils[_0x6ab0('0x1a')](util[_0x6ab0('0x2')](_0x6ab0('0x24'),_0x32129e[_0x6ab0('0x3')]),_0x64b2ea);}};exports[_0x6ab0('0x25')]=function(_0x17a587){try{_[_0x6ab0('0x26')](agents,function(_0x50cdcf,_0x4bdddc){if(_0x50cdcf[_0x6ab0('0x3')]==_0x17a587[_0x6ab0('0x3')]&&!_[_0x6ab0('0x27')](unanswered,_0x50cdcf[_0x6ab0('0x13')])){utils[_0x6ab0('0x14')](util[_0x6ab0('0x2')](_0x6ab0('0x28'),_0x17a587[_0x6ab0('0x3')]),_0x17a587);utils[_0x6ab0('0x1')](util[_0x6ab0('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x17a587[_0x6ab0('0x3')],_0x50cdcf['membername'],_0x50cdcf['destuniqueid']));_0x50cdcf[_0x6ab0('0x1b')]=!![];_0x50cdcf['agentringnoanswerAt']=utils[_0x6ab0('0x17')]();_0x50cdcf[_0x6ab0('0x8')]=_0x6ab0('0x29');_0x50cdcf[_0x6ab0('0x20')]='abandoned';_0x50cdcf[_0x6ab0('0x21')]=_0x17a587['holdtime'];_0x50cdcf[_0x6ab0('0x2a')]=0x0;writeDB(_0x50cdcf);}});}catch(_0xd316c2){utils[_0x6ab0('0x1a')](util[_0x6ab0('0x2')]('[%s][agents][queuecallerabandon]',_0x17a587[_0x6ab0('0x3')]),_0xd316c2);}};exports[_0x6ab0('0x2b')]=function(_0x2e9a89){try{if(agents[_0x2e9a89['destuniqueid']]){utils[_0x6ab0('0x14')](util['format'](_0x6ab0('0x2c'),_0x2e9a89[_0x6ab0('0x3')]),_0x2e9a89);utils[_0x6ab0('0x1')](util[_0x6ab0('0x2')](_0x6ab0('0x2d'),_0x2e9a89[_0x6ab0('0x3')],agents[_0x2e9a89['destuniqueid']]['membername'],_0x2e9a89[_0x6ab0('0x13')]));agents[_0x2e9a89[_0x6ab0('0x13')]][_0x6ab0('0x2e')]=utils['now']();agents[_0x2e9a89['destuniqueid']][_0x6ab0('0x7')]=_0x2e9a89[_0x6ab0('0x7')];agents[_0x2e9a89[_0x6ab0('0x13')]]['connectedlinename']=_0x2e9a89['connectedlinename'];agents[_0x2e9a89[_0x6ab0('0x13')]][_0x6ab0('0x21')]=_0x2e9a89['ringtime'];agents[_0x2e9a89[_0x6ab0('0x13')]]['lastevent']=_0x6ab0('0x2f');_[_0x6ab0('0x26')](agents,function(_0x5a29b5,_0x5f5ae0){if(_0x5a29b5['destuniqueid']!=_0x2e9a89[_0x6ab0('0x13')]&&_0x5a29b5[_0x6ab0('0x3')]==_0x2e9a89[_0x6ab0('0x3')]){_0x5a29b5['talktime']=0x0;_0x5a29b5['holdtime']=_0x2e9a89[_0x6ab0('0x22')];_0x5a29b5[_0x6ab0('0x1b')]=!![];_0x5a29b5[_0x6ab0('0x1e')]=utils[_0x6ab0('0x17')]();_0x5a29b5[_0x6ab0('0x8')]=_0x6ab0('0x30');_0x5a29b5[_0x6ab0('0x20')]=_0x6ab0('0x30');_0x5a29b5[_0x6ab0('0x31')]=_0x2e9a89['destuniqueid'];_0x5a29b5[_0x6ab0('0x32')]=_0x2e9a89[_0x6ab0('0x4')];writeDB(_0x5a29b5);}});}}catch(_0x3695e6){utils[_0x6ab0('0x1a')](util[_0x6ab0('0x2')](_0x6ab0('0x2c'),_0x2e9a89[_0x6ab0('0x3')]),_0x3695e6);}};exports[_0x6ab0('0xe')]=function(_0x315a18){try{if(!_[_0x6ab0('0x1c')](agents[_0x315a18['destuniqueid']])){utils[_0x6ab0('0x14')](util[_0x6ab0('0x2')]('[%s][agents][agentcomplete]',_0x315a18[_0x6ab0('0x3')]),_0x315a18);utils[_0x6ab0('0x1')](util[_0x6ab0('0x2')](_0x6ab0('0x33'),_0x315a18[_0x6ab0('0x3')],agents[_0x315a18['destuniqueid']][_0x6ab0('0x4')],_0x315a18[_0x6ab0('0x13')]));agents[_0x315a18['destuniqueid']][_0x6ab0('0xe')]=!![];agents[_0x315a18[_0x6ab0('0x13')]]['agentcompleteAt']=utils[_0x6ab0('0x17')]();agents[_0x315a18[_0x6ab0('0x13')]][_0x6ab0('0x2a')]=utils[_0x6ab0('0x34')](agents[_0x315a18[_0x6ab0('0x13')]]['agentcompleteAt'],agents[_0x315a18[_0x6ab0('0x13')]][_0x6ab0('0x2e')]);agents[_0x315a18[_0x6ab0('0x13')]][_0x6ab0('0x20')]=_0x315a18['reason'];agents[_0x315a18[_0x6ab0('0x13')]][_0x6ab0('0x8')]=_0x6ab0('0x35');writeDB(agents[_0x315a18[_0x6ab0('0x13')]]);}}catch(_0x5da028){utils[_0x6ab0('0x1a')](util['format']('[%s][agents][agentcomplete]',_0x315a18[_0x6ab0('0x3')]),_0x5da028);}};exports[_0x6ab0('0x36')]=function(_0x28dbfa){try{if(!_[_0x6ab0('0x1c')](agents[_0x28dbfa[_0x6ab0('0x37')]])){utils[_0x6ab0('0x14')](util[_0x6ab0('0x2')](_0x6ab0('0x38'),_0x28dbfa[_0x6ab0('0x3')]),_0x28dbfa);utils['info'](util[_0x6ab0('0x2')](_0x6ab0('0x39'),_0x28dbfa[_0x6ab0('0x3')],agents[_0x28dbfa[_0x6ab0('0x37')]][_0x6ab0('0x4')],agents[_0x28dbfa[_0x6ab0('0x37')]][_0x6ab0('0x3')]));agents[_0x28dbfa['transfereruniqueid']][_0x6ab0('0x3a')]=!![];agents[_0x28dbfa[_0x6ab0('0x37')]][_0x6ab0('0x3b')]=_0x6ab0('0x3c');agents[_0x28dbfa[_0x6ab0('0x37')]][_0x6ab0('0x3d')]=_0x28dbfa[_0x6ab0('0x3e')];agents[_0x28dbfa[_0x6ab0('0x37')]][_0x6ab0('0x3f')]=agents[_0x28dbfa[_0x6ab0('0x37')]][_0x6ab0('0x3')];}}catch(_0x44d42a){utils[_0x6ab0('0x1a')](util[_0x6ab0('0x2')](_0x6ab0('0x38'),_0x28dbfa['uniqueid']),_0x44d42a);}};exports['attendedtransfer']=function(_0x2b3508){try{utils[_0x6ab0('0x14')](util['format'](_0x6ab0('0x40'),_0x2b3508[_0x6ab0('0x41')]),_0x2b3508);if(_0x2b3508['origtransfereruniqueid']==_0x2b3508[_0x6ab0('0x42')]){if(!_['isNil'](agents[_0x2b3508['secondtransfereruniqueid']])){utils[_0x6ab0('0x1')](util['format'](_0x6ab0('0x43'),_0x2b3508[_0x6ab0('0x41')],agents[_0x2b3508[_0x6ab0('0x44')]][_0x6ab0('0x4')]));agents[_0x2b3508[_0x6ab0('0x44')]]['transfer']=!![];agents[_0x2b3508[_0x6ab0('0x44')]][_0x6ab0('0x3b')]=_0x6ab0('0x45');agents[_0x2b3508[_0x6ab0('0x44')]][_0x6ab0('0x3d')]=_0x2b3508[_0x6ab0('0x46')];agents[_0x2b3508['secondtransfereruniqueid']][_0x6ab0('0x3f')]=_0x2b3508[_0x6ab0('0x41')];}if(_0x2b3508['transfereeuniqueid']&&agents[_0x2b3508['transfereeuniqueid']]){agents[_0x2b3508[_0x6ab0('0x47')]][_0x6ab0('0x48')]=0x1;transfers[_0x2b3508[_0x6ab0('0x47')]]=_[_0x6ab0('0x49')](agents[_0x2b3508[_0x6ab0('0x47')]]);transfers[_0x2b3508['transfereeuniqueid']][_0x6ab0('0x6')]=agents[_0x2b3508[_0x6ab0('0x44')]][_0x6ab0('0x6')];transfers[_0x2b3508['transfereeuniqueid']][_0x6ab0('0x4a')]=agents[_0x2b3508[_0x6ab0('0x44')]][_0x6ab0('0x4a')];transfers[_0x2b3508[_0x6ab0('0x47')]][_0x6ab0('0x16')]=utils['now']();transfers[_0x2b3508['transfereeuniqueid']][_0x6ab0('0x2e')]=utils[_0x6ab0('0x17')]();transfers[_0x2b3508[_0x6ab0('0x47')]]['holdtime']=0x0;transfers[_0x2b3508[_0x6ab0('0x47')]][_0x6ab0('0x48')]=0x2;}}else if(_0x2b3508[_0x6ab0('0x44')]==_0x2b3508[_0x6ab0('0x4b')]){if(!_[_0x6ab0('0x1c')](agents[_0x2b3508['origtransfereruniqueid']])){utils[_0x6ab0('0x1')](util[_0x6ab0('0x2')](_0x6ab0('0x43'),_0x2b3508['origtransfereruniqueid'],agents[_0x2b3508['origtransfereruniqueid']][_0x6ab0('0x4')]));agents[_0x2b3508['origtransfereruniqueid']]['transfer']=!![];agents[_0x2b3508[_0x6ab0('0x41')]]['transfertype']=_0x6ab0('0x45');agents[_0x2b3508['origtransfereruniqueid']][_0x6ab0('0x3d')]=_0x2b3508['secondtransfererexten'];agents[_0x2b3508[_0x6ab0('0x41')]][_0x6ab0('0x3f')]=_0x2b3508[_0x6ab0('0x44')];}if(_0x2b3508['transfertargetuniqueid']&&agents[_0x2b3508[_0x6ab0('0x4c')]]){agents[_0x2b3508[_0x6ab0('0x4c')]][_0x6ab0('0x48')]=0x1;transfers[_0x2b3508[_0x6ab0('0x4c')]]=_[_0x6ab0('0x49')](agents[_0x2b3508['transfertargetuniqueid']]);transfers[_0x2b3508[_0x6ab0('0x4c')]][_0x6ab0('0x6')]=agents[_0x2b3508[_0x6ab0('0x41')]][_0x6ab0('0x6')];transfers[_0x2b3508[_0x6ab0('0x4c')]][_0x6ab0('0x4a')]=agents[_0x2b3508[_0x6ab0('0x41')]]['calleridname'];transfers[_0x2b3508[_0x6ab0('0x4c')]][_0x6ab0('0x16')]=utils[_0x6ab0('0x17')]();transfers[_0x2b3508[_0x6ab0('0x4c')]][_0x6ab0('0x2e')]=utils[_0x6ab0('0x17')]();transfers[_0x2b3508[_0x6ab0('0x4c')]][_0x6ab0('0x21')]=0x0;transfers[_0x2b3508[_0x6ab0('0x4c')]][_0x6ab0('0x48')]=0x2;}}}catch(_0x5bcd49){utils[_0x6ab0('0x1a')](util['format'](_0x6ab0('0x40'),_0x2b3508['origtransfereruniqueid']),_0x5bcd49);}};exports['hangup']=function(_0x12226c){try{utils[_0x6ab0('0x14')](util['format']('[%s][agents][hangup]',_0x12226c[_0x6ab0('0x3')]),_0x12226c);if(agents[_0x12226c[_0x6ab0('0x3')]]&&agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x20')]===_0x6ab0('0x1f')){if(_0x12226c[_0x6ab0('0x4d')]==='21'){agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x20')]=_0x6ab0('0x4e');agents[_0x12226c['uniqueid']]['lastevent']='rejected';}utils[_0x6ab0('0x1')](util['format'](_0x6ab0('0x4f'),_0x12226c[_0x6ab0('0x3')],agents[_0x12226c['uniqueid']]['membername'],agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x20')],agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x8')]));writeDB(agents[_0x12226c[_0x6ab0('0x3')]]);var _0x1ebd96=unanswered[_0x6ab0('0x50')](_0x12226c[_0x6ab0('0x3')]);if(_0x1ebd96>-0x1){unanswered[_0x6ab0('0x51')](_0x1ebd96,0x1);}}if(transfers[_0x12226c[_0x6ab0('0x3')]]){transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0xe')]=!![];transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x52')]=utils[_0x6ab0('0x17')]();transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x2a')]=utils[_0x6ab0('0x34')](transfers[_0x12226c['uniqueid']][_0x6ab0('0x52')],transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x2e')]);transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x20')]='agent';transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x8')]=_0x6ab0('0x35');utils['info'](util[_0x6ab0('0x2')](_0x6ab0('0x4f'),_0x12226c[_0x6ab0('0x3')],transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x4')],transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x20')],transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x8')]));writeDB(transfers[_0x12226c[_0x6ab0('0x3')]],!![]);}if(agents[_0x12226c[_0x6ab0('0x3')]]&&agents[_0x12226c['uniqueid']][_0x6ab0('0x2e')]){agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0xe')]=!![];agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x52')]=utils['now']();agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x2a')]=utils[_0x6ab0('0x34')](agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x52')],agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x2e')]);agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x20')]=agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x3a')]?_0x6ab0('0x3a'):'agent';agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x8')]='complete';utils[_0x6ab0('0x1')](util['format'](_0x6ab0('0x4f'),_0x12226c[_0x6ab0('0x3')],agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x4')],agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x20')],agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x8')]));writeDB(agents[_0x12226c[_0x6ab0('0x3')]]);}}catch(_0x4712d2){utils[_0x6ab0('0x1a')](util[_0x6ab0('0x2')](_0x6ab0('0x53'),_0x12226c[_0x6ab0('0x3')]),_0x4712d2);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index e773cf5..797e868 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 _0xba09=['secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','variable','xmd-callerid','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','appdata','split','substring','lastIndexOf','includes','execif','gotoif','lastapplication','lodash','util','./utils','./transfers.controller','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','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','calleridnum','context','DOCUMENTATION','error','newstate','debug','[%s][calls][newstate]','isNil','systemanswertime','now','channelstate','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s'];(function(_0x1057a3,_0x28d9b7){var _0x131cdb=function(_0x47a386){while(--_0x47a386){_0x1057a3['push'](_0x1057a3['shift']());}};_0x131cdb(++_0x28d9b7);}(_0xba09,0x1f4));var _0x9ba0=function(_0x2d9f8f,_0x40bc79){_0x2d9f8f=_0x2d9f8f-0x0;var _0x240df4=_0xba09[_0x2d9f8f];return _0x240df4;};'use strict';var _=require(_0x9ba0('0x0'));var util=require(_0x9ba0('0x1'));var utils=require(_0x9ba0('0x2'));var transfers=require(_0x9ba0('0x3'));var dispositions=[_0x9ba0('0x4'),_0x9ba0('0x5'),_0x9ba0('0x5'),'NO\x20ANSWER',_0x9ba0('0x4'),'NO\x20ANSWER',_0x9ba0('0x6'),_0x9ba0('0x7'),_0x9ba0('0x5'),_0x9ba0('0x5'),_0x9ba0('0x5')];var channels={};function writeDB(_0xbd351e){var _0x3b4d19;if(transfers[_0x9ba0('0x8')][_0xbd351e[_0x9ba0('0x9')]]){_0x3b4d19=_0xbd351e[_0x9ba0('0x9')];_0xbd351e['uniqueid']=transfers[_0x9ba0('0x8')][_0xbd351e[_0x9ba0('0x9')]][_0x9ba0('0xa')];}utils[_0x9ba0('0xb')](util[_0x9ba0('0xc')](_0x9ba0('0xd'),_0xbd351e['uniqueid'],_0xbd351e[_0x9ba0('0xe')],_0xbd351e[_0x9ba0('0xf')],_0xbd351e[_0x9ba0('0x10')],_0xbd351e[_0x9ba0('0x11')],_0xbd351e['calleridnum'],_0xbd351e[_0x9ba0('0x12')],_0xbd351e[_0x9ba0('0x13')]));if(_0xbd351e[_0x9ba0('0x14')]){utils[_0x9ba0('0x15')](_0xbd351e[_0x9ba0('0x14')])['then'](function(_0x2df433){if(_0x2df433){_0xbd351e[_0x9ba0('0x16')]=_0x2df433['id'];}utils[_0x9ba0('0x17')]('CreateVoiceCallReport',_0xbd351e);});}else{utils[_0x9ba0('0x17')](_0x9ba0('0x18'),_0xbd351e);}if(channels[_0xbd351e[_0x9ba0('0x9')]]){delete channels[_0xbd351e['uniqueid']];}else if(_0x3b4d19&&channels[_0x3b4d19]){delete transfers[_0x9ba0('0x8')][_0x3b4d19];delete channels[_0x3b4d19];}}exports[_0x9ba0('0x19')]=function(_0x1de709){try{utils['debug'](util['format']('[%s][calls][newchannel]',_0x1de709[_0x9ba0('0x9')]),_0x1de709);if(_0x1de709[_0x9ba0('0x9')]==_0x1de709['linkedid']&&_0x1de709['channel']!=_0x9ba0('0x1a')){utils[_0x9ba0('0xb')](util['format'](_0x9ba0('0x1b'),_0x1de709['uniqueid'],_0x1de709['context'],_0x1de709[_0x9ba0('0x1c')]));channels[_0x1de709[_0x9ba0('0x9')]]={'uniqueid':_0x1de709[_0x9ba0('0x9')],'accountcode':_0x1de709[_0x9ba0('0x14')],'source':_0x1de709[_0x9ba0('0x1d')],'destination':_0x1de709['exten'],'destinationcontext':_0x1de709[_0x9ba0('0x1e')],'channel':_0x1de709['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x9ba0('0x1f')};}}catch(_0xe4fc4f){utils[_0x9ba0('0x20')](util[_0x9ba0('0xc')]('[%s][calls][newchannel]',_0x1de709[_0x9ba0('0x9')]),_0xe4fc4f);}};exports[_0x9ba0('0x21')]=function(_0x448836){try{utils[_0x9ba0('0x22')](util[_0x9ba0('0xc')](_0x9ba0('0x23'),_0x448836['uniqueid']),_0x448836);if(!_[_0x9ba0('0x24')](channels[_0x448836[_0x9ba0('0x9')]])&&_0x448836['channelstate']==0x6){utils[_0x9ba0('0xb')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x448836[_0x9ba0('0x9')],_0x448836['context'],_0x448836['channel']));if(_[_0x9ba0('0x24')](channels[_0x448836[_0x9ba0('0x9')]][_0x9ba0('0x25')])){channels[_0x448836['uniqueid']]['systemanswertime']=utils[_0x9ba0('0x26')]();}}else if(!_[_0x9ba0('0x24')](channels[_0x448836['linkedid']])&&_0x448836[_0x9ba0('0x27')]==0x6&&_0x448836['context']!='transfer'){utils[_0x9ba0('0xb')](util[_0x9ba0('0xc')](_0x9ba0('0x28'),_0x448836[_0x9ba0('0x9')],_0x448836[_0x9ba0('0x29')],_0x448836[_0x9ba0('0x1e')],_0x448836[_0x9ba0('0xe')]));channels[_0x448836['linkedid']][_0x9ba0('0x14')]=_0x448836[_0x9ba0('0x14')];channels[_0x448836[_0x9ba0('0x29')]][_0x9ba0('0x2a')]=_0x448836[_0x9ba0('0xe')];if(_[_0x9ba0('0x24')](channels[_0x448836[_0x9ba0('0x29')]][_0x9ba0('0x2b')])){channels[_0x448836[_0x9ba0('0x29')]]['answertime']=utils[_0x9ba0('0x26')]();}channels[_0x448836[_0x9ba0('0x29')]][_0x9ba0('0x2c')]=dispositions[_[_0x9ba0('0x2d')](_0x448836[_0x9ba0('0x27')])]||_0x9ba0('0x6');}}catch(_0x53a53a){utils[_0x9ba0('0x20')](util['format']('[%s][calls][newstate]',_0x448836['uniqueid']),_0x53a53a);}};exports[_0x9ba0('0x2e')]=function(_0x126aa6){try{if(!_[_0x9ba0('0x24')](channels[_0x126aa6[_0x9ba0('0x9')]])){utils[_0x9ba0('0x22')](util[_0x9ba0('0xc')](_0x9ba0('0x2f'),_0x126aa6[_0x9ba0('0x9')]),_0x126aa6);if(_[_0x9ba0('0x24')](channels[_0x126aa6[_0x9ba0('0x9')]]['callerid'])){channels[_0x126aa6[_0x9ba0('0x9')]][_0x9ba0('0x30')]=_0x126aa6[_0x9ba0('0x31')]+'\x20<'+_0x126aa6['calleridnum']+'>';}utils[_0x9ba0('0xb')](util['format'](_0x9ba0('0x32'),_0x126aa6['uniqueid'],channels[_0x126aa6[_0x9ba0('0x9')]]['callerid'],_0x126aa6[_0x9ba0('0x33')]));channels[_0x126aa6['uniqueid']][_0x9ba0('0x34')]=utils[_0x9ba0('0x26')]();channels[_0x126aa6[_0x9ba0('0x9')]]['duration']=utils[_0x9ba0('0x35')](channels[_0x126aa6[_0x9ba0('0x9')]][_0x9ba0('0x34')],channels[_0x126aa6[_0x9ba0('0x9')]][_0x9ba0('0x36')]);channels[_0x126aa6[_0x9ba0('0x9')]]['billableseconds']=channels[_0x126aa6[_0x9ba0('0x9')]][_0x9ba0('0x2b')]?utils[_0x9ba0('0x35')](channels[_0x126aa6[_0x9ba0('0x9')]][_0x9ba0('0x34')],channels[_0x126aa6[_0x9ba0('0x9')]]['answertime']):0x0;writeDB(channels[_0x126aa6[_0x9ba0('0x9')]]);}}catch(_0xe0675a){utils[_0x9ba0('0x20')](util['format'](_0x9ba0('0x2f'),_0x126aa6[_0x9ba0('0x9')]),_0xe0675a);}};exports[_0x9ba0('0x37')]=function(_0x48e867){try{if(!_[_0x9ba0('0x24')](channels[_0x48e867[_0x9ba0('0x38')]])){utils[_0x9ba0('0x22')](util['format'](_0x9ba0('0x39'),_0x48e867[_0x9ba0('0x3a')]),_0x48e867);if(channels[_0x48e867['localtwolinkedid']][_0x9ba0('0xe')]==_0x48e867['transfereechannel']){utils['info'](util[_0x9ba0('0xc')](_0x9ba0('0x3b'),_0x48e867[_0x9ba0('0x3a')],_0x48e867[_0x9ba0('0x38')],_0x48e867[_0x9ba0('0x3c')]));channels[_0x48e867[_0x9ba0('0x38')]]['destinationchannel']=_0x48e867[_0x9ba0('0x3c')];channels[_0x48e867[_0x9ba0('0x38')]][_0x9ba0('0x3d')]='_attended';}else if(channels[_0x48e867[_0x9ba0('0x38')]][_0x9ba0('0xe')]=_0x48e867[_0x9ba0('0x3e')]){utils[_0x9ba0('0xb')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x48e867[_0x9ba0('0x3a')],_0x48e867[_0x9ba0('0x38')],_0x48e867[_0x9ba0('0x3f')]));channels[_0x48e867[_0x9ba0('0x38')]][_0x9ba0('0x2a')]=_0x48e867[_0x9ba0('0x3f')];channels[_0x48e867[_0x9ba0('0x38')]][_0x9ba0('0x3d')]=_0x9ba0('0x40');}}}catch(_0x542af8){utils[_0x9ba0('0x20')](util[_0x9ba0('0xc')](_0x9ba0('0x39'),_0x48e867['origtransfereruniqueid']),_0x542af8);}};exports[_0x9ba0('0x41')]=function(_0x3bd937){try{if(!_[_0x9ba0('0x24')](channels[_0x3bd937[_0x9ba0('0x9')]])){utils[_0x9ba0('0x22')](util[_0x9ba0('0xc')](_0x9ba0('0x42'),_0x3bd937[_0x9ba0('0x9')]),_0x3bd937);channels[_0x3bd937['uniqueid']][_0x9ba0('0x43')]=utils[_0x9ba0('0x26')]();utils['info'](util['format'](_0x9ba0('0x44'),_0x3bd937[_0x9ba0('0x9')],channels[_0x3bd937['uniqueid']][_0x9ba0('0x43')]));}}catch(_0x2c927f){utils[_0x9ba0('0x20')](util[_0x9ba0('0xc')](_0x9ba0('0x42'),_0x3bd937[_0x9ba0('0x9')]),_0x2c927f);}};exports['musiconholdstop']=function(_0x5c1060){try{if(!_['isNil'](channels[_0x5c1060[_0x9ba0('0x9')]])){utils['debug'](util[_0x9ba0('0xc')](_0x9ba0('0x45'),_0x5c1060[_0x9ba0('0x9')]),_0x5c1060);if(!_[_0x9ba0('0x24')](channels[_0x5c1060[_0x9ba0('0x9')]]['musiconholdstartAt'])){channels[_0x5c1060[_0x9ba0('0x9')]][_0x9ba0('0x46')]+=utils[_0x9ba0('0x35')](utils[_0x9ba0('0x26')](),channels[_0x5c1060[_0x9ba0('0x9')]][_0x9ba0('0x43')]);utils[_0x9ba0('0xb')](util[_0x9ba0('0xc')](_0x9ba0('0x47'),_0x5c1060['uniqueid'],channels[_0x5c1060[_0x9ba0('0x9')]]['mohtime']));delete channels[_0x5c1060[_0x9ba0('0x9')]][_0x9ba0('0x43')];}}}catch(_0x3d40a7){utils[_0x9ba0('0x20')](util[_0x9ba0('0xc')](_0x9ba0('0x45'),_0x5c1060[_0x9ba0('0x9')]),_0x3d40a7);}};exports[_0x9ba0('0x48')]=function(_0xb498e4){try{if(!_[_0x9ba0('0x24')](channels[_0xb498e4[_0x9ba0('0x9')]])){utils[_0x9ba0('0x22')](util[_0x9ba0('0xc')]('[%s][calls][varset]',_0xb498e4[_0x9ba0('0x9')]),_0xb498e4);if(!_[_0x9ba0('0x24')](_0xb498e4['variable']['xmd-originatecalleridnum'])){utils[_0x9ba0('0xb')](util[_0x9ba0('0xc')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0xb498e4['uniqueid'],_0xb498e4[_0x9ba0('0x49')]));channels[_0xb498e4['uniqueid']][_0x9ba0('0x4a')]=_0xb498e4[_0x9ba0('0x49')];}if(!_['isNil'](_0xb498e4['variable'][_0x9ba0('0x4b')])){utils[_0x9ba0('0xb')](util[_0x9ba0('0xc')](_0x9ba0('0x4c'),_0xb498e4[_0x9ba0('0x9')],_0xb498e4['value']));channels[_0xb498e4[_0x9ba0('0x9')]][_0x9ba0('0x4d')]=_0xb498e4[_0x9ba0('0x49')];channels[_0xb498e4[_0x9ba0('0x9')]][_0x9ba0('0x30')]='\x22'+_0xb498e4[_0x9ba0('0x49')]+_0x9ba0('0x4e')+_0xb498e4[_0x9ba0('0x49')]+'>';}if(!_['isNil'](_0xb498e4['variable'][_0x9ba0('0x4f')])||!_['isNil'](_0xb498e4['variable']['xmd-callerid'])){utils[_0x9ba0('0xb')](util[_0x9ba0('0xc')](_0x9ba0('0x50'),_0xb498e4['uniqueid'],!_[_0x9ba0('0x24')](_0xb498e4[_0x9ba0('0x51')][_0x9ba0('0x4f')])?_0x9ba0('0x4f'):_0x9ba0('0x52'),_0xb498e4['value']));channels[_0xb498e4['uniqueid']][_0x9ba0('0x30')]=_0xb498e4[_0x9ba0('0x49')];}if(!_[_0x9ba0('0x24')](_0xb498e4[_0x9ba0('0x51')][_0x9ba0('0x53')])||!_[_0x9ba0('0x24')](_0xb498e4[_0x9ba0('0x51')][_0x9ba0('0x54')])){utils[_0x9ba0('0xb')](util['format'](_0x9ba0('0x50'),_0xb498e4[_0x9ba0('0x9')],!_[_0x9ba0('0x24')](_0xb498e4[_0x9ba0('0x51')][_0x9ba0('0x53')])?'xmd-queue':_0x9ba0('0x54'),_0xb498e4['value']));channels[_0xb498e4[_0x9ba0('0x9')]]['lastapplication']=_0x9ba0('0x55');channels[_0xb498e4[_0x9ba0('0x9')]][_0x9ba0('0x56')]=_0xb498e4[_0x9ba0('0x49')];channels[_0xb498e4['uniqueid']][_0x9ba0('0xf')]=!![];}if(!_[_0x9ba0('0x24')](_0xb498e4['variable'][_0x9ba0('0x57')])){utils[_0x9ba0('0xb')](util[_0x9ba0('0xc')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0xb498e4['uniqueid'],_0xb498e4[_0x9ba0('0x49')]));channels[_0xb498e4[_0x9ba0('0x9')]][_0x9ba0('0x58')]=_0xb498e4[_0x9ba0('0x49')];}if(!_[_0x9ba0('0x24')](_0xb498e4[_0x9ba0('0x51')][_0x9ba0('0x59')])){utils[_0x9ba0('0xb')](util[_0x9ba0('0xc')](_0x9ba0('0x5a'),_0xb498e4['uniqueid'],_0xb498e4['value']));channels[_0xb498e4['uniqueid']][_0x9ba0('0x5b')]=_0xb498e4[_0x9ba0('0x49')];}if(!_['isNil'](_0xb498e4[_0x9ba0('0x51')][_0x9ba0('0x5c')])){utils[_0x9ba0('0xb')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0xb498e4[_0x9ba0('0x9')],_0xb498e4[_0x9ba0('0x49')]));channels[_0xb498e4['uniqueid']][_0x9ba0('0x5d')]=_0xb498e4[_0x9ba0('0x49')];}if(!_[_0x9ba0('0x24')](_0xb498e4[_0x9ba0('0x51')]['sipcallid'])){utils[_0x9ba0('0xb')](util[_0x9ba0('0xc')](_0x9ba0('0x5e'),_0xb498e4[_0x9ba0('0x9')],_0xb498e4[_0x9ba0('0x49')]));channels[_0xb498e4[_0x9ba0('0x9')]][_0x9ba0('0x5f')]=_0xb498e4[_0x9ba0('0x49')];}}}catch(_0x59d381){utils[_0x9ba0('0x20')](util[_0x9ba0('0xc')]('[%s][calls][varset]',_0xb498e4[_0x9ba0('0x9')]),_0x59d381);}};exports[_0x9ba0('0x60')]=function(_0x2cb930){try{if(!_['isNil'](channels[_0x2cb930[_0x9ba0('0x9')]])){utils[_0x9ba0('0x22')](util[_0x9ba0('0xc')](_0x9ba0('0x61'),_0x2cb930['uniqueid']),_0x2cb930);utils[_0x9ba0('0xb')](util[_0x9ba0('0xc')](_0x9ba0('0x62'),_0x2cb930['uniqueid'],_0x2cb930[_0x9ba0('0x63')],_0x2cb930['appdata']));if(_0x2cb930[_0x9ba0('0x63')][_0x9ba0('0x64')]()==_0x9ba0('0x65')&&_[_0x9ba0('0x66')](_0x2cb930['appdata'][_0x9ba0('0x64')](),_0x9ba0('0x67'))){var _0x27f125=_0x2cb930[_0x9ba0('0x68')][_0x9ba0('0x69')]('=');var _0x23e25e=_0x27f125[0x0][_0x9ba0('0x6a')](_0x27f125[0x0][_0x9ba0('0x6b')]('(')+0x1,_0x27f125[0x0][_0x9ba0('0x6b')](')'));var _0x22e83d=_0x27f125[0x1];channels[_0x2cb930[_0x9ba0('0x9')]][_0x23e25e]=_0x22e83d;}if(!_[_0x9ba0('0x6c')]([_0x9ba0('0x2e'),'noop',_0x9ba0('0x6d'),_0x9ba0('0x65'),_0x9ba0('0x6e')],_0x2cb930['application']['toLowerCase']())){channels[_0x2cb930['uniqueid']][_0x9ba0('0x6f')]=_0x2cb930[_0x9ba0('0x63')];channels[_0x2cb930[_0x9ba0('0x9')]][_0x9ba0('0x56')]=_0x2cb930[_0x9ba0('0x68')];}}}catch(_0x14c2b2){utils['error'](util[_0x9ba0('0xc')]('[%s][calls][newexten]',_0x2cb930[_0x9ba0('0x9')]),_0x14c2b2);}}; \ No newline at end of file +var _0xe9e9=['set','startsWith','cdr','split','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','interface','calleridnum','connectedlinenum','getUserByInternal','then','request','CreateVoiceCallReport','debug','format','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','disposition','channelstate','hangup','callerid','calleridname','cause-txt','duration','diffTime','starttime','billableseconds','answertime','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','xmd-originatecalleridnum','value','variable','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0xe9e9,0x1c1));var _0x9e9e=function(_0x447779,_0x279ecd){_0x447779=_0x447779-0x0;var _0x122a93=_0xe9e9[_0x447779];return _0x122a93;};'use strict';var _=require(_0x9e9e('0x0'));var util=require(_0x9e9e('0x1'));var utils=require(_0x9e9e('0x2'));var transfers=require(_0x9e9e('0x3'));var dispositions=[_0x9e9e('0x4'),_0x9e9e('0x5'),_0x9e9e('0x5'),_0x9e9e('0x4'),_0x9e9e('0x4'),_0x9e9e('0x4'),_0x9e9e('0x6'),_0x9e9e('0x7'),'FAILED',_0x9e9e('0x5'),_0x9e9e('0x5')];var channels={};function writeDB(_0x5e0d08){var _0x116526;if(transfers[_0x9e9e('0x8')][_0x5e0d08[_0x9e9e('0x9')]]){_0x116526=_0x5e0d08[_0x9e9e('0x9')];_0x5e0d08['uniqueid']=transfers[_0x9e9e('0x8')][_0x5e0d08[_0x9e9e('0x9')]][_0x9e9e('0xa')];}utils['info'](util['format'](_0x9e9e('0xb'),_0x5e0d08[_0x9e9e('0x9')],_0x5e0d08['channel'],_0x5e0d08[_0x9e9e('0xc')],_0x5e0d08['membername'],_0x5e0d08[_0x9e9e('0xd')],_0x5e0d08[_0x9e9e('0xe')],_0x5e0d08[_0x9e9e('0xf')],_0x5e0d08['lastevent']));if(_0x5e0d08['accountcode']){utils[_0x9e9e('0x10')](_0x5e0d08['accountcode'])[_0x9e9e('0x11')](function(_0x4f208c){if(_0x4f208c){_0x5e0d08['UserId']=_0x4f208c['id'];}utils[_0x9e9e('0x12')](_0x9e9e('0x13'),_0x5e0d08);});}else{utils[_0x9e9e('0x12')]('CreateVoiceCallReport',_0x5e0d08);}if(channels[_0x5e0d08[_0x9e9e('0x9')]]){delete channels[_0x5e0d08['uniqueid']];}else if(_0x116526&&channels[_0x116526]){delete transfers[_0x9e9e('0x8')][_0x116526];delete channels[_0x116526];}}exports['newchannel']=function(_0x1916b2){try{utils[_0x9e9e('0x14')](util[_0x9e9e('0x15')](_0x9e9e('0x16'),_0x1916b2[_0x9e9e('0x9')]),_0x1916b2);if(_0x1916b2[_0x9e9e('0x9')]==_0x1916b2[_0x9e9e('0x17')]&&_0x1916b2[_0x9e9e('0x18')]!=_0x9e9e('0x19')){utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')](_0x9e9e('0x1b'),_0x1916b2[_0x9e9e('0x9')],_0x1916b2[_0x9e9e('0x1c')],_0x1916b2[_0x9e9e('0x1d')]));channels[_0x1916b2[_0x9e9e('0x9')]]={'uniqueid':_0x1916b2[_0x9e9e('0x9')],'accountcode':_0x1916b2[_0x9e9e('0x1e')],'source':_0x1916b2['calleridnum'],'destination':_0x1916b2[_0x9e9e('0x1d')],'destinationcontext':_0x1916b2['context'],'channel':_0x1916b2['channel'],'starttime':utils[_0x9e9e('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x9e9e('0x20')};}}catch(_0xdf2749){utils[_0x9e9e('0x21')](util[_0x9e9e('0x15')](_0x9e9e('0x16'),_0x1916b2[_0x9e9e('0x9')]),_0xdf2749);}};exports[_0x9e9e('0x22')]=function(_0x2e7ebf){try{utils[_0x9e9e('0x14')](util[_0x9e9e('0x15')](_0x9e9e('0x23'),_0x2e7ebf[_0x9e9e('0x9')]),_0x2e7ebf);if(!_[_0x9e9e('0x24')](channels[_0x2e7ebf[_0x9e9e('0x9')]])&&_0x2e7ebf['channelstate']==0x6){utils['info'](util[_0x9e9e('0x15')](_0x9e9e('0x25'),_0x2e7ebf[_0x9e9e('0x9')],_0x2e7ebf[_0x9e9e('0x1c')],_0x2e7ebf[_0x9e9e('0x18')]));if(_[_0x9e9e('0x24')](channels[_0x2e7ebf[_0x9e9e('0x9')]]['systemanswertime'])){channels[_0x2e7ebf[_0x9e9e('0x9')]][_0x9e9e('0x26')]=utils[_0x9e9e('0x1f')]();}}else if(!_[_0x9e9e('0x24')](channels[_0x2e7ebf[_0x9e9e('0x17')]])&&_0x2e7ebf['channelstate']==0x6&&_0x2e7ebf['context']!=_0x9e9e('0x27')){utils['info'](util['format'](_0x9e9e('0x28'),_0x2e7ebf['uniqueid'],_0x2e7ebf[_0x9e9e('0x17')],_0x2e7ebf['context'],_0x2e7ebf[_0x9e9e('0x18')]));channels[_0x2e7ebf['linkedid']][_0x9e9e('0x1e')]=_0x2e7ebf[_0x9e9e('0x1e')];channels[_0x2e7ebf[_0x9e9e('0x17')]][_0x9e9e('0x29')]=_0x2e7ebf[_0x9e9e('0x18')];if(_[_0x9e9e('0x24')](channels[_0x2e7ebf[_0x9e9e('0x17')]]['answertime'])){channels[_0x2e7ebf[_0x9e9e('0x17')]]['answertime']=utils[_0x9e9e('0x1f')]();}channels[_0x2e7ebf['linkedid']][_0x9e9e('0x2a')]=dispositions[_['toNumber'](_0x2e7ebf[_0x9e9e('0x2b')])]||_0x9e9e('0x6');}}catch(_0x1ea4bb){utils[_0x9e9e('0x21')](util[_0x9e9e('0x15')](_0x9e9e('0x23'),_0x2e7ebf[_0x9e9e('0x9')]),_0x1ea4bb);}};exports[_0x9e9e('0x2c')]=function(_0x205553){try{if(!_[_0x9e9e('0x24')](channels[_0x205553[_0x9e9e('0x9')]])){utils[_0x9e9e('0x14')](util[_0x9e9e('0x15')]('[%s][calls][hangup]',_0x205553[_0x9e9e('0x9')]),_0x205553);if(_[_0x9e9e('0x24')](channels[_0x205553['uniqueid']][_0x9e9e('0x2d')])){channels[_0x205553['uniqueid']][_0x9e9e('0x2d')]=_0x205553[_0x9e9e('0x2e')]+'\x20<'+_0x205553['calleridnum']+'>';}utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x205553[_0x9e9e('0x9')],channels[_0x205553[_0x9e9e('0x9')]][_0x9e9e('0x2d')],_0x205553[_0x9e9e('0x2f')]));channels[_0x205553[_0x9e9e('0x9')]]['endtime']=utils[_0x9e9e('0x1f')]();channels[_0x205553[_0x9e9e('0x9')]][_0x9e9e('0x30')]=utils[_0x9e9e('0x31')](channels[_0x205553[_0x9e9e('0x9')]]['endtime'],channels[_0x205553['uniqueid']][_0x9e9e('0x32')]);channels[_0x205553['uniqueid']][_0x9e9e('0x33')]=channels[_0x205553[_0x9e9e('0x9')]][_0x9e9e('0x34')]?utils[_0x9e9e('0x31')](channels[_0x205553[_0x9e9e('0x9')]]['endtime'],channels[_0x205553[_0x9e9e('0x9')]][_0x9e9e('0x34')]):0x0;writeDB(channels[_0x205553[_0x9e9e('0x9')]]);}}catch(_0x183912){utils['error'](util[_0x9e9e('0x15')]('[%s][calls][hangup]',_0x205553['uniqueid']),_0x183912);}};exports[_0x9e9e('0x35')]=function(_0x154cae){try{if(!_['isNil'](channels[_0x154cae['localtwolinkedid']])){utils[_0x9e9e('0x14')](util[_0x9e9e('0x15')](_0x9e9e('0x36'),_0x154cae[_0x9e9e('0x37')]),_0x154cae);if(channels[_0x154cae[_0x9e9e('0x38')]][_0x9e9e('0x18')]==_0x154cae[_0x9e9e('0x39')]){utils['info'](util[_0x9e9e('0x15')](_0x9e9e('0x3a'),_0x154cae['origtransfereruniqueid'],_0x154cae['localtwolinkedid'],_0x154cae[_0x9e9e('0x3b')]));channels[_0x154cae['localtwolinkedid']][_0x9e9e('0x29')]=_0x154cae[_0x9e9e('0x3b')];channels[_0x154cae[_0x9e9e('0x38')]][_0x9e9e('0x3c')]=_0x9e9e('0x3d');}else if(channels[_0x154cae['localtwolinkedid']][_0x9e9e('0x18')]=_0x154cae[_0x9e9e('0x3e')]){utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x154cae['origtransfereruniqueid'],_0x154cae[_0x9e9e('0x38')],_0x154cae[_0x9e9e('0x3f')]));channels[_0x154cae[_0x9e9e('0x38')]][_0x9e9e('0x29')]=_0x154cae[_0x9e9e('0x3f')];channels[_0x154cae[_0x9e9e('0x38')]][_0x9e9e('0x3c')]=_0x9e9e('0x3d');}}}catch(_0x4f76e7){utils[_0x9e9e('0x21')](util[_0x9e9e('0x15')](_0x9e9e('0x36'),_0x154cae[_0x9e9e('0x37')]),_0x4f76e7);}};exports[_0x9e9e('0x40')]=function(_0x111fe7){try{if(!_['isNil'](channels[_0x111fe7[_0x9e9e('0x9')]])){utils[_0x9e9e('0x14')](util[_0x9e9e('0x15')]('[%s][calls][musiconholdstart]',_0x111fe7[_0x9e9e('0x9')]),_0x111fe7);channels[_0x111fe7[_0x9e9e('0x9')]][_0x9e9e('0x41')]=utils[_0x9e9e('0x1f')]();utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')](_0x9e9e('0x42'),_0x111fe7[_0x9e9e('0x9')],channels[_0x111fe7['uniqueid']][_0x9e9e('0x41')]));}}catch(_0x394985){utils['error'](util[_0x9e9e('0x15')]('[%s][calls][musiconholdstart]',_0x111fe7[_0x9e9e('0x9')]),_0x394985);}};exports[_0x9e9e('0x43')]=function(_0x55d68f){try{if(!_[_0x9e9e('0x24')](channels[_0x55d68f[_0x9e9e('0x9')]])){utils[_0x9e9e('0x14')](util[_0x9e9e('0x15')](_0x9e9e('0x44'),_0x55d68f[_0x9e9e('0x9')]),_0x55d68f);if(!_['isNil'](channels[_0x55d68f[_0x9e9e('0x9')]][_0x9e9e('0x41')])){channels[_0x55d68f['uniqueid']][_0x9e9e('0x45')]+=utils['diffTime'](utils['now'](),channels[_0x55d68f['uniqueid']][_0x9e9e('0x41')]);utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x55d68f[_0x9e9e('0x9')],channels[_0x55d68f[_0x9e9e('0x9')]][_0x9e9e('0x45')]));delete channels[_0x55d68f[_0x9e9e('0x9')]][_0x9e9e('0x41')];}}}catch(_0x348002){utils['error'](util['format'](_0x9e9e('0x44'),_0x55d68f[_0x9e9e('0x9')]),_0x348002);}};exports[_0x9e9e('0x46')]=function(_0xe7aa4e){try{if(!_[_0x9e9e('0x24')](channels[_0xe7aa4e[_0x9e9e('0x9')]])){utils[_0x9e9e('0x14')](util['format']('[%s][calls][varset]',_0xe7aa4e[_0x9e9e('0x9')]),_0xe7aa4e);if(!_[_0x9e9e('0x24')](_0xe7aa4e['variable'][_0x9e9e('0x47')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0xe7aa4e[_0x9e9e('0x9')],_0xe7aa4e[_0x9e9e('0x48')]));channels[_0xe7aa4e[_0x9e9e('0x9')]]['source']=_0xe7aa4e[_0x9e9e('0x48')];}if(!_[_0x9e9e('0x24')](_0xe7aa4e[_0x9e9e('0x49')]['xmd-phone'])){utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0xe7aa4e[_0x9e9e('0x9')],_0xe7aa4e[_0x9e9e('0x48')]));channels[_0xe7aa4e[_0x9e9e('0x9')]][_0x9e9e('0x4a')]=_0xe7aa4e['value'];channels[_0xe7aa4e['uniqueid']][_0x9e9e('0x2d')]='\x22'+_0xe7aa4e[_0x9e9e('0x48')]+_0x9e9e('0x4b')+_0xe7aa4e['value']+'>';}if(!_['isNil'](_0xe7aa4e[_0x9e9e('0x49')]['xmd-callerid-preview'])||!_['isNil'](_0xe7aa4e[_0x9e9e('0x49')][_0x9e9e('0x4c')])){utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')](_0x9e9e('0x4d'),_0xe7aa4e[_0x9e9e('0x9')],!_[_0x9e9e('0x24')](_0xe7aa4e['variable'][_0x9e9e('0x4e')])?_0x9e9e('0x4e'):'xmd-callerid',_0xe7aa4e[_0x9e9e('0x48')]));channels[_0xe7aa4e['uniqueid']][_0x9e9e('0x2d')]=_0xe7aa4e['value'];}if(!_[_0x9e9e('0x24')](_0xe7aa4e[_0x9e9e('0x49')][_0x9e9e('0x4f')])||!_[_0x9e9e('0x24')](_0xe7aa4e[_0x9e9e('0x49')][_0x9e9e('0x50')])){utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0xe7aa4e[_0x9e9e('0x9')],!_[_0x9e9e('0x24')](_0xe7aa4e[_0x9e9e('0x49')][_0x9e9e('0x4f')])?_0x9e9e('0x4f'):_0x9e9e('0x50'),_0xe7aa4e[_0x9e9e('0x48')]));channels[_0xe7aa4e[_0x9e9e('0x9')]][_0x9e9e('0x51')]=_0x9e9e('0x52');channels[_0xe7aa4e[_0x9e9e('0x9')]]['lastdata']=_0xe7aa4e[_0x9e9e('0x48')];channels[_0xe7aa4e[_0x9e9e('0x9')]]['queue']=!![];}if(!_[_0x9e9e('0x24')](_0xe7aa4e[_0x9e9e('0x49')][_0x9e9e('0x53')])){utils['info'](util[_0x9e9e('0x15')](_0x9e9e('0x54'),_0xe7aa4e[_0x9e9e('0x9')],_0xe7aa4e[_0x9e9e('0x48')]));channels[_0xe7aa4e[_0x9e9e('0x9')]][_0x9e9e('0x55')]=_0xe7aa4e[_0x9e9e('0x48')];}if(!_[_0x9e9e('0x24')](_0xe7aa4e['variable'][_0x9e9e('0x56')])){utils['info'](util['format'](_0x9e9e('0x57'),_0xe7aa4e[_0x9e9e('0x9')],_0xe7aa4e['value']));channels[_0xe7aa4e[_0x9e9e('0x9')]][_0x9e9e('0x58')]=_0xe7aa4e[_0x9e9e('0x48')];}if(!_[_0x9e9e('0x24')](_0xe7aa4e[_0x9e9e('0x49')][_0x9e9e('0x59')])){utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')](_0x9e9e('0x5a'),_0xe7aa4e['uniqueid'],_0xe7aa4e[_0x9e9e('0x48')]));channels[_0xe7aa4e[_0x9e9e('0x9')]][_0x9e9e('0x5b')]=_0xe7aa4e[_0x9e9e('0x48')];}if(!_['isNil'](_0xe7aa4e[_0x9e9e('0x49')][_0x9e9e('0x5c')])){utils['info'](util['format'](_0x9e9e('0x5d'),_0xe7aa4e[_0x9e9e('0x9')],_0xe7aa4e[_0x9e9e('0x48')]));channels[_0xe7aa4e['uniqueid']][_0x9e9e('0x5c')]=_0xe7aa4e[_0x9e9e('0x48')];}}}catch(_0xd580dd){utils[_0x9e9e('0x21')](util[_0x9e9e('0x15')](_0x9e9e('0x5e'),_0xe7aa4e[_0x9e9e('0x9')]),_0xd580dd);}};exports[_0x9e9e('0x5f')]=function(_0x3b6ef0){try{if(!_[_0x9e9e('0x24')](channels[_0x3b6ef0[_0x9e9e('0x9')]])){utils[_0x9e9e('0x14')](util['format'](_0x9e9e('0x60'),_0x3b6ef0['uniqueid']),_0x3b6ef0);utils['info'](util[_0x9e9e('0x15')](_0x9e9e('0x61'),_0x3b6ef0[_0x9e9e('0x9')],_0x3b6ef0[_0x9e9e('0x62')],_0x3b6ef0[_0x9e9e('0x63')]));if(_0x3b6ef0[_0x9e9e('0x62')][_0x9e9e('0x64')]()==_0x9e9e('0x65')&&_[_0x9e9e('0x66')](_0x3b6ef0[_0x9e9e('0x63')][_0x9e9e('0x64')](),_0x9e9e('0x67'))){var _0x4e7149=_0x3b6ef0[_0x9e9e('0x63')][_0x9e9e('0x68')]('=');var _0x3e4345=_0x4e7149[0x0]['substring'](_0x4e7149[0x0][_0x9e9e('0x69')]('(')+0x1,_0x4e7149[0x0][_0x9e9e('0x69')](')'));var _0x585c09=_0x4e7149[0x1];channels[_0x3b6ef0[_0x9e9e('0x9')]][_0x3e4345]=_0x585c09;}if(!_[_0x9e9e('0x6a')](['hangup',_0x9e9e('0x6b'),_0x9e9e('0x6c'),'set',_0x9e9e('0x6d')],_0x3b6ef0['application'][_0x9e9e('0x64')]())){channels[_0x3b6ef0[_0x9e9e('0x9')]]['lastapplication']=_0x3b6ef0[_0x9e9e('0x62')];channels[_0x3b6ef0[_0x9e9e('0x9')]]['lastdata']=_0x3b6ef0[_0x9e9e('0x63')];}}}catch(_0x26dc6c){utils[_0x9e9e('0x21')](util[_0x9e9e('0x15')](_0x9e9e('0x60'),_0x3b6ef0['uniqueid']),_0x26dc6c);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 67b7478..49a97d4 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 _0xe229=['[core]\x20shutdown','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','shutdown','info'];(function(_0x2ed63c,_0x287b18){var _0x4812ff=function(_0x582bc5){while(--_0x582bc5){_0x2ed63c['push'](_0x2ed63c['shift']());}};_0x4812ff(++_0x287b18);}(_0xe229,0x1e6));var _0x9e22=function(_0x1869f9,_0x15bc61){_0x1869f9=_0x1869f9-0x0;var _0x49c560=_0xe229[_0x1869f9];return _0x49c560;};'use strict';var utils=require(_0x9e22('0x0'));exports[_0x9e22('0x1')]=function(){utils['info']('[core]\x20connected');};exports[_0x9e22('0x2')]=function(){utils[_0x9e22('0x3')](_0x9e22('0x4'));};exports['fullybooted']=function(){utils[_0x9e22('0x3')]('[core]\x20fullybooted');};exports[_0x9e22('0x5')]=function(_0x4e33c2){utils[_0x9e22('0x5')](_0x9e22('0x6'),_0x4e33c2);};exports[_0x9e22('0x7')]=function(){utils[_0x9e22('0x3')](_0x9e22('0x8'));};exports[_0x9e22('0x9')]=function(_0xbed0fb){}; \ No newline at end of file +var _0x7949=['fullybooted','info','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect','[core]\x20connected','[core]\x20shutdown'];(function(_0x52de74,_0x152687){var _0x33113e=function(_0x182424){while(--_0x182424){_0x52de74['push'](_0x52de74['shift']());}};_0x33113e(++_0x152687);}(_0x7949,0x152));var _0x9794=function(_0x4e692d,_0x320ce5){_0x4e692d=_0x4e692d-0x0;var _0x49b78d=_0x7949[_0x4e692d];return _0x49b78d;};'use strict';var utils=require('./utils');exports[_0x9794('0x0')]=function(){utils['info'](_0x9794('0x1'));};exports['shutdown']=function(){utils['info'](_0x9794('0x2'));};exports[_0x9794('0x3')]=function(){utils[_0x9794('0x4')](_0x9794('0x5'));};exports['error']=function(_0x516510){utils[_0x9794('0x6')](_0x9794('0x7'),_0x516510);};exports[_0x9794('0x8')]=function(){utils[_0x9794('0x4')](_0x9794('0x9'));};exports[_0x9794('0xa')]=function(_0x3722a2){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index aa793ad..f9a8d21 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 _0xfc60=['holdtime','endtime','billableseconds','[%s][dials][hangup]','./utils','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','error','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','diffTime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc60,0x103));var _0x0fc6=function(_0x127a3c,_0xd22972){_0x127a3c=_0x127a3c-0x0;var _0x5a999b=_0xfc60[_0x127a3c];return _0x5a999b;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x0fc6('0x0'));var dials={};function writeDB(_0x4b0332){utils[_0x0fc6('0x1')](util[_0x0fc6('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x4b0332[_0x0fc6('0x3')],_0x4b0332[_0x0fc6('0x4')],_0x4b0332[_0x0fc6('0x5')],_0x4b0332[_0x0fc6('0x6')],_0x4b0332[_0x0fc6('0x7')],_0x4b0332['dialstatus']));utils['request'](_0x0fc6('0x8'),_0x4b0332);delete dials[_0x4b0332[_0x0fc6('0x3')]];}exports[_0x0fc6('0x9')]=function(_0x24c5d1){try{utils[_0x0fc6('0xa')](util['format'](_0x0fc6('0xb'),_0x24c5d1['uniqueid']),_0x24c5d1);utils[_0x0fc6('0x1')](util['format'](_0x0fc6('0xc'),_0x24c5d1[_0x0fc6('0x3')],_0x24c5d1['application'],_0x24c5d1['appdata']));if(_0x24c5d1[_0x0fc6('0xd')][_0x0fc6('0xe')]()==_0x0fc6('0xf')&&_[_0x0fc6('0x10')](_0x24c5d1[_0x0fc6('0x11')][_0x0fc6('0xe')](),_0x0fc6('0x12'))){var _0x1d1387=_0x24c5d1[_0x0fc6('0x11')]['split']('=');dials[_0x24c5d1[_0x0fc6('0x3')]]={'routeId':_0x1d1387[0x1]};}}catch(_0x3128f6){utils[_0x0fc6('0x13')](util[_0x0fc6('0x2')]('[%s][dials][newexten]',_0x24c5d1[_0x0fc6('0x3')]),_0x3128f6);}};exports[_0x0fc6('0x14')]=function(_0x27bd31){try{utils[_0x0fc6('0xa')](util['format'](_0x0fc6('0x15'),_0x27bd31[_0x0fc6('0x3')]),_0x27bd31);if(!_[_0x0fc6('0x16')](_0x27bd31[_0x0fc6('0x17')]['outboundrouteid'])){utils['info'](util[_0x0fc6('0x2')](_0x0fc6('0x18'),_0x27bd31[_0x0fc6('0x3')],_0x27bd31[_0x0fc6('0x19')]));dials[_0x27bd31['uniqueid']]={'routeId':_0x27bd31[_0x0fc6('0x19')]};}}catch(_0xd0b62e){utils[_0x0fc6('0x13')](util[_0x0fc6('0x2')]('[%s][dials][varset]',_0x27bd31[_0x0fc6('0x3')]),_0xd0b62e);}};exports[_0x0fc6('0x1a')]=function(_0x35017d){try{if(!_['isNil'](dials[_0x35017d[_0x0fc6('0x3')]])){utils['debug'](util[_0x0fc6('0x2')](_0x0fc6('0x1b'),_0x35017d[_0x0fc6('0x3')]),_0x35017d);dials[_0x35017d[_0x0fc6('0x3')]]=_[_0x0fc6('0x1c')](dials[_0x35017d[_0x0fc6('0x3')]],_0x35017d);dials[_0x35017d[_0x0fc6('0x3')]][_0x0fc6('0x1d')]=utils[_0x0fc6('0x1e')]();dials[_0x35017d[_0x0fc6('0x3')]][_0x0fc6('0x1f')]=_0x0fc6('0x20');utils[_0x0fc6('0x1')](util[_0x0fc6('0x2')](_0x0fc6('0x21'),_0x35017d[_0x0fc6('0x3')],dials[_0x35017d[_0x0fc6('0x3')]]['starttime']));}}catch(_0x2de6d3){utils[_0x0fc6('0x13')](util[_0x0fc6('0x2')](_0x0fc6('0x1b'),_0x35017d['uniqueid']),_0x2de6d3);}};exports[_0x0fc6('0x22')]=function(_0x35e83d){try{if(!_[_0x0fc6('0x16')](dials[_0x35e83d['uniqueid']])){utils[_0x0fc6('0xa')](util[_0x0fc6('0x2')](_0x0fc6('0x23'),_0x35e83d[_0x0fc6('0x3')]),_0x35e83d);dials[_0x35e83d[_0x0fc6('0x3')]][_0x0fc6('0x24')]=_0x35e83d[_0x0fc6('0x24')];if(_0x35e83d[_0x0fc6('0x24')]=='ANSWER'){dials[_0x35e83d[_0x0fc6('0x3')]]=_[_0x0fc6('0x1c')](dials[_0x35e83d['uniqueid']],_0x35e83d);dials[_0x35e83d[_0x0fc6('0x3')]][_0x0fc6('0x25')]=utils[_0x0fc6('0x1e')]();dials[_0x35e83d[_0x0fc6('0x3')]][_0x0fc6('0x1f')]=_0x0fc6('0x26');utils['info'](util[_0x0fc6('0x2')](_0x0fc6('0x27'),_0x35e83d['uniqueid'],_0x35e83d['dialstatus'],dials[_0x35e83d[_0x0fc6('0x3')]][_0x0fc6('0x25')]));}else{utils['info'](util[_0x0fc6('0x2')](_0x0fc6('0x28'),_0x35e83d[_0x0fc6('0x3')],_0x35e83d[_0x0fc6('0x24')]));}}}catch(_0x495718){utils[_0x0fc6('0x13')](util[_0x0fc6('0x2')](_0x0fc6('0x23'),_0x35e83d[_0x0fc6('0x3')]),_0x495718);}};exports[_0x0fc6('0x29')]=function(_0x59149b){try{if(!_[_0x0fc6('0x16')](dials[_0x59149b['uniqueid']])){utils['debug'](util[_0x0fc6('0x2')]('[%s][dials][hangup]',_0x59149b[_0x0fc6('0x3')]),_0x59149b);utils[_0x0fc6('0x1')](util[_0x0fc6('0x2')](_0x0fc6('0x2a'),_0x59149b[_0x0fc6('0x3')],_0x59149b[_0x0fc6('0x6')],_0x59149b['calleridname'],_0x59149b[_0x0fc6('0x2b')]));dials[_0x59149b[_0x0fc6('0x3')]]=_['assign'](dials[_0x59149b[_0x0fc6('0x3')]],{'endtime':utils[_0x0fc6('0x1e')](),'lastevent':_0x0fc6('0x2c')});dials[_0x59149b[_0x0fc6('0x3')]][_0x0fc6('0x2d')]=utils[_0x0fc6('0x2e')](dials[_0x59149b[_0x0fc6('0x3')]]['endtime'],dials[_0x59149b[_0x0fc6('0x3')]]['starttime']);dials[_0x59149b[_0x0fc6('0x3')]][_0x0fc6('0x2f')]=utils[_0x0fc6('0x2e')](dials[_0x59149b[_0x0fc6('0x3')]][_0x0fc6('0x25')]||dials[_0x59149b['uniqueid']][_0x0fc6('0x30')],dials[_0x59149b['uniqueid']][_0x0fc6('0x1d')]);dials[_0x59149b[_0x0fc6('0x3')]][_0x0fc6('0x31')]=dials[_0x59149b[_0x0fc6('0x3')]]['answertime']?utils[_0x0fc6('0x2e')](dials[_0x59149b['uniqueid']][_0x0fc6('0x30')],dials[_0x59149b[_0x0fc6('0x3')]][_0x0fc6('0x25')]):0x0;writeDB(dials[_0x59149b[_0x0fc6('0x3')]]);}}catch(_0x1c216f){utils[_0x0fc6('0x13')](util[_0x0fc6('0x2')](_0x0fc6('0x32'),_0x59149b[_0x0fc6('0x3')]),_0x1c216f);}}; \ No newline at end of file +var _0x7129=['[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','holdtime','billableseconds','endtime','lodash','./utils','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','error','varset','debug','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','dialstatus','ANSWER','assign','answertime','now'];(function(_0x4dad15,_0x30f850){var _0x4dda5e=function(_0x5e3f9a){while(--_0x5e3f9a){_0x4dad15['push'](_0x4dad15['shift']());}};_0x4dda5e(++_0x30f850);}(_0x7129,0x70));var _0x9712=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x7129[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x9712('0x0'));var util=require('util');var utils=require(_0x9712('0x1'));var dials={};function writeDB(_0x515cae){utils[_0x9712('0x2')](util[_0x9712('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x515cae[_0x9712('0x4')],_0x515cae[_0x9712('0x5')],_0x515cae[_0x9712('0x6')],_0x515cae[_0x9712('0x7')],_0x515cae[_0x9712('0x8')],_0x515cae['dialstatus']));utils[_0x9712('0x9')](_0x9712('0xa'),_0x515cae);delete dials[_0x515cae[_0x9712('0x4')]];}exports[_0x9712('0xb')]=function(_0x389080){try{utils['debug'](util['format'](_0x9712('0xc'),_0x389080[_0x9712('0x4')]),_0x389080);utils[_0x9712('0x2')](util[_0x9712('0x3')](_0x9712('0xd'),_0x389080[_0x9712('0x4')],_0x389080[_0x9712('0xe')],_0x389080[_0x9712('0xf')]));if(_0x389080[_0x9712('0xe')][_0x9712('0x10')]()=='set'&&_[_0x9712('0x11')](_0x389080['appdata']['toLowerCase'](),_0x9712('0x12'))){var _0x2407b7=_0x389080[_0x9712('0xf')]['split']('=');dials[_0x389080[_0x9712('0x4')]]={'routeId':_0x2407b7[0x1]};}}catch(_0x52d104){utils[_0x9712('0x13')](util[_0x9712('0x3')]('[%s][dials][newexten]',_0x389080[_0x9712('0x4')]),_0x52d104);}};exports[_0x9712('0x14')]=function(_0x3bd67f){try{utils[_0x9712('0x15')](util[_0x9712('0x3')]('[%s][dials][varset]',_0x3bd67f[_0x9712('0x4')]),_0x3bd67f);if(!_[_0x9712('0x16')](_0x3bd67f[_0x9712('0x17')]['outboundrouteid'])){utils[_0x9712('0x2')](util[_0x9712('0x3')](_0x9712('0x18'),_0x3bd67f[_0x9712('0x4')],_0x3bd67f[_0x9712('0x19')]));dials[_0x3bd67f[_0x9712('0x4')]]={'routeId':_0x3bd67f['value']};}}catch(_0x174486){utils[_0x9712('0x13')](util[_0x9712('0x3')]('[%s][dials][varset]',_0x3bd67f[_0x9712('0x4')]),_0x174486);}};exports[_0x9712('0x1a')]=function(_0x41697b){try{if(!_['isNil'](dials[_0x41697b[_0x9712('0x4')]])){utils[_0x9712('0x15')](util[_0x9712('0x3')]('[%s][dials][dialbegin]',_0x41697b['uniqueid']),_0x41697b);dials[_0x41697b[_0x9712('0x4')]]=_['assign'](dials[_0x41697b[_0x9712('0x4')]],_0x41697b);dials[_0x41697b[_0x9712('0x4')]][_0x9712('0x1b')]=utils['now']();dials[_0x41697b[_0x9712('0x4')]][_0x9712('0x1c')]=_0x9712('0x1d');utils[_0x9712('0x2')](util[_0x9712('0x3')](_0x9712('0x1e'),_0x41697b['uniqueid'],dials[_0x41697b['uniqueid']]['starttime']));}}catch(_0x197f84){utils[_0x9712('0x13')](util[_0x9712('0x3')](_0x9712('0x1f'),_0x41697b[_0x9712('0x4')]),_0x197f84);}};exports[_0x9712('0x20')]=function(_0xced040){try{if(!_[_0x9712('0x16')](dials[_0xced040[_0x9712('0x4')]])){utils[_0x9712('0x15')](util[_0x9712('0x3')]('[%s][dials][dialend]',_0xced040['uniqueid']),_0xced040);dials[_0xced040['uniqueid']][_0x9712('0x21')]=_0xced040[_0x9712('0x21')];if(_0xced040[_0x9712('0x21')]==_0x9712('0x22')){dials[_0xced040['uniqueid']]=_[_0x9712('0x23')](dials[_0xced040['uniqueid']],_0xced040);dials[_0xced040[_0x9712('0x4')]][_0x9712('0x24')]=utils[_0x9712('0x25')]();dials[_0xced040[_0x9712('0x4')]]['lastevent']='connect';utils['info'](util['format'](_0x9712('0x26'),_0xced040[_0x9712('0x4')],_0xced040[_0x9712('0x21')],dials[_0xced040[_0x9712('0x4')]][_0x9712('0x24')]));}else{utils[_0x9712('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0xced040['uniqueid'],_0xced040[_0x9712('0x21')]));}}}catch(_0x458371){utils[_0x9712('0x13')](util[_0x9712('0x3')](_0x9712('0x27'),_0xced040[_0x9712('0x4')]),_0x458371);}};exports['hangup']=function(_0x146f17){try{if(!_['isNil'](dials[_0x146f17[_0x9712('0x4')]])){utils[_0x9712('0x15')](util['format'](_0x9712('0x28'),_0x146f17[_0x9712('0x4')]),_0x146f17);utils[_0x9712('0x2')](util[_0x9712('0x3')](_0x9712('0x29'),_0x146f17['uniqueid'],_0x146f17['calleridnum'],_0x146f17[_0x9712('0x2a')],_0x146f17[_0x9712('0x2b')]));dials[_0x146f17[_0x9712('0x4')]]=_[_0x9712('0x23')](dials[_0x146f17[_0x9712('0x4')]],{'endtime':utils[_0x9712('0x25')](),'lastevent':_0x9712('0x2c')});dials[_0x146f17[_0x9712('0x4')]][_0x9712('0x2d')]=utils[_0x9712('0x2e')](dials[_0x146f17['uniqueid']]['endtime'],dials[_0x146f17[_0x9712('0x4')]][_0x9712('0x1b')]);dials[_0x146f17[_0x9712('0x4')]][_0x9712('0x2f')]=utils[_0x9712('0x2e')](dials[_0x146f17[_0x9712('0x4')]][_0x9712('0x24')]||dials[_0x146f17[_0x9712('0x4')]]['endtime'],dials[_0x146f17[_0x9712('0x4')]]['starttime']);dials[_0x146f17[_0x9712('0x4')]][_0x9712('0x30')]=dials[_0x146f17['uniqueid']][_0x9712('0x24')]?utils[_0x9712('0x2e')](dials[_0x146f17[_0x9712('0x4')]][_0x9712('0x31')],dials[_0x146f17[_0x9712('0x4')]][_0x9712('0x24')]):0x0;writeDB(dials[_0x146f17[_0x9712('0x4')]]);}}catch(_0x28b44f){utils[_0x9712('0x13')](util[_0x9712('0x3')]('[%s][dials][hangup]',_0x146f17[_0x9712('0x4')]),_0x28b44f);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 2ff0f0d..b73240c 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 _0x3ccb=['./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','./utils','util','asterisk','port','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3ccb,0xbe));var _0xb3cc=function(_0x3a3731,_0x2d573a){_0x3a3731=_0x3a3731-0x0;var _0x23ee93=_0x3ccb[_0x3a3731];return _0x23ee93;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0xb3cc('0x0'));var util=require(_0xb3cc('0x1'));var ami=new AsteriskManager(config[_0xb3cc('0x2')][_0xb3cc('0x3')],config[_0xb3cc('0x2')]['ip'],config[_0xb3cc('0x2')]['username'],config['asterisk']['password'],!![]);ami[_0xb3cc('0x4')]();if(config['xdr']&&config[_0xb3cc('0x5')][_0xb3cc('0x6')]){utils[_0xb3cc('0x7')](_0xb3cc('0x8'));}else{var agents=require(_0xb3cc('0x9'));var calls=require(_0xb3cc('0xa'));var queues=require(_0xb3cc('0xb'));var recordings=require(_0xb3cc('0xc'));var members=require(_0xb3cc('0xd'));var dials=require('./dials.controller');var transfers=require(_0xb3cc('0xe'));var core=require(_0xb3cc('0xf'));ami['on'](_0xb3cc('0x10'),core['connect']);ami['on'](_0xb3cc('0x11'),core[_0xb3cc('0x11')]);ami['on']('fullybooted',core[_0xb3cc('0x12')]);ami['on']('error',core[_0xb3cc('0x13')]);ami['on'](_0xb3cc('0x14'),core[_0xb3cc('0x14')]);ami['on']('managerevent',core[_0xb3cc('0x15')]);ami['on'](_0xb3cc('0x16'),function(_0x489d24){try{utils[_0xb3cc('0x17')](util[_0xb3cc('0x18')](_0xb3cc('0x19'),_0x489d24[_0xb3cc('0x1a')]),_0x489d24);members[_0xb3cc('0x16')](_0x489d24);}catch(_0x3ad61c){utils['error'](util[_0xb3cc('0x18')]('[%s][index][devicestatechange]',_0x489d24['device']),_0x3ad61c);}});ami['on'](_0xb3cc('0x1b'),function(_0x28d879){try{utils[_0xb3cc('0x17')](util[_0xb3cc('0x18')](_0xb3cc('0x1c'),_0x28d879[_0xb3cc('0x1d')]),_0x28d879);agents['agentcalled'](_0x28d879);}catch(_0x468ecb){utils[_0xb3cc('0x13')](util[_0xb3cc('0x18')](_0xb3cc('0x1c'),_0x28d879['uniqueid']),_0x468ecb);}});ami['on'](_0xb3cc('0x1e'),function(_0x37650e){try{utils[_0xb3cc('0x17')](util[_0xb3cc('0x18')](_0xb3cc('0x1f'),_0x37650e[_0xb3cc('0x1d')]),_0x37650e);agents[_0xb3cc('0x1e')](_0x37650e);}catch(_0x1f052c){utils[_0xb3cc('0x13')](util[_0xb3cc('0x18')]('[%s][index][agentringnoanswer]',_0x37650e[_0xb3cc('0x1d')]),_0x1f052c);}});ami['on'](_0xb3cc('0x20'),function(_0x412218){try{utils['debug'](util[_0xb3cc('0x18')](_0xb3cc('0x21'),_0x412218[_0xb3cc('0x1d')]),_0x412218);agents[_0xb3cc('0x20')](_0x412218);queues[_0xb3cc('0x20')](_0x412218);}catch(_0x336971){utils[_0xb3cc('0x13')](util['format'](_0xb3cc('0x21'),_0x412218[_0xb3cc('0x1d')]),_0x336971);}});ami['on']('agentcomplete',function(_0x29c7c8){try{utils[_0xb3cc('0x17')](util[_0xb3cc('0x18')]('[%s][index][agentcomplete]',_0x29c7c8['uniqueid']),_0x29c7c8);agents[_0xb3cc('0x22')](_0x29c7c8);queues[_0xb3cc('0x22')](_0x29c7c8);members[_0xb3cc('0x22')](_0x29c7c8);}catch(_0x597f25){utils['error'](util[_0xb3cc('0x18')](_0xb3cc('0x23'),_0x29c7c8[_0xb3cc('0x1d')]),_0x597f25);}});ami['on'](_0xb3cc('0x24'),function(_0x24b5a9){try{utils[_0xb3cc('0x17')](util[_0xb3cc('0x18')](_0xb3cc('0x25'),_0x24b5a9[_0xb3cc('0x1d')]),_0x24b5a9);agents['queuecallerabandon'](_0x24b5a9);queues[_0xb3cc('0x24')](_0x24b5a9);}catch(_0x119344){utils[_0xb3cc('0x13')](util[_0xb3cc('0x18')](_0xb3cc('0x25'),_0x24b5a9[_0xb3cc('0x1d')]),_0x119344);}});ami['on'](_0xb3cc('0x26'),function(_0x3da9ed){try{utils[_0xb3cc('0x17')](util['format'](_0xb3cc('0x27'),_0x3da9ed[_0xb3cc('0x1d')]),_0x3da9ed);queues[_0xb3cc('0x26')](_0x3da9ed);recordings[_0xb3cc('0x26')](_0x3da9ed);}catch(_0x3c8621){utils[_0xb3cc('0x13')](util['format'](_0xb3cc('0x27'),_0x3da9ed[_0xb3cc('0x1d')]),_0x3c8621);}});ami['on'](_0xb3cc('0x28'),function(_0x53c034){try{utils[_0xb3cc('0x17')](util[_0xb3cc('0x18')](_0xb3cc('0x29'),_0x53c034[_0xb3cc('0x1d')]),_0x53c034);queues[_0xb3cc('0x28')](_0x53c034);}catch(_0x4f2971){utils[_0xb3cc('0x13')](util[_0xb3cc('0x18')](_0xb3cc('0x29'),_0x53c034[_0xb3cc('0x1d')]),_0x4f2971);}});ami['on'](_0xb3cc('0x2a'),function(_0x364ef0){try{utils[_0xb3cc('0x17')](util[_0xb3cc('0x18')](_0xb3cc('0x2b'),_0x364ef0['uniqueid']),_0x364ef0);queues['musiconholdstart'](_0x364ef0);calls['musiconholdstart'](_0x364ef0);}catch(_0x2fb029){utils['error'](util['format'](_0xb3cc('0x2b'),_0x364ef0[_0xb3cc('0x1d')]),_0x2fb029);}});ami['on']('musiconholdstop',function(_0x5ee183){try{utils['debug'](util[_0xb3cc('0x18')](_0xb3cc('0x2c'),_0x5ee183[_0xb3cc('0x1d')]),_0x5ee183);queues[_0xb3cc('0x2d')](_0x5ee183);calls[_0xb3cc('0x2d')](_0x5ee183);}catch(_0x1d6775){utils[_0xb3cc('0x13')](util[_0xb3cc('0x18')]('[%s][index][musiconholdstop]',_0x5ee183['uniqueid']),_0x1d6775);}});ami['on'](_0xb3cc('0x2e'),function(_0x3e4898){try{utils[_0xb3cc('0x17')](util[_0xb3cc('0x18')](_0xb3cc('0x2f'),_0x3e4898[_0xb3cc('0x1d')]),_0x3e4898);calls[_0xb3cc('0x2e')](_0x3e4898);recordings[_0xb3cc('0x2e')](_0x3e4898);}catch(_0x30d063){utils['error'](util['format'](_0xb3cc('0x2f'),_0x3e4898[_0xb3cc('0x1d')]),_0x30d063);}});ami['on'](_0xb3cc('0x30'),function(_0x1691dd){try{utils[_0xb3cc('0x17')](util['format'](_0xb3cc('0x31'),_0x1691dd[_0xb3cc('0x1d')]),_0x1691dd);calls[_0xb3cc('0x30')](_0x1691dd);recordings[_0xb3cc('0x30')](_0x1691dd);dials[_0xb3cc('0x30')](_0x1691dd);agents[_0xb3cc('0x30')](_0x1691dd);queues[_0xb3cc('0x30')](_0x1691dd);}catch(_0x4d5737){utils[_0xb3cc('0x13')](util[_0xb3cc('0x18')](_0xb3cc('0x31'),_0x1691dd[_0xb3cc('0x1d')]),_0x4d5737);}});ami['on'](_0xb3cc('0x32'),function(_0x2789cd){try{utils[_0xb3cc('0x17')](util[_0xb3cc('0x18')](_0xb3cc('0x33'),_0x2789cd[_0xb3cc('0x1d')]),_0x2789cd);members['cdr'](_0x2789cd);}catch(_0x5c7790){utils['error'](util['format']('[%s][index][cdr]',_0x2789cd['uniqueid']),_0x5c7790);}});ami['on']('blindtransfer',function(_0x379e4e){try{utils[_0xb3cc('0x17')](util[_0xb3cc('0x18')](_0xb3cc('0x34'),_0x379e4e[_0xb3cc('0x1d')]),_0x379e4e);queues[_0xb3cc('0x35')](_0x379e4e);agents[_0xb3cc('0x35')](_0x379e4e);transfers[_0xb3cc('0x35')](_0x379e4e);}catch(_0x553822){utils[_0xb3cc('0x13')](util[_0xb3cc('0x18')](_0xb3cc('0x34'),_0x379e4e[_0xb3cc('0x1d')]),_0x553822);}});ami['on'](_0xb3cc('0x36'),function(_0x5caa1d){try{utils[_0xb3cc('0x17')](util['format'](_0xb3cc('0x37'),_0x5caa1d['origtransfereruniqueid']),_0x5caa1d);queues[_0xb3cc('0x36')](_0x5caa1d);transfers['attendedtransfer'](_0x5caa1d);agents['attendedtransfer'](_0x5caa1d);calls['attendedtransfer'](_0x5caa1d);}catch(_0x4fbf50){utils['error'](util[_0xb3cc('0x18')](_0xb3cc('0x37'),_0x5caa1d[_0xb3cc('0x38')]),_0x4fbf50);}});ami['on'](_0xb3cc('0x39'),function(_0x5b530b){try{utils[_0xb3cc('0x17')](util[_0xb3cc('0x18')](_0xb3cc('0x3a'),_0x5b530b['uniqueid']),_0x5b530b);queues[_0xb3cc('0x39')](_0x5b530b);recordings[_0xb3cc('0x39')](_0x5b530b);calls[_0xb3cc('0x39')](_0x5b530b);dials[_0xb3cc('0x39')](_0x5b530b);}catch(_0x352fa5){utils[_0xb3cc('0x13')](util[_0xb3cc('0x18')]('[%s][index][varset]',_0x5b530b[_0xb3cc('0x1d')]),_0x352fa5);}});ami['on'](_0xb3cc('0x3b'),function(_0xabcb11){try{utils[_0xb3cc('0x17')](util[_0xb3cc('0x18')](_0xb3cc('0x3c'),_0xabcb11[_0xb3cc('0x1d')]),_0xabcb11);calls[_0xb3cc('0x3b')](_0xabcb11);recordings[_0xb3cc('0x3b')](_0xabcb11);dials[_0xb3cc('0x3b')](_0xabcb11);}catch(_0x40f93b){utils[_0xb3cc('0x13')](util[_0xb3cc('0x18')](_0xb3cc('0x3c'),_0xabcb11[_0xb3cc('0x1d')]),_0x40f93b);}});ami['on'](_0xb3cc('0x3d'),function(_0x40f40d){try{utils[_0xb3cc('0x17')](util[_0xb3cc('0x18')](_0xb3cc('0x3e'),_0x40f40d[_0xb3cc('0x1d')]),_0x40f40d);calls['newchannel'](_0x40f40d);recordings['newchannel'](_0x40f40d);}catch(_0x30b811){utils[_0xb3cc('0x13')](util[_0xb3cc('0x18')](_0xb3cc('0x3e'),_0x40f40d[_0xb3cc('0x1d')]),_0x30b811);}});ami['on'](_0xb3cc('0x3f'),function(_0x20d357){try{utils['debug'](util['format'](_0xb3cc('0x40'),_0x20d357[_0xb3cc('0x1d')]),_0x20d357);dials[_0xb3cc('0x3f')](_0x20d357);}catch(_0x190a3c){utils['error'](util['format'](_0xb3cc('0x41'),_0x20d357[_0xb3cc('0x1d')]),_0x190a3c);}});ami['on'](_0xb3cc('0x42'),function(_0xffc426){try{utils[_0xb3cc('0x17')](util[_0xb3cc('0x18')](_0xb3cc('0x43'),_0xffc426['uniqueid']),_0xffc426);dials['dialend'](_0xffc426);}catch(_0x584a1d){utils[_0xb3cc('0x13')](util[_0xb3cc('0x18')](_0xb3cc('0x43'),_0xffc426[_0xb3cc('0x1d')]),_0x584a1d);}});} \ No newline at end of file +var _0xdbea=['./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','util','asterisk','port','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller'];(function(_0x411b89,_0x45a648){var _0x3be7c5=function(_0x12dda4){while(--_0x12dda4){_0x411b89['push'](_0x411b89['shift']());}};_0x3be7c5(++_0x45a648);}(_0xdbea,0x104));var _0xadbe=function(_0x2eb950,_0x2a5064){_0x2eb950=_0x2eb950-0x0;var _0x4268c7=_0xdbea[_0x2eb950];return _0x4268c7;};var AsteriskManager=require(_0xadbe('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0xadbe('0x1'));var ami=new AsteriskManager(config[_0xadbe('0x2')][_0xadbe('0x3')],config[_0xadbe('0x2')]['ip'],config[_0xadbe('0x2')]['username'],config['asterisk'][_0xadbe('0x4')],!![]);ami[_0xadbe('0x5')]();if(config[_0xadbe('0x6')]&&config[_0xadbe('0x6')][_0xadbe('0x7')]){utils[_0xadbe('0x8')](_0xadbe('0x9'));}else{var agents=require(_0xadbe('0xa'));var calls=require(_0xadbe('0xb'));var queues=require(_0xadbe('0xc'));var recordings=require(_0xadbe('0xd'));var members=require(_0xadbe('0xe'));var dials=require(_0xadbe('0xf'));var transfers=require(_0xadbe('0x10'));var core=require(_0xadbe('0x11'));ami['on'](_0xadbe('0x12'),core[_0xadbe('0x12')]);ami['on'](_0xadbe('0x13'),core[_0xadbe('0x13')]);ami['on'](_0xadbe('0x14'),core[_0xadbe('0x14')]);ami['on'](_0xadbe('0x15'),core[_0xadbe('0x15')]);ami['on'](_0xadbe('0x16'),core[_0xadbe('0x16')]);ami['on']('managerevent',core[_0xadbe('0x17')]);ami['on'](_0xadbe('0x18'),function(_0x3d6efc){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x1b'),_0x3d6efc[_0xadbe('0x1c')]),_0x3d6efc);members[_0xadbe('0x18')](_0x3d6efc);}catch(_0x5287ae){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x1b'),_0x3d6efc[_0xadbe('0x1c')]),_0x5287ae);}});ami['on'](_0xadbe('0x1d'),function(_0xd0a966){try{utils[_0xadbe('0x19')](util['format']('[%s][index][agentcalled]',_0xd0a966[_0xadbe('0x1e')]),_0xd0a966);agents[_0xadbe('0x1d')](_0xd0a966);}catch(_0x350792){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x1f'),_0xd0a966['uniqueid']),_0x350792);}});ami['on'](_0xadbe('0x20'),function(_0x1d2a3c){try{utils[_0xadbe('0x19')](util['format'](_0xadbe('0x21'),_0x1d2a3c[_0xadbe('0x1e')]),_0x1d2a3c);agents['agentringnoanswer'](_0x1d2a3c);}catch(_0x487b6a){utils['error'](util[_0xadbe('0x1a')](_0xadbe('0x21'),_0x1d2a3c['uniqueid']),_0x487b6a);}});ami['on']('agentconnect',function(_0x3fbc37){try{utils[_0xadbe('0x19')](util['format'](_0xadbe('0x22'),_0x3fbc37[_0xadbe('0x1e')]),_0x3fbc37);agents[_0xadbe('0x23')](_0x3fbc37);queues[_0xadbe('0x23')](_0x3fbc37);}catch(_0x584401){utils[_0xadbe('0x15')](util['format'](_0xadbe('0x22'),_0x3fbc37['uniqueid']),_0x584401);}});ami['on'](_0xadbe('0x24'),function(_0x2b3d4c){try{utils[_0xadbe('0x19')](util['format']('[%s][index][agentcomplete]',_0x2b3d4c[_0xadbe('0x1e')]),_0x2b3d4c);agents['agentcomplete'](_0x2b3d4c);queues['agentcomplete'](_0x2b3d4c);members[_0xadbe('0x24')](_0x2b3d4c);}catch(_0x340724){utils[_0xadbe('0x15')](util['format'](_0xadbe('0x25'),_0x2b3d4c[_0xadbe('0x1e')]),_0x340724);}});ami['on'](_0xadbe('0x26'),function(_0x412215){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x27'),_0x412215[_0xadbe('0x1e')]),_0x412215);agents['queuecallerabandon'](_0x412215);queues[_0xadbe('0x26')](_0x412215);}catch(_0x1a7185){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x27'),_0x412215[_0xadbe('0x1e')]),_0x1a7185);}});ami['on'](_0xadbe('0x28'),function(_0x47e46d){try{utils['debug'](util[_0xadbe('0x1a')](_0xadbe('0x29'),_0x47e46d['uniqueid']),_0x47e46d);queues[_0xadbe('0x28')](_0x47e46d);recordings['queuecallerjoin'](_0x47e46d);}catch(_0x339901){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x29'),_0x47e46d[_0xadbe('0x1e')]),_0x339901);}});ami['on'](_0xadbe('0x2a'),function(_0x250ce7){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x2b'),_0x250ce7[_0xadbe('0x1e')]),_0x250ce7);queues['queuecallerleave'](_0x250ce7);}catch(_0x1052b8){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x2b'),_0x250ce7['uniqueid']),_0x1052b8);}});ami['on']('musiconholdstart',function(_0x3ca022){try{utils['debug'](util[_0xadbe('0x1a')](_0xadbe('0x2c'),_0x3ca022[_0xadbe('0x1e')]),_0x3ca022);queues[_0xadbe('0x2d')](_0x3ca022);calls[_0xadbe('0x2d')](_0x3ca022);}catch(_0x545d70){utils['error'](util[_0xadbe('0x1a')](_0xadbe('0x2c'),_0x3ca022[_0xadbe('0x1e')]),_0x545d70);}});ami['on'](_0xadbe('0x2e'),function(_0x337ab5){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x2f'),_0x337ab5[_0xadbe('0x1e')]),_0x337ab5);queues[_0xadbe('0x2e')](_0x337ab5);calls[_0xadbe('0x2e')](_0x337ab5);}catch(_0x384bf0){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x2f'),_0x337ab5[_0xadbe('0x1e')]),_0x384bf0);}});ami['on'](_0xadbe('0x30'),function(_0x3872dd){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')]('[%s][index][newstate]',_0x3872dd[_0xadbe('0x1e')]),_0x3872dd);calls['newstate'](_0x3872dd);recordings[_0xadbe('0x30')](_0x3872dd);}catch(_0x1f74cc){utils[_0xadbe('0x15')](util['format'](_0xadbe('0x31'),_0x3872dd[_0xadbe('0x1e')]),_0x1f74cc);}});ami['on']('hangup',function(_0x55aaed){try{utils['debug'](util[_0xadbe('0x1a')](_0xadbe('0x32'),_0x55aaed[_0xadbe('0x1e')]),_0x55aaed);calls[_0xadbe('0x33')](_0x55aaed);recordings['hangup'](_0x55aaed);dials['hangup'](_0x55aaed);agents[_0xadbe('0x33')](_0x55aaed);queues['hangup'](_0x55aaed);}catch(_0x48c0fb){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x32'),_0x55aaed[_0xadbe('0x1e')]),_0x48c0fb);}});ami['on'](_0xadbe('0x34'),function(_0x12d977){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x35'),_0x12d977['uniqueid']),_0x12d977);members[_0xadbe('0x34')](_0x12d977);}catch(_0x3256c4){utils[_0xadbe('0x15')](util['format']('[%s][index][cdr]',_0x12d977[_0xadbe('0x1e')]),_0x3256c4);}});ami['on'](_0xadbe('0x36'),function(_0x28647d){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x37'),_0x28647d[_0xadbe('0x1e')]),_0x28647d);queues[_0xadbe('0x36')](_0x28647d);agents[_0xadbe('0x36')](_0x28647d);transfers[_0xadbe('0x36')](_0x28647d);}catch(_0x5e4f86){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x37'),_0x28647d['uniqueid']),_0x5e4f86);}});ami['on'](_0xadbe('0x38'),function(_0x2ed393){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x39'),_0x2ed393[_0xadbe('0x3a')]),_0x2ed393);queues['attendedtransfer'](_0x2ed393);transfers['attendedtransfer'](_0x2ed393);agents[_0xadbe('0x38')](_0x2ed393);calls[_0xadbe('0x38')](_0x2ed393);}catch(_0x3b6908){utils[_0xadbe('0x15')](util['format']('[%s][index][attendedtransfer]',_0x2ed393['origtransfereruniqueid']),_0x3b6908);}});ami['on']('varset',function(_0x21c1c8){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x3b'),_0x21c1c8[_0xadbe('0x1e')]),_0x21c1c8);queues[_0xadbe('0x3c')](_0x21c1c8);recordings[_0xadbe('0x3c')](_0x21c1c8);calls[_0xadbe('0x3c')](_0x21c1c8);dials[_0xadbe('0x3c')](_0x21c1c8);}catch(_0x19211d){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x3b'),_0x21c1c8['uniqueid']),_0x19211d);}});ami['on'](_0xadbe('0x3d'),function(_0x4977b5){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x3e'),_0x4977b5[_0xadbe('0x1e')]),_0x4977b5);calls[_0xadbe('0x3d')](_0x4977b5);recordings[_0xadbe('0x3d')](_0x4977b5);dials[_0xadbe('0x3d')](_0x4977b5);}catch(_0x4a7aa5){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')]('[%s][index][newexten]',_0x4977b5[_0xadbe('0x1e')]),_0x4a7aa5);}});ami['on'](_0xadbe('0x3f'),function(_0x36e506){try{utils['debug'](util['format']('[%s][index][newchannel]',_0x36e506[_0xadbe('0x1e')]),_0x36e506);calls['newchannel'](_0x36e506);recordings['newchannel'](_0x36e506);}catch(_0x56d7cd){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')]('[%s][index][newchannel]',_0x36e506[_0xadbe('0x1e')]),_0x56d7cd);}});ami['on']('dialbegin',function(_0x110e08){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')]('[%s][index][dialbegin]',_0x110e08[_0xadbe('0x1e')]),_0x110e08);dials[_0xadbe('0x40')](_0x110e08);}catch(_0x1e18b5){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x41'),_0x110e08[_0xadbe('0x1e')]),_0x1e18b5);}});ami['on'](_0xadbe('0x42'),function(_0x59b244){try{utils[_0xadbe('0x19')](util['format']('[%s][index][dialend]',_0x59b244[_0xadbe('0x1e')]),_0x59b244);dials[_0xadbe('0x42')](_0x59b244);}catch(_0x4e083c){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x43'),_0x59b244[_0xadbe('0x1e')]),_0x4e083c);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index c0830f6..8d6bb63 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 _0x65dd=['destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','membername','type','getUserByInterface','interface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','agent','NOT_INUSE','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','data2','exitAt'];(function(_0x117f85,_0x5afa65){var _0x1c61a7=function(_0x5be223){while(--_0x5be223){_0x117f85['push'](_0x117f85['shift']());}};_0x1c61a7(++_0x5afa65);}(_0x65dd,0x17b));var _0xd65d=function(_0x1b0bb1,_0x5a0540){_0x1b0bb1=_0x1b0bb1-0x0;var _0x11c001=_0x65dd[_0x1b0bb1];return _0x11c001;};'use strict';var _=require(_0xd65d('0x0'));var util=require(_0xd65d('0x1'));var utils=require(_0xd65d('0x2'));var members={};var exclude=[_0xd65d('0x3'),_0xd65d('0x4')];function writeDB(_0x53c883){utils[_0xd65d('0x5')](util[_0xd65d('0x6')](_0xd65d('0x7'),_0x53c883[_0xd65d('0x8')],_0x53c883['interface'],_0x53c883[_0xd65d('0x9')],_0x53c883['data2'],_0x53c883[_0xd65d('0xa')],_0x53c883[_0xd65d('0xb')]));if(_0x53c883['interface']){utils[_0xd65d('0xc')](_0x53c883[_0xd65d('0xd')])[_0xd65d('0xe')](function(_0x3641a9){if(_0x3641a9){_0x53c883[_0xd65d('0xa')]=_0x3641a9[_0xd65d('0xf')];_0x53c883['internal']=_0x3641a9[_0xd65d('0x10')];utils[_0xd65d('0x11')](_0xd65d('0x12'),_0x53c883);}else{utils[_0xd65d('0x13')](_0x53c883[_0xd65d('0xd')][_0xd65d('0x14')]('/')[0x1])['then'](function(_0x1c4cc7){if(_0x1c4cc7){_0x53c883[_0xd65d('0xa')]=_0x1c4cc7[_0xd65d('0xf')];_0x53c883['internal']=_0x1c4cc7['internal'];utils['request'](_0xd65d('0x12'),_0x53c883);}});}})[_0xd65d('0x15')](function(_0x4b2e4b){utils[_0xd65d('0x16')](util[_0xd65d('0x6')](_0xd65d('0x17'),_0x53c883[_0xd65d('0x8')]),_0x4b2e4b);});}delete members[_0x53c883[_0xd65d('0xd')]];}function startsWith(_0x12d1db,_0x31b5b7){return _[_0xd65d('0x18')](_0x12d1db,function(_0x22d5e0){return _[_0xd65d('0x19')](_0x31b5b7,_0x22d5e0);});}exports['devicestatechange']=function(_0x2a958c){try{utils[_0xd65d('0x1a')](util[_0xd65d('0x6')](_0xd65d('0x1b'),members[_0x2a958c[_0xd65d('0x1c')]]?members[_0x2a958c[_0xd65d('0x1c')]][_0xd65d('0x8')]:_0x2a958c[_0xd65d('0x1c')]),_0x2a958c);utils['info'](util[_0xd65d('0x6')](_0xd65d('0x1d'),members[_0x2a958c[_0xd65d('0x1c')]]?members[_0x2a958c[_0xd65d('0x1c')]][_0xd65d('0x8')]:_0x2a958c[_0xd65d('0x1c')],_0x2a958c['state'],_0x2a958c[_0xd65d('0x1c')]));switch(_0x2a958c[_0xd65d('0x1e')]){case _0xd65d('0x1f'):case _0xd65d('0x20'):if(!startsWith(exclude,_0x2a958c[_0xd65d('0x1c')])){members[_0x2a958c[_0xd65d('0x1c')]]={'channel':_0xd65d('0x21'),'interface':_0x2a958c[_0xd65d('0x1c')],'type':'TALKING','enterAt':utils[_0xd65d('0x22')](),'role':_0xd65d('0x23')};}break;case _0xd65d('0x24'):if(!_['isNil'](members[_0x2a958c['device']])){members[_0x2a958c[_0xd65d('0x1c')]]['exitAt']=utils[_0xd65d('0x22')]();members[_0x2a958c[_0xd65d('0x1c')]]['duration']=utils[_0xd65d('0x25')](members[_0x2a958c[_0xd65d('0x1c')]]['exitAt'],members[_0x2a958c[_0xd65d('0x1c')]][_0xd65d('0x26')]);if(members[_0x2a958c[_0xd65d('0x1c')]]['uniqueid']){writeDB(members[_0x2a958c[_0xd65d('0x1c')]]);}}break;default:break;}}catch(_0x18d113){utils[_0xd65d('0x16')](util[_0xd65d('0x6')](_0xd65d('0x1b'),members[_0x2a958c[_0xd65d('0x1c')]]?members[_0x2a958c[_0xd65d('0x1c')]]['uniqueid']:_0x2a958c[_0xd65d('0x1c')]),_0x18d113);}};exports[_0xd65d('0x27')]=function(_0x37098c){try{if(!_[_0xd65d('0x28')](members[_0x37098c[_0xd65d('0xd')]])){utils['debug'](util[_0xd65d('0x6')](_0xd65d('0x29'),_0x37098c['uniqueid']),_0x37098c);utils[_0xd65d('0x5')](util[_0xd65d('0x6')](_0xd65d('0x2a'),_0x37098c[_0xd65d('0x8')],_0x37098c[_0xd65d('0xd')],_0x37098c[_0xd65d('0x2b')]));members[_0x37098c['interface']]=_[_0xd65d('0x2c')](members[_0x37098c['interface']],{'data4':_0x37098c[_0xd65d('0x2b')],'uniqueid':_0x37098c[_0xd65d('0x8')]});}}catch(_0x178195){utils['error'](util[_0xd65d('0x6')](_0xd65d('0x29'),_0x37098c[_0xd65d('0x8')]),_0x178195);}};exports[_0xd65d('0x2d')]=function(_0x494f97){try{utils['debug'](util[_0xd65d('0x6')](_0xd65d('0x2e'),_0x494f97['uniqueid']),_0x494f97);if(_0x494f97['channel']){var _0x3d0c87=_0x494f97['channel'][_0xd65d('0x14')]('-')[0x0];if(!_['isNil'](members[_0x3d0c87])){members[_0x3d0c87]=_['assign'](members[_0x3d0c87],{'data1':members[_0x3d0c87]['data1']||_0x494f97[_0xd65d('0xb')],'data2':members[_0x3d0c87]['data2']||_0x494f97['source'],'data3':members[_0x3d0c87][_0xd65d('0x2f')]||_0x494f97[_0xd65d('0x30')],'uniqueid':members[_0x3d0c87][_0xd65d('0x8')]||_0x494f97[_0xd65d('0x8')]});utils[_0xd65d('0x5')](util['format'](_0xd65d('0x31'),_0x494f97[_0xd65d('0x8')],members[_0x3d0c87][_0xd65d('0x32')],members[_0x3d0c87][_0xd65d('0x33')],members[_0x3d0c87][_0xd65d('0x2f')]));if(members[_0x3d0c87][_0xd65d('0x34')]){writeDB(members[_0x3d0c87]);}}}if(_0x494f97[_0xd65d('0x35')]){var _0x43b124=_0x494f97['destinationchannel'][_0xd65d('0x14')]('-')[0x0];if(!_['isNil'](members[_0x43b124])){members[_0x43b124]=_['assign'](members[_0x43b124],{'data1':members[_0x43b124][_0xd65d('0x32')]||_0x494f97[_0xd65d('0xb')],'data2':members[_0x43b124][_0xd65d('0x33')]||_0x494f97['source'],'data3':members[_0x43b124]['data3']||_0x494f97[_0xd65d('0x30')],'uniqueid':members[_0x43b124][_0xd65d('0x8')]||_0x494f97[_0xd65d('0x8')]});utils[_0xd65d('0x5')](util['format'](_0xd65d('0x31'),_0x494f97[_0xd65d('0x8')],members[_0x43b124][_0xd65d('0x32')],members[_0x43b124][_0xd65d('0x33')],members[_0x43b124]['data3']));if(members[_0x43b124][_0xd65d('0x34')]){writeDB(members[_0x43b124]);}}}}catch(_0x389455){utils['error'](util[_0xd65d('0x6')](_0xd65d('0x2e'),_0x494f97[_0xd65d('0x8')]),_0x389455);}}; \ No newline at end of file +var _0xdd82=['destinationchannel','destination','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','error','[%s][members][writeDB]','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1'];(function(_0x438fe1,_0x3308d5){var _0x3c8e1b=function(_0x2f8d41){while(--_0x2f8d41){_0x438fe1['push'](_0x438fe1['shift']());}};_0x3c8e1b(++_0x3308d5);}(_0xdd82,0xd6));var _0x2dd8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdd82[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x2dd8('0x0'));var utils=require(_0x2dd8('0x1'));var members={};var exclude=[_0x2dd8('0x2'),_0x2dd8('0x3')];function writeDB(_0x51bb53){utils[_0x2dd8('0x4')](util[_0x2dd8('0x5')](_0x2dd8('0x6'),_0x51bb53[_0x2dd8('0x7')],_0x51bb53[_0x2dd8('0x8')],_0x51bb53[_0x2dd8('0x9')],_0x51bb53[_0x2dd8('0xa')],_0x51bb53[_0x2dd8('0xb')],_0x51bb53[_0x2dd8('0xc')]));if(_0x51bb53['interface']){utils[_0x2dd8('0xd')](_0x51bb53[_0x2dd8('0x8')])[_0x2dd8('0xe')](function(_0x3b2919){if(_0x3b2919){_0x51bb53[_0x2dd8('0xb')]=_0x3b2919[_0x2dd8('0xf')];_0x51bb53[_0x2dd8('0x10')]=_0x3b2919[_0x2dd8('0x10')];utils[_0x2dd8('0x11')]('CreateMemberReport',_0x51bb53);}else{utils[_0x2dd8('0x12')](_0x51bb53[_0x2dd8('0x8')][_0x2dd8('0x13')]('/')[0x1])[_0x2dd8('0xe')](function(_0x3cd4b1){if(_0x3cd4b1){_0x51bb53[_0x2dd8('0xb')]=_0x3cd4b1[_0x2dd8('0xf')];_0x51bb53[_0x2dd8('0x10')]=_0x3cd4b1[_0x2dd8('0x10')];utils[_0x2dd8('0x11')](_0x2dd8('0x14'),_0x51bb53);}});}})[_0x2dd8('0x15')](function(_0x1940f7){utils[_0x2dd8('0x16')](util[_0x2dd8('0x5')](_0x2dd8('0x17'),_0x51bb53[_0x2dd8('0x7')]),_0x1940f7);});}delete members[_0x51bb53[_0x2dd8('0x8')]];}function startsWith(_0x3052e9,_0xc4382a){return _['some'](_0x3052e9,function(_0x108aaf){return _['startsWith'](_0xc4382a,_0x108aaf);});}exports[_0x2dd8('0x18')]=function(_0x1a43c4){try{utils[_0x2dd8('0x19')](util[_0x2dd8('0x5')](_0x2dd8('0x1a'),members[_0x1a43c4[_0x2dd8('0x1b')]]?members[_0x1a43c4[_0x2dd8('0x1b')]]['uniqueid']:_0x1a43c4['device']),_0x1a43c4);utils[_0x2dd8('0x4')](util[_0x2dd8('0x5')](_0x2dd8('0x1c'),members[_0x1a43c4[_0x2dd8('0x1b')]]?members[_0x1a43c4[_0x2dd8('0x1b')]][_0x2dd8('0x7')]:_0x1a43c4[_0x2dd8('0x1b')],_0x1a43c4['state'],_0x1a43c4['device']));switch(_0x1a43c4[_0x2dd8('0x1d')]){case _0x2dd8('0x1e'):case _0x2dd8('0x1f'):if(!startsWith(exclude,_0x1a43c4[_0x2dd8('0x1b')])){members[_0x1a43c4[_0x2dd8('0x1b')]]={'channel':'voice','interface':_0x1a43c4[_0x2dd8('0x1b')],'type':'TALKING','enterAt':utils[_0x2dd8('0x20')](),'role':_0x2dd8('0x21')};}break;case _0x2dd8('0x22'):if(!_[_0x2dd8('0x23')](members[_0x1a43c4[_0x2dd8('0x1b')]])){members[_0x1a43c4['device']]['exitAt']=utils[_0x2dd8('0x20')]();members[_0x1a43c4[_0x2dd8('0x1b')]][_0x2dd8('0x24')]=utils[_0x2dd8('0x25')](members[_0x1a43c4['device']][_0x2dd8('0x26')],members[_0x1a43c4[_0x2dd8('0x1b')]][_0x2dd8('0x27')]);if(members[_0x1a43c4[_0x2dd8('0x1b')]]['uniqueid']){writeDB(members[_0x1a43c4[_0x2dd8('0x1b')]]);}}break;default:break;}}catch(_0x1c5943){utils['error'](util[_0x2dd8('0x5')](_0x2dd8('0x1a'),members[_0x1a43c4[_0x2dd8('0x1b')]]?members[_0x1a43c4['device']][_0x2dd8('0x7')]:_0x1a43c4[_0x2dd8('0x1b')]),_0x1c5943);}};exports[_0x2dd8('0x28')]=function(_0x34fc3e){try{if(!_[_0x2dd8('0x23')](members[_0x34fc3e[_0x2dd8('0x8')]])){utils[_0x2dd8('0x19')](util[_0x2dd8('0x5')](_0x2dd8('0x29'),_0x34fc3e[_0x2dd8('0x7')]),_0x34fc3e);utils[_0x2dd8('0x4')](util[_0x2dd8('0x5')](_0x2dd8('0x2a'),_0x34fc3e[_0x2dd8('0x7')],_0x34fc3e[_0x2dd8('0x8')],_0x34fc3e['queue']));members[_0x34fc3e[_0x2dd8('0x8')]]=_[_0x2dd8('0x2b')](members[_0x34fc3e[_0x2dd8('0x8')]],{'data4':_0x34fc3e[_0x2dd8('0x2c')],'uniqueid':_0x34fc3e[_0x2dd8('0x7')]});}}catch(_0x4646b1){utils[_0x2dd8('0x16')](util[_0x2dd8('0x5')](_0x2dd8('0x29'),_0x34fc3e[_0x2dd8('0x7')]),_0x4646b1);}};exports[_0x2dd8('0x2d')]=function(_0x12704b){try{utils[_0x2dd8('0x19')](util[_0x2dd8('0x5')](_0x2dd8('0x2e'),_0x12704b[_0x2dd8('0x7')]),_0x12704b);if(_0x12704b[_0x2dd8('0x9')]){var _0x448448=_0x12704b[_0x2dd8('0x9')][_0x2dd8('0x13')]('-')[0x0];if(!_[_0x2dd8('0x23')](members[_0x448448])){members[_0x448448]=_[_0x2dd8('0x2b')](members[_0x448448],{'data1':members[_0x448448]['data1']||_0x12704b[_0x2dd8('0xc')],'data2':members[_0x448448][_0x2dd8('0xa')]||_0x12704b[_0x2dd8('0x2f')],'data3':members[_0x448448][_0x2dd8('0x30')]||_0x12704b['destination'],'uniqueid':members[_0x448448][_0x2dd8('0x7')]||_0x12704b[_0x2dd8('0x7')]});utils['info'](util[_0x2dd8('0x5')](_0x2dd8('0x31'),_0x12704b[_0x2dd8('0x7')],members[_0x448448][_0x2dd8('0x32')],members[_0x448448][_0x2dd8('0xa')],members[_0x448448][_0x2dd8('0x30')]));if(members[_0x448448][_0x2dd8('0x26')]){writeDB(members[_0x448448]);}}}if(_0x12704b['destinationchannel']){var _0x2946e2=_0x12704b[_0x2dd8('0x33')][_0x2dd8('0x13')]('-')[0x0];if(!_[_0x2dd8('0x23')](members[_0x2946e2])){members[_0x2946e2]=_['assign'](members[_0x2946e2],{'data1':members[_0x2946e2][_0x2dd8('0x32')]||_0x12704b[_0x2dd8('0xc')],'data2':members[_0x2946e2][_0x2dd8('0xa')]||_0x12704b['source'],'data3':members[_0x2946e2]['data3']||_0x12704b[_0x2dd8('0x34')],'uniqueid':members[_0x2946e2]['uniqueid']||_0x12704b[_0x2dd8('0x7')]});utils['info'](util[_0x2dd8('0x5')](_0x2dd8('0x31'),_0x12704b[_0x2dd8('0x7')],members[_0x2946e2][_0x2dd8('0x32')],members[_0x2946e2][_0x2dd8('0xa')],members[_0x2946e2][_0x2dd8('0x30')]));if(members[_0x2946e2][_0x2dd8('0x26')]){writeDB(members[_0x2946e2]);}}}}catch(_0x3f72f0){utils[_0x2dd8('0x16')](util['format'](_0x2dd8('0x2e'),_0x12704b['uniqueid']),_0x3f72f0);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index f7d1f5d..86bd2c7 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 _0xe1c4=['ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','agentcomplete','[%s][queues][agentcomplete]','lastAssignedTo','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','secondtransfererexten','secondtransfereruniqueid','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','uniqueid','channel','queue','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerabandon','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','[%s][queues][varset]','[%s][queues][queuecallerabandon]'];(function(_0x472072,_0x5add18){var _0x38ca35=function(_0x197592){while(--_0x197592){_0x472072['push'](_0x472072['shift']());}};_0x38ca35(++_0x5add18);}(_0xe1c4,0x1ec));var _0x4e1c=function(_0x10fd98,_0x5209db){_0x10fd98=_0x10fd98-0x0;var _0x5347d5=_0xe1c4[_0x10fd98];return _0x5347d5;};'use strict';var _=require(_0x4e1c('0x0'));var util=require(_0x4e1c('0x1'));var utils=require(_0x4e1c('0x2'));var queues={};function writeDB(_0x51bf47){utils['info'](util[_0x4e1c('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x51bf47[_0x4e1c('0x4')],_0x51bf47[_0x4e1c('0x5')],_0x51bf47[_0x4e1c('0x6')],_0x51bf47['lastAssignedTo'],_0x51bf47['calleridnum'],_0x51bf47[_0x4e1c('0x7')],_0x51bf47[_0x4e1c('0x8')]));if(_0x51bf47[_0x4e1c('0x6')]){utils[_0x4e1c('0x9')](_0x51bf47[_0x4e1c('0x6')])[_0x4e1c('0xa')](function(_0x2622b4){if(_0x2622b4){_0x51bf47[_0x4e1c('0xb')]=_0x2622b4[_0x4e1c('0xb')];}utils[_0x4e1c('0xc')](_0x4e1c('0xd'),_0x51bf47);});}else{utils[_0x4e1c('0xc')](_0x4e1c('0xd'),_0x51bf47);}if(_0x51bf47['transfereduniqueid']){delete queues[_0x51bf47[_0x4e1c('0xe')]];}else{delete queues[_0x51bf47[_0x4e1c('0x4')]];}}exports['queuecallerjoin']=function(_0x2fbf2d){try{utils[_0x4e1c('0xf')](util[_0x4e1c('0x3')](_0x4e1c('0x10'),_0x2fbf2d['uniqueid']),_0x2fbf2d);utils[_0x4e1c('0x11')](util[_0x4e1c('0x3')](_0x4e1c('0x12'),_0x2fbf2d[_0x4e1c('0x4')],_0x2fbf2d['queue'],_0x2fbf2d['position']));queues[_0x2fbf2d['uniqueid']]=_[_0x4e1c('0x13')](_0x2fbf2d,{'originalposition':_0x2fbf2d[_0x4e1c('0x14')],'queuecallerjoinAt':utils[_0x4e1c('0x15')](),'mohtime':0x0});}catch(_0x201779){utils['error'](util[_0x4e1c('0x3')](_0x4e1c('0x10'),_0x2fbf2d[_0x4e1c('0x4')]),_0x201779);}};exports[_0x4e1c('0x16')]=function(_0x44a842){try{if(!_[_0x4e1c('0x17')](queues[_0x44a842['uniqueid']])){utils[_0x4e1c('0xf')](util[_0x4e1c('0x3')](_0x4e1c('0x18'),_0x44a842[_0x4e1c('0x4')]),_0x44a842);if(queues[_0x44a842[_0x4e1c('0x4')]][_0x4e1c('0x19')]){if(!queues[_0x44a842[_0x4e1c('0x4')]]['queuecallerabandon']&&!queues[_0x44a842[_0x4e1c('0x4')]][_0x4e1c('0x1a')]){queues[_0x44a842[_0x4e1c('0x4')]][_0x4e1c('0x1b')]=!![];queues[_0x44a842[_0x4e1c('0x4')]][_0x4e1c('0x1c')]=utils[_0x4e1c('0x15')]();queues[_0x44a842['uniqueid']][_0x4e1c('0x8')]=_0x4e1c('0x1d');}utils[_0x4e1c('0x11')](util[_0x4e1c('0x3')](_0x4e1c('0x1e'),_0x44a842[_0x4e1c('0x4')],queues[_0x44a842[_0x4e1c('0x4')]][_0x4e1c('0x1f')],queues[_0x44a842[_0x4e1c('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x44a842[_0x4e1c('0x4')]]);}else if(queues[_0x44a842[_0x4e1c('0x4')]][_0x4e1c('0xe')]){utils['info'](util['format'](_0x4e1c('0x20'),_0x44a842['uniqueid'],queues[_0x44a842[_0x4e1c('0x4')]][_0x4e1c('0x1f')],queues[_0x44a842[_0x4e1c('0x4')]][_0x4e1c('0xe')]));queues[queues[_0x44a842[_0x4e1c('0x4')]][_0x4e1c('0xe')]]=queues[_0x44a842['uniqueid']];queues[queues[_0x44a842[_0x4e1c('0x4')]][_0x4e1c('0xe')]][_0x4e1c('0x21')]=0x2;delete queues[_0x44a842[_0x4e1c('0x4')]];}}}catch(_0x145c29){utils['error'](util[_0x4e1c('0x3')](_0x4e1c('0x18'),_0x44a842[_0x4e1c('0x4')]),_0x145c29);}};exports[_0x4e1c('0x22')]=function(_0x504259){try{utils[_0x4e1c('0xf')](util[_0x4e1c('0x3')]('[%s][queues][varset]',_0x504259[_0x4e1c('0x4')]),_0x504259);if(!_['isNil'](_0x504259[_0x4e1c('0x23')][_0x4e1c('0x24')])&&_0x504259[_0x4e1c('0x25')][_0x4e1c('0x26')]()!=='CONTINUE'){if(!_[_0x4e1c('0x17')](queues[_0x504259['uniqueid']])){queues[_0x504259[_0x4e1c('0x4')]]['queuecallerabandon']=![];queues[_0x504259[_0x4e1c('0x4')]][_0x4e1c('0x27')]=null;queues[_0x504259['uniqueid']][_0x4e1c('0x1a')]=!![];queues[_0x504259['uniqueid']][_0x4e1c('0x28')]=utils[_0x4e1c('0x15')]();queues[_0x504259[_0x4e1c('0x4')]][_0x4e1c('0x8')]=_0x504259[_0x4e1c('0x25')][_0x4e1c('0x26')]();utils[_0x4e1c('0x11')](util[_0x4e1c('0x3')](_0x4e1c('0x29'),_0x504259[_0x4e1c('0x4')],queues[_0x504259['uniqueid']][_0x4e1c('0x1f')],_0x504259[_0x4e1c('0x25')],queues[_0x504259[_0x4e1c('0x4')]][_0x4e1c('0x8')]));writeDB(queues[_0x504259[_0x4e1c('0x4')]]);}}else if(!_[_0x4e1c('0x17')](_0x504259['variable']['queueposition'])){if(!_[_0x4e1c('0x17')](queues[_0x504259[_0x4e1c('0x4')]])&&!queues[_0x504259[_0x4e1c('0x4')]][_0x4e1c('0x2a')]){queues[_0x504259['uniqueid']][_0x4e1c('0x2a')]=![];queues[_0x504259[_0x4e1c('0x4')]]['queuecallerabandonAt']=null;queues[_0x504259[_0x4e1c('0x4')]][_0x4e1c('0x1a')]=!![];queues[_0x504259[_0x4e1c('0x4')]]['queuecallerexitAt']=utils[_0x4e1c('0x15')]();queues[_0x504259[_0x4e1c('0x4')]]['queuecallerexitreason']=_0x4e1c('0x2b');utils[_0x4e1c('0x11')](util[_0x4e1c('0x3')](_0x4e1c('0x2c'),_0x504259[_0x4e1c('0x4')],queues[_0x504259[_0x4e1c('0x4')]]['name'],_0x504259['value'],queues[_0x504259[_0x4e1c('0x4')]][_0x4e1c('0x8')]));}}}catch(_0x390d05){utils[_0x4e1c('0x2d')](util[_0x4e1c('0x3')](_0x4e1c('0x2e'),_0x504259[_0x4e1c('0x4')]),_0x390d05);}};exports[_0x4e1c('0x2a')]=function(_0xe3c942){try{if(!_[_0x4e1c('0x17')](queues[_0xe3c942[_0x4e1c('0x4')]])){utils['debug'](util['format'](_0x4e1c('0x2f'),_0xe3c942[_0x4e1c('0x4')]),_0xe3c942);queues[_0xe3c942[_0x4e1c('0x4')]][_0x4e1c('0x1a')]=![];queues[_0xe3c942[_0x4e1c('0x4')]][_0x4e1c('0x28')]=null;queues[_0xe3c942['uniqueid']][_0x4e1c('0x2a')]=!![];queues[_0xe3c942[_0x4e1c('0x4')]][_0x4e1c('0x27')]=utils[_0x4e1c('0x15')]();queues[_0xe3c942[_0x4e1c('0x4')]][_0x4e1c('0x8')]=_0x4e1c('0x30');utils[_0x4e1c('0x11')](util[_0x4e1c('0x3')](_0x4e1c('0x31'),_0xe3c942[_0x4e1c('0x4')],queues[_0xe3c942['uniqueid']][_0x4e1c('0x1f')],queues[_0xe3c942[_0x4e1c('0x4')]][_0x4e1c('0x8')]));}}catch(_0x1cb2c0){utils[_0x4e1c('0x2d')](util[_0x4e1c('0x3')](_0x4e1c('0x2f'),_0xe3c942[_0x4e1c('0x4')]),_0x1cb2c0);}};exports['queuecallerleave']=function(_0x3f63b1){try{if(!_['isNil'](queues[_0x3f63b1[_0x4e1c('0x4')]])){utils[_0x4e1c('0xf')](util['format'](_0x4e1c('0x32'),_0x3f63b1[_0x4e1c('0x4')]),_0x3f63b1);utils['info'](util['format'](_0x4e1c('0x33'),_0x3f63b1[_0x4e1c('0x4')],queues[_0x3f63b1[_0x4e1c('0x4')]][_0x4e1c('0x1f')],_0x3f63b1['connectedlinenum'],_0x3f63b1[_0x4e1c('0x34')]));queues[_0x3f63b1[_0x4e1c('0x4')]][_0x4e1c('0x35')]=!![];queues[_0x3f63b1[_0x4e1c('0x4')]]['queuecallerleaveAt']=utils[_0x4e1c('0x15')]();queues[_0x3f63b1[_0x4e1c('0x4')]][_0x4e1c('0x36')]=utils[_0x4e1c('0x37')](queues[_0x3f63b1[_0x4e1c('0x4')]][_0x4e1c('0x19')],queues[_0x3f63b1[_0x4e1c('0x4')]][_0x4e1c('0x38')]);queues[_0x3f63b1[_0x4e1c('0x4')]]['position']=_0x3f63b1[_0x4e1c('0x14')];queues[_0x3f63b1['uniqueid']][_0x4e1c('0x39')]=_0x3f63b1[_0x4e1c('0x39')];queues[_0x3f63b1[_0x4e1c('0x4')]]['connectedlinenum']=_0x3f63b1['connectedlinenum'];queues[_0x3f63b1[_0x4e1c('0x4')]][_0x4e1c('0x34')]=_0x3f63b1['connectedlinename'];}}catch(_0x304b74){utils[_0x4e1c('0x2d')](util['format']('[%s][queues][queuecallerleave]',_0x3f63b1[_0x4e1c('0x4')]),_0x304b74);}};exports['agentconnect']=function(_0x165af7){try{if(!_[_0x4e1c('0x17')](queues[_0x165af7[_0x4e1c('0x4')]])){utils[_0x4e1c('0xf')](util[_0x4e1c('0x3')](_0x4e1c('0x3a'),_0x165af7[_0x4e1c('0x4')]),_0x165af7);utils[_0x4e1c('0x11')](util['format'](_0x4e1c('0x3b'),_0x165af7[_0x4e1c('0x4')],queues[_0x165af7['uniqueid']][_0x4e1c('0x1f')],_0x165af7['membername'],_0x165af7[_0x4e1c('0x3c')]));queues[_0x165af7[_0x4e1c('0x4')]][_0x4e1c('0x2a')]=![];queues[_0x165af7['uniqueid']][_0x4e1c('0x2a')]=![];queues[_0x165af7[_0x4e1c('0x4')]]['queuecallerabandonAt']=null;queues[_0x165af7[_0x4e1c('0x4')]][_0x4e1c('0x1a')]=![];queues[_0x165af7[_0x4e1c('0x4')]][_0x4e1c('0x8')]=null;queues[_0x165af7['uniqueid']][_0x4e1c('0x28')]=null;queues[_0x165af7[_0x4e1c('0x4')]][_0x4e1c('0x3d')]=!![];queues[_0x165af7[_0x4e1c('0x4')]][_0x4e1c('0x7')]=_0x165af7[_0x4e1c('0x3c')];queues[_0x165af7[_0x4e1c('0x4')]]['lastAssignedTo']=_0x165af7[_0x4e1c('0x3e')];}}catch(_0x13e096){utils[_0x4e1c('0x2d')](util[_0x4e1c('0x3')]('[%s][queues][agentconnect]',_0x165af7[_0x4e1c('0x4')]),_0x13e096);}};exports[_0x4e1c('0x3f')]=function(_0x48df63){try{if(!_['isNil'](queues[_0x48df63[_0x4e1c('0x4')]])){if(queues[_0x48df63[_0x4e1c('0x4')]][_0x4e1c('0x19')]){utils[_0x4e1c('0xf')](util[_0x4e1c('0x3')](_0x4e1c('0x40'),_0x48df63[_0x4e1c('0x4')]),_0x48df63);queues[_0x48df63[_0x4e1c('0x4')]][_0x4e1c('0x2a')]=![];queues[_0x48df63['uniqueid']][_0x4e1c('0x2a')]=![];queues[_0x48df63['uniqueid']][_0x4e1c('0x27')]=null;queues[_0x48df63[_0x4e1c('0x4')]][_0x4e1c('0x1a')]=![];queues[_0x48df63['uniqueid']][_0x4e1c('0x28')]=null;queues[_0x48df63[_0x4e1c('0x4')]][_0x4e1c('0x3d')]=!![];queues[_0x48df63['uniqueid']][_0x4e1c('0x41')]=_0x48df63[_0x4e1c('0x3e')];queues[_0x48df63['uniqueid']][_0x4e1c('0x1b')]=!![];queues[_0x48df63[_0x4e1c('0x4')]][_0x4e1c('0x1c')]=utils[_0x4e1c('0x15')]();if(_0x48df63[_0x4e1c('0x42')]==_0x4e1c('0x43')){if(!queues[_0x48df63[_0x4e1c('0x4')]][_0x4e1c('0x43')]){queues[_0x48df63['uniqueid']][_0x4e1c('0x8')]=_0x4e1c('0x44');}}else{queues[_0x48df63[_0x4e1c('0x4')]]['queuecallerexitreason']=_0x4e1c('0x45')+_0x48df63[_0x4e1c('0x42')][_0x4e1c('0x26')]();}utils[_0x4e1c('0x11')](util[_0x4e1c('0x3')](_0x4e1c('0x46'),_0x48df63[_0x4e1c('0x4')],queues[_0x48df63[_0x4e1c('0x4')]][_0x4e1c('0x1f')],_0x48df63[_0x4e1c('0x3e')],queues[_0x48df63[_0x4e1c('0x4')]][_0x4e1c('0x8')]));writeDB(queues[_0x48df63[_0x4e1c('0x4')]]);}}}catch(_0x3dad9f){utils['error'](util['format'](_0x4e1c('0x40'),_0x48df63['uniqueid']),_0x3dad9f);}};exports['blindtransfer']=function(_0x4c2c23){try{if(!_[_0x4e1c('0x17')](queues[_0x4c2c23[_0x4e1c('0x47')]])){utils[_0x4e1c('0xf')](util[_0x4e1c('0x3')](_0x4e1c('0x48'),_0x4c2c23[_0x4e1c('0x4')]),_0x4c2c23);queues[_0x4c2c23['transfereeuniqueid']]['transfer']=!![];queues[_0x4c2c23[_0x4e1c('0x47')]][_0x4e1c('0x49')]=_0x4e1c('0x4a');queues[_0x4c2c23[_0x4e1c('0x47')]][_0x4e1c('0x4b')]=_0x4c2c23[_0x4e1c('0x4c')];queues[_0x4c2c23[_0x4e1c('0x47')]][_0x4e1c('0x4d')]=_0x4c2c23['transfereeuniqueid'];queues[_0x4c2c23[_0x4e1c('0x47')]][_0x4e1c('0x8')]=_0x4e1c('0x4e');utils[_0x4e1c('0x11')](util[_0x4e1c('0x3')](_0x4e1c('0x4f'),_0x4c2c23[_0x4e1c('0x4')],queues[_0x4c2c23[_0x4e1c('0x47')]]['name'],_0x4c2c23[_0x4e1c('0x47')],_0x4c2c23[_0x4e1c('0x4c')]));}}catch(_0x87f5c){utils[_0x4e1c('0x2d')](util['format']('[%s][queues][blindtransfer]',_0x4c2c23['uniqueid']),_0x87f5c);}};exports['attendedtransfer']=function(_0x4e1e30){try{utils[_0x4e1c('0xf')](util[_0x4e1c('0x3')](_0x4e1c('0x50'),_0x4e1e30['origtransfereruniqueid']),_0x4e1e30);if(_0x4e1e30[_0x4e1c('0x51')]==_0x4e1e30[_0x4e1c('0x52')]){if(!_[_0x4e1c('0x17')](queues[_0x4e1e30[_0x4e1c('0x53')]])){utils[_0x4e1c('0x11')](util[_0x4e1c('0x3')](_0x4e1c('0x54'),_0x4e1e30[_0x4e1c('0x51')],queues[_0x4e1e30[_0x4e1c('0x53')]][_0x4e1c('0x1f')],_0x4e1e30[_0x4e1c('0x55')]));queues[_0x4e1e30[_0x4e1c('0x53')]][_0x4e1c('0x43')]=!![];queues[_0x4e1e30[_0x4e1c('0x53')]][_0x4e1c('0x49')]='ATTENDED';queues[_0x4e1e30[_0x4e1c('0x53')]][_0x4e1c('0x4b')]=_0x4e1e30[_0x4e1c('0x55')];queues[_0x4e1e30['secondtransfererlinkedid']][_0x4e1c('0x4d')]=_0x4e1e30[_0x4e1c('0x51')];queues[_0x4e1e30[_0x4e1c('0x53')]][_0x4e1c('0x8')]=_0x4e1c('0x56');}if(!_[_0x4e1c('0x17')](queues[_0x4e1e30[_0x4e1c('0x52')]])){if(_0x4e1e30[_0x4e1c('0x57')]&&queues[_0x4e1e30[_0x4e1c('0x57')]]){queues[_0x4e1e30['transfereelinkedid']][_0x4e1c('0x21')]=0x1;queues[_0x4e1e30[_0x4e1c('0x47')]]=_[_0x4e1c('0x58')](queues[_0x4e1e30[_0x4e1c('0x57')]]);queues[_0x4e1e30[_0x4e1c('0x47')]]['transfereduniqueid']=_0x4e1e30[_0x4e1c('0x59')];queues[_0x4e1e30[_0x4e1c('0x47')]]['queuecallerenterreason']=0x2;queues[_0x4e1e30[_0x4e1c('0x47')]][_0x4e1c('0x5a')]=queues[_0x4e1e30[_0x4e1c('0x53')]]['calleridnum'];queues[_0x4e1e30[_0x4e1c('0x47')]]['calleridname']=queues[_0x4e1e30[_0x4e1c('0x53')]]['calleridname'];queues[_0x4e1e30[_0x4e1c('0x47')]][_0x4e1c('0x38')]=utils[_0x4e1c('0x15')]();queues[_0x4e1e30[_0x4e1c('0x47')]][_0x4e1c('0x19')]=utils[_0x4e1c('0x15')]();queues[_0x4e1e30[_0x4e1c('0x47')]][_0x4e1c('0x36')]=0x0;queues[_0x4e1e30[_0x4e1c('0x47')]][_0x4e1c('0x5b')]=0x0;utils[_0x4e1c('0x11')](util[_0x4e1c('0x3')](_0x4e1c('0x5c'),_0x4e1e30[_0x4e1c('0x51')],queues[_0x4e1e30[_0x4e1c('0x47')]][_0x4e1c('0x1f')],queues[_0x4e1e30['transfereeuniqueid']][_0x4e1c('0x5a')],queues[_0x4e1e30[_0x4e1c('0x47')]][_0x4e1c('0x5d')]));}else{utils[_0x4e1c('0x11')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x4e1e30[_0x4e1c('0x51')],queues[_0x4e1e30[_0x4e1c('0x52')]][_0x4e1c('0x1f')],_0x4e1e30['secondtransfererlinkedid']));queues[_0x4e1e30[_0x4e1c('0x52')]][_0x4e1c('0xe')]=_0x4e1e30[_0x4e1c('0x53')];}}}else if(_0x4e1e30['secondtransfereruniqueid']==_0x4e1e30[_0x4e1c('0x53')]){if(!_[_0x4e1c('0x17')](queues[_0x4e1e30[_0x4e1c('0x52')]])){utils['info'](util['format'](_0x4e1c('0x5e'),_0x4e1e30[_0x4e1c('0x51')],queues[_0x4e1e30['origtransfererlinkedid']][_0x4e1c('0x1f')],_0x4e1e30['secondtransfereruniqueid'],_0x4e1e30['secondtransfererexten']));queues[_0x4e1e30['origtransfererlinkedid']][_0x4e1c('0x43')]=!![];queues[_0x4e1e30[_0x4e1c('0x52')]]['transfertype']=_0x4e1c('0x5f');queues[_0x4e1e30[_0x4e1c('0x52')]][_0x4e1c('0x4b')]=_0x4e1e30[_0x4e1c('0x60')];queues[_0x4e1e30['origtransfererlinkedid']][_0x4e1c('0x4d')]=_0x4e1e30[_0x4e1c('0x61')];queues[_0x4e1e30[_0x4e1c('0x52')]][_0x4e1c('0x8')]=_0x4e1c('0x56');}if(!_[_0x4e1c('0x17')](queues[_0x4e1e30[_0x4e1c('0x53')]])){if(_0x4e1e30[_0x4e1c('0x62')]&&queues[_0x4e1e30[_0x4e1c('0x62')]]){queues[_0x4e1e30[_0x4e1c('0x62')]][_0x4e1c('0x21')]=0x1;queues[_0x4e1e30[_0x4e1c('0x59')]]=_[_0x4e1c('0x58')](queues[_0x4e1e30[_0x4e1c('0x62')]]);queues[_0x4e1e30[_0x4e1c('0x59')]][_0x4e1c('0xe')]=_0x4e1e30[_0x4e1c('0x59')];queues[_0x4e1e30['transfertargetuniqueid']][_0x4e1c('0x21')]=0x2;queues[_0x4e1e30['transfertargetuniqueid']][_0x4e1c('0x5a')]=queues[_0x4e1e30[_0x4e1c('0x52')]]['calleridnum'];queues[_0x4e1e30['transfertargetuniqueid']][_0x4e1c('0x5d')]=queues[_0x4e1e30[_0x4e1c('0x52')]][_0x4e1c('0x5d')];queues[_0x4e1e30[_0x4e1c('0x59')]]['queuecallerjoinAt']=utils[_0x4e1c('0x15')]();queues[_0x4e1e30[_0x4e1c('0x59')]][_0x4e1c('0x19')]=utils[_0x4e1c('0x15')]();queues[_0x4e1e30[_0x4e1c('0x59')]][_0x4e1c('0x36')]=0x0;queues[_0x4e1e30[_0x4e1c('0x59')]]['mohtime']=0x0;utils['info'](util[_0x4e1c('0x3')](_0x4e1c('0x63'),_0x4e1e30[_0x4e1c('0x51')],queues[_0x4e1e30[_0x4e1c('0x59')]][_0x4e1c('0x1f')],queues[_0x4e1e30[_0x4e1c('0x59')]][_0x4e1c('0xe')],queues[_0x4e1e30['transfertargetuniqueid']][_0x4e1c('0x5a')],queues[_0x4e1e30[_0x4e1c('0x59')]][_0x4e1c('0x5d')]));}else{utils[_0x4e1c('0x11')](util['format'](_0x4e1c('0x64'),_0x4e1e30[_0x4e1c('0x51')],queues[_0x4e1e30[_0x4e1c('0x53')]][_0x4e1c('0x1f')],_0x4e1e30[_0x4e1c('0x52')]));queues[_0x4e1e30[_0x4e1c('0x53')]][_0x4e1c('0xe')]=_0x4e1e30['origtransfererlinkedid'];}}}}catch(_0x52dd24){utils[_0x4e1c('0x2d')](util['format'](_0x4e1c('0x50'),_0x4e1e30[_0x4e1c('0x51')]),_0x52dd24);}};exports[_0x4e1c('0x65')]=function(_0x53034a){try{if(!_[_0x4e1c('0x17')](queues[_0x53034a[_0x4e1c('0x4')]])){utils[_0x4e1c('0xf')](util['format'](_0x4e1c('0x66'),_0x53034a[_0x4e1c('0x4')]),_0x53034a);queues[_0x53034a[_0x4e1c('0x4')]][_0x4e1c('0x67')]=utils[_0x4e1c('0x15')]();utils[_0x4e1c('0x11')](util[_0x4e1c('0x3')](_0x4e1c('0x68'),_0x53034a[_0x4e1c('0x4')],queues[_0x53034a['uniqueid']]['name'],queues[_0x53034a[_0x4e1c('0x4')]]['musiconholdstartAt']));}}catch(_0x3267ec){utils[_0x4e1c('0x2d')](util[_0x4e1c('0x3')](_0x4e1c('0x66'),_0x53034a[_0x4e1c('0x4')]),_0x3267ec);}};exports[_0x4e1c('0x69')]=function(_0x3380c7){try{if(!_[_0x4e1c('0x17')](queues[_0x3380c7[_0x4e1c('0x4')]])){if(!_[_0x4e1c('0x17')](queues[_0x3380c7[_0x4e1c('0x4')]][_0x4e1c('0x67')])){utils[_0x4e1c('0xf')](util['format'](_0x4e1c('0x6a'),_0x3380c7['uniqueid']),_0x3380c7);queues[_0x3380c7[_0x4e1c('0x4')]][_0x4e1c('0x5b')]+=utils[_0x4e1c('0x37')](utils[_0x4e1c('0x15')](),queues[_0x3380c7[_0x4e1c('0x4')]]['musiconholdstartAt']);utils[_0x4e1c('0x11')](util[_0x4e1c('0x3')](_0x4e1c('0x6b'),_0x3380c7['uniqueid'],queues[_0x3380c7[_0x4e1c('0x4')]][_0x4e1c('0x1f')],queues[_0x3380c7['uniqueid']][_0x4e1c('0x5b')]));delete queues[_0x3380c7[_0x4e1c('0x4')]]['musiconholdstartAt'];}}}catch(_0x555f4d){utils['error'](util[_0x4e1c('0x3')](_0x4e1c('0x6a'),_0x3380c7['uniqueid']),_0x555f4d);}}; \ No newline at end of file +var _0xb96d=['queuecallerleaveAt','queuecallerjoinAt','count','connectedlinenum','agentconnect','destaccountcode','assigned','membername','agentcomplete','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','secondtransfererlinkedid','ATTENDED','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertype','ATTENDEDTRANSFER','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','queue','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','info','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','debug','[%s][queues][varset]','variable','queuestatus','value','queuecallerabandon','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','queuecallerexitAt','ABANDONED','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','connectedlinename','queuecallerleave','holdtime','diffTime'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb96d,0x9e));var _0xdb96=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0xb96d[_0x28669c];return _0x4a3af6;};'use strict';var _=require('lodash');var util=require(_0xdb96('0x0'));var utils=require(_0xdb96('0x1'));var queues={};function writeDB(_0x36f0ce){utils['info'](util[_0xdb96('0x2')](_0xdb96('0x3'),_0x36f0ce[_0xdb96('0x4')],_0x36f0ce['channel'],_0x36f0ce['queue'],_0x36f0ce[_0xdb96('0x5')],_0x36f0ce[_0xdb96('0x6')],_0x36f0ce[_0xdb96('0x7')],_0x36f0ce[_0xdb96('0x8')]));if(_0x36f0ce['queue']){utils[_0xdb96('0x9')](_0x36f0ce[_0xdb96('0xa')])['then'](function(_0x3384b4){if(_0x3384b4){_0x36f0ce['type']=_0x3384b4[_0xdb96('0xb')];}utils[_0xdb96('0xc')]('CreateVoiceQueueReport',_0x36f0ce);});}else{utils[_0xdb96('0xc')](_0xdb96('0xd'),_0x36f0ce);}if(_0x36f0ce['transfereduniqueid']){delete queues[_0x36f0ce[_0xdb96('0xe')]];}else{delete queues[_0x36f0ce[_0xdb96('0x4')]];}}exports[_0xdb96('0xf')]=function(_0x1d4c0c){try{utils['debug'](util[_0xdb96('0x2')](_0xdb96('0x10'),_0x1d4c0c[_0xdb96('0x4')]),_0x1d4c0c);utils['info'](util[_0xdb96('0x2')](_0xdb96('0x11'),_0x1d4c0c[_0xdb96('0x4')],_0x1d4c0c[_0xdb96('0xa')],_0x1d4c0c[_0xdb96('0x12')]));queues[_0x1d4c0c[_0xdb96('0x4')]]=_[_0xdb96('0x13')](_0x1d4c0c,{'originalposition':_0x1d4c0c[_0xdb96('0x12')],'queuecallerjoinAt':utils[_0xdb96('0x14')](),'mohtime':0x0});}catch(_0x745780){utils[_0xdb96('0x15')](util[_0xdb96('0x2')](_0xdb96('0x10'),_0x1d4c0c['uniqueid']),_0x745780);}};exports[_0xdb96('0x16')]=function(_0x2a766e){try{if(!_[_0xdb96('0x17')](queues[_0x2a766e[_0xdb96('0x4')]])){utils['debug'](util[_0xdb96('0x2')](_0xdb96('0x18'),_0x2a766e[_0xdb96('0x4')]),_0x2a766e);if(queues[_0x2a766e['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x2a766e[_0xdb96('0x4')]]['queuecallerabandon']&&!queues[_0x2a766e['uniqueid']][_0xdb96('0x19')]){queues[_0x2a766e[_0xdb96('0x4')]][_0xdb96('0x1a')]=!![];queues[_0x2a766e[_0xdb96('0x4')]]['queuecallercompleteAt']=utils[_0xdb96('0x14')]();queues[_0x2a766e['uniqueid']][_0xdb96('0x8')]=_0xdb96('0x1b');}utils['info'](util[_0xdb96('0x2')](_0xdb96('0x1c'),_0x2a766e[_0xdb96('0x4')],queues[_0x2a766e[_0xdb96('0x4')]][_0xdb96('0x1d')],queues[_0x2a766e[_0xdb96('0x4')]][_0xdb96('0x8')]));writeDB(queues[_0x2a766e['uniqueid']]);}else if(queues[_0x2a766e[_0xdb96('0x4')]][_0xdb96('0xe')]){utils[_0xdb96('0x1e')](util['format'](_0xdb96('0x1f'),_0x2a766e[_0xdb96('0x4')],queues[_0x2a766e[_0xdb96('0x4')]][_0xdb96('0x1d')],queues[_0x2a766e[_0xdb96('0x4')]][_0xdb96('0xe')]));queues[queues[_0x2a766e[_0xdb96('0x4')]][_0xdb96('0xe')]]=queues[_0x2a766e[_0xdb96('0x4')]];queues[queues[_0x2a766e['uniqueid']][_0xdb96('0xe')]][_0xdb96('0x20')]=0x2;delete queues[_0x2a766e['uniqueid']];}}}catch(_0x372bca){utils[_0xdb96('0x15')](util['format'](_0xdb96('0x18'),_0x2a766e[_0xdb96('0x4')]),_0x372bca);}};exports[_0xdb96('0x21')]=function(_0x1317b8){try{utils[_0xdb96('0x22')](util[_0xdb96('0x2')](_0xdb96('0x23'),_0x1317b8['uniqueid']),_0x1317b8);if(!_[_0xdb96('0x17')](_0x1317b8[_0xdb96('0x24')][_0xdb96('0x25')])&&_0x1317b8[_0xdb96('0x26')]['toUpperCase']()!=='CONTINUE'){if(!_[_0xdb96('0x17')](queues[_0x1317b8[_0xdb96('0x4')]])){queues[_0x1317b8['uniqueid']][_0xdb96('0x27')]=![];queues[_0x1317b8['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1317b8['uniqueid']]['queuecallerexit']=!![];queues[_0x1317b8[_0xdb96('0x4')]]['queuecallerexitAt']=utils['now']();queues[_0x1317b8[_0xdb96('0x4')]][_0xdb96('0x8')]=_0x1317b8[_0xdb96('0x26')][_0xdb96('0x28')]();utils['info'](util[_0xdb96('0x2')](_0xdb96('0x29'),_0x1317b8[_0xdb96('0x4')],queues[_0x1317b8[_0xdb96('0x4')]][_0xdb96('0x1d')],_0x1317b8['value'],queues[_0x1317b8[_0xdb96('0x4')]][_0xdb96('0x8')]));writeDB(queues[_0x1317b8[_0xdb96('0x4')]]);}}else if(!_[_0xdb96('0x17')](_0x1317b8[_0xdb96('0x24')][_0xdb96('0x2a')])){if(!_[_0xdb96('0x17')](queues[_0x1317b8['uniqueid']])&&!queues[_0x1317b8['uniqueid']]['queuecallerabandon']){queues[_0x1317b8[_0xdb96('0x4')]][_0xdb96('0x27')]=![];queues[_0x1317b8[_0xdb96('0x4')]][_0xdb96('0x2b')]=null;queues[_0x1317b8['uniqueid']][_0xdb96('0x19')]=!![];queues[_0x1317b8['uniqueid']]['queuecallerexitAt']=utils[_0xdb96('0x14')]();queues[_0x1317b8[_0xdb96('0x4')]][_0xdb96('0x8')]=_0xdb96('0x2c');utils['info'](util[_0xdb96('0x2')](_0xdb96('0x2d'),_0x1317b8[_0xdb96('0x4')],queues[_0x1317b8[_0xdb96('0x4')]][_0xdb96('0x1d')],_0x1317b8['value'],queues[_0x1317b8[_0xdb96('0x4')]]['queuecallerexitreason']));}}}catch(_0x13507d){utils[_0xdb96('0x15')](util[_0xdb96('0x2')](_0xdb96('0x23'),_0x1317b8[_0xdb96('0x4')]),_0x13507d);}};exports['queuecallerabandon']=function(_0xb2ed0b){try{if(!_['isNil'](queues[_0xb2ed0b[_0xdb96('0x4')]])){utils[_0xdb96('0x22')](util['format']('[%s][queues][queuecallerabandon]',_0xb2ed0b[_0xdb96('0x4')]),_0xb2ed0b);queues[_0xb2ed0b[_0xdb96('0x4')]][_0xdb96('0x19')]=![];queues[_0xb2ed0b[_0xdb96('0x4')]][_0xdb96('0x2e')]=null;queues[_0xb2ed0b[_0xdb96('0x4')]]['queuecallerabandon']=!![];queues[_0xb2ed0b[_0xdb96('0x4')]]['queuecallerabandonAt']=utils[_0xdb96('0x14')]();queues[_0xb2ed0b['uniqueid']]['queuecallerexitreason']=_0xdb96('0x2f');utils['info'](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0xb2ed0b['uniqueid'],queues[_0xb2ed0b[_0xdb96('0x4')]][_0xdb96('0x1d')],queues[_0xb2ed0b['uniqueid']][_0xdb96('0x8')]));}}catch(_0x2cc46a){utils[_0xdb96('0x15')](util['format'](_0xdb96('0x30'),_0xb2ed0b[_0xdb96('0x4')]),_0x2cc46a);}};exports['queuecallerleave']=function(_0x2be486){try{if(!_[_0xdb96('0x17')](queues[_0x2be486[_0xdb96('0x4')]])){utils['debug'](util[_0xdb96('0x2')](_0xdb96('0x31'),_0x2be486[_0xdb96('0x4')]),_0x2be486);utils['info'](util[_0xdb96('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2be486[_0xdb96('0x4')],queues[_0x2be486[_0xdb96('0x4')]][_0xdb96('0x1d')],_0x2be486['connectedlinenum'],_0x2be486[_0xdb96('0x32')]));queues[_0x2be486['uniqueid']][_0xdb96('0x33')]=!![];queues[_0x2be486['uniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x2be486[_0xdb96('0x4')]][_0xdb96('0x34')]=utils[_0xdb96('0x35')](queues[_0x2be486[_0xdb96('0x4')]][_0xdb96('0x36')],queues[_0x2be486[_0xdb96('0x4')]][_0xdb96('0x37')]);queues[_0x2be486[_0xdb96('0x4')]][_0xdb96('0x12')]=_0x2be486[_0xdb96('0x12')];queues[_0x2be486[_0xdb96('0x4')]]['count']=_0x2be486[_0xdb96('0x38')];queues[_0x2be486[_0xdb96('0x4')]][_0xdb96('0x39')]=_0x2be486[_0xdb96('0x39')];queues[_0x2be486[_0xdb96('0x4')]][_0xdb96('0x32')]=_0x2be486[_0xdb96('0x32')];}}catch(_0x4c7943){utils['error'](util[_0xdb96('0x2')](_0xdb96('0x31'),_0x2be486[_0xdb96('0x4')]),_0x4c7943);}};exports[_0xdb96('0x3a')]=function(_0x1a4217){try{if(!_[_0xdb96('0x17')](queues[_0x1a4217['uniqueid']])){utils[_0xdb96('0x22')](util[_0xdb96('0x2')]('[%s][queues][agentconnect]',_0x1a4217[_0xdb96('0x4')]),_0x1a4217);utils['info'](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x1a4217[_0xdb96('0x4')],queues[_0x1a4217['uniqueid']][_0xdb96('0x1d')],_0x1a4217['membername'],_0x1a4217[_0xdb96('0x3b')]));queues[_0x1a4217[_0xdb96('0x4')]][_0xdb96('0x27')]=![];queues[_0x1a4217[_0xdb96('0x4')]][_0xdb96('0x27')]=![];queues[_0x1a4217[_0xdb96('0x4')]][_0xdb96('0x2b')]=null;queues[_0x1a4217[_0xdb96('0x4')]][_0xdb96('0x19')]=![];queues[_0x1a4217['uniqueid']][_0xdb96('0x8')]=null;queues[_0x1a4217[_0xdb96('0x4')]][_0xdb96('0x2e')]=null;queues[_0x1a4217[_0xdb96('0x4')]][_0xdb96('0x3c')]=!![];queues[_0x1a4217[_0xdb96('0x4')]][_0xdb96('0x7')]=_0x1a4217[_0xdb96('0x3b')];queues[_0x1a4217[_0xdb96('0x4')]]['lastAssignedTo']=_0x1a4217[_0xdb96('0x3d')];}}catch(_0x15558e){utils[_0xdb96('0x15')](util[_0xdb96('0x2')]('[%s][queues][agentconnect]',_0x1a4217[_0xdb96('0x4')]),_0x15558e);}};exports[_0xdb96('0x3e')]=function(_0x18ed1b){try{if(!_[_0xdb96('0x17')](queues[_0x18ed1b[_0xdb96('0x4')]])){if(queues[_0x18ed1b[_0xdb96('0x4')]]['queuecallerleaveAt']){utils[_0xdb96('0x22')](util['format']('[%s][queues][agentcomplete]',_0x18ed1b[_0xdb96('0x4')]),_0x18ed1b);queues[_0x18ed1b[_0xdb96('0x4')]]['queuecallerabandon']=![];queues[_0x18ed1b['uniqueid']][_0xdb96('0x27')]=![];queues[_0x18ed1b[_0xdb96('0x4')]][_0xdb96('0x2b')]=null;queues[_0x18ed1b[_0xdb96('0x4')]][_0xdb96('0x19')]=![];queues[_0x18ed1b['uniqueid']][_0xdb96('0x2e')]=null;queues[_0x18ed1b[_0xdb96('0x4')]]['assigned']=!![];queues[_0x18ed1b[_0xdb96('0x4')]]['lastAssignedTo']=_0x18ed1b['membername'];queues[_0x18ed1b[_0xdb96('0x4')]][_0xdb96('0x1a')]=!![];queues[_0x18ed1b[_0xdb96('0x4')]][_0xdb96('0x3f')]=utils['now']();if(_0x18ed1b[_0xdb96('0x40')]==_0xdb96('0x41')){if(!queues[_0x18ed1b[_0xdb96('0x4')]][_0xdb96('0x41')]){queues[_0x18ed1b['uniqueid']]['queuecallerexitreason']=_0xdb96('0x42');}}else{queues[_0x18ed1b[_0xdb96('0x4')]][_0xdb96('0x8')]=_0xdb96('0x43')+_0x18ed1b['reason'][_0xdb96('0x28')]();}utils['info'](util['format'](_0xdb96('0x44'),_0x18ed1b[_0xdb96('0x4')],queues[_0x18ed1b[_0xdb96('0x4')]]['name'],_0x18ed1b[_0xdb96('0x3d')],queues[_0x18ed1b['uniqueid']][_0xdb96('0x8')]));writeDB(queues[_0x18ed1b[_0xdb96('0x4')]]);}}}catch(_0x3e3f1a){utils[_0xdb96('0x15')](util[_0xdb96('0x2')](_0xdb96('0x45'),_0x18ed1b[_0xdb96('0x4')]),_0x3e3f1a);}};exports[_0xdb96('0x46')]=function(_0x436946){try{if(!_[_0xdb96('0x17')](queues[_0x436946[_0xdb96('0x47')]])){utils[_0xdb96('0x22')](util[_0xdb96('0x2')](_0xdb96('0x48'),_0x436946[_0xdb96('0x4')]),_0x436946);queues[_0x436946[_0xdb96('0x47')]][_0xdb96('0x41')]=!![];queues[_0x436946[_0xdb96('0x47')]]['transfertype']=_0xdb96('0x49');queues[_0x436946[_0xdb96('0x47')]][_0xdb96('0x4a')]=_0x436946[_0xdb96('0x4b')];queues[_0x436946[_0xdb96('0x47')]][_0xdb96('0x4c')]=_0x436946[_0xdb96('0x47')];queues[_0x436946[_0xdb96('0x47')]]['queuecallerexitreason']=_0xdb96('0x4d');utils[_0xdb96('0x1e')](util['format'](_0xdb96('0x4e'),_0x436946[_0xdb96('0x4')],queues[_0x436946[_0xdb96('0x47')]]['name'],_0x436946[_0xdb96('0x47')],_0x436946['extension']));}}catch(_0x462dde){utils[_0xdb96('0x15')](util[_0xdb96('0x2')](_0xdb96('0x48'),_0x436946[_0xdb96('0x4')]),_0x462dde);}};exports[_0xdb96('0x4f')]=function(_0x38b197){try{utils['debug'](util[_0xdb96('0x2')](_0xdb96('0x50'),_0x38b197[_0xdb96('0x51')]),_0x38b197);if(_0x38b197[_0xdb96('0x51')]==_0x38b197[_0xdb96('0x52')]){if(!_[_0xdb96('0x17')](queues[_0x38b197['secondtransfererlinkedid']])){utils[_0xdb96('0x1e')](util[_0xdb96('0x2')](_0xdb96('0x53'),_0x38b197['origtransfereruniqueid'],queues[_0x38b197['secondtransfererlinkedid']][_0xdb96('0x1d')],_0x38b197[_0xdb96('0x54')]));queues[_0x38b197[_0xdb96('0x55')]][_0xdb96('0x41')]=!![];queues[_0x38b197[_0xdb96('0x55')]]['transfertype']=_0xdb96('0x56');queues[_0x38b197[_0xdb96('0x55')]]['transferexten']=_0x38b197[_0xdb96('0x54')];queues[_0x38b197[_0xdb96('0x55')]][_0xdb96('0x4c')]=_0x38b197[_0xdb96('0x51')];queues[_0x38b197[_0xdb96('0x55')]][_0xdb96('0x8')]='ATTENDEDTRANSFER';}if(!_[_0xdb96('0x17')](queues[_0x38b197['origtransfererlinkedid']])){if(_0x38b197[_0xdb96('0x57')]&&queues[_0x38b197['transfereelinkedid']]){queues[_0x38b197[_0xdb96('0x57')]][_0xdb96('0x20')]=0x1;queues[_0x38b197[_0xdb96('0x47')]]=_[_0xdb96('0x58')](queues[_0x38b197[_0xdb96('0x57')]]);queues[_0x38b197[_0xdb96('0x47')]][_0xdb96('0xe')]=_0x38b197[_0xdb96('0x59')];queues[_0x38b197[_0xdb96('0x47')]][_0xdb96('0x20')]=0x2;queues[_0x38b197[_0xdb96('0x47')]]['calleridnum']=queues[_0x38b197[_0xdb96('0x55')]]['calleridnum'];queues[_0x38b197[_0xdb96('0x47')]]['calleridname']=queues[_0x38b197[_0xdb96('0x55')]][_0xdb96('0x5a')];queues[_0x38b197[_0xdb96('0x47')]][_0xdb96('0x37')]=utils[_0xdb96('0x14')]();queues[_0x38b197[_0xdb96('0x47')]][_0xdb96('0x36')]=utils['now']();queues[_0x38b197[_0xdb96('0x47')]]['holdtime']=0x0;queues[_0x38b197[_0xdb96('0x47')]][_0xdb96('0x5b')]=0x0;utils['info'](util[_0xdb96('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x38b197[_0xdb96('0x51')],queues[_0x38b197['transfereeuniqueid']][_0xdb96('0x1d')],queues[_0x38b197[_0xdb96('0x47')]][_0xdb96('0x6')],queues[_0x38b197[_0xdb96('0x47')]][_0xdb96('0x5a')]));}else{utils['info'](util['format'](_0xdb96('0x5c'),_0x38b197[_0xdb96('0x51')],queues[_0x38b197[_0xdb96('0x52')]][_0xdb96('0x1d')],_0x38b197[_0xdb96('0x55')]));queues[_0x38b197[_0xdb96('0x52')]][_0xdb96('0xe')]=_0x38b197[_0xdb96('0x55')];}}}else if(_0x38b197[_0xdb96('0x5d')]==_0x38b197[_0xdb96('0x55')]){if(!_[_0xdb96('0x17')](queues[_0x38b197['origtransfererlinkedid']])){utils['info'](util['format'](_0xdb96('0x5e'),_0x38b197[_0xdb96('0x51')],queues[_0x38b197[_0xdb96('0x52')]][_0xdb96('0x1d')],_0x38b197[_0xdb96('0x5d')],_0x38b197[_0xdb96('0x5f')]));queues[_0x38b197[_0xdb96('0x52')]][_0xdb96('0x41')]=!![];queues[_0x38b197['origtransfererlinkedid']][_0xdb96('0x60')]=_0xdb96('0x56');queues[_0x38b197[_0xdb96('0x52')]][_0xdb96('0x4a')]=_0x38b197['secondtransfererexten'];queues[_0x38b197[_0xdb96('0x52')]][_0xdb96('0x4c')]=_0x38b197['secondtransfereruniqueid'];queues[_0x38b197[_0xdb96('0x52')]][_0xdb96('0x8')]=_0xdb96('0x61');}if(!_[_0xdb96('0x17')](queues[_0x38b197[_0xdb96('0x55')]])){if(_0x38b197[_0xdb96('0x62')]&&queues[_0x38b197['transfertargetlinkedid']]){queues[_0x38b197[_0xdb96('0x62')]][_0xdb96('0x20')]=0x1;queues[_0x38b197['transfertargetuniqueid']]=_[_0xdb96('0x58')](queues[_0x38b197[_0xdb96('0x62')]]);queues[_0x38b197[_0xdb96('0x59')]][_0xdb96('0xe')]=_0x38b197['transfertargetuniqueid'];queues[_0x38b197[_0xdb96('0x59')]][_0xdb96('0x20')]=0x2;queues[_0x38b197[_0xdb96('0x59')]][_0xdb96('0x6')]=queues[_0x38b197[_0xdb96('0x52')]]['calleridnum'];queues[_0x38b197['transfertargetuniqueid']][_0xdb96('0x5a')]=queues[_0x38b197[_0xdb96('0x52')]][_0xdb96('0x5a')];queues[_0x38b197[_0xdb96('0x59')]][_0xdb96('0x37')]=utils[_0xdb96('0x14')]();queues[_0x38b197['transfertargetuniqueid']][_0xdb96('0x36')]=utils['now']();queues[_0x38b197['transfertargetuniqueid']][_0xdb96('0x34')]=0x0;queues[_0x38b197[_0xdb96('0x59')]][_0xdb96('0x5b')]=0x0;utils['info'](util[_0xdb96('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x38b197['origtransfereruniqueid'],queues[_0x38b197[_0xdb96('0x59')]][_0xdb96('0x1d')],queues[_0x38b197[_0xdb96('0x59')]][_0xdb96('0xe')],queues[_0x38b197[_0xdb96('0x59')]]['calleridnum'],queues[_0x38b197[_0xdb96('0x59')]][_0xdb96('0x5a')]));}else{utils[_0xdb96('0x1e')](util[_0xdb96('0x2')](_0xdb96('0x5c'),_0x38b197[_0xdb96('0x51')],queues[_0x38b197[_0xdb96('0x55')]][_0xdb96('0x1d')],_0x38b197['origtransfererlinkedid']));queues[_0x38b197[_0xdb96('0x55')]][_0xdb96('0xe')]=_0x38b197[_0xdb96('0x52')];}}}}catch(_0x3af79f){utils[_0xdb96('0x15')](util[_0xdb96('0x2')](_0xdb96('0x50'),_0x38b197[_0xdb96('0x51')]),_0x3af79f);}};exports[_0xdb96('0x63')]=function(_0x130c36){try{if(!_[_0xdb96('0x17')](queues[_0x130c36['uniqueid']])){utils[_0xdb96('0x22')](util[_0xdb96('0x2')]('[%s][queues][musiconholdstart]',_0x130c36[_0xdb96('0x4')]),_0x130c36);queues[_0x130c36[_0xdb96('0x4')]]['musiconholdstartAt']=utils[_0xdb96('0x14')]();utils[_0xdb96('0x1e')](util[_0xdb96('0x2')](_0xdb96('0x64'),_0x130c36[_0xdb96('0x4')],queues[_0x130c36[_0xdb96('0x4')]][_0xdb96('0x1d')],queues[_0x130c36[_0xdb96('0x4')]][_0xdb96('0x65')]));}}catch(_0x917b72){utils[_0xdb96('0x15')](util[_0xdb96('0x2')](_0xdb96('0x66'),_0x130c36[_0xdb96('0x4')]),_0x917b72);}};exports[_0xdb96('0x67')]=function(_0x5c2178){try{if(!_['isNil'](queues[_0x5c2178[_0xdb96('0x4')]])){if(!_['isNil'](queues[_0x5c2178[_0xdb96('0x4')]][_0xdb96('0x65')])){utils[_0xdb96('0x22')](util[_0xdb96('0x2')]('[%s][queues][musiconholdstop]',_0x5c2178['uniqueid']),_0x5c2178);queues[_0x5c2178[_0xdb96('0x4')]][_0xdb96('0x5b')]+=utils[_0xdb96('0x35')](utils[_0xdb96('0x14')](),queues[_0x5c2178[_0xdb96('0x4')]][_0xdb96('0x65')]);utils[_0xdb96('0x1e')](util[_0xdb96('0x2')](_0xdb96('0x68'),_0x5c2178[_0xdb96('0x4')],queues[_0x5c2178[_0xdb96('0x4')]]['name'],queues[_0x5c2178[_0xdb96('0x4')]]['mohtime']));delete queues[_0x5c2178[_0xdb96('0x4')]][_0xdb96('0x65')];}}}catch(_0x5d3ff0){utils[_0xdb96('0x15')](util[_0xdb96('0x2')](_0xdb96('0x69'),_0x5c2178['uniqueid']),_0x5d3ff0);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 4eafbe9..8104165 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 _0xda45=['calleridname','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','toLowerCase','appdata','split','lastIndexOf','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','linkedid','transfer','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s'];(function(_0x2a2cbf,_0x31b74a){var _0x2cb5c2=function(_0x1047d7){while(--_0x1047d7){_0x2a2cbf['push'](_0x2a2cbf['shift']());}};_0x2cb5c2(++_0x31b74a);}(_0xda45,0x111));var _0x5da4=function(_0x329dcb,_0xaa6e1f){_0x329dcb=_0x329dcb-0x0;var _0x27fe9f=_0xda45[_0x329dcb];return _0x27fe9f;};'use strict';var _=require(_0x5da4('0x0'));var util=require(_0x5da4('0x1'));var utils=require(_0x5da4('0x2'));var recordings={};function writeDB(_0x138c02){utils[_0x5da4('0x3')](util[_0x5da4('0x4')](_0x5da4('0x5'),_0x138c02[_0x5da4('0x6')]));if(_0x138c02[_0x5da4('0x7')]){utils[_0x5da4('0x8')](_0x138c02['accountcode'])[_0x5da4('0x9')](function(_0x3ef4f5){if(_0x3ef4f5){_0x138c02[_0x5da4('0xa')]=_0x3ef4f5['name'];_0x138c02['UserId']=_0x3ef4f5['id'];}utils[_0x5da4('0xb')](_0x5da4('0xc'),_0x138c02);});}else{utils['request'](_0x5da4('0xc'),_0x138c02);}}exports[_0x5da4('0xd')]=function(_0x19abdf){try{utils[_0x5da4('0xe')](util[_0x5da4('0x4')](_0x5da4('0xf'),_0x19abdf['uniqueid']),_0x19abdf);if(_0x19abdf[_0x5da4('0x6')]==_0x19abdf['linkedid']){utils['info'](util['format'](_0x5da4('0x10'),_0x19abdf[_0x5da4('0x6')],_0x19abdf[_0x5da4('0x11')],_0x19abdf[_0x5da4('0x12')]));recordings[_0x19abdf[_0x5da4('0x6')]]={'uniqueid':_0x19abdf[_0x5da4('0x6')],'accountcode':_0x19abdf[_0x5da4('0x7')],'exten':_0x19abdf[_0x5da4('0x12')],'context':_0x19abdf[_0x5da4('0x11')],'channel':_0x19abdf[_0x5da4('0x13')],'monitors':[]};}}catch(_0x2952e2){utils['error'](util['format']('[%s][recordings][newchannel]',_0x19abdf['uniqueid']),_0x2952e2);}};exports[_0x5da4('0x14')]=function(_0x41a93e){try{utils['debug'](util['format'](_0x5da4('0x15'),_0x41a93e[_0x5da4('0x6')]),_0x41a93e);if(!_['isNil'](recordings[_0x41a93e[_0x5da4('0x6')]])&&_0x41a93e['channelstate']==0x6){utils[_0x5da4('0x3')](util[_0x5da4('0x4')](_0x5da4('0x16'),_0x41a93e[_0x5da4('0x6')],_0x41a93e[_0x5da4('0x11')],_0x41a93e[_0x5da4('0x13')]));}else if(!_[_0x5da4('0x17')](recordings[_0x41a93e[_0x5da4('0x18')]])&&_0x41a93e['channelstate']==0x6&&_0x41a93e['context']!=_0x5da4('0x19')){utils[_0x5da4('0x3')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x41a93e[_0x5da4('0x6')],_0x41a93e[_0x5da4('0x18')],_0x41a93e[_0x5da4('0x11')],_0x41a93e[_0x5da4('0x13')]));recordings[_0x41a93e[_0x5da4('0x18')]][_0x5da4('0x7')]=_0x41a93e[_0x5da4('0x7')];}}catch(_0x53f27a){utils[_0x5da4('0x1a')](util['format'](_0x5da4('0x15'),_0x41a93e['uniqueid']),_0x53f27a);}};exports[_0x5da4('0x1b')]=function(_0x5d22ff){try{if(!_[_0x5da4('0x17')](_0x5d22ff[_0x5da4('0x1c')])&&!_[_0x5da4('0x17')](_0x5d22ff[_0x5da4('0x1c')][_0x5da4('0x1d')])){utils[_0x5da4('0xe')](util['format']('[%s][recordings][varset]',_0x5d22ff[_0x5da4('0x6')]),_0x5d22ff);utils[_0x5da4('0x3')](util[_0x5da4('0x4')](_0x5da4('0x1e'),_0x5d22ff[_0x5da4('0x6')],_0x5d22ff[_0x5da4('0x1c')],_0x5d22ff[_0x5da4('0x1f')]));if(_[_0x5da4('0x20')](_0x5d22ff[_0x5da4('0x1f')],_0x5da4('0x21'))){_0x5d22ff['value']=_0x5d22ff[_0x5da4('0x1f')]['replace'](_0x5da4('0x21'),_0x5da4('0x22'));}if(recordings[_0x5d22ff[_0x5da4('0x18')]]){var _0x48fa50=_[_0x5da4('0x23')](recordings[_0x5d22ff['linkedid']][_0x5da4('0x24')],{'value':_0x5d22ff['value']});if(_['isNil'](_0x48fa50)){recordings[_0x5d22ff[_0x5da4('0x18')]][_0x5da4('0x24')][_0x5da4('0x25')]({'value':_0x5d22ff[_0x5da4('0x1f')]});}}}}catch(_0xbdb0ae){utils['error'](util['format'](_0x5da4('0x26'),_0x5d22ff['uniqueid']),_0xbdb0ae);}};exports[_0x5da4('0x27')]=function(_0x1a3409){try{if(!_[_0x5da4('0x17')](recordings[_0x1a3409[_0x5da4('0x6')]])){utils['debug'](util[_0x5da4('0x4')](_0x5da4('0x28'),_0x1a3409[_0x5da4('0x6')]),_0x1a3409);utils[_0x5da4('0x3')](util[_0x5da4('0x4')](_0x5da4('0x29'),_0x1a3409[_0x5da4('0x6')],_0x1a3409['calleridnum'],_0x1a3409[_0x5da4('0x2a')],_0x1a3409['cause-txt']));recordings[_0x1a3409[_0x5da4('0x6')]][_0x5da4('0x2b')]=_0x1a3409[_0x5da4('0x2b')];recordings[_0x1a3409[_0x5da4('0x6')]]['calleridname']=_0x1a3409[_0x5da4('0x2a')];recordings[_0x1a3409['uniqueid']][_0x5da4('0x2c')]=_0x1a3409['connectedlinenum'];recordings[_0x1a3409['uniqueid']][_0x5da4('0x2d')]=_0x1a3409['connectedlinename'];if(recordings[_0x1a3409[_0x5da4('0x6')]][_0x5da4('0x2e')]==_0x5da4('0x2f')&&recordings[_0x1a3409[_0x5da4('0x6')]][_0x5da4('0x7')]){recordings[_0x1a3409[_0x5da4('0x6')]]['connectedlinenum']=recordings[_0x1a3409[_0x5da4('0x6')]]['accountcode'];recordings[_0x1a3409[_0x5da4('0x6')]][_0x5da4('0x2d')]='';}recordings[_0x1a3409[_0x5da4('0x6')]][_0x5da4('0x24')][_0x5da4('0x30')](function(_0xe88c30){var _0x120054=_[_0x5da4('0x31')](recordings[_0x1a3409[_0x5da4('0x6')]]);_0x120054[_0x5da4('0x1f')]=_0xe88c30[_0x5da4('0x1f')];writeDB(_0x120054);});delete recordings[_0x1a3409['uniqueid']];}}catch(_0x4b89d9){utils[_0x5da4('0x1a')](util[_0x5da4('0x4')]('[%s][recordings][hangup]',_0x1a3409[_0x5da4('0x6')]),_0x4b89d9);}};exports[_0x5da4('0x32')]=function(_0x34a96d){try{if(!_['isNil'](recordings[_0x34a96d[_0x5da4('0x6')]])){utils[_0x5da4('0xe')](util[_0x5da4('0x4')](_0x5da4('0x33'),_0x34a96d['uniqueid']),_0x34a96d);utils[_0x5da4('0x3')](util[_0x5da4('0x4')](_0x5da4('0x34'),_0x34a96d[_0x5da4('0x6')],_0x34a96d[_0x5da4('0x35')],_0x34a96d['appdata']));if(_0x34a96d[_0x5da4('0x35')]['toLowerCase']()==_0x5da4('0x36')&&_[_0x5da4('0x37')](_0x34a96d['appdata'][_0x5da4('0x38')](),'cdr')){var _0x3f225b=_0x34a96d[_0x5da4('0x39')][_0x5da4('0x3a')]('=');var _0x28d33f=_0x3f225b[0x0]['substring'](_0x3f225b[0x0][_0x5da4('0x3b')]('(')+0x1,_0x3f225b[0x0]['lastIndexOf'](')'));var _0x352b89=_0x3f225b[0x1];recordings[_0x34a96d['uniqueid']][_0x28d33f]=_0x352b89;}}}catch(_0x2b61a0){utils[_0x5da4('0x1a')](util[_0x5da4('0x4')](_0x5da4('0x33'),_0x34a96d[_0x5da4('0x6')]),_0x2b61a0);}};exports['queuecallerjoin']=function(_0x18a440){try{if(!_[_0x5da4('0x17')](recordings[_0x18a440['uniqueid']])){utils['debug'](util[_0x5da4('0x4')]('[%s][recordings][queuecallerjoin]',_0x18a440[_0x5da4('0x6')]),_0x18a440);utils['info'](util['format'](_0x5da4('0x3c'),_0x18a440['uniqueid'],_0x18a440[_0x5da4('0x3d')]));recordings[_0x18a440[_0x5da4('0x6')]][_0x5da4('0x3d')]=_0x18a440[_0x5da4('0x3d')];}}catch(_0xd93780){utils['error'](util[_0x5da4('0x4')](_0x5da4('0x3e'),_0x18a440['uniqueid']),_0xd93780);}}; \ No newline at end of file +var _0x8278=['[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','format','info','exten','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','context','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','linkedid','find','monitors','hangup','[%s][recordings][hangup]','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','newexten','[%s][recordings][newexten]','application','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','queuecallerjoin'];(function(_0x47794f,_0x12c9b3){var _0x2ca51d=function(_0x43deb3){while(--_0x43deb3){_0x47794f['push'](_0x47794f['shift']());}};_0x2ca51d(++_0x12c9b3);}(_0x8278,0x1ae));var _0x8827=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8278[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8827('0x0'));var util=require(_0x8827('0x1'));var utils=require(_0x8827('0x2'));var recordings={};function writeDB(_0x36bb50){utils['info'](util['format'](_0x8827('0x3'),_0x36bb50[_0x8827('0x4')]));if(_0x36bb50[_0x8827('0x5')]){utils[_0x8827('0x6')](_0x36bb50['accountcode'])[_0x8827('0x7')](function(_0x4342d7){if(_0x4342d7){_0x36bb50[_0x8827('0x8')]=_0x4342d7[_0x8827('0x9')];_0x36bb50[_0x8827('0xa')]=_0x4342d7['id'];}utils[_0x8827('0xb')](_0x8827('0xc'),_0x36bb50);});}else{utils[_0x8827('0xb')](_0x8827('0xc'),_0x36bb50);}}exports[_0x8827('0xd')]=function(_0x3c1ba6){try{utils[_0x8827('0xe')](util[_0x8827('0xf')]('[%s][recordings][newchannel]',_0x3c1ba6[_0x8827('0x4')]),_0x3c1ba6);if(_0x3c1ba6[_0x8827('0x4')]==_0x3c1ba6['linkedid']){utils[_0x8827('0x10')](util[_0x8827('0xf')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x3c1ba6[_0x8827('0x4')],_0x3c1ba6['context'],_0x3c1ba6['exten']));recordings[_0x3c1ba6[_0x8827('0x4')]]={'uniqueid':_0x3c1ba6[_0x8827('0x4')],'accountcode':_0x3c1ba6[_0x8827('0x5')],'exten':_0x3c1ba6[_0x8827('0x11')],'context':_0x3c1ba6['context'],'channel':_0x3c1ba6[_0x8827('0x12')],'monitors':[]};}}catch(_0xc0b479){utils[_0x8827('0x13')](util[_0x8827('0xf')](_0x8827('0x14'),_0x3c1ba6[_0x8827('0x4')]),_0xc0b479);}};exports[_0x8827('0x15')]=function(_0x560fba){try{utils[_0x8827('0xe')](util[_0x8827('0xf')](_0x8827('0x16'),_0x560fba['uniqueid']),_0x560fba);if(!_[_0x8827('0x17')](recordings[_0x560fba[_0x8827('0x4')]])&&_0x560fba[_0x8827('0x18')]==0x6){utils['info'](util['format'](_0x8827('0x19'),_0x560fba[_0x8827('0x4')],_0x560fba['context'],_0x560fba['channel']));}else if(!_[_0x8827('0x17')](recordings[_0x560fba['linkedid']])&&_0x560fba['channelstate']==0x6&&_0x560fba['context']!=_0x8827('0x1a')){utils[_0x8827('0x10')](util[_0x8827('0xf')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x560fba[_0x8827('0x4')],_0x560fba['linkedid'],_0x560fba[_0x8827('0x1b')],_0x560fba[_0x8827('0x12')]));recordings[_0x560fba['linkedid']]['accountcode']=_0x560fba[_0x8827('0x5')];}}catch(_0x5226fc){utils[_0x8827('0x13')](util['format'](_0x8827('0x16'),_0x560fba[_0x8827('0x4')]),_0x5226fc);}};exports[_0x8827('0x1c')]=function(_0x531b8c){try{if(!_[_0x8827('0x17')](_0x531b8c[_0x8827('0x1d')])&&!_[_0x8827('0x17')](_0x531b8c['variable'][_0x8827('0x1e')])){utils['debug'](util[_0x8827('0xf')](_0x8827('0x1f'),_0x531b8c['uniqueid']),_0x531b8c);utils[_0x8827('0x10')](util[_0x8827('0xf')](_0x8827('0x20'),_0x531b8c[_0x8827('0x4')],_0x531b8c[_0x8827('0x1d')],_0x531b8c[_0x8827('0x21')]));if(_['endsWith'](_0x531b8c['value'],_0x8827('0x22'))){_0x531b8c['value']=_0x531b8c[_0x8827('0x21')][_0x8827('0x23')]('.wav49','.WAV');}if(recordings[_0x531b8c[_0x8827('0x24')]]){var _0x5e03ec=_[_0x8827('0x25')](recordings[_0x531b8c[_0x8827('0x24')]][_0x8827('0x26')],{'value':_0x531b8c[_0x8827('0x21')]});if(_['isNil'](_0x5e03ec)){recordings[_0x531b8c[_0x8827('0x24')]]['monitors']['push']({'value':_0x531b8c[_0x8827('0x21')]});}}}}catch(_0x27891a){utils[_0x8827('0x13')](util[_0x8827('0xf')]('[%s][recordings][varset]',_0x531b8c[_0x8827('0x4')]),_0x27891a);}};exports[_0x8827('0x27')]=function(_0x463629){try{if(!_['isNil'](recordings[_0x463629[_0x8827('0x4')]])){utils['debug'](util[_0x8827('0xf')](_0x8827('0x28'),_0x463629['uniqueid']),_0x463629);utils[_0x8827('0x10')](util[_0x8827('0xf')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x463629['uniqueid'],_0x463629[_0x8827('0x29')],_0x463629[_0x8827('0x2a')],_0x463629['cause-txt']));recordings[_0x463629['uniqueid']]['calleridnum']=_0x463629[_0x8827('0x29')];recordings[_0x463629['uniqueid']][_0x8827('0x2a')]=_0x463629[_0x8827('0x2a')];recordings[_0x463629[_0x8827('0x4')]][_0x8827('0x2b')]=_0x463629[_0x8827('0x2b')];recordings[_0x463629[_0x8827('0x4')]]['connectedlinename']=_0x463629[_0x8827('0x2c')];if(recordings[_0x463629[_0x8827('0x4')]][_0x8827('0x2d')]=='outbound'&&recordings[_0x463629[_0x8827('0x4')]][_0x8827('0x5')]){recordings[_0x463629['uniqueid']]['connectedlinenum']=recordings[_0x463629[_0x8827('0x4')]][_0x8827('0x5')];recordings[_0x463629[_0x8827('0x4')]][_0x8827('0x2c')]='';}recordings[_0x463629[_0x8827('0x4')]][_0x8827('0x26')][_0x8827('0x2e')](function(_0x47d058){var _0x1c0499=_['clone'](recordings[_0x463629[_0x8827('0x4')]]);_0x1c0499[_0x8827('0x21')]=_0x47d058[_0x8827('0x21')];writeDB(_0x1c0499);});delete recordings[_0x463629[_0x8827('0x4')]];}}catch(_0x10ad56){utils[_0x8827('0x13')](util[_0x8827('0xf')](_0x8827('0x28'),_0x463629[_0x8827('0x4')]),_0x10ad56);}};exports[_0x8827('0x2f')]=function(_0x533fae){try{if(!_['isNil'](recordings[_0x533fae[_0x8827('0x4')]])){utils[_0x8827('0xe')](util[_0x8827('0xf')](_0x8827('0x30'),_0x533fae[_0x8827('0x4')]),_0x533fae);utils[_0x8827('0x10')](util[_0x8827('0xf')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x533fae['uniqueid'],_0x533fae[_0x8827('0x31')],_0x533fae['appdata']));if(_0x533fae[_0x8827('0x31')][_0x8827('0x32')]()==_0x8827('0x33')&&_[_0x8827('0x34')](_0x533fae[_0x8827('0x35')]['toLowerCase'](),'cdr')){var _0x262a27=_0x533fae[_0x8827('0x35')][_0x8827('0x36')]('=');var _0x32accd=_0x262a27[0x0][_0x8827('0x37')](_0x262a27[0x0][_0x8827('0x38')]('(')+0x1,_0x262a27[0x0]['lastIndexOf'](')'));var _0x1ac32f=_0x262a27[0x1];recordings[_0x533fae[_0x8827('0x4')]][_0x32accd]=_0x1ac32f;}}}catch(_0x171010){utils['error'](util[_0x8827('0xf')]('[%s][recordings][newexten]',_0x533fae[_0x8827('0x4')]),_0x171010);}};exports[_0x8827('0x39')]=function(_0x344e00){try{if(!_['isNil'](recordings[_0x344e00['uniqueid']])){utils[_0x8827('0xe')](util['format'](_0x8827('0x3a'),_0x344e00[_0x8827('0x4')]),_0x344e00);utils['info'](util[_0x8827('0xf')](_0x8827('0x3b'),_0x344e00[_0x8827('0x4')],_0x344e00[_0x8827('0x3c')]));recordings[_0x344e00[_0x8827('0x4')]]['queue']=_0x344e00[_0x8827('0x3c')];}}catch(_0x19ad4a){utils['error'](util['format'](_0x8827('0x3a'),_0x344e00[_0x8827('0x4')]),_0x19ad4a);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 545f517..f62306e 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 _0xc4ce=['debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','type','transfereruniqueid','error','[%s][transfers][attendedtransfer]','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','./utils','info','format','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc4ce,0x1ae));var _0xec4c=function(_0x362891,_0x196f69){_0x362891=_0x362891-0x0;var _0x6eebfa=_0xc4ce[_0x362891];return _0x6eebfa;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xec4c('0x0'));function writeDB(_0xfcf2c){utils[_0xec4c('0x1')](util[_0xec4c('0x2')]('[%s][transfers][writeDB]\x20type:%s',_0xfcf2c['type']===_0xec4c('0x3')?_0xfcf2c[_0xec4c('0x4')]:_0xfcf2c[_0xec4c('0x5')],_0xfcf2c['type']));utils[_0xec4c('0x6')](_0xec4c('0x7'),_0xfcf2c);}exports[_0xec4c('0x8')]={};exports[_0xec4c('0x9')]=function(_0x3e6c52){try{utils[_0xec4c('0xa')](util[_0xec4c('0x2')](_0xec4c('0xb'),_0x3e6c52['uniqueid']),_0x3e6c52);utils[_0xec4c('0x1')](util[_0xec4c('0x2')](_0xec4c('0xc'),_0x3e6c52[_0xec4c('0x5')],_0x3e6c52[_0xec4c('0xd')],_0x3e6c52[_0xec4c('0xe')],_0x3e6c52[_0xec4c('0xf')],_0x3e6c52[_0xec4c('0x10')]));_0x3e6c52[_0xec4c('0x11')]='blind';exports[_0xec4c('0x8')][_0x3e6c52[_0xec4c('0x12')]]=_0x3e6c52;writeDB(_0x3e6c52);}catch(_0xa58e34){utils[_0xec4c('0x13')](util[_0xec4c('0x2')](_0xec4c('0xb'),_0x3e6c52[_0xec4c('0x5')]),_0xa58e34);}};exports['attendedtransfer']=function(_0x28bed3){try{utils[_0xec4c('0xa')](util[_0xec4c('0x2')](_0xec4c('0x14'),_0x28bed3[_0xec4c('0x4')]),_0x28bed3);utils[_0xec4c('0x1')](util[_0xec4c('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x28bed3[_0xec4c('0x4')],_0x28bed3['origtransferercalleridnum'],_0x28bed3[_0xec4c('0x15')],_0x28bed3[_0xec4c('0x16')],_0x28bed3[_0xec4c('0x17')]));_0x28bed3=_['assign'](_0x28bed3,{'transfererchannel':_0x28bed3[_0xec4c('0x18')],'transferercalleridnum':_0x28bed3[_0xec4c('0x19')],'transferercalleridname':_0x28bed3['origtransferercalleridname'],'transfererconnectedlinenum':_0x28bed3['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x28bed3[_0xec4c('0x1a')],'transfereraccountcode':_0x28bed3[_0xec4c('0x1b')],'transferercontext':_0x28bed3['secondtransferercontext'],'transfererexten':_0x28bed3[_0xec4c('0x1c')],'transfererlinkedid':_0x28bed3[_0xec4c('0x1d')],'context':_0x28bed3[_0xec4c('0x1e')],'extension':_0x28bed3[_0xec4c('0x1f')],'type':_0xec4c('0x3')});if(_[_0xec4c('0x20')](_0x28bed3[_0xec4c('0x21')])){_0x28bed3=_['assign'](_0x28bed3,{'transfereechannel':_0x28bed3[_0xec4c('0x22')],'transfereecalleridnum':_0x28bed3[_0xec4c('0x16')],'transfereecalleridname':_0x28bed3['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x28bed3[_0xec4c('0x23')],'transfereeconnectedlinename':_0x28bed3[_0xec4c('0x24')],'transfereeaccountcode':_0x28bed3[_0xec4c('0x25')],'transfereecontext':_0x28bed3[_0xec4c('0x26')],'transfereeexten':_0x28bed3['transfertargetexten'],'transfereelinkedid':_0x28bed3[_0xec4c('0x27')]});}writeDB(_0x28bed3);}catch(_0x2d90c6){utils['error'](util[_0xec4c('0x2')](_0xec4c('0x14'),_0x28bed3[_0xec4c('0x4')]),_0x2d90c6);}}; \ No newline at end of file +var _0x3a59=['attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','isNil','transfereechannel','assign','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','transfereruniqueid','error'];(function(_0x4d0899,_0x208802){var _0x5142de=function(_0x272e14){while(--_0x272e14){_0x4d0899['push'](_0x4d0899['shift']());}};_0x5142de(++_0x208802);}(_0x3a59,0x172));var _0x93a5=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x3a59[_0x22e9fe];return _0x47cd19;};'use strict';var _=require(_0x93a5('0x0'));var util=require(_0x93a5('0x1'));var utils=require(_0x93a5('0x2'));function writeDB(_0x35eb3d){utils[_0x93a5('0x3')](util[_0x93a5('0x4')](_0x93a5('0x5'),_0x35eb3d[_0x93a5('0x6')]==='attended'?_0x35eb3d[_0x93a5('0x7')]:_0x35eb3d['uniqueid'],_0x35eb3d[_0x93a5('0x6')]));utils[_0x93a5('0x8')](_0x93a5('0x9'),_0x35eb3d);}exports[_0x93a5('0xa')]={};exports[_0x93a5('0xb')]=function(_0x207ba3){try{utils[_0x93a5('0xc')](util[_0x93a5('0x4')](_0x93a5('0xd'),_0x207ba3[_0x93a5('0xe')]),_0x207ba3);utils[_0x93a5('0x3')](util[_0x93a5('0x4')](_0x93a5('0xf'),_0x207ba3[_0x93a5('0xe')],_0x207ba3['transferercalleridnum'],_0x207ba3[_0x93a5('0x10')],_0x207ba3['transfereecalleridnum'],_0x207ba3[_0x93a5('0x11')]));_0x207ba3[_0x93a5('0x6')]='blind';exports[_0x93a5('0xa')][_0x207ba3[_0x93a5('0x12')]]=_0x207ba3;writeDB(_0x207ba3);}catch(_0x10f2e1){utils[_0x93a5('0x13')](util[_0x93a5('0x4')]('[%s][transfers][blindtransfer]',_0x207ba3['uniqueid']),_0x10f2e1);}};exports[_0x93a5('0x14')]=function(_0x6bc17f){try{utils[_0x93a5('0xc')](util[_0x93a5('0x4')](_0x93a5('0x15'),_0x6bc17f[_0x93a5('0x7')]),_0x6bc17f);utils[_0x93a5('0x3')](util[_0x93a5('0x4')](_0x93a5('0x16'),_0x6bc17f[_0x93a5('0x7')],_0x6bc17f[_0x93a5('0x17')],_0x6bc17f[_0x93a5('0x18')],_0x6bc17f['transfertargetcalleridnum'],_0x6bc17f[_0x93a5('0x19')]));_0x6bc17f=_['assign'](_0x6bc17f,{'transfererchannel':_0x6bc17f['origtransfererchannel'],'transferercalleridnum':_0x6bc17f[_0x93a5('0x17')],'transferercalleridname':_0x6bc17f[_0x93a5('0x18')],'transfererconnectedlinenum':_0x6bc17f[_0x93a5('0x1a')],'transfererconnectedlinename':_0x6bc17f['secondtransfererconnectedlinename'],'transfereraccountcode':_0x6bc17f[_0x93a5('0x1b')],'transferercontext':_0x6bc17f[_0x93a5('0x1c')],'transfererexten':_0x6bc17f[_0x93a5('0x1d')],'transfererlinkedid':_0x6bc17f[_0x93a5('0x1e')],'context':_0x6bc17f[_0x93a5('0x1f')],'extension':_0x6bc17f['origtransfererexten'],'type':_0x93a5('0x20')});if(_[_0x93a5('0x21')](_0x6bc17f[_0x93a5('0x22')])){_0x6bc17f=_[_0x93a5('0x23')](_0x6bc17f,{'transfereechannel':_0x6bc17f['transfertargetchannel'],'transfereecalleridnum':_0x6bc17f['transfertargetcalleridnum'],'transfereecalleridname':_0x6bc17f[_0x93a5('0x19')],'transfereeconnectedlinenum':_0x6bc17f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x6bc17f[_0x93a5('0x24')],'transfereeaccountcode':_0x6bc17f[_0x93a5('0x25')],'transfereecontext':_0x6bc17f['transfertargetcontext'],'transfereeexten':_0x6bc17f[_0x93a5('0x26')],'transfereelinkedid':_0x6bc17f['transfertargetlinkedid']});}writeDB(_0x6bc17f);}catch(_0x1d1081){utils[_0x93a5('0x13')](util[_0x93a5('0x4')](_0x93a5('0x15'),_0x6bc17f[_0x93a5('0x7')]),_0x1d1081);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 4698512..a4c7c31 100644 --- a/server/services/xdr/utils.js +++ b/server/services/xdr/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xb10b,0x12a));var _0xbb10=function(_0x34d6bd,_0x55b744){_0x34d6bd=_0x34d6bd-0x0;var _0x248396=_0xb10b[_0x34d6bd];return _0x248396;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file +var _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb10b,0x12a));var _0xbb10=function(_0x161e88,_0x49ce5e){_0x161e88=_0x161e88-0x0;var _0x40ee62=_0xb10b[_0x161e88];return _0x40ee62;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file